* [PATCH 1/3] dt-bindings: net: wireless: qcom,ath11k: allow describing radios
@ 2023-04-14 21:23 Rafał Miłecki
2023-04-14 21:23 ` [PATCH 2/3] wifi: ath11k: look for DT node for each radio Rafał Miłecki
` (2 more replies)
0 siblings, 3 replies; 4+ messages in thread
From: Rafał Miłecki @ 2023-04-14 21:23 UTC (permalink / raw)
To: Kalle Valo, Rob Herring, Krzysztof Kozlowski
Cc: David S . Miller, Eric Dumazet, Jakub Kicinski, Paolo Abeni,
ath11k, linux-wireless, netdev, devicetree, linux-kernel,
Robert Marko, Rafał Miłecki
From: Rafał Miłecki <rafal@milecki.pl>
Qualcomm ath11k chipsets can have up to 3 radios. Each radio may need to
be additionally described by including its MAC or available frequency
ranges.
Signed-off-by: Rafał Miłecki <rafal@milecki.pl>
---
.../bindings/net/wireless/qcom,ath11k.yaml | 26 +++++++++++++++++++
1 file changed, 26 insertions(+)
diff --git a/Documentation/devicetree/bindings/net/wireless/qcom,ath11k.yaml b/Documentation/devicetree/bindings/net/wireless/qcom,ath11k.yaml
index 7d5f982a3d09..ed660d563e09 100644
--- a/Documentation/devicetree/bindings/net/wireless/qcom,ath11k.yaml
+++ b/Documentation/devicetree/bindings/net/wireless/qcom,ath11k.yaml
@@ -78,6 +78,24 @@ properties:
items:
- const: wlan-smp2p-out
+patternProperties:
+ "^radio@[0-2]$":
+ type: object
+
+ allOf:
+ - $ref: ieee80211.yaml#
+
+ properties:
+ nvmem-cells:
+ items:
+ - description: NVMEM cell with the MAC address
+
+ nvmem-cell-names:
+ items:
+ - const: mac-address
+
+ unevaluatedProperties: false
+
required:
- compatible
- reg
@@ -378,6 +396,14 @@ examples:
"wbm2host-tx-completions-ring1",
"tcl2host-status-ring";
qcom,rproc = <&q6v5_wcss>;
+ #address-cells = <1>;
+ #size-cells = <0>;
+
+ radio@0 {
+ reg = <0x0>;
+ nvmem-cells = <&mac>;
+ nvmem-cell-names = "mac-address";
+ };
};
- |
--
2.34.1
^ permalink raw reply related [flat|nested] 4+ messages in thread
* [PATCH 2/3] wifi: ath11k: look for DT node for each radio
2023-04-14 21:23 [PATCH 1/3] dt-bindings: net: wireless: qcom,ath11k: allow describing radios Rafał Miłecki
@ 2023-04-14 21:23 ` Rafał Miłecki
2023-04-14 21:23 ` [PATCH 3/3] wifi: ath11k: support reading radio MAC from DT Rafał Miłecki
2023-04-17 13:10 ` [PATCH 1/3] dt-bindings: net: wireless: qcom,ath11k: allow describing radios Rob Herring
2 siblings, 0 replies; 4+ messages in thread
From: Rafał Miłecki @ 2023-04-14 21:23 UTC (permalink / raw)
To: Kalle Valo, Rob Herring, Krzysztof Kozlowski
Cc: David S . Miller, Eric Dumazet, Jakub Kicinski, Paolo Abeni,
ath11k, linux-wireless, netdev, devicetree, linux-kernel,
Robert Marko, Rafał Miłecki
From: Rafał Miłecki <rafal@milecki.pl>
Updated DT binding allows describing each chip radio.
Signed-off-by: Rafał Miłecki <rafal@milecki.pl>
---
drivers/net/wireless/ath/ath11k/core.h | 2 ++
drivers/net/wireless/ath/ath11k/mac.c | 20 ++++++++++++++++++++
2 files changed, 22 insertions(+)
diff --git a/drivers/net/wireless/ath/ath11k/core.h b/drivers/net/wireless/ath/ath11k/core.h
index 0830276e5028..1a583adf2ab1 100644
--- a/drivers/net/wireless/ath/ath11k/core.h
+++ b/drivers/net/wireless/ath/ath11k/core.h
@@ -13,6 +13,7 @@
#include <linux/bitfield.h>
#include <linux/dmi.h>
#include <linux/ctype.h>
+#include <linux/of.h>
#include <linux/rhashtable.h>
#include <linux/average.h>
#include "qmi.h"
@@ -592,6 +593,7 @@ struct ath11k_per_peer_tx_stats {
struct ath11k {
struct ath11k_base *ab;
struct ath11k_pdev *pdev;
+ struct device_node *np;
struct ieee80211_hw *hw;
struct ieee80211_ops *ops;
struct ath11k_pdev_wmi *wmi;
diff --git a/drivers/net/wireless/ath/ath11k/mac.c b/drivers/net/wireless/ath/ath11k/mac.c
index cad832e0e6b8..ad5a22d12bd3 100644
--- a/drivers/net/wireless/ath/ath11k/mac.c
+++ b/drivers/net/wireless/ath/ath11k/mac.c
@@ -9344,6 +9344,25 @@ int ath11k_mac_register(struct ath11k_base *ab)
return ret;
}
+static struct device_node *ath11k_mac_find_radio_node(struct ath11k_base *ab, int i)
+{
+ struct device_node *np;
+
+ for_each_child_of_node(ab->dev->of_node, np) {
+ u32 reg;
+ int err;
+
+ if (strcmp(np->name, "radio"))
+ continue;
+
+ err = of_property_read_u32(np, "reg", ®);
+ if (!err && reg == i)
+ return np;
+ }
+
+ return NULL;
+}
+
int ath11k_mac_allocate(struct ath11k_base *ab)
{
struct ieee80211_hw *hw;
@@ -9369,6 +9388,7 @@ int ath11k_mac_allocate(struct ath11k_base *ab)
ar->ab = ab;
ar->pdev = pdev;
ar->pdev_idx = i;
+ ar->np = ath11k_mac_find_radio_node(ab, i);
ar->lmac_id = ath11k_hw_get_mac_from_pdev_id(&ab->hw_params, i);
ar->wmi = &ab->wmi_ab.wmi[i];
--
2.34.1
^ permalink raw reply related [flat|nested] 4+ messages in thread
* [PATCH 3/3] wifi: ath11k: support reading radio MAC from DT
2023-04-14 21:23 [PATCH 1/3] dt-bindings: net: wireless: qcom,ath11k: allow describing radios Rafał Miłecki
2023-04-14 21:23 ` [PATCH 2/3] wifi: ath11k: look for DT node for each radio Rafał Miłecki
@ 2023-04-14 21:23 ` Rafał Miłecki
2023-04-17 13:10 ` [PATCH 1/3] dt-bindings: net: wireless: qcom,ath11k: allow describing radios Rob Herring
2 siblings, 0 replies; 4+ messages in thread
From: Rafał Miłecki @ 2023-04-14 21:23 UTC (permalink / raw)
To: Kalle Valo, Rob Herring, Krzysztof Kozlowski
Cc: David S . Miller, Eric Dumazet, Jakub Kicinski, Paolo Abeni,
ath11k, linux-wireless, netdev, devicetree, linux-kernel,
Robert Marko, Rafał Miłecki
From: Rafał Miłecki <rafal@milecki.pl>
On some devices (most routers) MAC is stored in an NVMEM cell. Support
reading it.
Signed-off-by: Rafał Miłecki <rafal@milecki.pl>
---
drivers/net/wireless/ath/ath11k/mac.c | 15 ++++++++++-----
1 file changed, 10 insertions(+), 5 deletions(-)
diff --git a/drivers/net/wireless/ath/ath11k/mac.c b/drivers/net/wireless/ath/ath11k/mac.c
index ad5a22d12bd3..6550bb5b2ece 100644
--- a/drivers/net/wireless/ath/ath11k/mac.c
+++ b/drivers/net/wireless/ath/ath11k/mac.c
@@ -8,6 +8,7 @@
#include <linux/etherdevice.h>
#include <linux/bitfield.h>
#include <linux/inetdevice.h>
+#include <linux/of_net.h>
#include <net/if_inet6.h>
#include <net/ipv6.h>
@@ -9292,7 +9293,7 @@ int ath11k_mac_register(struct ath11k_base *ab)
struct ath11k_pdev *pdev;
int i;
int ret;
- u8 mac_addr[ETH_ALEN] = {0};
+ u8 device_mac_addr[ETH_ALEN] = {0};
if (test_bit(ATH11K_FLAG_REGISTERED, &ab->dev_flags))
return 0;
@@ -9305,18 +9306,22 @@ int ath11k_mac_register(struct ath11k_base *ab)
if (ret)
return ret;
- device_get_mac_address(ab->dev, mac_addr);
+ device_get_mac_address(ab->dev, device_mac_addr);
for (i = 0; i < ab->num_radios; i++) {
+ u8 radio_mac_addr[ETH_ALEN];
+
pdev = &ab->pdevs[i];
ar = pdev->ar;
- if (ab->pdevs_macaddr_valid) {
+ if (!of_get_mac_address(ar->np, radio_mac_addr)) {
+ ether_addr_copy(ar->mac_addr, radio_mac_addr);
+ } else if (ab->pdevs_macaddr_valid) {
ether_addr_copy(ar->mac_addr, pdev->mac_addr);
} else {
- if (is_zero_ether_addr(mac_addr))
+ if (is_zero_ether_addr(device_mac_addr))
ether_addr_copy(ar->mac_addr, ab->mac_addr);
else
- ether_addr_copy(ar->mac_addr, mac_addr);
+ ether_addr_copy(ar->mac_addr, device_mac_addr);
ar->mac_addr[4] += i;
}
--
2.34.1
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH 1/3] dt-bindings: net: wireless: qcom,ath11k: allow describing radios
2023-04-14 21:23 [PATCH 1/3] dt-bindings: net: wireless: qcom,ath11k: allow describing radios Rafał Miłecki
2023-04-14 21:23 ` [PATCH 2/3] wifi: ath11k: look for DT node for each radio Rafał Miłecki
2023-04-14 21:23 ` [PATCH 3/3] wifi: ath11k: support reading radio MAC from DT Rafał Miłecki
@ 2023-04-17 13:10 ` Rob Herring
2 siblings, 0 replies; 4+ messages in thread
From: Rob Herring @ 2023-04-17 13:10 UTC (permalink / raw)
To: Rafał Miłecki
Cc: Paolo Abeni, ath11k, devicetree, Rafał Miłecki,
Jakub Kicinski, netdev, Rob Herring, Krzysztof Kozlowski,
David S . Miller, linux-wireless, linux-kernel, Robert Marko,
Kalle Valo, Eric Dumazet
On Fri, 14 Apr 2023 23:23:54 +0200, Rafał Miłecki wrote:
> From: Rafał Miłecki <rafal@milecki.pl>
>
> Qualcomm ath11k chipsets can have up to 3 radios. Each radio may need to
> be additionally described by including its MAC or available frequency
> ranges.
>
> Signed-off-by: Rafał Miłecki <rafal@milecki.pl>
> ---
> .../bindings/net/wireless/qcom,ath11k.yaml | 26 +++++++++++++++++++
> 1 file changed, 26 insertions(+)
>
My bot found errors running 'make DT_CHECKER_FLAGS=-m dt_binding_check'
on your patch (DT_CHECKER_FLAGS is new in v5.13):
yamllint warnings/errors:
dtschema/dtc warnings/errors:
/builds/robherring/dt-review-ci/linux/Documentation/devicetree/bindings/net/wireless/qcom,ath11k.example.dtb: wifi@c000000: radio@0: Unevaluated properties are not allowed ('reg' was unexpected)
From schema: /builds/robherring/dt-review-ci/linux/Documentation/devicetree/bindings/net/wireless/qcom,ath11k.yaml
/builds/robherring/dt-review-ci/linux/Documentation/devicetree/bindings/net/wireless/qcom,ath11k.example.dtb: wifi@c000000: '#address-cells', '#size-cells' do not match any of the regexes: '^radio@[0-2]$', 'pinctrl-[0-9]+'
From schema: /builds/robherring/dt-review-ci/linux/Documentation/devicetree/bindings/net/wireless/qcom,ath11k.yaml
doc reference errors (make refcheckdocs):
See https://patchwork.ozlabs.org/project/devicetree-bindings/patch/20230414212356.9326-1-zajec5@gmail.com
The base for the series is generally the latest rc1. A different dependency
should be noted in *this* patch.
If you already ran 'make dt_binding_check' and didn't see the above
error(s), then make sure 'yamllint' is installed and dt-schema is up to
date:
pip3 install dtschema --upgrade
Please check and re-submit after running the above command yourself. Note
that DT_SCHEMA_FILES can be set to your schema file to speed up checking
your schema. However, it must be unset to test all examples with your schema.
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2023-04-17 13:12 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-04-14 21:23 [PATCH 1/3] dt-bindings: net: wireless: qcom,ath11k: allow describing radios Rafał Miłecki
2023-04-14 21:23 ` [PATCH 2/3] wifi: ath11k: look for DT node for each radio Rafał Miłecki
2023-04-14 21:23 ` [PATCH 3/3] wifi: ath11k: support reading radio MAC from DT Rafał Miłecki
2023-04-17 13:10 ` [PATCH 1/3] dt-bindings: net: wireless: qcom,ath11k: allow describing radios Rob Herring
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).