[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <Yjx34sDWl4bMSCg3@smile.fi.intel.com>
Date: Thu, 24 Mar 2022 15:53:38 +0200
From: "andriy.shevchenko@...ux.intel.com"
<andriy.shevchenko@...ux.intel.com>
To: Christian Löhle <CLoehle@...erstone.com>
Cc: Ulf Hansson <ulf.hansson@...aro.org>,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
"linux-mmc@...r.kernel.org" <linux-mmc@...r.kernel.org>,
Adrian Hunter <adrian.hunter@...el.com>
Subject: Re: [PATCHv4] mmc: block: Check for errors after write on SPI
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
Powered by blists - more mailing lists