aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKevin O'Connor <kevin@koconnor.net>2021-03-24 19:49:08 -0400
committerKevin O'Connor <kevin@koconnor.net>2021-03-25 11:35:04 -0400
commitae89a65956f95c2bee652396286d97b47ff804b6 (patch)
tree196d9447cfacccecb7766bcfd922dd205c84dc81
parent6cab7bcfcb12003a538435f351a73978f5fbb954 (diff)
downloadkutter-ae89a65956f95c2bee652396286d97b47ff804b6.tar.gz
kutter-ae89a65956f95c2bee652396286d97b47ff804b6.tar.xz
kutter-ae89a65956f95c2bee652396286d97b47ff804b6.zip
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>
-rw-r--r--src/lpc176x/main.c9
1 files changed, 1 insertions, 8 deletions
diff --git a/src/lpc176x/main.c b/src/lpc176x/main.c
index b35e31ee..d12bcd57 100644
--- a/src/lpc176x/main.c
+++ b/src/lpc176x/main.c
@@ -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()