The basic blocks of the A23 are similar to the A31 (sun6i). Re-use
sun6i code for initial clock, gpio, and uart setup.

Signed-off-by: Chen-Yu Tsai <[email protected]>
---
 arch/arm/cpu/armv7/sunxi/Makefile       |  2 ++
 arch/arm/cpu/armv7/sunxi/board.c        |  2 +-
 arch/arm/cpu/armv7/sunxi/cpu_info.c     |  2 ++
 arch/arm/include/asm/arch-sunxi/clock.h |  2 +-
 arch/arm/include/asm/arch-sunxi/gpio.h  |  6 ++++++
 board/sunxi/board.c                     |  6 +++---
 drivers/mmc/sunxi_mmc.c                 |  5 +++--
 include/configs/sun8i.h                 | 28 ++++++++++++++++++++++++++++
 8 files changed, 46 insertions(+), 7 deletions(-)
 create mode 100644 include/configs/sun8i.h

diff --git a/arch/arm/cpu/armv7/sunxi/Makefile 
b/arch/arm/cpu/armv7/sunxi/Makefile
index b39ea02..447b1ec 100644
--- a/arch/arm/cpu/armv7/sunxi/Makefile
+++ b/arch/arm/cpu/armv7/sunxi/Makefile
@@ -13,11 +13,13 @@ obj-y       += clock.o
 obj-y  += pinmux.o
 obj-y  += watchdog.o
 obj-$(CONFIG_SUN6I)    += prcm.o
+obj-$(CONFIG_SUN8I)    += prcm.o
 obj-$(CONFIG_SUN6I)    += p2wi.o
 obj-$(CONFIG_SUN4I)    += clock_sun4i.o
 obj-$(CONFIG_SUN5I)    += clock_sun4i.o
 obj-$(CONFIG_SUN6I)    += clock_sun6i.o
 obj-$(CONFIG_SUN7I)    += clock_sun4i.o
+obj-$(CONFIG_SUN8I)    += clock_sun6i.o
 ifdef DEBUG
 obj-y  += early_print.o
 endif
diff --git a/arch/arm/cpu/armv7/sunxi/board.c b/arch/arm/cpu/armv7/sunxi/board.c
index 832d22c..4090d3d 100644
--- a/arch/arm/cpu/armv7/sunxi/board.c
+++ b/arch/arm/cpu/armv7/sunxi/board.c
@@ -113,7 +113,7 @@ void s_init(void)
 #endif
 #endif
 /* No SPL on sun6i, so we do sunxi_board_init() from non spl there */
-#if defined(CONFIG_SPL_BUILD) || defined(CONFIG_SUN6I)
+#if defined(CONFIG_SPL_BUILD) || defined(CONFIG_SUN6I) || defined(CONFIG_SUN8I)
        sunxi_board_init();
 #endif
 }
diff --git a/arch/arm/cpu/armv7/sunxi/cpu_info.c 
b/arch/arm/cpu/armv7/sunxi/cpu_info.c
index f8a2efd..83c1d2d 100644
--- a/arch/arm/cpu/armv7/sunxi/cpu_info.c
+++ b/arch/arm/cpu/armv7/sunxi/cpu_info.c
@@ -22,6 +22,8 @@ int print_cpuinfo(void)
        puts("CPU:   Allwinner A31 (SUN6I)\n");
 #elif defined CONFIG_SUN7I
        puts("CPU:   Allwinner A20 (SUN7I)\n");
+#elif defined CONFIG_SUN8I
+       puts("CPU:   Allwinner A23 (SUN8I)\n");
 #else
 #warning Please update cpu_info.c with correct CPU information
        puts("CPU:   SUNXI Family\n");
diff --git a/arch/arm/include/asm/arch-sunxi/clock.h 
b/arch/arm/include/asm/arch-sunxi/clock.h
index 2f580b7..a12d096 100644
--- a/arch/arm/include/asm/arch-sunxi/clock.h
+++ b/arch/arm/include/asm/arch-sunxi/clock.h
@@ -15,7 +15,7 @@
 #define CLK_GATE_CLOSE                 0x0
 
 /* clock control module regs definition */
-#if defined(CONFIG_SUN6I)
+#if defined(CONFIG_SUN6I) || defined(CONFIG_SUN8I)
 #include <asm/arch/clock_sun6i.h>
 #else
 #include <asm/arch/clock_sun4i.h>
