Merge branch 'master' of git://git.denx.de/u-boot-usb
authorTom Rini <trini@konsulko.com>
Fri, 18 Dec 2015 02:46:04 +0000 (21:46 -0500)
committerTom Rini <trini@konsulko.com>
Fri, 18 Dec 2015 02:46:04 +0000 (21:46 -0500)
35 files changed:
arch/arm/cpu/armv8/fsl-layerscape/soc.c
arch/arm/include/asm/arch-fsl-layerscape/config.h
arch/arm/include/asm/arch-fsl-layerscape/immap_lsch2.h
arch/arm/mach-rockchip/Kconfig
arch/arm/mach-rockchip/rk3036/Kconfig
arch/arm/mach-rockchip/rk3036/sdram_rk3036.c
arch/arm/mach-rockchip/rk3288/Kconfig
board/freescale/ls1043aqds/ls1043aqds_rcw_nand.cfg
board/freescale/ls1043aqds/ls1043aqds_rcw_sd_ifc.cfg
board/freescale/ls1043ardb/ls1043ardb_rcw_nand.cfg
board/freescale/ls1043ardb/ls1043ardb_rcw_sd.cfg
board/kylin/kylin_rk3036/Kconfig [new file with mode: 0644]
board/kylin/kylin_rk3036/MAINTAINERS [new file with mode: 0644]
board/kylin/kylin_rk3036/Makefile [new file with mode: 0644]
board/kylin/kylin_rk3036/kylin_rk3036.c [new file with mode: 0644]
common/spl/spl.c
configs/firefly-rk3288_defconfig
configs/kylin-rk3036_defconfig [new file with mode: 0644]
doc/README.rockchip
drivers/mmc/mmc.c
drivers/net/fm/init.c
drivers/net/fm/ls1043.c
drivers/net/fsl-mc/mc.c
include/configs/kylin_rk3036.h [new file with mode: 0644]
lib/Makefile
lib/panic.c [new file with mode: 0644]
lib/strto.c [new file with mode: 0644]
lib/tiny-printf.c
lib/vsprintf.c
tools/Makefile
tools/rkcommon.c
tools/rkcommon.h
tools/rkimage.c
tools/rksd.c
tools/rkspi.c

index 984eaf903e22be1b441fab3951c8321a48366483..23d6b73e3d307126c56786dd814522bd1b77b1de 100644 (file)
@@ -197,6 +197,19 @@ int sata_init(void)
 }
 #endif
 
+static void erratum_a009929(void)
+{
+#ifdef CONFIG_SYS_FSL_ERRATUM_A009929
+       struct ccsr_gur *gur = (void *)CONFIG_SYS_FSL_GUTS_ADDR;
+       u32 __iomem *dcsr_cop_ccp = (void *)CONFIG_SYS_DCSR_COP_CCP_ADDR;
+       u32 rstrqmr1 = gur_in32(&gur->rstrqmr1);
+
+       rstrqmr1 |= 0x00000400;
+       gur_out32(&gur->rstrqmr1, rstrqmr1);
+       writel(0x01000000, dcsr_cop_ccp);
+#endif
+}
+
 void fsl_lsch2_early_init_f(void)
 {
        struct ccsr_cci400 *cci = (struct ccsr_cci400 *)CONFIG_SYS_CCI400_ADDR;
@@ -216,6 +229,9 @@ void fsl_lsch2_early_init_f(void)
         */
        out_le32(&cci->slave[4].snoop_ctrl,
                 CCI400_DVM_MESSAGE_REQ_EN | CCI400_SNOOP_REQ_EN);
+
+       /* Erratum */
+       erratum_a009929();
 }
 #endif
 
index 6e5224ea1c98b2ad83e7b5c735df8a35355953ce..49b113dc59ba8f65ef7a92fbd7044fe22625e83b 100644 (file)
 #define GICD_BASE              0x01401000
 #define GICC_BASE              0x01402000
 
+#define CONFIG_SYS_FSL_ERRATUM_A009929
 #else
 #error SoC not defined
 #endif
index e7def3ac4a296f2f6164a791c6a9fbf59ce87558..21b803ff0fa9b65a1f81307b5c8ca6db68b2ec45 100644 (file)
@@ -11,7 +11,8 @@
 
 #define CONFIG_SYS_IMMR                                0x01000000
 #define CONFIG_SYS_DCSRBAR                     0x20000000
-#define CONFIG_SYS_DCSR_DCFG_ADDR      (CONFIG_SYS_DCSRBAR + 0x00220000)
+#define CONFIG_SYS_DCSR_DCFG_ADDR      (CONFIG_SYS_DCSRBAR + 0x00140000)
+#define CONFIG_SYS_DCSR_COP_CCP_ADDR   (CONFIG_SYS_DCSRBAR + 0x02008040)
 
 #define CONFIG_SYS_FSL_DDR_ADDR                        (CONFIG_SYS_IMMR + 0x00080000)
 #define CONFIG_SYS_CCI400_ADDR                 (CONFIG_SYS_IMMR + 0x00180000)
index aef1a455ae0108b079cccd7d0aea2f659fddc012..d3bddb726af61c6d4b4644b148f43fa980c8c389 100644 (file)
@@ -17,21 +17,6 @@ config ROCKCHIP_RK3036
          and video codec support. Peripherals include Gigabit Ethernet,
          USB2 host and OTG, SDIO, I2S, UART, SPI, I2C and PWMs.
 
-config ROCKCHIP_SPL_HDR
-       string "Header of rockchip's spl loader"
-       help
-         Rockchip's bootrom requires the spl loader to start with a 4-bytes
-         header. The content of this header depends on the chip type.
-
-config ROCKCHIP_MAX_SPL_SIZE
-       hex "Max size of rockchip's spl loader"
-       help
-         Different chip may have different sram size. And if we want to jump
-         back to the bootrom after spl, we may need to reserve some sram space
-         for the bootrom.
-         The max spl loader size should be sram size minus reserved
-         size(if needed)
-
 config SYS_MALLOC_F
        default y
 
index 95fb2b946338f493cc22b4dbf008c45092ade872..cc0380884729bd69be6ad0fb53180da49d6a10ff 100644 (file)
@@ -3,21 +3,19 @@ if ROCKCHIP_RK3036
 config TARGET_EVB_RK3036
        bool "EVB_RK3036"
 
+config TARGET_KYLIN_RK3036
+       bool "KYLIN_RK3036"
+
 config SYS_SOC
        default "rockchip"
 
 config SYS_MALLOC_F_LEN
        default 0x400
 
-config ROCKCHIP_SPL_HDR
-        default "RK30"
-
-config ROCKCHIP_MAX_SPL_SIZE
-        default 0x1000
-
 config ROCKCHIP_COMMON
        bool "Support rk common fuction"
 
 source "board/evb_rk3036/evb_rk3036/Kconfig"
+source "board/kylin/kylin_rk3036/Kconfig"
 
 endif
index 7a05e310d73d10b94bd9f1cf732c5ace1065f596..e3ca8700742da9dcff7d22b976ed7d68a219b2ee 100644 (file)
@@ -701,15 +701,19 @@ finish:
 static void sdram_all_config(struct rk3036_sdram_priv *priv)
 {
        u32 os_reg = 0;
+       u32 cs1_row = 0;
        struct rk3036_ddr_config config = priv->ddr_config;
 
+       if (config.rank > 1)
+               cs1_row = config.cs1_row - 13;
+
        os_reg = config.ddr_type << DDR_TYPE_SHIFT |
                        0 << DDR_CHN_CNT_SHIFT |
                        (config.rank - 1) << DDR_RANK_CNT_SHIFT |
                        (config.col - 1) << DDR_COL_SHIFT |
                        (config.bank == 3 ? 0 : 1) << DDR_BANK_SHIFT |
                        (config.cs0_row - 13) << DDR_CS0_ROW_SHIFT |
-                       (config.cs1_row - 13) << DDR_CS1_ROW_SHIFT |
+                       cs1_row << DDR_CS1_ROW_SHIFT |
                        1 << DDR_BW_SHIFT | config.bw << DDR_DIE_BW_SHIFT;
        writel(os_reg, &priv->grf->os_reg[1]);
 }
index 3de3878cd6e1284986288f975f8dcc5616432a49..d0a72767c88075ba78846bb2631313f02e0d789c 100644 (file)
@@ -16,12 +16,6 @@ config TARGET_CHROMEBOOK_JERRY
          WiFi. It includes a Chrome OS EC (Cortex-M3) to provide access to
          the keyboard and battery functions.
 
-config ROCKCHIP_SPL_HDR
-       default "RK32"
-
-config ROCKCHIP_MAX_SPL_SIZE
-       default 0x8000
-
 config SYS_SOC
        default "rockchip"
 
index 935ffc0102141d69c458d9d488d2ece34b84d376..d87058b7efef4d5a327404937bafc45089253d40 100644 (file)
@@ -1,7 +1,7 @@
 #PBL preamble and RCW header
 aa55aa55 01ee0100
 # serdes protocol
-0810000f 0c000000 00000000 00000000
-14550002 80004012 e0106000 61002000
+08100010 0a000000 00000000 00000000
+14550002 80004012 e0106000 c1002000
 00000000 00000000 00000000 00038800
 00000000 00001100 00000096 00000001
index 17a5dd02594f5d705372c9a673a02461e86a3769..b6b5e0b10183b22f5a11ad41bfb526b826b0f82f 100644 (file)
@@ -2,7 +2,7 @@
 aa55aa55 01ee0100
 # RCW
 # Enable IFC; disable QSPI
-0810000f 0c000000 00000000 00000000
-14550002 80004012 60040000 61002000
+08100010 0a000000 00000000 00000000
+14550002 80004012 60040000 c1002000
 00000000 00000000 00000000 00038800
 00000000 00001100 00000096 00000001
index 935ffc0102141d69c458d9d488d2ece34b84d376..d87058b7efef4d5a327404937bafc45089253d40 100644 (file)
@@ -1,7 +1,7 @@
 #PBL preamble and RCW header
 aa55aa55 01ee0100
 # serdes protocol
-0810000f 0c000000 00000000 00000000
-14550002 80004012 e0106000 61002000
+08100010 0a000000 00000000 00000000
+14550002 80004012 e0106000 c1002000
 00000000 00000000 00000000 00038800
 00000000 00001100 00000096 00000001
index 28cd95859d20655b47e2e191f917578403da49cb..e2ee34b7dfc4956c3ac7afda7b93019f87170a8a 100644 (file)
@@ -1,7 +1,7 @@
 #PBL preamble and RCW header
 aa55aa55 01ee0100
 # RCW
-0810000f 0c000000 00000000 00000000
-14550002 80004012 60040000 61002000
+08100010 0a000000 00000000 00000000
+14550002 80004012 60040000 c1002000
 00000000 00000000 00000000 00038800
 00000000 00001100 00000096 00000001
diff --git a/board/kylin/kylin_rk3036/Kconfig b/board/kylin/kylin_rk3036/Kconfig
new file mode 100644 (file)
index 0000000..5d75c1f
--- /dev/null
@@ -0,0 +1,15 @@
+if TARGET_KYLIN_RK3036
+
+config SYS_BOARD
+       default "kylin_rk3036"
+
+config SYS_VENDOR
+       default "kylin"
+
+config SYS_CONFIG_NAME
+       default "kylin_rk3036"
+
+config BOARD_SPECIFIC_OPTIONS # dummy
+       def_bool y
+
+endif
diff --git a/board/kylin/kylin_rk3036/MAINTAINERS b/board/kylin/kylin_rk3036/MAINTAINERS
new file mode 100644 (file)
index 0000000..e69de29
diff --git a/board/kylin/kylin_rk3036/Makefile b/board/kylin/kylin_rk3036/Makefile
new file mode 100644 (file)
index 0000000..0663270
--- /dev/null
@@ -0,0 +1,7 @@
+#
+# (C) Copyright 2015 Google, Inc
+#
+# SPDX-License-Identifier:     GPL-2.0+
+#
+
+obj-y  += kylin_rk3036.o
diff --git a/board/kylin/kylin_rk3036/kylin_rk3036.c b/board/kylin/kylin_rk3036/kylin_rk3036.c
new file mode 100644 (file)
index 0000000..40d6b52
--- /dev/null
@@ -0,0 +1,49 @@
+/*
+ * (C) Copyright 2015 Rockchip Electronics Co., Ltd
+ *
+ * SPDX-License-Identifier:     GPL-2.0+
+ */
+
+#include <common.h>
+#include <dm.h>
+#include <asm/io.h>
+#include <asm/arch/uart.h>
+#include <asm/arch/sdram_rk3036.h>
+
+DECLARE_GLOBAL_DATA_PTR;
+
+void get_ddr_config(struct rk3036_ddr_config *config)
+{
+       /* K4B4G1646Q config */
+       config->ddr_type = 3;
+       config->rank = 1;
+       config->cs0_row = 15;
+       config->cs1_row = 15;
+
+       /* 8bank */
+       config->bank = 3;
+       config->col = 10;
+
+       /* 16bit bw */
+       config->bw = 1;
+}
+
+int board_init(void)
+{
+       return 0;
+}
+
+int dram_init(void)
+{
+       gd->ram_size = sdram_size();
+
+       return 0;
+}
+
+#ifndef CONFIG_SYS_DCACHE_OFF
+void enable_caches(void)
+{
+       /* Enable D-cache. I-cache is already enabled in start.S */
+       dcache_enable();
+}
+#endif
index 7a393dc078291d3fec81b88cf4c17cebaa4e27d1..6e6dee7ec9b1d9b8ccd2cee17239557c88a28250 100644 (file)
@@ -452,7 +452,7 @@ ulong spl_relocate_stack_gd(void)
 #ifdef CONFIG_SPL_SYS_MALLOC_SIMPLE
        if (CONFIG_SPL_STACK_R_MALLOC_SIMPLE_LEN) {
                if (!(gd->flags & GD_FLG_SPL_INIT))
-                       panic("spl_init must be called before heap reloc");
+                       panic_str("spl_init must be called before heap reloc");
 
                ptr -= CONFIG_SPL_STACK_R_MALLOC_SIMPLE_LEN;
                gd->malloc_base = ptr;
index b645af561579a41c71b3a22c656375a6ae0e7752..be4ca8802e8e131356b7d72599aeb911ced93f85 100644 (file)
@@ -42,5 +42,6 @@ CONFIG_DEBUG_UART_CLOCK=24000000
 CONFIG_DEBUG_UART_SHIFT=2
 CONFIG_SYS_NS16550=y
 CONFIG_USE_PRIVATE_LIBGCC=y
+CONFIG_USE_TINY_PRINTF=y
 CONFIG_CMD_DHRYSTONE=y
 CONFIG_ERRNO_STR=y
diff --git a/configs/kylin-rk3036_defconfig b/configs/kylin-rk3036_defconfig
new file mode 100644 (file)
index 0000000..60cdebf
--- /dev/null
@@ -0,0 +1,26 @@
+CONFIG_ARM=y
+CONFIG_ARCH_ROCKCHIP=y
+CONFIG_ROCKCHIP_RK3036=y
+CONFIG_TARGET_KYLIN_RK3036=y
+CONFIG_DEFAULT_DEVICE_TREE="rk3036-sdk"
+CONFIG_SPL_STACK_R=y
+CONFIG_SPL_STACK_R_ADDR=0x80000
+# CONFIG_CMD_IMLS is not set
+# CONFIG_CMD_SETEXPR is not set
+CONFIG_CMD_PMIC=y
+CONFIG_CMD_REGULATOR=y
+CONFIG_CLK=y
+CONFIG_REGMAP=y
+CONFIG_SYSCON=y
+CONFIG_RESET=y
+CONFIG_LED=y
+CONFIG_SYS_I2C_ROCKCHIP=y
+CONFIG_PINCTRL=y
+CONFIG_ROCKCHIP_DWMMC=y
+CONFIG_ROCKCHIP_3036_PINCTRL=y
+CONFIG_ROCKCHIP_GPIO=y
+CONFIG_RAM=y
+CONFIG_DM_MMC=y
+CONFIG_USE_PRIVATE_LIBGCC=y
+CONFIG_CMD_DHRYSTONE=y
+CONFIG_ERRNO_STR=y
index 874441c34ecd1a603fbc606d7c27595521a6ec36..b455f6fee703272f8ae00c035479dc540286c9a6 100644 (file)
@@ -71,7 +71,7 @@ Connect your board's OTG port to your computer.
 
 To create a suitable image and write it to the board:
 
-   ./firefly-rk3288/tools/mkimage -T rkimage -d \
+   ./firefly-rk3288/tools/mkimage -n rk3288 -T rkimage -d \
        ./firefly-rk3288/spl/u-boot-spl-dtb.bin out && \
    cat out | openssl rc4 -K 7c4e0304550509072d2c7b38170d1711 | rkflashtool l
 
@@ -94,7 +94,7 @@ Booting from an SD card
 
 To write an image that boots from an SD card (assumed to be /dev/sdc):
 
-   ./firefly-rk3288/tools/mkimage -T rksd -d \
+   ./firefly-rk3288/tools/mkimage -n rk3288 -T rksd -d \
        firefly-rk3288/spl/u-boot-spl-dtb.bin out && \
    sudo dd if=out of=/dev/sdc seek=64 && \
    sudo dd if=firefly-rk3288/u-boot-dtb.img of=/dev/sdc seek=256
@@ -123,7 +123,7 @@ something like:
    =>
 
 For evb_rk3036 board:
-       ./evb-rk3036/tools/mkimage -T rksd  -d evb-rk3036/spl/u-boot-spl.bin out && \
+       ./evb-rk3036/tools/mkimage -n rk3036 -T rksd  -d evb-rk3036/spl/u-boot-spl.bin out && \
        cat evb-rk3036/u-boot-dtb.bin >> out && \
        sudo dd if=out of=/dev/sdc seek=64
 
@@ -135,7 +135,7 @@ Booting from SPI
 
 To write an image that boots from SPI flash (e.g. for the Haier Chromebook):
 
-   ./chromebook_jerry/tools/mkimage -T rkspi -d chromebook_jerry/spl/u-boot-spl-dtb.bin out
+   ./chromebook_jerry/tools/mkimage -n rk3036 -T rkspi -d chromebook_jerry/spl/u-boot-spl-dtb.bin out
    dd if=spl.bin of=out.bin bs=128K conv=sync
    cat chromebook_jerry/u-boot-dtb.img out.bin
    dd if=out.bin of=out.bin.pad bs=4M conv=sync
index 2a58702848b7f977bd3d10b12bd9138287fc1df5..3a34028c9177ef1d917910dfd61a7c4b14e12749 100644 (file)
@@ -1469,7 +1469,9 @@ static int mmc_startup(struct mmc *mmc)
        mmc->block_dev.blksz = mmc->read_bl_len;
        mmc->block_dev.log2blksz = LOG2(mmc->block_dev.blksz);
        mmc->block_dev.lba = lldiv(mmc->capacity, mmc->read_bl_len);
-#if !defined(CONFIG_SPL_BUILD) || defined(CONFIG_SPL_LIBCOMMON_SUPPORT)
+#if !defined(CONFIG_SPL_BUILD) || \
+               (defined(CONFIG_SPL_LIBCOMMON_SUPPORT) && \
+               !defined(CONFIG_USE_TINY_PRINTF))
        sprintf(mmc->block_dev.vendor, "Man %06x Snr %04x%04x",
                mmc->cid[0] >> 24, (mmc->cid[2] & 0xffff),
                (mmc->cid[3] >> 16) & 0xffff);
index 3a1de59fd8f5fc21ff30d921bd93c03fa944ae3f..7e312f1517817916dcef7f1bf6ccaa2e7fe727f3 100644 (file)
@@ -242,8 +242,10 @@ int ft_fixup_port(void *blob, struct fm_eth_info *info, char *prop)
        int off;
        uint32_t ph;
        phys_addr_t paddr = CONFIG_SYS_CCSRBAR_PHYS + info->compat_offset;
+#ifndef CONFIG_SYS_FMAN_V3
        u64 dtsec1_addr = (u64)CONFIG_SYS_CCSRBAR_PHYS +
                                CONFIG_SYS_FSL_FM1_DTSEC1_OFFSET;
+#endif
 
        off = fdt_node_offset_by_compat_reg(blob, prop, paddr);
        if (off == -FDT_ERR_NOTFOUND)
@@ -295,8 +297,10 @@ int ft_fixup_port(void *blob, struct fm_eth_info *info, char *prop)
        /* board code might have caused offset to change */
        off = fdt_node_offset_by_compat_reg(blob, prop, paddr);
 
+#ifndef CONFIG_SYS_FMAN_V3
        /* Don't disable FM1-DTSEC1 MAC as its used for MDIO */
        if (paddr != dtsec1_addr)
+#endif
                fdt_status_disabled(blob, off); /* disable the MAC node */
 
        /* disable the fsl,dpa-ethernet node that points to the MAC */
index cf2cc95a3a4c80196043ca3571f8a9897ca1e2cb..93ba318bf5286bd11114cf5a94dad87497a99f27 100644 (file)
@@ -54,11 +54,8 @@ phy_interface_t fman_port_enet_if(enum fm_port port)
        struct ccsr_gur *gur = (void *)(CONFIG_SYS_FSL_GUTS_ADDR);
        u32 rcwsr13 = in_be32(&gur->rcwsr[13]);
 
-       if (is_device_disabled(port)) {
-               printf("%s:%d: port(%d) is disabled\n", __func__,
-                      __LINE__, port);
+       if (is_device_disabled(port))
                return PHY_INTERFACE_MODE_NONE;
-       }
 
        if ((port == FM1_10GEC1) && (is_serdes_configured(XFI_FM1_MAC9)))
                return PHY_INTERFACE_MODE_XGMII;
@@ -69,15 +66,11 @@ phy_interface_t fman_port_enet_if(enum fm_port port)
        if (port == FM1_DTSEC3)
                if ((rcwsr13 & FSL_CHASSIS2_RCWSR13_EC1) ==
                                FSL_CHASSIS2_RCWSR13_EC1_DTSEC3_RGMII) {
-                       printf("%s:%d: port(FM1_DTSEC3) is OK\n",
-                              __func__, __LINE__);
                        return PHY_INTERFACE_MODE_RGMII;
                }
        if (port == FM1_DTSEC4)
                if ((rcwsr13 & FSL_CHASSIS2_RCWSR13_EC2) ==
                                FSL_CHASSIS2_RCWSR13_EC2_DTSEC4_RGMII) {
-                       printf("%s:%d: port(FM1_DTSEC4) is OK\n",
-                              __func__, __LINE__);
                        return PHY_INTERFACE_MODE_RGMII;
                }
 
index e1a02d1f3d1143b8d6454083a61101675668b179..bac4610fd995d62d1f2f1d595fe91e7216626be9 100644 (file)
@@ -541,19 +541,6 @@ int mc_init(u64 mc_fw_addr, u64 mc_dpc_addr)
                goto out;
        }
 
-       if (MC_VER_MAJOR != mc_ver_info.major) {
-               printf("fsl-mc: ERROR: Firmware major version mismatch (found: %d, expected: %d)\n",
-                      mc_ver_info.major, MC_VER_MAJOR);
-               printf("fsl-mc: Update the Management Complex firmware\n");
-
-               error = -ENODEV;
-               goto out;
-       }
-
-       if (MC_VER_MINOR != mc_ver_info.minor)
-               printf("fsl-mc: WARNING: Firmware minor version mismatch (found: %d, expected: %d)\n",
-                      mc_ver_info.minor, MC_VER_MINOR);
-
        printf("fsl-mc: Management Complex booted (version: %d.%d.%d, boot status: %#x)\n",
               mc_ver_info.major, mc_ver_info.minor, mc_ver_info.revision,
               reg_gsr & GSR_FS_MASK);
diff --git a/include/configs/kylin_rk3036.h b/include/configs/kylin_rk3036.h
new file mode 100644 (file)
index 0000000..aa07889
--- /dev/null
@@ -0,0 +1,12 @@
+/*
+ * (C) Copyright 2015 Rockchip Electronics Co., Ltd
+ *
+ * SPDX-License-Identifier:     GPL-2.0+
+ */
+
+#ifndef __CONFIG_H
+#define __CONFIG_H
+
+#include <configs/rk3036_common.h>
+
+#endif
index 1f1ff6f205592f6cbb9ef62f6b39b75ecf5ba1a8..dd36f25b2a3235b3acb487af4fd658eddc48e3fc 100644 (file)
@@ -85,13 +85,13 @@ obj-$(CONFIG_LIB_RAND) += rand.o
 ifdef CONFIG_SPL_BUILD
 # SPL U-Boot may use full-printf, tiny-printf or none at all
 ifdef CONFIG_USE_TINY_PRINTF
-obj-$(CONFIG_SPL_SERIAL_SUPPORT) += tiny-printf.o
+obj-$(CONFIG_SPL_SERIAL_SUPPORT) += tiny-printf.o panic.o strto.o
 else
-obj-$(CONFIG_SPL_SERIAL_SUPPORT) += vsprintf.o
+obj-$(CONFIG_SPL_SERIAL_SUPPORT) += vsprintf.o panic.o strto.o
 endif
 else
 # Main U-Boot always uses the full printf support
-obj-y += vsprintf.o
+obj-y += vsprintf.o panic.o strto.o
 endif
 
 subdir-ccflags-$(CONFIG_CC_OPTIMIZE_LIBS_FOR_SPEED) += -O2
diff --git a/lib/panic.c b/lib/panic.c
new file mode 100644 (file)
index 0000000..e2b8b74
--- /dev/null
@@ -0,0 +1,45 @@
+/*
+ *  linux/lib/vsprintf.c
+ *
+ *  Copyright (C) 1991, 1992  Linus Torvalds
+ */
+
+/* vsprintf.c -- Lars Wirzenius & Linus Torvalds. */
+/*
+ * Wirzenius wrote this portably, Torvalds fucked it up :-)
+ */
+
+#include <common.h>
+#if !defined(CONFIG_PANIC_HANG)
+#include <command.h>
+#endif
+
+static void panic_finish(void) __attribute__ ((noreturn));
+
+static void panic_finish(void)
+{
+       putc('\n');
+#if defined(CONFIG_PANIC_HANG)
+       hang();
+#else
+       udelay(100000); /* allow messages to go out */
+       do_reset(NULL, 0, 0, NULL);
+#endif
+       while (1)
+               ;
+}
+
+void panic_str(const char *str)
+{
+       puts(str);
+       panic_finish();
+}
+
+void panic(const char *fmt, ...)
+{
+       va_list args;
+       va_start(args, fmt);
+       vprintf(fmt, args);
+       va_end(args);
+       panic_finish();
+}
diff --git a/lib/strto.c b/lib/strto.c
new file mode 100644 (file)
index 0000000..a6c0157
--- /dev/null
@@ -0,0 +1,174 @@
+/*
+ *  linux/lib/vsprintf.c
+ *
+ *  Copyright (C) 1991, 1992  Linus Torvalds
+ */
+
+/* vsprintf.c -- Lars Wirzenius & Linus Torvalds. */
+/*
+ * Wirzenius wrote this portably, Torvalds fucked it up :-)
+ */
+
+#include <common.h>
+#include <errno.h>
+#include <linux/ctype.h>
+
+unsigned long simple_strtoul(const char *cp, char **endp,
+                               unsigned int base)
+{
+       unsigned long result = 0;
+       unsigned long value;
+
+       if (*cp == '0') {
+               cp++;
+               if ((*cp == 'x') && isxdigit(cp[1])) {
+                       base = 16;
+                       cp++;
+               }
+
+               if (!base)
+                       base = 8;
+       }
+
+       if (!base)
+               base = 10;
+
+       while (isxdigit(*cp) && (value = isdigit(*cp) ? *cp-'0' : (islower(*cp)
+           ? toupper(*cp) : *cp)-'A'+10) < base) {
+               result = result*base + value;
+               cp++;
+       }
+
+       if (endp)
+               *endp = (char *)cp;
+
+       return result;
+}
+
+int strict_strtoul(const char *cp, unsigned int base, unsigned long *res)
+{
+       char *tail;
+       unsigned long val;
+       size_t len;
+
+       *res = 0;
+       len = strlen(cp);
+       if (len == 0)
+               return -EINVAL;
+
+       val = simple_strtoul(cp, &tail, base);
+       if (tail == cp)
+               return -EINVAL;
+
+       if ((*tail == '\0') ||
+               ((len == (size_t)(tail - cp) + 1) && (*tail == '\n'))) {
+               *res = val;
+               return 0;
+       }
+
+       return -EINVAL;
+}
+
+long simple_strtol(const char *cp, char **endp, unsigned int base)
+{
+       if (*cp == '-')
+               return -simple_strtoul(cp + 1, endp, base);
+
+       return simple_strtoul(cp, endp, base);
+}
+
+unsigned long ustrtoul(const char *cp, char **endp, unsigned int base)
+{
+       unsigned long result = simple_strtoul(cp, endp, base);
+       switch (**endp) {
+       case 'G':
+               result *= 1024;
+               /* fall through */
+       case 'M':
+               result *= 1024;
+               /* fall through */
+       case 'K':
+       case 'k':
+               result *= 1024;
+               if ((*endp)[1] == 'i') {
+                       if ((*endp)[2] == 'B')
+                               (*endp) += 3;
+                       else
+                               (*endp) += 2;
+               }
+       }
+       return result;
+}
+
+unsigned long long ustrtoull(const char *cp, char **endp, unsigned int base)
+{
+       unsigned long long result = simple_strtoull(cp, endp, base);
+       switch (**endp) {
+       case 'G':
+               result *= 1024;
+               /* fall through */
+       case 'M':
+               result *= 1024;
+               /* fall through */
+       case 'K':
+       case 'k':
+               result *= 1024;
+               if ((*endp)[1] == 'i') {
+                       if ((*endp)[2] == 'B')
+                               (*endp) += 3;
+                       else
+                               (*endp) += 2;
+               }
+       }
+       return result;
+}
+
+unsigned long long simple_strtoull(const char *cp, char **endp,
+                                       unsigned int base)
+{
+       unsigned long long result = 0, value;
+
+       if (*cp == '0') {
+               cp++;
+               if ((*cp == 'x') && isxdigit(cp[1])) {
+                       base = 16;
+                       cp++;
+               }
+
+               if (!base)
+                       base = 8;
+       }
+
+       if (!base)
+               base = 10;
+
+       while (isxdigit(*cp) && (value = isdigit(*cp) ? *cp - '0'
+               : (islower(*cp) ? toupper(*cp) : *cp) - 'A' + 10) < base) {
+               result = result * base + value;
+               cp++;
+       }
+
+       if (endp)
+               *endp = (char *) cp;
+
+       return result;
+}
+
+long trailing_strtoln(const char *str, const char *end)
+{
+       const char *p;
+
+       if (!end)
+               end = str + strlen(str);
+       for (p = end - 1; p > str; p--) {
+               if (!isdigit(*p))
+                       return simple_strtoul(p + 1, NULL, 10);
+       }
+
+       return -1;
+}
+
+long trailing_strtol(const char *str)
+{
+       return trailing_strtoln(str, NULL);
+}
index 6766a8f1c8b648a201f430b15116dbf69c8a096e..403b134cd11222c493df68ab027cb085124ae681 100644 (file)
@@ -40,17 +40,14 @@ static void div_out(unsigned int *num, unsigned int div)
                out_dgt(dgt);
 }
 
-int printf(const char *fmt, ...)
+int vprintf(const char *fmt, va_list va)
 {
-       va_list va;
        char ch;
        char *p;
        unsigned int num;
        char buf[12];
        unsigned int div;
 
-       va_start(va, fmt);
-
        while ((ch = *(fmt++))) {
                if (ch != '%') {
                        putc(ch);
@@ -117,6 +114,17 @@ int printf(const char *fmt, ...)
        }
 
 abort:
-       va_end(va);
        return 0;
 }
+
+int printf(const char *fmt, ...)
+{
+       va_list va;
+       int ret;
+
+       va_start(va, fmt);
+       ret = vprintf(fmt, va);
+       va_end(va);
+
+       return ret;
+}
index dd8380b418c932ca0e0d2e8b80248d213ee047da..24167a135c020b9629181bb01c369e762d293d80 100644 (file)
 #include <linux/types.h>
 #include <linux/string.h>
 #include <linux/ctype.h>
-#include <errno.h>
 
 #include <common.h>
-#if !defined(CONFIG_PANIC_HANG)
-#include <command.h>
-#endif
 
 #include <div64.h>
 #define noinline __attribute__((noinline))
 
-unsigned long simple_strtoul(const char *cp, char **endp,
-                               unsigned int base)
-{
-       unsigned long result = 0;
-       unsigned long value;
-
-       if (*cp == '0') {
-               cp++;
-               if ((*cp == 'x') && isxdigit(cp[1])) {
-                       base = 16;
-                       cp++;
-               }
-
-               if (!base)
-                       base = 8;
-       }
-
-       if (!base)
-               base = 10;
-
-       while (isxdigit(*cp) && (value = isdigit(*cp) ? *cp-'0' : (islower(*cp)
-           ? toupper(*cp) : *cp)-'A'+10) < base) {
-               result = result*base + value;
-               cp++;
-       }
-
-       if (endp)
-               *endp = (char *)cp;
-
-       return result;
-}
-
-int strict_strtoul(const char *cp, unsigned int base, unsigned long *res)
-{
-       char *tail;
-       unsigned long val;
-       size_t len;
-
-       *res = 0;
-       len = strlen(cp);
-       if (len == 0)
-               return -EINVAL;
-
-       val = simple_strtoul(cp, &tail, base);
-       if (tail == cp)
-               return -EINVAL;
-
-       if ((*tail == '\0') ||
-               ((len == (size_t)(tail - cp) + 1) && (*tail == '\n'))) {
-               *res = val;
-               return 0;
-       }
-
-       return -EINVAL;
-}
-
-long simple_strtol(const char *cp, char **endp, unsigned int base)
-{
-       if (*cp == '-')
-               return -simple_strtoul(cp + 1, endp, base);
-
-       return simple_strtoul(cp, endp, base);
-}
-
-unsigned long ustrtoul(const char *cp, char **endp, unsigned int base)
-{
-       unsigned long result = simple_strtoul(cp, endp, base);
-       switch (**endp) {
-       case 'G':
-               result *= 1024;
-               /* fall through */
-       case 'M':
-               result *= 1024;
-               /* fall through */
-       case 'K':
-       case 'k':
-               result *= 1024;
-               if ((*endp)[1] == 'i') {
-                       if ((*endp)[2] == 'B')
-                               (*endp) += 3;
-                       else
-                               (*endp) += 2;
-               }
-       }
-       return result;
-}
-
-unsigned long long ustrtoull(const char *cp, char **endp, unsigned int base)
-{
-       unsigned long long result = simple_strtoull(cp, endp, base);
-       switch (**endp) {
-       case 'G':
-               result *= 1024;
-               /* fall through */
-       case 'M':
-               result *= 1024;
-               /* fall through */
-       case 'K':
-       case 'k':
-               result *= 1024;
-               if ((*endp)[1] == 'i') {
-                       if ((*endp)[2] == 'B')
-                               (*endp) += 3;
-                       else
-                               (*endp) += 2;
-               }
-       }
-       return result;
-}
-
-unsigned long long simple_strtoull(const char *cp, char **endp,
-                                       unsigned int base)
-{
-       unsigned long long result = 0, value;
-
-       if (*cp == '0') {
-               cp++;
-               if ((*cp == 'x') && isxdigit(cp[1])) {
-                       base = 16;
-                       cp++;
-               }
-
-               if (!base)
-                       base = 8;
-       }
-
-       if (!base)
-               base = 10;
-
-       while (isxdigit(*cp) && (value = isdigit(*cp) ? *cp - '0'
-               : (islower(*cp) ? toupper(*cp) : *cp) - 'A' + 10) < base) {
-               result = result * base + value;
-               cp++;
-       }
-
-       if (endp)
-               *endp = (char *) cp;
-
-       return result;
-}
-
-long trailing_strtoln(const char *str, const char *end)
-{
-       const char *p;
-
-       if (!end)
-               end = str + strlen(str);
-       for (p = end - 1; p > str; p--) {
-               if (!isdigit(*p))
-                       return simple_strtoul(p + 1, NULL, 10);
-       }
-
-       return -1;
-}
-
-long trailing_strtol(const char *str)
-{
-       return trailing_strtoln(str, NULL);
-}
-
 /* we use this so that we can do without the ctype library */
 #define is_digit(c)    ((c) >= '0' && (c) <= '9')
 
@@ -897,35 +733,6 @@ int vprintf(const char *fmt, va_list args)
        return i;
 }
 
-static void panic_finish(void) __attribute__ ((noreturn));
-
-static void panic_finish(void)
-{
-       putc('\n');
-#if defined(CONFIG_PANIC_HANG)
-       hang();
-#else
-       udelay(100000); /* allow messages to go out */
-       do_reset(NULL, 0, 0, NULL);
-#endif
-       while (1)
-               ;
-}
-
-void panic_str(const char *str)
-{
-       puts(str);
-       panic_finish();
-}
-
-void panic(const char *fmt, ...)
-{
-       va_list args;
-       va_start(args, fmt);
-       vprintf(fmt, args);
-       va_end(args);
-       panic_finish();
-}
 
 void __assert_fail(const char *assertion, const char *file, unsigned line,
                   const char *function)
index 7b4cd3f538f2f7f36cd82a7259e8c480bfc4802c..9cfd80b67095d449812d4341446cbf488b93ca0d 100644 (file)
@@ -64,7 +64,7 @@ RSA_OBJS-$(CONFIG_FIT_SIGNATURE) := $(addprefix lib/rsa/, \
                                        rsa-sign.o rsa-verify.o rsa-checksum.o \
                                        rsa-mod-exp.o)
 
-ROCKCHIP_OBS = $(if $(CONFIG_ARCH_ROCKCHIP),lib/rc4.o rkcommon.o rkimage.o rksd.o,)
+ROCKCHIP_OBS = lib/rc4.o rkcommon.o rkimage.o rksd.o
 
 # common objs for dumpimage and mkimage
 dumpimage-mkimage-objs := aisimage.o \
@@ -109,12 +109,6 @@ fit_check_sign-objs   := $(dumpimage-mkimage-objs) fit_check_sign.o
 
 # TODO(sjg@chromium.org): Is this correct on Mac OS?
 
-ifneq ($(CONFIG_ARCH_ROCKCHIP),)
-HOST_EXTRACFLAGS += \
-               -DCONFIG_ROCKCHIP_MAX_SPL_SIZE=$(CONFIG_ROCKCHIP_MAX_SPL_SIZE) \
-               -DCONFIG_ROCKCHIP_SPL_HDR="\"$(CONFIG_ROCKCHIP_SPL_HDR)\""
-endif
-
 ifneq ($(CONFIG_MX23)$(CONFIG_MX28),)
 # Add CONFIG_MXS into host CFLAGS, so we can check whether or not register
 # the mxsimage support within tools/mxsimage.c .
index 249c86262df86d63d9b5a9cfa7cf7006af031516..72621fd095c69b69e7db9878b17b5bac30e8636b 100644 (file)
@@ -40,16 +40,84 @@ struct header0_info {
        uint8_t reserved2[2];
 };
 
+/**
+ * struct spl_info - spl info for each chip
+ *
+ * @imagename:         Image name(passed by "mkimage -n")
+ * @spl_hdr:           Boot ROM requires a 4-bytes spl header
+ * @spl_size:          Spl size(include extra 4-bytes spl header)
+ */
+struct spl_info {
+       const char *imagename;
+       const char *spl_hdr;
+       const uint32_t spl_size;
+};
+
+static struct spl_info spl_infos[] = {
+       { "rk3036", "RK30", 0x1000 },
+       { "rk3288", "RK32", 0x8000 },
+};
+
 static unsigned char rc4_key[16] = {
        124, 78, 3, 4, 85, 5, 9, 7,
        45, 44, 123, 56, 23, 13, 23, 17
 };
 
-int rkcommon_set_header(void *buf, uint file_size)
+static struct spl_info *rkcommon_get_spl_info(char *imagename)
+{
+       int i;
+
+       for (i = 0; i < ARRAY_SIZE(spl_infos); i++)
+               if (!strncmp(imagename, spl_infos[i].imagename, 6))
+                       return spl_infos + i;
+
+       return NULL;
+}
+
+int rkcommon_check_params(struct image_tool_params *params)
+{
+       int i;
+
+       if (rkcommon_get_spl_info(params->imagename) != NULL)
+               return 0;
+
+       fprintf(stderr, "ERROR: imagename (%s) is not supported!\n",
+               strlen(params->imagename) > 0 ? params->imagename : "NULL");
+
+       fprintf(stderr, "Available imagename:");
+       for (i = 0; i < ARRAY_SIZE(spl_infos); i++)
+               fprintf(stderr, "\t%s", spl_infos[i].imagename);
+       fprintf(stderr, "\n");
+
+       return -1;
+}
+
+const char *rkcommon_get_spl_hdr(struct image_tool_params *params)
+{
+       struct spl_info *info = rkcommon_get_spl_info(params->imagename);
+
+       /*
+        * info would not be NULL, because of we checked params before.
+        */
+       return info->spl_hdr;
+}
+
+int rkcommon_get_spl_size(struct image_tool_params *params)
+{
+       struct spl_info *info = rkcommon_get_spl_info(params->imagename);
+
+       /*
+        * info would not be NULL, because of we checked params before.
+        */
+       return info->spl_size;
+}
+
+int rkcommon_set_header(void *buf, uint file_size,
+                       struct image_tool_params *params)
 {
        struct header0_info *hdr;
 
-       if (file_size > CONFIG_ROCKCHIP_MAX_SPL_SIZE)
+       if (file_size > rkcommon_get_spl_size(params))
                return -ENOSPC;
 
        memset(buf,  '\0', RK_INIT_OFFSET * RK_BLK_SIZE);
index 0fc1e96409b8ee630664554f81a236861793f722..c69540f5f38a35cab4bd9566af073716175e2139 100644 (file)
@@ -12,8 +12,37 @@ enum {
        RK_BLK_SIZE             = 512,
        RK_INIT_OFFSET          = 4,
        RK_MAX_BOOT_SIZE        = 512 << 10,
+       RK_SPL_HDR_START        = RK_INIT_OFFSET * RK_BLK_SIZE,
+       RK_SPL_HDR_SIZE         = 4,
+       RK_SPL_START            = RK_SPL_HDR_START + RK_SPL_HDR_SIZE,
+       RK_IMAGE_HEADER_LEN     = RK_SPL_START,
 };
 
+/**
+ * rkcommon_check_params() - check params
+ *
+ * @return 0 if OK, -1 if ERROR.
+ */
+int rkcommon_check_params(struct image_tool_params *params);
+
+/**
+ * rkcommon_get_spl_hdr() - get 4-bytes spl hdr for a Rockchip boot image
+ *
+ * Rockchip's bootrom requires the spl loader to start with a 4-bytes
+ * header. The content of this header depends on the chip type.
+ */
+const char *rkcommon_get_spl_hdr(struct image_tool_params *params);
+
+/**
+ * rkcommon_get_spl_size() - get spl size for a Rockchip boot image
+ *
+ * Different chip may have different sram size. And if we want to jump
+ * back to the bootrom after spl, we may need to reserve some sram space
+ * for the bootrom.
+ * The spl loader size should be sram size minus reserved size(if needed)
+ */
+int rkcommon_get_spl_size(struct image_tool_params *params);
+
 /**
  * rkcommon_set_header() - set up the header for a Rockchip boot image
  *
@@ -23,6 +52,7 @@ enum {
  * @file_size: Size of the file we want the boot ROM to load, in bytes
  * @return 0 if OK, -ENOSPC if too large
  */
-int rkcommon_set_header(void *buf, uint file_size);
+int rkcommon_set_header(void *buf, uint file_size,
+                       struct image_tool_params *params);
 
 #endif
index 73634e316bc7ff1955707b7ab421b4adf4010eca..f9fdcfa712f00496a88404a0181f783b158859fa 100644 (file)
@@ -9,6 +9,7 @@
 
 #include "imagetool.h"
 #include <image.h>
+#include "rkcommon.h"
 
 static uint32_t header;
 
@@ -30,7 +31,8 @@ static void rkimage_print_header(const void *buf)
 static void rkimage_set_header(void *buf, struct stat *sbuf, int ifd,
                               struct image_tool_params *params)
 {
-       memcpy(buf, CONFIG_ROCKCHIP_SPL_HDR, 4);
+       memcpy(buf + RK_SPL_HDR_START, rkcommon_get_spl_hdr(params),
+              RK_SPL_HDR_SIZE);
 }
 
 static int rkimage_extract_subimage(void *buf, struct image_tool_params *params)
index f660d562a8ee5e466cc2fd3808c5a61eeebe0d8b..a2baa74d3121168503f65ea56ee3b3a9a0b16f68 100644 (file)
 #include "mkimage.h"
 #include "rkcommon.h"
 
-enum {
-       RKSD_SPL_HDR_START      = RK_INIT_OFFSET * RK_BLK_SIZE,
-       RKSD_SPL_START          = RKSD_SPL_HDR_START + 4,
-       RKSD_HEADER_LEN         = RKSD_SPL_START,
-};
-
-static char dummy_hdr[RKSD_HEADER_LEN];
-
-static int rksd_check_params(struct image_tool_params *params)
-{
-       return 0;
-}
+static char dummy_hdr[RK_IMAGE_HEADER_LEN];
 
 static int rksd_verify_header(unsigned char *buf,  int size,
                                 struct image_tool_params *params)
@@ -42,15 +31,16 @@ static void rksd_set_header(void *buf,  struct stat *sbuf,  int ifd,
        unsigned int size;
        int ret;
 
-       size = params->file_size - RKSD_SPL_HDR_START;
-       ret = rkcommon_set_header(buf, size);
+       size = params->file_size - RK_SPL_HDR_START;
+       ret = rkcommon_set_header(buf, size, params);
        if (ret) {
                /* TODO(sjg@chromium.org): This method should return an error */
                printf("Warning: SPL image is too large (size %#x) and will not boot\n",
                       size);
        }
 
-       memcpy(buf + RKSD_SPL_HDR_START, CONFIG_ROCKCHIP_SPL_HDR, 4);
+       memcpy(buf + RK_SPL_HDR_START, rkcommon_get_spl_hdr(params),
+              RK_SPL_HDR_SIZE);
 }
 
 static int rksd_extract_subimage(void *buf,  struct image_tool_params *params)
@@ -72,7 +62,7 @@ static int rksd_vrec_header(struct image_tool_params *params,
 {
        int pad_size;
 
-       pad_size = RKSD_SPL_HDR_START + CONFIG_ROCKCHIP_MAX_SPL_SIZE;
+       pad_size = RK_SPL_HDR_START + rkcommon_get_spl_size(params);
        debug("pad_size %x\n", pad_size);
 
        return pad_size - params->file_size;
@@ -84,9 +74,9 @@ static int rksd_vrec_header(struct image_tool_params *params,
 U_BOOT_IMAGE_TYPE(
        rksd,
        "Rockchip SD Boot Image support",
-       RKSD_HEADER_LEN,
+       RK_IMAGE_HEADER_LEN,
        dummy_hdr,
-       rksd_check_params,
+       rkcommon_check_params,
        rksd_verify_header,
        rksd_print_header,
        rksd_set_header,
index 69a12f02e29a3448e886cb78c07deb87fb41df0f..800e235168ff5d041469c4c57bc0b5a7c44bc781 100644 (file)
 #include "rkcommon.h"
 
 enum {
-       RKSPI_SPL_HDR_START     = RK_INIT_OFFSET * RK_BLK_SIZE,
-       RKSPI_SPL_START         = RKSPI_SPL_HDR_START + 4,
-       RKSPI_HEADER_LEN        = RKSPI_SPL_START,
        RKSPI_SECT_LEN          = RK_BLK_SIZE * 4,
 };
 
-static char dummy_hdr[RKSPI_HEADER_LEN];
-
-static int rkspi_check_params(struct image_tool_params *params)
-{
-       return 0;
-}
+static char dummy_hdr[RK_IMAGE_HEADER_LEN];
 
 static int rkspi_verify_header(unsigned char *buf, int size,
                               struct image_tool_params *params)
@@ -45,7 +37,7 @@ static void rkspi_set_header(void *buf, struct stat *sbuf, int ifd,
        int ret;
 
        size = params->orig_file_size;
-       ret = rkcommon_set_header(buf, size);
+       ret = rkcommon_set_header(buf, size, params);
        debug("size %x\n", size);
        if (ret) {
                /* TODO(sjg@chromium.org): This method should return an error */
@@ -53,7 +45,8 @@ static void rkspi_set_header(void *buf, struct stat *sbuf, int ifd,
                       size);
        }
 
-       memcpy(buf + RKSPI_SPL_HDR_START, CONFIG_ROCKCHIP_SPL_HDR, 4);
+       memcpy(buf + RK_SPL_HDR_START, rkcommon_get_spl_hdr(params),
+              RK_SPL_HDR_SIZE);
 
        /*
         * Spread the image out so we only use the first 2KB of each 4KB
@@ -89,12 +82,12 @@ static int rkspi_vrec_header(struct image_tool_params *params,
 {
        int pad_size;
 
-       pad_size = (CONFIG_ROCKCHIP_MAX_SPL_SIZE + 0x7ff) / 0x800 * 0x800;
+       pad_size = (rkcommon_get_spl_size(params) + 0x7ff) / 0x800 * 0x800;
        params->orig_file_size = pad_size;
 
        /* We will double the image size due to the SPI format */
        pad_size *= 2;
-       pad_size += RKSPI_SPL_HDR_START;
+       pad_size += RK_SPL_HDR_START;
        debug("pad_size %x\n", pad_size);
 
        return pad_size - params->file_size;
@@ -106,9 +99,9 @@ static int rkspi_vrec_header(struct image_tool_params *params,
 U_BOOT_IMAGE_TYPE(
        rkspi,
        "Rockchip SPI Boot Image support",
-       RKSPI_HEADER_LEN,
+       RK_IMAGE_HEADER_LEN,
        dummy_hdr,
-       rkspi_check_params,
+       rkcommon_check_params,
        rkspi_verify_header,
        rkspi_print_header,
        rkspi_set_header,