forked from luck/tmp_suning_uos_patched
mtd: nand: omap2: obtain memory from resource
gpmc initialization done by platform code now updates struct resource with the address space alloted for nand. Use this interface to obtain memory rather than relying on platform data field - phys_base. 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
681988ba0c
commit
9c4c2f8b91
|
@ -26,7 +26,6 @@ struct omap_nand_platform_data {
|
||||||
bool dev_ready;
|
bool dev_ready;
|
||||||
int gpmc_irq;
|
int gpmc_irq;
|
||||||
enum nand_io xfer_type;
|
enum nand_io xfer_type;
|
||||||
unsigned long phys_base;
|
|
||||||
int devsize;
|
int devsize;
|
||||||
enum omap_ecc ecc_opt;
|
enum omap_ecc ecc_opt;
|
||||||
struct gpmc_nand_regs reg;
|
struct gpmc_nand_regs reg;
|
||||||
|
|
|
@ -134,6 +134,7 @@ struct omap_nand_info {
|
||||||
|
|
||||||
int gpmc_cs;
|
int gpmc_cs;
|
||||||
unsigned long phys_base;
|
unsigned long phys_base;
|
||||||
|
unsigned long mem_size;
|
||||||
struct completion comp;
|
struct completion comp;
|
||||||
struct dma_chan *dma;
|
struct dma_chan *dma;
|
||||||
int gpmc_irq;
|
int gpmc_irq;
|
||||||
|
@ -1270,6 +1271,7 @@ static int __devinit omap_nand_probe(struct platform_device *pdev)
|
||||||
int i, offset;
|
int i, offset;
|
||||||
dma_cap_mask_t mask;
|
dma_cap_mask_t mask;
|
||||||
unsigned sig;
|
unsigned sig;
|
||||||
|
struct resource *res;
|
||||||
|
|
||||||
pdata = pdev->dev.platform_data;
|
pdata = pdev->dev.platform_data;
|
||||||
if (pdata == NULL) {
|
if (pdata == NULL) {
|
||||||
|
@ -1289,7 +1291,6 @@ static int __devinit omap_nand_probe(struct platform_device *pdev)
|
||||||
info->pdev = pdev;
|
info->pdev = pdev;
|
||||||
|
|
||||||
info->gpmc_cs = pdata->cs;
|
info->gpmc_cs = pdata->cs;
|
||||||
info->phys_base = pdata->phys_base;
|
|
||||||
info->reg = pdata->reg;
|
info->reg = pdata->reg;
|
||||||
|
|
||||||
info->mtd.priv = &info->nand;
|
info->mtd.priv = &info->nand;
|
||||||
|
@ -1302,13 +1303,23 @@ static int __devinit omap_nand_probe(struct platform_device *pdev)
|
||||||
/* NAND write protect off */
|
/* NAND write protect off */
|
||||||
gpmc_cs_configure(info->gpmc_cs, GPMC_CONFIG_WP, 0);
|
gpmc_cs_configure(info->gpmc_cs, GPMC_CONFIG_WP, 0);
|
||||||
|
|
||||||
if (!request_mem_region(info->phys_base, NAND_IO_SIZE,
|
res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
|
||||||
|
if (res == NULL) {
|
||||||
|
err = -EINVAL;
|
||||||
|
dev_err(&pdev->dev, "error getting memory resource\n");
|
||||||
|
goto out_free_info;
|
||||||
|
}
|
||||||
|
|
||||||
|
info->phys_base = res->start;
|
||||||
|
info->mem_size = resource_size(res);
|
||||||
|
|
||||||
|
if (!request_mem_region(info->phys_base, info->mem_size,
|
||||||
pdev->dev.driver->name)) {
|
pdev->dev.driver->name)) {
|
||||||
err = -EBUSY;
|
err = -EBUSY;
|
||||||
goto out_free_info;
|
goto out_free_info;
|
||||||
}
|
}
|
||||||
|
|
||||||
info->nand.IO_ADDR_R = ioremap(info->phys_base, NAND_IO_SIZE);
|
info->nand.IO_ADDR_R = ioremap(info->phys_base, info->mem_size);
|
||||||
if (!info->nand.IO_ADDR_R) {
|
if (!info->nand.IO_ADDR_R) {
|
||||||
err = -ENOMEM;
|
err = -ENOMEM;
|
||||||
goto out_release_mem_region;
|
goto out_release_mem_region;
|
||||||
|
@ -1479,7 +1490,7 @@ static int __devinit omap_nand_probe(struct platform_device *pdev)
|
||||||
out_release_mem_region:
|
out_release_mem_region:
|
||||||
if (info->dma)
|
if (info->dma)
|
||||||
dma_release_channel(info->dma);
|
dma_release_channel(info->dma);
|
||||||
release_mem_region(info->phys_base, NAND_IO_SIZE);
|
release_mem_region(info->phys_base, info->mem_size);
|
||||||
out_free_info:
|
out_free_info:
|
||||||
kfree(info);
|
kfree(info);
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user