Skip to contentSkip to conversation

Beagleboard: SPL hangs on serial init

U-Boot New man.huber at arcor.de 7 participants 37 messages Feb 27, 2013 – Apr 10, 2013 Arm (32-bit)

lore
Share & tools
lore
#0 lore raw

SPL hangs on a beagleboard during the serial initialization (line 40 of drivers/serial/ns16550.c). The reason is the non-empty shift register of TX (transmit FIFO is empty). To avoid the hangup include/configs/omap3_beagle.h has to be changed like in include/configs/igep00x0.h:

include/configs/omap3_beagle.h +3 -0
index 59255c4..63cd30b 100644
@@ -81,6 +81,9 @@
 #define CONFIG_SYS_NS16550_REG_SIZE    (-4)
 #define CONFIG_SYS_NS16550_CLK         V_NS16550_CLK
 
+/* define to avoid U-Boot to hang while waiting for TEMT */
+#define CONFIG_SYS_NS16550_BROKEN_TEMT
+
 /*
  * select serial console configuration
  */

Best regards,
Manfred Huber

#1 lore raw

I'm surprised that no one is interested in a functioning Beagleboard. Has no one tested the Beagleboard since 2012-09-19?

Best regards,
Manfred Huber

Quoted 23 lines · man.huber at arcor.de

SPL hangs on a beagleboard during the serial initialization (line 40 of drivers/serial/ns16550.c). The reason is the non-empty shift register of TX (transmit FIFO is empty). To avoid the hangup include/configs/omap3_beagle.h has to be changed like in include/configs/igep00x0.h:

include/configs/omap3_beagle.h +3 -0
index 59255c4..63cd30b 100644
@@ -81,6 +81,9 @@
  #define CONFIG_SYS_NS16550_REG_SIZE    (-4)
  #define CONFIG_SYS_NS16550_CLK         V_NS16550_CLK
 
+/* define to avoid U-Boot to hang while waiting for TEMT */
+#define CONFIG_SYS_NS16550_BROKEN_TEMT
+
  /*
   * select serial console configuration
   */

Best regards,
Manfred Huber
_______________________________________________
U-Boot mailing list
U-Boot at lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot

#2 lore raw
Quoted 2 lines · Manfred Huber

I'm surprised that no one is interested in a functioning Beagleboard. Has no one tested the Beagleboard since 2012-09-19?

I don't see this problem on mine (classic and xM), which is probably part of the why. I'm inclined to accept the patch, but can you try two things please:
- How reproducible is this problem, with the host and beagleboard combination you have? 100%?
- Do you have another beagleboard or another host PC (or USB-Serial dongle) you can try?

Thanks!

Signature · 8 lines
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 836 bytes
Desc: Digital signature
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20130319/4ae9b442/attachment.pgp>
#3 lore raw
Quoted 13 lines · Tom Rini
Quoted 2 lines · Manfred Huber

I'm surprised that no one is interested in a functioning Beagleboard. Has no one tested the Beagleboard since 2012-09-19?

I don't see this problem on mine (classic and xM), which is probably part of the why. I'm inclined to accept the patch, but can you try two things please:
- How reproducible is this problem, with the host and beagleboard combination you have? 100%?
- Do you have another beagleboard or another host PC (or USB-Serial dongle) you can try?

Quoted 2 lines

Thanks!

Thanks for your answer. I have only one Beagleboard Revision C4 (CONTROL_IDCODE of the OMAP3530 is 0x4B7AE02F). My host is a Ubuntu 12.10 (Quantal Quetzal) and I use the gcc-arm-linux-gnueabihf cross-compiler version 4.7.2-1.

Compiling the actual u-boot leaded to the reported error. All version since commit cb55b3320014b7f6014416c556fe506efbf0a84b led to the hanging. All version before boots correctly.

Adding the define to omap3_beagle.h leads to a correct booting for all versions. Also a reset of the uart at the beginning of the init function leads to a correct booting. So I exclude that the hardware is defective.

If you can tell me your compiler and version I can try to use your cross-compiler.

Best regards,
Manfred

#4 lore raw
In reply to Tom Rini
Quoted 13 lines · Tom Rini
Quoted 2 lines · Manfred Huber

I'm surprised that no one is interested in a functioning Beagleboard. Has no one tested the Beagleboard since 2012-09-19?

I don't see this problem on mine (classic and xM), which is probably part of the why. I'm inclined to accept the patch, but can you try two things please:
- How reproducible is this problem, with the host and beagleboard combination you have? 100%?
- Do you have another beagleboard or another host PC (or USB-Serial dongle) you can try?

Quoted 4 lines

Thanks!

--
Tom

Hi,

I had this issue on another TI OMAP3 based board (IGEPv2) which use an DM3730 processor. Other IGEP board users reported that U-Boot hung on their boards and that a patch to not wait for the Transmitter Empty (TEMT) to initialize the serial console fixed the issue. So I added the CONFIG_SYS_NS16550_BROKEN_TEMT config option and used it for IGEP boards (igep00x0) to make them boot again.

Back then I also tested on a Beagleboard Rev. C4 since it has the same ns16550 UART controller than the IGEPv2 as far as I understood. I used the exact U-Boot version, USB-Serial cable, host PC and terminal emulation program that I used for the IGEPv2 and the Beagleboard booted correctly. This is the same behavior that Tom had on his Beagleboard.

Since it worked on the Beagle I thought the issue was only present on IGEP boards but now Manfred says that he has the same issue on his Beagleboard. I now wonder if all IGEPv2 are broken or only my board and the ones of the users that cared to report this and other IGEPv2 can boot without CONFIG_SYS_NS16550_BROKEN_TEMT.

Thanks a lot and best regards,
Javier

#5 lore raw

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Quoted 35 lines · Javier Martinez Canillas
Quoted 13 lines · Tom Rini
Quoted 3 lines · Manfred Huber

I'm surprised that no one is interested in a functioning Beagleboard. Has no one tested the Beagleboard since 2012-09-19?

I don't see this problem on mine (classic and xM), which is probably part of the why. I'm inclined to accept the patch, but can you try two things please: - How reproducible is this problem, with the host and beagleboard combination you have? 100%? - Do you have another beagleboard or another host PC (or USB-Serial dongle) you can try?

Quoted 3 lines

Thanks!

-- Tom

Hi,

I had this issue on another TI OMAP3 based board (IGEPv2) which use an DM3730 processor. Other IGEP board users reported that U-Boot hung on their boards and that a patch to not wait for the Transmitter Empty (TEMT) to initialize the serial console fixed the issue. So I added the CONFIG_SYS_NS16550_BROKEN_TEMT config option and used it for IGEP boards (igep00x0) to make them boot again.

Back then I also tested on a Beagleboard Rev. C4 since it has the same ns16550 UART controller than the IGEPv2 as far as I understood. I used the exact U-Boot version, USB-Serial cable, host PC and terminal emulation program that I used for the IGEPv2 and the Beagleboard booted correctly. This is the same behavior that Tom had on his Beagleboard.

Quoted 5 lines

Since it worked on the Beagle I thought the issue was only present on IGEP boards but now Manfred says that he has the same issue on his Beagleboard. I now wonder if all IGEPv2 are broken or only my board and the ones of the users that cared to report this and other IGEPv2 can boot without CONFIG_SYS_NS16550_BROKEN_TEMT.

Yeah, this is very perplexing. I'm thinking we need to enable this "quirk" for all of the "omap" platforms except for OMAP3_ZOOM (which iirc has a different uart chip wired up rather than the SoC uart).

- --
Tom
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.11 (GNU/Linux)
Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/

iQIcBAEBAgAGBQJRSRB2AAoJENk4IS6UOR1WP9YP/2McsjKVfEFq1Xooosts6v7Y iyLfGg/yYxszfFABTtCwMUn/GjCw5kLjLQB3zISOdR15GTneZ3NCiXcLY6Z/AgId 2gCDV7MOg1WSXyItIn6M+ra/Dt+HMT5VrwN8Z10GPpzQj58HCiJV/12115mMQKLN fWIRCMALetJkIddogNrcZluIJDwR9ye3QTy8p6jE8uy5QBvuu3QyDr+CrJKq3gEk BKuC0+9xLjHSMG8KcGG4QEObmzOFyw227lR6Cmfdw8cK52XE2v+11jZk/3vFHfFf xlL117wRzd8H1r9LGY8SNnzIuz+G6hDwa1n7kpmYLW6S8I5F5b4gOsS7pmA908CQ vognhGq4GSg6SZEqFk6s4OcqfdEG4+dCcXxFLy0iD0GeAkvet4G97SqQgvVAbJ8m By1gsrwsK05j5rtPeA3ELSbM4AOu8jVJZI210eZYyRHW+b4qyA7Sl+W4CqDHiwLk SGt4UT0S6/6fnV9M4oKq3xhh3R59ZYhkeUiOFoL4cUwOlp9PXbaWgkiNGyYZBCoQ 5XmfNGGyiT5bcueeyR1Swtw8UNX+FA4sncnJrtELFqRpb9SNFJq3GdTx9gNAJz6a Q+RS41IApAUz8vPq0Kg8JWF0h7C1IqRWMzLi3mIXpxZCbYy+0ElAgLMp3XeKbYhx SF/nnpv1PKMGWQVobw0s
=9RxY
-----END PGP SIGNATURE-----

#6 lore raw

Am 20.03.2013 02:27, schrieb Tom Rini:

Quoted 45 lines

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Quoted 35 lines · Javier Martinez Canillas
Quoted 13 lines · Tom Rini
Quoted 3 lines · Manfred Huber

I'm surprised that no one is interested in a functioning Beagleboard. Has no one tested the Beagleboard since 2012-09-19?

I don't see this problem on mine (classic and xM), which is probably part of the why. I'm inclined to accept the patch, but can you try two things please: - How reproducible is this problem, with the host and beagleboard combination you have? 100%? - Do you have another beagleboard or another host PC (or USB-Serial dongle) you can try?

Quoted 3 lines

Thanks!

-- Tom

Hi,

I had this issue on another TI OMAP3 based board (IGEPv2) which use an DM3730 processor. Other IGEP board users reported that U-Boot hung on their boards and that a patch to not wait for the Transmitter Empty (TEMT) to initialize the serial console fixed the issue. So I added the CONFIG_SYS_NS16550_BROKEN_TEMT config option and used it for IGEP boards (igep00x0) to make them boot again.

Back then I also tested on a Beagleboard Rev. C4 since it has the same ns16550 UART controller than the IGEPv2 as far as I understood. I used the exact U-Boot version, USB-Serial cable, host PC and terminal emulation program that I used for the IGEPv2 and the Beagleboard booted correctly. This is the same behavior that Tom had on his Beagleboard.

Quoted 5 lines

Since it worked on the Beagle I thought the issue was only present on IGEP boards but now Manfred says that he has the same issue on his Beagleboard. I now wonder if all IGEPv2 are broken or only my board and the ones of the users that cared to report this and other IGEPv2 can boot without CONFIG_SYS_NS16550_BROKEN_TEMT.

Quoted 6 lines

Yeah, this is very perplexing. I'm thinking we need to enable this "quirk" for all of the "omap" platforms except for OMAP3_ZOOM (which iirc has a different uart chip wired up rather than the SoC uart).

- --
Tom

As I described in my first mail the reason is the missing UART_LSR_TEMT bit in the line status register. Comparing the UART_LSR_THRE bit instead works in my case.

Maybe Javier can test on his IGEP board if it works for him to compare the UART_LSR_THRE bit instead of the UART_LSR_TEMT bit.

Another solution would be to make a soft reset of the UART as first command in the init function. This works also in my case.

On the other hand we can try to identify which OMAP3 has this behavior. The module version register of the UART returns version 4.6.

Best regards,
Manfred

#7 lore raw
Quoted 60 lines · Manfred Huber

Am 20.03.2013 02:27, schrieb Tom Rini:

Quoted 50 lines

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Quoted 39 lines · Javier Martinez Canillas
Quoted 15 lines · Tom Rini
Quoted 3 lines · Manfred Huber

I'm surprised that no one is interested in a functioning Beagleboard. Has no one tested the Beagleboard since 2012-09-19?

I don't see this problem on mine (classic and xM), which is probably part of the why. I'm inclined to accept the patch, but can you try two things please: - How reproducible is this problem, with the host and beagleboard combination you have? 100%? - Do you have another beagleboard or another host PC (or USB-Serial dongle) you can try?

Quoted 3 lines

Thanks!

-- Tom

Hi,

I had this issue on another TI OMAP3 based board (IGEPv2) which use an DM3730 processor. Other IGEP board users reported that U-Boot hung on their boards and that a patch to not wait for the Transmitter Empty (TEMT) to initialize the serial console fixed the issue. So I added the CONFIG_SYS_NS16550_BROKEN_TEMT config option and used it for IGEP boards (igep00x0) to make them boot again.

Back then I also tested on a Beagleboard Rev. C4 since it has the same ns16550 UART controller than the IGEPv2 as far as I understood. I used the exact U-Boot version, USB-Serial cable, host PC and terminal emulation program that I used for the IGEPv2 and the Beagleboard booted correctly. This is the same behavior that Tom had on his Beagleboard.

Quoted 5 lines

Since it worked on the Beagle I thought the issue was only present on IGEP boards but now Manfred says that he has the same issue on his Beagleboard. I now wonder if all IGEPv2 are broken or only my board and the ones of the users that cared to report this and other IGEPv2 can boot without CONFIG_SYS_NS16550_BROKEN_TEMT.

Quoted 6 lines

Yeah, this is very perplexing. I'm thinking we need to enable this "quirk" for all of the "omap" platforms except for OMAP3_ZOOM (which iirc has a different uart chip wired up rather than the SoC uart).

- --
Tom

Quoted 7 lines

As I described in my first mail the reason is the missing UART_LSR_TEMT bit in the line status register. Comparing the UART_LSR_THRE bit instead works in my case.

Maybe Javier can test on his IGEP board if it works for him to compare the UART_LSR_THRE bit instead of the UART_LSR_TEMT bit.

I see the same behavior in the IGEPv2. I tested mainline U-boot + your "[PATCH] omap3_beagle: Enable CONFIG_SYS_NS16550_BROKEN_TEMT" patch and SPL boots OK on my board.

Quoted 3 lines

Another solution would be to make a soft reset of the UART as first command in the init function. This works also in my case.

I prefer this approach if it doesn't affect other boards.

Quoted 7 lines

On the other hand we can try to identify which OMAP3 has this behavior. The module version register of the UART returns version 4.6.

Best regards,
Manfred

Best regards,
Javier

#8 lore raw

Hi all,

probably I found the error. It should be a bug in the ROM code of the OMAP3.

Depending on the Booting Sequence of the OMAP3, SPL is hanging or not. If ROM code configures UART3 before SPL starts from NAND it will lead to a hang of the SPL. If UART3 is not configured, SPL boots correctly from NAND.

If ROM code configures UART3 it leaves the UART in a bad state. Although Transmitter is not empty (TEMT is not set), ROM code disables the UART. Therefore Transmitter can never get empty.

In a normal Booting Sequence where NAND is for UART3 the bug will never appear.

There are some solutions:

1. Configuring UART3 first and let Transmitter send until Transmitter is empty.
2. Soft reset of Transmitter. (OMAP3 specific, NS16550 has no soft reset)
3. ...

Please tell me your assessment.

Best regards,
Manfred Huber

#9 lore raw

PATCH 1/1 omap3_beagle: Enable CONFIG_SYS_NS16550_BROKEN_TEMT

In reply to Javier Martinez Canillas

From: Manfred Huber

Beagleboard UART (ns16550) doesn't set the Transmitter Empty (TEMT) Bit in SPL. Only Transmitter Hold Register Empty (THRE) Bit is set. This makes SPL to hang while waiting for TEMT. Adding the CONFIG_SYS_NS16550_BROKEN_TEMT config option and waiting for THRE avoid this issue.

---
  drivers/serial/ns16550.c       |    5 ++++-
  include/configs/omap3_beagle.h |    3 +++
  2 files changed, 7 insertions(+), 1 deletion(-)
