BigW Consortium Gitlab

Commit d1130803 by David Clark

Merge branch 'master' of ssh://github.com/mangOH/mangOH

parents 852d9948 093b57b0
Subproject commit 210805ba20d4d85867d9a9f56fd9762c945aee62
Subproject commit 78a864d53e70fd53ad29744688032e9913db102f
Subproject commit 7c01aa8a0abf11ab8112bc0ebc85bb79776c45c6
Subproject commit 103c5a071d7ad191b3bd7faa84de4a72aeeec700
......@@ -17,10 +17,8 @@
#ifndef _MT7697_I_H_
#define _MT7697_I_H_
#define LEN32_ALIGNED(x) (((x) / sizeof(u32) + \
((x) % sizeof(u32) ? 1:0)) * sizeof(u32))
#define LEN_TO_WORD(x) ((x) / sizeof(u32) + \
((x) % sizeof(u32) ? 1:0))
#define LEN_TO_WORD(x) ((x) / sizeof(u32) + ((x) % sizeof(u32) ? 1 : 0))
#define LEN32_ALIGNED(x) (LEN_TO_WORD(x) * sizeof(u32))
enum mt7697_cmd_grp {
MT7697_CMD_GRP_QUEUE = 0,
......
......@@ -44,9 +44,9 @@ static int mt7697q_irq_run(struct mt7697q_info *qinfo)
__func__);
ret = -EINVAL;
}
}
else
} else {
enable_irq(qinfo->irq);
}
for (ch = 0; ch < MT7697_NUM_QUEUES; ch++) {
struct mt7697q_spec *qs = &qinfo->queues[ch];
......@@ -63,10 +63,10 @@ static int mt7697q_irq_run(struct mt7697q_info *qinfo)
__func__, ret);
goto cleanup;
}
}
else if (mt7697q_blocked_writer(qs)) {
} else if (mt7697q_blocked_writer(qs)) {
WARN_ON(!qs->notify_tx_fcn);
ret = qs->notify_tx_fcn(qs->priv, mt7697q_get_free_words(qs));
ret = qs->notify_tx_fcn(qs->priv,
mt7697q_get_free_words(qs));
if (ret < 0) {
dev_err(qs->qinfo->dev,
"%s(): notify_tx_fcn() failed(%d)\n",
......
......@@ -21,25 +21,25 @@
#include "io.h"
#include "spi.h"
static __inline u8 mt7697io_busy(u16 value)
static bool mt7697io_busy(u16 value)
{
return BF_GET(value, MT7697_IO_STATUS_REG_BUSY_OFFSET,
MT7697_IO_STATUS_REG_BUSY_WIDTH);
MT7697_IO_STATUS_REG_BUSY_WIDTH) ==
MT7697_IO_STATUS_REG_BUSY_VAL_BUSY;
}
static int mt7697io_write16(struct mt7697q_info *qinfo, u8 reg, u16 value)
{
int ret;
u8 txBuffer[] = {
MT7697_IO_CMD_WRITE,
reg,
((value >> 8) & 0xFF),
value & 0xFF,
};
WARN_ON(reg % sizeof(u16));
qinfo->txBuffer[0] = MT7697_IO_CMD_WRITE;
qinfo->txBuffer[1] = reg;
qinfo->txBuffer[2] = ((value >> 8) & 0xFF);
qinfo->txBuffer[3] = value & 0xFF;
ret = qinfo->hw_ops->write(qinfo->hw_priv, qinfo->txBuffer,
sizeof(qinfo->txBuffer));
ret = qinfo->hw_ops->write(qinfo->hw_priv, txBuffer, sizeof(txBuffer));
if (ret < 0) {
dev_err(qinfo->dev, "%s(): write() failed(%d)\n",
__func__, ret);
......@@ -53,45 +53,41 @@ cleanup:
static int mt7697io_write32(struct mt7697q_info *qinfo, u8 reg, u32 value)
{
int ret;
WARN_ON(reg % sizeof(u32));
ret = mt7697io_write16(qinfo, reg, BF_GET(value, 0, 16));
if (ret < 0) {
dev_err(qinfo->dev, "%s(): mt7697io_write16() failed(%d)\n",
__func__, ret);
goto cleanup;
}
if (ret < 0)
goto fail;
ret = mt7697io_write16(qinfo, reg + 2, BF_GET(value, 16, 16));
if (ret < 0) {
dev_err(qinfo->dev, "%s(): mt7697io_write16() failed(%d)\n",
__func__, ret);
goto cleanup;
}
if (ret < 0)
goto fail;
cleanup:
return ret;
fail:
dev_err(qinfo->dev, "%s(): mt7697io_write16() failed(%d)\n", __func__,
ret);
return ret;
}
static int mt7697io_read16(struct mt7697q_info *qinfo, u8 reg, u16 *value)
{
int ret;
u8 spi_buffer[4] = {
MT7697_IO_CMD_READ,
reg,
};
WARN_ON(reg % sizeof(u16));
qinfo->txBuffer[0] = MT7697_IO_CMD_READ;
qinfo->txBuffer[1] = reg;
ret = qinfo->hw_ops->write_then_read(qinfo->hw_priv,
qinfo->txBuffer, qinfo->rxBuffer, sizeof(u16) + sizeof(u16));
ret = qinfo->hw_ops->write_then_read(qinfo->hw_priv, spi_buffer,
spi_buffer, sizeof(spi_buffer));
if (ret < 0) {
dev_err(qinfo->dev, "%s(): write_then_read() failed(%d)\n",
__func__, ret);
goto cleanup;
}
*value = ((qinfo->rxBuffer[2] << 8) | qinfo->rxBuffer[3]);
*value = ((spi_buffer[2] << 8) | spi_buffer[3]);
cleanup:
return ret;
......@@ -102,29 +98,25 @@ static int mt7697io_read32(struct mt7697q_info *qinfo, u8 reg, u32 *value)
int ret;
u16 low;
u16 high;
WARN_ON(reg % sizeof(u32));
ret = mt7697io_read16(qinfo, reg, &low);
if (ret < 0) {
dev_err(qinfo->dev, "%s(): mt7697io_read16() failed(%d)\n",
__func__, ret);
goto cleanup;
}
ret = mt7697io_read16(qinfo, reg, &low);
if (ret < 0)
goto fail;
ret = mt7697io_read16(qinfo, reg + sizeof(u16), &high);
if (ret < 0) {
dev_err(qinfo->dev, "%s(): mt7697io_read16() failed(%d)\n",
__func__, ret);
goto cleanup;
}
if (ret < 0)
goto fail;
*value = (low | (high << 16));
cleanup:
return ret;
fail:
dev_err(qinfo->dev, "%s(): mt7697io_read16() failed(%d)\n", __func__,
ret);
return ret;
}
static int mt7697io_chk_slave_busy(struct mt7697q_info *qinfo)
static int mt7697io_chk_slave_busy(struct mt7697q_info *qinfo, bool *slave_busy)
{
int ret;
u16 value;
......@@ -136,7 +128,7 @@ static int mt7697io_chk_slave_busy(struct mt7697q_info *qinfo)
goto cleanup;
}
qinfo->slave_busy = mt7697io_busy(value) == MT7697_IO_STATUS_REG_BUSY_VAL_BUSY;
*slave_busy = mt7697io_busy(value);
cleanup:
return ret;
......@@ -145,32 +137,30 @@ cleanup:
static int mt7697io_slave_wait(struct mt7697q_info *qinfo)
{
int ret;
qinfo->slave_busy = true;
while (qinfo->slave_busy) {
ret = mt7697io_chk_slave_busy(qinfo);
bool slave_busy;
do {
ret = mt7697io_chk_slave_busy(qinfo, &slave_busy);
if (ret < 0) {
dev_err(qinfo->dev,
"%s(): mt7697io_chk_slave_busy() failed(%d)\n",
__func__, ret);
goto cleanup;
}
udelay(1);
};
} while (slave_busy);
cleanup:
return ret;
}
static __inline u8 mt7697io_get_s2m_mbox(u16 value)
static u8 mt7697io_get_s2m_mbox(u16 value)
{
return BF_GET(value,
MT7697_IO_S2M_MAILBOX_REG_MAILBOX_OFFSET,
MT7697_IO_S2M_MAILBOX_REG_MAILBOX_WIDTH);
}
static __inline u16 mt7697io_set_s2m_mbox(u8 value)
static u16 mt7697io_set_s2m_mbox(u8 value)
{
return BF_DEFINE(value,
MT7697_IO_S2M_MAILBOX_REG_MAILBOX_OFFSET,
......@@ -185,7 +175,8 @@ int mt7697io_wr_m2s_mbx(struct mt7697q_info *qinfo, u8 bits)
MT7697_IO_M2S_MAILBOX_REG_MAILBOX_WIDTH);
dev_dbg(qinfo->dev, "%s(): m2s mbx(0x%02x)\n", __func__, bits);
WARN_ON((GENMASK(MT7697_IO_M2S_MAILBOX_REG_MAILBOX_WIDTH, 0) & bits) != bits);
WARN_ON((GENMASK(MT7697_IO_M2S_MAILBOX_REG_MAILBOX_WIDTH, 0) & bits) !=
bits);
ret = mt7697io_write16(qinfo, MT7697_IO_SLAVE_REG_MAILBOX_M2S, value);
if (ret < 0) {
......@@ -198,7 +189,7 @@ cleanup:
return ret;
}
int mt7697io_rd_s2m_mbx(struct mt7697q_info *qinfo)
int mt7697io_rd_s2m_mbx(struct mt7697q_info *qinfo, u8 *s2m_mbx)
{
int ret;
u16 value;
......@@ -210,31 +201,30 @@ int mt7697io_rd_s2m_mbx(struct mt7697q_info *qinfo)
goto cleanup;
}
qinfo->s2m_mbox = mt7697io_get_s2m_mbox(value);
*s2m_mbx = mt7697io_get_s2m_mbox(value);
dev_dbg(qinfo->dev, "%s(): s2m mbx(0x%02x)\n",
__func__, qinfo->s2m_mbox);
__func__, *s2m_mbx);
cleanup:
return ret;
}
int mt7697io_clr_s2m_mbx(struct mt7697q_info *qinfo)
int mt7697io_clr_s2m_mbx(struct mt7697q_info *qinfo, u8 s2m_mbx)
{
const u16 value = mt7697io_set_s2m_mbox(qinfo->s2m_mbox);
const u16 value = mt7697io_set_s2m_mbox(s2m_mbx);
int ret;
ret = mt7697io_write16(qinfo, MT7697_IO_SLAVE_REG_MAILBOX_S2M, value);
if (ret < 0) {
dev_err(qinfo->dev, "%s(): mt7697io_write16() failed(%d)\n",
__func__, ret);
goto cleanup;
}
cleanup:
return ret;
}
int mt7697io_wr(struct mt7697q_info *qinfo, u32 addr, const u32 *data, size_t num)
int mt7697io_wr(struct mt7697q_info *qinfo, u32 addr, const u32 *data,
size_t num)
{
size_t i;
int ret;
......@@ -249,7 +239,8 @@ int mt7697io_wr(struct mt7697q_info *qinfo, u32 addr, const u32 *data, size_t nu
}
for (i = 0; i < num; i++) {
ret = mt7697io_write32(qinfo, MT7697_IO_SLAVE_REG_WRITE_DATA_LOW, data[i]);
ret = mt7697io_write32(
qinfo, MT7697_IO_SLAVE_REG_WRITE_DATA_LOW, data[i]);
if (ret < 0) {
dev_err(qinfo->dev,
"%s(): mt7697io_write32() failed(%d)\n",
......@@ -299,7 +290,8 @@ int mt7697io_rd(struct mt7697q_info *qinfo, u32 addr, u32 *data, size_t num)
}
for (i = 0; i < num; i++) {
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,
MT7697_IO_COMMAND_REG_BUS_SIZE_OFFSET,
MT7697_IO_COMMAND_REG_BUS_SIZE_WIDTH) |
......@@ -322,7 +314,8 @@ int mt7697io_rd(struct mt7697q_info *qinfo, u32 addr, u32 *data, size_t num)
goto cleanup;
}
ret = mt7697io_read32(qinfo, MT7697_IO_SLAVE_REG_READ_DATA_LOW, &data[i]);
ret = mt7697io_read32(
qinfo, MT7697_IO_SLAVE_REG_READ_DATA_LOW, &data[i]);
if (ret < 0) {
dev_err(qinfo->dev,
"%s(): mt7697io_read32() failed(%d)\n",
......@@ -337,7 +330,8 @@ cleanup:
int mt7697io_trigger_intr(struct mt7697q_info *qinfo)
{
int ret = mt7697io_write16(qinfo, MT7697_IO_SLAVE_REG_IRQ,
int ret = mt7697io_write16(
qinfo, MT7697_IO_SLAVE_REG_IRQ,
BF_DEFINE(MT7697_IO_IRQ_REG_IRQ_STATUS_VAL_ACTIVE,
MT7697_IO_IRQ_REG_IRQ_STATUS_OFFSET,
MT7697_IO_IRQ_REG_IRQ_STATUS_WIDTH));
......
......@@ -84,8 +84,8 @@
struct mt7697q_info;
int mt7697io_wr_m2s_mbx(struct mt7697q_info*, u8);
int mt7697io_rd_s2m_mbx(struct mt7697q_info*);
int mt7697io_clr_s2m_mbx(struct mt7697q_info*);
int mt7697io_rd_s2m_mbx(struct mt7697q_info*, u8*);
int mt7697io_clr_s2m_mbx(struct mt7697q_info*, u8);
int mt7697io_wr(struct mt7697q_info*, u32, const u32*, size_t);
int mt7697io_rd(struct mt7697q_info*, u32, u32*, size_t);
......
......@@ -21,7 +21,7 @@
#include "queue.h"
#include "spi.h"
static __inline ssize_t mt7697q_buf_diff(u32 size, u32 from, u32 to)
static ssize_t mt7697q_buf_diff(u32 size, u32 from, u32 to)
{
if (from >= size) {
pr_info("%s(): ERROR from(%u) >= size(%u)\n",
......@@ -38,13 +38,13 @@ static __inline ssize_t mt7697q_buf_diff(u32 size, u32 from, u32 to)
return (from <= to) ? (to - from):((size - from) + to);
}
static __inline size_t mt7697q_get_capacity(const struct mt7697q_spec *qs)
static size_t mt7697q_get_capacity(const struct mt7697q_spec *qs)
{
return BF_GET(qs->data.flags, MT7697_QUEUE_FLAGS_NUM_WORDS_OFFSET,
MT7697_QUEUE_FLAGS_NUM_WORDS_WIDTH) - 1;
}
static __inline size_t mt7697q_get_num_words(const struct mt7697q_spec *qs)
static size_t mt7697q_get_num_words(const struct mt7697q_spec *qs)
{
return mt7697q_buf_diff(BF_GET(qs->data.flags,
MT7697_QUEUE_FLAGS_NUM_WORDS_OFFSET,
......@@ -224,10 +224,11 @@ static int mt7697q_read_state(u8 ch, struct mt7697q_spec *qs)
mutex_lock(&qs->qinfo->mutex);
ret = mt7697io_rd(qs->qinfo,
MT7697_IO_SLAVE_BUFFER_ADDRESS + ch * sizeof(struct mt7697q_data),
(u32*)&qs->data,
LEN_TO_WORD(sizeof(struct mt7697q_data)));
ret = mt7697io_rd(
qs->qinfo,
MT7697_IO_SLAVE_BUFFER_ADDRESS +
ch * sizeof(struct mt7697q_data),
(u32*)&qs->data, LEN_TO_WORD(sizeof(struct mt7697q_data)));
if (ret < 0) {
dev_err(qs->qinfo->dev, "%s(): mt7697io_rd() failed(%d)\n",
__func__, ret);
......@@ -243,14 +244,12 @@ static int mt7697q_read_state(u8 ch, struct mt7697q_spec *qs)
__func__, qs->data.base_addr);
ret = -EINVAL;
goto cleanup;
}
else if (!qs->data.flags) {
} else if (!qs->data.flags) {
dev_err(qs->qinfo->dev, "%s(): invalid flags(0x%08x)\n",
__func__, qs->data.flags);
ret = -EINVAL;
goto cleanup;
}
else if ((qs->data.rd_offset > mt7697q_get_capacity(qs)) ||
} else if ((qs->data.rd_offset > mt7697q_get_capacity(qs)) ||
(qs->data.wr_offset > mt7697q_get_capacity(qs))) {
dev_err(qs->qinfo->dev,
"%s(): invalid rd/wr offset(0x%08x/0x%08x)\n",
......@@ -290,7 +289,8 @@ cleanup:
return ret;
}
static int mt7697q_wr_unused(struct mt7697q_spec *qsM2S, struct mt7697q_spec *qsS2M)
static int mt7697q_wr_unused(
struct mt7697q_spec *qsM2S, struct mt7697q_spec *qsS2M)
{
struct mt7697_queue_reset_req req;
int ret;
......@@ -301,9 +301,11 @@ static int mt7697q_wr_unused(struct mt7697q_spec *qsM2S, struct mt7697q_spec *qs
req.m2s_ch = qsM2S->ch;
req.s2m_ch = qsS2M->ch;
qsM2S->data.flags &= ~BF_GET(qsM2S->data.flags, MT7697_QUEUE_FLAGS_IN_USE_OFFSET,
qsM2S->data.flags &= ~BF_GET(qsM2S->data.flags,
MT7697_QUEUE_FLAGS_IN_USE_OFFSET,
MT7697_QUEUE_FLAGS_IN_USE_WIDTH);
qsS2M->data.flags &= ~BF_GET(qsS2M->data.flags, MT7697_QUEUE_FLAGS_IN_USE_OFFSET,
qsS2M->data.flags &= ~BF_GET(qsS2M->data.flags,
MT7697_QUEUE_FLAGS_IN_USE_OFFSET,
MT7697_QUEUE_FLAGS_IN_USE_WIDTH);
dev_dbg(qsM2S->qinfo->dev, "%s(): <-- QUEUE UNUSED(%u/%u)\n",
......@@ -324,28 +326,25 @@ cleanup:
return ret;
}
__inline size_t mt7697q_get_free_words(const struct mt7697q_spec *qs)
size_t mt7697q_get_free_words(const struct mt7697q_spec *qs)
{
return mt7697q_get_capacity(qs) - mt7697q_get_num_words(qs);
}
int mt7697q_get_s2m_mbx(struct mt7697q_info *qinfo, u8* s2m_mbox)
int mt7697q_get_s2m_mbx(struct mt7697q_info *qinfo, u8 *s2m_mbox)
{
int ret;
mutex_lock(&qinfo->mutex);
ret = mt7697io_rd_s2m_mbx(qinfo);
ret = mt7697io_rd_s2m_mbx(qinfo, s2m_mbox);
if (ret < 0) {
dev_err(qinfo->dev, "%s(): mt7697io_rd_s2m_mbx() failed(%d)\n",
__func__, ret);
goto cleanup;
}
*s2m_mbox = qinfo->s2m_mbox;
ret = mt7697io_clr_s2m_mbx(qinfo);
ret = mt7697io_clr_s2m_mbx(qinfo, *s2m_mbox);
if (ret < 0) {
dev_err(qinfo->dev,
"%s(): mt7697io_clr_s2m_mbx() failed(%d)\n",
......@@ -358,7 +357,7 @@ cleanup:
return ret;
}
__inline int mt7697q_blocked_writer(const struct mt7697q_spec *qs)
int mt7697q_blocked_writer(const struct mt7697q_spec *qs)
{
return atomic_read(&qs->qinfo->blocked_writer);
}
......@@ -379,14 +378,16 @@ int mt7697q_proc_data(struct mt7697q_spec *qsS2M)
avail = mt7697q_get_num_words(qsS2M);
req = (qsS2M->qinfo->rsp.cmd.len > 0) ?
LEN_TO_WORD(qsS2M->qinfo->rsp.cmd.len - sizeof(struct mt7697_rsp_hdr)) :
LEN_TO_WORD(qsS2M->qinfo->rsp.cmd.len -
sizeof(struct mt7697_rsp_hdr)) :
LEN_TO_WORD(sizeof(struct mt7697_rsp_hdr));
dev_dbg(qsS2M->qinfo->dev, "%s(): avail(%u) len(%u) req(%u)\n",
__func__, avail, qsS2M->qinfo->rsp.cmd.len, req);
while (avail >= req) {
if (!qsS2M->qinfo->rsp.cmd.len) {
ret = mt7697q_read(qsS2M, (u32*)&qsS2M->qinfo->rsp, req);
ret = mt7697q_read(qsS2M, (u32*)&qsS2M->qinfo->rsp,
req);
if (ret != req) {
dev_err(qsS2M->qinfo->dev,
"%s(): mt7697q_read() failed(%d != %d)\n",
......@@ -395,9 +396,11 @@ int mt7697q_proc_data(struct mt7697q_spec *qsS2M)
}
avail -= LEN_TO_WORD(sizeof(struct mt7697_rsp_hdr));
req = LEN_TO_WORD(qsS2M->qinfo->rsp.cmd.len - sizeof(struct mt7697_rsp_hdr));
dev_dbg(qsS2M->qinfo->dev, "%s(): avail(%u) len(%u) req(%u)\n",
__func__, avail, qsS2M->qinfo->rsp.cmd.len, req);
req = LEN_TO_WORD(qsS2M->qinfo->rsp.cmd.len -
sizeof(struct mt7697_rsp_hdr));
dev_dbg(qsS2M->qinfo->dev,
"%s(): avail(%u) len(%u) req(%u)\n", __func__,
avail, qsS2M->qinfo->rsp.cmd.len, req);
}
if (qsS2M->qinfo->rsp.result < 0) {
......@@ -435,10 +438,10 @@ int mt7697q_proc_data(struct mt7697q_spec *qsS2M)
__func__, ret);
goto cleanup;
}
}
else {
} else {
WARN_ON(!qsS2M->rx_fcn);
ret = qsS2M->rx_fcn((const struct mt7697_rsp_hdr*)&qsS2M->qinfo->rsp, qsS2M->priv);
ret = qsS2M->rx_fcn((const struct mt7697_rsp_hdr*)
&qsS2M->qinfo->rsp, qsS2M->priv);
if (ret < 0) {
dev_err(qsS2M->qinfo->dev,
"%s(): rx_fcn() failed(%d)\n",
......@@ -479,7 +482,7 @@ cleanup:
return ret;
}
__inline void mt7697q_unblock_writer(void *hndl)
void mt7697q_unblock_writer(void *hndl)
{
struct mt7697q_spec *qs = (struct mt7697q_spec*)hndl;
atomic_set(&qs->qinfo->blocked_writer, false);
......@@ -550,7 +553,8 @@ int mt7697q_init(u8 tx_ch, u8 rx_ch, void *priv, notify_tx_hndlr notify_tx_fcn,
goto cleanup;
}
snprintf(str, sizeof(str), "%s.%u", dev_name(&master->dev), MT7697_SPI_CS);
snprintf(str, sizeof(str), "%s.%u", dev_name(&master->dev),
MT7697_SPI_CS);
dev_dbg(&master->dev, "%s(): find SPI device('%s')\n", __func__, str);
dev = bus_find_device_by_name(&spi_bus_type, NULL, str);
if (!dev) {
......@@ -650,8 +654,9 @@ int mt7697q_shutdown(void **tx_hndl, void **rx_hndl)
ret = mt7697q_wr_unused(qsM2S, qsS2M);
if (ret < 0) {
dev_err(qsM2S->qinfo->dev, "%s(): mt7697q_wr_unused() failed(%d)\n",
__func__, ret);
dev_err(qsM2S->qinfo->dev,
"%s(): mt7697q_wr_unused() failed(%d)\n", __func__,
ret);
goto cleanup;
}
......@@ -685,7 +690,8 @@ size_t mt7697q_read(void *hndl, u32 *buf, size_t num)
__func__, num, qs->ch, read_offset, write_offset);
if (read_offset > write_offset) {
const size_t words_to_end = buff_words - read_offset;
const u32 rd_addr = qs->data.base_addr + (read_offset * sizeof(u32));
const u32 rd_addr = qs->data.base_addr +
(read_offset * sizeof(u32));
const size_t rd_num = (num <= words_to_end) ?
num : words_to_end;
......@@ -715,9 +721,11 @@ size_t mt7697q_read(void *hndl, u32 *buf, size_t num)
if (rd_words < num) {
/* NOTE: rd_offset assumed to be <= wr_offset at this point */
const size_t words_avail = write_offset - read_offset;
const u32 rd_addr = qs->data.base_addr + (read_offset * sizeof(u32));
const u32 rd_addr = qs->data.base_addr +
(read_offset * sizeof(u32));
const size_t words_req = num - rd_words;
const size_t rd_num = (words_req <= words_avail) ? words_req : words_avail;
const size_t rd_num =
(words_req <= words_avail) ? words_req : words_avail;
dev_dbg(qs->qinfo->dev,
"%s(): rd(%u) queue(%u) rd offset(%u) addr(0x%08x)\n",
......@@ -878,15 +886,14 @@ cleanup:
EXPORT_SYMBOL(mt7697q_write);
__inline u32 mt7697q_flags_get_in_use(u32 flags)
u32 mt7697q_flags_get_in_use(u32 flags)
{
return BF_GET(flags, MT7697_QUEUE_FLAGS_IN_USE_OFFSET,
MT7697_QUEUE_FLAGS_IN_USE_WIDTH);
}
__inline u32 mt7697q_flags_get_dir(u32 flags)
u32 mt7697q_flags_get_dir(u32 flags)
{
return BF_GET(flags,MT7697_QUEUE_FLAGS_DIR_OFFSET,
MT7697_QUEUE_FLAGS_DIR_WIDTH);
}
......@@ -55,8 +55,6 @@ struct mt7697q_spec {
struct mt7697q_info {
struct mt7697q_spec queues[MT7697_NUM_QUEUES];
struct mt7697_rsp_hdr rsp;
u8 txBuffer[sizeof(u32)];
u8 rxBuffer[sizeof(u32)];
struct device *dev;
void *hw_priv;
......@@ -70,8 +68,6 @@ struct mt7697q_info {
atomic_t blocked_writer;
int gpio_pin;
int irq;
u8 s2m_mbox;
bool slave_busy;
};
void mt7697q_irq_delayed_work(struct work_struct*);
......
......@@ -103,7 +103,8 @@ static int __init mt7697spi_init(void)
goto cleanup;
}
snprintf(str, sizeof(str), "%s.%u", dev_name(&master->dev), MT7697_SPI_CS);
snprintf(str, sizeof(str), "%s.%u", dev_name(&master->dev),
MT7697_SPI_CS);
dev_info(&master->dev, "%s(): find SPI device('%s')\n", __func__, str);
dev = bus_find_device_by_name(&spi_bus_type, NULL, str);
if (!dev) {
......@@ -115,7 +116,7 @@ static int __init mt7697spi_init(void)
goto cleanup;
}
spi = container_of(dev, struct spi_device, dev);
spi = to_spi_device(dev);
if (!spi) {
dev_err(&master->dev, "%s(): get SPI device failed\n",
__func__);
......@@ -136,7 +137,6 @@ static int __init mt7697spi_init(void)
goto cleanup;
}
memset(qinfo, 0, sizeof(struct mt7697q_info));
qinfo->dev = &spi->dev;
qinfo->hw_priv = spi;
......@@ -166,8 +166,7 @@ static int __init mt7697spi_init(void)
qinfo->irq = gpio_to_irq(qinfo->gpio_pin);
qinfo->gpio_pin = MT7697_SPI_INTR_GPIO_PIN_INVALID;
}
else {
} else {
gpio_direction_input(qinfo->gpio_pin);
qinfo->irq = gpio_to_irq(qinfo->gpio_pin);
}
......@@ -187,12 +186,12 @@ static int __init mt7697spi_init(void)
dev_info(qinfo->dev, "%s(): '%s' initialized\n", __func__, DRVNAME);
return 0;
failed_workqueue:
destroy_workqueue(qinfo->irq_workq);
failed_gpio_req:
if (qinfo->gpio_pin > 0) gpio_free(qinfo->gpio_pin);
failed_workqueue:
destroy_workqueue(qinfo->irq_workq);
cleanup:
if (qinfo) kfree(qinfo);
return ret;
......@@ -218,7 +217,8 @@ static void __exit mt7697spi_exit(void)
goto cleanup;
}
snprintf(str, sizeof(str), "%s.%u", dev_name(&master->dev), MT7697_SPI_CS);
snprintf(str, sizeof(str), "%s.%u", dev_name(&master->dev),
MT7697_SPI_CS);
dev_info(&master->dev, "%s(): find SPI device('%s')\n", __func__, str);
dev = bus_find_device_by_name(&spi_bus_type, NULL, str);
if (!dev) {
......@@ -228,7 +228,7 @@ static void __exit mt7697spi_exit(void)
goto cleanup;
}
spi = container_of(dev, struct spi_device, dev);
spi = to_spi_device(dev);
if (!spi) {
dev_err(dev, "%s(): get SPI device failed\n",
__func__);
......@@ -259,6 +259,6 @@ cleanup:
module_init(mt7697spi_init);
module_exit(mt7697spi_exit);
MODULE_AUTHOR( "Sierra Wireless Corporation" );
MODULE_LICENSE( "GPL" );
MODULE_DESCRIPTION( "MediaTek7697 SPI master" );
MODULE_AUTHOR("Sierra Wireless Corporation");
MODULE_LICENSE("GPL");
MODULE_DESCRIPTION("MediaTek7697 SPI master");
......@@ -58,20 +58,19 @@ static int mt7697_uart_rx_poll(struct mt7697_uart_info* uart_info)
poll_initwait(&table);
while (1) {
mask = uart_info->fd_hndl->f_op->poll(uart_info->fd_hndl, &table.pt);
mask = uart_info->fd_hndl->f_op->poll(
uart_info->fd_hndl, &table.pt);
if (mask & POLLERR) {
dev_warn(uart_info->dev,
"%s(): poll error\n", __func__);
ret = -EIO;
goto cleanup;
}
else if (mask & POLLHUP) {
} else if (mask & POLLHUP) {
dev_warn(uart_info->dev,
"%s(): poll hangup\n", __func__);
ret = -EPIPE;
goto cleanup;
}
else if (mask & (POLLRDNORM | POLLRDBAND | POLLIN)) {
} else if (mask & (POLLRDNORM | POLLRDBAND | POLLIN)) {
dev_dbg(uart_info->dev, "%s(): Rx data mask(0x%08x)\n",
__func__, mask);
break;
......@@ -122,9 +121,9 @@ static void mt7697_uart_rx_work(struct work_struct *rx_work)
"%s(): mt7697_uart_read() failed(%d != %d)\n",
__func__, ret,
LEN_TO_WORD(sizeof(struct mt7697_rsp_hdr)));
}
else {
dev_warn(uart_info->dev, "%s(): closed\n", __func__);
} else {
dev_warn(uart_info->dev, "%s(): closed\n",
__func__);
}
goto cleanup;
......@@ -138,27 +137,29 @@ static void mt7697_uart_rx_work(struct work_struct *rx_work)
}
if (uart_info->rsp.cmd.grp == MT7697_CMD_GRP_UART) {
if (uart_info->rsp.cmd.type == MT7697_CMD_UART_SHUTDOWN_RSP) {
if (uart_info->rsp.cmd.type ==
MT7697_CMD_UART_SHUTDOWN_RSP) {
dev_dbg(uart_info->dev,
"%s(): --> UART SHUTDOWN RSP\n",
__func__);
}
else {
} else {
dev_err(uart_info->dev,
"%s(): Rx invalid message type(%d)\n",
__func__, uart_info->rsp.cmd.type);
}
if (atomic_read(&uart_info->close)) {
dev_warn(uart_info->dev, "%s(): closed\n", __func__);
dev_warn(uart_info->dev, "%s(): closed\n",
__func__);
goto cleanup;
}
}
else {
} else {
WARN_ON(!uart_info->rx_fcn);
err = uart_info->rx_fcn((const struct mt7697_rsp_hdr*)&uart_info->rsp,
err = uart_info->rx_fcn(
(const struct mt7697_rsp_hdr*)&uart_info->rsp,
uart_info->rx_hndl);
dev_dbg(uart_info->dev, "%s(): rx_fcn ret(%d)\n", __func__, err);
dev_dbg(uart_info->dev, "%s(): rx_fcn ret(%d)\n",
__func__, err);
if (err < 0) {
dev_err(uart_info->dev,
"%s(): rx_fcn() failed(%d)\n",
......@@ -181,8 +182,10 @@ void* mt7697_uart_open(rx_hndlr rx_fcn, void* rx_hndl)
struct mt7697_uart_info *uart_info;
void *ret = NULL;
pr_info("%s(): find UART device('%s')\n", __func__, MT7697_UART_DRVNAME);
dev = bus_find_device_by_name(&platform_bus_type, NULL, MT7697_UART_DRVNAME);
pr_info("%s(): find UART device('%s')\n", __func__,
MT7697_UART_DRVNAME);
dev = bus_find_device_by_name(&platform_bus_type, NULL,
MT7697_UART_DRVNAME);
if (!dev) {
pr_err("%s(): '%s' bus_find_device_by_name() failed\n",
__func__, MT7697_UART_DRVNAME);
......@@ -205,7 +208,8 @@ void* mt7697_uart_open(rx_hndlr rx_fcn, void* rx_hndl)
WARN_ON(uart_info->fd_hndl);
dev_err(uart_info->dev, "%s(): open serial device '%s'\n",
__func__, uart_info->dev_file);
uart_info->fd_hndl = filp_open((const char __user*)uart_info->dev_file, O_RDWR, 0600);
uart_info->fd_hndl = filp_open((const char __user*)uart_info->dev_file,
O_RDWR, 0600);
if (IS_ERR(uart_info->fd_hndl)) {
dev_err(uart_info->dev, "%s(): filp_open() '%s' failed\n",
__func__, MT7697_UART_DEVICE);
......@@ -254,7 +258,8 @@ int mt7697_uart_close(void *arg)
goto cleanup;
}
wait_event_interruptible(uart_info->close_wq, !atomic_read(&uart_info->close));
wait_event_interruptible(uart_info->close_wq,
!atomic_read(&uart_info->close));
mutex_lock(&uart_info->mutex);
......@@ -298,11 +303,11 @@ size_t mt7697_uart_read(void *arg, u32 *buf, size_t len)
err = kernel_read(uart_info->fd_hndl, 0, ptr, count);
dev_dbg(uart_info->dev, "%s(): read(%d)\n", __func__, err);
if (err < 0) {
dev_err(uart_info->dev, "%s(): kernel_read() failed(%d)\n",
__func__, err);
dev_err(uart_info->dev,
"%s(): kernel_read() failed(%d)\n", __func__,
err);
goto cleanup;
}
else if (!err) {
} else if (!err) {
dev_warn(uart_info->dev, "%s(): CLOSED\n", __func__);
goto cleanup;
}
......@@ -347,13 +352,14 @@ size_t mt7697_uart_write(void *arg, const u32 *buf, size_t len)
dev_dbg(uart_info->dev, "%s(): len(%u)\n", __func__, len);
while (1) {
num_write = kernel_write(uart_info->fd_hndl, ptr, left, 0);
dev_dbg(uart_info->dev, "%s(): written(%u)\n", __func__, num_write);
dev_dbg(uart_info->dev, "%s(): written(%u)\n", __func__,
num_write);
if (num_write < 0) {
dev_err(uart_info->dev, "%s(): kernel_write() failed(%d)\n",
__func__, num_write);
dev_err(uart_info->dev,
"%s(): kernel_write() failed(%d)\n", __func__,
num_write);
goto cleanup;
}
else if (!num_write) {
} else if (!num_write) {
dev_warn(uart_info->dev, "%s(): CLOSED\n", __func__);
goto cleanup;
}
......@@ -401,7 +407,8 @@ static int mt7697_uart_probe(struct platform_device *pdev)
platform_set_drvdata(pdev, uart_info);
dev_info(&pdev->dev, "%s(): '%s' initialized\n", __func__, MT7697_UART_DRVNAME);
dev_info(&pdev->dev, "%s(): '%s' initialized\n", __func__,
MT7697_UART_DRVNAME);
return 0;
cleanup:
......@@ -460,14 +467,16 @@ static int __init mt7697_uart_init(void)
pr_info(MT7697_UART_DRVNAME" init\n");
ret = platform_device_register(&mt7697_uart_platform_device);
if (ret) {
pr_err(MT7697_UART_DRVNAME" %s(): platform_device_register() failed(%d)\n",
pr_err(MT7697_UART_DRVNAME
" %s(): platform_device_register() failed(%d)\n",
__func__, ret);
goto cleanup;
}
ret = platform_driver_register(&mt7697_uart_platform_driver);
if (ret) {
pr_err(MT7697_UART_DRVNAME" %s(): platform_driver_register() failed(%d)\n",
pr_err(MT7697_UART_DRVNAME
" %s(): platform_driver_register() failed(%d)\n",
__func__, ret);
platform_device_del(&mt7697_uart_platform_device);
goto cleanup;
......@@ -490,5 +499,3 @@ module_exit(mt7697_uart_exit);
MODULE_DESCRIPTION("MT7697 uart interface");
MODULE_LICENSE("GPL");
MODULE_AUTHOR("Sierra Wireless");
......@@ -38,7 +38,7 @@ struct mt7697_uart_info {
struct platform_device *pdev;
struct device *dev;
char* dev_file;
char *dev_file;
struct file *fd_hndl;
struct mutex mutex;
......
......@@ -208,7 +208,8 @@ static int mt7697_set_cipher(struct mt7697_vif *vif, u32 cipher, bool ucast)
case WLAN_CIPHER_SUITE_WEP40:
case WLAN_CIPHER_SUITE_SMS4:
default:
dev_err(vif->cfg->dev, "cipher(0x%08x) not supported\n", cipher);
dev_err(vif->cfg->dev, "cipher(0x%08x) not supported\n",
cipher);
ret = -ENOTSUPP;
goto cleanup;
}
......@@ -323,8 +324,9 @@ static struct cfg80211_bss* mt7697_add_bss_if_needed(struct mt7697_vif *vif,
dev_dbg(cfg->dev, "%s(): added bss(%p) to cfg80211\n",
__func__, bssid);
} else
} else {
dev_dbg(cfg->dev, "%s(): cfg80211 has bss\n", __func__);
}
cleanup:
if (ie) kfree(ie);
......@@ -355,11 +357,11 @@ static struct wireless_dev* mt7697_cfg80211_add_iface(struct wiphy *wiphy,
spin_unlock_bh(&cfg->vif_list_lock);
dev_dbg(cfg->dev, "%s(): iface('%s') exists\n",
__func__, name);
}
else {
} else {
wdev = mt7697_interface_add(cfg, name, type, if_idx);
if (!wdev) {
dev_err(cfg->dev, "%s(): mt7697_interface_add() failed\n",
dev_err(cfg->dev,
"%s(): mt7697_interface_add() failed\n",
__func__);
goto cleanup;
}
......@@ -666,7 +668,8 @@ static int mt7697_cfg80211_leave_ibss(struct wiphy *wiphy,
static int mt7697_cfg80211_set_wiphy_params(struct wiphy *wiphy, u32 changed)
{
struct mt7697_cfg80211_info *cfg = (struct mt7697_cfg80211_info*)wiphy_priv(wiphy);
struct mt7697_cfg80211_info *cfg =
(struct mt7697_cfg80211_info*)wiphy_priv(wiphy);
dev_dbg(cfg->dev, "%s(): SET WIPHY PARAMS changed(0x%08x)\n",
__func__, changed);
return 0;
......@@ -676,7 +679,8 @@ static int mt7697_cfg80211_start_ap(struct wiphy *wiphy,
struct net_device *ndev,
struct cfg80211_ap_settings *settings)
{
struct mt7697_cfg80211_info *cfg = (struct mt7697_cfg80211_info*)wiphy_priv(wiphy);
struct mt7697_cfg80211_info *cfg =
(struct mt7697_cfg80211_info*)wiphy_priv(wiphy);
struct mt7697_vif *vif = netdev_priv(ndev);
int ret;
......@@ -695,7 +699,8 @@ static int mt7697_cfg80211_start_ap(struct wiphy *wiphy,
cfg->wifi_cfg.ap.ssid_len = settings->ssid_len;
memcpy(cfg->wifi_cfg.ap.ssid, settings->ssid, settings->ssid_len);
vif->ch_hint = ieee80211_frequency_to_channel(settings->chandef.chan->center_freq);
vif->ch_hint = ieee80211_frequency_to_channel(
settings->chandef.chan->center_freq);
if (!vif->ch_hint) {
dev_err(cfg->dev,
"%s(): ieee80211_frequency_to_channel() failed\n",
......@@ -722,10 +727,10 @@ static int mt7697_cfg80211_start_ap(struct wiphy *wiphy,
goto cleanup;
}
if (settings->crypto.n_ciphers_pairwise)
ret = mt7697_set_cipher(vif, settings->crypto.ciphers_pairwise[0], true);
else
ret = mt7697_set_cipher(vif, 0, true);
ret = mt7697_set_cipher(vif,
settings->crypto.n_ciphers_pairwise ?
settings->crypto.ciphers_pairwise[0] : 0,
true);
if (ret < 0) {
dev_err(cfg->dev, "mt7697_set_cipher() failed(%d)\n", ret);
goto cleanup;
......@@ -741,15 +746,18 @@ static int mt7697_cfg80211_start_ap(struct wiphy *wiphy,
if (settings->crypto.n_akm_suites) {
ret = mt7697_set_key_mgmt(vif, settings->crypto.akm_suites[0]);
if (ret < 0) {
dev_err(cfg->dev, "%s: mt7697_set_key_mgmt() failed(%d)\n",
dev_err(cfg->dev,
"%s: mt7697_set_key_mgmt() failed(%d)\n",
__func__, ret);
goto cleanup;
}
}
ret = mt7697_wr_set_security_mode_req(cfg, vif->auth_mode, vif->prwise_crypto);
ret = mt7697_wr_set_security_mode_req(cfg, vif->auth_mode,
vif->prwise_crypto);
if (ret < 0) {
dev_err(cfg->dev, "%s: mt7697_wr_set_security_mode_req() failed(%d)\n",
dev_err(cfg->dev,
"%s: mt7697_wr_set_security_mode_req() failed(%d)\n",
__func__, ret);
goto cleanup;
}
......@@ -769,7 +777,8 @@ cleanup:
static int mt7697_cfg80211_stop_ap(struct wiphy *wiphy,
struct net_device *ndev)
{
struct mt7697_cfg80211_info *cfg = (struct mt7697_cfg80211_info*)wiphy_priv(wiphy);
struct mt7697_cfg80211_info *cfg =
(struct mt7697_cfg80211_info*)wiphy_priv(wiphy);
dev_dbg(cfg->dev, "%s(): STOP AP\n", __func__);
return 0;
}
......@@ -778,7 +787,8 @@ static int mt7697_cfg80211_change_beacon(struct wiphy *wiphy,
struct net_device *ndev,
struct cfg80211_beacon_data *info)
{
struct mt7697_cfg80211_info *cfg = (struct mt7697_cfg80211_info*)wiphy_priv(wiphy);
struct mt7697_cfg80211_info *cfg =
(struct mt7697_cfg80211_info*)wiphy_priv(wiphy);
dev_dbg(cfg->dev, "%s(): CHANGE BEACON\n", __func__);
return 0;
}
......@@ -1037,18 +1047,21 @@ int mt7697_cfg80211_stop(struct mt7697_vif *vif)
case SME_CONNECTED:
#if LINUX_VERSION_CODE >= KERNEL_VERSION(3,18,44)
cfg80211_disconnected(vif->ndev, 0, NULL, 0,
vif->locally_generated, GFP_KERNEL);
vif->locally_generated,
GFP_KERNEL);
#else
cfg80211_disconnected(vif->ndev, 0, NULL, 0, GFP_KERNEL);
cfg80211_disconnected(vif->ndev, 0, NULL, 0,
GFP_KERNEL);
#endif
break;
}
}
else if (vif->wdev.iftype == NL80211_IFTYPE_AP) {
} else if (vif->wdev.iftype == NL80211_IFTYPE_AP) {
spin_lock_bh(&vif->sta_list_lock);
list_for_each_entry_safe(sta, sta_next, &vif->sta_list, next) {
print_hex_dump(KERN_DEBUG, DRVNAME" DISCONNECT STA BSSID ",
DUMP_PREFIX_OFFSET, 16, 1, sta->bssid, ETH_ALEN, 0);
print_hex_dump(KERN_DEBUG,
DRVNAME " DISCONNECT STA BSSID ",
DUMP_PREFIX_OFFSET, 16, 1, sta->bssid,
ETH_ALEN, 0);
spin_unlock_bh(&vif->sta_list_lock);
ret = mt7697_wr_disconnect_req(vif->cfg, sta->bssid);
......@@ -1168,7 +1181,8 @@ static void mt7697_cleanup_vif(struct mt7697_cfg80211_info *cfg)
__func__, vif->fw_vif_idx);
if (vif->cfg->hif_ops->shutdown) {
ret = vif->cfg->hif_ops->shutdown(&vif->cfg->txq_hdl, &vif->cfg->rxq_hdl);
ret = vif->cfg->hif_ops->shutdown(&vif->cfg->txq_hdl,
&vif->cfg->rxq_hdl);
if (ret < 0) {
dev_err(vif->cfg->dev,
"%s(): shutdown() failed(%d)\n",
......@@ -1233,8 +1247,9 @@ struct wireless_dev* mt7697_interface_add(struct mt7697_cfg80211_info *cfg,
err = dev_alloc_name(ndev, name);
if (err < 0) {
dev_err(cfg->dev, "%s(): dev_alloc_name() failed(%d)\n",
__func__, err);
dev_err(cfg->dev,
"%s(): dev_alloc_name() failed(%d)\n", __func__,
err);
goto err;
}
......@@ -1243,7 +1258,8 @@ struct wireless_dev* mt7697_interface_add(struct mt7697_cfg80211_info *cfg,
vif->wdev.wiphy = cfg->wiphy;
vif->cfg = cfg;
vif->ndev = ndev;
INIT_WORK(&vif->disconnect_work, mt7697_cfg80211_disconnect_work);
INIT_WORK(&vif->disconnect_work,
mt7697_cfg80211_disconnect_work);
INIT_LIST_HEAD(&vif->next);
SET_NETDEV_DEV(ndev, wiphy_dev(vif->wdev.wiphy));
vif->wdev.netdev = ndev;
......@@ -1262,7 +1278,8 @@ struct wireless_dev* mt7697_interface_add(struct mt7697_cfg80211_info *cfg,
mt7697_init_netdev(ndev);
if (mt7697_cfg80211_vif_init(vif)) {
dev_err(cfg->dev, "%s(): mt7697_cfg80211_vif_init() failed\n",
dev_err(cfg->dev,
"%s(): mt7697_cfg80211_vif_init() failed\n",
__func__);
goto err;
}
......@@ -1287,8 +1304,7 @@ struct wireless_dev* mt7697_interface_add(struct mt7697_cfg80211_info *cfg,
dev_err(cfg->dev, "%s(): added('%s') type(%u)\n",
__func__, ndev->name, type);
}
else {
} else {
dev_dbg(cfg->dev, "%s(): interface exists\n", __func__);
vif = mt7697_get_vif_by_idx(cfg, 0);
}
......@@ -1308,8 +1324,10 @@ int mt7697_cfg80211_del_sta(struct mt7697_vif *vif, const u8* bssid)
spin_lock_bh(&vif->sta_list_lock);
list_for_each_entry_safe(sta, sta_next, &vif->sta_list, next) {
if (!memcmp(bssid, sta->bssid, ETH_ALEN)) {
print_hex_dump(KERN_DEBUG, DRVNAME" DISCONNECT STA BSSID ",
DUMP_PREFIX_OFFSET, 16, 1, sta->bssid, ETH_ALEN, 0);
print_hex_dump(KERN_DEBUG,
DRVNAME " DISCONNECT STA BSSID ",
DUMP_PREFIX_OFFSET, 16, 1, sta->bssid,
ETH_ALEN, 0);
spin_unlock_bh(&vif->sta_list_lock);
ret = mt7697_wr_disconnect_req(vif->cfg, sta->bssid);
......@@ -1390,12 +1408,12 @@ int mt7697_cfg80211_connect_event(struct mt7697_vif *vif, const u8* bssid,
DUMP_PREFIX_OFFSET, 16, 1, bssid, ETH_ALEN, 0);
}
if ((channel > 0) && (channel <= MT7697_CH_MAX_2G_CHANNEL))
if ((channel > 0) && (channel <= MT7697_CH_MAX_2G_CHANNEL)) {
band = wiphy->bands[IEEE80211_BAND_2GHZ];
else if ((channel >= MT7697_CH_MIN_5G_CHANNEL) &&
(channel <= MT7697_CH_MAX_5G_CHANNEL))
} else if ((channel >= MT7697_CH_MIN_5G_CHANNEL) &&
(channel <= MT7697_CH_MAX_5G_CHANNEL)) {
band = wiphy->bands[IEEE80211_BAND_5GHZ];
else {
} else {
dev_err(cfg->dev, "%s(): invalid channel(%u)\n",
__func__, channel);
ret = -EINVAL;
......@@ -1515,9 +1533,9 @@ int mt7697_cfg80211_init(struct mt7697_cfg80211_info *cfg)
wiphy->max_remain_on_channel_duration = 5000;
set_wiphy_dev(wiphy, cfg->dev);
wiphy->interface_modes = BIT(NL80211_IFTYPE_STATION) |
wiphy->interface_modes = (BIT(NL80211_IFTYPE_STATION) |
BIT(NL80211_IFTYPE_ADHOC) |
BIT(NL80211_IFTYPE_AP);
BIT(NL80211_IFTYPE_AP));
wiphy->max_scan_ssids = MT7697_SCAN_MAX_ITEMS;
wiphy->max_scan_ie_len = IEEE80211_MAX_SSID_LEN;
......
......@@ -59,7 +59,8 @@ static int mt7697_wext_siwfreq(struct net_device *ndev,
}
if (frq->e != 0 || frq->m < 1 || frq->m > FREQ_COUNT) {
dev_err(cfg->dev, "%s(): unsupported frequency(%u/%u)\n",
dev_err(cfg->dev,
"%s(): unsupported frequency(%u/%u)\n",
__func__, frq->e, frq->m);
ret = -EINVAL;
goto cleanup;
......@@ -221,25 +222,31 @@ static int mt7697_wext_giwrange(struct net_device *ndev,
wiphy->bands[IEEE80211_BAND_5GHZ]->n_channels;
for (i = 0; i < wiphy->bands[IEEE80211_BAND_2GHZ]->n_channels; i++) {
range->freq[i].m = wiphy->bands[IEEE80211_BAND_2GHZ]->channels[i].center_freq;
range->freq[i].m =
wiphy->bands[IEEE80211_BAND_2GHZ]->channels[i].center_freq;
range->freq[i].e = 6;
range->freq[i].i = wiphy->bands[IEEE80211_BAND_2GHZ]->channels[i].hw_value;
range->freq[i].i =
wiphy->bands[IEEE80211_BAND_2GHZ]->channels[i].hw_value;
}
for (i = 0; i < wiphy->bands[IEEE80211_BAND_5GHZ]->n_channels; i++) {
range->freq[i].m = wiphy->bands[IEEE80211_BAND_5GHZ]->channels[i].center_freq;
range->freq[i].m =
wiphy->bands[IEEE80211_BAND_5GHZ]->channels[i].center_freq;
range->freq[i].e = 6;
range->freq[i].i = wiphy->bands[IEEE80211_BAND_5GHZ]->channels[i].hw_value;
range->freq[i].i =
wiphy->bands[IEEE80211_BAND_5GHZ]->channels[i].hw_value;
}
range->num_bitrates = wiphy->bands[IEEE80211_BAND_2GHZ]->n_bitrates +
wiphy->bands[IEEE80211_BAND_5GHZ]->n_bitrates;
for (i = 0; i < wiphy->bands[IEEE80211_BAND_2GHZ]->n_bitrates; i++) {
range->bitrate[i] = wiphy->bands[IEEE80211_BAND_2GHZ]->bitrates[i].bitrate * 100000;
range->bitrate[i] =
wiphy->bands[IEEE80211_BAND_2GHZ]->bitrates[i].bitrate * 100000;
}
for (i = 0; i < wiphy->bands[IEEE80211_BAND_5GHZ]->n_bitrates; i++) {
range->bitrate[i] = wiphy->bands[IEEE80211_BAND_5GHZ]->bitrates[i].bitrate * 100000;
range->bitrate[i] =
wiphy->bands[IEEE80211_BAND_5GHZ]->bitrates[i].bitrate * 100000;
}
return 0;
......@@ -370,10 +377,9 @@ static int mt7697_wext_siwessid(struct net_device *ndev,
__func__, ret);
goto cleanup;
}
}
else {
ret = mt7697_wr_set_security_mode_req(cfg,
MT7697_WIFI_AUTH_MODE_OPEN,
} else {
ret = mt7697_wr_set_security_mode_req(
cfg, MT7697_WIFI_AUTH_MODE_OPEN,
MT7697_WIFI_ENCRYPT_TYPE_ENCRYPT_DISABLED);
if (ret < 0) {
dev_err(cfg->dev,
......@@ -406,8 +412,7 @@ static int mt7697_wext_siwessid(struct net_device *ndev,
__func__, ret);
goto cleanup;
}
}
else if ((cfg->wifi_cfg.opmode == MT7697_WIFI_MODE_STA_ONLY) &&
} else if ((cfg->wifi_cfg.opmode == MT7697_WIFI_MODE_STA_ONLY) &&
test_bit(CONNECTED, &vif->flags)) {
ret = mt7697_wr_disconnect_req(vif->cfg, NULL);
if (ret < 0) {
......@@ -607,4 +612,3 @@ const struct iw_handler_def mt7697_wireless_hndlrs = {
.standard = (iw_handler *) mt7697_wireless_handler,
.get_wireless_stats = NULL,
};
......@@ -71,8 +71,9 @@ static int mt7697_open(struct net_device *ndev)
if (test_bit(CONNECTED, &vif->flags)) {
netif_carrier_on(ndev);
netif_wake_queue(ndev);
} else
} else {
netif_carrier_on(ndev);
}
cleanup:
return ret;
......@@ -145,7 +146,8 @@ static void mt7697_init_hw_start(struct work_struct *work)
if (!strcmp(hw_itf, "spi")) {
dev_dbg(cfg->dev, "%s(): init mt7697 queue(%u/%u)\n",
__func__, MT7697_MAC80211_QUEUE_TX, MT7697_MAC80211_QUEUE_RX);
__func__, MT7697_MAC80211_QUEUE_TX,
MT7697_MAC80211_QUEUE_RX);
err = cfg->hif_ops->init(MT7697_MAC80211_QUEUE_TX,
MT7697_MAC80211_QUEUE_RX, cfg,
mt7697_notify_tx,
......@@ -156,8 +158,7 @@ static void mt7697_init_hw_start(struct work_struct *work)
__func__, MT7697_MAC80211_QUEUE_TX, err);
goto failed;
}
}
else {
} else {
dev_dbg(cfg->dev, "%s(): open mt7697 uart\n", __func__);
cfg->txq_hdl = cfg->hif_ops->open(mt7697_proc_80211cmd, cfg);
if (!cfg->txq_hdl) {
......@@ -245,14 +246,12 @@ static int mt7697_probe(struct platform_device *pdev)
if_ops.read = mt7697q_read;
if_ops.write = mt7697q_write;
if_ops.unblock_writer = mt7697q_unblock_writer;
}
else if (!strcmp(hw_itf, "uart")) {
} else if (!strcmp(hw_itf, "uart")) {
if_ops.open = mt7697_uart_open;
if_ops.close = mt7697_uart_close;
if_ops.read = mt7697_uart_read;
if_ops.write = mt7697_uart_write;
}
else {
} else {
dev_err(&pdev->dev,
"%s(): invalid hw itf(spi/uart) module paramter('%s')\n",
__func__, hw_itf);
......@@ -374,13 +373,13 @@ int mt7697_disconnect(struct mt7697_vif *vif)
if (test_bit(CONNECTED, &vif->flags) ||
test_bit(CONNECT_PEND, &vif->flags)) {
if (vif->sme_state == SME_CONNECTING)
if (vif->sme_state == SME_CONNECTING) {
cfg80211_connect_result(vif->ndev, vif->bssid,
NULL, 0,
NULL, 0,
WLAN_STATUS_UNSPECIFIED_FAILURE,
GFP_KERNEL);
else if (vif->sme_state == SME_CONNECTED) {
} else if (vif->sme_state == SME_CONNECTED) {
#if LINUX_VERSION_CODE >= KERNEL_VERSION(3,18,44)
cfg80211_disconnected(vif->ndev, 0,
NULL, 0, vif->locally_generated,
......@@ -414,4 +413,3 @@ cleanup:
MODULE_AUTHOR("Sierra Wireless Corporation");
MODULE_LICENSE("GPL");
MODULE_DESCRIPTION("MediaTek7697 WiFi 80211");
......@@ -31,7 +31,8 @@ int mt7697_notify_tx(void* priv, u32 free)
cfg->hif_ops->unblock_writer(cfg->txq_hdl);
ret = queue_work(cfg->tx_workq, &cfg->tx_work);
if (ret < 0) {
dev_err(cfg->dev, "%s(): queue_work() failed(%d)\n",
dev_err(cfg->dev,
"%s(): queue_work() failed(%d)\n",
__func__, ret);
goto cleanup;
}
......@@ -131,7 +132,8 @@ void mt7697_tx_work(struct work_struct *work)
vif->net_stats.tx_errors++;
}
dev_dbg(cfg->dev, "%s(): tx complete pkt(%p)\n", __func__, tx_pkt->skb);
dev_dbg(cfg->dev, "%s(): tx complete pkt(%p)\n", __func__,
tx_pkt->skb);
vif->net_stats.tx_packets++;
vif->net_stats.tx_bytes += tx_pkt->skb->len;
......@@ -154,7 +156,8 @@ void mt7697_tx_stop(struct mt7697_cfg80211_info *cfg)
struct mt7697_vif *vif = netdev_priv(tx_pkt->skb->dev);
WARN_ON(!vif);
dev_dbg(cfg->dev, "%s(): tx drop pkt(%p)\n", __func__, tx_pkt->skb);
dev_dbg(cfg->dev, "%s(): tx drop pkt(%p)\n", __func__,
tx_pkt->skb);
vif->net_stats.tx_dropped++;
spin_lock_bh(&cfg->tx_skb_list_lock);
......@@ -221,7 +224,8 @@ int mt7697_rx_data(struct mt7697_cfg80211_info *cfg, u32 len, u32 if_idx)
goto cleanup;
}
dev_err(cfg->dev, "%s(): netif_rx_ni() failed(%d)\n", __func__, ret);
dev_err(cfg->dev, "%s(): netif_rx_ni() failed(%d)\n", __func__,
ret);
goto cleanup;
}
......
......@@ -35,33 +35,38 @@
/**@brief Specifies 20MHz | 40MHz bandwidth in the 2.4GHz band.
*/
#define MT7697_WIFI_IOT_COMMAND_CONFIG_BANDWIDTH_2040MHZ (MT7697_WIFI_IOT_COMMAND_CONFIG_BANDWIDTH_20MHZ | \
#define MT7697_WIFI_IOT_COMMAND_CONFIG_BANDWIDTH_2040MHZ \
(MT7697_WIFI_IOT_COMMAND_CONFIG_BANDWIDTH_20MHZ | \
MT7697_WIFI_IOT_COMMAND_CONFIG_BANDWIDTH_40MHZ)
/**
* @brief Station operation mode. In this mode the device works as a Wi-Fi client.
*/
* @brief Station operation mode. In this mode the device works as a Wi-Fi
* client.
*/
#define MT7697_WIFI_MODE_STA_ONLY (1)
/**
* @brief SoftAP operation mode. In AP mode, other client devices can connect to the Wi-Fi AP.
*/
* @brief SoftAP operation mode. In AP mode, other client devices can connect to
* the Wi-Fi AP.
*/
#define MT7697_WIFI_MODE_AP_ONLY (2)
/**
* @brief Repeater mode. There are two virtual ports in repeater mode, one is #WIFI_PORT_AP, and the other is #WIFI_PORT_APCLI.
* Both ports should be configured to operate on the same channel with the same bandwidth, while their other settings can be different.
* For example, both ports can have different MAC addresses and security modes.
*/
* @brief Repeater mode. There are two virtual ports in repeater mode, one is
* #WIFI_PORT_AP, and the other is #WIFI_PORT_APCLI. Both ports should be
* configured to operate on the same channel with the same bandwidth, while
* their other settings can be different. For example, both ports can have
* different MAC addresses and security modes.
*/
#define MT7697_WIFI_MODE_REPEATER (3)
/**
* @brief This macro defines the monitoring mode. In this mode it can sniffer
* the Wi-Fi packet in the air given the specific channel and bandwidth.
* It is used to enter a hybrid mode and handle a raw packet.
* Call #wifi_config_register_rx_handler() to register a raw packet handler
* once this mode is set.
*/
* @brief This macro defines the monitoring mode. In this mode it can sniffer
* the Wi-Fi packet in the air given the specific channel and bandwidth. It is
* used to enter a hybrid mode and handle a raw packet. Call
* #wifi_config_register_rx_handler() to register a raw packet handler once this
* mode is set.
*/
#define MT7697_WIFI_MODE_MONITOR (4)
enum mt7697_port_type {
......@@ -81,8 +86,10 @@ enum mt7697_scan_option {
MT7697_WIFI_SCAN_OPTION_FORCE_ACTIVE,
};
/** @brief This enumeration defines the wireless authentication mode to indicate the Wi-Fi device’s authentication attribute.
*/
/**
* @brief This enumeration defines the wireless authentication mode to indicate
* the Wi-Fi device’s authentication attribute.
*/
enum mt7697_wifi_auth_mode_t {
MT7697_WIFI_AUTH_MODE_OPEN = 0, /**< Open mode. */
MT7697_WIFI_AUTH_MODE_SHARED, /**< Not supported. */
......@@ -96,8 +103,10 @@ enum mt7697_wifi_auth_mode_t {
MT7697_WIFI_AUTH_MODE_WPA_PSK_WPA2_PSK, /**< Mixture mode. */
};
/** @brief This enumeration defines the wireless encryption type to indicate the Wi-Fi device’s encryption attribute.
*/
/**
* @brief This enumeration defines the wireless encryption type to indicate the
* Wi-Fi device’s encryption attribute.
*/
enum mt7697_wifi_encrypt_type_t {
MT7697_WIFI_ENCRYPT_TYPE_WEP_ENABLED = 0, /**< WEP encryption type. */
MT7697_WIFI_ENCRYPT_TYPE_ENCRYPT1_ENABLED = MT7697_WIFI_ENCRYPT_TYPE_WEP_ENABLED, /**< WEP encryption type. */
......@@ -106,7 +115,7 @@ enum mt7697_wifi_encrypt_type_t {
MT7697_WIFI_ENCRYPT_TYPE_WEP_KEY_ABSENT = 2, /**< Not supported. */
MT7697_WIFI_ENCRYPT_TYPE_ENCRYPT_KEY_ABSENT = MT7697_WIFI_ENCRYPT_TYPE_WEP_KEY_ABSENT, /**< Not supported. */
MT7697_WIFI_ENCRYPT_TYPE_WEP_NOT_SUPPORTED = 3, /**< Not supported. */
MT7697_WIFI_ENCRYPT_TYPE_ENCRYPT_NOT_SUPPORTED = MT7697_WIFI_ENCRYPT_TYPE_WEP_NOT_SUPPORTED,/**< Not supported. */
MT7697_WIFI_ENCRYPT_TYPE_ENCRYPT_NOT_SUPPORTED = MT7697_WIFI_ENCRYPT_TYPE_WEP_NOT_SUPPORTED, /**< Not supported. */
MT7697_WIFI_ENCRYPT_TYPE_TKIP_ENABLED = 4, /**< TKIP encryption. */
MT7697_WIFI_ENCRYPT_TYPE_ENCRYPT2_ENABLED = MT7697_WIFI_ENCRYPT_TYPE_TKIP_ENABLED, /**< TKIP encryption. */
MT7697_WIFI_ENCRYPT_TYPE_AES_ENABLED = 6, /**< AES encryption. */
......@@ -139,8 +148,10 @@ enum mt7697_wifi_phy_mode_t {
MT7697_WIFI_PHY_11N_5G, /**< 11, 11n-only with 5GHz band. */
};
/** @brief This enumeration defines the RX filter register's bitmap. Each bit indicates a specific drop frame.
*/
/**
* @brief This enumeration defines the RX filter register's bitmap. Each bit
* indicates a specific drop frame.
*/
enum mt7697_wifi_rx_filter_t {
MT7697_WIFI_RX_FILTER_DROP_STBC_BCN_BC_MC, /**< bit 0 Drops the STBC beacon/BC/MC frames. */
MT7697_WIFI_RX_FILTER_DROP_FCS_ERR, /**< bit 1 Drops the FCS error frames. */
......@@ -160,8 +171,10 @@ enum mt7697_wifi_rx_filter_t {
MT7697_WIFI_RX_FILTER_DROP_NDPA /**< bit 20 Drops the NDPA or not. */
};
/** @brief This structure is the Wi-Fi configuration for initialization in STA mode.
*/
/**
* @brief This structure is the Wi-Fi configuration for initialization in STA
* mode.
*/
struct mt7697_wifi_sta_config_t {
u8 ssid[IEEE80211_MAX_SSID_LEN]; /**< The SSID of the target AP. */
u8 ssid_len; /**< The length of the SSID. */
......
......@@ -153,11 +153,11 @@ static int mt7697_proc_get_cfg(const struct mt7697_rsp_hdr* rsp,
wifi_cfg = (struct mt7697_wifi_config_t*)rd_buf;
dev_dbg(cfg->dev, "%s(): operation mode(%u)\n",
__func__, wifi_cfg->opmode);
if (wifi_cfg->opmode == MT7697_WIFI_MODE_STA_ONLY)
if (wifi_cfg->opmode == MT7697_WIFI_MODE_STA_ONLY) {
cfg->port_type = MT7697_PORT_STA;
else if (wifi_cfg->opmode == MT7697_WIFI_MODE_AP_ONLY)
} else if (wifi_cfg->opmode == MT7697_WIFI_MODE_AP_ONLY) {
cfg->port_type = MT7697_PORT_AP;
else {
} else {
dev_err(cfg->dev,
"%s(): unsupported operation mode(%d)\n",
__func__, wifi_cfg->opmode);
......@@ -227,7 +227,8 @@ static int mt7697_proc_get_cfg(const struct mt7697_rsp_hdr* rsp,
dev_dbg(cfg->dev, "%s(): AP passphrase len(%u)\n",
__func__, wifi_cfg->ap.pw_len);
if (wifi_cfg->ap.pw_len > 0) {
if (wifi_cfg->ap.pw_len > MT7697_WIFI_LENGTH_PASSPHRASE) {
if (wifi_cfg->ap.pw_len >
MT7697_WIFI_LENGTH_PASSPHRASE) {
dev_err(cfg->dev,
"%s(): invalid AP passphrase len(%u > %u)\n",
__func__, wifi_cfg->ap.pw_len,
......@@ -245,7 +246,8 @@ static int mt7697_proc_get_cfg(const struct mt7697_rsp_hdr* rsp,
wifi_cfg->ap.encrypt_type);
dev_dbg(cfg->dev, "%s(): AP channel(%u) bandwidth(%u)\n",
__func__, wifi_cfg->ap.ch, wifi_cfg->ap.bandwidth);
if (wifi_cfg->ap.bandwidth == MT7697_WIFI_IOT_COMMAND_CONFIG_BANDWIDTH_40MHZ) {
if (wifi_cfg->ap.bandwidth ==
MT7697_WIFI_IOT_COMMAND_CONFIG_BANDWIDTH_40MHZ) {
dev_dbg(cfg->dev, "%s(): AP bandwidth ext(%u)\n",
__func__, wifi_cfg->ap.bandwidth_ext);
}
......@@ -349,8 +351,7 @@ static int mt7697_proc_scan_ind(const struct mt7697_rsp_hdr* rsp,
__func__, probe_rsp_len, IEEE80211_MAX_DATA_LEN);
ret = -EINVAL;
goto cleanup;
}
else if (!probe_rsp_len) {
} else if (!probe_rsp_len) {
dev_err(cfg->dev, "%s(): invalid probe rsp len(%d)\n",
__func__, probe_rsp_len);
ret = -EINVAL;
......@@ -377,12 +378,12 @@ static int mt7697_proc_scan_ind(const struct mt7697_rsp_hdr* rsp,
struct ieee80211_supported_band *band;
u32 freq;
if ((ch > 0) && (ch <= MT7697_CH_MAX_2G_CHANNEL))
if ((ch > 0) && (ch <= MT7697_CH_MAX_2G_CHANNEL)) {
band = cfg->wiphy->bands[IEEE80211_BAND_2GHZ];
else if ((ch >= MT7697_CH_MIN_5G_CHANNEL) &&
(ch <= MT7697_CH_MAX_5G_CHANNEL))
} else if ((ch >= MT7697_CH_MIN_5G_CHANNEL) &&
(ch <= MT7697_CH_MAX_5G_CHANNEL)) {
band = cfg->wiphy->bands[IEEE80211_BAND_5GHZ];
else {
} else {
dev_err(cfg->dev, "%s(): invalid channel(%u)\n",
__func__, ch);
ret = -EINVAL;
......@@ -430,8 +431,7 @@ static int mt7697_proc_scan_ind(const struct mt7697_rsp_hdr* rsp,
__func__, bss->channel->band,
bss->channel->center_freq);
}
}
else {
} else {
dev_err(cfg->dev, "%s(): Rx unsupported mgmt frame\n",
__func__);
ret = -EINVAL;
......@@ -581,7 +581,8 @@ static int mt7697_proc_connect_ind(const struct mt7697_rsp_hdr* rsp,
if (cfg->wifi_cfg.opmode == MT7697_WIFI_MODE_STA_ONLY) {
vif = mt7697_get_vif_by_idx(cfg, if_idx);
if (!vif) {
dev_err(cfg->dev, "%s(): mt7697_get_vif_by_idx(%u) failed\n",
dev_err(cfg->dev,
"%s(): mt7697_get_vif_by_idx(%u) failed\n",
__func__, if_idx);
ret = -EINVAL;
goto cleanup;
......@@ -597,13 +598,13 @@ static int mt7697_proc_connect_ind(const struct mt7697_rsp_hdr* rsp,
goto cleanup;
}
}
}
else {
} else {
struct station_info sinfo = {0};
vif = mt7697_get_vif_by_idx(cfg, 0);
if (!vif) {
dev_err(cfg->dev, "%s(): mt7697_get_vif_by_idx(%u) failed\n",
dev_err(cfg->dev,
"%s(): mt7697_get_vif_by_idx(%u) failed\n",
__func__, if_idx);
ret = -EINVAL;
goto cleanup;
......@@ -673,7 +674,8 @@ static int mt7697_proc_disconnect_ind(struct mt7697_cfg80211_info *cfg)
if (cfg->wifi_cfg.opmode == MT7697_WIFI_MODE_STA_ONLY) {
vif = mt7697_get_vif_by_idx(cfg, if_idx);
if (!vif) {
dev_err(cfg->dev, "%s(): mt7697_get_vif_by_idx(%u) failed\n",
dev_err(cfg->dev,
"%s(): mt7697_get_vif_by_idx(%u) failed\n",
__func__, if_idx);
ret = -EINVAL;
goto cleanup;
......@@ -695,18 +697,17 @@ static int mt7697_proc_disconnect_ind(struct mt7697_cfg80211_info *cfg)
NULL, 0,
WLAN_STATUS_UNSPECIFIED_FAILURE,
GFP_KERNEL);
}
else if (vif->sme_state == SME_CONNECTED) {
} else if (vif->sme_state == SME_CONNECTED) {
#if LINUX_VERSION_CODE >= KERNEL_VERSION(3,18,44)
cfg80211_disconnected(vif->ndev, proto_reason,
NULL, 0, vif->locally_generated, GFP_KERNEL);
cfg80211_disconnected(vif->ndev, proto_reason, NULL, 0,
vif->locally_generated,
GFP_KERNEL);
#else
cfg80211_disconnected(vif->ndev, proto_reason,
NULL, 0, GFP_KERNEL);
cfg80211_disconnected(vif->ndev, proto_reason, NULL, 0,
GFP_KERNEL);
#endif
}
}
else {
} else {
vif = mt7697_get_vif_by_idx(cfg, 0);
if (!vif) {
dev_err(cfg->dev,
......@@ -925,15 +926,18 @@ int mt7697_proc_80211cmd(const struct mt7697_rsp_hdr* rsp, void* priv)
break;
case MT7697_CMD_SET_LISTEN_INTERVAL_RSP:
dev_dbg(cfg->dev, "%s(): --> SET LISTEN INTERVAL RSP\n", __func__);
dev_dbg(cfg->dev, "%s(): --> SET LISTEN INTERVAL RSP\n",
__func__);
break;
case MT7697_CMD_SET_WIRELESS_MODE_RSP:
dev_dbg(cfg->dev, "%s(): --> SET WIRELESS MODE RSP\n", __func__);
dev_dbg(cfg->dev, "%s(): --> SET WIRELESS MODE RSP\n",
__func__);
break;
case MT7697_CMD_SET_SECURITY_MODE_RSP:
dev_dbg(cfg->dev, "%s(): --> SET SECURITY MODE RSP\n", __func__);
dev_dbg(cfg->dev, "%s(): --> SET SECURITY MODE RSP\n",
__func__);
break;
case MT7697_CMD_SCAN_STOP_RSP:
......@@ -1139,7 +1143,8 @@ cleanup:
return ret;
}
int mt7697_wr_reload_settings_req(const struct mt7697_cfg80211_info* cfg, u8 if_idx)
int mt7697_wr_reload_settings_req(const struct mt7697_cfg80211_info* cfg,
u8 if_idx)
{
struct mt7697_reload_settings_req req;
int ret;
......@@ -1443,9 +1448,9 @@ int mt7697_wr_disconnect_req(const struct mt7697_cfg80211_info *cfg,
if (addr) {
req.port = MT7697_PORT_AP;
memcpy(req.addr, addr, ETH_ALEN);
}
else
} else {
req.port = MT7697_PORT_STA;
}
dev_dbg(cfg->dev, "%s(): <-- DISCONNECT len(%u)\n",
__func__, req.cmd.len);
......
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