Re: [PATCHv4] mmc: block: Check for errors after write on SPI

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Thu, Mar 24, 2022 at 01:27:51PM +0000, Christian Löhle wrote:

...

> v4:
>   - Move block layer handling out of the spi-specific function

In this case some optimizations are possible. See below.

...

> +static int mmc_spi_err_check(struct mmc_card *card)
> +{
> +	u32 status = 0;
> +	int err;
> +
> +	/*
> +	 * SPI does not have a TRAN state we have to wait on, instead the
> +	 * card is ready again when it no longer holds the line LOW.
> +	 * We still have to ensure two things here before we know the write
> +	 * was successful:
> +	 * 1. The card has not disconnected during busy and we actually read our
> +	 * own pull-up, thinking it was still connected, so ensure it
> +	 * still responds.
> +	 * 2. Check for any error bits, in particular R1_SPI_IDLE to catch a
> +	 * just reconnected card after being disconnected during busy.
> +	 */
> +	err = __mmc_send_status(card, &status, 0);

> +	/* All R1 and R2 bits of SPI are errors in our case */
> +	if (err || status) {
> +		if (err)
> +			return err;
> +		return -EIO;
> +	}

	if (err)
		return err;

	/* All R1 and R2 bits of SPI are errors in our case */
	if (status)
		return -EIO;

> +	return 0;
> +}

-- 
With Best Regards,
Andy Shevchenko





[Index of Archives]     [Linux Memonry Technology]     [Linux USB Devel]     [Linux Media]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux