Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

Merge tag 'mtd/for-6.7' of git://git.kernel.org/pub/scm/linux/kernel/git/mtd/linux

Pull mtd updates from Miquel Raynal:
"The main set of changes is related to Uwe's work converting platform
remove callbacks to return void. Comes next (in number of changes)
Kees' additional structures annotations to improve the sanitizers. The
usual amount of cleanups apply.

About the more substancial contribution, one main function of the
partitions core could return an error which was not checked, this is
now fixed. On the bindings side, fixed partitions can now have a
compression property. Finally, an erroneous situation is now always
avoided in the MAP RAM driver.

CFI:

- A several years old byte swap has been fixed.

NAND:

- The subsystem has, as usual, seen a bit of cleanup being done this
cycle, typically return values of platform_get_irq() and
devm_kasprintf(). There is also a better ECC check in the Arasan
driver. This comes with smaller misc changes.

- In the SPI-NAND world there is now support for Foresee F35SQA002G,
Winbond W25N and XTX XT26 chips.

SPI NOR:

- For SPI NOR we cleaned the flash info entries in order to have them
slimmer and self explanatory. In order to make the entries as slim
as possible, we introduced sane default values so that the actual
flash entries don't need to specify them. We now use a flexible
macro to specify the flash ID instead of the previous INFOx()
macros that had hardcoded ID lengths.

Instead of:

{ "w25q512nwm", INFO(0xef8020, 0, 64 * 1024, 0)
OTP_INFO(256, 3, 0x1000, 0x1000) },

We now use:

.id = SNOR_ID(0xef, 0x80, 0x20),
.name = "w25q512nwm",
.otp = SNOR_OTP(256, 3, 0x1000, 0x1000),

- We also removed some flash entries: the very old Catalyst SPI
EEPROMs that were introduced once with the SPI-NOR subsystem, and a
Fujitsu MRAM. Both should use the at25 EEPROM driver. The latter
even has device tree bindings for the at25 driver.

- We made sure that the conversion didn't introduce any unwanted
changes by comparing the .rodata segment before and after the
conversion. The patches landed in linux-next immediately after
v6.6-rc2, we haven't seen any regressions yet.

- Apart of the autumn cleaning we introduced a new flash entry,
at25ff321a, and added block protection support for mt25qu512a"

* tag 'mtd/for-6.7' of git://git.kernel.org/pub/scm/linux/kernel/git/mtd/linux: (91 commits)
mtd: cfi_cmdset_0001: Byte swap OTP info
mtd: rawnand: meson: check return value of devm_kasprintf()
mtd: rawnand: intel: check return value of devm_kasprintf()
mtd: rawnand: sh_flctl: Convert to module_platform_driver()
mtd: spi-nor: micron-st: use SFDP table for mt25qu512a
mtd: spi-nor: micron-st: enable lock/unlock for mt25qu512a
mtd: rawnand: Remove unused of_gpio.h inclusion
mtd: spinand: Add support for XTX XT26xxxDxxxxx
mtd: spinand: winbond: add support for serial NAND flash
mtd: rawnand: cadence: Annotate struct cdns_nand_chip with __counted_by
mtd: rawnand: Annotate struct mtk_nfc_nand_chip with __counted_by
mtd: spinand: add support for FORESEE F35SQA002G
mtd: rawnand: rockchip: Use struct_size()
mtd: rawnand: arasan: Include ECC syndrome along with in-band data while checking for ECC failure
mtd: Use device_get_match_data()
mtd: spi-nor: nxp-spifi: Convert to platform remove callback returning void
mtd: spi-nor: hisi-sfc: Convert to platform remove callback returning void
mtd: maps: sun_uflash: Convert to platform remove callback returning void
mtd: maps: sa1100-flash: Convert to platform remove callback returning void
mtd: maps: pxa2xx-flash: Convert to platform remove callback returning void
...

+1819 -988
+19
Documentation/devicetree/bindings/mtd/partitions/fixed-partitions.yaml
··· 29 29 30 30 "#size-cells": true 31 31 32 + compression: 33 + $ref: /schemas/types.yaml#/definitions/string 34 + description: | 35 + Compression algorithm used to store the data in this partition, chosen 36 + from a list of well-known algorithms. 37 + 38 + The contents are compressed using this algorithm. 39 + 40 + enum: 41 + - none 42 + - bzip2 43 + - gzip 44 + - lzop 45 + - lz4 46 + - lzma 47 + - xz 48 + - zstd 49 + 32 50 patternProperties: 33 51 "@[0-9a-f]+$": 34 52 $ref: partition.yaml# ··· 82 64 83 65 uimage@100000 { 84 66 reg = <0x0100000 0x200000>; 67 + compress = "lzma"; 85 68 }; 86 69 }; 87 70
+18 -2
drivers/mtd/chips/cfi_cmdset_0001.c
··· 422 422 extra_size = 0; 423 423 424 424 /* Protection Register info */ 425 - if (extp->NumProtectionFields) 425 + if (extp->NumProtectionFields) { 426 + struct cfi_intelext_otpinfo *otp = 427 + (struct cfi_intelext_otpinfo *)&extp->extra[0]; 428 + 426 429 extra_size += (extp->NumProtectionFields - 1) * 427 - sizeof(struct cfi_intelext_otpinfo); 430 + sizeof(struct cfi_intelext_otpinfo); 431 + 432 + if (extp_size >= sizeof(*extp) + extra_size) { 433 + int i; 434 + 435 + /* Do some byteswapping if necessary */ 436 + for (i = 0; i < extp->NumProtectionFields - 1; i++) { 437 + otp->ProtRegAddr = le32_to_cpu(otp->ProtRegAddr); 438 + otp->FactGroups = le16_to_cpu(otp->FactGroups); 439 + otp->UserGroups = le16_to_cpu(otp->UserGroups); 440 + otp++; 441 + } 442 + } 443 + } 428 444 } 429 445 430 446 if (extp->MinorVersion >= '1') {
+6 -2
drivers/mtd/chips/map_ram.c
··· 70 70 mtd->_read = mapram_read; 71 71 mtd->_write = mapram_write; 72 72 mtd->_panic_write = mapram_write; 73 - mtd->_point = mapram_point; 74 73 mtd->_sync = mapram_nop; 75 - mtd->_unpoint = mapram_unpoint; 76 74 mtd->flags = MTD_CAP_RAM; 77 75 mtd->writesize = 1; 76 + 77 + /* Disable direct access when NO_XIP is set */ 78 + if (map->phys != NO_XIP) { 79 + mtd->_point = mapram_point; 80 + mtd->_unpoint = mapram_unpoint; 81 + } 78 82 79 83 mtd->erasesize = PAGE_SIZE; 80 84 while(mtd->size & (mtd->erasesize - 1))
+2 -4
drivers/mtd/devices/bcm47xxsflash.c
··· 357 357 return 0; 358 358 } 359 359 360 - static int bcm47xxsflash_bcma_remove(struct platform_device *pdev) 360 + static void bcm47xxsflash_bcma_remove(struct platform_device *pdev) 361 361 { 362 362 struct bcm47xxsflash *b47s = platform_get_drvdata(pdev); 363 363 364 364 mtd_device_unregister(&b47s->mtd); 365 365 iounmap(b47s->window); 366 - 367 - return 0; 368 366 } 369 367 370 368 static struct platform_driver bcma_sflash_driver = { 371 369 .probe = bcm47xxsflash_bcma_probe, 372 - .remove = bcm47xxsflash_bcma_remove, 370 + .remove_new = bcm47xxsflash_bcma_remove, 373 371 .driver = { 374 372 .name = "bcma_sflash", 375 373 },
+2 -3
drivers/mtd/devices/docg3.c
··· 2046 2046 * 2047 2047 * Returns 0 2048 2048 */ 2049 - static int docg3_release(struct platform_device *pdev) 2049 + static void docg3_release(struct platform_device *pdev) 2050 2050 { 2051 2051 struct docg3_cascade *cascade = platform_get_drvdata(pdev); 2052 2052 struct docg3 *docg3 = cascade->floors[0]->priv; ··· 2058 2058 doc_release_device(cascade->floors[floor]); 2059 2059 2060 2060 bch_free(docg3->cascade->bch); 2061 - return 0; 2062 2061 } 2063 2062 2064 2063 #ifdef CONFIG_OF ··· 2075 2076 }, 2076 2077 .suspend = docg3_suspend, 2077 2078 .resume = docg3_resume, 2078 - .remove = docg3_release, 2079 + .remove_new = docg3_release, 2079 2080 }; 2080 2081 2081 2082 module_platform_driver_probe(g3_driver, docg3_probe);
+2 -4
drivers/mtd/devices/phram.c
··· 388 388 PAGE_SIZE); 389 389 } 390 390 391 - static int phram_remove(struct platform_device *pdev) 391 + static void phram_remove(struct platform_device *pdev) 392 392 { 393 393 struct phram_mtd_list *phram = platform_get_drvdata(pdev); 394 394 395 395 mtd_device_unregister(&phram->mtd); 396 396 phram_unmap(phram); 397 397 kfree(phram); 398 - 399 - return 0; 400 398 } 401 399 402 400 static struct platform_driver phram_driver = { 403 401 .probe = phram_probe, 404 - .remove = phram_remove, 402 + .remove_new = phram_remove, 405 403 .driver = { 406 404 .name = "phram", 407 405 .of_match_table = of_match_ptr(phram_of_match),
+2 -4
drivers/mtd/devices/powernv_flash.c
··· 265 265 * 266 266 * Returns 0 267 267 */ 268 - static int powernv_flash_release(struct platform_device *pdev) 268 + static void powernv_flash_release(struct platform_device *pdev) 269 269 { 270 270 struct powernv_flash *data = dev_get_drvdata(&(pdev->dev)); 271 271 272 272 /* All resources should be freed automatically */ 273 273 WARN_ON(mtd_device_unregister(&data->mtd)); 274 - 275 - return 0; 276 274 } 277 275 278 276 static const struct of_device_id powernv_flash_match[] = { ··· 283 285 .name = "powernv_flash", 284 286 .of_match_table = powernv_flash_match, 285 287 }, 286 - .remove = powernv_flash_release, 288 + .remove_new = powernv_flash_release, 287 289 .probe = powernv_flash_probe, 288 290 }; 289 291
+2 -4
drivers/mtd/devices/spear_smi.c
··· 1031 1031 * 1032 1032 * free all allocations and delete the partitions. 1033 1033 */ 1034 - static int spear_smi_remove(struct platform_device *pdev) 1034 + static void spear_smi_remove(struct platform_device *pdev) 1035 1035 { 1036 1036 struct spear_smi *dev; 1037 1037 struct spear_snor_flash *flash; ··· 1048 1048 /* clean up mtd stuff */ 1049 1049 WARN_ON(mtd_device_unregister(&flash->mtd)); 1050 1050 } 1051 - 1052 - return 0; 1053 1051 } 1054 1052 1055 1053 #ifdef CONFIG_PM_SLEEP ··· 1093 1095 .pm = &spear_smi_pm_ops, 1094 1096 }, 1095 1097 .probe = spear_smi_probe, 1096 - .remove = spear_smi_remove, 1098 + .remove_new = spear_smi_remove, 1097 1099 }; 1098 1100 module_platform_driver(spear_smi_driver); 1099 1101
+2 -4
drivers/mtd/devices/st_spi_fsm.c
··· 2097 2097 return mtd_device_register(&fsm->mtd, NULL, 0); 2098 2098 } 2099 2099 2100 - static int stfsm_remove(struct platform_device *pdev) 2100 + static void stfsm_remove(struct platform_device *pdev) 2101 2101 { 2102 2102 struct stfsm *fsm = platform_get_drvdata(pdev); 2103 2103 2104 2104 WARN_ON(mtd_device_unregister(&fsm->mtd)); 2105 - 2106 - return 0; 2107 2105 } 2108 2106 2109 2107 #ifdef CONFIG_PM_SLEEP ··· 2132 2134 2133 2135 static struct platform_driver stfsm_driver = { 2134 2136 .probe = stfsm_probe, 2135 - .remove = stfsm_remove, 2137 + .remove_new = stfsm_remove, 2136 2138 .driver = { 2137 2139 .name = "st-spi-fsm", 2138 2140 .of_match_table = stfsm_match,
+2 -4
drivers/mtd/hyperbus/hbmc-am654.c
··· 229 229 return ret; 230 230 } 231 231 232 - static int am654_hbmc_remove(struct platform_device *pdev) 232 + static void am654_hbmc_remove(struct platform_device *pdev) 233 233 { 234 234 struct am654_hbmc_priv *priv = platform_get_drvdata(pdev); 235 235 struct am654_hbmc_device_priv *dev_priv = priv->hbdev.priv; ··· 241 241 242 242 if (dev_priv->rx_chan) 243 243 dma_release_channel(dev_priv->rx_chan); 244 - 245 - return 0; 246 244 } 247 245 248 246 static const struct of_device_id am654_hbmc_dt_ids[] = { ··· 254 256 255 257 static struct platform_driver am654_hbmc_platform_driver = { 256 258 .probe = am654_hbmc_probe, 257 - .remove = am654_hbmc_remove, 259 + .remove_new = am654_hbmc_remove, 258 260 .driver = { 259 261 .name = "hbmc-am654", 260 262 .of_match_table = am654_hbmc_dt_ids,
+2 -4
drivers/mtd/hyperbus/rpc-if.c
··· 154 154 return error; 155 155 } 156 156 157 - static int rpcif_hb_remove(struct platform_device *pdev) 157 + static void rpcif_hb_remove(struct platform_device *pdev) 158 158 { 159 159 struct rpcif_hyperbus *hyperbus = platform_get_drvdata(pdev); 160 160 161 161 hyperbus_unregister_device(&hyperbus->hbdev); 162 162 163 163 pm_runtime_disable(hyperbus->rpc.dev); 164 - 165 - return 0; 166 164 } 167 165 168 166 static struct platform_driver rpcif_platform_driver = { 169 167 .probe = rpcif_hb_probe, 170 - .remove = rpcif_hb_remove, 168 + .remove_new = rpcif_hb_remove, 171 169 .driver = { 172 170 .name = "rpc-if-hyperflash", 173 171 },
+2 -4
drivers/mtd/lpddr/lpddr2_nvm.c
··· 476 476 /* 477 477 * lpddr2_nvm driver remove method 478 478 */ 479 - static int lpddr2_nvm_remove(struct platform_device *pdev) 479 + static void lpddr2_nvm_remove(struct platform_device *pdev) 480 480 { 481 481 WARN_ON(mtd_device_unregister(dev_get_drvdata(&pdev->dev))); 482 - 483 - return 0; 484 482 } 485 483 486 484 /* Initialize platform_driver data structure for lpddr2_nvm */ ··· 487 489 .name = "lpddr2_nvm", 488 490 }, 489 491 .probe = lpddr2_nvm_probe, 490 - .remove = lpddr2_nvm_remove, 492 + .remove_new = lpddr2_nvm_remove, 491 493 }; 492 494 493 495 module_platform_driver(lpddr2_nvm_drv);
+1 -1
drivers/mtd/lpddr/lpddr_cmds.c
··· 61 61 mtd->_point = lpddr_point; 62 62 mtd->_unpoint = lpddr_unpoint; 63 63 } 64 - mtd->size = 1 << lpddr->qinfo->DevSizeShift; 64 + mtd->size = 1ULL << lpddr->qinfo->DevSizeShift; 65 65 mtd->erasesize = 1 << lpddr->qinfo->UniformBlockSizeShift; 66 66 mtd->writesize = 1 << lpddr->qinfo->BufSizeShift; 67 67
+2 -4
drivers/mtd/maps/lantiq-flash.c
··· 166 166 return err; 167 167 } 168 168 169 - static int 170 - ltq_mtd_remove(struct platform_device *pdev) 169 + static void ltq_mtd_remove(struct platform_device *pdev) 171 170 { 172 171 struct ltq_mtd *ltq_mtd = platform_get_drvdata(pdev); 173 172 ··· 174 175 mtd_device_unregister(ltq_mtd->mtd); 175 176 map_destroy(ltq_mtd->mtd); 176 177 } 177 - return 0; 178 178 } 179 179 180 180 static const struct of_device_id ltq_mtd_match[] = { ··· 184 186 185 187 static struct platform_driver ltq_mtd_driver = { 186 188 .probe = ltq_mtd_probe, 187 - .remove = ltq_mtd_remove, 189 + .remove_new = ltq_mtd_remove, 188 190 .driver = { 189 191 .name = "ltq-nor", 190 192 .of_match_table = ltq_mtd_match,
+5 -10
drivers/mtd/maps/physmap-core.c
··· 30 30 #include <linux/slab.h> 31 31 #include <linux/device.h> 32 32 #include <linux/platform_device.h> 33 + #include <linux/property.h> 33 34 #include <linux/mtd/mtd.h> 34 35 #include <linux/mtd/map.h> 35 36 #include <linux/mtd/partitions.h> ··· 38 37 #include <linux/mtd/concat.h> 39 38 #include <linux/mtd/cfi_endian.h> 40 39 #include <linux/io.h> 41 - #include <linux/of_device.h> 40 + #include <linux/of.h> 42 41 #include <linux/pm_runtime.h> 43 42 #include <linux/gpio/consumer.h> 44 43 ··· 63 62 unsigned int win_order; 64 63 }; 65 64 66 - static int physmap_flash_remove(struct platform_device *dev) 65 + static void physmap_flash_remove(struct platform_device *dev) 67 66 { 68 67 struct physmap_flash_info *info; 69 68 struct physmap_flash_data *physmap_data; ··· 89 88 90 89 pm_runtime_put(&dev->dev); 91 90 pm_runtime_disable(&dev->dev); 92 - return 0; 93 91 } 94 92 95 93 static void physmap_set_vpp(struct map_info *map, int state) ··· 296 296 static const char *of_select_probe_type(struct platform_device *dev) 297 297 { 298 298 struct device_node *dp = dev->dev.of_node; 299 - const struct of_device_id *match; 300 299 const char *probe_type; 301 300 302 - match = of_match_device(of_flash_match, &dev->dev); 303 - if (!match) 304 - return NULL; 305 - 306 - probe_type = match->data; 301 + probe_type = device_get_match_data(&dev->dev); 307 302 if (probe_type) 308 303 return probe_type; 309 304 ··· 621 626 622 627 static struct platform_driver physmap_flash_driver = { 623 628 .probe = physmap_flash_probe, 624 - .remove = physmap_flash_remove, 629 + .remove_new = physmap_flash_remove, 625 630 .shutdown = physmap_flash_shutdown, 626 631 .driver = { 627 632 .name = "physmap-flash",
+3 -5
drivers/mtd/maps/plat-ram.c
··· 65 65 * called to remove the device from the driver's control 66 66 */ 67 67 68 - static int platram_remove(struct platform_device *pdev) 68 + static void platram_remove(struct platform_device *pdev) 69 69 { 70 70 struct platram_info *info = to_platram_info(pdev); 71 71 72 72 dev_dbg(&pdev->dev, "removing device\n"); 73 73 74 74 if (info == NULL) 75 - return 0; 75 + return; 76 76 77 77 if (info->mtd) { 78 78 mtd_device_unregister(info->mtd); ··· 84 84 platram_setrw(info, PLATRAM_RO); 85 85 86 86 kfree(info); 87 - 88 - return 0; 89 87 } 90 88 91 89 /* platram_probe ··· 205 207 206 208 static struct platform_driver platram_driver = { 207 209 .probe = platram_probe, 208 - .remove = platram_remove, 210 + .remove_new = platram_remove, 209 211 .driver = { 210 212 .name = "mtd-ram", 211 213 },
+2 -3
drivers/mtd/maps/pxa2xx-flash.c
··· 98 98 return 0; 99 99 } 100 100 101 - static int pxa2xx_flash_remove(struct platform_device *dev) 101 + static void pxa2xx_flash_remove(struct platform_device *dev) 102 102 { 103 103 struct pxa2xx_flash_info *info = platform_get_drvdata(dev); 104 104 ··· 109 109 if (info->map.cached) 110 110 iounmap(info->map.cached); 111 111 kfree(info); 112 - return 0; 113 112 } 114 113 115 114 #ifdef CONFIG_PM ··· 128 129 .name = "pxa2xx-flash", 129 130 }, 130 131 .probe = pxa2xx_flash_probe, 131 - .remove = pxa2xx_flash_remove, 132 + .remove_new = pxa2xx_flash_remove, 132 133 .shutdown = pxa2xx_flash_shutdown, 133 134 }; 134 135
+2 -4
drivers/mtd/maps/sa1100-flash.c
··· 285 285 return err; 286 286 } 287 287 288 - static int sa1100_mtd_remove(struct platform_device *pdev) 288 + static void sa1100_mtd_remove(struct platform_device *pdev) 289 289 { 290 290 struct sa_info *info = platform_get_drvdata(pdev); 291 291 struct flash_platform_data *plat = dev_get_platdata(&pdev->dev); 292 292 293 293 sa1100_destroy(info, plat); 294 - 295 - return 0; 296 294 } 297 295 298 296 static struct platform_driver sa1100_mtd_driver = { 299 297 .probe = sa1100_mtd_probe, 300 - .remove = sa1100_mtd_remove, 298 + .remove_new = sa1100_mtd_remove, 301 299 .driver = { 302 300 .name = "sa1100-mtd", 303 301 },
+2 -4
drivers/mtd/maps/sun_uflash.c
··· 118 118 return uflash_devinit(op, dp); 119 119 } 120 120 121 - static int uflash_remove(struct platform_device *op) 121 + static void uflash_remove(struct platform_device *op) 122 122 { 123 123 struct uflash_dev *up = dev_get_drvdata(&op->dev); 124 124 ··· 132 132 } 133 133 134 134 kfree(up); 135 - 136 - return 0; 137 135 } 138 136 139 137 static const struct of_device_id uflash_match[] = { ··· 149 151 .of_match_table = uflash_match, 150 152 }, 151 153 .probe = uflash_probe, 152 - .remove = uflash_remove, 154 + .remove_new = uflash_remove, 153 155 }; 154 156 155 157 module_platform_driver(uflash_driver);
+2
drivers/mtd/mtdcore.c
··· 1506 1506 ret = mtd_read_oob(mtd, from, &ops); 1507 1507 *retlen = ops.retlen; 1508 1508 1509 + WARN_ON_ONCE(*retlen != len && mtd_is_bitflip_or_eccerr(ret)); 1510 + 1509 1511 return ret; 1510 1512 } 1511 1513 EXPORT_SYMBOL_GPL(mtd_read);
+5 -1
drivers/mtd/mtdpart.c
··· 426 426 mtd_add_partition_attrs(child); 427 427 428 428 /* Look for subpartitions */ 429 - parse_mtd_partitions(child, parts[i].types, NULL); 429 + ret = parse_mtd_partitions(child, parts[i].types, NULL); 430 + if (ret < 0) { 431 + pr_err("Failed to parse subpartitions: %d\n", ret); 432 + goto err_del_partitions; 433 + } 430 434 431 435 cur_offset = child->part.offset + child->part.size; 432 436 }
+1 -1
drivers/mtd/nand/raw/arasan-nand-controller.c
··· 481 481 } 482 482 483 483 bf = nand_check_erased_ecc_chunk(raw_buf, chip->ecc.size, 484 - NULL, 0, NULL, 0, 484 + anand->hw_ecc, chip->ecc.bytes, NULL, 0, 485 485 chip->ecc.strength); 486 486 if (bf > 0) { 487 487 mtd->ecc_stats.corrected += bf;
+1 -1
drivers/mtd/nand/raw/atmel/nand-controller.c
··· 165 165 struct atmel_pmecc_user *pmecc; 166 166 struct gpio_desc *cdgpio; 167 167 int numcs; 168 - struct atmel_nand_cs cs[]; 168 + struct atmel_nand_cs cs[] __counted_by(numcs); 169 169 }; 170 170 171 171 static inline struct atmel_nand *to_atmel_nand(struct nand_chip *chip)
+6 -8
drivers/mtd/nand/raw/cadence-nand-controller.c
··· 15 15 #include <linux/module.h> 16 16 #include <linux/mtd/mtd.h> 17 17 #include <linux/mtd/rawnand.h> 18 - #include <linux/of_device.h> 19 18 #include <linux/iopoll.h> 19 + #include <linux/of.h> 20 + #include <linux/platform_device.h> 21 + #include <linux/property.h> 20 22 #include <linux/slab.h> 21 23 22 24 /* ··· 528 526 /* ECC strength index. */ 529 527 u8 corr_str_idx; 530 528 531 - u8 cs[]; 529 + u8 cs[] __counted_by(nsels); 532 530 }; 533 531 534 532 struct ecc_info { ··· 2997 2995 struct cadence_nand_dt *dt; 2998 2996 struct cdns_nand_ctrl *cdns_ctrl; 2999 2997 int ret; 3000 - const struct of_device_id *of_id; 3001 2998 const struct cadence_nand_dt_devdata *devdata; 3002 2999 u32 val; 3003 3000 3004 - of_id = of_match_device(cadence_nand_dt_ids, &ofdev->dev); 3005 - if (of_id) { 3006 - ofdev->id_entry = of_id->data; 3007 - devdata = of_id->data; 3008 - } else { 3001 + devdata = device_get_match_data(&ofdev->dev); 3002 + if (!devdata) { 3009 3003 pr_err("Failed to find the right device id.\n"); 3010 3004 return -ENOMEM; 3011 3005 }
+1 -1
drivers/mtd/nand/raw/denali.h
··· 328 328 struct nand_chip chip; 329 329 struct list_head node; 330 330 unsigned int nsels; 331 - struct denali_chip_sel sels[]; 331 + struct denali_chip_sel sels[] __counted_by(nsels); 332 332 }; 333 333 334 334 /**
+1 -1
drivers/mtd/nand/raw/ingenic/ingenic_nand_drv.c
··· 46 46 struct nand_controller controller; 47 47 unsigned int num_banks; 48 48 struct list_head chips; 49 - struct ingenic_nand_cs cs[]; 49 + struct ingenic_nand_cs cs[] __counted_by(num_banks); 50 50 }; 51 51 52 52 struct ingenic_nand {
+10
drivers/mtd/nand/raw/intel-nand-controller.c
··· 619 619 ebu_host->cs_num = cs; 620 620 621 621 resname = devm_kasprintf(dev, GFP_KERNEL, "nand_cs%d", cs); 622 + if (!resname) { 623 + ret = -ENOMEM; 624 + goto err_of_node_put; 625 + } 626 + 622 627 ebu_host->cs[cs].chipaddr = devm_platform_ioremap_resource_byname(pdev, 623 628 resname); 624 629 if (IS_ERR(ebu_host->cs[cs].chipaddr)) { ··· 654 649 } 655 650 656 651 resname = devm_kasprintf(dev, GFP_KERNEL, "addr_sel%d", cs); 652 + if (!resname) { 653 + ret = -ENOMEM; 654 + goto err_cleanup_dma; 655 + } 656 + 657 657 res = platform_get_resource_byname(pdev, IORESOURCE_MEM, resname); 658 658 if (!res) { 659 659 ret = -EINVAL;
-1
drivers/mtd/nand/raw/internals.h
··· 106 106 int oob_required, int page); 107 107 int nand_write_page_raw_notsupp(struct nand_chip *chip, const u8 *buf, 108 108 int oob_required, int page); 109 - int nand_exit_status_op(struct nand_chip *chip); 110 109 int nand_read_param_page_op(struct nand_chip *chip, u8 page, void *buf, 111 110 unsigned int len); 112 111 void nand_decode_ext_id(struct nand_chip *chip);
+1 -1
drivers/mtd/nand/raw/marvell_nand.c
··· 348 348 int addr_cyc; 349 349 int selected_die; 350 350 unsigned int nsels; 351 - struct marvell_nand_chip_sel sels[]; 351 + struct marvell_nand_chip_sel sels[] __counted_by(nsels); 352 352 }; 353 353 354 354 static inline struct marvell_nand_chip *to_marvell_nand(struct nand_chip *chip)
+4 -1
drivers/mtd/nand/raw/meson_nand.c
··· 128 128 u8 *data_buf; 129 129 __le64 *info_buf; 130 130 u32 nsels; 131 - u8 sels[]; 131 + u8 sels[] __counted_by(nsels); 132 132 }; 133 133 134 134 struct meson_nand_ecc { ··· 1134 1134 init.name = devm_kasprintf(nfc->dev, 1135 1135 GFP_KERNEL, "%s#div", 1136 1136 dev_name(nfc->dev)); 1137 + if (!init.name) 1138 + return -ENOMEM; 1139 + 1137 1140 init.ops = &clk_divider_ops; 1138 1141 nfc_divider_parent_data[0].fw_name = "device"; 1139 1142 init.parent_data = nfc_divider_parent_data;
+1 -1
drivers/mtd/nand/raw/mtk_nand.c
··· 130 130 u32 spare_per_sector; 131 131 132 132 int nsels; 133 - u8 sels[]; 133 + u8 sels[] __counted_by(nsels); 134 134 /* nothing after this field */ 135 135 }; 136 136
-1
drivers/mtd/nand/raw/nand_base.c
··· 42 42 #include <linux/io.h> 43 43 #include <linux/mtd/partitions.h> 44 44 #include <linux/of.h> 45 - #include <linux/of_gpio.h> 46 45 #include <linux/gpio/consumer.h> 47 46 48 47 #include "internals.h"
+4 -4
drivers/mtd/nand/raw/omap2.c
··· 1881 1881 1882 1882 case NAND_OMAP_PREFETCH_IRQ: 1883 1883 info->gpmc_irq_fifo = platform_get_irq(info->pdev, 0); 1884 - if (info->gpmc_irq_fifo <= 0) 1885 - return -ENODEV; 1884 + if (info->gpmc_irq_fifo < 0) 1885 + return info->gpmc_irq_fifo; 1886 1886 err = devm_request_irq(dev, info->gpmc_irq_fifo, 1887 1887 omap_nand_irq, IRQF_SHARED, 1888 1888 "gpmc-nand-fifo", info); ··· 1894 1894 } 1895 1895 1896 1896 info->gpmc_irq_count = platform_get_irq(info->pdev, 1); 1897 - if (info->gpmc_irq_count <= 0) 1898 - return -ENODEV; 1897 + if (info->gpmc_irq_count < 0) 1898 + return info->gpmc_irq_count; 1899 1899 err = devm_request_irq(dev, info->gpmc_irq_count, 1900 1900 omap_nand_irq, IRQF_SHARED, 1901 1901 "gpmc-nand-count", info);
+1 -1
drivers/mtd/nand/raw/renesas-nand-controller.c
··· 210 210 u32 tim_gen_seq1; 211 211 u32 tim_gen_seq2; 212 212 u32 tim_gen_seq3; 213 - struct rnand_chip_sel sels[]; 213 + struct rnand_chip_sel sels[] __counted_by(nsels); 214 214 }; 215 215 216 216 struct rnandc {
+2 -3
drivers/mtd/nand/raw/rockchip-nand-controller.c
··· 158 158 u32 timing; 159 159 160 160 u8 nsels; 161 - u8 sels[]; 162 - /* Nothing after this field. */ 161 + u8 sels[] __counted_by(nsels); 163 162 }; 164 163 165 164 struct rk_nfc { ··· 1118 1119 return -EINVAL; 1119 1120 } 1120 1121 1121 - rknand = devm_kzalloc(dev, sizeof(*rknand) + nsels * sizeof(u8), 1122 + rknand = devm_kzalloc(dev, struct_size(rknand, sels, nsels), 1122 1123 GFP_KERNEL); 1123 1124 if (!rknand) 1124 1125 return -ENOMEM;
+2 -1
drivers/mtd/nand/raw/sh_flctl.c
··· 1215 1215 } 1216 1216 1217 1217 static struct platform_driver flctl_driver = { 1218 + .probe = flctl_probe, 1218 1219 .remove_new = flctl_remove, 1219 1220 .driver = { 1220 1221 .name = "sh_flctl", ··· 1223 1222 }, 1224 1223 }; 1225 1224 1226 - module_platform_driver_probe(flctl_driver, flctl_probe); 1225 + module_platform_driver(flctl_driver); 1227 1226 1228 1227 MODULE_LICENSE("GPL v2"); 1229 1228 MODULE_AUTHOR("Yoshihiro Shimoda");
+1 -1
drivers/mtd/nand/raw/sunxi_nand.c
··· 197 197 u32 timing_cfg; 198 198 u32 timing_ctl; 199 199 int nsels; 200 - struct sunxi_nand_chip_sel sels[]; 200 + struct sunxi_nand_chip_sel sels[] __counted_by(nsels); 201 201 }; 202 202 203 203 static inline struct sunxi_nand_chip *to_sunxi_nand(struct nand_chip *nand)
+4
drivers/mtd/nand/raw/tegra_nand.c
··· 1197 1197 init_completion(&ctrl->dma_complete); 1198 1198 1199 1199 ctrl->irq = platform_get_irq(pdev, 0); 1200 + if (ctrl->irq < 0) { 1201 + err = ctrl->irq; 1202 + goto err_put_pm; 1203 + } 1200 1204 err = devm_request_irq(&pdev->dev, ctrl->irq, tegra_nand_irq, 0, 1201 1205 dev_name(&pdev->dev), ctrl); 1202 1206 if (err) {
+4 -6
drivers/mtd/nand/raw/vf610_nfc.c
··· 29 29 #include <linux/mtd/mtd.h> 30 30 #include <linux/mtd/rawnand.h> 31 31 #include <linux/mtd/partitions.h> 32 - #include <linux/of_device.h> 32 + #include <linux/of.h> 33 33 #include <linux/platform_device.h> 34 + #include <linux/property.h> 34 35 #include <linux/slab.h> 35 36 #include <linux/swab.h> 36 37 ··· 811 810 struct mtd_info *mtd; 812 811 struct nand_chip *chip; 813 812 struct device_node *child; 814 - const struct of_device_id *of_id; 815 813 int err; 816 814 int irq; 817 815 ··· 840 840 return PTR_ERR(nfc->clk); 841 841 } 842 842 843 - of_id = of_match_device(vf610_nfc_dt_ids, &pdev->dev); 844 - if (!of_id) 843 + nfc->variant = (enum vf610_nfc_variant)device_get_match_data(&pdev->dev); 844 + if (!nfc->variant) 845 845 return -ENODEV; 846 - 847 - nfc->variant = (uintptr_t)of_id->data; 848 846 849 847 for_each_available_child_of_node(nfc->dev->of_node, child) { 850 848 if (of_device_is_compatible(child, "fsl,vf610-nfc-nandcs")) {
-1
drivers/mtd/nand/raw/xway_nand.c
··· 6 6 */ 7 7 8 8 #include <linux/mtd/rawnand.h> 9 - #include <linux/of_gpio.h> 10 9 #include <linux/of.h> 11 10 #include <linux/platform_device.h> 12 11
+1 -1
drivers/mtd/nand/spi/Makefile
··· 1 1 # SPDX-License-Identifier: GPL-2.0 2 - spinand-objs := core.o alliancememory.o ato.o esmt.o gigadevice.o macronix.o 2 + spinand-objs := core.o alliancememory.o ato.o esmt.o foresee.o gigadevice.o macronix.o 3 3 spinand-objs += micron.o paragon.o toshiba.o winbond.o xtx.o 4 4 obj-$(CONFIG_MTD_SPI_NAND) += spinand.o
+1
drivers/mtd/nand/spi/core.c
··· 940 940 &alliancememory_spinand_manufacturer, 941 941 &ato_spinand_manufacturer, 942 942 &esmt_c8_spinand_manufacturer, 943 + &foresee_spinand_manufacturer, 943 944 &gigadevice_spinand_manufacturer, 944 945 &macronix_spinand_manufacturer, 945 946 &micron_spinand_manufacturer,
+95
drivers/mtd/nand/spi/foresee.c
··· 1 + // SPDX-License-Identifier: (GPL-2.0+ OR MIT) 2 + /* 3 + * Copyright (c) 2023, SberDevices. All Rights Reserved. 4 + * 5 + * Author: Martin Kurbanov <mmkurbanov@salutedevices.com> 6 + */ 7 + 8 + #include <linux/device.h> 9 + #include <linux/kernel.h> 10 + #include <linux/mtd/spinand.h> 11 + 12 + #define SPINAND_MFR_FORESEE 0xCD 13 + 14 + static SPINAND_OP_VARIANTS(read_cache_variants, 15 + SPINAND_PAGE_READ_FROM_CACHE_X4_OP(0, 1, NULL, 0), 16 + SPINAND_PAGE_READ_FROM_CACHE_X2_OP(0, 1, NULL, 0), 17 + SPINAND_PAGE_READ_FROM_CACHE_OP(true, 0, 1, NULL, 0), 18 + SPINAND_PAGE_READ_FROM_CACHE_OP(false, 0, 1, NULL, 0)); 19 + 20 + static SPINAND_OP_VARIANTS(write_cache_variants, 21 + SPINAND_PROG_LOAD_X4(true, 0, NULL, 0), 22 + SPINAND_PROG_LOAD(true, 0, NULL, 0)); 23 + 24 + static SPINAND_OP_VARIANTS(update_cache_variants, 25 + SPINAND_PROG_LOAD_X4(false, 0, NULL, 0), 26 + SPINAND_PROG_LOAD(false, 0, NULL, 0)); 27 + 28 + static int f35sqa002g_ooblayout_ecc(struct mtd_info *mtd, int section, 29 + struct mtd_oob_region *region) 30 + { 31 + return -ERANGE; 32 + } 33 + 34 + static int f35sqa002g_ooblayout_free(struct mtd_info *mtd, int section, 35 + struct mtd_oob_region *region) 36 + { 37 + if (section) 38 + return -ERANGE; 39 + 40 + /* Reserve 2 bytes for the BBM. */ 41 + region->offset = 2; 42 + region->length = 62; 43 + 44 + return 0; 45 + } 46 + 47 + static const struct mtd_ooblayout_ops f35sqa002g_ooblayout = { 48 + .ecc = f35sqa002g_ooblayout_ecc, 49 + .free = f35sqa002g_ooblayout_free, 50 + }; 51 + 52 + static int f35sqa002g_ecc_get_status(struct spinand_device *spinand, u8 status) 53 + { 54 + struct nand_device *nand = spinand_to_nand(spinand); 55 + 56 + switch (status & STATUS_ECC_MASK) { 57 + case STATUS_ECC_NO_BITFLIPS: 58 + return 0; 59 + 60 + case STATUS_ECC_HAS_BITFLIPS: 61 + return nanddev_get_ecc_conf(nand)->strength; 62 + 63 + default: 64 + break; 65 + } 66 + 67 + /* More than 1-bit error was detected in one or more sectors and 68 + * cannot be corrected. 69 + */ 70 + return -EBADMSG; 71 + } 72 + 73 + static const struct spinand_info foresee_spinand_table[] = { 74 + SPINAND_INFO("F35SQA002G", 75 + SPINAND_ID(SPINAND_READID_METHOD_OPCODE_DUMMY, 0x72, 0x72), 76 + NAND_MEMORG(1, 2048, 64, 64, 2048, 40, 1, 1, 1), 77 + NAND_ECCREQ(1, 512), 78 + SPINAND_INFO_OP_VARIANTS(&read_cache_variants, 79 + &write_cache_variants, 80 + &update_cache_variants), 81 + SPINAND_HAS_QE_BIT, 82 + SPINAND_ECCINFO(&f35sqa002g_ooblayout, 83 + f35sqa002g_ecc_get_status)), 84 + }; 85 + 86 + static const struct spinand_manufacturer_ops foresee_spinand_manuf_ops = { 87 + }; 88 + 89 + const struct spinand_manufacturer foresee_spinand_manufacturer = { 90 + .id = SPINAND_MFR_FORESEE, 91 + .name = "FORESEE", 92 + .chips = foresee_spinand_table, 93 + .nchips = ARRAY_SIZE(foresee_spinand_table), 94 + .ops = &foresee_spinand_manuf_ops, 95 + };
+45
drivers/mtd/nand/spi/winbond.c
··· 169 169 &update_cache_variants), 170 170 0, 171 171 SPINAND_ECCINFO(&w25n02kv_ooblayout, w25n02kv_ecc_get_status)), 172 + SPINAND_INFO("W25N01JW", 173 + SPINAND_ID(SPINAND_READID_METHOD_OPCODE_DUMMY, 0xbc, 0x21), 174 + NAND_MEMORG(1, 2048, 64, 64, 1024, 20, 1, 1, 1), 175 + NAND_ECCREQ(4, 512), 176 + SPINAND_INFO_OP_VARIANTS(&read_cache_variants, 177 + &write_cache_variants, 178 + &update_cache_variants), 179 + 0, 180 + SPINAND_ECCINFO(&w25m02gv_ooblayout, w25n02kv_ecc_get_status)), 181 + SPINAND_INFO("W25N02JWZEIF", 182 + SPINAND_ID(SPINAND_READID_METHOD_OPCODE_DUMMY, 0xbf, 0x22), 183 + NAND_MEMORG(1, 2048, 64, 64, 1024, 20, 1, 2, 1), 184 + NAND_ECCREQ(4, 512), 185 + SPINAND_INFO_OP_VARIANTS(&read_cache_variants, 186 + &write_cache_variants, 187 + &update_cache_variants), 188 + 0, 189 + SPINAND_ECCINFO(&w25n02kv_ooblayout, w25n02kv_ecc_get_status)), 190 + SPINAND_INFO("W25N512GW", 191 + SPINAND_ID(SPINAND_READID_METHOD_OPCODE_DUMMY, 0xba, 0x20), 192 + NAND_MEMORG(1, 2048, 64, 64, 512, 10, 1, 1, 1), 193 + NAND_ECCREQ(4, 512), 194 + SPINAND_INFO_OP_VARIANTS(&read_cache_variants, 195 + &write_cache_variants, 196 + &update_cache_variants), 197 + 0, 198 + SPINAND_ECCINFO(&w25n02kv_ooblayout, w25n02kv_ecc_get_status)), 199 + SPINAND_INFO("W25N02KWZEIR", 200 + SPINAND_ID(SPINAND_READID_METHOD_OPCODE_DUMMY, 0xba, 0x22), 201 + NAND_MEMORG(1, 2048, 128, 64, 2048, 40, 1, 1, 1), 202 + NAND_ECCREQ(8, 512), 203 + SPINAND_INFO_OP_VARIANTS(&read_cache_variants, 204 + &write_cache_variants, 205 + &update_cache_variants), 206 + 0, 207 + SPINAND_ECCINFO(&w25n02kv_ooblayout, w25n02kv_ecc_get_status)), 208 + SPINAND_INFO("W25N01GWZEIG", 209 + SPINAND_ID(SPINAND_READID_METHOD_OPCODE_DUMMY, 0xba, 0x21), 210 + NAND_MEMORG(1, 2048, 64, 64, 1024, 20, 1, 1, 1), 211 + NAND_ECCREQ(4, 512), 212 + SPINAND_INFO_OP_VARIANTS(&read_cache_variants, 213 + &write_cache_variants, 214 + &update_cache_variants), 215 + 0, 216 + SPINAND_ECCINFO(&w25m02gv_ooblayout, w25n02kv_ecc_get_status)), 172 217 }; 173 218 174 219 static int winbond_spinand_init(struct spinand_device *spinand)
+134
drivers/mtd/nand/spi/xtx.c
··· 4 4 * Felix Matouschek <felix@matouschek.org> 5 5 */ 6 6 7 + #include <linux/bitfield.h> 7 8 #include <linux/device.h> 8 9 #include <linux/kernel.h> 9 10 #include <linux/mtd/spinand.h> ··· 15 14 #define XT26G0XA_STATUS_ECC_NO_DETECTED (0 << 2) 16 15 #define XT26G0XA_STATUS_ECC_8_CORRECTED (3 << 4) 17 16 #define XT26G0XA_STATUS_ECC_UNCOR_ERROR (2 << 4) 17 + 18 + #define XT26XXXD_STATUS_ECC3_ECC2_MASK GENMASK(7, 6) 19 + #define XT26XXXD_STATUS_ECC_NO_DETECTED (0) 20 + #define XT26XXXD_STATUS_ECC_1_7_CORRECTED (1) 21 + #define XT26XXXD_STATUS_ECC_8_CORRECTED (3) 22 + #define XT26XXXD_STATUS_ECC_UNCOR_ERROR (2) 18 23 19 24 static SPINAND_OP_VARIANTS(read_cache_variants, 20 25 SPINAND_PAGE_READ_FROM_CACHE_QUADIO_OP(0, 1, NULL, 0), ··· 91 84 return status >> 2; 92 85 } 93 86 87 + static int xt26xxxd_ooblayout_ecc(struct mtd_info *mtd, int section, 88 + struct mtd_oob_region *region) 89 + { 90 + if (section) 91 + return -ERANGE; 92 + 93 + region->offset = mtd->oobsize / 2; 94 + region->length = mtd->oobsize / 2; 95 + 96 + return 0; 97 + } 98 + 99 + static int xt26xxxd_ooblayout_free(struct mtd_info *mtd, int section, 100 + struct mtd_oob_region *region) 101 + { 102 + if (section) 103 + return -ERANGE; 104 + 105 + region->offset = 2; 106 + region->length = mtd->oobsize / 2 - 2; 107 + 108 + return 0; 109 + } 110 + 111 + static const struct mtd_ooblayout_ops xt26xxxd_ooblayout = { 112 + .ecc = xt26xxxd_ooblayout_ecc, 113 + .free = xt26xxxd_ooblayout_free, 114 + }; 115 + 116 + static int xt26xxxd_ecc_get_status(struct spinand_device *spinand, 117 + u8 status) 118 + { 119 + switch (FIELD_GET(STATUS_ECC_MASK, status)) { 120 + case XT26XXXD_STATUS_ECC_NO_DETECTED: 121 + return 0; 122 + case XT26XXXD_STATUS_ECC_UNCOR_ERROR: 123 + return -EBADMSG; 124 + case XT26XXXD_STATUS_ECC_1_7_CORRECTED: 125 + return 4 + FIELD_GET(XT26XXXD_STATUS_ECC3_ECC2_MASK, status); 126 + case XT26XXXD_STATUS_ECC_8_CORRECTED: 127 + return 8; 128 + default: 129 + break; 130 + } 131 + 132 + return -EINVAL; 133 + } 94 134 static const struct spinand_info xtx_spinand_table[] = { 95 135 SPINAND_INFO("XT26G01A", 96 136 SPINAND_ID(SPINAND_READID_METHOD_OPCODE_ADDR, 0xE1), ··· 169 115 SPINAND_HAS_QE_BIT, 170 116 SPINAND_ECCINFO(&xt26g0xa_ooblayout, 171 117 xt26g0xa_ecc_get_status)), 118 + SPINAND_INFO("XT26G01D", 119 + SPINAND_ID(SPINAND_READID_METHOD_OPCODE_ADDR, 0x31), 120 + NAND_MEMORG(1, 2048, 128, 64, 1024, 20, 1, 1, 1), 121 + NAND_ECCREQ(8, 512), 122 + SPINAND_INFO_OP_VARIANTS(&read_cache_variants, 123 + &write_cache_variants, 124 + &update_cache_variants), 125 + 0, 126 + SPINAND_ECCINFO(&xt26xxxd_ooblayout, 127 + xt26xxxd_ecc_get_status)), 128 + SPINAND_INFO("XT26G11D", 129 + SPINAND_ID(SPINAND_READID_METHOD_OPCODE_ADDR, 0x34), 130 + NAND_MEMORG(1, 2048, 128, 64, 1024, 20, 1, 1, 1), 131 + NAND_ECCREQ(8, 512), 132 + SPINAND_INFO_OP_VARIANTS(&read_cache_variants, 133 + &write_cache_variants, 134 + &update_cache_variants), 135 + 0, 136 + SPINAND_ECCINFO(&xt26xxxd_ooblayout, 137 + xt26xxxd_ecc_get_status)), 138 + SPINAND_INFO("XT26Q01D", 139 + SPINAND_ID(SPINAND_READID_METHOD_OPCODE_ADDR, 0x51), 140 + NAND_MEMORG(1, 2048, 128, 64, 1024, 20, 1, 1, 1), 141 + NAND_ECCREQ(8, 512), 142 + SPINAND_INFO_OP_VARIANTS(&read_cache_variants, 143 + &write_cache_variants, 144 + &update_cache_variants), 145 + 0, 146 + SPINAND_ECCINFO(&xt26xxxd_ooblayout, 147 + xt26xxxd_ecc_get_status)), 148 + SPINAND_INFO("XT26G02D", 149 + SPINAND_ID(SPINAND_READID_METHOD_OPCODE_ADDR, 0x32), 150 + NAND_MEMORG(1, 2048, 128, 64, 2048, 40, 1, 1, 1), 151 + NAND_ECCREQ(8, 512), 152 + SPINAND_INFO_OP_VARIANTS(&read_cache_variants, 153 + &write_cache_variants, 154 + &update_cache_variants), 155 + 0, 156 + SPINAND_ECCINFO(&xt26xxxd_ooblayout, 157 + xt26xxxd_ecc_get_status)), 158 + SPINAND_INFO("XT26G12D", 159 + SPINAND_ID(SPINAND_READID_METHOD_OPCODE_ADDR, 0x35), 160 + NAND_MEMORG(1, 2048, 128, 64, 2048, 40, 1, 1, 1), 161 + NAND_ECCREQ(8, 512), 162 + SPINAND_INFO_OP_VARIANTS(&read_cache_variants, 163 + &write_cache_variants, 164 + &update_cache_variants), 165 + 0, 166 + SPINAND_ECCINFO(&xt26xxxd_ooblayout, 167 + xt26xxxd_ecc_get_status)), 168 + SPINAND_INFO("XT26Q02D", 169 + SPINAND_ID(SPINAND_READID_METHOD_OPCODE_ADDR, 0x52), 170 + NAND_MEMORG(1, 2048, 128, 64, 2048, 40, 1, 1, 1), 171 + NAND_ECCREQ(8, 512), 172 + SPINAND_INFO_OP_VARIANTS(&read_cache_variants, 173 + &write_cache_variants, 174 + &update_cache_variants), 175 + 0, 176 + SPINAND_ECCINFO(&xt26xxxd_ooblayout, 177 + xt26xxxd_ecc_get_status)), 178 + SPINAND_INFO("XT26G04D", 179 + SPINAND_ID(SPINAND_READID_METHOD_OPCODE_ADDR, 0x33), 180 + NAND_MEMORG(1, 4096, 256, 64, 2048, 40, 1, 1, 1), 181 + NAND_ECCREQ(8, 512), 182 + SPINAND_INFO_OP_VARIANTS(&read_cache_variants, 183 + &write_cache_variants, 184 + &update_cache_variants), 185 + 0, 186 + SPINAND_ECCINFO(&xt26xxxd_ooblayout, 187 + xt26xxxd_ecc_get_status)), 188 + SPINAND_INFO("XT26Q04D", 189 + SPINAND_ID(SPINAND_READID_METHOD_OPCODE_ADDR, 0x53), 190 + NAND_MEMORG(1, 4096, 256, 64, 2048, 40, 1, 1, 1), 191 + NAND_ECCREQ(8, 512), 192 + SPINAND_INFO_OP_VARIANTS(&read_cache_variants, 193 + &write_cache_variants, 194 + &update_cache_variants), 195 + 0, 196 + SPINAND_ECCINFO(&xt26xxxd_ooblayout, 197 + xt26xxxd_ecc_get_status)), 172 198 }; 173 199 174 200 static const struct spinand_manufacturer_ops xtx_spinand_manuf_ops = {
-2
drivers/mtd/spi-nor/Makefile
··· 2 2 3 3 spi-nor-objs := core.o sfdp.o swp.o otp.o sysfs.o 4 4 spi-nor-objs += atmel.o 5 - spi-nor-objs += catalyst.o 6 5 spi-nor-objs += eon.o 7 6 spi-nor-objs += esmt.o 8 7 spi-nor-objs += everspin.o 9 - spi-nor-objs += fujitsu.o 10 8 spi-nor-objs += gigadevice.o 11 9 spi-nor-objs += intel.o 12 10 spi-nor-objs += issi.o
+78 -43
drivers/mtd/spi-nor/atmel.c
··· 163 163 }; 164 164 165 165 static const struct flash_info atmel_nor_parts[] = { 166 - /* Atmel -- some are (confusingly) marketed as "DataFlash" */ 167 - { "at25fs010", INFO(0x1f6601, 0, 32 * 1024, 4) 168 - FLAGS(SPI_NOR_HAS_LOCK) 169 - NO_SFDP_FLAGS(SECT_4K) 170 - .fixups = &at25fs_nor_fixups }, 171 - { "at25fs040", INFO(0x1f6604, 0, 64 * 1024, 8) 172 - FLAGS(SPI_NOR_HAS_LOCK) 173 - NO_SFDP_FLAGS(SECT_4K) 174 - .fixups = &at25fs_nor_fixups }, 175 - { "at25df041a", INFO(0x1f4401, 0, 64 * 1024, 8) 176 - FLAGS(SPI_NOR_HAS_LOCK | SPI_NOR_SWP_IS_VOLATILE) 177 - NO_SFDP_FLAGS(SECT_4K) 178 - .fixups = &atmel_nor_global_protection_fixups }, 179 - { "at25df321", INFO(0x1f4700, 0, 64 * 1024, 64) 180 - FLAGS(SPI_NOR_HAS_LOCK | SPI_NOR_SWP_IS_VOLATILE) 181 - NO_SFDP_FLAGS(SECT_4K) 182 - .fixups = &atmel_nor_global_protection_fixups }, 183 - { "at25df321a", INFO(0x1f4701, 0, 64 * 1024, 64) 184 - FLAGS(SPI_NOR_HAS_LOCK | SPI_NOR_SWP_IS_VOLATILE) 185 - NO_SFDP_FLAGS(SECT_4K) 186 - .fixups = &atmel_nor_global_protection_fixups }, 187 - { "at25df641", INFO(0x1f4800, 0, 64 * 1024, 128) 188 - FLAGS(SPI_NOR_HAS_LOCK | SPI_NOR_SWP_IS_VOLATILE) 189 - NO_SFDP_FLAGS(SECT_4K) 190 - .fixups = &atmel_nor_global_protection_fixups }, 191 - { "at25sl321", INFO(0x1f4216, 0, 64 * 1024, 64) 192 - NO_SFDP_FLAGS(SECT_4K | SPI_NOR_DUAL_READ | SPI_NOR_QUAD_READ) }, 193 - { "at26f004", INFO(0x1f0400, 0, 64 * 1024, 8) 194 - NO_SFDP_FLAGS(SECT_4K) }, 195 - { "at26df081a", INFO(0x1f4501, 0, 64 * 1024, 16) 196 - FLAGS(SPI_NOR_HAS_LOCK | SPI_NOR_SWP_IS_VOLATILE) 197 - NO_SFDP_FLAGS(SECT_4K) 198 - .fixups = &atmel_nor_global_protection_fixups }, 199 - { "at26df161a", INFO(0x1f4601, 0, 64 * 1024, 32) 200 - FLAGS(SPI_NOR_HAS_LOCK | SPI_NOR_SWP_IS_VOLATILE) 201 - NO_SFDP_FLAGS(SECT_4K) 202 - .fixups = &atmel_nor_global_protection_fixups }, 203 - { "at26df321", INFO(0x1f4700, 0, 64 * 1024, 64) 204 - FLAGS(SPI_NOR_HAS_LOCK | SPI_NOR_SWP_IS_VOLATILE) 205 - NO_SFDP_FLAGS(SECT_4K) 206 - .fixups = &atmel_nor_global_protection_fixups }, 207 - { "at45db081d", INFO(0x1f2500, 0, 64 * 1024, 16) 208 - NO_SFDP_FLAGS(SECT_4K) }, 166 + { 167 + .id = SNOR_ID(0x1f, 0x04, 0x00), 168 + .name = "at26f004", 169 + .size = SZ_512K, 170 + .no_sfdp_flags = SECT_4K, 171 + }, { 172 + .id = SNOR_ID(0x1f, 0x25, 0x00), 173 + .name = "at45db081d", 174 + .size = SZ_1M, 175 + .no_sfdp_flags = SECT_4K, 176 + }, { 177 + .id = SNOR_ID(0x1f, 0x42, 0x16), 178 + .name = "at25sl321", 179 + .size = SZ_4M, 180 + .no_sfdp_flags = SECT_4K | SPI_NOR_DUAL_READ | SPI_NOR_QUAD_READ, 181 + }, { 182 + .id = SNOR_ID(0x1f, 0x44, 0x01), 183 + .name = "at25df041a", 184 + .size = SZ_512K, 185 + .flags = SPI_NOR_HAS_LOCK | SPI_NOR_SWP_IS_VOLATILE, 186 + .no_sfdp_flags = SECT_4K, 187 + .fixups = &atmel_nor_global_protection_fixups, 188 + }, { 189 + .id = SNOR_ID(0x1f, 0x45, 0x01), 190 + .name = "at26df081a", 191 + .size = SZ_1M, 192 + .flags = SPI_NOR_HAS_LOCK | SPI_NOR_SWP_IS_VOLATILE, 193 + .no_sfdp_flags = SECT_4K, 194 + .fixups = &atmel_nor_global_protection_fixups 195 + }, { 196 + .id = SNOR_ID(0x1f, 0x46, 0x01), 197 + .name = "at26df161a", 198 + .size = SZ_2M, 199 + .flags = SPI_NOR_HAS_LOCK | SPI_NOR_SWP_IS_VOLATILE, 200 + .no_sfdp_flags = SECT_4K, 201 + .fixups = &atmel_nor_global_protection_fixups 202 + }, { 203 + .id = SNOR_ID(0x1f, 0x47, 0x00), 204 + .name = "at25df321", 205 + .size = SZ_4M, 206 + .flags = SPI_NOR_HAS_LOCK | SPI_NOR_SWP_IS_VOLATILE, 207 + .no_sfdp_flags = SECT_4K, 208 + .fixups = &atmel_nor_global_protection_fixups 209 + }, { 210 + .id = SNOR_ID(0x1f, 0x47, 0x01), 211 + .name = "at25df321a", 212 + .size = SZ_4M, 213 + .flags = SPI_NOR_HAS_LOCK | SPI_NOR_SWP_IS_VOLATILE, 214 + .no_sfdp_flags = SECT_4K, 215 + .fixups = &atmel_nor_global_protection_fixups 216 + }, { 217 + .id = SNOR_ID(0x1f, 0x47, 0x08), 218 + .name = "at25ff321a", 219 + .flags = SPI_NOR_HAS_LOCK | SPI_NOR_SWP_IS_VOLATILE, 220 + .fixups = &atmel_nor_global_protection_fixups 221 + }, { 222 + .id = SNOR_ID(0x1f, 0x48, 0x00), 223 + .name = "at25df641", 224 + .size = SZ_8M, 225 + .flags = SPI_NOR_HAS_LOCK | SPI_NOR_SWP_IS_VOLATILE, 226 + .no_sfdp_flags = SECT_4K, 227 + .fixups = &atmel_nor_global_protection_fixups 228 + }, { 229 + .id = SNOR_ID(0x1f, 0x66, 0x01), 230 + .name = "at25fs010", 231 + .sector_size = SZ_32K, 232 + .size = SZ_128K, 233 + .flags = SPI_NOR_HAS_LOCK, 234 + .no_sfdp_flags = SECT_4K, 235 + .fixups = &at25fs_nor_fixups 236 + }, { 237 + .id = SNOR_ID(0x1f, 0x66, 0x04), 238 + .name = "at25fs040", 239 + .size = SZ_512K, 240 + .flags = SPI_NOR_HAS_LOCK, 241 + .no_sfdp_flags = SECT_4K, 242 + .fixups = &at25fs_nor_fixups 243 + }, 209 244 }; 210 245 211 246 const struct spi_nor_manufacturer spi_nor_atmel = {
-24
drivers/mtd/spi-nor/catalyst.c
··· 1 - // SPDX-License-Identifier: GPL-2.0 2 - /* 3 - * Copyright (C) 2005, Intec Automation Inc. 4 - * Copyright (C) 2014, Freescale Semiconductor, Inc. 5 - */ 6 - 7 - #include <linux/mtd/spi-nor.h> 8 - 9 - #include "core.h" 10 - 11 - static const struct flash_info catalyst_nor_parts[] = { 12 - /* Catalyst / On Semiconductor -- non-JEDEC */ 13 - { "cat25c11", CAT25_INFO(16, 8, 16, 1) }, 14 - { "cat25c03", CAT25_INFO(32, 8, 16, 2) }, 15 - { "cat25c09", CAT25_INFO(128, 8, 32, 2) }, 16 - { "cat25c17", CAT25_INFO(256, 8, 32, 2) }, 17 - { "cat25128", CAT25_INFO(2048, 8, 64, 2) }, 18 - }; 19 - 20 - const struct spi_nor_manufacturer spi_nor_catalyst = { 21 - .name = "catalyst", 22 - .parts = catalyst_nor_parts, 23 - .nparts = ARRAY_SIZE(catalyst_nor_parts), 24 - };
+2 -3
drivers/mtd/spi-nor/controllers/hisi-sfc.c
··· 468 468 return ret; 469 469 } 470 470 471 - static int hisi_spi_nor_remove(struct platform_device *pdev) 471 + static void hisi_spi_nor_remove(struct platform_device *pdev) 472 472 { 473 473 struct hifmc_host *host = platform_get_drvdata(pdev); 474 474 475 475 hisi_spi_nor_unregister_all(host); 476 476 mutex_destroy(&host->lock); 477 - return 0; 478 477 } 479 478 480 479 static const struct of_device_id hisi_spi_nor_dt_ids[] = { ··· 488 489 .of_match_table = hisi_spi_nor_dt_ids, 489 490 }, 490 491 .probe = hisi_spi_nor_probe, 491 - .remove = hisi_spi_nor_remove, 492 + .remove_new = hisi_spi_nor_remove, 492 493 }; 493 494 module_platform_driver(hisi_spi_nor_driver); 494 495
+2 -4
drivers/mtd/spi-nor/controllers/nxp-spifi.c
··· 431 431 return 0; 432 432 } 433 433 434 - static int nxp_spifi_remove(struct platform_device *pdev) 434 + static void nxp_spifi_remove(struct platform_device *pdev) 435 435 { 436 436 struct nxp_spifi *spifi = platform_get_drvdata(pdev); 437 437 438 438 mtd_device_unregister(&spifi->nor.mtd); 439 - 440 - return 0; 441 439 } 442 440 443 441 static const struct of_device_id nxp_spifi_match[] = { ··· 446 448 447 449 static struct platform_driver nxp_spifi_driver = { 448 450 .probe = nxp_spifi_probe, 449 - .remove = nxp_spifi_remove, 451 + .remove_new = nxp_spifi_remove, 450 452 .driver = { 451 453 .name = "nxp-spifi", 452 454 .of_match_table = nxp_spifi_match,
+24 -39
drivers/mtd/spi-nor/core.c
··· 1999 1999 2000 2000 static const struct spi_nor_manufacturer *manufacturers[] = { 2001 2001 &spi_nor_atmel, 2002 - &spi_nor_catalyst, 2003 2002 &spi_nor_eon, 2004 2003 &spi_nor_esmt, 2005 2004 &spi_nor_everspin, 2006 - &spi_nor_fujitsu, 2007 2005 &spi_nor_gigadevice, 2008 2006 &spi_nor_intel, 2009 2007 &spi_nor_issi, ··· 2017 2019 2018 2020 static const struct flash_info spi_nor_generic_flash = { 2019 2021 .name = "spi-nor-generic", 2020 - .n_banks = 1, 2021 - /* 2022 - * JESD216 rev A doesn't specify the page size, therefore we need a 2023 - * sane default. 2024 - */ 2025 - .page_size = 256, 2026 - .parse_sfdp = true, 2027 2022 }; 2028 2023 2029 2024 static const struct flash_info *spi_nor_match_id(struct spi_nor *nor, ··· 2028 2037 for (i = 0; i < ARRAY_SIZE(manufacturers); i++) { 2029 2038 for (j = 0; j < manufacturers[i]->nparts; j++) { 2030 2039 part = &manufacturers[i]->parts[j]; 2031 - if (part->id_len && 2032 - !memcmp(part->id, id, part->id_len)) { 2040 + if (part->id && 2041 + !memcmp(part->id->bytes, id, part->id->len)) { 2033 2042 nor->manufacturer = manufacturers[i]; 2034 2043 return part; 2035 2044 } ··· 2511 2520 /** 2512 2521 * spi_nor_select_uniform_erase() - select optimum uniform erase type 2513 2522 * @map: the erase map of the SPI NOR 2514 - * @wanted_size: the erase type size to search for. Contains the value of 2515 - * info->sector_size, the "small sector" size in case 2516 - * CONFIG_MTD_SPI_NOR_USE_4K_SECTORS is defined or 0 if 2517 - * there is no information about the sector size. The 2518 - * latter is the case if the flash parameters are parsed 2519 - * solely by SFDP, then the largest supported erase type 2520 - * is selected. 2521 2523 * 2522 2524 * Once the optimum uniform sector erase command is found, disable all the 2523 2525 * other. ··· 2518 2534 * Return: pointer to erase type on success, NULL otherwise. 2519 2535 */ 2520 2536 static const struct spi_nor_erase_type * 2521 - spi_nor_select_uniform_erase(struct spi_nor_erase_map *map, 2522 - const u32 wanted_size) 2537 + spi_nor_select_uniform_erase(struct spi_nor_erase_map *map) 2523 2538 { 2524 2539 const struct spi_nor_erase_type *tested_erase, *erase = NULL; 2525 2540 int i; 2526 2541 u8 uniform_erase_type = map->uniform_erase_type; 2527 2542 2543 + /* 2544 + * Search for the biggest erase size, except for when compiled 2545 + * to use 4k erases. 2546 + */ 2528 2547 for (i = SNOR_ERASE_TYPE_MAX - 1; i >= 0; i--) { 2529 2548 if (!(uniform_erase_type & BIT(i))) 2530 2549 continue; ··· 2539 2552 continue; 2540 2553 2541 2554 /* 2542 - * If the current erase size is the one, stop here: 2555 + * If the current erase size is the 4k one, stop here, 2543 2556 * we have found the right uniform Sector Erase command. 2544 2557 */ 2545 - if (tested_erase->size == wanted_size) { 2558 + if (IS_ENABLED(CONFIG_MTD_SPI_NOR_USE_4K_SECTORS) && 2559 + tested_erase->size == SZ_4K) { 2546 2560 erase = tested_erase; 2547 2561 break; 2548 2562 } ··· 2571 2583 struct spi_nor_erase_map *map = &nor->params->erase_map; 2572 2584 const struct spi_nor_erase_type *erase = NULL; 2573 2585 struct mtd_info *mtd = &nor->mtd; 2574 - u32 wanted_size = nor->info->sector_size; 2575 2586 int i; 2576 2587 2577 2588 /* ··· 2581 2594 * manage the SPI flash memory as uniform with a single erase sector 2582 2595 * size, when possible. 2583 2596 */ 2584 - #ifdef CONFIG_MTD_SPI_NOR_USE_4K_SECTORS 2585 - /* prefer "small sector" erase if possible */ 2586 - wanted_size = 4096u; 2587 - #endif 2588 - 2589 2597 if (spi_nor_has_uniform_erase(nor)) { 2590 - erase = spi_nor_select_uniform_erase(map, wanted_size); 2598 + erase = spi_nor_select_uniform_erase(map); 2591 2599 if (!erase) 2592 2600 return -EINVAL; 2593 2601 nor->erase_opcode = erase->opcode; ··· 2755 2773 { 2756 2774 struct spi_nor_flash_parameter *params = nor->params; 2757 2775 struct spi_nor_erase_map *map = &params->erase_map; 2758 - const u8 no_sfdp_flags = nor->info->no_sfdp_flags; 2776 + const struct flash_info *info = nor->info; 2777 + const u8 no_sfdp_flags = info->no_sfdp_flags; 2759 2778 u8 i, erase_mask; 2760 2779 2761 2780 if (no_sfdp_flags & SPI_NOR_DUAL_READ) { ··· 2810 2827 i++; 2811 2828 } 2812 2829 erase_mask |= BIT(i); 2813 - spi_nor_set_erase_type(&map->erase_type[i], nor->info->sector_size, 2830 + spi_nor_set_erase_type(&map->erase_type[i], 2831 + info->sector_size ?: SPI_NOR_DEFAULT_SECTOR_SIZE, 2814 2832 SPINOR_OP_SE); 2815 2833 spi_nor_init_uniform_erase_map(map, erase_mask, params->size); 2816 2834 } ··· 2853 2869 if (flags & NO_CHIP_ERASE) 2854 2870 nor->flags |= SNOR_F_NO_OP_CHIP_ERASE; 2855 2871 2856 - if (flags & SPI_NOR_RWW && nor->info->n_banks > 1 && 2872 + if (flags & SPI_NOR_RWW && nor->params->n_banks > 1 && 2857 2873 !nor->controller_ops) 2858 2874 nor->flags |= SNOR_F_RWW; 2859 2875 } ··· 2917 2933 if (nor->flags & SNOR_F_HAS_LOCK && !nor->params->locking_ops) 2918 2934 spi_nor_init_default_locking_ops(nor); 2919 2935 2920 - if (nor->info->n_banks > 1) 2921 - params->bank_size = div64_u64(params->size, nor->info->n_banks); 2936 + if (params->n_banks > 1) 2937 + params->bank_size = div64_u64(params->size, params->n_banks); 2922 2938 2923 2939 return 0; 2924 2940 } ··· 2978 2994 struct device_node *np = spi_nor_get_flash_node(nor); 2979 2995 2980 2996 params->quad_enable = spi_nor_sr2_bit1_quad_enable; 2981 - params->otp.org = &info->otp_org; 2997 + params->otp.org = info->otp; 2982 2998 2983 2999 /* Default to 16-bit Write Status (01h) Command */ 2984 3000 nor->flags |= SNOR_F_HAS_16BIT_SR; 2985 3001 2986 3002 /* Set SPI NOR sizes. */ 2987 3003 params->writesize = 1; 2988 - params->size = (u64)info->sector_size * info->n_sectors; 3004 + params->size = info->size; 2989 3005 params->bank_size = params->size; 2990 - params->page_size = info->page_size; 3006 + params->page_size = info->page_size ?: SPI_NOR_DEFAULT_PAGE_SIZE; 3007 + params->n_banks = info->n_banks ?: SPI_NOR_DEFAULT_N_BANKS; 2991 3008 2992 3009 if (!(info->flags & SPI_NOR_NO_FR)) { 2993 3010 /* Default to Fast Read for DT and non-DT platform devices. */ ··· 3068 3083 3069 3084 spi_nor_init_default_params(nor); 3070 3085 3071 - if (nor->info->parse_sfdp) { 3086 + if (spi_nor_needs_sfdp(nor)) { 3072 3087 ret = spi_nor_parse_sfdp(nor); 3073 3088 if (ret) { 3074 3089 dev_err(nor->dev, "BFPT parsing failed. Please consider using SPI_NOR_SKIP_SFDP when declaring the flash\n"); ··· 3370 3385 * If caller has specified name of flash model that can normally be 3371 3386 * detected using JEDEC, let's verify it. 3372 3387 */ 3373 - if (name && info->id_len) { 3388 + if (name && info->id) { 3374 3389 const struct flash_info *jinfo; 3375 3390 3376 3391 jinfo = spi_nor_detect(nor);
+61 -77
drivers/mtd/spi-nor/core.h
··· 10 10 #include "sfdp.h" 11 11 12 12 #define SPI_NOR_MAX_ID_LEN 6 13 + /* 14 + * 256 bytes is a sane default for most older flashes. Newer flashes will 15 + * have the page size defined within their SFDP tables. 16 + */ 17 + #define SPI_NOR_DEFAULT_PAGE_SIZE 256 18 + #define SPI_NOR_DEFAULT_N_BANKS 1 19 + #define SPI_NOR_DEFAULT_SECTOR_SIZE SZ_64K 13 20 14 21 /* Standard SPI NOR flash operations. */ 15 22 #define SPI_NOR_READID_OP(naddr, ndummy, buf, len) \ ··· 360 353 * in octal DTR mode. 361 354 * @rdsr_addr_nbytes: dummy address bytes needed for Read Status Register 362 355 * command in octal DTR mode. 356 + * @n_banks: number of banks. 363 357 * @n_dice: number of dice in the flash memory. 364 358 * @vreg_offset: volatile register offset for each die. 365 359 * @hwcaps: describes the read and page program hardware ··· 397 389 u8 addr_mode_nbytes; 398 390 u8 rdsr_dummy; 399 391 u8 rdsr_addr_nbytes; 392 + u8 n_banks; 400 393 u8 n_dice; 401 394 u32 *vreg_offset; 402 395 ··· 447 438 }; 448 439 449 440 /** 441 + * struct spi_nor_id - SPI NOR flash ID. 442 + * 443 + * @bytes: the bytes returned by the flash when issuing command 9F. Typically, 444 + * the first byte is the manufacturer ID code (see JEP106) and the next 445 + * two bytes are a flash part specific ID. 446 + * @len: the number of bytes of ID. 447 + */ 448 + struct spi_nor_id { 449 + const u8 *bytes; 450 + u8 len; 451 + }; 452 + 453 + /** 450 454 * struct flash_info - SPI NOR flash_info entry. 455 + * @id: pointer to struct spi_nor_id or NULL, which means "no ID" (mostly 456 + * older chips). 451 457 * @name: the name of the flash. 452 - * @id: the flash's ID bytes. The first three bytes are the 453 - * JEDIC ID. JEDEC ID zero means "no ID" (mostly older chips). 454 - * @id_len: the number of bytes of ID. 455 - * @sector_size: the size listed here is what works with SPINOR_OP_SE, which 456 - * isn't necessarily called a "sector" by the vendor. 457 - * @n_sectors: the number of sectors. 458 - * @n_banks: the number of banks. 459 - * @page_size: the flash's page size. 458 + * @size: the size of the flash in bytes. 459 + * @sector_size: (optional) the size listed here is what works with 460 + * SPINOR_OP_SE, which isn't necessarily called a "sector" by 461 + * the vendor. Defaults to 64k. 462 + * @n_banks: (optional) the number of banks. Defaults to 1. 463 + * @page_size: (optional) the flash's page size. Defaults to 256. 460 464 * @addr_nbytes: number of address bytes to send. 461 465 * 462 - * @parse_sfdp: true when flash supports SFDP tables. The false value has no 463 - * meaning. If one wants to skip the SFDP tables, one should 464 - * instead use the SPI_NOR_SKIP_SFDP sfdp_flag. 465 466 * @flags: flags that indicate support that is not defined by the 466 467 * JESD216 standard in its SFDP tables. Flag meanings: 467 468 * SPI_NOR_HAS_LOCK: flash supports lock/unlock via SR ··· 522 503 */ 523 504 struct flash_info { 524 505 char *name; 525 - u8 id[SPI_NOR_MAX_ID_LEN]; 526 - u8 id_len; 506 + const struct spi_nor_id *id; 507 + size_t size; 527 508 unsigned sector_size; 528 - u16 n_sectors; 529 509 u16 page_size; 530 510 u8 n_banks; 531 511 u8 addr_nbytes; 532 512 533 - bool parse_sfdp; 534 513 u16 flags; 535 514 #define SPI_NOR_HAS_LOCK BIT(0) 536 515 #define SPI_NOR_HAS_TB BIT(1) ··· 557 540 558 541 u8 mfr_flags; 559 542 560 - const struct spi_nor_otp_organization otp_org; 543 + const struct spi_nor_otp_organization *otp; 561 544 const struct spi_nor_fixups *fixups; 562 545 }; 563 546 564 - #define SPI_NOR_ID_2ITEMS(_id) ((_id) >> 8) & 0xff, (_id) & 0xff 565 - #define SPI_NOR_ID_3ITEMS(_id) ((_id) >> 16) & 0xff, SPI_NOR_ID_2ITEMS(_id) 547 + #define SNOR_ID(...) \ 548 + (&(const struct spi_nor_id){ \ 549 + .bytes = (const u8[]){ __VA_ARGS__ }, \ 550 + .len = sizeof((u8[]){ __VA_ARGS__ }), \ 551 + }) 566 552 567 - #define SPI_NOR_ID(_jedec_id, _ext_id) \ 568 - .id = { SPI_NOR_ID_3ITEMS(_jedec_id), SPI_NOR_ID_2ITEMS(_ext_id) }, \ 569 - .id_len = !(_jedec_id) ? 0 : (3 + ((_ext_id) ? 2 : 0)) 570 - 571 - #define SPI_NOR_ID6(_jedec_id, _ext_id) \ 572 - .id = { SPI_NOR_ID_3ITEMS(_jedec_id), SPI_NOR_ID_3ITEMS(_ext_id) }, \ 573 - .id_len = 6 574 - 575 - #define SPI_NOR_GEOMETRY(_sector_size, _n_sectors, _n_banks) \ 576 - .sector_size = (_sector_size), \ 577 - .n_sectors = (_n_sectors), \ 578 - .page_size = 256, \ 579 - .n_banks = (_n_banks) 580 - 581 - /* Used when the "_ext_id" is two bytes at most */ 582 - #define INFO(_jedec_id, _ext_id, _sector_size, _n_sectors) \ 583 - SPI_NOR_ID((_jedec_id), (_ext_id)), \ 584 - SPI_NOR_GEOMETRY((_sector_size), (_n_sectors), 1), 585 - 586 - #define INFOB(_jedec_id, _ext_id, _sector_size, _n_sectors, _n_banks) \ 587 - SPI_NOR_ID((_jedec_id), (_ext_id)), \ 588 - SPI_NOR_GEOMETRY((_sector_size), (_n_sectors), (_n_banks)), 589 - 590 - #define INFO6(_jedec_id, _ext_id, _sector_size, _n_sectors) \ 591 - SPI_NOR_ID6((_jedec_id), (_ext_id)), \ 592 - SPI_NOR_GEOMETRY((_sector_size), (_n_sectors), 1), 593 - 594 - #define CAT25_INFO(_sector_size, _n_sectors, _page_size, _addr_nbytes) \ 595 - .sector_size = (_sector_size), \ 596 - .n_sectors = (_n_sectors), \ 597 - .page_size = (_page_size), \ 598 - .n_banks = 1, \ 599 - .addr_nbytes = (_addr_nbytes), \ 600 - .flags = SPI_NOR_NO_ERASE | SPI_NOR_NO_FR, \ 601 - 602 - #define OTP_INFO(_len, _n_regions, _base, _offset) \ 603 - .otp_org = { \ 604 - .len = (_len), \ 605 - .base = (_base), \ 606 - .offset = (_offset), \ 607 - .n_regions = (_n_regions), \ 608 - }, 609 - 610 - #define PARSE_SFDP \ 611 - .parse_sfdp = true, \ 612 - 613 - #define FLAGS(_flags) \ 614 - .flags = (_flags), \ 615 - 616 - #define NO_SFDP_FLAGS(_no_sfdp_flags) \ 617 - .no_sfdp_flags = (_no_sfdp_flags), \ 618 - 619 - #define FIXUP_FLAGS(_fixup_flags) \ 620 - .fixup_flags = (_fixup_flags), \ 621 - 622 - #define MFR_FLAGS(_mfr_flags) \ 623 - .mfr_flags = (_mfr_flags), \ 553 + #define SNOR_OTP(_len, _n_regions, _base, _offset) \ 554 + (&(const struct spi_nor_otp_organization){ \ 555 + .len = (_len), \ 556 + .base = (_base), \ 557 + .offset = (_offset), \ 558 + .n_regions = (_n_regions), \ 559 + }) 624 560 625 561 /** 626 562 * struct spi_nor_manufacturer - SPI NOR manufacturer object ··· 601 631 602 632 /* Manufacturer drivers. */ 603 633 extern const struct spi_nor_manufacturer spi_nor_atmel; 604 - extern const struct spi_nor_manufacturer spi_nor_catalyst; 605 634 extern const struct spi_nor_manufacturer spi_nor_eon; 606 635 extern const struct spi_nor_manufacturer spi_nor_esmt; 607 636 extern const struct spi_nor_manufacturer spi_nor_everspin; 608 - extern const struct spi_nor_manufacturer spi_nor_fujitsu; 609 637 extern const struct spi_nor_manufacturer spi_nor_gigadevice; 610 638 extern const struct spi_nor_manufacturer spi_nor_intel; 611 639 extern const struct spi_nor_manufacturer spi_nor_issi; ··· 700 732 static inline struct spi_nor *mtd_to_spi_nor(struct mtd_info *mtd) 701 733 { 702 734 return container_of(mtd, struct spi_nor, mtd); 735 + } 736 + 737 + /** 738 + * spi_nor_needs_sfdp() - returns true if SFDP parsing is used for this flash. 739 + * 740 + * Return: true if SFDP parsing is needed 741 + */ 742 + static inline bool spi_nor_needs_sfdp(const struct spi_nor *nor) 743 + { 744 + /* 745 + * The flash size is one property parsed by the SFDP. We use it as an 746 + * indicator whether we need SFDP parsing for a particular flash. I.e. 747 + * non-legacy flash entries in flash_info will have a size of zero iff 748 + * SFDP should be used. 749 + */ 750 + return !nor->info->size; 703 751 } 704 752 705 753 #ifdef CONFIG_DEBUG_FS
+54 -20
drivers/mtd/spi-nor/eon.c
··· 9 9 #include "core.h" 10 10 11 11 static const struct flash_info eon_nor_parts[] = { 12 - /* EON -- en25xxx */ 13 - { "en25f32", INFO(0x1c3116, 0, 64 * 1024, 64) 14 - NO_SFDP_FLAGS(SECT_4K) }, 15 - { "en25p32", INFO(0x1c2016, 0, 64 * 1024, 64) }, 16 - { "en25q32b", INFO(0x1c3016, 0, 64 * 1024, 64) }, 17 - { "en25p64", INFO(0x1c2017, 0, 64 * 1024, 128) }, 18 - { "en25q64", INFO(0x1c3017, 0, 64 * 1024, 128) 19 - NO_SFDP_FLAGS(SECT_4K) }, 20 - { "en25q80a", INFO(0x1c3014, 0, 64 * 1024, 16) 21 - NO_SFDP_FLAGS(SECT_4K | SPI_NOR_DUAL_READ) }, 22 - { "en25qh16", INFO(0x1c7015, 0, 64 * 1024, 32) 23 - NO_SFDP_FLAGS(SECT_4K | SPI_NOR_DUAL_READ) }, 24 - { "en25qh32", INFO(0x1c7016, 0, 64 * 1024, 64) }, 25 - { "en25qh64", INFO(0x1c7017, 0, 64 * 1024, 128) 26 - NO_SFDP_FLAGS(SECT_4K | SPI_NOR_DUAL_READ) }, 27 - { "en25qh128", INFO(0x1c7018, 0, 64 * 1024, 256) }, 28 - { "en25qh256", INFO(0x1c7019, 0, 64 * 1024, 512) 29 - PARSE_SFDP }, 30 - { "en25s64", INFO(0x1c3817, 0, 64 * 1024, 128) 31 - NO_SFDP_FLAGS(SECT_4K) }, 12 + { 13 + .id = SNOR_ID(0x1c, 0x20, 0x16), 14 + .name = "en25p32", 15 + .size = SZ_4M, 16 + }, { 17 + .id = SNOR_ID(0x1c, 0x20, 0x17), 18 + .name = "en25p64", 19 + .size = SZ_8M, 20 + }, { 21 + .id = SNOR_ID(0x1c, 0x30, 0x14), 22 + .name = "en25q80a", 23 + .size = SZ_1M, 24 + .no_sfdp_flags = SECT_4K | SPI_NOR_DUAL_READ, 25 + }, { 26 + .id = SNOR_ID(0x1c, 0x30, 0x16), 27 + .name = "en25q32b", 28 + .size = SZ_4M, 29 + }, { 30 + .id = SNOR_ID(0x1c, 0x30, 0x17), 31 + .name = "en25q64", 32 + .size = SZ_8M, 33 + .no_sfdp_flags = SECT_4K, 34 + }, { 35 + .id = SNOR_ID(0x1c, 0x31, 0x16), 36 + .name = "en25f32", 37 + .size = SZ_4M, 38 + .no_sfdp_flags = SECT_4K, 39 + }, { 40 + .name = "en25s64", 41 + .id = SNOR_ID(0x1c, 0x38, 0x17), 42 + .size = SZ_8M, 43 + .no_sfdp_flags = SECT_4K, 44 + }, { 45 + .id = SNOR_ID(0x1c, 0x70, 0x15), 46 + .name = "en25qh16", 47 + .size = SZ_2M, 48 + .no_sfdp_flags = SECT_4K | SPI_NOR_DUAL_READ, 49 + }, { 50 + .id = SNOR_ID(0x1c, 0x70, 0x16), 51 + .name = "en25qh32", 52 + .size = SZ_4M, 53 + }, { 54 + .id = SNOR_ID(0x1c, 0x70, 0x17), 55 + .name = "en25qh64", 56 + .size = SZ_8M, 57 + .no_sfdp_flags = SECT_4K | SPI_NOR_DUAL_READ, 58 + }, { 59 + .id = SNOR_ID(0x1c, 0x70, 0x18), 60 + .name = "en25qh128", 61 + .size = SZ_16M, 62 + }, { 63 + .id = SNOR_ID(0x1c, 0x70, 0x19), 64 + .name = "en25qh256", 65 + }, 32 66 }; 33 67 34 68 const struct spi_nor_manufacturer spi_nor_eon = {
+19 -10
drivers/mtd/spi-nor/esmt.c
··· 9 9 #include "core.h" 10 10 11 11 static const struct flash_info esmt_nor_parts[] = { 12 - /* ESMT */ 13 - { "f25l32pa", INFO(0x8c2016, 0, 64 * 1024, 64) 14 - FLAGS(SPI_NOR_HAS_LOCK | SPI_NOR_SWP_IS_VOLATILE) 15 - NO_SFDP_FLAGS(SECT_4K) }, 16 - { "f25l32qa-2s", INFO(0x8c4116, 0, 64 * 1024, 64) 17 - FLAGS(SPI_NOR_HAS_LOCK) 18 - NO_SFDP_FLAGS(SECT_4K) }, 19 - { "f25l64qa", INFO(0x8c4117, 0, 64 * 1024, 128) 20 - FLAGS(SPI_NOR_HAS_LOCK) 21 - NO_SFDP_FLAGS(SECT_4K) }, 12 + { 13 + .id = SNOR_ID(0x8c, 0x20, 0x16), 14 + .name = "f25l32pa", 15 + .size = SZ_4M, 16 + .flags = SPI_NOR_HAS_LOCK | SPI_NOR_SWP_IS_VOLATILE, 17 + .no_sfdp_flags = SECT_4K, 18 + }, { 19 + .id = SNOR_ID(0x8c, 0x41, 0x16), 20 + .name = "f25l32qa-2s", 21 + .size = SZ_4M, 22 + .flags = SPI_NOR_HAS_LOCK, 23 + .no_sfdp_flags = SECT_4K, 24 + }, { 25 + .id = SNOR_ID(0x8c, 0x41, 0x17), 26 + .name = "f25l64qa", 27 + .size = SZ_8M, 28 + .flags = SPI_NOR_HAS_LOCK, 29 + .no_sfdp_flags = SECT_4K, 30 + } 22 31 }; 23 32 24 33 const struct spi_nor_manufacturer spi_nor_esmt = {
+23 -5
drivers/mtd/spi-nor/everspin.c
··· 9 9 #include "core.h" 10 10 11 11 static const struct flash_info everspin_nor_parts[] = { 12 - /* Everspin */ 13 - { "mr25h128", CAT25_INFO(16 * 1024, 1, 256, 2) }, 14 - { "mr25h256", CAT25_INFO(32 * 1024, 1, 256, 2) }, 15 - { "mr25h10", CAT25_INFO(128 * 1024, 1, 256, 3) }, 16 - { "mr25h40", CAT25_INFO(512 * 1024, 1, 256, 3) }, 12 + { 13 + .name = "mr25h128", 14 + .size = SZ_16K, 15 + .sector_size = SZ_16K, 16 + .addr_nbytes = 2, 17 + .flags = SPI_NOR_NO_ERASE | SPI_NOR_NO_FR, 18 + }, { 19 + .name = "mr25h256", 20 + .size = SZ_32K, 21 + .sector_size = SZ_32K, 22 + .addr_nbytes = 2, 23 + .flags = SPI_NOR_NO_ERASE | SPI_NOR_NO_FR, 24 + }, { 25 + .name = "mr25h10", 26 + .size = SZ_128K, 27 + .sector_size = SZ_128K, 28 + .flags = SPI_NOR_NO_ERASE | SPI_NOR_NO_FR, 29 + }, { 30 + .name = "mr25h40", 31 + .size = SZ_512K, 32 + .sector_size = SZ_512K, 33 + .flags = SPI_NOR_NO_ERASE | SPI_NOR_NO_FR, 34 + } 17 35 }; 18 36 19 37 const struct spi_nor_manufacturer spi_nor_everspin = {
-21
drivers/mtd/spi-nor/fujitsu.c
··· 1 - // SPDX-License-Identifier: GPL-2.0 2 - /* 3 - * Copyright (C) 2005, Intec Automation Inc. 4 - * Copyright (C) 2014, Freescale Semiconductor, Inc. 5 - */ 6 - 7 - #include <linux/mtd/spi-nor.h> 8 - 9 - #include "core.h" 10 - 11 - static const struct flash_info fujitsu_nor_parts[] = { 12 - /* Fujitsu */ 13 - { "mb85rs1mt", INFO(0x047f27, 0, 128 * 1024, 1) 14 - FLAGS(SPI_NOR_NO_ERASE) }, 15 - }; 16 - 17 - const struct spi_nor_manufacturer spi_nor_fujitsu = { 18 - .name = "fujitsu", 19 - .parts = fujitsu_nor_parts, 20 - .nparts = ARRAY_SIZE(fujitsu_nor_parts), 21 - };
+49 -33
drivers/mtd/spi-nor/gigadevice.c
··· 34 34 }; 35 35 36 36 static const struct flash_info gigadevice_nor_parts[] = { 37 - { "gd25q16", INFO(0xc84015, 0, 64 * 1024, 32) 38 - FLAGS(SPI_NOR_HAS_LOCK | SPI_NOR_HAS_TB) 39 - NO_SFDP_FLAGS(SECT_4K | SPI_NOR_DUAL_READ | 40 - SPI_NOR_QUAD_READ) }, 41 - { "gd25q32", INFO(0xc84016, 0, 64 * 1024, 64) 42 - FLAGS(SPI_NOR_HAS_LOCK | SPI_NOR_HAS_TB) 43 - NO_SFDP_FLAGS(SECT_4K | SPI_NOR_DUAL_READ | 44 - SPI_NOR_QUAD_READ) }, 45 - { "gd25lq32", INFO(0xc86016, 0, 64 * 1024, 64) 46 - FLAGS(SPI_NOR_HAS_LOCK | SPI_NOR_HAS_TB) 47 - NO_SFDP_FLAGS(SECT_4K | SPI_NOR_DUAL_READ | 48 - SPI_NOR_QUAD_READ) }, 49 - { "gd25q64", INFO(0xc84017, 0, 64 * 1024, 128) 50 - FLAGS(SPI_NOR_HAS_LOCK | SPI_NOR_HAS_TB) 51 - NO_SFDP_FLAGS(SECT_4K | SPI_NOR_DUAL_READ | 52 - SPI_NOR_QUAD_READ) }, 53 - { "gd25lq64c", INFO(0xc86017, 0, 64 * 1024, 128) 54 - FLAGS(SPI_NOR_HAS_LOCK | SPI_NOR_HAS_TB) 55 - NO_SFDP_FLAGS(SECT_4K | SPI_NOR_DUAL_READ | 56 - SPI_NOR_QUAD_READ) }, 57 - { "gd25lq128d", INFO(0xc86018, 0, 64 * 1024, 256) 58 - FLAGS(SPI_NOR_HAS_LOCK | SPI_NOR_HAS_TB) 59 - NO_SFDP_FLAGS(SECT_4K | SPI_NOR_DUAL_READ | 60 - SPI_NOR_QUAD_READ) }, 61 - { "gd25q128", INFO(0xc84018, 0, 64 * 1024, 256) 62 - FLAGS(SPI_NOR_HAS_LOCK | SPI_NOR_HAS_TB) 63 - NO_SFDP_FLAGS(SECT_4K | SPI_NOR_DUAL_READ | 64 - SPI_NOR_QUAD_READ) }, 65 - { "gd25q256", INFO(0xc84019, 0, 64 * 1024, 512) 66 - PARSE_SFDP 67 - FLAGS(SPI_NOR_HAS_LOCK | SPI_NOR_HAS_TB | SPI_NOR_TB_SR_BIT6) 68 - FIXUP_FLAGS(SPI_NOR_4B_OPCODES) 69 - .fixups = &gd25q256_fixups }, 37 + { 38 + .id = SNOR_ID(0xc8, 0x40, 0x15), 39 + .name = "gd25q16", 40 + .size = SZ_2M, 41 + .flags = SPI_NOR_HAS_LOCK | SPI_NOR_HAS_TB, 42 + .no_sfdp_flags = SECT_4K | SPI_NOR_DUAL_READ | SPI_NOR_QUAD_READ, 43 + }, { 44 + .id = SNOR_ID(0xc8, 0x40, 0x16), 45 + .name = "gd25q32", 46 + .size = SZ_4M, 47 + .flags = SPI_NOR_HAS_LOCK | SPI_NOR_HAS_TB, 48 + .no_sfdp_flags = SECT_4K | SPI_NOR_DUAL_READ | SPI_NOR_QUAD_READ, 49 + }, { 50 + .id = SNOR_ID(0xc8, 0x40, 0x17), 51 + .name = "gd25q64", 52 + .size = SZ_8M, 53 + .flags = SPI_NOR_HAS_LOCK | SPI_NOR_HAS_TB, 54 + .no_sfdp_flags = SECT_4K | SPI_NOR_DUAL_READ | SPI_NOR_QUAD_READ, 55 + }, { 56 + .id = SNOR_ID(0xc8, 0x40, 0x18), 57 + .name = "gd25q128", 58 + .size = SZ_16M, 59 + .flags = SPI_NOR_HAS_LOCK | SPI_NOR_HAS_TB, 60 + .no_sfdp_flags = SECT_4K | SPI_NOR_DUAL_READ | SPI_NOR_QUAD_READ, 61 + }, { 62 + .id = SNOR_ID(0xc8, 0x40, 0x19), 63 + .name = "gd25q256", 64 + .flags = SPI_NOR_HAS_LOCK | SPI_NOR_HAS_TB | SPI_NOR_TB_SR_BIT6, 65 + .fixups = &gd25q256_fixups, 66 + .fixup_flags = SPI_NOR_4B_OPCODES, 67 + }, { 68 + .id = SNOR_ID(0xc8, 0x60, 0x16), 69 + .name = "gd25lq32", 70 + .size = SZ_4M, 71 + .flags = SPI_NOR_HAS_LOCK | SPI_NOR_HAS_TB, 72 + .no_sfdp_flags = SECT_4K | SPI_NOR_DUAL_READ | SPI_NOR_QUAD_READ, 73 + }, { 74 + .id = SNOR_ID(0xc8, 0x60, 0x17), 75 + .name = "gd25lq64c", 76 + .size = SZ_8M, 77 + .flags = SPI_NOR_HAS_LOCK | SPI_NOR_HAS_TB, 78 + .no_sfdp_flags = SECT_4K | SPI_NOR_DUAL_READ | SPI_NOR_QUAD_READ, 79 + }, { 80 + .id = SNOR_ID(0xc8, 0x60, 0x18), 81 + .name = "gd25lq128d", 82 + .size = SZ_16M, 83 + .flags = SPI_NOR_HAS_LOCK | SPI_NOR_HAS_TB, 84 + .no_sfdp_flags = SECT_4K | SPI_NOR_DUAL_READ | SPI_NOR_QUAD_READ, 85 + }, 70 86 }; 71 87 72 88 const struct spi_nor_manufacturer spi_nor_gigadevice = {
+16 -7
drivers/mtd/spi-nor/intel.c
··· 9 9 #include "core.h" 10 10 11 11 static const struct flash_info intel_nor_parts[] = { 12 - /* Intel/Numonyx -- xxxs33b */ 13 - { "160s33b", INFO(0x898911, 0, 64 * 1024, 32) 14 - FLAGS(SPI_NOR_HAS_LOCK | SPI_NOR_SWP_IS_VOLATILE) }, 15 - { "320s33b", INFO(0x898912, 0, 64 * 1024, 64) 16 - FLAGS(SPI_NOR_HAS_LOCK | SPI_NOR_SWP_IS_VOLATILE) }, 17 - { "640s33b", INFO(0x898913, 0, 64 * 1024, 128) 18 - FLAGS(SPI_NOR_HAS_LOCK | SPI_NOR_SWP_IS_VOLATILE) }, 12 + { 13 + .id = SNOR_ID(0x89, 0x89, 0x11), 14 + .name = "160s33b", 15 + .size = SZ_2M, 16 + .flags = SPI_NOR_HAS_LOCK | SPI_NOR_SWP_IS_VOLATILE, 17 + }, { 18 + .id = SNOR_ID(0x89, 0x89, 0x12), 19 + .name = "320s33b", 20 + .size = SZ_4M, 21 + .flags = SPI_NOR_HAS_LOCK | SPI_NOR_SWP_IS_VOLATILE, 22 + }, { 23 + .id = SNOR_ID(0x89, 0x89, 0x13), 24 + .name = "640s33b", 25 + .size = SZ_8M, 26 + .flags = SPI_NOR_HAS_LOCK | SPI_NOR_SWP_IS_VOLATILE, 27 + } 19 28 }; 20 29 21 30 const struct spi_nor_manufacturer spi_nor_intel = {
+78 -40
drivers/mtd/spi-nor/issi.c
··· 47 47 }; 48 48 49 49 static const struct flash_info issi_nor_parts[] = { 50 - /* ISSI */ 51 - { "is25cd512", INFO(0x7f9d20, 0, 32 * 1024, 2) 52 - NO_SFDP_FLAGS(SECT_4K) }, 53 - { "is25lq040b", INFO(0x9d4013, 0, 64 * 1024, 8) 54 - NO_SFDP_FLAGS(SECT_4K | SPI_NOR_DUAL_READ | SPI_NOR_QUAD_READ) }, 55 - { "is25lp016d", INFO(0x9d6015, 0, 64 * 1024, 32) 56 - NO_SFDP_FLAGS(SECT_4K | SPI_NOR_DUAL_READ | SPI_NOR_QUAD_READ) }, 57 - { "is25lp080d", INFO(0x9d6014, 0, 64 * 1024, 16) 58 - NO_SFDP_FLAGS(SECT_4K | SPI_NOR_DUAL_READ | SPI_NOR_QUAD_READ) }, 59 - { "is25lp032", INFO(0x9d6016, 0, 64 * 1024, 64) 60 - NO_SFDP_FLAGS(SECT_4K | SPI_NOR_DUAL_READ) }, 61 - { "is25lp064", INFO(0x9d6017, 0, 64 * 1024, 128) 62 - NO_SFDP_FLAGS(SECT_4K | SPI_NOR_DUAL_READ) }, 63 - { "is25lp128", INFO(0x9d6018, 0, 64 * 1024, 256) 64 - NO_SFDP_FLAGS(SECT_4K | SPI_NOR_DUAL_READ) }, 65 - { "is25lp256", INFO(0x9d6019, 0, 64 * 1024, 512) 66 - PARSE_SFDP 67 - FIXUP_FLAGS(SPI_NOR_4B_OPCODES) 68 - .fixups = &is25lp256_fixups }, 69 - { "is25wp032", INFO(0x9d7016, 0, 64 * 1024, 64) 70 - NO_SFDP_FLAGS(SECT_4K | SPI_NOR_DUAL_READ | SPI_NOR_QUAD_READ) }, 71 - { "is25wp064", INFO(0x9d7017, 0, 64 * 1024, 128) 72 - NO_SFDP_FLAGS(SECT_4K | SPI_NOR_DUAL_READ | SPI_NOR_QUAD_READ) }, 73 - { "is25wp128", INFO(0x9d7018, 0, 64 * 1024, 256) 74 - NO_SFDP_FLAGS(SECT_4K | SPI_NOR_DUAL_READ | SPI_NOR_QUAD_READ) }, 75 - { "is25wp256", INFO(0x9d7019, 0, 0, 0) 76 - PARSE_SFDP 77 - FIXUP_FLAGS(SPI_NOR_4B_OPCODES) 78 - FLAGS(SPI_NOR_QUAD_PP) 79 - .fixups = &is25lp256_fixups }, 80 - 81 - /* PMC */ 82 - { "pm25lv512", INFO(0, 0, 32 * 1024, 2) 83 - NO_SFDP_FLAGS(SECT_4K) 50 + { 51 + .name = "pm25lv512", 52 + .sector_size = SZ_32K, 53 + .size = SZ_64K, 54 + .no_sfdp_flags = SECT_4K, 84 55 .fixups = &pm25lv_nor_fixups 85 - }, 86 - { "pm25lv010", INFO(0, 0, 32 * 1024, 4) 87 - NO_SFDP_FLAGS(SECT_4K) 56 + }, { 57 + .name = "pm25lv010", 58 + .sector_size = SZ_32K, 59 + .size = SZ_128K, 60 + .no_sfdp_flags = SECT_4K, 88 61 .fixups = &pm25lv_nor_fixups 89 - }, 90 - { "pm25lq032", INFO(0x7f9d46, 0, 64 * 1024, 64) 91 - NO_SFDP_FLAGS(SECT_4K) }, 62 + }, { 63 + .id = SNOR_ID(0x7f, 0x9d, 0x20), 64 + .name = "is25cd512", 65 + .sector_size = SZ_32K, 66 + .size = SZ_64K, 67 + .no_sfdp_flags = SECT_4K, 68 + }, { 69 + .id = SNOR_ID(0x7f, 0x9d, 0x46), 70 + .name = "pm25lq032", 71 + .size = SZ_4M, 72 + .no_sfdp_flags = SECT_4K, 73 + }, { 74 + .id = SNOR_ID(0x9d, 0x40, 0x13), 75 + .name = "is25lq040b", 76 + .size = SZ_512K, 77 + .no_sfdp_flags = SECT_4K | SPI_NOR_DUAL_READ | SPI_NOR_QUAD_READ, 78 + }, { 79 + .id = SNOR_ID(0x9d, 0x60, 0x14), 80 + .name = "is25lp080d", 81 + .size = SZ_1M, 82 + .no_sfdp_flags = SECT_4K | SPI_NOR_DUAL_READ | SPI_NOR_QUAD_READ, 83 + }, { 84 + .id = SNOR_ID(0x9d, 0x60, 0x15), 85 + .name = "is25lp016d", 86 + .size = SZ_2M, 87 + .no_sfdp_flags = SECT_4K | SPI_NOR_DUAL_READ | SPI_NOR_QUAD_READ, 88 + }, { 89 + .id = SNOR_ID(0x9d, 0x60, 0x16), 90 + .name = "is25lp032", 91 + .size = SZ_4M, 92 + .no_sfdp_flags = SECT_4K | SPI_NOR_DUAL_READ, 93 + }, { 94 + .id = SNOR_ID(0x9d, 0x60, 0x17), 95 + .name = "is25lp064", 96 + .size = SZ_8M, 97 + .no_sfdp_flags = SECT_4K | SPI_NOR_DUAL_READ, 98 + }, { 99 + .id = SNOR_ID(0x9d, 0x60, 0x18), 100 + .name = "is25lp128", 101 + .size = SZ_16M, 102 + .no_sfdp_flags = SECT_4K | SPI_NOR_DUAL_READ, 103 + }, { 104 + .id = SNOR_ID(0x9d, 0x60, 0x19), 105 + .name = "is25lp256", 106 + .fixups = &is25lp256_fixups, 107 + .fixup_flags = SPI_NOR_4B_OPCODES, 108 + }, { 109 + .id = SNOR_ID(0x9d, 0x70, 0x16), 110 + .name = "is25wp032", 111 + .size = SZ_4M, 112 + .no_sfdp_flags = SECT_4K | SPI_NOR_DUAL_READ | SPI_NOR_QUAD_READ, 113 + }, { 114 + .id = SNOR_ID(0x9d, 0x70, 0x17), 115 + .size = SZ_8M, 116 + .name = "is25wp064", 117 + .no_sfdp_flags = SECT_4K | SPI_NOR_DUAL_READ | SPI_NOR_QUAD_READ, 118 + }, { 119 + .id = SNOR_ID(0x9d, 0x70, 0x18), 120 + .name = "is25wp128", 121 + .size = SZ_16M, 122 + .no_sfdp_flags = SECT_4K | SPI_NOR_DUAL_READ | SPI_NOR_QUAD_READ, 123 + }, { 124 + .id = SNOR_ID(0x9d, 0x70, 0x19), 125 + .name = "is25wp256", 126 + .flags = SPI_NOR_QUAD_PP, 127 + .fixups = &is25lp256_fixups, 128 + .fixup_flags = SPI_NOR_4B_OPCODES, 129 + } 92 130 }; 93 131 94 132 static void issi_nor_default_init(struct spi_nor *nor)
+150 -70
drivers/mtd/spi-nor/macronix.c
··· 33 33 }; 34 34 35 35 static const struct flash_info macronix_nor_parts[] = { 36 - /* Macronix */ 37 - { "mx25l512e", INFO(0xc22010, 0, 64 * 1024, 1) 38 - NO_SFDP_FLAGS(SECT_4K) }, 39 - { "mx25l2005a", INFO(0xc22012, 0, 64 * 1024, 4) 40 - NO_SFDP_FLAGS(SECT_4K) }, 41 - { "mx25l4005a", INFO(0xc22013, 0, 64 * 1024, 8) 42 - NO_SFDP_FLAGS(SECT_4K) }, 43 - { "mx25l8005", INFO(0xc22014, 0, 64 * 1024, 16) }, 44 - { "mx25l1606e", INFO(0xc22015, 0, 64 * 1024, 32) 45 - NO_SFDP_FLAGS(SECT_4K) }, 46 - { "mx25l3205d", INFO(0xc22016, 0, 64 * 1024, 64) 47 - NO_SFDP_FLAGS(SECT_4K) }, 48 - { "mx25l3255e", INFO(0xc29e16, 0, 64 * 1024, 64) 49 - NO_SFDP_FLAGS(SECT_4K) }, 50 - { "mx25l6405d", INFO(0xc22017, 0, 64 * 1024, 128) 51 - NO_SFDP_FLAGS(SECT_4K) }, 52 - { "mx25u2033e", INFO(0xc22532, 0, 64 * 1024, 4) 53 - NO_SFDP_FLAGS(SECT_4K) }, 54 - { "mx25u3235f", INFO(0xc22536, 0, 64 * 1024, 64) 55 - NO_SFDP_FLAGS(SECT_4K | SPI_NOR_DUAL_READ | 56 - SPI_NOR_QUAD_READ) }, 57 - { "mx25u4035", INFO(0xc22533, 0, 64 * 1024, 8) 58 - NO_SFDP_FLAGS(SECT_4K) }, 59 - { "mx25u8035", INFO(0xc22534, 0, 64 * 1024, 16) 60 - NO_SFDP_FLAGS(SECT_4K) }, 61 - { "mx25u6435f", INFO(0xc22537, 0, 64 * 1024, 128) 62 - NO_SFDP_FLAGS(SECT_4K) }, 63 - { "mx25l12805d", INFO(0xc22018, 0, 64 * 1024, 256) 64 - FLAGS(SPI_NOR_HAS_LOCK | SPI_NOR_4BIT_BP) 65 - NO_SFDP_FLAGS(SECT_4K) }, 66 - { "mx25l12855e", INFO(0xc22618, 0, 64 * 1024, 256) }, 67 - { "mx25r1635f", INFO(0xc22815, 0, 64 * 1024, 32) 68 - NO_SFDP_FLAGS(SECT_4K | SPI_NOR_DUAL_READ | 69 - SPI_NOR_QUAD_READ) }, 70 - { "mx25r3235f", INFO(0xc22816, 0, 64 * 1024, 64) 71 - NO_SFDP_FLAGS(SECT_4K | SPI_NOR_DUAL_READ | 72 - SPI_NOR_QUAD_READ) }, 73 - { "mx25u12835f", INFO(0xc22538, 0, 64 * 1024, 256) 74 - NO_SFDP_FLAGS(SECT_4K | SPI_NOR_DUAL_READ | 75 - SPI_NOR_QUAD_READ) }, 76 - { "mx25l25635e", INFO(0xc22019, 0, 64 * 1024, 512) 77 - NO_SFDP_FLAGS(SPI_NOR_DUAL_READ | SPI_NOR_QUAD_READ) 78 - .fixups = &mx25l25635_fixups }, 79 - { "mx25u25635f", INFO(0xc22539, 0, 64 * 1024, 512) 80 - NO_SFDP_FLAGS(SECT_4K) 81 - FIXUP_FLAGS(SPI_NOR_4B_OPCODES) }, 82 - { "mx25u51245g", INFO(0xc2253a, 0, 64 * 1024, 1024) 83 - NO_SFDP_FLAGS(SECT_4K | SPI_NOR_DUAL_READ | SPI_NOR_QUAD_READ) 84 - FIXUP_FLAGS(SPI_NOR_4B_OPCODES) }, 85 - { "mx25uw51245g", INFOB(0xc2813a, 0, 0, 0, 4) 86 - PARSE_SFDP 87 - FLAGS(SPI_NOR_RWW) }, 88 - { "mx25v8035f", INFO(0xc22314, 0, 64 * 1024, 16) 89 - NO_SFDP_FLAGS(SECT_4K | SPI_NOR_DUAL_READ | 90 - SPI_NOR_QUAD_READ) }, 91 - { "mx25l25655e", INFO(0xc22619, 0, 64 * 1024, 512) }, 92 - { "mx66l51235f", INFO(0xc2201a, 0, 64 * 1024, 1024) 93 - NO_SFDP_FLAGS(SPI_NOR_DUAL_READ | SPI_NOR_QUAD_READ) 94 - FIXUP_FLAGS(SPI_NOR_4B_OPCODES) }, 95 - { "mx66u51235f", INFO(0xc2253a, 0, 64 * 1024, 1024) 96 - NO_SFDP_FLAGS(SECT_4K | SPI_NOR_DUAL_READ | SPI_NOR_QUAD_READ) 97 - FIXUP_FLAGS(SPI_NOR_4B_OPCODES) }, 98 - { "mx66l1g45g", INFO(0xc2201b, 0, 64 * 1024, 2048) 99 - NO_SFDP_FLAGS(SECT_4K | SPI_NOR_DUAL_READ | 100 - SPI_NOR_QUAD_READ) }, 101 - { "mx66l1g55g", INFO(0xc2261b, 0, 64 * 1024, 2048) 102 - NO_SFDP_FLAGS(SPI_NOR_QUAD_READ) }, 103 - { "mx66u2g45g", INFO(0xc2253c, 0, 64 * 1024, 4096) 104 - NO_SFDP_FLAGS(SECT_4K | SPI_NOR_DUAL_READ | SPI_NOR_QUAD_READ) 105 - FIXUP_FLAGS(SPI_NOR_4B_OPCODES) }, 36 + { 37 + .id = SNOR_ID(0xc2, 0x20, 0x10), 38 + .name = "mx25l512e", 39 + .size = SZ_64K, 40 + .no_sfdp_flags = SECT_4K, 41 + }, { 42 + .id = SNOR_ID(0xc2, 0x20, 0x12), 43 + .name = "mx25l2005a", 44 + .size = SZ_256K, 45 + .no_sfdp_flags = SECT_4K, 46 + }, { 47 + .id = SNOR_ID(0xc2, 0x20, 0x13), 48 + .name = "mx25l4005a", 49 + .size = SZ_512K, 50 + .no_sfdp_flags = SECT_4K, 51 + }, { 52 + .id = SNOR_ID(0xc2, 0x20, 0x14), 53 + .name = "mx25l8005", 54 + .size = SZ_1M, 55 + }, { 56 + .id = SNOR_ID(0xc2, 0x20, 0x15), 57 + .name = "mx25l1606e", 58 + .size = SZ_2M, 59 + .no_sfdp_flags = SECT_4K, 60 + }, { 61 + .id = SNOR_ID(0xc2, 0x20, 0x16), 62 + .name = "mx25l3205d", 63 + .size = SZ_4M, 64 + .no_sfdp_flags = SECT_4K, 65 + }, { 66 + .id = SNOR_ID(0xc2, 0x20, 0x17), 67 + .name = "mx25l6405d", 68 + .size = SZ_8M, 69 + .no_sfdp_flags = SECT_4K, 70 + }, { 71 + .id = SNOR_ID(0xc2, 0x20, 0x18), 72 + .name = "mx25l12805d", 73 + .size = SZ_16M, 74 + .flags = SPI_NOR_HAS_LOCK | SPI_NOR_4BIT_BP, 75 + .no_sfdp_flags = SECT_4K, 76 + }, { 77 + .id = SNOR_ID(0xc2, 0x20, 0x19), 78 + .name = "mx25l25635e", 79 + .size = SZ_32M, 80 + .no_sfdp_flags = SPI_NOR_DUAL_READ | SPI_NOR_QUAD_READ, 81 + .fixups = &mx25l25635_fixups 82 + }, { 83 + .id = SNOR_ID(0xc2, 0x20, 0x1a), 84 + .name = "mx66l51235f", 85 + .size = SZ_64M, 86 + .no_sfdp_flags = SPI_NOR_DUAL_READ | SPI_NOR_QUAD_READ, 87 + .fixup_flags = SPI_NOR_4B_OPCODES, 88 + }, { 89 + .id = SNOR_ID(0xc2, 0x20, 0x1b), 90 + .name = "mx66l1g45g", 91 + .size = SZ_128M, 92 + .no_sfdp_flags = SECT_4K | SPI_NOR_DUAL_READ | SPI_NOR_QUAD_READ, 93 + }, { 94 + .id = SNOR_ID(0xc2, 0x23, 0x14), 95 + .name = "mx25v8035f", 96 + .size = SZ_1M, 97 + .no_sfdp_flags = SECT_4K | SPI_NOR_DUAL_READ | SPI_NOR_QUAD_READ, 98 + }, { 99 + .id = SNOR_ID(0xc2, 0x25, 0x32), 100 + .name = "mx25u2033e", 101 + .size = SZ_256K, 102 + .no_sfdp_flags = SECT_4K, 103 + }, { 104 + .id = SNOR_ID(0xc2, 0x25, 0x33), 105 + .name = "mx25u4035", 106 + .size = SZ_512K, 107 + .no_sfdp_flags = SECT_4K, 108 + }, { 109 + .id = SNOR_ID(0xc2, 0x25, 0x34), 110 + .name = "mx25u8035", 111 + .size = SZ_1M, 112 + .no_sfdp_flags = SECT_4K, 113 + }, { 114 + .id = SNOR_ID(0xc2, 0x25, 0x36), 115 + .name = "mx25u3235f", 116 + .size = SZ_4M, 117 + .no_sfdp_flags = SECT_4K | SPI_NOR_DUAL_READ | SPI_NOR_QUAD_READ, 118 + }, { 119 + .id = SNOR_ID(0xc2, 0x25, 0x37), 120 + .name = "mx25u6435f", 121 + .size = SZ_8M, 122 + .no_sfdp_flags = SECT_4K, 123 + }, { 124 + .id = SNOR_ID(0xc2, 0x25, 0x38), 125 + .name = "mx25u12835f", 126 + .size = SZ_16M, 127 + .no_sfdp_flags = SECT_4K | SPI_NOR_DUAL_READ | SPI_NOR_QUAD_READ, 128 + }, { 129 + .id = SNOR_ID(0xc2, 0x25, 0x39), 130 + .name = "mx25u25635f", 131 + .size = SZ_32M, 132 + .no_sfdp_flags = SECT_4K, 133 + .fixup_flags = SPI_NOR_4B_OPCODES, 134 + }, { 135 + .id = SNOR_ID(0xc2, 0x25, 0x3a), 136 + .name = "mx25u51245g", 137 + .size = SZ_64M, 138 + .no_sfdp_flags = SECT_4K | SPI_NOR_DUAL_READ | SPI_NOR_QUAD_READ, 139 + .fixup_flags = SPI_NOR_4B_OPCODES, 140 + }, { 141 + .id = SNOR_ID(0xc2, 0x25, 0x3a), 142 + .name = "mx66u51235f", 143 + .size = SZ_64M, 144 + .no_sfdp_flags = SECT_4K | SPI_NOR_DUAL_READ | SPI_NOR_QUAD_READ, 145 + .fixup_flags = SPI_NOR_4B_OPCODES, 146 + }, { 147 + .id = SNOR_ID(0xc2, 0x25, 0x3c), 148 + .name = "mx66u2g45g", 149 + .size = SZ_256M, 150 + .no_sfdp_flags = SECT_4K | SPI_NOR_DUAL_READ | SPI_NOR_QUAD_READ, 151 + .fixup_flags = SPI_NOR_4B_OPCODES, 152 + }, { 153 + .id = SNOR_ID(0xc2, 0x26, 0x18), 154 + .name = "mx25l12855e", 155 + .size = SZ_16M, 156 + }, { 157 + .id = SNOR_ID(0xc2, 0x26, 0x19), 158 + .name = "mx25l25655e", 159 + .size = SZ_32M, 160 + }, { 161 + .id = SNOR_ID(0xc2, 0x26, 0x1b), 162 + .name = "mx66l1g55g", 163 + .size = SZ_128M, 164 + .no_sfdp_flags = SPI_NOR_QUAD_READ, 165 + }, { 166 + .id = SNOR_ID(0xc2, 0x28, 0x15), 167 + .name = "mx25r1635f", 168 + .size = SZ_2M, 169 + .no_sfdp_flags = SECT_4K | SPI_NOR_DUAL_READ | SPI_NOR_QUAD_READ, 170 + }, { 171 + .id = SNOR_ID(0xc2, 0x28, 0x16), 172 + .name = "mx25r3235f", 173 + .size = SZ_4M, 174 + .no_sfdp_flags = SECT_4K | SPI_NOR_DUAL_READ | SPI_NOR_QUAD_READ, 175 + }, { 176 + .id = SNOR_ID(0xc2, 0x81, 0x3a), 177 + .name = "mx25uw51245g", 178 + .n_banks = 4, 179 + .flags = SPI_NOR_RWW, 180 + }, { 181 + .id = SNOR_ID(0xc2, 0x9e, 0x16), 182 + .name = "mx25l3255e", 183 + .size = SZ_4M, 184 + .no_sfdp_flags = SECT_4K, 185 + } 106 186 }; 107 187 108 188 static void macronix_nor_default_init(struct spi_nor *nor)
+283 -140
drivers/mtd/spi-nor/micron-st.c
··· 78 78 return ret; 79 79 } 80 80 81 - if (memcmp(buf, nor->info->id, nor->info->id_len)) 81 + if (memcmp(buf, nor->info->id->bytes, nor->info->id->len)) 82 82 return -EINVAL; 83 83 84 84 return 0; ··· 114 114 return ret; 115 115 } 116 116 117 - if (memcmp(buf, nor->info->id, nor->info->id_len)) 117 + if (memcmp(buf, nor->info->id->bytes, nor->info->id->len)) 118 118 return -EINVAL; 119 119 120 120 return 0; ··· 159 159 }; 160 160 161 161 static const struct flash_info micron_nor_parts[] = { 162 - { "mt35xu512aba", INFO(0x2c5b1a, 0, 128 * 1024, 512) 163 - NO_SFDP_FLAGS(SECT_4K | SPI_NOR_OCTAL_READ | 164 - SPI_NOR_OCTAL_DTR_READ | SPI_NOR_OCTAL_DTR_PP) 165 - FIXUP_FLAGS(SPI_NOR_4B_OPCODES | SPI_NOR_IO_MODE_EN_VOLATILE) 166 - MFR_FLAGS(USE_FSR) 167 - .fixups = &mt35xu512aba_fixups 168 - }, 169 - { "mt35xu02g", INFO(0x2c5b1c, 0, 128 * 1024, 2048) 170 - NO_SFDP_FLAGS(SECT_4K | SPI_NOR_OCTAL_READ) 171 - FIXUP_FLAGS(SPI_NOR_4B_OPCODES) 172 - MFR_FLAGS(USE_FSR) 162 + { 163 + .id = SNOR_ID(0x2c, 0x5b, 0x1a), 164 + .name = "mt35xu512aba", 165 + .sector_size = SZ_128K, 166 + .size = SZ_64M, 167 + .no_sfdp_flags = SECT_4K | SPI_NOR_OCTAL_READ | 168 + SPI_NOR_OCTAL_DTR_READ | SPI_NOR_OCTAL_DTR_PP, 169 + .mfr_flags = USE_FSR, 170 + .fixup_flags = SPI_NOR_4B_OPCODES | SPI_NOR_IO_MODE_EN_VOLATILE, 171 + .fixups = &mt35xu512aba_fixups, 172 + }, { 173 + .id = SNOR_ID(0x2c, 0x5b, 0x1c), 174 + .name = "mt35xu02g", 175 + .sector_size = SZ_128K, 176 + .size = SZ_256M, 177 + .no_sfdp_flags = SECT_4K | SPI_NOR_OCTAL_READ, 178 + .mfr_flags = USE_FSR, 179 + .fixup_flags = SPI_NOR_4B_OPCODES, 173 180 }, 174 181 }; 175 182 183 + static int mt25qu512a_post_bfpt_fixup(struct spi_nor *nor, 184 + const struct sfdp_parameter_header *bfpt_header, 185 + const struct sfdp_bfpt *bfpt) 186 + { 187 + nor->flags &= ~SNOR_F_HAS_16BIT_SR; 188 + return 0; 189 + } 190 + 191 + static struct spi_nor_fixups mt25qu512a_fixups = { 192 + .post_bfpt = mt25qu512a_post_bfpt_fixup, 193 + }; 194 + 176 195 static const struct flash_info st_nor_parts[] = { 177 - { "n25q016a", INFO(0x20bb15, 0, 64 * 1024, 32) 178 - NO_SFDP_FLAGS(SECT_4K | SPI_NOR_QUAD_READ) }, 179 - { "n25q032", INFO(0x20ba16, 0, 64 * 1024, 64) 180 - NO_SFDP_FLAGS(SPI_NOR_QUAD_READ) }, 181 - { "n25q032a", INFO(0x20bb16, 0, 64 * 1024, 64) 182 - NO_SFDP_FLAGS(SPI_NOR_QUAD_READ) }, 183 - { "n25q064", INFO(0x20ba17, 0, 64 * 1024, 128) 184 - NO_SFDP_FLAGS(SECT_4K | SPI_NOR_QUAD_READ) }, 185 - { "n25q064a", INFO(0x20bb17, 0, 64 * 1024, 128) 186 - NO_SFDP_FLAGS(SECT_4K | SPI_NOR_QUAD_READ) }, 187 - { "n25q128a11", INFO(0x20bb18, 0, 64 * 1024, 256) 188 - FLAGS(SPI_NOR_HAS_LOCK | SPI_NOR_HAS_TB | SPI_NOR_4BIT_BP | 189 - SPI_NOR_BP3_SR_BIT6) 190 - NO_SFDP_FLAGS(SECT_4K | SPI_NOR_QUAD_READ) 191 - MFR_FLAGS(USE_FSR) 192 - }, 193 - { "n25q128a13", INFO(0x20ba18, 0, 64 * 1024, 256) 194 - FLAGS(SPI_NOR_HAS_LOCK | SPI_NOR_HAS_TB | SPI_NOR_4BIT_BP | 195 - SPI_NOR_BP3_SR_BIT6) 196 - NO_SFDP_FLAGS(SECT_4K | SPI_NOR_QUAD_READ) 197 - MFR_FLAGS(USE_FSR) 198 - }, 199 - { "mt25ql256a", INFO6(0x20ba19, 0x104400, 64 * 1024, 512) 200 - NO_SFDP_FLAGS(SECT_4K | SPI_NOR_DUAL_READ | SPI_NOR_QUAD_READ) 201 - FIXUP_FLAGS(SPI_NOR_4B_OPCODES) 202 - MFR_FLAGS(USE_FSR) 203 - }, 204 - { "n25q256a", INFO(0x20ba19, 0, 64 * 1024, 512) 205 - NO_SFDP_FLAGS(SECT_4K | SPI_NOR_DUAL_READ | 206 - SPI_NOR_QUAD_READ) 207 - MFR_FLAGS(USE_FSR) 208 - }, 209 - { "mt25qu256a", INFO6(0x20bb19, 0x104400, 64 * 1024, 512) 210 - FLAGS(SPI_NOR_HAS_LOCK | SPI_NOR_HAS_TB | SPI_NOR_4BIT_BP | 211 - SPI_NOR_BP3_SR_BIT6) 212 - NO_SFDP_FLAGS(SECT_4K | SPI_NOR_DUAL_READ | SPI_NOR_QUAD_READ) 213 - FIXUP_FLAGS(SPI_NOR_4B_OPCODES) 214 - MFR_FLAGS(USE_FSR) 215 - }, 216 - { "n25q256ax1", INFO(0x20bb19, 0, 64 * 1024, 512) 217 - NO_SFDP_FLAGS(SECT_4K | SPI_NOR_QUAD_READ) 218 - MFR_FLAGS(USE_FSR) 219 - }, 220 - { "mt25ql512a", INFO6(0x20ba20, 0x104400, 64 * 1024, 1024) 221 - NO_SFDP_FLAGS(SECT_4K | SPI_NOR_DUAL_READ | SPI_NOR_QUAD_READ) 222 - FIXUP_FLAGS(SPI_NOR_4B_OPCODES) 223 - MFR_FLAGS(USE_FSR) 224 - }, 225 - { "n25q512ax3", INFO(0x20ba20, 0, 64 * 1024, 1024) 226 - FLAGS(SPI_NOR_HAS_LOCK | SPI_NOR_HAS_TB | SPI_NOR_4BIT_BP | 227 - SPI_NOR_BP3_SR_BIT6) 228 - NO_SFDP_FLAGS(SECT_4K | SPI_NOR_QUAD_READ) 229 - MFR_FLAGS(USE_FSR) 230 - }, 231 - { "mt25qu512a", INFO6(0x20bb20, 0x104400, 64 * 1024, 1024) 232 - NO_SFDP_FLAGS(SECT_4K | SPI_NOR_DUAL_READ | SPI_NOR_QUAD_READ) 233 - FIXUP_FLAGS(SPI_NOR_4B_OPCODES) 234 - MFR_FLAGS(USE_FSR) 235 - }, 236 - { "n25q512a", INFO(0x20bb20, 0, 64 * 1024, 1024) 237 - FLAGS(SPI_NOR_HAS_LOCK | SPI_NOR_HAS_TB | SPI_NOR_4BIT_BP | 238 - SPI_NOR_BP3_SR_BIT6) 239 - NO_SFDP_FLAGS(SECT_4K | SPI_NOR_QUAD_READ) 240 - MFR_FLAGS(USE_FSR) 241 - }, 242 - { "n25q00", INFO(0x20ba21, 0, 64 * 1024, 2048) 243 - FLAGS(SPI_NOR_HAS_LOCK | SPI_NOR_HAS_TB | SPI_NOR_4BIT_BP | 244 - SPI_NOR_BP3_SR_BIT6 | NO_CHIP_ERASE) 245 - NO_SFDP_FLAGS(SECT_4K | SPI_NOR_QUAD_READ) 246 - MFR_FLAGS(USE_FSR) 247 - }, 248 - { "n25q00a", INFO(0x20bb21, 0, 64 * 1024, 2048) 249 - FLAGS(NO_CHIP_ERASE) 250 - NO_SFDP_FLAGS(SECT_4K | SPI_NOR_QUAD_READ) 251 - MFR_FLAGS(USE_FSR) 252 - }, 253 - { "mt25ql02g", INFO(0x20ba22, 0, 64 * 1024, 4096) 254 - FLAGS(NO_CHIP_ERASE) 255 - NO_SFDP_FLAGS(SECT_4K | SPI_NOR_QUAD_READ) 256 - MFR_FLAGS(USE_FSR) 257 - }, 258 - { "mt25qu02g", INFO(0x20bb22, 0, 64 * 1024, 4096) 259 - FLAGS(NO_CHIP_ERASE) 260 - NO_SFDP_FLAGS(SECT_4K | SPI_NOR_DUAL_READ | 261 - SPI_NOR_QUAD_READ) 262 - MFR_FLAGS(USE_FSR) 263 - }, 264 - 265 - { "m25p05", INFO(0x202010, 0, 32 * 1024, 2) }, 266 - { "m25p10", INFO(0x202011, 0, 32 * 1024, 4) }, 267 - { "m25p20", INFO(0x202012, 0, 64 * 1024, 4) }, 268 - { "m25p40", INFO(0x202013, 0, 64 * 1024, 8) }, 269 - { "m25p80", INFO(0x202014, 0, 64 * 1024, 16) }, 270 - { "m25p16", INFO(0x202015, 0, 64 * 1024, 32) }, 271 - { "m25p32", INFO(0x202016, 0, 64 * 1024, 64) }, 272 - { "m25p64", INFO(0x202017, 0, 64 * 1024, 128) }, 273 - { "m25p128", INFO(0x202018, 0, 256 * 1024, 64) }, 274 - 275 - { "m25p05-nonjedec", INFO(0, 0, 32 * 1024, 2) }, 276 - { "m25p10-nonjedec", INFO(0, 0, 32 * 1024, 4) }, 277 - { "m25p20-nonjedec", INFO(0, 0, 64 * 1024, 4) }, 278 - { "m25p40-nonjedec", INFO(0, 0, 64 * 1024, 8) }, 279 - { "m25p80-nonjedec", INFO(0, 0, 64 * 1024, 16) }, 280 - { "m25p16-nonjedec", INFO(0, 0, 64 * 1024, 32) }, 281 - { "m25p32-nonjedec", INFO(0, 0, 64 * 1024, 64) }, 282 - { "m25p64-nonjedec", INFO(0, 0, 64 * 1024, 128) }, 283 - { "m25p128-nonjedec", INFO(0, 0, 256 * 1024, 64) }, 284 - 285 - { "m45pe10", INFO(0x204011, 0, 64 * 1024, 2) }, 286 - { "m45pe80", INFO(0x204014, 0, 64 * 1024, 16) }, 287 - { "m45pe16", INFO(0x204015, 0, 64 * 1024, 32) }, 288 - 289 - { "m25pe20", INFO(0x208012, 0, 64 * 1024, 4) }, 290 - { "m25pe80", INFO(0x208014, 0, 64 * 1024, 16) }, 291 - { "m25pe16", INFO(0x208015, 0, 64 * 1024, 32) 292 - NO_SFDP_FLAGS(SECT_4K) }, 293 - 294 - { "m25px16", INFO(0x207115, 0, 64 * 1024, 32) 295 - NO_SFDP_FLAGS(SECT_4K) }, 296 - { "m25px32", INFO(0x207116, 0, 64 * 1024, 64) 297 - NO_SFDP_FLAGS(SECT_4K) }, 298 - { "m25px32-s0", INFO(0x207316, 0, 64 * 1024, 64) 299 - NO_SFDP_FLAGS(SECT_4K) }, 300 - { "m25px32-s1", INFO(0x206316, 0, 64 * 1024, 64) 301 - NO_SFDP_FLAGS(SECT_4K) }, 302 - { "m25px64", INFO(0x207117, 0, 64 * 1024, 128) }, 303 - { "m25px80", INFO(0x207114, 0, 64 * 1024, 16) }, 196 + { 197 + .name = "m25p05-nonjedec", 198 + .sector_size = SZ_32K, 199 + .size = SZ_64K, 200 + }, { 201 + .name = "m25p10-nonjedec", 202 + .sector_size = SZ_32K, 203 + .size = SZ_128K, 204 + }, { 205 + .name = "m25p20-nonjedec", 206 + .size = SZ_256K, 207 + }, { 208 + .name = "m25p40-nonjedec", 209 + .size = SZ_512K, 210 + }, { 211 + .name = "m25p80-nonjedec", 212 + .size = SZ_1M, 213 + }, { 214 + .name = "m25p16-nonjedec", 215 + .size = SZ_2M, 216 + }, { 217 + .name = "m25p32-nonjedec", 218 + .size = SZ_4M, 219 + }, { 220 + .name = "m25p64-nonjedec", 221 + .size = SZ_8M, 222 + }, { 223 + .name = "m25p128-nonjedec", 224 + .sector_size = SZ_256K, 225 + .size = SZ_16M, 226 + }, { 227 + .id = SNOR_ID(0x20, 0x20, 0x10), 228 + .name = "m25p05", 229 + .sector_size = SZ_32K, 230 + .size = SZ_64K, 231 + }, { 232 + .id = SNOR_ID(0x20, 0x20, 0x11), 233 + .name = "m25p10", 234 + .sector_size = SZ_32K, 235 + .size = SZ_128K, 236 + }, { 237 + .id = SNOR_ID(0x20, 0x20, 0x12), 238 + .name = "m25p20", 239 + .size = SZ_256K, 240 + }, { 241 + .id = SNOR_ID(0x20, 0x20, 0x13), 242 + .name = "m25p40", 243 + .size = SZ_512K, 244 + }, { 245 + .id = SNOR_ID(0x20, 0x20, 0x14), 246 + .name = "m25p80", 247 + .size = SZ_1M, 248 + }, { 249 + .id = SNOR_ID(0x20, 0x20, 0x15), 250 + .name = "m25p16", 251 + .size = SZ_2M, 252 + }, { 253 + .id = SNOR_ID(0x20, 0x20, 0x16), 254 + .name = "m25p32", 255 + .size = SZ_4M, 256 + }, { 257 + .id = SNOR_ID(0x20, 0x20, 0x17), 258 + .name = "m25p64", 259 + .size = SZ_8M, 260 + }, { 261 + .id = SNOR_ID(0x20, 0x20, 0x18), 262 + .name = "m25p128", 263 + .sector_size = SZ_256K, 264 + .size = SZ_16M, 265 + }, { 266 + .id = SNOR_ID(0x20, 0x40, 0x11), 267 + .name = "m45pe10", 268 + .size = SZ_128K, 269 + }, { 270 + .id = SNOR_ID(0x20, 0x40, 0x14), 271 + .name = "m45pe80", 272 + .size = SZ_1M, 273 + }, { 274 + .id = SNOR_ID(0x20, 0x40, 0x15), 275 + .name = "m45pe16", 276 + .size = SZ_2M, 277 + }, { 278 + .id = SNOR_ID(0x20, 0x63, 0x16), 279 + .name = "m25px32-s1", 280 + .size = SZ_4M, 281 + .no_sfdp_flags = SECT_4K, 282 + }, { 283 + .id = SNOR_ID(0x20, 0x71, 0x14), 284 + .name = "m25px80", 285 + .size = SZ_1M, 286 + }, { 287 + .id = SNOR_ID(0x20, 0x71, 0x15), 288 + .name = "m25px16", 289 + .size = SZ_2M, 290 + .no_sfdp_flags = SECT_4K, 291 + }, { 292 + .id = SNOR_ID(0x20, 0x71, 0x16), 293 + .name = "m25px32", 294 + .size = SZ_4M, 295 + .no_sfdp_flags = SECT_4K, 296 + }, { 297 + .id = SNOR_ID(0x20, 0x71, 0x17), 298 + .name = "m25px64", 299 + .size = SZ_8M, 300 + }, { 301 + .id = SNOR_ID(0x20, 0x73, 0x16), 302 + .name = "m25px32-s0", 303 + .size = SZ_4M, 304 + .no_sfdp_flags = SECT_4K, 305 + }, { 306 + .id = SNOR_ID(0x20, 0x80, 0x12), 307 + .name = "m25pe20", 308 + .size = SZ_256K, 309 + }, { 310 + .id = SNOR_ID(0x20, 0x80, 0x14), 311 + .name = "m25pe80", 312 + .size = SZ_1M, 313 + }, { 314 + .id = SNOR_ID(0x20, 0x80, 0x15), 315 + .name = "m25pe16", 316 + .size = SZ_2M, 317 + .no_sfdp_flags = SECT_4K, 318 + }, { 319 + .id = SNOR_ID(0x20, 0xba, 0x16), 320 + .name = "n25q032", 321 + .size = SZ_4M, 322 + .no_sfdp_flags = SPI_NOR_QUAD_READ, 323 + }, { 324 + .id = SNOR_ID(0x20, 0xba, 0x17), 325 + .name = "n25q064", 326 + .size = SZ_8M, 327 + .no_sfdp_flags = SECT_4K | SPI_NOR_QUAD_READ, 328 + }, { 329 + .id = SNOR_ID(0x20, 0xba, 0x18), 330 + .name = "n25q128a13", 331 + .size = SZ_16M, 332 + .flags = SPI_NOR_HAS_LOCK | SPI_NOR_HAS_TB | SPI_NOR_4BIT_BP | 333 + SPI_NOR_BP3_SR_BIT6, 334 + .no_sfdp_flags = SECT_4K | SPI_NOR_QUAD_READ, 335 + .mfr_flags = USE_FSR, 336 + }, { 337 + .id = SNOR_ID(0x20, 0xba, 0x19, 0x10, 0x44, 0x00), 338 + .name = "mt25ql256a", 339 + .size = SZ_32M, 340 + .no_sfdp_flags = SECT_4K | SPI_NOR_DUAL_READ | SPI_NOR_QUAD_READ, 341 + .fixup_flags = SPI_NOR_4B_OPCODES, 342 + .mfr_flags = USE_FSR, 343 + }, { 344 + .id = SNOR_ID(0x20, 0xba, 0x19), 345 + .name = "n25q256a", 346 + .size = SZ_32M, 347 + .no_sfdp_flags = SECT_4K | SPI_NOR_DUAL_READ | SPI_NOR_QUAD_READ, 348 + .mfr_flags = USE_FSR, 349 + }, { 350 + .id = SNOR_ID(0x20, 0xba, 0x20, 0x10, 0x44, 0x00), 351 + .name = "mt25ql512a", 352 + .size = SZ_64M, 353 + .no_sfdp_flags = SECT_4K | SPI_NOR_DUAL_READ | SPI_NOR_QUAD_READ, 354 + .fixup_flags = SPI_NOR_4B_OPCODES, 355 + .mfr_flags = USE_FSR, 356 + }, { 357 + .id = SNOR_ID(0x20, 0xba, 0x20), 358 + .name = "n25q512ax3", 359 + .size = SZ_64M, 360 + .flags = SPI_NOR_HAS_LOCK | SPI_NOR_HAS_TB | SPI_NOR_4BIT_BP | 361 + SPI_NOR_BP3_SR_BIT6, 362 + .no_sfdp_flags = SECT_4K | SPI_NOR_QUAD_READ, 363 + .mfr_flags = USE_FSR, 364 + }, { 365 + .id = SNOR_ID(0x20, 0xba, 0x21), 366 + .name = "n25q00", 367 + .size = SZ_128M, 368 + .flags = SPI_NOR_HAS_LOCK | SPI_NOR_HAS_TB | SPI_NOR_4BIT_BP | 369 + SPI_NOR_BP3_SR_BIT6 | NO_CHIP_ERASE, 370 + .no_sfdp_flags = SECT_4K | SPI_NOR_QUAD_READ, 371 + .mfr_flags = USE_FSR, 372 + }, { 373 + .id = SNOR_ID(0x20, 0xba, 0x22), 374 + .name = "mt25ql02g", 375 + .size = SZ_256M, 376 + .flags = NO_CHIP_ERASE, 377 + .no_sfdp_flags = SECT_4K | SPI_NOR_QUAD_READ, 378 + .mfr_flags = USE_FSR, 379 + }, { 380 + .id = SNOR_ID(0x20, 0xbb, 0x15), 381 + .name = "n25q016a", 382 + .size = SZ_2M, 383 + .no_sfdp_flags = SECT_4K | SPI_NOR_QUAD_READ, 384 + }, { 385 + .id = SNOR_ID(0x20, 0xbb, 0x16), 386 + .name = "n25q032a", 387 + .size = SZ_4M, 388 + .no_sfdp_flags = SPI_NOR_QUAD_READ, 389 + }, { 390 + .id = SNOR_ID(0x20, 0xbb, 0x17), 391 + .name = "n25q064a", 392 + .size = SZ_8M, 393 + .no_sfdp_flags = SECT_4K | SPI_NOR_QUAD_READ, 394 + }, { 395 + .id = SNOR_ID(0x20, 0xbb, 0x18), 396 + .name = "n25q128a11", 397 + .size = SZ_16M, 398 + .flags = SPI_NOR_HAS_LOCK | SPI_NOR_HAS_TB | SPI_NOR_4BIT_BP | 399 + SPI_NOR_BP3_SR_BIT6, 400 + .no_sfdp_flags = SECT_4K | SPI_NOR_QUAD_READ, 401 + .mfr_flags = USE_FSR, 402 + }, { 403 + .id = SNOR_ID(0x20, 0xbb, 0x19, 0x10, 0x44, 0x00), 404 + .name = "mt25qu256a", 405 + .size = SZ_32M, 406 + .flags = SPI_NOR_HAS_LOCK | SPI_NOR_HAS_TB | SPI_NOR_4BIT_BP | 407 + SPI_NOR_BP3_SR_BIT6, 408 + .no_sfdp_flags = SECT_4K | SPI_NOR_DUAL_READ | SPI_NOR_QUAD_READ, 409 + .fixup_flags = SPI_NOR_4B_OPCODES, 410 + .mfr_flags = USE_FSR, 411 + }, { 412 + .id = SNOR_ID(0x20, 0xbb, 0x19), 413 + .name = "n25q256ax1", 414 + .size = SZ_32M, 415 + .no_sfdp_flags = SECT_4K | SPI_NOR_QUAD_READ, 416 + .mfr_flags = USE_FSR, 417 + }, { 418 + .id = SNOR_ID(0x20, 0xbb, 0x20, 0x10, 0x44, 0x00), 419 + .name = "mt25qu512a", 420 + .flags = SPI_NOR_HAS_LOCK | SPI_NOR_HAS_TB | SPI_NOR_4BIT_BP | 421 + SPI_NOR_BP3_SR_BIT6, 422 + .mfr_flags = USE_FSR, 423 + .fixups = &mt25qu512a_fixups, 424 + }, { 425 + .id = SNOR_ID(0x20, 0xbb, 0x20), 426 + .name = "n25q512a", 427 + .size = SZ_64M, 428 + .flags = SPI_NOR_HAS_LOCK | SPI_NOR_HAS_TB | SPI_NOR_4BIT_BP | 429 + SPI_NOR_BP3_SR_BIT6, 430 + .no_sfdp_flags = SECT_4K | SPI_NOR_QUAD_READ, 431 + .mfr_flags = USE_FSR, 432 + }, { 433 + .id = SNOR_ID(0x20, 0xbb, 0x21), 434 + .name = "n25q00a", 435 + .size = SZ_128M, 436 + .flags = NO_CHIP_ERASE, 437 + .no_sfdp_flags = SECT_4K | SPI_NOR_QUAD_READ, 438 + .mfr_flags = USE_FSR, 439 + }, { 440 + .id = SNOR_ID(0x20, 0xbb, 0x22), 441 + .name = "mt25qu02g", 442 + .size = SZ_256M, 443 + .flags = NO_CHIP_ERASE, 444 + .no_sfdp_flags = SECT_4K | SPI_NOR_DUAL_READ | SPI_NOR_QUAD_READ, 445 + .mfr_flags = USE_FSR, 446 + } 304 447 }; 305 448 306 449 /**
+245 -147
drivers/mtd/spi-nor/spansion.c
··· 228 228 return ret; 229 229 } 230 230 231 - if (memcmp(buf, nor->info->id, nor->info->id_len)) 231 + if (memcmp(buf, nor->info->id->bytes, nor->info->id->len)) 232 232 return -EINVAL; 233 233 234 234 return 0; ··· 272 272 return ret; 273 273 } 274 274 275 - if (memcmp(buf, nor->info->id, nor->info->id_len)) 275 + if (memcmp(buf, nor->info->id->bytes, nor->info->id->len)) 276 276 return -EINVAL; 277 277 278 278 return 0; ··· 756 756 }; 757 757 758 758 static const struct flash_info spansion_nor_parts[] = { 759 - /* Spansion/Cypress -- single (large) sector size only, at least 760 - * for the chips listed here (without boot sectors). 761 - */ 762 - { "s25sl032p", INFO(0x010215, 0x4d00, 64 * 1024, 64) 763 - NO_SFDP_FLAGS(SPI_NOR_DUAL_READ | SPI_NOR_QUAD_READ) }, 764 - { "s25sl064p", INFO(0x010216, 0x4d00, 64 * 1024, 128) 765 - NO_SFDP_FLAGS(SPI_NOR_DUAL_READ | SPI_NOR_QUAD_READ) }, 766 - { "s25fl128s0", INFO6(0x012018, 0x4d0080, 256 * 1024, 64) 767 - NO_SFDP_FLAGS(SPI_NOR_DUAL_READ | SPI_NOR_QUAD_READ) 768 - MFR_FLAGS(USE_CLSR) 769 - }, 770 - { "s25fl128s1", INFO6(0x012018, 0x4d0180, 64 * 1024, 256) 771 - NO_SFDP_FLAGS(SPI_NOR_DUAL_READ | SPI_NOR_QUAD_READ) 772 - MFR_FLAGS(USE_CLSR) 773 - }, 774 - { "s25fl256s0", INFO6(0x010219, 0x4d0080, 256 * 1024, 128) 775 - NO_SFDP_FLAGS(SPI_NOR_SKIP_SFDP | SPI_NOR_DUAL_READ | 776 - SPI_NOR_QUAD_READ) 777 - MFR_FLAGS(USE_CLSR) 778 - }, 779 - { "s25fl256s1", INFO6(0x010219, 0x4d0180, 64 * 1024, 512) 780 - NO_SFDP_FLAGS(SPI_NOR_DUAL_READ | SPI_NOR_QUAD_READ) 781 - MFR_FLAGS(USE_CLSR) 782 - }, 783 - { "s25fl512s", INFO6(0x010220, 0x4d0080, 256 * 1024, 256) 784 - FLAGS(SPI_NOR_HAS_LOCK) 785 - NO_SFDP_FLAGS(SPI_NOR_DUAL_READ | SPI_NOR_QUAD_READ) 786 - MFR_FLAGS(USE_CLSR) 787 - }, 788 - { "s25fs128s1", INFO6(0x012018, 0x4d0181, 64 * 1024, 256) 789 - NO_SFDP_FLAGS(SPI_NOR_DUAL_READ | SPI_NOR_QUAD_READ) 790 - MFR_FLAGS(USE_CLSR) 791 - .fixups = &s25fs_s_nor_fixups, }, 792 - { "s25fs256s0", INFO6(0x010219, 0x4d0081, 256 * 1024, 128) 793 - NO_SFDP_FLAGS(SPI_NOR_DUAL_READ | SPI_NOR_QUAD_READ) 794 - MFR_FLAGS(USE_CLSR) 795 - }, 796 - { "s25fs256s1", INFO6(0x010219, 0x4d0181, 64 * 1024, 512) 797 - NO_SFDP_FLAGS(SPI_NOR_DUAL_READ | SPI_NOR_QUAD_READ) 798 - MFR_FLAGS(USE_CLSR) 799 - }, 800 - { "s25fs512s", INFO6(0x010220, 0x4d0081, 256 * 1024, 256) 801 - NO_SFDP_FLAGS(SPI_NOR_DUAL_READ | SPI_NOR_QUAD_READ) 802 - MFR_FLAGS(USE_CLSR) 803 - .fixups = &s25fs_s_nor_fixups, }, 804 - { "s25sl12800", INFO(0x012018, 0x0300, 256 * 1024, 64) }, 805 - { "s25sl12801", INFO(0x012018, 0x0301, 64 * 1024, 256) }, 806 - { "s25fl129p0", INFO(0x012018, 0x4d00, 256 * 1024, 64) 807 - NO_SFDP_FLAGS(SPI_NOR_DUAL_READ | SPI_NOR_QUAD_READ) 808 - MFR_FLAGS(USE_CLSR) 809 - }, 810 - { "s25fl129p1", INFO(0x012018, 0x4d01, 64 * 1024, 256) 811 - NO_SFDP_FLAGS(SPI_NOR_DUAL_READ | SPI_NOR_QUAD_READ) 812 - MFR_FLAGS(USE_CLSR) 813 - }, 814 - { "s25sl004a", INFO(0x010212, 0, 64 * 1024, 8) }, 815 - { "s25sl008a", INFO(0x010213, 0, 64 * 1024, 16) }, 816 - { "s25sl016a", INFO(0x010214, 0, 64 * 1024, 32) }, 817 - { "s25sl032a", INFO(0x010215, 0, 64 * 1024, 64) }, 818 - { "s25sl064a", INFO(0x010216, 0, 64 * 1024, 128) }, 819 - { "s25fl004k", INFO(0xef4013, 0, 64 * 1024, 8) 820 - NO_SFDP_FLAGS(SECT_4K | SPI_NOR_DUAL_READ | 821 - SPI_NOR_QUAD_READ) }, 822 - { "s25fl008k", INFO(0xef4014, 0, 64 * 1024, 16) 823 - NO_SFDP_FLAGS(SECT_4K | SPI_NOR_DUAL_READ | 824 - SPI_NOR_QUAD_READ) }, 825 - { "s25fl016k", INFO(0xef4015, 0, 64 * 1024, 32) 826 - NO_SFDP_FLAGS(SECT_4K | SPI_NOR_DUAL_READ | 827 - SPI_NOR_QUAD_READ) }, 828 - { "s25fl064k", INFO(0xef4017, 0, 64 * 1024, 128) 829 - NO_SFDP_FLAGS(SECT_4K | SPI_NOR_DUAL_READ | 830 - SPI_NOR_QUAD_READ) }, 831 - { "s25fl116k", INFO(0x014015, 0, 64 * 1024, 32) 832 - NO_SFDP_FLAGS(SECT_4K | SPI_NOR_DUAL_READ | 833 - SPI_NOR_QUAD_READ) }, 834 - { "s25fl132k", INFO(0x014016, 0, 64 * 1024, 64) 835 - NO_SFDP_FLAGS(SECT_4K) }, 836 - { "s25fl164k", INFO(0x014017, 0, 64 * 1024, 128) 837 - NO_SFDP_FLAGS(SECT_4K) }, 838 - { "s25fl204k", INFO(0x014013, 0, 64 * 1024, 8) 839 - NO_SFDP_FLAGS(SECT_4K | SPI_NOR_DUAL_READ) }, 840 - { "s25fl208k", INFO(0x014014, 0, 64 * 1024, 16) 841 - NO_SFDP_FLAGS(SECT_4K | SPI_NOR_DUAL_READ) }, 842 - { "s25fl064l", INFO(0x016017, 0, 64 * 1024, 128) 843 - NO_SFDP_FLAGS(SECT_4K | SPI_NOR_DUAL_READ | SPI_NOR_QUAD_READ) 844 - FIXUP_FLAGS(SPI_NOR_4B_OPCODES) }, 845 - { "s25fl128l", INFO(0x016018, 0, 64 * 1024, 256) 846 - NO_SFDP_FLAGS(SECT_4K | SPI_NOR_DUAL_READ | SPI_NOR_QUAD_READ) 847 - FIXUP_FLAGS(SPI_NOR_4B_OPCODES) }, 848 - { "s25fl256l", INFO(0x016019, 0, 64 * 1024, 512) 849 - NO_SFDP_FLAGS(SECT_4K | SPI_NOR_DUAL_READ | SPI_NOR_QUAD_READ) 850 - FIXUP_FLAGS(SPI_NOR_4B_OPCODES) }, 851 - { "s25fs256t", INFO6(0x342b19, 0x0f0890, 0, 0) 852 - PARSE_SFDP 853 - MFR_FLAGS(USE_CLPEF) 854 - .fixups = &s25fs256t_fixups }, 855 - { "s25hl512t", INFO6(0x342a1a, 0x0f0390, 0, 0) 856 - PARSE_SFDP 857 - MFR_FLAGS(USE_CLPEF) 858 - .fixups = &s25hx_t_fixups }, 859 - { "s25hl01gt", INFO6(0x342a1b, 0x0f0390, 0, 0) 860 - PARSE_SFDP 861 - MFR_FLAGS(USE_CLPEF) 862 - .fixups = &s25hx_t_fixups }, 863 - { "s25hl02gt", INFO6(0x342a1c, 0x0f0090, 0, 0) 864 - PARSE_SFDP 865 - MFR_FLAGS(USE_CLPEF) 866 - FLAGS(NO_CHIP_ERASE) 867 - .fixups = &s25hx_t_fixups }, 868 - { "s25hs512t", INFO6(0x342b1a, 0x0f0390, 0, 0) 869 - PARSE_SFDP 870 - MFR_FLAGS(USE_CLPEF) 871 - .fixups = &s25hx_t_fixups }, 872 - { "s25hs01gt", INFO6(0x342b1b, 0x0f0390, 0, 0) 873 - PARSE_SFDP 874 - MFR_FLAGS(USE_CLPEF) 875 - .fixups = &s25hx_t_fixups }, 876 - { "s25hs02gt", INFO6(0x342b1c, 0x0f0090, 0, 0) 877 - PARSE_SFDP 878 - MFR_FLAGS(USE_CLPEF) 879 - FLAGS(NO_CHIP_ERASE) 880 - .fixups = &s25hx_t_fixups }, 881 - { "cy15x104q", INFO6(0x042cc2, 0x7f7f7f, 512 * 1024, 1) 882 - FLAGS(SPI_NOR_NO_ERASE) }, 883 - { "s28hl512t", INFO(0x345a1a, 0, 0, 0) 884 - PARSE_SFDP 885 - MFR_FLAGS(USE_CLPEF) 759 + { 760 + .id = SNOR_ID(0x01, 0x02, 0x12), 761 + .name = "s25sl004a", 762 + .size = SZ_512K, 763 + }, { 764 + .id = SNOR_ID(0x01, 0x02, 0x13), 765 + .name = "s25sl008a", 766 + .size = SZ_1M, 767 + }, { 768 + .id = SNOR_ID(0x01, 0x02, 0x14), 769 + .name = "s25sl016a", 770 + .size = SZ_2M, 771 + }, { 772 + .id = SNOR_ID(0x01, 0x02, 0x15, 0x4d, 0x00), 773 + .name = "s25sl032p", 774 + .size = SZ_4M, 775 + .no_sfdp_flags = SPI_NOR_DUAL_READ | SPI_NOR_QUAD_READ, 776 + }, { 777 + .id = SNOR_ID(0x01, 0x02, 0x15), 778 + .name = "s25sl032a", 779 + .size = SZ_4M, 780 + }, { 781 + .id = SNOR_ID(0x01, 0x02, 0x16, 0x4d, 0x00), 782 + .name = "s25sl064p", 783 + .size = SZ_8M, 784 + .no_sfdp_flags = SPI_NOR_DUAL_READ | SPI_NOR_QUAD_READ, 785 + }, { 786 + .id = SNOR_ID(0x01, 0x02, 0x16), 787 + .name = "s25sl064a", 788 + .size = SZ_8M, 789 + }, { 790 + .id = SNOR_ID(0x01, 0x02, 0x19, 0x4d, 0x00, 0x80), 791 + .name = "s25fl256s0", 792 + .size = SZ_32M, 793 + .sector_size = SZ_256K, 794 + .no_sfdp_flags = SPI_NOR_SKIP_SFDP | SPI_NOR_DUAL_READ | SPI_NOR_QUAD_READ, 795 + .mfr_flags = USE_CLSR, 796 + }, { 797 + .id = SNOR_ID(0x01, 0x02, 0x19, 0x4d, 0x00, 0x81), 798 + .name = "s25fs256s0", 799 + .size = SZ_32M, 800 + .sector_size = SZ_256K, 801 + .no_sfdp_flags = SPI_NOR_DUAL_READ | SPI_NOR_QUAD_READ, 802 + .mfr_flags = USE_CLSR, 803 + }, { 804 + .id = SNOR_ID(0x01, 0x02, 0x19, 0x4d, 0x01, 0x80), 805 + .name = "s25fl256s1", 806 + .size = SZ_32M, 807 + .no_sfdp_flags = SPI_NOR_DUAL_READ | SPI_NOR_QUAD_READ, 808 + .mfr_flags = USE_CLSR, 809 + }, { 810 + .id = SNOR_ID(0x01, 0x02, 0x19, 0x4d, 0x01, 0x81), 811 + .name = "s25fs256s1", 812 + .size = SZ_32M, 813 + .no_sfdp_flags = SPI_NOR_DUAL_READ | SPI_NOR_QUAD_READ, 814 + .mfr_flags = USE_CLSR, 815 + }, { 816 + .id = SNOR_ID(0x01, 0x02, 0x20, 0x4d, 0x00, 0x80), 817 + .name = "s25fl512s", 818 + .size = SZ_64M, 819 + .sector_size = SZ_256K, 820 + .flags = SPI_NOR_HAS_LOCK, 821 + .no_sfdp_flags = SPI_NOR_DUAL_READ | SPI_NOR_QUAD_READ, 822 + .mfr_flags = USE_CLSR, 823 + }, { 824 + .id = SNOR_ID(0x01, 0x02, 0x20, 0x4d, 0x00, 0x81), 825 + .name = "s25fs512s", 826 + .size = SZ_64M, 827 + .sector_size = SZ_256K, 828 + .no_sfdp_flags = SPI_NOR_DUAL_READ | SPI_NOR_QUAD_READ, 829 + .mfr_flags = USE_CLSR, 830 + .fixups = &s25fs_s_nor_fixups, 831 + }, { 832 + .id = SNOR_ID(0x01, 0x20, 0x18, 0x03, 0x00), 833 + .name = "s25sl12800", 834 + .size = SZ_16M, 835 + .sector_size = SZ_256K, 836 + }, { 837 + .id = SNOR_ID(0x01, 0x20, 0x18, 0x03, 0x01), 838 + .name = "s25sl12801", 839 + .size = SZ_16M, 840 + }, { 841 + .id = SNOR_ID(0x01, 0x20, 0x18, 0x4d, 0x00, 0x80), 842 + .name = "s25fl128s0", 843 + .size = SZ_16M, 844 + .sector_size = SZ_256K, 845 + .no_sfdp_flags = SPI_NOR_DUAL_READ | SPI_NOR_QUAD_READ, 846 + .mfr_flags = USE_CLSR, 847 + }, { 848 + .id = SNOR_ID(0x01, 0x20, 0x18, 0x4d, 0x00), 849 + .name = "s25fl129p0", 850 + .size = SZ_16M, 851 + .sector_size = SZ_256K, 852 + .no_sfdp_flags = SPI_NOR_DUAL_READ | SPI_NOR_QUAD_READ, 853 + .mfr_flags = USE_CLSR, 854 + }, { 855 + .id = SNOR_ID(0x01, 0x20, 0x18, 0x4d, 0x01, 0x80), 856 + .name = "s25fl128s1", 857 + .size = SZ_16M, 858 + .no_sfdp_flags = SPI_NOR_DUAL_READ | SPI_NOR_QUAD_READ, 859 + .mfr_flags = USE_CLSR, 860 + }, { 861 + .id = SNOR_ID(0x01, 0x20, 0x18, 0x4d, 0x01, 0x81), 862 + .name = "s25fs128s1", 863 + .size = SZ_16M, 864 + .no_sfdp_flags = SPI_NOR_DUAL_READ | SPI_NOR_QUAD_READ, 865 + .mfr_flags = USE_CLSR, 866 + .fixups = &s25fs_s_nor_fixups, 867 + }, { 868 + .id = SNOR_ID(0x01, 0x20, 0x18, 0x4d, 0x01), 869 + .name = "s25fl129p1", 870 + .size = SZ_16M, 871 + .no_sfdp_flags = SPI_NOR_DUAL_READ | SPI_NOR_QUAD_READ, 872 + .mfr_flags = USE_CLSR, 873 + }, { 874 + .id = SNOR_ID(0x01, 0x40, 0x13), 875 + .name = "s25fl204k", 876 + .size = SZ_512K, 877 + .no_sfdp_flags = SECT_4K | SPI_NOR_DUAL_READ, 878 + }, { 879 + .id = SNOR_ID(0x01, 0x40, 0x14), 880 + .name = "s25fl208k", 881 + .size = SZ_1M, 882 + .no_sfdp_flags = SECT_4K | SPI_NOR_DUAL_READ, 883 + }, { 884 + .id = SNOR_ID(0x01, 0x40, 0x15), 885 + .name = "s25fl116k", 886 + .size = SZ_2M, 887 + .no_sfdp_flags = SECT_4K | SPI_NOR_DUAL_READ | SPI_NOR_QUAD_READ, 888 + }, { 889 + .id = SNOR_ID(0x01, 0x40, 0x16), 890 + .name = "s25fl132k", 891 + .size = SZ_4M, 892 + .no_sfdp_flags = SECT_4K, 893 + }, { 894 + .id = SNOR_ID(0x01, 0x40, 0x17), 895 + .name = "s25fl164k", 896 + .size = SZ_8M, 897 + .no_sfdp_flags = SECT_4K, 898 + }, { 899 + .id = SNOR_ID(0x01, 0x60, 0x17), 900 + .name = "s25fl064l", 901 + .size = SZ_8M, 902 + .no_sfdp_flags = SECT_4K | SPI_NOR_DUAL_READ | SPI_NOR_QUAD_READ, 903 + .fixup_flags = SPI_NOR_4B_OPCODES, 904 + }, { 905 + .id = SNOR_ID(0x01, 0x60, 0x18), 906 + .name = "s25fl128l", 907 + .size = SZ_16M, 908 + .no_sfdp_flags = SECT_4K | SPI_NOR_DUAL_READ | SPI_NOR_QUAD_READ, 909 + .fixup_flags = SPI_NOR_4B_OPCODES, 910 + }, { 911 + .id = SNOR_ID(0x01, 0x60, 0x19), 912 + .name = "s25fl256l", 913 + .size = SZ_32M, 914 + .no_sfdp_flags = SECT_4K | SPI_NOR_DUAL_READ | SPI_NOR_QUAD_READ, 915 + .fixup_flags = SPI_NOR_4B_OPCODES, 916 + }, { 917 + .id = SNOR_ID(0x04, 0x2c, 0xc2, 0x7f, 0x7f, 0x7f), 918 + .name = "cy15x104q", 919 + .size = SZ_512K, 920 + .sector_size = SZ_512K, 921 + .flags = SPI_NOR_NO_ERASE, 922 + }, { 923 + .id = SNOR_ID(0x34, 0x2a, 0x1a, 0x0f, 0x03, 0x90), 924 + .name = "s25hl512t", 925 + .mfr_flags = USE_CLPEF, 926 + .fixups = &s25hx_t_fixups 927 + }, { 928 + .id = SNOR_ID(0x34, 0x2a, 0x1b, 0x0f, 0x03, 0x90), 929 + .name = "s25hl01gt", 930 + .mfr_flags = USE_CLPEF, 931 + .fixups = &s25hx_t_fixups 932 + }, { 933 + .id = SNOR_ID(0x34, 0x2a, 0x1c, 0x0f, 0x00, 0x90), 934 + .name = "s25hl02gt", 935 + .mfr_flags = USE_CLPEF, 936 + .flags = NO_CHIP_ERASE, 937 + .fixups = &s25hx_t_fixups 938 + }, { 939 + .id = SNOR_ID(0x34, 0x2b, 0x19, 0x0f, 0x08, 0x90), 940 + .name = "s25fs256t", 941 + .mfr_flags = USE_CLPEF, 942 + .fixups = &s25fs256t_fixups 943 + }, { 944 + .id = SNOR_ID(0x34, 0x2b, 0x1a, 0x0f, 0x03, 0x90), 945 + .name = "s25hs512t", 946 + .mfr_flags = USE_CLPEF, 947 + .fixups = &s25hx_t_fixups 948 + }, { 949 + .id = SNOR_ID(0x34, 0x2b, 0x1b, 0x0f, 0x03, 0x90), 950 + .name = "s25hs01gt", 951 + .mfr_flags = USE_CLPEF, 952 + .fixups = &s25hx_t_fixups 953 + }, { 954 + .id = SNOR_ID(0x34, 0x2b, 0x1c, 0x0f, 0x00, 0x90), 955 + .name = "s25hs02gt", 956 + .mfr_flags = USE_CLPEF, 957 + .flags = NO_CHIP_ERASE, 958 + .fixups = &s25hx_t_fixups 959 + }, { 960 + .id = SNOR_ID(0x34, 0x5a, 0x1a), 961 + .name = "s28hl512t", 962 + .mfr_flags = USE_CLPEF, 886 963 .fixups = &s28hx_t_fixups, 887 - }, 888 - { "s28hl01gt", INFO(0x345a1b, 0, 0, 0) 889 - PARSE_SFDP 890 - MFR_FLAGS(USE_CLPEF) 964 + }, { 965 + .id = SNOR_ID(0x34, 0x5a, 0x1b), 966 + .name = "s28hl01gt", 967 + .mfr_flags = USE_CLPEF, 891 968 .fixups = &s28hx_t_fixups, 892 - }, 893 - { "s28hs512t", INFO(0x345b1a, 0, 0, 0) 894 - PARSE_SFDP 895 - MFR_FLAGS(USE_CLPEF) 969 + }, { 970 + .id = SNOR_ID(0x34, 0x5b, 0x1a), 971 + .name = "s28hs512t", 972 + .mfr_flags = USE_CLPEF, 896 973 .fixups = &s28hx_t_fixups, 897 - }, 898 - { "s28hs01gt", INFO(0x345b1b, 0, 0, 0) 899 - PARSE_SFDP 900 - MFR_FLAGS(USE_CLPEF) 974 + }, { 975 + .id = SNOR_ID(0x34, 0x5b, 0x1b), 976 + .name = "s28hs01gt", 977 + .mfr_flags = USE_CLPEF, 901 978 .fixups = &s28hx_t_fixups, 902 - }, 903 - { "s28hs02gt", INFO(0x345b1c, 0, 0, 0) 904 - PARSE_SFDP 905 - MFR_FLAGS(USE_CLPEF) 979 + }, { 980 + .id = SNOR_ID(0x34, 0x5b, 0x1c), 981 + .name = "s28hs02gt", 982 + .mfr_flags = USE_CLPEF, 906 983 .fixups = &s28hx_t_fixups, 907 - }, 984 + }, { 985 + .id = SNOR_ID(0xef, 0x40, 0x13), 986 + .name = "s25fl004k", 987 + .size = SZ_512K, 988 + .no_sfdp_flags = SECT_4K | SPI_NOR_DUAL_READ | SPI_NOR_QUAD_READ, 989 + }, { 990 + .id = SNOR_ID(0xef, 0x40, 0x14), 991 + .name = "s25fl008k", 992 + .size = SZ_1M, 993 + .no_sfdp_flags = SECT_4K | SPI_NOR_DUAL_READ | SPI_NOR_QUAD_READ, 994 + }, { 995 + .id = SNOR_ID(0xef, 0x40, 0x15), 996 + .name = "s25fl016k", 997 + .size = SZ_2M, 998 + .no_sfdp_flags = SECT_4K | SPI_NOR_DUAL_READ | SPI_NOR_QUAD_READ, 999 + }, { 1000 + .id = SNOR_ID(0xef, 0x40, 0x17), 1001 + .name = "s25fl064k", 1002 + .size = SZ_8M, 1003 + .no_sfdp_flags = SECT_4K | SPI_NOR_DUAL_READ | SPI_NOR_QUAD_READ, 1004 + } 908 1005 }; 909 1006 910 1007 /** ··· 1053 956 nor->flags |= SNOR_F_4B_OPCODES; 1054 957 /* No small sector erase for 4-byte command set */ 1055 958 nor->erase_opcode = SPINOR_OP_SE; 1056 - nor->mtd.erasesize = nor->info->sector_size; 959 + nor->mtd.erasesize = nor->info->sector_size ?: 960 + SPI_NOR_DEFAULT_SECTOR_SIZE; 1057 961 } 1058 962 1059 963 if (mfr_flags & (USE_CLSR | USE_CLPEF)) {
+104 -60
drivers/mtd/spi-nor/sst.c
··· 61 61 }; 62 62 63 63 static const struct flash_info sst_nor_parts[] = { 64 - /* SST -- large erase sizes are "overlays", "sectors" are 4K */ 65 - { "sst25vf040b", INFO(0xbf258d, 0, 64 * 1024, 8) 66 - FLAGS(SPI_NOR_HAS_LOCK | SPI_NOR_SWP_IS_VOLATILE) 67 - NO_SFDP_FLAGS(SECT_4K) 68 - MFR_FLAGS(SST_WRITE) }, 69 - { "sst25vf080b", INFO(0xbf258e, 0, 64 * 1024, 16) 70 - FLAGS(SPI_NOR_HAS_LOCK | SPI_NOR_SWP_IS_VOLATILE) 71 - NO_SFDP_FLAGS(SECT_4K) 72 - MFR_FLAGS(SST_WRITE) }, 73 - { "sst25vf016b", INFO(0xbf2541, 0, 64 * 1024, 32) 74 - FLAGS(SPI_NOR_HAS_LOCK | SPI_NOR_SWP_IS_VOLATILE) 75 - NO_SFDP_FLAGS(SECT_4K) 76 - MFR_FLAGS(SST_WRITE) }, 77 - { "sst25vf032b", INFO(0xbf254a, 0, 64 * 1024, 64) 78 - FLAGS(SPI_NOR_HAS_LOCK | SPI_NOR_SWP_IS_VOLATILE) 79 - NO_SFDP_FLAGS(SECT_4K) 80 - MFR_FLAGS(SST_WRITE) }, 81 - { "sst25vf064c", INFO(0xbf254b, 0, 64 * 1024, 128) 82 - FLAGS(SPI_NOR_HAS_LOCK | SPI_NOR_4BIT_BP | 83 - SPI_NOR_SWP_IS_VOLATILE) 84 - NO_SFDP_FLAGS(SECT_4K) }, 85 - { "sst25wf512", INFO(0xbf2501, 0, 64 * 1024, 1) 86 - FLAGS(SPI_NOR_HAS_LOCK | SPI_NOR_SWP_IS_VOLATILE) 87 - NO_SFDP_FLAGS(SECT_4K) 88 - MFR_FLAGS(SST_WRITE) }, 89 - { "sst25wf010", INFO(0xbf2502, 0, 64 * 1024, 2) 90 - FLAGS(SPI_NOR_HAS_LOCK | SPI_NOR_SWP_IS_VOLATILE) 91 - NO_SFDP_FLAGS(SECT_4K) 92 - MFR_FLAGS(SST_WRITE) }, 93 - { "sst25wf020", INFO(0xbf2503, 0, 64 * 1024, 4) 94 - FLAGS(SPI_NOR_HAS_LOCK | SPI_NOR_SWP_IS_VOLATILE) 95 - NO_SFDP_FLAGS(SECT_4K) 96 - MFR_FLAGS(SST_WRITE) }, 97 - { "sst25wf020a", INFO(0x621612, 0, 64 * 1024, 4) 98 - FLAGS(SPI_NOR_HAS_LOCK) 99 - NO_SFDP_FLAGS(SECT_4K) }, 100 - { "sst25wf040b", INFO(0x621613, 0, 64 * 1024, 8) 101 - FLAGS(SPI_NOR_HAS_LOCK) 102 - NO_SFDP_FLAGS(SECT_4K) }, 103 - { "sst25wf040", INFO(0xbf2504, 0, 64 * 1024, 8) 104 - FLAGS(SPI_NOR_HAS_LOCK | SPI_NOR_SWP_IS_VOLATILE) 105 - NO_SFDP_FLAGS(SECT_4K) 106 - MFR_FLAGS(SST_WRITE) }, 107 - { "sst25wf080", INFO(0xbf2505, 0, 64 * 1024, 16) 108 - FLAGS(SPI_NOR_HAS_LOCK | SPI_NOR_SWP_IS_VOLATILE) 109 - NO_SFDP_FLAGS(SECT_4K) 110 - MFR_FLAGS(SST_WRITE) }, 111 - { "sst26wf016b", INFO(0xbf2651, 0, 64 * 1024, 32) 112 - NO_SFDP_FLAGS(SECT_4K | SPI_NOR_DUAL_READ | 113 - SPI_NOR_QUAD_READ) }, 114 - { "sst26vf016b", INFO(0xbf2641, 0, 64 * 1024, 32) 115 - NO_SFDP_FLAGS(SECT_4K | SPI_NOR_DUAL_READ) }, 116 - { "sst26vf032b", INFO(0xbf2642, 0, 0, 0) 117 - FLAGS(SPI_NOR_HAS_LOCK | SPI_NOR_SWP_IS_VOLATILE) 118 - PARSE_SFDP 119 - .fixups = &sst26vf_nor_fixups }, 120 - { "sst26vf064b", INFO(0xbf2643, 0, 64 * 1024, 128) 121 - FLAGS(SPI_NOR_HAS_LOCK | SPI_NOR_SWP_IS_VOLATILE) 122 - NO_SFDP_FLAGS(SECT_4K | SPI_NOR_DUAL_READ | SPI_NOR_QUAD_READ) 123 - .fixups = &sst26vf_nor_fixups }, 64 + { 65 + .id = SNOR_ID(0x62, 0x16, 0x12), 66 + .name = "sst25wf020a", 67 + .size = SZ_256K, 68 + .flags = SPI_NOR_HAS_LOCK, 69 + .no_sfdp_flags = SECT_4K, 70 + }, { 71 + .id = SNOR_ID(0x62, 0x16, 0x13), 72 + .name = "sst25wf040b", 73 + .size = SZ_512K, 74 + .flags = SPI_NOR_HAS_LOCK, 75 + .no_sfdp_flags = SECT_4K, 76 + }, { 77 + .id = SNOR_ID(0xbf, 0x25, 0x01), 78 + .name = "sst25wf512", 79 + .size = SZ_64K, 80 + .flags = SPI_NOR_HAS_LOCK | SPI_NOR_SWP_IS_VOLATILE, 81 + .no_sfdp_flags = SECT_4K, 82 + .mfr_flags = SST_WRITE, 83 + }, { 84 + .id = SNOR_ID(0xbf, 0x25, 0x02), 85 + .name = "sst25wf010", 86 + .size = SZ_128K, 87 + .flags = SPI_NOR_HAS_LOCK | SPI_NOR_SWP_IS_VOLATILE, 88 + .no_sfdp_flags = SECT_4K, 89 + .mfr_flags = SST_WRITE, 90 + }, { 91 + .id = SNOR_ID(0xbf, 0x25, 0x03), 92 + .name = "sst25wf020", 93 + .size = SZ_256K, 94 + .flags = SPI_NOR_HAS_LOCK | SPI_NOR_SWP_IS_VOLATILE, 95 + .no_sfdp_flags = SECT_4K, 96 + .mfr_flags = SST_WRITE, 97 + }, { 98 + .id = SNOR_ID(0xbf, 0x25, 0x04), 99 + .name = "sst25wf040", 100 + .size = SZ_512K, 101 + .flags = SPI_NOR_HAS_LOCK | SPI_NOR_SWP_IS_VOLATILE, 102 + .no_sfdp_flags = SECT_4K, 103 + .mfr_flags = SST_WRITE, 104 + }, { 105 + .id = SNOR_ID(0xbf, 0x25, 0x05), 106 + .name = "sst25wf080", 107 + .size = SZ_1M, 108 + .flags = SPI_NOR_HAS_LOCK | SPI_NOR_SWP_IS_VOLATILE, 109 + .no_sfdp_flags = SECT_4K, 110 + .mfr_flags = SST_WRITE, 111 + }, { 112 + .id = SNOR_ID(0xbf, 0x25, 0x41), 113 + .name = "sst25vf016b", 114 + .size = SZ_2M, 115 + .flags = SPI_NOR_HAS_LOCK | SPI_NOR_SWP_IS_VOLATILE, 116 + .no_sfdp_flags = SECT_4K, 117 + .mfr_flags = SST_WRITE, 118 + }, { 119 + .id = SNOR_ID(0xbf, 0x25, 0x4a), 120 + .name = "sst25vf032b", 121 + .size = SZ_4M, 122 + .flags = SPI_NOR_HAS_LOCK | SPI_NOR_SWP_IS_VOLATILE, 123 + .no_sfdp_flags = SECT_4K, 124 + .mfr_flags = SST_WRITE, 125 + }, { 126 + .id = SNOR_ID(0xbf, 0x25, 0x4b), 127 + .name = "sst25vf064c", 128 + .size = SZ_8M, 129 + .flags = SPI_NOR_HAS_LOCK | SPI_NOR_4BIT_BP | SPI_NOR_SWP_IS_VOLATILE, 130 + .no_sfdp_flags = SECT_4K, 131 + }, { 132 + .id = SNOR_ID(0xbf, 0x25, 0x8d), 133 + .name = "sst25vf040b", 134 + .size = SZ_512K, 135 + .flags = SPI_NOR_HAS_LOCK | SPI_NOR_SWP_IS_VOLATILE, 136 + .no_sfdp_flags = SECT_4K, 137 + .mfr_flags = SST_WRITE, 138 + }, { 139 + .id = SNOR_ID(0xbf, 0x25, 0x8e), 140 + .name = "sst25vf080b", 141 + .size = SZ_1M, 142 + .flags = SPI_NOR_HAS_LOCK | SPI_NOR_SWP_IS_VOLATILE, 143 + .no_sfdp_flags = SECT_4K, 144 + .mfr_flags = SST_WRITE, 145 + }, { 146 + .id = SNOR_ID(0xbf, 0x26, 0x41), 147 + .name = "sst26vf016b", 148 + .size = SZ_2M, 149 + .no_sfdp_flags = SECT_4K | SPI_NOR_DUAL_READ, 150 + }, { 151 + .id = SNOR_ID(0xbf, 0x26, 0x42), 152 + .name = "sst26vf032b", 153 + .flags = SPI_NOR_HAS_LOCK | SPI_NOR_SWP_IS_VOLATILE, 154 + .fixups = &sst26vf_nor_fixups, 155 + }, { 156 + .id = SNOR_ID(0xbf, 0x26, 0x43), 157 + .name = "sst26vf064b", 158 + .size = SZ_8M, 159 + .flags = SPI_NOR_HAS_LOCK | SPI_NOR_SWP_IS_VOLATILE, 160 + .no_sfdp_flags = SECT_4K | SPI_NOR_DUAL_READ | SPI_NOR_QUAD_READ, 161 + .fixups = &sst26vf_nor_fixups, 162 + }, { 163 + .id = SNOR_ID(0xbf, 0x26, 0x51), 164 + .name = "sst26wf016b", 165 + .size = SZ_2M, 166 + .no_sfdp_flags = SECT_4K | SPI_NOR_DUAL_READ | SPI_NOR_QUAD_READ, 167 + } 124 168 }; 125 169 126 170 static int sst_nor_write(struct mtd_info *mtd, loff_t to, size_t len,
+9 -4
drivers/mtd/spi-nor/swp.c
··· 34 34 static u64 spi_nor_get_min_prot_length_sr(struct spi_nor *nor) 35 35 { 36 36 unsigned int bp_slots, bp_slots_needed; 37 + /* 38 + * sector_size will eventually be replaced with the max erase size of 39 + * the flash. For now, we need to have that ugly default. 40 + */ 41 + unsigned int sector_size = nor->info->sector_size ?: SPI_NOR_DEFAULT_SECTOR_SIZE; 42 + u64 n_sectors = div_u64(nor->params->size, sector_size); 37 43 u8 mask = spi_nor_get_sr_bp_mask(nor); 38 44 39 45 /* Reserved one for "protect none" and one for "protect all". */ 40 46 bp_slots = (1 << hweight8(mask)) - 2; 41 - bp_slots_needed = ilog2(nor->info->n_sectors); 47 + bp_slots_needed = ilog2(n_sectors); 42 48 43 49 if (bp_slots_needed > bp_slots) 44 - return nor->info->sector_size << 45 - (bp_slots_needed - bp_slots); 50 + return sector_size << (bp_slots_needed - bp_slots); 46 51 else 47 - return nor->info->sector_size; 52 + return sector_size; 48 53 } 49 54 50 55 static void spi_nor_get_locked_range_sr(struct spi_nor *nor, u8 sr, loff_t *ofs,
+3 -3
drivers/mtd/spi-nor/sysfs.c
··· 35 35 struct spi_device *spi = to_spi_device(dev); 36 36 struct spi_mem *spimem = spi_get_drvdata(spi); 37 37 struct spi_nor *nor = spi_mem_get_drvdata(spimem); 38 - const u8 *id = nor->info->id_len ? nor->info->id : nor->id; 39 - u8 id_len = nor->info->id_len ?: SPI_NOR_MAX_ID_LEN; 38 + const u8 *id = nor->info->id ? nor->info->id->bytes : nor->id; 39 + u8 id_len = nor->info->id ? nor->info->id->len : SPI_NOR_MAX_ID_LEN; 40 40 41 41 return sysfs_emit(buf, "%*phN\n", id_len, id); 42 42 } ··· 78 78 79 79 if (attr == &dev_attr_manufacturer.attr && !nor->manufacturer) 80 80 return 0; 81 - if (attr == &dev_attr_jedec_id.attr && !nor->info->id_len && !nor->id) 81 + if (attr == &dev_attr_jedec_id.attr && !nor->info->id && !nor->id) 82 82 return 0; 83 83 84 84 return 0444;
+186 -102
drivers/mtd/spi-nor/winbond.c
··· 42 42 }; 43 43 44 44 static const struct flash_info winbond_nor_parts[] = { 45 - /* Winbond -- w25x "blocks" are 64K, "sectors" are 4KiB */ 46 - { "w25x05", INFO(0xef3010, 0, 64 * 1024, 1) 47 - NO_SFDP_FLAGS(SECT_4K) }, 48 - { "w25x10", INFO(0xef3011, 0, 64 * 1024, 2) 49 - NO_SFDP_FLAGS(SECT_4K) }, 50 - { "w25x20", INFO(0xef3012, 0, 64 * 1024, 4) 51 - NO_SFDP_FLAGS(SECT_4K) }, 52 - { "w25x40", INFO(0xef3013, 0, 64 * 1024, 8) 53 - NO_SFDP_FLAGS(SECT_4K) }, 54 - { "w25x80", INFO(0xef3014, 0, 64 * 1024, 16) 55 - NO_SFDP_FLAGS(SECT_4K) }, 56 - { "w25x16", INFO(0xef3015, 0, 64 * 1024, 32) 57 - NO_SFDP_FLAGS(SECT_4K) }, 58 - { "w25q16dw", INFO(0xef6015, 0, 64 * 1024, 32) 59 - FLAGS(SPI_NOR_HAS_LOCK | SPI_NOR_HAS_TB) 60 - NO_SFDP_FLAGS(SECT_4K | SPI_NOR_DUAL_READ | 61 - SPI_NOR_QUAD_READ) }, 62 - { "w25x32", INFO(0xef3016, 0, 64 * 1024, 64) 63 - NO_SFDP_FLAGS(SECT_4K) }, 64 - { "w25q16jv-im/jm", INFO(0xef7015, 0, 64 * 1024, 32) 65 - FLAGS(SPI_NOR_HAS_LOCK | SPI_NOR_HAS_TB) 66 - NO_SFDP_FLAGS(SECT_4K | SPI_NOR_DUAL_READ | 67 - SPI_NOR_QUAD_READ) }, 68 - { "w25q20cl", INFO(0xef4012, 0, 64 * 1024, 4) 69 - NO_SFDP_FLAGS(SECT_4K) }, 70 - { "w25q20bw", INFO(0xef5012, 0, 64 * 1024, 4) 71 - NO_SFDP_FLAGS(SECT_4K) }, 72 - { "w25q20ew", INFO(0xef6012, 0, 64 * 1024, 4) 73 - NO_SFDP_FLAGS(SECT_4K) }, 74 - { "w25q32", INFO(0xef4016, 0, 64 * 1024, 64) 75 - NO_SFDP_FLAGS(SECT_4K) }, 76 - { "w25q32dw", INFO(0xef6016, 0, 64 * 1024, 64) 77 - FLAGS(SPI_NOR_HAS_LOCK | SPI_NOR_HAS_TB) 78 - NO_SFDP_FLAGS(SECT_4K | SPI_NOR_DUAL_READ | SPI_NOR_QUAD_READ) 79 - OTP_INFO(256, 3, 0x1000, 0x1000) }, 80 - { "w25q32jv", INFO(0xef7016, 0, 64 * 1024, 64) 81 - FLAGS(SPI_NOR_HAS_LOCK | SPI_NOR_HAS_TB) 82 - NO_SFDP_FLAGS(SECT_4K | SPI_NOR_DUAL_READ | 83 - SPI_NOR_QUAD_READ) }, 84 - { "w25q32jwm", INFO(0xef8016, 0, 64 * 1024, 64) 85 - FLAGS(SPI_NOR_HAS_LOCK | SPI_NOR_HAS_TB) 86 - NO_SFDP_FLAGS(SECT_4K | SPI_NOR_DUAL_READ | SPI_NOR_QUAD_READ) 87 - OTP_INFO(256, 3, 0x1000, 0x1000) }, 88 - { "w25q64jwm", INFO(0xef8017, 0, 64 * 1024, 128) 89 - FLAGS(SPI_NOR_HAS_LOCK | SPI_NOR_HAS_TB) 90 - NO_SFDP_FLAGS(SECT_4K | SPI_NOR_DUAL_READ | 91 - SPI_NOR_QUAD_READ) }, 92 - { "w25q128jwm", INFO(0xef8018, 0, 64 * 1024, 256) 93 - FLAGS(SPI_NOR_HAS_LOCK | SPI_NOR_HAS_TB) 94 - NO_SFDP_FLAGS(SECT_4K | SPI_NOR_DUAL_READ | 95 - SPI_NOR_QUAD_READ) }, 96 - { "w25q256jwm", INFO(0xef8019, 0, 64 * 1024, 512) 97 - FLAGS(SPI_NOR_HAS_LOCK | SPI_NOR_HAS_TB) 98 - NO_SFDP_FLAGS(SECT_4K | SPI_NOR_DUAL_READ | 99 - SPI_NOR_QUAD_READ) }, 100 - { "w25x64", INFO(0xef3017, 0, 64 * 1024, 128) 101 - NO_SFDP_FLAGS(SECT_4K) }, 102 - { "w25q64", INFO(0xef4017, 0, 64 * 1024, 128) 103 - NO_SFDP_FLAGS(SECT_4K | SPI_NOR_DUAL_READ | 104 - SPI_NOR_QUAD_READ) }, 105 - { "w25q64dw", INFO(0xef6017, 0, 64 * 1024, 128) 106 - FLAGS(SPI_NOR_HAS_LOCK | SPI_NOR_HAS_TB) 107 - NO_SFDP_FLAGS(SECT_4K | SPI_NOR_DUAL_READ | 108 - SPI_NOR_QUAD_READ) }, 109 - { "w25q64jvm", INFO(0xef7017, 0, 64 * 1024, 128) 110 - NO_SFDP_FLAGS(SECT_4K) }, 111 - { "w25q128fw", INFO(0xef6018, 0, 64 * 1024, 256) 112 - FLAGS(SPI_NOR_HAS_LOCK | SPI_NOR_HAS_TB) 113 - NO_SFDP_FLAGS(SECT_4K | SPI_NOR_DUAL_READ | 114 - SPI_NOR_QUAD_READ) }, 115 - { "w25q128jv", INFO(0xef7018, 0, 64 * 1024, 256) 116 - FLAGS(SPI_NOR_HAS_LOCK | SPI_NOR_HAS_TB) 117 - NO_SFDP_FLAGS(SECT_4K | SPI_NOR_DUAL_READ | 118 - SPI_NOR_QUAD_READ) }, 119 - { "w25q80", INFO(0xef5014, 0, 64 * 1024, 16) 120 - NO_SFDP_FLAGS(SECT_4K) }, 121 - { "w25q80bl", INFO(0xef4014, 0, 64 * 1024, 16) 122 - NO_SFDP_FLAGS(SECT_4K) }, 123 - { "w25q128", INFO(0xef4018, 0, 0, 0) 124 - PARSE_SFDP 125 - FLAGS(SPI_NOR_HAS_LOCK | SPI_NOR_HAS_TB) }, 126 - { "w25q256", INFO(0xef4019, 0, 64 * 1024, 512) 127 - NO_SFDP_FLAGS(SECT_4K | SPI_NOR_DUAL_READ | SPI_NOR_QUAD_READ) 128 - .fixups = &w25q256_fixups }, 129 - { "w25q256jvm", INFO(0xef7019, 0, 64 * 1024, 512) 130 - PARSE_SFDP }, 131 - { "w25q256jw", INFO(0xef6019, 0, 64 * 1024, 512) 132 - NO_SFDP_FLAGS(SECT_4K | SPI_NOR_DUAL_READ | 133 - SPI_NOR_QUAD_READ) }, 134 - { "w25m512jv", INFO(0xef7119, 0, 64 * 1024, 1024) 135 - NO_SFDP_FLAGS(SECT_4K | SPI_NOR_QUAD_READ | 136 - SPI_NOR_DUAL_READ) }, 137 - { "w25q512nwq", INFO(0xef6020, 0, 0, 0) 138 - PARSE_SFDP 139 - OTP_INFO(256, 3, 0x1000, 0x1000) }, 140 - { "w25q512nwm", INFO(0xef8020, 0, 64 * 1024, 1024) 141 - PARSE_SFDP 142 - OTP_INFO(256, 3, 0x1000, 0x1000) }, 143 - { "w25q512jvq", INFO(0xef4020, 0, 64 * 1024, 1024) 144 - NO_SFDP_FLAGS(SECT_4K | SPI_NOR_DUAL_READ | 145 - SPI_NOR_QUAD_READ) }, 45 + { 46 + .id = SNOR_ID(0xef, 0x30, 0x10), 47 + .name = "w25x05", 48 + .size = SZ_64K, 49 + .no_sfdp_flags = SECT_4K, 50 + }, { 51 + .id = SNOR_ID(0xef, 0x30, 0x11), 52 + .name = "w25x10", 53 + .size = SZ_128K, 54 + .no_sfdp_flags = SECT_4K, 55 + }, { 56 + .id = SNOR_ID(0xef, 0x30, 0x12), 57 + .name = "w25x20", 58 + .size = SZ_256K, 59 + .no_sfdp_flags = SECT_4K, 60 + }, { 61 + .id = SNOR_ID(0xef, 0x30, 0x13), 62 + .name = "w25x40", 63 + .size = SZ_512K, 64 + .no_sfdp_flags = SECT_4K, 65 + }, { 66 + .id = SNOR_ID(0xef, 0x30, 0x14), 67 + .name = "w25x80", 68 + .size = SZ_1M, 69 + .no_sfdp_flags = SECT_4K, 70 + }, { 71 + .id = SNOR_ID(0xef, 0x30, 0x15), 72 + .name = "w25x16", 73 + .size = SZ_2M, 74 + .no_sfdp_flags = SECT_4K, 75 + }, { 76 + .id = SNOR_ID(0xef, 0x30, 0x16), 77 + .name = "w25x32", 78 + .size = SZ_4M, 79 + .no_sfdp_flags = SECT_4K, 80 + }, { 81 + .id = SNOR_ID(0xef, 0x30, 0x17), 82 + .name = "w25x64", 83 + .size = SZ_8M, 84 + .no_sfdp_flags = SECT_4K, 85 + }, { 86 + .id = SNOR_ID(0xef, 0x40, 0x12), 87 + .name = "w25q20cl", 88 + .size = SZ_256K, 89 + .no_sfdp_flags = SECT_4K, 90 + }, { 91 + .id = SNOR_ID(0xef, 0x40, 0x14), 92 + .name = "w25q80bl", 93 + .size = SZ_1M, 94 + .no_sfdp_flags = SECT_4K, 95 + }, { 96 + .id = SNOR_ID(0xef, 0x40, 0x16), 97 + .name = "w25q32", 98 + .size = SZ_4M, 99 + .no_sfdp_flags = SECT_4K, 100 + }, { 101 + .id = SNOR_ID(0xef, 0x40, 0x17), 102 + .name = "w25q64", 103 + .size = SZ_8M, 104 + .no_sfdp_flags = SECT_4K | SPI_NOR_DUAL_READ | SPI_NOR_QUAD_READ, 105 + }, { 106 + .id = SNOR_ID(0xef, 0x40, 0x18), 107 + .name = "w25q128", 108 + .flags = SPI_NOR_HAS_LOCK | SPI_NOR_HAS_TB, 109 + }, { 110 + .id = SNOR_ID(0xef, 0x40, 0x19), 111 + .name = "w25q256", 112 + .size = SZ_32M, 113 + .no_sfdp_flags = SECT_4K | SPI_NOR_DUAL_READ | SPI_NOR_QUAD_READ, 114 + .fixups = &w25q256_fixups, 115 + }, { 116 + .id = SNOR_ID(0xef, 0x40, 0x20), 117 + .name = "w25q512jvq", 118 + .size = SZ_64M, 119 + .no_sfdp_flags = SECT_4K | SPI_NOR_DUAL_READ | SPI_NOR_QUAD_READ, 120 + }, { 121 + .id = SNOR_ID(0xef, 0x50, 0x12), 122 + .name = "w25q20bw", 123 + .size = SZ_256K, 124 + .no_sfdp_flags = SECT_4K, 125 + }, { 126 + .id = SNOR_ID(0xef, 0x50, 0x14), 127 + .name = "w25q80", 128 + .size = SZ_1M, 129 + .no_sfdp_flags = SECT_4K, 130 + }, { 131 + .id = SNOR_ID(0xef, 0x60, 0x12), 132 + .name = "w25q20ew", 133 + .size = SZ_256K, 134 + .no_sfdp_flags = SECT_4K, 135 + }, { 136 + .id = SNOR_ID(0xef, 0x60, 0x15), 137 + .name = "w25q16dw", 138 + .size = SZ_2M, 139 + .flags = SPI_NOR_HAS_LOCK | SPI_NOR_HAS_TB, 140 + .no_sfdp_flags = SECT_4K | SPI_NOR_DUAL_READ | SPI_NOR_QUAD_READ, 141 + }, { 142 + .id = SNOR_ID(0xef, 0x60, 0x16), 143 + .name = "w25q32dw", 144 + .size = SZ_4M, 145 + .flags = SPI_NOR_HAS_LOCK | SPI_NOR_HAS_TB, 146 + .no_sfdp_flags = SECT_4K | SPI_NOR_DUAL_READ | SPI_NOR_QUAD_READ, 147 + .otp = SNOR_OTP(256, 3, 0x1000, 0x1000), 148 + }, { 149 + .id = SNOR_ID(0xef, 0x60, 0x17), 150 + .name = "w25q64dw", 151 + .size = SZ_8M, 152 + .flags = SPI_NOR_HAS_LOCK | SPI_NOR_HAS_TB, 153 + .no_sfdp_flags = SECT_4K | SPI_NOR_DUAL_READ | SPI_NOR_QUAD_READ, 154 + }, { 155 + .id = SNOR_ID(0xef, 0x60, 0x18), 156 + .name = "w25q128fw", 157 + .size = SZ_16M, 158 + .flags = SPI_NOR_HAS_LOCK | SPI_NOR_HAS_TB, 159 + .no_sfdp_flags = SECT_4K | SPI_NOR_DUAL_READ | SPI_NOR_QUAD_READ, 160 + }, { 161 + .id = SNOR_ID(0xef, 0x60, 0x19), 162 + .name = "w25q256jw", 163 + .size = SZ_32M, 164 + .no_sfdp_flags = SECT_4K | SPI_NOR_DUAL_READ | SPI_NOR_QUAD_READ, 165 + }, { 166 + .id = SNOR_ID(0xef, 0x60, 0x20), 167 + .name = "w25q512nwq", 168 + .otp = SNOR_OTP(256, 3, 0x1000, 0x1000), 169 + }, { 170 + .id = SNOR_ID(0xef, 0x70, 0x15), 171 + .name = "w25q16jv-im/jm", 172 + .size = SZ_2M, 173 + .flags = SPI_NOR_HAS_LOCK | SPI_NOR_HAS_TB, 174 + .no_sfdp_flags = SECT_4K | SPI_NOR_DUAL_READ | SPI_NOR_QUAD_READ, 175 + }, { 176 + .id = SNOR_ID(0xef, 0x70, 0x16), 177 + .name = "w25q32jv", 178 + .size = SZ_4M, 179 + .flags = SPI_NOR_HAS_LOCK | SPI_NOR_HAS_TB, 180 + .no_sfdp_flags = SECT_4K | SPI_NOR_DUAL_READ | SPI_NOR_QUAD_READ, 181 + }, { 182 + .id = SNOR_ID(0xef, 0x70, 0x17), 183 + .name = "w25q64jvm", 184 + .size = SZ_8M, 185 + .no_sfdp_flags = SECT_4K, 186 + }, { 187 + .id = SNOR_ID(0xef, 0x70, 0x18), 188 + .name = "w25q128jv", 189 + .size = SZ_16M, 190 + .flags = SPI_NOR_HAS_LOCK | SPI_NOR_HAS_TB, 191 + .no_sfdp_flags = SECT_4K | SPI_NOR_DUAL_READ | SPI_NOR_QUAD_READ, 192 + }, { 193 + .id = SNOR_ID(0xef, 0x70, 0x19), 194 + .name = "w25q256jvm", 195 + }, { 196 + .id = SNOR_ID(0xef, 0x71, 0x19), 197 + .name = "w25m512jv", 198 + .size = SZ_64M, 199 + .no_sfdp_flags = SECT_4K | SPI_NOR_DUAL_READ | SPI_NOR_QUAD_READ, 200 + }, { 201 + .id = SNOR_ID(0xef, 0x80, 0x16), 202 + .name = "w25q32jwm", 203 + .size = SZ_4M, 204 + .flags = SPI_NOR_HAS_LOCK | SPI_NOR_HAS_TB, 205 + .no_sfdp_flags = SECT_4K | SPI_NOR_DUAL_READ | SPI_NOR_QUAD_READ, 206 + .otp = SNOR_OTP(256, 3, 0x1000, 0x1000), 207 + }, { 208 + .id = SNOR_ID(0xef, 0x80, 0x17), 209 + .name = "w25q64jwm", 210 + .size = SZ_8M, 211 + .flags = SPI_NOR_HAS_LOCK | SPI_NOR_HAS_TB, 212 + .no_sfdp_flags = SECT_4K | SPI_NOR_DUAL_READ | SPI_NOR_QUAD_READ, 213 + }, { 214 + .id = SNOR_ID(0xef, 0x80, 0x18), 215 + .name = "w25q128jwm", 216 + .size = SZ_16M, 217 + .flags = SPI_NOR_HAS_LOCK | SPI_NOR_HAS_TB, 218 + .no_sfdp_flags = SECT_4K | SPI_NOR_DUAL_READ | SPI_NOR_QUAD_READ, 219 + }, { 220 + .id = SNOR_ID(0xef, 0x80, 0x19), 221 + .name = "w25q256jwm", 222 + .size = SZ_32M, 223 + .flags = SPI_NOR_HAS_LOCK | SPI_NOR_HAS_TB, 224 + .no_sfdp_flags = SECT_4K | SPI_NOR_DUAL_READ | SPI_NOR_QUAD_READ, 225 + }, { 226 + .id = SNOR_ID(0xef, 0x80, 0x20), 227 + .name = "w25q512nwm", 228 + .otp = SNOR_OTP(256, 3, 0x1000, 0x1000), 229 + }, 146 230 }; 147 231 148 232 /** ··· 305 221 { 306 222 struct spi_nor_flash_parameter *params = nor->params; 307 223 308 - if (params->otp.org->n_regions) 224 + if (params->otp.org) 309 225 params->otp.ops = &winbond_nor_otp_ops; 310 226 311 227 /*
+13 -19
drivers/mtd/spi-nor/xilinx.c
··· 21 21 SPI_MEM_OP_NO_DUMMY, \ 22 22 SPI_MEM_OP_DATA_IN(1, buf, 0)) 23 23 24 - #define S3AN_INFO(_jedec_id, _n_sectors, _page_size) \ 25 - .id = { \ 26 - ((_jedec_id) >> 16) & 0xff, \ 27 - ((_jedec_id) >> 8) & 0xff, \ 28 - (_jedec_id) & 0xff \ 29 - }, \ 30 - .id_len = 3, \ 31 - .sector_size = (8 * (_page_size)), \ 32 - .n_sectors = (_n_sectors), \ 33 - .page_size = (_page_size), \ 34 - .n_banks = 1, \ 35 - .addr_nbytes = 3, \ 36 - .flags = SPI_NOR_NO_FR 24 + #define S3AN_FLASH(_id, _name, _n_sectors, _page_size) \ 25 + .id = _id, \ 26 + .name = _name, \ 27 + .size = 8 * (_page_size) * (_n_sectors), \ 28 + .sector_size = (8 * (_page_size)), \ 29 + .page_size = (_page_size), \ 30 + .flags = SPI_NOR_NO_FR 37 31 38 32 /* Xilinx S3AN share MFR with Atmel SPI NOR */ 39 33 static const struct flash_info xilinx_nor_parts[] = { 40 34 /* Xilinx S3AN Internal Flash */ 41 - { "3S50AN", S3AN_INFO(0x1f2200, 64, 264) }, 42 - { "3S200AN", S3AN_INFO(0x1f2400, 256, 264) }, 43 - { "3S400AN", S3AN_INFO(0x1f2400, 256, 264) }, 44 - { "3S700AN", S3AN_INFO(0x1f2500, 512, 264) }, 45 - { "3S1400AN", S3AN_INFO(0x1f2600, 512, 528) }, 35 + { S3AN_FLASH(SNOR_ID(0x1f, 0x22, 0x00), "3S50AN", 64, 264) }, 36 + { S3AN_FLASH(SNOR_ID(0x1f, 0x24, 0x00), "3S200AN", 256, 264) }, 37 + { S3AN_FLASH(SNOR_ID(0x1f, 0x24, 0x00), "3S400AN", 256, 264) }, 38 + { S3AN_FLASH(SNOR_ID(0x1f, 0x25, 0x00), "3S700AN", 512, 264) }, 39 + { S3AN_FLASH(SNOR_ID(0x1f, 0x26, 0x00), "3S1400AN", 512, 528) }, 46 40 }; 47 41 48 42 /* ··· 138 144 page_size = (nor->params->page_size == 264) ? 256 : 512; 139 145 nor->params->page_size = page_size; 140 146 nor->mtd.writebufsize = page_size; 141 - nor->params->size = 8 * page_size * nor->info->n_sectors; 147 + nor->params->size = nor->info->size; 142 148 nor->mtd.erasesize = 8 * page_size; 143 149 } else { 144 150 /* Flash in Default addressing mode */
+12 -7
drivers/mtd/spi-nor/xmc.c
··· 9 9 #include "core.h" 10 10 11 11 static const struct flash_info xmc_nor_parts[] = { 12 - /* XMC (Wuhan Xinxin Semiconductor Manufacturing Corp.) */ 13 - { "XM25QH64A", INFO(0x207017, 0, 64 * 1024, 128) 14 - NO_SFDP_FLAGS(SECT_4K | SPI_NOR_DUAL_READ | 15 - SPI_NOR_QUAD_READ) }, 16 - { "XM25QH128A", INFO(0x207018, 0, 64 * 1024, 256) 17 - NO_SFDP_FLAGS(SECT_4K | SPI_NOR_DUAL_READ | 18 - SPI_NOR_QUAD_READ) }, 12 + { 13 + .id = SNOR_ID(0x20, 0x70, 0x17), 14 + .name = "XM25QH64A", 15 + .size = SZ_8M, 16 + .no_sfdp_flags = SECT_4K | SPI_NOR_DUAL_READ | SPI_NOR_QUAD_READ, 17 + }, { 18 + .id = SNOR_ID(0x20, 0x70, 0x18), 19 + .name = "XM25QH128A", 20 + .size = SZ_16M, 21 + .no_sfdp_flags = SECT_4K | SPI_NOR_DUAL_READ | SPI_NOR_QUAD_READ, 22 + }, 19 23 }; 20 24 25 + /* XMC (Wuhan Xinxin Semiconductor Manufacturing Corp.) */ 21 26 const struct spi_nor_manufacturer spi_nor_xmc = { 22 27 .name = "xmc", 23 28 .parts = xmc_nor_parts,
+1 -1
include/linux/mtd/cfi.h
··· 287 287 unsigned long chipshift; /* Because they're of the same type */ 288 288 const char *im_name; /* inter_module name for cmdset_setup */ 289 289 unsigned long quirks; 290 - struct flchip chips[]; /* per-chip data structure for each chip */ 290 + struct flchip chips[] __counted_by(numchips); /* per-chip data structure for each chip */ 291 291 }; 292 292 293 293 uint32_t cfi_build_cmd_addr(uint32_t cmd_ofs,
+1 -1
include/linux/mtd/qinfo.h
··· 24 24 struct qinfo_chip *qinfo; 25 25 int numchips; 26 26 unsigned long chipshift; 27 - struct flchip chips[]; 27 + struct flchip chips[] __counted_by(numchips); 28 28 }; 29 29 30 30 /* qinfo_query_info structure contains request information for
+1
include/linux/mtd/spinand.h
··· 263 263 extern const struct spinand_manufacturer alliancememory_spinand_manufacturer; 264 264 extern const struct spinand_manufacturer ato_spinand_manufacturer; 265 265 extern const struct spinand_manufacturer esmt_c8_spinand_manufacturer; 266 + extern const struct spinand_manufacturer foresee_spinand_manufacturer; 266 267 extern const struct spinand_manufacturer gigadevice_spinand_manufacturer; 267 268 extern const struct spinand_manufacturer macronix_spinand_manufacturer; 268 269 extern const struct spinand_manufacturer micron_spinand_manufacturer;