[driver-core:driver-core-testing] BUILD SUCCESS 18555cb6db2373b9a5ec1f7572773fd58c77f9ba

2020-03-27 Thread kbuild test robot
tree/branch: 
https://git.kernel.org/pub/scm/linux/kernel/git/gregkh/driver-core.git  
driver-core-testing
branch HEAD: 18555cb6db2373b9a5ec1f7572773fd58c77f9ba  Revert "driver core: Set 
fw_devlink to "permissive" behavior by default"

elapsed time: 485m

configs tested: 156
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
shtitan_defconfig
sh   allmodconfig
riscvallmodconfig
riscv allnoconfig
microblazenommu_defconfig
i386  allnoconfig
i386 alldefconfig
i386 allyesconfig
i386defconfig
ia64 alldefconfig
ia64 allmodconfig
ia64  allnoconfig
ia64 allyesconfig
ia64defconfig
c6x  allyesconfig
c6xevmc6678_defconfig
nios2 10m50_defconfig
nios2 3c120_defconfig
openriscor1ksim_defconfig
openrisc simple_smp_defconfig
xtensa   common_defconfig
xtensa  iss_defconfig
nds32   defconfig
nds32 allnoconfig
cskydefconfig
alpha   defconfig
h8300   h8s-sim_defconfig
h8300 edosk2674_defconfig
m68k   m5475evb_defconfig
m68k allmodconfig
h8300h8300h-sim_defconfig
m68k   sun3_defconfig
m68k  multi_defconfig
arc defconfig
arc  allyesconfig
powerpc defconfig
powerpc   ppc64_defconfig
powerpc  rhel-kconfig
microblaze  mmu_defconfig
powerpc   allnoconfig
mips  fuloong2e_defconfig
mips  malta_kvm_defconfig
mips allyesconfig
mips 64r6el_defconfig
mips  allnoconfig
mips   32r2_defconfig
mips allmodconfig
pariscallnoconfig
pariscgeneric-64bit_defconfig
pariscgeneric-32bit_defconfig
parisc   allyesconfig
x86_64   randconfig-a001-20200327
x86_64   randconfig-a002-20200327
x86_64   randconfig-a003-20200327
i386 randconfig-a001-20200327
i386 randconfig-a002-20200327
i386 randconfig-a003-20200327
mips randconfig-a001-20200327
nds32randconfig-a001-20200327
m68k randconfig-a001-20200327
parisc   randconfig-a001-20200327
alpharandconfig-a001-20200327
riscvrandconfig-a001-20200327
h8300randconfig-a001-20200327
microblaze   randconfig-a001-20200327
nios2randconfig-a001-20200327
c6x  randconfig-a001-20200327
sparc64  randconfig-a001-20200327
csky randconfig-a001-20200327
openrisc randconfig-a001-20200327
s390 randconfig-a001-20200327
sh   randconfig-a001-20200327
xtensa   randconfig-a001-20200327
x86_64   randconfig-b001-20200327
x86_64   randconfig-b002-20200327
x86_64   randconfig-b003-20200327
i386 randconfig-b001-20200327
i386 randconfig-b002-20200327
i386 randconfig-b003-20200327
x86_64   randconfig-c001-20200327
x86_64   randconfig-c002-20200327
x86_64   randconfig-c003-20200327
i386 randconfig-c001-20200327
i386 randconfig-c002-20200327
i386 rand

[driver-core:debugfs_cleanup] BUILD SUCCESS c6380a673fb3aa90fa9c2cac3453169e4f9b66e3

2020-03-27 Thread kbuild test robot
tree/branch: 
https://git.kernel.org/pub/scm/linux/kernel/git/gregkh/driver-core.git  
debugfs_cleanup
branch HEAD: c6380a673fb3aa90fa9c2cac3453169e4f9b66e3  powerpc: powernv: no 
need to check return value of debugfs_create functions

elapsed time: 484m

configs tested: 144
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   efm32_defconfig
arm at91_dt_defconfig
armshmobile_defconfig
arm64   defconfig
arm  exynos_defconfig
armmulti_v5_defconfig
arm   sunxi_defconfig
armmulti_v7_defconfig
sparcallyesconfig
shtitan_defconfig
sh   allmodconfig
riscvallmodconfig
riscv allnoconfig
microblazenommu_defconfig
i386  allnoconfig
i386 allyesconfig
i386 alldefconfig
i386defconfig
ia64 alldefconfig
ia64 allmodconfig
ia64  allnoconfig
ia64 allyesconfig
ia64defconfig
c6x  allyesconfig
c6xevmc6678_defconfig
nios2 10m50_defconfig
nios2 3c120_defconfig
openriscor1ksim_defconfig
openrisc simple_smp_defconfig
xtensa   common_defconfig
xtensa  iss_defconfig
nds32   defconfig
nds32 allnoconfig
cskydefconfig
alpha   defconfig
h8300   h8s-sim_defconfig
h8300 edosk2674_defconfig
m68k   m5475evb_defconfig
m68k allmodconfig
h8300h8300h-sim_defconfig
m68k   sun3_defconfig
m68k  multi_defconfig
arc defconfig
arc  allyesconfig
powerpc defconfig
powerpc   ppc64_defconfig
powerpc  rhel-kconfig
microblaze  mmu_defconfig
powerpc   allnoconfig
mips   32r2_defconfig
mips 64r6el_defconfig
mips allmodconfig
mips  allnoconfig
mips allyesconfig
mips  fuloong2e_defconfig
mips  malta_kvm_defconfig
pariscallnoconfig
pariscgeneric-64bit_defconfig
pariscgeneric-32bit_defconfig
parisc   allyesconfig
i386 randconfig-a002-20200327
i386 randconfig-a001-20200327
x86_64   randconfig-a002-20200327
x86_64   randconfig-a001-20200327
i386 randconfig-a003-20200327
x86_64   randconfig-a003-20200327
alpharandconfig-a001-20200327
m68k randconfig-a001-20200327
mips randconfig-a001-20200327
nds32randconfig-a001-20200327
parisc   randconfig-a001-20200327
riscvrandconfig-a001-20200327
h8300randconfig-a001-20200327
nios2randconfig-a001-20200327
c6x  randconfig-a001-20200327
sparc64  randconfig-a001-20200327
csky randconfig-a001-20200327
openrisc randconfig-a001-20200327
s390 randconfig-a001-20200327
sh   randconfig-a001-20200327
xtensa   randconfig-a001-20200327
i386 randconfig-b003-20200327
i386 randconfig-b001-20200327
x86_64   randconfig-b003-20200327
i386 randconfig-b002-20200327
x86_64   randconfig-b002-20200327
x86_64   randconfig-b001-20200327
x86_64   randconfig-d001-20200327
x86_64   randconfig-d002-20200327
x86_64   randconfig-d003-20200327
i386 randconfig-d001-20200327
i386 randconfig-d002-20200327
i386 randconfig-d003-20200327
x86_64   randconfig-e001-20200327

Cooperation

2020-03-27 Thread Bahar�Zanjani
My Name is Bahar Zanjani Siblings to 45 years old Babak Morteza Zanjani an 
Iranian billionaire and business magnate apprehended on 2013 sentenced to death 
penalty and partner to Jailed Iranian Diplomat Ali Reza Monfared.

My siblings Babak Morteza Zanjani was the managing director of the UAE-based 
Sorinet Group, one of Iran's largest business conglomerates from Tehran, Iran 
currently on death penalty .

Due to current sanctions and unrest in my country Iran , I am looking for a 
relationship with a business or individual in your country so that I can make 
some investments there.

