Skip to content

Commit

Permalink
Merge ath-next from git://git.kernel.org/pub/scm/linux/kernel/git/kva…
Browse files Browse the repository at this point in the history
…lo/ath.git

ath.git patches for v5.16. Major changes:

ath9k

* add option to reset the wifi chip via debugfs

* convert Device Tree bindings to the json-schema

* support Device Tree ieee80211-freq-limit property to limit channels
  • Loading branch information
Kalle Valo committed Oct 20, 2021
2 parents 5943a86 + 65b4b8a commit 8347c80
Show file tree
Hide file tree
Showing 25 changed files with 315 additions and 108 deletions.
48 changes: 0 additions & 48 deletions Documentation/devicetree/bindings/net/wireless/qca,ath9k.txt

This file was deleted.

90 changes: 90 additions & 0 deletions Documentation/devicetree/bindings/net/wireless/qca,ath9k.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,90 @@
# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
%YAML 1.2
---
$id: http://devicetree.org/schemas/net/wireless/qca,ath9k.yaml#
$schema: http://devicetree.org/meta-schemas/core.yaml#

title: Qualcomm Atheros ath9k wireless devices Generic Binding

maintainers:
- Kalle Valo <kvalo@codeaurora.org>

description: |
This node provides properties for configuring the ath9k wireless device.
The node is expected to be specified as a child node of the PCI controller
to which the wireless chip is connected.
allOf:
- $ref: ieee80211.yaml#

properties:
compatible:
enum:
- pci168c,0023 # AR5416
- pci168c,0024 # AR5418
- pci168c,0027 # AR9160
- pci168c,0029 # AR9220 and AR9223
- pci168c,002a # AR9280 and AR9283
- pci168c,002b # AR9285
- pci168c,002c # AR2427 - 802.11n bonded out
- pci168c,002d # AR9227
- pci168c,002e # AR9287
- pci168c,0030 # AR9380, AR9381 and AR9382
- pci168c,0032 # AR9485
- pci168c,0033 # AR9580 and AR9590
- pci168c,0034 # AR9462
- pci168c,0036 # AR9565
- pci168c,0037 # AR1111 and AR9485

reg:
maxItems: 1

interrupts:
maxItems: 1

ieee80211-freq-limit: true

qca,no-eeprom:
$ref: /schemas/types.yaml#/definitions/flag
description:
Indicates that there is no physical EEPROM connected

nvmem-cells:
items:
- description: Reference to an nvmem node for the MAC address
- description: Reference to an nvmem node for calibration data

nvmem-cell-names:
items:
- const: mac-address
- const: calibration

required:
- compatible
- reg

additionalProperties: false

examples:
- |
pcie0 {
#address-cells = <3>;
#size-cells = <2>;
wifi@0,0 {
compatible = "pci168c,002d";
reg = <0 0 0 0 0>;
interrupts = <3>;
qca,no-eeprom;
};
};
- |
pci0 {
#address-cells = <3>;
#size-cells = <2>;
wifi@0,11 {
compatible = "pci168c,0029";
reg = <0x8800 0 0 0 0>;
nvmem-cells = <&macaddr_art_c>, <&cal_art_1000>;
nvmem-cell-names = "mac-address", "calibration";
};
};
1 change: 1 addition & 0 deletions MAINTAINERS
Original file line number Diff line number Diff line change
Expand Up @@ -15464,6 +15464,7 @@ M: ath9k-devel@qca.qualcomm.com
L: linux-wireless@vger.kernel.org
S: Supported
W: https://wireless.wiki.kernel.org/en/users/Drivers/ath9k
F: Documentation/devicetree/bindings/net/wireless/qca,ath9k.yaml
F: drivers/net/wireless/ath/ath9k/

QUALCOMM CAMERA SUBSYSTEM DRIVER
Expand Down
6 changes: 3 additions & 3 deletions drivers/net/wireless/ath/ath10k/mac.c
Original file line number Diff line number Diff line change
Expand Up @@ -1052,7 +1052,7 @@ static int ath10k_monitor_vdev_start(struct ath10k *ar, int vdev_id)
arg.channel.min_power = 0;
arg.channel.max_power = channel->max_power * 2;
arg.channel.max_reg_power = channel->max_reg_power * 2;
arg.channel.max_antenna_gain = channel->max_antenna_gain * 2;
arg.channel.max_antenna_gain = channel->max_antenna_gain;

