From patchwork Mon Oct 20 10:45:36 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Marek Szyprowski X-Patchwork-Id: 39036 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-la0-f71.google.com (mail-la0-f71.google.com [209.85.215.71]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id B7171203C5 for ; Mon, 20 Oct 2014 10:46:03 +0000 (UTC) Received: by mail-la0-f71.google.com with SMTP id gi9sf2326358lab.2 for ; Mon, 20 Oct 2014 03:46:02 -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=5t644woxS4B9DwGabijfqoKDH9STxviAC7jwZMyoStg=; b=RvgIVC8SZGQLxgs7Hkyhr7oSTKjwL4x/A5NCpl5isf35ZOQg2ZrzYlVLY7AlA0rEmm Pbt07ji/GfQ8zI4/cuSEXo/Hym+kJ+TO/Ej/Xam4YHNeYigHmCRtlIZS9z40fva9V5oa KXWKQUHGGeV02xdQGAcb4vuyKwdwqbtf1Q3rN+860S81CkdtbFlf7s1yCGiHZ7Yal2Zj yw7UWZZgnDh0G70idpNkyesGok9X09CeIy/Xbw/TFGSjxpq3WnBfm0sXrZtmkl6T8Phv uYvxismK6MFrdYpVvzctrPENQks1Nqevy82zBmdY/oIdWRcev3I3uiSA1AihMvmbV0HH B3Tw== X-Gm-Message-State: ALoCoQnuN/5M74r5KEhlIAPjprWeLCqdbkOEkDfWK2vWWRbOHiIJCT40iPNekgaxB8E+RtoxM3U8 X-Received: by 10.112.146.104 with SMTP id tb8mr12240lbb.22.1413801962591; Mon, 20 Oct 2014 03:46:02 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.204.44 with SMTP id kv12ls428508lac.44.gmail; Mon, 20 Oct 2014 03:46:02 -0700 (PDT) X-Received: by 10.152.88.70 with SMTP id be6mr26656354lab.72.1413801962442; Mon, 20 Oct 2014 03:46:02 -0700 (PDT) Received: from mail-la0-f49.google.com (mail-la0-f49.google.com. [209.85.215.49]) by mx.google.com with ESMTPS id k1si13671228lam.96.2014.10.20.03.46.02 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Mon, 20 Oct 2014 03:46:02 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.215.49 as permitted sender) client-ip=209.85.215.49; Received: by mail-la0-f49.google.com with SMTP id q1so3578544lam.8 for ; Mon, 20 Oct 2014 03:46:02 -0700 (PDT) X-Received: by 10.112.77.74 with SMTP id q10mr18036545lbw.66.1413801962327; Mon, 20 Oct 2014 03:46:02 -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 c5csp278552lbz; Mon, 20 Oct 2014 03:46:01 -0700 (PDT) X-Received: by 10.70.101.234 with SMTP id fj10mr27339153pdb.22.1413801960175; Mon, 20 Oct 2014 03:46:00 -0700 (PDT) Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id tv2si7567486pac.25.2014.10.20.03.45.59 for ; Mon, 20 Oct 2014 03:46:00 -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 S1753557AbaJTKp4 (ORCPT + 3 others); Mon, 20 Oct 2014 06:45:56 -0400 Received: from mailout3.w1.samsung.com ([210.118.77.13]:50553 "EHLO mailout3.w1.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753523AbaJTKpx (ORCPT ); Mon, 20 Oct 2014 06:45:53 -0400 Received: from eucpsbgm1.samsung.com (unknown [203.254.199.244]) by mailout3.w1.samsung.com (Oracle Communications Messaging Server 7u4-24.01(7.0.4.24.0) 64bit (built Nov 17 2011)) with ESMTP id <0NDQ00JX0OP6C810@mailout3.w1.samsung.com>; Mon, 20 Oct 2014 11:48:42 +0100 (BST) X-AuditID: cbfec7f4-b7f6c6d00000120b-5f-5444e7de9feb Received: from eusync4.samsung.com ( [203.254.199.214]) by eucpsbgm1.samsung.com (EUCPMTA) with SMTP id 11.64.04619.ED7E4445; Mon, 20 Oct 2014 11:45:50 +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:50 +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 06/10] usb: dwc2/gadget: decouple setting soft-disconnect from s3c_hsotg_core_init Date: Mon, 20 Oct 2014 12:45:36 +0200 Message-id: <1413801940-31086-7-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+NgFvrCJMWRmVeSWpSXmKPExsVy+t/xa7r3nruEGHw7YmBx8H69xesXhhZn m96wW8w4v4/JYtGyVmaLtUfusltsnzKdyeLB4Z3sDhwefVtWMXps2f+Z0eP4je1MHp83yQWw RHHZpKTmZJalFunbJXBl7Fi0kq3gmUjF5lXtbA2M0wS7GDk5JARMJOZe+swOYYtJXLi3nq2L kYtDSGApo8T67mVMEE4fk0TDnAtMIFVsAoYSXW+72EBsEQEHiSVL74DZzAI/GSUmT7UBsYUF 0iVe/PrODGKzCKhKvPp8B2wDr4CHxM7bG1ggtslJ/H+5Amwmp4CnxJsX0xhBbCGgmk3LX7JM YORdwMiwilE0tTS5oDgpPddQrzgxt7g0L10vOT93EyMkpL7sYFx8zOoQowAHoxIPr4ClS4gQ a2JZcWXuIUYJDmYlEd7u20Ah3pTEyqrUovz4otKc1OJDjEwcnFINjBXKeZfPtx7zVjV417Zv T+fdEtkUheJnmyxsyi2K+u7p2PQIWZixHmOftpRFtziXZVpkgY6dUfVk2diOjeI9yTP3al1U m32d1dQ7pcShecHqTxGiL5hYeUJTdDYKMxusWTO1zSWJIX3Vm1/61tOiDZ4stjjVvGXjbqe7 y+S+P7zKYZctVH1eiaU4I9FQi7moOBEA8ksyMQcCAAA= 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.215.49 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 changes s3c_hsotg_core_init function to leave hardware in soft disconnect mode, so the moment of coupling the hardware to the usb bus can be later controlled by the separate functions for enabling and disabling soft disconnect mode. This patch is a preparation to rework pullup() method. Signed-off-by: Marek Szyprowski Acked-by: Paul Zimmerman --- drivers/usb/dwc2/gadget.c | 22 +++++++++++++++++----- 1 file changed, 17 insertions(+), 5 deletions(-) diff --git a/drivers/usb/dwc2/gadget.c b/drivers/usb/dwc2/gadget.c index c1dad46bbbdd..5eb2473031c4 100644 --- a/drivers/usb/dwc2/gadget.c +++ b/drivers/usb/dwc2/gadget.c @@ -2124,7 +2124,7 @@ static int s3c_hsotg_corereset(struct s3c_hsotg *hsotg) * * Issue a soft reset to the core, and await the core finishing it. */ -static void s3c_hsotg_core_init(struct s3c_hsotg *hsotg) +static void s3c_hsotg_core_init_disconnected(struct s3c_hsotg *hsotg) { s3c_hsotg_corereset(hsotg); @@ -2241,14 +2241,23 @@ static void s3c_hsotg_core_init(struct s3c_hsotg *hsotg) readl(hsotg->regs + DOEPCTL0)); /* clear global NAKs */ - writel(DCTL_CGOUTNAK | DCTL_CGNPINNAK, + writel(DCTL_CGOUTNAK | DCTL_CGNPINNAK | DCTL_SFTDISCON, hsotg->regs + DCTL); /* must be at-least 3ms to allow bus to see disconnect */ mdelay(3); hsotg->last_rst = jiffies; +} + +static void s3c_hsotg_core_disconnect(struct s3c_hsotg *hsotg) +{ + /* set the soft-disconnect bit */ + __orr32(hsotg->regs + DCTL, DCTL_SFTDISCON); +} +static void s3c_hsotg_core_connect(struct s3c_hsotg *hsotg) +{ /* remove the soft-disconnect and let's go */ __bic32(hsotg->regs + DCTL, DCTL_SFTDISCON); } @@ -2348,7 +2357,8 @@ irq_retry: kill_all_requests(hsotg, &hsotg->eps[0], -ECONNRESET, true); - s3c_hsotg_core_init(hsotg); + s3c_hsotg_core_init_disconnected(hsotg); + s3c_hsotg_core_connect(hsotg); } } } @@ -2981,7 +2991,8 @@ static int s3c_hsotg_pullup(struct usb_gadget *gadget, int is_on) if (is_on) { s3c_hsotg_phy_enable(hsotg); clk_enable(hsotg->clk); - s3c_hsotg_core_init(hsotg); + s3c_hsotg_core_init_disconnected(hsotg); + s3c_hsotg_core_connect(hsotg); } else { clk_disable(hsotg->clk); s3c_hsotg_phy_disable(hsotg); @@ -3668,7 +3679,8 @@ static int s3c_hsotg_resume(struct platform_device *pdev) spin_lock_irqsave(&hsotg->lock, flags); s3c_hsotg_phy_enable(hsotg); - s3c_hsotg_core_init(hsotg); + s3c_hsotg_core_init_disconnected(hsotg); + s3c_hsotg_core_connect(hsotg); spin_unlock_irqrestore(&hsotg->lock, flags); return ret;