Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1605656 > unrolled thread

[v5 1/4] mmc: sdhci-cadence: Fix writing PHY delay

Started byPiotr Sroka <piotrs@cadence.com>
First post2017-03-21 15:40 +0100
Last post2017-03-22 08:40 +0100
Articles 7 — 3 participants

Back to article view | Back to linux.kernel


Contents

  [v5 1/4] mmc: sdhci-cadence: Fix writing PHY delay Piotr Sroka <piotrs@cadence.com> - 2017-03-21 15:40 +0100
    [v5 2/4] dt-bindings: mmc: add description of PHY delays for sdhci-cadence Piotr Sroka <piotrs@cadence.com> - 2017-03-21 15:40 +0100
      Re: [v5 2/4] dt-bindings: mmc: add description of PHY delays for sdhci-cadence Masahiro Yamada <yamada.masahiro@socionext.com> - 2017-03-22 08:40 +0100
      Re: [v5 2/4] dt-bindings: mmc: add description of PHY delays for  sdhci-cadence Rob Herring <robh@kernel.org> - 2017-03-24 17:30 +0100
    [v5 4/4] mmc: sdhci-cadence: refactor probe function Piotr Sroka <piotrs@cadence.com> - 2017-03-21 15:40 +0100
      Re: [v5 4/4] mmc: sdhci-cadence: refactor probe function Masahiro Yamada <yamada.masahiro@socionext.com> - 2017-03-22 08:40 +0100
    Re: [v5 1/4] mmc: sdhci-cadence: Fix writing PHY delay Masahiro Yamada <yamada.masahiro@socionext.com> - 2017-03-22 08:40 +0100

#1605656 — [v5 1/4] mmc: sdhci-cadence: Fix writing PHY delay

FromPiotr Sroka <piotrs@cadence.com>
Date2017-03-21 15:40 +0100
Subject[v5 1/4] mmc: sdhci-cadence: Fix writing PHY delay
Message-ID<tnt73-4zY-7@gated-at.bofh.it>
Add polling for ACK to be sure that data are written to PHY register.

Signed-off-by: Piotr Sroka <piotrs@cadence.com>
---
Changes for v2:
- fix indent
---
Changes for v3:
- none
---
Changes for v4:
- none
---
Changes for v5:
- use driver version from next branch, with applied enhanced strobe feature support.
---
 drivers/mmc/host/sdhci-cadence.c | 11 +++++++++--
 1 file changed, 9 insertions(+), 2 deletions(-)

diff --git a/drivers/mmc/host/sdhci-cadence.c b/drivers/mmc/host/sdhci-cadence.c
index 48f6419..83c3b55 100644
--- a/drivers/mmc/host/sdhci-cadence.c
+++ b/drivers/mmc/host/sdhci-cadence.c
@@ -68,11 +68,12 @@ struct sdhci_cdns_priv {
 	bool enhanced_strobe;
 };
 
