Add a Kconfig option which users can select when they want to boot older
kernels, e.g. the linux-sunxi 3.4 kernels. For now this just forces the pll5
"p" value to 1 (divide by 2) as that is what those kernels are hardcoded too,
in the future this may enable further workarounds.

Signed-off-by: Hans de Goede <[email protected]>
---
 arch/arm/cpu/armv7/sunxi/dram.c | 4 ++++
 board/sunxi/Kconfig             | 7 +++++++
 2 files changed, 11 insertions(+)

diff --git a/arch/arm/cpu/armv7/sunxi/dram.c b/arch/arm/cpu/armv7/sunxi/dram.c
index 0cbcf57..c0dc456 100644
--- a/arch/arm/cpu/armv7/sunxi/dram.c
+++ b/arch/arm/cpu/armv7/sunxi/dram.c
@@ -293,6 +293,10 @@ static void mctl_setup_dram_clock(u32 clk, u32 mbus_clk)
                reg_val |= CCM_PLL5_CTRL_K(CCM_PLL5_CTRL_K_X(2));
                reg_val |= CCM_PLL5_CTRL_N(CCM_PLL5_CTRL_N_X(clk / 24));
        }
+#ifdef CONFIG_OLD_KERNEL_COMPAT
+       /* Old kernels are hardcoded to P=1 (divide by 2) */
+       reg_val |= CCM_PLL5_CTRL_P(1);
+#endif
        reg_val &= ~CCM_PLL5_CTRL_VCO_GAIN;             /* PLL VCO Gain off */
        reg_val |= CCM_PLL5_CTRL_EN;                    /* PLL On */
        writel(reg_val, &ccm->pll5_cfg);
diff --git a/board/sunxi/Kconfig b/board/sunxi/Kconfig
index 66261fc..0331088 100644
--- a/board/sunxi/Kconfig
+++ b/board/sunxi/Kconfig
@@ -19,6 +19,13 @@ config SYS_SOC
 config FDTFILE
        string "Default fdtfile env setting for this board"
 
+config OLD_KERNEL_COMPAT
+       boolean "Enable workarounds for booting old kernels"
+       default n
+       ---help---
+       Set this to enable various workarounds for old kernels, this results in
+       sub-optimal settings for newer kernels, only enable if needed.
+
 config MMC0_CD_PIN
        string "Card detect pin for mmc0"
        default ""
-- 
2.1.0

-- 
You received this message because you are subscribed to the Google Groups 
"linux-sunxi" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to