From patchwork Wed Apr 1 13:57:58 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andy Shevchenko X-Patchwork-Id: 237094 List-Id: U-Boot discussion From: andriy.shevchenko at linux.intel.com (Andy Shevchenko) Date: Wed, 1 Apr 2020 16:57:58 +0300 Subject: [PATCH v2 1/2] serial: ns16550: Revert "Move PCI access from ofdata_to_platdata() to probe()" Message-ID: <20200401135759.13197-1-andriy.shevchenko@linux.intel.com> The commit breaks serial console on the Intel Edison. This reverts commit 720f9e1fdb0c92d3fd16e1bfc25bcbd35612675c. Signed-off-by: Andy Shevchenko --- drivers/serial/ns16550.c | 40 ++++++++++++---------------------------- 1 file changed, 12 insertions(+), 28 deletions(-) diff --git a/drivers/serial/ns16550.c b/drivers/serial/ns16550.c index c1b303ffcb..1fcbc35015 100644 --- a/drivers/serial/ns16550.c +++ b/drivers/serial/ns16550.c @@ -479,40 +479,12 @@ static int ns16550_serial_getinfo(struct udevice *dev, return 0; } -#if CONFIG_IS_ENABLED(OF_CONTROL) && !CONFIG_IS_ENABLED(OF_PLATDATA) -static int ns1655_serial_set_base_addr(struct udevice *dev) -{ - fdt_addr_t addr; - struct ns16550_platdata *plat; - - plat = dev_get_platdata(dev); - - addr = dev_read_addr_pci(dev); - if (addr == FDT_ADDR_T_NONE) - return -EINVAL; - -#ifdef CONFIG_SYS_NS16550_PORT_MAPPED - plat->base = addr; -#else - plat->base = (unsigned long)map_physmem(addr, 0, MAP_NOCACHE); -#endif - - return 0; -} -#endif - int ns16550_serial_probe(struct udevice *dev) { struct NS16550 *const com_port = dev_get_priv(dev); struct reset_ctl_bulk reset_bulk; int ret; -#if CONFIG_IS_ENABLED(OF_CONTROL) && !CONFIG_IS_ENABLED(OF_PLATDATA) - ret = ns1655_serial_set_base_addr(dev); - if (ret) - return ret; -#endif - ret = reset_get_bulk(dev, &reset_bulk); if (!ret) reset_deassert_bulk(&reset_bulk); @@ -535,9 +507,21 @@ int ns16550_serial_ofdata_to_platdata(struct udevice *dev) { struct ns16550_platdata *plat = dev->platdata; const u32 port_type = dev_get_driver_data(dev); + fdt_addr_t addr; struct clk clk; int err; + /* try Processor Local Bus device first */ + addr = dev_read_addr_pci(dev); + if (addr == FDT_ADDR_T_NONE) + return -EINVAL; + +#ifdef CONFIG_SYS_NS16550_PORT_MAPPED + plat->base = addr; +#else + plat->base = (unsigned long)map_physmem(addr, 0, MAP_NOCACHE); +#endif + plat->reg_offset = dev_read_u32_default(dev, "reg-offset", 0); plat->reg_shift = dev_read_u32_default(dev, "reg-shift", 0); plat->reg_width = dev_read_u32_default(dev, "reg-io-width", 1); From patchwork Wed Apr 1 13:57:59 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andy Shevchenko X-Patchwork-Id: 237093 List-Id: U-Boot discussion From: andriy.shevchenko at linux.intel.com (Andy Shevchenko) Date: Wed, 1 Apr 2020 16:57:59 +0300 Subject: [PATCH v2 2/2] dm: core: Partial revert of "Allocate parent data separate from probing parent" In-Reply-To: <20200401135759.13197-1-andriy.shevchenko@linux.intel.com> References: <20200401135759.13197-1-andriy.shevchenko@linux.intel.com> Message-ID: <20200401135759.13197-2-andriy.shevchenko@linux.intel.com> This reverts commit 82de42fa1468 ("dm: core: Allocate parent data separate from probing parent") as a being a culprit for Apollo Lake breakage. Suggested-by: Wolfgang Wallner Signed-off-by: Andy Shevchenko --- drivers/core/device.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/core/device.c b/drivers/core/device.c index 89ea820d48..400767d9bd 100644 --- a/drivers/core/device.c +++ b/drivers/core/device.c @@ -392,10 +392,6 @@ int device_probe(struct udevice *dev) drv = dev->driver; assert(drv); - ret = device_ofdata_to_platdata(dev); - if (ret) - goto fail; - /* Ensure all parents are probed */ if (dev->parent) { ret = device_probe(dev->parent); @@ -412,6 +408,10 @@ int device_probe(struct udevice *dev) return 0; } + ret = device_ofdata_to_platdata(dev); + if (ret) + goto fail; + seq = uclass_resolve_seq(dev); if (seq < 0) { ret = seq;