]> git.sur5r.net Git - u-boot/commitdiff
Merge branch 'master' of git://git.denx.de/u-boot-net
authorTom Rini <trini@konsulko.com>
Wed, 30 Sep 2015 22:51:51 +0000 (18:51 -0400)
committerTom Rini <trini@konsulko.com>
Wed, 30 Sep 2015 22:51:51 +0000 (18:51 -0400)
17 files changed:
arch/arm/cpu/armv7/sunxi/board.c
arch/arm/dts/Makefile
arch/arm/dts/sun8i-a33-q8-tablet.dts [new file with mode: 0644]
arch/arm/dts/sun8i-q8-common.dtsi [new file with mode: 0644]
arch/arm/include/asm/arch-sunxi/spl.h
arch/x86/lib/fsp/fsp_dram.c
board/sunxi/MAINTAINERS
board/sunxi/board.c
configs/A10s-Wobo-i5_defconfig [deleted file]
configs/Wobo_i5_defconfig [new file with mode: 0644]
configs/chromebook_link_defconfig
configs/q8_a33_tablet_1024x600_defconfig [new file with mode: 0644]
configs/q8_a33_tablet_800x480_defconfig [new file with mode: 0644]
drivers/mmc/sunxi_mmc.c
drivers/mtd/nand/sunxi_nand_spl.c
include/configs/sunxi-common.h
tools/mksunxiboot.c

index b40198b36ee5c03a8caaaff42dc53b855c84566e..d11365b65bc3f4f9c1f07830a1de0bd79fe19cf9 100644 (file)
@@ -21,6 +21,7 @@
 #include <asm/io.h>
 #include <asm/arch/clock.h>
 #include <asm/arch/gpio.h>
+#include <asm/arch/spl.h>
 #include <asm/arch/sys_proto.h>
 #include <asm/arch/timer.h>
 #include <asm/arch/tzpc.h>
@@ -152,7 +153,7 @@ u32 spl_boot_device(void)
         * binary over USB. If it is found, it determines where SPL was
         * read from.
         */
-       if (readl(4) != 0x4E4F4765 || readl(8) != 0x3054422E) /* eGON.BT0 */
+       if (!is_boot0_magic(SPL_ADDR + 4)) /* eGON.BT0 */
                return BOOT_DEVICE_BOARD;
 
        /* The BROM will try to boot from mmc0 first, so try that first. */
@@ -198,11 +199,6 @@ void board_init_f(ulong dummy)
        i2c_init(CONFIG_SYS_I2C_SPEED, CONFIG_SYS_I2C_SLAVE);
 #endif
        sunxi_board_init();
-
-       /* Clear the BSS. */
-       memset(__bss_start, 0, __bss_end - __bss_start);
-
-       board_init_r(NULL, 0);
 }
 #endif
 
index 5f10243fe6d4c5a4c025a6739f586167c26cd7ec..6a11b12f27d189492547355d0fdd6d031e56e5cb 100644 (file)
@@ -158,6 +158,7 @@ dtb-$(CONFIG_MACH_SUN8I_A33) += \
        sun8i-a33-et-q8-v1.6.dtb \
        sun8i-a33-ga10h-v1.1.dtb \
        sun8i-a33-ippo-q8h-v1.2.dtb \
+       sun8i-a33-q8-tablet.dtb \
        sun8i-a33-sinlinx-sina33.dtb
 dtb-$(CONFIG_MACH_SUN9I) += \
        sun9i-a80-optimus.dtb \
diff --git a/arch/arm/dts/sun8i-a33-q8-tablet.dts b/arch/arm/dts/sun8i-a33-q8-tablet.dts
new file mode 100644 (file)
index 0000000..44b3229
--- /dev/null
@@ -0,0 +1,65 @@
+/*
+ * Copyright 2015 Hans de Goede <hdegoede@redhat.com>
+ *
+ * This file is dual-licensed: you can use it either under the terms
+ * of the GPL or the X11 license, at your option. Note that this dual
+ * licensing only applies to this file, and not this project as a
+ * whole.
+ *
+ *  a) This file is free software; you can redistribute it and/or
+ *     modify it under the terms of the GNU General Public License as
+ *     published by the Free Software Foundation; either version 2 of the
+ *     License, or (at your option) any later version.
+ *
+ *     This file is distributed in the hope that it will be useful,
+ *     but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *     GNU General Public License for more details.
+ *
+ * Or, alternatively,
+ *
+ *  b) Permission is hereby granted, free of charge, to any person
+ *     obtaining a copy of this software and associated documentation
+ *     files (the "Software"), to deal in the Software without
+ *     restriction, including without limitation the rights to use,
+ *     copy, modify, merge, publish, distribute, sublicense, and/or
+ *     sell copies of the Software, and to permit persons to whom the
+ *     Software is furnished to do so, subject to the following
+ *     conditions:
+ *
+ *     The above copyright notice and this permission notice shall be
+ *     included in all copies or substantial portions of the Software.
+ *
+ *     THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ *     EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
+ *     OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ *     NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
+ *     HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+ *     WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ *     FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+ *     OTHER DEALINGS IN THE SOFTWARE.
+ */
+
+/dts-v1/;
+#include "sun8i-a33.dtsi"
+#include "sun8i-q8-common.dtsi"
+
+/ {
+       model = "Q8 A33 Tablet";
+       compatible = "allwinner,q8-a33", "allwinner,sun8i-a33";
+};
+
+/*
+ * FIXME for now we only support host mode and rely on u-boot to have
+ * turned on Vbus which is controlled by the axp223 pmic on the board.
+ *
+ * Once we have axp223 support we should switch to fully supporting otg.
+ */
+&usb_otg {
+       dr_mode = "host";
+       status = "okay";
+};
+
+&usbphy {
+       status = "okay";
+};
diff --git a/arch/arm/dts/sun8i-q8-common.dtsi b/arch/arm/dts/sun8i-q8-common.dtsi
new file mode 100644 (file)
index 0000000..07cd268
--- /dev/null
@@ -0,0 +1,84 @@
+/*
+ * Copyright 2015 Hans de Goede <hdegoede@redhat.com>
+ *
+ * This file is dual-licensed: you can use it either under the terms
+ * of the GPL or the X11 license, at your option. Note that this dual
+ * licensing only applies to this file, and not this project as a
+ * whole.
+ *
+ *  a) This file is free software; you can redistribute it and/or
+ *     modify it under the terms of the GNU General Public License as
+ *     published by the Free Software Foundation; either version 2 of the
+ *     License, or (at your option) any later version.
+ *
+ *     This file is distributed in the hope that it will be useful,
+ *     but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *     GNU General Public License for more details.
+ *
+ * Or, alternatively,
+ *
+ *  b) Permission is hereby granted, free of charge, to any person
+ *     obtaining a copy of this software and associated documentation
+ *     files (the "Software"), to deal in the Software without
+ *     restriction, including without limitation the rights to use,
+ *     copy, modify, merge, publish, distribute, sublicense, and/or
+ *     sell copies of the Software, and to permit persons to whom the
+ *     Software is furnished to do so, subject to the following
+ *     conditions:
+ *
+ *     The above copyright notice and this permission notice shall be
+ *     included in all copies or substantial portions of the Software.
+ *
+ *     THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ *     EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
+ *     OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ *     NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
+ *     HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+ *     WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ *     FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+ *     OTHER DEALINGS IN THE SOFTWARE.
+ */
+#include "sunxi-q8-common.dtsi"
+
+/ {
+       aliases {
+               serial0 = &r_uart;
+       };
+
+       chosen {
+               stdout-path = "serial0:115200n8";
+       };
+};
+
+&mmc0 {
+       pinctrl-names = "default";
+       pinctrl-0 = <&mmc0_pins_a>, <&mmc0_cd_pin_q8>;
+       vmmc-supply = <&reg_vcc3v0>;
+       bus-width = <4>;
+       cd-gpios = <&pio 1 4 GPIO_ACTIVE_HIGH>; /* PB4 */
+       cd-inverted;
+       status = "okay";
+};
+
+&pio {
+       bl_en_pin_q8: bl_en_pin@0 {
+               allwinner,pins = "PH6";
+               allwinner,function = "gpio_in";
+               allwinner,drive = <SUN4I_PINCTRL_10_MA>;
+               allwinner,pull = <SUN4I_PINCTRL_NO_PULL>;
+       };
+
+       mmc0_cd_pin_q8: mmc0_cd_pin@0 {
+               allwinner,pins = "PB4";
+               allwinner,function = "gpio_in";
+               allwinner,drive = <SUN4I_PINCTRL_10_MA>;
+               allwinner,pull = <SUN4I_PINCTRL_PULL_UP>;
+       };
+};
+
+&r_uart {
+       pinctrl-names = "default";
+       pinctrl-0 = <&r_uart_pins_a>;
+       status = "okay";
+};
index acbec46cb8b796d5b68617c07b1654676a66176e..a129dd4ee0a09e2d92cf11a7edd9caec8165ad61 100644 (file)
@@ -1,20 +1,50 @@
 /*
- * This is a copy of omap3/spl.h:
- *
- * (C) Copyright 2012
- * Texas Instruments, <www.ti.com>
+ * (C) Copyright 2007-2011
+ * Allwinner Technology Co., Ltd. <www.allwinnertech.com>
+ * Tom Cubie <tangliang@allwinnertech.com>
  *
  * SPDX-License-Identifier:    GPL-2.0+
  */
 #ifndef        _ASM_ARCH_SPL_H_
 #define        _ASM_ARCH_SPL_H_
 
