GitHub/moto-9609/android_kernel_motorola_exynos9610.git
8 years agomwifiex: fix loop timeout in mwifiex_prog_fw_w_helper()
Dan Carpenter [Tue, 19 Apr 2016 14:23:44 +0000 (07:23 -0700)]
mwifiex: fix loop timeout in mwifiex_prog_fw_w_helper()

USB8XXX_FW_MAX_RETRY is 3.  We were using a post-op loop
"while (retries--) {" but then the lines after that assume the loop
exits with retries set to zero.

I've fixed this by changing to a pre-op loop.  I started with retries
set to 4 instead of 3 so that we still go through the loop the same
number of times.

Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
8 years agomwifiex: missing error code on allocation failure
Dan Carpenter [Tue, 19 Apr 2016 14:21:58 +0000 (07:21 -0700)]
mwifiex: missing error code on allocation failure

We accidentally return success instead of -ENOMEM.

Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
8 years agortl8xxxu: Rename rtl8723au_iqk_phy_iq_bb_reg
Jes Sorensen [Mon, 18 Apr 2016 15:49:36 +0000 (11:49 -0400)]
rtl8xxxu: Rename rtl8723au_iqk_phy_iq_bb_reg

There is nothing 8723au specific about rtl8723au_iqk_phy_iq_bb_reg so
rename the array to rtl8xxxu_iqk_phy_iq_bb_reg.

Signed-off-by: Jes Sorensen <Jes.Sorensen@redhat.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
8 years agortl8xxxu: Rename rtl8723bu_simularity_compare()
Jes Sorensen [Mon, 18 Apr 2016 15:49:35 +0000 (11:49 -0400)]
rtl8xxxu: Rename rtl8723bu_simularity_compare()

This renames rtl8723bu_simularity_compare() to
rtl8xxxu_gen2_simularity_compare() to reflect it is used for all gen2
parts.

Signed-off-by: Jes Sorensen <Jes.Sorensen@redhat.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
8 years agortl8xxxu: Rename rtl8723b_channel_to_group()
Jes Sorensen [Mon, 18 Apr 2016 15:49:34 +0000 (11:49 -0400)]
rtl8xxxu: Rename rtl8723b_channel_to_group()

This renames rtl8723b_channel_to_group() to
rtl8xxxu_gen2_channel_to_group() to reflect it is used by all
currently supported gen2 parts.

Signed-off-by: Jes Sorensen <Jes.Sorensen@redhat.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
8 years agortl8xxxu: Rename rtl8723a_mac_init_table to rtl8xxxu_gen1_mac_init_table
Jes Sorensen [Mon, 18 Apr 2016 15:49:33 +0000 (11:49 -0400)]
rtl8xxxu: Rename rtl8723a_mac_init_table to rtl8xxxu_gen1_mac_init_table

All currently supported gen1 parts use the same mac_init_table, so
rename it to reflect this.

Signed-off-by: Jes Sorensen <Jes.Sorensen@redhat.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
8 years agortl8xxxu: Rename rtl8723a_enable_rf() to rtl8xxxu_gen1_enable_rf()
Jes Sorensen [Mon, 18 Apr 2016 15:49:32 +0000 (11:49 -0400)]
rtl8xxxu: Rename rtl8723a_enable_rf() to rtl8xxxu_gen1_enable_rf()

All gen1 parts use the same enable_rf() function, so rename it to
reflect this.

Signed-off-by: Jes Sorensen <Jes.Sorensen@redhat.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
8 years agortl8xxxu: Rename rtl8723a_set_tx_power() to rtl8xxxu_gen1_set_tx_power()
Jes Sorensen [Mon, 18 Apr 2016 15:49:31 +0000 (11:49 -0400)]
rtl8xxxu: Rename rtl8723a_set_tx_power() to rtl8xxxu_gen1_set_tx_power()

All gen1 parts use the same interface for setting TX power, so rename
the function to reflect this.

Signed-off-by: Jes Sorensen <Jes.Sorensen@redhat.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
8 years agortl8xxxu: Rename rtl8723au_init_phy_bb() to rtl8xxxu_gen1_init_phy_bb()
Jes Sorensen [Mon, 18 Apr 2016 15:49:30 +0000 (11:49 -0400)]
rtl8xxxu: Rename rtl8723au_init_phy_bb() to rtl8xxxu_gen1_init_phy_bb()

All gen1 parts use the same init_phy_bb() function, so rename it to
reflect this.

Signed-off-by: Jes Sorensen <Jes.Sorensen@redhat.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
8 years agortl8xxxu: Rename rtl8723au_phy_iq_calibrate() to rtl8xxxu_gen1_phy_iq_calibrate()
Jes Sorensen [Mon, 18 Apr 2016 15:49:29 +0000 (11:49 -0400)]
rtl8xxxu: Rename rtl8723au_phy_iq_calibrate() to rtl8xxxu_gen1_phy_iq_calibrate()

All supported gen1 parts use the same phy_iq_calibrate() function
(unlike their gen2 counterparts). Rename the function to reflect this.

Signed-off-by: Jes Sorensen <Jes.Sorensen@redhat.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
8 years agortl8xxxu: Rename rtl8723au_update_rate_mask() to rtl8xxxu_update_rate_mask()
Jes Sorensen [Mon, 18 Apr 2016 15:49:28 +0000 (11:49 -0400)]
rtl8xxxu: Rename rtl8723au_update_rate_mask() to rtl8xxxu_update_rate_mask()

All currently supported gen1 parts use the same function for updating
the rate mask, so rename it to reflect this.

Signed-off-by: Jes Sorensen <Jes.Sorensen@redhat.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
8 years agortl8xxxu: Rename rtl8723au_config_channel() to rtl8xxxu_gen1_config_channel()
Jes Sorensen [Mon, 18 Apr 2016 15:49:27 +0000 (11:49 -0400)]
rtl8xxxu: Rename rtl8723au_config_channel() to rtl8xxxu_gen1_config_channel()

All supported gen1 parts use the same config_channel() function, so
rename it to reflect this.

Signed-off-by: Jes Sorensen <Jes.Sorensen@redhat.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
8 years agortl8xxxu: Rename rtl8723a_disable_rf() to rtl8xxxu_gen1_disable_rf()
Jes Sorensen [Mon, 18 Apr 2016 15:49:26 +0000 (11:49 -0400)]
rtl8xxxu: Rename rtl8723a_disable_rf() to rtl8xxxu_gen1_disable_rf()

