mirror of https://github.com/Desuuuu/klipper.git
lpc176x: Do not modify PCLKSELx at runtime
The lpc176x has an errata that could cause updates to PCLKSELx to not take effect. Rework the code to use the default peripheral clock speed (25Mhz or 30Mhz) so that this register does not need to be updated at runtime. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
This commit is contained in:
parent
6cab7bcfcb
commit
ae89a65956
|
@ -49,20 +49,13 @@ void
|
|||
enable_pclock(uint32_t pclk)
|
||||
{
|
||||
LPC_SC->PCONP |= 1<<pclk;
|
||||
if (pclk < 16) {
|
||||
uint32_t shift = pclk * 2;
|
||||
LPC_SC->PCLKSEL0 = (LPC_SC->PCLKSEL0 & ~(0x3<<shift)) | (0x1<<shift);
|
||||
} else {
|
||||
uint32_t shift = (pclk - 16) * 2;
|
||||
LPC_SC->PCLKSEL1 = (LPC_SC->PCLKSEL1 & ~(0x3<<shift)) | (0x1<<shift);
|
||||
}
|
||||
}
|
||||
|
||||
// Return the frequency of the given peripheral clock
|
||||
uint32_t
|
||||
get_pclock_frequency(uint32_t pclk)
|
||||
{
|
||||
return CONFIG_CLOCK_FREQ;
|
||||
return CONFIG_CLOCK_FREQ / 4;
|
||||
}
|
||||
|
||||
// Main entry point - called from armcm_boot.c:ResetHandler()
|
||||
|
|
Loading…
Reference in New Issue