mirror of https://gitee.com/openkylin/linux.git
ath10k: don't use interrupts for BMI
It's not really necessary for interrupts to be used for BMI. BMI already assumes there's only one caller at a time and it works directly with CE. Make BMI poll for CE completions instead of waiting for interrupts. This makes disabling interrupts during early boot possible. Signed-off-by: Michal Kazior <michal.kazior@tieto.com> Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
This commit is contained in:
parent
fc15ca13a6
commit
85622cde05
|
@ -59,6 +59,9 @@ static int ath10k_pci_init_irq(struct ath10k *ar);
|
||||||
static int ath10k_pci_deinit_irq(struct ath10k *ar);
|
static int ath10k_pci_deinit_irq(struct ath10k *ar);
|
||||||
static int ath10k_pci_request_irq(struct ath10k *ar);
|
static int ath10k_pci_request_irq(struct ath10k *ar);
|
||||||
static void ath10k_pci_free_irq(struct ath10k *ar);
|
static void ath10k_pci_free_irq(struct ath10k *ar);
|
||||||
|
static int ath10k_pci_bmi_wait(struct ath10k_ce_pipe *tx_pipe,
|
||||||
|
struct ath10k_ce_pipe *rx_pipe,
|
||||||
|
struct bmi_xfer *xfer);
|
||||||
|
|
||||||
static const struct ce_attr host_ce_config_wlan[] = {
|
static const struct ce_attr host_ce_config_wlan[] = {
|
||||||
/* CE0: host->target HTC control and raw streams */
|
/* CE0: host->target HTC control and raw streams */
|
||||||
|
@ -1394,6 +1397,8 @@ static int ath10k_pci_hif_exchange_bmi_msg(struct ath10k *ar,
|
||||||
void *treq, *tresp = NULL;
|
void *treq, *tresp = NULL;
|
||||||
int ret = 0;
|
int ret = 0;
|
||||||
|
|
||||||
|
might_sleep();
|
||||||
|
|
||||||
if (resp && !resp_len)
|
if (resp && !resp_len)
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
|
|
||||||
|
@ -1434,14 +1439,12 @@ static int ath10k_pci_hif_exchange_bmi_msg(struct ath10k *ar,
|
||||||
if (ret)
|
if (ret)
|
||||||
goto err_resp;
|
goto err_resp;
|
||||||
|
|
||||||
ret = wait_for_completion_timeout(&xfer.done,
|
ret = ath10k_pci_bmi_wait(ce_tx, ce_rx, &xfer);
|
||||||
BMI_COMMUNICATION_TIMEOUT_HZ);
|
if (ret) {
|
||||||
if (ret <= 0) {
|
|
||||||
u32 unused_buffer;
|
u32 unused_buffer;
|
||||||
unsigned int unused_nbytes;
|
unsigned int unused_nbytes;
|
||||||
unsigned int unused_id;
|
unsigned int unused_id;
|
||||||
|
|
||||||
ret = -ETIMEDOUT;
|
|
||||||
ath10k_ce_cancel_send_next(ce_tx, NULL, &unused_buffer,
|
ath10k_ce_cancel_send_next(ce_tx, NULL, &unused_buffer,
|
||||||
&unused_nbytes, &unused_id);
|
&unused_nbytes, &unused_id);
|
||||||
} else {
|
} else {
|
||||||
|
@ -1509,6 +1512,25 @@ static void ath10k_pci_bmi_recv_data(struct ath10k_ce_pipe *ce_state)
|
||||||
complete(&xfer->done);
|
complete(&xfer->done);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static int ath10k_pci_bmi_wait(struct ath10k_ce_pipe *tx_pipe,
|
||||||
|
struct ath10k_ce_pipe *rx_pipe,
|
||||||
|
struct bmi_xfer *xfer)
|
||||||
|
{
|
||||||
|
unsigned long timeout = jiffies + BMI_COMMUNICATION_TIMEOUT_HZ;
|
||||||
|
|
||||||
|
while (time_before_eq(jiffies, timeout)) {
|
||||||
|
ath10k_pci_bmi_send_done(tx_pipe);
|
||||||
|
ath10k_pci_bmi_recv_data(rx_pipe);
|
||||||
|
|
||||||
|
if (completion_done(&xfer->done))
|
||||||
|
return 0;
|
||||||
|
|
||||||
|
schedule();
|
||||||
|
}
|
||||||
|
|
||||||
|
return -ETIMEDOUT;
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Map from service/endpoint to Copy Engine.
|
* Map from service/endpoint to Copy Engine.
|
||||||
* This table is derived from the CE_PCI TABLE, above.
|
* This table is derived from the CE_PCI TABLE, above.
|
||||||
|
@ -1846,24 +1868,6 @@ static void ath10k_pci_fw_interrupt_handler(struct ath10k *ar)
|
||||||
ath10k_pci_sleep(ar);
|
ath10k_pci_sleep(ar);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void ath10k_pci_start_bmi(struct ath10k *ar)
|
|
||||||
{
|
|
||||||
struct ath10k_pci *ar_pci = ath10k_pci_priv(ar);
|
|
||||||
struct ath10k_pci_pipe *pipe;
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Initially, establish CE completion handlers for use with BMI.
|
|
||||||
* These are overwritten with generic handlers after we exit BMI phase.
|
|
||||||
*/
|
|
||||||
pipe = &ar_pci->pipe_info[BMI_CE_NUM_TO_TARG];
|
|
||||||
ath10k_ce_send_cb_register(pipe->ce_hdl, ath10k_pci_bmi_send_done, 0);
|
|
||||||
|
|
||||||
pipe = &ar_pci->pipe_info[BMI_CE_NUM_TO_HOST];
|
|
||||||
ath10k_ce_recv_cb_register(pipe->ce_hdl, ath10k_pci_bmi_recv_data);
|
|
||||||
|
|
||||||
ath10k_dbg(ATH10K_DBG_BOOT, "boot start bmi\n");
|
|
||||||
}
|
|
||||||
|
|
||||||
static int ath10k_pci_hif_power_up(struct ath10k *ar)
|
static int ath10k_pci_hif_power_up(struct ath10k *ar)
|
||||||
{
|
{
|
||||||
struct ath10k_pci *ar_pci = ath10k_pci_priv(ar);
|
struct ath10k_pci *ar_pci = ath10k_pci_priv(ar);
|
||||||
|
@ -1938,8 +1942,6 @@ static int ath10k_pci_hif_power_up(struct ath10k *ar)
|
||||||
goto err_free_irq;
|
goto err_free_irq;
|
||||||
}
|
}
|
||||||
|
|
||||||
ath10k_pci_start_bmi(ar);
|
|
||||||
|
|
||||||
if (ar_pci->num_msi_intrs > 1)
|
if (ar_pci->num_msi_intrs > 1)
|
||||||
irq_mode = "MSI-X";
|
irq_mode = "MSI-X";
|
||||||
else if (ar_pci->num_msi_intrs == 1)
|
else if (ar_pci->num_msi_intrs == 1)
|
||||||
|
|
Loading…
Reference in New Issue