ARM: sunxi: Add basic support for Allwinner A31 (sun6i)
Subsystems (3)
cover ARM: sunxi: Add basic support for Allwinner A31 (sun6i)
Hi everyone,
This series add basic support for Allwinner's A31 SoC. The patches, excluding the first one, were cherry-picked from u-boot-sunxi. Due to the difference between u-boot mainline and u-boot-sunxi, some patches were rearranged or squashed to better fit the current state of u-boot, and not introduce any build breaks. It follows Ian's initial merge method of sun7i support: introducing various components first, then enabling them in the last commit. I tried to keep the commits separate, thus retaining the original author and Signed-off-bys.
Patch 1 adds a wrapper around "func(USB, usb, 0)" in BOOT_TARGET_DEVICES to deal with breakage when USB support is not enabled.
Patch 2 adds memory addresses for some hardware blocks new in sun6i.
Patch 3 adds support for the new PRCM (power reset and clock management) block, which also contains PLL bias voltage control.
Patch 4 adds support for the clock module. This patch is a bunch of different sun6i related patches on the clock code, from when sun6i support was introduced to u-boot-sunxi, up to its current form. This is done to avoid various conflicts and needlessly introducing then removing macros.
Patch 5 adds mmc support on sun6i.
Patch 6 adds uart0 muxing on sun6i.
Patch 7 enables sun6i support and adds defconfig for the Colombus board.
Cheers
ChenYu
Chen-Yu Tsai (2):
ARM: sunxi: Fix build break when CONFIG_USB_EHCI is not defined
ARM: sun6i: Add clock support
Hans de Goede (1):
ARM: sunxi-mmc: Add mmc support for sun6i / A31
Maxime Ripard (2):
ARM: sun6i: Setup the A31 UART0 muxing
ARM: sunxi: Add basic A31 support
Oliver Schinagl (2):
ARM: sun6i: Add base address for the new controllers in A31
ARM: sun6i: Add support for the new power control module found on the
A31
arch/arm/Kconfig | 3 + arch/arm/cpu/armv7/sunxi/Makefile | 2 + arch/arm/cpu/armv7/sunxi/board.c | 4 + arch/arm/cpu/armv7/sunxi/clock_sun6i.c | 107 ++++++++++++ arch/arm/cpu/armv7/sunxi/cpu_info.c | 2 + arch/arm/cpu/armv7/sunxi/prcm.c | 37 ++++ arch/arm/include/asm/arch-sunxi/clock.h | 4 + arch/arm/include/asm/arch-sunxi/clock_sun6i.h | 205 ++++++++++++++++++++++ arch/arm/include/asm/arch-sunxi/cpu.h | 9 + arch/arm/include/asm/arch-sunxi/mmc.h | 2 - arch/arm/include/asm/arch-sunxi/prcm.h | 238 ++++++++++++++++++++++++++ board/sunxi/Kconfig | 10 +- configs/Colombus_defconfig | 4 + drivers/mmc/sunxi_mmc.c | 9 + include/configs/sun6i.h | 26 +++ include/configs/sunxi-common.h | 8 +- 16 files changed, 666 insertions(+), 4 deletions(-) create mode 100644 arch/arm/cpu/armv7/sunxi/clock_sun6i.c create mode 100644 arch/arm/cpu/armv7/sunxi/prcm.c create mode 100644 arch/arm/include/asm/arch-sunxi/clock_sun6i.h create mode 100644 arch/arm/include/asm/arch-sunxi/prcm.h create mode 100644 configs/Colombus_defconfig create mode 100644 include/configs/sun6i.h
Signature · 1 line
2.1.0
PATCH 1/7 ARM: sunxi: Fix build break when CONFIG_USB_EHCI is not defined
BOOT_TARGET_DEVICES includes USB unconditionally. This breaks when CONFIG_CMD_USB is not defined. Use a secondary macro to conditionally include it when CONFIG_EHCI is enabled, as we do for CONFIG_AHCI.
--- include/configs/sunxi-common.h | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-)
include/configs/sunxi-common.h +7 -1
@@ -233,10 +233,16 @@#define BOOT_TARGET_DEVICES_SCSI (func)#endif +#ifdef CONFIG_USB_EHCI +#define BOOT_TARGET_DEVICES_USB (func) func(USB, usb, 0) +#else +#define BOOT_TARGET_DEVICES_USB (func) +#endif +#define BOOT_TARGET_DEVICES (func) \ func(MMC, mmc, 0) \ BOOT_TARGET_DEVICES_SCSI(func) \ - func(USB, usb, 0) \ + BOOT_TARGET_DEVICES_USB(func) \ func(PXE, pxe, na) \ func(DHCP, dhcp, na)
Signature · 1 line
2.1.0
PATCH 1/7 ARM: sunxi: Fix build break when CONFIG_USB_EHCI is not defined
Hi Ian, Hans,
Quoted 3 lines · Chen-Yu Tsai
BOOT_TARGET_DEVICESincludes USB unconditionally. This breaks whenCONFIG_CMD_USBis not defined. Use a secondary macro to conditionally include it whenCONFIG_EHCIis enabled, as we do forCONFIG_AHCI.
The other patches are for the next release, but maybe this fix could go into 2014.10?
Thanks
ChenYu
Quoted 31 lines
Signed-off-by Chen-Yu Tsai <[email protected]>--- include/configs/sunxi-common.h | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-)include/configs/sunxi-common.h +7
-2@@ -233,10 +233,16 @@#define BOOT_TARGET_DEVICES_SCSI (func)#endif +#ifdef CONFIG_USB_EHCI +#define BOOT_TARGET_DEVICES_USB (func) func(USB, usb, 0) +#else +#define BOOT_TARGET_DEVICES_USB (func) +#endif +#define BOOT_TARGET_DEVICES (func) \ func(MMC, mmc, 0) \ BOOT_TARGET_DEVICES_SCSI(func) \ - func(USB, usb, 0) \ + BOOT_TARGET_DEVICES_USB(func) \ func(PXE, pxe, na) \ func(DHCP, dhcp, na) --2.1.0
PATCH 1/7 ARM: sunxi: Fix build break when CONFIG_USB_EHCI is not defined
Hi Chen,
Quoted 9 lines · Chen-Yu Tsai
Hi Ian, Hans,
Quoted 3 lines · Chen-Yu Tsai
BOOT_TARGET_DEVICESincludes USB unconditionally. This breaks whenCONFIG_CMD_USBis not defined. Use a secondary macro to conditionally include it whenCONFIG_EHCIis enabled, as we do forCONFIG_AHCI.The other patches are for the next release, but maybe this fix could go into 2014.10?
I agree that this is a benign bug fix, but since we don't have any boards not setting CONFIG_EHCI atm I don't really see the value for getting it into 2014.10.
Regards,
Hans
Quoted 36 lines
Thanks
ChenYu
Quoted 31 lines
Signed-off-by Chen-Yu Tsai <[email protected]>--- include/configs/sunxi-common.h | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-)include/configs/sunxi-common.h +7
-2@@ -233,10 +233,16 @@#define BOOT_TARGET_DEVICES_SCSI (func)#endif +#ifdef CONFIG_USB_EHCI +#define BOOT_TARGET_DEVICES_USB (func) func(USB, usb, 0) +#else +#define BOOT_TARGET_DEVICES_USB (func) +#endif +#define BOOT_TARGET_DEVICES (func) \ func(MMC, mmc, 0) \ BOOT_TARGET_DEVICES_SCSI(func) \ - func(USB, usb, 0) \ + BOOT_TARGET_DEVICES_USB(func) \ func(PXE, pxe, na) \ func(DHCP, dhcp, na) --2.1.0
PATCH 1/7 ARM: sunxi: Fix build break when CONFIG_USB_EHCI is not defined
Quoted 10 lines · Hans de Goede
Hi Chen,
Quoted 7 lines · Chen-Yu Tsai
Hi Ian, Hans,
Quoted 3 lines · Chen-Yu Tsai
BOOT_TARGET_DEVICESincludes USB unconditionally. This breaks whenCONFIG_CMD_USBis not defined. Use a secondary macro to conditionally include it whenCONFIG_EHCIis enabled, as we do forCONFIG_AHCI.
Quoted 6 lines
Quoted 2 lines
The other patches are for the next release, but maybe this fix could go into 2014.10?
I agree that this is a benign bug fix, but since we don't have any boards not setting
CONFIG_EHCIatm I don't really see the value for getting it into 2014.10.
FWIW I was planning on putting the whole series in #next until the next merge window as soon as I find a some spare moments to look through it (sorry, might take me a few more days, I'm travelling at the w/e).
Ian.
PATCH 1/7 ARM: sunxi: Fix build break when CONFIG_USB_EHCI is not defined
Quoted 14 lines · Ian Campbell
Quoted 13 lines · Hans de Goede
Hi Chen,
Quoted 9 lines · Chen-Yu Tsai
Hi Ian, Hans,
Quoted 3 lines · Chen-Yu Tsai
BOOT_TARGET_DEVICESincludes USB unconditionally. This breaks whenCONFIG_CMD_USBis not defined. Use a secondary macro to conditionally include it whenCONFIG_EHCIis enabled, as we do forCONFIG_AHCI.The other patches are for the next release, but maybe this fix could go into 2014.10?
Quoted 7 lines
Quoted 3 lines
I agree that this is a benign bug fix, but since we don't have any boards not setting
CONFIG_EHCIatm I don't really see the value for getting it into 2014.10.FWIW I was planning on putting the whole series in #next until the next merge window as soon as I find a some spare moments to look through it (sorry, might take me a few more days, I'm travelling at the w/e).
OK. Thanks for the heads up.
ChenYu
PATCH 1/7 ARM: sunxi: Fix build break when CONFIG_USB_EHCI is not defined
In reply to Chen-Yu TsaiQuoted 5 lines · Chen-Yu Tsai
BOOT_TARGET_DEVICESincludes USB unconditionally. This breaks whenCONFIG_CMD_USBis not defined. Use a secondary macro to conditionally include it whenCONFIG_EHCIis enabled, as we do forCONFIG_AHCI.Signed-off-by Chen-Yu Tsai <[email protected]>
PATCH 2/7 ARM: sun6i: Add base address for the new controllers in A31
In reply to Chen-Yu TsaiFrom: Oliver Schinagl <[email protected]>
A31 has several new and changed memory address. This patch adds them.
--- arch/arm/include/asm/arch-sunxi/cpu.h | 9 +++++++++ 1 file changed, 9 insertions(+)
arch/arm/include/asm/arch-sunxi/cpu.h +9 -0
@@ -95,6 +95,11 @@#define SUNXI_MALI400_BASE 0x01c40000#define SUNXI_GMAC_BASE 0x01c50000 +#define SUNXI_DRAM_COM_BASE 0x01c62000 +#define SUNXI_DRAM_CTL_BASE 0x01c63000 +#define SUNXI_DRAM_PHY_CH1_BASE 0x01c65000 +#define SUNXI_DRAM_PHY_CH2_BASE 0x01c66000 +/* module sram */ #define SUNXI_SRAM_C_BASE 0x01d00000
@@ -105,6 +110,10 @@#define SUNXI_MP_BASE 0x01e80000#define SUNXI_AVG_BASE 0x01ea0000 +#define SUNXI_PRCM_BASE 0x01f01400 +#define SUNXI_R_PIO_BASE 0x01f02c00 +#define SUNXI_P2WI_BASE 0x01f03400 +/* CoreSight Debug Module */ #define SUNXI_CSDM_BASE 0x3f500000
Signature · 1 line
2.1.0
PATCH 2/7 ARM: sun6i: Add base address for the new controllers in A31
Quoted 7 lines · Chen-Yu Tsai
From: Oliver Schinagl <[email protected]>
A31 has several new and changed memory address. This patch adds them.
Signed-off-by Oliver Schinagl <[email protected]>Signed-off-by Hans de Goede <[email protected]>Signed-off-by Chen-Yu Tsai <[email protected]>
PATCH 3/7 ARM: sun6i: Add support for the new power control module found on the A31
In reply to Chen-Yu TsaiFrom: Oliver Schinagl <[email protected]>
To setup clocks and control voltages.
HdG: Rename the files from the somewhat generic pmu name to prcm.{c,h}
HdG: Make the prcm code only deal with the prcm, remove axp221 bits
--- arch/arm/cpu/armv7/sunxi/Makefile | 1 + arch/arm/cpu/armv7/sunxi/prcm.c | 37 +++++ arch/arm/include/asm/arch-sunxi/prcm.h | 238 +++++++++++++++++++++++++++++++++ 3 files changed, 276 insertions(+) create mode 100644 arch/arm/cpu/armv7/sunxi/prcm.c create mode 100644 arch/arm/include/asm/arch-sunxi/prcm.h
arch/arm/cpu/armv7/sunxi/Makefile +1 -0
@@ -11,6 +11,7 @@ obj-y += timer.o obj-y += board.o obj-y += clock.o obj-y += pinmux.o +obj-$(CONFIG_SUN6I) += prcm.o obj-$(CONFIG_SUN4I) += clock_sun4i.o obj-$(CONFIG_SUN5I) += clock_sun4i.o obj-$(CONFIG_SUN7I) += clock_sun4i.o
arch/arm/cpu/armv7/sunxi/prcm.c new file +37 -0
@@ -0,0 +1,37 @@ +/* +* Sunxi A31 Power Management Unit +* +* (C) Copyright 2013 Oliver Schinagl <[email protected]> +* http://linux-sunxi.org +* +* Based on sun6i sources and earlier U-Boot Allwiner A10 SPL work +* +* (C) Copyright 2006-2013 +* Allwinner Technology Co., Ltd. <www.allwinnertech.com> +* Berg Xing <[email protected]> +* Tom Cubie <[email protected]> +* +* SPDX-License-Identifier: GPL-2.0+ +*/ + +#include <common.h> +#include <errno.h> +#include <asm/io.h> +#include <asm/arch/cpu.h> +#include <asm/arch/prcm.h> +#include <asm/arch/sys_proto.h> + +void prcm_init_apb0 (void ) +{ +struct sunxi_prcm_reg *prcm = + (struct sunxi_prcm_reg *)SUNXI_PRCM_BASE ; +u32 reg_val; + + reg_val =readl (&prcm->apb0_gate); + reg_val |=PRCM_APB0_GATE_P2WI |PRCM_APB0_GATE_PIO ; +writel (reg_val, &prcm->apb0_gate); + + reg_val =readl (&prcm->apb0_reset); + reg_val |=PRCM_APB0_RESET_P2WI |PRCM_APB0_RESET_PIO ; +writel (reg_val, &prcm->apb0_reset); +}
arch/arm/include/asm/arch-sunxi/prcm.h new file +238 -0
238 lines not on this page · raw message
Signature · 1 line
2.1.0
PATCH 3/7 ARM: sun6i: Add support for the new power control module found on the A31
Quoted 3 lines · Chen-Yu Tsai
From: Oliver Schinagl <[email protected]>
To setup clocks and control voltages.
perhaps add "... For P2WI and PIO", since that is apparently what it is doing?
Quoted 2 lines
HdG: Rename the files from the somewhat generic pmu name to prcm.{c,h}
HdG: Make the prcm code only deal with the prcm, remove axp221 bits
I suppose these comments aren't really meaningful in the final commit message, probably better to drop them.
Quoted 1 line
+ * Based on sun6i sources and earlier U-Boot Allwiner A10 SPL work
Typo in "Allwiner"
arch/arm/cpu/armv7/sunxi/prcm.c line 36
Quoted 7 lines
arch/arm/cpu/armv7/sunxi/prcm.c new file +7
-0+ reg_val =readl (&prcm->apb0_gate); + reg_val |=PRCM_APB0_GATE_P2WI |PRCM_APB0_GATE_PIO ; +writel (reg_val, &prcm->apb0_gate); + + reg_val =readl (&prcm->apb0_reset); + reg_val |=PRCM_APB0_RESET_P2WI |PRCM_APB0_RESET_PIO ; +writel (reg_val, &prcm->apb0_reset);
I think these should both use the setbits helper.
Ian.
PATCH 3/7 ARM: sun6i: Add support for the new power control module found on the A31
Hi,
Quoted 7 lines · Ian Campbell
Quoted 3 lines · Chen-Yu Tsai
From: Oliver Schinagl <[email protected]>
To setup clocks and control voltages.
perhaps add "... For P2WI and PIO", since that is apparently what it is doing?
Sounds good. I'll expand the message to mention what the PRCM controls, and what we actually use.
Quoted 5 lines
Quoted 2 lines
HdG: Rename the files from the somewhat generic pmu name to prcm.{c,h}
HdG: Make the prcm code only deal with the prcm, remove axp221 bitsI suppose these comments aren't really meaningful in the final commit message, probably better to drop them.
I was trying to keep the history of the patches intact. If Hans agress, I can drop them.
Quoted 12 lines
Quoted 1 line
+ * Based on sun6i sources and earlier U-Boot Allwiner A10 SPL work
Typo in "Allwiner"
arch/arm/cpu/armv7/sunxi/prcm.c line 36
Quoted 7 lines
arch/arm/cpu/armv7/sunxi/prcm.c new file +7
-0+ reg_val =readl (&prcm->apb0_gate); + reg_val |=PRCM_APB0_GATE_P2WI |PRCM_APB0_GATE_PIO ; +writel (reg_val, &prcm->apb0_gate); + + reg_val =readl (&prcm->apb0_reset); + reg_val |=PRCM_APB0_RESET_P2WI |PRCM_APB0_RESET_PIO ; +writel (reg_val, &prcm->apb0_reset);
Quoted 1 line
I think these should both use the setbits helper.
Right. Will change them.
Thanks!
ChenYu
PATCH 3/7 ARM: sun6i: Add support for the new power control module found on the A31
Hi,
Quoted 14 lines · Chen-Yu Tsai
Hi,
Quoted 7 lines · Ian Campbell
Quoted 3 lines · Chen-Yu Tsai
From: Oliver Schinagl <[email protected]>
To setup clocks and control voltages.
perhaps add "... For P2WI and PIO", since that is apparently what it is doing?
Sounds good. I'll expand the message to mention what the PRCM controls, and what we actually use.
Quoted 8 lines
Quoted 5 lines
Quoted 2 lines
HdG: Rename the files from the somewhat generic pmu name to prcm.{c,h}
HdG: Make the prcm code only deal with the prcm, remove axp221 bitsI suppose these comments aren't really meaningful in the final commit message, probably better to drop them.
I was trying to keep the history of the patches intact. If Hans agress, I can drop them.
Yes dropping them for upstreaming is fine.
Regards,
Hans
Quoted 21 lines
Quoted 13 lines
Quoted 2 lines
+ * Based on sun6i sources and earlier U-Boot Allwiner A10 SPL work
Typo in "Allwiner"
arch/arm/cpu/armv7/sunxi/prcm.c line 36
Quoted 7 lines
arch/arm/cpu/armv7/sunxi/prcm.c new file +7
-0+ reg_val =readl (&prcm->apb0_gate); + reg_val |=PRCM_APB0_GATE_P2WI |PRCM_APB0_GATE_PIO ; +writel (reg_val, &prcm->apb0_gate); + + reg_val =readl (&prcm->apb0_reset); + reg_val |=PRCM_APB0_RESET_P2WI |PRCM_APB0_RESET_PIO ; +writel (reg_val, &prcm->apb0_reset);Quoted 1 line
I think these should both use the setbits helper.
Right. Will change them.
Thanks!
ChenYu
PATCH 4/7 ARM: sun6i: Add clock support
In reply to Chen-Yu TsaiThis patch adds the basic clocks support for the Allwinner A31 (sun6i) processor. This code will not been compiled until the build is hooked up in a later patch. It has been split out to keep the patches manageable.
This includes changes from the following commits from u-boot-sunxi:
a92051b ARM: sunxi: Add sun6i clock controller structure
1f72c6f ARM: sun6i: Setup the UART0 clocks
5f2e712 ARM: sunxi: Enable pll6 by default on all models
2be2f2a ARM: sunxi-mmc: Add mmc support for sun6i / A31
12e1633 ARM: sun6i: Add initial clock setup for SPL
1a9c9c6 ARM: sunxi: Split clock code into common, sun4i and sun6i code 0b194ee ARM: sun6i: Properly setup the PLL LDO in clock_init_safe b54c626 sunxi: avoid sr32 for APB1 clock setup.
68fe29c sunxi: remove magic numbers from clock_get_pll{5,6}
c89867d sunxi: clocks: clock_get_pll5 prototype and coding style 501ab1e ARM: sunxi: Fix sun6i PLL6 settings
37f669b ARM: sunxi: Fix macro names for mmc and uart reset offsets 61de1e6 ARM: sunxi: Correct comment for MBUS1 register in sun6i clock definitions
--- arch/arm/cpu/armv7/sunxi/Makefile | 1 + arch/arm/cpu/armv7/sunxi/clock_sun6i.c | 107 ++++++++++++++ arch/arm/include/asm/arch-sunxi/clock.h | 4 + arch/arm/include/asm/arch-sunxi/clock_sun6i.h | 205 ++++++++++++++++++++++++++ 4 files changed, 317 insertions(+) create mode 100644 arch/arm/cpu/armv7/sunxi/clock_sun6i.c create mode 100644 arch/arm/include/asm/arch-sunxi/clock_sun6i.h
arch/arm/cpu/armv7/sunxi/Makefile +1 -0
@@ -14,6 +14,7 @@ obj-y += pinmux.o obj-$(CONFIG_SUN6I) += 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 ifndef CONFIG_SPL_BUILD
arch/arm/cpu/armv7/sunxi/clock_sun6i.c new file +107 -0
107 lines not on this page · raw message
arch/arm/include/asm/arch-sunxi/clock.h +4 -0
@@ -15,7 +15,11 @@#define CLK_GATE_CLOSE 0x0/* clock control module regs definition */ +#ifdef CONFIG_SUN6I +#include <asm/arch/clock_sun6i.h> +#else #include <asm/arch/clock_sun4i.h> +#endif #ifndef __ASSEMBLY__int clock_init (void );
arch/arm/include/asm/arch-sunxi/clock_sun6i.h new file +205 -0
205 lines not on this page · raw message
Signature · 1 line
2.1.0
PATCH 4/7 ARM: sun6i: Add clock support
Quoted 1 line · Chen-Yu Tsai
+#ifdef
CONFIG_SPL_BUILD
Since there is no SPL support this is dead code right now, correct?
I'm wondering whether we should leave it out of mainline until the SPL stuff is done, so SPL will be upstreamed all at once. What do others think?
arch/arm/cpu/armv7/sunxi/clock_sun6i.c line 28
Quoted 1 line
arch/arm/cpu/armv7/sunxi/clock_sun6i.c new file +1
-0+/* Set PLL ldo voltage without this PLL6 does not work properly */
Is "this" here the doing it 3 times bit? If that's deliberate then please say so explicitly. e.g. "Set PLL LDO voltage 3 times, without ... etc"), if it's not deliberate then please fix ;-)
I'm assuming this is one of those "no docs, allwinner code did it but nobody knows why it works" scenarios. Of course if the reason is known/doc'd then please add a reference.
arch/arm/cpu/armv7/sunxi/clock_sun6i.c line 37
Quoted 9 lines
arch/arm/cpu/armv7/sunxi/clock_sun6i.c new file +9
-0+writel (PRCM_PLL_CTRL_LDO_DIGITAL_EN |PRCM_PLL_CTRL_LDO_ANALOG_EN | +PRCM_PLL_CTRL_EXT_OSC_EN |PRCM_PLL_CTRL_LDO_OUT_L (1140 ) | +PRCM_PLL_CTRL_LDO_KEY , &prcm->pll_ctrl1); +writel (PRCM_PLL_CTRL_LDO_DIGITAL_EN |PRCM_PLL_CTRL_LDO_ANALOG_EN | +PRCM_PLL_CTRL_EXT_OSC_EN |PRCM_PLL_CTRL_LDO_OUT_L (1140 ) | +PRCM_PLL_CTRL_LDO_KEY , &prcm->pll_ctrl1); +writel (PRCM_PLL_CTRL_LDO_DIGITAL_EN |PRCM_PLL_CTRL_LDO_ANALOG_EN | +PRCM_PLL_CTRL_EXT_OSC_EN |PRCM_PLL_CTRL_LDO_OUT_L (1140 ), + &prcm->pll_ctrl1);
[...]
Ian.
PATCH 4/7 ARM: sun6i: Add clock support
Quoted 5 lines · Ian Campbell
Quoted 1 line · Chen-Yu Tsai
+#ifdef
CONFIG_SPL_BUILDSince there is no SPL support this is dead code right now, correct?
This was part of Hans' attempt to support SPL. It was not finished.
Quoted 3 lines
I'm wondering whether we should leave it out of mainline until the SPL stuff is done, so SPL will be upstreamed all at once. What do others think?
Sounds reasonable.
Quoted 5 lines
Quoted 1 line
+ /* Set PLL ldo voltage without this PLL6 does not work properly */
Is "this" here the doing it 3 times bit? If that's deliberate then please say so explicitly. e.g. "Set PLL LDO voltage 3 times, without ... etc"), if it's not deliberate then please fix ;-)
Hans, if you could enlighten us? :)
Quoted 3 lines
I'm assuming this is one of those "no docs, allwinner code did it but nobody knows why it works" scenarios. Of course if the reason is known/doc'd then please add a reference.
I looked at the boot1 sources we recently got.
First it sets PRCM_PLL_CTRL_LDO_KEY to enable write access to the other values.
Then it sets PRCM_PLL_CTRL_IN_PWR_HIGH (which is the default) and PRCM_PLL_CTRL_LDO_OUT_L(1140) in one call.
Then it busy loops for some time to wait for it to stabilize.
Quoted 10 lines
Quoted 9 lines
arch/arm/cpu/armv7/sunxi/clock_sun6i.c new file +9
-0+writel (PRCM_PLL_CTRL_LDO_DIGITAL_EN |PRCM_PLL_CTRL_LDO_ANALOG_EN | +PRCM_PLL_CTRL_EXT_OSC_EN |PRCM_PLL_CTRL_LDO_OUT_L (1140 ) | +PRCM_PLL_CTRL_LDO_KEY , &prcm->pll_ctrl1); +writel (PRCM_PLL_CTRL_LDO_DIGITAL_EN |PRCM_PLL_CTRL_LDO_ANALOG_EN | +PRCM_PLL_CTRL_EXT_OSC_EN |PRCM_PLL_CTRL_LDO_OUT_L (1140 ) | +PRCM_PLL_CTRL_LDO_KEY , &prcm->pll_ctrl1); +writel (PRCM_PLL_CTRL_LDO_DIGITAL_EN |PRCM_PLL_CTRL_LDO_ANALOG_EN | +PRCM_PLL_CTRL_EXT_OSC_EN |PRCM_PLL_CTRL_LDO_OUT_L (1140 ), + &prcm->pll_ctrl1);[...]
ChenYu
PATCH 4/7 ARM: sun6i: Add clock support
Quoted 16 lines · Chen-Yu Tsai
Quoted 6 lines · Ian Campbell
Quoted 1 line · Chen-Yu Tsai
+ /* Set PLL ldo voltage without this PLL6 does not work properly */
Is "this" here the doing it 3 times bit? If that's deliberate then please say so explicitly. e.g. "Set PLL LDO voltage 3 times, without ... etc"), if it's not deliberate then please fix ;-)
Hans, if you could enlighten us? :)
Quoted 3 lines
I'm assuming this is one of those "no docs, allwinner code did it but nobody knows why it works" scenarios. Of course if the reason is known/doc'd then please add a reference.
I looked at the boot1 sources we recently got.
Quoted 7 lines
First it sets
PRCM_PLL_CTRL_LDO_KEYto enable write access to the other values.Then it sets
PRCM_PLL_CTRL_IN_PWR_HIGH(which is the default) andPRCM_PLL_CTRL_LDO_OUT_L(1140)in one call.Then it busy loops for some time to wait for it to stabilize.
My guess would be that 3 writes happens to cause enough time to pass that things have (often!) stabilised, which is certainly not as good as an explicit waiting busy loop. But as you say lets see what Hans says.
Quoted 14 lines
Quoted 11 lines
Quoted 10 lines
arch/arm/cpu/armv7/sunxi/clock_sun6i.c new file +9
-0+writel (PRCM_PLL_CTRL_LDO_DIGITAL_EN |PRCM_PLL_CTRL_LDO_ANALOG_EN | +PRCM_PLL_CTRL_EXT_OSC_EN |PRCM_PLL_CTRL_LDO_OUT_L (1140 ) | +PRCM_PLL_CTRL_LDO_KEY , &prcm->pll_ctrl1); +writel (PRCM_PLL_CTRL_LDO_DIGITAL_EN |PRCM_PLL_CTRL_LDO_ANALOG_EN | +PRCM_PLL_CTRL_EXT_OSC_EN |PRCM_PLL_CTRL_LDO_OUT_L (1140 ) | +PRCM_PLL_CTRL_LDO_KEY , &prcm->pll_ctrl1); +writel (PRCM_PLL_CTRL_LDO_DIGITAL_EN |PRCM_PLL_CTRL_LDO_ANALOG_EN | +PRCM_PLL_CTRL_EXT_OSC_EN |PRCM_PLL_CTRL_LDO_OUT_L (1140 ), + &prcm->pll_ctrl1);[...]
ChenYu
PATCH 4/7 ARM: sun6i: Add clock support
Quoted 20 lines · Ian Campbell
Quoted 19 lines · Chen-Yu Tsai
Quoted 6 lines · Ian Campbell
Quoted 1 line · Chen-Yu Tsai
+ /* Set PLL ldo voltage without this PLL6 does not work properly */
Is "this" here the doing it 3 times bit? If that's deliberate then please say so explicitly. e.g. "Set PLL LDO voltage 3 times, without ... etc"), if it's not deliberate then please fix ;-)
Hans, if you could enlighten us? :)
Quoted 3 lines
I'm assuming this is one of those "no docs, allwinner code did it but nobody knows why it works" scenarios. Of course if the reason is known/doc'd then please add a reference.
I looked at the boot1 sources we recently got.
First it sets
PRCM_PLL_CTRL_LDO_KEYto enable write access to the other values.
Quoted 8 lines
Quoted 4 lines
Then it sets
PRCM_PLL_CTRL_IN_PWR_HIGH(which is the default) andPRCM_PLL_CTRL_LDO_OUT_L(1140)in one call.Then it busy loops for some time to wait for it to stabilize.
My guess would be that 3 writes happens to cause enough time to pass that things have (often!) stabilised, which is certainly not as good as an explicit waiting busy loop. But as you say lets see what Hans says.
FYI I'm dropping this part from the patch, so this discussion is for future reference. :)
Quoted 10 lines
Quoted 10 lines
Quoted 10 lines
Quoted 9 lines
arch/arm/cpu/armv7/sunxi/clock_sun6i.c new file +9
-0+writel (PRCM_PLL_CTRL_LDO_DIGITAL_EN |PRCM_PLL_CTRL_LDO_ANALOG_EN | +PRCM_PLL_CTRL_EXT_OSC_EN |PRCM_PLL_CTRL_LDO_OUT_L (1140 ) | +PRCM_PLL_CTRL_LDO_KEY , &prcm->pll_ctrl1); +writel (PRCM_PLL_CTRL_LDO_DIGITAL_EN |PRCM_PLL_CTRL_LDO_ANALOG_EN | +PRCM_PLL_CTRL_EXT_OSC_EN |PRCM_PLL_CTRL_LDO_OUT_L (1140 ) | +PRCM_PLL_CTRL_LDO_KEY , &prcm->pll_ctrl1); +writel (PRCM_PLL_CTRL_LDO_DIGITAL_EN |PRCM_PLL_CTRL_LDO_ANALOG_EN | +PRCM_PLL_CTRL_EXT_OSC_EN |PRCM_PLL_CTRL_LDO_OUT_L (1140 ), + &prcm->pll_ctrl1);[...]
PATCH 4/7 ARM: sun6i: Add clock support
In reply to Chen-Yu TsaiHi,
Quoted 15 lines · Chen-Yu Tsai
Quoted 5 lines · Ian Campbell
Quoted 1 line · Chen-Yu Tsai
+#ifdef
CONFIG_SPL_BUILDSince there is no SPL support this is dead code right now, correct?
This was part of Hans' attempt to support SPL. It was not finished.
Quoted 3 lines
I'm wondering whether we should leave it out of mainline until the SPL stuff is done, so SPL will be upstreamed all at once. What do others think?
Sounds reasonable.
Quoted 7 lines
Quoted 5 lines
Quoted 1 line
+ /* Set PLL ldo voltage without this PLL6 does not work properly */
Is "this" here the doing it 3 times bit? If that's deliberate then please say so explicitly. e.g. "Set PLL LDO voltage 3 times, without ... etc"), if it's not deliberate then please fix ;-)
Hans, if you could enlighten us? :)
If you take a closer look at the code you will see not all 3 writes are the same:
/* Set PLL ldo voltage without this PLL6 does not work properly */
writel(PRCM_PLL_CTRL_LDO_DIGITAL_EN | PRCM_PLL_CTRL_LDO_ANALOG_EN |
PRCM_PLL_CTRL_EXT_OSC_EN | PRCM_PLL_CTRL_LDO_OUT_L(1140) |
PRCM_PLL_CTRL_LDO_KEY, &prcm->pll_ctrl1);
writel(PRCM_PLL_CTRL_LDO_DIGITAL_EN | PRCM_PLL_CTRL_LDO_ANALOG_EN |
PRCM_PLL_CTRL_EXT_OSC_EN | PRCM_PLL_CTRL_LDO_OUT_L(1140) |
PRCM_PLL_CTRL_LDO_KEY, &prcm->pll_ctrl1);
writel(PRCM_PLL_CTRL_LDO_DIGITAL_EN | PRCM_PLL_CTRL_LDO_ANALOG_EN |
PRCM_PLL_CTRL_EXT_OSC_EN | PRCM_PLL_CTRL_LDO_OUT_L(1140),
&prcm->pll_ctrl1);This register is locked with a so called "key", the first write is to set the key (and has everything else the same in case the key is already written). The second write actually makes the changes, and the third write clears the key bits.
I guess this may need some better comments :)
Regards,
Hans
PATCH 4/7 ARM: sun6i: Add clock support
Quoted 14 lines · Hans de Goede
If you take a closer look at the code you will see not all 3 writes are the same:
/* Set PLL ldo voltage without this PLL6 does not work properly */ writel(PRCM_PLL_CTRL_LDO_DIGITAL_EN | PRCM_PLL_CTRL_LDO_ANALOG_EN | PRCM_PLL_CTRL_EXT_OSC_EN | PRCM_PLL_CTRL_LDO_OUT_L(1140) | PRCM_PLL_CTRL_LDO_KEY, &prcm->pll_ctrl1); writel(PRCM_PLL_CTRL_LDO_DIGITAL_EN | PRCM_PLL_CTRL_LDO_ANALOG_EN | PRCM_PLL_CTRL_EXT_OSC_EN | PRCM_PLL_CTRL_LDO_OUT_L(1140) | PRCM_PLL_CTRL_LDO_KEY, &prcm->pll_ctrl1); writel(PRCM_PLL_CTRL_LDO_DIGITAL_EN | PRCM_PLL_CTRL_LDO_ANALOG_EN | PRCM_PLL_CTRL_EXT_OSC_EN | PRCM_PLL_CTRL_LDO_OUT_L(1140), &prcm->pll_ctrl1);
Quoted 4 lines
This register is locked with a so called "key", the first write is to set the key (and has everything else the same in case the key is already written). The second write actually makes the changes, and the third write clears the key bits.
Even after staring really hard I still don't see what differs in the first and second ones ;-)
Quoted 1 line
I guess this may need some better comments :)
Perhaps setclr_bits and friends might help make it obvious what is changing at each phase by allowing the other values to be omitted?
Or maybe a #define for the settings themselves so that the remaining bits stand out more?
Ian.
PATCH 4/7 ARM: sun6i: Add clock support
Hi,
Quoted 15 lines · Ian Campbell
Quoted 14 lines · Hans de Goede
If you take a closer look at the code you will see not all 3 writes are the same:
/* Set PLL ldo voltage without this PLL6 does not work properly */ writel(PRCM_PLL_CTRL_LDO_DIGITAL_EN | PRCM_PLL_CTRL_LDO_ANALOG_EN | PRCM_PLL_CTRL_EXT_OSC_EN | PRCM_PLL_CTRL_LDO_OUT_L(1140) | PRCM_PLL_CTRL_LDO_KEY, &prcm->pll_ctrl1); writel(PRCM_PLL_CTRL_LDO_DIGITAL_EN | PRCM_PLL_CTRL_LDO_ANALOG_EN | PRCM_PLL_CTRL_EXT_OSC_EN | PRCM_PLL_CTRL_LDO_OUT_L(1140) | PRCM_PLL_CTRL_LDO_KEY, &prcm->pll_ctrl1); writel(PRCM_PLL_CTRL_LDO_DIGITAL_EN | PRCM_PLL_CTRL_LDO_ANALOG_EN | PRCM_PLL_CTRL_EXT_OSC_EN | PRCM_PLL_CTRL_LDO_OUT_L(1140), &prcm->pll_ctrl1);
Quoted 7 lines
Quoted 4 lines
This register is locked with a so called "key", the first write is to set the key (and has everything else the same in case the key is already written). The second write actually makes the changes, and the third write clears the key bits.
Even after staring really hard I still don't see what differs in the first and second ones ;-)
Right, that is because there is no change between the first 2, I guess using setclr_bits to first only set the key, then only the bits, then only clear the key would be a good idea here :)
Regards,
Hans
PATCH 4/7 ARM: sun6i: Add clock support
Quoted 22 lines · Hans de Goede
Hi,
Quoted 19 lines · Ian Campbell
Quoted 18 lines · Hans de Goede
If you take a closer look at the code you will see not all 3 writes are the same:
/* Set PLL ldo voltage without this PLL6 does not work properly */ writel(PRCM_PLL_CTRL_LDO_DIGITAL_EN | PRCM_PLL_CTRL_LDO_ANALOG_EN | PRCM_PLL_CTRL_EXT_OSC_EN | PRCM_PLL_CTRL_LDO_OUT_L(1140) | PRCM_PLL_CTRL_LDO_KEY, &prcm->pll_ctrl1); writel(PRCM_PLL_CTRL_LDO_DIGITAL_EN | PRCM_PLL_CTRL_LDO_ANALOG_EN | PRCM_PLL_CTRL_EXT_OSC_EN | PRCM_PLL_CTRL_LDO_OUT_L(1140) | PRCM_PLL_CTRL_LDO_KEY, &prcm->pll_ctrl1); writel(PRCM_PLL_CTRL_LDO_DIGITAL_EN | PRCM_PLL_CTRL_LDO_ANALOG_EN | PRCM_PLL_CTRL_EXT_OSC_EN | PRCM_PLL_CTRL_LDO_OUT_L(1140), &prcm->pll_ctrl1);This register is locked with a so called "key", the first write is to set the key (and has everything else the same in case the key is already written). The second write actually makes the changes, and the third write clears the key bits.
Quoted 5 lines
Quoted 2 lines
Even after staring really hard I still don't see what differs in the first and second ones ;-)
Right, that is because there is no change between the first 2, I guess using
setclr_bitsto first only set the key, then only the bits, then only clear the key would be a good idea here :)
I think I wrote those lines ages ago, and I think i used writel instead of setclr_bits and friends initially, was to first 'copy' over the original implementation and swap magic values for defines. Once that could be verified to working, change over to prettier code :)
Granted, Since we have little docs and no comments, merging the first two lines requires some testing, which without hardware is near impossible. It would have probably worked having only set the key on the first line, key + values on the second and leave 3rd as is.
Olliver
Quoted 4 lines
Regards,
Hans
PATCH 5/7 ARM: sunxi-mmc: Add mmc support for sun6i / A31
In reply to Chen-Yu TsaiFrom: Hans de Goede <[email protected]>
[wens at csie.org: use setbits_le32 for reset control, drop obsolete changes,
squash "sunxi-mmc: sun6i has its fifo at a different address"]
--- arch/arm/include/asm/arch-sunxi/mmc.h | 2 -- drivers/mmc/sunxi_mmc.c | 9 +++++++++ 2 files changed, 9 insertions(+), 2 deletions(-)
arch/arm/include/asm/arch-sunxi/mmc.h +0 -2
@@ -42,8 +42,6 @@ struct sunxi_mmc {u32 idie;/* 0x8c internal DMA interrupt enable */ u32 chda;/* 0x90 */ u32 cbda;/* 0x94 */ -u32 res1[26 ]; -u32 fifo;/* 0x100 FIFO access address */ };#define SUNXI_MMC_CLK_POWERSAVE (0x1 << 17)
drivers/mmc/sunxi_mmc.c +9 -0
@@ -57,7 +57,11 @@ static int mmc_resource_init(int sdc_no)printf ("Wrong mmc number %d\n" , sdc_no);return -1 ; } +#ifdef CONFIG_SUN6I + mmchost->database = (unsigned int )mmchost->reg +0x200 ; +#else mmchost->database = (unsigned int )mmchost->reg +0x100 ; +#endif mmchost->mmc_no = sdc_no;return 0 ;
@@ -75,6 +79,11 @@ 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 ) +/* unassert reset */ +setbits_le32 (&ccm->ahb_reset0_cfg,1 <<AHB_RESET_OFFSET_MMC (sdc_no)); +#endif +/* config mod clock */ pll_clk =clock_get_pll6 ();/* should be close to 100 MHz but no more, so round up */
Signature · 1 line
2.1.0
PATCH 5/7 ARM: sunxi-mmc: Add mmc support for sun6i / A31
Quoted 6 lines · Chen-Yu Tsai
From: Hans de Goede <[email protected]>
Signed-off-by Hans de Goede <[email protected]>[wens at csie.org: use
setbits_le32for reset control, drop obsolete changes,
squash "sunxi-mmc: sun6i has its fifo at a different address"]Signed-off-by Chen-Yu Tsai <[email protected]>
Adding CC to Pantelis (MMC custodian).
Pantelis, once you are happy with this I propose we take this via the sunxi tree along with the rest of the series.
For my part I only have nitpicks:
Quoted 10 lines
--- arch/arm/include/asm/arch-sunxi/mmc.h | 2 -- drivers/mmc/sunxi_mmc.c | 9 +++++++++ 2 files changed, 9 insertions(+), 2 deletions(-)arch/arm/include/asm/arch-sunxi/mmc.h +0
-0
arch/arm/include/asm/arch-sunxi/mmc.h struct sunxi_mmc { · line 46
Quoted 5 lines
arch/arm/include/asm/arch-sunxi/mmc.h +0
-2@@ -42,8 +42,6 @@ struct sunxi_mmc {u32 idie;/* 0x8c internal DMA interrupt enable */ u32 chda;/* 0x90 */ u32 cbda;/* 0x94 */ -u32 res1[26 ]; -u32 fifo;/* 0x100 FIFO access address */
This seems unrelated to the stated purpose of the commit, should probably be a separate cleanup.
Quoted 8 lines
arch/arm/include/asm/arch-sunxi/mmc.h +0
-0};#define SUNXI_MMC_CLK_POWERSAVE (0x1 << 17)drivers/mmc/sunxi_mmc.c +0
-0
drivers/mmc/sunxi_mmc.c static int mmc_resource_init(int sdc_no) · line 64
Quoted 8 lines
drivers/mmc/sunxi_mmc.c +4
-0@@ -57,7 +57,11 @@ static int mmc_resource_init(int sdc_no)printf ("Wrong mmc number %d\n" , sdc_no);return -1 ; } +#ifdef CONFIG_SUN6I + mmchost->database = (unsigned int )mmchost->reg +0x200 ; +#else mmchost->database = (unsigned int )mmchost->reg +0x100 ; +#endif
Adding a #define to ./include/configs/sun?i.h would be preferred, I think.
Ian.
PATCH 5/7 ARM: sunxi-mmc: Add mmc support for sun6i / A31
Quoted 20 lines · Ian Campbell
Quoted 6 lines · Chen-Yu Tsai
From: Hans de Goede <[email protected]>
Signed-off-by Hans de Goede <[email protected]>[wens at csie.org: use
setbits_le32for reset control, drop obsolete changes,
squash "sunxi-mmc: sun6i has its fifo at a different address"]Signed-off-by Chen-Yu Tsai <[email protected]>Adding CC to Pantelis (MMC custodian).
Pantelis, once you are happy with this I propose we take this via the sunxi tree along with the rest of the series.
For my part I only have nitpicks:
Quoted 5 lines
--- arch/arm/include/asm/arch-sunxi/mmc.h | 2 -- drivers/mmc/sunxi_mmc.c | 9 +++++++++ 2 files changed, 9 insertions(+), 2 deletions(-)
Quoted 13 lines
arch/arm/include/asm/arch-sunxi/mmc.h struct sunxi_mmc { · line 46
Quoted 10 lines
arch/arm/include/asm/arch-sunxi/mmc.h +0
-2@@ -42,8 +42,6 @@ struct sunxi_mmc {u32 idie;/* 0x8c internal DMA interrupt enable */ u32 chda;/* 0x90 */ u32 cbda;/* 0x94 */ -u32 res1[26 ]; -u32 fifo;/* 0x100 FIFO access address */ This seems unrelated to the stated purpose of the commit, should probably be a separate cleanup.
This was part of "sunxi-mmc: sun6i has its fifo at a different address", but yeah, it definitely looks like a separate cleanup now. I'll split it out.
Quoted 11 lines
Quoted 11 lines
arch/arm/include/asm/arch-sunxi/mmc.h +0
-0};#define SUNXI_MMC_CLK_POWERSAVE (0x1 << 17)drivers/mmc/sunxi_mmc.c +0
-0@@ -57,7 +57,11 @@ static int mmc_resource_init(int sdc_no)printf ("Wrong mmc number %d\n" , sdc_no);return -1 ; }
Quoted 8 lines
drivers/mmc/sunxi_mmc.c static int mmc_resource_init(int sdc_no) · line 64
Quoted 5 lines
drivers/mmc/sunxi_mmc.c +4
-0+#ifdef CONFIG_SUN6I + mmchost->database = (unsigned int )mmchost->reg +0x200 ; +#else mmchost->database = (unsigned int )mmchost->reg +0x100 ; +#endif Adding a #define to ./include/configs/sun?i.h would be preferred, I think.
Sounds reasonable. I wonder what else (in other drivers) we should move over there.
ChenYu
PATCH 5/7 ARM: sunxi-mmc: Add mmc support for sun6i / A31
Quoted 59 lines · Chen-Yu Tsai
Quoted 20 lines · Ian Campbell
Quoted 6 lines · Chen-Yu Tsai
From: Hans de Goede <[email protected]>
Signed-off-by Hans de Goede <[email protected]>[wens at csie.org: use
setbits_le32for reset control, drop obsolete changes,
squash "sunxi-mmc: sun6i has its fifo at a different address"]Signed-off-by Chen-Yu Tsai <[email protected]>Adding CC to Pantelis (MMC custodian).
Pantelis, once you are happy with this I propose we take this via the sunxi tree along with the rest of the series.
For my part I only have nitpicks:
Quoted 5 lines
--- arch/arm/include/asm/arch-sunxi/mmc.h | 2 -- drivers/mmc/sunxi_mmc.c | 9 +++++++++ 2 files changed, 9 insertions(+), 2 deletions(-)Quoted 13 lines
arch/arm/include/asm/arch-sunxi/mmc.h struct sunxi_mmc { · line 46
Quoted 10 lines
arch/arm/include/asm/arch-sunxi/mmc.h +0
-2@@ -42,8 +42,6 @@ struct sunxi_mmc {u32 idie;/* 0x8c internal DMA interrupt enable */ u32 chda;/* 0x90 */ u32 cbda;/* 0x94 */ -u32 res1[26 ]; -u32 fifo;/* 0x100 FIFO access address */ This seems unrelated to the stated purpose of the commit, should probably be a separate cleanup.
This was part of "sunxi-mmc: sun6i has its fifo at a different address", but yeah, it definitely looks like a separate cleanup now. I'll split it out.
Quoted 11 lines
Quoted 11 lines
arch/arm/include/asm/arch-sunxi/mmc.h +0
-0};#define SUNXI_MMC_CLK_POWERSAVE (0x1 << 17)drivers/mmc/sunxi_mmc.c +0
-0@@ -57,7 +57,11 @@ static int mmc_resource_init(int sdc_no)printf ("Wrong mmc number %d\n" , sdc_no);return -1 ; }Quoted 8 lines
drivers/mmc/sunxi_mmc.c static int mmc_resource_init(int sdc_no) · line 64
Quoted 5 lines
drivers/mmc/sunxi_mmc.c +4
-0+#ifdef CONFIG_SUN6I + mmchost->database = (unsigned int )mmchost->reg +0x200 ; +#else mmchost->database = (unsigned int )mmchost->reg +0x100 ; +#endif Adding a #define to ./include/configs/sun?i.h would be preferred, I think.
Quoted 2 lines
Sounds reasonable. I wonder what else (in other drivers) we should move over there.
Ian, include/configs/sun?i.h and sunxi-common.h only have config related #defines. Are we sure this is the place for something like register offsets?
For reference, drivers/i2c/mvtwsi.c has sunxi specific register offsets wrapped in a #define in the file itself.
Cheers
ChenYu
PATCH 5/7 ARM: sunxi-mmc: Add mmc support for sun6i / A31
Quoted 3 lines · Chen-Yu Tsai
Ian, include/configs/sun?i.h and
sunxi-common.honly have config related #defines. Are we sure this is the place for something like register offsets?
I guess not ;-)
Quoted 2 lines
For reference,
drivers/i2c/mvtwsi.chas sunxi specific register offsets wrapped in a #define in the file itself.
How about either ./arch/arm/include/asm/arch-sunxi/mmc.h or near the top of this C file (i.e. outside the code itself)?
Ian.
PATCH 5/7 ARM: sunxi-mmc: Add mmc support for sun6i / A31
Quoted 5 lines · Ian Campbell
Quoted 3 lines · Chen-Yu Tsai
Ian, include/configs/sun?i.h and
sunxi-common.honly have config related #defines. Are we sure this is the place for something like register offsets?
Quoted 7 lines
I guess not ;-)
Quoted 2 lines
For reference,
drivers/i2c/mvtwsi.chas sunxi specific register offsets wrapped in a #define in the file itself.How about either
./arch/arm/include/asm/arch-sunxi/mmc.hor near the top of this C file (i.e. outside the code itself)?
Adding it to the register definitions in ./arch/arm/include/asm/arch-sunxi/mmc.h seems like a good choice. The last bit of struct sunxi_mmc would be like:
u32 idie; /* 0x8c internal DMA interrupt enable */
u32 chda; /* 0x90 */
u32 cbda; /* 0x94 */
#if defined(CONFIG_SUN6I)
u32 res1[126];
#else
u32 res1[26];
#endif
u32 fifo; /* 0x100 (0x200 on sun6i) FIFO access address */};
And have
mmchost->database = &mmchost->reg->fifo;
Or just get rid of ->database and use ->reg->fifo directly. The latter seems better.
ChenYu
PATCH 5/7 ARM: sunxi-mmc: Add mmc support for sun6i / A31
Quoted 26 lines · Chen-Yu Tsai
Quoted 5 lines · Ian Campbell
Quoted 3 lines · Chen-Yu Tsai
Ian, include/configs/sun?i.h and
sunxi-common.honly have config related #defines. Are we sure this is the place for something like register offsets?Quoted 7 lines
I guess not ;-)
Quoted 2 lines
For reference,
drivers/i2c/mvtwsi.chas sunxi specific register offsets wrapped in a #define in the file itself.How about either
./arch/arm/include/asm/arch-sunxi/mmc.hor near the top of this C file (i.e. outside the code itself)?Adding it to the register definitions in
./arch/arm/include/asm/arch-sunxi/mmc.hseems like a good choice. The last bit of structsunxi_mmcwould be like:u32 idie; /* 0x8c internal DMA interrupt enable */ u32 chda; /* 0x90 */ u32 cbda; /* 0x94 */ #if defined(CONFIG_SUN6I) u32 res1[126]; #else u32 res1[26]; #endif u32 fifo; /* 0x100 (0x200 on sun6i) FIFO access address */
Quoted 8 lines
};
And have
mmchost->database = &mmchost->reg->fifo;Or just get rid of ->database and use ->reg->fifo directly. The latter seems better.
Yep, sounds good.
You could also consider just
#if defined(CONFIG_SUN6I)
u32 res2[100];#endif
after the existing res1.
PATCH 6/7 ARM: sun6i: Setup the A31 UART0 muxing
In reply to Chen-Yu TsaiFrom: Maxime Ripard <[email protected]>
--- arch/arm/cpu/armv7/sunxi/board.c | 4 ++++ 1 file changed, 4 insertions(+)
arch/arm/cpu/armv7/sunxi/board.c +4 -0
@@ -54,6 +54,10 @@ int gpio_init(void)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 ),1 ); +#elif CONFIG_CONS_INDEX ==1 && defined(CONFIG_SUN6I ) +sunxi_gpio_set_cfgpin (SUNXI_GPH (20 ),2 ); +sunxi_gpio_set_cfgpin (SUNXI_GPH (21 ),2 ); +sunxi_gpio_set_pull (SUNXI_GPH (21 ),1 );#elif CONFIG_CONS_INDEX ==1 && defined(CONFIG_SUN5I )sunxi_gpio_set_cfgpin (SUNXI_GPB (19 ),SUN5I_GPB19_UART0_TX );sunxi_gpio_set_cfgpin (SUNXI_GPB (20 ),SUN5I_GPB20_UART0_RX );
Signature · 1 line
2.1.0
PATCH 6/7 ARM: sun6i: Setup the A31 UART0 muxing
Quoted 6 lines · Chen-Yu Tsai
From: Maxime Ripard <[email protected]>
Signed-off-by Maxime Ripard <[email protected]>Signed-off-by Hans de Goede <[email protected]>[wens at csie.org: commit message was "ARM: sunxi: Setup the A31 UART0 muxing"]Signed-off-by Chen-Yu Tsai <[email protected]>
PATCH 6/7 ARM: sun6i: Setup the A31 UART0 muxing
In reply to Chen-Yu TsaiHi
Il 08/set/2014 15:36 "Chen-Yu Tsai" <[email protected]> ha scritto:
Quoted 6 lines
From: Maxime Ripard <[email protected]>
Signed-off-by Maxime Ripard <[email protected]>Signed-off-by Hans de Goede <[email protected]>[wens at csie.org: commit message was "ARM: sunxi: Setup the A31 UART0
muxing"]
Review
Quoted 6 lines
Signed-off-by Chen-Yu Tsai <[email protected]>--- arch/arm/cpu/armv7/sunxi/board.c | 4 ++++ 1 file changed, 4 insertions(+)(quoted diff) +0
-0
b/arch/arm/cpu/armv7/sunxi/board.c
Quoted 15 lines
index f2cedbb..fc6aa4b 100644
arch/arm/cpu/armv7/sunxi/board.c +4
-1@@ -54,6 +54,10 @@ int gpio_init(void)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 ),1 ); +#elif CONFIG_CONS_INDEX ==1 && defined(CONFIG_SUN6I ) +sunxi_gpio_set_cfgpin (SUNXI_GPH (20 ),2 ); +sunxi_gpio_set_cfgpin (SUNXI_GPH (21 ),2 ); +sunxi_gpio_set_pull (SUNXI_GPH (21 ),1 );#elif CONFIG_CONS_INDEX ==1 && defined(CONFIG_SUN5I )sunxi_gpio_set_cfgpin (SUNXI_GPB (19 ),SUN5I_GPB19_UART0_TX );sunxi_gpio_set_cfgpin (SUNXI_GPB (20 ),SUN5I_GPB20_UART0_RX ); --
Quoted 2 lines
2.1.0
I don't know if it is correct that every architecture has a specific function to MUX, but can we define what is 2 2 and 1?
Michael
Quoted 4 lines
_______________________________________________
U-Boot mailing list
U-Boot at lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot
PATCH 6/7 ARM: sun6i: Setup the A31 UART0 muxing
Quoted 31 lines · Michael Trimarchi
Hi
Il 08/set/2014 15:36 "Chen-Yu Tsai" <[email protected]> ha scritto:
Quoted 26 lines
From: Maxime Ripard <[email protected]>
Signed-off-by Maxime Ripard <[email protected]>Signed-off-by Hans de Goede <[email protected]>[wens at csie.org: commit message was "ARM: sunxi: Setup the A31 UART0 muxing"]
Signed-off-by Chen-Yu Tsai <[email protected]>--- arch/arm/cpu/armv7/sunxi/board.c | 4 ++++ 1 file changed, 4 insertions(+)arch/arm/cpu/armv7/sunxi/board.c +4
-0@@ -54,6 +54,10 @@ int gpio_init(void)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 ),1 ); +#elif CONFIG_CONS_INDEX ==1 && defined(CONFIG_SUN6I ) +sunxi_gpio_set_cfgpin (SUNXI_GPH (20 ),2 ); +sunxi_gpio_set_cfgpin (SUNXI_GPH (21 ),2 ); +sunxi_gpio_set_pull (SUNXI_GPH (21 ),1 );#elif CONFIG_CONS_INDEX ==1 && defined(CONFIG_SUN5I )
Quoted 8 lines
Quoted 5 lines
arch/arm/cpu/armv7/sunxi/board.c +0
-1sunxi_gpio_set_cfgpin (SUNXI_GPB (19 ),SUN5I_GPB19_UART0_TX );sunxi_gpio_set_cfgpin (SUNXI_GPB (20 ),SUN5I_GPB20_UART0_RX ); --2.1.0
I don't know if it is correct that every architecture has a specific function to MUX, but can we define what is 2 2 and 1?
Yes they do. I will add them in a patch before this one in v2, and also a separate patch to clean up the existing sunxi_gpio_set_pull calls.
ChenYu
PATCH 7/7 ARM: sunxi: Add basic A31 support
In reply to Chen-Yu TsaiFrom: Maxime Ripard <[email protected]>
Add a new sun6i machine that doesn't do much for now.
[wens at csie.org: use SPDX labels, adapt to Kconfig system, drop ifdef
around mmc and smp code, drop MACH_TYPE]
--- arch/arm/Kconfig | 3 +++ arch/arm/cpu/armv7/sunxi/cpu_info.c | 2 ++ board/sunxi/Kconfig | 10 +++++++++- configs/Colombus_defconfig | 4 ++++ include/configs/sun6i.h | 26 ++++++++++++++++++++++++++ 5 files changed, 44 insertions(+), 1 deletion(-) create mode 100644 configs/Colombus_defconfig create mode 100644 include/configs/sun6i.h
arch/arm/Kconfig +3 -0
@@ -439,6 +439,9 @@ config TARGET_SUN4I config TARGET_SUN5I bool "Support sun5i" +config TARGET_SUN6I + bool "Support sun6i" + config TARGET_SUN7I bool "Support sun7i"
arch/arm/cpu/armv7/sunxi/cpu_info.c +2 -0
@@ -23,6 +23,8 @@ int print_cpuinfo(void)case 7 :puts ("CPU: Allwinner A10s (SUN5I)\n" );break ; default: puts("CPU: Allwinner A1X (SUN5I)\n"); } +#elif defined CONFIG_SUN6I +puts ("CPU: Allwinner A31 (SUN6I)\n" );#elif defined CONFIG_SUN7Iputs ("CPU: Allwinner A20 (SUN7I)\n" );#else
board/sunxi/Kconfig +9 -1
@@ -14,6 +14,14 @@ config SYS_CONFIG_NAME endif +if TARGET_SUN6I + +config SYS_CONFIG_NAME + string + default "sun6i" + +endif + if TARGET_SUN7I config SYS_CONFIG_NAME
@@ -22,7 +30,7 @@ config SYS_CONFIG_NAME endif -if TARGET_SUN4I || TARGET_SUN5I || TARGET_SUN7I +if TARGET_SUN4I || TARGET_SUN5I || TARGET_SUN6I || TARGET_SUN7I config SYS_CPU string
configs/Colombus_defconfig new file +4 -0
@@ -0,0 +1,4 @@ +CONFIG_SYS_EXTRA_OPTIONS="COLOMBUS" +CONFIG_ARM=y +CONFIG_TARGET_SUN6I=y +CONFIG_FDTFILE="sun6i-a31-colombus.dtb"
include/configs/sun6i.h new file +26 -0
@@ -0,0 +1,26 @@ +/* +* (C) Copyright 2012-2013 Henrik Nordstrom <[email protected]> +* (C) Copyright 2013 Luke Kenneth Casson Leighton <[email protected]> +* (C) Copyright 2013 Maxime Ripard <[email protected]> +* +* Configuration settings for the Allwinner A31 (sun6i) CPU +* +* SPDX-License-Identifier: GPL-2.0+ +*/ + +#ifndef __CONFIG_H +#define __CONFIG_H + +/* +* A31 specific configuration +*/ +#define CONFIG_SUN6I /* sun6i SoC generation */ + +#define CONFIG_SYS_PROMPT "sun6i# " + +/* +* Include common sunxi configuration where most the settings are +*/ +#include <configs/sunxi-common.h> + +#endif /* __CONFIG_H */
Signature · 1 line
2.1.0
PATCH 7/7 ARM: sunxi: Add basic A31 support
Quoted 3 lines · Chen-Yu Tsai
From: Maxime Ripard <[email protected]>
Add a new sun6i machine that doesn't do much for now.
Can you briefly outline here what it _does_ do, please.
The actual code looks ok to me. There is some possibility we might consolidate some of these Kconfig options, or at least move them to the sunxi Kconfig. We can cross the bridge when we come to it though.
Any links to some info about the Colombus? Is it the WITS development kit which google found for me?
Ian.
PATCH 7/7 ARM: sunxi: Add basic A31 support
Hi Ian,
Quoted 6 lines · Ian Campbell
Quoted 3 lines · Chen-Yu Tsai
From: Maxime Ripard <[email protected]>
Add a new sun6i machine that doesn't do much for now.
Can you briefly outline here what it _does_ do, please.
When I contributed this patch, it was only having the UART support, but judging from the rest of the patches Chen-Yu sent, I guess it does a bit more than that now, especially MMC.
Quoted 6 lines
The actual code looks ok to me. There is some possibility we might consolidate some of these
Kconfigoptions, or at least move them to the sunxiKconfig. We can cross the bridge when we come to it though.Any links to some info about the Colombus? Is it the WITS development kit which google found for me?
It is.
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: not available Type: application/pgp-signature Size: 819 bytes Desc: Digital signature URL: <http://lists.denx.de/pipermail/u-boot/attachments/20140921/9486ea4e/attachment.pgp>
PATCH 7/7 ARM: sunxi: Add basic A31 support
Quoted 6 lines · Maxime Ripard
Hi Ian,
Quoted 3 lines · Ian Campbell
Quoted 2 lines · Chen-Yu Tsai
From: Maxime Ripard <[email protected]>
Quoted 7 lines
Quoted 3 lines
Quoted 1 line
Add a new sun6i machine that doesn't do much for now.
Can you briefly outline here what it _does_ do, please.
When I contributed this patch, it was only having the UART support, but judging from the rest of the patches Chen-Yu sent, I guess it does a bit more than that now, especially MMC.
Yeah. I'll rewrite the commit message.
Quoted 8 lines
Quoted 6 lines
The actual code looks ok to me. There is some possibility we might consolidate some of these
Kconfigoptions, or at least move them to the sunxiKconfig. We can cross the bridge when we come to it though.Any links to some info about the Colombus? Is it the WITS development kit which google found for me?
It is.
I'll split out the Colombus defconfig into a separate patch, like we split machine support and board files for the kernel.
ChenYu
cover ARM: sunxi: Add basic support for Allwinner A31 (sun6i)
In reply to Chen-Yu TsaiHi,
Quoted 25 lines · Chen-Yu Tsai
Hi everyone,
This series add basic support for Allwinner's A31 SoC. The patches, excluding the first one, were cherry-picked from u-boot-sunxi. Due to the difference between u-boot mainline and u-boot-sunxi, some patches were rearranged or squashed to better fit the current state of u-boot, and not introduce any build breaks. It follows Ian's initial merge method of sun7i support: introducing various components first, then enabling them in the last commit. I tried to keep the commits separate, thus retaining the original author and Signed-off-bys.
Patch 1 adds a wrapper around "
func(USB, usb, 0)" inBOOT_TARGET_DEVICESto deal with breakage when USB support is not enabled.Patch 2 adds memory addresses for some hardware blocks new in sun6i.
Patch 3 adds support for the new PRCM (power reset and clock management) block, which also contains PLL bias voltage control.
Patch 4 adds support for the clock module. This patch is a bunch of different sun6i related patches on the clock code, from when sun6i support was introduced to u-boot-sunxi, up to its current form. This is done to avoid various conflicts and needlessly introducing then removing macros.
Quoted 5 lines
Patch 5 adds mmc support on sun6i.
Patch 6 adds uart0 muxing on sun6i.
Patch 7 enables sun6i support and adds defconfig for the Colombus board.
Chen,
Many thanks for working on this!
Just a quick not for people celebrating too early, this is the *incomplete* sun7i support from the linux-sunxi/u-boot-sunxi git repo. It is fine to merge this upstream, but this does not include SPL support.
This allows replacing u-boot.bin on allwinnner sd-card images, which is very useful. But it does not get us all the way to booting sun7i devices we still need boot0 and boot1 binaries from allwinner for that (for now).
Regards,
Hans
Quoted 38 lines · On Tue, 09 Sep 2014 09:00:57 +0200 Hans de Goede <[email protected]> wrote:
Hi,
Quoted 25 lines · Chen-Yu Tsai
Hi everyone,
This series add basic support for Allwinner's A31 SoC. The patches, excluding the first one, were cherry-picked from u-boot-sunxi. Due to the difference between u-boot mainline and u-boot-sunxi, some patches were rearranged or squashed to better fit the current state of u-boot, and not introduce any build breaks. It follows Ian's initial merge method of sun7i support: introducing various components first, then enabling them in the last commit. I tried to keep the commits separate, thus retaining the original author and Signed-off-bys.
Patch 1 adds a wrapper around "
func(USB, usb, 0)" inBOOT_TARGET_DEVICESto deal with breakage when USB support is not enabled.Patch 2 adds memory addresses for some hardware blocks new in sun6i.
Patch 3 adds support for the new PRCM (power reset and clock management) block, which also contains PLL bias voltage control.
Patch 4 adds support for the clock module. This patch is a bunch of different sun6i related patches on the clock code, from when sun6i support was introduced to u-boot-sunxi, up to its current form. This is done to avoid various conflicts and needlessly introducing then removing macros.
Quoted 5 lines
Patch 5 adds mmc support on sun6i.
Patch 6 adds uart0 muxing on sun6i.
Patch 7 enables sun6i support and adds defconfig for the Colombus board.
Chen,
Many thanks for working on this!
Quoted 7 lines
Just a quick not for people celebrating too early, this is the *incomplete* sun7i support from the linux-sunxi/u-boot-sunxi git repo. It is fine to merge this upstream, but this does not include SPL support.
This allows replacing u-boot.bin on allwinnner sd-card images, which is very useful. But it does not get us all the way to booting sun7i devices we still need boot0 and boot1 binaries from allwinner for that (for now).
If I understand it correctly, one of the things that needs to be done in SPL is the initialization of the DRAM controller. A few weeks ago Oliver has updated the http://linux-sunxi.org/DRAM_Controller page and added a link to the 'dram_sun6i.c' file from the rhombus-tech.net u-boot repository:
http://git.rhombus-tech.net/?p=u-boot.git;a=blob;f=arch/arm/cpu/armv7/sunxi/dram_sun6i.c;hb=refs/heads/allwinner-sunxi-a31
Does this repository look like exactly the missing part of code? Assuming that this code works, it provides a usable starting point for us.
It looks like the Allwinner A31 DRAM controller registers are very similar to what is used in RK3288 (I have not checked the details, but if we are very lucky, it might be even a 100% perfect match):
https://chromium-review.googlesource.com/#/c/209419/
And thanks to the Rockchip developers (who are contributing this DRAM controller support code to coreboot), now we have a lot of named defines for the individual bitfields in the hardware registers. So we can decode the magic constants used in the Allwinner code. And thanks to Texas Instruments, we also have some useful documentation, which also happens to be a reasonably good match:
http://www.ti.com/lit/ug/spruhn7a/spruhn7a.pdf
In general, if we are on our own, then we just need to do all the boring work again (similar to what we did with the Allwinner A10/A13/A20 DRAM controller earlier). Starting with the creation of the
http://linux-sunxi.org/A31_DRAM_Controller_Register_Guide
wiki page and populating it with the information gathered from the Allwinner and Rockchip source code and also from the TI Keystone2 documentation. Naturally, every bit of this information needs to be verified on real Allwinner A31 hardware before we can make any assumptions.
However Allwinner has promised to provide us with some better documentation later this month:
https://www.mail-archive.com/linux-sunxi at googlegroups.com/msg06840.html
I don't know if they are going to include the documentation for the DRAM controller in the first new documentation delivery. It surely may be complicated, because Allwinner is obviously licensing the DRAM controller IP from a third party and not designing it from scratch (in a nice company with Rockchip and Texas Instruments). But Texas Instruments somehow can provide the DRAM controller documentation in free public access. So I would guess that it should be possible for Allwinner too.
We still need proper Power-Down and Self-Refresh mode support for Allwinner A10/A13/A20. And I had plans to do some investigation for this stuff. But now this activity is temporarily suspended until we see what kind of assistance Allwinner is going to provide to us (A usable DRAM controller documentation? A contribution of DRAM code for u-boot? Nothing?).
Signature · 2 lines
Best regards, Siarhei Siamashka
Hi,
Quoted 49 lines · Siarhei Siamashka
Quoted 38 lines · On Tue, 09 Sep 2014 09:00:57 +0200 Hans de Goede <[email protected]> wrote:
Hi,
Quoted 25 lines · Chen-Yu Tsai
Hi everyone,
This series add basic support for Allwinner's A31 SoC. The patches, excluding the first one, were cherry-picked from u-boot-sunxi. Due to the difference between u-boot mainline and u-boot-sunxi, some patches were rearranged or squashed to better fit the current state of u-boot, and not introduce any build breaks. It follows Ian's initial merge method of sun7i support: introducing various components first, then enabling them in the last commit. I tried to keep the commits separate, thus retaining the original author and Signed-off-bys.
Patch 1 adds a wrapper around "
func(USB, usb, 0)" inBOOT_TARGET_DEVICESto deal with breakage when USB support is not enabled.Patch 2 adds memory addresses for some hardware blocks new in sun6i.
Patch 3 adds support for the new PRCM (power reset and clock management) block, which also contains PLL bias voltage control.
Patch 4 adds support for the clock module. This patch is a bunch of different sun6i related patches on the clock code, from when sun6i support was introduced to u-boot-sunxi, up to its current form. This is done to avoid various conflicts and needlessly introducing then removing macros.
Quoted 5 lines
Patch 5 adds mmc support on sun6i.
Patch 6 adds uart0 muxing on sun6i.
Patch 7 enables sun6i support and adds defconfig for the Colombus board.
Chen,
Many thanks for working on this!
Quoted 7 lines
Just a quick not for people celebrating too early, this is the *incomplete* sun7i support from the linux-sunxi/u-boot-sunxi git repo. It is fine to merge this upstream, but this does not include SPL support.
This allows replacing u-boot.bin on allwinnner sd-card images, which is very useful. But it does not get us all the way to booting sun7i devices we still need boot0 and boot1 binaries from allwinner for that (for now).
Quoted 7 lines
If I understand it correctly, one of the things that needs to be done in SPL is the initialization of the DRAM controller. A few weeks ago Oliver has updated the http://linux-sunxi.org/DRAM_Controller page and added a link to the '
dram_sun6i.c' file from the rhombus-tech.net u-boot repository:http://git.rhombus-tech.net/?p=u-boot.git;a=blob;f=arch/arm/cpu/armv7/sunxi/dram_sun6i.c;hb=refs/heads/allwinner-sunxi-a31Does this repository look like exactly the missing part of code?
Yes it does, interesting. I had found that file before, but this one was missing in the repo I found then:
But with that one added, this is definitely interesting.
Quoted 2 lines
Assuming that this code works, it provides a usable starting point for us.
Yep, assuming :) If no one beats me to it I'll take a look at this as time permits.
Quoted 4 lines
It looks like the Allwinner A31 DRAM controller registers are very similar to what is used in RK3288 (I have not checked the details, but if we are very lucky, it might be even a 100% perfect match):
https://chromium-review.googlesource.com/#/c/209419/
Quoted 8 lines
And thanks to the Rockchip developers (who are contributing this DRAM controller support code to coreboot), now we have a lot of named defines for the individual bitfields in the hardware registers. So we can decode the magic constants used in the Allwinner code. And thanks to Texas Instruments, we also have some useful documentation, which also happens to be a reasonably good match:
http://www.ti.com/lit/ug/spruhn7a/spruhn7a.pdf
Sounds good / useful.
Quoted 9 lines
In general, if we are on our own, then we just need to do all the boring work again (similar to what we did with the Allwinner A10/A13/A20 DRAM controller earlier). Starting with the creation of the
http://linux-sunxi.org/A31_DRAM_Controller_Register_Guide
wiki page and populating it with the information gathered from the Allwinner and Rockchip source code and also from the TI Keystone2 documentation. Naturally, every bit of this information needs to be verified on real Allwinner A31 hardware before we can make any assumptions.
Yep.
Quoted 12 lines
However Allwinner has promised to provide us with some better documentation later this month:
https://www.mail-archive.com/linux-sunxi at googlegroups.com/msg06840.html
I don't know if they are going to include the documentation for the DRAM controller in the first new documentation delivery. It surely may be complicated, because Allwinner is obviously licensing the DRAM controller IP from a third party and not designing it from scratch (in a nice company with Rockchip and Texas Instruments). But Texas Instruments somehow can provide the DRAM controller documentation in free public access. So I would guess that it should be possible for Allwinner too.
Quoted 6 lines
We still need proper Power-Down and Self-Refresh mode support for Allwinner A10/A13/A20. And I had plans to do some investigation for this stuff. But now this activity is temporarily suspended until we see what kind of assistance Allwinner is going to provide to us (A usable DRAM controller documentation? A contribution of DRAM code for u-boot? Nothing?).
Regards,
Hans
Hi,
Quoted 60 lines · Hans de Goede
Hi,
Quoted 49 lines · Siarhei Siamashka
Quoted 38 lines · On Tue, 09 Sep 2014 09:00:57 +0200 Hans de Goede <[email protected]> wrote:
Hi,
Quoted 25 lines · Chen-Yu Tsai
Hi everyone,
This series add basic support for Allwinner's A31 SoC. The patches, excluding the first one, were cherry-picked from u-boot-sunxi. Due to the difference between u-boot mainline and u-boot-sunxi, some patches were rearranged or squashed to better fit the current state of u-boot, and not introduce any build breaks. It follows Ian's initial merge method of sun7i support: introducing various components first, then enabling them in the last commit. I tried to keep the commits separate, thus retaining the original author and Signed-off-bys.
Patch 1 adds a wrapper around "
func(USB, usb, 0)" inBOOT_TARGET_DEVICESto deal with breakage when USB support is not enabled.Patch 2 adds memory addresses for some hardware blocks new in sun6i.
Patch 3 adds support for the new PRCM (power reset and clock management) block, which also contains PLL bias voltage control.
Patch 4 adds support for the clock module. This patch is a bunch of different sun6i related patches on the clock code, from when sun6i support was introduced to u-boot-sunxi, up to its current form. This is done to avoid various conflicts and needlessly introducing then removing macros.
Quoted 5 lines
Patch 5 adds mmc support on sun6i.
Patch 6 adds uart0 muxing on sun6i.
Patch 7 enables sun6i support and adds defconfig for the Colombus board.
Chen,
Many thanks for working on this!
Quoted 7 lines
Just a quick not for people celebrating too early, this is the *incomplete* sun7i support from the linux-sunxi/u-boot-sunxi git repo. It is fine to merge this upstream, but this does not include SPL support.
This allows replacing u-boot.bin on allwinnner sd-card images, which is very useful. But it does not get us all the way to booting sun7i devices we still need boot0 and boot1 binaries from allwinner for that (for now).
Quoted 7 lines
If I understand it correctly, one of the things that needs to be done in SPL is the initialization of the DRAM controller. A few weeks ago Oliver has updated the http://linux-sunxi.org/DRAM_Controller page and added a link to the '
dram_sun6i.c' file from the rhombus-tech.net u-boot repository:http://git.rhombus-tech.net/?p=u-boot.git;a=blob;f=arch/arm/cpu/armv7/sunxi/dram_sun6i.c;hb=refs/heads/allwinner-sunxi-a31Does this repository look like exactly the missing part of code?
Quoted 6 lines
Yes it does, interesting. I had found that file before, but this one was missing in the repo I found then:
But with that one added, this is definitely interesting.
The A31 Hummingbird's SDK has provided us with full boot0/boot1, which also includes the dram code:
It is more complex than what we found in u-boot. This code also shows what is encoded into the dram parameters found in the fex files.
Quoted 31 lines
Quoted 2 lines
Assuming that this code works, it provides a usable starting point for us.
Yep, assuming :) If no one beats me to it I'll take a look at this as time permits.
Quoted 4 lines
It looks like the Allwinner A31 DRAM controller registers are very similar to what is used in RK3288 (I have not checked the details, but if we are very lucky, it might be even a 100% perfect match):
https://chromium-review.googlesource.com/#/c/209419/Quoted 8 lines
And thanks to the Rockchip developers (who are contributing this DRAM controller support code to coreboot), now we have a lot of named defines for the individual bitfields in the hardware registers. So we can decode the magic constants used in the Allwinner code. And thanks to Texas Instruments, we also have some useful documentation, which also happens to be a reasonably good match:
http://www.ti.com/lit/ug/spruhn7a/spruhn7a.pdfSounds good / useful.
Quoted 9 lines
In general, if we are on our own, then we just need to do all the boring work again (similar to what we did with the Allwinner A10/A13/A20 DRAM controller earlier). Starting with the creation of the
http://linux-sunxi.org/A31_DRAM_Controller_Register_Guide
wiki page and populating it with the information gathered from the Allwinner and Rockchip source code and also from the TI Keystone2 documentation. Naturally, every bit of this information needs to be verified on real Allwinner A31 hardware before we can make any assumptions.
Quoted 1 line
Yep.
Matching the register bits with the parts decoded from dram parameters seems like a place to start, though i don't understand much of the terminology.
Quoted 12 lines
Quoted 12 lines
However Allwinner has promised to provide us with some better documentation later this month:
https://www.mail-archive.com/linux-sunxi at googlegroups.com/msg06840.html
I don't know if they are going to include the documentation for the DRAM controller in the first new documentation delivery. It surely may be complicated, because Allwinner is obviously licensing the DRAM controller IP from a third party and not designing it from scratch (in a nice company with Rockchip and Texas Instruments). But Texas Instruments somehow can provide the DRAM controller documentation in free public access. So I would guess that it should be possible for Allwinner too.
Quoted 6 lines
Quoted 6 lines
We still need proper Power-Down and Self-Refresh mode support for Allwinner A10/A13/A20. And I had plans to do some investigation for this stuff. But now this activity is temporarily suspended until we see what kind of assistance Allwinner is going to provide to us (A usable DRAM controller documentation? A contribution of DRAM code for u-boot? Nothing?).
Cheers
ChenYu
Hi,
Quoted 70 lines · Chen-Yu Tsai
Hi,
Quoted 60 lines · Hans de Goede
Hi,
Quoted 49 lines · Siarhei Siamashka
Quoted 38 lines · On Tue, 09 Sep 2014 09:00:57 +0200 Hans de Goede <[email protected]> wrote:
Hi,
Quoted 25 lines · Chen-Yu Tsai
Hi everyone,
This series add basic support for Allwinner's A31 SoC. The patches, excluding the first one, were cherry-picked from u-boot-sunxi. Due to the difference between u-boot mainline and u-boot-sunxi, some patches were rearranged or squashed to better fit the current state of u-boot, and not introduce any build breaks. It follows Ian's initial merge method of sun7i support: introducing various components first, then enabling them in the last commit. I tried to keep the commits separate, thus retaining the original author and Signed-off-bys.
Patch 1 adds a wrapper around "
func(USB, usb, 0)" inBOOT_TARGET_DEVICESto deal with breakage when USB support is not enabled.Patch 2 adds memory addresses for some hardware blocks new in sun6i.
Patch 3 adds support for the new PRCM (power reset and clock management) block, which also contains PLL bias voltage control.
Patch 4 adds support for the clock module. This patch is a bunch of different sun6i related patches on the clock code, from when sun6i support was introduced to u-boot-sunxi, up to its current form. This is done to avoid various conflicts and needlessly introducing then removing macros.
Quoted 5 lines
Patch 5 adds mmc support on sun6i.
Patch 6 adds uart0 muxing on sun6i.
Patch 7 enables sun6i support and adds defconfig for the Colombus board.
Chen,
Many thanks for working on this!
Quoted 7 lines
Just a quick not for people celebrating too early, this is the *incomplete* sun7i support from the linux-sunxi/u-boot-sunxi git repo. It is fine to merge this upstream, but this does not include SPL support.
This allows replacing u-boot.bin on allwinnner sd-card images, which is very useful. But it does not get us all the way to booting sun7i devices we still need boot0 and boot1 binaries from allwinner for that (for now).
Quoted 7 lines
If I understand it correctly, one of the things that needs to be done in SPL is the initialization of the DRAM controller. A few weeks ago Oliver has updated the http://linux-sunxi.org/DRAM_Controller page and added a link to the '
dram_sun6i.c' file from the rhombus-tech.net u-boot repository:http://git.rhombus-tech.net/?p=u-boot.git;a=blob;f=arch/arm/cpu/armv7/sunxi/dram_sun6i.c;hb=refs/heads/allwinner-sunxi-a31Does this repository look like exactly the missing part of code?
Quoted 6 lines
Yes it does, interesting. I had found that file before, but this one was missing in the repo I found then:
But with that one added, this is definitely interesting.
Quoted 8 lines
The A31 Hummingbird's SDK has provided us with full boot0/boot1, which also includes the dram code:
It is more complex than what we found in u-boot. This code also shows what is encoded into the dram parameters found in the fex files.
Interesting, if I ever find the time I may look into adding what ever is missing from the u-boot dram init code by looking at the algorithm used in the boot0 code. But as said, that depends on me finding the time ... So if others want to work on this, please do.
Regards,
Hans