From: samin Date: Wed, 5 Jan 2022 06:57:25 +0000 (+0800) Subject: reset: starfive-jh7110: use platform_ioremap_iomem_byname. X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=1f2eb3de36ad72a25326f8d3e2c0ee3be4c9df59;p=platform%2Fkernel%2Flinux-starfive.git reset: starfive-jh7110: use platform_ioremap_iomem_byname. The reset module is scattered in several domains, and each address segment may be located in the module device management. Using devm_platform_get_and_ioremap_resource->devm_ioremap_resource will cause the address of this segment to be occupied by the reset driver, and other modules cannot be used, so use ioremap that can be mapped multiple times instead. Signed-off-by: samin --- diff --git a/drivers/reset/starfive/reset-starfive-jh7110.c b/drivers/reset/starfive/reset-starfive-jh7110.c index 412c253..67ac8ff 100644 --- a/drivers/reset/starfive/reset-starfive-jh7110.c +++ b/drivers/reset/starfive/reset-starfive-jh7110.c @@ -199,6 +199,20 @@ static const struct reset_control_ops jh7110_reset_ops = { .status = jh7110_reset_status, }; +static void __iomem *platform_ioremap_iomem_byname(struct platform_device *pdev, + const char *name) +{ + struct resource *res; + + res = platform_get_resource_byname(pdev, IORESOURCE_MEM, name); + if (!res) { + dev_err(&pdev->dev, "get %s io base fail.\n",name); + return NULL; + } + + return ioremap(res->start, resource_size(res)); +} + int __init reset_starfive_jh7110_generic_probe(struct platform_device *pdev, const u32 *asserted, unsigned int nr_resets) @@ -212,15 +226,15 @@ int __init reset_starfive_jh7110_generic_probe(struct platform_device *pdev, dev->driver_data = data; - data->syscrg = devm_platform_ioremap_resource_byname(pdev, "syscrg"); + data->syscrg = platform_ioremap_iomem_byname(pdev, "syscrg"); if (IS_ERR(data->syscrg)) return PTR_ERR(data->syscrg); - data->stgcrg = devm_platform_ioremap_resource_byname(pdev, "stgcrg"); + data->stgcrg = platform_ioremap_iomem_byname(pdev, "stgcrg"); if (IS_ERR(data->stgcrg)) return PTR_ERR(data->stgcrg); - data->aoncrg = devm_platform_ioremap_resource_byname(pdev, "aoncrg"); + data->aoncrg = platform_ioremap_iomem_byname(pdev, "aoncrg"); if (IS_ERR(data->aoncrg)) return PTR_ERR(data->aoncrg);