]> git.sur5r.net Git - u-boot/blobdiff - drivers/serial/ns16550.c
rockchip: pinctrl: Reduce the size for SPL
[u-boot] / drivers / serial / ns16550.c
index d5bcbc3e3cfeddb3155a79bf3f653aced94dcf42..021b211ab4047c3b9c10322bf3a0b2662c18e02f 100644 (file)
@@ -368,7 +368,7 @@ int ns16550_serial_ofdata_to_platdata(struct udevice *dev)
 
        /* try Processor Local Bus device first */
        addr = dev_get_addr(dev);
-#ifdef CONFIG_PCI
+#if defined(CONFIG_PCI) && defined(CONFIG_DM_PCI)
        if (addr == FDT_ADDR_T_NONE) {
                /* then try pci device */
                struct fdt_pci_addr pci_addr;
@@ -389,8 +389,7 @@ int ns16550_serial_ofdata_to_platdata(struct udevice *dev)
                                return ret;
                }
 
-               ret = fdtdec_get_pci_bar32(gd->fdt_blob, dev->of_offset,
-                                          &pci_addr, &bar);
+               ret = fdtdec_get_pci_bar32(dev, &pci_addr, &bar);
                if (ret)
                        return ret;
 
@@ -403,7 +402,7 @@ int ns16550_serial_ofdata_to_platdata(struct udevice *dev)
 
        plat->base = addr;
        plat->reg_shift = fdtdec_get_int(gd->fdt_blob, dev->of_offset,
-                                        "reg-shift", 1);
+                                        "reg-shift", 0);
        plat->clock = fdtdec_get_int(gd->fdt_blob, dev->of_offset,
                                     "clock-frequency",
                                     CONFIG_SYS_NS16550_CLK);
@@ -428,6 +427,7 @@ static const struct udevice_id ns16550_serial_ids[] = {
        { .compatible = "ns16550" },
        { .compatible = "ns16550a" },
        { .compatible = "nvidia,tegra20-uart" },
+       { .compatible = "rockchip,rk3036-uart" },
        { .compatible = "snps,dw-apb-uart" },
        { .compatible = "ti,omap2-uart" },
        { .compatible = "ti,omap3-uart" },
@@ -439,6 +439,7 @@ static const struct udevice_id ns16550_serial_ids[] = {
 };
 #endif
 
+#if CONFIG_IS_ENABLED(SERIAL_PRESENT)
 U_BOOT_DRIVER(ns16550_serial) = {
        .name   = "ns16550_serial",
        .id     = UCLASS_SERIAL,
@@ -450,5 +451,7 @@ U_BOOT_DRIVER(ns16550_serial) = {
        .priv_auto_alloc_size = sizeof(struct NS16550),
        .probe = ns16550_serial_probe,
        .ops    = &ns16550_serial_ops,
+       .flags  = DM_FLAG_PRE_RELOC,
 };
+#endif
 #endif /* CONFIG_DM_SERIAL */