From patchwork Mon Oct 20 10:45:37 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Marek Szyprowski X-Patchwork-Id: 5104251 Return-Path: X-Original-To: patchwork-linux-samsung-soc@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 4C7B29F374 for ; Mon, 20 Oct 2014 10:46:18 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 941982017D for ; Mon, 20 Oct 2014 10:46:17 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 7794320179 for ; Mon, 20 Oct 2014 10:46:16 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753657AbaJTKqP (ORCPT ); Mon, 20 Oct 2014 06:46:15 -0400 Received: from mailout2.w1.samsung.com ([210.118.77.12]:16259 "EHLO mailout2.w1.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753522AbaJTKpw (ORCPT ); Mon, 20 Oct 2014 06:45:52 -0400 Received: from eucpsbgm2.samsung.com (unknown [203.254.199.245]) by mailout2.w1.samsung.com (Oracle Communications Messaging Server 7u4-24.01(7.0.4.24.0) 64bit (built Nov 17 2011)) with ESMTP id <0NDQ00MY8OP4PZ10@mailout2.w1.samsung.com>; Mon, 20 Oct 2014 11:48:40 +0100 (BST) X-AuditID: cbfec7f5-b7f956d000005ed7-49-5444e7df4eb9 Received: from eusync4.samsung.com ( [203.254.199.214]) by eucpsbgm2.samsung.com (EUCPMTA) with SMTP id 81.92.24279.FD7E4445; Mon, 20 Oct 2014 11:45:51 +0100 (BST) Received: from amdc1339.digital.local ([106.116.147.30]) by eusync4.samsung.com (Oracle Communications Messaging Server 7u4-24.01 (7.0.4.24.0) 64bit (built Nov 17 2011)) with ESMTPA id <0NDQ009U7OK7MS20@eusync4.samsung.com>; Mon, 20 Oct 2014 11:45:51 +0100 (BST) From: Marek Szyprowski To: linux-usb@vger.kernel.org, linux-samsung-soc@vger.kernel.org Cc: Marek Szyprowski , Felipe Balbi , Kyungmin Park , Robert Baldyga , Paul Zimmerman , Krzysztof Kozlowski Subject: [PATCH v2 07/10] usb: dwc2/gadget: move phy control calls out of pullup() method Date: Mon, 20 Oct 2014 12:45:37 +0200 Message-id: <1413801940-31086-8-git-send-email-m.szyprowski@samsung.com> X-Mailer: git-send-email 1.9.2 In-reply-to: <1413801940-31086-1-git-send-email-m.szyprowski@samsung.com> References: <1413801940-31086-1-git-send-email-m.szyprowski@samsung.com> X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFvrMJMWRmVeSWpSXmKPExsVy+t/xa7r3n7uEGHRdFbI4eL/e4vULQ4uz TW/YLWac38dksWhZK7PF2iN32S22T5nOZPHg8E52Bw6Pvi2rGD227P/M6HH8xnYmj8+b5AJY orhsUlJzMstSi/TtErgy1j68xFSwnaeic9JXlgbGHVxdjJwcEgImEvO3nWWCsMUkLtxbz9bF yMUhJLCUUWL51zfsEE4fk8T1+ZuZQarYBAwlut52sYHYIgIOEkuW3gGzmQV+MkpMnmoDYgsL REt0/e1m7WLk4GARUJXonCMNEuYV8JDYsOgSK8QyOYn/L1eALeYU8JR482IaI4gtBFSzaflL lgmMvAsYGVYxiqaWJhcUJ6XnGukVJ+YWl+al6yXn525ihATU1x2MS49ZHWIU4GBU4uHdYeYS IsSaWFZcmXuIUYKDWUmEt/s2UIg3JbGyKrUoP76oNCe1+BAjEwenVAPjtshyrg0bHqXPKDe4 WG31OPXZgiXLLvWLaGpNjAqrMV6+6UO60ikj+6eWqyvvh04oVqrfrt5o1Sq1dltyfS/D/79n dZLW5vf5MgSu6Hx6VOXI7A2NxdsYi5RDGe+l2Jn8dZvauu9ImL0T+/znfvd3TnrPlnXe4Qrr 3EJznh1uHIu78ryu6icqsRRnJBpqMRcVJwIA/d8PZgYCAAA= Sender: linux-samsung-soc-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-samsung-soc@vger.kernel.org X-Spam-Status: No, score=-8.3 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP This patch moves phy enable/disable calls from pullup() method to udc_start/stop functions. This solves the issue related to limited caller context for PHY functions, because they cannot be called from non-sleeping context. This is also a preparation for using soft-disconnect feature of udc controller in pullup() method. Signed-off-by: Marek Szyprowski Acked-by: Paul Zimmerman --- drivers/usb/dwc2/gadget.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/drivers/usb/dwc2/gadget.c b/drivers/usb/dwc2/gadget.c index 5eb2473031c4..98adf8d17493 100644 --- a/drivers/usb/dwc2/gadget.c +++ b/drivers/usb/dwc2/gadget.c @@ -2919,6 +2919,8 @@ static int s3c_hsotg_udc_start(struct usb_gadget *gadget, goto err; } + s3c_hsotg_phy_enable(hsotg); + dev_info(hsotg->dev, "bound driver %s\n", driver->driver.name); return 0; @@ -2955,6 +2957,8 @@ static int s3c_hsotg_udc_stop(struct usb_gadget *gadget, spin_unlock_irqrestore(&hsotg->lock, flags); + s3c_hsotg_phy_disable(hsotg); + regulator_bulk_disable(ARRAY_SIZE(hsotg->supplies), hsotg->supplies); clk_disable(hsotg->clk); @@ -2989,13 +2993,11 @@ static int s3c_hsotg_pullup(struct usb_gadget *gadget, int is_on) spin_lock_irqsave(&hsotg->lock, flags); if (is_on) { - s3c_hsotg_phy_enable(hsotg); clk_enable(hsotg->clk); s3c_hsotg_core_init_disconnected(hsotg); s3c_hsotg_core_connect(hsotg); } else { clk_disable(hsotg->clk); - s3c_hsotg_phy_disable(hsotg); } hsotg->gadget.speed = USB_SPEED_UNKNOWN;