| @@ -237,6 +237,7 @@ struct gpmc_device { · 236 unmodified lines |
| 237 | struct omap3_gpmc_regs context; | 237 | struct omap3_gpmc_regs context; |
| 238 | int nirqs; | 238 | int nirqs; |
| 239 | unsigned int is_suspended:1; | 239 | unsigned int is_suspended:1; |
| | 240 | struct resource *data; |
| 240 | }; | 241 | }; |
| 241 | | 242 | |
| 242 | static struct irq_domain *gpmc_irq_domain; | 243 | static struct irq_domain *gpmc_irq_domain; |
| @@ -1456,12 +1457,18 @@ static void gpmc_mem_exit(void) · 1213 unmodified lines |
| 1456 | } | 1457 | } |
| 1457 | } | 1458 | } |
| 1458 | | 1459 | |
| 1459 | static void gpmc_mem_init(void) | 1460 | static void gpmc_mem_init(struct gpmc_device *gpmc) |
| 1460 | { | 1461 | { |
| 1461 | int cs; | 1462 | int cs; |
| 1462 | | 1463 | |
| 1463 | gpmc_mem_root.start = GPMC_MEM_START; | 1464 | if (!gpmc->data) { |
| 1464 | gpmc_mem_root.end = GPMC_MEM_END; | 1465 | /* All legacy devices have same data IO window */ |
| | 1466 | gpmc_mem_root.start = GPMC_MEM_START; |
| | 1467 | gpmc_mem_root.end = GPMC_MEM_END; |
| | 1468 | } else { |
| | 1469 | gpmc_mem_root.start = gpmc->data->start; |
| | 1470 | gpmc_mem_root.end = gpmc->data->end; |
| | 1471 | } |
| 1465 | | 1472 | |
| 1466 | /* Reserve all regions that has been set up by bootloader */ | 1473 | /* Reserve all regions that has been set up by bootloader */ |
| 1467 | for (cs = 0; cs < gpmc_cs_num; cs++) { | 1474 | for (cs = 0; cs < gpmc_cs_num; cs++) { |
| @@ -1888,6 +1895,7 @@ static const struct of_device_id gpmc_dt_ids[] = { · 420 unmodified lines |
| 1888 | { .compatible = "ti,omap3430-gpmc" }, /* omap3430 & omap3630 */ | 1895 | { .compatible = "ti,omap3430-gpmc" }, /* omap3430 & omap3630 */ |
| 1889 | { .compatible = "ti,omap4430-gpmc" }, /* omap4430 & omap4460 & omap543x */ | 1896 | { .compatible = "ti,omap4430-gpmc" }, /* omap4430 & omap4460 & omap543x */ |
| 1890 | { .compatible = "ti,am3352-gpmc" }, /* am335x devices */ | 1897 | { .compatible = "ti,am3352-gpmc" }, /* am335x devices */ |
| | 1898 | { .compatible = "ti,am64-gpmc" }, |
| 1891 | { } | 1899 | { } |
| 1892 | }; | 1900 | }; |
| 1893 | | 1901 | |
| @@ -2175,7 +2183,7 @@ static int gpmc_probe_generic_child(struct platform_device *pdev, · 281 unmodified lines |
| 2175 | } | 2183 | } |
| 2176 | } | 2184 | } |
| 2177 | | 2185 | |
| 2178 | if (of_device_is_compatible(child, "ti,omap2-nand")) { | 2186 | if (of_match_node(omap_nand_ids, child)) { |
| 2179 | /* NAND specific setup */ | 2187 | /* NAND specific setup */ |
| 2180 | val = 8; | 2188 | val = 8; |
| 2181 | of_property_read_u32(child, "nand-bus-width", &val); | 2189 | of_property_read_u32(child, "nand-bus-width", &val); |
| @@ -2502,21 +2510,29 @@ static int gpmc_probe(struct platform_device *pdev) · 320 unmodified lines |
| 2502 | gpmc->dev = &pdev->dev; | 2510 | gpmc->dev = &pdev->dev; |
| 2503 | platform_set_drvdata(pdev, gpmc); | 2511 | platform_set_drvdata(pdev, gpmc); |
| 2504 | | 2512 | |
| 2505 | res = platform_get_resource(pdev, IORESOURCE_MEM, 0); | 2513 | res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "cfg"); |
| 2506 | if (!res) | | |
| 2507 | return -ENOENT; | | |
| 2508 | | | |
| 2509 | gpmc_base = devm_ioremap_resource(&pdev->dev, res); | | |
| 2510 | if (IS_ERR(gpmc_base)) | | |
| 2511 | return PTR_ERR(gpmc_base); | | |
| 2512 | | | |
| 2513 | res = platform_get_resource(pdev, IORESOURCE_IRQ, 0); | | |
| 2514 | if (!res) { | 2514 | if (!res) { |
| 2515 | dev_err(&pdev->dev, "Failed to get resource: irq\n"); | 2515 | /* legacy DT */ |
| 2516 | return -ENOENT; | 2516 | gpmc_base = devm_platform_ioremap_resource(pdev, 0); |
| | 2517 | if (IS_ERR(gpmc_base)) |
| | 2518 | return PTR_ERR(gpmc_base); |
| | 2519 | } else { |
| | 2520 | gpmc_base = devm_ioremap_resource(&pdev->dev, res); |
| | 2521 | if (IS_ERR(gpmc_base)) |
| | 2522 | return PTR_ERR(gpmc_base); |
| | 2523 | |
| | 2524 | res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "data"); |
| | 2525 | if (!res) { |
| | 2526 | dev_err(&pdev->dev, "couldn't get data reg resource\n"); |
| | 2527 | return -ENOENT; |
| | 2528 | } |
| | 2529 | |
| | 2530 | gpmc->data = res; |
| 2517 | } | 2531 | } |
| 2518 | | 2532 | |
| 2519 | gpmc->irq = res->start; | 2533 | gpmc->irq = platform_get_irq(pdev, 0); |
| | 2534 | if (gpmc->irq < 0) |
| | 2535 | return gpmc->irq; |
| 2520 | | 2536 | |
| 2521 | gpmc_l3_clk = devm_clk_get(&pdev->dev, "fck"); | 2537 | gpmc_l3_clk = devm_clk_get(&pdev->dev, "fck"); |
| 2522 | if (IS_ERR(gpmc_l3_clk)) { | 2538 | if (IS_ERR(gpmc_l3_clk)) { |
| @@ -2562,7 +2578,7 @@ static int gpmc_probe(struct platform_device *pdev) · 39 unmodified lines |
| 2562 | dev_info(gpmc->dev, "GPMC revision %d.%d\n", GPMC_REVISION_MAJOR(l), | 2578 | dev_info(gpmc->dev, "GPMC revision %d.%d\n", GPMC_REVISION_MAJOR(l), |
| 2563 | GPMC_REVISION_MINOR(l)); | 2579 | GPMC_REVISION_MINOR(l)); |
| 2564 | | 2580 | |
| 2565 | gpmc_mem_init(); | 2581 | gpmc_mem_init(gpmc); |
| 2566 | rc = gpmc_gpio_init(gpmc); | 2582 | rc = gpmc_gpio_init(gpmc); |
| 2567 | if (rc) | 2583 | if (rc) |
| 2568 | goto gpio_init_failed; | 2584 | goto gpio_init_failed; |