All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v5 0/2] usb: chipidea: imx: Add USB configuration for imx53
@ 2016-09-21  9:07 Fabien Lahoudere
  2016-09-21  9:07   ` Fabien Lahoudere
  2016-09-21  9:07 ` [PATCH v5 2/2] usb: chipidea: imx: Add binding to disable USB 60Mhz clock Fabien Lahoudere
  0 siblings, 2 replies; 9+ messages in thread
From: Fabien Lahoudere @ 2016-09-21  9:07 UTC (permalink / raw)
  To: Peter.Chen
  Cc: gregkh, linux-usb, robh+dt, mark.rutland, devicetree,
	linux-kernel, Fabien Lahoudere

Changes in V2:
	- Patches sent to early with bad contents
Changes in V3:
	- Change subject
	- Split "configure imx for ULPI phy" for disable-oc code
Changes in V4:
	- Fix "Change switch order" commit message
	- Indent switch/case (set case on the same column as switch)
	- Remove useless test in "Change switch order"
Changes in V5:
	- Squash "Change switch order" and "configure imx for ULPI phy"
	- Add device tree binding documentation

Fabien Lahoudere (2):
  usb: chipidea: imx: configure imx for ULPI phy
  usb: chipidea: imx: Add binding to disable USB 60Mhz clock

 .../devicetree/bindings/usb/ci-hdrc-usb2.txt       |  1 +
 drivers/usb/chipidea/ci_hdrc_imx.c                 |  7 ++
 drivers/usb/chipidea/ci_hdrc_imx.h                 |  2 +
 drivers/usb/chipidea/usbmisc_imx.c                 | 88 ++++++++++++++++++----
 4 files changed, 84 insertions(+), 14 deletions(-)

-- 
2.1.4

^ permalink raw reply	[flat|nested] 9+ messages in thread

* [PATCH v5 1/2] usb: chipidea: imx: configure imx for ULPI phy
@ 2016-09-21  9:07   ` Fabien Lahoudere
  0 siblings, 0 replies; 9+ messages in thread
From: Fabien Lahoudere @ 2016-09-21  9:07 UTC (permalink / raw)
  To: Peter.Chen
  Cc: gregkh, linux-usb, robh+dt, mark.rutland, devicetree,
	linux-kernel, Fabien Lahoudere

In order to use ULPI phy with usb host 2 and 3, we need to configure
controller register to enable ULPI features.

Each USB controller have different behaviour, so in order to avoid to have
several "swicth(data->index)" and lock/unlock, we prefer to get the index
switch and then test for features if they exist for this index.
This patch also remove useless test of reg and val. Those two values cannot
be NULL.

Signed-off-by: Fabien Lahoudere <fabien.lahoudere@collabora.co.uk>
---
 drivers/usb/chipidea/ci_hdrc_imx.c |  5 +++
 drivers/usb/chipidea/ci_hdrc_imx.h |  1 +
 drivers/usb/chipidea/usbmisc_imx.c | 75 +++++++++++++++++++++++++++++++-------
 3 files changed, 67 insertions(+), 14 deletions(-)

diff --git a/drivers/usb/chipidea/ci_hdrc_imx.c b/drivers/usb/chipidea/ci_hdrc_imx.c
index 0991794..96c0e33 100644
--- a/drivers/usb/chipidea/ci_hdrc_imx.c
+++ b/drivers/usb/chipidea/ci_hdrc_imx.c
@@ -18,6 +18,7 @@
 #include <linux/pm_runtime.h>
 #include <linux/dma-mapping.h>
 #include <linux/usb/chipidea.h>
+#include <linux/usb/of.h>
 #include <linux/clk.h>
 
 #include "ci.h"
@@ -146,6 +147,10 @@ static struct imx_usbmisc_data *usbmisc_get_init_data(struct device *dev)
 	if (of_find_property(np, "external-vbus-divider", NULL))
 		data->evdo = 1;
 
+
+	if (of_usb_get_phy_mode(np) == USBPHY_INTERFACE_MODE_ULPI)
+		data->ulpi = 1;
+
 	return data;
 }
 
diff --git a/drivers/usb/chipidea/ci_hdrc_imx.h b/drivers/usb/chipidea/ci_hdrc_imx.h
index 409aa5ca8..d666c9f 100644
--- a/drivers/usb/chipidea/ci_hdrc_imx.h
+++ b/drivers/usb/chipidea/ci_hdrc_imx.h
@@ -19,6 +19,7 @@ struct imx_usbmisc_data {
 	unsigned int disable_oc:1; /* over current detect disabled */
 	unsigned int oc_polarity:1; /* over current polarity if oc enabled */
 	unsigned int evdo:1; /* set external vbus divider option */
+	unsigned int ulpi:1; /* connected to an ULPI phy */
 };
 
 int imx_usbmisc_init(struct imx_usbmisc_data *);
diff --git a/drivers/usb/chipidea/usbmisc_imx.c b/drivers/usb/chipidea/usbmisc_imx.c
index 20d02a5..11f51bd 100644
--- a/drivers/usb/chipidea/usbmisc_imx.c
+++ b/drivers/usb/chipidea/usbmisc_imx.c
@@ -46,11 +46,20 @@
 
 #define MX53_USB_OTG_PHY_CTRL_0_OFFSET	0x08
 #define MX53_USB_OTG_PHY_CTRL_1_OFFSET	0x0c
+#define MX53_USB_CTRL_1_OFFSET	        0x10
+#define MX53_USB_CTRL_1_H2_XCVR_CLK_SEL_MASK (0x11 << 2)
+#define MX53_USB_CTRL_1_H2_XCVR_CLK_SEL_ULPI BIT(2)
+#define MX53_USB_CTRL_1_H3_XCVR_CLK_SEL_MASK (0x11 << 6)
+#define MX53_USB_CTRL_1_H3_XCVR_CLK_SEL_ULPI BIT(6)
 #define MX53_USB_UH2_CTRL_OFFSET	0x14
 #define MX53_USB_UH3_CTRL_OFFSET	0x18
 #define MX53_BM_OVER_CUR_DIS_H1		BIT(5)
 #define MX53_BM_OVER_CUR_DIS_OTG	BIT(8)
 #define MX53_BM_OVER_CUR_DIS_UHx	BIT(30)
+#define MX53_USB_CTRL_1_UH2_ULPI_EN	BIT(26)
+#define MX53_USB_CTRL_1_UH3_ULPI_EN	BIT(27)
+#define MX53_USB_UHx_CTRL_WAKE_UP_EN	BIT(7)
+#define MX53_USB_UHx_CTRL_ULPI_INT_EN	BIT(8)
 #define MX53_USB_PHYCTRL1_PLLDIV_MASK	0x3
 #define MX53_USB_PLL_DIV_24_MHZ		0x01
 
@@ -199,31 +208,69 @@ static int usbmisc_imx53_init(struct imx_usbmisc_data *data)
 	val |= MX53_USB_PLL_DIV_24_MHZ;
 	writel(val, usbmisc->base + MX53_USB_OTG_PHY_CTRL_1_OFFSET);
 
-	if (data->disable_oc) {
-		spin_lock_irqsave(&usbmisc->lock, flags);
-		switch (data->index) {
-		case 0:
+	spin_lock_irqsave(&usbmisc->lock, flags);
+
+	switch (data->index) {
+	case 0:
+		if (data->disable_oc) {
 			reg = usbmisc->base + MX53_USB_OTG_PHY_CTRL_0_OFFSET;
 			val = readl(reg) | MX53_BM_OVER_CUR_DIS_OTG;
-			break;
-		case 1:
+			writel(val, reg);
+		}
+		break;
+	case 1:
+		if (data->disable_oc) {
 			reg = usbmisc->base + MX53_USB_OTG_PHY_CTRL_0_OFFSET;
 			val = readl(reg) | MX53_BM_OVER_CUR_DIS_H1;
-			break;
-		case 2:
+			writel(val, reg);
+		}
+		break;
+	case 2:
+		if (data->ulpi) {
+			/* set USBH2 into ULPI-mode. */
+			reg = usbmisc->base + MX53_USB_CTRL_1_OFFSET;
+			val = readl(reg) | MX53_USB_CTRL_1_UH2_ULPI_EN;
+			/* select ULPI clock */
+			val &= ~MX53_USB_CTRL_1_H2_XCVR_CLK_SEL_MASK;
+			val |= MX53_USB_CTRL_1_H2_XCVR_CLK_SEL_ULPI;
+			writel(val, reg);
+			/* Set interrupt wake up enable */
+			reg = usbmisc->base + MX53_USB_UH2_CTRL_OFFSET;
+			val = readl(reg) | MX53_USB_UHx_CTRL_WAKE_UP_EN
+				| MX53_USB_UHx_CTRL_ULPI_INT_EN;
+			writel(val, reg);
+		}
+		if (data->disable_oc) {
 			reg = usbmisc->base + MX53_USB_UH2_CTRL_OFFSET;
 			val = readl(reg) | MX53_BM_OVER_CUR_DIS_UHx;
-			break;
-		case 3:
+			writel(val, reg);
+		}
+		break;
+	case 3:
+		if (data->ulpi) {
+			/* set USBH3 into ULPI-mode. */
+			reg = usbmisc->base + MX53_USB_CTRL_1_OFFSET;
+			val = readl(reg) | MX53_USB_CTRL_1_UH3_ULPI_EN;
+			/* select ULPI clock */
+			val &= ~MX53_USB_CTRL_1_H3_XCVR_CLK_SEL_MASK;
+			val |= MX53_USB_CTRL_1_H3_XCVR_CLK_SEL_ULPI;
+			writel(val, reg);
+			/* Set interrupt wake up enable */
 			reg = usbmisc->base + MX53_USB_UH3_CTRL_OFFSET;
-			val = readl(reg) | MX53_BM_OVER_CUR_DIS_UHx;
-			break;
+			val = readl(reg) | MX53_USB_UHx_CTRL_WAKE_UP_EN
+				| MX53_USB_UHx_CTRL_ULPI_INT_EN;
+			writel(val, reg);
 		}
-		if (reg && val)
+		if (data->disable_oc) {
+			reg = usbmisc->base + MX53_USB_UH3_CTRL_OFFSET;
+			val = readl(reg) | MX53_BM_OVER_CUR_DIS_UHx;
 			writel(val, reg);
-		spin_unlock_irqrestore(&usbmisc->lock, flags);
+		}
+		break;
 	}
 
+	spin_unlock_irqrestore(&usbmisc->lock, flags);
+
 	return 0;
 }
 
-- 
2.1.4

^ permalink raw reply related	[flat|nested] 9+ messages in thread

* [PATCH v5 1/2] usb: chipidea: imx: configure imx for ULPI phy
@ 2016-09-21  9:07   ` Fabien Lahoudere
  0 siblings, 0 replies; 9+ messages in thread
From: Fabien Lahoudere @ 2016-09-21  9:07 UTC (permalink / raw)
  To: Peter.Chen-3arQi8VN3Tc
  Cc: gregkh-hQyY1W1yCW8ekmWlsbkhG0B+6BGkLq7r,
	linux-usb-u79uwXL29TY76Z2rM5mHXA, robh+dt-DgEjT+Ai2ygdnm+yROfE0A,
	mark.rutland-5wv7dgnIgG8, devicetree-u79uwXL29TY76Z2rM5mHXA,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA, Fabien Lahoudere

In order to use ULPI phy with usb host 2 and 3, we need to configure
controller register to enable ULPI features.

Each USB controller have different behaviour, so in order to avoid to have
several "swicth(data->index)" and lock/unlock, we prefer to get the index
switch and then test for features if they exist for this index.
This patch also remove useless test of reg and val. Those two values cannot
be NULL.

Signed-off-by: Fabien Lahoudere <fabien.lahoudere-ZGY8ohtN/8pPYcu2f3hruQ@public.gmane.org>
---
 drivers/usb/chipidea/ci_hdrc_imx.c |  5 +++
 drivers/usb/chipidea/ci_hdrc_imx.h |  1 +
 drivers/usb/chipidea/usbmisc_imx.c | 75 +++++++++++++++++++++++++++++++-------
 3 files changed, 67 insertions(+), 14 deletions(-)

diff --git a/drivers/usb/chipidea/ci_hdrc_imx.c b/drivers/usb/chipidea/ci_hdrc_imx.c
index 0991794..96c0e33 100644
--- a/drivers/usb/chipidea/ci_hdrc_imx.c
+++ b/drivers/usb/chipidea/ci_hdrc_imx.c
@@ -18,6 +18,7 @@
 #include <linux/pm_runtime.h>
 #include <linux/dma-mapping.h>
 #include <linux/usb/chipidea.h>
+#include <linux/usb/of.h>
 #include <linux/clk.h>
 
 #include "ci.h"
@@ -146,6 +147,10 @@ static struct imx_usbmisc_data *usbmisc_get_init_data(struct device *dev)
 	if (of_find_property(np, "external-vbus-divider", NULL))
 		data->evdo = 1;
 
+
+	if (of_usb_get_phy_mode(np) == USBPHY_INTERFACE_MODE_ULPI)
+		data->ulpi = 1;
+
 	return data;
 }
 
diff --git a/drivers/usb/chipidea/ci_hdrc_imx.h b/drivers/usb/chipidea/ci_hdrc_imx.h
index 409aa5ca8..d666c9f 100644
--- a/drivers/usb/chipidea/ci_hdrc_imx.h
+++ b/drivers/usb/chipidea/ci_hdrc_imx.h
@@ -19,6 +19,7 @@ struct imx_usbmisc_data {
 	unsigned int disable_oc:1; /* over current detect disabled */
 	unsigned int oc_polarity:1; /* over current polarity if oc enabled */
 	unsigned int evdo:1; /* set external vbus divider option */
+	unsigned int ulpi:1; /* connected to an ULPI phy */
 };
 
 int imx_usbmisc_init(struct imx_usbmisc_data *);
diff --git a/drivers/usb/chipidea/usbmisc_imx.c b/drivers/usb/chipidea/usbmisc_imx.c
index 20d02a5..11f51bd 100644
--- a/drivers/usb/chipidea/usbmisc_imx.c
+++ b/drivers/usb/chipidea/usbmisc_imx.c
@@ -46,11 +46,20 @@
 
 #define MX53_USB_OTG_PHY_CTRL_0_OFFSET	0x08
 #define MX53_USB_OTG_PHY_CTRL_1_OFFSET	0x0c
