sunxi: Add basic H3 support
Subsystems (2)
PATCH 1/2 sunxi: Add basic H3 support
Add initial sun8i H3 support, only uart + mmc are supported for now.
--- arch/arm/cpu/armv7/sunxi/board.c | 4 ++++ arch/arm/cpu/armv7/sunxi/cpu_info.c | 2 ++ arch/arm/include/asm/arch-sunxi/gpio.h | 1 + board/sunxi/Kconfig | 7 ++++++- drivers/power/Kconfig | 5 +++-- include/configs/sun8i.h | 2 ++ 6 files changed, 18 insertions(+), 3 deletions(-)
arch/arm/cpu/armv7/sunxi/board.c +4 -0
@@ -72,6 +72,10 @@ static int gpio_init(void)sunxi_gpio_set_cfgpin (SUNXI_GPB (0 ),SUN8I_A33_GPB_UART0 );sunxi_gpio_set_cfgpin (SUNXI_GPB (1 ),SUN8I_A33_GPB_UART0 );sunxi_gpio_set_pull (SUNXI_GPB (1 ),SUNXI_GPIO_PULL_UP ); +#elif CONFIG_CONS_INDEX ==1 && defined(CONFIG_MACH_SUN8I_H3 ) +sunxi_gpio_set_cfgpin (SUNXI_GPA (4 ),SUN8I_H3_GPA_UART0 ); +sunxi_gpio_set_cfgpin (SUNXI_GPA (5 ),SUN8I_H3_GPA_UART0 ); +sunxi_gpio_set_pull (SUNXI_GPA (5 ),SUNXI_GPIO_PULL_UP );#elif CONFIG_CONS_INDEX ==1 && defined(CONFIG_MACH_SUN9I )sunxi_gpio_set_cfgpin (SUNXI_GPH (12 ),SUN9I_GPH_UART0 );sunxi_gpio_set_cfgpin (SUNXI_GPH (13 ),SUN9I_GPH_UART0 );
arch/arm/cpu/armv7/sunxi/cpu_info.c +2 -0
@@ -69,6 +69,8 @@ int print_cpuinfo(void)puts ("CPU: Allwinner A23 (SUN8I)\n" );#elif definedCONFIG_MACH_SUN8I_A33 puts ("CPU: Allwinner A33 (SUN8I)\n" ); +#elif definedCONFIG_MACH_SUN8I_H3 +puts ("CPU: Allwinner H3 (SUN8I)\n" );#elif definedCONFIG_MACH_SUN9I puts ("CPU: Allwinner A80 (SUN9I)\n" );#else
arch/arm/include/asm/arch-sunxi/gpio.h +1 -0
@@ -147,6 +147,7 @@ enum sunxi_gpio_number {#define SUN7I_GPA_GMAC 5#define SUN6I_GPA_SDC2 5#define SUN6I_GPA_SDC3 4 +#define SUN8I_H3_GPA_UART0 2#define SUN4I_GPB_TWI0 2#define SUN4I_GPB_TWI1 2
board/sunxi/Kconfig +6 -1
@@ -68,6 +68,11 @@ config MACH_SUN8I_A33 select SUPPORT_SPL select ARMV7_BOOT_SEC_DEFAULT if OLD_SUNXI_KERNEL_COMPAT +config MACH_SUN8I_H3 + bool "sun8i (Allwinner H3)" + select CPU_V7 + select SUNXI_GEN_SUN6I + config MACH_SUN9I bool "sun9i (Allwinner A80)" select CPU_V7
@@ -78,7 +83,7 @@ endchoice # The sun8i SoCs share a lot, this helps to avoid a lot of "if A23 || A33" config MACH_SUN8I bool - default y if MACH_SUN8I_A23 || MACH_SUN8I_A33 + default y if MACH_SUN8I_A23 || MACH_SUN8I_A33 || MACH_SUN8I_H3 config DRAM_CLK
drivers/power/Kconfig +3 -2
@@ -8,7 +8,8 @@ choice prompt "Select Sunxi PMIC Variant" depends on ARCH_SUNXI default AXP209_POWER if MACH_SUN4I || MACH_SUN5I || MACH_SUN7I - default AXP221_POWER if MACH_SUN6I || MACH_SUN8I + default AXP221_POWER if MACH_SUN6I || MACH_SUN8I_A23 || MACH_SUN8I_A33 + default SUNXI_NO_PMIC if MACH_SUN8I_H3 config SUNXI_NO_PMIC boolean "board without a pmic"
@@ -31,7 +32,7 @@ config AXP209_POWER config AXP221_POWER boolean "axp221 / axp223 pmic support" - depends on MACH_SUN6I || MACH_SUN8I + depends on MACH_SUN6I || MACH_SUN8I_A23 || MACH_SUN8I_A33 ---help--- Select this to enable support for the axp221/axp223 pmic found on most A23 and A31 boards.
include/configs/sun8i.h +2 -0
@@ -25,6 +25,8 @@#define CONFIG_ARMV7_PSCI_NR_CPUS 2#elif defined(CONFIG_MACH_SUN8I_A33 )#define CONFIG_ARMV7_PSCI_NR_CPUS 4 +#elif defined(CONFIG_MACH_SUN8I_H3 ) +#define CONFIG_ARMV7_PSCI_NR_CPUS 4#else #error Unsupported sun8i variant#endif
Signature · 1 line
2.6.2
PATCH 2/2 sunxi: Add H3 DRAM initialization support
Based on existing A23/A33 code and the original H3 boot0.
--- arch/arm/cpu/armv7/sunxi/Makefile | 1 + arch/arm/cpu/armv7/sunxi/dram_sun8i_h3.c | 469 ++++++++++++++++++++++++ arch/arm/include/asm/arch-sunxi/clock_sun6i.h | 3 + arch/arm/include/asm/arch-sunxi/dram.h | 2 + arch/arm/include/asm/arch-sunxi/dram_sun8i_h3.h | 185 ++++++++++ board/sunxi/Kconfig | 1 + 6 files changed, 661 insertions(+) create mode 100644 arch/arm/cpu/armv7/sunxi/dram_sun8i_h3.c create mode 100644 arch/arm/include/asm/arch-sunxi/dram_sun8i_h3.h
arch/arm/cpu/armv7/sunxi/Makefile +1 -0
@@ -49,5 +49,6 @@ obj-$(CONFIG_MACH_SUN6I) += dram_sun6i.o obj-$(CONFIG_MACH_SUN7I) += dram_sun4i.o obj-$(CONFIG_MACH_SUN8I_A23) += dram_sun8i_a23.o obj-$(CONFIG_MACH_SUN8I_A33) += dram_sun8i_a33.o +obj-$(CONFIG_MACH_SUN8I_H3) += dram_sun8i_h3.o obj-y += fel_utils.o endif
arch/arm/cpu/armv7/sunxi/dram_sun8i_h3.c new file +469 -0
469 lines not on this page · raw message
arch/arm/include/asm/arch-sunxi/clock_sun6i.h +3 -0
@@ -282,6 +282,9 @@ struct sunxi_ccm_reg {#define CCM_DRAMCLK_CFG_DIV_MASK (0xf << 0)#define CCM_DRAMCLK_CFG_DIV0 (x) ((x - 1) << 8)#define CCM_DRAMCLK_CFG_DIV0_MASK (0xf << 8) +#define CCM_DRAMCLK_CFG_SRC_PLL5 (0x0 << 20) +#define CCM_DRAMCLK_CFG_SRC_PLL6x2 (0x1 << 20) +#define CCM_DRAMCLK_CFG_SRC_MASK (0x3 << 20)#define CCM_DRAMCLK_CFG_UPD (0x1 << 16)#define CCM_DRAMCLK_CFG_RST (0x1 << 31)
arch/arm/include/asm/arch-sunxi/dram.h +2 -0
@@ -22,6 +22,8 @@#include <asm/arch/dram_sun8i_a23.h> #elif defined(CONFIG_MACH_SUN8I_A33 )#include <asm/arch/dram_sun8i_a33.h> +#elif defined(CONFIG_MACH_SUN8I_H3 ) +#include <asm/arch/dram_sun8i_h3.h> #else #include <asm/arch/dram_sun4i.h> #endif
arch/arm/include/asm/arch-sunxi/dram_sun8i_h3.h new file +185 -0
185 lines not on this page · raw message
board/sunxi/Kconfig +1 -0
@@ -72,6 +72,7 @@ config MACH_SUN8I_H3 bool "sun8i (Allwinner H3)" select CPU_V7 select SUNXI_GEN_SUN6I + select SUPPORT_SPL config MACH_SUN9I bool "sun9i (Allwinner A80)"
Signature · 1 line
2.6.2
PATCH 1/2 sunxi: Add basic H3 support
In reply to Jens KuskeHi,
Quoted 3 lines · Jens Kuske
Add initial sun8i H3 support, only uart + mmc are supported for now.
Signed-off-by Jens Kuske <[email protected]>
Thanks! I've applied both patches and added 2 more from myself to bring in the latest upstream dts[i] work and add defconfigs for the orangepi_plus and orangepi_pc.
I know that the upstream dts work is not yet fully final due to bus_gates discussion, but the bus_gates bindings (or any clk stuff for that matter) are not used by u-boot. So from a u-boot pov this does not matter (and when booting the kernel u-boot uses the dtb from the boot medium, not its own copy).
Given the popularity of H3 boards I believe that it is important to get basic support in place now. Esp. to keep the contributions from various people working on H3 support flowing. I'm very happy to see that various people are contributing to this and I do not want to discourage them by taking for-ever to merge this :)
Regards,
Hans
p.s.
I've listed myself as maintainer for the orangepi_plus for now but I do not actually have one, feel free to submit a follow-up patch updating board/sunxi/MAINTAINERS to make you the maintainer for that one.
Quoted 111 lines
--- arch/arm/cpu/armv7/sunxi/board.c | 4 ++++ arch/arm/cpu/armv7/sunxi/cpu_info.c | 2 ++ arch/arm/include/asm/arch-sunxi/gpio.h | 1 + board/sunxi/Kconfig | 7 ++++++- drivers/power/Kconfig | 5 +++-- include/configs/sun8i.h | 2 ++ 6 files changed, 18 insertions(+), 3 deletions(-)arch/arm/cpu/armv7/sunxi/board.c +4
-0@@ -72,6 +72,10 @@ static int gpio_init(void)sunxi_gpio_set_cfgpin (SUNXI_GPB (0 ),SUN8I_A33_GPB_UART0 );sunxi_gpio_set_cfgpin (SUNXI_GPB (1 ),SUN8I_A33_GPB_UART0 );sunxi_gpio_set_pull (SUNXI_GPB (1 ),SUNXI_GPIO_PULL_UP ); +#elif CONFIG_CONS_INDEX ==1 && defined(CONFIG_MACH_SUN8I_H3 ) +sunxi_gpio_set_cfgpin (SUNXI_GPA (4 ),SUN8I_H3_GPA_UART0 ); +sunxi_gpio_set_cfgpin (SUNXI_GPA (5 ),SUN8I_H3_GPA_UART0 ); +sunxi_gpio_set_pull (SUNXI_GPA (5 ),SUNXI_GPIO_PULL_UP );#elif CONFIG_CONS_INDEX ==1 && defined(CONFIG_MACH_SUN9I )sunxi_gpio_set_cfgpin (SUNXI_GPH (12 ),SUN9I_GPH_UART0 );sunxi_gpio_set_cfgpin (SUNXI_GPH (13 ),SUN9I_GPH_UART0 );arch/arm/cpu/armv7/sunxi/cpu_info.c +2
-0@@ -69,6 +69,8 @@ int print_cpuinfo(void)puts ("CPU: Allwinner A23 (SUN8I)\n" );#elif definedCONFIG_MACH_SUN8I_A33 puts ("CPU: Allwinner A33 (SUN8I)\n" ); +#elif definedCONFIG_MACH_SUN8I_H3 +puts ("CPU: Allwinner H3 (SUN8I)\n" );#elif definedCONFIG_MACH_SUN9I puts ("CPU: Allwinner A80 (SUN9I)\n" );#else arch/arm/include/asm/arch-sunxi/gpio.h +1
-0@@ -147,6 +147,7 @@ enum sunxi_gpio_number {#define SUN7I_GPA_GMAC 5#define SUN6I_GPA_SDC2 5#define SUN6I_GPA_SDC3 4 +#define SUN8I_H3_GPA_UART0 2#define SUN4I_GPB_TWI0 2#define SUN4I_GPB_TWI1 2board/sunxi/Kconfig +6
-1@@ -68,6 +68,11 @@ config MACH_SUN8I_A33 select SUPPORT_SPL select ARMV7_BOOT_SEC_DEFAULT if OLD_SUNXI_KERNEL_COMPAT +config MACH_SUN8I_H3 + bool "sun8i (Allwinner H3)" + select CPU_V7 + select SUNXI_GEN_SUN6I + config MACH_SUN9I bool "sun9i (Allwinner A80)" select CPU_V7@@ -78,7 +83,7 @@ endchoice # The sun8i SoCs share a lot, this helps to avoid a lot of "if A23 || A33" config MACH_SUN8I bool - default y if MACH_SUN8I_A23 || MACH_SUN8I_A33 + default y if MACH_SUN8I_A23 || MACH_SUN8I_A33 || MACH_SUN8I_H3 config DRAM_CLKdrivers/power/Kconfig +3
-2@@ -8,7 +8,8 @@ choice prompt "Select Sunxi PMIC Variant" depends on ARCH_SUNXI default AXP209_POWER if MACH_SUN4I || MACH_SUN5I || MACH_SUN7I - default AXP221_POWER if MACH_SUN6I || MACH_SUN8I + default AXP221_POWER if MACH_SUN6I || MACH_SUN8I_A23 || MACH_SUN8I_A33 + default SUNXI_NO_PMIC if MACH_SUN8I_H3 config SUNXI_NO_PMIC boolean "board without a pmic"@@ -31,7 +32,7 @@ config AXP209_POWER config AXP221_POWER boolean "axp221 / axp223 pmic support" - depends on MACH_SUN6I || MACH_SUN8I + depends on MACH_SUN6I || MACH_SUN8I_A23 || MACH_SUN8I_A33 ---help--- Select this to enable support for the axp221/axp223 pmic found on most A23 and A31 boards.include/configs/sun8i.h +2
-0@@ -25,6 +25,8 @@#define CONFIG_ARMV7_PSCI_NR_CPUS 2#elif defined(CONFIG_MACH_SUN8I_A33 )#define CONFIG_ARMV7_PSCI_NR_CPUS 4 +#elif defined(CONFIG_MACH_SUN8I_H3 ) +#define CONFIG_ARMV7_PSCI_NR_CPUS 4#else #error Unsupported sun8i variant#endif