mbox series

[v3,00/17] wifi: cc33xx: Add driver for new TI CC33xx wireless device family

Message ID 20240806170018.638585-1-michael.nemanov@ti.com
Headers show
Series wifi: cc33xx: Add driver for new TI CC33xx wireless device family | expand

Message

Nemanov, Michael Aug. 6, 2024, 5 p.m. UTC
Hello everyone,

This series adds support for CC33xx which is a new family of WLAN IEEE802.11 a/b/g/n/ax
and BLE 5.4 transceivers by Texas Instruments. These devices are 20MHz single spatial stream
enabling STA (IEEE802.11ax) and AP (IEEE802.11n only) roles as well as both roles simultaneously.
Communication to the CC33xx is done via 4-bit SDIO with two extra GPIOs: Enable and Interrupt.

This driver's architecture is a soft-MAC and derivative of existing wl18xx + wlcore code [1].
It has been tested with the AM335x, AM625x, and i.MX8-MP evaluation kits.

Data sheet: https://www.ti.com/lit/gpn/cc3301

All code passes sparse, smatch, coccicheck and checkpatch with very few pragmatic exceptions.

Driver is split on file boundary as required by Linux-wireless wiki:
https://wireless.wiki.kernel.org/en/developers/documentation/submittingpatches#new_driver


Change log:
v3:
* Added missing sign-offs
* Fixed multiple warnings for memcpy overflow
* Fixed commit message and description of device-tree bindings

v2:
* Fixed build bug on non-ARM architectures
* Removed driver version
* Removed trivial debug traces
* Removed debug parameters for cc33xx module
* Fixed multiple type compatibility warnings
* Minor fixes
Link: https://lore.kernel.org/linux-wireless/20240609182102.2950457-1-michael.nemanov@ti.com/

v1:
* Added dt-bindings
* Removed debugfs to ease review
* Fix build issue with CONFIG_CFG80211_CERTIFICATION_ONUS
* Fix multiple build warnings found with Clang 18 and W=12
Link: https://lore.kernel.org/linux-wireless/20240521171841.884576-1-michael.nemanov@ti.com/


Test log:
https://0x0.st/XVBS.log

[1] It was considered implementing CC33xx as another user of wlcore but The
differences in HW, host interface, IRQ functionality, Rx/Tx behavior and supported features
were too significant so this was abandoned.

Michael Nemanov
Texas Instruments

