diff options
author | Roland Stigge <stigge@antcom.de> | 2012-08-24 09:06:51 -0400 |
---|---|---|
committer | David Woodhouse <David.Woodhouse@intel.com> | 2012-09-29 10:12:48 -0400 |
commit | 10594f67870e86aac361d75ee1e84535a33e1214 (patch) | |
tree | 3ce8d25515e4e2bdb1e992e454f002d101b9b74b | |
parent | e1f5b3f6a8370a053326077b413c61026e3f710a (diff) |
mtd: lpc32xx_slc: Cleanup after DT-only conversion
The LPC32xx's DT-only conversion of the SLC 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>
-rw-r--r-- | drivers/mtd/nand/lpc32xx_slc.c | 52 |
1 files changed, 21 insertions, 31 deletions
diff --git a/drivers/mtd/nand/lpc32xx_slc.c b/drivers/mtd/nand/lpc32xx_slc.c index 9326e5994b26..32409c45d479 100644 --- a/drivers/mtd/nand/lpc32xx_slc.c +++ b/drivers/mtd/nand/lpc32xx_slc.c | |||
@@ -719,45 +719,38 @@ static int lpc32xx_nand_dma_setup(struct lpc32xx_nand_host *host) | |||
719 | return 0; | 719 | return 0; |
720 | } | 720 | } |
721 | 721 | ||
722 | #ifdef CONFIG_OF | ||
723 | static struct lpc32xx_nand_cfg_slc *lpc32xx_parse_dt(struct device *dev) | 722 | static struct lpc32xx_nand_cfg_slc *lpc32xx_parse_dt(struct device *dev) |
724 | { | 723 | { |
725 | struct lpc32xx_nand_cfg_slc *pdata; | 724 | struct lpc32xx_nand_cfg_slc *ncfg; |
726 | struct device_node *np = dev->of_node; | 725 | struct device_node *np = dev->of_node; |
727 | 726 | ||
728 | pdata = devm_kzalloc(dev, sizeof(*pdata), GFP_KERNEL); | 727 | ncfg = devm_kzalloc(dev, sizeof(*ncfg), GFP_KERNEL); |
729 | if (!pdata) { | 728 | if (!ncfg) { |
730 | dev_err(dev, "could not allocate memory for platform data\n"); | 729 | dev_err(dev, "could not allocate memory for NAND config\n"); |
731 | return NULL; | 730 | return NULL; |
732 | } | 731 | } |
733 | 732 | ||
734 | of_property_read_u32(np, "nxp,wdr-clks", &pdata->wdr_clks); | 733 | of_property_read_u32(np, "nxp,wdr-clks", &ncfg->wdr_clks); |
735 | of_property_read_u32(np, "nxp,wwidth", &pdata->wwidth); | 734 | of_property_read_u32(np, "nxp,wwidth", &ncfg->wwidth); |
736 | of_property_read_u32(np, "nxp,whold", &pdata->whold); | 735 | of_property_read_u32(np, "nxp,whold", &ncfg->whold); |
737 | of_property_read_u32(np, "nxp,wsetup", &pdata->wsetup); | 736 | of_property_read_u32(np, "nxp,wsetup", &ncfg->wsetup); |
738 | of_property_read_u32(np, "nxp,rdr-clks", &pdata->rdr_clks); | 737 | of_property_read_u32(np, "nxp,rdr-clks", &ncfg->rdr_clks); |
739 | of_property_read_u32(np, "nxp,rwidth", &pdata->rwidth); | 738 | of_property_read_u32(np, "nxp,rwidth", &ncfg->rwidth); |
740 | of_property_read_u32(np, "nxp,rhold", &pdata->rhold); | 739 | of_property_read_u32(np, "nxp,rhold", &ncfg->rhold); |
741 | of_property_read_u32(np, "nxp,rsetup", &pdata->rsetup); | 740 | of_property_read_u32(np, "nxp,rsetup", &ncfg->rsetup); |
742 | 741 | ||
743 | if (!pdata->wdr_clks || !pdata->wwidth || !pdata->whold || | 742 | if (!ncfg->wdr_clks || !ncfg->wwidth || !ncfg->whold || |
744 | !pdata->wsetup || !pdata->rdr_clks || !pdata->rwidth || | 743 | !ncfg->wsetup || !ncfg->rdr_clks || !ncfg->rwidth || |
745 | !pdata->rhold || !pdata->rsetup) { | 744 | !ncfg->rhold || !ncfg->rsetup) { |
746 | dev_err(dev, "chip parameters not specified correctly\n"); | 745 | dev_err(dev, "chip parameters not specified correctly\n"); |
747 | return NULL; | 746 | return NULL; |
748 | } | 747 | } |
749 | 748 | ||
750 | pdata->use_bbt = of_get_nand_on_flash_bbt(np); | 749 | ncfg->use_bbt = of_get_nand_on_flash_bbt(np); |
751 | pdata->wp_gpio = of_get_named_gpio(np, "gpios", 0); | 750 | ncfg->wp_gpio = of_get_named_gpio(np, "gpios", 0); |
752 | 751 | ||
753 | return pdata; | 752 | return ncfg; |
754 | } | ||
755 | #else | ||
756 | static struct lpc32xx_nand_cfg_slc *lpc32xx_parse_dt(struct device *dev) | ||
757 | { | ||
758 | return NULL; | ||
759 | } | 753 | } |
760 | #endif | ||
761 | 754 | ||
762 | /* | 755 | /* |
763 | * Probe for NAND controller | 756 | * Probe for NAND controller |
@@ -793,10 +786,9 @@ static int __devinit lpc32xx_nand_probe(struct platform_device *pdev) | |||
793 | 786 | ||
794 | if (pdev->dev.of_node) | 787 | if (pdev->dev.of_node) |
795 | host->ncfg = lpc32xx_parse_dt(&pdev->dev); | 788 | host->ncfg = lpc32xx_parse_dt(&pdev->dev); |
796 | else | ||
797 | host->ncfg = pdev->dev.platform_data; | ||
798 | if (!host->ncfg) { | 789 | if (!host->ncfg) { |
799 | dev_err(&pdev->dev, "Missing platform data\n"); | 790 | dev_err(&pdev->dev, |
791 | "Missing or bad NAND config from device tree\n"); | ||
800 | return -ENOENT; | 792 | return -ENOENT; |
801 | } | 793 | } |
802 | if (host->ncfg->wp_gpio == -EPROBE_DEFER) | 794 | if (host->ncfg->wp_gpio == -EPROBE_DEFER) |
@@ -1021,13 +1013,11 @@ static int lpc32xx_nand_suspend(struct platform_device *pdev, pm_message_t pm) | |||
1021 | #define lpc32xx_nand_suspend NULL | 1013 | #define lpc32xx_nand_suspend NULL |
1022 | #endif | 1014 | #endif |
1023 | 1015 | ||
1024 | #if defined(CONFIG_OF) | ||
1025 | static const struct of_device_id lpc32xx_nand_match[] = { | 1016 | static const struct of_device_id lpc32xx_nand_match[] = { |
1026 | { .compatible = "nxp,lpc3220-slc" }, | 1017 | { .compatible = "nxp,lpc3220-slc" }, |
1027 | { /* sentinel */ }, | 1018 | { /* sentinel */ }, |
1028 | }; | 1019 | }; |
1029 | MODULE_DEVICE_TABLE(of, lpc32xx_nand_match); | 1020 | MODULE_DEVICE_TABLE(of, lpc32xx_nand_match); |
1030 | #endif | ||
1031 | 1021 | ||
1032 | static struct platform_driver lpc32xx_nand_driver = { | 1022 | static struct platform_driver lpc32xx_nand_driver = { |
1033 | .probe = lpc32xx_nand_probe, | 1023 | .probe = lpc32xx_nand_probe, |