Skip to content

Commit 01b95fc

Browse files
author
Roger Quadros
committed
mtd: nand: omap: Copy platform data parameters to omap_nand_info data
Copy all the platform data parameters to the driver's local data structure 'omap_nand_info' and use it in the entire driver. This will make it easer for device tree migration. Signed-off-by: Roger Quadros <[email protected]> Acked-by: Brian Norris <[email protected]> Acked-by: Tony Lindgren <[email protected]>
1 parent d6e5521 commit 01b95fc

File tree

1 file changed

+18
-8
lines changed

1 file changed

+18
-8
lines changed

drivers/mtd/nand/omap2.c

Lines changed: 18 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -152,13 +152,17 @@ static struct nand_hw_control omap_gpmc_controller = {
152152
};
153153

154154
struct omap_nand_info {
155-
struct omap_nand_platform_data *pdata;
156155
struct nand_chip nand;
157156
struct platform_device *pdev;
158157

159158
int gpmc_cs;
160-
unsigned long phys_base;
159+
bool dev_ready;
160+
enum nand_io xfer_type;
161+
int devsize;
161162
enum omap_ecc ecc_opt;
163+
struct device_node *elm_of_node;
164+
165+
unsigned long phys_base;
162166
struct completion comp;
163167
struct dma_chan *dma;
164168
int gpmc_irq_fifo;
@@ -1631,7 +1635,7 @@ static bool omap2_nand_ecc_check(struct omap_nand_info *info,
16311635
"CONFIG_MTD_NAND_OMAP_BCH not enabled\n");
16321636
return false;
16331637
}
1634-
if (ecc_needs_elm && !is_elm_present(info, pdata->elm_of_node)) {
1638+
if (ecc_needs_elm && !is_elm_present(info, info->elm_of_node)) {
16351639
dev_err(&info->pdev->dev, "ELM not available\n");
16361640
return false;
16371641
}
@@ -1675,6 +1679,11 @@ static int omap_nand_probe(struct platform_device *pdev)
16751679
info->gpmc_cs = pdata->cs;
16761680
info->of_node = pdata->of_node;
16771681
info->ecc_opt = pdata->ecc_opt;
1682+
info->dev_ready = pdata->dev_ready;
1683+
info->xfer_type = pdata->xfer_type;
1684+
info->devsize = pdata->devsize;
1685+
info->elm_of_node = pdata->elm_of_node;
1686+
16781687
nand_chip = &info->nand;
16791688
mtd = nand_to_mtd(nand_chip);
16801689
mtd->dev.parent = &pdev->dev;
@@ -1700,7 +1709,7 @@ static int omap_nand_probe(struct platform_device *pdev)
17001709
* chip delay which is slightly more than tR (AC Timing) of the NAND
17011710
* device and read status register until you get a failure or success
17021711
*/
1703-
if (pdata->dev_ready) {
1712+
if (info->dev_ready) {
17041713
nand_chip->dev_ready = omap_dev_ready;
17051714
nand_chip->chip_delay = 0;
17061715
} else {
@@ -1714,15 +1723,16 @@ static int omap_nand_probe(struct platform_device *pdev)
17141723
nand_chip->options |= NAND_SKIP_BBTSCAN;
17151724

17161725
/* scan NAND device connected to chip controller */
1717-
nand_chip->options |= pdata->devsize & NAND_BUSWIDTH_16;
1726+
nand_chip->options |= info->devsize & NAND_BUSWIDTH_16;
17181727
if (nand_scan_ident(mtd, 1, NULL)) {
1719-
dev_err(&info->pdev->dev, "scan failed, may be bus-width mismatch\n");
1728+
dev_err(&info->pdev->dev,
1729+
"scan failed, may be bus-width mismatch\n");
17201730
err = -ENXIO;
17211731
goto return_error;
17221732
}
17231733

17241734
/* re-populate low-level callbacks based on xfer modes */
1725-
switch (pdata->xfer_type) {
1735+
switch (info->xfer_type) {
17261736
case NAND_OMAP_PREFETCH_POLLED:
17271737
nand_chip->read_buf = omap_read_buf_pref;
17281738
nand_chip->write_buf = omap_write_buf_pref;
@@ -1802,7 +1812,7 @@ static int omap_nand_probe(struct platform_device *pdev)
18021812

18031813
default:
18041814
dev_err(&pdev->dev,
1805-
"xfer_type(%d) not supported!\n", pdata->xfer_type);
1815+
"xfer_type(%d) not supported!\n", info->xfer_type);
18061816
err = -EINVAL;
18071817
goto return_error;
18081818
}

0 commit comments

Comments
 (0)