mtd: onenand: omap2: obtain memory from resource
gpmc initialization for onenand done by platform code now provides onenand address space as memory resource. Hence remove usage of gpmc_cs_request in onenand driver and obtain memory details from resource structure. Signed-off-by: Afzal Mohammed <afzal@ti.com> Acked-by: Artem Bityutskiy <artem.bityutskiy@linux.intel.com> Signed-off-by: Tony Lindgren <tony@atomide.com>
This commit is contained in:
parent
9c4c2f8b91
commit
d65ccb6da6
|
@ -48,13 +48,13 @@
|
||||||
|
|
||||||
#define DRIVER_NAME "omap2-onenand"
|
#define DRIVER_NAME "omap2-onenand"
|
||||||
|
|
||||||
#define ONENAND_IO_SIZE SZ_128K
|
|
||||||
#define ONENAND_BUFRAM_SIZE (1024 * 5)
|
#define ONENAND_BUFRAM_SIZE (1024 * 5)
|
||||||
|
|
||||||
struct omap2_onenand {
|
struct omap2_onenand {
|
||||||
struct platform_device *pdev;
|
struct platform_device *pdev;
|
||||||
int gpmc_cs;
|
int gpmc_cs;
|
||||||
unsigned long phys_base;
|
unsigned long phys_base;
|
||||||
|
unsigned int mem_size;
|
||||||
int gpio_irq;
|
int gpio_irq;
|
||||||
struct mtd_info mtd;
|
struct mtd_info mtd;
|
||||||
struct onenand_chip onenand;
|
struct onenand_chip onenand;
|
||||||
|
@ -626,6 +626,7 @@ static int __devinit omap2_onenand_probe(struct platform_device *pdev)
|
||||||
struct omap2_onenand *c;
|
struct omap2_onenand *c;
|
||||||
struct onenand_chip *this;
|
struct onenand_chip *this;
|
||||||
int r;
|
int r;
|
||||||
|
struct resource *res;
|
||||||
|
|
||||||
pdata = pdev->dev.platform_data;
|
pdata = pdev->dev.platform_data;
|
||||||
if (pdata == NULL) {
|
if (pdata == NULL) {
|
||||||
|
@ -647,20 +648,24 @@ static int __devinit omap2_onenand_probe(struct platform_device *pdev)
|
||||||
c->gpio_irq = 0;
|
c->gpio_irq = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
r = gpmc_cs_request(c->gpmc_cs, ONENAND_IO_SIZE, &c->phys_base);
|
res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
|
||||||
if (r < 0) {
|
if (res == NULL) {
|
||||||
dev_err(&pdev->dev, "Cannot request GPMC CS\n");
|
r = -EINVAL;
|
||||||
|
dev_err(&pdev->dev, "error getting memory resource\n");
|
||||||
goto err_kfree;
|
goto err_kfree;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (request_mem_region(c->phys_base, ONENAND_IO_SIZE,
|
c->phys_base = res->start;
|
||||||
|
c->mem_size = resource_size(res);
|
||||||
|
|
||||||
|
if (request_mem_region(c->phys_base, c->mem_size,
|
||||||
pdev->dev.driver->name) == NULL) {
|
pdev->dev.driver->name) == NULL) {
|
||||||
dev_err(&pdev->dev, "Cannot reserve memory region at 0x%08lx, "
|
dev_err(&pdev->dev, "Cannot reserve memory region at 0x%08lx, size: 0x%x\n",
|
||||||
"size: 0x%x\n", c->phys_base, ONENAND_IO_SIZE);
|
c->phys_base, c->mem_size);
|
||||||
r = -EBUSY;
|
r = -EBUSY;
|
||||||
goto err_free_cs;
|
goto err_kfree;
|
||||||
}
|
}
|
||||||
c->onenand.base = ioremap(c->phys_base, ONENAND_IO_SIZE);
|
c->onenand.base = ioremap(c->phys_base, c->mem_size);
|
||||||
if (c->onenand.base == NULL) {
|
if (c->onenand.base == NULL) {
|
||||||
r = -ENOMEM;
|
r = -ENOMEM;
|
||||||
goto err_release_mem_region;
|
goto err_release_mem_region;
|
||||||
|
@ -776,9 +781,7 @@ err_release_gpio:
|
||||||
err_iounmap:
|
err_iounmap:
|
||||||
iounmap(c->onenand.base);
|
iounmap(c->onenand.base);
|
||||||
err_release_mem_region:
|
err_release_mem_region:
|
||||||
release_mem_region(c->phys_base, ONENAND_IO_SIZE);
|
release_mem_region(c->phys_base, c->mem_size);
|
||||||
err_free_cs:
|
|
||||||
gpmc_cs_free(c->gpmc_cs);
|
|
||||||
err_kfree:
|
err_kfree:
|
||||||
kfree(c);
|
kfree(c);
|
||||||
|
|
||||||
|
@ -800,7 +803,7 @@ static int __devexit omap2_onenand_remove(struct platform_device *pdev)
|
||||||
gpio_free(c->gpio_irq);
|
gpio_free(c->gpio_irq);
|
||||||
}
|
}
|
||||||
iounmap(c->onenand.base);
|
iounmap(c->onenand.base);
|
||||||
release_mem_region(c->phys_base, ONENAND_IO_SIZE);
|
release_mem_region(c->phys_base, c->mem_size);
|
||||||
gpmc_cs_free(c->gpmc_cs);
|
gpmc_cs_free(c->gpmc_cs);
|
||||||
kfree(c);
|
kfree(c);
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue