* [U-Boot] [PATCH 1/2] sunxi: Add conditional magic sram poke for A33
@ 2016-03-24 22:12 Hans de Goede
2016-03-24 22:12 ` [U-Boot] [PATCH 2/2] sunxi: Print soc-id from sram controller for sun8i boards Hans de Goede
[not found] ` <20160325001038.GA21408@excalibur.cnev.de>
0 siblings, 2 replies; 3+ messages in thread
From: Hans de Goede @ 2016-03-24 22:12 UTC (permalink / raw)
To: u-boot
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
+ * 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 || \
--
2.7.3
^ permalink raw reply related [flat|nested] 3+ messages in thread
* [U-Boot] [PATCH 2/2] sunxi: Print soc-id from sram controller for sun8i boards
2016-03-24 22:12 [U-Boot] [PATCH 1/2] sunxi: Add conditional magic sram poke for A33 Hans de Goede
@ 2016-03-24 22:12 ` Hans de Goede
[not found] ` <20160325001038.GA21408@excalibur.cnev.de>
1 sibling, 0 replies; 3+ messages in thread
From: Hans de Goede @ 2016-03-24 22:12 UTC (permalink / raw)
To: u-boot
As the need for various magic sram pokes has shown this maybe useful
info to have. e.g. this shows one of my a23 tablets having an id of
1661 rather then the usual 1650 for the a23.
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
---
arch/arm/cpu/armv7/sunxi/cpu_info.c | 24 +++++++++++++++++++-----
1 file changed, 19 insertions(+), 5 deletions(-)
diff --git a/arch/arm/cpu/armv7/sunxi/cpu_info.c b/arch/arm/cpu/armv7/sunxi/cpu_info.c
index b9bc70c..c0eabdf 100644
--- a/arch/arm/cpu/armv7/sunxi/cpu_info.c
+++ b/arch/arm/cpu/armv7/sunxi/cpu_info.c
@@ -38,6 +38,20 @@ int sunxi_get_ss_bonding_id(void)
}
#endif
+#ifdef CONFIG_MACH_SUN8I
+uint sunxi_get_sram_id(void)
+{
+ uint id;
+
+ /* Unlock sram info reg, read it, relock */
+ setbits_le32(SUNXI_SRAMC_BASE + 0x24, (1 << 15));
+ id = readl(SUNXI_SRAMC_BASE + 0x24) >> 16;
+ clrbits_le32(SUNXI_SRAMC_BASE + 0x24, (1 << 15));
+
+ return id;
+}
+#endif
+
#ifdef CONFIG_DISPLAY_CPUINFO
int print_cpuinfo(void)
{
@@ -66,15 +80,15 @@ int print_cpuinfo(void)
#elif defined CONFIG_MACH_SUN7I
puts("CPU: Allwinner A20 (SUN7I)\n");
#elif defined CONFIG_MACH_SUN8I_A23
- puts("CPU: Allwinner A23 (SUN8I)\n");
+ printf("CPU: Allwinner A23 (SUN8I %04x)\n", sunxi_get_sram_id());
#elif defined CONFIG_MACH_SUN8I_A33
- puts("CPU: Allwinner A33 (SUN8I)\n");
+ printf("CPU: Allwinner A33 (SUN8I %04x)\n", sunxi_get_sram_id());
+#elif defined CONFIG_MACH_SUN8I_A83T
+ printf("CPU: Allwinner A83T (SUN8I %04x)\n", sunxi_get_sram_id());
#elif defined CONFIG_MACH_SUN8I_H3
- puts("CPU: Allwinner H3 (SUN8I)\n");
+ printf("CPU: Allwinner H3 (SUN8I %04x)\n", sunxi_get_sram_id());
#elif defined CONFIG_MACH_SUN9I
puts("CPU: Allwinner A80 (SUN9I)\n");
-#elif defined CONFIG_MACH_SUN8I_A83T
- puts("CPU: Allwinner A83T (SUN8I)\n");
#else
#warning Please update cpu_info.c with correct CPU information
puts("CPU: SUNXI Family\n");
--
2.7.3
^ permalink raw reply related [flat|nested] 3+ messages in thread
* [U-Boot] [PATCH 1/2] sunxi: Add conditional magic sram poke for A33
[not found] ` <20160325001038.GA21408@excalibur.cnev.de>
@ 2016-03-25 6:49 ` Ian Campbell
0 siblings, 0 replies; 3+ messages in thread
From: Ian Campbell @ 2016-03-25 6:49 UTC (permalink / raw)
To: u-boot
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.
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2016-03-25 6:49 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-03-24 22:12 [U-Boot] [PATCH 1/2] sunxi: Add conditional magic sram poke for A33 Hans de Goede
2016-03-24 22:12 ` [U-Boot] [PATCH 2/2] sunxi: Print soc-id from sram controller for sun8i boards Hans de Goede
[not found] ` <20160325001038.GA21408@excalibur.cnev.de>
2016-03-25 6:49 ` [U-Boot] [PATCH 1/2] sunxi: Add conditional magic sram poke for A33 Ian Campbell
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox