ath10k: clean up growing hw checks during safe and full reset
Store pci chip secific reset funtions in struct ath10k_pci as callbacks during early ath10k_pci_probe() and use the callback to perform chip specific resets. This patch essentially adds two callback in ath10k_pci, one for doing soft reset and the other for hard reset. By using callbacks we can get rid of those hw revision checks in ath10k_pci_safe_chip_reset() and ath10k_pci_chip_reset(). As such this patch does not fix any issue. Signed-off-by: Vasanthakumar Thiagarajan <vthiagar@qti.qualcomm.com> Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
This commit is contained in:
parent
2f1d2e87a7
commit
dac9835b1d
2 changed files with 34 additions and 16 deletions
|
@ -2293,16 +2293,20 @@ static int ath10k_pci_warm_reset(struct ath10k *ar)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static int ath10k_pci_qca99x0_soft_chip_reset(struct ath10k *ar)
|
||||||
|
{
|
||||||
|
ath10k_pci_irq_disable(ar);
|
||||||
|
return ath10k_pci_qca99x0_chip_reset(ar);
|
||||||
|
}
|
||||||
|
|
||||||
static int ath10k_pci_safe_chip_reset(struct ath10k *ar)
|
static int ath10k_pci_safe_chip_reset(struct ath10k *ar)
|
||||||
{
|
{
|
||||||
if (QCA_REV_988X(ar) || QCA_REV_6174(ar)) {
|
struct ath10k_pci *ar_pci = ath10k_pci_priv(ar);
|
||||||
return ath10k_pci_warm_reset(ar);
|
|
||||||
} else if (QCA_REV_99X0(ar)) {
|
if (!ar_pci->pci_soft_reset)
|
||||||
ath10k_pci_irq_disable(ar);
|
|
||||||
return ath10k_pci_qca99x0_chip_reset(ar);
|
|
||||||
} else {
|
|
||||||
return -ENOTSUPP;
|
return -ENOTSUPP;
|
||||||
}
|
|
||||||
|
return ar_pci->pci_soft_reset(ar);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int ath10k_pci_qca988x_chip_reset(struct ath10k *ar)
|
static int ath10k_pci_qca988x_chip_reset(struct ath10k *ar)
|
||||||
|
@ -2437,16 +2441,12 @@ static int ath10k_pci_qca99x0_chip_reset(struct ath10k *ar)
|
||||||
|
|
||||||
static int ath10k_pci_chip_reset(struct ath10k *ar)
|
static int ath10k_pci_chip_reset(struct ath10k *ar)
|
||||||
{
|
{
|
||||||
if (QCA_REV_988X(ar))
|
struct ath10k_pci *ar_pci = ath10k_pci_priv(ar);
|
||||||
return ath10k_pci_qca988x_chip_reset(ar);
|
|
||||||
else if (QCA_REV_6174(ar))
|
if (WARN_ON(!ar_pci->pci_hard_reset))
|
||||||
return ath10k_pci_qca6174_chip_reset(ar);
|
|
||||||
else if (QCA_REV_9377(ar))
|
|
||||||
return ath10k_pci_qca6174_chip_reset(ar);
|
|
||||||
else if (QCA_REV_99X0(ar))
|
|
||||||
return ath10k_pci_qca99x0_chip_reset(ar);
|
|
||||||
else
|
|
||||||
return -ENOTSUPP;
|
return -ENOTSUPP;
|
||||||
|
|
||||||
|
return ar_pci->pci_hard_reset(ar);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int ath10k_pci_hif_power_up(struct ath10k *ar)
|
static int ath10k_pci_hif_power_up(struct ath10k *ar)
|
||||||
|
@ -2976,24 +2976,34 @@ static int ath10k_pci_probe(struct pci_dev *pdev,
|
||||||
enum ath10k_hw_rev hw_rev;
|
enum ath10k_hw_rev hw_rev;
|
||||||
u32 chip_id;
|
u32 chip_id;
|
||||||
bool pci_ps;
|
bool pci_ps;
|
||||||
|
int (*pci_soft_reset)(struct ath10k *ar);
|
||||||
|
int (*pci_hard_reset)(struct ath10k *ar);
|
||||||
|
|
||||||
switch (pci_dev->device) {
|
switch (pci_dev->device) {
|
||||||
case QCA988X_2_0_DEVICE_ID:
|
case QCA988X_2_0_DEVICE_ID:
|
||||||
hw_rev = ATH10K_HW_QCA988X;
|
hw_rev = ATH10K_HW_QCA988X;
|
||||||
pci_ps = false;
|
pci_ps = false;
|
||||||
|
pci_soft_reset = ath10k_pci_warm_reset;
|
||||||
|
pci_hard_reset = ath10k_pci_qca988x_chip_reset;
|
||||||
break;
|
break;
|
||||||
case QCA6164_2_1_DEVICE_ID:
|
case QCA6164_2_1_DEVICE_ID:
|
||||||
case QCA6174_2_1_DEVICE_ID:
|
case QCA6174_2_1_DEVICE_ID:
|
||||||
hw_rev = ATH10K_HW_QCA6174;
|
hw_rev = ATH10K_HW_QCA6174;
|
||||||
pci_ps = true;
|
pci_ps = true;
|
||||||
|
pci_soft_reset = ath10k_pci_warm_reset;
|
||||||
|
pci_hard_reset = ath10k_pci_qca6174_chip_reset;
|
||||||
break;
|
break;
|
||||||
case QCA99X0_2_0_DEVICE_ID:
|
case QCA99X0_2_0_DEVICE_ID:
|
||||||
hw_rev = ATH10K_HW_QCA99X0;
|
hw_rev = ATH10K_HW_QCA99X0;
|
||||||
pci_ps = false;
|
pci_ps = false;
|
||||||
|
pci_soft_reset = ath10k_pci_qca99x0_soft_chip_reset;
|
||||||
|
pci_hard_reset = ath10k_pci_qca99x0_chip_reset;
|
||||||
break;
|
break;
|
||||||
case QCA9377_1_0_DEVICE_ID:
|
case QCA9377_1_0_DEVICE_ID:
|
||||||
hw_rev = ATH10K_HW_QCA9377;
|
hw_rev = ATH10K_HW_QCA9377;
|
||||||
pci_ps = true;
|
pci_ps = true;
|
||||||
|
pci_soft_reset = NULL;
|
||||||
|
pci_hard_reset = ath10k_pci_qca6174_chip_reset;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
WARN_ON(1);
|
WARN_ON(1);
|
||||||
|
@ -3018,6 +3028,8 @@ static int ath10k_pci_probe(struct pci_dev *pdev,
|
||||||
ar->dev_id = pci_dev->device;
|
ar->dev_id = pci_dev->device;
|
||||||
ar_pci->pci_ps = pci_ps;
|
ar_pci->pci_ps = pci_ps;
|
||||||
ar_pci->bus_ops = &ath10k_pci_bus_ops;
|
ar_pci->bus_ops = &ath10k_pci_bus_ops;
|
||||||
|
ar_pci->pci_soft_reset = pci_soft_reset;
|
||||||
|
ar_pci->pci_hard_reset = pci_hard_reset;
|
||||||
|
|
||||||
ar->id.vendor = pdev->vendor;
|
ar->id.vendor = pdev->vendor;
|
||||||
ar->id.device = pdev->device;
|
ar->id.device = pdev->device;
|
||||||
|
|
|
@ -234,6 +234,12 @@ struct ath10k_pci {
|
||||||
|
|
||||||
const struct ath10k_bus_ops *bus_ops;
|
const struct ath10k_bus_ops *bus_ops;
|
||||||
|
|
||||||
|
/* Chip specific pci reset routine used to do a safe reset */
|
||||||
|
int (*pci_soft_reset)(struct ath10k *ar);
|
||||||
|
|
||||||
|
/* Chip specific pci full reset function */
|
||||||
|
int (*pci_hard_reset)(struct ath10k *ar);
|
||||||
|
|
||||||
/* Keep this entry in the last, memory for struct ath10k_ahb is
|
/* Keep this entry in the last, memory for struct ath10k_ahb is
|
||||||
* allocated (ahb support enabled case) in the continuation of
|
* allocated (ahb support enabled case) in the continuation of
|
||||||
* this struct.
|
* this struct.
|
||||||
|
|
Loading…
Add table
Reference in a new issue