mchp_pit64b_init_mode(9)
π mchp_pit64b_init_mode π
okay so this page lives in the Kernel API Manual, section 9, and it's all about the function mchp_pit64b_init_mode β yes the name is a mouthful, we're gonna get through it together bestie π«Ά
β¨ NAME β¨
mchp_pit64b_init_mode β literally prepares the PIT64B mode register value that gets used at runtime, and that includes the prescaler and the SGCLK bit. no cap, that's the whole job π
β¨ SYNOPSIS β¨
int mchp_pit64b_init_mode (struct mchp_pit64b_timer *timer , unsigned
long max_rate );
πΈ ARGUMENTS πΈ
timerβ pointer to the pit64b timer you want to init, bestie. give it the goods.max_rateβ the maximum rate that the timer's clock could use π
π¦ DESCRIPTION π¦
okay so story time: the PIT64B timer can be fed by gclk or pclk, right? when gclk is the one being used, its rate has to be at least 3 times lower than pclk's rate. highkey an important rule, remember it π pclk's rate is fixed, but gclk's rate could be changed via clock APIs. and whichever clock is chosen (pclk or gclk) could be divided by the internal PIT64B's divider. iconic behavior honestly.
so what this function does first is try to use GCLK by requesting the desired rate from PMC, and then it uses the internal PIT64B prescaler β if any β to reach the requested rate β¨ and if PCLK/GCLK < 3 (that's the condition requested by the PIT64B hardware, not me making it up), then the function falls back on using PCLK as the clock source for the PIT64B timer, choosing the highest prescaler in case it doesn't locate one to match the requested frequency. it's giving "plan B but make it maxed out" ππ₯
and below is the PIT64B block in relation with PMC, as promised:
PIT64B PMC +------------------------------------+
ββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β -->gclk --> --> +---------+ +-----+ β
β MUX ---> β
β -->pclk --> --> +---------+ +-----+ β
β ^ β
β sel β
ββββββββββββββββββββββββββββββββββββββββββββββββββββββ
Where:
- gclk rate <= pclk rate/3
- gclk rate could be requested from PMC
- pclk rate is fixed (cannot be requested from PMC)
bestie the<=and the/3are doing so much heavy lifting here, do not mix them up π
β SEE ALSO β
- Kernel file
./drivers/clocksource/timer-microchip-pit64b.c struct mchp_pit64b_timer(9)struct mchp_pit64b_clkevt(9)struct mchp_pit64b_clksrc(9)
and that's the whole page, periodt π it comes to you from ./drivers/clocksource, dated October 2026 β ty bestie for reading, go init some timers, slay πππ
π¦ where this page comes from
- nixpkgs unstable: linux-manual 7.3.1
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms