Skip to content

Commit 9444775

Browse files
committed
Merge tag 'nand/for-6.13' into mtd/next
SPI-NAND changes: A load of fixes to Winbond manufacturer driver have been done, plus a structure constification. Raw NAND changes: The GPMI driver has been improved on the power management side. The Davinci driver has been cleaned up. A leak in the Atmel driver plus some typos in the core have been fixed.
2 parents 34267d3 + af264e5 commit 9444775

21 files changed

+139
-128
lines changed

MAINTAINERS

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9028,6 +9028,7 @@ F: drivers/net/ethernet/freescale/gianfar*
90289028

90299029
FREESCALE GPMI NAND DRIVER
90309030
M: Han Xu <[email protected]>
9031+
90319032
90329033
S: Maintained
90339034
F: drivers/mtd/nand/raw/gpmi-nand/*

drivers/mtd/nand/ecc-mxic.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -723,21 +723,21 @@ static int mxic_ecc_finish_io_req_pipelined(struct nand_device *nand,
723723
return ret;
724724
}
725725

726-
static struct nand_ecc_engine_ops mxic_ecc_engine_external_ops = {
726+
static const struct nand_ecc_engine_ops mxic_ecc_engine_external_ops = {
727727
.init_ctx = mxic_ecc_init_ctx_external,
728728
.cleanup_ctx = mxic_ecc_cleanup_ctx,
729729
.prepare_io_req = mxic_ecc_prepare_io_req_external,
730730
.finish_io_req = mxic_ecc_finish_io_req_external,
731731
};
732732

733-
static struct nand_ecc_engine_ops mxic_ecc_engine_pipelined_ops = {
733+
static const struct nand_ecc_engine_ops mxic_ecc_engine_pipelined_ops = {
734734
.init_ctx = mxic_ecc_init_ctx_pipelined,
735735
.cleanup_ctx = mxic_ecc_cleanup_ctx,
736736
.prepare_io_req = mxic_ecc_prepare_io_req_pipelined,
737737
.finish_io_req = mxic_ecc_finish_io_req_pipelined,
738738
};
739739

740-
struct nand_ecc_engine_ops *mxic_ecc_get_pipelined_ops(void)
740+
const struct nand_ecc_engine_ops *mxic_ecc_get_pipelined_ops(void)
741741
{
742742
return &mxic_ecc_engine_pipelined_ops;
743743
}

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -384,7 +384,7 @@ static int nand_ecc_sw_bch_finish_io_req(struct nand_device *nand,
384384
return max_bitflips;
385385
}
386386

387-
static struct nand_ecc_engine_ops nand_ecc_sw_bch_engine_ops = {
387+
static const struct nand_ecc_engine_ops nand_ecc_sw_bch_engine_ops = {
388388
.init_ctx = nand_ecc_sw_bch_init_ctx,
389389
.cleanup_ctx = nand_ecc_sw_bch_cleanup_ctx,
390390
.prepare_io_req = nand_ecc_sw_bch_prepare_io_req,

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -638,7 +638,7 @@ static int nand_ecc_sw_hamming_finish_io_req(struct nand_device *nand,
638638
return max_bitflips;
639639
}
640640

641-
static struct nand_ecc_engine_ops nand_ecc_sw_hamming_engine_ops = {
641+
static const struct nand_ecc_engine_ops nand_ecc_sw_hamming_engine_ops = {
642642
.init_ctx = nand_ecc_sw_hamming_init_ctx,
643643
.cleanup_ctx = nand_ecc_sw_hamming_cleanup_ctx,
644644
.prepare_io_req = nand_ecc_sw_hamming_prepare_io_req,

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

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -362,7 +362,7 @@ atmel_pmecc_create_user(struct atmel_pmecc *pmecc,
362362
size = ALIGN(size, sizeof(s32));
363363
size += (req->ecc.strength + 1) * sizeof(s32) * 3;
364364

365-
user = kzalloc(size, GFP_KERNEL);
365+
user = devm_kzalloc(pmecc->dev, size, GFP_KERNEL);
366366
if (!user)
367367
return ERR_PTR(-ENOMEM);
368368

@@ -408,12 +408,6 @@ atmel_pmecc_create_user(struct atmel_pmecc *pmecc,
408408
}
409409
EXPORT_SYMBOL_GPL(atmel_pmecc_create_user);
410410

411-
void atmel_pmecc_destroy_user(struct atmel_pmecc_user *user)
412-
{
413-
kfree(user);
414-
}
415-
EXPORT_SYMBOL_GPL(atmel_pmecc_destroy_user);
416-
417411
static int get_strength(struct atmel_pmecc_user *user)
418412
{
419413
const int *strengths = user->pmecc->caps->strengths;

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

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,8 +55,6 @@ struct atmel_pmecc *devm_atmel_pmecc_get(struct device *dev);
5555
struct atmel_pmecc_user *
5656
atmel_pmecc_create_user(struct atmel_pmecc *pmecc,
5757
struct atmel_pmecc_user_req *req);
58-
void atmel_pmecc_destroy_user(struct atmel_pmecc_user *user);
59-
6058
void atmel_pmecc_reset(struct atmel_pmecc *pmecc);
6159
int atmel_pmecc_enable(struct atmel_pmecc_user *user, int op);
6260
void atmel_pmecc_disable(struct atmel_pmecc_user *user);

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1561,7 +1561,7 @@ static int write_oob_to_regs(struct brcmnand_controller *ctrl, int i,
15611561
(oob[j + 2] << 8) |
15621562
(oob[j + 3] << 0));
15631563

1564-
/* handle the remaing bytes */
1564+
/* handle the remaining bytes */
15651565
while (j < tbytes)
15661566
plast[k++] = oob[j++];
15671567

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1891,7 +1891,7 @@ static int cadence_nand_read_buf(struct cdns_nand_ctrl *cdns_ctrl,
18911891

18921892
int len_in_words = (data_dma_width == 4) ? len >> 2 : len >> 3;
18931893

1894-
/* read alingment data */
1894+
/* read alignment data */
18951895
if (data_dma_width == 4)
18961896
ioread32_rep(cdns_ctrl->io.virt, buf, len_in_words);
18971897
#ifdef CONFIG_64BIT

drivers/mtd/nand/raw/cs553x_nand.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626

2727
#define NR_CS553X_CONTROLLERS 4
2828

29-
#define MSR_DIVIL_GLD_CAP 0x51400000 /* DIVIL capabilitiies */
29+
#define MSR_DIVIL_GLD_CAP 0x51400000 /* DIVIL capabilities */
3030
#define CAP_CS5535 0x2df000ULL
3131
#define CAP_CS5536 0x5df500ULL
3232

drivers/mtd/nand/raw/davinci_nand.c

Lines changed: 29 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -10,15 +10,15 @@
1010
* Dirk Behme <[email protected]>
1111
*/
1212

13-
#include <linux/kernel.h>
14-
#include <linux/module.h>
15-
#include <linux/platform_device.h>
1613
#include <linux/err.h>
1714
#include <linux/iopoll.h>
18-
#include <linux/mtd/rawnand.h>
15+
#include <linux/kernel.h>
16+
#include <linux/module.h>
1917
#include <linux/mtd/partitions.h>
18+
#include <linux/mtd/rawnand.h>
19+
#include <linux/platform_device.h>
20+
#include <linux/property.h>
2021
#include <linux/slab.h>
21-
#include <linux/of.h>
2222

2323
#define NRCSR_OFFSET 0x00
2424
#define NANDFCR_OFFSET 0x60
@@ -487,10 +487,10 @@ static const struct of_device_id davinci_nand_of_match[] = {
487487
};
488488
MODULE_DEVICE_TABLE(of, davinci_nand_of_match);
489489

490-
static struct davinci_nand_pdata
491-
*nand_davinci_get_pdata(struct platform_device *pdev)
490+
static struct davinci_nand_pdata *
491+
nand_davinci_get_pdata(struct platform_device *pdev)
492492
{
493-
if (!dev_get_platdata(&pdev->dev) && pdev->dev.of_node) {
493+
if (!dev_get_platdata(&pdev->dev)) {
494494
struct davinci_nand_pdata *pdata;
495495
const char *mode;
496496
u32 prop;
@@ -501,40 +501,42 @@ static struct davinci_nand_pdata
501501
pdev->dev.platform_data = pdata;
502502
if (!pdata)
503503
return ERR_PTR(-ENOMEM);
504-
if (!of_property_read_u32(pdev->dev.of_node,
505-
"ti,davinci-chipselect", &prop))
504+
if (!device_property_read_u32(&pdev->dev,
505+
"ti,davinci-chipselect", &prop))
506506
pdata->core_chipsel = prop;
507507
else
508508
return ERR_PTR(-EINVAL);
509509

510-
if (!of_property_read_u32(pdev->dev.of_node,
511-
"ti,davinci-mask-ale", &prop))
510+
if (!device_property_read_u32(&pdev->dev,
511+
"ti,davinci-mask-ale", &prop))
512512
pdata->mask_ale = prop;
513-
if (!of_property_read_u32(pdev->dev.of_node,
514-
"ti,davinci-mask-cle", &prop))
513+
if (!device_property_read_u32(&pdev->dev,
514+
"ti,davinci-mask-cle", &prop))
515515
pdata->mask_cle = prop;
516-
if (!of_property_read_u32(pdev->dev.of_node,
517-
"ti,davinci-mask-chipsel", &prop))
516+
if (!device_property_read_u32(&pdev->dev,
517+
"ti,davinci-mask-chipsel", &prop))
518518
pdata->mask_chipsel = prop;
519-
if (!of_property_read_string(pdev->dev.of_node,
520-
"ti,davinci-ecc-mode", &mode)) {
519+
if (!device_property_read_string(&pdev->dev,
520+
"ti,davinci-ecc-mode",
521+
&mode)) {
521522
if (!strncmp("none", mode, 4))
522523
pdata->engine_type = NAND_ECC_ENGINE_TYPE_NONE;
523524
if (!strncmp("soft", mode, 4))
524525
pdata->engine_type = NAND_ECC_ENGINE_TYPE_SOFT;
525526
if (!strncmp("hw", mode, 2))
526527
pdata->engine_type = NAND_ECC_ENGINE_TYPE_ON_HOST;
527528
}
528-
if (!of_property_read_u32(pdev->dev.of_node,
529-
"ti,davinci-ecc-bits", &prop))
529+
if (!device_property_read_u32(&pdev->dev,
530+
"ti,davinci-ecc-bits", &prop))
530531
pdata->ecc_bits = prop;
531532

532-
if (!of_property_read_u32(pdev->dev.of_node,
533-
"ti,davinci-nand-buswidth", &prop) && prop == 16)
533+
if (!device_property_read_u32(&pdev->dev,
534+
"ti,davinci-nand-buswidth",
535+
&prop) && prop == 16)
534536
pdata->options |= NAND_BUSWIDTH_16;
535537

536-
if (of_property_read_bool(pdev->dev.of_node,
537-
"ti,davinci-nand-use-bbt"))
538+
if (device_property_read_bool(&pdev->dev,
539+
"ti,davinci-nand-use-bbt"))
538540
pdata->bbt_options = NAND_BBT_USE_FLASH;
539541

540542
/*
@@ -548,17 +550,15 @@ static struct davinci_nand_pdata
548550
* then use "ti,davinci-nand" as the compatible in your
549551
* device-tree file.
550552
*/
551-
if (of_device_is_compatible(pdev->dev.of_node,
552-
"ti,keystone-nand")) {
553+
if (device_is_compatible(&pdev->dev, "ti,keystone-nand"))
553554
pdata->options |= NAND_NO_SUBPAGE_WRITE;
554-
}
555555
}
556556

557557
return dev_get_platdata(&pdev->dev);
558558
}
559559
#else
560-
static struct davinci_nand_pdata
561-
*nand_davinci_get_pdata(struct platform_device *pdev)
560+
static struct davinci_nand_pdata *
561+
nand_davinci_get_pdata(struct platform_device *pdev)
562562
{
563563
return dev_get_platdata(&pdev->dev);
564564
}

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

Lines changed: 35 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
#include <linux/of.h>
1616
#include <linux/platform_device.h>
1717
#include <linux/pm_runtime.h>
18+
#include <linux/pinctrl/consumer.h>
1819
#include <linux/dma/mxs-dma.h>
1920
#include "gpmi-nand.h"
2021
#include "gpmi-regs.h"
@@ -737,9 +738,8 @@ static int bch_set_geometry(struct gpmi_nand_data *this)
737738
if (ret)
738739
return ret;
739740

740-
ret = pm_runtime_get_sync(this->dev);
741+
ret = pm_runtime_resume_and_get(this->dev);
741742
if (ret < 0) {
742-
pm_runtime_put_autosuspend(this->dev);
743743
return ret;
744744
}
745745

@@ -2761,15 +2761,9 @@ static int gpmi_nand_probe(struct platform_device *pdev)
27612761
if (ret)
27622762
goto exit_acquire_resources;
27632763

2764-
ret = __gpmi_enable_clk(this, true);
2765-
if (ret)
2766-
goto exit_acquire_resources;
2767-
2764+
pm_runtime_enable(&pdev->dev);
27682765
pm_runtime_set_autosuspend_delay(&pdev->dev, 500);
27692766
pm_runtime_use_autosuspend(&pdev->dev);
2770-
pm_runtime_set_active(&pdev->dev);
2771-
pm_runtime_enable(&pdev->dev);
2772-
pm_runtime_get_sync(&pdev->dev);
27732767

27742768
ret = gpmi_init(this);
27752769
if (ret)
@@ -2779,15 +2773,12 @@ static int gpmi_nand_probe(struct platform_device *pdev)
27792773
if (ret)
27802774
goto exit_nfc_init;
27812775

2782-
pm_runtime_mark_last_busy(&pdev->dev);
2783-
pm_runtime_put_autosuspend(&pdev->dev);
2784-
27852776
dev_info(this->dev, "driver registered.\n");
27862777

27872778
return 0;
27882779

27892780
exit_nfc_init:
2790-
pm_runtime_put(&pdev->dev);
2781+
pm_runtime_dont_use_autosuspend(&pdev->dev);
27912782
pm_runtime_disable(&pdev->dev);
27922783
release_resources(this);
27932784
exit_acquire_resources:
@@ -2801,33 +2792,37 @@ static void gpmi_nand_remove(struct platform_device *pdev)
28012792
struct nand_chip *chip = &this->nand;
28022793
int ret;
28032794

2804-
pm_runtime_put_sync(&pdev->dev);
2805-
pm_runtime_disable(&pdev->dev);
2806-
28072795
ret = mtd_device_unregister(nand_to_mtd(chip));
28082796
WARN_ON(ret);
28092797
nand_cleanup(chip);
28102798
gpmi_free_dma_buffer(this);
28112799
release_resources(this);
2800+
pm_runtime_dont_use_autosuspend(&pdev->dev);
2801+
pm_runtime_disable(&pdev->dev);
28122802
}
28132803

2814-
#ifdef CONFIG_PM_SLEEP
28152804
static int gpmi_pm_suspend(struct device *dev)
28162805
{
2817-
struct gpmi_nand_data *this = dev_get_drvdata(dev);
2806+
int ret;
28182807

2819-
release_dma_channels(this);
2820-
return 0;
2808+
pinctrl_pm_select_sleep_state(dev);
2809+
ret = pm_runtime_force_suspend(dev);
2810+
2811+
return ret;
28212812
}
28222813

28232814
static int gpmi_pm_resume(struct device *dev)
28242815
{
28252816
struct gpmi_nand_data *this = dev_get_drvdata(dev);
28262817
int ret;
28272818

2828-
ret = acquire_dma_channels(this);
2829-
if (ret < 0)
2819+
ret = pm_runtime_force_resume(dev);
2820+
if (ret) {
2821+
dev_err(this->dev, "Error in resume %d\n", ret);
28302822
return ret;
2823+
}
2824+
2825+
pinctrl_pm_select_default_state(dev);
28312826

28322827
/* re-init the GPMI registers */
28332828
ret = gpmi_init(this);
@@ -2849,31 +2844,41 @@ static int gpmi_pm_resume(struct device *dev)
28492844

28502845
return 0;
28512846
}
2852-
#endif /* CONFIG_PM_SLEEP */
28532847

2854-
static int __maybe_unused gpmi_runtime_suspend(struct device *dev)
2848+
#define gpmi_enable_clk(x) __gpmi_enable_clk(x, true)
2849+
#define gpmi_disable_clk(x) __gpmi_enable_clk(x, false)
2850+
2851+
static int gpmi_runtime_suspend(struct device *dev)
28552852
{
28562853
struct gpmi_nand_data *this = dev_get_drvdata(dev);
28572854

2858-
return __gpmi_enable_clk(this, false);
2855+
gpmi_disable_clk(this);
2856+
2857+
return 0;
28592858
}
28602859

2861-
static int __maybe_unused gpmi_runtime_resume(struct device *dev)
2860+
static int gpmi_runtime_resume(struct device *dev)
28622861
{
28632862
struct gpmi_nand_data *this = dev_get_drvdata(dev);
2863+
int ret;
2864+
2865+
ret = gpmi_enable_clk(this);
2866+
if (ret)
2867+
return ret;
2868+
2869+
return 0;
28642870

2865-
return __gpmi_enable_clk(this, true);
28662871
}
28672872

28682873
static const struct dev_pm_ops gpmi_pm_ops = {
2869-
SET_SYSTEM_SLEEP_PM_OPS(gpmi_pm_suspend, gpmi_pm_resume)
2870-
SET_RUNTIME_PM_OPS(gpmi_runtime_suspend, gpmi_runtime_resume, NULL)
2874+
SYSTEM_SLEEP_PM_OPS(gpmi_pm_suspend, gpmi_pm_resume)
2875+
RUNTIME_PM_OPS(gpmi_runtime_suspend, gpmi_runtime_resume, NULL)
28712876
};
28722877

28732878
static struct platform_driver gpmi_nand_driver = {
28742879
.driver = {
28752880
.name = "gpmi-nand",
2876-
.pm = &gpmi_pm_ops,
2881+
.pm = pm_ptr(&gpmi_pm_ops),
28772882
.of_match_table = gpmi_nand_id_table,
28782883
},
28792884
.probe = gpmi_nand_probe,

drivers/mtd/nand/raw/nand_macronix.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@ static void macronix_nand_onfi_init(struct nand_chip *chip)
113113
rand_otp = of_property_read_bool(dn, "mxic,enable-randomizer-otp");
114114

115115
mxic = (struct nand_onfi_vendor_macronix *)p->onfi->vendor;
116-
/* Subpage write is prohibited in randomizer operatoin */
116+
/* Subpage write is prohibited in randomizer operation */
117117
if (rand_otp && chip->options & NAND_NO_SUBPAGE_WRITE &&
118118
mxic->reliability_func & MACRONIX_RANDOMIZER_BIT) {
119119
if (p->supports_set_get_features) {

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -187,7 +187,7 @@ static const struct mtd_ooblayout_ops pl35x_ecc_ooblayout16_ops = {
187187
.free = pl35x_ecc_ooblayout16_free,
188188
};
189189

190-
/* Generic flash bbt decriptors */
190+
/* Generic flash bbt descriptors */
191191
static u8 bbt_pattern[] = { 'B', 'b', 't', '0' };
192192
static u8 mirror_pattern[] = { '1', 't', 'b', 'B' };
193193

0 commit comments

Comments
 (0)