Michael Nemanov (17):
  wifi: cc33xx: Add cc33xx.h, cc33xx_i.h
  wifi: cc33xx: Add debug.h
  wifi: cc33xx: Add sdio.c, io.c, io.h
  wifi: cc33xx: Add cmd.c, cmd.h
  wifi: cc33xx: Add acx.c, acx.h
  wifi: cc33xx: Add event.c, event.h
  wifi: cc33xx: Add boot.c, boot.h
  wifi: cc33xx: Add main.c
  wifi: cc33xx: Add rx.c, rx.h
  wifi: cc33xx: Add tx.c, tx.h
  wifi: cc33xx: Add init.c, init.h
  wifi: cc33xx: Add scan.c, scan.h
  wifi: cc33xx: Add conf.h
  wifi: cc33xx: Add ps.c, ps.h
  wifi: cc33xx: Add testmode.c, testmode.h
  wifi: cc33xx: Add Kconfig, Makefile
  dt-bindings: net: wireless: cc33xx: Add ti,cc33xx.yaml

 .../bindings/net/wireless/ti,cc33xx.yaml      |   56 +
 drivers/net/wireless/ti/Kconfig               |    1 +
 drivers/net/wireless/ti/Makefile              |    1 +
 drivers/net/wireless/ti/cc33xx/Kconfig        |   24 +
 drivers/net/wireless/ti/cc33xx/Makefile       |   10 +
 drivers/net/wireless/ti/cc33xx/acx.c          | 1011 +++
 drivers/net/wireless/ti/cc33xx/acx.h          |  835 +++
 drivers/net/wireless/ti/cc33xx/boot.c         |  363 +
 drivers/net/wireless/ti/cc33xx/boot.h         |   24 +
 drivers/net/wireless/ti/cc33xx/cc33xx.h       |  483 ++
 drivers/net/wireless/ti/cc33xx/cc33xx_i.h     |  459 ++
 drivers/net/wireless/ti/cc33xx/cmd.c          | 2030 ++++++
 drivers/net/wireless/ti/cc33xx/cmd.h          |  700 ++
 drivers/net/wireless/ti/cc33xx/conf.h         | 1246 ++++
 drivers/net/wireless/ti/cc33xx/debug.h        |   92 +
 drivers/net/wireless/ti/cc33xx/event.c        |  385 ++
 drivers/net/wireless/ti/cc33xx/event.h        |   71 +
 drivers/net/wireless/ti/cc33xx/init.c         |  232 +
 drivers/net/wireless/ti/cc33xx/init.h         |   15 +
 drivers/net/wireless/ti/cc33xx/io.c           |  131 +
 drivers/net/wireless/ti/cc33xx/io.h           |   26 +
 drivers/net/wireless/ti/cc33xx/main.c         | 5853 +++++++++++++++++
 drivers/net/wireless/ti/cc33xx/ps.c           |  117 +
 drivers/net/wireless/ti/cc33xx/ps.h           |   16 +
 drivers/net/wireless/ti/cc33xx/rx.c           |  393 ++
 drivers/net/wireless/ti/cc33xx/rx.h           |   86 +
 drivers/net/wireless/ti/cc33xx/scan.c         |  750 +++
 drivers/net/wireless/ti/cc33xx/scan.h         |  363 +
 drivers/net/wireless/ti/cc33xx/sdio.c         |  584 ++
 drivers/net/wireless/ti/cc33xx/testmode.c     |  359 +
 drivers/net/wireless/ti/cc33xx/testmode.h     |   12 +
 drivers/net/wireless/ti/cc33xx/tx.c           | 1411 ++++
 drivers/net/wireless/ti/cc33xx/tx.h           |  160 +
 33 files changed, 18299 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/net/wireless/ti,cc33xx.yaml
 create mode 100644 drivers/net/wireless/ti/cc33xx/Kconfig
 create mode 100644 drivers/net/wireless/ti/cc33xx/Makefile
 create mode 100644 drivers/net/wireless/ti/cc33xx/acx.c
 create mode 100644 drivers/net/wireless/ti/cc33xx/acx.h
 create mode 100644 drivers/net/wireless/ti/cc33xx/boot.c
 create mode 100644 drivers/net/wireless/ti/cc33xx/boot.h
 create mode 100644 drivers/net/wireless/ti/cc33xx/cc33xx.h
 create mode 100644 drivers/net/wireless/ti/cc33xx/cc33xx_i.h
 create mode 100644 drivers/net/wireless/ti/cc33xx/cmd.c
 create mode 100644 drivers/net/wireless/ti/cc33xx/cmd.h
 create mode 100644 drivers/net/wireless/ti/cc33xx/conf.h
 create mode 100644 drivers/net/wireless/ti/cc33xx/debug.h
 create mode 100644 drivers/net/wireless/ti/cc33xx/event.c
 create mode 100644 drivers/net/wireless/ti/cc33xx/event.h
 create mode 100644 drivers/net/wireless/ti/cc33xx/init.c
 create mode 100644 drivers/net/wireless/ti/cc33xx/init.h
 create mode 100644 drivers/net/wireless/ti/cc33xx/io.c
 create mode 100644 drivers/net/wireless/ti/cc33xx/io.h
 create mode 100644 drivers/net/wireless/ti/cc33xx/main.c
 create mode 100644 drivers/net/wireless/ti/cc33xx/ps.c
 create mode 100644 drivers/net/wireless/ti/cc33xx/ps.h
 create mode 100644 drivers/net/wireless/ti/cc33xx/rx.c
 create mode 100644 drivers/net/wireless/ti/cc33xx/rx.h
 create mode 100644 drivers/net/wireless/ti/cc33xx/scan.c
 create mode 100644 drivers/net/wireless/ti/cc33xx/scan.h
 create mode 100644 drivers/net/wireless/ti/cc33xx/sdio.c
 create mode 100644 drivers/net/wireless/ti/cc33xx/testmode.c
 create mode 100644 drivers/net/wireless/ti/cc33xx/testmode.h
 create mode 100644 drivers/net/wireless/ti/cc33xx/tx.c
 create mode 100644 drivers/net/wireless/ti/cc33xx/tx.h

Comments

Krzysztof Kozlowski Aug. 7, 2024, 7:06 a.m. UTC | #1
On 06/08/2024 19:00, Michael Nemanov wrote:

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

> +properties:
> +  compatible:
> +    enum:
> +      - ti,cc3300
> +      - ti,cc3301
> +      - ti,cc3350
> +      - ti,cc3351
> +
> +  reg:
> +    description:
> +      must be set to 2

Then just const: 2 and drop free form text.

> +    maxItems: 1
> +
> +  interrupts:
> +    description:
> +      The out-of-band interrupt line.
> +      Can be IRQ_TYPE_EDGE_RISING or IRQ_TYPE_LEVEL_HIGH.
> +      If property is omitted, SDIO in-band IRQ will be used.
> +    maxItems: 1
> +
> +required:
> +  - compatible
> +  - reg
> +
> +additionalProperties: false
> +
> +examples:
> +  - |
> +    #include <dt-bindings/interrupt-controller/irq.h>
> +
> +    // SDIO example:

Drop, obvious.

> +    mmc {
> +        #address-cells = <1>;
> +        #size-cells = <0>;
> +
> +        wifi@1{

Missing space.

Also, this does not match reg. Test your DTS with W=1 and FIX ALL warnings.

Best regards,
Krzysztof
Krzysztof Kozlowski Aug. 7, 2024, 7:06 a.m. UTC | #2
On 06/08/2024 19:00, Michael Nemanov wrote:
> Add device-tree bindings for the CC33xx family.
> 
> Signed-off-by: Michael Nemanov <michael.nemanov@ti.com>
> ---
>  .../bindings/net/wireless/ti,cc33xx.yaml      | 56 +++++++++++++++++++

Also, bindings always come before users, but maybe the maintainers will
re-order things since you expect here some squashing.

Best regards,
Krzysztof
Krzysztof Kozlowski Aug. 7, 2024, 7:15 a.m. UTC | #3
On 06/08/2024 19:00, Michael Nemanov wrote:
> These file contain various WLAN-oriented APIs
> 
> Signed-off-by: Michael Nemanov <michael.nemanov@ti.com>
> ---
>  drivers/net/wireless/ti/cc33xx/acx.c | 1011 ++++++++++++++++++++++++++
>  drivers/net/wireless/ti/cc33xx/acx.h |  835 +++++++++++++++++++++
>  2 files changed, 1846 insertions(+)
>  create mode 100644 drivers/net/wireless/ti/cc33xx/acx.c
>  create mode 100644 drivers/net/wireless/ti/cc33xx/acx.h
> 
> diff --git a/drivers/net/wireless/ti/cc33xx/acx.c b/drivers/net/wireless/ti/cc33xx/acx.c
> new file mode 100644
> index 000000000000..3c9b590e69b1
> --- /dev/null
> +++ b/drivers/net/wireless/ti/cc33xx/acx.c
> @@ -0,0 +1,1011 @@
> +// SPDX-License-Identifier: GPL-2.0-only
> +/*
> + * Copyright (C) 2022-2024 Texas Instruments Incorporated - https://www.ti.com/
> + */
> +
> +#include "acx.h"
> +
> +int cc33xx_acx_clear_statistics(struct cc33xx *cc)
> +{
> +	struct acx_header *acx;
> +	int ret = 0;
> +
> +	cc33xx_debug(DEBUG_ACX, "acx clear statistics");

So you just re-implemented tracing.

No, I asked to drop such silly entry/exit messages because you duplicate
existing mechanisms in the kernel.

That's a no everywhere. Do not write such code. You can have useful
debug statements when tracing or kprobes or whatever you want is not
sufficient.

Best regards,
Krzysztof
Nemanov, Michael Aug. 7, 2024, 3:51 p.m. UTC | #4
On 8/7/2024 10:06 AM, Krzysztof Kozlowski wrote:
> On 06/08/2024 19:00, Michael Nemanov wrote:
> 
> Thank you for your patch. There is something to discuss/improve.
> 
>> +properties:
>> +  compatible:
>> +    enum:
>> +      - ti,cc3300
>> +      - ti,cc3301
>> +      - ti,cc3350
>> +      - ti,cc3351
>> +
>> +  reg:
>> +    description:
>> +      must be set to 2
> 
> Then just const: 2 and drop free form text.
> 
>> +    maxItems: 1
>> +
>> +  interrupts:
>> +    description:
>> +      The out-of-band interrupt line.
>> +      Can be IRQ_TYPE_EDGE_RISING or IRQ_TYPE_LEVEL_HIGH.
>> +      If property is omitted, SDIO in-band IRQ will be used.
>> +    maxItems: 1
>> +
>> +required:
>> +  - compatible
>> +  - reg
>> +
>> +additionalProperties: false
>> +
>> +examples:
>> +  - |
>> +    #include <dt-bindings/interrupt-controller/irq.h>
>> +
>> +    // SDIO example:
> 
> Drop, obvious.
> 
>> +    mmc {
>> +        #address-cells = <1>;
>> +        #size-cells = <0>;
>> +
>> +        wifi@1{
> 
> Missing space.
> 
> Also, this does not match reg. Test your DTS with W=1 and FIX ALL warnings.
> 
> Best regards,
> Krzysztof
> 

Will fix all above.

I'm currently testing my .yaml with:
make dt_binding_check DT_CHECKER_FLAGS=-m \ 
DT_SCHEMA_FILES=Documentation/devicetree/bindings/net/wireless/ti,cc33xx.yaml

It reports no warnings. Adding W=1 doesn't seem to change anything. Am I 
missing something?

Thanks and regards,
Michael.
Nemanov, Michael Aug. 7, 2024, 3:53 p.m. UTC | #5
On 8/7/2024 10:06 AM, Krzysztof Kozlowski wrote:
> On 06/08/2024 19:00, Michael Nemanov wrote:
>> Add device-tree bindings for the CC33xx family.
>>
>> Signed-off-by: Michael Nemanov <michael.nemanov@ti.com>
>> ---
>>   .../bindings/net/wireless/ti,cc33xx.yaml      | 56 +++++++++++++++++++
> 
> Also, bindings always come before users, but maybe the maintainers will
> re-order things since you expect here some squashing.
> 
> Best regards,
> Krzysztof
> 

Will hoist the bindings to be 1st.

Thanks and regards,
Michael.
Nemanov, Michael Aug. 7, 2024, 4:09 p.m. UTC | #6
On 8/7/2024 10:15 AM, Krzysztof Kozlowski wrote:
> On 06/08/2024 19:00, Michael Nemanov wrote:
>> These file contain various WLAN-oriented APIs
>>
>> Signed-off-by: Michael Nemanov <michael.nemanov@ti.com>
>> ---
>>   drivers/net/wireless/ti/cc33xx/acx.c | 1011 ++++++++++++++++++++++++++
>>   drivers/net/wireless/ti/cc33xx/acx.h |  835 +++++++++++++++++++++
>>   2 files changed, 1846 insertions(+)
>>   create mode 100644 drivers/net/wireless/ti/cc33xx/acx.c
>>   create mode 100644 drivers/net/wireless/ti/cc33xx/acx.h
>>
>> diff --git a/drivers/net/wireless/ti/cc33xx/acx.c b/drivers/net/wireless/ti/cc33xx/acx.c
>> new file mode 100644
>> index 000000000000..3c9b590e69b1
>> --- /dev/null
>> +++ b/drivers/net/wireless/ti/cc33xx/acx.c
>> @@ -0,0 +1,1011 @@
>> +// SPDX-License-Identifier: GPL-2.0-only
>> +/*
>> + * Copyright (C) 2022-2024 Texas Instruments Incorporated - https://www.ti.com/
>> + */
>> +
>> +#include "acx.h"
>> +
>> +int cc33xx_acx_clear_statistics(struct cc33xx *cc)
>> +{
>> +	struct acx_header *acx;
>> +	int ret = 0;
>> +
>> +	cc33xx_debug(DEBUG_ACX, "acx clear statistics");
> 
> So you just re-implemented tracing.
> 
> No, I asked to drop such silly entry/exit messages because you duplicate
> existing mechanisms in the kernel.
> 
> That's a no everywhere. Do not write such code. You can have useful
> debug statements when tracing or kprobes or whatever you want is not
> sufficient.
> 
> Best regards,
> Krzysztof
> 

OK, I misunderstood the previous exchange with you and Kalle Valo. I'll 
remove all entry / exit cc33xx_debug traces. Non-trivial ones are OK 
tough, right?

Thanks and regards,
Michael.
Krzysztof Kozlowski Aug. 8, 2024, 7:45 a.m. UTC | #7
On 07/08/2024 17:51, Nemanov, Michael wrote:
> On 8/7/2024 10:06 AM, Krzysztof Kozlowski wrote:
>> On 06/08/2024 19:00, Michael Nemanov wrote:
>>
>> Thank you for your patch. There is something to discuss/improve.
>>
>>> +properties:
>>> +  compatible:
>>> +    enum:
>>> +      - ti,cc3300
>>> +      - ti,cc3301
>>> +      - ti,cc3350
>>> +      - ti,cc3351
>>> +
>>> +  reg:
>>> +    description:
>>> +      must be set to 2
>>
>> Then just const: 2 and drop free form text.
>>
>>> +    maxItems: 1
>>> +
>>> +  interrupts:
>>> +    description:
>>> +      The out-of-band interrupt line.
>>> +      Can be IRQ_TYPE_EDGE_RISING or IRQ_TYPE_LEVEL_HIGH.
>>> +      If property is omitted, SDIO in-band IRQ will be used.
>>> +    maxItems: 1
>>> +
>>> +required:
>>> +  - compatible
>>> +  - reg
>>> +
>>> +additionalProperties: false
>>> +
>>> +examples:
>>> +  - |
>>> +    #include <dt-bindings/interrupt-controller/irq.h>
>>> +
>>> +    // SDIO example:
>>
>> Drop, obvious.
>>
>>> +    mmc {
>>> +        #address-cells = <1>;
>>> +        #size-cells = <0>;
>>> +
>>> +        wifi@1{
>>
>> Missing space.
>>
>> Also, this does not match reg. Test your DTS with W=1 and FIX ALL warnings.
>>
>> Best regards,
>> Krzysztof
>>
> 
> Will fix all above.
> 
> I'm currently testing my .yaml with:
> make dt_binding_check DT_CHECKER_FLAGS=-m \ 
> DT_SCHEMA_FILES=Documentation/devicetree/bindings/net/wireless/ti,cc33xx.yaml
> 
> It reports no warnings. Adding W=1 doesn't seem to change anything. Am I 
> missing something?

I said test your DTS, not bindings.

Best regards,
Krzysztof