* [PATCH 0/2]
@ 2025-06-27 2:50 Rex Chen
2025-06-27 2:50 ` [PATCH 1/2] mmc: core: SPI mode remove cmd7 Rex Chen
2025-06-27 2:50 ` [PATCH 2/2] mmc: mmc_spi: multiple block read remove read crc ack Rex Chen
0 siblings, 2 replies; 7+ messages in thread
From: Rex Chen @ 2025-06-27 2:50 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]
Function mmc_sdio_alive() check if sd device alive by cmd7, but SPI mode
cmd7 unavailable, so replaced by check if can read CCCR register success.
[PATCH 2/2]
SPI multiple read operation doesn't need to read crc ack, so remove it.
Rex Chen (2):
mmc: core: SPI mode remove cmd7
mmc: mmc_spi: multiple block read remove read crc ack
drivers/mmc/core/sdio.c | 8 +++++++-
drivers/mmc/host/mmc_spi.c | 2 +-
2 files changed, 8 insertions(+), 2 deletions(-)
--
2.25.1
^ permalink raw reply [flat|nested] 7+ messages in thread
* [PATCH 1/2] mmc: core: SPI mode remove cmd7
2025-06-27 2:50 [PATCH 0/2] Rex Chen
@ 2025-06-27 2:50 ` Rex Chen
2025-07-03 11:44 ` Ulf Hansson
2025-06-27 2:50 ` [PATCH 2/2] mmc: mmc_spi: multiple block read remove read crc ack Rex Chen
1 sibling, 1 reply; 7+ messages in thread
From: Rex Chen @ 2025-06-27 2:50 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 | 8 +++++++-
1 file changed, 7 insertions(+), 1 deletion(-)
diff --git a/drivers/mmc/core/sdio.c b/drivers/mmc/core/sdio.c
index 0f753367aec1..a5679a0add16 100644
--- a/drivers/mmc/core/sdio.c
+++ b/drivers/mmc/core/sdio.c
@@ -945,7 +945,13 @@ static void mmc_sdio_remove(struct mmc_host *host)
*/
static int mmc_sdio_alive(struct mmc_host *host)
{
- return mmc_select_card(host->card);
+ u8 data;
+
+ 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,
+ &data);
}
/*
--
2.25.1
^ permalink raw reply related [flat|nested] 7+ messages in thread
* [PATCH 2/2] mmc: mmc_spi: multiple block read remove read crc ack
2025-06-27 2:50 [PATCH 0/2] Rex Chen
2025-06-27 2:50 ` [PATCH 1/2] mmc: core: SPI mode remove cmd7 Rex Chen
@ 2025-06-27 2:50 ` Rex Chen
2025-07-03 11:46 ` Ulf Hansson
1 sibling, 1 reply; 7+ messages in thread
From: Rex Chen @ 2025-06-27 2:50 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
Multiple block read doesn't need to read crc ack, so remove it.
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] 7+ messages in thread
* Re: [PATCH 1/2] mmc: core: SPI mode remove cmd7
2025-06-27 2:50 ` [PATCH 1/2] mmc: core: SPI mode remove cmd7 Rex Chen
@ 2025-07-03 11:44 ` Ulf Hansson
0 siblings, 0 replies; 7+ messages in thread
From: Ulf Hansson @ 2025-07-03 11:44 UTC (permalink / raw)
To: Rex Chen
Cc: conor.dooley, bartosz.golaszewski, viro, linux-mmc, avri.altman,
shawn.lin, adrian.hunter, wsa+renesas
On Fri, 27 Jun 2025 at 04:50, Rex Chen <rex.chen_1@nxp.com> wrote:
>
> 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 | 8 +++++++-
> 1 file changed, 7 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/mmc/core/sdio.c b/drivers/mmc/core/sdio.c
> index 0f753367aec1..a5679a0add16 100644
> --- a/drivers/mmc/core/sdio.c
> +++ b/drivers/mmc/core/sdio.c
> @@ -945,7 +945,13 @@ static void mmc_sdio_remove(struct mmc_host *host)
> */
> static int mmc_sdio_alive(struct mmc_host *host)
> {
> - return mmc_select_card(host->card);
> + u8 data;
> +
> + 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,
> + &data);
There is no reason to provide &data as the out-parameter unless we are
going to use it. Just provide NULL instead.
> }
>
> /*
> --
> 2.25.1
>
Kind regards
Uffe
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH 2/2] mmc: mmc_spi: multiple block read remove read crc ack
2025-06-27 2:50 ` [PATCH 2/2] mmc: mmc_spi: multiple block read remove read crc ack Rex Chen
@ 2025-07-03 11:46 ` Ulf Hansson
2025-07-04 10:26 ` Rex Chen
0 siblings, 1 reply; 7+ messages in thread
From: Ulf Hansson @ 2025-07-03 11:46 UTC (permalink / raw)
To: Rex Chen
Cc: conor.dooley, bartosz.golaszewski, viro, linux-mmc, avri.altman,
shawn.lin, adrian.hunter, wsa+renesas
On Fri, 27 Jun 2025 at 04:50, Rex Chen <rex.chen_1@nxp.com> wrote:
>
> Multiple block read doesn't need to read crc ack, so remove it.
Why? Please elaborate.
Kind regards
Uffe
>
> 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 [flat|nested] 7+ messages in thread
* Re: [PATCH 2/2] mmc: mmc_spi: multiple block read remove read crc ack
2025-07-03 11:46 ` Ulf Hansson
@ 2025-07-04 10:26 ` Rex Chen
2025-07-04 10:43 ` Ulf Hansson
0 siblings, 1 reply; 7+ messages in thread
From: Rex Chen @ 2025-07-04 10:26 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 Fri, 27 Jun 2025 at 04:50, Rex Chen <rex.chen_1@nxp.com> wrote:
>
> Multiple block read doesn't need to read crc ack, so remove it.
Why? Please elaborate.
-----From Rex Chen:
The origin implementation without my change, function mmc_spi_setup_data_message builds data transfer sequence, transfer one block data sequence contains token, payload, crc, and 29 bytes scratch->status to wait crc ack from sdio device side for block write, also 1 byte for block read, I don't know why need this 1 byte transfer, and block read transfer failed if I add this 1 byte sequence.
I didn't find related description in specification about this 1 byte transfer, maybe I miss it, if so, could you pls let me know the details?
Thanks.
Kind regards
Uffe
>
> 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 [flat|nested] 7+ messages in thread
* Re: [PATCH 2/2] mmc: mmc_spi: multiple block read remove read crc ack
2025-07-04 10:26 ` Rex Chen
@ 2025-07-04 10:43 ` Ulf Hansson
0 siblings, 0 replies; 7+ messages in thread
From: Ulf Hansson @ 2025-07-04 10:43 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 Fri, 4 Jul 2025 at 12:26, Rex Chen <rex.chen_1@nxp.com> wrote:
>
>
> On Fri, 27 Jun 2025 at 04:50, Rex Chen <rex.chen_1@nxp.com> wrote:
> >
> > Multiple block read doesn't need to read crc ack, so remove it.
>
> Why? Please elaborate.
> -----From Rex Chen:
> The origin implementation without my change, function mmc_spi_setup_data_message builds data transfer sequence, transfer one block data sequence contains token, payload, crc, and 29 bytes scratch->status to wait crc ack from sdio device side for block write, also 1 byte for block read, I don't know why need this 1 byte transfer, and block read transfer failed if I add this 1 byte sequence.
> I didn't find related description in specification about this 1 byte transfer, maybe I miss it, if so, could you pls let me know the details?
I don't know the details from the top of my head, sorry.
I would have to go and read the spec to find out, but I don't have the
time to do that currently. In other words, I will be relying on you
and others in the community to help out with this. So, please
re-submit your patches and include a proper commit message with the
information, then we can take it from there.
[...]
Kind regards
Uffe
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2025-07-04 10:44 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-06-27 2:50 [PATCH 0/2] Rex Chen
2025-06-27 2:50 ` [PATCH 1/2] mmc: core: SPI mode remove cmd7 Rex Chen
2025-07-03 11:44 ` Ulf Hansson
2025-06-27 2:50 ` [PATCH 2/2] mmc: mmc_spi: multiple block read remove read crc ack Rex Chen
2025-07-03 11:46 ` Ulf Hansson
2025-07-04 10:26 ` Rex Chen
2025-07-04 10:43 ` 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).