mirror of
https://git.codelinaro.org/clo/qsdk/oss/boot/u-boot-2016.git
synced 2026-01-28 01:47:24 +01:00
Flash: ipq5018: Add SPI-NAND flash support
Change-Id: I45d73fdd7e7315f110e4691a7dc9fe6698c51c37 Signed-off-by: Vandhiadevan Karunamoorthy <vkarunam@codeaurora.org>
This commit is contained in:
parent
7e457276d2
commit
bbbdb8e5ab
8 changed files with 45 additions and 24 deletions
|
|
@ -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)
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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) ||
|
||||
|
|
|
|||
|
|
@ -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");
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
|
|
|||
|
|
@ -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) {
|
||||
|
|
|
|||
|
|
@ -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)
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue