Skip to content

Commit 74cae21

Browse files
committed
Merge tag 'mtd/for-5.20' of git://git.kernel.org/pub/scm/linux/kernel/git/mtd/linux
Pull MTD updates from Richard Weinberger: "MTD core changes: - Dynamic partition support - Fix deadlock in sm_ftl - Various refcount fixes in maps, partitions and parser code - Integer overflow fixes in mtdchar - Support for Sercomm partitions NAND driver changes: - Clockrate fix for arasan - Add ATO25D1GA support - Double free fix for meson driver - Fix probe/remove methods in cafe NAND - Support unprotected spare data pages in qcom_nandc SPI NOR core changes: - move SECT_4K_PMC flag out of the core as it's a vendor specific flag - s/addr_width/addr_nbytes/g: address width means the number of IO lines used for the address, whereas in the code it is used as the number of address bytes. - do not change nor->addr_nbytes at SFDP parsing time. At the SFDP parsing time we should not change members of struct spi_nor, but instead fill members of struct spi_nor_flash_parameters which could later on be used by the callers. - track flash's internal address mode so that we can use 4B opcodes together with opcodes that don't have a 4B opcode correspondent. SPI NOR manufacturer drivers changes: - esmt: Rename "f25l32qa" flash name to "f25l32qa-2s". - micron-st: Skip FSR reading if SPI controller does not support it to allow flashes that support FSR to work even when attached to such SPI controllers. - spansion: Add s25hl-t/s25hs-t IDs and fixups" * tag 'mtd/for-5.20' of git://git.kernel.org/pub/scm/linux/kernel/git/mtd/linux: (53 commits) mtd: core: check partition before dereference mtd: spi-nor: fix spi_nor_spimem_setup_op() call in spi_nor_erase_{sector,chip}() mtd: spi-nor: spansion: Add s25hl-t/s25hs-t IDs and fixups mtd: spi-nor: spansion: Add local function to discover page size mtd: spi-nor: core: Track flash's internal address mode mtd: spi-nor: core: Return error code from set_4byte_addr_mode() mtd: spi-nor: Do not change nor->addr_nbytes at SFDP parsing time mtd: spi-nor: core: Shrink the storage size of the flash_info's addr_nbytes mtd: spi-nor: s/addr_width/addr_nbytes mtd: spi-nor: esmt: Use correct name of f25l32qa mtd: spi-nor: micron-st: Skip FSR reading if SPI controller does not support it MAINTAINERS: Use my kernel.org email mtd: rawnand: arasan: Fix clock rate in NV-DDR mtd: rawnand: arasan: Update NAND bus clock instead of system clock mtd: core: introduce of support for dynamic partitions dt-bindings: mtd: partitions: add additional example for qcom,smem-part dt-bindings: mtd: partitions: support label/name only partition mtd: spi-nor: move SECT_4K_PMC special handling mtd: dataflash: Add SPI ID table mtd: hyperbus: rpc-if: Fix RPM imbalance in probe error path ...
2 parents 79b7e67 + 7ec4cdb commit 74cae21

Some content is hidden

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

50 files changed

+1108
-250
lines changed

Documentation/devicetree/bindings/mtd/mxc-nand.yaml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,4 @@ examples:
3737
compatible = "fsl,imx27-nand";
3838
reg = <0xd8000000 0x1000>;
3939
interrupts = <29>;
40-
nand-bus-width = <8>;
41-
nand-ecc-mode = "hw";
4240
};

Documentation/devicetree/bindings/mtd/partitions/partition.yaml

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,17 @@ description: |
1111
relative offset and size specified. Depending on partition function extra
1212
properties can be used.
1313
14+
A partition may be dynamically allocated by a specific parser at runtime.
15+
In this specific case, a specific suffix is required to the node name.
16+
Everything after 'partition-' will be used as the partition name to compare
17+
with the one dynamically allocated by the specific parser.
18+
If the partition contains invalid char a label can be provided that will
19+
be used instead of the node name to make the comparison.
20+
This is used to assign an OF node to the dynamiccally allocated partition
21+
so that subsystem like NVMEM can provide an OF node and declare NVMEM cells.
22+
The OF node will be assigned only if the partition label declared match the
23+
one assigned by the parser at runtime.
24+
1425
maintainers:
1526
- Rafał Miłecki <[email protected]>
1627

@@ -41,7 +52,12 @@ properties:
4152
immune to paired-pages corruptions
4253
type: boolean
4354

