@@ -161,9 +161,25 @@ void
mt76_eeprom_override(struct mt76_phy *phy)
{
struct mt76_dev *dev = phy->dev;
- struct device_node *np = dev->dev->of_node;
+ struct device_node *np = dev->dev->of_node, *band_np;
+ bool found_mac = false;
+ u32 reg;
+ int ret;
+
+ for_each_child_of_node(np, band_np) {
+ ret = of_property_read_u32(band_np, "reg", ®);
+ if (ret)
+ continue;
+
+ if (reg == phy->band_idx) {
+ found_mac = !of_get_mac_address(band_np, phy->macaddr);
+ of_node_put(band_np);
+ break;
+ }
+ }
- of_get_mac_address(np, phy->macaddr);
+ if (!found_mac)
+ of_get_mac_address(np, phy->macaddr);
if (!is_valid_ether_addr(phy->macaddr)) {
eth_random_addr(phy->macaddr);