+#define MX53_USB_CTRL_1_OFFSET	        0x10
+#define MX53_USB_CTRL_1_H2_XCVR_CLK_SEL_MASK (0x11 << 2)
+#define MX53_USB_CTRL_1_H2_XCVR_CLK_SEL_ULPI BIT(2)
+#define MX53_USB_CTRL_1_H3_XCVR_CLK_SEL_MASK (0x11 << 6)
+#define MX53_USB_CTRL_1_H3_XCVR_CLK_SEL_ULPI BIT(6)
 #define MX53_USB_UH2_CTRL_OFFSET	0x14
 #define MX53_USB_UH3_CTRL_OFFSET	0x18
 #define MX53_BM_OVER_CUR_DIS_H1		BIT(5)
 #define MX53_BM_OVER_CUR_DIS_OTG	BIT(8)
 #define MX53_BM_OVER_CUR_DIS_UHx	BIT(30)
+#define MX53_USB_CTRL_1_UH2_ULPI_EN	BIT(26)
+#define MX53_USB_CTRL_1_UH3_ULPI_EN	BIT(27)
+#define MX53_USB_UHx_CTRL_WAKE_UP_EN	BIT(7)
+#define MX53_USB_UHx_CTRL_ULPI_INT_EN	BIT(8)
 #define MX53_USB_PHYCTRL1_PLLDIV_MASK	0x3
 #define MX53_USB_PLL_DIV_24_MHZ		0x01
 
@@ -199,31 +208,69 @@ static int usbmisc_imx53_init(struct imx_usbmisc_data *data)
 	val |= MX53_USB_PLL_DIV_24_MHZ;
 	writel(val, usbmisc->base + MX53_USB_OTG_PHY_CTRL_1_OFFSET);
 
-	if (data->disable_oc) {
-		spin_lock_irqsave(&usbmisc->lock, flags);
-		switch (data->index) {
-		case 0:
+	spin_lock_irqsave(&usbmisc->lock, flags);
+
+	switch (data->index) {
+	case 0:
+		if (data->disable_oc) {
 			reg = usbmisc->base + MX53_USB_OTG_PHY_CTRL_0_OFFSET;
 			val = readl(reg) | MX53_BM_OVER_CUR_DIS_OTG;
-			break;
-		case 1:
+			writel(val, reg);
+		}
+		break;
+	case 1:
+		if (data->disable_oc) {
 			reg = usbmisc->base + MX53_USB_OTG_PHY_CTRL_0_OFFSET;
 			val = readl(reg) | MX53_BM_OVER_CUR_DIS_H1;
-			break;
-		case 2:
+			writel(val, reg);
+		}
+		break;
+	case 2:
+		if (data->ulpi) {
+			/* set USBH2 into ULPI-mode. */
+			reg = usbmisc->base + MX53_USB_CTRL_1_OFFSET;
+			val = readl(reg) | MX53_USB_CTRL_1_UH2_ULPI_EN;
+			/* select ULPI clock */
+			val &= ~MX53_USB_CTRL_1_H2_XCVR_CLK_SEL_MASK;
+			val |= MX53_USB_CTRL_1_H2_XCVR_CLK_SEL_ULPI;
+			writel(val, reg);
+			/* Set interrupt wake up enable */
+			reg = usbmisc->base + MX53_USB_UH2_CTRL_OFFSET;
+			val = readl(reg) | MX53_USB_UHx_CTRL_WAKE_UP_EN
+				| MX53_USB_UHx_CTRL_ULPI_INT_EN;
+			writel(val, reg);
+		}
+		if (data->disable_oc) {
 			reg = usbmisc->base + MX53_USB_UH2_CTRL_OFFSET;
 			val = readl(reg) | MX53_BM_OVER_CUR_DIS_UHx;
-			break;
-		case 3:
+			writel(val, reg);
+		}
+		break;
+	case 3:
+		if (data->ulpi) {
+			/* set USBH3 into ULPI-mode. */
+			reg = usbmisc->base + MX53_USB_CTRL_1_OFFSET;
+			val = readl(reg) | MX53_USB_CTRL_1_UH3_ULPI_EN;
+			/* select ULPI clock */
+			val &= ~MX53_USB_CTRL_1_H3_XCVR_CLK_SEL_MASK;
+			val |= MX53_USB_CTRL_1_H3_XCVR_CLK_SEL_ULPI;
+			writel(val, reg);
+			/* Set interrupt wake up enable */
 			reg = usbmisc->base + MX53_USB_UH3_CTRL_OFFSET;
-			val = readl(reg) | MX53_BM_OVER_CUR_DIS_UHx;
-			break;
+			val = readl(reg) | MX53_USB_UHx_CTRL_WAKE_UP_EN
+				| MX53_USB_UHx_CTRL_ULPI_INT_EN;
+			writel(val, reg);
 		}
-		if (reg && val)
+		if (data->disable_oc) {
+			reg = usbmisc->base + MX53_USB_UH3_CTRL_OFFSET;
+			val = readl(reg) | MX53_BM_OVER_CUR_DIS_UHx;
 			writel(val, reg);
-		spin_unlock_irqrestore(&usbmisc->lock, flags);
+		}
+		break;
 	}
 
+	spin_unlock_irqrestore(&usbmisc->lock, flags);
+
 	return 0;
 }
 
-- 
2.1.4

--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply related	[flat|nested] 9+ messages in thread

* [PATCH v5 2/2] usb: chipidea: imx: Add binding to disable USB 60Mhz clock
  2016-09-21  9:07 [PATCH v5 0/2] usb: chipidea: imx: Add USB configuration for imx53 Fabien Lahoudere
  2016-09-21  9:07   ` Fabien Lahoudere
@ 2016-09-21  9:07 ` Fabien Lahoudere
  2016-09-23 19:47   ` Rob Herring
  2016-09-26  8:18   ` Sascha Hauer
  1 sibling, 2 replies; 9+ messages in thread
From: Fabien Lahoudere @ 2016-09-21  9:07 UTC (permalink / raw)
  To: Peter.Chen
  Cc: gregkh, linux-usb, robh+dt, mark.rutland, devicetree,
	linux-kernel, Fabien Lahoudere

This binding allow to disable the internal 60Mhz clock for USB host2 or
host3.

Signed-off-by: Fabien Lahoudere <fabien.lahoudere@collabora.co.uk>
---
 Documentation/devicetree/bindings/usb/ci-hdrc-usb2.txt |  1 +
 drivers/usb/chipidea/ci_hdrc_imx.c                     |  2 ++
 drivers/usb/chipidea/ci_hdrc_imx.h                     |  1 +
 drivers/usb/chipidea/usbmisc_imx.c                     | 13 +++++++++++++
 4 files changed, 17 insertions(+)

diff --git a/Documentation/devicetree/bindings/usb/ci-hdrc-usb2.txt b/Documentation/devicetree/bindings/usb/ci-hdrc-usb2.txt
index 0e03344..f83da66 100644
--- a/Documentation/devicetree/bindings/usb/ci-hdrc-usb2.txt
+++ b/Documentation/devicetree/bindings/usb/ci-hdrc-usb2.txt
@@ -84,6 +84,7 @@ i.mx specific properties
 - over-current-active-high: over current signal polarity is high active,
   typically over current signal polarity is low active.
 - external-vbus-divider: enables off-chip resistor divider for Vbus
+- disable-int60ck: disable internal 60MHz clock for usb host2 or host3 on imx53
 
 Example:
 
diff --git a/drivers/usb/chipidea/ci_hdrc_imx.c b/drivers/usb/chipidea/ci_hdrc_imx.c
index 96c0e33..89a9d98 100644
--- a/drivers/usb/chipidea/ci_hdrc_imx.c
+++ b/drivers/usb/chipidea/ci_hdrc_imx.c
@@ -147,6 +147,8 @@ static struct imx_usbmisc_data *usbmisc_get_init_data(struct device *dev)
 	if (of_find_property(np, "external-vbus-divider", NULL))
 		data->evdo = 1;
 
+	if (of_find_property(np, "disable-int60ck", NULL))
+		data->disable_int60ck = 1;
 
 	if (of_usb_get_phy_mode(np) == USBPHY_INTERFACE_MODE_ULPI)
 		data->ulpi = 1;
diff --git a/drivers/usb/chipidea/ci_hdrc_imx.h b/drivers/usb/chipidea/ci_hdrc_imx.h
index d666c9f..43bafae 100644
--- a/drivers/usb/chipidea/ci_hdrc_imx.h
+++ b/drivers/usb/chipidea/ci_hdrc_imx.h
@@ -20,6 +20,7 @@ struct imx_usbmisc_data {
 	unsigned int oc_polarity:1; /* over current polarity if oc enabled */
 	unsigned int evdo:1; /* set external vbus divider option */
 	unsigned int ulpi:1; /* connected to an ULPI phy */
+	unsigned int disable_int60ck:1; /* disable 60 MHZ clock */
 };
 
 int imx_usbmisc_init(struct imx_usbmisc_data *);
diff --git a/drivers/usb/chipidea/usbmisc_imx.c b/drivers/usb/chipidea/usbmisc_imx.c
index 11f51bd..a781f87 100644
--- a/drivers/usb/chipidea/usbmisc_imx.c
+++ b/drivers/usb/chipidea/usbmisc_imx.c
@@ -53,6 +53,9 @@
 #define MX53_USB_CTRL_1_H3_XCVR_CLK_SEL_ULPI BIT(6)
 #define MX53_USB_UH2_CTRL_OFFSET	0x14
 #define MX53_USB_UH3_CTRL_OFFSET	0x18
+#define MX53_USB_CLKONOFF_CTRL_OFFSET	0x24
+#define MX53_USB_CLKONOFF_CTRL_H2_INT60CKOFF BIT(21)
+#define MX53_USB_CLKONOFF_CTRL_H3_INT60CKOFF BIT(22)
 #define MX53_BM_OVER_CUR_DIS_H1		BIT(5)
 #define MX53_BM_OVER_CUR_DIS_OTG	BIT(8)
 #define MX53_BM_OVER_CUR_DIS_UHx	BIT(30)
@@ -240,6 +243,11 @@ static int usbmisc_imx53_init(struct imx_usbmisc_data *data)
 				| MX53_USB_UHx_CTRL_ULPI_INT_EN;
 			writel(val, reg);
 		}
