From patchwork Mon Oct 20 10:45:38 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Marek Szyprowski X-Patchwork-Id: 39039 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-ee0-f70.google.com (mail-ee0-f70.google.com [74.125.83.70]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id A5D4D203C5 for ; Mon, 20 Oct 2014 10:46:07 +0000 (UTC) Received: by mail-ee0-f70.google.com with SMTP id c13sf2402774eek.9 for ; Mon, 20 Oct 2014 03:46:06 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:delivered-to:from:to:cc:subject :date:message-id:in-reply-to:references:sender:precedence:list-id :x-original-sender:x-original-authentication-results:mailing-list :list-post:list-help:list-archive:list-unsubscribe; bh=37c/7c+aI5NsA4UiFueOpV9+oU/fhZgKC+O3e26rrbY=; b=jZcRYEK+M+asoHXBN0ln2Ge/K1WH39GscV7TkNqjAyqaTfAxKb1a9K84GW+1oM/oNe GEZxX2UMwOqd2kzYpdJBZXZ2UGll+lFRDmHbBEFxosvd/mYTtBZFrc8l2H0mcernmjkE wATwdcoAHWnR0ScKdMnOhMXHwk2fdzD6Q7D/E31Ve56JY96EGauJZcQNZgbKQ/6VvEoM HpGBcQ/LYVlmZgHFhUofC2Oc9QOjcZlrZwGZIByP8HqTx2+HqmsDiu9BkmXewTv5tjCk bPglWVXXSozEZt1FntD14+/P221iDBFT6SNZxbez6W1BAZTUWEwbiR/Jmb9ItDAvGJe6 680g== X-Gm-Message-State: ALoCoQmrRD8S6o0dh6ixk8BKZVxBFpobb4bho1ZUcoFdDft76dLIrS5SboiagB0uOEc9P+IspGeG X-Received: by 10.112.95.133 with SMTP id dk5mr3913543lbb.3.1413801966795; Mon, 20 Oct 2014 03:46:06 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.26.130 with SMTP id l2ls411042lag.45.gmail; Mon, 20 Oct 2014 03:46:06 -0700 (PDT) X-Received: by 10.152.19.9 with SMTP id a9mr26569131lae.41.1413801966639; Mon, 20 Oct 2014 03:46:06 -0700 (PDT) Received: from mail-lb0-f180.google.com (mail-lb0-f180.google.com. [209.85.217.180]) by mx.google.com with ESMTPS id bn10si13664931lbc.108.2014.10.20.03.46.06 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Mon, 20 Oct 2014 03:46:06 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.217.180 as permitted sender) client-ip=209.85.217.180; Received: by mail-lb0-f180.google.com with SMTP id n15so3553711lbi.25 for ; Mon, 20 Oct 2014 03:46:06 -0700 (PDT) X-Received: by 10.112.221.197 with SMTP id qg5mr26266871lbc.32.1413801966557; Mon, 20 Oct 2014 03:46:06 -0700 (PDT) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patch@linaro.org Received: by 10.112.84.229 with SMTP id c5csp278563lbz; Mon, 20 Oct 2014 03:46:05 -0700 (PDT) X-Received: by 10.70.34.236 with SMTP id c12mr7976694pdj.116.1413801964536; Mon, 20 Oct 2014 03:46:04 -0700 (PDT) Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id m5si7471476pdl.134.2014.10.20.03.46.03 for ; Mon, 20 Oct 2014 03:46:04 -0700 (PDT) Received-SPF: none (google.com: linux-usb-owner@vger.kernel.org does not designate permitted sender hosts) client-ip=209.132.180.67; Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753594AbaJTKqB (ORCPT + 3 others); Mon, 20 Oct 2014 06:46:01 -0400 Received: from mailout4.w1.samsung.com ([210.118.77.14]:33978 "EHLO mailout4.w1.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753529AbaJTKp4 (ORCPT ); Mon, 20 Oct 2014 06:45:56 -0400 Received: from eucpsbgm2.samsung.com (unknown [203.254.199.245]) by mailout4.w1.samsung.com (Oracle Communications Messaging Server 7u4-24.01(7.0.4.24.0) 64bit (built Nov 17 2011)) with ESMTP id <0NDQ000WQOP20M10@mailout4.w1.samsung.com>; Mon, 20 Oct 2014 11:48:38 +0100 (BST) X-AuditID: cbfec7f5-b7f956d000005ed7-4f-5444e7dfb1a2 Received: from eusync4.samsung.com ( [203.254.199.214]) by eucpsbgm2.samsung.com (EUCPMTA) with SMTP id 33.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 08/10] usb: dwc2/gadget: use soft-disconnect udc feature in pullup() method Date: Mon, 20 Oct 2014 12:45:38 +0200 Message-id: <1413801940-31086-9-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/xa7r3n7uEGBx5YGhx8H69xesXhhZn m96wW8w4v4/JYtGyVmaLtUfusltsnzKdyeLB4Z3sDhwefVtWMXps2f+Z0eP4je1MHp83yQWw RHHZpKTmZJalFunbJXBlfD87ib3gLm/FiV2PWBoYD3J3MXJySAiYSKw4/5cFwhaTuHBvPVsX IxeHkMBSRokfJy4xQjh9TBLX529mBqliEzCU6HrbxQZiiwg4SCxZegfMZhb4ySgxeapNFyMH h7BAgsSpXk6QMIuAqsT3nfMZQWxeAQ+Ja4v6mSCWyUn8f7kCzOYU8JR482IaWI0QUM2m5S9Z JjDyLmBkWMUomlqaXFCclJ5rpFecmFtcmpeul5yfu4kRElBfdzAuPWZ1iFGAg1GJh3eHmUuI EGtiWXFl7iFGCQ5mJRHe7ttAId6UxMqq1KL8+KLSnNTiQ4xMHJxSDYxKJ6ynMQscfdzoUBps YPDWYZPhkv1u08S4t/7mUju2a8HU+pMVFxtVPlZ5y36pTWP6vffignbrtw/ZeG0ci+0T2L7M 5JZi+MhZ5rD9irJEtL/u+bSKs0VzuucaszNI6zsefdHBvDK24KOR+7HyWTr1FhE+yoEuC9Ot ffruFRnra3+81PK0SImlOCPRUIu5qDgRAJ5HDGAGAgAA Sender: linux-usb-owner@vger.kernel.org Precedence: list List-ID: X-Mailing-List: linux-usb@vger.kernel.org X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: m.szyprowski@samsung.com X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.217.180 as permitted sender) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org X-Google-Group-Id: 836684582541 List-Post: , List-Help: , List-Archive: List-Unsubscribe: , This patch moves udc initialization from pullup() method to s3c_hsotg_udc_start(), so that method ends with hardware fully initialized and left in soft-disconnected state. After this change, the pullup() method simply clears soft-disconnect start() when called with is_on=1. For completeness, a call to s3c_hsotg_core_disconnect() has been added when pullup() method is called with is_on=0, what puts the udc hardware back to soft-disconnected state. Signed-off-by: Marek Szyprowski Acked-by: Paul Zimmerman --- drivers/usb/dwc2/gadget.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/drivers/usb/dwc2/gadget.c b/drivers/usb/dwc2/gadget.c index 98adf8d17493..e8ffc080e6c7 100644 --- a/drivers/usb/dwc2/gadget.c +++ b/drivers/usb/dwc2/gadget.c @@ -2883,6 +2883,7 @@ static int s3c_hsotg_udc_start(struct usb_gadget *gadget, struct usb_gadget_driver *driver) { struct s3c_hsotg *hsotg = to_hsotg(gadget); + unsigned long flags; int ret; if (!hsotg) { @@ -2921,7 +2922,13 @@ static int s3c_hsotg_udc_start(struct usb_gadget *gadget, s3c_hsotg_phy_enable(hsotg); + spin_lock_irqsave(&hsotg->lock, flags); + s3c_hsotg_init(hsotg); + s3c_hsotg_core_init_disconnected(hsotg); + spin_unlock_irqrestore(&hsotg->lock, flags); + dev_info(hsotg->dev, "bound driver %s\n", driver->driver.name); + return 0; err: @@ -2994,9 +3001,9 @@ static int s3c_hsotg_pullup(struct usb_gadget *gadget, int is_on) spin_lock_irqsave(&hsotg->lock, flags); if (is_on) { clk_enable(hsotg->clk); - s3c_hsotg_core_init_disconnected(hsotg); s3c_hsotg_core_connect(hsotg); } else { + s3c_hsotg_core_disconnect(hsotg); clk_disable(hsotg->clk); }