From d71910fc509933fab881f85ae244ea95525a41d6 Mon Sep 17 00:00:00 2001 From: Iain Paton Date: Sun, 28 Sep 2014 14:18:42 +0100 Subject: sun7i: Add support for Olimex A20-OLinuXino-LIME2 This adds support for the Olimex A20-OLinuXino-Lime2 https://www.olimex.com/Products/OLinuXino/A20/A20-OLinuXIno-LIME2 Differences to previous Lime boards are 1GB RAM and gigabit ethernet Signed-off-by: Iain Paton Signed-off-by: Hans de Goede --- board/sunxi/MAINTAINERS | 6 ++++++ board/sunxi/Makefile | 1 + board/sunxi/dram_a20_olinuxino_l2.c | 31 +++++++++++++++++++++++++++++++ 3 files changed, 38 insertions(+) create mode 100644 board/sunxi/dram_a20_olinuxino_l2.c (limited to 'board') diff --git a/board/sunxi/MAINTAINERS b/board/sunxi/MAINTAINERS index 4f32195dcd9..4ed82cf6e30 100644 --- a/board/sunxi/MAINTAINERS +++ b/board/sunxi/MAINTAINERS @@ -38,3 +38,9 @@ M: FUKAUMI Naoki S: Maintained F: board/sunxi/dram_a20_olinuxino_l.c F: configs/A20-OLinuXino-Lime_defconfig + +A20-OLINUXINO-LIME2 BOARD +M: Iain Paton +S: Maintained +F: board/sunxi/dram_a20_olinuxino_l2.c +F: configs/A20-OLinuXino-Lime2_defconfig diff --git a/board/sunxi/Makefile b/board/sunxi/Makefile index 56073a024d1..d63a6d2c791 100644 --- a/board/sunxi/Makefile +++ b/board/sunxi/Makefile @@ -16,6 +16,7 @@ obj-$(CONFIG_A10S_OLINUXINO_M) += dram_a10s_olinuxino_m.o obj-$(CONFIG_A13_OLINUXINO) += dram_a13_olinuxino.o obj-$(CONFIG_A13_OLINUXINOM) += dram_a13_oli_micro.o obj-$(CONFIG_A20_OLINUXINO_L) += dram_a20_olinuxino_l.o +obj-$(CONFIG_A20_OLINUXINO_L2) += dram_a20_olinuxino_l2.o obj-$(CONFIG_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_AUXTEK_T004) += dram_a10s_olinuxino_m.o diff --git a/board/sunxi/dram_a20_olinuxino_l2.c b/board/sunxi/dram_a20_olinuxino_l2.c new file mode 100644 index 00000000000..2115d37470a --- /dev/null +++ b/board/sunxi/dram_a20_olinuxino_l2.c @@ -0,0 +1,31 @@ +/* this file is generated, don't edit it yourself */ + +#include +#include + +static struct dram_para dram_para = { + .clock = 480, + .type = 3, + .rank_num = 1, + .density = 4096, + .io_width = 16, + .bus_width = 32, + .cas = 9, + .zq = 0x7f, + .odt_en = 0, + .size = 1024, + .tpr0 = 0x42d899b7, + .tpr1 = 0xa090, + .tpr2 = 0x22a00, + .tpr3 = 0, + .tpr4 = 0, + .tpr5 = 0, + .emr1 = 0x4, + .emr2 = 0x10, + .emr3 = 0, +}; + +unsigned long sunxi_dram_init(void) +{ + return dramc_init(&dram_para); +} -- cgit v1.2.3 From f1fe97527a5301549133a5b0e25ac1fe0243e7a9 Mon Sep 17 00:00:00 2001 From: Hans de Goede Date: Tue, 30 Sep 2014 16:12:39 +0200 Subject: sunxi: Add support for the Mele M3 board The Mele M3 is yet another Allwinnner based Android top set box from Mele. It uses a housing similar to the A2000, but without the USM sata storage slot at the top. It features an A20 SoC, 1G RAM, 4G eMMC (unique for Allwinner devices), 100Mbit ethernet, HDMI out, 3 USB A receptacles, VGA, and A/V OUT connections. Signed-off-by: Hans de Goede Acked-by: Ian Campbell --- board/sunxi/MAINTAINERS | 1 + board/sunxi/Makefile | 1 + configs/Mele_M3_defconfig | 5 +++++ 3 files changed, 7 insertions(+) create mode 100644 configs/Mele_M3_defconfig (limited to 'board') diff --git a/board/sunxi/MAINTAINERS b/board/sunxi/MAINTAINERS index 4ed82cf6e30..6c4226ed327 100644 --- a/board/sunxi/MAINTAINERS +++ b/board/sunxi/MAINTAINERS @@ -8,6 +8,7 @@ F: configs/ba10_tv_box_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 diff --git a/board/sunxi/Makefile b/board/sunxi/Makefile index d63a6d2c791..6a2e4c9d5b5 100644 --- a/board/sunxi/Makefile +++ b/board/sunxi/Makefile @@ -28,6 +28,7 @@ obj-$(CONFIG_CUBIETRUCK) += dram_cubietruck.o obj-$(CONFIG_I12_TVBOX) += dram_sun7i_384_1024_iow16.o obj-$(CONFIG_MELE_A1000) += dram_sun4i_360_512.o obj-$(CONFIG_MELE_A1000G) += dram_sun4i_360_1024_iow8.o +obj-$(CONFIG_MELE_M3) += dram_sun7i_384_1024_iow16.o obj-$(CONFIG_MINI_X) += dram_sun4i_360_512.o obj-$(CONFIG_MINI_X_1GB) += dram_sun4i_360_1024_iow16.o obj-$(CONFIG_PCDUINO3) += dram_linksprite_pcduino3.o diff --git a/configs/Mele_M3_defconfig b/configs/Mele_M3_defconfig new file mode 100644 index 00000000000..645b236da6b --- /dev/null +++ b/configs/Mele_M3_defconfig @@ -0,0 +1,5 @@ +CONFIG_SPL=y +CONFIG_SYS_EXTRA_OPTIONS="MELE_M3,AXP209_POWER,SUNXI_GMAC,USB_EHCI" +CONFIG_FDTFILE="sun7i-a20-m3.dtb" ++S:CONFIG_ARM=y ++S:CONFIG_TARGET_SUN7I=y -- cgit v1.2.3 From 8a6564dacb7e24e82077d109d7d5992d2a14dac3 Mon Sep 17 00:00:00 2001 From: Maxime Ripard Date: Fri, 3 Oct 2014 20:16:29 +0800 Subject: ARM: sunxi: Add basic A31 support Add a new sun6i machine that supports UART and MMC. Signed-off-by: Maxime Ripard Signed-off-by: Hans de Goede [wens@csie.org: use SPDX labels, adapt to Kconfig system, drop ifdef around mmc and smp code, drop MACH_TYPE] Signed-off-by: Chen-Yu Tsai Acked-by: Ian Campbell --- arch/arm/Kconfig | 3 +++ arch/arm/cpu/armv7/sunxi/cpu_info.c | 2 ++ board/sunxi/Kconfig | 10 +++++++++- include/configs/sun6i.h | 26 ++++++++++++++++++++++++++ 4 files changed, 40 insertions(+), 1 deletion(-) create mode 100644 include/configs/sun6i.h (limited to 'board') diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig index 109d49f57db..4317b69e361 100644 --- a/arch/arm/Kconfig +++ b/arch/arm/Kconfig @@ -450,6 +450,9 @@ config TARGET_SUN4I config TARGET_SUN5I bool "Support sun5i" +config TARGET_SUN6I + bool "Support sun6i" + config TARGET_SUN7I bool "Support sun7i" diff --git a/arch/arm/cpu/armv7/sunxi/cpu_info.c b/arch/arm/cpu/armv7/sunxi/cpu_info.c index 5cf35acc1e6..40c4e1347c2 100644 --- a/arch/arm/cpu/armv7/sunxi/cpu_info.c +++ b/arch/arm/cpu/armv7/sunxi/cpu_info.c @@ -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_SUN7I puts("CPU: Allwinner A20 (SUN7I)\n"); #else diff --git a/board/sunxi/Kconfig b/board/sunxi/Kconfig index bcd0a55a1e5..05defacfcaf 100644 --- a/board/sunxi/Kconfig +++ b/board/sunxi/Kconfig @@ -12,6 +12,14 @@ config SYS_CONFIG_NAME endif +if TARGET_SUN6I + +config SYS_CONFIG_NAME + string + default "sun6i" + +endif + if TARGET_SUN7I config SYS_CONFIG_NAME @@ -19,7 +27,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 default "armv7" diff --git a/include/configs/sun6i.h b/include/configs/sun6i.h new file mode 100644 index 00000000000..93a1d965ca4 --- /dev/null +++ b/include/configs/sun6i.h @@ -0,0 +1,26 @@ +/* + * (C) Copyright 2012-2013 Henrik Nordstrom + * (C) Copyright 2013 Luke Kenneth Casson Leighton + * (C) Copyright 2013 Maxime Ripard + * + * 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 + +#endif /* __CONFIG_H */ -- cgit v1.2.3 From 7ad3b6aa37ccf3caa5b8d6f7d639f2904009ed1e Mon Sep 17 00:00:00 2001 From: Chen-Yu Tsai Date: Fri, 3 Oct 2014 20:16:30 +0800 Subject: ARM: sun6i: Add Colombus board defconfig The Colombus board is an A31 evaluation board from WITS Technology. Maxime has kindly agreed to maintain this board. [1] http://lists.denx.de/pipermail/u-boot/2014-September/190043.html Signed-off-by: Chen-Yu Tsai Cc: Maxime Ripard Acked-by: Maxime Ripard Acked-by: Ian Campbell --- board/sunxi/MAINTAINERS | 5 +++++ configs/Colombus_defconfig | 4 ++++ 2 files changed, 9 insertions(+) create mode 100644 configs/Colombus_defconfig (limited to 'board') diff --git a/board/sunxi/MAINTAINERS b/board/sunxi/MAINTAINERS index 6c4226ed327..7afe45ebee9 100644 --- a/board/sunxi/MAINTAINERS +++ b/board/sunxi/MAINTAINERS @@ -45,3 +45,8 @@ M: Iain Paton S: Maintained F: board/sunxi/dram_a20_olinuxino_l2.c F: configs/A20-OLinuXino-Lime2_defconfig + +COLOMBUS BOARD +M: Maxime Ripard +S: Maintained +F: configs/Colombus_defconfig diff --git a/configs/Colombus_defconfig b/configs/Colombus_defconfig new file mode 100644 index 00000000000..16800de2bcd --- /dev/null +++ b/configs/Colombus_defconfig @@ -0,0 +1,4 @@ +CONFIG_SYS_EXTRA_OPTIONS="COLOMBUS" +CONFIG_ARM=y +CONFIG_TARGET_SUN6I=y +CONFIG_FDTFILE="sun6i-a31-colombus.dtb" -- cgit v1.2.3 From cd82113a98e152b34e727718b729d0c5be44da99 Mon Sep 17 00:00:00 2001 From: Hans de Goede Date: Thu, 2 Oct 2014 20:29:26 +0200 Subject: sunxi: Add mmc card-detect functionality Signed-off-by: Hans de Goede Acked-by: Ian Campbell --- board/sunxi/Kconfig | 26 ++++++++++++++++++++++++++ drivers/mmc/sunxi_mmc.c | 21 +++++++++++++++++++++ include/configs/sunxi-common.h | 1 + 3 files changed, 48 insertions(+) (limited to 'board') diff --git a/board/sunxi/Kconfig b/board/sunxi/Kconfig index 05defacfcaf..63188dd3211 100644 --- a/board/sunxi/Kconfig +++ b/board/sunxi/Kconfig @@ -41,4 +41,30 @@ config SYS_SOC config FDTFILE string "Default fdtfile env setting for this board" +config MMC0_CD_PIN + string "Card detect pin for mmc0" + default "" + ---help--- + Set the card detect pin for mmc0, leave empty to not use cd. This + takes a string in the format understood by sunxi_name_to_gpio, e.g. + PH1 for pin 1 of port H. + +config MMC1_CD_PIN + string "Card detect pin for mmc1" + default "" + ---help--- + See MMC0_CD_PIN help text. + +config MMC2_CD_PIN + string "Card detect pin for mmc2" + default "" + ---help--- + See MMC0_CD_PIN help text. + +config MMC3_CD_PIN + string "Card detect pin for mmc3" + default "" + ---help--- + See MMC0_CD_PIN help text. + endif diff --git a/drivers/mmc/sunxi_mmc.c b/drivers/mmc/sunxi_mmc.c index 8f4b50ba985..b47376a7938 100644 --- a/drivers/mmc/sunxi_mmc.c +++ b/drivers/mmc/sunxi_mmc.c @@ -14,7 +14,9 @@ #include #include #include +#include #include +#include struct sunxi_mmc_host { unsigned mmc_no; @@ -346,10 +348,29 @@ out: return error; } +static int sunxi_mmc_getcd(struct mmc *mmc) +{ + struct sunxi_mmc_host *mmchost = mmc->priv; + int cd_pin = -1; + + switch (mmchost->mmc_no) { + case 0: cd_pin = sunxi_name_to_gpio(CONFIG_MMC0_CD_PIN); break; + case 1: cd_pin = sunxi_name_to_gpio(CONFIG_MMC1_CD_PIN); break; + case 2: cd_pin = sunxi_name_to_gpio(CONFIG_MMC2_CD_PIN); break; + case 3: cd_pin = sunxi_name_to_gpio(CONFIG_MMC3_CD_PIN); break; + } + + if (cd_pin == -1) + return 1; + + return !gpio_direction_input(cd_pin); +} + static const struct mmc_ops sunxi_mmc_ops = { .send_cmd = mmc_send_cmd, .set_ios = mmc_set_ios, .init = mmc_core_init, + .getcd = sunxi_mmc_getcd, }; int sunxi_mmc_init(int sdc_no) diff --git a/include/configs/sunxi-common.h b/include/configs/sunxi-common.h index 318f526d340..5f54c01653a 100644 --- a/include/configs/sunxi-common.h +++ b/include/configs/sunxi-common.h @@ -181,6 +181,7 @@ /* GPIO */ #define CONFIG_SUNXI_GPIO +#define CONFIG_SPL_GPIO_SUPPORT #define CONFIG_CMD_GPIO /* Ethernet support */ -- cgit v1.2.3 From 2ccfac01fca3c58ee87db7bbe54c8243e3980d02 Mon Sep 17 00:00:00 2001 From: Hans de Goede Date: Thu, 2 Oct 2014 20:43:50 +0200 Subject: sunxi: Turn MMC_SUNXI_SLOT_EXTRA into a proper Kconfig option Note we also drop the SPL check for initializing the 2nd mmc slot, the SPL check is not necessary with Kconfig, because only options explicitly marked as also being for the SPL get set during SPL builds. Signed-off-by: Hans de Goede Acked-by: Ian Campbell --- board/sunxi/Kconfig | 8 ++++++++ board/sunxi/board.c | 2 +- 2 files changed, 9 insertions(+), 1 deletion(-) (limited to 'board') diff --git a/board/sunxi/Kconfig b/board/sunxi/Kconfig index 63188dd3211..552fce8394a 100644 --- a/board/sunxi/Kconfig +++ b/board/sunxi/Kconfig @@ -67,4 +67,12 @@ config MMC3_CD_PIN ---help--- See MMC0_CD_PIN help text. +config MMC_SUNXI_SLOT_EXTRA + int "mmc extra slot number" + default -1 + ---help--- + sunxi builds always enable mmc0, some boards also have a second sdcard + slot or emmc on mmc1 - mmc3. Setting this to 1, 2 or 3 will enable + support for this. + endif diff --git a/board/sunxi/board.c b/board/sunxi/board.c index 2179e234e21..cfe22b61388 100644 --- a/board/sunxi/board.c +++ b/board/sunxi/board.c @@ -106,7 +106,7 @@ int board_mmc_init(bd_t *bis) { mmc_pinmux_setup(CONFIG_MMC_SUNXI_SLOT); sunxi_mmc_init(CONFIG_MMC_SUNXI_SLOT); -#if !defined (CONFIG_SPL_BUILD) && defined (CONFIG_MMC_SUNXI_SLOT_EXTRA) +#if CONFIG_MMC_SUNXI_SLOT_EXTRA != -1 mmc_pinmux_setup(CONFIG_MMC_SUNXI_SLOT_EXTRA); sunxi_mmc_init(CONFIG_MMC_SUNXI_SLOT_EXTRA); #endif -- cgit v1.2.3 From e79c7c881047ca99191cc79b6d83ec64b898cd9b Mon Sep 17 00:00:00 2001 From: Hans de Goede Date: Thu, 2 Oct 2014 21:13:54 +0200 Subject: sunxi: When we've both mmc0 and mmc2, detect from which one we're booting sunxi SOCs can boot from both mmc0 and mmc2, detect from which one we're booting, and make that one "mmc dev 0" so that a single u-boot binary can be used for both the onboard eMMC and for external sdcards. When we're booting from mmc2, we make it dev 0 because that is where the SPL will load the tertiary payload (the actual u-boot binary in our case) from, see: common/spl/spl_mmc.c, which has dev 0 hardcoded everywhere. Signed-off-by: Hans de Goede Acked-by: Ian Campbell --- arch/arm/include/asm/arch-sunxi/mmc.h | 2 +- board/sunxi/board.c | 30 ++++++++++++++++++++++++++++-- drivers/mmc/sunxi_mmc.c | 7 ++----- 3 files changed, 31 insertions(+), 8 deletions(-) (limited to 'board') diff --git a/arch/arm/include/asm/arch-sunxi/mmc.h b/arch/arm/include/asm/arch-sunxi/mmc.h index 6a3118402f4..70d787567c1 100644 --- a/arch/arm/include/asm/arch-sunxi/mmc.h +++ b/arch/arm/include/asm/arch-sunxi/mmc.h @@ -123,5 +123,5 @@ struct sunxi_mmc { #define SUNXI_MMC_IDIE_TXIRQ (0x1 << 0) #define SUNXI_MMC_IDIE_RXIRQ (0x1 << 1) -int sunxi_mmc_init(int sdc_no); +struct mmc *sunxi_mmc_init(int sdc_no); #endif /* _SUNXI_MMC_H */ diff --git a/board/sunxi/board.c b/board/sunxi/board.c index cfe22b61388..f310e8dbff2 100644 --- a/board/sunxi/board.c +++ b/board/sunxi/board.c @@ -12,6 +12,7 @@ */ #include +#include #ifdef CONFIG_AXP152_POWER #include #endif @@ -104,11 +105,36 @@ static void mmc_pinmux_setup(int sdc) int board_mmc_init(bd_t *bis) { + __maybe_unused struct mmc *mmc0, *mmc1; + __maybe_unused char buf[512]; + mmc_pinmux_setup(CONFIG_MMC_SUNXI_SLOT); - sunxi_mmc_init(CONFIG_MMC_SUNXI_SLOT); + mmc0 = sunxi_mmc_init(CONFIG_MMC_SUNXI_SLOT); + if (!mmc0) + return -1; + #if CONFIG_MMC_SUNXI_SLOT_EXTRA != -1 mmc_pinmux_setup(CONFIG_MMC_SUNXI_SLOT_EXTRA); - sunxi_mmc_init(CONFIG_MMC_SUNXI_SLOT_EXTRA); + mmc1 = sunxi_mmc_init(CONFIG_MMC_SUNXI_SLOT_EXTRA); + if (!mmc1) + return -1; +#endif + +#if CONFIG_MMC_SUNXI_SLOT == 0 && CONFIG_MMC_SUNXI_SLOT_EXTRA == 2 + /* + * Both mmc0 and mmc2 are bootable, figure out where we're booting + * from. Try mmc0 first, just like the brom does. + */ + if (mmc_getcd(mmc0) && mmc_init(mmc0) == 0 && + mmc0->block_dev.block_read(0, 16, 1, buf) == 1) { + buf[12] = 0; + if (strcmp(&buf[4], "eGON.BT0") == 0) + return 0; + } + + /* no bootable card in mmc0, so we must be booting from mmc2, swap */ + mmc0->block_dev.dev = 1; + mmc1->block_dev.dev = 0; #endif return 0; diff --git a/drivers/mmc/sunxi_mmc.c b/drivers/mmc/sunxi_mmc.c index b47376a7938..d3b1039cfe9 100644 --- a/drivers/mmc/sunxi_mmc.c +++ b/drivers/mmc/sunxi_mmc.c @@ -373,7 +373,7 @@ static const struct mmc_ops sunxi_mmc_ops = { .getcd = sunxi_mmc_getcd, }; -int sunxi_mmc_init(int sdc_no) +struct mmc *sunxi_mmc_init(int sdc_no) { struct mmc_config *cfg = &mmc_host[sdc_no].cfg; @@ -396,8 +396,5 @@ int sunxi_mmc_init(int sdc_no) mmc_resource_init(sdc_no); mmc_clk_io_on(sdc_no); - if (mmc_create(cfg, &mmc_host[sdc_no]) == NULL) - return -1; - - return 0; + return mmc_create(cfg, &mmc_host[sdc_no]); } -- cgit v1.2.3 From bbff84b3b0092d00db1b0b77ef9043b46991d791 Mon Sep 17 00:00:00 2001 From: Hans de Goede Date: Fri, 3 Oct 2014 16:44:57 +0200 Subject: sunxi: Use PG3 - PG8 as io-pins for mmc1 None of the known sunxi devices actually use mmc1 routed through PH, where as some devices do actually use mmc1 routed through PG, so change the routing of mmc1 to PG. If in the future we encounter devices with mmc1 routed through PH, we will need to change things to be a bit more flexible. Signed-off-by: Hans de Goede Acked-by: Ian Campbell --- arch/arm/include/asm/arch-sunxi/gpio.h | 2 ++ board/sunxi/board.c | 6 +++--- 2 files changed, 5 insertions(+), 3 deletions(-) (limited to 'board') diff --git a/arch/arm/include/asm/arch-sunxi/gpio.h b/arch/arm/include/asm/arch-sunxi/gpio.h index ba7e69b7b7e..59122db4ce6 100644 --- a/arch/arm/include/asm/arch-sunxi/gpio.h +++ b/arch/arm/include/asm/arch-sunxi/gpio.h @@ -117,6 +117,8 @@ enum sunxi_gpio_number { #define SUN5I_GPB19_UART0_TX 2 #define SUN5I_GPB20_UART0_RX 2 +#define SUN5I_GPG3_SDC1 2 + #define SUN5I_GPG3_UART1_TX 4 #define SUN5I_GPG4_UART1_RX 4 diff --git a/board/sunxi/board.c b/board/sunxi/board.c index f310e8dbff2..03890c8c9ce 100644 --- a/board/sunxi/board.c +++ b/board/sunxi/board.c @@ -71,9 +71,9 @@ static void mmc_pinmux_setup(int sdc) break; case 1: - /* CMD-PH22, CLK-PH23, D0~D3-PH24~27 : 5 */ - for (pin = SUNXI_GPH(22); pin <= SUNXI_GPH(27); pin++) { - sunxi_gpio_set_cfgpin(pin, SUN4I_GPH22_SDC1); + /* CMD-PG3, CLK-PG4, D0~D3-PG5-8 */ + for (pin = SUNXI_GPG(3); pin <= SUNXI_GPG(8); pin++) { + sunxi_gpio_set_cfgpin(pin, SUN5I_GPG3_SDC1); sunxi_gpio_set_pull(pin, SUNXI_GPIO_PULL_UP); sunxi_gpio_set_drv(pin, 2); } -- cgit v1.2.3 From 722e00cef4e497f171dcbc5ef84d81d215670a24 Mon Sep 17 00:00:00 2001 From: Hans de Goede Date: Wed, 13 Aug 2014 14:02:29 +0200 Subject: sunxi: Kconfig: Unify sunxi Kconfig code Unify the sunxi Kconfig code, instead of having separate code blocks for each of sun4i - sun7i. Signed-off-by: Hans de Goede Acked-by: Ian Campbell --- board/sunxi/Kconfig | 32 +++++--------------------------- 1 file changed, 5 insertions(+), 27 deletions(-) (limited to 'board') diff --git a/board/sunxi/Kconfig b/board/sunxi/Kconfig index 552fce8394a..9892a34cfbb 100644 --- a/board/sunxi/Kconfig +++ b/board/sunxi/Kconfig @@ -1,33 +1,11 @@ -if TARGET_SUN4I - -config SYS_CONFIG_NAME - default "sun4i" - -endif - -if TARGET_SUN5I - -config SYS_CONFIG_NAME - default "sun5i" - -endif - -if TARGET_SUN6I +if TARGET_SUN4I || TARGET_SUN5I || TARGET_SUN6I || TARGET_SUN7I config SYS_CONFIG_NAME string - default "sun6i" - -endif - -if TARGET_SUN7I - -config SYS_CONFIG_NAME - default "sun7i" - -endif - -if TARGET_SUN4I || TARGET_SUN5I || TARGET_SUN6I || TARGET_SUN7I + default "sun4i" if TARGET_SUN4I + default "sun5i" if TARGET_SUN5I + default "sun6i" if TARGET_SUN6I + default "sun7i" if TARGET_SUN7I config SYS_CPU default "armv7" -- cgit v1.2.3 From 8ebe4f429266a7cb9011f5b3ab51226297f41210 Mon Sep 17 00:00:00 2001 From: Chen-Yu Tsai Date: Wed, 22 Oct 2014 16:47:44 +0800 Subject: ARM: sunxi: Add basic A23 support The basic blocks of the A23 are similar to the A31 (sun6i). Re-use sun6i code for initial clock, gpio, and uart setup. There is no SPL support for A23, as we do not have any documentation or sample code for DRAM initialization. Signed-off-by: Chen-Yu Tsai Acked-by: Ian Campbell --- arch/arm/Kconfig | 3 +++ arch/arm/cpu/armv7/sunxi/Makefile | 2 ++ arch/arm/cpu/armv7/sunxi/board.c | 3 ++- arch/arm/cpu/armv7/sunxi/cpu_info.c | 2 ++ arch/arm/include/asm/arch-sunxi/clock.h | 2 +- board/sunxi/Kconfig | 3 ++- include/configs/sun8i.h | 23 +++++++++++++++++++++++ 7 files changed, 35 insertions(+), 3 deletions(-) create mode 100644 include/configs/sun8i.h (limited to 'board') diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig index 4317b69e361..8f910f39a37 100644 --- a/arch/arm/Kconfig +++ b/arch/arm/Kconfig @@ -456,6 +456,9 @@ config TARGET_SUN6I config TARGET_SUN7I bool "Support sun7i" +config TARGET_SUN8I + bool "Support sun8i" + config TARGET_SNOWBALL bool "Support snowball" diff --git a/arch/arm/cpu/armv7/sunxi/Makefile b/arch/arm/cpu/armv7/sunxi/Makefile index 2a42dcaaa20..24f1daee647 100644 --- a/arch/arm/cpu/armv7/sunxi/Makefile +++ b/arch/arm/cpu/armv7/sunxi/Makefile @@ -12,10 +12,12 @@ obj-y += board.o obj-y += clock.o obj-y += pinmux.o obj-$(CONFIG_SUN6I) += prcm.o +obj-$(CONFIG_SUN8I) += prcm.o obj-$(CONFIG_SUN4I) += clock_sun4i.o obj-$(CONFIG_SUN5I) += clock_sun4i.o obj-$(CONFIG_SUN6I) += clock_sun6i.o obj-$(CONFIG_SUN7I) += clock_sun4i.o +obj-$(CONFIG_SUN8I) += clock_sun6i.o ifndef CONFIG_SPL_BUILD obj-y += cpu_info.o diff --git a/arch/arm/cpu/armv7/sunxi/board.c b/arch/arm/cpu/armv7/sunxi/board.c index 7d10f10fd8d..134a19874e4 100644 --- a/arch/arm/cpu/armv7/sunxi/board.c +++ b/arch/arm/cpu/armv7/sunxi/board.c @@ -110,7 +110,8 @@ void reset_cpu(ulong addr) /* do some early init */ void s_init(void) { -#if !defined CONFIG_SPL_BUILD && (defined CONFIG_SUN7I || defined CONFIG_SUN6I) +#if !defined CONFIG_SPL_BUILD && (defined CONFIG_SUN7I || \ + defined CONFIG_SUN6I || defined CONFIG_SUN8I) /* Enable SMP mode for CPU0, by setting bit 6 of Auxiliary Ctl reg */ asm volatile( "mrc p15, 0, r0, c1, c0, 1\n" diff --git a/arch/arm/cpu/armv7/sunxi/cpu_info.c b/arch/arm/cpu/armv7/sunxi/cpu_info.c index 40c4e1347c2..4f2a09cd2e2 100644 --- a/arch/arm/cpu/armv7/sunxi/cpu_info.c +++ b/arch/arm/cpu/armv7/sunxi/cpu_info.c @@ -27,6 +27,8 @@ int print_cpuinfo(void) puts("CPU: Allwinner A31 (SUN6I)\n"); #elif defined CONFIG_SUN7I puts("CPU: Allwinner A20 (SUN7I)\n"); +#elif defined CONFIG_SUN8I + puts("CPU: Allwinner A23 (SUN8I)\n"); #else #warning Please update cpu_info.c with correct CPU information puts("CPU: SUNXI Family\n"); diff --git a/arch/arm/include/asm/arch-sunxi/clock.h b/arch/arm/include/asm/arch-sunxi/clock.h index 8f5d86025b3..012c2af72e3 100644 --- a/arch/arm/include/asm/arch-sunxi/clock.h +++ b/arch/arm/include/asm/arch-sunxi/clock.h @@ -15,7 +15,7 @@ #define CLK_GATE_CLOSE 0x0 /* clock control module regs definition */ -#ifdef CONFIG_SUN6I +#if defined(CONFIG_SUN6I) || defined(CONFIG_SUN8I) #include #else #include diff --git a/board/sunxi/Kconfig b/board/sunxi/Kconfig index 9892a34cfbb..449c0460f99 100644 --- a/board/sunxi/Kconfig +++ b/board/sunxi/Kconfig @@ -1,4 +1,4 @@ -if TARGET_SUN4I || TARGET_SUN5I || TARGET_SUN6I || TARGET_SUN7I +if TARGET_SUN4I || TARGET_SUN5I || TARGET_SUN6I || TARGET_SUN7I || TARGET_SUN8I config SYS_CONFIG_NAME string @@ -6,6 +6,7 @@ config SYS_CONFIG_NAME default "sun5i" if TARGET_SUN5I default "sun6i" if TARGET_SUN6I default "sun7i" if TARGET_SUN7I + default "sun8i" if TARGET_SUN8I config SYS_CPU default "armv7" diff --git a/include/configs/sun8i.h b/include/configs/sun8i.h new file mode 100644 index 00000000000..1c1a7cde5ec --- /dev/null +++ b/include/configs/sun8i.h @@ -0,0 +1,23 @@ +/* + * (C) Copyright 2014 Chen-Yu Tsai + * + * Configuration settings for the Allwinner A23 (sun8i) CPU + * + * SPDX-License-Identifier: GPL-2.0+ + */ + +#ifndef __CONFIG_H +#define __CONFIG_H + +/* + * A23 specific configuration + */ +#define CONFIG_SUN8I /* sun8i SoC generation */ +#define CONFIG_SYS_PROMPT "sun8i# " + +/* + * Include common sunxi configuration where most the settings are + */ +#include + +#endif /* __CONFIG_H */ -- cgit v1.2.3 From 7b48d8c8bc40ba3215a5ceb2731d762d4b143e3b Mon Sep 17 00:00:00 2001 From: Chen-Yu Tsai Date: Wed, 22 Oct 2014 16:47:48 +0800 Subject: ARM: sunxi: Add Ippo-q8h-v5 A23 tablet board defconfig Ippo q8h is a series of A23 tablet boards. This defconfig is for v5 of these boards, though for u-boot purposes they are mostly the same. See: http://linux-sunxi.org/Ippo_q8h Signed-off-by: Chen-Yu Tsai Acked-by: Ian Campbell --- board/sunxi/MAINTAINERS | 5 +++++ configs/Ippo_q8h_defconfig | 4 ++++ 2 files changed, 9 insertions(+) create mode 100644 configs/Ippo_q8h_defconfig (limited to 'board') diff --git a/board/sunxi/MAINTAINERS b/board/sunxi/MAINTAINERS index 7afe45ebee9..febd126cb83 100644 --- a/board/sunxi/MAINTAINERS +++ b/board/sunxi/MAINTAINERS @@ -50,3 +50,8 @@ COLOMBUS BOARD M: Maxime Ripard S: Maintained F: configs/Colombus_defconfig + +IPPO-Q8H-V5 BOARD +M: CHen-Yu Tsai +S: Maintained +F: configs/Ippo_q8h_v5_defconfig diff --git a/configs/Ippo_q8h_defconfig b/configs/Ippo_q8h_defconfig new file mode 100644 index 00000000000..781f13785b2 --- /dev/null +++ b/configs/Ippo_q8h_defconfig @@ -0,0 +1,4 @@ +CONFIG_SYS_EXTRA_OPTIONS="IPPO_Q8H_V5,CONS_INDEX=5" +CONFIG_ARM=y +CONFIG_TARGET_SUN8I=y +CONFIG_DEFAULT_DEVICE_TREE="sun8i-a23-ippo-q8h-v5.dtb" -- cgit v1.2.3 From accc9e446be6c3bd129315a0c5830bddccfa16da Mon Sep 17 00:00:00 2001 From: Hans de Goede Date: Wed, 22 Oct 2014 14:56:36 +0200 Subject: sunxi: Add CONFIG_OLD_SUNXI_KERNEL_COMPAT Kconfig option Add a Kconfig option which users can select when they want to boot older kernels, e.g. the linux-sunxi 3.4 kernels. For now this just forces the pll5 "p" value to 1 (divide by 2) as that is what those kernels are hardcoded too, in the future this may enable further workarounds. Signed-off-by: Hans de Goede Reviewed-by: Tom Rini -- Changes in v2: -s/CONFIG_OLD_KERNEL_COMPAT/CONFIG_OLD_SUNXI_KERNEL_COMPAT. -Move the code block setting P(1) for old kernels to where P gets cleared --- arch/arm/cpu/armv7/sunxi/dram.c | 4 ++++ board/sunxi/Kconfig | 7 +++++++ 2 files changed, 11 insertions(+) (limited to 'board') diff --git a/arch/arm/cpu/armv7/sunxi/dram.c b/arch/arm/cpu/armv7/sunxi/dram.c index 0cbcf5767c3..3cf3cbf19ad 100644 --- a/arch/arm/cpu/armv7/sunxi/dram.c +++ b/arch/arm/cpu/armv7/sunxi/dram.c @@ -262,6 +262,10 @@ static void mctl_setup_dram_clock(u32 clk, u32 mbus_clk) reg_val &= ~CCM_PLL5_CTRL_K_MASK; /* set K to 0 (x1) */ reg_val &= ~CCM_PLL5_CTRL_N_MASK; /* set N to 0 (x0) */ reg_val &= ~CCM_PLL5_CTRL_P_MASK; /* set P to 0 (x1) */ +#ifdef CONFIG_OLD_SUNXI_KERNEL_COMPAT + /* Old kernels are hardcoded to P=1 (divide by 2) */ + reg_val |= CCM_PLL5_CTRL_P(1); +#endif if (clk >= 540 && clk < 552) { /* dram = 540MHz */ reg_val |= CCM_PLL5_CTRL_M(CCM_PLL5_CTRL_M_X(2)); diff --git a/board/sunxi/Kconfig b/board/sunxi/Kconfig index 449c0460f99..31a15037d07 100644 --- a/board/sunxi/Kconfig +++ b/board/sunxi/Kconfig @@ -20,6 +20,13 @@ config SYS_SOC config FDTFILE string "Default fdtfile env setting for this board" +config OLD_SUNXI_KERNEL_COMPAT + boolean "Enable workarounds for booting old kernels" + default n + ---help--- + Set this to enable various workarounds for old kernels, this results in + sub-optimal settings for newer kernels, only enable if needed. + config MMC0_CD_PIN string "Card detect pin for mmc0" default "" -- cgit v1.2.3