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

Jeremy Kerr jk at ozlabs.org
Wed Feb 22 12:13:59 AEDT 2017


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]

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

Cheers,


Jeremy


More information about the openbmc mailing list