Skip to contentSkip to conversation

serial: ns16550: Revert "Move PCI access from ofdata_to_platdata() to probe()"

PATCH Superseded Andy Shevchenko 7 participants 24 messages Apr 1, 2020 – Apr 6, 2020

v2 of 3 Superseded Latest is v3 →

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/2 serial: ns16550: Revert "Move PCI access from ofdata_to_platdata() to probe()"

The commit breaks serial console on the Intel Edison.

This reverts commit 720f9e1fdb0c92d3fd16e1bfc25bcbd35612675c.

---
 drivers/serial/ns16550.c | 40 ++++++++++++----------------------------
 1 file changed, 12 insertions(+), 28 deletions(-)
drivers/serial/ns16550.c +12 -28
index c1b303ffcb..1fcbc35015 100644
@@ -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);
Signature · 1 line
2.25.1
#1 lore raw

PATCH v2 2/2 dm: core: Partial revert of "Allocate parent data separate from probing parent"

This reverts commit 82de42fa1468
("dm: core: Allocate parent data separate from probing parent") as a being a culprit for Apollo Lake breakage.

---
 drivers/core/device.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)
drivers/core/device.c +4 -4
index 89ea820d48..400767d9bd 100644
@@ -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;
Signature · 1 line
2.25.1
#2 lore raw

PATCH v2 1/2 serial: ns16550: Revert "Move PCI access from ofdata_to_platdata() to probe()"

In reply to Andy Shevchenko

Hi Andy,

Quoted 10 lines · Andy Shevchenko

The commit breaks serial console on the Intel Edison.

This reverts commit 720f9e1fdb0c92d3fd16e1bfc25bcbd35612675c.

---
 drivers/serial/ns16550.c | 40 ++++++++++++----------------------------
 1 file changed, 12 insertions(+), 28 deletions(-)

Could you please spend some time to investigate why this breaks Intel Edison?

Reverting this patch would mean we break other boards too as Wolfgang's patch wanted to fix the breakage in the first place. Much appreciated!

Regards,
Bin

#3 lore raw

PATCH v2 1/2 serial: ns16550: Revert "Move PCI access from ofdata_to_platdata() to probe()"

Quoted 13 lines · Bin Meng
Quoted 10 lines · Andy Shevchenko

The commit breaks serial console on the Intel Edison.

This reverts commit 720f9e1fdb0c92d3fd16e1bfc25bcbd35612675c.

---
 drivers/serial/ns16550.c | 40 ++++++++++++----------------------------
 1 file changed, 12 insertions(+), 28 deletions(-)
Quoted 5 lines

Could you please spend some time to investigate why this breaks Intel Edison?

Reverting this patch would mean we break other boards too as Wolfgang's patch wanted to fix the breakage in the first place. Much appreciated!

I guess I'm wrong person here. The DM code is a complete black box to me. Nevertheless, I may test any provided fix / debug / etc patch by request.

And I think it's fair to investigate by the one who made a regression in the first place.

Signature · 2 lines
With Best Regards,
Andy Shevchenko
#4 lore raw

PATCH v2 1/2 serial: ns16550: Revert "Move PCI access from ofdata_to_platdata() to probe()"

Hi Andy,

Quoted 21 lines · Andy Shevchenko
Quoted 13 lines · Bin Meng
Quoted 10 lines · Andy Shevchenko

The commit breaks serial console on the Intel Edison.

This reverts commit 720f9e1fdb0c92d3fd16e1bfc25bcbd35612675c.

---
 drivers/serial/ns16550.c | 40 ++++++++++++----------------------------
 1 file changed, 12 insertions(+), 28 deletions(-)
Quoted 5 lines

Could you please spend some time to investigate why this breaks Intel Edison?

Reverting this patch would mean we break other boards too as Wolfgang's patch wanted to fix the breakage in the first place. Much appreciated!

Quoted 5 lines

I guess I'm wrong person here. The DM code is a complete black box to me. Nevertheless, I may test any provided fix / debug / etc patch by request.

And I think it's fair to investigate by the one who made a regression in the first place.

Given that we have conflicting breakages, we need to debug Edison. Does it enable the debug UART?

I have one but have not powered it on for a while, nor added it to my lab.

Regards,
Simon

#5 lore raw

PATCH v2 1/2 serial: ns16550: Revert "Move PCI access from ofdata_to_platdata() to probe()"

Quoted 24 lines · Simon Glass

Hi Andy,

Quoted 21 lines · Andy Shevchenko
Quoted 18 lines · Bin Meng
Quoted 10 lines · Andy Shevchenko

The commit breaks serial console on the Intel Edison.

This reverts commit 720f9e1fdb0c92d3fd16e1bfc25bcbd35612675c.

---
 drivers/serial/ns16550.c | 40 ++++++++++++----------------------------
 1 file changed, 12 insertions(+), 28 deletions(-)

Could you please spend some time to investigate why this breaks Intel Edison?

Reverting this patch would mean we break other boards too as Wolfgang's patch wanted to fix the breakage in the first place. Much appreciated!

Quoted 7 lines
Quoted 5 lines

I guess I'm wrong person here. The DM code is a complete black box to me. Nevertheless, I may test any provided fix / debug / etc patch by request.

And I think it's fair to investigate by the one who made a regression in the first place.

Given that we have conflicting breakages, we need to debug Edison.

I would glad to test any suggested change or debug patch!

Quoted 1 line

Does it enable the debug UART?

If I am not mistaken, it does not.

Signature · 2 lines
With Best Regards,
Andy Shevchenko
#6 lore raw

PATCH v2 1/2 serial: ns16550: Revert "Move PCI access from ofdata_to_platdata() to probe()"

Hi Andy,

Quoted 32 lines · Andy Shevchenko
Quoted 30 lines · Simon Glass

Hi Andy,

Quoted 26 lines · Andy Shevchenko
Quoted 13 lines · Bin Meng
Quoted 10 lines · Andy Shevchenko

The commit breaks serial console on the Intel Edison.

This reverts commit 720f9e1fdb0c92d3fd16e1bfc25bcbd35612675c.

---
 drivers/serial/ns16550.c | 40 ++++++++++++----------------------------
 1 file changed, 12 insertions(+), 28 deletions(-)
Quoted 5 lines

Could you please spend some time to investigate why this breaks Intel Edison?

Reverting this patch would mean we break other boards too as Wolfgang's patch wanted to fix the breakage in the first place. Much appreciated!

I guess I'm wrong person here. The DM code is a complete black box to me. Nevertheless, I may test any provided fix / debug / etc patch by request.

And I think it's fair to investigate by the one who made a regression in the first place.

Quoted 7 lines
Quoted 1 line

Given that we have conflicting breakages, we need to debug Edison.

I would glad to test any suggested change or debug patch!

Quoted 1 line

Does it enable the debug UART?

If I am not mistaken, it does not.

Looks like you are right. If you know the address you could do that - see minnowmax for an example.

- Simon

#7 lore raw

PATCH v2 1/2 serial: ns16550: Revert "Move PCI access from ofdata_to_platdata() to probe()"

Hi Simon, Andy,

Quoted 38 lines · Simon Glass

Hi Andy,

Quoted 34 lines · Andy Shevchenko
Quoted 31 lines · Simon Glass

Hi Andy,

Quoted 21 lines · Andy Shevchenko
Quoted 13 lines · Bin Meng
Quoted 10 lines · Andy Shevchenko

The commit breaks serial console on the Intel Edison.

This reverts commit 720f9e1fdb0c92d3fd16e1bfc25bcbd35612675c.

---
 drivers/serial/ns16550.c | 40 ++++++++++++----------------------------
 1 file changed, 12 insertions(+), 28 deletions(-)
Quoted 5 lines

Could you please spend some time to investigate why this breaks Intel Edison?

Reverting this patch would mean we break other boards too as Wolfgang's patch wanted to fix the breakage in the first place. Much appreciated!

Quoted 5 lines

I guess I'm wrong person here. The DM code is a complete black box to me. Nevertheless, I may test any provided fix / debug / etc patch by request.

And I think it's fair to investigate by the one who made a regression in the first place.

Given that we have conflicting breakages, we need to debug Edison.

Quoted 8 lines
Quoted 5 lines

I would glad to test any suggested change or debug patch!

Quoted 1 line

Does it enable the debug UART?

If I am not mistaken, it does not.

Looks like you are right. If you know the address you could do that - see minnowmax for an example.

Please suggest what's the best approach to proceed.

Regards,
Bin

#8 lore raw

PATCH v2 1/2 serial: ns16550: Revert "Move PCI access from ofdata_to_platdata() to probe()"

Quoted 43 lines · Bin Meng

Hi Simon, Andy,

Quoted 40 lines · Simon Glass

Hi Andy,

Quoted 36 lines · Andy Shevchenko
Quoted 24 lines · Simon Glass

Hi Andy,

Quoted 21 lines · Andy Shevchenko
Quoted 18 lines · Bin Meng
Quoted 10 lines · Andy Shevchenko

The commit breaks serial console on the Intel Edison.

This reverts commit 720f9e1fdb0c92d3fd16e1bfc25bcbd35612675c.

---
 drivers/serial/ns16550.c | 40 ++++++++++++----------------------------
 1 file changed, 12 insertions(+), 28 deletions(-)

Could you please spend some time to investigate why this breaks Intel Edison?

Reverting this patch would mean we break other boards too as Wolfgang's patch wanted to fix the breakage in the first place. Much appreciated!

Quoted 7 lines
Quoted 5 lines

I guess I'm wrong person here. The DM code is a complete black box to me. Nevertheless, I may test any provided fix / debug / etc patch by request.

And I think it's fair to investigate by the one who made a regression in the first place.

Given that we have conflicting breakages, we need to debug Edison.

I would glad to test any suggested change or debug patch!

Quoted 8 lines
Quoted 6 lines
Quoted 3 lines
Quoted 1 line

Does it enable the debug UART?

If I am not mistaken, it does not.

Looks like you are right. If you know the address you could do that - see minnowmax for an example.

Please suggest what's the best approach to proceed.

Adding SoCFPGA folks to this thread as the first commit (82de42fa1468) is also breaking platforms there and then their fix for that problem is also causing problems, if I follow right.

Signature · 8 lines
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 659 bytes
Desc: not available
URL: <https://lists.denx.de/pipermail/u-boot/attachments/20200402/a337622c/attachment.sig>
#9 lore raw

PATCH v2 1/2 serial: ns16550: Revert "Move PCI access from ofdata_to_platdata() to probe()"

Quoted 58 lines · Bin Meng
Quoted 7 lines

Hi Simon, Andy,

Quoted 4 lines · Simon Glass

Hi Andy,

On Wed, 1 Apr 2020 at 11:39, Andy Shevchenko

Quoted 5 lines · <[email protected]> wrote:
Quoted 5 lines
Quoted 5 lines · Simon Glass
Quoted 3 lines

Hi Andy,

On Wed, 1 Apr 2020 at 08:45, Andy Shevchenko

Quoted 2 lines · <[email protected]> wrote:
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines

On Wed, Apr 1, 2020 at 5:32 PM Bin Meng <[email protected]>

Quoted 15 lines · wrote:
Quoted 15 lines
Quoted 15 lines
Quoted 15 lines
Quoted 15 lines
Quoted 15 lines
Quoted 12 lines · Andy Shevchenko

The commit breaks serial console on the Intel Edison.

This reverts commit 720f9e1fdb0c92d3fd16e1bfc25bcbd35612675c.

Signed-off-by: Andy Shevchenko
<[email protected]>

---
 drivers/serial/ns16550.c | 40
++++++++++++----------------------------
 1 file changed, 12 insertions(+), 28 deletions(-)
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

Could you please spend some time to investigate why this breaks Intel

Edison?

Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 4 lines

Reverting this patch would mean we break other boards too as Wolfgang's patch wanted to fix the breakage in the first place. Much appreciated!

I guess I'm wrong person here. The DM code is a complete black box to

me.

Quoted 16 lines
Quoted 15 lines
Quoted 5 lines
Quoted 5 lines
Quoted 4 lines

Nevertheless, I may test any provided fix / debug / etc patch by request.

And I think it's fair to investigate by the one who made a regression in the first place.

Quoted 7 lines
Quoted 1 line

Given that we have conflicting breakages, we need to debug Edison.

I would glad to test any suggested change or debug patch!

Quoted 1 line

Does it enable the debug UART?

If I am not mistaken, it does not.

Looks like you are right. If you know the address you could do that
- see minnowmax for an example.

Quoted 8 lines
Quoted 1 line

Please suggest what's the best approach to proceed.

Adding SoCFPGA folks to this thread as the first commit (82de42fa1468) is also breaking platforms there and then their fix for that problem is also causing problems, if I follow right.

--
Tom

Yes. This commit (82de42fa1468) breaks our A10 platform.
I did submit similar patch to move some init code from ofdata_to_platdata() to probe() for our clock driver as well. Check out the thread here:
https://lists.denx.de/pipermail/u-boot/2020-April/405252.html

#10 lore raw

PATCH v2 1/2 serial: ns16550: Revert "Move PCI access from ofdata_to_platdata() to probe()"

Quoted 51 lines · Chee Hong
Quoted 51 lines · Bin Meng
Quoted 2 lines · Simon Glass
Quoted 1 line

On Wed, 1 Apr 2020 at 11:39, Andy Shevchenko

Quoted 2 lines · <[email protected]> wrote:
Quoted 2 lines
Quoted 2 lines · Simon Glass
Quoted 1 line

On Wed, 1 Apr 2020 at 08:45, Andy Shevchenko

Quoted 1 line · <[email protected]> wrote:
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

On Wed, Apr 1, 2020 at 5:32 PM Bin Meng <[email protected]>

Quoted 15 lines · wrote:
Quoted 15 lines
Quoted 15 lines
Quoted 15 lines
Quoted 15 lines
Quoted 15 lines
Quoted 12 lines · Andy Shevchenko

The commit breaks serial console on the Intel Edison.

This reverts commit 720f9e1fdb0c92d3fd16e1bfc25bcbd35612675c.

Signed-off-by: Andy Shevchenko
<[email protected]>

---
 drivers/serial/ns16550.c | 40
++++++++++++----------------------------
 1 file changed, 12 insertions(+), 28 deletions(-)
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

Could you please spend some time to investigate why this breaks Intel

Edison?

Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 4 lines

Reverting this patch would mean we break other boards too as Wolfgang's patch wanted to fix the breakage in the first place. Much appreciated!

I guess I'm wrong person here. The DM code is a complete black box to

me.

Quoted 17 lines
Quoted 7 lines
Quoted 7 lines
Quoted 6 lines
Quoted 4 lines

Nevertheless, I may test any provided fix / debug / etc patch by request.

And I think it's fair to investigate by the one who made a regression in the first place.

Given that we have conflicting breakages, we need to debug Edison.

Quoted 8 lines
Quoted 5 lines

I would glad to test any suggested change or debug patch!

Quoted 1 line

Does it enable the debug UART?

If I am not mistaken, it does not.

Looks like you are right. If you know the address you could do that
- see minnowmax for an example.

Please suggest what's the best approach to proceed.

Quoted 8 lines
Quoted 3 lines

Adding SoCFPGA folks to this thread as the first commit (82de42fa1468) is also breaking platforms there and then their fix for that problem is also causing problems, if I follow right.

Yes. This commit (82de42fa1468) breaks our A10 platform.
I did submit similar patch to move some init code from ofdata_to_platdata() to probe() for our clock driver as well. Check out the thread here:
https://lists.denx.de/pipermail/u-boot/2020-April/405252.html

I see half or less of the messages in the thread by above link. Can you summarize what should have been done in order to fix this?

Signature · 2 lines
With Best Regards,
Andy Shevchenko
#11 lore raw

PATCH v2 1/2 serial: ns16550: Revert "Move PCI access from ofdata_to_platdata() to probe()"

Quoted 63 lines
Quoted 9 lines · Chee Hong
Quoted 9 lines · Bin Meng
Quoted 2 lines · Simon Glass
Quoted 1 line

On Wed, 1 Apr 2020 at 11:39, Andy Shevchenko

Quoted 2 lines · <[email protected]> wrote:
Quoted 2 lines
Quoted 2 lines · Simon Glass
Quoted 1 line

On Wed, 1 Apr 2020 at 08:45, Andy Shevchenko

Quoted 2 lines · <[email protected]> wrote:
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines

On Wed, Apr 1, 2020 at 5:32 PM Bin Meng
<[email protected]>

Quoted 7 lines
Quoted 7 lines
Quoted 6 lines · wrote:
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 4 lines · Andy Shevchenko

The commit breaks serial console on the Intel Edison.

This reverts commit

720f9e1fdb0c92d3fd16e1bfc25bcbd35612675c.

Quoted 13 lines
Quoted 13 lines
Quoted 11 lines
Quoted 11 lines
Quoted 11 lines
Quoted 11 lines
Quoted 11 lines
Quoted 11 lines
Quoted 8 lines

Signed-off-by: Andy Shevchenko
<[email protected]>

---
 drivers/serial/ns16550.c | 40
++++++++++++----------------------------
 1 file changed, 12 insertions(+), 28 deletions(-)

Could you please spend some time to investigate why this breaks Intel

Edison?

Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 8 lines
Quoted 8 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 3 lines

Reverting this patch would mean we break other boards too as Wolfgang's patch wanted to fix the breakage in the first place. Much appreciated!

I guess I'm wrong person here. The DM code is a complete black box to

me.

Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

Nevertheless, I may test any provided fix / debug / etc patch by

request.

Quoted 21 lines
Quoted 21 lines
Quoted 10 lines
Quoted 10 lines
Quoted 10 lines
Quoted 5 lines
Quoted 3 lines

And I think it's fair to investigate by the one who made a regression in the first place.

Given that we have conflicting breakages, we need to debug Edison.

I would glad to test any suggested change or debug patch!

Quoted 1 line

Does it enable the debug UART?

Quoted 7 lines
Quoted 5 lines
Quoted 1 line

If I am not mistaken, it does not.

Looks like you are right. If you know the address you could do that
- see minnowmax for an example.

Please suggest what's the best approach to proceed.

Adding SoCFPGA folks to this thread as the first commit (82de42fa1468) is also breaking platforms there and then their fix for that problem is also causing problems, if I follow right.

Quoted 8 lines
Quoted 2 lines

Yes. This commit (82de42fa1468) breaks our A10 platform.
I did submit similar patch to move some init code from ofdata_to_platdata() to

probe() for our clock driver as well.

Quoted 2 lines

Check out the thread here:
https://lists.denx.de/pipermail/u-boot/2020-April/405252.html

I see half or less of the messages in the thread by above link. Can you summarize what should have been done in order to fix this?

1) Fix in the driver (broken by this commit: 82de42fa1468) by moving some code from ofdata_to_platdata() to probe().
2) Fix the DM core.
Simon and Marek were discussing about these 2 options.
Perhaps Simon can help shed some light here.

Quoted 4 lines

--
With Best Regards,
Andy Shevchenko

#12 lore raw

PATCH v2 1/2 serial: ns16550: Revert "Move PCI access from ofdata_to_platdata() to probe()"

Quoted 20 lines · Chee Hong
Quoted 20 lines
Quoted 5 lines · Chee Hong
Quoted 5 lines · Bin Meng
Quoted 4 lines · Simon Glass
Quoted 3 lines

On Wed, 1 Apr 2020 at 11:39, Andy Shevchenko

Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

This reverts commit

720f9e1fdb0c92d3fd16e1bfc25bcbd35612675c.

Quoted 6 lines
Quoted 3 lines

Adding SoCFPGA folks to this thread as the first commit (82de42fa1468) is also breaking platforms there and then their fix for that problem is also causing problems, if I follow right.

Yes. This commit (82de42fa1468) breaks our A10 platform.
I did submit similar patch to move some init code from ofdata_to_platdata() to

probe() for our clock driver as well.

Quoted 2 lines

Check out the thread here:
https://lists.denx.de/pipermail/u-boot/2020-April/405252.html

Quoted 6 lines
Quoted 2 lines

I see half or less of the messages in the thread by above link. Can you summarize what should have been done in order to fix this?

1) Fix in the driver (broken by this commit: 82de42fa1468) by moving some code from ofdata_to_platdata() to probe().
2) Fix the DM core.
Simon and Marek were discussing about these 2 options.
Perhaps Simon can help shed some light here.

I have a question. Does revert of 720f9e1fdb0c92d3fd16e1bfc25bcbd35612675c makes any difference to SoCFPGA?

Signature · 2 lines
With Best Regards,
Andy Shevchenko
#13 lore raw

PATCH v2 1/2 serial: ns16550: Revert "Move PCI access from ofdata_to_platdata() to probe()"

Quoted 28 lines
Quoted 6 lines · Chee Hong
Quoted 6 lines
Quoted 2 lines · Chee Hong
Quoted 2 lines · Bin Meng
Quoted 1 line

On Thu, Apr 2, 2020 at 1:55 AM Simon Glass <[email protected]>

Quoted 12 lines · wrote:
Quoted 12 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines

On Wed, 1 Apr 2020 at 11:39, Andy Shevchenko

Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

This reverts commit

720f9e1fdb0c92d3fd16e1bfc25bcbd35612675c.

Quoted 7 lines
Quoted 3 lines

Adding SoCFPGA folks to this thread as the first commit (82de42fa1468) is also breaking platforms there and then their fix for that problem is also causing problems, if I follow right.

Yes. This commit (82de42fa1468) breaks our A10 platform. I did submit similar patch to move some init code from ofdata_to_platdata() to

Quoted 7 lines
Quoted 6 lines

probe() for our clock driver as well.

Quoted 2 lines

Check out the thread here:
https://lists.denx.de/pipermail/u-boot/2020-April/405252.html

I see half or less of the messages in the thread by above link. Can you summarize what should have been done in order to fix this?

1) Fix in the driver (broken by this commit: 82de42fa1468) by moving some

Quoted 8 lines

code from ofdata_to_platdata() to probe().

Quoted 3 lines

2) Fix the DM core.
Simon and Marek were discussing about these 2 options. Perhaps Simon can help shed some light here.

I have a question. Does revert of 720f9e1fdb0c92d3fd16e1bfc25bcbd35612675c makes any difference to SoCFPGA?

This commit: 82de42fa1468 break our SoCFPGA A10 clock driver.
This commit 720f9e1fdb0c92d3fd16e1bfc25bcbd35612675c does not affect our SoCFPGA platforms. We just want to know which way to go. Fixing our A10 clock driver or fix the DM core. Seems like this commit 720f9e1fdb0c92d3fd16e1bfc25bcbd35612675c go with option 1 (fixing the driver).

Quoted 4 lines

--
With Best Regards,
Andy Shevchenko

#14 lore raw

PATCH v2 1/2 serial: ns16550: Revert "Move PCI access from ofdata_to_platdata() to probe()"

Quoted 33 lines · Chee Hong
Quoted 33 lines
Quoted 6 lines · Chee Hong
Quoted 6 lines
Quoted 2 lines · Chee Hong
Quoted 2 lines · Bin Meng
Quoted 1 line

On Thu, Apr 2, 2020 at 1:55 AM Simon Glass <[email protected]>

Quoted 12 lines · wrote:
Quoted 12 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines

On Wed, 1 Apr 2020 at 11:39, Andy Shevchenko

Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

This reverts commit

720f9e1fdb0c92d3fd16e1bfc25bcbd35612675c.

Quoted 7 lines
Quoted 3 lines

Adding SoCFPGA folks to this thread as the first commit (82de42fa1468) is also breaking platforms there and then their fix for that problem is also causing problems, if I follow right.

Yes. This commit (82de42fa1468) breaks our A10 platform. I did submit similar patch to move some init code from ofdata_to_platdata() to

Quoted 7 lines
Quoted 6 lines

probe() for our clock driver as well.

Quoted 2 lines

Check out the thread here:
https://lists.denx.de/pipermail/u-boot/2020-April/405252.html

I see half or less of the messages in the thread by above link. Can you summarize what should have been done in order to fix this?

1) Fix in the driver (broken by this commit: 82de42fa1468) by moving some

code from ofdata_to_platdata() to probe().

Quoted 3 lines

2) Fix the DM core.
Simon and Marek were discussing about these 2 options. Perhaps Simon can help shed some light here.

Quoted 7 lines
Quoted 3 lines

I have a question. Does revert of 720f9e1fdb0c92d3fd16e1bfc25bcbd35612675c makes any difference to SoCFPGA?

This commit: 82de42fa1468 break our SoCFPGA A10 clock driver.
This commit 720f9e1fdb0c92d3fd16e1bfc25bcbd35612675c does not affect our SoCFPGA platforms. We just want to know which way to go. Fixing our A10 clock driver or fix the DM core. Seems like this commit 720f9e1fdb0c92d3fd16e1bfc25bcbd35612675c go with option 1 (fixing the driver).

I dunno what 720f9e is actually fixing, it breaks definitely the ordering.

So, I'm going to send a v3 of revert of 720f9e since it is not related to SoCFPGA.

Signature · 2 lines
With Best Regards,
Andy Shevchenko
#15 lore raw

PATCH v2 1/2 serial: ns16550: Revert "Move PCI access from ofdata_to_platdata() to probe()"

In reply to Ang

Hi Chee Hong,

Quoted 34 lines · Chee Hong
Quoted 34 lines
Quoted 6 lines · Chee Hong
Quoted 6 lines
Quoted 2 lines · Chee Hong
Quoted 2 lines · Bin Meng
Quoted 1 line

On Thu, Apr 2, 2020 at 1:55 AM Simon Glass <[email protected]>

Quoted 12 lines · wrote:
Quoted 12 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines

On Wed, 1 Apr 2020 at 11:39, Andy Shevchenko

Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

This reverts commit

720f9e1fdb0c92d3fd16e1bfc25bcbd35612675c.

Quoted 7 lines
Quoted 3 lines

Adding SoCFPGA folks to this thread as the first commit (82de42fa1468) is also breaking platforms there and then their fix for that problem is also causing problems, if I follow right.

Yes. This commit (82de42fa1468) breaks our A10 platform. I did submit similar patch to move some init code from ofdata_to_platdata() to

Quoted 7 lines
Quoted 6 lines

probe() for our clock driver as well.

Quoted 2 lines

Check out the thread here:
https://lists.denx.de/pipermail/u-boot/2020-April/405252.html

I see half or less of the messages in the thread by above link. Can you summarize what should have been done in order to fix this?

1) Fix in the driver (broken by this commit: 82de42fa1468) by moving some

code from ofdata_to_platdata() to probe().

Quoted 3 lines

2) Fix the DM core.
Simon and Marek were discussing about these 2 options. Perhaps Simon can help shed some light here.

Quoted 7 lines
Quoted 3 lines

I have a question. Does revert of 720f9e1fdb0c92d3fd16e1bfc25bcbd35612675c makes any difference to SoCFPGA?

This commit: 82de42fa1468 break our SoCFPGA A10 clock driver.
This commit 720f9e1fdb0c92d3fd16e1bfc25bcbd35612675c does not affect our SoCFPGA platforms. We just want to know which way to go. Fixing our A10 clock driver or fix the DM core. Seems like this commit 720f9e1fdb0c92d3fd16e1bfc25bcbd35612675c go with option 1 (fixing the driver).

For now you should fix your clock driver as it is too late to make a change to the DM core.

For your particular case, running ofdata_to_platdata() on parent devices might be enough to get your clock driver running, so after the release we can figure that out.

Regards,
SImon

#16 lore raw

PATCH v2 1/2 serial: ns16550: Revert "Move PCI access from ofdata_to_platdata() to probe()"

In reply to Bin Meng
Quoted 34 lines · Bin Meng
Quoted 33 lines · Simon Glass
Quoted 32 lines · Andy Shevchenko
Quoted 21 lines · Simon Glass
Quoted 20 lines · Andy Shevchenko
Quoted 18 lines · Bin Meng
Quoted 10 lines · Andy Shevchenko

The commit breaks serial console on the Intel Edison.

This reverts commit 720f9e1fdb0c92d3fd16e1bfc25bcbd35612675c.

---
 drivers/serial/ns16550.c | 40 ++++++++++++----------------------------
 1 file changed, 12 insertions(+), 28 deletions(-)

Could you please spend some time to investigate why this breaks Intel Edison?

Reverting this patch would mean we break other boards too as Wolfgang's patch wanted to fix the breakage in the first place. Much appreciated!

Quoted 7 lines
Quoted 5 lines

I guess I'm wrong person here. The DM code is a complete black box to me. Nevertheless, I may test any provided fix / debug / etc patch by request.

And I think it's fair to investigate by the one who made a regression in the first place.

Given that we have conflicting breakages, we need to debug Edison.

I would glad to test any suggested change or debug patch!

Quoted 8 lines
Quoted 6 lines
Quoted 3 lines
Quoted 1 line

Does it enable the debug UART?

If I am not mistaken, it does not.

Looks like you are right. If you know the address you could do that - see minnowmax for an example.

Please suggest what's the best approach to proceed.

I think I understand what happened, and Wolfgang's patch *is* a culprit.

In serial_intel_mid.c we setup a divisor before probing the actual device. Now, since the address retrieving has been moved further in the initialization, we are writing to unknown registers and thus don't properly initialize hardware.

So, the proper fix would be in my opinion to introduce a call back or some other way to make ordering possible, like registering hw_init callback in probe which will be called in the ns16550, or even do this as a callback for all serial class drivers.

I don't dare to dive into this anticipating that crap will hit the fan. So, please, who is knowing serial code, fix this asap!

Signature · 2 lines
With Best Regards,
Andy Shevchenko
#17 lore raw

PATCH v2 1/2 serial: ns16550: Revert "Move PCI access from ofdata_to_platdata() to probe()"

+Cc: Chee Hong

Quoted 63 lines · Andy Shevchenko
Quoted 34 lines · Bin Meng
Quoted 33 lines · Simon Glass
Quoted 32 lines · Andy Shevchenko
Quoted 21 lines · Simon Glass
Quoted 20 lines · Andy Shevchenko
Quoted 18 lines · Bin Meng
Quoted 10 lines · Andy Shevchenko

The commit breaks serial console on the Intel Edison.

This reverts commit 720f9e1fdb0c92d3fd16e1bfc25bcbd35612675c.

---
 drivers/serial/ns16550.c | 40 ++++++++++++----------------------------
 1 file changed, 12 insertions(+), 28 deletions(-)

Could you please spend some time to investigate why this breaks Intel Edison?

Reverting this patch would mean we break other boards too as Wolfgang's patch wanted to fix the breakage in the first place. Much appreciated!

Quoted 7 lines
Quoted 5 lines

I guess I'm wrong person here. The DM code is a complete black box to me. Nevertheless, I may test any provided fix / debug / etc patch by request.

And I think it's fair to investigate by the one who made a regression in the first place.

Given that we have conflicting breakages, we need to debug Edison.

I would glad to test any suggested change or debug patch!

Quoted 8 lines
Quoted 6 lines
Quoted 3 lines
Quoted 1 line

Does it enable the debug UART?

If I am not mistaken, it does not.

Looks like you are right. If you know the address you could do that - see minnowmax for an example.

Please suggest what's the best approach to proceed.

I think I understand what happened, and Wolfgang's patch *is* a culprit.

In serial_intel_mid.c we setup a divisor before probing the actual device. Now, since the address retrieving has been moved further in the initialization, we are writing to unknown registers and thus don't properly initialize hardware.

So, the proper fix would be in my opinion to introduce a call back or some other way to make ordering possible, like registering hw_init callback in probe which will be called in the ns16550, or even do this as a callback for all serial class drivers.

I don't dare to dive into this anticipating that crap will hit the fan. So, please, who is knowing serial code, fix this asap!

--
With Best Regards,
Andy Shevchenko

Signature · 2 lines
With Best Regards,
Andy Shevchenko
#18 lore raw

Antwort: Re: [PATCH v2 1/2] serial: ns16550: Revert "Move PCI access from ofdata_to_platdata() to probe()"

In reply to Andy Shevchenko

Hi Andy, Bin,

Quoted 43 lines

-----"Andy Shevchenko" <[email protected]> schrieb: -----

Quoted 41 lines · Bin Meng
Quoted 39 lines · Simon Glass
Quoted 28 lines · Andy Shevchenko
Quoted 27 lines · Simon Glass
Quoted 25 lines · Andy Shevchenko
Quoted 13 lines · Bin Meng
Quoted 10 lines · Andy Shevchenko

The commit breaks serial console on the Intel Edison.

This reverts commit 720f9e1fdb0c92d3fd16e1bfc25bcbd35612675c.

---
 drivers/serial/ns16550.c | 40 ++++++++++++----------------------------
 1 file changed, 12 insertions(+), 28 deletions(-)
Quoted 5 lines

Could you please spend some time to investigate why this breaks Intel Edison?

Reverting this patch would mean we break other boards too as Wolfgang's patch wanted to fix the breakage in the first place. Much appreciated!

I guess I'm wrong person here. The DM code is a complete black box to me. Nevertheless, I may test any provided fix / debug / etc patch by request.

And I think it's fair to investigate by the one who made a regression in the first place.

Quoted 7 lines
Quoted 1 line

Given that we have conflicting breakages, we need to debug Edison.

I would glad to test any suggested change or debug patch!

Quoted 1 line

Does it enable the debug UART?

If I am not mistaken, it does not.

Looks like you are right. If you know the address you could do that - see minnowmax for an example.

Quoted 8 lines
Quoted 1 line

Please suggest what's the best approach to proceed.

I think I understand what happened, and Wolfgang's patch *is* a culprit.

In serial_intel_mid.c we setup a divisor before probing the actual device. Now, since the address retrieving has been moved further in the initialization, we are writing to unknown registers and thus don't properly initialize hardware.

Yes, you are right, mid_serial_probe() relies on plat->base being set by ns16550_serial_ofdata_to_platdata().

I was not aware that other drivers rely on ns16550 in this way. And now that I know I see that there are few more:

  $ grep -r -l --include='*.c' -e ns16550_serial_probe -e ns16550_serial_ofdata_to_platdata
  drivers/serial/serial_intel_mid.c
  drivers/serial/serial_rockchip.c
  drivers/serial/serial_omap.c
  drivers/serial/ns16550.c
  arch/x86/cpu/apollolake/uart.c
  arch/x86/cpu/slimbootloader/serial.c

This means my patch has a wider impact than what I have taken care of.

@Bin: I'm fine with reverting 720f9e1 for now. I will come back with a new revision of this patch when I had the time to look at the other impacted drivers.

But reverting 720f9e1 is IMHO only a temporary workaround, as the underlying problem (possible PCI access in ofdata_to_platdata()) should be fixed anyway, at least my interpretation of the comment in drivers/pci/pci-uclass.c is that this PCI access should not be there:

"A common cause of this problem is that this function is called in the ofdata_to_platdata() method of @dev. Accessing the PCI bus in that method is not allowed, since it has not yet been probed. To fix this, move that access to the probe() method of @dev instead."

@Andy: Regarding serial_intel_mid: I don't know the hardware, but would it be possible to move the register accesses after the call to ns16550_serial_probe()?

   mid_writel(plat, UART_MUL, 96);
   mid_writel(plat, UART_DIV, 125);
   mid_writel(plat, UART_PS, 16);

   return ns16550_serial_probe(dev);
Quoted 7 lines

So, the proper fix would be in my opinion to introduce a call back or some other way to make ordering possible, like registering hw_init callback in probe which will be called in the ns16550, or even do this as a callback for all serial class drivers.

I don't dare to dive into this anticipating that crap will hit the fan. So, please, who is knowing serial code, fix this asap!

regards, Wolfgang

#19 lore raw

PATCH v2 1/2 serial: ns16550: Revert "Move PCI access from ofdata_to_platdata() to probe()"

Hi Wolfgang,

Quoted 81 lines · Wolfgang Wallner

Hi Andy, Bin,

Quoted 43 lines

-----"Andy Shevchenko" <[email protected]> schrieb: -----

Quoted 41 lines · Bin Meng
Quoted 39 lines · Simon Glass
Quoted 28 lines · Andy Shevchenko
Quoted 27 lines · Simon Glass
Quoted 25 lines · Andy Shevchenko
Quoted 13 lines · Bin Meng
Quoted 10 lines · Andy Shevchenko

The commit breaks serial console on the Intel Edison.

This reverts commit 720f9e1fdb0c92d3fd16e1bfc25bcbd35612675c.

---
 drivers/serial/ns16550.c | 40 ++++++++++++----------------------------
 1 file changed, 12 insertions(+), 28 deletions(-)
Quoted 5 lines

Could you please spend some time to investigate why this breaks Intel Edison?

Reverting this patch would mean we break other boards too as Wolfgang's patch wanted to fix the breakage in the first place. Much appreciated!

I guess I'm wrong person here. The DM code is a complete black box to me. Nevertheless, I may test any provided fix / debug / etc patch by request.

And I think it's fair to investigate by the one who made a regression in the first place.

Quoted 7 lines
Quoted 1 line

Given that we have conflicting breakages, we need to debug Edison.

I would glad to test any suggested change or debug patch!

Quoted 1 line

Does it enable the debug UART?

If I am not mistaken, it does not.

Looks like you are right. If you know the address you could do that - see minnowmax for an example.

Quoted 8 lines
Quoted 1 line

Please suggest what's the best approach to proceed.

I think I understand what happened, and Wolfgang's patch *is* a culprit.

In serial_intel_mid.c we setup a divisor before probing the actual device. Now, since the address retrieving has been moved further in the initialization, we are writing to unknown registers and thus don't properly initialize hardware.

Yes, you are right, mid_serial_probe() relies on plat->base being set by ns16550_serial_ofdata_to_platdata().

I was not aware that other drivers rely on ns16550 in this way. And now that I know I see that there are few more:

  $ grep -r -l --include='*.c' -e ns16550_serial_probe -e ns16550_serial_ofdata_to_platdata
  drivers/serial/serial_intel_mid.c
  drivers/serial/serial_rockchip.c
  drivers/serial/serial_omap.c
  drivers/serial/ns16550.c
  arch/x86/cpu/apollolake/uart.c
  arch/x86/cpu/slimbootloader/serial.c

This means my patch has a wider impact than what I have taken care of.

@Bin: I'm fine with reverting 720f9e1 for now. I will come back with a new revision of this patch when I had the time to look at the other impacted drivers.

But reverting 720f9e1 is IMHO only a temporary workaround, as the underlying problem (possible PCI access in ofdata_to_platdata()) should be fixed anyway, at least my interpretation of the comment in drivers/pci/pci-uclass.c is that this PCI access should not be there:

Quoted 5 lines

"A common cause of this problem is that this function is called in the ofdata_to_platdata() method of @dev. Accessing the PCI bus in that method is not allowed, since it has not yet been probed. To fix this, move that access to the probe() method of @dev instead."

Yes, when I looked at this, I wonder why the first commit was introduced. Simon, could you please explain more about the DM changes below?

commit 82de42fa14682d408da935adfb0f935354c5008f

Author: Simon Glass <[email protected]>
Date:   Sun Dec 29 21:19:18 2019 -0700

dm: core: Allocate parent data separate from probing parent

At present the parent is probed before the child's ofdata_to_platdata() method is called. Adjust the logic slightly so that probing parents is not done until afterwards.

Quoted 4 lines

@Andy: Regarding serial_intel_mid: I don't know the hardware, but would it be possible to move the register accesses after the call to ns16550_serial_probe()?

I suspect this does not work.

Quoted 14 lines
   mid_writel(plat, UART_MUL, 96);
   mid_writel(plat, UART_DIV, 125);
   mid_writel(plat, UART_PS, 16);

   return ns16550_serial_probe(dev);
Quoted 7 lines

So, the proper fix would be in my opinion to introduce a call back or some other way to make ordering possible, like registering hw_init callback in probe which will be called in the ns16550, or even do this as a callback for all serial class drivers.

I don't dare to dive into this anticipating that crap will hit the fan. So, please, who is knowing serial code, fix this asap!

I am currently working on a patch. Will send out for Andy and you for testing soon.

Regards,
Bin

#20 lore raw

PATCH v2 1/2 serial: ns16550: Revert "Move PCI access from ofdata_to_platdata() to probe()"

Quoted 4 lines · Bin Meng
Quoted 2 lines · Wolfgang Wallner
Quoted 2 lines

-----"Andy Shevchenko" <[email protected]> schrieb: ----- On Thu, Apr 2, 2020 at 7:55 AM Bin Meng <[email protected]> wrote:

...

Quoted 52 lines
Quoted 32 lines
Quoted 6 lines

I think I understand what happened, and Wolfgang's patch *is* a culprit.

In serial_intel_mid.c we setup a divisor before probing the actual device. Now, since the address retrieving has been moved further in the initialization, we are writing to unknown registers and thus don't properly initialize hardware.

Yes, you are right, mid_serial_probe() relies on plat->base being set by ns16550_serial_ofdata_to_platdata().

I was not aware that other drivers rely on ns16550 in this way. And now that I know I see that there are few more:

  $ grep -r -l --include='*.c' -e ns16550_serial_probe -e ns16550_serial_ofdata_to_platdata
  drivers/serial/serial_intel_mid.c
  drivers/serial/serial_rockchip.c
  drivers/serial/serial_omap.c
  drivers/serial/ns16550.c
  arch/x86/cpu/apollolake/uart.c
  arch/x86/cpu/slimbootloader/serial.c

This means my patch has a wider impact than what I have taken care of.

@Bin: I'm fine with reverting 720f9e1 for now. I will come back with a new revision of this patch when I had the time to look at the other impacted drivers.

But reverting 720f9e1 is IMHO only a temporary workaround, as the underlying problem (possible PCI access in ofdata_to_platdata()) should be fixed anyway, at least my interpretation of the comment in drivers/pci/pci-uclass.c is that this PCI access should not be there:

Quoted 5 lines

"A common cause of this problem is that this function is called in the ofdata_to_platdata() method of @dev. Accessing the PCI bus in that method is not allowed, since it has not yet been probed. To fix this, move that access to the probe() method of @dev instead."

Yes, when I looked at this, I wonder why the first commit was introduced. Simon, could you please explain more about the DM changes below?

commit 82de42fa14682d408da935adfb0f935354c5008f

Author: Simon Glass <[email protected]>
Date:   Sun Dec 29 21:19:18 2019 -0700

