diff options
Diffstat (limited to 'drivers/mtd/nand/txx9ndfmc.c')
-rw-r--r-- | drivers/mtd/nand/txx9ndfmc.c | 13 |
1 files changed, 5 insertions, 8 deletions
diff --git a/drivers/mtd/nand/txx9ndfmc.c b/drivers/mtd/nand/txx9ndfmc.c index 7ed654c68b08..235714a421dd 100644 --- a/drivers/mtd/nand/txx9ndfmc.c +++ b/drivers/mtd/nand/txx9ndfmc.c | |||
@@ -87,7 +87,7 @@ static struct platform_device *mtd_to_platdev(struct mtd_info *mtd) | |||
87 | static void __iomem *ndregaddr(struct platform_device *dev, unsigned int reg) | 87 | static void __iomem *ndregaddr(struct platform_device *dev, unsigned int reg) |
88 | { | 88 | { |
89 | struct txx9ndfmc_drvdata *drvdata = platform_get_drvdata(dev); | 89 | struct txx9ndfmc_drvdata *drvdata = platform_get_drvdata(dev); |
90 | struct txx9ndfmc_platform_data *plat = dev->dev.platform_data; | 90 | struct txx9ndfmc_platform_data *plat = dev_get_platdata(&dev->dev); |
91 | 91 | ||
92 | return drvdata->base + (reg << plat->shift); | 92 | return drvdata->base + (reg << plat->shift); |
93 | } | 93 | } |
@@ -138,7 +138,7 @@ static void txx9ndfmc_cmd_ctrl(struct mtd_info *mtd, int cmd, | |||
138 | struct nand_chip *chip = mtd->priv; | 138 | struct nand_chip *chip = mtd->priv; |
139 | struct txx9ndfmc_priv *txx9_priv = chip->priv; | 139 | struct txx9ndfmc_priv *txx9_priv = chip->priv; |
140 | struct platform_device *dev = txx9_priv->dev; | 140 | struct platform_device *dev = txx9_priv->dev; |
141 | struct txx9ndfmc_platform_data *plat = dev->dev.platform_data; | 141 | struct txx9ndfmc_platform_data *plat = dev_get_platdata(&dev->dev); |
142 | 142 | ||
143 | if (ctrl & NAND_CTRL_CHANGE) { | 143 | if (ctrl & NAND_CTRL_CHANGE) { |
144 | u32 mcr = txx9ndfmc_read(dev, TXX9_NDFMCR); | 144 | u32 mcr = txx9ndfmc_read(dev, TXX9_NDFMCR); |
@@ -225,7 +225,7 @@ static void txx9ndfmc_enable_hwecc(struct mtd_info *mtd, int mode) | |||
225 | 225 | ||
226 | static void txx9ndfmc_initialize(struct platform_device *dev) | 226 | static void txx9ndfmc_initialize(struct platform_device *dev) |
227 | { | 227 | { |
228 | struct txx9ndfmc_platform_data *plat = dev->dev.platform_data; | 228 | struct txx9ndfmc_platform_data *plat = dev_get_platdata(&dev->dev); |
229 | struct txx9ndfmc_drvdata *drvdata = platform_get_drvdata(dev); | 229 | struct txx9ndfmc_drvdata *drvdata = platform_get_drvdata(dev); |
230 | int tmout = 100; | 230 | int tmout = 100; |
231 | 231 | ||
@@ -274,19 +274,17 @@ static int txx9ndfmc_nand_scan(struct mtd_info *mtd) | |||
274 | 274 | ||
275 | static int __init txx9ndfmc_probe(struct platform_device *dev) | 275 | static int __init txx9ndfmc_probe(struct platform_device *dev) |
276 | { | 276 | { |
277 | struct txx9ndfmc_platform_data *plat = dev->dev.platform_data; | 277 | struct txx9ndfmc_platform_data *plat = dev_get_platdata(&dev->dev); |
278 | int hold, spw; | 278 | int hold, spw; |
279 | int i; | 279 | int i; |
280 | struct txx9ndfmc_drvdata *drvdata; | 280 | struct txx9ndfmc_drvdata *drvdata; |
281 | unsigned long gbusclk = plat->gbus_clock; | 281 | unsigned long gbusclk = plat->gbus_clock; |
282 | struct resource *res; | 282 | struct resource *res; |
283 | 283 | ||
284 | res = platform_get_resource(dev, IORESOURCE_MEM, 0); | ||
285 | if (!res) | ||
286 | return -ENODEV; | ||
287 | drvdata = devm_kzalloc(&dev->dev, sizeof(*drvdata), GFP_KERNEL); | 284 | drvdata = devm_kzalloc(&dev->dev, sizeof(*drvdata), GFP_KERNEL); |
288 | if (!drvdata) | 285 | if (!drvdata) |
289 | return -ENOMEM; | 286 | return -ENOMEM; |
287 | res = platform_get_resource(dev, IORESOURCE_MEM, 0); | ||
290 | drvdata->base = devm_ioremap_resource(&dev->dev, res); | 288 | drvdata->base = devm_ioremap_resource(&dev->dev, res); |
291 | if (IS_ERR(drvdata->base)) | 289 | if (IS_ERR(drvdata->base)) |
292 | return PTR_ERR(drvdata->base); | 290 | return PTR_ERR(drvdata->base); |
@@ -387,7 +385,6 @@ static int __exit txx9ndfmc_remove(struct platform_device *dev) | |||
387 | struct txx9ndfmc_drvdata *drvdata = platform_get_drvdata(dev); | 385 | struct txx9ndfmc_drvdata *drvdata = platform_get_drvdata(dev); |
388 | int i; | 386 | int i; |
389 | 387 | ||
390 | platform_set_drvdata(dev, NULL); | ||
391 | if (!drvdata) | 388 | if (!drvdata) |
392 | return 0; | 389 | return 0; |
393 | for (i = 0; i < MAX_TXX9NDFMC_DEV; i++) { | 390 | for (i = 0; i < MAX_TXX9NDFMC_DEV; i++) { |