From patchwork Wed Nov 28 06:04:12 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hsin-Yi Wang X-Patchwork-Id: 10701993 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 781C413BF for ; Wed, 28 Nov 2018 06:04:32 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 680372CC93 for ; Wed, 28 Nov 2018 06:04:32 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 5C16A2CCA8; Wed, 28 Nov 2018 06:04:32 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.2 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 0E48A2CC93 for ; Wed, 28 Nov 2018 06:04:32 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:MIME-Version:Cc:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id:Message-Id:Date: Subject:To:From:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To: References:List-Owner; bh=8IwWDz11cOsZPe2BJS3rIsb/+qrhF3dM0WVoThZd/uM=; b=mAE 07FvJzp+L+2abnSeDTbHwqlfsdf8iRVH1OA+q4sLQsIfUrt3ORKKUmvdKa7lrsQQ2LSnp7PLR+Omo So1s+giu8gXk/r617AtuVCm4DK/dF/r4ZDVsUdMhibu/r8zxK3Bek6uDuBFZbsJwcXlzzdqKBNUMk 98E2rDkfl4kOnPztaLPwRNxDZ3hhpOpHnPvTU2Hmvn/wIhxREO94o+O9ioK+0ik6ZGemlj3QzzUKO esK81rKL/o1RlJ7WBXGswIZWFbEfKEBTDnonOc4eDtybWNK2OygXqS7xdfoPzfPPy0ybgok/tbOff 529vjotNPtZqFmlzD1Wr2tFuiDxcaRw==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1gRsxb-0001pt-FE; Wed, 28 Nov 2018 06:04:31 +0000 Received: from mail-pf1-x442.google.com ([2607:f8b0:4864:20::442]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1gRsxY-0001pF-AY for linux-mediatek@lists.infradead.org; Wed, 28 Nov 2018 06:04:29 +0000 Received: by mail-pf1-x442.google.com with SMTP id c72so9640224pfc.6 for ; Tue, 27 Nov 2018 22:04:17 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=from:to:cc:subject:date:message-id; bh=CP0ZZK7SqB43zKSvumuMlYKiaZyMxI0xBVfIYtC5CkA=; b=D1IamjTXkEXtalGe/CAe5Tfj4HAw4u1TftWQ5QZru+RLNmGqft2uZo1f0MgRbgfBUU EHsdzo7ncC0DiUQouXjCN47aXgiNGi//IvzoH/NnXY+Rvl40q3aPLVXBr352jojKWZ5j JhydCMxHTvi/hFhwVV8gNTw4O0qLxq1ve6G7U= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=CP0ZZK7SqB43zKSvumuMlYKiaZyMxI0xBVfIYtC5CkA=; b=ON7GS/fYUMZnc0rhMB9lCYL+4f2s69vcLEDBzLkuZJVXsQxIgBlep+regWlGvuFkFu DX18hkRdc5ZehdU/Rv8cW029c4qLjRtzucrLi6LE3g5IbmN90vluprDJtOd0pmmEFdp6 K2kmAbm5Ix0tRanTY2G6QRwXM8Rji99uKCHTnUgBN+FaO+9WVTXzO7KtgB6Kz5Lu1CW/ 7RZfvs4qS4EJ4XVCBa74kPZknGp5Gxw5PMB2dj5xW44ub5tGAUeGiGyzkXNdl0QnUOWE +D3PIWuxqA6FScFHO+5baetVXNVvVbPq6kMyr0Kla4ZjThBUB+volofL16zf5UHL4Us0 js7A== X-Gm-Message-State: AA+aEWaKGtuLbqOFYQ3Bjzo/fKmB0jFBa4XdmN64Nc+xW6abU5t7MRpG CjnoebCS6MBIdtPzLsbmKO3q2Q== X-Google-Smtp-Source: AFSGD/Upc7VGPqDgAmd1BSZnB+zR3FOjHi3jqz/rHjnH4jQsb3qI8+/8eR6N0Aa3KQdfamknOC7YQw== X-Received: by 2002:a63:1d1d:: with SMTP id d29mr30798324pgd.49.1543385057493; Tue, 27 Nov 2018 22:04:17 -0800 (PST) Received: from hsinyi-z840.tpe.corp.google.com ([2401:fa00:1:10:b852:bd51:9305:4261]) by smtp.gmail.com with ESMTPSA id l85sm6598368pfg.161.2018.11.27.22.04.15 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 27 Nov 2018 22:04:17 -0800 (PST) From: "Hsin-Yi, Wang" To: linux-arm-kernel@lists.infradead.org Subject: [PATCH] usb/mtu3: power down device ip at setup Date: Wed, 28 Nov 2018 14:04:12 +0800 Message-Id: <20181128060412.630-1-hsinyi@chromium.org> X-Mailer: git-send-email 2.18.1 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20181127_220428_382729_995E5F30 X-CRM114-Status: UNSURE ( 9.35 ) X-CRM114-Notice: Please train this message. X-BeenThere: linux-mediatek@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Chunfeng Yun , Greg Kroah-Hartman , linux-usb@vger.kernel.org, linux-mediatek@lists.infradead.org, linux-kernel@vger.kernel.org MIME-Version: 1.0 Sender: "Linux-mediatek" Errors-To: linux-mediatek-bounces+patchwork-linux-mediatek=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP Originally, when dr_mode is USB_DR_MODE_HOST, it didn't power down device ip, so host ip sleep will fail at ssusb_host_disable. Power down device ip at ssusb_host_setup. Signed-off-by: Hsin-Yi, Wang --- drivers/usb/mtu3/mtu3_host.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/drivers/usb/mtu3/mtu3_host.c b/drivers/usb/mtu3/mtu3_host.c index c871b94f3e6f..d17cf43305db 100644 --- a/drivers/usb/mtu3/mtu3_host.c +++ b/drivers/usb/mtu3/mtu3_host.c @@ -192,9 +192,17 @@ int ssusb_host_disable(struct ssusb_mtk *ssusb, bool suspend) static void ssusb_host_setup(struct ssusb_mtk *ssusb) { struct otg_switch_mtk *otg_sx = &ssusb->otg_switch; + void __iomem *ibase = ssusb->ippc_base; host_ports_num_get(ssusb); + /* + * device ip is default power-on in fact + * power down device ip, otherwise ip-sleep will fail + */ + if (ssusb->dr_mode == USB_DR_MODE_HOST) + mtu3_setbits(ibase, U3D_SSUSB_IP_PW_CTRL2, SSUSB_IP_DEV_PDN); + /* * power on host and power on/enable all ports * if support OTG, gadget driver will switch port0 to device mode