Skip to content

Commit 2c51d0d

Browse files
committed
Merge tag 'nand/for-5.19' into mtd/next
NAND core: * Print offset instead of page number for bad blocks Raw NAND controller drivers: * Cadence: Fix possible null-ptr-deref in cadence_nand_dt_probe() * CS553X: simplify the return expression of cs553x_write_ctrl_byte() * Davinci: Remove redundant unsigned comparison to zero * Denali: Use managed device resources * GPMI: - Add large oob bch setting support - Rename the variable ecc_chunk_size - Uninline the gpmi_check_ecc function - Add strict ecc strength check - Refactor BCH geometry settings function * Intel: Fix possible null-ptr-deref in ebu_nand_probe() * MPC5121: Check before clk_disable_unprepare() not needed * Mtk: - MTD_NAND_ECC_MEDIATEK should depend on ARCH_MEDIATEK - Also parse the default nand-ecc-engine property if available - Make mtk_ecc.c a separated module * OMAP ELM: - Convert the bindings to yaml - Describe the bindings for AM64 ELM - Add support for its compatible * Renesas: Use runtime PM instead of the raw clock API and update the bindings accordingly * Rockchip: Check before clk_disable_unprepare() not needed * TMIO: Check return value after calling platform_get_resource() Raw NAND chip driver: * Kioxia: Add support for TH58NVG3S0HBAI4 and TC58NVG0S3HTA00 SPI-NAND chip drivers: * Gigadevice: - Add support for: - GD5FxGM7xExxG - GD5F{2,4}GQ5xExxG - GD5F1GQ5RExxG - GD5FxGQ4xExxG - Fix Quad IO for GD5F1GQ5UExxG * XTX: Add support for XT26G0xA Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com>
2 parents e6828be + 6a2277a commit 2c51d0d

30 files changed

Lines changed: 701 additions & 129 deletions

Documentation/devicetree/bindings/mtd/elm.txt

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

Documentation/devicetree/bindings/mtd/renesas-nandc.yaml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,11 +36,15 @@ properties:
3636
- const: hclk
3737
- const: eclk
3838

39+
power-domains:
40+
maxItems: 1
41+
3942
required:
4043
- compatible
4144
- reg
4245
- clocks
4346
- clock-names
47+
- power-domains
4448
- interrupts
4549

4650
unevaluatedProperties: false
@@ -56,6 +60,7 @@ examples:
5660
interrupts = <GIC_SPI 58 IRQ_TYPE_LEVEL_HIGH>;
5761
clocks = <&sysctrl R9A06G032_HCLK_NAND>, <&sysctrl R9A06G032_CLK_NAND>;
5862
clock-names = "hclk", "eclk";
63+
power-domains = <&sysctrl>;
5964
#address-cells = <1>;
6065
#size-cells = <0>;
6166
};
Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
1+
# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
2+
%YAML 1.2
3+
---
4+
$id: http://devicetree.org/schemas/mtd/ti,elm.yaml#
5+
$schema: http://devicetree.org/meta-schemas/core.yaml#
6+
7+
title: Texas Instruments Error Location Module (ELM).
8+
9+
maintainers:
10+
- Roger Quadros <rogerq@kernel.org>
11+
12+
description:
13+
ELM module is used together with GPMC and NAND Flash to detect
14+
errors and the location of the error based on BCH algorithms
15+
so they can be corrected if possible.
16+
17+
properties:
18+
compatible:
19+
enum:
20+
- ti,am3352-elm
21+
- ti,am64-elm
22+
23+
reg:
24+
maxItems: 1
25+
26+
interrupts:
27+
maxItems: 1
28+
29+
clocks:
30+
maxItems: 1
31+
description: Functional clock.
32+
33+
clock-names:
34+
items:
35+
- const: fck
36+
37+
power-domains:
38+
maxItems: 1
39+
40+
ti,hwmods:
41+
description:
42+
Name of the HWMOD associated with ELM. This is for legacy
43+
platforms only.
44+
$ref: /schemas/types.yaml#/definitions/string
45+
deprecated: true
46+
47+
required:
48+
- compatible
49+
- reg
50+
- interrupts
51+
52+
allOf:
53+
- if:
54+
properties:
55+
compatible:
56+
contains:
57+
const: ti,am64-elm
58+
then:
59+
required:
60+
- clocks
61+
- clock-names
62+
- power-domains
63+
64+
additionalProperties: false
65+
66+
examples:
67+
- |
68+
elm: ecc@0 {
69+
compatible = "ti,am3352-elm";
70+
reg = <0x0 0x2000>;
71+
interrupts = <4>;
72+
};

drivers/mtd/nand/Kconfig

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,14 @@ config MTD_NAND_ECC_MXIC
5353
help
5454
This enables support for the hardware ECC engine from Macronix.
5555

56+
config MTD_NAND_ECC_MEDIATEK
57+
tristate "Mediatek hardware ECC engine"
58+
depends on HAS_IOMEM
59+
depends on ARCH_MEDIATEK || COMPILE_TEST
60+
select MTD_NAND_ECC
61+
help
62+
This enables support for the hardware ECC engine from Mediatek.
63+
5664
endmenu
5765

5866
endmenu

drivers/mtd/nand/Makefile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
nandcore-objs := core.o bbt.o
44
obj-$(CONFIG_MTD_NAND_CORE) += nandcore.o
5+
obj-$(CONFIG_MTD_NAND_ECC_MEDIATEK) += ecc-mtk.o
56

67
obj-y += onenand/
78
obj-y += raw/
Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,7 @@
1515
#include <linux/of.h>
1616
#include <linux/of_platform.h>
1717
#include <linux/mutex.h>
18-
19-
#include "mtk_ecc.h"
18+
#include <linux/mtd/nand-ecc-mtk.h>
2019

2120
#define ECC_IDLE_MASK BIT(0)
2221
#define ECC_IRQ_EN BIT(0)
@@ -279,7 +278,10 @@ struct mtk_ecc *of_mtk_ecc_get(struct device_node *of_node)
279278
struct mtk_ecc *ecc = NULL;
280279
struct device_node *np;
281280

282-
np = of_parse_phandle(of_node, "ecc-engine", 0);
281+
np = of_parse_phandle(of_node, "nand-ecc-engine", 0);
282+
/* for backward compatibility */
283+
if (!np)
284+
np = of_parse_phandle(of_node, "ecc-engine", 0);
283285
if (np) {
284286
ecc = mtk_ecc_get(np);
285287
of_node_put(np);

drivers/mtd/nand/raw/Kconfig

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -374,6 +374,7 @@ config MTD_NAND_QCOM
374374

375375
config MTD_NAND_MTK
376376
tristate "MTK NAND controller"
377+
depends on MTD_NAND_ECC_MEDIATEK
377378
depends on ARCH_MEDIATEK || COMPILE_TEST
378379
depends on HAS_IOMEM
379380
help

drivers/mtd/nand/raw/Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ obj-$(CONFIG_MTD_NAND_SUNXI) += sunxi_nand.o
4848
obj-$(CONFIG_MTD_NAND_HISI504) += hisi504_nand.o
4949
obj-$(CONFIG_MTD_NAND_BRCMNAND) += brcmnand/
5050
obj-$(CONFIG_MTD_NAND_QCOM) += qcom_nandc.o
51-
obj-$(CONFIG_MTD_NAND_MTK) += mtk_ecc.o mtk_nand.o
51+
obj-$(CONFIG_MTD_NAND_MTK) += mtk_nand.o
5252
obj-$(CONFIG_MTD_NAND_MXIC) += mxic_nand.o
5353
obj-$(CONFIG_MTD_NAND_TEGRA) += tegra_nand.o
5454
obj-$(CONFIG_MTD_NAND_STM32_FMC2) += stm32_fmc2_nand.o

drivers/mtd/nand/raw/cadence-nand-controller.c

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2983,11 +2983,10 @@ static int cadence_nand_dt_probe(struct platform_device *ofdev)
29832983
if (IS_ERR(cdns_ctrl->reg))
29842984
return PTR_ERR(cdns_ctrl->reg);
29852985

2986-
res = platform_get_resource(ofdev, IORESOURCE_MEM, 1);
2987-
cdns_ctrl->io.dma = res->start;
2988-
cdns_ctrl->io.virt = devm_ioremap_resource(&ofdev->dev, res);
2986+
cdns_ctrl->io.virt = devm_platform_get_and_ioremap_resource(ofdev, 1, &res);
29892987
if (IS_ERR(cdns_ctrl->io.virt))
29902988
return PTR_ERR(cdns_ctrl->io.virt);
2989+
cdns_ctrl->io.dma = res->start;
29912990

29922991
dt->clk = devm_clk_get(cdns_ctrl->dev, "nf_clk");
29932992
if (IS_ERR(dt->clk))

drivers/mtd/nand/raw/cs553x_nand.c

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -104,17 +104,12 @@ static int cs553x_write_ctrl_byte(struct cs553x_nand_controller *cs553x,
104104
u32 ctl, u8 data)
105105
{
106106
u8 status;
107-
int ret;
108107

109108
writeb(ctl, cs553x->mmio + MM_NAND_CTL);
110109
writeb(data, cs553x->mmio + MM_NAND_IO);
111-
ret = readb_poll_timeout_atomic(cs553x->mmio + MM_NAND_STS, status,
110+
return readb_poll_timeout_atomic(cs553x->mmio + MM_NAND_STS, status,
112111
!(status & CS_NAND_CTLR_BUSY), 1,
113112
100000);
114-
if (ret)
115-
return ret;
116-
117-
return 0;
118113
}
119114

120115
static void cs553x_data_in(struct cs553x_nand_controller *cs553x, void *buf,

0 commit comments

Comments
 (0)