* [PATCH 2/2] phy: rockchip-emmc: try to get drive impedance from DT
[not found] ` <1483608682-226716-1-git-send-email-shawn.lin-TNX95d0MmH7DzftRWevZcw@public.gmane.org>
@ 2017-01-05 9:31 ` Shawn Lin
[not found] ` <1483608682-226716-2-git-send-email-shawn.lin-TNX95d0MmH7DzftRWevZcw@public.gmane.org>
2017-01-05 11:15 ` [PATCH 1/2] Documentation: phy: introduce new optional property to specify drive impedance Heiko Stübner
2017-01-09 18:06 ` Rob Herring
2 siblings, 1 reply; 8+ messages in thread
From: Shawn Lin @ 2017-01-05 9:31 UTC (permalink / raw)
To: Kishon Vijay Abraham I
Cc: devicetree-u79uwXL29TY76Z2rM5mHXA, Heiko Stuebner, Shawn Lin,
Douglas Anderson, linux-kernel-u79uwXL29TY76Z2rM5mHXA,
linux-rockchip-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r, Rob Herring
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-TNX95d0MmH7DzftRWevZcw@public.gmane.org>
---
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
^ permalink raw reply related [flat|nested] 8+ messages in thread* Re: [PATCH 1/2] Documentation: phy: introduce new optional property to specify drive impedance
[not found] ` <1483608682-226716-1-git-send-email-shawn.lin-TNX95d0MmH7DzftRWevZcw@public.gmane.org>
2017-01-05 9:31 ` [PATCH 2/2] phy: rockchip-emmc: try to get drive impedance from DT Shawn Lin
@ 2017-01-05 11:15 ` Heiko Stübner
2017-01-06 0:44 ` Shawn Lin
2017-01-09 18:06 ` Rob Herring
2 siblings, 1 reply; 8+ messages in thread
From: Heiko Stübner @ 2017-01-05 11:15 UTC (permalink / raw)
To: Shawn Lin
Cc: devicetree-u79uwXL29TY76Z2rM5mHXA, Douglas Anderson,
linux-kernel-u79uwXL29TY76Z2rM5mHXA,
linux-rockchip-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r, Rob Herring,
Kishon Vijay Abraham I
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-TNX95d0MmH7DzftRWevZcw@public.gmane.org>
> ---
>
> 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
^ permalink raw reply [flat|nested] 8+ messages in thread* Re: [PATCH 1/2] Documentation: phy: introduce new optional property to specify drive impedance
2017-01-05 11:15 ` [PATCH 1/2] Documentation: phy: introduce new optional property to specify drive impedance Heiko Stübner
@ 2017-01-06 0:44 ` Shawn Lin
0 siblings, 0 replies; 8+ messages in thread
From: Shawn Lin @ 2017-01-06 0:44 UTC (permalink / raw)
To: Heiko Stübner
Cc: devicetree-u79uwXL29TY76Z2rM5mHXA,
linux-kernel-u79uwXL29TY76Z2rM5mHXA,
shawn.lin-TNX95d0MmH7DzftRWevZcw, Douglas Anderson,
Kishon Vijay Abraham I,
linux-rockchip-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r, Rob Herring
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-TNX95d0MmH7DzftRWevZcw@public.gmane.org>
>> ---
>>
>> 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
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH 1/2] Documentation: phy: introduce new optional property to specify drive impedance
[not found] ` <1483608682-226716-1-git-send-email-shawn.lin-TNX95d0MmH7DzftRWevZcw@public.gmane.org>
2017-01-05 9:31 ` [PATCH 2/2] phy: rockchip-emmc: try to get drive impedance from DT Shawn Lin
2017-01-05 11:15 ` [PATCH 1/2] Documentation: phy: introduce new optional property to specify drive impedance Heiko Stübner
@ 2017-01-09 18:06 ` Rob Herring
2 siblings, 0 replies; 8+ messages in thread
From: Rob Herring @ 2017-01-09 18:06 UTC (permalink / raw)
To: Shawn Lin
Cc: Kishon Vijay Abraham I, devicetree-u79uwXL29TY76Z2rM5mHXA,
linux-rockchip-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r, Heiko Stuebner,
Douglas Anderson, linux-kernel-u79uwXL29TY76Z2rM5mHXA
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-TNX95d0MmH7DzftRWevZcw@public.gmane.org>
> ---
>
> 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
>
>
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply [flat|nested] 8+ messages in thread