Back to home page

OSCL-LXR

 
 

    


0001 // SPDX-License-Identifier: GPL-2.0
0002 /*
0003  * Copyright (C) 2005, Intec Automation Inc.
0004  * Copyright (C) 2014, Freescale Semiconductor, Inc.
0005  */
0006 
0007 #include <linux/mtd/spi-nor.h>
0008 
0009 #include "core.h"
0010 
0011 static int
0012 is25lp256_post_bfpt_fixups(struct spi_nor *nor,
0013                const struct sfdp_parameter_header *bfpt_header,
0014                const struct sfdp_bfpt *bfpt)
0015 {
0016     /*
0017      * IS25LP256 supports 4B opcodes, but the BFPT advertises
0018      * BFPT_DWORD1_ADDRESS_BYTES_3_ONLY.
0019      * Overwrite the number of address bytes advertised by the BFPT.
0020      */
0021     if ((bfpt->dwords[BFPT_DWORD(1)] & BFPT_DWORD1_ADDRESS_BYTES_MASK) ==
0022         BFPT_DWORD1_ADDRESS_BYTES_3_ONLY)
0023         nor->params->addr_nbytes = 4;
0024 
0025     return 0;
0026 }
0027 
0028 static const struct spi_nor_fixups is25lp256_fixups = {
0029     .post_bfpt = is25lp256_post_bfpt_fixups,
0030 };
0031 
0032 static void pm25lv_nor_late_init(struct spi_nor *nor)
0033 {
0034     struct spi_nor_erase_map *map = &nor->params->erase_map;
0035     int i;
0036 
0037     /* The PM25LV series has a different 4k sector erase opcode */
0038     for (i = 0; i < SNOR_ERASE_TYPE_MAX; i++)
0039         if (map->erase_type[i].size == 4096)
0040             map->erase_type[i].opcode = SPINOR_OP_BE_4K_PMC;
0041 }
0042 
0043 static const struct spi_nor_fixups pm25lv_nor_fixups = {
0044     .late_init = pm25lv_nor_late_init,
0045 };
0046 
0047 static const struct flash_info issi_nor_parts[] = {
0048     /* ISSI */
0049     { "is25cd512",  INFO(0x7f9d20, 0, 32 * 1024,   2)
0050         NO_SFDP_FLAGS(SECT_4K) },
0051     { "is25lq040b", INFO(0x9d4013, 0, 64 * 1024,   8)
0052         NO_SFDP_FLAGS(SECT_4K | SPI_NOR_DUAL_READ | SPI_NOR_QUAD_READ) },
0053     { "is25lp016d", INFO(0x9d6015, 0, 64 * 1024,  32)
0054         NO_SFDP_FLAGS(SECT_4K | SPI_NOR_DUAL_READ | SPI_NOR_QUAD_READ) },
0055     { "is25lp080d", INFO(0x9d6014, 0, 64 * 1024,  16)
0056         NO_SFDP_FLAGS(SECT_4K | SPI_NOR_DUAL_READ | SPI_NOR_QUAD_READ) },
0057     { "is25lp032",  INFO(0x9d6016, 0, 64 * 1024,  64)
0058         NO_SFDP_FLAGS(SECT_4K | SPI_NOR_DUAL_READ) },
0059     { "is25lp064",  INFO(0x9d6017, 0, 64 * 1024, 128)
0060         NO_SFDP_FLAGS(SECT_4K | SPI_NOR_DUAL_READ) },
0061     { "is25lp128",  INFO(0x9d6018, 0, 64 * 1024, 256)
0062         NO_SFDP_FLAGS(SECT_4K | SPI_NOR_DUAL_READ) },
0063     { "is25lp256",  INFO(0x9d6019, 0, 64 * 1024, 512)
0064         PARSE_SFDP
0065         FIXUP_FLAGS(SPI_NOR_4B_OPCODES)
0066         .fixups = &is25lp256_fixups },
0067     { "is25wp032",  INFO(0x9d7016, 0, 64 * 1024,  64)
0068         NO_SFDP_FLAGS(SECT_4K | SPI_NOR_DUAL_READ | SPI_NOR_QUAD_READ) },
0069     { "is25wp064",  INFO(0x9d7017, 0, 64 * 1024, 128)
0070         NO_SFDP_FLAGS(SECT_4K | SPI_NOR_DUAL_READ | SPI_NOR_QUAD_READ) },
0071     { "is25wp128",  INFO(0x9d7018, 0, 64 * 1024, 256)
0072         NO_SFDP_FLAGS(SECT_4K | SPI_NOR_DUAL_READ | SPI_NOR_QUAD_READ) },
0073     { "is25wp256", INFO(0x9d7019, 0, 64 * 1024, 512)
0074         NO_SFDP_FLAGS(SECT_4K | SPI_NOR_DUAL_READ | SPI_NOR_QUAD_READ)
0075         FIXUP_FLAGS(SPI_NOR_4B_OPCODES)
0076         .fixups = &is25lp256_fixups },
0077 
0078     /* PMC */
0079     { "pm25lv512",   INFO(0,        0, 32 * 1024,    2)
0080         NO_SFDP_FLAGS(SECT_4K)
0081         .fixups = &pm25lv_nor_fixups
0082     },
0083     { "pm25lv010",   INFO(0,        0, 32 * 1024,    4)
0084         NO_SFDP_FLAGS(SECT_4K)
0085         .fixups = &pm25lv_nor_fixups
0086     },
0087     { "pm25lq032",   INFO(0x7f9d46, 0, 64 * 1024,   64)
0088         NO_SFDP_FLAGS(SECT_4K) },
0089 };
0090 
0091 static void issi_nor_default_init(struct spi_nor *nor)
0092 {
0093     nor->params->quad_enable = spi_nor_sr1_bit6_quad_enable;
0094 }
0095 
0096 static const struct spi_nor_fixups issi_fixups = {
0097     .default_init = issi_nor_default_init,
0098 };
0099 
0100 const struct spi_nor_manufacturer spi_nor_issi = {
0101     .name = "issi",
0102     .parts = issi_nor_parts,
0103     .nparts = ARRAY_SIZE(issi_nor_parts),
0104     .fixups = &issi_fixups,
0105 };