reinit_completion(&ar->vdev_setup_done);
reinit_completion(&ar->vdev_delete_done);
Expand Down Expand Up @@ -1498,7 +1498,7 @@ static int ath10k_vdev_start_restart(struct ath10k_vif *arvif,
arg.channel.min_power = 0;
arg.channel.max_power = chandef->chan->max_power * 2;
arg.channel.max_reg_power = chandef->chan->max_reg_power * 2;
arg.channel.max_antenna_gain = chandef->chan->max_antenna_gain * 2;
arg.channel.max_antenna_gain = chandef->chan->max_antenna_gain;

if (arvif->vdev_type == WMI_VDEV_TYPE_AP) {
arg.ssid = arvif->u.ap.ssid;
Expand Down Expand Up @@ -3426,7 +3426,7 @@ static int ath10k_update_channel_list(struct ath10k *ar)
ch->min_power = 0;
ch->max_power = channel->max_power * 2;
ch->max_reg_power = channel->max_reg_power * 2;
ch->max_antenna_gain = channel->max_antenna_gain * 2;
ch->max_antenna_gain = channel->max_antenna_gain;
ch->reg_class_id = 0; /* FIXME */

/* FIXME: why use only legacy modes, why not any
Expand Down
3 changes: 2 additions & 1 deletion drivers/net/wireless/ath/ath10k/qmi.c
Original file line number Diff line number Diff line change
Expand Up @@ -864,7 +864,8 @@ static void ath10k_qmi_event_server_exit(struct ath10k_qmi *qmi)

ath10k_qmi_remove_msa_permission(qmi);
ath10k_core_free_board_files(ar);
if (!test_bit(ATH10K_SNOC_FLAG_UNREGISTERING, &ar_snoc->flags))
if (!test_bit(ATH10K_SNOC_FLAG_UNREGISTERING, &ar_snoc->flags) &&
!test_bit(ATH10K_SNOC_FLAG_MODEM_STOPPED, &ar_snoc->flags))
ath10k_snoc_fw_crashed_dump(ar);

ath10k_snoc_fw_indication(ar, ATH10K_QMI_EVENT_FW_DOWN_IND);
Expand Down
77 changes: 77 additions & 0 deletions drivers/net/wireless/ath/ath10k/snoc.c
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
#include <linux/platform_device.h>
#include <linux/property.h>
#include <linux/regulator/consumer.h>
#include <linux/remoteproc/qcom_rproc.h>
#include <linux/of_address.h>
#include <linux/iommu.h>

Expand Down Expand Up @@ -1477,6 +1478,74 @@ void ath10k_snoc_fw_crashed_dump(struct ath10k *ar)
mutex_unlock(&ar->dump_mutex);
}

static int ath10k_snoc_modem_notify(struct notifier_block *nb, unsigned long action,
void *data)
{
struct ath10k_snoc *ar_snoc = container_of(nb, struct ath10k_snoc, nb);
struct ath10k *ar = ar_snoc->ar;
struct qcom_ssr_notify_data *notify_data = data;

switch (action) {
case QCOM_SSR_BEFORE_POWERUP:
ath10k_dbg(ar, ATH10K_DBG_SNOC, "received modem starting event\n");
clear_bit(ATH10K_SNOC_FLAG_MODEM_STOPPED, &ar_snoc->flags);
break;

case QCOM_SSR_AFTER_POWERUP:
ath10k_dbg(ar, ATH10K_DBG_SNOC, "received modem running event\n");
break;

case QCOM_SSR_BEFORE_SHUTDOWN:
ath10k_dbg(ar, ATH10K_DBG_SNOC, "received modem %s event\n",
notify_data->crashed ? "crashed" : "stopping");
if (!notify_data->crashed)
set_bit(ATH10K_SNOC_FLAG_MODEM_STOPPED, &ar_snoc->flags);
else
clear_bit(ATH10K_SNOC_FLAG_MODEM_STOPPED, &ar_snoc->flags);
break;

case QCOM_SSR_AFTER_SHUTDOWN:
ath10k_dbg(ar, ATH10K_DBG_SNOC, "received modem offline event\n");
break;

default:
ath10k_err(ar, "received unrecognized event %lu\n", action);
break;
}

return NOTIFY_OK;
}

static int ath10k_modem_init(struct ath10k *ar)
{
struct ath10k_snoc *ar_snoc = ath10k_snoc_priv(ar);
void *notifier;
int ret;

ar_snoc->nb.notifier_call = ath10k_snoc_modem_notify;

notifier = qcom_register_ssr_notifier("mpss", &ar_snoc->nb);
if (IS_ERR(notifier)) {
ret = PTR_ERR(notifier);
ath10k_err(ar, "failed to initialize modem notifier: %d\n", ret);
return ret;
}

ar_snoc->notifier = notifier;

return 0;
}

static void ath10k_modem_deinit(struct ath10k *ar)
{
int ret;
struct ath10k_snoc *ar_snoc = ath10k_snoc_priv(ar);

ret = qcom_unregister_ssr_notifier(ar_snoc->notifier, &ar_snoc->nb);
if (ret)
ath10k_err(ar, "error %d unregistering notifier\n", ret);
}

static int ath10k_setup_msa_resources(struct ath10k *ar, u32 msa_size)
{
struct device *dev = ar->dev;
Expand Down Expand Up @@ -1740,10 +1809,17 @@ static int ath10k_snoc_probe(struct platform_device *pdev)
goto err_fw_deinit;
}

ret = ath10k_modem_init(ar);
if (ret)
goto err_qmi_deinit;

ath10k_dbg(ar, ATH10K_DBG_SNOC, "snoc probe\n");

return 0;

err_qmi_deinit:
ath10k_qmi_deinit(ar);

err_fw_deinit:
ath10k_fw_deinit(ar);

Expand Down Expand Up @@ -1771,6 +1847,7 @@ static int ath10k_snoc_free_resources(struct ath10k *ar)
ath10k_fw_deinit(ar);
ath10k_snoc_free_irq(ar);
ath10k_snoc_release_resource(ar);
ath10k_modem_deinit(ar);
ath10k_qmi_deinit(ar);
ath10k_core_destroy(ar);

Expand Down
5 changes: 5 additions & 0 deletions drivers/net/wireless/ath/ath10k/snoc.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@
#ifndef _SNOC_H_
#define _SNOC_H_

#include <linux/notifier.h>

#include "hw.h"
#include "ce.h"
#include "qmi.h"
Expand Down Expand Up @@ -45,6 +47,7 @@ struct ath10k_snoc_ce_irq {
enum ath10k_snoc_flags {
ATH10K_SNOC_FLAG_REGISTERED,
ATH10K_SNOC_FLAG_UNREGISTERING,
ATH10K_SNOC_FLAG_MODEM_STOPPED,
ATH10K_SNOC_FLAG_RECOVERY,
ATH10K_SNOC_FLAG_8BIT_HOST_CAP_QUIRK,
};
Expand Down Expand Up @@ -75,6 +78,8 @@ struct ath10k_snoc {
struct clk_bulk_data *clks;
size_t num_clks;
struct ath10k_qmi *qmi;
struct notifier_block nb;
void *notifier;
unsigned long flags;
bool xo_cal_supported;
u32 xo_cal_data;
Expand Down
3 changes: 3 additions & 0 deletions drivers/net/wireless/ath/ath10k/wmi.h
Original file line number Diff line number Diff line change
Expand Up @@ -2066,7 +2066,9 @@ struct wmi_channel {
union {
__le32 reginfo1;
struct {
/* note: power unit is 1 dBm */
u8 antenna_max;
/* note: power unit is 0.5 dBm */
u8 max_tx_power;
} __packed;
} __packed;
Expand All @@ -2086,6 +2088,7 @@ struct wmi_channel_arg {
u32 min_power;
u32 max_power;
u32 max_reg_power;
/* note: power unit is 1 dBm */
u32 max_antenna_gain;
u32 reg_class_id;
enum wmi_phy_mode mode;
Expand Down
Loading

0 comments on commit 8347c80

Please sign in to comment.