usb-s3c6400x: prevent lockup if usb extracted during data sending

Change-Id: I5e87a9c47defa90e15800666e8ab4608ef5de299
This commit is contained in:
Mihail Zenkov 2016-02-20 03:02:24 +00:00 committed by Gerrit Rockbox
parent bb48fa02d2
commit 4c6871cffa

View file

@ -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;
}