mbox series

[v4,00/24] wfx: get out from the staging area

Message ID 20201223153925.73742-1-Jerome.Pouiller@silabs.com
Headers show
Series wfx: get out from the staging area | expand

Message

Jérôme Pouiller Dec. 23, 2020, 3:39 p.m. UTC
From: Jérôme Pouiller <jerome.pouiller@silabs.com>

I think the wfx driver is now mature enough to be accepted in the
drivers/net/wireless directory.

The firmware associated with this driver is available here[1]. It is not yet
available in linux-firmware, but I am working on the PR.

[1]: https://github.com/SiliconLabs/wfx-firmware

As requested by Kalle[2], I send one file per patch. At the end, all the
patches (or at least the patches 3 to 24) will be squashed (therefore, I
didn't bother to write real commit messages).

[2]: https://lore.kernel.org/lkml/87ft6p2n0h.fsf@codeaurora.org/

Here is a diagram of the global architecture that may help to understand
the code:

    ,------------------------------------.
    |                mac80211            |
    `------------------------------------'
    ,------------+-----------+-----------.
    |    sta     |           |           |
    |    scan    |           |           |
    |    main    |           |           |
    +------------+  data_tx  |           |
    |    key     |           |  data_rx  |
    | hif_tx_mib |   queue   |           |
    |   hif_tx   |           |           |
    |   hif_rx   |           |           |
    |  hif_api_* |           |           |
    +------------+-----------+-----------+--------.
    |                  bh                |  fwio  |
    +------------------------------------+--------+
    |                     hwio                    |
    +---------------------------------------------+
    |                   bus_sdio                  |
    |                   bus_spi                   |
    `---------------------------------------------'
    ,---------------------------------------------.
    |                  spi / sdio                 |
    `---------------------------------------------'

Roughly, I have sent the files from the bottom to the top.


Below the differences with the files from drivers/staging/wfx/:

v4:
  - Rebase on last staging tree
  - Add 'additionalProperties: false' to the DT specification (I have made
    that change blindly because I am able to reproduce the Rob's error)
    (Rob)
  - Replace C++ comments with Ansi C comments (Kalle)
  - Check that existing Ansi C comments comply with net/ "compact" style
  - Drop one obsolete comment
  - Remove comments after '#endif' in header files
  - Remove macro redefinitions in hif_api_general.h (Kalle)
  - Replace compiletime_assert() with BUILD_BUG_ON_MSG() (Kalle)
  - Rename ieee80211_is_action_back() (Kalle)
  - Add a comment explaining how the PDS isent to the device (Kalle)
  - Add a comment about case where CONFIG_MMC==m in the Makefile (Kalle)
  - Fix irrelevant comment about CONFIG_VMAP_STACK (Kalle)
  - Talk about the unreliable SDIO Vendor ID in the Kconfig help (Kalle)
  - Mention the firmware status in the cover letter (Kalle)
  - Fix misaligned function arguments in key.c

v3:
  - dt-bindings: Rename config-file property (Rob)
  - dt-bindings: No additional properties are allowed (spi-max-frequency is
    already listed) (Rob)
  - dt-bindings: Remove references for mac-address properties (Rob)
  - Rebase on staging/staging-next

v2:
  - dt-bindings: Improve device description and add link to the datasheet
      (Rob)
  - dt-bindings: Add blank lines between each DT property (Rob)
  - dt-bindings: Explicitly mention mac-address and local-mac-address and
      add references to ethernet-controller.yaml (Rob)
  - dt-bindings: "config-file" is not for development/debug (Rob)
  - dt-bindings: Remove description of "spi-max-frequency" (Rob)
  - dt-bindings: Use "folded scalar" syntax instead of escaping the colons
  - bus_sdio.c: A compatible node in the DT is now mandatory to probe the
      device. Also change documentation of dt-bindings accordingly (Pali,
      Ulf)
  - bus_sdio.c: Move SDIO IDs to sdio_ids.h (Pali)
  - bh.c: Import patch "staging: wfx: fix test on return value of
      gpiod_get_value()" (Nathan)
  - data_tx.c: Import patch "staging: wfx: fix use of uninitialized
      pointer"
  - sta.c: Import patch "staging: wfx: make a const array static, makes
      object smaller" (Colin)

v1:
  - Drop the function name in the warning message (Kalle)
  - Replace goto by return in wfx_send_pdata_pds() (Kalle, Dan)
  - Improve error label in wfx_send_pdata_pds() (Kalle)


Jérôme Pouiller (24):
  mmc: sdio: add SDIO IDs for Silabs WF200 chip
  dt-bindings: introduce silabs,wfx.yaml
  wfx: add Makefile/Kconfig
  wfx: add wfx.h
  wfx: add main.c/main.h
  wfx: add bus.h
  wfx: add bus_spi.c
  wfx: add bus_sdio.c
  wfx: add hwio.c/hwio.h
  wfx: add fwio.c/fwio.h
  wfx: add bh.c/bh.h
  wfx: add hif_api_*.h
  wfx: add hif_tx*.c/hif_tx*.h
  wfx: add key.c/key.h
  wfx: add hif_rx.c/hif_rx.h
  wfx: add data_rx.c/data_rx.h
  wfx: add queue.c/queue.h
  wfx: add data_tx.c/data_tx.h
  wfx: add sta.c/sta.h
  wfx: add scan.c/scan.h
  wfx: add debug.c/debug.h
  wfx: add traces.h
  wfx: remove from the staging area
  wfx: get out from the staging area

 .../bindings/net/wireless/silabs,wfx.yaml     | 68 +++++++++-------
 MAINTAINERS                                   |  3 +-
 drivers/net/wireless/Kconfig                  |  1 +
 drivers/net/wireless/Makefile                 |  1 +
 drivers/net/wireless/silabs/Kconfig           | 18 +++++
 drivers/net/wireless/silabs/Makefile          |  3 +
 .../wireless/silabs}/wfx/Kconfig              |  4 +
 .../wireless/silabs}/wfx/Makefile             |  1 +
 .../{staging => net/wireless/silabs}/wfx/bh.c | 31 ++++----
 .../{staging => net/wireless/silabs}/wfx/bh.h |  2 +-
 .../wireless/silabs}/wfx/bus.h                |  0
 .../wireless/silabs}/wfx/bus_sdio.c           | 23 ++----
 .../wireless/silabs}/wfx/bus_spi.c            | 18 ++---
 .../wireless/silabs}/wfx/data_rx.c            |  5 +-
 .../wireless/silabs}/wfx/data_rx.h            |  2 +-
 .../wireless/silabs}/wfx/data_tx.c            | 65 +++++++++-------
 .../wireless/silabs}/wfx/data_tx.h            |  4 +-
 .../wireless/silabs}/wfx/debug.c              | 12 +--
 .../wireless/silabs}/wfx/debug.h              |  2 +-
 .../wireless/silabs}/wfx/fwio.c               | 26 +++----
 .../wireless/silabs}/wfx/fwio.h               |  2 +-
 .../wireless/silabs}/wfx/hif_api_cmd.h        | 12 +--
 .../wireless/silabs}/wfx/hif_api_general.h    | 23 +++---
 .../wireless/silabs}/wfx/hif_api_mib.h        |  2 +-
 .../wireless/silabs}/wfx/hif_rx.c             | 17 ++--
 .../wireless/silabs}/wfx/hif_rx.h             |  0
 .../wireless/silabs}/wfx/hif_tx.c             | 32 ++++----
 .../wireless/silabs}/wfx/hif_tx.h             |  0
 .../wireless/silabs}/wfx/hif_tx_mib.c         |  4 +-
 .../wireless/silabs}/wfx/hif_tx_mib.h         |  0
 .../wireless/silabs}/wfx/hwio.c               | 18 +----
 .../wireless/silabs}/wfx/hwio.h               | 22 +++---
 .../wireless/silabs}/wfx/key.c                | 30 +++----
 .../wireless/silabs}/wfx/key.h                |  2 +-
 .../wireless/silabs}/wfx/main.c               | 37 ++++++---
 .../wireless/silabs}/wfx/main.h               |  3 +-
 .../wireless/silabs}/wfx/queue.c              | 27 ++++---
 .../wireless/silabs}/wfx/queue.h              |  4 +-
 .../wireless/silabs}/wfx/scan.c               |  3 +-
 .../wireless/silabs}/wfx/scan.h               |  2 +-
 .../wireless/silabs}/wfx/sta.c                | 78 ++++++++++---------
 .../wireless/silabs}/wfx/sta.h                |  8 +-
 .../wireless/silabs}/wfx/traces.h             |  2 +-
 .../wireless/silabs}/wfx/wfx.h                |  4 +-
 drivers/staging/Kconfig                       |  2 -
 drivers/staging/Makefile                      |  1 -
 drivers/staging/wfx/TODO                      |  6 --
 include/linux/mmc/sdio_ids.h                  |  7 ++
 48 files changed, 339 insertions(+), 298 deletions(-)
 rename {drivers/staging/wfx/Documentation => Documentation}/devicetree/bindings/net/wireless/silabs,wfx.yaml (71%)
 create mode 100644 drivers/net/wireless/silabs/Kconfig
 create mode 100644 drivers/net/wireless/silabs/Makefile
 rename drivers/{staging => net/wireless/silabs}/wfx/Kconfig (65%)
 rename drivers/{staging => net/wireless/silabs}/wfx/Makefile (85%)
 rename drivers/{staging => net/wireless/silabs}/wfx/bh.c (93%)
 rename drivers/{staging => net/wireless/silabs}/wfx/bh.h (97%)
 rename drivers/{staging => net/wireless/silabs}/wfx/bus.h (100%)
 rename drivers/{staging => net/wireless/silabs}/wfx/bus_sdio.c (89%)
 rename drivers/{staging => net/wireless/silabs}/wfx/bus_spi.c (94%)
 rename drivers/{staging => net/wireless/silabs}/wfx/data_rx.c (95%)
 rename drivers/{staging => net/wireless/silabs}/wfx/data_rx.h (93%)
 rename drivers/{staging => net/wireless/silabs}/wfx/data_tx.c (91%)
 rename drivers/{staging => net/wireless/silabs}/wfx/data_tx.h (94%)
 rename drivers/{staging => net/wireless/silabs}/wfx/debug.c (96%)
 rename drivers/{staging => net/wireless/silabs}/wfx/debug.h (94%)
 rename drivers/{staging => net/wireless/silabs}/wfx/fwio.c (95%)
 rename drivers/{staging => net/wireless/silabs}/wfx/fwio.h (91%)
 rename drivers/{staging => net/wireless/silabs}/wfx/hif_api_cmd.h (97%)
 rename drivers/{staging => net/wireless/silabs}/wfx/hif_api_general.h (93%)
 rename drivers/{staging => net/wireless/silabs}/wfx/hif_api_mib.h (99%)
 rename drivers/{staging => net/wireless/silabs}/wfx/hif_rx.c (96%)
 rename drivers/{staging => net/wireless/silabs}/wfx/hif_rx.h (100%)
 rename drivers/{staging => net/wireless/silabs}/wfx/hif_tx.c (95%)
 rename drivers/{staging => net/wireless/silabs}/wfx/hif_tx.h (100%)
 rename drivers/{staging => net/wireless/silabs}/wfx/hif_tx_mib.c (98%)
 rename drivers/{staging => net/wireless/silabs}/wfx/hif_tx_mib.h (100%)
 rename drivers/{staging => net/wireless/silabs}/wfx/hwio.c (93%)
 rename drivers/{staging => net/wireless/silabs}/wfx/hwio.h (77%)
 rename drivers/{staging => net/wireless/silabs}/wfx/key.c (91%)
 rename drivers/{staging => net/wireless/silabs}/wfx/key.h (94%)
 rename drivers/{staging => net/wireless/silabs}/wfx/main.c (92%)
 rename drivers/{staging => net/wireless/silabs}/wfx/main.h (94%)
 rename drivers/{staging => net/wireless/silabs}/wfx/queue.c (92%)
 rename drivers/{staging => net/wireless/silabs}/wfx/queue.h (94%)
 rename drivers/{staging => net/wireless/silabs}/wfx/scan.c (98%)
 rename drivers/{staging => net/wireless/silabs}/wfx/scan.h (95%)
 rename drivers/{staging => net/wireless/silabs}/wfx/sta.c (91%)
 rename drivers/{staging => net/wireless/silabs}/wfx/sta.h (97%)
 rename drivers/{staging => net/wireless/silabs}/wfx/traces.h (99%)
 rename drivers/{staging => net/wireless/silabs}/wfx/wfx.h (97%)
 delete mode 100644 drivers/staging/wfx/TODO

Comments

Rob Herring (Arm) Jan. 8, 2021, 2:28 a.m. UTC | #1
On Wed, Dec 23, 2020 at 04:39:03PM +0100, Jerome Pouiller wrote:
> From: Jérôme Pouiller <jerome.pouiller@silabs.com>

Commit message?

checkpatch.pl reports trailing whitespace errors.

> 
> Signed-off-by: Jérôme Pouiller <jerome.pouiller@silabs.com>
> ---
>  .../bindings/net/wireless/silabs,wfx.yaml     | 133 ++++++++++++++++++
>  1 file changed, 133 insertions(+)
>  create mode 100644 Documentation/devicetree/bindings/net/wireless/silabs,wfx.yaml
> 
> diff --git a/Documentation/devicetree/bindings/net/wireless/silabs,wfx.yaml b/Documentation/devicetree/bindings/net/wireless/silabs,wfx.yaml
> new file mode 100644
> index 000000000000..487d46c5fdc0
> --- /dev/null
> +++ b/Documentation/devicetree/bindings/net/wireless/silabs,wfx.yaml
> @@ -0,0 +1,133 @@
> +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
> +# Copyright (c) 2020, Silicon Laboratories, Inc.
> +%YAML 1.2
> +---
> +
> +$id: http://devicetree.org/schemas/net/wireless/silabs,wfx.yaml#
> +$schema: http://devicetree.org/meta-schemas/core.yaml#
> +
> +title: Silicon Labs WFxxx devicetree bindings
> +
> +maintainers:
> +  - Jérôme Pouiller <jerome.pouiller@silabs.com>
> +
> +description: >
> +  Support for the Wifi chip WFxxx from Silicon Labs. Currently, the only device
> +  from the WFxxx series is the WF200 described here:
> +     https://www.silabs.com/documents/public/data-sheets/wf200-datasheet.pdf
> +  
> +  The WF200 can be connected via SPI or via SDIO.
> +  
> +  For SDIO:
> +  
> +    Declaring the WFxxx chip in device tree is mandatory (usually, the VID/PID is
> +    sufficient for the SDIO devices).
> +  
> +    It is recommended to declare a mmc-pwrseq on SDIO host above WFx. Without
> +    it, you may encounter issues during reboot. The mmc-pwrseq should be
> +    compatible with mmc-pwrseq-simple. Please consult
> +    Documentation/devicetree/bindings/mmc/mmc-pwrseq-simple.txt for more
> +    information.
> +  
> +  For SPI:
> +  
> +    In add of the properties below, please consult
> +    Documentation/devicetree/bindings/spi/spi-controller.yaml for optional SPI
> +    related properties.
> +
> +properties:
> +  compatible:
> +    const: silabs,wf200
> +
> +  reg:
> +    description:
> +      When used on SDIO bus, <reg> must be set to 1. When used on SPI bus, it is
> +      the chip select address of the device as defined in the SPI devices
> +      bindings.
> +    maxItems: 1
> +
> +  spi-max-frequency: true
> +
> +  interrupts:
> +    description: The interrupt line. Triggers IRQ_TYPE_LEVEL_HIGH and
> +      IRQ_TYPE_EDGE_RISING are both supported by the chip and the driver. When
> +      SPI is used, this property is required. When SDIO is used, the "in-band"
> +      interrupt provided by the SDIO bus is used unless an interrupt is defined
> +      in the Device Tree.
> +    maxItems: 1
> +
> +  reset-gpios:
> +    description: (SPI only) Phandle of gpio that will be used to reset chip
> +      during probe. Without this property, you may encounter issues with warm
> +      boot. (For legacy purpose, the gpio in inverted when compatible ==
> +      "silabs,wfx-spi")
> +
> +      For SDIO, the reset gpio should declared using a mmc-pwrseq.
> +    maxItems: 1
> +
> +  wakeup-gpios:
> +    description: Phandle of gpio that will be used to wake-up chip. Without this
> +      property, driver will disable most of power saving features.
> +    maxItems: 1
> +
> +  silabs,antenna-config-file:
> +    $ref: /schemas/types.yaml#/definitions/string
> +    description: Use an alternative file for antenna configuration (aka
> +      "Platform Data Set" in Silabs jargon). Default is 'wf200.pds'.
> +
> +  local-mac-address: true
> +
> +  mac-address: true
> +
> +additionalProperties: false
> +
> +required:
> +  - compatible
> +  - reg
> +
> +examples:
> +  - |
> +    #include <dt-bindings/gpio/gpio.h>
> +    #include <dt-bindings/interrupt-controller/irq.h>
> +
> +    spi0 {
> +        #address-cells = <1>;
> +        #size-cells = <0>;
> +
> +        wifi@0 {
> +            compatible = "silabs,wf200";
> +            pinctrl-names = "default";
> +            pinctrl-0 = <&wfx_irq &wfx_gpios>;
> +            reg = <0>;
> +            interrupts-extended = <&gpio 16 IRQ_TYPE_EDGE_RISING>;
> +            wakeup-gpios = <&gpio 12 GPIO_ACTIVE_HIGH>;
> +            reset-gpios = <&gpio 13 GPIO_ACTIVE_LOW>;
> +            spi-max-frequency = <42000000>;
> +        };
> +    };
> +
> +  - |
> +    #include <dt-bindings/gpio/gpio.h>
> +    #include <dt-bindings/interrupt-controller/irq.h>
> +
> +    wfx_pwrseq: wfx_pwrseq {
> +        compatible = "mmc-pwrseq-simple";
> +        pinctrl-names = "default";
> +        pinctrl-0 = <&wfx_reset>;
> +        reset-gpios = <&gpio 13 GPIO_ACTIVE_LOW>;
> +    };
> +
> +    mmc0 {
> +        mmc-pwrseq = <&wfx_pwrseq>;
> +        #address-cells = <1>;
> +        #size-cells = <0>;
> +
> +        wifi@1 {
> +            compatible = "silabs,wf200";
> +            pinctrl-names = "default";
> +            pinctrl-0 = <&wfx_wakeup>;
> +            reg = <1>;
> +            wakeup-gpios = <&gpio 12 GPIO_ACTIVE_HIGH>;
> +        };
> +    };
> +...
> -- 
> 2.29.2
>