2016-10-12 18:41:10

by Zach Brown

[permalink] [raw]
Subject: [RFC v2 0/2] Add device tree property and driver behavior for supporting sdhci configurations with broken highspeed.

Some board configurations can not support sd highspeed mode due to the distance
between the card slot and the controller. The card and controller report that
they are capable of highspeed however, so we need a mechanism for specifying
that the setup is incapable of supporting highspeed mode.

The first patch adds documentation about a new devicetree property
sd-broken-highspeed.

The second patch keeps the sd controller and card from going into highspeed
mode when the property is set.

v2:
* changed sd-broken-highspeed to broken-highspeed
* Removed new quirk, instead read of property when would've checked quirk

Zach Brown (2):
sdhci: Add device tree property broken-highspeed
sdhci: Prevent SD from doing high-speed timing when broken-highspeed
property is set

Documentation/devicetree/bindings/mmc/mmc.txt | 2 ++
drivers/mmc/host/sdhci.c | 4 +++-
2 files changed, 5 insertions(+), 1 deletion(-)

--
2.7.4


2016-10-12 18:41:27

by Zach Brown

[permalink] [raw]
Subject: [RFC v2 1/2] sdhci: Add device tree property broken-highspeed

Certain board configurations can make highspeed malfuction due to timing
issues. In these cases a way is needed to force the controller and card
into standard speed even if they otherwise appear to be capable of
highspeed.

The broken-highspeed property will let the sdhci driver know that
highspeed will not work.

Signed-off-by: Zach Brown <[email protected]>
---
Documentation/devicetree/bindings/mmc/mmc.txt | 2 ++
1 file changed, 2 insertions(+)

diff --git a/Documentation/devicetree/bindings/mmc/mmc.txt b/Documentation/devicetree/bindings/mmc/mmc.txt
index 8a37782..a2b298c 100644
--- a/Documentation/devicetree/bindings/mmc/mmc.txt
+++ b/Documentation/devicetree/bindings/mmc/mmc.txt
@@ -52,6 +52,8 @@ Optional properties:
- no-sdio: controller is limited to send sdio cmd during initialization
- no-sd: controller is limited to send sd cmd during initialization
- no-mmc: controller is limited to send mmc cmd during initialization
+- broken-highspeed: Highspeed is broken, even if the controller and card
+ themselves claim they support highspeed.

*NOTE* on CD and WP polarity. To use common for all SD/MMC host controllers line
polarity properties, we have to fix the meaning of the "normal" and "inverted"
--
2.7.4

2016-10-12 18:41:19

by Zach Brown

[permalink] [raw]
Subject: [RFC v2 2/2] sdhci: Prevent SD from doing high-speed timing when broken-highspeed property is set

When the broken-highspeed property is set the sdhci driver will not
go into highspeed mode even if the controller and card appear to
otherwise support highspeed mode.

This is useful in cases where the controller and card support highspeed,
but the board configuration or some other issue make highspeed
impossible. For example, we send the SDIO lines through a fpga so we
need the data to change on the falling edge of the clock or there will
be issues with hold time.

Signed-off-by: Zach Brown <[email protected]>
---
drivers/mmc/host/sdhci.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/mmc/host/sdhci.c b/drivers/mmc/host/sdhci.c
index 4805566..17e6c50 100644
--- a/drivers/mmc/host/sdhci.c
+++ b/drivers/mmc/host/sdhci.c
@@ -22,6 +22,7 @@
#include <linux/scatterlist.h>
#include <linux/regulator/consumer.h>
#include <linux/pm_runtime.h>
+#include <linux/of.h>

#include <linux/leds.h>

@@ -3274,7 +3275,8 @@ int sdhci_setup_host(struct sdhci_host *host)
if (host->quirks2 & SDHCI_QUIRK2_HOST_NO_CMD23)
mmc->caps &= ~MMC_CAP_CMD23;

- if (host->caps & SDHCI_CAN_DO_HISPD)
+ if ((host->caps & SDHCI_CAN_DO_HISPD) &&
+ !(of_property_read_bool(mmc_dev(mmc)->of_node, "broken-highspeed")))
mmc->caps |= MMC_CAP_SD_HIGHSPEED | MMC_CAP_MMC_HIGHSPEED;

