diff --git a/README b/README index 88ff837d7c..d881da2de2 100644 --- a/README +++ b/README @@ -3487,6 +3487,10 @@ FIT uImage format: consider that a completely unreadable NAND block is bad, and thus should be skipped silently. + CONFIG_SPL_ABORT_ON_RAW_IMAGE + When defined, SPL will proceed to another boot method + if the image it has loaded does not have a signature. + CONFIG_SPL_RELOC_STACK Adress of the start of the stack SPL will use after relocation. If unspecified, this is equal to diff --git a/arch/arm/cpu/armv7/mx7/clock_slice.c b/arch/arm/cpu/armv7/mx7/clock_slice.c index ad5d504d28..1665df92ad 100644 --- a/arch/arm/cpu/armv7/mx7/clock_slice.c +++ b/arch/arm/cpu/armv7/mx7/clock_slice.c @@ -55,7 +55,7 @@ static struct clk_root_map root_array[] = { PLL_ENET_MAIN_250M_CLK, PLL_AUDIO_MAIN_CLK} }, {AHB_CLK_ROOT, CCM_AHB_CHANNEL, - {OSC_24M_CLK, PLL_SYS_PFD2_135M_CLK, PLL_DRAM_MAIN_533M_CLK, + {OSC_24M_CLK, PLL_SYS_PFD2_270M_CLK, PLL_DRAM_MAIN_533M_CLK, PLL_SYS_PFD0_392M_CLK, PLL_ENET_MAIN_125M_CLK, PLL_USB_MAIN_480M_CLK, PLL_AUDIO_MAIN_CLK, PLL_VIDEO_MAIN_CLK} }, diff --git a/arch/arm/imx-common/cpu.c b/arch/arm/imx-common/cpu.c index 5fb3ed840f..4223187261 100644 --- a/arch/arm/imx-common/cpu.c +++ b/arch/arm/imx-common/cpu.c @@ -138,7 +138,7 @@ const char *get_imx_type(u32 imxtype) { switch (imxtype) { case MXC_CPU_MX7S: - return "7SOLO"; /* Single-core version of the mx7 */ + return "7S"; /* Single-core version of the mx7 */ case MXC_CPU_MX7D: return "7D"; /* Dual-core version of the mx7 */ case MXC_CPU_MX6QP: diff --git a/arch/arm/include/asm/arch-mx6/mx6sl_pins.h b/arch/arm/include/asm/arch-mx6/mx6sl_pins.h index 6ba1034b2e..919d83dd90 100644 --- a/arch/arm/include/asm/arch-mx6/mx6sl_pins.h +++ b/arch/arm/include/asm/arch-mx6/mx6sl_pins.h @@ -22,6 +22,7 @@ enum { MX6_PAD_SD1_DAT3__USDHC1_DAT3 = IOMUX_PAD(0x0548, 0x0240, 0, 0x0000, 0, 0), MX6_PAD_SD1_DAT4__USDHC1_DAT4 = IOMUX_PAD(0x054C, 0x0244, 0, 0x0000, 0, 0), MX6_PAD_SD1_DAT5__USDHC1_DAT5 = IOMUX_PAD(0x0550, 0x0248, 0, 0x0000, 0, 0), + MX6_PAD_SD1_DAT5__GPIO_5_9 = IOMUX_PAD(0x0550, 0x0248, 5, 0x0000, 0, 0), MX6_PAD_SD1_DAT6__USDHC1_DAT6 = IOMUX_PAD(0x0554, 0x024C, 0, 0x0000, 0, 0), MX6_PAD_SD1_DAT7__USDHC1_DAT7 = IOMUX_PAD(0x0558, 0x0250, 0, 0x0000, 0, 0), MX6_PAD_KEY_ROW7__GPIO_4_7 = IOMUX_PAD(0x04B0, 0x01A8, 5, 0x0000, 0, 0), diff --git a/arch/arm/include/asm/arch-mx7/mx7d_pins.h b/arch/arm/include/asm/arch-mx7/mx7d_pins.h index d8b4097262..0ab1246de8 100644 --- a/arch/arm/include/asm/arch-mx7/mx7d_pins.h +++ b/arch/arm/include/asm/arch-mx7/mx7d_pins.h @@ -635,7 +635,7 @@ enum { MX7D_PAD_LCD_DATA23__GPIO3_IO28 = IOMUX_PAD(0x0394, 0x0124, 5, 0x0000, 0, 0), MX7D_PAD_LCD_DATA23__I2C4_SDA = IOMUX_PAD(0x0394, 0x0124, IOMUX_CONFIG_SION | 6, 0x05F0, 1, 0), - MX7D_PAD_UART1_RX_DATA__UART1_DCE_RX = IOMUX_PAD(0x0398, 0x0128, 0, 0x0000, 0, 0), + MX7D_PAD_UART1_RX_DATA__UART1_DCE_RX = IOMUX_PAD(0x0398, 0x0128, 0, 0x06F4, 0, 0), MX7D_PAD_UART1_RX_DATA__UART1_DTE_TX = IOMUX_PAD(0x0398, 0x0128, 0, 0x0000, 0, 0), MX7D_PAD_UART1_RX_DATA__I2C1_SCL = IOMUX_PAD(0x0398, 0x0128, IOMUX_CONFIG_SION | 1, 0x0000, 0, 0), @@ -655,7 +655,7 @@ enum { MX7D_PAD_UART1_TX_DATA__GPIO4_IO1 = IOMUX_PAD(0x039C, 0x012C, 5, 0x0000, 0, 0), MX7D_PAD_UART1_TX_DATA__ENET1_MDC = IOMUX_PAD(0x039C, 0x012C, 6, 0x0000, 0, 0), - MX7D_PAD_UART2_RX_DATA__UART2_DCE_RX = IOMUX_PAD(0x03A0, 0x0130, 0, 0x0000, 0, 0), + MX7D_PAD_UART2_RX_DATA__UART2_DCE_RX = IOMUX_PAD(0x03A0, 0x0130, 0, 0x06FC, 2, 0), MX7D_PAD_UART2_RX_DATA__UART2_DTE_TX = IOMUX_PAD(0x03A0, 0x0130, 0, 0x0000, 0, 0), MX7D_PAD_UART2_RX_DATA__I2C2_SCL = IOMUX_PAD(0x03A0, 0x0130, IOMUX_CONFIG_SION | 1, 0x0000, 0, 0), @@ -667,7 +667,7 @@ enum { MX7D_PAD_UART2_TX_DATA__UART2_DCE_TX = IOMUX_PAD(0x03A4, 0x0134, 0, 0x0000, 0, 0), - MX7D_PAD_UART2_TX_DATA__UART2_DTE_RX = IOMUX_PAD(0x03A4, 0x0134, 0, 0x0000, 0, 0), + MX7D_PAD_UART2_TX_DATA__UART2_DTE_RX = IOMUX_PAD(0x03A4, 0x0134, 0, 0x06FC, 3, 0), MX7D_PAD_UART2_TX_DATA__I2C2_SDA = IOMUX_PAD(0x03A4, 0x0134, IOMUX_CONFIG_SION | 1, 0x05E0, 0, 0), MX7D_PAD_UART2_TX_DATA__SAI3_RX_DATA0 = IOMUX_PAD(0x03A4, 0x0134, 2, 0x06C8, 0, 0), MX7D_PAD_UART2_TX_DATA__ECSPI1_RDY = IOMUX_PAD(0x03A4, 0x0134, 3, 0x0000, 0, 0), @@ -695,7 +695,7 @@ enum { MX7D_PAD_UART3_TX_DATA__GPIO4_IO5 = IOMUX_PAD(0x03AC, 0x013C, 5, 0x0000, 0, 0), MX7D_PAD_UART3_TX_DATA__SD2_LCTL = IOMUX_PAD(0x03AC, 0x013C, 6, 0x0000, 0, 0), - MX7D_PAD_UART3_RTS_B__UART3_DCE_RTS = IOMUX_PAD(0x03B0, 0x0140, 0, 0x0000, 0, 0), + MX7D_PAD_UART3_RTS_B__UART3_DCE_RTS = IOMUX_PAD(0x03B0, 0x0140, 0, 0x0700, 2, 0), MX7D_PAD_UART3_RTS_B__UART3_DTE_CTS = IOMUX_PAD(0x03B0, 0x0140, 0, 0x0000, 0, 0), MX7D_PAD_UART3_RTS_B__USB_OTG2_OC = IOMUX_PAD(0x03B0, 0x0140, 1, 0x0000, 0, 0), diff --git a/common/spl/spl.c b/common/spl/spl.c index 82e7f58e80..93f9bd13fc 100644 --- a/common/spl/spl.c +++ b/common/spl/spl.c @@ -73,7 +73,7 @@ void spl_set_header_raw_uboot(void) spl_image.name = "U-Boot"; } -void spl_parse_image_header(const struct image_header *header) +int spl_parse_image_header(const struct image_header *header) { u32 header_size = sizeof(struct image_header); @@ -111,6 +111,9 @@ void spl_parse_image_header(const struct image_header *header) * is bad, and thus should be skipped silently. */ panic("** no mkimage signature but raw image not supported"); +#elif defined(CONFIG_SPL_ABORT_ON_RAW_IMAGE) + /* Signature not found, proceed to other boot methods. */ + return -EINVAL; #else /* Signature not found - assume u-boot.bin */ debug("mkimage signature not found - ih_magic = %x\n", @@ -118,6 +121,7 @@ void spl_parse_image_header(const struct image_header *header) spl_set_header_raw_uboot(); #endif } + return 0; } __weak void __noreturn jump_to_image_no_args(struct spl_image_info *spl_image) diff --git a/common/spl/spl_ext.c b/common/spl/spl_ext.c index b77dbf4d0c..ade5496600 100644 --- a/common/spl/spl_ext.c +++ b/common/spl/spl_ext.c @@ -48,7 +48,11 @@ int spl_load_image_ext(struct blk_desc *block_dev, goto end; } - spl_parse_image_header(header); + err = spl_parse_image_header(header); + if (err < 0) { + puts("spl: ext4fs_read failed\n"); + goto end; + } err = ext4fs_read((char *)spl_image.load_addr, filelen, &actlen); diff --git a/common/spl/spl_fat.c b/common/spl/spl_fat.c index d761b264c1..338ea2f092 100644 --- a/common/spl/spl_fat.c +++ b/common/spl/spl_fat.c @@ -57,7 +57,9 @@ int spl_load_image_fat(struct blk_desc *block_dev, if (err <= 0) goto end; - spl_parse_image_header(header); + err = spl_parse_image_header(header); + if (err <= 0) + goto end; err = file_fat_read(filename, (u8 *)spl_image.load_addr, 0); diff --git a/common/spl/spl_mmc.c b/common/spl/spl_mmc.c index 8d588d13a3..360c754050 100644 --- a/common/spl/spl_mmc.c +++ b/common/spl/spl_mmc.c @@ -23,8 +23,12 @@ static int mmc_load_legacy(struct mmc *mmc, ulong sector, { u32 image_size_sectors; unsigned long count; + int ret; + + ret = spl_parse_image_header(header); + if (ret) + return ret; - spl_parse_image_header(header); /* convert size to sectors - round up */ image_size_sectors = (spl_image.size + mmc->read_bl_len - 1) / mmc->read_bl_len; diff --git a/common/spl/spl_nand.c b/common/spl/spl_nand.c index 79388ff326..bbd9546987 100644 --- a/common/spl/spl_nand.c +++ b/common/spl/spl_nand.c @@ -32,7 +32,10 @@ static int spl_nand_load_element(int offset, struct image_header *header) if (err) return err; - spl_parse_image_header(header); + err = spl_parse_image_header(header); + if (err) + return err; + return nand_spl_load_image(offset, spl_image.size, (void *)(unsigned long)spl_image.load_addr); } @@ -77,7 +80,9 @@ int spl_nand_load_image(void) /* load linux */ nand_spl_load_image(CONFIG_SYS_NAND_SPL_KERNEL_OFFS, sizeof(*header), (void *)header); - spl_parse_image_header(header); + err = spl_parse_image_header(header); + if (err) + return err; if (header->ih_os == IH_OS_LINUX) { /* happy - was a linux */ err = nand_spl_load_image( diff --git a/common/spl/spl_net.c b/common/spl/spl_net.c index 63b20d8200..ae71d26f0a 100644 --- a/common/spl/spl_net.c +++ b/common/spl/spl_net.c @@ -34,7 +34,5 @@ int spl_net_load_image(const char *device) printf("Problem booting with BOOTP\n"); return rv; } - spl_parse_image_header((struct image_header *)load_addr); - - return 0; + return spl_parse_image_header((struct image_header *)load_addr); } diff --git a/common/spl/spl_nor.c b/common/spl/spl_nor.c index d0bd0b0533..da2422f305 100644 --- a/common/spl/spl_nor.c +++ b/common/spl/spl_nor.c @@ -9,6 +9,7 @@ int spl_nor_load_image(void) { + int ret; /* * Loading of the payload to SDRAM is done with skipping of * the mkimage header in this SPL NOR driver @@ -28,7 +29,9 @@ int spl_nor_load_image(void) if (image_get_os(header) == IH_OS_LINUX) { /* happy - was a Linux */ - spl_parse_image_header(header); + ret = spl_parse_image_header(header); + if (ret) + return ret; memcpy((void *)spl_image.load_addr, (void *)(CONFIG_SYS_OS_BASE + @@ -56,8 +59,10 @@ int spl_nor_load_image(void) * Load real U-Boot from its location in NOR flash to its * defined location in SDRAM */ - spl_parse_image_header( + ret = spl_parse_image_header( (const struct image_header *)CONFIG_SYS_UBOOT_BASE); + if (ret) + return ret; memcpy((void *)(unsigned long)spl_image.load_addr, (void *)(CONFIG_SYS_UBOOT_BASE + sizeof(struct image_header)), diff --git a/common/spl/spl_onenand.c b/common/spl/spl_onenand.c index af7d82eb62..1a28a84e44 100644 --- a/common/spl/spl_onenand.c +++ b/common/spl/spl_onenand.c @@ -17,6 +17,7 @@ int spl_onenand_load_image(void) { struct image_header *header; + int ret; debug("spl: onenand\n"); @@ -25,7 +26,9 @@ int spl_onenand_load_image(void) /* Load u-boot */ onenand_spl_load_image(CONFIG_SYS_ONENAND_U_BOOT_OFFS, CONFIG_SYS_ONENAND_PAGE_SIZE, (void *)header); - spl_parse_image_header(header); + ret = spl_parse_image_header(header); + if (ret) + return ret; onenand_spl_load_image(CONFIG_SYS_ONENAND_U_BOOT_OFFS, spl_image.size, (void *)spl_image.load_addr); diff --git a/common/spl/spl_ymodem.c b/common/spl/spl_ymodem.c index 380d8ddf52..4f26ea5d21 100644 --- a/common/spl/spl_ymodem.c +++ b/common/spl/spl_ymodem.c @@ -40,8 +40,11 @@ int spl_ymodem_load_image(void) if (!ret) { while ((res = xyzModem_stream_read(buf, BUF_SIZE, &err)) > 0) { - if (addr == 0) - spl_parse_image_header((struct image_header *)buf); + if (addr == 0) { + ret = spl_parse_image_header((struct image_header *)buf); + if (ret) + return ret; + } store_addr = addr + spl_image.load_addr; size += res; addr += res; diff --git a/drivers/mtd/spi/spi_spl_load.c b/drivers/mtd/spi/spi_spl_load.c index ca56fe9015..46c98a9cee 100644 --- a/drivers/mtd/spi/spi_spl_load.c +++ b/drivers/mtd/spi/spi_spl_load.c @@ -23,6 +23,8 @@ static int spi_load_image_os(struct spi_flash *flash, struct image_header *header) { + int err; + /* Read for a header, parse or error out. */ spi_flash_read(flash, CONFIG_SYS_SPI_KERNEL_OFFS, 0x40, (void *)header); @@ -30,7 +32,9 @@ static int spi_load_image_os(struct spi_flash *flash, if (image_get_magic(header) != IH_MAGIC) return -1; - spl_parse_image_header(header); + err = spl_parse_image_header(header); + if (err) + return err; spi_flash_read(flash, CONFIG_SYS_SPI_KERNEL_OFFS, spl_image.size, (void *)spl_image.load_addr); @@ -81,7 +85,9 @@ int spl_spi_load_image(void) if (err) return err; - spl_parse_image_header(header); + err = spl_parse_image_header(header); + if (err) + return err; err = spi_flash_read(flash, CONFIG_SYS_SPI_U_BOOT_OFFS, spl_image.size, (void *)spl_image.load_addr); } diff --git a/drivers/video/ipu_common.c b/drivers/video/ipu_common.c index 36d4b23bfe..5676a0f083 100644 --- a/drivers/video/ipu_common.c +++ b/drivers/video/ipu_common.c @@ -352,7 +352,9 @@ static int ipu_pixel_clk_set_rate(struct clk *clk, unsigned long rate) */ __raw_writel((div / 16) << 16, DI_BS_CLKGEN1(clk->id)); - clk->rate = (u64)(clk->parent->rate * 16) / div; + do_div(parent_rate, div); + + clk->rate = parent_rate; return 0; } diff --git a/include/configs/imx6_spl.h b/include/configs/imx6_spl.h index 68d3fd7384..9bd9f6e3e4 100644 --- a/include/configs/imx6_spl.h +++ b/include/configs/imx6_spl.h @@ -48,12 +48,16 @@ #define CONFIG_SYS_U_BOOT_MAX_SIZE_SECTORS 800 /* 400 KB */ #define CONFIG_SYS_MMCSD_FS_BOOT_PARTITION 1 #define CONFIG_SYS_MONITOR_LEN (CONFIG_SYS_U_BOOT_MAX_SIZE_SECTORS/2*1024) +#define CONFIG_SPL_ABORT_ON_RAW_IMAGE +#define CONFIG_SPL_EXT_SUPPORT #endif /* SATA support */ #if defined(CONFIG_SPL_SATA_SUPPORT) #define CONFIG_SPL_SATA_BOOT_DEVICE 0 #define CONFIG_SYS_SATA_FAT_BOOT_PARTITION 1 +#define CONFIG_SPL_ABORT_ON_RAW_IMAGE +#define CONFIG_SPL_EXT_SUPPORT #endif /* Define the payload for FAT/EXT support */ diff --git a/include/configs/novena.h b/include/configs/novena.h index cfb92d6356..2382951873 100644 --- a/include/configs/novena.h +++ b/include/configs/novena.h @@ -75,7 +75,6 @@ /* SPL */ #define CONFIG_SPL_FAT_SUPPORT -#define CONFIG_SPL_EXT_SUPPORT #define CONFIG_SPL_MMC_SUPPORT #include "imx6_spl.h" /* common IMX6 SPL configuration */ @@ -150,6 +149,7 @@ #define CONFIG_USB_EHCI_MX6 #define CONFIG_USB_STORAGE #define CONFIG_USB_KEYBOARD +#define CONFIG_SYS_STDIO_DEREGISTER #define CONFIG_SYS_USB_EVENT_POLL_VIA_CONTROL_EP #define CONFIG_USB_HOST_ETHER #define CONFIG_USB_ETHER_ASIX diff --git a/include/configs/tqma6.h b/include/configs/tqma6.h index badb955241..77ced7179a 100644 --- a/include/configs/tqma6.h +++ b/include/configs/tqma6.h @@ -16,7 +16,6 @@ #define CONFIG_SPL_MMC_SUPPORT #define CONFIG_SPL_SPI_SUPPORT #define CONFIG_SPL_FAT_SUPPORT -#define CONFIG_SPL_EXT_SUPPORT /* common IMX6 SPL configuration */ #include "imx6_spl.h" diff --git a/include/spl.h b/include/spl.h index de4f70a377..7edfab46dc 100644 --- a/include/spl.h +++ b/include/spl.h @@ -56,7 +56,7 @@ void preloader_console_init(void); u32 spl_boot_device(void); u32 spl_boot_mode(void); void spl_set_header_raw_uboot(void); -void spl_parse_image_header(const struct image_header *header); +int spl_parse_image_header(const struct image_header *header); void spl_board_prepare_for_linux(void); void __noreturn jump_to_image_linux(void *arg); int spl_start_uboot(void); diff --git a/tools/imximage.c b/tools/imximage.c index 7c219222e9..092d550002 100644 --- a/tools/imximage.c +++ b/tools/imximage.c @@ -209,7 +209,7 @@ static void set_dcd_param_v2(struct imx_header *imxhdr, uint32_t dcd_len, d = d2; d->write_dcd_command.tag = DCD_CHECK_DATA_COMMAND_TAG; d->write_dcd_command.length = cpu_to_be16(4); - d->write_dcd_command.param = DCD_CHECK_BITS_SET_PARAM; + d->write_dcd_command.param = DCD_CHECK_BITS_CLR_PARAM; break; default: break;