diff options
Diffstat (limited to 'arch/microblaze/kernel/prom_parse.c')
-rw-r--r-- | arch/microblaze/kernel/prom_parse.c | 38 |
1 files changed, 0 insertions, 38 deletions
diff --git a/arch/microblaze/kernel/prom_parse.c b/arch/microblaze/kernel/prom_parse.c index 99d9b61cccb5..9ae24f4b882b 100644 --- a/arch/microblaze/kernel/prom_parse.c +++ b/arch/microblaze/kernel/prom_parse.c | |||
@@ -110,41 +110,3 @@ void of_parse_dma_window(struct device_node *dn, const void *dma_window_prop, | |||
110 | cells = prop ? *(u32 *)prop : of_n_size_cells(dn); | 110 | cells = prop ? *(u32 *)prop : of_n_size_cells(dn); |
111 | *size = of_read_number(dma_window, cells); | 111 | *size = of_read_number(dma_window, cells); |
112 | } | 112 | } |
113 | |||
114 | /** | ||
115 | * Search the device tree for the best MAC address to use. 'mac-address' is | ||
116 | * checked first, because that is supposed to contain to "most recent" MAC | ||
117 | * address. If that isn't set, then 'local-mac-address' is checked next, | ||
118 | * because that is the default address. If that isn't set, then the obsolete | ||
119 | * 'address' is checked, just in case we're using an old device tree. | ||
120 | * | ||
121 | * Note that the 'address' property is supposed to contain a virtual address of | ||
122 | * the register set, but some DTS files have redefined that property to be the | ||
123 | * MAC address. | ||
124 | * | ||
125 | * All-zero MAC addresses are rejected, because those could be properties that | ||
126 | * exist in the device tree, but were not set by U-Boot. For example, the | ||
127 | * DTS could define 'mac-address' and 'local-mac-address', with zero MAC | ||
128 | * addresses. Some older U-Boots only initialized 'local-mac-address'. In | ||
129 | * this case, the real MAC is in 'local-mac-address', and 'mac-address' exists | ||
130 | * but is all zeros. | ||
131 | */ | ||
132 | const void *of_get_mac_address(struct device_node *np) | ||
133 | { | ||
134 | struct property *pp; | ||
135 | |||
136 | pp = of_find_property(np, "mac-address", NULL); | ||
137 | if (pp && (pp->length == 6) && is_valid_ether_addr(pp->value)) | ||
138 | return pp->value; | ||
139 | |||
140 | pp = of_find_property(np, "local-mac-address", NULL); | ||
141 | if (pp && (pp->length == 6) && is_valid_ether_addr(pp->value)) | ||
142 | return pp->value; | ||
143 | |||
144 | pp = of_find_property(np, "address", NULL); | ||
145 | if (pp && (pp->length == 6) && is_valid_ether_addr(pp->value)) | ||
146 | return pp->value; | ||
147 | |||
148 | return NULL; | ||
149 | } | ||
150 | EXPORT_SYMBOL(of_get_mac_address); | ||