mirror of
https://xff.cz/git/u-boot/
synced 2025-09-01 16:52:14 +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 <fdtdec.h>
|
||||
#include <linux/bitops.h>
|
||||
#include <linux/err.h>
|
||||
#include <linux/libfdt.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_pin_ctrl *ctrl;
|
||||
struct udevice *syscon;
|
||||
struct regmap *regmap;
|
||||
int ret = 0;
|
||||
|
||||
/* get rockchip grf syscon phandle */
|
||||
ret = uclass_get_device_by_phandle(UCLASS_SYSCON, dev, "rockchip,grf",
|
||||
&syscon);
|
||||
if (ret) {
|
||||
debug("unable to find rockchip,grf syscon device (%d)\n", ret);
|
||||
return ret;
|
||||
priv->regmap_base =
|
||||
syscon_regmap_lookup_by_phandle(dev, "rockchip,grf");
|
||||
if (IS_ERR(priv->regmap_base)) {
|
||||
debug("unable to find rockchip,grf regmap\n");
|
||||
return PTR_ERR(priv->regmap_base);
|
||||
}
|
||||
|
||||
/* get grf-reg base address */
|
||||
regmap = syscon_get_regmap(syscon);
|
||||
if (!regmap) {
|
||||
debug("unable to find rockchip grf regmap\n");
|
||||
return -ENODEV;
|
||||
}
|
||||
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;
|
||||
if (dev_read_bool(dev, "rockchip,pmu")) {
|
||||
priv->regmap_pmu =
|
||||
syscon_regmap_lookup_by_phandle(dev, "rockchip,pmu");
|
||||
if (IS_ERR(priv->regmap_pmu)) {
|
||||
debug("unable to find rockchip,pmu regmap\n");
|
||||
return PTR_ERR(priv->regmap_pmu);
|
||||
}
|
||||
priv->regmap_pmu = regmap;
|
||||
}
|
||||
|
||||
ctrl = rockchip_pinctrl_get_soc_data(dev);
|
||||
|
Reference in New Issue
Block a user