return N_FAIL;
}
- /**
+ /*
* Command/Control response
- **/
+ */
if (cmd == CMD_RESET ||
cmd == CMD_TERMINATE ||
cmd == CMD_REPEAT) {
return N_FAIL;
}
- /**
+ /*
* State response
- **/
+ */
rsp = rb[rix++];
if (rsp != 0x00) {
dev_err(&spi->dev, "Failed cmd state response state (%02x)\n",
int retry;
/* u16 crc1, crc2; */
u8 crc[2];
- /**
+ /*
* Data Respnose header
- **/
+ */
retry = 100;
do {
- /* ensure there is room in buffer later to read data and crc */
+ /*
+ * ensure there is room in buffer later
+ * to read data and crc
+ */
if (rix < len2) {
rsp = rb[rix++];
} else {
}
if (cmd == CMD_INTERNAL_READ || cmd == CMD_SINGLE_READ) {
- /**
+ /*
* Read bytes
- **/
+ */
if ((rix + 3) < len2) {
b[0] = rb[rix++];
b[1] = rb[rix++];
}
if (!g_spi.crc_off) {
- /**
+ /*
* Read Crc
- **/
+ */
if ((rix + 1) < len2) {
crc[0] = rb[rix++];
crc[1] = rb[rix++];
else
nbytes = DATA_PKT_SZ - ix;
- /**
+ /*
* Read bytes
- **/
+ */
if (wilc_spi_rx(wilc, &b[ix], nbytes)) {
dev_err(&spi->dev, "Failed data block read, bus error...\n");
result = N_FAIL;
goto _error_;
}
- /**
+ /*
* Read Crc
- **/
+ */
if (!g_spi.crc_off) {
if (wilc_spi_rx(wilc, crc, 2)) {
dev_err(&spi->dev, "Failed data block crc read, bus error...\n");
sz -= nbytes;
}
- /* if any data in left unread, then read the rest using normal DMA code.*/
+ /*
+ * if any data in left unread,
+ * then read the rest using normal DMA code.
+ */
while (sz > 0) {
int nbytes;
else
nbytes = DATA_PKT_SZ;
- /**
+ /*
* read data response only on the next DMA cycles not
* the first DMA since data response header is already
* handled above for the first DMA.
- **/
- /**
+ */
+ /*
* Data Respnose header
- **/
+ */
retry = 10;
do {
if (wilc_spi_rx(wilc, &rsp, 1)) {
if (result == N_FAIL)
break;
- /**
+ /*
* Read bytes
- **/
+ */
if (wilc_spi_rx(wilc, &b[ix], nbytes)) {
dev_err(&spi->dev, "Failed data block read, bus error...\n");
result = N_FAIL;
break;
}
- /**
+ /*
* Read Crc
- **/
+ */
if (!g_spi.crc_off) {
if (wilc_spi_rx(wilc, crc, 2)) {
dev_err(&spi->dev, "Failed data block crc read, bus error...\n");
u8 cmd, order, crc[2] = {0};
/* u8 rsp; */
- /**
- * Data
- **/
+ /*
+ * Data
+ */
ix = 0;
do {
if (sz <= DATA_PKT_SZ)
else
nbytes = DATA_PKT_SZ;
- /**
- * Write command
- **/
+ /*
+ * Write command
+ */
cmd = 0xf0;
if (ix == 0) {
if (sz <= DATA_PKT_SZ)
break;
}
- /**
- * Write data
- **/
+ /*
+ * Write data
+ */
if (wilc_spi_tx(wilc, &b[ix], nbytes)) {
dev_err(&spi->dev,
"Failed data block write, bus error...\n");
break;
}
- /**
- * Write Crc
- **/
+ /*
+ * Write Crc
+ */
if (!g_spi.crc_off) {
if (wilc_spi_tx(wilc, crc, 2)) {
dev_err(&spi->dev, "Failed data block crc write, bus error...\n");
}
}
- /**
- * No need to wait for response
- **/
+ /*
+ * No need to wait for response
+ */
ix += nbytes;
sz -= nbytes;
} while (sz);
data = cpu_to_le32(data);
if (addr < 0x30) {
- /* Clockless register*/
+ /* Clockless register */
cmd = CMD_INTERNAL_WRITE;
clockless = 1;
}
int result;
u8 cmd = CMD_DMA_EXT_WRITE;
- /**
- * has to be greated than 4
- **/
+ /*
+ * has to be greated than 4
+ */
if (size <= 4)
return 0;
return 0;
}
- /**
- * Data
- **/
+ /*
+ * Data
+ */
result = spi_data_write(wilc, buf, size);
if (result != N_OK)
dev_err(&spi->dev, "Failed block data write...\n");
if (addr < 0x30) {
/* dev_err(&spi->dev, "***** read addr %d\n\n", addr); */
- /* Clockless register*/
+ /* Clockless register */
cmd = CMD_INTERNAL_READ;
clockless = 1;
}
static int _wilc_spi_deinit(struct wilc *wilc)
{
- /**
- * TODO:
- **/
+ /*
+ * TODO:
+ */
return 1;
}
memset(&g_spi, 0, sizeof(struct wilc_spi));
- /**
- * configure protocol
- **/
+ /*
+ * configure protocol
+ */
g_spi.crc_off = 0;
- /* TODO: We can remove the CRC trials if there is a definite way to reset */
+ /*
+ * TODO: We can remove the CRC trials if there is a definite
+ * way to reset
+ */
/* the SPI to it's initial value. */
if (!spi_internal_read(wilc, WILC_SPI_PROTOCOL_OFFSET, ®)) {
- /* Read failed. Try with CRC off. This might happen when module
+ /*
+ * Read failed. Try with CRC off. This might happen when module
* is removed but chip isn't reset
*/
g_spi.crc_off = 1;
}
}
if (g_spi.crc_off == 0) {
- reg &= ~0xc; /* disable crc checking */
+ reg &= ~0xc; /* disable crc checking */
reg &= ~0x70;
reg |= (0x5 << 4);
if (!spi_internal_write(wilc, WILC_SPI_PROTOCOL_OFFSET, reg)) {
g_spi.crc_off = 1;
}
- /**
- * make sure can read back chip id correctly
- **/
+ /*
+ * make sure can read back chip id correctly
+ */
if (!wilc_spi_read_reg(wilc, 0x1000, &chipid)) {
dev_err(&spi->dev, "Fail cmd read chip id...\n");
return 0;
ret = 1;
for (i = 0; i < g_spi.nint; i++) {
- /* No matter what you write 1 or 0, it will clear interrupt. */
+ /*
+ * No matter what you write 1 or 0,
+ * it will clear interrupt.
+ */
if (flags & 1)
ret = wilc_spi_write_reg(wilc, 0x10c8 + i * 4, 1);
if (!ret)
}
if ((val & EN_VMM) == EN_VMM) {
- /**
- * enable vmm transfer.
- **/
+ /*
+ * enable vmm transfer.
+ */
ret = wilc_spi_write_reg(wilc,
WILC_VMM_CORE_CTL, 1);
if (!ret) {
g_spi.nint = nint;
- /**
- * interrupt pin mux select
- **/
+ /*
+ * interrupt pin mux select
+ */
ret = wilc_spi_read_reg(wilc, WILC_PIN_MUX_0, ®);
if (!ret) {
dev_err(&spi->dev, "Failed read reg (%08x)...\n",
return 0;
}
- /**
- * interrupt enable
- **/
+ /*
+ * interrupt enable
+ */
ret = wilc_spi_read_reg(wilc, WILC_INTR_ENABLE, ®);
if (!ret) {
dev_err(&spi->dev, "Failed read reg (%08x)...\n",