From patchwork Thu Feb 21 04:07:23 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chao Xie X-Patchwork-Id: 2170431 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork2.kernel.org Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) by patchwork2.kernel.org (Postfix) with ESMTP id BCE67DF215 for ; Thu, 21 Feb 2013 04:14:44 +0000 (UTC) Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.76 #1 (Red Hat Linux)) id 1U8NWA-0003o4-7K; Thu, 21 Feb 2013 04:12:22 +0000 Received: from na3sys009aog109.obsmtp.com ([74.125.149.201]) by merlin.infradead.org with smtps (Exim 4.76 #1 (Red Hat Linux)) id 1U8NS3-0001F6-37 for linux-arm-kernel@lists.infradead.org; Thu, 21 Feb 2013 04:08:13 +0000 Received: from MSI-MTA.marvell.com ([65.219.4.132]) (using TLSv1) by na3sys009aob109.postini.com ([74.125.148.12]) with SMTP ID DSNKUSWdoP7YkLxTt6pd3LdZ+FeiNvrGqyEC@postini.com; Wed, 20 Feb 2013 20:08:07 PST Received: from maili.marvell.com ([10.68.76.210]) by MSI-MTA.marvell.com with Microsoft SMTPSVC(6.0.3790.4675); Wed, 20 Feb 2013 20:07:39 -0800 Received: from localhost (unknown [10.38.36.239]) by maili.marvell.com (Postfix) with ESMTP id 0CDF74E513; Wed, 20 Feb 2013 20:07:39 -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: [V8 PATCH 13/16] usb: ehci: ehci-mv: add extern chip support Date: Wed, 20 Feb 2013 23:07:23 -0500 Message-Id: <1361419646-9052-14-git-send-email-chao.xie@marvell.com> X-Mailer: git-send-email 1.7.4.1 In-Reply-To: <1361419646-9052-1-git-send-email-chao.xie@marvell.com> References: <1361419646-9052-1-git-send-email-chao.xie@marvell.com> X-OriginalArrivalTime: 21 Feb 2013 04:07:39.0338 (UTC) FILETIME=[FD184AA0:01CE0FE8] X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20130220_230807_364213_BA37BC13 X-CRM114-Status: GOOD ( 11.69 ) 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.201 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 3e89bd4..ae5d8dc 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 = PTR_ERR(ehci_mv->phy); 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); }