History log of /linux-master/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu.h
Revision Date Author Comments
# 94dd7ce1 05-Feb-2024 Martin Kaistra <martin.kaistra@linutronix.de>

wifi: rtl8xxxu: update rate mask per sta

Until now, rtl8xxxu_watchdog_callback() only fetches RSSI and updates
the rate mask in station mode. This means, in AP mode only the default
rate mask is used.

In order to have the rate mask reflect the actual connection quality,
extend rtl8xxxu_watchdog_callback() to iterate over every sta. Like in
the rtw88 driver, add a function to collect all currently present stas
and then iterate over a list of copies to ensure no RCU lock problems
for register access via USB. Remove the existing RCU lock in
rtl8xxxu_refresh_rate_mask().

Since the currently used ieee80211_ave_rssi() is only for 'vif', add
driver-level tracking of RSSI per sta.

Signed-off-by: Martin Kaistra <martin.kaistra@linutronix.de>
Reviewed-by: Ping-Ke Shih <pkshih@realtek.com>
Signed-off-by: Kalle Valo <kvalo@kernel.org>
Link: https://msgid.link/20240205093040.1941140-1-martin.kaistra@linutronix.de


# ece90a86 11-Jan-2024 Martin Kaistra <martin.kaistra@linutronix.de>

wifi: rtl8xxxu: enable channel switch support

The CSA countdown in the beacon frames, which are sent out by firmware,
needs to get updated by the driver. To achieve this, convert
update_beacon_work to delayed_work and schedule it with the beacon
interval in case CSA is active and the countdown is not complete.

Signed-off-by: Martin Kaistra <martin.kaistra@linutronix.de>
Reviewed-by: Ping-Ke Shih <pkshih@realtek.com>
Signed-off-by: Kalle Valo <kvalo@kernel.org>
Link: https://msgid.link/20240111163628.320697-3-martin.kaistra@linutronix.de


# 1cd165ad 22-Dec-2023 Martin Kaistra <martin.kaistra@linutronix.de>

wifi: rtl8xxxu: declare concurrent mode support for 8188f

Everything is in place now for concurrent mode, we can tell the system
that we support it.
We will allow a maximum of 2 virtual interfaces, one of them can be in
AP mode.

Signed-off-by: Martin Kaistra <martin.kaistra@linutronix.de>
Reviewed-by: Ping-Ke Shih <pkshih@realtek.com>
Signed-off-by: Kalle Valo <kvalo@kernel.org>
Link: https://msgid.link/20231222101442.626837-22-martin.kaistra@linutronix.de


# b837f78f 22-Dec-2023 Martin Kaistra <martin.kaistra@linutronix.de>

wifi: rtl8xxxu: add hw crypto support for AP mode

Add a custom function for allocating entries in the sec cam. This allows
us to store multiple keys with the same keyidx.

The maximum number of sec cam entries for 8188f is 16 according to the
vendor driver. Add the number to rtl8xxxu_fileops, so that other chips
which might support more entries, can set a different number there.

Set the bssid as mac address for group keys instead of just using the
ethernet broadcast address and use BIT(6) in the sec cam ctrl entry
for differentiating them from pairwise keys like in the vendor driver.

Add the TXDESC_EN_DESC_ID bit and the hw_key_idx to tx
broadcast/multicast packets in AP mode.

Finally, allow the usage of rtl8xxxu_set_key() for AP mode.

Signed-off-by: Martin Kaistra <martin.kaistra@linutronix.de>
Reviewed-by: Ping-Ke Shih <pkshih@realtek.com>
Signed-off-by: Kalle Valo <kvalo@kernel.org>
Link: https://msgid.link/20231222101442.626837-20-martin.kaistra@linutronix.de


# f232e9d9 22-Dec-2023 Martin Kaistra <martin.kaistra@linutronix.de>

wifi: rtl8xxxu: remove obsolete priv->vif

Now that all uses of priv->vif have been converted to priv->vifs[]
remove the old attribute.

Signed-off-by: Martin Kaistra <martin.kaistra@linutronix.de>
Reviewed-by: Ping-Ke Shih <pkshih@realtek.com>
Signed-off-by: Kalle Valo <kvalo@kernel.org>
Link: https://msgid.link/20231222101442.626837-19-martin.kaistra@linutronix.de


# 5ce0d7e8 22-Dec-2023 Martin Kaistra <martin.kaistra@linutronix.de>

wifi: rtl8xxxu: add macids for STA mode

Until now, the driver only assigned a dedicated macid for connections
made in AP mode, in STA mode the return value of rtl8xxxu_get_macid()
was simply 0.
To differentiate between port 0 and 1, when both are in STA mode,
allocate a second macid (with value 1) and set sta_info->macid according
to the used port_num in rtl8xxxu_sta_add().

Signed-off-by: Martin Kaistra <martin.kaistra@linutronix.de>
Reviewed-by: Ping-Ke Shih <pkshih@realtek.com>
Signed-off-by: Kalle Valo <kvalo@kernel.org>
Link: https://msgid.link/20231222101442.626837-18-martin.kaistra@linutronix.de


# eef55f15 22-Dec-2023 Martin Kaistra <martin.kaistra@linutronix.de>

wifi: rtl8xxxu: support multiple interfaces in {add,remove}_interface()

Add a custom struct to store in vif->drv_priv with a reference to
port_num and fill it when a new interface is added. Choose a free
port_num for the newly added interface.

As we only want to support AP mode/sending beacons on port 0, only change
the beacon settings if a new interface is actually assigned to port 0.

Call set_linktype() and set_mac() with the appropriate port_num.

Signed-off-by: Martin Kaistra <martin.kaistra@linutronix.de>
Reviewed-by: Ping-Ke Shih <pkshih@realtek.com>
Signed-off-by: Kalle Valo <kvalo@kernel.org>
Link: https://msgid.link/20231222101442.626837-15-martin.kaistra@linutronix.de


# 2bbd7d58 22-Dec-2023 Martin Kaistra <martin.kaistra@linutronix.de>

wifi: rtl8xxxu: prepare supporting two virtual interfaces

To prepare for concurrent mode, add an array ("vifs") to rtl8xxxu_priv
to keep track of both interfaces.

Keep the old priv->vif as long there are still users of it and let
priv->vifs[0] point to the same location.

Signed-off-by: Martin Kaistra <martin.kaistra@linutronix.de>
Reviewed-by: Ping-Ke Shih <pkshih@realtek.com>
Signed-off-by: Kalle Valo <kvalo@kernel.org>
Link: https://msgid.link/20231222101442.626837-3-martin.kaistra@linutronix.de


# c98411dc 13-May-2023 Bitterblue Smith <rtl8821cerfe2@gmail.com>

wifi: rtl8xxxu: Support new chip RTL8192FU

This is a newer chip, similar to the RTL8710BU in that it uses the same
PHY status structs.

Features: 2.4 GHz, b/g/n mode, 2T2R, 300 Mbps.

It can allegedly have Bluetooth, but that's not implemented here.

This chip can have many RFE (RF front end) types, of which types 1
and 5 are the only ones tested. Many of the other types need different
initialisation tables. They can be added if someone wants them.

The vendor driver v5.8.6.2_35538.20191028_COEX20190910-0d02 from
https://github.com/BrightX/rtl8192fu was used as reference, with
additional device IDs taken from
https://github.com/kelebek333/rtl8192fu-dkms.

The vendor driver also claims to support devices with ID 0bda:a725,
but that is found in some bluetooth-only devices, so it's not supported
here.

Signed-off-by: Bitterblue Smith <rtl8821cerfe2@gmail.com>
Reviewed-by: Ping-Ke Shih <pkshih@realtek.com>
Signed-off-by: Kalle Valo <kvalo@kernel.org>
Link: https://lore.kernel.org/r/7dcf9fb9-1c97-ac28-5286-2236e287a18c@gmail.com


# 20429444 11-May-2023 Yun Lu <luyun@kylinos.cn>

wifi: rtl8xxxu: fix authentication timeout due to incorrect RCR value

When using rtl8192cu with rtl8xxxu driver to connect wifi, there is a
probability of failure, which shows "authentication with ... timed out".
Through debugging, it was found that the RCR register has been inexplicably
modified to an incorrect value, resulting in the nic not being able to
receive authenticated frames.

To fix this problem, add regrcr in rtl8xxxu_priv struct, and store
the RCR value every time the register is written, and use it the next
time the register need to be modified.

Signed-off-by: Yun Lu <luyun@kylinos.cn>
Link: https://lore.kernel.org/all/20230427020512.1221062-1-luyun_611@163.com
Signed-off-by: Kalle Valo <kvalo@kernel.org>
Link: https://lore.kernel.org/r/20230512012055.2990472-1-luyun_611@163.com


# b9a07c44 28-Apr-2023 Martin Kaistra <martin.kaistra@linutronix.de>

wifi: rtl8xxxu: Set maximum number of supported stations

Set maximum number of associated stations supported in AP mode. For
8188f, the maximum number of supported macids is 16, reserve one for
broadcast/multicast frames.

Signed-off-by: Martin Kaistra <martin.kaistra@linutronix.de>
Reviewed-by: Ping-Ke Shih <pkshih@realtek.com>
Signed-off-by: Kalle Valo <kvalo@kernel.org>
Link: https://lore.kernel.org/r/20230428150833.218605-19-martin.kaistra@linutronix.de


# b468481c 28-Apr-2023 Martin Kaistra <martin.kaistra@linutronix.de>

wifi: rtl8xxxu: Declare AP mode support for 8188f

Everything is in place now for AP mode, we can tell the system that we
support it. Put the feature behind a flag in priv->fops, because it is
not (yet) implemented for all chips.

Signed-off-by: Martin Kaistra <martin.kaistra@linutronix.de>
Reviewed-by: Ping-Ke Shih <pkshih@realtek.com>
Signed-off-by: Kalle Valo <kvalo@kernel.org>
Link: https://lore.kernel.org/r/20230428150833.218605-18-martin.kaistra@linutronix.de


# 769f3263 28-Apr-2023 Martin Kaistra <martin.kaistra@linutronix.de>

wifi: rtl8xxxu: Add parameter macid to update_rate_mask

The HW maintains a rate_mask for each connection, referenced by the
macid. Add a parameter to update_rate_mask and add the macid to the
h2c call in the gen2 implementation.

Also extend refresh_rate_mask to get the macid from sta_info.

Signed-off-by: Martin Kaistra <martin.kaistra@linutronix.de>
Reviewed-by: Ping-Ke Shih <pkshih@realtek.com>
Signed-off-by: Kalle Valo <kvalo@kernel.org>
Link: https://lore.kernel.org/r/20230428150833.218605-13-martin.kaistra@linutronix.de


# 9aa45598 28-Apr-2023 Martin Kaistra <martin.kaistra@linutronix.de>

wifi: rtl8xxxu: Put the macid in txdesc

Add a parameter macid to fill_txdesc(), implement setting it for the
gen2 version.
This is used to tell the HW who the recipient of the packet is, so that
the appropriate data rate can be selected.

Signed-off-by: Martin Kaistra <martin.kaistra@linutronix.de>
Reviewed-by: Ping-Ke Shih <pkshih@realtek.com>
Signed-off-by: Kalle Valo <kvalo@kernel.org>
Link: https://lore.kernel.org/r/20230428150833.218605-12-martin.kaistra@linutronix.de


# 726e478c 28-Apr-2023 Martin Kaistra <martin.kaistra@linutronix.de>

wifi: rtl8xxxu: Add sta_add() and sta_remove() callbacks

In AP mode, sta_add() gets called when a new STA gets associated to
us. Call rtl8xxxu_refresh_rate_mask() to set a rate mask for the newly
connected STA (referenced by the macid) and then send a media connnect
report. Ignore the call to sta_add() in station mode.

Reserve one macid for broadcast/multicast packets in init.

Signed-off-by: Martin Kaistra <martin.kaistra@linutronix.de>
Reviewed-by: Ping-Ke Shih <pkshih@realtek.com>
Signed-off-by: Kalle Valo <kvalo@kernel.org>
Link: https://lore.kernel.org/r/20230428150833.218605-11-martin.kaistra@linutronix.de


# 2be2eed4 28-Apr-2023 Martin Kaistra <martin.kaistra@linutronix.de>

wifi: rtl8xxxu: Add parameter role to report_connect

This allows to tell the HW if a connection is made to a STA or an AP.
Add the implementation for the gen2 version.

Signed-off-by: Martin Kaistra <martin.kaistra@linutronix.de>
Reviewed-by: Ping-Ke Shih <pkshih@realtek.com>
Signed-off-by: Kalle Valo <kvalo@kernel.org>
Link: https://lore.kernel.org/r/20230428150833.218605-9-martin.kaistra@linutronix.de


# cde8848c 28-Apr-2023 Martin Kaistra <martin.kaistra@linutronix.de>

wifi: rtl8xxxu: Add beacon functions

Add a workqueue to update the beacon contents asynchronously and
implement downloading the beacon to the HW and starting beacon tx like
the vendor driver.

Signed-off-by: Martin Kaistra <martin.kaistra@linutronix.de>
Reviewed-by: Ping-Ke Shih <pkshih@realtek.com>
Signed-off-by: Kalle Valo <kvalo@kernel.org>
Link: https://lore.kernel.org/r/20230428150833.218605-4-martin.kaistra@linutronix.de


# ac48499e 28-Apr-2023 Martin Kaistra <martin.kaistra@linutronix.de>

wifi: rtl8xxxu: Add start_ap() callback

This gets called at the start of AP mode operation. Set bssid, beacon
interval and send a connect report to the HW.

Signed-off-by: Martin Kaistra <martin.kaistra@linutronix.de>
Reviewed-by: Ping-Ke Shih <pkshih@realtek.com>
Signed-off-by: Kalle Valo <kvalo@kernel.org>
Link: https://lore.kernel.org/r/20230428150833.218605-2-martin.kaistra@linutronix.de


# cd85c8b0 17-Apr-2023 Bitterblue Smith <rtl8821cerfe2@gmail.com>

wifi: rtl8xxxu: Add rtl8xxxu_write{8,16,32}_{set,clear}

Also add rtl8xxxu_write32_mask, rtl8xxxu_write_rfreg_mask.

These helper functions make it easier to modify only parts of a register
by eliminating the call to the register reading function and the bit
manipulations.

Signed-off-by: Bitterblue Smith <rtl8821cerfe2@gmail.com>
Reviewed-by: Ping-Ke Shih <pkshih@realtek.com>
Signed-off-by: Kalle Valo <kvalo@kernel.org>
Link: https://lore.kernel.org/r/9430b841-1048-b27c-14ec-fca447dc32af@gmail.com


# b9c3379d 10-Apr-2023 Bitterblue Smith <rtl8821cerfe2@gmail.com>

wifi: rtl8xxxu: Support devices with 5-6 out endpoints

Handle them the same way as the devices with 3-4 USB out endpoints.
This is needed for the RTL8192FU.

Signed-off-by: Bitterblue Smith <rtl8821cerfe2@gmail.com>
Reviewed-by: Ping-Ke Shih <pkshih@realtek.com>
Signed-off-by: Kalle Valo <kvalo@kernel.org>
Link: https://lore.kernel.org/r/ef4bc66d-84f5-4021-efd7-1787d097519c@gmail.com


# a5be45ea 10-Apr-2023 Bitterblue Smith <rtl8821cerfe2@gmail.com>

wifi: rtl8xxxu: Clean up some messy ifs

Add some new members to rtl8xxxu_fileops and use them instead of
checking priv->rtl_chip.

Signed-off-by: Bitterblue Smith <rtl8821cerfe2@gmail.com>
Reviewed-by: Ping-Ke Shih <pkshih@realtek.com>
Signed-off-by: Kalle Valo <kvalo@kernel.org>
Link: https://lore.kernel.org/r/e24a5534-6e33-cfb9-0634-0caf4646513f@gmail.com


# 70664495 13-Mar-2023 Bitterblue Smith <rtl8821cerfe2@gmail.com>

wifi: rtl8xxxu: Support new chip RTL8710BU aka RTL8188GU

This chip is found in cheap "free driver" USB adapters from Aliexpress.
Initially they pretend to be a CD-ROM containing the driver for Windows.
"Ejecting" switches the device to wifi mode.

Features: 2.4 GHz, b/g/n mode, 1T1R, 150 Mbps.

This chip is more unique than other Realtek chips:

* The registers at addresses 0x0-0xff, which all the other chips use,
can't be used here. New registers at 0x8000-0x80ff must be used
instead. And it's not a simple matter of adding 0x8000: 0x2
(REG_SYS_FUNC) became 0x8004, 0x80 (REG_MCU_FW_DL) became 0x8090,
etc.

* Also there are a few new registers which must be accessed indirectly
because their addresses don't fit in 16 bits. No other chips seem to
have these.

* The vendor driver compiles to 8188gu.ko, but the code calls the chip
RTL8710B(U) pretty much everywhere, including messages visible to the
user.

Another difference compared to the other chips supported by rtl8xxxu is
that it has a new PHY status struct, or three of them actually, from
which we extract the RSSI, among other things. This is not unique,
though, just new. The chips supported by rtw88 also use it.

Signed-off-by: Bitterblue Smith <rtl8821cerfe2@gmail.com>
Reviewed-by: Ping-Ke Shih <pkshih@realtek.com>
Tested-by: Philipp Hortmann <philipp.g.hortmann@gmail.com> # Edimax N150
Signed-off-by: Kalle Valo <kvalo@kernel.org>
Link: https://lore.kernel.org/r/4edbe29f-00b9-8eef-9789-20bed0b141e2@gmail.com


# 3be01622 20-Jan-2023 Bitterblue Smith <rtl8821cerfe2@gmail.com>

wifi: rtl8xxxu: Register the LED and make it blink

If the chip can have an LED, register a struct led_classdev and enable
hardware-controlled blinking. When the chip is not transmitting or
receiving anything the LED is off. Otherwise the LED will blink
faster or slower according to the throughput.

The LED can be controlled from userspace by writing 0, 1, or 2 to
/sys/class/leds/rtl8xxxu-usbX-Y/brightness:
0 - solid off.
1 - solid on.
2 - hardware-controlled blinking.

In this patch none of the chips advertise having an LED. That will be
added in the next patches.

Signed-off-by: Bitterblue Smith <rtl8821cerfe2@gmail.com>
Reviewed-by: Ping-Ke Shih <pkshih@realtek.com>
Signed-off-by: Kalle Valo <kvalo@kernel.org>
Link: https://lore.kernel.org/r/b8235bca-60c3-d0fe-a958-53c6dd3ba3f6@gmail.com


# 3922dc9f 08-Jan-2023 Bitterblue Smith <rtl8821cerfe2@gmail.com>

wifi: rtl8xxxu: Report the RSSI to the firmware

Or in the case of RTL8188EU, report the RSSI to the rate control code.

The rate control code for RTL8188EU is less likely to switch to a lower
rate when the RSSI is high. The firmware-based rate control in the other
chips probably works the same way.

This affects all the chips, but it was only tested with RTL8188EU,
RTL8188FU, and RTL8192EU.

Signed-off-by: Bitterblue Smith <rtl8821cerfe2@gmail.com>
Reviewed-by: Ping-Ke Shih <pkshih@realtek.com>
Signed-off-by: Kalle Valo <kvalo@kernel.org>
Link: https://lore.kernel.org/r/2aab4f3f-e914-4fe1-f29a-deac91774d05@gmail.com


# 8b9754b2 17-Dec-2022 Bitterblue Smith <rtl8821cerfe2@gmail.com>

wifi: rtl8xxxu: Add rate control code for RTL8188EU

Copied from the newer vendor driver, v5.2.2.4.

Signed-off-by: Bitterblue Smith <rtl8821cerfe2@gmail.com>
Reviewed-by: Ping-Ke Shih <pkshih@realtek.com>
Signed-off-by: Kalle Valo <kvalo@kernel.org>
Link: https://lore.kernel.org/r/5acc1e5d-62d6-3a6a-0f9e-cbc8b809b1d7@gmail.com


# 3dfb8e84 17-Dec-2022 Jes Sorensen <Jes.Sorensen@gmail.com>

wifi: rtl8xxxu: Support new chip RTL8188EU

This chip is found in cheap USB devices from TP-Link, D-Link, etc.

Features: 2.4 GHz, b/g/n mode, 1T1R, 150 Mbps.

Chip versions older than "I cut" need software rate control. That will
be in the next commit. Until then MCS7 is used for all data frames.

The "I cut" chips are not supported. They require different firmware
and initialisation tables. Support can be added if someone has the
hardware to test it.

Co-developed-by: Andrea Merello <andrea.merello@gmail.com>
Signed-off-by: Andrea Merello <andrea.merello@gmail.com>
Co-developed-by: Taehee Yoo <ap420073@gmail.com>
Signed-off-by: Taehee Yoo <ap420073@gmail.com>
Signed-off-by: Jes Sorensen <Jes.Sorensen@gmail.com>
Co-developed-by: Bitterblue Smith <rtl8821cerfe2@gmail.com>
Signed-off-by: Bitterblue Smith <rtl8821cerfe2@gmail.com>
Reviewed-by: Ping-Ke Shih <pkshih@realtek.com>
Signed-off-by: Kalle Valo <kvalo@kernel.org>
Link: https://lore.kernel.org/r/3aad60f6-23f9-81e8-c741-4bd51e99f423@gmail.com


# b75289e8 17-Dec-2022 Bitterblue Smith <rtl8821cerfe2@gmail.com>

wifi: rtl8xxxu: Define masks for cck_agc_rpt bits

Define the constants CCK_AGC_RPT_LNA_IDX_MASK and
CCK_AGC_RPT_VGA_IDX_MASK instead of using the same literals
in four places.

And get the bits from cck_agc_rpt using u8_get_bits().

It's a cosmetic change only.

Signed-off-by: Bitterblue Smith <rtl8821cerfe2@gmail.com>
Reviewed-by: Ping-Ke Shih <pkshih@realtek.com>
Signed-off-by: Kalle Valo <kvalo@kernel.org>
Link: https://lore.kernel.org/r/cfe79922-efdf-2ed0-7404-263915d19d82@gmail.com


# d7a3705c 17-Dec-2022 Bitterblue Smith <rtl8821cerfe2@gmail.com>

wifi: rtl8xxxu: Make rtl8xxxu_load_firmware take const char*

And pass const char* to it.

Signed-off-by: Bitterblue Smith <rtl8821cerfe2@gmail.com>
Reviewed-by: Ping-Ke Shih <pkshih@realtek.com>
Signed-off-by: Kalle Valo <kvalo@kernel.org>
Link: https://lore.kernel.org/r/361ceac1-cc73-605b-4b63-736bfce80833@gmail.com


# dd469a75 01-Dec-2022 Bitterblue Smith <rtl8821cerfe2@gmail.com>

wifi: rtl8xxxu: Add __packed to struct rtl8723bu_c2h

This struct is used to access a sequence of bytes received from the
wifi chip. It must not have any padding bytes between the members.

This doesn't change anything on my system, possibly because currently
none of the members need more than byte alignment.

Fixes: b2b43b7837ba ("rtl8xxxu: Initial functionality to handle C2H events for 8723bu")
Signed-off-by: Bitterblue Smith <rtl8821cerfe2@gmail.com>
Reviewed-by: Ping-Ke Shih <pkshih@realtek.com>
Signed-off-by: Kalle Valo <kvalo@kernel.org>
Link: https://lore.kernel.org/r/1a270918-da22-ff5f-29fc-7855f740c5ba@gmail.com


# 14566bbf 05-Nov-2022 Bitterblue Smith <rtl8821cerfe2@gmail.com>

wifi: rtl8xxxu: Split up rtl8xxxu_identify_chip

Move the reusable parts into separate functions and create one
identify_chip function for each chip type.

This is preparation for supporting the RTL8710BU chip, which would
need too many ugly changes to this function. Another reason to do this
is to get rid of the long and scary if..else if..else block in the
middle of the function.

Everything should still work the same as before.

Signed-off-by: Bitterblue Smith <rtl8821cerfe2@gmail.com>
Signed-off-by: Kalle Valo <kvalo@kernel.org>
Link: https://lore.kernel.org/r/b268b5cf-071c-6292-0d90-0573e4fb2228@gmail.com


# bcfcb712 05-Nov-2022 Bitterblue Smith <rtl8821cerfe2@gmail.com>

wifi: rtl8xxxu: Move burst init to a function

No changes to functionality, just moving code to make
rtl8xxxu_init_device look nicer.

Signed-off-by: Bitterblue Smith <rtl8821cerfe2@gmail.com>
Signed-off-by: Kalle Valo <kvalo@kernel.org>
Link: https://lore.kernel.org/r/bef90bf8-716f-c92f-9403-12ef2bfefc15@gmail.com


# 2ad2a813 01-Nov-2022 Bitterblue Smith <rtl8821cerfe2@gmail.com>

wifi: rtl8xxxu: Fix the CCK RSSI calculation

The CCK RSSI calculation is incorrect for the RTL8723BU, RTL8192EU,
and RTL8188FU. Add new functions for these chips with code copied from
their vendor drivers. Use the old code only for the RTL8723AU and
RTL8192CU.

I didn't notice any difference in the reported signal strength with my
RTL8188FU, but I didn't look very hard either.

Signed-off-by: Bitterblue Smith <rtl8821cerfe2@gmail.com>
Signed-off-by: Kalle Valo <kvalo@kernel.org>
Link: https://lore.kernel.org/r/926c838f-4997-698b-4da9-44582e2af99a@gmail.com


# 57b328bc 01-Nov-2022 Bitterblue Smith <rtl8821cerfe2@gmail.com>

wifi: rtl8xxxu: Add central frequency offset tracking

According to Realtek programmers, "to adjust oscillator to align
central frequency of connected AP. Then, it can yield better
performance." From commit fb8517f4fade ("rtw88: 8822c: add CFO
tracking").

The RTL8192CU and a version of RTL8723AU apparently don't have the
ability to adjust the oscillator, so this doesn't apply to them.

This also doesn't apply to the wifi + bluetooth combo chips (RTL8723AU
and RTL8723BU) because the CFO tracking should only be done when
bluetooth is disabled, and determining that looked complicated.

That leaves only the RTL8192EU and RTL8188FU chips. I tested this with
the latter.

Signed-off-by: Bitterblue Smith <rtl8821cerfe2@gmail.com>
Signed-off-by: Kalle Valo <kvalo@kernel.org>
Link: https://lore.kernel.org/r/80aba428-0aff-f4b2-dea5-35d1425982b6@gmail.com


# 79cac25e 08-Oct-2022 Bitterblue Smith <rtl8821cerfe2@gmail.com>

wifi: rtl8xxxu: Make some arrays const

All the initialisation tables, plus rtl8xxxu_rfregs.

Most of them were already static.

Signed-off-by: Bitterblue Smith <rtl8821cerfe2@gmail.com>
Signed-off-by: Kalle Valo <kvalo@kernel.org>
Link: https://lore.kernel.org/r/9407f219-a7ba-676e-3d99-154d67b312d2@gmail.com


# c888183b 28-Sep-2022 Bitterblue Smith <rtl8821cerfe2@gmail.com>

wifi: rtl8xxxu: Support new chip RTL8188FU

This chip is found in the cheapest USB adapters, e.g. 1.17 USD with
VAT and shipping from China included.

It's a gen 2 chip, similar to the RTL8723BU, but without Bluetooth.
Features: 2.4 GHz, b/g/n mode, 1T1R, 150 Mbps.

The vendor driver rtl8188fu version 4.3.23.6_20964.20170110 [0]
was used as reference. The CD shipped with the device includes a
newer driver, version 5.11.5-1-g12f7cde4b.20201102, but that one
couldn't complete the WPA2 key exchange thing for whatever reason.

[0] https://github.com/kelebek333/rtl8188fu

Signed-off-by: Bitterblue Smith <rtl8821cerfe2@gmail.com>
Signed-off-by: Kalle Valo <kvalo@kernel.org>
Link: https://lore.kernel.org/r/b14f299d-3248-98fe-eee1-ba50d2e76c74@gmail.com


# a8b5aef2 18-Sep-2022 Bitterblue Smith <rtl8821cerfe2@gmail.com>

wifi: rtl8xxxu: gen2: Enable 40 MHz channel width

The module parameter ht40_2g was supposed to enable 40 MHz operation,
but it didn't.

Tell the firmware about the channel width when updating the rate mask.
This makes it work with my gen 2 chip RTL8188FU.

I'm not sure if anything needs to be done for the gen 1 chips, if 40
MHz channel width already works or not. They update the rate mask with
a different structure which doesn't have a field for the channel width.

Also set the channel width correctly for sta_statistics.

Fixes: f653e69009c6 ("rtl8xxxu: Implement basic 8723b specific update_rate_mask() function")
Fixes: bd917b3d28c9 ("rtl8xxxu: fill up txrate info for gen1 chips")
Signed-off-by: Bitterblue Smith <rtl8821cerfe2@gmail.com>
Acked-by: Jes Sorensen <jes@trained-monkey.org>
Signed-off-by: Kalle Valo <kvalo@kernel.org>
Link: https://lore.kernel.org/r/3a950997-7580-8a6b-97a0-e0a81a135456@gmail.com


# 95a581ab 04-Aug-2021 Chris Chiu <chris.chiu@canonical.com>

rtl8xxxu: Fix the handling of TX A-MPDU aggregation

The TX A-MPDU aggregation is not handled in the driver since the
ieee80211_start_tx_ba_session has never been started properly.
Start and stop the TX BA session by tracking the TX aggregation
status of each TID. Fix the ampdu_action and the tx descriptor
accordingly with the given TID.

Signed-off-by: Chris Chiu <chris.chiu@canonical.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
Link: https://lore.kernel.org/r/20210804151325.86600-1-chris.chiu@canonical.com


# c240b044 24-Apr-2021 Pascal Terjan <pterjan@google.com>

rtl8xxxu: Fix device info for RTL8192EU devices

Based on 2001:3319 and 2357:0109 which I used to test the fix and
0bda:818b and 2357:0108 for which I found efuse dumps online.

== 2357:0109 ==
=== Before ===
Vendor: Realtek
Product: \x03802.11n NI
Serial:
=== After ===
Vendor: Realtek
Product: 802.11n NIC
Serial not available.

== 2001:3319 ==
=== Before ===
Vendor: Realtek
Product: Wireless N
Serial: no USB Adap
=== After ===
Vendor: Realtek
Product: Wireless N Nano USB Adapter
Serial not available.

Signed-off-by: Pascal Terjan <pterjan@google.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
Link: https://lore.kernel.org/r/20210424172959.1559890-1-pterjan@google.com


# 431eb49e 05-Apr-2021 Christophe JAILLET <christophe.jaillet@wanadoo.fr>

rtl8xxxu: Simplify locking of a skb list accesses

The 'c2hcmd_lock' spinlock is only used to protect some __skb_queue_tail()
and __skb_dequeue() calls.
Use the lock provided in the skb itself and call skb_queue_tail() and
skb_dequeue(). These functions already include the correct locking.

Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
Link: https://lore.kernel.org/r/8bcec6429615aeb498482dc7e1955ce09b456585.1617613700.git.christophe.jaillet@wanadoo.fr


# 0985d3a4 20-Mar-2020 Chris Chiu <chiu@endlessm.com>

rtl8xxxu: Feed current txrate information for mac80211

The nl80211 commands such as 'iw link' can't get current txrate
information from the driver. This commit fills in the tx rate
information from the C2H RA report in the sta_statistics function.

Signed-off-by: Chris Chiu <chiu@endlessm.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
Link: https://lore.kernel.org/r/20200320063833.1058-3-chiu@endlessm.com


# a66b8b41 20-Mar-2020 Chris Chiu <chiu@endlessm.com>

rtl8xxxu: add enumeration for channel bandwidth

There's a data field in H2C and C2H commands which is used to
carry channel bandwidth information. Add enumeration to make it
more descriptive in code.

Signed-off-by: Chris Chiu <chiu@endlessm.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
Link: https://lore.kernel.org/r/20200320063833.1058-2-chiu@endlessm.com


# a1b7714b 24-Feb-2020 Gustavo A. R. Silva <gustavo@embeddedor.com>

wireless: realtek: Replace zero-length array with flexible-array member

The current codebase makes use of the zero-length array language
extension to the C90 standard, but the preferred mechanism to declare
variable-length types such as these ones is a flexible array member[1][2],
introduced in C99:

struct foo {
int stuff;
struct boo array[];
};

By making use of the mechanism above, we will get a compiler warning
in case the flexible array does not occur last in the structure, which
will help us prevent some kind of undefined behavior bugs from being
inadvertently introduced[3] to the codebase from now on.

Also, notice that, dynamic memory allocations won't be affected by
this change:

"Flexible array members have incomplete type, and so the sizeof operator
may not be applied. As a quirk of the original implementation of
zero-length arrays, sizeof evaluates to zero."[1]

This issue was found with the help of Coccinelle.

[1] https://gcc.gnu.org/onlinedocs/gcc/Zero-Length.html
[2] https://github.com/KSPP/linux/issues/21
[3] commit 76497732932f ("cxgb3/l2t: Fix undefined behaviour")

Signed-off-by: Gustavo A. R. Silva <gustavo@embeddedor.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
Link: https://lore.kernel.org/r/20200225002746.GA26789@embeddedor


# 0eeb91ad 15-Oct-2019 Chris Chiu <chiu@endlessm.com>

rtl8xxxu: fix RTL8723BU connection failure issue after warm reboot

The RTL8723BU has problems connecting to AP after each warm reboot.
Sometimes it returns no scan result, and in most cases, it fails
the authentication for unknown reason. However, it works totally
fine after cold reboot.

Compare the value of register SYS_CR and SYS_CLK_MAC_CLK_ENABLE
for cold reboot and warm reboot, the registers imply that the MAC
is already powered and thus some procedures are skipped during
driver initialization. Double checked the vendor driver, it reads
the SYS_CR and SYS_CLK_MAC_CLK_ENABLE also but doesn't skip any
during initialization based on them. This commit only tells the
RTL8723BU to do full initialization without checking MAC status.

Signed-off-by: Chris Chiu <chiu@endlessm.com>
Signed-off-by: Jes Sorensen <Jes.Sorensen@gmail.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>


# e542e66b 05-Oct-2019 Chris Chiu <chiu@endlessm.com>

rtl8xxxu: add bluetooth co-existence support for single antenna

The RTL8723BU suffers the wifi disconnection problem while bluetooth
device connected. While wifi is doing tx/rx, the bluetooth will scan
without results. This is due to the wifi and bluetooth share the same
single antenna for RF communication and they need to have a mechanism
to collaborate.

BT information is provided via the packet sent from co-processor to
host (C2H). It contains the status of BT but the rtl8723bu_handle_c2h
dose not really handle it. And there's no bluetooth coexistence
mechanism to deal with it.

This commit adds a workqueue to set the tdma configurations and
coefficient table per the parsed bluetooth link status and given
wifi connection state. The tdma/coef table comes from the vendor
driver code of the RTL8192EU and RTL8723BU. However, this commit is
only for single antenna scenario which RTL8192EU is default dual
antenna. The rtl8xxxu_parse_rxdesc24 which invokes the handle_c2h
is only for 8723b and 8192e so the mechanism is expected to work
on both chips with single antenna. Note RTL8192EU dual antenna is
not supported.

Signed-off-by: Chris Chiu <chiu@endlessm.com>
Signed-off-by: Jes Sorensen <Jes.Sorensen@gmail.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>


# a9bb0b51 02-Oct-2019 Chris Chiu <chiu@endlessm.com>

rtl8xxxu: Improve TX performance of RTL8723BU on rtl8xxxu driver

We have 3 laptops which connect the wifi by the same RTL8723BU.
The PCI VID/PID of the wifi chip is 10EC:B720 which is supported.
They have the same problem with the in-kernel rtl8xxxu driver, the
iperf (as a client to an ethernet-connected server) gets ~1Mbps.
Nevertheless, the signal strength is reported as around -40dBm,
which is quite good. From the wireshark capture, the tx rate for each
data and qos data packet is only 1Mbps. Compare to the Realtek driver
at https://github.com/lwfinger/rtl8723bu, the same iperf test gets
~12Mbps or better. The signal strength is reported similarly around
-40dBm. That's why we want to improve.

After reading the source code of the rtl8xxxu driver and Realtek's, the
major difference is that Realtek's driver has a watchdog which will keep
monitoring the signal quality and updating the rate mask just like the
rtl8xxxu_gen2_update_rate_mask() does if signal quality changes.
And this kind of watchdog also exists in rtlwifi driver of some specific
chips, ex rtl8192ee, rtl8188ee, rtl8723ae, rtl8821ae...etc. They have
the same member function named dm_watchdog and will invoke the
corresponding dm_refresh_rate_adaptive_mask to adjust the tx rate
mask.

With this commit, the tx rate of each data and qos data packet will
be 39Mbps (MCS4) with the 0xF00000 as the tx rate mask. The 20th bit
to 23th bit means MCS4 to MCS7. It means that the firmware still picks
the lowest rate from the rate mask and explains why the tx rate of
data and qos data is always lowest 1Mbps because the default rate mask
passed is always 0xFFFFFFF ranges from the basic CCK rate, OFDM rate,
and MCS rate. However, with Realtek's driver, the tx rate observed from
wireshark under the same condition is almost 65Mbps or 72Mbps, which
indicating that rtl8xxxu could still be further improved.

Signed-off-by: Chris Chiu <chiu@endlessm.com>
Reviewed-by: Daniel Drake <drake@endlessm.com>
Acked-by: Jes Sorensen <Jes.Sorensen@gmail.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>


# 5b497af4 29-May-2019 Thomas Gleixner <tglx@linutronix.de>

treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 295

Based on 1 normalized pattern(s):

