Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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.]

Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com>

+66 -24
+22 -1
Documentation/devicetree/bindings/memory-controllers/ti,gpmc.yaml
··· 23 23 items: 24 24 - enum: 25 25 - ti,am3352-gpmc 26 + - ti,am64-gpmc 26 27 - ti,omap2420-gpmc 27 28 - ti,omap2430-gpmc 28 29 - ti,omap3430-gpmc 29 30 - ti,omap4430-gpmc 30 31 31 32 reg: 32 - maxItems: 1 33 + minItems: 1 34 + maxItems: 2 35 + 36 + reg-names: 37 + items: 38 + - const: cfg 39 + - const: data 33 40 34 41 interrupts: 35 42 maxItems: 1 ··· 50 43 clock-names: 51 44 items: 52 45 - const: fck 46 + 47 + power-domains: 48 + maxItems: 1 53 49 54 50 dmas: 55 51 items: ··· 142 132 - gpmc,num-waitpins 143 133 - "#address-cells" 144 134 - "#size-cells" 135 + 136 + allOf: 137 + - if: 138 + properties: 139 + compatible: 140 + contains: 141 + const: ti,am64-gpmc 142 + then: 143 + required: 144 + - reg-names 145 + - power-domains 145 146 146 147 additionalProperties: false 147 148
+33 -17
drivers/memory/omap-gpmc.c
··· 237 237 struct omap3_gpmc_regs context; 238 238 int nirqs; 239 239 unsigned int is_suspended:1; 240 + struct resource *data; 240 241 }; 241 242 242 243 static struct irq_domain *gpmc_irq_domain; ··· 1457 1456 } 1458 1457 } 1459 1458 1460 - static void gpmc_mem_init(void) 1459 + static void gpmc_mem_init(struct gpmc_device *gpmc) 1461 1460 { 1462 1461 int cs; 1463 1462 1464 - gpmc_mem_root.start = GPMC_MEM_START; 1465 - gpmc_mem_root.end = GPMC_MEM_END; 1463 + if (!gpmc->data) { 1464 + /* All legacy devices have same data IO window */ 1465 + gpmc_mem_root.start = GPMC_MEM_START; 1466 + gpmc_mem_root.end = GPMC_MEM_END; 1467 + } else { 1468 + gpmc_mem_root.start = gpmc->data->start; 1469 + gpmc_mem_root.end = gpmc->data->end; 1470 + } 1466 1471 1467 1472 /* Reserve all regions that has been set up by bootloader */ 1468 1473 for (cs = 0; cs < gpmc_cs_num; cs++) { ··· 1895 1888 { .compatible = "ti,omap3430-gpmc" }, /* omap3430 & omap3630 */ 1896 1889 { .compatible = "ti,omap4430-gpmc" }, /* omap4430 & omap4460 & omap543x */ 1897 1890 { .compatible = "ti,am3352-gpmc" }, /* am335x devices */ 1891 + { .compatible = "ti,am64-gpmc" }, 1898 1892 { } 1899 1893 }; 1900 1894 ··· 2183 2175 } 2184 2176 } 2185 2177 2186 - if (of_device_is_compatible(child, "ti,omap2-nand")) { 2178 + if (of_match_node(omap_nand_ids, child)) { 2187 2179 /* NAND specific setup */ 2188 2180 val = 8; 2189 2181 of_property_read_u32(child, "nand-bus-width", &val); ··· 2510 2502 gpmc->dev = &pdev->dev; 2511 2503 platform_set_drvdata(pdev, gpmc); 2512 2504 2513 - res = platform_get_resource(pdev, IORESOURCE_MEM, 0); 2514 - if (!res) 2515 - return -ENOENT; 2516 - 2517 - gpmc_base = devm_ioremap_resource(&pdev->dev, res); 2518 - if (IS_ERR(gpmc_base)) 2519 - return PTR_ERR(gpmc_base); 2520 - 2521 - res = platform_get_resource(pdev, IORESOURCE_IRQ, 0); 2505 + res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "cfg"); 2522 2506 if (!res) { 2523 - dev_err(&pdev->dev, "Failed to get resource: irq\n"); 2524 - return -ENOENT; 2507 + /* legacy DT */ 2508 + gpmc_base = devm_platform_ioremap_resource(pdev, 0); 2509 + if (IS_ERR(gpmc_base)) 2510 + return PTR_ERR(gpmc_base); 2511 + } else { 2512 + gpmc_base = devm_ioremap_resource(&pdev->dev, res); 2513 + if (IS_ERR(gpmc_base)) 2514 + return PTR_ERR(gpmc_base); 2515 + 2516 + res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "data"); 2517 + if (!res) { 2518 + dev_err(&pdev->dev, "couldn't get data reg resource\n"); 2519 + return -ENOENT; 2520 + } 2521 + 2522 + gpmc->data = res; 2525 2523 } 2526 2524 2527 - gpmc->irq = res->start; 2525 + gpmc->irq = platform_get_irq(pdev, 0); 2526 + if (gpmc->irq < 0) 2527 + return gpmc->irq; 2528 2528 2529 2529 gpmc_l3_clk = devm_clk_get(&pdev->dev, "fck"); 2530 2530 if (IS_ERR(gpmc_l3_clk)) { ··· 2578 2562 dev_info(gpmc->dev, "GPMC revision %d.%d\n", GPMC_REVISION_MAJOR(l), 2579 2563 GPMC_REVISION_MINOR(l)); 2580 2564 2581 - gpmc_mem_init(); 2565 + gpmc_mem_init(gpmc); 2582 2566 rc = gpmc_gpio_init(gpmc); 2583 2567 if (rc) 2584 2568 goto gpio_init_failed;
+1
drivers/mtd/nand/raw/Kconfig
··· 42 42 tristate "OMAP2, OMAP3, OMAP4 and Keystone NAND controller" 43 43 depends on ARCH_OMAP2PLUS || ARCH_KEYSTONE || ARCH_K3 || COMPILE_TEST 44 44 depends on HAS_IOMEM 45 + select OMAP_GPMC if ARCH_K3 45 46 help 46 47 Support for NAND flash on Texas Instruments OMAP2, OMAP3, OMAP4 47 48 and Keystone platforms.
+1 -5
drivers/mtd/nand/raw/omap2.c
··· 2290 2290 return ret; 2291 2291 } 2292 2292 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 */ 2298 2294 MODULE_DEVICE_TABLE(of, omap_nand_ids); 2299 2295 2300 2296 static struct platform_driver omap_nand_driver = {
+9 -1
include/linux/platform_data/mtd-nand-omap2.h
··· 7 7 #define _MTD_NAND_OMAP2_H 8 8 9 9 #include <linux/mtd/partitions.h> 10 + #include <linux/mod_devicetable.h> 10 11 11 12 #define GPMC_BCH_NUM_REMAINDER 8 12 13 ··· 62 61 void __iomem *gpmc_bch_result5[GPMC_BCH_NUM_REMAINDER]; 63 62 void __iomem *gpmc_bch_result6[GPMC_BCH_NUM_REMAINDER]; 64 63 }; 65 - #endif 64 + 65 + static const struct of_device_id omap_nand_ids[] = { 66 + { .compatible = "ti,omap2-nand", }, 67 + { .compatible = "ti,am64-nand", }, 68 + {}, 69 + }; 70 + 71 + #endif /* _MTD_NAND_OMAP2_H */