mail archive of the barebox mailing list
 help / color / mirror / Atom feed
* [PATCH 1/2] usb: imx: add support for setting power pin polarity on i.MX6/7
@ 2020-11-23 15:29 Lucas Stach
  2020-11-23 15:29 ` [PATCH 2/2] usb: imx: get power pin polarity from DT Lucas Stach
  2020-11-24  8:36 ` [PATCH 1/2] usb: imx: add support for setting power pin polarity on i.MX6/7 Sascha Hauer
  0 siblings, 2 replies; 3+ messages in thread
From: Lucas Stach @ 2020-11-23 15:29 UTC (permalink / raw)
  To: barebox

Signed-off-by: Lucas Stach <l.stach@pengutronix.de>
---
 drivers/usb/imx/imx-usb-misc.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/drivers/usb/imx/imx-usb-misc.c b/drivers/usb/imx/imx-usb-misc.c
index 3a5ec236e532..b663d073aa88 100644
--- a/drivers/usb/imx/imx-usb-misc.c
+++ b/drivers/usb/imx/imx-usb-misc.c
@@ -354,6 +354,7 @@ static __maybe_unused struct imx_usb_misc_data mx5_data = {
 #define MX6_USB_CTRL(n)			((n) * 4)
 #define MX6_USB_CTRL_OVER_CUR_DIS	(1 << 7)
 #define MX6_USB_CTRL_OVER_CUR_ACT_HIGH	(1 << 8)
+#define MX6_USB_CTRL_PWR_POLARITY	(1 << 9)
 
 static void mx6_hsic_pullup(unsigned long reg, int on)
 {
@@ -380,6 +381,8 @@ static __maybe_unused int mx6_initialize_usb_hw(void __iomem *base, int port,
 		val = readl(base + MX6_USB_CTRL(port));
 		if (flags & MXC_EHCI_DISABLE_OVERCURRENT)
 			val |= MX6_USB_CTRL_OVER_CUR_DIS;
+		if (flags & MXC_EHCI_PWR_PIN_ACTIVE_HIGH)
+			val |= MX6_USB_CTRL_PWR_POLARITY;
 		writel(val, base + MX6_USB_CTRL(port));
 		break;
 	case 2: /* HSIC port */
@@ -454,6 +457,8 @@ static int usbmisc_imx7d_init(void __iomem *base, int port,
 		else
 			reg |= MX6_USB_CTRL_OVER_CUR_ACT_HIGH;
 	}
+	if (flags & MXC_EHCI_PWR_PIN_ACTIVE_HIGH)
+		reg |= MX6_USB_CTRL_PWR_POLARITY;
 	writel(reg, base);
 
 	reg = readl(base + MX7D_USBNC_USB_CTRL2);
-- 
2.20.1


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

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

* [PATCH 2/2] usb: imx: get power pin polarity from DT
  2020-11-23 15:29 [PATCH 1/2] usb: imx: add support for setting power pin polarity on i.MX6/7 Lucas Stach
@ 2020-11-23 15:29 ` Lucas Stach
  2020-11-24  8:36 ` [PATCH 1/2] usb: imx: add support for setting power pin polarity on i.MX6/7 Sascha Hauer
  1 sibling, 0 replies; 3+ messages in thread
From: Lucas Stach @ 2020-11-23 15:29 UTC (permalink / raw)
  To: barebox

There is a documented DT property to set the power pin polarity,
parse it.

Signed-off-by: Lucas Stach <l.stach@pengutronix.de>
---
 drivers/usb/imx/chipidea-imx.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/drivers/usb/imx/chipidea-imx.c b/drivers/usb/imx/chipidea-imx.c
index b1a77a163798..b144f41437a9 100644
--- a/drivers/usb/imx/chipidea-imx.c
+++ b/drivers/usb/imx/chipidea-imx.c
@@ -168,6 +168,9 @@ static int imx_chipidea_probe_dt(struct imx_chipidea *ci)
 				   "over-current-active-high", NULL))
 		ci->flags |= MXC_EHCI_OC_PIN_ACTIVE_LOW;
 
+	if (of_find_property(ci->dev->device_node, "power-active-high", NULL))
+		ci->flags |= MXC_EHCI_PWR_PIN_ACTIVE_HIGH;
+
 	if (of_usb_get_maximum_speed(ci->dev->device_node, NULL) ==
 			USB_SPEED_FULL)
 		ci->flags |= MXC_EHCI_PFSC;
-- 
2.20.1


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

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

* Re: [PATCH 1/2] usb: imx: add support for setting power pin polarity on i.MX6/7
  2020-11-23 15:29 [PATCH 1/2] usb: imx: add support for setting power pin polarity on i.MX6/7 Lucas Stach
  2020-11-23 15:29 ` [PATCH 2/2] usb: imx: get power pin polarity from DT Lucas Stach
@ 2020-11-24  8:36 ` Sascha Hauer
  1 sibling, 0 replies; 3+ messages in thread
From: Sascha Hauer @ 2020-11-24  8:36 UTC (permalink / raw)
  To: Lucas Stach; +Cc: barebox

On Mon, Nov 23, 2020 at 04:29:30PM +0100, Lucas Stach wrote:
> Signed-off-by: Lucas Stach <l.stach@pengutronix.de>
> ---
>  drivers/usb/imx/imx-usb-misc.c | 5 +++++
>  1 file changed, 5 insertions(+)

Applied, thanks

Sascha

> 
> diff --git a/drivers/usb/imx/imx-usb-misc.c b/drivers/usb/imx/imx-usb-misc.c
> index 3a5ec236e532..b663d073aa88 100644
> --- a/drivers/usb/imx/imx-usb-misc.c
> +++ b/drivers/usb/imx/imx-usb-misc.c
> @@ -354,6 +354,7 @@ static __maybe_unused struct imx_usb_misc_data mx5_data = {
>  #define MX6_USB_CTRL(n)			((n) * 4)
>  #define MX6_USB_CTRL_OVER_CUR_DIS	(1 << 7)
>  #define MX6_USB_CTRL_OVER_CUR_ACT_HIGH	(1 << 8)
> +#define MX6_USB_CTRL_PWR_POLARITY	(1 << 9)
>  
>  static void mx6_hsic_pullup(unsigned long reg, int on)
>  {
> @@ -380,6 +381,8 @@ static __maybe_unused int mx6_initialize_usb_hw(void __iomem *base, int port,
>  		val = readl(base + MX6_USB_CTRL(port));
>  		if (flags & MXC_EHCI_DISABLE_OVERCURRENT)
>  			val |= MX6_USB_CTRL_OVER_CUR_DIS;
> +		if (flags & MXC_EHCI_PWR_PIN_ACTIVE_HIGH)
> +			val |= MX6_USB_CTRL_PWR_POLARITY;
>  		writel(val, base + MX6_USB_CTRL(port));
>  		break;
>  	case 2: /* HSIC port */
> @@ -454,6 +457,8 @@ static int usbmisc_imx7d_init(void __iomem *base, int port,
>  		else
>  			reg |= MX6_USB_CTRL_OVER_CUR_ACT_HIGH;
>  	}
> +	if (flags & MXC_EHCI_PWR_PIN_ACTIVE_HIGH)
> +		reg |= MX6_USB_CTRL_PWR_POLARITY;
>  	writel(reg, base);
>  
>  	reg = readl(base + MX7D_USBNC_USB_CTRL2);
> -- 
> 2.20.1
> 
> 
> _______________________________________________
> barebox mailing list
> barebox@lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/barebox
> 

-- 
Pengutronix e.K.                           |                             |
Steuerwalder Str. 21                       | http://www.pengutronix.de/  |
31137 Hildesheim, Germany                  | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |

_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

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

end of thread, other threads:[~2020-11-24  8:37 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-11-23 15:29 [PATCH 1/2] usb: imx: add support for setting power pin polarity on i.MX6/7 Lucas Stach
2020-11-23 15:29 ` [PATCH 2/2] usb: imx: get power pin polarity from DT Lucas Stach
2020-11-24  8:36 ` [PATCH 1/2] usb: imx: add support for setting power pin polarity on i.MX6/7 Sascha Hauer

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox