I'm currently trying to port Linux 2.6 to a MIPS platform which is very
similar to the Jaguar ATX platform, so I started from this code. I have
a few questions concerning this code.
1) Wired TLB entries and ioremap()
In the file arch/mips/momentum/jaguar_atx/setup.c, the
momenco_jaguar_atx_setup() function calls the wire_stupidity_into_tlb()
function to hard-wire entries into the TLB. These entries allows to
access the Marvell registers space (at 0xf4000000). So, this is done in
the early stages of the initialization.
Then, later, the per_cpu_mappings() function is called, through the
arch_initcall mecanism. This function calls ioremap() to map in virtual
memory the Marvell registers space.
At the beginning, I did not understand why both (hard-wired TLB entry
+ mapping in virtual space through ioremap()) were needed, but after
reflexion and discussion with collegues, we found out a possible
explanation. I just wanted to know if it was true or not.
At the very first stages of the initialization (during the
momenco_jaguar_atx_setup() function for example), paging is not
initialized, so we cannot use ioremap(). But we still want to be able to
talk with the Marvell, so the only solution is to wire an entry in the
Then, later on, once everything has been set up (including paging), we
do not need anymore this wired entry, which is deleted in the
per_cpu_mappings() function through the call of the
local_flush_tlb_all() function. The Marvell registers space is then
ioremap'ed in the address, and so is still accessible (because paging is
Is it the right explanation ?
I'm not sure whether my board_time_init() function should set
mips_hpt_frequency or not. In arch/mips/kernel/time.c, it is said that :
* b) (optional) calibrate and set the mips_hpt_frequency
* (only needed if you intended to use fixed_rate_gettimeoffset
* or use cpu counter as timer interrupt source)
So it doesn't seem to be mandatory, but actually I do not understand
clearly the two cases for which setting mips_hpt_frequency is mandatory.
I don't think I want to use fixed_rate_gettimeoffset, but I'm not sure
with the second usage.
When I read the code of arch/mips/kernel/time.c, function time_init()
around line 701, I can see that if no value has been set to
mips_hpt_frequency, then it is computed by the calibrate_hpt(). So, when
is it needed to set it ?
FYI, the platform I'm working on doesn't have any external timer source.
What's the exact use of the mips_hpt_frequency ? Should I set it or not
PETAZZONI Thomas - firstname.lastname@example.org
http://thomas.enix.org - Jabber: email@example.com
KOS: http://kos.enix.org/ - Lolut: http://lolut.utbm.info
Fingerprint : 0BE1 4CF3 CEA4 AC9D CC6E 1624 F653 CB30 98D3 F7A7