USB: ice40-hcd: Add configuration loading test
Provide a debug facility to power off the bridge chip and load the
configuration file. This will be useful to test the configuration
loading multiple times. The below command needs to be executed
to run this test.
echo -n "config_test" > /sys/kernel/debug/ice40_hcd/command
Change-Id: I22d8d5f87f35cd98dafa4189de34169a95e62a67
Signed-off-by: Pavankumar Kondeti <pkondeti@codeaurora.org>
diff --git a/drivers/usb/host/ice40-hcd.c b/drivers/usb/host/ice40-hcd.c
index 4d62a3e..09c6590 100644
--- a/drivers/usb/host/ice40-hcd.c
+++ b/drivers/usb/host/ice40-hcd.c
@@ -1884,6 +1884,13 @@
ihcd->port_flags |= (USB_PORT_STAT_C_CONNECTION << 16);
ihcd->pcd_pending = true;
usb_hcd_poll_rh_status(ihcd->hcd);
+ } else if (!strcmp(buf, "config_test")) {
+ ice40_spi_power_off(ihcd);
+ ret = ice40_spi_load_fw(ihcd);
+ if (ret) {
+ pr_err("config load failed\n");
+ goto out;
+ }
} else {
ret = -EINVAL;
goto out;