Skip to content

Commit b1dfbda

Browse files
committed
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 ...
2 parents e707038 + 6d55d31 commit b1dfbda

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

71 files changed

+1819
-988
lines changed

Documentation/devicetree/bindings/mtd/partitions/fixed-partitions.yaml

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,24 @@ properties:
2929

3030
"#size-cells": true
3131

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+
3250
patternProperties:
3351
"@[0-9a-f]+$":
3452
$ref: partition.yaml#
@@ -64,6 +82,7 @@ examples:
6482
6583
uimage@100000 {
6684
reg = <0x0100000 0x200000>;
85+
compress = "lzma";
6786
};
6887
};
6988

drivers/mtd/chips/cfi_cmdset_0001.c

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -422,9 +422,25 @@ read_pri_intelext(struct map_info *map, __u16 adr)
422422
extra_size = 0;
423423

424424
/* 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+
426429
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+
}
428444
}
429445

430446
if (extp->MinorVersion >= '1') {

drivers/mtd/chips/map_ram.c

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -70,12 +70,16 @@ static struct mtd_info *map_ram_probe(struct map_info *map)
7070
mtd->_read = mapram_read;
7171
mtd->_write = mapram_write;
7272
mtd->_panic_write = mapram_write;
73-
mtd->_point = mapram_point;
7473
mtd->_sync = mapram_nop;
75-
mtd->_unpoint = mapram_unpoint;
7674
mtd->flags = MTD_CAP_RAM;
7775
mtd->writesize = 1;
7876

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+
}
82+
7983
mtd->erasesize = PAGE_SIZE;
8084
while(mtd->size & (mtd->erasesize - 1))
8185
mtd->erasesize >>= 1;

drivers/mtd/devices/bcm47xxsflash.c

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -357,19 +357,17 @@ static int bcm47xxsflash_bcma_probe(struct platform_device *pdev)
357357
return 0;
358358
}
359359

360-
static int bcm47xxsflash_bcma_remove(struct platform_device *pdev)
360+
static void bcm47xxsflash_bcma_remove(struct platform_device *pdev)
361361
{
362362
struct bcm47xxsflash *b47s = platform_get_drvdata(pdev);
363363

364364
mtd_device_unregister(&b47s->mtd);
365365
iounmap(b47s->window);
366-
367-
return 0;
368366
}
369367

370368
static struct platform_driver bcma_sflash_driver = {
371369
.probe = bcm47xxsflash_bcma_probe,
372-
.remove = bcm47xxsflash_bcma_remove,
370+
.remove_new = bcm47xxsflash_bcma_remove,
373371
.driver = {
374372
.name = "bcma_sflash",
375373
},

drivers/mtd/devices/docg3.c

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2046,7 +2046,7 @@ static int __init docg3_probe(struct platform_device *pdev)
20462046
*
20472047
* Returns 0
20482048
*/
2049-
static int docg3_release(struct platform_device *pdev)
2049+
static void docg3_release(struct platform_device *pdev)
20502050
{
20512051
struct docg3_cascade *cascade = platform_get_drvdata(pdev);
20522052
struct docg3 *docg3 = cascade->floors[0]->priv;
@@ -2058,7 +2058,6 @@ static int docg3_release(struct platform_device *pdev)
20582058
doc_release_device(cascade->floors[floor]);
20592059

20602060
bch_free(docg3->cascade->bch);
2061-
return 0;
20622061
}
20632062

20642063
#ifdef CONFIG_OF
@@ -2076,7 +2075,7 @@ static struct platform_driver g3_driver = {
20762075
},
20772076
.suspend = docg3_suspend,
20782077
.resume = docg3_resume,
2079-
.remove = docg3_release,
2078+
.remove_new = docg3_release,
20802079
};
20812080

20822081
module_platform_driver_probe(g3_driver, docg3_probe);

drivers/mtd/devices/phram.c

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -388,20 +388,18 @@ static int phram_probe(struct platform_device *pdev)
388388
PAGE_SIZE);
389389
}
390390

391-
static int phram_remove(struct platform_device *pdev)
391+
static void phram_remove(struct platform_device *pdev)
392392
{
393393
struct phram_mtd_list *phram = platform_get_drvdata(pdev);
394394

395395
mtd_device_unregister(&phram->mtd);
396396
phram_unmap(phram);
397397
kfree(phram);
398-
399-
return 0;
400398
}
401399

402400
static struct platform_driver phram_driver = {
403401
.probe = phram_probe,
404-
.remove = phram_remove,
402+
.remove_new = phram_remove,
405403
.driver = {
406404
.name = "phram",
407405
.of_match_table = of_match_ptr(phram_of_match),

drivers/mtd/devices/powernv_flash.c

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -265,14 +265,12 @@ static int powernv_flash_probe(struct platform_device *pdev)
265265
*
266266
* Returns 0
267267
*/
268-
static int powernv_flash_release(struct platform_device *pdev)
268+
static void powernv_flash_release(struct platform_device *pdev)
269269
{
270270
struct powernv_flash *data = dev_get_drvdata(&(pdev->dev));
271271

272272
/* All resources should be freed automatically */
273273
WARN_ON(mtd_device_unregister(&data->mtd));
274-
275-
return 0;
276274
}
277275

278276
static const struct of_device_id powernv_flash_match[] = {
@@ -285,7 +283,7 @@ static struct platform_driver powernv_flash_driver = {
285283
.name = "powernv_flash",
286284
.of_match_table = powernv_flash_match,
287285
},
288-
.remove = powernv_flash_release,
286+
.remove_new = powernv_flash_release,
289287
.probe = powernv_flash_probe,
290288
};
291289

drivers/mtd/devices/spear_smi.c

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1031,7 +1031,7 @@ static int spear_smi_probe(struct platform_device *pdev)
10311031
*
10321032
* free all allocations and delete the partitions.
10331033
*/
1034-
static int spear_smi_remove(struct platform_device *pdev)
1034+
static void spear_smi_remove(struct platform_device *pdev)
10351035
{
10361036
struct spear_smi *dev;
10371037
struct spear_snor_flash *flash;
@@ -1048,8 +1048,6 @@ static int spear_smi_remove(struct platform_device *pdev)
10481048
/* clean up mtd stuff */
10491049
WARN_ON(mtd_device_unregister(&flash->mtd));
10501050
}
1051-
1052-
return 0;
10531051
}
10541052

10551053
#ifdef CONFIG_PM_SLEEP
@@ -1095,7 +1093,7 @@ static struct platform_driver spear_smi_driver = {
10951093
.pm = &spear_smi_pm_ops,
10961094
},
10971095
.probe = spear_smi_probe,
1098-
.remove = spear_smi_remove,
1096+
.remove_new = spear_smi_remove,
10991097
};
11001098
module_platform_driver(spear_smi_driver);
11011099

drivers/mtd/devices/st_spi_fsm.c

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2097,13 +2097,11 @@ static int stfsm_probe(struct platform_device *pdev)
20972097
return mtd_device_register(&fsm->mtd, NULL, 0);
20982098
}
20992099

2100-
static int stfsm_remove(struct platform_device *pdev)
2100+
static void stfsm_remove(struct platform_device *pdev)
21012101
{
21022102
struct stfsm *fsm = platform_get_drvdata(pdev);
21032103

21042104
WARN_ON(mtd_device_unregister(&fsm->mtd));
2105-
2106-
return 0;
21072105
}
21082106

21092107
#ifdef CONFIG_PM_SLEEP
@@ -2134,7 +2132,7 @@ MODULE_DEVICE_TABLE(of, stfsm_match);
21342132

