tree: https://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb.git usb-testing head: 68d4209158f43a558c5553ea95ab0c8975eab18c commit: 6782311d04dfbb01d379836ee5c564f49e66648c [14/33] usb: misc: onboard_usb_dev: add Microchip usb5744 SMBus programming support config: riscv-randconfig-001-20240913 (https://download.01.org/0day-ci/archive/20240914/202409140539.3Axwv38m-lkp@xxxxxxxxx/config) compiler: riscv64-linux-gcc (GCC) 14.1.0 reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20240914/202409140539.3Axwv38m-lkp@xxxxxxxxx/reproduce) If you fix the issue in a separate patch/commit (i.e. not just a new version of the same patch/commit), kindly add following tags | Reported-by: kernel test robot <lkp@xxxxxxxxx> | Closes: https://lore.kernel.org/oe-kbuild-all/202409140539.3Axwv38m-lkp@xxxxxxxxx/ All errors (new ones prefixed by >>): riscv64-linux-ld: drivers/usb/misc/onboard_usb_dev.o: in function `fsleep': include/linux/delay.h:89:(.text+0xaa4): undefined reference to `i2c_find_device_by_fwnode' riscv64-linux-ld: drivers/usb/misc/onboard_usb_dev.o: in function `onboard_dev_probe': >> drivers/usb/misc/onboard_usb_dev.c:408:(.text+0xb24): undefined reference to `i2c_smbus_write_block_data' riscv64-linux-ld: drivers/usb/misc/onboard_usb_dev.o: in function `onboard_dev_5744_i2c_init': >> drivers/usb/misc/onboard_usb_dev.c:330:(.text+0xb58): undefined reference to `i2c_smbus_write_word_data' >> riscv64-linux-ld: drivers/usb/misc/onboard_usb_dev.c:332:(.text+0xb8c): undefined reference to `i2c_smbus_write_word_data' vim +408 drivers/usb/misc/onboard_usb_dev.c 311 312 static int onboard_dev_5744_i2c_init(struct i2c_client *client) 313 { 314 #if IS_ENABLED(CONFIG_I2C) 315 struct device *dev = &client->dev; 316 int ret; 317 318 /* 319 * Set BYPASS_UDC_SUSPEND bit to ensure MCU is always enabled 320 * and ready to respond to SMBus runtime commands. 321 * The command writes 5 bytes to memory and single data byte in 322 * configuration register. 323 */ 324 char wr_buf[7] = {USB5744_CREG_MEM_ADDR, 5, 325 USB5744_CREG_WRITE, 1, 326 USB5744_CREG_RUNTIMEFLAGS2, 327 USB5744_CREG_RUNTIMEFLAGS2_LSB, 328 USB5744_CREG_BYPASS_UDC_SUSPEND}; 329 > 330 ret = i2c_smbus_write_block_data(client, 0, sizeof(wr_buf), wr_buf); 331 if (ret) > 332 return dev_err_probe(dev, ret, "BYPASS_UDC_SUSPEND bit configuration failed\n"); 333 334 ret = i2c_smbus_write_word_data(client, USB5744_CMD_CREG_ACCESS, 335 USB5744_CMD_CREG_ACCESS_LSB); 336 if (ret) 337 return dev_err_probe(dev, ret, "Configuration Register Access Command failed\n"); 338 339 /* Send SMBus command to boot hub. */ 340 ret = i2c_smbus_write_word_data(client, USB5744_CMD_ATTACH, 341 USB5744_CMD_ATTACH_LSB); 342 if (ret < 0) 343 return dev_err_probe(dev, ret, "USB Attach with SMBus command failed\n"); 344 345 return ret; 346 #else 347 return -ENODEV; 348 #endif 349 } 350 351 static int onboard_dev_probe(struct platform_device *pdev) 352 { 353 struct device *dev = &pdev->dev; 354 struct onboard_dev *onboard_dev; 355 struct device_node *i2c_node; 356 int err; 357 358 onboard_dev = devm_kzalloc(dev, sizeof(*onboard_dev), GFP_KERNEL); 359 if (!onboard_dev) 360 return -ENOMEM; 361 362 onboard_dev->pdata = device_get_match_data(dev); 363 if (!onboard_dev->pdata) 364 return -EINVAL; 365 366 if (!onboard_dev->pdata->is_hub) 367 onboard_dev->always_powered_in_suspend = true; 368 369 onboard_dev->dev = dev; 370 371 err = onboard_dev_get_regulators(onboard_dev); 372 if (err) 373 return err; 374 375 onboard_dev->clk = devm_clk_get_optional(dev, NULL); 376 if (IS_ERR(onboard_dev->clk)) 377 return dev_err_probe(dev, PTR_ERR(onboard_dev->clk), 378 "failed to get clock\n"); 379 380 onboard_dev->reset_gpio = devm_gpiod_get_optional(dev, "reset", 381 GPIOD_OUT_HIGH); 382 if (IS_ERR(onboard_dev->reset_gpio)) 383 return dev_err_probe(dev, PTR_ERR(onboard_dev->reset_gpio), 384 "failed to get reset GPIO\n"); 385 386 mutex_init(&onboard_dev->lock); 387 INIT_LIST_HEAD(&onboard_dev->udev_list); 388 389 dev_set_drvdata(dev, onboard_dev); 390 391 err = onboard_dev_power_on(onboard_dev); 392 if (err) 393 return err; 394 395 i2c_node = of_parse_phandle(pdev->dev.of_node, "i2c-bus", 0); 396 if (i2c_node) { 397 struct i2c_client *client; 398 399 client = of_find_i2c_device_by_node(i2c_node); 400 of_node_put(i2c_node); 401 402 if (!client) { 403 err = -EPROBE_DEFER; 404 goto err_power_off; 405 } 406 407 if (of_device_is_compatible(pdev->dev.of_node, "usb424,2744") || > 408 of_device_is_compatible(pdev->dev.of_node, "usb424,5744")) 409 err = onboard_dev_5744_i2c_init(client); 410 411 put_device(&client->dev); 412 if (err < 0) 413 goto err_power_off; 414 } 415 416 /* 417 * The USB driver might have been detached from the USB devices by 418 * onboard_dev_remove() (e.g. through an 'unbind' by userspace), 419 * make sure to re-attach it if needed. 420 * 421 * This needs to be done deferred to avoid self-deadlocks on systems 422 * with nested onboard hubs. 423 */ 424 schedule_work(&attach_usb_driver_work); 425 426 return 0; 427 428 err_power_off: 429 onboard_dev_power_off(onboard_dev); 430 return err; 431 } 432 -- 0-DAY CI Kernel Test Service https://github.com/intel/lkp-tests/wiki