Linux USB
 help / color / mirror / Atom feed
* [RFC,2/3] usb: chipidea: usbmisc: evdo can be set e/o reset
@ 2018-01-13 15:41 Michael Trimarchi
  0 siblings, 0 replies; 2+ messages in thread
From: Michael Trimarchi @ 2018-01-13 15:41 UTC (permalink / raw)
  To: Peter Chen; +Cc: linux-usb, Greg Kroah-Hartman, michael

evdo bit can be set or reset. We can not trust evdo bit
status after bootloader stage

Signed-off-by: Michael Trimarchi <michael@amarulasolutions.com>
---
 drivers/usb/chipidea/usbmisc_imx.c | 20 ++++++++++++--------
 1 file changed, 12 insertions(+), 8 deletions(-)

diff --git a/drivers/usb/chipidea/usbmisc_imx.c b/drivers/usb/chipidea/usbmisc_imx.c
index a52f5a8..1f47ef6 100644
--- a/drivers/usb/chipidea/usbmisc_imx.c
+++ b/drivers/usb/chipidea/usbmisc_imx.c
@@ -151,14 +151,18 @@ static int usbmisc_imx25_post(struct imx_usbmisc_data *data)
 	if (data->index)
 		return 0;
 
-	if (data->evdo) {
-		spin_lock_irqsave(&usbmisc->lock, flags);
-		reg = usbmisc->base + MX25_USB_PHY_CTRL_OFFSET;
-		val = readl(reg);
-		writel(val | MX25_BM_EXTERNAL_VBUS_DIVIDER, reg);
-		spin_unlock_irqrestore(&usbmisc->lock, flags);
-		usleep_range(5000, 10000); /* needed to stabilize voltage */
-	}
+	spin_lock_irqsave(&usbmisc->lock, flags);
+	reg = usbmisc->base + MX25_USB_PHY_CTRL_OFFSET;
+	val = readl(reg);
+
+	if (data->evdo)
+		val |= MX25_BM_EXTERNAL_VBUS_DIVIDER;
+	else
+		val &= ~MX25_BM_EXTERNAL_VBUS_DIVIDER;
+
+	writel(val, reg);
+	spin_unlock_irqrestore(&usbmisc->lock, flags);
+	usleep_range(5000, 10000); /* needed to stabilize voltage */
 
 	return 0;
 }

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

* [RFC,2/3] usb: chipidea: usbmisc: evdo can be set e/o reset
@ 2018-01-15  3:07 Peter Chen
  0 siblings, 0 replies; 2+ messages in thread
From: Peter Chen @ 2018-01-15  3:07 UTC (permalink / raw)
  To: Michael Trimarchi; +Cc: Peter Chen, linux-usb, Greg Kroah-Hartman

On Sat, Jan 13, 2018 at 04:41:47PM +0100, Michael Trimarchi wrote:
> evdo bit can be set or reset. We can not trust evdo bit
> status after bootloader stage
> 
> Signed-off-by: Michael Trimarchi <michael@amarulasolutions.com>
> ---
>  drivers/usb/chipidea/usbmisc_imx.c | 20 ++++++++++++--------
>  1 file changed, 12 insertions(+), 8 deletions(-)
> 
> diff --git a/drivers/usb/chipidea/usbmisc_imx.c b/drivers/usb/chipidea/usbmisc_imx.c
> index a52f5a8..1f47ef6 100644
> --- a/drivers/usb/chipidea/usbmisc_imx.c
> +++ b/drivers/usb/chipidea/usbmisc_imx.c
> @@ -151,14 +151,18 @@ static int usbmisc_imx25_post(struct imx_usbmisc_data *data)
>  	if (data->index)
>  		return 0;
>  
> -	if (data->evdo) {
> -		spin_lock_irqsave(&usbmisc->lock, flags);
> -		reg = usbmisc->base + MX25_USB_PHY_CTRL_OFFSET;
> -		val = readl(reg);
> -		writel(val | MX25_BM_EXTERNAL_VBUS_DIVIDER, reg);
> -		spin_unlock_irqrestore(&usbmisc->lock, flags);
> -		usleep_range(5000, 10000); /* needed to stabilize voltage */
> -	}
> +	spin_lock_irqsave(&usbmisc->lock, flags);
> +	reg = usbmisc->base + MX25_USB_PHY_CTRL_OFFSET;
> +	val = readl(reg);
> +
> +	if (data->evdo)
> +		val |= MX25_BM_EXTERNAL_VBUS_DIVIDER;
> +	else
> +		val &= ~MX25_BM_EXTERNAL_VBUS_DIVIDER;
> +
> +	writel(val, reg);
> +	spin_unlock_irqrestore(&usbmisc->lock, flags);
> +	usleep_range(5000, 10000); /* needed to stabilize voltage */

Acked-by: Peter Chen <peter.chen@nxp.com>

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

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

end of thread, other threads:[~2018-01-15  3:07 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-01-15  3:07 [RFC,2/3] usb: chipidea: usbmisc: evdo can be set e/o reset Peter Chen
  -- strict thread matches above, loose matches on Subject: below --
2018-01-13 15:41 Michael Trimarchi

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