mt76: update to the latest version
[oweals/openwrt.git] / package / kernel / mac80211 / patches / 653-0002-rtl8xxxu-Add-initial-code-to-detect-8188eu-devices.patch
1 From 6f971392cd52524058f179d7c78464d692fbb018 Mon Sep 17 00:00:00 2001
2 From: Jes Sorensen <Jes.Sorensen@redhat.com>
3 Date: Mon, 27 Jun 2016 14:23:44 -0400
4 Subject: [PATCH] rtl8xxxu: Add initial code to detect 8188eu devices
5
6 So far this just detects the device and tries to load firmware.
7
8 Signed-off-by: Jes Sorensen <Jes.Sorensen@redhat.com>
9 ---
10  drivers/net/wireless/realtek/rtl8xxxu/Makefile     |  2 +-
11  drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu.h   |  1 +
12  .../net/wireless/realtek/rtl8xxxu/rtl8xxxu_8188e.c | 65 ++++++++++++++++++++++
13  .../net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c  |  3 +
14  4 files changed, 70 insertions(+), 1 deletion(-)
15  create mode 100644 drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_8188e.c
16
17 --- a/drivers/net/wireless/realtek/rtl8xxxu/Makefile
18 +++ b/drivers/net/wireless/realtek/rtl8xxxu/Makefile
19 @@ -1,4 +1,4 @@
20  obj-$(CPTCFG_RTL8XXXU) += rtl8xxxu.o
21  
22  rtl8xxxu-y     := rtl8xxxu_core.o rtl8xxxu_8192e.o rtl8xxxu_8723b.o \
23 -                  rtl8xxxu_8723a.o rtl8xxxu_8192c.o
24 +                  rtl8xxxu_8723a.o rtl8xxxu_8192c.o rtl8xxxu_8188e.o
25 --- a/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu.h
26 +++ b/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu.h
27 @@ -1446,6 +1446,7 @@ void rtl8xxxu_fill_txdesc_v2(struct ieee
28                              bool short_preamble, bool ampdu_enable,
29                              u32 rts_rate);
30  
31 +extern struct rtl8xxxu_fileops rtl8188eu_fops;
32  extern struct rtl8xxxu_fileops rtl8192cu_fops;
33  extern struct rtl8xxxu_fileops rtl8192eu_fops;
34  extern struct rtl8xxxu_fileops rtl8723au_fops;
35 --- /dev/null
36 +++ b/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_8188e.c
37 @@ -0,0 +1,65 @@
38 +/*
39 + * RTL8XXXU mac80211 USB driver - 8188e specific subdriver
40 + *
41 + * Copyright (c) 2014 - 2016 Jes Sorensen <Jes.Sorensen@redhat.com>
42 + *
43 + * Portions, notably calibration code:
44 + * Copyright(c) 2007 - 2011 Realtek Corporation. All rights reserved.
45 + *
46 + * This driver was written as a replacement for the vendor provided
47 + * rtl8723au driver. As the Realtek 8xxx chips are very similar in
48 + * their programming interface, I have started adding support for
49 + * additional 8xxx chips like the 8192cu, 8188cus, etc.
50 + *
51 + * This program is free software; you can redistribute it and/or modify it
52 + * under the terms of version 2 of the GNU General Public License as
53 + * published by the Free Software Foundation.
54 + *
55 + * This program is distributed in the hope that it will be useful, but WITHOUT
56 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
57 + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
58 + * more details.
59 + */
60 +
61 +#include <linux/init.h>
62 +#include <linux/kernel.h>
63 +#include <linux/sched.h>
64 +#include <linux/errno.h>
65 +#include <linux/slab.h>
66 +#include <linux/module.h>
67 +#include <linux/spinlock.h>
68 +#include <linux/list.h>
69 +#include <linux/usb.h>
70 +#include <linux/netdevice.h>
71 +#include <linux/etherdevice.h>
72 +#include <linux/ethtool.h>
73 +#include <linux/wireless.h>
74 +#include <linux/firmware.h>
75 +#include <linux/moduleparam.h>
76 +#include <net/mac80211.h>
77 +#include "rtl8xxxu.h"
78 +#include "rtl8xxxu_regs.h"
79 +
80 +static int rtl8188eu_parse_efuse(struct rtl8xxxu_priv *priv)
81 +{
82 +       return 0;
83 +}
84 +
85 +static int rtl8188eu_load_firmware(struct rtl8xxxu_priv *priv)
86 +{
87 +       char *fw_name;
88 +       int ret;
89 +
90 +       fw_name = "rtlwifi/rtl8188eufw.bin";
91 +
92 +       ret = rtl8xxxu_load_firmware(priv, fw_name);
93 +
94 +       return -EINVAL;
95 +       return ret;
96 +}
97 +
98 +struct rtl8xxxu_fileops rtl8188eu_fops = {
99 +       .parse_efuse = rtl8188eu_parse_efuse,
100 +       .load_firmware = rtl8188eu_load_firmware,
101 +       .reset_8051 = rtl8xxxu_reset_8051,
102 +};
103 --- a/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c
104 +++ b/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c
105 @@ -54,6 +54,7 @@ MODULE_LICENSE("GPL");
106  MODULE_FIRMWARE("rtlwifi/rtl8723aufw_A.bin");
107  MODULE_FIRMWARE("rtlwifi/rtl8723aufw_B.bin");
108  MODULE_FIRMWARE("rtlwifi/rtl8723aufw_B_NoBT.bin");
109 +MODULE_FIRMWARE("rtlwifi/rtl8188eufw.bin");
110  MODULE_FIRMWARE("rtlwifi/rtl8192cufw_A.bin");
111  MODULE_FIRMWARE("rtlwifi/rtl8192cufw_B.bin");
112  MODULE_FIRMWARE("rtlwifi/rtl8192cufw_TMSC.bin");
113 @@ -6212,6 +6213,8 @@ static const struct usb_device_id dev_ta
114  {USB_DEVICE_AND_INTERFACE_INFO(USB_VENDOR_ID_REALTEK, 0xb720, 0xff, 0xff, 0xff),
115         .driver_info = (unsigned long)&rtl8723bu_fops},
116  #ifdef CPTCFG_RTL8XXXU_UNTESTED
117 +{USB_DEVICE_AND_INTERFACE_INFO(USB_VENDOR_ID_REALTEK, 0x8179, 0xff, 0xff, 0xff),
118 +       .driver_info = (unsigned long)&rtl8188eu_fops},
119  /* Still supported by rtlwifi */
120  {USB_DEVICE_AND_INTERFACE_INFO(USB_VENDOR_ID_REALTEK, 0x8176, 0xff, 0xff, 0xff),
121         .driver_info = (unsigned long)&rtl8192cu_fops},