21352133
static struct platform_driver stfsm_driver = {
21362134
.probe = stfsm_probe,
2137-
.remove = stfsm_remove,
2135+
.remove_new = stfsm_remove,
21382136
.driver = {
21392137
.name = "st-spi-fsm",
21402138
.of_match_table = stfsm_match,

drivers/mtd/hyperbus/hbmc-am654.c

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -229,7 +229,7 @@ static int am654_hbmc_probe(struct platform_device *pdev)
229229
return ret;
230230
}
231231

232-
static int am654_hbmc_remove(struct platform_device *pdev)
232+
static void am654_hbmc_remove(struct platform_device *pdev)
233233
{
234234
struct am654_hbmc_priv *priv = platform_get_drvdata(pdev);
235235
struct am654_hbmc_device_priv *dev_priv = priv->hbdev.priv;
@@ -241,8 +241,6 @@ static int am654_hbmc_remove(struct platform_device *pdev)
241241

242242
if (dev_priv->rx_chan)
243243
dma_release_channel(dev_priv->rx_chan);
244-
245-
return 0;
246244
}
247245

248246
static const struct of_device_id am654_hbmc_dt_ids[] = {
@@ -256,7 +254,7 @@ MODULE_DEVICE_TABLE(of, am654_hbmc_dt_ids);
256254

257255
static struct platform_driver am654_hbmc_platform_driver = {
258256
.probe = am654_hbmc_probe,
259-
.remove = am654_hbmc_remove,
257+
.remove_new = am654_hbmc_remove,
260258
.driver = {
261259
.name = "hbmc-am654",
262260
.of_match_table = am654_hbmc_dt_ids,

drivers/mtd/hyperbus/rpc-if.c

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -154,20 +154,18 @@ static int rpcif_hb_probe(struct platform_device *pdev)
154154
return error;
155155
}
156156

157-
static int rpcif_hb_remove(struct platform_device *pdev)
157+
static void rpcif_hb_remove(struct platform_device *pdev)
158158
{
159159
struct rpcif_hyperbus *hyperbus = platform_get_drvdata(pdev);
160160

161161
hyperbus_unregister_device(&hyperbus->hbdev);
162162

163163
pm_runtime_disable(hyperbus->rpc.dev);
164-
165-
return 0;
166164
}
167165

168166
static struct platform_driver rpcif_platform_driver = {
169167
.probe = rpcif_hb_probe,
170-
.remove = rpcif_hb_remove,
168+
.remove_new = rpcif_hb_remove,
171169
.driver = {
172170
.name = "rpc-if-hyperflash",
173171
},

drivers/mtd/lpddr/lpddr2_nvm.c

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -476,11 +476,9 @@ static int lpddr2_nvm_probe(struct platform_device *pdev)
476476
/*
477477
* lpddr2_nvm driver remove method
478478
*/
479-
static int lpddr2_nvm_remove(struct platform_device *pdev)
479+
static void lpddr2_nvm_remove(struct platform_device *pdev)
480480
{
481481
WARN_ON(mtd_device_unregister(dev_get_drvdata(&pdev->dev)));
482-
483-
return 0;
484482
}
485483

486484
/* Initialize platform_driver data structure for lpddr2_nvm */
@@ -489,7 +487,7 @@ static struct platform_driver lpddr2_nvm_drv = {
489487
.name = "lpddr2_nvm",
490488
},
491489
.probe = lpddr2_nvm_probe,
492-
.remove = lpddr2_nvm_remove,
490+
.remove_new = lpddr2_nvm_remove,
493491
};
494492

495493
module_platform_driver(lpddr2_nvm_drv);

drivers/mtd/lpddr/lpddr_cmds.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ struct mtd_info *lpddr_cmdset(struct map_info *map)
6161
mtd->_point = lpddr_point;
6262
mtd->_unpoint = lpddr_unpoint;
6363
}
64-
mtd->size = 1 << lpddr->qinfo->DevSizeShift;
64+
mtd->size = 1ULL << lpddr->qinfo->DevSizeShift;
6565
mtd->erasesize = 1 << lpddr->qinfo->UniformBlockSizeShift;
6666
mtd->writesize = 1 << lpddr->qinfo->BufSizeShift;
6767

drivers/mtd/maps/lantiq-flash.c

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -166,16 +166,14 @@ ltq_mtd_probe(struct platform_device *pdev)
166166
return err;
167167
}
168168

169-
static int
170-
ltq_mtd_remove(struct platform_device *pdev)
169+
static void ltq_mtd_remove(struct platform_device *pdev)
171170
{
172171
struct ltq_mtd *ltq_mtd = platform_get_drvdata(pdev);
173172

174173
if (ltq_mtd && ltq_mtd->mtd) {
175174
mtd_device_unregister(ltq_mtd->mtd);
176175
map_destroy(ltq_mtd->mtd);
177176
}
178-
return 0;
179177
}
180178

181179
static const struct of_device_id ltq_mtd_match[] = {
@@ -186,7 +184,7 @@ MODULE_DEVICE_TABLE(of, ltq_mtd_match);
186184

187185
static struct platform_driver ltq_mtd_driver = {
188186
.probe = ltq_mtd_probe,
189-
.remove = ltq_mtd_remove,
187+
.remove_new = ltq_mtd_remove,
190188
.driver = {
191189
.name = "ltq-nor",
192190
.of_match_table = ltq_mtd_match,

drivers/mtd/maps/physmap-core.c

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -30,14 +30,15 @@
3030
#include <linux/slab.h>
3131
#include <linux/device.h>
3232
#include <linux/platform_device.h>
33+
#include <linux/property.h>
3334
#include <linux/mtd/mtd.h>
3435
#include <linux/mtd/map.h>
3536
#include <linux/mtd/partitions.h>
3637
#include <linux/mtd/physmap.h>
3738
#include <linux/mtd/concat.h>
3839
#include <linux/mtd/cfi_endian.h>
3940
#include <linux/io.h>
40-
#include <linux/of_device.h>
41+
#include <linux/of.h>
4142
#include <linux/pm_runtime.h>
4243
#include <linux/gpio/consumer.h>
4344

@@ -62,7 +63,7 @@ struct physmap_flash_info {
6263
unsigned int win_order;
6364
};
6465

65-
static int physmap_flash_remove(struct platform_device *dev)
66+
static void physmap_flash_remove(struct platform_device *dev)
6667
{
6768
struct physmap_flash_info *info;
6869
struct physmap_flash_data *physmap_data;
@@ -88,7 +89,6 @@ static int physmap_flash_remove(struct platform_device *dev)
8889

8990
pm_runtime_put(&dev->dev);
9091
pm_runtime_disable(&dev->dev);
91-
return 0;
9292
}
9393

9494
static void physmap_set_vpp(struct map_info *map, int state)
@@ -296,14 +296,9 @@ static const char * const *of_get_part_probes(struct platform_device *dev)
296296
static const char *of_select_probe_type(struct platform_device *dev)
297297
{
298298
struct device_node *dp = dev->dev.of_node;
299-
const struct of_device_id *match;
300299
const char *probe_type;
301300

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);
307302
if (probe_type)
308303
return probe_type;
309304

@@ -626,7 +621,7 @@ static void physmap_flash_shutdown(struct platform_device *dev)
626621

627622
static struct platform_driver physmap_flash_driver = {
628623
.probe = physmap_flash_probe,
629-
.remove = physmap_flash_remove,
624+
.remove_new = physmap_flash_remove,
630625
.shutdown = physmap_flash_shutdown,
631626
.driver = {
632627
.name = "physmap-flash",

0 commit comments

Comments
 (0)