summaryrefslogtreecommitdiff
path: root/drivers
diff options
context:
space:
mode:
authorMasahiro Yamada <yamada.masahiro@socionext.com>2018-04-19 12:14:03 +0900
committerTom Rini <trini@konsulko.com>2018-05-07 15:49:51 -0400
commitd35812368a590ebe1a5c92199a1a57ce3e80722e (patch)
treec1ff594293463470564010fd57e7cbbd03bb35a0 /drivers
parent5ccc2c21307e186722ca9966bad0e03189c237c5 (diff)
regmap: change regmap_init_mem() to take ofnode instead udevice
Currently, regmap_init_mem() takes a udevice. This requires the node has already been associated with a device. It prevents syscon/regmap from behaving like those in Linux. Change the first argumenet to take a device node. Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com> Acked-by: Neil Armstrong <narmstrong@baylibre.com> Reviewed-by: Simon Glass <sjg@chromium.org>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/core/regmap.c11
-rw-r--r--drivers/core/syscon-uclass.c2
-rw-r--r--drivers/phy/meson-gxl-usb2.c2
-rw-r--r--drivers/phy/meson-gxl-usb3.c2
-rw-r--r--drivers/ram/rockchip/dmc-rk3368.c2
-rw-r--r--drivers/ram/rockchip/sdram_rk3188.c2
-rw-r--r--drivers/ram/rockchip/sdram_rk322x.c2
-rw-r--r--drivers/ram/rockchip/sdram_rk3288.c2
-rw-r--r--drivers/ram/rockchip/sdram_rk3399.c2
-rw-r--r--drivers/ram/stm32mp1/stm32mp1_ram.c2
-rw-r--r--drivers/reset/reset-meson.c2
11 files changed, 15 insertions, 16 deletions
diff --git a/drivers/core/regmap.c b/drivers/core/regmap.c
index 0f787ab4e1..fabcc5f53a 100644
--- a/drivers/core/regmap.c
+++ b/drivers/core/regmap.c
@@ -50,7 +50,7 @@ int regmap_init_mem_platdata(struct udevice *dev, fdt_val_t *reg, int count,
return 0;
}
#else
-int regmap_init_mem(struct udevice *dev, struct regmap **mapp)
+int regmap_init_mem(ofnode node, struct regmap **mapp)
{
struct regmap_range *range;
struct regmap *map;
@@ -58,14 +58,13 @@ int regmap_init_mem(struct udevice *dev, struct regmap **mapp)
int addr_len, size_len, both_len;
int len;
int index;
- ofnode node = dev_ofnode(dev);
struct resource r;
- addr_len = dev_read_simple_addr_cells(dev->parent);
- size_len = dev_read_simple_size_cells(dev->parent);
+ addr_len = ofnode_read_simple_addr_cells(ofnode_get_parent(node));
+ size_len = ofnode_read_simple_size_cells(ofnode_get_parent(node));
both_len = addr_len + size_len;
- len = dev_read_size(dev, "reg");
+ len = ofnode_read_size(node, "reg");
if (len < 0)
return len;
len /= sizeof(fdt32_t);
@@ -86,7 +85,7 @@ int regmap_init_mem(struct udevice *dev, struct regmap **mapp)
range->size = r.end - r.start + 1;
} else {
range->start = fdtdec_get_addr_size_fixed(gd->fdt_blob,
- dev_of_offset(dev), "reg", index,
+ ofnode_to_offset(node), "reg", index,
addr_len, size_len, &sz, true);
range->size = sz;
}
diff --git a/drivers/core/syscon-uclass.c b/drivers/core/syscon-uclass.c
index 96408dea7e..62ba462158 100644
--- a/drivers/core/syscon-uclass.c
+++ b/drivers/core/syscon-uclass.c
@@ -40,7 +40,7 @@ static int syscon_pre_probe(struct udevice *dev)
return regmap_init_mem_platdata(dev, plat->reg, ARRAY_SIZE(plat->reg),
&priv->regmap);
#else
- return regmap_init_mem(dev, &priv->regmap);
+ return regmap_init_mem(dev_ofnode(dev), &priv->regmap);
#endif
}
diff --git a/drivers/phy/meson-gxl-usb2.c b/drivers/phy/meson-gxl-usb2.c
index 7ea4fe797e..86e69c73ba 100644
--- a/drivers/phy/meson-gxl-usb2.c
+++ b/drivers/phy/meson-gxl-usb2.c
@@ -192,7 +192,7 @@ int meson_gxl_usb2_phy_probe(struct udevice *dev)
struct phy_meson_gxl_usb2_priv *priv = dev_get_priv(dev);
int ret;
- ret = regmap_init_mem(dev, &priv->regmap);
+ ret = regmap_init_mem(dev_ofnode(dev), &priv->regmap);
if (ret)
return ret;
diff --git a/drivers/phy/meson-gxl-usb3.c b/drivers/phy/meson-gxl-usb3.c
index 22824de517..5cbbd4d8f7 100644
--- a/drivers/phy/meson-gxl-usb3.c
+++ b/drivers/phy/meson-gxl-usb3.c
@@ -163,7 +163,7 @@ int meson_gxl_usb3_phy_probe(struct udevice *dev)
struct phy_meson_gxl_usb3_priv *priv = dev_get_priv(dev);
int ret;
- ret = regmap_init_mem(dev, &priv->regmap);
+ ret = regmap_init_mem(dev_ofnode(dev), &priv->regmap);
if (ret)
return ret;
diff --git a/drivers/ram/rockchip/dmc-rk3368.c b/drivers/ram/rockchip/dmc-rk3368.c
index 75e2e9969b..8d1b9faacc 100644
--- a/drivers/ram/rockchip/dmc-rk3368.c
+++ b/drivers/ram/rockchip/dmc-rk3368.c
@@ -877,7 +877,7 @@ static int rk3368_dmc_ofdata_to_platdata(struct udevice *dev)
#if !CONFIG_IS_ENABLED(OF_PLATDATA)
struct rk3368_sdram_params *plat = dev_get_platdata(dev);
- ret = regmap_init_mem(dev, &plat->map);
+ ret = regmap_init_mem(dev_ofnode(dev), &plat->map);
if (ret)
return ret;
#endif
diff --git a/drivers/ram/rockchip/sdram_rk3188.c b/drivers/ram/rockchip/sdram_rk3188.c
index 91edc5a661..3774abfa98 100644
--- a/drivers/ram/rockchip/sdram_rk3188.c
+++ b/drivers/ram/rockchip/sdram_rk3188.c
@@ -839,7 +839,7 @@ static int rk3188_dmc_ofdata_to_platdata(struct udevice *dev)
printf("%s: Cannot read rockchip,sdram-params\n", __func__);
return -EINVAL;
}
- ret = regmap_init_mem(dev, &params->map);
+ ret = regmap_init_mem(dev_ofnode(dev), &params->map);
if (ret)
return ret;
#endif
diff --git a/drivers/ram/rockchip/sdram_rk322x.c b/drivers/ram/rockchip/sdram_rk322x.c
index 16cf557af4..8bafd17f8f 100644
--- a/drivers/ram/rockchip/sdram_rk322x.c
+++ b/drivers/ram/rockchip/sdram_rk322x.c
@@ -743,7 +743,7 @@ static int rk322x_dmc_ofdata_to_platdata(struct udevice *dev)
printf("%s: Cannot read rockchip,sdram-params\n", __func__);
return -EINVAL;
}
- ret = regmap_init_mem(dev, &params->map);
+ ret = regmap_init_mem(dev_ofnode(dev), &params->map);
if (ret)
return ret;
#endif
diff --git a/drivers/ram/rockchip/sdram_rk3288.c b/drivers/ram/rockchip/sdram_rk3288.c
index 14c30c9080..bb3cf48788 100644
--- a/drivers/ram/rockchip/sdram_rk3288.c
+++ b/drivers/ram/rockchip/sdram_rk3288.c
@@ -1000,7 +1000,7 @@ static int rk3288_dmc_ofdata_to_platdata(struct udevice *dev)
priv->is_veyron = !fdt_node_check_compatible(blob, 0, "google,veyron");
#endif
- ret = regmap_init_mem(dev, &params->map);
+ ret = regmap_init_mem(dev_ofnode(dev), &params->map);
if (ret)
return ret;
#endif
diff --git a/drivers/ram/rockchip/sdram_rk3399.c b/drivers/ram/rockchip/sdram_rk3399.c
index d16ff0d427..49ebd8809f 100644
--- a/drivers/ram/rockchip/sdram_rk3399.c
+++ b/drivers/ram/rockchip/sdram_rk3399.c
@@ -1098,7 +1098,7 @@ static int rk3399_dmc_ofdata_to_platdata(struct udevice *dev)
__func__, ret);
return ret;
}
- ret = regmap_init_mem(dev, &plat->map);
+ ret = regmap_init_mem(dev_ofnode(dev), &plat->map);
if (ret)
printf("%s: regmap failed %d\n", __func__, ret);
diff --git a/drivers/ram/stm32mp1/stm32mp1_ram.c b/drivers/ram/stm32mp1/stm32mp1_ram.c
index a40f992f1a..bd497a3021 100644
--- a/drivers/ram/stm32mp1/stm32mp1_ram.c
+++ b/drivers/ram/stm32mp1/stm32mp1_ram.c
@@ -146,7 +146,7 @@ static int stm32mp1_ddr_probe(struct udevice *dev)
debug("STM32MP1 DDR probe\n");
priv->dev = dev;
- ret = regmap_init_mem(dev, &map);
+ ret = regmap_init_mem(dev_ofnode(dev), &map);
if (ret)
return ret;
diff --git a/drivers/reset/reset-meson.c b/drivers/reset/reset-meson.c
index ef0d043afb..92f04695ec 100644
--- a/drivers/reset/reset-meson.c
+++ b/drivers/reset/reset-meson.c
@@ -76,7 +76,7 @@ static int meson_reset_probe(struct udevice *dev)
{
struct meson_reset_priv *priv = dev_get_priv(dev);
- return regmap_init_mem(dev, &priv->regmap);
+ return regmap_init_mem(dev_ofnode(dev), &priv->regmap);
}
U_BOOT_DRIVER(meson_reset) = {