-#define BOOT_DEVICE_NONE       0
-#define BOOT_DEVICE_XIP                1
-#define BOOT_DEVICE_NAND       2
-#define BOOT_DEVICE_ONE_NAND   3
-#define BOOT_DEVICE_MMC2       5 /*emmc*/
-#define BOOT_DEVICE_MMC1       6
-#define BOOT_DEVICE_XIPWAIT    7
-#define BOOT_DEVICE_MMC2_2      0xff
+#define BOOT0_MAGIC            "eGON.BT0"
+#define SPL_SIGNATURE          "SPL" /* marks "sunxi" SPL header */
+#define SPL_HEADER_VERSION     1
+
+/* Note: A80 will require special handling here: SPL_ADDR 0x10000 */
+#define SPL_ADDR               0x0
+
+/* boot head definition from sun4i boot code */
+struct boot_file_head {
+       uint32_t b_instruction; /* one intruction jumping to real code */
+       uint8_t magic[8];       /* ="eGON.BT0" or "eGON.BT1", not C-style str */
+       uint32_t check_sum;     /* generated by PC */
+       uint32_t length;        /* generated by PC */
+       /*
+        * We use a simplified header, only filling in what is needed
+        * by the boot ROM. To be compatible with Allwinner tools we
+        * would need to implement the proper fields here instead of
+        * padding.
+        *
+        * Actually we want the ability to recognize our "sunxi" variant
+        * of the SPL. To do so, let's place a special signature into the
+        * "pub_head_size" field. We can reasonably expect Allwinner's
+        * boot0 to always have the upper 16 bits of this set to 0 (after
+        * all the value shouldn't be larger than the limit imposed by
+        * SRAM size).
+        * If the signature is present (at 0x14), then we know it's safe
+        * to use the remaining 8 bytes (at 0x18) for our own purposes.
+        * (E.g. sunxi-tools "fel" utility can pass information there.)
+        */
+       union {
+               uint32_t pub_head_size;
+               uint8_t spl_signature[4];
+       };
+       uint32_t fel_script_address;
+       uint32_t reserved;              /* padding, align to 32 bytes */
+};
+
+#define is_boot0_magic(addr)   (memcmp((void *)addr, BOOT0_MAGIC, 8) == 0)
+
 #endif
index 28552fa15a0e32b8601cb177a7ff26b58d727304..e51ca96eb712fa514384cbe81278e4b5c091964d 100644 (file)
@@ -72,9 +72,10 @@ unsigned install_e820_map(unsigned max_entries, struct e820entry *entries)
                                entries[num_entries].type = E820_RAM;
                        else if (res_desc->type == RES_MEM_RESERVED)
                                entries[num_entries].type = E820_RESERVED;
+
+                       num_entries++;
                }
                hdr = get_next_hob(hdr);
-               num_entries++;
        }
 
        /* Mark PCIe ECAM address range as reserved */
index 8f95867fa6489d436fc1726b83d889b3a9da3003..f7a837a6eb1af070611e66d8c84bab15f5950a16 100644 (file)
@@ -20,8 +20,6 @@ F:    configs/mk802ii_defconfig
 F:     configs/pov_protab2_ips9_defconfig
 F:     include/configs/sun5i.h
 F:     configs/A10s-OLinuXino-M_defconfig
-F:     configs/A10s-OLinuXino-M_defconfig
-F:     configs/A10s-Wobo-i5_defconfig
 F:     configs/A13-OLinuXino_defconfig
 F:     configs/A13-OLinuXinoM_defconfig
 F:     configs/Auxtek-T003_defconfig
@@ -35,6 +33,7 @@ F:    include/configs/sun6i.h
 F:     configs/CSQ_CS908_defconfig
 F:     configs/Mele_A1000G_quad_defconfig
 F:     configs/Mele_M9_defconfig
+F:     configs/Wobo_i5_defconfig
 F:     include/configs/sun7i.h
 F:     configs/A20-OLinuXino_MICRO_defconfig
 F:     configs/Bananapi_defconfig
@@ -51,6 +50,8 @@ F:    configs/ga10h_v1_1_defconfig
 F:     configs/gt90h_v4_defconfig
 F:     configs/Ippo_q8h_v1_2_defconfig
 F:     configs/Ippo_q8h_v1_2_a33_1024x600_defconfig
+F:     configs/q8_a33_tablet_800x480_defconfig
+F:     configs/q8_a33_tablet_1024x600_defconfig
 F:     include/configs/sun9i.h
 F:     configs/Merrii_A80_Optimus_defconfig
 
index 9c855f604d62908e9983523c40a25ff0fd449750..096d12791cd29b0b521a5a820b0967e30e229e7d 100644 (file)
@@ -516,6 +516,31 @@ void get_board_serial(struct tag_serialnr *serialnr)
 }
 #endif
 
+#if !defined(CONFIG_SPL_BUILD)
+#include <asm/arch/spl.h>
+
+/*
+ * Check the SPL header for the "sunxi" variant. If found: parse values
+ * that might have been passed by the loader ("fel" utility), and update
+ * the environment accordingly.
+ */
+static void parse_spl_header(const uint32_t spl_addr)
+{
+       struct boot_file_head *spl = (void *)spl_addr;
+       if (memcmp(spl->spl_signature, SPL_SIGNATURE, 3) == 0) {
+               uint8_t spl_header_version = spl->spl_signature[3];
+               if (spl_header_version == SPL_HEADER_VERSION) {
+                       if (spl->fel_script_address)
+                               setenv_hex("fel_scriptaddr",
+                                          spl->fel_script_address);
+                       return;
+               }
+               printf("sunxi SPL version mismatch: expected %u, got %u\n",
+                      SPL_HEADER_VERSION, spl_header_version);
+       }
+}
+#endif
+
 #ifdef CONFIG_MISC_INIT_R
 int misc_init_r(void)
 {
@@ -524,6 +549,16 @@ int misc_init_r(void)
        uint8_t mac_addr[6];
        int ret;
 
+#if !defined(CONFIG_SPL_BUILD)
+       setenv("fel_booted", NULL);
+       setenv("fel_scriptaddr", NULL);
+       /* determine if we are running in FEL mode */
+       if (!is_boot0_magic(SPL_ADDR + 4)) { /* eGON.BT0 */
+               setenv("fel_booted", "1");
+               parse_spl_header(SPL_ADDR);
+       }
+#endif
+
        ret = sunxi_get_sid(sid);
        if (ret == 0 && sid[0] != 0 && sid[3] != 0) {
                if (!getenv("ethaddr")) {
diff --git a/configs/A10s-Wobo-i5_defconfig b/configs/A10s-Wobo-i5_defconfig
deleted file mode 100644 (file)
index 206fd48..0000000
+++ /dev/null
@@ -1,14 +0,0 @@
-CONFIG_ARM=y
-CONFIG_ARCH_SUNXI=y
-CONFIG_MACH_SUN5I=y
-CONFIG_DRAM_CLK=432
-CONFIG_MMC0_CD_PIN="PB3"
-CONFIG_USB1_VBUS_PIN="PG12"
-CONFIG_DEFAULT_DEVICE_TREE="sun5i-a10s-wobo-i5"
-# CONFIG_SYS_MALLOC_CLEAR_ON_INIT is not set
-CONFIG_SPL=y
-CONFIG_SYS_EXTRA_OPTIONS="AXP209_POWER"
-# CONFIG_CMD_IMLS is not set
-# CONFIG_CMD_FLASH is not set
-# CONFIG_CMD_FPGA is not set
-CONFIG_USB_EHCI_HCD=y
diff --git a/configs/Wobo_i5_defconfig b/configs/Wobo_i5_defconfig
new file mode 100644 (file)
index 0000000..206fd48
--- /dev/null
@@ -0,0 +1,14 @@
+CONFIG_ARM=y
+CONFIG_ARCH_SUNXI=y
+CONFIG_MACH_SUN5I=y
+CONFIG_DRAM_CLK=432
+CONFIG_MMC0_CD_PIN="PB3"
+CONFIG_USB1_VBUS_PIN="PG12"
+CONFIG_DEFAULT_DEVICE_TREE="sun5i-a10s-wobo-i5"
+# CONFIG_SYS_MALLOC_CLEAR_ON_INIT is not set
+CONFIG_SPL=y
+CONFIG_SYS_EXTRA_OPTIONS="AXP209_POWER"
+# CONFIG_CMD_IMLS is not set
+# CONFIG_CMD_FLASH is not set
+# CONFIG_CMD_FPGA is not set
+CONFIG_USB_EHCI_HCD=y
index 1c10124e8518e5b0de3a996cbff5664b3d6f6d78..21e85f3c666f1a6beaddb6ef04a94374fbdbc604 100644 (file)
@@ -1,4 +1,5 @@
 CONFIG_X86=y
+CONFIG_SYS_MALLOC_F_LEN=0x1800
 CONFIG_VENDOR_GOOGLE=y
 CONFIG_DEFAULT_DEVICE_TREE="chromebook_link"
 CONFIG_TARGET_CHROMEBOOK_LINK=y
diff --git a/configs/q8_a33_tablet_1024x600_defconfig b/configs/q8_a33_tablet_1024x600_defconfig
new file mode 100644 (file)
index 0000000..fbbf128
--- /dev/null
@@ -0,0 +1,25 @@
+CONFIG_ARM=y
+CONFIG_ARCH_SUNXI=y
+CONFIG_MACH_SUN8I_A33=y
+CONFIG_DRAM_CLK=456
+CONFIG_DRAM_ZQ=15291
+CONFIG_MMC0_CD_PIN="PB4"
+CONFIG_USB0_VBUS_PIN="AXP0-VBUS-ENABLE"
+CONFIG_USB0_VBUS_DET="AXP0-VBUS-DETECT"
+CONFIG_USB0_ID_DET="PH8"
+CONFIG_AXP_GPIO=y
+CONFIG_VIDEO_LCD_MODE="x:1024,y:600,depth:18,pclk_khz:51000,le:159,ri:160,up:22,lo:12,hs:1,vs:1,sync:3,vmode:0"
+CONFIG_VIDEO_LCD_DCLK_PHASE=0
+CONFIG_VIDEO_LCD_POWER="PH7"
+CONFIG_VIDEO_LCD_BL_EN="PH6"
+CONFIG_VIDEO_LCD_BL_PWM="PH0"
+CONFIG_DEFAULT_DEVICE_TREE="sun8i-a33-q8-tablet"
+# CONFIG_SYS_MALLOC_CLEAR_ON_INIT is not set
+CONFIG_SPL=y
+CONFIG_SYS_EXTRA_OPTIONS="CONS_INDEX=5"
+# CONFIG_CMD_IMLS is not set
+# CONFIG_CMD_FLASH is not set
+# CONFIG_CMD_FPGA is not set
+CONFIG_AXP221_DLDO1_VOLT=3300
+CONFIG_AXP221_ALDO1_VOLT=3000
+CONFIG_USB_MUSB_HOST=y
diff --git a/configs/q8_a33_tablet_800x480_defconfig b/configs/q8_a33_tablet_800x480_defconfig
new file mode 100644 (file)
index 0000000..8e8aa92
--- /dev/null
@@ -0,0 +1,25 @@
+CONFIG_ARM=y
+CONFIG_ARCH_SUNXI=y
+CONFIG_MACH_SUN8I_A33=y
+CONFIG_DRAM_CLK=456
+CONFIG_DRAM_ZQ=15291
+CONFIG_MMC0_CD_PIN="PB4"
+CONFIG_USB0_VBUS_PIN="AXP0-VBUS-ENABLE"
+CONFIG_USB0_VBUS_DET="AXP0-VBUS-DETECT"
+CONFIG_USB0_ID_DET="PH8"
+CONFIG_AXP_GPIO=y
+CONFIG_VIDEO_LCD_MODE="x:800,y:480,depth:18,pclk_khz:33000,le:87,ri:167,up:31,lo:13,hs:1,vs:1,sync:3,vmode:0"
+CONFIG_VIDEO_LCD_DCLK_PHASE=0
+CONFIG_VIDEO_LCD_POWER="PH7"
+CONFIG_VIDEO_LCD_BL_EN="PH6"
+CONFIG_VIDEO_LCD_BL_PWM="PH0"
+CONFIG_DEFAULT_DEVICE_TREE="sun8i-a33-q8-tablet"
+# CONFIG_SYS_MALLOC_CLEAR_ON_INIT is not set
+CONFIG_SPL=y
+CONFIG_SYS_EXTRA_OPTIONS="CONS_INDEX=5"
+# CONFIG_CMD_IMLS is not set
+# CONFIG_CMD_FLASH is not set
+# CONFIG_CMD_FPGA is not set
+CONFIG_AXP221_DLDO1_VOLT=3300
+CONFIG_AXP221_ALDO1_VOLT=3000
+CONFIG_USB_MUSB_HOST=y
index 25f18adb67257359160803e92733a7ebaa938ac2..e717c44216297fba3583098fad6cb20da8c58d98 100644 (file)
@@ -120,17 +120,27 @@ static int mmc_set_mod_clk(struct sunxi_mmc_host *mmchost, unsigned int hz)
        /* determine delays */
        if (hz <= 400000) {
                oclk_dly = 0;
-               sclk_dly = 7;
+               sclk_dly = 0;
        } else if (hz <= 25000000) {
                oclk_dly = 0;
                sclk_dly = 5;
+#ifdef CONFIG_MACH_SUN9I
        } else if (hz <= 50000000) {
-               oclk_dly = 3;
-               sclk_dly = 5;
+               oclk_dly = 5;
+               sclk_dly = 4;
        } else {
                /* hz > 50000000 */
                oclk_dly = 2;
                sclk_dly = 4;
+#else
+       } else if (hz <= 50000000) {
+               oclk_dly = 3;
+               sclk_dly = 4;
+       } else {
+               /* hz > 50000000 */
+               oclk_dly = 1;
+               sclk_dly = 4;
+#endif
        }
 
        writel(CCM_MMC_CTRL_ENABLE | pll | CCM_MMC_CTRL_SCLK_DLY(sclk_dly) |
index 5985534e5f1546073baff720db1d99b1ec0e1bcc..b0e07aa2d088a27977ddbb380d263b4a10e4a2be 100644 (file)
@@ -356,18 +356,32 @@ static int nand_read_buffer(uint32_t offs, unsigned int size, void *dest,
 
 int nand_spl_load_image(uint32_t offs, unsigned int size, void *dest)
 {
+#if CONFIG_SYS_NAND_U_BOOT_OFFS == CONFIG_SPL_PAD_TO
+       /*
+        * u-boot-dtb.bin appended to SPL, use syndrome (like the BROM does)
+        * and try different erase block sizes to find the backup.
+        */
        const uint32_t boot_offsets[] = {
                0 * 1024 * 1024 + CONFIG_SYS_NAND_U_BOOT_OFFS,
                1 * 1024 * 1024 + CONFIG_SYS_NAND_U_BOOT_OFFS,
                2 * 1024 * 1024 + CONFIG_SYS_NAND_U_BOOT_OFFS,
                4 * 1024 * 1024 + CONFIG_SYS_NAND_U_BOOT_OFFS,
        };
-       int i, syndrome;
-
-       if (CONFIG_SYS_NAND_U_BOOT_OFFS == CONFIG_SPL_PAD_TO)
-               syndrome = 1; /* u-boot-dtb.bin appended to SPL */
-       else
-               syndrome = 0; /* u-boot-dtb.bin on its own partition */
+       const int syndrome = 1;
+#else
+       /*
+        * u-boot-dtb.bin on its own partition, do not use syndrome, u-boot
+        * partition sits after 2 eraseblocks (spl, spl-backup), look for
+        * backup u-boot 1 erase block further.
+        */
+       const uint32_t eraseblock_size = CONFIG_SYS_NAND_U_BOOT_OFFS / 2;
+       const uint32_t boot_offsets[] = {
+               CONFIG_SYS_NAND_U_BOOT_OFFS,
+               CONFIG_SYS_NAND_U_BOOT_OFFS + eraseblock_size,
+       };
+       const int syndrome = 0;
+#endif
+       int i;
 
        if (offs == CONFIG_SYS_NAND_U_BOOT_OFFS) {
                for (i = 0; i < ARRAY_SIZE(boot_offsets); i++) {
index 48cc4ed6f629ebbf1229603aca99840edcc4f051..e1ba7914cda1830ff1bebb8a6aee43e2eafa210d 100644 (file)
@@ -13,6 +13,7 @@
 #ifndef _SUNXI_COMMON_CONFIG_H
 #define _SUNXI_COMMON_CONFIG_H
 
+#include <asm/arch/cpu.h>
 #include <linux/stringify.h>
 
 #ifdef CONFIG_OLD_SUNXI_KERNEL_COMPAT
 #define CONFIG_SYS_THUMB_BUILD /* Thumbs mode to save space in SPL */
 #endif
 
-#include <asm/arch/cpu.h>      /* get chip and board defs */
-
-#if !defined(CONFIG_SPL_BUILD) && defined(CONFIG_DM_SERIAL)
-# define CONFIG_DW_SERIAL
-#endif
-
-/*
- * Display CPU information
- */
-#define CONFIG_DISPLAY_CPUINFO
-
 /* Serial & console */
 #define CONFIG_SYS_NS16550
 #define CONFIG_SYS_NS16550_SERIAL
 /* ns16550 reg in the low bits of cpu reg */
 #define CONFIG_SYS_NS16550_CLK         24000000
-#ifndef CONFIG_DM_SERIAL
+#ifdef CONFIG_DM_SERIAL
+# define CONFIG_DW_SERIAL
+#else
 # define CONFIG_SYS_NS16550_REG_SIZE   -4
 # define CONFIG_SYS_NS16550_COM1               SUNXI_UART0_BASE
 # define CONFIG_SYS_NS16550_COM2               SUNXI_UART1_BASE
@@ -65,6 +57,7 @@
 #endif
 
 /* CPU */
+#define CONFIG_DISPLAY_CPUINFO
 #define CONFIG_SYS_CACHELINE_SIZE      64
 
 /*
 #define CONFIG_SYS_MMC_ENV_DEV         0       /* first detected MMC controller */
 #endif
 
-/* 4MB of malloc() pool */
-#define CONFIG_SYS_MALLOC_LEN          (CONFIG_ENV_SIZE + (4 << 20))
+/* 64MB of malloc() pool */
+#define CONFIG_SYS_MALLOC_LEN          (CONFIG_ENV_SIZE + (64 << 20))
 
 /*
  * Miscellaneous configurable options
@@ -282,11 +275,7 @@ extern int soft_i2c_gpio_scl;
  * The amount of RAM to keep free at the top of RAM when relocating u-boot,
  * to use as framebuffer. This must be a multiple of 4096.
  */
-#ifdef CONFIG_VIDEO_LCD_PANEL_EDP_4_LANE_1620M_VIA_ANX9804
-#define CONFIG_SUNXI_MAX_FB_SIZE (12 << 20)
-#else
-#define CONFIG_SUNXI_MAX_FB_SIZE (9 << 20)
-#endif
+#define CONFIG_SUNXI_MAX_FB_SIZE (16 << 20)
 
 /* Do we want to initialize a simple FB? */
 #define CONFIG_VIDEO_DT_SIMPLEFB
@@ -393,12 +382,12 @@ extern int soft_i2c_gpio_scl;
 #define CONFIG_PRE_CON_BUF_SZ          4096 /* Aprox 2 80*25 screens */
 
 /*
- * 240M RAM (256M minimum minus space for the framebuffer),
+ * 160M RAM (256M minimum minus 64MB heap + 32MB for u-boot, stack, fb, etc.
  * 32M uncompressed kernel, 16M compressed kernel, 1M fdt,
  * 1M script, 1M pxe and the ramdisk at the end.
  */
 #define MEM_LAYOUT_ENV_SETTINGS \
-       "bootm_size=0xf000000\0" \
+       "bootm_size=0xa000000\0" \
        "kernel_addr_r=" __stringify(SDRAM_OFFSET(2000000)) "\0" \
        "fdt_addr_r=" __stringify(SDRAM_OFFSET(3000000)) "\0" \
        "scriptaddr=" __stringify(SDRAM_OFFSET(3100000)) "\0" \
@@ -423,7 +412,18 @@ extern int soft_i2c_gpio_scl;
 #define BOOT_TARGET_DEVICES_USB(func)
 #endif
 
+/* FEL boot support, auto-execute boot.scr if a script address was provided */
+#define BOOTENV_DEV_FEL(devtypeu, devtypel, instance) \
+       "bootcmd_fel=" \
+               "if test -n ${fel_booted} && test -n ${fel_scriptaddr}; then " \
+                       "echo '(FEL boot)'; " \
+                       "source ${fel_scriptaddr}; " \
+               "fi\0"
+#define BOOTENV_DEV_NAME_FEL(devtypeu, devtypel, instance) \
+       "fel "
+
 #define BOOT_TARGET_DEVICES(func) \
+       func(FEL, fel, na) \
        BOOT_TARGET_DEVICES_MMC(func) \
        BOOT_TARGET_DEVICES_SCSI(func) \
        BOOT_TARGET_DEVICES_USB(func) \
index 676d392fb4d5a5c505fe505d4ab3d1ce25bc61eb..9c1c5b7cee2895d7fb8aa1e79822f0c9452bed8b 100644 (file)
 #include <errno.h>
 #include <sys/types.h>
 #include <sys/stat.h>
+#include "asm/arch/spl.h"
 
-/* boot head definition from sun4i boot code */
-struct boot_file_head {
-       uint32_t b_instruction; /* one intruction jumping to real code */
-       uint8_t magic[8];       /* ="eGON.BT0" or "eGON.BT1", not C-style str */
-       uint32_t check_sum;     /* generated by PC */
-       uint32_t length;        /* generated by PC */
-       /*
-        * We use a simplified header, only filling in what is needed
-        * by the boot ROM. To be compatible with Allwinner tools we
-        * would need to implement the proper fields here instead of
-        * padding.
-        */
-       uint8_t pad[12];                /* align to 32 bytes */
-};
-
-#define BOOT0_MAGIC                     "eGON.BT0"
 #define STAMP_VALUE                     0x5F0A6C39
 
 /* check sum functon from sun4i boot code */
@@ -133,6 +118,10 @@ int main(int argc, char *argv[])
                ALIGN(file_size + sizeof(struct boot_file_head), BLOCK_SIZE);
        img.header.b_instruction = cpu_to_le32(img.header.b_instruction);
        img.header.length = cpu_to_le32(img.header.length);
+
+       memcpy(img.header.spl_signature, SPL_SIGNATURE, 3); /* "sunxi" marker */
+       img.header.spl_signature[3] = SPL_HEADER_VERSION;
+
        gen_check_sum(&img.header);
 
        count = write(fd_out, &img, le32_to_cpu(img.header.length));