All of lore.kernel.org
 help / color / mirror / Atom feed
* [U-Boot] mips board with no output from console
@ 2009-09-28 23:59 myuboot at fastmail.fm
  2009-09-29  0:55 ` Jerry Van Baren
  0 siblings, 1 reply; 3+ messages in thread
From: myuboot at fastmail.fm @ 2009-09-28 23:59 UTC (permalink / raw)
  To: u-boot

I am trying to upgrade my u-boot from 2008.10 to 2009.06. So I used the
buildroot 2009.06 to build the tool chain for my mips32 board as well as
u-boot. I also copied the previous u-boot initialization code to
initialze timer, serial port, ram and etc from u-boot 2008.10 to
2009.06. My previous version of u-boot-2008.10 was working, but after
porting it over to u-boot 2009.06, there is no output from console at
all. I used bdi hardware debugger to debug it, and found that u-boot is
stuck in file drivers/serial/ns16550.c function NS16550_putc. There is a
while loop there :
while ((com_port>lsr & LSR_THRE) == 0);

My understanding is the line here is to wait for the hardware register
(LSR_THRE) to acknowledge the input character was received by the
hardware.

But I don't have any clue how to fix this issue. I think I have
initialized the serial port the same way as I did for u-boot 2008.10.
Can some one give me some suggestions on what to check for?

Thanks.  

^ permalink raw reply	[flat|nested] 3+ messages in thread

* [U-Boot] mips board with no output from console
  2009-09-28 23:59 [U-Boot] mips board with no output from console myuboot at fastmail.fm
@ 2009-09-29  0:55 ` Jerry Van Baren
       [not found]   ` <1254264169.23326.1337258915@webmail.messagingengine.com>
  0 siblings, 1 reply; 3+ messages in thread
From: Jerry Van Baren @ 2009-09-29  0:55 UTC (permalink / raw)
  To: u-boot

myuboot at fastmail.fm wrote:
> I am trying to upgrade my u-boot from 2008.10 to 2009.06. So I used the
> buildroot 2009.06 to build the tool chain for my mips32 board as well as
> u-boot. I also copied the previous u-boot initialization code to
> initialze timer, serial port, ram and etc from u-boot 2008.10 to
> 2009.06. My previous version of u-boot-2008.10 was working, but after
> porting it over to u-boot 2009.06, there is no output from console at
> all. I used bdi hardware debugger to debug it, and found that u-boot is
> stuck in file drivers/serial/ns16550.c function NS16550_putc. There is a
> while loop there :
> while ((com_port>lsr & LSR_THRE) == 0);
> 
> My understanding is the line here is to wait for the hardware register
> (LSR_THRE) to acknowledge the input character was received by the
> hardware.
> 
> But I don't have any clue how to fix this issue. I think I have
> initialized the serial port the same way as I did for u-boot 2008.10.
> Can some one give me some suggestions on what to check for?
> 
> Thanks.  

Hi "myuboot",

If you look in ./include/ns16550.h you will see:
#define UART_LSR_THRE   0x20            /* Xmit holding register empty */

The code you quote is waiting for room in the transmit buffer to put the 
character in.  It is stuck in the loop because it is reading 0 == not 
empty, i.e. full.

This means the UART is not transmitting for some reason - that is why it 
is backed up.  My first suspicion would be that your UART is not being 
clocked.  I know nothing of your board or processor, but I would check 
clock configurations.  I would put a scope on the UART clock pin, 
assuming you can probe it, and *verify* that the clock is running at the 
expected rate.

If your clocking is OK, the next likely thing is that you have hardware 
handshaking and the RTS/CTS (DSR/DTR) lines are holding off the Tx. 
This could be due to actual handshaking hardware, or due to port (or 
SOC) configuration that makes the UART think that there are handshake 
lines that aren't connected or that are configured to be inactive.

I would put 98% odds on your clocking not clocking, however.

Good luck,
gvb

^ permalink raw reply	[flat|nested] 3+ messages in thread

* [U-Boot] mips board with no output from console
       [not found]   ` <1254264169.23326.1337258915@webmail.messagingengine.com>
@ 2009-09-29 23:37     ` Jerry Van Baren
  0 siblings, 0 replies; 3+ messages in thread
From: Jerry Van Baren @ 2009-09-29 23:37 UTC (permalink / raw)
  To: u-boot

Hi myuboot,

(You should CC: the list - tap the wisdom of the crowd, plus answers get 
  archived for the next person that gets bit by the problem.)

myuboot at fastmail.fm wrote:
> Jerry,
> 
> I appreciate your input. 
> I somehow fixed the issue without really knowing the cause.

DANGER, Will Robinson!
   <http://en.wikipedia.org/wiki/Danger,_Will_Robinson>

> In the header file for the particular board I am using, I have the
> parameters for serial configuration,such as
> #define CFG_NS16550
> #define CFG_NS16550_SERIAL
> #define CFG_NS16550_REG_SIZE 4
> #define CFG_NS16550_CLK      4
> ...
> when I port it to u-boot2009.06, I double defined the parameters so that
> my existing code does not need to be changed, so I have both
> #define CFG_NS16550
> #define CFG_NS16550_SERIAL
> #define CFG_NS16550_REG_SIZE 4
> #define CFG_NS16550_CLK      4
> ...
> 
> #define CONFIG_SYS_NS16550
> #define CONFIG_SYS_NS16550_SERIAL
> #define CONFIG_SYS_NS16550_REG_SIZE 4
> #define CONFIG_SYS_NS16550_CLK      4
> ...
> 
> When I removed every thing starts with CONFIG_SYS_NS16550, the console
> is working.
> 
> Thanks. 

That is NOT the right fix.  If you grep CFG_NS16550, you will find it is 
no longer used (there was a CFG/CONFIG cleanup a little while back).
   $ find . -name "*.[ch]" | xargs grep CFG_NS16550

If you look at common/serial.c, you will find the default serial console
   struct serial_device *__default_serial_console (void)
is selected by a combination of
   #if defined(CONFIG_CONS_INDEX) && defined(CONFIG_SYS_NS16550_SERIAL)

Further, in
   void serial_initialize (void)
the combination is also used to select which register/UART channel to 
set up via
   int serial_register (struct serial_device *dev)

I suspect you did not have CONFIG_CONS_INDEX, and possible some other 
CONFIG_SYS_NS16550_SERIAL_* defines defined, so your initialization 
didn't happen correctly.  There are plenty of examples to copy from:
   $ find . -name "*.h" | xargs grep -l CONFIG_SYS_NS16550

Best regards,
gvb

[snip]

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2009-09-29 23:37 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-09-28 23:59 [U-Boot] mips board with no output from console myuboot at fastmail.fm
2009-09-29  0:55 ` Jerry Van Baren
     [not found]   ` <1254264169.23326.1337258915@webmail.messagingengine.com>
2009-09-29 23:37     ` Jerry Van Baren

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.