Skip to contentSkip to conversation

mmc: mmc_spi: parse speed mode options

PATCH In review Christian Löhle 3 participants 7 messages Mar 31, 2022 – Apr 6, 2022

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/2 mmc: mmc_spi: parse speed mode options

Since SD and MMC Highspeed modes are also valid for SPI let's parse them too.

---
 drivers/mmc/host/of_mmc_spi.c | 4 ++++
 1 file changed, 4 insertions(+)
drivers/mmc/host/of_mmc_spi.c +4 -0
index 3629550528b6..bf54776fb26c 100644
@@ -70,6 +70,10 @@ struct mmc_spi_platform_data *mmc_spi_get_pdata(struct spi_device *spi)
 	} else {
 		oms->pdata.caps |= MMC_CAP_NEEDS_POLL;
 	}
+	if (device_property_read_bool(dev, "cap-sd-highspeed"))
+		oms->pdata.caps |= MMC_CAP_SD_HIGHSPEED;
+	if (device_property_read_bool(dev, "cap-mmc-highspeed"))
+		oms->pdata.caps |= MMC_CAP_MMC_HIGHSPEED;
 
 	dev->platform_data = &oms->pdata;
 	return dev->platform_data;
Signature · 4 lines
2.34.1
Hyperstone GmbH | Reichenaustr. 39a  | 78467 Konstanz
Managing Director: Dr. Jan Peter Berns.
Commercial register of local courts: Freiburg HRB381782
#1 lore raw

PATCH 2/2 mmc: mmc_spi: enable Highspeed for above 25MHz

Any setup supporting more than 25MHz is able to utilize highspeed, so enable it even when not explicitly specified.

---
 drivers/mmc/host/mmc_spi.c | 3 +++
 1 file changed, 3 insertions(+)
drivers/mmc/host/mmc_spi.c +3 -0
index 106dd204b1a7..0a74c2f55542 100644
@@ -1378,6 +1378,9 @@ static int mmc_spi_probe(struct spi_device *spi)
 	mmc->f_min = 400000;
 	mmc->f_max = spi->max_speed_hz;
 
+	if (mmc->f_max > 25000000)
+		mmc->caps |= MMC_CAP_SD_HIGHSPEED | MMC_CAP_MMC_HIGHSPEED;
+
 	host = mmc_priv(mmc);
 	host->mmc = mmc;
 	host->spi = spi;
Signature · 4 lines
2.34.1
Hyperstone GmbH | Reichenaustr. 39a  | 78467 Konstanz
Managing Director: Dr. Jan Peter Berns.
Commercial register of local courts: Freiburg HRB381782
#2 lore raw

Re: [PATCH 2/2] mmc: mmc_spi: enable Highspeed for above 25MHz

Quoted 2 lines · Christian Löhle

Any setup supporting more than 25MHz is able to utilize highspeed, so enable it even when not explicitly specified.

I'm not sure about this. I prefer to be on the safer side, i.e. follow only what is supplied by firmware (ACPI / DT).

Signature · 2 lines
With Best Regards,
Andy Shevchenko
#3 lore raw

Re: [PATCH 2/2] mmc: mmc_spi: enable Highspeed for above 25MHz

Understood and sure, then I'll take 2/2 back.
@Ulf, would you like a v2 just containing 1/2 or is it fine like this?

From: [email protected] <[email protected]>
Sent: Thursday, March 31, 2022 4:07 PM
To: Christian Löhle
Cc: Ulf Hansson; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]
Subject: Re: [PATCH 2/2] mmc: mmc_spi: enable Highspeed for above 25MHz

Quoted 2 lines · Christian Löhle

Any setup supporting more than 25MHz is able to utilize highspeed, so enable it even when not explicitly specified.

I'm not sure about this. I prefer to be on the safer side, i.e. follow only what is supplied by firmware (ACPI / DT).

Signature · 8 lines
With Best Regards,
Andy Shevchenko


    =
Hyperstone GmbH | Reichenaustr. 39a  | 78467 Konstanz
Managing Director: Dr. Jan Peter Berns.
Commercial register of local courts: Freiburg HRB381782
#4 lore raw

Re: [PATCH 2/2] mmc: mmc_spi: enable Highspeed for above 25MHz

Quoted 3 lines · Christian Löhle

Understood and sure, then I'll take 2/2 back.
@Ulf, would you like a v2 just containing 1/2 or is it fine like this?

It's fine as is, I will pick up patch1 very soon.

Kind regards
Uffe

Quoted 27 lines

From: [email protected] <[email protected]>
Sent: Thursday, March 31, 2022 4:07 PM
To: Christian Löhle
Cc: Ulf Hansson; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]
Subject: Re: [PATCH 2/2] mmc: mmc_spi: enable Highspeed for above 25MHz

Quoted 2 lines · Christian Löhle

Any setup supporting more than 25MHz is able to utilize highspeed, so enable it even when not explicitly specified.

I'm not sure about this. I prefer to be on the safer side, i.e. follow only what is supplied by firmware (ACPI / DT).

--
With Best Regards,
Andy Shevchenko

    =

Hyperstone GmbH | Reichenaustr. 39a | 78467 Konstanz Managing Director: Dr. Jan Peter Berns. Commercial register of local courts: Freiburg HRB381782

Reviewed-by on v1 1/2
#5 lore raw
In reply to Christian Löhle
Quoted 2 lines · Christian Löhle

Since SD and MMC Highspeed modes are also valid for SPI let's parse them too.

Makes sense to me.

Quoted 26 lines
---
 drivers/mmc/host/of_mmc_spi.c | 4 ++++
 1 file changed, 4 insertions(+)
drivers/mmc/host/of_mmc_spi.c +4 -1
index 3629550528b6..bf54776fb26c 100644
@@ -70,6 +70,10 @@ struct mmc_spi_platform_data *mmc_spi_get_pdata(struct spi_device *spi)
 	} else {
 		oms->pdata.caps |= MMC_CAP_NEEDS_POLL;
 	}
+	if (device_property_read_bool(dev, "cap-sd-highspeed"))
+		oms->pdata.caps |= MMC_CAP_SD_HIGHSPEED;
+	if (device_property_read_bool(dev, "cap-mmc-highspeed"))
+		oms->pdata.caps |= MMC_CAP_MMC_HIGHSPEED;
 
 	dev->platform_data = &oms->pdata;
 	return dev->platform_data;
--

2.34.1
Hyperstone GmbH | Reichenaustr. 39a | 78467 Konstanz Managing Director: Dr. Jan Peter Berns. Commercial register of local courts: Freiburg HRB381782

Signature · 2 lines
With Best Regards,
Andy Shevchenko
#6 lore raw
In reply to Christian Löhle
Quoted 5 lines · Christian Löhle

Since SD and MMC Highspeed modes are also valid for SPI let's parse them too.

Applied for next, thanks!

Kind regards
Uffe

Quoted 25 lines
---
 drivers/mmc/host/of_mmc_spi.c | 4 ++++
 1 file changed, 4 insertions(+)
drivers/mmc/host/of_mmc_spi.c +4 -1
index 3629550528b6..bf54776fb26c 100644
@@ -70,6 +70,10 @@ struct mmc_spi_platform_data *mmc_spi_get_pdata(struct spi_device *spi)
        } else {
                oms->pdata.caps |= MMC_CAP_NEEDS_POLL;
        }
+       if (device_property_read_bool(dev, "cap-sd-highspeed"))
+               oms->pdata.caps |= MMC_CAP_SD_HIGHSPEED;
+       if (device_property_read_bool(dev, "cap-mmc-highspeed"))
+               oms->pdata.caps |= MMC_CAP_MMC_HIGHSPEED;
 
        dev->platform_data = &oms->pdata;
        return dev->platform_data;
--

2.34.1
Hyperstone GmbH | Reichenaustr. 39a | 78467 Konstanz Managing Director: Dr. Jan Peter Berns. Commercial register of local courts: Freiburg HRB381782