dm: core: Replace of_offset with accessor
At present devices use a simple integer offset to record the device tree node associated with the device. In preparation for supporting a live device tree, which uses a node pointer instead, refactor existing code to access this field through an inline function. Signed-off-by: Simon Glass <sjg@chromium.org>
This commit is contained in:
parent
8aa41363eb
commit
e160f7d430
@ -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) {
|
||||
|
@ -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 */
|
||||
|
@ -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);
|
||||
|
@ -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 */
|
||||
|
@ -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;
|
||||
|
@ -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;
|
||||
|
@ -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,
|
||||
|
@ -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);
|
||||
|
@ -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)
|
||||
|
@ -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);
|
||||
|
@ -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);
|
||||
|
@ -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;
|
||||
|
@ -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);
|
||||
|
@ -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;
|
||||
|
@ -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;
|
||||
|
||||
|
@ -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;
|
||||
|
||||
|
@ -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 */
|
||||
|
@ -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;
|
||||
|
@ -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,
|
||||
|
@ -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
|
||||
|
@ -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);
|
||||
|
@ -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;
|
||||
|
||||
|
@ -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;
|
||||
|
@ -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;
|
||||
|
||||
|
@ -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);
|
||||
|
@ -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
|
||||
|
||||
|
@ -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;
|
||||
|
||||
|
@ -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)
|
||||
|
@ -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)
|
||||
|
@ -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);
|
||||
}
|
||||
|
||||
|
@ -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);
|
||||
|
@ -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;
|
||||
|
@ -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;
|
||||
|
@ -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);
|
||||
|
@ -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);
|
||||
|
@ -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;
|
||||
|
@ -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;
|
||||
|
@ -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++;
|
||||
}
|
||||
|
||||
|
@ -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) {
|
||||
|
@ -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;
|
||||
|
@ -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;
|
||||
|
@ -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;
|
||||
}
|
||||
|
@ -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;
|
||||
}
|
||||
|
@ -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";
|
||||
|
@ -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;
|
||||
|
@ -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;
|
||||
|
||||
|
@ -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;
|
||||
|
||||
|
@ -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;
|
||||
|
||||
|
@ -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";
|
||||
|
@ -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)
|
||||
|
@ -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;
|
||||
}
|
||||
|
@ -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;
|
||||
|
@ -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;
|
||||
|
@ -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));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -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;
|
||||
|
@ -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);
|
||||
|
@ -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);
|
||||
|
@ -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);
|
||||
|
||||
|
@ -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;
|
||||
|
||||
|
@ -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,
|
||||
|
@ -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
|
||||
|
@ -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);
|
||||
|
@ -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;
|
||||
|
@ -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;
|
||||
|
@ -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;
|
||||
}
|
||||
|
@ -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;
|
||||
|
||||
|
@ -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);
|
||||
|
||||
|
@ -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__);
|
||||
|
@ -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))
|
||||
|
@ -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;
|
||||
|
||||
|
@ -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);
|
||||
|
@ -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;
|
||||
|
@ -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);
|
||||
|
@ -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;
|
||||
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
@ -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__,
|
||||
|
@ -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);
|
||||
|
@ -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;
|
||||
|
@ -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);
|
||||
|
@ -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);
|
||||
|
@ -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;
|
||||
|
@ -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;
|
||||
|
@ -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;
|
||||
|
||||
|
@ -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");
|
||||
|
@ -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
|
||||
|
@ -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) {
|
||||
|
@ -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;
|
||||
|
||||
|
@ -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;
|
||||
|
||||
|
@ -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;
|
||||
|
@ -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;
|
||||
|
||||
|
@ -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)) {
|
||||
|
@ -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;
|
||||
|
@ -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;
|
||||
|
@ -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;
|
||||
|
@ -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;
|
||||
|
@ -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) {
|
||||
|
@ -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;
|
||||
|
@ -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) {
|
||||
|
@ -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;
|
||||
|
@ -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;
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user