if ((host->quirks & SDHCI_QUIRK_BROKEN_CARD_DETECTION) &&
--
2.7.4

2016-10-13 02:27:52

by Jaehoon Chung

[permalink] [raw]
Subject: Re: [RFC v2 1/2] sdhci: Add device tree property broken-highspeed

On 10/13/2016 03:40 AM, Zach Brown wrote:
> Certain board configurations can make highspeed malfuction due to timing
> issues. In these cases a way is needed to force the controller and card
> into standard speed even if they otherwise appear to be capable of
> highspeed.

I'm not sure "broken-hishspeed" property is relevant to only sdhci driver? otherwise on card side..?
Subject looks like only sdhci driver..And your RFC patch should be supported only SDHCI driver.
But your [patch 1/2] can cause the confusing in future..because there are just comment as "controller".

Then developer who refer to mmc.txt will add the property "broken-highspeed".
I'm not sure what is correct way..but to prevent confusing..you mentioned only "sdhci" driver or supporting other controller.

Best Regards,
Jaehoon Chung

>
> The broken-highspeed property will let the sdhci driver know that
> highspeed will not work.
>
> Signed-off-by: Zach Brown <[email protected]>
> ---
> Documentation/devicetree/bindings/mmc/mmc.txt | 2 ++
> 1 file changed, 2 insertions(+)
>
> diff --git a/Documentation/devicetree/bindings/mmc/mmc.txt b/Documentation/devicetree/bindings/mmc/mmc.txt
> index 8a37782..a2b298c 100644
> --- a/Documentation/devicetree/bindings/mmc/mmc.txt
> +++ b/Documentation/devicetree/bindings/mmc/mmc.txt
> @@ -52,6 +52,8 @@ Optional properties:
> - no-sdio: controller is limited to send sdio cmd during initialization
> - no-sd: controller is limited to send sd cmd during initialization
> - no-mmc: controller is limited to send mmc cmd during initialization
> +- broken-highspeed: Highspeed is broken, even if the controller and card
> + themselves claim they support highspeed.
>
> *NOTE* on CD and WP polarity. To use common for all SD/MMC host controllers line
> polarity properties, we have to fix the meaning of the "normal" and "inverted"
>

2016-10-17 07:01:30

by Adrian Hunter

[permalink] [raw]
Subject: Re: [RFC v2 2/2] sdhci: Prevent SD from doing high-speed timing when broken-highspeed property is set

On 12/10/16 21:40, Zach Brown wrote:
> When the broken-highspeed property is set the sdhci driver will not
> go into highspeed mode even if the controller and card appear to
> otherwise support highspeed mode.
>
> This is useful in cases where the controller and card support highspeed,
> but the board configuration or some other issue make highspeed
> impossible. For example, we send the SDIO lines through a fpga so we
> need the data to change on the falling edge of the clock or there will
> be issues with hold time.
>
> Signed-off-by: Zach Brown <[email protected]>

Assuming the DT property is accepted:

Acked-by: Adrian Hunter <[email protected]>

> ---
> drivers/mmc/host/sdhci.c | 4 +++-
> 1 file changed, 3 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/mmc/host/sdhci.c b/drivers/mmc/host/sdhci.c
> index 4805566..17e6c50 100644
> --- a/drivers/mmc/host/sdhci.c
> +++ b/drivers/mmc/host/sdhci.c
> @@ -22,6 +22,7 @@
> #include <linux/scatterlist.h>
> #include <linux/regulator/consumer.h>
> #include <linux/pm_runtime.h>
> +#include <linux/of.h>
>
> #include <linux/leds.h>
>
> @@ -3274,7 +3275,8 @@ int sdhci_setup_host(struct sdhci_host *host)
> if (host->quirks2 & SDHCI_QUIRK2_HOST_NO_CMD23)
> mmc->caps &= ~MMC_CAP_CMD23;
>
> - if (host->caps & SDHCI_CAN_DO_HISPD)
> + if ((host->caps & SDHCI_CAN_DO_HISPD) &&
> + !(of_property_read_bool(mmc_dev(mmc)->of_node, "broken-highspeed")))
> mmc->caps |= MMC_CAP_SD_HIGHSPEED | MMC_CAP_MMC_HIGHSPEED;
>
> if ((host->quirks & SDHCI_QUIRK_BROKEN_CARD_DETECTION) &&
>

2016-10-18 13:18:06

by Rob Herring

[permalink] [raw]
Subject: Re: [RFC v2 1/2] sdhci: Add device tree property broken-highspeed

On Wed, Oct 12, 2016 at 01:40:55PM -0500, Zach Brown wrote:
> Certain board configurations can make highspeed malfuction due to timing
> issues. In these cases a way is needed to force the controller and card
> into standard speed even if they otherwise appear to be capable of
> highspeed.
>
> The broken-highspeed property will let the sdhci driver know that
> highspeed will not work.
>
> Signed-off-by: Zach Brown <[email protected]>
> ---
> Documentation/devicetree/bindings/mmc/mmc.txt | 2 ++
> 1 file changed, 2 insertions(+)

Acked-by: Rob Herring <[email protected]>