All currently supported gen1 parts use the same disable_rf() routine,
so rename the function to reflect that.

Signed-off-by: Jes Sorensen <Jes.Sorensen@redhat.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
8 years agortl8xxxu: Rename rtl8723b_disable_rf() to rtl8xxxu_gen2_disable_rf()
Jes Sorensen [Mon, 18 Apr 2016 15:49:25 +0000 (11:49 -0400)]
rtl8xxxu: Rename rtl8723b_disable_rf() to rtl8xxxu_gen2_disable_rf()

At least for now, all gen2 parts use the same disable_rf() function

Signed-off-by: Jes Sorensen <Jes.Sorensen@redhat.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
8 years agortl8xxxu: Rename rtl8723bu_config_channel() to rtl8xxxu_gen2_config_channel()
Jes Sorensen [Mon, 18 Apr 2016 15:49:24 +0000 (11:49 -0400)]
rtl8xxxu: Rename rtl8723bu_config_channel() to rtl8xxxu_gen2_config_channel()

Rename the function to indicate it is applicable to most/all gen2
parts.

Signed-off-by: Jes Sorensen <Jes.Sorensen@redhat.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
8 years agortl8xxxu: Rename rtl8723au_report_connect() to rtl8xxxu_gen1_report_connect()
Jes Sorensen [Mon, 18 Apr 2016 15:49:23 +0000 (11:49 -0400)]
rtl8xxxu: Rename rtl8723au_report_connect() to rtl8xxxu_gen1_report_connect()

Rename the function to reflect it is for all/most gen1 parts.

Signed-off-by: Jes Sorensen <Jes.Sorensen@redhat.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
8 years agortl8xxxu: Rename rtl8723bu_report_connect() to rtl8xxxu_gen2_report_connect()
Jes Sorensen [Mon, 18 Apr 2016 15:49:22 +0000 (11:49 -0400)]
rtl8xxxu: Rename rtl8723bu_report_connect() to rtl8xxxu_gen2_report_connect()

Make the name reflect this is for most/all gen2 parts.

Signed-off-by: Jes Sorensen <Jes.Sorensen@redhat.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
8 years agortl8xxxu: Rename rtl8723bu_update_rate_mask() to rtl8xxxu_gen2_update_rate_mask()
Jes Sorensen [Mon, 18 Apr 2016 15:49:21 +0000 (11:49 -0400)]
rtl8xxxu: Rename rtl8723bu_update_rate_mask() to rtl8xxxu_gen2_update_rate_mask()

Update the name of rtl8723bu_update_rate_mask() to make it reflect
it's applicable for all/most gen2 N parts.

Signed-off-by: Jes Sorensen <Jes.Sorensen@redhat.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
8 years agomwifiex: stop background scan when net device closed
Xinming Hu [Mon, 18 Apr 2016 13:42:55 +0000 (06:42 -0700)]
mwifiex: stop background scan when net device closed

Transmit data path should not touch background scan. We will stop
background scan when net device is closed.

Signed-off-by: Xinming Hu <huxm@marvell.com>
Signed-off-by: Amitkumar Karwar <akarwar@marvell.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
8 years agomwifiex: add platform specific wakeup interrupt support
Xinming Hu [Mon, 18 Apr 2016 12:22:23 +0000 (05:22 -0700)]
mwifiex: add platform specific wakeup interrupt support

On some arm-based platforms, we need to configure platform specific
parameters by device tree node and also define our node as a child
node of parent SDIO host controller.
This patch parses these parameters from device tree. It includes
calibration data dowoload to firmware, wakeup pin configured to firmware,
and soc specific wake up gpio, which will be set as wakeup interrupt pin.

Signed-off-by: Xinming Hu <huxm@marvell.com>
Signed-off-by: Amitkumar Karwar <akarwar@marvell.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
8 years agodt: bindings: add MARVELL's sd8xxx wireless device
Xinming Hu [Mon, 18 Apr 2016 12:22:22 +0000 (05:22 -0700)]
dt: bindings: add MARVELL's sd8xxx wireless device

Add device tree binding documentation for MARVELL's sd8xxx
(sd8897 and sd8997) wlan chip.

Signed-off-by: Xinming Hu <huxm@marvell.com>
Signed-off-by: Amitkumar Karwar <akarwar@marvell.com>
Acked-by: Rob Herring <robh@kernel.org>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
8 years agobrcmf: Fix null pointer exception in bcdc_hdrpull
Per Forlin [Sun, 17 Apr 2016 13:25:03 +0000 (15:25 +0200)]
brcmf: Fix null pointer exception in bcdc_hdrpull

In fwsignal.c: brcmf_fws_commit_skb()
...
if (rc < 0) {
  entry->transit_count--;
    if (entry->suppressed)
      entry->suppr_transit_count--;
      (void)brcmf_proto_hdrpull(fws->drvr, false, skb, NULL);
                                                     ^^^^^^^
    goto rollback;
}
...

The call to hdrpull will trigger a null pointer exception
unless a null check is made in the method implementation.

Signed-off-by: Per Forlin <per.forlin@gmail.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
8 years agobrcmfmac: add support for nl80211 BSS_SELECT feature
Arend van Spriel [Sun, 17 Apr 2016 14:44:58 +0000 (16:44 +0200)]
brcmfmac: add support for nl80211 BSS_SELECT feature

Announce support for nl80211 feature BSS_SELECT and process
BSS selection behaviour provided in .connect() callback.

Reviewed-by: Hante Meuleman <meuleman@broadcom.com>
Reviewed-by: Franky (Zhenhui) Lin <frankyl@broadcom.com>
Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
Reviewed-by: Lei Zhang <leizh@broadcom.com>
Signed-off-by: Arend van Spriel <arend@broadcom.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
8 years agortlwifi: rtl8821ae: Make sure loop counter is signed on all architectures
David Müller [Fri, 15 Apr 2016 06:50:25 +0000 (08:50 +0200)]
rtlwifi: rtl8821ae: Make sure loop counter is signed on all architectures

The for-loop condition does not work correctly on architectures where
"char" is unsigned. Fix it by using an "int", which may also result in
more efficient code.

Signed-off-by: David Müller <d.mueller@elsoft.ch>
Acked-by: Larry Finger <Larry.Finger@lwfinger.net>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
8 years agoprism54: isl_38xx: Replace 'struct timeval'
Tina Ruchandani [Wed, 13 Apr 2016 06:09:16 +0000 (23:09 -0700)]
prism54: isl_38xx: Replace 'struct timeval'

'struct timeval' uses a 32-bit seconds field which will overflow in
year 2038 and beyond. This patch is part of a larger effort to remove
all instances of 'struct timeval' from the kernel and replace them
with 64-bit timekeeping variables.
The patch also fixes the debug printf specifier to avoid the
seconds value being truncated.
The patch was build-tested / debugged by removing the
"if VERBOSE > SHOW_ERROR_MESSAGES" guards.

Signed-off-by: Tina Ruchandani <ruchandani.tina@gmail.com>
Suggested-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
8 years agortl818x_pci: Fix a memory leak in rtl8180_init_rx_ring
Jia-Ju Bai [Fri, 18 Mar 2016 02:27:09 +0000 (13:27 +1100)]
rtl818x_pci: Fix a memory leak in rtl8180_init_rx_ring

When dev_alloc_skb or pci_dma_mapping_error in rtl8180_init_rx_ring fails,
the memory allocated by pci_zalloc_consistent is not freed.

This patch fixes the bug by adding pci_free_consistent
in error handling code.

Signed-off-by: Jia-Ju Bai <baijiaju1990@163.com>
Signed-off-by: Julian Calaby <julian.calaby@gmail.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
8 years agortl8xxxu: hide unused tables
Arnd Bergmann [Mon, 18 Apr 2016 21:59:31 +0000 (23:59 +0200)]
rtl8xxxu: hide unused tables

The references to some arrays in the rtl8xxxu driver were moved inside
of an #ifdef, but the symbols remain outside, resulting in build warnings:

rtl8xxxu/rtl8xxxu.c:1506:33: error: 'rtl8188ru_radioa_1t_highpa_table' defined but not used
rtl8xxxu/rtl8xxxu.c:1431:33: error: 'rtl8192cu_radioa_1t_init_table' defined but not used
rtl8xxxu/rtl8xxxu.c:1407:33: error: 'rtl8192cu_radiob_2t_init_table' defined but not used
rtl8xxxu/rtl8xxxu.c:1332:33: error: 'rtl8192cu_radioa_2t_init_table' defined but not used
rtl8xxxu/rtl8xxxu.c:239:35: error: 'rtl8192c_power_base' defined but not used
rtl8xxxu/rtl8xxxu.c:217:35: error: 'rtl8188r_power_base' defined but not used

This adds an extra #ifdef around them to shut up the warnings.

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Fixes: 2fc0b8e5a17d ("rtl8xxxu: Add TX power base values for gen1 parts")
Fixes: 4062b8ffec36 ("rtl8xxxu: Move PHY RF init into device specific functions")
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
8 years agortl8xxxu: MAINTAINERS: Update to point to the active devel branch
Jes Sorensen [Thu, 14 Apr 2016 20:37:21 +0000 (16:37 -0400)]
rtl8xxxu: MAINTAINERS: Update to point to the active devel branch

Update the MAINTAINERS info to reflect active development of the
rtl8xxxu driver.

Signed-off-by: Jes Sorensen <Jes.Sorensen@redhat.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
8 years agortl8xxxu: Pause TX before calling disable_rf()
Jes Sorensen [Thu, 14 Apr 2016 20:37:20 +0000 (16:37 -0400)]
rtl8xxxu: Pause TX before calling disable_rf()

All the disable_rf() functions were setting REG_TXPAUSE to 0xff to
stop transmission. Do it centrally before calling disable_rf()
instead.

Signed-off-by: Jes Sorensen <Jes.Sorensen@redhat.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
8 years agortl8xxxu: Implement rtl8192e_enable_rf()
Jes Sorensen [Thu, 14 Apr 2016 20:37:19 +0000 (16:37 -0400)]
rtl8xxxu: Implement rtl8192e_enable_rf()

This implements an 8192eu specific enable_rf() function. The 8192eu is
not a combo device, so no need for doing the BT specific bits needed
by the 8723bu.

Signed-off-by: Jes Sorensen <Jes.Sorensen@redhat.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
8 years agortl8xxxu: Fix OOPS if user tries to add device via /sys
Jes Sorensen [Thu, 14 Apr 2016 20:37:18 +0000 (16:37 -0400)]
rtl8xxxu: Fix OOPS if user tries to add device via /sys

This driver relies on driver_info in struct usb_device_id, so allowing
adding a device via /sys/bus/usb/drivers/rtl8xxxu/new_id will cause a
NULL pointer dereference.

Set .no_dynamic_id = 1 to disable hot add of USB IDs.

Reported-by: Xose Vazquez Perez <xose.vazquez@gmail.com>
Signed-off-by: Jes Sorensen <Jes.Sorensen@redhat.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
8 years agortl8xxxu: Fix 8188RU support
Jes Sorensen [Thu, 14 Apr 2016 20:37:17 +0000 (16:37 -0400)]
rtl8xxxu: Fix 8188RU support

The 8188RU does not like PAPE to be enabled, while all the other gen1
parts seem to require it.

This makes the RTL8188RU able to associate for me.

Signed-off-by: Jes Sorensen <Jes.Sorensen@redhat.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
8 years agortl8xxxu: Add TX power base values for gen1 parts
Jes Sorensen [Thu, 14 Apr 2016 20:37:16 +0000 (16:37 -0400)]
rtl8xxxu: Add TX power base values for gen1 parts

Signed-off-by: Jes Sorensen <Jes.Sorensen@redhat.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
8 years agortl8xxxu: Set register 0xfe10 on rtl8192cu based parts
Jes Sorensen [Thu, 14 Apr 2016 20:37:15 +0000 (16:37 -0400)]
rtl8xxxu: Set register 0xfe10 on rtl8192cu based parts

This register is undocumented in the vendor code, but it is set
unconditionally for all 8192cu/8188cu/8188ru parts.

Signed-off-by: Jes Sorensen <Jes.Sorensen@redhat.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
8 years agortl8xxxu: Update copyright statement to include 2016
Jes Sorensen [Thu, 14 Apr 2016 20:37:14 +0000 (16:37 -0400)]
rtl8xxxu: Update copyright statement to include 2016

Signed-off-by: Jes Sorensen <Jes.Sorensen@redhat.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
8 years agortl8xxxu: Unregister from mac80211 before shutting down the device
Jes Sorensen [Thu, 14 Apr 2016 20:37:13 +0000 (16:37 -0400)]
rtl8xxxu: Unregister from mac80211 before shutting down the device

This fixes a long standing bug where mac80211 would send disconnect
packets to the device, after we had shut down the device.

Signed-off-by: Jes Sorensen <Jes.Sorensen@redhat.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
8 years agortl8xxxu: Match 8723bu power down sequence to vendor driver
Jes Sorensen [Thu, 14 Apr 2016 20:37:12 +0000 (16:37 -0400)]
rtl8xxxu: Match 8723bu power down sequence to vendor driver

In particular set APS_FSMCO_WLON_RESET in the right register, and do
not overwrite too much of REG_CR.

Signed-off-by: Jes Sorensen <Jes.Sorensen@redhat.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
8 years agortl8xxxu: Use rtl_chip == RTL8188R to identify high PA parts
Jes Sorensen [Thu, 14 Apr 2016 20:37:11 +0000 (16:37 -0400)]
rtl8xxxu: Use rtl_chip == RTL8188R to identify high PA parts

This is simpler than checking for RTL8188C && hi_pa.

Signed-off-by: Jes Sorensen <Jes.Sorensen@redhat.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
8 years agortl8xxxu: Apply 8188RU workaround for UMC B cut parts correctly
Jes Sorensen [Thu, 14 Apr 2016 20:37:10 +0000 (16:37 -0400)]
rtl8xxxu: Apply 8188RU workaround for UMC B cut parts correctly

This patch was being missed since rtl_chip will never match RTL8188C
if hi_pa is true.

Signed-off-by: Jes Sorensen <Jes.Sorensen@redhat.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
8 years agortl8xxxu: For devices with external PA (8188RU), limit CCK TX power
Jes Sorensen [Thu, 14 Apr 2016 20:37:09 +0000 (16:37 -0400)]
rtl8xxxu: For devices with external PA (8188RU), limit CCK TX power

Per the vendor driver, devices with an external PA needs limiting it's
TX power to 0x20.

Signed-off-by: Jes Sorensen <Jes.Sorensen@redhat.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
8 years agortl8xxxu: Move PHY RF init into device specific functions
Jes Sorensen [Thu, 14 Apr 2016 20:37:08 +0000 (16:37 -0400)]
rtl8xxxu: Move PHY RF init into device specific functions

Load the RF table in init_phy_rf(), which allows for applying device
specific RF hacks in the same place. Getting rid of more ugly if ()
clutter.

Signed-off-by: Jes Sorensen <Jes.Sorensen@redhat.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
8 years agortl8xxxu: fix uninitialized return value in ret
Colin Ian King [Thu, 14 Apr 2016 20:37:07 +0000 (16:37 -0400)]
rtl8xxxu: fix uninitialized return value in ret

several functions are not initializing a return status in ret
resulting in garbage to be returned instead of 0 for success.
Currently, the calls to these functions are not checking the
return, however, it seems prudent to return the correct status
in case they are to be checked at a later date.

Signed-off-by: Colin Ian King <colin.king@canonical.com>
Signed-off-by: Jes Sorensen <Jes.Sorensen@redhat.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
8 years agortl8xxxu: Mark 0x050d:0x1004 as tested
Jes Sorensen [Thu, 14 Apr 2016 20:37:06 +0000 (16:37 -0400)]
rtl8xxxu: Mark 0x050d:0x1004 as tested

This dongle was tested successfully by Andrea Merello

Reported-by: Andrea Merello <andrea.merello@gmail.com>
Signed-off-by: Jes Sorensen <Jes.Sorensen@redhat.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
8 years agoRe-enable 8192eu support
Jes Sorensen [Thu, 14 Apr 2016 18:59:07 +0000 (14:59 -0400)]
Re-enable 8192eu support

Revert "rtl8xxxu: Temporarily disable 8192eu device init"

This reverts commit ccfe1e85322090649d2fae599e55300c1512bf15.

Signed-off-by: Jes Sorensen <Jes.Sorensen@redhat.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
8 years agortl8xxxu: 8192eu Fix bug in LDPC RX hang fix
Jes Sorensen [Thu, 14 Apr 2016 18:59:06 +0000 (14:59 -0400)]
rtl8xxxu: 8192eu Fix bug in LDPC RX hang fix

Write the adjusted value back to the correct register

Signed-off-by: Jes Sorensen <Jes.Sorensen@redhat.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
8 years agortl8xxxu: Remove unneeded 8192eu hack
Jes Sorensen [Thu, 14 Apr 2016 18:59:05 +0000 (14:59 -0400)]
rtl8xxxu: Remove unneeded 8192eu hack

This removes an unneeded hack for 8192eu, and allows for initializing
REG_FPGA0_XAB_RF_SW_CTRL at the same point as it is done for all other
parts.

Signed-off-by: Jes Sorensen <Jes.Sorensen@redhat.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
8 years agortl8xxxu: Split USB quirks into gen1 and gen2 quirks
Jes Sorensen [Thu, 14 Apr 2016 18:59:04 +0000 (14:59 -0400)]
rtl8xxxu: Split USB quirks into gen1 and gen2 quirks

This removes a bunch of if () spaghetti and re-applies the USB bus
quirks for 8188/8192 that had gotten lost.

Signed-off-by: Jes Sorensen <Jes.Sorensen@redhat.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
8 years agortl8xxxu: Make PBP tuning a fileops parameter
Jes Sorensen [Thu, 14 Apr 2016 18:59:03 +0000 (14:59 -0400)]
rtl8xxxu: Make PBP tuning a fileops parameter

Rather than scattering the code with #ifdefs, use the fileops
structure to hold device specific PBP values.

Signed-off-by: Jes Sorensen <Jes.Sorensen@redhat.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
8 years agortl8xxxu: Do not backup RF_MODE_AG when it's never being used
Jes Sorensen [Thu, 14 Apr 2016 18:59:02 +0000 (14:59 -0400)]
rtl8xxxu: Do not backup RF_MODE_AG when it's never being used

This was expired by the vendor driver, but we never ended up using the
backed up value.

Signed-off-by: Jes Sorensen <Jes.Sorensen@redhat.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
8 years agortl8xxxu: Store device specific TRXFF boundary in the fileops
Jes Sorensen [Thu, 14 Apr 2016 18:59:01 +0000 (14:59 -0400)]
rtl8xxxu: Store device specific TRXFF boundary in the fileops

This removes another case of ugly if () clutter

Signed-off-by: Jes Sorensen <Jes.Sorensen@redhat.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
8 years agortl8xxxu: REG_LDOA15_CTRL is only used on gen1 parts
Jes Sorensen [Thu, 14 Apr 2016 18:59:00 +0000 (14:59 -0400)]
rtl8xxxu: REG_LDOA15_CTRL is only used on gen1 parts

Move setting it to rtl8723au_init_phy_bb()

Signed-off-by: Jes Sorensen <Jes.Sorensen@redhat.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
8 years agortl8xxxu: Move loading of AGC table to device specific function
Jes Sorensen [Thu, 14 Apr 2016 18:58:59 +0000 (14:58 -0400)]
rtl8xxxu: Move loading of AGC table to device specific function

This moves the loading of the AGC table into init_phy_bb() and reduces
the if() clutter.

Signed-off-by: Jes Sorensen <Jes.Sorensen@redhat.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
8 years agortl8xxxu: Load AGC table before patching for 1T2R parts
Jes Sorensen [Thu, 14 Apr 2016 18:58:58 +0000 (14:58 -0400)]
rtl8xxxu: Load AGC table before patching for 1T2R parts

This should get the order right and avoid patching something that is
later overwritten.

Signed-off-by: Jes Sorensen <Jes.Sorensen@redhat.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
8 years agortl8xxxu: Split rtl8xxxu_init_phy_bb() into device specific functions
Jes Sorensen [Thu, 14 Apr 2016 18:58:57 +0000 (14:58 -0400)]
rtl8xxxu: Split rtl8xxxu_init_phy_bb() into device specific functions

This reduces the if () clutter. Longer term it probably makes sense to
split this between gen1 (8723au/8188cu/8192cu) and gen2
(8192eu/8723bu) devices.

Signed-off-by: Jes Sorensen <Jes.Sorensen@redhat.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
8 years agortl8xxxu: Use descriptive bits for setting RX paths for 1T2R parts
Jes Sorensen [Thu, 14 Apr 2016 18:58:56 +0000 (14:58 -0400)]
rtl8xxxu: Use descriptive bits for setting RX paths for 1T2R parts

This reduce the use of magic values a little.

Signed-off-by: Jes Sorensen <Jes.Sorensen@redhat.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
8 years agortl8xxxu: Correctly mask what was read from REG_CCK0_AFE_SETTING
Jes Sorensen [Thu, 14 Apr 2016 18:58:55 +0000 (14:58 -0400)]
rtl8xxxu: Correctly mask what was read from REG_CCK0_AFE_SETTING

The old code incorrectly wiped out bits 0-23 by mistake when setting
the RX path for 1T parts.

Signed-off-by: Jes Sorensen <Jes.Sorensen@redhat.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
8 years agortl8xxxu: Remove unused 8723bu path B IQ calibration code
Jes Sorensen [Thu, 14 Apr 2016 18:58:54 +0000 (14:58 -0400)]
rtl8xxxu: Remove unused 8723bu path B IQ calibration code

The 8723bu is a combo WiFi/BT dongle, and path B is not used for WiFi,
so no point in calibrating it.

Signed-off-by: Jes Sorensen <Jes.Sorensen@redhat.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
8 years agortl8xxxu: Remove misleading warning from rtl8192eu_phy_iqcalibrate()
Jes Sorensen [Thu, 14 Apr 2016 18:58:53 +0000 (14:58 -0400)]
rtl8xxxu: Remove misleading warning from rtl8192eu_phy_iqcalibrate()

No actual code flow change, but no need to warn about something that
isn't a prioblem.

Signed-off-by: Jes Sorensen <Jes.Sorensen@redhat.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
8 years agortl8xxxu: Name RX descriptor types rxdesc16/rxdesc24
Jes Sorensen [Thu, 14 Apr 2016 18:58:52 +0000 (14:58 -0400)]
rtl8xxxu: Name RX descriptor types rxdesc16/rxdesc24

This caught a bug where too little memory was allocated for RX urbs
for parts using 24 byte RX descriptors

Signed-off-by: Jes Sorensen <Jes.Sorensen@redhat.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
8 years agortl8xxxu: byteswap the entire RX descriptor for 24 byte RX descriptors
Jes Sorensen [Thu, 14 Apr 2016 18:58:51 +0000 (14:58 -0400)]
rtl8xxxu: byteswap the entire RX descriptor for 24 byte RX descriptors

This shouldn't affect little endian system, but may have prevented the
driver working on big endian systems for devices with the larger 24
byte RX descriptors.

Signed-off-by: Jes Sorensen <Jes.Sorensen@redhat.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
8 years agortl8xxxu: Use has_s0s1 for REG_S0S1 issues only
Jes Sorensen [Thu, 14 Apr 2016 18:58:50 +0000 (14:58 -0400)]
rtl8xxxu: Use has_s0s1 for REG_S0S1 issues only

Instead use tx_desc_size() to distinguish between gen1
(8723a/8192c/8188c) and gen2 (8723b/8192e) parts.

Signed-off-by: Jes Sorensen <Jes.Sorensen@redhat.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
8 years agortl8xxxu: Implment rtl8192e_set_tx_power()
Jes Sorensen [Thu, 14 Apr 2016 18:58:49 +0000 (14:58 -0400)]
rtl8xxxu: Implment rtl8192e_set_tx_power()

8192eu is a 2T part, so setting TX power for path A only, as done by
rtl8723bu_set_tx_power() is not sufficient.

Signed-off-by: Jes Sorensen <Jes.Sorensen@redhat.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
8 years agortl8xxxu: Do not try to set REG_LEDCFG2 on 8192eu
Jes Sorensen [Thu, 14 Apr 2016 18:58:48 +0000 (14:58 -0400)]
rtl8xxxu: Do not try to set REG_LEDCFG2 on 8192eu

Presumably 8192eu devices do not have leds, so do not enable them.

Signed-off-by: Jes Sorensen <Jes.Sorensen@redhat.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
8 years agortl8xxxu: Do not init FPGA0_TX_INFO on 8192eu
Jes Sorensen [Thu, 14 Apr 2016 18:58:47 +0000 (14:58 -0400)]
rtl8xxxu: Do not init FPGA0_TX_INFO on 8192eu

Like the 8723bu, the vendor driver does not set FPGA0_TX_INFO for
8192eu in the init sequence.

Signed-off-by: Jes Sorensen <Jes.Sorensen@redhat.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
8 years agortl8xxxu: Do not set REG_PBP on 8192eu
Jes Sorensen [Thu, 14 Apr 2016 18:58:46 +0000 (14:58 -0400)]
rtl8xxxu: Do not set REG_PBP on 8192eu

