public inbox for linux-riscv@lists.infradead.org
 help / color / mirror / Atom feed
* [PATCH v2] usb: misc: onboard_usb_dev: introduce new config symbol for usb5744 SMBus support
@ 2024-09-28 13:26 Radhey Shyam Pandey
  2024-10-04 13:36 ` Greg KH
  0 siblings, 1 reply; 3+ messages in thread
From: Radhey Shyam Pandey @ 2024-09-28 13:26 UTC (permalink / raw)
  To: gregkh, mka, paul.walmsley, palmer, aou, wentong.wu, sakari.ailus,
	javier.carrasco, matthias
  Cc: linux-usb, linux-kernel, linux-riscv, git, Radhey Shyam Pandey

Introduce new kernel config symbol for Microchip usb5744 SMBus programming
support. Since usb5744 i2c initialization routine uses i2c SMBus APIs these
APIs should only be invoked when kernel has I2C support. This new kernel
config describes the dependency on I2C kernel support and fix the below
build issues when USB_ONBOARD_DEV=y and CONFIG_I2C=m.

riscv64-linux-ld: drivers/usb/misc/onboard_usb_dev.o:
undefined reference to `i2c_find_device_by_fwnode'
drivers/usb/misc/onboard_usb_dev.c:408:(.text+0xb24): undefined
reference to `i2c_smbus_write_block_data'
<snip>

Parsing of the i2c-bus bus handle is not put under usb5744 kernel config
check as the intention is to report an error when DT is configured for
usb5744 SMBus support and kernel has USB_ONBOARD_DEV_USB5744 disabled.

Fixes: 6782311d04df ("usb: misc: onboard_usb_dev: add Microchip usb5744 SMBus programming support")
Signed-off-by: Radhey Shyam Pandey <radhey.shyam.pandey@amd.com>
Suggested-by: Matthias Kaehlcke <matthias@kaehlcke.net>
Reported-by: kernel test robot <lkp@intel.com>
Closes: https://lore.kernel.org/oe-kbuild-all/202409140539.3Axwv38m-lkp@intel.com/
Acked-by: Matthias Kaehlcke <matthias@kaehlcke.net>
---
Changes for v2:
- As suggested by Greg drop default 'y' and instead describe the
  constraints in the kconfig description.
---
 drivers/usb/misc/Kconfig           | 12 ++++++++++++
 drivers/usb/misc/onboard_usb_dev.c |  6 ++++--
 2 files changed, 16 insertions(+), 2 deletions(-)

diff --git a/drivers/usb/misc/Kconfig b/drivers/usb/misc/Kconfig
index 50b86d531701..6497c4e81e95 100644
--- a/drivers/usb/misc/Kconfig
+++ b/drivers/usb/misc/Kconfig
@@ -331,3 +331,15 @@ config USB_ONBOARD_DEV
 	  this config will enable the driver and it will automatically
 	  match the state of the USB subsystem. If this driver is a
 	  module it will be called onboard_usb_dev.
+
+config USB_ONBOARD_DEV_USB5744
+	bool "Onboard USB Microchip usb5744 hub with SMBus support"
+	depends on (USB_ONBOARD_DEV && I2C=y) || (USB_ONBOARD_DEV=m && I2C=m)
+	help
+	  Say Y here if you want to support onboard USB Microchip usb5744
+	  hub that requires SMBus initialization.
+
+	  This options enables usb5744 i2c default initialization sequence
+	  during hub start-up configuration stage. It is must to enable this
+	  option on AMD Kria KR260 Robotics Starter Kit as this hub is
+	  connected to USB-SD converter which mounts the root filesystem.
diff --git a/drivers/usb/misc/onboard_usb_dev.c b/drivers/usb/misc/onboard_usb_dev.c
index 560591e02d6a..75dfdca04ff1 100644
--- a/drivers/usb/misc/onboard_usb_dev.c
+++ b/drivers/usb/misc/onboard_usb_dev.c
@@ -311,7 +311,7 @@ static void onboard_dev_attach_usb_driver(struct work_struct *work)
 
 static int onboard_dev_5744_i2c_init(struct i2c_client *client)
 {
-#if IS_ENABLED(CONFIG_I2C)
+#if IS_ENABLED(CONFIG_USB_ONBOARD_DEV_USB5744)
 	struct device *dev = &client->dev;
 	int ret;
 
@@ -394,9 +394,11 @@ static int onboard_dev_probe(struct platform_device *pdev)
 
 	i2c_node = of_parse_phandle(pdev->dev.of_node, "i2c-bus", 0);
 	if (i2c_node) {
-		struct i2c_client *client;
+		struct i2c_client *client = NULL;
 
+#if IS_ENABLED(CONFIG_USB_ONBOARD_DEV_USB5744)
 		client = of_find_i2c_device_by_node(i2c_node);
+#endif
 		of_node_put(i2c_node);
 
 		if (!client) {

base-commit: 40e0c9d414f57d450e3ad03c12765e797fc3fede
-- 
2.34.1


_______________________________________________
linux-riscv mailing list
linux-riscv@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-riscv

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

* Re: [PATCH v2] usb: misc: onboard_usb_dev: introduce new config symbol for usb5744 SMBus support
  2024-09-28 13:26 [PATCH v2] usb: misc: onboard_usb_dev: introduce new config symbol for usb5744 SMBus support Radhey Shyam Pandey
@ 2024-10-04 13:36 ` Greg KH
  2024-10-04 13:37   ` Greg KH
  0 siblings, 1 reply; 3+ messages in thread
From: Greg KH @ 2024-10-04 13:36 UTC (permalink / raw)
  To: Radhey Shyam Pandey
  Cc: mka, paul.walmsley, palmer, aou, wentong.wu, sakari.ailus,
	javier.carrasco, matthias, linux-usb, linux-kernel, linux-riscv,
	git

On Sat, Sep 28, 2024 at 06:56:32PM +0530, Radhey Shyam Pandey wrote:
> Introduce new kernel config symbol for Microchip usb5744 SMBus programming
> support. Since usb5744 i2c initialization routine uses i2c SMBus APIs these
> APIs should only be invoked when kernel has I2C support. This new kernel
> config describes the dependency on I2C kernel support and fix the below
> build issues when USB_ONBOARD_DEV=y and CONFIG_I2C=m.
> 
> riscv64-linux-ld: drivers/usb/misc/onboard_usb_dev.o:
> undefined reference to `i2c_find_device_by_fwnode'
> drivers/usb/misc/onboard_usb_dev.c:408:(.text+0xb24): undefined
> reference to `i2c_smbus_write_block_data'
> <snip>
> 
> Parsing of the i2c-bus bus handle is not put under usb5744 kernel config
> check as the intention is to report an error when DT is configured for
> usb5744 SMBus support and kernel has USB_ONBOARD_DEV_USB5744 disabled.
> 
> Fixes: 6782311d04df ("usb: misc: onboard_usb_dev: add Microchip usb5744 SMBus programming support")
> Signed-off-by: Radhey Shyam Pandey <radhey.shyam.pandey@amd.com>
> Suggested-by: Matthias Kaehlcke <matthias@kaehlcke.net>
> Reported-by: kernel test robot <lkp@intel.com>
> Closes: https://lore.kernel.org/oe-kbuild-all/202409140539.3Axwv38m-lkp@intel.com/
> Acked-by: Matthias Kaehlcke <matthias@kaehlcke.net>
> ---
> Changes for v2:
> - As suggested by Greg drop default 'y' and instead describe the
>   constraints in the kconfig description.
> ---
>  drivers/usb/misc/Kconfig           | 12 ++++++++++++
>  drivers/usb/misc/onboard_usb_dev.c |  6 ++++--
>  2 files changed, 16 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/usb/misc/Kconfig b/drivers/usb/misc/Kconfig
> index 50b86d531701..6497c4e81e95 100644
> --- a/drivers/usb/misc/Kconfig
> +++ b/drivers/usb/misc/Kconfig
> @@ -331,3 +331,15 @@ config USB_ONBOARD_DEV
>  	  this config will enable the driver and it will automatically
>  	  match the state of the USB subsystem. If this driver is a
>  	  module it will be called onboard_usb_dev.
> +
> +config USB_ONBOARD_DEV_USB5744
> +	bool "Onboard USB Microchip usb5744 hub with SMBus support"
> +	depends on (USB_ONBOARD_DEV && I2C=y) || (USB_ONBOARD_DEV=m && I2C=m)
> +	help
> +	  Say Y here if you want to support onboard USB Microchip usb5744
> +	  hub that requires SMBus initialization.
> +
> +	  This options enables usb5744 i2c default initialization sequence
> +	  during hub start-up configuration stage. It is must to enable this
> +	  option on AMD Kria KR260 Robotics Starter Kit as this hub is
> +	  connected to USB-SD converter which mounts the root filesystem.

With this applied I get the following build warning:


WARNING: unmet direct dependencies detected for MODVERSIONS
  Depends on [n]: MODULES [=y] && !COMPILE_TEST [=y]
  Selected by [y]:
  - RANDSTRUCT_FULL [=y] && (CC_HAS_RANDSTRUCT [=n] || GCC_PLUGINS [=y]) && MODULES [=y]

WARNING: unmet direct dependencies detected for MODVERSIONS
  Depends on [n]: MODULES [=y] && !COMPILE_TEST [=y]
  Selected by [y]:
  - RANDSTRUCT_FULL [=y] && (CC_HAS_RANDSTRUCT [=n] || GCC_PLUGINS [=y]) && MODULES [=y]

WARNING: unmet direct dependencies detected for MODVERSIONS
  Depends on [n]: MODULES [=y] && !COMPILE_TEST [=y]
  Selected by [y]:
  - RANDSTRUCT_FULL [=y] && (CC_HAS_RANDSTRUCT [=n] || GCC_PLUGINS [=y]) && MODULES [=y]


Which is odd.

It's one extra "unmet direct ..." message than normal for now, so
something in this commit is not working properly.

Can you fix this up and send a new version?

thanks,

greg k-h

_______________________________________________
linux-riscv mailing list
linux-riscv@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-riscv

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

* Re: [PATCH v2] usb: misc: onboard_usb_dev: introduce new config symbol for usb5744 SMBus support
  2024-10-04 13:36 ` Greg KH
@ 2024-10-04 13:37   ` Greg KH
  0 siblings, 0 replies; 3+ messages in thread
From: Greg KH @ 2024-10-04 13:37 UTC (permalink / raw)
  To: Radhey Shyam Pandey
  Cc: mka, paul.walmsley, palmer, aou, wentong.wu, sakari.ailus,
	javier.carrasco, matthias, linux-usb, linux-kernel, linux-riscv,
	git

On Fri, Oct 04, 2024 at 03:36:11PM +0200, Greg KH wrote:
> On Sat, Sep 28, 2024 at 06:56:32PM +0530, Radhey Shyam Pandey wrote:
> > Introduce new kernel config symbol for Microchip usb5744 SMBus programming
> > support. Since usb5744 i2c initialization routine uses i2c SMBus APIs these
> > APIs should only be invoked when kernel has I2C support. This new kernel
> > config describes the dependency on I2C kernel support and fix the below
> > build issues when USB_ONBOARD_DEV=y and CONFIG_I2C=m.
> > 
> > riscv64-linux-ld: drivers/usb/misc/onboard_usb_dev.o:
> > undefined reference to `i2c_find_device_by_fwnode'
> > drivers/usb/misc/onboard_usb_dev.c:408:(.text+0xb24): undefined
> > reference to `i2c_smbus_write_block_data'
> > <snip>
> > 
> > Parsing of the i2c-bus bus handle is not put under usb5744 kernel config
> > check as the intention is to report an error when DT is configured for
> > usb5744 SMBus support and kernel has USB_ONBOARD_DEV_USB5744 disabled.
> > 
> > Fixes: 6782311d04df ("usb: misc: onboard_usb_dev: add Microchip usb5744 SMBus programming support")
> > Signed-off-by: Radhey Shyam Pandey <radhey.shyam.pandey@amd.com>
> > Suggested-by: Matthias Kaehlcke <matthias@kaehlcke.net>
> > Reported-by: kernel test robot <lkp@intel.com>
> > Closes: https://lore.kernel.org/oe-kbuild-all/202409140539.3Axwv38m-lkp@intel.com/
> > Acked-by: Matthias Kaehlcke <matthias@kaehlcke.net>
> > ---
> > Changes for v2:
> > - As suggested by Greg drop default 'y' and instead describe the
> >   constraints in the kconfig description.
> > ---
> >  drivers/usb/misc/Kconfig           | 12 ++++++++++++
> >  drivers/usb/misc/onboard_usb_dev.c |  6 ++++--
> >  2 files changed, 16 insertions(+), 2 deletions(-)
> > 
> > diff --git a/drivers/usb/misc/Kconfig b/drivers/usb/misc/Kconfig
> > index 50b86d531701..6497c4e81e95 100644
> > --- a/drivers/usb/misc/Kconfig
> > +++ b/drivers/usb/misc/Kconfig
> > @@ -331,3 +331,15 @@ config USB_ONBOARD_DEV
> >  	  this config will enable the driver and it will automatically
> >  	  match the state of the USB subsystem. If this driver is a
> >  	  module it will be called onboard_usb_dev.
> > +
> > +config USB_ONBOARD_DEV_USB5744
> > +	bool "Onboard USB Microchip usb5744 hub with SMBus support"
> > +	depends on (USB_ONBOARD_DEV && I2C=y) || (USB_ONBOARD_DEV=m && I2C=m)
> > +	help
> > +	  Say Y here if you want to support onboard USB Microchip usb5744
> > +	  hub that requires SMBus initialization.
> > +
> > +	  This options enables usb5744 i2c default initialization sequence
> > +	  during hub start-up configuration stage. It is must to enable this
> > +	  option on AMD Kria KR260 Robotics Starter Kit as this hub is
> > +	  connected to USB-SD converter which mounts the root filesystem.
> 
> With this applied I get the following build warning:
> 
> 
> WARNING: unmet direct dependencies detected for MODVERSIONS
>   Depends on [n]: MODULES [=y] && !COMPILE_TEST [=y]
>   Selected by [y]:
>   - RANDSTRUCT_FULL [=y] && (CC_HAS_RANDSTRUCT [=n] || GCC_PLUGINS [=y]) && MODULES [=y]
> 
> WARNING: unmet direct dependencies detected for MODVERSIONS
>   Depends on [n]: MODULES [=y] && !COMPILE_TEST [=y]
>   Selected by [y]:
>   - RANDSTRUCT_FULL [=y] && (CC_HAS_RANDSTRUCT [=n] || GCC_PLUGINS [=y]) && MODULES [=y]
> 
> WARNING: unmet direct dependencies detected for MODVERSIONS
>   Depends on [n]: MODULES [=y] && !COMPILE_TEST [=y]
>   Selected by [y]:
>   - RANDSTRUCT_FULL [=y] && (CC_HAS_RANDSTRUCT [=n] || GCC_PLUGINS [=y]) && MODULES [=y]
> 
> 
> Which is odd.
> 
> It's one extra "unmet direct ..." message than normal for now, so
> something in this commit is not working properly.
> 
> Can you fix this up and send a new version?

Nevermind, it's not this patch's fault, I'll go take this now, sorry for
the noise...

greg k-h

_______________________________________________
linux-riscv mailing list
linux-riscv@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-riscv

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

end of thread, other threads:[~2024-10-04 14:05 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-09-28 13:26 [PATCH v2] usb: misc: onboard_usb_dev: introduce new config symbol for usb5744 SMBus support Radhey Shyam Pandey
2024-10-04 13:36 ` Greg KH
2024-10-04 13:37   ` Greg KH

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox