[U-Boot-Users] Bootp on PXA255 and resume from sleep

Matej Kupljen matej.kupljen at ultra.si
Tue May 11 09:57:03 CEST 2004

Hi all,

I am using U-Boot 1.0.2 on our custom platform which is based on the
PXA255 and we use SMSC LAN91c96 ethernet chip. When I use "bootp" 
all I get are timeouts. I checked the code and I found the problem
is in the udelay() located in the cpu/pxa/interrupts.c

bootp calls NetLoop (in net.c), which calls BootpRequest (bootp.c)
which then calls NetSetTimeOut. This function retrives the current
value of the counter OSCR and stores it in the timeStart variable.

Then the NetLoop enters the Main packet reception loop. During the
packet sending in smc_send_packet the udelay() is used.
This function, when called, resets the value of timer (OSCR = 0).
At the end of the Main packet reception loop, the timout is tested,
using the current value of the timer and the value stored, when
the NetSetTimeout was called. The problem is, that the current value
of the timer is smaller (due to udelay, which resets the OSCR) then
the stored value (timeStart) and we always get a timeout.
I modified the udelay_masked in the cpu/pxa/interrupts.c to this:

void udelay_masked (unsigned long usec)
	ulong tmo;

	tmo = usec / 1000;
	tmo *= CFG_HZ;
	tmo /= 1000;

	ulong tms;
	tms = get_timer_masked();
	while((get_timer_masked() - tms) < tmo)
		/* NOP */;

	reset_timer_masked ();

	while (tmo >= get_timer_masked ())

When I use this code, the bootp works as excpected.
Has anyone else had problems like this?

The second question is about implementing resume from sleep.
Has anybody implemented it?
Where is the best place to check if this is reset due to Hardware
reset or due to WakeUp event? In memsetup.S?

Thanks and best regards,

More information about the U-Boot mailing list