linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
From: chunfeng.yun@mediatek.com (Chunfeng Yun)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH] usb/mtu3: power down device ip at setup
Date: Wed, 28 Nov 2018 15:02:56 +0800	[thread overview]
Message-ID: <1543388576.32173.106.camel@mhfsdcap03> (raw)
In-Reply-To: <CAJMQK-joY4M-=4+XoYAC5SJUie554i_EO=7VgrkJj2JNbbDdxg@mail.gmail.com>

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
> <chunfeng.yun@mediatek.com> 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 <hsinyi@chromium.org>
>         > ---
>         >  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
>         
>         

  parent reply	other threads:[~2018-11-28  7:02 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-11-28  6:04 [PATCH] usb/mtu3: power down device ip at setup Hsin-Yi, Wang
2018-11-28  6:22 ` Chunfeng Yun
2018-11-28  6:59   ` Hsin-Yi Wang
     [not found]   ` <CAJMQK-joY4M-=4+XoYAC5SJUie554i_EO=7VgrkJj2JNbbDdxg@mail.gmail.com>
2018-11-28  7:02     ` Chunfeng Yun [this message]
2018-11-28  9:29 ` [V2] " Hsin-Yi, Wang
2018-11-28  9:41   ` Chunfeng Yun
2018-11-28  9:53   ` [V3] " Hsin-Yi, Wang
2018-11-29  1:20     ` Nicolas Boichat
2018-11-29  3:16     ` [PATCH v4] " Hsin-Yi, Wang
2018-11-29  6:26       ` Chunfeng Yun
2018-11-29  7:50         ` Hsin-Yi Wang

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1543388576.32173.106.camel@mhfsdcap03 \
    --to=chunfeng.yun@mediatek.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).