linux-mmc.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v3 0/2]
@ 2025-07-28  8:22 Rex Chen
  2025-07-28  8:22 ` [PATCH v3 1/2] mmc: core: SPI mode remove cmd7 Rex Chen
                   ` (2 more replies)
  0 siblings, 3 replies; 6+ messages in thread
From: Rex Chen @ 2025-07-28  8:22 UTC (permalink / raw)
  To: ulf.hansson
  Cc: conor.dooley, bartosz.golaszewski, viro, linux-mmc, avri.altman,
	shawn.lin, adrian.hunter, wsa+renesas, rex.chen_1

[patch 1/2]
No change for patch 1
[patch 2/2]
Add more details in commit message

Rex Chen (2):
  mmc: core: SPI mode remove cmd7
  mmc: mmc_spi: multiple block read remove read crc ack

 drivers/mmc/core/sdio.c    | 6 +++++-
 drivers/mmc/host/mmc_spi.c | 2 +-
 2 files changed, 6 insertions(+), 2 deletions(-)

-- 
2.25.1


^ permalink raw reply	[flat|nested] 6+ messages in thread

* [PATCH v3 1/2] mmc: core: SPI mode remove cmd7
  2025-07-28  8:22 [PATCH v3 0/2] Rex Chen
@ 2025-07-28  8:22 ` Rex Chen
  2025-07-28  8:22 ` [PATCH v3 2/2] mmc: mmc_spi: multiple block read remove read crc ack Rex Chen
  2025-08-18 10:54 ` [PATCH v3 0/2] Ulf Hansson
  2 siblings, 0 replies; 6+ messages in thread
From: Rex Chen @ 2025-07-28  8:22 UTC (permalink / raw)
  To: ulf.hansson
  Cc: conor.dooley, bartosz.golaszewski, viro, linux-mmc, avri.altman,
	shawn.lin, adrian.hunter, wsa+renesas, rex.chen_1

SPI mode doesn't support cmd7, so remove it in mmc_sdio_alive() and
confirm if sdio is active by checking CCCR register value is available
or not.

Signed-off-by: Rex Chen <rex.chen_1@nxp.com>
---
 drivers/mmc/core/sdio.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/drivers/mmc/core/sdio.c b/drivers/mmc/core/sdio.c
index 0f753367aec1..83085e76486a 100644
--- a/drivers/mmc/core/sdio.c
+++ b/drivers/mmc/core/sdio.c
@@ -945,7 +945,11 @@ static void mmc_sdio_remove(struct mmc_host *host)
  */
 static int mmc_sdio_alive(struct mmc_host *host)
 {
-	return mmc_select_card(host->card);
+	if (!mmc_host_is_spi(host))
+		return mmc_select_card(host->card);
+	else
+		return mmc_io_rw_direct(host->card, 0, 0, SDIO_CCCR_CCCR, 0,
+					NULL);
 }
 
 /*
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [PATCH v3 2/2] mmc: mmc_spi: multiple block read remove read crc ack
  2025-07-28  8:22 [PATCH v3 0/2] Rex Chen
  2025-07-28  8:22 ` [PATCH v3 1/2] mmc: core: SPI mode remove cmd7 Rex Chen
@ 2025-07-28  8:22 ` Rex Chen
  2025-08-18 10:54 ` [PATCH v3 0/2] Ulf Hansson
  2 siblings, 0 replies; 6+ messages in thread
From: Rex Chen @ 2025-07-28  8:22 UTC (permalink / raw)
  To: ulf.hansson
  Cc: conor.dooley, bartosz.golaszewski, viro, linux-mmc, avri.altman,
	shawn.lin, adrian.hunter, wsa+renesas, rex.chen_1

For multiple block read, the current implementation, transfer packet
includes cmd53 + cmd53 response + block nums*(1byte token +
block length bytes payload + 2bytes CRC + 1byte transfer), the last
1byte transfer of every block is not needed, so remove it.

Why doesn't multiple block read need CRC ack?
For read operation, host side get the payload and CRC value, then
will only check the CRC value to confirm if the data is correct or
not, but not send CRC ack to card. If the data is correct, save it,
or discard it and retransmit if data is error, so the last 1byte
transfer of every block make no sense.

What's the side effect of this 1byte transfer?
As the SPI is full duplex, if add this redundant 1byte transfer, SDIO
card side take it as the token of next block, then all the next sub
blocks sequence distort.

Signed-off-by: Rex Chen <rex.chen_1@nxp.com>
---
 drivers/mmc/host/mmc_spi.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/mmc/host/mmc_spi.c b/drivers/mmc/host/mmc_spi.c
index 47443fb5eb33..f42d5f9c48c1 100644
--- a/drivers/mmc/host/mmc_spi.c
+++ b/drivers/mmc/host/mmc_spi.c
@@ -563,7 +563,7 @@ mmc_spi_setup_data_message(struct mmc_spi_host *host, bool multiple, bool write)
 	 * the next token (next data block, or STOP_TRAN).  We can try to
 	 * minimize I/O ops by using a single read to collect end-of-busy.
 	 */
-	if (multiple || write) {
+	if (write) {
 		t = &host->early_status;
 		memset(t, 0, sizeof(*t));
 		t->len = write ? sizeof(scratch->status) : 1;
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: [PATCH v3 0/2]
  2025-07-28  8:22 [PATCH v3 0/2] Rex Chen
  2025-07-28  8:22 ` [PATCH v3 1/2] mmc: core: SPI mode remove cmd7 Rex Chen
  2025-07-28  8:22 ` [PATCH v3 2/2] mmc: mmc_spi: multiple block read remove read crc ack Rex Chen
@ 2025-08-18 10:54 ` Ulf Hansson
  2025-08-19  6:04   ` [EXT] " Rex Chen
  2 siblings, 1 reply; 6+ messages in thread
From: Ulf Hansson @ 2025-08-18 10:54 UTC (permalink / raw)
  To: Rex Chen
  Cc: conor.dooley, bartosz.golaszewski, viro, linux-mmc, avri.altman,
	shawn.lin, adrian.hunter, wsa+renesas

On Mon, 28 Jul 2025 at 10:22, Rex Chen <rex.chen_1@nxp.com> wrote:
>
> [patch 1/2]
> No change for patch 1
> [patch 2/2]
> Add more details in commit message
>
> Rex Chen (2):
>   mmc: core: SPI mode remove cmd7
>   mmc: mmc_spi: multiple block read remove read crc ack
>
>  drivers/mmc/core/sdio.c    | 6 +++++-
>  drivers/mmc/host/mmc_spi.c | 2 +-
>  2 files changed, 6 insertions(+), 2 deletions(-)
>
> --
> 2.25.1
>

The series applied for next, thanks!

Do you think we should tag these for stable kernels too?

Kind regards
Uffe

^ permalink raw reply	[flat|nested] 6+ messages in thread

* RE: [EXT] Re: [PATCH v3 0/2]
  2025-08-18 10:54 ` [PATCH v3 0/2] Ulf Hansson
@ 2025-08-19  6:04   ` Rex Chen
  2025-08-19 12:35     ` Ulf Hansson
  0 siblings, 1 reply; 6+ messages in thread
From: Rex Chen @ 2025-08-19  6:04 UTC (permalink / raw)
  To: Ulf Hansson
  Cc: conor.dooley@microchip.com, bartosz.golaszewski@linaro.org,
	viro@zeniv.linux.org.uk, linux-mmc@vger.kernel.org,
	avri.altman@wdc.com, shawn.lin@rock-chips.com,
	adrian.hunter@intel.com, wsa+renesas@sang-engineering.com

On Mon, 28 Jul 2025 at 10:22, Rex Chen <rex.chen_1@nxp.com> wrote:
>
> [patch 1/2]
> No change for patch 1
> [patch 2/2]
> Add more details in commit message
>
> Rex Chen (2):
>   mmc: core: SPI mode remove cmd7
>   mmc: mmc_spi: multiple block read remove read crc ack
>
>  drivers/mmc/core/sdio.c    | 6 +++++-
>  drivers/mmc/host/mmc_spi.c | 2 +-
>  2 files changed, 6 insertions(+), 2 deletions(-)
>
> --
> 2.25.1
>

The series applied for next, thanks!

Do you think we should tag these for stable kernels too?
------------------------
RE from Rex:
Thanks, Pls apply the patch to stable kernels.
------------------------

Kind regards
Uffe

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [EXT] Re: [PATCH v3 0/2]
  2025-08-19  6:04   ` [EXT] " Rex Chen
@ 2025-08-19 12:35     ` Ulf Hansson
  0 siblings, 0 replies; 6+ messages in thread
From: Ulf Hansson @ 2025-08-19 12:35 UTC (permalink / raw)
  To: Rex Chen
  Cc: conor.dooley@microchip.com, bartosz.golaszewski@linaro.org,
	viro@zeniv.linux.org.uk, linux-mmc@vger.kernel.org,
	avri.altman@wdc.com, shawn.lin@rock-chips.com,
	adrian.hunter@intel.com, wsa+renesas@sang-engineering.com

On Tue, 19 Aug 2025 at 08:04, Rex Chen <rex.chen_1@nxp.com> wrote:
>
> On Mon, 28 Jul 2025 at 10:22, Rex Chen <rex.chen_1@nxp.com> wrote:
> >
> > [patch 1/2]
> > No change for patch 1
> > [patch 2/2]
> > Add more details in commit message
> >
> > Rex Chen (2):
> >   mmc: core: SPI mode remove cmd7
> >   mmc: mmc_spi: multiple block read remove read crc ack
> >
> >  drivers/mmc/core/sdio.c    | 6 +++++-
> >  drivers/mmc/host/mmc_spi.c | 2 +-
> >  2 files changed, 6 insertions(+), 2 deletions(-)
> >
> > --
> > 2.25.1
> >
>
> The series applied for next, thanks!
>
> Do you think we should tag these for stable kernels too?
> ------------------------
> RE from Rex:
> Thanks, Pls apply the patch to stable kernels.
> ------------------------
>

Okay, I have tagged the patches for stable too.

Kind regards
Uffe

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2025-08-19 12:36 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-07-28  8:22 [PATCH v3 0/2] Rex Chen
2025-07-28  8:22 ` [PATCH v3 1/2] mmc: core: SPI mode remove cmd7 Rex Chen
2025-07-28  8:22 ` [PATCH v3 2/2] mmc: mmc_spi: multiple block read remove read crc ack Rex Chen
2025-08-18 10:54 ` [PATCH v3 0/2] Ulf Hansson
2025-08-19  6:04   ` [EXT] " Rex Chen
2025-08-19 12:35     ` Ulf Hansson

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).