Skip to contentSkip to conversation

wireless: ath5k: set MAC address through OF

PATCH New Rosen Penev 1 participant 1 message Aug 21, 2025 Atheros ATH5K wireless driver

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 wireless: ath5k: set MAC address through OF

If defined in OF, set the MAC address. Allows avoiding having to do that in userspace.

---
 drivers/net/wireless/ath/ath5k/base.c | 18 ++++++++++++++++++
 1 file changed, 18 insertions(+)
drivers/net/wireless/ath/ath5k/base.c +18 -0
index 4d88b02ffa79..22ca7e624b32 100644
@@ -59,6 +59,7 @@
 #include <net/cfg80211.h>
 #include <net/ieee80211_radiotap.h>
 
+#include <linux/of_net.h>
 #include <linux/unaligned.h>
 
 #include <net/mac80211.h>
@@ -2570,6 +2571,19 @@ static const struct ieee80211_iface_combination if_comb = {
 	.num_different_channels = 1,
 };
 
+static int ath5k_of_init(struct ath5k_hw *ah)
+{
+	struct ath_common *common = ath5k_hw_common(ah);
+	struct device_node *np = ah->dev->of_node;
+	int ret;
+
+	ret = of_get_mac_address(np, common->macaddr);
+	if (ret == -EPROBE_DEFER)
+		return ret;
+
+	return 0;
+}
+
 int
 ath5k_init_ah(struct ath5k_hw *ah, const struct ath_bus_ops *bus_ops)
 {
@@ -2638,6 +2652,10 @@ ath5k_init_ah(struct ath5k_hw *ah, const struct ath_bus_ops *bus_ops)
 	common->priv = ah;
 	common->clockrate = 40;
 
+	ret = ath5k_of_init(ah);
+	if (ret)
+		return ret;
+
 	/*
 	 * Cache line size is used to size and align various
 	 * structures used to communicate with the hardware.
Signature · 1 line
2.50.1