BigW Consortium Gitlab

Commit 9297fb0f by David Frey Committed by David Clark

mt7697: indent kernel code with tabs

parent 831a8bec
...@@ -29,11 +29,11 @@ static int mt7697q_irq_run(struct mt7697q_info *qinfo) ...@@ -29,11 +29,11 @@ static int mt7697q_irq_run(struct mt7697q_info *qinfo)
u8 s2m_mbox; u8 s2m_mbox;
ret = mt7697q_get_s2m_mbx(qinfo, &s2m_mbox); ret = mt7697q_get_s2m_mbx(qinfo, &s2m_mbox);
if (ret < 0) { if (ret < 0) {
dev_err(qinfo->dev, dev_err(qinfo->dev,
"%s(): mt7697q_get_s2m_mbx() failed(%d)\n", "%s(): mt7697q_get_s2m_mbx() failed(%d)\n",
__func__, ret); __func__, ret);
goto cleanup; goto cleanup;
} }
if (s2m_mbox) { if (s2m_mbox) {
...@@ -43,7 +43,7 @@ static int mt7697q_irq_run(struct mt7697q_info *qinfo) ...@@ -43,7 +43,7 @@ static int mt7697q_irq_run(struct mt7697q_info *qinfo)
"%s(): queue_delayed_work() failed\n", "%s(): queue_delayed_work() failed\n",
__func__); __func__);
ret = -EINVAL; ret = -EINVAL;
} }
} else { } else {
enable_irq(qinfo->irq); enable_irq(qinfo->irq);
} }
...@@ -61,8 +61,8 @@ static int mt7697q_irq_run(struct mt7697q_info *qinfo) ...@@ -61,8 +61,8 @@ static int mt7697q_irq_run(struct mt7697q_info *qinfo)
dev_err(qinfo->dev, dev_err(qinfo->dev,
"%s(): mt7697q_proc_data() failed(%d)\n", "%s(): mt7697q_proc_data() failed(%d)\n",
__func__, ret); __func__, ret);
goto cleanup; goto cleanup;
} }
} else if (mt7697q_blocked_writer(qs)) { } else if (mt7697q_blocked_writer(qs)) {
WARN_ON(!qs->notify_tx_fcn); WARN_ON(!qs->notify_tx_fcn);
ret = qs->notify_tx_fcn(qs->priv, ret = qs->notify_tx_fcn(qs->priv,
...@@ -71,7 +71,7 @@ static int mt7697q_irq_run(struct mt7697q_info *qinfo) ...@@ -71,7 +71,7 @@ static int mt7697q_irq_run(struct mt7697q_info *qinfo)
dev_err(qs->qinfo->dev, dev_err(qs->qinfo->dev,
"%s(): notify_tx_fcn() failed(%d)\n", "%s(): notify_tx_fcn() failed(%d)\n",
__func__, ret); __func__, ret);
} }
} }
} }
} }
...@@ -91,7 +91,7 @@ void mt7697q_irq_delayed_work(struct work_struct *irq_delayed_work) ...@@ -91,7 +91,7 @@ void mt7697q_irq_delayed_work(struct work_struct *irq_delayed_work)
if (ret < 0) { if (ret < 0) {
dev_err(qinfo->dev, "%s(): mt7697q_irq_run() failed(%d)\n", dev_err(qinfo->dev, "%s(): mt7697q_irq_run() failed(%d)\n",
__func__, ret); __func__, ret);
goto cleanup; goto cleanup;
} }
cleanup: cleanup:
...@@ -110,7 +110,7 @@ void mt7697q_irq_work(struct work_struct *irq_work) ...@@ -110,7 +110,7 @@ void mt7697q_irq_work(struct work_struct *irq_work)
dev_err(qinfo->dev, dev_err(qinfo->dev,
"%s(): mt7697q_irq_run() failed(%d)\n", "%s(): mt7697q_irq_run() failed(%d)\n",
__func__, ret); __func__, ret);
goto cleanup; goto cleanup;
} }
cleanup: cleanup:
...@@ -124,7 +124,7 @@ irqreturn_t mt7697q_isr(int irq, void *arg) ...@@ -124,7 +124,7 @@ irqreturn_t mt7697q_isr(int irq, void *arg)
disable_irq_nosync(qinfo->irq); disable_irq_nosync(qinfo->irq);
if (!queue_work(qinfo->irq_workq, &qinfo->irq_work)) { if (!queue_work(qinfo->irq_workq, &qinfo->irq_work)) {
dev_err(qinfo->dev, "%s(): queue_work() failed\n", __func__); dev_err(qinfo->dev, "%s(): queue_work() failed\n", __func__);
} }
return IRQ_HANDLED; return IRQ_HANDLED;
} }
...@@ -38,41 +38,41 @@ static int mt7697io_write16(struct mt7697q_info *qinfo, u8 reg, u16 value) ...@@ -38,41 +38,41 @@ static int mt7697io_write16(struct mt7697q_info *qinfo, u8 reg, u16 value)
value & 0xFF, value & 0xFF,
}; };
WARN_ON(reg % sizeof(u16)); WARN_ON(reg % sizeof(u16));
ret = qinfo->hw_ops->write(qinfo->hw_priv, txBuffer, sizeof(txBuffer)); ret = qinfo->hw_ops->write(qinfo->hw_priv, txBuffer, sizeof(txBuffer));
if (ret < 0) { if (ret < 0) {
dev_err(qinfo->dev, "%s(): write() failed(%d)\n", dev_err(qinfo->dev, "%s(): write() failed(%d)\n",
__func__, ret); __func__, ret);
goto cleanup; goto cleanup;
} }
cleanup: cleanup:
return ret; return ret;
} }
static int mt7697io_write32(struct mt7697q_info *qinfo, u8 reg, u32 value) static int mt7697io_write32(struct mt7697q_info *qinfo, u8 reg, u32 value)
{ {
int ret; int ret;
WARN_ON(reg % sizeof(u32)); WARN_ON(reg % sizeof(u32));
ret = mt7697io_write16(qinfo, reg, BF_GET(value, 0, 16)); ret = mt7697io_write16(qinfo, reg, BF_GET(value, 0, 16));
if (ret < 0)
goto fail;
ret = mt7697io_write16(qinfo, reg + 2, BF_GET(value, 16, 16));
if (ret < 0) if (ret < 0)
goto fail; goto fail;
ret = mt7697io_write16(qinfo, reg + 2, BF_GET(value, 16, 16));
if (ret < 0)
goto fail;
return ret; return ret;
fail: fail:
dev_err(qinfo->dev, "%s(): mt7697io_write16() failed(%d)\n", __func__, dev_err(qinfo->dev, "%s(): mt7697io_write16() failed(%d)\n", __func__,
ret); ret);
return ret; return ret;
} }
static int mt7697io_read16(struct mt7697q_info *qinfo, u8 reg, u16 *value) static int mt7697io_read16(struct mt7697q_info *qinfo, u8 reg, u16 *value)
{ {
int ret; int ret;
u8 spi_buffer[4] = { u8 spi_buffer[4] = {
MT7697_IO_CMD_READ, MT7697_IO_CMD_READ,
reg, reg,
...@@ -84,13 +84,13 @@ static int mt7697io_read16(struct mt7697q_info *qinfo, u8 reg, u16 *value) ...@@ -84,13 +84,13 @@ static int mt7697io_read16(struct mt7697q_info *qinfo, u8 reg, u16 *value)
if (ret < 0) { if (ret < 0) {
dev_err(qinfo->dev, "%s(): write_then_read() failed(%d)\n", dev_err(qinfo->dev, "%s(): write_then_read() failed(%d)\n",
__func__, ret); __func__, ret);
goto cleanup; goto cleanup;
} }
*value = ((spi_buffer[2] << 8) | spi_buffer[3]); *value = ((spi_buffer[2] << 8) | spi_buffer[3]);
cleanup: cleanup:
return ret; return ret;
} }
static int mt7697io_read32(struct mt7697q_info *qinfo, u8 reg, u32 *value) static int mt7697io_read32(struct mt7697q_info *qinfo, u8 reg, u32 *value)
...@@ -100,13 +100,13 @@ static int mt7697io_read32(struct mt7697q_info *qinfo, u8 reg, u32 *value) ...@@ -100,13 +100,13 @@ static int mt7697io_read32(struct mt7697q_info *qinfo, u8 reg, u32 *value)
u16 high; u16 high;
WARN_ON(reg % sizeof(u32)); WARN_ON(reg % sizeof(u32));
ret = mt7697io_read16(qinfo, reg, &low); ret = mt7697io_read16(qinfo, reg, &low);
if (ret < 0)
goto fail;
ret = mt7697io_read16(qinfo, reg + sizeof(u16), &high);
if (ret < 0) if (ret < 0)
goto fail; goto fail;
*value = (low | (high << 16)); ret = mt7697io_read16(qinfo, reg + sizeof(u16), &high);
if (ret < 0)
goto fail;
*value = (low | (high << 16));
return ret; return ret;
...@@ -119,19 +119,19 @@ fail: ...@@ -119,19 +119,19 @@ fail:
static int mt7697io_chk_slave_busy(struct mt7697q_info *qinfo, bool *slave_busy) static int mt7697io_chk_slave_busy(struct mt7697q_info *qinfo, bool *slave_busy)
{ {
int ret; int ret;
u16 value; u16 value;
ret = mt7697io_read16(qinfo, MT7697_IO_SLAVE_REG_STATUS, &value); ret = mt7697io_read16(qinfo, MT7697_IO_SLAVE_REG_STATUS, &value);
if (ret < 0) { if (ret < 0) {
dev_err(qinfo->dev, "%s(): mt7697io_read16() failed(%d)\n", dev_err(qinfo->dev, "%s(): mt7697io_read16() failed(%d)\n",
__func__, ret); __func__, ret);
goto cleanup; goto cleanup;
} }
*slave_busy = mt7697io_busy(value); *slave_busy = mt7697io_busy(value);
cleanup: cleanup:
return ret; return ret;
} }
static int mt7697io_slave_wait(struct mt7697q_info *qinfo) static int mt7697io_slave_wait(struct mt7697q_info *qinfo)
...@@ -144,13 +144,13 @@ static int mt7697io_slave_wait(struct mt7697q_info *qinfo) ...@@ -144,13 +144,13 @@ static int mt7697io_slave_wait(struct mt7697q_info *qinfo)
dev_err(qinfo->dev, dev_err(qinfo->dev,
"%s(): mt7697io_chk_slave_busy() failed(%d)\n", "%s(): mt7697io_chk_slave_busy() failed(%d)\n",
__func__, ret); __func__, ret);
goto cleanup; goto cleanup;
} }
udelay(1); udelay(1);
} while (slave_busy); } while (slave_busy);
cleanup: cleanup:
return ret; return ret;
} }
static u8 mt7697io_get_s2m_mbox(u16 value) static u8 mt7697io_get_s2m_mbox(u16 value)
...@@ -175,38 +175,38 @@ int mt7697io_wr_m2s_mbx(struct mt7697q_info *qinfo, u8 bits) ...@@ -175,38 +175,38 @@ int mt7697io_wr_m2s_mbx(struct mt7697q_info *qinfo, u8 bits)
MT7697_IO_M2S_MAILBOX_REG_MAILBOX_WIDTH); MT7697_IO_M2S_MAILBOX_REG_MAILBOX_WIDTH);
dev_dbg(qinfo->dev, "%s(): m2s mbx(0x%02x)\n", __func__, bits); dev_dbg(qinfo->dev, "%s(): m2s mbx(0x%02x)\n", __func__, bits);
WARN_ON((GENMASK(MT7697_IO_M2S_MAILBOX_REG_MAILBOX_WIDTH, 0) & bits) != WARN_ON((GENMASK(MT7697_IO_M2S_MAILBOX_REG_MAILBOX_WIDTH, 0) & bits) !=
bits); bits);
ret = mt7697io_write16(qinfo, MT7697_IO_SLAVE_REG_MAILBOX_M2S, value); ret = mt7697io_write16(qinfo, MT7697_IO_SLAVE_REG_MAILBOX_M2S, value);
if (ret < 0) { if (ret < 0) {
dev_err(qinfo->dev, "%s(): mt7697io_write16() failed(%d)\n", dev_err(qinfo->dev, "%s(): mt7697io_write16() failed(%d)\n",
__func__, ret); __func__, ret);
goto cleanup; goto cleanup;
} }
cleanup: cleanup:
return ret; return ret;
} }
int mt7697io_rd_s2m_mbx(struct mt7697q_info *qinfo, u8 *s2m_mbx) int mt7697io_rd_s2m_mbx(struct mt7697q_info *qinfo, u8 *s2m_mbx)
{ {
int ret; int ret;
u16 value; u16 value;
ret = mt7697io_read16(qinfo, MT7697_IO_SLAVE_REG_MAILBOX_S2M, &value); ret = mt7697io_read16(qinfo, MT7697_IO_SLAVE_REG_MAILBOX_S2M, &value);
if (ret < 0) { if (ret < 0) {
dev_err(qinfo->dev, "%s(): mt7697io_read16() failed(%d)\n", dev_err(qinfo->dev, "%s(): mt7697io_read16() failed(%d)\n",
__func__, ret); __func__, ret);
goto cleanup; goto cleanup;
} }
*s2m_mbx = mt7697io_get_s2m_mbox(value); *s2m_mbx = mt7697io_get_s2m_mbox(value);
dev_dbg(qinfo->dev, "%s(): s2m mbx(0x%02x)\n", dev_dbg(qinfo->dev, "%s(): s2m mbx(0x%02x)\n",
__func__, *s2m_mbx); __func__, *s2m_mbx);
cleanup: cleanup:
return ret; return ret;
} }
int mt7697io_clr_s2m_mbx(struct mt7697q_info *qinfo, u8 s2m_mbx) int mt7697io_clr_s2m_mbx(struct mt7697q_info *qinfo, u8 s2m_mbx)
...@@ -214,13 +214,13 @@ int mt7697io_clr_s2m_mbx(struct mt7697q_info *qinfo, u8 s2m_mbx) ...@@ -214,13 +214,13 @@ int mt7697io_clr_s2m_mbx(struct mt7697q_info *qinfo, u8 s2m_mbx)
const u16 value = mt7697io_set_s2m_mbox(s2m_mbx); const u16 value = mt7697io_set_s2m_mbox(s2m_mbx);
int ret; int ret;
ret = mt7697io_write16(qinfo, MT7697_IO_SLAVE_REG_MAILBOX_S2M, value); ret = mt7697io_write16(qinfo, MT7697_IO_SLAVE_REG_MAILBOX_S2M, value);
if (ret < 0) { if (ret < 0) {
dev_err(qinfo->dev, "%s(): mt7697io_write16() failed(%d)\n", dev_err(qinfo->dev, "%s(): mt7697io_write16() failed(%d)\n",
__func__, ret); __func__, ret);
} }
return ret; return ret;
} }
int mt7697io_wr(struct mt7697q_info *qinfo, u32 addr, const u32 *data, int mt7697io_wr(struct mt7697q_info *qinfo, u32 addr, const u32 *data,
...@@ -229,26 +229,26 @@ int mt7697io_wr(struct mt7697q_info *qinfo, u32 addr, const u32 *data, ...@@ -229,26 +229,26 @@ int mt7697io_wr(struct mt7697q_info *qinfo, u32 addr, const u32 *data,
size_t i; size_t i;
int ret; int ret;
WARN_ON(num == 0); WARN_ON(num == 0);
ret = mt7697io_write32(qinfo, MT7697_IO_SLAVE_REG_BUS_ADDR_LOW, addr); ret = mt7697io_write32(qinfo, MT7697_IO_SLAVE_REG_BUS_ADDR_LOW, addr);
if (ret < 0) { if (ret < 0) {
dev_err(qinfo->dev, "%s(): mt7697io_write32() failed(%d)\n", dev_err(qinfo->dev, "%s(): mt7697io_write32() failed(%d)\n",
__func__, ret); __func__, ret);
goto cleanup; goto cleanup;
} }
for (i = 0; i < num; i++) { for (i = 0; i < num; i++) {
ret = mt7697io_write32( ret = mt7697io_write32(
qinfo, MT7697_IO_SLAVE_REG_WRITE_DATA_LOW, data[i]); qinfo, MT7697_IO_SLAVE_REG_WRITE_DATA_LOW, data[i]);
if (ret < 0) { if (ret < 0) {
dev_err(qinfo->dev, dev_err(qinfo->dev,
"%s(): mt7697io_write32() failed(%d)\n", "%s(): mt7697io_write32() failed(%d)\n",
__func__, ret); __func__, ret);
goto cleanup; goto cleanup;
} }
ret = mt7697io_write16(qinfo, MT7697_IO_SLAVE_REG_COMMAND, ( ret = mt7697io_write16(qinfo, MT7697_IO_SLAVE_REG_COMMAND, (
BF_DEFINE(MT7697_IO_COMMAND_REG_BUS_SIZE_VAL_WORD, BF_DEFINE(MT7697_IO_COMMAND_REG_BUS_SIZE_VAL_WORD,
MT7697_IO_COMMAND_REG_BUS_SIZE_OFFSET, MT7697_IO_COMMAND_REG_BUS_SIZE_OFFSET,
MT7697_IO_COMMAND_REG_BUS_SIZE_WIDTH) | MT7697_IO_COMMAND_REG_BUS_SIZE_WIDTH) |
...@@ -259,20 +259,20 @@ int mt7697io_wr(struct mt7697q_info *qinfo, u32 addr, const u32 *data, ...@@ -259,20 +259,20 @@ int mt7697io_wr(struct mt7697q_info *qinfo, u32 addr, const u32 *data,
dev_err(qinfo->dev, dev_err(qinfo->dev,
"%s(): mt7697io_write16() failed(%d)\n", "%s(): mt7697io_write16() failed(%d)\n",
__func__, ret); __func__, ret);
goto cleanup; goto cleanup;
} }
ret = mt7697io_slave_wait(qinfo); ret = mt7697io_slave_wait(qinfo);
if (ret < 0) { if (ret < 0) {
dev_err(qinfo->dev, dev_err(qinfo->dev,
"%s(): mt7697io_slave_wait() failed(%d)\n", "%s(): mt7697io_slave_wait() failed(%d)\n",
__func__, ret); __func__, ret);
goto cleanup; goto cleanup;
} }
} }
cleanup: cleanup:
return ret; return ret;
} }
int mt7697io_rd(struct mt7697q_info *qinfo, u32 addr, u32 *data, size_t num) int mt7697io_rd(struct mt7697q_info *qinfo, u32 addr, u32 *data, size_t num)
...@@ -280,65 +280,67 @@ int mt7697io_rd(struct mt7697q_info *qinfo, u32 addr, u32 *data, size_t num) ...@@ -280,65 +280,67 @@ int mt7697io_rd(struct mt7697q_info *qinfo, u32 addr, u32 *data, size_t num)
size_t i; size_t i;
int ret; int ret;
WARN_ON(num == 0); WARN_ON(num == 0);
ret = mt7697io_write32(qinfo, MT7697_IO_SLAVE_REG_BUS_ADDR_LOW, addr); ret = mt7697io_write32(qinfo, MT7697_IO_SLAVE_REG_BUS_ADDR_LOW, addr);
if (ret < 0) { if (ret < 0) {
dev_err(qinfo->dev, "%s(): mt7697io_write32() failed(%d)\n", dev_err(qinfo->dev, "%s(): mt7697io_write32() failed(%d)\n",
__func__, ret); __func__, ret);
goto cleanup; goto cleanup;
} }
for (i = 0; i < num; i++) { for (i = 0; i < num; i++) {
ret = mt7697io_write16(qinfo, MT7697_IO_SLAVE_REG_COMMAND, ( ret = mt7697io_write16(
BF_DEFINE(MT7697_IO_COMMAND_REG_BUS_SIZE_VAL_WORD, qinfo, MT7697_IO_SLAVE_REG_COMMAND, (
MT7697_IO_COMMAND_REG_BUS_SIZE_OFFSET, BF_DEFINE(MT7697_IO_COMMAND_REG_BUS_SIZE_VAL_WORD,
MT7697_IO_COMMAND_REG_BUS_SIZE_WIDTH) | MT7697_IO_COMMAND_REG_BUS_SIZE_OFFSET,
BF_DEFINE(MT7697_IO_COMMAND_REG_RW_VAL_READ, MT7697_IO_COMMAND_REG_BUS_SIZE_WIDTH) |
MT7697_IO_COMMAND_REG_RW_OFFSET, BF_DEFINE(MT7697_IO_COMMAND_REG_RW_VAL_READ,
MT7697_IO_COMMAND_REG_RW_WIDTH))); MT7697_IO_COMMAND_REG_RW_OFFSET,
MT7697_IO_COMMAND_REG_RW_WIDTH)));
if (ret < 0) { if (ret < 0) {
dev_err(qinfo->dev, dev_err(qinfo->dev,
"%s(): mt7697io_write16() failed(%d)\n", "%s(): mt7697io_write16() failed(%d)\n",
__func__, ret); __func__, ret);
goto cleanup; goto cleanup;
} }
ret = mt7697io_slave_wait(qinfo); ret = mt7697io_slave_wait(qinfo);
if (ret < 0) { if (ret < 0) {
dev_err(qinfo->dev, dev_err(qinfo->dev,
"%s(): mt7697io_slave_wait() failed(%d)\n", "%s(): mt7697io_slave_wait() failed(%d)\n",
__func__, ret); __func__, ret);
goto cleanup; goto cleanup;
} }
ret = mt7697io_read32( ret = mt7697io_read32(
qinfo, MT7697_IO_SLAVE_REG_READ_DATA_LOW, &data[i]); qinfo, MT7697_IO_SLAVE_REG_READ_DATA_LOW, &data[i]);
if (ret < 0) { if (ret < 0) {
dev_err(qinfo->dev, dev_err(qinfo->dev,
"%s(): mt7697io_read32() failed(%d)\n", "%s(): mt7697io_read32() failed(%d)\n",
__func__, ret); __func__, ret);
goto cleanup; goto cleanup;
} }
} }
cleanup: cleanup:
return ret; return ret;
} }
int mt7697io_trigger_intr(struct mt7697q_info *qinfo) int mt7697io_trigger_intr(struct mt7697q_info *qinfo)
{ {
int ret = mt7697io_write16(qinfo, MT7697_IO_SLAVE_REG_IRQ, int ret = mt7697io_write16(
BF_DEFINE(MT7697_IO_IRQ_REG_IRQ_STATUS_VAL_ACTIVE, qinfo, MT7697_IO_SLAVE_REG_IRQ,
MT7697_IO_IRQ_REG_IRQ_STATUS_OFFSET, BF_DEFINE(MT7697_IO_IRQ_REG_IRQ_STATUS_VAL_ACTIVE,
MT7697_IO_IRQ_REG_IRQ_STATUS_WIDTH)); MT7697_IO_IRQ_REG_IRQ_STATUS_OFFSET,
MT7697_IO_IRQ_REG_IRQ_STATUS_WIDTH));
if (ret < 0) { if (ret < 0) {
dev_err(qinfo->dev, "%s(): mt7697io_write16() failed(%d)\n", dev_err(qinfo->dev, "%s(): mt7697io_write16() failed(%d)\n",
__func__, ret); __func__, ret);
goto cleanup; goto cleanup;
} }
cleanup: cleanup:
return ret; return ret;
} }
...@@ -35,39 +35,39 @@ ...@@ -35,39 +35,39 @@
#define MT7697_QUEUE_DEBUG_DUMP_LIMIT 1024 #define MT7697_QUEUE_DEBUG_DUMP_LIMIT 1024
struct mt7697q_data { struct mt7697q_data {
u32 flags; u32 flags;
u32 base_addr; u32 base_addr;
u16 rd_offset; u16 rd_offset;
u16 reserved1; u16 reserved1;
u16 wr_offset; u16 wr_offset;
u16 reserved2; u16 reserved2;
}; };
struct mt7697q_spec { struct mt7697q_spec {
struct mt7697q_data data; struct mt7697q_data data;
struct mt7697q_info *qinfo; struct mt7697q_info *qinfo;
void *priv; void *priv;
notify_tx_hndlr notify_tx_fcn; notify_tx_hndlr notify_tx_fcn;
rx_hndlr rx_fcn; rx_hndlr rx_fcn;
u8 ch; u8 ch;
}; };
struct mt7697q_info { struct mt7697q_info {
struct mt7697q_spec queues[MT7697_NUM_QUEUES]; struct mt7697q_spec queues[MT7697_NUM_QUEUES];
struct mt7697_rsp_hdr rsp; struct mt7697_rsp_hdr rsp;
struct device *dev; struct device *dev;
void *hw_priv; void *hw_priv;
const struct mt7697spi_hw_ops *hw_ops; const struct mt7697spi_hw_ops *hw_ops;
struct mutex mutex; struct mutex mutex;
struct workqueue_struct *irq_workq; struct workqueue_struct *irq_workq;
struct work_struct irq_work; struct work_struct irq_work;
struct delayed_work irq_delayed_work; struct delayed_work irq_delayed_work;
atomic_t blocked_writer; atomic_t blocked_writer;
int gpio_pin; int gpio_pin;
int irq; int irq;
}; };
void mt7697q_irq_delayed_work(struct work_struct*); void mt7697q_irq_delayed_work(struct work_struct*);
......
...@@ -19,13 +19,13 @@ ...@@ -19,13 +19,13 @@
#include "mt7697_i.h" #include "mt7697_i.h"
#define mt7697_queue_init_rsp mt7697_rsp_hdr #define mt7697_queue_init_rsp mt7697_rsp_hdr
#define mt7697_queue_reset_rsp mt7697_rsp_hdr #define mt7697_queue_reset_rsp mt7697_rsp_hdr
enum mt7697q_dir enum mt7697q_dir
{ {
MT7697_QUEUE_DIR_M2S = 0, MT7697_QUEUE_DIR_M2S = 0,
MT7697_QUEUE_DIR_S2M, MT7697_QUEUE_DIR_S2M,
}; };
enum mt7697q_cmd_types { enum mt7697q_cmd_types {
...@@ -37,21 +37,21 @@ enum mt7697q_cmd_types { ...@@ -37,21 +37,21 @@ enum mt7697q_cmd_types {
}; };
struct mt7697_queue_init_req { struct mt7697_queue_init_req {
struct mt7697_cmd_hdr cmd; struct mt7697_cmd_hdr cmd;
__be32 m2s_ch; __be32 m2s_ch;
__be32 s2m_ch; __be32 s2m_ch;
} __attribute__((packed, aligned(4))); } __attribute__((packed, aligned(4)));
struct mt7697_queue_unused_req { struct mt7697_queue_unused_req {
struct mt7697_cmd_hdr cmd; struct mt7697_cmd_hdr cmd;
__be32 m2s_ch; __be32 m2s_ch;
__be32 s2m_ch; __be32 s2m_ch;
} __attribute__((packed, aligned(4))); } __attribute__((packed, aligned(4)));
struct mt7697_queue_reset_req { struct mt7697_queue_reset_req {
struct mt7697_cmd_hdr cmd; struct mt7697_cmd_hdr cmd;
__be32 m2s_ch; __be32 m2s_ch;
__be32 s2m_ch; __be32 s2m_ch;
} __attribute__((packed, aligned(4))); } __attribute__((packed, aligned(4)));
u32 mt7697q_flags_get_in_use(u32); u32 mt7697q_flags_get_in_use(u32);
......
...@@ -31,7 +31,7 @@ ...@@ -31,7 +31,7 @@
#include "spi.h" #include "spi.h"
static int mt7697spi_write_then_read(struct spi_device *spi, const void *txbuf, static int mt7697spi_write_then_read(struct spi_device *spi, const void *txbuf,
void *rxbuf, unsigned len) void *rxbuf, unsigned len)
{ {
struct spi_transfer transfer = { struct spi_transfer transfer = {
.tx_buf = txbuf, .tx_buf = txbuf,
...@@ -98,19 +98,19 @@ static int __init mt7697spi_init(void) ...@@ -98,19 +98,19 @@ static int __init mt7697spi_init(void)
ret = cp2130_update_ch_config(master, MT7697_SPI_CONFIG); ret = cp2130_update_ch_config(master, MT7697_SPI_CONFIG);
if (ret < 0) { if (ret < 0) {
dev_err(&master->dev, dev_err(&master->dev,
"%s(): cp2130_update_ch_config() failed(%d)\n", "%s(): cp2130_update_ch_config() failed(%d)\n",
__func__, ret); __func__, ret);
goto cleanup; goto cleanup;
} }
snprintf(str, sizeof(str), "%s.%u", dev_name(&master->dev), snprintf(str, sizeof(str), "%s.%u", dev_name(&master->dev),
MT7697_SPI_CS); MT7697_SPI_CS);
dev_info(&master->dev, "%s(): find SPI device('%s')\n", __func__, str); dev_info(&master->dev, "%s(): find SPI device('%s')\n", __func__, str);
dev = bus_find_device_by_name(&spi_bus_type, NULL, str); dev = bus_find_device_by_name(&spi_bus_type, NULL, str);
if (!dev) { if (!dev) {
dev_err(&master->dev, dev_err(&master->dev,
"%s(): bus_find_device_by_name('%s') failed\n", "%s(): bus_find_device_by_name('%s') failed\n",
__func__, str); __func__, str);
ret = -EINVAL; ret = -EINVAL;
goto cleanup; goto cleanup;
...@@ -119,65 +119,65 @@ static int __init mt7697spi_init(void) ...@@ -119,65 +119,65 @@ static int __init mt7697spi_init(void)
spi = to_spi_device(dev); spi = to_spi_device(dev);
if (!spi) { if (!spi) {
dev_err(&master->dev, "%s(): get SPI device failed\n", dev_err(&master->dev, "%s(): get SPI device failed\n",
__func__); __func__);
ret = -EINVAL; ret = -EINVAL;
goto cleanup; goto cleanup;
} }
dev_info(&master->dev, "%s(): dev('%s') mode(%d) max speed(%d) " dev_info(&master->dev, "%s(): dev('%s') mode(%d) max speed(%d) "
"CS(%d) bits/word(%d)\n", "CS(%d) bits/word(%d)\n",
__func__, spi->modalias, spi->mode, spi->max_speed_hz, __func__, spi->modalias, spi->mode, spi->max_speed_hz,
spi->chip_select, spi->bits_per_word); spi->chip_select, spi->bits_per_word);
qinfo = kzalloc(sizeof(struct mt7697q_info), GFP_KERNEL); qinfo = kzalloc(sizeof(struct mt7697q_info), GFP_KERNEL);
if (!qinfo) { if (!qinfo) {
dev_err(&master->dev, "%s(): create queue info failed\n", dev_err(&master->dev, "%s(): create queue info failed\n",
__func__); __func__);
ret = -ENOMEM; ret = -ENOMEM;
goto cleanup; goto cleanup;
} }
qinfo->dev = &spi->dev; qinfo->dev = &spi->dev;
qinfo->hw_priv = spi; qinfo->hw_priv = spi;
qinfo->hw_ops = &hw_ops; qinfo->hw_ops = &hw_ops;
mutex_init(&qinfo->mutex); mutex_init(&qinfo->mutex);
INIT_DELAYED_WORK(&qinfo->irq_delayed_work, mt7697q_irq_delayed_work); INIT_DELAYED_WORK(&qinfo->irq_delayed_work, mt7697q_irq_delayed_work);
INIT_WORK(&qinfo->irq_work, mt7697q_irq_work); INIT_WORK(&qinfo->irq_work, mt7697q_irq_work);
qinfo->irq_workq = alloc_workqueue(DRVNAME"wq", qinfo->irq_workq = alloc_workqueue(DRVNAME"wq",
WQ_HIGHPRI | WQ_MEM_RECLAIM | WQ_UNBOUND, 1); WQ_HIGHPRI | WQ_MEM_RECLAIM | WQ_UNBOUND, 1);
if (!qinfo->irq_workq) { if (!qinfo->irq_workq) {
dev_err(qinfo->dev, "%s(): alloc_workqueue() failed\n", dev_err(qinfo->dev, "%s(): alloc_workqueue() failed\n",
__func__); __func__);
ret = -ENOMEM; ret = -ENOMEM;
goto cleanup; goto cleanup;
} }
qinfo->gpio_pin = MT7697_SPI_INTR_GPIO_PIN; qinfo->gpio_pin = MT7697_SPI_INTR_GPIO_PIN;
ret = gpio_request(qinfo->gpio_pin, MT7697_SPI_GPIO_IRQ_NAME); ret = gpio_request(qinfo->gpio_pin, MT7697_SPI_GPIO_IRQ_NAME);
if (ret < 0) { if (ret < 0) {
if (ret != -EBUSY) { if (ret != -EBUSY) {
dev_err(qinfo->dev, "%s(): gpio_request() failed(%d)", dev_err(qinfo->dev, "%s(): gpio_request() failed(%d)",
__func__, ret); __func__, ret);
goto failed_workqueue; goto failed_workqueue;
} }
qinfo->irq = gpio_to_irq(qinfo->gpio_pin); qinfo->irq = gpio_to_irq(qinfo->gpio_pin);
qinfo->gpio_pin = MT7697_SPI_INTR_GPIO_PIN_INVALID; qinfo->gpio_pin = MT7697_SPI_INTR_GPIO_PIN_INVALID;
} else { } else {
gpio_direction_input(qinfo->gpio_pin); gpio_direction_input(qinfo->gpio_pin);
qinfo->irq = gpio_to_irq(qinfo->gpio_pin); qinfo->irq = gpio_to_irq(qinfo->gpio_pin);
} }
dev_info(qinfo->dev, "%s(): request irq(%d)\n", __func__, qinfo->irq); dev_info(qinfo->dev, "%s(): request irq(%d)\n", __func__, qinfo->irq);
ret = request_irq(qinfo->irq, mt7697q_isr, 0, DRVNAME, qinfo); ret = request_irq(qinfo->irq, mt7697q_isr, 0, DRVNAME, qinfo);
if (ret < 0) { if (ret < 0) {
dev_err(qinfo->dev, "%s(): request_irq() failed(%d)", dev_err(qinfo->dev, "%s(): request_irq() failed(%d)",
__func__, ret); __func__, ret);
goto failed_gpio_req; goto failed_gpio_req;
} }
irq_set_irq_type(qinfo->irq, IRQ_TYPE_EDGE_BOTH); irq_set_irq_type(qinfo->irq, IRQ_TYPE_EDGE_BOTH);
...@@ -218,27 +218,27 @@ static void __exit mt7697spi_exit(void) ...@@ -218,27 +218,27 @@ static void __exit mt7697spi_exit(void)
} }
snprintf(str, sizeof(str), "%s.%u", dev_name(&master->dev), snprintf(str, sizeof(str), "%s.%u", dev_name(&master->dev),
MT7697_SPI_CS); MT7697_SPI_CS);
dev_info(&master->dev, "%s(): find SPI device('%s')\n", __func__, str); dev_info(&master->dev, "%s(): find SPI device('%s')\n", __func__, str);
dev = bus_find_device_by_name(&spi_bus_type, NULL, str); dev = bus_find_device_by_name(&spi_bus_type, NULL, str);
if (!dev) { if (!dev) {
dev_err(&master->dev, dev_err(&master->dev,
"%s(): '%s' bus_find_device_by_name() failed\n", "%s(): '%s' bus_find_device_by_name() failed\n",
__func__, str); __func__, str);
goto cleanup; goto cleanup;
} }
spi = to_spi_device(dev); spi = to_spi_device(dev);
if (!spi) { if (!spi) {
dev_err(dev, "%s(): get SPI device failed\n", dev_err(dev, "%s(): get SPI device failed\n",
__func__); __func__);
goto cleanup; goto cleanup;
} }
qinfo = spi_get_drvdata(spi); qinfo = spi_get_drvdata(spi);
if (!qinfo) { if (!qinfo) {
dev_err(dev, "%s(): SPI device no queue info\n", dev_err(dev, "%s(): SPI device no queue info\n",
__func__); __func__);
goto cleanup; goto cleanup;
} }
......
...@@ -22,12 +22,12 @@ ...@@ -22,12 +22,12 @@
#include "mt7697_i.h" #include "mt7697_i.h"
#include "uart_i.h" #include "uart_i.h"
#define MT7697_UART_DRVNAME "mt7697serial" #define MT7697_UART_DRVNAME "mt7697serial"
#define MT7697_UART_DEVICE "/dev/ttyHS0" #define MT7697_UART_DEVICE "/dev/ttyHS0"
#define MT7697_UART_INVALID_FD NULL #define MT7697_UART_INVALID_FD NULL
#define mt7697_uart_shutdown_req mt7697_cmd_hdr #define mt7697_uart_shutdown_req mt7697_cmd_hdr
#define mt7697_uart_shutdown_rsp mt7697_rsp_hdr #define mt7697_uart_shutdown_rsp mt7697_rsp_hdr
enum mt7697_uart_cmd_types { enum mt7697_uart_cmd_types {
MT7697_CMD_UART_SHUTDOWN_REQ = 0, MT7697_CMD_UART_SHUTDOWN_REQ = 0,
...@@ -35,20 +35,20 @@ enum mt7697_uart_cmd_types { ...@@ -35,20 +35,20 @@ enum mt7697_uart_cmd_types {
}; };
struct mt7697_uart_info { struct mt7697_uart_info {
struct platform_device *pdev; struct platform_device *pdev;
struct device *dev; struct device *dev;
char* dev_file; char *dev_file;
struct file *fd_hndl; struct file *fd_hndl;
struct mutex mutex; struct mutex mutex;
struct work_struct rx_work; struct work_struct rx_work;
struct mt7697_rsp_hdr rsp; struct mt7697_rsp_hdr rsp;
rx_hndlr rx_fcn; rx_hndlr rx_fcn;
void *rx_hndl; void *rx_hndl;
wait_queue_head_t close_wq; wait_queue_head_t close_wq;
atomic_t close; atomic_t close;
}; };
#endif #endif
...@@ -66,19 +66,19 @@ enum mt7697_sme_state { ...@@ -66,19 +66,19 @@ enum mt7697_sme_state {
}; };
enum mt7697_vif_state { enum mt7697_vif_state {
CONNECTED, CONNECTED,
CONNECT_PEND, CONNECT_PEND,
WMM_ENABLED, WMM_ENABLED,
NETQ_STOPPED, NETQ_STOPPED,
DTIM_EXPIRED, DTIM_EXPIRED,
CLEAR_BSSFILTER_ON_BEACON, CLEAR_BSSFILTER_ON_BEACON,
DTIM_PERIOD_AVAIL, DTIM_PERIOD_AVAIL,
WLAN_ENABLED, WLAN_ENABLED,
STATS_UPDATE_PEND, STATS_UPDATE_PEND,
HOST_SLEEP_MODE_CMD_PROCESSED, HOST_SLEEP_MODE_CMD_PROCESSED,
NETDEV_MCAST_ALL_ON, NETDEV_MCAST_ALL_ON,
NETDEV_MCAST_ALL_OFF, NETDEV_MCAST_ALL_OFF,
SCHED_SCANNING, SCHED_SCANNING,
}; };
struct mt7697_tx_pkt { struct mt7697_tx_pkt {
...@@ -88,7 +88,7 @@ struct mt7697_tx_pkt { ...@@ -88,7 +88,7 @@ struct mt7697_tx_pkt {
struct mt7697_cfg80211_info { struct mt7697_cfg80211_info {
struct device *dev; struct device *dev;
struct wiphy *wiphy; struct wiphy *wiphy;
struct semaphore sem; struct semaphore sem;
struct platform_device *hif_priv; struct platform_device *hif_priv;
...@@ -196,12 +196,12 @@ struct mt7697_vif { ...@@ -196,12 +196,12 @@ struct mt7697_vif {
static inline struct wiphy *cfg_to_wiphy(struct mt7697_cfg80211_info *cfg) static inline struct wiphy *cfg_to_wiphy(struct mt7697_cfg80211_info *cfg)
{ {
return cfg->wiphy; return cfg->wiphy;
} }
static inline struct mt7697_cfg80211_info *wiphy_to_cfg(struct wiphy *w) static inline struct mt7697_cfg80211_info *wiphy_to_cfg(struct wiphy *w)
{ {
return (struct mt7697_cfg80211_info *)(wiphy_priv(w)); return (struct mt7697_cfg80211_info *)(wiphy_priv(w));
} }
static inline struct mt7697_cfg80211_info *mt7697_priv(struct net_device *ndev) static inline struct mt7697_cfg80211_info *mt7697_priv(struct net_device *ndev)
...@@ -211,7 +211,7 @@ static inline struct mt7697_cfg80211_info *mt7697_priv(struct net_device *ndev) ...@@ -211,7 +211,7 @@ static inline struct mt7697_cfg80211_info *mt7697_priv(struct net_device *ndev)
static inline struct mt7697_vif *mt7697_vif_from_wdev(struct wireless_dev *wdev) static inline struct mt7697_vif *mt7697_vif_from_wdev(struct wireless_dev *wdev)
{ {
return container_of(wdev, struct mt7697_vif, wdev); return container_of(wdev, struct mt7697_vif, wdev);
} }
void mt7697_init_netdev(struct net_device*); void mt7697_init_netdev(struct net_device*);
......
...@@ -36,15 +36,15 @@ MODULE_PARM_DESC(itf_idx_start, "MT7697 WiFi interface start index"); ...@@ -36,15 +36,15 @@ MODULE_PARM_DESC(itf_idx_start, "MT7697 WiFi interface start index");
static void mt7697_to_lower(char** in) static void mt7697_to_lower(char** in)
{ {
char* ptr = (char*)*in; char* ptr = (char*)*in;
while (*ptr != '\0') { while (*ptr != '\0') {
if (((*ptr <= 'Z') && (*ptr >= 'A')) || if (((*ptr <= 'Z') && (*ptr >= 'A')) ||
((*ptr <= 'z') && (*ptr >= 'a'))) ((*ptr <= 'z') && (*ptr >= 'a')))
*ptr = ((*ptr <= 'Z') && (*ptr >= 'A')) ? *ptr = ((*ptr <= 'Z') && (*ptr >= 'A')) ?
*ptr + 'a' - 'A':*ptr; *ptr + 'a' - 'A':*ptr;
ptr++; ptr++;
} }
} }
static int mt7697_open(struct net_device *ndev) static int mt7697_open(struct net_device *ndev)
...@@ -55,8 +55,8 @@ static int mt7697_open(struct net_device *ndev) ...@@ -55,8 +55,8 @@ static int mt7697_open(struct net_device *ndev)
dev_dbg(cfg->dev, "%s(): open net device\n", __func__); dev_dbg(cfg->dev, "%s(): open net device\n", __func__);
if (!cfg->rxq_hdl && !cfg->txq_hdl) { if (!cfg->rxq_hdl && !cfg->txq_hdl) {
dev_dbg(cfg->dev, "%s(): open mt7697 uart\n", __func__); dev_dbg(cfg->dev, "%s(): open mt7697 uart\n", __func__);
cfg->txq_hdl = cfg->hif_ops->open(mt7697_proc_80211cmd, cfg); cfg->txq_hdl = cfg->hif_ops->open(mt7697_proc_80211cmd, cfg);
if (!cfg->txq_hdl) { if (!cfg->txq_hdl) {
dev_err(cfg->dev, "%s(): open() failed\n", __func__); dev_err(cfg->dev, "%s(): open() failed\n", __func__);
...@@ -64,7 +64,7 @@ static int mt7697_open(struct net_device *ndev) ...@@ -64,7 +64,7 @@ static int mt7697_open(struct net_device *ndev)
} }
cfg->rxq_hdl = cfg->txq_hdl; cfg->rxq_hdl = cfg->txq_hdl;
} }
set_bit(WLAN_ENABLED, &vif->flags); set_bit(WLAN_ENABLED, &vif->flags);
...@@ -140,7 +140,7 @@ static void mt7697_set_multicast_list(struct net_device *ndev) ...@@ -140,7 +140,7 @@ static void mt7697_set_multicast_list(struct net_device *ndev)
static void mt7697_init_hw_start(struct work_struct *work) static void mt7697_init_hw_start(struct work_struct *work)
{ {
struct mt7697_cfg80211_info *cfg = container_of(work, struct mt7697_cfg80211_info *cfg = container_of(work,
struct mt7697_cfg80211_info, init_work); struct mt7697_cfg80211_info, init_work);
int err; int err;
...@@ -151,7 +151,7 @@ static void mt7697_init_hw_start(struct work_struct *work) ...@@ -151,7 +151,7 @@ static void mt7697_init_hw_start(struct work_struct *work)
err = cfg->hif_ops->init(MT7697_MAC80211_QUEUE_TX, err = cfg->hif_ops->init(MT7697_MAC80211_QUEUE_TX,
MT7697_MAC80211_QUEUE_RX, cfg, MT7697_MAC80211_QUEUE_RX, cfg,
mt7697_notify_tx, mt7697_notify_tx,
mt7697_proc_80211cmd, mt7697_proc_80211cmd,
&cfg->txq_hdl, &cfg->rxq_hdl); &cfg->txq_hdl, &cfg->rxq_hdl);
if (err < 0) { if (err < 0) {
dev_err(cfg->dev, "%s(): queue(%u) init() failed(%d)\n", dev_err(cfg->dev, "%s(): queue(%u) init() failed(%d)\n",
...@@ -181,22 +181,22 @@ failed: ...@@ -181,22 +181,22 @@ failed:
} }
static const struct net_device_ops mt7697_netdev_ops = { static const struct net_device_ops mt7697_netdev_ops = {
.ndo_open = mt7697_open, .ndo_open = mt7697_open,
.ndo_stop = mt7697_stop, .ndo_stop = mt7697_stop,
.ndo_start_xmit = mt7697_data_tx, .ndo_start_xmit = mt7697_data_tx,
.ndo_get_stats = mt7697_get_stats, .ndo_get_stats = mt7697_get_stats,
.ndo_set_rx_mode = mt7697_set_multicast_list, .ndo_set_rx_mode = mt7697_set_multicast_list,
}; };
void mt7697_init_netdev(struct net_device *ndev) void mt7697_init_netdev(struct net_device *ndev)
{ {
ndev->netdev_ops = &mt7697_netdev_ops; ndev->netdev_ops = &mt7697_netdev_ops;
ndev->wireless_handlers = &mt7697_wireless_hndlrs; ndev->wireless_handlers = &mt7697_wireless_hndlrs;
ndev->destructor = free_netdev; ndev->destructor = free_netdev;
ndev->watchdog_timeo = MT7697_TX_TIMEOUT; ndev->watchdog_timeo = MT7697_TX_TIMEOUT;
ndev->needed_headroom = sizeof(struct ieee80211_hdr) + ndev->needed_headroom = sizeof(struct ieee80211_hdr) +
sizeof(struct mt7697_llc_snap_hdr); sizeof(struct mt7697_llc_snap_hdr);
ndev->hw_features |= NETIF_F_IP_CSUM | NETIF_F_RXCSUM; ndev->hw_features |= NETIF_F_IP_CSUM | NETIF_F_RXCSUM;
} }
static struct mt7697_if_ops if_ops; static struct mt7697_if_ops if_ops;
...@@ -210,22 +210,22 @@ static int mt7697_probe(struct platform_device *pdev) ...@@ -210,22 +210,22 @@ static int mt7697_probe(struct platform_device *pdev)
dev_dbg(&pdev->dev, "%s(): probe\n", __func__); dev_dbg(&pdev->dev, "%s(): probe\n", __func__);
cfg = mt7697_cfg80211_create(); cfg = mt7697_cfg80211_create();
if (!cfg) { if (!cfg) {
dev_err(&pdev->dev, dev_err(&pdev->dev,
"%s(): mt7697_cfg80211_create() failed()\n", "%s(): mt7697_cfg80211_create() failed()\n",
__func__); __func__);
err = -ENOMEM; err = -ENOMEM;
goto failed; goto failed;
} }
sema_init(&cfg->sem, 1); sema_init(&cfg->sem, 1);
cfg->tx_workq = create_workqueue(DRVNAME); cfg->tx_workq = create_workqueue(DRVNAME);
if (!cfg->tx_workq) { if (!cfg->tx_workq) {
dev_err(&pdev->dev, dev_err(&pdev->dev,
"%s(): create_workqueue() failed()\n", "%s(): create_workqueue() failed()\n",
__func__); __func__);
err = -ENOMEM; err = -ENOMEM;
goto failed; goto failed;
} }
INIT_WORK(&cfg->init_work, mt7697_init_hw_start); INIT_WORK(&cfg->init_work, mt7697_init_hw_start);
INIT_WORK(&cfg->tx_work, mt7697_tx_work); INIT_WORK(&cfg->tx_work, mt7697_tx_work);
...@@ -268,11 +268,11 @@ static int mt7697_probe(struct platform_device *pdev) ...@@ -268,11 +268,11 @@ static int mt7697_probe(struct platform_device *pdev)
err = mt7697_cfg80211_init(cfg); err = mt7697_cfg80211_init(cfg);
if (err < 0) { if (err < 0) {
dev_err(&pdev->dev, dev_err(&pdev->dev,
"%s(): mt7697_cfg80211_init() failed(%d)\n", "%s(): mt7697_cfg80211_init() failed(%d)\n",
__func__, err); __func__, err);
goto failed; goto failed;
} }
platform_set_drvdata(pdev, cfg); platform_set_drvdata(pdev, cfg);
schedule_work(&cfg->init_work); schedule_work(&cfg->init_work);
...@@ -302,20 +302,20 @@ static void mt7697_release(struct device *dev) ...@@ -302,20 +302,20 @@ static void mt7697_release(struct device *dev)
} }
static struct platform_device mt7697_platform_device = { static struct platform_device mt7697_platform_device = {
.name = DRVNAME, .name = DRVNAME,
.id = PLATFORM_DEVID_NONE, .id = PLATFORM_DEVID_NONE,
.dev = { .dev = {
.release = mt7697_release, .release = mt7697_release,
}, },
}; };
static struct platform_driver mt7697_platform_driver = { static struct platform_driver mt7697_platform_driver = {
.driver = { .driver = {
.name = DRVNAME, .name = DRVNAME,
.owner = THIS_MODULE, .owner = THIS_MODULE,
}, },
.probe = mt7697_probe, .probe = mt7697_probe,
.remove = mt7697_remove, .remove = mt7697_remove,
}; };
......
...@@ -72,7 +72,7 @@ int mt7697_data_tx(struct sk_buff *skb, struct net_device *ndev) ...@@ -72,7 +72,7 @@ int mt7697_data_tx(struct sk_buff *skb, struct net_device *ndev)
__func__); __func__);
ret = NETDEV_TX_BUSY; ret = NETDEV_TX_BUSY;
goto cleanup; goto cleanup;
} }
tx_skb->skb = skb; tx_skb->skb = skb;
dev_dbg(cfg->dev, "%s(): tx pkt(%u/%p)\n", dev_dbg(cfg->dev, "%s(): tx pkt(%u/%p)\n",
...@@ -106,7 +106,7 @@ cleanup: ...@@ -106,7 +106,7 @@ cleanup:
void mt7697_tx_work(struct work_struct *work) void mt7697_tx_work(struct work_struct *work)
{ {
struct mt7697_cfg80211_info *cfg = container_of(work, struct mt7697_cfg80211_info *cfg = container_of(work,
struct mt7697_cfg80211_info, tx_work); struct mt7697_cfg80211_info, tx_work);
struct mt7697_tx_pkt *tx_pkt, *tx_pkt_next = NULL; struct mt7697_tx_pkt *tx_pkt, *tx_pkt_next = NULL;
struct ieee80211_hdr *hdr; struct ieee80211_hdr *hdr;
...@@ -116,12 +116,12 @@ void mt7697_tx_work(struct work_struct *work) ...@@ -116,12 +116,12 @@ void mt7697_tx_work(struct work_struct *work)
struct mt7697_vif *vif = netdev_priv(tx_pkt->skb->dev); struct mt7697_vif *vif = netdev_priv(tx_pkt->skb->dev);
WARN_ON(!vif); WARN_ON(!vif);
/* validate length for ether packet */ /* validate length for ether packet */
if (tx_pkt->skb->len < sizeof(*hdr)) { if (tx_pkt->skb->len < sizeof(*hdr)) {
dev_err(cfg->dev, "%s(): invalid skb len(%u < %u)\n", dev_err(cfg->dev, "%s(): invalid skb len(%u < %u)\n",
__func__, tx_pkt->skb->len, sizeof(*hdr)); __func__, tx_pkt->skb->len, sizeof(*hdr));
vif->net_stats.tx_errors++; vif->net_stats.tx_errors++;
} }
ret = mt7697_wr_tx_raw_packet(cfg, tx_pkt->skb->data, ret = mt7697_wr_tx_raw_packet(cfg, tx_pkt->skb->data,
tx_pkt->skb->len); tx_pkt->skb->len);
...@@ -150,7 +150,7 @@ void mt7697_tx_work(struct work_struct *work) ...@@ -150,7 +150,7 @@ void mt7697_tx_work(struct work_struct *work)
void mt7697_tx_stop(struct mt7697_cfg80211_info *cfg) void mt7697_tx_stop(struct mt7697_cfg80211_info *cfg)
{ {
struct mt7697_tx_pkt *tx_pkt, *tx_pkt_next = NULL; struct mt7697_tx_pkt *tx_pkt, *tx_pkt_next = NULL;
list_for_each_entry_safe(tx_pkt, tx_pkt_next, &cfg->tx_skb_list, next) { list_for_each_entry_safe(tx_pkt, tx_pkt_next, &cfg->tx_skb_list, next) {
struct mt7697_vif *vif = netdev_priv(tx_pkt->skb->dev); struct mt7697_vif *vif = netdev_priv(tx_pkt->skb->dev);
...@@ -204,7 +204,7 @@ int mt7697_rx_data(struct mt7697_cfg80211_info *cfg, u32 len, u32 if_idx) ...@@ -204,7 +204,7 @@ int mt7697_rx_data(struct mt7697_cfg80211_info *cfg, u32 len, u32 if_idx)
} }
skb_put(skb, len); skb_put(skb, len);
memcpy(skb->data, cfg->rx_data, len); memcpy(skb->data, cfg->rx_data, len);
skb->dev = vif->ndev; skb->dev = vif->ndev;
vif->net_stats.rx_packets++; vif->net_stats.rx_packets++;
......
...@@ -23,40 +23,40 @@ ...@@ -23,40 +23,40 @@
#include "mt7697_i.h" #include "mt7697_i.h"
#include "wifi_api.h" #include "wifi_api.h"
#define MT7697_WOW_MAX_FILTERS_PER_LIST 4 #define MT7697_WOW_MAX_FILTERS_PER_LIST 4
#define MT7697_WOW_PATTERN_SIZE 64 #define MT7697_WOW_PATTERN_SIZE 64
#define MT7697_PASSPHRASE_LEN 64 #define MT7697_PASSPHRASE_LEN 64
#define mt7697_cfg_req mt7697_cmd_hdr #define mt7697_cfg_req mt7697_cmd_hdr
#define mt7697_get_rx_filter_req mt7697_cmd_hdr #define mt7697_get_rx_filter_req mt7697_cmd_hdr
#define mt7697_get_listen_interval_req mt7697_cmd_hdr #define mt7697_get_listen_interval_req mt7697_cmd_hdr
#define mt7697_get_smart_conn_filter_req mt7697_cmd_hdr #define mt7697_get_smart_conn_filter_req mt7697_cmd_hdr
#define mt7697_scan_stop mt7697_cmd_hdr #define mt7697_scan_stop mt7697_cmd_hdr
#define mt7697_set_wireless_mode_rsp mt7697_rsp_hdr #define mt7697_set_wireless_mode_rsp mt7697_rsp_hdr
#define mt7697_set_op_mode_rsp mt7697_rsp_hdr #define mt7697_set_op_mode_rsp mt7697_rsp_hdr
#define mt7697_set_rx_filter_rsp mt7697_rsp_hdr #define mt7697_set_rx_filter_rsp mt7697_rsp_hdr
#define mt7697_set_smart_conn_filter_rsp mt7697_rsp_hdr #define mt7697_set_smart_conn_filter_rsp mt7697_rsp_hdr
#define mt7697_set_listen_interval_rsp mt7697_rsp_hdr #define mt7697_set_listen_interval_rsp mt7697_rsp_hdr
#define mt7697_set_pmk_rsp mt7697_rsp_hdr #define mt7697_set_pmk_rsp mt7697_rsp_hdr
#define mt7697_set_channel_rsp mt7697_rsp_hdr #define mt7697_set_channel_rsp mt7697_rsp_hdr
#define mt7697_set_bssid_rsp mt7697_rsp_hdr #define mt7697_set_bssid_rsp mt7697_rsp_hdr
#define mt7697_set_ssid_rsp mt7697_rsp_hdr #define mt7697_set_ssid_rsp mt7697_rsp_hdr
#define mt7697_set_security_mode_rsp mt7697_rsp_hdr #define mt7697_set_security_mode_rsp mt7697_rsp_hdr
#define mt7697_scan_stop_rsp mt7697_rsp_hdr #define mt7697_scan_stop_rsp mt7697_rsp_hdr
#define mt7697_reload_settings_rsp mt7697_rsp_hdr #define mt7697_reload_settings_rsp mt7697_rsp_hdr
#define mt7697_disconnect_rsp mt7697_rsp_hdr #define mt7697_disconnect_rsp mt7697_rsp_hdr
enum mt7697_connect_ctrl_flags_bits { enum mt7697_connect_ctrl_flags_bits {
MT7697_CONNECT_ASSOC_POLICY_USER = 0x0001, MT7697_CONNECT_ASSOC_POLICY_USER = 0x0001,
MT7697_CONNECT_SEND_REASSOC = 0x0002, MT7697_CONNECT_SEND_REASSOC = 0x0002,
MT7697_CONNECT_IGNORE_WPAx_GROUP_CIPHER = 0x0004, MT7697_CONNECT_IGNORE_WPAx_GROUP_CIPHER = 0x0004,
MT7697_CONNECT_PROFILE_MATCH_DONE = 0x0008, MT7697_CONNECT_PROFILE_MATCH_DONE = 0x0008,
MT7697_CONNECT_IGNORE_AAC_BEACON = 0x0010, MT7697_CONNECT_IGNORE_AAC_BEACON = 0x0010,
MT7697_CONNECT_CSA_FOLLOW_BSS = 0x0020, MT7697_CONNECT_CSA_FOLLOW_BSS = 0x0020,
MT7697_CONNECT_DO_WPA_OFFLOAD = 0x0040, MT7697_CONNECT_DO_WPA_OFFLOAD = 0x0040,
MT7697_CONNECT_DO_NOT_DEAUTH = 0x0080, MT7697_CONNECT_DO_NOT_DEAUTH = 0x0080,
MT7697_CONNECT_WPS_FLAG = 0x0100, MT7697_CONNECT_WPS_FLAG = 0x0100,
}; };
enum mt7697_wifi_cmd_types { enum mt7697_wifi_cmd_types {
...@@ -106,156 +106,156 @@ struct mt7697_cfg80211_info; ...@@ -106,156 +106,156 @@ struct mt7697_cfg80211_info;
struct cfg80211_scan_request; struct cfg80211_scan_request;
struct mt7697_mac_addr_req { struct mt7697_mac_addr_req {
struct mt7697_cmd_hdr cmd; struct mt7697_cmd_hdr cmd;
__be32 port; __be32 port;
} __attribute__((packed, aligned(4))); } __attribute__((packed, aligned(4)));
struct mt7697_mac_addr_rsp { struct mt7697_mac_addr_rsp {
struct mt7697_rsp_hdr rsp; struct mt7697_rsp_hdr rsp;
u8 addr[LEN32_ALIGNED(ETH_ALEN)]; u8 addr[LEN32_ALIGNED(ETH_ALEN)];
} __attribute__((packed, aligned(4))); } __attribute__((packed, aligned(4)));
struct mt7697_get_wireless_mode_req { struct mt7697_get_wireless_mode_req {
struct mt7697_cmd_hdr cmd; struct mt7697_cmd_hdr cmd;
__be32 port; __be32 port;
} __attribute__((packed, aligned(4))); } __attribute__((packed, aligned(4)));
struct mt7697_get_wireless_mode_rsp { struct mt7697_get_wireless_mode_rsp {
struct mt7697_rsp_hdr rsp; struct mt7697_rsp_hdr rsp;
__be32 mode; __be32 mode;
} __attribute__((packed, aligned(4))); } __attribute__((packed, aligned(4)));
struct mt7697_set_wireless_mode_req { struct mt7697_set_wireless_mode_req {
struct mt7697_cmd_hdr cmd; struct mt7697_cmd_hdr cmd;
__be32 port; __be32 port;
__be32 mode; __be32 mode;
} __attribute__((packed, aligned(4))); } __attribute__((packed, aligned(4)));
struct mt7697_cfg_rsp { struct mt7697_cfg_rsp {
struct mt7697_rsp_hdr rsp; struct mt7697_rsp_hdr rsp;
struct mt7697_wifi_config_t cfg; struct mt7697_wifi_config_t cfg;
} __attribute__((packed, aligned(4))); } __attribute__((packed, aligned(4)));
struct mt7697_set_op_mode_req { struct mt7697_set_op_mode_req {
struct mt7697_cmd_hdr cmd; struct mt7697_cmd_hdr cmd;
__be32 opmode; __be32 opmode;
} __attribute__((packed, aligned(4))); } __attribute__((packed, aligned(4)));
struct mt7697_get_listen_interval_rsp { struct mt7697_get_listen_interval_rsp {
struct mt7697_rsp_hdr rsp; struct mt7697_rsp_hdr rsp;
__be32 interval; __be32 interval;
} __attribute__((packed, aligned(4))); } __attribute__((packed, aligned(4)));
struct mt7697_set_listen_interval_req { struct mt7697_set_listen_interval_req {
struct mt7697_cmd_hdr cmd; struct mt7697_cmd_hdr cmd;
__be32 interval; __be32 interval;
} __attribute__((packed, aligned(4))); } __attribute__((packed, aligned(4)));
struct mt7697_reload_settings_req { struct mt7697_reload_settings_req {
struct mt7697_cmd_hdr cmd; struct mt7697_cmd_hdr cmd;
__be32 if_idx; __be32 if_idx;
} __attribute__((packed, aligned(4))); } __attribute__((packed, aligned(4)));
struct mt7697_scan_req { struct mt7697_scan_req {
struct mt7697_cmd_hdr cmd; struct mt7697_cmd_hdr cmd;
__be32 if_idx; __be32 if_idx;
__be32 mode; __be32 mode;
__be32 option; __be32 option;
__be32 bssid_len; __be32 bssid_len;
u8 bssid[LEN32_ALIGNED(ETH_ALEN)]; u8 bssid[LEN32_ALIGNED(ETH_ALEN)];
__be32 ssid_len; __be32 ssid_len;
u8 ssid[LEN32_ALIGNED(IEEE80211_MAX_SSID_LEN)]; u8 ssid[LEN32_ALIGNED(IEEE80211_MAX_SSID_LEN)];
} __attribute__((packed, aligned(4))); } __attribute__((packed, aligned(4)));
struct mt7697_scan_rsp { struct mt7697_scan_rsp {
struct mt7697_rsp_hdr rsp; struct mt7697_rsp_hdr rsp;
__be32 if_idx; __be32 if_idx;
} __attribute__((packed, aligned(4))); } __attribute__((packed, aligned(4)));
struct mt7697_scan_ind { struct mt7697_scan_ind {
struct mt7697_rsp_hdr rsp; struct mt7697_rsp_hdr rsp;
__be32 rssi; __be32 rssi;
__be32 channel; __be32 channel;
u8 probe_rsp[]; u8 probe_rsp[];
} __attribute__((packed, aligned(4))); } __attribute__((packed, aligned(4)));
struct mt7697_scan_complete_ind { struct mt7697_scan_complete_ind {
struct mt7697_rsp_hdr rsp; struct mt7697_rsp_hdr rsp;
__be32 if_idx; __be32 if_idx;
} __attribute__((packed, aligned(4))); } __attribute__((packed, aligned(4)));
struct mt7697_set_pmk_req { struct mt7697_set_pmk_req {
struct mt7697_cmd_hdr cmd; struct mt7697_cmd_hdr cmd;
__be32 port; __be32 port;
u8 pmk[LEN32_ALIGNED(MT7697_WIFI_LENGTH_PASSPHRASE)]; u8 pmk[LEN32_ALIGNED(MT7697_WIFI_LENGTH_PASSPHRASE)];
} __attribute__((packed, aligned(4))); } __attribute__((packed, aligned(4)));
struct mt7697_set_channel_req { struct mt7697_set_channel_req {
struct mt7697_cmd_hdr cmd; struct mt7697_cmd_hdr cmd;
__be32 port; __be32 port;
__be32 ch; __be32 ch;
} __attribute__((packed, aligned(4))); } __attribute__((packed, aligned(4)));
struct mt7697_set_bssid_req { struct mt7697_set_bssid_req {
struct mt7697_cmd_hdr cmd; struct mt7697_cmd_hdr cmd;
u8 bssid[LEN32_ALIGNED(ETH_ALEN)]; u8 bssid[LEN32_ALIGNED(ETH_ALEN)];
} __attribute__((packed, aligned(4))); } __attribute__((packed, aligned(4)));
struct mt7697_set_ssid_req { struct mt7697_set_ssid_req {
struct mt7697_cmd_hdr cmd; struct mt7697_cmd_hdr cmd;
__be32 port; __be32 port;
__be32 len; __be32 len;
u8 ssid[LEN32_ALIGNED(IEEE80211_MAX_SSID_LEN)]; u8 ssid[LEN32_ALIGNED(IEEE80211_MAX_SSID_LEN)];
} __attribute__((packed, aligned(4))); } __attribute__((packed, aligned(4)));
struct mt7697_set_security_mode_req { struct mt7697_set_security_mode_req {
struct mt7697_cmd_hdr cmd; struct mt7697_cmd_hdr cmd;
__be32 port; __be32 port;
__be32 auth_mode; __be32 auth_mode;
__be32 encrypt_type; __be32 encrypt_type;
} __attribute__((packed, aligned(4))); } __attribute__((packed, aligned(4)));
struct mt7697_get_security_mode_req { struct mt7697_get_security_mode_req {
struct mt7697_cmd_hdr cmd; struct mt7697_cmd_hdr cmd;
__be32 if_idx; __be32 if_idx;
__be32 port; __be32 port;
} __attribute__((packed, aligned(4))); } __attribute__((packed, aligned(4)));
struct mt7697_get_security_mode_rsp { struct mt7697_get_security_mode_rsp {
struct mt7697_rsp_hdr rsp; struct mt7697_rsp_hdr rsp;
__be32 if_idx; __be32 if_idx;
__be32 auth_mode; __be32 auth_mode;
__be32 encrypt_type; __be32 encrypt_type;
} __attribute__((packed, aligned(4))); } __attribute__((packed, aligned(4)));
struct mt7697_connect_ind { struct mt7697_connect_ind {
struct mt7697_rsp_hdr rsp; struct mt7697_rsp_hdr rsp;
__be32 if_idx; __be32 if_idx;
__be32 channel; __be32 channel;
u8 bssid[LEN32_ALIGNED(ETH_ALEN)]; u8 bssid[LEN32_ALIGNED(ETH_ALEN)];
} __attribute__((packed, aligned(4))); } __attribute__((packed, aligned(4)));
struct mt7697_disconnect_req { struct mt7697_disconnect_req {
struct mt7697_cmd_hdr cmd; struct mt7697_cmd_hdr cmd;
__be32 port; __be32 port;
u8 addr[LEN32_ALIGNED(ETH_ALEN)]; u8 addr[LEN32_ALIGNED(ETH_ALEN)];
} __attribute__((packed, aligned(4))); } __attribute__((packed, aligned(4)));
struct mt7697_disconnect_ind { struct mt7697_disconnect_ind {
struct mt7697_rsp_hdr rsp; struct mt7697_rsp_hdr rsp;
__be32 if_idx; __be32 if_idx;
u8 bssid[LEN32_ALIGNED(ETH_ALEN)]; u8 bssid[LEN32_ALIGNED(ETH_ALEN)];
} __attribute__((packed, aligned(4))); } __attribute__((packed, aligned(4)));
struct mt7697_tx_raw_packet { struct mt7697_tx_raw_packet {
struct mt7697_cmd_hdr cmd; struct mt7697_cmd_hdr cmd;
__be32 len; __be32 len;
u8 data[LEN32_ALIGNED(IEEE80211_MAX_FRAME_LEN)]; u8 data[LEN32_ALIGNED(IEEE80211_MAX_FRAME_LEN)];
} __attribute__((packed, aligned(4))); } __attribute__((packed, aligned(4)));
struct mt7697_rx_raw_packet { struct mt7697_rx_raw_packet {
struct mt7697_rsp_hdr hdr; struct mt7697_rsp_hdr hdr;
u8 data[]; u8 data[];
} __attribute__((packed, aligned(4))); } __attribute__((packed, aligned(4)));
int mt7697_wr_set_wireless_mode_req(const struct mt7697_cfg80211_info*, u8); int mt7697_wr_set_wireless_mode_req(const struct mt7697_cfg80211_info*, u8);
......
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