Skip to content

Commit 889711a

Browse files
committed
Merge tag 'wireless-drivers-next-for-davem-2017-02-01' of git://git.kernel.org/pub/scm/linux/kernel/git/kvalo/wireless-drivers-next
Kalle Valo says: ==================== wireless-drivers-next patches for 4.11 It's nice to see rt2x00 development has becoming active, for example adding support for a new chip version. Also wcn36xx has been converted to use the recently merged QCOM_SMD subsystem. Otherwise new features and fixes it lots of drivers. Major changes: iwlwifi * some more work in preparation for A000 family support * add support for radiotap timestamps * some work on our firmware debugging capabilities wcn36xx * convert to a proper QCOM_SMD driver (from the platform_driver interface) ath10k * VHT160 support * dump Copy Engine registers during firmware crash * search board file extension from SMBIOS wil6210 * add disable_ap_sme module parameter rt2x00 * support RT3352 with external PA * support for RT3352 with 20MHz crystal * add support for RT5350 WiSoC brcmfmac * add support for BCM43455 sdio device rtl8xxxu * add support for D-Link DWA-131 rev E1, TP-Link TL-WN822N v4 and others ==================== Signed-off-by: David S. Miller <davem@davemloft.net>
2 parents ff1176f + 7243a1a commit 889711a

File tree

156 files changed

+2847
-2526
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

156 files changed

+2847
-2526
lines changed

MAINTAINERS

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10607,7 +10607,7 @@ F: drivers/net/wireless/realtek/rtlwifi/
1060710607
F: drivers/net/wireless/realtek/rtlwifi/rtl8192ce/
1060810608

1060910609
RTL8XXXU WIRELESS DRIVER (rtl8xxxu)
10610-
M: Jes Sorensen <Jes.Sorensen@redhat.com>
10610+
M: Jes Sorensen <Jes.Sorensen@gmail.com>
1061110611
L: linux-wireless@vger.kernel.org
1061210612
T: git git://git.kernel.org/pub/scm/linux/kernel/git/jes/linux.git rtl8xxxu-devel
1061310613
S: Maintained

drivers/bcma/main.c

Lines changed: 15 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -136,17 +136,17 @@ static bool bcma_is_core_needed_early(u16 core_id)
136136
return false;
137137
}
138138

139-
static struct device_node *bcma_of_find_child_device(struct platform_device *parent,
139+
static struct device_node *bcma_of_find_child_device(struct device *parent,
140140
struct bcma_device *core)
141141
{
142142
struct device_node *node;
143143
u64 size;
144144
const __be32 *reg;
145145

146-
if (!parent || !parent->dev.of_node)
146+
if (!parent->of_node)
147147
return NULL;
148148

149-
for_each_child_of_node(parent->dev.of_node, node) {
149+
for_each_child_of_node(parent->of_node, node) {
150150
reg = of_get_address(node, 0, &size, NULL);
151151
if (!reg)
152152
continue;
@@ -156,7 +156,7 @@ static struct device_node *bcma_of_find_child_device(struct platform_device *par
156156
return NULL;
157157
}
158158

159-
static int bcma_of_irq_parse(struct platform_device *parent,
159+
static int bcma_of_irq_parse(struct device *parent,
160160
struct bcma_device *core,
161161
struct of_phandle_args *out_irq, int num)
162162
{
@@ -169,21 +169,21 @@ static int bcma_of_irq_parse(struct platform_device *parent,
169169
return rc;
170170
}
171171

172-
out_irq->np = parent->dev.of_node;
172+
out_irq->np = parent->of_node;
173173
out_irq->args_count = 1;
174174
out_irq->args[0] = num;
175175

176176
laddr[0] = cpu_to_be32(core->addr);
177177
return of_irq_parse_raw(laddr, out_irq);
178178
}
179179

180-
static unsigned int bcma_of_get_irq(struct platform_device *parent,
180+
static unsigned int bcma_of_get_irq(struct device *parent,
181181
struct bcma_device *core, int num)
182182
{
183183
struct of_phandle_args out_irq;
184184
int ret;
185185

186-
if (!IS_ENABLED(CONFIG_OF_IRQ) || !parent || !parent->dev.of_node)
186+
if (!IS_ENABLED(CONFIG_OF_IRQ) || !parent->of_node)
187187
return 0;
188188

189189
ret = bcma_of_irq_parse(parent, core, &out_irq, num);
@@ -196,7 +196,7 @@ static unsigned int bcma_of_get_irq(struct platform_device *parent,
196196
return irq_create_of_mapping(&out_irq);
197197
}
198198

199-
static void bcma_of_fill_device(struct platform_device *parent,
199+
static void bcma_of_fill_device(struct device *parent,
200200
struct bcma_device *core)
201201
{
202202
struct device_node *node;
@@ -227,7 +227,7 @@ unsigned int bcma_core_irq(struct bcma_device *core, int num)
227227
return mips_irq <= 4 ? mips_irq + 2 : 0;
228228
}
229229
if (bus->host_pdev)
230-
return bcma_of_get_irq(bus->host_pdev, core, num);
230+
return bcma_of_get_irq(&bus->host_pdev->dev, core, num);
231231
return 0;
232232
case BCMA_HOSTTYPE_SDIO:
233233
return 0;
@@ -253,7 +253,8 @@ void bcma_prepare_core(struct bcma_bus *bus, struct bcma_device *core)
253253
if (IS_ENABLED(CONFIG_OF) && bus->host_pdev) {
254254
core->dma_dev = &bus->host_pdev->dev;
255255
core->dev.parent = &bus->host_pdev->dev;
256-
bcma_of_fill_device(bus->host_pdev, core);
256+
if (core->dev.parent)
257+
bcma_of_fill_device(core->dev.parent, core);
257258
} else {
258259
core->dev.dma_mask = &core->dev.coherent_dma_mask;
259260
core->dma_dev = &core->dev;
@@ -633,8 +634,11 @@ static int bcma_device_probe(struct device *dev)
633634
drv);
634635
int err = 0;
635636

637+
get_device(dev);
636638
if (adrv->probe)
637639
err = adrv->probe(core);
640+
if (err)
641+
put_device(dev);
638642

639643
return err;
640644
}
@@ -647,6 +651,7 @@ static int bcma_device_remove(struct device *dev)
647651

648652
if (adrv->remove)
649653
adrv->remove(core);
654+
put_device(dev);
650655

651656
return 0;
652657
}

drivers/net/wireless/ath/ath10k/ce.c

Lines changed: 40 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -958,7 +958,7 @@ ath10k_ce_alloc_dest_ring(struct ath10k *ar, unsigned int ce_id,
958958
* coherent DMA are unsupported
959959
*/
960960
dest_ring->base_addr_owner_space_unaligned =
961-
dma_alloc_coherent(ar->dev,
961+
dma_zalloc_coherent(ar->dev,
962962
(nentries * sizeof(struct ce_desc) +
963963
CE_DESC_RING_ALIGN),
964964
&base_addr, GFP_KERNEL);
@@ -969,13 +969,6 @@ ath10k_ce_alloc_dest_ring(struct ath10k *ar, unsigned int ce_id,
969969

970970
dest_ring->base_addr_ce_space_unaligned = base_addr;
971971

972-
/*
973-
* Correctly initialize memory to 0 to prevent garbage
974-
* data crashing system when download firmware
975-
*/
976-
memset(dest_ring->base_addr_owner_space_unaligned, 0,
977-
nentries * sizeof(struct ce_desc) + CE_DESC_RING_ALIGN);
978-
979972
dest_ring->base_addr_owner_space = PTR_ALIGN(
980973
dest_ring->base_addr_owner_space_unaligned,
981974
CE_DESC_RING_ALIGN);
@@ -1130,3 +1123,42 @@ void ath10k_ce_free_pipe(struct ath10k *ar, int ce_id)
11301123
ce_state->src_ring = NULL;
11311124
ce_state->dest_ring = NULL;
11321125
}
1126+
1127+
void ath10k_ce_dump_registers(struct ath10k *ar,
1128+
struct ath10k_fw_crash_data *crash_data)
1129+
{
1130+
struct ath10k_pci *ar_pci = ath10k_pci_priv(ar);
1131+
struct ath10k_ce_crash_data ce;
1132+
u32 addr, id;
1133+
1134+
lockdep_assert_held(&ar->data_lock);
1135+
1136+
ath10k_err(ar, "Copy Engine register dump:\n");
1137+
1138+
spin_lock_bh(&ar_pci->ce_lock);
1139+
for (id = 0; id < CE_COUNT; id++) {
1140+
addr = ath10k_ce_base_address(ar, id);
1141+
ce.base_addr = cpu_to_le32(addr);
1142+
1143+
ce.src_wr_idx =
1144+
cpu_to_le32(ath10k_ce_src_ring_write_index_get(ar, addr));
1145+
ce.src_r_idx =
1146+
cpu_to_le32(ath10k_ce_src_ring_read_index_get(ar, addr));
1147+
ce.dst_wr_idx =
1148+
cpu_to_le32(ath10k_ce_dest_ring_write_index_get(ar, addr));
1149+
ce.dst_r_idx =
1150+
cpu_to_le32(ath10k_ce_dest_ring_read_index_get(ar, addr));
1151+
1152+
if (crash_data)
1153+
crash_data->ce_crash_data[id] = ce;
1154+
1155+
ath10k_err(ar, "[%02d]: 0x%08x %3u %3u %3u %3u", id,
1156+
le32_to_cpu(ce.base_addr),
1157+
le32_to_cpu(ce.src_wr_idx),
1158+
le32_to_cpu(ce.src_r_idx),
1159+
le32_to_cpu(ce.dst_wr_idx),
1160+
le32_to_cpu(ce.dst_r_idx));
1161+
}
1162+
1163+
spin_unlock_bh(&ar_pci->ce_lock);
1164+
}

drivers/net/wireless/ath/ath10k/ce.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,6 @@
2020

2121
#include "hif.h"
2222

23-
/* Maximum number of Copy Engine's supported */
24-
#define CE_COUNT_MAX 12
2523
#define CE_HTT_H2T_MSG_SRC_NENTRIES 8192
2624

2725
/* Descriptor rings must be aligned to this boundary */
@@ -228,6 +226,8 @@ void ath10k_ce_per_engine_service_any(struct ath10k *ar);
228226
void ath10k_ce_per_engine_service(struct ath10k *ar, unsigned int ce_id);
229227
int ath10k_ce_disable_interrupts(struct ath10k *ar);
230228
void ath10k_ce_enable_interrupts(struct ath10k *ar);
229+
void ath10k_ce_dump_registers(struct ath10k *ar,
230+
struct ath10k_fw_crash_data *crash_data);
231231

232232
/* ce_attr.flags values */
233233
/* Use NonSnooping PCIe accesses? */

drivers/net/wireless/ath/ath10k/core.c

Lines changed: 81 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,8 @@
1818
#include <linux/module.h>
1919
#include <linux/firmware.h>
2020
#include <linux/of.h>
21+
#include <linux/dmi.h>
22+
#include <linux/ctype.h>
2123
#include <asm/byteorder.h>
2224

2325
#include "core.h"
@@ -707,6 +709,72 @@ static int ath10k_core_get_board_id_from_otp(struct ath10k *ar)
707709
return 0;
708710
}
709711

712+
static void ath10k_core_check_bdfext(const struct dmi_header *hdr, void *data)
713+
{
714+
struct ath10k *ar = data;
715+
const char *bdf_ext;
716+
const char *magic = ATH10K_SMBIOS_BDF_EXT_MAGIC;
717+
u8 bdf_enabled;
718+
int i;
719+
720+
if (hdr->type != ATH10K_SMBIOS_BDF_EXT_TYPE)
721+
return;
722+
723+
if (hdr->length != ATH10K_SMBIOS_BDF_EXT_LENGTH) {
724+
ath10k_dbg(ar, ATH10K_DBG_BOOT,
725+
"wrong smbios bdf ext type length (%d).\n",
726+
hdr->length);
727+
return;
728+
}
729+
730+
bdf_enabled = *((u8 *)hdr + ATH10K_SMBIOS_BDF_EXT_OFFSET);
731+
if (!bdf_enabled) {
732+
ath10k_dbg(ar, ATH10K_DBG_BOOT, "bdf variant name not found.\n");
733+
return;
734+
}
735+
736+
/* Only one string exists (per spec) */
737+
bdf_ext = (char *)hdr + hdr->length;
738+
739+
if (memcmp(bdf_ext, magic, strlen(magic)) != 0) {
740+
ath10k_dbg(ar, ATH10K_DBG_BOOT,
741+
"bdf variant magic does not match.\n");
742+
return;
743+
}
744+
745+
for (i = 0; i < strlen(bdf_ext); i++) {
746+
if (!isascii(bdf_ext[i]) || !isprint(bdf_ext[i])) {
747+
ath10k_dbg(ar, ATH10K_DBG_BOOT,
748+
"bdf variant name contains non ascii chars.\n");
749+
return;
750+
}
751+
}
752+
753+
/* Copy extension name without magic suffix */
754+
if (strscpy(ar->id.bdf_ext, bdf_ext + strlen(magic),
755+
sizeof(ar->id.bdf_ext)) < 0) {
756+
ath10k_dbg(ar, ATH10K_DBG_BOOT,
757+
"bdf variant string is longer than the buffer can accommodate (variant: %s)\n",
758+
bdf_ext);
759+
return;
760+
}
761+
762+
ath10k_dbg(ar, ATH10K_DBG_BOOT,
763+
"found and validated bdf variant smbios_type 0x%x bdf %s\n",
764+
ATH10K_SMBIOS_BDF_EXT_TYPE, bdf_ext);
765+
}
766+
767+
static int ath10k_core_check_smbios(struct ath10k *ar)
768+
{
769+
ar->id.bdf_ext[0] = '\0';
770+
dmi_walk(ath10k_core_check_bdfext, ar);
771+
772+
if (ar->id.bdf_ext[0] == '\0')
773+
return -ENODATA;
774+
775+
return 0;
776+
}
777+
710778
static int ath10k_download_and_run_otp(struct ath10k *ar)
711779
{
712780
u32 result, address = ar->hw_params.patch_load_addr;
@@ -1053,6 +1121,9 @@ static int ath10k_core_fetch_board_data_api_n(struct ath10k *ar,
10531121
static int ath10k_core_create_board_name(struct ath10k *ar, char *name,
10541122
size_t name_len)
10551123
{
1124+
/* strlen(',variant=') + strlen(ar->id.bdf_ext) */
1125+
char variant[9 + ATH10K_SMBIOS_BDF_EXT_STR_LENGTH];
1126+
10561127
if (ar->id.bmi_ids_valid) {
10571128
scnprintf(name, name_len,
10581129
"bus=%s,bmi-chip-id=%d,bmi-board-id=%d",
@@ -1062,12 +1133,15 @@ static int ath10k_core_create_board_name(struct ath10k *ar, char *name,
10621133
goto out;
10631134
}
10641135

1136+
if (ar->id.bdf_ext[0] != '\0')
1137+
scnprintf(variant, sizeof(variant), ",variant=%s",
1138+
ar->id.bdf_ext);
1139+
10651140
scnprintf(name, name_len,
1066-
"bus=%s,vendor=%04x,device=%04x,subsystem-vendor=%04x,subsystem-device=%04x",
1141+
"bus=%s,vendor=%04x,device=%04x,subsystem-vendor=%04x,subsystem-device=%04x%s",
10671142
ath10k_bus_str(ar->hif.bus),
10681143
ar->id.vendor, ar->id.device,
1069-
ar->id.subsystem_vendor, ar->id.subsystem_device);
1070-
1144+
ar->id.subsystem_vendor, ar->id.subsystem_device, variant);
10711145
out:
10721146
ath10k_dbg(ar, ATH10K_DBG_BOOT, "boot using board name '%s'\n", name);
10731147

@@ -2128,6 +2202,10 @@ static int ath10k_core_probe_fw(struct ath10k *ar)
21282202
goto err_free_firmware_files;
21292203
}
21302204

2205+
ret = ath10k_core_check_smbios(ar);
2206+
if (ret)
2207+
ath10k_dbg(ar, ATH10K_DBG_BOOT, "bdf variant name not set.\n");
2208+
21312209
ret = ath10k_core_fetch_board_file(ar);
21322210
if (ret) {
21332211
ath10k_err(ar, "failed to fetch board file: %d\n", ret);

drivers/net/wireless/ath/ath10k/core.h

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,23 @@
6969
#define ATH10K_NAPI_BUDGET 64
7070
#define ATH10K_NAPI_QUOTA_LIMIT 60
7171

72+
/* SMBIOS type containing Board Data File Name Extension */
73+
#define ATH10K_SMBIOS_BDF_EXT_TYPE 0xF8
74+
75+
/* SMBIOS type structure length (excluding strings-set) */
76+
#define ATH10K_SMBIOS_BDF_EXT_LENGTH 0x9
77+
78+
/* Offset pointing to Board Data File Name Extension */
79+
#define ATH10K_SMBIOS_BDF_EXT_OFFSET 0x8
80+
81+
/* Board Data File Name Extension string length.
82+
* String format: BDF_<Customer ID>_<Extension>\0
83+
*/
84+
#define ATH10K_SMBIOS_BDF_EXT_STR_LENGTH 0x20
85+
86+
/* The magic used by QCA spec */
87+
#define ATH10K_SMBIOS_BDF_EXT_MAGIC "BDF_"
88+
7289
struct ath10k;
7390

7491
enum ath10k_bus {
@@ -314,6 +331,7 @@ struct ath10k_peer {
314331
struct ieee80211_vif *vif;
315332
struct ieee80211_sta *sta;
316333

334+
bool removed;
317335
int vdev_id;
318336
u8 addr[ETH_ALEN];
319337
DECLARE_BITMAP(peer_ids, ATH10K_MAX_NUM_PEER_IDS);
@@ -419,13 +437,29 @@ struct ath10k_vif_iter {
419437
struct ath10k_vif *arvif;
420438
};
421439

440+
/* Copy Engine register dump, protected by ce-lock */
441+
struct ath10k_ce_crash_data {
442+
__le32 base_addr;
443+
__le32 src_wr_idx;
444+
__le32 src_r_idx;
445+
__le32 dst_wr_idx;
446+
__le32 dst_r_idx;
447+
};
448+
449+
struct ath10k_ce_crash_hdr {
450+
__le32 ce_count;
451+
__le32 reserved[3]; /* for future use */
452+
struct ath10k_ce_crash_data entries[];
453+
};
454+
422455
/* used for crash-dump storage, protected by data-lock */
423456
struct ath10k_fw_crash_data {
424457
bool crashed_since_read;
425458

426459
uuid_le uuid;
427460
struct timespec timestamp;
428461
__le32 registers[REG_DUMP_COUNT_QCA988X];
462+
struct ath10k_ce_crash_data ce_crash_data[CE_COUNT_MAX];
429463
};
430464

431465
struct ath10k_debug {
@@ -781,6 +815,8 @@ struct ath10k {
781815
bool bmi_ids_valid;
782816
u8 bmi_board_id;
783817
u8 bmi_chip_id;
818+
819+
char bdf_ext[ATH10K_SMBIOS_BDF_EXT_STR_LENGTH];
784820
} id;
785821

786822
int fw_api;

0 commit comments

Comments
 (0)