mtd: ipq5018: remove CONFIG_CMD_NAND from tiny nor

This changes add CONFIG_CMD_NAND flags in flash command and smem
source file to eliminate nand specific source if CONFIG_CMD_NAND
is not defined.

This changes replace CONFIG_IPQ_MTD_NOR with CONFIG_MTD_DEVICE flag

Signed-off-by: Vandhiadevan Karunamoorthy <vkarunam@codeaurora.org>
Change-Id: I612ae89c3730dc86f2693088fb4cb5c10763165d
This commit is contained in:
Vandhiadevan Karunamoorthy 2020-07-17 12:43:30 +05:30 committed by Gerrit - the friendly Code Review server
parent 24d30ab2b2
commit 81ba78ca06
8 changed files with 41 additions and 20 deletions

View file

@ -508,7 +508,7 @@ unsigned int get_rootfs_active_partition(void)
return 0; /* alt partition not available */
}
#ifdef CONFIG_CMD_NAND
/*
* get nand block size by device id.
* dev_id is 0 for parallel nand.
@ -522,16 +522,20 @@ uint32_t get_nand_block_size(uint8_t dev_id)
return mtd->erasesize;
}
#endif
/*
* get flash block size based on partition name.
*/
static inline uint32_t get_flash_block_size(char *name,
qca_smem_flash_info_t *smem)
{
#ifdef CONFIG_CMD_NAND
return (get_which_flash_param(name) == 1) ?
get_nand_block_size(is_spi_nand_available())
: smem->flash_block_size;
#else
return smem->flash_block_size;
#endif
}
#define part_which_flash(p) (((p)->attr & 0xff000000) >> 24)
@ -539,9 +543,13 @@ static inline uint32_t get_flash_block_size(char *name,
static inline uint32_t get_part_block_size(struct smem_ptn *p,
qca_smem_flash_info_t *sfi)
{
#ifdef CONFIG_CMD_NAND
return (part_which_flash(p) == 1) ?
get_nand_block_size(is_spi_nand_available())
: sfi->flash_block_size;
#else
return sfi->flash_block_size;
#endif
}
void qca_set_part_entry(char *name, qca_smem_flash_info_t *smem,
@ -611,8 +619,13 @@ int smem_getpart(char *part_name, uint32_t *start, uint32_t *size)
* Partition size is 'till end of device', calculate
* appropriately
*/
#ifdef CONFIG_CMD_NAND
*size = (nand_info[get_device_id_by_part(p)].size /
bsize) - p->start;
#else
*size = 0;
bsize = bsize;
#endif
} else {
*size = p->size;
}
@ -885,8 +898,12 @@ void qca_smem_part_to_mtdparts(char *mtdid, int len)
* Partition size is 'till end of device', calculate
* appropriately
*/
#ifdef CONFIG_CMD_NAND
psize = (nand_info[get_device_id_by_part(p)].size
- (((loff_t)p->start) * bsize));
#else
psize = 0;
#endif
} else {
psize = ((loff_t)p->size) * bsize;
}
@ -957,8 +974,12 @@ int getpart_offset_size(char *part_name, uint32_t *offset, uint32_t *size)
* Partition size is 'till end of device', calculate
* appropriately
*/
#ifdef CONFIG_CMD_NAND
psize = nand_info[get_device_id_by_part(p)].size
- (((loff_t)p->start) * bsize);
#else
psize = 0;
#endif
} else {
psize = ((loff_t)p->size) * bsize;
}
@ -1110,8 +1131,12 @@ int do_smeminfo(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
* Partition size is 'till end of device', calculate
* appropriately
*/
#ifdef CONFIG_CMD_NAND
psize = nand_info[get_device_id_by_part(p)].size
- (((loff_t)p->start) * bsize);
#else
psize = 0;
#endif
} else {
psize = ((loff_t)p->size) * bsize;
}

View file

@ -46,7 +46,7 @@ DECLARE_GLOBAL_DATA_PTR;
struct sdhci_host mmc_host;
#endif
#ifdef CONFIG_IPQ_MTD_NOR
#ifdef CONFIG_MTD_DEVICE
extern int ipq_spi_init(u16);
#endif
@ -596,7 +596,7 @@ void board_nand_init(void)
gpio_node = fdt_path_offset(gd->fdt_blob, "/spi/spi_gpio");
if (gpio_node >= 0) {
qca_gpio_init(gpio_node);
#ifdef CONFIG_IPQ_MTD_NOR
#ifdef CONFIG_MTD_DEVICE
ipq_spi_init(CONFIG_IPQ_SPI_NOR_INFO_IDX);
#endif
}

View file

@ -141,9 +141,7 @@ obj-$(CONFIG_CMD_MMC) += cmd_mmc.o
obj-$(CONFIG_CMD_MMC_SPI) += cmd_mmc_spi.o
obj-$(CONFIG_MP) += cmd_mp.o
obj-$(CONFIG_CMD_MTDPARTS) += cmd_mtdparts.o
ifndef CONFIG_IPQ_TINY
obj-$(CONFIG_CMD_NAND) += cmd_nand.o
endif
obj-$(CONFIG_CMD_NET) += cmd_net.o
obj-$(CONFIG_CMD_ONENAND) += cmd_onenand.o
obj-$(CONFIG_CMD_OTP) += cmd_otp.o

View file

@ -202,8 +202,9 @@ char * const argv[])
#endif
disk_partition_t disk_info = {0};
qca_smem_flash_info_t *sfi = &qca_smem_flash_info;
#ifdef CONFIG_CMD_NAND
nand_info_t *nand = &nand_info[CONFIG_NAND_FLASH_INFO_IDX];
#endif
if (strcmp(argv[0], "flash") == 0)
flash_cmd = 1;
@ -350,7 +351,7 @@ char * const argv[])
}
if (flash_cmd) {
#ifdef CONFIG_CMD_NAND
if (((flash_type == SMEM_BOOT_NAND_FLASH) ||
(flash_type == SMEM_BOOT_QSPI_NAND_FLASH))) {
@ -358,7 +359,7 @@ char * const argv[])
if (adj_size)
file_size = file_size + (nand->writesize - adj_size);
}
#endif
if (flash_type == SMEM_BOOT_MMC_FLASH) {
if (disk_info.blksz) {

View file

@ -230,7 +230,7 @@ CONFIG_QPIC_SERIAL=y
# CONFIG_DM_ETH is not set
# CONFIG_PHYLIB is not set
# CONFIG_NETDEVICES is not set
CONFIG_IPQ_MTD_NOR=y
# CONFIG_IPQ_MTD_NOR is not set
# CONFIG_IPQ_TINY_SPI_NOR is not set
#

View file

@ -130,7 +130,7 @@ static int ipq_spi_block_markbad(struct mtd_info *mtd, loff_t offs)
int ipq_spi_init(u16 idx)
{
struct spi_flash *flash;
int ret;
int ret = 0;
struct mtd_info *mtd;
flash = spi_flash_probe(CONFIG_SF_DEFAULT_BUS,
@ -163,14 +163,14 @@ int ipq_spi_init(u16 idx)
mtd->_write_oob = ipq_spi_write_oob;
mtd->_block_isbad = ipq_spi_block_isbad;
mtd->_block_markbad = ipq_spi_block_markbad;
#ifdef CONFIG_MTD_DEVICE
if ((ret = nand_register(idx)) < 0) {
spi_print("Failed to register with MTD subsystem\n");
return ret;
}
#endif
spi_print("page_size: 0x%x, sector_size: 0x%x, size: 0x%x\n",
flash->page_size, flash->sector_size, flash->size);
return 0;
return ret;
}

View file

@ -27,9 +27,6 @@ else # not spl
NORMAL_DRIVERS=y
ifdef CONFIG_IPQ_TINY
obj-y += nand.o
else
obj-y += nand.o
obj-y += nand_bbt.o
obj-y += nand_ids.o
@ -37,7 +34,7 @@ obj-y += nand_util.o
obj-y += nand_ecc.o
obj-y += nand_base.o
obj-y += nand_timings.o
endif
endif # not spl
ifdef NORMAL_DRIVERS

View file

@ -144,11 +144,11 @@ extern loff_t board_env_size;
* CONFIG_IPQ_NAND: QPIC NAND in FIFO/block mode.
* BAM is enabled by default.
*/
#define CONFIG_CMD_NAND
#define CONFIG_SYS_NAND_SELF_INIT
#define CONFIG_CMD_MTDPARTS
#define CONFIG_SYS_NAND_SELF_INIT
#ifdef CONFIG_NAND_FLASH
#define CONFIG_CMD_NAND
#define CONFIG_ENV_IS_IN_NAND 1
#define CONFIG_QPIC_NAND
#define CONFIG_SYS_NAND_ONFI_DETECTION