History

Merge tag 'memory-controller-drv-omap-5.17' into nand/next

Memory controller drivers for v5.17 - OMAP GPMC 1. Add support for AM64 SoC. 2. Minor improvement: use platform_get_irq(). [miquel.raynal@bootlin.com: A first commit introduced a new omap compatible and another moved the IDs to a header which created a conflict: moving the new ID as well in the header fixed it.]

Miquel Raynal committed 4 years ago

Commit 2997e482 parents ecb78b2 dbcb1245 files · +66 −24Browse files

Unified · Split

5 files
  1. Documentation/devicetree/bindings/memory-controllers/ti,gpmc.yaml +22 −1
  2. drivers/memory/omap-gpmc.c +33 −17
  3. drivers/mtd/nand/raw/Kconfig +1 −0
  4. drivers/mtd/nand/raw/omap2.c +1 −5
  5. include/linux/platform_data/mtd-nand-omap2.h +9 −1
Documentation/devicetree/bindings/memory-controllers/ti,gpmc.yaml+22−1
@@ -23,13 +23,20 @@ properties: · 22 unmodified lines
23 items:23 items:
24 - enum:24 - enum:
25 - ti,am3352-gpmc25 - ti,am3352-gpmc
26 - ti,am64-gpmc
26 - ti,omap2420-gpmc27 - ti,omap2420-gpmc
27 - ti,omap2430-gpmc28 - ti,omap2430-gpmc
28 - ti,omap3430-gpmc29 - ti,omap3430-gpmc
29 - ti,omap4430-gpmc30 - ti,omap4430-gpmc
30 31
31 reg:32 reg:
32 maxItems: 133 minItems: 1
34 maxItems: 2
35
36 reg-names:
37 items:
38 - const: cfg
39 - const: data
33 40
34 interrupts:41 interrupts:
35 maxItems: 142 maxItems: 1
@@ -44,6 +51,9 @@ properties: · 8 unmodified lines
44 items:51 items:
45 - const: fck52 - const: fck
46 53
54 power-domains:
55 maxItems: 1
56
47 dmas:57 dmas:
48 items:58 items:
49 - description: DMA channel for GPMC NAND prefetch59 - description: DMA channel for GPMC NAND prefetch
@@ -133,6 +143,17 @@ required: · 83 unmodified lines
133 - "#address-cells"143 - "#address-cells"
134 - "#size-cells"144 - "#size-cells"
135 145
146allOf:
147 - if:
148 properties:
149 compatible:
150 contains:
151 const: ti,am64-gpmc
152 then:
153 required:
154 - reg-names
155 - power-domains
156
136additionalProperties: false157additionalProperties: false
137 158
138examples:159examples:
drivers/memory/omap-gpmc.c+33−17
@@ -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
242static struct irq_domain *gpmc_irq_domain;243static 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
1459static void gpmc_mem_init(void)1460static 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;
drivers/mtd/nand/raw/Kconfig+1−0
@@ -42,6 +42,7 @@ config MTD_NAND_OMAP2 · 41 unmodified lines
42 tristate "OMAP2, OMAP3, OMAP4 and Keystone NAND controller"42 tristate "OMAP2, OMAP3, OMAP4 and Keystone NAND controller"
43 depends on ARCH_OMAP2PLUS || ARCH_KEYSTONE || ARCH_K3 || COMPILE_TEST43 depends on ARCH_OMAP2PLUS || ARCH_KEYSTONE || ARCH_K3 || COMPILE_TEST
44 depends on HAS_IOMEM44 depends on HAS_IOMEM
45 select OMAP_GPMC if ARCH_K3
45 help46 help
46 Support for NAND flash on Texas Instruments OMAP2, OMAP3, OMAP447 Support for NAND flash on Texas Instruments OMAP2, OMAP3, OMAP4
47 and Keystone platforms.48 and Keystone platforms.
drivers/mtd/nand/raw/omap2.c+1−5
@@ -2290,11 +2290,7 @@ static int omap_nand_remove(struct platform_device *pdev) · 2289 unmodified lines
2290 return ret;2290 return ret;
2291}2291}
2292 2292
2293static const struct of_device_id omap_nand_ids[] = {2293/* omap_nand_ids defined in linux/platform_data/mtd-nand-omap2.h */
2294 { .compatible = "ti,omap2-nand", },
2295 { .compatible = "ti,am64-nand", },
2296 {},
2297};
2298MODULE_DEVICE_TABLE(of, omap_nand_ids);2294MODULE_DEVICE_TABLE(of, omap_nand_ids);
2299 2295
2300static struct platform_driver omap_nand_driver = {2296static struct platform_driver omap_nand_driver = {
include/linux/platform_data/mtd-nand-omap2.h+9−1
@@ -7,6 +7,7 @@ · 6 unmodified lines
7#define _MTD_NAND_OMAP2_H7#define _MTD_NAND_OMAP2_H
8 8
9#include <linux/mtd/partitions.h>9#include <linux/mtd/partitions.h>
10#include <linux/mod_devicetable.h>
10 11
11#define GPMC_BCH_NUM_REMAINDER 812#define GPMC_BCH_NUM_REMAINDER 8
12 13
@@ -61,4 +62,11 @@ struct gpmc_nand_regs { · 48 unmodified lines
61 void __iomem *gpmc_bch_result5[GPMC_BCH_NUM_REMAINDER];62 void __iomem *gpmc_bch_result5[GPMC_BCH_NUM_REMAINDER];
62 void __iomem *gpmc_bch_result6[GPMC_BCH_NUM_REMAINDER];63 void __iomem *gpmc_bch_result6[GPMC_BCH_NUM_REMAINDER];
63};64};
64#endif65
66static const struct of_device_id omap_nand_ids[] = {
67 { .compatible = "ti,omap2-nand", },
68 { .compatible = "ti,am64-nand", },
69 {},
70};
71
72#endif /* _MTD_NAND_OMAP2_H */