BigW Consortium Gitlab

Commit c6878f74 by David Clark

Updates to use the current cp2130 driver changes

parent 220ee96b
......@@ -83,16 +83,15 @@ static int mt7697io_read16(struct mt7697q_info *qinfo, u8 reg, u16 *value)
qinfo->txBuffer[0] = MT7697_IO_CMD_READ;
qinfo->txBuffer[1] = reg;
ret = qinfo->hw_ops->write_then_read(qinfo->hw_priv,
qinfo->txBuffer, sizeof(u16),
qinfo->rxBuffer, sizeof(qinfo->rxBuffer));
ret = qinfo->hw_ops->write_then_read(qinfo->hw_priv,
qinfo->txBuffer, qinfo->rxBuffer, sizeof(u16) + sizeof(u16));
if (ret < 0) {
dev_err(qinfo->dev, "%s(): write_then_read() failed(%d)\n",
__func__, ret);
goto cleanup;
}
*value = ((qinfo->rxBuffer[0] << 8) | qinfo->rxBuffer[1]);
*value = ((qinfo->rxBuffer[2] << 8) | qinfo->rxBuffer[3]);
cleanup:
return ret;
......
......@@ -426,14 +426,14 @@ int mt7697q_proc_data(struct mt7697q_spec *qsS2M)
dev_dbg(qsS2M->qinfo->dev, "%s(): avail(%u) len(%u) req(%u)\n",
__func__, avail, qsS2M->qinfo->rsp.cmd.len, req);
}
}
ret = mt7697q_push_rd_ptr(qsS2M);
if (ret < 0) {
dev_err(qsS2M->qinfo->dev,
"%s(): mt7697q_push_rd_ptr() failed(%d)\n",
__func__, ret);
goto cleanup;
ret = mt7697q_push_rd_ptr(qsS2M);
if (ret < 0) {
dev_err(qsS2M->qinfo->dev,
"%s(): mt7697q_push_rd_ptr() failed(%d)\n",
__func__, ret);
goto cleanup;
}
}
cleanup:
......
......@@ -55,7 +55,7 @@ struct mt7697q_info {
struct mt7697q_spec queues[MT7697_NUM_QUEUES];
struct mt7697q_rsp_hdr rsp;
u8 txBuffer[sizeof(u32)];
u8 rxBuffer[sizeof(u16)];
u8 rxBuffer[sizeof(u32)];
struct device *dev;
void *hw_priv;
......
......@@ -30,6 +30,18 @@
#include "queue.h"
#include "spi.h"
static int mt7697spi_write_then_read(struct spi_device *spi, const void *txbuf,
void *rxbuf, unsigned len)
{
struct spi_transfer transfer = {
.tx_buf = txbuf,
.rx_buf = rxbuf,
.len = len,
};
return spi_sync_transfer(spi, &transfer, 1);
}
static void mt7697spi_reset(struct spi_device *spi)
{
......@@ -53,7 +65,7 @@ static const struct mt7697spi_hw_ops hw_ops =
{
.write = spi_write,
.read = spi_read,
.write_then_read = spi_write_then_read,
.write_then_read = mt7697spi_write_then_read,
.reset = mt7697spi_reset,
.enable_irq = mt7697spi_enable_irq,
.disable_irq = mt7697spi_disable_irq,
......@@ -72,8 +84,6 @@ static int __init mt7697spi_init(void)
pr_info(DRVNAME" %s(): '%s' initialize\n", __func__, DRVNAME);
while (!master && (bus_num >= 0)) {
// pr_info(DRVNAME" %s(): get SPI master bus(%u)\n",
// __func__, bus_num);
master = spi_busnum_to_master(bus_num);
if (!master)
bus_num--;
......@@ -136,9 +146,10 @@ static int __init mt7697spi_init(void)
INIT_DELAYED_WORK(&qinfo->irq_delayed_work, mt7697_irq_delayed_work);
INIT_WORK(&qinfo->irq_work, mt7697_irq_work);
qinfo->irq_workq = create_workqueue(DRVNAME"wq");
qinfo->irq_workq = alloc_workqueue(DRVNAME"wq",
WQ_HIGHPRI | WQ_MEM_RECLAIM | WQ_UNBOUND, 1);
if (!qinfo->irq_workq) {
dev_err(qinfo->dev, "%s(): create_workqueue() failed\n",
dev_err(qinfo->dev, "%s(): alloc_workqueue() failed\n",
__func__);
ret = -ENOMEM;
goto cleanup;
......@@ -189,8 +200,6 @@ static void __exit mt7697spi_exit(void)
int bus_num = MT7697_SPI_BUS_NUM;
while (!master && (bus_num >= 0)) {
// pr_info(DRVNAME" %s(): get SPI master bus(%u)\n",
// __func__, bus_num);
master = spi_busnum_to_master(bus_num);
if (!master)
bus_num--;
......
......@@ -36,8 +36,7 @@
struct mt7697spi_hw_ops {
int (*write)(struct spi_device*, const void*, size_t);
int (*read)(struct spi_device*, void*, size_t);
int (*write_then_read)(struct spi_device*, const void*, unsigned,
void*, unsigned);
int (*write_then_read)(struct spi_device*, const void*, void*, unsigned);
void (*reset)(struct spi_device*);
void (*enable_irq)(struct spi_device*);
void (*disable_irq)(struct spi_device*);
......
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