Skip to contentSkip to conversation

sun6i: Add dram init and SPL support

PATCH Superseded Hans de Goede 1 participant 10 messages Nov 5, 2014

Subsystems (3)

v2 of 3 Superseded Latest is v3 →

lore
Share & tools
lore
#0 lore raw

v2 cover sun6i: Add dram init and SPL support

Hi All,

Here is v2 of my A31 dram init & SPL support series.

Changes since v1:
-"sun6i: Add new p2wi controller driver"
-Rename p2wi_set_pmu_address to p2wi_change_to_p2wi_mode
-"sun6i: Add basic axp221 driver"
-Add support for all dldo and aldo-s
-Add Kconfig option to select building AXP221 and to select voltage of
dldo and aldo-s
-"sun6i: Add cpucfg register definitions"
-Rename existing SUNXI_CPUCFG_BASE to SUN7I_CPUCFG_BASE, name sun6i one
SUN6I_CPUCFG_BASE
-Rename cpucfg.h to cpucfg_sun6i.h
-"sun4i: Rename dram files to dram_sun4i.x"
-Do not include non existing dram_sun6i.h
-"sun6i: Add Mele M9 board"
-Add defconfig settings for various ldo-s

Please review.

Regards,

Hans

#1 lore raw

PATCH v2 1/9 sun6i: Add new p2wi controller driver

From: Oliver Schinagl <[email protected]>

The A31 uses a new push-pull two wire interface, which features higher transfer speeds (upto 6 MHz) in theory. While the hardware can burst 8 bytes each time, this driver will only see very little use and thus is limited to single byte transmission only.

---
 arch/arm/cpu/armv7/sunxi/Makefile      |   1 +
 arch/arm/cpu/armv7/sunxi/p2wi.c        | 117 +++++++++++++++++++++++++++
 arch/arm/include/asm/arch-sunxi/gpio.h |   3 +
 arch/arm/include/asm/arch-sunxi/p2wi.h | 140 +++++++++++++++++++++++++++++++++
 4 files changed, 261 insertions(+)
 create mode 100644 arch/arm/cpu/armv7/sunxi/p2wi.c
 create mode 100644 arch/arm/include/asm/arch-sunxi/p2wi.h
arch/arm/cpu/armv7/sunxi/Makefile +1 -0
index 82dbf76..b3a3601 100644
@@ -13,6 +13,7 @@ obj-y	+= clock.o
 obj-y	+= pinmux.o
 obj-$(CONFIG_MACH_SUN6I)	+= prcm.o
 obj-$(CONFIG_MACH_SUN8I)	+= prcm.o
+obj-$(CONFIG_MACH_SUN6I)	+= p2wi.o
 obj-$(CONFIG_MACH_SUN4I)	+= clock_sun4i.o
 obj-$(CONFIG_MACH_SUN5I)	+= clock_sun4i.o
 obj-$(CONFIG_MACH_SUN6I)	+= clock_sun6i.o
arch/arm/cpu/armv7/sunxi/p2wi.c new file +117 -0

117 lines not on this page · raw message

arch/arm/include/asm/arch-sunxi/gpio.h +3 -0
index 437dd35..c734cf0 100644
@@ -172,6 +172,9 @@ enum sunxi_gpio_number {
 
 #define SUN4I_GPI4_SDC3		2
 
+#define SUNXI_GPL0_R_P2WI_SCK	3
+#define SUNXI_GPL1_R_P2WI_SDA	3
+
 #define SUN8I_GPL2_R_UART_TX	2
 #define SUN8I_GPL3_R_UART_RX	2
 
arch/arm/include/asm/arch-sunxi/p2wi.h new file +140 -0

140 lines not on this page · raw message

Signature · 1 line
2.1.0
#2 lore raw

PATCH v2 2/9 sun6i: Add basic axp221 driver

In reply to Hans de Goede

From: Oliver Schinagl <[email protected]>

The A31 uses the AXP221 pmic for various voltages.

---
 board/sunxi/board.c    |  26 +++++++
 drivers/power/Kconfig  |  47 ++++++++++++
 drivers/power/Makefile |   1 +
 drivers/power/axp221.c | 205 +++++++++++++++++++++++++++++++++++++++++++++++++
 include/axp221.h       |  42 ++++++++++
 5 files changed, 321 insertions(+)
 create mode 100644 drivers/power/axp221.c
 create mode 100644 include/axp221.h
board/sunxi/board.c +26 -0
index 8d5d03e..ddb0acd 100644
@@ -19,6 +19,9 @@
 #ifdef CONFIG_AXP209_POWER
 #include <axp209.h>
 #endif
+#ifdef CONFIG_AXP221_POWER
+#include <axp221.h>
+#endif
 #include <asm/arch/clock.h>
 #include <asm/arch/cpu.h>
 #include <asm/arch/dram.h>
@@ -173,6 +176,29 @@ void sunxi_board_init(void)
 	power_failed |= axp209_set_ldo3(2800);
 	power_failed |= axp209_set_ldo4(2800);
 #endif
+#ifdef CONFIG_AXP221_POWER
+	power_failed = axp221_init();
+	power_failed |= axp221_set_dcdc1(3000);
+	power_failed |= axp221_set_dcdc2(1200);
+	power_failed |= axp221_set_dcdc3(1200);
+	power_failed |= axp221_set_dcdc4(1200);
+	power_failed |= axp221_set_dcdc5(1500);
+#if CONFIG_AXP221_DLDO1_VOLT != -1
+	power_failed |= axp221_set_dldo1(CONFIG_AXP221_DLDO1_VOLT);
+#endif
+#if CONFIG_AXP221_DLDO4_VOLT != -1
+	power_failed |= axp221_set_dldo4(CONFIG_AXP221_DLDO4_VOLT);
+#endif
+#if CONFIG_AXP221_ALDO1_VOLT != -1
+	power_failed |= axp221_set_aldo1(CONFIG_AXP221_ALDO1_VOLT);
+#endif
+#if CONFIG_AXP221_ALDO2_VOLT != -1
+	power_failed |= axp221_set_aldo2(CONFIG_AXP221_ALDO2_VOLT);
+#endif
+#if CONFIG_AXP221_ALDO3_VOLT != -1
+	power_failed |= axp221_set_aldo3(CONFIG_AXP221_ALDO3_VOLT);
+#endif
+#endif
 
 	printf("DRAM:");
 	ramsize = sunxi_dram_init();
drivers/power/Kconfig +47 -0

47 lines not on this page · raw message

drivers/power/Makefile +1 -0
index dc64e4d..04bd996 100644
@@ -7,6 +7,7 @@
 
 obj-$(CONFIG_AXP152_POWER)	+= axp152.o
 obj-$(CONFIG_AXP209_POWER)	+= axp209.o
+obj-$(CONFIG_AXP221_POWER)	+= axp221.o
 obj-$(CONFIG_EXYNOS_TMU)	+= exynos-tmu.o
 obj-$(CONFIG_FTPMU010_POWER)	+= ftpmu010.o
 obj-$(CONFIG_TPS6586X_POWER)	+= tps6586x.o
drivers/power/axp221.c new file +205 -0

205 lines not on this page · raw message

include/axp221.h new file +42 -0

42 lines not on this page · raw message

Signature · 1 line
2.1.0
#3 lore raw

PATCH v2 3/9 sun6i: Add clock functions needed for SPL / DRAM init

In reply to Hans de Goede

Add clock_init_safe and clockset_pll5 functions, as these are needed for SPL support resp. DRAM init (which is needed for SPL too).

Also add some extra clock register constant defines.

---
 arch/arm/cpu/armv7/sunxi/clock_sun6i.c        | 77 +++++++++++++++++++++++++++
 arch/arm/include/asm/arch-sunxi/clock.h       |  1 +
 arch/arm/include/asm/arch-sunxi/clock_sun6i.h | 27 +++++++++-
 arch/arm/include/asm/arch-sunxi/prcm.h        |  1 +
 include/configs/sun6i.h                       |  1 +
 5 files changed, 106 insertions(+), 1 deletion(-)
arch/arm/cpu/armv7/sunxi/clock_sun6i.c +77 -0
index 1eae976..16ab6f3 100644
@@ -16,6 +16,33 @@
 #include <asm/arch/prcm.h>
 #include <asm/arch/sys_proto.h>
 
+#ifdef CONFIG_SPL_BUILD
+void clock_init_safe(void)
+{
+	struct sunxi_ccm_reg * const ccm =
+		(struct sunxi_ccm_reg *)SUNXI_CCM_BASE;
+	struct sunxi_prcm_reg * const prcm =
+		(struct sunxi_prcm_reg *)SUNXI_PRCM_BASE;
+
+	/* Set PLL ldo voltage without this PLL6 does not work properly */
+	clrsetbits_le32(&prcm->pll_ctrl1, PRCM_PLL_CTRL_LDO_KEY_MASK,
+			PRCM_PLL_CTRL_LDO_KEY);
+	clrsetbits_le32(&prcm->pll_ctrl1, ~PRCM_PLL_CTRL_LDO_KEY_MASK,
+		PRCM_PLL_CTRL_LDO_DIGITAL_EN | PRCM_PLL_CTRL_LDO_ANALOG_EN |
+		PRCM_PLL_CTRL_EXT_OSC_EN | PRCM_PLL_CTRL_LDO_OUT_L(1140));
+	clrbits_le32(&prcm->pll_ctrl1, PRCM_PLL_CTRL_LDO_KEY_MASK);
+
+	clock_set_pll1(408000000);
+
+	writel(AHB1_ABP1_DIV_DEFAULT, &ccm->ahb1_apb1_div);
+
+	writel(PLL6_CFG_DEFAULT, &ccm->pll6_cfg);
+
+	writel(MBUS_CLK_DEFAULT, &ccm->mbus0_clk_cfg);
+	writel(MBUS_CLK_DEFAULT, &ccm->mbus1_clk_cfg);
+}
+#endif
+
 void clock_init_uart(void)
 {
 	struct sunxi_ccm_reg *const ccm =
@@ -65,6 +92,56 @@ int clock_twi_onoff(int port, int state)
 	return 0;
 }
 
+#ifdef CONFIG_SPL_BUILD
+void clock_set_pll1(unsigned int clk)
+{
+	struct sunxi_ccm_reg * const ccm =
+		(struct sunxi_ccm_reg *)SUNXI_CCM_BASE;
+	int k = 1;
+	int m = 1;
+
+	if (clk > 1152000000) {
+		k = 2;
+	} else if (clk > 768000000) {
+		k = 3;
+		m = 2;
+	}
+
+	/* Switch to 24MHz clock while changing PLL1 */
+	writel(AXI_DIV_3 << AXI_DIV_SHIFT |
+	       ATB_DIV_2 << ATB_DIV_SHIFT |
+	       CPU_CLK_SRC_OSC24M << CPU_CLK_SRC_SHIFT,
+	       &ccm->cpu_axi_cfg);
+
+	/* PLL1 rate = 24000000 * n * k / m */
+	writel(CCM_PLL1_CTRL_EN | CCM_PLL1_CTRL_MAGIC |
+	       CCM_PLL1_CTRL_N(clk / (24000000 * k / m)) |
+	       CCM_PLL1_CTRL_K(k) | CCM_PLL1_CTRL_M(m), &ccm->pll1_cfg);
+	sdelay(200);
+
+	/* Switch CPU to PLL1 */
+	writel(AXI_DIV_3 << AXI_DIV_SHIFT |
+	       ATB_DIV_2 << ATB_DIV_SHIFT |
+	       CPU_CLK_SRC_PLL1 << CPU_CLK_SRC_SHIFT,
+	       &ccm->cpu_axi_cfg);
+}
+#endif
+
+void clock_set_pll5(unsigned int clk)
+{
+	struct sunxi_ccm_reg * const ccm =
+		(struct sunxi_ccm_reg *)SUNXI_CCM_BASE;
+	const int k = 2;
+	const int m = 1;
+
+	/* PLL5 rate = 24000000 * n * k / m */
+	writel(CCM_PLL5_CTRL_EN | CCM_PLL5_CTRL_UPD |
+	       CCM_PLL5_CTRL_N(clk / (24000000 * k / m)) |
+	       CCM_PLL5_CTRL_K(k) | CCM_PLL5_CTRL_M(m), &ccm->pll5_cfg);
+
+	udelay(5500);
+}
+
 unsigned int clock_get_pll6(void)
 {
 	struct sunxi_ccm_reg *const ccm =
arch/arm/include/asm/arch-sunxi/clock.h +1 -0
index 42382a8..b40c16b 100644
@@ -25,6 +25,7 @@
 int clock_init(void);
 int clock_twi_onoff(int port, int state);
 void clock_set_pll1(unsigned int hz);
+void clock_set_pll5(unsigned int hz);
 unsigned int clock_get_pll5p(void);
 unsigned int clock_get_pll6(void);
 void clock_init_safe(void);
arch/arm/include/asm/arch-sunxi/clock_sun6i.h +26 -1
index 1397b35..4992dbc 100644
@@ -170,7 +170,17 @@ struct sunxi_ccm_reg {
 #define CPU_CLK_SRC_OSC24M		1
 #define CPU_CLK_SRC_PLL1		2
 
-#define PLL1_CFG_DEFAULT		0x90011b21
+#define CCM_PLL1_CTRL_M(n)		((((n) - 1) & 0x3) << 0)
+#define CCM_PLL1_CTRL_K(n)		((((n) - 1) & 0x3) << 4)
+#define CCM_PLL1_CTRL_N(n)		((((n) - 1) & 0x1f) << 8)
+#define CCM_PLL1_CTRL_MAGIC		(0x1 << 16)
+#define CCM_PLL1_CTRL_EN		(0x1 << 31)
+
+#define CCM_PLL5_CTRL_M(n)		((((n) - 1) & 0x3) << 0)
+#define CCM_PLL5_CTRL_K(n)		((((n) - 1) & 0x3) << 4)
+#define CCM_PLL5_CTRL_N(n)		((((n) - 1) & 0x1f) << 8)
+#define CCM_PLL5_CTRL_UPD		(0x1 << 20)
+#define CCM_PLL5_CTRL_EN		(0x1 << 31)
 
 #define PLL6_CFG_DEFAULT		0x90041811
 
@@ -179,6 +189,11 @@ struct sunxi_ccm_reg {
 #define CCM_PLL6_CTRL_K_SHIFT		4
 #define CCM_PLL6_CTRL_K_MASK		(0x3 << CCM_PLL6_CTRL_K_SHIFT)
 
+#define AHB1_ABP1_DIV_DEFAULT		0x00002020
+
+#define AXI_GATE_OFFSET_DRAM		0
+
+#define AHB_GATE_OFFSET_MCTL		14
 #define AHB_GATE_OFFSET_MMC3		11
 #define AHB_GATE_OFFSET_MMC2		10
 #define AHB_GATE_OFFSET_MMC1		9
@@ -190,6 +205,16 @@ struct sunxi_ccm_reg {
 
 #define CCM_MMC_CTRL_ENABLE (0x1 << 31)
 
+#define MDFS_CLK_DEFAULT		0x81000002 /* PLL6 / 3 */
+
+#define CCM_DRAMCLK_CFG_DIV0(x)		((x - 1) << 8)
+#define CCM_DRAMCLK_CFG_DIV0_MASK	(0xf << 8)
+#define CCM_DRAMCLK_CFG_UPD		(0x1 << 16)
+#define CCM_DRAMCLK_CFG_RST		(0x1 << 31)
+
+#define MBUS_CLK_DEFAULT		0x81000001 /* PLL6 / 2 */
+
+#define AHB_RESET_OFFSET_MCTL		14
 #define AHB_RESET_OFFSET_MMC3		11
 #define AHB_RESET_OFFSET_MMC2		10
 #define AHB_RESET_OFFSET_MMC1		9
arch/arm/include/asm/arch-sunxi/prcm.h +1 -0
index 3d3bfa6..88de1ff 100644
@@ -119,6 +119,7 @@
 #define PRCM_PLL_CTRL_LDO_OUT_HV(n) \
 	__PRCM_PLL_CTRL_VDD_LDO_OUT((((n) & 0x7) * 30) + 1160)
 #define PRCM_PLL_CTRL_LDO_KEY (0xa7 << 24)
+#define PRCM_PLL_CTRL_LDO_KEY_MASK (0xff << 24)
 
 #define PRCM_CLK_1WIRE_GATE (0x1 << 31)
 
include/configs/sun6i.h +1 -0
index b714474..9558771 100644
@@ -14,6 +14,7 @@
 /*
  * A31 specific configuration
  */
+#define CONFIG_CLK_FULL_SPEED		1008000000
 
 #define CONFIG_SYS_PROMPT		"sun6i# "
 
Signature · 1 line
2.1.0
#4 lore raw

PATCH v2 4/9 sun6i: Add cpucfg register definitions

In reply to Hans de Goede

Not used atm, for future use (e.g. PSCI).

---
 arch/arm/cpu/armv7/sunxi/psci.S                |  4 +-
 arch/arm/include/asm/arch-sunxi/cpu.h          |  3 +-
 arch/arm/include/asm/arch-sunxi/cpucfg_sun6i.h | 67 ++++++++++++++++++++++++++
 3 files changed, 71 insertions(+), 3 deletions(-)
 create mode 100644 arch/arm/include/asm/arch-sunxi/cpucfg_sun6i.h
arch/arm/cpu/armv7/sunxi/psci.S +2 -2
index 0084c81..b9ea78b 100644
@@ -87,8 +87,8 @@ psci_cpu_on:
 	str	r2, [r0]
 	dsb
 
-	movw	r0, #(SUNXI_CPUCFG_BASE & 0xffff)
-	movt	r0, #(SUNXI_CPUCFG_BASE >> 16)
+	movw	r0, #(SUN7I_CPUCFG_BASE & 0xffff)
+	movt	r0, #(SUN7I_CPUCFG_BASE >> 16)
 
 	@ CPU mask
 	and	r1, r1, #3	@ only care about first cluster
arch/arm/include/asm/arch-sunxi/cpu.h +2 -1
index 0de79a0..d34690e 100644
@@ -70,7 +70,7 @@
 
 #define SUNXI_TP_BASE			0x01c25000
 #define SUNXI_PMU_BASE			0x01c25400
-#define SUNXI_CPUCFG_BASE              0x01c25c00
+#define SUN7I_CPUCFG_BASE              0x01c25c00
 
 #define SUNXI_UART0_BASE		0x01c28000
 #define SUNXI_UART1_BASE		0x01c28400
@@ -111,6 +111,7 @@
 #define SUNXI_AVG_BASE			0x01ea0000
 
 #define SUNXI_PRCM_BASE			0x01f01400
+#define SUN6I_CPUCFG_BASE		0x01f01c00
 #define SUNXI_R_UART_BASE		0x01f02800
 #define SUNXI_R_PIO_BASE		0x01f02c00
 #define SUNXI_P2WI_BASE			0x01f03400
arch/arm/include/asm/arch-sunxi/cpucfg_sun6i.h new file +67 -0

67 lines not on this page · raw message

Signature · 1 line
2.1.0
#5 lore raw

PATCH v2 5/9 sun4i: Rename dram files to dram_sun4i.x

In reply to Hans de Goede

In preparation for adding sun6i dram support.

---
 arch/arm/cpu/armv7/sunxi/Makefile            |   6 +-
 arch/arm/cpu/armv7/sunxi/dram.c              | 750 ---------------------------
 arch/arm/cpu/armv7/sunxi/dram_sun4i.c        | 750 +++++++++++++++++++++++++++
 arch/arm/include/asm/arch-sunxi/dram.h       | 167 +-----
 arch/arm/include/asm/arch-sunxi/dram_sun4i.h | 182 +++++++
 5 files changed, 937 insertions(+), 918 deletions(-)
 delete mode 100644 arch/arm/cpu/armv7/sunxi/dram.c
 create mode 100644 arch/arm/cpu/armv7/sunxi/dram_sun4i.c
 create mode 100644 arch/arm/include/asm/arch-sunxi/dram_sun4i.h
arch/arm/cpu/armv7/sunxi/Makefile +3 -3
index b3a3601..48cca0b 100644
@@ -28,9 +28,9 @@ endif
 endif
 
 ifdef CONFIG_SPL_BUILD
-obj-$(CONFIG_MACH_SUN4I)	+= dram.o
-obj-$(CONFIG_MACH_SUN5I)	+= dram.o
-obj-$(CONFIG_MACH_SUN7I)	+= dram.o
+obj-$(CONFIG_MACH_SUN4I)	+= dram_sun4i.o
+obj-$(CONFIG_MACH_SUN5I)	+= dram_sun4i.o
+obj-$(CONFIG_MACH_SUN7I)	+= dram_sun4i.o
 ifdef CONFIG_SPL_FEL
 obj-y	+= start.o
 endif
arch/arm/cpu/armv7/sunxi/dram.c deleted +0 -750

750 lines not on this page · raw message

arch/arm/cpu/armv7/sunxi/dram_sun4i.c new file +750 -0

750 lines not on this page · raw message

arch/arm/include/asm/arch-sunxi/dram.h +2 -165

174 lines not on this page · raw message

arch/arm/include/asm/arch-sunxi/dram_sun4i.h new file +182 -0

182 lines not on this page · raw message

Signature · 1 line
2.1.0
#6 lore raw

PATCH v2 6/9 sun6i: Add dram initialization code

In reply to Hans de Goede

Add full support for dram initialization, using a fixed clock and autodetection of the memory organization (numbers of channels, bus-width, etc.).

This is based on dram_sun6i.c and dram.h from u-boot in the Allwinner A31 SDK, extended with extra initialization sequences and the autodetect algorithm from boot0.

---
 arch/arm/cpu/armv7/sunxi/Makefile            |   1 +
 arch/arm/cpu/armv7/sunxi/dram_sun6i.c        | 436 +++++++++++++++++++++++++++
 arch/arm/include/asm/arch-sunxi/cpu.h        |   8 +-
 arch/arm/include/asm/arch-sunxi/dram.h       |   4 +
 arch/arm/include/asm/arch-sunxi/dram_sun6i.h | 359 ++++++++++++++++++++++
 5 files changed, 805 insertions(+), 3 deletions(-)
 create mode 100644 arch/arm/cpu/armv7/sunxi/dram_sun6i.c
 create mode 100644 arch/arm/include/asm/arch-sunxi/dram_sun6i.h
arch/arm/cpu/armv7/sunxi/Makefile +1 -0
index 48cca0b..3b6ae47 100644
@@ -30,6 +30,7 @@ endif
 ifdef CONFIG_SPL_BUILD
 obj-$(CONFIG_MACH_SUN4I)	+= dram_sun4i.o
 obj-$(CONFIG_MACH_SUN5I)	+= dram_sun4i.o
+obj-$(CONFIG_MACH_SUN6I)	+= dram_sun6i.o
 obj-$(CONFIG_MACH_SUN7I)	+= dram_sun4i.o
 ifdef CONFIG_SPL_FEL
 obj-y	+= start.o
arch/arm/cpu/armv7/sunxi/dram_sun6i.c new file +436 -0

436 lines not on this page · raw message

arch/arm/include/asm/arch-sunxi/cpu.h +5 -3
index d34690e..6550e50 100644
@@ -96,9 +96,10 @@
 #define SUNXI_GMAC_BASE			0x01c50000
 
 #define SUNXI_DRAM_COM_BASE		0x01c62000
-#define SUNXI_DRAM_CTL_BASE		0x01c63000
-#define SUNXI_DRAM_PHY_CH1_BASE		0x01c65000
-#define SUNXI_DRAM_PHY_CH2_BASE		0x01c66000
+#define SUNXI_DRAM_CTL0_BASE		0x01c63000
+#define SUNXI_DRAM_CTL1_BASE		0x01c64000
+#define SUNXI_DRAM_PHY0_BASE		0x01c65000
+#define SUNXI_DRAM_PHY1_BASE		0x01c66000
 
 /* module sram */
 #define SUNXI_SRAM_C_BASE		0x01d00000
@@ -110,6 +111,7 @@
 #define SUNXI_MP_BASE			0x01e80000
 #define SUNXI_AVG_BASE			0x01ea0000
 
+#define SUNXI_RTC_BASE			0x01f00000
 #define SUNXI_PRCM_BASE			0x01f01400
 #define SUN6I_CPUCFG_BASE		0x01f01c00
 #define SUNXI_R_UART_BASE		0x01f02800
arch/arm/include/asm/arch-sunxi/dram.h +4 -0
index c58971d..9072e68 100644
@@ -15,7 +15,11 @@
 #include <linux/types.h>
 
 /* dram regs definition */
+#if defined(CONFIG_MACH_SUN6I)
+#include <asm/arch/dram_sun6i.h>
+#else
 #include <asm/arch/dram_sun4i.h>
+#endif
 
 unsigned long sunxi_dram_init(void);
 
arch/arm/include/asm/arch-sunxi/dram_sun6i.h new file +359 -0

359 lines not on this page · raw message

Signature · 1 line
2.1.0
#7 lore raw

PATCH v2 7/9 sun6i: Poke magic sram controller register to avoid cache issues

In reply to Hans de Goede

Without this the cache will only work in write-through mode, and as soon as it is put in write-back mode things break.

---
 arch/arm/cpu/armv7/sunxi/board.c | 5 +++++
 1 file changed, 5 insertions(+)
arch/arm/cpu/armv7/sunxi/board.c +5 -0
index 6c812fc..9b3e80c 100644
@@ -114,6 +114,11 @@ void reset_cpu(ulong addr)
 /* do some early init */
 void s_init(void)
 {
+#if defined CONFIG_SPL_BUILD && defined CONFIG_MACH_SUN6I
+	/* Magic (undocmented) value taken from boot0, without this DRAM
+	 * access gets messed up (seems cache related) */
+	setbits_le32(SUNXI_SRAMC_BASE + 0x44, 0x1800);
+#endif
 #if !defined CONFIG_SPL_BUILD && (defined CONFIG_MACH_SUN7I || \
 		defined CONFIG_MACH_SUN6I || defined CONFIG_MACH_SUN8I)
 	/* Enable SMP mode for CPU0, by setting bit 6 of Auxiliary Ctl reg */
Signature · 1 line
2.1.0
#8 lore raw

PATCH v2 8/9 sun6i: Enable SPL

In reply to Hans de Goede

Enable the SPL now that we've all the necessary bits in place.

---
 board/sunxi/Kconfig        | 1 +
 configs/Colombus_defconfig | 9 +++++----
 2 files changed, 6 insertions(+), 4 deletions(-)
board/sunxi/Kconfig +1 -0
index 905e62d..df47863 100644
@@ -16,6 +16,7 @@ config MACH_SUN5I
 config MACH_SUN6I
 	bool "sun6i (Allwinner A31)"
 	select CPU_V7
+	select SUPPORT_SPL
 
 config MACH_SUN7I
 	bool "sun7i (Allwinner A20)"
configs/Colombus_defconfig +5 -4
index 8ba0029..bfbfccd 100644
@@ -1,7 +1,8 @@
-CONFIG_ARM=y
-CONFIG_ARCH_SUNXI=y
-CONFIG_MACH_SUN6I=y
-CONFIG_TARGET_COLOMBUS=y
+CONFIG_SPL=y
 CONFIG_FDTFILE="sun6i-a31-colombus.dtb"
 CONFIG_VIDEO=n
 CONFIG_USB_KEYBOARD=n
++S:CONFIG_ARM=y
++S:CONFIG_ARCH_SUNXI=y
++S:CONFIG_MACH_SUN6I=y
++S:CONFIG_TARGET_COLOMBUS=y
Signature · 1 line
2.1.0
#9 lore raw

PATCH v2 9/9 sun6i: Add Mele M9 board

In reply to Hans de Goede
---
 board/sunxi/Kconfig       |  4 ++++
 board/sunxi/MAINTAINERS   |  1 +
 configs/Mele_M9_defconfig | 18 ++++++++++++++++++
 3 files changed, 23 insertions(+)
 create mode 100644 configs/Mele_M9_defconfig
board/sunxi/Kconfig +4 -0
index df47863..f60da9d 100644
@@ -113,6 +113,10 @@ config TARGET_MELE_M3
 	bool "MELE_M3"
 	depends on MACH_SUN7I
 
+config TARGET_MELE_M9
+	bool "MELE_M9"
+	depends on MACH_SUN6I
+
 config TARGET_MINI_X_1GB
 	bool "MINI_X_1GB"
 	depends on MACH_SUN4I
board/sunxi/MAINTAINERS +1 -0
index b3c77a8..ca03002 100644
@@ -9,6 +9,7 @@ F:	configs/Cubieboard_defconfig
 F:	configs/Mele_A1000_defconfig
 F:	configs/Mele_A1000G_defconfig
 F:	configs/Mele_M3_defconfig
+F:	configs/Mele_M9_defconfig
 F:	configs/Mini-X_defconfig
 F:	configs/Mini-X-1Gb_defconfig
 F:	include/configs/sun5i.h
configs/Mele_M9_defconfig new file +18 -0
new file mode 100644
index 0000000..2c08c13
@@ -0,0 +1,18 @@
+CONFIG_SPL=y
+CONFIG_SYS_EXTRA_OPTIONS="AXP221_POWER"
+CONFIG_FDTFILE="sun6i-a31-m9.dtb"
+CONFIG_VIDEO=n
+CONFIG_USB_KEYBOARD=n
++S:CONFIG_ARM=y
++S:CONFIG_ARCH_SUNXI=y
++S:CONFIG_MACH_SUN6I=y
++S:CONFIG_TARGET_MELE_M9=y
+# Ethernet phy power
++S:CONFIG_AXP221_DLDO1_VOLT=3300
+# USB hub power
++S:CONFIG_AXP221_DLDO4_VOLT=3300
+# Wifi power
++S:CONFIG_AXP221_ALDO1_VOLT=3300
+# HDMI power ?
++S:CONFIG_AXP221_ALDO2_VOLT=1800
++S:CONFIG_AXP221_ALDO3_VOLT=3000
Signature · 1 line
2.1.0