44-
required:
45-
- reg
55+
if:
56+
not:
57+
required: [ reg ]
58+
then:
59+
properties:
60+
$nodename:
61+
pattern: '^partition-.*$'
4662

4763
additionalProperties: true

Documentation/devicetree/bindings/mtd/partitions/qcom,smem-part.yaml

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,10 @@ properties:
1919
compatible:
2020
const: qcom,smem-part
2121

22+
patternProperties:
23+
"^partition-[0-9a-z]+$":
24+
$ref: partition.yaml#
25+
2226
required:
2327
- compatible
2428

@@ -31,3 +35,26 @@ examples:
3135
compatible = "qcom,smem-part";
3236
};
3337
};
38+
39+
- |
40+
/* Example declaring dynamic partition */
41+
flash {
42+
partitions {
43+
compatible = "qcom,smem-part";
44+
45+
partition-art {
46+
compatible = "nvmem-cells";
47+
#address-cells = <1>;
48+
#size-cells = <1>;
49+
label = "0:art";
50+
51+
macaddr_art_0: macaddr@0 {
52+
reg = <0x0 0x6>;
53+
};
54+
55+
macaddr_art_6: macaddr@6 {
56+
reg = <0x6 0x6>;
57+
};
58+
};
59+
};
60+
};

Documentation/devicetree/bindings/mtd/qcom,nandc.yaml

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,31 @@ allOf:
102102
- const: rx
103103
- const: cmd
104104

105+
- if:
106+
properties:
107+
compatible:
108+
contains:
109+
enum:
110+
- qcom,ipq806x-nand
111+
112+
then:
113+
properties:
114+
qcom,boot-partitions:
115+
$ref: /schemas/types.yaml#/definitions/uint32-matrix
116+
items:
117+
items:
118+
- description: offset
119+
- description: size
120+
description:
121+
Boot partition use a different layout where the 4 bytes of spare
122+
data are not protected by ECC. Use this to declare these special
123+
partitions by defining first the offset and then the size.
124+
125+
It's in the form of <offset1 size1 offset2 size2 offset3 ...>
126+
and should be declared in ascending order.
127+
128+
Refer to the ipq8064 example on how to use this special binding.
129+
105130
required:
106131
- compatible
107132
- reg
@@ -135,6 +160,8 @@ examples:
135160
nand-ecc-strength = <4>;
136161
nand-bus-width = <8>;
137162
163+
qcom,boot-partitions = <0x0 0x58a0000>;
164+
138165
partitions {
139166
compatible = "fixed-partitions";
140167
#address-cells = <1>;

MAINTAINERS

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19130,7 +19130,7 @@ F: drivers/pinctrl/spear/
1913019130

1913119131
SPI NOR SUBSYSTEM
1913219132
M: Tudor Ambarus <[email protected]>
19133-
M: Pratyush Yadav <[email protected]>
19133+
M: Pratyush Yadav <[email protected]>
1913419134
R: Michael Walle <[email protected]>
1913519135
1913619136
S: Maintained

drivers/mtd/devices/mtd_dataflash.c

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -112,6 +112,13 @@ static const struct of_device_id dataflash_dt_ids[] = {
112112
MODULE_DEVICE_TABLE(of, dataflash_dt_ids);
113113
#endif
114114

115+
static const struct spi_device_id dataflash_spi_ids[] = {
116+
{ .name = "at45", },
117+
{ .name = "dataflash", },
118+
{ /* sentinel */ }
119+
};
120+
MODULE_DEVICE_TABLE(spi, dataflash_spi_ids);
121+
115122
/* ......................................................................... */
116123

117124
/*
@@ -936,6 +943,7 @@ static struct spi_driver dataflash_driver = {
936943

937944
.probe = dataflash_probe,
938945
.remove = dataflash_remove,
946+
.id_table = dataflash_spi_ids,
939947

940948
/* FIXME: investigate suspend and resume... */
941949
};

drivers/mtd/devices/powernv_flash.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -270,7 +270,9 @@ static int powernv_flash_release(struct platform_device *pdev)
270270
struct powernv_flash *data = dev_get_drvdata(&(pdev->dev));
271271

272272
/* All resources should be freed automatically */
273-
return mtd_device_unregister(&(data->mtd));
273+
WARN_ON(mtd_device_unregister(&data->mtd));
274+
275+
return 0;
274276
}
275277

276278
static const struct of_device_id powernv_flash_match[] = {

drivers/mtd/devices/spear_smi.c

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1045,13 +1045,9 @@ static int spear_smi_remove(struct platform_device *pdev)
10451045
{
10461046
struct spear_smi *dev;
10471047
struct spear_snor_flash *flash;
1048-
int ret, i;
1048+
int i;
10491049

10501050
dev = platform_get_drvdata(pdev);
1051-
if (!dev) {
1052-
dev_err(&pdev->dev, "dev is null\n");
1053-
return -ENODEV;
1054-
}
10551051

10561052
/* clean up for all nor flash */
10571053
for (i = 0; i < dev->num_flashes; i++) {
@@ -1060,9 +1056,7 @@ static int spear_smi_remove(struct platform_device *pdev)
10601056
continue;
10611057

10621058
/* clean up mtd stuff */
1063-
ret = mtd_device_unregister(&flash->mtd);
1064-
if (ret)
1065-
dev_err(&pdev->dev, "error removing mtd\n");
1059+
WARN_ON(mtd_device_unregister(&flash->mtd));
10661060
}
10671061

10681062
clk_disable_unprepare(dev->clk);

drivers/mtd/devices/st_spi_fsm.c

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -2084,15 +2084,12 @@ static int stfsm_probe(struct platform_device *pdev)
20842084
* Configure READ/WRITE/ERASE sequences according to platform and
20852085
* device flags.
20862086
*/
2087-
if (info->config) {
2087+
if (info->config)
20882088
ret = info->config(fsm);
2089-
if (ret)
2090-
goto err_clk_unprepare;
2091-
} else {
2089+
else
20922090
ret = stfsm_prepare_rwe_seqs_default(fsm);
2093-
if (ret)
2094-
goto err_clk_unprepare;
2095-
}
2091+
if (ret)
2092+
goto err_clk_unprepare;
20962093

20972094
fsm->mtd.name = info->name;
20982095
fsm->mtd.dev.parent = &pdev->dev;
@@ -2115,20 +2112,24 @@ static int stfsm_probe(struct platform_device *pdev)
21152112
(long long)fsm->mtd.size, (long long)(fsm->mtd.size >> 20),
21162113
fsm->mtd.erasesize, (fsm->mtd.erasesize >> 10));
21172114

2118-
return mtd_device_register(&fsm->mtd, NULL, 0);
2119-
2115+
ret = mtd_device_register(&fsm->mtd, NULL, 0);
2116+
if (ret) {
21202117
err_clk_unprepare:
2121-
clk_disable_unprepare(fsm->clk);
2118+
clk_disable_unprepare(fsm->clk);
2119+
}
2120+
21222121
return ret;
21232122
}
21242123

21252124
static int stfsm_remove(struct platform_device *pdev)
21262125
{
21272126
struct stfsm *fsm = platform_get_drvdata(pdev);
21282127

2128+
WARN_ON(mtd_device_unregister(&fsm->mtd));
2129+
21292130
clk_disable_unprepare(fsm->clk);
21302131

2131-
return mtd_device_unregister(&fsm->mtd);
2132+
return 0;
21322133
}
21332134

21342135
#ifdef CONFIG_PM_SLEEP

drivers/mtd/hyperbus/hbmc-am654.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -233,16 +233,16 @@ static int 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;
236-
int ret;
237236

238-
ret = hyperbus_unregister_device(&priv->hbdev);
237+
hyperbus_unregister_device(&priv->hbdev);
238+
239239
if (priv->mux_ctrl)
240240
mux_control_deselect(priv->mux_ctrl);
241241

242242
if (dev_priv->rx_chan)
243243
dma_release_channel(dev_priv->rx_chan);
244244

245-
return ret;
245+
return 0;
246246
}
247247

248248
static const struct of_device_id am654_hbmc_dt_ids[] = {

drivers/mtd/hyperbus/hyperbus-core.c

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -126,16 +126,12 @@ int hyperbus_register_device(struct hyperbus_device *hbdev)
126126
}
127127
EXPORT_SYMBOL_GPL(hyperbus_register_device);
128128

129-
int hyperbus_unregister_device(struct hyperbus_device *hbdev)
129+
void hyperbus_unregister_device(struct hyperbus_device *hbdev)
130130
{
131-
int ret = 0;
132-
133131
if (hbdev && hbdev->mtd) {
134-
ret = mtd_device_unregister(hbdev->mtd);
132+
WARN_ON(mtd_device_unregister(hbdev->mtd));
135133
map_destroy(hbdev->mtd);
136134
}
137-
138-
return ret;
139135
}
140136
EXPORT_SYMBOL_GPL(hyperbus_unregister_device);
141137

drivers/mtd/hyperbus/rpc-if.c

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,7 @@ static int rpcif_hb_probe(struct platform_device *pdev)
134134

135135
error = rpcif_hw_init(&hyperbus->rpc, true);
136136
if (error)
137-
return error;
137+
goto out_disable_rpm;
138138

139139
hyperbus->hbdev.map.size = hyperbus->rpc.size;
140140
hyperbus->hbdev.map.virt = hyperbus->rpc.dirmap;
@@ -145,19 +145,24 @@ static int rpcif_hb_probe(struct platform_device *pdev)
145145
hyperbus->hbdev.np = of_get_next_child(pdev->dev.parent->of_node, NULL);
146146
error = hyperbus_register_device(&hyperbus->hbdev);
147147
if (error)
148-
rpcif_disable_rpm(&hyperbus->rpc);
148+
goto out_disable_rpm;
149+
150+
return 0;
149151

152+
out_disable_rpm:
153+
rpcif_disable_rpm(&hyperbus->rpc);
150154
return error;
151155
}
152156

153157
static int rpcif_hb_remove(struct platform_device *pdev)
154158
{
155159
struct rpcif_hyperbus *hyperbus = platform_get_drvdata(pdev);
156-
int error = hyperbus_unregister_device(&hyperbus->hbdev);
160+
161+
hyperbus_unregister_device(&hyperbus->hbdev);
157162

158163
rpcif_disable_rpm(&hyperbus->rpc);
159164

160-
return error;
165+
return 0;
161166
}
162167

163168
static struct platform_driver rpcif_platform_driver = {

drivers/mtd/lpddr/lpddr2_nvm.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -478,7 +478,9 @@ static int lpddr2_nvm_probe(struct platform_device *pdev)
478478
*/
479479
static int lpddr2_nvm_remove(struct platform_device *pdev)
480480
{
481-
return mtd_device_unregister(dev_get_drvdata(&pdev->dev));
481+
WARN_ON(mtd_device_unregister(dev_get_drvdata(&pdev->dev)));
482+
483+
return 0;
482484
}
483485

484486
/* Initialize platform_driver data structure for lpddr2_nvm */

drivers/mtd/maps/physmap-core.c

Lines changed: 3 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -66,18 +66,12 @@ static int physmap_flash_remove(struct platform_device *dev)
6666
{
6767
struct physmap_flash_info *info;
6868
struct physmap_flash_data *physmap_data;
69-
int i, err = 0;
69+
int i;
7070

7171
info = platform_get_drvdata(dev);
72-
if (!info) {
73-
err = -EINVAL;
74-
goto out;
75-
}
7672

7773
if (info->cmtd) {
78-
err = mtd_device_unregister(info->cmtd);
79-
if (err)
80-
goto out;
74+
WARN_ON(mtd_device_unregister(info->cmtd));
8175

8276
if (info->cmtd != info->mtds[0])
8377
mtd_concat_destroy(info->cmtd);
@@ -92,10 +86,9 @@ static int physmap_flash_remove(struct platform_device *dev)
9286
if (physmap_data && physmap_data->exit)
9387
physmap_data->exit(dev);
9488

95-
out:
9689
pm_runtime_put(&dev->dev);
9790
pm_runtime_disable(&dev->dev);
98-
return err;
91+
return 0;
9992
}
10093

10194
static void physmap_set_vpp(struct map_info *map, int state)

drivers/mtd/maps/physmap-versatile.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,7 @@ static int ap_flash_init(struct platform_device *pdev)
9393
return -ENODEV;
9494
}
9595
ebi_base = of_iomap(ebi, 0);
96+
of_node_put(ebi);
9697
if (!ebi_base)
9798
return -ENODEV;
9899

@@ -207,6 +208,7 @@ int of_flash_probe_versatile(struct platform_device *pdev,
207208

208209
versatile_flashprot = (enum versatile_flashprot)devid->data;
209210
rmap = syscon_node_to_regmap(sysnp);
211+
of_node_put(sysnp);
210212
if (IS_ERR(rmap))
211213
return PTR_ERR(rmap);
212214

0 commit comments

Comments
 (0)