Commit 2034afe4 authored by Stanislaw Gruszka's avatar Stanislaw Gruszka Committed by Kalle Valo

rt2800: add helpers for reading dma done index

For mmio we do not properlly trace dma done Q_INDEX_DMA_DONE index
for TX queues. That would require implementing INT_SOURCE_CSR_*_DMA_DONE
interrupts, what is rather not worth to do due to adding extra
CPU load (small but still somewhat not necessary otherwise).

We can just read TX DMA done indexes from registers directly. What
will be used by watchdog.
Signed-off-by: default avatarStanislaw Gruszka <sgruszka@redhat.com>
Signed-off-by: default avatarKalle Valo <kvalo@codeaurora.org>
parent 9f3e3323
...@@ -65,6 +65,7 @@ struct rt2800_ops { ...@@ -65,6 +65,7 @@ struct rt2800_ops {
const u8 *data, const size_t len); const u8 *data, const size_t len);
int (*drv_init_registers)(struct rt2x00_dev *rt2x00dev); int (*drv_init_registers)(struct rt2x00_dev *rt2x00dev);
__le32 *(*drv_get_txwi)(struct queue_entry *entry); __le32 *(*drv_get_txwi)(struct queue_entry *entry);
unsigned int (*drv_get_dma_done)(struct data_queue *queue);
}; };
static inline u32 rt2800_register_read(struct rt2x00_dev *rt2x00dev, static inline u32 rt2800_register_read(struct rt2x00_dev *rt2x00dev,
...@@ -166,6 +167,13 @@ static inline __le32 *rt2800_drv_get_txwi(struct queue_entry *entry) ...@@ -166,6 +167,13 @@ static inline __le32 *rt2800_drv_get_txwi(struct queue_entry *entry)
return rt2800ops->drv_get_txwi(entry); return rt2800ops->drv_get_txwi(entry);
} }
static inline unsigned int rt2800_drv_get_dma_done(struct data_queue *queue)
{
const struct rt2800_ops *rt2800ops = queue->rt2x00dev->ops->drv;
return rt2800ops->drv_get_dma_done(queue);
}
void rt2800_mcu_request(struct rt2x00_dev *rt2x00dev, void rt2800_mcu_request(struct rt2x00_dev *rt2x00dev,
const u8 command, const u8 token, const u8 command, const u8 token,
const u8 arg0, const u8 arg1); const u8 arg0, const u8 arg1);
......
...@@ -24,6 +24,37 @@ ...@@ -24,6 +24,37 @@
#include "rt2800lib.h" #include "rt2800lib.h"
#include "rt2800mmio.h" #include "rt2800mmio.h"
unsigned int rt2800mmio_get_dma_done(struct data_queue *queue)
{
struct rt2x00_dev *rt2x00dev = queue->rt2x00dev;
struct queue_entry *entry;
int idx, qid;
switch (queue->qid) {
case QID_AC_VO:
case QID_AC_VI:
case QID_AC_BE:
case QID_AC_BK:
qid = queue->qid;
idx = rt2x00mmio_register_read(rt2x00dev, TX_DTX_IDX(qid));
break;
case QID_MGMT:
idx = rt2x00mmio_register_read(rt2x00dev, TX_DTX_IDX(5));
break;
case QID_RX:
entry = rt2x00queue_get_entry(queue, Q_INDEX_DMA_DONE);
idx = entry->entry_idx;
break;
default:
WARN_ON_ONCE(1);
idx = 0;
break;
}
return idx;
}
EXPORT_SYMBOL_GPL(rt2800mmio_get_dma_done);
/* /*
* TX descriptor initialization * TX descriptor initialization
*/ */
......
...@@ -114,6 +114,8 @@ ...@@ -114,6 +114,8 @@
#define RXD_W3_PLCP_SIGNAL FIELD32(0x00020000) #define RXD_W3_PLCP_SIGNAL FIELD32(0x00020000)
#define RXD_W3_PLCP_RSSI FIELD32(0x00040000) #define RXD_W3_PLCP_RSSI FIELD32(0x00040000)
unsigned int rt2800mmio_get_dma_done(struct data_queue *queue);
/* TX descriptor initialization */ /* TX descriptor initialization */
__le32 *rt2800mmio_get_txwi(struct queue_entry *entry); __le32 *rt2800mmio_get_txwi(struct queue_entry *entry);
void rt2800mmio_write_tx_desc(struct queue_entry *entry, void rt2800mmio_write_tx_desc(struct queue_entry *entry,
......
...@@ -326,6 +326,7 @@ static const struct rt2800_ops rt2800pci_rt2800_ops = { ...@@ -326,6 +326,7 @@ static const struct rt2800_ops rt2800pci_rt2800_ops = {
.drv_write_firmware = rt2800pci_write_firmware, .drv_write_firmware = rt2800pci_write_firmware,
.drv_init_registers = rt2800mmio_init_registers, .drv_init_registers = rt2800mmio_init_registers,
.drv_get_txwi = rt2800mmio_get_txwi, .drv_get_txwi = rt2800mmio_get_txwi,
.drv_get_dma_done = rt2800mmio_get_dma_done,
}; };
static const struct rt2x00lib_ops rt2800pci_rt2x00_ops = { static const struct rt2x00lib_ops rt2800pci_rt2x00_ops = {
......
...@@ -171,6 +171,7 @@ static const struct rt2800_ops rt2800soc_rt2800_ops = { ...@@ -171,6 +171,7 @@ static const struct rt2800_ops rt2800soc_rt2800_ops = {
.drv_write_firmware = rt2800soc_write_firmware, .drv_write_firmware = rt2800soc_write_firmware,
.drv_init_registers = rt2800mmio_init_registers, .drv_init_registers = rt2800mmio_init_registers,
.drv_get_txwi = rt2800mmio_get_txwi, .drv_get_txwi = rt2800mmio_get_txwi,
.drv_get_dma_done = rt2800mmio_get_dma_done,
}; };
static const struct rt2x00lib_ops rt2800soc_rt2x00_ops = { static const struct rt2x00lib_ops rt2800soc_rt2x00_ops = {
......
...@@ -379,6 +379,14 @@ static int rt2800usb_set_device_state(struct rt2x00_dev *rt2x00dev, ...@@ -379,6 +379,14 @@ static int rt2800usb_set_device_state(struct rt2x00_dev *rt2x00dev,
return retval; return retval;
} }
static unsigned int rt2800usb_get_dma_done(struct data_queue *queue)
{
struct queue_entry *entry;
entry = rt2x00queue_get_entry(queue, Q_INDEX_DMA_DONE);
return entry->entry_idx;
}
/* /*
* TX descriptor initialization * TX descriptor initialization
*/ */
...@@ -661,6 +669,7 @@ static const struct rt2800_ops rt2800usb_rt2800_ops = { ...@@ -661,6 +669,7 @@ static const struct rt2800_ops rt2800usb_rt2800_ops = {
.drv_write_firmware = rt2800usb_write_firmware, .drv_write_firmware = rt2800usb_write_firmware,
.drv_init_registers = rt2800usb_init_registers, .drv_init_registers = rt2800usb_init_registers,
.drv_get_txwi = rt2800usb_get_txwi, .drv_get_txwi = rt2800usb_get_txwi,
.drv_get_dma_done = rt2800usb_get_dma_done,
}; };
static const struct rt2x00lib_ops rt2800usb_rt2x00_ops = { static const struct rt2x00lib_ops rt2800usb_rt2x00_ops = {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment