Skip to contentSkip to conversation

arm: socfpga: make debug uart work on socfpga_gen5

PATCH New Simon Goldschmidt 2 participants 17 messages Jan 7, 2019 – Jan 14, 2019

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 arm: socfpga: make debug uart work on socfpga_gen5

When debug UART is enabled on socfpga_gen5, the debug uart driver hangs in an endless loop because 'socfpga_bridges_reset' calls printf before the debug UART is initialized.

After the generic fix for this in the UART driver did not work due to portability issues, let's just drop this printf statement when called from SPL with debug UART enabled.

---

This is about my fourth try to get the debug uart usable on socfpga gen5. Hope this time I'll make it :-)
It's really annoying to have local diffs only for enabling the debug uart!

 arch/arm/mach-socfpga/reset_manager_gen5.c | 3 +++
 1 file changed, 3 insertions(+)
arch/arm/mach-socfpga/reset_manager_gen5.c +3 -0
index 25baef79bc..39d8fbed94 100644
@@ -90,7 +90,10 @@ void socfpga_bridges_reset(int enable)
 		if (!fpgamgr_test_fpga_ready()) {
 			/* FPGA not ready, do nothing. We allow system to boot
 			 * without FPGA ready. So, return 0 instead of error. */
+#if !defined CONFIG_SPL_BUILD || !defined CONFIG_DEBUG_UART
+			/* In SPL, this is called before debug-uart init... */
 			printf("%s: FPGA not ready, aborting.\n", __func__);
+#endif
 			return;
 		}
 
Signature · 1 line
2.17.1
#1 lore raw

PATCH 1/1 arm: socfpga: make debug uart work on socfpga_gen5

Quoted 9 lines · Simon Goldschmidt

When debug UART is enabled on socfpga_gen5, the debug uart driver hangs in an endless loop because 'socfpga_bridges_reset' calls printf before the debug UART is initialized.

After the generic fix for this in the UART driver did not work due to portability issues, let's just drop this printf statement when called from SPL with debug UART enabled.

Can we have an un-portable fix which at least works on SoCFPGA ? :)

Quoted 25 lines

---

This is about my fourth try to get the debug uart usable on socfpga gen5. Hope this time I'll make it :-)
It's really annoying to have local diffs only for enabling the debug uart!

 arch/arm/mach-socfpga/reset_manager_gen5.c | 3 +++
 1 file changed, 3 insertions(+)
arch/arm/mach-socfpga/reset_manager_gen5.c +3 -0
index 25baef79bc..39d8fbed94 100644
@@ -90,7 +90,10 @@ void socfpga_bridges_reset(int enable)
 		if (!fpgamgr_test_fpga_ready()) {
 			/* FPGA not ready, do nothing. We allow system to boot
 			 * without FPGA ready. So, return 0 instead of error. */
+#if !defined CONFIG_SPL_BUILD || !defined CONFIG_DEBUG_UART
+			/* In SPL, this is called before debug-uart init... */
 			printf("%s: FPGA not ready, aborting.\n", __func__);
+#endif
 			return;
 		}
 
Signature · 2 lines
Best regards,
Marek Vasut
#2 lore raw

PATCH 1/1 arm: socfpga: make debug uart work on socfpga_gen5

Am 07.01.2019 um 21:19 schrieb Marek Vasut:

Quoted 5 lines · Simon Goldschmidt
Quoted 4 lines

When debug UART is enabled on socfpga_gen5, the debug uart driver hangs in an endless loop because 'socfpga_bridges_reset' calls printf before the debug UART is initialized.

Quoted 7 lines
Quoted 5 lines

After the generic fix for this in the UART driver did not work due to portability issues, let's just drop this printf statement when called from SPL with debug UART enabled.

Can we have an un-portable fix which at least works on SoCFPGA ? :)

This one worked on socfpga but broke rockchip:

https://patchwork.ozlabs.org/patch/992553/

However, the message below wasn't shown either with that patch applied. The code just runs too early to enable the UART.

Do you want to keep the message (although I failed to see in which situation it can be printed) or do you just dislike the #ifdef thing?

Regards,
Simon

Quoted 28 lines
Quoted 26 lines

---

This is about my fourth try to get the debug uart usable on socfpga gen5. Hope this time I'll make it :-)
It's really annoying to have local diffs only for enabling the debug uart!

  arch/arm/mach-socfpga/reset_manager_gen5.c | 3 +++
  1 file changed, 3 insertions(+)
arch/arm/mach-socfpga/reset_manager_gen5.c +3 -0
index 25baef79bc..39d8fbed94 100644
@@ -90,7 +90,10 @@ void socfpga_bridges_reset(int enable)
  		if (!fpgamgr_test_fpga_ready()) {
  			/* FPGA not ready, do nothing. We allow system to boot
  			 * without FPGA ready. So, return 0 instead of error. */
+#if !defined CONFIG_SPL_BUILD || !defined CONFIG_DEBUG_UART
+			/* In SPL, this is called before debug-uart init... */
  			printf("%s: FPGA not ready, aborting.\n", __func__);
+#endif
  			return;
  		}
 
#3 lore raw

PATCH 1/1 arm: socfpga: make debug uart work on socfpga_gen5

Quoted 16 lines · Simon Goldschmidt

Am 07.01.2019 um 21:19 schrieb Marek Vasut:

Quoted 5 lines · Simon Goldschmidt
Quoted 4 lines

When debug UART is enabled on socfpga_gen5, the debug uart driver hangs in an endless loop because 'socfpga_bridges_reset' calls printf before the debug UART is initialized.

Quoted 7 lines
Quoted 5 lines

After the generic fix for this in the UART driver did not work due to portability issues, let's just drop this printf statement when called from SPL with debug UART enabled.

Can we have an un-portable fix which at least works on SoCFPGA ? :)

This one worked on socfpga but broke rockchip:

Quoted 7 lines

https://patchwork.ozlabs.org/patch/992553/

However, the message below wasn't shown either with that patch applied. The code just runs too early to enable the UART.

Do you want to keep the message (although I failed to see in which situation it can be printed) or do you just dislike the #ifdef thing?

I'd like to keep the error message if possible. Is it possible ?

Signature · 2 lines
Best regards,
Marek Vasut
#4 lore raw

PATCH 1/1 arm: socfpga: make debug uart work on socfpga_gen5

Am 07.01.2019 um 21:25 schrieb Marek Vasut:

Quoted 19 lines · Simon Goldschmidt
Quoted 18 lines

Am 07.01.2019 um 21:19 schrieb Marek Vasut:

Quoted 5 lines · Simon Goldschmidt
Quoted 4 lines

When debug UART is enabled on socfpga_gen5, the debug uart driver hangs in an endless loop because 'socfpga_bridges_reset' calls printf before the debug UART is initialized.

Quoted 7 lines
Quoted 5 lines

