Commit f95e8c79 authored by Chunyan Zhang's avatar Chunyan Zhang Committed by Stephen Boyd

clk: sprd: support to get regmap from parent node

Some SC9863a clock nodes would be the child of a syscon node, clocks can
use the regmap of syscon device directly for this kind of cases.
Signed-off-by: default avatarChunyan Zhang <chunyan.zhang@unisoc.com>
Link: https://lkml.kernel.org/r/20200304072730.9193-7-zhang.lyra@gmail.comSigned-off-by: default avatarStephen Boyd <sboyd@kernel.org>
parent ea8ca310
...@@ -40,7 +40,8 @@ int sprd_clk_regmap_init(struct platform_device *pdev, ...@@ -40,7 +40,8 @@ int sprd_clk_regmap_init(struct platform_device *pdev,
const struct sprd_clk_desc *desc) const struct sprd_clk_desc *desc)
{ {
void __iomem *base; void __iomem *base;
struct device_node *node = pdev->dev.of_node; struct device *dev = &pdev->dev;
struct device_node *node = dev->of_node;
struct regmap *regmap; struct regmap *regmap;
if (of_find_property(node, "sprd,syscon", NULL)) { if (of_find_property(node, "sprd,syscon", NULL)) {
...@@ -49,6 +50,13 @@ int sprd_clk_regmap_init(struct platform_device *pdev, ...@@ -49,6 +50,13 @@ int sprd_clk_regmap_init(struct platform_device *pdev,
pr_err("%s: failed to get syscon regmap\n", __func__); pr_err("%s: failed to get syscon regmap\n", __func__);
return PTR_ERR(regmap); return PTR_ERR(regmap);
} }
} else if (of_device_is_compatible(of_get_parent(dev->of_node),
"syscon")) {
regmap = device_node_to_regmap(of_get_parent(dev->of_node));
if (IS_ERR(regmap)) {
dev_err(dev, "failed to get regmap from its parent.\n");
return PTR_ERR(regmap);
}
} else { } else {
base = devm_platform_ioremap_resource(pdev, 0); base = devm_platform_ioremap_resource(pdev, 0);
if (IS_ERR(base)) if (IS_ERR(base))
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment