summaryrefslogtreecommitdiffstats
path: root/arch
diff options
context:
space:
mode:
authorAhmad Fatoum <a.fatoum@pengutronix.de>2024-02-20 10:30:54 +0100
committerSascha Hauer <s.hauer@pengutronix.de>2024-02-23 08:30:31 +0100
commit824801f1309e4b134e4a249bef7376cba93ddee3 (patch)
tree758afa667e117c9322e9499dd344b21266c3a759 /arch
parentead3bd2c6db6549f4ab5c16286260d9c50647932 (diff)
downloadbarebox-824801f1309e4b134e4a249bef7376cba93ddee3.tar.gz
barebox-824801f1309e4b134e4a249bef7376cba93ddee3.tar.xz
ARM: at91: sam9263_ll: refactor MCK switch to PLLA for clarity
Duplicating the bits being written to configure the MCK harms readability, so factor that out into a new variable to make clear the bits that change between the two calls to at91_pmc_cfg_mck(). Reviewed-by: Sam Ravnborg <sam@ravnborg.org> Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de> Link: https://lore.barebox.org/20240220093100.1539120-9-a.fatoum@pengutronix.de Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Diffstat (limited to 'arch')
-rw-r--r--arch/arm/mach-at91/sam9263_ll.c14
1 files changed, 4 insertions, 10 deletions
diff --git a/arch/arm/mach-at91/sam9263_ll.c b/arch/arm/mach-at91/sam9263_ll.c
index ed56ad21cd..dd4ea7c938 100644
--- a/arch/arm/mach-at91/sam9263_ll.c
+++ b/arch/arm/mach-at91/sam9263_ll.c
@@ -10,6 +10,7 @@
static void sam9263_pmc_init(const struct sam92_pmc_config *config)
{
unsigned flags = AT91_PMC_LL_AT91SAM9263;
+ u32 mckr_settings;
at91_pmc_init(IOMEM(AT91SAM926X_BASE_PMC), flags);
@@ -21,22 +22,15 @@ static void sam9263_pmc_init(const struct sam92_pmc_config *config)
flags);
/* Selection of Master Clock and Processor Clock */
+ mckr_settings = AT91_PMC_PRES_1 | AT91SAM9_PMC_MDIV_2 | AT91_PMC_PDIV_1;
/* PCK = PLLA = 2 * MCK */
at91_pmc_cfg_mck(IOMEM(AT91SAM926X_BASE_PMC),
- AT91_PMC_CSS_SLOW
- | AT91_PMC_PRES_1
- | AT91SAM9_PMC_MDIV_2
- | AT91_PMC_PDIV_1,
- flags);
+ AT91_PMC_CSS_SLOW | mckr_settings, flags);
/* Switch MCK on PLLA output */
at91_pmc_cfg_mck(IOMEM(AT91SAM926X_BASE_PMC),
- AT91_PMC_CSS_PLLA
- | AT91_PMC_PRES_1
- | AT91SAM9_PMC_MDIV_2
- | AT91_PMC_PDIV_1,
- flags);
+ AT91_PMC_CSS_PLLA | mckr_settings, flags);
}
static inline void matrix_wr(unsigned int offset, const unsigned int value)