linux-usb.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] usb: dwc2: Enable RPi in ACPI mode
@ 2021-04-08  3:21 jlinton
  2021-04-08  6:03 ` kernel test robot
  2021-04-09  2:55 ` kernel test robot
  0 siblings, 2 replies; 3+ messages in thread
From: jlinton @ 2021-04-08  3:21 UTC (permalink / raw)
  To: linux-usb; +Cc: gregkh, hminas, linux-kernel, Jeremy Linton

From: Jeremy Linton <jeremy.linton@arm.com>

The dwc2 driver has everything we need to run
in ACPI mode except for the ACPI module device table
boilerplate. With that added and identified as "BCM2848",
an id in use by other OSs for this device, the dw2
controller on the BCM2711 will work.

Signed-off-by: Jeremy Linton <jeremy.linton@arm.com>
---
 drivers/usb/dwc2/core.h     |  2 ++
 drivers/usb/dwc2/params.c   | 14 ++++++++++++++
 drivers/usb/dwc2/platform.c |  1 +
 3 files changed, 17 insertions(+)

diff --git a/drivers/usb/dwc2/core.h b/drivers/usb/dwc2/core.h
index 7161344c6522..defc6034af49 100644
--- a/drivers/usb/dwc2/core.h
+++ b/drivers/usb/dwc2/core.h
@@ -38,6 +38,7 @@
 #ifndef __DWC2_CORE_H__
 #define __DWC2_CORE_H__
 
+#include <linux/acpi.h>
 #include <linux/phy/phy.h>
 #include <linux/regulator/consumer.h>
 #include <linux/usb/gadget.h>
@@ -1339,6 +1340,7 @@ irqreturn_t dwc2_handle_common_intr(int irq, void *dev);
 
 /* The device ID match table */
 extern const struct of_device_id dwc2_of_match_table[];
+extern const struct acpi_device_id dwc2_acpi_match[];
 
 int dwc2_lowlevel_hw_enable(struct dwc2_hsotg *hsotg);
 int dwc2_lowlevel_hw_disable(struct dwc2_hsotg *hsotg);
diff --git a/drivers/usb/dwc2/params.c b/drivers/usb/dwc2/params.c
index 92df3d620f7d..127878a0a397 100644
--- a/drivers/usb/dwc2/params.c
+++ b/drivers/usb/dwc2/params.c
@@ -232,6 +232,12 @@ const struct of_device_id dwc2_of_match_table[] = {
 };
 MODULE_DEVICE_TABLE(of, dwc2_of_match_table);
 
+const struct acpi_device_id dwc2_acpi_match[] = {
+	{ "BCM2848", dwc2_set_bcm_params },
+	{ },
+};
+MODULE_DEVICE_TABLE(acpi, dwc2_acpi_match);
+
 static void dwc2_set_param_otg_cap(struct dwc2_hsotg *hsotg)
 {
 	u8 val;
@@ -878,6 +884,14 @@ int dwc2_init_params(struct dwc2_hsotg *hsotg)
 	if (match && match->data) {
 		set_params = match->data;
 		set_params(hsotg);
+	} else {
+		struct acpi_device_id *amatch;
+
+		amatch = acpi_match_device(dwc2_acpi_match, hsotg->dev);
+		if (amatch && amatch->driver_data) {
+			set_params = amatch->driver_data;
+			set_params(hsotg);
+		}
 	}
 
 	dwc2_check_params(hsotg);
diff --git a/drivers/usb/dwc2/platform.c b/drivers/usb/dwc2/platform.c
index 5f18acac7406..53fc6bc3ed1a 100644
--- a/drivers/usb/dwc2/platform.c
+++ b/drivers/usb/dwc2/platform.c
@@ -734,6 +734,7 @@ static struct platform_driver dwc2_platform_driver = {
 	.driver = {
 		.name = dwc2_driver_name,
 		.of_match_table = dwc2_of_match_table,
+		.acpi_match_table = ACPI_PTR(dwc2_acpi_match),
 		.pm = &dwc2_dev_pm_ops,
 	},
 	.probe = dwc2_driver_probe,
-- 
2.26.2


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

* Re: [PATCH] usb: dwc2: Enable RPi in ACPI mode
  2021-04-08  3:21 [PATCH] usb: dwc2: Enable RPi in ACPI mode jlinton
@ 2021-04-08  6:03 ` kernel test robot
  2021-04-09  2:55 ` kernel test robot
  1 sibling, 0 replies; 3+ messages in thread
From: kernel test robot @ 2021-04-08  6:03 UTC (permalink / raw)
  To: jlinton, linux-usb
  Cc: kbuild-all, gregkh, hminas, linux-kernel, Jeremy Linton

[-- Attachment #1: Type: text/plain, Size: 2762 bytes --]

Hi jlinton,

Thank you for the patch! Perhaps something to improve:

[auto build test WARNING on usb/usb-testing]
[also build test WARNING on peter.chen-usb/for-usb-next balbi-usb/testing/next v5.12-rc6 next-20210407]
[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/jlinton/usb-dwc2-Enable-RPi-in-ACPI-mode/20210408-112405
base:   https://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb.git usb-testing
config: parisc-randconfig-r005-20210407 (attached as .config)
compiler: hppa-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/09dcd4fc8628ed453434dee372e69ec8e5d3d338
        git remote add linux-review https://github.com/0day-ci/linux
        git fetch --no-tags linux-review jlinton/usb-dwc2-Enable-RPi-in-ACPI-mode/20210408-112405
        git checkout 09dcd4fc8628ed453434dee372e69ec8e5d3d338
        # save the attached .config to linux build tree
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-9.3.0 make.cross ARCH=parisc 

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/dwc2/params.c:236:15: warning: initialization of 'long unsigned int' from 'void (*)(struct dwc2_hsotg *)' makes integer from pointer without a cast [-Wint-conversion]
     236 |  { "BCM2848", dwc2_set_bcm_params },
         |               ^~~~~~~~~~~~~~~~~~~
   drivers/usb/dwc2/params.c:236:15: note: (near initialization for 'dwc2_acpi_match[0].driver_data')
   drivers/usb/dwc2/params.c: In function 'dwc2_init_params':
>> drivers/usb/dwc2/params.c:890:10: warning: assignment discards 'const' qualifier from pointer target type [-Wdiscarded-qualifiers]
     890 |   amatch = acpi_match_device(dwc2_acpi_match, hsotg->dev);
         |          ^
>> drivers/usb/dwc2/params.c:892:15: warning: assignment to 'void (*)(struct dwc2_hsotg *)' from 'kernel_ulong_t' {aka 'long unsigned int'} makes pointer from integer without a cast [-Wint-conversion]
     892 |    set_params = amatch->driver_data;
         |               ^


vim +236 drivers/usb/dwc2/params.c

   234	
   235	const struct acpi_device_id dwc2_acpi_match[] = {
 > 236		{ "BCM2848", dwc2_set_bcm_params },
   237		{ },
   238	};
   239	MODULE_DEVICE_TABLE(acpi, dwc2_acpi_match);
   240	

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

[-- Attachment #2: .config.gz --]
[-- Type: application/gzip, Size: 38049 bytes --]

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

* Re: [PATCH] usb: dwc2: Enable RPi in ACPI mode
  2021-04-08  3:21 [PATCH] usb: dwc2: Enable RPi in ACPI mode jlinton
  2021-04-08  6:03 ` kernel test robot
@ 2021-04-09  2:55 ` kernel test robot
  1 sibling, 0 replies; 3+ messages in thread
From: kernel test robot @ 2021-04-09  2:55 UTC (permalink / raw)
  To: jlinton, linux-usb
  Cc: kbuild-all, clang-built-linux, gregkh, hminas, linux-kernel,
	Jeremy Linton

[-- Attachment #1: Type: text/plain, Size: 3017 bytes --]

Hi jlinton,

Thank you for the patch! Perhaps something to improve:

[auto build test WARNING on usb/usb-testing]
[also build test WARNING on peter.chen-usb/for-usb-next balbi-usb/testing/next v5.12-rc6 next-20210408]
[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/jlinton/usb-dwc2-Enable-RPi-in-ACPI-mode/20210408-112405
base:   https://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb.git usb-testing
config: x86_64-randconfig-a014-20210408 (attached as .config)
compiler: clang version 13.0.0 (https://github.com/llvm/llvm-project 56ea2e2fdd691136d5e6631fa0e447173694b82c)
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 x86_64 cross compiling tool for clang build
        # apt-get install binutils-x86-64-linux-gnu
        # https://github.com/0day-ci/linux/commit/09dcd4fc8628ed453434dee372e69ec8e5d3d338
        git remote add linux-review https://github.com/0day-ci/linux
        git fetch --no-tags linux-review jlinton/usb-dwc2-Enable-RPi-in-ACPI-mode/20210408-112405
        git checkout 09dcd4fc8628ed453434dee372e69ec8e5d3d338
        # save the attached .config to linux build tree
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross ARCH=x86_64 

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/dwc2/params.c:236:15: warning: incompatible pointer to integer conversion initializing 'kernel_ulong_t' (aka 'unsigned long') with an expression of type 'void (struct dwc2_hsotg *)' [-Wint-conversion]
           { "BCM2848", dwc2_set_bcm_params },
                        ^~~~~~~~~~~~~~~~~~~
   drivers/usb/dwc2/params.c:890:10: error: assigning to 'struct acpi_device_id *' from 'const struct acpi_device_id *' discards qualifiers [-Werror,-Wincompatible-pointer-types-discards-qualifiers]
                   amatch = acpi_match_device(dwc2_acpi_match, hsotg->dev);
                          ^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>> drivers/usb/dwc2/params.c:892:15: warning: incompatible integer to pointer conversion assigning to 'void (*)(struct dwc2_hsotg *)' from 'kernel_ulong_t' (aka 'unsigned long') [-Wint-conversion]
                           set_params = amatch->driver_data;
                                      ^ ~~~~~~~~~~~~~~~~~~~
   2 warnings and 1 error generated.


vim +236 drivers/usb/dwc2/params.c

   234	
   235	const struct acpi_device_id dwc2_acpi_match[] = {
 > 236		{ "BCM2848", dwc2_set_bcm_params },
   237		{ },
   238	};
   239	MODULE_DEVICE_TABLE(acpi, dwc2_acpi_match);
   240	

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

[-- Attachment #2: .config.gz --]
[-- Type: application/gzip, Size: 46850 bytes --]

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

end of thread, other threads:[~2021-04-09  2:55 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-04-08  3:21 [PATCH] usb: dwc2: Enable RPi in ACPI mode jlinton
2021-04-08  6:03 ` kernel test robot
2021-04-09  2:55 ` kernel test robot

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