提交 8e8ddb2b 编写于 作者: K Kalle Valo

ath6kl: move htc_hif to hif.c

Signed-off-by: NKalle Valo <kvalo@qca.qualcomm.com>
上级 b4be8959
...@@ -23,7 +23,7 @@ ...@@ -23,7 +23,7 @@
obj-$(CONFIG_ATH6KL) := ath6kl.o obj-$(CONFIG_ATH6KL) := ath6kl.o
ath6kl-y += debug.o ath6kl-y += debug.o
ath6kl-y += htc_hif.o ath6kl-y += hif.o
ath6kl-y += htc.o ath6kl-y += htc.o
ath6kl-y += bmi.o ath6kl-y += bmi.o
ath6kl-y += cfg80211.o ath6kl-y += cfg80211.o
......
...@@ -24,7 +24,8 @@ ...@@ -24,7 +24,8 @@
#define ATH6KL_TIME_QUANTUM 10 /* in ms */ #define ATH6KL_TIME_QUANTUM 10 /* in ms */
static int ath6kldev_cp_scat_dma_buf(struct hif_scatter_req *req, bool from_dma) static int ath6kl_hif_cp_scat_dma_buf(struct hif_scatter_req *req,
bool from_dma)
{ {
u8 *buf; u8 *buf;
int i; int i;
...@@ -46,12 +47,12 @@ static int ath6kldev_cp_scat_dma_buf(struct hif_scatter_req *req, bool from_dma) ...@@ -46,12 +47,12 @@ static int ath6kldev_cp_scat_dma_buf(struct hif_scatter_req *req, bool from_dma)
return 0; return 0;
} }
int ath6kldev_rw_comp_handler(void *context, int status) int ath6kl_hif_rw_comp_handler(void *context, int status)
{ {
struct htc_packet *packet = context; struct htc_packet *packet = context;
ath6kl_dbg(ATH6KL_DBG_HTC_RECV, ath6kl_dbg(ATH6KL_DBG_HTC_RECV,
"ath6kldev_rw_comp_handler (pkt:0x%p , status: %d\n", "ath6kl_hif_rw_comp_handler (pkt:0x%p , status: %d\n",
packet, status); packet, status);
packet->status = status; packet->status = status;
...@@ -60,7 +61,7 @@ int ath6kldev_rw_comp_handler(void *context, int status) ...@@ -60,7 +61,7 @@ int ath6kldev_rw_comp_handler(void *context, int status)
return 0; return 0;
} }
static int ath6kldev_proc_dbg_intr(struct ath6kl_device *dev) static int ath6kl_hif_proc_dbg_intr(struct ath6kl_device *dev)
{ {
u32 dummy; u32 dummy;
int status; int status;
...@@ -82,7 +83,7 @@ static int ath6kldev_proc_dbg_intr(struct ath6kl_device *dev) ...@@ -82,7 +83,7 @@ static int ath6kldev_proc_dbg_intr(struct ath6kl_device *dev)
} }
/* mailbox recv message polling */ /* mailbox recv message polling */
int ath6kldev_poll_mboxmsg_rx(struct ath6kl_device *dev, u32 *lk_ahd, int ath6kl_hif_poll_mboxmsg_rx(struct ath6kl_device *dev, u32 *lk_ahd,
int timeout) int timeout)
{ {
struct ath6kl_irq_proc_registers *rg; struct ath6kl_irq_proc_registers *rg;
...@@ -131,7 +132,7 @@ int ath6kldev_poll_mboxmsg_rx(struct ath6kl_device *dev, u32 *lk_ahd, ...@@ -131,7 +132,7 @@ int ath6kldev_poll_mboxmsg_rx(struct ath6kl_device *dev, u32 *lk_ahd,
* Target failure handler will be called in case of * Target failure handler will be called in case of
* an assert. * an assert.
*/ */
ath6kldev_proc_dbg_intr(dev); ath6kl_hif_proc_dbg_intr(dev);
} }
return status; return status;
...@@ -141,7 +142,7 @@ int ath6kldev_poll_mboxmsg_rx(struct ath6kl_device *dev, u32 *lk_ahd, ...@@ -141,7 +142,7 @@ int ath6kldev_poll_mboxmsg_rx(struct ath6kl_device *dev, u32 *lk_ahd,
* Disable packet reception (used in case the host runs out of buffers) * Disable packet reception (used in case the host runs out of buffers)
* using the interrupt enable registers through the host I/F * using the interrupt enable registers through the host I/F
*/ */
int ath6kldev_rx_control(struct ath6kl_device *dev, bool enable_rx) int ath6kl_hif_rx_control(struct ath6kl_device *dev, bool enable_rx)
{ {
struct ath6kl_irq_enable_reg regs; struct ath6kl_irq_enable_reg regs;
int status = 0; int status = 0;
...@@ -168,7 +169,7 @@ int ath6kldev_rx_control(struct ath6kl_device *dev, bool enable_rx) ...@@ -168,7 +169,7 @@ int ath6kldev_rx_control(struct ath6kl_device *dev, bool enable_rx)
return status; return status;
} }
int ath6kldev_submit_scat_req(struct ath6kl_device *dev, int ath6kl_hif_submit_scat_req(struct ath6kl_device *dev,
struct hif_scatter_req *scat_req, bool read) struct hif_scatter_req *scat_req, bool read)
{ {
int status = 0; int status = 0;
...@@ -186,13 +187,13 @@ int ath6kldev_submit_scat_req(struct ath6kl_device *dev, ...@@ -186,13 +187,13 @@ int ath6kldev_submit_scat_req(struct ath6kl_device *dev,
} }
ath6kl_dbg((ATH6KL_DBG_HTC_RECV | ATH6KL_DBG_HTC_SEND), ath6kl_dbg((ATH6KL_DBG_HTC_RECV | ATH6KL_DBG_HTC_SEND),
"ath6kldev_submit_scat_req, entries: %d, total len: %d mbox:0x%X (mode: %s : %s)\n", "ath6kl_hif_submit_scat_req, entries: %d, total len: %d mbox:0x%X (mode: %s : %s)\n",
scat_req->scat_entries, scat_req->len, scat_req->scat_entries, scat_req->len,
scat_req->addr, !read ? "async" : "sync", scat_req->addr, !read ? "async" : "sync",
(read) ? "rd" : "wr"); (read) ? "rd" : "wr");
if (!read && scat_req->virt_scat) { if (!read && scat_req->virt_scat) {
status = ath6kldev_cp_scat_dma_buf(scat_req, false); status = ath6kl_hif_cp_scat_dma_buf(scat_req, false);
if (status) { if (status) {
scat_req->status = status; scat_req->status = status;
scat_req->complete(dev->ar->htc_target, scat_req); scat_req->complete(dev->ar->htc_target, scat_req);
...@@ -207,13 +208,13 @@ int ath6kldev_submit_scat_req(struct ath6kl_device *dev, ...@@ -207,13 +208,13 @@ int ath6kldev_submit_scat_req(struct ath6kl_device *dev,
scat_req->status = status; scat_req->status = status;
if (!status && scat_req->virt_scat) if (!status && scat_req->virt_scat)
scat_req->status = scat_req->status =
ath6kldev_cp_scat_dma_buf(scat_req, true); ath6kl_hif_cp_scat_dma_buf(scat_req, true);
} }
return status; return status;
} }
static int ath6kldev_proc_counter_intr(struct ath6kl_device *dev) static int ath6kl_hif_proc_counter_intr(struct ath6kl_device *dev)
{ {
u8 counter_int_status; u8 counter_int_status;
...@@ -232,12 +233,12 @@ static int ath6kldev_proc_counter_intr(struct ath6kl_device *dev) ...@@ -232,12 +233,12 @@ static int ath6kldev_proc_counter_intr(struct ath6kl_device *dev)
* the debug assertion counter interrupt. * the debug assertion counter interrupt.
*/ */
if (counter_int_status & ATH6KL_TARGET_DEBUG_INTR_MASK) if (counter_int_status & ATH6KL_TARGET_DEBUG_INTR_MASK)
return ath6kldev_proc_dbg_intr(dev); return ath6kl_hif_proc_dbg_intr(dev);
return 0; return 0;
} }
static int ath6kldev_proc_err_intr(struct ath6kl_device *dev) static int ath6kl_hif_proc_err_intr(struct ath6kl_device *dev)
{ {
int status; int status;
u8 error_int_status; u8 error_int_status;
...@@ -282,7 +283,7 @@ static int ath6kldev_proc_err_intr(struct ath6kl_device *dev) ...@@ -282,7 +283,7 @@ static int ath6kldev_proc_err_intr(struct ath6kl_device *dev)
return status; return status;
} }
static int ath6kldev_proc_cpu_intr(struct ath6kl_device *dev) static int ath6kl_hif_proc_cpu_intr(struct ath6kl_device *dev)
{ {
int status; int status;
u8 cpu_int_status; u8 cpu_int_status;
...@@ -436,21 +437,21 @@ static int proc_pending_irqs(struct ath6kl_device *dev, bool *done) ...@@ -436,21 +437,21 @@ static int proc_pending_irqs(struct ath6kl_device *dev, bool *done)
if (MS(HOST_INT_STATUS_CPU, host_int_status)) { if (MS(HOST_INT_STATUS_CPU, host_int_status)) {
/* CPU Interrupt */ /* CPU Interrupt */
status = ath6kldev_proc_cpu_intr(dev); status = ath6kl_hif_proc_cpu_intr(dev);
if (status) if (status)
goto out; goto out;
} }
if (MS(HOST_INT_STATUS_ERROR, host_int_status)) { if (MS(HOST_INT_STATUS_ERROR, host_int_status)) {
/* Error Interrupt */ /* Error Interrupt */
status = ath6kldev_proc_err_intr(dev); status = ath6kl_hif_proc_err_intr(dev);
if (status) if (status)
goto out; goto out;
} }
if (MS(HOST_INT_STATUS_COUNTER, host_int_status)) if (MS(HOST_INT_STATUS_COUNTER, host_int_status))
/* Counter Interrupt */ /* Counter Interrupt */
status = ath6kldev_proc_counter_intr(dev); status = ath6kl_hif_proc_counter_intr(dev);
out: out:
/* /*
...@@ -479,7 +480,7 @@ static int proc_pending_irqs(struct ath6kl_device *dev, bool *done) ...@@ -479,7 +480,7 @@ static int proc_pending_irqs(struct ath6kl_device *dev, bool *done)
} }
/* interrupt handler, kicks off all interrupt processing */ /* interrupt handler, kicks off all interrupt processing */
int ath6kldev_intr_bh_handler(struct ath6kl *ar) int ath6kl_hif_intr_bh_handler(struct ath6kl *ar)
{ {
struct ath6kl_device *dev = ar->htc_target->dev; struct ath6kl_device *dev = ar->htc_target->dev;
int status = 0; int status = 0;
...@@ -504,7 +505,7 @@ int ath6kldev_intr_bh_handler(struct ath6kl *ar) ...@@ -504,7 +505,7 @@ int ath6kldev_intr_bh_handler(struct ath6kl *ar)
return status; return status;
} }
static int ath6kldev_enable_intrs(struct ath6kl_device *dev) static int ath6kl_hif_enable_intrs(struct ath6kl_device *dev)
{ {
struct ath6kl_irq_enable_reg regs; struct ath6kl_irq_enable_reg regs;
int status; int status;
...@@ -552,7 +553,7 @@ static int ath6kldev_enable_intrs(struct ath6kl_device *dev) ...@@ -552,7 +553,7 @@ static int ath6kldev_enable_intrs(struct ath6kl_device *dev)
return status; return status;
} }
int ath6kldev_disable_intrs(struct ath6kl_device *dev) int ath6kl_hif_disable_intrs(struct ath6kl_device *dev)
{ {
struct ath6kl_irq_enable_reg regs; struct ath6kl_irq_enable_reg regs;
...@@ -571,7 +572,7 @@ int ath6kldev_disable_intrs(struct ath6kl_device *dev) ...@@ -571,7 +572,7 @@ int ath6kldev_disable_intrs(struct ath6kl_device *dev)
} }
/* enable device interrupts */ /* enable device interrupts */
int ath6kldev_unmask_intrs(struct ath6kl_device *dev) int ath6kl_hif_unmask_intrs(struct ath6kl_device *dev)
{ {
int status = 0; int status = 0;
...@@ -583,29 +584,29 @@ int ath6kldev_unmask_intrs(struct ath6kl_device *dev) ...@@ -583,29 +584,29 @@ int ath6kldev_unmask_intrs(struct ath6kl_device *dev)
* target "soft" resets. The ATH6KL interrupt enables reset back to an * target "soft" resets. The ATH6KL interrupt enables reset back to an
* "enabled" state when this happens. * "enabled" state when this happens.
*/ */
ath6kldev_disable_intrs(dev); ath6kl_hif_disable_intrs(dev);
/* unmask the host controller interrupts */ /* unmask the host controller interrupts */
ath6kl_hif_irq_enable(dev->ar); ath6kl_hif_irq_enable(dev->ar);
status = ath6kldev_enable_intrs(dev); status = ath6kl_hif_enable_intrs(dev);
return status; return status;
} }
/* disable all device interrupts */ /* disable all device interrupts */
int ath6kldev_mask_intrs(struct ath6kl_device *dev) int ath6kl_hif_mask_intrs(struct ath6kl_device *dev)
{ {
/* /*
* Mask the interrupt at the HIF layer to avoid any stray interrupt * Mask the interrupt at the HIF layer to avoid any stray interrupt
* taken while we zero out our shadow registers in * taken while we zero out our shadow registers in
* ath6kldev_disable_intrs(). * ath6kl_hif_disable_intrs().
*/ */
ath6kl_hif_irq_disable(dev->ar); ath6kl_hif_irq_disable(dev->ar);
return ath6kldev_disable_intrs(dev); return ath6kl_hif_disable_intrs(dev);
} }
int ath6kldev_setup(struct ath6kl_device *dev) int ath6kl_hif_setup(struct ath6kl_device *dev)
{ {
int status = 0; int status = 0;
...@@ -634,7 +635,7 @@ int ath6kldev_setup(struct ath6kl_device *dev) ...@@ -634,7 +635,7 @@ int ath6kldev_setup(struct ath6kl_device *dev)
ath6kl_dbg(ATH6KL_DBG_TRC, ath6kl_dbg(ATH6KL_DBG_TRC,
"hif interrupt processing is sync only\n"); "hif interrupt processing is sync only\n");
status = ath6kldev_disable_intrs(dev); status = ath6kl_hif_disable_intrs(dev);
fail_setup: fail_setup:
return status; return status;
......
...@@ -482,7 +482,7 @@ static void ath6kl_htc_tx_bundle(struct htc_endpoint *endpoint, ...@@ -482,7 +482,7 @@ static void ath6kl_htc_tx_bundle(struct htc_endpoint *endpoint,
ath6kl_dbg(ATH6KL_DBG_HTC_SEND, ath6kl_dbg(ATH6KL_DBG_HTC_SEND,
"send scatter total bytes: %d , entries: %d\n", "send scatter total bytes: %d , entries: %d\n",
scat_req->len, scat_req->scat_entries); scat_req->len, scat_req->scat_entries);
ath6kldev_submit_scat_req(target->dev, scat_req, false); ath6kl_hif_submit_scat_req(target->dev, scat_req, false);
if (status) if (status)
break; break;
...@@ -1620,7 +1620,7 @@ static int ath6kl_htc_rx_bundle(struct htc_target *target, ...@@ -1620,7 +1620,7 @@ static int ath6kl_htc_rx_bundle(struct htc_target *target,
scat_req->len = len; scat_req->len = len;
scat_req->scat_entries = i; scat_req->scat_entries = i;
status = ath6kldev_submit_scat_req(target->dev, scat_req, true); status = ath6kl_hif_submit_scat_req(target->dev, scat_req, true);
if (!status) if (!status)
*n_pkt_fetched = i; *n_pkt_fetched = i;
...@@ -1865,7 +1865,7 @@ int ath6kl_htc_rxmsg_pending_handler(struct htc_target *target, ...@@ -1865,7 +1865,7 @@ int ath6kl_htc_rxmsg_pending_handler(struct htc_target *target,
if (target->htc_flags & HTC_OP_STATE_STOPPING) { if (target->htc_flags & HTC_OP_STATE_STOPPING) {
ath6kl_warn("host is going to stop blocking receiver for htc_stop\n"); ath6kl_warn("host is going to stop blocking receiver for htc_stop\n");
ath6kldev_rx_control(target->dev, false); ath6kl_hif_rx_control(target->dev, false);
} }
} }
...@@ -1875,7 +1875,7 @@ int ath6kl_htc_rxmsg_pending_handler(struct htc_target *target, ...@@ -1875,7 +1875,7 @@ int ath6kl_htc_rxmsg_pending_handler(struct htc_target *target,
*/ */
if (target->rx_st_flags & HTC_RECV_WAIT_BUFFERS) { if (target->rx_st_flags & HTC_RECV_WAIT_BUFFERS) {
ath6kl_warn("host has no rx buffers blocking receiver to prevent overrun\n"); ath6kl_warn("host has no rx buffers blocking receiver to prevent overrun\n");
ath6kldev_rx_control(target->dev, false); ath6kl_hif_rx_control(target->dev, false);
} }
*num_pkts = n_fetched; *num_pkts = n_fetched;
...@@ -1893,7 +1893,7 @@ static struct htc_packet *htc_wait_for_ctrl_msg(struct htc_target *target) ...@@ -1893,7 +1893,7 @@ static struct htc_packet *htc_wait_for_ctrl_msg(struct htc_target *target)
struct htc_frame_hdr *htc_hdr; struct htc_frame_hdr *htc_hdr;
u32 look_ahead; u32 look_ahead;
if (ath6kldev_poll_mboxmsg_rx(target->dev, &look_ahead, if (ath6kl_hif_poll_mboxmsg_rx(target->dev, &look_ahead,
HTC_TARGET_RESPONSE_TIMEOUT)) HTC_TARGET_RESPONSE_TIMEOUT))
return NULL; return NULL;
...@@ -2001,7 +2001,7 @@ int ath6kl_htc_add_rxbuf_multiple(struct htc_target *target, ...@@ -2001,7 +2001,7 @@ int ath6kl_htc_add_rxbuf_multiple(struct htc_target *target,
if (rx_unblock && !(target->htc_flags & HTC_OP_STATE_STOPPING)) if (rx_unblock && !(target->htc_flags & HTC_OP_STATE_STOPPING))
/* TODO : implement a buffer threshold count? */ /* TODO : implement a buffer threshold count? */
ath6kldev_rx_control(target->dev, true); ath6kl_hif_rx_control(target->dev, true);
return status; return status;
} }
...@@ -2340,7 +2340,7 @@ int ath6kl_htc_start(struct htc_target *target) ...@@ -2340,7 +2340,7 @@ int ath6kl_htc_start(struct htc_target *target)
int status; int status;
/* Disable interrupts at the chip level */ /* Disable interrupts at the chip level */
ath6kldev_disable_intrs(target->dev); ath6kl_hif_disable_intrs(target->dev);
target->htc_flags = 0; target->htc_flags = 0;
target->rx_st_flags = 0; target->rx_st_flags = 0;
...@@ -2365,7 +2365,7 @@ int ath6kl_htc_start(struct htc_target *target) ...@@ -2365,7 +2365,7 @@ int ath6kl_htc_start(struct htc_target *target)
return status; return status;
/* unmask interrupts */ /* unmask interrupts */
status = ath6kldev_unmask_intrs(target->dev); status = ath6kl_hif_unmask_intrs(target->dev);
if (status) if (status)
ath6kl_htc_stop(target); ath6kl_htc_stop(target);
...@@ -2385,7 +2385,7 @@ void ath6kl_htc_stop(struct htc_target *target) ...@@ -2385,7 +2385,7 @@ void ath6kl_htc_stop(struct htc_target *target)
* function returns all pending HIF I/O has completed, we can * function returns all pending HIF I/O has completed, we can
* safely flush the queues. * safely flush the queues.
*/ */
ath6kldev_mask_intrs(target->dev); ath6kl_hif_mask_intrs(target->dev);
ath6kl_htc_flush_txep_all(target); ath6kl_htc_flush_txep_all(target);
...@@ -2428,7 +2428,7 @@ void *ath6kl_htc_create(struct ath6kl *ar) ...@@ -2428,7 +2428,7 @@ void *ath6kl_htc_create(struct ath6kl *ar)
reset_ep_state(target); reset_ep_state(target);
status = ath6kldev_setup(target->dev); status = ath6kl_hif_setup(target->dev);
if (status) if (status)
goto fail_create_htc; goto fail_create_htc;
......
...@@ -74,19 +74,19 @@ struct ath6kl_device { ...@@ -74,19 +74,19 @@ struct ath6kl_device {
struct ath6kl *ar; struct ath6kl *ar;
}; };
int ath6kldev_setup(struct ath6kl_device *dev); int ath6kl_hif_setup(struct ath6kl_device *dev);
int ath6kldev_unmask_intrs(struct ath6kl_device *dev); int ath6kl_hif_unmask_intrs(struct ath6kl_device *dev);
int ath6kldev_mask_intrs(struct ath6kl_device *dev); int ath6kl_hif_mask_intrs(struct ath6kl_device *dev);
int ath6kldev_poll_mboxmsg_rx(struct ath6kl_device *dev, int ath6kl_hif_poll_mboxmsg_rx(struct ath6kl_device *dev,
u32 *lk_ahd, int timeout); u32 *lk_ahd, int timeout);
int ath6kldev_rx_control(struct ath6kl_device *dev, bool enable_rx); int ath6kl_hif_rx_control(struct ath6kl_device *dev, bool enable_rx);
int ath6kldev_disable_intrs(struct ath6kl_device *dev); int ath6kl_hif_disable_intrs(struct ath6kl_device *dev);
int ath6kldev_rw_comp_handler(void *context, int status); int ath6kl_hif_rw_comp_handler(void *context, int status);
int ath6kldev_intr_bh_handler(struct ath6kl *ar); int ath6kl_hif_intr_bh_handler(struct ath6kl *ar);
/* Scatter Function and Definitions */ /* Scatter Function and Definitions */
int ath6kldev_submit_scat_req(struct ath6kl_device *dev, int ath6kl_hif_submit_scat_req(struct ath6kl_device *dev,
struct hif_scatter_req *scat_req, bool read); struct hif_scatter_req *scat_req, bool read);
#endif /*ATH6KL_H_ */ #endif /*ATH6KL_H_ */
...@@ -420,7 +420,7 @@ static void __ath6kl_sdio_write_async(struct ath6kl_sdio *ar_sdio, ...@@ -420,7 +420,7 @@ static void __ath6kl_sdio_write_async(struct ath6kl_sdio *ar_sdio,
req->request); req->request);
context = req->packet; context = req->packet;
ath6kl_sdio_free_bus_req(ar_sdio, req); ath6kl_sdio_free_bus_req(ar_sdio, req);
ath6kldev_rw_comp_handler(context, status); ath6kl_hif_rw_comp_handler(context, status);
} }
} }
...@@ -457,7 +457,7 @@ static void ath6kl_sdio_irq_handler(struct sdio_func *func) ...@@ -457,7 +457,7 @@ static void ath6kl_sdio_irq_handler(struct sdio_func *func)
*/ */
sdio_release_host(ar_sdio->func); sdio_release_host(ar_sdio->func);
status = ath6kldev_intr_bh_handler(ar_sdio->ar); status = ath6kl_hif_intr_bh_handler(ar_sdio->ar);
sdio_claim_host(ar_sdio->func); sdio_claim_host(ar_sdio->func);
atomic_set(&ar_sdio->irq_handling, 0); atomic_set(&ar_sdio->irq_handling, 0);
WARN_ON(status && status != -ECANCELED); WARN_ON(status && status != -ECANCELED);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册