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