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
2323 items:
2424 - enum:
2525 - ti,am3352-gpmc
26+ - ti,am64-gpmc
2627 - ti,omap2420-gpmc
2728 - ti,omap2430-gpmc
2829 - ti,omap3430-gpmc
2930 - ti,omap4430-gpmc
3031
3132 reg:
32− maxItems: 1
33+ minItems: 1
34+ maxItems: 2
35+
36+ reg-names:
37+ items:
38+ - const: cfg
39+ - const: data
3340
3441 interrupts:
3542 maxItems: 1
@@ -44,6 +51,9 @@ properties: · 8 unmodified lines
4451 items:
4552 - const: fck
4653
54+ power-domains:
55+ maxItems: 1
56+
4757 dmas:
4858 items:
4959 - description: DMA channel for GPMC NAND prefetch
@@ -133,6 +143,17 @@ required: · 83 unmodified lines
133143 - "#address-cells"
134144 - "#size-cells"
135145
146+allOf:
147+ - if:
148+ properties:
149+ compatible:
150+ contains:
151+ const: ti,am64-gpmc
152+ then:
153+ required:
154+ - reg-names
155+ - power-domains
156+
136157 additionalProperties: false
137158
138159 examples:
drivers/memory/omap-gpmc.c+33−17
@@ -237,6 +237,7 @@ struct gpmc_device { · 236 unmodified lines
237237 struct omap3_gpmc_regs context;
238238 int nirqs;
239239 unsigned int is_suspended:1;
240+ struct resource *data;
240241 };
241242
242243 static struct irq_domain *gpmc_irq_domain;
@@ -1456,12 +1457,18 @@ static void gpmc_mem_exit(void) · 1213 unmodified lines
14561457 }
14571458 }
14581459
1459−static void gpmc_mem_init(void)
1460+static void gpmc_mem_init(struct gpmc_device *gpmc)
14601461 {
14611462 int cs;
14621463
1463− gpmc_mem_root.start = GPMC_MEM_START;
1464− gpmc_mem_root.end = GPMC_MEM_END;
1464+ if (!gpmc->data) {
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+ }
14651472
14661473 /* Reserve all regions that has been set up by bootloader */
14671474 for (cs = 0; cs < gpmc_cs_num; cs++) {
@@ -1888,6 +1895,7 @@ static const struct of_device_id gpmc_dt_ids[] = { · 420 unmodified lines
18881895 { .compatible = "ti,omap3430-gpmc" }, /* omap3430 & omap3630 */
18891896 { .compatible = "ti,omap4430-gpmc" }, /* omap4430 & omap4460 & omap543x */
18901897 { .compatible = "ti,am3352-gpmc" }, /* am335x devices */
1898+ { .compatible = "ti,am64-gpmc" },
18911899 { }
18921900 };
18931901
@@ -2175,7 +2183,7 @@ static int gpmc_probe_generic_child(struct platform_device *pdev, · 281 unmodified lines
21752183 }
21762184 }
21772185
2178− if (of_device_is_compatible(child, "ti,omap2-nand")) {
2186+ if (of_match_node(omap_nand_ids, child)) {
21792187 /* NAND specific setup */
21802188 val = 8;
21812189 of_property_read_u32(child, "nand-bus-width", &val);
@@ -2502,21 +2510,29 @@ static int gpmc_probe(struct platform_device *pdev) · 320 unmodified lines
25022510 gpmc->dev = &pdev->dev;
25032511 platform_set_drvdata(pdev, gpmc);
25042512
2505− res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
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);
2513+ res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "cfg");
25142514 if (!res) {
2515− dev_err(&pdev->dev, "Failed to get resource: irq\n");
2516− return -ENOENT;
2515+ /* legacy DT */
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;
25172531 }
25182532
2519− gpmc->irq = res->start;
2533+ gpmc->irq = platform_get_irq(pdev, 0);
2534+ if (gpmc->irq < 0)
2535+ return gpmc->irq;
25202536
25212537 gpmc_l3_clk = devm_clk_get(&pdev->dev, "fck");
25222538 if (IS_ERR(gpmc_l3_clk)) {
@@ -2562,7 +2578,7 @@ static int gpmc_probe(struct platform_device *pdev) · 39 unmodified lines
25622578 dev_info(gpmc->dev, "GPMC revision %d.%d\n", GPMC_REVISION_MAJOR(l),
25632579 GPMC_REVISION_MINOR(l));
25642580
2565− gpmc_mem_init();
2581+ gpmc_mem_init(gpmc);
25662582 rc = gpmc_gpio_init(gpmc);
25672583 if (rc)
25682584 goto gpio_init_failed;
drivers/mtd/nand/raw/Kconfig+1−0
@@ -42,6 +42,7 @@ config MTD_NAND_OMAP2 · 41 unmodified lines
4242 tristate "OMAP2, OMAP3, OMAP4 and Keystone NAND controller"
4343 depends on ARCH_OMAP2PLUS || ARCH_KEYSTONE || ARCH_K3 || COMPILE_TEST
4444 depends on HAS_IOMEM
45+ select OMAP_GPMC if ARCH_K3
4546 help
4647 Support for NAND flash on Texas Instruments OMAP2, OMAP3, OMAP4
4748 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
22902290 return ret;
22912291 }
22922292
2293−static const struct of_device_id omap_nand_ids[] = {
2294− { .compatible = "ti,omap2-nand", },
2295− { .compatible = "ti,am64-nand", },
2296− {},
2297−};
2293+/* omap_nand_ids defined in linux/platform_data/mtd-nand-omap2.h */
22982294 MODULE_DEVICE_TABLE(of, omap_nand_ids);
22992295
23002296 static struct platform_driver omap_nand_driver = {
include/linux/platform_data/mtd-nand-omap2.h+9−1
@@ -7,6 +7,7 @@ · 6 unmodified lines
77 #define _MTD_NAND_OMAP2_H
88
99 #include <linux/mtd/partitions.h>
10+#include <linux/mod_devicetable.h>
1011
1112 #define GPMC_BCH_NUM_REMAINDER 8
1213
@@ -61,4 +62,11 @@ struct gpmc_nand_regs { · 48 unmodified lines
6162 void __iomem *gpmc_bch_result5[GPMC_BCH_NUM_REMAINDER];
6263 void __iomem *gpmc_bch_result6[GPMC_BCH_NUM_REMAINDER];
6364 };
64−#endif
65+
66+static 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 */