diff mbox series

[06/13] usb: xhci-mtk: support ip-sleep wakeup for MT8183

Message ID 1616382832-28450-6-git-send-email-chunfeng.yun@mediatek.com (mailing list archive)
State Superseded
Headers show
Series [01/13] dt-bindings: usb: mtk-xhci: support property usb2-lpm-disable | expand

Commit Message

Chunfeng Yun (云春峰) March 22, 2021, 3:13 a.m. UTC
Add support ip-sleep wakeup for MT8183, it's similar to MT8173,
and it's also a specific one, but not follow IPM rule.
Due to the index 2 already used by many DTS, it's better to keep
it unchanged for backward compatible, treat specific ones without
following IPM rule as revision 1.x, meanwhile reserve 3~10 for
later revision that follows the IPM rule.

Signed-off-by: Chunfeng Yun <chunfeng.yun@mediatek.com>
---
 drivers/usb/host/xhci-mtk.c | 13 +++++++++++++
 1 file changed, 13 insertions(+)

Comments

Sergey Shtylyov March 22, 2021, 8:54 a.m. UTC | #1
Hello!

On 22.03.2021 6:13, Chunfeng Yun wrote:

> Add support ip-sleep wakeup for MT8183, it's similar to MT8173,
              ^ for

> and it's also a specific one, but not follow IPM rule.

    Following?

> Due to the index 2 already used by many DTS, it's better to keep
> it unchanged for backward compatible, treat specific ones without

    Compatibility.

> following IPM rule as revision 1.x, meanwhile reserve 3~10 for
> later revision that follows the IPM rule.
> 
> Signed-off-by: Chunfeng Yun <chunfeng.yun@mediatek.com>
> ---
>   drivers/usb/host/xhci-mtk.c | 13 +++++++++++++
>   1 file changed, 13 insertions(+)
> 
> diff --git a/drivers/usb/host/xhci-mtk.c b/drivers/usb/host/xhci-mtk.c
> index 09f2ddbfe8b9..8ba1f914cb75 100644
> --- a/drivers/usb/host/xhci-mtk.c
> +++ b/drivers/usb/host/xhci-mtk.c
> @@ -57,12 +57,19 @@
>   #define CTRL_U2_FORCE_PLL_STB	BIT(28)
>   
>   /* usb remote wakeup registers in syscon */
> +
>   /* mt8173 etc */
>   #define PERI_WK_CTRL1	0x4
>   #define WC1_IS_C(x)	(((x) & 0xf) << 26)  /* cycle debounce */
>   #define WC1_IS_EN	BIT(25)
>   #define WC1_IS_P	BIT(6)  /* polarity for ip sleep */
>   
> +/* mt8183 */
> +#define PERI_WK_CTRL0	0x0
> +#define WC0_IS_C(x)	(((x) & 0xf) << 28)  /* cycle debounce */
> +#define WC0_IS_P	BIT(12)	/* polarity */
> +#define WC0_IS_EN	BIT(6)
> +
>   /* mt2712 etc */
>   #define PERI_SSUSB_SPM_CTRL	0x0
>   #define SSC_IP_SLEEP_EN	BIT(4)
> @@ -71,6 +78,7 @@
>   enum ssusb_uwk_vers {
>   	SSUSB_UWK_V1 = 1,
>   	SSUSB_UWK_V2,
> +	SSUSB_UWK_V11 = 11,	/* specific revision 1.1 */

    SSUSB_UWK_V1_1, maybe?

[...]

MBR, Sergei
Chunfeng Yun (云春峰) March 23, 2021, 2:39 a.m. UTC | #2
On Mon, 2021-03-22 at 11:54 +0300, Sergei Shtylyov wrote:
> Hello!
> 
> On 22.03.2021 6:13, Chunfeng Yun wrote:
> 
> > Add support ip-sleep wakeup for MT8183, it's similar to MT8173,
>               ^ for
> 
> > and it's also a specific one, but not follow IPM rule.
> 
>     Following?
Ack
> 
> > Due to the index 2 already used by many DTS, it's better to keep
> > it unchanged for backward compatible, treat specific ones without
> 
>     Compatibility.
Ack
> 
> > following IPM rule as revision 1.x, meanwhile reserve 3~10 for
> > later revision that follows the IPM rule.
> > 
> > Signed-off-by: Chunfeng Yun <chunfeng.yun@mediatek.com>
> > ---
> >   drivers/usb/host/xhci-mtk.c | 13 +++++++++++++
> >   1 file changed, 13 insertions(+)
> > 
> > diff --git a/drivers/usb/host/xhci-mtk.c b/drivers/usb/host/xhci-mtk.c
> > index 09f2ddbfe8b9..8ba1f914cb75 100644
> > --- a/drivers/usb/host/xhci-mtk.c
> > +++ b/drivers/usb/host/xhci-mtk.c
> > @@ -57,12 +57,19 @@
> >   #define CTRL_U2_FORCE_PLL_STB	BIT(28)
> >   
> >   /* usb remote wakeup registers in syscon */
> > +
> >   /* mt8173 etc */
> >   #define PERI_WK_CTRL1	0x4
> >   #define WC1_IS_C(x)	(((x) & 0xf) << 26)  /* cycle debounce */
> >   #define WC1_IS_EN	BIT(25)
> >   #define WC1_IS_P	BIT(6)  /* polarity for ip sleep */
> >   
> > +/* mt8183 */
> > +#define PERI_WK_CTRL0	0x0
> > +#define WC0_IS_C(x)	(((x) & 0xf) << 28)  /* cycle debounce */
> > +#define WC0_IS_P	BIT(12)	/* polarity */
> > +#define WC0_IS_EN	BIT(6)
> > +
> >   /* mt2712 etc */
> >   #define PERI_SSUSB_SPM_CTRL	0x0
> >   #define SSC_IP_SLEEP_EN	BIT(4)
> > @@ -71,6 +78,7 @@
> >   enum ssusb_uwk_vers {
> >   	SSUSB_UWK_V1 = 1,
> >   	SSUSB_UWK_V2,
> > +	SSUSB_UWK_V11 = 11,	/* specific revision 1.1 */
> 
>     SSUSB_UWK_V1_1, maybe?
Good point, will modify it.

Thanks a lot

> 
> [...]
> 
> MBR, Sergei
kernel test robot March 23, 2021, 9:07 a.m. UTC | #3
Hi Chunfeng,

I love your patch! Perhaps something to improve:

[auto build test WARNING on usb/usb-testing]
[also build test WARNING on robh/for-next linus/master v5.12-rc4 next-20210323]
[cannot apply to mediatek/for-next]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch]

url:    https://github.com/0day-ci/linux/commits/Chunfeng-Yun/dt-bindings-usb-mtk-xhci-support-property-usb2-lpm-disable/20210322-111651
base:   https://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb.git usb-testing
config: alpha-allyesconfig (attached as .config)
compiler: alpha-linux-gcc (GCC) 9.3.0
reproduce (this is a W=1 build):
        wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
        chmod +x ~/bin/make.cross
        # https://github.com/0day-ci/linux/commit/519248a4690ce1617790e13220fb52badd09b0c9
        git remote add linux-review https://github.com/0day-ci/linux
        git fetch --no-tags linux-review Chunfeng-Yun/dt-bindings-usb-mtk-xhci-support-property-usb2-lpm-disable/20210322-111651
        git checkout 519248a4690ce1617790e13220fb52badd09b0c9
        # save the attached .config to linux build tree
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-9.3.0 make.cross ARCH=alpha 

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@intel.com>

All warnings (new ones prefixed by >>):

   In file included from include/linux/bits.h:6,
                    from include/linux/bitops.h:6,
                    from include/linux/kernel.h:11,
                    from include/linux/clk.h:13,
                    from drivers/usb/host/xhci-mtk.c:10:
   drivers/usb/host/xhci-mtk.c: In function 'usb_wakeup_ip_sleep_set':
>> include/vdso/bits.h:7:19: warning: conversion from 'long unsigned int' to 'u32' {aka 'unsigned int'} changes value from '18446744073441120320' to '4026536000' [-Woverflow]
       7 | #define BIT(nr)   (UL(1) << (nr))
         |                   ^
   drivers/usb/host/xhci-mtk.c:71:19: note: in expansion of macro 'BIT'
      71 | #define WC0_IS_EN BIT(6)
         |                   ^~~
   drivers/usb/host/xhci-mtk.c:313:9: note: in expansion of macro 'WC0_IS_EN'
     313 |   msk = WC0_IS_EN | WC0_IS_C(0xf) | WC0_IS_P;
         |         ^~~~~~~~~


vim +7 include/vdso/bits.h

3945ff37d2f48d Vincenzo Frascino 2020-03-20  6  
3945ff37d2f48d Vincenzo Frascino 2020-03-20 @7  #define BIT(nr)			(UL(1) << (nr))
3945ff37d2f48d Vincenzo Frascino 2020-03-20  8  

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org
diff mbox series

Patch

diff --git a/drivers/usb/host/xhci-mtk.c b/drivers/usb/host/xhci-mtk.c
index 09f2ddbfe8b9..8ba1f914cb75 100644
--- a/drivers/usb/host/xhci-mtk.c
+++ b/drivers/usb/host/xhci-mtk.c
@@ -57,12 +57,19 @@ 
 #define CTRL_U2_FORCE_PLL_STB	BIT(28)
 
 /* usb remote wakeup registers in syscon */
+
 /* mt8173 etc */
 #define PERI_WK_CTRL1	0x4
 #define WC1_IS_C(x)	(((x) & 0xf) << 26)  /* cycle debounce */
 #define WC1_IS_EN	BIT(25)
 #define WC1_IS_P	BIT(6)  /* polarity for ip sleep */
 
+/* mt8183 */
+#define PERI_WK_CTRL0	0x0
+#define WC0_IS_C(x)	(((x) & 0xf) << 28)  /* cycle debounce */
+#define WC0_IS_P	BIT(12)	/* polarity */
+#define WC0_IS_EN	BIT(6)
+
 /* mt2712 etc */
 #define PERI_SSUSB_SPM_CTRL	0x0
 #define SSC_IP_SLEEP_EN	BIT(4)
@@ -71,6 +78,7 @@ 
 enum ssusb_uwk_vers {
 	SSUSB_UWK_V1 = 1,
 	SSUSB_UWK_V2,
+	SSUSB_UWK_V11 = 11,	/* specific revision 1.1 */
 };
 
 static int xhci_mtk_host_enable(struct xhci_hcd_mtk *mtk)
@@ -300,6 +308,11 @@  static void usb_wakeup_ip_sleep_set(struct xhci_hcd_mtk *mtk, bool enable)
 		msk = WC1_IS_EN | WC1_IS_C(0xf) | WC1_IS_P;
 		val = enable ? (WC1_IS_EN | WC1_IS_C(0x8)) : 0;
 		break;
+	case SSUSB_UWK_V11:
+		reg = mtk->uwk_reg_base + PERI_WK_CTRL0;
+		msk = WC0_IS_EN | WC0_IS_C(0xf) | WC0_IS_P;
+		val = enable ? (WC0_IS_EN | WC0_IS_C(0x8)) : 0;
+		break;
 	case SSUSB_UWK_V2:
 		reg = mtk->uwk_reg_base + PERI_SSUSB_SPM_CTRL;
 		msk = SSC_IP_SLEEP_EN | SSC_SPM_INT_EN;