diff --git a/arch/arm/cpu/armv7/qca/common/smem.c b/arch/arm/cpu/armv7/qca/common/smem.c index 5a1ea3c7f6..8712228c2a 100644 --- a/arch/arm/cpu/armv7/qca/common/smem.c +++ b/arch/arm/cpu/armv7/qca/common/smem.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013, 2015-2017 The Linux Foundation. All rights reserved. + * Copyright (c) 2013, 2015-2017, 2020 The Linux Foundation. All rights reserved. * * Based on smem.c from lk. * @@ -986,7 +986,8 @@ int ubi_set_rootfs_part(void) char runcmd[256]; int i; - if (sfi->flash_type == SMEM_BOOT_NAND_FLASH) { + if (((sfi->flash_type == SMEM_BOOT_NAND_FLASH) || + (sfi->flash_type == SMEM_BOOT_QSPI_NAND_FLASH))) { ret = smem_getpart(QCA_ROOT_FS_PART_NAME, &start_block, &size_block); if (ret) diff --git a/arch/arm/include/asm/arch-qca-common/smem.h b/arch/arm/include/asm/arch-qca-common/smem.h index 21cc06e70d..fdf48e3815 100644 --- a/arch/arm/include/asm/arch-qca-common/smem.h +++ b/arch/arm/include/asm/arch-qca-common/smem.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015-2017 The Linux Foundation. All rights reserved. + * Copyright (c) 2015-2017, 2020 The Linux Foundation. All rights reserved. * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License version 2 and @@ -39,6 +39,7 @@ enum { SMEM_BOOT_SPI_FLASH = 6, SMEM_BOOT_NORPLUSNAND = 7, SMEM_BOOT_NORPLUSEMMC = 8, + SMEM_BOOT_QSPI_NAND_FLASH = 11, }; struct version_entry diff --git a/board/qca/arm/common/board_init.c b/board/qca/arm/common/board_init.c index 7210387e36..d4b98280d2 100644 --- a/board/qca/arm/common/board_init.c +++ b/board/qca/arm/common/board_init.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015-2017 The Linux Foundation. All rights reserved. + * Copyright (c) 2015-2017, 2020 The Linux Foundation. All rights reserved. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License version 2 and @@ -139,6 +139,7 @@ int board_init(void) #ifndef CONFIG_ENV_IS_NOWHERE switch (sfi->flash_type) { case SMEM_BOOT_NAND_FLASH: + case SMEM_BOOT_QSPI_NAND_FLASH: nand_env_device = CONFIG_NAND_FLASH_INFO_IDX; break; case SMEM_BOOT_SPI_FLASH: @@ -165,6 +166,7 @@ int board_init(void) switch (sfi->flash_type) { case SMEM_BOOT_NAND_FLASH: + case SMEM_BOOT_QSPI_NAND_FLASH: board_env_range = CONFIG_ENV_SIZE_MAX; BUG_ON(board_env_size < CONFIG_ENV_SIZE_MAX); break; @@ -230,7 +232,8 @@ int get_current_flash_type(uint32_t *flash_type) if (*flash_type == SMEM_BOOT_SPI_FLASH) { if (get_which_flash_param("rootfs") || - sfi->flash_secondary_type == SMEM_BOOT_NAND_FLASH) + ((sfi->flash_secondary_type == SMEM_BOOT_NAND_FLASH) || + (sfi->flash_secondary_type == SMEM_BOOT_QSPI_NAND_FLASH))) *flash_type = SMEM_BOOT_NORPLUSNAND; else { if ((sfi->rootfs.offset == 0xBAD0FF5E) || diff --git a/board/qca/arm/common/cmd_bootqca.c b/board/qca/arm/common/cmd_bootqca.c index 4385a53273..590fac47b8 100644 --- a/board/qca/arm/common/cmd_bootqca.c +++ b/board/qca/arm/common/cmd_bootqca.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015-2017 The Linux Foundation. All rights reserved. + * Copyright (c) 2015-2017, 2020 The Linux Foundation. All rights reserved. * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License version 2 and @@ -99,7 +99,8 @@ static int set_fs_bootargs(int *fs_on_nand) if (sfi->flash_type == SMEM_BOOT_SPI_FLASH) { if (get_which_flash_param("rootfs") || - sfi->flash_secondary_type == SMEM_BOOT_NAND_FLASH) { + ((sfi->flash_secondary_type == SMEM_BOOT_NAND_FLASH) || + (sfi->flash_secondary_type == SMEM_BOOT_QSPI_NAND_FLASH))) { bootargs = nand_rootfs; *fs_on_nand = 1; @@ -152,7 +153,8 @@ static int set_fs_bootargs(int *fs_on_nand) if (getenv("fsbootargs") == NULL) setenv("fsbootargs", bootargs); } - } else if (sfi->flash_type == SMEM_BOOT_NAND_FLASH) { + } else if (((sfi->flash_type == SMEM_BOOT_NAND_FLASH) || + (sfi->flash_type == SMEM_BOOT_QSPI_NAND_FLASH))) { bootargs = nand_rootfs; if (getenv("fsbootargs") == NULL) setenv("fsbootargs", bootargs); @@ -448,7 +450,8 @@ static int do_boot_signedimg(cmd_tbl_t *cmdtp, int flag, int argc, char *const a if (debug) { printf("Using nand device %d\n", CONFIG_SPI_FLASH_INFO_IDX); } - } else if (sfi->flash_type == SMEM_BOOT_NAND_FLASH) { + } else if (((sfi->flash_type == SMEM_BOOT_NAND_FLASH) || + (sfi->flash_type == SMEM_BOOT_QSPI_NAND_FLASH))) { if (debug) { printf("Using nand device 0\n"); } @@ -684,7 +687,8 @@ static int do_boot_unsignedimg(cmd_tbl_t *cmdtp, int flag, int argc, char *const printf("Booting from flash\n"); } - if (sfi->flash_type == SMEM_BOOT_NAND_FLASH) { + if (((sfi->flash_type == SMEM_BOOT_NAND_FLASH) || + (sfi->flash_type == SMEM_BOOT_QSPI_NAND_FLASH))) { if (debug) { printf("Using nand device 0\n"); } diff --git a/board/qca/arm/common/crashdump.c b/board/qca/arm/common/crashdump.c index 49c7bd6d75..a3efdfcd98 100644 --- a/board/qca/arm/common/crashdump.c +++ b/board/qca/arm/common/crashdump.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015-2018 The Linux Foundation. All rights reserved. + * Copyright (c) 2015-2018, 2020 The Linux Foundation. All rights reserved. * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License version 2 and @@ -1111,7 +1111,8 @@ static int qca_wdt_write_crashdump_data( * Determine the flash type and initialize function pointer for flash * operations and its context which needs to be passed to these functions */ - if (flash_type == SMEM_BOOT_NAND_FLASH) { + if (((flash_type == SMEM_BOOT_NAND_FLASH) || + (flash_type == SMEM_BOOT_QSPI_NAND_FLASH))) { crashdump_cnxt = (void *)&crashdump_nand_cnxt; crashdump_flash_write_init = init_crashdump_nand_flash_write; crashdump_flash_write = crashdump_nand_flash_write_data; @@ -1202,6 +1203,8 @@ int do_dumpqca_minimal_data(const char *offset) if (sfi->flash_type == SMEM_BOOT_NAND_FLASH) { flash_type = SMEM_BOOT_NAND_FLASH; + } else if (sfi->flash_type == SMEM_BOOT_QSPI_NAND_FLASH) { + flash_type = SMEM_BOOT_QSPI_NAND_FLASH; } else if (sfi->flash_type == SMEM_BOOT_SPI_FLASH) { flash_type = SMEM_BOOT_SPI_FLASH; #ifdef CONFIG_QCA_MMC diff --git a/board/qca/arm/common/ethaddr.c b/board/qca/arm/common/ethaddr.c index 36765c2618..cd7af73610 100644 --- a/board/qca/arm/common/ethaddr.c +++ b/board/qca/arm/common/ethaddr.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016-2017 The Linux Foundation. All rights reserved. + * Copyright (c) 2016-2017, 2020 The Linux Foundation. All rights reserved. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License version 2 and @@ -51,6 +51,8 @@ int get_eth_mac_address(uchar *enetaddr, uint no_of_macs) flash_type = CONFIG_SPI_FLASH_INFO_IDX; else if (qca_smem_flash_info.flash_type == SMEM_BOOT_NAND_FLASH) flash_type = CONFIG_NAND_FLASH_INFO_IDX; + else if (qca_smem_flash_info.flash_type == SMEM_BOOT_QSPI_NAND_FLASH) + flash_type = CONFIG_NAND_FLASH_INFO_IDX; else { printf("Unknown flash type\n"); return -EINVAL; diff --git a/board/qca/arm/common/fdt_fixup.c b/board/qca/arm/common/fdt_fixup.c index 99dda2c82d..c3101bdf42 100644 --- a/board/qca/arm/common/fdt_fixup.c +++ b/board/qca/arm/common/fdt_fixup.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015-2017 The Linux Foundation. All rights reserved. + * Copyright (c) 2015-2017, 2020 The Linux Foundation. All rights reserved. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License version 2 and @@ -640,6 +640,7 @@ int ft_board_setup(void *blob, bd_t *bd) { "qcom,msm-nand", MTD_DEV_TYPE_NAND, 0 }, { "qcom,qcom_nand", MTD_DEV_TYPE_NAND, 0 }, { "qcom,ebi2-nandc-bam-v1.5.0", MTD_DEV_TYPE_NAND, 0 }, + { "qcom,ebi2-nandc-bam-v2.1.1", MTD_DEV_TYPE_NAND, 0 }, { "spinand,mt29f", MTD_DEV_TYPE_NAND, 1 }, { "n25q128a11", MTD_DEV_TYPE_NAND, CONFIG_IPQ_SPI_NOR_INFO_IDX }, @@ -652,7 +653,8 @@ int ft_board_setup(void *blob, bd_t *bd) #ifndef CONFIG_QCA_APPSBL_DLOAD ipq_fdt_mem_rsvd_fixup(blob); #endif - if (sfi->flash_type == SMEM_BOOT_NAND_FLASH) { + if (((sfi->flash_type == SMEM_BOOT_NAND_FLASH) || + (sfi->flash_type == SMEM_BOOT_QSPI_NAND_FLASH))) { snprintf(parts_str, sizeof(parts_str), "mtdparts=nand0"); } else if (sfi->flash_type == SMEM_BOOT_SPI_FLASH) { /* Patch NOR block size and density for @@ -660,7 +662,8 @@ int ft_board_setup(void *blob, bd_t *bd) ipq_fdt_fixup_spi_nor_params(blob); snprintf(parts_str,sizeof(parts_str), "mtdparts=" QCA_SPI_NOR_DEVICE); - if (sfi->flash_secondary_type == SMEM_BOOT_NAND_FLASH) { + if ((sfi->flash_secondary_type == SMEM_BOOT_NAND_FLASH) || + (sfi->flash_secondary_type == SMEM_BOOT_QSPI_NAND_FLASH)) { if(smem_bootconfig_info() == 0) activepart = get_rootfs_active_partition(); if (!activepart) { diff --git a/common/cmd_flashwrite.c b/common/cmd_flashwrite.c index 3bc958bd41..6e2be1a803 100644 --- a/common/cmd_flashwrite.c +++ b/common/cmd_flashwrite.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018, The Linux Foundation. All rights reserved. + * Copyright (c) 2018, 2020 The Linux Foundation. All rights reserved. * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License version 2 and @@ -40,7 +40,8 @@ uint32_t part_size, uint32_t file_size, char *layout) char runcmd[256]; int nand_dev = CONFIG_NAND_FLASH_INFO_IDX; - if (flash_type == SMEM_BOOT_NAND_FLASH) { + if (((flash_type == SMEM_BOOT_NAND_FLASH) || + (flash_type == SMEM_BOOT_QSPI_NAND_FLASH))) { snprintf(runcmd, sizeof(runcmd), "nand device %d && ", nand_dev); @@ -86,7 +87,8 @@ static int fl_erase(int flash_type, uint32_t offset, uint32_t part_size, char runcmd[256]; int nand_dev = CONFIG_NAND_FLASH_INFO_IDX; - if (flash_type == SMEM_BOOT_NAND_FLASH) { + if (((flash_type == SMEM_BOOT_NAND_FLASH) || + (flash_type == SMEM_BOOT_QSPI_NAND_FLASH))) { snprintf(runcmd, sizeof(runcmd), "nand device %d && ", nand_dev); if (strcmp(layout, "default") != 0) { @@ -239,7 +241,8 @@ char * const argv[]) flash_type = sfi->flash_type; part_name = argv[1]; - if (sfi->flash_type == SMEM_BOOT_NAND_FLASH) { + if (((sfi->flash_type == SMEM_BOOT_NAND_FLASH) || + (sfi->flash_type == SMEM_BOOT_QSPI_NAND_FLASH))) { ret = smem_getpart(part_name, &start_block, &size_block); if (ret) { @@ -295,11 +298,11 @@ char * const argv[]) if (ret) return retn; - } else if ((sfi->flash_secondary_type == SMEM_BOOT_NAND_FLASH) + } else if (((sfi->flash_secondary_type == SMEM_BOOT_NAND_FLASH)|| + (sfi->flash_secondary_type == SMEM_BOOT_QSPI_NAND_FLASH)) && (strncmp(part_name, "rootfs", 6) == 0)) { - /* IPQ806X - NOR + NAND */ - flash_type = SMEM_BOOT_NAND_FLASH; + flash_type = sfi->flash_secondary_type; if (sfi->rootfs.offset == 0xBAD0FF5E) { if (smem_bootconfig_info() == 0) @@ -348,7 +351,8 @@ char * const argv[]) if (flash_cmd) { - if (flash_type == SMEM_BOOT_NAND_FLASH) { + if (((flash_type == SMEM_BOOT_NAND_FLASH) || + (flash_type == SMEM_BOOT_QSPI_NAND_FLASH))) { adj_size = file_size % nand->writesize; if (adj_size)