]> git.dujemihanovic.xyz Git - u-boot.git/commitdiff
dm: core: Replace of_offset with accessor
authorSimon Glass <sjg@chromium.org>
Tue, 17 Jan 2017 23:52:55 +0000 (16:52 -0700)
committerSimon Glass <sjg@chromium.org>
Wed, 8 Feb 2017 13:12:14 +0000 (06:12 -0700)
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>
220 files changed:
arch/arm/mach-aspeed/ast2500/sdram_ast2500.c
arch/arm/mach-rockchip/rk3288/sdram_rk3288.c
arch/nios2/cpu/cpu.c
arch/x86/cpu/broadwell/cpu.c
arch/x86/cpu/broadwell/pch.c
arch/x86/cpu/broadwell/pinctrl_broadwell.c
arch/x86/cpu/broadwell/sata.c
arch/x86/cpu/cpu_x86.c
arch/x86/cpu/intel_common/lpc.c
arch/x86/cpu/intel_common/mrc.c
arch/x86/cpu/irq.c
arch/x86/cpu/ivybridge/lpc.c
arch/x86/cpu/ivybridge/model_206ax.c
arch/x86/cpu/ivybridge/sata.c
arch/x86/cpu/mp_init.c
arch/x86/lib/mpspec.c
arch/x86/lib/pinctrl_ich6.c
board/qualcomm/dragonboard410c/dragonboard410c.c
doc/driver-model/README.txt
doc/driver-model/of-plat.txt
doc/driver-model/spi-howto.txt
drivers/adc/adc-uclass.c
drivers/clk/at91/clk-generated.c
drivers/clk/at91/pmc.c
drivers/clk/clk-uclass.c
drivers/clk/clk_fixed_rate.c
drivers/clk/clk_pic32.c
drivers/core/device.c
drivers/core/regmap.c
drivers/core/root.c
drivers/core/simple-bus.c
drivers/core/uclass.c
drivers/demo/demo-shape.c
drivers/demo/demo-uclass.c
drivers/gpio/74x164_gpio.c
drivers/gpio/altera_pio.c
drivers/gpio/atmel_pio4.c
drivers/gpio/dwapb_gpio.c
drivers/gpio/gpio-uclass.c
drivers/gpio/intel_broadwell_gpio.c
drivers/gpio/intel_ich6_gpio.c
drivers/gpio/lpc32xx_gpio.c
drivers/gpio/mpc85xx_gpio.c
drivers/gpio/msm_gpio.c
drivers/gpio/omap_gpio.c
drivers/gpio/pca953x_gpio.c
drivers/gpio/pcf8575_gpio.c
drivers/gpio/pic32_gpio.c
drivers/gpio/pm8916_gpio.c
drivers/gpio/s5p_gpio.c
drivers/gpio/sandbox.c
drivers/gpio/sunxi_gpio.c
drivers/gpio/tegra186_gpio.c
drivers/gpio/tegra_gpio.c
drivers/gpio/vybrid_gpio.c
drivers/i2c/at91_i2c.c
drivers/i2c/cros_ec_tunnel.c
drivers/i2c/exynos_hs_i2c.c
drivers/i2c/fsl_i2c.c
drivers/i2c/i2c-gpio.c
drivers/i2c/i2c-uclass.c
drivers/i2c/muxes/i2c-arb-gpio-challenge.c
drivers/i2c/muxes/i2c-mux-uclass.c
drivers/i2c/muxes/pca954x.c
drivers/i2c/mvtwsi.c
drivers/i2c/mxc_i2c.c
drivers/i2c/s3c24x0_i2c.c
drivers/i2c/tegra186_bpmp_i2c.c
drivers/input/cros_ec_keyb.c
drivers/input/i8042.c
drivers/input/tegra-kbc.c
drivers/led/led_gpio.c
drivers/mailbox/mailbox-uclass.c
drivers/misc/cros_ec.c
drivers/misc/cros_ec_sandbox.c
drivers/misc/i2c_eeprom_emul.c
drivers/misc/tegra186_bpmp.c
drivers/misc/tegra_car.c
drivers/mmc/atmel_sdhci.c
drivers/mmc/exynos_dw_mmc.c
drivers/mmc/fsl_esdhc.c
drivers/mmc/msm_sdhci.c
drivers/mmc/omap_hsmmc.c
drivers/mmc/pic32_sdhci.c
drivers/mmc/rockchip_dw_mmc.c
drivers/mmc/rockchip_sdhci.c
drivers/mmc/s5p_sdhci.c
drivers/mmc/socfpga_dw_mmc.c
drivers/mmc/tegra_mmc.c
drivers/mmc/uniphier-sd.c
drivers/mmc/xenon_sdhci.c
drivers/mtd/altera_qspi.c
drivers/mtd/cfi_flash.c
drivers/mtd/pic32_flash.c
drivers/mtd/spi/sandbox.c
drivers/mtd/spi/spi_flash.c
drivers/net/ag7xxx.c
drivers/net/altera_tse.c
drivers/net/cpsw-common.c
drivers/net/cpsw.c
drivers/net/designware.c
drivers/net/fec_mxc.c
drivers/net/gmac_rockchip.c
drivers/net/keystone_net.c
drivers/net/macb.c
drivers/net/mvneta.c
drivers/net/mvpp2.c
drivers/net/phy/micrel.c
drivers/net/phy/ti.c
drivers/net/phy/xilinx_phy.c
drivers/net/pic32_eth.c
drivers/net/sandbox-raw.c
drivers/net/sandbox.c
drivers/net/sun8i_emac.c
drivers/net/tsec.c
drivers/net/xilinx_axi_emac.c
drivers/net/xilinx_emaclite.c
drivers/net/zynq_gem.c
drivers/pci/pci-uclass.c
drivers/pci/pci_tegra.c
drivers/pci/pcie_layerscape.c
drivers/pci/pcie_xilinx.c
drivers/phy/marvell/comphy_core.c
drivers/pinctrl/ath79/pinctrl_ar933x.c
drivers/pinctrl/ath79/pinctrl_qca953x.c
drivers/pinctrl/exynos/pinctrl-exynos.c
drivers/pinctrl/meson/pinctrl-meson.c
drivers/pinctrl/mvebu/pinctrl-mvebu.c
drivers/pinctrl/nxp/pinctrl-imx.c
drivers/pinctrl/pinctrl-at91-pio4.c
drivers/pinctrl/pinctrl-generic.c
drivers/pinctrl/pinctrl-uclass.c
drivers/pinctrl/pinctrl_pic32.c
drivers/pinctrl/rockchip/pinctrl_rk3036.c
drivers/pinctrl/rockchip/pinctrl_rk3288.c
drivers/pinctrl/rockchip/pinctrl_rk3399.c
drivers/power/domain/power-domain-uclass.c
drivers/power/pmic/act8846.c
drivers/power/pmic/i2c_pmic_emul.c
drivers/power/pmic/lp873x.c
drivers/power/pmic/max77686.c
drivers/power/pmic/palmas.c
drivers/power/pmic/pfuze100.c
drivers/power/pmic/pmic-uclass.c
drivers/power/pmic/rk808.c
drivers/power/pmic/s5m8767.c
drivers/power/pmic/sandbox.c
drivers/power/pmic/tps65090.c
drivers/power/regulator/fixed.c
drivers/power/regulator/gpio-regulator.c
drivers/power/regulator/pwm_regulator.c
drivers/power/regulator/regulator-uclass.c
drivers/remoteproc/rproc-uclass.c
drivers/remoteproc/ti_power_proc.c
drivers/reset/reset-uclass.c
drivers/serial/altera_uart.c
drivers/serial/ns16550.c
drivers/serial/sandbox.c
drivers/serial/serial_arc.c
drivers/serial/serial_bcm283x_mu.c
drivers/serial/serial_msm.c
drivers/serial/serial_mxc.c
drivers/serial/serial_pic32.c
drivers/serial/serial_pl01x.c
drivers/serial/serial_s5p.c
drivers/serial/serial_sh.c
drivers/serial/serial_uniphier.c
drivers/spi/cadence_qspi.c
drivers/spi/davinci_spi.c
drivers/spi/designware_spi.c
drivers/spi/exynos_spi.c
drivers/spi/fsl_dspi.c
drivers/spi/fsl_qspi.c
drivers/spi/ich.c
drivers/spi/mvebu_a3700_spi.c
drivers/spi/omap3_spi.c
drivers/spi/pic32_spi.c
drivers/spi/rk_spi.c
drivers/spi/soft_spi.c
drivers/spi/spi-uclass.c
drivers/spi/stm32_qspi.c
drivers/spi/tegra114_spi.c
drivers/spi/tegra20_sflash.c
drivers/spi/tegra20_slink.c
drivers/spi/tegra210_qspi.c
drivers/spi/ti_qspi.c
drivers/spi/zynq_qspi.c
drivers/spi/zynq_spi.c
drivers/spmi/spmi-msm.c
drivers/sysreset/sysreset_sandbox.c
drivers/timer/timer-uclass.c
drivers/usb/emul/sandbox_flash.c
drivers/usb/emul/sandbox_hub.c
drivers/usb/host/dwc2.c
drivers/usb/host/ehci-exynos.c
drivers/usb/host/ehci-fsl.c
drivers/usb/host/ehci-mx6.c
drivers/usb/host/ehci-tegra.c
drivers/usb/host/ehci-vf.c
drivers/usb/host/usb-uclass.c
drivers/usb/host/xhci-exynos5.c
drivers/usb/host/xhci-rockchip.c
drivers/usb/musb-new/pic32.c
drivers/usb/musb-new/ti-musb.c
drivers/video/atmel_lcdfb.c
drivers/video/bridge/ps862x.c
drivers/video/broadwell_igd.c
drivers/video/exynos/exynos_dp.c
drivers/video/exynos/exynos_fb.c
drivers/video/ivybridge_igd.c
drivers/video/pwm_backlight.c
drivers/video/rockchip/rk_lvds.c
drivers/video/rockchip/rk_vop.c
drivers/video/sandbox_sdl.c
drivers/video/tegra.c
drivers/video/tegra124/display.c
drivers/video/tegra124/sor.c
include/dm/device.h
test/dm/spi.c
test/dm/test-fdt.c

index ace102811661215e1d9089129e92786abd0a58d5..cb6e03fa3426afa1d0a452e156aef8ec24ad0f43 100644 (file)
@@ -392,7 +392,7 @@ static int ast2500_sdrammc_ofdata_to_platdata(struct udevice *dev)
        priv->regs = regmap_get_range(map, 0);
        priv->phy = regmap_get_range(map, 1);
 
