Fix incorrect core_freq for Raspberry Pi 4, Raspberry Pi 400 and CM4

Compare https://github.com/raspberrypi/documentation/blob/develop/documentation/asciidoc/computers/config_txt/overclocking.adoc. Unfortunately i found no easy way to read 'core_freq'. This would be great, since the value is "wrong" for most of the RPi revisions.
This commit is contained in:
Thomas Maier 2021-11-27 13:54:30 +01:00
parent 2ab4c0432c
commit be3df1c40e

7
spi.go
View File

@ -61,8 +61,11 @@ func SpiEnd(dev SpiDev) {
// Param speed may be as big as 125MHz in theory, but
// only values up to 31.25MHz are considered relayable.
func SpiSpeed(speed int) {
const baseFreq = 250 * 1000000
cdiv := uint32(baseFreq / speed)
coreFreq := 250 * 1000000
if isBCM2711() {
coreFreq = 550 * 1000000
}
cdiv := uint32(coreFreq / speed)
setSpiDiv(cdiv)
}