|
@@ -719,45 +719,38 @@ static int lpc32xx_nand_dma_setup(struct lpc32xx_nand_host *host)
|
|
|
return 0;
|
|
|
}
|
|
|
|
|
|
-#ifdef CONFIG_OF
|
|
|
static struct lpc32xx_nand_cfg_slc *lpc32xx_parse_dt(struct device *dev)
|
|
|
{
|
|
|
- struct lpc32xx_nand_cfg_slc *pdata;
|
|
|
+ struct lpc32xx_nand_cfg_slc *ncfg;
|
|
|
struct device_node *np = dev->of_node;
|
|
|
|
|
|
- pdata = devm_kzalloc(dev, sizeof(*pdata), GFP_KERNEL);
|
|
|
- if (!pdata) {
|
|
|
- dev_err(dev, "could not allocate memory for platform data\n");
|
|
|
+ ncfg = devm_kzalloc(dev, sizeof(*ncfg), GFP_KERNEL);
|
|
|
+ if (!ncfg) {
|
|
|
+ dev_err(dev, "could not allocate memory for NAND config\n");
|
|
|
return NULL;
|
|
|
}
|
|
|
|
|
|
- of_property_read_u32(np, "nxp,wdr-clks", &pdata->wdr_clks);
|
|
|
- of_property_read_u32(np, "nxp,wwidth", &pdata->wwidth);
|
|
|
- of_property_read_u32(np, "nxp,whold", &pdata->whold);
|
|
|
- of_property_read_u32(np, "nxp,wsetup", &pdata->wsetup);
|
|
|
- of_property_read_u32(np, "nxp,rdr-clks", &pdata->rdr_clks);
|
|
|
- of_property_read_u32(np, "nxp,rwidth", &pdata->rwidth);
|
|
|
- of_property_read_u32(np, "nxp,rhold", &pdata->rhold);
|
|
|
- of_property_read_u32(np, "nxp,rsetup", &pdata->rsetup);
|
|
|
-
|
|
|
- if (!pdata->wdr_clks || !pdata->wwidth || !pdata->whold ||
|
|
|
- !pdata->wsetup || !pdata->rdr_clks || !pdata->rwidth ||
|
|
|
- !pdata->rhold || !pdata->rsetup) {
|
|
|
+ of_property_read_u32(np, "nxp,wdr-clks", &ncfg->wdr_clks);
|
|
|
+ of_property_read_u32(np, "nxp,wwidth", &ncfg->wwidth);
|
|
|
+ of_property_read_u32(np, "nxp,whold", &ncfg->whold);
|
|
|
+ of_property_read_u32(np, "nxp,wsetup", &ncfg->wsetup);
|
|
|
+ of_property_read_u32(np, "nxp,rdr-clks", &ncfg->rdr_clks);
|
|
|
+ of_property_read_u32(np, "nxp,rwidth", &ncfg->rwidth);
|
|
|
+ of_property_read_u32(np, "nxp,rhold", &ncfg->rhold);
|
|
|
+ of_property_read_u32(np, "nxp,rsetup", &ncfg->rsetup);
|
|
|
+
|
|
|
+ if (!ncfg->wdr_clks || !ncfg->wwidth || !ncfg->whold ||
|
|
|
+ !ncfg->wsetup || !ncfg->rdr_clks || !ncfg->rwidth ||
|
|
|
+ !ncfg->rhold || !ncfg->rsetup) {
|
|
|
dev_err(dev, "chip parameters not specified correctly\n");
|
|
|
return NULL;
|
|
|
}
|
|
|
|
|
|
- pdata->use_bbt = of_get_nand_on_flash_bbt(np);
|
|
|
- pdata->wp_gpio = of_get_named_gpio(np, "gpios", 0);
|
|
|
+ ncfg->use_bbt = of_get_nand_on_flash_bbt(np);
|
|
|
+ ncfg->wp_gpio = of_get_named_gpio(np, "gpios", 0);
|
|
|
|
|
|
- return pdata;
|
|
|
-}
|
|
|
-#else
|
|
|
-static struct lpc32xx_nand_cfg_slc *lpc32xx_parse_dt(struct device *dev)
|
|
|
-{
|
|
|
- return NULL;
|
|
|
+ return ncfg;
|
|
|
}
|
|
|
-#endif
|
|
|
|
|
|
/*
|
|
|
* Probe for NAND controller
|
|
@@ -793,10 +786,9 @@ static int __devinit lpc32xx_nand_probe(struct platform_device *pdev)
|
|
|
|
|
|
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)
|
|
@@ -1021,13 +1013,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-slc" },
|
|
|
{ /* sentinel */ },
|
|
|
};
|
|
|
MODULE_DEVICE_TABLE(of, lpc32xx_nand_match);
|
|
|
-#endif
|
|
|
|
|
|
static struct platform_driver lpc32xx_nand_driver = {
|
|
|
.probe = lpc32xx_nand_probe,
|