drivers/serial/ns16550.c +4 -1
index b2da8b3..6379bcc 100644
@@ -36,7 +36,10 @@
 
  void NS16550_init(NS16550_t com_port, int baud_divisor)
  {
-#if (!defined(CONFIG_SYS_NS16550_BROKEN_TEMT))
+#if defined(CONFIG_SPL_BUILD) && defined(CONFIG_SYS_NS16550_BROKEN_TEMT)
+	while (!(serial_in(&com_port->lsr) & UART_LSR_THRE))
+		;
+#else
  	while (!(serial_in(&com_port->lsr) & UART_LSR_TEMT))
  		;
  #endif
include/configs/omap3_beagle.h +3 -0
index 48ce4c0..6ab46d5 100644
@@ -82,6 +82,9 @@
  #define CONFIG_SYS_NS16550_REG_SIZE	(-4)
  #define CONFIG_SYS_NS16550_CLK		V_NS16550_CLK
 
+/* define to avoid U-Boot to hang while waiting for TEMT */
+#define CONFIG_SYS_NS16550_BROKEN_TEMT
+
  /*
   * select serial console configuration
   */
#10 lore raw

PATCH 1/1 omap3_beagle: Enable CONFIG_SYS_NS16550_BROKEN_TEMT

Hi Manfred,

Quoted 18 lines · Manfred Huber

From: Manfred Huber

Beagleboard UART (ns16550) doesn't set the Transmitter Empty (TEMT) Bit in SPL. Only Transmitter Hold Register Empty (THRE) Bit is set. This makes SPL to hang while waiting for TEMT. Adding the CONFIG_SYS_NS16550_BROKEN_TEMT config option and waiting for THRE avoid this issue.

---
 drivers/serial/ns16550.c       |    5 ++++-
 include/configs/omap3_beagle.h |    3 +++
 2 files changed, 7 insertions(+), 1 deletion(-)
drivers/serial/ns16550.c +0 -0
index b2da8b3..6379bcc 100644

drivers/serial/ns16550.c line 42

Quoted 8 lines
drivers/serial/ns16550.c +4 -1
@@ -36,7 +36,10 @@
 
 void NS16550_init(NS16550_t com_port, int baud_divisor)
 {
-#if (!defined(CONFIG_SYS_NS16550_BROKEN_TEMT))
+#if defined(CONFIG_SPL_BUILD) && defined(CONFIG_SYS_NS16550_BROKEN_TEMT)
+       while (!(serial_in(&com_port->lsr) & UART_LSR_THRE))
+               ;
+#else

I'm not sure to add this behavior under CONFIG_SYS_NS16550_BROKEN_TEMT since this option just means:

"On some broken platforms the Transmitter Empty (TEMT) bit is not set in SPL making U-Boot to hang while waiting for it"

According to your findings it seems that some OMAP3 platforms (at least DM3730 and 3530) set THRE but I wonder if other broken platforms will behave the same.

The current CONFIG_SYS_NS16550_BROKEN_TEMT just skips this test so it can be reused by other platforms, but now your change makes it less generic since it will only work on platforms that set THRE.

So I would just leave CONFIG_SYS_NS16550_BROKEN_TEMT as is now and be able to reuse it on other platforms or add a new config option CONFIG_SYS_NS16550_WAIT_THRE or something that would test for THRE instead of TEMT and use that for OMAP3 based boards.

I do like your change that adds a test for CONFIG_SPL_BUILD since even in the README it says that the issue is only present in SPL. So I just forgot to add this when added the config option.

Quoted 9 lines
drivers/serial/ns16550.c +0 -0
        while (!(serial_in(&com_port->lsr) & UART_LSR_TEMT))
                ;
 #endif
include/configs/omap3_beagle.h +0 -0
index 48ce4c0..6ab46d5 100644

include/configs/omap3_beagle.h line 90

Quoted 9 lines
include/configs/omap3_beagle.h +3 -0
@@ -82,6 +82,9 @@
 #define CONFIG_SYS_NS16550_REG_SIZE    (-4)
 #define CONFIG_SYS_NS16550_CLK         V_NS16550_CLK
 
+/* define to avoid U-Boot to hang while waiting for TEMT */
+#define CONFIG_SYS_NS16550_BROKEN_TEMT
+
 /*
  * select serial console configuration
  */

This part of your patch looks good to me but you should split your changes in two patches. One to change the ns16550 drvier and another one to add this config option for the Beagleboard.

Thanks a lot and best regards,
Javier

#11 lore raw

PATCH 1/1 omap3_beagle: Enable CONFIG_SYS_NS16550_BROKEN_TEMT

In reply to Manfred Huber
Quoted 20 lines · Manfred Huber

From: Manfred Huber

Beagleboard UART (ns16550) doesn't set the Transmitter Empty (TEMT) Bit in SPL. Only Transmitter Hold Register Empty (THRE) Bit is set. This makes SPL to hang while waiting for TEMT. Adding the CONFIG_SYS_NS16550_BROKEN_TEMT config option and waiting for THRE avoid this issue.

---
 drivers/serial/ns16550.c       |    5 ++++-
 include/configs/omap3_beagle.h |    3 +++
 2 files changed, 7 insertions(+), 1 deletion(-)
drivers/serial/ns16550.c +0 -0
index b2da8b3..6379bcc 100644
@@ -36,7 +36,10 @@
 

drivers/serial/ns16550.c line 45

Quoted 10 lines
drivers/serial/ns16550.c +4 -1
 void NS16550_init(NS16550_t com_port, int baud_divisor)
 {
-#if (!defined(CONFIG_SYS_NS16550_BROKEN_TEMT))
+#if defined(CONFIG_SPL_BUILD) && defined(CONFIG_SYS_NS16550_BROKEN_TEMT)
+	while (!(serial_in(&com_port->lsr) & UART_LSR_THRE))
+		;
+#else
 	while (!(serial_in(&com_port->lsr) & UART_LSR_TEMT))
 		;
 #endif

Scott, do you still have access to the failing systems that made us introduce this change to start with? Could we perhaps go with the THRE test instead in all cases? Thanks!

Signature · 8 lines
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 836 bytes
Desc: Digital signature
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20130321/91cb1a48/attachment.pgp>
#12 lore raw

PATCH 1/1 omap3_beagle: Enable CONFIG_SYS_NS16550_BROKEN_TEMT

Quoted 5 lines · Tom Rini
Quoted 4 lines · Manfred Huber

From: Manfred Huber

Beagleboard UART (ns16550) doesn't set the Transmitter Empty (TEMT) Bit in SPL.

The serial port behaves differently based on the stage of U-Boot that is running?

Or is it that the bit doesn't get set until the port has been properly initialized? Couldn't that happen in a case where SPL isn't used at all?

Quoted 22 lines
Quoted 16 lines

Only Transmitter Hold Register Empty (THRE) Bit is set. This makes SPL to hang while waiting for TEMT. Adding the CONFIG_SYS_NS16550_BROKEN_TEMT config option and waiting for THRE avoid this issue.

---
 drivers/serial/ns16550.c       |    5 ++++-
 include/configs/omap3_beagle.h |    3 +++
 2 files changed, 7 insertions(+), 1 deletion(-)
drivers/serial/ns16550.c +0 -0
index b2da8b3..6379bcc 100644

drivers/serial/ns16550.c line 39

Quoted 5 lines
drivers/serial/ns16550.c +1 -1
@@ -36,7 +36,10 @@
 
 void NS16550_init(NS16550_t com_port, int baud_divisor)
 {
-#if (!defined(CONFIG_SYS_NS16550_BROKEN_TEMT))
+#if defined(CONFIG_SPL_BUILD) &&  

defined(CONFIG_SYS_NS16550_BROKEN_TEMT)

Quoted 9 lines

drivers/serial/ns16550.c line 45

Quoted 6 lines
drivers/serial/ns16550.c +3 -0
+	while (!(serial_in(&com_port->lsr) & UART_LSR_THRE))
+		;
+#else
 	while (!(serial_in(&com_port->lsr) & UART_LSR_TEMT))
 		;
 #endif

Scott, do you still have access to the failing systems that made us introduce this change to start with?

It was an intermittent failure seen on a development tree, so not really. You could try testing it by printing something immediately before calling NS16550_init(), either in a situation where you know the serial port is already configured (e.g. by SPL) or by calling NS16550_init() twice.

Quoted 1 line

Could we perhaps go with the THRE test instead in all cases? Thanks!

Wouldn't that still allow the last character to possibly be corrupted?

-Scott

#13 lore raw

PATCH v2 1/1 omap3_beagle: Enabling UART3 first allows the Transmitter to be empty

In reply to Javier Martinez Canillas

From: Manfred Huber

Due to a Bug in the ROM code of some OMAP3 devices, the TEMT bit is not set if UART3 is configured before (only THRE is set). Reason is the disabling of UART3 even though the Transmitter is not empty. Enabling UART3 allows the Transmitter to be empty.

---
  drivers/serial/ns16550.c |   12 ++++++++++--
  1 file changed, 10 insertions(+), 2 deletions(-)
drivers/serial/ns16550.c +2 -1
index b2da8b3..24ff84f 100644
@@ -36,10 +36,18 @@
 
  void NS16550_init(NS16550_t com_port, int baud_divisor)
  {
-#if (!defined(CONFIG_SYS_NS16550_BROKEN_TEMT))
+#if (defined(CONFIG_SPL_BUILD) && defined(CONFIG_OMAP34XX))
+	if ((serial_in(&com_port->lsr) & (UART_LSR_TEMT | UART_LSR_THRE)) == 

UART_LSR_THRE) {
+ serial_out(UART_LCR_DLAB, &com_port->lcr);
+ serial_out(baud_divisor & 0xff, &com_port->dll);
+ serial_out((baud_divisor >> 8) & 0xff, &com_port->dlm);
+ serial_out(UART_LCRVAL, &com_port->lcr);
+ serial_out(0, &com_port->mdr1);
+ }
+#endif
+
while (!(serial_in(&com_port->lsr) & UART_LSR_TEMT))
;
-#endif

  	serial_out(CONFIG_SYS_NS16550_IER, &com_port->ier);
  #if (defined(CONFIG_OMAP) && !defined(CONFIG_OMAP3_ZOOM2)) || \
#14 lore raw

PATCH v2 1/1 omap3_beagle: Enabling UART3 first allows the Transmitter to be empty

Please test the Patch. It is very simple on a Beagleboard. I guess you have flashed the actual SPL and u-boot and Beagleboard boots correctly. Now press and hold 'User' button and connect power. SPL should hang. You can see some symbols on the console from the ROM code.

Install the Patch, compile it and flash the NAND. Beagleboard still boots correctly. Now press and hold 'User' button again and Beagleboard should also boot correctly. The Patch works.

I suspect the IGEP board has the same bug. If so, the Patch should work on this board too and we don't need CONFIG_SYS_NS16550_BROKEN_TEMT anymore.

If you don't want a patch for this bug please let me know. I will not bother you again.

Best regards,
Manfred

Quoted 42 lines · Manfred Huber

From: Manfred Huber

Due to a Bug in the ROM code of some OMAP3 devices, the TEMT bit is not set if UART3 is configured before (only THRE is set). Reason is the disabling of UART3 even though the Transmitter is not empty. Enabling UART3 allows the Transmitter to be empty.

---
  drivers/serial/ns16550.c |   12 ++++++++++--
  1 file changed, 10 insertions(+), 2 deletions(-)
drivers/serial/ns16550.c +10 -2
index b2da8b3..24ff84f 100644
@@ -36,10 +36,18 @@
 
  void NS16550_init(NS16550_t com_port, int baud_divisor)
  {
-#if (!defined(CONFIG_SYS_NS16550_BROKEN_TEMT))
+#if (defined(CONFIG_SPL_BUILD) && defined(CONFIG_OMAP34XX))
+    if ((serial_in(&com_port->lsr) & (UART_LSR_TEMT | UART_LSR_THRE))
 == UART_LSR_THRE) {
+        serial_out(UART_LCR_DLAB, &com_port->lcr);
+        serial_out(baud_divisor & 0xff, &com_port->dll);
+        serial_out((baud_divisor >> 8) & 0xff, &com_port->dlm);
+        serial_out(UART_LCRVAL, &com_port->lcr);
+        serial_out(0, &com_port->mdr1);
+    }
+#endif
+
      while (!(serial_in(&com_port->lsr) & UART_LSR_TEMT))
          ;
-#endif
 
      serial_out(CONFIG_SYS_NS16550_IER, &com_port->ier);

#if (defined(CONFIG_OMAP) && !defined(CONFIG_OMAP3_ZOOM2)) || \
_______________________________________________
U-Boot mailing list
U-Boot at lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot

#15 lore raw

PATCH v2 1/1 omap3_beagle: Enabling UART3 first allows the Transmitter to be empty

Quoted 5 lines · Manfred Huber

Please test the Patch. It is very simple on a Beagleboard. I guess you have flashed the actual SPL and u-boot and Beagleboard boots correctly. Now press and hold 'User' button and connect power. SPL should hang. You can see some symbols on the console from the ROM code.

Hi Manfred,

I don't have access to my IGEP board right now but I'll test your patch as soon as posible.

Quoted 8 lines

Install the Patch, compile it and flash the NAND. Beagleboard still boots correctly. Now press and hold 'User' button again and Beagleboard should also boot correctly. The Patch works.

I suspect the IGEP board has the same bug. If so, the Patch should work on this board too and we don't need CONFIG_SYS_NS16550_BROKEN_TEMT anymore.

I still think that we should keep CONFIG_SYS_NS16550_BROKEN_TEMT or something similar instead of just checking for CONFIG_OMAP34XX. Since we don't know if this problem is also present on other TI OMAP platforms (or any other platform). I would just change CONFIG_SYS_NS16550_BROKEN_TEMT semantics once is confirmed that this also fixes the issue on IGEP boards.

Also, if you are removing CONFIG_SYS_NS16550_BROKEN_TEMT then you have to update the README too since it is explained there what this config option does.

Quoted 3 lines

If you don't want a patch for this bug please let me know. I will not bother you again.

Thanks a lot for working on this. Some people work on mainline U-Boot on their free time (like myself) so it can take a few days until you get a response about a patch. Please be patient :-)

Quoted 4 lines

Best regards,
Manfred

Thank a lot and best regards,
Javier

Quoted 47 lines · Manfred Huber
Quoted 43 lines

From: Manfred Huber

Due to a Bug in the ROM code of some OMAP3 devices, the TEMT bit is not set if UART3 is configured before (only THRE is set). Reason is the disabling of UART3 even though the Transmitter is not empty. Enabling UART3 allows the Transmitter to be empty.

---
  drivers/serial/ns16550.c |   12 ++++++++++--
  1 file changed, 10 insertions(+), 2 deletions(-)
drivers/serial/ns16550.c +10 -2
index b2da8b3..24ff84f 100644
@@ -36,10 +36,18 @@
 
  void NS16550_init(NS16550_t com_port, int baud_divisor)
  {
-#if (!defined(CONFIG_SYS_NS16550_BROKEN_TEMT))
+#if (defined(CONFIG_SPL_BUILD) && defined(CONFIG_OMAP34XX))
+    if ((serial_in(&com_port->lsr) & (UART_LSR_TEMT | UART_LSR_THRE))
 == UART_LSR_THRE) {
+        serial_out(UART_LCR_DLAB, &com_port->lcr);
+        serial_out(baud_divisor & 0xff, &com_port->dll);
+        serial_out((baud_divisor >> 8) & 0xff, &com_port->dlm);
+        serial_out(UART_LCRVAL, &com_port->lcr);
+        serial_out(0, &com_port->mdr1);
+    }
+#endif
+
      while (!(serial_in(&com_port->lsr) & UART_LSR_TEMT))
          ;
-#endif
 
      serial_out(CONFIG_SYS_NS16550_IER, &com_port->ier);

#if (defined(CONFIG_OMAP) && !defined(CONFIG_OMAP3_ZOOM2)) || \
_______________________________________________
U-Boot mailing list
U-Boot at lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot

#16 lore raw

PATCH v2 1/1 omap3_beagle: Enabling UART3 first allows the Transmitter to be empty

Quoted 21 lines · Javier Martinez Canillas
Quoted 5 lines · Manfred Huber

Please test the Patch. It is very simple on a Beagleboard. I guess you have flashed the actual SPL and u-boot and Beagleboard boots correctly. Now press and hold 'User' button and connect power. SPL should hang. You can see some symbols on the console from the ROM code.

Hi Manfred,

I don't have access to my IGEP board right now but I'll test your patch as soon as posible.

Quoted 8 lines

Install the Patch, compile it and flash the NAND. Beagleboard still boots correctly. Now press and hold 'User' button again and Beagleboard should also boot correctly. The Patch works.

I suspect the IGEP board has the same bug. If so, the Patch should work on this board too and we don't need CONFIG_SYS_NS16550_BROKEN_TEMT anymore.

Quoted 6 lines

I still think that we should keep CONFIG_SYS_NS16550_BROKEN_TEMT or something similar instead of just checking for CONFIG_OMAP34XX. Since we don't know if this problem is also present on other TI OMAP platforms (or any other platform). I would just change CONFIG_SYS_NS16550_BROKEN_TEMT semantics once is confirmed that this also fixes the issue on IGEP boards.

I'm attempting to see if this ROM bug is (a) known and (b) is or was fixed at some point. Based on what I know (or at least think I know) of how the ROM code lived for "OMAP3", given that you're seeing this on beagle and igep, it's a valid assumption that OMAP34XX is buggy. The question I have (and hope for resolution on) is if it's a problem on am335x/omap4 or later as well. If I follow how to reproduce this issue (and I think I do), assuming I can I'll setup an am335x platform in a similar position.

Quoted 7 lines
Quoted 3 lines

If you don't want a patch for this bug please let me know. I will not bother you again.

Thanks a lot for working on this. Some people work on mainline U-Boot on their free time (like myself) so it can take a few days until you get a response about a patch. Please be patient :-)

Yes, thanks for working this issue through, I also appreciate it!

Signature · 8 lines
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 836 bytes
Desc: Digital signature
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20130327/28e32fd7/attachment.pgp>
#17 lore raw

PATCH v2 1/1 omap3_beagle: Enabling UART3 first allows the Transmitter to be empty

In reply to Javier Martinez Canillas
Quoted 32 lines · Javier Martinez Canillas
Quoted 5 lines · Manfred Huber

Please test the Patch. It is very simple on a Beagleboard. I guess you have flashed the actual SPL and u-boot and Beagleboard boots correctly. Now press and hold 'User' button and connect power. SPL should hang. You can see some symbols on the console from the ROM code.

Hi Manfred,

I don't have access to my IGEP board right now but I'll test your patch as soon as posible.

Quoted 8 lines

Install the Patch, compile it and flash the NAND. Beagleboard still boots correctly. Now press and hold 'User' button again and Beagleboard should also boot correctly. The Patch works.

I suspect the IGEP board has the same bug. If so, the Patch should work on this board too and we don't need CONFIG_SYS_NS16550_BROKEN_TEMT anymore.

I still think that we should keep CONFIG_SYS_NS16550_BROKEN_TEMT or something similar instead of just checking for CONFIG_OMAP34XX. Since we don't know if this problem is also present on other TI OMAP platforms (or any other platform). I would just change CONFIG_SYS_NS16550_BROKEN_TEMT semantics once is confirmed that this also fixes the issue on IGEP boards.

Also, if you are removing CONFIG_SYS_NS16550_BROKEN_TEMT then you have to update the README too since it is explained there what this config option does.

Quoted 8 lines
Quoted 3 lines

If you don't want a patch for this bug please let me know. I will not bother you again.

Thanks a lot for working on this. Some people work on mainline U-Boot on their free time (like myself) so it can take a few days until you get a response about a patch. Please be patient :-)

Hi Javier,

Also like me. The patch is not for me, because I have written my own serial driver. So this comment was only not to waste your and my time if no one needs this patch.

Best regards,
Manfred

Quoted 55 lines
Quoted 4 lines

Best regards,
Manfred

Thank a lot and best regards,
Javier

Quoted 47 lines · Manfred Huber
Quoted 43 lines

From: Manfred Huber

Due to a Bug in the ROM code of some OMAP3 devices, the TEMT bit is not set if UART3 is configured before (only THRE is set). Reason is the disabling of UART3 even though the Transmitter is not empty. Enabling UART3 allows the Transmitter to be empty.

---
   drivers/serial/ns16550.c |   12 ++++++++++--
   1 file changed, 10 insertions(+), 2 deletions(-)
drivers/serial/ns16550.c +10 -2
index b2da8b3..24ff84f 100644
@@ -36,10 +36,18 @@
 
   void NS16550_init(NS16550_t com_port, int baud_divisor)
   {
-#if (!defined(CONFIG_SYS_NS16550_BROKEN_TEMT))
+#if (defined(CONFIG_SPL_BUILD) && defined(CONFIG_OMAP34XX))
+    if ((serial_in(&com_port->lsr) & (UART_LSR_TEMT | UART_LSR_THRE))
 == UART_LSR_THRE) {
+        serial_out(UART_LCR_DLAB, &com_port->lcr);
+        serial_out(baud_divisor & 0xff, &com_port->dll);
+        serial_out((baud_divisor >> 8) & 0xff, &com_port->dlm);
+        serial_out(UART_LCRVAL, &com_port->lcr);
+        serial_out(0, &com_port->mdr1);
+    }
+#endif
+
       while (!(serial_in(&com_port->lsr) & UART_LSR_TEMT))
           ;
-#endif
 
       serial_out(CONFIG_SYS_NS16550_IER, &com_port->ier);
   #if (defined(CONFIG_OMAP) && !defined(CONFIG_OMAP3_ZOOM2)) || \

_______________________________________________
U-Boot mailing list
U-Boot at lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot

#18 lore raw

PATCH v2 1/1 omap3_beagle: Enabling UART3 first allows the Transmitter to be empty

In reply to Javier Martinez Canillas
Quoted 1 line · Javier Martinez Canillas

On Wed, Mar 27, 2013 at 5:50 AM, Manfred Huber <[email protected]> wrote:

<snip>

Quoted 8 lines

I still think that we should keep CONFIG_SYS_NS16550_BROKEN_TEMT or something similar instead of just checking for CONFIG_OMAP34XX. Since we don't know if this problem is also present on other TI OMAP platforms (or any other platform). I would just change CONFIG_SYS_NS16550_BROKEN_TEMT semantics once is confirmed that this also fixes the issue on IGEP boards.

If we continue using CONFIG_SYS_NS16550_BROKEN_TEMT, there is no benefit by my patch. It works with the define alone.

Quoted 4 lines

Also, if you are removing CONFIG_SYS_NS16550_BROKEN_TEMT then you have to update the README too since it is explained there what this config option does.

And also in igep00x0.h

<snip>

Quoted 6 lines

Thank a lot and best regards,
Javier

Quoted 2 lines · Manfred Huber

<snip>

#19 lore raw

PATCH v2 1/1 omap3_beagle: Enabling UART3 first allows the Transmitter to be empty

In reply to Manfred Huber
Quoted 4 lines · Manfred Huber

Please test the Patch. It is very simple on a Beagleboard. I guess you have flashed the actual SPL and u-boot and Beagleboard boots correctly. Now press and hold 'User' button and connect power. SPL should hang. You can see some symbols on the console from the ROM code.

I cannot reproduce this problem on my Beagleboard C5. I note this only so it's clear I tried things out. I'm still supportive of the changes overall as they also don't break anything here. I'm also still waiting to hear back from some folks that might know what the ROM code does or doesn't do.

Signature · 8 lines
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 836 bytes
Desc: Digital signature
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20130328/ae913832/attachment-0001.pgp>
#20 lore raw

PATCH v2 1/1 omap3_beagle: Enabling UART3 first allows the Transmitter to be empty

In reply to Manfred Huber

Dear Manfred Huber,

---8<---
abiessmann at punisher % pwclient get 230994
Saved patch to U-Boot-1-1-v2-omap3_beagle-Enabling-UART3-first-allows-the-Transmitter-to-be-empty.patch abiessmann at punisher % git am U-Boot-1-1-v2-omap3_beagle-Enabling-UART3-first-allows-the-Transmitter-to-be-empty.patch Patch does not have a valid e-mail address.
abiessmann@punisher % ./tools/checkpatch.pl U-Boot-1-1-v2-omap3_beagle-Enabling-UART3-first-allows-the-Transmitter-to-be-empty.patch
ERROR: trailing whitespace
#39: FILE: drivers/serial/ns16550.c:40:
+^Iif ((serial_in(&com_port->lsr) & (UART_LSR_TEMT | UART_LSR_THRE)) == $

ERROR: patch seems to be corrupt (line wrapped?)
#40: FILE: drivers/serial/ns16550.c:40:
UART_LSR_THRE) {

total: 2 errors, 0 warnings, 20 lines checked

NOTE: whitespace errors detected, you may wish to use scripts/cleanpatch or
scripts/cleanfile

NOTE: Ignored message types: COMPLEX_MACRO CONSIDER_KSTRTO MINMAX MULTISTATEMENT_MACRO_USE_DO_WHILE

U-Boot-1-1-v2-omap3_beagle-Enabling-UART3-first-allows-the-Transmitter-to-be-empty.patch has style problems, please review.

If any of these errors are false positives, please report them to the maintainer, see CHECKPATCH in MAINTAINERS. --->8---

Can you please fix these errors?

Quoted 17 lines · Manfred Huber

From: Manfred Huber

Due to a Bug in the ROM code of some OMAP3 devices, the TEMT bit is not set if UART3 is configured before (only THRE is set). Reason is the disabling of UART3 even though the Transmitter is not empty. Enabling UART3 allows the Transmitter to be empty.

---
 drivers/serial/ns16550.c |   12 ++++++++++--
 1 file changed, 10 insertions(+), 2 deletions(-)
drivers/serial/ns16550.c +0 -0
index b2da8b3..24ff84f 100644

drivers/serial/ns16550.c line 39

Quoted 5 lines
drivers/serial/ns16550.c +1 -1
@@ -36,10 +36,18 @@
 
 void NS16550_init(NS16550_t com_port, int baud_divisor)
 {
-#if (!defined(CONFIG_SYS_NS16550_BROKEN_TEMT))
+#if (defined(CONFIG_SPL_BUILD) && defined(CONFIG_OMAP34XX))

I think a comment here would be good.

drivers/serial/ns16550.c line 41

Quoted 2 lines
drivers/serial/ns16550.c +1 -0
+    if ((serial_in(&com_port->lsr) & (UART_LSR_TEMT | UART_LSR_THRE))
 == UART_LSR_THRE) {

The patch is broken here, even if you fix the wrapping you will get an 'over 80 char' error here.

drivers/serial/ns16550.c line 46

Quoted 5 lines
drivers/serial/ns16550.c +5 -0
+        serial_out(UART_LCR_DLAB, &com_port->lcr);
+        serial_out(baud_divisor & 0xff, &com_port->dll);
+        serial_out((baud_divisor >> 8) & 0xff, &com_port->dlm);
+        serial_out(UART_LCRVAL, &com_port->lcr);
+        serial_out(0, &com_port->mdr1);

Do we need to setup baud a.s.o. here? Isn't it enough to issue an soft reset of the UART? I'm not in this material, I just wonder if we can omit some of the lines here cause we set e.g. the BAUD later on.

Quoted 9 lines
drivers/serial/ns16550.c +3 -1
+    }
+#endif
+
     while (!(serial_in(&com_port->lsr) & UART_LSR_TEMT))
         ;
-#endif
 
     serial_out(CONFIG_SYS_NS16550_IER, &com_port->ier);

#if (defined(CONFIG_OMAP) && !defined(CONFIG_OMAP3_ZOOM2)) || \

I managed to apply your patch anyhow. A short test on a tricorder board showed no harm to the boot process. So please get your patch clean and resend, then I will add my tested-by.

As Javier pointed out please think about using the CONFIG_SYS_NS16550_BROKEN_TEMT instead of SPL && OMAP34XX. Another solution could be to have this TEMT | THRE check in unconditionally, this however would require a lot more testing. Especially with the release date in mind.

Best regards

Andreas Bie?mann

#21 lore raw

PATCH v2 1/1 omap3_beagle: Enabling UART3 first allows the Transmitter to be empty

Quoted 98 lines · Andreas Bie?mann

Dear Manfred Huber,

---8<---
abiessmann at punisher % pwclient get 230994
Saved patch to U-Boot-1-1-v2-omap3_beagle-Enabling-UART3-first-allows-the-Transmitter-to-be-empty.patch abiessmann at punisher % git am U-Boot-1-1-v2-omap3_beagle-Enabling-UART3-first-allows-the-Transmitter-to-be-empty.patch Patch does not have a valid e-mail address.
abiessmann at punisher % ./tools/checkpatch.pl U-Boot-1-1-v2-omap3_beagle-Enabling-UART3-first-allows-the-Transmitter-to-be-empty.patch
ERROR: trailing whitespace
#39: FILE: drivers/serial/ns16550.c:40:
+^Iif ((serial_in(&com_port->lsr) & (UART_LSR_TEMT | UART_LSR_THRE)) == $

ERROR: patch seems to be corrupt (line wrapped?)
#40: FILE: drivers/serial/ns16550.c:40:
UART_LSR_THRE) {

total: 2 errors, 0 warnings, 20 lines checked

NOTE: whitespace errors detected, you may wish to use scripts/cleanpatch or
scripts/cleanfile

NOTE: Ignored message types: COMPLEX_MACRO CONSIDER_KSTRTO MINMAX MULTISTATEMENT_MACRO_USE_DO_WHILE

U-Boot-1-1-v2-omap3_beagle-Enabling-UART3-first-allows-the-Transmitter-to-be-empty.patch has style problems, please review.

If any of these errors are false positives, please report them to the maintainer, see CHECKPATCH in MAINTAINERS. --->8---

Can you please fix these errors?

Quoted 17 lines · Manfred Huber

From: Manfred Huber

Due to a Bug in the ROM code of some OMAP3 devices, the TEMT bit is not set if UART3 is configured before (only THRE is set). Reason is the disabling of UART3 even though the Transmitter is not empty. Enabling UART3 allows the Transmitter to be empty.

---
 drivers/serial/ns16550.c |   12 ++++++++++--
 1 file changed, 10 insertions(+), 2 deletions(-)
drivers/serial/ns16550.c +0 -0
index b2da8b3..24ff84f 100644

drivers/serial/ns16550.c line 39

Quoted 5 lines
drivers/serial/ns16550.c +1 -1
@@ -36,10 +36,18 @@
 
 void NS16550_init(NS16550_t com_port, int baud_divisor)
 {
-#if (!defined(CONFIG_SYS_NS16550_BROKEN_TEMT))
+#if (defined(CONFIG_SPL_BUILD) && defined(CONFIG_OMAP34XX))

I think a comment here would be good.

drivers/serial/ns16550.c line 41

Quoted 2 lines
drivers/serial/ns16550.c +1 -0
+    if ((serial_in(&com_port->lsr) & (UART_LSR_TEMT | UART_LSR_THRE))
 == UART_LSR_THRE) {

The patch is broken here, even if you fix the wrapping you will get an 'over 80 char' error here.

drivers/serial/ns16550.c line 46

Quoted 5 lines
drivers/serial/ns16550.c +5 -0
+        serial_out(UART_LCR_DLAB, &com_port->lcr);
+        serial_out(baud_divisor & 0xff, &com_port->dll);
+        serial_out((baud_divisor >> 8) & 0xff, &com_port->dlm);
+        serial_out(UART_LCRVAL, &com_port->lcr);
+        serial_out(0, &com_port->mdr1);

Do we need to setup baud a.s.o. here? Isn't it enough to issue an soft reset of the UART? I'm not in this material, I just wonder if we can omit some of the lines here cause we set e.g. the BAUD later on.

Quoted 9 lines
drivers/serial/ns16550.c +3 -1
+    }
+#endif
+
     while (!(serial_in(&com_port->lsr) & UART_LSR_TEMT))
         ;
-#endif
 
     serial_out(CONFIG_SYS_NS16550_IER, &com_port->ier);

#if (defined(CONFIG_OMAP) && !defined(CONFIG_OMAP3_ZOOM2)) || \

I managed to apply your patch anyhow. A short test on a tricorder board showed no harm to the boot process. So please get your patch clean and resend, then I will add my tested-by.

As Javier pointed out please think about using the CONFIG_SYS_NS16550_BROKEN_TEMT instead of SPL && OMAP34XX. Another solution could be to have this TEMT | THRE check in unconditionally, this however would require a lot more testing. Especially with the release date in mind.

Quoted 3 lines

Best regards

Andreas Bie?mann

Hi Manfred,

I just tested your patch and my IGEPv2 boots correctly.

So, after addressing the issues pointed out by Andreas feel free to add my Tested-by too.

Thanks a lot and best regards,
Javier

#22 lore raw

PATCH v2 1/1 omap3_beagle: Enabling UART3 first allows the Transmitter to be empty

In reply to Andreas Bießmann
Quoted 27 lines · Andreas Bie?mann

Dear Manfred Huber,

---8<---
abiessmann at punisher % pwclient get 230994
Saved patch to U-Boot-1-1-v2-omap3_beagle-Enabling-UART3-first-allows-the-Transmitter-to-be-empty.patch abiessmann at punisher % git am U-Boot-1-1-v2-omap3_beagle-Enabling-UART3-first-allows-the-Transmitter-to-be-empty.patch Patch does not have a valid e-mail address.
abiessmann at punisher % ./tools/checkpatch.pl U-Boot-1-1-v2-omap3_beagle-Enabling-UART3-first-allows-the-Transmitter-to-be-empty.patch
ERROR: trailing whitespace
#39: FILE: drivers/serial/ns16550.c:40:
+^Iif ((serial_in(&com_port->lsr) & (UART_LSR_TEMT | UART_LSR_THRE)) == $

ERROR: patch seems to be corrupt (line wrapped?)
#40: FILE: drivers/serial/ns16550.c:40:
UART_LSR_THRE) {

total: 2 errors, 0 warnings, 20 lines checked

NOTE: whitespace errors detected, you may wish to use scripts/cleanpatch or
scripts/cleanfile

NOTE: Ignored message types: COMPLEX_MACRO CONSIDER_KSTRTO MINMAX MULTISTATEMENT_MACRO_USE_DO_WHILE

Quoted 8 lines

U-Boot-1-1-v2-omap3_beagle-Enabling-UART3-first-allows-the-Transmitter-to-be-empty.patch has style problems, please review.

If any of these errors are false positives, please report them to the maintainer, see CHECKPATCH in MAINTAINERS. --->8---

Can you please fix these errors?

I will do it.

Quoted 20 lines · Manfred Huber
Quoted 18 lines

From: Manfred Huber

Due to a Bug in the ROM code of some OMAP3 devices, the TEMT bit is not set if UART3 is configured before (only THRE is set). Reason is the disabling of UART3 even though the Transmitter is not empty. Enabling UART3 allows the Transmitter to be empty.

---
  drivers/serial/ns16550.c |   12 ++++++++++--
  1 file changed, 10 insertions(+), 2 deletions(-)
drivers/serial/ns16550.c +0 -0
index b2da8b3..24ff84f 100644
@@ -36,10 +36,18 @@
 
Quoted 6 lines

drivers/serial/ns16550.c line 39

Quoted 4 lines
drivers/serial/ns16550.c +1 -1
  void NS16550_init(NS16550_t com_port, int baud_divisor)
  {
-#if (!defined(CONFIG_SYS_NS16550_BROKEN_TEMT))
+#if (defined(CONFIG_SPL_BUILD) && defined(CONFIG_OMAP34XX))

I think a comment here would be good.

I will do it.

Quoted 13 lines

drivers/serial/ns16550.c line 41

Quoted 3 lines
drivers/serial/ns16550.c +1 -0
+    if ((serial_in(&com_port->lsr) & (UART_LSR_TEMT | UART_LSR_THRE))
 == UART_LSR_THRE) {

The patch is broken here, even if you fix the wrapping you will get an 'over 80 char' error here.

drivers/serial/ns16550.c line 46

Quoted 5 lines
drivers/serial/ns16550.c +5 -0
+        serial_out(UART_LCR_DLAB, &com_port->lcr);
+        serial_out(baud_divisor & 0xff, &com_port->dll);
+        serial_out((baud_divisor >> 8) & 0xff, &com_port->dlm);
+        serial_out(UART_LCRVAL, &com_port->lcr);
+        serial_out(0, &com_port->mdr1);
Quoted 4 lines

Do we need to setup baud a.s.o. here? Isn't it enough to issue an soft reset of the UART? I'm not in this material, I just wonder if we can omit some of the lines here cause we set e.g. the BAUD later on.

The reason to setup the baud is for the shift register. It only works with programmed baud registers. A soft reset would also work, but as Scott Wood said it would corrupt the last character. On the other hand the character should be corrupted by disabling the UART. I have no preferred solution: programming the UART or a soft reset. Maybe someone wants to decide.

Quoted 14 lines
Quoted 9 lines
drivers/serial/ns16550.c +3 -1
+    }
+#endif
+
      while (!(serial_in(&com_port->lsr) & UART_LSR_TEMT))
          ;
-#endif
 
      serial_out(CONFIG_SYS_NS16550_IER, &com_port->ier);
  #if (defined(CONFIG_OMAP) && !defined(CONFIG_OMAP3_ZOOM2)) || \

I managed to apply your patch anyhow. A short test on a tricorder board showed no harm to the boot process. So please get your patch clean and resend, then I will add my tested-by.

Quoted 5 lines

As Javier pointed out please think about using the CONFIG_SYS_NS16550_BROKEN_TEMT instead of SPL && OMAP34XX. Another solution could be to have this TEMT | THRE check in unconditionally, this however would require a lot more testing. Especially with the release date in mind.

It's not critical. So I guess it's not needed for this release.

Quoted 5 lines

Best regards

Andreas Bie?mann

Best regards,
Manfred

#23 lore raw

PATCH v2 1/1 omap3_beagle: Enabling UART3 first allows the Transmitter to be empty

Dear Manfred Huber,

Quoted 1 line · Manfred Huber

On 2013-03-27 14:37, Andreas Bie?mann wrote:

<snip>

Quoted 1 line
Quoted 1 line · Manfred Huber

<snip>

Quoted 11 lines
Quoted 10 lines

Review

Quoted 5 lines
(quoted diff) +5 -0
+        serial_out(UART_LCR_DLAB, &com_port->lcr);
+        serial_out(baud_divisor & 0xff, &com_port->dll);
+        serial_out((baud_divisor >> 8) & 0xff, &com_port->dlm);
+        serial_out(UART_LCRVAL, &com_port->lcr);
+        serial_out(0, &com_port->mdr1);

Do we need to setup baud a.s.o. here? Isn't it enough to issue an soft reset of the UART? I'm not in this material, I just wonder if we can omit some of the lines here cause we set e.g. the BAUD later on.

Quoted 6 lines

The reason to setup the baud is for the shift register. It only works with programmed baud registers. A soft reset would also work, but as Scott Wood said it would corrupt the last character. On the other hand the character should be corrupted by disabling the UART. I have no preferred solution: programming the UART or a soft reset. Maybe someone wants to decide.

Well, I think also that re-programming the UART will destroy the last character in shift register anyway.
I wonder which use-case requires UART flushing in u-boot context before initializing the UART for u-boot correctly. Can someone explain this to me? Shouldn't we always start here from the very beginning and setup UART as configured?

Quoted 15 lines
Quoted 15 lines

Review

Quoted 10 lines
(quoted diff) +3 -1
+    }
+#endif
+
      while (!(serial_in(&com_port->lsr) & UART_LSR_TEMT))
          ;
-#endif
 
      serial_out(CONFIG_SYS_NS16550_IER, &com_port->ier);
  #if (defined(CONFIG_OMAP) && !defined(CONFIG_OMAP3_ZOOM2)) || \

I managed to apply your patch anyhow. A short test on a tricorder board showed no harm to the boot process. So please get your patch clean and resend, then I will add my tested-by.

Quoted 7 lines
Quoted 5 lines

As Javier pointed out please think about using the CONFIG_SYS_NS16550_BROKEN_TEMT instead of SPL && OMAP34XX. Another solution could be to have this TEMT | THRE check in unconditionally, this however would require a lot more testing. Especially with the release date in mind.

It's not critical. So I guess it's not needed for this release.

Well, if there are boards in the field that will not boot with the next release I think it is critical.
We do have some omap3 (omap35xx and am37xx) based boards here. I can recall a situation where some few boards did not boot from sd-card while serial debug cable was attached (AFAIR this was not the case when booting from NAND). The root cause was never investigated, so maybe we suffered exactly this bug.

Best regards

Andreas Bie?mann

#24 lore raw

PATCH v2 1/1 omap3_beagle: Enabling UART3 first allows the Transmitter to be empty

Quoted 67 lines · Andreas Bie?mann

Dear Manfred Huber,

Quoted 1 line · Manfred Huber

On 2013-03-27 14:37, Andreas Bie?mann wrote:

<snip>

Quoted 1 line
Quoted 1 line · Manfred Huber

<snip>

Quoted 11 lines
Quoted 10 lines

Review

Quoted 5 lines
(quoted diff) +5 -0
+        serial_out(UART_LCR_DLAB, &com_port->lcr);
+        serial_out(baud_divisor & 0xff, &com_port->dll);
+        serial_out((baud_divisor >> 8) & 0xff, &com_port->dlm);
+        serial_out(UART_LCRVAL, &com_port->lcr);
+        serial_out(0, &com_port->mdr1);

Do we need to setup baud a.s.o. here? Isn't it enough to issue an soft reset of the UART? I'm not in this material, I just wonder if we can omit some of the lines here cause we set e.g. the BAUD later on.

Quoted 6 lines

The reason to setup the baud is for the shift register. It only works with programmed baud registers. A soft reset would also work, but as Scott Wood said it would corrupt the last character. On the other hand the character should be corrupted by disabling the UART. I have no preferred solution: programming the UART or a soft reset. Maybe someone wants to decide.

Well, I think also that re-programming the UART will destroy the last character in shift register anyway.
I wonder which use-case requires UART flushing in u-boot context before initializing the UART for u-boot correctly. Can someone explain this to me? Shouldn't we always start here from the very beginning and setup UART as configured?

Quoted 15 lines
Quoted 15 lines

Review

Quoted 10 lines
(quoted diff) +3 -1
+    }
+#endif
+
      while (!(serial_in(&com_port->lsr) & UART_LSR_TEMT))
          ;
-#endif
 
      serial_out(CONFIG_SYS_NS16550_IER, &com_port->ier);
  #if (defined(CONFIG_OMAP) && !defined(CONFIG_OMAP3_ZOOM2)) || \

I managed to apply your patch anyhow. A short test on a tricorder board showed no harm to the boot process. So please get your patch clean and resend, then I will add my tested-by.

Quoted 7 lines
Quoted 5 lines

As Javier pointed out please think about using the CONFIG_SYS_NS16550_BROKEN_TEMT instead of SPL && OMAP34XX. Another solution could be to have this TEMT | THRE check in unconditionally, this however would require a lot more testing. Especially with the release date in mind.

It's not critical. So I guess it's not needed for this release.

Well, if there are boards in the field that will not boot with the next release I think it is critical.
We do have some omap3 (omap35xx and am37xx) based boards here. I can recall a situation where some few boards did not boot from sd-card while serial debug cable was attached (AFAIR this was not the case when booting from NAND). The root cause was never investigated, so maybe we suffered exactly this bug.

Quoted 3 lines

Best regards

Andreas Bie?mann

Hi Andreas,

When I first hit this bug I tried removing the serial debug cable and this made my IGEPv2 to boot correctly. Then I looked at the latest changes to the serial ns16550 driver and found that cb55b332 "serial/ns16550: wait for TEMT before initializing" was the culprit commit that made my board to not boot.

So, if I remember correctly, it seems as you hit the exact same bug (I didn't try to boot from NAND back then though)

Best regards,
Javier

#25 lore raw

PATCH v2 1/1 omap3_beagle: Enabling UART3 first allows the Transmitter to be empty

Hi Javier,

Quoted 6 lines · Javier Martinez Canillas
Quoted 4 lines · Andreas Bie?mann

Dear Manfred Huber,

Quoted 1 line · Manfred Huber

On 2013-03-27 14:37, Andreas Bie?mann wrote:

<snip>

Quoted 13 lines
Quoted 13 lines
Quoted 6 lines

The reason to setup the baud is for the shift register. It only works with programmed baud registers. A soft reset would also work, but as Scott Wood said it would corrupt the last character. On the other hand the character should be corrupted by disabling the UART. I have no preferred solution: programming the UART or a soft reset. Maybe someone wants to decide.

Well, I think also that re-programming the UART will destroy the last character in shift register anyway.
I wonder which use-case requires UART flushing in u-boot context before initializing the UART for u-boot correctly. Can someone explain this to me? Shouldn't we always start here from the very beginning and setup UART as configured?

<snip>

Quoted 5 lines

When I first hit this bug I tried removing the serial debug cable and this made my IGEPv2 to boot correctly. Then I looked at the latest changes to the serial ns16550 driver and found that cb55b332 "serial/ns16550: wait for TEMT before initializing" was the culprit commit that made my board to not boot.

Thanks for clarification. So there is a need to flush UART before initializing it in u-boot context as said by Scott's comment in cb55b332, at least for some systems.

I think Manfred's proposed solution in this patch is ok. It fixes a bug when transiting from (some) OMAP ROM code to SPL, therefore we should have the code conditionally on SPL and OMAP. Maybe we find out later, that this also matches other combinations. But for now I think we should just take Manfred's solution in this release, Tom?

Many thanks to you Manfred for forcing attention on this bug and providing a solution.

Best regards

Andreas Bie?mann

#26 lore raw

PATCH v2 1/1 omap3_beagle: Enabling UART3 first allows the Transmitter to be empty

Quoted 25 lines · Andreas Bie??mann

Hi Javier,

Quoted 6 lines · Javier Martinez Canillas
Quoted 4 lines · Andreas Bie??mann

Dear Manfred Huber,

Quoted 1 line · Manfred Huber

On 2013-03-27 14:37, Andreas Bie??mann wrote:

<snip>

Quoted 13 lines
Quoted 13 lines
Quoted 6 lines

The reason to setup the baud is for the shift register. It only works with programmed baud registers. A soft reset would also work, but as Scott Wood said it would corrupt the last character. On the other hand the character should be corrupted by disabling the UART. I have no preferred solution: programming the UART or a soft reset. Maybe someone wants to decide.

Well, I think also that re-programming the UART will destroy the last character in shift register anyway.
I wonder which use-case requires UART flushing in u-boot context before initializing the UART for u-boot correctly. Can someone explain this to me? Shouldn't we always start here from the very beginning and setup UART as configured?

We shouldn't be concerned with what is destroyed here as it's going to be related to ROM trying (and then failing and moving on from) to load via UART the next program. We've already started and are running, so the UART is ours to do with as we need. If ROM did load us over UART it really should already be in a clean state.

Quoted 12 lines

<snip>

Quoted 5 lines

When I first hit this bug I tried removing the serial debug cable and this made my IGEPv2 to boot correctly. Then I looked at the latest changes to the serial ns16550 driver and found that cb55b332 "serial/ns16550: wait for TEMT before initializing" was the culprit commit that made my board to not boot.

Thanks for clarification. So there is a need to flush UART before initializing it in u-boot context as said by Scott's comment in cb55b332, at least for some systems.

Quoted 5 lines

I think Manfred's proposed solution in this patch is ok. It fixes a bug when transiting from (some) OMAP ROM code to SPL, therefore we should have the code conditionally on SPL and OMAP. Maybe we find out later, that this also matches other combinations. But for now I think we should just take Manfred's solution in this release, Tom?

Agreed.

Quoted 2 lines

Many thanks to you Manfred for forcing attention on this bug and providing a solution.

And also very much agreed!

Signature · 8 lines
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 836 bytes
Desc: Digital signature
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20130328/598a67b1/attachment.pgp>
#27 lore raw

PATCH v2 1/1 omap3_beagle: Enabling UART3 first allows the Transmitter to be empty

In reply to Andreas Bießmann

Am 28.03.2013 09:45, schrieb Andreas Bie?mann:

Quoted 17 lines

Dear Manfred Huber,

Quoted 1 line · Manfred Huber

On 2013-03-27 14:37, Andreas Bie?mann wrote:

<snip>

Quoted 1 line
Quoted 1 line · Manfred Huber

<snip>

Quoted 6 lines
Quoted 6 lines
Quoted 5 lines
(quoted diff) +5 -0
+        serial_out(UART_LCR_DLAB, &com_port->lcr);
+        serial_out(baud_divisor & 0xff, &com_port->dll);
+        serial_out((baud_divisor >> 8) & 0xff, &com_port->dlm);
+        serial_out(UART_LCRVAL, &com_port->lcr);
+        serial_out(0, &com_port->mdr1);

<snip>

Quoted 4 lines

I wonder which use-case requires UART flushing in u-boot context before initializing the UART for u-boot correctly. Can someone explain this to me? Shouldn't we always start here from the very beginning and setup UART as configured?

Beagleboard has several ways to boot (NAND, SD/MMC, UART, ...). For the boot mode with UART, Beagleboard configures the UART and ends with a non empty transmitter. In a booting sequence where UART is before NAND, SD/MMC or wherever SPL starts from, we have not a clean UART.

Quoted 1 line

<snip>

Quoted 10 lines
Quoted 2 lines

It's not critical. So I guess it's not needed for this release.

Well, if there are boards in the field that will not boot with the next release I think it is critical.
We do have some omap3 (omap35xx and am37xx) based boards here. I can recall a situation where some few boards did not boot from sd-card while serial debug cable was attached (AFAIR this was not the case when booting from NAND). The root cause was never investigated, so maybe we suffered exactly this bug.

Can you test this boars with my patch?

Quoted 5 lines

Best regards

Andreas Bie?mann

#28 lore raw

PATCH v3 1/1 omap3_beagle: Enabling UART3 first allows the Transmitter to be empty

In reply to Javier Martinez Canillas

On some OMAP3 devices when UART3 is configured for boot mode before SPL starts only THRE bit is set. We have to empty the transmitter before initialization starts. This patch avoids the use of CONFIG_SYS_NS16550_BROKEN_TEMT.

---
README | 8 --------

 drivers/serial/ns16550.c   |   16 ++++++++++++++--
 include/configs/igep00x0.h |    3 ---
 3 files changed, 14 insertions(+), 13 deletions(-)
README +0 -8
index a336476..e6b3a50 100644
@@ -616,14 +616,6 @@ The following options need to be configured:
 		boot loader that has already initialized the UART.  Define this
 		variable to flush the UART at init time.
 
-		CONFIG_SYS_NS16550_BROKEN_TEMT
-
-		16550 UART set the Transmitter Empty (TEMT) Bit when all output
-		has finished and the transmitter is totally empty. U-Boot waits
-		for this bit to be set to initialize the serial console. On some
-		broken platforms this bit is not set in SPL making U-Boot to
-		hang while waiting for TEMT. Define this option to avoid it.
-
 
 - Console Interface:
 		Depending on board, define exactly one serial port
drivers/serial/ns16550.c +14 -2
index 87a0917..2922a2c 100644
@@ -36,10 +36,22 @@
 
 void NS16550_init(NS16550_t com_port, int baud_divisor)
 {
-#if (!defined(CONFIG_SYS_NS16550_BROKEN_TEMT))
+#if (defined(CONFIG_SPL_BUILD) && defined(CONFIG_OMAP34XX))
+	/* On some OMAP3 devices when UART3 is configured for boot mode before
+	   SPL starts only THRE bit is set. We have to empty the transmitter
+	   before initialization starts. */
+	if ((serial_in(&com_port->lsr) & (UART_LSR_TEMT | UART_LSR_THRE))
+	     == UART_LSR_THRE) {
+		serial_out(UART_LCR_DLAB, &com_port->lcr);
+		serial_out(baud_divisor & 0xff, &com_port->dll);
+		serial_out((baud_divisor >> 8) & 0xff, &com_port->dlm);
+		serial_out(UART_LCRVAL, &com_port->lcr);
+		serial_out(0, &com_port->mdr1);
+	}
+#endif
+
 	while (!(serial_in(&com_port->lsr) & UART_LSR_TEMT))
 		;
-#endif
 
 	serial_out(CONFIG_SYS_NS16550_IER, &com_port->ier);
 #if (defined(CONFIG_OMAP) && !defined(CONFIG_OMAP3_ZOOM2)) || \
include/configs/igep00x0.h +0 -3
index f8131b1..0617a58 100644
@@ -67,9 +67,6 @@
 #define CONFIG_SYS_NS16550_REG_SIZE	(-4)
 #define CONFIG_SYS_NS16550_CLK		V_NS16550_CLK
 
-/* define to avoid U-Boot to hang while waiting for TEMT */
-#define CONFIG_SYS_NS16550_BROKEN_TEMT
-
 /* select serial console configuration */
 #define CONFIG_CONS_INDEX		3
 #define CONFIG_SYS_NS16550_COM3		OMAP34XX_UART3
#29 lore raw

PATCH v3 1/1 omap3_beagle: Enabling UART3 first allows the Transmitter to be empty

Hi Manfred,

Quoted 6 lines · Manfred Huber

On some OMAP3 devices when UART3 is configured for boot mode before SPL starts only THRE bit is set. We have to empty the transmitter before initialization starts. This patch avoids the use of CONFIG_SYS_NS16550_BROKEN_TEMT.

---

Patch history is missing here.

Also, I would like the commit summary (first commit message line, also subject of the patch mail) to clearly state what the patch *does* as opposed to what *happens*, because it is unclear right now if you're describing the solution or the issue. Something like :

"omap3_beagle: flush UART3 xmit on enable if TEMT is broken"

Quoted 69 lines

README | 8 --------

 drivers/serial/ns16550.c   |   16 ++++++++++++++--
 include/configs/igep00x0.h |    3 ---
 3 files changed, 14 insertions(+), 13 deletions(-)
README +0 -8
index a336476..e6b3a50 100644
@@ -616,14 +616,6 @@ The following options need to be configured:
 		boot loader that has already initialized the UART.  Define this
 		variable to flush the UART at init time.
 
-		CONFIG_SYS_NS16550_BROKEN_TEMT
-
-		16550 UART set the Transmitter Empty (TEMT) Bit when all output
-		has finished and the transmitter is totally empty. U-Boot waits
-		for this bit to be set to initialize the serial console. On some
-		broken platforms this bit is not set in SPL making U-Boot to
-		hang while waiting for TEMT. Define this option to avoid it.
-
 
 - Console Interface:
 		Depending on board, define exactly one serial port
drivers/serial/ns16550.c +14 -2
index 87a0917..2922a2c 100644
@@ -36,10 +36,22 @@
 
 void NS16550_init(NS16550_t com_port, int baud_divisor)
 {
-#if (!defined(CONFIG_SYS_NS16550_BROKEN_TEMT))
+#if (defined(CONFIG_SPL_BUILD) && defined(CONFIG_OMAP34XX))
+	/* On some OMAP3 devices when UART3 is configured for boot mode before
+	   SPL starts only THRE bit is set. We have to empty the transmitter
+	   before initialization starts. */
+	if ((serial_in(&com_port->lsr) & (UART_LSR_TEMT | UART_LSR_THRE))
+	     == UART_LSR_THRE) {
+		serial_out(UART_LCR_DLAB, &com_port->lcr);
+		serial_out(baud_divisor & 0xff, &com_port->dll);
+		serial_out((baud_divisor >> 8) & 0xff, &com_port->dlm);
+		serial_out(UART_LCRVAL, &com_port->lcr);
+		serial_out(0, &com_port->mdr1);
+	}
+#endif
+
 	while (!(serial_in(&com_port->lsr) & UART_LSR_TEMT))
 		;
-#endif
 
 	serial_out(CONFIG_SYS_NS16550_IER, &com_port->ier);
 #if (defined(CONFIG_OMAP) && !defined(CONFIG_OMAP3_ZOOM2)) || \
include/configs/igep00x0.h +0 -3
index f8131b1..0617a58 100644
@@ -67,9 +67,6 @@
 #define CONFIG_SYS_NS16550_REG_SIZE	(-4)
 #define CONFIG_SYS_NS16550_CLK		V_NS16550_CLK
 
-/* define to avoid U-Boot to hang while waiting for TEMT */
-#define CONFIG_SYS_NS16550_BROKEN_TEMT
-
 /* select serial console configuration */
 #define CONFIG_CONS_INDEX		3
 #define CONFIG_SYS_NS16550_COM3		OMAP34XX_UART3
Quoted 4 lines

_______________________________________________
U-Boot mailing list
U-Boot at lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot

Amicalement,

Signature · 1 line
Albert.
#30 lore raw

PATCH v3 1/1 omap3_beagle: Enabling UART3 first allows the Transmitter to be empty

Quoted 5 lines · Albert ARIBAUD

Hi Manfred,

On Fri, 29 Mar 2013 10:20:25 +0100, Manfred Huber <[email protected]> wrote:

Quoted 8 lines
Quoted 6 lines

On some OMAP3 devices when UART3 is configured for boot mode before SPL starts only THRE bit is set. We have to empty the transmitter before initialization starts. This patch avoids the use of CONFIG_SYS_NS16550_BROKEN_TEMT.

---

Patch history is missing here.

That's largely because each iteration has been fairly different (we started with adding CONFIG_SYS_NS16550_BROKEN_TEMPT to omap3_beagle).

Quoted 6 lines

Also, I would like the commit summary (first commit message line, also subject of the patch mail) to clearly state what the patch *does* as opposed to what *happens*, because it is unclear right now if you're describing the solution or the issue. Something like :

"omap3_beagle: flush UART3 xmit on enable if TEMT is broken"

Agreed.

Quoted 32 lines
Quoted 32 lines

README | 8 --------

 drivers/serial/ns16550.c   |   16 ++++++++++++++--
 include/configs/igep00x0.h |    3 ---
 3 files changed, 14 insertions(+), 13 deletions(-)
README +0 -8
index a336476..e6b3a50 100644
@@ -616,14 +616,6 @@ The following options need to be configured:
 		boot loader that has already initialized the UART.  Define this
 		variable to flush the UART at init time.
 
-		CONFIG_SYS_NS16550_BROKEN_TEMT
-
-		16550 UART set the Transmitter Empty (TEMT) Bit when all output
-		has finished and the transmitter is totally empty. U-Boot waits
-		for this bit to be set to initialize the serial console. On some
-		broken platforms this bit is not set in SPL making U-Boot to
-		hang while waiting for TEMT. Define this option to avoid it.
-
 
 - Console Interface:
 		Depending on board, define exactly one serial port
drivers/serial/ns16550.c +0 -0
index 87a0917..2922a2c 100644
@@ -36,10 +36,22 @@
 
Quoted 7 lines

drivers/serial/ns16550.c line 42

Quoted 7 lines
drivers/serial/ns16550.c +4 -1
 void NS16550_init(NS16550_t com_port, int baud_divisor)
 {
-#if (!defined(CONFIG_SYS_NS16550_BROKEN_TEMT))
+#if (defined(CONFIG_SPL_BUILD) && defined(CONFIG_OMAP34XX))
+	/* On some OMAP3 devices when UART3 is configured for boot mode before
+	   SPL starts only THRE bit is set. We have to empty the transmitter
+	   before initialization starts. */

/*
* Multiline comments
* must be like this.
*/

Signature · 8 lines
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 836 bytes
Desc: Digital signature
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20130329/31892ec9/attachment.pgp>
#31 lore raw

PATCH v4 1/1 omap3_beagle: Flush UART3 xmit on enable if TEMT is broken

In reply to Javier Martinez Canillas

From: Manfred Huber <[email protected]>

Flush UART3 xmit on enable if TEMT is broken

On some OMAP3 devices when UART3 is configured for boot mode before SPL starts only THRE bit is set. We have to empty the transmitter before initialization starts. This patch avoids the use of CONFIG_SYS_NS16550_BROKEN_TEMT.

---
Changes since v3:
- Changed commit summary and added version history.

Changes since v2:
- Removing CONFIG_SYS_NS16550_BROKEN_TEMT in README and igep00x0.h.

Changes since v1:
- Replaced CONFIG_SYS_NS16550_BROKEN_TEMT with initial configuration of UART.

README | 8 --------

 drivers/serial/ns16550.c   |   16 ++++++++++++++--
 include/configs/igep00x0.h |    3 ---
 3 files changed, 14 insertions(+), 13 deletions(-)
README +0 -8
index a336476..e6b3a50 100644
@@ -616,14 +616,6 @@ The following options need to be configured:
 		boot loader that has already initialized the UART.  Define this
 		variable to flush the UART at init time.
 
-		CONFIG_SYS_NS16550_BROKEN_TEMT
-
-		16550 UART set the Transmitter Empty (TEMT) Bit when all output
-		has finished and the transmitter is totally empty. U-Boot waits
-		for this bit to be set to initialize the serial console. On some
-		broken platforms this bit is not set in SPL making U-Boot to
-		hang while waiting for TEMT. Define this option to avoid it.
-
 
 - Console Interface:
 		Depending on board, define exactly one serial port
drivers/serial/ns16550.c +14 -2
index 87a0917..2922a2c 100644
@@ -36,10 +36,22 @@
 
 void NS16550_init(NS16550_t com_port, int baud_divisor)
 {
-#if (!defined(CONFIG_SYS_NS16550_BROKEN_TEMT))
+#if (defined(CONFIG_SPL_BUILD) && defined(CONFIG_OMAP34XX))
+	/* On some OMAP3 devices when UART3 is configured for boot mode before
+	   SPL starts only THRE bit is set. We have to empty the transmitter
+	   before initialization starts. */
+	if ((serial_in(&com_port->lsr) & (UART_LSR_TEMT | UART_LSR_THRE))
+	     == UART_LSR_THRE) {
+		serial_out(UART_LCR_DLAB, &com_port->lcr);
+		serial_out(baud_divisor & 0xff, &com_port->dll);
+		serial_out((baud_divisor >> 8) & 0xff, &com_port->dlm);
+		serial_out(UART_LCRVAL, &com_port->lcr);
+		serial_out(0, &com_port->mdr1);
+	}
+#endif
+
 	while (!(serial_in(&com_port->lsr) & UART_LSR_TEMT))
 		;
-#endif
 
 	serial_out(CONFIG_SYS_NS16550_IER, &com_port->ier);
 #if (defined(CONFIG_OMAP) && !defined(CONFIG_OMAP3_ZOOM2)) || \
include/configs/igep00x0.h +0 -3
index f8131b1..0617a58 100644
@@ -67,9 +67,6 @@
 #define CONFIG_SYS_NS16550_REG_SIZE	(-4)
 #define CONFIG_SYS_NS16550_CLK		V_NS16550_CLK
 
-/* define to avoid U-Boot to hang while waiting for TEMT */
-#define CONFIG_SYS_NS16550_BROKEN_TEMT
-
 /* select serial console configuration */
 #define CONFIG_CONS_INDEX		3
 #define CONFIG_SYS_NS16550_COM3		OMAP34XX_UART3
#32 lore raw

PATCH v5 1/1 omap3_beagle: Flush UART3 xmit on enable if TEMT is broken

In reply to Javier Martinez Canillas

From: Manfred Huber <[email protected]>

Flush UART3 xmit on enable if TEMT is broken

On some OMAP3 devices when UART3 is configured for boot mode before SPL starts only THRE bit is set. We have to empty the transmitter before initialization starts. This patch avoids the use of CONFIG_SYS_NS16550_BROKEN_TEMT.

---
Changes since v4:
- Changed multiline comment.

Changes since v3:
- Changed commit summary and added version history.

Changes since v2:
- Removing CONFIG_SYS_NS16550_BROKEN_TEMT in README and igep00x0.h.

Changes since v1:
- Replaced CONFIG_SYS_NS16550_BROKEN_TEMT with initial configuration of UART.

 README                     |    8 --------
 drivers/serial/ns16550.c   |   18 ++++++++++++++++--
 include/configs/igep00x0.h |    3 ---
 3 files changed, 16 insertions(+), 13 deletions(-)
README +0 -8
index a336476..e6b3a50 100644
@@ -616,14 +616,6 @@ The following options need to be configured:
 		boot loader that has already initialized the UART.  Define this
 		variable to flush the UART at init time.
 
-		CONFIG_SYS_NS16550_BROKEN_TEMT
-
-		16550 UART set the Transmitter Empty (TEMT) Bit when all output
-		has finished and the transmitter is totally empty. U-Boot waits
-		for this bit to be set to initialize the serial console. On some
-		broken platforms this bit is not set in SPL making U-Boot to
-		hang while waiting for TEMT. Define this option to avoid it.
-
 
 - Console Interface:
 		Depending on board, define exactly one serial port
drivers/serial/ns16550.c +16 -2
index 87a0917..a9352fb 100644
@@ -36,10 +36,24 @@
 
 void NS16550_init(NS16550_t com_port, int baud_divisor)
 {
-#if (!defined(CONFIG_SYS_NS16550_BROKEN_TEMT))
+#if (defined(CONFIG_SPL_BUILD) && defined(CONFIG_OMAP34XX))
+	/*
+	 * On some OMAP3 devices when UART3 is configured for boot mode before
+	 * SPL starts only THRE bit is set. We have to empty the transmitter
+	 * before initialization starts.
+	 */
+	if ((serial_in(&com_port->lsr) & (UART_LSR_TEMT | UART_LSR_THRE))
+	     == UART_LSR_THRE) {
+		serial_out(UART_LCR_DLAB, &com_port->lcr);
+		serial_out(baud_divisor & 0xff, &com_port->dll);
+		serial_out((baud_divisor >> 8) & 0xff, &com_port->dlm);
+		serial_out(UART_LCRVAL, &com_port->lcr);
+		serial_out(0, &com_port->mdr1);
+	}
+#endif
+
 	while (!(serial_in(&com_port->lsr) & UART_LSR_TEMT))
 		;
-#endif
 
 	serial_out(CONFIG_SYS_NS16550_IER, &com_port->ier);
 #if (defined(CONFIG_OMAP) && !defined(CONFIG_OMAP3_ZOOM2)) || \
include/configs/igep00x0.h +0 -3
index f8131b1..0617a58 100644
@@ -67,9 +67,6 @@
 #define CONFIG_SYS_NS16550_REG_SIZE	(-4)
 #define CONFIG_SYS_NS16550_CLK		V_NS16550_CLK
 
-/* define to avoid U-Boot to hang while waiting for TEMT */
-#define CONFIG_SYS_NS16550_BROKEN_TEMT
-
 /* select serial console configuration */
 #define CONFIG_CONS_INDEX		3
 #define CONFIG_SYS_NS16550_COM3		OMAP34XX_UART3
#33 lore raw

PATCH v5 1/1 omap3_beagle: Flush UART3 xmit on enable if TEMT is broken

Quoted 83 lines · Manfred Huber

From: Manfred Huber <[email protected]>

Flush UART3 xmit on enable if TEMT is broken

On some OMAP3 devices when UART3 is configured for boot mode before SPL starts only THRE bit is set. We have to empty the transmitter before initialization starts. This patch avoids the use of CONFIG_SYS_NS16550_BROKEN_TEMT.

---
Changes since v4:
- Changed multiline comment.

Changes since v3:
- Changed commit summary and added version history.

Changes since v2:
- Removing CONFIG_SYS_NS16550_BROKEN_TEMT in README and igep00x0.h.

Changes since v1:
- Replaced CONFIG_SYS_NS16550_BROKEN_TEMT with initial configuration of UART.

 README                     |    8 --------
 drivers/serial/ns16550.c   |   18 ++++++++++++++++--
 include/configs/igep00x0.h |    3 ---
 3 files changed, 16 insertions(+), 13 deletions(-)
README +0 -8
index a336476..e6b3a50 100644
@@ -616,14 +616,6 @@ The following options need to be configured:
                boot loader that has already initialized the UART.  Define this
                variable to flush the UART at init time.
 
-               CONFIG_SYS_NS16550_BROKEN_TEMT
-
-               16550 UART set the Transmitter Empty (TEMT) Bit when all output
-               has finished and the transmitter is totally empty. U-Boot waits
-               for this bit to be set to initialize the serial console. On some
-               broken platforms this bit is not set in SPL making U-Boot to
-               hang while waiting for TEMT. Define this option to avoid it.
-
 
 - Console Interface:
                Depending on board, define exactly one serial port
drivers/serial/ns16550.c +16 -2
index 87a0917..a9352fb 100644
@@ -36,10 +36,24 @@
 
 void NS16550_init(NS16550_t com_port, int baud_divisor)
 {
-#if (!defined(CONFIG_SYS_NS16550_BROKEN_TEMT))
+#if (defined(CONFIG_SPL_BUILD) && defined(CONFIG_OMAP34XX))
+       /*
+        * On some OMAP3 devices when UART3 is configured for boot mode before
+        * SPL starts only THRE bit is set. We have to empty the transmitter
+        * before initialization starts.
+        */
+       if ((serial_in(&com_port->lsr) & (UART_LSR_TEMT | UART_LSR_THRE))
+            == UART_LSR_THRE) {
+               serial_out(UART_LCR_DLAB, &com_port->lcr);
+               serial_out(baud_divisor & 0xff, &com_port->dll);
+               serial_out((baud_divisor >> 8) & 0xff, &com_port->dlm);
+               serial_out(UART_LCRVAL, &com_port->lcr);
+               serial_out(0, &com_port->mdr1);
+       }
+#endif
+
        while (!(serial_in(&com_port->lsr) & UART_LSR_TEMT))
                ;
-#endif
 
        serial_out(CONFIG_SYS_NS16550_IER, &com_port->ier);
 #if (defined(CONFIG_OMAP) && !defined(CONFIG_OMAP3_ZOOM2)) || \
include/configs/igep00x0.h +0 -0
index f8131b1..0617a58 100644

include/configs/igep00x0.h line 72

Quoted 9 lines
include/configs/igep00x0.h +0 -3
@@ -67,9 +67,6 @@
 #define CONFIG_SYS_NS16550_REG_SIZE    (-4)
 #define CONFIG_SYS_NS16550_CLK         V_NS16550_CLK
 
-/* define to avoid U-Boot to hang while waiting for TEMT */
-#define CONFIG_SYS_NS16550_BROKEN_TEMT
-
 /* select serial console configuration */
 #define CONFIG_CONS_INDEX              3
 #define CONFIG_SYS_NS16550_COM3                OMAP34XX_UART3

Hi Manfred,

I tested your patch on my IGEPv2 and is booting correctly, so:

Thanks a lot for working on this!

Best regards,
Javier

#34 lore raw

PATCH v5 1/1 omap3_beagle: Flush UART3 xmit on enable if TEMT is broken

In reply to Manfred Huber

Dear Manfred Huber,

Quoted 9 lines · Manfred Huber

From: Manfred Huber <[email protected]>

Flush UART3 xmit on enable if TEMT is broken

On some OMAP3 devices when UART3 is configured for boot mode before SPL starts only THRE bit is set. We have to empty the transmitter before initialization starts. This patch avoids the use of CONFIG_SYS_NS16550_BROKEN_TEMT.

on tricorder board.

#35 lore raw

PATCH v5 1/1 omap3_beagle: Flush UART3 xmit on enable if TEMT is broken

In reply to Manfred Huber
Quoted 11 lines · man.huber at arcor.de

From: Manfred Huber <[email protected]>

Flush UART3 xmit on enable if TEMT is broken

On some OMAP3 devices when UART3 is configured for boot mode before SPL starts only THRE bit is set. We have to empty the transmitter before initialization starts. This patch avoids the use of CONFIG_SYS_NS16550_BROKEN_TEMT.

Applied to u-boot-ti/master, thanks!

Signature · 8 lines
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 836 bytes
Desc: Digital signature
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20130408/92c35616/attachment.pgp>
#36 lore raw

PATCH 1/1 omap3: Display MHz instead of mHz on the console

In reply to Javier Martinez Canillas

The processor is hopefully running with M(ega)Hz and not with m(illi)Hz.

---
 arch/arm/cpu/armv7/omap3/sys_info.c |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
arch/arm/cpu/armv7/omap3/sys_info.c +2 -2
index 3c80113..08a63d2 100644
@@ -299,9 +299,9 @@ int print_cpuinfo (void)
 		}
 		if ((get_cpu_rev() >= CPU_3XX_ES31) &&
 		    (get_sku_id() == SKUID_CLK_720MHZ))
-			max_clk = "720 mHz";
+			max_clk = "720 MHz";
 		else
-			max_clk = "600 mHz";
+			max_clk = "600 MHz";
 
 		break;
 	case CPU_AM35XX: