Skip to content

Commit 6ac5131

Browse files
committed
Merge tag 'mtd/fixes-for-7.0-rc5' of git://git.kernel.org/pub/scm/linux/kernel/git/mtd/linux
Pull MTD fixes from Miquel Raynal: - In SPI NOR, there was an issue with the RDCR capability, leading to several platforms no longer capable of using it for wrong reasons (the follow-up commit renames the helper to avoid future confusion) - NAND controller drivers needed to be improved to fix some timings, a locking schenario and avoid certain operations during panic writes - The Spear600 DT binding conversion was done partially, leading to several warnings which have individually been fixed - Tudor gets replaced by Takahiro for the SPI NOR maintainance - Plus two more misc fixes * tag 'mtd/fixes-for-7.0-rc5' of git://git.kernel.org/pub/scm/linux/kernel/git/mtd/linux: mtd: rawnand: pl353: make sure optimal timings are applied mtd: spi-nor: Rename spi_nor_spimem_check_op() mtd: spi-nor: Fix RDCR controller capability core check mtd: rawnand: brcmnand: skip DMA during panic write mtd: rawnand: serialize lock/unlock against other NAND operations dt-bindings: mtd: st,spear600-smi: Fix example dt-bindings: mtd: st,spear600-smi: #address/size-cells is mandatory dt-bindings: mtd: st,spear600-smi: Fix description mtd: rawnand: cadence: Fix error check for dma_alloc_coherent() in cadence_nand_init() mtd: Avoid boot crash in RedBoot partition table parser MAINTAINERS: add Takahiro Kuwano as SPI NOR reviewer MAINTAINERS: remove Tudor Ambarus as SPI NOR maintainer
2 parents 47e231c + b9465b0 commit 6ac5131

8 files changed

Lines changed: 48 additions & 25 deletions

File tree

Documentation/devicetree/bindings/mtd/st,spear600-smi.yaml

Lines changed: 19 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,6 @@ description:
1919
Flash sub nodes describe the memory range and optional per-flash
2020
properties.
2121

22-
allOf:
23-
- $ref: mtd.yaml#
24-
2522
properties:
2623
compatible:
2724
const: st,spear600-smi
@@ -42,14 +39,29 @@ properties:
4239
$ref: /schemas/types.yaml#/definitions/uint32
4340
description: Functional clock rate of the SMI controller in Hz.
4441

45-
st,smi-fast-mode:
46-
type: boolean
47-
description: Indicates that the attached flash supports fast read mode.
42+
patternProperties:
43+
"^flash@.*$":
44+
$ref: /schemas/mtd/mtd.yaml#
45+
46+
properties:
47+
reg:
48+
maxItems: 1
49+
50+
st,smi-fast-mode:
51+
type: boolean
52+
description: Indicates that the attached flash supports fast read mode.
53+
54+
unevaluatedProperties: false
55+
56+
required:
57+
- reg
4858

4959
required:
5060
- compatible
5161
- reg
5262
- clock-rate
63+
- "#address-cells"
64+
- "#size-cells"
5365

5466
unevaluatedProperties: false
5567

