2014-10-07 10:19:44

by Vivek Gautam

[permalink] [raw]
Subject: [PATCH v2 0/4] usb: dwc3/phy-exynos5-usbdrd: Extend support to Exynos7

Adding required support for clocks and additional VBUS regulators
to enable USB 3.0 support on Exynos7 SoC.

This series depends for ACRH_EXYNOS7 support on following series:
[PATCH v5 0/8] arch: arm64: Enable support for Samsung Exynos7 SoC
http://www.spinics.net/lists/linux-samsung-soc/msg37047.html

The series is based on usb-next branch.

Changes since v1:
-- Addressed review comments for unnecessary warning messages after
clk_get() fails for dwc3-exynos and phy-exynos5-usbdrd.
-- Assigned "exynos->sclk" as well as "phy_drd->utmiclk" and
"phy_drd->pipeclk" to NULL in case of clk_get() failure to avoid
unnecessary check for clock.
-- Modified dependency for symbol PHY_EXYNOS5_USBDRD to depend on
ARCH_EXYNOS which includes both Exynos5 as well as Exynos7.
-- Dropped [PATCH 4/5] usb: dwc3: Adding Kconfig dependency for Exynos7
from v1 of this series, since its not required now.

Vivek Gautam (4):
dwc3: exynos: Add support for SCLK present on Exynos7
phy: exynos5-usbdrd: Add pipe-clk and utmi-clk support
phy: exynos5-usbdrd: Add facility for VBUS-BOOST-5V supply
phy: exynos7-usbdrd: Update dependency for ARCH_EXYNOS

.../devicetree/bindings/phy/samsung-phy.txt | 4 ++
drivers/phy/Kconfig | 2 +-
drivers/phy/phy-exynos5-usbdrd.c | 52 +++++++++++++++++++-
drivers/usb/dwc3/dwc3-exynos.c | 16 ++++++
4 files changed, 71 insertions(+), 3 deletions(-)

--
1.7.10.4


2014-10-07 10:19:51

by Vivek Gautam

[permalink] [raw]
Subject: [PATCH v2 1/4] dwc3: exynos: Add support for SCLK present on Exynos7

Exynos7 also has a separate special gate clock going to the IP
apart from the usual AHB clock. So add support for the same.

Signed-off-by: Vivek Gautam <[email protected]>
---
drivers/usb/dwc3/dwc3-exynos.c | 16 ++++++++++++++++
1 file changed, 16 insertions(+)

diff --git a/drivers/usb/dwc3/dwc3-exynos.c b/drivers/usb/dwc3/dwc3-exynos.c
index 3951a65..7dc6a98 100644
--- a/drivers/usb/dwc3/dwc3-exynos.c
+++ b/drivers/usb/dwc3/dwc3-exynos.c
@@ -35,6 +35,7 @@ struct dwc3_exynos {
struct device *dev;

struct clk *clk;
+ struct clk *sclk;
struct regulator *vdd33;
struct regulator *vdd10;
};
@@ -139,10 +140,21 @@ static int dwc3_exynos_probe(struct platform_device *pdev)
return -EINVAL;
}

+ /*
+ * Exynos7 has a special gate clock going to this IP,
+ * which in earlier SoCs was probably concealed.
+ */
+ exynos->sclk = devm_clk_get(dev, "usbdrd30_sclk");
+ if (IS_ERR(exynos->sclk)) {
+ dev_info(dev, "no sclk specified\n");
+ exynos->sclk = NULL;
+ }
+
exynos->dev = dev;
exynos->clk = clk;

clk_prepare_enable(exynos->clk);
+ clk_prepare_enable(exynos->sclk);

exynos->vdd33 = devm_regulator_get(dev, "vdd33");
if (IS_ERR(exynos->vdd33)) {
@@ -185,6 +197,7 @@ err4:
err3:
regulator_disable(exynos->vdd33);
err2:
+ clk_disable_unprepare(exynos->sclk);
clk_disable_unprepare(clk);
return ret;
}
@@ -197,6 +210,7 @@ static int dwc3_exynos_remove(struct platform_device *pdev)
platform_device_unregister(exynos->usb2_phy);
platform_device_unregister(exynos->usb3_phy);

+ clk_disable_unprepare(exynos->sclk);
clk_disable_unprepare(exynos->clk);

regulator_disable(exynos->vdd33);
@@ -218,6 +232,7 @@ static int dwc3_exynos_suspend(struct device *dev)
{
struct dwc3_exynos *exynos = dev_get_drvdata(dev);

+ clk_disable(exynos->sclk);
clk_disable(exynos->clk);

regulator_disable(exynos->vdd33);
@@ -243,6 +258,7 @@ static int dwc3_exynos_resume(struct device *dev)
}

clk_enable(exynos->clk);
+ clk_enable(exynos->sclk);

/* runtime set active to reflect active state. */
pm_runtime_disable(dev);
--
1.7.10.4

2014-10-07 10:19:59

by Vivek Gautam

[permalink] [raw]
Subject: [PATCH v2 3/4] phy: exynos5-usbdrd: Add facility for VBUS-BOOST-5V supply

Some Exynos SoCs have a separate regulator controlling a
Boost 5V supply which goes as input for VBUS regulator.
So adding a control for the same in driver, to enable
vbus supply on the port.

Signed-off-by: Vivek Gautam <[email protected]>
---
drivers/phy/phy-exynos5-usbdrd.c | 30 ++++++++++++++++++++++++++++--
1 file changed, 28 insertions(+), 2 deletions(-)

diff --git a/drivers/phy/phy-exynos5-usbdrd.c b/drivers/phy/phy-exynos5-usbdrd.c
index 013ee84..57e8a0a 100644
--- a/drivers/phy/phy-exynos5-usbdrd.c
+++ b/drivers/phy/phy-exynos5-usbdrd.c
@@ -176,6 +176,7 @@ struct exynos5_usbdrd_phy {
u32 extrefclk;
struct clk *ref_clk;
struct regulator *vbus;
+ struct regulator *vbus_boost;
};

static inline
@@ -455,11 +456,20 @@ static int exynos5_usbdrd_phy_power_on(struct phy *phy)
clk_prepare_enable(phy_drd->ref_clk);

/* Enable VBUS supply */
+ if (phy_drd->vbus_boost) {
+ ret = regulator_enable(phy_drd->vbus_boost);
+ if (ret) {
+ dev_err(phy_drd->dev,
+ "Failed to enable VBUS boost supply\n");
+ goto fail_vbus;
+ }
+ }
+
if (phy_drd->vbus) {
ret = regulator_enable(phy_drd->vbus);
if (ret) {
dev_err(phy_drd->dev, "Failed to enable VBUS supply\n");
- goto fail_vbus;
+ goto fail_vbus_boost;
}
}

@@ -468,6 +478,10 @@ static int exynos5_usbdrd_phy_power_on(struct phy *phy)

return 0;

+fail_vbus_boost:
+ if (phy_drd->vbus_boost)
+ regulator_disable(phy_drd->vbus_boost);
+
fail_vbus:
clk_disable_unprepare(phy_drd->ref_clk);
clk_disable_unprepare(phy_drd->pipeclk);
@@ -489,6 +503,8 @@ static int exynos5_usbdrd_phy_power_off(struct phy *phy)
/* Disable VBUS supply */
if (phy_drd->vbus)
regulator_disable(phy_drd->vbus);
+ if (phy_drd->vbus_boost)
+ regulator_disable(phy_drd->vbus_boost);

clk_disable_unprepare(phy_drd->ref_clk);
clk_disable_unprepare(phy_drd->pipeclk);
@@ -644,7 +660,7 @@ static int exynos5_usbdrd_phy_probe(struct platform_device *pdev)
break;
}

- /* Get Vbus regulator */
+ /* Get Vbus regulators */
phy_drd->vbus = devm_regulator_get(dev, "vbus");
if (IS_ERR(phy_drd->vbus)) {
ret = PTR_ERR(phy_drd->vbus);
@@ -655,6 +671,16 @@ static int exynos5_usbdrd_phy_probe(struct platform_device *pdev)
phy_drd->vbus = NULL;
}

+ phy_drd->vbus_boost = devm_regulator_get(dev, "vbus-boost");
+ if (IS_ERR(phy_drd->vbus_boost)) {
+ ret = PTR_ERR(phy_drd->vbus_boost);
+ if (ret == -EPROBE_DEFER)
+ return ret;
+
+ dev_warn(dev, "Failed to get VBUS boost supply regulator\n");
+ phy_drd->vbus_boost = NULL;
+ }
+
dev_vdbg(dev, "Creating usbdrd_phy phy\n");

for (i = 0; i < EXYNOS5_DRDPHYS_NUM; i++) {
--
1.7.10.4

2014-10-07 10:20:07

by Vivek Gautam

[permalink] [raw]
Subject: [PATCH v2 4/4] phy: exynos7-usbdrd: Update dependency for ARCH_EXYNOS

This PHY controller is also present on Exynos7 platform
in arch-exynos family.
So PHY_EXYNOS5_USBDRD should now depend on ARCH_EXYNOS.

Signed-off-by: Vivek Gautam <[email protected]>
---
drivers/phy/Kconfig | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/phy/Kconfig b/drivers/phy/Kconfig
index 2a436e6..1514e40 100644
--- a/drivers/phy/Kconfig
+++ b/drivers/phy/Kconfig
@@ -193,7 +193,7 @@ config PHY_EXYNOS5250_USB2

config PHY_EXYNOS5_USBDRD
tristate "Exynos5 SoC series USB DRD PHY driver"
- depends on ARCH_EXYNOS5 && OF
+ depends on ARCH_EXYNOS && OF
depends on HAS_IOMEM
depends on USB_DWC3_EXYNOS
select GENERIC_PHY
--
1.7.10.4

2014-10-07 10:20:53

by Vivek Gautam

[permalink] [raw]
Subject: [PATCH v2 2/4] phy: exynos5-usbdrd: Add pipe-clk and utmi-clk support

Exynos7 SoC has now separate gate control for 125MHz pipe3 phy
clock, as well as 60MHz utmi phy clock.
So get the same and control in the phy-exynos5-usbdrd driver.

Signed-off-by: Vivek Gautam <[email protected]>
---
.../devicetree/bindings/phy/samsung-phy.txt | 4 ++++
drivers/phy/phy-exynos5-usbdrd.c | 22 ++++++++++++++++++++
2 files changed, 26 insertions(+)

diff --git a/Documentation/devicetree/bindings/phy/samsung-phy.txt b/Documentation/devicetree/bindings/phy/samsung-phy.txt
index 15e0f2c..c2bc9dc 100644
--- a/Documentation/devicetree/bindings/phy/samsung-phy.txt
+++ b/Documentation/devicetree/bindings/phy/samsung-phy.txt
@@ -138,6 +138,10 @@ Required properties:
PHY operations, associated by phy name. It is used to
determine bit values for clock settings register.
For Exynos5420 this is given as 'sclk_usbphy30' in CMU.
+ - optional clocks: Exynos7 SoC has now following additional
+ gate clocks available:
+ - phy_pipe: for PIPE3 phy
+ - phy_utmi: for UTMI+ phy
- samsung,pmu-syscon: phandle for PMU system controller interface, used to
control pmu registers for power isolation.
- #phy-cells : from the generic PHY bindings, must be 1;
diff --git a/drivers/phy/phy-exynos5-usbdrd.c b/drivers/phy/phy-exynos5-usbdrd.c
index f756aca..013ee84 100644
--- a/drivers/phy/phy-exynos5-usbdrd.c
+++ b/drivers/phy/phy-exynos5-usbdrd.c
@@ -148,6 +148,8 @@ struct exynos5_usbdrd_phy_drvdata {
* @dev: pointer to device instance of this platform device
* @reg_phy: usb phy controller register memory base
* @clk: phy clock for register access
+ * @pipeclk: clock for pipe3 phy
+ * @utmiclk: clock for utmi+ phy
* @drv_data: pointer to SoC level driver data structure
* @phys[]: array for 'EXYNOS5_DRDPHYS_NUM' number of PHY
* instances each with its 'phy' and 'phy_cfg'.
@@ -161,6 +163,8 @@ struct exynos5_usbdrd_phy {
struct device *dev;
void __iomem *reg_phy;
struct clk *clk;
+ struct clk *pipeclk;
+ struct clk *utmiclk;
const struct exynos5_usbdrd_phy_drvdata *drv_data;
struct phy_usb_instance {
struct phy *phy;
@@ -446,6 +450,8 @@ static int exynos5_usbdrd_phy_power_on(struct phy *phy)

dev_dbg(phy_drd->dev, "Request to power_on usbdrd_phy phy\n");

+ clk_prepare_enable(phy_drd->utmiclk);
+ clk_prepare_enable(phy_drd->pipeclk);
clk_prepare_enable(phy_drd->ref_clk);

/* Enable VBUS supply */
@@ -464,6 +470,8 @@ static int exynos5_usbdrd_phy_power_on(struct phy *phy)

fail_vbus:
clk_disable_unprepare(phy_drd->ref_clk);
+ clk_disable_unprepare(phy_drd->pipeclk);
+ clk_disable_unprepare(phy_drd->utmiclk);

return ret;
}
@@ -483,6 +491,8 @@ static int exynos5_usbdrd_phy_power_off(struct phy *phy)
regulator_disable(phy_drd->vbus);

clk_disable_unprepare(phy_drd->ref_clk);
+ clk_disable_unprepare(phy_drd->pipeclk);
+ clk_disable_unprepare(phy_drd->utmiclk);

return 0;
}
@@ -582,6 +592,18 @@ static int exynos5_usbdrd_phy_probe(struct platform_device *pdev)
return PTR_ERR(phy_drd->clk);
}

+ phy_drd->pipeclk = devm_clk_get(dev, "phy_pipe");
+ if (IS_ERR(phy_drd->pipeclk)) {
+ dev_info(dev, "PIPE3 phy operational clock not specified\n");
+ phy_drd->pipeclk = NULL;
+ }
+
+ phy_drd->utmiclk = devm_clk_get(dev, "phy_utmi");
+ if (IS_ERR(phy_drd->utmiclk)) {
+ dev_info(dev, "UTMI phy operational clock not specified\n");
+ phy_drd->utmiclk = NULL;
+ }
+
phy_drd->ref_clk = devm_clk_get(dev, "ref");
if (IS_ERR(phy_drd->ref_clk)) {
dev_err(dev, "Failed to get reference clock of usbdrd phy\n");
--
1.7.10.4

2014-10-07 14:11:39

by Felipe Balbi

[permalink] [raw]
Subject: Re: [PATCH v2 1/4] dwc3: exynos: Add support for SCLK present on Exynos7

On Tue, Oct 07, 2014 at 03:49:33PM +0530, Vivek Gautam wrote:
> Exynos7 also has a separate special gate clock going to the IP
> apart from the usual AHB clock. So add support for the same.
>
> Signed-off-by: Vivek Gautam <[email protected]>

I'll take this one once -rc1 is tagged. The others have no direct
dependency on this so I'll leave them to Kishon.

--
balbi


Attachments:
(No filename) (377.00 B)
signature.asc (819.00 B)
Digital signature
Download all attachments

2014-10-08 03:01:22

by Vivek Gautam

[permalink] [raw]
Subject: Re: [PATCH v2 1/4] dwc3: exynos: Add support for SCLK present on Exynos7

On Tue, Oct 7, 2014 at 7:41 PM, Felipe Balbi <[email protected]> wrote:
> On Tue, Oct 07, 2014 at 03:49:33PM +0530, Vivek Gautam wrote:
>> Exynos7 also has a separate special gate clock going to the IP
>> apart from the usual AHB clock. So add support for the same.
>>
>> Signed-off-by: Vivek Gautam <[email protected]>
>
> I'll take this one once -rc1 is tagged. The others have no direct
> dependency on this so I'll leave them to Kishon.

Thanks Felipe !



--
Best Regards
Vivek Gautam
Samsung R&D Institute, Bangalore
India

2014-10-13 04:55:09

by Anton Tikhomirov

[permalink] [raw]
Subject: RE: [PATCH v2 1/4] dwc3: exynos: Add support for SCLK present on Exynos7

Hi Vivek,

> Exynos7 also has a separate special gate clock going to the IP
> apart from the usual AHB clock. So add support for the same.

As we discussed before, Exynos7 SoCs have 7 clocks to be controlled
by the driver. Adding only sclk is not enough.

>
> Signed-off-by: Vivek Gautam <[email protected]>
> ---
> drivers/usb/dwc3/dwc3-exynos.c | 16 ++++++++++++++++
> 1 file changed, 16 insertions(+)
>
> diff --git a/drivers/usb/dwc3/dwc3-exynos.c b/drivers/usb/dwc3/dwc3-
> exynos.c
> index 3951a65..7dc6a98 100644
> --- a/drivers/usb/dwc3/dwc3-exynos.c
> +++ b/drivers/usb/dwc3/dwc3-exynos.c
> @@ -35,6 +35,7 @@ struct dwc3_exynos {
> struct device *dev;
>
> struct clk *clk;

The clock "clk" in Exynos5 just gated all that above 7 clocks, which
we should control separately now in Exynos7.

> + struct clk *sclk;
> struct regulator *vdd33;
> struct regulator *vdd10;
> };
> @@ -139,10 +140,21 @@ static int dwc3_exynos_probe(struct
> platform_device *pdev)
> return -EINVAL;
> }
>
> + /*
> + * Exynos7 has a special gate clock going to this IP,
> + * which in earlier SoCs was probably concealed.
> + */
> + exynos->sclk = devm_clk_get(dev, "usbdrd30_sclk");
> + if (IS_ERR(exynos->sclk)) {
> + dev_info(dev, "no sclk specified\n");
> + exynos->sclk = NULL;
> + }
> +
> exynos->dev = dev;
> exynos->clk = clk;
>
> clk_prepare_enable(exynos->clk);
> + clk_prepare_enable(exynos->sclk);
>
> exynos->vdd33 = devm_regulator_get(dev, "vdd33");
> if (IS_ERR(exynos->vdd33)) {
> @@ -185,6 +197,7 @@ err4:
> err3:
> regulator_disable(exynos->vdd33);
> err2:
> + clk_disable_unprepare(exynos->sclk);
> clk_disable_unprepare(clk);
> return ret;
> }
> @@ -197,6 +210,7 @@ static int dwc3_exynos_remove(struct
> platform_device *pdev)
> platform_device_unregister(exynos->usb2_phy);
> platform_device_unregister(exynos->usb3_phy);
>
> + clk_disable_unprepare(exynos->sclk);
> clk_disable_unprepare(exynos->clk);
>
> regulator_disable(exynos->vdd33);
> @@ -218,6 +232,7 @@ static int dwc3_exynos_suspend(struct device *dev)
> {
> struct dwc3_exynos *exynos = dev_get_drvdata(dev);
>
> + clk_disable(exynos->sclk);
> clk_disable(exynos->clk);
>
> regulator_disable(exynos->vdd33);
> @@ -243,6 +258,7 @@ static int dwc3_exynos_resume(struct device *dev)
> }
>
> clk_enable(exynos->clk);
> + clk_enable(exynos->sclk);
>
> /* runtime set active to reflect active state. */
> pm_runtime_disable(dev);
> --
> 1.7.10.4
>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-usb" in
> the body of a message to [email protected]
> More majordomo info at http://vger.kernel.org/majordomo-info.html

2014-10-13 05:02:35

by Anton Tikhomirov

[permalink] [raw]
Subject: RE: [PATCH v2 2/4] phy: exynos5-usbdrd: Add pipe-clk and utmi-clk support

Hi Vivek,

> Exynos7 SoC has now separate gate control for 125MHz pipe3 phy
> clock, as well as 60MHz utmi phy clock.
> So get the same and control in the phy-exynos5-usbdrd driver.

In case of the PHY the situation is pretty much the same as with
DWC3 core. Here we should control 6 clocks to make Exynos7 USB DRD
PHY working.

By the way, the driver name phy-exynos5-usbdrd.c doesn't imply it
supports Exynos7 :)

>
> Signed-off-by: Vivek Gautam <[email protected]>
> ---
> .../devicetree/bindings/phy/samsung-phy.txt | 4 ++++
> drivers/phy/phy-exynos5-usbdrd.c | 22
> ++++++++++++++++++++
> 2 files changed, 26 insertions(+)
>
> diff --git a/Documentation/devicetree/bindings/phy/samsung-phy.txt
> b/Documentation/devicetree/bindings/phy/samsung-phy.txt
> index 15e0f2c..c2bc9dc 100644
> --- a/Documentation/devicetree/bindings/phy/samsung-phy.txt
> +++ b/Documentation/devicetree/bindings/phy/samsung-phy.txt
> @@ -138,6 +138,10 @@ Required properties:
> PHY operations, associated by phy name. It is used to
> determine bit values for clock settings register.
> For Exynos5420 this is given as 'sclk_usbphy30' in CMU.
> + - optional clocks: Exynos7 SoC has now following additional
> + gate clocks available:
> + - phy_pipe: for PIPE3 phy
> + - phy_utmi: for UTMI+ phy
> - samsung,pmu-syscon: phandle for PMU system controller interface,
> used to
> control pmu registers for power isolation.
> - #phy-cells : from the generic PHY bindings, must be 1;
> diff --git a/drivers/phy/phy-exynos5-usbdrd.c b/drivers/phy/phy-
> exynos5-usbdrd.c
> index f756aca..013ee84 100644
> --- a/drivers/phy/phy-exynos5-usbdrd.c
> +++ b/drivers/phy/phy-exynos5-usbdrd.c
> @@ -148,6 +148,8 @@ struct exynos5_usbdrd_phy_drvdata {
> * @dev: pointer to device instance of this platform device
> * @reg_phy: usb phy controller register memory base
> * @clk: phy clock for register access
> + * @pipeclk: clock for pipe3 phy
> + * @utmiclk: clock for utmi+ phy
> * @drv_data: pointer to SoC level driver data structure
> * @phys[]: array for 'EXYNOS5_DRDPHYS_NUM' number of PHY
> * instances each with its 'phy' and 'phy_cfg'.
> @@ -161,6 +163,8 @@ struct exynos5_usbdrd_phy {
> struct device *dev;
> void __iomem *reg_phy;
> struct clk *clk;
> + struct clk *pipeclk;
> + struct clk *utmiclk;
> const struct exynos5_usbdrd_phy_drvdata *drv_data;
> struct phy_usb_instance {
> struct phy *phy;
> @@ -446,6 +450,8 @@ static int exynos5_usbdrd_phy_power_on(struct phy
> *phy)
>
> dev_dbg(phy_drd->dev, "Request to power_on usbdrd_phy phy\n");
>
> + clk_prepare_enable(phy_drd->utmiclk);
> + clk_prepare_enable(phy_drd->pipeclk);
> clk_prepare_enable(phy_drd->ref_clk);
>
> /* Enable VBUS supply */
> @@ -464,6 +470,8 @@ static int exynos5_usbdrd_phy_power_on(struct phy
> *phy)
>
> fail_vbus:
> clk_disable_unprepare(phy_drd->ref_clk);
> + clk_disable_unprepare(phy_drd->pipeclk);
> + clk_disable_unprepare(phy_drd->utmiclk);
>
> return ret;
> }
> @@ -483,6 +491,8 @@ static int exynos5_usbdrd_phy_power_off(struct phy
> *phy)
> regulator_disable(phy_drd->vbus);
>
> clk_disable_unprepare(phy_drd->ref_clk);
> + clk_disable_unprepare(phy_drd->pipeclk);
> + clk_disable_unprepare(phy_drd->utmiclk);
>
> return 0;
> }
> @@ -582,6 +592,18 @@ static int exynos5_usbdrd_phy_probe(struct
> platform_device *pdev)
> return PTR_ERR(phy_drd->clk);
> }
>
> + phy_drd->pipeclk = devm_clk_get(dev, "phy_pipe");
> + if (IS_ERR(phy_drd->pipeclk)) {
> + dev_info(dev, "PIPE3 phy operational clock not
> specified\n");
> + phy_drd->pipeclk = NULL;
> + }
> +
> + phy_drd->utmiclk = devm_clk_get(dev, "phy_utmi");
> + if (IS_ERR(phy_drd->utmiclk)) {
> + dev_info(dev, "UTMI phy operational clock not specified\n");
> + phy_drd->utmiclk = NULL;
> + }
> +
> phy_drd->ref_clk = devm_clk_get(dev, "ref");
> if (IS_ERR(phy_drd->ref_clk)) {
> dev_err(dev, "Failed to get reference clock of usbdrd
> phy\n");
> --
> 1.7.10.4
>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-usb" in
> the body of a message to [email protected]
> More majordomo info at http://vger.kernel.org/majordomo-info.html

2014-10-13 05:06:47

by Anton Tikhomirov

[permalink] [raw]
Subject: RE: [PATCH v2 3/4] phy: exynos5-usbdrd: Add facility for VBUS-BOOST-5V supply

Hi Vivek,

> Some Exynos SoCs have a separate regulator controlling a

I guess you meant the Exynos based *boards* instead of SoCs,
since Exynos SoCs don't have any boost regulators.

> Boost 5V supply which goes as input for VBUS regulator.
> So adding a control for the same in driver, to enable
> vbus supply on the port.
>
> Signed-off-by: Vivek Gautam <[email protected]>
> ---
> drivers/phy/phy-exynos5-usbdrd.c | 30 ++++++++++++++++++++++++++++--
> 1 file changed, 28 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/phy/phy-exynos5-usbdrd.c b/drivers/phy/phy-
> exynos5-usbdrd.c
> index 013ee84..57e8a0a 100644
> --- a/drivers/phy/phy-exynos5-usbdrd.c
> +++ b/drivers/phy/phy-exynos5-usbdrd.c
> @@ -176,6 +176,7 @@ struct exynos5_usbdrd_phy {
> u32 extrefclk;
> struct clk *ref_clk;
> struct regulator *vbus;
> + struct regulator *vbus_boost;
> };
>
> static inline
> @@ -455,11 +456,20 @@ static int exynos5_usbdrd_phy_power_on(struct phy
> *phy)
> clk_prepare_enable(phy_drd->ref_clk);
>
> /* Enable VBUS supply */
> + if (phy_drd->vbus_boost) {
> + ret = regulator_enable(phy_drd->vbus_boost);
> + if (ret) {
> + dev_err(phy_drd->dev,
> + "Failed to enable VBUS boost supply\n");
> + goto fail_vbus;
> + }
> + }
> +
> if (phy_drd->vbus) {
> ret = regulator_enable(phy_drd->vbus);
> if (ret) {
> dev_err(phy_drd->dev, "Failed to enable VBUS
> supply\n");
> - goto fail_vbus;
> + goto fail_vbus_boost;
> }
> }
>
> @@ -468,6 +478,10 @@ static int exynos5_usbdrd_phy_power_on(struct phy
> *phy)
>
> return 0;
>
> +fail_vbus_boost:
> + if (phy_drd->vbus_boost)
> + regulator_disable(phy_drd->vbus_boost);
> +
> fail_vbus:
> clk_disable_unprepare(phy_drd->ref_clk);
> clk_disable_unprepare(phy_drd->pipeclk);
> @@ -489,6 +503,8 @@ static int exynos5_usbdrd_phy_power_off(struct phy
> *phy)
> /* Disable VBUS supply */
> if (phy_drd->vbus)
> regulator_disable(phy_drd->vbus);
> + if (phy_drd->vbus_boost)
> + regulator_disable(phy_drd->vbus_boost);
>
> clk_disable_unprepare(phy_drd->ref_clk);
> clk_disable_unprepare(phy_drd->pipeclk);
> @@ -644,7 +660,7 @@ static int exynos5_usbdrd_phy_probe(struct
> platform_device *pdev)
> break;
> }
>
> - /* Get Vbus regulator */
> + /* Get Vbus regulators */
> phy_drd->vbus = devm_regulator_get(dev, "vbus");
> if (IS_ERR(phy_drd->vbus)) {
> ret = PTR_ERR(phy_drd->vbus);
> @@ -655,6 +671,16 @@ static int exynos5_usbdrd_phy_probe(struct
> platform_device *pdev)
> phy_drd->vbus = NULL;
> }
>
> + phy_drd->vbus_boost = devm_regulator_get(dev, "vbus-boost");
> + if (IS_ERR(phy_drd->vbus_boost)) {
> + ret = PTR_ERR(phy_drd->vbus_boost);
> + if (ret == -EPROBE_DEFER)
> + return ret;
> +
> + dev_warn(dev, "Failed to get VBUS boost supply
> regulator\n");
> + phy_drd->vbus_boost = NULL;
> + }
> +
> dev_vdbg(dev, "Creating usbdrd_phy phy\n");
>
> for (i = 0; i < EXYNOS5_DRDPHYS_NUM; i++) {
> --
> 1.7.10.4
>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-usb" in
> the body of a message to [email protected]
> More majordomo info at http://vger.kernel.org/majordomo-info.html

2014-10-13 05:11:37

by Vivek Gautam

[permalink] [raw]
Subject: Re: [PATCH v2 3/4] phy: exynos5-usbdrd: Add facility for VBUS-BOOST-5V supply

On Mon, Oct 13, 2014 at 10:36 AM, Anton Tikhomirov
<[email protected]> wrote:
> Hi Vivek,
>
>> Some Exynos SoCs have a separate regulator controlling a
>
> I guess you meant the Exynos based *boards* instead of SoCs,
> since Exynos SoCs don't have any boost regulators.

Right, should be boards instead. Thanks for pointing it out.

>
>> Boost 5V supply which goes as input for VBUS regulator.
>> So adding a control for the same in driver, to enable
>> vbus supply on the port.
>>
>> Signed-off-by: Vivek Gautam <[email protected]>
>> ---
>> drivers/phy/phy-exynos5-usbdrd.c | 30 ++++++++++++++++++++++++++++--
>> 1 file changed, 28 insertions(+), 2 deletions(-)
>>
>> diff --git a/drivers/phy/phy-exynos5-usbdrd.c b/drivers/phy/phy-
>> exynos5-usbdrd.c
>> index 013ee84..57e8a0a 100644
>> --- a/drivers/phy/phy-exynos5-usbdrd.c
>> +++ b/drivers/phy/phy-exynos5-usbdrd.c
>> @@ -176,6 +176,7 @@ struct exynos5_usbdrd_phy {
>> u32 extrefclk;
>> struct clk *ref_clk;
>> struct regulator *vbus;
>> + struct regulator *vbus_boost;
>> };
>>
>> static inline
>> @@ -455,11 +456,20 @@ static int exynos5_usbdrd_phy_power_on(struct phy
>> *phy)
>> clk_prepare_enable(phy_drd->ref_clk);
>>
>> /* Enable VBUS supply */
>> + if (phy_drd->vbus_boost) {
>> + ret = regulator_enable(phy_drd->vbus_boost);
>> + if (ret) {
>> + dev_err(phy_drd->dev,
>> + "Failed to enable VBUS boost supply\n");
>> + goto fail_vbus;
>> + }
>> + }
>> +
>> if (phy_drd->vbus) {
>> ret = regulator_enable(phy_drd->vbus);
>> if (ret) {
>> dev_err(phy_drd->dev, "Failed to enable VBUS
>> supply\n");
>> - goto fail_vbus;
>> + goto fail_vbus_boost;
>> }
>> }
>>
>> @@ -468,6 +478,10 @@ static int exynos5_usbdrd_phy_power_on(struct phy
>> *phy)
>>
>> return 0;
>>
>> +fail_vbus_boost:
>> + if (phy_drd->vbus_boost)
>> + regulator_disable(phy_drd->vbus_boost);
>> +
>> fail_vbus:
>> clk_disable_unprepare(phy_drd->ref_clk);
>> clk_disable_unprepare(phy_drd->pipeclk);
>> @@ -489,6 +503,8 @@ static int exynos5_usbdrd_phy_power_off(struct phy
>> *phy)
>> /* Disable VBUS supply */
>> if (phy_drd->vbus)
>> regulator_disable(phy_drd->vbus);
>> + if (phy_drd->vbus_boost)
>> + regulator_disable(phy_drd->vbus_boost);
>>
>> clk_disable_unprepare(phy_drd->ref_clk);
>> clk_disable_unprepare(phy_drd->pipeclk);
>> @@ -644,7 +660,7 @@ static int exynos5_usbdrd_phy_probe(struct
>> platform_device *pdev)
>> break;
>> }
>>
>> - /* Get Vbus regulator */
>> + /* Get Vbus regulators */
>> phy_drd->vbus = devm_regulator_get(dev, "vbus");
>> if (IS_ERR(phy_drd->vbus)) {
>> ret = PTR_ERR(phy_drd->vbus);
>> @@ -655,6 +671,16 @@ static int exynos5_usbdrd_phy_probe(struct
>> platform_device *pdev)
>> phy_drd->vbus = NULL;
>> }
>>
>> + phy_drd->vbus_boost = devm_regulator_get(dev, "vbus-boost");
>> + if (IS_ERR(phy_drd->vbus_boost)) {
>> + ret = PTR_ERR(phy_drd->vbus_boost);
>> + if (ret == -EPROBE_DEFER)
>> + return ret;
>> +
>> + dev_warn(dev, "Failed to get VBUS boost supply
>> regulator\n");
>> + phy_drd->vbus_boost = NULL;
>> + }
>> +
>> dev_vdbg(dev, "Creating usbdrd_phy phy\n");
>>
>> for (i = 0; i < EXYNOS5_DRDPHYS_NUM; i++) {
>> --
>> 1.7.10.4
>>
>> --
>> To unsubscribe from this list: send the line "unsubscribe linux-usb" in
>> the body of a message to [email protected]
>> More majordomo info at http://vger.kernel.org/majordomo-info.html
>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-samsung-soc" in
> the body of a message to [email protected]
> More majordomo info at http://vger.kernel.org/majordomo-info.html



--
Best Regards
Vivek Gautam
Samsung R&D Institute, Bangalore
India

2014-10-13 22:44:28

by Felipe Balbi

[permalink] [raw]
Subject: Re: [PATCH v2 1/4] dwc3: exynos: Add support for SCLK present on Exynos7

Hi,

On Mon, Oct 13, 2014 at 01:54:59PM +0900, Anton Tikhomirov wrote:
> Hi Vivek,
>
> > Exynos7 also has a separate special gate clock going to the IP
> > apart from the usual AHB clock. So add support for the same.
>
> As we discussed before, Exynos7 SoCs have 7 clocks to be controlled
> by the driver. Adding only sclk is not enough.
>
> >
> > Signed-off-by: Vivek Gautam <[email protected]>
> > ---
> > drivers/usb/dwc3/dwc3-exynos.c | 16 ++++++++++++++++
> > 1 file changed, 16 insertions(+)
> >
> > diff --git a/drivers/usb/dwc3/dwc3-exynos.c b/drivers/usb/dwc3/dwc3-
> > exynos.c
> > index 3951a65..7dc6a98 100644
> > --- a/drivers/usb/dwc3/dwc3-exynos.c
> > +++ b/drivers/usb/dwc3/dwc3-exynos.c
> > @@ -35,6 +35,7 @@ struct dwc3_exynos {
> > struct device *dev;
> >
> > struct clk *clk;
>
> The clock "clk" in Exynos5 just gated all that above 7 clocks, which
> we should control separately now in Exynos7.
>

should I drop this patch for now ?

--
balbi


Attachments:
(No filename) (991.00 B)
signature.asc (819.00 B)
Digital signature
Download all attachments

2014-10-13 22:51:14

by Tomasz Figa

[permalink] [raw]
Subject: Re: [PATCH v2 1/4] dwc3: exynos: Add support for SCLK present on Exynos7

Hi Anton,

On 13.10.2014 06:54, Anton Tikhomirov wrote:
> Hi Vivek,
>
>> Exynos7 also has a separate special gate clock going to the IP
>> apart from the usual AHB clock. So add support for the same.
>
> As we discussed before, Exynos7 SoCs have 7 clocks to be controlled
> by the driver. Adding only sclk is not enough.
>

I'm quite interested in this discussion. Has it happened on mailing lists?

In general, previous SoCs also gave the possibility of controlling all
the bus clocks separately, in addition to bulk gates, but there was no
real advantage in using those, while burdening the clock tree with
numerous clocks. Isn't Exynos7 similar in this aspect?

Best regards,
Tomasz

2014-10-14 01:26:41

by Anton Tikhomirov

[permalink] [raw]
Subject: RE: [PATCH v2 1/4] dwc3: exynos: Add support for SCLK present on Exynos7

Hello,

> Hi Anton,
>
> On 13.10.2014 06:54, Anton Tikhomirov wrote:
> > Hi Vivek,
> >
> >> Exynos7 also has a separate special gate clock going to the IP
> >> apart from the usual AHB clock. So add support for the same.
> >
> > As we discussed before, Exynos7 SoCs have 7 clocks to be controlled
> > by the driver. Adding only sclk is not enough.
> >
>
> I'm quite interested in this discussion. Has it happened on mailing
> lists?

No, we used company messenger for the discussion.

>
> In general, previous SoCs also gave the possibility of controlling all
> the bus clocks separately, in addition to bulk gates, but there was no

correct

> real advantage in using those, while burdening the clock tree with
> numerous clocks. Isn't Exynos7 similar in this aspect?

Exynos7 doesn't have "Gating all clocks for USBDRD30" bit. The clocks
should be controlled separately.

>
> Best regards,
> Tomasz
> --
> To unsubscribe from this list: send the line "unsubscribe linux-usb" in
> the body of a message to [email protected]
> More majordomo info at http://vger.kernel.org/majordomo-info.html

2014-10-14 04:53:40

by Vivek Gautam

[permalink] [raw]
Subject: Re: [PATCH v2 1/4] dwc3: exynos: Add support for SCLK present on Exynos7

Hi Tomasz,


On Tue, Oct 14, 2014 at 6:56 AM, Anton Tikhomirov
<[email protected]> wrote:
> Hello,
>
>> Hi Anton,
>>
>> On 13.10.2014 06:54, Anton Tikhomirov wrote:
>> > Hi Vivek,
>> >
>> >> Exynos7 also has a separate special gate clock going to the IP
>> >> apart from the usual AHB clock. So add support for the same.
>> >
>> > As we discussed before, Exynos7 SoCs have 7 clocks to be controlled
>> > by the driver. Adding only sclk is not enough.
>> >
>>
>> I'm quite interested in this discussion. Has it happened on mailing
>> lists?
>
> No, we used company messenger for the discussion.

Yea, we head a round of discussion at our end regarding this, and we are
going to get more clarity on this from our H/W team too, this week.

>
>>
>> In general, previous SoCs also gave the possibility of controlling all
>> the bus clocks separately, in addition to bulk gates, but there was no
>
> correct
>
>> real advantage in using those, while burdening the clock tree with
>> numerous clocks. Isn't Exynos7 similar in this aspect?
>
> Exynos7 doesn't have "Gating all clocks for USBDRD30" bit. The clocks
> should be controlled separately.

true, on Exynos7 we have separate gates for the available clocks going to
USB-DRD block. So we will have to add these basic required number of
clocks.





--
Best Regards
Vivek Gautam
Samsung R&D Institute, Bangalore
India

2014-10-14 04:55:06

by Vivek Gautam

[permalink] [raw]
Subject: Re: [PATCH v2 1/4] dwc3: exynos: Add support for SCLK present on Exynos7

Hi Felipe,


On Tue, Oct 14, 2014 at 4:14 AM, Felipe Balbi <[email protected]> wrote:
> Hi,
>
> On Mon, Oct 13, 2014 at 01:54:59PM +0900, Anton Tikhomirov wrote:
>> Hi Vivek,
>>
>> > Exynos7 also has a separate special gate clock going to the IP
>> > apart from the usual AHB clock. So add support for the same.
>>
>> As we discussed before, Exynos7 SoCs have 7 clocks to be controlled
>> by the driver. Adding only sclk is not enough.
>>
>> >
>> > Signed-off-by: Vivek Gautam <[email protected]>
>> > ---
>> > drivers/usb/dwc3/dwc3-exynos.c | 16 ++++++++++++++++
>> > 1 file changed, 16 insertions(+)
>> >
>> > diff --git a/drivers/usb/dwc3/dwc3-exynos.c b/drivers/usb/dwc3/dwc3-
>> > exynos.c
>> > index 3951a65..7dc6a98 100644
>> > --- a/drivers/usb/dwc3/dwc3-exynos.c
>> > +++ b/drivers/usb/dwc3/dwc3-exynos.c
>> > @@ -35,6 +35,7 @@ struct dwc3_exynos {
>> > struct device *dev;
>> >
>> > struct clk *clk;
>>
>> The clock "clk" in Exynos5 just gated all that above 7 clocks, which
>> we should control separately now in Exynos7.
>>
>
> should I drop this patch for now ?

Yes, better to hold this for some time till we get more clarity
from our h/w team.


--
Best Regards
Vivek Gautam
Samsung R&D Institute, Bangalore
India

2014-10-15 14:50:51

by Felipe Balbi

[permalink] [raw]
Subject: Re: [PATCH v2 1/4] dwc3: exynos: Add support for SCLK present on Exynos7

Hi,

On Tue, Oct 14, 2014 at 10:25:00AM +0530, Vivek Gautam wrote:
> Hi Felipe,
>
>
> On Tue, Oct 14, 2014 at 4:14 AM, Felipe Balbi <[email protected]> wrote:
> > Hi,
> >
> > On Mon, Oct 13, 2014 at 01:54:59PM +0900, Anton Tikhomirov wrote:
> >> Hi Vivek,
> >>
> >> > Exynos7 also has a separate special gate clock going to the IP
> >> > apart from the usual AHB clock. So add support for the same.
> >>
> >> As we discussed before, Exynos7 SoCs have 7 clocks to be controlled
> >> by the driver. Adding only sclk is not enough.
> >>
> >> >
> >> > Signed-off-by: Vivek Gautam <[email protected]>
> >> > ---
> >> > drivers/usb/dwc3/dwc3-exynos.c | 16 ++++++++++++++++
> >> > 1 file changed, 16 insertions(+)
> >> >
> >> > diff --git a/drivers/usb/dwc3/dwc3-exynos.c b/drivers/usb/dwc3/dwc3-
> >> > exynos.c
> >> > index 3951a65..7dc6a98 100644
> >> > --- a/drivers/usb/dwc3/dwc3-exynos.c
> >> > +++ b/drivers/usb/dwc3/dwc3-exynos.c
> >> > @@ -35,6 +35,7 @@ struct dwc3_exynos {
> >> > struct device *dev;
> >> >
> >> > struct clk *clk;
> >>
> >> The clock "clk" in Exynos5 just gated all that above 7 clocks, which
> >> we should control separately now in Exynos7.
> >>
> >
> > should I drop this patch for now ?
>
> Yes, better to hold this for some time till we get more clarity
> from our h/w team.

now dropped. Please a new one if needed.

--
balbi


Attachments:
(No filename) (1.36 kB)
signature.asc (819.00 B)
Digital signature
Download all attachments

2014-10-22 11:53:50

by Kishon Vijay Abraham I

[permalink] [raw]
Subject: Re: [PATCH v2 2/4] phy: exynos5-usbdrd: Add pipe-clk and utmi-clk support

Hi,

On Tuesday 07 October 2014 03:49 PM, Vivek Gautam wrote:
> Exynos7 SoC has now separate gate control for 125MHz pipe3 phy
> clock, as well as 60MHz utmi phy clock.
> So get the same and control in the phy-exynos5-usbdrd driver.
>
> Signed-off-by: Vivek Gautam <[email protected]>
> ---
> .../devicetree/bindings/phy/samsung-phy.txt | 4 ++++
> drivers/phy/phy-exynos5-usbdrd.c | 22 ++++++++++++++++++++
> 2 files changed, 26 insertions(+)
>
> diff --git a/Documentation/devicetree/bindings/phy/samsung-phy.txt b/Documentation/devicetree/bindings/phy/samsung-phy.txt
> index 15e0f2c..c2bc9dc 100644
> --- a/Documentation/devicetree/bindings/phy/samsung-phy.txt
> +++ b/Documentation/devicetree/bindings/phy/samsung-phy.txt
> @@ -138,6 +138,10 @@ Required properties:
> PHY operations, associated by phy name. It is used to
> determine bit values for clock settings register.
> For Exynos5420 this is given as 'sclk_usbphy30' in CMU.
> + - optional clocks: Exynos7 SoC has now following additional
> + gate clocks available:
> + - phy_pipe: for PIPE3 phy
> + - phy_utmi: for UTMI+ phy
> - samsung,pmu-syscon: phandle for PMU system controller interface, used to
> control pmu registers for power isolation.
> - #phy-cells : from the generic PHY bindings, must be 1;
> diff --git a/drivers/phy/phy-exynos5-usbdrd.c b/drivers/phy/phy-exynos5-usbdrd.c
> index f756aca..013ee84 100644
> --- a/drivers/phy/phy-exynos5-usbdrd.c
> +++ b/drivers/phy/phy-exynos5-usbdrd.c
> @@ -148,6 +148,8 @@ struct exynos5_usbdrd_phy_drvdata {
> * @dev: pointer to device instance of this platform device
> * @reg_phy: usb phy controller register memory base
> * @clk: phy clock for register access
> + * @pipeclk: clock for pipe3 phy
> + * @utmiclk: clock for utmi+ phy
> * @drv_data: pointer to SoC level driver data structure
> * @phys[]: array for 'EXYNOS5_DRDPHYS_NUM' number of PHY
> * instances each with its 'phy' and 'phy_cfg'.
> @@ -161,6 +163,8 @@ struct exynos5_usbdrd_phy {
> struct device *dev;
> void __iomem *reg_phy;
> struct clk *clk;
> + struct clk *pipeclk;
> + struct clk *utmiclk;
> const struct exynos5_usbdrd_phy_drvdata *drv_data;
> struct phy_usb_instance {
> struct phy *phy;
> @@ -446,6 +450,8 @@ static int exynos5_usbdrd_phy_power_on(struct phy *phy)
>
> dev_dbg(phy_drd->dev, "Request to power_on usbdrd_phy phy\n");
>
> + clk_prepare_enable(phy_drd->utmiclk);
> + clk_prepare_enable(phy_drd->pipeclk);

We can have a separate function for powering on/off usb3 phy and usb2 phy
independently. That way if the USB controller is operating only on high speed
mode, the pipe clock need not be enabled at all.

I think we should create separate PHYs (phy_create) for usb2 phy and usb3 phy
here. Please refer how Lee Jones did that for miphy365x modelling each PHY as a
child node to the PHY provider and doing phy_create for each child node.

Thanks
Kishon