diff --git a/arch/arm/include/asm/arch-sunxi/gpio.h 
b/arch/arm/include/asm/arch-sunxi/gpio.h
index 8de6bc1..1d0c6cb 100644
--- a/arch/arm/include/asm/arch-sunxi/gpio.h
+++ b/arch/arm/include/asm/arch-sunxi/gpio.h
@@ -138,8 +138,14 @@ enum sunxi_gpio_number {
 #define SUNXI_GPF0_SDC0                2
 
 #define SUNXI_GPF2_SDC0                2
+
+#ifdef CONFIG_SUN8I
+#define SUNXI_GPF2_UART0_TX    3
+#define SUNXI_GPF4_UART0_RX    3
+#else
 #define SUNXI_GPF2_UART0_TX    4
 #define SUNXI_GPF4_UART0_RX    4
+#endif
 
 #define SUN4I_GPG0_SDC1                4
 
diff --git a/board/sunxi/board.c b/board/sunxi/board.c
index 386b03e..82cead0 100644
--- a/board/sunxi/board.c
+++ b/board/sunxi/board.c
@@ -77,11 +77,11 @@ int board_mmc_init(bd_t *bis)
 }
 #endif
 
-#if defined(CONFIG_SPL_BUILD) || defined(CONFIG_SUN6I)
+#if defined(CONFIG_SPL_BUILD) || defined(CONFIG_SUN6I) || defined(CONFIG_SUN8I)
 void sunxi_board_init(void)
 {
        int power_failed = 0;
-#if !defined(CONFIG_SUN6I)
+#if !defined(CONFIG_SUN6I) && !defined(CONFIG_SUN8I)
        unsigned long ramsize;
 
        printf("DRAM:");
@@ -122,7 +122,7 @@ void sunxi_board_init(void)
 #endif
 #endif
 
-#if !defined(CONFIG_SUN6I)
+#if !defined(CONFIG_SUN6I) && !defined(CONFIG_SUN8I)
        /*
         * Only clock up the CPU to full speed if we are reasonably
         * assured it's being powered with suitable core voltage
diff --git a/drivers/mmc/sunxi_mmc.c b/drivers/mmc/sunxi_mmc.c
index d6c051e..4eae99c 100644
--- a/drivers/mmc/sunxi_mmc.c
+++ b/drivers/mmc/sunxi_mmc.c
@@ -77,7 +77,8 @@ struct sunxi_mmc_des {
        u32 data_buf1_sz:13;
        u32 data_buf2_sz:13;
        u32 reserverd2_1:6;
-#elif defined(CONFIG_SUN5I) || defined(CONFIG_SUN6I) || defined(CONFIG_SUN7I)
+#elif defined(CONFIG_SUN5I) || defined(CONFIG_SUN6I) || \
+       defined(CONFIG_SUN7I) || defined(CONFIG_SUN8I)
 #define SDXC_DES_NUM_SHIFT 16
 #define SDXC_DES_BUFFER_MAX_LEN        (1 << SDXC_DES_NUM_SHIFT)
        u32 data_buf1_sz:16;
@@ -201,7 +202,7 @@ static int mmc_clk_io_on(int sdc_no)
        /* config ahb clock */
        setbits_le32(&ccm->ahb_gate0, 1 << AHB_GATE_OFFSET_MMC(sdc_no));
 
-#if defined(CONFIG_SUN6I)
+#if defined(CONFIG_SUN6I) || defined(CONFIG_SUN8I)
        /* unassert reset */
        setbits_le32(&ccm->ahb_reset0_cfg, 1 << AHB_RESET_OFFSET_MMC(sdc_no));
 #endif
diff --git a/include/configs/sun8i.h b/include/configs/sun8i.h
new file mode 100644
index 0000000..6f12865
--- /dev/null
+++ b/include/configs/sun8i.h
@@ -0,0 +1,28 @@
+/*
+ * (C) Copyright 2012-2013 Henrik Nordstrom <[email protected]>
+ * (C) Copyright 2013 Luke Kenneth Casson Leighton <[email protected]>
+ * (C) Copyright 2013 Maxime Ripard <[email protected]>
+ * (C) Copyright 2014 Chen-Yu Tsai <[email protected]>
+ *
+ * Configuration settings for the Allwinner A23 (sun8i) CPU
+ *
+ * SPDX-License-Identifier:    GPL-2.0+
+ */
+
+#ifndef __CONFIG_H
+#define __CONFIG_H
+
+/*
+ * A23 specific configuration
+ */
+#define CONFIG_SUN8I           /* sun8i SoC generation */
+
+#define CONFIG_SYS_PROMPT              "sun8i# "
+#define CONFIG_MACH_TYPE               4137
+
+/*
+ * Include common sunxi configuration where most the settings are
+ */
+#include <configs/sunxi-common.h>
+
+#endif /* __CONFIG_H */
-- 
2.0.0.rc0

-- 
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