-       priv->clock_rate = fdtdec_get_int(gd->fdt_blob, dev->of_offset,
+       priv->clock_rate = fdtdec_get_int(gd->fdt_blob, dev_of_offset(dev),
                                          "clock-frequency", 0);
 
        if (!priv->clock_rate) {
index be3d7132020f3999f83ec3dbcd3ec2c236fbec2b..89fd8e6bff1114a80727e44102dccf62358b9124 100644 (file)
@@ -1016,7 +1016,7 @@ static int rk3288_dmc_ofdata_to_platdata(struct udevice *dev)
 #if !CONFIG_IS_ENABLED(OF_PLATDATA)
        struct rk3288_sdram_params *params = dev_get_platdata(dev);
        const void *blob = gd->fdt_blob;
-       int node = dev->of_offset;
+       int node = dev_of_offset(dev);
        int ret;
 
        /* Rk3288 supports dual-channel, set default channel num to 2 */
index 4f0f8fc5f8bb7c103776c89459feeccf390945c4..c1caa651742bbfb7c922a3bbc736086876150b92 100644 (file)
@@ -103,7 +103,7 @@ static int altera_nios2_get_count(struct udevice *dev)
 static int altera_nios2_probe(struct udevice *dev)
 {
        const void *blob = gd->fdt_blob;
-       int node = dev->of_offset;
+       int node = dev_of_offset(dev);
 
        gd->cpu_clk = fdtdec_get_int(blob, node,
                "clock-frequency", 0);
index 6977e860321fa3d83187c45ff41f7f1c75c8b99f..1b71d566c950829a4acba505e23284c3685eb661 100644 (file)
@@ -256,8 +256,8 @@ static void initialize_vr_config(struct udevice *dev)
        /* Set the slow ramp rate */
        msr.hi &= ~(0x3 << (53 - 32));
        /* Configure the C-state exit ramp rate */
-       ramp = fdtdec_get_int(gd->fdt_blob, dev->of_offset, "intel,slow-ramp",
-                             -1);
+       ramp = fdtdec_get_int(gd->fdt_blob, dev_of_offset(dev),
+                             "intel,slow-ramp", -1);
        if (ramp != -1) {
                /* Configured slow ramp rate */
                msr.hi |= ((ramp & 0x3) << (53 - 32));
@@ -271,8 +271,8 @@ static void initialize_vr_config(struct udevice *dev)
        }
        /* Set MIN_VID (31:24) to allow CPU to have full control */
        msr.lo &= ~0xff000000;
-       min_vid = fdtdec_get_int(gd->fdt_blob, dev->of_offset, "intel,min-vid",
-                                0);
+       min_vid = fdtdec_get_int(gd->fdt_blob, dev_of_offset(dev),
+                                "intel,min-vid", 0);
        msr.lo |= (min_vid & 0xff) << 24;
        msr_write(MSR_VR_MISC_CONFIG, msr);
 
@@ -562,7 +562,7 @@ static void configure_thermal_target(struct udevice *dev)
        int tcc_offset;
        msr_t msr;
 
-       tcc_offset = fdtdec_get_int(gd->fdt_blob, dev->of_offset,
+       tcc_offset = fdtdec_get_int(gd->fdt_blob, dev_of_offset(dev),
                                    "intel,tcc-offset", 0);
 
        /* Set TCC activaiton offset if supported */
index 317f57d3f9819f3a2de1185955fd200c196536bd..16eac3daae6f73640ae7f7e86e74ecfad477102e 100644 (file)
@@ -190,14 +190,14 @@ static int pch_power_options(struct udevice *dev)
        debug("Set power %s after power failure.\n", state);
 
        /* GPE setup based on device tree configuration */
-       ret = fdtdec_get_int_array(gd->fdt_blob, dev->of_offset,
+       ret = fdtdec_get_int_array(gd->fdt_blob, dev_of_offset(dev),
                                   "intel,gpe0-en", enable, ARRAY_SIZE(enable));
        if (ret)
                return -EINVAL;
        enable_all_gpe(enable[0], enable[1], enable[2], enable[3]);
 
        /* SMI setup based on device tree configuration */
-       enable_alt_smi(dev, fdtdec_get_int(gd->fdt_blob, dev->of_offset,
+       enable_alt_smi(dev, fdtdec_get_int(gd->fdt_blob, dev_of_offset(dev),
                                           "intel,alt-gp-smi-enable", 0));
 
        return 0;
index 2a3fcedd0dbc9de38e6311ad570a8a0ff46c078c..881413f476977b1e1fb4aa5ace018c6f9449a767 100644 (file)
@@ -51,7 +51,7 @@ static int broadwell_pinctrl_read_configs(struct udevice *dev,
        int node;
 
        debug("%s: starting\n", __func__);
-       for (node = fdt_first_subnode(blob, dev->of_offset);
+       for (node = fdt_first_subnode(blob, dev_of_offset(dev));
             node > 0;
             node = fdt_next_subnode(blob, node)) {
                int phandle = fdt_get_phandle(blob, node);
@@ -115,7 +115,7 @@ static int broadwell_pinctrl_read_pins(struct udevice *dev,
        int count = 0;
        int node;
 
-       for (node = fdt_first_subnode(blob, dev->of_offset);
+       for (node = fdt_first_subnode(blob, dev_of_offset(dev));
             node > 0;
             node = fdt_next_subnode(blob, node)) {
                int len, i;
index 2e4708262c1daa41411a7acc9b3b1e37778d3fbe..10461d99a8c10c30a890fb52134b19a3fc713dd8 100644 (file)
@@ -235,7 +235,7 @@ static int broadwell_sata_ofdata_to_platdata(struct udevice *dev)
 {
        struct sata_platdata *plat = dev_get_platdata(dev);
        const void *blob = gd->fdt_blob;
-       int node = dev->of_offset;
+       int node = dev_of_offset(dev);
 
        plat->port_map = fdtdec_get_int(blob, node, "intel,sata-port-map", 0);
        plat->port0_gen3_tx = fdtdec_get_int(blob, node,
index 157f3de6d81e00dbd2f2e3651157fd84d389dbe1..8be14b5929110dd4dd29d107d4168630fb6b4065 100644 (file)
@@ -17,7 +17,7 @@ int cpu_x86_bind(struct udevice *dev)
        struct cpu_platdata *plat = dev_get_parent_platdata(dev);
        struct cpuid_result res;
 
-       plat->cpu_id = fdtdec_get_int(gd->fdt_blob, dev->of_offset,
+       plat->cpu_id = fdtdec_get_int(gd->fdt_blob, dev_of_offset(dev),
                                      "intel,apic-id", -1);
        plat->family = gd->arch.x86;
        res = cpuid(1);
index 03cb45b636912ddc59407c89e7bc790dfb1f8e3f..696b6304fe1a4fd96fae03534f6f0ef30587763e 100644 (file)
@@ -50,7 +50,7 @@ int lpc_common_early_init(struct udevice *dev)
        int count;
        int i;
 
-       count = fdtdec_get_int_array_count(gd->fdt_blob, dev->of_offset,
+       count = fdtdec_get_int_array_count(gd->fdt_blob, dev_of_offset(dev),
                        "intel,gen-dec", (u32 *)values,
                        sizeof(values) / sizeof(u32));
        if (count < 0)
index 01b6e866b5b71e5c130e220a2b1305ad39ea1362..f1a249af72ce402c4bf3558e9612ec2239c6acd7 100644 (file)
@@ -149,7 +149,7 @@ int mrc_locate_spd(struct udevice *dev, int size, const void **spd_datap)
        spd_index = dm_gpio_get_values_as_int(desc, ret);
        debug("spd index %d\n", spd_index);
 
-       node = fdt_first_subnode(blob, dev->of_offset);
+       node = fdt_first_subnode(blob, dev_of_offset(dev));
        if (node < 0)
                return -EINVAL;
        for (spd_node = fdt_first_subnode(blob, node);
index d2901de6d5888bf943fd03cf891ae204b0195834..f5654eb510d5888b2ae8f077a446fbfbb8817cee 100644 (file)
@@ -96,7 +96,7 @@ static int create_pirq_routing_table(struct udevice *dev)
        int i;
        int ret;
 
-       node = dev->of_offset;
+       node = dev_of_offset(dev);
 
        /* extract the bdf from fdt_pci_addr */
        priv->bdf = dm_pci_get_bdf(dev->parent);
index aef1206be41832b6a522d4780ad2d19a5f0313f3..4e254b3c57146d85ad7caf84d0bf759ed0c1d728 100644 (file)
@@ -86,7 +86,7 @@ static int pch_pirq_init(struct udevice *pch)
 {
        uint8_t route[8], *ptr;
 
-       if (fdtdec_get_byte_array(gd->fdt_blob, pch->of_offset,
+       if (fdtdec_get_byte_array(gd->fdt_blob, dev_of_offset(pch),
                                  "intel,pirq-routing", route, sizeof(route)))
                return -EINVAL;
        ptr = route;
@@ -113,7 +113,7 @@ static int pch_gpi_routing(struct udevice *pch)
        u32 reg;
        int gpi;
 
-       if (fdtdec_get_byte_array(gd->fdt_blob, pch->of_offset,
+       if (fdtdec_get_byte_array(gd->fdt_blob, dev_of_offset(pch),
                                  "intel,gpi-routing", route, sizeof(route)))
                return -EINVAL;
 
@@ -128,7 +128,7 @@ static int pch_gpi_routing(struct udevice *pch)
 static int pch_power_options(struct udevice *pch)
 {
        const void *blob = gd->fdt_blob;
-       int node = pch->of_offset;
+       int node = dev_of_offset(pch);
        u8 reg8;
        u16 reg16, pmbase;
        u32 reg32;
index d5f32196ae386854b59f5b90fe7d73097ee52b4b..81dedee2ec097125c86fdc85e0538cc7dbae45b8 100644 (file)
@@ -288,8 +288,8 @@ static int configure_thermal_target(struct udevice *dev)
        int tcc_offset;
        msr_t msr;
 
-       tcc_offset = fdtdec_get_int(gd->fdt_blob, dev->of_offset, "tcc-offset",
-                                   0);
+       tcc_offset = fdtdec_get_int(gd->fdt_blob, dev_of_offset(dev),
+                                   "tcc-offset", 0);
 
        /* Set TCC activaiton offset if supported */
        msr = msr_read(MSR_PLATFORM_INFO);
index c7ffbc11fd976725a5d0fb5c763149d09b126d08..0f5e19042575fe4117735137ea026be729806c73 100644 (file)
@@ -39,7 +39,7 @@ static void bd82x6x_sata_init(struct udevice *dev, struct udevice *pch)
 {
        unsigned int port_map, speed_support, port_tx;
        const void *blob = gd->fdt_blob;
-       int node = dev->of_offset;
+       int node = dev_of_offset(dev);
        const char *mode;
        u32 reg32;
        u16 reg16;
@@ -190,7 +190,7 @@ static void bd82x6x_sata_init(struct udevice *dev, struct udevice *pch)
 static void bd82x6x_sata_enable(struct udevice *dev)
 {
        const void *blob = gd->fdt_blob;
-       int node = dev->of_offset;
+       int node = dev_of_offset(dev);
        unsigned port_map;
        const char *mode;
        u16 map = 0;
index 2b6b3bd04e6d137b1078d208fa22a42985439332..988073cc7953f188cf1ffc7758263df83934b437 100644 (file)
@@ -568,7 +568,8 @@ int mp_init_cpu(struct udevice *cpu, void *unused)
         * seq num in the uclass_resolve_seq() during device_probe(). To avoid
         * this, set req_seq to the reg number in the device tree in advance.
         */
-       cpu->req_seq = fdtdec_get_int(gd->fdt_blob, cpu->of_offset, "reg", -1);
+       cpu->req_seq = fdtdec_get_int(gd->fdt_blob, dev_of_offset(cpu), "reg",
+                                     -1);
        plat->ucode_version = microcode_read_rev();
        plat->device_id = gd->arch.x86_device;
 
index 17e977ce5e3d56f889e8d92d0aae92bfc298ee7e..a6e493d69af9aa814fa4398fcd5eaa510a5e5794 100644 (file)
@@ -304,7 +304,8 @@ static int mptable_add_intsrc(struct mp_config_table *mc,
        }
 
        /* Get I/O interrupt information from device tree */
-       cell = fdt_getprop(blob, dev->of_offset, "intel,pirq-routing", &len);
+       cell = fdt_getprop(blob, dev_of_offset(dev), "intel,pirq-routing",
+                          &len);
        if (!cell)
                return -ENOENT;
 
index fb2d2940c9530e3e58506feff5b9a899ff1ddc0b..406852d324daf189ccc4133729feda9787bbeb4e 100644 (file)
@@ -187,7 +187,7 @@ static int ich6_pinctrl_probe(struct udevice *dev)
                return -EINVAL;
        }
 
-       for (pin_node = fdt_first_subnode(gd->fdt_blob, dev->of_offset);
+       for (pin_node = fdt_first_subnode(gd->fdt_blob, dev_of_offset(dev));
             pin_node > 0;
             pin_node = fdt_next_subnode(gd->fdt_blob, pin_node)) {
                /* Configure the pin */
index 1fa566436b4585744c1b1f1c8dc8a2363d4ae12c..818ae04dfd015c2c0d6c1b9ed0e4c1db9bd4a1b5 100644 (file)
@@ -44,7 +44,8 @@ int board_prepare_usb(enum usb_init_type type)
 
        /* Try to request gpios needed to start usb host on dragonboard */
        if (!dm_gpio_is_valid(&hub_reset)) {
-               node = fdt_subnode_offset(gd->fdt_blob, pmic_gpio->of_offset,
+               node = fdt_subnode_offset(gd->fdt_blob,
+                                         dev_of_offset(pmic_gpio),
                                          "usb_hub_reset_pm");
                if (node < 0) {
                        printf("Failed to find usb_hub_reset_pm dt node.\n");
@@ -59,7 +60,8 @@ int board_prepare_usb(enum usb_init_type type)
        }
 
        if (!dm_gpio_is_valid(&usb_sel)) {
-               node = fdt_subnode_offset(gd->fdt_blob, pmic_gpio->of_offset,
+               node = fdt_subnode_offset(gd->fdt_blob,
+                                         dev_of_offset(pmic_gpio),
                                          "usb_sw_sel_pm");
                if (node < 0) {
                        printf("Failed to find usb_sw_sel_pm dt node.\n");
@@ -110,7 +112,8 @@ int misc_init_r(void)
                return 0;
        }
 
-       node = fdt_subnode_offset(gd->fdt_blob, pon->of_offset, "key_vol_down");
+       node = fdt_subnode_offset(gd->fdt_blob, dev_of_offset(pon),
+                                 "key_vol_down");
        if (node < 0) {
                printf("Failed to find key_vol_down node. Check device tree\n");
                return 0;
index 1b5ccec4b2e58ef9c611dc27a022967685ea49a0..fea324e25eee876f931a56807f9dfc360943ed71 100644 (file)
@@ -684,7 +684,7 @@ steps (see device_probe()):
 
    g. If the driver provides an ofdata_to_platdata() method, then this is
    called to convert the device tree data into platform data. This should
-   do various calls like fdtdec_get_int(gd->fdt_blob, dev->of_offset, ...)
+   do various calls like fdtdec_get_int(gd->fdt_blob, dev_of_offset(dev), ...)
    to access the node and store the resulting information into dev->platdata.
    After this point, the device works the same way whether it was bound
    using a device tree node or U_BOOT_DEVICE() structure. In either case,
index 86e5e25300c318ee760b9ccdbc983eb724042ebb..0063bfe510cd7fbffdb01ba5a5994ac4d8369398 100644 (file)
@@ -205,7 +205,7 @@ For example:
             /* Decode the device tree data */
             struct mmc_platdata *plat = dev_get_platdata(dev);
             const void *blob = gd->fdt_blob;
-            int node = dev->of_offset;
+            int node = dev_of_offset(dev);
 
             plat->fifo_depth = fdtdec_get_int(blob, node, "fifo-depth", 0);
     #endif
index ee4abf4a8b49cc8b8ab2de8521fe91522afb3e14..1955ffe284eafd4aec984ad1aedac49ff11e6d29 100644 (file)
@@ -223,7 +223,7 @@ static int exynos_spi_ofdata_to_platdata(struct udevice *bus)
 {
        struct exynos_spi_platdata *plat = bus->platdata;
        const void *blob = gd->fdt_blob;
-       int node = bus->of_offset;
+       int node = dev_of_offset(bus);
 
        plat->regs = (struct exynos_spi *)fdtdec_get_addr(blob, node, "reg");
        plat->periph_id = pinmux_decode_periph_id(blob, node);
index 9233fcdb6c1edb67befd534b681c0db80c26024b..3e28a5600bf7738a1b81fbd822f76a891c339139 100644 (file)
@@ -345,7 +345,7 @@ nodev:
 static int adc_vdd_platdata_set(struct udevice *dev)
 {
        struct adc_uclass_platdata *uc_pdata = dev_get_uclass_platdata(dev);
-       int ret, offset = dev->of_offset;
+       int ret, offset = dev_of_offset(dev);
        const void *fdt = gd->fdt_blob;
        char *prop;
 
@@ -366,7 +366,7 @@ static int adc_vdd_platdata_set(struct udevice *dev)
 static int adc_vss_platdata_set(struct udevice *dev)
 {
        struct adc_uclass_platdata *uc_pdata = dev_get_uclass_platdata(dev);
-       int ret, offset = dev->of_offset;
+       int ret, offset = dev_of_offset(dev);
        const void *fdt = gd->fdt_blob;
        char *prop;
 
index d36f64ffdf81b7df371b67f77c70cb356ef210d9..ac27d3e675039545d565923b472461fe104305fb 100644 (file)
@@ -154,9 +154,8 @@ static int generic_clk_ofdata_to_platdata(struct udevice *dev)
        u32 num_parents;
 
        num_parents = fdtdec_get_int_array_count(gd->fdt_blob,
-                                                dev_get_parent(dev)->of_offset,
-                                                "clocks", cells,
-                                                GENERATED_SOURCE_MAX);
+                       dev_of_offset(dev_get_parent(dev)), "clocks", cells,
+                       GENERATED_SOURCE_MAX);
 
        if (!num_parents)
                return -1;
index 76ba91af81209296585eae984e6143b3719c0db0..c73156a0df1e095f8b625097cd481d63f1b81b3a 100644 (file)
@@ -47,7 +47,7 @@ int at91_pmc_core_probe(struct udevice *dev)
 int at91_clk_sub_device_bind(struct udevice *dev, const char *drv_name)
 {
        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;
@@ -90,7 +90,8 @@ int at91_clk_of_xlate(struct clk *clk, struct fdtdec_phandle_args *args)
                return -EINVAL;
        }
 
-       periph = fdtdec_get_uint(gd->fdt_blob, clk->dev->of_offset, "reg", -1);
+       periph = fdtdec_get_uint(gd->fdt_blob, dev_of_offset(clk->dev), "reg",
+                                -1);
        if (periph < 0)
                return -EINVAL;
 
index 153ceba702d621158c238322e1345516125fc31f..6fcfd6997c88d32a312b7ec2fb0b919a870b874b 100644 (file)
@@ -65,7 +65,7 @@ int clk_get_by_index(struct udevice *dev, int index, struct clk *clk)
        debug("%s(dev=%p, index=%d, clk=%p)\n", __func__, dev, index, clk);
 
        assert(clk);
-       ret = fdtdec_parse_phandle_with_args(gd->fdt_blob, dev->of_offset,
+       ret = fdtdec_parse_phandle_with_args(gd->fdt_blob, dev_of_offset(dev),
                                             "clocks", "#clock-cells", 0, index,
                                             &args);
        if (ret) {
@@ -104,7 +104,7 @@ int clk_get_by_name(struct udevice *dev, const char *name, struct clk *clk)
 
        debug("%s(dev=%p, name=%s, clk=%p)\n", __func__, dev, name, clk);
 
-       index = fdt_stringlist_search(gd->fdt_blob, dev->of_offset,
+       index = fdt_stringlist_search(gd->fdt_blob, dev_of_offset(dev),
                                      "clock-names", name);
        if (index < 0) {
                debug("fdt_stringlist_search() failed: %d\n", index);
index 9c4d2b322f707e63cf43407792a740074f1b1939..3911bf61a03a2f9395c23204eed96eac19b48753 100644 (file)
@@ -32,7 +32,7 @@ static int clk_fixed_rate_ofdata_to_platdata(struct udevice *dev)
 {
 #if !CONFIG_IS_ENABLED(OF_PLATDATA)
        to_clk_fixed_rate(dev)->fixed_rate =
-                               fdtdec_get_int(gd->fdt_blob, dev->of_offset,
+                               fdtdec_get_int(gd->fdt_blob, dev_of_offset(dev),
                                               "clock-frequency", 0);
 #endif
 
index 70ec3543cf90eadf9b79e8f01631e1a8a454e3d7..f6eef314ec312d0fb726c52426bb381018fe891a 100644 (file)
@@ -330,7 +330,7 @@ static void pic32_clk_init(struct udevice *dev)
        for (i = REF1CLK; i <= REF5CLK; i++) {
                snprintf(propname, sizeof(propname),
                         "microchip,refo%d-frequency", i - REF1CLK + 1);
-               rate = fdtdec_get_int(blob, dev->of_offset, propname, 0);
+               rate = fdtdec_get_int(blob, dev_of_offset(dev), propname, 0);
                if (rate)
                        pic32_set_refclk(priv, i, pll_hz, rate, ROCLK_SRC_SPLL);
        }
@@ -393,7 +393,8 @@ static int pic32_clk_probe(struct udevice *dev)
        fdt_addr_t addr;
        fdt_size_t size;
 
-       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;
 
index ed553d70a6bc0d62e22513f68fb8d2f9419c0075..70fcfc23e0cbceb78e3440e759f225f10932f474 100644 (file)
@@ -355,7 +355,7 @@ int device_probe(struct udevice *dev)
                        goto fail;
        }
 
-       if (drv->ofdata_to_platdata && dev->of_offset >= 0) {
+       if (drv->ofdata_to_platdata && dev_of_offset(dev) >= 0) {
                ret = drv->ofdata_to_platdata(dev);
                if (ret)
                        goto fail;
@@ -524,7 +524,7 @@ int device_find_child_by_of_offset(struct udevice *parent, int of_offset,
        *devp = NULL;
 
        list_for_each_entry(dev, &parent->child_head, sibling_node) {
-               if (dev->of_offset == of_offset) {
+               if (dev_of_offset(dev) == of_offset) {
                        *devp = dev;
                        return 0;
                }
@@ -549,7 +549,7 @@ static struct udevice *_device_find_global_by_of_offset(struct udevice *parent,
 {
        struct udevice *dev, *found;
 
-       if (parent->of_offset == of_offset)
+       if (dev_of_offset(parent) == of_offset)
                return parent;
 
        list_for_each_entry(dev, &parent->child_head, sibling_node) {
@@ -637,19 +637,21 @@ fdt_addr_t dev_get_addr_index(struct udevice *dev, int index)
                int len = 0;
                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 FDT_ADDR_T_NONE;
                }
 
-               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 < 0) {
                        debug("bad #size-cells\n");
                        return FDT_ADDR_T_NONE;
                }
 
-               reg = fdt_getprop(gd->fdt_blob, dev->of_offset, "reg", &len);
+               reg = fdt_getprop(gd->fdt_blob, dev_of_offset(dev), "reg",
+                                 &len);
                if (!reg || (len <= (index * sizeof(fdt32_t) * (na + ns)))) {
                        debug("Req index out of range\n");
                        return FDT_ADDR_T_NONE;
@@ -662,16 +664,15 @@ fdt_addr_t dev_get_addr_index(struct udevice *dev, int index)
                 * bus setups.
                 */
                addr = fdt_translate_address((void *)gd->fdt_blob,
-                                            dev->of_offset, reg);
+                                            dev_of_offset(dev), reg);
        } else {
                /*
                 * Use the "simple" translate function for less complex
                 * bus setups.
                 */
                addr = fdtdec_get_addr_size_auto_parent(gd->fdt_blob,
-                                                       dev->parent->of_offset,
-                                                       dev->of_offset, "reg",
-                                                       index, NULL, false);
+                               dev_of_offset(dev->parent), dev_of_offset(dev),
+                               "reg", index, NULL, false);
                if (CONFIG_IS_ENABLED(SIMPLE_BUS) && addr != FDT_ADDR_T_NONE) {
                        if (device_get_uclass_id(dev->parent) ==
                            UCLASS_SIMPLE_BUS)
@@ -702,7 +703,7 @@ fdt_addr_t dev_get_addr_size_index(struct udevice *dev, int index,
         * next call to the exisiting dev_get_xxx function which handles
         * all config options.
         */
-       fdtdec_get_addr_size_auto_noparent(gd->fdt_blob, dev->of_offset,
+       fdtdec_get_addr_size_auto_noparent(gd->fdt_blob, dev_of_offset(dev),
                                           "reg", index, size, false);
 
        /*
@@ -720,7 +721,7 @@ fdt_addr_t dev_get_addr_name(struct udevice *dev, const char *name)
 #if CONFIG_IS_ENABLED(OF_CONTROL)
        int index;
 
-       index = fdt_stringlist_search(gd->fdt_blob, dev->of_offset,
+       index = fdt_stringlist_search(gd->fdt_blob, dev_of_offset(dev),
                                      "reg-names", name);
        if (index < 0)
                return index;
@@ -799,7 +800,7 @@ bool of_device_is_compatible(struct udevice *dev, const char *compat)
 {
        const void *fdt = gd->fdt_blob;
 
-       return !fdt_node_check_compatible(fdt, dev->of_offset, compat);
+       return !fdt_node_check_compatible(fdt, dev_of_offset(dev), compat);
 }
 
 bool of_machine_is_compatible(const char *compat)
index c68bcba54f1e5cfd750ec854f5c12b1a6096b214..833cd78e8489038496da2ad7fe31a3f4600e9a07 100644 (file)
@@ -71,12 +71,12 @@ int regmap_init_mem(struct udevice *dev, struct regmap **mapp)
        int parent;
        int len;
 
-       parent = dev->parent->of_offset;
+       parent = dev_of_offset(dev->parent);
        addr_len = fdt_address_cells(blob, parent);
        size_len = fdt_size_cells(blob, parent);
        both_len = addr_len + size_len;
 
-       cell = fdt_getprop(blob, dev->of_offset, "reg", &len);
+       cell = fdt_getprop(blob, dev_of_offset(dev), "reg", &len);
        len /= sizeof(*cell);
        count = len / both_len;
        if (!cell || !count)
index 9edfc1efb661bddb6bff7ba2af604123f4657819..175fd3fb252d494a5096b02d1a3a3b940879ca33 100644 (file)
@@ -227,10 +227,10 @@ int dm_scan_fdt_node(struct udevice *parent, const void *blob, int offset,
 
 int dm_scan_fdt_dev(struct udevice *dev)
 {
-       if (dev->of_offset == -1)
+       if (dev_of_offset(dev) == -1)
                return 0;
 
-       return dm_scan_fdt_node(dev, gd->fdt_blob, dev->of_offset,
+       return dm_scan_fdt_node(dev, gd->fdt_blob, dev_of_offset(dev),
                                gd->flags & GD_FLG_RELOC ? false : true);
 }
 
index 5c955da3346b2c1ff665060100b2f875a87cbe50..6be269f273599cde53a085a0a0759b1cb787c08b 100644 (file)
@@ -30,7 +30,7 @@ static int simple_bus_post_bind(struct udevice *dev)
        u32 cell[3];
        int ret;
 
-       ret = fdtdec_get_int_array(gd->fdt_blob, dev->of_offset, "ranges",
+       ret = fdtdec_get_int_array(gd->fdt_blob, dev_of_offset(dev), "ranges",
                                   cell, ARRAY_SIZE(cell));
        if (!ret) {
                struct simple_bus_plat *plat = dev_get_uclass_platdata(dev);
index 60610e5a1f5464eee6c49afa5b4d3da9bf807e2d..7de370644d72c6ff9232b9f1f6337495ae318aae 100644 (file)
@@ -278,7 +278,7 @@ int uclass_find_device_by_of_offset(enum uclass_id id, int node,
                return ret;
 
        list_for_each_entry(dev, &uc->dev_head, uclass_node) {
-               if (dev->of_offset == node) {
+               if (dev_of_offset(dev) == node) {
                        *devp = dev;
                        return 0;
                }
@@ -299,7 +299,7 @@ static int uclass_find_device_by_phandle(enum uclass_id id,
        int ret;
 
        *devp = NULL;
-       find_phandle = fdtdec_get_int(gd->fdt_blob, parent->of_offset, name,
+       find_phandle = fdtdec_get_int(gd->fdt_blob, dev_of_offset(parent), name,
                                      -1);
        if (find_phandle <= 0)
                return -ENOENT;
@@ -308,7 +308,9 @@ static int uclass_find_device_by_phandle(enum uclass_id id,
                return ret;
 
        list_for_each_entry(dev, &uc->dev_head, uclass_node) {
-               uint phandle = fdt_get_phandle(gd->fdt_blob, dev->of_offset);
+               uint phandle;
+
+               phandle = fdt_get_phandle(gd->fdt_blob, dev_of_offset(dev));
 
                if (phandle == find_phandle) {
                        *devp = dev;
index d908736cffe31e2acb1bfa787bc12b05265543b7..7e71f3bf6ae9bd5b677eb11c017cca682cc5cfd8 100644 (file)
@@ -151,7 +151,7 @@ static int shape_ofdata_to_platdata(struct udevice *dev)
                return ret;
 
        /* Parse the data that only we need */
-       pdata->default_char = fdtdec_get_int(gd->fdt_blob, dev->of_offset,
+       pdata->default_char = fdtdec_get_int(gd->fdt_blob, dev_of_offset(dev),
                                             "character", '@');
 
        return 0;
index 725f06898f33deb8d7e827f016d1a63da90b71aa..3341572e8a6450f8bb0ad759e15e8fdd76c7e309 100644 (file)
@@ -66,7 +66,7 @@ int demo_set_light(struct udevice *dev, int light)
 int demo_parse_dt(struct udevice *dev)
 {
        struct dm_demo_pdata *pdata = dev_get_platdata(dev);
-       int dn = dev->of_offset;
+       int dn = dev_of_offset(dev);
 
        pdata->sides = fdtdec_get_int(gd->fdt_blob, dn, "sides", 0);
        pdata->colour = fdt_getprop(gd->fdt_blob, dn, "colour", NULL);
index 9ac10a745d20434981ece71d8090168ba2fade08..750eedfffd0bb1cb1685dda62cd6da0992c37d86 100644 (file)
@@ -130,7 +130,7 @@ static int gen_74x164_probe(struct udevice *dev)
        char *str, name[32];
        int ret;
        const void *fdt = gd->fdt_blob;
-       int node = dev->of_offset;
+       int node = dev_of_offset(dev);
 
        snprintf(name, sizeof(name), "%s_", dev->name);
        str = strdup(name);
index 6f42bf8a2269018f17004943fd4e328efc948f0e..92849c5295e9ea481ba320130bdd2b04a68a05af 100644 (file)
@@ -92,9 +92,9 @@ static int altera_pio_ofdata_to_platdata(struct udevice *dev)
        plat->regs = map_physmem(dev_get_addr(dev),
                                 sizeof(struct altera_pio_regs),
                                 MAP_NOCACHE);
-       plat->gpio_count = fdtdec_get_int(gd->fdt_blob, dev->of_offset,
+       plat->gpio_count = fdtdec_get_int(gd->fdt_blob, dev_of_offset(dev),
                "altr,gpio-bank-width", 32);
-       plat->bank_name = fdt_getprop(gd->fdt_blob, dev->of_offset,
+       plat->bank_name = fdt_getprop(gd->fdt_blob, dev_of_offset(dev),
                "gpio-bank-name", NULL);
 
        return 0;
index cb90b0241a2bdc7b120f73ca817e7bf9aa5522aa..81c30475514a4b25d007ccc94ebc14d40d66d6ed 100644 (file)
@@ -276,7 +276,7 @@ static const struct dm_gpio_ops atmel_pio4_ops = {
 
 static int atmel_pio4_bind(struct udevice *dev)
 {
-       return dm_scan_fdt_node(dev, gd->fdt_blob, dev->of_offset, false);
+       return dm_scan_fdt_node(dev, gd->fdt_blob, dev_of_offset(dev), false);
 }
 
 static int atmel_pio4_probe(struct udevice *dev)
@@ -308,7 +308,8 @@ static int atmel_pio4_probe(struct udevice *dev)
        pioctrl_data = (struct atmel_pioctrl_data *)dev_get_driver_data(dev);
        nbanks = pioctrl_data->nbanks;
 
-       uc_priv->bank_name = fdt_get_name(gd->fdt_blob, dev->of_offset, NULL);
+       uc_priv->bank_name = fdt_get_name(gd->fdt_blob, dev_of_offset(dev),
+                                         NULL);
        uc_priv->gpio_count = nbanks * ATMEL_PIO_NPINS_PER_BANK;
 
        return 0;
index 85e0a8647f278646464971691e6fc6ab78ae19e3..7d1904c1e1edf80e2686f26dfec3e1c300cbf64b 100644 (file)
@@ -112,13 +112,13 @@ static int gpio_dwapb_bind(struct udevice *dev)
        if (plat)
                return 0;
 
-       base = fdtdec_get_addr(blob, dev->of_offset, "reg");
+       base = fdtdec_get_addr(blob, dev_of_offset(dev), "reg");
        if (base == FDT_ADDR_T_NONE) {
                debug("Can't get the GPIO register base address\n");
                return -ENXIO;
        }
 
-       for (node = fdt_first_subnode(blob, dev->of_offset);
+       for (node = fdt_first_subnode(blob, dev_of_offset(dev));
             node > 0;
             node = fdt_next_subnode(blob, node)) {
                if (!fdtdec_get_bool(blob, node, "gpio-controller"))
@@ -142,7 +142,7 @@ static int gpio_dwapb_bind(struct udevice *dev)
                if (ret)
                        goto err;
 
-               subdev->of_offset = node;
+               dev_set_of_offset(subdev, node);
                bank++;
        }
 
index 4559739d619c637d79495e349290b7ae93646de9..9ab9df4ce7a6cd5afd1a78813c13560a40265a29 100644 (file)
@@ -707,7 +707,7 @@ int gpio_request_by_name(struct udevice *dev,  const char *list_name, int index,
         * calls in gpio_request_by_name(), but we can do this until
         * gpio_request_by_name_nodev() can be dropped.
         */
-       return gpio_request_by_name_nodev(gd->fdt_blob, dev->of_offset,
+       return gpio_request_by_name_nodev(gd->fdt_blob, dev_of_offset(dev),
                                          list_name, index, desc, flags);
 }
 
@@ -746,7 +746,7 @@ int gpio_request_list_by_name(struct udevice *dev, const char *list_name,
         * calls in gpio_request_by_name(), but we can do this until
         * gpio_request_list_by_name_nodev() can be dropped.
         */
-       return gpio_request_list_by_name_nodev(gd->fdt_blob, dev->of_offset,
+       return gpio_request_list_by_name_nodev(gd->fdt_blob, dev_of_offset(dev),
                                               list_name, desc, max_count,
                                               flags);
 }
@@ -755,7 +755,7 @@ int gpio_get_list_count(struct udevice *dev, const char *list_name)
 {
        int ret;
 
-       ret = fdtdec_parse_phandle_with_args(gd->fdt_blob, dev->of_offset,
+       ret = fdtdec_parse_phandle_with_args(gd->fdt_blob, dev_of_offset(dev),
                                             list_name, "#gpio-cells", 0, -1,
                                             NULL);
        if (ret) {
index 81ce446e1a162d1e2c624e657623b1fc96714963..790577ac810e5abf3ab35bcb163724e2fbe07b51 100644 (file)
@@ -149,14 +149,14 @@ static int broadwell_gpio_ofdata_to_platdata(struct udevice *dev)
        if (ret)
                return ret;
 
-       bank = fdtdec_get_int(gd->fdt_blob, dev->of_offset, "reg", -1);
+       bank = fdtdec_get_int(gd->fdt_blob, dev_of_offset(dev), "reg", -1);
        if (bank == -1) {
                debug("%s: Invalid bank number %d\n", __func__, bank);
                return -EINVAL;
        }
        plat->bank = bank;
        plat->base_addr = gpiobase;
-       plat->bank_name = fdt_getprop(gd->fdt_blob, dev->of_offset,
+       plat->bank_name = fdt_getprop(gd->fdt_blob, dev_of_offset(dev),
                                      "bank-name", NULL);
 
        return 0;
index fd6181fa5a733f4bc76856b621bd6d1ce1e897d7..8b782260bc336cd1117531820f0aedc1cc2ed31b 100644 (file)
@@ -94,14 +94,14 @@ static int gpio_ich6_ofdata_to_platdata(struct udevice *dev)
        if (ret)
                return ret;
 
-       offset = fdtdec_get_int(gd->fdt_blob, dev->of_offset, "reg", -1);
+       offset = fdtdec_get_int(gd->fdt_blob, dev_of_offset(dev), "reg", -1);
        if (offset == -1) {
                debug("%s: Invalid register offset %d\n", __func__, offset);
                return -EINVAL;
        }
        plat->offset = offset;
        plat->base_addr = gpiobase + offset;
-       plat->bank_name = fdt_getprop(gd->fdt_blob, dev->of_offset,
+       plat->bank_name = fdt_getprop(gd->fdt_blob, dev_of_offset(dev),
                                      "bank-name", NULL);
 
        return 0;
index 9674ee75f03185eca01bc5d942ba7acd6a011f01..1bf945acfc634de960b3f5746f11c805dfaaf25e 100644 (file)
@@ -297,7 +297,7 @@ static int lpc32xx_gpio_probe(struct udevice *dev)
        struct lpc32xx_gpio_priv *gpio_priv = dev_get_priv(dev);
        struct gpio_dev_priv *uc_priv = dev->uclass_priv;
 
-       if (dev->of_offset == -1) {
+       if (dev_of_offset(dev) == -1) {
                /* Tell the uclass how many GPIOs we have */
                uc_priv->gpio_count = LPC32XX_GPIOS;
        }
index 168c696c4dc00a435669281d419c2cbbb0bd119e..cfeb6e76328d299b44dd9bf21f0a9f8cceff83aa 100644 (file)
@@ -169,13 +169,13 @@ static int mpc85xx_gpio_ofdata_to_platdata(struct udevice *dev) {
        fdt_addr_t addr;
        fdt_size_t size;
 
-       addr = fdtdec_get_addr_size_auto_noparent(gd->fdt_blob, dev->of_offset,
-                                                 "reg", 0, &size, false);
+       addr = fdtdec_get_addr_size_auto_noparent(gd->fdt_blob,
+                       dev_of_offset(dev), "reg", 0, &size, false);
 
        plat->addr = addr;
        plat->size = size;
-       plat->ngpios = fdtdec_get_int(gd->fdt_blob, dev->of_offset,
-                                                 "ngpios", 32);
+       plat->ngpios = fdtdec_get_int(gd->fdt_blob, dev_of_offset(dev),
+                                     "ngpios", 32);
 
        return 0;
 }
index 03029792c2a7dcb72866a1423183cac794d23464..01ce1d6fa0f21035b488bae500dbb4daf9073dbf 100644 (file)
@@ -106,9 +106,9 @@ static int msm_gpio_ofdata_to_platdata(struct udevice *dev)
 {
        struct gpio_dev_priv *uc_priv = dev_get_uclass_priv(dev);
 
-       uc_priv->gpio_count = fdtdec_get_int(gd->fdt_blob, dev->of_offset,
+       uc_priv->gpio_count = fdtdec_get_int(gd->fdt_blob, dev_of_offset(dev),
                                             "gpio-count", 0);
-       uc_priv->bank_name = fdt_getprop(gd->fdt_blob, dev->of_offset,
+       uc_priv->bank_name = fdt_getprop(gd->fdt_blob, dev_of_offset(dev),
                                         "gpio-bank-name", NULL);
        if (uc_priv->bank_name == NULL)
                uc_priv->bank_name = "soc";
index f906b97fb7466dcfe8e1b7b182034d98f4e324bc..5338552179f6eec9b07c492d22f75a8779203a34 100644 (file)
@@ -320,7 +320,7 @@ static int omap_gpio_bind(struct udevice *dev)
                return -ENOMEM;
 
        plat->base = base_addr;
-       plat->port_name = fdt_get_name(gd->fdt_blob, dev->of_offset, NULL);
+       plat->port_name = fdt_get_name(gd->fdt_blob, dev_of_offset(dev), NULL);
        dev->platdata = plat;
 
        return 0;
index 0410add5183cb607ac55b5a41d1d19c9f5573755..b81f0fa90c2f04d98bce36ac2484ba43b5a1ed33 100644 (file)
@@ -265,7 +265,7 @@ static int pca953x_probe(struct udevice *dev)
                return -ENODEV;
        }
 
-       addr = fdtdec_get_int(gd->fdt_blob, dev->of_offset, "reg", 0);
+       addr = fdtdec_get_int(gd->fdt_blob, dev_of_offset(dev), "reg", 0);
        if (addr == 0)
                return -ENODEV;
 
index 2bda0ff9966bba2db77d3510f44bb5f89a41c983..2cbb9e61ea37890e5589b754bddaa0ff2f89242a 100644 (file)
@@ -131,15 +131,15 @@ static int pcf8575_ofdata_platdata(struct udevice *dev)
 
        int n_latch;
 
-       uc_priv->gpio_count = fdtdec_get_int(gd->fdt_blob, dev->of_offset,
+       uc_priv->gpio_count = fdtdec_get_int(gd->fdt_blob, dev_of_offset(dev),
                                             "gpio-count", 16);
-       uc_priv->bank_name = fdt_getprop(gd->fdt_blob, dev->of_offset,
+       uc_priv->bank_name = fdt_getprop(gd->fdt_blob, dev_of_offset(dev),
                                         "gpio-bank-name", NULL);
        if (!uc_priv->bank_name)
                uc_priv->bank_name = fdt_get_name(gd->fdt_blob,
-                                                 dev->of_offset, NULL);
+                                                 dev_of_offset(dev), NULL);
 
-       n_latch = fdtdec_get_uint(gd->fdt_blob, dev->of_offset,
+       n_latch = fdtdec_get_uint(gd->fdt_blob, dev_of_offset(dev),
                                  "lines-initial-states", 0);
        plat->out = ~n_latch;
 
index 7a037f3a77cd1009d2ca495d4cc7d9a8530721e1..e838ad45a8c742c5e622db857036319bbeceed70 100644 (file)
@@ -133,7 +133,8 @@ static int pic32_gpio_probe(struct udevice *dev)
        char *end;
        int bank;
 
-       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;
 
index 0b619758438f856fb664b572a007579139f39784..e38cee88693bf3509994f0361c36ea37917f0d59 100644 (file)
@@ -193,9 +193,9 @@ static int pm8916_gpio_ofdata_to_platdata(struct udevice *dev)
 {
        struct gpio_dev_priv *uc_priv = dev_get_uclass_priv(dev);
 
-       uc_priv->gpio_count = fdtdec_get_int(gd->fdt_blob, dev->of_offset,
+       uc_priv->gpio_count = fdtdec_get_int(gd->fdt_blob, dev_of_offset(dev),
                                             "gpio-count", 0);
-       uc_priv->bank_name = fdt_getprop(gd->fdt_blob, dev->of_offset,
+       uc_priv->bank_name = fdt_getprop(gd->fdt_blob, dev_of_offset(dev),
                                         "gpio-bank-name", NULL);
        if (uc_priv->bank_name == NULL)
                uc_priv->bank_name = "pm8916";
index 377fed467fb323a5d4beb721a1ac7efc33f2eebb..042996e559e85e946826dccd8df47597968e6d04 100644 (file)
@@ -317,7 +317,7 @@ static int gpio_exynos_bind(struct udevice *parent)
                return 0;
 
        base = (struct s5p_gpio_bank *)dev_get_addr(parent);
-       for (node = fdt_first_subnode(blob, parent->of_offset), bank = base;
+       for (node = fdt_first_subnode(blob, dev_of_offset(parent)), bank = base;
             node > 0;
             node = fdt_next_subnode(blob, node), bank++) {
                struct exynos_gpio_platdata *plat;
@@ -337,7 +337,7 @@ static int gpio_exynos_bind(struct udevice *parent)
                if (ret)
                        return ret;
 
-               dev->of_offset = node;
+               dev_set_of_offset(dev, node);
 
                reg = dev_get_addr(dev);
                if (reg != FDT_ADDR_T_NONE)
index f6435a0543ba787981a70830d65f6c923f97aa4e..ae6d93013f7c79a4bc84ab6be9acd5fd052c736e 100644 (file)
@@ -197,9 +197,9 @@ static int sandbox_gpio_ofdata_to_platdata(struct udevice *dev)
 {
        struct gpio_dev_priv *uc_priv = dev_get_uclass_priv(dev);
 
-       uc_priv->gpio_count = fdtdec_get_int(gd->fdt_blob, dev->of_offset,
+       uc_priv->gpio_count = fdtdec_get_int(gd->fdt_blob, dev_of_offset(dev),
                                             "num-gpios", 0);
-       uc_priv->bank_name = fdt_getprop(gd->fdt_blob, dev->of_offset,
+       uc_priv->bank_name = fdt_getprop(gd->fdt_blob, dev_of_offset(dev),
                                         "gpio-bank-name", NULL);
 
        return 0;
@@ -209,7 +209,7 @@ static int gpio_sandbox_probe(struct udevice *dev)
 {
        struct gpio_dev_priv *uc_priv = dev_get_uclass_priv(dev);
 
-       if (dev->of_offset == -1) {
+       if (dev_of_offset(dev) == -1) {
                /* Tell the uclass how many GPIOs we have */
                uc_priv->gpio_count = CONFIG_SANDBOX_GPIO_COUNT;
        }
index e8accaa333026a08da7931e9527d4a3b41243b31..8d2bb18504aeae4e05981df68521dcab33154b5a 100644 (file)
@@ -312,7 +312,7 @@ static int gpio_sunxi_bind(struct udevice *parent)
                                        plat->bank_name, plat, -1, &dev);
                if (ret)
                        return ret;
-               dev->of_offset = parent->of_offset;
+               dev_set_of_offset(dev, dev_of_offset(parent));
        }
 
        return 0;
index 1c681514db9f50e61a9db041ac2067c084db494c..b0c22e5bfe3146993890eea10498b96f2feef5b6 100644 (file)
@@ -197,7 +197,7 @@ static int tegra186_gpio_bind(struct udevice *parent)
                                  -1, &dev);
                if (ret)
                        return ret;
-               dev->of_offset = parent->of_offset;
+               dev_set_of_offset(dev, dev_of_offset(parent));
        }
 
        return 0;
index 5a031159ca370c423455e0fdebcf8965dc8fb962..b01968a304dae744b5f7926b13f6222868f0e95d 100644 (file)
@@ -337,7 +337,8 @@ static int gpio_tegra_bind(struct udevice *parent)
         * This driver does not make use of interrupts, other than to figure
         * out the number of GPIO banks
         */
-       if (!fdt_getprop(gd->fdt_blob, parent->of_offset, "interrupts", &len))
+       if (!fdt_getprop(gd->fdt_blob, dev_of_offset(parent), "interrupts",
+                        &len))
                return -EINVAL;
        bank_count = len / 3 / sizeof(u32);
        ctlr = (struct gpio_ctlr *)dev_get_addr(parent);
@@ -363,7 +364,7 @@ static int gpio_tegra_bind(struct udevice *parent)
                                          plat->port_name, plat, -1, &dev);
                        if (ret)
                                return ret;
-                       dev->of_offset = parent->of_offset;
+                       dev_set_of_offset(dev, dev_of_offset(parent));
                }
        }
 
index a30ba5d2ed6f3966b3bab766355d05c43faf651a..458104e8b07f89a67f53a9d9fae6ab52028bb1be 100644 (file)
@@ -129,7 +129,7 @@ static int vybrid_gpio_bind(struct udevice *dev)
 
        plat->base = base_addr;
        plat->chip = dev->req_seq;
-       plat->port_name = fdt_get_name(gd->fdt_blob, dev->of_offset, NULL);
+       plat->port_name = fdt_get_name(gd->fdt_blob, dev_of_offset(dev), NULL);
        dev->platdata = plat;
 
        return 0;
index 4bc54eea596eb6b2a63bae682de7feb6550f9b25..5a636697a5e5b257eb3d56e9a66e93f540b82c37 100644 (file)
@@ -242,7 +242,7 @@ static int at91_i2c_ofdata_to_platdata(struct udevice *dev)
 {
        const void *blob = gd->fdt_blob;
        struct at91_i2c_bus *bus = dev_get_priv(dev);
-       int node = dev->of_offset;
+       int node = dev_of_offset(dev);
 
        bus->regs = (struct at91_i2c_regs *)dev_get_addr(dev);
        bus->pdata = (struct at91_i2c_pdata *)dev_get_driver_data(dev);
index 9cf8e7dec0f8861b44f5316e7196ce59e6ecf2ba..86fa684ff0553420ba945d2442306316c8c1de8f 100644 (file)
@@ -34,7 +34,7 @@ static int cros_ec_i2c_ofdata_to_platdata(struct udevice *dev)
 {
        struct cros_ec_i2c_bus *i2c_bus = dev_get_priv(dev);
        const void *blob = gd->fdt_blob;
-       int node = dev->of_offset;
+       int node = dev_of_offset(dev);
 
        i2c_bus->remote_bus = fdtdec_get_uint(blob, node, "google,remote-bus",
                                              0);
index 9521aeb3c308c7e6a85efffa7af3c5ddf3099682..2dd75fd154c431d01a8b0b169e3d5c9c2d7d668b 100644 (file)
@@ -522,7 +522,7 @@ static int s3c_i2c_ofdata_to_platdata(struct udevice *dev)
        struct s3c24x0_i2c_bus *i2c_bus = dev_get_priv(dev);
        int node;
 
-       node = dev->of_offset;
+       node = dev_of_offset(dev);
 
        i2c_bus->hsregs = (struct exynos5_hsi2c *)dev_get_addr(dev);
 
index c3f826d68c7591e4318ecb5754a9312f960a6b1f..e9fbf828f34b8138704491ba97dc137e6db2487f 100644 (file)
@@ -585,21 +585,21 @@ static int fsl_i2c_ofdata_to_platdata(struct udevice *bus)
        struct fsl_i2c_dev *dev = dev_get_priv(bus);
        fdt_addr_t addr;
        fdt_size_t size;
+       int node = dev_of_offset(bus);
 
-       addr = fdtdec_get_addr_size_auto_noparent(gd->fdt_blob, bus->of_offset,
-                                                 "reg", 0, &size, false);
+       addr = fdtdec_get_addr_size_auto_noparent(gd->fdt_blob, node, "reg", 0,
+                                                 &size, false);
 
        dev->base = map_sysmem(CONFIG_SYS_IMMR + addr, size);
 
        if (!dev->base)
                return -ENOMEM;
 
-       dev->index = fdtdec_get_int(gd->fdt_blob, bus->of_offset,
-                                   "cell-index", -1);
-       dev->slaveadd = fdtdec_get_int(gd->fdt_blob, bus->of_offset,
+       dev->index = fdtdec_get_int(gd->fdt_blob, node, "cell-index", -1);
+       dev->slaveadd = fdtdec_get_int(gd->fdt_blob, node,
                                       "u-boot,i2c-slave-addr", 0x7f);
-       dev->speed = fdtdec_get_int(gd->fdt_blob, bus->of_offset,
-                                   "clock-frequency", 400000);
+       dev->speed = fdtdec_get_int(gd->fdt_blob, node, "clock-frequency",
+                                   400000);
 
        dev->i2c_clk = dev->index ? gd->arch.i2c2_clk : gd->arch.i2c1_clk;
 
index a8b83c51bc398a61f89377b3305cc9474a14c9e2..aeeb304a876f13a44cbac1d0ccbecc1523b9b9a0 100644 (file)
@@ -309,7 +309,7 @@ static int i2c_gpio_ofdata_to_platdata(struct udevice *dev)
 {
        struct i2c_gpio_bus *bus = dev_get_priv(dev);
        const void *blob = gd->fdt_blob;
-       int node = dev->of_offset;
+       int node = dev_of_offset(dev);
        int ret;
 
        ret = gpio_request_list_by_name(dev, "gpios", bus->gpios,
index dbd3789747dfdacc1ca2fc013203ff8d4f416e05..f3184c71d9e84d1ac35393ddacee5f44f1f782d5 100644 (file)
@@ -489,7 +489,7 @@ static int i2c_post_probe(struct udevice *dev)
 #if CONFIG_IS_ENABLED(OF_CONTROL)
        struct dm_i2c_bus *i2c = dev_get_uclass_priv(dev);
 
-       i2c->speed_hz = fdtdec_get_int(gd->fdt_blob, dev->of_offset,
+       i2c->speed_hz = fdtdec_get_int(gd->fdt_blob, dev_of_offset(dev),
                                     "clock-frequency", 100000);
 
        return dm_i2c_set_bus_speed(dev, i2c->speed_hz);
@@ -503,10 +503,11 @@ static int i2c_child_post_bind(struct udevice *dev)
 #if CONFIG_IS_ENABLED(OF_CONTROL)
        struct dm_i2c_chip *plat = dev_get_parent_platdata(dev);
 
-       if (dev->of_offset == -1)
+       if (dev_of_offset(dev) == -1)
                return 0;
 
-       return i2c_chip_ofdata_to_platdata(gd->fdt_blob, dev->of_offset, plat);
+       return i2c_chip_ofdata_to_platdata(gd->fdt_blob, dev_of_offset(dev),
+                                          plat);
 #else
        return 0;
 #endif
index 3f072c78b81d1720cc52b16c2b354e75d378ac29..66ce7ecc9c2ad65598f5fb4e478e1bca01339704 100644 (file)
@@ -89,7 +89,7 @@ static int i2c_arbitrator_probe(struct udevice *dev)
 {
        struct i2c_arbitrator_priv *priv = dev_get_priv(dev);
        const void *blob = gd->fdt_blob;
-       int node = dev->of_offset;
+       int node = dev_of_offset(dev);
        int ret;
 
        debug("%s: %s\n", __func__, dev->name);
index db086efe61240f3d7f93d67bc4ba72a0ebb1e5f2..d243b8e32d62aee3f34cb73ba57c8fc9eb63b7e5 100644 (file)
@@ -40,7 +40,7 @@ static int i2c_mux_child_post_bind(struct udevice *dev)
        struct i2c_mux_bus *plat = dev_get_parent_platdata(dev);
        int channel;
 
-       channel = fdtdec_get_int(gd->fdt_blob, dev->of_offset, "reg", -1);
+       channel = fdtdec_get_int(gd->fdt_blob, dev_of_offset(dev), "reg", -1);
        if (channel < 0)
                return -EINVAL;
        plat->channel = channel;
@@ -60,7 +60,7 @@ static int i2c_mux_post_bind(struct udevice *mux)
         * There is no compatible string in the sub-nodes, so we must manually
         * bind these
         */
-       for (offset = fdt_first_subnode(blob, mux->of_offset);
+       for (offset = fdt_first_subnode(blob, dev_of_offset(mux));
             offset > 0;
             offset = fdt_next_subnode(blob, offset)) {
                struct udevice *dev;
index 7e0d2da4d60585c84c29590cb070cc1a66c5b088..1a6761858ce95364983bfe34f690bba0ac6973bd 100644 (file)
@@ -51,7 +51,7 @@ static int pca954x_ofdata_to_platdata(struct udevice *dev)
 {
        struct pca954x_priv *priv = dev_get_priv(dev);
 
-       priv->addr = fdtdec_get_int(gd->fdt_blob, dev->of_offset, "reg", 0);
+       priv->addr = fdtdec_get_int(gd->fdt_blob, dev_of_offset(dev), "reg", 0);
        if (!priv->addr) {
                debug("MUX not found\n");
                return -ENODEV;
index cea3da0b27610cd49cc593dff4b0ab44d42b90ab..648a96eeb4e88cd0ab9b753b31c8d85b9b33d4e5 100644 (file)
@@ -775,11 +775,11 @@ static int mvtwsi_i2c_ofdata_to_platdata(struct udevice *bus)
        if (!dev->base)
                return -ENOMEM;
 
-       dev->index = fdtdec_get_int(gd->fdt_blob, bus->of_offset,
+       dev->index = fdtdec_get_int(gd->fdt_blob, dev_of_offset(bus),
                                    "cell-index", -1);
-       dev->slaveadd = fdtdec_get_int(gd->fdt_blob, bus->of_offset,
+       dev->slaveadd = fdtdec_get_int(gd->fdt_blob, dev_of_offset(bus),
                                       "u-boot,i2c-slave-addr", 0x0);
-       dev->speed = fdtdec_get_int(gd->fdt_blob, bus->of_offset,
+       dev->speed = fdtdec_get_int(gd->fdt_blob, dev_of_offset(bus),
                                    "clock-frequency", 100000);
        return 0;
 }
index 94d9027d256d9e0ef78a9fcf59cc892f17e1d11d..eb789f5bff492246bf19ae5698b6b4367607d818 100644 (file)
@@ -750,7 +750,7 @@ static int mxc_i2c_probe(struct udevice *bus)
 {
        struct mxc_i2c_bus *i2c_bus = dev_get_priv(bus);
        const void *fdt = gd->fdt_blob;
-       int node = bus->of_offset;
+       int node = dev_of_offset(bus);
        fdt_addr_t addr;
        int ret, ret2;
 
index 363cd04e4e2692899b63bad0bbe46613861b6371..3c69dbf409b00fd8cff74cdd321fd6278a821e41 100644 (file)
@@ -312,7 +312,7 @@ static int s3c_i2c_ofdata_to_platdata(struct udevice *dev)
        struct s3c24x0_i2c_bus *i2c_bus = dev_get_priv(dev);
        int node;
 
-       node = dev->of_offset;
+       node = dev_of_offset(dev);
 
        i2c_bus->regs = (struct s3c24x0_i2c *)dev_get_addr(dev);
 
index 513c414ae38aed82fb7aaab6ff0e44288d89b496..931c6de508c02b2c0c3475470908a61f7f59b1fe 100644 (file)
@@ -90,7 +90,7 @@ static int tegra186_bpmp_i2c_probe(struct udevice *dev)
 {
        struct tegra186_bpmp_i2c *priv = dev_get_priv(dev);
 
-       priv->bpmp_bus_id = fdtdec_get_uint(gd->fdt_blob, dev->of_offset,
+       priv->bpmp_bus_id = fdtdec_get_uint(gd->fdt_blob, dev_of_offset(dev),
                                            "nvidia,bpmp-bus-id", U32_MAX);
        if (priv->bpmp_bus_id == U32_MAX) {
                debug("%s: could not parse nvidia,bpmp-bus-id\n", __func__);
index 9bc4555c2eb6f8fc6343e3837526d5023a9af010..00381dcd720ac1b92b70d8afd4b52191d2c47d64 100644 (file)
@@ -189,7 +189,7 @@ static int cros_ec_kbd_probe(struct udevice *dev)
        struct stdio_dev *sdev = &uc_priv->sdev;
        struct input_config *input = &uc_priv->input;
        const void *blob = gd->fdt_blob;
-       int node = dev->of_offset;
+       int node = dev_of_offset(dev);
        int ret;
 
        if (cros_ec_keyb_decode_fdt(blob, node, priv))
index 03d48403857a862c2e6224a15a71eb4472119607..0fd25b17ec0878a0ebe06b0ecc4ff7348a3eba1a 100644 (file)
@@ -315,7 +315,7 @@ static int i8042_kbd_probe(struct udevice *dev)
        struct input_config *input = &uc_priv->input;
        int ret;
 
-       if (fdtdec_get_bool(gd->fdt_blob, dev->of_offset,
+       if (fdtdec_get_bool(gd->fdt_blob, dev_of_offset(dev),
                            "intel,duplicate-por"))
                priv->quirks |= QUIRK_DUP_POR;
 
index c77f6107696281f89c85986efcd95d62b4a37f41..d36f1a1dfa174909cfdab68d58e0e2424e131f28 100644 (file)
@@ -290,7 +290,7 @@ static int tegra_kbd_probe(struct udevice *dev)
        struct keyboard_priv *uc_priv = dev_get_uclass_priv(dev);
        struct stdio_dev *sdev = &uc_priv->sdev;
        struct input_config *input = &uc_priv->input;
-       int node = dev->of_offset;
+       int node = dev_of_offset(dev);
        int ret;
 
        priv->kbc = (struct kbc_tegra *)dev_get_addr(dev);
index cb6e996931b3d33c18d7cdac3466dc7ffe532377..5b119903f55e431e1a811ca9032d4b2e2a3770a4 100644 (file)
@@ -62,7 +62,7 @@ static int led_gpio_bind(struct udevice *parent)
        int node;
        int ret;
 
-       for (node = fdt_first_subnode(blob, parent->of_offset);
+       for (node = fdt_first_subnode(blob, dev_of_offset(parent));
             node > 0;
             node = fdt_next_subnode(blob, node)) {
                struct led_uclass_plat *uc_plat;
index a7fcde51d593a105a3f49db713993958b533bea8..38448de9655d6bb5462d5c35713cd7b9011714a1 100644 (file)
@@ -41,7 +41,7 @@ int mbox_get_by_index(struct udevice *dev, int index, struct mbox_chan *chan)
 
        debug("%s(dev=%p, index=%d, chan=%p)\n", __func__, dev, index, chan);
 
-       ret = fdtdec_parse_phandle_with_args(gd->fdt_blob, dev->of_offset,
+       ret = fdtdec_parse_phandle_with_args(gd->fdt_blob, dev_of_offset(dev),
                                             "mboxes", "#mbox-cells", 0,
                                             index, &args);
        if (ret) {
@@ -85,7 +85,7 @@ int mbox_get_by_name(struct udevice *dev, const char *name,
 
        debug("%s(dev=%p, name=%s, chan=%p)\n", __func__, dev, name, chan);
 
-       index = fdt_stringlist_search(gd->fdt_blob, dev->of_offset,
+       index = fdt_stringlist_search(gd->fdt_blob, dev_of_offset(dev),
                                      "mbox-names", name);
        if (index < 0) {
                debug("fdt_stringlist_search() failed: %d\n", index);
index 759bb46c57b2ec7555c152394956505d18716a1d..3d449b2a5526cac31ee28d8bc4edd2d2f7527806 100644 (file)
@@ -998,7 +998,7 @@ int cros_ec_register(struct udevice *dev)
 {
        struct cros_ec_dev *cdev = dev_get_uclass_priv(dev);
        const void *blob = gd->fdt_blob;
-       int node = dev->of_offset;
+       int node = dev_of_offset(dev);
        char id[MSG_BYTES];
 
        cdev->dev = dev;
index c4fbca0d3ae129a260d3073fe7387b4f6688ff6b..848c67bc230c2fe55612f53bdb1060d58a0a2741 100644 (file)
@@ -522,7 +522,7 @@ int cros_ec_probe(struct udevice *dev)
        int err;
 
        memcpy(ec, &s_state, sizeof(*ec));
-       err = cros_ec_decode_ec_flash(blob, dev->of_offset, &ec->ec_config);
+       err = cros_ec_decode_ec_flash(blob, dev_of_offset(dev), &ec->ec_config);
        if (err)
                return err;
 
@@ -531,7 +531,7 @@ int cros_ec_probe(struct udevice *dev)
             keyb_dev;
             device_find_next_child(&keyb_dev)) {
                if (device_get_uclass_id(keyb_dev) == UCLASS_KEYBOARD) {
-                       node = keyb_dev->of_offset;
+                       node = dev_of_offset(keyb_dev);
                        break;
                }
        }
index 4410d0357ff37f63020a8e5820a3ca3d2ced7b13..02de8d7df3d05fc84c64acaf503fadf750343cc9 100644 (file)
@@ -115,9 +115,9 @@ static int sandbox_i2c_eeprom_ofdata_to_platdata(struct udevice *dev)
 {
        struct sandbox_i2c_flash_plat_data *plat = dev_get_platdata(dev);
 
-       plat->size = fdtdec_get_int(gd->fdt_blob, dev->of_offset,
+       plat->size = fdtdec_get_int(gd->fdt_blob, dev_of_offset(dev),
                                    "sandbox,size", 32);
-       plat->filename = fdt_getprop(gd->fdt_blob, dev->of_offset,
+       plat->filename = fdt_getprop(gd->fdt_blob, dev_of_offset(dev),
                                     "sandbox,filename", NULL);
        if (!plat->filename) {
                debug("%s: No filename for device '%s'\n", __func__,
index f4ddbea3760e5e05965846e5f874aebed0bd5f95..bd8b9602e0dd1b4229aa1caf3b30aa94079c141e 100644 (file)
@@ -112,19 +112,19 @@ static int tegra186_bpmp_bind(struct udevice *dev)
        debug("%s(dev=%p)\n", __func__, dev);
 
        ret = device_bind_driver_to_node(dev, "tegra186_clk", "tegra186_clk",
-                                        dev->of_offset, &child);
+                                        dev_of_offset(dev), &child);
        if (ret)
                return ret;
 
        ret = device_bind_driver_to_node(dev, "tegra186_reset",
-                                        "tegra186_reset", dev->of_offset,
+                                        "tegra186_reset", dev_of_offset(dev),
                                         &child);
        if (ret)
                return ret;
 
        ret = device_bind_driver_to_node(dev, "tegra186_power_domain",
                                         "tegra186_power_domain",
-                                        dev->of_offset, &child);
+                                        dev_of_offset(dev), &child);
        if (ret)
                return ret;
 
@@ -141,7 +141,7 @@ static ulong tegra186_bpmp_get_shmem(struct udevice *dev, int index)
        struct fdtdec_phandle_args args;
        fdt_addr_t reg;
 
-       ret = fdtdec_parse_phandle_with_args(gd->fdt_blob, dev->of_offset,
+       ret = fdtdec_parse_phandle_with_args(gd->fdt_blob, dev_of_offset(dev),
                                              "shmem", NULL, 0, index, &args);
        if (ret < 0) {
                error("fdtdec_parse_phandle_with_args() failed: %d\n", ret);
index 0eb009657c43ed7b995a688296b908b3b33eb1a2..5db3c374ce0a1021f78af71d043df88e6a12272f 100644 (file)
@@ -22,12 +22,12 @@ static int tegra_car_bpmp_bind(struct udevice *dev)
        debug("%s(dev=%p)\n", __func__, dev);
 
        ret = device_bind_driver_to_node(dev, "tegra_car_clk", "tegra_car_clk",
-                                        dev->of_offset, &child);
+                                        dev_of_offset(dev), &child);
        if (ret)
                return ret;
 
        ret = device_bind_driver_to_node(dev, "tegra_car_reset",
-                                        "tegra_car_reset", dev->of_offset,
+                                        "tegra_car_reset", dev_of_offset(dev),
                                         &child);
        if (ret)
                return ret;
index 62cb242343c7199f402fe3221cb6cbac3999c24a..852255782f138e752194a4ed275ae2b264b41043 100644 (file)
@@ -75,7 +75,7 @@ static int atmel_sdhci_probe(struct udevice *dev)
        host->ioaddr = (void *)dev_get_addr(dev);
 
        host->quirks = 0;
-       host->bus_width = fdtdec_get_int(gd->fdt_blob, dev->of_offset,
+       host->bus_width = fdtdec_get_int(gd->fdt_blob, dev_of_offset(dev),
                                         "bus-width", 4);
 
        caps = sdhci_readl(host, SDHCI_CAPABILITIES);
index c440399a09cfa38e0dd569a68c7a8c347ad3633a..40f7892ac80b757ef95ca723a1495d56110f3a93 100644 (file)
@@ -264,7 +264,7 @@ static int exynos_dwmmc_probe(struct udevice *dev)
        struct dwmci_host *host = &priv->host;
        int err;
 
-       err = exynos_dwmci_get_config(gd->fdt_blob, dev->of_offset, host);
+       err = exynos_dwmci_get_config(gd->fdt_blob, dev_of_offset(dev), host);
        if (err)
                return err;
        err = do_dwmci_init(host);
index 73473c53a375fe679a6bd94a36301f1dbae6f383..adeb5df6da925bb895bda35cc59eca9a7be3fb7c 100644 (file)
@@ -954,7 +954,7 @@ static int fsl_esdhc_probe(struct udevice *dev)
        struct mmc_uclass_priv *upriv = dev_get_uclass_priv(dev);
        struct fsl_esdhc_priv *priv = dev_get_priv(dev);
        const void *fdt = gd->fdt_blob;
-       int node = dev->of_offset;
+       int node = dev_of_offset(dev);
        fdt_addr_t addr;
        unsigned int val;
        int ret;
index 1db683d01e695696e633727233c8d45af39f8465..7a7e67f6f3579ee4164161ee7eacf1b7b3cae6ab 100644 (file)
@@ -50,16 +50,16 @@ DECLARE_GLOBAL_DATA_PTR;
 
 static int msm_sdc_clk_init(struct udevice *dev)
 {
-       uint clk_rate = fdtdec_get_uint(gd->fdt_blob, dev->of_offset,
-                                       "clock-frequency", 400000);
+       int node = dev_of_offset(dev);
+       uint clk_rate = fdtdec_get_uint(gd->fdt_blob, node, "clock-frequency",
+                                       400000);
        uint clkd[2]; /* clk_id and clk_no */
        int clk_offset;
        struct udevice *clk_dev;
        struct clk clk;
        int ret;
 
-       ret = fdtdec_get_int_array(gd->fdt_blob, dev->of_offset, "clock", clkd,
-                                  2);
+       ret = fdtdec_get_int_array(gd->fdt_blob, node, "clock", clkd, 2);
        if (ret)
                return ret;
 
@@ -168,17 +168,14 @@ static int msm_ofdata_to_platdata(struct udevice *dev)
        struct udevice *parent = dev->parent;
        struct msm_sdhc *priv = dev_get_priv(dev);
        struct sdhci_host *host = &priv->host;
+       int node = dev_of_offset(dev);
 
        host->name = strdup(dev->name);
        host->ioaddr = (void *)dev_get_addr(dev);
-       host->bus_width = fdtdec_get_int(gd->fdt_blob, dev->of_offset,
-                                        "bus-width", 4);
-       host->index = fdtdec_get_uint(gd->fdt_blob, dev->of_offset, "index", 0);
+       host->bus_width = fdtdec_get_int(gd->fdt_blob, node, "bus-width", 4);
+       host->index = fdtdec_get_uint(gd->fdt_blob, node, "index", 0);
        priv->base = (void *)fdtdec_get_addr_size_auto_parent(gd->fdt_blob,
-                                                             parent->of_offset,
-                                                             dev->of_offset,
-                                                             "reg", 1, NULL,
-                                                             false);
+                       dev_of_offset(parent), node, "reg", 1, NULL, false);
        if (priv->base == (void *)FDT_ADDR_T_NONE ||
            host->ioaddr == (void *)FDT_ADDR_T_NONE)
                return -EINVAL;
index b3268467dcc904e660bd5b09463704b6cbf247ea..5bb628d1250aed9c627f5a4d8963611387ceae09 100644 (file)
@@ -728,7 +728,7 @@ static int omap_hsmmc_ofdata_to_platdata(struct udevice *dev)
 {
        struct omap_hsmmc_data *priv = dev_get_priv(dev);
        const void *fdt = gd->fdt_blob;
-       int node = dev->of_offset;
+       int node = dev_of_offset(dev);
        struct mmc_config *cfg;
        int val;
 
index 1e14fa14d6a00f9b14f0a3a015b84a0ab0563dab..9d8a392ed9646b346061de53b00876adc26acded 100644 (file)
@@ -38,18 +38,18 @@ static int pic32_sdhci_probe(struct udevice *dev)
        fdt_size_t size;
        int ret;
 
-       addr = fdtdec_get_addr_size(fdt, dev->of_offset, "reg", &size);
+       addr = fdtdec_get_addr_size(fdt, dev_of_offset(dev), "reg", &size);
        if (addr == FDT_ADDR_T_NONE)
                return -EINVAL;
 
        host->ioaddr    = ioremap(addr, size);
        host->name      = dev->name;
        host->quirks    = SDHCI_QUIRK_NO_HISPD_BIT;
-       host->bus_width = fdtdec_get_int(gd->fdt_blob, dev->of_offset,
+       host->bus_width = fdtdec_get_int(gd->fdt_blob, dev_of_offset(dev),
                                        "bus-width", 4);
        host->ops = &pic32_sdhci_ops;
 
-       ret = fdtdec_get_int_array(gd->fdt_blob, dev->of_offset,
+       ret = fdtdec_get_int_array(gd->fdt_blob, dev_of_offset(dev),
                                   "clock-freq-min-max", f_min_max, 2);
        if (ret) {
                printf("sdhci: clock-freq-min-max not found\n");
index 47db6786cfce47334d4d387562c3dd6490318289..c36eda05d20b139b71caaca95430513f91f66212 100644 (file)
@@ -59,24 +59,24 @@ static int rockchip_dwmmc_ofdata_to_platdata(struct udevice *dev)
 
        host->name = dev->name;
        host->ioaddr = (void *)dev_get_addr(dev);
-       host->buswidth = fdtdec_get_int(gd->fdt_blob, dev->of_offset,
+       host->buswidth = fdtdec_get_int(gd->fdt_blob, dev_of_offset(dev),
                                        "bus-width", 4);
        host->get_mmc_clk = rockchip_dwmmc_get_mmc_clk;
        host->priv = dev;
 
        /* use non-removeable as sdcard and emmc as judgement */
-       if (fdtdec_get_bool(gd->fdt_blob, dev->of_offset, "non-removable"))
+       if (fdtdec_get_bool(gd->fdt_blob, dev_of_offset(dev), "non-removable"))
                host->dev_index = 0;
        else
                host->dev_index = 1;
 
-       priv->fifo_depth = fdtdec_get_int(gd->fdt_blob, dev->of_offset,
+       priv->fifo_depth = fdtdec_get_int(gd->fdt_blob, dev_of_offset(dev),
                                    "fifo-depth", 0);
        if (priv->fifo_depth < 0)
                return -EINVAL;
-       priv->fifo_mode = fdtdec_get_bool(gd->fdt_blob, dev->of_offset,
+       priv->fifo_mode = fdtdec_get_bool(gd->fdt_blob, dev_of_offset(dev),
                                          "fifo-mode");
-       if (fdtdec_get_int_array(gd->fdt_blob, dev->of_offset,
+       if (fdtdec_get_int_array(gd->fdt_blob, dev_of_offset(dev),
                                 "clock-freq-min-max", priv->minmax, 2))
                return -EINVAL;
 #endif
index 13588647014c8846cfcacc5f0220e1e7ade8f2d2..bd91f917580ae3a779f5d5f7247cd2c1e53fd612 100644 (file)
@@ -38,7 +38,7 @@ static int arasan_sdhci_probe(struct udevice *dev)
        struct clk clk;
 
 
-       max_frequency = fdtdec_get_int(gd->fdt_blob, dev->of_offset,
+       max_frequency = fdtdec_get_int(gd->fdt_blob, dev_of_offset(dev),
                        "max-frequency", 0);
        ret = clk_get_by_index(dev, 0, &clk);
        if (!ret) {
index 28327d5f0bced321690b1ec52d16c5906f5d42ca..640ea0261eb50e24c586de49d0928dffefec90fd 100644 (file)
@@ -247,7 +247,7 @@ static int s5p_sdhci_probe(struct udevice *dev)
        struct sdhci_host *host = dev_get_priv(dev);
        int ret;
 
-       ret = sdhci_get_config(gd->fdt_blob, dev->of_offset, host);
+       ret = sdhci_get_config(gd->fdt_blob, dev_of_offset(dev), host);
        if (ret)
                return ret;
 
index 0a22e582957fc24e00f05c56e956aa1fabfce479..d0c3c5155a01628bc6c3b363551d88c480bbb246 100644 (file)
@@ -70,7 +70,7 @@ static int socfpga_dwmmc_ofdata_to_platdata(struct udevice *dev)
                return -EINVAL;
        }
 
-       fifo_depth = fdtdec_get_int(gd->fdt_blob, dev->of_offset,
+       fifo_depth = fdtdec_get_int(gd->fdt_blob, dev_of_offset(dev),
                                    "fifo-depth", 0);
        if (fifo_depth < 0) {
                printf("DWMMC: Can't get FIFO depth\n");
@@ -79,7 +79,7 @@ static int socfpga_dwmmc_ofdata_to_platdata(struct udevice *dev)
 
        host->name = dev->name;
        host->ioaddr = (void *)dev_get_addr(dev);
-       host->buswidth = fdtdec_get_int(gd->fdt_blob, dev->of_offset,
+       host->buswidth = fdtdec_get_int(gd->fdt_blob, dev_of_offset(dev),
                                        "bus-width", 4);
        host->clksel = socfpga_dwmci_clksel;
 
@@ -92,9 +92,9 @@ static int socfpga_dwmmc_ofdata_to_platdata(struct udevice *dev)
        host->bus_hz = clk;
        host->fifoth_val = MSIZE(0x2) |
                RX_WMARK(fifo_depth / 2 - 1) | TX_WMARK(fifo_depth / 2);
-       priv->drvsel = fdtdec_get_uint(gd->fdt_blob, dev->of_offset,
+       priv->drvsel = fdtdec_get_uint(gd->fdt_blob, dev_of_offset(dev),
                                       "drvsel", 3);
-       priv->smplsel = fdtdec_get_uint(gd->fdt_blob, dev->of_offset,
+       priv->smplsel = fdtdec_get_uint(gd->fdt_blob, dev_of_offset(dev),
                                        "smplsel", 0);
        host->priv = priv;
 
index 0211dc7b80d7a3f6e53bfb0c407fff04d8e2b233..0df74ef79ae1d14566bdf162b7b9c8c38cff8c54 100644 (file)
@@ -578,8 +578,8 @@ static int tegra_mmc_probe(struct udevice *dev)
        priv->cfg.name = "Tegra SD/MMC";
        priv->cfg.ops = &tegra_mmc_ops;
 
-       bus_width = fdtdec_get_int(gd->fdt_blob, dev->of_offset, "bus-width",
-                                  1);
+       bus_width = fdtdec_get_int(gd->fdt_blob, dev_of_offset(dev),
+                                  "bus-width", 1);
 
        priv->cfg.voltages = MMC_VDD_32_33 | MMC_VDD_33_34 | MMC_VDD_165_195;
        priv->cfg.host_caps = 0;
index 4af7fdb13c91471757fb9d4459c6eba1f48bd5fa..7f20ef124d66a54401dac10362a82581d60ccaea 100644 (file)
@@ -705,7 +705,8 @@ static int uniphier_sd_probe(struct udevice *dev)
        plat->cfg.name = dev->name;
        plat->cfg.host_caps = MMC_MODE_HS_52MHz | MMC_MODE_HS;
 
-       switch (fdtdec_get_int(gd->fdt_blob, dev->of_offset, "bus-width", 1)) {
+       switch (fdtdec_get_int(gd->fdt_blob, dev_of_offset(dev), "bus-width",
+                              1)) {
        case 8:
                plat->cfg.host_caps |= MMC_MODE_8BIT;
                break;
@@ -719,7 +720,7 @@ static int uniphier_sd_probe(struct udevice *dev)
                return -EINVAL;
        }
 
-       if (fdt_get_property(gd->fdt_blob, dev->of_offset, "non-removable",
+       if (fdt_get_property(gd->fdt_blob, dev_of_offset(dev), "non-removable",
                             NULL))
                priv->caps |= UNIPHIER_SD_CAP_NONREMOVABLE;
 
index 828da111c80e279a450ab4ac15e19fa582be4240..f67811023983057b2099576e8e85e5254dbd3d97 100644 (file)
@@ -405,7 +405,8 @@ static int xenon_sdhci_probe(struct udevice *dev)
                armada_3700_soc_pad_voltage_set(host);
 
        host->host_caps = MMC_MODE_HS | MMC_MODE_HS_52MHz | MMC_MODE_DDR_52MHz;
-       switch (fdtdec_get_int(gd->fdt_blob, dev->of_offset, "bus-width", 1)) {
+       switch (fdtdec_get_int(gd->fdt_blob, dev_of_offset(dev), "bus-width",
+               1)) {
        case 8:
                host->host_caps |= MMC_MODE_8BIT;
                break;
@@ -455,7 +456,7 @@ static int xenon_sdhci_ofdata_to_platdata(struct udevice *dev)
        if (of_device_is_compatible(dev, "marvell,armada-3700-sdhci"))
                priv->pad_ctrl_reg = (void *)dev_get_addr_index(dev, 1);
 
-       name = fdt_getprop(gd->fdt_blob, dev->of_offset, "marvell,pad-type",
+       name = fdt_getprop(gd->fdt_blob, dev_of_offset(dev), "marvell,pad-type",
                           NULL);
        if (name) {
                if (0 == strncmp(name, "sd", 2)) {
index a9148a7fe41f0f0e4af4b66a0aa3ca94c3059f6d..e04964b558e54653a6b7915bf4711883e1f7f2aa 100644 (file)
@@ -349,7 +349,7 @@ static int altera_qspi_ofdata_to_platdata(struct udevice *dev)
 {
        struct altera_qspi_platdata *pdata = dev_get_platdata(dev);
        void *blob = (void *)gd->fdt_blob;
-       int node = dev->of_offset;
+       int node = dev_of_offset(dev);
        const char *list, *end;
        const fdt32_t *cell;
        void *base;
index e036b88a6256c5752021af6351da6d0185a383b1..d440f5ccd96d07816ca2be3b16cb401db0a9a638 100644 (file)
@@ -2441,7 +2441,7 @@ unsigned long flash_init (void)
 static int cfi_flash_probe(struct udevice *dev)
 {
        void *blob = (void *)gd->fdt_blob;
-       int node = dev->of_offset;
+       int node = dev_of_offset(dev);
        const fdt32_t *cell;
        phys_addr_t addr;
        int parent, addrc, sizec;
index 9166fcd9803f75a0376896632c4400f833c17b5f..8ed7874cc9f73523f34a1a9a37fedf3f7002d8c8 100644 (file)
@@ -371,7 +371,7 @@ static void pic32_flash_bank_init(flash_info_t *info,
 static int pic32_flash_probe(struct udevice *dev)
 {
        void *blob = (void *)gd->fdt_blob;
-       int node = dev->of_offset;
+       int node = dev_of_offset(dev);
        const char *list, *end;
        const fdt32_t *cell;
        unsigned long addr, size;
index 4944059fa3f16c1d8710089f18e92246854bea3b..36a50fe3a15d9ebd393765cdaa5c7462c68681c7 100644 (file)
@@ -516,7 +516,7 @@ int sandbox_sf_ofdata_to_platdata(struct udevice *dev)
 {
        struct sandbox_spi_flash_plat_data *pdata = dev_get_platdata(dev);
        const void *blob = gd->fdt_blob;
-       int node = dev->of_offset;
+       int node = dev_of_offset(dev);
 
        pdata->filename = fdt_getprop(blob, node, "sandbox,filename", NULL);
        pdata->device_name = fdt_getprop(blob, node, "compatible", NULL);
@@ -641,7 +641,7 @@ int sandbox_spi_get_emul(struct sandbox_state *state,
                debug("%s: busnum=%u, cs=%u: binding SPI flash emulation: ",
                      __func__, busnum, cs);
                ret = sandbox_sf_bind_emul(state, busnum, cs, bus,
-                                          slave->of_offset, slave->name);
+                                          dev_of_offset(slave), slave->name);
                if (ret) {
                        debug("failed (err=%d)\n", ret);
                        return ret;
index 2e378dc822aa00e2b6ad695033693e0a3b60c31b..ab7910bc1450ffe25ef8d541425a98db1296a92d 100644 (file)
@@ -919,7 +919,7 @@ int spi_flash_decode_fdt(const void *blob, struct spi_flash *flash)
 #ifdef CONFIG_DM_SPI_FLASH
        fdt_addr_t addr;
        fdt_size_t size;
-       int node = flash->dev->of_offset;
+       int node = dev_of_offset(flash->dev);
 
        addr = fdtdec_get_addr_size(blob, node, "memory-map", &size);
        if (addr == FDT_ADDR_T_NONE) {
index 346f138caf85c49802ce9296d2176388660e51dc..f8782bcbd03205bb6e92879140e3e78a87cd46f1 100644 (file)
@@ -857,7 +857,7 @@ static int ag7xxx_get_phy_iface_offset(struct udevice *dev)
 {
        int offset;
 
-       offset = fdtdec_lookup_phandle(gd->fdt_blob, dev->of_offset, "phy");
+       offset = fdtdec_lookup_phandle(gd->fdt_blob, dev_of_offset(dev), "phy");
        if (offset <= 0) {
                debug("%s: PHY OF node not found (ret=%i)\n", __func__, offset);
                return -EINVAL;
index 92a1b644958cf7050e96a66ba5afa62f2ba456ad..d4d17dd2226e7b0f2689d4452debddbe19bc206a 100644 (file)
@@ -576,7 +576,7 @@ static int altera_tse_probe(struct udevice *dev)
        struct eth_pdata *pdata = dev_get_platdata(dev);
        struct altera_tse_priv *priv = dev_get_priv(dev);
        void *blob = (void *)gd->fdt_blob;
-       int node = dev->of_offset;
+       int node = dev_of_offset(dev);
        const char *list, *end;
        const fdt32_t *cell;
        void *base, *desc_mem = NULL;
@@ -676,7 +676,8 @@ static int altera_tse_ofdata_to_platdata(struct udevice *dev)
        const char *phy_mode;
 
        pdata->phy_interface = -1;
-       phy_mode = fdt_getprop(gd->fdt_blob, dev->of_offset, "phy-mode", NULL);
+       phy_mode = fdt_getprop(gd->fdt_blob, dev_of_offset(dev), "phy-mode",
+                              NULL);
        if (phy_mode)
                pdata->phy_interface = phy_get_interface_by_name(phy_mode);
        if (pdata->phy_interface == -1) {
index e828e85d8b318fda0b8775e80cdfc5c19fc02f3f..aa52503986c36f3cd8a5c01274df860c2d6cf0ea 100644 (file)
@@ -20,7 +20,7 @@ static int davinci_emac_3517_get_macid(struct udevice *dev, u16 offset,
                                       int slave, u8 *mac_addr)
 {
        void *fdt = (void *)gd->fdt_blob;
-       int node = dev->of_offset;
+       int node = dev_of_offset(dev);
        u32 macid_lsb;
        u32 macid_msb;
        fdt32_t gmii = 0;
@@ -60,7 +60,7 @@ static int cpsw_am33xx_cm_get_macid(struct udevice *dev, u16 offset, int slave,
                                    u8 *mac_addr)
 {
        void *fdt = (void *)gd->fdt_blob;
-       int node = dev->of_offset;
+       int node = dev_of_offset(dev);
        u32 macid_lo;
        u32 macid_hi;
        fdt32_t gmii = 0;
index cbce683eea9ab13369a0a0d8c944daeb7aca92d2..5fbab9e492f85eb044a2fefc4a3d0369fed676b1 100644 (file)
@@ -981,7 +981,7 @@ static int cpsw_phy_init(struct cpsw_priv *priv, struct cpsw_slave *slave)
 
 #ifdef CONFIG_DM_ETH
        if (slave->data->phy_of_handle)
-               phydev->dev->of_offset = slave->data->phy_of_handle;
+               dev_set_of_offset(phydev->dev, slave->data->phy_of_handle);
 #endif
 
        priv->phydev = phydev;
@@ -1286,7 +1286,7 @@ static int cpsw_eth_ofdata_to_platdata(struct udevice *dev)
        const char *phy_mode;
        const char *phy_sel_compat = NULL;
        const void *fdt = gd->fdt_blob;
-       int node = dev->of_offset;
+       int node = dev_of_offset(dev);
        int subnode;
        int slave_index = 0;
        int active_slave;
index e207bc63b837fbc60db485642f49613bd8f6b1f9..eee4e09d7ed9859339c43bce9d756c3f3713e4e0 100644 (file)
@@ -728,7 +728,8 @@ int designware_eth_ofdata_to_platdata(struct udevice *dev)
 
        pdata->iobase = dev_get_addr(dev);
        pdata->phy_interface = -1;
-       phy_mode = fdt_getprop(gd->fdt_blob, dev->of_offset, "phy-mode", NULL);
+       phy_mode = fdt_getprop(gd->fdt_blob, dev_of_offset(dev), "phy-mode",
+                              NULL);
        if (phy_mode)
                pdata->phy_interface = phy_get_interface_by_name(phy_mode);
        if (pdata->phy_interface == -1) {
@@ -737,19 +738,19 @@ int designware_eth_ofdata_to_platdata(struct udevice *dev)
        }
 
        pdata->max_speed = 0;
-       cell = fdt_getprop(gd->fdt_blob, dev->of_offset, "max-speed", NULL);
+       cell = fdt_getprop(gd->fdt_blob, dev_of_offset(dev), "max-speed", NULL);
        if (cell)
                pdata->max_speed = fdt32_to_cpu(*cell);
 
 #ifdef CONFIG_DM_GPIO
-       if (fdtdec_get_bool(gd->fdt_blob, dev->of_offset,
+       if (fdtdec_get_bool(gd->fdt_blob, dev_of_offset(dev),
                            "snps,reset-active-low"))
                reset_flags |= GPIOD_ACTIVE_LOW;
 
        ret = gpio_request_by_name(dev, "snps,reset-gpio", 0,
                &priv->reset_gpio, reset_flags);
        if (ret == 0) {
-               ret = fdtdec_get_int_array(gd->fdt_blob, dev->of_offset,
+               ret = fdtdec_get_int_array(gd->fdt_blob, dev_of_offset(dev),
                        "snps,reset-delays-us", dw_pdata->reset_delays, 3);
        } else if (ret == -ENOENT) {
                ret = 0;
index 3304fddc696ffca174477bd7f1f4859a8e8af2d0..5f34c8fe3c6e22fde41aa50bd8d2874be51a41c5 100644 (file)
@@ -1277,7 +1277,8 @@ static int fecmxc_ofdata_to_platdata(struct udevice *dev)
        priv->eth = (struct ethernet_regs *)pdata->iobase;
 
        pdata->phy_interface = -1;
-       phy_mode = fdt_getprop(gd->fdt_blob, dev->of_offset, "phy-mode", NULL);
+       phy_mode = fdt_getprop(gd->fdt_blob, dev_of_offset(dev), "phy-mode",
+                              NULL);
        if (phy_mode)
                pdata->phy_interface = phy_get_interface_by_name(phy_mode);
        if (pdata->phy_interface == -1) {
index 5f833fa711f3d4d041ed7f133a12c3ace8ea682b..e9b202ab9ae81c26d48f8f943568fc84bf781ab6 100644 (file)
@@ -36,9 +36,9 @@ static int gmac_rockchip_ofdata_to_platdata(struct udevice *dev)
 {
        struct gmac_rockchip_platdata *pdata = dev_get_platdata(dev);
 
-       pdata->tx_delay = fdtdec_get_int(gd->fdt_blob, dev->of_offset,
+       pdata->tx_delay = fdtdec_get_int(gd->fdt_blob, dev_of_offset(dev),
                                         "tx-delay", 0x30);
-       pdata->rx_delay = fdtdec_get_int(gd->fdt_blob, dev->of_offset,
+       pdata->rx_delay = fdtdec_get_int(gd->fdt_blob, dev_of_offset(dev),
                                         "rx-delay", 0x10);
 
        return designware_eth_ofdata_to_platdata(dev);
index a5120e01ad36e064d1ef77534819e2943c662cff..1b781f4d95a74939de39363f4dc532af21524fe8 100644 (file)
@@ -1099,7 +1099,7 @@ static int ks2_sl_eth_ofdata_to_platdata(struct udevice *dev)
        struct ks2_eth_priv *priv = dev_get_priv(dev);
        struct eth_pdata *pdata = dev_get_platdata(dev);
        const void *fdt = gd->fdt_blob;
-       int slave = dev->of_offset;
+       int slave = dev_of_offset(dev);
        int interfaces;
        int gbe;
        int netcp_devices;
@@ -1126,13 +1126,13 @@ static int ks2_eth_ofdata_to_platdata(struct udevice *dev)
        int netcp_devices;
        int gbe;
 
-       netcp_devices = fdt_subnode_offset(fdt, dev->of_offset,
+       netcp_devices = fdt_subnode_offset(fdt, dev_of_offset(dev),
                                           "netcp-devices");
        gbe = fdt_subnode_offset(fdt, netcp_devices, "gbe");
 
        ks2_eth_bind_slaves(dev, gbe, &gbe_0);
 
-       ks2_eth_parse_slave_interface(dev->of_offset, gbe_0, priv, pdata);
+       ks2_eth_parse_slave_interface(dev_of_offset(dev), gbe_0, priv, pdata);
 
        pdata->iobase = dev_get_addr(dev);
 
index 01527f7fc7cecd0fb6c700b72693e927062f22b5..452fc3e3b97ccde238774011bcec30f42ace90b5 100644 (file)
@@ -999,7 +999,8 @@ static int macb_eth_probe(struct udevice *dev)
 #ifdef CONFIG_DM_ETH
        const char *phy_mode;
 
-       phy_mode = fdt_getprop(gd->fdt_blob, dev->of_offset, "phy-mode", NULL);
+       phy_mode = fdt_getprop(gd->fdt_blob, dev_of_offset(dev), "phy-mode",
+                              NULL);
        if (phy_mode)
                macb->phy_interface = phy_get_interface_by_name(phy_mode);
        if (macb->phy_interface == -1) {
index 00f378f0826aebe1414a0e8139612b3371e92525..674075f037ddaaca04c61e227f59a84a8f1e7442 100644 (file)
@@ -1611,7 +1611,7 @@ static int mvneta_probe(struct udevice *dev)
        struct eth_pdata *pdata = dev_get_platdata(dev);
        struct mvneta_port *pp = dev_get_priv(dev);
        void *blob = (void *)gd->fdt_blob;
-       int node = dev->of_offset;
+       int node = dev_of_offset(dev);
        struct mii_dev *bus;
        unsigned long addr;
        void *bd_space;
@@ -1691,7 +1691,8 @@ static int mvneta_ofdata_to_platdata(struct udevice *dev)
 
        /* Get phy-mode / phy_interface from DT */
        pdata->phy_interface = -1;
-       phy_mode = fdt_getprop(gd->fdt_blob, dev->of_offset, "phy-mode", NULL);
+       phy_mode = fdt_getprop(gd->fdt_blob, dev_of_offset(dev), "phy-mode",
+                              NULL);
        if (phy_mode)
                pdata->phy_interface = phy_get_interface_by_name(phy_mode);
        if (pdata->phy_interface == -1) {
index 405776af95db191fa00c76451b25b766fcfa7943..88e88b903b3fc63757b0ed46312ef96a7c84f6a6 100644 (file)
@@ -4047,7 +4047,7 @@ static int mvpp2_probe(struct udevice *dev)
                return err;
        }
 
-       return mvpp2_port_probe(dev, port, dev->of_offset, priv,
+       return mvpp2_port_probe(dev, port, dev_of_offset(dev), priv,
                                &buffer_loc.first_rxq);
 }
 
@@ -4138,7 +4138,7 @@ static int mvpp2_base_probe(struct udevice *dev)
 static int mvpp2_base_bind(struct udevice *parent)
 {
        const void *blob = gd->fdt_blob;
-       int node = parent->of_offset;
+       int node = dev_of_offset(parent);
        struct uclass_driver *drv;
        struct udevice *dev;
        struct eth_pdata *plat;
@@ -4169,7 +4169,7 @@ static int mvpp2_base_bind(struct udevice *parent)
 
                /* Create child device UCLASS_ETH and bind it */
                device_bind(parent, &mvpp2_driver, name, plat, subnode, &dev);
-               dev->of_offset = subnode;
+               dev_set_of_offset(dev, subnode);
        }
 
        return 0;
index 7163fa257f4c5ad5f9476a862fe5b267f8684d33..0e4a4ebcc603370ce66845e507979e1aa0f7424e 100644 (file)
@@ -244,7 +244,7 @@ static int ksz90x1_of_config_group(struct phy_device *phydev,
                return -EOPNOTSUPP;
 
        for (i = 0; i < ofcfg->grpsz; i++) {
-               val[i] = fdtdec_get_uint(gd->fdt_blob, dev->of_offset,
+               val[i] = fdtdec_get_uint(gd->fdt_blob, dev_of_offset(dev),
                                         ofcfg->grp[i].name, -1);
                offset = ofcfg->grp[i].off;
                if (val[i] == -1) {
index c55dd973f4c3ea6d8d1e2cc2966e4f233d37d920..d1ce4060ff8613f51687eeb9afe433770d9e2bcf 100644 (file)
@@ -167,13 +167,13 @@ static int dp83867_of_init(struct phy_device *phydev)
        struct dp83867_private *dp83867 = phydev->priv;
        struct udevice *dev = phydev->dev;
 
-       dp83867->rx_id_delay = fdtdec_get_uint(gd->fdt_blob, dev->of_offset,
+       dp83867->rx_id_delay = fdtdec_get_uint(gd->fdt_blob, dev_of_offset(dev),
                                 "ti,rx-internal-delay", -1);
 
-       dp83867->tx_id_delay = fdtdec_get_uint(gd->fdt_blob, dev->of_offset,
+       dp83867->tx_id_delay = fdtdec_get_uint(gd->fdt_blob, dev_of_offset(dev),
                                 "ti,tx-internal-delay", -1);
 
-       dp83867->fifo_depth = fdtdec_get_uint(gd->fdt_blob, dev->of_offset,
+       dp83867->fifo_depth = fdtdec_get_uint(gd->fdt_blob, dev_of_offset(dev),
                                 "ti,fifo-depth", -1);
 
        return 0;
index 920bfcb380b30ca8469c7a75aabfa2118df6d2b2..3f80f0495e8d54ff6b74e5e3995e343595eaa9f7 100644 (file)
@@ -104,7 +104,7 @@ static int xilinxphy_of_init(struct phy_device *phydev)
        u32 phytype;
 
        debug("%s\n", __func__);
-       phytype = fdtdec_get_int(gd->fdt_blob, phydev->dev->of_offset,
+       phytype = fdtdec_get_int(gd->fdt_blob, dev_of_offset(phydev->dev),
                                 "phy-type", -1);
        if (phytype == XAE_PHY_TYPE_1000BASE_X)
                phydev->flags |= XAE_PHY_TYPE_1000BASE_X;
index 167af8bde5b2770bd2638ff2ee2361580271bf91..385aad5b7e1d735afdcecdcc5bec4570a6c73efa 100644 (file)
@@ -535,7 +535,8 @@ static int pic32_eth_probe(struct udevice *dev)
        int offset = 0;
        int phy_addr = -1;
 
-       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;
 
@@ -544,7 +545,8 @@ static int pic32_eth_probe(struct udevice *dev)
 
        /* get phy mode */
        pdata->phy_interface = -1;
-       phy_mode = fdt_getprop(gd->fdt_blob, dev->of_offset, "phy-mode", NULL);
+       phy_mode = fdt_getprop(gd->fdt_blob, dev_of_offset(dev), "phy-mode",
+                              NULL);
        if (phy_mode)
                pdata->phy_interface = phy_get_interface_by_name(phy_mode);
        if (pdata->phy_interface == -1) {
@@ -553,13 +555,13 @@ static int pic32_eth_probe(struct udevice *dev)
        }
 
        /* get phy addr */
-       offset = fdtdec_lookup_phandle(gd->fdt_blob, dev->of_offset,
+       offset = fdtdec_lookup_phandle(gd->fdt_blob, dev_of_offset(dev),
                                       "phy-handle");
        if (offset > 0)
                phy_addr = fdtdec_get_int(gd->fdt_blob, offset, "reg", -1);
 
        /* phy reset gpio */
-       gpio_request_by_name_nodev(gd->fdt_blob, dev->of_offset,
+       gpio_request_by_name_nodev(gd->fdt_blob, dev_of_offset(dev),
                                   "reset-gpios", 0,
                                   &priv->rst_gpio, GPIOD_IS_OUT);
 
index 591242797e26dfff301888f1022f62ce8fa5f88d..9742c2c4f6612269b49363120a3334936da1730c 100644 (file)
@@ -26,7 +26,7 @@ static int sb_eth_raw_start(struct udevice *dev)
 
        debug("eth_sandbox_raw: Start\n");
 
-       interface = fdt_getprop(gd->fdt_blob, dev->of_offset,
+       interface = fdt_getprop(gd->fdt_blob, dev_of_offset(dev),
                                            "host-raw-interface", NULL);
        if (interface == NULL)
                return -EINVAL;
index d538d379bbec77cb54c7072b63480218f3d456dd..79d0ae68bfd5281ff2d0c985053de8e9d71925d5 100644 (file)
@@ -60,8 +60,9 @@ static int sb_eth_start(struct udevice *dev)
 
        debug("eth_sandbox: Start\n");
 
-       fdtdec_get_byte_array(gd->fdt_blob, dev->of_offset, "fake-host-hwaddr",
-                             priv->fake_host_hwaddr, ARP_HLEN);
+       fdtdec_get_byte_array(gd->fdt_blob, dev_of_offset(dev),
+                             "fake-host-hwaddr", priv->fake_host_hwaddr,
+                             ARP_HLEN);
        priv->recv_packet_buffer = net_rx_packets[0];
        return 0;
 }
index abd9cc8bc0b3ba51ab826b1cfc8c4bbfd9e675aa..b87210bad7923c1b0ae56f61c928794b5407463f 100644 (file)
@@ -442,7 +442,7 @@ static int parse_phy_pins(struct udevice *dev)
        const char *pin_name;
        int drive, pull, i;
 
-       offset = fdtdec_lookup_phandle(gd->fdt_blob, dev->of_offset,
+       offset = fdtdec_lookup_phandle(gd->fdt_blob, dev_of_offset(dev),
                                       "pinctrl-0");
        if (offset < 0) {
                printf("WARNING: emac: cannot find pinctrl-0 node\n");
@@ -716,6 +716,7 @@ static int sun8i_emac_eth_ofdata_to_platdata(struct udevice *dev)
        struct eth_pdata *pdata = dev_get_platdata(dev);
        struct emac_eth_dev *priv = dev_get_priv(dev);
        const char *phy_mode;
+       int node = dev_of_offset(dev);
        int offset = 0;
 
        pdata->iobase = dev_get_addr_name(dev, "emac");
@@ -725,13 +726,13 @@ static int sun8i_emac_eth_ofdata_to_platdata(struct udevice *dev)
        priv->phyaddr = -1;
        priv->use_internal_phy = false;
 
-       offset = fdtdec_lookup_phandle(gd->fdt_blob, dev->of_offset,
+       offset = fdtdec_lookup_phandle(gd->fdt_blob, node,
                                       "phy");
        if (offset > 0)
                priv->phyaddr = fdtdec_get_int(gd->fdt_blob, offset, "reg",
                                               -1);
 
-       phy_mode = fdt_getprop(gd->fdt_blob, dev->of_offset, "phy-mode", NULL);
+       phy_mode = fdt_getprop(gd->fdt_blob, node, "phy-mode", NULL);
 
        if (phy_mode)
                pdata->phy_interface = phy_get_interface_by_name(phy_mode);
@@ -751,7 +752,7 @@ static int sun8i_emac_eth_ofdata_to_platdata(struct udevice *dev)
        }
 
        if (priv->variant == H3_EMAC) {
-               if (fdt_getprop(gd->fdt_blob, dev->of_offset,
+               if (fdt_getprop(gd->fdt_blob, node,
                                "allwinner,use-internal-phy", NULL))
                        priv->use_internal_phy = true;
        }
index 7df4c63acfd7888b08be6a4cf1fcd46443fd7295..f2ce4e2a8edb743c0616ea23e4655f983069826d 100644 (file)
@@ -783,7 +783,7 @@ int tsec_probe(struct udevice *dev)
        pdata->iobase = (phys_addr_t)dev_get_addr(dev);
        priv->regs = (struct tsec *)pdata->iobase;
 
-       offset = fdtdec_lookup_phandle(gd->fdt_blob, dev->of_offset,
+       offset = fdtdec_lookup_phandle(gd->fdt_blob, dev_of_offset(dev),
                                       "phy-handle");
        if (offset > 0) {
                reg = fdtdec_get_int(gd->fdt_blob, offset, "reg", 0);
@@ -802,7 +802,7 @@ int tsec_probe(struct udevice *dev)
                return -ENOENT;
        }
 
-       offset = fdtdec_lookup_phandle(gd->fdt_blob, dev->of_offset,
+       offset = fdtdec_lookup_phandle(gd->fdt_blob, dev_of_offset(dev),
                                       "tbi-handle");
        if (offset > 0) {
                reg = fdtdec_get_int(gd->fdt_blob, offset, "reg",
@@ -812,7 +812,7 @@ int tsec_probe(struct udevice *dev)
                priv->tbiaddr = CONFIG_SYS_TBIPA_VALUE;
        }
 
-       phy_mode = fdt_getprop(gd->fdt_blob, dev->of_offset,
+       phy_mode = fdt_getprop(gd->fdt_blob, dev_of_offset(dev),
                               "phy-connection-type", NULL);
        if (phy_mode)
                pdata->phy_interface = phy_get_interface_by_name(phy_mode);
index 51c74266637cc9c5747c289f07ab3adf58c1ecb3..a6f24b3cbecb138a3e780586088ed318b744fd1d 100644 (file)
@@ -682,13 +682,14 @@ static int axi_emac_ofdata_to_platdata(struct udevice *dev)
 {
        struct eth_pdata *pdata = dev_get_platdata(dev);
        struct axidma_priv *priv = dev_get_priv(dev);
+       int node = dev_of_offset(dev);
        int offset = 0;
        const char *phy_mode;
 
        pdata->iobase = (phys_addr_t)dev_get_addr(dev);
        priv->iobase = (struct axi_regs *)pdata->iobase;
 
-       offset = fdtdec_lookup_phandle(gd->fdt_blob, dev->of_offset,
+       offset = fdtdec_lookup_phandle(gd->fdt_blob, node,
                                       "axistream-connected");
        if (offset <= 0) {
                printf("%s: axistream is not found\n", __func__);
@@ -705,12 +706,11 @@ static int axi_emac_ofdata_to_platdata(struct udevice *dev)
 
        priv->phyaddr = -1;
 
-       offset = fdtdec_lookup_phandle(gd->fdt_blob, dev->of_offset,
-                                      "phy-handle");
+       offset = fdtdec_lookup_phandle(gd->fdt_blob, node, "phy-handle");
        if (offset > 0)
                priv->phyaddr = fdtdec_get_int(gd->fdt_blob, offset, "reg", -1);
 
-       phy_mode = fdt_getprop(gd->fdt_blob, dev->of_offset, "phy-mode", NULL);
+       phy_mode = fdt_getprop(gd->fdt_blob, node, "phy-mode", NULL);
        if (phy_mode)
                pdata->phy_interface = phy_get_interface_by_name(phy_mode);
        if (pdata->phy_interface == -1) {
index ea93cf906ed76063ab0577dfd314f6fc1c8e2431..7d4e14f8ef33a41b4defd59519d2643aff90c8d8 100644 (file)
@@ -604,15 +604,15 @@ static int emaclite_ofdata_to_platdata(struct udevice *dev)
 
        emaclite->phyaddr = -1;
 
-       offset = fdtdec_lookup_phandle(gd->fdt_blob, dev->of_offset,
+       offset = fdtdec_lookup_phandle(gd->fdt_blob, dev_of_offset(dev),
                                      "phy-handle");
        if (offset > 0)
                emaclite->phyaddr = fdtdec_get_int(gd->fdt_blob, offset,
                                                   "reg", -1);
 
-       emaclite->txpp = fdtdec_get_int(gd->fdt_blob, dev->of_offset,
+       emaclite->txpp = fdtdec_get_int(gd->fdt_blob, dev_of_offset(dev),
                                        "xlnx,tx-ping-pong", 0);
-       emaclite->rxpp = fdtdec_get_int(gd->fdt_blob, dev->of_offset,
+       emaclite->rxpp = fdtdec_get_int(gd->fdt_blob, dev_of_offset(dev),
                                        "xlnx,rx-ping-pong", 0);
 
        printf("EMACLITE: %lx, phyaddr %d, %d/%d\n", (ulong)emaclite->regs,
index 6dd87cf28f95540da795f9b414be4def7e494439..86dd03fedaf6a3e11843975201c1cc3bb899438f 100644 (file)
@@ -345,7 +345,7 @@ static int zynq_phy_init(struct udevice *dev)
        priv->phydev->advertising = priv->phydev->supported;
 
        if (priv->phy_of_handle > 0)
-               priv->phydev->dev->of_offset = priv->phy_of_handle;
+               dev_set_of_offset(priv->phydev->dev, priv->phy_of_handle);
 
        return phy_config(priv->phydev);
 }
@@ -684,6 +684,7 @@ static int zynq_gem_ofdata_to_platdata(struct udevice *dev)
 {
        struct eth_pdata *pdata = dev_get_platdata(dev);
        struct zynq_gem_priv *priv = dev_get_priv(dev);
+       int node = dev_of_offset(dev);
        const char *phy_mode;
 
        pdata->iobase = (phys_addr_t)dev_get_addr(dev);
@@ -692,13 +693,13 @@ static int zynq_gem_ofdata_to_platdata(struct udevice *dev)
        priv->emio = 0;
        priv->phyaddr = -1;
 
-       priv->phy_of_handle = fdtdec_lookup_phandle(gd->fdt_blob,
-                                       dev->of_offset, "phy-handle");
+       priv->phy_of_handle = fdtdec_lookup_phandle(gd->fdt_blob, node,
+                                                   "phy-handle");
        if (priv->phy_of_handle > 0)
                priv->phyaddr = fdtdec_get_int(gd->fdt_blob,
                                        priv->phy_of_handle, "reg", -1);
 
-       phy_mode = fdt_getprop(gd->fdt_blob, dev->of_offset, "phy-mode", NULL);
+       phy_mode = fdt_getprop(gd->fdt_blob, node, "phy-mode", NULL);
        if (phy_mode)
                pdata->phy_interface = phy_get_interface_by_name(phy_mode);
        if (pdata->phy_interface == -1) {
@@ -707,7 +708,7 @@ static int zynq_gem_ofdata_to_platdata(struct udevice *dev)
        }
        priv->interface = pdata->phy_interface;
 
-       priv->emio = fdtdec_get_bool(gd->fdt_blob, dev->of_offset, "xlnx,emio");
+       priv->emio = fdtdec_get_bool(gd->fdt_blob, node, "xlnx,emio");
 
        printf("ZYNQ GEM: %lx, phyaddr %x, interface %s\n", (ulong)priv->iobase,
               priv->phyaddr, phy_string_for_interface(priv->interface));
index 3b00e6a41b36c040e3c1298bf4f5b1248c51872a..a1408f5bf1ca7c157f4210759ae0a73617020ead 100644 (file)
@@ -839,8 +839,9 @@ static int pci_uclass_pre_probe(struct udevice *bus)
        /* For bridges, use the top-level PCI controller */
        if (!device_is_on_pci_bus(bus)) {
                hose->ctlr = bus;
-               ret = decode_regions(hose, gd->fdt_blob, bus->parent->of_offset,
-                               bus->of_offset);
+               ret = decode_regions(hose, gd->fdt_blob,
+                                    dev_of_offset(bus->parent),
+                                    dev_of_offset(bus));
                if (ret) {
                        debug("%s: Cannot decode regions\n", __func__);
                        return ret;
@@ -903,7 +904,7 @@ static int pci_uclass_child_post_bind(struct udevice *dev)
        struct fdt_pci_addr addr;
        int ret;
 
-       if (dev->of_offset == -1)
+       if (dev_of_offset(dev) == -1)
                return 0;
 
        /*
@@ -911,7 +912,7 @@ static int pci_uclass_child_post_bind(struct udevice *dev)
         * just check the address.
         */
        pplat = dev_get_parent_platdata(dev);
-       ret = fdtdec_get_pci_addr(gd->fdt_blob, dev->of_offset,
+       ret = fdtdec_get_pci_addr(gd->fdt_blob, dev_of_offset(dev),
                                  FDT_PCI_SPACE_CONFIG, "reg", &addr);
 
        if (ret) {
index 430270ec2923597412f039d41f76117562f4d9f8..7d9c63b06f20eee9dce8dbc6b2aa5c160d908d81 100644 (file)
@@ -1099,7 +1099,7 @@ static int pci_tegra_ofdata_to_platdata(struct udevice *dev)
 
        INIT_LIST_HEAD(&pcie->ports);
 
-       if (tegra_pcie_parse_dt(gd->fdt_blob, dev->of_offset, id, pcie))
+       if (tegra_pcie_parse_dt(gd->fdt_blob, dev_of_offset(dev), id, pcie))
                return -EINVAL;
 
        return 0;
index 90b9fe2a17a82b34136754adaa9ea5b2cf590da5..b6806cf67b69bae3f5babaf5a94ffe8d88949fbc 100644 (file)
@@ -438,7 +438,7 @@ static int ls_pcie_probe(struct udevice *dev)
 {
        struct ls_pcie *pcie = dev_get_priv(dev);
        const void *fdt = gd->fdt_blob;
-       int node = dev->of_offset;
+       int node = dev_of_offset(dev);
        u8 header_type;
        u16 link_sta;
        bool ep_mode;
index 521600180e6d0068b0b9d30e667ab356027a445c..08e2e9344583072ab4f44fc48f009962647e68b8 100644 (file)
@@ -186,7 +186,7 @@ static int pcie_xilinx_ofdata_to_platdata(struct udevice *dev)
        DECLARE_GLOBAL_DATA_PTR;
        int err;
 
-       err = fdt_get_resource(gd->fdt_blob, dev->of_offset, "reg",
+       err = fdt_get_resource(gd->fdt_blob, dev_of_offset(dev), "reg",
                               0, &reg_res);
        if (err < 0) {
                error("\"reg\" resource not found\n");
index bc2508bb7e0372137ee7b861e00189c08f4ef27a..caa1928f07dccd6a5113486766cf01581f44e873 100644 (file)
@@ -107,7 +107,7 @@ void comphy_print(struct chip_serdes_phy_config *chip_cfg,
 static int comphy_probe(struct udevice *dev)
 {
        const void *blob = gd->fdt_blob;
-       int node = dev->of_offset;
+       int node = dev_of_offset(dev);
        struct chip_serdes_phy_config *chip_cfg = dev_get_priv(dev);
        struct comphy_map comphy_map_data[MAX_LANE_OPTIONS];
        int subnode;
index e3f64b63553cd6aaba741edd062b0f6ff8a668b8..fccc7c4b0668cfc8b15a6440fc0363989a9cf6fb 100644 (file)
@@ -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;
index d02597e968aca76fd1edc5b1482e1030cad48ab9..a7f8c7082e80110fe623dc8bfbd08d8a67a1af9e 100644 (file)
@@ -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;
index dd0a16ef5fab75295bb43050d4d24f71998d2d65..5b9a592b0da6f9cf3d1851cc06324723bed376f2 100644 (file)
@@ -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;
index 30f7cfc8200acdb68fd46b10fd5ecec0f6b9bfd5..b5486b8fe4bff10f9df263b5b7dec7c9cbb64cd8 100644 (file)
@@ -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;
index b07763931fe8a2c102b9fdf0f3ba1daddbc46e26..80f0dfaf91b0c3a089cc90165c7a05c3814c013e 100644 (file)
@@ -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);
index 949d0f32d8b9cfeed5b5064780d48aaf1eb509e0..e130faf8764ef44122a961d41f60679f3822f51a 100644 (file)
@@ -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;
index 6d4aadc32c0bcfb64b36df96cdc877bb4e073fb1..5c6bff568ad0154a88ab36903bd40a9093e56d98 100644 (file)
@@ -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;
index 3629322dbb380ad9867dfcd855ef22eb55556d24..0272496b51d13ba8613c5e555b27cc0ac240f1e5 100644 (file)
@@ -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;
index 02ab9b4afde6499ad9deee4b68fcd6b4b7947cd7..49afe91c24eff576e81adcb87e02e1ed78023235 100644 (file)
@@ -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;
index 9acac29133cb900259eab828c7aa90a771060dbe..59466ee02e637d72ed87776825e5f182a8d88904 100644 (file)
@@ -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",
index 6aea856aa63f119b816ac62ac0879e7e711411f1..8d42584b31517431670f2669e0fe239d4d9ffc43 100644 (file)
@@ -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;
index 03222647cade379d62d2aea4ec73e5b343426bda..cb13d30da8e9e8769a1053a6281f4126ac10af2d 100644 (file)
@@ -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) {
index 17ea165edaf11eea3bb656a70b7905fd7375fabf..da301544c99174fc9f3b3e6f4a5ea82e03cbef00 100644 (file)
@@ -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;
index 1bb6262fa1b9b799f19ff0eec542b8a7fc1eee47..3dabbe4ac0aa274ff5a3ad73b4c447274795757a 100644 (file)
@@ -41,7 +41,7 @@ int power_domain_get(struct udevice *dev, struct power_domain *power_domain)
 
        debug("%s(dev=%p, power_domain=%p)\n", __func__, dev, power_domain);
 
-       ret = fdtdec_parse_phandle_with_args(gd->fdt_blob, dev->of_offset,
+       ret = fdtdec_parse_phandle_with_args(gd->fdt_blob, dev_of_offset(dev),
                                             "power-domains",
                                             "#power-domain-cells", 0, 0,
                                             &args);
index e8164bfd08afab318252a10a6da0f8582ed8815d..15da12edea9e7708bc404db64d4cb0a2cd89776c 100644 (file)
@@ -52,7 +52,7 @@ static int act8846_bind(struct udevice *dev)
        int regulators_node;
        int children;
 
-       regulators_node = fdt_subnode_offset(blob, dev->of_offset,
+       regulators_node = fdt_subnode_offset(blob, dev_of_offset(dev),
                                             "regulators");
        if (regulators_node <= 0) {
                debug("%s: %s regulators subnode not found!", __func__,
index aeab5c949adf864f0efca6cf8fa8b463f1f2c894..4f92e3dad8228565021a5aab4252ed1f048ba314 100644 (file)
@@ -108,9 +108,9 @@ static int sandbox_i2c_pmic_ofdata_to_platdata(struct udevice *emul)
 
        debug("%s:%d Setting PMIC default registers\n", __func__, __LINE__);
 
-       reg_defaults = fdtdec_locate_byte_array(gd->fdt_blob, emul->of_offset,
-                                               "reg-defaults",
-                                               SANDBOX_PMIC_REG_COUNT);
+       reg_defaults = fdtdec_locate_byte_array(gd->fdt_blob,
+                       dev_of_offset(emul), "reg-defaults",
+                       SANDBOX_PMIC_REG_COUNT);
 
        if (!reg_defaults) {
                error("Property \"reg-defaults\" not found for device: %s!",
index 307f96bad1b8fefce8961ceaf1e83a840c2b2aa1..d8f30df371b86eb0d838e3ed4a0a9a357ed9e518 100644 (file)
@@ -49,7 +49,7 @@ static int lp873x_bind(struct udevice *dev)
        int regulators_node;
        const void *blob = gd->fdt_blob;
        int children;
-       int node = dev->of_offset;
+       int node = dev_of_offset(dev);
 
        regulators_node = fdt_subnode_offset(blob, node, "regulators");
 
index dc5a54a6a3aca82b229b03ae1710519f2581a013..8295fab3f02d4c162f3a60d0338614be6d170e62 100644 (file)
@@ -54,7 +54,7 @@ static int max77686_bind(struct udevice *dev)
        const void *blob = gd->fdt_blob;
        int children;
 
-       regulators_node = fdt_subnode_offset(blob, dev->of_offset,
+       regulators_node = fdt_subnode_offset(blob, dev_of_offset(dev),
                                             "voltage-regulators");
        if (regulators_node <= 0) {
                debug("%s: %s regulators subnode not found!", __func__,
index 0ab425e5dc70770549019816226f7886e45e56ec..f5a23073c4a2a38d41fd123c8c44e4347812e21e 100644 (file)
@@ -49,7 +49,7 @@ static int palmas_bind(struct udevice *dev)
        int pmic_node = -1, regulators_node;
        const void *blob = gd->fdt_blob;
        int children;
-       int node = dev->of_offset;
+       int node = dev_of_offset(dev);
        int subnode, len;
 
        fdt_for_each_subnode(subnode, blob, node) {
index 3beb48eeac522901a698d94253aff51b7b3968cd..90a43f2fe52c449317f387fd08b18114d37d4689 100644 (file)
@@ -56,7 +56,7 @@ static int pfuze100_bind(struct udevice *dev)
        int regulators_node;
        const void *blob = gd->fdt_blob;
 
-       regulators_node = fdt_subnode_offset(blob, dev->of_offset,
+       regulators_node = fdt_subnode_offset(blob, dev_of_offset(dev),
                                             "regulators");
        if (regulators_node <= 0) {
                debug("%s: %s regulators subnode not found!", __func__,
index 7211026aecbea883c7ad42a0262d9d9f8cb56306..0f7fa517f9967c7dd48bde23c4dc1844cbc1da52 100644 (file)
@@ -33,7 +33,7 @@ int pmic_bind_children(struct udevice *pmic, int offset,
        int ret;
 
        debug("%s for '%s' at node offset: %d\n", __func__, pmic->name,
-             pmic->of_offset);
+             dev_of_offset(pmic));
 
        for (node = fdt_first_subnode(blob, offset);
             node > 0;
index 770f471672e8f8a8677664631d43400134d17c55..3f5f316b56ffdbeddc1a5c085b0b7a1642cddfa9 100644 (file)
@@ -61,7 +61,7 @@ static int rk808_bind(struct udevice *dev)
        int regulators_node;
        int children;
 
-       regulators_node = fdt_subnode_offset(blob, dev->of_offset,
+       regulators_node = fdt_subnode_offset(blob, dev_of_offset(dev),
                                             "regulators");
        if (regulators_node <= 0) {
                debug("%s: %s regulators subnode not found!", __func__,
index 075fe7e2f15c01acdd7da2597e56c4dc87272650..25d673b9981052cadd12e8c61fddd67315a4c215 100644 (file)
@@ -58,7 +58,7 @@ static int s5m8767_bind(struct udevice *dev)
        const void *blob = gd->fdt_blob;
        int children;
 
-       node = fdt_subnode_offset(blob, dev->of_offset, "regulators");
+       node = fdt_subnode_offset(blob, dev_of_offset(dev), "regulators");
        if (node <= 0) {
                debug("%s: %s regulators subnode not found!", __func__,
                      dev->name);
index 3e56acd5e274243671cf35fbe9c0ab4180d56af0..b4e412eb3efac74298b61de334cc4393babbda43 100644 (file)
@@ -51,7 +51,7 @@ static int sandbox_pmic_read(struct udevice *dev, uint reg,
 
 static int sandbox_pmic_bind(struct udevice *dev)
 {
-       if (!pmic_bind_children(dev, dev->of_offset, pmic_children_info))
+       if (!pmic_bind_children(dev, dev_of_offset(dev), pmic_children_info))
                error("%s:%d PMIC: %s - no child found!", __func__, __LINE__,
                                                          dev->name);
 
index 4797f327facc02fb40fb39eb57649effe7cd42f2..b30a7f08e957454062ea536acaa9ac70d60f651c 100644 (file)
@@ -56,7 +56,7 @@ static int tps65090_bind(struct udevice *dev)
        const void *blob = gd->fdt_blob;
        int children;
 
-       regulators_node = fdt_subnode_offset(blob, dev->of_offset,
+       regulators_node = fdt_subnode_offset(blob, dev_of_offset(dev),
                                             "regulators");
        if (regulators_node <= 0) {
                debug("%s: %s regulators subnode not found!", __func__,
index 3d2d9081c1b1fbb45d4f2b400bd83c06b0a8f269..cd5213766dc8707a6fe4a637a4f965a263d27a05 100644 (file)
@@ -28,7 +28,7 @@ static int fixed_regulator_ofdata_to_platdata(struct udevice *dev)
        struct fixed_regulator_platdata *dev_pdata;
        struct gpio_desc *gpio;
        const void *blob = gd->fdt_blob;
-       int node = dev->of_offset, flags = GPIOD_IS_OUT;
+       int node = dev_of_offset(dev), flags = GPIOD_IS_OUT;
        int ret;
 
        dev_pdata = dev_get_platdata(dev);
@@ -54,7 +54,7 @@ static int fixed_regulator_ofdata_to_platdata(struct udevice *dev)
 
        /* Get optional ramp up delay */
        dev_pdata->startup_delay_us = fdtdec_get_uint(gd->fdt_blob,
-                                                     dev->of_offset,
+                                                     dev_of_offset(dev),
                                                      "startup-delay-us", 0);
 
        return 0;
index 0a60a9cfc6a20d26ad0db54b6abceaead93cc1b6..42391c69b4307bcf9eaf005570d56186db2469a6 100644 (file)
@@ -30,7 +30,7 @@ static int gpio_regulator_ofdata_to_platdata(struct udevice *dev)
        struct gpio_regulator_platdata *dev_pdata;
        struct gpio_desc *gpio;
        const void *blob = gd->fdt_blob;
-       int node = dev->of_offset;
+       int node = dev_of_offset(dev);
        int ret, count, i, j;
        u32 states_array[8];
 
index b0a4c5da6d807c7d0668387434bea528dd3dfa7b..4875238e43d7935e9a772f33acc1fc638ce348de 100644 (file)
@@ -88,7 +88,7 @@ static int pwm_regulator_ofdata_to_platdata(struct udevice *dev)
        struct pwm_regulator_info *priv = dev_get_priv(dev);
        struct fdtdec_phandle_args args;
        const void *blob = gd->fdt_blob;
-       int node = dev->of_offset;
+       int node = dev_of_offset(dev);
        int ret;
 
        ret = fdtdec_parse_phandle_with_args(blob, node, "pwms", "#pwm-cells",
index 52a107036325e2fb31d150e7fd3890d3f72432df..2e0b5ed307f9e8447781336484258762a82b0905 100644 (file)
@@ -278,7 +278,7 @@ static bool regulator_name_is_unique(struct udevice *check_dev,
 static int regulator_post_bind(struct udevice *dev)
 {
        struct dm_regulator_uclass_platdata *uc_pdata;
-       int offset = dev->of_offset;
+       int offset = dev_of_offset(dev);
        const void *blob = gd->fdt_blob;
        const char *property = "regulator-name";
 
@@ -308,7 +308,7 @@ static int regulator_post_bind(struct udevice *dev)
 static int regulator_pre_probe(struct udevice *dev)
 {
        struct dm_regulator_uclass_platdata *uc_pdata;
-       int offset = dev->of_offset;
+       int offset = dev_of_offset(dev);
 
        uc_pdata = dev_get_uclass_platdata(dev);
        if (!uc_pdata)
index 200cf61bc948b71c9331fc2b07cf45c12f37046a..b6e67f2bf3e4924de4386a903c08ef6e4dfa1460 100644 (file)
@@ -116,7 +116,7 @@ static int rproc_pre_probe(struct udevice *dev)
 
        if (!dev->platdata) {
 #if CONFIG_IS_ENABLED(OF_CONTROL)
-               int node = dev->of_offset;
+               int node = dev_of_offset(dev);
                const void *blob = gd->fdt_blob;
                bool tmp;
                if (!blob) {
index 76ac3be092e2567642316221326fd1f86b2502c2..bb7a145f45242a9ca6188c44fa1a014dc5fb5705 100644 (file)
@@ -33,7 +33,7 @@ struct ti_powerproc_privdata {
 static int ti_of_to_priv(struct udevice *dev,
                         struct ti_powerproc_privdata *priv)
 {
-       int node = dev->of_offset;
+       int node = dev_of_offset(dev);
        const void *blob = gd->fdt_blob;
        int tmp;
 
index d3744ef703cbb1f7976f3ca6a778a6f094ff62b7..e92b24fa34ac7b767b7077bb7a4034fc2310f283 100644 (file)
@@ -43,7 +43,7 @@ int reset_get_by_index(struct udevice *dev, int index,
        debug("%s(dev=%p, index=%d, reset_ctl=%p)\n", __func__, dev, index,
              reset_ctl);
 
-       ret = fdtdec_parse_phandle_with_args(gd->fdt_blob, dev->of_offset,
+       ret = fdtdec_parse_phandle_with_args(gd->fdt_blob, dev_of_offset(dev),
                                             "resets", "#reset-cells", 0,
                                             index, &args);
        if (ret) {
@@ -88,7 +88,7 @@ int reset_get_by_name(struct udevice *dev, const char *name,
        debug("%s(dev=%p, name=%s, reset_ctl=%p)\n", __func__, dev, name,
              reset_ctl);
 
-       index = fdt_stringlist_search(gd->fdt_blob, dev->of_offset,
+       index = fdt_stringlist_search(gd->fdt_blob, dev_of_offset(dev),
                                      "reset-names", name);
        if (index < 0) {
                debug("fdt_stringlist_search() failed: %d\n", index);
index eff9c592d65159f451800aff05b2c33ca07c0b66..8344940282eb431455f12c042d497970a1dfd0e4 100644 (file)
@@ -92,7 +92,7 @@ static int altera_uart_ofdata_to_platdata(struct udevice *dev)
        plat->regs = map_physmem(dev_get_addr(dev),
                                 sizeof(struct altera_uart_regs),
                                 MAP_NOCACHE);
-       plat->uartclk = fdtdec_get_int(gd->fdt_blob, dev->of_offset,
+       plat->uartclk = fdtdec_get_int(gd->fdt_blob, dev_of_offset(dev),
                "clock-frequency", 0);
 
        return 0;
index 2df4a1f04fe52620776817a09340b5674ed1f499..1f819d487b6e84bada1002c1436bb3752965eca9 100644 (file)
@@ -383,13 +383,13 @@ int ns16550_serial_ofdata_to_platdata(struct udevice *dev)
                int ret;
 
                /* we prefer to use a memory-mapped register */
-               ret = fdtdec_get_pci_addr(gd->fdt_blob, dev->of_offset,
+               ret = fdtdec_get_pci_addr(gd->fdt_blob, dev_of_offset(dev),
                                          FDT_PCI_SPACE_MEM32, "reg",
                                          &pci_addr);
                if (ret) {
                        /* try if there is any i/o-mapped register */
                        ret = fdtdec_get_pci_addr(gd->fdt_blob,
-                                                 dev->of_offset,
+                                                 dev_of_offset(dev),
                                                  FDT_PCI_SPACE_IO,
                                                  "reg", &pci_addr);
                        if (ret)
@@ -413,9 +413,9 @@ int ns16550_serial_ofdata_to_platdata(struct udevice *dev)
        plat->base = (unsigned long)map_physmem(addr, 0, MAP_NOCACHE);
 #endif
 
-       plat->reg_offset = fdtdec_get_int(gd->fdt_blob, dev->of_offset,
+       plat->reg_offset = fdtdec_get_int(gd->fdt_blob, dev_of_offset(dev),
                                     "reg-offset", 0);
-       plat->reg_shift = fdtdec_get_int(gd->fdt_blob, dev->of_offset,
+       plat->reg_shift = fdtdec_get_int(gd->fdt_blob, dev_of_offset(dev),
                                         "reg-shift", 0);
 
        err = clk_get_by_index(dev, 0, &clk);
@@ -429,7 +429,7 @@ int ns16550_serial_ofdata_to_platdata(struct udevice *dev)
        }
 
        if (!plat->clock)
-               plat->clock = fdtdec_get_int(gd->fdt_blob, dev->of_offset,
+               plat->clock = fdtdec_get_int(gd->fdt_blob, dev_of_offset(dev),
                                             "clock-frequency",
                                             CONFIG_SYS_NS16550_CLK);
        if (!plat->clock) {
index bcc3465312e8819c71ff3667b3847b09e6de84bd..858e340f5937d0b7b5031042893063f19a905bd0 100644 (file)
@@ -152,7 +152,7 @@ static int sandbox_serial_ofdata_to_platdata(struct udevice *dev)
        int i;
 
        plat->colour = -1;
-       colour = fdt_getprop(gd->fdt_blob, dev->of_offset,
+       colour = fdt_getprop(gd->fdt_blob, dev_of_offset(dev),
                             "sandbox,text-colour", NULL);
        if (colour) {
                for (i = 0; i < ARRAY_SIZE(ansi_colour); i++) {
index 326a536a26ad47801b40eee9b44a7f04ce084641..fc91977b4c8aa358aa1c5dbe5b426166202ae260 100644 (file)
@@ -115,7 +115,7 @@ static int arc_serial_ofdata_to_platdata(struct udevice *dev)
        DECLARE_GLOBAL_DATA_PTR;
 
        plat->reg = (struct arc_serial_regs *)dev_get_addr(dev);
-       plat->uartclk = fdtdec_get_int(gd->fdt_blob, dev->of_offset,
+       plat->uartclk = fdtdec_get_int(gd->fdt_blob, dev_of_offset(dev),
                                       "clock-frequency", 0);
 
        return 0;
index 3884f744cda0f36515cff86a921cd5f349db426d..e7ed8993b847009795c1cb32788f826ff8e34b23 100644 (file)
@@ -164,8 +164,9 @@ static int bcm283x_mu_serial_ofdata_to_platdata(struct udevice *dev)
                return -EINVAL;
 
        plat->base = addr;
-       plat->clock = fdtdec_get_int(gd->fdt_blob, dev->of_offset, "clock", 1);
-       plat->skip_init = fdtdec_get_bool(gd->fdt_blob, dev->of_offset,
+       plat->clock = fdtdec_get_int(gd->fdt_blob, dev_of_offset(dev), "clock",
+                                    1);
+       plat->skip_init = fdtdec_get_bool(gd->fdt_blob, dev_of_offset(dev),
                                          "skip-init");
        plat->disabled = false;
        return 0;
index a7cab1346f228a5ff10c55c36338876a2ce28929..63b3006c638ade35b66f9c4115d560717ef6042f 100644 (file)
@@ -146,7 +146,7 @@ static const struct dm_serial_ops msm_serial_ops = {
 
 static int msm_uart_clk_init(struct udevice *dev)
 {
-       uint clk_rate = fdtdec_get_uint(gd->fdt_blob, dev->of_offset,
+       uint clk_rate = fdtdec_get_uint(gd->fdt_blob, dev_of_offset(dev),
                                        "clock-frequency", 115200);
        uint clkd[2]; /* clk_id and clk_no */
        int clk_offset;
@@ -154,8 +154,8 @@ static int msm_uart_clk_init(struct udevice *dev)
        struct clk clk;
        int ret;
 
-       ret = fdtdec_get_int_array(gd->fdt_blob, dev->of_offset, "clock", clkd,
-                                  2);
+       ret = fdtdec_get_int_array(gd->fdt_blob, dev_of_offset(dev), "clock",
+                                  clkd, 2);
        if (ret)
                return ret;
 
index 4fd2b1dd054f39cf5e560b10e93708147be27815..1cfcbf25b4f1755a46ed73ffa7402f33abc01437 100644 (file)
@@ -359,7 +359,7 @@ static int mxc_serial_ofdata_to_platdata(struct udevice *dev)
 
        plat->reg = (struct mxc_uart *)addr;
 
-       plat->use_dte = fdtdec_get_bool(gd->fdt_blob, dev->of_offset,
+       plat->use_dte = fdtdec_get_bool(gd->fdt_blob, dev_of_offset(dev),
                                        "fsl,dte-mode");
        return 0;
 }
index c2141f0a083dfc8651d89c126eed36ccad018300..b0e01aa0e5c1064afe97a8d9f88d2e9751f37f11 100644 (file)
@@ -141,7 +141,8 @@ static int pic32_uart_probe(struct udevice *dev)
        int ret;
 
        /* get address */
-       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;
 
index a8d3d675d577c9776fd9d61d2a87906ad5b9809e..a49134a95a8e877be262dd8893d5d87042e19d0c 100644 (file)
@@ -354,9 +354,10 @@ static int pl01x_serial_ofdata_to_platdata(struct udevice *dev)
                return -EINVAL;
 
        plat->base = addr;
-       plat->clock = fdtdec_get_int(gd->fdt_blob, dev->of_offset, "clock", 1);
+       plat->clock = fdtdec_get_int(gd->fdt_blob, dev_of_offset(dev), "clock",
+                                    1);
        plat->type = dev_get_driver_data(dev);
-       plat->skip_init = fdtdec_get_bool(gd->fdt_blob, dev->of_offset,
+       plat->skip_init = fdtdec_get_bool(gd->fdt_blob, dev_of_offset(dev),
                                          "skip-init");
        return 0;
 }
index 622547951e69cf57353dacab151b9b4ecbfb7c5d..96842de8d4765893d955fb270c29cc0d2651f7aa 100644 (file)
@@ -187,7 +187,7 @@ static int s5p_serial_ofdata_to_platdata(struct udevice *dev)
                return -EINVAL;
 
        plat->reg = (struct s5p_uart *)addr;
-       plat->port_id = fdtdec_get_int(gd->fdt_blob, dev->of_offset,
+       plat->port_id = fdtdec_get_int(gd->fdt_blob, dev_of_offset(dev),
                                        "id", dev->seq);
        return 0;
 }
index ef7cf0f26c84673799b79d08f66ceb777e568ffa..51f7fbcfb795ee502e8ca55e5e0c61cd7a9d3d58 100644 (file)
@@ -216,12 +216,13 @@ static int sh_serial_ofdata_to_platdata(struct udevice *dev)
        struct sh_serial_platdata *plat = dev_get_platdata(dev);
        fdt_addr_t addr;
 
-       addr = fdtdec_get_addr(gd->fdt_blob, dev->of_offset, "reg");
+       addr = fdtdec_get_addr(gd->fdt_blob, dev_of_offset(dev), "reg");
        if (addr == FDT_ADDR_T_NONE)
                return -EINVAL;
 
        plat->base = addr;
-       plat->clk = fdtdec_get_int(gd->fdt_blob, dev->of_offset, "clock", 1);
+       plat->clk = fdtdec_get_int(gd->fdt_blob, dev_of_offset(dev), "clock",
+                                  1);
        plat->type = dev_get_driver_data(dev);
        return 0;
 }
index 4ea5304b1d016314160f1d61776e73049995ac57..0e25cba6acc6b47e7126d785389afe105b5fc62d 100644 (file)
@@ -105,7 +105,7 @@ static int uniphier_serial_probe(struct udevice *dev)
 
        priv->membase = port;
 
-       priv->uartclk = fdtdec_get_int(gd->fdt_blob, dev->of_offset,
+       priv->uartclk = fdtdec_get_int(gd->fdt_blob, dev_of_offset(dev),
                                       "clock-frequency", 0);
 
        tmp = readl(&port->lcr_mcr);
index f16f90de2898cd5bd4f699fead2eeaf43643f07d..9a6e41f33076d9584e1f61285979cee5cc3b6997 100644 (file)
@@ -282,7 +282,7 @@ static int cadence_spi_ofdata_to_platdata(struct udevice *bus)
 {
        struct cadence_spi_platdata *plat = bus->platdata;
        const void *blob = gd->fdt_blob;
-       int node = bus->of_offset;
+       int node = dev_of_offset(bus);
        int subnode;
        u32 data[4];
        int ret;
index 20aa99a451dc7cab03e33625d8da6e291e3f8bf8..65d37b0b9fabd3457bba307fc98f9f519841fc78 100644 (file)
@@ -540,7 +540,7 @@ static int davinci_ofdata_to_platadata(struct udevice *bus)
 {
        struct davinci_spi_slave *ds = dev_get_priv(bus);
        const void *blob = gd->fdt_blob;
-       int node = bus->of_offset;
+       int node = dev_of_offset(bus);
 
        ds->regs = dev_map_physmem(bus, sizeof(struct davinci_spi_regs));
        if (!ds->regs) {
index 24a6e982054c5ce67893c81b85a1f74397b8ff56..9d5e29c6c3f690eeff560042a946ac27d4030fd1 100644 (file)
@@ -132,7 +132,7 @@ static int dw_spi_ofdata_to_platdata(struct udevice *bus)
 {
        struct dw_spi_platdata *plat = bus->platdata;
        const void *blob = gd->fdt_blob;
-       int node = bus->of_offset;
+       int node = dev_of_offset(bus);
 
        plat->regs = (struct dw_spi *)dev_get_addr(bus);
 
index 44948c37364d27d42138fd824145e426ad56acdf..aa0784c04a55947709ea6fa051bcd017c96073ae 100644 (file)
@@ -253,7 +253,7 @@ static int exynos_spi_ofdata_to_platdata(struct udevice *bus)
 {
        struct exynos_spi_platdata *plat = bus->platdata;
        const void *blob = gd->fdt_blob;
-       int node = bus->of_offset;
+       int node = dev_of_offset(bus);
 
        plat->regs = (struct exynos_spi *)dev_get_addr(bus);
        plat->periph_id = pinmux_decode_periph_id(blob, node);
index f213587557c6baad1d958caebb0dc55c7ffba3b8..e09985ef2bff3eb51e14cb45bc27b9095923f3f2 100644 (file)
@@ -646,7 +646,7 @@ static int fsl_dspi_ofdata_to_platdata(struct udevice *bus)
        fdt_addr_t addr;
        struct fsl_dspi_platdata *plat = bus->platdata;
        const void *blob = gd->fdt_blob;
-       int node = bus->of_offset;
+       int node = dev_of_offset(bus);
 
        if (fdtdec_get_bool(blob, node, "big-endian"))
                plat->flags |= DSPI_FLAG_REGMAP_ENDIAN_BIG;
index 4d378c227d5bc7e47e1211ed27a7e3cb91716b92..b2a058380f69ea271602af6815d9cf0bba5441da 100644 (file)
@@ -1078,7 +1078,7 @@ static int fsl_qspi_ofdata_to_platdata(struct udevice *bus)
        struct fdt_resource res_regs, res_mem;
        struct fsl_qspi_platdata *plat = bus->platdata;
        const void *blob = gd->fdt_blob;
-       int node = bus->of_offset;
+       int node = dev_of_offset(bus);
        int ret, flash_num = 0, subnode;
 
        if (fdtdec_get_bool(blob, node, "big-endian"))
index caf0103dc386ec732dfa444b4e734da25450f3ca..893fe33b66f77572870397d17d45a077c2075b9a 100644 (file)
@@ -658,14 +658,14 @@ static int ich_spi_child_pre_probe(struct udevice *dev)
 static int ich_spi_ofdata_to_platdata(struct udevice *dev)
 {
        struct ich_spi_platdata *plat = dev_get_platdata(dev);
+       int node = dev_of_offset(dev);
        int ret;
 
-       ret = fdt_node_check_compatible(gd->fdt_blob, dev->of_offset,
-                                       "intel,ich7-spi");
+       ret = fdt_node_check_compatible(gd->fdt_blob, node, "intel,ich7-spi");
        if (ret == 0) {
                plat->ich_version = ICHV_7;
        } else {
-               ret = fdt_node_check_compatible(gd->fdt_blob, dev->of_offset,
+               ret = fdt_node_check_compatible(gd->fdt_blob, node,
                                                "intel,ich9-spi");
                if (ret == 0)
                        plat->ich_version = ICHV_9;
index 7c58c3661fa2c06cf35894df811a2803fde017ed..ee847e461050e6e1230f64085d56b098c52aa864 100644 (file)
@@ -261,9 +261,9 @@ static int mvebu_spi_ofdata_to_platdata(struct udevice *bus)
         * it should be used to read the input clock and the DT property
         * can be removed.
         */
-       plat->clock = fdtdec_get_int(gd->fdt_blob, bus->of_offset,
+       plat->clock = fdtdec_get_int(gd->fdt_blob, dev_of_offset(bus),
                                     "clock-frequency", 160000);
-       plat->frequency = fdtdec_get_int(gd->fdt_blob, bus->of_offset,
+       plat->frequency = fdtdec_get_int(gd->fdt_blob, dev_of_offset(bus),
                                         "spi-max-frequency", 40000);
 
        return 0;
index 60e9d6e82552c8d18711a3667508d794545b880b..8a8945010973c54c09f5eac4532354315ee6f3bc 100644 (file)
@@ -627,7 +627,7 @@ static int omap3_spi_probe(struct udevice *dev)
 {
        struct omap3_spi_priv *priv = dev_get_priv(dev);
        const void *blob = gd->fdt_blob;
-       int node = dev->of_offset;
+       int node = dev_of_offset(dev);
 
        struct omap2_mcspi_platform_config* data =
                (struct omap2_mcspi_platform_config*)dev_get_driver_data(dev);
index 25ca1f3e1ba0392249cee85793c46aa3b9d3f5a2..78d78bc54bad97bf99aa544d12cd7d64bfe793d5 100644 (file)
@@ -377,13 +377,14 @@ static int pic32_spi_probe(struct udevice *bus)
 {
        struct pic32_spi_priv *priv = dev_get_priv(bus);
        struct dm_spi_bus *dm_spi = dev_get_uclass_priv(bus);
+       int node = dev_of_offset(bus);
        struct udevice *clkdev;
        fdt_addr_t addr;
        fdt_size_t size;
        int ret;
 
        debug("%s: %d, bus: %i\n", __func__, __LINE__, bus->seq);
-       addr = fdtdec_get_addr_size(gd->fdt_blob, bus->of_offset, "reg", &size);
+       addr = fdtdec_get_addr_size(gd->fdt_blob, node, "reg", &size);
        if (addr == FDT_ADDR_T_NONE)
                return -EINVAL;
 
@@ -391,8 +392,8 @@ static int pic32_spi_probe(struct udevice *bus)
        if (!priv->regs)
                return -EINVAL;
 
-       dm_spi->max_hz = fdtdec_get_int(gd->fdt_blob, bus->of_offset,
-                                       "spi-max-frequency", 250000000);
+       dm_spi->max_hz = fdtdec_get_int(gd->fdt_blob, node, "spi-max-frequency",
+                                       250000000);
        /* get clock rate */
        ret = clk_get_by_index(bus, 0, &clkdev);
        if (ret < 0) {
@@ -413,8 +414,7 @@ static int pic32_spi_probe(struct udevice *bus)
         * of the ongoing transfer. To avoid this sort of error we will drive
         * /CS manually by toggling cs-gpio pins.
         */
-       ret = gpio_request_by_name_nodev(gd->fdt_blob, bus->of_offset,
-                                        "cs-gpios", 0,
+       ret = gpio_request_by_name_nodev(gd->fdt_blob, node, "cs-gpios", 0,
                                         &priv->cs_gpio, GPIOD_IS_OUT);
        if (ret) {
                printf("pic32-spi: error, cs-gpios not found\n");
index 15cf0bda202a72b7257e27a5eff97bdd8250485f..3e44f1795e3ccbcfedb606ece22b01bebd07fde5 100644 (file)
@@ -164,7 +164,7 @@ static int rockchip_spi_ofdata_to_platdata(struct udevice *bus)
        struct rockchip_spi_platdata *plat = dev_get_platdata(bus);
        struct rockchip_spi_priv *priv = dev_get_priv(bus);
        const void *blob = gd->fdt_blob;
-       int node = bus->of_offset;
+       int node = dev_of_offset(bus);
        int ret;
 
        plat->base = dev_get_addr(bus);
index d23dc81a211edc865b516f07a1e8e3a45f9e4993..1690cd76f90ac451cb8c2d6e05b8bcc38b61487e 100644 (file)
@@ -202,7 +202,7 @@ static int soft_spi_ofdata_to_platdata(struct udevice *dev)
 {
        struct soft_spi_platdata *plat = dev->platdata;
        const void *blob = gd->fdt_blob;
-       int node = dev->of_offset;
+       int node = dev_of_offset(dev);
 
        plat->spi_delay_us = fdtdec_get_int(blob, node, "spi-delay-us", 0);
 
index 1ab5b75fa1fc642a3971a58625ddca0a9c70d381..ac17da0777d53a07769da1100e908960fe77405a 100644 (file)
@@ -113,10 +113,11 @@ static int spi_child_post_bind(struct udevice *dev)
 {
        struct dm_spi_slave_platdata *plat = dev_get_parent_platdata(dev);
 
-       if (dev->of_offset == -1)
+       if (dev_of_offset(dev) == -1)
                return 0;
 
-       return spi_slave_ofdata_to_platdata(gd->fdt_blob, dev->of_offset, plat);
+       return spi_slave_ofdata_to_platdata(gd->fdt_blob, dev_of_offset(dev),
+                                           plat);
 }
 #endif
 
@@ -125,7 +126,7 @@ static int spi_post_probe(struct udevice *bus)
 #if !CONFIG_IS_ENABLED(OF_PLATDATA)
        struct dm_spi_bus *spi = dev_get_uclass_priv(bus);
 
-       spi->max_hz = fdtdec_get_int(gd->fdt_blob, bus->of_offset,
+       spi->max_hz = fdtdec_get_int(gd->fdt_blob, dev_of_offset(bus),
                                     "spi-max-frequency", 0);
 #endif
 #if defined(CONFIG_NEEDS_MANUAL_RELOC)
index 123a1f368d8a2e9b2c8c308961186140639282f5..05358ebf4cd1bbb7512acf7d4049b53e60dd6191 100644 (file)
@@ -411,7 +411,7 @@ static int stm32_qspi_ofdata_to_platdata(struct udevice *bus)
        struct fdt_resource res_regs, res_mem;
        struct stm32_qspi_platdata *plat = bus->platdata;
        const void *blob = gd->fdt_blob;
-       int node = bus->of_offset;
+       int node = dev_of_offset(bus);
        int ret;
 
        ret = fdt_get_named_resource(blob, node, "reg", "reg-names",
index 509afba0a298c54bf9ed7f74f45db27a8ae29612..897409ca02faab242a8ec45c235b8d329c546e72 100644 (file)
@@ -101,7 +101,7 @@ static int tegra114_spi_ofdata_to_platdata(struct udevice *bus)
 {
        struct tegra_spi_platdata *plat = bus->platdata;
        const void *blob = gd->fdt_blob;
-       int node = bus->of_offset;
+       int node = dev_of_offset(bus);
 
        plat->base = dev_get_addr(bus);
        plat->periph_id = clock_decode_periph_id(blob, node);
index ce3a2d398cfba08bbd1bf77b7b3f741552154b10..ecbf4c16f3b5eb9435c9741df5787e62a1169961 100644 (file)
@@ -88,7 +88,7 @@ static int tegra20_sflash_ofdata_to_platdata(struct udevice *bus)
 {
        struct tegra_spi_platdata *plat = bus->platdata;
        const void *blob = gd->fdt_blob;
-       int node = bus->of_offset;
+       int node = dev_of_offset(bus);
 
        plat->base = dev_get_addr(bus);
        plat->periph_id = clock_decode_periph_id(blob, node);
index e1da23b7b44b62cbd24d9cb581f7fa98ad9dac08..1d99a1e910e5cff3151c6fdd32d554373b9eb527 100644 (file)
@@ -94,7 +94,7 @@ static int tegra30_spi_ofdata_to_platdata(struct udevice *bus)
 {
        struct tegra_spi_platdata *plat = bus->platdata;
        const void *blob = gd->fdt_blob;
-       int node = bus->of_offset;
+       int node = dev_of_offset(bus);
 
        plat->base = dev_get_addr(bus);
        plat->periph_id = clock_decode_periph_id(blob, node);
index 026cff0c152e1075565315cf78392fdfaec74a03..1e094cbc8b34a4dafa53cf14517c2b401430cab4 100644 (file)
@@ -97,7 +97,7 @@ static int tegra210_qspi_ofdata_to_platdata(struct udevice *bus)
 {
        struct tegra_spi_platdata *plat = bus->platdata;
        const void *blob = gd->fdt_blob;
-       int node = bus->of_offset;
+       int node = dev_of_offset(bus);
 
        plat->base = dev_get_addr(bus);
        plat->periph_id = clock_decode_periph_id(blob, node);
index 6f9f983524d1f051158f5508b32cbeb75fb109dc..79955d75979544ff2540c324695f68c1352bce67 100644 (file)
@@ -553,7 +553,7 @@ static int ti_qspi_ofdata_to_platdata(struct udevice *bus)
 {
        struct ti_qspi_priv *priv = dev_get_priv(bus);
        const void *blob = gd->fdt_blob;
-       int node = bus->of_offset;
+       int node = dev_of_offset(bus);
        fdt_addr_t addr;
        void *mmap;
 
index b98663c23b21e72e62eb970c42ed1f68b7135d42..255e02f585da4a9a6df77d6d477b3464eafeb097 100644 (file)
@@ -101,7 +101,7 @@ static int zynq_qspi_ofdata_to_platdata(struct udevice *bus)
 {
        struct zynq_qspi_platdata *plat = bus->platdata;
        const void *blob = gd->fdt_blob;
-       int node = bus->of_offset;
+       int node = dev_of_offset(bus);
 
        plat->regs = (struct zynq_qspi_regs *)fdtdec_get_addr(blob,
                                                              node, "reg");
index 15ca271ea4a8c02886030b2022e8b11a2a29f8db..5a9b1f0f2ee4cc369c1da3b1b655ae7e5d7f540d 100644 (file)
@@ -71,7 +71,7 @@ static int zynq_spi_ofdata_to_platdata(struct udevice *bus)
 {
        struct zynq_spi_platdata *plat = bus->platdata;
        const void *blob = gd->fdt_blob;
-       int node = bus->of_offset;
+       int node = dev_of_offset(bus);
 
        plat->regs = (struct zynq_spi_regs *)dev_get_addr(bus);
 
index 48bc15759645835760ee7730e0e458372aae9201..605683fc0e5ecf3879b099abcbf2d9d5e2d2cc94 100644 (file)
@@ -147,18 +147,14 @@ static int msm_spmi_probe(struct udevice *dev)
 {
        struct udevice *parent = dev->parent;
        struct msm_spmi_priv *priv = dev_get_priv(dev);
+       int node = dev_of_offset(dev);
        int i;
 
        priv->arb_chnl = dev_get_addr(dev);
        priv->spmi_core = fdtdec_get_addr_size_auto_parent(gd->fdt_blob,
-                                                          parent->of_offset,
-                                                          dev->of_offset,
-                                                          "reg", 1, NULL,
-                                                          false);
+                       dev_of_offset(parent), node, "reg", 1, NULL, false);
        priv->spmi_obs = fdtdec_get_addr_size_auto_parent(gd->fdt_blob,
-                                                         parent->of_offset,
-                                                         dev->of_offset, "reg",
-                                                         2, NULL, false);
+                       dev_of_offset(parent), node, "reg", 2, NULL, false);
        if (priv->arb_chnl == FDT_ADDR_T_NONE ||
            priv->spmi_core == FDT_ADDR_T_NONE ||
            priv->spmi_obs == FDT_ADDR_T_NONE)
index 7ae7f386ee026aeccfa498250177de78044e2c87..0c4e2e1a93a696903cee0c8fb8f6e7e303854155 100644 (file)
@@ -41,7 +41,7 @@ static int sandbox_sysreset_request(struct udevice *dev, enum sysreset_t type)
         * (see the U_BOOT_DEVICE() declaration below) should not do anything.
         * If we are that device, return an error.
         */
-       if (state->fdt_fname && dev->of_offset == -1)
+       if (state->fdt_fname && dev_of_offset(dev) == -1)
                return -ENODEV;
 
        switch (type) {
index 5c63e6b41014ea92a43535a617d988492796420f..1caf3cd2887a4b8fcb639d90c0288c6ae3e731ce 100644 (file)
@@ -55,7 +55,7 @@ static int timer_pre_probe(struct udevice *dev)
                uc_priv->clock_rate = ret;
        } else
                uc_priv->clock_rate = fdtdec_get_int(gd->fdt_blob,
-                               dev->of_offset, "clock-frequency", 0);
+                               dev_of_offset(dev),     "clock-frequency", 0);
 
        return 0;
 }
index 0965ad01d3d69875e69bd1cf3e1b548b0029b666..9abb323745aa9609f693bb411687fc88d4cfd98c 100644 (file)
@@ -373,8 +373,8 @@ static int sandbox_flash_ofdata_to_platdata(struct udevice *dev)
        struct sandbox_flash_plat *plat = dev_get_platdata(dev);
        const void *blob = gd->fdt_blob;
 
-       plat->pathname = fdt_getprop(blob, dev->of_offset, "sandbox,filepath",
-                                    NULL);
+       plat->pathname = fdt_getprop(blob, dev_of_offset(dev),
+                                    "sandbox,filepath", NULL);
 
        return 0;
 }
index 624fbdecf1f965bcda9cc4244d21905f06f87af7..c3a8e73389d4afc3e38f7a561b5263568f6125de 100644 (file)
@@ -277,7 +277,8 @@ static int sandbox_child_post_bind(struct udevice *dev)
 {
        struct sandbox_hub_platdata *plat = dev_get_parent_platdata(dev);
 
-       plat->port = fdtdec_get_int(gd->fdt_blob, dev->of_offset, "reg", -1);
+       plat->port = fdtdec_get_int(gd->fdt_blob, dev_of_offset(dev), "reg",
+                                   -1);
 
        return 0;
 }
index d08879dc67de2ca6a58d913a5c945402f71d44da..d253b946f334a2fae4cfad5f7a89da60c4433266 100644 (file)
@@ -1199,8 +1199,8 @@ static int dwc2_usb_ofdata_to_platdata(struct udevice *dev)
                return -EINVAL;
        priv->regs = (struct dwc2_core_regs *)addr;
 
-       prop = fdt_getprop(gd->fdt_blob, dev->of_offset, "disable-over-current",
-                          NULL);
+       prop = fdt_getprop(gd->fdt_blob, dev_of_offset(dev),
+                          "disable-over-current", NULL);
        if (prop)
                priv->oc_disable = true;
 
index 53281d78b35f1b39860da8aa2b027cbdcf2a68ed..981543e31501cd6ad7fe10e2704ff39dabb8cd69 100644 (file)
@@ -59,7 +59,7 @@ static int ehci_usb_ofdata_to_platdata(struct udevice *dev)
        }
 
        depth = 0;
-       node = fdtdec_next_compatible_subnode(blob, dev->of_offset,
+       node = fdtdec_next_compatible_subnode(blob, dev_of_offset(dev),
                                COMPAT_SAMSUNG_EXYNOS_USB_PHY, &depth);
        if (node <= 0) {
                debug("XHCI: Can't get device node for usb3-phy controller\n");
index 9c3292182683952d7b488b2bdda5c85f4b41a7d7..7ad50fccee35319e0c5f1aa04b97c6a41ccff22a 100644 (file)
@@ -61,7 +61,7 @@ static int ehci_fsl_ofdata_to_platdata(struct udevice *dev)
        struct ehci_fsl_priv *priv = dev_get_priv(dev);
        const void *prop;
 
-       prop = fdt_getprop(gd->fdt_blob, dev->of_offset, "phy_type",
+       prop = fdt_getprop(gd->fdt_blob, dev_of_offset(dev), "phy_type",
                           NULL);
        if (prop) {
                priv->phy_type = (char *)prop;
index 7b309b7b9617a95fd5f02429053812fb93b158c7..55ac162a3c04c09dbf15a6e54770af459d5b1921 100644 (file)
@@ -437,7 +437,7 @@ static int ehci_usb_phy_mode(struct udevice *dev)
        void *__iomem addr = (void *__iomem)dev_get_addr(dev);
        void *__iomem phy_ctrl, *__iomem phy_status;
        const void *blob = gd->fdt_blob;
-       int offset = dev->of_offset, phy_off;
+       int offset = dev_of_offset(dev), phy_off;
        u32 val;
 
        /*
@@ -484,7 +484,7 @@ static int ehci_usb_ofdata_to_platdata(struct udevice *dev)
        struct usb_platdata *plat = dev_get_platdata(dev);
        const char *mode;
 
-       mode = fdt_getprop(gd->fdt_blob, dev->of_offset, "dr_mode", NULL);
+       mode = fdt_getprop(gd->fdt_blob, dev_of_offset(dev), "dr_mode", NULL);
        if (mode) {
                if (strcmp(mode, "peripheral") == 0)
                        plat->init_type = USB_INIT_DEVICE;
index e3620da15fb13974a089834861d4d47d202b2aca..beb3b027963472933a1962dd9ad7626380f97c06 100644 (file)
@@ -696,7 +696,7 @@ static void config_clock(const u32 timing[])
 static int fdt_decode_usb(struct udevice *dev, struct fdt_usb *config)
 {
        const void *blob = gd->fdt_blob;
-       int node = dev->of_offset;
+       int node = dev_of_offset(dev);
        const char *phy, *mode;
 
        config->reg = (struct usb_ctlr *)dev_get_addr(dev);
index f389bff1718f09b7f5f979907e48cfcc48e307f2..84241cd17328715f78c18fde40b60c884eb863c1 100644 (file)
@@ -218,7 +218,7 @@ static int vf_usb_ofdata_to_platdata(struct udevice *dev)
 {
        struct ehci_vf_priv_data *priv = dev_get_priv(dev);
        const void *dt_blob = gd->fdt_blob;
-       int node = dev->of_offset;
+       int node = dev_of_offset(dev);
        const char *mode;
 
        priv->portnr = dev->seq;
index be114fc07715b3a900551cc1a55ba2da5198ecdb..5cf1e9a36cbc1deffddf40b41658317821744288 100644 (file)
@@ -686,16 +686,17 @@ int usb_child_post_bind(struct udevice *dev)
        const void *blob = gd->fdt_blob;
        int val;
 
-       if (dev->of_offset == -1)
+       if (dev_of_offset(dev) == -1)
                return 0;
 
        /* We only support matching a few things */
-       val = fdtdec_get_int(blob, dev->of_offset, "usb,device-class", -1);
+       val = fdtdec_get_int(blob, dev_of_offset(dev), "usb,device-class", -1);
        if (val != -1) {
                plat->id.match_flags |= USB_DEVICE_ID_MATCH_DEV_CLASS;
                plat->id.bDeviceClass = val;
        }
-       val = fdtdec_get_int(blob, dev->of_offset, "usb,interface-class", -1);
+       val = fdtdec_get_int(blob, dev_of_offset(dev), "usb,interface-class",
+                            -1);
        if (val != -1) {
                plat->id.match_flags |= USB_DEVICE_ID_MATCH_INT_CLASS;
                plat->id.bInterfaceClass = val;
index 82fcd84ef2f20dafddc3308f000434e2343b3ebf..b3f48b34e222d2b19f16254dc530325e50eb7ce9 100644 (file)
@@ -68,7 +68,7 @@ static int xhci_usb_ofdata_to_platdata(struct udevice *dev)
        }
 
        depth = 0;
-       node = fdtdec_next_compatible_subnode(blob, dev->of_offset,
+       node = fdtdec_next_compatible_subnode(blob, dev_of_offset(dev),
                                COMPAT_SAMSUNG_EXYNOS5_USB3_PHY, &depth);
        if (node <= 0) {
                debug("XHCI: Can't get device node for usb3-phy controller\n");
index 8cbcb8f923e0901caada82986289a3341cbda3f4..f559830185de3a49621252552e1dbdaae38b0073 100644 (file)
@@ -90,11 +90,11 @@ static void rockchip_dwc3_phy_setup(struct dwc3 *dwc3_reg,
        /* Set dwc3 usb2 phy config */
        reg = readl(&dwc3_reg->g_usb2phycfg[0]);
 
-       if (fdtdec_get_bool(blob, dev->of_offset,
+       if (fdtdec_get_bool(blob, dev_of_offset(dev),
                            "snps,dis-enblslpm-quirk"))
                reg &= ~DWC3_GUSB2PHYCFG_ENBLSLPM;
 
-       utmi_bits = fdtdec_get_int(blob, dev->of_offset,
+       utmi_bits = fdtdec_get_int(blob, dev_of_offset(dev),
                                   "snps,phyif-utmi-bits", -1);
        if (utmi_bits == 16) {
                reg |= DWC3_GUSB2PHYCFG_PHYIF;
@@ -106,11 +106,11 @@ static void rockchip_dwc3_phy_setup(struct dwc3 *dwc3_reg,
                reg |= DWC3_GUSB2PHYCFG_USBTRDTIM_8BIT;
        }
 
-       if (fdtdec_get_bool(blob, dev->of_offset,
+       if (fdtdec_get_bool(blob, dev_of_offset(dev),
                            "snps,dis-u2-freeclk-exists-quirk"))
                reg &= ~DWC3_GUSB2PHYCFG_U2_FREECLK_EXISTS;
 
-       if (fdtdec_get_bool(blob, dev->of_offset,
+       if (fdtdec_get_bool(blob, dev_of_offset(dev),
                            "snps,dis-u2-susphy-quirk"))
                reg &= ~DWC3_GUSB2PHYCFG_SUSPHY;
 
index c888c645fa015bc19ba3e40f21d0e95f4333a516..ed6da19eecdb52da9f88e4be662ed9d6dee2a71a 100644 (file)
@@ -219,7 +219,7 @@ static int musb_usb_probe(struct udevice *dev)
        struct musb_host_data *mdata = &pdata->mdata;
        struct fdt_resource mc, glue;
        void *fdt = (void *)gd->fdt_blob;
-       int node = dev->of_offset;
+       int node = dev_of_offset(dev);
        void __iomem *mregs;
        int ret;
 
index 1c15aa2a427f6570fbdfc30931524efc76a88e9c..852f07facc38e07a244bad501bb3ef8dd542c22f 100644 (file)
@@ -83,7 +83,7 @@ static int ti_musb_ofdata_to_platdata(struct udevice *dev)
 {
        struct ti_musb_platdata *platdata = dev_get_platdata(dev);
        const void *fdt = gd->fdt_blob;
-       int node = dev->of_offset;
+       int node = dev_of_offset(dev);
        int phys;
        int ctrl_mod;
        int usb_index;
@@ -178,7 +178,7 @@ static int ti_musb_host_ofdata_to_platdata(struct udevice *dev)
 {
        struct ti_musb_platdata *platdata = dev_get_platdata(dev);
        const void *fdt = gd->fdt_blob;
-       int node = dev->of_offset;
+       int node = dev_of_offset(dev);
        int ret;
 
        ret = ti_musb_ofdata_to_platdata(dev);
@@ -209,7 +209,7 @@ static int ti_musb_wrapper_bind(struct udevice *parent)
        int node;
        int ret;
 
-       for (node = fdt_first_subnode(fdt, parent->of_offset); node > 0;
+       for (node = fdt_first_subnode(fdt, dev_of_offset(parent)); node > 0;
             node = fdt_next_subnode(fdt, node)) {
                struct udevice *dev;
                const char *name = fdt_get_name(fdt, node, NULL);
index 39cd7caff16dbf25c3ff9e1f89bb95b032a71bf8..ed2bd306c6bc8471305740a0a782cbb281ad39d0 100644 (file)
@@ -276,7 +276,7 @@ static int atmel_fb_ofdata_to_platdata(struct udevice *dev)
        struct display_timing *timing = &priv->timing;
        const void *blob = gd->fdt_blob;
 
-       if (fdtdec_decode_display_timing(blob, dev->of_offset,
+       if (fdtdec_decode_display_timing(blob, dev_of_offset(dev),
                                         plat->timing_index, timing)) {
                debug("%s: Failed to decode display timing\n", __func__);
                return -EINVAL;
index 80f63e3eb5515f6019561eb242f8c2de4158785f..46aacca2b7dc8e610373874363a83ccbe9cd11e3 100644 (file)
@@ -86,7 +86,8 @@ static int ps8622_attach(struct udevice *dev)
        if (ret)
                return ret;
 
-       params = fdt_getprop(gd->fdt_blob, dev->of_offset, "parade,regs", &len);
+       params = fdt_getprop(gd->fdt_blob, dev_of_offset(dev), "parade,regs",
+                            &len);
        if (!params || len % 3) {
                debug("%s: missing/invalid params=%p, len=%x\n", __func__,
                      params, len);
index beef770f920f4d9c41933b28fa5cd9759a71d9ed..4612d0414efa5ecf2525d97d4b3442fd26bca436 100644 (file)
@@ -705,7 +705,7 @@ static int broadwell_igd_ofdata_to_platdata(struct udevice *dev)
 {
        struct broadwell_igd_plat *plat = dev_get_platdata(dev);
        struct broadwell_igd_priv *priv = dev_get_priv(dev);
-       int node = dev->of_offset;
+       int node = dev_of_offset(dev);
        const void *blob = gd->fdt_blob;
 
        if (fdtdec_get_int_array(blob, node, "intel,dp-hotplug",
index fc39f2c5620bca1cd00265ca837b895733b2e417..c5039e7b430c7e050c9741feba2335442e8562fb 100644 (file)
@@ -880,7 +880,7 @@ static int exynos_dp_ofdata_to_platdata(struct udevice *dev)
 {
        struct exynos_dp_priv *priv = dev_get_priv(dev);
        const void *blob = gd->fdt_blob;
-       unsigned int node = dev->of_offset;
+       unsigned int node = dev_of_offset(dev);
        fdt_addr_t addr;
 
        addr = dev_get_addr(dev);
index 5483d6613f76585fc5d15daad7e88c21a269773b..46320e7f02a71a20c7ed0ce4b9e8083eca619f42 100644 (file)
@@ -383,7 +383,7 @@ void exynos_fimd_lcd_init(struct udevice *dev)
        unsigned int offset;
        unsigned int node;
 
-       node = dev->of_offset;
+       node = dev_of_offset(dev);
        if (fdtdec_get_bool(gd->fdt_blob, node, "samsung,disable-sysmmu"))
                exynos_fimd_disable_sysmmu();
 
@@ -482,7 +482,7 @@ unsigned long exynos_fimd_calc_fbsize(struct exynos_fb_priv *priv)
 int exynos_fb_ofdata_to_platdata(struct udevice *dev)
 {
        struct exynos_fb_priv *priv = dev_get_priv(dev);
-       unsigned int node = dev->of_offset;
+       unsigned int node = dev_of_offset(dev);
        const void *blob = gd->fdt_blob;
        fdt_addr_t addr;
 
index f16d725f3c7bd510689e52052dba63e32ce93e42..d8af2e169635584f5afb53792852d82caf028f63 100644 (file)
@@ -517,7 +517,7 @@ static int gma_pm_init_pre_vbios(void *gtt_bar, int rev)
 static int gma_pm_init_post_vbios(struct udevice *dev, int rev, void *gtt_bar)
 {
        const void *blob = gd->fdt_blob;
-       int node = dev->of_offset;
+       int node = dev_of_offset(dev);
        u32 reg32, cycle_delay;
 
        debug("GT Power Management Init (post VBIOS)\n");
index de6277f4ffe8efdae5ff7edfee31e10214f4773f..3697f4905c92604477cd38d7aa45a6b450c582b2 100644 (file)
@@ -61,7 +61,7 @@ static int pwm_backlight_ofdata_to_platdata(struct udevice *dev)
        struct pwm_backlight_priv *priv = dev_get_priv(dev);
        struct fdtdec_phandle_args args;
        const void *blob = gd->fdt_blob;
-       int node = dev->of_offset;
+       int node = dev_of_offset(dev);
        int index, ret, count, len;
        const u32 *cell;
 
index fcbb4d63d25f3114d1929658ec4a088dfd96a060..ee43255753c3e8d3c5dae2f9f357bcc334e2a04d 100644 (file)
@@ -162,7 +162,7 @@ int rk_lvds_enable(struct udevice *dev, int panel_bpp,
 int rk_lvds_read_timing(struct udevice *dev, struct display_timing *timing)
 {
        if (fdtdec_decode_display_timing
-           (gd->fdt_blob, dev->of_offset, 0, timing)) {
+           (gd->fdt_blob, dev_of_offset(dev), 0, timing)) {
                debug("%s: Failed to decode display timing\n", __func__);
                return -EINVAL;
        }
@@ -174,7 +174,7 @@ static int rk_lvds_ofdata_to_platdata(struct udevice *dev)
 {
        struct rk_lvds_priv *priv = dev_get_priv(dev);
        const void *blob = gd->fdt_blob;
-       int node = dev->of_offset;
+       int node = dev_of_offset(dev);
        int ret;
        priv->regs = (void *)dev_get_addr(dev);
        priv->grf = syscon_get_first_range(ROCKCHIP_SYSCON_GRF);
index eab548699f74e1830966ebf08fa799c18a04c82f..aeecb5815be15e0f51d3fde88dea31cdfd01cff2 100644 (file)
@@ -321,7 +321,7 @@ static int rk_vop_probe(struct udevice *dev)
         * clock so it is currently not possible to use more than one display
         * device simultaneously.
         */
-       port = fdt_subnode_offset(blob, dev->of_offset, "port");
+       port = fdt_subnode_offset(blob, dev_of_offset(dev), "port");
        if (port < 0)
                return -EINVAL;
        for (node = fdt_first_subnode(blob, port);
index dc5a220d512448efc009cba06b2092056b216e39..18afe2f3fd356b557175e3266bac8f696b2daec7 100644 (file)
@@ -46,7 +46,7 @@ static int sandbox_sdl_bind(struct udevice *dev)
        struct video_uc_platdata *uc_plat = dev_get_uclass_platdata(dev);
        struct sandbox_sdl_plat *plat = dev_get_platdata(dev);
        const void *blob = gd->fdt_blob;
-       int node = dev->of_offset;
+       int node = dev_of_offset(dev);
        int ret = 0;
 
        plat->xres = fdtdec_get_int(blob, node, "xres", LCD_MAX_WIDTH);
index 92214d61b279210e173c845b058a0fe94ea2a952..0ba3f2c2b4bbaa684289332f9f2d7adf8f14a80c 100644 (file)
@@ -338,7 +338,7 @@ static int tegra_lcd_ofdata_to_platdata(struct udevice *dev)
        struct tegra_lcd_priv *priv = dev_get_priv(dev);
        const void *blob = gd->fdt_blob;
        struct display_timing *timing;
-       int node = dev->of_offset;
+       int node = dev_of_offset(dev);
        int panel_node;
        int rgb;
        int ret;
@@ -392,7 +392,7 @@ static int tegra_lcd_bind(struct udevice *dev)
 {
        struct video_uc_platdata *plat = dev_get_uclass_platdata(dev);
        const void *blob = gd->fdt_blob;
-       int node = dev->of_offset;
+       int node = dev_of_offset(dev);
        int rgb;
 
        rgb = fdt_subnode_offset(blob, node, "rgb");
index 28db96c952963b1a88ac3ad32b8268e3022a7ae9..bbbca13bdc4e1d76925c37f539c99808e19a8fb6 100644 (file)
@@ -363,9 +363,9 @@ static int display_init(struct udevice *dev, void *lcdbase,
                return ret;
        }
 
-       dc_ctlr = (struct dc_ctlr *)fdtdec_get_addr(blob, dev->of_offset,
+       dc_ctlr = (struct dc_ctlr *)fdtdec_get_addr(blob, dev_of_offset(dev),
                                                    "reg");
-       if (fdtdec_decode_display_timing(blob, dev->of_offset, 0, timing)) {
+       if (fdtdec_decode_display_timing(blob, dev_of_offset(dev), 0, timing)) {
                debug("%s: Failed to decode display timing\n", __func__);
                return -EINVAL;
        }
index e5cea51d48c81a01494effaba1d7eb674a9c5342..5e4140ff532044ac9a59c968dd431c249415dcd3 100644 (file)
@@ -757,7 +757,7 @@ int tegra_dc_sor_attach(struct udevice *dc_dev, struct udevice *dev,
 
        /* Use the first display controller */
        debug("%s\n", __func__);
-       node = dc_dev->of_offset;
+       node = dev_of_offset(dc_dev);
        disp_ctrl = (struct dc_ctlr *)fdtdec_get_addr(blob, node, "reg");
 
        tegra_dc_sor_enable_dc(disp_ctrl);
@@ -973,7 +973,7 @@ int tegra_dc_sor_detach(struct udevice *dc_dev, struct udevice *dev)
 
        debug("%s\n", __func__);
        /* Use the first display controller */
-       node = dc_dev->of_offset;
+       node = dev_of_offset(dc_dev);
        disp_ctrl = (struct dc_ctlr *)fdtdec_get_addr(blob, node, "reg");
 
        /* Sleep mode */
@@ -1045,7 +1045,7 @@ static int tegra_sor_ofdata_to_platdata(struct udevice *dev)
        int node;
        int ret;
 
-       priv->base = (void *)fdtdec_get_addr(blob, dev->of_offset, "reg");
+       priv->base = (void *)fdtdec_get_addr(blob, dev_of_offset(dev), "reg");
 
        node = fdtdec_next_compatible(blob, 0, COMPAT_NVIDIA_TEGRA124_PMC);
        if (node < 0) {
index 9948bd49fa53b86b54ea0b2775f27b9cf5577b1f..4e95fb7773d961cc1f9d20e1fe3b157d0209e431 100644 (file)
@@ -121,6 +121,16 @@ struct udevice {
 /* Returns non-zero if the device is active (probed and not removed) */
 #define device_active(dev)     ((dev)->flags & DM_FLAG_ACTIVATED)
 
+static inline int dev_of_offset(const struct udevice *dev)
+{
+       return dev->of_offset;
+}
+
+static inline void dev_set_of_offset(struct udevice *dev, int of_offset)
+{
+       dev->of_offset = of_offset;
+}
+
 /**
  * struct udevice_id - Lists the compatible strings supported by a driver
  * @compatible: Compatible string
index 5733096066c9780a4539270856b03ef4840ffab3..f52cb733c775f7f1f9661b6f245f1e5182c0c8a7 100644 (file)
@@ -35,7 +35,7 @@ static int dm_test_spi_find(struct unit_test_state *uts)
         */
        ut_asserteq(0, uclass_get_device_by_seq(UCLASS_SPI, busnum, &bus));
        ut_assertok(spi_cs_info(bus, cs, &info));
-       of_offset = info.dev->of_offset;
+       of_offset = dev_of_offset(info.dev);
        device_remove(info.dev);
        device_unbind(info.dev);
 
index 49a36cb1932e67794d5f55ec7359e2c54920885a..3048a7b890c9ebc6c25ed4ba7b083fc27727731c 100644 (file)
@@ -37,9 +37,9 @@ static int testfdt_ofdata_to_platdata(struct udevice *dev)
 {
        struct dm_test_pdata *pdata = dev_get_platdata(dev);
 
-       pdata->ping_add = fdtdec_get_int(gd->fdt_blob, dev->of_offset,
+       pdata->ping_add = fdtdec_get_int(gd->fdt_blob, dev_of_offset(dev),
                                        "ping-add", -1);
-       pdata->base = fdtdec_get_addr(gd->fdt_blob, dev->of_offset,
+       pdata->base = fdtdec_get_addr(gd->fdt_blob, dev_of_offset(dev),
                                      "ping-expect");
 
        return 0;
@@ -121,10 +121,10 @@ int dm_check_devices(struct unit_test_state *uts, int num_devices)
                 * want to test the code that sets that up
                 * (testfdt_drv_probe()).
                 */
-               base = fdtdec_get_addr(gd->fdt_blob, dev->of_offset,
+               base = fdtdec_get_addr(gd->fdt_blob, dev_of_offset(dev),
                                       "ping-expect");
                debug("dev=%d, base=%d: %s\n", i, base,
-                     fdt_get_name(gd->fdt_blob, dev->of_offset, NULL));
+                     fdt_get_name(gd->fdt_blob, dev_of_offset(dev), NULL));
 
                ut_assert(!dm_check_operations(uts, dev, base,
                                               dev_get_priv(dev)));