devicetree.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2 1/3] doc: usb: usbmisc-imx: add imx7d compatible string
@ 2016-07-20  8:02 Li Jun
       [not found] ` <1469001762-15015-1-git-send-email-jun.li-3arQi8VN3Tc@public.gmane.org>
  0 siblings, 1 reply; 5+ messages in thread
From: Li Jun @ 2016-07-20  8:02 UTC (permalink / raw)
  To: peter.chen-3arQi8VN3Tc, robh+dt-DgEjT+Ai2ygdnm+yROfE0A,
	shawnguo-DgEjT+Ai2ygdnm+yROfE0A
  Cc: linux-usb-u79uwXL29TY76Z2rM5mHXA,
	devicetree-u79uwXL29TY76Z2rM5mHXA, Li Jun

Add compatible string for imx7d-usbmisc.

Acked-by: Rob Herring <robh-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>
Signed-off-by: Li Jun <jun.li-3arQi8VN3Tc@public.gmane.org>
---
 Documentation/devicetree/bindings/usb/usbmisc-imx.txt | 1 +
 1 file changed, 1 insertion(+)

diff --git a/Documentation/devicetree/bindings/usb/usbmisc-imx.txt b/Documentation/devicetree/bindings/usb/usbmisc-imx.txt
index 3539d4e..f1e27fa 100644
--- a/Documentation/devicetree/bindings/usb/usbmisc-imx.txt
+++ b/Documentation/devicetree/bindings/usb/usbmisc-imx.txt
@@ -6,6 +6,7 @@ Required properties:
 	"fsl,imx6q-usbmisc" for imx6q
 	"fsl,vf610-usbmisc" for Vybrid vf610
 	"fsl,imx6sx-usbmisc" for imx6sx
+	"fsl,imx7d-usbmisc" for imx7d
 - reg: Should contain registers location and length
 
 Examples:
-- 
1.9.1

--
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] 5+ messages in thread

* [PATCH v2 2/3] doc: usb: ci-hdrc-usb2: add property over-current-active-high
       [not found] ` <1469001762-15015-1-git-send-email-jun.li-3arQi8VN3Tc@public.gmane.org>
@ 2016-07-20  8:02   ` Li Jun
       [not found]     ` <1469001762-15015-2-git-send-email-jun.li-3arQi8VN3Tc@public.gmane.org>
  2016-07-20  8:02   ` [PATCH v2 3/3] usb: chipidea: imx: set over current polarity per dts setting Li Jun
  1 sibling, 1 reply; 5+ messages in thread
From: Li Jun @ 2016-07-20  8:02 UTC (permalink / raw)
  To: peter.chen-3arQi8VN3Tc, robh+dt-DgEjT+Ai2ygdnm+yROfE0A,
	shawnguo-DgEjT+Ai2ygdnm+yROfE0A
  Cc: linux-usb-u79uwXL29TY76Z2rM5mHXA,
	devicetree-u79uwXL29TY76Z2rM5mHXA, Li Jun

Adding over-current-active-high to indicate the over current flag
is high active as typically we use active low for over current
polarity.

Signed-off-by: Li Jun <jun.li-3arQi8VN3Tc@public.gmane.org>
---
 Documentation/devicetree/bindings/usb/ci-hdrc-usb2.txt | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/Documentation/devicetree/bindings/usb/ci-hdrc-usb2.txt b/Documentation/devicetree/bindings/usb/ci-hdrc-usb2.txt
index 341dc67..0e03344 100644
--- a/Documentation/devicetree/bindings/usb/ci-hdrc-usb2.txt
+++ b/Documentation/devicetree/bindings/usb/ci-hdrc-usb2.txt
@@ -81,6 +81,8 @@ i.mx specific properties
 - fsl,usbmisc: phandler of non-core register device, with one
   argument that indicate usb controller index
 - disable-over-current: disable over current detect
+- 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
 
 Example:
-- 
1.9.1

--
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] 5+ messages in thread

* [PATCH v2 3/3] usb: chipidea: imx: set over current polarity per dts setting
       [not found] ` <1469001762-15015-1-git-send-email-jun.li-3arQi8VN3Tc@public.gmane.org>
  2016-07-20  8:02   ` [PATCH v2 2/3] doc: usb: ci-hdrc-usb2: add property over-current-active-high Li Jun
@ 2016-07-20  8:02   ` Li Jun
       [not found]     ` <1469001762-15015-3-git-send-email-jun.li-3arQi8VN3Tc@public.gmane.org>
  1 sibling, 1 reply; 5+ messages in thread
From: Li Jun @ 2016-07-20  8:02 UTC (permalink / raw)
  To: peter.chen-3arQi8VN3Tc, robh+dt-DgEjT+Ai2ygdnm+yROfE0A,
	shawnguo-DgEjT+Ai2ygdnm+yROfE0A
  Cc: linux-usb-u79uwXL29TY76Z2rM5mHXA,
	devicetree-u79uwXL29TY76Z2rM5mHXA, Li Jun

imx usb over current polarity is low active by default, with
over-current-active-high property added, user can config it to be high
active. Meanwhile keep this setting unchanged for existing platforms
so new platform must set the right value for active low by its usbmisc
init function if over current is enabled.

Signed-off-by: Li Jun <jun.li-3arQi8VN3Tc@public.gmane.org>
---
 drivers/usb/chipidea/ci_hdrc_imx.c |  3 +++
 drivers/usb/chipidea/ci_hdrc_imx.h |  1 +
 drivers/usb/chipidea/usbmisc_imx.c | 22 +++++++++++++++++-----
 3 files changed, 21 insertions(+), 5 deletions(-)

diff --git a/drivers/usb/chipidea/ci_hdrc_imx.c b/drivers/usb/chipidea/ci_hdrc_imx.c
index dedc33e..0991794 100644
--- a/drivers/usb/chipidea/ci_hdrc_imx.c
+++ b/drivers/usb/chipidea/ci_hdrc_imx.c
@@ -140,6 +140,9 @@ static struct imx_usbmisc_data *usbmisc_get_init_data(struct device *dev)
 	if (of_find_property(np, "disable-over-current", NULL))
 		data->disable_oc = 1;
 
+	if (of_find_property(np, "over-current-active-high", NULL))
+		data->oc_polarity = 1;
+
 	if (of_find_property(np, "external-vbus-divider", NULL))
 		data->evdo = 1;
 
diff --git a/drivers/usb/chipidea/ci_hdrc_imx.h b/drivers/usb/chipidea/ci_hdrc_imx.h
index 635717e..409aa5ca8 100644
--- a/drivers/usb/chipidea/ci_hdrc_imx.h
+++ b/drivers/usb/chipidea/ci_hdrc_imx.h
@@ -17,6 +17,7 @@ struct imx_usbmisc_data {
 	int index;
 
 	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 */
 };
 
diff --git a/drivers/usb/chipidea/usbmisc_imx.c b/drivers/usb/chipidea/usbmisc_imx.c
index ab8b027..20d02a5 100644
--- a/drivers/usb/chipidea/usbmisc_imx.c
+++ b/drivers/usb/chipidea/usbmisc_imx.c
@@ -56,6 +56,7 @@
 
 #define MX6_BM_NON_BURST_SETTING	BIT(1)
 #define MX6_BM_OVER_CUR_DIS		BIT(7)
+#define MX6_BM_OVER_CUR_POLARITY	BIT(8)
 #define MX6_BM_WAKEUP_ENABLE		BIT(10)
 #define MX6_BM_ID_WAKEUP		BIT(16)
 #define MX6_BM_VBUS_WAKEUP		BIT(17)
@@ -266,11 +267,14 @@ static int usbmisc_imx6q_init(struct imx_usbmisc_data *data)
 
 	spin_lock_irqsave(&usbmisc->lock, flags);
 
+	reg = readl(usbmisc->base + data->index * 4);
 	if (data->disable_oc) {
-		reg = readl(usbmisc->base + data->index * 4);
-		writel(reg | MX6_BM_OVER_CUR_DIS,
-			usbmisc->base + data->index * 4);
+		reg |= MX6_BM_OVER_CUR_DIS;
+	} else if (data->oc_polarity == 1) {
+		/* High active */
+		reg &= ~(MX6_BM_OVER_CUR_DIS | MX6_BM_OVER_CUR_POLARITY);
 	}
+	writel(reg, usbmisc->base + data->index * 4);
 
 	/* SoC non-burst setting */
 	reg = readl(usbmisc->base + data->index * 4);
@@ -365,10 +369,14 @@ static int usbmisc_imx7d_init(struct imx_usbmisc_data *data)
 		return -EINVAL;
 
 	spin_lock_irqsave(&usbmisc->lock, flags);
+	reg = readl(usbmisc->base);
 	if (data->disable_oc) {
-		reg = readl(usbmisc->base);
-		writel(reg | MX6_BM_OVER_CUR_DIS, usbmisc->base);
+		reg |= MX6_BM_OVER_CUR_DIS;
+	} else if (data->oc_polarity == 1) {
+		/* High active */
+		reg &= ~(MX6_BM_OVER_CUR_DIS | MX6_BM_OVER_CUR_POLARITY);
 	}
+	writel(reg, usbmisc->base);
 
 	reg = readl(usbmisc->base + MX7D_USBNC_USB_CTRL2);
 	reg &= ~MX7D_USB_VBUS_WAKEUP_SOURCE_MASK;
@@ -492,6 +500,10 @@ static const struct of_device_id usbmisc_imx_dt_ids[] = {
 		.compatible = "fsl,imx6ul-usbmisc",
 		.data = &imx6sx_usbmisc_ops,
 	},
+	{
+		.compatible = "fsl,imx7d-usbmisc",
+		.data = &imx7d_usbmisc_ops,
+	},
 	{ /* sentinel */ }
 };
 MODULE_DEVICE_TABLE(of, usbmisc_imx_dt_ids);
-- 
1.9.1

--
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] 5+ messages in thread

* Re: [PATCH v2 2/3] doc: usb: ci-hdrc-usb2: add property over-current-active-high
       [not found]     ` <1469001762-15015-2-git-send-email-jun.li-3arQi8VN3Tc@public.gmane.org>
@ 2016-07-20 19:10       ` Rob Herring
  0 siblings, 0 replies; 5+ messages in thread
From: Rob Herring @ 2016-07-20 19:10 UTC (permalink / raw)
  To: Li Jun
  Cc: peter.chen-3arQi8VN3Tc, shawnguo-DgEjT+Ai2ygdnm+yROfE0A,
	linux-usb-u79uwXL29TY76Z2rM5mHXA,
	devicetree-u79uwXL29TY76Z2rM5mHXA

On Wed, Jul 20, 2016 at 04:02:41PM +0800, Li Jun wrote:
> Adding over-current-active-high to indicate the over current flag
> is high active as typically we use active low for over current
> polarity.
> 
> Signed-off-by: Li Jun <jun.li-3arQi8VN3Tc@public.gmane.org>
> ---
>  Documentation/devicetree/bindings/usb/ci-hdrc-usb2.txt | 2 ++
>  1 file changed, 2 insertions(+)

Acked-by: Rob Herring <robh-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>
--
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	[flat|nested] 5+ messages in thread

* Re: [PATCH v2 3/3] usb: chipidea: imx: set over current polarity per dts setting
       [not found]     ` <1469001762-15015-3-git-send-email-jun.li-3arQi8VN3Tc@public.gmane.org>
@ 2016-07-21  8:16       ` Peter Chen
  0 siblings, 0 replies; 5+ messages in thread
From: Peter Chen @ 2016-07-21  8:16 UTC (permalink / raw)
  To: Li Jun
  Cc: peter.chen-3arQi8VN3Tc, robh+dt-DgEjT+Ai2ygdnm+yROfE0A,
	shawnguo-DgEjT+Ai2ygdnm+yROfE0A, linux-usb-u79uwXL29TY76Z2rM5mHXA,
	devicetree-u79uwXL29TY76Z2rM5mHXA

On Wed, Jul 20, 2016 at 04:02:42PM +0800, Li Jun wrote:
> imx usb over current polarity is low active by default, with
> over-current-active-high property added, user can config it to be high
> active. Meanwhile keep this setting unchanged for existing platforms
> so new platform must set the right value for active low by its usbmisc
> init function if over current is enabled.
> 
> Signed-off-by: Li Jun <jun.li-3arQi8VN3Tc@public.gmane.org>
> ---
>  drivers/usb/chipidea/ci_hdrc_imx.c |  3 +++
>  drivers/usb/chipidea/ci_hdrc_imx.h |  1 +
>  drivers/usb/chipidea/usbmisc_imx.c | 22 +++++++++++++++++-----
>  3 files changed, 21 insertions(+), 5 deletions(-)
> 
> diff --git a/drivers/usb/chipidea/ci_hdrc_imx.c b/drivers/usb/chipidea/ci_hdrc_imx.c
> index dedc33e..0991794 100644
> --- a/drivers/usb/chipidea/ci_hdrc_imx.c
> +++ b/drivers/usb/chipidea/ci_hdrc_imx.c
> @@ -140,6 +140,9 @@ static struct imx_usbmisc_data *usbmisc_get_init_data(struct device *dev)
>  	if (of_find_property(np, "disable-over-current", NULL))
>  		data->disable_oc = 1;
>  
> +	if (of_find_property(np, "over-current-active-high", NULL))
> +		data->oc_polarity = 1;
> +
>  	if (of_find_property(np, "external-vbus-divider", NULL))
>  		data->evdo = 1;
>  
> diff --git a/drivers/usb/chipidea/ci_hdrc_imx.h b/drivers/usb/chipidea/ci_hdrc_imx.h
> index 635717e..409aa5ca8 100644
> --- a/drivers/usb/chipidea/ci_hdrc_imx.h
> +++ b/drivers/usb/chipidea/ci_hdrc_imx.h
> @@ -17,6 +17,7 @@ struct imx_usbmisc_data {
>  	int index;
>  
>  	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 */
>  };
>  
> diff --git a/drivers/usb/chipidea/usbmisc_imx.c b/drivers/usb/chipidea/usbmisc_imx.c
> index ab8b027..20d02a5 100644
> --- a/drivers/usb/chipidea/usbmisc_imx.c
> +++ b/drivers/usb/chipidea/usbmisc_imx.c
> @@ -56,6 +56,7 @@
>  
>  #define MX6_BM_NON_BURST_SETTING	BIT(1)
>  #define MX6_BM_OVER_CUR_DIS		BIT(7)
> +#define MX6_BM_OVER_CUR_POLARITY	BIT(8)
>  #define MX6_BM_WAKEUP_ENABLE		BIT(10)
>  #define MX6_BM_ID_WAKEUP		BIT(16)
>  #define MX6_BM_VBUS_WAKEUP		BIT(17)
> @@ -266,11 +267,14 @@ static int usbmisc_imx6q_init(struct imx_usbmisc_data *data)
>  
>  	spin_lock_irqsave(&usbmisc->lock, flags);
>  
> +	reg = readl(usbmisc->base + data->index * 4);
>  	if (data->disable_oc) {
> -		reg = readl(usbmisc->base + data->index * 4);
> -		writel(reg | MX6_BM_OVER_CUR_DIS,
> -			usbmisc->base + data->index * 4);
> +		reg |= MX6_BM_OVER_CUR_DIS;
> +	} else if (data->oc_polarity == 1) {
> +		/* High active */
> +		reg &= ~(MX6_BM_OVER_CUR_DIS | MX6_BM_OVER_CUR_POLARITY);
>  	}
> +	writel(reg, usbmisc->base + data->index * 4);
>  
>  	/* SoC non-burst setting */
>  	reg = readl(usbmisc->base + data->index * 4);
> @@ -365,10 +369,14 @@ static int usbmisc_imx7d_init(struct imx_usbmisc_data *data)
>  		return -EINVAL;
>  
>  	spin_lock_irqsave(&usbmisc->lock, flags);
> +	reg = readl(usbmisc->base);
>  	if (data->disable_oc) {
> -		reg = readl(usbmisc->base);
> -		writel(reg | MX6_BM_OVER_CUR_DIS, usbmisc->base);
> +		reg |= MX6_BM_OVER_CUR_DIS;
> +	} else if (data->oc_polarity == 1) {
> +		/* High active */
> +		reg &= ~(MX6_BM_OVER_CUR_DIS | MX6_BM_OVER_CUR_POLARITY);
>  	}
> +	writel(reg, usbmisc->base);
>  
>  	reg = readl(usbmisc->base + MX7D_USBNC_USB_CTRL2);
>  	reg &= ~MX7D_USB_VBUS_WAKEUP_SOURCE_MASK;
> @@ -492,6 +500,10 @@ static const struct of_device_id usbmisc_imx_dt_ids[] = {
>  		.compatible = "fsl,imx6ul-usbmisc",
>  		.data = &imx6sx_usbmisc_ops,
>  	},
> +	{
> +		.compatible = "fsl,imx7d-usbmisc",
> +		.data = &imx7d_usbmisc_ops,
> +	},
>  	{ /* sentinel */ }
>  };
>  MODULE_DEVICE_TABLE(of, usbmisc_imx_dt_ids);
> -- 

This one is ok, I will queue it

-- 

Best Regards,
Peter Chen
--
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	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2016-07-21  8:16 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-07-20  8:02 [PATCH v2 1/3] doc: usb: usbmisc-imx: add imx7d compatible string Li Jun
     [not found] ` <1469001762-15015-1-git-send-email-jun.li-3arQi8VN3Tc@public.gmane.org>
2016-07-20  8:02   ` [PATCH v2 2/3] doc: usb: ci-hdrc-usb2: add property over-current-active-high Li Jun
     [not found]     ` <1469001762-15015-2-git-send-email-jun.li-3arQi8VN3Tc@public.gmane.org>
2016-07-20 19:10       ` Rob Herring
2016-07-20  8:02   ` [PATCH v2 3/3] usb: chipidea: imx: set over current polarity per dts setting Li Jun
     [not found]     ` <1469001762-15015-3-git-send-email-jun.li-3arQi8VN3Tc@public.gmane.org>
2016-07-21  8:16       ` Peter Chen

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).