mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Arnd Bergmann <arnd@arndb.de>
To: Felipe Balbi <balbi@kernel.org>
Cc: Arnd Bergmann <arnd@arndb.de>, Andy Gross <andy.gross@linaro.org>,
	David Brown <david.brown@linaro.org>,
	Peter Chen <Peter.Chen@nxp.com>,
	Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	Alan Stern <stern@rowland.harvard.edu>,
	Mark Brown <broonie@kernel.org>,
	Bjorn Andersson <bjorn.andersson@linaro.org>,
	linux-kernel@vger.kernel.org, linux-arm-msm@vger.kernel.org,
	linux-soc@vger.kernel.org, linux-usb@vger.kernel.org
Subject: [RFC 2/8] usb: ehci-msm: call usb_phy_init instead of open-coding it
Date: Wed, 18 May 2016 23:24:07 +0200	[thread overview]
Message-ID: <1463606653-325131-3-git-send-email-arnd@arndb.de> (raw)
In-Reply-To: <1463606653-325131-1-git-send-email-arnd@arndb.de>

While looking at the phy-msm-usb driver, I noticed that its registers
are also accessed by teh ehci-msm driver, basically duplicating part
of the logic that is already present in the phy driver.

This removes the duplicate code from the ehci driver and instead
calls the usb_phy_init() function.

I did not test this change, so please review the patch carefully
and wait for a positive test result before applying.

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
---
 drivers/usb/host/ehci-msm.c | 17 ++---------------
 1 file changed, 2 insertions(+), 15 deletions(-)

diff --git a/drivers/usb/host/ehci-msm.c b/drivers/usb/host/ehci-msm.c
index d3afc89d00f5..4a9f31f77c46 100644
--- a/drivers/usb/host/ehci-msm.c
+++ b/drivers/usb/host/ehci-msm.c
@@ -30,15 +30,12 @@
 #include <linux/platform_device.h>
 #include <linux/pm_runtime.h>
 #include <linux/usb/otg.h>
-#include <linux/usb/msm_hsusb_hw.h>
 #include <linux/usb.h>
 #include <linux/usb/hcd.h>
 #include <linux/acpi.h>
 
 #include "ehci.h"
 
-#define MSM_USB_BASE (hcd->regs)
-
 #define DRIVER_DESC "Qualcomm On-Chip EHCI Host Controller"
 
 static const char hcd_name[] = "ehci-msm";
@@ -49,24 +46,13 @@ static int ehci_msm_reset(struct usb_hcd *hcd)
 	struct ehci_hcd *ehci = hcd_to_ehci(hcd);
 	int retval;
 
-	ehci->caps = USB_CAPLENGTH;
+	ehci->caps = hcd->regs + 0x100;
 	hcd->has_tt = 1;
 
 	retval = ehci_setup(hcd);
 	if (retval)
 		return retval;
 
-	/* select ULPI phy and clear other status/control bits in PORTSC */
-	writel(PORTSC_PTS_ULPI, USB_PORTSC);
-	/* bursts of unspecified length. */
-	writel(0, USB_AHBBURST);
-	/* Use the AHB transactor, allow posted data writes */
-	writel(0x8, USB_AHBMODE);
-	/* Disable streaming mode and select host mode */
-	writel(0x13, USB_USBMODE);
-	/* Disable ULPI_TX_PKT_EN_CLR_FIX which is valid only for HSIC */
-	writel(readl(USB_GENCONFIG_2) & ~ULPI_TX_PKT_EN_CLR_FIX, USB_GENCONFIG_2);
-
 	return 0;
 }
 
@@ -144,6 +130,7 @@ static int ehci_msm_probe(struct platform_device *pdev)
 		pm_runtime_no_callbacks(&pdev->dev);
 		pm_runtime_enable(&pdev->dev);
 	} else {
+		usb_phy_init(phy);
 		ret = usb_add_hcd(hcd, hcd->irq, IRQF_SHARED);
 		if (ret)
 			goto put_hcd;
-- 
2.7.0

  parent reply	other threads:[~2016-05-18 21:24 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-05-18 21:24 [RFC 0/8] usb: phy: msm: various cleanups Arnd Bergmann
2016-05-18 21:24 ` [RFC 1/8] usb: phy: move msm_hsusb.h into driver Arnd Bergmann
2016-05-18 21:24 ` Arnd Bergmann [this message]
2016-05-18 21:24 ` [RFC 3/8] usb: chipidea: msm: remove open-coded phy init Arnd Bergmann
2016-05-18 21:24 ` [RFC 4/8] usb: phy: move TCSR driver into new file Arnd Bergmann
2016-05-19 19:08   ` Andy Gross
2016-05-20 12:24     ` Arnd Bergmann
2016-05-20 12:44       ` Mark Brown
2016-05-20 14:15         ` Arnd Bergmann
2016-05-18 21:24 ` [RFC 5/8] usb: phy: msm: move register definitions into driver Arnd Bergmann
2016-05-18 21:24 ` [RFC 6/8] usb: phy: qcom: use bulk regulator interfaces Arnd Bergmann
2016-05-18 21:24 ` [RFC 7/8] usb: phy: msm: remove v1p8/v3p3 voltage setting Arnd Bergmann
2016-05-18 21:24 ` [RFC 8/8] usb: phy: msm: disable regulator for remove() Arnd Bergmann
     [not found] ` <CAL411-q+B0fuFj6XDR4R21qWknnNj1Z=K8MzSyg0dZyEivk5nw@mail.gmail.com>
2016-05-19 15:28   ` [RFC 0/8] usb: phy: msm: various cleanups Andy Gross
2016-06-21  8:14 ` Felipe Balbi

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=1463606653-325131-3-git-send-email-arnd@arndb.de \
    --to=arnd@arndb.de \
    --cc=Peter.Chen@nxp.com \
    --cc=andy.gross@linaro.org \
    --cc=balbi@kernel.org \
    --cc=bjorn.andersson@linaro.org \
    --cc=broonie@kernel.org \
    --cc=david.brown@linaro.org \
    --cc=gregkh@linuxfoundation.org \
    --cc=linux-arm-msm@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-soc@vger.kernel.org \
    --cc=linux-usb@vger.kernel.org \
    --cc=stern@rowland.harvard.edu \
    /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

all inboxes | Powered by JetHome®