After the generic fix for this in the UART driver did not work due to portability issues, let's just drop this printf statement when called from SPL with debug UART enabled.

Can we have an un-portable fix which at least works on SoCFPGA ? :)

This one worked on socfpga but broke rockchip:

https://patchwork.ozlabs.org/patch/992553/

Quoted 7 lines
Quoted 5 lines

However, the message below wasn't shown either with that patch applied. The code just runs too early to enable the UART.

Do you want to keep the message (although I failed to see in which situation it can be printed) or do you just dislike the #ifdef thing?

I'd like to keep the error message if possible. Is it possible ?

I have *never* seen this message yet. I have failed to produce a situation where it is shown.

This function ('socfpga_bridges_reset') is called 5 times throughout the code, but only *one* single time with 'reset=0' as argument (only with 0, the code in question is executed). And this is in SPL before initializing the console and even before the debug UART can be initialized.

As I could see, the printf *is* executed on every boot (I saw the code hanging when enabling debug UART). However, when not booting from FPGA, it is just normal that the FPGA is not ready when running SPL. Why do you want an error message here anyway?

Regards,
Simon

#5 lore raw

PATCH 1/1 arm: socfpga: make debug uart work on socfpga_gen5

Quoted 24 lines · Simon Goldschmidt

Am 07.01.2019 um 21:25 schrieb Marek Vasut:

Quoted 23 lines · Simon Goldschmidt
Quoted 22 lines

Am 07.01.2019 um 21:19 schrieb Marek Vasut:

Quoted 6 lines · Simon Goldschmidt
Quoted 5 lines

When debug UART is enabled on socfpga_gen5, the debug uart driver hangs
in an endless loop because 'socfpga_bridges_reset' calls printf before the debug UART is initialized.

Quoted 7 lines
Quoted 5 lines

After the generic fix for this in the UART driver did not work due to portability issues, let's just drop this printf statement when called from SPL with debug UART enabled.

Can we have an un-portable fix which at least works on SoCFPGA ? :)

This one worked on socfpga but broke rockchip:

https://patchwork.ozlabs.org/patch/992553/

However, the message below wasn't shown either with that patch applied. The code just runs too early to enable the UART.

Quoted 7 lines
Quoted 4 lines
Quoted 2 lines

Do you want to keep the message (although I failed to see in which situation it can be printed) or do you just dislike the #ifdef thing?

I'd like to keep the error message if possible. Is it possible ?

I have *never* seen this message yet. I have failed to produce a situation where it is shown.

I believe that.

Quoted 9 lines

This function ('socfpga_bridges_reset') is called 5 times throughout the code, but only *one* single time with 'reset=0' as argument (only with 0, the code in question is executed). And this is in SPL before initializing the console and even before the debug UART can be initialized.

As I could see, the printf *is* executed on every boot (I saw the code hanging when enabling debug UART). However, when not booting from FPGA, it is just normal that the FPGA is not ready when running SPL. Why do you want an error message here anyway?

I was under the impression this is an error message, but it might not be so ? Maybe the wording is incorrect ?

Signature · 2 lines
Best regards,
Marek Vasut
#6 lore raw

PATCH 1/1 arm: socfpga: make debug uart work on socfpga_gen5

Am 07.01.2019 um 21:47 schrieb Marek Vasut:

Quoted 40 lines · Simon Goldschmidt
Quoted 24 lines

Am 07.01.2019 um 21:25 schrieb Marek Vasut:

Quoted 23 lines · Simon Goldschmidt
Quoted 22 lines

Am 07.01.2019 um 21:19 schrieb Marek Vasut:

Quoted 6 lines · Simon Goldschmidt
Quoted 5 lines

When debug UART is enabled on socfpga_gen5, the debug uart driver hangs
in an endless loop because 'socfpga_bridges_reset' calls printf before the debug UART is initialized.

Quoted 7 lines
Quoted 5 lines

After the generic fix for this in the UART driver did not work due to portability issues, let's just drop this printf statement when called from SPL with debug UART enabled.

Can we have an un-portable fix which at least works on SoCFPGA ? :)

This one worked on socfpga but broke rockchip:

https://patchwork.ozlabs.org/patch/992553/

However, the message below wasn't shown either with that patch applied. The code just runs too early to enable the UART.

Quoted 7 lines
Quoted 4 lines
Quoted 2 lines

Do you want to keep the message (although I failed to see in which situation it can be printed) or do you just dislike the #ifdef thing?

I'd like to keep the error message if possible. Is it possible ?

I have *never* seen this message yet. I have failed to produce a situation where it is shown.

I believe that.

Quoted 5 lines

This function ('socfpga_bridges_reset') is called 5 times throughout the code, but only *one* single time with 'reset=0' as argument (only with 0, the code in question is executed). And this is in SPL before initializing the console and even before the debug UART can be initialized.

Quoted 7 lines
Quoted 4 lines

As I could see, the printf *is* executed on every boot (I saw the code hanging when enabling debug UART). However, when not booting from FPGA, it is just normal that the FPGA is not ready when running SPL. Why do you want an error message here anyway?

I was under the impression this is an error message, but it might not be so ? Maybe the wording is incorrect ?

Now that I re-read it, "aborting" is incorrect, yes.

So how should we proceed? This is an error message that can never be shown (like the code is now) but breaks debug UART.

I'd say we can drop it altogether. It might only be interesint if (in the future) that code would get called from somewhere else (i.e. later, after console initialization).

Re-reading spl_gen5.c, there are some 'debug' calls before the debug uart is initialized which probably would need to be removed as well, but that's a different story...

Regards,
Simon

#7 lore raw

PATCH 1/1 arm: socfpga: make debug uart work on socfpga_gen5

Quoted 59 lines · Simon Goldschmidt

Am 07.01.2019 um 21:47 schrieb Marek Vasut:

Quoted 45 lines · Simon Goldschmidt
Quoted 28 lines

Am 07.01.2019 um 21:25 schrieb Marek Vasut:

Quoted 27 lines · Simon Goldschmidt
Quoted 26 lines

Am 07.01.2019 um 21:19 schrieb Marek Vasut:

Quoted 13 lines · Simon Goldschmidt
Quoted 12 lines

When debug UART is enabled on socfpga_gen5, the debug uart driver hangs
in an endless loop because 'socfpga_bridges_reset' calls printf before
the debug UART is initialized.

After the generic fix for this in the UART driver did not work due to
portability issues, let's just drop this printf statement when called
from SPL with debug UART enabled.

Quoted 3 lines
Quoted 1 line

Can we have an un-portable fix which at least works on SoCFPGA ? :)

This one worked on socfpga but broke rockchip:

https://patchwork.ozlabs.org/patch/992553/

However, the message below wasn't shown either with that patch applied.
The code just runs too early to enable the UART.

Quoted 7 lines
Quoted 4 lines
Quoted 2 lines

Do you want to keep the message (although I failed to see in which situation it can be printed) or do you just dislike the #ifdef thing?

I'd like to keep the error message if possible. Is it possible ?

I have *never* seen this message yet. I have failed to produce a situation where it is shown.

I believe that.

Quoted 6 lines

This function ('socfpga_bridges_reset') is called 5 times throughout the code, but only *one* single time with 'reset=0' as argument (only with 0, the code in question is executed). And this is in SPL before initializing the console and even before the debug UART can be initialized.

Quoted 7 lines
Quoted 4 lines

As I could see, the printf *is* executed on every boot (I saw the code hanging when enabling debug UART). However, when not booting from FPGA, it is just normal that the FPGA is not ready when running SPL. Why do you want an error message here anyway?

I was under the impression this is an error message, but it might not be so ? Maybe the wording is incorrect ?

Now that I re-read it, "aborting" is incorrect, yes.

So how should we proceed? This is an error message that can never be shown (like the code is now) but breaks debug UART.

Quoted 7 lines

I'd say we can drop it altogether. It might only be interesint if (in the future) that code would get called from somewhere else (i.e. later, after console initialization).

Re-reading spl_gen5.c, there are some 'debug' calls before the debug uart is initialized which probably would need to be removed as well, but that's a different story...

How come those don't hang the system then ?

Signature · 2 lines
Best regards,
Marek Vasut
#8 lore raw

PATCH 1/1 arm: socfpga: make debug uart work on socfpga_gen5

Quoted 65 lines · Marek Vasut
Quoted 63 lines · Simon Goldschmidt

Am 07.01.2019 um 21:47 schrieb Marek Vasut:

Quoted 45 lines · Simon Goldschmidt
Quoted 28 lines

Am 07.01.2019 um 21:25 schrieb Marek Vasut:

Quoted 27 lines · Simon Goldschmidt
Quoted 26 lines

Am 07.01.2019 um 21:19 schrieb Marek Vasut:

Quoted 13 lines · Simon Goldschmidt
Quoted 12 lines

When debug UART is enabled on socfpga_gen5, the debug uart driver hangs
in an endless loop because 'socfpga_bridges_reset' calls printf before
the debug UART is initialized.

After the generic fix for this in the UART driver did not work due to
portability issues, let's just drop this printf statement when called
from SPL with debug UART enabled.

Quoted 3 lines
Quoted 1 line

Can we have an un-portable fix which at least works on SoCFPGA ? :)

This one worked on socfpga but broke rockchip:

https://patchwork.ozlabs.org/patch/992553/

However, the message below wasn't shown either with that patch applied.
The code just runs too early to enable the UART.

Quoted 7 lines
Quoted 4 lines
Quoted 2 lines

Do you want to keep the message (although I failed to see in which situation it can be printed) or do you just dislike the #ifdef thing?

I'd like to keep the error message if possible. Is it possible ?

I have *never* seen this message yet. I have failed to produce a situation where it is shown.

I believe that.

Quoted 6 lines

This function ('socfpga_bridges_reset') is called 5 times throughout the code, but only *one* single time with 'reset=0' as argument (only with 0, the code in question is executed). And this is in SPL before initializing the console and even before the debug UART can be initialized.

Quoted 7 lines
Quoted 4 lines

As I could see, the printf *is* executed on every boot (I saw the code hanging when enabling debug UART). However, when not booting from FPGA, it is just normal that the FPGA is not ready when running SPL. Why do you want an error message here anyway?

I was under the impression this is an error message, but it might not be so ? Maybe the wording is incorrect ?

Now that I re-read it, "aborting" is incorrect, yes.

So how should we proceed? This is an error message that can never be shown (like the code is now) but breaks debug UART.

I'd say we can drop it altogether. It might only be interesint if (in the future) that code would get called from somewhere else (i.e. later, after console initialization).

Quoted 5 lines
Quoted 3 lines

Re-reading spl_gen5.c, there are some 'debug' calls before the debug uart is initialized which probably would need to be removed as well, but that's a different story...

How come those don't hang the system then ?

I just haven't enabled debug output in spl_gen5.c, yet. I guess they would hang the system when enabling them.

While it would be easy to remove these debug statements, to be future-proof it would of course make sense to make the debug UART robust against this.

But given the problems with Rockchip ns16550, we would need a dedicated debug UART for socfpga to solve this. And that would probably mean code duplication.

Regards,
Simon

#9 lore raw

PATCH 1/1 arm: socfpga: make debug uart work on socfpga_gen5

Quoted 75 lines · Simon Goldschmidt
Quoted 65 lines · Marek Vasut
Quoted 63 lines · Simon Goldschmidt

Am 07.01.2019 um 21:47 schrieb Marek Vasut:

Quoted 45 lines · Simon Goldschmidt
Quoted 28 lines

Am 07.01.2019 um 21:25 schrieb Marek Vasut:

Quoted 27 lines · Simon Goldschmidt
Quoted 26 lines

Am 07.01.2019 um 21:19 schrieb Marek Vasut:

Quoted 13 lines · Simon Goldschmidt
Quoted 12 lines

When debug UART is enabled on socfpga_gen5, the debug uart driver hangs
in an endless loop because 'socfpga_bridges_reset' calls printf before
the debug UART is initialized.

After the generic fix for this in the UART driver did not work due to
portability issues, let's just drop this printf statement when called
from SPL with debug UART enabled.

Quoted 3 lines
Quoted 1 line

Can we have an un-portable fix which at least works on SoCFPGA ? :)

This one worked on socfpga but broke rockchip:

https://patchwork.ozlabs.org/patch/992553/

However, the message below wasn't shown either with that patch applied.
The code just runs too early to enable the UART.

Quoted 7 lines
Quoted 4 lines
Quoted 2 lines

Do you want to keep the message (although I failed to see in which situation it can be printed) or do you just dislike the #ifdef thing?

I'd like to keep the error message if possible. Is it possible ?

I have *never* seen this message yet. I have failed to produce a situation where it is shown.

I believe that.

Quoted 6 lines

This function ('socfpga_bridges_reset') is called 5 times throughout the code, but only *one* single time with 'reset=0' as argument (only with 0, the code in question is executed). And this is in SPL before initializing the console and even before the debug UART can be initialized.

Quoted 7 lines
Quoted 4 lines

As I could see, the printf *is* executed on every boot (I saw the code hanging when enabling debug UART). However, when not booting from FPGA, it is just normal that the FPGA is not ready when running SPL. Why do you want an error message here anyway?

I was under the impression this is an error message, but it might not be so ? Maybe the wording is incorrect ?

Now that I re-read it, "aborting" is incorrect, yes.

So how should we proceed? This is an error message that can never be shown (like the code is now) but breaks debug UART.

I'd say we can drop it altogether. It might only be interesint if (in the future) that code would get called from somewhere else (i.e. later, after console initialization).

Quoted 5 lines
Quoted 3 lines

Re-reading spl_gen5.c, there are some 'debug' calls before the debug uart is initialized which probably would need to be removed as well, but that's a different story...

How come those don't hang the system then ?

I just haven't enabled debug output in spl_gen5.c, yet. I guess they would hang the system when enabling them.

Quoted 6 lines

While it would be easy to remove these debug statements, to be future-proof it would of course make sense to make the debug UART robust against this.

But given the problems with Rockchip ns16550, we would need a dedicated debug UART for socfpga to solve this. And that would probably mean code duplication.

What is the problem with Rockchip ? I don't want various SoCs blocking others.

Signature · 2 lines
Best regards,
Marek Vasut
#10 lore raw

PATCH 1/1 arm: socfpga: make debug uart work on socfpga_gen5

Quoted 80 lines · Marek Vasut
Quoted 78 lines · Simon Goldschmidt
Quoted 65 lines · Marek Vasut
Quoted 63 lines · Simon Goldschmidt

Am 07.01.2019 um 21:47 schrieb Marek Vasut:

Quoted 45 lines · Simon Goldschmidt
Quoted 28 lines

Am 07.01.2019 um 21:25 schrieb Marek Vasut:

Quoted 27 lines · Simon Goldschmidt
Quoted 26 lines

Am 07.01.2019 um 21:19 schrieb Marek Vasut:

Quoted 13 lines · Simon Goldschmidt
Quoted 12 lines

When debug UART is enabled on socfpga_gen5, the debug uart driver hangs
in an endless loop because 'socfpga_bridges_reset' calls printf before
the debug UART is initialized.

After the generic fix for this in the UART driver did not work due to
portability issues, let's just drop this printf statement when called
from SPL with debug UART enabled.

Quoted 3 lines
Quoted 1 line

Can we have an un-portable fix which at least works on SoCFPGA ? :)

This one worked on socfpga but broke rockchip:

https://patchwork.ozlabs.org/patch/992553/

However, the message below wasn't shown either with that patch applied.
The code just runs too early to enable the UART.

Quoted 7 lines
Quoted 4 lines
Quoted 2 lines

Do you want to keep the message (although I failed to see in which situation it can be printed) or do you just dislike the #ifdef thing?

I'd like to keep the error message if possible. Is it possible ?

I have *never* seen this message yet. I have failed to produce a situation where it is shown.

I believe that.

Quoted 6 lines

This function ('socfpga_bridges_reset') is called 5 times throughout the code, but only *one* single time with 'reset=0' as argument (only with 0, the code in question is executed). And this is in SPL before initializing the console and even before the debug UART can be initialized.

Quoted 7 lines
Quoted 4 lines

As I could see, the printf *is* executed on every boot (I saw the code hanging when enabling debug UART). However, when not booting from FPGA, it is just normal that the FPGA is not ready when running SPL. Why do you want an error message here anyway?

I was under the impression this is an error message, but it might not be so ? Maybe the wording is incorrect ?

Now that I re-read it, "aborting" is incorrect, yes.

So how should we proceed? This is an error message that can never be shown (like the code is now) but breaks debug UART.

I'd say we can drop it altogether. It might only be interesint if (in the future) that code would get called from somewhere else (i.e. later, after console initialization).

Quoted 5 lines
Quoted 3 lines

Re-reading spl_gen5.c, there are some 'debug' calls before the debug uart is initialized which probably would need to be removed as well, but that's a different story...

How come those don't hang the system then ?

I just haven't enabled debug output in spl_gen5.c, yet. I guess they would hang the system when enabling them.

While it would be easy to remove these debug statements, to be future-proof it would of course make sense to make the debug UART robust against this.

Quoted 6 lines
Quoted 3 lines

But given the problems with Rockchip ns16550, we would need a dedicated debug UART for socfpga to solve this. And that would probably mean code duplication.

What is the problem with Rockchip ? I don't want various SoCs blocking others.

I had sent a patch that does not wait for the TX fifo to hold more bytes if the baudrate prescaler is 0 (according to both the socfgpa and the rockchip docs, the UART is disabled if the prescaler is 0).

However, it seems that the prescaler was read back as 0 on a rockchip board which caused chars to be missing from the console output.

See this mail:
https://lists.denx.de/pipermail/u-boot/2018-December/350355.html

I checked with Henri and did not find a solution so I reverted the patch:
https://patchwork.ozlabs.org/patch/1007211/

Keeping this patch but only for selected platforms would be my favourite, but it would at least mean we need yet another debug UART selection, plus some changes to make the "prescaler == 0" detection specific to this new debug UART. Would this be better acceptable?

Regards,
Simon

#11 lore raw

PATCH 1/1 arm: socfpga: make debug uart work on socfpga_gen5

Quoted 98 lines · Simon Goldschmidt
Quoted 80 lines · Marek Vasut
Quoted 78 lines · Simon Goldschmidt
Quoted 65 lines · Marek Vasut
Quoted 63 lines · Simon Goldschmidt

Am 07.01.2019 um 21:47 schrieb Marek Vasut:

Quoted 45 lines · Simon Goldschmidt
Quoted 28 lines

Am 07.01.2019 um 21:25 schrieb Marek Vasut:

Quoted 27 lines · Simon Goldschmidt
Quoted 26 lines

Am 07.01.2019 um 21:19 schrieb Marek Vasut:

Quoted 13 lines · Simon Goldschmidt
Quoted 12 lines

When debug UART is enabled on socfpga_gen5, the debug uart driver hangs
in an endless loop because 'socfpga_bridges_reset' calls printf before
the debug UART is initialized.

After the generic fix for this in the UART driver did not work due to
portability issues, let's just drop this printf statement when called
from SPL with debug UART enabled.

Quoted 3 lines
Quoted 1 line

Can we have an un-portable fix which at least works on SoCFPGA ? :)

This one worked on socfpga but broke rockchip:

https://patchwork.ozlabs.org/patch/992553/

However, the message below wasn't shown either with that patch applied.
The code just runs too early to enable the UART.

Quoted 7 lines
Quoted 4 lines
Quoted 2 lines

Do you want to keep the message (although I failed to see in which situation it can be printed) or do you just dislike the #ifdef thing?

I'd like to keep the error message if possible. Is it possible ?

I have *never* seen this message yet. I have failed to produce a situation where it is shown.

I believe that.

Quoted 6 lines

This function ('socfpga_bridges_reset') is called 5 times throughout the code, but only *one* single time with 'reset=0' as argument (only with 0, the code in question is executed). And this is in SPL before initializing the console and even before the debug UART can be initialized.

Quoted 7 lines
Quoted 4 lines

As I could see, the printf *is* executed on every boot (I saw the code hanging when enabling debug UART). However, when not booting from FPGA, it is just normal that the FPGA is not ready when running SPL. Why do you want an error message here anyway?

I was under the impression this is an error message, but it might not be so ? Maybe the wording is incorrect ?

Now that I re-read it, "aborting" is incorrect, yes.

So how should we proceed? This is an error message that can never be shown (like the code is now) but breaks debug UART.

I'd say we can drop it altogether. It might only be interesint if (in the future) that code would get called from somewhere else (i.e. later, after console initialization).

Quoted 5 lines
Quoted 3 lines

Re-reading spl_gen5.c, there are some 'debug' calls before the debug uart is initialized which probably would need to be removed as well, but that's a different story...

How come those don't hang the system then ?

I just haven't enabled debug output in spl_gen5.c, yet. I guess they would hang the system when enabling them.

While it would be easy to remove these debug statements, to be future-proof it would of course make sense to make the debug UART robust against this.

Quoted 6 lines
Quoted 3 lines

But given the problems with Rockchip ns16550, we would need a dedicated debug UART for socfpga to solve this. And that would probably mean code duplication.

What is the problem with Rockchip ? I don't want various SoCs blocking others.

I had sent a patch that does not wait for the TX fifo to hold more bytes if the baudrate prescaler is 0 (according to both the socfgpa and the rockchip docs, the UART is disabled if the prescaler is 0).

However, it seems that the prescaler was read back as 0 on a rockchip board which caused chars to be missing from the console output.

See this mail:
https://lists.denx.de/pipermail/u-boot/2018-December/350355.html

Quoted 7 lines

I checked with Henri and did not find a solution so I reverted the patch:
https://patchwork.ozlabs.org/patch/1007211/

Keeping this patch but only for selected platforms would be my favourite, but it would at least mean we need yet another debug UART selection, plus some changes to make the "prescaler == 0" detection specific to this new debug UART. Would this be better acceptable?

Doesn't the DT compatible tell you the UART type ? It does, so you can match on that and apply the workaround accordingly . Or you can cache the prescaler.

Signature · 2 lines
Best regards,
Marek Vasut
#12 lore raw

PATCH 1/1 arm: socfpga: make debug uart work on socfpga_gen5

Quoted 103 lines · Marek Vasut
Quoted 101 lines · Simon Goldschmidt
Quoted 80 lines · Marek Vasut
Quoted 78 lines · Simon Goldschmidt
Quoted 65 lines · Marek Vasut
Quoted 63 lines · Simon Goldschmidt

Am 07.01.2019 um 21:47 schrieb Marek Vasut:

Quoted 45 lines · Simon Goldschmidt
Quoted 28 lines

Am 07.01.2019 um 21:25 schrieb Marek Vasut:

Quoted 27 lines · Simon Goldschmidt
Quoted 26 lines

Am 07.01.2019 um 21:19 schrieb Marek Vasut:

Quoted 13 lines · Simon Goldschmidt
Quoted 12 lines

When debug UART is enabled on socfpga_gen5, the debug uart driver hangs
in an endless loop because 'socfpga_bridges_reset' calls printf before
the debug UART is initialized.

After the generic fix for this in the UART driver did not work due to
portability issues, let's just drop this printf statement when called
from SPL with debug UART enabled.

Quoted 3 lines
Quoted 1 line

Can we have an un-portable fix which at least works on SoCFPGA ? :)

This one worked on socfpga but broke rockchip:

https://patchwork.ozlabs.org/patch/992553/

However, the message below wasn't shown either with that patch applied.
The code just runs too early to enable the UART.

Quoted 7 lines
Quoted 4 lines
Quoted 2 lines

Do you want to keep the message (although I failed to see in which situation it can be printed) or do you just dislike the #ifdef thing?

I'd like to keep the error message if possible. Is it possible ?

I have *never* seen this message yet. I have failed to produce a situation where it is shown.

I believe that.

Quoted 6 lines

This function ('socfpga_bridges_reset') is called 5 times throughout the code, but only *one* single time with 'reset=0' as argument (only with 0, the code in question is executed). And this is in SPL before initializing the console and even before the debug UART can be initialized.

Quoted 7 lines
Quoted 4 lines

As I could see, the printf *is* executed on every boot (I saw the code hanging when enabling debug UART). However, when not booting from FPGA, it is just normal that the FPGA is not ready when running SPL. Why do you want an error message here anyway?

I was under the impression this is an error message, but it might not be so ? Maybe the wording is incorrect ?

Now that I re-read it, "aborting" is incorrect, yes.

So how should we proceed? This is an error message that can never be shown (like the code is now) but breaks debug UART.

I'd say we can drop it altogether. It might only be interesint if (in the future) that code would get called from somewhere else (i.e. later, after console initialization).

Quoted 5 lines
Quoted 3 lines

Re-reading spl_gen5.c, there are some 'debug' calls before the debug uart is initialized which probably would need to be removed as well, but that's a different story...

How come those don't hang the system then ?

I just haven't enabled debug output in spl_gen5.c, yet. I guess they would hang the system when enabling them.

While it would be easy to remove these debug statements, to be future-proof it would of course make sense to make the debug UART robust against this.

Quoted 6 lines
Quoted 3 lines

But given the problems with Rockchip ns16550, we would need a dedicated debug UART for socfpga to solve this. And that would probably mean code duplication.

What is the problem with Rockchip ? I don't want various SoCs blocking others.

I had sent a patch that does not wait for the TX fifo to hold more bytes if the baudrate prescaler is 0 (according to both the socfgpa and the rockchip docs, the UART is disabled if the prescaler is 0).

However, it seems that the prescaler was read back as 0 on a rockchip board which caused chars to be missing from the console output.

See this mail:
https://lists.denx.de/pipermail/u-boot/2018-December/350355.html

I checked with Henri and did not find a solution so I reverted the patch:
https://patchwork.ozlabs.org/patch/1007211/

Quoted 7 lines
Quoted 4 lines

Keeping this patch but only for selected platforms would be my favourite, but it would at least mean we need yet another debug UART selection, plus some changes to make the "prescaler == 0" detection specific to this new debug UART. Would this be better acceptable?

Doesn't the DT compatible tell you the UART type ? It does, so you can match on that and apply the workaround accordingly .

We're talking about debug UART here only. No DT compatible involved.

Quoted 1 line

Or you can cache the prescaler.

We already had that. Simon mentioned that on some platforms you neither have bss available nor 'gd' at the point where the debug UART is inialized, so there's not portable
storage to cache the prescaler, either :-(

The best I can think of right now would probably be to extend the list of debug UARTS
with an socfpga specific type which compiles the same code as DEBUG_UART_NS16550 but enables this prescaler check.

Regards,
Simon

#13 lore raw

PATCH 1/1 arm: socfpga: make debug uart work on socfpga_gen5

Quoted 121 lines · Simon Goldschmidt
Quoted 103 lines · Marek Vasut
Quoted 101 lines · Simon Goldschmidt
Quoted 80 lines · Marek Vasut
Quoted 78 lines · Simon Goldschmidt
Quoted 65 lines · Marek Vasut
Quoted 63 lines · Simon Goldschmidt

Am 07.01.2019 um 21:47 schrieb Marek Vasut:

Quoted 45 lines · Simon Goldschmidt
Quoted 28 lines

Am 07.01.2019 um 21:25 schrieb Marek Vasut:

Quoted 27 lines · Simon Goldschmidt
Quoted 26 lines

Am 07.01.2019 um 21:19 schrieb Marek Vasut:

Quoted 13 lines · Simon Goldschmidt
Quoted 12 lines

When debug UART is enabled on socfpga_gen5, the debug uart driver
hangs
in an endless loop because 'socfpga_bridges_reset' calls printf
before
the debug UART is initialized.

After the generic fix for this in the UART driver did not work
due to
portability issues, let's just drop this printf statement when
called
from SPL with debug UART enabled.

Quoted 3 lines
Quoted 1 line

Signed-off-by: Simon Goldschmidt <[email protected]>

Can we have an un-portable fix which at least works on SoCFPGA ? :)

This one worked on socfpga but broke rockchip:

https://patchwork.ozlabs.org/patch/992553/

However, the message below wasn't shown either with that patch applied.
The code just runs too early to enable the UART.

Quoted 7 lines
Quoted 4 lines
Quoted 2 lines

Do you want to keep the message (although I failed to see in which situation it can be printed) or do you just dislike the #ifdef thing?

I'd like to keep the error message if possible. Is it possible ?

I have *never* seen this message yet. I have failed to produce a situation where it is shown.

I believe that.

Quoted 6 lines

This function ('socfpga_bridges_reset') is called 5 times throughout the code, but only *one* single time with 'reset=0' as argument (only with 0, the code in question is executed). And this is in SPL before initializing the console and even before the debug UART can be initialized.

Quoted 7 lines
Quoted 4 lines

As I could see, the printf *is* executed on every boot (I saw the code hanging when enabling debug UART). However, when not booting from FPGA, it is just normal that the FPGA is not ready when running SPL. Why do you want an error message here anyway?

I was under the impression this is an error message, but it might not be so ? Maybe the wording is incorrect ?

Now that I re-read it, "aborting" is incorrect, yes.

So how should we proceed? This is an error message that can never be shown (like the code is now) but breaks debug UART.

I'd say we can drop it altogether. It might only be interesint if (in the future) that code would get called from somewhere else (i.e. later, after console initialization).

Quoted 5 lines
Quoted 3 lines

Re-reading spl_gen5.c, there are some 'debug' calls before the debug uart is initialized which probably would need to be removed as well, but that's a different story...

How come those don't hang the system then ?

I just haven't enabled debug output in spl_gen5.c, yet. I guess they would hang the system when enabling them.

While it would be easy to remove these debug statements, to be future-proof it would of course make sense to make the debug UART robust against this.

Quoted 6 lines
Quoted 3 lines

But given the problems with Rockchip ns16550, we would need a dedicated debug UART for socfpga to solve this. And that would probably mean code duplication.

What is the problem with Rockchip ? I don't want various SoCs blocking others.

I had sent a patch that does not wait for the TX fifo to hold more bytes if the baudrate prescaler is 0 (according to both the socfgpa and the rockchip docs, the UART is disabled if the prescaler is 0).

However, it seems that the prescaler was read back as 0 on a rockchip board which caused chars to be missing from the console output.

See this mail:
https://lists.denx.de/pipermail/u-boot/2018-December/350355.html

I checked with Henri and did not find a solution so I reverted the patch:
https://patchwork.ozlabs.org/patch/1007211/

Quoted 7 lines
Quoted 4 lines

Keeping this patch but only for selected platforms would be my favourite, but it would at least mean we need yet another debug UART selection, plus some changes to make the "prescaler == 0" detection specific to this new debug UART. Would this be better acceptable?

Doesn't the DT compatible tell you the UART type ? It does, so you can match on that and apply the workaround accordingly .

We're talking about debug UART here only. No DT compatible involved.

Quoted 1 line

Or you can cache the prescaler.

We already had that. Simon mentioned that on some platforms you neither have bss available nor 'gd' at the point where the debug UART is inialized, so there's not portable
storage to cache the prescaler, either :-(

Quoted 4 lines

The best I can think of right now would probably be to extend the list of debug UARTS
with an socfpga specific type which compiles the same code as DEBUG_UART_NS16550 but enables this prescaler check.

Uhhhhhh, unless you find a better option, that'd be fine by me.

Signature · 2 lines
Best regards,
Marek Vasut
#14 lore raw

PATCH 1/1 arm: socfpga: make debug uart work on socfpga_gen5

Am 08.01.2019 um 13:56 schrieb Marek Vasut:

Quoted 122 lines · Simon Goldschmidt
Quoted 121 lines · Marek Vasut
Quoted 103 lines · Simon Goldschmidt
Quoted 101 lines · Marek Vasut
Quoted 80 lines · Simon Goldschmidt
Quoted 78 lines · Marek Vasut
Quoted 65 lines · Simon Goldschmidt
Quoted 63 lines

Am 07.01.2019 um 21:47 schrieb Marek Vasut:

Quoted 45 lines · Simon Goldschmidt
Quoted 28 lines

Am 07.01.2019 um 21:25 schrieb Marek Vasut:

Quoted 27 lines · Simon Goldschmidt
Quoted 26 lines

Am 07.01.2019 um 21:19 schrieb Marek Vasut:

Quoted 16 lines · Simon Goldschmidt

When debug UART is enabled on socfpga_gen5, the debug uart driver
hangs
in an endless loop because 'socfpga_bridges_reset' calls printf
before
the debug UART is initialized.

After the generic fix for this in the UART driver did not work
due to
portability issues, let's just drop this printf statement when
called
from SPL with debug UART enabled.

Signed-off-by: Simon Goldschmidt <[email protected]>

Can we have an un-portable fix which at least works on SoCFPGA ? :)

This one worked on socfpga but broke rockchip:

https://patchwork.ozlabs.org/patch/992553/

However, the message below wasn't shown either with that patch applied.
The code just runs too early to enable the UART.

Quoted 7 lines
Quoted 4 lines
Quoted 2 lines

Do you want to keep the message (although I failed to see in which situation it can be printed) or do you just dislike the #ifdef thing?

I'd like to keep the error message if possible. Is it possible ?

I have *never* seen this message yet. I have failed to produce a situation where it is shown.

I believe that.

Quoted 6 lines

This function ('socfpga_bridges_reset') is called 5 times throughout the code, but only *one* single time with 'reset=0' as argument (only with 0, the code in question is executed). And this is in SPL before initializing the console and even before the debug UART can be initialized.

Quoted 7 lines
Quoted 4 lines

