Linux USB
 help / color / mirror / Atom feed
From: Michael Trimarchi <michael@amarulasolutions.com>
To: Peter Chen <Peter.Chen@nxp.com>
Cc: linux-usb@vger.kernel.org,
	Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	michael@amarulasolutions.com
Subject: [RFC,2/3] usb: chipidea: usbmisc: evdo can be set e/o reset
Date: Sat, 13 Jan 2018 16:41:47 +0100	[thread overview]
Message-ID: <1515858108-17067-2-git-send-email-michael@amarulasolutions.com> (raw)

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;
 }

             reply	other threads:[~2018-01-13 15:41 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-01-13 15:41 Michael Trimarchi [this message]
  -- strict thread matches above, loose matches on Subject: below --
2018-01-15  3:07 [RFC,2/3] usb: chipidea: usbmisc: evdo can be set e/o reset Peter Chen

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1515858108-17067-2-git-send-email-michael@amarulasolutions.com \
    --to=michael@amarulasolutions.com \
    --cc=Peter.Chen@nxp.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=linux-usb@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox