* [PATCH 1/2] dt-bindings: sdhci-of-at91: add the microchip, sdcal-inverted property
@ 2019-10-08 12:34 Nicolas Ferre
2019-10-08 12:34 ` [PATCH 2/2] mmc: sdhci-of-at91: add DT property to enable calibration on full reset Nicolas Ferre
` (2 more replies)
0 siblings, 3 replies; 6+ messages in thread
From: Nicolas Ferre @ 2019-10-08 12:34 UTC (permalink / raw)
To: Ludovic Desroches, linux-arm-kernel, linux-mmc, devicetree, robh+dt
Cc: Alexandre Belloni, linux-kernel, ulf.hansson, adrian.hunter
Add the specific microchip,sdcal-inverted property to at91 sdhci
device binding.
This optional property describes how the SoC SDCAL pin is connected.
It could be handled at SiP, SoM or board level.
This property read by at91 sdhci driver will allow to put in place a
software workaround that would reduce power consumption.
Signed-off-by: Nicolas Ferre <nicolas.ferre@microchip.com>
---
Documentation/devicetree/bindings/mmc/sdhci-atmel.txt | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/Documentation/devicetree/bindings/mmc/sdhci-atmel.txt b/Documentation/devicetree/bindings/mmc/sdhci-atmel.txt
index 1b662d7171a0..503c6dbac1b2 100644
--- a/Documentation/devicetree/bindings/mmc/sdhci-atmel.txt
+++ b/Documentation/devicetree/bindings/mmc/sdhci-atmel.txt
@@ -9,6 +9,11 @@ Required properties:
- clocks: Phandlers to the clocks.
- clock-names: Must be "hclock", "multclk", "baseclk";
+Optional properties:
+- microchip,sdcal-inverted: when present, polarity on the SDCAL SoC pin is
+ inverted. The default polarity for this signal is described in the datasheet.
+ For instance on SAMA5D2, the pin is usually tied to the GND with a resistor
+ and a capacitor (see "SDMMC I/O Calibration" chapter).
Example:
--
2.17.1
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [PATCH 2/2] mmc: sdhci-of-at91: add DT property to enable calibration on full reset
2019-10-08 12:34 [PATCH 1/2] dt-bindings: sdhci-of-at91: add the microchip, sdcal-inverted property Nicolas Ferre
@ 2019-10-08 12:34 ` Nicolas Ferre
2019-10-11 12:41 ` Ludovic Desroches
2019-10-18 10:58 ` Ulf Hansson
2019-10-15 22:25 ` [PATCH 1/2] dt-bindings: sdhci-of-at91: add the microchip,sdcal-inverted property Rob Herring
2019-10-18 10:58 ` Ulf Hansson
2 siblings, 2 replies; 6+ messages in thread
From: Nicolas Ferre @ 2019-10-08 12:34 UTC (permalink / raw)
To: Ludovic Desroches, linux-arm-kernel, linux-mmc, devicetree, robh+dt
Cc: Alexandre Belloni, linux-kernel, ulf.hansson, adrian.hunter
Add a property to keep the analog calibration cell powered.
This feature is specific to the Microchip SDHCI IP and outside
of the standard SDHCI register map.
By always keeping it on, after a full reset sequence, we make sure
that this feature is activated and not disabled.
We expose a hardware property to the DT as this feature can be used
to adapt SDHCI behavior vs. how the SDCAL SoC pin is connected
on the board.
Note that managing properly this property would reduce
power consumption on some SAMA5D2 SiP revisions.
Signed-off-by: Nicolas Ferre <nicolas.ferre@microchip.com>
---
drivers/mmc/host/sdhci-of-at91.c | 19 +++++++++++++++++++
1 file changed, 19 insertions(+)
diff --git a/drivers/mmc/host/sdhci-of-at91.c b/drivers/mmc/host/sdhci-of-at91.c
index e7d1920729fb..9571c4a882a9 100644
--- a/drivers/mmc/host/sdhci-of-at91.c
+++ b/drivers/mmc/host/sdhci-of-at91.c
@@ -27,6 +27,9 @@
#define SDMMC_CACR 0x230
#define SDMMC_CACR_CAPWREN BIT(0)
#define SDMMC_CACR_KEY (0x46 << 8)
+#define SDMMC_CALCR 0x240
+#define SDMMC_CALCR_EN BIT(0)
+#define SDMMC_CALCR_ALWYSON BIT(4)
#define SDHCI_AT91_PRESET_COMMON_CONF 0x400 /* drv type B, programmable clock mode */
@@ -35,6 +38,7 @@ struct sdhci_at91_priv {
struct clk *gck;
struct clk *mainck;
bool restore_needed;
+ bool cal_always_on;
};
static void sdhci_at91_set_force_card_detect(struct sdhci_host *host)
@@ -116,10 +120,17 @@ static void sdhci_at91_set_uhs_signaling(struct sdhci_host *host,
static void sdhci_at91_reset(struct sdhci_host *host, u8 mask)
{
+ struct sdhci_pltfm_host *pltfm_host = sdhci_priv(host);
+ struct sdhci_at91_priv *priv = sdhci_pltfm_priv(pltfm_host);
+
sdhci_reset(host, mask);
if (host->mmc->caps & MMC_CAP_NONREMOVABLE)
sdhci_at91_set_force_card_detect(host);
+
+ if (priv->cal_always_on && (mask & SDHCI_RESET_ALL))
+ sdhci_writel(host, SDMMC_CALCR_ALWYSON | SDMMC_CALCR_EN,
+ SDMMC_CALCR);
}
static const struct sdhci_ops sdhci_at91_sama5d2_ops = {
@@ -345,6 +356,14 @@ static int sdhci_at91_probe(struct platform_device *pdev)
priv->restore_needed = false;
+ /*
+ * if SDCAL pin is wrongly connected, we must enable
+ * the analog calibration cell permanently.
+ */
+ priv->cal_always_on =
+ device_property_read_bool(&pdev->dev,
+ "microchip,sdcal-inverted");
+
ret = mmc_of_parse(host->mmc);
if (ret)
goto clocks_disable_unprepare;
--
2.17.1
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [PATCH 2/2] mmc: sdhci-of-at91: add DT property to enable calibration on full reset
2019-10-08 12:34 ` [PATCH 2/2] mmc: sdhci-of-at91: add DT property to enable calibration on full reset Nicolas Ferre
@ 2019-10-11 12:41 ` Ludovic Desroches
2019-10-18 10:58 ` Ulf Hansson
1 sibling, 0 replies; 6+ messages in thread
From: Ludovic Desroches @ 2019-10-11 12:41 UTC (permalink / raw)
To: Nicolas Ferre
Cc: devicetree, Alexandre Belloni, linux-mmc, linux-kernel,
adrian.hunter, robh+dt, ulf.hansson, linux-arm-kernel
On Tue, Oct 08, 2019 at 02:34:32PM +0200, Nicolas Ferre wrote:
> Add a property to keep the analog calibration cell powered.
> This feature is specific to the Microchip SDHCI IP and outside
> of the standard SDHCI register map.
>
> By always keeping it on, after a full reset sequence, we make sure
> that this feature is activated and not disabled.
>
> We expose a hardware property to the DT as this feature can be used
> to adapt SDHCI behavior vs. how the SDCAL SoC pin is connected
> on the board.
>
> Note that managing properly this property would reduce
> power consumption on some SAMA5D2 SiP revisions.
>
> Signed-off-by: Nicolas Ferre <nicolas.ferre@microchip.com>
Acked-by: Ludovic Desroches <ludovic.desroches@microchip.com>
Thanks
Ludovic
> ---
> drivers/mmc/host/sdhci-of-at91.c | 19 +++++++++++++++++++
> 1 file changed, 19 insertions(+)
>
> diff --git a/drivers/mmc/host/sdhci-of-at91.c b/drivers/mmc/host/sdhci-of-at91.c
> index e7d1920729fb..9571c4a882a9 100644
> --- a/drivers/mmc/host/sdhci-of-at91.c
> +++ b/drivers/mmc/host/sdhci-of-at91.c
> @@ -27,6 +27,9 @@
> #define SDMMC_CACR 0x230
> #define SDMMC_CACR_CAPWREN BIT(0)
> #define SDMMC_CACR_KEY (0x46 << 8)
> +#define SDMMC_CALCR 0x240
> +#define SDMMC_CALCR_EN BIT(0)
> +#define SDMMC_CALCR_ALWYSON BIT(4)
>
> #define SDHCI_AT91_PRESET_COMMON_CONF 0x400 /* drv type B, programmable clock mode */
>
> @@ -35,6 +38,7 @@ struct sdhci_at91_priv {
> struct clk *gck;
> struct clk *mainck;
> bool restore_needed;
> + bool cal_always_on;
> };
>
> static void sdhci_at91_set_force_card_detect(struct sdhci_host *host)
> @@ -116,10 +120,17 @@ static void sdhci_at91_set_uhs_signaling(struct sdhci_host *host,
>
> static void sdhci_at91_reset(struct sdhci_host *host, u8 mask)
> {
> + struct sdhci_pltfm_host *pltfm_host = sdhci_priv(host);
> + struct sdhci_at91_priv *priv = sdhci_pltfm_priv(pltfm_host);
> +
> sdhci_reset(host, mask);
>
> if (host->mmc->caps & MMC_CAP_NONREMOVABLE)
> sdhci_at91_set_force_card_detect(host);
> +
> + if (priv->cal_always_on && (mask & SDHCI_RESET_ALL))
> + sdhci_writel(host, SDMMC_CALCR_ALWYSON | SDMMC_CALCR_EN,
> + SDMMC_CALCR);
> }
>
> static const struct sdhci_ops sdhci_at91_sama5d2_ops = {
> @@ -345,6 +356,14 @@ static int sdhci_at91_probe(struct platform_device *pdev)
>
> priv->restore_needed = false;
>
> + /*
> + * if SDCAL pin is wrongly connected, we must enable
> + * the analog calibration cell permanently.
> + */
> + priv->cal_always_on =
> + device_property_read_bool(&pdev->dev,
> + "microchip,sdcal-inverted");
> +
> ret = mmc_of_parse(host->mmc);
> if (ret)
> goto clocks_disable_unprepare;
> --
> 2.17.1
>
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH 1/2] dt-bindings: sdhci-of-at91: add the microchip,sdcal-inverted property
2019-10-08 12:34 [PATCH 1/2] dt-bindings: sdhci-of-at91: add the microchip, sdcal-inverted property Nicolas Ferre
2019-10-08 12:34 ` [PATCH 2/2] mmc: sdhci-of-at91: add DT property to enable calibration on full reset Nicolas Ferre
@ 2019-10-15 22:25 ` Rob Herring
2019-10-18 10:58 ` Ulf Hansson
2 siblings, 0 replies; 6+ messages in thread
From: Rob Herring @ 2019-10-15 22:25 UTC (permalink / raw)
To: Nicolas Ferre
Cc: devicetree, Alexandre Belloni, linux-mmc, linux-kernel,
adrian.hunter, Ludovic Desroches, robh+dt, ulf.hansson,
linux-arm-kernel
On Tue, 8 Oct 2019 14:34:31 +0200, Nicolas Ferre wrote:
> Add the specific microchip,sdcal-inverted property to at91 sdhci
> device binding.
> This optional property describes how the SoC SDCAL pin is connected.
> It could be handled at SiP, SoM or board level.
>
> This property read by at91 sdhci driver will allow to put in place a
> software workaround that would reduce power consumption.
>
> Signed-off-by: Nicolas Ferre <nicolas.ferre@microchip.com>
> ---
> Documentation/devicetree/bindings/mmc/sdhci-atmel.txt | 5 +++++
> 1 file changed, 5 insertions(+)
>
Reviewed-by: Rob Herring <robh@kernel.org>
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH 1/2] dt-bindings: sdhci-of-at91: add the microchip,sdcal-inverted property
2019-10-08 12:34 [PATCH 1/2] dt-bindings: sdhci-of-at91: add the microchip, sdcal-inverted property Nicolas Ferre
2019-10-08 12:34 ` [PATCH 2/2] mmc: sdhci-of-at91: add DT property to enable calibration on full reset Nicolas Ferre
2019-10-15 22:25 ` [PATCH 1/2] dt-bindings: sdhci-of-at91: add the microchip,sdcal-inverted property Rob Herring
@ 2019-10-18 10:58 ` Ulf Hansson
2 siblings, 0 replies; 6+ messages in thread
From: Ulf Hansson @ 2019-10-18 10:58 UTC (permalink / raw)
To: Nicolas Ferre
Cc: DTML, Alexandre Belloni, linux-mmc, Linux Kernel Mailing List,
Adrian Hunter, Ludovic Desroches, Rob Herring, Linux ARM
On Tue, 8 Oct 2019 at 14:34, Nicolas Ferre <nicolas.ferre@microchip.com> wrote:
>
> Add the specific microchip,sdcal-inverted property to at91 sdhci
> device binding.
> This optional property describes how the SoC SDCAL pin is connected.
> It could be handled at SiP, SoM or board level.
>
> This property read by at91 sdhci driver will allow to put in place a
> software workaround that would reduce power consumption.
>
> Signed-off-by: Nicolas Ferre <nicolas.ferre@microchip.com>
Applied for next, thanks!
Kind regards
Uffe
> ---
> Documentation/devicetree/bindings/mmc/sdhci-atmel.txt | 5 +++++
> 1 file changed, 5 insertions(+)
>
> diff --git a/Documentation/devicetree/bindings/mmc/sdhci-atmel.txt b/Documentation/devicetree/bindings/mmc/sdhci-atmel.txt
> index 1b662d7171a0..503c6dbac1b2 100644
> --- a/Documentation/devicetree/bindings/mmc/sdhci-atmel.txt
> +++ b/Documentation/devicetree/bindings/mmc/sdhci-atmel.txt
> @@ -9,6 +9,11 @@ Required properties:
> - clocks: Phandlers to the clocks.
> - clock-names: Must be "hclock", "multclk", "baseclk";
>
> +Optional properties:
> +- microchip,sdcal-inverted: when present, polarity on the SDCAL SoC pin is
> + inverted. The default polarity for this signal is described in the datasheet.
> + For instance on SAMA5D2, the pin is usually tied to the GND with a resistor
> + and a capacitor (see "SDMMC I/O Calibration" chapter).
>
> Example:
>
> --
> 2.17.1
>
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH 2/2] mmc: sdhci-of-at91: add DT property to enable calibration on full reset
2019-10-08 12:34 ` [PATCH 2/2] mmc: sdhci-of-at91: add DT property to enable calibration on full reset Nicolas Ferre
2019-10-11 12:41 ` Ludovic Desroches
@ 2019-10-18 10:58 ` Ulf Hansson
1 sibling, 0 replies; 6+ messages in thread
From: Ulf Hansson @ 2019-10-18 10:58 UTC (permalink / raw)
To: Nicolas Ferre
Cc: DTML, Alexandre Belloni, linux-mmc, Linux Kernel Mailing List,
Adrian Hunter, Ludovic Desroches, Rob Herring, Linux ARM
On Tue, 8 Oct 2019 at 14:34, Nicolas Ferre <nicolas.ferre@microchip.com> wrote:
>
> Add a property to keep the analog calibration cell powered.
> This feature is specific to the Microchip SDHCI IP and outside
> of the standard SDHCI register map.
>
> By always keeping it on, after a full reset sequence, we make sure
> that this feature is activated and not disabled.
>
> We expose a hardware property to the DT as this feature can be used
> to adapt SDHCI behavior vs. how the SDCAL SoC pin is connected
> on the board.
>
> Note that managing properly this property would reduce
> power consumption on some SAMA5D2 SiP revisions.
>
> Signed-off-by: Nicolas Ferre <nicolas.ferre@microchip.com>
Applied for next, thanks!
Kind regards
Uffe
> ---
> drivers/mmc/host/sdhci-of-at91.c | 19 +++++++++++++++++++
> 1 file changed, 19 insertions(+)
>
> diff --git a/drivers/mmc/host/sdhci-of-at91.c b/drivers/mmc/host/sdhci-of-at91.c
> index e7d1920729fb..9571c4a882a9 100644
> --- a/drivers/mmc/host/sdhci-of-at91.c
> +++ b/drivers/mmc/host/sdhci-of-at91.c
> @@ -27,6 +27,9 @@
> #define SDMMC_CACR 0x230
> #define SDMMC_CACR_CAPWREN BIT(0)
> #define SDMMC_CACR_KEY (0x46 << 8)
> +#define SDMMC_CALCR 0x240
> +#define SDMMC_CALCR_EN BIT(0)
> +#define SDMMC_CALCR_ALWYSON BIT(4)
>
> #define SDHCI_AT91_PRESET_COMMON_CONF 0x400 /* drv type B, programmable clock mode */
>
> @@ -35,6 +38,7 @@ struct sdhci_at91_priv {
> struct clk *gck;
> struct clk *mainck;
> bool restore_needed;
> + bool cal_always_on;
> };
>
> static void sdhci_at91_set_force_card_detect(struct sdhci_host *host)
> @@ -116,10 +120,17 @@ static void sdhci_at91_set_uhs_signaling(struct sdhci_host *host,
>
> static void sdhci_at91_reset(struct sdhci_host *host, u8 mask)
> {
> + struct sdhci_pltfm_host *pltfm_host = sdhci_priv(host);
> + struct sdhci_at91_priv *priv = sdhci_pltfm_priv(pltfm_host);
> +
> sdhci_reset(host, mask);
>
> if (host->mmc->caps & MMC_CAP_NONREMOVABLE)
> sdhci_at91_set_force_card_detect(host);
> +
> + if (priv->cal_always_on && (mask & SDHCI_RESET_ALL))
> + sdhci_writel(host, SDMMC_CALCR_ALWYSON | SDMMC_CALCR_EN,
> + SDMMC_CALCR);
> }
>
> static const struct sdhci_ops sdhci_at91_sama5d2_ops = {
> @@ -345,6 +356,14 @@ static int sdhci_at91_probe(struct platform_device *pdev)
>
> priv->restore_needed = false;
>
> + /*
> + * if SDCAL pin is wrongly connected, we must enable
> + * the analog calibration cell permanently.
> + */
> + priv->cal_always_on =
> + device_property_read_bool(&pdev->dev,
> + "microchip,sdcal-inverted");
> +
> ret = mmc_of_parse(host->mmc);
> if (ret)
> goto clocks_disable_unprepare;
> --
> 2.17.1
>
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2019-10-18 10:59 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-10-08 12:34 [PATCH 1/2] dt-bindings: sdhci-of-at91: add the microchip, sdcal-inverted property Nicolas Ferre
2019-10-08 12:34 ` [PATCH 2/2] mmc: sdhci-of-at91: add DT property to enable calibration on full reset Nicolas Ferre
2019-10-11 12:41 ` Ludovic Desroches
2019-10-18 10:58 ` Ulf Hansson
2019-10-15 22:25 ` [PATCH 1/2] dt-bindings: sdhci-of-at91: add the microchip,sdcal-inverted property Rob Herring
2019-10-18 10:58 ` 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).