machine: bump rp2040 to 200MHz (#4768)

* machine: add support for core voltage adjustments to rp2040

In preparation for bumping the core frequency of the rp2040, this
change implements the required core voltage adjustment logic.

* machine: bump rp2040 to 200MHz
This commit is contained in:
Elias Naur
2025-03-04 12:57:59 +01:00
committed by GitHub
parent 8c54e3dd88
commit 7d6d93f7aa
3 changed files with 30 additions and 1 deletions
+12
View File
@@ -42,6 +42,10 @@ type clock struct {
cix clockIndex
}
// The delay in seconds for core voltage adjustments to
// settle. Taken from the Pico SDK.
const _VREG_VOLTAGE_AUTO_ADJUST_DELAY = 1 / 1e3
// clock returns the clock identified by cix.
func (clks *clocksType) clock(cix clockIndex) clock {
return clock{
@@ -188,6 +192,14 @@ func (clks *clocksType) init() {
xoscFreq,
xoscFreq)
if adjustCoreVoltage() {
// Wait for the voltage to settle.
const cycles = _VREG_VOLTAGE_AUTO_ADJUST_DELAY * xoscFreq * MHz
for i := 0; i < cycles; i++ {
arm.Asm("nop")
}
}
// clkSys = pllSys (125MHz) / 1 = 125MHz
csys := clks.clock(clkSys)
csys.configure(rp.CLOCKS_CLK_SYS_CTRL_SRC_CLKSRC_CLK_SYS_AUX,