From patchwork Wed May 18 21:24:07 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arnd Bergmann X-Patchwork-Id: 102324 Delivered-To: patch@linaro.org Received: by 10.140.92.199 with SMTP id b65csp2858581qge; Wed, 18 May 2016 14:25:09 -0700 (PDT) X-Received: by 10.66.7.69 with SMTP id h5mr14076481paa.11.1463606709030; Wed, 18 May 2016 14:25:09 -0700 (PDT) Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id r4si14462644paa.218.2016.05.18.14.25.08; Wed, 18 May 2016 14:25:09 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754113AbcERVYp (ORCPT + 29 others); Wed, 18 May 2016 17:24:45 -0400 Received: from mout.kundenserver.de ([212.227.126.133]:53823 "EHLO mout.kundenserver.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752609AbcERVYg (ORCPT ); Wed, 18 May 2016 17:24:36 -0400 Received: from wuerfel.lan. ([78.42.132.4]) by mrelayeu.kundenserver.de (mreue004) with ESMTPA (Nemesis) id 0MPt6U-1azHL91MFW-004x3V; Wed, 18 May 2016 23:24:25 +0200 From: Arnd Bergmann To: Felipe Balbi Cc: Arnd Bergmann , Andy Gross , David Brown , Peter Chen , Greg Kroah-Hartman , Alan Stern , Mark Brown , Bjorn Andersson , 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 Message-Id: <1463606653-325131-3-git-send-email-arnd@arndb.de> X-Mailer: git-send-email 2.7.0 In-Reply-To: <1463606653-325131-1-git-send-email-arnd@arndb.de> References: <1463606653-325131-1-git-send-email-arnd@arndb.de> X-Provags-ID: V03:K0:kkT5CElXYq+0+fd/fMoVS8P3XPyKTWNKeC19w4iUuv66ofbyK93 GIDMrLkp2PF15j+5TBoLYffd/f0xYA10OCMqHQEuUX2o0jkDEioO/+ZKbf86ayc9165PoKz kQHHGmNNXD1gheyPHP3tgcoTL4+ciPpXIMs/BhGwPzJiL2BXHTZPP2Ce4Vrza/ZzeCviyUG Rh5C+mRmKG79HUSy3++aw== X-UI-Out-Filterresults: notjunk:1; V01:K0:ajpHu5d6QR4=:xClLKIKfN951TjAvtR9rNV N8WXTodS03utrDkqhl+xVLbO2icTsue6iUqRo1yuHiiWOTMjRd/9eD13M6+wKy2gUb7NB6INP MPFzI0sp3brCq/UwxhOBFvXB7t2VmBBohCnCf519Scy3mLjtb/EipnZafnGywntDxRQv178sn lg1YD02aCOnty662k+iGumPPMQEdsQE/YlfR1zdv3jYLREL8wuK2OwuLsQVEs/PVmMJorPF2w 1udoCZCZDlL+uS/fPP+7dwhOGytI22AkJ5rvFxefMQPyhO9iLIvHGDF+Bc8k3tswp3tMHLuN6 aKK40ClsAJTk3WyZkyw5F34RegilukO5u7laN9vdOQyE7rd7kgs3nWDREWl07YuJgwMhL0b/2 pzfImtmVNTSGWO1XNHuj61/yH6T5X+qM8zmR6a6UFPaWRT3cQq3mCZ7GqBr8Xy6j1A6rJbp1o G/1N0itUT29BBtcJOD0Dw6WNacvsqLM4QgHUNAS5Y8MgVwbiq/rhUGzt+L+4MFVnRvGbwh75J 4rxxHk43JqsOiPft6JDl0kah65p/rxDYN57HaPXV3TlHtI74SKq917oxbjpR9DRUnP90/M3XW LxPbPZa2K1BQUHixmHQD48X/f9VPhh1KB/UVpaLSr4AmTnOFLWLJwyt1e2Y0hKCXIs8/CYuT6 FYRAjOgJ2PmdvZBXpHFAw3yOfSMD8WDpCeVeKd1xDVUWfyWggcD2alo5ky9R6AWFp5Vk= Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 --- drivers/usb/host/ehci-msm.c | 17 ++--------------- 1 file changed, 2 insertions(+), 15 deletions(-) -- 2.7.0 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 #include #include -#include #include #include #include #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;