[PATCH linux dev-4.7 v2 5/7] drivers/fsi: Add retry on bus error detect

Christopher Bostic cbostic at linux.vnet.ibm.com
Thu Feb 23 03:37:17 AEDT 2017



On 2/21/17 7:13 PM, Jeremy Kerr wrote:
> Hi Chris,
>
>> --- a/drivers/fsi/fsi-master-gpio.c
>> +++ b/drivers/fsi/fsi-master-gpio.c
>> @@ -381,7 +381,17 @@ static int fsi_master_gpio_read(struct fsi_master *_master, int link,
>>   		return -ENODEV;
>>   
>>   	build_abs_ar_command(&cmd, FSI_GPIO_CMD_READ, slave, addr, size, NULL);
>> -	return send_command(master, &cmd, FSI_GPIO_RESP_ACKD, size, val);
>> +	rc = send_command(master, &cmd, FSI_GPIO_RESP_ACKD, size, val);
>> +	if (rc) {
>> +		fsi_master_handle_error(&master->master, addr);
>> +
>> +		/* Try again */
>> +		rc = send_command(master, &cmd, FSI_GPIO_RESP_ACKD, size, val);
>> +		if (rc)
>> +			fsi_master_handle_error(&master->master, addr);
>> +	}
>> +
>> +	return rc;
> Lets avoid the repeated code:
>
> 	const static int master_retries = 2;
>
> 	[...]
>
> 	for (retries = 0; retries < master_retries; retries++) {
> 		rc = send_command(master, &cmd, FSI_GPIO_RESP_ACKD, size, val);
> 		if (!rc)
> 			break;
> 		fsi_master_handle_error(&master->master, addr);
> 	}
>
> 	return rc;
>
> [or even better, we may want to put this in a helper, for use by both
> call sites]
Hi Jeremy,

Will change to a loop.


> Also, is there any condition where fsi_master_handle_error() knows that
> the FSI bus is totally hosed, and there's no point retrying?

There's not anything defined to flag a bad bus -will look into it.

Thanks,
Chris

> Cheers,
>
>
> Jeremy
>



More information about the openbmc mailing list