Skip to content

Commit 78a0b13

Browse files
committed
Merge tag 'nand/for-6.11' into mtd/next
Raw NAND changes; The Freescale MXC driver has been converted to the newer ->exec_op() interface. The meson driver now supports handling the boot ROM area with very specific ECC needs. Support for the iMX8QXP has been added to the GPMI driver. The lpx32xx driver now can get the DMA channels using DT entries. The Qcom binding has been improved to be more future proof by Rob. And then there is the usual load of misc and minor changes. SPI-NAND changes: The Macronix vendor driver has been improved to support an extended ID to avoid conflicting with older devices after an ID reuse issue. Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com>
2 parents b93f410 + a503f91 commit 78a0b13

File tree

12 files changed

+565
-452
lines changed

12 files changed

+565
-452
lines changed

Documentation/devicetree/bindings/mtd/amlogic,meson-nand.yaml

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,11 +64,29 @@ patternProperties:
6464
items:
6565
maximum: 0
6666

67+
amlogic,boot-pages:
68+
$ref: /schemas/types.yaml#/definitions/uint32
69+
description:
70+
Number of pages starting from offset 0, where a special ECC
71+
configuration must be used because it is accessed by the ROM
72+
code. This ECC configuration uses 384 bytes data blocks.
73+
Also scrambling mode is enabled for such pages.
74+
75+
amlogic,boot-page-step:
76+
$ref: /schemas/types.yaml#/definitions/uint32
77+
description:
78+
Interval between pages, accessed by the ROM code. For example
79+
we have 8 pages [0, 7]. Pages 0,2,4,6 are accessed by the
80+
ROM code, so this field will be 2 (e.g. every 2nd page). Rest
81+
of pages - 1,3,5,7 are read/written without this mode.
82+
6783
unevaluatedProperties: false
6884

6985
dependencies:
7086
nand-ecc-strength: [nand-ecc-step-size]
7187
nand-ecc-step-size: [nand-ecc-strength]
88+
amlogic,boot-pages: [nand-is-boot-medium, "amlogic,boot-page-step"]
89+
amlogic,boot-page-step: [nand-is-boot-medium, "amlogic,boot-pages"]
7290

7391

7492
required:

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

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ properties:
2424
- fsl,imx6q-gpmi-nand
2525
- fsl,imx6sx-gpmi-nand
2626
- fsl,imx7d-gpmi-nand
27+
- fsl,imx8qxp-gpmi-nand
2728
- items:
2829
- enum:
2930
- fsl,imx8mm-gpmi-nand
@@ -151,6 +152,27 @@ allOf:
151152
- const: gpmi_io
152153
- const: gpmi_bch_apb
153154

155+
- if:
156+
properties:
157+
compatible:
158+
contains:
159+
enum:
160+
- fsl,imx8qxp-gpmi-nand
161+
then:
162+
properties:
163+
clocks:
164+
items:
165+
- description: SoC gpmi io clock
166+
- description: SoC gpmi apb clock
167+
- description: SoC gpmi bch clock
168+
- description: SoC gpmi bch apb clock
169+
clock-names:
170+
items:
171+
- const: gpmi_io
172+
- const: gpmi_apb
173+
- const: gpmi_bch
174+
- const: gpmi_bch_apb
175+
154176
examples:
155177
- |
156178
nand-controller@8000c000 {

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

Lines changed: 14 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,18 @@ properties:
3131
- const: core
3232
- const: aon
3333

34+
qcom,cmd-crci:
35+
$ref: /schemas/types.yaml#/definitions/uint32
36+
description:
37+
Must contain the ADM command type CRCI block instance number specified for
38+
the NAND controller on the given platform
39+
40+
qcom,data-crci:
41+
$ref: /schemas/types.yaml#/definitions/uint32
42+
description:
43+
Must contain the ADM data type CRCI block instance number specified for
44+
the NAND controller on the given platform
45+
3446
patternProperties:
3547
"^nand@[a-f0-9]$":
3648
type: object
@@ -83,18 +95,6 @@ allOf:
8395
items:
8496
- const: rxtx
8597

86-
qcom,cmd-crci:
87-
$ref: /schemas/types.yaml#/definitions/uint32
88-
description:
89-
Must contain the ADM command type CRCI block instance number
90-
specified for the NAND controller on the given platform
91-
92-
qcom,data-crci:
93-
$ref: /schemas/types.yaml#/definitions/uint32
94-
description:
95-
Must contain the ADM data type CRCI block instance number
96-
specified for the NAND controller on the given platform
97-
9898
- if:
9999
properties:
100100
compatible:
@@ -119,19 +119,9 @@ allOf:
119119
- const: rx
120120
- const: cmd
121121

122-
- if:
123-
properties:
124-
compatible:
125-
contains:
126-
enum:
127-
- qcom,ipq806x-nand
122+
qcom,cmd-crci: false
123+
qcom,data-crci: false
128124

129-
then:
130-
patternProperties:
131-
"^nand@[a-f0-9]$":
132-
properties:
133-
qcom,boot-partitions: true
134-
else:
135125
patternProperties:
136126
"^nand@[a-f0-9]$":
137127
properties:

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

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -531,11 +531,6 @@ struct cdns_nand_chip {
531531
u8 cs[] __counted_by(nsels);
532532
};
533533

534-
struct ecc_info {
535-
int (*calc_ecc_bytes)(int step_size, int strength);
536-
int max_step_size;
537-
};
538-
539534
static inline struct
540535
cdns_nand_chip *to_cdns_nand_chip(struct nand_chip *chip)
541536
{

drivers/mtd/nand/raw/gpmi-nand/gpmi-nand.c

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -983,7 +983,7 @@ static int gpmi_setup_interface(struct nand_chip *chip, int chipnr,
983983
return PTR_ERR(sdr);
984984

985985
/* Only MX28/MX6 GPMI controller can reach EDO timings */
986-
if (sdr->tRC_min <= 25000 && !GPMI_IS_MX28(this) && !GPMI_IS_MX6(this))
986+
if (sdr->tRC_min <= 25000 && !this->devdata->support_edo_timing)
987987
return -ENOTSUPP;
988988

989989
/* Stop here if this call was just a check */
@@ -1142,6 +1142,7 @@ static const struct gpmi_devdata gpmi_devdata_imx28 = {
11421142
.type = IS_MX28,
11431143
.bch_max_ecc_strength = 20,
11441144
.max_chain_delay = 16000,
1145+
.support_edo_timing = true,
11451146
.clks = gpmi_clks_for_mx2x,
11461147
.clks_count = ARRAY_SIZE(gpmi_clks_for_mx2x),
11471148
};
@@ -1154,6 +1155,7 @@ static const struct gpmi_devdata gpmi_devdata_imx6q = {
11541155
.type = IS_MX6Q,
11551156
.bch_max_ecc_strength = 40,
11561157
.max_chain_delay = 12000,
1158+
.support_edo_timing = true,
11571159
.clks = gpmi_clks_for_mx6,
11581160
.clks_count = ARRAY_SIZE(gpmi_clks_for_mx6),
11591161
};
@@ -1162,6 +1164,7 @@ static const struct gpmi_devdata gpmi_devdata_imx6sx = {
11621164
.type = IS_MX6SX,
11631165
.bch_max_ecc_strength = 62,
11641166
.max_chain_delay = 12000,
1167+
.support_edo_timing = true,
11651168
.clks = gpmi_clks_for_mx6,
11661169
.clks_count = ARRAY_SIZE(gpmi_clks_for_mx6),
11671170
};
@@ -1174,10 +1177,24 @@ static const struct gpmi_devdata gpmi_devdata_imx7d = {
11741177
.type = IS_MX7D,
11751178
.bch_max_ecc_strength = 62,
11761179
.max_chain_delay = 12000,
1180+
.support_edo_timing = true,
11771181
.clks = gpmi_clks_for_mx7d,
11781182
.clks_count = ARRAY_SIZE(gpmi_clks_for_mx7d),
11791183
};
11801184

1185+
static const char *gpmi_clks_for_mx8qxp[GPMI_CLK_MAX] = {
1186+
"gpmi_io", "gpmi_apb", "gpmi_bch", "gpmi_bch_apb",
1187+
};
1188+
1189+
static const struct gpmi_devdata gpmi_devdata_imx8qxp = {
1190+
.type = IS_MX8QXP,
1191+
.bch_max_ecc_strength = 62,
1192+
.max_chain_delay = 12000,
1193+
.support_edo_timing = true,
1194+
.clks = gpmi_clks_for_mx8qxp,
1195+
.clks_count = ARRAY_SIZE(gpmi_clks_for_mx8qxp),
1196+
};
1197+
11811198
static int acquire_register_block(struct gpmi_nand_data *this,
11821199
const char *res_name)
11831200
{
@@ -2721,6 +2738,7 @@ static const struct of_device_id gpmi_nand_id_table[] = {
27212738
{ .compatible = "fsl,imx6q-gpmi-nand", .data = &gpmi_devdata_imx6q, },
27222739
{ .compatible = "fsl,imx6sx-gpmi-nand", .data = &gpmi_devdata_imx6sx, },
27232740
{ .compatible = "fsl,imx7d-gpmi-nand", .data = &gpmi_devdata_imx7d,},
2741+
{ .compatible = "fsl,imx8qxp-gpmi-nand", .data = &gpmi_devdata_imx8qxp, },
27242742
{}
27252743
};
27262744
MODULE_DEVICE_TABLE(of, gpmi_nand_id_table);

drivers/mtd/nand/raw/gpmi-nand/gpmi-nand.h

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,7 @@ enum gpmi_type {
7878
IS_MX6Q,
7979
IS_MX6SX,
8080
IS_MX7D,
81+
IS_MX8QXP,
8182
};
8283

8384
struct gpmi_devdata {
@@ -86,6 +87,7 @@ struct gpmi_devdata {
8687
int max_chain_delay; /* See the SDR EDO mode */
8788
const char * const *clks;
8889
const int clks_count;
90+
bool support_edo_timing;
8991
};
9092

9193
/**
@@ -172,8 +174,10 @@ struct gpmi_nand_data {
172174
#define GPMI_IS_MX6Q(x) ((x)->devdata->type == IS_MX6Q)
173175
#define GPMI_IS_MX6SX(x) ((x)->devdata->type == IS_MX6SX)
174176
#define GPMI_IS_MX7D(x) ((x)->devdata->type == IS_MX7D)
177+
#define GPMI_IS_MX8QXP(x) ((x)->devdata->type == IS_MX8QXP)
175178

176179
#define GPMI_IS_MX6(x) (GPMI_IS_MX6Q(x) || GPMI_IS_MX6SX(x) || \
177-
GPMI_IS_MX7D(x))
180+
GPMI_IS_MX7D(x) || GPMI_IS_MX8QXP(x))
181+
178182
#define GPMI_IS_MXS(x) (GPMI_IS_MX23(x) || GPMI_IS_MX28(x))
179183
#endif

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -295,7 +295,7 @@ static int ebu_dma_start(struct ebu_nand_controller *ebu_host, u32 dir,
295295
unsigned long flags = DMA_CTRL_ACK | DMA_PREP_INTERRUPT;
296296
dma_addr_t buf_dma;
297297
int ret;
298-
u32 timeout;
298+
unsigned long time_left;
299299

300300
if (dir == DMA_DEV_TO_MEM) {
301301
chan = ebu_host->dma_rx;
@@ -335,8 +335,8 @@ static int ebu_dma_start(struct ebu_nand_controller *ebu_host, u32 dir,
335335
dma_async_issue_pending(chan);
336336

337337
/* Wait DMA to finish the data transfer.*/
338-
timeout = wait_for_completion_timeout(dma_completion, msecs_to_jiffies(1000));
339-
if (!timeout) {
338+
time_left = wait_for_completion_timeout(dma_completion, msecs_to_jiffies(1000));
339+
if (!time_left) {
340340
dev_err(ebu_host->dev, "I/O Error in DMA RX (status %d)\n",
341341
dmaengine_tx_status(chan, cookie, NULL));
342342
dmaengine_terminate_sync(chan);

drivers/mtd/nand/raw/lpc32xx_mlc.c

Lines changed: 15 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -574,18 +574,22 @@ static int lpc32xx_dma_setup(struct lpc32xx_nand_host *host)
574574
struct mtd_info *mtd = nand_to_mtd(&host->nand_chip);
575575
dma_cap_mask_t mask;
576576

577-
if (!host->pdata || !host->pdata->dma_filter) {
578-
dev_err(mtd->dev.parent, "no DMA platform data\n");
579-
return -ENOENT;
580-
}
577+
host->dma_chan = dma_request_chan(mtd->dev.parent, "rx-tx");
578+
if (IS_ERR(host->dma_chan)) {
579+
/* fallback to request using platform data */
580+
if (!host->pdata || !host->pdata->dma_filter) {
581+
dev_err(mtd->dev.parent, "no DMA platform data\n");
582+
return -ENOENT;
583+
}
581584

582-
dma_cap_zero(mask);
583-
dma_cap_set(DMA_SLAVE, mask);
584-
host->dma_chan = dma_request_channel(mask, host->pdata->dma_filter,
585-
"nand-mlc");
586-
if (!host->dma_chan) {
587-
dev_err(mtd->dev.parent, "Failed to request DMA channel\n");
588-
return -EBUSY;
585+
dma_cap_zero(mask);
586+
dma_cap_set(DMA_SLAVE, mask);
587+
host->dma_chan = dma_request_channel(mask, host->pdata->dma_filter, "nand-mlc");
588+
589+
if (!host->dma_chan) {
590+
dev_err(mtd->dev.parent, "Failed to request DMA channel\n");
591+
return -EBUSY;
592+
}
589593
}
590594

591595
/*

drivers/mtd/nand/raw/lpc32xx_slc.c

Lines changed: 15 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -721,18 +721,22 @@ static int lpc32xx_nand_dma_setup(struct lpc32xx_nand_host *host)
721721
struct mtd_info *mtd = nand_to_mtd(&host->nand_chip);
722722
dma_cap_mask_t mask;
723723

724-
if (!host->pdata || !host->pdata->dma_filter) {
725-
dev_err(mtd->dev.parent, "no DMA platform data\n");
726-
return -ENOENT;
727-
}
724+
host->dma_chan = dma_request_chan(mtd->dev.parent, "rx-tx");
725+
if (IS_ERR(host->dma_chan)) {
726+
/* fallback to request using platform data */
727+
if (!host->pdata || !host->pdata->dma_filter) {
728+
dev_err(mtd->dev.parent, "no DMA platform data\n");
729+
return -ENOENT;
730+
}
728731

729-
dma_cap_zero(mask);
730-
dma_cap_set(DMA_SLAVE, mask);
731-
host->dma_chan = dma_request_channel(mask, host->pdata->dma_filter,
732-
"nand-slc");
733-
if (!host->dma_chan) {
734-
dev_err(mtd->dev.parent, "Failed to request DMA channel\n");
735-
return -EBUSY;
732+
dma_cap_zero(mask);
733+
dma_cap_set(DMA_SLAVE, mask);
734+
host->dma_chan = dma_request_channel(mask, host->pdata->dma_filter, "nand-slc");
735+
736+
if (!host->dma_chan) {
737+
dev_err(mtd->dev.parent, "Failed to request DMA channel\n");
738+
return -EBUSY;
739+
}
736740
}
737741

738742
return 0;

0 commit comments

Comments
 (0)