From patchwork Fri Jan 18 09:00:23 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: p.paneri@samsung.com X-Patchwork-Id: 2000311 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 66239DF280 for ; Fri, 18 Jan 2013 08:49:42 +0000 (UTC) Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.76 #1 (Red Hat Linux)) id 1Tw7bO-0000lT-Ad; Fri, 18 Jan 2013 08:47:06 +0000 Received: from mailout1.samsung.com ([203.254.224.24]) by merlin.infradead.org with esmtp (Exim 4.76 #1 (Red Hat Linux)) id 1Tw7ao-0000fU-MV for linux-arm-kernel@lists.infradead.org; Fri, 18 Jan 2013 08:46:33 +0000 Received: from epcpsbgm2.samsung.com (epcpsbgm2 [203.254.230.27]) by mailout1.samsung.com (Oracle Communications Messaging Server 7u4-24.01(7.0.4.24.0) 64bit (built Nov 17 2011)) with ESMTP id <0MGT007MRCCYWQT0@mailout1.samsung.com> for linux-arm-kernel@lists.infradead.org; Fri, 18 Jan 2013 17:46:26 +0900 (KST) Received: from epcpsbgm2.samsung.com ( [172.20.52.123]) by epcpsbgm2.samsung.com (EPCPMTA) with SMTP id BA.73.12699.2EB09F05; Fri, 18 Jan 2013 17:46:26 +0900 (KST) X-AuditID: cbfee61b-b7f616d00000319b-cd-50f90be216c5 Received: from epmmp1.local.host ( [203.254.227.16]) by epcpsbgm2.samsung.com (EPCPMTA) with SMTP id 99.73.12699.2EB09F05; Fri, 18 Jan 2013 17:46:26 +0900 (KST) Received: from matrix.sisodomain.com ([107.108.73.199]) by mmp1.samsung.com (Oracle Communications Messaging Server 7u4-24.01 (7.0.4.24.0) 64bit (built Nov 17 2011)) with ESMTPA id <0MGT00F57CD22110@mmp1.samsung.com> for linux-arm-kernel@lists.infradead.org; Fri, 18 Jan 2013 17:46:26 +0900 (KST) From: Praveen Paneri To: linux-usb@vger.kernel.org Subject: [RESEND PATCH v9 2/2] usb: s3c-hsotg: Adding phy driver support Date: Fri, 18 Jan 2013 14:30:23 +0530 Message-id: <1358499623-13901-3-git-send-email-p.paneri@samsung.com> X-Mailer: git-send-email 1.7.1 In-reply-to: <1358499623-13901-1-git-send-email-p.paneri@samsung.com> References: <1358499623-13901-1-git-send-email-p.paneri@samsung.com> DLP-Filter: Pass X-MTR: 20000000000000000@CPGS X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFrrJLMWRmVeSWpSXmKPExsWyRsSkWvcR988Ag46bKhabHl9jdWD02Lyk PoAxissmJTUnsyy1SN8ugSvjxbbjLAVvpSq+fulmamB8JdrFyMEhIWAiceKrXxcjJ5ApJnHh 3nq2LkYuDiGBpYwSz/9dZYFImEg82nCcDcQWEljEKHHllTBE0QYmiSdPprCDDGIT0JZomGkE UiMiICtx+MpvZhCbWWAus0TvDUEQW1jAQ+L71FNgM1kEVCUOn3jBCmLzCrhITO5czQSxS05i x+onYDangKvE5BdfGSH2uki8232THaJXQOLb5EMsEPfLSmw6wAxyjoTAZTaJVfcOM0LMkZQ4 uOIGywRG4QWMDKsYRVMLkguKk9JzjfSKE3OLS/PS9ZLzczcxAsPv9L9n0jsYVzVYHGIU4GBU 4uHdqPIjQIg1say4MvcQowQHs5IIb+tBoBBvSmJlVWpRfnxRaU5q8SFGH6BLJjJLiSbnA2Mj ryTe0NjE3NTY1NLIyMzUFIewkjgv46knAUIC6YklqdmpqQWpRTDjmDg4pRoYDXb1ya41l/0S G7XpUPC7aoVnr3NVttayfRGKv1V7JbJb3TnS5Np53RUNXo/91VY2VXxnCp0u65y7aVLmjQiN oqiDPal/5z1ReaZSlnr3UDtX/8otCXtEtQV3nGybMStk8xae56aCdzwYLxx+c3Ya49MXEwqO 3HygdC17f2X5p9/eUk3n//f9U2Ipzkg01GIuKk4EAN8qnkxsAgAA X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFupkkeLIzCtJLcpLzFFi42I5/e+xgO4j7p8BBn9ny1hsenyN1YHRY/OS +gDGqAZGm4zUxJTUIoXUvOT8lMy8dFsl7+B453hTMwNDXUNLC3MlhbzE3FRbJRefAF23zByg qUoKZYk5pUChgMTiYiV9O0wTQkPcdC1gGiN0fUOC4HqMDNBAwhrGjBfbjrMUvJWq+Pqlm6mB 8ZVoFyMnh4SAicSjDcfZIGwxiQv31oPZQgKLGCWuvBLuYuQCsjcwSTx5MoW9i5GDg01AW6Jh phFIjYiArMThK7+ZQWxmgbnMEr03BEFsYQEPie9TT7GA2CwCqhKHT7xgBbF5BVwkJneuZoLY JSexY/UTMJtTwFVi8ouvjBB7XSTe7b7JPoGRdwEjwypG0dSC5ILipPRcI73ixNzi0rx0veT8 3E2M4PB+Jr2DcVWDxSFGAQ5GJR7ejSo/AoRYE8uKK3MPMUpwMCuJ8LYeBArxpiRWVqUW5ccX leakFh9i9AG6aiKzlGhyPjD28kriDY1NzE2NTS1NLEzMLHEIK4nzMp56EiAkkJ5YkpqdmlqQ WgQzjomDU6qBMa9R+0fqPt/W82JWt4L+rq3MfML5j3UWb5lTTOwkhmduNysNndYstox04nY9 KiCfbex+sEv2lGcHI8uBHKeGZK1r87bEZZmfOiYRU9b3ncfo3eIPOx6/Mvl4WPiM4+OG/f/y jXnbqlZ+WMX4zX7yifz9TY+nqTvlpMhFT1B58JtDwKYhMaxTiaU4I9FQi7moOBEAvrmwrpwC AAA= X-CFilter-Loop: Reflected X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20130118_034631_016743_1327560A X-CRM114-Status: GOOD ( 13.80 ) X-Spam-Score: -7.6 (-------) X-Spam-Report: SpamAssassin version 3.3.2 on merlin.infradead.org summary: Content analysis details: (-7.6 points) pts rule name description ---- ---------------------- -------------------------------------------------- -5.0 RCVD_IN_DNSWL_HI RBL: Sender listed at http://www.dnswl.org/, high trust [203.254.224.24 listed in list.dnswl.org] -0.0 SPF_HELO_PASS SPF: HELO matches SPF record -0.7 RP_MATCHES_RCVD Envelope sender domain matches handover relay domain -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] Cc: l.majewski@samsung.com, kgene.kim@samsung.com, heiko@sntech.de, gregkh@linuxfoundation.org, devicetree-discuss@lists.ozlabs.org, broonie@opensource.wolfsonmicro.com, balbi@ti.com, grant.likely@secretlab.ca, kyungmin.park@samsung.com, linux-samsung-soc@vger.kernel.org, thomas.abraham@linaro.org, gautam.vivek@samsung.com, ben-linux@fluff.org, t.figa@samsung.com, linux-arm-kernel@lists.infradead.org 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 Adding the transceiver to hsotg driver. Keeping the platform data for continuing the smooth operation for boards which still uses it Signed-off-by: Praveen Paneri Acked-by: Kyungmin Park --- drivers/usb/gadget/s3c-hsotg.c | 37 +++++++++++++++++++++++++++---------- 1 files changed, 27 insertions(+), 10 deletions(-) diff --git a/drivers/usb/gadget/s3c-hsotg.c b/drivers/usb/gadget/s3c-hsotg.c index 439c3f9..c8ed7f1 100644 --- a/drivers/usb/gadget/s3c-hsotg.c +++ b/drivers/usb/gadget/s3c-hsotg.c @@ -32,6 +32,7 @@ #include #include +#include #include #include @@ -133,7 +134,9 @@ struct s3c_hsotg_ep { * struct s3c_hsotg - driver state. * @dev: The parent device supplied to the probe function * @driver: USB gadget driver - * @plat: The platform specific configuration data. + * @phy: The otg phy transceiver structure for phy control. + * @plat: The platform specific configuration data. This can be removed once + * all SoCs support usb transceiver. * @regs: The memory area mapped for accessing registers. * @irq: The IRQ number we are using * @supplies: Definition of USB power supplies @@ -153,6 +156,7 @@ struct s3c_hsotg_ep { struct s3c_hsotg { struct device *dev; struct usb_gadget_driver *driver; + struct usb_phy *phy; struct s3c_hsotg_plat *plat; spinlock_t lock; @@ -2854,7 +2858,10 @@ static void s3c_hsotg_phy_enable(struct s3c_hsotg *hsotg) struct platform_device *pdev = to_platform_device(hsotg->dev); dev_dbg(hsotg->dev, "pdev 0x%p\n", pdev); - if (hsotg->plat->phy_init) + + if (hsotg->phy) + usb_phy_init(hsotg->phy); + else if (hsotg->plat->phy_init) hsotg->plat->phy_init(pdev, hsotg->plat->phy_type); } @@ -2869,7 +2876,9 @@ static void s3c_hsotg_phy_disable(struct s3c_hsotg *hsotg) { struct platform_device *pdev = to_platform_device(hsotg->dev); - if (hsotg->plat->phy_exit) + if (hsotg->phy) + usb_phy_shutdown(hsotg->phy); + else if (hsotg->plat->phy_exit) hsotg->plat->phy_exit(pdev, hsotg->plat->phy_type); } @@ -3492,6 +3501,7 @@ static void s3c_hsotg_release(struct device *dev) static int s3c_hsotg_probe(struct platform_device *pdev) { struct s3c_hsotg_plat *plat = pdev->dev.platform_data; + struct usb_phy *phy; struct device *dev = &pdev->dev; struct s3c_hsotg_ep *eps; struct s3c_hsotg *hsotg; @@ -3500,20 +3510,27 @@ static int s3c_hsotg_probe(struct platform_device *pdev) int ret; int i; - plat = pdev->dev.platform_data; - if (!plat) { - dev_err(&pdev->dev, "no platform data defined\n"); - return -EINVAL; - } - hsotg = devm_kzalloc(&pdev->dev, sizeof(struct s3c_hsotg), GFP_KERNEL); if (!hsotg) { dev_err(dev, "cannot get memory\n"); return -ENOMEM; } + phy = devm_usb_get_phy(dev, USB_PHY_TYPE_USB2); + if (IS_ERR_OR_NULL(phy)) { + /* Fallback for pdata */ + plat = pdev->dev.platform_data; + if (!plat) { + dev_err(&pdev->dev, "no platform data or transceiver defined\n"); + return -EPROBE_DEFER; + } else { + hsotg->plat = plat; + } + } else { + hsotg->phy = phy; + } + hsotg->dev = dev; - hsotg->plat = plat; hsotg->clk = devm_clk_get(&pdev->dev, "otg"); if (IS_ERR(hsotg->clk)) {