Skip to content

Commit 6c4e1ef

Browse files
Radhey Shyam Pandeygregkh
authored andcommitted
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: 6782311 ("usb: misc: onboard_usb_dev: add Microchip usb5744 SMBus programming support") Signed-off-by: Radhey Shyam Pandey <[email protected]> Suggested-by: Matthias Kaehlcke <[email protected]> Reported-by: kernel test robot <[email protected]> Closes: https://lore.kernel.org/oe-kbuild-all/[email protected]/ Acked-by: Matthias Kaehlcke <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Greg Kroah-Hartman <[email protected]>
1 parent 0d410e8 commit 6c4e1ef

File tree

2 files changed

+16
-2
lines changed

2 files changed

+16
-2
lines changed

drivers/usb/misc/Kconfig

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -331,3 +331,15 @@ config USB_ONBOARD_DEV
331331
this config will enable the driver and it will automatically
332332
match the state of the USB subsystem. If this driver is a
333333
module it will be called onboard_usb_dev.
334+
335+
config USB_ONBOARD_DEV_USB5744
336+
bool "Onboard USB Microchip usb5744 hub with SMBus support"
337+
depends on (USB_ONBOARD_DEV && I2C=y) || (USB_ONBOARD_DEV=m && I2C=m)
338+
help
339+
Say Y here if you want to support onboard USB Microchip usb5744
340+
hub that requires SMBus initialization.
341+
342+
This options enables usb5744 i2c default initialization sequence
343+
during hub start-up configuration stage. It is must to enable this
344+
option on AMD Kria KR260 Robotics Starter Kit as this hub is
345+
connected to USB-SD converter which mounts the root filesystem.

drivers/usb/misc/onboard_usb_dev.c

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -311,7 +311,7 @@ static void onboard_dev_attach_usb_driver(struct work_struct *work)
311311

312312
static int onboard_dev_5744_i2c_init(struct i2c_client *client)
313313
{
314-
#if IS_ENABLED(CONFIG_I2C)
314+
#if IS_ENABLED(CONFIG_USB_ONBOARD_DEV_USB5744)
315315
struct device *dev = &client->dev;
316316
int ret;
317317

@@ -394,9 +394,11 @@ static int onboard_dev_probe(struct platform_device *pdev)
394394

395395
i2c_node = of_parse_phandle(pdev->dev.of_node, "i2c-bus", 0);
396396
if (i2c_node) {
397-
struct i2c_client *client;
397+
struct i2c_client *client = NULL;
398398

399+
#if IS_ENABLED(CONFIG_USB_ONBOARD_DEV_USB5744)
399400
client = of_find_i2c_device_by_node(i2c_node);
401+
#endif
400402
of_node_put(i2c_node);
401403

402404
if (!client) {

0 commit comments

Comments
 (0)