* [PATCH v2 01/11] phy: rockchip-emmc: Increase lock time allowance
2016-06-13 23:04 ` Douglas Anderson
(?)
@ 2016-06-13 23:04 ` Douglas Anderson
-1 siblings, 0 replies; 78+ messages in thread
From: Douglas Anderson @ 2016-06-13 23:04 UTC (permalink / raw)
To: ulf.hansson-QSEj5FYQhm4dnm+yROfE0A, kishon-l0cyMroinI0,
Heiko Stuebner, robh+dt-DgEjT+Ai2ygdnm+yROfE0A
Cc: devicetree-u79uwXL29TY76Z2rM5mHXA, xzy.xu-TNX95d0MmH7DzftRWevZcw,
linux-kernel-u79uwXL29TY76Z2rM5mHXA,
shawn.lin-TNX95d0MmH7DzftRWevZcw,
briannorris-F7+t8E8rja9g9hUCZPvPmw,
linux-mmc-u79uwXL29TY76Z2rM5mHXA,
adrian.hunter-ral2JQCrhuEAvxtiuMwx3w, Douglas Anderson,
linux-rockchip-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r,
linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r
Previous PHY code waited a fixed amount of time for the DLL to lock at
power on time. Unfortunately, the time for the DLL to lock is actually
a bit more dynamic and can be longer if the card clock is slower.
Instead of waiting a fixed 30 us, let's now dynamically wait until the
lock bit gets set. We'll wait up to 10 ms which should be OK even if
the card clock is at the super slow 100 kHz.
On its own, this change makes the PHY power on code a little more
robust. Before this change the PHY was relying on the eMMC code to make
sure the PHY was only powered on when the card clock was set to at least
50 MHz before, though this reliance wasn't documented anywhere.
This change will be even more useful in future changes where we actually
need to be able to wait for a DLL lock at slower clock speeds.
Signed-off-by: Douglas Anderson <dianders-F7+t8E8rja9g9hUCZPvPmw@public.gmane.org>
---
Changes in v2:
- Indicate that 5.1 ms is calculated (Shawn).
drivers/phy/phy-rockchip-emmc.c | 28 ++++++++++++++++++++--------
1 file changed, 20 insertions(+), 8 deletions(-)
diff --git a/drivers/phy/phy-rockchip-emmc.c b/drivers/phy/phy-rockchip-emmc.c
index a69f53630e67..2d059c046978 100644
--- a/drivers/phy/phy-rockchip-emmc.c
+++ b/drivers/phy/phy-rockchip-emmc.c
@@ -85,6 +85,7 @@ static int rockchip_emmc_phy_power(struct rockchip_emmc_phy *rk_phy,
{
unsigned int caldone;
unsigned int dllrdy;
+ unsigned long timeout;
/*
* Keep phyctrl_pdb and phyctrl_endll low to allow
@@ -137,15 +138,26 @@ static int rockchip_emmc_phy_power(struct rockchip_emmc_phy *rk_phy,
PHYCTRL_ENDLL_MASK,
PHYCTRL_ENDLL_SHIFT));
/*
- * After enable analog DLL circuits, we need an extra 10.2us
- * for dll to be ready for work. But according to testing, we
- * find some chips need more than 25us.
+ * After enabling analog DLL circuits docs say that we need 10.2 us if
+ * our source clock is at 50 MHz and that lock time scales linearly
+ * with clock speed. If we are powering on the PHY and the card clock
+ * is super slow (like 100 kHZ) this could take as long as 5.1 ms as
+ * per the math: 10.2 us * (50000000 Hz / 100000 Hz) => 5.1 ms
+ * Hopefully we won't be running at 100 kHz, but we should still make
+ * sure we wait long enough.
*/
- udelay(30);
- regmap_read(rk_phy->reg_base,
- rk_phy->reg_offset + GRF_EMMCPHY_STATUS,
- &dllrdy);
- dllrdy = (dllrdy >> PHYCTRL_DLLRDY_SHIFT) & PHYCTRL_DLLRDY_MASK;
+ timeout = jiffies + msecs_to_jiffies(10);
+ do {
+ udelay(1);
+
+ regmap_read(rk_phy->reg_base,
+ rk_phy->reg_offset + GRF_EMMCPHY_STATUS,
+ &dllrdy);
+ dllrdy = (dllrdy >> PHYCTRL_DLLRDY_SHIFT) & PHYCTRL_DLLRDY_MASK;
+ if (dllrdy == PHYCTRL_DLLRDY_DONE)
+ break;
+ } while (!time_after(jiffies, timeout));
+
if (dllrdy != PHYCTRL_DLLRDY_DONE) {
pr_err("rockchip_emmc_phy_power: dllrdy timeout.\n");
return -ETIMEDOUT;
--
2.8.0.rc3.226.g39d4020
^ permalink raw reply related [flat|nested] 78+ messages in thread* [PATCH v2 01/11] phy: rockchip-emmc: Increase lock time allowance
@ 2016-06-13 23:04 ` Douglas Anderson
0 siblings, 0 replies; 78+ messages in thread
From: Douglas Anderson @ 2016-06-13 23:04 UTC (permalink / raw)
To: ulf.hansson, kishon, Heiko Stuebner, robh+dt
Cc: shawn.lin, xzy.xu, briannorris, adrian.hunter, linux-rockchip,
linux-mmc, devicetree, Douglas Anderson, linux-kernel,
linux-arm-kernel
Previous PHY code waited a fixed amount of time for the DLL to lock at
power on time. Unfortunately, the time for the DLL to lock is actually
a bit more dynamic and can be longer if the card clock is slower.
Instead of waiting a fixed 30 us, let's now dynamically wait until the
lock bit gets set. We'll wait up to 10 ms which should be OK even if
the card clock is at the super slow 100 kHz.
On its own, this change makes the PHY power on code a little more
robust. Before this change the PHY was relying on the eMMC code to make
sure the PHY was only powered on when the card clock was set to at least
50 MHz before, though this reliance wasn't documented anywhere.
This change will be even more useful in future changes where we actually
need to be able to wait for a DLL lock at slower clock speeds.
Signed-off-by: Douglas Anderson <dianders@chromium.org>
---
Changes in v2:
- Indicate that 5.1 ms is calculated (Shawn).
drivers/phy/phy-rockchip-emmc.c | 28 ++++++++++++++++++++--------
1 file changed, 20 insertions(+), 8 deletions(-)
diff --git a/drivers/phy/phy-rockchip-emmc.c b/drivers/phy/phy-rockchip-emmc.c
index a69f53630e67..2d059c046978 100644
--- a/drivers/phy/phy-rockchip-emmc.c
+++ b/drivers/phy/phy-rockchip-emmc.c
@@ -85,6 +85,7 @@ static int rockchip_emmc_phy_power(struct rockchip_emmc_phy *rk_phy,
{
unsigned int caldone;
unsigned int dllrdy;
+ unsigned long timeout;
/*
* Keep phyctrl_pdb and phyctrl_endll low to allow
@@ -137,15 +138,26 @@ static int rockchip_emmc_phy_power(struct rockchip_emmc_phy *rk_phy,
PHYCTRL_ENDLL_MASK,
PHYCTRL_ENDLL_SHIFT));
/*
- * After enable analog DLL circuits, we need an extra 10.2us
- * for dll to be ready for work. But according to testing, we
- * find some chips need more than 25us.
+ * After enabling analog DLL circuits docs say that we need 10.2 us if
+ * our source clock is at 50 MHz and that lock time scales linearly
+ * with clock speed. If we are powering on the PHY and the card clock
+ * is super slow (like 100 kHZ) this could take as long as 5.1 ms as
+ * per the math: 10.2 us * (50000000 Hz / 100000 Hz) => 5.1 ms
+ * Hopefully we won't be running at 100 kHz, but we should still make
+ * sure we wait long enough.
*/
- udelay(30);
- regmap_read(rk_phy->reg_base,
- rk_phy->reg_offset + GRF_EMMCPHY_STATUS,
- &dllrdy);
- dllrdy = (dllrdy >> PHYCTRL_DLLRDY_SHIFT) & PHYCTRL_DLLRDY_MASK;
+ timeout = jiffies + msecs_to_jiffies(10);
+ do {
+ udelay(1);
+
+ regmap_read(rk_phy->reg_base,
+ rk_phy->reg_offset + GRF_EMMCPHY_STATUS,
+ &dllrdy);
+ dllrdy = (dllrdy >> PHYCTRL_DLLRDY_SHIFT) & PHYCTRL_DLLRDY_MASK;
+ if (dllrdy == PHYCTRL_DLLRDY_DONE)
+ break;
+ } while (!time_after(jiffies, timeout));
+
if (dllrdy != PHYCTRL_DLLRDY_DONE) {
pr_err("rockchip_emmc_phy_power: dllrdy timeout.\n");
return -ETIMEDOUT;
--
2.8.0.rc3.226.g39d4020
^ permalink raw reply related [flat|nested] 78+ messages in thread* [PATCH v2 01/11] phy: rockchip-emmc: Increase lock time allowance
@ 2016-06-13 23:04 ` Douglas Anderson
0 siblings, 0 replies; 78+ messages in thread
From: Douglas Anderson @ 2016-06-13 23:04 UTC (permalink / raw)
To: linux-arm-kernel
Previous PHY code waited a fixed amount of time for the DLL to lock at
power on time. Unfortunately, the time for the DLL to lock is actually
a bit more dynamic and can be longer if the card clock is slower.
Instead of waiting a fixed 30 us, let's now dynamically wait until the
lock bit gets set. We'll wait up to 10 ms which should be OK even if
the card clock is at the super slow 100 kHz.
On its own, this change makes the PHY power on code a little more
robust. Before this change the PHY was relying on the eMMC code to make
sure the PHY was only powered on when the card clock was set to at least
50 MHz before, though this reliance wasn't documented anywhere.
This change will be even more useful in future changes where we actually
need to be able to wait for a DLL lock at slower clock speeds.
Signed-off-by: Douglas Anderson <dianders@chromium.org>
---
Changes in v2:
- Indicate that 5.1 ms is calculated (Shawn).
drivers/phy/phy-rockchip-emmc.c | 28 ++++++++++++++++++++--------
1 file changed, 20 insertions(+), 8 deletions(-)
diff --git a/drivers/phy/phy-rockchip-emmc.c b/drivers/phy/phy-rockchip-emmc.c
index a69f53630e67..2d059c046978 100644
--- a/drivers/phy/phy-rockchip-emmc.c
+++ b/drivers/phy/phy-rockchip-emmc.c
@@ -85,6 +85,7 @@ static int rockchip_emmc_phy_power(struct rockchip_emmc_phy *rk_phy,
{
unsigned int caldone;
unsigned int dllrdy;
+ unsigned long timeout;
/*
* Keep phyctrl_pdb and phyctrl_endll low to allow
@@ -137,15 +138,26 @@ static int rockchip_emmc_phy_power(struct rockchip_emmc_phy *rk_phy,
PHYCTRL_ENDLL_MASK,
PHYCTRL_ENDLL_SHIFT));
/*
- * After enable analog DLL circuits, we need an extra 10.2us
- * for dll to be ready for work. But according to testing, we
- * find some chips need more than 25us.
+ * After enabling analog DLL circuits docs say that we need 10.2 us if
+ * our source clock is at 50 MHz and that lock time scales linearly
+ * with clock speed. If we are powering on the PHY and the card clock
+ * is super slow (like 100 kHZ) this could take as long as 5.1 ms as
+ * per the math: 10.2 us * (50000000 Hz / 100000 Hz) => 5.1 ms
+ * Hopefully we won't be running at 100 kHz, but we should still make
+ * sure we wait long enough.
*/
- udelay(30);
- regmap_read(rk_phy->reg_base,
- rk_phy->reg_offset + GRF_EMMCPHY_STATUS,
- &dllrdy);
- dllrdy = (dllrdy >> PHYCTRL_DLLRDY_SHIFT) & PHYCTRL_DLLRDY_MASK;
+ timeout = jiffies + msecs_to_jiffies(10);
+ do {
+ udelay(1);
+
+ regmap_read(rk_phy->reg_base,
+ rk_phy->reg_offset + GRF_EMMCPHY_STATUS,
+ &dllrdy);
+ dllrdy = (dllrdy >> PHYCTRL_DLLRDY_SHIFT) & PHYCTRL_DLLRDY_MASK;
+ if (dllrdy == PHYCTRL_DLLRDY_DONE)
+ break;
+ } while (!time_after(jiffies, timeout));
+
if (dllrdy != PHYCTRL_DLLRDY_DONE) {
pr_err("rockchip_emmc_phy_power: dllrdy timeout.\n");
return -ETIMEDOUT;
--
2.8.0.rc3.226.g39d4020
^ permalink raw reply related [flat|nested] 78+ messages in thread* Re: [PATCH v2 01/11] phy: rockchip-emmc: Increase lock time allowance
2016-06-13 23:04 ` Douglas Anderson
@ 2016-06-14 0:28 ` Shawn Lin
-1 siblings, 0 replies; 78+ messages in thread
From: Shawn Lin @ 2016-06-14 0:28 UTC (permalink / raw)
To: Douglas Anderson, ulf.hansson, kishon, Heiko Stuebner, robh+dt
Cc: shawn.lin, xzy.xu, briannorris, adrian.hunter, linux-rockchip,
linux-mmc, devicetree, linux-kernel, linux-arm-kernel
在 2016/6/14 7:04, Douglas Anderson 写道:
> Previous PHY code waited a fixed amount of time for the DLL to lock at
> power on time. Unfortunately, the time for the DLL to lock is actually
> a bit more dynamic and can be longer if the card clock is slower.
>
> Instead of waiting a fixed 30 us, let's now dynamically wait until the
> lock bit gets set. We'll wait up to 10 ms which should be OK even if
> the card clock is at the super slow 100 kHz.
>
> On its own, this change makes the PHY power on code a little more
> robust. Before this change the PHY was relying on the eMMC code to make
> sure the PHY was only powered on when the card clock was set to at least
> 50 MHz before, though this reliance wasn't documented anywhere.
>
> This change will be even more useful in future changes where we actually
> need to be able to wait for a DLL lock at slower clock speeds.
>
Looks good to me.
Reviewed-by: Shawn Lin <shawn.lin@rock-chips.com>
> Signed-off-by: Douglas Anderson <dianders@chromium.org>
> ---
> Changes in v2:
> - Indicate that 5.1 ms is calculated (Shawn).
>
> drivers/phy/phy-rockchip-emmc.c | 28 ++++++++++++++++++++--------
> 1 file changed, 20 insertions(+), 8 deletions(-)
>
> diff --git a/drivers/phy/phy-rockchip-emmc.c b/drivers/phy/phy-rockchip-emmc.c
> index a69f53630e67..2d059c046978 100644
> --- a/drivers/phy/phy-rockchip-emmc.c
> +++ b/drivers/phy/phy-rockchip-emmc.c
> @@ -85,6 +85,7 @@ static int rockchip_emmc_phy_power(struct rockchip_emmc_phy *rk_phy,
> {
> unsigned int caldone;
> unsigned int dllrdy;
> + unsigned long timeout;
>
> /*
> * Keep phyctrl_pdb and phyctrl_endll low to allow
> @@ -137,15 +138,26 @@ static int rockchip_emmc_phy_power(struct rockchip_emmc_phy *rk_phy,
> PHYCTRL_ENDLL_MASK,
> PHYCTRL_ENDLL_SHIFT));
> /*
> - * After enable analog DLL circuits, we need an extra 10.2us
> - * for dll to be ready for work. But according to testing, we
> - * find some chips need more than 25us.
> + * After enabling analog DLL circuits docs say that we need 10.2 us if
> + * our source clock is at 50 MHz and that lock time scales linearly
> + * with clock speed. If we are powering on the PHY and the card clock
> + * is super slow (like 100 kHZ) this could take as long as 5.1 ms as
> + * per the math: 10.2 us * (50000000 Hz / 100000 Hz) => 5.1 ms
> + * Hopefully we won't be running at 100 kHz, but we should still make
> + * sure we wait long enough.
> */
> - udelay(30);
> - regmap_read(rk_phy->reg_base,
> - rk_phy->reg_offset + GRF_EMMCPHY_STATUS,
> - &dllrdy);
> - dllrdy = (dllrdy >> PHYCTRL_DLLRDY_SHIFT) & PHYCTRL_DLLRDY_MASK;
> + timeout = jiffies + msecs_to_jiffies(10);
> + do {
> + udelay(1);
> +
> + regmap_read(rk_phy->reg_base,
> + rk_phy->reg_offset + GRF_EMMCPHY_STATUS,
> + &dllrdy);
> + dllrdy = (dllrdy >> PHYCTRL_DLLRDY_SHIFT) & PHYCTRL_DLLRDY_MASK;
> + if (dllrdy == PHYCTRL_DLLRDY_DONE)
> + break;
> + } while (!time_after(jiffies, timeout));
> +
> if (dllrdy != PHYCTRL_DLLRDY_DONE) {
> pr_err("rockchip_emmc_phy_power: dllrdy timeout.\n");
> return -ETIMEDOUT;
>
--
Best Regards
Shawn Lin
^ permalink raw reply [flat|nested] 78+ messages in thread* [PATCH v2 01/11] phy: rockchip-emmc: Increase lock time allowance
@ 2016-06-14 0:28 ` Shawn Lin
0 siblings, 0 replies; 78+ messages in thread
From: Shawn Lin @ 2016-06-14 0:28 UTC (permalink / raw)
To: linux-arm-kernel
? 2016/6/14 7:04, Douglas Anderson ??:
> Previous PHY code waited a fixed amount of time for the DLL to lock at
> power on time. Unfortunately, the time for the DLL to lock is actually
> a bit more dynamic and can be longer if the card clock is slower.
>
> Instead of waiting a fixed 30 us, let's now dynamically wait until the
> lock bit gets set. We'll wait up to 10 ms which should be OK even if
> the card clock is at the super slow 100 kHz.
>
> On its own, this change makes the PHY power on code a little more
> robust. Before this change the PHY was relying on the eMMC code to make
> sure the PHY was only powered on when the card clock was set to at least
> 50 MHz before, though this reliance wasn't documented anywhere.
>
> This change will be even more useful in future changes where we actually
> need to be able to wait for a DLL lock at slower clock speeds.
>
Looks good to me.
Reviewed-by: Shawn Lin <shawn.lin@rock-chips.com>
> Signed-off-by: Douglas Anderson <dianders@chromium.org>
> ---
> Changes in v2:
> - Indicate that 5.1 ms is calculated (Shawn).
>
> drivers/phy/phy-rockchip-emmc.c | 28 ++++++++++++++++++++--------
> 1 file changed, 20 insertions(+), 8 deletions(-)
>
> diff --git a/drivers/phy/phy-rockchip-emmc.c b/drivers/phy/phy-rockchip-emmc.c
> index a69f53630e67..2d059c046978 100644
> --- a/drivers/phy/phy-rockchip-emmc.c
> +++ b/drivers/phy/phy-rockchip-emmc.c
> @@ -85,6 +85,7 @@ static int rockchip_emmc_phy_power(struct rockchip_emmc_phy *rk_phy,
> {
> unsigned int caldone;
> unsigned int dllrdy;
> + unsigned long timeout;
>
> /*
> * Keep phyctrl_pdb and phyctrl_endll low to allow
> @@ -137,15 +138,26 @@ static int rockchip_emmc_phy_power(struct rockchip_emmc_phy *rk_phy,
> PHYCTRL_ENDLL_MASK,
> PHYCTRL_ENDLL_SHIFT));
> /*
> - * After enable analog DLL circuits, we need an extra 10.2us
> - * for dll to be ready for work. But according to testing, we
> - * find some chips need more than 25us.
> + * After enabling analog DLL circuits docs say that we need 10.2 us if
> + * our source clock is at 50 MHz and that lock time scales linearly
> + * with clock speed. If we are powering on the PHY and the card clock
> + * is super slow (like 100 kHZ) this could take as long as 5.1 ms as
> + * per the math: 10.2 us * (50000000 Hz / 100000 Hz) => 5.1 ms
> + * Hopefully we won't be running at 100 kHz, but we should still make
> + * sure we wait long enough.
> */
> - udelay(30);
> - regmap_read(rk_phy->reg_base,
> - rk_phy->reg_offset + GRF_EMMCPHY_STATUS,
> - &dllrdy);
> - dllrdy = (dllrdy >> PHYCTRL_DLLRDY_SHIFT) & PHYCTRL_DLLRDY_MASK;
> + timeout = jiffies + msecs_to_jiffies(10);
> + do {
> + udelay(1);
> +
> + regmap_read(rk_phy->reg_base,
> + rk_phy->reg_offset + GRF_EMMCPHY_STATUS,
> + &dllrdy);
> + dllrdy = (dllrdy >> PHYCTRL_DLLRDY_SHIFT) & PHYCTRL_DLLRDY_MASK;
> + if (dllrdy == PHYCTRL_DLLRDY_DONE)
> + break;
> + } while (!time_after(jiffies, timeout));
> +
> if (dllrdy != PHYCTRL_DLLRDY_DONE) {
> pr_err("rockchip_emmc_phy_power: dllrdy timeout.\n");
> return -ETIMEDOUT;
>
--
Best Regards
Shawn Lin
^ permalink raw reply [flat|nested] 78+ messages in thread
[parent not found: <1465859076-4868-2-git-send-email-dianders-F7+t8E8rja9g9hUCZPvPmw@public.gmane.org>]
* Re: [PATCH v2 01/11] phy: rockchip-emmc: Increase lock time allowance
2016-06-13 23:04 ` Douglas Anderson
(?)
@ 2016-06-20 13:03 ` Kishon Vijay Abraham I
-1 siblings, 0 replies; 78+ messages in thread
From: Kishon Vijay Abraham I @ 2016-06-20 13:03 UTC (permalink / raw)
To: Douglas Anderson, ulf.hansson-QSEj5FYQhm4dnm+yROfE0A,
Heiko Stuebner, robh+dt-DgEjT+Ai2ygdnm+yROfE0A
Cc: devicetree-u79uwXL29TY76Z2rM5mHXA, xzy.xu-TNX95d0MmH7DzftRWevZcw,
shawn.lin-TNX95d0MmH7DzftRWevZcw,
briannorris-F7+t8E8rja9g9hUCZPvPmw,
linux-mmc-u79uwXL29TY76Z2rM5mHXA,
adrian.hunter-ral2JQCrhuEAvxtiuMwx3w,
linux-kernel-u79uwXL29TY76Z2rM5mHXA,
linux-rockchip-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r,
linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r
On Tuesday 14 June 2016 04:34 AM, Douglas Anderson wrote:
> Previous PHY code waited a fixed amount of time for the DLL to lock at
> power on time. Unfortunately, the time for the DLL to lock is actually
> a bit more dynamic and can be longer if the card clock is slower.
>
> Instead of waiting a fixed 30 us, let's now dynamically wait until the
> lock bit gets set. We'll wait up to 10 ms which should be OK even if
> the card clock is at the super slow 100 kHz.
>
> On its own, this change makes the PHY power on code a little more
> robust. Before this change the PHY was relying on the eMMC code to make
> sure the PHY was only powered on when the card clock was set to at least
> 50 MHz before, though this reliance wasn't documented anywhere.
>
> This change will be even more useful in future changes where we actually
> need to be able to wait for a DLL lock at slower clock speeds.
>
> Signed-off-by: Douglas Anderson <dianders-F7+t8E8rja9g9hUCZPvPmw@public.gmane.org>
Acked-by: Kishon Vijay Abraham I <kishon-l0cyMroinI0@public.gmane.org>
> ---
> Changes in v2:
> - Indicate that 5.1 ms is calculated (Shawn).
>
> drivers/phy/phy-rockchip-emmc.c | 28 ++++++++++++++++++++--------
> 1 file changed, 20 insertions(+), 8 deletions(-)
>
> diff --git a/drivers/phy/phy-rockchip-emmc.c b/drivers/phy/phy-rockchip-emmc.c
> index a69f53630e67..2d059c046978 100644
> --- a/drivers/phy/phy-rockchip-emmc.c
> +++ b/drivers/phy/phy-rockchip-emmc.c
> @@ -85,6 +85,7 @@ static int rockchip_emmc_phy_power(struct rockchip_emmc_phy *rk_phy,
> {
> unsigned int caldone;
> unsigned int dllrdy;
> + unsigned long timeout;
>
> /*
> * Keep phyctrl_pdb and phyctrl_endll low to allow
> @@ -137,15 +138,26 @@ static int rockchip_emmc_phy_power(struct rockchip_emmc_phy *rk_phy,
> PHYCTRL_ENDLL_MASK,
> PHYCTRL_ENDLL_SHIFT));
> /*
> - * After enable analog DLL circuits, we need an extra 10.2us
> - * for dll to be ready for work. But according to testing, we
> - * find some chips need more than 25us.
> + * After enabling analog DLL circuits docs say that we need 10.2 us if
> + * our source clock is at 50 MHz and that lock time scales linearly
> + * with clock speed. If we are powering on the PHY and the card clock
> + * is super slow (like 100 kHZ) this could take as long as 5.1 ms as
> + * per the math: 10.2 us * (50000000 Hz / 100000 Hz) => 5.1 ms
> + * Hopefully we won't be running at 100 kHz, but we should still make
> + * sure we wait long enough.
> */
> - udelay(30);
> - regmap_read(rk_phy->reg_base,
> - rk_phy->reg_offset + GRF_EMMCPHY_STATUS,
> - &dllrdy);
> - dllrdy = (dllrdy >> PHYCTRL_DLLRDY_SHIFT) & PHYCTRL_DLLRDY_MASK;
> + timeout = jiffies + msecs_to_jiffies(10);
> + do {
> + udelay(1);
> +
> + regmap_read(rk_phy->reg_base,
> + rk_phy->reg_offset + GRF_EMMCPHY_STATUS,
> + &dllrdy);
> + dllrdy = (dllrdy >> PHYCTRL_DLLRDY_SHIFT) & PHYCTRL_DLLRDY_MASK;
> + if (dllrdy == PHYCTRL_DLLRDY_DONE)
> + break;
> + } while (!time_after(jiffies, timeout));
> +
> if (dllrdy != PHYCTRL_DLLRDY_DONE) {
> pr_err("rockchip_emmc_phy_power: dllrdy timeout.\n");
> return -ETIMEDOUT;
>
^ permalink raw reply [flat|nested] 78+ messages in thread* Re: [PATCH v2 01/11] phy: rockchip-emmc: Increase lock time allowance
@ 2016-06-20 13:03 ` Kishon Vijay Abraham I
0 siblings, 0 replies; 78+ messages in thread
From: Kishon Vijay Abraham I @ 2016-06-20 13:03 UTC (permalink / raw)
To: Douglas Anderson, ulf.hansson, Heiko Stuebner, robh+dt
Cc: shawn.lin, xzy.xu, briannorris, adrian.hunter, linux-rockchip,
linux-mmc, devicetree, linux-kernel, linux-arm-kernel
On Tuesday 14 June 2016 04:34 AM, Douglas Anderson wrote:
> Previous PHY code waited a fixed amount of time for the DLL to lock at
> power on time. Unfortunately, the time for the DLL to lock is actually
> a bit more dynamic and can be longer if the card clock is slower.
>
> Instead of waiting a fixed 30 us, let's now dynamically wait until the
> lock bit gets set. We'll wait up to 10 ms which should be OK even if
> the card clock is at the super slow 100 kHz.
>
> On its own, this change makes the PHY power on code a little more
> robust. Before this change the PHY was relying on the eMMC code to make
> sure the PHY was only powered on when the card clock was set to at least
> 50 MHz before, though this reliance wasn't documented anywhere.
>
> This change will be even more useful in future changes where we actually
> need to be able to wait for a DLL lock at slower clock speeds.
>
> Signed-off-by: Douglas Anderson <dianders@chromium.org>
Acked-by: Kishon Vijay Abraham I <kishon@ti.com>
> ---
> Changes in v2:
> - Indicate that 5.1 ms is calculated (Shawn).
>
> drivers/phy/phy-rockchip-emmc.c | 28 ++++++++++++++++++++--------
> 1 file changed, 20 insertions(+), 8 deletions(-)
>
> diff --git a/drivers/phy/phy-rockchip-emmc.c b/drivers/phy/phy-rockchip-emmc.c
> index a69f53630e67..2d059c046978 100644
> --- a/drivers/phy/phy-rockchip-emmc.c
> +++ b/drivers/phy/phy-rockchip-emmc.c
> @@ -85,6 +85,7 @@ static int rockchip_emmc_phy_power(struct rockchip_emmc_phy *rk_phy,
> {
> unsigned int caldone;
> unsigned int dllrdy;
> + unsigned long timeout;
>
> /*
> * Keep phyctrl_pdb and phyctrl_endll low to allow
> @@ -137,15 +138,26 @@ static int rockchip_emmc_phy_power(struct rockchip_emmc_phy *rk_phy,
> PHYCTRL_ENDLL_MASK,
> PHYCTRL_ENDLL_SHIFT));
> /*
> - * After enable analog DLL circuits, we need an extra 10.2us
> - * for dll to be ready for work. But according to testing, we
> - * find some chips need more than 25us.
> + * After enabling analog DLL circuits docs say that we need 10.2 us if
> + * our source clock is at 50 MHz and that lock time scales linearly
> + * with clock speed. If we are powering on the PHY and the card clock
> + * is super slow (like 100 kHZ) this could take as long as 5.1 ms as
> + * per the math: 10.2 us * (50000000 Hz / 100000 Hz) => 5.1 ms
> + * Hopefully we won't be running at 100 kHz, but we should still make
> + * sure we wait long enough.
> */
> - udelay(30);
> - regmap_read(rk_phy->reg_base,
> - rk_phy->reg_offset + GRF_EMMCPHY_STATUS,
> - &dllrdy);
> - dllrdy = (dllrdy >> PHYCTRL_DLLRDY_SHIFT) & PHYCTRL_DLLRDY_MASK;
> + timeout = jiffies + msecs_to_jiffies(10);
> + do {
> + udelay(1);
> +
> + regmap_read(rk_phy->reg_base,
> + rk_phy->reg_offset + GRF_EMMCPHY_STATUS,
> + &dllrdy);
> + dllrdy = (dllrdy >> PHYCTRL_DLLRDY_SHIFT) & PHYCTRL_DLLRDY_MASK;
> + if (dllrdy == PHYCTRL_DLLRDY_DONE)
> + break;
> + } while (!time_after(jiffies, timeout));
> +
> if (dllrdy != PHYCTRL_DLLRDY_DONE) {
> pr_err("rockchip_emmc_phy_power: dllrdy timeout.\n");
> return -ETIMEDOUT;
>
^ permalink raw reply [flat|nested] 78+ messages in thread* [PATCH v2 01/11] phy: rockchip-emmc: Increase lock time allowance
@ 2016-06-20 13:03 ` Kishon Vijay Abraham I
0 siblings, 0 replies; 78+ messages in thread
From: Kishon Vijay Abraham I @ 2016-06-20 13:03 UTC (permalink / raw)
To: linux-arm-kernel
On Tuesday 14 June 2016 04:34 AM, Douglas Anderson wrote:
> Previous PHY code waited a fixed amount of time for the DLL to lock at
> power on time. Unfortunately, the time for the DLL to lock is actually
> a bit more dynamic and can be longer if the card clock is slower.
>
> Instead of waiting a fixed 30 us, let's now dynamically wait until the
> lock bit gets set. We'll wait up to 10 ms which should be OK even if
> the card clock is at the super slow 100 kHz.
>
> On its own, this change makes the PHY power on code a little more
> robust. Before this change the PHY was relying on the eMMC code to make
> sure the PHY was only powered on when the card clock was set to at least
> 50 MHz before, though this reliance wasn't documented anywhere.
>
> This change will be even more useful in future changes where we actually
> need to be able to wait for a DLL lock at slower clock speeds.
>
> Signed-off-by: Douglas Anderson <dianders@chromium.org>
Acked-by: Kishon Vijay Abraham I <kishon@ti.com>
> ---
> Changes in v2:
> - Indicate that 5.1 ms is calculated (Shawn).
>
> drivers/phy/phy-rockchip-emmc.c | 28 ++++++++++++++++++++--------
> 1 file changed, 20 insertions(+), 8 deletions(-)
>
> diff --git a/drivers/phy/phy-rockchip-emmc.c b/drivers/phy/phy-rockchip-emmc.c
> index a69f53630e67..2d059c046978 100644
> --- a/drivers/phy/phy-rockchip-emmc.c
> +++ b/drivers/phy/phy-rockchip-emmc.c
> @@ -85,6 +85,7 @@ static int rockchip_emmc_phy_power(struct rockchip_emmc_phy *rk_phy,
> {
> unsigned int caldone;
> unsigned int dllrdy;
> + unsigned long timeout;
>
> /*
> * Keep phyctrl_pdb and phyctrl_endll low to allow
> @@ -137,15 +138,26 @@ static int rockchip_emmc_phy_power(struct rockchip_emmc_phy *rk_phy,
> PHYCTRL_ENDLL_MASK,
> PHYCTRL_ENDLL_SHIFT));
> /*
> - * After enable analog DLL circuits, we need an extra 10.2us
> - * for dll to be ready for work. But according to testing, we
> - * find some chips need more than 25us.
> + * After enabling analog DLL circuits docs say that we need 10.2 us if
> + * our source clock is at 50 MHz and that lock time scales linearly
> + * with clock speed. If we are powering on the PHY and the card clock
> + * is super slow (like 100 kHZ) this could take as long as 5.1 ms as
> + * per the math: 10.2 us * (50000000 Hz / 100000 Hz) => 5.1 ms
> + * Hopefully we won't be running at 100 kHz, but we should still make
> + * sure we wait long enough.
> */
> - udelay(30);
> - regmap_read(rk_phy->reg_base,
> - rk_phy->reg_offset + GRF_EMMCPHY_STATUS,
> - &dllrdy);
> - dllrdy = (dllrdy >> PHYCTRL_DLLRDY_SHIFT) & PHYCTRL_DLLRDY_MASK;
> + timeout = jiffies + msecs_to_jiffies(10);
> + do {
> + udelay(1);
> +
> + regmap_read(rk_phy->reg_base,
> + rk_phy->reg_offset + GRF_EMMCPHY_STATUS,
> + &dllrdy);
> + dllrdy = (dllrdy >> PHYCTRL_DLLRDY_SHIFT) & PHYCTRL_DLLRDY_MASK;
> + if (dllrdy == PHYCTRL_DLLRDY_DONE)
> + break;
> + } while (!time_after(jiffies, timeout));
> +
> if (dllrdy != PHYCTRL_DLLRDY_DONE) {
> pr_err("rockchip_emmc_phy_power: dllrdy timeout.\n");
> return -ETIMEDOUT;
>
^ permalink raw reply [flat|nested] 78+ messages in thread
* [PATCH v2 03/11] Documentation: mmc: sdhci-of-arasan: Add soc-ctl-syscon for corecfg regs
2016-06-13 23:04 ` Douglas Anderson
@ 2016-06-13 23:04 ` Douglas Anderson
-1 siblings, 0 replies; 78+ messages in thread
From: Douglas Anderson @ 2016-06-13 23:04 UTC (permalink / raw)
To: ulf.hansson-QSEj5FYQhm4dnm+yROfE0A, kishon-l0cyMroinI0,
Heiko Stuebner, robh+dt-DgEjT+Ai2ygdnm+yROfE0A
Cc: mark.rutland-5wv7dgnIgG8, devicetree-u79uwXL29TY76Z2rM5mHXA,
xzy.xu-TNX95d0MmH7DzftRWevZcw, pawel.moll-5wv7dgnIgG8,
ijc+devicetree-KcIKpvwj1kUDXYZnReoRVg,
linux-kernel-u79uwXL29TY76Z2rM5mHXA,
shawn.lin-TNX95d0MmH7DzftRWevZcw,
briannorris-F7+t8E8rja9g9hUCZPvPmw,
linux-mmc-u79uwXL29TY76Z2rM5mHXA,
adrian.hunter-ral2JQCrhuEAvxtiuMwx3w, Douglas Anderson,
linux-rockchip-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r,
galak-sgV2jX0FEOL9JmXXK+q4OQ
As can be seen in Arasan's datasheet [1] there are several "corecfg"
settings in their SDHCI IP Block that are supposed to be controlled by
software. Although the datasheet referenced is a bit vague about how to
access corecfg, in Figure 5 you can see that for Arasan's PHY (a
separate component than their SDHCI component) they describe the
"phyctrl" registers as being "FROM SOC CTL REG", implying that it's up
to the licensee of the Arasan IP block to implement these registers. It
seems sane to assume that the "corecfg" registers in their SDHCI IP
block works in a similar way for all licensees of the IP Block.
Device tree has a model that allows a device to get a reference to
random registers located elsewhere in the SoC: sysctl. Let's leverage
this model and allow adding a sysctl reference to access the control
registers for the Arasan SDHCI PHYs.
Having a reference to the control registers doesn't do much for us on
its own since the Arasan spec doesn't specify how these corecfg values
are laid out in memory. In the SDHCI driver we'll need a map detailing
where each corecfg can be found in each implementation. This map can be
found using the primary compatible string of the SDHCI device. In that
spirit, document that existing rk3399 device trees already have a
specific compatible string, though up to now they've always been relying
on the driver supporting the generic.
Note that since existing devices seem to work fairly well as-is, we'll
list the syscon reference as "optional", but it's likely that we'll run
into much fewer problems if we can actually set the proper values in the
syscon, so it is strongly suggested that any SoCs where we have a map to
set the corecfg also include a reference to the syscon.
[1]: https://arasan.com/wp-content/media/eMMC-5-1-Total-Solution_Rev-1-3.pdf
Signed-off-by: Douglas Anderson <dianders-F7+t8E8rja9g9hUCZPvPmw@public.gmane.org>
Acked-by: Rob Herring <robh-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>
---
Changes in v2:
- Clean up description of rk3399 PHY (Shawn)
- Add Rob Herring's Ack.
.../devicetree/bindings/mmc/arasan,sdhci.txt | 27 ++++++++++++++++++++--
1 file changed, 25 insertions(+), 2 deletions(-)
diff --git a/Documentation/devicetree/bindings/mmc/arasan,sdhci.txt b/Documentation/devicetree/bindings/mmc/arasan,sdhci.txt
index 31b35c3a5e47..476604e6ce2a 100644
--- a/Documentation/devicetree/bindings/mmc/arasan,sdhci.txt
+++ b/Documentation/devicetree/bindings/mmc/arasan,sdhci.txt
@@ -9,8 +9,12 @@ Device Tree Bindings for the Arasan SDHCI Controller
[4] Documentation/devicetree/bindings/phy/phy-bindings.txt
Required Properties:
- - compatible: Compatibility string. Must be 'arasan,sdhci-8.9a' or
- 'arasan,sdhci-4.9a' or 'arasan,sdhci-5.1'
+ - compatible: Compatibility string. One of:
+ - "arasan,sdhci-8.9a": generic Arasan SDHCI 8.9a PHY
+ - "arasan,sdhci-4.9a": generic Arasan SDHCI 4.9a PHY
+ - "arasan,sdhci-5.1": generic Arasan SDHCI 5.1 PHY
+ - "rockchip,rk3399-sdhci-5.1", "arasan,sdhci-5.1": rk3399 eMMC PHY
+ For this device it is strongly suggested to include arasan,soc-ctl-syscon.
- reg: From mmc bindings: Register location and length.
- clocks: From clock bindings: Handles to clock inputs.
- clock-names: From clock bindings: Tuple including "clk_xin" and "clk_ahb"
@@ -22,6 +26,11 @@ Required Properties for "arasan,sdhci-5.1":
- phys: From PHY bindings: Phandle for the Generic PHY for arasan.
- phy-names: MUST be "phy_arasan".
+Optional Properties:
+ - arasan,soc-ctl-syscon: A phandle to a syscon device (see ../mfd/syscon.txt)
+ used to access core corecfg registers. Offsets of registers in this
+ syscon are determined based on the main compatible string for the device.
+
Example:
sdhci@e0100000 {
compatible = "arasan,sdhci-8.9a";
@@ -42,3 +51,17 @@ Example:
phys = <&emmc_phy>;
phy-names = "phy_arasan";
} ;
+
+ sdhci: sdhci@fe330000 {
+ compatible = "rockchip,rk3399-sdhci-5.1", "arasan,sdhci-5.1";
+ reg = <0x0 0xfe330000 0x0 0x10000>;
+ interrupts = <GIC_SPI 11 IRQ_TYPE_LEVEL_HIGH>;
+ clocks = <&cru SCLK_EMMC>, <&cru ACLK_EMMC>;
+ clock-names = "clk_xin", "clk_ahb";
+ arasan,soc-ctl-syscon = <&grf>;
+ assigned-clocks = <&cru SCLK_EMMC>;
+ assigned-clock-rates = <200000000>;
+ phys = <&emmc_phy>;
+ phy-names = "phy_arasan";
+ status = "disabled";
+ };
--
2.8.0.rc3.226.g39d4020
^ permalink raw reply related [flat|nested] 78+ messages in thread* [PATCH v2 03/11] Documentation: mmc: sdhci-of-arasan: Add soc-ctl-syscon for corecfg regs
@ 2016-06-13 23:04 ` Douglas Anderson
0 siblings, 0 replies; 78+ messages in thread
From: Douglas Anderson @ 2016-06-13 23:04 UTC (permalink / raw)
To: ulf.hansson, kishon, Heiko Stuebner, robh+dt
Cc: shawn.lin, xzy.xu, briannorris, adrian.hunter, linux-rockchip,
linux-mmc, devicetree, Douglas Anderson, pawel.moll, mark.rutland,
ijc+devicetree, galak, linux-kernel
As can be seen in Arasan's datasheet [1] there are several "corecfg"
settings in their SDHCI IP Block that are supposed to be controlled by
software. Although the datasheet referenced is a bit vague about how to
access corecfg, in Figure 5 you can see that for Arasan's PHY (a
separate component than their SDHCI component) they describe the
"phyctrl" registers as being "FROM SOC CTL REG", implying that it's up
to the licensee of the Arasan IP block to implement these registers. It
seems sane to assume that the "corecfg" registers in their SDHCI IP
block works in a similar way for all licensees of the IP Block.
Device tree has a model that allows a device to get a reference to
random registers located elsewhere in the SoC: sysctl. Let's leverage
this model and allow adding a sysctl reference to access the control
registers for the Arasan SDHCI PHYs.
Having a reference to the control registers doesn't do much for us on
its own since the Arasan spec doesn't specify how these corecfg values
are laid out in memory. In the SDHCI driver we'll need a map detailing
where each corecfg can be found in each implementation. This map can be
found using the primary compatible string of the SDHCI device. In that
spirit, document that existing rk3399 device trees already have a
specific compatible string, though up to now they've always been relying
on the driver supporting the generic.
Note that since existing devices seem to work fairly well as-is, we'll
list the syscon reference as "optional", but it's likely that we'll run
into much fewer problems if we can actually set the proper values in the
syscon, so it is strongly suggested that any SoCs where we have a map to
set the corecfg also include a reference to the syscon.
[1]: https://arasan.com/wp-content/media/eMMC-5-1-Total-Solution_Rev-1-3.pdf
Signed-off-by: Douglas Anderson <dianders@chromium.org>
Acked-by: Rob Herring <robh@kernel.org>
---
Changes in v2:
- Clean up description of rk3399 PHY (Shawn)
- Add Rob Herring's Ack.
.../devicetree/bindings/mmc/arasan,sdhci.txt | 27 ++++++++++++++++++++--
1 file changed, 25 insertions(+), 2 deletions(-)
diff --git a/Documentation/devicetree/bindings/mmc/arasan,sdhci.txt b/Documentation/devicetree/bindings/mmc/arasan,sdhci.txt
index 31b35c3a5e47..476604e6ce2a 100644
--- a/Documentation/devicetree/bindings/mmc/arasan,sdhci.txt
+++ b/Documentation/devicetree/bindings/mmc/arasan,sdhci.txt
@@ -9,8 +9,12 @@ Device Tree Bindings for the Arasan SDHCI Controller
[4] Documentation/devicetree/bindings/phy/phy-bindings.txt
Required Properties:
- - compatible: Compatibility string. Must be 'arasan,sdhci-8.9a' or
- 'arasan,sdhci-4.9a' or 'arasan,sdhci-5.1'
+ - compatible: Compatibility string. One of:
+ - "arasan,sdhci-8.9a": generic Arasan SDHCI 8.9a PHY
+ - "arasan,sdhci-4.9a": generic Arasan SDHCI 4.9a PHY
+ - "arasan,sdhci-5.1": generic Arasan SDHCI 5.1 PHY
+ - "rockchip,rk3399-sdhci-5.1", "arasan,sdhci-5.1": rk3399 eMMC PHY
+ For this device it is strongly suggested to include arasan,soc-ctl-syscon.
- reg: From mmc bindings: Register location and length.
- clocks: From clock bindings: Handles to clock inputs.
- clock-names: From clock bindings: Tuple including "clk_xin" and "clk_ahb"
@@ -22,6 +26,11 @@ Required Properties for "arasan,sdhci-5.1":
- phys: From PHY bindings: Phandle for the Generic PHY for arasan.
- phy-names: MUST be "phy_arasan".
+Optional Properties:
+ - arasan,soc-ctl-syscon: A phandle to a syscon device (see ../mfd/syscon.txt)
+ used to access core corecfg registers. Offsets of registers in this
+ syscon are determined based on the main compatible string for the device.
+
Example:
sdhci@e0100000 {
compatible = "arasan,sdhci-8.9a";
@@ -42,3 +51,17 @@ Example:
phys = <&emmc_phy>;
phy-names = "phy_arasan";
} ;
+
+ sdhci: sdhci@fe330000 {
+ compatible = "rockchip,rk3399-sdhci-5.1", "arasan,sdhci-5.1";
+ reg = <0x0 0xfe330000 0x0 0x10000>;
+ interrupts = <GIC_SPI 11 IRQ_TYPE_LEVEL_HIGH>;
+ clocks = <&cru SCLK_EMMC>, <&cru ACLK_EMMC>;
+ clock-names = "clk_xin", "clk_ahb";
+ arasan,soc-ctl-syscon = <&grf>;
+ assigned-clocks = <&cru SCLK_EMMC>;
+ assigned-clock-rates = <200000000>;
+ phys = <&emmc_phy>;
+ phy-names = "phy_arasan";
+ status = "disabled";
+ };
--
2.8.0.rc3.226.g39d4020
^ permalink raw reply related [flat|nested] 78+ messages in thread* Re: [PATCH v2 03/11] Documentation: mmc: sdhci-of-arasan: Add soc-ctl-syscon for corecfg regs
2016-06-13 23:04 ` Douglas Anderson
(?)
@ 2016-06-14 0:33 ` Shawn Lin
-1 siblings, 0 replies; 78+ messages in thread
From: Shawn Lin @ 2016-06-14 0:33 UTC (permalink / raw)
To: Douglas Anderson, ulf.hansson, kishon, Heiko Stuebner, robh+dt
Cc: shawn.lin, xzy.xu, briannorris, adrian.hunter, linux-rockchip,
linux-mmc, devicetree, pawel.moll, mark.rutland, ijc+devicetree,
galak, linux-kernel
在 2016/6/14 7:04, Douglas Anderson 写道:
> As can be seen in Arasan's datasheet [1] there are several "corecfg"
> settings in their SDHCI IP Block that are supposed to be controlled by
> software. Although the datasheet referenced is a bit vague about how to
> access corecfg, in Figure 5 you can see that for Arasan's PHY (a
> separate component than their SDHCI component) they describe the
> "phyctrl" registers as being "FROM SOC CTL REG", implying that it's up
> to the licensee of the Arasan IP block to implement these registers. It
> seems sane to assume that the "corecfg" registers in their SDHCI IP
> block works in a similar way for all licensees of the IP Block.
>
> Device tree has a model that allows a device to get a reference to
> random registers located elsewhere in the SoC: sysctl. Let's leverage
> this model and allow adding a sysctl reference to access the control
> registers for the Arasan SDHCI PHYs.
>
> Having a reference to the control registers doesn't do much for us on
> its own since the Arasan spec doesn't specify how these corecfg values
> are laid out in memory. In the SDHCI driver we'll need a map detailing
> where each corecfg can be found in each implementation. This map can be
> found using the primary compatible string of the SDHCI device. In that
> spirit, document that existing rk3399 device trees already have a
> specific compatible string, though up to now they've always been relying
> on the driver supporting the generic.
>
> Note that since existing devices seem to work fairly well as-is, we'll
> list the syscon reference as "optional", but it's likely that we'll run
> into much fewer problems if we can actually set the proper values in the
> syscon, so it is strongly suggested that any SoCs where we have a map to
> set the corecfg also include a reference to the syscon.
>
> [1]: https://arasan.com/wp-content/media/eMMC-5-1-Total-Solution_Rev-1-3.pdf
Looks good.
Reviewed-by: Shawn Lin <shawn.lin@rock-chips.com>
>
> Signed-off-by: Douglas Anderson <dianders@chromium.org>
> Acked-by: Rob Herring <robh@kernel.org>
> ---
> Changes in v2:
> - Clean up description of rk3399 PHY (Shawn)
> - Add Rob Herring's Ack.
>
> .../devicetree/bindings/mmc/arasan,sdhci.txt | 27 ++++++++++++++++++++--
> 1 file changed, 25 insertions(+), 2 deletions(-)
>
> diff --git a/Documentation/devicetree/bindings/mmc/arasan,sdhci.txt b/Documentation/devicetree/bindings/mmc/arasan,sdhci.txt
> index 31b35c3a5e47..476604e6ce2a 100644
> --- a/Documentation/devicetree/bindings/mmc/arasan,sdhci.txt
> +++ b/Documentation/devicetree/bindings/mmc/arasan,sdhci.txt
> @@ -9,8 +9,12 @@ Device Tree Bindings for the Arasan SDHCI Controller
> [4] Documentation/devicetree/bindings/phy/phy-bindings.txt
>
> Required Properties:
> - - compatible: Compatibility string. Must be 'arasan,sdhci-8.9a' or
> - 'arasan,sdhci-4.9a' or 'arasan,sdhci-5.1'
> + - compatible: Compatibility string. One of:
> + - "arasan,sdhci-8.9a": generic Arasan SDHCI 8.9a PHY
> + - "arasan,sdhci-4.9a": generic Arasan SDHCI 4.9a PHY
> + - "arasan,sdhci-5.1": generic Arasan SDHCI 5.1 PHY
> + - "rockchip,rk3399-sdhci-5.1", "arasan,sdhci-5.1": rk3399 eMMC PHY
> + For this device it is strongly suggested to include arasan,soc-ctl-syscon.
> - reg: From mmc bindings: Register location and length.
> - clocks: From clock bindings: Handles to clock inputs.
> - clock-names: From clock bindings: Tuple including "clk_xin" and "clk_ahb"
> @@ -22,6 +26,11 @@ Required Properties for "arasan,sdhci-5.1":
> - phys: From PHY bindings: Phandle for the Generic PHY for arasan.
> - phy-names: MUST be "phy_arasan".
>
> +Optional Properties:
> + - arasan,soc-ctl-syscon: A phandle to a syscon device (see ../mfd/syscon.txt)
> + used to access core corecfg registers. Offsets of registers in this
> + syscon are determined based on the main compatible string for the device.
> +
> Example:
> sdhci@e0100000 {
> compatible = "arasan,sdhci-8.9a";
> @@ -42,3 +51,17 @@ Example:
> phys = <&emmc_phy>;
> phy-names = "phy_arasan";
> } ;
> +
> + sdhci: sdhci@fe330000 {
> + compatible = "rockchip,rk3399-sdhci-5.1", "arasan,sdhci-5.1";
> + reg = <0x0 0xfe330000 0x0 0x10000>;
> + interrupts = <GIC_SPI 11 IRQ_TYPE_LEVEL_HIGH>;
> + clocks = <&cru SCLK_EMMC>, <&cru ACLK_EMMC>;
> + clock-names = "clk_xin", "clk_ahb";
> + arasan,soc-ctl-syscon = <&grf>;
> + assigned-clocks = <&cru SCLK_EMMC>;
> + assigned-clock-rates = <200000000>;
> + phys = <&emmc_phy>;
> + phy-names = "phy_arasan";
> + status = "disabled";
> + };
>
--
Best Regards
Shawn Lin
^ permalink raw reply [flat|nested] 78+ messages in thread* Re: [PATCH v2 03/11] Documentation: mmc: sdhci-of-arasan: Add soc-ctl-syscon for corecfg regs
2016-06-13 23:04 ` Douglas Anderson
(?)
(?)
@ 2016-06-18 14:15 ` Heiko Stübner
-1 siblings, 0 replies; 78+ messages in thread
From: Heiko Stübner @ 2016-06-18 14:15 UTC (permalink / raw)
To: Douglas Anderson
Cc: ulf.hansson, kishon, robh+dt, shawn.lin, xzy.xu, briannorris,
adrian.hunter, linux-rockchip, linux-mmc, devicetree, pawel.moll,
mark.rutland, ijc+devicetree, galak, linux-kernel
Am Montag, 13. Juni 2016, 16:04:27 schrieb Douglas Anderson:
> As can be seen in Arasan's datasheet [1] there are several "corecfg"
> settings in their SDHCI IP Block that are supposed to be controlled by
> software. Although the datasheet referenced is a bit vague about how to
> access corecfg, in Figure 5 you can see that for Arasan's PHY (a
> separate component than their SDHCI component) they describe the
> "phyctrl" registers as being "FROM SOC CTL REG", implying that it's up
> to the licensee of the Arasan IP block to implement these registers. It
> seems sane to assume that the "corecfg" registers in their SDHCI IP
> block works in a similar way for all licensees of the IP Block.
>
> Device tree has a model that allows a device to get a reference to
> random registers located elsewhere in the SoC: sysctl. Let's leverage
> this model and allow adding a sysctl reference to access the control
> registers for the Arasan SDHCI PHYs.
>
> Having a reference to the control registers doesn't do much for us on
> its own since the Arasan spec doesn't specify how these corecfg values
> are laid out in memory. In the SDHCI driver we'll need a map detailing
> where each corecfg can be found in each implementation. This map can be
> found using the primary compatible string of the SDHCI device. In that
> spirit, document that existing rk3399 device trees already have a
> specific compatible string, though up to now they've always been relying
> on the driver supporting the generic.
>
> Note that since existing devices seem to work fairly well as-is, we'll
> list the syscon reference as "optional", but it's likely that we'll run
> into much fewer problems if we can actually set the proper values in the
> syscon, so it is strongly suggested that any SoCs where we have a map to
> set the corecfg also include a reference to the syscon.
>
> [1]: https://arasan.com/wp-content/media/eMMC-5-1-Total-Solution_Rev-1-3.pdf
>
> Signed-off-by: Douglas Anderson <dianders@chromium.org>
> Acked-by: Rob Herring <robh@kernel.org>
I was trying to find public datasheets of other arasan-5.1 users, but wasn't
sucessful. But I guess this solution should be versatile enough to support the
implementation on other socs anyway, so
Reviewed-by: Heiko Stuebner <heiko@sntech.de>
^ permalink raw reply [flat|nested] 78+ messages in thread
* [PATCH v2 05/11] arm64: dts: rockchip: Add soc-ctl-syscon to sdhci for rk3399
2016-06-13 23:04 ` Douglas Anderson
(?)
@ 2016-06-13 23:04 ` Douglas Anderson
-1 siblings, 0 replies; 78+ messages in thread
From: Douglas Anderson @ 2016-06-13 23:04 UTC (permalink / raw)
To: ulf.hansson-QSEj5FYQhm4dnm+yROfE0A, kishon-l0cyMroinI0,
Heiko Stuebner, robh+dt-DgEjT+Ai2ygdnm+yROfE0A
Cc: mark.rutland-5wv7dgnIgG8, devicetree-u79uwXL29TY76Z2rM5mHXA,
xzy.xu-TNX95d0MmH7DzftRWevZcw,
linux-kernel-u79uwXL29TY76Z2rM5mHXA,
zhengxing-TNX95d0MmH7DzftRWevZcw, pawel.moll-5wv7dgnIgG8,
ijc+devicetree-KcIKpvwj1kUDXYZnReoRVg,
catalin.marinas-5wv7dgnIgG8, shawn.lin-TNX95d0MmH7DzftRWevZcw,
briannorris-F7+t8E8rja9g9hUCZPvPmw,
linux-mmc-u79uwXL29TY76Z2rM5mHXA,
adrian.hunter-ral2JQCrhuEAvxtiuMwx3w, will.deacon-5wv7dgnIgG8,
Douglas Anderson, linux-rockchip-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r,
galak-sgV2jX0FEOL9JmXXK+q4OQ, jay.xu-TNX95d0MmH7DzftRWevZcw,
linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r,
wxt-TNX95d0MmH7DzftRWevZcw
On rk3399 we'd like to be able to properly set corecfg registers in the
Arasan SDHCI component. Specify the syscon to enable that.
Signed-off-by: Douglas Anderson <dianders-F7+t8E8rja9g9hUCZPvPmw@public.gmane.org>
---
Changes in v2: None
arch/arm64/boot/dts/rockchip/rk3399.dtsi | 1 +
1 file changed, 1 insertion(+)
diff --git a/arch/arm64/boot/dts/rockchip/rk3399.dtsi b/arch/arm64/boot/dts/rockchip/rk3399.dtsi
index a4383f359264..1b57e92e0093 100644
--- a/arch/arm64/boot/dts/rockchip/rk3399.dtsi
+++ b/arch/arm64/boot/dts/rockchip/rk3399.dtsi
@@ -220,6 +220,7 @@
compatible = "rockchip,rk3399-sdhci-5.1", "arasan,sdhci-5.1";
reg = <0x0 0xfe330000 0x0 0x10000>;
interrupts = <GIC_SPI 11 IRQ_TYPE_LEVEL_HIGH>;
+ arasan,soc-ctl-syscon = <&grf>;
assigned-clocks = <&cru SCLK_EMMC>;
assigned-clock-rates = <200000000>;
clocks = <&cru SCLK_EMMC>, <&cru ACLK_EMMC>;
--
2.8.0.rc3.226.g39d4020
^ permalink raw reply related [flat|nested] 78+ messages in thread
* [PATCH v2 05/11] arm64: dts: rockchip: Add soc-ctl-syscon to sdhci for rk3399
@ 2016-06-13 23:04 ` Douglas Anderson
0 siblings, 0 replies; 78+ messages in thread
From: Douglas Anderson @ 2016-06-13 23:04 UTC (permalink / raw)
To: ulf.hansson, kishon, Heiko Stuebner, robh+dt
Cc: shawn.lin, xzy.xu, briannorris, adrian.hunter, linux-rockchip,
linux-mmc, devicetree, Douglas Anderson, pawel.moll, mark.rutland,
ijc+devicetree, galak, catalin.marinas, will.deacon, zhengxing,
jay.xu, wxt, linux-arm-kernel, linux-kernel
On rk3399 we'd like to be able to properly set corecfg registers in the
Arasan SDHCI component. Specify the syscon to enable that.
Signed-off-by: Douglas Anderson <dianders@chromium.org>
---
Changes in v2: None
arch/arm64/boot/dts/rockchip/rk3399.dtsi | 1 +
1 file changed, 1 insertion(+)
diff --git a/arch/arm64/boot/dts/rockchip/rk3399.dtsi b/arch/arm64/boot/dts/rockchip/rk3399.dtsi
index a4383f359264..1b57e92e0093 100644
--- a/arch/arm64/boot/dts/rockchip/rk3399.dtsi
+++ b/arch/arm64/boot/dts/rockchip/rk3399.dtsi
@@ -220,6 +220,7 @@
compatible = "rockchip,rk3399-sdhci-5.1", "arasan,sdhci-5.1";
reg = <0x0 0xfe330000 0x0 0x10000>;
interrupts = <GIC_SPI 11 IRQ_TYPE_LEVEL_HIGH>;
+ arasan,soc-ctl-syscon = <&grf>;
assigned-clocks = <&cru SCLK_EMMC>;
assigned-clock-rates = <200000000>;
clocks = <&cru SCLK_EMMC>, <&cru ACLK_EMMC>;
--
2.8.0.rc3.226.g39d4020
^ permalink raw reply related [flat|nested] 78+ messages in thread
* [PATCH v2 05/11] arm64: dts: rockchip: Add soc-ctl-syscon to sdhci for rk3399
@ 2016-06-13 23:04 ` Douglas Anderson
0 siblings, 0 replies; 78+ messages in thread
From: Douglas Anderson @ 2016-06-13 23:04 UTC (permalink / raw)
To: linux-arm-kernel
On rk3399 we'd like to be able to properly set corecfg registers in the
Arasan SDHCI component. Specify the syscon to enable that.
Signed-off-by: Douglas Anderson <dianders@chromium.org>
---
Changes in v2: None
arch/arm64/boot/dts/rockchip/rk3399.dtsi | 1 +
1 file changed, 1 insertion(+)
diff --git a/arch/arm64/boot/dts/rockchip/rk3399.dtsi b/arch/arm64/boot/dts/rockchip/rk3399.dtsi
index a4383f359264..1b57e92e0093 100644
--- a/arch/arm64/boot/dts/rockchip/rk3399.dtsi
+++ b/arch/arm64/boot/dts/rockchip/rk3399.dtsi
@@ -220,6 +220,7 @@
compatible = "rockchip,rk3399-sdhci-5.1", "arasan,sdhci-5.1";
reg = <0x0 0xfe330000 0x0 0x10000>;
interrupts = <GIC_SPI 11 IRQ_TYPE_LEVEL_HIGH>;
+ arasan,soc-ctl-syscon = <&grf>;
assigned-clocks = <&cru SCLK_EMMC>;
assigned-clock-rates = <200000000>;
clocks = <&cru SCLK_EMMC>, <&cru ACLK_EMMC>;
--
2.8.0.rc3.226.g39d4020
^ permalink raw reply related [flat|nested] 78+ messages in thread
* Re: [PATCH v2 05/11] arm64: dts: rockchip: Add soc-ctl-syscon to sdhci for rk3399
2016-06-13 23:04 ` Douglas Anderson
@ 2016-06-18 12:49 ` Heiko Stübner
-1 siblings, 0 replies; 78+ messages in thread
From: Heiko Stübner @ 2016-06-18 12:49 UTC (permalink / raw)
To: Douglas Anderson
Cc: ulf.hansson, kishon, robh+dt, shawn.lin, xzy.xu, briannorris,
adrian.hunter, linux-rockchip, linux-mmc, devicetree, pawel.moll,
mark.rutland, ijc+devicetree, galak, catalin.marinas, will.deacon,
zhengxing, jay.xu, wxt, linux-arm-kernel, linux-kernel
Am Montag, 13. Juni 2016, 16:04:29 schrieb Douglas Anderson:
> On rk3399 we'd like to be able to properly set corecfg registers in the
> Arasan SDHCI component. Specify the syscon to enable that.
>
> Signed-off-by: Douglas Anderson <dianders@chromium.org>
as the whole devicetree-part of the emmc addition is in my queue for 4.8, I'll
pick this patch after everything else has gone into some tree.
Heiko
^ permalink raw reply [flat|nested] 78+ messages in thread
* [PATCH v2 05/11] arm64: dts: rockchip: Add soc-ctl-syscon to sdhci for rk3399
@ 2016-06-18 12:49 ` Heiko Stübner
0 siblings, 0 replies; 78+ messages in thread
From: Heiko Stübner @ 2016-06-18 12:49 UTC (permalink / raw)
To: linux-arm-kernel
Am Montag, 13. Juni 2016, 16:04:29 schrieb Douglas Anderson:
> On rk3399 we'd like to be able to properly set corecfg registers in the
> Arasan SDHCI component. Specify the syscon to enable that.
>
> Signed-off-by: Douglas Anderson <dianders@chromium.org>
as the whole devicetree-part of the emmc addition is in my queue for 4.8, I'll
pick this patch after everything else has gone into some tree.
Heiko
^ permalink raw reply [flat|nested] 78+ messages in thread
* [PATCH v2 06/11] Documentation: mmc: sdhci-of-arasan: Add ability to export card clock
2016-06-13 23:04 ` Douglas Anderson
@ 2016-06-13 23:04 ` Douglas Anderson
-1 siblings, 0 replies; 78+ messages in thread
From: Douglas Anderson @ 2016-06-13 23:04 UTC (permalink / raw)
To: ulf.hansson-QSEj5FYQhm4dnm+yROfE0A, kishon-l0cyMroinI0,
Heiko Stuebner, robh+dt-DgEjT+Ai2ygdnm+yROfE0A
Cc: mark.rutland-5wv7dgnIgG8, devicetree-u79uwXL29TY76Z2rM5mHXA,
xzy.xu-TNX95d0MmH7DzftRWevZcw, pawel.moll-5wv7dgnIgG8,
ijc+devicetree-KcIKpvwj1kUDXYZnReoRVg,
linux-kernel-u79uwXL29TY76Z2rM5mHXA,
shawn.lin-TNX95d0MmH7DzftRWevZcw,
briannorris-F7+t8E8rja9g9hUCZPvPmw,
linux-mmc-u79uwXL29TY76Z2rM5mHXA,
adrian.hunter-ral2JQCrhuEAvxtiuMwx3w, Douglas Anderson,
linux-rockchip-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r,
galak-sgV2jX0FEOL9JmXXK+q4OQ
Some SD/eMMC PHYs (like the PHY from Arasan that is designed to work
with arasan,sdhci-5.1) need to know the card clock frequency in order to
function properly. Physically in a SoC this clock is exported from the
SDHCI IP block to the PHY IP block and the PHY needs to know the speed.
Let's export the SDHCI card clock using a standard device tree mechanism
so that the PHY can get access to it and query the card clock frequency.
Signed-off-by: Douglas Anderson <dianders-F7+t8E8rja9g9hUCZPvPmw@public.gmane.org>
Acked-by: Rob Herring <robh-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>
---
Changes in v2:
- Adjust commit message wording (Rob)
- Add Rob Herring's Ack.
Documentation/devicetree/bindings/mmc/arasan,sdhci.txt | 8 ++++++++
1 file changed, 8 insertions(+)
diff --git a/Documentation/devicetree/bindings/mmc/arasan,sdhci.txt b/Documentation/devicetree/bindings/mmc/arasan,sdhci.txt
index 476604e6ce2a..3404afa9b938 100644
--- a/Documentation/devicetree/bindings/mmc/arasan,sdhci.txt
+++ b/Documentation/devicetree/bindings/mmc/arasan,sdhci.txt
@@ -30,6 +30,12 @@ Optional Properties:
- arasan,soc-ctl-syscon: A phandle to a syscon device (see ../mfd/syscon.txt)
used to access core corecfg registers. Offsets of registers in this
syscon are determined based on the main compatible string for the device.
+ - clock-output-names: If specified, this will be the name of the card clock
+ which will be exposed by this device. Required if #clock-cells is
+ specified.
+ - #clock-cells: If specified this should be the value <0>. With this property
+ in place we will export a clock representing the Card Clock. This clock
+ is expected to be consumed by our PHY. You must also specify
Example:
sdhci@e0100000 {
@@ -61,7 +67,9 @@ Example:
arasan,soc-ctl-syscon = <&grf>;
assigned-clocks = <&cru SCLK_EMMC>;
assigned-clock-rates = <200000000>;
+ clock-output-names = "emmc_cardclock";
phys = <&emmc_phy>;
phy-names = "phy_arasan";
+ #clock-cells = <0>;
status = "disabled";
};
--
2.8.0.rc3.226.g39d4020
^ permalink raw reply related [flat|nested] 78+ messages in thread* [PATCH v2 06/11] Documentation: mmc: sdhci-of-arasan: Add ability to export card clock
@ 2016-06-13 23:04 ` Douglas Anderson
0 siblings, 0 replies; 78+ messages in thread
From: Douglas Anderson @ 2016-06-13 23:04 UTC (permalink / raw)
To: ulf.hansson, kishon, Heiko Stuebner, robh+dt
Cc: shawn.lin, xzy.xu, briannorris, adrian.hunter, linux-rockchip,
linux-mmc, devicetree, Douglas Anderson, pawel.moll, mark.rutland,
ijc+devicetree, galak, linux-kernel
Some SD/eMMC PHYs (like the PHY from Arasan that is designed to work
with arasan,sdhci-5.1) need to know the card clock frequency in order to
function properly. Physically in a SoC this clock is exported from the
SDHCI IP block to the PHY IP block and the PHY needs to know the speed.
Let's export the SDHCI card clock using a standard device tree mechanism
so that the PHY can get access to it and query the card clock frequency.
Signed-off-by: Douglas Anderson <dianders@chromium.org>
Acked-by: Rob Herring <robh@kernel.org>
---
Changes in v2:
- Adjust commit message wording (Rob)
- Add Rob Herring's Ack.
Documentation/devicetree/bindings/mmc/arasan,sdhci.txt | 8 ++++++++
1 file changed, 8 insertions(+)
diff --git a/Documentation/devicetree/bindings/mmc/arasan,sdhci.txt b/Documentation/devicetree/bindings/mmc/arasan,sdhci.txt
index 476604e6ce2a..3404afa9b938 100644
--- a/Documentation/devicetree/bindings/mmc/arasan,sdhci.txt
+++ b/Documentation/devicetree/bindings/mmc/arasan,sdhci.txt
@@ -30,6 +30,12 @@ Optional Properties:
- arasan,soc-ctl-syscon: A phandle to a syscon device (see ../mfd/syscon.txt)
used to access core corecfg registers. Offsets of registers in this
syscon are determined based on the main compatible string for the device.
+ - clock-output-names: If specified, this will be the name of the card clock
+ which will be exposed by this device. Required if #clock-cells is
+ specified.
+ - #clock-cells: If specified this should be the value <0>. With this property
+ in place we will export a clock representing the Card Clock. This clock
+ is expected to be consumed by our PHY. You must also specify
Example:
sdhci@e0100000 {
@@ -61,7 +67,9 @@ Example:
arasan,soc-ctl-syscon = <&grf>;
assigned-clocks = <&cru SCLK_EMMC>;
assigned-clock-rates = <200000000>;
+ clock-output-names = "emmc_cardclock";
phys = <&emmc_phy>;
phy-names = "phy_arasan";
+ #clock-cells = <0>;
status = "disabled";
};
--
2.8.0.rc3.226.g39d4020
^ permalink raw reply related [flat|nested] 78+ messages in thread* Re: [PATCH v2 06/11] Documentation: mmc: sdhci-of-arasan: Add ability to export card clock
2016-06-13 23:04 ` Douglas Anderson
(?)
@ 2016-06-18 18:02 ` Heiko Stuebner
-1 siblings, 0 replies; 78+ messages in thread
From: Heiko Stuebner @ 2016-06-18 18:02 UTC (permalink / raw)
To: Douglas Anderson
Cc: ulf.hansson, kishon, robh+dt, shawn.lin, xzy.xu, briannorris,
adrian.hunter, linux-rockchip, linux-mmc, devicetree, pawel.moll,
mark.rutland, ijc+devicetree, galak, linux-kernel
Am Montag, 13. Juni 2016, 16:04:30 schrieb Douglas Anderson:
> Some SD/eMMC PHYs (like the PHY from Arasan that is designed to work
> with arasan,sdhci-5.1) need to know the card clock frequency in order to
> function properly. Physically in a SoC this clock is exported from the
> SDHCI IP block to the PHY IP block and the PHY needs to know the speed.
> Let's export the SDHCI card clock using a standard device tree mechanism
> so that the PHY can get access to it and query the card clock frequency.
>
> Signed-off-by: Douglas Anderson <dianders@chromium.org>
> Acked-by: Rob Herring <robh@kernel.org>
Doug and me talked about how to solve this beforehand, so obviously I'm in
favour of doing it like this :-)
Reviewed-by: Heiko Stuebner <heiko@sntech.de>
^ permalink raw reply [flat|nested] 78+ messages in thread
* [PATCH v2 08/11] Documentation: phy: Let the rockchip eMMC PHY get an exported card clock
2016-06-13 23:04 ` Douglas Anderson
(?)
@ 2016-06-13 23:04 ` Douglas Anderson
-1 siblings, 0 replies; 78+ messages in thread
From: Douglas Anderson @ 2016-06-13 23:04 UTC (permalink / raw)
To: ulf.hansson-QSEj5FYQhm4dnm+yROfE0A, kishon-l0cyMroinI0,
Heiko Stuebner, robh+dt-DgEjT+Ai2ygdnm+yROfE0A
Cc: mark.rutland-5wv7dgnIgG8, devicetree-u79uwXL29TY76Z2rM5mHXA,
xzy.xu-TNX95d0MmH7DzftRWevZcw, pawel.moll-5wv7dgnIgG8,
ijc+devicetree-KcIKpvwj1kUDXYZnReoRVg,
linux-kernel-u79uwXL29TY76Z2rM5mHXA,
shawn.lin-TNX95d0MmH7DzftRWevZcw,
briannorris-F7+t8E8rja9g9hUCZPvPmw,
linux-mmc-u79uwXL29TY76Z2rM5mHXA,
adrian.hunter-ral2JQCrhuEAvxtiuMwx3w, Douglas Anderson,
linux-rockchip-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r,
galak-sgV2jX0FEOL9JmXXK+q4OQ,
linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r
As of an earlier change in this series ("Documentation: mmc:
sdhci-of-arasan: Add ability to export card clock") the SDHCI driver
used on Rockchip SoCs can now expose its clock. Let's now specify that
the PHY can use it.
Letting the PHY get access to this clock means it can adjust
phyctrl_frqsel field appropriately. Although the Rockchip PHY appears
slightly different than the reference Arasan one, you can see that the
Arasan datasheet [1] had it defined as:
Select the frequency range of DLL operation:
3b'000 => 200MHz to 170 MHz
3b'001 => 170MHz to 140 MHz
3b'010 => 140MHz to 110 MHz
3b'011 => 110MHz to 80MHz
3b'100 => 80MHz to 50 MHz
3b'101 => 275Mhz to 250MHz
3b'110 => 250MHz to 225MHz
3b'111 => 225MHz to 200MHz
On the Rockchip version of the PHY we have less granularity but the idea
is the same.
[1]: https://arasan.com/wp-content/media/eMMC-5-1-Total-Solution_Rev-1-3.pdf
Signed-off-by: Douglas Anderson <dianders-F7+t8E8rja9g9hUCZPvPmw@public.gmane.org>
---
Changes in v2:
- List out clocks and clock names (Rob)
Documentation/devicetree/bindings/phy/rockchip-emmc-phy.txt | 9 +++++++++
1 file changed, 9 insertions(+)
diff --git a/Documentation/devicetree/bindings/phy/rockchip-emmc-phy.txt b/Documentation/devicetree/bindings/phy/rockchip-emmc-phy.txt
index 555cb0f40690..e3ea55763b0a 100644
--- a/Documentation/devicetree/bindings/phy/rockchip-emmc-phy.txt
+++ b/Documentation/devicetree/bindings/phy/rockchip-emmc-phy.txt
@@ -7,6 +7,13 @@ Required properties:
- reg: PHY register address offset and length in "general
register files"
+Optional clocks using the clock bindings (see ../clock/clock-bindings.txt),
+specified by name:
+ - clock-names: Should contain "emmcclk". Although this is listed as optional
+ (because most boards can get basic functionality without having
+ access to it), it is strongly suggested.
+ - clocks: Should have a phandle to the card clock exported by the SDHCI driver.
+
Example:
@@ -20,6 +27,8 @@ grf: syscon@ff770000 {
emmcphy: phy@f780 {
compatible = "rockchip,rk3399-emmc-phy";
reg = <0xf780 0x20>;
+ clocks = <&sdhci>;
+ clock-names = "emmcclk";
#phy-cells = <0>;
};
};
--
2.8.0.rc3.226.g39d4020
^ permalink raw reply related [flat|nested] 78+ messages in thread* [PATCH v2 08/11] Documentation: phy: Let the rockchip eMMC PHY get an exported card clock
@ 2016-06-13 23:04 ` Douglas Anderson
0 siblings, 0 replies; 78+ messages in thread
From: Douglas Anderson @ 2016-06-13 23:04 UTC (permalink / raw)
To: ulf.hansson, kishon, Heiko Stuebner, robh+dt
Cc: shawn.lin, xzy.xu, briannorris, adrian.hunter, linux-rockchip,
linux-mmc, devicetree, Douglas Anderson, pawel.moll, mark.rutland,
ijc+devicetree, galak, linux-arm-kernel, linux-kernel
As of an earlier change in this series ("Documentation: mmc:
sdhci-of-arasan: Add ability to export card clock") the SDHCI driver
used on Rockchip SoCs can now expose its clock. Let's now specify that
the PHY can use it.
Letting the PHY get access to this clock means it can adjust
phyctrl_frqsel field appropriately. Although the Rockchip PHY appears
slightly different than the reference Arasan one, you can see that the
Arasan datasheet [1] had it defined as:
Select the frequency range of DLL operation:
3b'000 => 200MHz to 170 MHz
3b'001 => 170MHz to 140 MHz
3b'010 => 140MHz to 110 MHz
3b'011 => 110MHz to 80MHz
3b'100 => 80MHz to 50 MHz
3b'101 => 275Mhz to 250MHz
3b'110 => 250MHz to 225MHz
3b'111 => 225MHz to 200MHz
On the Rockchip version of the PHY we have less granularity but the idea
is the same.
[1]: https://arasan.com/wp-content/media/eMMC-5-1-Total-Solution_Rev-1-3.pdf
Signed-off-by: Douglas Anderson <dianders@chromium.org>
---
Changes in v2:
- List out clocks and clock names (Rob)
Documentation/devicetree/bindings/phy/rockchip-emmc-phy.txt | 9 +++++++++
1 file changed, 9 insertions(+)
diff --git a/Documentation/devicetree/bindings/phy/rockchip-emmc-phy.txt b/Documentation/devicetree/bindings/phy/rockchip-emmc-phy.txt
index 555cb0f40690..e3ea55763b0a 100644
--- a/Documentation/devicetree/bindings/phy/rockchip-emmc-phy.txt
+++ b/Documentation/devicetree/bindings/phy/rockchip-emmc-phy.txt
@@ -7,6 +7,13 @@ Required properties:
- reg: PHY register address offset and length in "general
register files"
+Optional clocks using the clock bindings (see ../clock/clock-bindings.txt),
+specified by name:
+ - clock-names: Should contain "emmcclk". Although this is listed as optional
+ (because most boards can get basic functionality without having
+ access to it), it is strongly suggested.
+ - clocks: Should have a phandle to the card clock exported by the SDHCI driver.
+
Example:
@@ -20,6 +27,8 @@ grf: syscon@ff770000 {
emmcphy: phy@f780 {
compatible = "rockchip,rk3399-emmc-phy";
reg = <0xf780 0x20>;
+ clocks = <&sdhci>;
+ clock-names = "emmcclk";
#phy-cells = <0>;
};
};
--
2.8.0.rc3.226.g39d4020
^ permalink raw reply related [flat|nested] 78+ messages in thread* [PATCH v2 08/11] Documentation: phy: Let the rockchip eMMC PHY get an exported card clock
@ 2016-06-13 23:04 ` Douglas Anderson
0 siblings, 0 replies; 78+ messages in thread
From: Douglas Anderson @ 2016-06-13 23:04 UTC (permalink / raw)
To: linux-arm-kernel
As of an earlier change in this series ("Documentation: mmc:
sdhci-of-arasan: Add ability to export card clock") the SDHCI driver
used on Rockchip SoCs can now expose its clock. Let's now specify that
the PHY can use it.
Letting the PHY get access to this clock means it can adjust
phyctrl_frqsel field appropriately. Although the Rockchip PHY appears
slightly different than the reference Arasan one, you can see that the
Arasan datasheet [1] had it defined as:
Select the frequency range of DLL operation:
3b'000 => 200MHz to 170 MHz
3b'001 => 170MHz to 140 MHz
3b'010 => 140MHz to 110 MHz
3b'011 => 110MHz to 80MHz
3b'100 => 80MHz to 50 MHz
3b'101 => 275Mhz to 250MHz
3b'110 => 250MHz to 225MHz
3b'111 => 225MHz to 200MHz
On the Rockchip version of the PHY we have less granularity but the idea
is the same.
[1]: https://arasan.com/wp-content/media/eMMC-5-1-Total-Solution_Rev-1-3.pdf
Signed-off-by: Douglas Anderson <dianders@chromium.org>
---
Changes in v2:
- List out clocks and clock names (Rob)
Documentation/devicetree/bindings/phy/rockchip-emmc-phy.txt | 9 +++++++++
1 file changed, 9 insertions(+)
diff --git a/Documentation/devicetree/bindings/phy/rockchip-emmc-phy.txt b/Documentation/devicetree/bindings/phy/rockchip-emmc-phy.txt
index 555cb0f40690..e3ea55763b0a 100644
--- a/Documentation/devicetree/bindings/phy/rockchip-emmc-phy.txt
+++ b/Documentation/devicetree/bindings/phy/rockchip-emmc-phy.txt
@@ -7,6 +7,13 @@ Required properties:
- reg: PHY register address offset and length in "general
register files"
+Optional clocks using the clock bindings (see ../clock/clock-bindings.txt),
+specified by name:
+ - clock-names: Should contain "emmcclk". Although this is listed as optional
+ (because most boards can get basic functionality without having
+ access to it), it is strongly suggested.
+ - clocks: Should have a phandle to the card clock exported by the SDHCI driver.
+
Example:
@@ -20,6 +27,8 @@ grf: syscon at ff770000 {
emmcphy: phy at f780 {
compatible = "rockchip,rk3399-emmc-phy";
reg = <0xf780 0x20>;
+ clocks = <&sdhci>;
+ clock-names = "emmcclk";
#phy-cells = <0>;
};
};
--
2.8.0.rc3.226.g39d4020
^ permalink raw reply related [flat|nested] 78+ messages in thread* Re: [PATCH v2 08/11] Documentation: phy: Let the rockchip eMMC PHY get an exported card clock
2016-06-13 23:04 ` Douglas Anderson
@ 2016-06-16 18:42 ` Rob Herring
-1 siblings, 0 replies; 78+ messages in thread
From: Rob Herring @ 2016-06-16 18:42 UTC (permalink / raw)
To: Douglas Anderson
Cc: ulf.hansson, kishon, Heiko Stuebner, shawn.lin, xzy.xu,
briannorris, adrian.hunter, linux-rockchip, linux-mmc, devicetree,
pawel.moll, mark.rutland, ijc+devicetree, galak, linux-arm-kernel,
linux-kernel
On Mon, Jun 13, 2016 at 04:04:32PM -0700, Douglas Anderson wrote:
> As of an earlier change in this series ("Documentation: mmc:
> sdhci-of-arasan: Add ability to export card clock") the SDHCI driver
> used on Rockchip SoCs can now expose its clock. Let's now specify that
> the PHY can use it.
>
> Letting the PHY get access to this clock means it can adjust
> phyctrl_frqsel field appropriately. Although the Rockchip PHY appears
> slightly different than the reference Arasan one, you can see that the
> Arasan datasheet [1] had it defined as:
> Select the frequency range of DLL operation:
> 3b'000 => 200MHz to 170 MHz
> 3b'001 => 170MHz to 140 MHz
> 3b'010 => 140MHz to 110 MHz
> 3b'011 => 110MHz to 80MHz
> 3b'100 => 80MHz to 50 MHz
> 3b'101 => 275Mhz to 250MHz
> 3b'110 => 250MHz to 225MHz
> 3b'111 => 225MHz to 200MHz
>
> On the Rockchip version of the PHY we have less granularity but the idea
> is the same.
>
> [1]: https://arasan.com/wp-content/media/eMMC-5-1-Total-Solution_Rev-1-3.pdf
>
> Signed-off-by: Douglas Anderson <dianders@chromium.org>
> ---
> Changes in v2:
> - List out clocks and clock names (Rob)
>
> Documentation/devicetree/bindings/phy/rockchip-emmc-phy.txt | 9 +++++++++
> 1 file changed, 9 insertions(+)
Acked-by: Rob Herring <robh@kernel.org>
^ permalink raw reply [flat|nested] 78+ messages in thread* [PATCH v2 08/11] Documentation: phy: Let the rockchip eMMC PHY get an exported card clock
@ 2016-06-16 18:42 ` Rob Herring
0 siblings, 0 replies; 78+ messages in thread
From: Rob Herring @ 2016-06-16 18:42 UTC (permalink / raw)
To: linux-arm-kernel
On Mon, Jun 13, 2016 at 04:04:32PM -0700, Douglas Anderson wrote:
> As of an earlier change in this series ("Documentation: mmc:
> sdhci-of-arasan: Add ability to export card clock") the SDHCI driver
> used on Rockchip SoCs can now expose its clock. Let's now specify that
> the PHY can use it.
>
> Letting the PHY get access to this clock means it can adjust
> phyctrl_frqsel field appropriately. Although the Rockchip PHY appears
> slightly different than the reference Arasan one, you can see that the
> Arasan datasheet [1] had it defined as:
> Select the frequency range of DLL operation:
> 3b'000 => 200MHz to 170 MHz
> 3b'001 => 170MHz to 140 MHz
> 3b'010 => 140MHz to 110 MHz
> 3b'011 => 110MHz to 80MHz
> 3b'100 => 80MHz to 50 MHz
> 3b'101 => 275Mhz to 250MHz
> 3b'110 => 250MHz to 225MHz
> 3b'111 => 225MHz to 200MHz
>
> On the Rockchip version of the PHY we have less granularity but the idea
> is the same.
>
> [1]: https://arasan.com/wp-content/media/eMMC-5-1-Total-Solution_Rev-1-3.pdf
>
> Signed-off-by: Douglas Anderson <dianders@chromium.org>
> ---
> Changes in v2:
> - List out clocks and clock names (Rob)
>
> Documentation/devicetree/bindings/phy/rockchip-emmc-phy.txt | 9 +++++++++
> 1 file changed, 9 insertions(+)
Acked-by: Rob Herring <robh@kernel.org>
^ permalink raw reply [flat|nested] 78+ messages in thread
* Re: [PATCH v2 08/11] Documentation: phy: Let the rockchip eMMC PHY get an exported card clock
2016-06-13 23:04 ` Douglas Anderson
@ 2016-06-18 21:48 ` Heiko Stübner
-1 siblings, 0 replies; 78+ messages in thread
From: Heiko Stübner @ 2016-06-18 21:48 UTC (permalink / raw)
To: Douglas Anderson
Cc: ulf.hansson, kishon, robh+dt, shawn.lin, xzy.xu, briannorris,
adrian.hunter, linux-rockchip, linux-mmc, devicetree, pawel.moll,
mark.rutland, ijc+devicetree, galak, linux-arm-kernel,
linux-kernel
Am Montag, 13. Juni 2016, 16:04:32 schrieb Douglas Anderson:
> As of an earlier change in this series ("Documentation: mmc:
> sdhci-of-arasan: Add ability to export card clock") the SDHCI driver
> used on Rockchip SoCs can now expose its clock. Let's now specify that
> the PHY can use it.
>
> Letting the PHY get access to this clock means it can adjust
> phyctrl_frqsel field appropriately. Although the Rockchip PHY appears
> slightly different than the reference Arasan one, you can see that the
> Arasan datasheet [1] had it defined as:
> Select the frequency range of DLL operation:
> 3b'000 => 200MHz to 170 MHz
> 3b'001 => 170MHz to 140 MHz
> 3b'010 => 140MHz to 110 MHz
> 3b'011 => 110MHz to 80MHz
> 3b'100 => 80MHz to 50 MHz
> 3b'101 => 275Mhz to 250MHz
> 3b'110 => 250MHz to 225MHz
> 3b'111 => 225MHz to 200MHz
>
> On the Rockchip version of the PHY we have less granularity but the idea
> is the same.
>
> [1]: https://arasan.com/wp-content/media/eMMC-5-1-Total-Solution_Rev-1-3.pdf
>
> Signed-off-by: Douglas Anderson <dianders@chromium.org>
Reviewed-by: Heiko Stuebner <heiko@sntech.de>
^ permalink raw reply [flat|nested] 78+ messages in thread* [PATCH v2 08/11] Documentation: phy: Let the rockchip eMMC PHY get an exported card clock
@ 2016-06-18 21:48 ` Heiko Stübner
0 siblings, 0 replies; 78+ messages in thread
From: Heiko Stübner @ 2016-06-18 21:48 UTC (permalink / raw)
To: linux-arm-kernel
Am Montag, 13. Juni 2016, 16:04:32 schrieb Douglas Anderson:
> As of an earlier change in this series ("Documentation: mmc:
> sdhci-of-arasan: Add ability to export card clock") the SDHCI driver
> used on Rockchip SoCs can now expose its clock. Let's now specify that
> the PHY can use it.
>
> Letting the PHY get access to this clock means it can adjust
> phyctrl_frqsel field appropriately. Although the Rockchip PHY appears
> slightly different than the reference Arasan one, you can see that the
> Arasan datasheet [1] had it defined as:
> Select the frequency range of DLL operation:
> 3b'000 => 200MHz to 170 MHz
> 3b'001 => 170MHz to 140 MHz
> 3b'010 => 140MHz to 110 MHz
> 3b'011 => 110MHz to 80MHz
> 3b'100 => 80MHz to 50 MHz
> 3b'101 => 275Mhz to 250MHz
> 3b'110 => 250MHz to 225MHz
> 3b'111 => 225MHz to 200MHz
>
> On the Rockchip version of the PHY we have less granularity but the idea
> is the same.
>
> [1]: https://arasan.com/wp-content/media/eMMC-5-1-Total-Solution_Rev-1-3.pdf
>
> Signed-off-by: Douglas Anderson <dianders@chromium.org>
Reviewed-by: Heiko Stuebner <heiko@sntech.de>
^ permalink raw reply [flat|nested] 78+ messages in thread
[parent not found: <1465859076-4868-9-git-send-email-dianders-F7+t8E8rja9g9hUCZPvPmw@public.gmane.org>]
* Re: [PATCH v2 08/11] Documentation: phy: Let the rockchip eMMC PHY get an exported card clock
2016-06-13 23:04 ` Douglas Anderson
(?)
@ 2016-06-20 13:04 ` Kishon Vijay Abraham I
-1 siblings, 0 replies; 78+ messages in thread
From: Kishon Vijay Abraham I @ 2016-06-20 13:04 UTC (permalink / raw)
To: Douglas Anderson, ulf.hansson-QSEj5FYQhm4dnm+yROfE0A,
Heiko Stuebner, robh+dt-DgEjT+Ai2ygdnm+yROfE0A
Cc: mark.rutland-5wv7dgnIgG8, devicetree-u79uwXL29TY76Z2rM5mHXA,
xzy.xu-TNX95d0MmH7DzftRWevZcw, pawel.moll-5wv7dgnIgG8,
ijc+devicetree-KcIKpvwj1kUDXYZnReoRVg,
shawn.lin-TNX95d0MmH7DzftRWevZcw,
briannorris-F7+t8E8rja9g9hUCZPvPmw,
linux-mmc-u79uwXL29TY76Z2rM5mHXA,
adrian.hunter-ral2JQCrhuEAvxtiuMwx3w,
linux-kernel-u79uwXL29TY76Z2rM5mHXA,
linux-rockchip-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r,
galak-sgV2jX0FEOL9JmXXK+q4OQ,
linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r
On Tuesday 14 June 2016 04:34 AM, Douglas Anderson wrote:
> As of an earlier change in this series ("Documentation: mmc:
> sdhci-of-arasan: Add ability to export card clock") the SDHCI driver
> used on Rockchip SoCs can now expose its clock. Let's now specify that
> the PHY can use it.
>
> Letting the PHY get access to this clock means it can adjust
> phyctrl_frqsel field appropriately. Although the Rockchip PHY appears
> slightly different than the reference Arasan one, you can see that the
> Arasan datasheet [1] had it defined as:
> Select the frequency range of DLL operation:
> 3b'000 => 200MHz to 170 MHz
> 3b'001 => 170MHz to 140 MHz
> 3b'010 => 140MHz to 110 MHz
> 3b'011 => 110MHz to 80MHz
> 3b'100 => 80MHz to 50 MHz
> 3b'101 => 275Mhz to 250MHz
> 3b'110 => 250MHz to 225MHz
> 3b'111 => 225MHz to 200MHz
>
> On the Rockchip version of the PHY we have less granularity but the idea
> is the same.
>
> [1]: https://arasan.com/wp-content/media/eMMC-5-1-Total-Solution_Rev-1-3.pdf
>
> Signed-off-by: Douglas Anderson <dianders-F7+t8E8rja9g9hUCZPvPmw@public.gmane.org>
Acked-by: Kishon Vijay Abraham I <kishon-l0cyMroinI0@public.gmane.org>
> ---
> Changes in v2:
> - List out clocks and clock names (Rob)
>
> Documentation/devicetree/bindings/phy/rockchip-emmc-phy.txt | 9 +++++++++
> 1 file changed, 9 insertions(+)
>
> diff --git a/Documentation/devicetree/bindings/phy/rockchip-emmc-phy.txt b/Documentation/devicetree/bindings/phy/rockchip-emmc-phy.txt
> index 555cb0f40690..e3ea55763b0a 100644
> --- a/Documentation/devicetree/bindings/phy/rockchip-emmc-phy.txt
> +++ b/Documentation/devicetree/bindings/phy/rockchip-emmc-phy.txt
> @@ -7,6 +7,13 @@ Required properties:
> - reg: PHY register address offset and length in "general
> register files"
>
> +Optional clocks using the clock bindings (see ../clock/clock-bindings.txt),
> +specified by name:
> + - clock-names: Should contain "emmcclk". Although this is listed as optional
> + (because most boards can get basic functionality without having
> + access to it), it is strongly suggested.
> + - clocks: Should have a phandle to the card clock exported by the SDHCI driver.
> +
> Example:
>
>
> @@ -20,6 +27,8 @@ grf: syscon@ff770000 {
> emmcphy: phy@f780 {
> compatible = "rockchip,rk3399-emmc-phy";
> reg = <0xf780 0x20>;
> + clocks = <&sdhci>;
> + clock-names = "emmcclk";
> #phy-cells = <0>;
> };
> };
>
^ permalink raw reply [flat|nested] 78+ messages in thread* Re: [PATCH v2 08/11] Documentation: phy: Let the rockchip eMMC PHY get an exported card clock
@ 2016-06-20 13:04 ` Kishon Vijay Abraham I
0 siblings, 0 replies; 78+ messages in thread
From: Kishon Vijay Abraham I @ 2016-06-20 13:04 UTC (permalink / raw)
To: Douglas Anderson, ulf.hansson, Heiko Stuebner, robh+dt
Cc: shawn.lin, xzy.xu, briannorris, adrian.hunter, linux-rockchip,
linux-mmc, devicetree, pawel.moll, mark.rutland, ijc+devicetree,
galak, linux-arm-kernel, linux-kernel
On Tuesday 14 June 2016 04:34 AM, Douglas Anderson wrote:
> As of an earlier change in this series ("Documentation: mmc:
> sdhci-of-arasan: Add ability to export card clock") the SDHCI driver
> used on Rockchip SoCs can now expose its clock. Let's now specify that
> the PHY can use it.
>
> Letting the PHY get access to this clock means it can adjust
> phyctrl_frqsel field appropriately. Although the Rockchip PHY appears
> slightly different than the reference Arasan one, you can see that the
> Arasan datasheet [1] had it defined as:
> Select the frequency range of DLL operation:
> 3b'000 => 200MHz to 170 MHz
> 3b'001 => 170MHz to 140 MHz
> 3b'010 => 140MHz to 110 MHz
> 3b'011 => 110MHz to 80MHz
> 3b'100 => 80MHz to 50 MHz
> 3b'101 => 275Mhz to 250MHz
> 3b'110 => 250MHz to 225MHz
> 3b'111 => 225MHz to 200MHz
>
> On the Rockchip version of the PHY we have less granularity but the idea
> is the same.
>
> [1]: https://arasan.com/wp-content/media/eMMC-5-1-Total-Solution_Rev-1-3.pdf
>
> Signed-off-by: Douglas Anderson <dianders@chromium.org>
Acked-by: Kishon Vijay Abraham I <kishon@ti.com>
> ---
> Changes in v2:
> - List out clocks and clock names (Rob)
>
> Documentation/devicetree/bindings/phy/rockchip-emmc-phy.txt | 9 +++++++++
> 1 file changed, 9 insertions(+)
>
> diff --git a/Documentation/devicetree/bindings/phy/rockchip-emmc-phy.txt b/Documentation/devicetree/bindings/phy/rockchip-emmc-phy.txt
> index 555cb0f40690..e3ea55763b0a 100644
> --- a/Documentation/devicetree/bindings/phy/rockchip-emmc-phy.txt
> +++ b/Documentation/devicetree/bindings/phy/rockchip-emmc-phy.txt
> @@ -7,6 +7,13 @@ Required properties:
> - reg: PHY register address offset and length in "general
> register files"
>
> +Optional clocks using the clock bindings (see ../clock/clock-bindings.txt),
> +specified by name:
> + - clock-names: Should contain "emmcclk". Although this is listed as optional
> + (because most boards can get basic functionality without having
> + access to it), it is strongly suggested.
> + - clocks: Should have a phandle to the card clock exported by the SDHCI driver.
> +
> Example:
>
>
> @@ -20,6 +27,8 @@ grf: syscon@ff770000 {
> emmcphy: phy@f780 {
> compatible = "rockchip,rk3399-emmc-phy";
> reg = <0xf780 0x20>;
> + clocks = <&sdhci>;
> + clock-names = "emmcclk";
> #phy-cells = <0>;
> };
> };
>
^ permalink raw reply [flat|nested] 78+ messages in thread* [PATCH v2 08/11] Documentation: phy: Let the rockchip eMMC PHY get an exported card clock
@ 2016-06-20 13:04 ` Kishon Vijay Abraham I
0 siblings, 0 replies; 78+ messages in thread
From: Kishon Vijay Abraham I @ 2016-06-20 13:04 UTC (permalink / raw)
To: linux-arm-kernel
On Tuesday 14 June 2016 04:34 AM, Douglas Anderson wrote:
> As of an earlier change in this series ("Documentation: mmc:
> sdhci-of-arasan: Add ability to export card clock") the SDHCI driver
> used on Rockchip SoCs can now expose its clock. Let's now specify that
> the PHY can use it.
>
> Letting the PHY get access to this clock means it can adjust
> phyctrl_frqsel field appropriately. Although the Rockchip PHY appears
> slightly different than the reference Arasan one, you can see that the
> Arasan datasheet [1] had it defined as:
> Select the frequency range of DLL operation:
> 3b'000 => 200MHz to 170 MHz
> 3b'001 => 170MHz to 140 MHz
> 3b'010 => 140MHz to 110 MHz
> 3b'011 => 110MHz to 80MHz
> 3b'100 => 80MHz to 50 MHz
> 3b'101 => 275Mhz to 250MHz
> 3b'110 => 250MHz to 225MHz
> 3b'111 => 225MHz to 200MHz
>
> On the Rockchip version of the PHY we have less granularity but the idea
> is the same.
>
> [1]: https://arasan.com/wp-content/media/eMMC-5-1-Total-Solution_Rev-1-3.pdf
>
> Signed-off-by: Douglas Anderson <dianders@chromium.org>
Acked-by: Kishon Vijay Abraham I <kishon@ti.com>
> ---
> Changes in v2:
> - List out clocks and clock names (Rob)
>
> Documentation/devicetree/bindings/phy/rockchip-emmc-phy.txt | 9 +++++++++
> 1 file changed, 9 insertions(+)
>
> diff --git a/Documentation/devicetree/bindings/phy/rockchip-emmc-phy.txt b/Documentation/devicetree/bindings/phy/rockchip-emmc-phy.txt
> index 555cb0f40690..e3ea55763b0a 100644
> --- a/Documentation/devicetree/bindings/phy/rockchip-emmc-phy.txt
> +++ b/Documentation/devicetree/bindings/phy/rockchip-emmc-phy.txt
> @@ -7,6 +7,13 @@ Required properties:
> - reg: PHY register address offset and length in "general
> register files"
>
> +Optional clocks using the clock bindings (see ../clock/clock-bindings.txt),
> +specified by name:
> + - clock-names: Should contain "emmcclk". Although this is listed as optional
> + (because most boards can get basic functionality without having
> + access to it), it is strongly suggested.
> + - clocks: Should have a phandle to the card clock exported by the SDHCI driver.
> +
> Example:
>
>
> @@ -20,6 +27,8 @@ grf: syscon at ff770000 {
> emmcphy: phy at f780 {
> compatible = "rockchip,rk3399-emmc-phy";
> reg = <0xf780 0x20>;
> + clocks = <&sdhci>;
> + clock-names = "emmcclk";
> #phy-cells = <0>;
> };
> };
>
^ permalink raw reply [flat|nested] 78+ messages in thread
* [PATCH v2 10/11] phy: rockchip-emmc: Set phyctrl_frqsel based on card clock
2016-06-13 23:04 ` Douglas Anderson
(?)
@ 2016-06-13 23:04 ` Douglas Anderson
-1 siblings, 0 replies; 78+ messages in thread
From: Douglas Anderson @ 2016-06-13 23:04 UTC (permalink / raw)
To: ulf.hansson-QSEj5FYQhm4dnm+yROfE0A, kishon-l0cyMroinI0,
Heiko Stuebner, robh+dt-DgEjT+Ai2ygdnm+yROfE0A
Cc: devicetree-u79uwXL29TY76Z2rM5mHXA, xzy.xu-TNX95d0MmH7DzftRWevZcw,
linux-kernel-u79uwXL29TY76Z2rM5mHXA,
shawn.lin-TNX95d0MmH7DzftRWevZcw,
briannorris-F7+t8E8rja9g9hUCZPvPmw,
linux-mmc-u79uwXL29TY76Z2rM5mHXA,
adrian.hunter-ral2JQCrhuEAvxtiuMwx3w, Douglas Anderson,
linux-rockchip-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r,
linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r
The "phyctrl_frqsel" is described in the Arasan datasheet [1] as "the
frequency range of DLL operation". Although the Rockchip variant of
this PHY has different ranges than the reference Arasan PHY it appears
as if the functionality is similar. We should set this phyctrl field
properly.
Note: as per Rockchip engineers, apparently the "phyctrl_frqsel" is
actually only useful in HS200 / HS400 modes even though the DLL itself
it used for some purposes in all modes. See the discussion in the
earlier change in this series: ("mmc: sdhci-of-arasan: Always power the
PHY off/on when clock changes"). In any case, it shouldn't hurt to set
this always.
Note that this change should allow boards to run at HS200 / HS400 speed
modes while running at 100 MHz or 150 MHz. In fact, running HS400 at
150 MHz (giving 300 MB/s) is the main motivation of this series, since
performance is still good but signal integrity problems are less
prevelant at 150 MHz.
[1]: https://arasan.com/wp-content/media/eMMC-5-1-Total-Solution_Rev-1-3.pdf
Signed-off-by: Douglas Anderson <dianders-F7+t8E8rja9g9hUCZPvPmw@public.gmane.org>
---
Changes in v2:
- Warn if we're more than 15 MHz from ideal rate (Shawn)
- Move code cleanup before set phyctrl_frqsel based on card clock (Shawn)
- Fix typo USB => SDHCI (Shawn)
drivers/phy/phy-rockchip-emmc.c | 82 ++++++++++++++++++++++++++++++++++-------
1 file changed, 69 insertions(+), 13 deletions(-)
diff --git a/drivers/phy/phy-rockchip-emmc.c b/drivers/phy/phy-rockchip-emmc.c
index 23fe50864526..51ddd543fd04 100644
--- a/drivers/phy/phy-rockchip-emmc.c
+++ b/drivers/phy/phy-rockchip-emmc.c
@@ -14,6 +14,7 @@
* GNU General Public License for more details.
*/
+#include <linux/clk.h>
#include <linux/delay.h>
#include <linux/mfd/syscon.h>
#include <linux/module.h>
@@ -78,16 +79,73 @@
struct rockchip_emmc_phy {
unsigned int reg_offset;
struct regmap *reg_base;
+ struct clk *emmcclk;
};
-static int rockchip_emmc_phy_power(struct rockchip_emmc_phy *rk_phy,
- bool on_off)
+static int rockchip_emmc_phy_power(struct phy *phy, bool on_off)
{
+ struct rockchip_emmc_phy *rk_phy = phy_get_drvdata(phy);
unsigned int caldone;
unsigned int dllrdy;
+ unsigned int freqsel = PHYCTRL_FREQSEL_200M;
unsigned long timeout;
/*
+ * We purposely get the clock here and not in probe to avoid the
+ * circular dependency problem. We expect:
+ * - PHY driver to probe
+ * - SDHCI driver to start probe
+ * - SDHCI driver to register it's clock
+ * - SDHCI driver to get the PHY
+ * - SDHCI driver to power on the PHY
+ */
+ if (!rk_phy->emmcclk) {
+ rk_phy->emmcclk = devm_clk_get(&phy->dev, "emmcclk");
+
+ /* Don't expect defer at this point; try next time */
+ if (PTR_ERR(rk_phy->emmcclk) == -EPROBE_DEFER) {
+ dev_warn(&phy->dev, "Unexpected emmcclk defer\n");
+ rk_phy->emmcclk = NULL;
+ }
+ }
+
+ if (!IS_ERR_OR_NULL(rk_phy->emmcclk)) {
+ unsigned long rate = clk_get_rate(rk_phy->emmcclk);
+ unsigned long ideal_rate;
+ unsigned long diff;
+
+ switch (rate) {
+ case 0 ... 74999999:
+ ideal_rate = 50000000;
+ freqsel = PHYCTRL_FREQSEL_50M;
+ break;
+ case 75000000 ... 124999999:
+ ideal_rate = 100000000;
+ freqsel = PHYCTRL_FREQSEL_100M;
+ break;
+ case 125000000 ... 174999999:
+ ideal_rate = 150000000;
+ freqsel = PHYCTRL_FREQSEL_150M;
+ break;
+ default:
+ ideal_rate = 200000000;
+ break;
+ };
+
+ diff = (rate > ideal_rate) ?
+ rate - ideal_rate : ideal_rate - rate;
+
+ /*
+ * In order for tuning delays to be accurate we need to be
+ * pretty spot on for the DLL range, so warn if we're too
+ * far off. Also warn if we're above the 200 MHz max. Don't
+ * warn for really slow rates since we won't be tuning then.
+ */
+ if ((rate > 50000000 && diff > 15000000) || (rate > 200000000))
+ dev_warn(&phy->dev, "Unsupported rate: %lu\n", rate);
+ }
+
+ /*
* Keep phyctrl_pdb and phyctrl_endll low to allow
* initialization of CALIO state M/C DFFs
*/
@@ -132,6 +190,13 @@ static int rockchip_emmc_phy_power(struct rockchip_emmc_phy *rk_phy,
return -ETIMEDOUT;
}
+ /* Set the frequency of the DLL operation */
+ regmap_write(rk_phy->reg_base,
+ rk_phy->reg_offset + GRF_EMMCPHY_CON0,
+ HIWORD_UPDATE(freqsel, PHYCTRL_FREQSEL_MASK,
+ PHYCTRL_FREQSEL_SHIFT));
+
+ /* Turn on the DLL */
regmap_write(rk_phy->reg_base,
rk_phy->reg_offset + GRF_EMMCPHY_CON6,
HIWORD_UPDATE(PHYCTRL_ENDLL_ENABLE,
@@ -168,23 +233,14 @@ static int rockchip_emmc_phy_power(struct rockchip_emmc_phy *rk_phy,
static int rockchip_emmc_phy_power_off(struct phy *phy)
{
- struct rockchip_emmc_phy *rk_phy = phy_get_drvdata(phy);
-
/* Power down emmc phy analog blocks */
- return rockchip_emmc_phy_power(rk_phy, PHYCTRL_PDB_PWR_OFF);
+ return rockchip_emmc_phy_power(phy, PHYCTRL_PDB_PWR_OFF);
}
static int rockchip_emmc_phy_power_on(struct phy *phy)
{
struct rockchip_emmc_phy *rk_phy = phy_get_drvdata(phy);
- /* DLL operation: 200 MHz */
- regmap_write(rk_phy->reg_base,
- rk_phy->reg_offset + GRF_EMMCPHY_CON0,
- HIWORD_UPDATE(PHYCTRL_FREQSEL_200M,
- PHYCTRL_FREQSEL_MASK,
- PHYCTRL_FREQSEL_SHIFT));
-
/* Drive impedance: 50 Ohm */
regmap_write(rk_phy->reg_base,
rk_phy->reg_offset + GRF_EMMCPHY_CON6,
@@ -207,7 +263,7 @@ static int rockchip_emmc_phy_power_on(struct phy *phy)
PHYCTRL_OTAPDLYSEL_SHIFT));
/* Power up emmc phy analog blocks */
- return rockchip_emmc_phy_power(rk_phy, PHYCTRL_PDB_PWR_ON);
+ return rockchip_emmc_phy_power(phy, PHYCTRL_PDB_PWR_ON);
}
static const struct phy_ops ops = {
--
2.8.0.rc3.226.g39d4020
^ permalink raw reply related [flat|nested] 78+ messages in thread* [PATCH v2 10/11] phy: rockchip-emmc: Set phyctrl_frqsel based on card clock
@ 2016-06-13 23:04 ` Douglas Anderson
0 siblings, 0 replies; 78+ messages in thread
From: Douglas Anderson @ 2016-06-13 23:04 UTC (permalink / raw)
To: ulf.hansson, kishon, Heiko Stuebner, robh+dt
Cc: shawn.lin, xzy.xu, briannorris, adrian.hunter, linux-rockchip,
linux-mmc, devicetree, Douglas Anderson, linux-kernel,
linux-arm-kernel
The "phyctrl_frqsel" is described in the Arasan datasheet [1] as "the
frequency range of DLL operation". Although the Rockchip variant of
this PHY has different ranges than the reference Arasan PHY it appears
as if the functionality is similar. We should set this phyctrl field
properly.
Note: as per Rockchip engineers, apparently the "phyctrl_frqsel" is
actually only useful in HS200 / HS400 modes even though the DLL itself
it used for some purposes in all modes. See the discussion in the
earlier change in this series: ("mmc: sdhci-of-arasan: Always power the
PHY off/on when clock changes"). In any case, it shouldn't hurt to set
this always.
Note that this change should allow boards to run at HS200 / HS400 speed
modes while running at 100 MHz or 150 MHz. In fact, running HS400 at
150 MHz (giving 300 MB/s) is the main motivation of this series, since
performance is still good but signal integrity problems are less
prevelant at 150 MHz.
[1]: https://arasan.com/wp-content/media/eMMC-5-1-Total-Solution_Rev-1-3.pdf
Signed-off-by: Douglas Anderson <dianders@chromium.org>
---
Changes in v2:
- Warn if we're more than 15 MHz from ideal rate (Shawn)
- Move code cleanup before set phyctrl_frqsel based on card clock (Shawn)
- Fix typo USB => SDHCI (Shawn)
drivers/phy/phy-rockchip-emmc.c | 82 ++++++++++++++++++++++++++++++++++-------
1 file changed, 69 insertions(+), 13 deletions(-)
diff --git a/drivers/phy/phy-rockchip-emmc.c b/drivers/phy/phy-rockchip-emmc.c
index 23fe50864526..51ddd543fd04 100644
--- a/drivers/phy/phy-rockchip-emmc.c
+++ b/drivers/phy/phy-rockchip-emmc.c
@@ -14,6 +14,7 @@
* GNU General Public License for more details.
*/
+#include <linux/clk.h>
#include <linux/delay.h>
#include <linux/mfd/syscon.h>
#include <linux/module.h>
@@ -78,16 +79,73 @@
struct rockchip_emmc_phy {
unsigned int reg_offset;
struct regmap *reg_base;
+ struct clk *emmcclk;
};
-static int rockchip_emmc_phy_power(struct rockchip_emmc_phy *rk_phy,
- bool on_off)
+static int rockchip_emmc_phy_power(struct phy *phy, bool on_off)
{
+ struct rockchip_emmc_phy *rk_phy = phy_get_drvdata(phy);
unsigned int caldone;
unsigned int dllrdy;
+ unsigned int freqsel = PHYCTRL_FREQSEL_200M;
unsigned long timeout;
/*
+ * We purposely get the clock here and not in probe to avoid the
+ * circular dependency problem. We expect:
+ * - PHY driver to probe
+ * - SDHCI driver to start probe
+ * - SDHCI driver to register it's clock
+ * - SDHCI driver to get the PHY
+ * - SDHCI driver to power on the PHY
+ */
+ if (!rk_phy->emmcclk) {
+ rk_phy->emmcclk = devm_clk_get(&phy->dev, "emmcclk");
+
+ /* Don't expect defer at this point; try next time */
+ if (PTR_ERR(rk_phy->emmcclk) == -EPROBE_DEFER) {
+ dev_warn(&phy->dev, "Unexpected emmcclk defer\n");
+ rk_phy->emmcclk = NULL;
+ }
+ }
+
+ if (!IS_ERR_OR_NULL(rk_phy->emmcclk)) {
+ unsigned long rate = clk_get_rate(rk_phy->emmcclk);
+ unsigned long ideal_rate;
+ unsigned long diff;
+
+ switch (rate) {
+ case 0 ... 74999999:
+ ideal_rate = 50000000;
+ freqsel = PHYCTRL_FREQSEL_50M;
+ break;
+ case 75000000 ... 124999999:
+ ideal_rate = 100000000;
+ freqsel = PHYCTRL_FREQSEL_100M;
+ break;
+ case 125000000 ... 174999999:
+ ideal_rate = 150000000;
+ freqsel = PHYCTRL_FREQSEL_150M;
+ break;
+ default:
+ ideal_rate = 200000000;
+ break;
+ };
+
+ diff = (rate > ideal_rate) ?
+ rate - ideal_rate : ideal_rate - rate;
+
+ /*
+ * In order for tuning delays to be accurate we need to be
+ * pretty spot on for the DLL range, so warn if we're too
+ * far off. Also warn if we're above the 200 MHz max. Don't
+ * warn for really slow rates since we won't be tuning then.
+ */
+ if ((rate > 50000000 && diff > 15000000) || (rate > 200000000))
+ dev_warn(&phy->dev, "Unsupported rate: %lu\n", rate);
+ }
+
+ /*
* Keep phyctrl_pdb and phyctrl_endll low to allow
* initialization of CALIO state M/C DFFs
*/
@@ -132,6 +190,13 @@ static int rockchip_emmc_phy_power(struct rockchip_emmc_phy *rk_phy,
return -ETIMEDOUT;
}
+ /* Set the frequency of the DLL operation */
+ regmap_write(rk_phy->reg_base,
+ rk_phy->reg_offset + GRF_EMMCPHY_CON0,
+ HIWORD_UPDATE(freqsel, PHYCTRL_FREQSEL_MASK,
+ PHYCTRL_FREQSEL_SHIFT));
+
+ /* Turn on the DLL */
regmap_write(rk_phy->reg_base,
rk_phy->reg_offset + GRF_EMMCPHY_CON6,
HIWORD_UPDATE(PHYCTRL_ENDLL_ENABLE,
@@ -168,23 +233,14 @@ static int rockchip_emmc_phy_power(struct rockchip_emmc_phy *rk_phy,
static int rockchip_emmc_phy_power_off(struct phy *phy)
{
- struct rockchip_emmc_phy *rk_phy = phy_get_drvdata(phy);
-
/* Power down emmc phy analog blocks */
- return rockchip_emmc_phy_power(rk_phy, PHYCTRL_PDB_PWR_OFF);
+ return rockchip_emmc_phy_power(phy, PHYCTRL_PDB_PWR_OFF);
}
static int rockchip_emmc_phy_power_on(struct phy *phy)
{
struct rockchip_emmc_phy *rk_phy = phy_get_drvdata(phy);
- /* DLL operation: 200 MHz */
- regmap_write(rk_phy->reg_base,
- rk_phy->reg_offset + GRF_EMMCPHY_CON0,
- HIWORD_UPDATE(PHYCTRL_FREQSEL_200M,
- PHYCTRL_FREQSEL_MASK,
- PHYCTRL_FREQSEL_SHIFT));
-
/* Drive impedance: 50 Ohm */
regmap_write(rk_phy->reg_base,
rk_phy->reg_offset + GRF_EMMCPHY_CON6,
@@ -207,7 +263,7 @@ static int rockchip_emmc_phy_power_on(struct phy *phy)
PHYCTRL_OTAPDLYSEL_SHIFT));
/* Power up emmc phy analog blocks */
- return rockchip_emmc_phy_power(rk_phy, PHYCTRL_PDB_PWR_ON);
+ return rockchip_emmc_phy_power(phy, PHYCTRL_PDB_PWR_ON);
}
static const struct phy_ops ops = {
--
2.8.0.rc3.226.g39d4020
^ permalink raw reply related [flat|nested] 78+ messages in thread* [PATCH v2 10/11] phy: rockchip-emmc: Set phyctrl_frqsel based on card clock
@ 2016-06-13 23:04 ` Douglas Anderson
0 siblings, 0 replies; 78+ messages in thread
From: Douglas Anderson @ 2016-06-13 23:04 UTC (permalink / raw)
To: linux-arm-kernel
The "phyctrl_frqsel" is described in the Arasan datasheet [1] as "the
frequency range of DLL operation". Although the Rockchip variant of
this PHY has different ranges than the reference Arasan PHY it appears
as if the functionality is similar. We should set this phyctrl field
properly.
Note: as per Rockchip engineers, apparently the "phyctrl_frqsel" is
actually only useful in HS200 / HS400 modes even though the DLL itself
it used for some purposes in all modes. See the discussion in the
earlier change in this series: ("mmc: sdhci-of-arasan: Always power the
PHY off/on when clock changes"). In any case, it shouldn't hurt to set
this always.
Note that this change should allow boards to run at HS200 / HS400 speed
modes while running at 100 MHz or 150 MHz. In fact, running HS400 at
150 MHz (giving 300 MB/s) is the main motivation of this series, since
performance is still good but signal integrity problems are less
prevelant at 150 MHz.
[1]: https://arasan.com/wp-content/media/eMMC-5-1-Total-Solution_Rev-1-3.pdf
Signed-off-by: Douglas Anderson <dianders@chromium.org>
---
Changes in v2:
- Warn if we're more than 15 MHz from ideal rate (Shawn)
- Move code cleanup before set phyctrl_frqsel based on card clock (Shawn)
- Fix typo USB => SDHCI (Shawn)
drivers/phy/phy-rockchip-emmc.c | 82 ++++++++++++++++++++++++++++++++++-------
1 file changed, 69 insertions(+), 13 deletions(-)
diff --git a/drivers/phy/phy-rockchip-emmc.c b/drivers/phy/phy-rockchip-emmc.c
index 23fe50864526..51ddd543fd04 100644
--- a/drivers/phy/phy-rockchip-emmc.c
+++ b/drivers/phy/phy-rockchip-emmc.c
@@ -14,6 +14,7 @@
* GNU General Public License for more details.
*/
+#include <linux/clk.h>
#include <linux/delay.h>
#include <linux/mfd/syscon.h>
#include <linux/module.h>
@@ -78,16 +79,73 @@
struct rockchip_emmc_phy {
unsigned int reg_offset;
struct regmap *reg_base;
+ struct clk *emmcclk;
};
-static int rockchip_emmc_phy_power(struct rockchip_emmc_phy *rk_phy,
- bool on_off)
+static int rockchip_emmc_phy_power(struct phy *phy, bool on_off)
{
+ struct rockchip_emmc_phy *rk_phy = phy_get_drvdata(phy);
unsigned int caldone;
unsigned int dllrdy;
+ unsigned int freqsel = PHYCTRL_FREQSEL_200M;
unsigned long timeout;
/*
+ * We purposely get the clock here and not in probe to avoid the
+ * circular dependency problem. We expect:
+ * - PHY driver to probe
+ * - SDHCI driver to start probe
+ * - SDHCI driver to register it's clock
+ * - SDHCI driver to get the PHY
+ * - SDHCI driver to power on the PHY
+ */
+ if (!rk_phy->emmcclk) {
+ rk_phy->emmcclk = devm_clk_get(&phy->dev, "emmcclk");
+
+ /* Don't expect defer at this point; try next time */
+ if (PTR_ERR(rk_phy->emmcclk) == -EPROBE_DEFER) {
+ dev_warn(&phy->dev, "Unexpected emmcclk defer\n");
+ rk_phy->emmcclk = NULL;
+ }
+ }
+
+ if (!IS_ERR_OR_NULL(rk_phy->emmcclk)) {
+ unsigned long rate = clk_get_rate(rk_phy->emmcclk);
+ unsigned long ideal_rate;
+ unsigned long diff;
+
+ switch (rate) {
+ case 0 ... 74999999:
+ ideal_rate = 50000000;
+ freqsel = PHYCTRL_FREQSEL_50M;
+ break;
+ case 75000000 ... 124999999:
+ ideal_rate = 100000000;
+ freqsel = PHYCTRL_FREQSEL_100M;
+ break;
+ case 125000000 ... 174999999:
+ ideal_rate = 150000000;
+ freqsel = PHYCTRL_FREQSEL_150M;
+ break;
+ default:
+ ideal_rate = 200000000;
+ break;
+ };
+
+ diff = (rate > ideal_rate) ?
+ rate - ideal_rate : ideal_rate - rate;
+
+ /*
+ * In order for tuning delays to be accurate we need to be
+ * pretty spot on for the DLL range, so warn if we're too
+ * far off. Also warn if we're above the 200 MHz max. Don't
+ * warn for really slow rates since we won't be tuning then.
+ */
+ if ((rate > 50000000 && diff > 15000000) || (rate > 200000000))
+ dev_warn(&phy->dev, "Unsupported rate: %lu\n", rate);
+ }
+
+ /*
* Keep phyctrl_pdb and phyctrl_endll low to allow
* initialization of CALIO state M/C DFFs
*/
@@ -132,6 +190,13 @@ static int rockchip_emmc_phy_power(struct rockchip_emmc_phy *rk_phy,
return -ETIMEDOUT;
}
+ /* Set the frequency of the DLL operation */
+ regmap_write(rk_phy->reg_base,
+ rk_phy->reg_offset + GRF_EMMCPHY_CON0,
+ HIWORD_UPDATE(freqsel, PHYCTRL_FREQSEL_MASK,
+ PHYCTRL_FREQSEL_SHIFT));
+
+ /* Turn on the DLL */
regmap_write(rk_phy->reg_base,
rk_phy->reg_offset + GRF_EMMCPHY_CON6,
HIWORD_UPDATE(PHYCTRL_ENDLL_ENABLE,
@@ -168,23 +233,14 @@ static int rockchip_emmc_phy_power(struct rockchip_emmc_phy *rk_phy,
static int rockchip_emmc_phy_power_off(struct phy *phy)
{
- struct rockchip_emmc_phy *rk_phy = phy_get_drvdata(phy);
-
/* Power down emmc phy analog blocks */
- return rockchip_emmc_phy_power(rk_phy, PHYCTRL_PDB_PWR_OFF);
+ return rockchip_emmc_phy_power(phy, PHYCTRL_PDB_PWR_OFF);
}
static int rockchip_emmc_phy_power_on(struct phy *phy)
{
struct rockchip_emmc_phy *rk_phy = phy_get_drvdata(phy);
- /* DLL operation: 200 MHz */
- regmap_write(rk_phy->reg_base,
- rk_phy->reg_offset + GRF_EMMCPHY_CON0,
- HIWORD_UPDATE(PHYCTRL_FREQSEL_200M,
- PHYCTRL_FREQSEL_MASK,
- PHYCTRL_FREQSEL_SHIFT));
-
/* Drive impedance: 50 Ohm */
regmap_write(rk_phy->reg_base,
rk_phy->reg_offset + GRF_EMMCPHY_CON6,
@@ -207,7 +263,7 @@ static int rockchip_emmc_phy_power_on(struct phy *phy)
PHYCTRL_OTAPDLYSEL_SHIFT));
/* Power up emmc phy analog blocks */
- return rockchip_emmc_phy_power(rk_phy, PHYCTRL_PDB_PWR_ON);
+ return rockchip_emmc_phy_power(phy, PHYCTRL_PDB_PWR_ON);
}
static const struct phy_ops ops = {
--
2.8.0.rc3.226.g39d4020
^ permalink raw reply related [flat|nested] 78+ messages in thread[parent not found: <1465859076-4868-11-git-send-email-dianders-F7+t8E8rja9g9hUCZPvPmw@public.gmane.org>]
* Re: [PATCH v2 10/11] phy: rockchip-emmc: Set phyctrl_frqsel based on card clock
2016-06-13 23:04 ` Douglas Anderson
(?)
@ 2016-06-18 12:20 ` Heiko Stübner
-1 siblings, 0 replies; 78+ messages in thread
From: Heiko Stübner @ 2016-06-18 12:20 UTC (permalink / raw)
To: Douglas Anderson
Cc: devicetree-u79uwXL29TY76Z2rM5mHXA,
ulf.hansson-QSEj5FYQhm4dnm+yROfE0A, xzy.xu-TNX95d0MmH7DzftRWevZcw,
linux-kernel-u79uwXL29TY76Z2rM5mHXA,
shawn.lin-TNX95d0MmH7DzftRWevZcw,
briannorris-F7+t8E8rja9g9hUCZPvPmw,
linux-mmc-u79uwXL29TY76Z2rM5mHXA,
adrian.hunter-ral2JQCrhuEAvxtiuMwx3w, kishon-l0cyMroinI0,
linux-rockchip-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r,
robh+dt-DgEjT+Ai2ygdnm+yROfE0A,
linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r
Am Montag, 13. Juni 2016, 16:04:34 schrieb Douglas Anderson:
> The "phyctrl_frqsel" is described in the Arasan datasheet [1] as "the
> frequency range of DLL operation". Although the Rockchip variant of
> this PHY has different ranges than the reference Arasan PHY it appears
> as if the functionality is similar. We should set this phyctrl field
> properly.
>
> Note: as per Rockchip engineers, apparently the "phyctrl_frqsel" is
> actually only useful in HS200 / HS400 modes even though the DLL itself
> it used for some purposes in all modes. See the discussion in the
> earlier change in this series: ("mmc: sdhci-of-arasan: Always power the
> PHY off/on when clock changes"). In any case, it shouldn't hurt to set
> this always.
>
> Note that this change should allow boards to run at HS200 / HS400 speed
> modes while running at 100 MHz or 150 MHz. In fact, running HS400 at
> 150 MHz (giving 300 MB/s) is the main motivation of this series, since
> performance is still good but signal integrity problems are less
> prevelant at 150 MHz.
>
> [1]: https://arasan.com/wp-content/media/eMMC-5-1-Total-Solution_Rev-1-3.pdf
>
> Signed-off-by: Douglas Anderson <dianders-F7+t8E8rja9g9hUCZPvPmw@public.gmane.org>
> ---
> Changes in v2:
> - Warn if we're more than 15 MHz from ideal rate (Shawn)
> - Move code cleanup before set phyctrl_frqsel based on card clock (Shawn)
> - Fix typo USB => SDHCI (Shawn)
>
> drivers/phy/phy-rockchip-emmc.c | 82
> ++++++++++++++++++++++++++++++++++------- 1 file changed, 69 insertions(+),
> 13 deletions(-)
>
> diff --git a/drivers/phy/phy-rockchip-emmc.c
> b/drivers/phy/phy-rockchip-emmc.c index 23fe50864526..51ddd543fd04 100644
> --- a/drivers/phy/phy-rockchip-emmc.c
> +++ b/drivers/phy/phy-rockchip-emmc.c
> @@ -14,6 +14,7 @@
> * GNU General Public License for more details.
> */
>
> +#include <linux/clk.h>
> #include <linux/delay.h>
> #include <linux/mfd/syscon.h>
> #include <linux/module.h>
> @@ -78,16 +79,73 @@
> struct rockchip_emmc_phy {
> unsigned int reg_offset;
> struct regmap *reg_base;
> + struct clk *emmcclk;
> };
>
> -static int rockchip_emmc_phy_power(struct rockchip_emmc_phy *rk_phy,
> - bool on_off)
> +static int rockchip_emmc_phy_power(struct phy *phy, bool on_off)
> {
> + struct rockchip_emmc_phy *rk_phy = phy_get_drvdata(phy);
> unsigned int caldone;
> unsigned int dllrdy;
> + unsigned int freqsel = PHYCTRL_FREQSEL_200M;
> unsigned long timeout;
>
> /*
> + * We purposely get the clock here and not in probe to avoid the
> + * circular dependency problem. We expect:
> + * - PHY driver to probe
> + * - SDHCI driver to start probe
> + * - SDHCI driver to register it's clock
> + * - SDHCI driver to get the PHY
> + * - SDHCI driver to power on the PHY
> + */
Doesn't that leave open the unbind / removal case with that same circular
dependency? While true that the clock-framework does some special handling on
clk_unregister, I don't think this would catch multiple unbind/bind actions.
The emmc-phy would still hold on to the old clock-instance with the empty clk-
ops the ccf assigns, even when the rebind of the arasan-sdhci would create a
new clock.
How about using phy-init / phy-exit callbacks for that instead? (Aka clk_get
and clk_put the emmc clock in there instead of using the devm variant)
> + if (!rk_phy->emmcclk) {
> + rk_phy->emmcclk = devm_clk_get(&phy->dev, "emmcclk");
> +
> + /* Don't expect defer at this point; try next time */
> + if (PTR_ERR(rk_phy->emmcclk) == -EPROBE_DEFER) {
> + dev_warn(&phy->dev, "Unexpected emmcclk defer\n");
> + rk_phy->emmcclk = NULL;
> + }
> + }
> +
> + if (!IS_ERR_OR_NULL(rk_phy->emmcclk)) {
you just made it NULL in the error case above?
Heiko
^ permalink raw reply [flat|nested] 78+ messages in thread* Re: [PATCH v2 10/11] phy: rockchip-emmc: Set phyctrl_frqsel based on card clock
@ 2016-06-18 12:20 ` Heiko Stübner
0 siblings, 0 replies; 78+ messages in thread
From: Heiko Stübner @ 2016-06-18 12:20 UTC (permalink / raw)
To: Douglas Anderson
Cc: ulf.hansson, kishon, robh+dt, shawn.lin, xzy.xu, briannorris,
adrian.hunter, linux-rockchip, linux-mmc, devicetree,
linux-kernel, linux-arm-kernel
Am Montag, 13. Juni 2016, 16:04:34 schrieb Douglas Anderson:
> The "phyctrl_frqsel" is described in the Arasan datasheet [1] as "the
> frequency range of DLL operation". Although the Rockchip variant of
> this PHY has different ranges than the reference Arasan PHY it appears
> as if the functionality is similar. We should set this phyctrl field
> properly.
>
> Note: as per Rockchip engineers, apparently the "phyctrl_frqsel" is
> actually only useful in HS200 / HS400 modes even though the DLL itself
> it used for some purposes in all modes. See the discussion in the
> earlier change in this series: ("mmc: sdhci-of-arasan: Always power the
> PHY off/on when clock changes"). In any case, it shouldn't hurt to set
> this always.
>
> Note that this change should allow boards to run at HS200 / HS400 speed
> modes while running at 100 MHz or 150 MHz. In fact, running HS400 at
> 150 MHz (giving 300 MB/s) is the main motivation of this series, since
> performance is still good but signal integrity problems are less
> prevelant at 150 MHz.
>
> [1]: https://arasan.com/wp-content/media/eMMC-5-1-Total-Solution_Rev-1-3.pdf
>
> Signed-off-by: Douglas Anderson <dianders@chromium.org>
> ---
> Changes in v2:
> - Warn if we're more than 15 MHz from ideal rate (Shawn)
> - Move code cleanup before set phyctrl_frqsel based on card clock (Shawn)
> - Fix typo USB => SDHCI (Shawn)
>
> drivers/phy/phy-rockchip-emmc.c | 82
> ++++++++++++++++++++++++++++++++++------- 1 file changed, 69 insertions(+),
> 13 deletions(-)
>
> diff --git a/drivers/phy/phy-rockchip-emmc.c
> b/drivers/phy/phy-rockchip-emmc.c index 23fe50864526..51ddd543fd04 100644
> --- a/drivers/phy/phy-rockchip-emmc.c
> +++ b/drivers/phy/phy-rockchip-emmc.c
> @@ -14,6 +14,7 @@
> * GNU General Public License for more details.
> */
>
> +#include <linux/clk.h>
> #include <linux/delay.h>
> #include <linux/mfd/syscon.h>
> #include <linux/module.h>
> @@ -78,16 +79,73 @@
> struct rockchip_emmc_phy {
> unsigned int reg_offset;
> struct regmap *reg_base;
> + struct clk *emmcclk;
> };
>
> -static int rockchip_emmc_phy_power(struct rockchip_emmc_phy *rk_phy,
> - bool on_off)
> +static int rockchip_emmc_phy_power(struct phy *phy, bool on_off)
> {
> + struct rockchip_emmc_phy *rk_phy = phy_get_drvdata(phy);
> unsigned int caldone;
> unsigned int dllrdy;
> + unsigned int freqsel = PHYCTRL_FREQSEL_200M;
> unsigned long timeout;
>
> /*
> + * We purposely get the clock here and not in probe to avoid the
> + * circular dependency problem. We expect:
> + * - PHY driver to probe
> + * - SDHCI driver to start probe
> + * - SDHCI driver to register it's clock
> + * - SDHCI driver to get the PHY
> + * - SDHCI driver to power on the PHY
> + */
Doesn't that leave open the unbind / removal case with that same circular
dependency? While true that the clock-framework does some special handling on
clk_unregister, I don't think this would catch multiple unbind/bind actions.
The emmc-phy would still hold on to the old clock-instance with the empty clk-
ops the ccf assigns, even when the rebind of the arasan-sdhci would create a
new clock.
How about using phy-init / phy-exit callbacks for that instead? (Aka clk_get
and clk_put the emmc clock in there instead of using the devm variant)
> + if (!rk_phy->emmcclk) {
> + rk_phy->emmcclk = devm_clk_get(&phy->dev, "emmcclk");
> +
> + /* Don't expect defer at this point; try next time */
> + if (PTR_ERR(rk_phy->emmcclk) == -EPROBE_DEFER) {
> + dev_warn(&phy->dev, "Unexpected emmcclk defer\n");
> + rk_phy->emmcclk = NULL;
> + }
> + }
> +
> + if (!IS_ERR_OR_NULL(rk_phy->emmcclk)) {
you just made it NULL in the error case above?
Heiko
^ permalink raw reply [flat|nested] 78+ messages in thread* [PATCH v2 10/11] phy: rockchip-emmc: Set phyctrl_frqsel based on card clock
@ 2016-06-18 12:20 ` Heiko Stübner
0 siblings, 0 replies; 78+ messages in thread
From: Heiko Stübner @ 2016-06-18 12:20 UTC (permalink / raw)
To: linux-arm-kernel
Am Montag, 13. Juni 2016, 16:04:34 schrieb Douglas Anderson:
> The "phyctrl_frqsel" is described in the Arasan datasheet [1] as "the
> frequency range of DLL operation". Although the Rockchip variant of
> this PHY has different ranges than the reference Arasan PHY it appears
> as if the functionality is similar. We should set this phyctrl field
> properly.
>
> Note: as per Rockchip engineers, apparently the "phyctrl_frqsel" is
> actually only useful in HS200 / HS400 modes even though the DLL itself
> it used for some purposes in all modes. See the discussion in the
> earlier change in this series: ("mmc: sdhci-of-arasan: Always power the
> PHY off/on when clock changes"). In any case, it shouldn't hurt to set
> this always.
>
> Note that this change should allow boards to run at HS200 / HS400 speed
> modes while running at 100 MHz or 150 MHz. In fact, running HS400 at
> 150 MHz (giving 300 MB/s) is the main motivation of this series, since
> performance is still good but signal integrity problems are less
> prevelant at 150 MHz.
>
> [1]: https://arasan.com/wp-content/media/eMMC-5-1-Total-Solution_Rev-1-3.pdf
>
> Signed-off-by: Douglas Anderson <dianders@chromium.org>
> ---
> Changes in v2:
> - Warn if we're more than 15 MHz from ideal rate (Shawn)
> - Move code cleanup before set phyctrl_frqsel based on card clock (Shawn)
> - Fix typo USB => SDHCI (Shawn)
>
> drivers/phy/phy-rockchip-emmc.c | 82
> ++++++++++++++++++++++++++++++++++------- 1 file changed, 69 insertions(+),
> 13 deletions(-)
>
> diff --git a/drivers/phy/phy-rockchip-emmc.c
> b/drivers/phy/phy-rockchip-emmc.c index 23fe50864526..51ddd543fd04 100644
> --- a/drivers/phy/phy-rockchip-emmc.c
> +++ b/drivers/phy/phy-rockchip-emmc.c
> @@ -14,6 +14,7 @@
> * GNU General Public License for more details.
> */
>
> +#include <linux/clk.h>
> #include <linux/delay.h>
> #include <linux/mfd/syscon.h>
> #include <linux/module.h>
> @@ -78,16 +79,73 @@
> struct rockchip_emmc_phy {
> unsigned int reg_offset;
> struct regmap *reg_base;
> + struct clk *emmcclk;
> };
>
> -static int rockchip_emmc_phy_power(struct rockchip_emmc_phy *rk_phy,
> - bool on_off)
> +static int rockchip_emmc_phy_power(struct phy *phy, bool on_off)
> {
> + struct rockchip_emmc_phy *rk_phy = phy_get_drvdata(phy);
> unsigned int caldone;
> unsigned int dllrdy;
> + unsigned int freqsel = PHYCTRL_FREQSEL_200M;
> unsigned long timeout;
>
> /*
> + * We purposely get the clock here and not in probe to avoid the
> + * circular dependency problem. We expect:
> + * - PHY driver to probe
> + * - SDHCI driver to start probe
> + * - SDHCI driver to register it's clock
> + * - SDHCI driver to get the PHY
> + * - SDHCI driver to power on the PHY
> + */
Doesn't that leave open the unbind / removal case with that same circular
dependency? While true that the clock-framework does some special handling on
clk_unregister, I don't think this would catch multiple unbind/bind actions.
The emmc-phy would still hold on to the old clock-instance with the empty clk-
ops the ccf assigns, even when the rebind of the arasan-sdhci would create a
new clock.
How about using phy-init / phy-exit callbacks for that instead? (Aka clk_get
and clk_put the emmc clock in there instead of using the devm variant)
> + if (!rk_phy->emmcclk) {
> + rk_phy->emmcclk = devm_clk_get(&phy->dev, "emmcclk");
> +
> + /* Don't expect defer at this point; try next time */
> + if (PTR_ERR(rk_phy->emmcclk) == -EPROBE_DEFER) {
> + dev_warn(&phy->dev, "Unexpected emmcclk defer\n");
> + rk_phy->emmcclk = NULL;
> + }
> + }
> +
> + if (!IS_ERR_OR_NULL(rk_phy->emmcclk)) {
you just made it NULL in the error case above?
Heiko
^ permalink raw reply [flat|nested] 78+ messages in thread* Re: [PATCH v2 10/11] phy: rockchip-emmc: Set phyctrl_frqsel based on card clock
2016-06-18 12:20 ` Heiko Stübner
(?)
@ 2016-06-20 16:48 ` Doug Anderson
-1 siblings, 0 replies; 78+ messages in thread
From: Doug Anderson @ 2016-06-20 16:48 UTC (permalink / raw)
To: Heiko Stübner
Cc: devicetree-u79uwXL29TY76Z2rM5mHXA@public.gmane.org, Ulf Hansson,
Ziyuan Xu, linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
Shawn Lin, Brian Norris,
linux-mmc-u79uwXL29TY76Z2rM5mHXA@public.gmane.org, Adrian Hunter,
Kishon Vijay Abraham I, open list:ARM/Rockchip SoC...,
Rob Herring,
linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org
Heiko,
On Sat, Jun 18, 2016 at 5:20 AM, Heiko Stübner <heiko@sntech.de> wrote:
> Am Montag, 13. Juni 2016, 16:04:34 schrieb Douglas Anderson:
>> The "phyctrl_frqsel" is described in the Arasan datasheet [1] as "the
>> frequency range of DLL operation". Although the Rockchip variant of
>> this PHY has different ranges than the reference Arasan PHY it appears
>> as if the functionality is similar. We should set this phyctrl field
>> properly.
>>
>> Note: as per Rockchip engineers, apparently the "phyctrl_frqsel" is
>> actually only useful in HS200 / HS400 modes even though the DLL itself
>> it used for some purposes in all modes. See the discussion in the
>> earlier change in this series: ("mmc: sdhci-of-arasan: Always power the
>> PHY off/on when clock changes"). In any case, it shouldn't hurt to set
>> this always.
>>
>> Note that this change should allow boards to run at HS200 / HS400 speed
>> modes while running at 100 MHz or 150 MHz. In fact, running HS400 at
>> 150 MHz (giving 300 MB/s) is the main motivation of this series, since
>> performance is still good but signal integrity problems are less
>> prevelant at 150 MHz.
>>
>> [1]: https://arasan.com/wp-content/media/eMMC-5-1-Total-Solution_Rev-1-3.pdf
>>
>> Signed-off-by: Douglas Anderson <dianders@chromium.org>
>> ---
>> Changes in v2:
>> - Warn if we're more than 15 MHz from ideal rate (Shawn)
>> - Move code cleanup before set phyctrl_frqsel based on card clock (Shawn)
>> - Fix typo USB => SDHCI (Shawn)
>>
>> drivers/phy/phy-rockchip-emmc.c | 82
>> ++++++++++++++++++++++++++++++++++------- 1 file changed, 69 insertions(+),
>> 13 deletions(-)
>>
>> diff --git a/drivers/phy/phy-rockchip-emmc.c
>> b/drivers/phy/phy-rockchip-emmc.c index 23fe50864526..51ddd543fd04 100644
>> --- a/drivers/phy/phy-rockchip-emmc.c
>> +++ b/drivers/phy/phy-rockchip-emmc.c
>> @@ -14,6 +14,7 @@
>> * GNU General Public License for more details.
>> */
>>
>> +#include <linux/clk.h>
>> #include <linux/delay.h>
>> #include <linux/mfd/syscon.h>
>> #include <linux/module.h>
>> @@ -78,16 +79,73 @@
>> struct rockchip_emmc_phy {
>> unsigned int reg_offset;
>> struct regmap *reg_base;
>> + struct clk *emmcclk;
>> };
>>
>> -static int rockchip_emmc_phy_power(struct rockchip_emmc_phy *rk_phy,
>> - bool on_off)
>> +static int rockchip_emmc_phy_power(struct phy *phy, bool on_off)
>> {
>> + struct rockchip_emmc_phy *rk_phy = phy_get_drvdata(phy);
>> unsigned int caldone;
>> unsigned int dllrdy;
>> + unsigned int freqsel = PHYCTRL_FREQSEL_200M;
>> unsigned long timeout;
>>
>> /*
>> + * We purposely get the clock here and not in probe to avoid the
>> + * circular dependency problem. We expect:
>> + * - PHY driver to probe
>> + * - SDHCI driver to start probe
>> + * - SDHCI driver to register it's clock
>> + * - SDHCI driver to get the PHY
>> + * - SDHCI driver to power on the PHY
>> + */
>
> Doesn't that leave open the unbind / removal case with that same circular
> dependency? While true that the clock-framework does some special handling on
> clk_unregister, I don't think this would catch multiple unbind/bind actions.
>
> The emmc-phy would still hold on to the old clock-instance with the empty clk-
> ops the ccf assigns, even when the rebind of the arasan-sdhci would create a
> new clock.
>
> How about using phy-init / phy-exit callbacks for that instead? (Aka clk_get
> and clk_put the emmc clock in there instead of using the devm variant)
Using phy-init and phy-exit is perfect. I'll spin shortly.
>> + if (!rk_phy->emmcclk) {
>> + rk_phy->emmcclk = devm_clk_get(&phy->dev, "emmcclk");
>> +
>> + /* Don't expect defer at this point; try next time */
>> + if (PTR_ERR(rk_phy->emmcclk) == -EPROBE_DEFER) {
>> + dev_warn(&phy->dev, "Unexpected emmcclk defer\n");
>> + rk_phy->emmcclk = NULL;
>> + }
>> + }
>> +
>> + if (!IS_ERR_OR_NULL(rk_phy->emmcclk)) {
>
> you just made it NULL in the error case above?
Yeah. The idea was the if we happened to get a EPROBE_DEFER (should
never happen) we would continue on and just skip this part. In any
case, should be a moot point with the new version, which I'll send out
soon.
-Doug
_______________________________________________
Linux-rockchip mailing list
Linux-rockchip@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-rockchip
^ permalink raw reply [flat|nested] 78+ messages in thread* Re: [PATCH v2 10/11] phy: rockchip-emmc: Set phyctrl_frqsel based on card clock
@ 2016-06-20 16:48 ` Doug Anderson
0 siblings, 0 replies; 78+ messages in thread
From: Doug Anderson @ 2016-06-20 16:48 UTC (permalink / raw)
To: Heiko Stübner
Cc: Ulf Hansson, Kishon Vijay Abraham I, Rob Herring, Shawn Lin,
Ziyuan Xu, Brian Norris, Adrian Hunter,
open list:ARM/Rockchip SoC..., linux-mmc@vger.kernel.org,
devicetree@vger.kernel.org, linux-kernel@vger.kernel.org,
linux-arm-kernel@lists.infradead.org
Heiko,
On Sat, Jun 18, 2016 at 5:20 AM, Heiko Stübner <heiko@sntech.de> wrote:
> Am Montag, 13. Juni 2016, 16:04:34 schrieb Douglas Anderson:
>> The "phyctrl_frqsel" is described in the Arasan datasheet [1] as "the
>> frequency range of DLL operation". Although the Rockchip variant of
>> this PHY has different ranges than the reference Arasan PHY it appears
>> as if the functionality is similar. We should set this phyctrl field
>> properly.
>>
>> Note: as per Rockchip engineers, apparently the "phyctrl_frqsel" is
>> actually only useful in HS200 / HS400 modes even though the DLL itself
>> it used for some purposes in all modes. See the discussion in the
>> earlier change in this series: ("mmc: sdhci-of-arasan: Always power the
>> PHY off/on when clock changes"). In any case, it shouldn't hurt to set
>> this always.
>>
>> Note that this change should allow boards to run at HS200 / HS400 speed
>> modes while running at 100 MHz or 150 MHz. In fact, running HS400 at
>> 150 MHz (giving 300 MB/s) is the main motivation of this series, since
>> performance is still good but signal integrity problems are less
>> prevelant at 150 MHz.
>>
>> [1]: https://arasan.com/wp-content/media/eMMC-5-1-Total-Solution_Rev-1-3.pdf
>>
>> Signed-off-by: Douglas Anderson <dianders@chromium.org>
>> ---
>> Changes in v2:
>> - Warn if we're more than 15 MHz from ideal rate (Shawn)
>> - Move code cleanup before set phyctrl_frqsel based on card clock (Shawn)
>> - Fix typo USB => SDHCI (Shawn)
>>
>> drivers/phy/phy-rockchip-emmc.c | 82
>> ++++++++++++++++++++++++++++++++++------- 1 file changed, 69 insertions(+),
>> 13 deletions(-)
>>
>> diff --git a/drivers/phy/phy-rockchip-emmc.c
>> b/drivers/phy/phy-rockchip-emmc.c index 23fe50864526..51ddd543fd04 100644
>> --- a/drivers/phy/phy-rockchip-emmc.c
>> +++ b/drivers/phy/phy-rockchip-emmc.c
>> @@ -14,6 +14,7 @@
>> * GNU General Public License for more details.
>> */
>>
>> +#include <linux/clk.h>
>> #include <linux/delay.h>
>> #include <linux/mfd/syscon.h>
>> #include <linux/module.h>
>> @@ -78,16 +79,73 @@
>> struct rockchip_emmc_phy {
>> unsigned int reg_offset;
>> struct regmap *reg_base;
>> + struct clk *emmcclk;
>> };
>>
>> -static int rockchip_emmc_phy_power(struct rockchip_emmc_phy *rk_phy,
>> - bool on_off)
>> +static int rockchip_emmc_phy_power(struct phy *phy, bool on_off)
>> {
>> + struct rockchip_emmc_phy *rk_phy = phy_get_drvdata(phy);
>> unsigned int caldone;
>> unsigned int dllrdy;
>> + unsigned int freqsel = PHYCTRL_FREQSEL_200M;
>> unsigned long timeout;
>>
>> /*
>> + * We purposely get the clock here and not in probe to avoid the
>> + * circular dependency problem. We expect:
>> + * - PHY driver to probe
>> + * - SDHCI driver to start probe
>> + * - SDHCI driver to register it's clock
>> + * - SDHCI driver to get the PHY
>> + * - SDHCI driver to power on the PHY
>> + */
>
> Doesn't that leave open the unbind / removal case with that same circular
> dependency? While true that the clock-framework does some special handling on
> clk_unregister, I don't think this would catch multiple unbind/bind actions.
>
> The emmc-phy would still hold on to the old clock-instance with the empty clk-
> ops the ccf assigns, even when the rebind of the arasan-sdhci would create a
> new clock.
>
> How about using phy-init / phy-exit callbacks for that instead? (Aka clk_get
> and clk_put the emmc clock in there instead of using the devm variant)
Using phy-init and phy-exit is perfect. I'll spin shortly.
>> + if (!rk_phy->emmcclk) {
>> + rk_phy->emmcclk = devm_clk_get(&phy->dev, "emmcclk");
>> +
>> + /* Don't expect defer at this point; try next time */
>> + if (PTR_ERR(rk_phy->emmcclk) == -EPROBE_DEFER) {
>> + dev_warn(&phy->dev, "Unexpected emmcclk defer\n");
>> + rk_phy->emmcclk = NULL;
>> + }
>> + }
>> +
>> + if (!IS_ERR_OR_NULL(rk_phy->emmcclk)) {
>
> you just made it NULL in the error case above?
Yeah. The idea was the if we happened to get a EPROBE_DEFER (should
never happen) we would continue on and just skip this part. In any
case, should be a moot point with the new version, which I'll send out
soon.
-Doug
^ permalink raw reply [flat|nested] 78+ messages in thread* [PATCH v2 10/11] phy: rockchip-emmc: Set phyctrl_frqsel based on card clock
@ 2016-06-20 16:48 ` Doug Anderson
0 siblings, 0 replies; 78+ messages in thread
From: Doug Anderson @ 2016-06-20 16:48 UTC (permalink / raw)
To: linux-arm-kernel
Heiko,
On Sat, Jun 18, 2016 at 5:20 AM, Heiko St?bner <heiko@sntech.de> wrote:
> Am Montag, 13. Juni 2016, 16:04:34 schrieb Douglas Anderson:
>> The "phyctrl_frqsel" is described in the Arasan datasheet [1] as "the
>> frequency range of DLL operation". Although the Rockchip variant of
>> this PHY has different ranges than the reference Arasan PHY it appears
>> as if the functionality is similar. We should set this phyctrl field
>> properly.
>>
>> Note: as per Rockchip engineers, apparently the "phyctrl_frqsel" is
>> actually only useful in HS200 / HS400 modes even though the DLL itself
>> it used for some purposes in all modes. See the discussion in the
>> earlier change in this series: ("mmc: sdhci-of-arasan: Always power the
>> PHY off/on when clock changes"). In any case, it shouldn't hurt to set
>> this always.
>>
>> Note that this change should allow boards to run at HS200 / HS400 speed
>> modes while running at 100 MHz or 150 MHz. In fact, running HS400 at
>> 150 MHz (giving 300 MB/s) is the main motivation of this series, since
>> performance is still good but signal integrity problems are less
>> prevelant at 150 MHz.
>>
>> [1]: https://arasan.com/wp-content/media/eMMC-5-1-Total-Solution_Rev-1-3.pdf
>>
>> Signed-off-by: Douglas Anderson <dianders@chromium.org>
>> ---
>> Changes in v2:
>> - Warn if we're more than 15 MHz from ideal rate (Shawn)
>> - Move code cleanup before set phyctrl_frqsel based on card clock (Shawn)
>> - Fix typo USB => SDHCI (Shawn)
>>
>> drivers/phy/phy-rockchip-emmc.c | 82
>> ++++++++++++++++++++++++++++++++++------- 1 file changed, 69 insertions(+),
>> 13 deletions(-)
>>
>> diff --git a/drivers/phy/phy-rockchip-emmc.c
>> b/drivers/phy/phy-rockchip-emmc.c index 23fe50864526..51ddd543fd04 100644
>> --- a/drivers/phy/phy-rockchip-emmc.c
>> +++ b/drivers/phy/phy-rockchip-emmc.c
>> @@ -14,6 +14,7 @@
>> * GNU General Public License for more details.
>> */
>>
>> +#include <linux/clk.h>
>> #include <linux/delay.h>
>> #include <linux/mfd/syscon.h>
>> #include <linux/module.h>
>> @@ -78,16 +79,73 @@
>> struct rockchip_emmc_phy {
>> unsigned int reg_offset;
>> struct regmap *reg_base;
>> + struct clk *emmcclk;
>> };
>>
>> -static int rockchip_emmc_phy_power(struct rockchip_emmc_phy *rk_phy,
>> - bool on_off)
>> +static int rockchip_emmc_phy_power(struct phy *phy, bool on_off)
>> {
>> + struct rockchip_emmc_phy *rk_phy = phy_get_drvdata(phy);
>> unsigned int caldone;
>> unsigned int dllrdy;
>> + unsigned int freqsel = PHYCTRL_FREQSEL_200M;
>> unsigned long timeout;
>>
>> /*
>> + * We purposely get the clock here and not in probe to avoid the
>> + * circular dependency problem. We expect:
>> + * - PHY driver to probe
>> + * - SDHCI driver to start probe
>> + * - SDHCI driver to register it's clock
>> + * - SDHCI driver to get the PHY
>> + * - SDHCI driver to power on the PHY
>> + */
>
> Doesn't that leave open the unbind / removal case with that same circular
> dependency? While true that the clock-framework does some special handling on
> clk_unregister, I don't think this would catch multiple unbind/bind actions.
>
> The emmc-phy would still hold on to the old clock-instance with the empty clk-
> ops the ccf assigns, even when the rebind of the arasan-sdhci would create a
> new clock.
>
> How about using phy-init / phy-exit callbacks for that instead? (Aka clk_get
> and clk_put the emmc clock in there instead of using the devm variant)
Using phy-init and phy-exit is perfect. I'll spin shortly.
>> + if (!rk_phy->emmcclk) {
>> + rk_phy->emmcclk = devm_clk_get(&phy->dev, "emmcclk");
>> +
>> + /* Don't expect defer at this point; try next time */
>> + if (PTR_ERR(rk_phy->emmcclk) == -EPROBE_DEFER) {
>> + dev_warn(&phy->dev, "Unexpected emmcclk defer\n");
>> + rk_phy->emmcclk = NULL;
>> + }
>> + }
>> +
>> + if (!IS_ERR_OR_NULL(rk_phy->emmcclk)) {
>
> you just made it NULL in the error case above?
Yeah. The idea was the if we happened to get a EPROBE_DEFER (should
never happen) we would continue on and just skip this part. In any
case, should be a moot point with the new version, which I'll send out
soon.
-Doug
^ permalink raw reply [flat|nested] 78+ messages in thread
* Re: [PATCH v2 10/11] phy: rockchip-emmc: Set phyctrl_frqsel based on card clock
2016-06-13 23:04 ` Douglas Anderson
(?)
@ 2016-06-20 13:08 ` Kishon Vijay Abraham I
-1 siblings, 0 replies; 78+ messages in thread
From: Kishon Vijay Abraham I @ 2016-06-20 13:08 UTC (permalink / raw)
To: Douglas Anderson, ulf.hansson-QSEj5FYQhm4dnm+yROfE0A,
Heiko Stuebner, robh+dt-DgEjT+Ai2ygdnm+yROfE0A
Cc: devicetree-u79uwXL29TY76Z2rM5mHXA, xzy.xu-TNX95d0MmH7DzftRWevZcw,
shawn.lin-TNX95d0MmH7DzftRWevZcw,
briannorris-F7+t8E8rja9g9hUCZPvPmw,
linux-mmc-u79uwXL29TY76Z2rM5mHXA,
adrian.hunter-ral2JQCrhuEAvxtiuMwx3w,
linux-kernel-u79uwXL29TY76Z2rM5mHXA,
linux-rockchip-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r,
linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r
On Tuesday 14 June 2016 04:34 AM, Douglas Anderson wrote:
> The "phyctrl_frqsel" is described in the Arasan datasheet [1] as "the
> frequency range of DLL operation". Although the Rockchip variant of
> this PHY has different ranges than the reference Arasan PHY it appears
> as if the functionality is similar. We should set this phyctrl field
> properly.
>
> Note: as per Rockchip engineers, apparently the "phyctrl_frqsel" is
> actually only useful in HS200 / HS400 modes even though the DLL itself
> it used for some purposes in all modes. See the discussion in the
> earlier change in this series: ("mmc: sdhci-of-arasan: Always power the
> PHY off/on when clock changes"). In any case, it shouldn't hurt to set
> this always.
>
> Note that this change should allow boards to run at HS200 / HS400 speed
> modes while running at 100 MHz or 150 MHz. In fact, running HS400 at
> 150 MHz (giving 300 MB/s) is the main motivation of this series, since
> performance is still good but signal integrity problems are less
> prevelant at 150 MHz.
>
> [1]: https://arasan.com/wp-content/media/eMMC-5-1-Total-Solution_Rev-1-3.pdf
>
> Signed-off-by: Douglas Anderson <dianders-F7+t8E8rja9g9hUCZPvPmw@public.gmane.org>
Acked-by: Kishon Vijay Abraham I <kishon-l0cyMroinI0@public.gmane.org>
> ---
> Changes in v2:
> - Warn if we're more than 15 MHz from ideal rate (Shawn)
> - Move code cleanup before set phyctrl_frqsel based on card clock (Shawn)
> - Fix typo USB => SDHCI (Shawn)
>
> drivers/phy/phy-rockchip-emmc.c | 82 ++++++++++++++++++++++++++++++++++-------
> 1 file changed, 69 insertions(+), 13 deletions(-)
>
> diff --git a/drivers/phy/phy-rockchip-emmc.c b/drivers/phy/phy-rockchip-emmc.c
> index 23fe50864526..51ddd543fd04 100644
> --- a/drivers/phy/phy-rockchip-emmc.c
> +++ b/drivers/phy/phy-rockchip-emmc.c
> @@ -14,6 +14,7 @@
> * GNU General Public License for more details.
> */
>
> +#include <linux/clk.h>
> #include <linux/delay.h>
> #include <linux/mfd/syscon.h>
> #include <linux/module.h>
> @@ -78,16 +79,73 @@
> struct rockchip_emmc_phy {
> unsigned int reg_offset;
> struct regmap *reg_base;
> + struct clk *emmcclk;
> };
>
> -static int rockchip_emmc_phy_power(struct rockchip_emmc_phy *rk_phy,
> - bool on_off)
> +static int rockchip_emmc_phy_power(struct phy *phy, bool on_off)
> {
> + struct rockchip_emmc_phy *rk_phy = phy_get_drvdata(phy);
> unsigned int caldone;
> unsigned int dllrdy;
> + unsigned int freqsel = PHYCTRL_FREQSEL_200M;
> unsigned long timeout;
>
> /*
> + * We purposely get the clock here and not in probe to avoid the
> + * circular dependency problem. We expect:
> + * - PHY driver to probe
> + * - SDHCI driver to start probe
> + * - SDHCI driver to register it's clock
> + * - SDHCI driver to get the PHY
> + * - SDHCI driver to power on the PHY
> + */
> + if (!rk_phy->emmcclk) {
> + rk_phy->emmcclk = devm_clk_get(&phy->dev, "emmcclk");
> +
> + /* Don't expect defer at this point; try next time */
> + if (PTR_ERR(rk_phy->emmcclk) == -EPROBE_DEFER) {
> + dev_warn(&phy->dev, "Unexpected emmcclk defer\n");
> + rk_phy->emmcclk = NULL;
> + }
> + }
> +
> + if (!IS_ERR_OR_NULL(rk_phy->emmcclk)) {
> + unsigned long rate = clk_get_rate(rk_phy->emmcclk);
> + unsigned long ideal_rate;
> + unsigned long diff;
> +
> + switch (rate) {
> + case 0 ... 74999999:
> + ideal_rate = 50000000;
> + freqsel = PHYCTRL_FREQSEL_50M;
> + break;
> + case 75000000 ... 124999999:
> + ideal_rate = 100000000;
> + freqsel = PHYCTRL_FREQSEL_100M;
> + break;
> + case 125000000 ... 174999999:
> + ideal_rate = 150000000;
> + freqsel = PHYCTRL_FREQSEL_150M;
> + break;
> + default:
> + ideal_rate = 200000000;
> + break;
> + };
> +
> + diff = (rate > ideal_rate) ?
> + rate - ideal_rate : ideal_rate - rate;
> +
> + /*
> + * In order for tuning delays to be accurate we need to be
> + * pretty spot on for the DLL range, so warn if we're too
> + * far off. Also warn if we're above the 200 MHz max. Don't
> + * warn for really slow rates since we won't be tuning then.
> + */
> + if ((rate > 50000000 && diff > 15000000) || (rate > 200000000))
> + dev_warn(&phy->dev, "Unsupported rate: %lu\n", rate);
> + }
> +
> + /*
> * Keep phyctrl_pdb and phyctrl_endll low to allow
> * initialization of CALIO state M/C DFFs
> */
> @@ -132,6 +190,13 @@ static int rockchip_emmc_phy_power(struct rockchip_emmc_phy *rk_phy,
> return -ETIMEDOUT;
> }
>
> + /* Set the frequency of the DLL operation */
> + regmap_write(rk_phy->reg_base,
> + rk_phy->reg_offset + GRF_EMMCPHY_CON0,
> + HIWORD_UPDATE(freqsel, PHYCTRL_FREQSEL_MASK,
> + PHYCTRL_FREQSEL_SHIFT));
> +
> + /* Turn on the DLL */
> regmap_write(rk_phy->reg_base,
> rk_phy->reg_offset + GRF_EMMCPHY_CON6,
> HIWORD_UPDATE(PHYCTRL_ENDLL_ENABLE,
> @@ -168,23 +233,14 @@ static int rockchip_emmc_phy_power(struct rockchip_emmc_phy *rk_phy,
>
> static int rockchip_emmc_phy_power_off(struct phy *phy)
> {
> - struct rockchip_emmc_phy *rk_phy = phy_get_drvdata(phy);
> -
> /* Power down emmc phy analog blocks */
> - return rockchip_emmc_phy_power(rk_phy, PHYCTRL_PDB_PWR_OFF);
> + return rockchip_emmc_phy_power(phy, PHYCTRL_PDB_PWR_OFF);
> }
>
> static int rockchip_emmc_phy_power_on(struct phy *phy)
> {
> struct rockchip_emmc_phy *rk_phy = phy_get_drvdata(phy);
>
> - /* DLL operation: 200 MHz */
> - regmap_write(rk_phy->reg_base,
> - rk_phy->reg_offset + GRF_EMMCPHY_CON0,
> - HIWORD_UPDATE(PHYCTRL_FREQSEL_200M,
> - PHYCTRL_FREQSEL_MASK,
> - PHYCTRL_FREQSEL_SHIFT));
> -
> /* Drive impedance: 50 Ohm */
> regmap_write(rk_phy->reg_base,
> rk_phy->reg_offset + GRF_EMMCPHY_CON6,
> @@ -207,7 +263,7 @@ static int rockchip_emmc_phy_power_on(struct phy *phy)
> PHYCTRL_OTAPDLYSEL_SHIFT));
>
> /* Power up emmc phy analog blocks */
> - return rockchip_emmc_phy_power(rk_phy, PHYCTRL_PDB_PWR_ON);
> + return rockchip_emmc_phy_power(phy, PHYCTRL_PDB_PWR_ON);
> }
>
> static const struct phy_ops ops = {
>
^ permalink raw reply [flat|nested] 78+ messages in thread* Re: [PATCH v2 10/11] phy: rockchip-emmc: Set phyctrl_frqsel based on card clock
@ 2016-06-20 13:08 ` Kishon Vijay Abraham I
0 siblings, 0 replies; 78+ messages in thread
From: Kishon Vijay Abraham I @ 2016-06-20 13:08 UTC (permalink / raw)
To: Douglas Anderson, ulf.hansson, Heiko Stuebner, robh+dt
Cc: shawn.lin, xzy.xu, briannorris, adrian.hunter, linux-rockchip,
linux-mmc, devicetree, linux-kernel, linux-arm-kernel
On Tuesday 14 June 2016 04:34 AM, Douglas Anderson wrote:
> The "phyctrl_frqsel" is described in the Arasan datasheet [1] as "the
> frequency range of DLL operation". Although the Rockchip variant of
> this PHY has different ranges than the reference Arasan PHY it appears
> as if the functionality is similar. We should set this phyctrl field
> properly.
>
> Note: as per Rockchip engineers, apparently the "phyctrl_frqsel" is
> actually only useful in HS200 / HS400 modes even though the DLL itself
> it used for some purposes in all modes. See the discussion in the
> earlier change in this series: ("mmc: sdhci-of-arasan: Always power the
> PHY off/on when clock changes"). In any case, it shouldn't hurt to set
> this always.
>
> Note that this change should allow boards to run at HS200 / HS400 speed
> modes while running at 100 MHz or 150 MHz. In fact, running HS400 at
> 150 MHz (giving 300 MB/s) is the main motivation of this series, since
> performance is still good but signal integrity problems are less
> prevelant at 150 MHz.
>
> [1]: https://arasan.com/wp-content/media/eMMC-5-1-Total-Solution_Rev-1-3.pdf
>
> Signed-off-by: Douglas Anderson <dianders@chromium.org>
Acked-by: Kishon Vijay Abraham I <kishon@ti.com>
> ---
> Changes in v2:
> - Warn if we're more than 15 MHz from ideal rate (Shawn)
> - Move code cleanup before set phyctrl_frqsel based on card clock (Shawn)
> - Fix typo USB => SDHCI (Shawn)
>
> drivers/phy/phy-rockchip-emmc.c | 82 ++++++++++++++++++++++++++++++++++-------
> 1 file changed, 69 insertions(+), 13 deletions(-)
>
> diff --git a/drivers/phy/phy-rockchip-emmc.c b/drivers/phy/phy-rockchip-emmc.c
> index 23fe50864526..51ddd543fd04 100644
> --- a/drivers/phy/phy-rockchip-emmc.c
> +++ b/drivers/phy/phy-rockchip-emmc.c
> @@ -14,6 +14,7 @@
> * GNU General Public License for more details.
> */
>
> +#include <linux/clk.h>
> #include <linux/delay.h>
> #include <linux/mfd/syscon.h>
> #include <linux/module.h>
> @@ -78,16 +79,73 @@
> struct rockchip_emmc_phy {
> unsigned int reg_offset;
> struct regmap *reg_base;
> + struct clk *emmcclk;
> };
>
> -static int rockchip_emmc_phy_power(struct rockchip_emmc_phy *rk_phy,
> - bool on_off)
> +static int rockchip_emmc_phy_power(struct phy *phy, bool on_off)
> {
> + struct rockchip_emmc_phy *rk_phy = phy_get_drvdata(phy);
> unsigned int caldone;
> unsigned int dllrdy;
> + unsigned int freqsel = PHYCTRL_FREQSEL_200M;
> unsigned long timeout;
>
> /*
> + * We purposely get the clock here and not in probe to avoid the
> + * circular dependency problem. We expect:
> + * - PHY driver to probe
> + * - SDHCI driver to start probe
> + * - SDHCI driver to register it's clock
> + * - SDHCI driver to get the PHY
> + * - SDHCI driver to power on the PHY
> + */
> + if (!rk_phy->emmcclk) {
> + rk_phy->emmcclk = devm_clk_get(&phy->dev, "emmcclk");
> +
> + /* Don't expect defer at this point; try next time */
> + if (PTR_ERR(rk_phy->emmcclk) == -EPROBE_DEFER) {
> + dev_warn(&phy->dev, "Unexpected emmcclk defer\n");
> + rk_phy->emmcclk = NULL;
> + }
> + }
> +
> + if (!IS_ERR_OR_NULL(rk_phy->emmcclk)) {
> + unsigned long rate = clk_get_rate(rk_phy->emmcclk);
> + unsigned long ideal_rate;
> + unsigned long diff;
> +
> + switch (rate) {
> + case 0 ... 74999999:
> + ideal_rate = 50000000;
> + freqsel = PHYCTRL_FREQSEL_50M;
> + break;
> + case 75000000 ... 124999999:
> + ideal_rate = 100000000;
> + freqsel = PHYCTRL_FREQSEL_100M;
> + break;
> + case 125000000 ... 174999999:
> + ideal_rate = 150000000;
> + freqsel = PHYCTRL_FREQSEL_150M;
> + break;
> + default:
> + ideal_rate = 200000000;
> + break;
> + };
> +
> + diff = (rate > ideal_rate) ?
> + rate - ideal_rate : ideal_rate - rate;
> +
> + /*
> + * In order for tuning delays to be accurate we need to be
> + * pretty spot on for the DLL range, so warn if we're too
> + * far off. Also warn if we're above the 200 MHz max. Don't
> + * warn for really slow rates since we won't be tuning then.
> + */
> + if ((rate > 50000000 && diff > 15000000) || (rate > 200000000))
> + dev_warn(&phy->dev, "Unsupported rate: %lu\n", rate);
> + }
> +
> + /*
> * Keep phyctrl_pdb and phyctrl_endll low to allow
> * initialization of CALIO state M/C DFFs
> */
> @@ -132,6 +190,13 @@ static int rockchip_emmc_phy_power(struct rockchip_emmc_phy *rk_phy,
> return -ETIMEDOUT;
> }
>
> + /* Set the frequency of the DLL operation */
> + regmap_write(rk_phy->reg_base,
> + rk_phy->reg_offset + GRF_EMMCPHY_CON0,
> + HIWORD_UPDATE(freqsel, PHYCTRL_FREQSEL_MASK,
> + PHYCTRL_FREQSEL_SHIFT));
> +
> + /* Turn on the DLL */
> regmap_write(rk_phy->reg_base,
> rk_phy->reg_offset + GRF_EMMCPHY_CON6,
> HIWORD_UPDATE(PHYCTRL_ENDLL_ENABLE,
> @@ -168,23 +233,14 @@ static int rockchip_emmc_phy_power(struct rockchip_emmc_phy *rk_phy,
>
> static int rockchip_emmc_phy_power_off(struct phy *phy)
> {
> - struct rockchip_emmc_phy *rk_phy = phy_get_drvdata(phy);
> -
> /* Power down emmc phy analog blocks */
> - return rockchip_emmc_phy_power(rk_phy, PHYCTRL_PDB_PWR_OFF);
> + return rockchip_emmc_phy_power(phy, PHYCTRL_PDB_PWR_OFF);
> }
>
> static int rockchip_emmc_phy_power_on(struct phy *phy)
> {
> struct rockchip_emmc_phy *rk_phy = phy_get_drvdata(phy);
>
> - /* DLL operation: 200 MHz */
> - regmap_write(rk_phy->reg_base,
> - rk_phy->reg_offset + GRF_EMMCPHY_CON0,
> - HIWORD_UPDATE(PHYCTRL_FREQSEL_200M,
> - PHYCTRL_FREQSEL_MASK,
> - PHYCTRL_FREQSEL_SHIFT));
> -
> /* Drive impedance: 50 Ohm */
> regmap_write(rk_phy->reg_base,
> rk_phy->reg_offset + GRF_EMMCPHY_CON6,
> @@ -207,7 +263,7 @@ static int rockchip_emmc_phy_power_on(struct phy *phy)
> PHYCTRL_OTAPDLYSEL_SHIFT));
>
> /* Power up emmc phy analog blocks */
> - return rockchip_emmc_phy_power(rk_phy, PHYCTRL_PDB_PWR_ON);
> + return rockchip_emmc_phy_power(phy, PHYCTRL_PDB_PWR_ON);
> }
>
> static const struct phy_ops ops = {
>
^ permalink raw reply [flat|nested] 78+ messages in thread* [PATCH v2 10/11] phy: rockchip-emmc: Set phyctrl_frqsel based on card clock
@ 2016-06-20 13:08 ` Kishon Vijay Abraham I
0 siblings, 0 replies; 78+ messages in thread
From: Kishon Vijay Abraham I @ 2016-06-20 13:08 UTC (permalink / raw)
To: linux-arm-kernel
On Tuesday 14 June 2016 04:34 AM, Douglas Anderson wrote:
> The "phyctrl_frqsel" is described in the Arasan datasheet [1] as "the
> frequency range of DLL operation". Although the Rockchip variant of
> this PHY has different ranges than the reference Arasan PHY it appears
> as if the functionality is similar. We should set this phyctrl field
> properly.
>
> Note: as per Rockchip engineers, apparently the "phyctrl_frqsel" is
> actually only useful in HS200 / HS400 modes even though the DLL itself
> it used for some purposes in all modes. See the discussion in the
> earlier change in this series: ("mmc: sdhci-of-arasan: Always power the
> PHY off/on when clock changes"). In any case, it shouldn't hurt to set
> this always.
>
> Note that this change should allow boards to run at HS200 / HS400 speed
> modes while running at 100 MHz or 150 MHz. In fact, running HS400 at
> 150 MHz (giving 300 MB/s) is the main motivation of this series, since
> performance is still good but signal integrity problems are less
> prevelant at 150 MHz.
>
> [1]: https://arasan.com/wp-content/media/eMMC-5-1-Total-Solution_Rev-1-3.pdf
>
> Signed-off-by: Douglas Anderson <dianders@chromium.org>
Acked-by: Kishon Vijay Abraham I <kishon@ti.com>
> ---
> Changes in v2:
> - Warn if we're more than 15 MHz from ideal rate (Shawn)
> - Move code cleanup before set phyctrl_frqsel based on card clock (Shawn)
> - Fix typo USB => SDHCI (Shawn)
>
> drivers/phy/phy-rockchip-emmc.c | 82 ++++++++++++++++++++++++++++++++++-------
> 1 file changed, 69 insertions(+), 13 deletions(-)
>
> diff --git a/drivers/phy/phy-rockchip-emmc.c b/drivers/phy/phy-rockchip-emmc.c
> index 23fe50864526..51ddd543fd04 100644
> --- a/drivers/phy/phy-rockchip-emmc.c
> +++ b/drivers/phy/phy-rockchip-emmc.c
> @@ -14,6 +14,7 @@
> * GNU General Public License for more details.
> */
>
> +#include <linux/clk.h>
> #include <linux/delay.h>
> #include <linux/mfd/syscon.h>
> #include <linux/module.h>
> @@ -78,16 +79,73 @@
> struct rockchip_emmc_phy {
> unsigned int reg_offset;
> struct regmap *reg_base;
> + struct clk *emmcclk;
> };
>
> -static int rockchip_emmc_phy_power(struct rockchip_emmc_phy *rk_phy,
> - bool on_off)
> +static int rockchip_emmc_phy_power(struct phy *phy, bool on_off)
> {
> + struct rockchip_emmc_phy *rk_phy = phy_get_drvdata(phy);
> unsigned int caldone;
> unsigned int dllrdy;
> + unsigned int freqsel = PHYCTRL_FREQSEL_200M;
> unsigned long timeout;
>
> /*
> + * We purposely get the clock here and not in probe to avoid the
> + * circular dependency problem. We expect:
> + * - PHY driver to probe
> + * - SDHCI driver to start probe
> + * - SDHCI driver to register it's clock
> + * - SDHCI driver to get the PHY
> + * - SDHCI driver to power on the PHY
> + */
> + if (!rk_phy->emmcclk) {
> + rk_phy->emmcclk = devm_clk_get(&phy->dev, "emmcclk");
> +
> + /* Don't expect defer at this point; try next time */
> + if (PTR_ERR(rk_phy->emmcclk) == -EPROBE_DEFER) {
> + dev_warn(&phy->dev, "Unexpected emmcclk defer\n");
> + rk_phy->emmcclk = NULL;
> + }
> + }
> +
> + if (!IS_ERR_OR_NULL(rk_phy->emmcclk)) {
> + unsigned long rate = clk_get_rate(rk_phy->emmcclk);
> + unsigned long ideal_rate;
> + unsigned long diff;
> +
> + switch (rate) {
> + case 0 ... 74999999:
> + ideal_rate = 50000000;
> + freqsel = PHYCTRL_FREQSEL_50M;
> + break;
> + case 75000000 ... 124999999:
> + ideal_rate = 100000000;
> + freqsel = PHYCTRL_FREQSEL_100M;
> + break;
> + case 125000000 ... 174999999:
> + ideal_rate = 150000000;
> + freqsel = PHYCTRL_FREQSEL_150M;
> + break;
> + default:
> + ideal_rate = 200000000;
> + break;
> + };
> +
> + diff = (rate > ideal_rate) ?
> + rate - ideal_rate : ideal_rate - rate;
> +
> + /*
> + * In order for tuning delays to be accurate we need to be
> + * pretty spot on for the DLL range, so warn if we're too
> + * far off. Also warn if we're above the 200 MHz max. Don't
> + * warn for really slow rates since we won't be tuning then.
> + */
> + if ((rate > 50000000 && diff > 15000000) || (rate > 200000000))
> + dev_warn(&phy->dev, "Unsupported rate: %lu\n", rate);
> + }
> +
> + /*
> * Keep phyctrl_pdb and phyctrl_endll low to allow
> * initialization of CALIO state M/C DFFs
> */
> @@ -132,6 +190,13 @@ static int rockchip_emmc_phy_power(struct rockchip_emmc_phy *rk_phy,
> return -ETIMEDOUT;
> }
>
> + /* Set the frequency of the DLL operation */
> + regmap_write(rk_phy->reg_base,
> + rk_phy->reg_offset + GRF_EMMCPHY_CON0,
> + HIWORD_UPDATE(freqsel, PHYCTRL_FREQSEL_MASK,
> + PHYCTRL_FREQSEL_SHIFT));
> +
> + /* Turn on the DLL */
> regmap_write(rk_phy->reg_base,
> rk_phy->reg_offset + GRF_EMMCPHY_CON6,
> HIWORD_UPDATE(PHYCTRL_ENDLL_ENABLE,
> @@ -168,23 +233,14 @@ static int rockchip_emmc_phy_power(struct rockchip_emmc_phy *rk_phy,
>
> static int rockchip_emmc_phy_power_off(struct phy *phy)
> {
> - struct rockchip_emmc_phy *rk_phy = phy_get_drvdata(phy);
> -
> /* Power down emmc phy analog blocks */
> - return rockchip_emmc_phy_power(rk_phy, PHYCTRL_PDB_PWR_OFF);
> + return rockchip_emmc_phy_power(phy, PHYCTRL_PDB_PWR_OFF);
> }
>
> static int rockchip_emmc_phy_power_on(struct phy *phy)
> {
> struct rockchip_emmc_phy *rk_phy = phy_get_drvdata(phy);
>
> - /* DLL operation: 200 MHz */
> - regmap_write(rk_phy->reg_base,
> - rk_phy->reg_offset + GRF_EMMCPHY_CON0,
> - HIWORD_UPDATE(PHYCTRL_FREQSEL_200M,
> - PHYCTRL_FREQSEL_MASK,
> - PHYCTRL_FREQSEL_SHIFT));
> -
> /* Drive impedance: 50 Ohm */
> regmap_write(rk_phy->reg_base,
> rk_phy->reg_offset + GRF_EMMCPHY_CON6,
> @@ -207,7 +263,7 @@ static int rockchip_emmc_phy_power_on(struct phy *phy)
> PHYCTRL_OTAPDLYSEL_SHIFT));
>
> /* Power up emmc phy analog blocks */
> - return rockchip_emmc_phy_power(rk_phy, PHYCTRL_PDB_PWR_ON);
> + return rockchip_emmc_phy_power(phy, PHYCTRL_PDB_PWR_ON);
> }
>
> static const struct phy_ops ops = {
>
^ permalink raw reply [flat|nested] 78+ messages in thread
* [PATCH v2 11/11] arm64: dts: rockchip: Provide emmcclk to PHY for rk3399
2016-06-13 23:04 ` Douglas Anderson
(?)
@ 2016-06-13 23:04 ` Douglas Anderson
-1 siblings, 0 replies; 78+ messages in thread
From: Douglas Anderson @ 2016-06-13 23:04 UTC (permalink / raw)
To: ulf.hansson-QSEj5FYQhm4dnm+yROfE0A, kishon-l0cyMroinI0,
Heiko Stuebner, robh+dt-DgEjT+Ai2ygdnm+yROfE0A
Cc: mark.rutland-5wv7dgnIgG8, devicetree-u79uwXL29TY76Z2rM5mHXA,
xzy.xu-TNX95d0MmH7DzftRWevZcw,
linux-kernel-u79uwXL29TY76Z2rM5mHXA,
zhengxing-TNX95d0MmH7DzftRWevZcw, pawel.moll-5wv7dgnIgG8,
ijc+devicetree-KcIKpvwj1kUDXYZnReoRVg,
catalin.marinas-5wv7dgnIgG8, shawn.lin-TNX95d0MmH7DzftRWevZcw,
briannorris-F7+t8E8rja9g9hUCZPvPmw,
linux-mmc-u79uwXL29TY76Z2rM5mHXA,
adrian.hunter-ral2JQCrhuEAvxtiuMwx3w, will.deacon-5wv7dgnIgG8,
Douglas Anderson, linux-rockchip-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r,
galak-sgV2jX0FEOL9JmXXK+q4OQ, jay.xu-TNX95d0MmH7DzftRWevZcw,
linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r,
wxt-TNX95d0MmH7DzftRWevZcw
Previous changes in this series allowed exposing the card clock from the
rk3399 SDHCI device and allowed consuming the card clock in the rk3399
eMMC PHY. Hook things up in the main rk3399 dtsi file.
Signed-off-by: Douglas Anderson <dianders-F7+t8E8rja9g9hUCZPvPmw@public.gmane.org>
---
Changes in v2: None
arch/arm64/boot/dts/rockchip/rk3399.dtsi | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/arch/arm64/boot/dts/rockchip/rk3399.dtsi b/arch/arm64/boot/dts/rockchip/rk3399.dtsi
index 1b57e92e0093..004b599ca285 100644
--- a/arch/arm64/boot/dts/rockchip/rk3399.dtsi
+++ b/arch/arm64/boot/dts/rockchip/rk3399.dtsi
@@ -225,8 +225,10 @@
assigned-clock-rates = <200000000>;
clocks = <&cru SCLK_EMMC>, <&cru ACLK_EMMC>;
clock-names = "clk_xin", "clk_ahb";
+ clock-output-names = "emmc_cardclock";
phys = <&emmc_phy>;
phy-names = "phy_arasan";
+ #clock-cells = <0>;
status = "disabled";
};
@@ -621,6 +623,8 @@
emmc_phy: phy@f780 {
compatible = "rockchip,rk3399-emmc-phy";
reg = <0xf780 0x24>;
+ clocks = <&sdhci>;
+ clock-names = "emmcclk";
#phy-cells = <0>;
status = "disabled";
};
--
2.8.0.rc3.226.g39d4020
^ permalink raw reply related [flat|nested] 78+ messages in thread* [PATCH v2 11/11] arm64: dts: rockchip: Provide emmcclk to PHY for rk3399
@ 2016-06-13 23:04 ` Douglas Anderson
0 siblings, 0 replies; 78+ messages in thread
From: Douglas Anderson @ 2016-06-13 23:04 UTC (permalink / raw)
To: ulf.hansson, kishon, Heiko Stuebner, robh+dt
Cc: shawn.lin, xzy.xu, briannorris, adrian.hunter, linux-rockchip,
linux-mmc, devicetree, Douglas Anderson, pawel.moll, mark.rutland,
ijc+devicetree, galak, catalin.marinas, will.deacon, jay.xu,
zhengxing, wxt, linux-arm-kernel, linux-kernel
Previous changes in this series allowed exposing the card clock from the
rk3399 SDHCI device and allowed consuming the card clock in the rk3399
eMMC PHY. Hook things up in the main rk3399 dtsi file.
Signed-off-by: Douglas Anderson <dianders@chromium.org>
---
Changes in v2: None
arch/arm64/boot/dts/rockchip/rk3399.dtsi | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/arch/arm64/boot/dts/rockchip/rk3399.dtsi b/arch/arm64/boot/dts/rockchip/rk3399.dtsi
index 1b57e92e0093..004b599ca285 100644
--- a/arch/arm64/boot/dts/rockchip/rk3399.dtsi
+++ b/arch/arm64/boot/dts/rockchip/rk3399.dtsi
@@ -225,8 +225,10 @@
assigned-clock-rates = <200000000>;
clocks = <&cru SCLK_EMMC>, <&cru ACLK_EMMC>;
clock-names = "clk_xin", "clk_ahb";
+ clock-output-names = "emmc_cardclock";
phys = <&emmc_phy>;
phy-names = "phy_arasan";
+ #clock-cells = <0>;
status = "disabled";
};
@@ -621,6 +623,8 @@
emmc_phy: phy@f780 {
compatible = "rockchip,rk3399-emmc-phy";
reg = <0xf780 0x24>;
+ clocks = <&sdhci>;
+ clock-names = "emmcclk";
#phy-cells = <0>;
status = "disabled";
};
--
2.8.0.rc3.226.g39d4020
^ permalink raw reply related [flat|nested] 78+ messages in thread* [PATCH v2 11/11] arm64: dts: rockchip: Provide emmcclk to PHY for rk3399
@ 2016-06-13 23:04 ` Douglas Anderson
0 siblings, 0 replies; 78+ messages in thread
From: Douglas Anderson @ 2016-06-13 23:04 UTC (permalink / raw)
To: linux-arm-kernel
Previous changes in this series allowed exposing the card clock from the
rk3399 SDHCI device and allowed consuming the card clock in the rk3399
eMMC PHY. Hook things up in the main rk3399 dtsi file.
Signed-off-by: Douglas Anderson <dianders@chromium.org>
---
Changes in v2: None
arch/arm64/boot/dts/rockchip/rk3399.dtsi | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/arch/arm64/boot/dts/rockchip/rk3399.dtsi b/arch/arm64/boot/dts/rockchip/rk3399.dtsi
index 1b57e92e0093..004b599ca285 100644
--- a/arch/arm64/boot/dts/rockchip/rk3399.dtsi
+++ b/arch/arm64/boot/dts/rockchip/rk3399.dtsi
@@ -225,8 +225,10 @@
assigned-clock-rates = <200000000>;
clocks = <&cru SCLK_EMMC>, <&cru ACLK_EMMC>;
clock-names = "clk_xin", "clk_ahb";
+ clock-output-names = "emmc_cardclock";
phys = <&emmc_phy>;
phy-names = "phy_arasan";
+ #clock-cells = <0>;
status = "disabled";
};
@@ -621,6 +623,8 @@
emmc_phy: phy at f780 {
compatible = "rockchip,rk3399-emmc-phy";
reg = <0xf780 0x24>;
+ clocks = <&sdhci>;
+ clock-names = "emmcclk";
#phy-cells = <0>;
status = "disabled";
};
--
2.8.0.rc3.226.g39d4020
^ permalink raw reply related [flat|nested] 78+ messages in thread* Re: [PATCH v2 11/11] arm64: dts: rockchip: Provide emmcclk to PHY for rk3399
2016-06-13 23:04 ` Douglas Anderson
@ 2016-06-18 12:07 ` Heiko Stübner
-1 siblings, 0 replies; 78+ messages in thread
From: Heiko Stübner @ 2016-06-18 12:07 UTC (permalink / raw)
To: Douglas Anderson
Cc: ulf.hansson, kishon, robh+dt, shawn.lin, xzy.xu, briannorris,
adrian.hunter, linux-rockchip, linux-mmc, devicetree, pawel.moll,
mark.rutland, ijc+devicetree, galak, catalin.marinas, will.deacon,
jay.xu, zhengxing, wxt, linux-arm-kernel, linux-kernel
Am Montag, 13. Juni 2016, 16:04:35 schrieb Douglas Anderson:
> Previous changes in this series allowed exposing the card clock from the
> rk3399 SDHCI device and allowed consuming the card clock in the rk3399
> eMMC PHY. Hook things up in the main rk3399 dtsi file.
>
> Signed-off-by: Douglas Anderson <dianders@chromium.org>
as the whole devicetree-part of the emmc addition is in my queue for 4.8, I'll
pick this patch after everything else has gone into some tree.
Heiko
^ permalink raw reply [flat|nested] 78+ messages in thread
* [PATCH v2 11/11] arm64: dts: rockchip: Provide emmcclk to PHY for rk3399
@ 2016-06-18 12:07 ` Heiko Stübner
0 siblings, 0 replies; 78+ messages in thread
From: Heiko Stübner @ 2016-06-18 12:07 UTC (permalink / raw)
To: linux-arm-kernel
Am Montag, 13. Juni 2016, 16:04:35 schrieb Douglas Anderson:
> Previous changes in this series allowed exposing the card clock from the
> rk3399 SDHCI device and allowed consuming the card clock in the rk3399
> eMMC PHY. Hook things up in the main rk3399 dtsi file.
>
> Signed-off-by: Douglas Anderson <dianders@chromium.org>
as the whole devicetree-part of the emmc addition is in my queue for 4.8, I'll
pick this patch after everything else has gone into some tree.
Heiko
^ permalink raw reply [flat|nested] 78+ messages in thread
* Re: [PATCH v2 0/11] Changes to support 150 MHz eMMC on rk3399
2016-06-13 23:04 ` Douglas Anderson
(?)
@ 2016-06-17 12:39 ` Kishon Vijay Abraham I
-1 siblings, 0 replies; 78+ messages in thread
From: Kishon Vijay Abraham I @ 2016-06-17 12:39 UTC (permalink / raw)
To: Douglas Anderson, ulf.hansson-QSEj5FYQhm4dnm+yROfE0A,
Heiko Stuebner, robh+dt-DgEjT+Ai2ygdnm+yROfE0A
Cc: mark.rutland-5wv7dgnIgG8, devicetree-u79uwXL29TY76Z2rM5mHXA,
xzy.xu-TNX95d0MmH7DzftRWevZcw,
linux-kernel-u79uwXL29TY76Z2rM5mHXA, pawel.moll-5wv7dgnIgG8,
zhengxing-TNX95d0MmH7DzftRWevZcw,
ijc+devicetree-KcIKpvwj1kUDXYZnReoRVg,
catalin.marinas-5wv7dgnIgG8, shawn.lin-TNX95d0MmH7DzftRWevZcw,
briannorris-F7+t8E8rja9g9hUCZPvPmw,
linux-mmc-u79uwXL29TY76Z2rM5mHXA,
adrian.hunter-ral2JQCrhuEAvxtiuMwx3w, will.deacon-5wv7dgnIgG8,
michal.simek-gjFFaj9aHVfQT0dZR+AlfA,
linux-rockchip-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r,
soren.brinkmann-gjFFaj9aHVfQT0dZR+AlfA,
galak-sgV2jX0FEOL9JmXXK+q4OQ, jay.xu-TNX95d0MmH7DzftRWevZcw,
linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r,
wxt-TNX95d0MmH7DzftRWevZcw
Hi,
On Tuesday 14 June 2016 04:34 AM, Douglas Anderson wrote:
> The theme of this series of patches is to try to allow running the eMMC
> at 150 MHz on the rk3399 SoC, though the changes should still be correct
> and have merit on their own. The motivation for running at 150 MHz is
> that doing so improves signal integrity and (with some eMMC devices)
> doesn't affect throughput.
>
> These patches have been structured to keep things as separate as
> possible, but nevertheless there are still some dependencies between
> patches. It probably makes the most sense for all of the non-device
> tree patches to go through a single tree. If others agree, perhaps the
> most sane would be to get Acks from PHY maintainers and then to land the
> patches in the MMC tree. Device tree patches should be able to be
> landed separately and the worst what would happen is a warning in the
> kernel log if you have the code without the device tree.
>
> The code patches are based on Ulf's mmc-next, then 4 patches that are
> outstanding / ready to land. Specifically:
> - https://patchwork.kernel.org/patch/9086501/
> phy: rockchip-emmc: give DLL some extra time to be ready
> - https://patchwork.kernel.org/patch/9093681/
> phy: rockchip-emmc: configure frequency range and drive impedance
> - https://patchwork.kernel.org/patch/9086511/
> phy: rockchip-emmc: configure default output tap delay
> - https://patchwork.kernel.org/patch/9086531/
> phy: rockchip-emmc: reindent the register definitions
Do you want all these "phy: rockchip-emmc:" along with the patch in this series
to go in MMC tree? Or I can take all the phy part in my linux-phy -next branch?
Thanks
Kishon
>
> The device tree patches are based on Heiko's v4.8-armsoc/dts64.
>
> If requested, I could repost my series with the outstanding code patches
> or I could try folding those patches into mine. Since those patches
> aren't in 4.7-rc1 presumably they would also make sense to take through
> the MMC tree if others agree.
>
> Changes in v2:
> - Indicate that 5.1 ms is calculated (Shawn).
> - Clean up description of rk3399 PHY (Shawn)
> - Add Rob Herring's Ack.
> - Reorder includes (Shawn)
> - Adjust commit message wording (Rob)
> - List out clocks and clock names (Rob)
> - Move code cleanup before set phyctrl_frqsel based on card clock (Shawn)
> - Warn if we're more than 15 MHz from ideal rate (Shawn)
> - Fix typo USB => SDHCI (Shawn)
>
> Douglas Anderson (11):
> phy: rockchip-emmc: Increase lock time allowance
> mmc: sdhci-of-arasan: Always power the PHY off/on when clock changes
> Documentation: mmc: sdhci-of-arasan: Add soc-ctl-syscon for corecfg
> regs
> mmc: sdhci-of-arasan: Properly set corecfg_baseclkfreq on rk3399
> arm64: dts: rockchip: Add soc-ctl-syscon to sdhci for rk3399
> Documentation: mmc: sdhci-of-arasan: Add ability to export card clock
> mmc: sdhci-of-arasan: Add ability to export card clock
> Documentation: phy: Let the rockchip eMMC PHY get an exported card
> clock
> phy: rockchip-emmc: Minor code cleanup in
> rockchip_emmc_phy_power_on/off()
> phy: rockchip-emmc: Set phyctrl_frqsel based on card clock
> arm64: dts: rockchip: Provide emmcclk to PHY for rk3399
>
> .../devicetree/bindings/mmc/arasan,sdhci.txt | 35 ++-
> .../devicetree/bindings/phy/rockchip-emmc-phy.txt | 9 +
> arch/arm64/boot/dts/rockchip/rk3399.dtsi | 5 +
> drivers/mmc/host/sdhci-of-arasan.c | 333 +++++++++++++++++++--
> drivers/phy/phy-rockchip-emmc.c | 120 ++++++--
> 5 files changed, 442 insertions(+), 60 deletions(-)
>
^ permalink raw reply [flat|nested] 78+ messages in thread
* Re: [PATCH v2 0/11] Changes to support 150 MHz eMMC on rk3399
@ 2016-06-17 12:39 ` Kishon Vijay Abraham I
0 siblings, 0 replies; 78+ messages in thread
From: Kishon Vijay Abraham I @ 2016-06-17 12:39 UTC (permalink / raw)
To: Douglas Anderson, ulf.hansson, Heiko Stuebner, robh+dt
Cc: shawn.lin, xzy.xu, briannorris, adrian.hunter, linux-rockchip,
linux-mmc, devicetree, mark.rutland, catalin.marinas, will.deacon,
zhengxing, michal.simek, linux-arm-kernel, jay.xu, wxt,
pawel.moll, ijc+devicetree, soren.brinkmann, linux-kernel, galak
Hi,
On Tuesday 14 June 2016 04:34 AM, Douglas Anderson wrote:
> The theme of this series of patches is to try to allow running the eMMC
> at 150 MHz on the rk3399 SoC, though the changes should still be correct
> and have merit on their own. The motivation for running at 150 MHz is
> that doing so improves signal integrity and (with some eMMC devices)
> doesn't affect throughput.
>
> These patches have been structured to keep things as separate as
> possible, but nevertheless there are still some dependencies between
> patches. It probably makes the most sense for all of the non-device
> tree patches to go through a single tree. If others agree, perhaps the
> most sane would be to get Acks from PHY maintainers and then to land the
> patches in the MMC tree. Device tree patches should be able to be
> landed separately and the worst what would happen is a warning in the
> kernel log if you have the code without the device tree.
>
> The code patches are based on Ulf's mmc-next, then 4 patches that are
> outstanding / ready to land. Specifically:
> - https://patchwork.kernel.org/patch/9086501/
> phy: rockchip-emmc: give DLL some extra time to be ready
> - https://patchwork.kernel.org/patch/9093681/
> phy: rockchip-emmc: configure frequency range and drive impedance
> - https://patchwork.kernel.org/patch/9086511/
> phy: rockchip-emmc: configure default output tap delay
> - https://patchwork.kernel.org/patch/9086531/
> phy: rockchip-emmc: reindent the register definitions
Do you want all these "phy: rockchip-emmc:" along with the patch in this series
to go in MMC tree? Or I can take all the phy part in my linux-phy -next branch?
Thanks
Kishon
>
> The device tree patches are based on Heiko's v4.8-armsoc/dts64.
>
> If requested, I could repost my series with the outstanding code patches
> or I could try folding those patches into mine. Since those patches
> aren't in 4.7-rc1 presumably they would also make sense to take through
> the MMC tree if others agree.
>
> Changes in v2:
> - Indicate that 5.1 ms is calculated (Shawn).
> - Clean up description of rk3399 PHY (Shawn)
> - Add Rob Herring's Ack.
> - Reorder includes (Shawn)
> - Adjust commit message wording (Rob)
> - List out clocks and clock names (Rob)
> - Move code cleanup before set phyctrl_frqsel based on card clock (Shawn)
> - Warn if we're more than 15 MHz from ideal rate (Shawn)
> - Fix typo USB => SDHCI (Shawn)
>
> Douglas Anderson (11):
> phy: rockchip-emmc: Increase lock time allowance
> mmc: sdhci-of-arasan: Always power the PHY off/on when clock changes
> Documentation: mmc: sdhci-of-arasan: Add soc-ctl-syscon for corecfg
> regs
> mmc: sdhci-of-arasan: Properly set corecfg_baseclkfreq on rk3399
> arm64: dts: rockchip: Add soc-ctl-syscon to sdhci for rk3399
> Documentation: mmc: sdhci-of-arasan: Add ability to export card clock
> mmc: sdhci-of-arasan: Add ability to export card clock
> Documentation: phy: Let the rockchip eMMC PHY get an exported card
> clock
> phy: rockchip-emmc: Minor code cleanup in
> rockchip_emmc_phy_power_on/off()
> phy: rockchip-emmc: Set phyctrl_frqsel based on card clock
> arm64: dts: rockchip: Provide emmcclk to PHY for rk3399
>
> .../devicetree/bindings/mmc/arasan,sdhci.txt | 35 ++-
> .../devicetree/bindings/phy/rockchip-emmc-phy.txt | 9 +
> arch/arm64/boot/dts/rockchip/rk3399.dtsi | 5 +
> drivers/mmc/host/sdhci-of-arasan.c | 333 +++++++++++++++++++--
> drivers/phy/phy-rockchip-emmc.c | 120 ++++++--
> 5 files changed, 442 insertions(+), 60 deletions(-)
>
^ permalink raw reply [flat|nested] 78+ messages in thread
* [PATCH v2 0/11] Changes to support 150 MHz eMMC on rk3399
@ 2016-06-17 12:39 ` Kishon Vijay Abraham I
0 siblings, 0 replies; 78+ messages in thread
From: Kishon Vijay Abraham I @ 2016-06-17 12:39 UTC (permalink / raw)
To: linux-arm-kernel
Hi,
On Tuesday 14 June 2016 04:34 AM, Douglas Anderson wrote:
> The theme of this series of patches is to try to allow running the eMMC
> at 150 MHz on the rk3399 SoC, though the changes should still be correct
> and have merit on their own. The motivation for running at 150 MHz is
> that doing so improves signal integrity and (with some eMMC devices)
> doesn't affect throughput.
>
> These patches have been structured to keep things as separate as
> possible, but nevertheless there are still some dependencies between
> patches. It probably makes the most sense for all of the non-device
> tree patches to go through a single tree. If others agree, perhaps the
> most sane would be to get Acks from PHY maintainers and then to land the
> patches in the MMC tree. Device tree patches should be able to be
> landed separately and the worst what would happen is a warning in the
> kernel log if you have the code without the device tree.
>
> The code patches are based on Ulf's mmc-next, then 4 patches that are
> outstanding / ready to land. Specifically:
> - https://patchwork.kernel.org/patch/9086501/
> phy: rockchip-emmc: give DLL some extra time to be ready
> - https://patchwork.kernel.org/patch/9093681/
> phy: rockchip-emmc: configure frequency range and drive impedance
> - https://patchwork.kernel.org/patch/9086511/
> phy: rockchip-emmc: configure default output tap delay
> - https://patchwork.kernel.org/patch/9086531/
> phy: rockchip-emmc: reindent the register definitions
Do you want all these "phy: rockchip-emmc:" along with the patch in this series
to go in MMC tree? Or I can take all the phy part in my linux-phy -next branch?
Thanks
Kishon
>
> The device tree patches are based on Heiko's v4.8-armsoc/dts64.
>
> If requested, I could repost my series with the outstanding code patches
> or I could try folding those patches into mine. Since those patches
> aren't in 4.7-rc1 presumably they would also make sense to take through
> the MMC tree if others agree.
>
> Changes in v2:
> - Indicate that 5.1 ms is calculated (Shawn).
> - Clean up description of rk3399 PHY (Shawn)
> - Add Rob Herring's Ack.
> - Reorder includes (Shawn)
> - Adjust commit message wording (Rob)
> - List out clocks and clock names (Rob)
> - Move code cleanup before set phyctrl_frqsel based on card clock (Shawn)
> - Warn if we're more than 15 MHz from ideal rate (Shawn)
> - Fix typo USB => SDHCI (Shawn)
>
> Douglas Anderson (11):
> phy: rockchip-emmc: Increase lock time allowance
> mmc: sdhci-of-arasan: Always power the PHY off/on when clock changes
> Documentation: mmc: sdhci-of-arasan: Add soc-ctl-syscon for corecfg
> regs
> mmc: sdhci-of-arasan: Properly set corecfg_baseclkfreq on rk3399
> arm64: dts: rockchip: Add soc-ctl-syscon to sdhci for rk3399
> Documentation: mmc: sdhci-of-arasan: Add ability to export card clock
> mmc: sdhci-of-arasan: Add ability to export card clock
> Documentation: phy: Let the rockchip eMMC PHY get an exported card
> clock
> phy: rockchip-emmc: Minor code cleanup in
> rockchip_emmc_phy_power_on/off()
> phy: rockchip-emmc: Set phyctrl_frqsel based on card clock
> arm64: dts: rockchip: Provide emmcclk to PHY for rk3399
>
> .../devicetree/bindings/mmc/arasan,sdhci.txt | 35 ++-
> .../devicetree/bindings/phy/rockchip-emmc-phy.txt | 9 +
> arch/arm64/boot/dts/rockchip/rk3399.dtsi | 5 +
> drivers/mmc/host/sdhci-of-arasan.c | 333 +++++++++++++++++++--
> drivers/phy/phy-rockchip-emmc.c | 120 ++++++--
> 5 files changed, 442 insertions(+), 60 deletions(-)
>
^ permalink raw reply [flat|nested] 78+ messages in thread
* Re: [PATCH v2 0/11] Changes to support 150 MHz eMMC on rk3399
2016-06-17 12:39 ` Kishon Vijay Abraham I
(?)
@ 2016-06-17 15:37 ` Doug Anderson
-1 siblings, 0 replies; 78+ messages in thread
From: Doug Anderson @ 2016-06-17 15:37 UTC (permalink / raw)
To: Kishon Vijay Abraham I, Ulf Hansson
Cc: Heiko Stuebner, Rob Herring, Shawn Lin, Ziyuan Xu, Brian Norris,
Adrian Hunter, open list:ARM/Rockchip SoC...,
linux-mmc@vger.kernel.org, devicetree@vger.kernel.org,
Mark Rutland, Catalin Marinas, Will Deacon, Xing Zheng,
Michal Simek, linux-arm-kernel@lists.infradead.org, Xu Jianqun,
Caesar Wang, Pawel Moll, Ian Campbell, soren.brinkmann,
linux-kernel
Kishon,
On Fri, Jun 17, 2016 at 5:39 AM, Kishon Vijay Abraham I <kishon@ti.com> wrote:
> Hi,
>
> On Tuesday 14 June 2016 04:34 AM, Douglas Anderson wrote:
>> The theme of this series of patches is to try to allow running the eMMC
>> at 150 MHz on the rk3399 SoC, though the changes should still be correct
>> and have merit on their own. The motivation for running at 150 MHz is
>> that doing so improves signal integrity and (with some eMMC devices)
>> doesn't affect throughput.
>>
>> These patches have been structured to keep things as separate as
>> possible, but nevertheless there are still some dependencies between
>> patches. It probably makes the most sense for all of the non-device
>> tree patches to go through a single tree. If others agree, perhaps the
>> most sane would be to get Acks from PHY maintainers and then to land the
>> patches in the MMC tree. Device tree patches should be able to be
>> landed separately and the worst what would happen is a warning in the
>> kernel log if you have the code without the device tree.
>>
>> The code patches are based on Ulf's mmc-next, then 4 patches that are
>> outstanding / ready to land. Specifically:
>> - https://patchwork.kernel.org/patch/9086501/
>> phy: rockchip-emmc: give DLL some extra time to be ready
>> - https://patchwork.kernel.org/patch/9093681/
>> phy: rockchip-emmc: configure frequency range and drive impedance
>> - https://patchwork.kernel.org/patch/9086511/
>> phy: rockchip-emmc: configure default output tap delay
>> - https://patchwork.kernel.org/patch/9086531/
>> phy: rockchip-emmc: reindent the register definitions
>
> Do you want all these "phy: rockchip-emmc:" along with the patch in this series
> to go in MMC tree? Or I can take all the phy part in my linux-phy -next branch?
If Ulf is amenable, I was hoping that these could all go through the
MMC tree with your blessing. ...then "dts" patches would go through
Heiko's tree.
-Doug
^ permalink raw reply [flat|nested] 78+ messages in thread
* Re: [PATCH v2 0/11] Changes to support 150 MHz eMMC on rk3399
@ 2016-06-17 15:37 ` Doug Anderson
0 siblings, 0 replies; 78+ messages in thread
From: Doug Anderson @ 2016-06-17 15:37 UTC (permalink / raw)
To: Kishon Vijay Abraham I, Ulf Hansson
Cc: Heiko Stuebner, Rob Herring, Shawn Lin, Ziyuan Xu, Brian Norris,
Adrian Hunter, open list:ARM/Rockchip SoC...,
linux-mmc@vger.kernel.org, devicetree@vger.kernel.org,
Mark Rutland, Catalin Marinas, Will Deacon, Xing Zheng,
Michal Simek, linux-arm-kernel@lists.infradead.org, Xu Jianqun,
Caesar Wang, Pawel Moll, Ian Campbell, soren.brinkmann,
linux-kernel@vger.kernel.org, Kumar Gala
Kishon,
On Fri, Jun 17, 2016 at 5:39 AM, Kishon Vijay Abraham I <kishon@ti.com> wrote:
> Hi,
>
> On Tuesday 14 June 2016 04:34 AM, Douglas Anderson wrote:
>> The theme of this series of patches is to try to allow running the eMMC
>> at 150 MHz on the rk3399 SoC, though the changes should still be correct
>> and have merit on their own. The motivation for running at 150 MHz is
>> that doing so improves signal integrity and (with some eMMC devices)
>> doesn't affect throughput.
>>
>> These patches have been structured to keep things as separate as
>> possible, but nevertheless there are still some dependencies between
>> patches. It probably makes the most sense for all of the non-device
>> tree patches to go through a single tree. If others agree, perhaps the
>> most sane would be to get Acks from PHY maintainers and then to land the
>> patches in the MMC tree. Device tree patches should be able to be
>> landed separately and the worst what would happen is a warning in the
>> kernel log if you have the code without the device tree.
>>
>> The code patches are based on Ulf's mmc-next, then 4 patches that are
>> outstanding / ready to land. Specifically:
>> - https://patchwork.kernel.org/patch/9086501/
>> phy: rockchip-emmc: give DLL some extra time to be ready
>> - https://patchwork.kernel.org/patch/9093681/
>> phy: rockchip-emmc: configure frequency range and drive impedance
>> - https://patchwork.kernel.org/patch/9086511/
>> phy: rockchip-emmc: configure default output tap delay
>> - https://patchwork.kernel.org/patch/9086531/
>> phy: rockchip-emmc: reindent the register definitions
>
> Do you want all these "phy: rockchip-emmc:" along with the patch in this series
> to go in MMC tree? Or I can take all the phy part in my linux-phy -next branch?
If Ulf is amenable, I was hoping that these could all go through the
MMC tree with your blessing. ...then "dts" patches would go through
Heiko's tree.
-Doug
^ permalink raw reply [flat|nested] 78+ messages in thread
* [PATCH v2 0/11] Changes to support 150 MHz eMMC on rk3399
@ 2016-06-17 15:37 ` Doug Anderson
0 siblings, 0 replies; 78+ messages in thread
From: Doug Anderson @ 2016-06-17 15:37 UTC (permalink / raw)
To: linux-arm-kernel
Kishon,
On Fri, Jun 17, 2016 at 5:39 AM, Kishon Vijay Abraham I <kishon@ti.com> wrote:
> Hi,
>
> On Tuesday 14 June 2016 04:34 AM, Douglas Anderson wrote:
>> The theme of this series of patches is to try to allow running the eMMC
>> at 150 MHz on the rk3399 SoC, though the changes should still be correct
>> and have merit on their own. The motivation for running at 150 MHz is
>> that doing so improves signal integrity and (with some eMMC devices)
>> doesn't affect throughput.
>>
>> These patches have been structured to keep things as separate as
>> possible, but nevertheless there are still some dependencies between
>> patches. It probably makes the most sense for all of the non-device
>> tree patches to go through a single tree. If others agree, perhaps the
>> most sane would be to get Acks from PHY maintainers and then to land the
>> patches in the MMC tree. Device tree patches should be able to be
>> landed separately and the worst what would happen is a warning in the
>> kernel log if you have the code without the device tree.
>>
>> The code patches are based on Ulf's mmc-next, then 4 patches that are
>> outstanding / ready to land. Specifically:
>> - https://patchwork.kernel.org/patch/9086501/
>> phy: rockchip-emmc: give DLL some extra time to be ready
>> - https://patchwork.kernel.org/patch/9093681/
>> phy: rockchip-emmc: configure frequency range and drive impedance
>> - https://patchwork.kernel.org/patch/9086511/
>> phy: rockchip-emmc: configure default output tap delay
>> - https://patchwork.kernel.org/patch/9086531/
>> phy: rockchip-emmc: reindent the register definitions
>
> Do you want all these "phy: rockchip-emmc:" along with the patch in this series
> to go in MMC tree? Or I can take all the phy part in my linux-phy -next branch?
If Ulf is amenable, I was hoping that these could all go through the
MMC tree with your blessing. ...then "dts" patches would go through
Heiko's tree.
-Doug
^ permalink raw reply [flat|nested] 78+ messages in thread