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).
 -----BEGIN PGP SIGNATURE-----
 
 iQJEBAABCgAuFiEE3dJiKD0RGyM7briowTdm5oaLg9cFAmJw1CsQHGtyemtAa2Vy
 bmVsLm9yZwAKCRDBN2bmhouD1/UCD/9qNCeanmRu+iBPViPhjf4rXNV2cgzPXDIv
 k00pcdn2BJwpiqP/Wn1JJYaHOo1V7O7axd+Tw1Hhz3AgXYWLWnqwA2Q+BH+YYg8H
 nM2VeGC7TYpd3PVB04t0V24mN2gVo0BkBURzk9ekJDsj8RgVu+Kt4k7pc0vQSWZ2
 4vRMkImzCbTvH9rXH75UmKFQC1QjNbnreM8M3ulNFWMKBetf2pwOtXB/0hKeMmPv
 fwLViJzJwv2g9C9SRjOEDOTKsVDc4tGykhi5aXXJ5vZCGJttNusnyn9acVIhhiq3
 kLYRzTNbK4BIcXdcbFoG7NMSqESkNRyWNn2rEqJbhYu3hx6SAYqhlaJdegQj9BXy
 RiBCZKzDdomw3ObbtwpsigOPeNl7LiOLnwj/HoNxd4orUy9RE900DyLVMryHgaLo
 jfgAsy+mN+pzWrzqOKeNB71XMhrnaYLuYrLX+WuJ7CvwnWdCZYS32iq+DnhMRe2O
 zuPf9IXhBeveV3WcbbFc4LQJVx9YUyX5uRA42tMP6ys5n6Zoh0i4ePcMaVbba/IR
 nrUqK3ni7QorNGvzXthACMOAjcw42frcFfUs2CDRWJYLk/PUHk1C+N4s5CiygaYo
 M2N1UTGyT5+mQ/axz2YGSblemcCZQmfwGn1VfOGEpObdoJtuRNUMV5j5C6XnTgK1
 F/zrMF/TvQ==
 =u7Y+
 -----END PGP SIGNATURE-----
gpgsig -----BEGIN PGP SIGNATURE-----
 
 iQIzBAABCgAdFiEEo6/YBQwIrVS28WGKmmx57+YAGNkFAmJxH7UACgkQmmx57+YA
 GNlzTQ/+I2DaRUG1A/m/7wmbywFjv8zTEacLbCUwE7iSVMCMbxlNmjLTCup9haYH
 /Lzt0Yaazs1gDf1EGxq9DT2KVoxTlwN7pt2rWYRHCzpwJXVqNiea2Chk1Ns/hULX
 m5pNUhOgZ7pJtHdot7NbTjd9q7DHOrLo51In5uT1yGeHmQFDgkrwIwBswAAvjDuS
 1GPa47WiCMiT89f0qEv1kFAUCD4b15qus8+4HeVUyVg5u7OEWQcGeK6bpJu6z1R8
 Hg6Z7G0Faz0fR3wUTg7OiFnKrSpIzggFgyriv8wLZXzk6tzy19ZGTx0UmMF0b0lZ
 78BXL0lTu9XJfrfxO8sIYFqvrcdjYIroE0EYTzzNCqtl+SjZMo41n6AQfeM8N52o
 Fb1ISjewG31f3P/7eYQwUCw06O8QBsK001ADsOFJOGvWzIoT+Ak5OXvSwRb6tSGT
 ZSXoBGNg4Ws7UVh4pey4U+vCIrbzm/XJ8PUNCy2sDdnMqoY61cq/8AP6P7nE+B/+
 ch/Vww/DL34t5Tpno+jG7R3I14yvmS2YH7nGAyL+Kr8rhTLv08M663QtsIb0QlCt
 cFrBY4h3hb6G+xL6WpKMULhL5d7ZmXWAmu+cjkgYb9Cxv/NDFWJ1sBuwl4FWrOO/
 h2u12pWV0wQgDcsHXQC2LMyad75CBEj4KsfnuSWGdrjOeTGkT58=
 =c7xR
 -----END PGP SIGNATURE-----

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>
This commit is contained in:
Arnd Bergmann 2022-05-03 14:27:31 +02:00
commit b8e3d15e73
9 changed files with 35 additions and 44 deletions

View File

@ -103,7 +103,7 @@ config TI_EMIF
temperature changes
config OMAP_GPMC
bool "Texas Instruments OMAP SoC GPMC driver" if COMPILE_TEST
tristate "Texas Instruments OMAP SoC GPMC driver"
depends on OF_ADDRESS
select GPIOLIB
help

View File

@ -857,7 +857,6 @@ static int brcmstb_dpfe_probe(struct platform_device *pdev)
{
struct device *dev = &pdev->dev;
struct brcmstb_dpfe_priv *priv;
struct resource *res;
int ret;
priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL);
@ -869,22 +868,19 @@ static int brcmstb_dpfe_probe(struct platform_device *pdev)
mutex_init(&priv->lock);
platform_set_drvdata(pdev, priv);
res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "dpfe-cpu");
priv->regs = devm_ioremap_resource(dev, res);
priv->regs = devm_platform_ioremap_resource_byname(pdev, "dpfe-cpu");
if (IS_ERR(priv->regs)) {
dev_err(dev, "couldn't map DCPU registers\n");
return -ENODEV;
}
res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "dpfe-dmem");
priv->dmem = devm_ioremap_resource(dev, res);
priv->dmem = devm_platform_ioremap_resource_byname(pdev, "dpfe-dmem");
if (IS_ERR(priv->dmem)) {
dev_err(dev, "Couldn't map DCPU data memory\n");
return -ENOENT;
}
res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "dpfe-imem");
priv->imem = devm_ioremap_resource(dev, res);
priv->imem = devm_platform_ioremap_resource_byname(pdev, "dpfe-imem");
if (IS_ERR(priv->imem)) {
dev_err(dev, "Couldn't map DCPU instruction memory\n");
return -ENOENT;

View File

@ -115,8 +115,7 @@ static int da8xx_ddrctl_probe(struct platform_device *pdev)
return -EINVAL;
}
res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
ddrctl = devm_ioremap_resource(dev, res);
ddrctl = devm_platform_get_and_ioremap_resource(pdev, 0, &res);
if (IS_ERR(ddrctl)) {
dev_err(dev, "unable to map memory controller registers\n");
return PTR_ERR(ddrctl);

View File

@ -1107,7 +1107,6 @@ error:
static int __init_or_module emif_probe(struct platform_device *pdev)
{
struct emif_data *emif;
struct resource *res;
int irq, ret;
if (pdev->dev.of_node)
@ -1126,8 +1125,7 @@ static int __init_or_module emif_probe(struct platform_device *pdev)
emif->dev = &pdev->dev;
platform_set_drvdata(pdev, emif);
res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
emif->base = devm_ioremap_resource(emif->dev, res);
emif->base = devm_platform_ioremap_resource(pdev, 0);
if (IS_ERR(emif->base))
goto error;

View File

@ -12,6 +12,7 @@
#include <linux/cpu_pm.h>
#include <linux/irq.h>
#include <linux/kernel.h>
#include <linux/module.h>
#include <linux/init.h>
#include <linux/err.h>
#include <linux/clk.h>
@ -1889,16 +1890,6 @@ int gpmc_cs_program_settings(int cs, struct gpmc_settings *p)
}
#ifdef CONFIG_OF
static const struct of_device_id gpmc_dt_ids[] = {
{ .compatible = "ti,omap2420-gpmc" },
{ .compatible = "ti,omap2430-gpmc" },
{ .compatible = "ti,omap3430-gpmc" }, /* omap3430 & omap3630 */
{ .compatible = "ti,omap4430-gpmc" }, /* omap4430 & omap4460 & omap543x */
{ .compatible = "ti,am3352-gpmc" }, /* am335x devices */
{ .compatible = "ti,am64-gpmc" },
{ }
};
static void gpmc_cs_set_name(int cs, const char *name)
{
struct gpmc_cs_data *gpmc = &gpmc_cs[cs];
@ -2257,11 +2248,9 @@ no_timings:
if (!of_platform_device_create(child, NULL, &pdev->dev))
goto err_child_fail;
/* is child a common bus? */
if (of_match_node(of_default_bus_match_table, child))
/* create children and other common bus children */
if (of_platform_default_populate(child, NULL, &pdev->dev))
goto err_child_fail;
/* create children and other common bus children */
if (of_platform_default_populate(child, NULL, &pdev->dev))
goto err_child_fail;
return 0;
@ -2278,6 +2267,8 @@ err:
return ret;
}
static const struct of_device_id gpmc_dt_ids[];
static int gpmc_probe_dt(struct platform_device *pdev)
{
int ret;
@ -2644,6 +2635,19 @@ static int gpmc_resume(struct device *dev)
static SIMPLE_DEV_PM_OPS(gpmc_pm_ops, gpmc_suspend, gpmc_resume);
#ifdef CONFIG_OF
static const struct of_device_id gpmc_dt_ids[] = {
{ .compatible = "ti,omap2420-gpmc" },
{ .compatible = "ti,omap2430-gpmc" },
{ .compatible = "ti,omap3430-gpmc" }, /* omap3430 & omap3630 */
{ .compatible = "ti,omap4430-gpmc" }, /* omap4430 & omap4460 & omap543x */
{ .compatible = "ti,am3352-gpmc" }, /* am335x devices */
{ .compatible = "ti,am64-gpmc" },
{ }
};
MODULE_DEVICE_TABLE(of, gpmc_dt_ids);
#endif
static struct platform_driver gpmc_driver = {
.probe = gpmc_probe,
.remove = gpmc_remove,
@ -2654,8 +2658,7 @@ static struct platform_driver gpmc_driver = {
},
};
static __init int gpmc_init(void)
{
return platform_driver_register(&gpmc_driver);
}
postcore_initcall(gpmc_init);
module_platform_driver(gpmc_driver);
MODULE_DESCRIPTION("Texas Instruments GPMC driver");
MODULE_LICENSE("GPL");

View File

@ -229,8 +229,7 @@ int rpcif_sw_init(struct rpcif *rpc, struct device *dev)
rpc->dev = dev;
res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "regs");
rpc->base = devm_ioremap_resource(&pdev->dev, res);
rpc->base = devm_platform_ioremap_resource_byname(pdev, "regs");
if (IS_ERR(rpc->base))
return PTR_ERR(rpc->base);

View File

@ -716,7 +716,6 @@ del_provider:
static int tegra_mc_probe(struct platform_device *pdev)
{
struct resource *res;
struct tegra_mc *mc;
u64 mask;
int err;
@ -741,8 +740,7 @@ static int tegra_mc_probe(struct platform_device *pdev)
/* length of MC tick in nanoseconds */
mc->tick = 30;
res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
mc->regs = devm_ioremap_resource(&pdev->dev, res);
mc->regs = devm_platform_ioremap_resource(pdev, 0);
if (IS_ERR(mc->regs))
return PTR_ERR(mc->regs);

View File

@ -328,7 +328,6 @@ static int aemif_probe(struct platform_device *pdev)
{
int i;
int ret = -ENODEV;
struct resource *res;
struct device *dev = &pdev->dev;
struct device_node *np = dev->of_node;
struct device_node *child_np;
@ -362,8 +361,7 @@ static int aemif_probe(struct platform_device *pdev)
else if (pdata)
aemif->cs_offset = pdata->cs_offset;
res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
aemif->base = devm_ioremap_resource(dev, res);
aemif->base = devm_platform_ioremap_resource(pdev, 0);
if (IS_ERR(aemif->base)) {
ret = PTR_ERR(aemif->base);
goto error;

View File

@ -290,9 +290,9 @@ static int ti_emif_probe(struct platform_device *pdev)
emif_data->pm_data.ti_emif_sram_config = (unsigned long)match->data;
res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
emif_data->pm_data.ti_emif_base_addr_virt = devm_ioremap_resource(dev,
res);
emif_data->pm_data.ti_emif_base_addr_virt = devm_platform_get_and_ioremap_resource(pdev,
0,
&res);
if (IS_ERR(emif_data->pm_data.ti_emif_base_addr_virt)) {
ret = PTR_ERR(emif_data->pm_data.ti_emif_base_addr_virt);
return ret;