Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp805440imu; Tue, 27 Nov 2018 23:04:32 -0800 (PST) X-Google-Smtp-Source: AJdET5eke8liGSuu8/06UyY5IN8sYlZbI4Episyyyr8tYJQCjAlla0lIclnkBoVeixvSC2kYZfHo X-Received: by 2002:a62:8d4f:: with SMTP id z76mr37487740pfd.2.1543388672047; Tue, 27 Nov 2018 23:04:32 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1543388672; cv=none; d=google.com; s=arc-20160816; b=p9kbYRTuFnJ2FDdIH+C25fIYyx1St1If4Mu2D51wjbr8auOiD3C3ljNB9Dooe33DZJ wcmZ09Ze5olMZudzOm9N6Q++WJ3WacOm4LrArZ0j6/sZwR0ItIKvjl9TG1jOZZwKTevt N5mrHiQHl5PID3lJ9IvSD/SDAS24HkY1QoliZ5kOQFgo2PhBiB5RSkI8Dp4l8MODhra2 /ReFY2INyn+0TzA6lzs5KbORC3+MftU9zeQjQ7f1QKaJYfMhnyxak66+GDh5/zkV+RCf G7n4menGgz1u1hMp1LdPgxYGof46w6/rS9fm/f3J+xfyxDIHkj7bCHOLgIB+xsmga4ii xASA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:content-transfer-encoding :references:in-reply-to:date:cc:to:from:subject:message-id; bh=DDEPv/V1MO38UfwdDBlIrWYxRWkWAt+JrwqapefhQA0=; b=tWZTTbfxj74IlcxUOhCxhRKKfqHELroZJeR12b5TrD+2IuVwp/bzJFRfUNGTosf3x/ FbCLa2XSaphULRGU5xBCng3aFnnsxJpZ5/EUDF5l/RYAik1NDxdmKD++hqOsctNUY31M dj2e+YEKW/BJF7vztgwSYVY4nm1qXg85MzbzgUpW60yD6xaT3A3F1sd7Ow8xN577Mtf9 VoFTXYHlm0en5q2veu7c+JdLBAZTirwHBUUZ6VstS5R4V4W7PFa0S9fBXTO3WA2Qb/PA Xw3BlpRU/pqNH25wQjpjfSDZZNMz2QViJTBXI/OBBR9Z2jjwXcohr1KHNb18eXvD+3IJ gVTA== ARC-Authentication-Results: i=1; mx.google.com; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 19si6417113pgq.215.2018.11.27.23.04.16; Tue, 27 Nov 2018 23:04:32 -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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727616AbeK1SDv (ORCPT + 99 others); Wed, 28 Nov 2018 13:03:51 -0500 Received: from mailgw02.mediatek.com ([1.203.163.81]:5087 "EHLO mailgw02.mediatek.com" rhost-flags-OK-FAIL-OK-FAIL) by vger.kernel.org with ESMTP id S1727107AbeK1SDv (ORCPT ); Wed, 28 Nov 2018 13:03:51 -0500 X-UUID: ed5a464ecd8f43c1a5a7976e68a9049c-20181128 X-UUID: ed5a464ecd8f43c1a5a7976e68a9049c-20181128 Received: from mtkcas35.mediatek.inc [(172.27.4.250)] by mailgw02.mediatek.com (envelope-from ) (mailgw01.mediatek.com ESMTP with TLS) with ESMTP id 1809863021; Wed, 28 Nov 2018 15:02:57 +0800 Received: from MTKCAS36.mediatek.inc (172.27.4.186) by MTKMBS33N1.mediatek.inc (172.27.4.75) with Microsoft SMTP Server (TLS) id 15.0.1395.4; Wed, 28 Nov 2018 15:02:56 +0800 Received: from [10.17.3.153] (10.17.3.153) by MTKCAS36.mediatek.inc (172.27.4.170) with Microsoft SMTP Server id 15.0.1395.4 via Frontend Transport; Wed, 28 Nov 2018 15:02:56 +0800 Message-ID: <1543388576.32173.106.camel@mhfsdcap03> Subject: Re: [PATCH] usb/mtu3: power down device ip at setup From: Chunfeng Yun To: Hsin-Yi Wang CC: , Greg Kroah-Hartman , , , Date: Wed, 28 Nov 2018 15:02:56 +0800 In-Reply-To: References: <20181128060412.630-1-hsinyi@chromium.org> <1543386149.32173.87.camel@mhfsdcap03> Content-Type: text/plain; charset="UTF-8" X-Mailer: Evolution 3.2.3-0ubuntu6 Content-Transfer-Encoding: 7bit MIME-Version: 1.0 X-MTK: N Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, 2018-11-28 at 14:26 +0800, Hsin-Yi Wang wrote: > Hi Chunfeng, > On mt8183, We found `ip sleep failed!!!` with powerd_dbus_suspend. Did you enable usb device mode in BROM or LK stage? e.g. download image by fastboot / flashtool > Referenced from xhci, it also power down device ip at > xhci_mtk_ssusb_config(). It may happen when user downloads images by usb device in LK/BROM stage, but not disable it before enter kernel stage. > Also if dr_mode is PERIPHERAL and OTG, they both power down device ip > at ssusb_gadget_init(). Yes, it tries to save power; > > 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); > > + Could you please put it in ssusb_ip_sw_reset(), after ip reset, in mtu3_plat.c, if it fix the issue? > > /* > > * power on host and power on/enable all ports > > * if support OTG, gadget driver will switch port0 to > device mode > >