+		if (data->disable_int60ck) {
+			reg = usbmisc->base + MX53_USB_CLKONOFF_CTRL_OFFSET;
+			val = readl(reg) | MX53_USB_CLKONOFF_CTRL_H2_INT60CKOFF;
+			writel(val, reg);
+		}
 		if (data->disable_oc) {
 			reg = usbmisc->base + MX53_USB_UH2_CTRL_OFFSET;
 			val = readl(reg) | MX53_BM_OVER_CUR_DIS_UHx;
@@ -261,6 +269,11 @@ static int usbmisc_imx53_init(struct imx_usbmisc_data *data)
 				| MX53_USB_UHx_CTRL_ULPI_INT_EN;
 			writel(val, reg);
 		}
+		if (data->disable_int60ck) {
+			reg = usbmisc->base + MX53_USB_CLKONOFF_CTRL_OFFSET;
+			val = readl(reg) | MX53_USB_CLKONOFF_CTRL_H3_INT60CKOFF;
+			writel(val, reg);
+		}
 		if (data->disable_oc) {
 			reg = usbmisc->base + MX53_USB_UH3_CTRL_OFFSET;
 			val = readl(reg) | MX53_BM_OVER_CUR_DIS_UHx;
-- 
2.1.4

^ permalink raw reply related	[flat|nested] 9+ messages in thread

* Re: [PATCH v5 2/2] usb: chipidea: imx: Add binding to disable USB 60Mhz clock
  2016-09-21  9:07 ` [PATCH v5 2/2] usb: chipidea: imx: Add binding to disable USB 60Mhz clock Fabien Lahoudere
@ 2016-09-23 19:47   ` Rob Herring
  2016-09-26  9:00       ` Fabien Lahoudere
  2016-09-26  8:18   ` Sascha Hauer
  1 sibling, 1 reply; 9+ messages in thread
From: Rob Herring @ 2016-09-23 19:47 UTC (permalink / raw)
  To: Fabien Lahoudere
  Cc: Peter.Chen, gregkh, linux-usb, mark.rutland, devicetree, linux-kernel

On Wed, Sep 21, 2016 at 11:07:07AM +0200, Fabien Lahoudere wrote:
> This binding allow to disable the internal 60Mhz clock for USB host2 or
> host3.
> 
> Signed-off-by: Fabien Lahoudere <fabien.lahoudere@collabora.co.uk>
> ---
>  Documentation/devicetree/bindings/usb/ci-hdrc-usb2.txt |  1 +
>  drivers/usb/chipidea/ci_hdrc_imx.c                     |  2 ++
>  drivers/usb/chipidea/ci_hdrc_imx.h                     |  1 +
>  drivers/usb/chipidea/usbmisc_imx.c                     | 13 +++++++++++++
>  4 files changed, 17 insertions(+)
> 
> diff --git a/Documentation/devicetree/bindings/usb/ci-hdrc-usb2.txt b/Documentation/devicetree/bindings/usb/ci-hdrc-usb2.txt
> index 0e03344..f83da66 100644
> --- a/Documentation/devicetree/bindings/usb/ci-hdrc-usb2.txt
> +++ b/Documentation/devicetree/bindings/usb/ci-hdrc-usb2.txt
> @@ -84,6 +84,7 @@ i.mx specific properties
>  - over-current-active-high: over current signal polarity is high active,
>    typically over current signal polarity is low active.
>  - external-vbus-divider: enables off-chip resistor divider for Vbus
> +- disable-int60ck: disable internal 60MHz clock for usb host2 or host3 on imx53

Doesn't this depend on something else like the type of phy connected? If 
not, when can you do this or not?

Rob

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH v5 2/2] usb: chipidea: imx: Add binding to disable USB 60Mhz clock
  2016-09-21  9:07 ` [PATCH v5 2/2] usb: chipidea: imx: Add binding to disable USB 60Mhz clock Fabien Lahoudere
  2016-09-23 19:47   ` Rob Herring
@ 2016-09-26  8:18   ` Sascha Hauer
  2016-09-26  8:54     ` Fabien Lahoudere
  1 sibling, 1 reply; 9+ messages in thread
From: Sascha Hauer @ 2016-09-26  8:18 UTC (permalink / raw)
  To: Fabien Lahoudere
  Cc: Peter.Chen, gregkh, linux-usb, robh+dt, mark.rutland, devicetree,
	linux-kernel

On Wed, Sep 21, 2016 at 11:07:07AM +0200, Fabien Lahoudere wrote:
> This binding allow to disable the internal 60Mhz clock for USB host2 or
> host3.
> 
> Signed-off-by: Fabien Lahoudere <fabien.lahoudere@collabora.co.uk>
> ---
>  Documentation/devicetree/bindings/usb/ci-hdrc-usb2.txt |  1 +
>  drivers/usb/chipidea/ci_hdrc_imx.c                     |  2 ++
>  drivers/usb/chipidea/ci_hdrc_imx.h                     |  1 +
>  drivers/usb/chipidea/usbmisc_imx.c                     | 13 +++++++++++++
>  4 files changed, 17 insertions(+)
> 
> diff --git a/Documentation/devicetree/bindings/usb/ci-hdrc-usb2.txt b/Documentation/devicetree/bindings/usb/ci-hdrc-usb2.txt
> index 0e03344..f83da66 100644
> --- a/Documentation/devicetree/bindings/usb/ci-hdrc-usb2.txt
> +++ b/Documentation/devicetree/bindings/usb/ci-hdrc-usb2.txt
> @@ -84,6 +84,7 @@ i.mx specific properties
>  - over-current-active-high: over current signal polarity is high active,
>    typically over current signal polarity is low active.
>  - external-vbus-divider: enables off-chip resistor divider for Vbus
> +- disable-int60ck: disable internal 60MHz clock for usb host2 or host3 on imx53

Why do we need a binding for this? I would assume the driver should know
whether this clock is in use or not. If it doesn't that's a problem we
should solve.

Sascha

-- 
Pengutronix e.K.                           |                             |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH v5 2/2] usb: chipidea: imx: Add binding to disable USB 60Mhz clock
  2016-09-26  8:18   ` Sascha Hauer
@ 2016-09-26  8:54     ` Fabien Lahoudere
  0 siblings, 0 replies; 9+ messages in thread
From: Fabien Lahoudere @ 2016-09-26  8:54 UTC (permalink / raw)
  To: Sascha Hauer
  Cc: Peter.Chen, gregkh, linux-usb, robh+dt, mark.rutland, devicetree,
	linux-kernel

Hi,

On 26/09/16 10:18, Sascha Hauer wrote:
> On Wed, Sep 21, 2016 at 11:07:07AM +0200, Fabien Lahoudere wrote:
>> This binding allow to disable the internal 60Mhz clock for USB host2 or
>> host3.
>>
>> Signed-off-by: Fabien Lahoudere <fabien.lahoudere@collabora.co.uk>
>> ---
>>  Documentation/devicetree/bindings/usb/ci-hdrc-usb2.txt |  1 +
>>  drivers/usb/chipidea/ci_hdrc_imx.c                     |  2 ++
>>  drivers/usb/chipidea/ci_hdrc_imx.h                     |  1 +
>>  drivers/usb/chipidea/usbmisc_imx.c                     | 13 +++++++++++++
>>  4 files changed, 17 insertions(+)
>>
>> diff --git a/Documentation/devicetree/bindings/usb/ci-hdrc-usb2.txt b/Documentation/devicetree/bindings/usb/ci-hdrc-usb2.txt
>> index 0e03344..f83da66 100644
>> --- a/Documentation/devicetree/bindings/usb/ci-hdrc-usb2.txt
>> +++ b/Documentation/devicetree/bindings/usb/ci-hdrc-usb2.txt
>> @@ -84,6 +84,7 @@ i.mx specific properties
>>  - over-current-active-high: over current signal polarity is high active,
>>    typically over current signal polarity is low active.
>>  - external-vbus-divider: enables off-chip resistor divider for Vbus
>> +- disable-int60ck: disable internal 60MHz clock for usb host2 or host3 on imx53
>
> Why do we need a binding for this? I would assume the driver should know
> whether this clock is in use or not. If it doesn't that's a problem we
> should solve.
>

Yes you are right because we can disable this clock for OTG and with 
ULPI PHY. I think that it will be better to have a dt binding but if it 
is useless I can remove it and disable clock when ULPI mode is enabled.

> Sascha
>

Fabien

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH v5 2/2] usb: chipidea: imx: Add binding to disable USB 60Mhz clock
  2016-09-23 19:47   ` Rob Herring
@ 2016-09-26  9:00       ` Fabien Lahoudere
  0 siblings, 0 replies; 9+ messages in thread
From: Fabien Lahoudere @ 2016-09-26  9:00 UTC (permalink / raw)
  To: Rob Herring
  Cc: Peter.Chen, gregkh, linux-usb, mark.rutland, devicetree, linux-kernel

Hi,

On 23/09/16 21:47, Rob Herring wrote:
> On Wed, Sep 21, 2016 at 11:07:07AM +0200, Fabien Lahoudere wrote:
>> This binding allow to disable the internal 60Mhz clock for USB host2 or
>> host3.
>>
>> Signed-off-by: Fabien Lahoudere <fabien.lahoudere@collabora.co.uk>
>> ---
>>  Documentation/devicetree/bindings/usb/ci-hdrc-usb2.txt |  1 +
>>  drivers/usb/chipidea/ci_hdrc_imx.c                     |  2 ++
>>  drivers/usb/chipidea/ci_hdrc_imx.h                     |  1 +
>>  drivers/usb/chipidea/usbmisc_imx.c                     | 13 +++++++++++++
>>  4 files changed, 17 insertions(+)
>>
>> diff --git a/Documentation/devicetree/bindings/usb/ci-hdrc-usb2.txt b/Documentation/devicetree/bindings/usb/ci-hdrc-usb2.txt
>> index 0e03344..f83da66 100644
>> --- a/Documentation/devicetree/bindings/usb/ci-hdrc-usb2.txt
>> +++ b/Documentation/devicetree/bindings/usb/ci-hdrc-usb2.txt
>> @@ -84,6 +84,7 @@ i.mx specific properties
>>  - over-current-active-high: over current signal polarity is high active,
>>    typically over current signal polarity is low active.
>>  - external-vbus-divider: enables off-chip resistor divider for Vbus
>> +- disable-int60ck: disable internal 60MHz clock for usb host2 or host3 on imx53
>
> Doesn't this depend on something else like the type of phy connected? If
> not, when can you do this or not?
>

We can disable it in OTG mode and with ULPI phy and Sascha Hauer think 
we can do it without dt binding for example based on PHY mode. So I will 
remove the binding and just disable clock if ULPI is selected.

> Rob
>

Fabien

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH v5 2/2] usb: chipidea: imx: Add binding to disable USB 60Mhz clock
@ 2016-09-26  9:00       ` Fabien Lahoudere
  0 siblings, 0 replies; 9+ messages in thread
From: Fabien Lahoudere @ 2016-09-26  9:00 UTC (permalink / raw)
  To: Rob Herring
  Cc: Peter.Chen-3arQi8VN3Tc, gregkh-hQyY1W1yCW8ekmWlsbkhG0B+6BGkLq7r,
	linux-usb-u79uwXL29TY76Z2rM5mHXA, mark.rutland-5wv7dgnIgG8,
	devicetree-u79uwXL29TY76Z2rM5mHXA,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA

Hi,

On 23/09/16 21:47, Rob Herring wrote:
> On Wed, Sep 21, 2016 at 11:07:07AM +0200, Fabien Lahoudere wrote:
>> This binding allow to disable the internal 60Mhz clock for USB host2 or
>> host3.
>>
>> Signed-off-by: Fabien Lahoudere <fabien.lahoudere-ZGY8ohtN/8pPYcu2f3hruQ@public.gmane.org>
>> ---
>>  Documentation/devicetree/bindings/usb/ci-hdrc-usb2.txt |  1 +
>>  drivers/usb/chipidea/ci_hdrc_imx.c                     |  2 ++
>>  drivers/usb/chipidea/ci_hdrc_imx.h                     |  1 +
>>  drivers/usb/chipidea/usbmisc_imx.c                     | 13 +++++++++++++
>>  4 files changed, 17 insertions(+)
>>
>> diff --git a/Documentation/devicetree/bindings/usb/ci-hdrc-usb2.txt b/Documentation/devicetree/bindings/usb/ci-hdrc-usb2.txt
>> index 0e03344..f83da66 100644
>> --- a/Documentation/devicetree/bindings/usb/ci-hdrc-usb2.txt
>> +++ b/Documentation/devicetree/bindings/usb/ci-hdrc-usb2.txt
>> @@ -84,6 +84,7 @@ i.mx specific properties
>>  - over-current-active-high: over current signal polarity is high active,
>>    typically over current signal polarity is low active.
>>  - external-vbus-divider: enables off-chip resistor divider for Vbus
>> +- disable-int60ck: disable internal 60MHz clock for usb host2 or host3 on imx53
>
> Doesn't this depend on something else like the type of phy connected? If
> not, when can you do this or not?
>

We can disable it in OTG mode and with ULPI phy and Sascha Hauer think 
we can do it without dt binding for example based on PHY mode. So I will 
remove the binding and just disable clock if ULPI is selected.

> Rob
>

Fabien
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2016-09-26  9:01 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-09-21  9:07 [PATCH v5 0/2] usb: chipidea: imx: Add USB configuration for imx53 Fabien Lahoudere
2016-09-21  9:07 ` [PATCH v5 1/2] usb: chipidea: imx: configure imx for ULPI phy Fabien Lahoudere
2016-09-21  9:07   ` Fabien Lahoudere
2016-09-21  9:07 ` [PATCH v5 2/2] usb: chipidea: imx: Add binding to disable USB 60Mhz clock Fabien Lahoudere
2016-09-23 19:47   ` Rob Herring
2016-09-26  9:00     ` Fabien Lahoudere
2016-09-26  9:00       ` Fabien Lahoudere
2016-09-26  8:18   ` Sascha Hauer
2016-09-26  8:54     ` Fabien Lahoudere

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.