* [PATCH 0/4] wifi: ath9k: add ahb OF support
@ 2025-05-21 2:15 Rosen Penev
2025-05-21 2:15 ` [PATCH 1/4] wifi: ath9k: ahb: reorder declarations Rosen Penev
` (3 more replies)
0 siblings, 4 replies; 9+ messages in thread
From: Rosen Penev @ 2025-05-21 2:15 UTC (permalink / raw)
To: linux-wireless
Cc: Rob Herring, Krzysztof Kozlowski, Conor Dooley,
Thomas Bogendoerfer, Toke Høiland-Jørgensen,
open list:OPEN FIRMWARE AND FLATTENED DEVICE TREE BINDINGS,
open list:MIPS, open list
First two commits are small cleanups to make the changes of the third
simpler. The fourth actually adds dts definitions to use ahb.
Rosen Penev (4):
wifi: ath9k: ahb: reorder declarations
wifi: ath9k: ahb: reorder includes
wifi: ath9k: ahb: replace id_table with of
mips: dts: qca: add wmac support
arch/mips/boot/dts/qca/ar9132.dtsi | 9 +++
.../boot/dts/qca/ar9132_tl_wr1043nd_v1.dts | 4 ++
arch/mips/boot/dts/qca/ar9331.dtsi | 9 +++
arch/mips/boot/dts/qca/ar9331_dpt_module.dts | 4 ++
.../mips/boot/dts/qca/ar9331_dragino_ms14.dts | 4 ++
arch/mips/boot/dts/qca/ar9331_omega.dts | 4 ++
.../qca/ar9331_openembed_som9331_board.dts | 4 ++
arch/mips/boot/dts/qca/ar9331_tl_mr3020.dts | 4 ++
drivers/net/wireless/ath/ath9k/ahb.c | 61 +++++++------------
9 files changed, 63 insertions(+), 40 deletions(-)
--
2.49.0
^ permalink raw reply [flat|nested] 9+ messages in thread
* [PATCH 1/4] wifi: ath9k: ahb: reorder declarations
2025-05-21 2:15 [PATCH 0/4] wifi: ath9k: add ahb OF support Rosen Penev
@ 2025-05-21 2:15 ` Rosen Penev
2025-05-21 2:15 ` [PATCH 2/4] wifi: ath9k: ahb: reorder includes Rosen Penev
` (2 subsequent siblings)
3 siblings, 0 replies; 9+ messages in thread
From: Rosen Penev @ 2025-05-21 2:15 UTC (permalink / raw)
To: linux-wireless
Cc: Rob Herring, Krzysztof Kozlowski, Conor Dooley,
Thomas Bogendoerfer, Toke Høiland-Jørgensen,
open list:OPEN FIRMWARE AND FLATTENED DEVICE TREE BINDINGS,
open list:MIPS, open list
Easier to look at. Follows netdev style.
Also remove ret assignment. Because of all of these devm conversions,
ret = 0 is a path that never gets hit. The first time it does it when
request_irq fails, but that ends up reassigning it.
Signed-off-by: Rosen Penev <rosenp@gmail.com>
---
drivers/net/wireless/ath/ath9k/ahb.c | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)
diff --git a/drivers/net/wireless/ath/ath9k/ahb.c b/drivers/net/wireless/ath/ath9k/ahb.c
index 49b7ab26c477..d2a97e74f451 100644
--- a/drivers/net/wireless/ath/ath9k/ahb.c
+++ b/drivers/net/wireless/ath/ath9k/ahb.c
@@ -71,14 +71,14 @@ static const struct ath_bus_ops ath_ahb_bus_ops = {
static int ath_ahb_probe(struct platform_device *pdev)
{
- void __iomem *mem;
- struct ath_softc *sc;
- struct ieee80211_hw *hw;
const struct platform_device_id *id = platform_get_device_id(pdev);
- int irq;
- int ret = 0;
+ struct ieee80211_hw *hw;
+ struct ath_softc *sc;
struct ath_hw *ah;
+ void __iomem *mem;
char hw_name[64];
+ int irq;
+ int ret;
if (!dev_get_platdata(&pdev->dev)) {
dev_err(&pdev->dev, "no platform data specified\n");
--
2.49.0
^ permalink raw reply related [flat|nested] 9+ messages in thread
* [PATCH 2/4] wifi: ath9k: ahb: reorder includes
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 ` Rosen Penev
2025-05-21 2:15 ` [PATCH 3/4] wifi: ath9k: ahb: replace id_table with of Rosen Penev
2025-05-21 2:15 ` [PATCH 4/4] mips: dts: qca: add wmac support Rosen Penev
3 siblings, 0 replies; 9+ messages in thread
From: Rosen Penev @ 2025-05-21 2:15 UTC (permalink / raw)
To: linux-wireless
Cc: Rob Herring, Krzysztof Kozlowski, Conor Dooley,
Thomas Bogendoerfer, Toke Høiland-Jørgensen,
open list:OPEN FIRMWARE AND FLATTENED DEVICE TREE BINDINGS,
open list:MIPS, open list
Alphabetic includes are easier to look at and to make further changes to
them.
Signed-off-by: Rosen Penev <rosenp@gmail.com>
---
drivers/net/wireless/ath/ath9k/ahb.c | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/drivers/net/wireless/ath/ath9k/ahb.c b/drivers/net/wireless/ath/ath9k/ahb.c
index d2a97e74f451..1ffec827ed87 100644
--- a/drivers/net/wireless/ath/ath9k/ahb.c
+++ b/drivers/net/wireless/ath/ath9k/ahb.c
@@ -16,10 +16,11 @@
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
+#include <linux/mod_devicetable.h>
+#include <linux/module.h>
#include <linux/nl80211.h>
#include <linux/platform_device.h>
-#include <linux/module.h>
-#include <linux/mod_devicetable.h>
+
#include "ath9k.h"
static const struct platform_device_id ath9k_platform_id_table[] = {
--
2.49.0
^ permalink raw reply related [flat|nested] 9+ messages in thread
* [PATCH 3/4] wifi: ath9k: ahb: replace id_table with of
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
2025-05-21 11:07 ` Krzysztof Kozlowski
2025-05-21 2:15 ` [PATCH 4/4] mips: dts: qca: add wmac support Rosen Penev
3 siblings, 1 reply; 9+ messages in thread
From: Rosen Penev @ 2025-05-21 2:15 UTC (permalink / raw)
To: linux-wireless
Cc: Rob Herring, Krzysztof Kozlowski, Conor Dooley,
Thomas Bogendoerfer, Toke Høiland-Jørgensen,
open list:OPEN FIRMWARE AND FLATTENED DEVICE TREE BINDINGS,
open list:MIPS, open list
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
^ permalink raw reply related [flat|nested] 9+ messages in thread
* [PATCH 4/4] mips: dts: qca: add wmac support
2025-05-21 2:15 [PATCH 0/4] wifi: ath9k: add ahb OF support Rosen Penev
` (2 preceding siblings ...)
2025-05-21 2:15 ` [PATCH 3/4] wifi: ath9k: ahb: replace id_table with of Rosen Penev
@ 2025-05-21 2:15 ` Rosen Penev
2025-05-21 11:09 ` Krzysztof Kozlowski
3 siblings, 1 reply; 9+ messages in thread
From: Rosen Penev @ 2025-05-21 2:15 UTC (permalink / raw)
To: linux-wireless
Cc: Rob Herring, Krzysztof Kozlowski, Conor Dooley,
Thomas Bogendoerfer, Toke Høiland-Jørgensen,
open list:OPEN FIRMWARE AND FLATTENED DEVICE TREE BINDINGS,
open list:MIPS, open list
Now that OF ahb support was added to the ath9k driver, we can use it to
enable and use the SoC wireless found in these chipsets.
Signed-off-by: Rosen Penev <rosenp@gmail.com>
---
arch/mips/boot/dts/qca/ar9132.dtsi | 9 +++++++++
arch/mips/boot/dts/qca/ar9132_tl_wr1043nd_v1.dts | 4 ++++
arch/mips/boot/dts/qca/ar9331.dtsi | 9 +++++++++
arch/mips/boot/dts/qca/ar9331_dpt_module.dts | 4 ++++
arch/mips/boot/dts/qca/ar9331_dragino_ms14.dts | 4 ++++
arch/mips/boot/dts/qca/ar9331_omega.dts | 4 ++++
.../mips/boot/dts/qca/ar9331_openembed_som9331_board.dts | 4 ++++
arch/mips/boot/dts/qca/ar9331_tl_mr3020.dts | 4 ++++
8 files changed, 42 insertions(+)
diff --git a/arch/mips/boot/dts/qca/ar9132.dtsi b/arch/mips/boot/dts/qca/ar9132.dtsi
index 61dcfa5b6ca7..dc94459aa3e9 100644
--- a/arch/mips/boot/dts/qca/ar9132.dtsi
+++ b/arch/mips/boot/dts/qca/ar9132.dtsi
@@ -156,6 +156,15 @@ spi: spi@1f000000 {
#address-cells = <1>;
#size-cells = <0>;
};
+
+ wmac: wmac@180c0000 {
+ compatible = "qca,ar9130-wmac";
+ reg = <0x180c0000 0x230000>;
+
+ interrupts = <2>;
+
+ status = "disabled";
+ };
};
usb_phy: usb-phy {
diff --git a/arch/mips/boot/dts/qca/ar9132_tl_wr1043nd_v1.dts b/arch/mips/boot/dts/qca/ar9132_tl_wr1043nd_v1.dts
index f894fe17816b..7df518fdc515 100644
--- a/arch/mips/boot/dts/qca/ar9132_tl_wr1043nd_v1.dts
+++ b/arch/mips/boot/dts/qca/ar9132_tl_wr1043nd_v1.dts
@@ -108,3 +108,7 @@ partition@2 {
};
};
};
+
+&wmac {
+ status = "okay";
+};
diff --git a/arch/mips/boot/dts/qca/ar9331.dtsi b/arch/mips/boot/dts/qca/ar9331.dtsi
index 768ac0f869b1..4cd55f765e1f 100644
--- a/arch/mips/boot/dts/qca/ar9331.dtsi
+++ b/arch/mips/boot/dts/qca/ar9331.dtsi
@@ -285,6 +285,15 @@ spi: spi@1f000000 {
status = "disabled";
};
+
+ wmac: wmac@18100000 {
+ compatible = "qca,ar9330-wmac";
+ reg = <0x18100000 0x20000>;
+
+ interrupts = <2>;
+
+ status = "disabled";
+ };
};
usb_phy: usb-phy {
diff --git a/arch/mips/boot/dts/qca/ar9331_dpt_module.dts b/arch/mips/boot/dts/qca/ar9331_dpt_module.dts
index c857cd22f7db..d855dfe118e6 100644
--- a/arch/mips/boot/dts/qca/ar9331_dpt_module.dts
+++ b/arch/mips/boot/dts/qca/ar9331_dpt_module.dts
@@ -97,3 +97,7 @@ &phy_port0 {
&phy_port4 {
status = "okay";
};
+
+&wmac {
+ status = "okay";
+};
diff --git a/arch/mips/boot/dts/qca/ar9331_dragino_ms14.dts b/arch/mips/boot/dts/qca/ar9331_dragino_ms14.dts
index 7affa58d4fa6..679e793e9f55 100644
--- a/arch/mips/boot/dts/qca/ar9331_dragino_ms14.dts
+++ b/arch/mips/boot/dts/qca/ar9331_dragino_ms14.dts
@@ -98,3 +98,7 @@ spiflash: w25q128@0 {
reg = <0>;
};
};
+
+&wmac {
+ status = "okay";
+};
diff --git a/arch/mips/boot/dts/qca/ar9331_omega.dts b/arch/mips/boot/dts/qca/ar9331_omega.dts
index 8904aa917a6e..093142bf3ed6 100644
--- a/arch/mips/boot/dts/qca/ar9331_omega.dts
+++ b/arch/mips/boot/dts/qca/ar9331_omega.dts
@@ -74,3 +74,7 @@ spiflash: w25q128@0 {
reg = <0>;
};
};
+
+&wmac {
+ status = "okay";
+};
diff --git a/arch/mips/boot/dts/qca/ar9331_openembed_som9331_board.dts b/arch/mips/boot/dts/qca/ar9331_openembed_som9331_board.dts
index dc65ebd60bbc..22e05d9c283a 100644
--- a/arch/mips/boot/dts/qca/ar9331_openembed_som9331_board.dts
+++ b/arch/mips/boot/dts/qca/ar9331_openembed_som9331_board.dts
@@ -106,3 +106,7 @@ &phy_port2 {
&phy_port4 {
status = "okay";
};
+
+&wmac {
+ status = "okay";
+};
diff --git a/arch/mips/boot/dts/qca/ar9331_tl_mr3020.dts b/arch/mips/boot/dts/qca/ar9331_tl_mr3020.dts
index 10b9759228b7..b740f1a91162 100644
--- a/arch/mips/boot/dts/qca/ar9331_tl_mr3020.dts
+++ b/arch/mips/boot/dts/qca/ar9331_tl_mr3020.dts
@@ -114,3 +114,7 @@ spiflash: s25sl032p@0 {
reg = <0>;
};
};
+
+&wmac {
+ status = "okay";
+};
--
2.49.0
^ permalink raw reply related [flat|nested] 9+ messages in thread
* Re: [PATCH 3/4] wifi: ath9k: ahb: replace id_table with of
2025-05-21 2:15 ` [PATCH 3/4] wifi: ath9k: ahb: replace id_table with of Rosen Penev
@ 2025-05-21 11:07 ` Krzysztof Kozlowski
2025-05-21 20:43 ` Rosen Penev
0 siblings, 1 reply; 9+ messages in thread
From: Krzysztof Kozlowski @ 2025-05-21 11:07 UTC (permalink / raw)
To: Rosen Penev, linux-wireless
Cc: Rob Herring, Krzysztof Kozlowski, Conor Dooley,
Thomas Bogendoerfer, Toke Høiland-Jørgensen,
open list:OPEN FIRMWARE AND FLATTENED DEVICE TREE BINDINGS,
open list:MIPS, open list
On 21/05/2025 04:15, Rosen Penev wrote:
> - .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 },
Undocumented ABI.
Please run scripts/checkpatch.pl on the patches and fix reported
warnings. After that, run also 'scripts/checkpatch.pl --strict' on the
patches and (probably) fix more warnings. Some warnings can be ignored,
especially from --strict run, but the code here looks like it needs a
fix. Feel free to get in touch if the warning is not clear.
> {},
> };
>
> @@ -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);
There is a wrapper for getting data, use it.
> + dev_id = (uintptr_t)match->data;
And dev_id is enum? Then you want kernel_ulong_t.
Best regards,
Krzysztof
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH 4/4] mips: dts: qca: add wmac support
2025-05-21 2:15 ` [PATCH 4/4] mips: dts: qca: add wmac support Rosen Penev
@ 2025-05-21 11:09 ` Krzysztof Kozlowski
0 siblings, 0 replies; 9+ messages in thread
From: Krzysztof Kozlowski @ 2025-05-21 11:09 UTC (permalink / raw)
To: Rosen Penev, linux-wireless
Cc: Rob Herring, Krzysztof Kozlowski, Conor Dooley,
Thomas Bogendoerfer, Toke Høiland-Jørgensen,
open list:OPEN FIRMWARE AND FLATTENED DEVICE TREE BINDINGS,
open list:MIPS, open list
On 21/05/2025 04:15, Rosen Penev wrote:
> Now that OF ahb support was added to the ath9k driver, we can use it to
> enable and use the SoC wireless found in these chipsets.
>
> Signed-off-by: Rosen Penev <rosenp@gmail.com>
> ---
> arch/mips/boot/dts/qca/ar9132.dtsi | 9 +++++++++
> arch/mips/boot/dts/qca/ar9132_tl_wr1043nd_v1.dts | 4 ++++
> arch/mips/boot/dts/qca/ar9331.dtsi | 9 +++++++++
> arch/mips/boot/dts/qca/ar9331_dpt_module.dts | 4 ++++
> arch/mips/boot/dts/qca/ar9331_dragino_ms14.dts | 4 ++++
> arch/mips/boot/dts/qca/ar9331_omega.dts | 4 ++++
> .../mips/boot/dts/qca/ar9331_openembed_som9331_board.dts | 4 ++++
> arch/mips/boot/dts/qca/ar9331_tl_mr3020.dts | 4 ++++
> 8 files changed, 42 insertions(+)
>
> diff --git a/arch/mips/boot/dts/qca/ar9132.dtsi b/arch/mips/boot/dts/qca/ar9132.dtsi
> index 61dcfa5b6ca7..dc94459aa3e9 100644
> --- a/arch/mips/boot/dts/qca/ar9132.dtsi
> +++ b/arch/mips/boot/dts/qca/ar9132.dtsi
> @@ -156,6 +156,15 @@ spi: spi@1f000000 {
> #address-cells = <1>;
> #size-cells = <0>;
> };
> +
> + wmac: wmac@180c0000 {
The name is enforced by bindings now (if you tested that). It's wifi.
It does not look like you tested the DTS against bindings. Please run
`make dtbs_check W=1` (see
Documentation/devicetree/bindings/writing-schema.rst or
https://www.linaro.org/blog/tips-and-tricks-for-validating-devicetree-sources-with-the-devicetree-schema/
for instructions).
Maybe you need to update your dtschema and yamllint. Don't rely on
distro packages for dtschema and be sure you are using the latest
released dtschema.
Please run scripts/checkpatch.pl on the patches and fix reported
warnings. After that, run also 'scripts/checkpatch.pl --strict' on the
patches and (probably) fix more warnings. Some warnings can be ignored,
especially from --strict run, but the code here looks like it needs a
fix. Feel free to get in touch if the warning is not clear.
Best regards,
Krzysztof
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH 3/4] wifi: ath9k: ahb: replace id_table with of
2025-05-21 11:07 ` Krzysztof Kozlowski
@ 2025-05-21 20:43 ` Rosen Penev
2025-05-22 6:09 ` Krzysztof Kozlowski
0 siblings, 1 reply; 9+ messages in thread
From: Rosen Penev @ 2025-05-21 20:43 UTC (permalink / raw)
To: Krzysztof Kozlowski
Cc: linux-wireless, Rob Herring, Krzysztof Kozlowski, Conor Dooley,
Thomas Bogendoerfer, Toke Høiland-Jørgensen,
open list:OPEN FIRMWARE AND FLATTENED DEVICE TREE BINDINGS,
open list:MIPS, open list
On Wed, May 21, 2025 at 4:08 AM Krzysztof Kozlowski <krzk@kernel.org> wrote:
>
> On 21/05/2025 04:15, Rosen Penev wrote:
> > - .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 },
>
> Undocumented ABI.
Hrm wonder where to document.
Documentation/devicetree/bindings/net/wireless/qca,ath9k.yaml
sounds like the place but that file looks like it's for pci(e) only.
This patch adds the bindings to ahb, not pci(e).
>
> Please run scripts/checkpatch.pl on the patches and fix reported
> warnings. After that, run also 'scripts/checkpatch.pl --strict' on the
> patches and (probably) fix more warnings. Some warnings can be ignored,
> especially from --strict run, but the code here looks like it needs a
> fix. Feel free to get in touch if the warning is not clear.
>
>
> > {},
> > };
> >
> > @@ -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);
>
> There is a wrapper for getting data, use it.
I assume you mean of_device_get_match_data. Will do.
>
> > + dev_id = (uintptr_t)match->data;
>
> And dev_id is enum? Then you want kernel_ulong_t.
The entries specified in data are macros in the form of 0xYYYY. This
is why I used u16. The ath9k_init_device takes an int here.
Interestingly enough in the newer ath drivers, it looks like these
macros are placed in an enum. ath9k uses a u16 field in the struct.
As for kernel_ulong_t, ath12k uses that, ath10k uintptr_t. I assume
the former is more appropriate.
>
>
>
>
> Best regards,
> Krzysztof
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH 3/4] wifi: ath9k: ahb: replace id_table with of
2025-05-21 20:43 ` Rosen Penev
@ 2025-05-22 6:09 ` Krzysztof Kozlowski
0 siblings, 0 replies; 9+ messages in thread
From: Krzysztof Kozlowski @ 2025-05-22 6:09 UTC (permalink / raw)
To: Rosen Penev
Cc: linux-wireless, Rob Herring, Krzysztof Kozlowski, Conor Dooley,
Thomas Bogendoerfer, Toke Høiland-Jørgensen,
open list:OPEN FIRMWARE AND FLATTENED DEVICE TREE BINDINGS,
open list:MIPS, open list
On 21/05/2025 22:43, Rosen Penev wrote:
>>> - 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);
>>
>> There is a wrapper for getting data, use it.
> I assume you mean of_device_get_match_data. Will do.
>>
>>> + dev_id = (uintptr_t)match->data;
>>
>> And dev_id is enum? Then you want kernel_ulong_t.
> The entries specified in data are macros in the form of 0xYYYY. This
> is why I used u16. The ath9k_init_device takes an int here.
You did not use u16, but uintptr_t. My comment was about the cast.
Best regards,
Krzysztof
^ permalink raw reply [flat|nested] 9+ messages in thread
end of thread, other threads:[~2025-05-22 6:09 UTC | newest]
Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
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 ` [PATCH 3/4] wifi: ath9k: ahb: replace id_table with of Rosen Penev
2025-05-21 11:07 ` 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
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).