[U-Boot] [PATCH 1/9] sunxi: axp209: Disable interrupts when intializing the axp209

We do not use the axp209 interrupt, and at least in my mini-x (which does not have a power button) the pwr-button pin and the irq pin are soldered together, so if the axp209 keeps it irq asserted to long it will see a 10s pwr-button press and hard power off the board, disabling the irqs fixes this.
Signed-off-by: Hans de Goede hdegoede@redhat.com --- drivers/power/axp209.c | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-)
diff --git a/drivers/power/axp209.c b/drivers/power/axp209.c index 3b1a6a7..4565398 100644 --- a/drivers/power/axp209.c +++ b/drivers/power/axp209.c @@ -16,6 +16,11 @@ enum axp209_reg { AXP209_DCDC3_VOLTAGE = 0x27, AXP209_LDO24_VOLTAGE = 0x28, AXP209_LDO3_VOLTAGE = 0x29, + AXP209_IRQ_ENABLE1 = 0x40, + AXP209_IRQ_ENABLE2 = 0x41, + AXP209_IRQ_ENABLE3 = 0x42, + AXP209_IRQ_ENABLE4 = 0x43, + AXP209_IRQ_ENABLE5 = 0x44, AXP209_IRQ_STATUS5 = 0x4c, AXP209_SHUTDOWN = 0x32, AXP209_GPIO0_CTRL = 0x90, @@ -143,7 +148,7 @@ int axp209_set_ldo4(int mvolt) int axp209_init(void) { u8 ver; - int rc; + int i, rc;
rc = axp209_read(AXP209_CHIP_VERSION, &ver); if (rc) @@ -155,6 +160,13 @@ int axp209_init(void) if (ver != 0x1) return -1;
+ /* Mask all interrupts */ + for (i = AXP209_IRQ_ENABLE1; i <= AXP209_IRQ_ENABLE5; i++) { + rc = axp209_write(i, 0); + if (rc) + return rc; + } + return 0; }

PH12 is Vbus enable for Vbus2, not Vbus1.
Signed-off-by: Hans de Goede hdegoede@redhat.com --- configs/ba10_tv_box_defconfig | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/configs/ba10_tv_box_defconfig b/configs/ba10_tv_box_defconfig index 6ca7c57..37bf51b 100644 --- a/configs/ba10_tv_box_defconfig +++ b/configs/ba10_tv_box_defconfig @@ -1,7 +1,7 @@ CONFIG_SPL=y CONFIG_SYS_EXTRA_OPTIONS="AXP209_POWER,SUNXI_EMAC,USB_EHCI" CONFIG_FDTFILE="sun4i-a10-ba10-tvbox.dtb" -CONFIG_USB1_VBUS_PIN="PH12" +CONFIG_USB2_VBUS_PIN="PH12" +S:CONFIG_ARM=y +S:CONFIG_ARCH_SUNXI=y +S:CONFIG_MACH_SUN4I=y

On Sun, 2015-01-18 at 13:23 +0100, Hans de Goede wrote:
PH12 is Vbus enable for Vbus2, not Vbus1.
Signed-off-by: Hans de Goede hdegoede@redhat.com
Acked-by: Ian Campbell ijc@hellion.org.uk

While working on adding more boards I noticed that we lack a config for the 512M cubieboard, and that some of the new boards which I want to add also have 512M and 1G variants, rather then adding 2 defconfig's for all of these, lets switch the exising boards which have both a 512M and 1024M variant over to the sun4i dram autoconfig code.
This also drops the foo_RAMSIZE_defconfig variants of boards where we currently have 2 separate configs already.
Note: 1) The newly introduced CONFIG_DRAM_EMR1 kconfig value is not used with a value other then its default for now, but we need this to be configurable to support some new boards with auto dram config.
2) We always set all CONFIG_DRAM_foo values in defconfigs, even if they match the defaults, this is done to make it more clear what values are used for a certain board.
This has been tested on a Mele A1000, Mini-X and a Cubieboard, all 1G variants, the dram autoconfig code has also been tested on a 512M mk802 (a defconfig for the mk802 is added in a later patch).
Signed-off-by: Hans de Goede hdegoede@redhat.com --- arch/arm/include/asm/arch-sunxi/dram_sun4i.h | 2 +- board/sunxi/Kconfig | 36 +++++++++++++++------------- board/sunxi/MAINTAINERS | 2 -- board/sunxi/Makefile | 8 +++---- board/sunxi/dram_cubieboard.c | 31 ------------------------ board/sunxi/dram_sun4i_360_1024_iow16.c | 31 ------------------------ board/sunxi/dram_sun4i_360_1024_iow8.c | 31 ------------------------ board/sunxi/dram_sun4i_360_512.c | 31 ------------------------ board/sunxi/dram_sun4i_auto.c | 31 ++++++++++++++++++++++++ configs/Cubieboard_defconfig | 3 +++ configs/Mele_A1000G_defconfig | 8 ------- configs/Mele_A1000_defconfig | 3 +++ configs/Mini-X-1Gb_defconfig | 7 ------ configs/Mini-X_defconfig | 3 +++ 14 files changed, 63 insertions(+), 164 deletions(-) delete mode 100644 board/sunxi/dram_cubieboard.c delete mode 100644 board/sunxi/dram_sun4i_360_1024_iow16.c delete mode 100644 board/sunxi/dram_sun4i_360_1024_iow8.c delete mode 100644 board/sunxi/dram_sun4i_360_512.c create mode 100644 board/sunxi/dram_sun4i_auto.c delete mode 100644 configs/Mele_A1000G_defconfig delete mode 100644 configs/Mini-X-1Gb_defconfig
diff --git a/arch/arm/include/asm/arch-sunxi/dram_sun4i.h b/arch/arm/include/asm/arch-sunxi/dram_sun4i.h index 6c1ec5b..40c385a 100644 --- a/arch/arm/include/asm/arch-sunxi/dram_sun4i.h +++ b/arch/arm/include/asm/arch-sunxi/dram_sun4i.h @@ -76,7 +76,7 @@ struct dram_para { u32 cas; u32 zq; u32 odt_en; - u32 size; + u32 size; /* For compat with dram.c files from u-boot-sunxi, unused */ u32 tpr0; u32 tpr1; u32 tpr2; diff --git a/board/sunxi/Kconfig b/board/sunxi/Kconfig index e65b8af..f7064d0 100644 --- a/board/sunxi/Kconfig +++ b/board/sunxi/Kconfig @@ -37,21 +37,31 @@ config MACH_SUN9I
endchoice
-if MACH_SUN6I || MACH_SUN8I - config DRAM_CLK - int "sun6i dram clock speed" - default 312 + int "sunxi dram clock speed" + default 312 if MACH_SUN6I || MACH_SUN8I + default 360 if MACH_SUN4I || MACH_SUN5I || MACH_SUN7I ---help--- Set the dram clock speed, valid range 240 - 480, must be a multiple - of 24. + of 24. Note on sun4i / sun5i / sun7i this is only used by boards + which use dram autoconfig.
config DRAM_ZQ - int "sun6i dram zq value" - default 123 + int "sunxi dram zq value" + default 123 if MACH_SUN4I || MACH_SUN5I || MACH_SUN6I || MACH_SUN8I + default 127 if MACH_SUN7I ---help--- - Set the dram zq value. - + Set the dram zq value. Note on sun4i / sun5i / sun7i this is only + used by boards which use dram autoconfig. + +if MACH_SUN4I || MACH_SUN5I || MACH_SUN7I +config DRAM_EMR1 + int "sunxi dram emr1 value" + default 0 if MACH_SUN4I + default 4 if MACH_SUN5I || MACH_SUN7I + ---help--- + Set the dram controller emr1 value. Note this is only used by boards + which use dram autoconfig. endif
config SYS_CONFIG_NAME @@ -141,10 +151,6 @@ config TARGET_PCDUINO3 bool "PCDUINO3" depends on MACH_SUN7I
-config TARGET_MELE_A1000G - bool "MELE_A1000G" - depends on MACH_SUN4I - config TARGET_MELE_A1000 bool "MELE_A1000" depends on MACH_SUN4I @@ -157,10 +163,6 @@ config TARGET_MELE_M9 bool "MELE_M9" depends on MACH_SUN6I
-config TARGET_MINI_X_1GB - bool "MINI_X_1GB" - depends on MACH_SUN4I - config TARGET_MINI_X bool "MINI_X" depends on MACH_SUN4I diff --git a/board/sunxi/MAINTAINERS b/board/sunxi/MAINTAINERS index 7cd0b20..16429d4 100644 --- a/board/sunxi/MAINTAINERS +++ b/board/sunxi/MAINTAINERS @@ -8,10 +8,8 @@ F: configs/ba10_tv_box_defconfig F: configs/Chuwi_V7_CW0825_defconfig F: configs/Cubieboard_defconfig F: configs/Mele_A1000_defconfig -F: configs/Mele_A1000G_defconfig F: configs/Mele_M3_defconfig F: configs/Mini-X_defconfig -F: configs/Mini-X-1Gb_defconfig F: include/configs/sun5i.h F: configs/A10s-OLinuXino-M_defconfig F: configs/A13-OLinuXino_defconfig diff --git a/board/sunxi/Makefile b/board/sunxi/Makefile index b0a9b9e..606bf73 100644 --- a/board/sunxi/Makefile +++ b/board/sunxi/Makefile @@ -24,15 +24,13 @@ obj-$(CONFIG_TARGET_BA10_TV_BOX) += dram_sun4i_384_1024_iow8.o obj-$(CONFIG_TARGET_BANANAPI) += dram_bananapi.o obj-$(CONFIG_TARGET_BANANAPRO) += dram_bananapi.o obj-$(CONFIG_TARGET_CHUWI_V7_CW0825) += dram_sun4i_408_1024_iow16.o -obj-$(CONFIG_TARGET_CUBIEBOARD) += dram_cubieboard.o +obj-$(CONFIG_TARGET_CUBIEBOARD) += dram_sun4i_auto.o obj-$(CONFIG_TARGET_CUBIEBOARD2) += dram_cubieboard2.o obj-$(CONFIG_TARGET_CUBIETRUCK) += dram_cubietruck.o obj-$(CONFIG_TARGET_I12_TVBOX) += dram_sun7i_384_1024_iow16.o -obj-$(CONFIG_TARGET_MELE_A1000) += dram_sun4i_360_512.o -obj-$(CONFIG_TARGET_MELE_A1000G) += dram_sun4i_360_1024_iow8.o +obj-$(CONFIG_TARGET_MELE_A1000) += dram_sun4i_auto.o obj-$(CONFIG_TARGET_MELE_M3) += dram_sun7i_384_1024_iow16.o -obj-$(CONFIG_TARGET_MINI_X) += dram_sun4i_360_512.o -obj-$(CONFIG_TARGET_MINI_X_1GB) += dram_sun4i_360_1024_iow16.o +obj-$(CONFIG_TARGET_MINI_X) += dram_sun4i_auto.o obj-$(CONFIG_TARGET_MSI_PRIMO73) += dram_sun7i_384_1024_iow16.o obj-$(CONFIG_TARGET_PCDUINO) += dram_sun4i_408_1024_iow8.o obj-$(CONFIG_TARGET_PCDUINO3) += dram_linksprite_pcduino3.o diff --git a/board/sunxi/dram_cubieboard.c b/board/sunxi/dram_cubieboard.c deleted file mode 100644 index 399028c..0000000 --- a/board/sunxi/dram_cubieboard.c +++ /dev/null @@ -1,31 +0,0 @@ -/* this file is generated, don't edit it yourself */ - -#include <common.h> -#include <asm/arch/dram.h> - -static struct dram_para dram_para = { - .clock = 480, - .type = 3, - .rank_num = 1, - .density = 4096, - .io_width = 16, - .bus_width = 32, - .cas = 6, - .zq = 123, - .odt_en = 0, - .size = 1024, - .tpr0 = 0x30926692, - .tpr1 = 0x1090, - .tpr2 = 0x1a0c8, - .tpr3 = 0, - .tpr4 = 0, - .tpr5 = 0, - .emr1 = 0, - .emr2 = 0, - .emr3 = 0, -}; - -unsigned long sunxi_dram_init(void) -{ - return dramc_init(&dram_para); -} diff --git a/board/sunxi/dram_sun4i_360_1024_iow16.c b/board/sunxi/dram_sun4i_360_1024_iow16.c deleted file mode 100644 index 3763713..0000000 --- a/board/sunxi/dram_sun4i_360_1024_iow16.c +++ /dev/null @@ -1,31 +0,0 @@ -/* this file is generated, don't edit it yourself */ - -#include <common.h> -#include <asm/arch/dram.h> - -static struct dram_para dram_para = { - .clock = 360, - .type = 3, - .rank_num = 1, - .density = 4096, - .io_width = 16, - .bus_width = 32, - .cas = 6, - .zq = 123, - .odt_en = 0, - .size = 1024, - .tpr0 = 0x30926692, - .tpr1 = 0x1090, - .tpr2 = 0x1a0c8, - .tpr3 = 0, - .tpr4 = 0, - .tpr5 = 0, - .emr1 = 0, - .emr2 = 0, - .emr3 = 0, -}; - -unsigned long sunxi_dram_init(void) -{ - return dramc_init(&dram_para); -} diff --git a/board/sunxi/dram_sun4i_360_1024_iow8.c b/board/sunxi/dram_sun4i_360_1024_iow8.c deleted file mode 100644 index 2a5c9ed..0000000 --- a/board/sunxi/dram_sun4i_360_1024_iow8.c +++ /dev/null @@ -1,31 +0,0 @@ -/* this file is generated, don't edit it yourself */ - -#include <common.h> -#include <asm/arch/dram.h> - -static struct dram_para dram_para = { - .clock = 360, - .type = 3, - .rank_num = 1, - .density = 2048, - .io_width = 8, - .bus_width = 32, - .cas = 6, - .zq = 123, - .odt_en = 0, - .size = 1024, - .tpr0 = 0x30926692, - .tpr1 = 0x1090, - .tpr2 = 0x1a0c8, - .tpr3 = 0, - .tpr4 = 0, - .tpr5 = 0, - .emr1 = 0, - .emr2 = 0, - .emr3 = 0, -}; - -unsigned long sunxi_dram_init(void) -{ - return dramc_init(&dram_para); -} diff --git a/board/sunxi/dram_sun4i_360_512.c b/board/sunxi/dram_sun4i_360_512.c deleted file mode 100644 index 48aa6e2..0000000 --- a/board/sunxi/dram_sun4i_360_512.c +++ /dev/null @@ -1,31 +0,0 @@ -/* this file is generated, don't edit it yourself */ - -#include <common.h> -#include <asm/arch/dram.h> - -static struct dram_para dram_para = { - .clock = 360, - .type = 3, - .rank_num = 1, - .density = 2048, - .io_width = 16, - .bus_width = 32, - .cas = 6, - .zq = 123, - .odt_en = 0, - .size = 512, - .tpr0 = 0x30926692, - .tpr1 = 0x1090, - .tpr2 = 0x1a0c8, - .tpr3 = 0, - .tpr4 = 0, - .tpr5 = 0, - .emr1 = 0, - .emr2 = 0, - .emr3 = 0, -}; - -unsigned long sunxi_dram_init(void) -{ - return dramc_init(&dram_para); -} diff --git a/board/sunxi/dram_sun4i_auto.c b/board/sunxi/dram_sun4i_auto.c new file mode 100644 index 0000000..115b597 --- /dev/null +++ b/board/sunxi/dram_sun4i_auto.c @@ -0,0 +1,31 @@ +/* this file is generated, don't edit it yourself */ + +#include <common.h> +#include <asm/arch/dram.h> + +static struct dram_para dram_para = { + .clock = CONFIG_DRAM_CLK, + .type = 3, + .rank_num = 1, + .density = 0, + .io_width = 0, + .bus_width = 0, + .cas = 6, + .zq = CONFIG_DRAM_ZQ, + .odt_en = 0, + .size = 0, + .tpr0 = 0x30926692, + .tpr1 = 0x1090, + .tpr2 = 0x1a0c8, + .tpr3 = 0, + .tpr4 = 0, + .tpr5 = 0, + .emr1 = CONFIG_DRAM_EMR1, + .emr2 = 0, + .emr3 = 0, +}; + +unsigned long sunxi_dram_init(void) +{ + return dramc_init(&dram_para); +} diff --git a/configs/Cubieboard_defconfig b/configs/Cubieboard_defconfig index 0bc45fd..b256b95 100644 --- a/configs/Cubieboard_defconfig +++ b/configs/Cubieboard_defconfig @@ -5,3 +5,6 @@ CONFIG_FDTFILE="sun4i-a10-cubieboard.dtb" +S:CONFIG_ARCH_SUNXI=y +S:CONFIG_MACH_SUN4I=y +S:CONFIG_TARGET_CUBIEBOARD=y ++S:CONFIG_DRAM_CLK=480 ++S:CONFIG_DRAM_ZQ=123 ++S:CONFIG_DRAM_EMR1=0 diff --git a/configs/Mele_A1000G_defconfig b/configs/Mele_A1000G_defconfig deleted file mode 100644 index 9cb3285..0000000 --- a/configs/Mele_A1000G_defconfig +++ /dev/null @@ -1,8 +0,0 @@ -CONFIG_SPL=y -CONFIG_SYS_EXTRA_OPTIONS="AXP209_POWER,SUNXI_EMAC,MACPWR=SUNXI_GPH(15),AHCI,USB_EHCI" -CONFIG_FDTFILE="sun4i-a10-a1000.dtb" -CONFIG_VIDEO_VGA=y -+S:CONFIG_ARM=y -+S:CONFIG_ARCH_SUNXI=y -+S:CONFIG_MACH_SUN4I=y -+S:CONFIG_TARGET_MELE_A1000G=y diff --git a/configs/Mele_A1000_defconfig b/configs/Mele_A1000_defconfig index 97d9454..3b4a19e 100644 --- a/configs/Mele_A1000_defconfig +++ b/configs/Mele_A1000_defconfig @@ -6,3 +6,6 @@ CONFIG_VIDEO_VGA=y +S:CONFIG_ARCH_SUNXI=y +S:CONFIG_MACH_SUN4I=y +S:CONFIG_TARGET_MELE_A1000=y ++S:CONFIG_DRAM_CLK=360 ++S:CONFIG_DRAM_ZQ=123 ++S:CONFIG_DRAM_EMR1=0 diff --git a/configs/Mini-X-1Gb_defconfig b/configs/Mini-X-1Gb_defconfig deleted file mode 100644 index b8fea01..0000000 --- a/configs/Mini-X-1Gb_defconfig +++ /dev/null @@ -1,7 +0,0 @@ -CONFIG_SPL=y -CONFIG_SYS_EXTRA_OPTIONS="AXP209_POWER,USB_EHCI" -CONFIG_FDTFILE="sun4i-a10-mini-xplus.dtb" -+S:CONFIG_ARM=y -+S:CONFIG_ARCH_SUNXI=y -+S:CONFIG_MACH_SUN4I=y -+S:CONFIG_TARGET_MINI_X_1GB=y diff --git a/configs/Mini-X_defconfig b/configs/Mini-X_defconfig index 0f6bbe0..bb39464 100644 --- a/configs/Mini-X_defconfig +++ b/configs/Mini-X_defconfig @@ -5,3 +5,6 @@ CONFIG_FDTFILE="sun4i-a10-mini-xplus.dtb" +S:CONFIG_ARCH_SUNXI=y +S:CONFIG_MACH_SUN4I=y +S:CONFIG_TARGET_MINI_X=y ++S:CONFIG_DRAM_CLK=360 ++S:CONFIG_DRAM_ZQ=123 ++S:CONFIG_DRAM_EMR1=0

On Sun, 2015-01-18 at 13:23 +0100, Hans de Goede wrote:
diff --git a/board/sunxi/dram_sun4i_auto.c b/board/sunxi/dram_sun4i_auto.c new file mode 100644 index 0000000..115b597 --- /dev/null +++ b/board/sunxi/dram_sun4i_auto.c @@ -0,0 +1,31 @@ +/* this file is generated, don't edit it yourself */
This isn't strictly true any more, is it?
Acked-by: Ian Campbell ijc@hellion.org.uk
Ian.

Hi,
On 18-01-15 17:22, Ian Campbell wrote:
On Sun, 2015-01-18 at 13:23 +0100, Hans de Goede wrote:
diff --git a/board/sunxi/dram_sun4i_auto.c b/board/sunxi/dram_sun4i_auto.c new file mode 100644 index 0000000..115b597 --- /dev/null +++ b/board/sunxi/dram_sun4i_auto.c @@ -0,0 +1,31 @@ +/* this file is generated, don't edit it yourself */
This isn't strictly true any more, is it?
Yeah I was thinking the same thing when working on this but I wasn't sure what to do I'll drop the comment, as it is clearly false.
And thanks for the reviews.
Acked-by: Ian Campbell ijc@hellion.org.uk
Regards,
Hans

On Sun, 18 Jan 2015 13:23:26 +0100 Hans de Goede hdegoede@redhat.com wrote:
While working on adding more boards I noticed that we lack a config for the 512M cubieboard, and that some of the new boards which I want to add also have 512M and 1G variants, rather then adding 2 defconfig's for all of these, lets switch the exising boards which have both a 512M and 1024M variant over to the sun4i dram autoconfig code.
This also drops the foo_RAMSIZE_defconfig variants of boards where we currently have 2 separate configs already.
Note:
- The newly introduced CONFIG_DRAM_EMR1 kconfig value is not used with
a value other then its default for now, but we need this to be configurable to support some new boards with auto dram config.
- We always set all CONFIG_DRAM_foo values in defconfigs, even if they match
the defaults, this is done to make it more clear what values are used for a certain board.
This has been tested on a Mele A1000, Mini-X and a Cubieboard, all 1G variants, the dram autoconfig code has also been tested on a 512M mk802 (a defconfig for the mk802 is added in a later patch).
Signed-off-by: Hans de Goede hdegoede@redhat.com
Thanks for finally finding time to do some refinements in this pile of junk dram settings for the boards that you are maintaining.
I think that adding the Kconfig options is fine as long as they are not abused and the 'dram_para' structure is kept. We want to be able to update DRAM settings without the need of recompiling SPL. Currently this can be relatively easily done by finding and patching the 'dram_para' structure inside of the SPL binary.
In general this looks like a good change. However see below.
[...]
+++ b/board/sunxi/dram_sun4i_auto.c @@ -0,0 +1,31 @@ +/* this file is generated, don't edit it yourself */
+#include <common.h> +#include <asm/arch/dram.h>
+static struct dram_para dram_para = {
- .clock = CONFIG_DRAM_CLK,
- .type = 3,
- .rank_num = 1,
- .density = 0,
- .io_width = 0,
- .bus_width = 0,
- .cas = 6,
- .zq = CONFIG_DRAM_ZQ,
- .odt_en = 0,
- .size = 0,
- .tpr0 = 0x30926692,
- .tpr1 = 0x1090,
- .tpr2 = 0x1a0c8,
- .tpr3 = 0,
- .tpr4 = 0,
- .tpr5 = 0,
- .emr1 = CONFIG_DRAM_EMR1,
- .emr2 = 0,
- .emr3 = 0,
+};
As we already discussed earlier http://lists.denx.de/pipermail/u-boot/2014-September/189266.html these tpr0/tpr1/tpr2 settings are configured for DDR2-800E (and 400MHz clock speed because of double data rate). Yes, DDR2 (!) instead of DDR3. This in practice is not very much off from DDR3-800, except for the tXS parameter. But tXS is only relevant for self-refresh, which is currently not used by the u-boot or the mainline kernel anyway. That's why this all does not crash and burn in an obvious way.
Anyway, these timings are still wrong for the boards running DRAM at the clock speeds higher than 400MHz. For example, they are ~20% outside of the valid range at 480MHz and this all works by pure luck, thanks to the hardware typically having some safety/overclocking margin.
If we look at the parameters used by the sun7i boards: .cas = 9, .tpr0 = 0x42d899b7, .tpr1 = 0xa090, .tpr2 = 0x22a00, ... then we can see that the settings are also a bit fishy. The tpr1/tpr2 parameters are matching DDR3-800 timings. And tpr0 is matching DDR3-1333 timings with 1KB (!) page size, while many sunxi devices are using 2KB pages. So it's some weird crossbreed, which is however somewhat less wrong than the settings from sun4i boards.
I would suggest trying one of the following DRAM settings, generated as explained at http://linux-sunxi.org/Mainline_U-boot#DRAM_Settings And injecting the .clock, .zq and .emr1 parameters from Kconfig.
static struct dram_para dram_para = { /* DRAM timings: 7-7-7-18 (480 MHz) */ .clock = 480, .type = 3, .rank_num = 1, .cas = 7, .zq = 0x7b, .odt_en = 0, .tpr0 = 0x30927790, .tpr1 = 0xa0b0, .tpr2 = 0x23200, .tpr3 = 0x0, .tpr4 = 0x0, .tpr5 = 0x0, .emr1 = 0x0, .emr2 = 0x8, .emr3 = 0x0, .active_windowing = 1, };
static struct dram_para dram_para = { /* DRAM timings: 7-8-8-20 (528 MHz) */ .clock = 528, .type = 3, .rank_num = 1, .cas = 7, .zq = 0x7b, .odt_en = 0, .tpr0 = 0x36948890, .tpr1 = 0xa0c0, .tpr2 = 0x23600, .tpr3 = 0x0, .tpr4 = 0x0, .tpr5 = 0x0, .emr1 = 0x0, .emr2 = 0x8, .emr3 = 0x0, .active_windowing = 1, };
Alternatively, we can add runtime calculation of cas/tpr0/tpr1/tpr2/emr2 parameters directly into SPL, thus better matching the selected DRAM clock speed and reducing memory access latency. The disadvantages of this approach are: 1. Somewhat increased SPL size. 2. Some DDR3 chips have better timings than generic JEDEC speed bins, so using generic timings for every board may be not very optimal.
This all is only blocked on the lack of cooperation from the u-boot sunxi boards maintainers, who appear to be kinda happy with the status quo and prefer the sacred magic settings from the vendors over what is suggested by the geeks doing reverse engineering ;-)
To sum it up. We need motivated testers in order to improve things. Clever hackers are not really required.

Hi,
On 18-01-15 22:46, Siarhei Siamashka wrote:
On Sun, 18 Jan 2015 13:23:26 +0100 Hans de Goede hdegoede@redhat.com wrote:
While working on adding more boards I noticed that we lack a config for the 512M cubieboard, and that some of the new boards which I want to add also have 512M and 1G variants, rather then adding 2 defconfig's for all of these, lets switch the exising boards which have both a 512M and 1024M variant over to the sun4i dram autoconfig code.
This also drops the foo_RAMSIZE_defconfig variants of boards where we currently have 2 separate configs already.
Note:
- The newly introduced CONFIG_DRAM_EMR1 kconfig value is not used with
a value other then its default for now, but we need this to be configurable to support some new boards with auto dram config.
- We always set all CONFIG_DRAM_foo values in defconfigs, even if they match
the defaults, this is done to make it more clear what values are used for a certain board.
This has been tested on a Mele A1000, Mini-X and a Cubieboard, all 1G variants, the dram autoconfig code has also been tested on a 512M mk802 (a defconfig for the mk802 is added in a later patch).
Signed-off-by: Hans de Goede hdegoede@redhat.com
Thanks for finally finding time to do some refinements in this pile of junk dram settings for the boards that you are maintaining.
I think that adding the Kconfig options is fine as long as they are not abused and the 'dram_para' structure is kept. We want to be able to update DRAM settings without the need of recompiling SPL. Currently this can be relatively easily done by finding and patching the 'dram_para' structure inside of the SPL binary.
In general this looks like a good change. However see below.
[...]
+++ b/board/sunxi/dram_sun4i_auto.c @@ -0,0 +1,31 @@ +/* this file is generated, don't edit it yourself */
+#include <common.h> +#include <asm/arch/dram.h>
+static struct dram_para dram_para = {
- .clock = CONFIG_DRAM_CLK,
- .type = 3,
- .rank_num = 1,
- .density = 0,
- .io_width = 0,
- .bus_width = 0,
- .cas = 6,
- .zq = CONFIG_DRAM_ZQ,
- .odt_en = 0,
- .size = 0,
- .tpr0 = 0x30926692,
- .tpr1 = 0x1090,
- .tpr2 = 0x1a0c8,
- .tpr3 = 0,
- .tpr4 = 0,
- .tpr5 = 0,
- .emr1 = CONFIG_DRAM_EMR1,
- .emr2 = 0,
- .emr3 = 0,
+};
As we already discussed earlier http://lists.denx.de/pipermail/u-boot/2014-September/189266.html these tpr0/tpr1/tpr2 settings are configured for DDR2-800E (and 400MHz clock speed because of double data rate). Yes, DDR2 (!) instead of DDR3. This in practice is not very much off from DDR3-800, except for the tXS parameter. But tXS is only relevant for self-refresh, which is currently not used by the u-boot or the mainline kernel anyway. That's why this all does not crash and burn in an obvious way.
Anyway, these timings are still wrong for the boards running DRAM at the clock speeds higher than 400MHz. For example, they are ~20% outside of the valid range at 480MHz and this all works by pure luck, thanks to the hardware typically having some safety/overclocking margin.
If we look at the parameters used by the sun7i boards: .cas = 9, .tpr0 = 0x42d899b7, .tpr1 = 0xa090, .tpr2 = 0x22a00, ... then we can see that the settings are also a bit fishy. The tpr1/tpr2 parameters are matching DDR3-800 timings. And tpr0 is matching DDR3-1333 timings with 1KB (!) page size, while many sunxi devices are using 2KB pages. So it's some weird crossbreed, which is however somewhat less wrong than the settings from sun4i boards.
I would suggest trying one of the following DRAM settings, generated as explained at http://linux-sunxi.org/Mainline_U-boot#DRAM_Settings And injecting the .clock, .zq and .emr1 parameters from Kconfig.
static struct dram_para dram_para = { /* DRAM timings: 7-7-7-18 (480 MHz) */ .clock = 480, .type = 3, .rank_num = 1, .cas = 7, .zq = 0x7b, .odt_en = 0, .tpr0 = 0x30927790, .tpr1 = 0xa0b0, .tpr2 = 0x23200, .tpr3 = 0x0, .tpr4 = 0x0, .tpr5 = 0x0, .emr1 = 0x0, .emr2 = 0x8, .emr3 = 0x0, .active_windowing = 1, };
static struct dram_para dram_para = { /* DRAM timings: 7-8-8-20 (528 MHz) */ .clock = 528, .type = 3, .rank_num = 1, .cas = 7, .zq = 0x7b, .odt_en = 0, .tpr0 = 0x36948890, .tpr1 = 0xa0c0, .tpr2 = 0x23600, .tpr3 = 0x0, .tpr4 = 0x0, .tpr5 = 0x0, .emr1 = 0x0, .emr2 = 0x8, .emr3 = 0x0, .active_windowing = 1, };
Alternatively, we can add runtime calculation of cas/tpr0/tpr1/tpr2/emr2 parameters directly into SPL, thus better matching the selected DRAM clock speed and reducing memory access latency. The disadvantages of this approach are:
- Somewhat increased SPL size.
- Some DDR3 chips have better timings than generic JEDEC speed bins, so using generic timings for every board may be not very optimal.
This all is only blocked on the lack of cooperation from the u-boot sunxi boards maintainers, who appear to be kinda happy with the status quo and prefer the sacred magic settings from the vendors over what is suggested by the geeks doing reverse engineering ;-)
Siarhei, thanks for bringing this topic up once again, I agree that this is ideally something which we should fix. The problem is that the only way to know that any new settings which we do are actually good, is to test them on lots of boards, and I do not mean one of each board, but at least 10 of each board or some such.
Unfortunately that is not really feasible due to -ENOHWARDARE (not 10 of each) and -ENOTIME.
Still I would like to get this sorted, so I would like to move to the recommended timings for the generic JEDEC speed bins, you rightfully point out that those may not be 100% optimal, but given that we're dealing with a lot of cheap boards, I think that those are our best bet.
The plan would be for you to submit a patch for that, and then I'll add that to my sunxi-wip branch right away, this way all the testing I do, as well as all the testing people using my sunxi-wip branch do will use the new timings, and then once v2015.04 stabilizes a bit we can add that patch to u-boot-sunxi/next, getting it ready for v2015.07 .
Does that sound like a plan ?
Ian, what do you think about this ?
As for runtime calculation, it might be easier to instead do something like this in the "new" dram_sun4i_auto.c file which my patch-set introduces:
#if CONFIG_DRAM_CLK > 528 #error DRAM clocks above 528 Mhz are not supported #elif CONFIG_DRAM_CLK > 480
static struct dram_para dram_para = { /* DRAM timings: 7-8-8-20 (528 MHz) */ .clock = CONFIG_DRAM_CLK, ... };
#elif CONFIG_DRAM_CLK > 400
static struct dram_para dram_para = { /* DRAM timings: 7-7-7-18 (480 MHz) */ .clock = CONFIG_DRAM_CLK, ... };
#elif CONFIG_DRAM_CLK > 360
static struct dram_para dram_para = { /* DRAM timings: a-b-c-d (400 MHz) */ .clock = CONFIG_DRAM_CLK, ... };
#else
static struct dram_para dram_para = { /* DRAM timings: a-b-c-d (360 MHz) */ .clock = CONFIG_DRAM_CLK, ... };
#endif
This way we will not grow the spl, and keep an easy editable set of dram_para in the spl for people who like to hexedit the spl ...
Regards,
Hans

