summaryrefslogtreecommitdiff
path: root/firmware/target/arm/usb-s3c6400x.c
diff options
context:
space:
mode:
Diffstat (limited to 'firmware/target/arm/usb-s3c6400x.c')
-rw-r--r--firmware/target/arm/usb-s3c6400x.c14
1 files changed, 7 insertions, 7 deletions
diff --git a/firmware/target/arm/usb-s3c6400x.c b/firmware/target/arm/usb-s3c6400x.c
index eb7a0170bf..24e0fdc08a 100644
--- a/firmware/target/arm/usb-s3c6400x.c
+++ b/firmware/target/arm/usb-s3c6400x.c
@@ -44,7 +44,7 @@ struct ep_type
44 bool done; 44 bool done;
45 int rc; 45 int rc;
46 int size; 46 int size;
47 struct wakeup complete; 47 struct semaphore complete;
48} ; 48} ;
49 49
50static struct ep_type endpoints[USB_NUM_ENDPOINTS]; 50static struct ep_type endpoints[USB_NUM_ENDPOINTS];
@@ -64,7 +64,7 @@ static void reset_endpoints(int reinit)
64 endpoints[i].busy = false; 64 endpoints[i].busy = false;
65 endpoints[i].rc = -1; 65 endpoints[i].rc = -1;
66 endpoints[i].done = true; 66 endpoints[i].done = true;
67 wakeup_signal(&endpoints[i].complete); 67 semaphore_release(&endpoints[i].complete);
68 } 68 }
69 DIEPCTL0 = 0x8800; /* EP0 IN ACTIVE NEXT=1 */ 69 DIEPCTL0 = 0x8800; /* EP0 IN ACTIVE NEXT=1 */
70 DOEPCTL0 = 0x8000; /* EP0 OUT ACTIVE */ 70 DOEPCTL0 = 0x8000; /* EP0 OUT ACTIVE */
@@ -201,7 +201,7 @@ void INT_USB_FUNC(void)
201 endpoints[i].rc = 0; 201 endpoints[i].rc = 0;
202 endpoints[i].done = true; 202 endpoints[i].done = true;
203 usb_core_transfer_complete(i, USB_DIR_IN, 0, bytes); 203 usb_core_transfer_complete(i, USB_DIR_IN, 0, bytes);
204 wakeup_signal(&endpoints[i].complete); 204 semaphore_release(&endpoints[i].complete);
205 } 205 }
206 } 206 }
207 if (epints & 4) /* AHB error */ 207 if (epints & 4) /* AHB error */
@@ -213,7 +213,7 @@ void INT_USB_FUNC(void)
213 endpoints[i].busy = false; 213 endpoints[i].busy = false;
214 endpoints[i].rc = 1; 214 endpoints[i].rc = 1;
215 endpoints[i].done = true; 215 endpoints[i].done = true;
216 wakeup_signal(&endpoints[i].complete); 216 semaphore_release(&endpoints[i].complete);
217 } 217 }
218 } 218 }
219 DIEPINT(i) = epints; 219 DIEPINT(i) = epints;
@@ -233,7 +233,7 @@ void INT_USB_FUNC(void)
233 endpoints[i].rc = 0; 233 endpoints[i].rc = 0;
234 endpoints[i].done = true; 234 endpoints[i].done = true;
235 usb_core_transfer_complete(i, USB_DIR_OUT, 0, bytes); 235 usb_core_transfer_complete(i, USB_DIR_OUT, 0, bytes);
236 wakeup_signal(&endpoints[i].complete); 236 semaphore_release(&endpoints[i].complete);
237 } 237 }
238 } 238 }
239 if (epints & 4) /* AHB error */ 239 if (epints & 4) /* AHB error */
@@ -325,7 +325,7 @@ int usb_drv_send(int endpoint, void *ptr, int length)
325 endpoints[endpoint].done = false; 325 endpoints[endpoint].done = false;
326 ep_send(endpoint, ptr, length); 326 ep_send(endpoint, ptr, length);
327 while (!endpoints[endpoint].done && endpoints[endpoint].busy) 327 while (!endpoints[endpoint].done && endpoints[endpoint].busy)
328 wakeup_wait(&endpoints[endpoint].complete, TIMEOUT_BLOCK); 328 semaphore_wait(&endpoints[endpoint].complete, TIMEOUT_BLOCK);
329 return endpoints[endpoint].rc; 329 return endpoints[endpoint].rc;
330} 330}
331 331
@@ -412,7 +412,7 @@ void usb_init_device(void)
412{ 412{
413 unsigned int i; 413 unsigned int i;
414 for (i = 0; i < sizeof(endpoints)/sizeof(struct ep_type); i++) 414 for (i = 0; i < sizeof(endpoints)/sizeof(struct ep_type); i++)
415 wakeup_init(&endpoints[i].complete); 415 semaphore_init(&endpoints[i].complete, 1, 0);
416 416
417 /* Power up the core clocks to allow writing 417 /* Power up the core clocks to allow writing
418 to some registers needed to power it down */ 418 to some registers needed to power it down */