Please, reply me so we can discuss further as you keep this privy .
Thanks for your cooperation
Bahar Zanjani
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Cooperation

2020-03-27 Thread Bahar�Zanjani
My Name is Bahar Zanjani Siblings to 45 years old Babak Morteza Zanjani an 
Iranian billionaire and business magnate apprehended on 2013 sentenced to death 
penalty and partner to Jailed Iranian Diplomat Ali Reza Monfared.

My siblings Babak Morteza Zanjani was the managing director of the UAE-based 
Sorinet Group, one of Iran's largest business conglomerates from Tehran, Iran 
currently on death penalty .

Due to current sanctions and unrest in my country Iran , I am looking for a 
relationship with a business or individual in your country so that I can make 
some investments there.

Please, reply me so we can discuss further as you keep this privy .
Thanks for your cooperation
Bahar Zanjani
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Cooperation

2020-03-27 Thread Bahar�Zanjani
My Name is Bahar Zanjani Siblings to 45 years old Babak Morteza Zanjani an 
Iranian billionaire and business magnate apprehended on 2013 sentenced to death 
penalty and partner to Jailed Iranian Diplomat Ali Reza Monfared.

My siblings Babak Morteza Zanjani was the managing director of the UAE-based 
Sorinet Group, one of Iran's largest business conglomerates from Tehran, Iran 
currently on death penalty .

Due to current sanctions and unrest in my country Iran , I am looking for a 
relationship with a business or individual in your country so that I can make 
some investments there.

Please, reply me so we can discuss further as you keep this privy .
Thanks for your cooperation
Bahar Zanjani
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[staging:staging-testing] BUILD SUCCESS e681bb287f40e7a9dbcb04cef80fd87a2511ab86

2020-03-27 Thread kbuild test robot
tree/branch: https://git.kernel.org/pub/scm/linux/kernel/git/gregkh/staging.git 
 staging-testing
branch HEAD: e681bb287f40e7a9dbcb04cef80fd87a2511ab86  staging: vt6656: Use 
DIV_ROUND_UP macro instead of specific code

elapsed time: 480m

configs tested: 164
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
arc  allyesconfig
um i386_defconfig
h8300 edosk2674_defconfig
um  defconfig
shtitan_defconfig
ia64 alldefconfig
riscv  rv32_defconfig
pariscgeneric-32bit_defconfig
s390  debug_defconfig
alpha   defconfig
i386  allnoconfig
i386 alldefconfig
i386 allyesconfig
i386defconfig
ia64 allmodconfig
ia64  allnoconfig
ia64 allyesconfig
ia64defconfig
nios2 3c120_defconfig
nios2 10m50_defconfig
c6xevmc6678_defconfig
xtensa  iss_defconfig
c6x  allyesconfig
xtensa   common_defconfig
openrisc simple_smp_defconfig
openriscor1ksim_defconfig
nds32   defconfig
nds32 allnoconfig
cskydefconfig
h8300h8300h-sim_defconfig
h8300   h8s-sim_defconfig
m68k allmodconfig
m68k   m5475evb_defconfig
m68k  multi_defconfig
m68k   sun3_defconfig
arc defconfig
powerpc defconfig
powerpc   ppc64_defconfig
powerpc  rhel-kconfig
microblaze  mmu_defconfig
microblazenommu_defconfig
powerpc   allnoconfig
mips   32r2_defconfig
mips 64r6el_defconfig
mips allmodconfig
mips  allnoconfig
mips allyesconfig
mips  fuloong2e_defconfig
mips  malta_kvm_defconfig
pariscallnoconfig
parisc   allyesconfig
pariscgeneric-64bit_defconfig
x86_64   randconfig-a001-20200327
x86_64   randconfig-a002-20200327
x86_64   randconfig-a003-20200327
i386 randconfig-a001-20200327
i386 randconfig-a002-20200327
i386 randconfig-a003-20200327
alpharandconfig-a001-20200327
m68k randconfig-a001-20200327
mips randconfig-a001-20200327
nds32randconfig-a001-20200327
parisc   randconfig-a001-20200327
riscvrandconfig-a001-20200327
c6x  randconfig-a001-20200327
h8300randconfig-a001-20200327
microblaze   randconfig-a001-20200327
nios2randconfig-a001-20200327
sparc64  randconfig-a001-20200327
s390 randconfig-a001-20200327
xtensa   randconfig-a001-20200327
csky randconfig-a001-20200327
openrisc randconfig-a001-20200327
sh   randconfig-a001-20200327
x86_64   randconfig-b001-20200327
x86_64   randconfig-b002-20200327
x86_64   randconfig-b003-20200327
i386 randconfig-b001-20200327
i386 randconfig-b002-20200327
i386 randconfig-b003-20200327
x86_64   randconfig-c001-20200327
x86_64   randconfig-c002-20200327
x86_64   randconfig-c003-20200327
i386 randconfig-c001-20200327
i386 randconfig-c002-20200327
i386

[PATCH] staging: rtl8188eu: remove unnecessary parentheses

2020-03-27 Thread Michael Straube
Remove all remaining unnecessary parentheses reported by checkpatch.

Signed-off-by: Michael Straube 
---
 .../staging/rtl8188eu/core/rtw_ieee80211.c|  4 +-
 drivers/staging/rtl8188eu/core/rtw_mlme_ext.c |  4 +-
 drivers/staging/rtl8188eu/hal/odm.c   | 52 +-
 drivers/staging/rtl8188eu/hal/phy.c   |  8 +-
 drivers/staging/rtl8188eu/hal/rf.c|  2 +-
 drivers/staging/rtl8188eu/hal/rtl8188e_cmd.c  |  2 +-
 .../staging/rtl8188eu/include/osdep_service.h |  2 +-
 .../staging/rtl8188eu/os_dep/ioctl_linux.c| 94 +--
 .../staging/rtl8188eu/os_dep/rtw_android.c|  2 +-
 9 files changed, 85 insertions(+), 85 deletions(-)

diff --git a/drivers/staging/rtl8188eu/core/rtw_ieee80211.c 
b/drivers/staging/rtl8188eu/core/rtw_ieee80211.c
index e186982d5908..caf600eba03b 100644
--- a/drivers/staging/rtl8188eu/core/rtw_ieee80211.c
+++ b/drivers/staging/rtl8188eu/core/rtw_ieee80211.c
@@ -253,11 +253,11 @@ int rtw_generate_ie(struct registry_priv *pregistrypriv)
}
 
/* DS parameter set */
-   ie = rtw_set_ie(ie, _DSSET_IE_, 1, (u8 
*)&(pdev_network->Configuration.DSConfig), );
+   ie = rtw_set_ie(ie, _DSSET_IE_, 1, (u8 
*)_network->Configuration.DSConfig, );
 
/* IBSS Parameter Set */
 
-   ie = rtw_set_ie(ie, _IBSS_PARA_IE_, 2, (u8 
*)&(pdev_network->Configuration.ATIMWindow), );
+   ie = rtw_set_ie(ie, _IBSS_PARA_IE_, 2, (u8 
*)_network->Configuration.ATIMWindow, );
 
if (rateLen > 8)
ie = rtw_set_ie(ie, _EXT_SUPPORTEDRATES_IE_, (rateLen - 8), 
(pdev_network->SupportedRates + 8), );
diff --git a/drivers/staging/rtl8188eu/core/rtw_mlme_ext.c 
b/drivers/staging/rtl8188eu/core/rtw_mlme_ext.c
index 04897cd48370..bce777e4bf6c 100644
--- a/drivers/staging/rtl8188eu/core/rtw_mlme_ext.c
+++ b/drivers/staging/rtl8188eu/core/rtw_mlme_ext.c
@@ -1932,11 +1932,11 @@ static void site_survey(struct adapter *padapter)
if 
(pmlmeext->sitesurvey_res.ssid[i].ssid_length) {
/* todo: to issue two probe req??? */
issue_probereq(padapter,
-   &(pmlmeext->sitesurvey_res.ssid[i]),
+   >sitesurvey_res.ssid[i],
NULL, false);
/* msleep(SURVEY_TO>>1); */
issue_probereq(padapter,
-   &(pmlmeext->sitesurvey_res.ssid[i]),
+   >sitesurvey_res.ssid[i],
NULL, false);
}
}
diff --git a/drivers/staging/rtl8188eu/hal/odm.c 
b/drivers/staging/rtl8188eu/hal/odm.c
index 698377ea60ee..b3cc40527730 100644
--- a/drivers/staging/rtl8188eu/hal/odm.c
+++ b/drivers/staging/rtl8188eu/hal/odm.c
@@ -193,7 +193,7 @@ void ODM_DMWatchdog(struct odm_dm_struct *pDM_Odm)
odm_DIG(pDM_Odm);
odm_CCKPacketDetectionThresh(pDM_Odm);
 
-   if (*(pDM_Odm->pbPowerSaving))
+   if (*pDM_Odm->pbPowerSaving)
return;
 
odm_RefreshRateAdaptiveMask(pDM_Odm);
@@ -229,13 +229,13 @@ void odm_CommonInfoSelfUpdate(struct odm_dm_struct 
*pDM_Odm)
u8 i;
struct sta_info *pEntry;
 