-static void sdhci_cdns_write_phy_reg(struct sdhci_cdns_priv *priv,
-				     u8 addr, u8 data)
+static int sdhci_cdns_write_phy_reg(struct sdhci_cdns_priv *priv,
+				    u8 addr, u8 data)
 {
 	void __iomem *reg = priv->hrs_addr + SDHCI_CDNS_HRS04;
 	u32 tmp;
+	int ret;
 
 	tmp = (data << SDHCI_CDNS_HRS04_WDATA_SHIFT) |
 	      (addr << SDHCI_CDNS_HRS04_ADDR_SHIFT);
@@ -81,8 +82,14 @@ static void sdhci_cdns_write_phy_reg(struct sdhci_cdns_priv *priv,
 	tmp |= SDHCI_CDNS_HRS04_WR;
 	writel(tmp, reg);
 
+	ret = readl_poll_timeout(reg, tmp, tmp & SDHCI_CDNS_HRS04_ACK, 0, 10);
+	if (ret)
+		return ret;
+
 	tmp &= ~SDHCI_CDNS_HRS04_WR;
 	writel(tmp, reg);
+
+	return 0;
 }
 
 static void sdhci_cdns_phy_init(struct sdhci_cdns_priv *priv)
-- 
2.2.2

[toc] | [next] | [standalone]


#1605659 — [v5 2/4] dt-bindings: mmc: add description of PHY delays for sdhci-cadence

FromPiotr Sroka <piotrs@cadence.com>
Date2017-03-21 15:40 +0100
Subject[v5 2/4] dt-bindings: mmc: add description of PHY delays for sdhci-cadence
Message-ID<tnt74-4zY-37@gated-at.bofh.it>
In reply to#1605656
DTS properties are used instead of fixed data
because PHY settings can be different for different chips/boards.
Add description of new DLL PHY delays.

Signed-off-by: Piotr Sroka <piotrs@cadence.com>
---
Changes for v2:
- file was created in v2. It was a part of driver source file patch.
- most delays were moved from dts file
  to data associated with an SoC specific compatible
- description of delays was updated to be more clearly
---
Changes for v3:
- move all delays back to dts because they are also boards dependent
- prefix all of the Cadence-specific properties with cdns prefix
---
Changes for v4:
- change the beginning of the commit subject
---
Changes for v5:
- change name of property to be consistent with timing modes 
  available in Linux
---
 .../devicetree/bindings/mmc/sdhci-cadence.txt      | 48 ++++++++++++++++++++++
 1 file changed, 48 insertions(+)

diff --git a/Documentation/devicetree/bindings/mmc/sdhci-cadence.txt b/Documentation/devicetree/bindings/mmc/sdhci-cadence.txt
index c0f37cb..fa423c2 100644
--- a/Documentation/devicetree/bindings/mmc/sdhci-cadence.txt
+++ b/Documentation/devicetree/bindings/mmc/sdhci-cadence.txt
@@ -19,6 +19,53 @@ if supported.  See mmc.txt for details.
 - mmc-hs400-1_8v
 - mmc-hs400-1_2v
 
+Some PHY delays can be configured by following properties.
+PHY DLL input delays:
+They are used to delay the data valid window, and align the window
+to sampling clock. The delay starts from 5ns (for delay parameter equal to 0)
+and it is increased by 2.5ns in each step.
+- cdns,phy-input-delay-sd-highspeed:
+  Value of the delay in the input path for SD high-speed timing
+  Valid range = [0:0x1F].
+- cdns,phy-input-delay-legacy:
+  Value of the delay in the input path for legacy timing
+  Valid range = [0:0x1F].
+- cdns,phy-input-delay-sd-uhs-sdr12:
+  Value of the delay in the input path for SD UHS SDR12 timing
+  Valid range = [0:0x1F].
+- cdns,phy-input-delay-sd-uhs-sdr25:
+  Value of the delay in the input path for SD UHS SDR25 timing
+  Valid range = [0:0x1F].
+- cdns,phy-input-delay-sd-uhs-sdr50:
+  Value of the delay in the input path for SD UHS SDR50 timing
+  Valid range = [0:0x1F].
+- cdns,phy-input-delay-sd-uhs-ddr50:
+  Value of the delay in the input path for SD UHS DDR50 timing
+  Valid range = [0:0x1F].
+- cdns,phy-input-delay-mmc-highspeed:
+  Value of the delay in the input path for MMC high-speed timing
+  Valid range = [0:0x1F].
+- cdns,phy-input-delay-mmc-ddr:
+  Value of the delay in the input path for eMMC high-speed DDR timing
+  Valid range = [0:0x1F].
+
+PHY DLL clock delays:
+Each delay property represents the fraction of the clock period.
+The approximate delay value will be
+(<delay property value>/128)*sdmclk_clock_period.
+- cdns,phy-dll-delay-sdclk:
+  Value of the delay introduced on the sdclk output
+  for all modes except HS200, HS400 and HS400_ES.
+  Valid range = [0:0x7F].
+- cdns,phy-dll-delay-sdclk-hsmmc:
+  Value of the delay introduced on the sdclk output
+  for HS200, HS400 and HS400_ES speed modes.
+  Valid range = [0:0x7F].
+- cdns,phy-dll-delay-strobe:
+  Value of the delay introduced on the dat_strobe input
+  used in HS400 / HS400_ES speed modes.
+  Valid range = [0:0x7F].
+
 Example:
 	emmc: sdhci@5a000000 {
 		compatible = "socionext,uniphier-sd4hc", "cdns,sd4hc";
@@ -29,4 +76,5 @@ Example:
 		mmc-ddr-1_8v;
 		mmc-hs200-1_8v;
 		mmc-hs400-1_8v;
+		cdns,phy-dll-delay-sdclk = <0>;
 	};
-- 
2.2.2

[toc] | [prev] | [next] | [standalone]


#1606258 — Re: [v5 2/4] dt-bindings: mmc: add description of PHY delays for sdhci-cadence

FromMasahiro Yamada <yamada.masahiro@socionext.com>
Date2017-03-22 08:40 +0100
SubjectRe: [v5 2/4] dt-bindings: mmc: add description of PHY delays for sdhci-cadence
Message-ID<tnJ2b-7gq-27@gated-at.bofh.it>
In reply to#1605659
2017-03-21 23:33 GMT+09:00 Piotr Sroka <piotrs@cadence.com>:
> DTS properties are used instead of fixed data
> because PHY settings can be different for different chips/boards.
> Add description of new DLL PHY delays.
>
> Signed-off-by: Piotr Sroka <piotrs@cadence.com>
> ---
> Changes for v2:
> - file was created in v2. It was a part of driver source file patch.
> - most delays were moved from dts file
>   to data associated with an SoC specific compatible
> - description of delays was updated to be more clearly
> ---
> Changes for v3:
> - move all delays back to dts because they are also boards dependent
> - prefix all of the Cadence-specific properties with cdns prefix
> ---
> Changes for v4:
> - change the beginning of the commit subject
> ---
> Changes for v5:
> - change name of property to be consistent with timing modes
>   available in Linux


As I gave Reviewed-by in v4 already, this looks good to me.


Reviewed-by: Masahiro Yamada <yamada.masahiro@socionext.com>


As I said before,
once you get Reviewed/Acked tags,
please include them in your later version.



-- 
Best Regards
Masahiro Yamada

[toc] | [prev] | [next] | [standalone]


#1608647 — Re: [v5 2/4] dt-bindings: mmc: add description of PHY delays for sdhci-cadence

FromRob Herring <robh@kernel.org>
Date2017-03-24 17:30 +0100
SubjectRe: [v5 2/4] dt-bindings: mmc: add description of PHY delays for sdhci-cadence
Message-ID<toAgc-4c4-49@gated-at.bofh.it>
In reply to#1605659
On Tue, Mar 21, 2017 at 02:33:01PM +0000, Piotr Sroka wrote:
> DTS properties are used instead of fixed data
> because PHY settings can be different for different chips/boards.
> Add description of new DLL PHY delays.
> 
> Signed-off-by: Piotr Sroka <piotrs@cadence.com>
> ---
> Changes for v2:
> - file was created in v2. It was a part of driver source file patch.
> - most delays were moved from dts file
>   to data associated with an SoC specific compatible
> - description of delays was updated to be more clearly
> ---
> Changes for v3:
> - move all delays back to dts because they are also boards dependent
> - prefix all of the Cadence-specific properties with cdns prefix
> ---
> Changes for v4:
> - change the beginning of the commit subject
> ---
> Changes for v5:
> - change name of property to be consistent with timing modes 
>   available in Linux

I don't see any change here...

> ---
>  .../devicetree/bindings/mmc/sdhci-cadence.txt      | 48 ++++++++++++++++++++++
>  1 file changed, 48 insertions(+)

Acked-by: Rob Herring <robh@kernel.org>

[toc] | [prev] | [next] | [standalone]


#1605662 — [v5 4/4] mmc: sdhci-cadence: refactor probe function

FromPiotr Sroka <piotrs@cadence.com>
Date2017-03-21 15:40 +0100
Subject[v5 4/4] mmc: sdhci-cadence: refactor probe function
Message-ID<tnt73-4zY-19@gated-at.bofh.it>
In reply to#1605656
Use added dev variable for devm_clk_get.

Signed-off-by: Piotr Sroka <piotrs@cadence.com>
---
Changes for v5:
- patch created in v5
---
 drivers/mmc/host/sdhci-cadence.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/mmc/host/sdhci-cadence.c b/drivers/mmc/host/sdhci-cadence.c
index c3c7090..5aa238d 100644
--- a/drivers/mmc/host/sdhci-cadence.c
+++ b/drivers/mmc/host/sdhci-cadence.c
@@ -305,7 +305,7 @@ static int sdhci_cdns_probe(struct platform_device *pdev)
 	int ret;
 	struct device *dev = &pdev->dev;
 
-	clk = devm_clk_get(&pdev->dev, NULL);
+	clk = devm_clk_get(dev, NULL);
 	if (IS_ERR(clk))
 		return PTR_ERR(clk);
 
-- 
2.2.2

[toc] | [prev] | [next] | [standalone]


#1606255 — Re: [v5 4/4] mmc: sdhci-cadence: refactor probe function

FromMasahiro Yamada <yamada.masahiro@socionext.com>
Date2017-03-22 08:40 +0100
SubjectRe: [v5 4/4] mmc: sdhci-cadence: refactor probe function
Message-ID<tnJ2a-7gq-5@gated-at.bofh.it>
In reply to#1605662
2017-03-21 23:33 GMT+09:00 Piotr Sroka <piotrs@cadence.com>:
> Use added dev variable for devm_clk_get.
>
> Signed-off-by: Piotr Sroka <piotrs@cadence.com>
> ---
> Changes for v5:
> - patch created in v5
> ---


Reviewed-by: Masahiro Yamada <yamada.masahiro@socionext.com>


-- 
Best Regards
Masahiro Yamada

[toc] | [prev] | [next] | [standalone]


#1606261

FromMasahiro Yamada <yamada.masahiro@socionext.com>
Date2017-03-22 08:40 +0100
Message-ID<tnJ2b-7gq-23@gated-at.bofh.it>
In reply to#1605656
2017-03-21 23:32 GMT+09:00 Piotr Sroka <piotrs@cadence.com>:
> Add polling for ACK to be sure that data are written to PHY register.
>
> Signed-off-by: Piotr Sroka <piotrs@cadence.com>


Reviewed-by: Masahiro Yamada <yamada.masahiro@socionext.com>


-- 
Best Regards
Masahiro Yamada

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web