Skip to content

Commit f6e0150

Browse files
committed
Merge tag 'mtd/for-6.15' of git://git.kernel.org/pub/scm/linux/kernel/git/mtd/linux
Pull mtd updates from Miquel Raynal: "MTD changes: - The atmel,dataflash binding has been converted to yaml and the physmap one constrained. Some logs are improved, error path are getting reworked a bit, few patches target the use of str_enabled_disabled(). Raw NAND changes: - i.MX8 and i.MX31 now have their own compatible, the Qcom driver got cleaned, the Broadcom driver got fixed. SPI NAND changes: - OTP support has been brought, and ESMT and Micron manufacturer drivers implement it. - Read retry, and Macronix manufacturer driver implement it. SPI NOR changes: - Adding support for few flashes. Few cleanup patches for the core driver, where we touched the headers inclusion list and we start using the scope based mutex cleanup helpers. There is also a bunch of minor improvements and fixes in drivers and bindings" * tag 'mtd/for-6.15' of git://git.kernel.org/pub/scm/linux/kernel/git/mtd/linux: (34 commits) dt-bindings: mtd: atmel,dataflash: convert txt to yaml mtd: mchp48l640: Use str_enable_disable() in mchp48l640_write_prepare() mtd: rawnand: gpmi: Use str_enabled_disabled() in gpmi_nand_attach_chip() mtd: mtdpart: Do not supply NULL to printf() dt-bindings: mtd: gpmi-nand: Add compatible string for i.MX8 chips mtd: nand: Fix a kdoc comment mtd: spinand: Improve spinand_info macros style mtd: spi-nor: drop unused <linux/of_platform.h> mtd: spi-nor: explicitly include <linux/of.h> mtd: spi-nor: explicitly include <linux/math64.h> mtd: spi-nor: macronix: add support for mx66{l2, u1}g45g mtd: spi-nor: macronix: Add post_sfdp fixups for Quad Input Page Program mtd: Fix error handling in mtd_device_parse_register() error path mtd: capture device name setting failure when adding mtd mtd: Add check for devm_kcalloc() mtd: Replace kcalloc() with devm_kcalloc() dt-bindings: mtd: physmap: Ensure all properties are defined mtd: rawnand: brcmnand: fix PM resume warning dt-bindings: mtd: mxc-nand: Document fsl,imx31-nand mtd: spinand: macronix: Add support for read retry ...
2 parents 5e06802 + 2dd33fc commit f6e0150

28 files changed

+1122
-146
lines changed

Documentation/devicetree/bindings/mtd/arasan,nand-controller.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ required:
4242
- clock-names
4343
- interrupts
4444

45-
unevaluatedProperties: true
45+
unevaluatedProperties: false
4646

4747
examples:
4848
- |
Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
2+
%YAML 1.2
3+
---
4+
$id: http://devicetree.org/schemas/mtd/atmel,dataflash.yaml#
5+
$schema: http://devicetree.org/meta-schemas/core.yaml#
6+
7+
title: Atmel DataFlash
8+
9+
maintainers:
10+
- Nayab Sayed <[email protected]>
11+
12+
description:
13+
The Atmel DataFlash is a low pin-count serial interface sequential access
14+
Flash memory, compatible with SPI standard. The device tree may optionally
15+
contain sub-nodes describing partitions of the address space.
16+
17+
properties:
18+
compatible:
19+
oneOf:
20+
- items:
21+
- enum:
22+
- atmel,at45db321d
23+
- atmel,at45db041e
24+
- atmel,at45db642d
25+
- atmel,at45db021d
26+
- const: atmel,at45
27+
- const: atmel,dataflash
28+
- items:
29+
- const: atmel,at45
30+
- const: atmel,dataflash
31+
32+
reg:
33+
maxItems: 1
34+
35+
required:
36+
- compatible
37+
- reg
38+
39+
allOf:
40+
- $ref: mtd.yaml#
41+
- $ref: /schemas/spi/spi-peripheral-props.yaml#
42+
43+
unevaluatedProperties: false
44+
45+
examples:
46+
- |
47+
spi {
48+
#address-cells = <1>;
49+
#size-cells = <0>;
50+
51+
flash@1 {
52+
compatible = "atmel,at45db321d", "atmel,at45", "atmel,dataflash";
53+
reg = <1>;
54+
};
55+
};

Documentation/devicetree/bindings/mtd/atmel-dataflash.txt

Lines changed: 0 additions & 17 deletions
This file was deleted.

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

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,14 @@ properties:
2929
- enum:
3030
- fsl,imx8mm-gpmi-nand
3131
- fsl,imx8mn-gpmi-nand
32+
- fsl,imx8mp-gpmi-nand
33+
- fsl,imx8mq-gpmi-nand
3234
- const: fsl,imx7d-gpmi-nand
35+
- items:
36+
- enum:
37+
- fsl,imx8dxl-gpmi-nand
38+
- fsl,imx8qm-gpmi-nand
39+
- const: fsl,imx8qxp-gpmi-nand
3340

3441
reg:
3542
items:

Documentation/devicetree/bindings/mtd/mtd-physmap.yaml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -122,6 +122,8 @@ properties:
122122
'#size-cells':
123123
const: 1
124124

125+
ranges: true
126+
125127
big-endian: true
126128
little-endian: true
127129

@@ -143,8 +145,7 @@ then:
143145
required:
144146
- syscon
145147

146-
# FIXME: A parent bus may define timing properties
147-
additionalProperties: true
148+
unevaluatedProperties: false
148149

149150
examples:
150151
- |

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

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,12 @@ allOf:
1414

1515
properties:
1616
compatible:
17-
const: fsl,imx27-nand
18-
17+
oneOf:
18+
- const: fsl,imx27-nand
19+
- items:
20+
- enum:
21+
- fsl,imx31-nand
22+
- const: fsl,imx27-nand
1923
reg:
2024
maxItems: 1
2125

drivers/mtd/devices/mchp48l640.c

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323
#include <linux/spi/flash.h>
2424
#include <linux/spi/spi.h>
2525
#include <linux/of.h>
26+
#include <linux/string_choices.h>
2627

2728
struct mchp48_caps {
2829
unsigned int size;
@@ -128,11 +129,11 @@ static int mchp48l640_write_prepare(struct mchp48l640_flash *flash, bool enable)
128129
mutex_unlock(&flash->lock);
129130

130131
if (ret)
131-
dev_err(&flash->spi->dev, "write %sable failed ret: %d",
132-
(enable ? "en" : "dis"), ret);
132+
dev_err(&flash->spi->dev, "write %s failed ret: %d",
133+
str_enable_disable(enable), ret);
133134

134-
dev_dbg(&flash->spi->dev, "write %sable success ret: %d",
135-
(enable ? "en" : "dis"), ret);
135+
dev_dbg(&flash->spi->dev, "write %s success ret: %d",
136+
str_enable_disable(enable), ret);
136137
if (enable)
137138
return mchp48l640_waitforbit(flash, MCHP48L640_STATUS_WEL, true);
138139

drivers/mtd/mtdcore.c

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -741,7 +741,9 @@ int add_mtd_device(struct mtd_info *mtd)
741741
mtd->dev.type = &mtd_devtype;
742742
mtd->dev.class = &mtd_class;
743743
mtd->dev.devt = MTD_DEVT(i);
744-
dev_set_name(&mtd->dev, "mtd%d", i);
744+
error = dev_set_name(&mtd->dev, "mtd%d", i);
745+
if (error)
746+
goto fail_devname;
745747
dev_set_drvdata(&mtd->dev, mtd);
746748
mtd_check_of_node(mtd);
747749
of_node_get(mtd_get_of_node(mtd));
@@ -790,6 +792,7 @@ int add_mtd_device(struct mtd_info *mtd)
790792
device_unregister(&mtd->dev);
791793
fail_added:
792794
of_node_put(mtd_get_of_node(mtd));
795+
fail_devname:
793796
idr_remove(&mtd_idr, i);
794797
fail_locked:
795798
mutex_unlock(&mtd_table_mutex);
@@ -1053,7 +1056,7 @@ int mtd_device_parse_register(struct mtd_info *mtd, const char * const *types,
10531056
const struct mtd_partition *parts,
10541057
int nr_parts)
10551058
{
1056-
int ret;
1059+
int ret, err;
10571060

10581061
mtd_set_dev_defaults(mtd);
10591062

@@ -1105,8 +1108,11 @@ int mtd_device_parse_register(struct mtd_info *mtd, const char * const *types,
11051108
nvmem_unregister(mtd->otp_factory_nvmem);
11061109
}
11071110

1108-
if (ret && device_is_registered(&mtd->dev))
1109-
del_mtd_device(mtd);
1111+
if (ret && device_is_registered(&mtd->dev)) {
1112+
err = del_mtd_device(mtd);
1113+
if (err)
1114+
pr_err("Error when deleting MTD device (%d)\n", err);
1115+
}
11101116

11111117
return ret;
11121118
}

drivers/mtd/mtdpart.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -690,10 +690,9 @@ int parse_mtd_partitions(struct mtd_info *master, const char *const *types,
690690
parser = mtd_part_parser_get(*types);
691691
if (!parser && !request_module("%s", *types))
692692
parser = mtd_part_parser_get(*types);
693-
pr_debug("%s: got parser %s\n", master->name,
694-
parser ? parser->name : NULL);
695693
if (!parser)
696694
continue;
695+
pr_debug("%s: got parser %s\n", master->name, parser->name);
697696
ret = mtd_part_do_parse(parser, master, &pparts, data);
698697
if (ret <= 0)
699698
mtd_part_parser_put(parser);

drivers/mtd/mtdpstore.c

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -417,11 +417,14 @@ static void mtdpstore_notify_add(struct mtd_info *mtd)
417417
}
418418

419419
longcnt = BITS_TO_LONGS(div_u64(mtd->size, info->kmsg_size));
420-
cxt->rmmap = kcalloc(longcnt, sizeof(long), GFP_KERNEL);
421-
cxt->usedmap = kcalloc(longcnt, sizeof(long), GFP_KERNEL);
420+
cxt->rmmap = devm_kcalloc(&mtd->dev, longcnt, sizeof(long), GFP_KERNEL);
421+
cxt->usedmap = devm_kcalloc(&mtd->dev, longcnt, sizeof(long), GFP_KERNEL);
422422

423423
longcnt = BITS_TO_LONGS(div_u64(mtd->size, mtd->erasesize));
424-
cxt->badmap = kcalloc(longcnt, sizeof(long), GFP_KERNEL);
424+
cxt->badmap = devm_kcalloc(&mtd->dev, longcnt, sizeof(long), GFP_KERNEL);
425+
426+
if (!cxt->rmmap || !cxt->usedmap || !cxt->badmap)
427+
return;
425428

426429
/* just support dmesg right now */
427430
cxt->dev.flags = PSTORE_FLAGS_DMESG;
@@ -527,9 +530,6 @@ static void mtdpstore_notify_remove(struct mtd_info *mtd)
527530
mtdpstore_flush_removed(cxt);
528531

529532
unregister_pstore_device(&cxt->dev);
530-
kfree(cxt->badmap);
531-
kfree(cxt->usedmap);
532-
kfree(cxt->rmmap);
533533
cxt->mtd = NULL;
534534
cxt->index = -1;
535535
}

0 commit comments

Comments
 (0)