this program is free software you can redistribute it and or modify
it under the terms of version 2 of the gnu general public license as
published by the free software foundation this program is
distributed in the hope that it will be useful but without any
warranty without even the implied warranty of merchantability or
fitness for a particular purpose see the gnu general public license
for more details

extracted by the scancode license scanner the SPDX license identifier

GPL-2.0-only

has been chosen to replace the boilerplate/reference in 64 file(s).

Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Reviewed-by: Alexios Zavras <alexios.zavras@intel.com>
Reviewed-by: Allison Randal <allison@lohutok.net>
Cc: linux-spdx@vger.kernel.org
Link: https://lkml.kernel.org/r/20190529141901.894819585@linutronix.de
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>


# 8054a275 17-Jan-2018 Luis de Bethencourt <luisbg@kernel.org>

rtl8xxxu: Fix trailing semicolon

The trailing semicolon is an empty statement that does no operation.
Removing it since it doesn't do anything.

Signed-off-by: Luis de Bethencourt <luisbg@kernel.org>
Acked-by: Jes Sorensen <Jes.Sorensen@gmail.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>


# 1ee83789 17-Jan-2017 Jes Sorensen <Jes.Sorensen@redhat.com>

rtl8xxxu: Update author/maintainer contact info

Update copyright year and email address.

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


# b4c3d9cf 18-Nov-2016 Jes Sorensen <Jes.Sorensen@redhat.com>

rtl8xxxu: Pass tx_info to fill_txdesc in order to have access to retry count

In order to obtain retry count for a given rate we need to pass the
full struct ieee80211_tx_info to the function setting the rate in he
TX descriptor.

This uncovered a huge bug where the old code would use struct
ieee80211_rate.flags to test for rate parameters, which is always
zero, instead of the flags value from struct ieee80211_tx_rate.

Time to find a brown paper bag :(

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


# a748a110 18-Nov-2016 Jes Sorensen <Jes.Sorensen@redhat.com>

rtl8xxxu: Obtain RTS rates from mac80211

Use the mac80211 provided rate for RTS rather than the hard coded
24Mbps as suggested by the vendor drivers.

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>


# cf7cfef0 18-Nov-2016 Jes Sorensen <Jes.Sorensen@redhat.com>

rtl8xxxu: Fix big-endian problem reporting mactime

The full RX descriptor is converted so converting tsfl again would
return it to it's original endian value.

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


# 8a55698f 29-Sep-2016 Jes Sorensen <Jes.Sorensen@redhat.com>

rtl8xxxu: Fix big-endian problem reporting mactime

The full RX descriptor is converted so converting tsfl again would
return it to it's original endian value.

Signed-off-by: Jes Sorensen <Jes.Sorensen@redhat.com>
Cc: stable@vger.kernel.org # 4.8+
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>


# b42fbed6 20-Sep-2016 Larry Finger <Larry.Finger@lwfinger.net>

rtl8xxxu: Stop log spam from each successful interrupt

As soon as debugging is turned on, the logs are filled with messages
reporting the interrupt status. As this quantity is usually zero, this
output is not needed. In fact, there will be a report if the status is
not zero, thus the debug line in question could probably be deleted.
Rather than taking that action, I have changed it to only be printed
when the newly added RTL8XXXU_DEBUG_INTERRUPT bit is set in the debug
mask.

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


# c0a99bbb 20-Sep-2016 Jes Sorensen <Jes.Sorensen@redhat.com>

rtl8xxxu: Clean up llt_init() API

Remove last_tx_page argument from the llt_init() function. The
rtl8xxxu_fileops structure contains the correct TX_TOTAL_PAGE_NUM
value for the device, and rtl8xxxu_auto_llt_table() doesn't need to
know the value in the first place.

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


# b59415c2 19-Aug-2016 Jes Sorensen <Jes.Sorensen@redhat.com>

rtl8xxxu: Split filling of TX descriptors into separate functions

Split the filling of TX descriptors into a generic portion used on all
devices, and format specific helper functions provided in the fops
structure.

This also cleaned up some mess, even if non harmful, in the handling
of txdesc40 descriptors, where the code randomly would switch between
the pointer to tx_desc and tx_desc40.

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


# eed145ab 19-Aug-2016 Jes Sorensen <Jes.Sorensen@redhat.com>

rtl8xxxu: Introduce fops bitflag indicating type of thermal meter

Do not rely on TX descriptor size to determine the thermal meter
type.

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


# ee675cc3 19-Aug-2016 Jes Sorensen <Jes.Sorensen@redhat.com>

rtl8xxxu: Convert flags in rtl8xxxu_fileops to bitflags

This leaves space for a few more flags within the same space.

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


# e3ebcd74 19-Aug-2016 Jes Sorensen <Jes.Sorensen@redhat.com>

rtl8xxxu: Use flag to indicate whether device has TX report timer support

Use a fileops flag to indicate whether the device has TX report timer
support. This will make it easier to include future devices such as
8188eu to use the TX report timer.

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


# 44abaa08 19-Aug-2016 Jes Sorensen <Jes.Sorensen@redhat.com>

rtl8xxxu: Add TX page defines for 8723b

This switches the 8723b driver to use the new
rtl8xxxu_init_queue_reserved_page() function.

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


# 91dcbb71 26-Jun-2016 Jes Sorensen <Jes.Sorensen@redhat.com>

rtl8xxxu: Enable aggregation for rtl8723au

Implement rtl8xxxu_gen1_init_aggregation(). Aggregation should be the
same for all gen1 parts. We may want to allow for tuning parameters in
the fileopes struct. For now this is based allocating 16KB RX buffers,
leaving 16000 bytes for actual packets, and the rest for the skb
overhead.

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


# 04319ae2 26-Jun-2016 Jes Sorensen <Jes.Sorensen@redhat.com>

rtl8xxxu: Allocate larger RX skbs when aggregation is enabled

This adds support for allocating larger skbs for devices which
indicate they support it.

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


# 41892729 26-Jun-2016 Jes Sorensen <Jes.Sorensen@redhat.com>

rtl8xxxu: Correct rxdesc16 definition

This corrects the definition of rxdesc16 to correctly specify pkt_cnt
for aggregated packets. This is based on the code of the vendor
rtl8723au driver, as opposed to the struct definitions they use.

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


# 2db125d4 26-Jun-2016 Jes Sorensen <Jes.Sorensen@redhat.com>

rtl8xxxu: Obtain ieee80211_rx_status within parse_rx_desc()

When handling aggregated packets, we'll get a new ieee80211_rx_status
for each cloned skb, so passing in the pointer from the outside
doesn't make sense.

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


# e1ca790c 28-Apr-2016 Jes Sorensen <Jes.Sorensen@redhat.com>

rtl8xxxu: Remove the now obsolete mbox_ext_reg info from rtl8xxxu_fileops

With two different h2c_cmd() functions, mbox_ext_reg and
mbox_ext_width are no longer needed.

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


# 27c7e89e 28-Apr-2016 Jes Sorensen <Jes.Sorensen@redhat.com>

rtl8xxxu: rtl8xxxu_prepare_calibrate() is never used on gen1

Rename it to rtl8xxxu_gen2_prepare_calibrate() and remove the calls to
it from rtl8xxxu_gen1_phy_iq_calibrate()

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


# 9c0343d4 28-Apr-2016 Jes Sorensen <Jes.Sorensen@redhat.com>

rtl8xxxu: Split rtl8723a_h2c_cmd() into a gen1 and a gen2 version

The H2C API is completely different between gen1 and gen2 parts, so
there is little point trying to treat this as a generic function. All
calls to *_h2c_cmd() will always come from a gen1 or a gen2 specific
function.

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


# 993dd9b4 28-Apr-2016 Jes Sorensen <Jes.Sorensen@redhat.com>

rtl8xxxu: Rename rtl8723a_disabled_to_emu() to rtl8xxxu_disabled_to_emu()

This function is generic to most of the chips, so change the name to
reflect this.

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


# 181725dd 28-Apr-2016 Jes Sorensen <Jes.Sorensen@redhat.com>

rtl8xxxu: move rtl8188[cr] and rtl8192c related code into rtl8xxxu_8192c.c

This moves the code for rtl8188c, rtl8188r, and rtl8192c into it's own
file. This is purely a code moving exercise, there is no change to the
code itself.

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


# 20e3b2e9 28-Apr-2016 Jes Sorensen <Jes.Sorensen@redhat.com>

rtl8xxxu: move rtl8723a related code into rtl8xxxu_8723a.c

This moves the rtl8723a code into it's own file. This is purely a code
moving exercise, no code changes.

This device specific file is a lot smaller since the gen1 chips
(8723a, 8188c, 8188r, 8192c) share a lot more common code than the
gen2 chips.

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


# 6c46ca3b 28-Apr-2016 Jes Sorensen <Jes.Sorensen@redhat.com>

rtl8xxxu: move rtl8723b related code into rtl8xxxu_8723b.c

This moves the rtl8723b code into it's own file. This is purely a code
moving exercise, no functional changes. This did expose
rtl723a_h2c_cmd() as a function that should be refactored into a gen1
and a gen2 version.

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


# 599119f6 28-Apr-2016 Jes Sorensen <Jes.Sorensen@redhat.com>

rtl8xxxu: move rtl8192e related code into rtl8xxxu_8192e.c

This moves the rtl8192e code into it's own file. This is purely a code
moving exercise, no code changes.

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


# cabb550e 14-Apr-2016 Jes Sorensen <Jes.Sorensen@redhat.com>

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>


# 2fc0b8e5 14-Apr-2016 Jes Sorensen <Jes.Sorensen@redhat.com>

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>


# eb188062 14-Apr-2016 Jes Sorensen <Jes.Sorensen@redhat.com>

rtl8xxxu: Update copyright statement to include 2016

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


# 4062b8ff 14-Apr-2016 Jes Sorensen <Jes.Sorensen@redhat.com>

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>


# 747bf237 14-Apr-2016 Jes Sorensen <Jes.Sorensen@redhat.com>

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>


# 9b323ee9 14-Apr-2016 Jes Sorensen <Jes.Sorensen@redhat.com>

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>


# a7737206 14-Apr-2016 Jes Sorensen <Jes.Sorensen@redhat.com>

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>


# 24e8e7ec 14-Apr-2016 Jes Sorensen <Jes.Sorensen@redhat.com>

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>


# cb877250 14-Apr-2016 Jes Sorensen <Jes.Sorensen@redhat.com>

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>


# a49c7ce1 14-Apr-2016 Jes Sorensen <Jes.Sorensen@redhat.com>

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>


# 89c2a097 14-Apr-2016 Jes Sorensen <Jes.Sorensen@redhat.com>

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>


# 9e24772a 07-Apr-2016 Jes Sorensen <Jes.Sorensen@redhat.com>

rtl8xxxu: Correctly parse 8192eu efuse

The 8192eu efuse only has power data for path A and B. It follows the
same layout as 8723bu.

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


# 80805aa5 07-Apr-2016 Jes Sorensen <Jes.Sorensen@redhat.com>

rtl8xxxu: Set TX page boundaries for 8192eu

The 8192eu also has it's own TRXFF boundary value to set.

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


# c606e662 07-Apr-2016 Jes Sorensen <Jes.Sorensen@redhat.com>

rtl8xxxu: Add MAC init table for 8192eu

The 8192eu requires a different MAC init table. Add the missing table
and specify the table to use in the fileops structure.

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


# ba17d824 31-Mar-2016 Jes Sorensen <Jes.Sorensen@redhat.com>

rtl8xxxu: Use enums for chip version numbers

With support for more chips being added, use an enum to specify the
chip version.

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


# 1df1de34 31-Mar-2016 Jes Sorensen <Jes.Sorensen@redhat.com>

rtl8xxxu: TXDESC_SHORT_GI is txdesc32 only

This is no short GI bit in the txdesc40 format.

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


# 169bc5cb 31-Mar-2016 Jes Sorensen <Jes.Sorensen@redhat.com>

rtl8xxxu: Correct txdesc40 gid definition

txdesc40 dword2 gid is a 6 bit field, not a single bit

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


# 33f37249 31-Mar-2016 Jes Sorensen <Jes.Sorensen@redhat.com>

rtl8xxxu: Rename TX descriptor bits to map them to 32/40 byte descriptors

With the size based naming of TX descriptors. Change the bit
definition namings to indicate which descriptor format they match,
rather than having a device name in the bit name.

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


# dbb2896b 31-Mar-2016 Jes Sorensen <Jes.Sorensen@redhat.com>

rtl8xxxu: Change name of struct tx_desc to be more decriptive

There are two major types of TX descriptor formats for the RTL parts,
the old 32 byte descriptor, and the newer 40 byte descriptor used by
the 8723bu, 8192eu, and 88xx series.

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


# 7d4ccb8b 29-Feb-2016 Jes Sorensen <Jes.Sorensen@redhat.com>

rtl8xxxu: Use correct 8051 reset function for 8723b parts

8723b needs more action, so implement support for device specific
reset functions.

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


# fe37d5f6 29-Feb-2016 Jes Sorensen <Jes.Sorensen@redhat.com>

rtl8xxxu: Implement device specific power_off function

Implment 8723bu specific device power down, and make power_off() a
fileops function.

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


# fc89a41f 29-Feb-2016 Jes Sorensen <Jes.Sorensen@redhat.com>

rtl8xxxu: Implement 8723bu specific disable_rf() function

Powering up the 8723bu RF should probably be matched by the ability to
power it down again.

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


# 0290e7d0 29-Feb-2016 Jes Sorensen <Jes.Sorensen@redhat.com>

rtl8xxxu: convert rtl8723bu_init_bt() into rtl8723b_enable_rf()

rtl8723bu_init_bt() is effectively the function enabling RF, so name
it appropriately.

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


# 55a18dd1 29-Feb-2016 Jes Sorensen <Jes.Sorensen@redhat.com>

rtl8xxxu: Process C2H RA_REPORT events for 8723bu

Handle RA_REPORTS events for 8723bu to not have them show up as
unhandled.

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


# 7d794eaa 29-Feb-2016 Jes Sorensen <Jes.Sorensen@redhat.com>

rtl8xxxu: Report media status using the correct H2C command for 8723bu

Implement support for nextgen devices reporting connectition to the
firmware.

The H2C API for reporting connection to the firmware is different
between the two device generations. Use the fileops structure to
determine which one to call.

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


# f653e690 29-Feb-2016 Jes Sorensen <Jes.Sorensen@redhat.com>

rtl8xxxu: Implement basic 8723b specific update_rate_mask() function

Support for setting bandwidth and VHT parameters is still missing

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


# 80b30b2a 29-Feb-2016 Jes Sorensen <Jes.Sorensen@redhat.com>

rtl8xxxu: Define 8723b H2C ramask command structure

Define H2C command structure for setting the rate mask.

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


# 4c683607 29-Feb-2016 Jes Sorensen <Jes.Sorensen@redhat.com>

rtl8xxxu: Improve handling of txdesc32 vs txdesc40 handling

Further correct the handling of 40 byte TX descriptors.

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


# 2c6670b2 29-Feb-2016 Jes Sorensen <Jes.Sorensen@redhat.com>

rtl8xxxu: TX RTS rate is word 4 for 8723a

Correct the setting of TX RTS for 8723a generation chips. In addition
update documentation to match that this is part of data word 4, note
data word 5.

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


# 2098bfb5 29-Feb-2016 Jes Sorensen <Jes.Sorensen@redhat.com>

rtl8723au: Update TX descriptor words 4 and 5 definitions

TX data words 4 and 5 differ significantly between 32 byte and 40 byte
descriptors.

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


# cc2646d4 29-Feb-2016 Jes Sorensen <Jes.Sorensen@redhat.com>

rtl8xxxu: Set sequence number correctly for 40 byte TX descriptors

SEQ changed location in the 40 byte TX descriptor. Set it correctly.

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


# ce2d1dbb 29-Feb-2016 Jes Sorensen <Jes.Sorensen@redhat.com>

rtl8xxxu: Add more 40 byte TX desc bit definitions

Add additional bit definitions for 40 byte TX descriptors, and rename
bits for 32 byte descriptors that are located differently in the 40
byte descriptor format.

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


# 0249258d 29-Feb-2016 Jes Sorensen <Jes.Sorensen@redhat.com>

rtl8xxxu: Add additional tx descriptor bits for data word 0

This adds documentation for some additional bits in TX descriptor word
0.

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


# 179e1742 29-Feb-2016 Jes Sorensen <Jes.Sorensen@redhat.com>

rtl8xxxu: Handle 40 byte TX descriptors for rtl8723bu

Note the descriptor checksum is still only calculated over the initial
32 bytes of the descriptor, ignoring the last 8 bytes of the
descriptor.

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


# 80491a1f 29-Feb-2016 Jes Sorensen <Jes.Sorensen@redhat.com>

rtl8xxxu: Add definition for 8723bu tx descriptor

Newer generation chips use a 40 byte TX descriptor, compared to the
32 byte descriptor used on older chips.

This adds the definition for the 40 byte descriptor.

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


# 3be26999 29-Feb-2016 Jes Sorensen <Jes.Sorensen@redhat.com>

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>


# 21db9973 29-Feb-2016 Jes Sorensen <Jes.Sorensen@redhat.com>

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>


# e796dab4 29-Feb-2016 Jes Sorensen <Jes.Sorensen@redhat.com>

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>


# 4a0d7db5 29-Feb-2016 Jes Sorensen <Jes.Sorensen@redhat.com>

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>


# db08de94 29-Feb-2016 Jes Sorensen <Jes.Sorensen@redhat.com>

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>


# 9c79bf95 29-Feb-2016 Jes Sorensen <Jes.Sorensen@redhat.com>

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>


# 3e88ca44 29-Feb-2016 Jes Sorensen <Jes.Sorensen@redhat.com>

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>


# 4ef22eb9 29-Feb-2016 Jes Sorensen <Jes.Sorensen@redhat.com>

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>


# 6b9eae01 29-Feb-2016 Jes Sorensen <Jes.Sorensen@redhat.com>

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>


# 394f1bd3 29-Feb-2016 Jes Sorensen <Jes.Sorensen@redhat.com>

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>


# b2b43b78 29-Feb-2016 Jes Sorensen <Jes.Sorensen@redhat.com>

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>


# b18cdfdb 29-Feb-2016 Jes Sorensen <Jes.Sorensen@redhat.com>

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>


# a6c80d21 29-Feb-2016 Jes Sorensen <Jes.Sorensen@redhat.com>

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>


# 7297f49c 29-Feb-2016 Jes Sorensen <Jes.Sorensen@redhat.com>

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>


# 3ca7b32c 29-Feb-2016 Jes Sorensen <Jes.Sorensen@redhat.com>

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>


# f37e9228 29-Feb-2016 Jes Sorensen <Jes.Sorensen@redhat.com>

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>


# c3f9506f 29-Feb-2016 Jes Sorensen <Jes.Sorensen@redhat.com>

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>


# e6f9a9c3 29-Feb-2016 Jakub Sitnicki <jsitnicki@gmail.com>

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>


# 60c76cba 29-Feb-2016 Jes Sorensen <Jes.Sorensen@redhat.com>

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>


# 0d698dec 29-Feb-2016 Jes Sorensen <Jes.Sorensen@redhat.com>

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>


# e1547c53 29-Feb-2016 Jes Sorensen <Jes.Sorensen@redhat.com>

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>


# 8634af5e 29-Feb-2016 Jes Sorensen <Jes.Sorensen@redhat.com>

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>


# c7a5a190 29-Feb-2016 Jes Sorensen <Jes.Sorensen@redhat.com>

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>


# 8da91571 29-Feb-2016 Jes Sorensen <Jes.Sorensen@redhat.com>

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>


# d940c247 29-Feb-2016 Jes Sorensen <Jes.Sorensen@redhat.com>

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>


# ed35d094 29-Feb-2016 Jes Sorensen <Jes.Sorensen@redhat.com>

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>


# f0d9f5e9 29-Feb-2016 Jes Sorensen <Jes.Sorensen@redhat.com>

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>


# 22a31d45 29-Feb-2016 Jes Sorensen <Jes.Sorensen@redhat.com>

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>


# 0e28b975 29-Feb-2016 Jes Sorensen <Jes.Sorensen@redhat.com>

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>


# 3c836d60 29-Feb-2016 Jes Sorensen <Jes.Sorensen@redhat.com>

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>


# 35a741fe 29-Feb-2016 Jes Sorensen <Jes.Sorensen@redhat.com>

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>


# 74b99bed 29-Feb-2016 Jes Sorensen <Jes.Sorensen@redhat.com>

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>


# 0e5d435a 29-Feb-2016 Jes Sorensen <Jes.Sorensen@redhat.com>

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>


# 3307d840 29-Feb-2016 Jes Sorensen <Jes.Sorensen@redhat.com>

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>


# 38451998 03-Feb-2016 Jakub Sitnicki <jsitnicki@gmail.com>

rtl8xxxu: Use REG_EFUSE_TEST register only on multifunctional devices

rtl8192cu driver doesn't read/write the REG_EFUSE_TEST register.
Neither does the rtl8188eu driver. Do it only for multifunc devices
RTL8723AU/RTL8723BU.

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>


# e5c447cc 03-Feb-2016 Jes Sorensen <Jes.Sorensen@redhat.com>

rtl8xxxu: Remove unused clutter for handling recursive calls to rtl8xxxu_init_device()

This was a leftover from the vendor driver that was never utilized.

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


# 26f1fad2 14-Oct-2015 Jes Sorensen <Jes.Sorensen@redhat.com>

New driver: rtl8xxxu (mac80211)

This is an alternate driver for a number of Realtek WiFi USB devices,
including RTL8723AU, RTL8188CU, RTL8188RU, RTL8191CU, and RTL8192CU.
It was written from scratch utilizing the Linux mac80211 stack.

After spending months cleaning up the vendor provided rtl8723au
driver, which comes with it's own 802.11 stack included, I decided to
rewrite this driver from the bottom up.

Many thanks to Johannes Berg for 802.11 insights and help and Larry
Finger for help with the vendor driver.

The full git log for the development of this driver can be found here:
git git://git.kernel.org/pub/scm/linux/kernel/git/jes/linux.git
branch rtl8723au-mac80211

This driver is still under development, but has proven to be very
stable for me. It currently supports station mode only. It has support
for OFDM and CCK rates. It does lack certain features found in the
staging driver, such as power management, AMPDU, and 40MHz channel
support. In addition it does not support AD-HOC, AP, and monitor mode
support at this point.

The driver is known to work with the following devices:
Lenovo Yoga (rtl8723au)
TP-Link TL-WN823N (rtl8192cu)
Etekcity 6R (rtl8188cu)
Daffodil LAN03 (rtl8188cu)
Alfa AWUS036NHR (rtl8188ru)

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