@@ -64,7 +76,7 @@ examples:
6476
interrupts = <12>;
6577
clock-rate = <50000000>; /* 50 MHz */
6678
67-
flash@f8000000 {
79+
flash@fc000000 {
6880
reg = <0xfc000000 0x1000>;
6981
st,smi-fast-mode;
7082
};

MAINTAINERS

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24902,9 +24902,9 @@ F: drivers/clk/spear/
2490224902
F: drivers/pinctrl/spear/
2490324903

2490424904
SPI NOR SUBSYSTEM
24905-
M: Tudor Ambarus <tudor.ambarus@linaro.org>
2490624905
M: Pratyush Yadav <pratyush@kernel.org>
2490724906
M: Michael Walle <mwalle@kernel.org>
24907+
R: Takahiro Kuwano <takahiro.kuwano@infineon.com>
2490824908
L: linux-mtd@lists.infradead.org
2490924909
S: Maintained
2491024910
W: http://www.linux-mtd.infradead.org/

drivers/mtd/nand/raw/brcmnand/brcmnand.c

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2350,14 +2350,12 @@ static int brcmnand_write(struct mtd_info *mtd, struct nand_chip *chip,
23502350
for (i = 0; i < ctrl->max_oob; i += 4)
23512351
oob_reg_write(ctrl, i, 0xffffffff);
23522352

2353-
if (mtd->oops_panic_write)
2353+
if (mtd->oops_panic_write) {
23542354
/* switch to interrupt polling and PIO mode */
23552355
disable_ctrl_irqs(ctrl);
2356-
2357-
if (use_dma(ctrl) && (has_edu(ctrl) || !oob) && flash_dma_buf_ok(buf)) {
2356+
} else if (use_dma(ctrl) && (has_edu(ctrl) || !oob) && flash_dma_buf_ok(buf)) {
23582357
if (ctrl->dma_trans(host, addr, (u32 *)buf, oob, mtd->writesize,
23592358
CMD_PROGRAM_PAGE))
2360-
23612359
ret = -EIO;
23622360

23632361
goto out;

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3133,7 +3133,7 @@ static int cadence_nand_init(struct cdns_nand_ctrl *cdns_ctrl)
31333133
sizeof(*cdns_ctrl->cdma_desc),
31343134
&cdns_ctrl->dma_cdma_desc,
31353135
GFP_KERNEL);
3136-
if (!cdns_ctrl->dma_cdma_desc)
3136+
if (!cdns_ctrl->cdma_desc)
31373137
return -ENOMEM;
31383138

31393139
cdns_ctrl->buf_size = SZ_16K;

drivers/mtd/nand/raw/nand_base.c

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4737,11 +4737,16 @@ static void nand_shutdown(struct mtd_info *mtd)
47374737
static int nand_lock(struct mtd_info *mtd, loff_t ofs, uint64_t len)
47384738
{
47394739
struct nand_chip *chip = mtd_to_nand(mtd);
4740+
int ret;
47404741

47414742
if (!chip->ops.lock_area)
47424743
return -ENOTSUPP;
47434744

4744-
return chip->ops.lock_area(chip, ofs, len);
4745+
nand_get_device(chip);
4746+
ret = chip->ops.lock_area(chip, ofs, len);
4747+
nand_release_device(chip);
4748+
4749+
return ret;
47454750
}
47464751

47474752
/**
@@ -4753,11 +4758,16 @@ static int nand_lock(struct mtd_info *mtd, loff_t ofs, uint64_t len)
47534758
static int nand_unlock(struct mtd_info *mtd, loff_t ofs, uint64_t len)
47544759
{
47554760
struct nand_chip *chip = mtd_to_nand(mtd);
4761+
int ret;
47564762

47574763
if (!chip->ops.unlock_area)
47584764
return -ENOTSUPP;
47594765

4760-
return chip->ops.unlock_area(chip, ofs, len);
4766+
nand_get_device(chip);
4767+
ret = chip->ops.unlock_area(chip, ofs, len);
4768+
nand_release_device(chip);
4769+
4770+
return ret;
47614771
}
47624772

47634773
/* Set default functions */

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

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -862,6 +862,9 @@ static int pl35x_nfc_setup_interface(struct nand_chip *chip, int cs,
862862
PL35X_SMC_NAND_TAR_CYCLES(tmgs.t_ar) |
863863
PL35X_SMC_NAND_TRR_CYCLES(tmgs.t_rr);
864864

865+
writel(plnand->timings, nfc->conf_regs + PL35X_SMC_CYCLES);
866+
pl35x_smc_update_regs(nfc);
867+
865868
return 0;
866869
}
867870

drivers/mtd/parsers/redboot.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -270,9 +270,9 @@ static int parse_redboot_partitions(struct mtd_info *master,
270270

271271
strcpy(names, fl->img->name);
272272
#ifdef CONFIG_MTD_REDBOOT_PARTS_READONLY
273-
if (!memcmp(names, "RedBoot", 8) ||
274-
!memcmp(names, "RedBoot config", 15) ||
275-
!memcmp(names, "FIS directory", 14)) {
273+
if (!strcmp(names, "RedBoot") ||
274+
!strcmp(names, "RedBoot config") ||
275+
!strcmp(names, "FIS directory")) {
276276
parts[i].mask_flags = MTD_WRITEABLE;
277277
}
278278
#endif

drivers/mtd/spi-nor/core.c

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2345,15 +2345,15 @@ int spi_nor_hwcaps_pp2cmd(u32 hwcaps)
23452345
}
23462346

23472347
/**
2348-
* spi_nor_spimem_check_op - check if the operation is supported
2349-
* by controller
2348+
* spi_nor_spimem_check_read_pp_op - check if a read or a page program operation is
2349+
* supported by controller
23502350
*@nor: pointer to a 'struct spi_nor'
23512351
*@op: pointer to op template to be checked
23522352
*
23532353
* Returns 0 if operation is supported, -EOPNOTSUPP otherwise.
23542354
*/
2355-
static int spi_nor_spimem_check_op(struct spi_nor *nor,
2356-
struct spi_mem_op *op)
2355+
static int spi_nor_spimem_check_read_pp_op(struct spi_nor *nor,
2356+
struct spi_mem_op *op)
23572357
{
23582358
/*
23592359
* First test with 4 address bytes. The opcode itself might
@@ -2396,7 +2396,7 @@ static int spi_nor_spimem_check_readop(struct spi_nor *nor,
23962396
if (spi_nor_protocol_is_dtr(nor->read_proto))
23972397
op.dummy.nbytes *= 2;
23982398

2399-
return spi_nor_spimem_check_op(nor, &op);
2399+
return spi_nor_spimem_check_read_pp_op(nor, &op);
24002400
}
24012401

24022402
/**
@@ -2414,7 +2414,7 @@ static int spi_nor_spimem_check_pp(struct spi_nor *nor,
24142414

24152415
spi_nor_spimem_setup_op(nor, &op, pp->proto);
24162416

2417-
return spi_nor_spimem_check_op(nor, &op);
2417+
return spi_nor_spimem_check_read_pp_op(nor, &op);
24182418
}
24192419

24202420
/**
@@ -2466,7 +2466,7 @@ spi_nor_spimem_adjust_hwcaps(struct spi_nor *nor, u32 *hwcaps)
24662466

24672467
spi_nor_spimem_setup_op(nor, &op, nor->reg_proto);
24682468

2469-
if (spi_nor_spimem_check_op(nor, &op))
2469+
if (!spi_mem_supports_op(nor->spimem, &op))
24702470
nor->flags |= SNOR_F_NO_READ_CR;
24712471
}
24722472
}

0 commit comments

Comments
 (0)