diff mbox

[U-Boot,1/2] sunxi: Add conditional magic sram poke for A33

Message ID 1458857522-24511-1-git-send-email-hdegoede@redhat.com
State Accepted
Delegated to: Hans de Goede
Headers show

Commit Message

Hans de Goede March 24, 2016, 10:12 p.m. UTC
I noticed that for certain SoC versions boot0 does a magic poke when
build for A33. I'm not aware of this actually being necessary anywhere,
but better safe then sorry.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
---
 arch/arm/cpu/armv7/sunxi/board.c | 20 ++++++++++++++++----
 1 file changed, 16 insertions(+), 4 deletions(-)

Comments

Karsten Merker March 25, 2016, 12:10 a.m. UTC | #1
On Thu, Mar 24, 2016 at 11:12:01PM +0100, Hans de Goede wrote:

> I noticed that for certain SoC versions boot0 does a magic poke when
> build for A33. I'm not aware of this actually being necessary anywhere,
> but better safe then sorry.
> 
> Signed-off-by: Hans de Goede <hdegoede@redhat.com>
> ---
>  arch/arm/cpu/armv7/sunxi/board.c | 20 ++++++++++++++++----
>  1 file changed, 16 insertions(+), 4 deletions(-)
> 
> diff --git a/arch/arm/cpu/armv7/sunxi/board.c b/arch/arm/cpu/armv7/sunxi/board.c
> index 7653148..73c8727 100644
> --- a/arch/arm/cpu/armv7/sunxi/board.c
> +++ b/arch/arm/cpu/armv7/sunxi/board.c
> @@ -120,18 +120,30 @@ void s_init(void)
>  	 */
>  #if defined CONFIG_MACH_SUN6I
>  	setbits_le32(SUNXI_SRAMC_BASE + 0x44, 0x1800);
> -#elif defined CONFIG_MACH_SUN8I_A23
> -	uint version;
> +#elif defined CONFIG_MACH_SUN8I
> +	__maybe_unused uint version;
>  
>  	/* Unlock sram version info reg, read it, relock */
>  	setbits_le32(SUNXI_SRAMC_BASE + 0x24, (1 << 15));
> -	version = readl(SUNXI_SRAMC_BASE + 0x24);
> +	version = readl(SUNXI_SRAMC_BASE + 0x24) >> 16;
>  	clrbits_le32(SUNXI_SRAMC_BASE + 0x24, (1 << 15));
>  
> -	if ((version & 0xffff0000) == 0x16500000)
> +	/*
> +	 * Ideally this would be a switch case, bit we do not know exactly

s/bit/but/

> +	 * which versions there are and which version needs which settings,
> +	 * so reproduce the per SoC code from the BSP.
> +	 */

Regards,
Karsten
Ian Campbell March 25, 2016, 6:49 a.m. UTC | #2
On Fri, 2016-03-25 at 01:10 +0100, Karsten Merker wrote: 
> > -	if ((version & 0xffff0000) == 0x16500000)
> > +	/*
> > +	 * Ideally this would be a switch case, bit we do not know exactly
> 
> s/bit/but/

Other than that, both patches:
    Acked-by: Ian Campbell <    ijc@hellion.org.uk    >

Ian.
diff mbox

Patch

diff --git a/arch/arm/cpu/armv7/sunxi/board.c b/arch/arm/cpu/armv7/sunxi/board.c
index 7653148..73c8727 100644
--- a/arch/arm/cpu/armv7/sunxi/board.c
+++ b/arch/arm/cpu/armv7/sunxi/board.c
@@ -120,18 +120,30 @@  void s_init(void)
 	 */
 #if defined CONFIG_MACH_SUN6I
 	setbits_le32(SUNXI_SRAMC_BASE + 0x44, 0x1800);
-#elif defined CONFIG_MACH_SUN8I_A23
-	uint version;
+#elif defined CONFIG_MACH_SUN8I
+	__maybe_unused uint version;
 
 	/* Unlock sram version info reg, read it, relock */
 	setbits_le32(SUNXI_SRAMC_BASE + 0x24, (1 << 15));
-	version = readl(SUNXI_SRAMC_BASE + 0x24);
+	version = readl(SUNXI_SRAMC_BASE + 0x24) >> 16;
 	clrbits_le32(SUNXI_SRAMC_BASE + 0x24, (1 << 15));
 
-	if ((version & 0xffff0000) == 0x16500000)
+	/*
+	 * Ideally this would be a switch case, bit we do not know exactly
+	 * which versions there are and which version needs which settings,
+	 * so reproduce the per SoC code from the BSP.
+	 */
+#if defined CONFIG_MACH_SUN8I_A23
+	if (version == 0x1650)
 		setbits_le32(SUNXI_SRAMC_BASE + 0x44, 0x1800);
 	else /* 0x1661 ? */
 		setbits_le32(SUNXI_SRAMC_BASE + 0x44, 0xc0);
+#elif defined CONFIG_MACH_SUN8I_A33
+	if (version != 0x1667)
+		setbits_le32(SUNXI_SRAMC_BASE + 0x44, 0xc0);
+#endif
+	/* A83T BSP never modifies SUNXI_SRAMC_BASE + 0x44 */
+	/* No H3 BSP, boot0 seems to not modify SUNXI_SRAMC_BASE + 0x44 */
 #endif
 
 #if defined CONFIG_MACH_SUN6I || \