wilc1000: ignore clockless registers status response for SPI
authorAjay Singh <ajay.kathat@microchip.com>
Thu, 16 Sep 2021 16:49:20 +0000 (16:49 +0000)
committerKalle Valo <kvalo@codeaurora.org>
Tue, 21 Sep 2021 15:08:16 +0000 (18:08 +0300)
During WILC chip wake-up sequence, the clockless status register sometimes
reports failure even when the actual status is successful. So, for the
clockless register, remove the incorrect error status reporting during the
read and write command API's.

Signed-off-by: Ajay Singh <ajay.kathat@microchip.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
Link: https://lore.kernel.org/r/20210916164902.74629-8-ajay.kathat@microchip.com
drivers/net/wireless/microchip/wilc1000/spi.c

index 511b926..4f0bc24 100644 (file)
@@ -474,7 +474,7 @@ static int wilc_spi_single_read(struct wilc *wilc, u8 cmd, u32 adr, void *b,
        }
 
        r = (struct wilc_spi_rsp_data *)&rb[cmd_len];
-       if (r->rsp_cmd_type != cmd) {
+       if (r->rsp_cmd_type != cmd && !clockless) {
                if (!spi_priv->probing_crc)
                        dev_err(&spi->dev,
                                "Failed cmd, cmd (%02x), resp (%02x)\n",
@@ -482,7 +482,7 @@ static int wilc_spi_single_read(struct wilc *wilc, u8 cmd, u32 adr, void *b,
                return -EINVAL;
        }
 
-       if (r->status != WILC_SPI_COMMAND_STAT_SUCCESS) {
+       if (r->status != WILC_SPI_COMMAND_STAT_SUCCESS && !clockless) {
                dev_err(&spi->dev, "Failed cmd state response state (%02x)\n",
                        r->status);
                return -EINVAL;
@@ -571,14 +571,18 @@ static int wilc_spi_write_cmd(struct wilc *wilc, u8 cmd, u32 adr, u32 data,
        }
 
        r = (struct wilc_spi_rsp_data *)&rb[cmd_len];
-       if (r->rsp_cmd_type != cmd) {
+       /*
+        * Clockless registers operations might return unexptected responses,
+        * even if successful.
+        */
+       if (r->rsp_cmd_type != cmd && !clockless) {
                dev_err(&spi->dev,
                        "Failed cmd response, cmd (%02x), resp (%02x)\n",
                        cmd, r->rsp_cmd_type);
                return -EINVAL;
        }
 
-       if (r->status != WILC_SPI_COMMAND_STAT_SUCCESS) {
+       if (r->status != WILC_SPI_COMMAND_STAT_SUCCESS && !clockless) {
                dev_err(&spi->dev, "Failed cmd state response state (%02x)\n",
                        r->status);
                return -EINVAL;