As I could see, the printf *is* executed on every boot (I saw the code hanging when enabling debug UART). However, when not booting from FPGA, it is just normal that the FPGA is not ready when running SPL. Why do you want an error message here anyway?

I was under the impression this is an error message, but it might not be so ? Maybe the wording is incorrect ?

Now that I re-read it, "aborting" is incorrect, yes.

So how should we proceed? This is an error message that can never be shown (like the code is now) but breaks debug UART.

I'd say we can drop it altogether. It might only be interesint if (in the future) that code would get called from somewhere else (i.e. later, after console initialization).

Quoted 5 lines
Quoted 3 lines

Re-reading spl_gen5.c, there are some 'debug' calls before the debug uart is initialized which probably would need to be removed as well, but that's a different story...

How come those don't hang the system then ?

I just haven't enabled debug output in spl_gen5.c, yet. I guess they would hang the system when enabling them.

While it would be easy to remove these debug statements, to be future-proof it would of course make sense to make the debug UART robust against this.

Quoted 6 lines
Quoted 3 lines

But given the problems with Rockchip ns16550, we would need a dedicated debug UART for socfpga to solve this. And that would probably mean code duplication.

What is the problem with Rockchip ? I don't want various SoCs blocking others.

I had sent a patch that does not wait for the TX fifo to hold more bytes if the baudrate prescaler is 0 (according to both the socfgpa and the rockchip docs, the UART is disabled if the prescaler is 0).

However, it seems that the prescaler was read back as 0 on a rockchip board which caused chars to be missing from the console output.

See this mail:
https://lists.denx.de/pipermail/u-boot/2018-December/350355.html

I checked with Henri and did not find a solution so I reverted the patch:
https://patchwork.ozlabs.org/patch/1007211/

Quoted 7 lines
Quoted 4 lines

Keeping this patch but only for selected platforms would be my favourite, but it would at least mean we need yet another debug UART selection, plus some changes to make the "prescaler == 0" detection specific to this new debug UART. Would this be better acceptable?

Doesn't the DT compatible tell you the UART type ? It does, so you can match on that and apply the workaround accordingly .

We're talking about debug UART here only. No DT compatible involved.

Quoted 1 line

Or you can cache the prescaler.

We already had that. Simon mentioned that on some platforms you neither have bss available nor 'gd' at the point where the debug UART is inialized, so there's not portable
storage to cache the prescaler, either :-(

Quoted 6 lines
Quoted 4 lines

The best I can think of right now would probably be to extend the list of debug UARTS
with an socfpga specific type which compiles the same code as DEBUG_UART_NS16550 but enables this prescaler check.

Uhhhhhh, unless you find a better option, that'd be fine by me.

This patch should be dropped in favour to another patch taht adds a Kconfig option to check the baudrate prescaler:

https://patchwork.ozlabs.org/patch/1022600/

Regards,
Simon

#15 lore raw

PATCH 1/1 arm: socfpga: make debug uart work on socfpga_gen5

Quoted 163 lines · Simon Goldschmidt

Am 08.01.2019 um 13:56 schrieb Marek Vasut:

Quoted 162 lines · Simon Goldschmidt
Quoted 160 lines · Marek Vasut
Quoted 141 lines · Simon Goldschmidt
Quoted 131 lines · Marek Vasut
Quoted 109 lines · Simon Goldschmidt
Quoted 101 lines · Marek Vasut
Quoted 83 lines · Simon Goldschmidt
Quoted 81 lines

Am 07.01.2019 um 21:47 schrieb Marek Vasut:

Quoted 64 lines · Simon Goldschmidt
Quoted 39 lines

Am 07.01.2019 um 21:25 schrieb Marek Vasut:

Quoted 38 lines · Simon Goldschmidt
Quoted 36 lines

Am 07.01.2019 um 21:19 schrieb Marek Vasut:
On 1/7/19 8:36 PM, Simon Goldschmidt wrote:
When debug UART is enabled on socfpga_gen5, the debug
uart driver
hangs
in an endless loop because 'socfpga_bridges_reset' calls
printf
before
the debug UART is initialized.

After the generic fix for this in the UART driver did not
work
due to
portability issues, let's just drop this printf statement
when
called
from SPL with debug UART enabled.

Signed-off-by: Simon Goldschmidt
<[email protected]>

Can we have an un-portable fix which at least works on
SoCFPGA ? :)

This one worked on socfpga but broke rockchip:

https://patchwork.ozlabs.org/patch/992553/

However, the message below wasn't shown either with that patch
applied.
The code just runs too early to enable the UART.

Do you want to keep the message (although I failed to see
in which
situation it can be printed) or do you just dislike the
#ifdef thing?

Quoted 5 lines
Quoted 2 lines

I'd like to keep the error message if possible. Is it possible ?

I have *never* seen this message yet. I have failed to produce a situation where it is shown.

I believe that.

Quoted 8 lines

This function ('socfpga_bridges_reset') is called 5 times throughout the
code, but only *one* single time with 'reset=0' as argument (only with
0, the code in question is executed). And this is in SPL before initializing the console and even before the debug UART can be initialized.

Quoted 7 lines

As I could see, the printf *is* executed on every boot (I saw the code
hanging when enabling debug UART). However, when not booting from FPGA,
it is just normal that the FPGA is not ready when running SPL. Why do
you want an error message here anyway?

Quoted 3 lines

I was under the impression this is an error message, but it might not be
so ? Maybe the wording is incorrect ?

Now that I re-read it, "aborting" is incorrect, yes.

So how should we proceed? This is an error message that can never be
shown (like the code is now) but breaks debug UART.

I'd say we can drop it altogether. It might only be interesint if (in
the future) that code would get called from somewhere else (i.e. later,
after console initialization).

Quoted 7 lines
Quoted 5 lines

Re-reading spl_gen5.c, there are some 'debug' calls before the debug
uart is initialized which probably would need to be removed as well, but
that's a different story...

How come those don't hang the system then ?

I just haven't enabled debug output in spl_gen5.c, yet. I guess they would hang
the system when enabling them.

While it would be easy to remove these debug statements, to be future-proof
it would of course make sense to make the debug UART robust against this.

Quoted 5 lines

But given the problems with Rockchip ns16550, we would need a dedicated
debug UART for socfpga to solve this. And that would probably mean code
duplication.

Quoted 3 lines

What is the problem with Rockchip ? I don't want various SoCs blocking
others.

I had sent a patch that does not wait for the TX fifo to hold more bytes if the
baudrate prescaler is 0 (according to both the socfgpa and the rockchip docs,
the UART is disabled if the prescaler is 0).

However, it seems that the prescaler was read back as 0 on a rockchip board
which caused chars to be missing from the console output.

See this mail:
https://lists.denx.de/pipermail/u-boot/2018-December/350355.html

I checked with Henri and did not find a solution so I reverted the patch:
https://patchwork.ozlabs.org/patch/1007211/

Quoted 7 lines

Keeping this patch but only for selected platforms would be my favourite, but it
would at least mean we need yet another debug UART selection, plus some changes
to make the "prescaler == 0" detection specific to this new debug UART.
Would this be better acceptable?

Quoted 2 lines

Doesn't the DT compatible tell you the UART type ? It does, so you can match on that and apply the workaround accordingly .

We're talking about debug UART here only. No DT compatible involved.

Quoted 1 line

Or you can cache the prescaler.

We already had that. Simon mentioned that on some platforms you neither have bss
available nor 'gd' at the point where the debug UART is inialized, so there's not portable
storage to cache the prescaler, either :-(

The best I can think of right now would probably be to extend the list of debug UARTS
with an socfpga specific type which compiles the same code as DEBUG_UART_NS16550
but enables this prescaler check.

Quoted 6 lines
Quoted 1 line

Uhhhhhh, unless you find a better option, that'd be fine by me.

This patch should be dropped in favour to another patch taht adds a Kconfig option to check the baudrate prescaler:

https://patchwork.ozlabs.org/patch/1022600/

So that's the real fix here ?

Signature · 2 lines
Best regards,
Marek Vasut
#16 lore raw

PATCH 1/1 arm: socfpga: make debug uart work on socfpga_gen5

Am 14.01.2019 um 19:26 schrieb Marek Vasut:

Quoted 164 lines · Simon Goldschmidt
Quoted 163 lines

Am 08.01.2019 um 13:56 schrieb Marek Vasut:

Quoted 162 lines · Simon Goldschmidt
Quoted 160 lines · Marek Vasut
Quoted 141 lines · Simon Goldschmidt
Quoted 131 lines · Marek Vasut
Quoted 109 lines · Simon Goldschmidt
Quoted 101 lines · Marek Vasut
Quoted 83 lines · Simon Goldschmidt
Quoted 81 lines

Am 07.01.2019 um 21:47 schrieb Marek Vasut:

Quoted 64 lines · Simon Goldschmidt
Quoted 39 lines

Am 07.01.2019 um 21:25 schrieb Marek Vasut:

Quoted 38 lines · Simon Goldschmidt

Am 07.01.2019 um 21:19 schrieb Marek Vasut:
On 1/7/19 8:36 PM, Simon Goldschmidt wrote:
When debug UART is enabled on socfpga_gen5, the debug
uart driver
hangs
in an endless loop because 'socfpga_bridges_reset' calls
printf
before
the debug UART is initialized.

After the generic fix for this in the UART driver did not
work
due to
portability issues, let's just drop this printf statement
when
called
from SPL with debug UART enabled.

Signed-off-by: Simon Goldschmidt
<[email protected]>

Can we have an un-portable fix which at least works on
SoCFPGA ? :)

This one worked on socfpga but broke rockchip:

https://patchwork.ozlabs.org/patch/992553/

However, the message below wasn't shown either with that patch
applied.
The code just runs too early to enable the UART.

Do you want to keep the message (although I failed to see
in which
situation it can be printed) or do you just dislike the
#ifdef thing?

Quoted 5 lines
Quoted 2 lines

I'd like to keep the error message if possible. Is it
possible ?

I have *never* seen this message yet. I have failed to produce a situation where it is shown.

I believe that.

Quoted 8 lines

This function ('socfpga_bridges_reset') is called 5 times throughout the
code, but only *one* single time with 'reset=0' as argument (only with
0, the code in question is executed). And this is in SPL before initializing the console and even before the debug UART can be initialized.

Quoted 7 lines

As I could see, the printf *is* executed on every boot (I saw the code
hanging when enabling debug UART). However, when not booting from FPGA,
it is just normal that the FPGA is not ready when running SPL. Why do
you want an error message here anyway?

Quoted 3 lines

I was under the impression this is an error message, but it might not be
so ? Maybe the wording is incorrect ?

Now that I re-read it, "aborting" is incorrect, yes.

So how should we proceed? This is an error message that can never be
shown (like the code is now) but breaks debug UART.

I'd say we can drop it altogether. It might only be interesint if (in
the future) that code would get called from somewhere else (i.e. later,
after console initialization).

Quoted 7 lines
Quoted 5 lines

Re-reading spl_gen5.c, there are some 'debug' calls before the debug
uart is initialized which probably would need to be removed as well, but
that's a different story...

How come those don't hang the system then ?

I just haven't enabled debug output in spl_gen5.c, yet. I guess they would hang
the system when enabling them.

While it would be easy to remove these debug statements, to be future-proof
it would of course make sense to make the debug UART robust against this.

Quoted 5 lines

But given the problems with Rockchip ns16550, we would need a dedicated
debug UART for socfpga to solve this. And that would probably mean code
duplication.

Quoted 3 lines

What is the problem with Rockchip ? I don't want various SoCs blocking
others.

I had sent a patch that does not wait for the TX fifo to hold more bytes if the
baudrate prescaler is 0 (according to both the socfgpa and the rockchip docs,
the UART is disabled if the prescaler is 0).

However, it seems that the prescaler was read back as 0 on a rockchip board
which caused chars to be missing from the console output.

See this mail:
https://lists.denx.de/pipermail/u-boot/2018-December/350355.html

I checked with Henri and did not find a solution so I reverted the patch:
https://patchwork.ozlabs.org/patch/1007211/

Quoted 7 lines

Keeping this patch but only for selected platforms would be my favourite, but it
would at least mean we need yet another debug UART selection, plus some changes
to make the "prescaler == 0" detection specific to this new debug UART.
Would this be better acceptable?

Quoted 2 lines

Doesn't the DT compatible tell you the UART type ? It does, so you can match on that and apply the workaround accordingly .

We're talking about debug UART here only. No DT compatible involved.

Quoted 1 line

Or you can cache the prescaler.

We already had that. Simon mentioned that on some platforms you neither have bss
available nor 'gd' at the point where the debug UART is inialized, so there's not portable
storage to cache the prescaler, either :-(

The best I can think of right now would probably be to extend the list of debug UARTS
with an socfpga specific type which compiles the same code as DEBUG_UART_NS16550
but enables this prescaler check.

Quoted 8 lines
Quoted 6 lines
Quoted 1 line

Uhhhhhh, unless you find a better option, that'd be fine by me.

This patch should be dropped in favour to another patch taht adds a Kconfig option to check the baudrate prescaler:

https://patchwork.ozlabs.org/patch/1022600/

So that's the real fix here ?

Yes: The real fix is that the uart driver should not sit in an endless loop (because the tx buffer does not get empty) when its 'putc' function is called but it isn't enabled.

The above mentione patch does this, but it only does so when specifically enabled because this patch somehow fails at least on rockchip. And since the driver (ns16550) is pretty generic, it might fail on other chips, too.

Regards,
Simon