On Mon, 2015-01-19 at 15:35 +0100, Hans de Goede wrote:
Siarhei, thanks for bringing this topic up once again, I agree that this is ideally something which we should fix. The problem is that the only way to know that any new settings which we do are actually good, is to test them on lots of boards, and I do not mean one of each board, but at least 10 of each board or some such.
I agree. Having settings which are optimal for Hans' board but untested elsewhere would not be a good idea IMHO.
Still I would like to get this sorted, so I would like to move to the recommended timings for the generic JEDEC speed bins, you rightfully point out that those may not be 100% optimal, but given that we're dealing with a lot of cheap boards, I think that those are our best bet.
Agreed. In the absence of an ability to test lots of boards this is probably the best we can do.
An alternative would be to use the settings from the factory firmware, but I don't think we have any real reason to think these will be any better in general than the JEDEC timings, at least not without lots of testing (see previous paragraph).
The plan would be for you to submit a patch for that, and then I'll add that to my sunxi-wip branch right away, this way all the testing I do, as well as all the testing people using my sunxi-wip branch do will use the new timings, and then once v2015.04 stabilizes a bit we can add that patch to u-boot-sunxi/next, getting it ready for v2015.07 .
Does that sound like a plan ?
Ian, what do you think about this ?
Go for it.
This way we will not grow the spl, and keep an easy editable set of dram_para in the spl for people who like to hexedit the spl ...
At the start of the #ifdef chain you could add
#ifdef CONFIG...CUSTOM_DRAM_SETTINGS static struct dram_para dram_para = { CONFIG_...CUSTOM_DRAM_SETTINGS }; #elif ...
along with a corresponding Kconfig entry (perhaps depends on EXPERT?).
Then people who really want to tweak things could enter "CONFIG....=.clock=XXX,.type=YYY,.." in their .config (menuconfig etc) or defconfig to their heart's content. (only question is what the character limit on a config option is...)
Ian.

