From: Rosen Penev <rosenp@gmail.com>
To: linux-wireless@vger.kernel.org
Cc: "Rob Herring" <robh@kernel.org>,
"Krzysztof Kozlowski" <krzk+dt@kernel.org>,
"Conor Dooley" <conor+dt@kernel.org>,
"Thomas Bogendoerfer" <tsbogend@alpha.franken.de>,
"Toke Høiland-Jørgensen" <toke@toke.dk>,
devicetree@vger.kernel.org (open list:OPEN FIRMWARE AND
FLATTENED DEVICE TREE BINDINGS),
linux-mips@vger.kernel.org (open list:MIPS),
linux-kernel@vger.kernel.org (open list)
Subject: [PATCH 3/4] wifi: ath9k: ahb: replace id_table with of
Date: Tue, 20 May 2025 19:15:56 -0700 [thread overview]
Message-ID: <20250521021557.666611-4-rosenp@gmail.com> (raw)
In-Reply-To: <20250521021557.666611-1-rosenp@gmail.com>
Since 2b0996c7646 , all of this platform code became no-op with no OF
replacement. Not only that, there are no users of AHB here. Add an OF
match table that mostly mirrors the original platform device id table.
Use a qca prefix as is done for the only other property: qca,no-eeprom.
Also used qca prefix for ar9530 as the latter seems to be a mistake.
This will be used to add ath9k support for the various ath79 devices
here.
Signed-off-by: Rosen Penev <rosenp@gmail.com>
---
drivers/net/wireless/ath/ath9k/ahb.c | 49 +++++++++-------------------
1 file changed, 15 insertions(+), 34 deletions(-)
diff --git a/drivers/net/wireless/ath/ath9k/ahb.c b/drivers/net/wireless/ath/ath9k/ahb.c
index 1ffec827ed87..27eaad8c96a4 100644
--- a/drivers/net/wireless/ath/ath9k/ahb.c
+++ b/drivers/net/wireless/ath/ath9k/ahb.c
@@ -19,35 +19,18 @@
#include <linux/mod_devicetable.h>
#include <linux/module.h>
#include <linux/nl80211.h>
+#include <linux/of_device.h>
#include <linux/platform_device.h>
#include "ath9k.h"
-static const struct platform_device_id ath9k_platform_id_table[] = {
- {
- .name = "ath9k",
- .driver_data = AR5416_AR9100_DEVID,
- },
- {
- .name = "ar933x_wmac",
- .driver_data = AR9300_DEVID_AR9330,
- },
- {
- .name = "ar934x_wmac",
- .driver_data = AR9300_DEVID_AR9340,
- },
- {
- .name = "qca955x_wmac",
- .driver_data = AR9300_DEVID_QCA955X,
- },
- {
- .name = "qca953x_wmac",
- .driver_data = AR9300_DEVID_AR953X,
- },
- {
- .name = "qca956x_wmac",
- .driver_data = AR9300_DEVID_QCA956X,
- },
+static const struct of_device_id ath9k_of_match_table[] = {
+ { .compatible = "qca,ar9130-wmac", .data = (void *)AR5416_AR9100_DEVID },
+ { .compatible = "qca,ar9330-wmac", .data = (void *)AR9300_DEVID_AR9330 },
+ { .compatible = "qca,ar9340-wmac", .data = (void *)AR9300_DEVID_AR9340 },
+ { .compatible = "qca,qca9530-wmac", .data = (void *)AR9300_DEVID_AR953X },
+ { .compatible = "qca,qca9550-wmac", .data = (void *)AR9300_DEVID_QCA955X },
+ { .compatible = "qca,qca9560-wmac", .data = (void *)AR9300_DEVID_QCA956X },
{},
};
@@ -72,20 +55,16 @@ static const struct ath_bus_ops ath_ahb_bus_ops = {
static int ath_ahb_probe(struct platform_device *pdev)
{
- const struct platform_device_id *id = platform_get_device_id(pdev);
+ const struct of_device_id *match;
struct ieee80211_hw *hw;
struct ath_softc *sc;
struct ath_hw *ah;
void __iomem *mem;
char hw_name[64];
+ u16 dev_id;
int irq;
int ret;
- if (!dev_get_platdata(&pdev->dev)) {
- dev_err(&pdev->dev, "no platform data specified\n");
- return -EINVAL;
- }
-
mem = devm_platform_ioremap_resource(pdev, 0);
if (IS_ERR(mem)) {
dev_err(&pdev->dev, "ioremap failed\n");
@@ -118,7 +97,9 @@ static int ath_ahb_probe(struct platform_device *pdev)
goto err_free_hw;
}
- ret = ath9k_init_device(id->driver_data, sc, &ath_ahb_bus_ops);
+ match = of_match_device(ath9k_of_match_table, &pdev->dev);
+ dev_id = (uintptr_t)match->data;
+ ret = ath9k_init_device(dev_id, sc, &ath_ahb_bus_ops);
if (ret) {
dev_err(&pdev->dev, "failed to initialize device\n");
goto err_irq;
@@ -156,11 +137,11 @@ static struct platform_driver ath_ahb_driver = {
.remove = ath_ahb_remove,
.driver = {
.name = "ath9k",
+ .of_match_table = ath9k_of_match_table,
},
- .id_table = ath9k_platform_id_table,
};
-MODULE_DEVICE_TABLE(platform, ath9k_platform_id_table);
+MODULE_DEVICE_TABLE(of, ath9k_of_match_table);
int ath_ahb_init(void)
{
--
2.49.0
next prev parent reply other threads:[~2025-05-21 2:16 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-05-21 2:15 [PATCH 0/4] wifi: ath9k: add ahb OF support Rosen Penev
2025-05-21 2:15 ` [PATCH 1/4] wifi: ath9k: ahb: reorder declarations Rosen Penev
2025-05-21 2:15 ` [PATCH 2/4] wifi: ath9k: ahb: reorder includes Rosen Penev
2025-05-21 2:15 ` Rosen Penev [this message]
2025-05-21 11:07 ` [PATCH 3/4] wifi: ath9k: ahb: replace id_table with of Krzysztof Kozlowski
2025-05-21 20:43 ` Rosen Penev
2025-05-22 6:09 ` Krzysztof Kozlowski
2025-05-21 2:15 ` [PATCH 4/4] mips: dts: qca: add wmac support Rosen Penev
2025-05-21 11:09 ` Krzysztof Kozlowski
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20250521021557.666611-4-rosenp@gmail.com \
--to=rosenp@gmail.com \
--cc=conor+dt@kernel.org \
--cc=devicetree@vger.kernel.org \
--cc=krzk+dt@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mips@vger.kernel.org \
--cc=linux-wireless@vger.kernel.org \
--cc=robh@kernel.org \
--cc=toke@toke.dk \
--cc=tsbogend@alpha.franken.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox