diff mbox series

[v4,1/5] dt-bindings: wireless: wilc1000: Document WILC3000 compatible string

Message ID 20240829004510.178016-1-marex@denx.de (mailing list archive)
State Superseded
Delegated to: Netdev Maintainers
Headers show
Series [v4,1/5] dt-bindings: wireless: wilc1000: Document WILC3000 compatible string | expand

Checks

Context Check Description
netdev/tree_selection success Not a local patch

Commit Message

Marek Vasut Aug. 29, 2024, 12:44 a.m. UTC
Document compatible string for the WILC3000 chip. The chip is similar
to WILC1000, except that the register layout is slightly different and
it does not support WPA3/SAE.

Reviewed-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
Signed-off-by: Marek Vasut <marex@denx.de>
---
Cc: "David S. Miller" <davem@davemloft.net>
Cc: Adham Abozaeid <adham.abozaeid@microchip.com>
Cc: Ajay Singh <ajay.kathat@microchip.com>
Cc: Alexis Lothoré <alexis.lothore@bootlin.com>
Cc: Claudiu Beznea <claudiu.beznea@tuxon.dev>
Cc: Conor Dooley <conor+dt@kernel.org>
Cc: Eric Dumazet <edumazet@google.com>
Cc: Jakub Kicinski <kuba@kernel.org>
Cc: Kalle Valo <kvalo@kernel.org>
Cc: Krzysztof Kozlowski <krzk+dt@kernel.org>
Cc: Marek Vasut <marex@denx.de>
Cc: Paolo Abeni <pabeni@redhat.com>
Cc: Rob Herring <robh@kernel.org>
Cc: devicetree@vger.kernel.org
Cc: linux-wireless@vger.kernel.org
Cc: netdev@vger.kernel.org
---
V2: - Use WILC1000 as fallback compatible string for WILC3000
V3: - Swap the wilc1000/wilc3000 compatible order
V4: - Add RB from Krzysztof
---
 .../bindings/net/wireless/microchip,wilc1000.yaml           | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

Comments

Alexis Lothoré (eBPF Foundation) Sept. 3, 2024, 4:09 p.m. UTC | #1
Hello everyone,

On 8/29/24 02:44, Marek Vasut wrote:
> Document compatible string for the WILC3000 chip. The chip is similar
> to WILC1000, except that the register layout is slightly different and
> it does not support WPA3/SAE.
> 
> Reviewed-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
> Signed-off-by: Marek Vasut <marex@denx.de>

[...]

>  .../bindings/net/wireless/microchip,wilc1000.yaml           | 6 +++++-
>  1 file changed, 5 insertions(+), 1 deletion(-)
> 
> diff --git a/Documentation/devicetree/bindings/net/wireless/microchip,wilc1000.yaml b/Documentation/devicetree/bindings/net/wireless/microchip,wilc1000.yaml
> index 2460ccc082371..5d40f22765bb6 100644
> --- a/Documentation/devicetree/bindings/net/wireless/microchip,wilc1000.yaml
> +++ b/Documentation/devicetree/bindings/net/wireless/microchip,wilc1000.yaml
> @@ -16,7 +16,11 @@ description:
>  
>  properties:
>    compatible:
> -    const: microchip,wilc1000
> +    oneOf:
> +      - items:
> +          - const: microchip,wilc3000
> +          - const: microchip,wilc1000
> +      - const: microchip,wilc1000
>  
>    reg: true

Following this series first revision, I have been taking a look at how to
implement bluetooth feature for wilc3000 (the chip supports Bluetooth LE through
a separated UART, see [1]), and I am facing some constraints. I feel like the
possible solutions would conflict with this new binding, so even if I am a bit
late to the party, I would like to expose the issue before the binding is merged
in case we can find something which would allow to add bluetooth support without
too much pain after the wlan part.

Downstream driver currently does not implement bluetooth as a standard bluetooth
driver (module in drivers/bluetooth, registering a HCI device) but only performs
a minimal set of operations directly in the wlan part ([2]). Getting a version
valid for upstream would need the following points to be addressed:
1. despite being controlled from a serial port for nominal operations, the
bluetooth part also depends on the "wlan" bus (spi or sdio) for initialization
2. yet init steps are not performed on any kind of subsystem ops but through
writes to a custom chardev
3. the driver does not register itself a hci interface, it is expected to be
done by userspace (hciattach).

It is only after those 3 steps that the chip can be used with standard hci
commands over serial port. IMHO 1 is the biggest point, because it means that
**a bluetooth driver for wilc3000 needs access to the bus used by wlan part**
(so only describing the bluetooth part of the chip as a child node of an uart
controller is not enough). Aside from bus access, I also expect some
interactions between bluetooth and wifi (eg: power management, sleep/wakeup)

After considering multiple solutions to try to share this bus between existing
wlan driver and a new bt driver (mfd device, auxiliary bus, device link + some
handles, etc), my current best guess is to convert wilc driver to a MFD driver
for wilc3000. I guess some work can be done so that the driver can still be
shared between wilc1000 and wilc3000 _while_ remaining compatible with current
wilc1000 description, but it would impact the DT description for wilc3000, which
would need to switch from this:

  spi {
    wifi@0 {
      compatible = "microchip,wilc3000";
      [...]
    };
  };

To something like this:

  spi {
    wilc@0 {
      compatible = "microchip,wilc3000"; /* mfd driver */
      wifi {
        compatible = "microchip,wilc3000-wlan";
        [...]
      };
      bt {
        compatible = "microchip,wilc3000-bt";
        XXXX; /* some link to the uart controller connected to the chip */
        [...]
      };
    };
  };

(and similar thing when wilc is driven over a sdio bus)

Any opinion on this ? Would it make sense to describe wilc3000 chip that way ?

Thanks,
Alexis

[1] https://www.microchip.com/en-us/product/atwilc3000
[2]
https://github.com/linux4sam/linux-at91/blob/linux-6.6-mchp/drivers/net/wireless/microchip/wilc1000/bt.c
Krzysztof Kozlowski Sept. 3, 2024, 6:47 p.m. UTC | #2
On 03/09/2024 18:09, Alexis Lothoré wrote:
> Hello everyone,
> 
> On 8/29/24 02:44, Marek Vasut wrote:
>> Document compatible string for the WILC3000 chip. The chip is similar
>> to WILC1000, except that the register layout is slightly different and
>> it does not support WPA3/SAE.
>>
>> Reviewed-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
>> Signed-off-by: Marek Vasut <marex@denx.de>
> 
> [...]
> 
>>  .../bindings/net/wireless/microchip,wilc1000.yaml           | 6 +++++-
>>  1 file changed, 5 insertions(+), 1 deletion(-)
>>
>> diff --git a/Documentation/devicetree/bindings/net/wireless/microchip,wilc1000.yaml b/Documentation/devicetree/bindings/net/wireless/microchip,wilc1000.yaml
>> index 2460ccc082371..5d40f22765bb6 100644
>> --- a/Documentation/devicetree/bindings/net/wireless/microchip,wilc1000.yaml
>> +++ b/Documentation/devicetree/bindings/net/wireless/microchip,wilc1000.yaml
>> @@ -16,7 +16,11 @@ description:
>>  
>>  properties:
>>    compatible:
>> -    const: microchip,wilc1000
>> +    oneOf:
>> +      - items:
>> +          - const: microchip,wilc3000
>> +          - const: microchip,wilc1000
>> +      - const: microchip,wilc1000
>>  
>>    reg: true
> 
> Following this series first revision, I have been taking a look at how to
> implement bluetooth feature for wilc3000 (the chip supports Bluetooth LE through
> a separated UART, see [1]), and I am facing some constraints. I feel like the
> possible solutions would conflict with this new binding, so even if I am a bit
> late to the party, I would like to expose the issue before the binding is merged
> in case we can find something which would allow to add bluetooth support without
> too much pain after the wlan part.
> 
> Downstream driver currently does not implement bluetooth as a standard bluetooth
> driver (module in drivers/bluetooth, registering a HCI device) but only performs
> a minimal set of operations directly in the wlan part ([2]). Getting a version
> valid for upstream would need the following points to be addressed:
> 1. despite being controlled from a serial port for nominal operations, the
> bluetooth part also depends on the "wlan" bus (spi or sdio) for initialization
> 2. yet init steps are not performed on any kind of subsystem ops but through
> writes to a custom chardev
> 3. the driver does not register itself a hci interface, it is expected to be
> done by userspace (hciattach).
> 
> It is only after those 3 steps that the chip can be used with standard hci
> commands over serial port. IMHO 1 is the biggest point, because it means that
> **a bluetooth driver for wilc3000 needs access to the bus used by wlan part**
> (so only describing the bluetooth part of the chip as a child node of an uart
> controller is not enough). Aside from bus access, I also expect some
> interactions between bluetooth and wifi (eg: power management, sleep/wakeup)
> 
> After considering multiple solutions to try to share this bus between existing
> wlan driver and a new bt driver (mfd device, auxiliary bus, device link + some

Driver design should not have impact on bindings.

> handles, etc), my current best guess is to convert wilc driver to a MFD driver
> for wilc3000. I guess some work can be done so that the driver can still be
> shared between wilc1000 and wilc3000 _while_ remaining compatible with current
> wilc1000 description, but it would impact the DT description for wilc3000, which
> would need to switch from this:
> 
>   spi {
>     wifi@0 {
>       compatible = "microchip,wilc3000";
>       [...]
>     };
>   };
> 
> To something like this:
> 
>   spi {
>     wilc@0 {
>       compatible = "microchip,wilc3000"; /* mfd driver */

I do not see any reason why... or rather: What is MFD here? MFD is Linux
stuff and we talk about hardware.

>       wifi {
>         compatible = "microchip,wilc3000-wlan";

Why? Just merge it to parent...

>         [...]
>       };
>       bt {
>         compatible = "microchip,wilc3000-bt";
>         XXXX; /* some link to the uart controller connected to the chip */

That's not how we represent UART devices. I don't understand why do you
need these - if for power sequencing, then use power sequencing
framework and describe associated hardware (there are some talks coming
about it in 2 weeks). If for something else, then for what?

>         [...]
>       };
>     };
>   };
> 
> (and similar thing when wilc is driven over a sdio bus)
> 
> Any opinion on this ? Would it make sense to describe wilc3000 chip that way ?
> 

You described drivers, not wilc3000 chip...

Best regards,
Krzysztof
Marek Vasut Sept. 3, 2024, 7:30 p.m. UTC | #3
On 9/3/24 6:09 PM, Alexis Lothoré wrote:
> Hello everyone,

Hi,

> On 8/29/24 02:44, Marek Vasut wrote:
>> Document compatible string for the WILC3000 chip. The chip is similar
>> to WILC1000, except that the register layout is slightly different and
>> it does not support WPA3/SAE.
>>
>> Reviewed-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
>> Signed-off-by: Marek Vasut <marex@denx.de>
> 
> [...]
> 
>>   .../bindings/net/wireless/microchip,wilc1000.yaml           | 6 +++++-
>>   1 file changed, 5 insertions(+), 1 deletion(-)
>>
>> diff --git a/Documentation/devicetree/bindings/net/wireless/microchip,wilc1000.yaml b/Documentation/devicetree/bindings/net/wireless/microchip,wilc1000.yaml
>> index 2460ccc082371..5d40f22765bb6 100644
>> --- a/Documentation/devicetree/bindings/net/wireless/microchip,wilc1000.yaml
>> +++ b/Documentation/devicetree/bindings/net/wireless/microchip,wilc1000.yaml
>> @@ -16,7 +16,11 @@ description:
>>   
>>   properties:
>>     compatible:
>> -    const: microchip,wilc1000
>> +    oneOf:
>> +      - items:
>> +          - const: microchip,wilc3000
>> +          - const: microchip,wilc1000
>> +      - const: microchip,wilc1000
>>   
>>     reg: true
> 
> Following this series first revision, I have been taking a look at how to
> implement bluetooth feature for wilc3000 (the chip supports Bluetooth LE through
> a separated UART, see [1]), and I am facing some constraints. I feel like the
> possible solutions would conflict with this new binding, so even if I am a bit
> late to the party, I would like to expose the issue before the binding is merged
> in case we can find something which would allow to add bluetooth support without
> too much pain after the wlan part.
> 
> Downstream driver currently does not implement bluetooth as a standard bluetooth
> driver (module in drivers/bluetooth, registering a HCI device) but only performs
> a minimal set of operations directly in the wlan part ([2]). Getting a version
> valid for upstream would need the following points to be addressed:
> 1. despite being controlled from a serial port for nominal operations, the
> bluetooth part also depends on the "wlan" bus (spi or sdio) for initialization
> 2. yet init steps are not performed on any kind of subsystem ops but through
> writes to a custom chardev
> 3. the driver does not register itself a hci interface, it is expected to be
> done by userspace (hciattach).
> 
> It is only after those 3 steps that the chip can be used with standard hci
> commands over serial port. IMHO 1 is the biggest point, because it means that
> **a bluetooth driver for wilc3000 needs access to the bus used by wlan part**
> (so only describing the bluetooth part of the chip as a child node of an uart
> controller is not enough). Aside from bus access, I also expect some
> interactions between bluetooth and wifi (eg: power management, sleep/wakeup)

