Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp802134imu; Tue, 27 Nov 2018 23:00:37 -0800 (PST) X-Google-Smtp-Source: AFSGD/UJS1KL/gBmK5ewzTGN5b7ZNV3fvHD7deImkaGs92CNRKbXuBFTlfGz9QgL69RI9YuTYf1W X-Received: by 2002:a63:8ac4:: with SMTP id y187mr32321142pgd.446.1543388437517; Tue, 27 Nov 2018 23:00:37 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1543388437; cv=none; d=google.com; s=arc-20160816; b=STwWMxLQt0BvvziV1zxlHAS7RsNe+z40Bn+JdU0ddvCofiHfC9xhSMlITimqhaYVV2 sZeGBGuDExZO+F6CZtM+Q/+CRwnB9vpcoCMxOjB4c2RaDlStusNAQZ3Ao9c2nxedtseh wJk+QkzDrvbRtfNMsyF4oPb4Bv0wxpYgopYwLGxWBoCVrjaIdBoInotVqMrtw9BxAuWt xsfcedizVyRKM+kdnQTh/n1gK/+Eyr/2rk91pnqt3kKLBGAi17gMgpx1juxmbnKaQ787 Z9BiFTBC/mmmtcGvAT5j0Gu2GXtParRSATz04XAQaqHgbtdYWAX3IbY9ftlS1UYLgtHJ LOFg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature; bh=9A5w39wUOKS/Zre1YyUran8Plh9y0s6bu15KiaJKdTI=; b=lZkvGSOwBxm4tw6YsSQg9tRBehxnKiMOwIs5okYVogtbUrPZPxvJGtQz8mhsGpR+Vz /r0LtEs3TJz2TbywUJEw5zK+GaL80/mfV2dFAdaXrFfXdM3eb5zT92msGADeEWdie2Ar p87H9iBZE5PZAlxMPs746pyRDtW6pENtHpvti9V8R/rQdB+R0X6IIcXsmed+4w8xOwMj ZeuLCTNWC1FQzFN5umrl0/yt3fqRQwwvBS1GF+N+QfOBvKCyPw0NIjLMe7DePwChZPzX XjyrD9par/dALcVsXuv9UaRoxfcCyu3oB1Q7OJcbJ7TJnmWRlw4MYUJrTDSNrQvd2Kmp Cr6A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=Qgsl6Is+; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id q8si6173723pgc.580.2018.11.27.23.00.22; Tue, 27 Nov 2018 23:00:37 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=Qgsl6Is+; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727339AbeK1SAV (ORCPT + 99 others); Wed, 28 Nov 2018 13:00:21 -0500 Received: from mail-qk1-f193.google.com ([209.85.222.193]:43710 "EHLO mail-qk1-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727230AbeK1SAV (ORCPT ); Wed, 28 Nov 2018 13:00:21 -0500 Received: by mail-qk1-f193.google.com with SMTP id r71so16188023qkr.10 for ; Tue, 27 Nov 2018 22:59:45 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=9A5w39wUOKS/Zre1YyUran8Plh9y0s6bu15KiaJKdTI=; b=Qgsl6Is+XwahKfLaTCulaHl6BeVEXpzaj1ojp16ehmIl6hS4QUvwrl/fBznl5E5UaL K+UfJfKp3GUilomgZDAsYF3TquqYW7lul1GHQc7Kh6DT5Q46x1DMV7Wxk7nbQkAfUFrn r+wCFz5Y6AN8RmMglfHA7uHc3Z9uHwKPXiX9k= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=9A5w39wUOKS/Zre1YyUran8Plh9y0s6bu15KiaJKdTI=; b=JxQkU2NCudCgDg71JAvc8TShxQBC4rYa2m6+QlkGA30pRSIeFSkme0o6vFmkKnQZYt uSoLE+UuoyIR2ZpWu038VCWJnstE6AjCPnBR2rLU7j9K5mhpVlBgGe9fXr+l9814JoNy nUdiHxv+8oVI9Hly/5xoakiBaowjiELWx+WHT0v8pKDfszsYSngJ+FxwVxUk96YmQnpN wnOGcWyiH6l8BKJzt5hZNkpyAceCralMseqEi09EzVV9AHtLit/b78EyBt9V8pM2fusy IBXTetrV7Po0yhJlMP76HxvEU776aeC01EgKIavYUWjsslAPLwjf59lVb03uqQ1bmqek UfKQ== X-Gm-Message-State: AA+aEWZ8imL1bWE7ANUCgeDSet8BNUwy0VdWphB+3ZnguzZ0Asejk2Hs 0iu6kSvUMX/1LYVhGx1a+D2VwbAkcTCV+cvjGfHwRGIPSyywnw== X-Received: by 2002:a37:11dd:: with SMTP id 90mr32787483qkr.212.1543388384772; Tue, 27 Nov 2018 22:59:44 -0800 (PST) MIME-Version: 1.0 References: <20181128060412.630-1-hsinyi@chromium.org> <1543386149.32173.87.camel@mhfsdcap03> In-Reply-To: <1543386149.32173.87.camel@mhfsdcap03> From: Hsin-Yi Wang Date: Wed, 28 Nov 2018 14:59:33 +0800 Message-ID: Subject: Re: [PATCH] usb/mtu3: power down device ip at setup To: Chunfeng Yun Cc: linux-arm-kernel@lists.infradead.org, Greg Kroah-Hartman , linux-usb@vger.kernel.org, linux-mediatek@lists.infradead.org, linux-kernel@vger.kernel.org Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Chunfeng, On mt8183, We found `ip sleep failed!!!` with powerd_dbus_suspend. Referenced from xhci, it power down device ip at xhci_mtk_ssusb_config(). Also if dr_mode is PERIPHERAL and OTG, they both power down device ip at ssusb_gadget_init(). On Wed, Nov 28, 2018 at 2:22 PM Chunfeng Yun wrote: > > Hi Hsin-Yi, > > On Wed, 2018-11-28 at 14:04 +0800, Hsin-Yi, Wang wrote: > > 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 > The device ip is power-off by default, no need power down it here. > > On which platform did you encounter the issue? > > > + * 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 > >