sunxi: Allwinner H5 and OrangePi PC2 support
Subsystems (7)
cover sunxi: Allwinner H5 and OrangePi PC2 support
This series introduces support for the Allwinner H5 SoC with four Cortex-A53 cores. The SoC's peripherals are very similar to the H3, although the cores and the BROM/SRAM layout resembles the A64. The first 6 patches contain some fixes and refactoring, to make code sharing between the three mentioned SoCs easier.
Patch 07/12 adds support for the H5 DRAM controller, by extending the already existing combined H3/A64 DRAM code.
Patch 08/12 renames the existing CONFIG_MACH_SUN8I_H3 config symbol to let it be used by all peripheral code that can be shared between the H3 and H5. Patch 10/12 introduces the H5 SoC config option into Kconfig, which defines this shared symbol as well.
Patch 11/12 adds an easy device tree, which actually uses the H3 .dtsi and overwrites nodes which are different. This is good enough for U-Boot, the DT will be changed anyway once we get the DT merged into the Linux kernel.
The final patch then adds the defconfig for the OrangePi PC2 board. Since this board comes with soldered SPI flash, we enable support for it in the SPL. This has been tested by writing the SPI flash with some special sunxi-fel version. The BROM loaded and executed the SPL, which in turn loaded and executed U-Boot proper. Both parts are 64-bit only for now.
Ethernet support is enabled, but fails at the moment since the EMAC driver does not support setting a GPIO to enable the external Gigabit PHY. This should be a problem for H3 boards with Gigabit as well.
At the moment this build suffers from the same problem as the A64: the ATF is missing, so Linux won't boot easily. However I finally managed to clean up the FIT extension series, which solves this problem in a quite elegant way. I will post this series after getting some sleep ;-)
This series is on top of sunxi/next, which has three yet unmerged (and unrelated) patches compared to HEAD. So it should apply to both branches.
Some of these patches will probably conflict with ongoing work from Icenowy, I am happy to rebase on any branch someone points me to.
Please have a look and let me know your opinion!
Cheers,
Andre.
Andre Przywara (12):
sunxi: fix ACTLR.SMP assembly routine
sunxi: simplify ACTLR.SMP bit set #ifdef
sunxi: configs: merge sun9i and sun50i SPL memory definitions
sunxi: Kconfig: introduce CONFIG_SUNXI_HIGH_SRAM
sunxi: provide ARMv8 mem_map for every ARM64 board
SPI: SPL: sunxi: fix 64-bit build
sunxi: DRAM: add Allwinner H5 support
sunxi: prepare for sharing MACH_SUN8I_H3 config symbol
sunxi: H5: add COUNTER_FREQUENCY
sunxi: introduce Allwinner H5 config option
sunxi: dts: add basic OrangePi PC 2 device tree file
sunxi: configs: add basic OrangePi PC 2 defconfig
arch/arm/dts/Makefile | 2 + arch/arm/dts/sun50i-h5-orangepi-pc2.dts | 147 ++++++++++++++++++++++++++ arch/arm/include/asm/arch-sunxi/clock_sun6i.h | 4 +- arch/arm/include/asm/arch-sunxi/cpu.h | 1 + arch/arm/include/asm/arch-sunxi/cpu_sun4i.h | 4 +- arch/arm/include/asm/arch-sunxi/dram.h | 2 +- arch/arm/include/asm/arch-sunxi/spl.h | 2 +- arch/arm/mach-sunxi/Makefile | 2 +- arch/arm/mach-sunxi/board.c | 21 ++-- arch/arm/mach-sunxi/clock_sun6i.c | 6 +- arch/arm/mach-sunxi/cpu_info.c | 2 + arch/arm/mach-sunxi/dram_sun8i_h3.c | 97 ++++++++++++++--- arch/arm/mach-sunxi/usb_phy.c | 4 +- board/sunxi/Kconfig | 36 ++++++- board/sunxi/MAINTAINERS | 5 + configs/orangepi_pc2_defconfig | 16 +++ drivers/mtd/spi/Kconfig | 2 +- drivers/mtd/spi/sunxi_spi_spl.c | 16 +-- drivers/net/sun8i_emac.c | 2 +- drivers/power/Kconfig | 4 +- drivers/usb/host/ehci-sunxi.c | 2 +- include/configs/sun8i.h | 2 + include/configs/sunxi-common.h | 22 ++-- 23 files changed, 330 insertions(+), 71 deletions(-) create mode 100644 arch/arm/dts/sun50i-h5-orangepi-pc2.dts create mode 100644 configs/orangepi_pc2_defconfig
Signature · 1 line
2.8.2
PATCH 1/12 sunxi: fix ACTLR.SMP assembly routine
If we take the liberty to use register r0 to perform our bit set, we should be nice enough to tell the compiler about it.
Add r0 to the clobber list to avoid potential mayhem.
--- arch/arm/mach-sunxi/board.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
arch/arm/mach-sunxi/board.c +2 -1
@@ -188,7 +188,8 @@ void s_init(void) asmvolatile ("mrc p15, 0, r0, c1, c0, 1\n" "orr r0, r0, #1 << 6\n" -"mcr p15, 0, r0, c1, c0, 1\n" ); +"mcr p15, 0, r0, c1, c0, 1\n" + :::"r0" );#endif #if definedCONFIG_MACH_SUN6I || definedCONFIG_MACH_SUN8I_H3 /* Enable non-secure access to some peripherals */
Signature · 1 line
2.8.2
PATCH 1/12 sunxi: fix ACTLR.SMP assembly routine
Quoted 5 lines · Andre Przywara
If we take the liberty to use register r0 to perform our bit set, we should be nice enough to tell the compiler about it.
Add r0 to the clobber list to avoid potential mayhem.Signed-off-by Andre Przywara <[email protected]>
Thanks,
Maxime
Signature · 10 lines
Maxime Ripard, Free Electrons Embedded Linux and Kernel engineering http://free-electrons.com -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 801 bytes Desc: not available URL: <http://lists.denx.de/pipermail/u-boot/attachments/20170116/dbddc682/attachment.sig>
PATCH 2/12 sunxi: simplify ACTLR.SMP bit set #ifdef
In reply to Andre PrzywaraInstead of enumerating all SoC families that need that bit set, let's just express this more clearly: The SMP bits needs to be set on SMP capable ARMv7 CPUs. It's much easier to Kconfig to express it the other way round, so we use ! NO_SMP and ! ARM64.
--- arch/arm/mach-sunxi/board.c | 5 +---- board/sunxi/Kconfig | 6 ++++++ 2 files changed, 7 insertions(+), 4 deletions(-)
arch/arm/mach-sunxi/board.c +1 -4
@@ -180,10 +180,7 @@ void s_init(void)/* No H3 BSP, boot0 seems to not modify SUNXI_SRAMC_BASE + 0x44 */ #endif -#if definedCONFIG_MACH_SUN6I || \ - definedCONFIG_MACH_SUN7I || \ - definedCONFIG_MACH_SUN8I || \ - definedCONFIG_MACH_SUN9I +#if !defined(CONFIG_SUNXI_NO_SMP ) && !defined(CONFIG_ARM64 )/* Enable SMP mode for CPU0, by setting bit 6 of Auxiliary Ctl reg */ asmvolatile ( "mrc p15, 0, r0, c1, c0, 1\n"
board/sunxi/Kconfig +6 -0
@@ -27,6 +27,10 @@ config SPL_POWER_SUPPORT config SPL_SERIAL_SUPPORT default y +config SUNXI_NO_SMP + bool + default n + # Note only one of these may be selected at a time! But hidden choices are # not supported by Kconfig config SUNXI_GEN_SUN4I
@@ -50,12 +54,14 @@ choice config MACH_SUN4I bool "sun4i (Allwinner A10)" select CPU_V7 + select SUNXI_NO_SMP select SUNXI_GEN_SUN4I select SUPPORT_SPL config MACH_SUN5I bool "sun5i (Allwinner A13)" select CPU_V7 + select SUNXI_NO_SMP select SUNXI_GEN_SUN4I select SUPPORT_SPL
Signature · 1 line
2.8.2
PATCH 2/12 sunxi: simplify ACTLR.SMP bit set #ifdef
13.01.2017, 09:34, "Andre Przywara" <[email protected]>:
Quoted 4 lines
Instead of enumerating all SoC families that need that bit set, let's just express this more clearly: The SMP bits needs to be set on SMP capable ARMv7 CPUs. It's much easier to
Kconfigto express it the other way round, so we use !NO_SMPand ! ARM64.
How about single-core Cortex-A7?
Quoted 55 lines
Signed-off-by Andre Przywara <[email protected]>---
?arch/arm/mach-sunxi/board.c | 5 +----
?board/sunxi/Kconfig | 6 ++++++
?2 files changed, 7 insertions(+), 4 deletions(-)arch/arm/mach-sunxi/board.c +0
-0@@ -180,10 +180,7 @@ void s_init(void)?????????/* No H3 BSP, boot0 seems to not modify
SUNXI_SRAMC_BASE+0x44*/ ?#endifarch/arm/mach-sunxi/board.c +1
-4-#if definedCONFIG_MACH_SUN6I || \ - definedCONFIG_MACH_SUN7I || \ - definedCONFIG_MACH_SUN8I || \ - definedCONFIG_MACH_SUN9I +#if !defined(CONFIG_SUNXI_NO_SMP ) && !defined(CONFIG_ARM64 )?????????/* Enable SMP mode for CPU0, by setting bit 6 of Auxiliary Ctl reg */ ?????????asm volatile(
?????????????????"mrc p15, 0, r0, c1, c0, 1\n"board/sunxi/Kconfig +0
-0@@ -27,6 +27,10 @@ config SPL_POWER_SUPPORT?config
SPL_SERIAL_SUPPORT
?????????default yboard/sunxi/Kconfig +4
-0+config SUNXI_NO_SMP + bool + default n +?# Note only one of these may be selected at a time! But hidden choices are ?# not supported by
Kconfig
?configSUNXI_GEN_SUN4Iboard/sunxi/Kconfig +0
-0@@ -50,12 +54,14 @@ choice?config
MACH_SUN4I
?????????bool "sun4i (Allwinner A10)"
?????????selectCPU_V7
+ selectSUNXI_NO_SMP
?????????selectSUNXI_GEN_SUN4I
?????????selectSUPPORT_SPL?config
MACH_SUN5I
?????????bool "sun5i (Allwinner A13)"
?????????selectCPU_V7
+ selectSUNXI_NO_SMP
?????????selectSUNXI_GEN_SUN4I
?????????selectSUPPORT_SPL--
2.8.2
[U-Boot] [linux-sunxi] Re: [PATCH 02/12] sunxi: simplify ACTLR.SMP bit set #ifdef
Even for the single core cortex-a7, SMP bit should be set before enabling MMU and cache.
Reference: Cortex A7 r0p5 TRM. section 4.3.31.
Quoted 70 lines · Icenowy Zheng
13.01.2017, 09:34, "Andre Przywara" <[email protected]>:
Quoted 4 lines
Instead of enumerating all SoC families that need that bit set, let's just express this more clearly: The SMP bits needs to be set on SMP capable ARMv7 CPUs. It's much easier to
Kconfigto express it the other way round, so we use !NO_SMPand ! ARM64.How about single-core Cortex-A7?
Quoted 54 lines
Signed-off-by Andre Przywara <[email protected]>--- arch/arm/mach-sunxi/board.c | 5 +---- board/sunxi/Kconfig | 6 ++++++ 2 files changed, 7 insertions(+), 4 deletions(-)arch/arm/mach-sunxi/board.c +1
-4@@ -180,10 +180,7 @@ void s_init(void)/* No H3 BSP, boot0 seems to not modify SUNXI_SRAMC_BASE + 0x44 */ #endif -#if definedCONFIG_MACH_SUN6I || \ - definedCONFIG_MACH_SUN7I || \ - definedCONFIG_MACH_SUN8I || \ - definedCONFIG_MACH_SUN9I +#if !defined(CONFIG_SUNXI_NO_SMP ) && !defined(CONFIG_ARM64 )/* Enable SMP mode for CPU0, by setting bit 6 of Auxiliary Ctl reg */ asmvolatile ( "mrc p15, 0, r0, c1, c0, 1\n"board/sunxi/Kconfig +6
-1@@ -27,6 +27,10 @@ config SPL_POWER_SUPPORT config SPL_SERIAL_SUPPORT default y +config SUNXI_NO_SMP + bool + default n + # Note only one of these may be selected at a time! But hidden choices are # not supported by Kconfig config SUNXI_GEN_SUN4I@@ -50,12 +54,14 @@ choice config MACH_SUN4I bool "sun4i (Allwinner A10)" select CPU_V7 + select SUNXI_NO_SMP select SUNXI_GEN_SUN4I select SUPPORT_SPL config MACH_SUN5I bool "sun5i (Allwinner A13)" select CPU_V7 + select SUNXI_NO_SMP select SUNXI_GEN_SUN4I select SUPPORT_SPL --Quoted 1 line
2.8.2
--
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 linux-sunxi+unsubscribe at googlegroups.com. For more options, visit https://groups.google.com/d/optout.
[U-Boot] [linux-sunxi] Re: [PATCH 02/12] sunxi: simplify ACTLR.SMP bit set #ifdef
On 13/01/17 08:09, Vishnu Patekar wrote:
Hi Vishnu,
Quoted 4 lines
Even for the single core cortex-a7, SMP bit should be set before enabling MMU and cache.
Reference: Cortex A7 r0p5 TRM. section 4.3.31.
Ah, good point, thanks for the heads up. I was misled by the SMP name when answering Icenowy.
So it's about coherency in general and we need the bit for TLBs and caches to work as well.
Let me check what that means for the other SoCs and whether we need to rename the config symbol then.
Cheers,
Andre.
Quoted 72 lines · Icenowy Zheng
Quoted 70 lines
13.01.2017, 09:34, "Andre Przywara" <[email protected]>:
Quoted 4 lines
Instead of enumerating all SoC families that need that bit set, let's just express this more clearly: The SMP bits needs to be set on SMP capable ARMv7 CPUs. It's much easier to
Kconfigto express it the other way round, so we use !NO_SMPand ! ARM64.How about single-core Cortex-A7?
Quoted 54 lines
Signed-off-by Andre Przywara <[email protected]>--- arch/arm/mach-sunxi/board.c | 5 +---- board/sunxi/Kconfig | 6 ++++++ 2 files changed, 7 insertions(+), 4 deletions(-)arch/arm/mach-sunxi/board.c +1
-4@@ -180,10 +180,7 @@ void s_init(void)/* No H3 BSP, boot0 seems to not modify SUNXI_SRAMC_BASE + 0x44 */ #endif -#if definedCONFIG_MACH_SUN6I || \ - definedCONFIG_MACH_SUN7I || \ - definedCONFIG_MACH_SUN8I || \ - definedCONFIG_MACH_SUN9I +#if !defined(CONFIG_SUNXI_NO_SMP ) && !defined(CONFIG_ARM64 )/* Enable SMP mode for CPU0, by setting bit 6 of Auxiliary Ctl reg */ asmvolatile ( "mrc p15, 0, r0, c1, c0, 1\n"board/sunxi/Kconfig +6
-1@@ -27,6 +27,10 @@ config SPL_POWER_SUPPORT config SPL_SERIAL_SUPPORT default y +config SUNXI_NO_SMP + bool + default n + # Note only one of these may be selected at a time! But hidden choices are # not supported by Kconfig config SUNXI_GEN_SUN4I@@ -50,12 +54,14 @@ choice config MACH_SUN4I bool "sun4i (Allwinner A10)" select CPU_V7 + select SUNXI_NO_SMP select SUNXI_GEN_SUN4I select SUPPORT_SPL config MACH_SUN5I bool "sun5i (Allwinner A13)" select CPU_V7 + select SUNXI_NO_SMP select SUNXI_GEN_SUN4I select SUPPORT_SPL --Quoted 1 line
2.8.2
--
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 linux-sunxi+unsubscribe at googlegroups.com. For more options, visit https://groups.google.com/d/optout.
[U-Boot] [linux-sunxi] Re: [PATCH 02/12] sunxi: simplify ACTLR.SMP bit set #ifdef
Quoted 6 lines · Andr? Przywara
On 13/01/17 08:09, Vishnu Patekar wrote:
Hi Vishnu,Quoted 3 lines
Even for the single core cortex-a7, SMP bit should be set before enabling MMU and cache.
Quoted 8 lines
Quoted 1 line
Reference: Cortex A7 r0p5 TRM. section 4.3.31.
Ah, good point, thanks for the heads up. I was misled by the SMP name when answering Icenowy.
So it's about coherency in general and we need the bit for TLBs and caches to work as well.
Let me check what that means for the other SoCs and whether we need to rename the config symbol then.
If we still needs it, x86 has a CONFIG_SMP symbol, that would be better to just leverage that.
Thanks!
Maxime
Signature · 10 lines
Maxime Ripard, Free Electrons Embedded Linux and Kernel engineering http://free-electrons.com -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 801 bytes Desc: not available URL: <http://lists.denx.de/pipermail/u-boot/attachments/20170116/3d9a3e22/attachment.sig>
[U-Boot] [linux-sunxi] Re: [PATCH 02/12] sunxi: simplify ACTLR.SMP bit set #ifdef
Hi,
Quoted 7 lines · Maxime Ripard
Quoted 6 lines · Andr? Przywara
On 13/01/17 08:09, Vishnu Patekar wrote:
Hi Vishnu,Quoted 3 lines
Even for the single core cortex-a7, SMP bit should be set before enabling MMU and cache.
Quoted 8 lines
Quoted 8 lines
Quoted 1 line
Reference: Cortex A7 r0p5 TRM. section 4.3.31.
Ah, good point, thanks for the heads up. I was misled by the SMP name when answering Icenowy.
So it's about coherency in general and we need the bit for TLBs and caches to work as well.
Let me check what that means for the other SoCs and whether we need to rename the config symbol then.
So I checked the other ARMv7 Cortex TRMs, in contrast to the A7 TRM they explicitly speak of cache and TLB requests from other _processors_. So it should not be needed to use caches and the MMU on a uni-core implementation (which seem to be pretty rare with Cortex-A7s).
But: my understanding is that it actually controls handling coherency request from outside of the processor core, which could be from a coherent agent on the bus as well, if I get this correctly. So I think it does not hurt to enable the bit on the V3s as well and could avoid potential problems. As this lines up with what the TRM says, we should turn it on as in the other cores.
Icenowy: did you see problems with setting this bit and turned it off for a reason or was that just because the bit is named "SMP"?
Quoted 1 line
If we still needs it,
First: we definitely need this symbol, since it guards an implementation defined register and the Cortex-A53 does not define it. So we have to confine its use to the ARMv7 Cortex CPUs.
Quoted 2 lines
x86 has a
CONFIG_SMPsymbol, that would be
better to just leverage that.
Sounds tempting, but this seems to be a generic symbol that enables SMP support _within_ U-Boot, so it allows multiple cores to execute U-Boot code. This is clearly not what we want. Defining it seems to enable architecture specific and generic code paths in U-Boot.
I can rename this symbol if that helps to avoid confusion, for instance to read CONFIG_SUNXI_NO_ACTLR_SMP or to CONFIG_CPU_IS_NOT_SMP or CONFIG_CPU_IS_UP.
Cheers,
Andre.
[U-Boot] [linux-sunxi] Re: [PATCH 02/12] sunxi: simplify ACTLR.SMP bit set #ifdef
Quoted 5 lines · Andr? Przywara
Quoted 1 line
If we still needs it,
First: we definitely need this symbol, since it guards an implementation defined register and the Cortex-A53 does not define it. So we have to confine its use to the ARMv7 Cortex CPUs.
Ack.
Quoted 11 lines
Quoted 2 lines
x86 has a
CONFIG_SMPsymbol, that would be
better to just leverage that.Sounds tempting, but this seems to be a generic symbol that enables SMP support _within_ U-Boot, so it allows multiple cores to execute U-Boot code. This is clearly not what we want. Defining it seems to enable architecture specific and generic code paths in U-Boot.
I can rename this symbol if that helps to avoid confusion, for instance to read
CONFIG_SUNXI_NO_ACTLR_SMPor toCONFIG_CPU_IS_NOT_SMPorCONFIG_CPU_IS_UP.
There's nothing sunxi specific about it, the last one is better imho.
Thanks!
Maxime
Signature · 10 lines
Maxime Ripard, Free Electrons Embedded Linux and Kernel engineering http://free-electrons.com -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 801 bytes Desc: not available URL: <http://lists.denx.de/pipermail/u-boot/attachments/20170123/b8be54b0/attachment.sig>
PATCH 2/12 sunxi: simplify ACTLR.SMP bit set #ifdef
In reply to Icenowy ZhengOn 13/01/17 04:41, Icenowy Zheng wrote:
Hi,
Quoted 7 lines
13.01.2017, 09:34, "Andre Przywara" <[email protected]>:
Quoted 4 lines
Instead of enumerating all SoC families that need that bit set, let's just express this more clearly: The SMP bits needs to be set on SMP capable ARMv7 CPUs. It's much easier to
Kconfigto express it the other way round, so we use !NO_SMPand ! ARM64.How about single-core Cortex-A7?
Well, I had the V3s in mind already, so it should be as easy as adding:
select SUNXI_NO_SMP
to your MACH_SUN8I_V3S stanza in board/sunxi/Kconfig, actually saving you to alter the actual code #ifdefs.
Or am I missing something?
Cheers,
Andre.
Quoted 55 lines
Quoted 55 lines
Signed-off-by Andre Przywara <[email protected]>--- arch/arm/mach-sunxi/board.c | 5 +---- board/sunxi/Kconfig | 6 ++++++ 2 files changed, 7 insertions(+), 4 deletions(-)arch/arm/mach-sunxi/board.c +1
-4@@ -180,10 +180,7 @@ void s_init(void)/* No H3 BSP, boot0 seems to not modify SUNXI_SRAMC_BASE + 0x44 */ #endif -#if definedCONFIG_MACH_SUN6I || \ - definedCONFIG_MACH_SUN7I || \ - definedCONFIG_MACH_SUN8I || \ - definedCONFIG_MACH_SUN9I +#if !defined(CONFIG_SUNXI_NO_SMP ) && !defined(CONFIG_ARM64 )/* Enable SMP mode for CPU0, by setting bit 6 of Auxiliary Ctl reg */ asmvolatile ( "mrc p15, 0, r0, c1, c0, 1\n"board/sunxi/Kconfig +6
-1@@ -27,6 +27,10 @@ config SPL_POWER_SUPPORT config SPL_SERIAL_SUPPORT default y +config SUNXI_NO_SMP + bool + default n + # Note only one of these may be selected at a time! But hidden choices are # not supported by Kconfig config SUNXI_GEN_SUN4I@@ -50,12 +54,14 @@ choice config MACH_SUN4I bool "sun4i (Allwinner A10)" select CPU_V7 + select SUNXI_NO_SMP select SUNXI_GEN_SUN4I select SUPPORT_SPL config MACH_SUN5I bool "sun5i (Allwinner A13)" select CPU_V7 + select SUNXI_NO_SMP select SUNXI_GEN_SUN4I select SUPPORT_SPL --2.8.2
PATCH 3/12 sunxi: configs: merge sun9i and sun50i SPL memory definitions
In reply to Andre PrzywaraFor some reason we were pretty conservative when defining the maximum SPL size for the Allwinner A80(sun9i) SoC.
According to the manual the SRAM A1 is even 40KB, but the BROM probably still has the 32 KiB load limit. For the sake of simplicity, merge the SPL memory definitions for the A64 and A80 SoCs, since both SoC share the BROM/SRAM A1 memory layout.
This helps to further simplify this in the next patch.
--- include/configs/sunxi-common.h | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-)
include/configs/sunxi-common.h +2 -5
@@ -186,12 +186,9 @@#define CONFIG_SPL_BOARD_LOAD_IMAGE #endif -#if defined(CONFIG_MACH_SUN9I ) -#define CONFIG_SPL_TEXT_BASE 0x10040/* sram start+header */ -#define CONFIG_SPL_MAX_SIZE 0x5fc0/* ? KiB on sun9i */ -#elif defined(CONFIG_MACH_SUN50I ) +#if defined(CONFIG_MACH_SUN9I ) || defined(CONFIG_MACH_SUN50I )#define CONFIG_SPL_TEXT_BASE 0x10040/* sram start+header */ -#define CONFIG_SPL_MAX_SIZE 0x7fc0/* 32 KiB on sun50i */ +#define CONFIG_SPL_MAX_SIZE 0x7fc0/* 32 KiB on sun9/50i */ #else #define CONFIG_SPL_TEXT_BASE 0x40/* sram start+header */ #define CONFIG_SPL_MAX_SIZE 0x5fc0/* 24KB on sun4i/sun7i */
Signature · 1 line
2.8.2
PATCH 3/12 sunxi: configs: merge sun9i and sun50i SPL memory definitions
Quoted 9 lines · Andre Przywara
For some reason we were pretty conservative when defining the maximum SPL size for the Allwinner A80(sun9i) SoC.
According to the manual the SRAM A1 is even 40KB, but the BROM probably still has the 32 KiB load limit. For the sake of simplicity, merge the SPL memory definitions for the A64 and A80 SoCs, since both SoC share the BROM/SRAM A1 memory layout.
This helps to further simplify this in the next patch.Signed-off-by Andre Przywara <[email protected]>
Thanks,
Maxime
Signature · 10 lines
Maxime Ripard, Free Electrons Embedded Linux and Kernel engineering http://free-electrons.com -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 801 bytes Desc: not available URL: <http://lists.denx.de/pipermail/u-boot/attachments/20170116/4d78721f/attachment.sig>
PATCH 4/12 sunxi: Kconfig: introduce CONFIG_SUNXI_HIGH_SRAM
In reply to Andre PrzywaraTraditionally Allwinner SoCs have their boot ROM mapped just below 4GB, while the first SRAM region is mapped at address 0.
With the extended physical memory support of the A80 this was changed, so the BROM is now at address 0 and the SRAM region starts right behind this at 64KB. This configuration seems to be called "high SRAM". Instead of enumerating the SoCs which have copied this configuration, let's call a spade a spade and introduce a Kconfig option for this setup. SoCs implementing this (A80, A64 and H5, so far), can then select this configuration.
Simplify the config header definition on the way.
--- arch/arm/include/asm/arch-sunxi/spl.h | 2 +- board/sunxi/Kconfig | 6 ++++++ include/configs/sunxi-common.h | 19 +++++++------------ 3 files changed, 14 insertions(+), 13 deletions(-)
arch/arm/include/asm/arch-sunxi/spl.h +1 -1
@@ -12,7 +12,7 @@#define SPL_SIGNATURE "SPL"/* marks "sunxi" SPL header */ #define SPL_HEADER_VERSION 1 -#if defined(CONFIG_MACH_SUN9I ) || defined(CONFIG_MACH_SUN50I ) +#ifdef CONFIG_SUNXI_HIGH_SRAM #define SPL_ADDR 0x10000#else #define SPL_ADDR 0x0
board/sunxi/Kconfig +6 -0
@@ -31,6 +31,10 @@ config SUNXI_NO_SMP bool default n +config SUNXI_HIGH_SRAM + bool + default n + # Note only one of these may be selected at a time! But hidden choices are # not supported by Kconfig config SUNXI_GEN_SUN4I
@@ -124,6 +128,7 @@ config MACH_SUN8I_H3 config MACH_SUN9I bool "sun9i (Allwinner A80)" select CPU_V7 + select SUNXI_HIGH_SRAM select SUNXI_GEN_SUN6I select SUPPORT_SPL
@@ -131,6 +136,7 @@ config MACH_SUN50I bool "sun50i (Allwinner A64)" select ARM64 select SUNXI_GEN_SUN6I + select SUNXI_HIGH_SRAM select SUPPORT_SPL endchoice
include/configs/sunxi-common.h +7 -12
@@ -86,7 +86,7 @@#define CONFIG_SPL_BSS_MAX_SIZE 0x00080000/* 512 KiB */ -#if defined(CONFIG_MACH_SUN9I ) || defined(CONFIG_MACH_SUN50I ) +#ifdef CONFIG_SUNXI_HIGH_SRAM /* * The A80's A1 sram starts at 0x00010000 rather then at 0x00000000 and is * slightly bigger. Note that it is possible to map the first 32 KiB of the
@@ -186,29 +186,24 @@#define CONFIG_SPL_BOARD_LOAD_IMAGE #endif -#if defined(CONFIG_MACH_SUN9I ) || defined(CONFIG_MACH_SUN50I ) +#ifdef CONFIG_SUNXI_HIGH_SRAM #define CONFIG_SPL_TEXT_BASE 0x10040/* sram start+header */ -#define CONFIG_SPL_MAX_SIZE 0x7fc0/* 32 KiB on sun9/50i */ +#define CONFIG_SPL_MAX_SIZE 0x7fc0/* 32 KiB */ +#define LOW_LEVEL_SRAM_STACK 0x00018000#else #define CONFIG_SPL_TEXT_BASE 0x40/* sram start+header */ #define CONFIG_SPL_MAX_SIZE 0x5fc0/* 24KB on sun4i/sun7i */ +#define LOW_LEVEL_SRAM_STACK 0x00008000/* End of sram */ #endif +#define CONFIG_SPL_STACK LOW_LEVEL_SRAM_STACK +#ifndef CONFIG_ARM64 #define CONFIG_SPL_LDSCRIPT "arch/arm/cpu/armv7/sunxi/u-boot-spl.lds"#endif #define CONFIG_SPL_PAD_TO 32768/* decimal for 'dd' */ -#if defined(CONFIG_MACH_SUN9I ) || defined(CONFIG_MACH_SUN50I ) -/* FIXME: 40 KiB instead of 32 KiB ? */ -#define LOW_LEVEL_SRAM_STACK 0x00018000 -#define CONFIG_SPL_STACK LOW_LEVEL_SRAM_STACK -#else -/* end of 32 KiB in sram */ -#define LOW_LEVEL_SRAM_STACK 0x00008000/* End of sram */ -#define CONFIG_SPL_STACK LOW_LEVEL_SRAM_STACK -#endif /* I2C */ #if defined CONFIG_AXP152_POWER || defined CONFIG_AXP209_POWER || \
Signature · 1 line
2.8.2
PATCH 4/12 sunxi: Kconfig: introduce CONFIG_SUNXI_HIGH_SRAM
Quoted 11 lines · Andre Przywara
Traditionally Allwinner SoCs have their boot ROM mapped just below 4GB, while the first SRAM region is mapped at address 0.
With the extended physical memory support of the A80 this was changed, so the BROM is now at address 0 and the SRAM region starts right behind this at 64KB. This configuration seems to be called "high SRAM". Instead of enumerating the SoCs which have copied this configuration, let's call a spade a spade and introduce aKconfigoption for this setup. SoCs implementing this (A80, A64 and H5, so far), can then select this configuration.
Simplify the config header definition on the way.
Quoted 1 line
Signed-off-by Andre Przywara <[email protected]>
Thanks,
Maxime
Signature · 10 lines
Maxime Ripard, Free Electrons Embedded Linux and Kernel engineering http://free-electrons.com -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 801 bytes Desc: not available URL: <http://lists.denx.de/pipermail/u-boot/attachments/20170116/e3944925/attachment.sig>
PATCH 5/12 sunxi: provide ARMv8 mem_map for every ARM64 board
In reply to Andre PrzywaraEvery armv8 board needs the memory map, so change the #ifdef to ARM64 to avoid enumerating every single board or SoC.
--- arch/arm/mach-sunxi/board.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/arm/mach-sunxi/board.c +1 -1
@@ -40,7 +40,7 @@ struct fel_stash { struct fel_stash fel_stash __attribute__((section(".data"))); -#ifdef CONFIG_MACH_SUN50I +#ifdef CONFIG_ARM64 #include <asm/armv8/mmu.h> static struct mm_region sunxi_mem_map[] = {
Signature · 1 line
2.8.2
PATCH 5/12 sunxi: provide ARMv8 mem_map for every ARM64 board
Quoted 4 lines · Andre Przywara
Every armv8 board needs the memory map, so change the #ifdef to ARM64 to avoid enumerating every single board or SoC.
Signed-off-by Andre Przywara <[email protected]>
Thanks,
Maxime
Signature · 10 lines
Maxime Ripard, Free Electrons Embedded Linux and Kernel engineering http://free-electrons.com -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 801 bytes Desc: not available URL: <http://lists.denx.de/pipermail/u-boot/attachments/20170116/c4c8c16d/attachment.sig>
PATCH 6/12 SPI: SPL: sunxi: fix 64-bit build
In reply to Andre PrzywaraAddresses passed on to readl and writel are expected to be of the same size as a pointer. Change the parameter types of sunxi_spi0_read_data() to make the compiler happy and allow a warning-free aarch64 compile.
--- drivers/mtd/spi/sunxi_spi_spl.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-)
drivers/mtd/spi/sunxi_spi_spl.c +8 -8
@@ -185,14 +185,14 @@ static void spi0_deinit(void)#define SPI_READ_MAX_SIZE 60/* FIFO size, minus 4 bytes of the header */ static void sunxi_spi0_read_data (u8 *buf,u32 addr,u32 bufsize, -u32 spi_ctl_reg, -u32 spi_ctl_xch_bitmask, -u32 spi_fifo_reg, -u32 spi_tx_reg, -u32 spi_rx_reg, -u32 spi_bc_reg, -u32 spi_tc_reg, -u32 spi_bcc_reg) +ulong spi_ctl_reg, +ulong spi_ctl_xch_bitmask, +ulong spi_fifo_reg, +ulong spi_tx_reg, +ulong spi_rx_reg, +ulong spi_bc_reg, +ulong spi_tc_reg, +ulong spi_bcc_reg) {writel (4 + bufsize, spi_bc_reg);/* Burst counter (total bytes) */ writel (4 , spi_tc_reg);/* Transfer counter (bytes to send) */
Signature · 1 line
2.8.2
PATCH 6/12 SPI: SPL: sunxi: fix 64-bit build
Quoted 5 lines · Andre Przywara
Addresses passed on to readl and writel are expected to be of the same size as a pointer. Change the parameter types of
sunxi_spi0_read_data()to make the compiler happy and allow a warning-free aarch64 compile.Signed-off-by Andre Przywara <[email protected]>
How about using intptr_t and uintptr_t from include/compiler.h? It will make it clearer that these parameters should be able to hold a pointer.
Quoted 32 lines
--- drivers/mtd/spi/sunxi_spi_spl.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-)drivers/mtd/spi/sunxi_spi_spl.c +8
-8@@ -185,14 +185,14 @@ static void spi0_deinit(void)#define SPI_READ_MAX_SIZE 60/* FIFO size, minus 4 bytes of the header */ static void sunxi_spi0_read_data (u8 *buf,u32 addr,u32 bufsize, -u32 spi_ctl_reg, -u32 spi_ctl_xch_bitmask, -u32 spi_fifo_reg, -u32 spi_tx_reg, -u32 spi_rx_reg, -u32 spi_bc_reg, -u32 spi_tc_reg, -u32 spi_bcc_reg) +ulong spi_ctl_reg, +ulong spi_ctl_xch_bitmask, +ulong spi_fifo_reg, +ulong spi_tx_reg, +ulong spi_rx_reg, +ulong spi_bc_reg, +ulong spi_tc_reg, +ulong spi_bcc_reg) {writel (4 + bufsize, spi_bc_reg);/* Burst counter (total bytes) */ writel (4 , spi_tc_reg);/* Transfer counter (bytes to send) */
Signature · 1 line
Rask Ingemann Lambertsen
PATCH 6/12 SPI: SPL: sunxi: fix 64-bit build
Quoted 33 lines · Rask Ingemann Lambertsen
Quoted 5 lines · Andre Przywara
Addresses passed on to readl and writel are expected to be of the same size as a pointer. Change the parameter types of
sunxi_spi0_read_data()to make the compiler happy and allow a warning-free aarch64 compile.Signed-off-by Andre Przywara <[email protected]>How about using
intptr_tanduintptr_tfrominclude/compiler.h? It will make it clearer that these parameters should be able to hold a pointer.Quoted 23 lines
--- drivers/mtd/spi/sunxi_spi_spl.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-)drivers/mtd/spi/sunxi_spi_spl.c +3
-8@@ -185,14 +185,14 @@ static void spi0_deinit(void)#define SPI_READ_MAX_SIZE 60/* FIFO size, minus 4 bytes of the header */ static void sunxi_spi0_read_data(u8 *buf, u32 addr, u32 bufsize, -u32 spi_ctl_reg, -u32 spi_ctl_xch_bitmask, -u32 spi_fifo_reg, -u32 spi_tx_reg, -u32 spi_rx_reg, -u32 spi_bc_reg, -u32 spi_tc_reg, -u32 spi_bcc_reg) + ulong spi_ctl_reg, + ulong spi_ctl_xch_bitmask, + ulong spi_fifo_reg,
Quoted 8 lines
drivers/mtd/spi/sunxi_spi_spl.c static void spi0_deinit(void) · line 198
Quoted 8 lines
drivers/mtd/spi/sunxi_spi_spl.c +5
-0+ulong spi_tx_reg, + ulong spi_rx_reg, + ulong spi_bc_reg, + ulong spi_tc_reg, + ulong spi_bcc_reg) { writel(4 + bufsize, spi_bc_reg); /* Burst counter (total bytes) */writel (4 , spi_tc_reg);/* Transfer counter (bytes to send) */
We normally use ulong for addresses in U-Boot.
PATCH 7/12 sunxi: DRAM: add Allwinner H5 support
In reply to Andre PrzywaraThe DRAM controller in the Allwinner H5 SoC is again very similar to the one in the H3 and A64.
Based on the existing socid parameter, add support for this controller by reusing the bulk of the code and only deviating where needed. Also add the delay line parameters taken from the boot0 and libdram disassembly.
Register setup differences between H5 and H3 are courtesy of Jens Kuske.
--- arch/arm/include/asm/arch-sunxi/cpu.h | 1 + arch/arm/mach-sunxi/dram_sun8i_h3.c | 97 +++++++++++++++++++++++++++++------ 2 files changed, 82 insertions(+), 16 deletions(-)
arch/arm/include/asm/arch-sunxi/cpu.h +1 -0
@@ -15,5 +15,6 @@#define SOCID_A64 0x1689#define SOCID_H3 0x1680 +#define SOCID_H5 0x1718#endif /* _SUNXI_CPU_H */
arch/arm/mach-sunxi/dram_sun8i_h3.c +81 -16
187 lines not on this page · raw message
Signature · 1 line
2.8.2
PATCH 7/12 sunxi: DRAM: add Allwinner H5 support
Quoted 9 lines · Andre Przywara
The DRAM controller in the Allwinner H5 SoC is again very similar to the one in the H3 and A64.
Based on the existing socid parameter, add support for this controller by reusing the bulk of the code and only deviating where needed. Also add the delay line parameters taken from the boot0 and libdram disassembly.
Register setup differences between H5 and H3 are courtesy of Jens Kuske.Signed-off-by Andre Przywara <[email protected]>
There's a number of issues with checkpatch here, please fix them.
And there's way too many magics here, again...
Maxime
Signature · 10 lines
Maxime Ripard, Free Electrons Embedded Linux and Kernel engineering http://free-electrons.com -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 801 bytes Desc: not available URL: <http://lists.denx.de/pipermail/u-boot/attachments/20170116/8140efad/attachment.sig>
PATCH 8/12 sunxi: prepare for sharing MACH_SUN8I_H3 config symbol
In reply to Andre PrzywaraThe Allwinner H5 is very close to the H3 SoC, but has ARMv8 cores. To allow sharing the clocks, GPIO and driver code easily, create an architecture agnostic MACH_SUN8I_H3_H5 Kconfig symbol. Rename the existing symbol to MACH_SUN8I_H3_H5 where code is shared and let it be selected by a new shared Kconfig option.
--- arch/arm/include/asm/arch-sunxi/clock_sun6i.h | 4 ++-- arch/arm/include/asm/arch-sunxi/cpu_sun4i.h | 4 ++-- arch/arm/include/asm/arch-sunxi/dram.h | 2 +- arch/arm/mach-sunxi/Makefile | 2 +- arch/arm/mach-sunxi/board.c | 11 +++++++---- arch/arm/mach-sunxi/clock_sun6i.c | 6 +++--- arch/arm/mach-sunxi/usb_phy.c | 4 ++-- board/sunxi/Kconfig | 14 +++++++++----- drivers/mtd/spi/Kconfig | 2 +- drivers/net/sun8i_emac.c | 2 +- drivers/power/Kconfig | 4 ++-- drivers/usb/host/ehci-sunxi.c | 2 +- 12 files changed, 32 insertions(+), 25 deletions(-)
arch/arm/include/asm/arch-sunxi/clock_sun6i.h +2 -2
@@ -242,7 +242,7 @@ struct sunxi_ccm_reg {/* ahb_gate0 offsets */ #define AHB_GATE_OFFSET_USB_OHCI1 30#define AHB_GATE_OFFSET_USB_OHCI0 29 -#ifdef CONFIG_MACH_SUN8I_H3 +#ifdef CONFIG_MACH_SUN8I_H3_H5 /* * These are EHCI1 - EHCI3 in the datasheet (EHCI0 is for the OTG) we call * them 0 - 2 like they were called on older SoCs.
@@ -293,7 +293,7 @@ struct sunxi_ccm_reg {#define CCM_USB_CTRL_PHY1_CLK (0x1 << 9)#define CCM_USB_CTRL_PHY2_CLK (0x1 << 10)#define CCM_USB_CTRL_PHY3_CLK (0x1 << 11) -#ifdef CONFIG_MACH_SUN8I_H3 +#ifdef CONFIG_MACH_SUN8I_H3_H5 /* * These are OHCI1 - OHCI3 in the datasheet (OHCI0 is for the OTG) we call * them 0 - 2 like they were called on older SoCs.
arch/arm/include/asm/arch-sunxi/cpu_sun4i.h +2 -2
@@ -56,7 +56,7 @@#define SUNXI_USB2_BASE 0x01c1c000#endif #ifdef CONFIG_SUNXI_GEN_SUN6I -#if defined(CONFIG_MACH_SUN8I_H3 ) || defined(CONFIG_MACH_SUN50I ) +#if defined(CONFIG_MACH_SUN8I_H3_H5 ) || defined(CONFIG_MACH_SUN50I )#define SUNXI_USBPHY_BASE 0x01c19000#define SUNXI_USB0_BASE 0x01c1a000#define SUNXI_USB1_BASE 0x01c1b000
@@ -94,7 +94,7 @@#define SUNXI_KEYPAD_BASE 0x01c23000#define SUNXI_TZPC_BASE 0x01c23400 -#if defined(CONFIG_MACH_SUN8I_A83T ) || defined(CONFIG_MACH_SUN8I_H3 ) || \ +#if defined(CONFIG_MACH_SUN8I_A83T ) || defined(CONFIG_MACH_SUN8I_H3_H5 ) || \ defined(CONFIG_MACH_SUN50I )/* SID address space starts at 0x01c1400, but e-fuse is@offset 0x200 */ #define SUNXI_SIDC_BASE 0x01c14000
arch/arm/include/asm/arch-sunxi/dram.h +1 -1
@@ -24,7 +24,7 @@#include <asm/arch/dram_sun8i_a33.h> #elif defined(CONFIG_MACH_SUN8I_A83T )#include <asm/arch/dram_sun8i_a83t.h> -#elif defined(CONFIG_MACH_SUN8I_H3 ) || defined(CONFIG_MACH_SUN50I ) +#elif defined(CONFIG_MACH_SUN8I_H3_H5 ) || defined(CONFIG_MACH_SUN50I )#include <asm/arch/dram_sun8i_h3.h> #elif defined(CONFIG_MACH_SUN9I )#include <asm/arch/dram_sun9i.h>
arch/arm/mach-sunxi/Makefile +1 -1
@@ -48,7 +48,7 @@ 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_A83T) += dram_sun8i_a83t.o -obj-$(CONFIG_MACH_SUN8I_H3) += dram_sun8i_h3.o +obj-$(CONFIG_MACH_SUN8I_H3_H5) += dram_sun8i_h3.o obj-$(CONFIG_MACH_SUN9I) += dram_sun9i.o obj-$(CONFIG_MACH_SUN50I) += dram_sun8i_h3.o endif
arch/arm/mach-sunxi/board.c +7 -4
@@ -98,7 +98,7 @@ 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 ) +#elif CONFIG_CONS_INDEX ==1 && defined(CONFIG_MACH_SUN8I_H3_H5 )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 );
@@ -145,6 +145,10 @@ static int spl_board_load_image(struct spl_image_info *spl_image,SPL_LOAD_IMAGE_METHOD ("FEL" ,0 ,BOOT_DEVICE_BOARD , spl_board_load_image);#endif +__weak void tzpc_init (void ) +{ +} +void s_init (void ) {/*
@@ -188,10 +192,9 @@ void s_init(void) "mcr p15, 0, r0, c1, c0, 1\n" ::: "r0");#endif -#if definedCONFIG_MACH_SUN6I || definedCONFIG_MACH_SUN8I_H3 -/* Enable non-secure access to some peripherals */ + +/* Enable non-secure access to some peripherals (only if needed) */ tzpc_init (); -#endif clock_init ();timer_init ();
arch/arm/mach-sunxi/clock_sun6i.c +3 -3
@@ -22,7 +22,7 @@ void clock_init_safe(void)struct sunxi_ccm_reg *const ccm = (struct sunxi_ccm_reg *)SUNXI_CCM_BASE ; -#if !defined(CONFIG_MACH_SUN8I_H3 ) && !defined(CONFIG_MACH_SUN50I ) +#if !defined(CONFIG_MACH_SUN8I_H3_H5 ) && !defined(CONFIG_MACH_SUN50I )struct sunxi_prcm_reg *const prcm = (struct sunxi_prcm_reg *)SUNXI_PRCM_BASE ;
@@ -51,7 +51,7 @@ void clock_init_safe(void)void clock_init_sec (void ) { -#ifdef CONFIG_MACH_SUN8I_H3 +#ifdef CONFIG_MACH_SUN8I_H3_H5 struct sunxi_ccm_reg *const ccm = (struct sunxi_ccm_reg *)SUNXI_CCM_BASE ;
@@ -152,7 +152,7 @@ void clock_set_pll5(unsigned int clk, bool sigma_delta_enable)const int max_n =32 ;int k =1 , m =2 ; -#ifdef CONFIG_MACH_SUN8I_H3 +#ifdef CONFIG_MACH_SUN8I_H3_H5 clrsetbits_le32 (&ccm->pll5_tuning_cfg,CCM_PLL5_TUN_LOCK_TIME_MASK |CCM_PLL5_TUN_INIT_FREQ_MASK ,CCM_PLL5_TUN_LOCK_TIME (2 ) |CCM_PLL5_TUN_INIT_FREQ (16 ));
arch/arm/mach-sunxi/usb_phy.c +2 -2
@@ -146,10 +146,10 @@ __maybe_unused static void usb_phy_write(struct sunxi_usb_phy *phy, int addr, } } -#if defined(CONFIG_MACH_SUN8I_H3 ) || defined(CONFIG_MACH_SUN50I ) +#if defined(CONFIG_MACH_SUN8I_H3_H5 ) || defined(CONFIG_MACH_SUN50I )static void sunxi_usb_phy_config (struct sunxi_usb_phy *phy) { -#if definedCONFIG_MACH_SUN8I_H3 +#if definedCONFIG_MACH_SUN8I_H3_H5 if (phy->id ==0 )clrbits_le32 (SUNXI_USBPHY_BASE +REG_PHY_UNK_H3 ,0x01 );#endif
board/sunxi/Kconfig +9 -5
@@ -51,6 +51,11 @@ config SUNXI_GEN_SUN6I watchdog, etc. +config MACH_SUN8I_H3_H5 + bool + select SUNXI_GEN_SUN6I + select SUPPORT_SPL + choice prompt "Sunxi SoC Variant" optional
@@ -121,8 +126,7 @@ config MACH_SUN8I_H3 select CPU_V7_HAS_NONSEC select CPU_V7_HAS_VIRT select ARCH_SUPPORT_PSCI - select SUNXI_GEN_SUN6I - select SUPPORT_SPL + select MACH_SUN8I_H3_H5 select ARMV7_BOOT_SEC_DEFAULT if OLD_SUNXI_KERNEL_COMPAT config MACH_SUN9I
@@ -144,7 +148,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 || MACH_SUN8I_H3 || MACH_SUN8I_A83T + default y if MACH_SUN8I_A23 || MACH_SUN8I_A33 || MACH_SUN8I_H3_H5 || MACH_SUN8I_A83T config RESERVE_ALLWINNER_BOOT0_HEADER bool "reserve space for Allwinner boot0 header"
@@ -332,7 +336,7 @@ config OLD_SUNXI_KERNEL_COMPAT config MMC0_CD_PIN string "Card detect pin for mmc0" - default "PF6" if MACH_SUN8I_A83T || MACH_SUN8I_H3 || MACH_SUN50I + default "PF6" if MACH_SUN8I_A83T || MACH_SUN8I_H3_H5 || MACH_SUN50I default "" ---help--- Set the card detect pin for mmc0, leave empty to not use cd. This
@@ -497,7 +501,7 @@ config AXP_GPIO config VIDEO bool "Enable graphical uboot console on HDMI, LCD or VGA" - depends on !MACH_SUN8I_A83T && !MACH_SUN8I_H3 && !MACH_SUN9I && !MACH_SUN50I + depends on !MACH_SUN8I_A83T && !MACH_SUN8I_H3_H5 && !MACH_SUN9I && !MACH_SUN50I default y ---help--- Say Y here to add support for using a cfb console on the HDMI, LCD
drivers/mtd/spi/Kconfig +1 -1
@@ -132,7 +132,7 @@ if SPL config SPL_SPI_SUNXI bool "Support for SPI Flash on Allwinner SoCs in SPL" - depends on MACH_SUN4I || MACH_SUN5I || MACH_SUN7I || MACH_SUN8I_H3 || MACH_SUN50I + depends on MACH_SUN4I || MACH_SUN5I || MACH_SUN7I || MACH_SUN8I_H3_H5 || MACH_SUN50I ---help--- Enable support for SPI Flash. This option allows SPL to read from sunxi SPI Flash. It uses the same method as the boot ROM, so does
drivers/net/sun8i_emac.c +1 -1
@@ -62,7 +62,7 @@#define AHB_GATE_OFFSET_EPHY 0 -#if defined(CONFIG_MACH_SUN8I_H3 ) +#if defined(CONFIG_MACH_SUN8I_H3_H5 )#define SUN8I_GPD8_GMAC 2#else #define SUN8I_GPD8_GMAC 4
drivers/power/Kconfig +2 -2
@@ -12,7 +12,7 @@ choice default AXP209_POWER if MACH_SUN4I || MACH_SUN5I || MACH_SUN7I default AXP221_POWER if MACH_SUN6I || MACH_SUN8I_A23 || MACH_SUN8I_A33 default AXP818_POWER if MACH_SUN8I_A83T - default SUNXI_NO_PMIC if MACH_SUN8I_H3 || MACH_SUN50I + default SUNXI_NO_PMIC if MACH_SUN8I_H3_H5 || MACH_SUN50I config SUNXI_NO_PMIC bool "board without a pmic"
@@ -60,7 +60,7 @@ config AXP818_POWER config SY8106A_POWER bool "SY8106A pmic support" - depends on MACH_SUN8I_H3 + depends on MACH_SUN8I_H3_H5 ---help--- Select this to enable support for the SY8106A pmic found on some H3 boards.
drivers/usb/host/ehci-sunxi.c +1 -1
@@ -45,7 +45,7 @@ static int ehci_usb_probe(struct udevice *dev)* clocks resp. phys. */ priv->ahb_gate_mask =1 <<AHB_GATE_OFFSET_USB_EHCI0 ; -#if defined(CONFIG_MACH_SUN8I_H3 ) || defined(CONFIG_MACH_SUN50I ) +#if defined(CONFIG_MACH_SUN8I_H3_H5 ) || defined(CONFIG_MACH_SUN50I ) extra_ahb_gate_mask =1 <<AHB_GATE_OFFSET_USB_OHCI0 ;#endif priv->phy_index = ((uintptr_t )hccr -SUNXI_USB1_BASE ) /BASE_DIST ;
Signature · 1 line
2.8.2
PATCH 8/12 sunxi: prepare for sharing MACH_SUN8I_H3 config symbol
Quoted 5 lines · Andre Przywara
The Allwinner H5 is very close to the H3 SoC, but has ARMv8 cores. To allow sharing the clocks, GPIO and driver code easily, create an architecture agnostic
MACH_SUN8I_H3_H5Kconfigsymbol. Rename the existing symbol toMACH_SUN8I_H3_H5where code is shared and let it be selected by a new sharedKconfigoption.
This isn't really related to sun8i anymore, how about MACH_SUNXI_H3_H5?
[...]
Quoted 9 lines
arch/arm/mach-sunxi/board.c +4
-0+__weak void tzpc_init (void ) +{ +} +void s_init (void ) {/*
arch/arm/mach-sunxi/board.c void s_init(void) · line 194
Quoted 9 lines
arch/arm/mach-sunxi/board.c +2
-3@@ -188,10 +192,9 @@ void s_init(void) "mcr p15, 0, r0, c1, c0, 1\n" ::: "r0");#endif -#if definedCONFIG_MACH_SUN6I || definedCONFIG_MACH_SUN8I_H3 -/* Enable non-secure access to some peripherals */ + +/* Enable non-secure access to some peripherals (only if needed) */ tzpc_init (); -#endif
This looks unrelated to your patch.
Thanks,
Maxime
Signature · 10 lines
Maxime Ripard, Free Electrons Embedded Linux and Kernel engineering http://free-electrons.com -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 801 bytes Desc: not available URL: <http://lists.denx.de/pipermail/u-boot/attachments/20170116/2ee185fb/attachment.sig>
PATCH 8/12 sunxi: prepare for sharing MACH_SUN8I_H3 config symbol
Quoted 9 lines · Maxime Ripard
Quoted 5 lines · Andre Przywara
The Allwinner H5 is very close to the H3 SoC, but has ARMv8 cores. To allow sharing the clocks, GPIO and driver code easily, create an architecture agnostic
MACH_SUN8I_H3_H5Kconfigsymbol. Rename the existing symbol toMACH_SUN8I_H3_H5where code is shared and let it be selected by a new sharedKconfigoption.This isn't really related to sun8i anymore, how about
MACH_SUNXI_H3_H5?
Even better, I renamed it.
Quoted 15 lines
[...]
Quoted 12 lines
arch/arm/mach-sunxi/board.c +4
-0+__weak void tzpc_init (void ) +{ +} +void s_init (void ) {/* @@ -188,10 +192,9 @@ void s_init(void) "mcr p15, 0, r0, c1, c0, 1\n" ::: "r0");#endif
Quoted 8 lines
arch/arm/mach-sunxi/board.c void s_init(void) · line 194
Quoted 6 lines
arch/arm/mach-sunxi/board.c +2
-3-#if definedCONFIG_MACH_SUN6I || definedCONFIG_MACH_SUN8I_H3 -/* Enable non-secure access to some peripherals */ + +/* Enable non-secure access to some peripherals (only if needed) */ tzpc_init (); -#endif This looks unrelated to your patch.
Ah, thanks for spotting this. It was an attempt to get rid of some #ifdef's at all (by using a weak function), but I think I can just drop it in this patch to keep the patch smaller and confined to one purpose.
Cheers,
Andre.
PATCH 9/12 sunxi: H5: add COUNTER_FREQUENCY
In reply to Andre PrzywaraFor the arch timer to work properly, we need to setup the CNTFRQ register, which is only possible in EL3.
Define the arch timer frequency in sun8i.h as well, so that ARMv8's start.S can program the register correctly.
--- include/configs/sun8i.h | 2 ++ 1 file changed, 2 insertions(+)
include/configs/sun8i.h +2 -0
@@ -13,6 +13,8 @@* A23 specific configuration */ +#define COUNTER_FREQUENCY CONFIG_TIMER_CLK_FREQ +#ifdef CONFIG_USB_EHCI #define CONFIG_USB_EHCI_SUNXI #endif
Signature · 1 line
2.8.2
PATCH 9/12 sunxi: H5: add COUNTER_FREQUENCY
Quoted 15 lines · Andre Przywara
For the arch timer to work properly, we need to setup the CNTFRQ register, which is only possible in EL3.
Define the arch timer frequency insun8i.has well, so that ARMv8'sstart.Scan program the register correctly.Signed-off-by Andre Przywara <[email protected]>--- include/configs/sun8i.h | 2 ++ 1 file changed, 2 insertions(+)include/configs/sun8i.h +0
-0
include/configs/sun8i.h line 17
Quoted 5 lines
include/configs/sun8i.h +2
-0@@ -13,6 +13,8 @@* A23 specific configuration */ +#define COUNTER_FREQUENCY CONFIG_TIMER_CLK_FREQ +
Why not convert the armv8 code to use CONFIG_TIMER_CLK_FREQ, or armv7 to use COUNTER_FREQUENCY?
The both options seem redundant.
Maxime
Signature · 10 lines
Maxime Ripard, Free Electrons Embedded Linux and Kernel engineering http://free-electrons.com -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 801 bytes Desc: not available URL: <http://lists.denx.de/pipermail/u-boot/attachments/20170116/a99dd186/attachment.sig>
PATCH 9/12 sunxi: H5: add COUNTER_FREQUENCY
Hi,
Quoted 19 lines · Maxime Ripard
Quoted 18 lines · Andre Przywara
For the arch timer to work properly, we need to setup the CNTFRQ register, which is only possible in EL3.
Define the arch timer frequency insun8i.has well, so that ARMv8'sstart.Scan program the register correctly.Signed-off-by Andre Przywara <[email protected]>--- include/configs/sun8i.h | 2 ++ 1 file changed, 2 insertions(+)include/configs/sun8i.h +0
-0@@ -13,6 +13,8 @@* A23 specific configuration */
Quoted 7 lines
include/configs/sun8i.h line 17
Quoted 2 lines
include/configs/sun8i.h +2
-0+#define COUNTER_FREQUENCY CONFIG_TIMER_CLK_FREQ +Why not convert the armv8 code to use
CONFIG_TIMER_CLK_FREQ, or armv7 to useCOUNTER_FREQUENCY?The both options seem redundant.
Good point, they indeed are.
So I will drop this patch here and instead have a new one to rename the v7 users over to use COUNTER_FREQUENCY.
I chose COUNTER_FREQUENCY because the other symbol has less users.
Thanks for the idea!
Cheers,
Andre.
PATCH 10/12 sunxi: introduce Allwinner H5 config option
In reply to Andre PrzywaraThe Allwinner H5 Soc is bascially an H3 with high SRAM and ARMv8 cores. As the peripherals and the pinmuxing are almost identical, we piggy back on the shared MACH_SUN8I_H3_H5 config symbol.
--- arch/arm/mach-sunxi/cpu_info.c | 2 ++ board/sunxi/Kconfig | 10 ++++++++++ 2 files changed, 12 insertions(+)
arch/arm/mach-sunxi/cpu_info.c +2 -0
@@ -91,6 +91,8 @@ int print_cpuinfo(void)puts ("CPU: Allwinner A80 (SUN9I)\n" );#elif definedCONFIG_MACH_SUN50I puts ("CPU: Allwinner A64 (SUN50I)\n" ); +#elif definedCONFIG_MACH_SUN50I_H5 +puts ("CPU: Allwinner H5 (SUN50I)\n" );#else #warning Please update cpu_info.c with correct CPU informationputs ("CPU: SUNXI Family\n" );
board/sunxi/Kconfig +10 -0
@@ -56,6 +56,11 @@ config MACH_SUN8I_H3_H5 select SUNXI_GEN_SUN6I select SUPPORT_SPL +config MACH_SUN50I_H5 + bool + select SUNXI_HIGH_SRAM + select MACH_SUN8I_H3_H5 + choice prompt "Sunxi SoC Variant" optional
@@ -143,6 +148,11 @@ config MACH_SUN50I select SUNXI_HIGH_SRAM select SUPPORT_SPL +config MACH_SUN50I_H5_64 + bool "sun50i (Allwinner H5)" + select ARM64 + select MACH_SUN50I_H5 + endchoice # The sun8i SoCs share a lot, this helps to avoid a lot of "if A23 || A33"
Signature · 1 line
2.8.2
PATCH 11/12 sunxi: dts: add basic OrangePi PC 2 device tree file
In reply to Andre PrzywaraThe OrangePi PC 2 is a typical SBC with the 64-bit Allwinner H5 SoC. Create a new .dts file for it by including the (32-bit) H3 SoC .dtsi and changing the differing components accordingly.
This is a preliminary device tree mostly for U-Boot's own sake, it is expected to be updated once the official DT gets accepted upstream.
--- arch/arm/dts/Makefile | 2 + arch/arm/dts/sun50i-h5-orangepi-pc2.dts | 147 ++++++++++++++++++++++++++++++++ 2 files changed, 149 insertions(+) create mode 100644 arch/arm/dts/sun50i-h5-orangepi-pc2.dts
arch/arm/dts/Makefile +2 -0
@@ -281,6 +281,8 @@ dtb-$(CONFIG_MACH_SUN8I_H3) += \ sun8i-h3-orangepi-plus.dtb \ sun8i-h3-orangepi-plus2e.dtb \ sun8i-h3-nanopi-neo.dtb +dtb-$(CONFIG_MACH_SUN50I_H5) += \ + sun50i-h5-orangepi-pc2.dtb dtb-$(CONFIG_MACH_SUN50I) += \ sun50i-a64-pine64-plus.dtb \ sun50i-a64-pine64.dtb
arch/arm/dts/sun50i-h5-orangepi-pc2.dts new file +147 -0
147 lines not on this page · raw message
Signature · 1 line
2.8.2
PATCH 12/12 sunxi: configs: add basic OrangePi PC 2 defconfig
In reply to Andre PrzywaraThe OrangePi PC 2 is a typical SBC with the 64-bit Allwinner H5 SoC. Add a (64-bit only) defconfig defining the required options to build the U-Boot proper and SPL.
--- board/sunxi/MAINTAINERS | 5 +++++ configs/orangepi_pc2_defconfig | 16 ++++++++++++++++ 2 files changed, 21 insertions(+) create mode 100644 configs/orangepi_pc2_defconfig
board/sunxi/MAINTAINERS +5 -0
@@ -242,6 +242,11 @@ M: Icenowy Zheng <[email protected]> S: Maintained F: configs/orangepi_zero_defconfig +ORANGEPI PC 2 BOARD +M: Andre Przywara <[email protected]> +S: Maintained +F: configs/orangepi_pc2_defconfig + R16 EVB PARROT BOARD M: Quentin Schulz <[email protected]> S: Maintained
configs/orangepi_pc2_defconfig new file +16 -0
@@ -0,0 +1,16 @@ +CONFIG_ARM=y +CONFIG_ARCH_SUNXI=y +CONFIG_MACH_SUN50I_H5_64=y +CONFIG_SPL=y +CONFIG_DRAM_CLK=672 +CONFIG_DRAM_ZQ=3881977 +CONFIG_DEFAULT_DEVICE_TREE="sun50i-h5-orangepi-pc2" +# CONFIG_SYS_MALLOC_CLEAR_ON_INIT is not set +CONFIG_CONSOLE_MUX=y +# CONFIG_CMD_IMLS is not set +# CONFIG_CMD_FLASH is not set +# CONFIG_CMD_FPGA is not set +CONFIG_SUN8I_EMAC=y +CONFIG_USB_EHCI_HCD=y +CONFIG_SPL_SPI_SUNXI=y +CONFIG_SPL_SPI_FLASH_SUPPORT=y
Signature · 1 line
2.8.2
cover sunxi: Allwinner H5 and OrangePi PC2 support
In reply to Andre Przywara13.01.2017, 09:34, "Andre Przywara" <[email protected]>:
Quoted 30 lines
This series introduces support for the Allwinner H5 SoC with four Cortex-A53 cores. The SoC's peripherals are very similar to the H3, although the cores and the BROM/SRAM layout resembles the A64. The first 6 patches contain some fixes and refactoring, to make code sharing between the three mentioned SoCs easier.
Patch 07/12 adds support for the H5 DRAM controller, by extending the already existing combined H3/A64 DRAM code.
Patch 08/12 renames the existingCONFIG_MACH_SUN8I_H3config symbol to let it be used by all peripheral code that can be shared between the H3 and H5. Patch 10/12 introduces the H5 SoC config option intoKconfig, which defines this shared symbol as well.
Patch 11/12 adds an easy device tree, which actually uses the H3 .dtsi and overwrites nodes which are different. This is good enough for U-Boot, the DT will be changed anyway once we get the DT merged into the Linux kernel.
The final patch then adds the defconfig for the OrangePi PC2 board. Since this board comes with soldered SPI flash, we enable support for it in the SPL. This has been tested by writing the SPI flash with some special sunxi-fel version. The BROM loaded and executed the SPL, which in turn loaded and executed U-Boot proper. Both parts are 64-bit only for now.
Ethernet support is enabled, but fails at the moment since the EMAC driver does not support setting a GPIO to enable the external Gigabit PHY. This should be a problem for H3 boards with Gigabit as well.At the moment this build suffers from the same problem as the A64: the ATF is missing, so Linux won't boot easily. However I finally managed to clean up the FIT extension series, which solves this problem in a quite elegant way. I will post this series after getting some sleep ;-)
Quoted 5 lines
This series is on top of sunxi/next, which has three yet unmerged (and unrelated) patches compared to HEAD. So it should apply to both branches.
Some of these patches will probably conflict with ongoing work from Icenowy, I am happy to rebase on any branch someone points me to.
No. It's me who should do rebase, as I have not done everything ;-)
Quoted 49 lines
Please have a look and let me know your opinion!
Cheers,
Andre.Andre Przywara (12):
??sunxi: fix ACTLR.SMP assembly routine
??sunxi: simplify ACTLR.SMP bit set #ifdef
??sunxi: configs: merge sun9i and sun50i SPL memory definitions ??sunxi:Kconfig: introduceCONFIG_SUNXI_HIGH_SRAM??sunxi: provide ARMv8mem_mapfor every ARM64 board ??SPI: SPL: sunxi: fix 64-bit build
??sunxi: DRAM: add Allwinner H5 support
??sunxi: prepare for sharingMACH_SUN8I_H3config symbol ??sunxi: H5: addCOUNTER_FREQUENCY
??sunxi: introduce Allwinner H5 config option ??sunxi: dts: add basic OrangePi PC 2 device tree file ??sunxi: configs: add basic OrangePi PC 2 defconfig?arch/arm/dts/Makefile | 2 + ?arch/arm/dts/sun50i-h5-orangepi-pc2.dts | 147 ++++++++++++++++++++++++++ ?arch/arm/include/asm/arch-sunxi/clock_sun6i.h | 4 +- ?arch/arm/include/asm/arch-sunxi/cpu.h | 1 + ?arch/arm/include/asm/arch-sunxi/cpu_sun4i.h | 4 +- ?arch/arm/include/asm/arch-sunxi/dram.h | 2 +- ?arch/arm/include/asm/arch-sunxi/spl.h | 2 +- ?arch/arm/mach-sunxi/Makefile | 2 +- ?arch/arm/mach-sunxi/board.c | 21 ++-- ?arch/arm/mach-sunxi/clock_sun6i.c | 6 +- ?arch/arm/mach-sunxi/cpu_info.c | 2 + ?arch/arm/mach-sunxi/dram_sun8i_h3.c | 97 ++++++++++++++--- ?arch/arm/mach-sunxi/usb_phy.c | 4 +-
?board/sunxi/Kconfig | 36 ++++++-
?board/sunxi/MAINTAINERS | 5 + ?configs/orangepi_pc2_defconfig | 16 +++ ?drivers/mtd/spi/Kconfig | 2 +- ?drivers/mtd/spi/sunxi_spi_spl.c | 16 +-- ?drivers/net/sun8i_emac.c | 2 +-
?drivers/power/Kconfig | 4 +-
?drivers/usb/host/ehci-sunxi.c | 2 +- ?include/configs/sun8i.h | 2 + ?include/configs/sunxi-common.h | 22 ++--
?23 files changed, 330 insertions(+), 71 deletions(-)
?create mode 100644arch/arm/dts/sun50i-h5-orangepi-pc2.dts?create mode 100644 configs/orangepi_pc2_defconfig--
2.8.2