From 0dacf960248801afc7e5472d1435b0655f16a929 Mon Sep 17 00:00:00 2001 From: Srinivas Jagadam Date: Thu, 7 Dec 2023 09:45:42 +0530 Subject: [PATCH] driver: nand: qpic_nand: Add support for Gigadevice SPI nand device XT26Q12DWSIGA Change-Id: I42dad1c8c8a8af5dda9bd35b005e8089dd53cd60 Signed-off-by: Srinivas Jagadam --- drivers/mtd/nand/qpic_nand.c | 53 ++++++++++++++++++++++++++++++++++++ 1 file changed, 53 insertions(+) diff --git a/drivers/mtd/nand/qpic_nand.c b/drivers/mtd/nand/qpic_nand.c index 539b3ce258..ccca846347 100644 --- a/drivers/mtd/nand/qpic_nand.c +++ b/drivers/mtd/nand/qpic_nand.c @@ -413,10 +413,27 @@ static struct qpic_serial_nand_params qpic_serial_nand_tbl[] = { .check_quad_config = true, .name = "MX35UF1G24AD", }, + { + .id = { 0x0B, 0x55 }, + .page_size = 2048, + .erase_blk_size = 0x00020000, + .pgs_per_blk = 64, + .no_of_blocks = 2048, + .spare_size = 128, + .density = 0x10000000, + .otp_region = 0x2000, + .no_of_addr_cycle = 0x3, + .num_bits_ecc_correctability = 8, + .timing_mode_support = 0, + .quad_mode = true, + .check_quad_config = true, + .name = "XT26Q12DWSIGA", + }, }; struct qpic_serial_nand_params *serial_params; #define MICRON_DEVICE_ID 0x152c152c #define WINBOND_MFR_ID 0xef +#define XTX_MFR_ID 0x0b #define CMD3_MASK 0xfff0ffff /* * An array holding the fixed pattern to compare with @@ -1563,6 +1580,42 @@ int qpic_spi_nand_config(struct mtd_info *mtd) __func__); } } + + if (dev->vendor == XTX_MFR_ID) { + status = qpic_serial_get_feature(mtd, FLASH_SPI_NAND_FR_ADDR); + if (status < 0) { + printf("%s : Error in getting feature.\n",__func__); + return status; + } + + if (!((status >> 8) & FLASH_SPI_NAND_FR_BUFF_ENABLE)) { + qspi_debug("%s :continous buffer mode disabled\n", + __func__); + qspi_debug("%s : Issuing set feature command to enable it\n", + __func__); + status = qpic_serial_set_feature(mtd, FLASH_SPI_NAND_FR_ADDR, + (FLASH_SPI_NAND_FR_BUFF_ENABLE | (status >> 8))); + if (status < 0) { + printf("%s : Error in disabling continous buffer bit.\n", + __func__); + return status; + } + } else { + status = qpic_serial_set_feature(mtd, FLASH_SPI_NAND_FR_ADDR, + (FLASH_SPI_NAND_FR_BUFF_ENABLE & ~(status >> 8))); + if (status < 0) { + printf("%s : Error in disabling continous buffer bit.\n", + __func__); + return status; + } + status = qpic_serial_get_feature(mtd, FLASH_SPI_NAND_FR_ADDR); + if (status < 0) { + printf("%s : Error in getting feature.\n",__func__); + return status; + } + } + } + /* Enable QUAD mode if device supported. Check this condition only * if dev->quad_mode = true , means device will support Quad mode * else no need to check for Quad mode.