forked from Openwrt-EcoNet/openwrt
It's the proper function to handle this stuff in. The original patch abused the fact that the ath9k driver in init called ath9k_init_platform to populate all the needed configuration. This is the wrong place to do so and it also goes away in 6.13. Move 553-ath9k_of_gpio_mask.patch contents to ath9k_of_init where they belong. Signed-off-by: Rosen Penev <rosenp@gmail.com> Link: https://github.com/openwrt/openwrt/pull/18764 Signed-off-by: Robert Marko <robimarko@gmail.com>
69 lines
2.1 KiB
Diff
69 lines
2.1 KiB
Diff
--- a/drivers/net/wireless/ath/ath9k/ahb.c
|
|
+++ b/drivers/net/wireless/ath/ath9k/ahb.c
|
|
@@ -20,6 +20,7 @@
|
|
#include <linux/platform_device.h>
|
|
#include <linux/module.h>
|
|
#include <linux/mod_devicetable.h>
|
|
+#include <linux/of_device.h>
|
|
#include "ath9k.h"
|
|
|
|
static const struct platform_device_id ath9k_platform_id_table[] = {
|
|
@@ -69,21 +70,28 @@ static const struct ath_bus_ops ath_ahb_
|
|
.eeprom_read = ath_ahb_eeprom_read,
|
|
};
|
|
|
|
+const struct of_device_id of_ath_ahb_match[] = {
|
|
+ { .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 },
|
|
+ {},
|
|
+};
|
|
+MODULE_DEVICE_TABLE(of, of_ath_ahb_match);
|
|
+
|
|
static int ath_ahb_probe(struct platform_device *pdev)
|
|
{
|
|
- void __iomem *mem;
|
|
- struct ath_softc *sc;
|
|
+ const struct of_device_id *match;
|
|
struct ieee80211_hw *hw;
|
|
- const struct platform_device_id *id = platform_get_device_id(pdev);
|
|
- int irq;
|
|
- int ret = 0;
|
|
+ struct ath_softc *sc;
|
|
+ void __iomem *mem;
|
|
struct ath_hw *ah;
|
|
char hw_name[64];
|
|
-
|
|
- if (!dev_get_platdata(&pdev->dev)) {
|
|
- dev_err(&pdev->dev, "no platform data specified\n");
|
|
- return -EINVAL;
|
|
- }
|
|
+ u16 dev_id;
|
|
+ int irq;
|
|
+ int ret;
|
|
|
|
mem = devm_platform_ioremap_resource(pdev, 0);
|
|
if (IS_ERR(mem)) {
|
|
@@ -117,7 +125,9 @@ static int ath_ahb_probe(struct platform
|
|
goto err_free_hw;
|
|
}
|
|
|
|
- ret = ath9k_init_device(id->driver_data, sc, &ath_ahb_bus_ops);
|
|
+ match = of_match_device(of_ath_ahb_match, &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;
|
|
@@ -155,6 +165,7 @@ static struct platform_driver ath_ahb_dr
|
|
.remove_new = ath_ahb_remove,
|
|
.driver = {
|
|
.name = "ath9k",
|
|
+ .of_match_table = of_ath_ahb_match,
|
|
},
|
|
.id_table = ath9k_platform_id_table,
|
|
};
|