[U-Boot-Users] Few U-boot architecture/implementation questions

Robin Getz rgetz at blackfin.uclinux.org
Wed Sep 8 01:29:05 CEST 2004


All:

I am involved in a U-Boot port to a new processor, and had a few 
implementation questions.

Question #1
------------------------------
For serial I/O, the cpu specific function found in /cpu/<processor>serial.c 
named serial_getc(void); can either be implemented where
  - serial_getc sits a bangs on UART_rx_buff as fast as it can, until 
something shows up. (idle loop of wait for keystroke).
OR
  - an independent uart_rx_int populates a ring buffer, serial_getc grabs 
the character from the ring buffer, if there isn't a char in the ring 
buffer, go to sleep for 1ms (at 115,200 Buad, 8N1; 1 char = ~87us; as long 
as the ring buffer can cope with 12 chars you should be OK).

It seems as if most of the implementations that I looked at do the first - 
which is easier, but it is also why monitors, boot loaders,  etc are 
usually worse case power consumers. (IMHO - idle loops should be idle - not 
wait for keystroke - but it is harder, and adds complexity - you still can 
get UART interrupts when you have networking activity, and you need to make 
sure that you can handle both - so I can understand why it is implemented 
as is).

Question #2
---------------------------
For Networking functions - I have a SMSC LAN911C11 on the first target 
board, and every time I access the networking functions, it seems to 
re-initalize the SMSC 9191C111.

Is this normal? Or do I have a bug (I would assume - bug, but didn't see 
anything yet).

Question #3
----------------------
In /include/configs/<board>.h what should CFG_HZ be set to? Lost of 
different boards seem to be set to 1000 , (but I don't think that they are 
all running at the same frequency) but then some are not - I could not find 
it int the docs (but maybe didn't look hard enough)

Question #4
--------------------
In /cpu/<cpu_type>interrupts.c in the function udelay(unsigned long usec) - 
how exact should this be? (exactly 1.00000us or +/- 5% is OK?)

Question #5
----------------------
In /lib_<cup_type>/timer.c (for those processors that have it) - I have a 
processor that supports ticks in terms of instructions clocks (up to 
750MHz) or peripheral clock ticks (up to 133MHz). I assume that peripheral 
clocks ticks are OK. (and that loosing the accuracy is not a big deal).

Question #6
-------------------
Which is actually more of a feature enhancement that a question - if I 
implement a autobaud routine in /cpu/<cpu_type>/serial.c in the function 
serial_tstc - that would be the correct place for it? (If no key presses, 
return 0, if there is a key press - figure out the speed, set the UART up 
properly if it is not, and then return a 1 ?)

Thanks - feedback or RTFM with pointers are welcome.

-Robin





More information about the U-Boot mailing list