mirror of
https://xff.cz/git/u-boot/
synced 2025-09-02 09:12:08 +02:00
pinctrl: rockchip: Use syscon_regmap_lookup_by_phandle()
Use syscon_regmap_lookup_by_phandle() to simplify the code. Signed-off-by: Jonas Karlman <jonas@kwiboo.se> Reviewed-by: Kever Yang <kever.yang@rock-chips.com>
This commit is contained in:
committed by
Ondrej Jirman
parent
eb84ee977d
commit
f308fc9ab0
@@ -10,6 +10,7 @@
|
|||||||
#include <syscon.h>
|
#include <syscon.h>
|
||||||
#include <fdtdec.h>
|
#include <fdtdec.h>
|
||||||
#include <linux/bitops.h>
|
#include <linux/bitops.h>
|
||||||
|
#include <linux/err.h>
|
||||||
#include <linux/libfdt.h>
|
#include <linux/libfdt.h>
|
||||||
|
|
||||||
#include "pinctrl-rockchip.h"
|
#include "pinctrl-rockchip.h"
|
||||||
@@ -640,37 +641,21 @@ int rockchip_pinctrl_probe(struct udevice *dev)
|
|||||||
{
|
{
|
||||||
struct rockchip_pinctrl_priv *priv = dev_get_priv(dev);
|
struct rockchip_pinctrl_priv *priv = dev_get_priv(dev);
|
||||||
struct rockchip_pin_ctrl *ctrl;
|
struct rockchip_pin_ctrl *ctrl;
|
||||||
struct udevice *syscon;
|
|
||||||
struct regmap *regmap;
|
|
||||||
int ret = 0;
|
|
||||||
|
|
||||||
/* get rockchip grf syscon phandle */
|
priv->regmap_base =
|
||||||
ret = uclass_get_device_by_phandle(UCLASS_SYSCON, dev, "rockchip,grf",
|
syscon_regmap_lookup_by_phandle(dev, "rockchip,grf");
|
||||||
&syscon);
|
if (IS_ERR(priv->regmap_base)) {
|
||||||
if (ret) {
|
debug("unable to find rockchip,grf regmap\n");
|
||||||
debug("unable to find rockchip,grf syscon device (%d)\n", ret);
|
return PTR_ERR(priv->regmap_base);
|
||||||
return ret;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* get grf-reg base address */
|
if (dev_read_bool(dev, "rockchip,pmu")) {
|
||||||
regmap = syscon_get_regmap(syscon);
|
priv->regmap_pmu =
|
||||||
if (!regmap) {
|
syscon_regmap_lookup_by_phandle(dev, "rockchip,pmu");
|
||||||
debug("unable to find rockchip grf regmap\n");
|
if (IS_ERR(priv->regmap_pmu)) {
|
||||||
return -ENODEV;
|
debug("unable to find rockchip,pmu regmap\n");
|
||||||
}
|
return PTR_ERR(priv->regmap_pmu);
|
||||||
priv->regmap_base = regmap;
|
|
||||||
|
|
||||||
/* option: get pmu-reg base address */
|
|
||||||
ret = uclass_get_device_by_phandle(UCLASS_SYSCON, dev, "rockchip,pmu",
|
|
||||||
&syscon);
|
|
||||||
if (!ret) {
|
|
||||||
/* get pmugrf-reg base address */
|
|
||||||
regmap = syscon_get_regmap(syscon);
|
|
||||||
if (!regmap) {
|
|
||||||
debug("unable to find rockchip pmu regmap\n");
|
|
||||||
return -ENODEV;
|
|
||||||
}
|
}
|
||||||
priv->regmap_pmu = regmap;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
ctrl = rockchip_pinctrl_get_soc_data(dev);
|
ctrl = rockchip_pinctrl_get_soc_data(dev);
|
||||||
|
Reference in New Issue
Block a user