ARM: sunxi: Add Allwinner A23 (sun8i) support
Subsystems (3)
cover ARM: sunxi: Add Allwinner A23 (sun8i) support
Hi everyone,
This series adds support for Allwinner's A23 SoC. All the patches are either direct cherry-picks or changes manually merged from u-boot-sunxi.
Patch 1 fixes build breaks when CONFIG_MMC is not set. This happens when we use port F for uart0.
Patch 2 adds uart0 pinmux values for A23.
Patch 3 adds support for using uart0 on port F, either using a breakout board or soldering wires to exposed pads. At least one version of A23 tablets requires this, as no other uarts are exposed.
Patch 4 adds support for sun8i in the mmc driver. This is the same as sun6i.
Patch 5 adds machine support for sun8i.
Patch 6 adds support for gpio banks L and beyond, which is used by r_uart, p2wi (on sun6i) and rsb (on sun8i).
Patch 7 makes the prcm apb0 clock enabling function to take an argument for which modules should be enabled.
Patch 8 adds support for using r_uart as a console (with CONS_INDEX=5).
Patch 9 adds a defconfig for the Ippo Q8H A23 tablet board.
Cheers
ChenYu
Chen-Yu Tsai (8):
ARM: sunxi: Fix build break when CONFIG_MMC is not defined
ARM: sunxi: Add sun8i (A23) UART0 pin mux support
ARM: sunxi: Add support for uart0 on port F (mmc0)
mmc: sunxi: Add support for sun8i (A23)
ARM: sunxi: Add basic A23 support
ARM: sunxi: Allow specifying module in prcm apb0 init function
ARM: sunxi: Add support for using R_UART as console
ARM: sunxi: Add Ippo-q8h-v5 A23 tablet board defconfig
Hans de Goede (1):
ARM: sunxi: Add support for R_PIO gpio banks
arch/arm/Kconfig | 3 +++ arch/arm/cpu/armv7/sunxi/Makefile | 2 ++ arch/arm/cpu/armv7/sunxi/board.c | 18 +++++++++++++++-- arch/arm/cpu/armv7/sunxi/clock_sun6i.c | 6 ++++++ arch/arm/cpu/armv7/sunxi/cpu_info.c | 2 ++ arch/arm/cpu/armv7/sunxi/prcm.c | 12 +++++++----- arch/arm/include/asm/arch-sunxi/clock.h | 2 +- arch/arm/include/asm/arch-sunxi/cpu.h | 1 + arch/arm/include/asm/arch-sunxi/gpio.h | 34 +++++++++++++++++++++++++++++++-- arch/arm/include/asm/arch-sunxi/mmc.h | 2 +- arch/arm/include/asm/arch-sunxi/prcm.h | 2 +- board/sunxi/Kconfig | 9 ++++++++- board/sunxi/MAINTAINERS | 5 +++++ configs/Ippo_q8h_defconfig | 4 ++++ drivers/mmc/sunxi_mmc.c | 2 +- include/configs/sun8i.h | 23 ++++++++++++++++++++++ include/configs/sunxi-common.h | 11 ++++++++++- 17 files changed, 123 insertions(+), 15 deletions(-) create mode 100644 configs/Ippo_q8h_defconfig create mode 100644 include/configs/sun8i.h
Signature · 1 line
2.1.1
PATCH 1/9 ARM: sunxi: Fix build break when CONFIG_MMC is not defined
BOOT_TARGET_DEVICES includes MMC unconditionally. This breaks when CONFIG_CMD_MMC is not defined. Use a secondary macro to conditionally include it when CONFIG_MMC is enabled, as we do for CONFIG_AHCI.
This is used when we want to use uart0 from port F, which conflicts with mmc0.
--- include/configs/sunxi-common.h | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-)
include/configs/sunxi-common.h +7 -1
@@ -227,6 +227,12 @@"pxefile_addr_r=0x43200000\0" \ "ramdisk_addr_r=0x43300000\0" +#ifdef CONFIG_MMC +#define BOOT_TARGET_DEVICES_MMC (func) func(MMC, mmc, 0) +#else +#define BOOT_TARGET_DEVICES_MMC (func) +#endif +#ifdef CONFIG_AHCI #define BOOT_TARGET_DEVICES_SCSI (func) func(SCSI, scsi, 0)#else
@@ -240,7 +246,7 @@#endif #define BOOT_TARGET_DEVICES (func) \ - func(MMC, mmc, 0) \ + BOOT_TARGET_DEVICES_MMC(func) \ BOOT_TARGET_DEVICES_SCSI(func) \ BOOT_TARGET_DEVICES_USB(func) \ func(PXE, pxe, na) \
Signature · 1 line
2.1.1
PATCH 1/9 ARM: sunxi: Fix build break when CONFIG_MMC is not defined
Quoted 8 lines · Chen-Yu Tsai
BOOT_TARGET_DEVICESincludes MMC unconditionally. This breaks whenCONFIG_CMD_MMCis not defined. Use a secondary macro to conditionally include it whenCONFIG_MMCis enabled, as we do forCONFIG_AHCI.This is used when we want to use uart0 from port F, which conflicts with mmc0.
Signed-off-by Chen-Yu Tsai <[email protected]>
Hans, this made me think back to your " Enable second sdcard slot found on some boards" series -- do you not want to add mmc1 as a boot target device when MMC_SUNXI_SLOT_EXTRA is enabled?
Quoted 30 lines
--- include/configs/sunxi-common.h | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-)include/configs/sunxi-common.h +7
-1@@ -227,6 +227,12 @@"pxefile_addr_r=0x43200000\0" \ "ramdisk_addr_r=0x43300000\0" +#ifdef CONFIG_MMC +#define BOOT_TARGET_DEVICES_MMC (func) func(MMC, mmc, 0) +#else +#define BOOT_TARGET_DEVICES_MMC (func) +#endif +#ifdef CONFIG_AHCI #define BOOT_TARGET_DEVICES_SCSI (func) func(SCSI, scsi, 0)#else @@ -240,7 +246,7 @@#endif #define BOOT_TARGET_DEVICES (func) \ - func(MMC, mmc, 0) \ + BOOT_TARGET_DEVICES_MMC(func) \ BOOT_TARGET_DEVICES_SCSI(func) \ BOOT_TARGET_DEVICES_USB(func) \ func(PXE, pxe, na) \
PATCH 1/9 ARM: sunxi: Fix build break when CONFIG_MMC is not defined
Hi,
Quoted 8 lines · Ian Campbell
Quoted 7 lines · Chen-Yu Tsai
BOOT_TARGET_DEVICESincludes MMC unconditionally. This breaks whenCONFIG_CMD_MMCis not defined. Use a secondary macro to conditionally include it whenCONFIG_MMCis enabled, as we do forCONFIG_AHCI.This is used when we want to use uart0 from port F, which conflicts with mmc0.
Quoted 7 lines
Quoted 1 line
Signed-off-by Chen-Yu Tsai <[email protected]>Acked-by Ian Campbell <[email protected]>Hans, this made me think back to your " Enable second sdcard slot found on some boards" series -- do you not want to add mmc1 as a boot target device when
MMC_SUNXI_SLOT_EXTRAis enabled?
An interesting question. u-boot itself is always running of mmc 0, or loaded through FEL, but that does not mean that e.g. extlinux.conf + the kernel and dts could not be on mmc 1. So yes I guess we do want to add mmc 1 as boot target.
First lets get Chen's patches + my existing second mmc slot set merged into u-boot-sunxi next, and then I'll do a patch on top of that.
Regards,
Hans
Quoted 33 lines
Quoted 31 lines
--- include/configs/sunxi-common.h | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-)include/configs/sunxi-common.h +7
-1@@ -227,6 +227,12 @@"pxefile_addr_r=0x43200000\0" \ "ramdisk_addr_r=0x43300000\0" +#ifdef CONFIG_MMC +#define BOOT_TARGET_DEVICES_MMC (func) func(MMC, mmc, 0) +#else +#define BOOT_TARGET_DEVICES_MMC (func) +#endif +#ifdef CONFIG_AHCI #define BOOT_TARGET_DEVICES_SCSI (func) func(SCSI, scsi, 0)#else @@ -240,7 +246,7 @@#endif #define BOOT_TARGET_DEVICES (func) \ - func(MMC, mmc, 0) \ + BOOT_TARGET_DEVICES_MMC(func) \ BOOT_TARGET_DEVICES_SCSI(func) \ BOOT_TARGET_DEVICES_USB(func) \ func(PXE, pxe, na) \
PATCH 2/9 ARM: sunxi: Add sun8i (A23) UART0 pin mux support
In reply to Chen-Yu TsaiUART0 pin muxes on the A23 have a different function value.
--- arch/arm/include/asm/arch-sunxi/gpio.h | 6 ++++++ 1 file changed, 6 insertions(+)
arch/arm/include/asm/arch-sunxi/gpio.h +6 -0
@@ -125,8 +125,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
Signature · 1 line
2.1.1
PATCH 2/9 ARM: sunxi: Add sun8i (A23) UART0 pin mux support
Quoted 3 lines · Chen-Yu Tsai
UART0 pin muxes on the A23 have a different function value.
Signed-off-by Chen-Yu Tsai <[email protected]>
Sigh, why can't silicon folks resist fiddling with stuff ;-)
Quoted 23 lines
--- arch/arm/include/asm/arch-sunxi/gpio.h | 6 ++++++ 1 file changed, 6 insertions(+)arch/arm/include/asm/arch-sunxi/gpio.h +6
-0@@ -125,8 +125,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
PATCH 3/9 ARM: sunxi: Add support for uart0 on port F (mmc0)
In reply to Chen-Yu TsaiAllwinner SoCs provide uart0 muxed with mmc0, which can then be used with a micro SD breakout board. On the A23, this is the only way to use uart0.
--- arch/arm/cpu/armv7/sunxi/board.c | 11 ++++++++++- include/configs/sunxi-common.h | 2 ++ 2 files changed, 12 insertions(+), 1 deletion(-)
arch/arm/cpu/armv7/sunxi/board.c +10 -1
@@ -50,7 +50,16 @@ u32 spl_boot_mode(void)int gpio_init (void ) { -#if CONFIG_CONS_INDEX ==1 && (defined(CONFIG_SUN4I ) || defined(CONFIG_SUN7I )) +#if CONFIG_CONS_INDEX ==1 && defined(CONFIG_UART0_PORT_F ) +#if defined(CONFIG_SUN4I ) || defined(CONFIG_SUN7I ) +/* disable GPB22,23 as uart0 tx,rx to avoid conflict */ +sunxi_gpio_set_cfgpin (SUNXI_GPB (22 ),SUNXI_GPIO_INPUT ); +sunxi_gpio_set_cfgpin (SUNXI_GPB (23 ),SUNXI_GPIO_INPUT ); +#endif +sunxi_gpio_set_cfgpin (SUNXI_GPF (2 ),SUNXI_GPF2_UART0_TX ); +sunxi_gpio_set_cfgpin (SUNXI_GPF (4 ),SUNXI_GPF4_UART0_RX ); +sunxi_gpio_set_pull (SUNXI_GPF (4 ),1 ); +#elif CONFIG_CONS_INDEX ==1 && (defined(CONFIG_SUN4I ) || defined(CONFIG_SUN7I ))sunxi_gpio_set_cfgpin (SUNXI_GPB (22 ),SUN4I_GPB22_UART0_TX );sunxi_gpio_set_cfgpin (SUNXI_GPB (23 ),SUN4I_GPB23_UART0_RX );sunxi_gpio_set_pull (SUNXI_GPB (23 ),SUNXI_GPIO_PULL_UP );
include/configs/sunxi-common.h +2 -0
@@ -77,6 +77,7 @@#define CONFIG_INITRD_TAG /* mmc config */ +#if !defined(CONFIG_UART0_PORT_F )#define CONFIG_MMC #define CONFIG_GENERIC_MMC #define CONFIG_CMD_MMC
@@ -84,6 +85,7 @@#define CONFIG_MMC_SUNXI_SLOT 0#define CONFIG_ENV_IS_IN_MMC #define CONFIG_SYS_MMC_ENV_DEV 0/* first detected MMC controller */ +#endif /* 4MB of malloc() pool */ #define CONFIG_SYS_MALLOC_LEN (CONFIG_ENV_SIZE + (4 << 20))
Signature · 1 line
2.1.1
PATCH 3/9 ARM: sunxi: Add support for uart0 on port F (mmc0)
Quoted 5 lines · Chen-Yu Tsai
Allwinner SoCs provide uart0 muxed with mmc0, which can then be used with a micro SD breakout board. On the A23, this is the only way to use uart0.
Signed-off-by Chen-Yu Tsai <[email protected]>
Quoted 47 lines
--- arch/arm/cpu/armv7/sunxi/board.c | 11 ++++++++++- include/configs/sunxi-common.h | 2 ++ 2 files changed, 12 insertions(+), 1 deletion(-)arch/arm/cpu/armv7/sunxi/board.c +10
-1@@ -50,7 +50,16 @@ u32 spl_boot_mode(void)int gpio_init (void ) { -#if CONFIG_CONS_INDEX ==1 && (defined(CONFIG_SUN4I ) || defined(CONFIG_SUN7I )) +#if CONFIG_CONS_INDEX ==1 && defined(CONFIG_UART0_PORT_F ) +#if defined(CONFIG_SUN4I ) || defined(CONFIG_SUN7I ) +/* disable GPB22,23 as uart0 tx,rx to avoid conflict */ +sunxi_gpio_set_cfgpin (SUNXI_GPB (22 ),SUNXI_GPIO_INPUT ); +sunxi_gpio_set_cfgpin (SUNXI_GPB (23 ),SUNXI_GPIO_INPUT ); +#endif +sunxi_gpio_set_cfgpin (SUNXI_GPF (2 ),SUNXI_GPF2_UART0_TX ); +sunxi_gpio_set_cfgpin (SUNXI_GPF (4 ),SUNXI_GPF4_UART0_RX ); +sunxi_gpio_set_pull (SUNXI_GPF (4 ),1 ); +#elif CONFIG_CONS_INDEX ==1 && (defined(CONFIG_SUN4I ) || defined(CONFIG_SUN7I ))sunxi_gpio_set_cfgpin (SUNXI_GPB (22 ),SUN4I_GPB22_UART0_TX );sunxi_gpio_set_cfgpin (SUNXI_GPB (23 ),SUN4I_GPB23_UART0_RX );sunxi_gpio_set_pull (SUNXI_GPB (23 ),SUNXI_GPIO_PULL_UP );include/configs/sunxi-common.h +2
-0@@ -77,6 +77,7 @@#define CONFIG_INITRD_TAG /* mmc config */ +#if !defined(CONFIG_UART0_PORT_F )#define CONFIG_MMC #define CONFIG_GENERIC_MMC #define CONFIG_CMD_MMC @@ -84,6 +85,7 @@#define CONFIG_MMC_SUNXI_SLOT 0#define CONFIG_ENV_IS_IN_MMC #define CONFIG_SYS_MMC_ENV_DEV 0/* first detected MMC controller */ +#endif /* 4MB of malloc() pool */ #define CONFIG_SYS_MALLOC_LEN (CONFIG_ENV_SIZE + (4 << 20))
PATCH 4/9 mmc: sunxi: Add support for sun8i (A23)
In reply to Chen-Yu TsaiThe Allwinner A23 SoC has reset controls like the A31 (sun6i). The FIFO address is also the same as sun6i.
Re-use code added for sun6i.
--- arch/arm/include/asm/arch-sunxi/mmc.h | 2 +- drivers/mmc/sunxi_mmc.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-)
arch/arm/include/asm/arch-sunxi/mmc.h +1 -1
@@ -43,7 +43,7 @@ struct sunxi_mmc {u32 chda;/* 0x90 */ u32 cbda;/* 0x94 */ u32 res1[26 ]; -#if defined(CONFIG_SUN6I ) +#if defined(CONFIG_SUN6I ) || defined(CONFIG_SUN8I )u32 res2[64 ];#endif u32 fifo;/* 0x100 (0x200 on sun6i) FIFO access address */
drivers/mmc/sunxi_mmc.c +1 -1
@@ -73,7 +73,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
Signature · 1 line
2.1.1
PATCH 4/9 mmc: sunxi: Add support for sun8i (A23)
Quoted 6 lines · Chen-Yu Tsai
The Allwinner A23 SoC has reset controls like the A31 (sun6i). The FIFO address is also the same as sun6i.
Re-use code added for sun6i.
Signed-off-by Chen-Yu Tsai <[email protected]>
Quoted 31 lines
--- arch/arm/include/asm/arch-sunxi/mmc.h | 2 +- drivers/mmc/sunxi_mmc.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-)arch/arm/include/asm/arch-sunxi/mmc.h +1
-1@@ -43,7 +43,7 @@ struct sunxi_mmc {u32 chda;/* 0x90 */ u32 cbda;/* 0x94 */ u32 res1[26 ]; -#if defined(CONFIG_SUN6I ) +#if defined(CONFIG_SUN6I ) || defined(CONFIG_SUN8I )u32 res2[64 ];#endif u32 fifo;/* 0x100 (0x200 on sun6i) FIFO access address */ drivers/mmc/sunxi_mmc.c +1
-1@@ -73,7 +73,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
PATCH 5/9 ARM: sunxi: Add basic A23 support
In reply to Chen-Yu TsaiThe basic blocks of the A23 are similar to the A31 (sun6i). Re-use sun6i code for initial clock, gpio, and uart setup.
--- arch/arm/Kconfig | 3 +++ arch/arm/cpu/armv7/sunxi/Makefile | 2 ++ arch/arm/cpu/armv7/sunxi/board.c | 3 ++- arch/arm/cpu/armv7/sunxi/cpu_info.c | 2 ++ arch/arm/include/asm/arch-sunxi/clock.h | 2 +- board/sunxi/Kconfig | 9 ++++++++- include/configs/sun8i.h | 23 +++++++++++++++++++++++ 7 files changed, 41 insertions(+), 3 deletions(-) create mode 100644 include/configs/sun8i.h
arch/arm/Kconfig +3 -0
@@ -450,6 +450,9 @@ config TARGET_SUN6I config TARGET_SUN7I bool "Support sun7i" +config TARGET_SUN8I + bool "Support sun8i" + config TARGET_SNOWBALL bool "Support snowball"
arch/arm/cpu/armv7/sunxi/Makefile +2 -0
@@ -12,10 +12,12 @@ obj-y += board.o obj-y += clock.o obj-y += pinmux.o obj-$(CONFIG_SUN6I) += prcm.o +obj-$(CONFIG_SUN8I) += prcm.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 ifndef CONFIG_SPL_BUILD obj-y += cpu_info.o
arch/arm/cpu/armv7/sunxi/board.c +2 -1
@@ -100,7 +100,8 @@ void reset_cpu(ulong addr)/* do some early init */ void s_init (void ) { -#if !definedCONFIG_SPL_BUILD && (definedCONFIG_SUN7I || definedCONFIG_SUN6I ) +#if !definedCONFIG_SPL_BUILD && (definedCONFIG_SUN7I || \ + definedCONFIG_SUN6I || definedCONFIG_SUN8I )/* Enable SMP mode for CPU0, by setting bit 6 of Auxiliary Ctl reg */ asmvolatile ( "mrc p15, 0, r0, c1, c0, 1\n"
arch/arm/cpu/armv7/sunxi/cpu_info.c +2 -0
@@ -27,6 +27,8 @@ int print_cpuinfo(void)puts ("CPU: Allwinner A31 (SUN6I)\n" );#elif definedCONFIG_SUN7I puts ("CPU: Allwinner A20 (SUN7I)\n" ); +#elif definedCONFIG_SUN8I +puts ("CPU: Allwinner A23 (SUN8I)\n" );#else #warning Please update cpu_info.c with correct CPU informationputs ("CPU: SUNXI Family\n" );
arch/arm/include/asm/arch-sunxi/clock.h +1 -1
@@ -15,7 +15,7 @@#define CLK_GATE_CLOSE 0x0/* clock control module regs definition */ -#ifdef CONFIG_SUN6I +#if defined(CONFIG_SUN6I ) || defined(CONFIG_SUN8I )#include <asm/arch/clock_sun6i.h> #else #include <asm/arch/clock_sun4i.h>
board/sunxi/Kconfig +8 -1
@@ -27,7 +27,14 @@ config SYS_CONFIG_NAME endif -if TARGET_SUN4I || TARGET_SUN5I || TARGET_SUN6I || TARGET_SUN7I +if TARGET_SUN8I + +config SYS_CONFIG_NAME + default "sun8i" + +endif + +if TARGET_SUN4I || TARGET_SUN5I || TARGET_SUN6I || TARGET_SUN7I || TARGET_SUN8I config SYS_CPU default "armv7"
include/configs/sun8i.h new file +23 -0
@@ -0,0 +1,23 @@ +/* +* (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# " + +/* +* Include common sunxi configuration where most the settings are +*/ +#include <configs/sunxi-common.h> + +#endif /* __CONFIG_H */
Signature · 1 line
2.1.1
PATCH 5/9 ARM: sunxi: Add basic A23 support
Quoted 2 lines · Chen-Yu Tsai
The basic blocks of the A23 are similar to the A31 (sun6i). Re-use sun6i code for initial clock, gpio, and uart setup.
Do I take it that sun8i is also in the same position wrt DRAM bring up code not existing yet and there therefore being no SPL yet?
Quoted 48 lines
Signed-off-by Chen-Yu Tsai <[email protected]>--- arch/arm/Kconfig | 3 +++ arch/arm/cpu/armv7/sunxi/Makefile | 2 ++ arch/arm/cpu/armv7/sunxi/board.c | 3 ++- arch/arm/cpu/armv7/sunxi/cpu_info.c | 2 ++ arch/arm/include/asm/arch-sunxi/clock.h | 2 +- board/sunxi/Kconfig | 9 ++++++++- include/configs/sun8i.h | 23 +++++++++++++++++++++++ 7 files changed, 41 insertions(+), 3 deletions(-) create mode 100644 include/configs/sun8i.harch/arm/Kconfig +3
-0@@ -450,6 +450,9 @@ config TARGET_SUN6I config TARGET_SUN7I bool "Support sun7i" +config TARGET_SUN8I + bool "Support sun8i" + config TARGET_SNOWBALL bool "Support snowball"arch/arm/cpu/armv7/sunxi/Makefile +2
-0@@ -12,10 +12,12 @@ obj-y += board.o obj-y += clock.o obj-y += pinmux.o obj-$(CONFIG_SUN6I) += prcm.o +obj-$(CONFIG_SUN8I) += prcm.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 ifndef CONFIG_SPL_BUILD obj-y += cpu_info.oarch/arm/cpu/armv7/sunxi/board.c +0
-0
arch/arm/cpu/armv7/sunxi/board.c void reset_cpu(ulong addr) · line 104
Quoted 6 lines
arch/arm/cpu/armv7/sunxi/board.c +2
-1@@ -100,7 +100,8 @@ void reset_cpu(ulong addr)/* do some early init */ void s_init (void ) { -#if !definedCONFIG_SPL_BUILD && (definedCONFIG_SUN7I || definedCONFIG_SUN6I ) +#if !definedCONFIG_SPL_BUILD && (definedCONFIG_SUN7I || \ + definedCONFIG_SUN6I || definedCONFIG_SUN8I )
At some point we should refactor this to use a common Kconfig thing (SUNXI_SMP etc) which the relevant targets select.
Quoted 78 lines
arch/arm/cpu/armv7/sunxi/board.c +0
-0/* Enable SMP mode for CPU0, by setting bit 6 of Auxiliary Ctl reg */ asmvolatile ( "mrc p15, 0, r0, c1, c0, 1\n"arch/arm/cpu/armv7/sunxi/cpu_info.c +2
-0@@ -27,6 +27,8 @@ int print_cpuinfo(void)puts ("CPU: Allwinner A31 (SUN6I)\n" );#elif definedCONFIG_SUN7I puts ("CPU: Allwinner A20 (SUN7I)\n" ); +#elif definedCONFIG_SUN8I +puts ("CPU: Allwinner A23 (SUN8I)\n" );#else #warning Please update cpu_info.c with correct CPU informationputs ("CPU: SUNXI Family\n" );arch/arm/include/asm/arch-sunxi/clock.h +1
-1@@ -15,7 +15,7 @@#define CLK_GATE_CLOSE 0x0/* clock control module regs definition */ -#ifdef CONFIG_SUN6I +#if defined(CONFIG_SUN6I ) || defined(CONFIG_SUN8I )#include <asm/arch/clock_sun6i.h> #else #include <asm/arch/clock_sun4i.h> board/sunxi/Kconfig +8
-1@@ -27,7 +27,14 @@ config SYS_CONFIG_NAME endif -if TARGET_SUN4I || TARGET_SUN5I || TARGET_SUN6I || TARGET_SUN7I +if TARGET_SUN8I + +config SYS_CONFIG_NAME + default "sun8i" + +endif + +if TARGET_SUN4I || TARGET_SUN5I || TARGET_SUN6I || TARGET_SUN7I || TARGET_SUN8I config SYS_CPU default "armv7"include/configs/sun8i.h new file +23
-0@@ -0,0 +1,23 @@ +/* +* (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# " + +/* +* Include common sunxi configuration where most the settings are +*/ +#include <configs/sunxi-common.h> + +#endif /* __CONFIG_H */
PATCH 5/9 ARM: sunxi: Add basic A23 support
Quoted 6 lines · Ian Campbell
Quoted 2 lines · Chen-Yu Tsai
The basic blocks of the A23 are similar to the A31 (sun6i). Re-use sun6i code for initial clock, gpio, and uart setup.
Do I take it that sun8i is also in the same position wrt DRAM bring up code not existing yet and there therefore being no SPL yet?
That is correct.
Quoted 41 lines
Quoted 41 lines
Signed-off-by Chen-Yu Tsai <[email protected]>--- arch/arm/Kconfig | 3 +++ arch/arm/cpu/armv7/sunxi/Makefile | 2 ++ arch/arm/cpu/armv7/sunxi/board.c | 3 ++- arch/arm/cpu/armv7/sunxi/cpu_info.c | 2 ++ arch/arm/include/asm/arch-sunxi/clock.h | 2 +- board/sunxi/Kconfig | 9 ++++++++- include/configs/sun8i.h | 23 +++++++++++++++++++++++ 7 files changed, 41 insertions(+), 3 deletions(-) create mode 100644 include/configs/sun8i.harch/arm/Kconfig +3
-0@@ -450,6 +450,9 @@ config TARGET_SUN6I config TARGET_SUN7I bool "Support sun7i" +config TARGET_SUN8I + bool "Support sun8i" + config TARGET_SNOWBALL bool "Support snowball"arch/arm/cpu/armv7/sunxi/Makefile +2
-0@@ -12,10 +12,12 @@ obj-y += board.o obj-y += clock.o obj-y += pinmux.o obj-$(CONFIG_SUN6I) += prcm.o +obj-$(CONFIG_SUN8I) += prcm.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
Quoted 16 lines
arch/arm/cpu/armv7/sunxi/board.c void reset_cpu(ulong addr) · line 104
Quoted 13 lines
arch/arm/cpu/armv7/sunxi/Makefile +0
-0ifndef CONFIG_SPL_BUILD obj-y += cpu_info.oarch/arm/cpu/armv7/sunxi/board.c +2
-1@@ -100,7 +100,8 @@ void reset_cpu(ulong addr)/* do some early init */ void s_init (void ) { -#if !definedCONFIG_SPL_BUILD && (definedCONFIG_SUN7I || definedCONFIG_SUN6I ) +#if !definedCONFIG_SPL_BUILD && (definedCONFIG_SUN7I || \ + definedCONFIG_SUN6I || definedCONFIG_SUN8I )At some point we should refactor this to use a common
Kconfigthing (SUNXI_SMPetc) which the relevant targets select.
I agree. We can do this as we move further to Kconfig.
ChenYu
Quoted 80 lines
Quoted 78 lines
arch/arm/cpu/armv7/sunxi/board.c +0
-0/* Enable SMP mode for CPU0, by setting bit 6 of Auxiliary Ctl reg */ asmvolatile ( "mrc p15, 0, r0, c1, c0, 1\n"arch/arm/cpu/armv7/sunxi/cpu_info.c +2
-0@@ -27,6 +27,8 @@ int print_cpuinfo(void)puts ("CPU: Allwinner A31 (SUN6I)\n" );#elif definedCONFIG_SUN7I puts ("CPU: Allwinner A20 (SUN7I)\n" ); +#elif definedCONFIG_SUN8I +puts ("CPU: Allwinner A23 (SUN8I)\n" );#else #warning Please update cpu_info.c with correct CPU informationputs ("CPU: SUNXI Family\n" );arch/arm/include/asm/arch-sunxi/clock.h +1
-1@@ -15,7 +15,7 @@#define CLK_GATE_CLOSE 0x0/* clock control module regs definition */ -#ifdef CONFIG_SUN6I +#if defined(CONFIG_SUN6I ) || defined(CONFIG_SUN8I )#include <asm/arch/clock_sun6i.h> #else #include <asm/arch/clock_sun4i.h> board/sunxi/Kconfig +8
-1@@ -27,7 +27,14 @@ config SYS_CONFIG_NAME endif -if TARGET_SUN4I || TARGET_SUN5I || TARGET_SUN6I || TARGET_SUN7I +if TARGET_SUN8I + +config SYS_CONFIG_NAME + default "sun8i" + +endif + +if TARGET_SUN4I || TARGET_SUN5I || TARGET_SUN6I || TARGET_SUN7I || TARGET_SUN8I config SYS_CPU default "armv7"include/configs/sun8i.h new file +23
-0@@ -0,0 +1,23 @@ +/* +* (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# " + +/* +* Include common sunxi configuration where most the settings are +*/ +#include <configs/sunxi-common.h> + +#endif /* __CONFIG_H */
PATCH 5/9 ARM: sunxi: Add basic A23 support
Quoted 9 lines · Chen-Yu Tsai
Quoted 6 lines · Ian Campbell
Quoted 2 lines · Chen-Yu Tsai
The basic blocks of the A23 are similar to the A31 (sun6i). Re-use sun6i code for initial clock, gpio, and uart setup.
Do I take it that sun8i is also in the same position wrt DRAM bring up code not existing yet and there therefore being no SPL yet?
That is correct.
Please could you add a sentence to the commit message.
Apart from that: Acked-by: Ian Campbell <[email protected]>
Quoted 144 lines
Quoted 42 lines
Quoted 42 lines
Signed-off-by Chen-Yu Tsai <[email protected]>--- arch/arm/Kconfig | 3 +++ arch/arm/cpu/armv7/sunxi/Makefile | 2 ++ arch/arm/cpu/armv7/sunxi/board.c | 3 ++- arch/arm/cpu/armv7/sunxi/cpu_info.c | 2 ++ arch/arm/include/asm/arch-sunxi/clock.h | 2 +- board/sunxi/Kconfig | 9 ++++++++- include/configs/sun8i.h | 23 +++++++++++++++++++++++ 7 files changed, 41 insertions(+), 3 deletions(-) create mode 100644 include/configs/sun8i.harch/arm/Kconfig +3
-0@@ -450,6 +450,9 @@ config TARGET_SUN6I config TARGET_SUN7I bool "Support sun7i" +config TARGET_SUN8I + bool "Support sun8i" + config TARGET_SNOWBALL bool "Support snowball"arch/arm/cpu/armv7/sunxi/Makefile +2
-0@@ -12,10 +12,12 @@ obj-y += board.o obj-y += clock.o obj-y += pinmux.o obj-$(CONFIG_SUN6I) += prcm.o +obj-$(CONFIG_SUN8I) += prcm.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.oQuoted 16 lines
arch/arm/cpu/armv7/sunxi/board.c void reset_cpu(ulong addr) · line 104
Quoted 13 lines
arch/arm/cpu/armv7/sunxi/Makefile +0
-0ifndef CONFIG_SPL_BUILD obj-y += cpu_info.oarch/arm/cpu/armv7/sunxi/board.c +2
-1@@ -100,7 +100,8 @@ void reset_cpu(ulong addr)/* do some early init */ void s_init (void ) { -#if !definedCONFIG_SPL_BUILD && (definedCONFIG_SUN7I || definedCONFIG_SUN6I ) +#if !definedCONFIG_SPL_BUILD && (definedCONFIG_SUN7I || \ + definedCONFIG_SUN6I || definedCONFIG_SUN8I )At some point we should refactor this to use a common
Kconfigthing (SUNXI_SMPetc) which the relevant targets select.I agree. We can do this as we move further to
Kconfig.ChenYu
Quoted 80 lines
Quoted 78 lines
arch/arm/cpu/armv7/sunxi/board.c +0
-0/* Enable SMP mode for CPU0, by setting bit 6 of Auxiliary Ctl reg */ asmvolatile ( "mrc p15, 0, r0, c1, c0, 1\n"arch/arm/cpu/armv7/sunxi/cpu_info.c +2
-0@@ -27,6 +27,8 @@ int print_cpuinfo(void)puts ("CPU: Allwinner A31 (SUN6I)\n" );#elif definedCONFIG_SUN7I puts ("CPU: Allwinner A20 (SUN7I)\n" ); +#elif definedCONFIG_SUN8I +puts ("CPU: Allwinner A23 (SUN8I)\n" );#else #warning Please update cpu_info.c with correct CPU informationputs ("CPU: SUNXI Family\n" );arch/arm/include/asm/arch-sunxi/clock.h +1
-1@@ -15,7 +15,7 @@#define CLK_GATE_CLOSE 0x0/* clock control module regs definition */ -#ifdef CONFIG_SUN6I +#if defined(CONFIG_SUN6I ) || defined(CONFIG_SUN8I )#include <asm/arch/clock_sun6i.h> #else #include <asm/arch/clock_sun4i.h> board/sunxi/Kconfig +8
-1@@ -27,7 +27,14 @@ config SYS_CONFIG_NAME endif -if TARGET_SUN4I || TARGET_SUN5I || TARGET_SUN6I || TARGET_SUN7I +if TARGET_SUN8I + +config SYS_CONFIG_NAME + default "sun8i" + +endif + +if TARGET_SUN4I || TARGET_SUN5I || TARGET_SUN6I || TARGET_SUN7I || TARGET_SUN8I config SYS_CPU default "armv7"include/configs/sun8i.h new file +23
-0@@ -0,0 +1,23 @@ +/* +* (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# " + +/* +* Include common sunxi configuration where most the settings are +*/ +#include <configs/sunxi-common.h> + +#endif /* __CONFIG_H */
PATCH 6/9 ARM: sunxi: Add support for R_PIO gpio banks
In reply to Chen-Yu TsaiFrom: Hans de Goede <[email protected]>
The A31, A23 and later SoCs have an extra pin controller, called CPUs_PIO or R_PIO, which handles pin banks L and beyond.
--- arch/arm/include/asm/arch-sunxi/gpio.h | 25 +++++++++++++++++++++++-- 1 file changed, 23 insertions(+), 2 deletions(-)
arch/arm/include/asm/arch-sunxi/gpio.h +23 -2
@@ -10,6 +10,7 @@#define _SUNXI_GPIO_H#include <linux/types.h> +#include <asm/arch/cpu.h> /* * sunxi has 9 banks of gpio, they are:
@@ -29,6 +30,19 @@#define SUNXI_GPIO_I 8#define SUNXI_GPIO_BANKS 9 +/* +* sun6i/sun8i and later SoCs have an additional GPIO controller (R_PIO) +* at a different register offset. +* +* sun6i has 2 banks: +* PL0 - PL8 | PM0 - PM7 +* +* sun8i has 1 bank: +* PL0 - PL11 +*/ +#define SUNXI_GPIO_L 9 +#define SUNXI_GPIO_M 10 +struct sunxi_gpio {u32 cfg[4 ];u32 dat;
@@ -50,8 +64,9 @@ struct sunxi_gpio_reg {struct sunxi_gpio_int gpio_int; }; -#define BANK_TO_GPIO (bank) \ - &((struct sunxi_gpio_reg *)SUNXI_PIO_BASE)->gpio_bank[bank] +#define BANK_TO_GPIO (bank) (((bank) < SUNXI_GPIO_BANKS) ? \ + &((struct sunxi_gpio_reg *)SUNXI_PIO_BASE)->gpio_bank[bank] : \ + &((struct sunxi_gpio_reg *)SUNXI_R_PIO_BASE)->gpio_bank[(bank) - SUNXI_GPIO_BANKS])#define GPIO_BANK (pin) ((pin) >> 5)#define GPIO_NUM (pin) ((pin) & 0x1f)
@@ -75,6 +90,8 @@ struct sunxi_gpio_reg {#define SUNXI_GPIO_G_NR 32#define SUNXI_GPIO_H_NR 32#define SUNXI_GPIO_I_NR 32 +#define SUNXI_GPIO_L_NR 32 +#define SUNXI_GPIO_M_NR 32#define SUNXI_GPIO_NEXT (__gpio) \ ((__gpio##_START) + (__gpio##_NR) + 0)
@@ -89,6 +106,8 @@ enum sunxi_gpio_number {SUNXI_GPIO_G_START =SUNXI_GPIO_NEXT (SUNXI_GPIO_F ),SUNXI_GPIO_H_START =SUNXI_GPIO_NEXT (SUNXI_GPIO_G ),SUNXI_GPIO_I_START =SUNXI_GPIO_NEXT (SUNXI_GPIO_H ), +SUNXI_GPIO_L_START =SUNXI_GPIO_NEXT (SUNXI_GPIO_I ), + SUNXI_GPIO_M_START = SUNXI_GPIO_NEXT(SUNXI_GPIO_L), };/* SUNXI GPIO number definitions */
@@ -101,6 +120,8 @@ enum sunxi_gpio_number {#define SUNXI_GPG (_nr) (SUNXI_GPIO_G_START + (_nr))#define SUNXI_GPH (_nr) (SUNXI_GPIO_H_START + (_nr))#define SUNXI_GPI (_nr) (SUNXI_GPIO_I_START + (_nr)) +#define SUNXI_GPL (_nr) (SUNXI_GPIO_L_START + (_nr)) +#define SUNXI_GPM (_nr) (SUNXI_GPIO_M_START + (_nr))/* GPIO pin function config */ #define SUNXI_GPIO_INPUT 0
Signature · 1 line
2.1.1
PATCH 6/9 ARM: sunxi: Add support for R_PIO gpio banks
Quoted 4 lines · Chen-Yu Tsai
From: Hans de Goede <[email protected]>
The A31, A23 and later SoCs have an extra pin controller, called
CPUs_PIOorR_PIO, which handles pin banks L and beyond.
Does it also have enough space for 9 banks? Since you overlay a struct sunxi_gpio_reg on it which has a gpio_bank[SUNXI_GPIO_BANKS] over it.
SUNXI_GPIO_BANKS is now also confusingly named since it is really "number of banks on the first/original GPIO controller". Eventually someone will use it as the actual total and be very sad.
I think it might be best if we retcon some distinct name onto the original GPIO controller so we can have SUNXIO_GPIO_BLA_BANKS and SUNXI_GPIO_R_BANKS (or even just call them controller 0 and 1 and have SUNXI_GPIO0_BANKS and SUNXI_GPIO1_BANKS, if that's not too confusing)
If we still need SUNXI_GPIO_BANKS after that then it would be the sum of those two.
Quoted 79 lines
Signed-off-by Hans de Goede <[email protected]>[wens at csie.org: expanded commit message][wens at csie.org: add pin bank M and expand comments]Signed-off-by Chen-Yu Tsai <[email protected]>--- arch/arm/include/asm/arch-sunxi/gpio.h | 25 +++++++++++++++++++++++-- 1 file changed, 23 insertions(+), 2 deletions(-)arch/arm/include/asm/arch-sunxi/gpio.h +23
-2@@ -10,6 +10,7 @@#define _SUNXI_GPIO_H#include <linux/types.h> +#include <asm/arch/cpu.h> /* * sunxi has 9 banks of gpio, they are: @@ -29,6 +30,19 @@#define SUNXI_GPIO_I 8#define SUNXI_GPIO_BANKS 9 +/* +* sun6i/sun8i and later SoCs have an additional GPIO controller (R_PIO) +* at a different register offset. +* +* sun6i has 2 banks: +* PL0 - PL8 | PM0 - PM7 +* +* sun8i has 1 bank: +* PL0 - PL11 +*/ +#define SUNXI_GPIO_L 9 +#define SUNXI_GPIO_M 10 +struct sunxi_gpio {u32 cfg[4 ];u32 dat;@@ -50,8 +64,9 @@ struct sunxi_gpio_reg {struct sunxi_gpio_int gpio_int; }; -#define BANK_TO_GPIO (bank) \ - &((struct sunxi_gpio_reg *)SUNXI_PIO_BASE)->gpio_bank[bank] +#define BANK_TO_GPIO (bank) (((bank) < SUNXI_GPIO_BANKS) ? \ + &((struct sunxi_gpio_reg *)SUNXI_PIO_BASE)->gpio_bank[bank] : \ + &((struct sunxi_gpio_reg *)SUNXI_R_PIO_BASE)->gpio_bank[(bank) - SUNXI_GPIO_BANKS])#define GPIO_BANK (pin) ((pin) >> 5)#define GPIO_NUM (pin) ((pin) & 0x1f)@@ -75,6 +90,8 @@ struct sunxi_gpio_reg {#define SUNXI_GPIO_G_NR 32#define SUNXI_GPIO_H_NR 32#define SUNXI_GPIO_I_NR 32 +#define SUNXI_GPIO_L_NR 32 +#define SUNXI_GPIO_M_NR 32#define SUNXI_GPIO_NEXT (__gpio) \ ((__gpio##_START) + (__gpio##_NR) + 0)@@ -89,6 +106,8 @@ enum sunxi_gpio_number {SUNXI_GPIO_G_START =SUNXI_GPIO_NEXT (SUNXI_GPIO_F ),SUNXI_GPIO_H_START =SUNXI_GPIO_NEXT (SUNXI_GPIO_G ),SUNXI_GPIO_I_START =SUNXI_GPIO_NEXT (SUNXI_GPIO_H ), +SUNXI_GPIO_L_START =SUNXI_GPIO_NEXT (SUNXI_GPIO_I ), + SUNXI_GPIO_M_START = SUNXI_GPIO_NEXT(SUNXI_GPIO_L), };/* SUNXI GPIO number definitions */ @@ -101,6 +120,8 @@ enum sunxi_gpio_number {#define SUNXI_GPG (_nr) (SUNXI_GPIO_G_START + (_nr))#define SUNXI_GPH (_nr) (SUNXI_GPIO_H_START + (_nr))#define SUNXI_GPI (_nr) (SUNXI_GPIO_I_START + (_nr)) +#define SUNXI_GPL (_nr) (SUNXI_GPIO_L_START + (_nr)) +#define SUNXI_GPM (_nr) (SUNXI_GPIO_M_START + (_nr))/* GPIO pin function config */ #define SUNXI_GPIO_INPUT 0
PATCH 6/9 ARM: sunxi: Add support for R_PIO gpio banks
Quoted 8 lines · Ian Campbell
Quoted 4 lines · Chen-Yu Tsai
From: Hans de Goede <[email protected]>
The A31, A23 and later SoCs have an extra pin controller, called
CPUs_PIOorR_PIO, which handles pin banks L and beyond.Does it also have enough space for 9 banks? Since you overlay a struct
sunxi_gpio_regon it which has a gpio_bank[SUNXI_GPIO_BANKS] over it.
Yes it does, as seen in the latest A31 manuals released by Allwinner.
Quoted 8 lines
SUNXI_GPIO_BANKSis now also confusingly named since it is really "number of banks on the first/original GPIO controller". Eventually someone will use it as the actual total and be very sad.I think it might be best if we retcon some distinct name onto the original GPIO controller so we can have
SUNXIO_GPIO_BLA_BANKSandSUNXI_GPIO_R_BANKS(or even just call them controller 0 and 1 and haveSUNXI_GPIO0_BANKSandSUNXI_GPIO1_BANKS, if that's not too confusing)
The latest manuals have "CPUx-PORT" and "CPUs-PORT" for the respective chapters. I'm guessing "x" is for 0~3 cores, and s is for standby or something.
Of course it's also confusing that Allwinner's sources use the "R_" prefix for all hardware in that address range, while the datasheet lists the GPIO function names as "s_something".
We might want to make sure the naming is consistent with the kernel as well. (+CC Maxime)
ChenYu
Quoted 84 lines
If we still need
SUNXI_GPIO_BANKSafter that then it would be the sum of those two.Quoted 79 lines
Signed-off-by Hans de Goede <[email protected]>[wens at csie.org: expanded commit message][wens at csie.org: add pin bank M and expand comments]Signed-off-by Chen-Yu Tsai <[email protected]>--- arch/arm/include/asm/arch-sunxi/gpio.h | 25 +++++++++++++++++++++++-- 1 file changed, 23 insertions(+), 2 deletions(-)arch/arm/include/asm/arch-sunxi/gpio.h +23
-2@@ -10,6 +10,7 @@#define _SUNXI_GPIO_H#include <linux/types.h> +#include <asm/arch/cpu.h> /* * sunxi has 9 banks of gpio, they are: @@ -29,6 +30,19 @@#define SUNXI_GPIO_I 8#define SUNXI_GPIO_BANKS 9 +/* +* sun6i/sun8i and later SoCs have an additional GPIO controller (R_PIO) +* at a different register offset. +* +* sun6i has 2 banks: +* PL0 - PL8 | PM0 - PM7 +* +* sun8i has 1 bank: +* PL0 - PL11 +*/ +#define SUNXI_GPIO_L 9 +#define SUNXI_GPIO_M 10 +struct sunxi_gpio {u32 cfg[4 ];u32 dat;@@ -50,8 +64,9 @@ struct sunxi_gpio_reg {struct sunxi_gpio_int gpio_int; }; -#define BANK_TO_GPIO (bank) \ - &((struct sunxi_gpio_reg *)SUNXI_PIO_BASE)->gpio_bank[bank] +#define BANK_TO_GPIO (bank) (((bank) < SUNXI_GPIO_BANKS) ? \ + &((struct sunxi_gpio_reg *)SUNXI_PIO_BASE)->gpio_bank[bank] : \ + &((struct sunxi_gpio_reg *)SUNXI_R_PIO_BASE)->gpio_bank[(bank) - SUNXI_GPIO_BANKS])#define GPIO_BANK (pin) ((pin) >> 5)#define GPIO_NUM (pin) ((pin) & 0x1f)@@ -75,6 +90,8 @@ struct sunxi_gpio_reg {#define SUNXI_GPIO_G_NR 32#define SUNXI_GPIO_H_NR 32#define SUNXI_GPIO_I_NR 32 +#define SUNXI_GPIO_L_NR 32 +#define SUNXI_GPIO_M_NR 32#define SUNXI_GPIO_NEXT (__gpio) \ ((__gpio##_START) + (__gpio##_NR) + 0)@@ -89,6 +106,8 @@ enum sunxi_gpio_number {SUNXI_GPIO_G_START =SUNXI_GPIO_NEXT (SUNXI_GPIO_F ),SUNXI_GPIO_H_START =SUNXI_GPIO_NEXT (SUNXI_GPIO_G ),SUNXI_GPIO_I_START =SUNXI_GPIO_NEXT (SUNXI_GPIO_H ), +SUNXI_GPIO_L_START =SUNXI_GPIO_NEXT (SUNXI_GPIO_I ), + SUNXI_GPIO_M_START = SUNXI_GPIO_NEXT(SUNXI_GPIO_L), };/* SUNXI GPIO number definitions */ @@ -101,6 +120,8 @@ enum sunxi_gpio_number {#define SUNXI_GPG (_nr) (SUNXI_GPIO_G_START + (_nr))#define SUNXI_GPH (_nr) (SUNXI_GPIO_H_START + (_nr))#define SUNXI_GPI (_nr) (SUNXI_GPIO_I_START + (_nr)) +#define SUNXI_GPL (_nr) (SUNXI_GPIO_L_START + (_nr)) +#define SUNXI_GPM (_nr) (SUNXI_GPIO_M_START + (_nr))/* GPIO pin function config */ #define SUNXI_GPIO_INPUT 0
PATCH 6/9 ARM: sunxi: Add support for R_PIO gpio banks
Quoted 25 lines · Chen-Yu Tsai
Quoted 8 lines · Ian Campbell
Quoted 4 lines · Chen-Yu Tsai
From: Hans de Goede <[email protected]>
The A31, A23 and later SoCs have an extra pin controller, called
CPUs_PIOorR_PIO, which handles pin banks L and beyond.Does it also have enough space for 9 banks? Since you overlay a struct
sunxi_gpio_regon it which has a gpio_bank[SUNXI_GPIO_BANKS] over it.Yes it does, as seen in the latest A31 manuals released by Allwinner.
Quoted 8 lines
SUNXI_GPIO_BANKSis now also confusingly named since it is really "number of banks on the first/original GPIO controller". Eventually someone will use it as the actual total and be very sad.I think it might be best if we retcon some distinct name onto the original GPIO controller so we can have
SUNXIO_GPIO_BLA_BANKSandSUNXI_GPIO_R_BANKS(or even just call them controller 0 and 1 and haveSUNXI_GPIO0_BANKSandSUNXI_GPIO1_BANKS, if that's not too confusing)The latest manuals have "CPUx-PORT" and "CPUs-PORT" for the respective chapters. I'm guessing "x" is for 0~3 cores, and s is for standby or something.
Quoted 6 lines
Of course it's also confusing that Allwinner's sources use the "R_" prefix for all hardware in that address range, while the datasheet lists the GPIO function names as "
s_something".We might want to make sure the naming is consistent with the kernel as well. (+CC Maxime)
Good idea, last thing we want to do is introduce yet another "standard" ;-)
Quoted 88 lines
ChenYu
Quoted 84 lines
If we still need
SUNXI_GPIO_BANKSafter that then it would be the sum of those two.Quoted 79 lines
Signed-off-by Hans de Goede <[email protected]>[wens at csie.org: expanded commit message][wens at csie.org: add pin bank M and expand comments]Signed-off-by Chen-Yu Tsai <[email protected]>--- arch/arm/include/asm/arch-sunxi/gpio.h | 25 +++++++++++++++++++++++-- 1 file changed, 23 insertions(+), 2 deletions(-)arch/arm/include/asm/arch-sunxi/gpio.h +23
-2@@ -10,6 +10,7 @@#define _SUNXI_GPIO_H#include <linux/types.h> +#include <asm/arch/cpu.h> /* * sunxi has 9 banks of gpio, they are: @@ -29,6 +30,19 @@#define SUNXI_GPIO_I 8#define SUNXI_GPIO_BANKS 9 +/* +* sun6i/sun8i and later SoCs have an additional GPIO controller (R_PIO) +* at a different register offset. +* +* sun6i has 2 banks: +* PL0 - PL8 | PM0 - PM7 +* +* sun8i has 1 bank: +* PL0 - PL11 +*/ +#define SUNXI_GPIO_L 9 +#define SUNXI_GPIO_M 10 +struct sunxi_gpio {u32 cfg[4 ];u32 dat;@@ -50,8 +64,9 @@ struct sunxi_gpio_reg {struct sunxi_gpio_int gpio_int; }; -#define BANK_TO_GPIO (bank) \ - &((struct sunxi_gpio_reg *)SUNXI_PIO_BASE)->gpio_bank[bank] +#define BANK_TO_GPIO (bank) (((bank) < SUNXI_GPIO_BANKS) ? \ + &((struct sunxi_gpio_reg *)SUNXI_PIO_BASE)->gpio_bank[bank] : \ + &((struct sunxi_gpio_reg *)SUNXI_R_PIO_BASE)->gpio_bank[(bank) - SUNXI_GPIO_BANKS])#define GPIO_BANK (pin) ((pin) >> 5)#define GPIO_NUM (pin) ((pin) & 0x1f)@@ -75,6 +90,8 @@ struct sunxi_gpio_reg {#define SUNXI_GPIO_G_NR 32#define SUNXI_GPIO_H_NR 32#define SUNXI_GPIO_I_NR 32 +#define SUNXI_GPIO_L_NR 32 +#define SUNXI_GPIO_M_NR 32#define SUNXI_GPIO_NEXT (__gpio) \ ((__gpio##_START) + (__gpio##_NR) + 0)@@ -89,6 +106,8 @@ enum sunxi_gpio_number {SUNXI_GPIO_G_START =SUNXI_GPIO_NEXT (SUNXI_GPIO_F ),SUNXI_GPIO_H_START =SUNXI_GPIO_NEXT (SUNXI_GPIO_G ),SUNXI_GPIO_I_START =SUNXI_GPIO_NEXT (SUNXI_GPIO_H ), +SUNXI_GPIO_L_START =SUNXI_GPIO_NEXT (SUNXI_GPIO_I ), + SUNXI_GPIO_M_START = SUNXI_GPIO_NEXT(SUNXI_GPIO_L), };/* SUNXI GPIO number definitions */ @@ -101,6 +120,8 @@ enum sunxi_gpio_number {#define SUNXI_GPG (_nr) (SUNXI_GPIO_G_START + (_nr))#define SUNXI_GPH (_nr) (SUNXI_GPIO_H_START + (_nr))#define SUNXI_GPI (_nr) (SUNXI_GPIO_I_START + (_nr)) +#define SUNXI_GPL (_nr) (SUNXI_GPIO_L_START + (_nr)) +#define SUNXI_GPM (_nr) (SUNXI_GPIO_M_START + (_nr))/* GPIO pin function config */ #define SUNXI_GPIO_INPUT 0
PATCH 6/9 ARM: sunxi: Add support for R_PIO gpio banks
In reply to Chen-Yu TsaiQuoted 16 lines · Chen-Yu Tsai
Quoted 8 lines · Ian Campbell
Quoted 4 lines · Chen-Yu Tsai
From: Hans de Goede <[email protected]>
The A31, A23 and later SoCs have an extra pin controller, called
CPUs_PIOorR_PIO, which handles pin banks L and beyond.Does it also have enough space for 9 banks? Since you overlay a struct
sunxi_gpio_regon it which has a gpio_bank[SUNXI_GPIO_BANKS] over it.Yes it does, as seen in the latest A31 manuals released by Allwinner.
Quoted 4 lines
SUNXI_GPIO_BANKSis now also confusingly named since it is really "number of banks on the first/original GPIO controller". Eventually someone will use it as the actual total and be very sad.
Quoted 8 lines
Quoted 4 lines
I think it might be best if we retcon some distinct name onto the original GPIO controller so we can have
SUNXIO_GPIO_BLA_BANKSandSUNXI_GPIO_R_BANKS(or even just call them controller 0 and 1 and haveSUNXI_GPIO0_BANKSandSUNXI_GPIO1_BANKS, if that's not too confusing)The latest manuals have "CPUx-PORT" and "CPUs-PORT" for the respective chapters. I'm guessing "x" is for 0~3 cores, and s is for standby or something.
iirc, it was meant for "special".
Quoted 4 lines
Of course it's also confusing that Allwinner's sources use the "R_" prefix for all hardware in that address range, while the datasheet lists the GPIO function names as "
s_something".
We use the same pin convention than in the datasheet in mainline (but starting from PL for the special pins). And it's true that we do prefix all the functions by s_, once again, just like the datasheet does.
The fact that it comes from a different controller is only expressed by where the pinctrl pins node is defined in the DT.
Maxime
Signature · 10 lines
Maxime Ripard, Free Electrons Embedded Linux, Kernel and Android engineering http://free-electrons.com -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 819 bytes Desc: Digital signature URL: <http://lists.denx.de/pipermail/u-boot/attachments/20141013/c19ee7f3/attachment.pgp>
[U-Boot] [linux-sunxi] Re: [PATCH 6/9] ARM: sunxi: Add support for R_PIO gpio banks
Hi Ian,
Quoted 22 lines · Maxime Ripard
Quoted 21 lines · Chen-Yu Tsai
Quoted 8 lines · Ian Campbell
Quoted 4 lines · Chen-Yu Tsai
From: Hans de Goede <[email protected]>
The A31, A23 and later SoCs have an extra pin controller, called
CPUs_PIOorR_PIO, which handles pin banks L and beyond.Does it also have enough space for 9 banks? Since you overlay a struct
sunxi_gpio_regon it which has a gpio_bank[SUNXI_GPIO_BANKS] over it.Yes it does, as seen in the latest A31 manuals released by Allwinner.
Quoted 8 lines
SUNXI_GPIO_BANKSis now also confusingly named since it is really "number of banks on the first/original GPIO controller". Eventually someone will use it as the actual total and be very sad.I think it might be best if we retcon some distinct name onto the original GPIO controller so we can have
SUNXIO_GPIO_BLA_BANKSandSUNXI_GPIO_R_BANKS(or even just call them controller 0 and 1 and haveSUNXI_GPIO0_BANKSandSUNXI_GPIO1_BANKS, if that's not too confusing)
Quoted 5 lines
Quoted 3 lines
The latest manuals have "CPUx-PORT" and "CPUs-PORT" for the respective chapters. I'm guessing "x" is for 0~3 cores, and s is for standby or something.
iirc, it was meant for "special".
I'd like to keep it as SUNXI_GPIO_BANKS if possible. The GPIO and R_GPIO prefixes match what we see in Allwinner's sources and what we use in the mainline kernel.
The comment section above it could be made clearer about it.
Also that number would be bumped up for A80, which has pin bank J. I will change some of the R_PIO code to check/use the starting pin bank L number instead of checking against SUNXI_GPIO_BANKS. Wonder why I didn't do it before...
Quoted 11 lines
Quoted 3 lines
Of course it's also confusing that Allwinner's sources use the "R_" prefix for all hardware in that address range, while the datasheet lists the GPIO function names as "
s_something".We use the same pin convention than in the datasheet in mainline (but starting from PL for the special pins). And it's true that we do prefix all the functions by s_, once again, just like the datasheet does.
The fact that it comes from a different controller is only expressed by where the pinctrl pins node is defined in the DT.
I'm a bit undecided about how we should name the pin definitions. In the kernel, we named the function s_uart, but the pinconf node r_uart.
In u-boot there isn't this separation. I'm wondering which would be easier to understand and relate to the underlying peripheral. At the moment I prefer R_UART.
ChenYu
[U-Boot] [linux-sunxi] Re: [PATCH 6/9] ARM: sunxi: Add support for R_PIO gpio banks
Quoted 30 lines · Chen-Yu Tsai
Hi Ian,
Quoted 26 lines · Maxime Ripard
Quoted 24 lines · Chen-Yu Tsai
Quoted 8 lines · Ian Campbell
Quoted 4 lines · Chen-Yu Tsai
From: Hans de Goede <[email protected]>
The A31, A23 and later SoCs have an extra pin controller, called
CPUs_PIOorR_PIO, which handles pin banks L and beyond.Does it also have enough space for 9 banks? Since you overlay a struct
sunxi_gpio_regon it which has a gpio_bank[SUNXI_GPIO_BANKS] over it.Yes it does, as seen in the latest A31 manuals released by Allwinner.
Quoted 8 lines
SUNXI_GPIO_BANKSis now also confusingly named since it is really "number of banks on the first/original GPIO controller". Eventually someone will use it as the actual total and be very sad.I think it might be best if we retcon some distinct name onto the original GPIO controller so we can have
SUNXIO_GPIO_BLA_BANKSandSUNXI_GPIO_R_BANKS(or even just call them controller 0 and 1 and haveSUNXI_GPIO0_BANKSandSUNXI_GPIO1_BANKS, if that's not too confusing)The latest manuals have "CPUx-PORT" and "CPUs-PORT" for the respective chapters. I'm guessing "x" is for 0~3 cores, and s is for standby or something.
Quoted 5 lines
Quoted 1 line
iirc, it was meant for "special".
I'd like to keep it as
SUNXI_GPIO_BANKSif possible. The GPIO andR_GPIOprefixes match what we see in Allwinner's sources and what we use in the mainline kernel.
OK, matching the mainline kernel is a sound plan.
Quoted 6 lines
The comment section above it could be made clearer about it.
Also that number would be bumped up for A80, which has pin bank J. I will change some of the
R_PIOcode to check/use the starting pin bank L number instead of checking againstSUNXI_GPIO_BANKS. Wonder why I didn't do it before...
Sounds good.
Quoted 12 lines
Quoted 11 lines
Quoted 3 lines
Of course it's also confusing that Allwinner's sources use the "R_" prefix for all hardware in that address range, while the datasheet lists the GPIO function names as "
s_something".We use the same pin convention than in the datasheet in mainline (but starting from PL for the special pins). And it's true that we do prefix all the functions by s_, once again, just like the datasheet does.
The fact that it comes from a different controller is only expressed by where the pinctrl pins node is defined in the DT.
Quoted 7 lines
I'm a bit undecided about how we should name the pin definitions. In the kernel, we named the function
s_uart, but the pinconf noder_uart.In u-boot there isn't this separation. I'm wondering which would be easier to understand and relate to the underlying peripheral. At the moment I prefer
R_UART.
Either is fine for me.
Ian.
PATCH 7/9 ARM: sunxi: Allow specifying module in prcm apb0 init function
In reply to Chen-Yu TsaiThe prcm apb0 controls multiple modules. Allow specifying which modules to enable clocks and de-assert resets so the function can be reused.
--- arch/arm/cpu/armv7/sunxi/prcm.c | 12 +++++++----- arch/arm/include/asm/arch-sunxi/prcm.h | 2 +- 2 files changed, 8 insertions(+), 6 deletions(-)
arch/arm/cpu/armv7/sunxi/prcm.c +7 -5
@@ -21,13 +21,15 @@#include <asm/arch/prcm.h> #include <asm/arch/sys_proto.h> -void prcm_init_apb0 (void ) +/* APB0 clock gate and reset bit offsets are the same. */ +void prcm_apb0_enable (u32 flags) {struct sunxi_prcm_reg *prcm = (struct sunxi_prcm_reg *)SUNXI_PRCM_BASE ; -setbits_le32 (&prcm->apb0_gate,PRCM_APB0_GATE_P2WI | -PRCM_APB0_GATE_PIO ); -setbits_le32 (&prcm->apb0_reset,PRCM_APB0_RESET_P2WI | -PRCM_APB0_RESET_PIO ); +/* open the clock for module */ +setbits_le32 (&prcm->apb0_gate, flags); + +/* deassert reset for module */ +setbits_le32 (&prcm->apb0_reset, flags); }
arch/arm/include/asm/arch-sunxi/prcm.h +1 -1
@@ -233,6 +233,6 @@ struct sunxi_prcm_reg {u32 dram_tst;/* 0x190 */ }; -void prcm_init_apb0 (void ); +void prcm_apb0_enable (u32 flags);#endif /* __ASSEMBLY__ */ #endif /* _PRCM_H */
Signature · 1 line
2.1.1
PATCH 7/9 ARM: sunxi: Allow specifying module in prcm apb0 init function
Quoted 3 lines · Chen-Yu Tsai
The prcm apb0 controls multiple modules. Allow specifying which modules to enable clocks and de-assert resets so the function can be reused.
How come this isn't actually called on sun6i?
(naughty of me not to notice this when it was submitted!)
Is it going to be called by anything in this series? I have a feeling this is a precursor for SPL which should have been left out of the sun6i series, but oh well what's done is done.
Without a caller it's hard to make a judgement call on parameters vs #ifdef in the function, although my inclination would generally be towards parameters, if there's just going to be an ifdef at the call site instead it's not really buying us much.
Quoted 11 lines
Signed-off-by Chen-Yu Tsai <[email protected]>--- arch/arm/cpu/armv7/sunxi/prcm.c | 12 +++++++----- arch/arm/include/asm/arch-sunxi/prcm.h | 2 +- 2 files changed, 8 insertions(+), 6 deletions(-)arch/arm/cpu/armv7/sunxi/prcm.c +0
-0
arch/arm/cpu/armv7/sunxi/prcm.c line 24
Quoted 5 lines
arch/arm/cpu/armv7/sunxi/prcm.c +1
-1@@ -21,13 +21,15 @@#include <asm/arch/prcm.h> #include <asm/arch/sys_proto.h> -void prcm_init_apb0 (void ) +/* APB0 clock gate and reset bit offsets are the same. */
Is this absolutely guaranteed?
Quoted 27 lines
arch/arm/cpu/armv7/sunxi/prcm.c +6
-4+void prcm_apb0_enable (u32 flags) {struct sunxi_prcm_reg *prcm = (struct sunxi_prcm_reg *)SUNXI_PRCM_BASE ; -setbits_le32 (&prcm->apb0_gate,PRCM_APB0_GATE_P2WI | -PRCM_APB0_GATE_PIO ); -setbits_le32 (&prcm->apb0_reset,PRCM_APB0_RESET_P2WI | -PRCM_APB0_RESET_PIO ); +/* open the clock for module */ +setbits_le32 (&prcm->apb0_gate, flags); + +/* deassert reset for module */ +setbits_le32 (&prcm->apb0_reset, flags); }arch/arm/include/asm/arch-sunxi/prcm.h +1
-1@@ -233,6 +233,6 @@ struct sunxi_prcm_reg {u32 dram_tst;/* 0x190 */ }; -void prcm_init_apb0 (void ); +void prcm_apb0_enable (u32 flags);#endif /* __ASSEMBLY__ */ #endif /* _PRCM_H */
PATCH 7/9 ARM: sunxi: Allow specifying module in prcm apb0 init function
Quoted 9 lines · Ian Campbell
Quoted 3 lines · Chen-Yu Tsai
The prcm apb0 controls multiple modules. Allow specifying which modules to enable clocks and de-assert resets so the function can be reused.
How come this isn't actually called on sun6i?
(naughty of me not to notice this when it was submitted!)
Quoted 8 lines
Is it going to be called by anything in this series? I have a feeling this is a precursor for SPL which should have been left out of the sun6i series, but oh well what's done is done.
Without a caller it's hard to make a judgement call on parameters vs #ifdef in the function, although my inclination would generally be towards parameters, if there's just going to be an ifdef at the call site instead it's not really buying us much.
I should have read the next patch more carefully before commenting...
Quoted 1 line
Quoted 1 line
Signed-off-by Chen-Yu Tsai <[email protected]>
Quoted 52 lines
Quoted 10 lines
--- arch/arm/cpu/armv7/sunxi/prcm.c | 12 +++++++----- arch/arm/include/asm/arch-sunxi/prcm.h | 2 +- 2 files changed, 8 insertions(+), 6 deletions(-)arch/arm/cpu/armv7/sunxi/prcm.c +0
-0arch/arm/cpu/armv7/sunxi/prcm.c line 24
Quoted 5 lines
arch/arm/cpu/armv7/sunxi/prcm.c +1
-1@@ -21,13 +21,15 @@#include <asm/arch/prcm.h> #include <asm/arch/sys_proto.h> -void prcm_init_apb0 (void ) +/* APB0 clock gate and reset bit offsets are the same. */ Is this absolutely guaranteed?
Quoted 20 lines
arch/arm/cpu/armv7/sunxi/prcm.c +6
-4+void prcm_apb0_enable (u32 flags) {struct sunxi_prcm_reg *prcm = (struct sunxi_prcm_reg *)SUNXI_PRCM_BASE ; -setbits_le32 (&prcm->apb0_gate,PRCM_APB0_GATE_P2WI | -PRCM_APB0_GATE_PIO ); -setbits_le32 (&prcm->apb0_reset,PRCM_APB0_RESET_P2WI | -PRCM_APB0_RESET_PIO ); +/* open the clock for module */ +setbits_le32 (&prcm->apb0_gate, flags); + +/* deassert reset for module */ +setbits_le32 (&prcm->apb0_reset, flags); }arch/arm/include/asm/arch-sunxi/prcm.h +0
-0arch/arm/include/asm/arch-sunxi/prcm.h struct sunxi_prcm_reg { · line 238
Quoted 7 lines
arch/arm/include/asm/arch-sunxi/prcm.h +1
-1@@ -233,6 +233,6 @@ struct sunxi_prcm_reg {u32 dram_tst;/* 0x190 */ }; -void prcm_init_apb0 (void ); +void prcm_apb0_enable (u32 flags);#endif /* __ASSEMBLY__ */ #endif /* _PRCM_H */ _______________________________________________
U-Boot mailing list
U-Boot at lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot
PATCH 7/9 ARM: sunxi: Allow specifying module in prcm apb0 init function
Quoted 6 lines · Ian Campbell
Quoted 5 lines · Ian Campbell
Quoted 3 lines · Chen-Yu Tsai
The prcm apb0 controls multiple modules. Allow specifying which modules to enable clocks and de-assert resets so the function can be reused.
Quoted 7 lines
Quoted 7 lines
How come this isn't actually called on sun6i?
(naughty of me not to notice this when it was submitted!)
Is it going to be called by anything in this series? I have a feeling this is a precursor for SPL which should have been left out of the sun6i series, but oh well what's done is done.
This will be used by P2WI and PMIC stuff. (series WiP)
Quoted 11 lines
Quoted 5 lines
Without a caller it's hard to make a judgement call on parameters vs #ifdef in the function, although my inclination would generally be towards parameters, if there's just going to be an ifdef at the call site instead it's not really buying us much.
I should have read the next patch more carefully before commenting...
Quoted 1 line
Quoted 1 line
Signed-off-by Chen-Yu Tsai <[email protected]>Acked-by Ian Campbell <[email protected]>
Thanks.
Quoted 54 lines
Quoted 52 lines
Quoted 10 lines
--- arch/arm/cpu/armv7/sunxi/prcm.c | 12 +++++++----- arch/arm/include/asm/arch-sunxi/prcm.h | 2 +- 2 files changed, 8 insertions(+), 6 deletions(-)arch/arm/cpu/armv7/sunxi/prcm.c +0
-0arch/arm/cpu/armv7/sunxi/prcm.c line 24
Quoted 5 lines
arch/arm/cpu/armv7/sunxi/prcm.c +1
-1@@ -21,13 +21,15 @@#include <asm/arch/prcm.h> #include <asm/arch/sys_proto.h> -void prcm_init_apb0 (void ) +/* APB0 clock gate and reset bit offsets are the same. */ Is this absolutely guaranteed?
Quoted 20 lines
arch/arm/cpu/armv7/sunxi/prcm.c +6
-4+void prcm_apb0_enable (u32 flags) {struct sunxi_prcm_reg *prcm = (struct sunxi_prcm_reg *)SUNXI_PRCM_BASE ; -setbits_le32 (&prcm->apb0_gate,PRCM_APB0_GATE_P2WI | -PRCM_APB0_GATE_PIO ); -setbits_le32 (&prcm->apb0_reset,PRCM_APB0_RESET_P2WI | -PRCM_APB0_RESET_PIO ); +/* open the clock for module */ +setbits_le32 (&prcm->apb0_gate, flags); + +/* deassert reset for module */ +setbits_le32 (&prcm->apb0_reset, flags); }arch/arm/include/asm/arch-sunxi/prcm.h +0
-0arch/arm/include/asm/arch-sunxi/prcm.h struct sunxi_prcm_reg { · line 238
Quoted 7 lines
arch/arm/include/asm/arch-sunxi/prcm.h +1
-1@@ -233,6 +233,6 @@ struct sunxi_prcm_reg {u32 dram_tst;/* 0x190 */ }; -void prcm_init_apb0 (void ); +void prcm_apb0_enable (u32 flags);#endif /* __ASSEMBLY__ */ #endif /* _PRCM_H */ _______________________________________________
U-Boot mailing list
U-Boot at lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot
PATCH 8/9 ARM: sunxi: Add support for using R_UART as console
In reply to Chen-Yu TsaiThe A23 only has UART0 muxed with MMC0. Some of the boards we encountered expose R_UART as a set of pads.
Add support for R_UART so we can have a console while using mmc.
--- arch/arm/cpu/armv7/sunxi/board.c | 4 ++++ arch/arm/cpu/armv7/sunxi/clock_sun6i.c | 6 ++++++ arch/arm/include/asm/arch-sunxi/cpu.h | 1 + arch/arm/include/asm/arch-sunxi/gpio.h | 3 +++ include/configs/sunxi-common.h | 1 + 5 files changed, 15 insertions(+)
arch/arm/cpu/armv7/sunxi/board.c +4 -0
@@ -75,6 +75,10 @@ int gpio_init(void)sunxi_gpio_set_cfgpin (SUNXI_GPG (3 ),SUN5I_GPG3_UART1_TX );sunxi_gpio_set_cfgpin (SUNXI_GPG (4 ),SUN5I_GPG4_UART1_RX );sunxi_gpio_set_pull (SUNXI_GPG (4 ),SUNXI_GPIO_PULL_UP ); +#elif CONFIG_CONS_INDEX ==5 && defined(CONFIG_SUN8I ) +sunxi_gpio_set_cfgpin (SUNXI_GPL (2 ),SUN8I_GPL2_R_UART_TX ); +sunxi_gpio_set_cfgpin (SUNXI_GPL (3 ),SUN8I_GPL3_R_UART_RX ); +sunxi_gpio_set_pull (SUNXI_GPL (3 ),SUNXI_GPIO_PULL_UP );#else #error Unsupported console port number. Please fix pin mux settings in board.c#endif
arch/arm/cpu/armv7/sunxi/clock_sun6i.c +6 -0
@@ -13,6 +13,7 @@#include <common.h> #include <asm/io.h> #include <asm/arch/clock.h> +#include <asm/arch/prcm.h> #include <asm/arch/sys_proto.h> void clock_init_uart (void )
@@ -20,6 +21,7 @@ void clock_init_uart(void)struct sunxi_ccm_reg *const ccm = (struct sunxi_ccm_reg *)SUNXI_CCM_BASE ; +#if CONFIG_CONS_INDEX <5 /* uart clock source is apb2 */ writel(APB2_CLK_SRC_OSC24M| APB2_CLK_RATE_N_1|
@@ -35,6 +37,10 @@ void clock_init_uart(void)setbits_le32 (&ccm->apb2_reset_cfg,1 << (APB2_RESET_UART_SHIFT +CONFIG_CONS_INDEX -1 )); +#else +/* enable R_PIO and R_UART clocks, and de-assert resets */ +prcm_apb0_enable (PRCM_APB0_GATE_PIO |PRCM_APB0_GATE_UART ); +#endif /* Dup with clock_init_safe(), drop once sun6i SPL support lands */ writel (PLL6_CFG_DEFAULT , &ccm->pll6_cfg);
arch/arm/include/asm/arch-sunxi/cpu.h +1 -0
@@ -111,6 +111,7 @@#define SUNXI_AVG_BASE 0x01ea0000#define SUNXI_PRCM_BASE 0x01f01400 +#define SUNXI_R_UART_BASE 0x01f02800#define SUNXI_R_PIO_BASE 0x01f02c00#define SUNXI_P2WI_BASE 0x01f03400
arch/arm/include/asm/arch-sunxi/gpio.h +3 -0
@@ -164,6 +164,9 @@ enum sunxi_gpio_number {#define SUN4I_GPI4_SDC3 2 +#define SUN8I_GPL2_R_UART_TX 2 +#define SUN8I_GPL3_R_UART_RX 2 +/* GPIO pin pull-up/down config */ #define SUNXI_GPIO_PULL_DISABLE 0#define SUNXI_GPIO_PULL_UP 1
include/configs/sunxi-common.h +1 -0
@@ -42,6 +42,7 @@#define CONFIG_SYS_NS16550_COM2 SUNXI_UART1_BASE#define CONFIG_SYS_NS16550_COM3 SUNXI_UART2_BASE#define CONFIG_SYS_NS16550_COM4 SUNXI_UART3_BASE +#define CONFIG_SYS_NS16550_COM5 SUNXI_R_UART_BASE/* DRAM Base */ #define CONFIG_SYS_SDRAM_BASE 0x40000000
Signature · 1 line
2.1.1
PATCH 8/9 ARM: sunxi: Add support for using R_UART as console
Quoted 4 lines · Chen-Yu Tsai
The A23 only has UART0 muxed with MMC0. Some of the boards we encountered expose
R_UARTas a set of pads.Add support for
R_UARTso we can have a console while using mmc.
I suppose R_UART is the h/w doc name. UARTR would fit the code better but I suppose sticking with the h/w names is fine.
CONFIG_CONS_INDEX is also getting a bit out of hand, eventually we should make it a Kconfig choice option.
Quoted 1 line
Signed-off-by Chen-Yu Tsai <[email protected]>
Quoted 92 lines
--- arch/arm/cpu/armv7/sunxi/board.c | 4 ++++ arch/arm/cpu/armv7/sunxi/clock_sun6i.c | 6 ++++++ arch/arm/include/asm/arch-sunxi/cpu.h | 1 + arch/arm/include/asm/arch-sunxi/gpio.h | 3 +++ include/configs/sunxi-common.h | 1 + 5 files changed, 15 insertions(+)arch/arm/cpu/armv7/sunxi/board.c +4
-0@@ -75,6 +75,10 @@ int gpio_init(void)sunxi_gpio_set_cfgpin (SUNXI_GPG (3 ),SUN5I_GPG3_UART1_TX );sunxi_gpio_set_cfgpin (SUNXI_GPG (4 ),SUN5I_GPG4_UART1_RX );sunxi_gpio_set_pull (SUNXI_GPG (4 ),SUNXI_GPIO_PULL_UP ); +#elif CONFIG_CONS_INDEX ==5 && defined(CONFIG_SUN8I ) +sunxi_gpio_set_cfgpin (SUNXI_GPL (2 ),SUN8I_GPL2_R_UART_TX ); +sunxi_gpio_set_cfgpin (SUNXI_GPL (3 ),SUN8I_GPL3_R_UART_RX ); +sunxi_gpio_set_pull (SUNXI_GPL (3 ),SUNXI_GPIO_PULL_UP );#else #error Unsupported console port number. Please fix pin mux settings in board.c#endif arch/arm/cpu/armv7/sunxi/clock_sun6i.c +6
-0@@ -13,6 +13,7 @@#include <common.h> #include <asm/io.h> #include <asm/arch/clock.h> +#include <asm/arch/prcm.h> #include <asm/arch/sys_proto.h> void clock_init_uart (void )@@ -20,6 +21,7 @@ void clock_init_uart(void)struct sunxi_ccm_reg *const ccm = (struct sunxi_ccm_reg *)SUNXI_CCM_BASE ; +#if CONFIG_CONS_INDEX <5 /* uart clock source is apb2 */ writel(APB2_CLK_SRC_OSC24M| APB2_CLK_RATE_N_1|@@ -35,6 +37,10 @@ void clock_init_uart(void)setbits_le32 (&ccm->apb2_reset_cfg,1 << (APB2_RESET_UART_SHIFT +CONFIG_CONS_INDEX -1 )); +#else +/* enable R_PIO and R_UART clocks, and de-assert resets */ +prcm_apb0_enable (PRCM_APB0_GATE_PIO |PRCM_APB0_GATE_UART ); +#endif /* Dup with clock_init_safe(), drop once sun6i SPL support lands */ writel (PLL6_CFG_DEFAULT , &ccm->pll6_cfg);arch/arm/include/asm/arch-sunxi/cpu.h +1
-0@@ -111,6 +111,7 @@#define SUNXI_AVG_BASE 0x01ea0000#define SUNXI_PRCM_BASE 0x01f01400 +#define SUNXI_R_UART_BASE 0x01f02800#define SUNXI_R_PIO_BASE 0x01f02c00#define SUNXI_P2WI_BASE 0x01f03400arch/arm/include/asm/arch-sunxi/gpio.h +3
-0@@ -164,6 +164,9 @@ enum sunxi_gpio_number {#define SUN4I_GPI4_SDC3 2 +#define SUN8I_GPL2_R_UART_TX 2 +#define SUN8I_GPL3_R_UART_RX 2 +/* GPIO pin pull-up/down config */ #define SUNXI_GPIO_PULL_DISABLE 0#define SUNXI_GPIO_PULL_UP 1include/configs/sunxi-common.h +1
-0@@ -42,6 +42,7 @@#define CONFIG_SYS_NS16550_COM2 SUNXI_UART1_BASE#define CONFIG_SYS_NS16550_COM3 SUNXI_UART2_BASE#define CONFIG_SYS_NS16550_COM4 SUNXI_UART3_BASE +#define CONFIG_SYS_NS16550_COM5 SUNXI_R_UART_BASE/* DRAM Base */ #define CONFIG_SYS_SDRAM_BASE 0x40000000
PATCH 9/9 ARM: sunxi: Add Ippo-q8h-v5 A23 tablet board defconfig
In reply to Chen-Yu TsaiIppo q8h is a series of A23 tablet boards. This defconfig is for v5 of these boards, though for u-boot purposes they are mostly the same.
See: http://linux-sunxi.org/Ippo_q8h
--- board/sunxi/MAINTAINERS | 5 +++++ configs/Ippo_q8h_defconfig | 4 ++++ 2 files changed, 9 insertions(+) create mode 100644 configs/Ippo_q8h_defconfig
board/sunxi/MAINTAINERS +5 -0
@@ -50,3 +50,8 @@ COLOMBUS BOARD M: Maxime Ripard <[email protected]> S: Maintained F: configs/Colombus_defconfig + +IPPO-Q8H-V5 BOARD +M: CHen-Yu Tsai <[email protected]> +S: Maintained +F: configs/Ippo_q8h_v5_defconfig
configs/Ippo_q8h_defconfig new file +4 -0
@@ -0,0 +1,4 @@ +CONFIG_SYS_EXTRA_OPTIONS="IPPO_Q8H_V5,CONS_INDEX=5" +CONFIG_ARM=y +CONFIG_TARGET_SUN8I=y +CONFIG_DEFAULT_DEVICE_TREE="sun8i-a23-ippo-q8h-v5.dtb"
Signature · 1 line
2.1.1
PATCH 9/9 ARM: sunxi: Add Ippo-q8h-v5 A23 tablet board defconfig
Quoted 3 lines · Chen-Yu Tsai
Ippo q8h is a series of A23 tablet boards. This defconfig is for v5 of these boards, though for u-boot purposes they are mostly the same.
Any differences worth mentioning?
Quoted 1 line
BTW, this says "The port is then used by the OpenRISC core to dump debug messages. Whether this port can be used by the primary system is still unknown." but your previous patches suggest this is now known?
Quoted 1 line
Signed-off-by Chen-Yu Tsai <[email protected]>
Quoted 29 lines
--- board/sunxi/MAINTAINERS | 5 +++++ configs/Ippo_q8h_defconfig | 4 ++++ 2 files changed, 9 insertions(+) create mode 100644 configs/Ippo_q8h_defconfigboard/sunxi/MAINTAINERS +5
-0@@ -50,3 +50,8 @@ COLOMBUS BOARD M: Maxime Ripard <[email protected]> S: Maintained F: configs/Colombus_defconfig + +IPPO-Q8H-V5 BOARD +M: CHen-Yu Tsai <[email protected]> +S: Maintained +F: configs/Ippo_q8h_v5_defconfigconfigs/Ippo_q8h_defconfig new file +4
-0@@ -0,0 +1,4 @@ +CONFIG_SYS_EXTRA_OPTIONS="IPPO_Q8H_V5,CONS_INDEX=5" +CONFIG_ARM=y +CONFIG_TARGET_SUN8I=y +CONFIG_DEFAULT_DEVICE_TREE="sun8i-a23-ippo-q8h-v5.dtb"
PATCH 9/9 ARM: sunxi: Add Ippo-q8h-v5 A23 tablet board defconfig
Quoted 6 lines · Ian Campbell
Quoted 3 lines · Chen-Yu Tsai
Ippo q8h is a series of A23 tablet boards. This defconfig is for v5 of these boards, though for u-boot purposes they are mostly the same.
Any differences worth mentioning?
AFAIK, the boards have different wifi modules, which u-boot doesn't use anyway.
Quoted 5 lines
Quoted 1 line
BTW, this says "The port is then used by the OpenRISC core to dump debug messages. Whether this port can be used by the primary system is still unknown." but your previous patches suggest this is now known?
Updated. This was written before I started mainline kernel work.
Quoted 3 lines
Quoted 1 line
Signed-off-by Chen-Yu Tsai <[email protected]>Acked-by Ian Campbell <[email protected]>
Thanks.
Quoted 29 lines
Quoted 29 lines
--- board/sunxi/MAINTAINERS | 5 +++++ configs/Ippo_q8h_defconfig | 4 ++++ 2 files changed, 9 insertions(+) create mode 100644 configs/Ippo_q8h_defconfigboard/sunxi/MAINTAINERS +5
-0@@ -50,3 +50,8 @@ COLOMBUS BOARD M: Maxime Ripard <[email protected]> S: Maintained F: configs/Colombus_defconfig + +IPPO-Q8H-V5 BOARD +M: CHen-Yu Tsai <[email protected]> +S: Maintained +F: configs/Ippo_q8h_v5_defconfigconfigs/Ippo_q8h_defconfig new file +4
-0@@ -0,0 +1,4 @@ +CONFIG_SYS_EXTRA_OPTIONS="IPPO_Q8H_V5,CONS_INDEX=5" +CONFIG_ARM=y +CONFIG_TARGET_SUN8I=y +CONFIG_DEFAULT_DEVICE_TREE="sun8i-a23-ippo-q8h-v5.dtb"