fsi/fsi-master-gpio: More error handling cleanup

Remove calls to the empty and useless fsi_master_gpio_error()
function, and report CRC errors as "FSI_ERR_NO_SLAVE" when
reading an all 1's response.
Signed-off-by: default avatarBenjamin Herrenschmidt <benh@kernel.crashing.org>
Tested-by: default avatarJoel Stanley <joel@jms.id.au>
parent 4e56828a
...@@ -41,13 +41,6 @@ ...@@ -41,13 +41,6 @@
#define FSI_GPIO_RESP_BUSY 1 /* Slave busy */ #define FSI_GPIO_RESP_BUSY 1 /* Slave busy */
#define FSI_GPIO_RESP_ERRA 2 /* Any (misc) Error */ #define FSI_GPIO_RESP_ERRA 2 /* Any (misc) Error */
#define FSI_GPIO_RESP_ERRC 3 /* Slave reports master CRC error */ #define FSI_GPIO_RESP_ERRC 3 /* Slave reports master CRC error */
#define FSI_GPIO_MTOE 4 /* Master time out error */
#define FSI_GPIO_CRC_INVAL 5 /* Master reports slave CRC error */
/* Normal slave responses */
#define FSI_GPIO_RESP_BUSY 1
#define FSI_GPIO_RESP_ACK 0
#define FSI_GPIO_RESP_ACKD 4
#define FSI_GPIO_MAX_BUSY 200 #define FSI_GPIO_MAX_BUSY 200
#define FSI_GPIO_MTOE_COUNT 1000 #define FSI_GPIO_MTOE_COUNT 1000
...@@ -359,15 +352,6 @@ static void build_term_command(struct fsi_gpio_msg *cmd, uint8_t slave_id) ...@@ -359,15 +352,6 @@ static void build_term_command(struct fsi_gpio_msg *cmd, uint8_t slave_id)
msg_push_crc(cmd); msg_push_crc(cmd);
} }
/*
* Store information on master errors so handler can detect and clean
* up the bus
*/
static void fsi_master_gpio_error(struct fsi_master_gpio *master, int error)
{
}
/* /*
* Note: callers rely specifically on this returning -EAGAIN for * Note: callers rely specifically on this returning -EAGAIN for
* a CRC error detected in the response. Use other error code * a CRC error detected in the response. Use other error code
...@@ -396,7 +380,6 @@ static int read_one_response(struct fsi_master_gpio *master, ...@@ -396,7 +380,6 @@ static int read_one_response(struct fsi_master_gpio *master,
if (i == FSI_GPIO_MTOE_COUNT) { if (i == FSI_GPIO_MTOE_COUNT) {
dev_dbg(master->dev, dev_dbg(master->dev,
"Master time out waiting for response\n"); "Master time out waiting for response\n");
fsi_master_gpio_error(master, FSI_GPIO_MTOE);
spin_unlock_irqrestore(&master->bit_lock, flags); spin_unlock_irqrestore(&master->bit_lock, flags);
return -ETIMEDOUT; return -ETIMEDOUT;
} }
...@@ -422,8 +405,11 @@ static int read_one_response(struct fsi_master_gpio *master, ...@@ -422,8 +405,11 @@ static int read_one_response(struct fsi_master_gpio *master,
crc = crc4(0, 1, 1); crc = crc4(0, 1, 1);
crc = crc4(crc, msg.msg, msg.bits); crc = crc4(crc, msg.msg, msg.bits);
if (crc) { if (crc) {
dev_dbg(master->dev, "ERR response CRC\n"); /* Check if it's all 1's, that probably means the host is off */
fsi_master_gpio_error(master, FSI_GPIO_CRC_INVAL); if (((~msg.msg) & ((1ull << msg.bits) - 1)) == 0)
return -ENODEV;
dev_dbg(master->dev, "ERR response CRC msg: 0x%016llx (%d bits)\n",
msg.msg, msg.bits);
return -EAGAIN; return -EAGAIN;
} }
...@@ -538,12 +524,10 @@ static int poll_for_response(struct fsi_master_gpio *master, ...@@ -538,12 +524,10 @@ static int poll_for_response(struct fsi_master_gpio *master,
case FSI_GPIO_RESP_ERRA: case FSI_GPIO_RESP_ERRA:
dev_dbg(master->dev, "ERRA received: 0x%x\n", (int)response.msg); dev_dbg(master->dev, "ERRA received: 0x%x\n", (int)response.msg);
fsi_master_gpio_error(master, response.msg);
rc = -EIO; rc = -EIO;
break; break;
case FSI_GPIO_RESP_ERRC: case FSI_GPIO_RESP_ERRC:
dev_dbg(master->dev, "ERRC received: 0x%x\n", (int)response.msg); dev_dbg(master->dev, "ERRC received: 0x%x\n", (int)response.msg);
fsi_master_gpio_error(master, response.msg);
trace_fsi_master_gpio_crc_cmd_error(master); trace_fsi_master_gpio_crc_cmd_error(master);
rc = -EAGAIN; rc = -EAGAIN;
break; break;
......
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