Skip to content

Commit bca20e6

Browse files
committed
Merge tag 'nand/for-5.16' into mtd/next
Core: * Remove obsolete macros only used by the old nand_ecclayout struct * MAINTAINERS: Add entry for Qualcomm NAND controller driver Raw NAND controller drivers: * Arasan: - Prevent an unsupported configuration * Xway, Socrates: plat_nand, Pasemi, Orion, mpc5121, GPIO, Au1550nd, AMS-Delta: - Keep the driver compatible with on-die ECC engines * cs553x, lpc32xx_slc, ndfc, sharpsl, tmio, txx9ndfmc: - Revert the commits: "Fix external use of SW Hamming ECC helper" - And let callers use the bare Hamming helpers * Fsmc: Fix use of SM ORDER * Intel: - Fix potential buffer overflow in probe * xway, vf610, txx9ndfm, tegra, stm32, plat_nand, oxnas, omap, mtk, hisi504, gpmi, gpio, denali, bcm6368, atmel: - Make use of the helper function devm_platform_ioremap_resource{,byname}() Onenand driver: * Samsung: Drop Exynos4 and describe driver in KConfig Raw NAND chip drivers: * Hynix: Add support for H27UCG8T2ETR-BC MLC NAND
2 parents c13de23 + fc9e18f commit bca20e6

36 files changed

+169
-149
lines changed

MAINTAINERS

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15571,6 +15571,14 @@ S: Maintained
1557115571
F: Documentation/devicetree/bindings/regulator/vqmmc-ipq4019-regulator.yaml
1557215572
F: drivers/regulator/vqmmc-ipq4019-regulator.c
1557315573

15574+
QUALCOMM NAND CONTROLLER DRIVER
15575+
M: Manivannan Sadhasivam <[email protected]>
15576+
15577+
15578+
S: Maintained
15579+
F: Documentation/devicetree/bindings/mtd/qcom,nandc.yaml
15580+
F: drivers/mtd/nand/raw/qcom_nandc.c
15581+
1557415582
QUALCOMM RMNET DRIVER
1557515583
M: Subash Abhinov Kasiviswanathan <[email protected]>
1557615584
M: Sean Tranchetti <[email protected]>

