Commit 81d92dc117bf9954f24a8d88c2d1ef26bd13ecc7
Exists in
ti-lsk-linux-4.1.y
and in
10 other branches
Merge tag 'for-linus-20141102' of git://git.infradead.org/linux-mtd
Pull MTD fixes from Brian Norris: "Three main MTD fixes for 3.18: - A regression from 3.16 which was noticed in 3.17. With the restructuring of the m25p80.c driver and the SPI NOR library framework, we omitted proper listing of the SPI device IDs. This means m25p80.c wouldn't auto-load (modprobe) properly when built as a module. For now, we duplicate the device IDs into both modules. - The OMAP / ELM modules were depending on an implicit link ordering. Use deferred probing so that the new link order (in 3.18-rc) can still allow for successful probing. - Fix suspend/resume support for LH28F640BF NOR flash" * tag 'for-linus-20141102' of git://git.infradead.org/linux-mtd: mtd: cfi_cmdset_0001.c: fix resume for LH28F640BF chips mtd: omap: fix mtd devices not showing up mtd: m25p80,spi-nor: Fix module aliases for m25p80 mtd: spi-nor: make spi_nor_scan() take a chip type name, not spi_device_id mtd: m25p80: get rid of spi_get_device_id
Showing 6 changed files Side-by-side Diff
drivers/mtd/chips/cfi_cmdset_0001.c
... | ... | @@ -2590,6 +2590,8 @@ |
2590 | 2590 | |
2591 | 2591 | /* Go to known state. Chip may have been power cycled */ |
2592 | 2592 | if (chip->state == FL_PM_SUSPENDED) { |
2593 | + /* Refresh LH28F640BF Partition Config. Register */ | |
2594 | + fixup_LH28F640BF(mtd); | |
2593 | 2595 | map_write(map, CMD(0xFF), cfi->chips[i].start); |
2594 | 2596 | chip->oldstate = chip->state = FL_READY; |
2595 | 2597 | wake_up(&chip->wq); |
drivers/mtd/devices/m25p80.c
... | ... | @@ -193,10 +193,10 @@ |
193 | 193 | { |
194 | 194 | struct mtd_part_parser_data ppdata; |
195 | 195 | struct flash_platform_data *data; |
196 | - const struct spi_device_id *id = NULL; | |
197 | 196 | struct m25p *flash; |
198 | 197 | struct spi_nor *nor; |
199 | 198 | enum read_mode mode = SPI_NOR_NORMAL; |
199 | + char *flash_name = NULL; | |
200 | 200 | int ret; |
201 | 201 | |
202 | 202 | data = dev_get_platdata(&spi->dev); |
203 | 203 | |
... | ... | @@ -236,13 +236,11 @@ |
236 | 236 | * If that's the case, respect "type" and ignore a "name". |
237 | 237 | */ |
238 | 238 | if (data && data->type) |
239 | - id = spi_nor_match_id(data->type); | |
239 | + flash_name = data->type; | |
240 | + else | |
241 | + flash_name = spi->modalias; | |
240 | 242 | |
241 | - /* If we didn't get name from platform, simply use "modalias". */ | |
242 | - if (!id) | |
243 | - id = spi_get_device_id(spi); | |
244 | - | |
245 | - ret = spi_nor_scan(nor, id, mode); | |
243 | + ret = spi_nor_scan(nor, flash_name, mode); | |
246 | 244 | if (ret) |
247 | 245 | return ret; |
248 | 246 | |
249 | 247 | |
... | ... | @@ -263,12 +261,62 @@ |
263 | 261 | } |
264 | 262 | |
265 | 263 | |
264 | +/* | |
265 | + * XXX This needs to be kept in sync with spi_nor_ids. We can't share | |
266 | + * it with spi-nor, because if this is built as a module then modpost | |
267 | + * won't be able to read it and add appropriate aliases. | |
268 | + */ | |
269 | +static const struct spi_device_id m25p_ids[] = { | |
270 | + {"at25fs010"}, {"at25fs040"}, {"at25df041a"}, {"at25df321a"}, | |
271 | + {"at25df641"}, {"at26f004"}, {"at26df081a"}, {"at26df161a"}, | |
272 | + {"at26df321"}, {"at45db081d"}, | |
273 | + {"en25f32"}, {"en25p32"}, {"en25q32b"}, {"en25p64"}, | |
274 | + {"en25q64"}, {"en25qh128"}, {"en25qh256"}, | |
275 | + {"f25l32pa"}, | |
276 | + {"mr25h256"}, {"mr25h10"}, | |
277 | + {"gd25q32"}, {"gd25q64"}, | |
278 | + {"160s33b"}, {"320s33b"}, {"640s33b"}, | |
279 | + {"mx25l2005a"}, {"mx25l4005a"}, {"mx25l8005"}, {"mx25l1606e"}, | |
280 | + {"mx25l3205d"}, {"mx25l3255e"}, {"mx25l6405d"}, {"mx25l12805d"}, | |
281 | + {"mx25l12855e"},{"mx25l25635e"},{"mx25l25655e"},{"mx66l51235l"}, | |
282 | + {"mx66l1g55g"}, | |
283 | + {"n25q064"}, {"n25q128a11"}, {"n25q128a13"}, {"n25q256a"}, | |
284 | + {"n25q512a"}, {"n25q512ax3"}, {"n25q00"}, | |
285 | + {"pm25lv512"}, {"pm25lv010"}, {"pm25lq032"}, | |
286 | + {"s25sl032p"}, {"s25sl064p"}, {"s25fl256s0"}, {"s25fl256s1"}, | |
287 | + {"s25fl512s"}, {"s70fl01gs"}, {"s25sl12800"}, {"s25sl12801"}, | |
288 | + {"s25fl129p0"}, {"s25fl129p1"}, {"s25sl004a"}, {"s25sl008a"}, | |
289 | + {"s25sl016a"}, {"s25sl032a"}, {"s25sl064a"}, {"s25fl008k"}, | |
290 | + {"s25fl016k"}, {"s25fl064k"}, | |
291 | + {"sst25vf040b"},{"sst25vf080b"},{"sst25vf016b"},{"sst25vf032b"}, | |
292 | + {"sst25vf064c"},{"sst25wf512"}, {"sst25wf010"}, {"sst25wf020"}, | |
293 | + {"sst25wf040"}, | |
294 | + {"m25p05"}, {"m25p10"}, {"m25p20"}, {"m25p40"}, | |
295 | + {"m25p80"}, {"m25p16"}, {"m25p32"}, {"m25p64"}, | |
296 | + {"m25p128"}, {"n25q032"}, | |
297 | + {"m25p05-nonjedec"}, {"m25p10-nonjedec"}, {"m25p20-nonjedec"}, | |
298 | + {"m25p40-nonjedec"}, {"m25p80-nonjedec"}, {"m25p16-nonjedec"}, | |
299 | + {"m25p32-nonjedec"}, {"m25p64-nonjedec"}, {"m25p128-nonjedec"}, | |
300 | + {"m45pe10"}, {"m45pe80"}, {"m45pe16"}, | |
301 | + {"m25pe20"}, {"m25pe80"}, {"m25pe16"}, | |
302 | + {"m25px16"}, {"m25px32"}, {"m25px32-s0"}, {"m25px32-s1"}, | |
303 | + {"m25px64"}, | |
304 | + {"w25x10"}, {"w25x20"}, {"w25x40"}, {"w25x80"}, | |
305 | + {"w25x16"}, {"w25x32"}, {"w25q32"}, {"w25q32dw"}, | |
306 | + {"w25x64"}, {"w25q64"}, {"w25q128"}, {"w25q80"}, | |
307 | + {"w25q80bl"}, {"w25q128"}, {"w25q256"}, {"cat25c11"}, | |
308 | + {"cat25c03"}, {"cat25c09"}, {"cat25c17"}, {"cat25128"}, | |
309 | + { }, | |
310 | +}; | |
311 | +MODULE_DEVICE_TABLE(spi, m25p_ids); | |
312 | + | |
313 | + | |
266 | 314 | static struct spi_driver m25p80_driver = { |
267 | 315 | .driver = { |
268 | 316 | .name = "m25p80", |
269 | 317 | .owner = THIS_MODULE, |
270 | 318 | }, |
271 | - .id_table = spi_nor_ids, | |
319 | + .id_table = m25p_ids, | |
272 | 320 | .probe = m25p_probe, |
273 | 321 | .remove = m25p_remove, |
274 | 322 |
drivers/mtd/nand/omap_elm.c
... | ... | @@ -115,7 +115,7 @@ |
115 | 115 | |
116 | 116 | if (!info) { |
117 | 117 | dev_err(dev, "Unable to configure elm - device not probed?\n"); |
118 | - return -ENODEV; | |
118 | + return -EPROBE_DEFER; | |
119 | 119 | } |
120 | 120 | /* ELM cannot detect ECC errors for chunks > 1KB */ |
121 | 121 | if (ecc_step_size > ((ELM_ECC_SIZE + 1) / 2)) { |
drivers/mtd/spi-nor/fsl-quadspi.c
... | ... | @@ -881,7 +881,6 @@ |
881 | 881 | |
882 | 882 | /* iterate the subnodes. */ |
883 | 883 | for_each_available_child_of_node(dev->of_node, np) { |
884 | - const struct spi_device_id *id; | |
885 | 884 | char modalias[40]; |
886 | 885 | |
887 | 886 | /* skip the holes */ |
... | ... | @@ -909,10 +908,6 @@ |
909 | 908 | if (of_modalias_node(np, modalias, sizeof(modalias)) < 0) |
910 | 909 | goto map_failed; |
911 | 910 | |
912 | - id = spi_nor_match_id(modalias); | |
913 | - if (!id) | |
914 | - goto map_failed; | |
915 | - | |
916 | 911 | ret = of_property_read_u32(np, "spi-max-frequency", |
917 | 912 | &q->clk_rate); |
918 | 913 | if (ret < 0) |
... | ... | @@ -921,7 +916,7 @@ |
921 | 916 | /* set the chip address for READID */ |
922 | 917 | fsl_qspi_set_base_addr(q, nor); |
923 | 918 | |
924 | - ret = spi_nor_scan(nor, id, SPI_NOR_QUAD); | |
919 | + ret = spi_nor_scan(nor, modalias, SPI_NOR_QUAD); | |
925 | 920 | if (ret) |
926 | 921 | goto map_failed; |
927 | 922 |
drivers/mtd/spi-nor/spi-nor.c
... | ... | @@ -28,6 +28,8 @@ |
28 | 28 | |
29 | 29 | #define JEDEC_MFR(_jedec_id) ((_jedec_id) >> 16) |
30 | 30 | |
31 | +static const struct spi_device_id *spi_nor_match_id(const char *name); | |
32 | + | |
31 | 33 | /* |
32 | 34 | * Read the status register, returning its value in the location |
33 | 35 | * Return the status register value. |
... | ... | @@ -473,7 +475,7 @@ |
473 | 475 | * more nor chips. This current list focusses on newer chips, which |
474 | 476 | * have been converging on command sets which including JEDEC ID. |
475 | 477 | */ |
476 | -const struct spi_device_id spi_nor_ids[] = { | |
478 | +static const struct spi_device_id spi_nor_ids[] = { | |
477 | 479 | /* Atmel -- some are (confusingly) marketed as "DataFlash" */ |
478 | 480 | { "at25fs010", INFO(0x1f6601, 0, 32 * 1024, 4, SECT_4K) }, |
479 | 481 | { "at25fs040", INFO(0x1f6604, 0, 64 * 1024, 8, SECT_4K) }, |
... | ... | @@ -637,7 +639,6 @@ |
637 | 639 | { "cat25128", CAT25_INFO(2048, 8, 64, 2, SPI_NOR_NO_ERASE | SPI_NOR_NO_FR) }, |
638 | 640 | { }, |
639 | 641 | }; |
640 | -EXPORT_SYMBOL_GPL(spi_nor_ids); | |
641 | 642 | |
642 | 643 | static const struct spi_device_id *spi_nor_read_id(struct spi_nor *nor) |
643 | 644 | { |
644 | 645 | |
... | ... | @@ -911,9 +912,9 @@ |
911 | 912 | return 0; |
912 | 913 | } |
913 | 914 | |
914 | -int spi_nor_scan(struct spi_nor *nor, const struct spi_device_id *id, | |
915 | - enum read_mode mode) | |
915 | +int spi_nor_scan(struct spi_nor *nor, const char *name, enum read_mode mode) | |
916 | 916 | { |
917 | + const struct spi_device_id *id = NULL; | |
917 | 918 | struct flash_info *info; |
918 | 919 | struct device *dev = nor->dev; |
919 | 920 | struct mtd_info *mtd = nor->mtd; |
... | ... | @@ -925,6 +926,10 @@ |
925 | 926 | if (ret) |
926 | 927 | return ret; |
927 | 928 | |
929 | + id = spi_nor_match_id(name); | |
930 | + if (!id) | |
931 | + return -ENOENT; | |
932 | + | |
928 | 933 | info = (void *)id->driver_data; |
929 | 934 | |
930 | 935 | if (info->jedec_id) { |
... | ... | @@ -1113,7 +1118,7 @@ |
1113 | 1118 | } |
1114 | 1119 | EXPORT_SYMBOL_GPL(spi_nor_scan); |
1115 | 1120 | |
1116 | -const struct spi_device_id *spi_nor_match_id(char *name) | |
1121 | +static const struct spi_device_id *spi_nor_match_id(const char *name) | |
1117 | 1122 | { |
1118 | 1123 | const struct spi_device_id *id = spi_nor_ids; |
1119 | 1124 | |
... | ... | @@ -1124,7 +1129,6 @@ |
1124 | 1129 | } |
1125 | 1130 | return NULL; |
1126 | 1131 | } |
1127 | -EXPORT_SYMBOL_GPL(spi_nor_match_id); | |
1128 | 1132 | |
1129 | 1133 | MODULE_LICENSE("GPL"); |
1130 | 1134 | MODULE_AUTHOR("Huang Shijie <shijie8@gmail.com>"); |
include/linux/mtd/spi-nor.h
... | ... | @@ -187,33 +187,18 @@ |
187 | 187 | /** |
188 | 188 | * spi_nor_scan() - scan the SPI NOR |
189 | 189 | * @nor: the spi_nor structure |
190 | - * @id: the spi_device_id provided by the driver | |
190 | + * @name: the chip type name | |
191 | 191 | * @mode: the read mode supported by the driver |
192 | 192 | * |
193 | 193 | * The drivers can use this fuction to scan the SPI NOR. |
194 | 194 | * In the scanning, it will try to get all the necessary information to |
195 | 195 | * fill the mtd_info{} and the spi_nor{}. |
196 | 196 | * |
197 | - * The board may assigns a spi_device_id with @id which be used to compared with | |
198 | - * the spi_device_id detected by the scanning. | |
197 | + * The chip type name can be provided through the @name parameter. | |
199 | 198 | * |
200 | 199 | * Return: 0 for success, others for failure. |
201 | 200 | */ |
202 | -int spi_nor_scan(struct spi_nor *nor, const struct spi_device_id *id, | |
203 | - enum read_mode mode); | |
204 | -extern const struct spi_device_id spi_nor_ids[]; | |
205 | - | |
206 | -/** | |
207 | - * spi_nor_match_id() - find the spi_device_id by the name | |
208 | - * @name: the name of the spi_device_id | |
209 | - * | |
210 | - * The drivers use this function to find the spi_device_id | |
211 | - * specified by the @name. | |
212 | - * | |
213 | - * Return: returns the right spi_device_id pointer on success, | |
214 | - * and returns NULL on failure. | |
215 | - */ | |
216 | -const struct spi_device_id *spi_nor_match_id(char *name); | |
201 | +int spi_nor_scan(struct spi_nor *nor, const char *name, enum read_mode mode); | |
217 | 202 | |
218 | 203 | #endif |