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

Merge tag 'memory-controller-drv-5.19-2' of git://git.kernel.org/pub/scm/linux/kernel/git/krzk/linux-mem-ctrl into arm/drivers

Memory controller drivers for v5.19, part two

1. Cleanup: simplify platform_get_resource() calls by using
devm_platform_get_and_ioremap_resource() helper.
2. OMAP: allow building omap-gpmc as module and make it visible (it is
not selected by platform anymore).

* tag 'memory-controller-drv-5.19-2' of git://git.kernel.org/pub/scm/linux/kernel/git/krzk/linux-mem-ctrl:
memory: omap-gpmc: Allow building as a module
memory: omap-gpmc: Make OMAP_GPMC config visible and selectable
memory: renesas-rpc-if: simplify platform_get_resource_byname()
memory: brcmstb_dpfe: simplify platform_get_resource_byname()
memory: tegra: mc: simplify platform_get_resource()
memory: ti-emif-pm: simplify platform_get_resource()
memory: ti-emif: simplify platform_get_resource()
memory: emif: simplify platform_get_resource()
memory: da8xx-ddrctl: simplify platform_get_resource()

Link: https://lore.kernel.org/r/20220503070652.54091-1-krzysztof.kozlowski@linaro.org
Signed-off-by: Arnd Bergmann <arnd@arndb.de>

+35 -44
+1 -1
drivers/memory/Kconfig
··· 103 103 temperature changes 104 104 105 105 config OMAP_GPMC 106 - bool "Texas Instruments OMAP SoC GPMC driver" if COMPILE_TEST 106 + tristate "Texas Instruments OMAP SoC GPMC driver" 107 107 depends on OF_ADDRESS 108 108 select GPIOLIB 109 109 help
+3 -7
drivers/memory/brcmstb_dpfe.c
··· 857 857 { 858 858 struct device *dev = &pdev->dev; 859 859 struct brcmstb_dpfe_priv *priv; 860 - struct resource *res; 861 860 int ret; 862 861 863 862 priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL); ··· 868 869 mutex_init(&priv->lock); 869 870 platform_set_drvdata(pdev, priv); 870 871 871 - res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "dpfe-cpu"); 872 - priv->regs = devm_ioremap_resource(dev, res); 872 + priv->regs = devm_platform_ioremap_resource_byname(pdev, "dpfe-cpu"); 873 873 if (IS_ERR(priv->regs)) { 874 874 dev_err(dev, "couldn't map DCPU registers\n"); 875 875 return -ENODEV; 876 876 } 877 877 878 - res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "dpfe-dmem"); 879 - priv->dmem = devm_ioremap_resource(dev, res); 878 + priv->dmem = devm_platform_ioremap_resource_byname(pdev, "dpfe-dmem"); 880 879 if (IS_ERR(priv->dmem)) { 881 880 dev_err(dev, "Couldn't map DCPU data memory\n"); 882 881 return -ENOENT; 883 882 } 884 883 885 - res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "dpfe-imem"); 886 - priv->imem = devm_ioremap_resource(dev, res); 884 + priv->imem = devm_platform_ioremap_resource_byname(pdev, "dpfe-imem"); 887 885 if (IS_ERR(priv->imem)) { 888 886 dev_err(dev, "Couldn't map DCPU instruction memory\n"); 889 887 return -ENOENT;
+1 -2
drivers/memory/da8xx-ddrctl.c
··· 115 115 return -EINVAL; 116 116 } 117 117 118 - res = platform_get_resource(pdev, IORESOURCE_MEM, 0); 119 - ddrctl = devm_ioremap_resource(dev, res); 118 + ddrctl = devm_platform_get_and_ioremap_resource(pdev, 0, &res); 120 119 if (IS_ERR(ddrctl)) { 121 120 dev_err(dev, "unable to map memory controller registers\n"); 122 121 return PTR_ERR(ddrctl);
+1 -3
drivers/memory/emif.c
··· 1107 1107 static int __init_or_module emif_probe(struct platform_device *pdev) 1108 1108 { 1109 1109 struct emif_data *emif; 1110 - struct resource *res; 1111 1110 int irq, ret; 1112 1111 1113 1112 if (pdev->dev.of_node) ··· 1125 1126 emif->dev = &pdev->dev; 1126 1127 platform_set_drvdata(pdev, emif); 1127 1128 1128 - res = platform_get_resource(pdev, IORESOURCE_MEM, 0); 1129 - emif->base = devm_ioremap_resource(emif->dev, res); 1129 + emif->base = devm_platform_ioremap_resource(pdev, 0); 1130 1130 if (IS_ERR(emif->base)) 1131 1131 goto error; 1132 1132
+23 -20
drivers/memory/omap-gpmc.c
··· 12 12 #include <linux/cpu_pm.h> 13 13 #include <linux/irq.h> 14 14 #include <linux/kernel.h> 15 + #include <linux/module.h> 15 16 #include <linux/init.h> 16 17 #include <linux/err.h> 17 18 #include <linux/clk.h> ··· 1890 1889 } 1891 1890 1892 1891 #ifdef CONFIG_OF 1893 - static const struct of_device_id gpmc_dt_ids[] = { 1894 - { .compatible = "ti,omap2420-gpmc" }, 1895 - { .compatible = "ti,omap2430-gpmc" }, 1896 - { .compatible = "ti,omap3430-gpmc" }, /* omap3430 & omap3630 */ 1897 - { .compatible = "ti,omap4430-gpmc" }, /* omap4430 & omap4460 & omap543x */ 1898 - { .compatible = "ti,am3352-gpmc" }, /* am335x devices */ 1899 - { .compatible = "ti,am64-gpmc" }, 1900 - { } 1901 - }; 1902 - 1903 1892 static void gpmc_cs_set_name(int cs, const char *name) 1904 1893 { 1905 1894 struct gpmc_cs_data *gpmc = &gpmc_cs[cs]; ··· 2248 2257 if (!of_platform_device_create(child, NULL, &pdev->dev)) 2249 2258 goto err_child_fail; 2250 2259 2251 - /* is child a common bus? */ 2252 - if (of_match_node(of_default_bus_match_table, child)) 2253 - /* create children and other common bus children */ 2254 - if (of_platform_default_populate(child, NULL, &pdev->dev)) 2255 - goto err_child_fail; 2260 + /* create children and other common bus children */ 2261 + if (of_platform_default_populate(child, NULL, &pdev->dev)) 2262 + goto err_child_fail; 2256 2263 2257 2264 return 0; 2258 2265 ··· 2266 2277 2267 2278 return ret; 2268 2279 } 2280 + 2281 + static const struct of_device_id gpmc_dt_ids[]; 2269 2282 2270 2283 static int gpmc_probe_dt(struct platform_device *pdev) 2271 2284 { ··· 2635 2644 2636 2645 static SIMPLE_DEV_PM_OPS(gpmc_pm_ops, gpmc_suspend, gpmc_resume); 2637 2646 2647 + #ifdef CONFIG_OF 2648 + static const struct of_device_id gpmc_dt_ids[] = { 2649 + { .compatible = "ti,omap2420-gpmc" }, 2650 + { .compatible = "ti,omap2430-gpmc" }, 2651 + { .compatible = "ti,omap3430-gpmc" }, /* omap3430 & omap3630 */ 2652 + { .compatible = "ti,omap4430-gpmc" }, /* omap4430 & omap4460 & omap543x */ 2653 + { .compatible = "ti,am3352-gpmc" }, /* am335x devices */ 2654 + { .compatible = "ti,am64-gpmc" }, 2655 + { } 2656 + }; 2657 + MODULE_DEVICE_TABLE(of, gpmc_dt_ids); 2658 + #endif 2659 + 2638 2660 static struct platform_driver gpmc_driver = { 2639 2661 .probe = gpmc_probe, 2640 2662 .remove = gpmc_remove, ··· 2658 2654 }, 2659 2655 }; 2660 2656 2661 - static __init int gpmc_init(void) 2662 - { 2663 - return platform_driver_register(&gpmc_driver); 2664 - } 2665 - postcore_initcall(gpmc_init); 2657 + module_platform_driver(gpmc_driver); 2658 + 2659 + MODULE_DESCRIPTION("Texas Instruments GPMC driver"); 2660 + MODULE_LICENSE("GPL");
+1 -2
drivers/memory/renesas-rpc-if.c
··· 229 229 230 230 rpc->dev = dev; 231 231 232 - res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "regs"); 233 - rpc->base = devm_ioremap_resource(&pdev->dev, res); 232 + rpc->base = devm_platform_ioremap_resource_byname(pdev, "regs"); 234 233 if (IS_ERR(rpc->base)) 235 234 return PTR_ERR(rpc->base); 236 235
+1 -3
drivers/memory/tegra/mc.c
··· 716 716 717 717 static int tegra_mc_probe(struct platform_device *pdev) 718 718 { 719 - struct resource *res; 720 719 struct tegra_mc *mc; 721 720 u64 mask; 722 721 int err; ··· 740 741 /* length of MC tick in nanoseconds */ 741 742 mc->tick = 30; 742 743 743 - res = platform_get_resource(pdev, IORESOURCE_MEM, 0); 744 - mc->regs = devm_ioremap_resource(&pdev->dev, res); 744 + mc->regs = devm_platform_ioremap_resource(pdev, 0); 745 745 if (IS_ERR(mc->regs)) 746 746 return PTR_ERR(mc->regs); 747 747
+1 -3
drivers/memory/ti-aemif.c
··· 328 328 { 329 329 int i; 330 330 int ret = -ENODEV; 331 - struct resource *res; 332 331 struct device *dev = &pdev->dev; 333 332 struct device_node *np = dev->of_node; 334 333 struct device_node *child_np; ··· 361 362 else if (pdata) 362 363 aemif->cs_offset = pdata->cs_offset; 363 364 364 - res = platform_get_resource(pdev, IORESOURCE_MEM, 0); 365 - aemif->base = devm_ioremap_resource(dev, res); 365 + aemif->base = devm_platform_ioremap_resource(pdev, 0); 366 366 if (IS_ERR(aemif->base)) { 367 367 ret = PTR_ERR(aemif->base); 368 368 goto error;
+3 -3
drivers/memory/ti-emif-pm.c
··· 290 290 291 291 emif_data->pm_data.ti_emif_sram_config = (unsigned long)match->data; 292 292 293 - res = platform_get_resource(pdev, IORESOURCE_MEM, 0); 294 - emif_data->pm_data.ti_emif_base_addr_virt = devm_ioremap_resource(dev, 295 - res); 293 + emif_data->pm_data.ti_emif_base_addr_virt = devm_platform_get_and_ioremap_resource(pdev, 294 + 0, 295 + &res); 296 296 if (IS_ERR(emif_data->pm_data.ti_emif_base_addr_virt)) { 297 297 ret = PTR_ERR(emif_data->pm_data.ti_emif_base_addr_virt); 298 298 return ret;