diff options
author | Simon Glass <sjg@chromium.org> | 2017-01-17 16:52:55 -0700 |
---|---|---|
committer | Simon Glass <sjg@chromium.org> | 2017-02-08 06:12:14 -0700 |
commit | e160f7d430f163bc42757aff3bf2bcac0a459f02 (patch) | |
tree | ce006f94b4a52f6fff567eacd86922c3be6df706 /drivers/pinctrl | |
parent | 8aa41363ebf46b9ff63b311bd2aa793c67a49def (diff) | |
download | u-boot-imx-e160f7d430f163bc42757aff3bf2bcac0a459f02.zip u-boot-imx-e160f7d430f163bc42757aff3bf2bcac0a459f02.tar.gz u-boot-imx-e160f7d430f163bc42757aff3bf2bcac0a459f02.tar.bz2 |
dm: core: Replace of_offset with accessor
At present devices use a simple integer offset to record the device tree
node associated with the device. In preparation for supporting a live
device tree, which uses a node pointer instead, refactor existing code to
access this field through an inline function.
Signed-off-by: Simon Glass <sjg@chromium.org>
Diffstat (limited to 'drivers/pinctrl')
-rw-r--r-- | drivers/pinctrl/ath79/pinctrl_ar933x.c | 2 | ||||
-rw-r--r-- | drivers/pinctrl/ath79/pinctrl_qca953x.c | 2 | ||||
-rw-r--r-- | drivers/pinctrl/exynos/pinctrl-exynos.c | 2 | ||||
-rw-r--r-- | drivers/pinctrl/meson/pinctrl-meson.c | 6 | ||||
-rw-r--r-- | drivers/pinctrl/mvebu/pinctrl-mvebu.c | 6 | ||||
-rw-r--r-- | drivers/pinctrl/nxp/pinctrl-imx.c | 7 | ||||
-rw-r--r-- | drivers/pinctrl/pinctrl-at91-pio4.c | 2 | ||||
-rw-r--r-- | drivers/pinctrl/pinctrl-generic.c | 4 | ||||
-rw-r--r-- | drivers/pinctrl/pinctrl-uclass.c | 4 | ||||
-rw-r--r-- | drivers/pinctrl/pinctrl_pic32.c | 4 | ||||
-rw-r--r-- | drivers/pinctrl/rockchip/pinctrl_rk3036.c | 2 | ||||
-rw-r--r-- | drivers/pinctrl/rockchip/pinctrl_rk3288.c | 4 | ||||
-rw-r--r-- | drivers/pinctrl/rockchip/pinctrl_rk3399.c | 2 |
13 files changed, 24 insertions, 23 deletions
diff --git a/drivers/pinctrl/ath79/pinctrl_ar933x.c b/drivers/pinctrl/ath79/pinctrl_ar933x.c index e3f64b6..fccc7c4 100644 --- a/drivers/pinctrl/ath79/pinctrl_ar933x.c +++ b/drivers/pinctrl/ath79/pinctrl_ar933x.c @@ -75,7 +75,7 @@ static int ar933x_pinctrl_get_periph_id(struct udevice *dev, u32 cell[2]; int ret; - ret = fdtdec_get_int_array(gd->fdt_blob, periph->of_offset, + ret = fdtdec_get_int_array(gd->fdt_blob, dev_of_offset(periph), "interrupts", cell, ARRAY_SIZE(cell)); if (ret < 0) return -EINVAL; diff --git a/drivers/pinctrl/ath79/pinctrl_qca953x.c b/drivers/pinctrl/ath79/pinctrl_qca953x.c index d02597e..a7f8c70 100644 --- a/drivers/pinctrl/ath79/pinctrl_qca953x.c +++ b/drivers/pinctrl/ath79/pinctrl_qca953x.c @@ -95,7 +95,7 @@ static int qca953x_pinctrl_get_periph_id(struct udevice *dev, u32 cell[2]; int ret; - ret = fdtdec_get_int_array(gd->fdt_blob, periph->of_offset, + ret = fdtdec_get_int_array(gd->fdt_blob, dev_of_offset(periph), "interrupts", cell, ARRAY_SIZE(cell)); if (ret < 0) return -EINVAL; diff --git a/drivers/pinctrl/exynos/pinctrl-exynos.c b/drivers/pinctrl/exynos/pinctrl-exynos.c index dd0a16e..5b9a592 100644 --- a/drivers/pinctrl/exynos/pinctrl-exynos.c +++ b/drivers/pinctrl/exynos/pinctrl-exynos.c @@ -70,7 +70,7 @@ static unsigned long pin_to_bank_base(struct udevice *dev, const char *pin_name, int exynos_pinctrl_set_state(struct udevice *dev, struct udevice *config) { const void *fdt = gd->fdt_blob; - int node = config->of_offset; + int node = dev_of_offset(config); unsigned int count, idx, pin_num; unsigned int pinfunc, pinpud, pindrv; unsigned long reg, value; diff --git a/drivers/pinctrl/meson/pinctrl-meson.c b/drivers/pinctrl/meson/pinctrl-meson.c index 30f7cfc..b5486b8 100644 --- a/drivers/pinctrl/meson/pinctrl-meson.c +++ b/drivers/pinctrl/meson/pinctrl-meson.c @@ -142,19 +142,19 @@ int meson_pinctrl_probe(struct udevice *dev) int node, gpio = -1, len; int na, ns; - na = fdt_address_cells(gd->fdt_blob, dev->parent->of_offset); + na = fdt_address_cells(gd->fdt_blob, dev_of_offset(dev->parent)); if (na < 1) { debug("bad #address-cells\n"); return -EINVAL; } - ns = fdt_size_cells(gd->fdt_blob, dev->parent->of_offset); + ns = fdt_size_cells(gd->fdt_blob, dev_of_offset(dev->parent)); if (ns < 1) { debug("bad #size-cells\n"); return -EINVAL; } - fdt_for_each_subnode(node, gd->fdt_blob, dev->of_offset) { + fdt_for_each_subnode(node, gd->fdt_blob, dev_of_offset(dev)) { if (fdt_getprop(gd->fdt_blob, node, "gpio-controller", &len)) { gpio = node; break; diff --git a/drivers/pinctrl/mvebu/pinctrl-mvebu.c b/drivers/pinctrl/mvebu/pinctrl-mvebu.c index b077639..80f0dfa 100644 --- a/drivers/pinctrl/mvebu/pinctrl-mvebu.c +++ b/drivers/pinctrl/mvebu/pinctrl-mvebu.c @@ -28,7 +28,7 @@ DECLARE_GLOBAL_DATA_PTR; int mvebu_pinctrl_set_state(struct udevice *dev, struct udevice *config) { const void *blob = gd->fdt_blob; - int node = config->of_offset; + int node = dev_of_offset(config); struct mvebu_pinctrl_priv *priv; u32 pin_arr[MVEBU_MAX_PINS_PER_BANK]; u32 function; @@ -82,7 +82,7 @@ static int mvebu_pinctrl_set_state_all(struct udevice *dev, struct udevice *config) { const void *blob = gd->fdt_blob; - int node = config->of_offset; + int node = dev_of_offset(config); struct mvebu_pinctrl_priv *priv; u32 func_arr[MVEBU_MAX_PINS_PER_BANK]; int pin, err; @@ -128,7 +128,7 @@ static int mvebu_pinctrl_set_state_all(struct udevice *dev, int mvebu_pinctl_probe(struct udevice *dev) { const void *blob = gd->fdt_blob; - int node = dev->of_offset; + int node = dev_of_offset(dev); struct mvebu_pinctrl_priv *priv; priv = dev_get_priv(dev); diff --git a/drivers/pinctrl/nxp/pinctrl-imx.c b/drivers/pinctrl/nxp/pinctrl-imx.c index 949d0f3..e130faf 100644 --- a/drivers/pinctrl/nxp/pinctrl-imx.c +++ b/drivers/pinctrl/nxp/pinctrl-imx.c @@ -19,7 +19,7 @@ static int imx_pinctrl_set_state(struct udevice *dev, struct udevice *config) { struct imx_pinctrl_priv *priv = dev_get_priv(dev); struct imx_pinctrl_soc_info *info = priv->info; - int node = config->of_offset; + int node = dev_of_offset(config); const struct fdt_property *prop; u32 *pin_data; int npins, size, pin_size; @@ -176,7 +176,7 @@ int imx_pinctrl_probe(struct udevice *dev, struct imx_pinctrl_soc_info *info) { struct imx_pinctrl_priv *priv = dev_get_priv(dev); - int node = dev->of_offset, ret; + int node = dev_of_offset(dev), ret; struct fdtdec_phandle_args arg; fdt_addr_t addr; fdt_size_t size; @@ -189,7 +189,8 @@ int imx_pinctrl_probe(struct udevice *dev, priv->dev = dev; priv->info = info; - addr = fdtdec_get_addr_size(gd->fdt_blob, dev->of_offset, "reg", &size); + addr = fdtdec_get_addr_size(gd->fdt_blob, dev_of_offset(dev), "reg", + &size); if (addr == FDT_ADDR_T_NONE) return -EINVAL; diff --git a/drivers/pinctrl/pinctrl-at91-pio4.c b/drivers/pinctrl/pinctrl-at91-pio4.c index 6d4aadc..5c6bff5 100644 --- a/drivers/pinctrl/pinctrl-at91-pio4.c +++ b/drivers/pinctrl/pinctrl-at91-pio4.c @@ -109,7 +109,7 @@ static int atmel_pinctrl_set_state(struct udevice *dev, struct udevice *config) { struct atmel_pio4_port *bank_base; const void *blob = gd->fdt_blob; - int node = config->of_offset; + int node = dev_of_offset(config); u32 offset, func, bank, line; u32 cells[MAX_PINMUX_ENTRIES]; u32 i, conf; diff --git a/drivers/pinctrl/pinctrl-generic.c b/drivers/pinctrl/pinctrl-generic.c index 3629322..0272496 100644 --- a/drivers/pinctrl/pinctrl-generic.c +++ b/drivers/pinctrl/pinctrl-generic.c @@ -245,7 +245,7 @@ static int pinctrl_generic_set_state_one(struct udevice *dev, bool is_group, unsigned selector) { const void *fdt = gd->fdt_blob; - int node_offset = config->of_offset; + int node_offset = dev_of_offset(config); const char *propname; const void *value; int prop_offset, len, func_selector, param, ret; @@ -300,7 +300,7 @@ static int pinctrl_generic_set_state_subnode(struct udevice *dev, struct udevice *config) { const void *fdt = gd->fdt_blob; - int node = config->of_offset; + int node = dev_of_offset(config); const char *subnode_target_type = "pins"; bool is_group = false; const char *name; diff --git a/drivers/pinctrl/pinctrl-uclass.c b/drivers/pinctrl/pinctrl-uclass.c index 02ab9b4..49afe91 100644 --- a/drivers/pinctrl/pinctrl-uclass.c +++ b/drivers/pinctrl/pinctrl-uclass.c @@ -64,7 +64,7 @@ static int pinctrl_config_one(struct udevice *config) static int pinctrl_select_state_full(struct udevice *dev, const char *statename) { const void *fdt = gd->fdt_blob; - int node = dev->of_offset; + int node = dev_of_offset(dev); char propname[32]; /* long enough */ const fdt32_t *list; uint32_t phandle; @@ -122,7 +122,7 @@ static int pinctrl_select_state_full(struct udevice *dev, const char *statename) static int pinconfig_post_bind(struct udevice *dev) { const void *fdt = gd->fdt_blob; - int offset = dev->of_offset; + int offset = dev_of_offset(dev); bool pre_reloc_only = !(gd->flags & GD_FLG_RELOC); const char *name; int ret; diff --git a/drivers/pinctrl/pinctrl_pic32.c b/drivers/pinctrl/pinctrl_pic32.c index 9acac29..59466ee 100644 --- a/drivers/pinctrl/pinctrl_pic32.c +++ b/drivers/pinctrl/pinctrl_pic32.c @@ -253,7 +253,7 @@ static int pic32_pinctrl_get_periph_id(struct udevice *dev, int ret; u32 cell[2]; - ret = fdtdec_get_int_array(gd->fdt_blob, periph->of_offset, + ret = fdtdec_get_int_array(gd->fdt_blob, dev_of_offset(periph), "interrupts", cell, ARRAY_SIZE(cell)); if (ret < 0) return -EINVAL; @@ -310,7 +310,7 @@ static int pic32_pinctrl_probe(struct udevice *dev) struct pic32_pinctrl_priv *priv = dev_get_priv(dev); struct fdt_resource res; void *fdt = (void *)gd->fdt_blob; - int node = dev->of_offset; + int node = dev_of_offset(dev); int ret; ret = fdt_get_named_resource(fdt, node, "reg", "reg-names", diff --git a/drivers/pinctrl/rockchip/pinctrl_rk3036.c b/drivers/pinctrl/rockchip/pinctrl_rk3036.c index 6aea856..8d42584 100644 --- a/drivers/pinctrl/rockchip/pinctrl_rk3036.c +++ b/drivers/pinctrl/rockchip/pinctrl_rk3036.c @@ -205,7 +205,7 @@ static int rk3036_pinctrl_get_periph_id(struct udevice *dev, u32 cell[3]; int ret; - ret = fdtdec_get_int_array(gd->fdt_blob, periph->of_offset, + ret = fdtdec_get_int_array(gd->fdt_blob, dev_of_offset(periph), "interrupts", cell, ARRAY_SIZE(cell)); if (ret < 0) return -EINVAL; diff --git a/drivers/pinctrl/rockchip/pinctrl_rk3288.c b/drivers/pinctrl/rockchip/pinctrl_rk3288.c index 0322264..cb13d30 100644 --- a/drivers/pinctrl/rockchip/pinctrl_rk3288.c +++ b/drivers/pinctrl/rockchip/pinctrl_rk3288.c @@ -479,7 +479,7 @@ static int rk3288_pinctrl_get_periph_id(struct udevice *dev, u32 cell[3]; int ret; - ret = fdtdec_get_int_array(gd->fdt_blob, periph->of_offset, + ret = fdtdec_get_int_array(gd->fdt_blob, dev_of_offset(periph), "interrupts", cell, ARRAY_SIZE(cell)); if (ret < 0) return -EINVAL; @@ -644,7 +644,7 @@ static int rk3288_pinctrl_set_state(struct udevice *dev, struct udevice *config) u32 cell[60], *ptr; debug("%s: %s %s\n", __func__, dev->name, config->name); - ret = fdtdec_get_int_array_count(blob, config->of_offset, + ret = fdtdec_get_int_array_count(blob, dev_of_offset(config), "rockchip,pins", cell, ARRAY_SIZE(cell)); if (ret < 0) { diff --git a/drivers/pinctrl/rockchip/pinctrl_rk3399.c b/drivers/pinctrl/rockchip/pinctrl_rk3399.c index 17ea165..da30154 100644 --- a/drivers/pinctrl/rockchip/pinctrl_rk3399.c +++ b/drivers/pinctrl/rockchip/pinctrl_rk3399.c @@ -362,7 +362,7 @@ static int rk3399_pinctrl_get_periph_id(struct udevice *dev, u32 cell[3]; int ret; - ret = fdtdec_get_int_array(gd->fdt_blob, periph->of_offset, + ret = fdtdec_get_int_array(gd->fdt_blob, dev_of_offset(periph), "interrupts", cell, ARRAY_SIZE(cell)); if (ret < 0) return -EINVAL; |