mdelay() from board_setup() [is default value for loops_per_jiffy way off?]
Hi,
I'm working on a linux port for a custom Au1550 based board. Inside of board_setup() I need to wait for some hardware to power up. So, I called mdelay(), but it seems to wait for far too short a time. It seems that loops_per_jiffy still has the default value (4096) in board_setup(), the computed value is more like 245248. So, what is the proper way to spin wait this early in the startup process? Also, isn't the default value for loops_per_jiffy off by quite a bit? I'm running the Au1550 at 492MHz, so that would make the default value good for a ~8MHz processor?
--Clem
Quoted 11 lines · Clem Taylor
Hi,
I'm working on a linux port for a custom Au1550 based board. Inside of
board_setup()I need to wait for some hardware to power up. So, I calledmdelay(), but it seems to wait for far too short a time. It seems thatloops_per_jiffystill has the default value (4096) inboard_setup(), the computed value is more like 245248. So, what is the proper way to spin wait this early in the startup process? Also, isn't the default value forloops_per_jiffyoff by quite a bit? I'm running the Au1550 at 492MHz, so that would make the default value good for a ~8MHz processor?
It's too early in board_setup() to use the standard delay routines. You can't use those until after calibrate_delay() runs. To do precise delays in board_setup, you'll have to do something yourself where you read the cp0 timer periodically and wait a certain amount of time.
Pete
Quoted 4 lines · Pete Popov
It's too early in
board_setup()to use the standard delay routines. You can't use those until aftercalibrate_delay()runs. To do precise delays inboard_setup, you'll have to do something yourself where you read the cp0 timer periodically and wait a certain amount of time.
And make sure not to be trapped by wrap-arounds of that counter. Also it doesn't count the same speed on all processors ...
Ralf