linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] usb/mtu3: power down device ip at setup
@ 2018-11-28  6:04 Hsin-Yi, Wang
  2018-11-28  6:22 ` Chunfeng Yun
  2018-11-28  9:29 ` [V2] " Hsin-Yi, Wang
  0 siblings, 2 replies; 11+ messages in thread
From: Hsin-Yi, Wang @ 2018-11-28  6:04 UTC (permalink / raw)
  To: linux-arm-kernel
  Cc: Chunfeng Yun, Greg Kroah-Hartman, linux-usb, linux-mediatek,
	linux-kernel

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
+	 * 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
-- 
2.18.1


^ permalink raw reply related	[flat|nested] 11+ messages in thread

* Re: [PATCH] usb/mtu3: power down device ip at setup
  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  9:29 ` [V2] " Hsin-Yi, Wang
  1 sibling, 2 replies; 11+ messages in thread
From: Chunfeng Yun @ 2018-11-28  6:22 UTC (permalink / raw)
  To: Hsin-Yi, Wang
  Cc: linux-arm-kernel, Greg Kroah-Hartman, linux-usb, linux-mediatek,
	linux-kernel

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);
> +


>  	/*
>  	 * power on host and power on/enable all ports
>  	 * if support OTG, gadget driver will switch port0 to device mode



^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH] usb/mtu3: power down device ip at setup
  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>
  1 sibling, 0 replies; 11+ messages in thread
From: Hsin-Yi Wang @ 2018-11-28  6:59 UTC (permalink / raw)
  To: Chunfeng Yun
  Cc: linux-arm-kernel, Greg Kroah-Hartman, linux-usb, linux-mediatek,
	linux-kernel

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 <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);
> > +
>
>
> >       /*
> >        * power on host and power on/enable all ports
> >        * if support OTG, gadget driver will switch port0 to device mode
>
>

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH] usb/mtu3: power down device ip at setup
       [not found]   ` <CAJMQK-joY4M-=4+XoYAC5SJUie554i_EO=7VgrkJj2JNbbDdxg@mail.gmail.com>
@ 2018-11-28  7:02     ` Chunfeng Yun
  0 siblings, 0 replies; 11+ messages in thread
From: Chunfeng Yun @ 2018-11-28  7:02 UTC (permalink / raw)
  To: Hsin-Yi Wang
  Cc: linux-arm-kernel, Greg Kroah-Hartman, linux-usb, linux-mediatek,
	linux-kernel

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
>         
>         



^ permalink raw reply	[flat|nested] 11+ messages in thread

* [V2] usb/mtu3: power down device ip at setup
  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  9:29 ` Hsin-Yi, Wang
  2018-11-28  9:41   ` Chunfeng Yun
  2018-11-28  9:53   ` [V3] " Hsin-Yi, Wang
  1 sibling, 2 replies; 11+ messages in thread
From: Hsin-Yi, Wang @ 2018-11-28  9:29 UTC (permalink / raw)
  To: linux-arm-kernel
  Cc: Chunfeng Yun, Greg Kroah-Hartman, linux-usb, linux-mediatek,
	linux-kernel

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_plat.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/drivers/usb/mtu3/mtu3_plat.c b/drivers/usb/mtu3/mtu3_plat.c
index 46551f6d16fd..cdef66141e20 100644
--- a/drivers/usb/mtu3/mtu3_plat.c
+++ b/drivers/usb/mtu3/mtu3_plat.c
@@ -200,6 +200,12 @@ static void ssusb_ip_sw_reset(struct ssusb_mtk *ssusb)
 	mtu3_setbits(ssusb->ippc_base, U3D_SSUSB_IP_PW_CTRL0, SSUSB_IP_SW_RST);
 	udelay(1);
 	mtu3_clrbits(ssusb->ippc_base, U3D_SSUSB_IP_PW_CTRL0, SSUSB_IP_SW_RST);
+
+	/*
+	 * device ip is default power-on in fact
+	 * power down device ip, otherwise ip-sleep will fail
+	 */
+	mtu3_setbits(ssusb->ippc_base, U3D_SSUSB_IP_PW_CTRL2, SSUSB_IP_DEV_PDN);
 }
 
 /* ignore the error if the clock does not exist */
-- 
2.18.1


^ permalink raw reply related	[flat|nested] 11+ messages in thread

