summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMihail Zenkov <mihail.zenkov@gmail.com>2016-02-20 03:02:24 +0000
committerGerrit Rockbox <gerrit@rockbox.org>2016-03-18 14:02:17 +0100
commit4c6871cffaf5917165fc05d6bf77bd4cff34cfd5 (patch)
treed235ca58fb7ab63896483a4563d9e8a8b317ce42
parentbb48fa02d2057753dc5695d7e21c6d63cac8b75c (diff)
downloadrockbox-4c6871c.tar.gz
rockbox-4c6871c.tar.bz2
rockbox-4c6871c.zip
usb-s3c6400x: prevent lockup if usb extracted during data sending
Change-Id: I5e87a9c47defa90e15800666e8ab4608ef5de299
-rw-r--r--firmware/target/arm/usb-s3c6400x.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/firmware/target/arm/usb-s3c6400x.c b/firmware/target/arm/usb-s3c6400x.c
index 27164aef69..d51a71165c 100644
--- a/firmware/target/arm/usb-s3c6400x.c
+++ b/firmware/target/arm/usb-s3c6400x.c
@@ -432,7 +432,7 @@ void usb_drv_exit(void)
ORSTCON = 7; /* Put the PHY into reset (needed to get current down) */
udelay(10);
PCGCCTL = 1; /* Shut down PHY clock */
-
+
#if CONFIG_CPU==S5L8701
PWRCON |= 0x4000;
PWRCONEXT |= 0x800;
@@ -619,7 +619,7 @@ int usb_drv_send(int ep, void *ptr, int len)
struct ep_type *endpoint = &endpoints[ep][1];
endpoint->done = false;
ep_transfer(ep, ptr, len, false);
- while (endpoint->busy && !endpoint->done)
- semaphore_wait(&endpoint->complete, TIMEOUT_BLOCK);
+ while (endpoint->busy && !endpoint->done && usb_detect() != USB_EXTRACTED)
+ semaphore_wait(&endpoint->complete, HZ);
return endpoint->status;
}