Commit d5c79fcb authored by Jisheng Zhang's avatar Jisheng Zhang Committed by Linus Walleij

pinctrl: berlin: introduce berlin_pinctrl_probe_regmap()

This is to prepare for the next berlin4ct support, where we won't use
simple-mfd any more.
Signed-off-by: default avatarJisheng Zhang <jszhang@marvell.com>
Acked-by: default avatarSebastian Hesselbarth <sebastian.hesselbarth@gmail.com>
Acked-by: default avatarAntoine Tenart <antoine.tenart@free-electrons.com>
Signed-off-by: default avatarLinus Walleij <linus.walleij@linaro.org>
parent 69c308e2
...@@ -292,20 +292,14 @@ static struct pinctrl_desc berlin_pctrl_desc = { ...@@ -292,20 +292,14 @@ static struct pinctrl_desc berlin_pctrl_desc = {
.owner = THIS_MODULE, .owner = THIS_MODULE,
}; };
int berlin_pinctrl_probe(struct platform_device *pdev, int berlin_pinctrl_probe_regmap(struct platform_device *pdev,
const struct berlin_pinctrl_desc *desc) const struct berlin_pinctrl_desc *desc,
struct regmap *regmap)
{ {
struct device *dev = &pdev->dev; struct device *dev = &pdev->dev;
struct device_node *parent_np = of_get_parent(dev->of_node);
struct berlin_pinctrl *pctrl; struct berlin_pinctrl *pctrl;
struct regmap *regmap;
int ret; int ret;
regmap = syscon_node_to_regmap(parent_np);
of_node_put(parent_np);
if (IS_ERR(regmap))
return PTR_ERR(regmap);
pctrl = devm_kzalloc(dev, sizeof(*pctrl), GFP_KERNEL); pctrl = devm_kzalloc(dev, sizeof(*pctrl), GFP_KERNEL);
if (!pctrl) if (!pctrl)
return -ENOMEM; return -ENOMEM;
...@@ -330,3 +324,17 @@ int berlin_pinctrl_probe(struct platform_device *pdev, ...@@ -330,3 +324,17 @@ int berlin_pinctrl_probe(struct platform_device *pdev,
return 0; return 0;
} }
int berlin_pinctrl_probe(struct platform_device *pdev,
const struct berlin_pinctrl_desc *desc)
{
struct device *dev = &pdev->dev;
struct device_node *parent_np = of_get_parent(dev->of_node);
struct regmap *regmap = syscon_node_to_regmap(parent_np);
of_node_put(parent_np);
if (IS_ERR(regmap))
return PTR_ERR(regmap);
return berlin_pinctrl_probe_regmap(pdev, desc, regmap);
}
...@@ -58,4 +58,8 @@ struct berlin_pinctrl_function { ...@@ -58,4 +58,8 @@ struct berlin_pinctrl_function {
int berlin_pinctrl_probe(struct platform_device *pdev, int berlin_pinctrl_probe(struct platform_device *pdev,
const struct berlin_pinctrl_desc *desc); const struct berlin_pinctrl_desc *desc);
int berlin_pinctrl_probe_regmap(struct platform_device *pdev,
const struct berlin_pinctrl_desc *desc,
struct regmap *regmap);
#endif /* __PINCTRL_BERLIN_H */ #endif /* __PINCTRL_BERLIN_H */
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