* Re: [V2] usb/mtu3: power down device ip at setup
  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
  1 sibling, 0 replies; 11+ messages in thread
From: Chunfeng Yun @ 2018-11-28  9:41 UTC (permalink / raw)
  To: Hsin-Yi, Wang
  Cc: linux-arm-kernel, Greg Kroah-Hartman, linux-usb, linux-mediatek,
	linux-kernel

Hi Hsin-Yi,

On Wed, 2018-11-28 at 17:29 +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.
need modify it, not in ssusb_host_setup now
> 
> 
> Signed-off-by: Hsin-Yi, Wang <hsinyi@chromium.org>
> ---
>  drivers/usb/mtu3/mtu3_plat.c | 6 ++++++
>  1 file changed, 6 insertions(+)
> 
> diff --git a/drivers/usb/mtu3/mtu3_plat.c b/drivers/usb/mtu3/mtu3_plat.c
> index 46551f6d16fd..cdef66141e20 100644
> --- a/drivers/usb/mtu3/mtu3_plat.c
> +++ b/drivers/usb/mtu3/mtu3_plat.c
> @@ -200,6 +200,12 @@ static void ssusb_ip_sw_reset(struct ssusb_mtk *ssusb)
>  	mtu3_setbits(ssusb->ippc_base, U3D_SSUSB_IP_PW_CTRL0, SSUSB_IP_SW_RST);
>  	udelay(1);
>  	mtu3_clrbits(ssusb->ippc_base, U3D_SSUSB_IP_PW_CTRL0, SSUSB_IP_SW_RST);
> +
> +	/*
> +	 * device ip is default power-on in fact
change as: device ip maybe poweron in LK/BROM stage before enter kernel
stage;
> +	 * power down device ip, otherwise ip-sleep will fail
power down device ip, otherwise ip-sleep will fail when works as host
only mode
> +	 */
> +	mtu3_setbits(ssusb->ippc_base, U3D_SSUSB_IP_PW_CTRL2, SSUSB_IP_DEV_PDN);
>  }
>  
>  /* ignore the error if the clock does not exist */

Thanks a lot




^ permalink raw reply	[flat|nested] 11+ messages in thread

* [V3] usb/mtu3: power down device ip at setup
  2018-11-28  9:29 ` [V2] " Hsin-Yi, Wang
  2018-11-28  9:41   ` Chunfeng Yun
