Re: [PATCH v9 05/24] wfx: add main.c/main.h

2022-02-10 Thread Kalle Valo
Jérôme Pouiller  writes:

>> > There is also the patch 01/24 about the SDIO IDs.
>> >
>> > I think the v10 could contain only 3 patches:
>> >
>> > 1. mmc: sdio: add SDIO IDs for Silabs WF200 chip
>> > 2. dt-bindings: introduce silabs,wfx.yaml
>> > 3. [all the patches 3 to 24 squashed]
>> >
>> > Would it be right for you?
>> 
>> TBH I don't see the point of patch 3 at this moment, we have had so many
>> iterations with the full driver already. If people want to look at the
>> driver, they can check it from the staging tree. So in the next round I
>> recommend submitting only patches 1 and 2 and focus on getting all the
>> pending patches to staging tree.
>
> Ok.
>
>> And the chances are that a big patch like that would be filtered by the
>> mailing lists anyway.
>
> I believe that with -M, the patch would be very small.

Ah, you mean patch 3 would be about moving wfx from drivers/staging to
drivers/net/wireless? Yeah, with -M that would be a good idea.

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

https://wireless.wiki.kernel.org/en/developers/documentation/submittingpatches
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [PATCH v9 05/24] wfx: add main.c/main.h

2022-02-10 Thread Jérôme Pouiller
On Thursday 10 February 2022 17:25:05 CET Kalle Valo wrote:
> Jérôme Pouiller  writes:
> 
> > On Thursday 10 February 2022 15:51:03 CET Kalle Valo wrote:
> >> Jérôme Pouiller  writes:
> >> > On Thursday 10 February 2022 15:20:56 CET Kalle Valo wrote:
> >> >> Jérôme Pouiller  writes:
> >> >>
> >> >> > Kalle, is this function what you expected? If it is right for you, I 
> >> >> > am
> >> >> > going to send it to the staging tree.
> >> >>
> >> >> Looks better, but I don't get why '{' and '}' are still needed. Ah, does
> >> >> the firmware require to have them?
> >> >
> >> > Indeed. If '{' and '}' are not present, I guarantee the firmware will 
> >> > return
> >> > an error (or assert). However, I am more confident in the driver than in 
> >> > the
> >> > firmware to report errors to the user.
> >>
> >> Agreed.
> >>
> >> > If there is no other comment, I am going to:
> >> >   - submit this change to the staging tree
> >>
> >> Good, it's important that you get all your changes to the staging tree
> >> before the next merge window.
> >>
> >> >   - publish the tool that generate this new format
> >> >   - submit the PDS files referenced in bus_{sdio,spi}.c to linux-firmware
> >> >   - send the v10 of this PR
> >>
> >> I'm not sure if there's a need to send a full patchset anymore? We are
> >> so close now anyway and the full driver is available from the staging
> >> tree, at least that's what I will use from now on when reviewing wfx.
> >>
> >> What about the Device Tree bindings? That needs to be acked by the DT
> >> maintainers, so that's good to submit as a separate patch for review.
> >
> > There is also the patch 01/24 about the SDIO IDs.
> >
> > I think the v10 could contain only 3 patches:
> >
> > 1. mmc: sdio: add SDIO IDs for Silabs WF200 chip
> > 2. dt-bindings: introduce silabs,wfx.yaml
> > 3. [all the patches 3 to 24 squashed]
> >
> > Would it be right for you?
> 
> TBH I don't see the point of patch 3 at this moment, we have had so many
> iterations with the full driver already. If people want to look at the
> driver, they can check it from the staging tree. So in the next round I
> recommend submitting only patches 1 and 2 and focus on getting all the
> pending patches to staging tree.

Ok.

> And the chances are that a big patch like that would be filtered by the
> mailing lists anyway.

I believe that with -M, the patch would be very small.

-- 
Jérôme Pouiller


___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [PATCH v9 05/24] wfx: add main.c/main.h

2022-02-10 Thread Kalle Valo
Jérôme Pouiller  writes:

> On Thursday 10 February 2022 15:51:03 CET Kalle Valo wrote:
>> Jérôme Pouiller  writes:
>> > On Thursday 10 February 2022 15:20:56 CET Kalle Valo wrote:
>> >> Jérôme Pouiller  writes:
>> >>
>> >> > Kalle, is this function what you expected? If it is right for you, I am
>> >> > going to send it to the staging tree.
>> >>
>> >> Looks better, but I don't get why '{' and '}' are still needed. Ah, does
>> >> the firmware require to have them?
>> >
>> > Indeed. If '{' and '}' are not present, I guarantee the firmware will 
>> > return
>> > an error (or assert). However, I am more confident in the driver than in 
>> > the
>> > firmware to report errors to the user.
>> 
>> Agreed.
>> 
>> > If there is no other comment, I am going to:
>> >   - submit this change to the staging tree
>> 
>> Good, it's important that you get all your changes to the staging tree
>> before the next merge window.
>> 
>> >   - publish the tool that generate this new format
>> >   - submit the PDS files referenced in bus_{sdio,spi}.c to linux-firmware
>> >   - send the v10 of this PR
>> 
>> I'm not sure if there's a need to send a full patchset anymore? We are
>> so close now anyway and the full driver is available from the staging
>> tree, at least that's what I will use from now on when reviewing wfx.
>> 
>> What about the Device Tree bindings? That needs to be acked by the DT
>> maintainers, so that's good to submit as a separate patch for review.
>
> There is also the patch 01/24 about the SDIO IDs.
>
> I think the v10 could contain only 3 patches:
>
> 1. mmc: sdio: add SDIO IDs for Silabs WF200 chip
> 2. dt-bindings: introduce silabs,wfx.yaml
> 3. [all the patches 3 to 24 squashed]
>
> Would it be right for you?

TBH I don't see the point of patch 3 at this moment, we have had so many
iterations with the full driver already. If people want to look at the
driver, they can check it from the staging tree. So in the next round I
recommend submitting only patches 1 and 2 and focus on getting all the
pending patches to staging tree.

And the chances are that a big patch like that would be filtered by the
mailing lists anyway.

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

https://wireless.wiki.kernel.org/en/developers/documentation/submittingpatches
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [PATCH v9 05/24] wfx: add main.c/main.h

2022-02-10 Thread Jérôme Pouiller
On Thursday 10 February 2022 15:51:03 CET Kalle Valo wrote:
> Jérôme Pouiller  writes:
> > On Thursday 10 February 2022 15:20:56 CET Kalle Valo wrote:
> >> Jérôme Pouiller  writes:
> >>
> >> > Kalle, is this function what you expected? If it is right for you, I am
> >> > going to send it to the staging tree.
> >>
> >> Looks better, but I don't get why '{' and '}' are still needed. Ah, does
> >> the firmware require to have them?
> >
> > Indeed. If '{' and '}' are not present, I guarantee the firmware will return
> > an error (or assert). However, I am more confident in the driver than in the
> > firmware to report errors to the user.
> 
> Agreed.
> 
> > If there is no other comment, I am going to:
> >   - submit this change to the staging tree
> 
> Good, it's important that you get all your changes to the staging tree
> before the next merge window.
> 
> >   - publish the tool that generate this new format
> >   - submit the PDS files referenced in bus_{sdio,spi}.c to linux-firmware
> >   - send the v10 of this PR
> 
> I'm not sure if there's a need to send a full patchset anymore? We are
> so close now anyway and the full driver is available from the staging
> tree, at least that's what I will use from now on when reviewing wfx.
> 
> What about the Device Tree bindings? That needs to be acked by the DT
> maintainers, so that's good to submit as a separate patch for review.

There is also the patch 01/24 about the SDIO IDs.

I think the v10 could contain only 3 patches:

1. mmc: sdio: add SDIO IDs for Silabs WF200 chip
2. dt-bindings: introduce silabs,wfx.yaml
3. [all the patches 3 to 24 squashed]

Would it be right for you?

-- 
Jérôme Pouiller


___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [PATCH v9 05/24] wfx: add main.c/main.h

2022-02-10 Thread Kalle Valo
Jérôme Pouiller  writes:

> On Thursday 10 February 2022 15:20:56 CET Kalle Valo wrote:
>> 
>> Jérôme Pouiller  writes:
>> 
>> > Kalle, is this function what you expected? If it is right for you, I am
>> > going to send it to the staging tree.
>> 
>> Looks better, but I don't get why '{' and '}' are still needed. Ah, does
>> the firmware require to have them?
>
> Indeed. If '{' and '}' are not present, I guarantee the firmware will return
> an error (or assert). However, I am more confident in the driver than in the
> firmware to report errors to the user.

Agreed.

> If there is no other comment, I am going to:
>   - submit this change to the staging tree

Good, it's important that you get all your changes to the staging tree
before the next merge window.

>   - publish the tool that generate this new format
>   - submit the PDS files referenced in bus_{sdio,spi}.c to linux-firmware
>   - send the v10 of this PR

I'm not sure if there's a need to send a full patchset anymore? We are
so close now anyway and the full driver is available from the staging
tree, at least that's what I will use from now on when reviewing wfx.

What about the Device Tree bindings? That needs to be acked by the DT
maintainers, so that's good to submit as a separate patch for review.

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

https://wireless.wiki.kernel.org/en/developers/documentation/submittingpatches
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [PATCH v9 05/24] wfx: add main.c/main.h

2022-02-10 Thread Jérôme Pouiller
On Thursday 10 February 2022 15:20:56 CET Kalle Valo wrote:
> 
> Jérôme Pouiller  writes:
> 
> > Hi Kalle,
> >
> > On Tuesday 11 January 2022 18:14:05 CET Jerome Pouiller wrote:
> >> From: Jérôme Pouiller 
> >>
> >> Signed-off-by: Jérôme Pouiller 
> >> ---
> >>  drivers/net/wireless/silabs/wfx/main.c | 485 +
> >>  drivers/net/wireless/silabs/wfx/main.h |  42 +++
> >>  2 files changed, 527 insertions(+)
> >>  create mode 100644 drivers/net/wireless/silabs/wfx/main.c
> >>  create mode 100644 drivers/net/wireless/silabs/wfx/main.h
> >>
> > [...]
> >> +/* The device needs data about the antenna configuration. This 
> >> information in
> >> + * provided by PDS (Platform Data Set, this is the wording used in WF200
> >> + * documentation) files. For hardware integrators, the full process to 
> >> create
> >> + * PDS files is described here:
> >> + *   https:github.com/SiliconLabs/wfx-firmware/blob/master/PDS/README.md
> >> + *
> >> + * The PDS file is an array of Time-Length-Value structs.
> >> + */
> >> + int wfx_send_pds(struct wfx_dev *wdev, u8 *buf, size_t len)
> >> +{
> >> +int ret, chunk_type, chunk_len, chunk_num = 0;
> >> +
> >> +if (*buf == '{') {
> >> +dev_err(wdev->dev, "PDS: malformed file (legacy format?)\n");
> >> +return -EINVAL;
> >> +}
> >> +while (len > 0) {
> >> +chunk_type = get_unaligned_le16(buf + 0);
> >> +chunk_len = get_unaligned_le16(buf + 2);
> >> +if (chunk_len > len) {
> >> +dev_err(wdev->dev, "PDS:%d: corrupted file\n", 
> >> chunk_num);
> >> +return -EINVAL;
> >> +}
> >> +if (chunk_type != WFX_PDS_TLV_TYPE) {
> >> +dev_info(wdev->dev, "PDS:%d: skip unknown data\n", 
> >> chunk_num);
> >> +goto next;
> >> +}
> >> +if (chunk_len > WFX_PDS_MAX_CHUNK_SIZE)
> >> + dev_warn(wdev->dev, "PDS:%d: unexpectly large chunk\n",
> >> chunk_num);
> >> +if (buf[4] != '{' || buf[chunk_len - 1] != '}')
> >> + dev_warn(wdev->dev, "PDS:%d: unexpected content\n", chunk_num);
> >> +
> >> +ret = wfx_hif_configuration(wdev, buf + 4, chunk_len - 4);
> >> +if (ret > 0) {
> >> + dev_err(wdev->dev, "PDS:%d: invalid data (unsupported
> >> options?)\n",
> >> +chunk_num);
> >> +return -EINVAL;
> >> +}
> >> +if (ret == -ETIMEDOUT) {
> >> + dev_err(wdev->dev, "PDS:%d: chip didn't reply (corrupted
> >> file?)\n",
> >> +chunk_num);
> >> +return ret;
> >> +}
> >> +if (ret) {
> >> + dev_err(wdev->dev, "PDS:%d: chip returned an unknown error\n",
> >> chunk_num);
> >> +return -EIO;
> >> +}
> >> +next:
> >> +chunk_num++;
> >> +len -= chunk_len;
> >> +buf += chunk_len;
> >> +}
> >> +return 0;
> >> +}
> >
> > Kalle, is this function what you expected? If it is right for you, I am
> > going to send it to the staging tree.
> 
> Looks better, but I don't get why '{' and '}' are still needed. Ah, does
> the firmware require to have them?

Indeed. If '{' and '}' are not present, I guarantee the firmware will return
an error (or assert). However, I am more confident in the driver than in the
firmware to report errors to the user.

If there is no other comment, I am going to:
  - submit this change to the staging tree
  - publish the tool that generate this new format
  - submit the PDS files referenced in bus_{sdio,spi}.c to linux-firmware
  - send the v10 of this PR


-- 
Jérôme Pouiller


___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [PATCH v9 05/24] wfx: add main.c/main.h

2022-02-10 Thread Pali Rohár
On Tuesday 11 January 2022 18:14:05 Jerome Pouiller wrote:
> +/* The device needs data about the antenna configuration. This information in
> + * provided by PDS (Platform Data Set, this is the wording used in WF200
> + * documentation) files. For hardware integrators, the full process to create
> + * PDS files is described here:
> + *   https:github.com/SiliconLabs/wfx-firmware/blob/master/PDS/README.md
> + *

Just a small cosmetic issue but URL cannot be automatically opened as it
is missing slashes after https protocol.
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [PATCH v9 05/24] wfx: add main.c/main.h

2022-02-10 Thread Kalle Valo
Jérôme Pouiller  writes:

> Hi Kalle,
>
> On Tuesday 11 January 2022 18:14:05 CET Jerome Pouiller wrote:
>> From: Jérôme Pouiller 
>> 
>> Signed-off-by: Jérôme Pouiller 
>> ---
>>  drivers/net/wireless/silabs/wfx/main.c | 485 +
>>  drivers/net/wireless/silabs/wfx/main.h |  42 +++
>>  2 files changed, 527 insertions(+)
>>  create mode 100644 drivers/net/wireless/silabs/wfx/main.c
>>  create mode 100644 drivers/net/wireless/silabs/wfx/main.h
>> 
> [...]
>> +/* The device needs data about the antenna configuration. This information 
>> in
>> + * provided by PDS (Platform Data Set, this is the wording used in WF200
>> + * documentation) files. For hardware integrators, the full process to 
>> create
>> + * PDS files is described here:
>> + *   https:github.com/SiliconLabs/wfx-firmware/blob/master/PDS/README.md
>> + *
>> + * The PDS file is an array of Time-Length-Value structs.
>> + */
>> + int wfx_send_pds(struct wfx_dev *wdev, u8 *buf, size_t len)
>> +{
>> +int ret, chunk_type, chunk_len, chunk_num = 0;
>> +
>> +if (*buf == '{') {
>> +dev_err(wdev->dev, "PDS: malformed file (legacy format?)\n");
>> +return -EINVAL;
>> +}
>> +while (len > 0) {
>> +chunk_type = get_unaligned_le16(buf + 0);
>> +chunk_len = get_unaligned_le16(buf + 2);
>> +if (chunk_len > len) {
>> +dev_err(wdev->dev, "PDS:%d: corrupted file\n", 
>> chunk_num);
>> +return -EINVAL;
>> +}
>> +if (chunk_type != WFX_PDS_TLV_TYPE) {
>> +dev_info(wdev->dev, "PDS:%d: skip unknown data\n", 
>> chunk_num);
>> +goto next;
>> +}
>> +if (chunk_len > WFX_PDS_MAX_CHUNK_SIZE)
>> + dev_warn(wdev->dev, "PDS:%d: unexpectly large chunk\n",
>> chunk_num);
>> +if (buf[4] != '{' || buf[chunk_len - 1] != '}')
>> + dev_warn(wdev->dev, "PDS:%d: unexpected content\n", chunk_num);
>> +
>> +ret = wfx_hif_configuration(wdev, buf + 4, chunk_len - 4);
>> +if (ret > 0) {
>> + dev_err(wdev->dev, "PDS:%d: invalid data (unsupported
>> options?)\n",
>> +chunk_num);
>> +return -EINVAL;
>> +}
>> +if (ret == -ETIMEDOUT) {
>> + dev_err(wdev->dev, "PDS:%d: chip didn't reply (corrupted
>> file?)\n",
>> +chunk_num);
>> +return ret;
>> +}
>> +if (ret) {
>> + dev_err(wdev->dev, "PDS:%d: chip returned an unknown error\n",
>> chunk_num);
>> +return -EIO;
>> +}
>> +next:
>> +chunk_num++;
>> +len -= chunk_len;
>> +buf += chunk_len;
>> +}
>> +return 0;
>> +}
>
> Kalle, is this function what you expected? If it is right for you, I am
> going to send it to the staging tree.

Looks better, but I don't get why '{' and '}' are still needed. Ah, does
the firmware require to have them?

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

https://wireless.wiki.kernel.org/en/developers/documentation/submittingpatches
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [PATCH v9 05/24] wfx: add main.c/main.h

2022-01-26 Thread Jérôme Pouiller
Hi Kalle,

On Tuesday 11 January 2022 18:14:05 CET Jerome Pouiller wrote:
> From: Jérôme Pouiller 
> 
> Signed-off-by: Jérôme Pouiller 
> ---
>  drivers/net/wireless/silabs/wfx/main.c | 485 +
>  drivers/net/wireless/silabs/wfx/main.h |  42 +++
>  2 files changed, 527 insertions(+)
>  create mode 100644 drivers/net/wireless/silabs/wfx/main.c
>  create mode 100644 drivers/net/wireless/silabs/wfx/main.h
> 
[...]
> +/* The device needs data about the antenna configuration. This information in
> + * provided by PDS (Platform Data Set, this is the wording used in WF200
> + * documentation) files. For hardware integrators, the full process to create
> + * PDS files is described here:
> + *   https:github.com/SiliconLabs/wfx-firmware/blob/master/PDS/README.md
> + *
> + * The PDS file is an array of Time-Length-Value structs.
> + */
> + int wfx_send_pds(struct wfx_dev *wdev, u8 *buf, size_t len)
> +{
> + int ret, chunk_type, chunk_len, chunk_num = 0;
> +
> + if (*buf == '{') {
> + dev_err(wdev->dev, "PDS: malformed file (legacy format?)\n");
> + return -EINVAL;
> + }
> + while (len > 0) {
> + chunk_type = get_unaligned_le16(buf + 0);
> + chunk_len = get_unaligned_le16(buf + 2);
> + if (chunk_len > len) {
> + dev_err(wdev->dev, "PDS:%d: corrupted file\n", 
> chunk_num);
> + return -EINVAL;
> + }
> + if (chunk_type != WFX_PDS_TLV_TYPE) {
> + dev_info(wdev->dev, "PDS:%d: skip unknown data\n", 
> chunk_num);
> + goto next;
> + }
> + if (chunk_len > WFX_PDS_MAX_CHUNK_SIZE)
> + dev_warn(wdev->dev, "PDS:%d: unexpectly large chunk\n", 
> chunk_num);
> + if (buf[4] != '{' || buf[chunk_len - 1] != '}')
> + dev_warn(wdev->dev, "PDS:%d: unexpected content\n", 
> chunk_num);
> +
> + ret = wfx_hif_configuration(wdev, buf + 4, chunk_len - 4);
> + if (ret > 0) {
> + dev_err(wdev->dev, "PDS:%d: invalid data (unsupported 
> options?)\n",
> + chunk_num);
> + return -EINVAL;
> + }
> + if (ret == -ETIMEDOUT) {
> + dev_err(wdev->dev, "PDS:%d: chip didn't reply 
> (corrupted file?)\n",
> + chunk_num);
> + return ret;
> + }
> + if (ret) {
> + dev_err(wdev->dev, "PDS:%d: chip returned an unknown 
> error\n", chunk_num);
> + return -EIO;
> + }
> +next:
> + chunk_num++;
> + len -= chunk_len;
> + buf += chunk_len;
> + }
> + return 0;
> +}

Kalle, is this function what you expected? If it is right for you, I am
going to send it to the staging tree.


-- 
Jérôme Pouiller


___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH v9 05/24] wfx: add main.c/main.h

2022-01-11 Thread Jerome Pouiller
From: Jérôme Pouiller 

Signed-off-by: Jérôme Pouiller 
---
 drivers/net/wireless/silabs/wfx/main.c | 485 +
 drivers/net/wireless/silabs/wfx/main.h |  42 +++
 2 files changed, 527 insertions(+)
 create mode 100644 drivers/net/wireless/silabs/wfx/main.c
 create mode 100644 drivers/net/wireless/silabs/wfx/main.h

diff --git a/drivers/net/wireless/silabs/wfx/main.c 
b/drivers/net/wireless/silabs/wfx/main.c
new file mode 100644
index ..d3507b91263b
--- /dev/null
+++ b/drivers/net/wireless/silabs/wfx/main.c
@@ -0,0 +1,485 @@
+// SPDX-License-Identifier: GPL-2.0-only
+/*
+ * Device probe and register.
+ *
+ * Copyright (c) 2017-2020, Silicon Laboratories, Inc.
+ * Copyright (c) 2010, ST-Ericsson
+ * Copyright (c) 2008, Johannes Berg 
+ * Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
+ * Copyright (c) 2007-2009, Christian Lamparter 
+ * Copyright (c) 2006, Michael Wu 
+ * Copyright (c) 2004-2006 Jean-Baptiste Note , et al.
+ */
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#include "main.h"
+#include "wfx.h"
+#include "fwio.h"
+#include "hwio.h"
+#include "bus.h"
+#include "bh.h"
+#include "sta.h"
+#include "key.h"
+#include "scan.h"
+#include "debug.h"
+#include "data_tx.h"
+#include "hif_tx_mib.h"
+#include "hif_api_cmd.h"
+
+#define WFX_PDS_TLV_TYPE 0x4450 // "PD" (Platform Data) in ascii little-endian
+#define WFX_PDS_MAX_CHUNK_SIZE 1500
+
+MODULE_DESCRIPTION("Silicon Labs 802.11 Wireless LAN driver for WF200");
+MODULE_AUTHOR("Jérôme Pouiller ");
+MODULE_LICENSE("GPL");
+
+#define RATETAB_ENT(_rate, _rateid, _flags) { \
+   .bitrate  = (_rate),   \
+   .hw_value = (_rateid), \
+   .flags= (_flags),  \
+}
+
+static struct ieee80211_rate wfx_rates[] = {
+   RATETAB_ENT(10,  0,  0),
+   RATETAB_ENT(20,  1,  IEEE80211_RATE_SHORT_PREAMBLE),
+   RATETAB_ENT(55,  2,  IEEE80211_RATE_SHORT_PREAMBLE),
+   RATETAB_ENT(110, 3,  IEEE80211_RATE_SHORT_PREAMBLE),
+   RATETAB_ENT(60,  6,  0),
+   RATETAB_ENT(90,  7,  0),
+   RATETAB_ENT(120, 8,  0),
+   RATETAB_ENT(180, 9,  0),
+   RATETAB_ENT(240, 10, 0),
+   RATETAB_ENT(360, 11, 0),
+   RATETAB_ENT(480, 12, 0),
+   RATETAB_ENT(540, 13, 0),
+};
+
+#define CHAN2G(_channel, _freq, _flags) { \
+   .band = NL80211_BAND_2GHZ, \
+   .center_freq = (_freq),\
+   .hw_value = (_channel),\
+   .flags = (_flags), \
+   .max_antenna_gain = 0, \
+   .max_power = 30,   \
+}
+
+static struct ieee80211_channel wfx_2ghz_chantable[] = {
+   CHAN2G(1,  2412, 0),
+   CHAN2G(2,  2417, 0),
+   CHAN2G(3,  2422, 0),
+   CHAN2G(4,  2427, 0),
+   CHAN2G(5,  2432, 0),
+   CHAN2G(6,  2437, 0),
+   CHAN2G(7,  2442, 0),
+   CHAN2G(8,  2447, 0),
+   CHAN2G(9,  2452, 0),
+   CHAN2G(10, 2457, 0),
+   CHAN2G(11, 2462, 0),
+   CHAN2G(12, 2467, 0),
+   CHAN2G(13, 2472, 0),
+   CHAN2G(14, 2484, 0),
+};
+
+static const struct ieee80211_supported_band wfx_band_2ghz = {
+   .channels = wfx_2ghz_chantable,
+   .n_channels = ARRAY_SIZE(wfx_2ghz_chantable),
+   .bitrates = wfx_rates,
+   .n_bitrates = ARRAY_SIZE(wfx_rates),
+   .ht_cap = {
+   /* Receive caps */
+   .cap = IEEE80211_HT_CAP_GRN_FLD | IEEE80211_HT_CAP_SGI_20 |
+  IEEE80211_HT_CAP_MAX_AMSDU | (1 << 
IEEE80211_HT_CAP_RX_STBC_SHIFT),
+   .ht_supported = 1,
+   .ampdu_factor = IEEE80211_HT_MAX_AMPDU_16K,
+   .ampdu_density = IEEE80211_HT_MPDU_DENSITY_NONE,
+   .mcs = {
+   .rx_mask = { 0xFF }, /* MCS0 to MCS7 */
+   .rx_highest = cpu_to_le16(72),
+   .tx_params = IEEE80211_HT_MCS_TX_DEFINED,
+   },
+   },
+};
+
+static const struct ieee80211_iface_limit wdev_iface_limits[] = {
+   { .max = 1, .types = BIT(NL80211_IFTYPE_STATION) },
+   { .max = 1, .types = BIT(NL80211_IFTYPE_AP) },
+};
+
+static const struct ieee80211_iface_combination wfx_iface_combinations[] = {
+   {
+   .num_different_channels = 2,
+   .max_interfaces = 2,
+   .limits = wdev_iface_limits,
+   .n_limits = ARRAY_SIZE(wdev_iface_limits),
+   }
+};
+
+static const struct ieee80211_ops wfx_ops = {
+   .start   = wfx_start,
+   .stop= wfx_stop,
+   .add_interface   = wfx_add_interface,
+   .remove_interface= wfx_remove_interface,
+   .config  = wfx_config,
+   .tx  = wfx_tx,
+   .join_ibss   = wfx_join_ibss,
+   .leave_ibss  = wfx_leave_ibss,
+   .conf_tx = wfx_conf_tx,
+   .hw_scan = wfx_hw_scan,
+   .cancel_hw_scan  = wfx_cancel_hw_scan,
+   .start_ap=