2020-03-13 12:42:44 -07:00
|
|
|
// SPDX-License-Identifier: GPL-2.0
|
|
|
|
/*
|
|
|
|
* Copyright (C) 2005, Intec Automation Inc.
|
|
|
|
* Copyright (C) 2014, Freescale Semiconductor, Inc.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include <linux/mtd/spi-nor.h>
|
|
|
|
|
|
|
|
#include "core.h"
|
|
|
|
|
|
|
|
static int
|
|
|
|
is25lp256_post_bfpt_fixups(struct spi_nor *nor,
|
|
|
|
const struct sfdp_parameter_header *bfpt_header,
|
2021-03-06 02:50:00 -07:00
|
|
|
const struct sfdp_bfpt *bfpt)
|
2020-03-13 12:42:44 -07:00
|
|
|
{
|
|
|
|
/*
|
2022-07-25 02:24:59 -07:00
|
|
|
* IS25LP256 supports 4B opcodes, but the BFPT advertises
|
|
|
|
* BFPT_DWORD1_ADDRESS_BYTES_3_ONLY.
|
|
|
|
* Overwrite the number of address bytes advertised by the BFPT.
|
2020-03-13 12:42:44 -07:00
|
|
|
*/
|
2022-12-25 21:01:59 -07:00
|
|
|
if ((bfpt->dwords[SFDP_DWORD(1)] & BFPT_DWORD1_ADDRESS_BYTES_MASK) ==
|
2020-03-13 12:42:44 -07:00
|
|
|
BFPT_DWORD1_ADDRESS_BYTES_3_ONLY)
|
2022-07-25 02:25:01 -07:00
|
|
|
nor->params->addr_nbytes = 4;
|
2020-03-13 12:42:44 -07:00
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2021-11-06 03:29:15 -07:00
|
|
|
static const struct spi_nor_fixups is25lp256_fixups = {
|
2020-03-13 12:42:44 -07:00
|
|
|
.post_bfpt = is25lp256_post_bfpt_fixups,
|
|
|
|
};
|
|
|
|
|
2023-07-26 00:52:47 -07:00
|
|
|
static int pm25lv_nor_late_init(struct spi_nor *nor)
|
2022-04-18 04:26:50 -07:00
|
|
|
{
|
|
|
|
struct spi_nor_erase_map *map = &nor->params->erase_map;
|
|
|
|
int i;
|
|
|
|
|
|
|
|
/* The PM25LV series has a different 4k sector erase opcode */
|
|
|
|
for (i = 0; i < SNOR_ERASE_TYPE_MAX; i++)
|
|
|
|
if (map->erase_type[i].size == 4096)
|
|
|
|
map->erase_type[i].opcode = SPINOR_OP_BE_4K_PMC;
|
2023-07-26 00:52:47 -07:00
|
|
|
|
|
|
|
return 0;
|
2022-04-18 04:26:50 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
static const struct spi_nor_fixups pm25lv_nor_fixups = {
|
|
|
|
.late_init = pm25lv_nor_late_init,
|
|
|
|
};
|
|
|
|
|
2022-02-23 06:43:35 -07:00
|
|
|
static const struct flash_info issi_nor_parts[] = {
|
2023-09-08 03:16:41 -07:00
|
|
|
{
|
2023-09-08 03:16:52 -07:00
|
|
|
.name = "pm25lv512",
|
|
|
|
.sector_size = SZ_32K,
|
|
|
|
.size = SZ_64K,
|
|
|
|
.no_sfdp_flags = SECT_4K,
|
|
|
|
.fixups = &pm25lv_nor_fixups
|
|
|
|
}, {
|
|
|
|
.name = "pm25lv010",
|
|
|
|
.sector_size = SZ_32K,
|
|
|
|
.size = SZ_128K,
|
|
|
|
.no_sfdp_flags = SECT_4K,
|
|
|
|
.fixups = &pm25lv_nor_fixups
|
|
|
|
}, {
|
2023-09-08 03:16:41 -07:00
|
|
|
.id = SNOR_ID(0x7f, 0x9d, 0x20),
|
|
|
|
.name = "is25cd512",
|
|
|
|
.sector_size = SZ_32K,
|
|
|
|
.size = SZ_64K,
|
|
|
|
.no_sfdp_flags = SECT_4K,
|
2023-09-08 03:16:52 -07:00
|
|
|
}, {
|
|
|
|
.id = SNOR_ID(0x7f, 0x9d, 0x46),
|
|
|
|
.name = "pm25lq032",
|
|
|
|
.size = SZ_4M,
|
|
|
|
.no_sfdp_flags = SECT_4K,
|
2023-09-08 03:16:41 -07:00
|
|
|
}, {
|
|
|
|
.id = SNOR_ID(0x9d, 0x40, 0x13),
|
|
|
|
.name = "is25lq040b",
|
|
|
|
.size = SZ_512K,
|
|
|
|
.no_sfdp_flags = SECT_4K | SPI_NOR_DUAL_READ | SPI_NOR_QUAD_READ,
|
|
|
|
}, {
|
|
|
|
.id = SNOR_ID(0x9d, 0x60, 0x14),
|
|
|
|
.name = "is25lp080d",
|
|
|
|
.size = SZ_1M,
|
|
|
|
.no_sfdp_flags = SECT_4K | SPI_NOR_DUAL_READ | SPI_NOR_QUAD_READ,
|
2023-09-08 03:16:52 -07:00
|
|
|
}, {
|
|
|
|
.id = SNOR_ID(0x9d, 0x60, 0x15),
|
|
|
|
.name = "is25lp016d",
|
|
|
|
.size = SZ_2M,
|
|
|
|
.no_sfdp_flags = SECT_4K | SPI_NOR_DUAL_READ | SPI_NOR_QUAD_READ,
|
2023-09-08 03:16:41 -07:00
|
|
|
}, {
|
|
|
|
.id = SNOR_ID(0x9d, 0x60, 0x16),
|
|
|
|
.name = "is25lp032",
|
|
|
|
.size = SZ_4M,
|
|
|
|
.no_sfdp_flags = SECT_4K | SPI_NOR_DUAL_READ,
|
|
|
|
}, {
|
|
|
|
.id = SNOR_ID(0x9d, 0x60, 0x17),
|
|
|
|
.name = "is25lp064",
|
|
|
|
.size = SZ_8M,
|
|
|
|
.no_sfdp_flags = SECT_4K | SPI_NOR_DUAL_READ,
|
|
|
|
}, {
|
|
|
|
.id = SNOR_ID(0x9d, 0x60, 0x18),
|
|
|
|
.name = "is25lp128",
|
|
|
|
.size = SZ_16M,
|
|
|
|
.no_sfdp_flags = SECT_4K | SPI_NOR_DUAL_READ,
|
|
|
|
}, {
|
|
|
|
.id = SNOR_ID(0x9d, 0x60, 0x19),
|
|
|
|
.name = "is25lp256",
|
|
|
|
.fixups = &is25lp256_fixups,
|
|
|
|
.fixup_flags = SPI_NOR_4B_OPCODES,
|
|
|
|
}, {
|
|
|
|
.id = SNOR_ID(0x9d, 0x70, 0x16),
|
|
|
|
.name = "is25wp032",
|
|
|
|
.size = SZ_4M,
|
|
|
|
.no_sfdp_flags = SECT_4K | SPI_NOR_DUAL_READ | SPI_NOR_QUAD_READ,
|
|
|
|
}, {
|
|
|
|
.id = SNOR_ID(0x9d, 0x70, 0x17),
|
|
|
|
.size = SZ_8M,
|
|
|
|
.name = "is25wp064",
|
|
|
|
.no_sfdp_flags = SECT_4K | SPI_NOR_DUAL_READ | SPI_NOR_QUAD_READ,
|
|
|
|
}, {
|
|
|
|
.id = SNOR_ID(0x9d, 0x70, 0x18),
|
|
|
|
.name = "is25wp128",
|
|
|
|
.size = SZ_16M,
|
|
|
|
.no_sfdp_flags = SECT_4K | SPI_NOR_DUAL_READ | SPI_NOR_QUAD_READ,
|
|
|
|
}, {
|
|
|
|
.id = SNOR_ID(0x9d, 0x70, 0x19),
|
|
|
|
.name = "is25wp256",
|
|
|
|
.flags = SPI_NOR_QUAD_PP,
|
|
|
|
.fixups = &is25lp256_fixups,
|
|
|
|
.fixup_flags = SPI_NOR_4B_OPCODES,
|
|
|
|
}
|
2020-03-13 12:42:44 -07:00
|
|
|
};
|
|
|
|
|
2022-02-23 06:43:35 -07:00
|
|
|
static void issi_nor_default_init(struct spi_nor *nor)
|
2020-03-13 12:42:44 -07:00
|
|
|
{
|
2020-03-13 12:42:53 -07:00
|
|
|
nor->params->quad_enable = spi_nor_sr1_bit6_quad_enable;
|
2020-03-13 12:42:44 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
static const struct spi_nor_fixups issi_fixups = {
|
2022-02-23 06:43:35 -07:00
|
|
|
.default_init = issi_nor_default_init,
|
2020-03-13 12:42:44 -07:00
|
|
|
};
|
|
|
|
|
|
|
|
const struct spi_nor_manufacturer spi_nor_issi = {
|
|
|
|
.name = "issi",
|
2022-02-23 06:43:35 -07:00
|
|
|
.parts = issi_nor_parts,
|
|
|
|
.nparts = ARRAY_SIZE(issi_nor_parts),
|
2020-03-13 12:42:44 -07:00
|
|
|
.fixups = &issi_fixups,
|
|
|
|
};
|