- mvebu bubt cmd: Add A38x support (Joel)
- Clearfog: Fix SCSI boot duplication (Joel)
- Armada-37xx: Fix DDR PHY clock divider values (Marek)
This commit is contained in:
Tom Rini 2020-04-22 13:00:21 -04:00
commit caad316b31
17 changed files with 142 additions and 60 deletions

View file

@ -232,13 +232,25 @@ config SYS_SOC
choice
prompt "Boot method"
depends on SPL
config MVEBU_SPL_BOOT_DEVICE_SPI
bool "SPI NOR flash"
imply ENV_IS_IN_SPI_FLASH
select SPL_DM_SPI
select SPL_SPI_FLASH_SUPPORT
select SPL_SPI_LOAD
select SPL_SPI_SUPPORT
config MVEBU_SPL_BOOT_DEVICE_MMC
bool "SDIO/MMC card"
imply ENV_IS_IN_MMC
# GPIO needed for eMMC/SD card presence detection
select SPL_DM_GPIO
select SPL_DM_MMC
select SPL_GPIO_SUPPORT
select SPL_LIBDISK_SUPPORT
select SPL_MMC_SUPPORT
config MVEBU_SPL_BOOT_DEVICE_SATA
bool "SATA"

View file

@ -85,7 +85,45 @@ struct mvebu_image_info {
u32 encrypt_start_offset;
u32 encrypt_size;
};
#endif /* CONFIG_ARMADA_XXX */
#endif
/* Structure of the main header, version 1 (Armada 370/38x/XP) */
struct a38x_main_hdr_v1 {
u8 blockid; /* 0x0 */
u8 flags; /* 0x1 */
u16 reserved2; /* 0x2-0x3 */
u32 blocksize; /* 0x4-0x7 */
u8 version; /* 0x8 */
u8 headersz_msb; /* 0x9 */
u16 headersz_lsb; /* 0xA-0xB */
u32 srcaddr; /* 0xC-0xF */
u32 destaddr; /* 0x10-0x13 */
u32 execaddr; /* 0x14-0x17 */
u8 options; /* 0x18 */
u8 nandblocksize; /* 0x19 */
u8 nandbadblklocation; /* 0x1A */
u8 reserved4; /* 0x1B */
u16 reserved5; /* 0x1C-0x1D */
u8 ext; /* 0x1E */
u8 checksum; /* 0x1F */
};
struct a38x_boot_mode {
unsigned int id;
const char *name;
};
/* The blockid header field values used to indicate boot device of image */
struct a38x_boot_mode a38x_boot_modes[] = {
{ 0x4D, "i2c" },
{ 0x5A, "spi" },
{ 0x69, "uart" },
{ 0x78, "sata" },
{ 0x8B, "nand" },
{ 0x9C, "pex" },
{ 0xAE, "mmc" },
{},
};
struct bubt_dev {
char name[8];
@ -324,7 +362,7 @@ static int nand_burn_image(size_t image_size)
/* Align U-Boot size to currently used blocksize */
image_size = ((image_size + (block_size - 1)) & (~(block_size - 1)));
/* Erase the U-BOOT image space */
/* Erase the U-Boot image space */
printf("Erasing 0x%x - 0x%x:...", 0, (int)image_size);
ret = nand_erase(mtd, 0, image_size);
if (ret) {
@ -621,7 +659,52 @@ static int check_image_header(void)
return 0;
}
#elif defined(CONFIG_ARMADA_38X)
static size_t a38x_header_size(const struct a38x_main_hdr_v1 *h)
{
if (h->version == 1)
return (h->headersz_msb << 16) | le16_to_cpu(h->headersz_lsb);
printf("Error: Invalid A38x image (header version 0x%x unknown)!\n",
h->version);
return 0;
}
static uint8_t image_checksum8(const void *start, size_t len)
{
u8 csum = 0;
const u8 *p = start;
while (len) {
csum += *p;
++p;
--len;
}
return csum;
}
static int check_image_header(void)
{
u8 checksum;
const struct a38x_main_hdr_v1 *hdr =
(struct a38x_main_hdr_v1 *)get_load_addr();
const size_t image_size = a38x_header_size(hdr);
if (!image_size)
return -ENOEXEC;
checksum = image_checksum8(hdr, image_size);
checksum -= hdr->checksum;
if (checksum != hdr->checksum) {
printf("Error: Bad A38x image checksum. 0x%x != 0x%x\n",
checksum, hdr->checksum);
return -ENOEXEC;
}
printf("Image checksum...OK!\n");
return 0;
}
#else /* Not ARMADA? */
static int check_image_header(void)
{
@ -630,7 +713,39 @@ static int check_image_header(void)
}
#endif
static int bubt_verify(size_t image_size)
static int bubt_check_boot_mode(const struct bubt_dev *dst)
{
if (IS_ENABLED(CONFIG_ARMADA_38X)) {
int mode;
const struct a38x_main_hdr_v1 *hdr =
(struct a38x_main_hdr_v1 *)get_load_addr();
for (mode = 0; mode < ARRAY_SIZE(a38x_boot_modes); mode++) {
if (strcmp(a38x_boot_modes[mode].name, dst->name) == 0)
break;
}
if (a38x_boot_modes[mode].id == hdr->blockid)
return 0;
for (int i = 0; i < ARRAY_SIZE(a38x_boot_modes); i++) {
if (a38x_boot_modes[i].id == hdr->blockid) {
printf("Error: A38x image meant to be "
"booted from \"%s\", not \"%s\"!\n",
a38x_boot_modes[i].name, dst->name);
return -ENOEXEC;
}
}
printf("Error: unknown boot device in A38x image header: "
"0x%x\n", hdr->blockid);
return -ENOEXEC;
} else {
return 0;
}
}
static int bubt_verify(const struct bubt_dev *dst)
{
int err;
@ -641,6 +756,12 @@ static int bubt_verify(size_t image_size)
return err;
}
err = bubt_check_boot_mode(dst);
if (err) {
printf("Error: Image boot mode verification failed\n");
return err;
}
return 0;
}
@ -667,7 +788,7 @@ static int bubt_read_file(struct bubt_dev *src)
static int bubt_is_dev_active(struct bubt_dev *dev)
{
if (!dev->active) {
printf("Device \"%s\" not supported by U-BOOT image\n",
printf("Device \"%s\" not supported by U-Boot image\n",
dev->name);
return 0;
}
@ -755,14 +876,14 @@ int do_bubt_cmd(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
if (!bubt_is_dev_active(src))
return -ENODEV;
printf("Burning U-BOOT image \"%s\" from \"%s\" to \"%s\"\n",
printf("Burning U-Boot image \"%s\" from \"%s\" to \"%s\"\n",
net_boot_file_name, src->name, dst->name);
image_size = bubt_read_file(src);
if (!image_size)
return -EIO;
err = bubt_verify(image_size);
err = bubt_verify(dst);
if (err)
return err;

View file

@ -3,14 +3,12 @@ CONFIG_ARCH_CPU_INIT=y
CONFIG_SYS_THUMB_BUILD=y
CONFIG_ARCH_MVEBU=y
CONFIG_SYS_TEXT_BASE=0x00800000
CONFIG_SPL_GPIO_SUPPORT=y
CONFIG_SPL_LIBCOMMON_SUPPORT=y
CONFIG_SPL_LIBGENERIC_SUPPORT=y
CONFIG_SYS_MALLOC_F_LEN=0x2000
CONFIG_TARGET_CLEARFOG=y
CONFIG_MVEBU_SPL_BOOT_DEVICE_MMC=y
CONFIG_DM_GPIO=y
CONFIG_SPL_MMC_SUPPORT=y
CONFIG_SPL_SERIAL_SUPPORT=y
CONFIG_NR_DRAM_BANKS=2
CONFIG_SPL=y
@ -33,6 +31,7 @@ CONFIG_SPL_CMD_TLV_EEPROM=y
CONFIG_CMD_GPIO=y
CONFIG_CMD_I2C=y
CONFIG_CMD_MMC=y
CONFIG_CMD_MVEBU_BUBT=y
CONFIG_CMD_PCI=y
CONFIG_CMD_SPI=y
CONFIG_CMD_USB=y
@ -42,7 +41,6 @@ CONFIG_CMD_CACHE=y
CONFIG_CMD_TIME=y
# CONFIG_SPL_PARTITION_UUIDS is not set
CONFIG_DEFAULT_DEVICE_TREE="armada-388-clearfog"
CONFIG_ENV_IS_IN_MMC=y
CONFIG_NET_RANDOM_ETHADDR=y
CONFIG_SPL_OF_TRANSLATE=y
CONFIG_AHCI_MVEBU=y

View file

@ -14,8 +14,6 @@ CONFIG_NR_DRAM_BANKS=2
CONFIG_SPL=y
CONFIG_DEBUG_UART_BASE=0xd0012000
CONFIG_DEBUG_UART_CLOCK=250000000
CONFIG_SPL_SPI_FLASH_SUPPORT=y
CONFIG_SPL_SPI_SUPPORT=y
CONFIG_DEBUG_UART=y
CONFIG_AHCI=y
CONFIG_SPL_TEXT_BASE=0x40000030
@ -28,7 +26,6 @@ CONFIG_DISPLAY_BOARDINFO_LATE=y
CONFIG_LAST_STAGE_INIT=y
CONFIG_SPL_BOARD_INIT=y
CONFIG_SPL_SYS_MALLOC_SIMPLE=y
CONFIG_SPL_SPI_LOAD=y
CONFIG_SYS_SPI_U_BOOT_OFFS=0x30000
CONFIG_HUSH_PARSER=y
# CONFIG_CMD_ELF is not set
@ -50,7 +47,6 @@ CONFIG_CMD_EXT4=y
CONFIG_EFI_PARTITION=y
CONFIG_OF_BOARD_FIXUP=y
CONFIG_DEFAULT_DEVICE_TREE="armada-38x-controlcenterdc"
CONFIG_ENV_IS_IN_SPI_FLASH=y
CONFIG_USE_ENV_SPI_MAX_HZ=y
CONFIG_ENV_SPI_MAX_HZ=50000000
CONFIG_SYS_RELOC_GD_ENV_ADDR=y

View file

@ -14,8 +14,6 @@ CONFIG_NR_DRAM_BANKS=2
CONFIG_SPL=y
CONFIG_DEBUG_UART_BASE=0xf1012000
CONFIG_DEBUG_UART_CLOCK=250000000
CONFIG_SPL_SPI_FLASH_SUPPORT=y
CONFIG_SPL_SPI_SUPPORT=y
CONFIG_DEBUG_UART=y
CONFIG_SPL_TEXT_BASE=0x40004030
# CONFIG_SYS_MALLOC_CLEAR_ON_INIT is not set
@ -25,7 +23,6 @@ CONFIG_SYS_CONSOLE_INFO_QUIET=y
# CONFIG_DISPLAY_BOARDINFO is not set
CONFIG_DISPLAY_BOARDINFO_LATE=y
CONFIG_SPL_I2C_SUPPORT=y
CONFIG_SPL_SPI_LOAD=y
CONFIG_SYS_SPI_U_BOOT_OFFS=0x20000
CONFIG_CMD_I2C=y
CONFIG_CMD_SPI=y
@ -43,7 +40,6 @@ CONFIG_CMD_FAT=y
CONFIG_CMD_FS_GENERIC=y
# CONFIG_DOS_PARTITION is not set
CONFIG_DEFAULT_DEVICE_TREE="armada-375-db"
CONFIG_ENV_IS_IN_SPI_FLASH=y
CONFIG_USE_ENV_SPI_MAX_HZ=y
CONFIG_ENV_SPI_MAX_HZ=50000000
CONFIG_SYS_RELOC_GD_ENV_ADDR=y

View file

@ -14,8 +14,6 @@ CONFIG_NR_DRAM_BANKS=2
CONFIG_SPL=y
CONFIG_DEBUG_UART_BASE=0xd0012000
CONFIG_DEBUG_UART_CLOCK=200000000
CONFIG_SPL_SPI_FLASH_SUPPORT=y
CONFIG_SPL_SPI_SUPPORT=y
CONFIG_DEBUG_UART=y
CONFIG_SPL_TEXT_BASE=0x40000030
CONFIG_FIT=y
@ -26,7 +24,6 @@ CONFIG_SYS_CONSOLE_INFO_QUIET=y
# CONFIG_DISPLAY_BOARDINFO is not set
CONFIG_DISPLAY_BOARDINFO_LATE=y
CONFIG_SPL_I2C_SUPPORT=y
CONFIG_SPL_SPI_LOAD=y
CONFIG_SYS_SPI_U_BOOT_OFFS=0x24000
# CONFIG_CMD_FLASH is not set
CONFIG_CMD_I2C=y
@ -48,7 +45,6 @@ CONFIG_EFI_PARTITION=y
# CONFIG_PARTITION_UUIDS is not set
# CONFIG_SPL_PARTITION_UUIDS is not set
CONFIG_DEFAULT_DEVICE_TREE="armada-385-db-88f6820-amc"
CONFIG_ENV_IS_IN_SPI_FLASH=y
CONFIG_USE_ENV_SPI_MAX_HZ=y
CONFIG_ENV_SPI_MAX_HZ=50000000
CONFIG_SYS_RELOC_GD_ENV_ADDR=y

View file

@ -14,8 +14,6 @@ CONFIG_NR_DRAM_BANKS=2
CONFIG_SPL=y
CONFIG_DEBUG_UART_BASE=0xd0012000
CONFIG_DEBUG_UART_CLOCK=250000000
CONFIG_SPL_SPI_FLASH_SUPPORT=y
CONFIG_SPL_SPI_SUPPORT=y
CONFIG_DEBUG_UART=y
CONFIG_AHCI=y
CONFIG_SPL_TEXT_BASE=0x40000030
@ -26,7 +24,6 @@ CONFIG_SYS_CONSOLE_INFO_QUIET=y
CONFIG_DISPLAY_BOARDINFO_LATE=y
CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_USE_PARTITION=y
CONFIG_SPL_I2C_SUPPORT=y
CONFIG_SPL_SPI_LOAD=y
CONFIG_SYS_SPI_U_BOOT_OFFS=0x24000
CONFIG_CMD_I2C=y
CONFIG_CMD_MMC=y
@ -48,7 +45,6 @@ CONFIG_EFI_PARTITION=y
# CONFIG_PARTITION_UUIDS is not set
# CONFIG_SPL_PARTITION_UUIDS is not set
CONFIG_DEFAULT_DEVICE_TREE="armada-388-gp"
CONFIG_ENV_IS_IN_SPI_FLASH=y
CONFIG_USE_ENV_SPI_MAX_HZ=y
CONFIG_ENV_SPI_MAX_HZ=50000000
CONFIG_SYS_RELOC_GD_ENV_ADDR=y

View file

@ -14,8 +14,6 @@ CONFIG_NR_DRAM_BANKS=2
CONFIG_SPL=y
CONFIG_DEBUG_UART_BASE=0xd0012000
CONFIG_DEBUG_UART_CLOCK=250000000
CONFIG_SPL_SPI_FLASH_SUPPORT=y
CONFIG_SPL_SPI_SUPPORT=y
CONFIG_DEBUG_UART=y
CONFIG_SPL_TEXT_BASE=0x40004030
# CONFIG_SYS_MALLOC_CLEAR_ON_INIT is not set
@ -25,7 +23,6 @@ CONFIG_SYS_CONSOLE_INFO_QUIET=y
# CONFIG_DISPLAY_BOARDINFO is not set
CONFIG_DISPLAY_BOARDINFO_LATE=y
CONFIG_SPL_I2C_SUPPORT=y
CONFIG_SPL_SPI_LOAD=y
CONFIG_SYS_SPI_U_BOOT_OFFS=0x20000
# CONFIG_CMD_FLASH is not set
CONFIG_CMD_I2C=y

View file

@ -14,8 +14,6 @@ CONFIG_NR_DRAM_BANKS=2
CONFIG_SPL=y
CONFIG_DEBUG_UART_BASE=0xd0012000
CONFIG_DEBUG_UART_CLOCK=250000000
CONFIG_SPL_SPI_FLASH_SUPPORT=y
CONFIG_SPL_SPI_SUPPORT=y
CONFIG_DEBUG_UART=y
CONFIG_SPL_TEXT_BASE=0x40004030
CONFIG_BOOTDELAY=3
@ -26,7 +24,6 @@ CONFIG_PREBOOT="usb start; sf probe"
# CONFIG_DISPLAY_BOARDINFO is not set
CONFIG_DISPLAY_BOARDINFO_LATE=y
CONFIG_SPL_I2C_SUPPORT=y
CONFIG_SPL_SPI_LOAD=y
CONFIG_SYS_SPI_U_BOOT_OFFS=0x24000
# CONFIG_CMD_FLASH is not set
CONFIG_CMD_I2C=y

View file

@ -38,7 +38,6 @@ CONFIG_CMD_CACHE=y
CONFIG_CMD_TIME=y
# CONFIG_SPL_PARTITION_UUIDS is not set
CONFIG_DEFAULT_DEVICE_TREE="armada-388-helios4"
CONFIG_ENV_IS_IN_MMC=y
CONFIG_NET_RANDOM_ETHADDR=y
CONFIG_SPL_OF_TRANSLATE=y
CONFIG_SCSI_AHCI=y

View file

@ -14,8 +14,6 @@ CONFIG_NR_DRAM_BANKS=2
CONFIG_SPL=y
CONFIG_DEBUG_UART_BASE=0xd0012000
CONFIG_DEBUG_UART_CLOCK=250000000
CONFIG_SPL_SPI_FLASH_SUPPORT=y
CONFIG_SPL_SPI_SUPPORT=y
CONFIG_DEBUG_UART=y
CONFIG_SPL_TEXT_BASE=0x40004030
CONFIG_BOOTDELAY=3
@ -24,7 +22,6 @@ CONFIG_SYS_CONSOLE_INFO_QUIET=y
# CONFIG_DISPLAY_BOARDINFO is not set
CONFIG_DISPLAY_BOARDINFO_LATE=y
CONFIG_SPL_I2C_SUPPORT=y
CONFIG_SPL_SPI_LOAD=y
CONFIG_SYS_SPI_U_BOOT_OFFS=0x20000
CONFIG_CMD_I2C=y
CONFIG_CMD_SPI=y

View file

@ -15,8 +15,6 @@ CONFIG_NR_DRAM_BANKS=2
CONFIG_SPL=y
CONFIG_DEBUG_UART_BASE=0xd0012000
CONFIG_DEBUG_UART_CLOCK=250000000
CONFIG_SPL_SPI_FLASH_SUPPORT=y
CONFIG_SPL_SPI_SUPPORT=y
CONFIG_DEBUG_UART=y
CONFIG_SPL_TEXT_BASE=0x40004030
# CONFIG_SYS_MALLOC_CLEAR_ON_INIT is not set
@ -28,7 +26,6 @@ CONFIG_SYS_CONSOLE_INFO_QUIET=y
# CONFIG_DISPLAY_BOARDINFO is not set
CONFIG_DISPLAY_BOARDINFO_LATE=y
CONFIG_SPL_I2C_SUPPORT=y
CONFIG_SPL_SPI_LOAD=y
CONFIG_SYS_SPI_U_BOOT_OFFS=0x1a000
CONFIG_HUSH_PARSER=y
CONFIG_CMD_BOOTZ=y

View file

@ -17,8 +17,6 @@ CONFIG_NR_DRAM_BANKS=2
CONFIG_SPL=y
CONFIG_DEBUG_UART_BASE=0xd0012000
CONFIG_DEBUG_UART_CLOCK=250000000
CONFIG_SPL_SPI_FLASH_SUPPORT=y
CONFIG_SPL_SPI_SUPPORT=y
CONFIG_DEBUG_UART=y
CONFIG_AHCI=y
CONFIG_SPL_TEXT_BASE=0x40000030
@ -32,7 +30,6 @@ CONFIG_MISC_INIT_R=y
# CONFIG_DISPLAY_BOARDINFO is not set
CONFIG_DISPLAY_BOARDINFO_LATE=y
CONFIG_SPL_I2C_SUPPORT=y
CONFIG_SPL_SPI_LOAD=y
CONFIG_SYS_SPI_U_BOOT_OFFS=0x24000
CONFIG_CMD_MEMTEST=y
CONFIG_SYS_ALT_MEMTEST=y
@ -53,7 +50,6 @@ CONFIG_CMD_HASH=y
CONFIG_CMD_BTRFS=y
# CONFIG_SPL_PARTITION_UUIDS is not set
CONFIG_DEFAULT_DEVICE_TREE="armada-385-turris-omnia"
CONFIG_ENV_IS_IN_SPI_FLASH=y
CONFIG_USE_ENV_SPI_MAX_HZ=y
CONFIG_ENV_SPI_MAX_HZ=50000000
CONFIG_SYS_RELOC_GD_ENV_ADDR=y

View file

@ -15,8 +15,6 @@ CONFIG_NR_DRAM_BANKS=2
CONFIG_SPL=y
CONFIG_DEBUG_UART_BASE=0xd0012000
CONFIG_DEBUG_UART_CLOCK=250000000
CONFIG_SPL_SPI_FLASH_SUPPORT=y
CONFIG_SPL_SPI_SUPPORT=y
CONFIG_DEBUG_UART=y
CONFIG_SPL_TEXT_BASE=0x40000030
CONFIG_FIT=y
@ -26,7 +24,6 @@ CONFIG_SILENT_U_BOOT_ONLY=y
CONFIG_SILENT_CONSOLE_UPDATE_ON_RELOC=y
CONFIG_MISC_INIT_R=y
CONFIG_SPL_BOARD_INIT=y
CONFIG_SPL_SPI_LOAD=y
CONFIG_SYS_SPI_U_BOOT_OFFS=0x24000
CONFIG_SPL_WATCHDOG_SUPPORT=y
CONFIG_CMD_MEMINFO=y
@ -47,7 +44,6 @@ CONFIG_CMD_EXT4=y
CONFIG_CMD_FAT=y
CONFIG_CMD_FS_GENERIC=y
CONFIG_DEFAULT_DEVICE_TREE="armada-385-atl-x530"
CONFIG_ENV_IS_IN_SPI_FLASH=y
CONFIG_ENV_ADDR=0x100000
CONFIG_SPL_OF_TRANSLATE=y
CONFIG_BLK=y

View file

@ -89,8 +89,8 @@ static const struct clk_div_table div_table1[] = {
};
static const struct clk_div_table div_table2[] = {
{ 2, 1 },
{ 4, 2 },
{ 2, 0 },
{ 4, 1 },
{ 0, 0 },
};

View file

@ -104,12 +104,6 @@
#define BOOT_TARGET_DEVICES_MMC(func)
#endif
#ifdef CONFIG_SCSI
#define BOOT_TARGET_DEVICES_SCSI(func) func(SCSI, scsi, 0)
#else
#define BOOT_TARGET_DEVICES_SCSI(func)
#endif
#ifdef CONFIG_USB_STORAGE
#define BOOT_TARGET_DEVICES_USB(func) func(USB, usb, 0)
#else
@ -152,7 +146,6 @@
*/
#define BOOT_TARGET_DEVICES(func) \
BOOT_TARGET_DEVICES_MMC(func) \
BOOT_TARGET_DEVICES_SCSI(func) \
BOOT_TARGET_DEVICES_USB(func) \
BOOT_TARGET_DEVICES_SCSI_BUS0(func) \
BOOT_TARGET_DEVICES_SCSI_BUS1(func) \

View file

@ -93,16 +93,11 @@
#define CONFIG_SPL_BOOTROM_SAVE (CONFIG_SPL_STACK + 4)
#if CONFIG_SPL_BOOT_DEVICE == SPL_BOOT_SPI_NOR_FLASH
/* SPL related SPI defines */
#define CONFIG_SPL_SPI_FLASH_SUPPORT
#define CONFIG_SPL_SPI_LOAD
#define CONFIG_SPL_SPI_SUPPORT
#define CONFIG_SYS_U_BOOT_OFFS CONFIG_SYS_SPI_U_BOOT_OFFS
#endif
#if CONFIG_SPL_BOOT_DEVICE == SPL_BOOT_SDIO_MMC_CARD
/* SPL related MMC defines */
#define CONFIG_SPL_MMC_SUPPORT
#define CONFIG_SYS_MMC_U_BOOT_OFFS (160 << 10)
#define CONFIG_SYS_U_BOOT_OFFS CONFIG_SYS_MMC_U_BOOT_OFFS
#ifdef CONFIG_SPL_BUILD