* [PATCH ath-next 0/2] wifi: ath5k: add MAC address OF support
@ 2026-01-12 3:19 Rosen Penev
2026-01-12 3:19 ` [PATCH ath-next 1/2] wifi: ath5k: ahb: use devm for ioremap Rosen Penev
2026-01-12 3:19 ` [PATCH ath-next 2/2] wifi: ath5k: set MAC address through OF Rosen Penev
0 siblings, 2 replies; 3+ messages in thread
From: Rosen Penev @ 2026-01-12 3:19 UTC (permalink / raw)
To: linux-wireless; +Cc: Jiri Slaby, Nick Kossifidis, Luis Chamberlain, open list
First commit is a small cleanup for ahb, which doesn't appear to be used
anywhere.
Second adds the ability to override MAC addresses through OF.
Rosen Penev (2):
wifi: ath5k: ahb: use devm for ioremap
wifi: ath5k: set MAC address through OF
drivers/net/wireless/ath/ath5k/ahb.c | 33 ++++++---------------------
drivers/net/wireless/ath/ath5k/base.c | 18 +++++++++++++++
2 files changed, 25 insertions(+), 26 deletions(-)
--
2.52.0
^ permalink raw reply [flat|nested] 3+ messages in thread
* [PATCH ath-next 1/2] wifi: ath5k: ahb: use devm for ioremap
2026-01-12 3:19 [PATCH ath-next 0/2] wifi: ath5k: add MAC address OF support Rosen Penev
@ 2026-01-12 3:19 ` Rosen Penev
2026-01-12 3:19 ` [PATCH ath-next 2/2] wifi: ath5k: set MAC address through OF Rosen Penev
1 sibling, 0 replies; 3+ messages in thread
From: Rosen Penev @ 2026-01-12 3:19 UTC (permalink / raw)
To: linux-wireless; +Cc: Jiri Slaby, Nick Kossifidis, Luis Chamberlain, open list
Simplifies the code by quite a bit in probe.
Also allows removing a goto and returning directly.
Signed-off-by: Rosen Penev <rosenp@gmail.com>
---
drivers/net/wireless/ath/ath5k/ahb.c | 33 ++++++----------------------
1 file changed, 7 insertions(+), 26 deletions(-)
diff --git a/drivers/net/wireless/ath/ath5k/ahb.c b/drivers/net/wireless/ath/ath5k/ahb.c
index cb3e891ee1bd..f34313568d9c 100644
--- a/drivers/net/wireless/ath/ath5k/ahb.c
+++ b/drivers/net/wireless/ath/ath5k/ahb.c
@@ -87,7 +87,6 @@ static int ath_ahb_probe(struct platform_device *pdev)
struct ar231x_board_config *bcfg = dev_get_platdata(&pdev->dev);
struct ath5k_hw *ah;
struct ieee80211_hw *hw;
- struct resource *res;
void __iomem *mem;
int irq;
int ret = 0;
@@ -95,35 +94,21 @@ static int ath_ahb_probe(struct platform_device *pdev)
if (!dev_get_platdata(&pdev->dev)) {
dev_err(&pdev->dev, "no platform data specified\n");
- ret = -EINVAL;
- goto err_out;
+ return -EINVAL;
}
- res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
- if (res == NULL) {
- dev_err(&pdev->dev, "no memory resource found\n");
- ret = -ENXIO;
- goto err_out;
- }
-
- mem = ioremap(res->start, resource_size(res));
- if (mem == NULL) {
- dev_err(&pdev->dev, "ioremap failed\n");
- ret = -ENOMEM;
- goto err_out;
- }
+ mem = devm_platform_ioremap_resources(pdev, 0);
+ if (IS_ERR(mem))
+ return dev_err_probe(&pdev->dev, PTR_ERR(mem), "ioremap failed\n");
irq = platform_get_irq(pdev, 0);
- if (irq < 0) {
- ret = irq;
- goto err_iounmap;
- }
+ if (irq < 0)
+ return irq;
hw = ieee80211_alloc_hw(sizeof(struct ath5k_hw), &ath5k_hw_ops);
if (hw == NULL) {
dev_err(&pdev->dev, "no memory for ieee80211_hw\n");
- ret = -ENOMEM;
- goto err_iounmap;
+ return -ENOMEM;
}
ah = hw->priv;
@@ -179,9 +164,6 @@ static int ath_ahb_probe(struct platform_device *pdev)
err_free_hw:
ieee80211_free_hw(hw);
- err_iounmap:
- iounmap(mem);
- err_out:
return ret;
}
@@ -213,7 +195,6 @@ static void ath_ahb_remove(struct platform_device *pdev)
}
ath5k_deinit_ah(ah);
- iounmap(ah->iobase);
ieee80211_free_hw(hw);
}
--
2.52.0
^ permalink raw reply related [flat|nested] 3+ messages in thread
* [PATCH ath-next 2/2] wifi: ath5k: set MAC address through OF
2026-01-12 3:19 [PATCH ath-next 0/2] wifi: ath5k: add MAC address OF support Rosen Penev
2026-01-12 3:19 ` [PATCH ath-next 1/2] wifi: ath5k: ahb: use devm for ioremap Rosen Penev
@ 2026-01-12 3:19 ` Rosen Penev
1 sibling, 0 replies; 3+ messages in thread
From: Rosen Penev @ 2026-01-12 3:19 UTC (permalink / raw)
To: linux-wireless; +Cc: Jiri Slaby, Nick Kossifidis, Luis Chamberlain, open list
If defined in OF, set the MAC address. Allows avoiding having to do that
in userspace.
Signed-off-by: Rosen Penev <rosenp@gmail.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.52.0
^ permalink raw reply related [flat|nested] 3+ messages in thread
end of thread, other threads:[~2026-01-12 3:19 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-01-12 3:19 [PATCH ath-next 0/2] wifi: ath5k: add MAC address OF support Rosen Penev
2026-01-12 3:19 ` [PATCH ath-next 1/2] wifi: ath5k: ahb: use devm for ioremap Rosen Penev
2026-01-12 3:19 ` [PATCH ath-next 2/2] wifi: ath5k: set MAC address through OF Rosen Penev
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox