aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorRoland Stigge <stigge@antcom.de>2012-08-24 09:06:52 -0400
committerDavid Woodhouse <David.Woodhouse@intel.com>2012-09-29 10:12:49 -0400
commit62beee20b1a53ba633badc4b57c68d815c9f3e66 (patch)
tree55141ad2591f4ed9dc506071353a6f4930bc7260 /drivers
parent10594f67870e86aac361d75ee1e84535a33e1214 (diff)
mtd: lpc32xx_mlc: Cleanup after DT-only conversion
The LPC32xx's DT-only conversion of the MLC NAND driver makes NAND config via platform_data obsolete. Dropped by this patch. Further, the driver really needs CONFIG_OF, which is already reflected by the dependency on ARCH_LPC32XX which depends on CONFIG_OF. So also dropping CONFIG_OF ifdefs. There is still platform_data necessary to supply the dma_filter callback for the dma engine. This is a completely different data structure than the old platform_data for NAND config, so renaming some old "pdata" variable to "ncfg" to prevent confusion with the new platform data. Signed-off-by: Roland Stigge <stigge@antcom.de> Signed-off-by: Artem Bityutskiy <artem.bityutskiy@linux.intel.com> Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/mtd/nand/lpc32xx_mlc.c46
1 files changed, 18 insertions, 28 deletions
diff --git a/drivers/mtd/nand/lpc32xx_mlc.c b/drivers/mtd/nand/lpc32xx_mlc.c
index 5da31795b693..c29b7ac1f6af 100644
--- a/drivers/mtd/nand/lpc32xx_mlc.c
+++ b/drivers/mtd/nand/lpc32xx_mlc.c
@@ -621,43 +621,36 @@ out1:
621 return -ENXIO; 621 return -ENXIO;
622} 622}
623 623
624#ifdef CONFIG_OF
625static struct lpc32xx_nand_cfg_mlc *lpc32xx_parse_dt(struct device *dev) 624static struct lpc32xx_nand_cfg_mlc *lpc32xx_parse_dt(struct device *dev)
626{ 625{
627 struct lpc32xx_nand_cfg_mlc *pdata; 626 struct lpc32xx_nand_cfg_mlc *ncfg;
628 struct device_node *np = dev->of_node; 627 struct device_node *np = dev->of_node;
629 628
630 pdata = devm_kzalloc(dev, sizeof(*pdata), GFP_KERNEL); 629 ncfg = devm_kzalloc(dev, sizeof(*ncfg), GFP_KERNEL);
631 if (!pdata) { 630 if (!ncfg) {
632 dev_err(dev, "could not allocate memory for platform data\n"); 631 dev_err(dev, "could not allocate memory for platform data\n");
633 return NULL; 632 return NULL;
634 } 633 }
635 634
636 of_property_read_u32(np, "nxp,tcea-delay", &pdata->tcea_delay); 635 of_property_read_u32(np, "nxp,tcea-delay", &ncfg->tcea_delay);
637 of_property_read_u32(np, "nxp,busy-delay", &pdata->busy_delay); 636 of_property_read_u32(np, "nxp,busy-delay", &ncfg->busy_delay);
638 of_property_read_u32(np, "nxp,nand-ta", &pdata->nand_ta); 637 of_property_read_u32(np, "nxp,nand-ta", &ncfg->nand_ta);
639 of_property_read_u32(np, "nxp,rd-high", &pdata->rd_high); 638 of_property_read_u32(np, "nxp,rd-high", &ncfg->rd_high);
640 of_property_read_u32(np, "nxp,rd-low", &pdata->rd_low); 639 of_property_read_u32(np, "nxp,rd-low", &ncfg->rd_low);
641 of_property_read_u32(np, "nxp,wr-high", &pdata->wr_high); 640 of_property_read_u32(np, "nxp,wr-high", &ncfg->wr_high);
642 of_property_read_u32(np, "nxp,wr-low", &pdata->wr_low); 641 of_property_read_u32(np, "nxp,wr-low", &ncfg->wr_low);
643 642
644 if (!pdata->tcea_delay || !pdata->busy_delay || !pdata->nand_ta || 643 if (!ncfg->tcea_delay || !ncfg->busy_delay || !ncfg->nand_ta ||
645 !pdata->rd_high || !pdata->rd_low || !pdata->wr_high || 644 !ncfg->rd_high || !ncfg->rd_low || !ncfg->wr_high ||
646 !pdata->wr_low) { 645 !ncfg->wr_low) {
647 dev_err(dev, "chip parameters not specified correctly\n"); 646 dev_err(dev, "chip parameters not specified correctly\n");
648 return NULL; 647 return NULL;
649 } 648 }
650 649
651 pdata->wp_gpio = of_get_named_gpio(np, "gpios", 0); 650 ncfg->wp_gpio = of_get_named_gpio(np, "gpios", 0);
652 651
653 return pdata; 652 return ncfg;
654} 653}
655#else
656static struct lpc32xx_nand_cfg_mlc *lpc32xx_parse_dt(struct device *dev)
657{
658 return NULL;
659}
660#endif
661 654
662/* 655/*
663 * Probe for NAND controller 656 * Probe for NAND controller
@@ -695,10 +688,9 @@ static int __devinit lpc32xx_nand_probe(struct platform_device *pdev)
695 nand_chip = &host->nand_chip; 688 nand_chip = &host->nand_chip;
696 if (pdev->dev.of_node) 689 if (pdev->dev.of_node)
697 host->ncfg = lpc32xx_parse_dt(&pdev->dev); 690 host->ncfg = lpc32xx_parse_dt(&pdev->dev);
698 else
699 host->ncfg = pdev->dev.platform_data;
700 if (!host->ncfg) { 691 if (!host->ncfg) {
701 dev_err(&pdev->dev, "Missing platform data\n"); 692 dev_err(&pdev->dev,
693 "Missing or bad NAND config from device tree\n");
702 return -ENOENT; 694 return -ENOENT;
703 } 695 }
704 if (host->ncfg->wp_gpio == -EPROBE_DEFER) 696 if (host->ncfg->wp_gpio == -EPROBE_DEFER)
@@ -907,13 +899,11 @@ static int lpc32xx_nand_suspend(struct platform_device *pdev, pm_message_t pm)
907#define lpc32xx_nand_suspend NULL 899#define lpc32xx_nand_suspend NULL
908#endif 900#endif
909 901
910#if defined(CONFIG_OF)
911static const struct of_device_id lpc32xx_nand_match[] = { 902static const struct of_device_id lpc32xx_nand_match[] = {
912 { .compatible = "nxp,lpc3220-mlc" }, 903 { .compatible = "nxp,lpc3220-mlc" },
913 { /* sentinel */ }, 904 { /* sentinel */ },
914}; 905};
915MODULE_DEVICE_TABLE(of, lpc32xx_nand_match); 906MODULE_DEVICE_TABLE(of, lpc32xx_nand_match);
916#endif
917 907
918static struct platform_driver lpc32xx_nand_driver = { 908static struct platform_driver lpc32xx_nand_driver = {
919 .probe = lpc32xx_nand_probe, 909 .probe = lpc32xx_nand_probe,