linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/2] dt-bindings: net: wireless: ath11k: add new DT entry for board ID
@ 2022-06-21 13:53 Robert Marko
  2022-06-21 13:53 ` [PATCH 2/2] ath11k: search DT for qcom,ath11k-board-id Robert Marko
                   ` (2 more replies)
  0 siblings, 3 replies; 8+ messages in thread
From: Robert Marko @ 2022-06-21 13:53 UTC (permalink / raw)
  To: kvalo, davem, edumazet, kuba, pabeni, robh+dt,
	krzysztof.kozlowski+dt, ath11k, linux-wireless, netdev,
	devicetree, linux-kernel
  Cc: Robert Marko

bus + qmi-chip-id + qmi-board-id and optionally the variant are currently
used for identifying the correct board data file.

This however is sometimes not enough as all of the IPQ8074 boards that I
have access to dont have the qmi-board-id properly fused and simply return
the default value of 0xFF.

So, to provide the correct qmi-board-id add a new DT property that allows
the qmi-board-id to be overridden from DTS in cases where its not set.
This is what vendors have been doing in the stock firmwares that were
shipped on boards I have.

Signed-off-by: Robert Marko <robimarko@gmail.com>
---
 .../devicetree/bindings/net/wireless/qcom,ath11k.yaml     | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/Documentation/devicetree/bindings/net/wireless/qcom,ath11k.yaml b/Documentation/devicetree/bindings/net/wireless/qcom,ath11k.yaml
index a677b056f112..fe6aafdab9d4 100644
--- a/Documentation/devicetree/bindings/net/wireless/qcom,ath11k.yaml
+++ b/Documentation/devicetree/bindings/net/wireless/qcom,ath11k.yaml
@@ -41,6 +41,14 @@ properties:
         * reg
         * reg-names
 
+  qcom,ath11k-board-id:
+    $ref: /schemas/types.yaml#/definitions/uint32
+    description:
+      Board ID to override the one returned by the firmware or the default
+      0xff if it was not set by the vendor at all.
+      It is used along the ath11k-calibration-variant to mach the correct
+      calibration data from board-2.bin.
+
   qcom,ath11k-calibration-variant:
     $ref: /schemas/types.yaml#/definitions/string
     description:
-- 
2.36.1


^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [PATCH 2/2] ath11k: search DT for qcom,ath11k-board-id
  2022-06-21 13:53 [PATCH 1/2] dt-bindings: net: wireless: ath11k: add new DT entry for board ID Robert Marko
@ 2022-06-21 13:53 ` Robert Marko
  2022-06-21 15:58 ` [PATCH 1/2] dt-bindings: net: wireless: ath11k: add new DT entry for board ID Krzysztof Kozlowski
  2022-06-27 10:26 ` Kalle Valo
  2 siblings, 0 replies; 8+ messages in thread
From: Robert Marko @ 2022-06-21 13:53 UTC (permalink / raw)
  To: kvalo, davem, edumazet, kuba, pabeni, robh+dt,
	krzysztof.kozlowski+dt, ath11k, linux-wireless, netdev,
	devicetree, linux-kernel
  Cc: Robert Marko

bus + qmi-chip-id + qmi-board-id and optionally the variant are currently
used for identifying the correct board data file.

This however is sometimes not enough as all of the IPQ8074 boards that I
have access to dont have the qmi-board-id properly fused and simply return
the default value of 0xFF.

So, to provide the correct qmi-board-id look for the qcom,ath11k-board-id
property and use that.
This is what vendors have been doing in the stock firmwares that were
shipped on boards I have.

It should be added to DTS like:
	wifi@c000000 {
        status = "okay";

        qcom,ath11k-board-id = <658>;
        qcom,ath11k-calibration-variant = "Edgecore-EAP102";
    };

Signed-off-by: Robert Marko <robimarko@gmail.com>
---
 drivers/net/wireless/ath/ath11k/qmi.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/drivers/net/wireless/ath/ath11k/qmi.c b/drivers/net/wireless/ath/ath11k/qmi.c
index 00136601cb7d..9d27b4968d10 100644
--- a/drivers/net/wireless/ath/ath11k/qmi.c
+++ b/drivers/net/wireless/ath/ath11k/qmi.c
@@ -2172,12 +2172,14 @@ static int ath11k_qmi_request_device_info(struct ath11k_base *ab)
 
 static int ath11k_qmi_request_target_cap(struct ath11k_base *ab)
 {
+	struct device *dev = ab->dev;
 	struct qmi_wlanfw_cap_req_msg_v01 req;
 	struct qmi_wlanfw_cap_resp_msg_v01 resp;
 	struct qmi_txn txn;
 	int ret = 0;
 	int r;
 	char *fw_build_id;
+	unsigned int board_id;
 	int fw_build_id_mask_len;
 
 	memset(&req, 0, sizeof(req));
@@ -2219,7 +2221,9 @@ static int ath11k_qmi_request_target_cap(struct ath11k_base *ab)
 		ab->qmi.target.chip_family = resp.chip_info.chip_family;
 	}
 
-	if (resp.board_info_valid)
+	if (!of_property_read_u32(dev->of_node, "qcom,ath11k-board-id", &board_id))
+		ab->qmi.target.board_id = board_id;
+	else if (resp.board_info_valid)
 		ab->qmi.target.board_id = resp.board_info.board_id;
 	else
 		ab->qmi.target.board_id = 0xFF;
-- 
2.36.1


^ permalink raw reply related	[flat|nested] 8+ messages in thread

* Re: [PATCH 1/2] dt-bindings: net: wireless: ath11k: add new DT entry for board ID
  2022-06-21 13:53 [PATCH 1/2] dt-bindings: net: wireless: ath11k: add new DT entry for board ID Robert Marko
  2022-06-21 13:53 ` [PATCH 2/2] ath11k: search DT for qcom,ath11k-board-id Robert Marko
@ 2022-06-21 15:58 ` Krzysztof Kozlowski
  2022-06-21 18:47   ` Robert Marko
  2022-06-27 10:26 ` Kalle Valo
  2 siblings, 1 reply; 8+ messages in thread
From: Krzysztof Kozlowski @ 2022-06-21 15:58 UTC (permalink / raw)
  To: Robert Marko, kvalo, davem, edumazet, kuba, pabeni, robh+dt,
	krzysztof.kozlowski+dt, ath11k, linux-wireless, netdev,
	devicetree, linux-kernel

On 21/06/2022 15:53, Robert Marko wrote:
> bus + qmi-chip-id + qmi-board-id and optionally the variant are currently
> used for identifying the correct board data file.
> 
> This however is sometimes not enough as all of the IPQ8074 boards that I
> have access to dont have the qmi-board-id properly fused and simply return
> the default value of 0xFF.
> 
> So, to provide the correct qmi-board-id add a new DT property that allows
> the qmi-board-id to be overridden from DTS in cases where its not set.
> This is what vendors have been doing in the stock firmwares that were
> shipped on boards I have.
> 
> Signed-off-by: Robert Marko <robimarko@gmail.com>

Thank you for your patch. There is something to discuss/improve.

> ---
>  .../devicetree/bindings/net/wireless/qcom,ath11k.yaml     | 8 ++++++++
>  1 file changed, 8 insertions(+)
> 
> diff --git a/Documentation/devicetree/bindings/net/wireless/qcom,ath11k.yaml b/Documentation/devicetree/bindings/net/wireless/qcom,ath11k.yaml
> index a677b056f112..fe6aafdab9d4 100644
> --- a/Documentation/devicetree/bindings/net/wireless/qcom,ath11k.yaml
> +++ b/Documentation/devicetree/bindings/net/wireless/qcom,ath11k.yaml
> @@ -41,6 +41,14 @@ properties:
>          * reg
>          * reg-names
>  
> +  qcom,ath11k-board-id:

The "board" a bit confuses me because in the context of entire system it
means the entire hardware running Qualcomm SoC. This is sometimes
encoded as qcom,board-id property.

Is your property exactly the same?

> +    $ref: /schemas/types.yaml#/definitions/uint32
> +    description:
> +      Board ID to override the one returned by the firmware or the default
> +      0xff if it was not set by the vendor at all.
> +      It is used along the ath11k-calibration-variant to mach the correct
> +      calibration data from board-2.bin.
> +
>    qcom,ath11k-calibration-variant:
>      $ref: /schemas/types.yaml#/definitions/string
>      description:


Best regards,
Krzysztof

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH 1/2] dt-bindings: net: wireless: ath11k: add new DT entry for board ID
  2022-06-21 15:58 ` [PATCH 1/2] dt-bindings: net: wireless: ath11k: add new DT entry for board ID Krzysztof Kozlowski
@ 2022-06-21 18:47   ` Robert Marko
  2022-06-22 14:55     ` Krzysztof Kozlowski
  0 siblings, 1 reply; 8+ messages in thread
From: Robert Marko @ 2022-06-21 18:47 UTC (permalink / raw)
  To: Krzysztof Kozlowski
  Cc: Kalle Valo, davem, edumazet, kuba, pabeni, Rob Herring,
	krzysztof.kozlowski+dt, ath11k, linux-wireless, netdev,
	Devicetree List, open list

On Tue, 21 Jun 2022 at 17:58, Krzysztof Kozlowski
<krzysztof.kozlowski@linaro.org> wrote:
>
> On 21/06/2022 15:53, Robert Marko wrote:
> > bus + qmi-chip-id + qmi-board-id and optionally the variant are currently
> > used for identifying the correct board data file.
> >
> > This however is sometimes not enough as all of the IPQ8074 boards that I
> > have access to dont have the qmi-board-id properly fused and simply return
> > the default value of 0xFF.
> >
> > So, to provide the correct qmi-board-id add a new DT property that allows
> > the qmi-board-id to be overridden from DTS in cases where its not set.
> > This is what vendors have been doing in the stock firmwares that were
> > shipped on boards I have.
> >
> > Signed-off-by: Robert Marko <robimarko@gmail.com>
>
> Thank you for your patch. There is something to discuss/improve.
>
> > ---
> >  .../devicetree/bindings/net/wireless/qcom,ath11k.yaml     | 8 ++++++++
> >  1 file changed, 8 insertions(+)
> >
> > diff --git a/Documentation/devicetree/bindings/net/wireless/qcom,ath11k.yaml b/Documentation/devicetree/bindings/net/wireless/qcom,ath11k.yaml
> > index a677b056f112..fe6aafdab9d4 100644
> > --- a/Documentation/devicetree/bindings/net/wireless/qcom,ath11k.yaml
> > +++ b/Documentation/devicetree/bindings/net/wireless/qcom,ath11k.yaml
> > @@ -41,6 +41,14 @@ properties:
> >          * reg
> >          * reg-names
> >
> > +  qcom,ath11k-board-id:
>
> The "board" a bit confuses me because in the context of entire system it
> means the entire hardware running Qualcomm SoC. This is sometimes
> encoded as qcom,board-id property.

Hi Krzysztof,
I agree that the name is a bit confusing, it's not the same as
qcom,board-id AFAIK
and QCA as well as vendors are using a similar property in the wifi
node to override
the default qmi-board-id to the correct one as its rarely properly fused.

I assume it would be better-called qcom,ath11k-qmi-board-id as you
dont even have
to be using a Qualcomm SoC as the same is used by PCI ath11k cards as well.

Regards,
Robert
>
> Is your property exactly the same?
>
> > +    $ref: /schemas/types.yaml#/definitions/uint32
> > +    description:
> > +      Board ID to override the one returned by the firmware or the default
> > +      0xff if it was not set by the vendor at all.
> > +      It is used along the ath11k-calibration-variant to mach the correct
> > +      calibration data from board-2.bin.
> > +
> >    qcom,ath11k-calibration-variant:
> >      $ref: /schemas/types.yaml#/definitions/string
> >      description:
>
>
> Best regards,
> Krzysztof

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH 1/2] dt-bindings: net: wireless: ath11k: add new DT entry for board ID
  2022-06-21 18:47   ` Robert Marko
@ 2022-06-22 14:55     ` Krzysztof Kozlowski
  2022-06-23 20:16       ` Robert Marko
  0 siblings, 1 reply; 8+ messages in thread
From: Krzysztof Kozlowski @ 2022-06-22 14:55 UTC (permalink / raw)
  To: Robert Marko
  Cc: Kalle Valo, davem, edumazet, kuba, pabeni, Rob Herring,
	krzysztof.kozlowski+dt, ath11k, linux-wireless, netdev,
	Devicetree List, open list

On 21/06/2022 20:47, Robert Marko wrote:
> On Tue, 21 Jun 2022 at 17:58, Krzysztof Kozlowski
> <krzysztof.kozlowski@linaro.org> wrote:
>>
>> On 21/06/2022 15:53, Robert Marko wrote:
>>> bus + qmi-chip-id + qmi-board-id and optionally the variant are currently
>>> used for identifying the correct board data file.
>>>
>>> This however is sometimes not enough as all of the IPQ8074 boards that I
>>> have access to dont have the qmi-board-id properly fused and simply return
>>> the default value of 0xFF.
>>>
>>> So, to provide the correct qmi-board-id add a new DT property that allows
>>> the qmi-board-id to be overridden from DTS in cases where its not set.
>>> This is what vendors have been doing in the stock firmwares that were
>>> shipped on boards I have.
>>>
>>> Signed-off-by: Robert Marko <robimarko@gmail.com>
>>
>> Thank you for your patch. There is something to discuss/improve.
>>
>>> ---
>>>  .../devicetree/bindings/net/wireless/qcom,ath11k.yaml     | 8 ++++++++
>>>  1 file changed, 8 insertions(+)
>>>
>>> diff --git a/Documentation/devicetree/bindings/net/wireless/qcom,ath11k.yaml b/Documentation/devicetree/bindings/net/wireless/qcom,ath11k.yaml
>>> index a677b056f112..fe6aafdab9d4 100644
>>> --- a/Documentation/devicetree/bindings/net/wireless/qcom,ath11k.yaml
>>> +++ b/Documentation/devicetree/bindings/net/wireless/qcom,ath11k.yaml
>>> @@ -41,6 +41,14 @@ properties:
>>>          * reg
>>>          * reg-names
>>>
>>> +  qcom,ath11k-board-id:
>>
>> The "board" a bit confuses me because in the context of entire system it
>> means the entire hardware running Qualcomm SoC. This is sometimes
>> encoded as qcom,board-id property.
> 
> Hi Krzysztof,
> I agree that the name is a bit confusing, it's not the same as
> qcom,board-id AFAIK
> and QCA as well as vendors are using a similar property in the wifi
> node to override
> the default qmi-board-id to the correct one as its rarely properly fused.
> 
> I assume it would be better-called qcom,ath11k-qmi-board-id as you
> dont even have
> to be using a Qualcomm SoC as the same is used by PCI ath11k cards as well.
> 

Thanks for the explanation. What is the "board" in that context? The
card/hardware with ath11k? Then maybe qcom,ath11k-qmi-id or
qcom,ath11k-qmi-hw-id?

Best regards,
Krzysztof

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH 1/2] dt-bindings: net: wireless: ath11k: add new DT entry for board ID
  2022-06-22 14:55     ` Krzysztof Kozlowski
@ 2022-06-23 20:16       ` Robert Marko
  0 siblings, 0 replies; 8+ messages in thread
From: Robert Marko @ 2022-06-23 20:16 UTC (permalink / raw)
  To: Krzysztof Kozlowski
  Cc: Kalle Valo, davem, Eric Dumazet, kuba, pabeni, Rob Herring,
	krzysztof.kozlowski+dt, ath11k, linux-wireless, netdev,
	Devicetree List, open list

On Wed, 22 Jun 2022 at 16:55, Krzysztof Kozlowski
<krzysztof.kozlowski@linaro.org> wrote:
>
> On 21/06/2022 20:47, Robert Marko wrote:
> > On Tue, 21 Jun 2022 at 17:58, Krzysztof Kozlowski
> > <krzysztof.kozlowski@linaro.org> wrote:
> >>
> >> On 21/06/2022 15:53, Robert Marko wrote:
> >>> bus + qmi-chip-id + qmi-board-id and optionally the variant are currently
> >>> used for identifying the correct board data file.
> >>>
> >>> This however is sometimes not enough as all of the IPQ8074 boards that I
> >>> have access to dont have the qmi-board-id properly fused and simply return
> >>> the default value of 0xFF.
> >>>
> >>> So, to provide the correct qmi-board-id add a new DT property that allows
> >>> the qmi-board-id to be overridden from DTS in cases where its not set.
> >>> This is what vendors have been doing in the stock firmwares that were
> >>> shipped on boards I have.
> >>>
> >>> Signed-off-by: Robert Marko <robimarko@gmail.com>
> >>
> >> Thank you for your patch. There is something to discuss/improve.
> >>
> >>> ---
> >>>  .../devicetree/bindings/net/wireless/qcom,ath11k.yaml     | 8 ++++++++
> >>>  1 file changed, 8 insertions(+)
> >>>
> >>> diff --git a/Documentation/devicetree/bindings/net/wireless/qcom,ath11k.yaml b/Documentation/devicetree/bindings/net/wireless/qcom,ath11k.yaml
> >>> index a677b056f112..fe6aafdab9d4 100644
> >>> --- a/Documentation/devicetree/bindings/net/wireless/qcom,ath11k.yaml
> >>> +++ b/Documentation/devicetree/bindings/net/wireless/qcom,ath11k.yaml
> >>> @@ -41,6 +41,14 @@ properties:
> >>>          * reg
> >>>          * reg-names
> >>>
> >>> +  qcom,ath11k-board-id:
> >>
> >> The "board" a bit confuses me because in the context of entire system it
> >> means the entire hardware running Qualcomm SoC. This is sometimes
> >> encoded as qcom,board-id property.
> >
> > Hi Krzysztof,
> > I agree that the name is a bit confusing, it's not the same as
> > qcom,board-id AFAIK
> > and QCA as well as vendors are using a similar property in the wifi
> > node to override
> > the default qmi-board-id to the correct one as its rarely properly fused.
> >
> > I assume it would be better-called qcom,ath11k-qmi-board-id as you
> > dont even have
> > to be using a Qualcomm SoC as the same is used by PCI ath11k cards as well.
> >
>
> Thanks for the explanation. What is the "board" in that context? The
> card/hardware with ath11k? Then maybe qcom,ath11k-qmi-id or
> qcom,ath11k-qmi-hw-id?

Hi,

I assume it started off as a numerical value to match the board design and was
then simply carried off to the PCI cards as well.

qcom,ath11k-qmi-hw-id is fine by me, will just expand the description to make
it clear.

Regards,
Robert

>
> Best regards,
> Krzysztof

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH 1/2] dt-bindings: net: wireless: ath11k: add new DT entry for board ID
  2022-06-21 13:53 [PATCH 1/2] dt-bindings: net: wireless: ath11k: add new DT entry for board ID Robert Marko
  2022-06-21 13:53 ` [PATCH 2/2] ath11k: search DT for qcom,ath11k-board-id Robert Marko
  2022-06-21 15:58 ` [PATCH 1/2] dt-bindings: net: wireless: ath11k: add new DT entry for board ID Krzysztof Kozlowski
@ 2022-06-27 10:26 ` Kalle Valo
  2022-06-27 10:30   ` Robert Marko
  2 siblings, 1 reply; 8+ messages in thread
From: Kalle Valo @ 2022-06-27 10:26 UTC (permalink / raw)
  To: Robert Marko
  Cc: davem, edumazet, kuba, pabeni, robh+dt, krzysztof.kozlowski+dt,
	ath11k, linux-wireless, netdev, devicetree, linux-kernel

Robert Marko <robimarko@gmail.com> writes:

> bus + qmi-chip-id + qmi-board-id and optionally the variant are currently
> used for identifying the correct board data file.
>
> This however is sometimes not enough as all of the IPQ8074 boards that I
> have access to dont have the qmi-board-id properly fused and simply return
> the default value of 0xFF.
>
> So, to provide the correct qmi-board-id add a new DT property that allows
> the qmi-board-id to be overridden from DTS in cases where its not set.
> This is what vendors have been doing in the stock firmwares that were
> shipped on boards I have.

What's wrong with using 0xff? Ie. something like this:

bus=ahb,qmi-chip-id=0,qmi-board-id=255,variant=foo

Or maybe even just skip qmi-board-id entirely if it's not supported? So
that the board file string would be something like:

bus=ahb,qmi-chip-id=0,variant=foo

I really would like to avoid adding more DT properties unless it's
absolutely critical.

-- 
https://patchwork.kernel.org/project/linux-wireless/list/

https://wireless.wiki.kernel.org/en/developers/documentation/submittingpatches

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH 1/2] dt-bindings: net: wireless: ath11k: add new DT entry for board ID
  2022-06-27 10:26 ` Kalle Valo
@ 2022-06-27 10:30   ` Robert Marko
  0 siblings, 0 replies; 8+ messages in thread
From: Robert Marko @ 2022-06-27 10:30 UTC (permalink / raw)
  To: Kalle Valo
  Cc: davem, Eric Dumazet, kuba, pabeni, Rob Herring,
	krzysztof.kozlowski+dt, ath11k, linux-wireless, netdev,
	Devicetree List, open list

On Mon, 27 Jun 2022 at 12:27, Kalle Valo <kvalo@kernel.org> wrote:
>
> Robert Marko <robimarko@gmail.com> writes:
>
> > bus + qmi-chip-id + qmi-board-id and optionally the variant are currently
> > used for identifying the correct board data file.
> >
> > This however is sometimes not enough as all of the IPQ8074 boards that I
> > have access to dont have the qmi-board-id properly fused and simply return
> > the default value of 0xFF.
> >
> > So, to provide the correct qmi-board-id add a new DT property that allows
> > the qmi-board-id to be overridden from DTS in cases where its not set.
> > This is what vendors have been doing in the stock firmwares that were
> > shipped on boards I have.
>
> What's wrong with using 0xff? Ie. something like this:
>
> bus=ahb,qmi-chip-id=0,qmi-board-id=255,variant=foo
>
> Or maybe even just skip qmi-board-id entirely if it's not supported? So
> that the board file string would be something like:
>
> bus=ahb,qmi-chip-id=0,variant=foo
>
> I really would like to avoid adding more DT properties unless it's
> absolutely critical.

Well, I suppose that due to the variant property we can avoid "correcting" the
qmi-board-id

Regards,
Robert
>
> --
> https://patchwork.kernel.org/project/linux-wireless/list/
>
> https://wireless.wiki.kernel.org/en/developers/documentation/submittingpatches

^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2022-06-27 10:30 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-06-21 13:53 [PATCH 1/2] dt-bindings: net: wireless: ath11k: add new DT entry for board ID Robert Marko
2022-06-21 13:53 ` [PATCH 2/2] ath11k: search DT for qcom,ath11k-board-id Robert Marko
2022-06-21 15:58 ` [PATCH 1/2] dt-bindings: net: wireless: ath11k: add new DT entry for board ID Krzysztof Kozlowski
2022-06-21 18:47   ` Robert Marko
2022-06-22 14:55     ` Krzysztof Kozlowski
2022-06-23 20:16       ` Robert Marko
2022-06-27 10:26 ` Kalle Valo
2022-06-27 10:30   ` Robert Marko

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).