From patchwork Mon Feb 18 06:10:35 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chao Xie X-Patchwork-Id: 2155751 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork1.kernel.org Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) by patchwork1.kernel.org (Postfix) with ESMTP id 0FA293FCFC for ; Mon, 18 Feb 2013 06:27:11 +0000 (UTC) Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.76 #1 (Red Hat Linux)) id 1U7K9K-00055o-Km; Mon, 18 Feb 2013 06:24:26 +0000 Received: from na3sys009aog129.obsmtp.com ([74.125.149.142]) by merlin.infradead.org with smtps (Exim 4.76 #1 (Red Hat Linux)) id 1U7K5c-0002N2-6e for linux-arm-kernel@lists.infradead.org; Mon, 18 Feb 2013 06:20:41 +0000 Received: from MSI-MTA.marvell.com ([65.219.4.132]) (using TLSv1) by na3sys009aob129.postini.com ([74.125.148.12]) with SMTP ID DSNKUSHIMD73F4lOtp3CX6m1V0r41rk6TiFc@postini.com; Sun, 17 Feb 2013 22:20:36 PST Received: from maili.marvell.com ([10.68.76.210]) by MSI-MTA.marvell.com with Microsoft SMTPSVC(6.0.3790.4675); Sun, 17 Feb 2013 22:10:52 -0800 Received: from localhost (unknown [10.38.36.239]) by maili.marvell.com (Postfix) with ESMTP id 446B64E513; Sun, 17 Feb 2013 22:10:52 -0800 (PST) From: Chao Xie To: linux-usb@vger.kernel.org, linux-arm-kernel@lists.infradead.org, haojian.zhuang@gmail.com, stern@rowland.harvard.edu, balbi@ti.com, gregkh@linuxfoundation.org, kishon@ti.com, xiechao.mail@gmail.com Subject: [V7 PATCH 13/16] usb: ehci: ehci-mv: add extern chip support Date: Mon, 18 Feb 2013 01:10:35 -0500 Message-Id: <1361167838-22929-14-git-send-email-chao.xie@marvell.com> X-Mailer: git-send-email 1.7.4.1 In-Reply-To: <1361167838-22929-1-git-send-email-chao.xie@marvell.com> References: <1361167838-22929-1-git-send-email-chao.xie@marvell.com> X-OriginalArrivalTime: 18 Feb 2013 06:10:52.0546 (UTC) FILETIME=[B48D0E20:01CE0D9E] X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20130218_012036_451668_33F929E9 X-CRM114-Status: GOOD ( 11.11 ) X-Spam-Score: -4.2 (----) X-Spam-Report: SpamAssassin version 3.3.2 on merlin.infradead.org summary: Content analysis details: (-4.2 points) pts rule name description ---- ---------------------- -------------------------------------------------- -2.3 RCVD_IN_DNSWL_MED RBL: Sender listed at http://www.dnswl.org/, medium trust [74.125.149.142 listed in list.dnswl.org] -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] Cc: Chao Xie X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: linux-arm-kernel-bounces@lists.infradead.org Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org It does the similar things as what we do for udc driver. Signed-off-by: Chao Xie Acked-by: Alan Stern --- drivers/usb/host/ehci-mv.c | 16 ++++++++++------ 1 files changed, 10 insertions(+), 6 deletions(-) diff --git a/drivers/usb/host/ehci-mv.c b/drivers/usb/host/ehci-mv.c index 1d5fd0b..365a35a 100644 --- a/drivers/usb/host/ehci-mv.c +++ b/drivers/usb/host/ehci-mv.c @@ -138,6 +138,7 @@ static int mv_ehci_probe(struct platform_device *pdev) struct ehci_hcd *ehci; struct ehci_hcd_mv *ehci_mv; struct resource *r; + struct mv_usb2_phy *mv_phy; int clk_i, retval = -ENODEV; u32 offset; size_t size; @@ -199,6 +200,7 @@ static int mv_ehci_probe(struct platform_device *pdev) retval = -ENODEV; goto err_clear_drvdata; } + mv_phy = container_of(ehci_mv->phy, struct mv_usb2_phy, phy); retval = mv_ehci_enable(ehci_mv); if (retval) { @@ -251,8 +253,8 @@ static int mv_ehci_probe(struct platform_device *pdev) goto err_disable_clk; #endif } else { - if (pdata->set_vbus) - pdata->set_vbus(1); + if (mv_usb2_has_extern_call(mv_phy, vbus, set_vbus)) + mv_usb2_extern_call(mv_phy, vbus, set_vbus, 1); retval = usb_add_hcd(hcd, hcd->irq, IRQF_SHARED); if (retval) { @@ -270,8 +272,8 @@ static int mv_ehci_probe(struct platform_device *pdev) return 0; err_set_vbus: - if (pdata->set_vbus) - pdata->set_vbus(0); + if (mv_usb2_has_extern_call(mv_phy, vbus, set_vbus)) + mv_usb2_extern_call(mv_phy, vbus, set_vbus, 0); err_disable_clk: mv_ehci_disable(ehci_mv); err_clear_drvdata: @@ -286,6 +288,7 @@ static int mv_ehci_remove(struct platform_device *pdev) { struct ehci_hcd_mv *ehci_mv = platform_get_drvdata(pdev); struct usb_hcd *hcd = ehci_mv->hcd; + struct mv_usb2_phy *mv_phy; if (hcd->rh_registered) usb_remove_hcd(hcd); @@ -293,9 +296,10 @@ static int mv_ehci_remove(struct platform_device *pdev) if (!IS_ERR_OR_NULL(ehci_mv->otg)) otg_set_host(ehci_mv->otg->otg, NULL); + mv_phy = container_of(ehci_mv->phy, struct mv_usb2_phy, phy); if (ehci_mv->mode == MV_USB_MODE_HOST) { - if (ehci_mv->pdata->set_vbus) - ehci_mv->pdata->set_vbus(0); + if (mv_usb2_has_extern_call(mv_phy, vbus, set_vbus)) + mv_usb2_extern_call(mv_phy, vbus, set_vbus, 1); mv_ehci_disable(ehci_mv); }