Just a quick idea -- what about having a phandle to the BT UART node in 
the wilc3000 node ? Then the wilc driver can check if the phandle is 
available and valid, and attach the BT part to the UART, while also 
doing all the necessary power sequencing and bus accesses via SDIO/SPI.

Like this:

&uart10 {
   status = "okay";
};

&mmc20 {
   ...
   wifi@0 {
     compatible = "microchip,wilc1000";
     microchip,bt-uart = <&uart10>; // OPTIONAL
     ...
   };
};
Alexis Lothoré (eBPF Foundation) Sept. 4, 2024, 2:32 p.m. UTC | #4
Hi Krzysztof,

On 9/3/24 20:47, Krzysztof Kozlowski wrote:
> On 03/09/2024 18:09, Alexis Lothoré wrote:

[...]

>> After considering multiple solutions to try to share this bus between existing
>> wlan driver and a new bt driver (mfd device, auxiliary bus, device link + some
> 
> Driver design should not have impact on bindings.
> 
>> handles, etc), my current best guess is to convert wilc driver to a MFD driver
>> for wilc3000. I guess some work can be done so that the driver can still be
>> shared between wilc1000 and wilc3000 _while_ remaining compatible with current
>> wilc1000 description, but it would impact the DT description for wilc3000, which
>> would need to switch from this:
>>
>>   spi {
>>     wifi@0 {
>>       compatible = "microchip,wilc3000";
>>       [...]
>>     };
>>   };
>>
>> To something like this:
>>
>>   spi {
>>     wilc@0 {
>>       compatible = "microchip,wilc3000"; /* mfd driver */
> 
> I do not see any reason why... or rather: What is MFD here? MFD is Linux
> stuff and we talk about hardware.
> 
>>       wifi {
>>         compatible = "microchip,wilc3000-wlan";
> 
> Why? Just merge it to parent...
> 
>>         [...]
>>       };
>>       bt {
>>         compatible = "microchip,wilc3000-bt";
>>         XXXX; /* some link to the uart controller connected to the chip */
> 
> That's not how we represent UART devices. I don't understand why do you
> need these - if for power sequencing, then use power sequencing
> framework and describe associated hardware (there are some talks coming
> about it in 2 weeks). If for something else, then for what?

I have to check more for this power sequencing framework, it look likes it could
handle parts of the wifi/bt shared power management, but it will not cover
everything. The need for this bus on the BT side is not only for power
sequencing, there is some chip initialization to be performed over this bus,
like firmware upload to the chip (not the wifi firmware, it is an additional
bluetooth firmware).

I guess you are referring to Bartosz Golaszewski's talk at Plumbers.
Unfortunately I can not attend, but I'll make sure to check the materials once
available :)

Thanks,

Alexis
Alexis Lothoré (eBPF Foundation) Sept. 4, 2024, 2:50 p.m. UTC | #5
Hello Marek,

On 9/3/24 21:30, Marek Vasut wrote:
> On 9/3/24 6:09 PM, Alexis Lothoré wrote:

[...]

>> It is only after those 3 steps that the chip can be used with standard hci
>> commands over serial port. IMHO 1 is the biggest point, because it means that
>> **a bluetooth driver for wilc3000 needs access to the bus used by wlan part**
>> (so only describing the bluetooth part of the chip as a child node of an uart
>> controller is not enough). Aside from bus access, I also expect some
>> interactions between bluetooth and wifi (eg: power management, sleep/wakeup)
> 
> Just a quick idea -- what about having a phandle to the BT UART node in the
> wilc3000 node ? Then the wilc driver can check if the phandle is available and
> valid, and attach the BT part to the UART, while also doing all the necessary
> power sequencing and bus accesses via SDIO/SPI.
> 
> Like this:
> 
> &uart10 {
>   status = "okay";
> };
> 
> &mmc20 {
>   ...
>   wifi@0 {
>     compatible = "microchip,wilc1000";
>     microchip,bt-uart = <&uart10>; // OPTIONAL
>     ...
>   };
> };

I thought about something like this too, indeed (but somehow inverted, a
reference to wilc node in the bt node under uart, to allow the bluetooth part to
ask wilc to perform operations over sdio/spi). The design would likely be
simpler in this case, but some internal discussions with colleagues raised some
concerns, for example with power management (but Krzysztof's suggestion about
power sequencing may help with this).

Thanks,

Alexis
Marek Vasut Sept. 4, 2024, 5:45 p.m. UTC | #6
On 9/4/24 4:50 PM, Alexis Lothoré wrote:
> Hello Marek,

Hi,

>>> It is only after those 3 steps that the chip can be used with standard hci
>>> commands over serial port. IMHO 1 is the biggest point, because it means that
>>> **a bluetooth driver for wilc3000 needs access to the bus used by wlan part**
>>> (so only describing the bluetooth part of the chip as a child node of an uart
>>> controller is not enough). Aside from bus access, I also expect some
>>> interactions between bluetooth and wifi (eg: power management, sleep/wakeup)
>>
>> Just a quick idea -- what about having a phandle to the BT UART node in the
>> wilc3000 node ? Then the wilc driver can check if the phandle is available and
>> valid, and attach the BT part to the UART, while also doing all the necessary
>> power sequencing and bus accesses via SDIO/SPI.
>>
>> Like this:
>>
>> &uart10 {
>>    status = "okay";
>> };
>>
>> &mmc20 {
>>    ...
>>    wifi@0 {
>>      compatible = "microchip,wilc1000";
>>      microchip,bt-uart = <&uart10>; // OPTIONAL
>>      ...
>>    };
>> };
> 
> I thought about something like this too, indeed (but somehow inverted, a
> reference to wilc node in the bt node under uart, to allow the bluetooth part to
> ask wilc to perform operations over sdio/spi). The design would likely be
> simpler in this case, but some internal discussions with colleagues raised some
> concerns, for example with power management (but Krzysztof's suggestion about
> power sequencing may help with this).

Maybe switching the current WILC power management to runtime PM would 
simplify things greatly ?
diff mbox series

Patch

diff --git a/Documentation/devicetree/bindings/net/wireless/microchip,wilc1000.yaml b/Documentation/devicetree/bindings/net/wireless/microchip,wilc1000.yaml
index 2460ccc082371..5d40f22765bb6 100644
--- a/Documentation/devicetree/bindings/net/wireless/microchip,wilc1000.yaml
+++ b/Documentation/devicetree/bindings/net/wireless/microchip,wilc1000.yaml
@@ -16,7 +16,11 @@  description:
 
 properties:
   compatible:
-    const: microchip,wilc1000
+    oneOf:
+      - items:
+          - const: microchip,wilc3000
+          - const: microchip,wilc1000
+      - const: microchip,wilc1000
 
   reg: true