cns3xxx: fix uImage build issue
[openwrt.git] / package / boot / uboot-sunxi / patches / 002-sun5i-give-pll6-a-sane-value.patch
1 From 75ec90fda763b491e5169dcb6dce8abe3856d946 Mon Sep 17 00:00:00 2001
2 From: Hans de Goede <hdegoede@redhat.com>
3 Date: Sat, 14 Dec 2013 20:58:57 +0100
4 Subject: [PATCH] sun5i: Give PLL6 a sane initial value
5
6 The upstream kernel does not override PLL values as set by power-on-reset
7 and/or the bootloader if it can avoid doing so.
8
9 The power-on-reset value for PLL6 is 2400MHz, which does not actually work,
10 the kernel does not know this and 2400 / 48 is 50 MHz, so the kernel happily
11 tries to use it as is for mmc.
12
13 Set PLL6 to a working frequency so that the kernel can use it. This fixes
14 mmc in the upstream kernel not working on sun5i.
15
16 Signed-off-by: Hans de Goede <hdegoede@redhat.com>
17 ---
18  arch/arm/cpu/armv7/sunxi/clock.c | 5 +++++
19  1 file changed, 5 insertions(+)
20
21 diff --git a/arch/arm/cpu/armv7/sunxi/clock.c b/arch/arm/cpu/armv7/sunxi/clock.c
22 index 57b136d..b9dd608 100644
23 --- a/arch/arm/cpu/armv7/sunxi/clock.c
24 +++ b/arch/arm/cpu/armv7/sunxi/clock.c
25 @@ -43,6 +43,11 @@ static void clock_init_safe(void)
26         sdelay(200);
27         writel(AXI_DIV_1 << 0 | AHB_DIV_2 << 4 | APB0_DIV_1 << 8 |
28                CPU_CLK_SRC_PLL1 << 16, &ccm->cpu_ahb_apb0_cfg);
29 +#ifdef CONFIG_SUN5I
30 +       /* Power on reset default for PLL6 is 2400 MHz, which is faster then
31 +        * it can reliable do :|  Set it to a 600 MHz instead. */
32 +       writel(0x21009900, &ccm->pll6_cfg);
33 +#endif
34  #ifdef CONFIG_SUN7I
35         writel(0x1 << 6 | readl(&ccm->ahb_gate0), &ccm->ahb_gate0);
36         writel(0x1 << 31 | readl(&ccm->pll6_cfg), &ccm->pll6_cfg);
37 -- 
38 1.8.5.1
39