drivers/mtd/nand/ecc-sw-hamming.c

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -364,9 +364,9 @@ int nand_ecc_sw_hamming_calculate(struct nand_device *nand,
364364
{
365365
struct nand_ecc_sw_hamming_conf *engine_conf = nand->ecc.ctx.priv;
366366
unsigned int step_size = nand->ecc.ctx.conf.step_size;
367+
bool sm_order = engine_conf ? engine_conf->sm_order : false;
367368

368-
return ecc_sw_hamming_calculate(buf, step_size, code,
369-
engine_conf->sm_order);
369+
return ecc_sw_hamming_calculate(buf, step_size, code, sm_order);
370370
}
371371
EXPORT_SYMBOL(nand_ecc_sw_hamming_calculate);
372372

@@ -457,9 +457,10 @@ int nand_ecc_sw_hamming_correct(struct nand_device *nand, unsigned char *buf,
457457
{
458458
struct nand_ecc_sw_hamming_conf *engine_conf = nand->ecc.ctx.priv;
459459
unsigned int step_size = nand->ecc.ctx.conf.step_size;
460+
bool sm_order = engine_conf ? engine_conf->sm_order : false;
460461

461462
return ecc_sw_hamming_correct(buf, read_ecc, calc_ecc, step_size,
462-
engine_conf->sm_order);
463+
sm_order);
463464
}
464465
EXPORT_SYMBOL(nand_ecc_sw_hamming_correct);
465466

drivers/mtd/nand/onenand/Kconfig

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -33,11 +33,12 @@ config MTD_ONENAND_OMAP2
3333

3434
config MTD_ONENAND_SAMSUNG
3535
tristate "OneNAND on Samsung SOC controller support"
36-
depends on ARCH_S3C64XX || ARCH_S5PV210 || ARCH_EXYNOS4 || COMPILE_TEST
36+
depends on ARCH_S3C64XX || ARCH_S5PV210 || COMPILE_TEST
3737
help
38-
Support for a OneNAND flash device connected to an Samsung SOC.
39-
S3C64XX uses command mapping method.
40-
S5PC110/S5PC210 use generic OneNAND method.
38+
Support for a OneNAND flash device connected to Samsung S3C64XX
39+
(using command mapping method) and S5PC110/S5PC210 (using generic
40+
OneNAND method) SoCs.
41+
Choose Y here only if you build for such Samsung SoC.
4142

4243
config MTD_ONENAND_OTP
4344
bool "OneNAND OTP Support"

drivers/mtd/nand/raw/ams-delta.c

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -217,9 +217,8 @@ static int gpio_nand_setup_interface(struct nand_chip *this, int csline,
217217

218218
static int gpio_nand_attach_chip(struct nand_chip *chip)
219219
{
220-
chip->ecc.engine_type = NAND_ECC_ENGINE_TYPE_SOFT;
221-
222-
if (chip->ecc.algo == NAND_ECC_ALGO_UNKNOWN)
220+
if (chip->ecc.engine_type == NAND_ECC_ENGINE_TYPE_SOFT &&
221+
chip->ecc.algo == NAND_ECC_ALGO_UNKNOWN)
223222
chip->ecc.algo = NAND_ECC_ALGO_HAMMING;
224223

225224
return 0;
@@ -370,6 +369,13 @@ static int gpio_nand_probe(struct platform_device *pdev)
370369
/* Release write protection */
371370
gpiod_set_value(priv->gpiod_nwp, 0);
372371

372+
/*
373+
* This driver assumes that the default ECC engine should be TYPE_SOFT.
374+
* Set ->engine_type before registering the NAND devices in order to
375+
* provide a driver specific default value.
376+
*/
377+
this->ecc.engine_type = NAND_ECC_ENGINE_TYPE_SOFT;
378+
373379
/* Scan to find existence of the device */
374380
err = nand_scan(this, 1);
375381
if (err)

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

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -973,6 +973,21 @@ static int anfc_setup_interface(struct nand_chip *chip, int target,
973973
nvddr = nand_get_nvddr_timings(conf);
974974
if (IS_ERR(nvddr))
975975
return PTR_ERR(nvddr);
976+
977+
/*
978+
* The controller only supports data payload requests which are
979+
* a multiple of 4. In practice, most data accesses are 4-byte
980+
* aligned and this is not an issue. However, rounding up will
981+
* simply be refused by the controller if we reached the end of
982+
* the device *and* we are using the NV-DDR interface(!). In
983+
* this situation, unaligned data requests ending at the device
984+
* boundary will confuse the controller and cannot be performed.
985+
*
986+
* This is something that happens in nand_read_subpage() when
987+
* selecting software ECC support and must be avoided.
988+
*/
989+
if (chip->ecc.engine_type == NAND_ECC_ENGINE_TYPE_SOFT)
990+
return -ENOTSUPP;
976991
} else {
977992
sdr = nand_get_sdr_timings(conf);
978993
if (IS_ERR(sdr))

drivers/mtd/nand/raw/atmel/pmecc.c

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -834,7 +834,6 @@ static struct atmel_pmecc *atmel_pmecc_create(struct platform_device *pdev,
834834
{
835835
struct device *dev = &pdev->dev;
836836
struct atmel_pmecc *pmecc;
837-
struct resource *res;
838837

839838
pmecc = devm_kzalloc(dev, sizeof(*pmecc), GFP_KERNEL);
840839
if (!pmecc)
@@ -844,13 +843,11 @@ static struct atmel_pmecc *atmel_pmecc_create(struct platform_device *pdev,
844843
pmecc->dev = dev;
845844
mutex_init(&pmecc->lock);
846845

847-
res = platform_get_resource(pdev, IORESOURCE_MEM, pmecc_res_idx);
848-
pmecc->regs.base = devm_ioremap_resource(dev, res);
846+
pmecc->regs.base = devm_platform_ioremap_resource(pdev, pmecc_res_idx);
849847
if (IS_ERR(pmecc->regs.base))
850848
return ERR_CAST(pmecc->regs.base);
851849

852-
res = platform_get_resource(pdev, IORESOURCE_MEM, errloc_res_idx);
853-
pmecc->regs.errloc = devm_ioremap_resource(dev, res);
850+
pmecc->regs.errloc = devm_platform_ioremap_resource(pdev, errloc_res_idx);
854851
if (IS_ERR(pmecc->regs.errloc))
855852
return ERR_CAST(pmecc->regs.errloc);
856853

drivers/mtd/nand/raw/au1550nd.c

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -239,9 +239,8 @@ static int au1550nd_exec_op(struct nand_chip *this,
239239

240240
static int au1550nd_attach_chip(struct nand_chip *chip)
241241
{
242-
chip->ecc.engine_type = NAND_ECC_ENGINE_TYPE_SOFT;
243-
244-
if (chip->ecc.algo == NAND_ECC_ALGO_UNKNOWN)
242+
if (chip->ecc.engine_type == NAND_ECC_ENGINE_TYPE_SOFT &&
243+
chip->ecc.algo == NAND_ECC_ALGO_UNKNOWN)
245244
chip->ecc.algo = NAND_ECC_ALGO_HAMMING;
246245

247246
return 0;
@@ -310,6 +309,13 @@ static int au1550nd_probe(struct platform_device *pdev)
310309
if (pd->devwidth)
311310
this->options |= NAND_BUSWIDTH_16;
312311

312+
/*
313+
* This driver assumes that the default ECC engine should be TYPE_SOFT.
314+
* Set ->engine_type before registering the NAND devices in order to
315+
* provide a driver specific default value.
316+
*/
317+
this->ecc.engine_type = NAND_ECC_ENGINE_TYPE_SOFT;
318+
313319
ret = nand_scan(this, 1);
314320
if (ret) {
315321
dev_err(&pdev->dev, "NAND scan failed with %d\n", ret);

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

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -88,16 +88,13 @@ static int bcm6368_nand_probe(struct platform_device *pdev)
8888
struct device *dev = &pdev->dev;
8989
struct bcm6368_nand_soc *priv;
9090
struct brcmnand_soc *soc;
91-
struct resource *res;
9291

9392
priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL);
9493
if (!priv)
9594
return -ENOMEM;
9695
soc = &priv->soc;
9796

98-
res = platform_get_resource_byname(pdev,
99-
IORESOURCE_MEM, "nand-int-base");
100-
priv->base = devm_ioremap_resource(dev, res);
97+
priv->base = devm_platform_ioremap_resource_byname(pdev, "nand-int-base");
10198
if (IS_ERR(priv->base))
10299
return PTR_ERR(priv->base);
103100

drivers/mtd/nand/raw/cs553x_nand.c

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@
1818
#include <linux/module.h>
1919
#include <linux/delay.h>
2020
#include <linux/mtd/mtd.h>
21-
#include <linux/mtd/nand-ecc-sw-hamming.h>
2221
#include <linux/mtd/rawnand.h>
2322
#include <linux/mtd/partitions.h>
2423
#include <linux/iopoll.h>
@@ -241,15 +240,6 @@ static int cs_calculate_ecc(struct nand_chip *this, const u_char *dat,
241240
return 0;
242241
}
243242

244-
static int cs553x_ecc_correct(struct nand_chip *chip,
245-
unsigned char *buf,
246-
unsigned char *read_ecc,
247-
unsigned char *calc_ecc)
248-
{
249-
return ecc_sw_hamming_correct(buf, read_ecc, calc_ecc,
250-
chip->ecc.size, false);
251-
}
252-
253243
static struct cs553x_nand_controller *controllers[4];
254244

255245
static int cs553x_attach_chip(struct nand_chip *chip)
@@ -261,7 +251,7 @@ static int cs553x_attach_chip(struct nand_chip *chip)
261251
chip->ecc.bytes = 3;
262252
chip->ecc.hwctl = cs_enable_hwecc;
263253
chip->ecc.calculate = cs_calculate_ecc;
264-
chip->ecc.correct = cs553x_ecc_correct;
254+
chip->ecc.correct = rawnand_sw_hamming_correct;
265255
chip->ecc.strength = 1;
266256

267257
return 0;

drivers/mtd/nand/raw/denali_dt.c

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,6 @@ static int denali_dt_chip_init(struct denali_controller *denali,
113113
static int denali_dt_probe(struct platform_device *pdev)
114114
{
115115
struct device *dev = &pdev->dev;
116-
struct resource *res;
117116
struct denali_dt *dt;
118117
const struct denali_dt_data *data;
119118
struct denali_controller *denali;
@@ -139,13 +138,11 @@ static int denali_dt_probe(struct platform_device *pdev)
139138
if (denali->irq < 0)
140139
return denali->irq;
141140

142-
res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "denali_reg");
143-
denali->reg = devm_ioremap_resource(dev, res);
141+
denali->reg = devm_platform_ioremap_resource_byname(pdev, "denali_reg");
144142
if (IS_ERR(denali->reg))
145143
return PTR_ERR(denali->reg);
146144

147-
res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "nand_data");
148-
denali->host = devm_ioremap_resource(dev, res);
145+
denali->host = devm_platform_ioremap_resource_byname(pdev, "nand_data");
149146
if (IS_ERR(denali->host))
150147
return PTR_ERR(denali->host);
151148

0 commit comments

Comments
 (0)