[PATCH v4] staging: qlge: emit debug and dump at same level
Simplify code in ql_mpi_core_to_log() by calling print_hex_dump() instead of existing functions so that the debug and dump are emitted at the same KERN_ Signed-off-by: Kaaira Gupta --- changes since v1: make code of ql_mpi_core_to_log() simpler. changes since v2: directly call the function instead of defining a macro. changes since v3: Remove prefix string. --- drivers/staging/qlge/qlge_dbg.c | 23 +++ 1 file changed, 3 insertions(+), 20 deletions(-) diff --git a/drivers/staging/qlge/qlge_dbg.c b/drivers/staging/qlge/qlge_dbg.c index c7af2548d119..0c5f6859e645 100644 --- a/drivers/staging/qlge/qlge_dbg.c +++ b/drivers/staging/qlge/qlge_dbg.c @@ -1324,27 +1324,10 @@ void ql_mpi_core_to_log(struct work_struct *work) { struct ql_adapter *qdev = container_of(work, struct ql_adapter, mpi_core_to_log.work); - u32 *tmp, count; - int i; - count = sizeof(struct ql_mpi_coredump) / sizeof(u32); - tmp = (u32 *)qdev->mpi_coredump; - netif_printk(qdev, drv, KERN_DEBUG, qdev->ndev, -"Core is dumping to log file!\n"); - - for (i = 0; i < count; i += 8) { - pr_err("%.08x: %.08x %.08x %.08x %.08x %.08x " - "%.08x %.08x %.08x\n", i, - tmp[i + 0], - tmp[i + 1], - tmp[i + 2], - tmp[i + 3], - tmp[i + 4], - tmp[i + 5], - tmp[i + 6], - tmp[i + 7]); - msleep(5); - } + print_hex_dump(KERN_DEBUG, "", DUMP_PREFIX_OFFSET, + 32, 4, qdev->mpi_coredump, + sizeof(*qdev->mpi_coredump), false); } #ifdef QL_REG_DUMP -- 2.17.1 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
Re: [PATCH] docs: dt: fix several broken doc references
Hi Mauro, Mauro Carvalho Chehab wrote on Sun, 23 Feb 2020 09:59:53 +0100: > There are several DT doc references that require manual fixes. > I found 3 cases fixed on this patch: > > - directory named "binding/" instead of "bindings/"; > - .txt to .yaml renames; > - file renames (still on txt format); > > Signed-off-by: Mauro Carvalho Chehab > --- > .../devicetree/bindings/mtd/cadence-nand-controller.txt | 2 +- > .../devicetree/bindings/net/brcm,bcm7445-switch-v4.0.txt | 2 +- > Documentation/devicetree/bindings/sound/st,stm32-sai.txt | 2 +- > Documentation/devicetree/bindings/sound/st,stm32-spdifrx.txt | 2 +- > Documentation/devicetree/bindings/spi/st,stm32-spi.yaml | 2 +- > MAINTAINERS | 4 ++-- > .../devicetree/bindings/net/wireless/siliabs,wfx.txt | 2 +- > 7 files changed, 8 insertions(+), 8 deletions(-) For the Cadence file, Reviewed-by: Miquel Raynal Thanks, Miquèl ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
Re: [PATCH] docs: dt: fix several broken doc references
On Sunday 23 February 2020 09:59:53 CET Mauro Carvalho Chehab wrote: > There are several DT doc references that require manual fixes. > I found 3 cases fixed on this patch: > > - directory named "binding/" instead of "bindings/"; > - .txt to .yaml renames; > - file renames (still on txt format); > > Signed-off-by: Mauro Carvalho Chehab > --- > .../devicetree/bindings/mtd/cadence-nand-controller.txt | 2 +- > .../devicetree/bindings/net/brcm,bcm7445-switch-v4.0.txt | 2 +- > Documentation/devicetree/bindings/sound/st,stm32-sai.txt | 2 +- > Documentation/devicetree/bindings/sound/st,stm32-spdifrx.txt | 2 +- > Documentation/devicetree/bindings/spi/st,stm32-spi.yaml | 2 +- > MAINTAINERS | 4 ++-- > .../devicetree/bindings/net/wireless/siliabs,wfx.txt | 2 +- > 7 files changed, 8 insertions(+), 8 deletions(-) [...] > diff --git > a/drivers/staging/wfx/Documentation/devicetree/bindings/net/wireless/siliabs,wfx.txt > > b/drivers/staging/wfx/Documentation/devicetree/bindings/net/wireless/siliabs,wfx.txt > index ffec79c14786..17db67559f5e 100644 > --- > a/drivers/staging/wfx/Documentation/devicetree/bindings/net/wireless/siliabs,wfx.txt > +++ > b/drivers/staging/wfx/Documentation/devicetree/bindings/net/wireless/siliabs,wfx.txt > @@ -94,5 +94,5 @@ Some properties are recognized either by SPI and SDIO > versions: > Must contains 64 hexadecimal digits. Not supported in current version. > > WFx driver also supports `mac-address` and `local-mac-address` as described > in > -Documentation/devicetree/binding/net/ethernet.txt > +Documentation/devicetree/bindings/net/ethernet.txt For siliabs,wfx.txt: Reviewed-by: Jérôme Pouiller -- Jérôme Pouiller ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
Re: [PATCH] staging: wfx: match parentheses alignment
On Sunday 23 February 2020 20:32:01 CET Kaaira Gupta wrote: > > match next line with open parentheses by giving appropriate tabs. Maybe the body of the commit message should start with a capital letter, else: Reviewed-by: Jérôme Pouiller > > Signed-off-by: Kaaira Gupta > --- > drivers/staging/wfx/data_tx.c | 6 +++--- > 1 file changed, 3 insertions(+), 3 deletions(-) > > diff --git a/drivers/staging/wfx/data_tx.c b/drivers/staging/wfx/data_tx.c > index 20f4740734f2..815fde0913f5 100644 > --- a/drivers/staging/wfx/data_tx.c > +++ b/drivers/staging/wfx/data_tx.c > @@ -300,8 +300,8 @@ static void wfx_tx_manage_pm(struct wfx_vif *wvif, struct > ieee80211_hdr *hdr, > } > > static u8 wfx_tx_get_raw_link_id(struct wfx_vif *wvif, > - struct ieee80211_sta *sta, > - struct ieee80211_hdr *hdr) > +struct ieee80211_sta *sta, > +struct ieee80211_hdr *hdr) > { > struct wfx_sta_priv *sta_priv = > sta ? (struct wfx_sta_priv *) &sta->drv_priv : NULL; > @@ -368,7 +368,7 @@ static void wfx_tx_fixup_rates(struct ieee80211_tx_rate > *rates) > } > > static u8 wfx_tx_get_rate_id(struct wfx_vif *wvif, > - struct ieee80211_tx_info *tx_info) > +struct ieee80211_tx_info *tx_info) > { > bool tx_policy_renew = false; > u8 rate_id; -- Jérôme Pouiller ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH] staging: kpc2000: prevent underflow in cpld_reconfigure()
This function should not allow negative values of "wr_val". If negatives are allowed then capping the upper bound at 7 is meaningless. Let's make it unsigned. Fixes: 7dc7967fc39a ("staging: kpc2000: add initial set of Daktronics drivers") Signed-off-by: Dan Carpenter --- drivers/staging/kpc2000/kpc2000/core.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/staging/kpc2000/kpc2000/core.c b/drivers/staging/kpc2000/kpc2000/core.c index 93cf28febdf6..7b00d7069e21 100644 --- a/drivers/staging/kpc2000/kpc2000/core.c +++ b/drivers/staging/kpc2000/kpc2000/core.c @@ -110,10 +110,10 @@ static ssize_t cpld_reconfigure(struct device *dev, const char *buf, size_t count) { struct kp2000_device *pcard = dev_get_drvdata(dev); - long wr_val; + unsigned long wr_val; int rv; - rv = kstrtol(buf, 0, &wr_val); + rv = kstrtoul(buf, 0, &wr_val); if (rv < 0) return rv; if (wr_val > 7) -- 2.11.0 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
AW: [PATCH] staging: rtl8723bs: core: remove redundant zero'ing of counter variable k
Von: kernel-janitors-ow...@vger.kernel.org im Auftrag von Colin King Gesendet: Sonntag, 23. Februar 2020 16:28 An: Greg Kroah-Hartman; de...@driverdev.osuosl.org Cc: kernel-janit...@vger.kernel.org; linux-ker...@vger.kernel.org Betreff: [PATCH] staging: rtl8723bs: core: remove redundant zero'ing of counter variable k From: Colin Ian King The zero'ing of counter variable k is redundant as it is never read after breaking out of the while loop. Remove it. Addresses-Coverity: ("Unused value") Signed-off-by: Colin Ian King --- drivers/staging/rtl8723bs/core/rtw_efuse.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/drivers/staging/rtl8723bs/core/rtw_efuse.c b/drivers/staging/rtl8723bs/core/rtw_efuse.c index 3b8848182221..bdb6ff8aab7d 100644 --- a/drivers/staging/rtl8723bs/core/rtw_efuse.c +++ b/drivers/staging/rtl8723bs/core/rtw_efuse.c @@ -244,10 +244,8 @@ u16Address) while (!(Bytetemp & 0x80)) { Bytetemp = rtw_read8(Adapter, EFUSE_CTRL+3); k++; - if (k == 1000) { - k = 0; + if (k == 1000) break; - } IMHO this is confusing to read, i suggest: for(k=0;k<1000;k++) { Bytetemp = rtw_read8(Adapter, EFUSE_CTRL+3); if ( Bytetemp & 0x80 ) break; } NTL is am wondering what will happen if k==1000 and Bytetemp is still invalid. Will rtw_read8() fail or simply return invalid data ? ym2c, re, wh } return rtw_read8(Adapter, EFUSE_CTRL); } else -- 2.25.0 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
Re: [PATCH] staging: rtl8723bs: core: remove redundant zero'ing of counter variable k
On Mon, Feb 24, 2020 at 11:07:55AM +, Walter Harms wrote: > diff --git a/drivers/staging/rtl8723bs/core/rtw_efuse.c > b/drivers/staging/rtl8723bs/core/rtw_efuse.c > index 3b8848182221..bdb6ff8aab7d 100644 > --- a/drivers/staging/rtl8723bs/core/rtw_efuse.c > +++ b/drivers/staging/rtl8723bs/core/rtw_efuse.c > @@ -244,10 +244,8 @@ u16Address) > while (!(Bytetemp & 0x80)) { > Bytetemp = rtw_read8(Adapter, EFUSE_CTRL+3); > k++; > - if (k == 1000) { > - k = 0; > + if (k == 1000) > break; > - } > > IMHO this is confusing to read, i suggest: > > for(k=0;k<1000;k++) { > Bytetemp = rtw_read8(Adapter, EFUSE_CTRL+3); > if ( Bytetemp & 0x80 ) >break; > } > The problem with the original code is that the variable is named "k" instead of "retry". It should be: do { Bytetemp = rtw_read8(Adapter, EFUSE_CTRL+3); } while (!(Bytetemp & 0x80)) && ++retry < 1000); > NTL is am wondering what will happen if k==1000 > and Bytetemp is still invalid. Will rtw_read8() fail or > simply return invalid data ? Yeah. That was my thought reviewing this patch as well. It should probably return 0xff on failure. if (retry >= 1000) return 0xff; regards, dan carpenter ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
AW: [PATCH] staging: rtl8723bs: core: remove redundant zero'ing of counter variable k
Von: Dan Carpenter Gesendet: Montag, 24. Februar 2020 12:27 An: Walter Harms Cc: Colin King; Greg Kroah-Hartman; de...@driverdev.osuosl.org; kernel-janit...@vger.kernel.org; linux-ker...@vger.kernel.org Betreff: Re: [PATCH] staging: rtl8723bs: core: remove redundant zero'ing of counter variable k On Mon, Feb 24, 2020 at 11:07:55AM +, Walter Harms wrote: > diff --git a/drivers/staging/rtl8723bs/core/rtw_efuse.c > b/drivers/staging/rtl8723bs/core/rtw_efuse.c > index 3b8848182221..bdb6ff8aab7d 100644 > --- a/drivers/staging/rtl8723bs/core/rtw_efuse.c > +++ b/drivers/staging/rtl8723bs/core/rtw_efuse.c > @@ -244,10 +244,8 @@ u16Address) > while (!(Bytetemp & 0x80)) { > Bytetemp = rtw_read8(Adapter, EFUSE_CTRL+3); > k++; > - if (k == 1000) { > - k = 0; > + if (k == 1000) > break; > - } > > IMHO this is confusing to read, i suggest: > > for(k=0;k<1000;k++) { > Bytetemp = rtw_read8(Adapter, EFUSE_CTRL+3); > if ( Bytetemp & 0x80 ) >break; > } > The problem with the original code is that the variable is named "k" instead of "retry". It should be: do { Bytetemp = rtw_read8(Adapter, EFUSE_CTRL+3); } while (!(Bytetemp & 0x80)) && ++retry < 1000); good point, personally i try to avoid putting to much into braces, so i would go for the additional if() but this is for the maintainer. > NTL is am wondering what will happen if k==1000 > and Bytetemp is still invalid. Will rtw_read8() fail or > simply return invalid data ? Yeah. That was my thought reviewing this patch as well. It should probably return 0xff on failure. if (retry >= 1000) return 0xff; looks nice, re, wh regards, dan carpenter ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
Re: [PATCH v3] staging: qlge: emit debug and dump at same level
On Sun, 2020-02-23 at 23:01 +0530, Kaaira Gupta wrote: > Simplify code in ql_mpi_core_to_log() by calling print_hex_dump() > instead of existing functions so that the debug and dump are > emitted at the same KERN_ [] > Also, can you please help me understand how are are numbers 32 and 4 > chosen for the function print_hex_dump()? Emit 32 bytes per line in 4 byte chunks as u32 And below: > diff --git a/drivers/staging/qlge/qlge_dbg.c b/drivers/staging/qlge/qlge_dbg.c [] > @@ -1324,27 +1324,10 @@ void ql_mpi_core_to_log(struct work_struct *work) > { > struct ql_adapter *qdev = > container_of(work, struct ql_adapter, mpi_core_to_log.work); [] > + print_hex_dump(KERN_DEBUG, "Core is dumping to log file!\n", > +DUMP_PREFIX_OFFSET, 32, 4, qdev->mpi_coredump, > +sizeof(*qdev->mpi_coredump), false); This use of a prefix string is not acceptable. >From the kernel-doc: /** * print_hex_dump - print a text hex dump to syslog for a binary blob of data * @level: kernel log level (e.g. KERN_DEBUG) * @prefix_str: string to prefix each line with; * caller supplies trailing spaces for alignment if desired So this would emit "Core is dumping..." line for for every line of hex output. ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
Re: [PATCH] docs: dt: fix several broken doc references
On Sun, Feb 23, 2020 at 09:59:53AM +0100, Mauro Carvalho Chehab wrote: > There are several DT doc references that require manual fixes. > I found 3 cases fixed on this patch: > > - directory named "binding/" instead of "bindings/"; > - .txt to .yaml renames; > - file renames (still on txt format); This seems like it should've been split up a bit. :/ Acked-by: Mark Brown signature.asc Description: PGP signature ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
Re: [greybus-dev] [PATCH] staging: greybus: match parenthesis alignment
Hi Kaaira, Thank you for the patch. On Thu, Feb 20, 2020 at 01:26:51AM +0530, Kaaira Gupta wrote: > Fix checkpatch.pl warning of alignment should match open parenthesis in > audio_codec.c > > Signed-off-by: Kaaira Gupta > --- > drivers/staging/greybus/audio_codec.c | 8 > 1 file changed, 4 insertions(+), 4 deletions(-) > > diff --git a/drivers/staging/greybus/audio_codec.c > b/drivers/staging/greybus/audio_codec.c > index 08746c85dea6..d62f91f4e9a2 100644 > --- a/drivers/staging/greybus/audio_codec.c > +++ b/drivers/staging/greybus/audio_codec.c > @@ -70,7 +70,7 @@ static int gbaudio_module_enable_tx(struct > gbaudio_codec_info *codec, > i2s_port = 0; /* fixed for now */ > cportid = data->connection->hd_cport_id; > ret = gb_audio_apbridgea_register_cport(data->connection, > - i2s_port, cportid, > + i2s_port, cportid, > AUDIO_APBRIDGEA_DIRECTION_TX); I'm curious to know why you think the line you changed deserves a modification, while the next one doesn't :-) > if (ret) { > dev_err_ratelimited(module->dev, > @@ -160,7 +160,7 @@ static int gbaudio_module_disable_tx(struct > gbaudio_module_info *module, int id) > i2s_port = 0; /* fixed for now */ > cportid = data->connection->hd_cport_id; > ret = gb_audio_apbridgea_unregister_cport(data->connection, > - i2s_port, cportid, > + i2s_port, cportid, > AUDIO_APBRIDGEA_DIRECTION_TX); > if (ret) { > dev_err_ratelimited(module->dev, > @@ -205,7 +205,7 @@ static int gbaudio_module_enable_rx(struct > gbaudio_codec_info *codec, > i2s_port = 0; /* fixed for now */ > cportid = data->connection->hd_cport_id; > ret = gb_audio_apbridgea_register_cport(data->connection, > - i2s_port, cportid, > + i2s_port, cportid, > AUDIO_APBRIDGEA_DIRECTION_RX); > if (ret) { > dev_err_ratelimited(module->dev, > @@ -295,7 +295,7 @@ static int gbaudio_module_disable_rx(struct > gbaudio_module_info *module, int id) > i2s_port = 0; /* fixed for now */ > cportid = data->connection->hd_cport_id; > ret = gb_audio_apbridgea_unregister_cport(data->connection, > - i2s_port, cportid, > + i2s_port, cportid, > AUDIO_APBRIDGEA_DIRECTION_RX); > if (ret) { > dev_err_ratelimited(module->dev, -- Regards, Laurent Pinchart ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
Re: [PATCH v4] staging: qlge: emit debug and dump at same level
On Mon, 2020-02-24 at 13:54 +0530, Kaaira Gupta wrote: > Simplify code in ql_mpi_core_to_log() by calling print_hex_dump() > instead of existing functions so that the debug and dump are > emitted at the same KERN_ [] > diff --git a/drivers/staging/qlge/qlge_dbg.c b/drivers/staging/qlge/qlge_dbg.c [] > @@ -1324,27 +1324,10 @@ void ql_mpi_core_to_log(struct work_struct *work) > { > struct ql_adapter *qdev = > container_of(work, struct ql_adapter, mpi_core_to_log.work); > - u32 *tmp, count; > - int i; > > - count = sizeof(struct ql_mpi_coredump) / sizeof(u32); > - tmp = (u32 *)qdev->mpi_coredump; > - netif_printk(qdev, drv, KERN_DEBUG, qdev->ndev, > - "Core is dumping to log file!\n"); There is no real need to delete this line. And if you really want to, it'd be better to mention the removal in the commit message description. As is for this change, there is no "debug" and "dump" as the commit message description shows, just "dump". ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
Re: [PATCH] staging: wfx: match parentheses alignment
On Mon, 2020-02-24 at 01:02 +0530, Kaaira Gupta wrote: > match next line with open parentheses by giving appropriate tabs. This patch is only for data_tx.c There are many more parentheses that are not aligned in staging/wfx in other files. Realistically, either change the subject to show that it's only for data_tx or do them all. (but not traces.h, those use a different style) $ ./scripts/checkpatch.pl -f --terse --nosummary --types=parenthesis_alignment drivers/staging/wfx/*.[ch] drivers/staging/wfx/data_tx.c:303: CHECK: Alignment should match open parenthesis drivers/staging/wfx/data_tx.c:371: CHECK: Alignment should match open parenthesis drivers/staging/wfx/debug.c:35: CHECK: Alignment should match open parenthesis drivers/staging/wfx/key.c:35: CHECK: Alignment should match open parenthesis drivers/staging/wfx/key.c:45: CHECK: Alignment should match open parenthesis drivers/staging/wfx/key.c:55: CHECK: Alignment should match open parenthesis drivers/staging/wfx/key.c:72: CHECK: Alignment should match open parenthesis drivers/staging/wfx/key.c:97: CHECK: Alignment should match open parenthesis drivers/staging/wfx/key.c:106: CHECK: Alignment should match open parenthesis drivers/staging/wfx/key.c:118: CHECK: Alignment should match open parenthesis drivers/staging/wfx/key.c:133: CHECK: Alignment should match open parenthesis drivers/staging/wfx/key.c:147: CHECK: Alignment should match open parenthesis drivers/staging/wfx/queue.c:393: CHECK: Alignment should match open parenthesis drivers/staging/wfx/queue.c:408: CHECK: Alignment should match open parenthesis drivers/staging/wfx/queue.c:433: CHECK: Alignment should match open parenthesis drivers/staging/wfx/sta.c:123: CHECK: Alignment should match open parenthesis drivers/staging/wfx/sta.c:235: CHECK: Alignment should match open parenthesis drivers/staging/wfx/sta.c:291: CHECK: Alignment should match open parenthesis drivers/staging/wfx/sta.c:340: CHECK: Alignment should match open parenthesis drivers/staging/wfx/sta.c:717: CHECK: Alignment should match open parenthesis drivers/staging/wfx/traces.h:156: CHECK: Alignment should match open parenthesis drivers/staging/wfx/traces.h:194: CHECK: Alignment should match open parenthesis drivers/staging/wfx/traces.h:206: CHECK: Alignment should match open parenthesis drivers/staging/wfx/traces.h:211: CHECK: Alignment should match open parenthesis drivers/staging/wfx/traces.h:234: CHECK: Alignment should match open parenthesis drivers/staging/wfx/traces.h:257: CHECK: Alignment should match open parenthesis drivers/staging/wfx/traces.h:265: CHECK: Alignment should match open parenthesis drivers/staging/wfx/traces.h:271: CHECK: Alignment should match open parenthesis drivers/staging/wfx/traces.h:278: CHECK: Alignment should match open parenthesis drivers/staging/wfx/traces.h:296: CHECK: Alignment should match open parenthesis drivers/staging/wfx/traces.h:302: CHECK: Alignment should match open parenthesis drivers/staging/wfx/traces.h:307: CHECK: Alignment should match open parenthesis drivers/staging/wfx/traces.h:313: CHECK: Alignment should match open parenthesis drivers/staging/wfx/traces.h:324: CHECK: Alignment should match open parenthesis drivers/staging/wfx/traces.h:329: CHECK: Alignment should match open parenthesis drivers/staging/wfx/traces.h:334: CHECK: Alignment should match open parenthesis drivers/staging/wfx/traces.h:351: CHECK: Alignment should match open parenthesis drivers/staging/wfx/traces.h:362: CHECK: Alignment should match open parenthesis drivers/staging/wfx/traces.h:416: CHECK: Alignment should match open parenthesis drivers/staging/wfx/traces.h:418: CHECK: Alignment should match open parenthesis ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH v2] staging: wfx: data_tx.c: match parentheses alignment
On Mon, Feb 24, 2020 at 06:13:32AM -0800, Joe Perches wrote: > On Mon, 2020-02-24 at 01:02 +0530, Kaaira Gupta wrote: > > Match next line with open parentheses by giving appropriate tabs. Changed the first word to caps. Will keep this in mind from now on. Thanks! > > This patch is only for data_tx.c > > There are many more parentheses that are not aligned > in staging/wfx in other files. > > Realistically, either change the subject to show > that it's only for data_tx or do them all. I have made the changes in the subject line and will submit a separate patch with clean-ups in all the other files > > (but not traces.h, those use a different style) > > $ ./scripts/checkpatch.pl -f --terse --nosummary > --types=parenthesis_alignment drivers/staging/wfx/*.[ch] > drivers/staging/wfx/data_tx.c:303: CHECK: Alignment should match open > parenthesis > drivers/staging/wfx/data_tx.c:371: CHECK: Alignment should match open > parenthesis > drivers/staging/wfx/debug.c:35: CHECK: Alignment should match open parenthesis > drivers/staging/wfx/key.c:35: CHECK: Alignment should match open parenthesis > drivers/staging/wfx/key.c:45: CHECK: Alignment should match open parenthesis > drivers/staging/wfx/key.c:55: CHECK: Alignment should match open parenthesis > drivers/staging/wfx/key.c:72: CHECK: Alignment should match open parenthesis > drivers/staging/wfx/key.c:97: CHECK: Alignment should match open parenthesis > drivers/staging/wfx/key.c:106: CHECK: Alignment should match open parenthesis > drivers/staging/wfx/key.c:118: CHECK: Alignment should match open parenthesis > drivers/staging/wfx/key.c:133: CHECK: Alignment should match open parenthesis > drivers/staging/wfx/key.c:147: CHECK: Alignment should match open parenthesis > drivers/staging/wfx/queue.c:393: CHECK: Alignment should match open > parenthesis > drivers/staging/wfx/queue.c:408: CHECK: Alignment should match open > parenthesis > drivers/staging/wfx/queue.c:433: CHECK: Alignment should match open > parenthesis > drivers/staging/wfx/sta.c:123: CHECK: Alignment should match open parenthesis > drivers/staging/wfx/sta.c:235: CHECK: Alignment should match open parenthesis > drivers/staging/wfx/sta.c:291: CHECK: Alignment should match open parenthesis > drivers/staging/wfx/sta.c:340: CHECK: Alignment should match open parenthesis > drivers/staging/wfx/sta.c:717: CHECK: Alignment should match open parenthesis > drivers/staging/wfx/traces.h:156: CHECK: Alignment should match open > parenthesis > drivers/staging/wfx/traces.h:194: CHECK: Alignment should match open > parenthesis > drivers/staging/wfx/traces.h:206: CHECK: Alignment should match open > parenthesis > drivers/staging/wfx/traces.h:211: CHECK: Alignment should match open > parenthesis > drivers/staging/wfx/traces.h:234: CHECK: Alignment should match open > parenthesis > drivers/staging/wfx/traces.h:257: CHECK: Alignment should match open > parenthesis > drivers/staging/wfx/traces.h:265: CHECK: Alignment should match open > parenthesis > drivers/staging/wfx/traces.h:271: CHECK: Alignment should match open > parenthesis > drivers/staging/wfx/traces.h:278: CHECK: Alignment should match open > parenthesis > drivers/staging/wfx/traces.h:296: CHECK: Alignment should match open > parenthesis > drivers/staging/wfx/traces.h:302: CHECK: Alignment should match open > parenthesis > drivers/staging/wfx/traces.h:307: CHECK: Alignment should match open > parenthesis > drivers/staging/wfx/traces.h:313: CHECK: Alignment should match open > parenthesis > drivers/staging/wfx/traces.h:324: CHECK: Alignment should match open > parenthesis > drivers/staging/wfx/traces.h:329: CHECK: Alignment should match open > parenthesis > drivers/staging/wfx/traces.h:334: CHECK: Alignment should match open > parenthesis > drivers/staging/wfx/traces.h:351: CHECK: Alignment should match open > parenthesis > drivers/staging/wfx/traces.h:362: CHECK: Alignment should match open > parenthesis > drivers/staging/wfx/traces.h:416: CHECK: Alignment should match open > parenthesis > drivers/staging/wfx/traces.h:418: CHECK: Alignment should match open > parenthesis > > > > ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
Re: [PATCH v4] staging: qlge: emit debug and dump at same level
On Mon, Feb 24, 2020 at 05:38:09AM -0800, Joe Perches wrote: > On Mon, 2020-02-24 at 13:54 +0530, Kaaira Gupta wrote: > > Simplify code in ql_mpi_core_to_log() by calling print_hex_dump() > > instead of existing functions so that the debug and dump are > > emitted at the same KERN_ > [] > > diff --git a/drivers/staging/qlge/qlge_dbg.c > > b/drivers/staging/qlge/qlge_dbg.c > [] > > @@ -1324,27 +1324,10 @@ void ql_mpi_core_to_log(struct work_struct *work) > > { > > struct ql_adapter *qdev = > > container_of(work, struct ql_adapter, mpi_core_to_log.work); > > - u32 *tmp, count; > > - int i; > > > > - count = sizeof(struct ql_mpi_coredump) / sizeof(u32); > > - tmp = (u32 *)qdev->mpi_coredump; > > - netif_printk(qdev, drv, KERN_DEBUG, qdev->ndev, > > -"Core is dumping to log file!\n"); > > There is no real need to delete this line. > > And if you really want to, it'd be better to mention > the removal in the commit message description. > > As is for this change, there is no "debug" and "dump" > as the commit message description shows, just "dump". This patch has already been added to the tree, if I amend the commit now using git rebase, won't it affect the upstream as the SHA-1 of the commit and it's children will change? > > > > ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
Re: [greybus-dev] [PATCH] staging: greybus: match parenthesis alignment
On Mon, Feb 24, 2020 at 01:49:29PM +0200, Laurent Pinchart wrote: > Hi Kaaira, > > Thank you for the patch. > > On Thu, Feb 20, 2020 at 01:26:51AM +0530, Kaaira Gupta wrote: > > Fix checkpatch.pl warning of alignment should match open parenthesis in > > audio_codec.c > > > > Signed-off-by: Kaaira Gupta > > --- > > drivers/staging/greybus/audio_codec.c | 8 > > 1 file changed, 4 insertions(+), 4 deletions(-) > > > > diff --git a/drivers/staging/greybus/audio_codec.c > > b/drivers/staging/greybus/audio_codec.c > > index 08746c85dea6..d62f91f4e9a2 100644 > > --- a/drivers/staging/greybus/audio_codec.c > > +++ b/drivers/staging/greybus/audio_codec.c > > @@ -70,7 +70,7 @@ static int gbaudio_module_enable_tx(struct > > gbaudio_codec_info *codec, > > i2s_port = 0; /* fixed for now */ > > cportid = data->connection->hd_cport_id; > > ret = gb_audio_apbridgea_register_cport(data->connection, > > - i2s_port, cportid, > > + i2s_port, cportid, > > AUDIO_APBRIDGEA_DIRECTION_TX); > > I'm curious to know why you think the line you changed deserves a > modification, while the next one doesn't :-) According to me, both the lines deserve a modification. But I did not do that as changing the other line was throwing 'greater than 80 characters' warning and I wasn't sure if I should go ahead with the changes anyhow. > > > if (ret) { > > dev_err_ratelimited(module->dev, > > @@ -160,7 +160,7 @@ static int gbaudio_module_disable_tx(struct > > gbaudio_module_info *module, int id) > > i2s_port = 0; /* fixed for now */ > > cportid = data->connection->hd_cport_id; > > ret = gb_audio_apbridgea_unregister_cport(data->connection, > > - i2s_port, cportid, > > + i2s_port, cportid, > > AUDIO_APBRIDGEA_DIRECTION_TX); > > if (ret) { > > dev_err_ratelimited(module->dev, > > @@ -205,7 +205,7 @@ static int gbaudio_module_enable_rx(struct > > gbaudio_codec_info *codec, > > i2s_port = 0; /* fixed for now */ > > cportid = data->connection->hd_cport_id; > > ret = gb_audio_apbridgea_register_cport(data->connection, > > - i2s_port, cportid, > > + i2s_port, cportid, > > AUDIO_APBRIDGEA_DIRECTION_RX); > > if (ret) { > > dev_err_ratelimited(module->dev, > > @@ -295,7 +295,7 @@ static int gbaudio_module_disable_rx(struct > > gbaudio_module_info *module, int id) > > i2s_port = 0; /* fixed for now */ > > cportid = data->connection->hd_cport_id; > > ret = gb_audio_apbridgea_unregister_cport(data->connection, > > - i2s_port, cportid, > > + i2s_port, cportid, > > AUDIO_APBRIDGEA_DIRECTION_RX); > > if (ret) { > > dev_err_ratelimited(module->dev, > > -- > Regards, > > Laurent Pinchart ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
Re: [PATCH v4] staging: qlge: emit debug and dump at same level
On Mon, 2020-02-24 at 22:17 +0530, Kaaira Gupta wrote: > On Mon, Feb 24, 2020 at 05:38:09AM -0800, Joe Perches wrote: > > On Mon, 2020-02-24 at 13:54 +0530, Kaaira Gupta wrote: > > > Simplify code in ql_mpi_core_to_log() by calling print_hex_dump() > > > instead of existing functions so that the debug and dump are > > > emitted at the same KERN_ > > [] > > > diff --git a/drivers/staging/qlge/qlge_dbg.c > > > b/drivers/staging/qlge/qlge_dbg.c > > [] > > > @@ -1324,27 +1324,10 @@ void ql_mpi_core_to_log(struct work_struct *work) > > > { > > > struct ql_adapter *qdev = > > > container_of(work, struct ql_adapter, mpi_core_to_log.work); > > > - u32 *tmp, count; > > > - int i; > > > > > > - count = sizeof(struct ql_mpi_coredump) / sizeof(u32); > > > - tmp = (u32 *)qdev->mpi_coredump; > > > - netif_printk(qdev, drv, KERN_DEBUG, qdev->ndev, > > > - "Core is dumping to log file!\n"); > > > > There is no real need to delete this line. > > > > And if you really want to, it'd be better to mention > > the removal in the commit message description. > > > > As is for this change, there is no "debug" and "dump" > > as the commit message description shows, just "dump". > > This patch has already been added to the tree, What tree is that? It's not in -next as of right now. > if I amend the commit now > using git rebase, won't it affect the upstream as the SHA-1 of the > commit and it's children will change? You are sending patches not pull requests. If it's really in an actual tree that people care about, send another patch putting the netif_printk back. ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
Re: [PATCH v4] staging: qlge: emit debug and dump at same level
On Mon, Feb 24, 2020 at 08:54:43AM -0800, Joe Perches wrote: > On Mon, 2020-02-24 at 22:17 +0530, Kaaira Gupta wrote: > > On Mon, Feb 24, 2020 at 05:38:09AM -0800, Joe Perches wrote: > > > On Mon, 2020-02-24 at 13:54 +0530, Kaaira Gupta wrote: > > > > Simplify code in ql_mpi_core_to_log() by calling print_hex_dump() > > > > instead of existing functions so that the debug and dump are > > > > emitted at the same KERN_ > > > [] > > > > diff --git a/drivers/staging/qlge/qlge_dbg.c > > > > b/drivers/staging/qlge/qlge_dbg.c > > > [] > > > > @@ -1324,27 +1324,10 @@ void ql_mpi_core_to_log(struct work_struct > > > > *work) > > > > { > > > > struct ql_adapter *qdev = > > > > container_of(work, struct ql_adapter, > > > > mpi_core_to_log.work); > > > > - u32 *tmp, count; > > > > - int i; > > > > > > > > - count = sizeof(struct ql_mpi_coredump) / sizeof(u32); > > > > - tmp = (u32 *)qdev->mpi_coredump; > > > > - netif_printk(qdev, drv, KERN_DEBUG, qdev->ndev, > > > > -"Core is dumping to log file!\n"); > > > > > > There is no real need to delete this line. > > > > > > And if you really want to, it'd be better to mention > > > the removal in the commit message description. > > > > > > As is for this change, there is no "debug" and "dump" > > > as the commit message description shows, just "dump". > > > > This patch has already been added to the tree, > > What tree is that? > It's not in -next as of right now. Its in staging-next right now. This is the link: https://lore.kernel.org/driverdev-devel/cba75ee4d88afdf118631510ad0f971e42c1a31c.ca...@perches.com/ > > > if I amend the commit now > > using git rebase, won't it affect the upstream as the SHA-1 of the > > commit and it's children will change? > > You are sending patches not pull requests. > > If it's really in an actual tree that people > care about, send another patch putting the > netif_printk back. I'll submit a patch, but can you please explain me why this function is still needed when we are already using print_hex_dump()? > > ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
Re: [PATCH v4] staging: qlge: emit debug and dump at same level
On Mon, 2020-02-24 at 22:48 +0530, Kaaira Gupta wrote: > On Mon, Feb 24, 2020 at 08:54:43AM -0800, Joe Perches wrote: > > On Mon, 2020-02-24 at 22:17 +0530, Kaaira Gupta wrote: > > > On Mon, Feb 24, 2020 at 05:38:09AM -0800, Joe Perches wrote: > > > > On Mon, 2020-02-24 at 13:54 +0530, Kaaira Gupta wrote: > > > > > Simplify code in ql_mpi_core_to_log() by calling print_hex_dump() > > > > > instead of existing functions so that the debug and dump are > > > > > emitted at the same KERN_ > > > > [] > > > > > diff --git a/drivers/staging/qlge/qlge_dbg.c > > > > > b/drivers/staging/qlge/qlge_dbg.c > > > > [] > > > > > @@ -1324,27 +1324,10 @@ void ql_mpi_core_to_log(struct work_struct > > > > > *work) > > > > > { > > > > > struct ql_adapter *qdev = > > > > > container_of(work, struct ql_adapter, > > > > > mpi_core_to_log.work); > > > > > - u32 *tmp, count; > > > > > - int i; > > > > > > > > > > - count = sizeof(struct ql_mpi_coredump) / sizeof(u32); > > > > > - tmp = (u32 *)qdev->mpi_coredump; > > > > > - netif_printk(qdev, drv, KERN_DEBUG, qdev->ndev, > > > > > - "Core is dumping to log file!\n"); > > > > > > > > There is no real need to delete this line. > > > > > > > > And if you really want to, it'd be better to mention > > > > the removal in the commit message description. > > > > > > > > As is for this change, there is no "debug" and "dump" > > > > as the commit message description shows, just "dump". > > > > > > This patch has already been added to the tree, > > > > What tree is that? > > It's not in -next as of right now. > > Its in staging-next right now. > This is the link: > https://lore.kernel.org/driverdev-devel/cba75ee4d88afdf118631510ad0f971e42c1a31c.ca...@perches.com/ > > > > if I amend the commit now > > > using git rebase, won't it affect the upstream as the SHA-1 of the > > > commit and it's children will change? > > > > You are sending patches not pull requests. > > > > If it's really in an actual tree that people > > care about, send another patch putting the > > netif_printk back. > > I'll submit a patch, but can you please explain me why this function is > still needed when we are already using print_hex_dump()? Your commit message did not match the code. You are changing the code and the output without explanation. It's fine to both change the code and the output when appropriate. it's not fine to do so by misstating what you are doing. ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
Re: [PATCH] docs: dt: fix several broken doc references
On Sun, Feb 23, 2020 at 09:59:53AM +0100, Mauro Carvalho Chehab wrote: > There are several DT doc references that require manual fixes. > I found 3 cases fixed on this patch: > > - directory named "binding/" instead of "bindings/"; > - .txt to .yaml renames; > - file renames (still on txt format); > > Signed-off-by: Mauro Carvalho Chehab > --- > .../devicetree/bindings/mtd/cadence-nand-controller.txt | 2 +- > .../devicetree/bindings/net/brcm,bcm7445-switch-v4.0.txt | 2 +- > Documentation/devicetree/bindings/sound/st,stm32-sai.txt | 2 +- > Documentation/devicetree/bindings/sound/st,stm32-spdifrx.txt | 2 +- > Documentation/devicetree/bindings/spi/st,stm32-spi.yaml | 2 +- > MAINTAINERS | 4 ++-- > .../devicetree/bindings/net/wireless/siliabs,wfx.txt | 2 +- > 7 files changed, 8 insertions(+), 8 deletions(-) Applied. Rob ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
Dear Beloved,
Dear Beloved, I'm Reverend Wright Watson, I was born in USA, 1945, I was ordained into the Catholic Priesthood. Please take your time to read this message, although we have never met before, this is no spam, It's a real message sent to you. I know also that you will be amazed at the level of trust that I am willing to place in a person that I have never seen nor spoken with. If I can receive favor from someone I barely know, its not bad entrusting this project to unknown person as long as my spirit directed me to you. I have been a catholic priest for over 22 years. I spent about 10 years serving at Africa, Burkina Faso to be precise, I spend most time in Ouagadougou Cathedral. Presently, I had a heart surgery on the 23-11-2018 and the Doctors have informed me that I cannot live longer; I had a serious bleeding after the operation. Before I left Ouagadougou to my country for the surgery, a priest friend of mine visited me from Netherlands with three companion, when they went back, one among his companion Transferred 10M$ in my personal account with Bank of Africa and advised that I use the money to help the poor, handicaps and less privileges because he saw the level hardship then. Because of my present health condition, I cannot live to proceed with the projects, therefore, I have decided to appoint you to reclaim the money which total sum of $10,970,000.00 (Ten million Nine Hundred and seventy Thousand US DOLLARS). I want you to use this sum to make the world a better place for the poor and less privileged, help the needy and also help your family members. I took this decision because I was raised in an Orphanage so I don't have relatives and presently, I'm still in the hospital, where I am undergoing treatment. That's why I have decided to contact you so that you can contact my account manager in Bank of Africa, reclaim the money and make good use of it. then you can contact me through private email addres(revwrightwat...@yandex.com) Regards, Rev.Wright Watson ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH] staging: iio: update TODO
gre...@linuxfoundation.org, ji...@kernel.org Bcc: Subject: [PATCH] staging: iio: update TODO Reply-To: Since there are no more uses of the old GPIO API in iio staging drivers remove that work item from the TODO. Add other work items with reference to the conversation in [1] [1]: https://marc.info/?l=linux-iio&m=158256721009892&w=2 Thanks, Rohit Signed-off-by: Rohit Sarkar --- drivers/staging/iio/TODO | 14 -- 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/drivers/staging/iio/TODO b/drivers/staging/iio/TODO index 1b8ebf2c1b69..783878f25f08 100644 --- a/drivers/staging/iio/TODO +++ b/drivers/staging/iio/TODO @@ -1,11 +1,13 @@ -2018-04-15 +2020-02-25 -All affected drivers: -Convert all uses of the old GPIO API from to the -GPIO descriptor API in and look up GPIO -lines from device tree, ACPI or board files, board files should -use . +- Documentation + - Binding docs for devices that are obviously used via device tree + - Yaml conversions for abandoned drivers + - ABI Documentation + - Audit driviers/iio/staging/Documentation +- Replace iio_dev->mlock by either a local lock or use iio_claim_direct. +(Requires analysis of the purpose of the lock.) ADI Drivers: CC the device-drivers-de...@blackfin.uclinux.org mailing list when -- 2.23.0.385.gbc12974a89 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
Re: [PATCH] staging: qlge: add braces around macro arguments
On 2020/02/24 13:22 +0530, Kaaira Gupta wrote: > On Mon, Feb 24, 2020 at 02:32:25PM +0900, Benjamin Poirier wrote: > > On 2020/02/22 01:26 +0530, Kaaira Gupta wrote: > > > Fix checkpatch.pl warnings of adding braces around macro arguments to > > > prevent precedence issues by adding braces in qlge_dbg.c > > > > > > Signed-off-by: Kaaira Gupta > > > --- > > > drivers/staging/qlge/qlge_dbg.c | 6 +++--- > > > 1 file changed, 3 insertions(+), 3 deletions(-) > > > > > > diff --git a/drivers/staging/qlge/qlge_dbg.c > > > b/drivers/staging/qlge/qlge_dbg.c > > > index 8cf39615c520..c7af2548d119 100644 > > > --- a/drivers/staging/qlge/qlge_dbg.c > > > +++ b/drivers/staging/qlge/qlge_dbg.c > > > @@ -1525,7 +1525,7 @@ void ql_dump_regs(struct ql_adapter *qdev) > > > #ifdef QL_STAT_DUMP > > > > > > #define DUMP_STAT(qdev, stat)\ > > > - pr_err("%s = %ld\n", #stat, (unsigned long)qdev->nic_stats.stat) > > > + pr_err("%s = %ld\n", #stat, (unsigned long)(qdev)->nic_stats.stat) > > > > > > void ql_dump_stat(struct ql_adapter *qdev) > > > { > > > @@ -1578,12 +1578,12 @@ void ql_dump_stat(struct ql_adapter *qdev) > > > #ifdef QL_DEV_DUMP > > > > > > #define DUMP_QDEV_FIELD(qdev, type, field) \ > > > - pr_err("qdev->%-24s = " type "\n", #field, qdev->field) > > > + pr_err("qdev->%-24s = " type "\n", #field, (qdev)->(field)) > > > #define DUMP_QDEV_DMA_FIELD(qdev, field) \ > > > pr_err("qdev->%-24s = %llx\n", #field, (unsigned long long)qdev->field) > > > > You missed one. > > It makes the line characaters greater than 80. Shall I still add braces? > I mean it's better that I add them to prevent precedence issues, but it > adds another warning, hence I wasn't sure. Generally speaking, it's ok to spread the macro body onto multiple lines. In this case, it would be better to replace this printk format type with "%pad". See Documentation/core-api/printk-formats.rst ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
Are you still alive? Urgent reply is needed
Dear Beneficiary, Please confirm if you are still alive because two gentle men walked into my office this morning to claim your inheritance funds with our bank. They said you are dead and that they are your representatives. On November 21, 2008. A business man (name withheld for security reasons) walked into our bank to open a NON RESIDENCE ACCOUNT and made you his NEXT OF KIN. I got your email address from the file of your benefactor as his NEXT OF KIN. It's been years we confirmed your benefactor's death and you have not contacted our bank to claim your inheritance. You have a total balance of €29,071,970.00. The gentlemen submitted an address where they want your VISA DEBIT ATM CARD sent. If you are still alive, please indicate by sending your full contact details within 7 day of receiving this message, failure to do so, I will send the card to the address submitted by your representatives. Regards ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
Re: [PATCH 1/3] compiler.h: define __do_not_initialize
On Mon, Feb 24, 2020 at 04:34:59PM +0100, gli...@google.com wrote: > For CONFIG_INIT_STACK_ALL it's sometimes handy to disable > force-initialization for a local variable, if it is known to be initialized > later on before the first use. This can be done by using the > __do_not_initialize macro. Nit-pick: other things are listed as __no_$feature. What about naming this __no_initialize (or reuse the attribute name of __uninitialized)? > __do_not_initialize should be applied carefully, as future changes to > the code around the local variable may introduce paths on which the > variable remains uninitialized before the use. > > Signed-off-by: Alexander Potapenko Please CC lkml as well in the future. But yes, this seems like a reasonable work-around until compilers can be taught which functions are considered initialization sinks. :) -Kees > --- > include/linux/compiler-clang.h | 10 ++ > include/linux/compiler_types.h | 4 > 2 files changed, 14 insertions(+) > > diff --git a/include/linux/compiler-clang.h b/include/linux/compiler-clang.h > index 333a6695a918c..9204334d39261 100644 > --- a/include/linux/compiler-clang.h > +++ b/include/linux/compiler-clang.h > @@ -24,6 +24,16 @@ > #define __no_sanitize_address > #endif > > +/* > + * Disable initialization of a local variable when building with > + * CONFIG_INIT_STACK_ALL. > + */ > +#ifdef CONFIG_INIT_STACK_ALL > +#define __do_not_initialize __attribute__((uninitialized)) > +#else > +#define __do_not_initialize > +#endif > + > /* > * Not all versions of clang implement the the type-generic versions > * of the builtin overflow checkers. Fortunately, clang implements > diff --git a/include/linux/compiler_types.h b/include/linux/compiler_types.h > index 72393a8c1a6c5..b216beb5586fc 100644 > --- a/include/linux/compiler_types.h > +++ b/include/linux/compiler_types.h > @@ -180,6 +180,10 @@ struct ftrace_likely_data { > > #endif /* __ASSEMBLY__ */ > > +#ifndef __do_not_initialize > +#define __do_not_initialize > +#endif > + > /* > * The below symbols may be defined for one or more, but not ALL, of the > above > * compilers. We don't consider that to be an error, so set them to nothing. > -- > 2.25.0.265.gbab2e86ba0-goog > -- Kees Cook ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
Re: [PATCH 2/3] binder: do not initialize locals passed to copy_from_user()
On Mon, Feb 24, 2020 at 04:35:00PM +0100, gli...@google.com wrote: > Certain copy_from_user() invocations in binder.c are known to > unconditionally initialize locals before their first use, like e.g. in > the following case: > > struct binder_transaction_data tr; > if (copy_from_user(&tr, ptr, sizeof(tr))) > return -EFAULT; > > In such cases enabling CONFIG_INIT_STACK_ALL leads to insertion of > redundant locals initialization that the compiler fails to remove. > To work around this problem till Clang can deal with it, we apply > __do_not_initialize to local Binder structures. It should be possible to write a Coccinelle script to identify all these cases. (i.e. a single path from struct declaration to copy_from_user()) and apply the changes automatically. This script could be checked into scripts/coccinelle/ to help keep these markings in sync... -Kees > > Cc: Kees Cook > Cc: Greg Kroah-Hartman > Signed-off-by: Alexander Potapenko > --- > drivers/android/binder.c | 12 ++-- > 1 file changed, 6 insertions(+), 6 deletions(-) > > diff --git a/drivers/android/binder.c b/drivers/android/binder.c > index a6b2082c24f8f..3c91d842ac704 100644 > --- a/drivers/android/binder.c > +++ b/drivers/android/binder.c > @@ -3788,7 +3788,7 @@ static int binder_thread_write(struct binder_proc *proc, > > case BC_TRANSACTION_SG: > case BC_REPLY_SG: { > - struct binder_transaction_data_sg tr; > + struct binder_transaction_data_sg tr > __do_not_initialize; > > if (copy_from_user(&tr, ptr, sizeof(tr))) > return -EFAULT; > @@ -3799,7 +3799,7 @@ static int binder_thread_write(struct binder_proc *proc, > } > case BC_TRANSACTION: > case BC_REPLY: { > - struct binder_transaction_data tr; > + struct binder_transaction_data tr __do_not_initialize; > > if (copy_from_user(&tr, ptr, sizeof(tr))) > return -EFAULT; > @@ -4827,7 +4827,7 @@ static int binder_ioctl_write_read(struct file *filp, > struct binder_proc *proc = filp->private_data; > unsigned int size = _IOC_SIZE(cmd); > void __user *ubuf = (void __user *)arg; > - struct binder_write_read bwr; > + struct binder_write_read bwr __do_not_initialize; > > if (size != sizeof(struct binder_write_read)) { > ret = -EINVAL; > @@ -5039,7 +5039,7 @@ static long binder_ioctl(struct file *filp, unsigned > int cmd, unsigned long arg) > break; > } > case BINDER_SET_CONTEXT_MGR_EXT: { > - struct flat_binder_object fbo; > + struct flat_binder_object fbo __do_not_initialize; > > if (copy_from_user(&fbo, ubuf, sizeof(fbo))) { > ret = -EINVAL; > @@ -5076,7 +5076,7 @@ static long binder_ioctl(struct file *filp, unsigned > int cmd, unsigned long arg) > break; > } > case BINDER_GET_NODE_INFO_FOR_REF: { > - struct binder_node_info_for_ref info; > + struct binder_node_info_for_ref info __do_not_initialize; > > if (copy_from_user(&info, ubuf, sizeof(info))) { > ret = -EFAULT; > @@ -5095,7 +5095,7 @@ static long binder_ioctl(struct file *filp, unsigned > int cmd, unsigned long arg) > break; > } > case BINDER_GET_NODE_DEBUG_INFO: { > - struct binder_node_debug_info info; > + struct binder_node_debug_info info __do_not_initialize; > > if (copy_from_user(&info, ubuf, sizeof(info))) { > ret = -EFAULT; > -- > 2.25.0.265.gbab2e86ba0-goog > -- Kees Cook ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH v7 2/2] drm/bridge: anx7625: Add anx7625 MIPI DSI/DPI to DP bridge driver
The ANX7625 is an ultra-low power 4K Mobile HD Transmitter designed for portable device. It converts MIPI DSI/DPI to DisplayPort 1.3 4K. The ANX7625 can support both USB Type-C PD feature and MIPI DSI/DPI to DP feature. This driver only enabled MIPI DSI/DPI to DP feature. Signed-off-by: Xin Ji --- drivers/gpu/drm/bridge/Makefile |2 +- drivers/gpu/drm/bridge/analogix/Kconfig |6 + drivers/gpu/drm/bridge/analogix/Makefile |1 + drivers/gpu/drm/bridge/analogix/anx7625.c | 2172 + drivers/gpu/drm/bridge/analogix/anx7625.h | 410 ++ 5 files changed, 2590 insertions(+), 1 deletion(-) create mode 100644 drivers/gpu/drm/bridge/analogix/anx7625.c create mode 100644 drivers/gpu/drm/bridge/analogix/anx7625.h diff --git a/drivers/gpu/drm/bridge/Makefile b/drivers/gpu/drm/bridge/Makefile index 4934fcf..bcd388a 100644 --- a/drivers/gpu/drm/bridge/Makefile +++ b/drivers/gpu/drm/bridge/Makefile @@ -12,8 +12,8 @@ obj-$(CONFIG_DRM_SII9234) += sii9234.o obj-$(CONFIG_DRM_THINE_THC63LVD1024) += thc63lvd1024.o obj-$(CONFIG_DRM_TOSHIBA_TC358764) += tc358764.o obj-$(CONFIG_DRM_TOSHIBA_TC358767) += tc358767.o -obj-$(CONFIG_DRM_ANALOGIX_DP) += analogix/ obj-$(CONFIG_DRM_I2C_ADV7511) += adv7511/ obj-$(CONFIG_DRM_TI_SN65DSI86) += ti-sn65dsi86.o obj-$(CONFIG_DRM_TI_TFP410) += ti-tfp410.o +obj-y += analogix/ obj-y += synopsys/ diff --git a/drivers/gpu/drm/bridge/analogix/Kconfig b/drivers/gpu/drm/bridge/analogix/Kconfig index e930ff9..b2f127e 100644 --- a/drivers/gpu/drm/bridge/analogix/Kconfig +++ b/drivers/gpu/drm/bridge/analogix/Kconfig @@ -2,3 +2,9 @@ config DRM_ANALOGIX_DP tristate depends on DRM + +config ANALOGIX_ANX7625 + tristate "Analogix MIPI to DP interface support" + help + ANX7625 is an ultra-low power 4K mobile HD transmitter designed + for portable devices. It converts MIPI/DPI to DisplayPort1.3 4K. diff --git a/drivers/gpu/drm/bridge/analogix/Makefile b/drivers/gpu/drm/bridge/analogix/Makefile index fdbf3fd..8a52867 100644 --- a/drivers/gpu/drm/bridge/analogix/Makefile +++ b/drivers/gpu/drm/bridge/analogix/Makefile @@ -1,3 +1,4 @@ # SPDX-License-Identifier: GPL-2.0-only +obj-$(CONFIG_ANALOGIX_ANX7625) += anx7625.o analogix_dp-objs := analogix_dp_core.o analogix_dp_reg.o obj-$(CONFIG_DRM_ANALOGIX_DP) += analogix_dp.o diff --git a/drivers/gpu/drm/bridge/analogix/anx7625.c b/drivers/gpu/drm/bridge/analogix/anx7625.c new file mode 100644 index 000..90a693a --- /dev/null +++ b/drivers/gpu/drm/bridge/analogix/anx7625.c @@ -0,0 +1,2172 @@ +// SPDX-License-Identifier: GPL-2.0-only +/* + * Copyright(c) 2016, Analogix Semiconductor. All rights reserved. + * + */ +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include + +#include "anx7625.h" + +/* + * there is a sync issue while access I2C register between AP(CPU) and + * internal firmware(OCM), to avoid the race condition, AP should access + * the reserved slave address before slave address occurs changes. + */ +static int i2c_access_workaround(struct anx7625_data *ctx, +struct i2c_client *client) +{ + u8 offset; + struct device *dev = &client->dev; + int ret; + + if (client == ctx->last_client) + return 0; + + ctx->last_client = client; + + if (client == ctx->i2c.tcpc_client) + offset = RSVD_00_ADDR; + else if (client == ctx->i2c.tx_p0_client) + offset = RSVD_D1_ADDR; + else if (client == ctx->i2c.tx_p1_client) + offset = RSVD_60_ADDR; + else if (client == ctx->i2c.rx_p0_client) + offset = RSVD_39_ADDR; + else if (client == ctx->i2c.rx_p1_client) + offset = RSVD_7F_ADDR; + else + offset = RSVD_00_ADDR; + + ret = i2c_smbus_write_byte_data(client, offset, 0x00); + if (ret < 0) + DRM_DEV_ERROR(dev, + "failed to access i2c id=%x\n:%x", + client->addr, offset); + + return ret; +} + +static int anx7625_reg_read(struct anx7625_data *ctx, + struct i2c_client *client, u8 reg_addr) +{ + int ret; + struct device *dev = &client->dev; + + i2c_access_workaround(ctx, client); + + ret = i2c_smbus_read_byte_data(client, reg_addr); + if (ret < 0) + DRM_DEV_ERROR(dev, "read i2c failed id=%x:%x\n", + client->addr, reg_addr); + + return ret; +} + +static int anx7625_reg_block_read(struct anx7625_data *ctx, + struct i2c_client *client, + u8 reg_addr, u8 len, u8 *buf) +{ + int ret; + str
[staging:staging-next] BUILD SUCCESS c85f15519d45588ce6ab8ad18616d2c0175a25d6
tree/branch: https://git.kernel.org/pub/scm/linux/kernel/git/gregkh/staging.git staging-next branch HEAD: c85f15519d45588ce6ab8ad18616d2c0175a25d6 Merge 5.6-rc3 into staging-next elapsed time: 1214m configs tested: 240 configs skipped: 0 The following configs have been built successfully. More configs may be tested in the coming days. arm allmodconfig arm allnoconfig arm allyesconfig arm64allmodconfig arm64 allnoconfig arm64allyesconfig arm at91_dt_defconfig arm efm32_defconfig arm exynos_defconfig armmulti_v5_defconfig armmulti_v7_defconfig armshmobile_defconfig arm sunxi_defconfig arm64 defconfig sparcallyesconfig nios2 3c120_defconfig pariscgeneric-64bit_defconfig nds32 allnoconfig s390 allyesconfig mips allmodconfig riscv rv32_defconfig m68k sun3_defconfig nds32 defconfig arc defconfig um i386_defconfig powerpc defconfig s390 alldefconfig s390 debug_defconfig powerpc ppc64_defconfig i386defconfig shallnoconfig h8300h8300h-sim_defconfig s390 allmodconfig um x86_64_defconfig i386 allnoconfig i386 alldefconfig i386 allyesconfig ia64 alldefconfig ia64 allmodconfig ia64 allnoconfig ia64 allyesconfig ia64defconfig c6x allyesconfig c6xevmc6678_defconfig nios2 10m50_defconfig openriscor1ksim_defconfig openrisc simple_smp_defconfig xtensa common_defconfig xtensa iss_defconfig alpha defconfig cskydefconfig h8300 edosk2674_defconfig h8300 h8s-sim_defconfig m68k allmodconfig m68k m5475evb_defconfig m68k multi_defconfig arc allyesconfig microblaze mmu_defconfig microblazenommu_defconfig powerpc allnoconfig powerpc rhel-kconfig mips 32r2_defconfig mips 64r6el_defconfig mips allnoconfig mips allyesconfig mips fuloong2e_defconfig mips malta_kvm_defconfig pariscallnoconfig parisc allyesconfig pariscgeneric-32bit_defconfig x86_64 randconfig-a001-20200224 x86_64 randconfig-a002-20200224 x86_64 randconfig-a003-20200224 i386 randconfig-a001-20200224 i386 randconfig-a002-20200224 i386 randconfig-a003-20200224 x86_64 randconfig-a001-20200225 x86_64 randconfig-a002-20200225 x86_64 randconfig-a003-20200225 i386 randconfig-a001-20200225 i386 randconfig-a002-20200225 i386 randconfig-a003-20200225 alpharandconfig-a001-20200224 m68k randconfig-a001-20200224 mips randconfig-a001-20200224 nds32randconfig-a001-20200224 parisc randconfig-a001-20200224 riscvrandconfig-a001-20200224 alpharandconfig-a001-20200225 m68k randconfig-a001-20200225 mips randconfig-a001-20200225 nds32randconfig-a001-20200225 parisc randconfig-a001-20200225 riscvrandconfig-a001-20200225 nios2randconfig-a001-20200224 c6x randconfig-a001-20200224 sparc64 randconfig-a001-20200224 microblaze randconfig-a001-20200224 h8300randconfig-a001-20200224 c6x randconfig-a001-20200225 h8300randconfig-a001-20200225
[PATCH v3 17/18] dt: bindings: net: add microchip,wilc1000,spi.yaml
From: Ajay Singh Moved '/drivers/staging/wilc1000//microchip,wilc1000,spi.yaml' to 'Documentation/devicetree/bindings/net/wireless/microchip,wilc1000,spi.yaml'. Signed-off-by: Ajay Singh --- .../net/wireless/microchip,wilc1000,spi.yaml | 61 +++ 1 file changed, 61 insertions(+) create mode 100644 Documentation/devicetree/bindings/net/wireless/microchip,wilc1000,spi.yaml diff --git a/Documentation/devicetree/bindings/net/wireless/microchip,wilc1000,spi.yaml b/Documentation/devicetree/bindings/net/wireless/microchip,wilc1000,spi.yaml new file mode 100644 index ..cc8ed64ce627 --- /dev/null +++ b/Documentation/devicetree/bindings/net/wireless/microchip,wilc1000,spi.yaml @@ -0,0 +1,61 @@ +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) +%YAML 1.2 +--- +$id: http://devicetree.org/schemas/net/wireless/microchip,wilc1000,spi.yaml# +$schema: http://devicetree.org/meta-schemas/core.yaml# + +title: Microchip WILC wireless SPI devicetree bindings + +maintainers: + - Adham Abozaeid + - Ajay Singh + +description: + The wilc1000 chips can be connected via SPI. This document describes + the binding for the SPI connected module. + +properties: + compatible: +const: microchip,wilc1000-spi + + spi-max-frequency: +description: Maximum SPI clocking speed of device in Hz. +maxItems: 1 + + reg: +description: Chip select address of device. +maxItems: 1 + + irq-gpios: +description: The GPIO phandle connect to a host IRQ. +maxItems: 1 + + clocks: +description: phandle to the clock connected on rtc clock line. +maxItems: 1 + +required: + - compatible + - spi-max-frequency + - reg + - irq-gpios + +examples: + - | +spi1: spi@fc018000 { + #address-cells = <1>; + #size-cells = <0>; + cs-gpios = <&pioB 21 0>; + status = "okay"; + wilc_spi@0 { +compatible = "microchip,wilc1000-spi"; +spi-max-frequency = <4800>; +reg = <0>; +irq-gpios = <&pioC 27 0>; +clocks = <&pck1>; +clock-names = "rtc_clk"; +assigned-clocks = <&pck1>; +assigned-clock-rates = <32768>; +status = "okay"; + }; +}; -- 2.24.0 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH v3 07/18] wilc1000: add cfg80211.h
From: Ajay Singh Moved 'drivers/staging/wilc1000/cfg80211.h' to 'drivers/net/wireless/microchip/wilc1000/cfg80211.h'. Signed-off-by: Ajay Singh --- .../wireless/microchip/wilc1000/cfg80211.h| 29 +++ 1 file changed, 29 insertions(+) create mode 100644 drivers/net/wireless/microchip/wilc1000/cfg80211.h diff --git a/drivers/net/wireless/microchip/wilc1000/cfg80211.h b/drivers/net/wireless/microchip/wilc1000/cfg80211.h new file mode 100644 index ..5e5d63f70df2 --- /dev/null +++ b/drivers/net/wireless/microchip/wilc1000/cfg80211.h @@ -0,0 +1,29 @@ +/* SPDX-License-Identifier: GPL-2.0 */ +/* + * Copyright (c) 2012 - 2018 Microchip Technology Inc., and its subsidiaries. + * All rights reserved. + */ + +#ifndef WILC_CFG80211_H +#define WILC_CFG80211_H +#include "netdev.h" + +struct wiphy *wilc_cfg_alloc(void); +int wilc_cfg80211_init(struct wilc **wilc, struct device *dev, int io_type, + const struct wilc_hif_func *ops); +struct wilc *wilc_create_wiphy(struct device *dev); +void wilc_deinit_host_int(struct net_device *net); +int wilc_init_host_int(struct net_device *net); +void wilc_wfi_monitor_rx(struct net_device *mon_dev, u8 *buff, u32 size); +struct wilc_vif *wilc_netdev_interface(struct wilc *wl, const char *name, + enum nl80211_iftype type); +void wilc_wfi_deinit_mon_interface(struct wilc *wl, bool rtnl_locked); +struct net_device *wilc_wfi_init_mon_interface(struct wilc *wl, + const char *name, + struct net_device *real_dev); +void wilc_mgmt_frame_register(struct wiphy *wiphy, struct wireless_dev *wdev, + u16 frame_type, bool reg); +struct wilc_vif *wilc_get_interface(struct wilc *wl); +struct wilc_vif *wilc_get_wl_to_vif(struct wilc *wl); +void wlan_deinit_locks(struct wilc *wilc); +#endif -- 2.24.0 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH v3 16/18] dt: bindings: net: add microchip,wilc1000,sdio.yaml
From: Ajay Singh Moved '/drivers/staging/wilc1000/microchip,wilc1000,sdio.yaml' to 'Documentation/devicetree/bindings/net/wireless/microchip,wilc1000,sdio.yaml'. Signed-off-by: Ajay Singh --- .../net/wireless/microchip,wilc1000,sdio.yaml | 68 +++ 1 file changed, 68 insertions(+) create mode 100644 Documentation/devicetree/bindings/net/wireless/microchip,wilc1000,sdio.yaml diff --git a/Documentation/devicetree/bindings/net/wireless/microchip,wilc1000,sdio.yaml b/Documentation/devicetree/bindings/net/wireless/microchip,wilc1000,sdio.yaml new file mode 100644 index ..b338f569f7e2 --- /dev/null +++ b/Documentation/devicetree/bindings/net/wireless/microchip,wilc1000,sdio.yaml @@ -0,0 +1,68 @@ +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) +%YAML 1.2 +--- +$id: http://devicetree.org/schemas/net/wireless/microchip,wilc1000,sdio.yaml# +$schema: http://devicetree.org/meta-schemas/core.yaml# + +title: Microchip WILC wireless SDIO devicetree bindings + +maintainers: + - Adham Abozaeid + - Ajay Singh + +description: + The wilc1000 chips can be connected via SDIO. The node is used to + specify child node to the SDIO controller that connects the device + to the system. + +properties: + compatible: +const: microchip,wilc1000-sdio + + irq-gpios: +description: The GPIO phandle connect to a host IRQ. +maxItems: 1 + + reg: +description: Slot ID used in the controller. +maxItems: 1 + + clocks: +description: phandle to the clock connected on rtc clock line. +maxItems: 1 + + bus-width: +description: The number of data lines wired up the slot. +allOf: + - $ref: /schemas/types.yaml#/definitions/uint32 + - enum: [1, 4, 8] + - default: 1 + +required: + - compatible + - irq-gpios + - reg + +examples: + - | +mmc1: mmc@fc00 { + #address-cells = <1>; + #size-cells = <0>; + pinctrl-names = "default"; + pinctrl-0 = <&pinctrl_mmc1_clk_cmd_dat0 &pinctrl_mmc1_dat1_3>; + non-removable; + vmmc-supply = <&vcc_mmc1_reg>; + vqmmc-supply = <&vcc_3v3_reg>; + status = "okay"; + wilc_sdio@0 { +compatible = "microchip,wilc1000-sdio"; + irq-gpios = <&pioC 27 0>; + reg = <0>; + clocks = <&pck1>; + clock-names = "rtc_clk"; + assigned-clocks = <&pck1>; + assigned-clock-rates = <32768>; + status = "okay"; + bus-width = <4>; +}; +}; -- 2.24.0 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH v3 14/18] wilc1000: add sdio.c
From: Ajay Singh Moved 'drivers/staging/wilc1000/sdio.c' to 'drivers/net/wireless/microchip/wilc1000/sdio.c'. Signed-off-by: Ajay Singh --- .../net/wireless/microchip/wilc1000/sdio.c| 1030 + 1 file changed, 1030 insertions(+) create mode 100644 drivers/net/wireless/microchip/wilc1000/sdio.c diff --git a/drivers/net/wireless/microchip/wilc1000/sdio.c b/drivers/net/wireless/microchip/wilc1000/sdio.c new file mode 100644 index ..2301e90c21ca --- /dev/null +++ b/drivers/net/wireless/microchip/wilc1000/sdio.c @@ -0,0 +1,1030 @@ +// SPDX-License-Identifier: GPL-2.0 +/* + * Copyright (c) 2012 - 2018 Microchip Technology Inc., and its subsidiaries. + * All rights reserved. + */ + +#include +#include +#include +#include + +#include "netdev.h" +#include "cfg80211.h" + +#define SDIO_MODALIAS "wilc1000_sdio" + +#define SDIO_VENDOR_ID_WILC 0x0296 +#define SDIO_DEVICE_ID_WILC 0x5347 + +static const struct sdio_device_id wilc_sdio_ids[] = { + { SDIO_DEVICE(SDIO_VENDOR_ID_WILC, SDIO_DEVICE_ID_WILC) }, + { }, +}; + +#define WILC_SDIO_BLOCK_SIZE 512 + +struct wilc_sdio { + bool irq_gpio; + u32 block_size; + int has_thrpt_enh3; +}; + +struct sdio_cmd52 { + u32 read_write: 1; + u32 function: 3; + u32 raw:1; + u32 address:17; + u32 data: 8; +}; + +struct sdio_cmd53 { + u32 read_write: 1; + u32 function: 3; + u32 block_mode: 1; + u32 increment: 1; + u32 address:17; + u32 count: 9; + u8 *buffer; + u32 block_size; +}; + +static const struct wilc_hif_func wilc_hif_sdio; + +static void wilc_sdio_interrupt(struct sdio_func *func) +{ + sdio_release_host(func); + wilc_handle_isr(sdio_get_drvdata(func)); + sdio_claim_host(func); +} + +static int wilc_sdio_cmd52(struct wilc *wilc, struct sdio_cmd52 *cmd) +{ + struct sdio_func *func = container_of(wilc->dev, struct sdio_func, dev); + int ret; + u8 data; + + sdio_claim_host(func); + + func->num = cmd->function; + if (cmd->read_write) { /* write */ + if (cmd->raw) { + sdio_writeb(func, cmd->data, cmd->address, &ret); + data = sdio_readb(func, cmd->address, &ret); + cmd->data = data; + } else { + sdio_writeb(func, cmd->data, cmd->address, &ret); + } + } else {/* read */ + data = sdio_readb(func, cmd->address, &ret); + cmd->data = data; + } + + sdio_release_host(func); + + if (ret) + dev_err(&func->dev, "%s..failed, err(%d)\n", __func__, ret); + return ret; +} + +static int wilc_sdio_cmd53(struct wilc *wilc, struct sdio_cmd53 *cmd) +{ + struct sdio_func *func = container_of(wilc->dev, struct sdio_func, dev); + int size, ret; + + sdio_claim_host(func); + + func->num = cmd->function; + func->cur_blksize = cmd->block_size; + if (cmd->block_mode) + size = cmd->count * cmd->block_size; + else + size = cmd->count; + + if (cmd->read_write) { /* write */ + ret = sdio_memcpy_toio(func, cmd->address, + (void *)cmd->buffer, size); + } else {/* read */ + ret = sdio_memcpy_fromio(func, (void *)cmd->buffer, +cmd->address, size); + } + + sdio_release_host(func); + + if (ret) + dev_err(&func->dev, "%s..failed, err(%d)\n", __func__, ret); + + return ret; +} + +static int wilc_sdio_probe(struct sdio_func *func, + const struct sdio_device_id *id) +{ + struct wilc *wilc; + int ret; + struct gpio_desc *gpio = NULL; + struct wilc_sdio *sdio_priv; + + sdio_priv = kzalloc(sizeof(*sdio_priv), GFP_KERNEL); + if (!sdio_priv) + return -ENOMEM; + + if (IS_ENABLED(CONFIG_WILC1000_HW_OOB_INTR)) { + gpio = gpiod_get(&func->dev, "irq", GPIOD_IN); + if (IS_ERR(gpio)) { + /* get the GPIO descriptor from hardcode GPIO number */ + gpio = gpio_to_desc(GPIO_NUM); + if (!gpio) + dev_err(&func->dev, "failed to get irq gpio\n"); + } + } + + ret = wilc_cfg80211_init(&wilc, &func->dev, WILC_HIF_SDIO, +&wilc_hif_sdio); + if (ret) { + kfree(sdio_priv); + return ret; + } + sdio_set_drvdata(func, wilc); + wilc->bus_data = sdio_priv; + wilc->dev = &func->dev; + wilc->gpio_irq = gpio; + + wilc->rtc_clk = devm_clk_get(&func->card->dev, "rtc_clk"); +
[PATCH v3 02/18] wilc1000: add hif.c
From: Ajay Singh Moved 'drivers/staging/wilc1000/hif.c' to 'drivers/net/wireless/microchip/wilc1000/hif.c'. Signed-off-by: Ajay Singh --- drivers/net/wireless/microchip/wilc1000/hif.c | 1959 + 1 file changed, 1959 insertions(+) create mode 100644 drivers/net/wireless/microchip/wilc1000/hif.c diff --git a/drivers/net/wireless/microchip/wilc1000/hif.c b/drivers/net/wireless/microchip/wilc1000/hif.c new file mode 100644 index ..c8c41c2df4ec --- /dev/null +++ b/drivers/net/wireless/microchip/wilc1000/hif.c @@ -0,0 +1,1959 @@ +// SPDX-License-Identifier: GPL-2.0 +/* + * Copyright (c) 2012 - 2018 Microchip Technology Inc., and its subsidiaries. + * All rights reserved. + */ + +#include "netdev.h" + +#define WILC_HIF_SCAN_TIMEOUT_MS5000 +#define WILC_HIF_CONNECT_TIMEOUT_MS 9500 + +#define WILC_FALSE_FRMWR_CHANNEL 100 + +struct wilc_rcvd_mac_info { + u8 status; +}; + +struct wilc_set_multicast { + u32 enabled; + u32 cnt; + u8 *mc_list; +}; + +struct wilc_del_all_sta { + u8 assoc_sta; + u8 mac[WILC_MAX_NUM_STA][ETH_ALEN]; +}; + +union wilc_message_body { + struct wilc_rcvd_net_info net_info; + struct wilc_rcvd_mac_info mac_info; + struct wilc_set_multicast mc_info; + struct wilc_remain_ch remain_on_ch; + char *data; +}; + +struct host_if_msg { + union wilc_message_body body; + struct wilc_vif *vif; + struct work_struct work; + void (*fn)(struct work_struct *ws); + struct completion work_comp; + bool is_sync; +}; + +/* 'msg' should be free by the caller for syc */ +static struct host_if_msg* +wilc_alloc_work(struct wilc_vif *vif, void (*work_fun)(struct work_struct *), + bool is_sync) +{ + struct host_if_msg *msg; + + if (!work_fun) + return ERR_PTR(-EINVAL); + + msg = kzalloc(sizeof(*msg), GFP_ATOMIC); + if (!msg) + return ERR_PTR(-ENOMEM); + msg->fn = work_fun; + msg->vif = vif; + msg->is_sync = is_sync; + if (is_sync) + init_completion(&msg->work_comp); + + return msg; +} + +static int wilc_enqueue_work(struct host_if_msg *msg) +{ + INIT_WORK(&msg->work, msg->fn); + + if (!msg->vif || !msg->vif->wilc || !msg->vif->wilc->hif_workqueue) + return -EINVAL; + + if (!queue_work(msg->vif->wilc->hif_workqueue, &msg->work)) + return -EINVAL; + + return 0; +} + +/* The idx starts from 0 to (NUM_CONCURRENT_IFC - 1), but 0 index used as + * special purpose in wilc device, so we add 1 to the index to starts from 1. + * As a result, the returned index will be 1 to NUM_CONCURRENT_IFC. + */ +int wilc_get_vif_idx(struct wilc_vif *vif) +{ + return vif->idx + 1; +} + +/* We need to minus 1 from idx which is from wilc device to get real index + * of wilc->vif[], because we add 1 when pass to wilc device in the function + * wilc_get_vif_idx. + * As a result, the index should be between 0 and (NUM_CONCURRENT_IFC - 1). + */ +static struct wilc_vif *wilc_get_vif_from_idx(struct wilc *wilc, int idx) +{ + int index = idx - 1; + struct wilc_vif *vif; + + if (index < 0 || index >= WILC_NUM_CONCURRENT_IFC) + return NULL; + + list_for_each_entry_rcu(vif, &wilc->vif_list, list) { + if (vif->idx == index) + return vif; + } + + return NULL; +} + +static int handle_scan_done(struct wilc_vif *vif, enum scan_event evt) +{ + int result = 0; + u8 abort_running_scan; + struct wid wid; + struct host_if_drv *hif_drv = vif->hif_drv; + struct wilc_user_scan_req *scan_req; + + if (evt == SCAN_EVENT_ABORTED) { + abort_running_scan = 1; + wid.id = WID_ABORT_RUNNING_SCAN; + wid.type = WID_CHAR; + wid.val = (s8 *)&abort_running_scan; + wid.size = sizeof(char); + + result = wilc_send_config_pkt(vif, WILC_SET_CFG, &wid, 1); + if (result) { + netdev_err(vif->ndev, "Failed to set abort running\n"); + result = -EFAULT; + } + } + + if (!hif_drv) { + netdev_err(vif->ndev, "%s: hif driver is NULL\n", __func__); + return result; + } + + scan_req = &hif_drv->usr_scan_req; + if (scan_req->scan_result) { + scan_req->scan_result(evt, NULL, scan_req->arg); + scan_req->scan_result = NULL; + } + + return result; +} + +int wilc_scan(struct wilc_vif *vif, u8 scan_source, u8 scan_type, + u8 *ch_freq_list, u8 ch_list_len, + void (*scan_result_fn)(enum scan_event, +struct wilc_rcvd_net_info *, void *), + void *user_arg, struct cfg80211_scan_request *request) +{ + int result = 0; + struct
[PATCH v3 05/18] wilc1000: add wlan_cfg.c
From: Ajay Singh Moved 'drivers/staging/wilc1000/wlan_cfg.c' to 'drivers/net/wireless/microchip/wilc1000/wlan_cfg.c'. Signed-off-by: Ajay Singh --- .../wireless/microchip/wilc1000/wlan_cfg.c| 413 ++ 1 file changed, 413 insertions(+) create mode 100644 drivers/net/wireless/microchip/wilc1000/wlan_cfg.c diff --git a/drivers/net/wireless/microchip/wilc1000/wlan_cfg.c b/drivers/net/wireless/microchip/wilc1000/wlan_cfg.c new file mode 100644 index ..fe2a7ed8e5cd --- /dev/null +++ b/drivers/net/wireless/microchip/wilc1000/wlan_cfg.c @@ -0,0 +1,413 @@ +// SPDX-License-Identifier: GPL-2.0 +/* + * Copyright (c) 2012 - 2018 Microchip Technology Inc., and its subsidiaries. + * All rights reserved. + */ + +#include +#include "wlan_if.h" +#include "wlan.h" +#include "wlan_cfg.h" +#include "netdev.h" + +enum cfg_cmd_type { + CFG_BYTE_CMD= 0, + CFG_HWORD_CMD = 1, + CFG_WORD_CMD= 2, + CFG_STR_CMD = 3, + CFG_BIN_CMD = 4 +}; + +static const struct wilc_cfg_byte g_cfg_byte[] = { + {WID_STATUS, 0}, + {WID_RSSI, 0}, + {WID_LINKSPEED, 0}, + {WID_NIL, 0} +}; + +static const struct wilc_cfg_hword g_cfg_hword[] = { + {WID_NIL, 0} +}; + +static const struct wilc_cfg_word g_cfg_word[] = { + {WID_FAILED_COUNT, 0}, + {WID_RECEIVED_FRAGMENT_COUNT, 0}, + {WID_SUCCESS_FRAME_COUNT, 0}, + {WID_GET_INACTIVE_TIME, 0}, + {WID_NIL, 0} + +}; + +static const struct wilc_cfg_str g_cfg_str[] = { + {WID_FIRMWARE_VERSION, NULL}, + {WID_MAC_ADDR, NULL}, + {WID_ASSOC_RES_INFO, NULL}, + {WID_NIL, NULL} +}; + +#define WILC_RESP_MSG_TYPE_CONFIG_REPLY'R' +#define WILC_RESP_MSG_TYPE_STATUS_INFO 'I' +#define WILC_RESP_MSG_TYPE_NETWORK_INFO'N' +#define WILC_RESP_MSG_TYPE_SCAN_COMPLETE 'S' + +/ + * + * Configuration Functions + * + / + +static int wilc_wlan_cfg_set_byte(u8 *frame, u32 offset, u16 id, u8 val8) +{ + if ((offset + 4) >= WILC_MAX_CFG_FRAME_SIZE) + return 0; + + put_unaligned_le16(id, &frame[offset]); + put_unaligned_le16(1, &frame[offset + 2]); + frame[offset + 4] = val8; + return 5; +} + +static int wilc_wlan_cfg_set_hword(u8 *frame, u32 offset, u16 id, u16 val16) +{ + if ((offset + 5) >= WILC_MAX_CFG_FRAME_SIZE) + return 0; + + put_unaligned_le16(id, &frame[offset]); + put_unaligned_le16(2, &frame[offset + 2]); + put_unaligned_le16(val16, &frame[offset + 4]); + + return 6; +} + +static int wilc_wlan_cfg_set_word(u8 *frame, u32 offset, u16 id, u32 val32) +{ + if ((offset + 7) >= WILC_MAX_CFG_FRAME_SIZE) + return 0; + + put_unaligned_le16(id, &frame[offset]); + put_unaligned_le16(4, &frame[offset + 2]); + put_unaligned_le32(val32, &frame[offset + 4]); + + return 8; +} + +static int wilc_wlan_cfg_set_str(u8 *frame, u32 offset, u16 id, u8 *str, +u32 size) +{ + if ((offset + size + 4) >= WILC_MAX_CFG_FRAME_SIZE) + return 0; + + put_unaligned_le16(id, &frame[offset]); + put_unaligned_le16(size, &frame[offset + 2]); + if (str && size != 0) + memcpy(&frame[offset + 4], str, size); + + return (size + 4); +} + +static int wilc_wlan_cfg_set_bin(u8 *frame, u32 offset, u16 id, u8 *b, u32 size) +{ + u32 i; + u8 checksum = 0; + + if ((offset + size + 5) >= WILC_MAX_CFG_FRAME_SIZE) + return 0; + + put_unaligned_le16(id, &frame[offset]); + put_unaligned_le16(size, &frame[offset + 2]); + + if ((b) && size != 0) { + memcpy(&frame[offset + 4], b, size); + for (i = 0; i < size; i++) + checksum += frame[offset + i + 4]; + } + + frame[offset + size + 4] = checksum; + + return (size + 5); +} + +/ + * + * Configuration Response Functions + * + / + +static void wilc_wlan_parse_response_frame(struct wilc *wl, u8 *info, int size) +{ + u16 wid; + u32 len = 0, i = 0; + struct wilc_cfg *cfg = &wl->cfg; + + while (size > 0) { + i = 0; + wid = get_unaligned_le16(info); + + switch (FIELD_GET(WILC_WID_TYPE, wid)) { + case WID_CHAR: + while (cfg->b[i].id != WID_NIL && cfg->b[i].id != wid) + i++; + + if (cfg->b[i].id == wid) + cfg->b[i].val = info[4]; + + len = 3; + break; + + case WID_SHORT: + while (cfg->hw[i].id != WID_NIL && cfg->hw[i].id != wid) + i++; +
[PATCH v3 15/18] wilc1000: add fw.h
From: Ajay Singh Moved 'drivers/staging/wilc1000/fw.h' to 'drivers/net/wireless/microchip/wilc1000/fw.h'. Signed-off-by: Ajay Singh --- drivers/net/wireless/microchip/wilc1000/fw.h | 119 +++ 1 file changed, 119 insertions(+) create mode 100644 drivers/net/wireless/microchip/wilc1000/fw.h diff --git a/drivers/net/wireless/microchip/wilc1000/fw.h b/drivers/net/wireless/microchip/wilc1000/fw.h new file mode 100644 index ..a76e1dea4345 --- /dev/null +++ b/drivers/net/wireless/microchip/wilc1000/fw.h @@ -0,0 +1,119 @@ +/* SPDX-License-Identifier: GPL-2.0 */ +/* + * Copyright (c) 2012 - 2018 Microchip Technology Inc., and its subsidiaries. + * All rights reserved. + */ + +#ifndef WILC_FW_H +#define WILC_FW_H + +#include + +#define WILC_MAX_NUM_STA 9 +#define WILC_MAX_RATES_SUPPORTED 12 +#define WILC_MAX_NUM_PMKIDS16 +#define WILC_MAX_NUM_SCANNED_CH14 + +struct wilc_assoc_resp { + __le16 capab_info; + __le16 status_code; + __le16 aid; +} __packed; + +struct wilc_pmkid { + u8 bssid[ETH_ALEN]; + u8 pmkid[WLAN_PMKID_LEN]; +} __packed; + +struct wilc_pmkid_attr { + u8 numpmkid; + struct wilc_pmkid pmkidlist[WILC_MAX_NUM_PMKIDS]; +} __packed; + +struct wilc_reg_frame { + u8 reg; + u8 reg_id; + __le16 frame_type; +} __packed; + +struct wilc_drv_handler { + __le32 handler; + u8 mode; +} __packed; + +struct wilc_wep_key { + u8 index; + u8 key_len; + u8 key[0]; +} __packed; + +struct wilc_sta_wpa_ptk { + u8 mac_addr[ETH_ALEN]; + u8 key_len; + u8 key[0]; +} __packed; + +struct wilc_ap_wpa_ptk { + u8 mac_addr[ETH_ALEN]; + u8 index; + u8 key_len; + u8 key[0]; +} __packed; + +struct wilc_gtk_key { + u8 mac_addr[ETH_ALEN]; + u8 rsc[8]; + u8 index; + u8 key_len; + u8 key[0]; +} __packed; + +struct wilc_op_mode { + __le32 mode; +} __packed; + +struct wilc_noa_opp_enable { + u8 ct_window; + u8 cnt; + __le32 duration; + __le32 interval; + __le32 start_time; +} __packed; + +struct wilc_noa_opp_disable { + u8 cnt; + __le32 duration; + __le32 interval; + __le32 start_time; +} __packed; + +struct wilc_join_bss_param { + char ssid[IEEE80211_MAX_SSID_LEN]; + u8 ssid_terminator; + u8 bss_type; + u8 ch; + __le16 cap_info; + u8 sa[ETH_ALEN]; + u8 bssid[ETH_ALEN]; + __le16 beacon_period; + u8 dtim_period; + u8 supp_rates[WILC_MAX_RATES_SUPPORTED + 1]; + u8 wmm_cap; + u8 uapsd_cap; + u8 ht_capable; + u8 rsn_found; + u8 rsn_grp_policy; + u8 mode_802_11i; + u8 p_suites[3]; + u8 akm_suites[3]; + u8 rsn_cap[2]; + u8 noa_enabled; + __le32 tsf_lo; + u8 idx; + u8 opp_enabled; + union { + struct wilc_noa_opp_disable opp_dis; + struct wilc_noa_opp_enable opp_en; + }; +} __packed; +#endif -- 2.24.0 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH v3 11/18] wilc1000: add spi.c
From: Ajay Singh Moved 'drivers/staging/wilc1000/spi.c' to 'drivers/net/wireless/microchip/wilc1000/spi.c'. Signed-off-by: Ajay Singh --- drivers/net/wireless/microchip/wilc1000/spi.c | 1001 + 1 file changed, 1001 insertions(+) create mode 100644 drivers/net/wireless/microchip/wilc1000/spi.c diff --git a/drivers/net/wireless/microchip/wilc1000/spi.c b/drivers/net/wireless/microchip/wilc1000/spi.c new file mode 100644 index ..11653ac118cd --- /dev/null +++ b/drivers/net/wireless/microchip/wilc1000/spi.c @@ -0,0 +1,1001 @@ +// SPDX-License-Identifier: GPL-2.0 +/* + * Copyright (c) 2012 - 2018 Microchip Technology Inc., and its subsidiaries. + * All rights reserved. + */ + +#include +#include + +#include "netdev.h" +#include "cfg80211.h" + +struct wilc_spi { + int crc_off; +}; + +static const struct wilc_hif_func wilc_hif_spi; + +/ + * + * Crc7 + * + / + +static const u8 crc7_syndrome_table[256] = { + 0x00, 0x09, 0x12, 0x1b, 0x24, 0x2d, 0x36, 0x3f, + 0x48, 0x41, 0x5a, 0x53, 0x6c, 0x65, 0x7e, 0x77, + 0x19, 0x10, 0x0b, 0x02, 0x3d, 0x34, 0x2f, 0x26, + 0x51, 0x58, 0x43, 0x4a, 0x75, 0x7c, 0x67, 0x6e, + 0x32, 0x3b, 0x20, 0x29, 0x16, 0x1f, 0x04, 0x0d, + 0x7a, 0x73, 0x68, 0x61, 0x5e, 0x57, 0x4c, 0x45, + 0x2b, 0x22, 0x39, 0x30, 0x0f, 0x06, 0x1d, 0x14, + 0x63, 0x6a, 0x71, 0x78, 0x47, 0x4e, 0x55, 0x5c, + 0x64, 0x6d, 0x76, 0x7f, 0x40, 0x49, 0x52, 0x5b, + 0x2c, 0x25, 0x3e, 0x37, 0x08, 0x01, 0x1a, 0x13, + 0x7d, 0x74, 0x6f, 0x66, 0x59, 0x50, 0x4b, 0x42, + 0x35, 0x3c, 0x27, 0x2e, 0x11, 0x18, 0x03, 0x0a, + 0x56, 0x5f, 0x44, 0x4d, 0x72, 0x7b, 0x60, 0x69, + 0x1e, 0x17, 0x0c, 0x05, 0x3a, 0x33, 0x28, 0x21, + 0x4f, 0x46, 0x5d, 0x54, 0x6b, 0x62, 0x79, 0x70, + 0x07, 0x0e, 0x15, 0x1c, 0x23, 0x2a, 0x31, 0x38, + 0x41, 0x48, 0x53, 0x5a, 0x65, 0x6c, 0x77, 0x7e, + 0x09, 0x00, 0x1b, 0x12, 0x2d, 0x24, 0x3f, 0x36, + 0x58, 0x51, 0x4a, 0x43, 0x7c, 0x75, 0x6e, 0x67, + 0x10, 0x19, 0x02, 0x0b, 0x34, 0x3d, 0x26, 0x2f, + 0x73, 0x7a, 0x61, 0x68, 0x57, 0x5e, 0x45, 0x4c, + 0x3b, 0x32, 0x29, 0x20, 0x1f, 0x16, 0x0d, 0x04, + 0x6a, 0x63, 0x78, 0x71, 0x4e, 0x47, 0x5c, 0x55, + 0x22, 0x2b, 0x30, 0x39, 0x06, 0x0f, 0x14, 0x1d, + 0x25, 0x2c, 0x37, 0x3e, 0x01, 0x08, 0x13, 0x1a, + 0x6d, 0x64, 0x7f, 0x76, 0x49, 0x40, 0x5b, 0x52, + 0x3c, 0x35, 0x2e, 0x27, 0x18, 0x11, 0x0a, 0x03, + 0x74, 0x7d, 0x66, 0x6f, 0x50, 0x59, 0x42, 0x4b, + 0x17, 0x1e, 0x05, 0x0c, 0x33, 0x3a, 0x21, 0x28, + 0x5f, 0x56, 0x4d, 0x44, 0x7b, 0x72, 0x69, 0x60, + 0x0e, 0x07, 0x1c, 0x15, 0x2a, 0x23, 0x38, 0x31, + 0x46, 0x4f, 0x54, 0x5d, 0x62, 0x6b, 0x70, 0x79 +}; + +static u8 crc7_byte(u8 crc, u8 data) +{ + return crc7_syndrome_table[(crc << 1) ^ data]; +} + +static u8 crc7(u8 crc, const u8 *buffer, u32 len) +{ + while (len--) + crc = crc7_byte(crc, *buffer++); + return crc; +} + +static u8 wilc_get_crc7(u8 *buffer, u32 len) +{ + return crc7(0x7f, (const u8 *)buffer, len) << 1; +} + +/ + * + * Spi protocol Function + * + / + +#define CMD_DMA_WRITE 0xc1 +#define CMD_DMA_READ 0xc2 +#define CMD_INTERNAL_WRITE 0xc3 +#define CMD_INTERNAL_READ 0xc4 +#define CMD_TERMINATE 0xc5 +#define CMD_REPEAT 0xc6 +#define CMD_DMA_EXT_WRITE 0xc7 +#define CMD_DMA_EXT_READ 0xc8 +#define CMD_SINGLE_WRITE 0xc9 +#define CMD_SINGLE_READ0xca +#define CMD_RESET 0xcf + +#define DATA_PKT_SZ_256256 +#define DATA_PKT_SZ_512512 +#define DATA_PKT_SZ_1K 1024 +#define DATA_PKT_SZ_4K (4 * 1024) +#define DATA_PKT_SZ_8K (8 * 1024) +#define DATA_PKT_SZDATA_PKT_SZ_8K + +#define USE_SPI_DMA0 + +#define WILC_SPI_COMMAND_STAT_SUCCESS 0 +#define WILC_GET_RESP_HDR_START(h) (((h) >> 4) & 0xf) + +struct wilc_spi_cmd { + u8 cmd_type; + union { + struct { + u8 addr[3]; + u8 crc[0]; + } __packed simple_cmd; + struct { + u8 addr[3]; + u8 size[2]; + u8 crc[0]; + } __packed dma_cmd; + struct { + u8 addr[3]; + u8 size[3]; + u8 crc[0]; + } __packed dma_cmd_ext; +
[PATCH v3 03/18] wilc1000: add wlan_if.h
From: Ajay Singh Moved 'drivers/staging/wilc1000/wlan_if.h' to 'drivers/net/wireless/microchip/wilc1000/wlan_if.h'. Signed-off-by: Ajay Singh --- .../net/wireless/microchip/wilc1000/wlan_if.h | 803 ++ 1 file changed, 803 insertions(+) create mode 100644 drivers/net/wireless/microchip/wilc1000/wlan_if.h diff --git a/drivers/net/wireless/microchip/wilc1000/wlan_if.h b/drivers/net/wireless/microchip/wilc1000/wlan_if.h new file mode 100644 index ..f85fd575136d --- /dev/null +++ b/drivers/net/wireless/microchip/wilc1000/wlan_if.h @@ -0,0 +1,803 @@ +/* SPDX-License-Identifier: GPL-2.0 */ +/* + * Copyright (c) 2012 - 2018 Microchip Technology Inc., and its subsidiaries. + * All rights reserved. + */ + +#ifndef WILC_WLAN_IF_H +#define WILC_WLAN_IF_H + +#include +#include "fw.h" + +/ + * + * Wlan Configuration ID + * + / + +enum bss_types { + WILC_FW_BSS_TYPE_INFRA = 0, + WILC_FW_BSS_TYPE_INDEPENDENT, + WILC_FW_BSS_TYPE_AP, +}; + +enum { + WILC_FW_OPER_MODE_B_ONLY = 0,/* 1, 2 M, otherwise 5, 11 M */ + WILC_FW_OPER_MODE_G_ONLY,/* 6,12,24 otherwise 9,18,36,48,54 */ + WILC_FW_OPER_MODE_G_MIXED_11B_1, /* 1,2,5.5,11 otherwise all on */ + WILC_FW_OPER_MODE_G_MIXED_11B_2, /* 1,2,5,11,6,12,24 otherwise all on */ +}; + +enum { + WILC_FW_PREAMBLE_SHORT = 0, /* Short Preamble */ + WILC_FW_PREAMBLE_LONG = 1, /* Long Preamble */ + WILC_FW_PREAMBLE_AUTO = 2, /* Auto Preamble Selection */ +}; + +enum { + WILC_FW_PASSIVE_SCAN = 0, + WILC_FW_ACTIVE_SCAN = 1, +}; + +enum { + WILC_FW_NO_POWERSAVE = 0, + WILC_FW_MIN_FAST_PS = 1, + WILC_FW_MAX_FAST_PS = 2, + WILC_FW_MIN_PSPOLL_PS = 3, + WILC_FW_MAX_PSPOLL_PS = 4 +}; + +enum chip_ps_states { + WILC_CHIP_WAKEDUP = 0, + WILC_CHIP_SLEEPING_AUTO = 1, + WILC_CHIP_SLEEPING_MANUAL = 2 +}; + +enum bus_acquire { + WILC_BUS_ACQUIRE_ONLY = 0, + WILC_BUS_ACQUIRE_AND_WAKEUP = 1, +}; + +enum bus_release { + WILC_BUS_RELEASE_ONLY = 0, + WILC_BUS_RELEASE_ALLOW_SLEEP = 1, +}; + +enum { + WILC_FW_NO_ENCRYPT = 0, + WILC_FW_ENCRYPT_ENABLED = BIT(0), + WILC_FW_WEP = BIT(1), + WILC_FW_WEP_EXTENDED = BIT(2), + WILC_FW_WPA = BIT(3), + WILC_FW_WPA2 = BIT(4), + WILC_FW_AES = BIT(5), + WILC_FW_TKIP = BIT(6) +}; + +enum { + WILC_FW_SEC_NO = WILC_FW_NO_ENCRYPT, + WILC_FW_SEC_WEP = WILC_FW_WEP | WILC_FW_ENCRYPT_ENABLED, + WILC_FW_SEC_WEP_EXTENDED = WILC_FW_WEP_EXTENDED | WILC_FW_SEC_WEP, + WILC_FW_SEC_WPA = WILC_FW_WPA | WILC_FW_ENCRYPT_ENABLED, + WILC_FW_SEC_WPA_AES = WILC_FW_AES | WILC_FW_SEC_WPA, + WILC_FW_SEC_WPA_TKIP = WILC_FW_TKIP | WILC_FW_SEC_WPA, + WILC_FW_SEC_WPA2 = WILC_FW_WPA2 | WILC_FW_ENCRYPT_ENABLED, + WILC_FW_SEC_WPA2_AES = WILC_FW_AES | WILC_FW_SEC_WPA2, + WILC_FW_SEC_WPA2_TKIP = WILC_FW_TKIP | WILC_FW_SEC_WPA2 +}; + +enum authtype { + WILC_FW_AUTH_OPEN_SYSTEM = 1, + WILC_FW_AUTH_SHARED_KEY = 2, + WILC_FW_AUTH_ANY = 3, + WILC_FW_AUTH_IEEE8021 = 5 +}; + +enum site_survey { + WILC_FW_SITE_SURVEY_1CH = 0, + WILC_FW_SITE_SURVEY_ALL_CH = 1, + WILC_FW_SITE_SURVEY_OFF = 2 +}; + +enum { + WILC_FW_ACK_POLICY_NORMAL = 0, + WILC_FW_ACK_NO_POLICY, +}; + +enum { + WILC_FW_REKEY_POLICY_DISABLE = 1, + WILC_FW_REKEY_POLICY_TIME_BASE, + WILC_FW_REKEY_POLICY_PKT_BASE, + WILC_FW_REKEY_POLICY_TIME_PKT_BASE +}; + +enum { + WILC_FW_FILTER_NO = 0x00, + WILC_FW_FILTER_AP_ONLY = 0x01, + WILC_FW_FILTER_STA_ONLY = 0x02 +}; + +enum { + WILC_FW_11N_PROT_AUTO = 0, /* Auto */ + WILC_FW_11N_NO_PROT,/* Do not use any protection */ + WILC_FW_11N_PROT_ERP, /* Protect all ERP frame exchanges */ + WILC_FW_11N_PROT_HT,/* Protect all HT frame exchanges */ + WILC_FW_11N_PROT_GF /* Protect all GF frame exchanges */ +}; + +enum { + WILC_FW_ERP_PROT_SELF_CTS, + WILC_FW_ERP_PROT_RTS_CTS, +}; + +enum { + WILC_FW_11N_OP_MODE_HT_MIXED = 1, + WILC_FW_11N_OP_MODE_HT_ONLY_20MHZ, + WILC_FW_11N_OP_MODE_HT_ONLY_20_40MHZ, +}; + +enum { + WILC_FW_OBBS_NONHT_NO_DETECT = 0, + WILC_FW_OBBS_NONHT_DETECT_ONLY = 1, + WILC_FW_OBBS_NONHT_DETECT_PROTECT = 2, + WILC_FW_OBBS_NONHT_DETECT_PROTECT_REPORT = 3, +}; + +enum { + WILC_FW_HT_PROT_RTS_CTS_NONHT = 0, /* RTS-CTS at non-HT rate */ + WILC_FW_HT_PROT_FIRST_FRAME_NONHT, /* First frame at non-HT rate */ + WILC_FW_HT_PROT_LSIG_TXOP, /* LSIG TXOP Protection */ + WILC_FW_HT_PROT_FIRST_FRAME_MIXED, /* First frame at Mixed format */ +}; + +enum { + WILC_FW_SMPS_MODE_STATIC = 1, + WILC_FW_SMPS_MODE_DYNAMIC = 2, + WILC_FW_SMPS_MODE_MIMO = 3,
[PATCH v3 10/18] wilc1000: add mon.c
From: Ajay Singh Moved 'drivers/staging/wilc1000/mon.c' to 'drivers/net/wireless/microchip/wilc1000/mon.c'. Signed-off-by: Ajay Singh --- drivers/net/wireless/microchip/wilc1000/mon.c | 260 ++ 1 file changed, 260 insertions(+) create mode 100644 drivers/net/wireless/microchip/wilc1000/mon.c diff --git a/drivers/net/wireless/microchip/wilc1000/mon.c b/drivers/net/wireless/microchip/wilc1000/mon.c new file mode 100644 index ..60331417bd98 --- /dev/null +++ b/drivers/net/wireless/microchip/wilc1000/mon.c @@ -0,0 +1,260 @@ +// SPDX-License-Identifier: GPL-2.0 +/* + * Copyright (c) 2012 - 2018 Microchip Technology Inc., and its subsidiaries. + * All rights reserved. + */ + +#include "cfg80211.h" + +struct wilc_wfi_radiotap_hdr { + struct ieee80211_radiotap_header hdr; + u8 rate; +} __packed; + +struct wilc_wfi_radiotap_cb_hdr { + struct ieee80211_radiotap_header hdr; + u8 rate; + u8 dump; + u16 tx_flags; +} __packed; + +#define TX_RADIOTAP_PRESENT ((1 << IEEE80211_RADIOTAP_RATE) | \ +(1 << IEEE80211_RADIOTAP_TX_FLAGS)) + +void wilc_wfi_monitor_rx(struct net_device *mon_dev, u8 *buff, u32 size) +{ + u32 header, pkt_offset; + struct sk_buff *skb = NULL; + struct wilc_wfi_radiotap_hdr *hdr; + struct wilc_wfi_radiotap_cb_hdr *cb_hdr; + + if (!mon_dev) + return; + + if (!netif_running(mon_dev)) + return; + + /* Get WILC header */ + header = get_unaligned_le32(buff - HOST_HDR_OFFSET); + /* +* The packet offset field contain info about what type of management +* the frame we are dealing with and ack status +*/ + pkt_offset = FIELD_GET(WILC_PKT_HDR_OFFSET_FIELD, header); + + if (pkt_offset & IS_MANAGMEMENT_CALLBACK) { + /* hostapd callback mgmt frame */ + + skb = dev_alloc_skb(size + sizeof(*cb_hdr)); + if (!skb) + return; + + skb_put_data(skb, buff, size); + + cb_hdr = skb_push(skb, sizeof(*cb_hdr)); + memset(cb_hdr, 0, sizeof(*cb_hdr)); + + cb_hdr->hdr.it_version = 0; /* PKTHDR_RADIOTAP_VERSION; */ + + cb_hdr->hdr.it_len = cpu_to_le16(sizeof(*cb_hdr)); + + cb_hdr->hdr.it_present = cpu_to_le32(TX_RADIOTAP_PRESENT); + + cb_hdr->rate = 5; + + if (pkt_offset & IS_MGMT_STATUS_SUCCES) { + /* success */ + cb_hdr->tx_flags = IEEE80211_RADIOTAP_F_TX_RTS; + } else { + cb_hdr->tx_flags = IEEE80211_RADIOTAP_F_TX_FAIL; + } + + } else { + skb = dev_alloc_skb(size + sizeof(*hdr)); + + if (!skb) + return; + + skb_put_data(skb, buff, size); + hdr = skb_push(skb, sizeof(*hdr)); + memset(hdr, 0, sizeof(struct wilc_wfi_radiotap_hdr)); + hdr->hdr.it_version = 0; /* PKTHDR_RADIOTAP_VERSION; */ + hdr->hdr.it_len = cpu_to_le16(sizeof(*hdr)); + hdr->hdr.it_present = cpu_to_le32 + (1 << IEEE80211_RADIOTAP_RATE); + hdr->rate = 5; + } + + skb->dev = mon_dev; + skb_reset_mac_header(skb); + skb->ip_summed = CHECKSUM_UNNECESSARY; + skb->pkt_type = PACKET_OTHERHOST; + skb->protocol = htons(ETH_P_802_2); + memset(skb->cb, 0, sizeof(skb->cb)); + + netif_rx(skb); +} + +struct tx_complete_mon_data { + int size; + void *buff; +}; + +static void mgmt_tx_complete(void *priv, int status) +{ + struct tx_complete_mon_data *pv_data = priv; + /* +* in case of fully hosting mode, the freeing will be done +* in response to the cfg packet +*/ + kfree(pv_data->buff); + + kfree(pv_data); +} + +static int mon_mgmt_tx(struct net_device *dev, const u8 *buf, size_t len) +{ + struct tx_complete_mon_data *mgmt_tx = NULL; + + if (!dev) + return -EFAULT; + + netif_stop_queue(dev); + mgmt_tx = kmalloc(sizeof(*mgmt_tx), GFP_ATOMIC); + if (!mgmt_tx) + return -ENOMEM; + + mgmt_tx->buff = kmemdup(buf, len, GFP_ATOMIC); + if (!mgmt_tx->buff) { + kfree(mgmt_tx); + return -ENOMEM; + } + + mgmt_tx->size = len; + + wilc_wlan_txq_add_mgmt_pkt(dev, mgmt_tx, mgmt_tx->buff, mgmt_tx->size, + mgmt_tx_complete); + + netif_wake_queue(dev); + return 0; +} + +static netdev_tx_t wilc_wfi_mon_xmit(struct sk_buff *skb, +struct net_device *dev) +{ + u32 rtap_len, ret = 0; + struct wilc_wfi_mon_priv *mon_priv; + struct sk_buff *skb2; + struct wilc_wfi_radiotap_cb_hdr *cb_hdr; + u8 srcadd[ETH_ALEN]; +
[PATCH v3 01/18] wilc1000: add hif.h
From: Ajay Singh Moved 'drivers/staging/wilc1000/hif.h' to 'drivers/net/wireless/microchip/wilc1000/hif.h'. Signed-off-by: Ajay Singh --- drivers/net/wireless/microchip/wilc1000/hif.h | 214 ++ 1 file changed, 214 insertions(+) create mode 100644 drivers/net/wireless/microchip/wilc1000/hif.h diff --git a/drivers/net/wireless/microchip/wilc1000/hif.h b/drivers/net/wireless/microchip/wilc1000/hif.h new file mode 100644 index ..db9179171f05 --- /dev/null +++ b/drivers/net/wireless/microchip/wilc1000/hif.h @@ -0,0 +1,214 @@ +/* SPDX-License-Identifier: GPL-2.0 */ +/* + * Copyright (c) 2012 - 2018 Microchip Technology Inc., and its subsidiaries + * All rights reserved. + */ + +#ifndef WILC_HIF_H +#define WILC_HIF_H +#include +#include "wlan_if.h" + +enum { + WILC_IDLE_MODE = 0x0, + WILC_AP_MODE = 0x1, + WILC_STATION_MODE = 0x2, + WILC_GO_MODE = 0x3, + WILC_CLIENT_MODE = 0x4 +}; + +#define WILC_MAX_NUM_PROBED_SSID 10 + +#define WILC_TX_MIC_KEY_LEN8 +#define WILC_RX_MIC_KEY_LEN8 + +#define WILC_ADD_STA_LENGTH40 +#define WILC_NUM_CONCURRENT_IFC2 + +enum { + WILC_SET_CFG = 0, + WILC_GET_CFG +}; + +#define WILC_MAX_ASSOC_RESP_FRAME_SIZE 256 + +struct rf_info { + u8 link_speed; + s8 rssi; + u32 tx_cnt; + u32 rx_cnt; + u32 tx_fail_cnt; +}; + +enum host_if_state { + HOST_IF_IDLE= 0, + HOST_IF_SCANNING= 1, + HOST_IF_CONNECTING = 2, + HOST_IF_WAITING_CONN_RESP = 3, + HOST_IF_CONNECTED = 4, + HOST_IF_P2P_LISTEN = 5, + HOST_IF_FORCE_32BIT = 0x +}; + +struct cfg_param_attr { + u32 flag; + u16 short_retry_limit; + u16 long_retry_limit; + u16 frag_threshold; + u16 rts_threshold; +}; + +enum cfg_param { + WILC_CFG_PARAM_RETRY_SHORT = BIT(0), + WILC_CFG_PARAM_RETRY_LONG = BIT(1), + WILC_CFG_PARAM_FRAG_THRESHOLD = BIT(2), + WILC_CFG_PARAM_RTS_THRESHOLD = BIT(3) +}; + +enum scan_event { + SCAN_EVENT_NETWORK_FOUND= 0, + SCAN_EVENT_DONE = 1, + SCAN_EVENT_ABORTED = 2, + SCAN_EVENT_FORCE_32BIT = 0x +}; + +enum conn_event { + CONN_DISCONN_EVENT_CONN_RESP= 0, + CONN_DISCONN_EVENT_DISCONN_NOTIF= 1, + CONN_DISCONN_EVENT_FORCE_32BIT = 0x +}; + +enum { + WILC_HIF_SDIO = 0, + WILC_HIF_SPI = BIT(0) +}; + +enum { + WILC_MAC_STATUS_INIT = -1, + WILC_MAC_STATUS_DISCONNECTED = 0, + WILC_MAC_STATUS_CONNECTED = 1 +}; + +struct wilc_rcvd_net_info { + s8 rssi; + u8 ch; + u16 frame_len; + struct ieee80211_mgmt *mgmt; +}; + +struct wilc_user_scan_req { + void (*scan_result)(enum scan_event evt, + struct wilc_rcvd_net_info *info, void *priv); + void *arg; + u32 ch_cnt; +}; + +struct wilc_conn_info { + u8 bssid[ETH_ALEN]; + u8 security; + enum authtype auth_type; + u8 ch; + u8 *req_ies; + size_t req_ies_len; + u8 *resp_ies; + u16 resp_ies_len; + u16 status; + void (*conn_result)(enum conn_event evt, u8 status, void *priv_data); + void *arg; + void *param; +}; + +struct wilc_remain_ch { + u16 ch; + u32 duration; + void (*expired)(void *priv, u64 cookie); + void *arg; + u32 cookie; +}; + +struct wilc; +struct host_if_drv { + struct wilc_user_scan_req usr_scan_req; + struct wilc_conn_info conn_info; + struct wilc_remain_ch remain_on_ch; + u64 p2p_timeout; + + enum host_if_state hif_state; + + u8 assoc_bssid[ETH_ALEN]; + + struct timer_list scan_timer; + struct wilc_vif *scan_timer_vif; + + struct timer_list connect_timer; + struct wilc_vif *connect_timer_vif; + + struct timer_list remain_on_ch_timer; + struct wilc_vif *remain_on_ch_timer_vif; + + bool ifc_up; + u8 assoc_resp[WILC_MAX_ASSOC_RESP_FRAME_SIZE]; +}; + +struct wilc_vif; +int wilc_remove_wep_key(struct wilc_vif *vif, u8 index); +int wilc_set_wep_default_keyid(struct wilc_vif *vif, u8 index); +int wilc_add_wep_key_bss_sta(struct wilc_vif *vif, const u8 *key, u8 len, +u8 index); +int wilc_add_wep_key_bss_ap(struct wilc_vif *vif, const u8 *key, u8 len, + u8 index, u8 mode, enum authtype auth_type); +int wilc_add_ptk(struct wilc_vif *vif, const u8 *ptk, u8 ptk_key_len, +const u8 *mac_addr, const u8 *rx_mic, const u8 *tx_mic, +u8 mode, u8 cipher_mode, u8 index); +s32 wilc_get_inactive_time(struct wilc_vif *vif, const u8 *mac, + u32 *out_val); +int wilc_add_rx_gtk(struct wilc_vif *vif,
[PATCH v3 00/18] wilc1000: move out of staging
From: Ajay Singh This patch series is to review and move wilc1000 driver out of staging. Most of the review comments received in [1] & [2] are addressed in the latest code. Please review and provide your inputs. [1]. https://lore.kernel.org/linux-wireless/1537957525-11467-1-git-send-email-ajay.kat...@microchip.com/ [2]. https://lore.kernel.org/linux-wireless/1562896697-8002-1-git-send-email-ajay.kat...@microchip.com/ Changes since v2: - use 'struct' to extract FW info from received commands. - make use of C style comments instead of C++. - remove use of bool type for firmware struct. - deleted unused code related to interrupt handling. - make use of RCU list to maintain interfaces list. - remove 'wilc_' prefix from file name. - added 'WILC_' prefix for header guard macro. - remove use of infinite loops(i.e. while(1)). - move firmware realted struct to a separate file. - refactor SPI command handling by using 'struct'. - use different functions to handle different SPI commands. - remove use of vendor specific IE for p2p handling. - refactor p2p related code to avoid use of buf pointer operation. - make use of FIELD_GET/PREP macro. - use #define instead of magic values. - use YAML schemes for DT binding documentation. - deleted unused code from spi.c and sdio.c. - added changes for few issues reported by smatch static code analyzer. Changes since v1: - remove use of shadow buffer to keep scan result. - remove internal messaging flow to handle cfg80211_ops. - make use of cfg80211 provide API. - use 'struct' for packing firmware commands. - make use of kernel API's and Macro. - remove unnecessary log messages - supported dynamically add/remove interfaces. - cleanup and deleted around 3.3k lines of code. Ajay Singh (18): wilc1000: add hif.h wilc1000: add hif.c wilc1000: add wlan_if.h wilc1000: add wlan_cfg.h wilc1000: add wlan_cfg.c wilc1000: add cfg80211.c wilc1000: add cfg80211.h wilc1000: add netdev.h wilc1000: add netdev.c wilc1000: add mon.c wilc1000: add spi.c wilc1000: add wlan.h wilc1000: add wlan.c wilc1000: add sdio.c wilc1000: add fw.h dt: bindings: net: add microchip,wilc1000,sdio.yaml dt: bindings: net: add microchip,wilc1000,spi.yaml wilc1000: add Makefile and Kconfig files for wilc1000 compilation .../net/wireless/microchip,wilc1000,sdio.yaml | 68 + .../net/wireless/microchip,wilc1000,spi.yaml | 61 + drivers/net/wireless/Kconfig |1 + drivers/net/wireless/Makefile |1 + drivers/net/wireless/microchip/Kconfig| 15 + drivers/net/wireless/microchip/Makefile |2 + .../net/wireless/microchip/wilc1000/Kconfig | 42 + .../net/wireless/microchip/wilc1000/Makefile | 14 + .../wireless/microchip/wilc1000/cfg80211.c| 1852 .../wireless/microchip/wilc1000/cfg80211.h| 29 + drivers/net/wireless/microchip/wilc1000/fw.h | 119 + drivers/net/wireless/microchip/wilc1000/hif.c | 1959 + drivers/net/wireless/microchip/wilc1000/hif.h | 214 ++ drivers/net/wireless/microchip/wilc1000/mon.c | 260 +++ .../net/wireless/microchip/wilc1000/netdev.c | 940 .../net/wireless/microchip/wilc1000/netdev.h | 295 +++ .../net/wireless/microchip/wilc1000/sdio.c| 1030 + drivers/net/wireless/microchip/wilc1000/spi.c | 1001 + .../net/wireless/microchip/wilc1000/wlan.c| 1240 +++ .../net/wireless/microchip/wilc1000/wlan.h| 398 .../wireless/microchip/wilc1000/wlan_cfg.c| 413 .../wireless/microchip/wilc1000/wlan_cfg.h| 54 + .../net/wireless/microchip/wilc1000/wlan_if.h | 803 +++ drivers/staging/Kconfig |2 - drivers/staging/Makefile |1 - 25 files changed, 10811 insertions(+), 3 deletions(-) create mode 100644 Documentation/devicetree/bindings/net/wireless/microchip,wilc1000,sdio.yaml create mode 100644 Documentation/devicetree/bindings/net/wireless/microchip,wilc1000,spi.yaml create mode 100644 drivers/net/wireless/microchip/Kconfig create mode 100644 drivers/net/wireless/microchip/Makefile create mode 100644 drivers/net/wireless/microchip/wilc1000/Kconfig create mode 100644 drivers/net/wireless/microchip/wilc1000/Makefile create mode 100644 drivers/net/wireless/microchip/wilc1000/cfg80211.c create mode 100644 drivers/net/wireless/microchip/wilc1000/cfg80211.h create mode 100644 drivers/net/wireless/microchip/wilc1000/fw.h create mode 100644 drivers/net/wireless/microchip/wilc1000/hif.c create mode 100644 drivers/net/wireless/microchip/wilc1000/hif.h create mode 100644 drivers/net/wireless/microchip/wilc1000/mon.c create mode 100644 drivers/net/wireless/microchip/wilc1000/netdev.c create mode 100644 drivers/net/wireless/microchip/wilc1000/netdev.h create mode 100644 drivers/net/wireless/microchip/wilc1000/sdio.c create mode 100644 drivers/net/wireless/microchip/wilc1000
[PATCH v3 08/18] wilc1000: add netdev.h
From: Ajay Singh Moved 'drivers/staging/wilc1000/netdev.h' to 'drivers/net/wireless/microchip/wilc1000/netdev.h'. Signed-off-by: Ajay Singh --- .../net/wireless/microchip/wilc1000/netdev.h | 295 ++ 1 file changed, 295 insertions(+) create mode 100644 drivers/net/wireless/microchip/wilc1000/netdev.h diff --git a/drivers/net/wireless/microchip/wilc1000/netdev.h b/drivers/net/wireless/microchip/wilc1000/netdev.h new file mode 100644 index ..e3689e2a4abb --- /dev/null +++ b/drivers/net/wireless/microchip/wilc1000/netdev.h @@ -0,0 +1,295 @@ +/* SPDX-License-Identifier: GPL-2.0 */ +/* + * Copyright (c) 2012 - 2018 Microchip Technology Inc., and its subsidiaries. + * All rights reserved. + */ + +#ifndef WILC_NETDEV_H +#define WILC_NETDEV_H + +#include +#include +#include +#include +#include +#include + +#include "hif.h" +#include "wlan.h" +#include "wlan_cfg.h" + +#define FLOW_CONTROL_LOWER_THRESHOLD 128 +#define FLOW_CONTROL_UPPER_THRESHOLD 256 + +#define PMKID_FOUND1 +#define NUM_STA_ASSOCIATED 8 + +#define NUM_REG_FRAME 2 + +#define TCP_ACK_FILTER_LINK_SPEED_THRESH 54 +#define DEFAULT_LINK_SPEED 72 + +struct wilc_wfi_stats { + unsigned long rx_packets; + unsigned long tx_packets; + unsigned long rx_bytes; + unsigned long tx_bytes; + u64 rx_time; + u64 tx_time; + +}; + +struct wilc_wfi_key { + u8 *key; + u8 *seq; + int key_len; + int seq_len; + u32 cipher; +}; + +struct wilc_wfi_wep_key { + u8 *key; + u8 key_len; + u8 key_idx; +}; + +struct sta_info { + u8 sta_associated_bss[WILC_MAX_NUM_STA][ETH_ALEN]; +}; + +/* Parameters needed for host interface for remaining on channel */ +struct wilc_wfi_p2p_listen_params { + struct ieee80211_channel *listen_ch; + u32 listen_duration; + u64 listen_cookie; +}; + +static const u32 wilc_cipher_suites[] = { + WLAN_CIPHER_SUITE_WEP40, + WLAN_CIPHER_SUITE_WEP104, + WLAN_CIPHER_SUITE_TKIP, + WLAN_CIPHER_SUITE_CCMP, + WLAN_CIPHER_SUITE_AES_CMAC +}; + +#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 const struct ieee80211_channel wilc_2ghz_channels[] = { + 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) +}; + +#define RATETAB_ENT(_rate, _hw_value, _flags) {\ + .bitrate = (_rate),\ + .hw_value = (_hw_value),\ + .flags= (_flags), \ +} + +static struct ieee80211_rate wilc_bitrates[] = { + RATETAB_ENT(10, 0, 0), + RATETAB_ENT(20, 1, 0), + RATETAB_ENT(55, 2, 0), + RATETAB_ENT(110, 3, 0), + RATETAB_ENT(60, 9, 0), + RATETAB_ENT(90, 6, 0), + RATETAB_ENT(120, 7, 0), + RATETAB_ENT(180, 8, 0), + RATETAB_ENT(240, 9, 0), + RATETAB_ENT(360, 10, 0), + RATETAB_ENT(480, 11, 0), + RATETAB_ENT(540, 12, 0) +}; + +struct wilc_priv { + struct wireless_dev wdev; + struct cfg80211_scan_request *scan_req; + + struct wilc_wfi_p2p_listen_params remain_on_ch_params; + u64 tx_cookie; + + bool cfg_scanning; + + u8 associated_bss[ETH_ALEN]; + struct sta_info assoc_stainfo; + struct sk_buff *skb; + struct net_device *dev; + struct host_if_drv *hif_drv; + struct wilc_pmkid_attr pmkid_list; + u8 wep_key[4][WLAN_KEY_LEN_WEP104]; + u8 wep_key_len[4]; + + /* The real interface that the monitor is on */ + struct net_device *real_ndev; + struct wilc_wfi_key *wilc_gtk[WILC_MAX_NUM_STA]; + struct wilc_wfi_key *wilc_ptk[WILC_MAX_NUM_STA]; + u8 wilc_groupkey; + + /* mutexes */ + struct mutex scan_req_lock; + bool p2p_listen_state; + int scanned_cnt; + + u64 inc_roc_cookie; +}; + +struct frame_reg { + u16 type; + bool reg; +}; + +#define MAX_TCP_SESSION25 +#define MAX_PENDING_ACKS 256 + +struct ack_session_info { + u32 seq_num; + u32 bigger_ack_num; + u16 src_port; + u16 dst_port; + u16 status; +}; + +struct pending_acks { + u32 ack_num; + u32 session_index; + struct txq_entry
[PATCH v3 04/18] wilc1000: add wlan_cfg.h
From: Ajay Singh Moved 'drivers/staging/wilc1000/wlan_cfg.h' to 'drivers/net/wireless/microchip/wilc1000/wlan_cfg.h'. Signed-off-by: Ajay Singh --- .../wireless/microchip/wilc1000/wlan_cfg.h| 54 +++ 1 file changed, 54 insertions(+) create mode 100644 drivers/net/wireless/microchip/wilc1000/wlan_cfg.h diff --git a/drivers/net/wireless/microchip/wilc1000/wlan_cfg.h b/drivers/net/wireless/microchip/wilc1000/wlan_cfg.h new file mode 100644 index ..614c5673f232 --- /dev/null +++ b/drivers/net/wireless/microchip/wilc1000/wlan_cfg.h @@ -0,0 +1,54 @@ +/* SPDX-License-Identifier: GPL-2.0 */ +/* + * Copyright (c) 2012 - 2018 Microchip Technology Inc., and its subsidiaries. + * All rights reserved. + */ + +#ifndef WILC_WLAN_CFG_H +#define WILC_WLAN_CFG_H + +struct wilc_cfg_byte { + u16 id; + u8 val; +}; + +struct wilc_cfg_hword { + u16 id; + u16 val; +}; + +struct wilc_cfg_word { + u16 id; + u32 val; +}; + +struct wilc_cfg_str { + u16 id; + u8 *str; +}; + +struct wilc_cfg_str_vals { + u8 mac_address[7]; + u8 firmware_version[129]; + u8 assoc_rsp[256]; +}; + +struct wilc_cfg { + struct wilc_cfg_byte *b; + struct wilc_cfg_hword *hw; + struct wilc_cfg_word *w; + struct wilc_cfg_str *s; + struct wilc_cfg_str_vals *str_vals; +}; + +struct wilc; +int wilc_wlan_cfg_set_wid(u8 *frame, u32 offset, u16 id, u8 *buf, int size); +int wilc_wlan_cfg_get_wid(u8 *frame, u32 offset, u16 id); +int wilc_wlan_cfg_get_val(struct wilc *wl, u16 wid, u8 *buffer, + u32 buffer_size); +void wilc_wlan_cfg_indicate_rx(struct wilc *wilc, u8 *frame, int size, + struct wilc_cfg_rsp *rsp); +int wilc_wlan_cfg_init(struct wilc *wl); +void wilc_wlan_cfg_deinit(struct wilc *wl); + +#endif -- 2.24.0 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH v3 13/18] wilc1000: add wlan.c
From: Ajay Singh Moved 'drivers/staging/wilc1000/wlan.c' to 'drivers/net/wireless/microchip/wilc1000/wlan.c'. Signed-off-by: Ajay Singh --- .../net/wireless/microchip/wilc1000/wlan.c| 1240 + 1 file changed, 1240 insertions(+) create mode 100644 drivers/net/wireless/microchip/wilc1000/wlan.c diff --git a/drivers/net/wireless/microchip/wilc1000/wlan.c b/drivers/net/wireless/microchip/wilc1000/wlan.c new file mode 100644 index ..3aeca882f431 --- /dev/null +++ b/drivers/net/wireless/microchip/wilc1000/wlan.c @@ -0,0 +1,1240 @@ +// SPDX-License-Identifier: GPL-2.0 +/* + * Copyright (c) 2012 - 2018 Microchip Technology Inc., and its subsidiaries. + * All rights reserved. + */ + +#include +#include +#include "cfg80211.h" +#include "wlan_cfg.h" + +static inline bool is_wilc1000(u32 id) +{ + return (id & (~WILC_CHIP_REV_FIELD)) == WILC_1000_BASE_ID; +} + +static inline void acquire_bus(struct wilc *wilc, enum bus_acquire acquire) +{ + mutex_lock(&wilc->hif_cs); + if (acquire == WILC_BUS_ACQUIRE_AND_WAKEUP) + chip_wakeup(wilc); +} + +static inline void release_bus(struct wilc *wilc, enum bus_release release) +{ + if (release == WILC_BUS_RELEASE_ALLOW_SLEEP) + chip_allow_sleep(wilc); + mutex_unlock(&wilc->hif_cs); +} + +static void wilc_wlan_txq_remove(struct wilc *wilc, struct txq_entry_t *tqe) +{ + list_del(&tqe->list); + wilc->txq_entries -= 1; +} + +static struct txq_entry_t * +wilc_wlan_txq_remove_from_head(struct net_device *dev) +{ + struct txq_entry_t *tqe = NULL; + unsigned long flags; + struct wilc_vif *vif = netdev_priv(dev); + struct wilc *wilc = vif->wilc; + + spin_lock_irqsave(&wilc->txq_spinlock, flags); + + if (!list_empty(&wilc->txq_head.list)) { + tqe = list_first_entry(&wilc->txq_head.list, struct txq_entry_t, + list); + list_del(&tqe->list); + wilc->txq_entries -= 1; + } + spin_unlock_irqrestore(&wilc->txq_spinlock, flags); + return tqe; +} + +static void wilc_wlan_txq_add_to_tail(struct net_device *dev, + struct txq_entry_t *tqe) +{ + unsigned long flags; + struct wilc_vif *vif = netdev_priv(dev); + struct wilc *wilc = vif->wilc; + + spin_lock_irqsave(&wilc->txq_spinlock, flags); + + list_add_tail(&tqe->list, &wilc->txq_head.list); + wilc->txq_entries += 1; + + spin_unlock_irqrestore(&wilc->txq_spinlock, flags); + + complete(&wilc->txq_event); +} + +static void wilc_wlan_txq_add_to_head(struct wilc_vif *vif, + struct txq_entry_t *tqe) +{ + unsigned long flags; + struct wilc *wilc = vif->wilc; + + mutex_lock(&wilc->txq_add_to_head_cs); + + spin_lock_irqsave(&wilc->txq_spinlock, flags); + + list_add(&tqe->list, &wilc->txq_head.list); + wilc->txq_entries += 1; + + spin_unlock_irqrestore(&wilc->txq_spinlock, flags); + mutex_unlock(&wilc->txq_add_to_head_cs); + complete(&wilc->txq_event); +} + +#define NOT_TCP_ACK(-1) + +static inline void add_tcp_session(struct wilc_vif *vif, u32 src_prt, + u32 dst_prt, u32 seq) +{ + struct tcp_ack_filter *f = &vif->ack_filter; + + if (f->tcp_session < 2 * MAX_TCP_SESSION) { + f->ack_session_info[f->tcp_session].seq_num = seq; + f->ack_session_info[f->tcp_session].bigger_ack_num = 0; + f->ack_session_info[f->tcp_session].src_port = src_prt; + f->ack_session_info[f->tcp_session].dst_port = dst_prt; + f->tcp_session++; + } +} + +static inline void update_tcp_session(struct wilc_vif *vif, u32 index, u32 ack) +{ + struct tcp_ack_filter *f = &vif->ack_filter; + + if (index < 2 * MAX_TCP_SESSION && + ack > f->ack_session_info[index].bigger_ack_num) + f->ack_session_info[index].bigger_ack_num = ack; +} + +static inline void add_tcp_pending_ack(struct wilc_vif *vif, u32 ack, + u32 session_index, + struct txq_entry_t *txqe) +{ + struct tcp_ack_filter *f = &vif->ack_filter; + u32 i = f->pending_base + f->pending_acks_idx; + + if (i < MAX_PENDING_ACKS) { + f->pending_acks[i].ack_num = ack; + f->pending_acks[i].txqe = txqe; + f->pending_acks[i].session_index = session_index; + txqe->ack_idx = i; + f->pending_acks_idx++; + } +} + +static inline void tcp_process(struct net_device *dev, struct txq_entry_t *tqe) +{ + void *buffer = tqe->buffer; + const struct ethhdr *eth_hdr_ptr = buffer; + int i; + unsigned long flags; + struct wilc_vif *vif = netdev_priv(dev); + struct wilc *wilc = vif->wilc; +
Re: [PATCH v7 0/2] Add initial support for slimport anx7625
On Tue, Feb 25, 2020 at 02:11:39PM +0800, Xin Ji wrote: > Hi all, > > The following series add initial support for the Slimport ANX7625 > transmitter, a > ultra-low power Full-HD 4K MIPI to DP transmitter designed for portable > device. > > This is the initial version, any mistakes, please let me know, I will fix it > in ^^^ > the next series. This is actually the v7 version, but the patch zero cover letter hasn't been updated. :P The last time anyone responded to these patches was to point out three simple bugs which you fixed in v4 last November. What changed in this version? My guess is that nothing changed and you are just prodding us to re-review it... Feel free to say that also because we can't read your mind. regards, dan carpenter ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH v3 06/18] wilc1000: add cfg80211.c
From: Ajay Singh Moved 'drivers/staging/wilc1000/cfg80211.c' to 'drivers/net/wireless/microchip/wilc1000/cfg80211.c'. Signed-off-by: Ajay Singh --- .../wireless/microchip/wilc1000/cfg80211.c| 1852 + 1 file changed, 1852 insertions(+) create mode 100644 drivers/net/wireless/microchip/wilc1000/cfg80211.c diff --git a/drivers/net/wireless/microchip/wilc1000/cfg80211.c b/drivers/net/wireless/microchip/wilc1000/cfg80211.c new file mode 100644 index ..5d8faa01337d --- /dev/null +++ b/drivers/net/wireless/microchip/wilc1000/cfg80211.c @@ -0,0 +1,1852 @@ +// SPDX-License-Identifier: GPL-2.0 +/* + * Copyright (c) 2012 - 2018 Microchip Technology Inc., and its subsidiaries. + * All rights reserved. + */ + +#include "cfg80211.h" + +#define GO_NEG_REQ 0x00 +#define GO_NEG_RSP 0x01 +#define GO_NEG_CONF0x02 +#define P2P_INV_REQ0x03 +#define P2P_INV_RSP0x04 + +#define WILC_INVALID_CHANNEL 0 + +/* Operation at 2.4 GHz with channels 1-13 */ +#define WILC_WLAN_OPERATING_CLASS_2_4GHZ 0x51 + +static const struct ieee80211_txrx_stypes + wilc_wfi_cfg80211_mgmt_types[NUM_NL80211_IFTYPES] = { + [NL80211_IFTYPE_STATION] = { + .tx = 0x, + .rx = BIT(IEEE80211_STYPE_ACTION >> 4) | + BIT(IEEE80211_STYPE_PROBE_REQ >> 4) + }, + [NL80211_IFTYPE_AP] = { + .tx = 0x, + .rx = BIT(IEEE80211_STYPE_ASSOC_REQ >> 4) | + BIT(IEEE80211_STYPE_REASSOC_REQ >> 4) | + BIT(IEEE80211_STYPE_PROBE_REQ >> 4) | + BIT(IEEE80211_STYPE_DISASSOC >> 4) | + BIT(IEEE80211_STYPE_AUTH >> 4) | + BIT(IEEE80211_STYPE_DEAUTH >> 4) | + BIT(IEEE80211_STYPE_ACTION >> 4) + }, + [NL80211_IFTYPE_P2P_CLIENT] = { + .tx = 0x, + .rx = BIT(IEEE80211_STYPE_ACTION >> 4) | + BIT(IEEE80211_STYPE_PROBE_REQ >> 4) | + BIT(IEEE80211_STYPE_ASSOC_REQ >> 4) | + BIT(IEEE80211_STYPE_REASSOC_REQ >> 4) | + BIT(IEEE80211_STYPE_DISASSOC >> 4) | + BIT(IEEE80211_STYPE_AUTH >> 4) | + BIT(IEEE80211_STYPE_DEAUTH >> 4) + } +}; + +static const struct wiphy_wowlan_support wowlan_support = { + .flags = WIPHY_WOWLAN_ANY +}; + +struct wilc_p2p_mgmt_data { + int size; + u8 *buff; +}; + +struct wilc_p2p_pub_act_frame { + u8 category; + u8 action; + u8 oui[3]; + u8 oui_type; + u8 oui_subtype; + u8 dialog_token; + u8 elem[]; +} __packed; + +struct wilc_vendor_specific_ie { + u8 tag_number; + u8 tag_len; + u8 oui[3]; + u8 oui_type; + u8 attr[]; +} __packed; + +struct wilc_attr_entry { + u8 attr_type; + __le16 attr_len; + u8 val[]; +} __packed; + +struct wilc_attr_oper_ch { + u8 attr_type; + __le16 attr_len; + u8 country_code[IEEE80211_COUNTRY_STRING_LEN]; + u8 op_class; + u8 op_channel; +} __packed; + +struct wilc_attr_ch_list { + u8 attr_type; + __le16 attr_len; + u8 country_code[IEEE80211_COUNTRY_STRING_LEN]; + u8 elem[]; +} __packed; + +struct wilc_ch_list_elem { + u8 op_class; + u8 no_of_channels; + u8 ch_list[]; +} __packed; + +static void cfg_scan_result(enum scan_event scan_event, + struct wilc_rcvd_net_info *info, void *user_void) +{ + struct wilc_priv *priv = user_void; + + if (!priv->cfg_scanning) + return; + + if (scan_event == SCAN_EVENT_NETWORK_FOUND) { + s32 freq; + struct ieee80211_channel *channel; + struct cfg80211_bss *bss; + struct wiphy *wiphy = priv->dev->ieee80211_ptr->wiphy; + + if (!wiphy || !info) + return; + + freq = ieee80211_channel_to_frequency((s32)info->ch, + NL80211_BAND_2GHZ); + channel = ieee80211_get_channel(wiphy, freq); + if (!channel) + return; + + bss = cfg80211_inform_bss_frame(wiphy, channel, info->mgmt, + info->frame_len, + (s32)info->rssi * 100, + GFP_KERNEL); + if (!bss) + cfg80211_put_bss(wiphy, bss); + } else if (scan_event == SCAN_EVENT_DONE) { + mutex_lock(&priv->scan_req_lock); + + if (priv->scan_req) { + struct cfg80211_scan_info info = { + .aborted = false, +
[PATCH v3 18/18] wilc1000: add Makefile and Kconfig files for wilc1000 compilation
From: Ajay Singh Added Makefile and Kconfig files for compiling wilc1000 module from 'drivers/net/wireless/microchip/'. Signed-off-by: Ajay Singh --- drivers/net/wireless/Kconfig | 1 + drivers/net/wireless/Makefile | 1 + drivers/net/wireless/microchip/Kconfig| 15 +++ drivers/net/wireless/microchip/Makefile | 2 + .../net/wireless/microchip/wilc1000/Kconfig | 42 +++ .../net/wireless/microchip/wilc1000/Makefile | 14 +++ drivers/staging/Kconfig | 2 - drivers/staging/Makefile | 1 - 8 files changed, 75 insertions(+), 3 deletions(-) create mode 100644 drivers/net/wireless/microchip/Kconfig create mode 100644 drivers/net/wireless/microchip/Makefile create mode 100644 drivers/net/wireless/microchip/wilc1000/Kconfig create mode 100644 drivers/net/wireless/microchip/wilc1000/Makefile diff --git a/drivers/net/wireless/Kconfig b/drivers/net/wireless/Kconfig index 1c98d781ae49..86faf8f3d9b0 100644 --- a/drivers/net/wireless/Kconfig +++ b/drivers/net/wireless/Kconfig @@ -47,6 +47,7 @@ source "drivers/net/wireless/st/Kconfig" source "drivers/net/wireless/ti/Kconfig" source "drivers/net/wireless/zydas/Kconfig" source "drivers/net/wireless/quantenna/Kconfig" +source "drivers/net/wireless/microchip/Kconfig" config PCMCIA_RAYCS tristate "Aviator/Raytheon 2.4GHz wireless support" diff --git a/drivers/net/wireless/Makefile b/drivers/net/wireless/Makefile index 6cfe74515c95..f9a51c2889ca 100644 --- a/drivers/net/wireless/Makefile +++ b/drivers/net/wireless/Makefile @@ -19,6 +19,7 @@ obj-$(CONFIG_WLAN_VENDOR_ST) += st/ obj-$(CONFIG_WLAN_VENDOR_TI) += ti/ obj-$(CONFIG_WLAN_VENDOR_ZYDAS) += zydas/ obj-$(CONFIG_WLAN_VENDOR_QUANTENNA) += quantenna/ +obj-$(CONFIG_WLAN_VENDOR_MICROCHIP) += microchip/ # 16-bit wireless PCMCIA client drivers obj-$(CONFIG_PCMCIA_RAYCS) += ray_cs.o diff --git a/drivers/net/wireless/microchip/Kconfig b/drivers/net/wireless/microchip/Kconfig new file mode 100644 index ..a6b46fb6b1ec --- /dev/null +++ b/drivers/net/wireless/microchip/Kconfig @@ -0,0 +1,15 @@ +# SPDX-License-Identifier: GPL-2.0 +config WLAN_VENDOR_MICROCHIP + bool "Microchip devices" + default y + help + If you have a wireless card belonging to this class, say Y. + + Note that the answer to this question doesn't directly affect the + kernel: saying N will just cause the configurator to skip all the + questions about these cards. If you say Y, you will be asked for + your specific card in the following questions. + +if WLAN_VENDOR_MICROCHIP +source "drivers/net/wireless/microchip/wilc1000/Kconfig" +endif # WLAN_VENDOR_MICROCHIP diff --git a/drivers/net/wireless/microchip/Makefile b/drivers/net/wireless/microchip/Makefile new file mode 100644 index ..73b763c7393e --- /dev/null +++ b/drivers/net/wireless/microchip/Makefile @@ -0,0 +1,2 @@ +# SPDX-License-Identifier: GPL-2.0 +obj-$(CONFIG_WILC1000) += wilc1000/ diff --git a/drivers/net/wireless/microchip/wilc1000/Kconfig b/drivers/net/wireless/microchip/wilc1000/Kconfig new file mode 100644 index ..59e58550d139 --- /dev/null +++ b/drivers/net/wireless/microchip/wilc1000/Kconfig @@ -0,0 +1,42 @@ +# SPDX-License-Identifier: GPL-2.0 +config WILC1000 + tristate + help + This module only support IEEE 802.11n WiFi. + +config WILC1000_SDIO + tristate "Atmel WILC1000 SDIO (WiFi only)" + depends on CFG80211 && INET && MMC + select WILC1000 + help + This module adds support for the SDIO interface of adapters using + WILC1000 chipset. The Atmel WILC1000 SDIO is a full speed interface. + It meets SDIO card specification version 2.0. The interface supports + the 1-bit/4-bit SD transfer mode at the clock range of 0-50 MHz. + The host can use this interface to read and write from any register + within the chip as well as configure the WILC1000 for data DMA. + To use this interface, pin9 (SDIO_SPI_CFG) must be grounded. Select + this if your platform is using the SDIO bus. + +config WILC1000_SPI + tristate "Atmel WILC1000 SPI (WiFi only)" + depends on CFG80211 && INET && SPI + select WILC1000 + help + This module adds support for the SPI interface of adapters using + WILC1000 chipset. The Atmel WILC1000 has a Serial Peripheral + Interface (SPI) that operates as a SPI slave. This SPI interface can + be used for control and for serial I/O of 802.11 data. The SPI is a + full-duplex slave synchronous serial interface that is available + immediately following reset when pin 9 (SDIO_SPI_CFG) is tied to + VDDIO. Select this if your platform is using the SPI bus. + +config WILC1000_HW_OOB_INTR + bool "WILC1000 out of band interrupt" + depends on WILC1000_SDIO + he
[PATCH v3 12/18] wilc1000: add wlan.h
From: Ajay Singh Moved 'drivers/staging/wilc1000/wlan.h' to 'drivers/net/wireless/microchip/wilc1000/wlan.h'. Signed-off-by: Ajay Singh --- .../net/wireless/microchip/wilc1000/wlan.h| 398 ++ 1 file changed, 398 insertions(+) create mode 100644 drivers/net/wireless/microchip/wilc1000/wlan.h diff --git a/drivers/net/wireless/microchip/wilc1000/wlan.h b/drivers/net/wireless/microchip/wilc1000/wlan.h new file mode 100644 index ..5999c5490ea5 --- /dev/null +++ b/drivers/net/wireless/microchip/wilc1000/wlan.h @@ -0,0 +1,398 @@ +/* SPDX-License-Identifier: GPL-2.0 */ +/* + * Copyright (c) 2012 - 2018 Microchip Technology Inc., and its subsidiaries. + * All rights reserved. + */ + +#ifndef WILC_WLAN_H +#define WILC_WLAN_H + +#include +#include + +/ + * + * Mac eth header length + * + / +#define MAX_MAC_HDR_LEN26 /* QOS_MAC_HDR_LEN */ +#define SUB_MSDU_HEADER_LENGTH 14 +#define SNAP_HDR_LEN 8 +#define ETHERNET_HDR_LEN 14 +#define WORD_ALIGNMENT_PAD 0 + +#define ETH_ETHERNET_HDR_OFFSET(MAX_MAC_HDR_LEN + \ +SUB_MSDU_HEADER_LENGTH + \ +SNAP_HDR_LEN - \ +ETHERNET_HDR_LEN + \ +WORD_ALIGNMENT_PAD) + +#define HOST_HDR_OFFSET4 +#define ETHERNET_HDR_LEN 14 +#define IP_HDR_LEN 20 +#define IP_HDR_OFFSET ETHERNET_HDR_LEN +#define UDP_HDR_OFFSET (IP_HDR_LEN + IP_HDR_OFFSET) +#define UDP_HDR_LEN8 +#define UDP_DATA_OFFSET(UDP_HDR_OFFSET + UDP_HDR_LEN) +#define ETH_CONFIG_PKT_HDR_LEN UDP_DATA_OFFSET + +#define ETH_CONFIG_PKT_HDR_OFFSET (ETH_ETHERNET_HDR_OFFSET + \ +ETH_CONFIG_PKT_HDR_LEN) + +/ + * + * Register Defines + * + / +#define WILC_PERIPH_REG_BASE 0x1000 +#define WILC_CHANGING_VIR_IF 0x108c +#define WILC_CHIPIDWILC_PERIPH_REG_BASE +#define WILC_GLB_RESET_0 (WILC_PERIPH_REG_BASE + 0x400) +#define WILC_PIN_MUX_0 (WILC_PERIPH_REG_BASE + 0x408) +#define WILC_HOST_TX_CTRL (WILC_PERIPH_REG_BASE + 0x6c) +#define WILC_HOST_RX_CTRL_0(WILC_PERIPH_REG_BASE + 0x70) +#define WILC_HOST_RX_CTRL_1(WILC_PERIPH_REG_BASE + 0x74) +#define WILC_HOST_VMM_CTL (WILC_PERIPH_REG_BASE + 0x78) +#define WILC_HOST_RX_CTRL (WILC_PERIPH_REG_BASE + 0x80) +#define WILC_HOST_RX_EXTRA_SIZE(WILC_PERIPH_REG_BASE + 0x84) +#define WILC_HOST_TX_CTRL_1(WILC_PERIPH_REG_BASE + 0x88) +#define WILC_MISC (WILC_PERIPH_REG_BASE + 0x428) +#define WILC_INTR_REG_BASE (WILC_PERIPH_REG_BASE + 0xa00) +#define WILC_INTR_ENABLE WILC_INTR_REG_BASE +#define WILC_INTR2_ENABLE (WILC_INTR_REG_BASE + 4) + +#define WILC_INTR_POLARITY (WILC_INTR_REG_BASE + 0x10) +#define WILC_INTR_TYPE (WILC_INTR_REG_BASE + 0x20) +#define WILC_INTR_CLEAR(WILC_INTR_REG_BASE + 0x30) +#define WILC_INTR_STATUS (WILC_INTR_REG_BASE + 0x40) + +#define WILC_RF_REVISION_ID0x13f4 + +#define WILC_VMM_TBL_SIZE 64 +#define WILC_VMM_TX_TBL_BASE 0x150400 +#define WILC_VMM_RX_TBL_BASE 0x150500 + +#define WILC_VMM_BASE 0x15 +#define WILC_VMM_CORE_CTL WILC_VMM_BASE +#define WILC_VMM_TBL_CTL (WILC_VMM_BASE + 0x4) +#define WILC_VMM_TBL_ENTRY (WILC_VMM_BASE + 0x8) +#define WILC_VMM_TBL0_SIZE (WILC_VMM_BASE + 0xc) +#define WILC_VMM_TO_HOST_SIZE (WILC_VMM_BASE + 0x10) +#define WILC_VMM_CORE_CFG (WILC_VMM_BASE + 0x14) +#define WILC_VMM_TBL_ACTIVE(WILC_VMM_BASE + 040) +#define WILC_VMM_TBL_STATUS(WILC_VMM_BASE + 0x44) + +#define WILC_SPI_REG_BASE 0xe800 +#define WILC_SPI_CTL WILC_SPI_REG_BASE +#define WILC_SPI_MASTER_DMA_ADDR (WILC_SPI_REG_BASE + 0x4) +#define WILC_SPI_MASTER_DMA_COUNT (WILC_SPI_REG_BASE + 0x8) +#define WILC_SPI_SLAVE_DMA_ADDR(WILC_SPI_REG_BASE + 0xc) +#define WILC_SPI_SLAVE_DMA_COUNT (WILC_SPI_REG_BASE + 0x10) +#define WILC_SPI_TX_MODE (WILC_SPI_REG_BASE + 0x20) +#define WILC_SPI_PROTOCOL_CONFIG (WILC_SPI_REG_BASE + 0x24) +#define WILC_SPI_INTR_CTL (WILC_SPI_REG_BASE + 0x2c) +#define WILC_SPI_INT_STATUS(WILC_SPI_REG_BASE + 0x40) +#define WILC_SPI_INT_CLEAR (WILC_SPI_REG_BASE + 0x44) + +#define
[PATCH v3 09/18] wilc1000: add netdev.c
From: Ajay Singh Moved 'drivers/staging/wilc1000/netdev.c' to 'drivers/net/wireless/microchip/wilc1000/netdev.c'. Signed-off-by: Ajay Singh --- .../net/wireless/microchip/wilc1000/netdev.c | 940 ++ 1 file changed, 940 insertions(+) create mode 100644 drivers/net/wireless/microchip/wilc1000/netdev.c diff --git a/drivers/net/wireless/microchip/wilc1000/netdev.c b/drivers/net/wireless/microchip/wilc1000/netdev.c new file mode 100644 index ..045f5cdfdca0 --- /dev/null +++ b/drivers/net/wireless/microchip/wilc1000/netdev.c @@ -0,0 +1,940 @@ +// SPDX-License-Identifier: GPL-2.0 +/* + * Copyright (c) 2012 - 2018 Microchip Technology Inc., and its subsidiaries. + * All rights reserved. + */ + +#include +#include +#include +#include +#include + +#include "cfg80211.h" +#include "wlan_cfg.h" + +#define WILC_MULTICAST_TABLE_SIZE 8 + +static irqreturn_t isr_uh_routine(int irq, void *user_data) +{ + struct net_device *dev = user_data; + struct wilc_vif *vif = netdev_priv(dev); + struct wilc *wilc = vif->wilc; + + if (wilc->close) { + netdev_err(dev, "Can't handle UH interrupt\n"); + return IRQ_HANDLED; + } + return IRQ_WAKE_THREAD; +} + +static irqreturn_t isr_bh_routine(int irq, void *userdata) +{ + struct net_device *dev = userdata; + struct wilc_vif *vif = netdev_priv(userdata); + struct wilc *wilc = vif->wilc; + + if (wilc->close) { + netdev_err(dev, "Can't handle BH interrupt\n"); + return IRQ_HANDLED; + } + + wilc_handle_isr(wilc); + + return IRQ_HANDLED; +} + +static int init_irq(struct net_device *dev) +{ + int ret = 0; + struct wilc_vif *vif = netdev_priv(dev); + struct wilc *wl = vif->wilc; + + ret = gpiod_direction_input(wl->gpio_irq); + if (ret) { + netdev_err(dev, "could not obtain gpio for WILC_INTR\n"); + return ret; + } + + wl->dev_irq_num = gpiod_to_irq(wl->gpio_irq); + + ret = request_threaded_irq(wl->dev_irq_num, isr_uh_routine, + isr_bh_routine, + IRQF_TRIGGER_FALLING | IRQF_ONESHOT, + "WILC_IRQ", dev); + if (ret < 0) + netdev_err(dev, "Failed to request IRQ\n"); + else + netdev_dbg(dev, "IRQ request succeeded IRQ-NUM= %d\n", + wl->dev_irq_num); + + return ret; +} + +static void deinit_irq(struct net_device *dev) +{ + struct wilc_vif *vif = netdev_priv(dev); + struct wilc *wilc = vif->wilc; + + /* Deinitialize IRQ */ + if (wilc->dev_irq_num) + free_irq(wilc->dev_irq_num, wilc); +} + +void wilc_mac_indicate(struct wilc *wilc) +{ + s8 status; + + wilc_wlan_cfg_get_val(wilc, WID_STATUS, &status, 1); + if (wilc->mac_status == WILC_MAC_STATUS_INIT) { + wilc->mac_status = status; + complete(&wilc->sync_event); + } else { + wilc->mac_status = status; + } +} + +static struct net_device *get_if_handler(struct wilc *wilc, u8 *mac_header) +{ + struct net_device *ndev = NULL; + struct wilc_vif *vif; + struct ieee80211_hdr *h = (struct ieee80211_hdr *)mac_header; + + list_for_each_entry_rcu(vif, &wilc->vif_list, list) { + if (vif->mode == WILC_STATION_MODE) + if (ether_addr_equal_unaligned(h->addr2, vif->bssid)) { + ndev = vif->ndev; + goto out; + } + if (vif->mode == WILC_AP_MODE) + if (ether_addr_equal_unaligned(h->addr1, vif->bssid)) { + ndev = vif->ndev; + goto out; + } + } +out: + return ndev; +} + +void wilc_wlan_set_bssid(struct net_device *wilc_netdev, u8 *bssid, u8 mode) +{ + struct wilc_vif *vif = netdev_priv(wilc_netdev); + + if (bssid) + ether_addr_copy(vif->bssid, bssid); + else + eth_zero_addr(vif->bssid); + + vif->mode = mode; +} + +int wilc_wlan_get_num_conn_ifcs(struct wilc *wilc) +{ + int srcu_idx; + u8 ret_val = 0; + struct wilc_vif *vif; + + srcu_idx = srcu_read_lock(&wilc->srcu); + list_for_each_entry_rcu(vif, &wilc->vif_list, list) { + if (!is_zero_ether_addr(vif->bssid)) + ret_val++; + } + srcu_read_unlock(&wilc->srcu, srcu_idx); + return ret_val; +} + +static int wilc_txq_task(void *vp) +{ + int ret; + u32 txq_count; + struct wilc *wl = vp; + + complete(&wl->txq_thread_started); + while (1) { + wait_for_completion(&wl->txq_event); + + if (wl->close) { + complete(&wl->txq_thread_start
[PATCH v7 1/2] dt-bindings: drm/bridge: anx7625: MIPI to DP transmitter binding
The ANX7625 is an ultra-low power 4K Mobile HD Transmitter designed for portable device. It converts MIPI to DisplayPort 1.3 4K. You can add support to your board with binding. Example: anx7625_bridge: encoder@58 { compatible = "analogix,anx7625"; reg = <0x58>; status = "okay"; panel-flags = <1>; enable-gpios = <&pio 45 GPIO_ACTIVE_HIGH>; reset-gpios = <&pio 73 GPIO_ACTIVE_HIGH>; #address-cells = <1>; #size-cells = <0>; port@0 { reg = <0>; anx_1_in: endpoint { remote-endpoint = <&mipi_dsi>; }; }; port@2 { reg = <2>; anx_1_out: endpoint { remote-endpoint = <&panel_in>; }; }; }; Signed-off-by: Xin Ji --- .../bindings/display/bridge/anx7625.yaml | 91 ++ 1 file changed, 91 insertions(+) create mode 100644 Documentation/devicetree/bindings/display/bridge/anx7625.yaml diff --git a/Documentation/devicetree/bindings/display/bridge/anx7625.yaml b/Documentation/devicetree/bindings/display/bridge/anx7625.yaml new file mode 100644 index 000..1149ebb --- /dev/null +++ b/Documentation/devicetree/bindings/display/bridge/anx7625.yaml @@ -0,0 +1,91 @@ +# SPDX-License-Identifier: (GPL-2.0 OR BSD-2-Clause) +# Copyright 2019 Analogix Semiconductor, Inc. +%YAML 1.2 +--- +$id: "http://devicetree.org/schemas/display/bridge/anx7625.yaml#"; +$schema: "http://devicetree.org/meta-schemas/core.yaml#"; + +title: Analogix ANX7625 SlimPort (4K Mobile HD Transmitter) + +maintainers: + - Xin Ji + +description: | + The ANX7625 is an ultra-low power 4K Mobile HD Transmitter + designed for portable devices. + +properties: + "#address-cells": true + "#size-cells": true + + compatible: +items: + - const: analogix,anx7625 + + reg: +maxItems: 1 + + panel-flags: +description: indicate the panel is internal or external. +maxItems: 1 + + interrupts: +maxItems: 1 + + enable-gpios: +description: used for power on chip control, POWER_EN pin D2. +maxItems: 1 + + reset-gpios: +description: used for reset chip control, RESET_N pin B7. +maxItems: 1 + + port@0: +type: object +description: + A port node pointing to MIPI DSI host port node. + + port@1: +type: object +description: + A port node pointing to MIPI DPI host port node. + + port@2: +type: object +description: + A port node pointing to panel port node. + +required: + - "#address-cells" + - "#size-cells" + - compatible + - reg + - port@0 + - port@2 + +example: + - | +anx7625_bridge: encoder@58 { +compatible = "analogix,anx7625"; +reg = <0x58>; +status = "okay"; +panel-flags = <1>; +enable-gpios = <&pio 45 GPIO_ACTIVE_HIGH>; +reset-gpios = <&pio 73 GPIO_ACTIVE_HIGH>; +#address-cells = <1>; +#size-cells = <0>; + +port@0 { + reg = <0>; + anx_1_in: endpoint { +remote-endpoint = <&mipi_dsi>; + }; +}; + +port@2 { + reg = <2>; + anx_1_out: endpoint { +remote-endpoint = <&panel_in>; + }; +}; +}; -- 2.7.4 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel