GitHub/moto-9609/android_kernel_motorola_exynos9610.git
8 years agortl8xxxu: Set 8723bu TX power for CCK and OFDM rates
Jes Sorensen [Mon, 29 Feb 2016 22:05:23 +0000 (17:05 -0500)]
rtl8xxxu: Set 8723bu TX power for CCK and OFDM rates

This implements support for setting TX power for CCK and OFDM rates on
8723bu. MCS rates is still pending.

Signed-off-by: Jes Sorensen <Jes.Sorensen@redhat.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
8 years agortl8xxxu: Parse efuse power indices for 8723bu
Jes Sorensen [Mon, 29 Feb 2016 22:05:22 +0000 (17:05 -0500)]
rtl8xxxu: Parse efuse power indices for 8723bu

This should (hopefully) parse the power indices correctly for the
8723bu.

Signed-off-by: Jes Sorensen <Jes.Sorensen@redhat.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
8 years agortl8xxxu: Bump TX power arrays to handle larger channel groups
Jes Sorensen [Mon, 29 Feb 2016 22:05:21 +0000 (17:05 -0500)]
rtl8xxxu: Bump TX power arrays to handle larger channel groups

Newer generation chips have more channels groups. In order to carry
the larger arrays in common structures, bump the array sizes to
match.

Signed-off-by: Jes Sorensen <Jes.Sorensen@redhat.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
8 years agortl8xxxu: Use size of source pointer when copying efuse data
Jes Sorensen [Mon, 29 Feb 2016 22:05:20 +0000 (17:05 -0500)]
rtl8xxxu: Use size of source pointer when copying efuse data

Some newer chips have more channel groups in their efuse parameter
tables, so use the size of the source, rather than the destination
when copying them out. This avoids copying garbage when increasing the
common array sizes.

Signed-off-by: Jes Sorensen <Jes.Sorensen@redhat.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
8 years agortl8xxxu: Introduce set_tx_power() fileop and a new 8723b dummy derivative
Jes Sorensen [Mon, 29 Feb 2016 22:05:19 +0000 (17:05 -0500)]
rtl8xxxu: Introduce set_tx_power() fileop and a new 8723b dummy derivative

The 8723b series is significantly different from the older generation
in this sense. So far the 8723b version doesn't do anything useful.

Signed-off-by: Jes Sorensen <Jes.Sorensen@redhat.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
8 years agortl8xxxu: Correct struct rtl8723bu_efuse to list power bases correctly
Jes Sorensen [Mon, 29 Feb 2016 22:05:18 +0000 (17:05 -0500)]
rtl8xxxu: Correct struct rtl8723bu_efuse to list power bases correctly

Correct TX power definitions in rtl8723bu_efuse

Signed-off-by: Jes Sorensen <Jes.Sorensen@redhat.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
8 years agortl8xxxu: Do not use hard-wired RF enable settings for 8723bu
Jes Sorensen [Mon, 29 Feb 2016 22:05:17 +0000 (17:05 -0500)]
rtl8xxxu: Do not use hard-wired RF enable settings for 8723bu

These settings simply block the 8723bu, for now leave an empty
function.

With this change we can finally communicate with aliens using the
8723bu!

Signed-off-by: Jes Sorensen <Jes.Sorensen@redhat.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
8 years agortl8xxxu: Setup coex table correctly (hopefully)
Jes Sorensen [Mon, 29 Feb 2016 22:05:16 +0000 (17:05 -0500)]
rtl8xxxu: Setup coex table correctly (hopefully)

Use the same values as the vendor driver when setting up the BTCOEX
table for 8723bu.

Signed-off-by: Jes Sorensen <Jes.Sorensen@redhat.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
8 years agortl8xxxu: Use REG_RFE_CTRL_ANTA_SRC rather than hard coded value
Jes Sorensen [Mon, 29 Feb 2016 22:05:15 +0000 (17:05 -0500)]
rtl8xxxu: Use REG_RFE_CTRL_ANTA_SRC rather than hard coded value

Another case where we should use the register name rather than the
hard coded value when accessing it.

Signed-off-by: Jes Sorensen <Jes.Sorensen@redhat.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
8 years agortl8xxxu: Use name for REG_RFE_BUFFER rather than hard coded value
Jes Sorensen [Mon, 29 Feb 2016 22:05:14 +0000 (17:05 -0500)]
rtl8xxxu: Use name for REG_RFE_BUFFER rather than hard coded value

Register 0x0944 is REG_RFE_BUFFER. Use the name rather than hard coded
value when accessing it.

Signed-off-by: Jes Sorensen <Jes.Sorensen@redhat.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
8 years agortl8xxxu: 8723bu: REG_BT_COEX_TABLE4 is only 8 bits
Jes Sorensen [Mon, 29 Feb 2016 22:05:13 +0000 (17:05 -0500)]
rtl8xxxu: 8723bu: REG_BT_COEX_TABLE4 is only 8 bits

The BT_COEX_TABLE register list contains 3 32 bit registers and one 8
bit register. Hence, use rtl8xxxu_write8() when writing the 8 bit
register.

Signed-off-by: Jes Sorensen <Jes.Sorensen@redhat.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
8 years agortl8xxxu: Set WLAN_ACT_CONTROL per vendor driver setting
Jes Sorensen [Mon, 29 Feb 2016 22:05:12 +0000 (17:05 -0500)]
rtl8xxxu: Set WLAN_ACT_CONTROL per vendor driver setting

The initial code set the wrong setting in WLAN_ACT_CONTROL for the
8723bu.

Signed-off-by: Jes Sorensen <Jes.Sorensen@redhat.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
8 years agortl8xxxu: RF_T_METER is different on the newer chips
Jes Sorensen [Mon, 29 Feb 2016 22:05:11 +0000 (17:05 -0500)]
rtl8xxxu: RF_T_METER is different on the newer chips

Provide RF_T_METER register location for nextgen chips.

Signed-off-by: Jes Sorensen <Jes.Sorensen@redhat.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
8 years agortl8xxxu: Implement init_statistics for 8723bu
Jes Sorensen [Mon, 29 Feb 2016 22:05:10 +0000 (17:05 -0500)]
rtl8xxxu: Implement init_statistics for 8723bu

Vendor driver implements this for 8723b and 8821 series

Signed-off-by: Jes Sorensen <Jes.Sorensen@redhat.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
8 years agortl8xxxu: Add missing blank space in front of bracket
Jes Sorensen [Mon, 29 Feb 2016 22:05:09 +0000 (17:05 -0500)]
rtl8xxxu: Add missing blank space in front of bracket

Keep the automated tools happy

Signed-off-by: Jes Sorensen <Jes.Sorensen@redhat.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
8 years agortl8xxxu: Setup RX aggregation
Jes Sorensen [Mon, 29 Feb 2016 22:05:08 +0000 (17:05 -0500)]
rtl8xxxu: Setup RX aggregation

This initializes RX DMA aggregation on 8723bu. We should do this for
all parts eventually, and also init TX aggregation.

Signed-off-by: Jes Sorensen <Jes.Sorensen@redhat.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
8 years agortl8xxxu: Group chip quirks together
Jes Sorensen [Mon, 29 Feb 2016 22:05:07 +0000 (17:05 -0500)]
rtl8xxxu: Group chip quirks together

Group chip quirks together instead of having them scattered all over
in the init code.

Signed-off-by: Jes Sorensen <Jes.Sorensen@redhat.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
8 years agortl8xxxu: Add REG_DWBCN1_CTRL_8723B define
Jes Sorensen [Mon, 29 Feb 2016 22:05:06 +0000 (17:05 -0500)]
rtl8xxxu: Add REG_DWBCN1_CTRL_8723B define

List yet another new register found on the 8723b.

Signed-off-by: Jes Sorensen <Jes.Sorensen@redhat.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
8 years agortl8xxxu: 8723bu lock phy after RF init
Jes Sorensen [Mon, 29 Feb 2016 22:05:05 +0000 (17:05 -0500)]
rtl8xxxu: 8723bu lock phy after RF init

Set PHY lock after running the RF init sequence on 8723bu.

Signed-off-by: Jes Sorensen <Jes.Sorensen@redhat.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
8 years agortl8xxxu: Call device specific _config_channel()
Jes Sorensen [Mon, 29 Feb 2016 22:05:04 +0000 (17:05 -0500)]
rtl8xxxu: Call device specific _config_channel()

Having a version for the newer chips without calling it doesn't do
much good.....

Signed-off-by: Jes Sorensen <Jes.Sorensen@redhat.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
8 years agortl8xxxu: Initialize burst parameters for 8723bu
Jes Sorensen [Mon, 29 Feb 2016 22:05:03 +0000 (17:05 -0500)]
rtl8xxxu: Initialize burst parameters for 8723bu

Implement burst parameter sequence for 8723bu parts. Eventually this
should be moved into device specific sections.

Signed-off-by: Jes Sorensen <Jes.Sorensen@redhat.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
8 years agortl8xxxu: Set RX boundary for 8723bu
Jes Sorensen [Mon, 29 Feb 2016 22:05:02 +0000 (17:05 -0500)]
rtl8xxxu: Set RX boundary for 8723bu

Set the correct TRXFF boundary for 8723bu.

Signed-off-by: Jes Sorensen <Jes.Sorensen@redhat.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
8 years agortl8xxxu: Do not set FPGA0_TX_INFO for 8723bu and use a larger PBP page size
Jes Sorensen [Mon, 29 Feb 2016 22:05:01 +0000 (17:05 -0500)]
rtl8xxxu: Do not set FPGA0_TX_INFO for 8723bu and use a larger PBP page size

The vendor driver does not set FPGA0_TX_INFO here. In additiona the
8723bu can handler a larger PBP page size.

Signed-off-by: Jes Sorensen <Jes.Sorensen@redhat.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
8 years agortl8xxxu: Do queue init in same order as 8723bu vendor driver
Jes Sorensen [Mon, 29 Feb 2016 22:05:00 +0000 (17:05 -0500)]
rtl8xxxu: Do queue init in same order as 8723bu vendor driver

Reorganize the init sequence in order to be able to compare to the
8723bu vendor driver's init sequence.

Signed-off-by: Jes Sorensen <Jes.Sorensen@redhat.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
8 years agortl8xxxu: 80M spur hack is for 8723au only
Jes Sorensen [Mon, 29 Feb 2016 22:04:59 +0000 (17:04 -0500)]
rtl8xxxu: 80M spur hack is for 8723au only

Only apply the 80M spur hack for 8723au parts.

Signed-off-by: Jes Sorensen <Jes.Sorensen@redhat.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
8 years agortl8xxxu: Init H2C command register for 8723bu
Jes Sorensen [Mon, 29 Feb 2016 22:04:58 +0000 (17:04 -0500)]
rtl8xxxu: Init H2C command register for 8723bu

In addition make register read/write flow match closer to vendor
driver flow. This is mainly to be able to compare the register write
log with the vendor driver, and can be optimized later once 8723bu
support is working.

Signed-off-by: Jes Sorensen <Jes.Sorensen@redhat.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
8 years agortl8xxxu: Another 8723bu magic register set during init
Jes Sorensen [Mon, 29 Feb 2016 22:04:57 +0000 (17:04 -0500)]
rtl8xxxu: Another 8723bu magic register set during init

No indication of what register 0xa3 does anywhere in the vendor source.

Signed-off-by: Jes Sorensen <Jes.Sorensen@redhat.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
8 years agortl8xxxu: Another 8723bu patch for rtl8xxxu_init_phy_bb()
Jes Sorensen [Mon, 29 Feb 2016 22:04:56 +0000 (17:04 -0500)]
rtl8xxxu: Another 8723bu patch for rtl8xxxu_init_phy_bb()

This function is going to need to be split up into chip specific
variants.

Signed-off-by: Jes Sorensen <Jes.Sorensen@redhat.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
8 years agortl8xxxu: Handle XTAL_K value in efuse specific location
Jes Sorensen [Mon, 29 Feb 2016 22:04:55 +0000 (17:04 -0500)]
rtl8xxxu: Handle XTAL_K value in efuse specific location

Retrieve the XTAL_K value in the parse_efuse() functions as it's
location various on a per device basis. For parts that do not provide
an XTAL_K value, skip setting it.

Signed-off-by: Jes Sorensen <Jes.Sorensen@redhat.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
8 years agortl8xxxu: Additional fixes for 8723bu
Jes Sorensen [Mon, 29 Feb 2016 22:04:54 +0000 (17:04 -0500)]
rtl8xxxu: Additional fixes for 8723bu

Additional tweaks to further map the init sequence for the 8723bu to
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: Setup LLT before downloading firmware
Jes Sorensen [Mon, 29 Feb 2016 22:04:53 +0000 (17:04 -0500)]
rtl8xxxu: Setup LLT before downloading firmware

This matches the order of the 8723bu vendor driver

Signed-off-by: Jes Sorensen <Jes.Sorensen@redhat.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
8 years agortl8xxxu: Implement 8723bu power on sequence
Jes Sorensen [Mon, 29 Feb 2016 22:04:52 +0000 (17:04 -0500)]
rtl8xxxu: Implement 8723bu power on sequence

This implements the 8723bu specific power on sequence as it is
different from that of the 8723au chips.

Signed-off-by: Jes Sorensen <Jes.Sorensen@redhat.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
8 years agortl8xxxu: Do not set REG_AFE_XTAL_CTRL on 8723bu
Jes Sorensen [Mon, 29 Feb 2016 22:04:51 +0000 (17:04 -0500)]
rtl8xxxu: Do not set REG_AFE_XTAL_CTRL on 8723bu

The 8723bu does not like REG_AFE_XTAL_CTRL being set, so skip this for
now, 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: Issue BT_INFO command
Jes Sorensen [Mon, 29 Feb 2016 22:04:50 +0000 (17:04 -0500)]
rtl8xxxu: Issue BT_INFO command

Issue a BT_INFO command to verify the status of BT/WiFi settings.

Signed-off-by: Jes Sorensen <Jes.Sorensen@redhat.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
8 years agortl8xxxu: Handle BT register writes and MP_OPER events
Jes Sorensen [Mon, 29 Feb 2016 22:04:49 +0000 (17:04 -0500)]
rtl8xxxu: Handle BT register writes and MP_OPER events

8723bu BT registers are written via the mailbox interface. Add support
for writing these and corresponding C2H event responses.

Signed-off-by: Jes Sorensen <Jes.Sorensen@redhat.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
8 years agortl8xxxu: Initial functionality to handle C2H events for 8723bu
Jes Sorensen [Mon, 29 Feb 2016 22:04:48 +0000 (17:04 -0500)]
rtl8xxxu: Initial functionality to handle C2H events for 8723bu

The 64 bit mailbox commands also provide a different method for
mailbox command responses (C2H events).

Signed-off-by: Jes Sorensen <Jes.Sorensen@redhat.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
8 years agortl8xxxu: Handle 8723bu style rx descriptors
Jes Sorensen [Mon, 29 Feb 2016 22:04:47 +0000 (17:04 -0500)]
rtl8xxxu: Handle 8723bu style rx descriptors

This adds code to parse the new RX descriptor format used by the
8723bu/8192eu parts.

Signed-off-by: Jes Sorensen <Jes.Sorensen@redhat.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
8 years agortl8xxxu: Add rtl8723bu (nextgen) rx descriptor definition
Jes Sorensen [Mon, 29 Feb 2016 22:04:46 +0000 (17:04 -0500)]
rtl8xxxu: Add rtl8723bu (nextgen) rx descriptor definition

The nextgen chips use a slightly different RX descriptor format. This
adds support for the new format.

Signed-off-by: Jes Sorensen <Jes.Sorensen@redhat.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
8 years agortl8xxxu: Set the right type for ps tdma on 8723bu
Jes Sorensen [Mon, 29 Feb 2016 22:04:45 +0000 (17:04 -0500)]
rtl8xxxu: Set the right type for ps tdma on 8723bu

Use the correct type when setting PS TDMA for 8723bu. This matches the
vendor driver.

Signed-off-by: Jes Sorensen <Jes.Sorensen@redhat.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
8 years agortl8xxxu: Do not ignore wlan activity on 8723bu
Jes Sorensen [Mon, 29 Feb 2016 22:04:44 +0000 (17:04 -0500)]
rtl8xxxu: Do not ignore wlan activity on 8723bu

The 8723bu is a WiFi/BT combo part. When initializing it for WiFi,
make sure to tell it not to ignore WiFi activity.

Signed-off-by: Jes Sorensen <Jes.Sorensen@redhat.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
8 years agortl8xxxu: Improve 8723bu init code
Jes Sorensen [Mon, 29 Feb 2016 22:04:43 +0000 (17:04 -0500)]
rtl8xxxu: Improve 8723bu init code

Implement additional init sequence code for the 8723bu.

Signed-off-by: Jes Sorensen <Jes.Sorensen@redhat.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
8 years agortl8xxxu: Remove unused variable
Jes Sorensen [Mon, 29 Feb 2016 22:04:42 +0000 (17:04 -0500)]
rtl8xxxu: Remove unused variable

Remove an unused variable to make the compiler happy.

Signed-off-by: Jes Sorensen <Jes.Sorensen@redhat.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
8 years agortl8xxxu: Initial rtl8723bu_init_bt() code
Jes Sorensen [Mon, 29 Feb 2016 22:04:41 +0000 (17:04 -0500)]
rtl8xxxu: Initial rtl8723bu_init_bt() code

This should initialize the antennas on the 8723bu, but so far I am
still not receiving anything :( More work is needed.

Signed-off-by: Jes Sorensen <Jes.Sorensen@redhat.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
8 years agortl8xxxu: Initial implementation of rtl8723bu_config_channel()
Jes Sorensen [Mon, 29 Feb 2016 22:04:40 +0000 (17:04 -0500)]
rtl8xxxu: Initial implementation of rtl8723bu_config_channel()

This is a first stab of implementing rtl8723bu_config_channel(). For
now this will only do 20MHz channels.

Signed-off-by: Jes Sorensen <Jes.Sorensen@redhat.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
8 years agortl8xxxu: rtl8192eu: Map out EFUSE TX power area
Jakub Sitnicki [Mon, 29 Feb 2016 22:04:39 +0000 (17:04 -0500)]
rtl8xxxu: rtl8192eu: Map out EFUSE TX power area

TX power values are laid out differently in EFUSE found in RTL8192EU &
RTL8188EU devices.  TX power indices and differences for each RF path
are not interleaved (A, B, A, B), as in other chips, but follow one
another (A, B, C, D).

Signed-off-by: Jakub Sitnicki <jsitnicki@gmail.com>
Signed-off-by: Jes Sorensen <Jes.Sorensen@redhat.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
8 years agortl8xxxu: Remove backing up certain registers, which was never used
Jes Sorensen [Mon, 29 Feb 2016 22:04:38 +0000 (17:04 -0500)]
rtl8xxxu: Remove backing up certain registers, which was never used

This was inspired by the vendor driver, but in the end never used for
anything.

Signed-off-by: Jes Sorensen <Jes.Sorensen@redhat.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
8 years agortl8xxxu: Do LC calibration before IQK calibration
Jes Sorensen [Mon, 29 Feb 2016 22:04:37 +0000 (17:04 -0500)]
rtl8xxxu: Do LC calibration before IQK calibration

This matches the flow of the vendor driver for newer hardware, and
doesn't seem to cause issues for the older parts.

Signed-off-by: Jes Sorensen <Jes.Sorensen@redhat.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
8 years agortl8xxxu: Handle S0S1 register in lc_calibrate()
Jes Sorensen [Mon, 29 Feb 2016 22:04:36 +0000 (17:04 -0500)]
rtl8xxxu: Handle S0S1 register in lc_calibrate()

Newer chips (8723bu/8192eu) has S0S1 settings which needs to be dealt
with during LC calibration.

Signed-off-by: Jes Sorensen <Jes.Sorensen@redhat.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
8 years agortl8xxxu: First stab at adding IQK calibration for 8723bu parts
Jes Sorensen [Mon, 29 Feb 2016 22:04:35 +0000 (17:04 -0500)]
rtl8xxxu: First stab at adding IQK calibration for 8723bu parts

The 8723bu also has it's own IQK calibration process. This is similar
in flow, but still different enough to warrent it's own
implementation, at least for now.

Signed-off-by: Jes Sorensen <Jes.Sorensen@redhat.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
8 years agortl8xxxu: Add a couple of new register definitions
Jes Sorensen [Mon, 29 Feb 2016 22:04:34 +0000 (17:04 -0500)]
rtl8xxxu: Add a couple of new register definitions

This adds some additional register definitions for 8723bu, as well as
a bit define for USB RXDMA aggregation in REG_RXDMA_AGG_PG_TH.

Signed-off-by: Jes Sorensen <Jes.Sorensen@redhat.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
8 years agortl8xxxu: Make rtl8xxxu_add_path_on() use device specific init values
Jes Sorensen [Mon, 29 Feb 2016 22:04:33 +0000 (17:04 -0500)]
rtl8xxxu: Make rtl8xxxu_add_path_on() use device specific init values

rtl8192cu/rtl8188cu/rtl8723au use the same values, but 8723bu and
8192eu have their own.

Signed-off-by: Jes Sorensen <Jes.Sorensen@redhat.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
8 years agortl8xxxu: Use correct formatting type to print sizeof()
Jes Sorensen [Mon, 29 Feb 2016 22:04:32 +0000 (17:04 -0500)]
rtl8xxxu: Use correct formatting type to print sizeof()

Usual gcc i386 issue reported by kbuildbot

Signed-off-by: Jes Sorensen <Jes.Sorensen@redhat.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
8 years agortl8xxxu: Do not overwrite rtl8xxxu_debug for untested chips
Jes Sorensen [Mon, 29 Feb 2016 22:04:31 +0000 (17:04 -0500)]
rtl8xxxu: Do not overwrite rtl8xxxu_debug for untested chips

Fix a silly bug where the debug level was overwritten rather than
amended for untested chips.

Signed-off-by: Jes Sorensen <Jes.Sorensen@redhat.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
8 years agortl8xxxu: Do BT_WLAN_CALIBRATION before doing IQK calibration
Jes Sorensen [Mon, 29 Feb 2016 22:04:30 +0000 (17:04 -0500)]
rtl8xxxu: Do BT_WLAN_CALIBRATION before doing IQK calibration

Newer generation chips require the firmware be notified before we
start the IQK calibration.

Signed-off-by: Jes Sorensen <Jes.Sorensen@redhat.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
8 years agortl8xxxu: rtl8xxxu_h2c_cmd(): Add size argument
Jes Sorensen [Mon, 29 Feb 2016 22:04:29 +0000 (17:04 -0500)]
rtl8xxxu: rtl8xxxu_h2c_cmd(): Add size argument

The firmware command API differs slightly between new and old
devices. The new generation requires the size since there is no
extension bit encoded into the command number.

Signed-off-by: Jes Sorensen <Jes.Sorensen@redhat.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
8 years agortl8xxxu: rtl8723bu_parse_efuse(): Use a pointer to the struct rtl8723bu_efuse
Jes Sorensen [Mon, 29 Feb 2016 22:04:28 +0000 (17:04 -0500)]
rtl8xxxu: rtl8723bu_parse_efuse(): Use a pointer to the struct rtl8723bu_efuse

Likewise for 8723bu, use a pointer to the efuse.

Signed-off-by: Jes Sorensen <Jes.Sorensen@redhat.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
8 years agortl8xxxu: rtl8192eu_parse_efuse(): Use a pointer to the struct rtl8192eu_efuse
Jes Sorensen [Mon, 29 Feb 2016 22:04:27 +0000 (17:04 -0500)]
rtl8xxxu: rtl8192eu_parse_efuse(): Use a pointer to the struct rtl8192eu_efuse

Make the code easier to read and less error prone by using a pointer
to the efuse.

Signed-off-by: Jes Sorensen <Jes.Sorensen@redhat.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
8 years agortl8xxxu: rtl8192cu: Introduce a pointer to efuse
Jakub Sitnicki [Mon, 29 Feb 2016 22:04:26 +0000 (17:04 -0500)]
rtl8xxxu: rtl8192cu: Introduce a pointer to efuse

Signed-off-by: Jakub Sitnicki <jsitnicki@gmail.com>
Signed-off-by: Jes Sorensen <Jes.Sorensen@redhat.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
8 years agortl8xxxu: rtl8723au: Introduce a pointer to efuse
Jakub Sitnicki [Mon, 29 Feb 2016 22:04:25 +0000 (17:04 -0500)]
rtl8xxxu: rtl8723au: Introduce a pointer to efuse

Signed-off-by: Jakub Sitnicki <jsitnicki@gmail.com>
Signed-off-by: Jes Sorensen <Jes.Sorensen@redhat.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
8 years agortl8xxxu: Skip disabled efuse words early
Jakub Sitnicki [Mon, 29 Feb 2016 22:04:24 +0000 (17:04 -0500)]
rtl8xxxu: Skip disabled efuse words early

Avoid a negative conditional and an extra level of indentation in the
bigger part of the loop body.

Signed-off-by: Jakub Sitnicki <jsitnicki@gmail.com>
Signed-off-by: Jes Sorensen <Jes.Sorensen@redhat.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
8 years agortl8xxxu: Don't check for illegal offset when reading from efuse
Jakub Sitnicki [Mon, 29 Feb 2016 22:04:23 +0000 (17:04 -0500)]
rtl8xxxu: Don't check for illegal offset when reading from efuse

It is enough to check for either illegal offset or illegal map address
because map address is a value derived from an offset:

  map_addr = offset * 8
  EFUSE_MAP_LEN = EFUSE_MAX_SECTION_8723A * 8

Leave just the check for an illegal map address because its upper
bound (EFUSE_MAP_LEN) is used also in a couple other places.

Signed-off-by: Jakub Sitnicki <jsitnicki@gmail.com>
Signed-off-by: Jes Sorensen <Jes.Sorensen@redhat.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
8 years agortl8xxxu: Add definitions for new generation h2c commands
Jes Sorensen [Mon, 29 Feb 2016 22:04:22 +0000 (17:04 -0500)]
rtl8xxxu: Add definitions for new generation h2c commands

The larger mailboxes also use a different set of mailbox commands.
This provides a list of the 64 bit commands.

Signed-off-by: Jes Sorensen <Jes.Sorensen@redhat.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
8 years agortl8xxxu: Group USB fixups together for all chips
Jes Sorensen [Mon, 29 Feb 2016 22:04:21 +0000 (17:04 -0500)]
rtl8xxxu: Group USB fixups together for all chips

In addition do not apply fixups for 8188/8191/8192 A-cut UMC parts.

Signed-off-by: Jes Sorensen <Jes.Sorensen@redhat.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
8 years agortl8xxxu: Add some missing register definitions for 8723bu
Jes Sorensen [Mon, 29 Feb 2016 22:04:20 +0000 (17:04 -0500)]
rtl8xxxu: Add some missing register definitions for 8723bu

This introduces additional register definitions for newer generation
chips.

Signed-off-by: Jes Sorensen <Jes.Sorensen@redhat.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
8 years agortl8xxxu: Handle 32 bit mailbox extension regs found on 8723bu/8192eu/8812
Jes Sorensen [Mon, 29 Feb 2016 22:04:19 +0000 (17:04 -0500)]
rtl8xxxu: Handle 32 bit mailbox extension regs found on 8723bu/8192eu/8812

Gen1 chips use a 16 bit mailbox extension register, for upto 48 bit
mailbox commands. The newer generation chips use a 32 bit mailbox
extension register instead, for upto 64 bit mailbox commands.

Handle writing the larger mailboxes.

Signed-off-by: Jes Sorensen <Jes.Sorensen@redhat.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
8 years agortl8xxxu: Add 8723by AGC table
Jes Sorensen [Mon, 29 Feb 2016 22:04:18 +0000 (17:04 -0500)]
rtl8xxxu: Add 8723by AGC table

The different RF module seems to require a different AGC table as well

Signed-off-by: Jes Sorensen <Jes.Sorensen@redhat.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
8 years agortl8xxxu: Add rtl8723b_mac_init_table
Jes Sorensen [Mon, 29 Feb 2016 22:04:17 +0000 (17:04 -0500)]
rtl8xxxu: Add rtl8723b_mac_init_table

Newer chips seem to have some different mac registers, requiring
a different init table.

Signed-off-by: Jes Sorensen <Jes.Sorensen@redhat.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
8 years agortl8xxxu: Add rtl8723bu_phy_init_antenna_selection()
Jes Sorensen [Mon, 29 Feb 2016 22:04:16 +0000 (17:04 -0500)]
rtl8xxxu: Add rtl8723bu_phy_init_antenna_selection()

So far this is just for 8723BU. It includes writing to a number of
registers I have seen no description for so far.

0x0064
0x0930
0x0944

Signed-off-by: Jes Sorensen <Jes.Sorensen@redhat.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
8 years agortl8xxxu: Add rtl8723bu_radioa_1t_init_table
Jes Sorensen [Mon, 29 Feb 2016 22:04:15 +0000 (17:04 -0500)]
rtl8xxxu: Add rtl8723bu_radioa_1t_init_table

Add 8723bu 1T radio init table. The vendor driver indicates that some
registers need special treatment for TFBGA90, TFBGA80, and TFBGA79
packaging. However the vendor driver never actually checks the package
type, so just stick to default values here.

Signed-off-by: Jes Sorensen <Jes.Sorensen@redhat.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
8 years agortl8xxxu: Add rtl8723b_phy_1t_init_table
Jes Sorensen [Mon, 29 Feb 2016 22:04:14 +0000 (17:04 -0500)]
rtl8xxxu: Add rtl8723b_phy_1t_init_table

This adds the 8723bu PHY 1T init table.

Signed-off-by: Jes Sorensen <Jes.Sorensen@redhat.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
8 years agortl8xxxu: Only setup USB interrupts for parts which support it
Jes Sorensen [Mon, 29 Feb 2016 22:04:13 +0000 (17:04 -0500)]
rtl8xxxu: Only setup USB interrupts for parts which support it

Only 1st generation chips do provide USB interrupts, so do not try to
setup interrupts for newer chips (8192eu and 8723bu).

Signed-off-by: Jes Sorensen <Jes.Sorensen@redhat.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
8 years agortl8xxxu: Use 1024 byte writes for writing 8723bu firmware
Jes Sorensen [Mon, 29 Feb 2016 22:04:12 +0000 (17:04 -0500)]
rtl8xxxu: Use 1024 byte writes for writing 8723bu firmware

The 8723bu, like the 8192eu, can also handle 1024 byte block writes.

Signed-off-by: Jes Sorensen <Jes.Sorensen@redhat.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
8 years agortl8xxxu: Add rtl8723bu_parse_efuse() and 8723bu efuse definition
Jes Sorensen [Mon, 29 Feb 2016 22:04:11 +0000 (17:04 -0500)]
rtl8xxxu: Add rtl8723bu_parse_efuse() and 8723bu efuse definition

Implement first stab at parsing the 8723bu's efuse.

Signed-off-by: Jes Sorensen <Jes.Sorensen@redhat.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
8 years agortl8xxxu: Initial rtl8723bu chip identification
Jes Sorensen [Mon, 29 Feb 2016 22:04:10 +0000 (17:04 -0500)]
rtl8xxxu: Initial rtl8723bu chip identification

This provides initial detection of 8723bu devices, and selects the
correct firmware image to load.

Signed-off-by: Jes Sorensen <Jes.Sorensen@redhat.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
8 years agortl8xxxu: Init REG_HIMR[01] for 8192eu parts
Jes Sorensen [Mon, 29 Feb 2016 22:04:09 +0000 (17:04 -0500)]
rtl8xxxu: Init REG_HIMR[01] for 8192eu parts

The newer generation chips have different interrupt registers.
Initialize this correct registers on 8192eu.

Signed-off-by: Jes Sorensen <Jes.Sorensen@redhat.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
8 years agortl8xxxu: Kludge to drop incorrect USB OUT EP for 8192EU
Jes Sorensen [Mon, 29 Feb 2016 22:04:08 +0000 (17:04 -0500)]
rtl8xxxu: Kludge to drop incorrect USB OUT EP for 8192EU

The 8192eu (and some other parts) will report an incorrect USB OUT
EP. This tells the chip to drop it - as per the vendor driver.

Signed-off-by: Jes Sorensen <Jes.Sorensen@redhat.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
8 years agortl8xxxu: Fix incorrect test for auto LLT failure
Jes Sorensen [Mon, 29 Feb 2016 22:04:07 +0000 (17:04 -0500)]
rtl8xxxu: Fix incorrect test for auto LLT failure

The logic for testing auto load failure in rtl8xxxu_auto_llt_table()
was inverted.

Signed-off-by: Jes Sorensen <Jes.Sorensen@redhat.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
8 years agortl8xxxu: Init the LLT after we start the firmware
Jes Sorensen [Mon, 29 Feb 2016 22:04:06 +0000 (17:04 -0500)]
rtl8xxxu: Init the LLT after we start the firmware

To match the flow of the vendor driver, move the LLT init to after the
firmware is started.

Signed-off-by: Jes Sorensen <Jes.Sorensen@redhat.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
8 years agortl8xxxu: Init page boundaries before starting the firmware
Jes Sorensen [Mon, 29 Feb 2016 22:04:05 +0000 (17:04 -0500)]
rtl8xxxu: Init page boundaries before starting the firmware

This reorganizes the device initialization to init page boundaries
before starting the firmware. This matches the flow 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: Add rtl8xxxu_auto_llt_table()
Jes Sorensen [Mon, 29 Feb 2016 22:04:04 +0000 (17:04 -0500)]
rtl8xxxu: Add rtl8xxxu_auto_llt_table()

Newer chips can auto load the LLT table, it is no longer necessary to
build it manually in the driver.

Signed-off-by: Jes Sorensen <Jes.Sorensen@redhat.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
8 years agortl8xxxu: Implment rtl8192eu_power_on()
Jes Sorensen [Mon, 29 Feb 2016 22:04:03 +0000 (17:04 -0500)]
rtl8xxxu: Implment rtl8192eu_power_on()

This implements the rtl8192eu power on sequence, and splits it off
from the rtl8192cu/rtl8723au power on sequence.

Signed-off-by: Jes Sorensen <Jes.Sorensen@redhat.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
8 years agortl8xxxu: Add rtl8192eu_nic.bin to the MODULE_FIRMWARE list
Jes Sorensen [Mon, 29 Feb 2016 22:04:02 +0000 (17:04 -0500)]
rtl8xxxu: Add rtl8192eu_nic.bin to the MODULE_FIRMWARE list

Signed-off-by: Jes Sorensen <Jes.Sorensen@redhat.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
8 years agortl8xxxu: Use 1024 byte block loads for 8192eu firmware
Jes Sorensen [Mon, 29 Feb 2016 22:04:01 +0000 (17:04 -0500)]
rtl8xxxu: Use 1024 byte block loads for 8192eu firmware

The rtl8192eu can handle 1024 byte block writes, unlike it's
predecessors (8192cu/8188cu).

Signed-off-by: Jes Sorensen <Jes.Sorensen@redhat.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
8 years agortl8xxxu: Identify chip vendors correctly
Jes Sorensen [Mon, 29 Feb 2016 22:04:00 +0000 (17:04 -0500)]
rtl8xxxu: Identify chip vendors correctly

This identifies the chip vendors correctly and also picks the correct
firmware for rtl8192eu.

Signed-off-by: Jes Sorensen <Jes.Sorensen@redhat.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
8 years agortl8xxxu: Add initial code to parse rtl8192eu efuse
Jes Sorensen [Mon, 29 Feb 2016 22:03:59 +0000 (17:03 -0500)]
rtl8xxxu: Add initial code to parse rtl8192eu efuse

This is the start of 8192eu support. For now just detect the device
and parse the efuse.

Signed-off-by: Jes Sorensen <Jes.Sorensen@redhat.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
8 years agowlcore/wl18xx: add radar_debug_mode handling
Eliad Peller [Sun, 6 Mar 2016 22:28:09 +0000 (00:28 +0200)]
wlcore/wl18xx: add radar_debug_mode handling

Add debugfs key (under CFG80211_CERTIFICATION_ONUS
configuration) to set/clear radar_debug_mode.
In this mode, the driver simply ignores radar
events (but prints them).

The fw is notified about this mode through
a special generic_cfg_feature command.

This mode is relevant only for ap mode. look for
it when initializing ap vif.

Signed-off-by: Eliad Peller <eliad@wizery.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
8 years agowlcore: don't WARN_ON in case of existing ROC
Eliad Peller [Sun, 6 Mar 2016 22:28:08 +0000 (00:28 +0200)]
wlcore: don't WARN_ON in case of existing ROC

When working with AP + P2P, it's possible to get into
a state when the AP is in ROC (due to assiciating station)
while trying to ROC on the P2P interface.

Replace the WARN_ON with wl1271_error to avoid warnings
in this case.

Signed-off-by: Eliad Peller <eliad@wizery.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
8 years agomwifiex: Empty Tx queue during suspend
Amitkumar Karwar [Wed, 9 Mar 2016 12:21:11 +0000 (04:21 -0800)]
mwifiex: Empty Tx queue during suspend

In cfg80211 suspend handler, stop the netif queue and
wait until all the Tx queues become empty. Start the
queues in resume handler.

Signed-off-by: Amitkumar Karwar <akarwar@marvell.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
8 years agobrcmfmac: Remove waitqueue_active check
Hui Wang [Wed, 9 Mar 2016 07:25:26 +0000 (15:25 +0800)]
brcmfmac: Remove waitqueue_active check

We met a problem of pm_suspend  when repeated closing/opening the lid
on a Lenovo laptop (1/20 reproduce rate), below is the log:

[ 199.735876] PM: Entering mem sleep
[ 199.750516] e1000e: EEE TX LPI TIMER: 00000011
[ 199.856638] Trying to free nonexistent resource <000000000000d000-000000000000d0ff>
[ 201.753566] brcmfmac: brcmf_pcie_suspend: Timeout on response for entering D3 substate
[ 201.753581] pci_legacy_suspend(): brcmf_pcie_suspend+0x0/0x1f0 [brcmfmac] returns -5
[ 201.753585] dpm_run_callback(): pci_pm_suspend+0x0/0x160 returns -5
[ 201.753589] PM: Device 0000:04:00.0 failed to suspend async: error -5

Through debugging, we found when problem happens, it is not the device
fails to enter D3, but the signal D3_ACK comes too early to pass the
waitqueue_active() check.

Just like this:
brcmf_pcie_send_mb_data(devinfo, BRCMF_H2D_HOST_D3_INFORM);
// signal is triggered here
wait_event_timeout(devinfo->mbdata_resp_wait, devinfo->mbdata_completed,
   BRCMF_PCIE_MBDATA_TIMEOUT);

So far I think it is safe to remove waitqueue_active check since there
is only one place to trigger this signal (sending
BRCMF_H2D_HOST_D3_INFORM). And it is not a problem calling wake_up
event earlier than calling wait_event.

Cc: Brett Rudley <brudley@broadcom.com>
Cc: Hante Meuleman <meuleman@broadcom.com>
Cc: Franky (Zhenhui) Lin <frankyl@broadcom.com>
Cc: Pieter-Paul Giesberts <pieterpg@broadcom.com>
Cc: Arend van Spriel <arend@broadcom.com>
Signed-off-by: Hui Wang <hui.wang@canonical.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
8 years agolibertas: fix an error code in probe
Dan Carpenter [Tue, 8 Mar 2016 12:04:08 +0000 (15:04 +0300)]
libertas: fix an error code in probe

We accidentally return success instead of a negative error code.

Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
8 years agoMerge tag 'iwlwifi-next-for-kalle-2016-03-09_2' of https://git.kernel.org/pub/scm...
Kalle Valo [Thu, 10 Mar 2016 12:53:35 +0000 (14:53 +0200)]
Merge tag 'iwlwifi-next-for-kalle-2016-03-09_2' of https://git./linux/kernel/git/iwlwifi/iwlwifi-next

* update GSCAN capabilities (Ayala)
* fix AES-CMAC in AP mode (Johannes)
* adapt prints to new firmware API
* rx path improvements (Sara and Gregory)
* fixes for the thermal / cooling device code (Chaya Rachel)
* fixes for GO uAPSD handling
* more code for the 9000 device family (Sara)
* infrastructure work for firmware notification (Chaya Rachel)
* improve association reliablity (Sara)
* runtime PM fixes
* fixes for ROC (HS2.0)

8 years agoiwlwifi: mvm: update GSCAN capabilities
Ayala Beker [Wed, 3 Feb 2016 13:36:52 +0000 (15:36 +0200)]
iwlwifi: mvm: update GSCAN capabilities

Gscan capabilities were updated with new capabilities supported
by the device. While at it, simplify the firmware support
conditional and move both conditions into the WARN() to make it
easier to undertand and use the unlikely() for both.

Signed-off-by: Ayala Beker <ayala.beker@intel.com>
Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
8 years agoiwlwifi: mvm: don't try to offload AES-CMAC in AP/IBSS modes
Johannes Berg [Wed, 9 Mar 2016 13:58:47 +0000 (14:58 +0100)]
iwlwifi: mvm: don't try to offload AES-CMAC in AP/IBSS modes

The firmware/hardware only supports checking AES-CMAC on RX, not
using it on TX. For station mode this is fine, since it's the only
thing it will ever do. For AP mode, it never receives such frames,
but must be able to transmit them. This is currently broken since
we try to enable them for hardware crypto (for RX only) and then
treat them as TX_CMD_SEC_EXT, leading to FIFO underruns during TX
so the frames never go out to the air.

To fix this, simply use software on TX in AP (and IBSS) mode.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
8 years agoiwlwifi: mvm: adapt the firmware assert log to new firmware
Emmanuel Grumbach [Mon, 7 Mar 2016 08:16:38 +0000 (10:16 +0200)]
iwlwifi: mvm: adapt the firmware assert log to new firmware

Newer firmware versions put different data in the memory
which is read by the driver upon firmware crash. Just
change the variable names in the code and the name of the
data in the log that we print withouth any functional
change.
On older firmware, there will be a mismatch between the
names that are printed and the content itself, but that's
harmless.

Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
8 years agoiwlwifi: pcie: avoid restocks inside rx loop if not emergency
Gregory Greenman [Mon, 29 Feb 2016 13:34:25 +0000 (15:34 +0200)]
iwlwifi: pcie: avoid restocks inside rx loop if not emergency

When trying to reach high Rx throughput of more than 500Mbps on
a device with a relatively weak CPU (Atom x5-Z8500), CPU utilization
may become a bottleneck. Analysis showed that we are looping in
iwl_pcie_rx_handle for very long periods which led to starvation
of other threads (iwl_pcie_rx_handle runs with _bh disabled).
We were handling Rx and allocating new buffers and the new buffers
were ready quickly enough to be available before we had finished
handling all the buffers available in the hardware. As a
consequence, we called iwl_pcie_rxq_restock to refill the hardware
with the new buffers, and start again handling new buffers without
exiting the function. Since we read the hardware pointer again when
we goto restart, new buffers were handled immediately instead of
exiting the function.

This patch avoids refilling RBs inside rx handling loop, unless an
emergency situation is reached. It also doesn't read the hardware
pointer again unless we are in an emergency (unlikely) case.
This significantly reduce the maximal time we spend in
iwl_pcie_rx_handle with _bh disabled.

Signed-off-by: Gregory Greenman <gregory.greenman@intel.com>
Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
8 years agoiwlwifi: mvm: return the cooling state index instead of the budget
Chaya Rachel Ivgi [Sun, 14 Feb 2016 12:03:10 +0000 (14:03 +0200)]
iwlwifi: mvm: return the cooling state index instead of the budget

iwl_mvm_tcool_get_cur_state is the function that returns the
cooling state index to the sysfs handler. This function returns
mvm->cooling_dev.cur_state but that variable was set to the
budget and not the cooling state index. Fix that.
Add a missing blank line while at it.

Signed-off-by: Chaya Rachel Ivgi <chaya.rachel.ivgi@intel.com>
Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
8 years agoiwlwifi: mvm: remove RRM advertisement
Emmanuel Grumbach [Tue, 8 Mar 2016 11:53:05 +0000 (13:53 +0200)]
iwlwifi: mvm: remove RRM advertisement

mac80211 advertises this feature for all its drivers.

Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
8 years agoiwlwifi: mvm: don't let NDPs mess the packet tracking
Emmanuel Grumbach [Mon, 7 Mar 2016 20:23:52 +0000 (22:23 +0200)]
iwlwifi: mvm: don't let NDPs mess the packet tracking

We need to track the next packet that we will reclaim in
order to know when the Tx queues are empty. This is useful
when we open or tear down an A-MPDU session which requires
to switch queue.
The next packet being reclaimed is identified by its WiFi
sequence number and this is relevant only when we use QoS.
QoS NDPs do have a TID but have a meaningless sequence
number. The spec mandates the receiver to ignore the
sequence number in this case, allowing the transmitter to
put any sequence number. Our implementation leaves it 0.
When we reclaim a QoS NDP, we can't update the next_relcaim
counter since the sequence number of the QoS NDP itself is
invalid.
We used to update the next_reclaim based on the sequence
number of the QoS NDP which reset it to 1 (0 + 1) and
because of this, we never knew when the queue got empty.
This had to sad consequence to stuck the A-MPDU state
machine in a transient state.
To fix this, don't update next_reclaim when we reclaim
a QoS NDP.

Alesya saw this bug when testing u-APSD. Because the
A-MPDU state machine was stuck in EMPTYING_DELBA, we
updated mac80211 that we still have frames for that
station when it got back to sleep. mac80211 then wrongly
set the TIM bit in the beacon and requested to release
non-existent frames from the A-MPDU queue. This led to
a situation where the client was trying to poll frames
but we had no frames to send.

Reported-by: Alesya Shapira <alesya.shapira@intel.com>
Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
8 years agoiwlwifi: add support for getting HW address from CSR
Sara Sharon [Mon, 7 Mar 2016 12:18:29 +0000 (14:18 +0200)]
iwlwifi: add support for getting HW address from CSR

From 9000 family on, we need to get HW address from host
CSR registers.
OEM can override it by fusing the override registers - read
those first, and if those are 0 - read the OTP registers instead.

In addition - bail out if no valid mac address is present. Make
it shared for all NICs.

Signed-off-by: Sara Sharon <sara.sharon@intel.com>
Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
8 years agoiwlwifi: pcie: fine tune number of rxbs
Sara Sharon [Mon, 1 Feb 2016 11:46:06 +0000 (13:46 +0200)]
iwlwifi: pcie: fine tune number of rxbs

We kick the allocator when we have 2 RBDs that don't have
attached RBs, and the allocator allocates 8 RBs meaning
that it needs another 6 RBDs to attach the RBs to.
The design is that allocator should always have enough RBDs
to fulfill requests, so we give in advance 6 RBDs to the
allocator so that when it is kicked, it gets additional 2 RBDs
and has enough RBDs.
These RBDs were taken from the Rx queue itself, meaning
that each Rx queue didn't have the maximal number of
RBDs, but MAX - 6.
Change initial number of RBDs in the system to include both
queue size and allocator reserves.
Note the multi-queue is always 511 instead of 512 to avoid a
full queue since we cannot detect this state easily enough in
the 9000 arch.

Signed-off-by: Sara Sharon <sara.sharon@intel.com>
Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>