The vendor driver does not set REG_PBP on 8192eu. Whether this is due
to the device not supporting it or simply an oversight in the vendor
driver is not clear.

Signed-off-by: Jes Sorensen <Jes.Sorensen@redhat.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
8 years agortl8xxxu: Reorder chip quirks to follow flow of 8192eu driver
Jes Sorensen [Thu, 14 Apr 2016 18:58:45 +0000 (14:58 -0400)]
rtl8xxxu: Reorder chip quirks to follow flow of 8192eu driver

Another flow order change to match the vendor driver.

Signed-off-by: Jes Sorensen <Jes.Sorensen@redhat.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
8 years agortl8xxxu: Implement generic init_queue_reserved_page() function
Jes Sorensen [Thu, 14 Apr 2016 18:58:44 +0000 (14:58 -0400)]
rtl8xxxu: Implement generic init_queue_reserved_page() function

Longer term we should switch all the chips over to use this function
instead of the random chip specific ifdef hacks.

Signed-off-by: Jes Sorensen <Jes.Sorensen@redhat.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
8 years agortl8xxxu: Reorg more code to match the flow of the 8192eu vendor driver
Jes Sorensen [Thu, 14 Apr 2016 18:58:43 +0000 (14:58 -0400)]
rtl8xxxu: Reorg more code to match the flow of the 8192eu vendor driver

This further reorganizes the init code flow to match that of the
8192eu vendor driver. This helps diffing the register write log
against that of the vendor driver.

Signed-off-by: Jes Sorensen <Jes.Sorensen@redhat.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
8 years agortl8xxxu: Reorder parts of init code to match the 8192eu vendor code flow
Jes Sorensen [Thu, 14 Apr 2016 18:58:42 +0000 (14:58 -0400)]
rtl8xxxu: Reorder parts of init code to match the 8192eu vendor code flow

In order to debug 8192eu support, reorder some init code to match the
flow of the vendor driver.

Signed-off-by: Jes Sorensen <Jes.Sorensen@redhat.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
8 years agomwifiex: make mwifiex_insert_cmd_to_free_q local static
Andreas Fenkart [Thu, 10 Mar 2016 08:44:11 +0000 (09:44 +0100)]
mwifiex: make mwifiex_insert_cmd_to_free_q local static

after factoring out mwifiex_cancel_pending_scan_cmd
the function is not called outside of cmdevt file
moved function to head of file to avoid forward declaration,
also moved mwifiex_recycle_cmd_node since they are very similar

Signed-off-by: Andreas Fenkart <afenkart@gmail.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
8 years agomwifiex: factor out mwifiex_cancel_pending_scan_cmd
Andreas Fenkart [Thu, 10 Mar 2016 08:44:10 +0000 (09:44 +0100)]
mwifiex: factor out mwifiex_cancel_pending_scan_cmd

Releasing the scan_pending lock in mwifiex_check_next_scan_command
introduces a short window where pending scan commands can be removed
or added before removing them all in mwifiex_cancel_pending_scan_cmd.
I think this is safe, since the worst thing to happen is that a
pending scan cmd is removed by the command handler. Adding new scan
commands is not possible while one is pending, see scan_processing flag.
Since all commands are removed from the queue anyway, we don't care if
some commands are removed by a different code path earlier, the final
state remains the same.
I assume, that the critical section needed for the check has been
extended over clearing the pending scan queue out of convenience. The
lock was already held and releasing it and grab it again was just
more work. It doesn't seem to be necessary because of concurrency.

Signed-off-by: Andreas Fenkart <afenkart@gmail.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
8 years agomwifiex: scan: replace pointer arithmetic with array access
Andreas Fenkart [Thu, 10 Mar 2016 08:44:09 +0000 (09:44 +0100)]
mwifiex: scan: replace pointer arithmetic with array access

improves readability

Reviewed-by: Julian Calaby <julian.calaby@gmail.com>
Signed-off-by: Andreas Fenkart <afenkart@gmail.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
8 years agomwifiex: scan: factor out dbg_security_flags
Andreas Fenkart [Thu, 10 Mar 2016 08:44:08 +0000 (09:44 +0100)]
mwifiex: scan: factor out dbg_security_flags

merge copy/paste code

Signed-off-by: Andreas Fenkart <afenkart@gmail.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
8 years agomwifiex: scan: simplify ternary operators using gnu extension
Andreas Fenkart [Thu, 10 Mar 2016 08:44:07 +0000 (09:44 +0100)]
mwifiex: scan: simplify ternary operators using gnu extension

"x ? x : y" can be simplified as "x ? : y"
https://gcc.gnu.org/onlinedocs/gcc/Conditionals.html#Conditionals

Reviewed-by: Julian Calaby <julian.calaby@gmail.com>
Signed-off-by: Andreas Fenkart <afenkart@gmail.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
8 years agomwifiex: scan: factor out has_ieee_hdr/has_vendor_hdr
Andreas Fenkart [Thu, 10 Mar 2016 08:44:06 +0000 (09:44 +0100)]
mwifiex: scan: factor out has_ieee_hdr/has_vendor_hdr

Signed-off-by: Andreas Fenkart <afenkart@gmail.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
8 years agomwifiex: scan: simplify dereference of bss_desc fields
Andreas Fenkart [Thu, 10 Mar 2016 08:44:05 +0000 (09:44 +0100)]
mwifiex: scan: simplify dereference of bss_desc fields

given this structure:
struct foo {
  struct bar {
     int baz;
  }
}

these accesses are equivalent:
(*(foo->bar)).baz
foo->bar->baz

Signed-off-by: Andreas Fenkart <afenkart@gmail.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
8 years agomwifiex: fix the incorrect WARN_ON during suspend
Vishal Thanki [Thu, 7 Apr 2016 21:37:12 +0000 (23:37 +0200)]
mwifiex: fix the incorrect WARN_ON during suspend

During system suspend, there is a kernel WARNING issued if there
is a pending command present. By marking the wait queue disabled
after calling the command completion routine fixes it.

Signed-off-by: Vishal Thanki <vishalthanki@gmail.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
8 years agomwifiex: fix incorrect ht capability problem
Amitkumar Karwar [Mon, 11 Apr 2016 14:52:41 +0000 (07:52 -0700)]
mwifiex: fix incorrect ht capability problem

IEEE80211_CHAN_NO_HT40PLUS and IEEE80211_CHAN_NO_HT40PLUS channel
flags tell if HT40 operation is allowed on a channel or not.

This patch ensures ht_capability information is modified
accordingly so that we don't end up creating a HT40 connection
when it's not allowed for current regulatory domain.

Signed-off-by: Amitkumar Karwar <akarwar@marvell.com>
Signed-off-by: Cathy Luo <cluo@marvell.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
8 years agomwifiex: do not wait on semaphore during card removal
Xinming Hu [Mon, 11 Apr 2016 14:52:40 +0000 (07:52 -0700)]
mwifiex: do not wait on semaphore during card removal

Host hang is observed if card is removed before firmware download
gets completed. In this case, firmware will be failed to download and
adapter structure gets freed.

In other thread, mwifiex_remove_card() waits on semaphore until the
firmware download fails. This wait is not necessary and may result in
invalid adapter access.

This patch uses down_trylock to return immediately so that hang issue
won't occur.

Signed-off-by: Xinming Hu <huxm@marvell.com>
Signed-off-by: Amitkumar Karwar <akarwar@marvell.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
8 years agomwifiex: add default setting for pcie firmware download
Shengzhen Li [Mon, 11 Apr 2016 14:52:39 +0000 (07:52 -0700)]
mwifiex: add default setting for pcie firmware download

This patch adds default setting for pcie firmware download name in
case that there are newer chipset version.

Signed-off-by: Shengzhen Li <szli@marvell.com>
Signed-off-by: Amitkumar Karwar <akarwar@marvell.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
8 years agomwifiex: add pcie usb/uart firmware download support
Shengzhen Li [Mon, 11 Apr 2016 14:52:38 +0000 (07:52 -0700)]
mwifiex: add pcie usb/uart firmware download support

This patch adds support for downloading usb/uart firmware for
8997 chipset by reading the chip version.

Signed-off-by: Shengzhen Li <szli@marvell.com>
Signed-off-by: Amitkumar Karwar <akarwar@marvell.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
8 years agomwifiex: missing break statement
Amitkumar Karwar [Mon, 11 Apr 2016 14:52:37 +0000 (07:52 -0700)]
mwifiex: missing break statement

This patch adds missing break statement at the end of
PCIE_DEVICE_ID_MARVELL_88W8897 switch section.

Signed-off-by: Amitkumar Karwar <akarwar@marvell.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
8 years agobrcmfmac: create common function for handling brcmf_proto_hdrpull()
Arend van Spriel [Mon, 11 Apr 2016 09:35:28 +0000 (11:35 +0200)]
brcmfmac: create common function for handling brcmf_proto_hdrpull()

In receive path brcmf_proto_hdrpull() needs to be called and handled
similar in brcmf_rx_frame() and brcmf_rx_event(). Move that duplicated
code in separate function.

Reviewed-by: Hante Meuleman <hante.meuleman@broadcom.com>
Reviewed-by: Pieter-Paul Giesberts <pieter-paul.giesberts@broadcom.com>
Reviewed-by: Franky Lin <franky.lin@broadcom.com>
Signed-off-by: Arend van Spriel <arend@broadcom.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
8 years agobrcmfmac: revise handling events in receive path
Arend van Spriel [Mon, 11 Apr 2016 09:35:27 +0000 (11:35 +0200)]
brcmfmac: revise handling events in receive path

Move event handling out of brcmf_netif_rx() avoiding the need
to pass a flag. This flag is only ever true for USB hosts as
other interface use separate brcmf_rx_event() function.

Reviewed-by: Hante Meuleman <hante.meuleman@broadcom.com>
Reviewed-by: Pieter-Paul Giesberts <pieter-paul.giesberts@broadcom.com>
Reviewed-by: Franky Lin <franky.lin@broadcom.com>
Signed-off-by: Arend van Spriel <arend@broadcom.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
8 years agobrcmfmac: cleanup ampdu-rx host reorder code
Arend van Spriel [Mon, 11 Apr 2016 09:35:26 +0000 (11:35 +0200)]
brcmfmac: cleanup ampdu-rx host reorder code

The code for ampdu-rx host reorder is related to the firmware signalling
supported in BCDC protocol. This change moves the code to fwsignal module.

Reviewed-by: Hante Meuleman <hante.meuleman@broadcom.com>
Reviewed-by: Pieter-Paul Giesberts <pieter-paul.giesberts@broadcom.com>
Reviewed-by: Franky Lin <franky.lin@broadcom.com>
Signed-off-by: Arend van Spriel <arend@broadcom.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
8 years agobrcmfmac: screening firmware event packet
Franky Lin [Mon, 11 Apr 2016 09:35:25 +0000 (11:35 +0200)]
brcmfmac: screening firmware event packet

Firmware uses asynchronized events as a communication method to the
host. The event packets are marked as ETH_P_LINK_CTL protocol type. For
SDIO and PCIe bus, this kind of packets are delivered through virtual
event channel not data channel. This patch adds a screening logic to
make sure the event handler only processes the events coming from the
correct channel.

Reviewed-by: Pieter-Paul Giesberts <pieter-paul.giesberts@broadcom.com>
Signed-off-by: Franky Lin <franky.lin@broadcom.com>
Signed-off-by: Arend van Spriel <arend@broadcom.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
8 years agobrcmfmac: fix p2p scan abort null pointer exception
Hante Meuleman [Mon, 11 Apr 2016 09:35:24 +0000 (11:35 +0200)]
brcmfmac: fix p2p scan abort null pointer exception

When p2p connection setup is performed without having ever done an
escan a null pointer exception can occur. This is because the ifp
to abort scanning is taken from escan struct while it was never
initialized. Fix this by using the primary ifp for scan abort. The
abort should still be performed and all scan related commands are
performed on primary ifp.

Reviewed-by: Arend Van Spriel <arend@broadcom.com>
Reviewed-by: Pieter-Paul Giesberts <pieter-paul.giesberts@broadcom.com>
Signed-off-by: Hante Meuleman <hante.meuleman@broadcom.com>
Signed-off-by: Arend van Spriel <arend@broadcom.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
8 years agobrcmfmac: insert default boardrev in nvram data if missing
Hante Meuleman [Mon, 11 Apr 2016 09:35:23 +0000 (11:35 +0200)]
brcmfmac: insert default boardrev in nvram data if missing

Some nvram files/stores come without the boardrev information,
but firmware requires this to be set. When not found in nvram then
add a default boardrev string to the nvram data.

Reported-by: Rafal Milecki <zajec5@gmail.com>
Reviewed-by: Arend Van Spriel <arend@broadcom.com>
Reviewed-by: Franky (Zhenhui) Lin <franky.lin@broadcom.com>
Reviewed-by: Pieter-Paul Giesberts <pieter-paul.giesberts@broadcom.com>
Signed-off-by: Hante Meuleman <hante.meuleman@broadcom.com>
Signed-off-by: Arend van Spriel <arend@broadcom.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
8 years agobrcmfmac: fix clearing wowl wake indicators
Hante Meuleman [Mon, 11 Apr 2016 09:35:22 +0000 (11:35 +0200)]
brcmfmac: fix clearing wowl wake indicators

Newer firmwares require the usage of the wowl wakeind struct as size
for the iovar to clear the wake indicators. Older firmwares do not
care, so change the used size.

Reviewed-by: Arend Van Spriel <arend@broadcom.com>
Reviewed-by: Pieter-Paul Giesberts <pieter-paul.giesberts@broadcom.com>
Signed-off-by: Hante Meuleman <hante.meuleman@broadcom.com>
Signed-off-by: Arend van Spriel <arend@broadcom.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
8 years agobrcmfmac: clear eventmask array before using it
Hante Meuleman [Mon, 11 Apr 2016 09:35:21 +0000 (11:35 +0200)]
brcmfmac: clear eventmask array before using it

When the event_msgs iovar is set an array is used to configure the
enabled events. This arrays needs to nulled before configuring
otherwise unhandled events will be enabled. This solves a problem
where in case of wowl the host got woken by an incorrectly enabled
event.

Reviewed-by: Pieter-Paul Giesberts <pieter-paul.giesberts@broadcom.com>
Reviewed-by: Arend Van Spriel <arend@broadcom.com>
Signed-off-by: Hante Meuleman <hante.meuleman@broadcom.com>
Signed-off-by: Arend van Spriel <arend@broadcom.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
8 years agortl8xxxu: Adjust AFE crystal value on 8192eu
Jes Sorensen [Thu, 7 Apr 2016 18:19:33 +0000 (14:19 -0400)]
rtl8xxxu: Adjust AFE crystal value on 8192eu

Adjust AFE before enabling PLL on 8192eu, probably also needed for
8723bu.

Signed-off-by: Jes Sorensen <Jes.Sorensen@redhat.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
8 years agortl8xxxu: Implement IQK calibration for 8192eu
Jes Sorensen [Thu, 7 Apr 2016 18:19:32 +0000 (14:19 -0400)]
rtl8xxxu: Implement IQK calibration for 8192eu

8192eu has it's own IQK calibration procedure, and notably uses
undocumented RF register 0x56 in the process.

Signed-off-by: Jes Sorensen <Jes.Sorensen@redhat.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
8 years agortl8xxxu: Use proper register name for REG_PAD_CTRL1
Jes Sorensen [Thu, 7 Apr 2016 18:19:31 +0000 (14:19 -0400)]
rtl8xxxu: Use proper register name for REG_PAD_CTRL1

Fixup another case where the hard coded register value was used
instead of the name.

Signed-off-by: Jes Sorensen <Jes.Sorensen@redhat.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
8 years agortl8xxxu: Implement 8192eu device specific quirks
Jes Sorensen [Thu, 7 Apr 2016 18:19:30 +0000 (14:19 -0400)]
rtl8xxxu: Implement 8192eu device specific quirks

Set REG_QUEUE_CTRL and REG_ACLK_MON for 8192eu.

Signed-off-by: Jes Sorensen <Jes.Sorensen@redhat.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
8 years agortl8xxxu: Fix LDPC RX hang issue on 8192eu
Jes Sorensen [Thu, 7 Apr 2016 18:19:29 +0000 (14:19 -0400)]
rtl8xxxu: Fix LDPC RX hang issue on 8192eu

Implement workaround for LDPC RX hands on 8192eu. This was inspired by
workaround found in the 8192eu vendor driver.

Signed-off-by: Jes Sorensen <Jes.Sorensen@redhat.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
8 years agortl8xxxu: Set REG_USB_HRPWM for 8192eu
Jes Sorensen [Thu, 7 Apr 2016 18:19:28 +0000 (14:19 -0400)]
rtl8xxxu: Set REG_USB_HRPWM for 8192eu

The vendor driver set register 0xfe58 REG_USB_HWPWM in it's init
sequence for 8192eu. Do the same here.

Signed-off-by: Jes Sorensen <Jes.Sorensen@redhat.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
8 years agortl8xxxu: Set correct interrupt masking registers on 8192eu
Jes Sorensen [Thu, 7 Apr 2016 18:19:27 +0000 (14:19 -0400)]
rtl8xxxu: Set correct interrupt masking registers on 8192eu

Set HIMR[01] on 8192eu instead of HISR/HIMR. It's not obvious this
really matters for USB devices, but this matches the register writes
performed by the vendor driver.

Signed-off-by: Jes Sorensen <Jes.Sorensen@redhat.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
8 years agortl8xxxu: Handle XTAL value setting on 8192eu
Jes Sorensen [Thu, 7 Apr 2016 18:19:26 +0000 (14:19 -0400)]
rtl8xxxu: Handle XTAL value setting on 8192eu

Set REG_AFE_XTAL_CTRL on 8192eu to the vendor driver value, and do not
skip setting REG_MAX_AGGR_NUM on 8192eu.

Signed-off-by: Jes Sorensen <Jes.Sorensen@redhat.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
8 years agortl8xxxu: Provide special handling when writing RF regs on 8192eu
Jes Sorensen [Thu, 7 Apr 2016 18:19:25 +0000 (14:19 -0400)]
rtl8xxxu: Provide special handling when writing RF regs on 8192eu

The 8192eu requires clearing/restoring bit 17 in REG_FPGA0_POWER_SAVE
before/after writing RF registers.

Signed-off-by: Jes Sorensen <Jes.Sorensen@redhat.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
8 years agortl8xxxu: Handle BB init for 8192eu
Jes Sorensen [Thu, 7 Apr 2016 18:19:24 +0000 (14:19 -0400)]
rtl8xxxu: Handle BB init for 8192eu

The 8192eu does not use REG_AFE_PLL_CTRL in it's BB init sequence, so
provide device specific handling.

Signed-off-by: Jes Sorensen <Jes.Sorensen@redhat.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>