From e13921a9514be6a82f328a8633ab695f2d953b83 Mon Sep 17 00:00:00 2001 From: Sean Nyekjaer Date: Wed, 22 Nov 2017 13:39:08 +0100 Subject: [PATCH 1/6] fix: nand: pxa3xx: fix defined but not used warnings bbt_mirror_descr and bbt_main_descr is defined but not used when compiling without CONFIG_SYS_NAND_USE_FLASH_BBT set. Signed-off-by: Sean Nyekjaer Signed-off-by: Stefan Roese --- drivers/mtd/nand/pxa3xx_nand.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/mtd/nand/pxa3xx_nand.c b/drivers/mtd/nand/pxa3xx_nand.c index 6ab3c8a25a..cedbb239b6 100644 --- a/drivers/mtd/nand/pxa3xx_nand.c +++ b/drivers/mtd/nand/pxa3xx_nand.c @@ -233,6 +233,7 @@ static struct pxa3xx_nand_flash builtin_flash_types[] = { { 0xba20, 16, 16, &timing[3] }, }; +#ifdef CONFIG_SYS_NAND_USE_FLASH_BBT static u8 bbt_pattern[] = {'M', 'V', 'B', 'b', 't', '0' }; static u8 bbt_mirror_pattern[] = {'1', 't', 'b', 'B', 'V', 'M' }; @@ -255,6 +256,7 @@ static struct nand_bbt_descr bbt_mirror_descr = { .maxblocks = 8, /* Last 8 blocks in each chip */ .pattern = bbt_mirror_pattern }; +#endif static struct nand_ecclayout ecc_layout_2KB_bch4bit = { .eccbytes = 32, From 348b488f5e60497cf8a2abf128f566ffbfc8c920 Mon Sep 17 00:00:00 2001 From: Sean Nyekjaer Date: Fri, 24 Nov 2017 14:00:48 +0100 Subject: [PATCH 2/6] arm: mvebu: add nand pins Signed-off-by: Sean Nyekjaer Signed-off-by: Stefan Roese --- arch/arm/dts/armada-38x.dtsi | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/arch/arm/dts/armada-38x.dtsi b/arch/arm/dts/armada-38x.dtsi index dc8a1a66c1..5e5a158551 100644 --- a/arch/arm/dts/armada-38x.dtsi +++ b/arch/arm/dts/armada-38x.dtsi @@ -258,6 +258,19 @@ marvell,function = "i2c0"; }; + nand_pins: nand-pins { + marvell,pins = "mpp22", "mpp34", "mpp23", "mpp33", + "mpp38", "mpp28", "mpp40", "mpp42", + "mpp35", "mpp36", "mpp25", "mpp30", + "mpp32"; + marvell,function = "dev"; + }; + + nand_rb: nand-rb { + marvell,pins = "mpp41"; + marvell,function = "nand"; + }; + mdio_pins: mdio-pins { marvell,pins = "mpp4", "mpp5"; marvell,function = "ge"; @@ -545,7 +558,7 @@ }; flash@d0000 { - compatible = "marvell,armada370-nand"; + compatible = "marvell,armada370-nand","marvell,mvebu-pxa3xx-nand"; reg = <0xd0000 0x54>; #address-cells = <1>; #size-cells = <1>; From e83e2b390038c9075642cb243a6292241beb8d73 Mon Sep 17 00:00:00 2001 From: Sean Nyekjaer Date: Fri, 24 Nov 2017 14:01:28 +0100 Subject: [PATCH 3/6] arm: mvebu: fix boot from UART when in fallback mode It's the first 8 bits of the bootrom error register that contain the boot error/fallback error code. Let's check that and continue to boot from UART. Signed-off-by: Sean Nyekjaer Signed-off-by: Stefan Roese --- arch/arm/mach-mvebu/include/mach/soc.h | 6 ++++++ arch/arm/mach-mvebu/spl.c | 9 +++++++++ 2 files changed, 15 insertions(+) diff --git a/arch/arm/mach-mvebu/include/mach/soc.h b/arch/arm/mach-mvebu/include/mach/soc.h index 1d302761f0..4f81285bb5 100644 --- a/arch/arm/mach-mvebu/include/mach/soc.h +++ b/arch/arm/mach-mvebu/include/mach/soc.h @@ -111,10 +111,16 @@ #define COMPHY_REFCLK_ALIGNMENT (MVEBU_REGISTER(0x182f8)) /* BootROM error register (also includes some status infos) */ +#if defined(CONFIG_ARMADA_38X) +#define CONFIG_BOOTROM_ERR_REG (MVEBU_REGISTER(0x182d0)) +#define BOOTROM_ERR_MODE_OFFS 0 +#define BOOTROM_ERR_MODE_MASK (0xf << BOOTROM_ERR_MODE_OFFS) +#else #define CONFIG_BOOTROM_ERR_REG (MVEBU_REGISTER(0x182d0)) #define BOOTROM_ERR_MODE_OFFS 28 #define BOOTROM_ERR_MODE_MASK (0xf << BOOTROM_ERR_MODE_OFFS) #define BOOTROM_ERR_MODE_UART 0x6 +#endif #if defined(CONFIG_ARMADA_375) /* SAR values for Armada 375 */ diff --git a/arch/arm/mach-mvebu/spl.c b/arch/arm/mach-mvebu/spl.c index a72a769f7c..2fd6c62589 100644 --- a/arch/arm/mach-mvebu/spl.c +++ b/arch/arm/mach-mvebu/spl.c @@ -26,7 +26,16 @@ static u32 get_boot_device(void) val = readl(CONFIG_BOOTROM_ERR_REG); boot_device = (val & BOOTROM_ERR_MODE_MASK) >> BOOTROM_ERR_MODE_OFFS; debug("BOOTROM_REG=0x%08x boot_device=0x%x\n", val, boot_device); +#if defined(CONFIG_ARMADA_38X) + /* + * If the bootrom error register contains any else than zeros + * in the first 8 bits it's an error condition. And in that case + * try to boot from UART. + */ + if (boot_device) +#else if (boot_device == BOOTROM_ERR_MODE_UART) +#endif return BOOT_DEVICE_UART; /* From 926c8b2e3241f3a694b46d5db3453bc546a01f69 Mon Sep 17 00:00:00 2001 From: Sean Nyekjaer Date: Fri, 24 Nov 2017 14:01:47 +0100 Subject: [PATCH 4/6] arm: mvebu: enable boot from NAND Check if we are booting from NAND and let the bootrom continue to load the rest of the bootloader Signed-off-by: Sean Nyekjaer Signed-off-by: Stefan Roese --- arch/arm/mach-mvebu/include/mach/soc.h | 1 + arch/arm/mach-mvebu/spl.c | 16 ++++++++++++++-- 2 files changed, 15 insertions(+), 2 deletions(-) diff --git a/arch/arm/mach-mvebu/include/mach/soc.h b/arch/arm/mach-mvebu/include/mach/soc.h index 4f81285bb5..1a06a1e876 100644 --- a/arch/arm/mach-mvebu/include/mach/soc.h +++ b/arch/arm/mach-mvebu/include/mach/soc.h @@ -147,6 +147,7 @@ #define BOOT_DEV_SEL_OFFS 4 #define BOOT_DEV_SEL_MASK (0x3f << BOOT_DEV_SEL_OFFS) +#define BOOT_FROM_NAND 0x0A #define BOOT_FROM_UART 0x28 #define BOOT_FROM_UART_ALT 0x3f #define BOOT_FROM_SPI 0x32 diff --git a/arch/arm/mach-mvebu/spl.c b/arch/arm/mach-mvebu/spl.c index 2fd6c62589..d16a62d2dd 100644 --- a/arch/arm/mach-mvebu/spl.c +++ b/arch/arm/mach-mvebu/spl.c @@ -45,6 +45,10 @@ static u32 get_boot_device(void) boot_device = (val & BOOT_DEV_SEL_MASK) >> BOOT_DEV_SEL_OFFS; debug("SAR_REG=0x%08x boot_device=0x%x\n", val, boot_device); switch (boot_device) { +#if defined(CONFIG_ARMADA_38X) + case BOOT_FROM_NAND: + return BOOT_DEVICE_NAND; +#endif #ifdef CONFIG_SPL_MMC_SUPPORT case BOOT_FROM_MMC: case BOOT_FROM_MMC_ALT: @@ -128,7 +132,15 @@ void board_init_f(ulong dummy) * SPL has no chance to receive this information. So we * need to return to the BootROM to enable this xmodem * UART download. + * + * If booting from NAND lets let the BootROM load the + * rest of the bootloader. */ - if (get_boot_device() == BOOT_DEVICE_UART) - return_to_bootrom(); + switch (get_boot_device()) { + case BOOT_DEVICE_UART: +#if defined(CONFIG_ARMADA_38X) + case BOOT_DEVICE_NAND: +#endif + return_to_bootrom(); + } } From f86474e28185a1f31a2c993fa0f34b1a94c8c6e0 Mon Sep 17 00:00:00 2001 From: Baruch Siach Date: Sun, 26 Nov 2017 09:21:23 +0200 Subject: [PATCH 5/6] arm64: mvebu: armada-7k/8k: drop useless #ifdef CONFIG_ENV_IS_IN_NAND has been removed in commit 2be296538e2e (Convert CONFIG_ENV_IS_IN_MMC/NAND/UBI and NOWHERE to Kconfig). CONFIG_ENV_IS_IN_SPI_FLASH has been removed in commit 91c868fe7cd (Convert CONFIG_ENV_IS_IN_SPI_FLASH to Kconfig). The environment #ifdef is now empty. Remove it. Signed-off-by: Baruch Siach Signed-off-by: Stefan Roese --- include/configs/mvebu_armada-8k.h | 5 ----- 1 file changed, 5 deletions(-) diff --git a/include/configs/mvebu_armada-8k.h b/include/configs/mvebu_armada-8k.h index fd60a9bfd4..d85527434a 100644 --- a/include/configs/mvebu_armada-8k.h +++ b/include/configs/mvebu_armada-8k.h @@ -73,11 +73,6 @@ #define CONFIG_SF_DEFAULT_MODE SPI_MODE_0 #define CONFIG_ENV_SPI_MODE CONFIG_SF_DEFAULT_MODE -/* Environment in SPI NOR flash */ -#ifdef CONFIG_MVEBU_SPI_BOOT -/* Environment in NAND flash */ -#endif - #define CONFIG_ENV_OFFSET 0x180000 /* as Marvell U-Boot version */ #define CONFIG_ENV_SIZE (64 << 10) /* 64KiB */ #define CONFIG_ENV_SECT_SIZE (64 << 10) /* 64KiB sectors */ From 01c541e0e698196ab29761fd29fd06f36185e03e Mon Sep 17 00:00:00 2001 From: Chris Packham Date: Wed, 29 Nov 2017 10:38:34 +1300 Subject: [PATCH 6/6] arm: mvebu: correct comments around cas_wl/cas_l The order of members in struct hws_topology_map is cas_wl, cas_l. The comments in the original db-88f6820-gp.c had this wrong and have been copied to other Armada-385 based boards. Practically this hasn't made a difference since all these boards set both cas_wl and cas_l to 0 (autodetect) but if there were ever a board that did need to set these explicitly they would run into unexpected issued. Update the comments to reflect the correct order of structure members. Reported-by: Tobi Wulff Signed-off-by: Chris Packham Reviewed-by: Stefan Roese Signed-off-by: Stefan Roese --- board/CZ.NIC/turris_omnia/turris_omnia.c | 4 ++-- board/Marvell/db-88f6820-amc/db-88f6820-amc.c | 2 +- board/Marvell/db-88f6820-gp/db-88f6820-gp.c | 2 +- board/gdsys/a38x/controlcenterdc.c | 2 +- board/solidrun/clearfog/clearfog.c | 2 +- 5 files changed, 6 insertions(+), 6 deletions(-) diff --git a/board/CZ.NIC/turris_omnia/turris_omnia.c b/board/CZ.NIC/turris_omnia/turris_omnia.c index af66837909..b03c0a3714 100644 --- a/board/CZ.NIC/turris_omnia/turris_omnia.c +++ b/board/CZ.NIC/turris_omnia/turris_omnia.c @@ -212,7 +212,7 @@ static struct hws_topology_map board_topology_map_1g = { BUS_WIDTH_16, /* memory_width */ MEM_4G, /* mem_size */ DDR_FREQ_800, /* frequency */ - 0, 0, /* cas_l cas_wl */ + 0, 0, /* cas_wl cas_l */ HWS_TEMP_NORMAL, /* temperature */ HWS_TIM_2T} }, /* timing (force 2t) */ 5, /* Num Of Bus Per Interface*/ @@ -231,7 +231,7 @@ static struct hws_topology_map board_topology_map_2g = { BUS_WIDTH_16, /* memory_width */ MEM_8G, /* mem_size */ DDR_FREQ_800, /* frequency */ - 0, 0, /* cas_l cas_wl */ + 0, 0, /* cas_wl cas_l */ HWS_TEMP_NORMAL, /* temperature */ HWS_TIM_2T} }, /* timing (force 2t) */ 5, /* Num Of Bus Per Interface*/ diff --git a/board/Marvell/db-88f6820-amc/db-88f6820-amc.c b/board/Marvell/db-88f6820-amc/db-88f6820-amc.c index ac58f90852..7db0095f75 100644 --- a/board/Marvell/db-88f6820-amc/db-88f6820-amc.c +++ b/board/Marvell/db-88f6820-amc/db-88f6820-amc.c @@ -68,7 +68,7 @@ static struct hws_topology_map board_topology_map = { BUS_WIDTH_8, /* memory_width */ MEM_2G, /* mem_size */ DDR_FREQ_800, /* frequency */ - 0, 0, /* cas_l cas_wl */ + 0, 0, /* cas_wl cas_l */ HWS_TEMP_LOW, /* temperature */ HWS_TIM_DEFAULT} }, /* timing */ 5, /* Num Of Bus Per Interface*/ diff --git a/board/Marvell/db-88f6820-gp/db-88f6820-gp.c b/board/Marvell/db-88f6820-gp/db-88f6820-gp.c index a1974cb4bd..b95cd1d4aa 100644 --- a/board/Marvell/db-88f6820-gp/db-88f6820-gp.c +++ b/board/Marvell/db-88f6820-gp/db-88f6820-gp.c @@ -89,7 +89,7 @@ static struct hws_topology_map board_topology_map = { BUS_WIDTH_8, /* memory_width */ MEM_4G, /* mem_size */ DDR_FREQ_800, /* frequency */ - 0, 0, /* cas_l cas_wl */ + 0, 0, /* cas_wl cas_l */ HWS_TEMP_LOW, /* temperature */ HWS_TIM_DEFAULT} }, /* timing */ 5, /* Num Of Bus Per Interface*/ diff --git a/board/gdsys/a38x/controlcenterdc.c b/board/gdsys/a38x/controlcenterdc.c index 32168d3576..3d74a6dfb8 100644 --- a/board/gdsys/a38x/controlcenterdc.c +++ b/board/gdsys/a38x/controlcenterdc.c @@ -52,7 +52,7 @@ static struct hws_topology_map ddr_topology_map = { BUS_WIDTH_16, /* memory_width */ MEM_4G, /* mem_size */ DDR_FREQ_533, /* frequency */ - 0, 0, /* cas_l cas_wl */ + 0, 0, /* cas_wl cas_l */ HWS_TEMP_LOW, /* temperature */ HWS_TIM_DEFAULT} }, /* timing */ 5, /* Num Of Bus Per Interface*/ diff --git a/board/solidrun/clearfog/clearfog.c b/board/solidrun/clearfog/clearfog.c index 8906636f76..1472e9793e 100644 --- a/board/solidrun/clearfog/clearfog.c +++ b/board/solidrun/clearfog/clearfog.c @@ -82,7 +82,7 @@ static struct hws_topology_map board_topology_map = { BUS_WIDTH_16, /* memory_width */ MEM_4G, /* mem_size */ DDR_FREQ_800, /* frequency */ - 0, 0, /* cas_l cas_wl */ + 0, 0, /* cas_wl cas_l */ HWS_TEMP_LOW, /* temperature */ HWS_TIM_DEFAULT} }, /* timing */ 5, /* Num Of Bus Per Interface*/