[<prev] [next>] [day] [month] [year] [list]
Message-ID: <20250821031809.631727-1-rosenp@gmail.com>
Date: Wed, 20 Aug 2025 20:18:09 -0700
From: Rosen Penev <rosenp@...il.com>
To: linux-wireless@...r.kernel.org
Cc: Jiri Slaby <jirislaby@...nel.org>,
Nick Kossifidis <mickflemm@...il.com>,
Luis Chamberlain <mcgrof@...nel.org>,
linux-kernel@...r.kernel.org (open list)
Subject: [PATCH ath-next] wireless: ath5k: set MAC address through OF
If defined in OF, set the MAC address. Allows avoiding having to do that
in userspace.
Signed-off-by: Rosen Penev <rosenp@...il.com>
---
drivers/net/wireless/ath/ath5k/base.c | 18 ++++++++++++++++++
1 file changed, 18 insertions(+)
diff --git a/drivers/net/wireless/ath/ath5k/base.c b/drivers/net/wireless/ath/ath5k/base.c
index 4d88b02ffa79..22ca7e624b32 100644
--- a/drivers/net/wireless/ath/ath5k/base.c
+++ b/drivers/net/wireless/ath/ath5k/base.c
@@ -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.
--
2.50.1
Powered by blists - more mailing lists