summaryrefslogtreecommitdiff
path: root/drivers/reset
diff options
context:
space:
mode:
authorsamin <samin.guo@starfivetech.com>2022-01-05 09:57:25 +0300
committersamin <samin.guo@starfivetech.com>2022-01-05 10:50:32 +0300
commit1f2eb3de36ad72a25326f8d3e2c0ee3be4c9df59 (patch)
tree0a7efc47b86f6298b7c8b1d83c3bfcabb1a1b9b6 /drivers/reset
parent7793261401ee7f8d5264a58c4baa3b435c2d86ae (diff)
downloadlinux-1f2eb3de36ad72a25326f8d3e2c0ee3be4c9df59.tar.xz
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 <samin.guo@starfivetech.com>
Diffstat (limited to 'drivers/reset')
-rw-r--r--drivers/reset/starfive/reset-starfive-jh7110.c20
1 files changed, 17 insertions, 3 deletions
diff --git a/drivers/reset/starfive/reset-starfive-jh7110.c b/drivers/reset/starfive/reset-starfive-jh7110.c
index 412c25346ab9..67ac8ff347f3 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);