From patchwork Wed Apr 3 12:53:51 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kishon Vijay Abraham I X-Patchwork-Id: 2387221 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 5105F3FD8C for ; Wed, 3 Apr 2013 12:58:04 +0000 (UTC) Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1UNNEC-0002BG-Qe; Wed, 03 Apr 2013 12:55:49 +0000 Received: from arroyo.ext.ti.com ([192.94.94.40]) by merlin.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1UNNDC-0001t9-5K for linux-arm-kernel@lists.infradead.org; Wed, 03 Apr 2013 12:54:48 +0000 Received: from dbdp20.itg.ti.com ([172.24.170.38]) by arroyo.ext.ti.com (8.13.7/8.13.7) with ESMTP id r33CsNeP017127; Wed, 3 Apr 2013 07:54:24 -0500 Received: from DBDE70.ent.ti.com (localhost [127.0.0.1]) by dbdp20.itg.ti.com (8.13.8/8.13.8) with ESMTP id r33CsBGm023399; Wed, 3 Apr 2013 18:24:22 +0530 (IST) Received: from dbdp33.itg.ti.com (172.24.170.252) by dbde70.ent.ti.com (172.24.170.148) with Microsoft SMTP Server id 14.1.323.3; Wed, 3 Apr 2013 18:24:11 +0530 Received: from a0393678lt.apr.dhcp.ti.com (smtpvbd.itg.ti.com [172.24.170.250]) by dbdp33.itg.ti.com (8.13.8/8.13.8) with ESMTP id r33CrumP029215; Wed, 3 Apr 2013 18:24:11 +0530 From: Kishon Vijay Abraham I To: , , , , , , Subject: [PATCH v5 3/6] usb: otg: twl4030: use the new generic PHY framework Date: Wed, 3 Apr 2013 18:23:51 +0530 Message-ID: <1364993634-6378-4-git-send-email-kishon@ti.com> X-Mailer: git-send-email 1.7.10.4 In-Reply-To: <1364993634-6378-1-git-send-email-kishon@ti.com> References: <1364993634-6378-1-git-send-email-kishon@ti.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20130403_085446_346002_17BB581A X-CRM114-Status: GOOD ( 12.72 ) X-Spam-Score: -7.5 (-------) X-Spam-Report: SpamAssassin version 3.3.2 on merlin.infradead.org summary: Content analysis details: (-7.5 points) pts rule name description ---- ---------------------- -------------------------------------------------- -5.0 RCVD_IN_DNSWL_HI RBL: Sender listed at http://www.dnswl.org/, high trust [192.94.94.40 listed in list.dnswl.org] 1.7 KHOP_BIG_TO_CC Sent to 10+ recipients instaed of Bcc or a list -0.0 SPF_PASS SPF: sender matches SPF record -2.3 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: broonie@opensource.wolfsonmicro.com, linux@arm.linux.org.uk, b-cousson@ti.com, linux-doc@vger.kernel.org, tony@atomide.com, netdev@vger.kernel.org, devicetree-discuss@lists.ozlabs.org, linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org, rob.herring@calxeda.com, kishon@ti.com, grant.likely@secretlab.ca, eballetbo@gmail.com, santosh.shilimkar@ti.com, linux-arm-kernel@lists.infradead.org, swarren@nvidia.com, javier@dowhile0.org, linux-omap@vger.kernel.org, davem@davemloft.net, cesarb@cesarb.net, mchehab@redhat.com X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org Used the generic PHY framework API to create the PHY. twl4030_usb_suspend and twl4030_usb_resume is added to phy_ops in order to align with the new framework. However using the old USB PHY library cannot be completely removed because OTG is intertwined with PHY and moving to the new framework completely will break OTG. Once we have a separate OTG state machine, we can get rid of the USB PHY library. Signed-off-by: Kishon Vijay Abraham I --- drivers/usb/otg/twl4030-usb.c | 37 +++++++++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) diff --git a/drivers/usb/otg/twl4030-usb.c b/drivers/usb/otg/twl4030-usb.c index a994715..6dab049 100644 --- a/drivers/usb/otg/twl4030-usb.c +++ b/drivers/usb/otg/twl4030-usb.c @@ -33,6 +33,7 @@ #include #include #include +#include #include #include #include @@ -575,10 +576,39 @@ static int twl4030_set_host(struct usb_otg *otg, struct usb_bus *host) return 0; } +static int twl4030_usb_suspend(struct phy *phy) +{ + struct twl4030_usb *twl = dev_get_drvdata(&phy->dev); + + twl4030_phy_suspend(twl, 1); + + return 0; +} + +static int twl4030_usb_resume(struct phy *phy) +{ + struct twl4030_usb *twl = dev_get_drvdata(&phy->dev); + + if (!twl->asleep) + return -EBUSY; + __twl4030_phy_resume(twl); + twl->asleep = 0; + + return 0; +} + +static struct phy_ops ops = { + .suspend = twl4030_usb_suspend, + .resume = twl4030_usb_resume, + .of_xlate = of_phy_xlate, + .owner = THIS_MODULE, +}; + static int twl4030_usb_probe(struct platform_device *pdev) { struct twl4030_usb_data *pdata = pdev->dev.platform_data; struct twl4030_usb *twl; + struct phy *phy; int status, err; struct usb_otg *otg; struct device_node *np = pdev->dev.of_node; @@ -617,6 +647,13 @@ static int twl4030_usb_probe(struct platform_device *pdev) otg->set_host = twl4030_set_host; otg->set_peripheral = twl4030_set_peripheral; + phy = devm_phy_create(twl->dev, "twl4030", pdev->dev.of_node, + USB_PHY_TYPE_USB2, &ops, twl); + if (IS_ERR(phy)) { + dev_dbg(&pdev->dev, "Failed to create PHY\n"); + return PTR_ERR(phy); + } + /* init spinlock for workqueue */ spin_lock_init(&twl->lock);