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


Groups > linux.kernel > #1551819 > unrolled thread

[PATCH 1/2] Documentation: phy: introduce new optional property to specify drive impedance

Started byShawn Lin <shawn.lin@rock-chips.com>
First post2017-01-05 10:40 +0100
Last post2017-01-09 19:10 +0100
Articles 8 — 4 participants

Back to article view | Back to linux.kernel


Contents

  [PATCH 1/2] Documentation: phy: introduce new optional property to specify drive impedance Shawn Lin <shawn.lin@rock-chips.com> - 2017-01-05 10:40 +0100
    [PATCH 2/2] phy: rockchip-emmc: try to get drive impedance from DT Shawn Lin <shawn.lin@rock-chips.com> - 2017-01-05 10:40 +0100
      Re: [PATCH 2/2] phy: rockchip-emmc: try to get drive impedance from DT Doug Anderson <dianders@chromium.org> - 2017-01-06 02:00 +0100
        Re: [PATCH 2/2] phy: rockchip-emmc: try to get drive impedance from  DT Shawn Lin <shawn.lin@rock-chips.com> - 2017-01-06 02:20 +0100
          Re: [PATCH 2/2] phy: rockchip-emmc: try to get drive impedance from DT Doug Anderson <dianders@chromium.org> - 2017-01-06 19:30 +0100
    Re: [PATCH 1/2] Documentation: phy: introduce new optional property to specify drive impedance Heiko Stübner <heiko@sntech.de> - 2017-01-05 13:00 +0100
      Re: [PATCH 1/2] Documentation: phy: introduce new optional property  to specify drive impedance Shawn Lin <shawn.lin@rock-chips.com> - 2017-01-06 01:50 +0100
    Re: [PATCH 1/2] Documentation: phy: introduce new optional property  to specify drive impedance Rob Herring <robh@kernel.org> - 2017-01-09 19:10 +0100

#1551819 — [PATCH 1/2] Documentation: phy: introduce new optional property to specify drive impedance

FromShawn Lin <shawn.lin@rock-chips.com>
Date2017-01-05 10:40 +0100
Subject[PATCH 1/2] Documentation: phy: introduce new optional property to specify drive impedance
Message-ID<sWcGB-15H-11@gated-at.bofh.it>
We need to modify the drive impedance according to the
different hardware condition. So let's expose this to
the DT.

Signed-off-by: Shawn Lin <shawn.lin@rock-chips.com>
---

 Documentation/devicetree/bindings/phy/rockchip-emmc-phy.txt | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/Documentation/devicetree/bindings/phy/rockchip-emmc-phy.txt b/Documentation/devicetree/bindings/phy/rockchip-emmc-phy.txt
index e3ea557..731aeb9 100644
--- a/Documentation/devicetree/bindings/phy/rockchip-emmc-phy.txt
+++ b/Documentation/devicetree/bindings/phy/rockchip-emmc-phy.txt
@@ -14,6 +14,11 @@ specified by name:
 		access to it), it is strongly suggested.
  - clocks: Should have a phandle to the card clock exported by the SDHCI driver.
 
+Optional Properties:
+- drive_impedance: Must be one of 33, 40, 50, 66, 100. This property allows
+	different boards to specify their own drive impedance depending on the
+	hardware condition.
+
 Example:
 
 
-- 
1.9.1

[toc] | [next] | [standalone]


#1551820 — [PATCH 2/2] phy: rockchip-emmc: try to get drive impedance from DT

FromShawn Lin <shawn.lin@rock-chips.com>
Date2017-01-05 10:40 +0100
Subject[PATCH 2/2] phy: rockchip-emmc: try to get drive impedance from DT
Message-ID<sWcGB-15H-19@gated-at.bofh.it>
In reply to#1551819
Try to get drive impedance from DT and use it, otherwise
use 50ohm by default in order not to break the existing boards
as 50ohm works fine for them already.

Signed-off-by: Shawn Lin <shawn.lin@rock-chips.com>
---

 drivers/phy/phy-rockchip-emmc.c | 29 ++++++++++++++++++++++++++++-
 1 file changed, 28 insertions(+), 1 deletion(-)

diff --git a/drivers/phy/phy-rockchip-emmc.c b/drivers/phy/phy-rockchip-emmc.c
index f1b24f1..7fd4a3e 100644
--- a/drivers/phy/phy-rockchip-emmc.c
+++ b/drivers/phy/phy-rockchip-emmc.c
@@ -78,6 +78,7 @@
 
 struct rockchip_emmc_phy {
 	unsigned int	reg_offset;
+	unsigned int	drive_impedance;
 	struct regmap	*reg_base;
 	struct clk	*emmcclk;
 };
@@ -288,7 +289,7 @@ static int rockchip_emmc_phy_power_on(struct phy *phy)
 	/* Drive impedance: 50 Ohm */
 	regmap_write(rk_phy->reg_base,
 		     rk_phy->reg_offset + GRF_EMMCPHY_CON6,
-		     HIWORD_UPDATE(PHYCTRL_DR_50OHM,
+		     HIWORD_UPDATE(rk_phy->drive_impedance,
 				   PHYCTRL_DR_MASK,
 				   PHYCTRL_DR_SHIFT));
 
@@ -346,6 +347,32 @@ static int rockchip_emmc_phy_probe(struct platform_device *pdev)
 		return -EINVAL;
 	}
 
+	rk_phy->drive_impedance = PHYCTRL_DR_50OHM;
+	if (!of_property_read_u32(dev->of_node, "drive_impedance",
+				  &rk_phy->drive_impedance)) {
+		switch (rk_phy->drive_impedance) {
+		case 33:
+			rk_phy->drive_impedance = PHYCTRL_DR_33OHM;
+			break;
+		case 40:
+			rk_phy->drive_impedance = PHYCTRL_DR_40OHM;
+			break;
+		case 50:
+			rk_phy->drive_impedance = PHYCTRL_DR_50OHM;
+			break;
+		case 66:
+			rk_phy->drive_impedance = PHYCTRL_DR_66OHM;
+			break;
+		case 100:
+			rk_phy->drive_impedance = PHYCTRL_DR_100OHM;
+			break;
+		default:
+			dev_info(dev, "invalid drive impedance.\n");
+			rk_phy->drive_impedance = PHYCTRL_DR_50OHM;
+			break;
+		}
+	}
+
 	rk_phy->reg_offset = reg_offset;
 	rk_phy->reg_base = grf;
 
-- 
1.9.1

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


#1552438 — Re: [PATCH 2/2] phy: rockchip-emmc: try to get drive impedance from DT

FromDoug Anderson <dianders@chromium.org>
Date2017-01-06 02:00 +0100
SubjectRe: [PATCH 2/2] phy: rockchip-emmc: try to get drive impedance from DT
Message-ID<sWr2W-2iO-7@gated-at.bofh.it>
In reply to#1551820
Hi,

On Thu, Jan 5, 2017 at 1:31 AM, Shawn Lin <shawn.lin@rock-chips.com> wrote:
> Try to get drive impedance from DT and use it, otherwise
> use 50ohm by default in order not to break the existing boards
> as 50ohm works fine for them already.
>
> Signed-off-by: Shawn Lin <shawn.lin@rock-chips.com>
> ---
>
>  drivers/phy/phy-rockchip-emmc.c | 29 ++++++++++++++++++++++++++++-
>  1 file changed, 28 insertions(+), 1 deletion(-)

I could have sworn that you somehow needed to make sure that the eMMC
part itself needed to also be updated to be told the matching drive
impedance so you don't get a mismatch.  How do you make that work?
...or am I just confused.  I meant to try to dig more, but ran out of
time today.  :(

-Doug

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


#1552445 — Re: [PATCH 2/2] phy: rockchip-emmc: try to get drive impedance from DT

FromShawn Lin <shawn.lin@rock-chips.com>
Date2017-01-06 02:20 +0100
SubjectRe: [PATCH 2/2] phy: rockchip-emmc: try to get drive impedance from DT
Message-ID<sWrmh-2Gl-9@gated-at.bofh.it>
In reply to#1552438
On 2017/1/6 8:51, Doug Anderson wrote:
> Hi,
>
> On Thu, Jan 5, 2017 at 1:31 AM, Shawn Lin <shawn.lin@rock-chips.com> wrote:
>> Try to get drive impedance from DT and use it, otherwise
>> use 50ohm by default in order not to break the existing boards
>> as 50ohm works fine for them already.
>>
>> Signed-off-by: Shawn Lin <shawn.lin@rock-chips.com>
>> ---
>>
>>  drivers/phy/phy-rockchip-emmc.c | 29 ++++++++++++++++++++++++++++-
>>  1 file changed, 28 insertions(+), 1 deletion(-)
>
> I could have sworn that you somehow needed to make sure that the eMMC
> part itself needed to also be updated to be told the matching drive
> impedance so you don't get a mismatch.  How do you make that work?

No I didn't. So that means the eMMC part itself still couldn't be
updated. The intention for me to introduce this only for emmc phy is
that I got report that the default drive impedance of one eMMC is not
50ohms, so now we haven't been able to update it for eMMC part but maybe
we could just update it for the phy itself to match them in between.


> ...or am I just confused.  I meant to try to dig more, but ran out of
> time today.  :(
>
> -Doug
>
>
>


-- 
Best Regards
Shawn Lin

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


#1553022 — Re: [PATCH 2/2] phy: rockchip-emmc: try to get drive impedance from DT

FromDoug Anderson <dianders@chromium.org>
Date2017-01-06 19:30 +0100
SubjectRe: [PATCH 2/2] phy: rockchip-emmc: try to get drive impedance from DT
Message-ID<sWHr5-5KI-35@gated-at.bofh.it>
In reply to#1552445
Hi,

On Thu, Jan 5, 2017 at 5:09 PM, Shawn Lin <shawn.lin@rock-chips.com> wrote:
> On 2017/1/6 8:51, Doug Anderson wrote:
>>
>> Hi,
>>
>> On Thu, Jan 5, 2017 at 1:31 AM, Shawn Lin <shawn.lin@rock-chips.com>
>> wrote:
>>>
>>> Try to get drive impedance from DT and use it, otherwise
>>> use 50ohm by default in order not to break the existing boards
>>> as 50ohm works fine for them already.
>>>
>>> Signed-off-by: Shawn Lin <shawn.lin@rock-chips.com>
>>> ---
>>>
>>>  drivers/phy/phy-rockchip-emmc.c | 29 ++++++++++++++++++++++++++++-
>>>  1 file changed, 28 insertions(+), 1 deletion(-)
>>
>>
>> I could have sworn that you somehow needed to make sure that the eMMC
>> part itself needed to also be updated to be told the matching drive
>> impedance so you don't get a mismatch.  How do you make that work?
>
>
> No I didn't. So that means the eMMC part itself still couldn't be
> updated. The intention for me to introduce this only for emmc phy is
> that I got report that the default drive impedance of one eMMC is not
> 50ohms, so now we haven't been able to update it for eMMC part but maybe
> we could just update it for the phy itself to match them in between.

Interesting.  ...the eMMC spec says that 50 Ohm is mandatory, so we
know that 50 Ohm must be supported.

...and even if the default isn't 50 Ohm then wouldn't it get set to 50
OHm when we set the HS_TIMING ?


-Doug

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


#1551925

FromHeiko Stübner <heiko@sntech.de>
Date2017-01-05 13:00 +0100
Message-ID<sWeS6-2ug-21@gated-at.bofh.it>
In reply to#1551819
Hi Shawn,

Am Donnerstag, 5. Januar 2017, 17:31:21 schrieb Shawn Lin:
> We need to modify the drive impedance according to the
> different hardware condition. So let's expose this to
> the DT.
> 
> Signed-off-by: Shawn Lin <shawn.lin@rock-chips.com>
> ---
> 
>  Documentation/devicetree/bindings/phy/rockchip-emmc-phy.txt | 5 +++++
>  1 file changed, 5 insertions(+)
> 
> diff --git a/Documentation/devicetree/bindings/phy/rockchip-emmc-phy.txt
> b/Documentation/devicetree/bindings/phy/rockchip-emmc-phy.txt index
> e3ea557..731aeb9 100644
> --- a/Documentation/devicetree/bindings/phy/rockchip-emmc-phy.txt
> +++ b/Documentation/devicetree/bindings/phy/rockchip-emmc-phy.txt
> @@ -14,6 +14,11 @@ specified by name:
>  		access to it), it is strongly suggested.
>   - clocks: Should have a phandle to the card clock exported by the SDHCI
> driver.
> 
> +Optional Properties:
> +- drive_impedance: Must be one of 33, 40, 50, 66, 100. This property allows
> +	different boards to specify their own drive impedance depending on the
> +	hardware condition.

In what unit are your 33, 40 etc values?

It is recommended that properties should specify their unit, see all the 
properties ending in "-ma", "-ns" and so on and also 
Documentation/devicetree/bindings/property-units.txt

Also properties should use dashes ("-") not underscores.

Judging by the second patch, these are Ohm, so combining the above you 
probably want

	drive-impedance-ohms

as property name.

Also the patch subject is slightly misleading and should probably specify the 
rockchip-emmc as well :-)


Heiko

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


#1552436 — Re: [PATCH 1/2] Documentation: phy: introduce new optional property to specify drive impedance

FromShawn Lin <shawn.lin@rock-chips.com>
Date2017-01-06 01:50 +0100
SubjectRe: [PATCH 1/2] Documentation: phy: introduce new optional property to specify drive impedance
Message-ID<sWqTf-2fH-7@gated-at.bofh.it>
In reply to#1551925
On 2017/1/5 19:15, Heiko Stübner wrote:
> Hi Shawn,
>
> Am Donnerstag, 5. Januar 2017, 17:31:21 schrieb Shawn Lin:
>> We need to modify the drive impedance according to the
>> different hardware condition. So let's expose this to
>> the DT.
>>
>> Signed-off-by: Shawn Lin <shawn.lin@rock-chips.com>
>> ---
>>
>>  Documentation/devicetree/bindings/phy/rockchip-emmc-phy.txt | 5 +++++
>>  1 file changed, 5 insertions(+)
>>
>> diff --git a/Documentation/devicetree/bindings/phy/rockchip-emmc-phy.txt
>> b/Documentation/devicetree/bindings/phy/rockchip-emmc-phy.txt index
>> e3ea557..731aeb9 100644
>> --- a/Documentation/devicetree/bindings/phy/rockchip-emmc-phy.txt
>> +++ b/Documentation/devicetree/bindings/phy/rockchip-emmc-phy.txt
>> @@ -14,6 +14,11 @@ specified by name:
>>  		access to it), it is strongly suggested.
>>   - clocks: Should have a phandle to the card clock exported by the SDHCI
>> driver.
>>
>> +Optional Properties:
>> +- drive_impedance: Must be one of 33, 40, 50, 66, 100. This property allows
>> +	different boards to specify their own drive impedance depending on the
>> +	hardware condition.
>
> In what unit are your 33, 40 etc values?
>
> It is recommended that properties should specify their unit, see all the
> properties ending in "-ma", "-ns" and so on and also
> Documentation/devicetree/bindings/property-units.txt
>
> Also properties should use dashes ("-") not underscores.
>
> Judging by the second patch, these are Ohm, so combining the above you
> probably want
>
> 	drive-impedance-ohms
>
> as property name.
>
> Also the patch subject is slightly misleading and should probably specify the
> rockchip-emmc as well :-)

Thanks, will fix them.

>
>
> Heiko
>
>
>


-- 
Best Regards
Shawn Lin

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


#1554567 — Re: [PATCH 1/2] Documentation: phy: introduce new optional property to specify drive impedance

FromRob Herring <robh@kernel.org>
Date2017-01-09 19:10 +0100
SubjectRe: [PATCH 1/2] Documentation: phy: introduce new optional property to specify drive impedance
Message-ID<sXMym-7wx-25@gated-at.bofh.it>
In reply to#1551819
On Thu, Jan 05, 2017 at 05:31:21PM +0800, Shawn Lin wrote:
> We need to modify the drive impedance according to the
> different hardware condition. So let's expose this to
> the DT.
> 
> Signed-off-by: Shawn Lin <shawn.lin@rock-chips.com>
> ---
> 
>  Documentation/devicetree/bindings/phy/rockchip-emmc-phy.txt | 5 +++++
>  1 file changed, 5 insertions(+)
> 
> diff --git a/Documentation/devicetree/bindings/phy/rockchip-emmc-phy.txt b/Documentation/devicetree/bindings/phy/rockchip-emmc-phy.txt
> index e3ea557..731aeb9 100644
> --- a/Documentation/devicetree/bindings/phy/rockchip-emmc-phy.txt
> +++ b/Documentation/devicetree/bindings/phy/rockchip-emmc-phy.txt
> @@ -14,6 +14,11 @@ specified by name:
>  		access to it), it is strongly suggested.
>   - clocks: Should have a phandle to the card clock exported by the SDHCI driver.
>  
> +Optional Properties:
> +- drive_impedance: Must be one of 33, 40, 50, 66, 100. This property allows
> +	different boards to specify their own drive impedance depending on the
> +	hardware condition.

Needs a vendor prefix. Don't use '_'. And needs unit suffix (-ohms).

> +
>  Example:
>  
>  
> -- 
> 1.9.1
> 
> 

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web