-   if (*(pDM_Odm->pBandWidth) == ODM_BW40M) {
-   if (*(pDM_Odm->pSecChOffset) == 1)
-   pDM_Odm->ControlChannel = *(pDM_Odm->pChannel) - 2;
-   else if (*(pDM_Odm->pSecChOffset) == 2)
-   pDM_Odm->ControlChannel = *(pDM_Odm->pChannel) + 2;
+   if (*pDM_Odm->pBandWidth == ODM_BW40M) {
+   if (*pDM_Odm->pSecChOffset == 1)
+   pDM_Odm->ControlChannel = *pDM_Odm->pChannel - 2;
+   else if (*pDM_Odm->pSecChOffset == 2)
+   pDM_Odm->ControlChannel = *pDM_Odm->pChannel + 2;
} else {
-   pDM_Odm->ControlChannel = *(pDM_Odm->pChannel);
+   pDM_Odm->ControlChannel = *pDM_Odm->pChannel;
}
 
for (i = 0; i < ODM_ASSOCIATE_ENTRY_NUM; i++) {
@@ -270,16 +270,16 @@ void odm_CmnInfoInit_Debug(struct odm_dm_struct *pDM_Odm)
 void odm_CmnInfoHook_Debug(struct odm_dm_struct *pDM_Odm)
 {
ODM_RT_TRACE(pDM_Odm, ODM_COMP_COMMON, ODM_DBG_LOUD, 
("odm_CmnInfoHook_Debug==>\n"));
-   ODM_RT_TRACE(pDM_Odm, ODM_COMP_COMMON, ODM_DBG_LOUD, 
("pNumTxBytesUnicast=%llu\n", *(pDM_Odm->pNumTxBytesUnicast)));
-   ODM_RT_TRACE(pDM_Odm, ODM_COMP_COMMON, ODM_DBG_LOUD, 
("pNumRxBytesUnicast=%llu\n", *(pDM_Odm->pNumRxBytesUnicast)));
-   ODM_RT_TRACE(pDM_Odm, ODM_COMP_COMMON, ODM_DBG_LOUD, 
("pWirelessMode=0x%x\n", *(pDM_Odm->pWirelessMode)));
-   ODM_RT_TRACE(pDM_Odm, ODM_COMP_COMMON, ODM_DBG_LOUD, 
("pSecChOffset=%d\n", *(pDM_Odm->pSecChOffset)));
-   

Re: Brenda Rogers

2020-03-27 Thread Brenda Rogers
I am Brenda Rogers, an Australian by birth. I am sick and dying and having 
operations at Albert Schweitzer Ziekenhuis, Dordrecht,South Holland, in the 
Netherlands.

My Husband an American citizen died years ago and we had no child. I am left 
with only family members whom do not represent my wishes.

At this critical time, I want you to use my funds for the homeless as this is 
my wish as i have decided to will my funds to you. This is based on my wish and 
my Attorney has been notified.

I am at operation room right now and cant even speak again hence had to reach 
you through this means.

Contact My Lawyer, David Henrik for guidance. 


Warm Regards.
Ms.Brenda Rogers








Send STOP EMAIL to Unsubscribe from my Email list if you do not want to receive 
any message from me.
Thank you.
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH] staging: vt6656: Define EnCFG_BBType_MASK as OR between previous defines

2020-03-27 Thread Oscar Carter
Define the EnCFG_BBType_MASK bit as an OR operation between two previous
defines instead of using the OR between two new BIT macros. Thus, the
code is more clear.

Fixes: a74081b44291 ("staging: vt6656: Use BIT() macro instead of hex value")
Signed-off-by: Oscar Carter 
Reviewed-by: Dan Carpenter 
---
 drivers/staging/vt6656/mac.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/staging/vt6656/mac.h b/drivers/staging/vt6656/mac.h
index c532b27de37f..b01d9ee8677e 100644
--- a/drivers/staging/vt6656/mac.h
+++ b/drivers/staging/vt6656/mac.h
@@ -177,7 +177,7 @@
 #define EnCFG_BBType_a 0x00
 #define EnCFG_BBType_b BIT(0)
 #define EnCFG_BBType_g BIT(1)
-#define EnCFG_BBType_MASK  (BIT(0) | BIT(1))
+#define EnCFG_BBType_MASK  (EnCFG_BBType_b | EnCFG_BBType_g)
 #define EnCFG_ProtectMdBIT(5)

 /* Bits in the EnhanceCFG_1 register */
--
2.20.1

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


Contact the JP Morgan Chase Bank Ny to receive your transfer $12.5Million Us Dollars today.

2020-03-27 Thread Mr. Mike Benz CEO Official Director IMF-Benin
Attn: Dear.
Happy to inform you,we have finally deposited your payment funds
$12.5 million us dollars with our international Paying bank,
JP Morgan Chase Bank Ny, this morning
to transfer the payment amount of $12.500.000,00 Million Us Dollars to you
Your transfer is ready for you now.
Contact the JP Morgan Chase Bank Ny to receive your transfer $12.5Million
Us Dollars today
Director Eco bank-Benin: Dr. RICHARD LONGORIA
Email id:  jp.morganchasebankn...@yahoo.com
Tel/mobile, (917) 983-4846
Note,I have paid the wire transfer and insurance fees for you
But the only money you are to send to this bank is $25.00 us dollars
Been for the activation of your payment files before funds been released to you
Contact Him now to receive your transfer deposited this morning
I wait for your reply upon confirmation
Mr. Mike Benz
CEO Official Director IMF-Benin
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [PATCH v6 00/17] wilc1000: move out of staging

2020-03-27 Thread Ajay.Kathat
Hi Kalle,

On 27/03/20 4:46 pm, Kalle Valo wrote:
> 
>  writes:
> 
>> 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 v5:
>>  - handle DT binding review comments suggested in below link:
>>   * https://lore.kernel.org/driverdev-devel/20200320175920.GA31641@bogus
>>  - merged latest driver from staging which contains few cleanup patches
>>and changes to use crc7 from existing library instead of having
>>private implementation.
> 
> This is already the third version this month, please avoid spamming the
> list unnecessarily. What you can do to speed up the acceptance is to get
> Reviewed-by tags from people, the more I see those the more confident I
> get about the driver. I will also review this again once I find some
> free time, but don't know when that will happen.
> 

Apology for sending the patch series multiple times. This series also
contains the DT binding documentation patch. We have received couple of
review comments for the file. In the latest series all those comments
are taken care and hope it cover all points. I wanted to atleast close
this and get Reviewed-by tag for the file.
Any suggestion on how to get only single file reviewed out of this
series in case further comments are received.

> But it would be good to document in the cover letter what commit id are
> you using as the baseline. That way it's easy to review rest of the
> changes Greg has applied separately and you don't need to resend the
> whole driver everytime.
> 

Sure, will capture the commit id details in the series cover letter.

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


Re: [PATCH v6 00/17] wilc1000: move out of staging

2020-03-27 Thread Greg KH
On Fri, Mar 27, 2020 at 01:16:01PM +0200, Kalle Valo wrote:
>  writes:
> 
> > 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 v5:
> >  - handle DT binding review comments suggested in below link:
> >   * https://lore.kernel.org/driverdev-devel/20200320175920.GA31641@bogus
> >  - merged latest driver from staging which contains few cleanup patches
> >and changes to use crc7 from existing library instead of having
> >private implementation.
> 
> This is already the third version this month, please avoid spamming the
> list unnecessarily. What you can do to speed up the acceptance is to get
> Reviewed-by tags from people, the more I see those the more confident I
> get about the driver. I will also review this again once I find some
> free time, but don't know when that will happen.
> 
> But it would be good to document in the cover letter what commit id are
> you using as the baseline. That way it's easy to review rest of the
> changes Greg has applied separately and you don't need to resend the
> whole driver everytime.

Using the --base= flag in git format-patch is helpful in automating that
:)

thanks,

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


Re: [PATCH v6 00/17] wilc1000: move out of staging

2020-03-27 Thread Kalle Valo
 writes:

> 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 v5:
>  - handle DT binding review comments suggested in below link:
>   * https://lore.kernel.org/driverdev-devel/20200320175920.GA31641@bogus
>  - merged latest driver from staging which contains few cleanup patches
>and changes to use crc7 from existing library instead of having
>private implementation.

This is already the third version this month, please avoid spamming the
list unnecessarily. What you can do to speed up the acceptance is to get
Reviewed-by tags from people, the more I see those the more confident I
get about the driver. I will also review this again once I find some
free time, but don't know when that will happen.

But it would be good to document in the cover letter what commit id are
you using as the baseline. That way it's easy to review rest of the
changes Greg has applied separately and you don't need to resend the
whole driver everytime.

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


Re: [PATCH v2] staging: vt6656: Use DIV_ROUND_UP macro instead of specific code

2020-03-27 Thread Quentin Deslandes
On 03/26/20 18:59:02, Oscar Carter wrote:
> Use DIV_ROUND_UP macro instead of specific code with the same purpose.
> Also, remove the unused variables.
> 
> Signed-off-by: Oscar Carter 
> ---
> Changelog v1 -> v2
> - Rebase the original patch [1] against the staging-next branch of the greg's
>   staging.git tree.
> 
>   [1] https://lore.kernel.org/lkml/20200322112342.9040-1-oscar.car...@gmx.com/
> 
>  drivers/staging/vt6656/baseband.c | 21 -
>  1 file changed, 4 insertions(+), 17 deletions(-)
> 
> diff --git a/drivers/staging/vt6656/baseband.c 
> b/drivers/staging/vt6656/baseband.c
> index 0b5729abcbcd..a19a563d8bcc 100644
> --- a/drivers/staging/vt6656/baseband.c
> +++ b/drivers/staging/vt6656/baseband.c
> @@ -23,6 +23,7 @@
>   */
> 
>  #include 
> +#include 
>  #include "mac.h"
>  #include "baseband.h"
>  #include "rf.h"
> @@ -133,7 +134,6 @@ unsigned int vnt_get_frame_time(u8 preamble_type, u8 
> pkt_type,
>  {
>   unsigned int frame_time;
>   unsigned int preamble;
> - unsigned int tmp;
>   unsigned int rate = 0;
> 
>   if (tx_rate > RATE_54M)
> @@ -147,20 +147,11 @@ unsigned int vnt_get_frame_time(u8 preamble_type, u8 
> pkt_type,
>   else
>   preamble = 192;
> 
> - frame_time = (frame_length * 80) / rate;
> - tmp = (frame_time * rate) / 80;
> -
> - if (frame_length != tmp)
> - frame_time++;
> -
> + frame_time = DIV_ROUND_UP(frame_length * 80, rate);
>   return preamble + frame_time;
>   }
> - frame_time = (frame_length * 8 + 22) / rate;
> - tmp = ((frame_time * rate) - 22) / 8;
> -
> - if (frame_length != tmp)
> - frame_time++;
> 
> + frame_time = DIV_ROUND_UP(frame_length * 8 + 22, rate);
>   frame_time = frame_time * 4;
> 
>   if (pkt_type != PK_TYPE_11A)
> @@ -214,11 +205,7 @@ void vnt_get_phy_field(struct vnt_private *priv, u32 
> frame_length,
> 
>   break;
>   case RATE_5M:
> - count = (bit_count * 10) / 55;
> - tmp = (count * 55) / 10;
> -
> - if (tmp != bit_count)
> - count++;
> + count = DIV_ROUND_UP(bit_count * 10, 55);
> 
>   if (preamble_type == 1)
>   phy->signal = 0x0a;
> --
> 2.20.1

Reviewed-by: Quentin Deslandes 

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


Re: [PATCH] staging: rtl8712: fix checkpatch warnings

2020-03-27 Thread Greg Kroah-Hartman
On Thu, Mar 26, 2020 at 01:56:16AM -0400, Aiman Najjar wrote:
> This patch fixes remaining warnings in rtl871x_xmit.c of
> rtl8712 staging driver
> 
> The following warnings are resolved:
> 
> WARNING: line over 80 characters
> \#74: FILE: drivers/staging//rtl8712/rtl871x_xmit.c:74:
> + * Please allocate memory with the sz = (struct xmit_frame) * 
> NR_XMITFRAME,
> 
> WARNING: line over 80 characters
> \#79: FILE: drivers/staging//rtl8712/rtl871x_xmit.c:79:
> + kmalloc(NR_XMITFRAME * sizeof(struct xmit_frame) + 4, 
> GFP_ATOMIC);
> 
> WARNING: line over 80 characters
> \#129: FILE: drivers/staging//rtl8712/rtl871x_xmit.c:129:
> + pxmitbuf->pallocated_buf = kmalloc(MAX_XMITBUF_SZ + 
> XMITBUF_ALIGN_SZ,
> 
> WARNING: Avoid multiple line dereference - prefer 
> 'psecuritypriv->XGrptxmickey'
> \#378: FILE: drivers/staging//rtl8712/rtl871x_xmit.c:378:
> + psecuritypriv->
> + XGrptxmickey[psecuritypriv->
> 
> WARNING: Avoid multiple line dereference - prefer 'psecuritypriv->XGrpKeyid'
> \#379: FILE: drivers/staging//rtl8712/rtl871x_xmit.c:379:
> + XGrptxmickey[psecuritypriv->
> + XGrpKeyid].skey);
> 
> WARNING: Avoid multiple line dereference - prefer 
> 'psta->sta_xmitpriv.txseq_tid[pattrib->priority]'
> \#544: FILE: drivers/staging//rtl8712/rtl871x_xmit.c:544:
> + pattrib->seqnum = psta->sta_xmitpriv.
> +  txseq_tid[pattrib->priority];
> 
> WARNING: Avoid multiple line dereference - prefer 
> 'psecuritypriv->PrivacyKeyIndex'
> \#636: FILE: drivers/staging//rtl8712/rtl871x_xmit.c:636:
> +   (u8)psecuritypriv->
> +   PrivacyKeyIndex);
> 
> WARNING: Avoid multiple line dereference - prefer 'psecuritypriv->XGrpKeyid'
> \#643: FILE: drivers/staging//rtl8712/rtl871x_xmit.c:643:
> +(u8)psecuritypriv->
> +XGrpKeyid);
> 
> WARNING: Avoid multiple line dereference - prefer 'psecuritypriv->XGrpKeyid'
> \#652: FILE: drivers/staging//rtl8712/rtl871x_xmit.c:652:
> +(u8)psecuritypriv->
> +XGrpKeyid);
> 
> Signed-off-by: aimannajjar 
> ---
>  drivers/staging/rtl8712/rtl871x_xmit.c | 85 +-
>  1 file changed, 41 insertions(+), 44 deletions(-)
> 
> diff --git a/drivers/staging/rtl8712/rtl871x_xmit.c 
> b/drivers/staging/rtl8712/rtl871x_xmit.c
> index f0b85338b567..82df5e26f8c8 100644
> --- a/drivers/staging/rtl8712/rtl871x_xmit.c
> +++ b/drivers/staging/rtl8712/rtl871x_xmit.c
> @@ -71,12 +71,13 @@ int _r8712_init_xmit_priv(struct xmit_priv *pxmitpriv,
>   _init_queue(>apsd_queue);
>   _init_queue(>free_xmit_queue);
>   /*
> -  * Please allocate memory with the sz = (struct xmit_frame) * 
> NR_XMITFRAME,
> +  * Please allocate memory with sz = (struct xmit_frame) * NR_XMITFRAME,
>* and initialize free_xmit_frame below.
>* Please also apply  free_txobj to link_up all the xmit_frames...
>*/
>   pxmitpriv->pallocated_frame_buf =
> - kmalloc(NR_XMITFRAME * sizeof(struct xmit_frame) + 4, 
> GFP_ATOMIC);
> + kmalloc(NR_XMITFRAME * sizeof(struct xmit_frame) + 4,
> + GFP_ATOMIC);
>   if (!pxmitpriv->pallocated_frame_buf) {
>   pxmitpriv->pxmit_frame_buf = NULL;
>   return -ENOMEM;
> @@ -126,8 +127,8 @@ int _r8712_init_xmit_priv(struct xmit_priv *pxmitpriv,
>   pxmitbuf = (struct xmit_buf *)pxmitpriv->pxmitbuf;
>   for (i = 0; i < NR_XMITBUFF; i++) {
>   INIT_LIST_HEAD(>list);
> - pxmitbuf->pallocated_buf = kmalloc(MAX_XMITBUF_SZ + 
> XMITBUF_ALIGN_SZ,
> -GFP_ATOMIC);
> + pxmitbuf->pallocated_buf =
> + kmalloc(MAX_XMITBUF_SZ + XMITBUF_ALIGN_SZ, GFP_ATOMIC);
>   if (!pxmitbuf->pallocated_buf)
>   return -ENOMEM;
>   pxmitbuf->pbuf = pxmitbuf->pallocated_buf + XMITBUF_ALIGN_SZ -
> @@ -350,7 +351,7 @@ static int xmitframe_addmic(struct _adapter *padapter,
>   struct  sta_info *stainfo;
>   struct  qos_priv *pqospriv = &(padapter->mlmepriv.qospriv);
>   struct  pkt_attrib  *pattrib = >attrib;
> - struct  security_priv *psecuritypriv = >securitypriv;
> + struct  security_priv *psecpriv = >securitypriv;
>   struct  xmit_priv *pxmitpriv = >xmitpriv;
>   u8 priority[4] = {0x0, 0x0, 0x0, 0x0};
>   bool bmcst = is_multicast_ether_addr(pattrib->ra);
> @@ -368,15 +369,14 @@ static int xmitframe_addmic(struct _adapter *padapter,
>  0x0, 0x0};
>   pframe = 

[PATCH v6 11/17] wilc1000: add spi.c

2020-03-27 Thread Ajay.Kathat
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 | 945 ++
 1 file changed, 945 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 ..3f19e3f38a39
--- /dev/null
+++ b/drivers/net/wireless/microchip/wilc1000/spi.c
@@ -0,0 +1,945 @@
+// SPDX-License-Identifier: GPL-2.0
+/*
+ * Copyright (c) 2012 - 2018 Microchip Technology Inc., and its subsidiaries.
+ * All rights reserved.
+ */
+
+#include 
+#include 
+#include 
+
+#include "netdev.h"
+#include "cfg80211.h"
+
+struct wilc_spi {
+   int crc_off;
+};
+
+static const struct wilc_hif_func wilc_hif_spi;
+
+/
+ *
+ *  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[];
+   } __packed simple_cmd;
+   struct {
+   u8 addr[3];
+   u8 size[2];
+   u8 crc[];
+   } __packed dma_cmd;
+   struct {
+   u8 addr[3];
+   u8 size[3];
+   u8 crc[];
+   } __packed dma_cmd_ext;
+   struct {
+   u8 addr[2];
+   __be32 data;
+   u8 crc[];
+   } __packed internal_w_cmd;
+   struct {
+   u8 addr[3];
+   __be32 data;
+   u8 crc[];
+   } __packed w_cmd;
+   } u;
+} __packed;
+
+struct wilc_spi_read_rsp_data {
+   u8 rsp_cmd_type;
+   u8 status;
+   u8 resp_header;
+   u8 resp_data[4];
+   u8 crc[];
+} __packed;
+
+struct wilc_spi_rsp_data {
+   u8 rsp_cmd_type;
+   u8 status;
+} __packed;
+
+static int wilc_bus_probe(struct spi_device *spi)
+{
+   int ret;
+   struct wilc *wilc;
+   struct wilc_spi *spi_priv;
+
+   spi_priv = kzalloc(sizeof(*spi_priv), GFP_KERNEL);
+   if (!spi_priv)
+   return -ENOMEM;
+
+   ret = wilc_cfg80211_init(, >dev, WILC_HIF_SPI, _hif_spi);
+   if (ret) {
+   kfree(spi_priv);
+   return ret;
+   }
+
+   spi_set_drvdata(spi, wilc);
+   wilc->dev = >dev;
+   wilc->bus_data = spi_priv;
+   wilc->dev_irq_num = spi->irq;
+
+   wilc->rtc_clk = devm_clk_get(>dev, "rtc_clk");
+   if (PTR_ERR_OR_ZERO(wilc->rtc_clk) == -EPROBE_DEFER)
+   return -EPROBE_DEFER;
+   else if (!IS_ERR(wilc->rtc_clk))
+   clk_prepare_enable(wilc->rtc_clk);
+
+   return 0;
+}
+
+static int wilc_bus_remove(struct spi_device *spi)
+{
+   struct wilc *wilc = spi_get_drvdata(spi);
+
+   if (!IS_ERR(wilc->rtc_clk))
+   clk_disable_unprepare(wilc->rtc_clk);
+
+   wilc_netdev_cleanup(wilc);
+   return 0;
+}
+
+static const struct of_device_id wilc_of_match[] = {
+   { .compatible = "microchip,wilc1000", },
+   { /* sentinel */ }
+};
+MODULE_DEVICE_TABLE(of, wilc_of_match);
+
+static struct spi_driver wilc_spi_driver = {
+   .driver = {
+   .name = MODALIAS,
+   .of_match_table = wilc_of_match,
+   },
+   .probe =  wilc_bus_probe,
+   .remove = wilc_bus_remove,
+};
+module_spi_driver(wilc_spi_driver);
+MODULE_LICENSE("GPL");
+
+static int wilc_spi_tx(struct wilc *wilc, u8 *b, u32 len)
+{
+   struct spi_device *spi = to_spi_device(wilc->dev);
+   int ret;
+   struct 

[PATCH v6 17/17] wilc1000: add Makefile and Kconfig files for wilc1000 compilation

2020-03-27 Thread Ajay.Kathat
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   | 47 +++
 .../net/wireless/microchip/wilc1000/Makefile  | 14 ++
 drivers/staging/Kconfig   |  2 -
 drivers/staging/Makefile  |  1 -
 8 files changed, 80 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 ..80c92e8bf8a5
--- /dev/null
+++ b/drivers/net/wireless/microchip/wilc1000/Kconfig
@@ -0,0 +1,47 @@
+# SPDX-License-Identifier: GPL-2.0
+config WILC1000
+   tristate
+   help
+ Add support for the Atmel WILC1000 802.11 b/g/n SoC.
+ This provides Wi-FI over an SDIO or SPI interface, and
+ is usually found in IoT devices.
+
+ 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
+   select CRC7
+   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 

[PATCH v6 14/17] wilc1000: add sdio.c

2020-03-27 Thread Ajay.Kathat
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| 1023 +
 1 file changed, 1023 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 ..36eb589263bf
--- /dev/null
+++ b/drivers/net/wireless/microchip/wilc1000/sdio.c
@@ -0,0 +1,1023 @@
+// 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 "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, );
+   data = sdio_readb(func, cmd->address, );
+   cmd->data = data;
+   } else {
+   sdio_writeb(func, cmd->data, cmd->address, );
+   }
+   } else {/* read */
+   data = sdio_readb(func, cmd->address, );
+   cmd->data = data;
+   }
+
+   sdio_release_host(func);
+
+   if (ret)
+   dev_err(>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(>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 wilc_sdio *sdio_priv;
+
+   sdio_priv = kzalloc(sizeof(*sdio_priv), GFP_KERNEL);
+   if (!sdio_priv)
+   return -ENOMEM;
+
+   ret = wilc_cfg80211_init(, >dev, WILC_HIF_SDIO,
+_hif_sdio);
+   if (ret) {
+   kfree(sdio_priv);
+   return ret;
+   }
+
+   if (IS_ENABLED(CONFIG_WILC1000_HW_OOB_INTR)) {
+   struct device_node *np = func->card->dev.of_node;
+   int irq_num = of_irq_get(np, 0);
+
+   if (irq_num > 0) {
+   wilc->dev_irq_num = irq_num;
+   sdio_priv->irq_gpio = true;
+   }
+   }
+
+   sdio_set_drvdata(func, wilc);
+   wilc->bus_data = sdio_priv;
+   wilc->dev = >dev;
+
+   wilc->rtc_clk = devm_clk_get(>card->dev, "rtc");
+   if (PTR_ERR_OR_ZERO(wilc->rtc_clk) == -EPROBE_DEFER)
+   return -EPROBE_DEFER;
+   else if (!IS_ERR(wilc->rtc_clk))
+   clk_prepare_enable(wilc->rtc_clk);
+
+   dev_info(>dev, 

[PATCH v6 02/17] wilc1000: add hif.c

2020-03-27 Thread Ajay.Kathat
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 ..6c7de2f8d3f2
--- /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(>work_comp);
+
+   return msg;
+}
+
+static int wilc_enqueue_work(struct host_if_msg *msg)
+{
+   INIT_WORK(>work, msg->fn);
+
+   if (!msg->vif || !msg->vif->wilc || !msg->vif->wilc->hif_workqueue)
+   return -EINVAL;
+
+   if (!queue_work(msg->vif->wilc->hif_workqueue, >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, >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 *)_running_scan;
+   wid.size = sizeof(char);
+
+   result = wilc_send_config_pkt(vif, WILC_SET_CFG, , 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 = _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 wid wid_list[5];
+   u32 

[PATCH v6 07/17] wilc1000: add cfg80211.h

2020-03-27 Thread Ajay.Kathat
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 v6 03/17] wilc1000: add wlan_if.h

2020-03-27 Thread Ajay.Kathat
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 v6 09/17] wilc1000: add netdev.c

2020-03-27 Thread Ajay.Kathat
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  | 934 ++
 1 file changed, 934 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 ..f94a17babd12
--- /dev/null
+++ b/drivers/net/wireless/microchip/wilc1000/netdev.c
@@ -0,0 +1,934 @@
+// 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)
+{
+   struct wilc_vif *vif = netdev_priv(dev);
+   struct wilc *wl = vif->wilc;
+   int ret;
+
+   ret = request_threaded_irq(wl->dev_irq_num, isr_uh_routine,
+  isr_bh_routine,
+  IRQF_TRIGGER_FALLING | IRQF_ONESHOT,
+  "WILC_IRQ", dev);
+   if (ret) {
+   netdev_err(dev, "Failed to request IRQ [%d]\n", ret);
+   return ret;
+   }
+   netdev_dbg(dev, "IRQ request succeeded IRQ-NUM= %d\n", wl->dev_irq_num);
+
+   return 0;
+}
+
+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, , 1);
+   if (wilc->mac_status == WILC_MAC_STATUS_INIT) {
+   wilc->mac_status = status;
+   complete(>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, >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(>srcu);
+   list_for_each_entry_rcu(vif, >vif_list, list) {
+   if (!is_zero_ether_addr(vif->bssid))
+   ret_val++;
+   }
+   srcu_read_unlock(>srcu, srcu_idx);
+   return ret_val;
+}
+
+static int wilc_txq_task(void *vp)
+{
+   int ret;
+   u32 txq_count;
+   struct wilc *wl = vp;
+
+   complete(>txq_thread_started);
+   while (1) {
+   wait_for_completion(>txq_event);
+
+   if (wl->close) {
+   complete(>txq_thread_started);
+
+   while (!kthread_should_stop())
+   schedule();
+   break;
+   }
+   do {
+   ret = wilc_wlan_handle_txq(wl, _count);
+   if (txq_count < 

[PATCH v6 05/17] wilc1000: add wlan_cfg.c

2020-03-27 Thread Ajay.Kathat
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, [offset]);
+   put_unaligned_le16(1, [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, [offset]);
+   put_unaligned_le16(2, [offset + 2]);
+   put_unaligned_le16(val16, [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, [offset]);
+   put_unaligned_le16(4, [offset + 2]);
+   put_unaligned_le32(val32, [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, [offset]);
+   put_unaligned_le16(size, [offset + 2]);
+   if (str && size != 0)
+   memcpy([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, [offset]);
+   put_unaligned_le16(size, [offset + 2]);
+
+   if ((b) && size != 0) {
+   memcpy([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 = >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++;
+
+   if (cfg->hw[i].id == wid)
+   

[PATCH v6 10/17] wilc1000: add mon.c

2020-03-27 Thread Ajay.Kathat
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 v6 16/17] dt: bindings: net: add microchip,wilc1000.yaml

2020-03-27 Thread Ajay.Kathat
From: Ajay Singh 

This file describes the binding details to connect wilc1000 device. It's
moved from staging to 'Documentation/devicetree/bindings/net/wireless'
path.

Signed-off-by: Ajay Singh 
---
 .../net/wireless/microchip,wilc1000.yaml  | 71 +++
 1 file changed, 71 insertions(+)
 create mode 100644 
Documentation/devicetree/bindings/net/wireless/microchip,wilc1000.yaml

diff --git 
a/Documentation/devicetree/bindings/net/wireless/microchip,wilc1000.yaml 
b/Documentation/devicetree/bindings/net/wireless/microchip,wilc1000.yaml
new file mode 100644
index ..2c320eb2a8c4
--- /dev/null
+++ b/Documentation/devicetree/bindings/net/wireless/microchip,wilc1000.yaml
@@ -0,0 +1,71 @@
+# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/net/wireless/microchip,wilc1000.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: Microchip WILC wireless devicetree bindings
+
+maintainers:
+  - Adham Abozaeid 
+  - Ajay Singh 
+
+description:
+  The wilc1000 chips can be connected via SPI or SDIO. This document
+  describes the binding to connect wilc devices.
+
+properties:
+  compatible:
+const: microchip,wilc1000
+
+  spi-max-frequency: true
+
+  interrupts:
+maxItems: 1
+
+  clocks:
+description: phandle to the clock connected on rtc clock line.
+maxItems: 1
+
+  clock-names:
+const: rtc
+
+required:
+  - compatible
+  - interrupts
+
+examples:
+  - |
+spi {
+  #address-cells = <1>;
+  #size-cells = <0>;
+  wifi@0 {
+compatible = "microchip,wilc1000";
+spi-max-frequency = <4800>;
+reg = <0>;
+interrupt-parent = <>;
+interrupts = <27 0>;
+clocks = <>;
+clock-names = "rtc";
+  };
+};
+
+  - |
+mmc {
+  #address-cells = <1>;
+  #size-cells = <0>;
+  pinctrl-names = "default";
+  pinctrl-0 = <_mmc1_clk_cmd_dat0 _mmc1_dat1_3>;
+  non-removable;
+  vmmc-supply = <_mmc1_reg>;
+  vqmmc-supply = <_3v3_reg>;
+  bus-width = <4>;
+  wifi@0 {
+compatible = "microchip,wilc1000";
+reg = <0>;
+interrupt-parent = <>;
+interrupts = <27 0>;
+clocks = <>;
+clock-names = "rtc";
+  };
+};
-- 
2.24.0
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH v6 08/17] wilc1000: add netdev.h

2020-03-27 Thread Ajay.Kathat
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  | 294 ++
 1 file changed, 294 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 ..61cbec674a62
--- /dev/null
+++ b/drivers/net/wireless/microchip/wilc1000/netdev.h
@@ -0,0 +1,294 @@
+/* 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 

[PATCH v6 04/17] wilc1000: add wlan_cfg.h

2020-03-27 Thread Ajay.Kathat
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 v6 15/17] wilc1000: add fw.h

2020-03-27 Thread Ajay.Kathat
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 v6 12/17] wilc1000: add wlan.h

2020-03-27 Thread Ajay.Kathat
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| 397 ++
 1 file changed, 397 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 ..7689569cd82f
--- /dev/null
+++ b/drivers/net/wireless/microchip/wilc1000/wlan.h
@@ -0,0 +1,397 @@
+/* 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 v6 13/17] wilc1000: add wlan.c

2020-03-27 Thread Ajay.Kathat
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| 1238 +
 1 file changed, 1238 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 ..6a82fb2f283e
--- /dev/null
+++ b/drivers/net/wireless/microchip/wilc1000/wlan.c
@@ -0,0 +1,1238 @@
+// 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(>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(>hif_cs);
+}
+
+static void wilc_wlan_txq_remove(struct wilc *wilc, struct txq_entry_t *tqe)
+{
+   list_del(>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(>txq_spinlock, flags);
+
+   if (!list_empty(>txq_head.list)) {
+   tqe = list_first_entry(>txq_head.list, struct txq_entry_t,
+  list);
+   list_del(>list);
+   wilc->txq_entries -= 1;
+   }
+   spin_unlock_irqrestore(>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(>txq_spinlock, flags);
+
+   list_add_tail(>list, >txq_head.list);
+   wilc->txq_entries += 1;
+
+   spin_unlock_irqrestore(>txq_spinlock, flags);
+
+   complete(>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(>txq_add_to_head_cs);
+
+   spin_lock_irqsave(>txq_spinlock, flags);
+
+   list_add(>list, >txq_head.list);
+   wilc->txq_entries += 1;
+
+   spin_unlock_irqrestore(>txq_spinlock, flags);
+   mutex_unlock(>txq_add_to_head_cs);
+   complete(>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 = >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 = >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 = >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;
+   struct tcp_ack_filter *f = >ack_filter;
+   const struct iphdr *ip_hdr_ptr;
+   const struct tcphdr *tcp_hdr_ptr;
+  

[PATCH v6 01/17] wilc1000: add hif.h

2020-03-27 Thread Ajay.Kathat
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 

[PATCH v6 00/17] wilc1000: move out of staging

2020-03-27 Thread Ajay.Kathat
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 v5:
 - handle DT binding review comments suggested in below link:
  * https://lore.kernel.org/driverdev-devel/20200320175920.GA31641@bogus
 - merged latest driver from staging which contains few cleanup patches
   and changes to use crc7 from existing library instead of having
   private implementation.

Changes since v4:
  - merged wilc1000 SDIO and SPI DT binding into a single file.
  - handle DT binding review comments suggested in below links:
* https://lore.kernel.org/linux-wireless/20200303015558.GA6876@bogus
* 
https://lore.kernel.org/linux-wireless/20200306144400.4269-2-ajay.kat...@microchip.com

Changes since v3:
  - handle few Smatch static checker reported issues.
  - use flexible-array member instead of zero-length array.

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 related struct to a separate file.
  - refactor SPI command handling by using 'struct'.
  - use different functions to handle different SPI commands.
  - cleanup spi.c and sdio.c by removing unused code.
  - 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 (17):
  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.yaml
  wilc1000: add Makefile and Kconfig files for wilc1000 compilation

 .../net/wireless/microchip,wilc1000.yaml  |   71 +
 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   |   47 +
 .../net/wireless/microchip/wilc1000/Makefile  |   14 +
 .../wireless/microchip/wilc1000/cfg80211.c| 1849 
 .../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  |  934 
 .../net/wireless/microchip/wilc1000/netdev.h  |  294 +++
 .../net/wireless/microchip/wilc1000/sdio.c| 1023 +
 drivers/net/wireless/microchip/wilc1000/spi.c |  945 
 .../net/wireless/microchip/wilc1000/wlan.c| 1238 +++
 .../net/wireless/microchip/wilc1000/wlan.h|  397 
 .../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 -
 24 files changed, 10682 insertions(+), 3 deletions(-)
 create mode 100644 
Documentation/devicetree/bindings/net/wireless/microchip,wilc1000.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 

[PATCH v6 06/17] wilc1000: add cfg80211.c

2020-03-27 Thread Ajay.Kathat
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| 1849 +
 1 file changed, 1849 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 ..4bdcbc5fd2fd
--- /dev/null
+++ b/drivers/net/wireless/microchip/wilc1000/cfg80211.c
@@ -0,0 +1,1849 @@
+// 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(>scan_req_lock);
+
+   if (priv->scan_req) {
+   struct cfg80211_scan_info info = {
+   .aborted = false,
+   };
+

Re: [PATCH AUTOSEL 5.5 13/28] staging: greybus: loopback_test: fix potential path truncations

2020-03-27 Thread Greg Kroah-Hartman
On Thu, Mar 26, 2020 at 07:23:42PM -0400, Sasha Levin wrote:
> From: Johan Hovold 
> 
> [ Upstream commit ae62cf5eb2792d9a818c2d93728ed92119357017 ]
> 
> Newer GCC warns about possible truncations of two generated path names as
> we're concatenating the configurable sysfs and debugfs path prefixes
> with a filename and placing the results in buffers of the same size as
> the maximum length of the prefixes.
> 
>   snprintf(d->name, MAX_STR_LEN, "gb_loopback%u", dev_id);
> 
>   snprintf(d->sysfs_entry, MAX_SYSFS_PATH, "%s%s/",
>t->sysfs_prefix, d->name);
> 
>   snprintf(d->debugfs_entry, MAX_SYSFS_PATH, "%sraw_latency_%s",
>t->debugfs_prefix, d->name);
> 
> Fix this by separating the maximum path length from the maximum prefix
> length and reducing the latter enough to fit the generated strings.
> 
> Note that we also need to reduce the device-name buffer size as GCC
> isn't smart enough to figure out that we ever only used MAX_STR_LEN
> bytes of it.
> 
> Fixes: 6b0658f68786 ("greybus: tools: Add tools directory to greybus repo and 
> add loopback")
> Signed-off-by: Johan Hovold 
> Link: https://lore.kernel.org/r/20200312110151.22028-4-jo...@kernel.org
> Signed-off-by: Greg Kroah-Hartman 
> Signed-off-by: Sasha Levin 
> ---
>  drivers/staging/greybus/tools/loopback_test.c | 15 ---
>  1 file changed, 8 insertions(+), 7 deletions(-)
> 
> diff --git a/drivers/staging/greybus/tools/loopback_test.c 
> b/drivers/staging/greybus/tools/loopback_test.c
> index 5ce7d6fa086cc..3ee9109c38f60 100644
> --- a/drivers/staging/greybus/tools/loopback_test.c
> +++ b/drivers/staging/greybus/tools/loopback_test.c
> @@ -19,6 +19,7 @@
>  #include 
>  
>  #define MAX_NUM_DEVICES 10
> +#define MAX_SYSFS_PREFIX 0x80
>  #define MAX_SYSFS_PATH   0x200
>  #define CSV_MAX_LINE 0x1000
>  #define SYSFS_MAX_INT0x20
> @@ -67,7 +68,7 @@ struct loopback_results {
>  };
>  
>  struct loopback_device {
> - char name[MAX_SYSFS_PATH];
> + char name[MAX_STR_LEN];
>   char sysfs_entry[MAX_SYSFS_PATH];
>   char debugfs_entry[MAX_SYSFS_PATH];
>   struct loopback_results results;
> @@ -93,8 +94,8 @@ struct loopback_test {
>   int stop_all;
>   int poll_count;
>   char test_name[MAX_STR_LEN];
> - char sysfs_prefix[MAX_SYSFS_PATH];
> - char debugfs_prefix[MAX_SYSFS_PATH];
> + char sysfs_prefix[MAX_SYSFS_PREFIX];
> + char debugfs_prefix[MAX_SYSFS_PREFIX];
>   struct timespec poll_timeout;
>   struct loopback_device devices[MAX_NUM_DEVICES];
>   struct loopback_results aggregate_results;
> @@ -907,10 +908,10 @@ int main(int argc, char *argv[])
>   t.iteration_max = atoi(optarg);
>   break;
>   case 'S':
> - snprintf(t.sysfs_prefix, MAX_SYSFS_PATH, "%s", optarg);
> + snprintf(t.sysfs_prefix, MAX_SYSFS_PREFIX, "%s", 
> optarg);
>   break;
>   case 'D':
> - snprintf(t.debugfs_prefix, MAX_SYSFS_PATH, "%s", 
> optarg);
> + snprintf(t.debugfs_prefix, MAX_SYSFS_PREFIX, "%s", 
> optarg);
>   break;
>   case 'm':
>   t.mask = atol(optarg);
> @@ -961,10 +962,10 @@ int main(int argc, char *argv[])
>   }
>  
>   if (!strcmp(t.sysfs_prefix, ""))
> - snprintf(t.sysfs_prefix, MAX_SYSFS_PATH, "%s", sysfs_prefix);
> + snprintf(t.sysfs_prefix, MAX_SYSFS_PREFIX, "%s", sysfs_prefix);
>  
>   if (!strcmp(t.debugfs_prefix, ""))
> - snprintf(t.debugfs_prefix, MAX_SYSFS_PATH, "%s", 
> debugfs_prefix);
> + snprintf(t.debugfs_prefix, MAX_SYSFS_PREFIX, "%s", 
> debugfs_prefix);
>  
>   ret = find_loopback_devices();
>   if (ret)
> -- 
> 2.20.1

ALso already in all trees, please don't try to add it again.
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [PATCH AUTOSEL 5.5 12/28] staging: greybus: loopback_test: fix potential path truncation

2020-03-27 Thread Greg KH
On Thu, Mar 26, 2020 at 07:23:41PM -0400, Sasha Levin wrote:
> From: Johan Hovold 
> 
> [ Upstream commit f16023834863932f95dfad13fac3fc47f77d2f29 ]
> 
> Newer GCC warns about a possible truncation of a generated sysfs path
> name as we're concatenating a directory path with a file name and
> placing the result in a buffer that is half the size of the maximum
> length of the directory path (which is user controlled).
> 
> loopback_test.c: In function 'open_poll_files':
> loopback_test.c:651:31: warning: '%s' directive output may be truncated 
> writing up to 511 bytes into a region of size 255 [-Wformat-truncation=]
>   651 |   snprintf(buf, sizeof(buf), "%s%s", dev->sysfs_entry, 
> "iteration_count");
>   |   ^~
> loopback_test.c:651:3: note: 'snprintf' output between 16 and 527 bytes into 
> a destination of size 255
>   651 |   snprintf(buf, sizeof(buf), "%s%s", dev->sysfs_entry, 
> "iteration_count");
>   |   
> ^~~
> 
> Fix this by making sure the buffer is large enough the concatenated
> strings.
> 
> Fixes: 6b0658f68786 ("greybus: tools: Add tools directory to greybus repo and 
> add loopback")
> Fixes: 9250c0ee2626 ("greybus: Loopback_test: use poll instead of inotify")
> Signed-off-by: Johan Hovold 
> Link: https://lore.kernel.org/r/20200312110151.22028-3-jo...@kernel.org
> Signed-off-by: Greg Kroah-Hartman 
> Signed-off-by: Sasha Levin 
> ---
>  drivers/staging/greybus/tools/loopback_test.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/staging/greybus/tools/loopback_test.c 
> b/drivers/staging/greybus/tools/loopback_test.c
> index ba6f905f26fad..5ce7d6fa086cc 100644
> --- a/drivers/staging/greybus/tools/loopback_test.c
> +++ b/drivers/staging/greybus/tools/loopback_test.c
> @@ -637,7 +637,7 @@ int find_loopback_devices(struct loopback_test *t)
>  static int open_poll_files(struct loopback_test *t)
>  {
>   struct loopback_device *dev;
> - char buf[MAX_STR_LEN];
> + char buf[MAX_SYSFS_PATH + MAX_STR_LEN];
>   char dummy;
>   int fds_idx = 0;
>   int i;
> -- 
> 2.20.1
> 

Already in all stable releases, so no need to add it again.
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel