From patchwork Wed Sep 12 10:45:54 2012 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: 1442271 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork2.kernel.org Received: from merlin.infradead.org (unknown [205.233.59.134]) by patchwork2.kernel.org (Postfix) with ESMTP id D36D7DF28C for ; Wed, 12 Sep 2012 10:46:58 +0000 (UTC) Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.76 #1 (Red Hat Linux)) id 1TBkJ4-0007Lp-Pi; Wed, 12 Sep 2012 10:36:30 +0000 Received: from mailout2.samsung.com ([203.254.224.25]) by merlin.infradead.org with esmtp (Exim 4.76 #1 (Red Hat Linux)) id 1TBkJ0-0007JC-ES for linux-arm-kernel@lists.infradead.org; Wed, 12 Sep 2012 10:36:27 +0000 Received: from epcpsbgm2.samsung.com (epcpsbgm2 [203.254.230.27]) by mailout2.samsung.com (Oracle Communications Messaging Server 7u4-24.01(7.0.4.24.0) 64bit (built Nov 17 2011)) with ESMTP id <0MA800JLXG38PRF0@mailout2.samsung.com> for linux-arm-kernel@lists.infradead.org; Wed, 12 Sep 2012 19:36:20 +0900 (KST) Received: from epcpsbgm2.samsung.com ( [172.20.52.114]) by epcpsbgm2.samsung.com (EPCPMTA) with SMTP id 7F.0F.31452.4A560505; Wed, 12 Sep 2012 19:36:20 +0900 (KST) X-AuditID: cbfee61b-b7f586d000007adc-cb-505065a402d7 Received: from epmmp1.local.host ( [203.254.227.16]) by epcpsbgm2.samsung.com (EPCPMTA) with SMTP id 2D.0F.31452.3A560505; Wed, 12 Sep 2012 19:36:19 +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 <0MA8007OKG30YQ80@mmp1.samsung.com> for linux-arm-kernel@lists.infradead.org; Wed, 12 Sep 2012 19:36:19 +0900 (KST) From: Praveen Paneri To: linux-usb@vger.kernel.org Subject: [PATCH v5 2/5] usb: s3c-hsotg: Adding phy driver support Date: Wed, 12 Sep 2012 16:15:54 +0530 Message-id: <1347446757-20519-3-git-send-email-p.paneri@samsung.com> X-Mailer: git-send-email 1.7.1 In-reply-to: <1347446757-20519-1-git-send-email-p.paneri@samsung.com> References: <1347446757-20519-1-git-send-email-p.paneri@samsung.com> DLP-Filter: Pass X-MTR: 20000000000000000@CPGS X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFrrNLMWRmVeSWpSXmKPExsWyRsSkSHdJakCAQe8EK4tNj6+xOjB6bF5S H8AYxWWTkpqTWZZapG+XwJUx8/McloJLUhV7b95laWC8JNrFyMkhIWAisfH9OyYIW0ziwr31 bF2MXBxCAksZJXrnHGWHK+paDZVYxCjx8X0TK4SzgUli5Z/JQO0cHGwC2hINM41AGkQEZCUO X/nNDGIzC7xlknh+JgzEFhZwlJi5cwEjiM0ioCpx/d4FNhCbV8BF4vGyHhaIZXISO1Y/AbuI U8BVYtLJiWBzhIBqbtycywrRKyDxbfIhFpC1EkC7Nh1gBjlHQuA6m8TOjg1sEHMkJQ6uuMEy gVF4ASPDKkbR1ILkguKk9FwjveLE3OLSvHS95PzcTYzAEDz975n0DsZVDRaHGAU4GJV4eBMz /QOEWBPLiitzDzFKcDArifBu0A0IEOJNSaysSi3Kjy8qzUktPsToA3TJRGYp0eR8YHzklcQb GhubmJmYWpgZmRmZ4BBWEud1OmcXICSQnliSmp2aWpBaBDOOiYNTqoFRVknxk/3+gO2hdkLs V0u6eDy3hEx5amYgKdHJIrZshkPVloOCq09Y7bR9unO5fDEDr+0p0/I7VZVXjx24fHlT1LPX 143N1Z4leJ//JLVXzqnhlMvWa8W2O14UtQl5+JpJMh/T3i7IcPeWXeVt/hfvTlhUpF+4l7KP y1Bq9/e57v/r9lzbrrNKiaU4I9FQi7moOBEAlJKvem4CAAA= X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFupikeLIzCtJLcpLzFFi42I5/e+xgO7i1IAAg40XuS02Pb7G6sDosXlJ fQBjVAOjTUZqYkpqkUJqXnJ+SmZeuq2Sd3C8c7ypmYGhrqGlhbmSQl5ibqqtkotPgK5bZg7Q VCWFssScUqBQQGJxsZK+HaYJoSFuuhYwjRG6viFBcD1GBmggYQ1jxszPc1gKLklV7L15l6WB 8ZJoFyMnh4SAicTGrtVsELaYxIV764FsLg4hgUWMEh/fN7FCOBuYJFb+mczUxcjBwSagLdEw 0wikQURAVuLwld/MIDazwFsmiednwkBsYQFHiZk7FzCC2CwCqhLX710AW8Ar4CLxeFkPC8Qy OYkdq58wgdicAq4Sk05OBJsjBFRz4+Zc1gmMvAsYGVYxiqYWJBcUJ6XnGukVJ+YWl+al6yXn 525iBAf4M+kdjKsaLA4xCnAwKvHwJmb6BwixJpYVV+YeYpTgYFYS4d2gGxAgxJuSWFmVWpQf X1Sak1p8iNEH6KqJzFKiyfnA6MsriTc0NjEzsjQyN7QwMjbHIawkzut0zi5ASCA9sSQ1OzW1 ILUIZhwTB6dUA2M0w6u53As9ViyakMvz1cl0kr2M9+KXX984RItumpGZ0P30Q2BQ6pL49EU6 8fHbdq5Lr/9m/SUhR/xteJrpBP60KUV3Df/E8whpnJWZlnphRsGadcylM3mn+SSqFbk8f68Y cMSv7K1o1NFft74KNzv5RhlINf/wn/N9YsuWO7cbta4rmlxnjFdiKc5INNRiLipOBABQtmVD nQIAAA== X-CFilter-Loop: Reflected X-Spam-Note: CRM114 invocation failed X-Spam-Score: -7.3 (-------) X-Spam-Report: SpamAssassin version 3.3.2 on merlin.infradead.org summary: Content analysis details: (-7.3 points) pts rule name description ---- ---------------------- -------------------------------------------------- -5.0 RCVD_IN_DNSWL_HI RBL: Sender listed at http://www.dnswl.org/, high trust [203.254.224.25 listed in list.dnswl.org] -0.0 SPF_HELO_PASS SPF: HELO matches SPF record -0.4 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, ben-linux@fluff.org, 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 --- 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 6f696ee..29815b9 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); } @@ -3493,6 +3502,7 @@ static void s3c_hsotg_release(struct device *dev) static int __devinit 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; @@ -3501,20 +3511,27 @@ static int __devinit 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; } + plat = pdev->dev.platform_data; + if (!plat) { + /* Fallback for transceiver */ + phy = devm_usb_get_phy(dev, USB_PHY_TYPE_USB2); + if (IS_ERR_OR_NULL(phy)) { + dev_err(&pdev->dev, "no platform data or transceiver defined\n"); + return -EPROBE_DEFER; + } else { + hsotg->phy = phy; + } + } else { + hsotg->plat = plat; + } + hsotg->dev = dev; - hsotg->plat = plat; hsotg->clk = devm_clk_get(&pdev->dev, "otg"); if (IS_ERR(hsotg->clk)) {