Currently we've separate detailed dram settings for all sun4i boards, this moves them over to using auto dram configuration so that we can get rid of all the per board dram_foo.c files.
Signed-off-by: Hans de Goede hdegoede@redhat.com --- board/sunxi/Makefile | 2 +- board/sunxi/dram_sun4i_408_1024_iow8.c | 31 ------------------------------- configs/Linksprite_pcDuino_defconfig | 3 +++ 3 files changed, 4 insertions(+), 32 deletions(-) delete mode 100644 board/sunxi/dram_sun4i_408_1024_iow8.c
diff --git a/board/sunxi/Makefile b/board/sunxi/Makefile index 606bf73..0111b56 100644 --- a/board/sunxi/Makefile +++ b/board/sunxi/Makefile @@ -32,7 +32,7 @@ obj-$(CONFIG_TARGET_MELE_A1000) += dram_sun4i_auto.o obj-$(CONFIG_TARGET_MELE_M3) += dram_sun7i_384_1024_iow16.o obj-$(CONFIG_TARGET_MINI_X) += dram_sun4i_auto.o obj-$(CONFIG_TARGET_MSI_PRIMO73) += dram_sun7i_384_1024_iow16.o -obj-$(CONFIG_TARGET_PCDUINO) += dram_sun4i_408_1024_iow8.o +obj-$(CONFIG_TARGET_PCDUINO) += dram_sun4i_auto.o obj-$(CONFIG_TARGET_PCDUINO3) += dram_linksprite_pcduino3.o obj-$(CONFIG_TARGET_QT840A) += dram_sun7i_384_512_busw16_iow16.o obj-$(CONFIG_TARGET_R7DONGLE) += dram_r7dongle.o diff --git a/board/sunxi/dram_sun4i_408_1024_iow8.c b/board/sunxi/dram_sun4i_408_1024_iow8.c deleted file mode 100644 index c6d87d2..0000000 --- a/board/sunxi/dram_sun4i_408_1024_iow8.c +++ /dev/null @@ -1,31 +0,0 @@ -/* this file is generated, don't edit it yourself */ - -#include <common.h> -#include <asm/arch/dram.h> - -static struct dram_para dram_para = { - .clock = 408, - .type = 3, - .rank_num = 1, - .density = 2048, - .io_width = 8, - .bus_width = 32, - .cas = 6, - .zq = 123, - .odt_en = 0, - .size = 1024, - .tpr0 = 0x30926692, - .tpr1 = 0x1090, - .tpr2 = 0x1a0c8, - .tpr3 = 0, - .tpr4 = 0, - .tpr5 = 0, - .emr1 = 0, - .emr2 = 0, - .emr3 = 0, -}; - -unsigned long sunxi_dram_init(void) -{ - return dramc_init(&dram_para); -} diff --git a/configs/Linksprite_pcDuino_defconfig b/configs/Linksprite_pcDuino_defconfig index f5b0ca9..0bf329e 100644 --- a/configs/Linksprite_pcDuino_defconfig +++ b/configs/Linksprite_pcDuino_defconfig @@ -5,3 +5,6 @@ CONFIG_FDTFILE="sun4i-a10-pcduino.dtb" +S:CONFIG_ARCH_SUNXI=y +S:CONFIG_MACH_SUN4I=y +S:CONFIG_TARGET_PCDUINO=y ++S:CONFIG_DRAM_CLK=408 ++S:CONFIG_DRAM_ZQ=123 ++S:CONFIG_DRAM_EMR1=0

On Sun, 2015-01-18 at 13:23 +0100, Hans de Goede wrote:
Currently we've separate detailed dram settings for all sun4i boards, this moves them
There's only one board here, did you intend for the next patch to be folder with this one as a bulk switch? Or is there something particularly interesting about this one?
over to using auto dram configuration so that we can get rid of all the per board dram_foo.c files.
Signed-off-by: Hans de Goede hdegoede@redhat.com
board/sunxi/Makefile | 2 +- board/sunxi/dram_sun4i_408_1024_iow8.c | 31 ------------------------------- configs/Linksprite_pcDuino_defconfig | 3 +++ 3 files changed, 4 insertions(+), 32 deletions(-) delete mode 100644 board/sunxi/dram_sun4i_408_1024_iow8.c
diff --git a/board/sunxi/Makefile b/board/sunxi/Makefile index 606bf73..0111b56 100644 --- a/board/sunxi/Makefile +++ b/board/sunxi/Makefile @@ -32,7 +32,7 @@ obj-$(CONFIG_TARGET_MELE_A1000) += dram_sun4i_auto.o obj-$(CONFIG_TARGET_MELE_M3) += dram_sun7i_384_1024_iow16.o obj-$(CONFIG_TARGET_MINI_X) += dram_sun4i_auto.o obj-$(CONFIG_TARGET_MSI_PRIMO73) += dram_sun7i_384_1024_iow16.o -obj-$(CONFIG_TARGET_PCDUINO) += dram_sun4i_408_1024_iow8.o +obj-$(CONFIG_TARGET_PCDUINO) += dram_sun4i_auto.o obj-$(CONFIG_TARGET_PCDUINO3) += dram_linksprite_pcduino3.o obj-$(CONFIG_TARGET_QT840A) += dram_sun7i_384_512_busw16_iow16.o obj-$(CONFIG_TARGET_R7DONGLE) += dram_r7dongle.o diff --git a/board/sunxi/dram_sun4i_408_1024_iow8.c b/board/sunxi/dram_sun4i_408_1024_iow8.c deleted file mode 100644 index c6d87d2..0000000 --- a/board/sunxi/dram_sun4i_408_1024_iow8.c +++ /dev/null @@ -1,31 +0,0 @@ -/* this file is generated, don't edit it yourself */
-#include <common.h> -#include <asm/arch/dram.h>
-static struct dram_para dram_para = {
- .clock = 408,
- .type = 3,
- .rank_num = 1,
- .density = 2048,
- .io_width = 8,
- .bus_width = 32,
- .cas = 6,
- .zq = 123,
- .odt_en = 0,
- .size = 1024,
- .tpr0 = 0x30926692,
- .tpr1 = 0x1090,
- .tpr2 = 0x1a0c8,
- .tpr3 = 0,
- .tpr4 = 0,
- .tpr5 = 0,
- .emr1 = 0,
- .emr2 = 0,
- .emr3 = 0,
-};
-unsigned long sunxi_dram_init(void) -{
- return dramc_init(&dram_para);
-} diff --git a/configs/Linksprite_pcDuino_defconfig b/configs/Linksprite_pcDuino_defconfig index f5b0ca9..0bf329e 100644 --- a/configs/Linksprite_pcDuino_defconfig +++ b/configs/Linksprite_pcDuino_defconfig @@ -5,3 +5,6 @@ CONFIG_FDTFILE="sun4i-a10-pcduino.dtb" +S:CONFIG_ARCH_SUNXI=y +S:CONFIG_MACH_SUN4I=y +S:CONFIG_TARGET_PCDUINO=y ++S:CONFIG_DRAM_CLK=408 ++S:CONFIG_DRAM_ZQ=123 ++S:CONFIG_DRAM_EMR1=0

On Sun, 2015-01-18 at 16:24 +0000, Ian Campbell wrote:
On Sun, 2015-01-18 at 13:23 +0100, Hans de Goede wrote:
Currently we've separate detailed dram settings for all sun4i boards, this moves them
There's only one board here, did you intend for the next patch to be folder with this one as a bulk switch? Or is there something particularly interesting about this one?
Maybe you intended to Cc Zoltan who is listed in MAINTAINERS for this board for testing? (Whereas apparently you own all the ones in the next patch).

Hi,
On 18-01-15 17:26, Ian Campbell wrote:
On Sun, 2015-01-18 at 16:24 +0000, Ian Campbell wrote:
On Sun, 2015-01-18 at 13:23 +0100, Hans de Goede wrote:
Currently we've separate detailed dram settings for all sun4i boards, this moves them
There's only one board here, did you intend for the next patch to be folder with this one as a bulk switch? Or is there something particularly interesting about this one?
Maybe you intended to Cc Zoltan who is listed in MAINTAINERS for this board for testing? (Whereas apparently you own all the ones in the next patch).
Right, but rather then Cc-ing him I've mailed him privately.
Regards,
Hans

Hi,
On 18-01-15 17:24, Ian Campbell wrote:
On Sun, 2015-01-18 at 13:23 +0100, Hans de Goede wrote:
Currently we've separate detailed dram settings for all sun4i boards, this moves them
There's only one board here, did you intend for the next patch to be folder with this one as a bulk switch? Or is there something particularly interesting about this one?
The only thing special about this board is that it is the only currently supported sun4i board which I do not have :)
I'm waiting for Zoltan to get back to me with testing results and then I can add his Tested-by, I can squash it into the next patch and add his Tested-by there, I guess that makes more sense.
Regards,
Hans
over to using auto dram configuration so that we can get rid of all the per board dram_foo.c files.
Signed-off-by: Hans de Goede hdegoede@redhat.com
board/sunxi/Makefile | 2 +- board/sunxi/dram_sun4i_408_1024_iow8.c | 31 ------------------------------- configs/Linksprite_pcDuino_defconfig | 3 +++ 3 files changed, 4 insertions(+), 32 deletions(-) delete mode 100644 board/sunxi/dram_sun4i_408_1024_iow8.c
diff --git a/board/sunxi/Makefile b/board/sunxi/Makefile index 606bf73..0111b56 100644 --- a/board/sunxi/Makefile +++ b/board/sunxi/Makefile @@ -32,7 +32,7 @@ obj-$(CONFIG_TARGET_MELE_A1000) += dram_sun4i_auto.o obj-$(CONFIG_TARGET_MELE_M3) += dram_sun7i_384_1024_iow16.o obj-$(CONFIG_TARGET_MINI_X) += dram_sun4i_auto.o obj-$(CONFIG_TARGET_MSI_PRIMO73) += dram_sun7i_384_1024_iow16.o -obj-$(CONFIG_TARGET_PCDUINO) += dram_sun4i_408_1024_iow8.o +obj-$(CONFIG_TARGET_PCDUINO) += dram_sun4i_auto.o obj-$(CONFIG_TARGET_PCDUINO3) += dram_linksprite_pcduino3.o obj-$(CONFIG_TARGET_QT840A) += dram_sun7i_384_512_busw16_iow16.o obj-$(CONFIG_TARGET_R7DONGLE) += dram_r7dongle.o diff --git a/board/sunxi/dram_sun4i_408_1024_iow8.c b/board/sunxi/dram_sun4i_408_1024_iow8.c deleted file mode 100644 index c6d87d2..0000000 --- a/board/sunxi/dram_sun4i_408_1024_iow8.c +++ /dev/null @@ -1,31 +0,0 @@ -/* this file is generated, don't edit it yourself */
-#include <common.h> -#include <asm/arch/dram.h>
-static struct dram_para dram_para = {
- .clock = 408,
- .type = 3,
- .rank_num = 1,
- .density = 2048,
- .io_width = 8,
- .bus_width = 32,
- .cas = 6,
- .zq = 123,
- .odt_en = 0,
- .size = 1024,
- .tpr0 = 0x30926692,
- .tpr1 = 0x1090,
- .tpr2 = 0x1a0c8,
- .tpr3 = 0,
- .tpr4 = 0,
- .tpr5 = 0,
- .emr1 = 0,
- .emr2 = 0,
- .emr3 = 0,
-};
-unsigned long sunxi_dram_init(void) -{
- return dramc_init(&dram_para);
-} diff --git a/configs/Linksprite_pcDuino_defconfig b/configs/Linksprite_pcDuino_defconfig index f5b0ca9..0bf329e 100644 --- a/configs/Linksprite_pcDuino_defconfig +++ b/configs/Linksprite_pcDuino_defconfig @@ -5,3 +5,6 @@ CONFIG_FDTFILE="sun4i-a10-pcduino.dtb" +S:CONFIG_ARCH_SUNXI=y +S:CONFIG_MACH_SUN4I=y +S:CONFIG_TARGET_PCDUINO=y ++S:CONFIG_DRAM_CLK=408 ++S:CONFIG_DRAM_ZQ=123 ++S:CONFIG_DRAM_EMR1=0

Currently we've separate detailed dram settings for all sun4i boards, this moves them over to using auto dram configuration so that we can get rid of all the per board dram_foo.c files.
This been tested on a A10-OLinuXino-Lime, Chuwi_V7_CW0825 and ba10_tv_box.
Signed-off-by: Hans de Goede hdegoede@redhat.com --- board/sunxi/Makefile | 8 +------- board/sunxi/dram_a10_olinuxino_l.c | 31 ------------------------------- board/sunxi/dram_sun4i_384_1024_iow8.c | 31 ------------------------------- board/sunxi/dram_sun4i_408_1024_iow16.c | 31 ------------------------------- configs/A10-OLinuXino-Lime_defconfig | 3 +++ configs/Chuwi_V7_CW0825_defconfig | 3 +++ configs/ba10_tv_box_defconfig | 3 +++ 7 files changed, 10 insertions(+), 100 deletions(-) delete mode 100644 board/sunxi/dram_a10_olinuxino_l.c delete mode 100644 board/sunxi/dram_sun4i_384_1024_iow8.c delete mode 100644 board/sunxi/dram_sun4i_408_1024_iow16.c
diff --git a/board/sunxi/Makefile b/board/sunxi/Makefile index 0111b56..f838e7b 100644 --- a/board/sunxi/Makefile +++ b/board/sunxi/Makefile @@ -11,7 +11,7 @@ obj-y += board.o obj-$(CONFIG_SUNXI_GMAC) += gmac.o obj-$(CONFIG_SUNXI_AHCI) += ahci.o -obj-$(CONFIG_TARGET_A10_OLINUXINO_L) += dram_a10_olinuxino_l.o +obj-$(CONFIG_MACH_SUN4I) += dram_sun4i_auto.o obj-$(CONFIG_TARGET_A10S_OLINUXINO_M) += dram_a10s_olinuxino_m.o obj-$(CONFIG_TARGET_A13_OLINUXINO) += dram_a13_olinuxino.o obj-$(CONFIG_TARGET_A13_OLINUXINOM) += dram_a13_oli_micro.o @@ -20,19 +20,13 @@ obj-$(CONFIG_TARGET_A20_OLINUXINO_L2) += dram_a20_olinuxino_l2.o obj-$(CONFIG_TARGET_A20_OLINUXINO_M) += dram_sun7i_384_1024_iow16.o # This is not a typo, uses the same mem settings as the a10s-olinuxino-m obj-$(CONFIG_TARGET_AUXTEK_T004) += dram_a10s_olinuxino_m.o -obj-$(CONFIG_TARGET_BA10_TV_BOX) += dram_sun4i_384_1024_iow8.o obj-$(CONFIG_TARGET_BANANAPI) += dram_bananapi.o obj-$(CONFIG_TARGET_BANANAPRO) += dram_bananapi.o -obj-$(CONFIG_TARGET_CHUWI_V7_CW0825) += dram_sun4i_408_1024_iow16.o -obj-$(CONFIG_TARGET_CUBIEBOARD) += dram_sun4i_auto.o obj-$(CONFIG_TARGET_CUBIEBOARD2) += dram_cubieboard2.o obj-$(CONFIG_TARGET_CUBIETRUCK) += dram_cubietruck.o obj-$(CONFIG_TARGET_I12_TVBOX) += dram_sun7i_384_1024_iow16.o -obj-$(CONFIG_TARGET_MELE_A1000) += dram_sun4i_auto.o obj-$(CONFIG_TARGET_MELE_M3) += dram_sun7i_384_1024_iow16.o -obj-$(CONFIG_TARGET_MINI_X) += dram_sun4i_auto.o obj-$(CONFIG_TARGET_MSI_PRIMO73) += dram_sun7i_384_1024_iow16.o -obj-$(CONFIG_TARGET_PCDUINO) += dram_sun4i_auto.o obj-$(CONFIG_TARGET_PCDUINO3) += dram_linksprite_pcduino3.o obj-$(CONFIG_TARGET_QT840A) += dram_sun7i_384_512_busw16_iow16.o obj-$(CONFIG_TARGET_R7DONGLE) += dram_r7dongle.o diff --git a/board/sunxi/dram_a10_olinuxino_l.c b/board/sunxi/dram_a10_olinuxino_l.c deleted file mode 100644 index 24a1bd9..0000000 --- a/board/sunxi/dram_a10_olinuxino_l.c +++ /dev/null @@ -1,31 +0,0 @@ -/* this file is generated, don't edit it yourself */ - -#include <common.h> -#include <asm/arch/dram.h> - -static struct dram_para dram_para = { - .clock = 480, - .type = 3, - .rank_num = 1, - .density = 4096, - .io_width = 16, - .bus_width = 16, - .cas = 6, - .zq = 123, - .odt_en = 0, - .size = 512, - .tpr0 = 0x30926692, - .tpr1 = 0x1090, - .tpr2 = 0x1a0c8, - .tpr3 = 0, - .tpr4 = 0, - .tpr5 = 0, - .emr1 = 0x4, - .emr2 = 0, - .emr3 = 0, -}; - -unsigned long sunxi_dram_init(void) -{ - return dramc_init(&dram_para); -} diff --git a/board/sunxi/dram_sun4i_384_1024_iow8.c b/board/sunxi/dram_sun4i_384_1024_iow8.c deleted file mode 100644 index b0fcc55..0000000 --- a/board/sunxi/dram_sun4i_384_1024_iow8.c +++ /dev/null @@ -1,31 +0,0 @@ -/* this file is generated, don't edit it yourself */ - -#include <common.h> -#include <asm/arch/dram.h> - -static struct dram_para dram_para = { - .clock = 384, - .type = 3, - .rank_num = 1, - .density = 2048, - .io_width = 8, - .bus_width = 32, - .cas = 6, - .zq = 123, - .odt_en = 0, - .size = 1024, - .tpr0 = 0x30926692, - .tpr1 = 0x1090, - .tpr2 = 0x1a0c8, - .tpr3 = 0, - .tpr4 = 0, - .tpr5 = 0, - .emr1 = 0x4, - .emr2 = 0, - .emr3 = 0, -}; - -unsigned long sunxi_dram_init(void) -{ - return dramc_init(&dram_para); -} diff --git a/board/sunxi/dram_sun4i_408_1024_iow16.c b/board/sunxi/dram_sun4i_408_1024_iow16.c deleted file mode 100644 index 1bc9f73..0000000 --- a/board/sunxi/dram_sun4i_408_1024_iow16.c +++ /dev/null @@ -1,31 +0,0 @@ -/* this file is generated, don't edit it yourself */ - -#include <common.h> -#include <asm/arch/dram.h> - -static struct dram_para dram_para = { - .clock = 408, - .type = 3, - .rank_num = 1, - .density = 4096, - .io_width = 16, - .bus_width = 32, - .cas = 6, - .zq = 123, - .odt_en = 0, - .size = 1024, - .tpr0 = 0x30926692, - .tpr1 = 0x1090, - .tpr2 = 0x1a0c8, - .tpr3 = 0, - .tpr4 = 0, - .tpr5 = 0, - .emr1 = 0x4, - .emr2 = 0, - .emr3 = 0, -}; - -unsigned long sunxi_dram_init(void) -{ - return dramc_init(&dram_para); -} diff --git a/configs/A10-OLinuXino-Lime_defconfig b/configs/A10-OLinuXino-Lime_defconfig index f0cbf21..ac7adc8 100644 --- a/configs/A10-OLinuXino-Lime_defconfig +++ b/configs/A10-OLinuXino-Lime_defconfig @@ -5,3 +5,6 @@ CONFIG_FDTFILE="sun4i-a10-olinuxino-lime.dtb" +S:CONFIG_ARCH_SUNXI=y +S:CONFIG_MACH_SUN4I=y +S:CONFIG_TARGET_A10_OLINUXINO_L=y ++S:CONFIG_DRAM_CLK=480 ++S:CONFIG_DRAM_ZQ=123 ++S:CONFIG_DRAM_EMR1=4 diff --git a/configs/Chuwi_V7_CW0825_defconfig b/configs/Chuwi_V7_CW0825_defconfig index 26cac90..9617907 100644 --- a/configs/Chuwi_V7_CW0825_defconfig +++ b/configs/Chuwi_V7_CW0825_defconfig @@ -12,3 +12,6 @@ CONFIG_VIDEO_LCD_PANEL_HITACHI_TX18D42VM=y +S:CONFIG_ARCH_SUNXI=y +S:CONFIG_MACH_SUN4I=y +S:CONFIG_TARGET_CHUWI_V7_CW0825=y ++S:CONFIG_DRAM_CLK=408 ++S:CONFIG_DRAM_ZQ=123 ++S:CONFIG_DRAM_EMR1=4 diff --git a/configs/ba10_tv_box_defconfig b/configs/ba10_tv_box_defconfig index 37bf51b..0bfb5bd 100644 --- a/configs/ba10_tv_box_defconfig +++ b/configs/ba10_tv_box_defconfig @@ -6,3 +6,6 @@ CONFIG_USB2_VBUS_PIN="PH12" +S:CONFIG_ARCH_SUNXI=y +S:CONFIG_MACH_SUN4I=y +S:CONFIG_TARGET_BA10_TV_BOX=y ++S:CONFIG_DRAM_CLK=384 ++S:CONFIG_DRAM_ZQ=123 ++S:CONFIG_DRAM_EMR1=4

On Sun, 2015-01-18 at 13:23 +0100, Hans de Goede wrote:
Currently we've separate detailed dram settings for all sun4i boards, this moves them over to using auto dram configuration so that we can get rid of all the per board dram_foo.c files.
This been tested on a A10-OLinuXino-Lime, Chuwi_V7_CW0825 and ba10_tv_box.
Unless I'm mistaken that's one for each of the dram_*.c removed, good.
Signed-off-by: Hans de Goede hdegoede@redhat.com
Acked-by: Ian Campbell ijc@hellion.org.uk

CONFIG_TARGET_FOO is only used in board/sunxi/Makefile to select the dram config for sun5i and sun7i boards and in board/sunxi/gmac.c for some special handling of the bananapi/bananapro (both sun7i), iow it is not used at all on any sun4i, sun6i and sun8i boards so lets get rid of it there.
Signed-off-by: Hans de Goede hdegoede@redhat.com --- board/sunxi/Kconfig | 57 ------------------------------------ configs/A10-OLinuXino-Lime_defconfig | 1 - configs/CSQ_CS908_defconfig | 1 - configs/Chuwi_V7_CW0825_defconfig | 1 - configs/Colombus_defconfig | 1 - configs/Cubieboard_defconfig | 1 - configs/Hummingbird_A31_defconfig | 1 - configs/Linksprite_pcDuino_defconfig | 1 - configs/MSI_Primo81_defconfig | 10 ++++++- configs/Mele_A1000_defconfig | 1 - configs/Mele_M9_defconfig | 1 - configs/Mini-X_defconfig | 1 - configs/ba10_tv_box_defconfig | 1 - 13 files changed, 9 insertions(+), 69 deletions(-)
diff --git a/board/sunxi/Kconfig b/board/sunxi/Kconfig index f7064d0..b9c25cc 100644 --- a/board/sunxi/Kconfig +++ b/board/sunxi/Kconfig @@ -75,10 +75,6 @@ config SYS_CONFIG_NAME choice prompt "Board"
-config TARGET_A10_OLINUXINO_L - bool "A10_OLINUXINO_L" - depends on MACH_SUN4I - config TARGET_A10S_OLINUXINO_M bool "A10S_OLINUXINO_M" depends on MACH_SUN5I @@ -115,58 +111,22 @@ config TARGET_BANANAPRO bool "BANANAPRO" depends on MACH_SUN7I
-config TARGET_CHUWI_V7_CW0825 - bool "CHUWI_V7_CW0825" - depends on MACH_SUN4I - -config TARGET_COLOMBUS - bool "COLOMBUS" - depends on MACH_SUN6I - config TARGET_CUBIEBOARD2 bool "CUBIEBOARD2" depends on MACH_SUN7I
-config TARGET_CUBIEBOARD - bool "CUBIEBOARD" - depends on MACH_SUN4I - config TARGET_CUBIETRUCK bool "CUBIETRUCK" depends on MACH_SUN7I
-config TARGET_HUMMINGBIRD_A31 - bool "HUMMINGBIRD_A31" - depends on MACH_SUN6I - -config TARGET_IPPO_Q8H_V5 - bool "IPPO_Q8H_V5" - depends on MACH_SUN8I - -config TARGET_PCDUINO - bool "PCDUINO" - depends on MACH_SUN4I - config TARGET_PCDUINO3 bool "PCDUINO3" depends on MACH_SUN7I
-config TARGET_MELE_A1000 - bool "MELE_A1000" - depends on MACH_SUN4I - config TARGET_MELE_M3 bool "MELE_M3" depends on MACH_SUN7I
-config TARGET_MELE_M9 - bool "MELE_M9" - depends on MACH_SUN6I - -config TARGET_MINI_X - bool "MINI_X" - depends on MACH_SUN4I - config TARGET_MSI_PRIMO73 bool "MSI Primo73 (7" tablet)" depends on MACH_SUN7I @@ -180,23 +140,6 @@ config TARGET_MSI_PRIMO73 OTG and 3.5mm headphone jack. More details are available at http://linux-sunxi.org/MSI_Primo73
-config TARGET_MSI_PRIMO81 - bool "MSI Primo81 (7.85" tablet)" - depends on MACH_SUN6I - ---help--- - The MSI Primo81 is an A31s based tablet, with 1G RAM, 16G NAND, - 1024x768 IPS LCD display, mono speaker, 0.3 MP front camera, 2.0 MP - rear camera, 3500 mAh battery, gt911 touchscreen, mma8452 accelerometer - and rtl8188etv usb wifi. Has "power", "volume+" and "volume-" buttons - (both volume buttons are also connected to the UBOOT_SEL pin). The - external connectors are represented by MicroSD slot, MiniHDMI, MicroUSB - OTG and 3.5mm headphone jack. More details are available at - http://linux-sunxi.org/MSI_Primo81 - -config TARGET_BA10_TV_BOX - bool "BA10_TV_BOX" - depends on MACH_SUN4I - config TARGET_I12_TVBOX bool "I12_TVBOX" depends on MACH_SUN7I diff --git a/configs/A10-OLinuXino-Lime_defconfig b/configs/A10-OLinuXino-Lime_defconfig index ac7adc8..8fa1a33 100644 --- a/configs/A10-OLinuXino-Lime_defconfig +++ b/configs/A10-OLinuXino-Lime_defconfig @@ -4,7 +4,6 @@ CONFIG_FDTFILE="sun4i-a10-olinuxino-lime.dtb" +S:CONFIG_ARM=y +S:CONFIG_ARCH_SUNXI=y +S:CONFIG_MACH_SUN4I=y -+S:CONFIG_TARGET_A10_OLINUXINO_L=y +S:CONFIG_DRAM_CLK=480 +S:CONFIG_DRAM_ZQ=123 +S:CONFIG_DRAM_EMR1=4 diff --git a/configs/CSQ_CS908_defconfig b/configs/CSQ_CS908_defconfig index 1b6cdbf..4040bee 100644 --- a/configs/CSQ_CS908_defconfig +++ b/configs/CSQ_CS908_defconfig @@ -4,7 +4,6 @@ CONFIG_FDTFILE="sun6i-a31s-cs908.dtb" +S:CONFIG_ARM=y +S:CONFIG_ARCH_SUNXI=y +S:CONFIG_MACH_SUN6I=y -+S:CONFIG_TARGET_CSQ_CS908=y +S:CONFIG_DRAM_CLK=432 +S:CONFIG_DRAM_ZQ=123 # Ethernet phy power diff --git a/configs/Chuwi_V7_CW0825_defconfig b/configs/Chuwi_V7_CW0825_defconfig index 9617907..3141024 100644 --- a/configs/Chuwi_V7_CW0825_defconfig +++ b/configs/Chuwi_V7_CW0825_defconfig @@ -11,7 +11,6 @@ CONFIG_VIDEO_LCD_PANEL_HITACHI_TX18D42VM=y +S:CONFIG_ARM=y +S:CONFIG_ARCH_SUNXI=y +S:CONFIG_MACH_SUN4I=y -+S:CONFIG_TARGET_CHUWI_V7_CW0825=y +S:CONFIG_DRAM_CLK=408 +S:CONFIG_DRAM_ZQ=123 +S:CONFIG_DRAM_EMR1=4 diff --git a/configs/Colombus_defconfig b/configs/Colombus_defconfig index f42ae52..33edcc4 100644 --- a/configs/Colombus_defconfig +++ b/configs/Colombus_defconfig @@ -4,7 +4,6 @@ CONFIG_FDTFILE="sun6i-a31-colombus.dtb" +S:CONFIG_ARM=y +S:CONFIG_ARCH_SUNXI=y +S:CONFIG_MACH_SUN6I=y -+S:CONFIG_TARGET_COLOMBUS=y +S:CONFIG_DRAM_CLK=240 +S:CONFIG_DRAM_ZQ=251 # Wifi power diff --git a/configs/Cubieboard_defconfig b/configs/Cubieboard_defconfig index b256b95..4efc6e1 100644 --- a/configs/Cubieboard_defconfig +++ b/configs/Cubieboard_defconfig @@ -4,7 +4,6 @@ CONFIG_FDTFILE="sun4i-a10-cubieboard.dtb" +S:CONFIG_ARM=y +S:CONFIG_ARCH_SUNXI=y +S:CONFIG_MACH_SUN4I=y -+S:CONFIG_TARGET_CUBIEBOARD=y +S:CONFIG_DRAM_CLK=480 +S:CONFIG_DRAM_ZQ=123 +S:CONFIG_DRAM_EMR1=0 diff --git a/configs/Hummingbird_A31_defconfig b/configs/Hummingbird_A31_defconfig index 8896999..0275463 100644 --- a/configs/Hummingbird_A31_defconfig +++ b/configs/Hummingbird_A31_defconfig @@ -6,7 +6,6 @@ CONFIG_VIDEO_VGA_EXTERNAL_DAC_EN="PH25" +S:CONFIG_ARM=y +S:CONFIG_ARCH_SUNXI=y +S:CONFIG_MACH_SUN6I=y -+S:CONFIG_TARGET_HUMMINGBIRD_A31=y +S:CONFIG_DRAM_CLK=312 +S:CONFIG_DRAM_ZQ=251 # Wifi power diff --git a/configs/Linksprite_pcDuino_defconfig b/configs/Linksprite_pcDuino_defconfig index 0bf329e..1ba37bb 100644 --- a/configs/Linksprite_pcDuino_defconfig +++ b/configs/Linksprite_pcDuino_defconfig @@ -4,7 +4,6 @@ CONFIG_FDTFILE="sun4i-a10-pcduino.dtb" +S:CONFIG_ARM=y +S:CONFIG_ARCH_SUNXI=y +S:CONFIG_MACH_SUN4I=y -+S:CONFIG_TARGET_PCDUINO=y +S:CONFIG_DRAM_CLK=408 +S:CONFIG_DRAM_ZQ=123 +S:CONFIG_DRAM_EMR1=0 diff --git a/configs/MSI_Primo81_defconfig b/configs/MSI_Primo81_defconfig index b4b0f6d..140f864 100644 --- a/configs/MSI_Primo81_defconfig +++ b/configs/MSI_Primo81_defconfig @@ -1,3 +1,12 @@ +# The MSI Primo81 is an A31s based tablet, with 1G RAM, 16G NAND, +# 1024x768 IPS LCD display, mono speaker, 0.3 MP front camera, 2.0 MP +# rear camera, 3500 mAh battery, gt911 touchscreen, mma8452 accelerometer +# and rtl8188etv usb wifi. Has "power", "volume+" and "volume-" buttons +# (both volume buttons are also connected to the UBOOT_SEL pin). The +# external connectors are represented by MicroSD slot, MiniHDMI, MicroUSB +# OTG and 3.5mm headphone jack. More details are available at +# http://linux-sunxi.org/MSI_Primo81 + CONFIG_SPL=y CONFIG_SYS_EXTRA_OPTIONS="" CONFIG_FDTFILE="sun6i-a31s-primo81.dtb" @@ -5,7 +14,6 @@ CONFIG_USB_KEYBOARD=n +S:CONFIG_ARM=y +S:CONFIG_ARCH_SUNXI=y +S:CONFIG_MACH_SUN6I=y -+S:CONFIG_TARGET_MSI_PRIMO81=y +S:CONFIG_DRAM_CLK=360 +S:CONFIG_DRAM_ZQ=122 # Wifi power diff --git a/configs/Mele_A1000_defconfig b/configs/Mele_A1000_defconfig index 3b4a19e..1a0a025 100644 --- a/configs/Mele_A1000_defconfig +++ b/configs/Mele_A1000_defconfig @@ -5,7 +5,6 @@ CONFIG_VIDEO_VGA=y +S:CONFIG_ARM=y +S:CONFIG_ARCH_SUNXI=y +S:CONFIG_MACH_SUN4I=y -+S:CONFIG_TARGET_MELE_A1000=y +S:CONFIG_DRAM_CLK=360 +S:CONFIG_DRAM_ZQ=123 +S:CONFIG_DRAM_EMR1=0 diff --git a/configs/Mele_M9_defconfig b/configs/Mele_M9_defconfig index e5ab0ec..eaf9a7e 100644 --- a/configs/Mele_M9_defconfig +++ b/configs/Mele_M9_defconfig @@ -4,7 +4,6 @@ CONFIG_FDTFILE="sun6i-a31-m9.dtb" +S:CONFIG_ARM=y +S:CONFIG_ARCH_SUNXI=y +S:CONFIG_MACH_SUN6I=y -+S:CONFIG_TARGET_MELE_M9=y +S:CONFIG_DRAM_CLK=312 +S:CONFIG_DRAM_ZQ=120 # The Mele M9 uses 3.3V for general IO diff --git a/configs/Mini-X_defconfig b/configs/Mini-X_defconfig index bb39464..6aea777 100644 --- a/configs/Mini-X_defconfig +++ b/configs/Mini-X_defconfig @@ -4,7 +4,6 @@ CONFIG_FDTFILE="sun4i-a10-mini-xplus.dtb" +S:CONFIG_ARM=y +S:CONFIG_ARCH_SUNXI=y +S:CONFIG_MACH_SUN4I=y -+S:CONFIG_TARGET_MINI_X=y +S:CONFIG_DRAM_CLK=360 +S:CONFIG_DRAM_ZQ=123 +S:CONFIG_DRAM_EMR1=0 diff --git a/configs/ba10_tv_box_defconfig b/configs/ba10_tv_box_defconfig index 0bfb5bd..400906d 100644 --- a/configs/ba10_tv_box_defconfig +++ b/configs/ba10_tv_box_defconfig @@ -5,7 +5,6 @@ CONFIG_USB2_VBUS_PIN="PH12" +S:CONFIG_ARM=y +S:CONFIG_ARCH_SUNXI=y +S:CONFIG_MACH_SUN4I=y -+S:CONFIG_TARGET_BA10_TV_BOX=y +S:CONFIG_DRAM_CLK=384 +S:CONFIG_DRAM_ZQ=123 +S:CONFIG_DRAM_EMR1=4

On Sun, 2015-01-18 at 13:23 +0100, Hans de Goede wrote:
CONFIG_TARGET_FOO is only used in board/sunxi/Makefile to select the dram config for sun5i and sun7i boards and in board/sunxi/gmac.c for some special handling of the bananapi/bananapro (both sun7i), iow it is not used at all on any sun4i, sun6i and sun8i boards so lets get rid of it there.
How close are we to being able to do the same for sun5i and/or sun7i?
The banana* stuff probably ought to become CONFIG_SUNXI_GMAX_DELAY (or whatever it was, you've told me like three times now but I can't seem to retain it...) sooner rather than later.
Ian.

On Sun, 2015-01-18 at 16:31 +0000, Ian Campbell wrote:
On Sun, 2015-01-18 at 13:23 +0100, Hans de Goede wrote:
CONFIG_TARGET_FOO is only used in board/sunxi/Makefile to select the dram config for sun5i and sun7i boards and in board/sunxi/gmac.c for some special handling of the bananapi/bananapro (both sun7i), iow it is not used at all on any sun4i, sun6i and sun8i boards so lets get rid of it there.
How close are we to being able to do the same for sun5i and/or sun7i?
The banana* stuff probably ought to become CONFIG_SUNXI_GMAX_DELAY (or whatever it was, you've told me like three times now but I can't seem to retain it...) sooner rather than later.
Oh, forgot the most important bit ;-)
Acked-by: Ian Campbell ijc@hellion.org.uk
Ian.

Hi,
On 18-01-15 17:31, Ian Campbell wrote:
On Sun, 2015-01-18 at 13:23 +0100, Hans de Goede wrote:
CONFIG_TARGET_FOO is only used in board/sunxi/Makefile to select the dram config for sun5i and sun7i boards and in board/sunxi/gmac.c for some special handling of the bananapi/bananapro (both sun7i), iow it is not used at all on any sun4i, sun6i and sun8i boards so lets get rid of it there.
How close are we to being able to do the same for sun5i and/or sun7i?
For sun5i it is a matter of me sitting down, doing the work, then testing on all the boards, then submit to the list for review.
For sun7i it is more or less the same, except that I do not own 1 or 2 supported sun7i boards, but I guess it is safe to say that if autoconfig works for all the boards I do own that it will work on the one I do not own also, never the less when I get around to this I'll also ask the MAINTAINERS to test.
The banana* stuff probably ought to become CONFIG_SUNXI_GMAX_DELAY (or whatever it was, you've told me like three times now but I can't seem to retain it...) sooner rather than later.
Ack, this is all a matter of spending the time to make the necessary changes.
I did the sun4i work now, because I wanted to clean up the sun4i stuff before adding more sun4i boards.
Regards,
Hans

The mk802 is the "classic" Allwinner A10 based hdmi tv-stick, it features 512M or 1G RAM, 4G nand, a mini-hdmi female connector, USB-A receptacle, mini-usb receptacle (OTG) and USB-wifi. Somewhat unique the mk802 does not use the AXP209 pmic, it does not have a pmic at all.
For more details see: http://linux-sunxi.org/Rikomagic_mk802
Signed-off-by: Hans de Goede hdegoede@redhat.com --- configs/mk802_defconfig | 10 ++++++++++ 1 file changed, 10 insertions(+) create mode 100644 configs/mk802_defconfig
diff --git a/configs/mk802_defconfig b/configs/mk802_defconfig new file mode 100644 index 0000000..d6b51a5 --- /dev/null +++ b/configs/mk802_defconfig @@ -0,0 +1,10 @@ +CONFIG_SPL=y +CONFIG_SYS_EXTRA_OPTIONS="USB_EHCI" +CONFIG_FDTFILE="sun4i-a10-mk802.dtb" +CONFIG_USB2_VBUS_PIN="PH12" ++S:CONFIG_ARM=y ++S:CONFIG_ARCH_SUNXI=y ++S:CONFIG_MACH_SUN4I=y ++S:CONFIG_DRAM_CLK=360 ++S:CONFIG_DRAM_ZQ=123 ++S:CONFIG_DRAM_EMR1=0

On Sun, 2015-01-18 at 13:23 +0100, Hans de Goede wrote:
The mk802 is the "classic" Allwinner A10 based hdmi tv-stick, it features 512M or 1G RAM, 4G nand, a mini-hdmi female connector, USB-A receptacle, mini-usb receptacle (OTG) and USB-wifi. Somewhat unique the mk802 does not use the AXP209 pmic, it does not have a pmic at all.
For more details see: http://linux-sunxi.org/Rikomagic_mk802
Signed-off-by: Hans de Goede hdegoede@redhat.com
For the three mk802* patches (#7..#9), iff you add MAINTAINERS entries, then: Acked-by: Ian Campbell ijc@hellion.org.uk
Ian.

Hi,
On 18-01-15 17:34, Ian Campbell wrote:
On Sun, 2015-01-18 at 13:23 +0100, Hans de Goede wrote:
The mk802 is the "classic" Allwinner A10 based hdmi tv-stick, it features 512M or 1G RAM, 4G nand, a mini-hdmi female connector, USB-A receptacle, mini-usb receptacle (OTG) and USB-wifi. Somewhat unique the mk802 does not use the AXP209 pmic, it does not have a pmic at all.
For more details see: http://linux-sunxi.org/Rikomagic_mk802
Signed-off-by: Hans de Goede hdegoede@redhat.com
For the three mk802* patches (#7..#9), iff you add MAINTAINERS entries, then: Acked-by: Ian Campbell ijc@hellion.org.uk
Gah, will I ever learn :)
Thanks for all the reviews, I've just pushed this set + the patches you acked from the A80 set (will do a v2 of the others later) + Siarhei's display patches + the marsboard defconfig to u-boot-sunxi/next, the plan is to rebase on top of origin/master as soon as Tom pulls from u-boot-usb, add in the OTG enable patch and then send another pull-req, as we've build up a nice set of patches again already.
Regards,
Hans

The mk802ii is a revised version of the mk802 A10 based hdmi tv-stick, it features 1G RAM, 4G nand, a hdmi male connector, USB-A receptacle, 2 micro usb receptacles (OTG & power) and USB-wifi, and does come with an axp209 pmic.
For more details see: http://linux-sunxi.org/Rikomagic_mk802ii
Signed-off-by: Hans de Goede hdegoede@redhat.com --- configs/mk802ii_defconfig | 9 +++++++++ 1 file changed, 9 insertions(+) create mode 100644 configs/mk802ii_defconfig
diff --git a/configs/mk802ii_defconfig b/configs/mk802ii_defconfig new file mode 100644 index 0000000..500f4df --- /dev/null +++ b/configs/mk802ii_defconfig @@ -0,0 +1,9 @@ +CONFIG_SPL=y +CONFIG_SYS_EXTRA_OPTIONS="AXP209_POWER,USB_EHCI" +CONFIG_FDTFILE="sun4i-a10-mk802ii.dtb" ++S:CONFIG_ARM=y ++S:CONFIG_ARCH_SUNXI=y ++S:CONFIG_MACH_SUN4I=y ++S:CONFIG_DRAM_CLK=360 ++S:CONFIG_DRAM_ZQ=123 ++S:CONFIG_DRAM_EMR1=0

The mk802_a10s re-uses is the "classic" mk802 case and functionality, but has an A10s SoC inside rather then the A10, it features 512M or 1G RAM, 4G nand, a mini-hdmi female connector, USB-A receptacle, mini-usb receptacle (OTG) and a sdio realtek wifi chip. Unlike the original mk802 it does have a pmic, the axp152.
For more details see: http://linux-sunxi.org/Semitime_g2
Signed-off-by: Hans de Goede hdegoede@redhat.com --- board/sunxi/Kconfig | 4 ++++ board/sunxi/Makefile | 1 + board/sunxi/dram_sun5i_auto.c | 31 +++++++++++++++++++++++++++++++ configs/mk802_a10s_defconfig | 11 +++++++++++ 4 files changed, 47 insertions(+) create mode 100644 board/sunxi/dram_sun5i_auto.c create mode 100644 configs/mk802_a10s_defconfig
diff --git a/board/sunxi/Kconfig b/board/sunxi/Kconfig index b9c25cc..c5ce099 100644 --- a/board/sunxi/Kconfig +++ b/board/sunxi/Kconfig @@ -127,6 +127,10 @@ config TARGET_MELE_M3 bool "MELE_M3" depends on MACH_SUN7I
+config TARGET_MK802_A10S + bool "MK802_A10S" + depends on MACH_SUN5I + config TARGET_MSI_PRIMO73 bool "MSI Primo73 (7" tablet)" depends on MACH_SUN7I diff --git a/board/sunxi/Makefile b/board/sunxi/Makefile index f838e7b..feb439a 100644 --- a/board/sunxi/Makefile +++ b/board/sunxi/Makefile @@ -26,6 +26,7 @@ obj-$(CONFIG_TARGET_CUBIEBOARD2) += dram_cubieboard2.o obj-$(CONFIG_TARGET_CUBIETRUCK) += dram_cubietruck.o obj-$(CONFIG_TARGET_I12_TVBOX) += dram_sun7i_384_1024_iow16.o obj-$(CONFIG_TARGET_MELE_M3) += dram_sun7i_384_1024_iow16.o +obj-$(CONFIG_TARGET_MK802_A10S) += dram_sun5i_auto.o obj-$(CONFIG_TARGET_MSI_PRIMO73) += dram_sun7i_384_1024_iow16.o obj-$(CONFIG_TARGET_PCDUINO3) += dram_linksprite_pcduino3.o obj-$(CONFIG_TARGET_QT840A) += dram_sun7i_384_512_busw16_iow16.o diff --git a/board/sunxi/dram_sun5i_auto.c b/board/sunxi/dram_sun5i_auto.c new file mode 100644 index 0000000..a5965db --- /dev/null +++ b/board/sunxi/dram_sun5i_auto.c @@ -0,0 +1,31 @@ +/* this file is generated, don't edit it yourself */ + +#include <common.h> +#include <asm/arch/dram.h> + +static struct dram_para dram_para = { + .clock = CONFIG_DRAM_CLK, + .type = 3, + .rank_num = 1, + .density = 0, + .io_width = 0, + .bus_width = 0, + .cas = 9, + .zq = CONFIG_DRAM_ZQ, + .odt_en = 0, + .size = 0, + .tpr0 = 0x42d899b7, + .tpr1 = 0xa090, + .tpr2 = 0x22a00, + .tpr3 = 0, + .tpr4 = 0, + .tpr5 = 0, + .emr1 = CONFIG_DRAM_EMR1, + .emr2 = 0x10, + .emr3 = 0, +}; + +unsigned long sunxi_dram_init(void) +{ + return dramc_init(&dram_para); +} diff --git a/configs/mk802_a10s_defconfig b/configs/mk802_a10s_defconfig new file mode 100644 index 0000000..086e1e4 --- /dev/null +++ b/configs/mk802_a10s_defconfig @@ -0,0 +1,11 @@ +CONFIG_SPL=y +CONFIG_SYS_EXTRA_OPTIONS="AXP152_POWER,USB_EHCI" +CONFIG_FDTFILE="sun5i-a10s-mk802.dtb" +CONFIG_USB1_VBUS_PIN="PB10" ++S:CONFIG_ARM=y ++S:CONFIG_ARCH_SUNXI=y ++S:CONFIG_MACH_SUN5I=y ++S:CONFIG_TARGET_MK802_A10S=y ++S:CONFIG_DRAM_CLK=432 ++S:CONFIG_DRAM_ZQ=123 ++S:CONFIG_DRAM_EMR1=0

On Sun, 2015-01-18 at 13:23 +0100, Hans de Goede wrote:
We do not use the axp209 interrupt, and at least in my mini-x (which does not have a power button) the pwr-button pin and the irq pin are soldered together, so if the axp209 keeps it irq asserted to long it will see a 10s pwr-button press and hard power off the board, disabling the irqs fixes this.
Signed-off-by: Hans de Goede hdegoede@redhat.com
Acked-by: Ian Campbell ijc@hellion.org.uk
participants (3)
-
Hans de Goede
-
Ian Campbell
-
Siarhei Siamashka