cc52a797ac0e692a2746a3f020eb344454634ce7
[oweals/openwrt.git] /
1 From 0ec9eb90feec4933637fbde9d5bfbc3b62aea218 Mon Sep 17 00:00:00 2001
2 From: Chi-Hsien Lin <chi-hsien.lin@cypress.com>
3 Date: Thu, 3 Aug 2017 17:37:58 +0800
4 Subject: [PATCH] brcmfmac: Add support for CYW4373 SDIO/USB chipset
5
6 Add support for CYW4373 SDIO/USB chipset.
7 CYW4373 is a 1x1 dual-band 11ac chipset with 20/40/80Mhz channel support.
8 It's a WiFi/BT combo device.
9
10 Signed-off-by: Chi-Hsien Lin <chi-hsien.lin@cypress.com>
11 Reviewed-by: Arend van Spriel <arend.vanspriel@broadcom.com>
12 Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
13 ---
14  drivers/net/wireless/broadcom/brcm80211/brcmfmac/bcmsdh.c     | 1 +
15  drivers/net/wireless/broadcom/brcm80211/brcmfmac/chip.c       | 2 ++
16  drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c       | 4 +++-
17  drivers/net/wireless/broadcom/brcm80211/brcmfmac/usb.c        | 9 ++++++++-
18  drivers/net/wireless/broadcom/brcm80211/include/brcm_hw_ids.h | 3 +++
19  include/linux/mmc/sdio_ids.h                                  | 1 +
20  6 files changed, 18 insertions(+), 2 deletions(-)
21
22 --- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/bcmsdh.c
23 +++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/bcmsdh.c
24 @@ -1104,6 +1104,7 @@ static const struct sdio_device_id brcmf
25         BRCMF_SDIO_DEVICE(SDIO_DEVICE_ID_BROADCOM_43455),
26         BRCMF_SDIO_DEVICE(SDIO_DEVICE_ID_BROADCOM_4354),
27         BRCMF_SDIO_DEVICE(SDIO_DEVICE_ID_BROADCOM_4356),
28 +       BRCMF_SDIO_DEVICE(SDIO_DEVICE_ID_CYPRESS_4373),
29         { /* end: all zeroes */ }
30  };
31  MODULE_DEVICE_TABLE(sdio, brcmf_sdmmc_ids);
32 --- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/chip.c
33 +++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/chip.c
34 @@ -690,6 +690,8 @@ static u32 brcmf_chip_tcm_rambase(struct
35         case BRCM_CC_4365_CHIP_ID:
36         case BRCM_CC_4366_CHIP_ID:
37                 return 0x200000;
38 +       case CY_CC_4373_CHIP_ID:
39 +               return 0x160000;
40         default:
41                 brcmf_err("unknown chip: %s\n", ci->pub.name);
42                 break;
43 --- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c
44 +++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c
45 @@ -617,6 +617,7 @@ BRCMF_FW_NVRAM_DEF(43430A1, "brcmfmac434
46  BRCMF_FW_NVRAM_DEF(43455, "brcmfmac43455-sdio.bin", "brcmfmac43455-sdio.txt");
47  BRCMF_FW_NVRAM_DEF(4354, "brcmfmac4354-sdio.bin", "brcmfmac4354-sdio.txt");
48  BRCMF_FW_NVRAM_DEF(4356, "brcmfmac4356-sdio.bin", "brcmfmac4356-sdio.txt");
49 +BRCMF_FW_NVRAM_DEF(4373, "brcmfmac4373-sdio.bin", "brcmfmac4373-sdio.txt");
50  
51  static struct brcmf_firmware_mapping brcmf_sdio_fwnames[] = {
52         BRCMF_FW_NVRAM_ENTRY(BRCM_CC_43143_CHIP_ID, 0xFFFFFFFF, 43143),
53 @@ -635,7 +636,8 @@ static struct brcmf_firmware_mapping brc
54         BRCMF_FW_NVRAM_ENTRY(BRCM_CC_43430_CHIP_ID, 0xFFFFFFFE, 43430A1),
55         BRCMF_FW_NVRAM_ENTRY(BRCM_CC_4345_CHIP_ID, 0xFFFFFFC0, 43455),
56         BRCMF_FW_NVRAM_ENTRY(BRCM_CC_4354_CHIP_ID, 0xFFFFFFFF, 4354),
57 -       BRCMF_FW_NVRAM_ENTRY(BRCM_CC_4356_CHIP_ID, 0xFFFFFFFF, 4356)
58 +       BRCMF_FW_NVRAM_ENTRY(BRCM_CC_4356_CHIP_ID, 0xFFFFFFFF, 4356),
59 +       BRCMF_FW_NVRAM_ENTRY(CY_CC_4373_CHIP_ID, 0xFFFFFFFF, 4373)
60  };
61  
62  static void pkt_align(struct sk_buff *p, int len, int align)
63 --- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/usb.c
64 +++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/usb.c
65 @@ -49,6 +49,7 @@ BRCMF_FW_DEF(43143, "brcmfmac43143.bin")
66  BRCMF_FW_DEF(43236B, "brcmfmac43236b.bin");
67  BRCMF_FW_DEF(43242A, "brcmfmac43242a.bin");
68  BRCMF_FW_DEF(43569, "brcmfmac43569.bin");
69 +BRCMF_FW_DEF(4373, "brcmfmac4373.bin");
70  
71  static struct brcmf_firmware_mapping brcmf_usb_fwnames[] = {
72         BRCMF_FW_ENTRY(BRCM_CC_43143_CHIP_ID, 0xFFFFFFFF, 43143),
73 @@ -57,7 +58,8 @@ static struct brcmf_firmware_mapping brc
74         BRCMF_FW_ENTRY(BRCM_CC_43238_CHIP_ID, 0x00000008, 43236B),
75         BRCMF_FW_ENTRY(BRCM_CC_43242_CHIP_ID, 0xFFFFFFFF, 43242A),
76         BRCMF_FW_ENTRY(BRCM_CC_43566_CHIP_ID, 0xFFFFFFFF, 43569),
77 -       BRCMF_FW_ENTRY(BRCM_CC_43569_CHIP_ID, 0xFFFFFFFF, 43569)
78 +       BRCMF_FW_ENTRY(BRCM_CC_43569_CHIP_ID, 0xFFFFFFFF, 43569),
79 +       BRCMF_FW_ENTRY(CY_CC_4373_CHIP_ID, 0xFFFFFFFF, 4373)
80  };
81  
82  #define TRX_MAGIC              0x30524448      /* "HDR0" */
83 @@ -1461,15 +1463,20 @@ static int brcmf_usb_reset_resume(struct
84  #define LINKSYS_USB_DEVICE(dev_id)     \
85         { USB_DEVICE(BRCM_USB_VENDOR_ID_LINKSYS, dev_id) }
86  
87 +#define CYPRESS_USB_DEVICE(dev_id)     \
88 +       { USB_DEVICE(CY_USB_VENDOR_ID_CYPRESS, dev_id) }
89 +
90  static struct usb_device_id brcmf_usb_devid_table[] = {
91         BRCMF_USB_DEVICE(BRCM_USB_43143_DEVICE_ID),
92         BRCMF_USB_DEVICE(BRCM_USB_43236_DEVICE_ID),
93         BRCMF_USB_DEVICE(BRCM_USB_43242_DEVICE_ID),
94         BRCMF_USB_DEVICE(BRCM_USB_43569_DEVICE_ID),
95         LINKSYS_USB_DEVICE(BRCM_USB_43235_LINKSYS_DEVICE_ID),
96 +       CYPRESS_USB_DEVICE(CY_USB_4373_DEVICE_ID),
97         { USB_DEVICE(BRCM_USB_VENDOR_ID_LG, BRCM_USB_43242_LG_DEVICE_ID) },
98         /* special entry for device with firmware loaded and running */
99         BRCMF_USB_DEVICE(BRCM_USB_BCMFW_DEVICE_ID),
100 +       CYPRESS_USB_DEVICE(BRCM_USB_BCMFW_DEVICE_ID),
101         { /* end: all zeroes */ }
102  };
103  
104 --- a/drivers/net/wireless/broadcom/brcm80211/include/brcm_hw_ids.h
105 +++ b/drivers/net/wireless/broadcom/brcm80211/include/brcm_hw_ids.h
106 @@ -23,6 +23,7 @@
107  #define BRCM_USB_VENDOR_ID_BROADCOM    0x0a5c
108  #define BRCM_USB_VENDOR_ID_LG          0x043e
109  #define BRCM_USB_VENDOR_ID_LINKSYS     0x13b1
110 +#define CY_USB_VENDOR_ID_CYPRESS       0x04b4
111  #define BRCM_PCIE_VENDOR_ID_BROADCOM   PCI_VENDOR_ID_BROADCOM
112  
113  /* Chipcommon Core Chip IDs */
114 @@ -57,6 +58,7 @@
115  #define BRCM_CC_4365_CHIP_ID           0x4365
116  #define BRCM_CC_4366_CHIP_ID           0x4366
117  #define BRCM_CC_4371_CHIP_ID           0x4371
118 +#define CY_CC_4373_CHIP_ID             0x4373
119  
120  /* USB Device IDs */
121  #define BRCM_USB_43143_DEVICE_ID       0xbd1e
122 @@ -66,6 +68,7 @@
123  #define BRCM_USB_43242_LG_DEVICE_ID    0x3101
124  #define BRCM_USB_43569_DEVICE_ID       0xbd27
125  #define BRCM_USB_BCMFW_DEVICE_ID       0x0bdc
126 +#define CY_USB_4373_DEVICE_ID          0xbd29
127  
128  /* PCIE Device IDs */
129  #define BRCM_PCIE_4350_DEVICE_ID       0x43a3
130 --- a/include/linux/mmc/sdio_ids.h
131 +++ b/include/linux/mmc/sdio_ids.h
132 @@ -39,6 +39,7 @@
133  #define SDIO_DEVICE_ID_BROADCOM_43455          0xa9bf
134  #define SDIO_DEVICE_ID_BROADCOM_4354           0x4354
135  #define SDIO_DEVICE_ID_BROADCOM_4356           0x4356
136 +#define SDIO_DEVICE_ID_CYPRESS_4373            0x4373
137  
138  #define SDIO_VENDOR_ID_INTEL                   0x0089
139  #define SDIO_DEVICE_ID_INTEL_IWMC3200WIMAX     0x1402