@ 2018-11-28  9:53   ` Hsin-Yi, Wang
  2018-11-29  1:20     ` Nicolas Boichat
  2018-11-29  3:16     ` [PATCH v4] " Hsin-Yi, Wang
  1 sibling, 2 replies; 11+ messages in thread
From: Hsin-Yi, Wang @ 2018-11-28  9:53 UTC (permalink / raw)
  To: linux-arm-kernel
  Cc: Chunfeng Yun, Greg Kroah-Hartman, linux-usb, linux-mediatek,
	linux-kernel

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_plat.c | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/drivers/usb/mtu3/mtu3_plat.c b/drivers/usb/mtu3/mtu3_plat.c
index 46551f6d16fd..792c420fd4ad 100644
--- a/drivers/usb/mtu3/mtu3_plat.c
+++ b/drivers/usb/mtu3/mtu3_plat.c
@@ -200,6 +200,13 @@ static void ssusb_ip_sw_reset(struct ssusb_mtk *ssusb)
 	mtu3_setbits(ssusb->ippc_base, U3D_SSUSB_IP_PW_CTRL0, SSUSB_IP_SW_RST);
 	udelay(1);
 	mtu3_clrbits(ssusb->ippc_base, U3D_SSUSB_IP_PW_CTRL0, SSUSB_IP_SW_RST);
+
+	/*
+	 * device ip maybe poweron in LK/BROM stage before enter kernel stage;
+	 * power down device ip, otherwise ip-sleep will fail when works as host
+	 * only mode
+	 */
+	mtu3_setbits(ssusb->ippc_base, U3D_SSUSB_IP_PW_CTRL2, SSUSB_IP_DEV_PDN);
 }
 
 /* ignore the error if the clock does not exist */
-- 
2.18.1


^ permalink raw reply related	[flat|nested] 11+ messages in thread

* Re: [V3] usb/mtu3: power down device ip at setup
  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
  1 sibling, 0 replies; 11+ messages in thread
From: Nicolas Boichat @ 2018-11-29  1:20 UTC (permalink / raw)
  To: Hsin-Yi Wang
  Cc: linux-arm Mailing List, chunfeng.yun, Greg Kroah-Hartman,
	linux-usb, linux-mediatek, lkml

FYI, the subject line should be [PATCH v3] (not just [V3])

On Wed, Nov 28, 2018 at 5:54 PM Hsin-Yi, Wang <hsinyi@chromium.org> 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>
> ---

Next time, add a changelog here (e.g. changes from v1: - ...).

>  drivers/usb/mtu3/mtu3_plat.c | 7 +++++++
>  1 file changed, 7 insertions(+)
>
> diff --git a/drivers/usb/mtu3/mtu3_plat.c b/drivers/usb/mtu3/mtu3_plat.c
> index 46551f6d16fd..792c420fd4ad 100644
> --- a/drivers/usb/mtu3/mtu3_plat.c
> +++ b/drivers/usb/mtu3/mtu3_plat.c
> @@ -200,6 +200,13 @@ static void ssusb_ip_sw_reset(struct ssusb_mtk *ssusb)
>         mtu3_setbits(ssusb->ippc_base, U3D_SSUSB_IP_PW_CTRL0, SSUSB_IP_SW_RST);
>         udelay(1);
>         mtu3_clrbits(ssusb->ippc_base, U3D_SSUSB_IP_PW_CTRL0, SSUSB_IP_SW_RST);
> +
> +       /*
> +        * device ip maybe poweron in LK/BROM stage before enter kernel stage;

I'd replace LK with a more generic "firmware" term. e.g.
"device ip may be powered on in firmware/BROM stage before entering
kernel stage;"

> +        * power down device ip, otherwise ip-sleep will fail when works as host

s/works/working/

> +        * only mode
> +        */
> +       mtu3_setbits(ssusb->ippc_base, U3D_SSUSB_IP_PW_CTRL2, SSUSB_IP_DEV_PDN);
>  }
>
>  /* ignore the error if the clock does not exist */
> --
> 2.18.1
>

Thanks.

^ permalink raw reply	[flat|nested] 11+ messages in thread

* [PATCH v4] usb/mtu3: power down device ip at setup
  2018-11-28  9:53   ` [V3] " Hsin-Yi, Wang
  2018-11-29  1:20     ` Nicolas Boichat
@ 2018-11-29  3:16     ` Hsin-Yi, Wang
  2018-11-29  6:26       ` Chunfeng Yun
  1 sibling, 1 reply; 11+ messages in thread
From: Hsin-Yi, Wang @ 2018-11-29  3:16 UTC (permalink / raw)
  To: linux-arm-kernel
  Cc: Chunfeng Yun, Greg Kroah-Hartman, linux-usb, linux-mediatek,
	linux-kernel

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>
---
ChangeLog:
V3->V4:
  *update comment
---
 drivers/usb/mtu3/mtu3_plat.c | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/drivers/usb/mtu3/mtu3_plat.c b/drivers/usb/mtu3/mtu3_plat.c
index 46551f6d16fd..e086630e41a9 100644
--- a/drivers/usb/mtu3/mtu3_plat.c
+++ b/drivers/usb/mtu3/mtu3_plat.c
@@ -200,6 +200,14 @@ static void ssusb_ip_sw_reset(struct ssusb_mtk *ssusb)
 	mtu3_setbits(ssusb->ippc_base, U3D_SSUSB_IP_PW_CTRL0, SSUSB_IP_SW_RST);
 	udelay(1);
 	mtu3_clrbits(ssusb->ippc_base, U3D_SSUSB_IP_PW_CTRL0, SSUSB_IP_SW_RST);
+
+	/*
+	 * device ip may be powered on in firmware/BROM stage before entering
+	 * kernel stage;
+	 * power down device ip, otherwise ip-sleep will fail when working as
+	 * host only mode
+	 */
+	mtu3_setbits(ssusb->ippc_base, U3D_SSUSB_IP_PW_CTRL2, SSUSB_IP_DEV_PDN);
 }
 
 /* ignore the error if the clock does not exist */
-- 
2.18.1


^ permalink raw reply related	[flat|nested] 11+ messages in thread

* Re: [PATCH v4] usb/mtu3: power down device ip at setup
  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
  0 siblings, 1 reply; 11+ messages in thread
From: Chunfeng Yun @ 2018-11-29  6:26 UTC (permalink / raw)
  To: Hsin-Yi, Wang
  Cc: linux-arm-kernel, Greg Kroah-Hartman, linux-usb, linux-mediatek,
	linux-kernel

hi Hsin-Yi,

On Thu, 2018-11-29 at 11:16 +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>
> ---
> ChangeLog:
> V3->V4:
>   *update comment
> ---
>  drivers/usb/mtu3/mtu3_plat.c | 8 ++++++++
>  1 file changed, 8 insertions(+)
> 
> diff --git a/drivers/usb/mtu3/mtu3_plat.c b/drivers/usb/mtu3/mtu3_plat.c
> index 46551f6d16fd..e086630e41a9 100644
> --- a/drivers/usb/mtu3/mtu3_plat.c
> +++ b/drivers/usb/mtu3/mtu3_plat.c
> @@ -200,6 +200,14 @@ static void ssusb_ip_sw_reset(struct ssusb_mtk *ssusb)
>  	mtu3_setbits(ssusb->ippc_base, U3D_SSUSB_IP_PW_CTRL0, SSUSB_IP_SW_RST);
>  	udelay(1);
>  	mtu3_clrbits(ssusb->ippc_base, U3D_SSUSB_IP_PW_CTRL0, SSUSB_IP_SW_RST);
> +
> +	/*
> +	 * device ip may be powered on in firmware/BROM stage before entering
> +	 * kernel stage;
> +	 * power down device ip, otherwise ip-sleep will fail when working as
> +	 * host only mode
> +	 */
> +	mtu3_setbits(ssusb->ippc_base, U3D_SSUSB_IP_PW_CTRL2, SSUSB_IP_DEV_PDN);
>  }
>  
>  /* ignore the error if the clock does not exist */

Acked-by: Chunfeng Yun <chunfeng.yun@mediatek.com>

Thanks a lot




^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH v4] usb/mtu3: power down device ip at setup
  2018-11-29  6:26       ` Chunfeng Yun
@ 2018-11-29  7:50         ` Hsin-Yi Wang
  0 siblings, 0 replies; 11+ messages in thread
From: Hsin-Yi Wang @ 2018-11-29  7:50 UTC (permalink / raw)
  To: chunfeng.yun
  Cc: linux-arm-kernel, gregkh, linux-usb, linux-mediatek, linux-kernel

Thanks!

On Thu, Nov 29, 2018 at 2:26 PM Chunfeng Yun <chunfeng.yun@mediatek.com> wrote:
>
> hi Hsin-Yi,
>
> On Thu, 2018-11-29 at 11:16 +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>
> > ---
> > ChangeLog:
> > V3->V4:
> >   *update comment
> > ---
> >  drivers/usb/mtu3/mtu3_plat.c | 8 ++++++++
> >  1 file changed, 8 insertions(+)
> >
> > diff --git a/drivers/usb/mtu3/mtu3_plat.c b/drivers/usb/mtu3/mtu3_plat.c
> > index 46551f6d16fd..e086630e41a9 100644
> > --- a/drivers/usb/mtu3/mtu3_plat.c
> > +++ b/drivers/usb/mtu3/mtu3_plat.c
> > @@ -200,6 +200,14 @@ static void ssusb_ip_sw_reset(struct ssusb_mtk *ssusb)
> >       mtu3_setbits(ssusb->ippc_base, U3D_SSUSB_IP_PW_CTRL0, SSUSB_IP_SW_RST);
> >       udelay(1);
> >       mtu3_clrbits(ssusb->ippc_base, U3D_SSUSB_IP_PW_CTRL0, SSUSB_IP_SW_RST);
> > +
> > +     /*
> > +      * device ip may be powered on in firmware/BROM stage before entering
> > +      * kernel stage;
> > +      * power down device ip, otherwise ip-sleep will fail when working as
> > +      * host only mode
> > +      */
> > +     mtu3_setbits(ssusb->ippc_base, U3D_SSUSB_IP_PW_CTRL2, SSUSB_IP_DEV_PDN);
> >  }
> >
> >  /* ignore the error if the clock does not exist */
>
> Acked-by: Chunfeng Yun <chunfeng.yun@mediatek.com>
>
> Thanks a lot
>
>
>

^ permalink raw reply	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2018-11-29  7:50 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
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
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

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).