From eb1f7784f4643329227bf63aa0d6e11d2941c996 Mon Sep 17 00:00:00 2001 From: Chris Packham Date: Tue, 25 Oct 2016 11:40:55 +1300 Subject: [PATCH 1/4] mvebu: db-88f6820-amc: Enable FIT support Signed-off-by: Chris Packham Signed-off-by: Stefan Roese --- configs/db-88f6820-amc_defconfig | 2 ++ 1 file changed, 2 insertions(+) diff --git a/configs/db-88f6820-amc_defconfig b/configs/db-88f6820-amc_defconfig index 90cbd4894a..27ec6565ba 100644 --- a/configs/db-88f6820-amc_defconfig +++ b/configs/db-88f6820-amc_defconfig @@ -8,6 +8,8 @@ CONFIG_SPL_SERIAL_SUPPORT=y CONFIG_SPL_SPI_FLASH_SUPPORT=y CONFIG_SPL_SPI_SUPPORT=y CONFIG_DEFAULT_DEVICE_TREE="armada-385-amc" +CONFIG_FIT=y +CONFIG_FIT_VERBOSE=y CONFIG_BOOTDELAY=3 CONFIG_SYS_CONSOLE_INFO_QUIET=y # CONFIG_DISPLAY_BOARDINFO is not set From a53d97ae851f6ddd2cb3dbb9cad63f4c3997f542 Mon Sep 17 00:00:00 2001 From: Chris Packham Date: Wed, 26 Oct 2016 14:08:30 +1300 Subject: [PATCH 2/4] arm: mvebu: move SYS_MVEBU_PLL_CLOCK to Kconfig The main PLL frequency is 2GHz for Armada-XP and 1GHZ for Armada 375, 38x and 39x. [ Linux commit ae142bd9976532aa5232ab0b00e621690d8bfe6a ] Signed-off-by: Chris Packham Signed-off-by: Stefan Roese --- arch/arm/mach-mvebu/Kconfig | 6 ++++++ arch/arm/mach-mvebu/include/mach/soc.h | 3 --- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/arch/arm/mach-mvebu/Kconfig b/arch/arm/mach-mvebu/Kconfig index 6e8026bde2..7733936be5 100644 --- a/arch/arm/mach-mvebu/Kconfig +++ b/arch/arm/mach-mvebu/Kconfig @@ -36,6 +36,12 @@ config ARMADA_8K bool select ARM64 +# Armada PLL frequency (used for NAND clock generation) +config SYS_MVEBU_PLL_CLOCK + int + default "2000000000" if ARMADA_XP || ARMADA_3700 || ARMADA_8K + default "1000000000" if ARMADA_38X || ARMADA_375 + # Armada XP/38x SoC types... config MV78230 bool diff --git a/arch/arm/mach-mvebu/include/mach/soc.h b/arch/arm/mach-mvebu/include/mach/soc.h index 731fe65ae4..0f69f3341b 100644 --- a/arch/arm/mach-mvebu/include/mach/soc.h +++ b/arch/arm/mach-mvebu/include/mach/soc.h @@ -31,9 +31,6 @@ #define CONFIG_SYS_TCLK 250000000 /* 250MHz */ #endif -/* Armada XP PLL frequency (used for NAND clock generation) */ -#define CONFIG_SYS_MVEBU_PLL_CLOCK 2000000000 - /* SOC specific definations */ #define INTREG_BASE 0xd0000000 #define INTREG_BASE_ADDR_REG (INTREG_BASE + 0x20080) From 4bdb547978a289dc33be9ba72dbb0e861b4aa31b Mon Sep 17 00:00:00 2001 From: Chris Packham Date: Wed, 9 Nov 2016 22:07:45 +1300 Subject: [PATCH 3/4] tools/kwbimage: add BAUDRATE option Offset 0x18 in some Marvell datasheets this field is redacted as "reserved". This offset is actually a set of options and bits 2:0 allow the selection of the UART baudrate. Allow a BAUDRATE option to set the UART baudrate for any messages coming from the BootROM firmware. Signed-off-by: Chris Packham Signed-off-by: Stefan Roese --- tools/kwbimage.c | 31 +++++++++++++++++++++++++++++++ tools/kwbimage.h | 14 +++++++++++++- 2 files changed, 44 insertions(+), 1 deletion(-) diff --git a/tools/kwbimage.c b/tools/kwbimage.c index 369aba7bca..ad182c5c5d 100644 --- a/tools/kwbimage.c +++ b/tools/kwbimage.c @@ -68,6 +68,7 @@ struct image_cfg_element { IMAGE_CFG_BINARY, IMAGE_CFG_PAYLOAD, IMAGE_CFG_DATA, + IMAGE_CFG_BAUDRATE, } type; union { unsigned int version; @@ -85,6 +86,7 @@ struct image_cfg_element { unsigned int nandeccmode; unsigned int nandpagesz; struct ext_hdr_v0_reg regdata; + unsigned int baudrate; }; }; @@ -195,6 +197,28 @@ static uint32_t image_checksum32(void *start, uint32_t len) return csum; } +static uint8_t baudrate_to_option(unsigned int baudrate) +{ + switch (baudrate) { + case 2400: + return MAIN_HDR_V1_OPT_BAUD_2400; + case 4800: + return MAIN_HDR_V1_OPT_BAUD_4800; + case 9600: + return MAIN_HDR_V1_OPT_BAUD_9600; + case 19200: + return MAIN_HDR_V1_OPT_BAUD_19200; + case 38400: + return MAIN_HDR_V1_OPT_BAUD_38400; + case 57600: + return MAIN_HDR_V1_OPT_BAUD_57600; + case 115200: + return MAIN_HDR_V1_OPT_BAUD_115200; + default: + return MAIN_HDR_V1_OPT_BAUD_DEFAULT; + } +} + static void *image_create_v0(size_t *imagesz, struct image_tool_params *params, int payloadsz) { @@ -398,6 +422,9 @@ static void *image_create_v1(size_t *imagesz, struct image_tool_params *params, e = image_find_option(IMAGE_CFG_NAND_BADBLK_LOCATION); if (e) main_hdr->nandbadblklocation = e->nandbadblklocation; + e = image_find_option(IMAGE_CFG_BAUDRATE); + if (e) + main_hdr->options = baudrate_to_option(e->baudrate); binarye = image_find_option(IMAGE_CFG_BINARY); if (binarye) { @@ -548,6 +575,10 @@ static int image_create_config_parse_oneline(char *line, el->type = IMAGE_CFG_DATA; el->regdata.raddr = strtoul(value1, NULL, 16); el->regdata.rdata = strtoul(value2, NULL, 16); + } else if (!strcmp(keyword, "BAUDRATE")) { + char *value = strtok_r(NULL, deliminiters, &saveptr); + el->type = IMAGE_CFG_BAUDRATE; + el->baudrate = strtoul(value, NULL, 10); } else { fprintf(stderr, "Ignoring unknown line '%s'\n", line); } diff --git a/tools/kwbimage.h b/tools/kwbimage.h index e6e3d1d4f9..9b06004a0b 100644 --- a/tools/kwbimage.h +++ b/tools/kwbimage.h @@ -82,7 +82,7 @@ struct main_hdr_v1 { uint32_t srcaddr; /* C-F */ uint32_t destaddr; /* 10-13 */ uint32_t execaddr; /* 14-17 */ - uint8_t reserved3; /* 18 */ + uint8_t options; /* 18 */ uint8_t nandblocksize; /* 19 */ uint8_t nandbadblklocation; /* 1A */ uint8_t reserved4; /* 1B */ @@ -91,6 +91,18 @@ struct main_hdr_v1 { uint8_t checksum; /* 1F */ }; +/* + * Main header options + */ +#define MAIN_HDR_V1_OPT_BAUD_DEFAULT 0 +#define MAIN_HDR_V1_OPT_BAUD_2400 0x1 +#define MAIN_HDR_V1_OPT_BAUD_4800 0x2 +#define MAIN_HDR_V1_OPT_BAUD_9600 0x3 +#define MAIN_HDR_V1_OPT_BAUD_19200 0x4 +#define MAIN_HDR_V1_OPT_BAUD_38400 0x5 +#define MAIN_HDR_V1_OPT_BAUD_57600 0x6 +#define MAIN_HDR_V1_OPT_BAUD_115200 0x7 + /* * Header for the optional headers, version 1 (Armada 370, Armada XP) */ From 2611c05e840033e4c4ab83115836d7657f5b316b Mon Sep 17 00:00:00 2001 From: Chris Packham Date: Wed, 9 Nov 2016 22:21:45 +1300 Subject: [PATCH 4/4] tools/kwbimage: add DEBUG option Offset 0x1 in the generated kwb image file is a set of flags, bit 0 enables debug output from the BootROM firmware. Allow a DEBUG option in the kwb configuration to request debug output from the BootROM firmware. Signed-off-by: Chris Packham Signed-off-by: Stefan Roese --- tools/kwbimage.c | 9 +++++++++ tools/kwbimage.h | 2 +- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/tools/kwbimage.c b/tools/kwbimage.c index ad182c5c5d..69844d9169 100644 --- a/tools/kwbimage.c +++ b/tools/kwbimage.c @@ -69,6 +69,7 @@ struct image_cfg_element { IMAGE_CFG_PAYLOAD, IMAGE_CFG_DATA, IMAGE_CFG_BAUDRATE, + IMAGE_CFG_DEBUG, } type; union { unsigned int version; @@ -87,6 +88,7 @@ struct image_cfg_element { unsigned int nandpagesz; struct ext_hdr_v0_reg regdata; unsigned int baudrate; + unsigned int debug; }; }; @@ -425,6 +427,9 @@ static void *image_create_v1(size_t *imagesz, struct image_tool_params *params, e = image_find_option(IMAGE_CFG_BAUDRATE); if (e) main_hdr->options = baudrate_to_option(e->baudrate); + e = image_find_option(IMAGE_CFG_DEBUG); + if (e) + main_hdr->flags = e->debug ? 0x1 : 0; binarye = image_find_option(IMAGE_CFG_BINARY); if (binarye) { @@ -579,6 +584,10 @@ static int image_create_config_parse_oneline(char *line, char *value = strtok_r(NULL, deliminiters, &saveptr); el->type = IMAGE_CFG_BAUDRATE; el->baudrate = strtoul(value, NULL, 10); + } else if (!strcmp(keyword, "DEBUG")) { + char *value = strtok_r(NULL, deliminiters, &saveptr); + el->type = IMAGE_CFG_DEBUG; + el->debug = strtoul(value, NULL, 10); } else { fprintf(stderr, "Ignoring unknown line '%s'\n", line); } diff --git a/tools/kwbimage.h b/tools/kwbimage.h index 9b06004a0b..01c2f1f323 100644 --- a/tools/kwbimage.h +++ b/tools/kwbimage.h @@ -73,7 +73,7 @@ struct kwb_header { /* Structure of the main header, version 1 (Armada 370, Armada XP) */ struct main_hdr_v1 { uint8_t blockid; /* 0 */ - uint8_t reserved1; /* 1 */ + uint8_t flags; /* 1 */ uint16_t reserved2; /* 2-3 */ uint32_t blocksize; /* 4-7 */ uint8_t version; /* 8 */