diff mbox series

[10/13] usb: mtu3: support ip-sleep wakeup for MT8183

Message ID 1616382832-28450-10-git-send-email-chunfeng.yun@mediatek.com (mailing list archive)
State New, archived
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/mtu3/mtu3_host.c | 12 ++++++++++++
 1 file changed, 12 insertions(+)

Comments

Sergei Shtylyov March 22, 2021, 8:57 a.m. UTC | #1
Same comments as to the patch #6.

MBR, Sergei
kernel test robot March 22, 2021, 5:51 p.m. UTC | #2
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-20210322]
[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: ia64-randconfig-r002-20210322 (attached as .config)
compiler: ia64-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/6c0e65b02daf53e661d1804f081cb75fda28b916
        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 6c0e65b02daf53e661d1804f081cb75fda28b916
        # save the attached .config to linux build tree
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-9.3.0 make.cross ARCH=ia64 

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 arch/ia64/include/asm/pgtable.h:154,
                    from include/linux/pgtable.h:6,
                    from arch/ia64/include/asm/uaccess.h:40,
                    from include/linux/uaccess.h:11,
                    from arch/ia64/include/asm/sections.h:11,
                    from include/linux/interrupt.h:20,
                    from arch/ia64/include/asm/hw_irq.h:10,
                    from include/linux/irq.h:589,
                    from drivers/usb/mtu3/mtu3_host.c:12:
   arch/ia64/include/asm/mmu_context.h: In function 'reload_context':
   arch/ia64/include/asm/mmu_context.h:127:41: warning: variable 'old_rr4' set but not used [-Wunused-but-set-variable]
     127 |  unsigned long rr0, rr1, rr2, rr3, rr4, old_rr4;
         |                                         ^~~~~~~
   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/mtu3/mtu3_host.c:10:
   drivers/usb/mtu3/mtu3_host.c: In function 'ssusb_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/mtu3/mtu3_host.c:31:19: note: in expansion of macro 'BIT'
      31 | #define WC0_IS_EN BIT(6)
         |                   ^~~
   drivers/usb/mtu3/mtu3_host.c:60:9: note: in expansion of macro 'WC0_IS_EN'
      60 |   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
Chunfeng Yun (云春峰) March 23, 2021, 2:40 a.m. UTC | #3
On Mon, 2021-03-22 at 11:57 +0300, Sergei Shtylyov wrote:
> Same comments as to the patch #6.
Ok, will check others, thanks a lot

> 
> MBR, Sergei
kernel test robot March 23, 2021, 9:14 a.m. UTC | #4
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]
[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: arm64-randconfig-r031-20210322 (attached as .config)
compiler: clang version 13.0.0 (https://github.com/llvm/llvm-project 14696baaf4c43fe53f738bc292bbe169eed93d5d)
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
        # install arm64 cross compiling tool for clang build
        # apt-get install binutils-aarch64-linux-gnu
        # https://github.com/0day-ci/linux/commit/6c0e65b02daf53e661d1804f081cb75fda28b916
        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 6c0e65b02daf53e661d1804f081cb75fda28b916
        # save the attached .config to linux build tree
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross ARCH=arm64 

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

>> drivers/usb/mtu3/mtu3_host.c:60:35: warning: implicit conversion from 'unsigned long' to 'u32' (aka 'unsigned int') changes value from 18446744073441120320 to 4026536000 [-Wconstant-conversion]
                   msk = WC0_IS_EN | WC0_IS_C(0xf) | WC0_IS_P;
                       ~ ~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~
   drivers/usb/mtu3/mtu3_host.c:61:29: warning: implicit conversion from 'unsigned long' to 'u32' (aka 'unsigned int') changes value from 18446744071562068032 to 2147483712 [-Wconstant-conversion]
                   val = enable ? (WC0_IS_EN | WC0_IS_C(0x8)) : 0;
                       ~           ~~~~~~~~~~^~~~~~~~~~~~~~~
   2 warnings generated.


vim +60 drivers/usb/mtu3/mtu3_host.c

    43	
    44	/*
    45	 * ip-sleep wakeup mode:
    46	 * all clocks can be turn off, but power domain should be kept on
    47	 */
    48	static void ssusb_wakeup_ip_sleep_set(struct ssusb_mtk *ssusb, bool enable)
    49	{
    50		u32 reg, msk, val;
    51	
    52		switch (ssusb->uwk_vers) {
    53		case SSUSB_UWK_V1:
    54			reg = ssusb->uwk_reg_base + PERI_WK_CTRL1;
    55			msk = WC1_IS_EN | WC1_IS_C(0xf) | WC1_IS_P;
    56			val = enable ? (WC1_IS_EN | WC1_IS_C(0x8)) : 0;
    57			break;
    58		case SSUSB_UWK_V11:
    59			reg = ssusb->uwk_reg_base + PERI_WK_CTRL0;
  > 60			msk = WC0_IS_EN | WC0_IS_C(0xf) | WC0_IS_P;
    61			val = enable ? (WC0_IS_EN | WC0_IS_C(0x8)) : 0;
    62			break;
    63		case SSUSB_UWK_V2:
    64			reg = ssusb->uwk_reg_base + PERI_SSUSB_SPM_CTRL;
    65			msk = SSC_IP_SLEEP_EN | SSC_SPM_INT_EN;
    66			val = enable ? msk : 0;
    67			break;
    68		default:
    69			return;
    70		}
    71		regmap_update_bits(ssusb->uwk, reg, msk, val);
    72	}
    73	

---
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/mtu3/mtu3_host.c b/drivers/usb/mtu3/mtu3_host.c
index c871b94f3e6f..e35b17e5f58e 100644
--- a/drivers/usb/mtu3/mtu3_host.c
+++ b/drivers/usb/mtu3/mtu3_host.c
@@ -24,6 +24,12 @@ 
 #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)
@@ -32,6 +38,7 @@ 
 enum ssusb_uwk_vers {
 	SSUSB_UWK_V1 = 1,
 	SSUSB_UWK_V2,
+	SSUSB_UWK_V11 = 11,	/* specific revision 1.1 */
 };
 
 /*
@@ -48,6 +55,11 @@  static void ssusb_wakeup_ip_sleep_set(struct ssusb_mtk *ssusb, 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 = ssusb->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 = ssusb->uwk_reg_base + PERI_SSUSB_SPM_CTRL;
 		msk = SSC_IP_SLEEP_EN | SSC_SPM_INT_EN;