Patrick Georgi (pgeorgi@google.com) just uploaded a new patch set to gerrit, which you can find at http://review.coreboot.org/10686
-gerrit
commit e7b19e58e11cda3c43176a509a62127cd6cd85e3 Author: Furquan Shaikh furquan@google.com Date: Mon Jun 22 16:07:51 2015 -0700
udc/chipidea: Allow force_shutdown of connection
Allow force shutdown operation of the connection in case where the cable is disconnected and reconnected back.
BUG=chrome-os-partner:41687 BRANCH=None TEST=Compiles successfully and fastboot works fine even with reconnection of cable
Change-Id: I8eb1217b4a9ad6ce8a2a40db329eca1930eda089 Signed-off-by: Patrick Georgi pgeorgi@chromium.org Original-Commit-Id: 3d7ab65c459caa4ec526b99a1aee1a31e9cb80da Original-Change-Id: I354c44e0ed2211cb2c4c1ae653d201b7d15ea932 Original-Signed-off-by: Furquan Shaikh furquan@google.com Original-Reviewed-on: https://chromium-review.googlesource.com/281066 Original-Trybot-Ready: Furquan Shaikh furquan@chromium.org Original-Tested-by: Furquan Shaikh furquan@chromium.org Original-Reviewed-by: Patrick Georgi pgeorgi@chromium.org Original-Commit-Queue: Furquan Shaikh furquan@chromium.org --- payloads/libpayload/drivers/udc/chipidea.c | 21 ++++++++++++++------- payloads/libpayload/include/udc/udc.h | 9 +++++++++ 2 files changed, 23 insertions(+), 7 deletions(-)
diff --git a/payloads/libpayload/drivers/udc/chipidea.c b/payloads/libpayload/drivers/udc/chipidea.c index 16a42e4..20267ed 100644 --- a/payloads/libpayload/drivers/udc/chipidea.c +++ b/payloads/libpayload/drivers/udc/chipidea.c @@ -413,6 +413,18 @@ static int chipidea_poll(struct usbdev_ctrl *this) return 1; }
+static void chipidea_force_shutdown(struct usbdev_ctrl *this) +{ + struct chipidea_pdata *p = CI_PDATA(this); + writel(0xffffffff, &p->opreg->epflush); + writel(USBCMD_8MICRO | USBCMD_RST, &p->opreg->usbcmd); + writel(0, &p->opreg->usbmode); + writel(USBCMD_8MICRO, &p->opreg->usbcmd); + free(p->qhlist); + free(p); + free(this); +} + static void chipidea_shutdown(struct usbdev_ctrl *this) { struct chipidea_pdata *p = CI_PDATA(this); @@ -426,13 +438,7 @@ static void chipidea_shutdown(struct usbdev_ctrl *this) if (!SIMPLEQ_EMPTY(&p->job_queue[i][j])) is_empty = 0; } - writel(0xffffffff, &p->opreg->epflush); - writel(USBCMD_8MICRO | USBCMD_RST, &p->opreg->usbcmd); - writel(0, &p->opreg->usbmode); - writel(USBCMD_8MICRO, &p->opreg->usbcmd); - free(p->qhlist); - free(p); - free(this); + chipidea_force_shutdown(this); }
static void chipidea_set_address(struct usbdev_ctrl *this, int address) @@ -491,6 +497,7 @@ struct usbdev_ctrl *chipidea_init(device_descriptor_t *dd) ctrl->add_gadget = udc_add_gadget; ctrl->add_strings = udc_add_strings; ctrl->enqueue_packet = chipidea_enqueue_packet; + ctrl->force_shutdown = chipidea_force_shutdown; ctrl->shutdown = chipidea_shutdown; ctrl->set_address = chipidea_set_address; ctrl->stall = chipidea_stall; diff --git a/payloads/libpayload/include/udc/udc.h b/payloads/libpayload/include/udc/udc.h index 99cbb1b..5180177 100644 --- a/payloads/libpayload/include/udc/udc.h +++ b/payloads/libpayload/include/udc/udc.h @@ -140,6 +140,15 @@ struct usbdev_ctrl { */ void (*stall)(struct usbdev_ctrl *, uint8_t ep, int in_dir, int set);
+ /** + * Disable controller and deallocate data structures. + */ + void (*force_shutdown)(struct usbdev_ctrl *this); + + /** + * Let queues run out, then disable controller and deallocate data + * structures. + */ void (*shutdown)(struct usbdev_ctrl *this);
/**