From 05e459136fa2e1b6c200ddeecb54cd94029b725e Mon Sep 17 00:00:00 2001 From: Roland Stigge Date: Fri, 24 Aug 2012 15:06:52 +0200 Subject: [PATCH] --- yaml --- r: 332723 b: refs/heads/master c: 62beee20b1a53ba633badc4b57c68d815c9f3e66 h: refs/heads/master i: 332721: 87db81c93a36fa567c2a28489e5363686dcc8660 332719: 4f0b9176a20f85029236c24f946a778c05e4689c v: v3 --- [refs] | 2 +- trunk/drivers/mtd/nand/lpc32xx_mlc.c | 46 +++++++++++----------------- 2 files changed, 19 insertions(+), 29 deletions(-) diff --git a/[refs] b/[refs] index 6880981c8d9e..db79a50c0669 100644 --- a/[refs] +++ b/[refs] @@ -1,2 +1,2 @@ --- -refs/heads/master: 10594f67870e86aac361d75ee1e84535a33e1214 +refs/heads/master: 62beee20b1a53ba633badc4b57c68d815c9f3e66 diff --git a/trunk/drivers/mtd/nand/lpc32xx_mlc.c b/trunk/drivers/mtd/nand/lpc32xx_mlc.c index 5da31795b693..c29b7ac1f6af 100644 --- a/trunk/drivers/mtd/nand/lpc32xx_mlc.c +++ b/trunk/drivers/mtd/nand/lpc32xx_mlc.c @@ -621,43 +621,36 @@ static int lpc32xx_dma_setup(struct lpc32xx_nand_host *host) return -ENXIO; } -#ifdef CONFIG_OF static struct lpc32xx_nand_cfg_mlc *lpc32xx_parse_dt(struct device *dev) { - struct lpc32xx_nand_cfg_mlc *pdata; + struct lpc32xx_nand_cfg_mlc *ncfg; struct device_node *np = dev->of_node; - pdata = devm_kzalloc(dev, sizeof(*pdata), GFP_KERNEL); - if (!pdata) { + ncfg = devm_kzalloc(dev, sizeof(*ncfg), GFP_KERNEL); + if (!ncfg) { dev_err(dev, "could not allocate memory for platform data\n"); return NULL; } - of_property_read_u32(np, "nxp,tcea-delay", &pdata->tcea_delay); - of_property_read_u32(np, "nxp,busy-delay", &pdata->busy_delay); - of_property_read_u32(np, "nxp,nand-ta", &pdata->nand_ta); - of_property_read_u32(np, "nxp,rd-high", &pdata->rd_high); - of_property_read_u32(np, "nxp,rd-low", &pdata->rd_low); - of_property_read_u32(np, "nxp,wr-high", &pdata->wr_high); - of_property_read_u32(np, "nxp,wr-low", &pdata->wr_low); - - if (!pdata->tcea_delay || !pdata->busy_delay || !pdata->nand_ta || - !pdata->rd_high || !pdata->rd_low || !pdata->wr_high || - !pdata->wr_low) { + of_property_read_u32(np, "nxp,tcea-delay", &ncfg->tcea_delay); + of_property_read_u32(np, "nxp,busy-delay", &ncfg->busy_delay); + of_property_read_u32(np, "nxp,nand-ta", &ncfg->nand_ta); + of_property_read_u32(np, "nxp,rd-high", &ncfg->rd_high); + of_property_read_u32(np, "nxp,rd-low", &ncfg->rd_low); + of_property_read_u32(np, "nxp,wr-high", &ncfg->wr_high); + of_property_read_u32(np, "nxp,wr-low", &ncfg->wr_low); + + if (!ncfg->tcea_delay || !ncfg->busy_delay || !ncfg->nand_ta || + !ncfg->rd_high || !ncfg->rd_low || !ncfg->wr_high || + !ncfg->wr_low) { dev_err(dev, "chip parameters not specified correctly\n"); return NULL; } - pdata->wp_gpio = of_get_named_gpio(np, "gpios", 0); + ncfg->wp_gpio = of_get_named_gpio(np, "gpios", 0); - return pdata; + return ncfg; } -#else -static struct lpc32xx_nand_cfg_mlc *lpc32xx_parse_dt(struct device *dev) -{ - return NULL; -} -#endif /* * Probe for NAND controller @@ -695,10 +688,9 @@ static int __devinit lpc32xx_nand_probe(struct platform_device *pdev) nand_chip = &host->nand_chip; if (pdev->dev.of_node) host->ncfg = lpc32xx_parse_dt(&pdev->dev); - else - host->ncfg = pdev->dev.platform_data; if (!host->ncfg) { - dev_err(&pdev->dev, "Missing platform data\n"); + dev_err(&pdev->dev, + "Missing or bad NAND config from device tree\n"); return -ENOENT; } if (host->ncfg->wp_gpio == -EPROBE_DEFER) @@ -907,13 +899,11 @@ static int lpc32xx_nand_suspend(struct platform_device *pdev, pm_message_t pm) #define lpc32xx_nand_suspend NULL #endif -#if defined(CONFIG_OF) static const struct of_device_id lpc32xx_nand_match[] = { { .compatible = "nxp,lpc3220-mlc" }, { /* sentinel */ }, }; MODULE_DEVICE_TABLE(of, lpc32xx_nand_match); -#endif static struct platform_driver lpc32xx_nand_driver = { .probe = lpc32xx_nand_probe,