dm: core: Allocate parent data separate from probing parent

At present the parent is probed before the child's ofdata_to_platdata() method is called. Adjust the logic slightly so that probing parents is not done until afterwards.

Quoted 8 lines
Quoted 4 lines

@Andy: Regarding serial_intel_mid: I don't know the hardware, but would it be possible to move the register accesses after the call to ns16550_serial_probe()?

I suspect this does not work.

I didn't check the details, but have same feelings.

Quoted 11 lines
Quoted 11 lines
   mid_writel(plat, UART_MUL, 96);
   mid_writel(plat, UART_DIV, 125);
   mid_writel(plat, UART_PS, 16);

   return ns16550_serial_probe(dev);
Quoted 5 lines

So, the proper fix would be in my opinion to introduce a call back or some other way to make ordering possible, like registering hw_init callback in probe which will be called in the ns16550, or even do this as a callback for all serial class drivers.

Quoted 6 lines
Quoted 3 lines
Quoted 2 lines

I don't dare to dive into this anticipating that crap will hit the fan. So, please, who is knowing serial code, fix this asap!

I am currently working on a patch. Will send out for Andy and you for testing soon.

I just sent a v3 of revert, but I'll glad to test better solution.

Signature · 2 lines
With Best Regards,
Andy Shevchenko
#21 lore raw

PATCH v2 1/2 serial: ns16550: Revert "Move PCI access from ofdata_to_platdata() to probe()"

In reply to Bin Meng

Hi Bin,

Quoted 92 lines · Bin Meng

Hi Wolfgang,

Quoted 81 lines · Wolfgang Wallner

Hi Andy, Bin,

Quoted 43 lines

-----"Andy Shevchenko" <[email protected]> schrieb: -----

Quoted 41 lines · Bin Meng
Quoted 39 lines · Simon Glass
Quoted 28 lines · Andy Shevchenko
Quoted 27 lines · Simon Glass
Quoted 25 lines · Andy Shevchenko
Quoted 13 lines · Bin Meng
Quoted 10 lines · Andy Shevchenko

The commit breaks serial console on the Intel Edison.

This reverts commit 720f9e1fdb0c92d3fd16e1bfc25bcbd35612675c.

---
 drivers/serial/ns16550.c | 40 ++++++++++++----------------------------
 1 file changed, 12 insertions(+), 28 deletions(-)
Quoted 5 lines

Could you please spend some time to investigate why this breaks Intel Edison?

Reverting this patch would mean we break other boards too as Wolfgang's patch wanted to fix the breakage in the first place. Much appreciated!

I guess I'm wrong person here. The DM code is a complete black box to me. Nevertheless, I may test any provided fix / debug / etc patch by request.

And I think it's fair to investigate by the one who made a regression in the first place.

Quoted 7 lines
Quoted 1 line

Given that we have conflicting breakages, we need to debug Edison.

I would glad to test any suggested change or debug patch!

Quoted 1 line

Does it enable the debug UART?

If I am not mistaken, it does not.

Looks like you are right. If you know the address you could do that - see minnowmax for an example.

Quoted 8 lines
Quoted 1 line

Please suggest what's the best approach to proceed.

I think I understand what happened, and Wolfgang's patch *is* a culprit.

In serial_intel_mid.c we setup a divisor before probing the actual device. Now, since the address retrieving has been moved further in the initialization, we are writing to unknown registers and thus don't properly initialize hardware.

Yes, you are right, mid_serial_probe() relies on plat->base being set by ns16550_serial_ofdata_to_platdata().

I was not aware that other drivers rely on ns16550 in this way. And now that I know I see that there are few more:

  $ grep -r -l --include='*.c' -e ns16550_serial_probe -e ns16550_serial_ofdata_to_platdata
  drivers/serial/serial_intel_mid.c
  drivers/serial/serial_rockchip.c
  drivers/serial/serial_omap.c
  drivers/serial/ns16550.c
  arch/x86/cpu/apollolake/uart.c
  arch/x86/cpu/slimbootloader/serial.c

This means my patch has a wider impact than what I have taken care of.

@Bin: I'm fine with reverting 720f9e1 for now. I will come back with a new revision of this patch when I had the time to look at the other impacted drivers.

But reverting 720f9e1 is IMHO only a temporary workaround, as the underlying problem (possible PCI access in ofdata_to_platdata()) should be fixed anyway, at least my interpretation of the comment in drivers/pci/pci-uclass.c is that this PCI access should not be there:

Quoted 5 lines

"A common cause of this problem is that this function is called in the ofdata_to_platdata() method of @dev. Accessing the PCI bus in that method is not allowed, since it has not yet been probed. To fix this, move that access to the probe() method of @dev instead."

Quoted 3 lines

Yes, when I looked at this, I wonder why the first commit was introduced. Simon, could you please explain more about the DM changes below?

Yes, please see the cover letter for the series:

https://www.mail-archive.com/u-boot at lists.denx.de/msg352249.html

Quoted 35 lines

commit 82de42fa14682d408da935adfb0f935354c5008f

Author: Simon Glass <[email protected]>
Date:   Sun Dec 29 21:19:18 2019 -0700

dm: core: Allocate parent data separate from probing parent

At present the parent is probed before the child's ofdata_to_platdata() method is called. Adjust the logic slightly so that probing parents is not done until afterwards.

Quoted 4 lines

@Andy: Regarding serial_intel_mid: I don't know the hardware, but would it be possible to move the register accesses after the call to ns16550_serial_probe()?

I suspect this does not work.

Quoted 14 lines
   mid_writel(plat, UART_MUL, 96);
   mid_writel(plat, UART_DIV, 125);
   mid_writel(plat, UART_PS, 16);

   return ns16550_serial_probe(dev);
Quoted 7 lines

So, the proper fix would be in my opinion to introduce a call back or some other way to make ordering possible, like registering hw_init callback in probe which will be called in the ns16550, or even do this as a callback for all serial class drivers.

I don't dare to dive into this anticipating that crap will hit the fan. So, please, who is knowing serial code, fix this asap!

Quoted 5 lines

I am currently working on a patch. Will send out for Andy and you for testing soon.

Regards,
Bin

Regards,
Simon

#22 lore raw

PATCH v2 1/2 serial: ns16550: Revert "Move PCI access from ofdata_to_platdata() to probe()"

Hi Simon,

Quoted 96 lines · Simon Glass

Hi Bin,

Quoted 92 lines · Bin Meng

Hi Wolfgang,

Quoted 86 lines · Wolfgang Wallner

Hi Andy, Bin,

Quoted 43 lines

-----"Andy Shevchenko" <[email protected]> schrieb: -----

Quoted 41 lines · Bin Meng
Quoted 39 lines · Simon Glass
Quoted 28 lines · Andy Shevchenko
Quoted 27 lines · Simon Glass
Quoted 25 lines · Andy Shevchenko
Quoted 13 lines · Bin Meng
Quoted 10 lines · Andy Shevchenko

The commit breaks serial console on the Intel Edison.

This reverts commit 720f9e1fdb0c92d3fd16e1bfc25bcbd35612675c.

---
 drivers/serial/ns16550.c | 40 ++++++++++++----------------------------
 1 file changed, 12 insertions(+), 28 deletions(-)
Quoted 5 lines

Could you please spend some time to investigate why this breaks Intel Edison?

Reverting this patch would mean we break other boards too as Wolfgang's patch wanted to fix the breakage in the first place. Much appreciated!

I guess I'm wrong person here. The DM code is a complete black box to me. Nevertheless, I may test any provided fix / debug / etc patch by request.

And I think it's fair to investigate by the one who made a regression in the first place.

Quoted 7 lines
Quoted 1 line

Given that we have conflicting breakages, we need to debug Edison.

I would glad to test any suggested change or debug patch!

Quoted 1 line

Does it enable the debug UART?

If I am not mistaken, it does not.

Looks like you are right. If you know the address you could do that - see minnowmax for an example.

Quoted 8 lines
Quoted 1 line

Please suggest what's the best approach to proceed.

I think I understand what happened, and Wolfgang's patch *is* a culprit.

In serial_intel_mid.c we setup a divisor before probing the actual device. Now, since the address retrieving has been moved further in the initialization, we are writing to unknown registers and thus don't properly initialize hardware.

Yes, you are right, mid_serial_probe() relies on plat->base being set by ns16550_serial_ofdata_to_platdata().

I was not aware that other drivers rely on ns16550 in this way. And now that I know I see that there are few more:

  $ grep -r -l --include='*.c' -e ns16550_serial_probe -e ns16550_serial_ofdata_to_platdata
  drivers/serial/serial_intel_mid.c
  drivers/serial/serial_rockchip.c
  drivers/serial/serial_omap.c
  drivers/serial/ns16550.c
  arch/x86/cpu/apollolake/uart.c
  arch/x86/cpu/slimbootloader/serial.c

This means my patch has a wider impact than what I have taken care of.

@Bin: I'm fine with reverting 720f9e1 for now. I will come back with a new revision of this patch when I had the time to look at the other impacted drivers.

But reverting 720f9e1 is IMHO only a temporary workaround, as the underlying problem (possible PCI access in ofdata_to_platdata()) should be fixed anyway, at least my interpretation of the comment in drivers/pci/pci-uclass.c is that this PCI access should not be there:

"A common cause of this problem is that this function is called in the ofdata_to_platdata() method of @dev. Accessing the PCI bus in that method is not allowed, since it has not yet been probed. To fix this, move that access to the probe() method of @dev instead."

Quoted 8 lines
Quoted 3 lines

Yes, when I looked at this, I wonder why the first commit was introduced. Simon, could you please explain more about the DM changes below?

Yes, please see the cover letter for the series:

https://www.mail-archive.com/u-boot at lists.denx.de/msg352249.html

Thanks. But still, as I described in my fix commit [1], there are chances that any PCI based ns16550 driver might break due to the ordering changes. Any ideas to improve that?

[1] http://patchwork.ozlabs.org/patch/1266326/

Regards,
Bin

#23 lore raw

PATCH v2 1/2 serial: ns16550: Revert "Move PCI access from ofdata_to_platdata() to probe()"

Hi Bin,

Quoted 104 lines · Bin Meng

Hi Simon,

Quoted 100 lines · Simon Glass

Hi Bin,

Quoted 95 lines · Bin Meng

Hi Wolfgang,

Quoted 81 lines · Wolfgang Wallner

Hi Andy, Bin,

Quoted 43 lines

-----"Andy Shevchenko" <[email protected]> schrieb: -----

Quoted 41 lines · Bin Meng
Quoted 39 lines · Simon Glass
Quoted 28 lines · Andy Shevchenko
Quoted 27 lines · Simon Glass
Quoted 25 lines · Andy Shevchenko
Quoted 13 lines · Bin Meng
Quoted 10 lines · Andy Shevchenko

The commit breaks serial console on the Intel Edison.

This reverts commit 720f9e1fdb0c92d3fd16e1bfc25bcbd35612675c.

---
 drivers/serial/ns16550.c | 40 ++++++++++++----------------------------
 1 file changed, 12 insertions(+), 28 deletions(-)
Quoted 5 lines

Could you please spend some time to investigate why this breaks Intel Edison?

Reverting this patch would mean we break other boards too as Wolfgang's patch wanted to fix the breakage in the first place. Much appreciated!

I guess I'm wrong person here. The DM code is a complete black box to me. Nevertheless, I may test any provided fix / debug / etc patch by request.

And I think it's fair to investigate by the one who made a regression in the first place.

Quoted 7 lines
Quoted 1 line

Given that we have conflicting breakages, we need to debug Edison.

I would glad to test any suggested change or debug patch!

Quoted 1 line

Does it enable the debug UART?

If I am not mistaken, it does not.

Looks like you are right. If you know the address you could do that - see minnowmax for an example.

Quoted 8 lines
Quoted 1 line

Please suggest what's the best approach to proceed.

I think I understand what happened, and Wolfgang's patch *is* a culprit.

In serial_intel_mid.c we setup a divisor before probing the actual device. Now, since the address retrieving has been moved further in the initialization, we are writing to unknown registers and thus don't properly initialize hardware.

Yes, you are right, mid_serial_probe() relies on plat->base being set by ns16550_serial_ofdata_to_platdata().

I was not aware that other drivers rely on ns16550 in this way. And now that I know I see that there are few more:

  $ grep -r -l --include='*.c' -e ns16550_serial_probe -e ns16550_serial_ofdata_to_platdata
  drivers/serial/serial_intel_mid.c
  drivers/serial/serial_rockchip.c
  drivers/serial/serial_omap.c
  drivers/serial/ns16550.c
  arch/x86/cpu/apollolake/uart.c
  arch/x86/cpu/slimbootloader/serial.c

This means my patch has a wider impact than what I have taken care of.

@Bin: I'm fine with reverting 720f9e1 for now. I will come back with a new revision of this patch when I had the time to look at the other impacted drivers.

But reverting 720f9e1 is IMHO only a temporary workaround, as the underlying problem (possible PCI access in ofdata_to_platdata()) should be fixed anyway, at least my interpretation of the comment in drivers/pci/pci-uclass.c is that this PCI access should not be there:

Quoted 5 lines

"A common cause of this problem is that this function is called in the ofdata_to_platdata() method of @dev. Accessing the PCI bus in that method is not allowed, since it has not yet been probed. To fix this, move that access to the probe() method of @dev instead."

Yes, when I looked at this, I wonder why the first commit was introduced. Simon, could you please explain more about the DM changes below?

Quoted 8 lines
Quoted 4 lines

Yes, please see the cover letter for the series:

https://www.mail-archive.com/u-boot at lists.denx.de/msg352249.html

Thanks. But still, as I described in my fix commit [1], there are chances that any PCI based ns16550 driver might break due to the ordering changes. Any ideas to improve that?

Hmm it is not very nice.

But I am not sure what the solution can be. With PCI we do need to probe the bus before we can access devices on it, right?

Would it help to split up ns16550 probe into two functions that people can call?

Another thought is that we could have a driver flag for PCI which tells DM to probe it if any devices reads its ofdata? I'm not sure how I could justify that, but it might work.

Quoted 2 lines

[1] http://patchwork.ozlabs.org/patch/1266326/

Regards,
Simon