Commit 6c4e1ef4 authored by Radhey Shyam Pandey's avatar Radhey Shyam Pandey Committed by Greg Kroah-Hartman
Browse files

usb: misc: onboard_usb_dev: introduce new config symbol for usb5744 SMBus support



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: 6782311d ("usb: misc: onboard_usb_dev: add Microchip usb5744 SMBus programming support")
Signed-off-by: default avatarRadhey Shyam Pandey <radhey.shyam.pandey@amd.com>
Suggested-by: default avatarMatthias Kaehlcke <matthias@kaehlcke.net>
Reported-by: default avatarkernel test robot <lkp@intel.com>
Closes: https://lore.kernel.org/oe-kbuild-all/202409140539.3Axwv38m-lkp@intel.com/


Acked-by: default avatarMatthias Kaehlcke <matthias@kaehlcke.net>
Link: https://lore.kernel.org/r/1727529992-476088-1-git-send-email-radhey.shyam.pandey@amd.com


Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 0d410e89
Loading
Loading
Loading
Loading
+12 −0
Original line number Diff line number Diff line
@@ -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.
+4 −2
Original line number Diff line number Diff line
@@ -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) {