Commit ad160681 authored by Kumar Gala's avatar Kumar Gala

[POWERPC] bootwrapper: Add find_node_by_alias and dt_fixup_mac_address_by_alias

Add the ability to set the mac address given the alias for the device.
Removes the need for having a linux,network-index property.
Signed-off-by: default avatarKumar Gala <galak@kernel.crashing.org>
parent 6392f184
...@@ -88,6 +88,20 @@ void dt_fixup_clock(const char *path, u32 freq) ...@@ -88,6 +88,20 @@ void dt_fixup_clock(const char *path, u32 freq)
} }
} }
void dt_fixup_mac_address_by_alias(const char *alias, const u8 *addr)
{
void *devp = find_node_by_alias(alias);
if (devp) {
printf("%s: local-mac-address <-"
" %02x:%02x:%02x:%02x:%02x:%02x\n\r", alias,
addr[0], addr[1], addr[2],
addr[3], addr[4], addr[5]);
setprop(devp, "local-mac-address", addr, 6);
}
}
void dt_fixup_mac_address(u32 index, const u8 *addr) void dt_fixup_mac_address(u32 index, const u8 *addr)
{ {
void *devp = find_node_by_prop_value(NULL, "linux,network-index", void *devp = find_node_by_prop_value(NULL, "linux,network-index",
......
...@@ -159,9 +159,23 @@ static inline void *find_node_by_devtype(const void *prev, ...@@ -159,9 +159,23 @@ static inline void *find_node_by_devtype(const void *prev,
return find_node_by_prop_value_str(prev, "device_type", type); return find_node_by_prop_value_str(prev, "device_type", type);
} }
static inline void *find_node_by_alias(const char *alias)
{
void *devp = finddevice("/aliases");
if (devp) {
char path[MAX_PATH_LEN];
if (getprop(devp, alias, path, MAX_PATH_LEN) > 0)
return finddevice(path);
}
return NULL;
}
void dt_fixup_memory(u64 start, u64 size); void dt_fixup_memory(u64 start, u64 size);
void dt_fixup_cpu_clocks(u32 cpufreq, u32 tbfreq, u32 busfreq); void dt_fixup_cpu_clocks(u32 cpufreq, u32 tbfreq, u32 busfreq);
void dt_fixup_clock(const char *path, u32 freq); void dt_fixup_clock(const char *path, u32 freq);
void dt_fixup_mac_address_by_alias(const char *alias, const u8 *addr);
void dt_fixup_mac_address(u32 index, const u8 *addr); void dt_fixup_mac_address(u32 index, const u8 *addr);
void __dt_fixup_mac_addresses(u32 startindex, ...); void __dt_fixup_mac_addresses(u32 startindex, ...);
#define dt_fixup_mac_addresses(...) \ #define dt_fixup_mac_addresses(...) \
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment