diff options
author | Rafaël Carré <rafael.carre@gmail.com> | 2011-12-31 21:18:10 +0000 |
---|---|---|
committer | Rafaël Carré <rafael.carre@gmail.com> | 2011-12-31 21:18:10 +0000 |
commit | fd5cb720c4b922979e854ee3d07979b81f60e776 (patch) | |
tree | 10fb1af91817d7d2c948a5a65b4710f6f398b075 | |
parent | 18bee1bafb7ce4cb7610a491c12c2d41939a2c2f (diff) | |
download | rockbox-fd5cb720c4b922979e854ee3d07979b81f60e776.tar.gz rockbox-fd5cb720c4b922979e854ee3d07979b81f60e776.zip |
usb-s3c6400: use more complete functions from usb-drv-as3525v2
update copyright
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@31508 a1c6a512-1295-4272-9138-f99709370657
-rw-r--r-- | firmware/target/arm/as3525/usb-drv-as3525v2.c | 24 | ||||
-rw-r--r-- | firmware/target/arm/usb-s3c6400x.c | 35 |
2 files changed, 25 insertions, 34 deletions
diff --git a/firmware/target/arm/as3525/usb-drv-as3525v2.c b/firmware/target/arm/as3525/usb-drv-as3525v2.c index e9a2ca8178..8c19758b65 100644 --- a/firmware/target/arm/as3525/usb-drv-as3525v2.c +++ b/firmware/target/arm/as3525/usb-drv-as3525v2.c | |||
@@ -366,23 +366,6 @@ void INT_USB(void) | |||
366 | GINTSTS = sts; | 366 | GINTSTS = sts; |
367 | } | 367 | } |
368 | 368 | ||
369 | int usb_drv_port_speed(void) | ||
370 | { | ||
371 | static const uint8_t speed[4] = { | ||
372 | [DSTS_ENUMSPD_HS_PHY_30MHZ_OR_60MHZ] = 1, | ||
373 | [DSTS_ENUMSPD_FS_PHY_30MHZ_OR_60MHZ] = 0, | ||
374 | [DSTS_ENUMSPD_FS_PHY_48MHZ] = 0, | ||
375 | [DSTS_ENUMSPD_LS_PHY_6MHZ] = 0, | ||
376 | }; | ||
377 | |||
378 | unsigned enumspd = extract(DSTS, enumspd); | ||
379 | |||
380 | if(enumspd == DSTS_ENUMSPD_LS_PHY_6MHZ) | ||
381 | panicf("usb-drv: LS is not supported"); | ||
382 | |||
383 | return speed[enumspd & 3]; | ||
384 | } | ||
385 | |||
386 | int usb_drv_request_endpoint(int type, int dir) | 369 | int usb_drv_request_endpoint(int type, int dir) |
387 | { | 370 | { |
388 | bool out = dir == USB_DIR_OUT; | 371 | bool out = dir == USB_DIR_OUT; |
@@ -456,10 +439,3 @@ int usb_drv_send(int ep, void *ptr, int len) | |||
456 | semaphore_wait(&endpoint->complete, TIMEOUT_BLOCK); | 439 | semaphore_wait(&endpoint->complete, TIMEOUT_BLOCK); |
457 | return endpoint->status; | 440 | return endpoint->status; |
458 | } | 441 | } |
459 | |||
460 | void usb_drv_set_test_mode(int mode) | ||
461 | { | ||
462 | /* there is a perfect matching between usb test mode code | ||
463 | * and the register field value */ | ||
464 | DCTL = (DCTL & ~bitm(DCTL, tstctl)) | (mode << DCTL_tstctl_bitp); | ||
465 | } | ||
diff --git a/firmware/target/arm/usb-s3c6400x.c b/firmware/target/arm/usb-s3c6400x.c index 26db55ee67..43c9f2fd77 100644 --- a/firmware/target/arm/usb-s3c6400x.c +++ b/firmware/target/arm/usb-s3c6400x.c | |||
@@ -8,6 +8,7 @@ | |||
8 | * $Id$ | 8 | * $Id$ |
9 | * | 9 | * |
10 | * Copyright (C) 2009 by Michael Sparmann | 10 | * Copyright (C) 2009 by Michael Sparmann |
11 | * Copyright © 2010 Amaury Pouly | ||
11 | * | 12 | * |
12 | * This program is free software; you can redistribute it and/or | 13 | * This program is free software; you can redistribute it and/or |
13 | * modify it under the terms of the GNU General Public License | 14 | * modify it under the terms of the GNU General Public License |
@@ -81,6 +82,30 @@ int usb_drv_recv(int endpoint, void* ptr, int length) | |||
81 | return 0; | 82 | return 0; |
82 | } | 83 | } |
83 | 84 | ||
85 | int usb_drv_port_speed(void) | ||
86 | { | ||
87 | static const uint8_t speed[4] = { | ||
88 | [DSTS_ENUMSPD_HS_PHY_30MHZ_OR_60MHZ] = 1, | ||
89 | [DSTS_ENUMSPD_FS_PHY_30MHZ_OR_60MHZ] = 0, | ||
90 | [DSTS_ENUMSPD_FS_PHY_48MHZ] = 0, | ||
91 | [DSTS_ENUMSPD_LS_PHY_6MHZ] = 0, | ||
92 | }; | ||
93 | |||
94 | unsigned enumspd = extract(DSTS, enumspd); | ||
95 | |||
96 | if(enumspd == DSTS_ENUMSPD_LS_PHY_6MHZ) | ||
97 | panicf("usb-drv: LS is not supported"); | ||
98 | |||
99 | return speed[enumspd & 3]; | ||
100 | } | ||
101 | |||
102 | void usb_drv_set_test_mode(int mode) | ||
103 | { | ||
104 | /* there is a perfect matching between usb test mode code | ||
105 | * and the register field value */ | ||
106 | DCTL = (DCTL & ~bitm(DCTL, tstctl)) | (mode << DCTL_tstctl_bitp); | ||
107 | } | ||
108 | |||
84 | #if CONFIG_CPU == AS3525v2 /* FIXME FIXME FIXME */ | 109 | #if CONFIG_CPU == AS3525v2 /* FIXME FIXME FIXME */ |
85 | # include "as3525/usb-drv-as3525v2.c" | 110 | # include "as3525/usb-drv-as3525v2.c" |
86 | #else | 111 | #else |
@@ -100,11 +125,6 @@ static union | |||
100 | unsigned char payload[64]; | 125 | unsigned char payload[64]; |
101 | } ctrlreq USB_DEVBSS_ATTR; | 126 | } ctrlreq USB_DEVBSS_ATTR; |
102 | 127 | ||
103 | int usb_drv_port_speed(void) | ||
104 | { | ||
105 | return (DSTS & 2) == 0 ? 1 : 0; | ||
106 | } | ||
107 | |||
108 | static void reset_endpoints(int reinit) | 128 | static void reset_endpoints(int reinit) |
109 | { | 129 | { |
110 | unsigned int i; | 130 | unsigned int i; |
@@ -331,11 +351,6 @@ void usb_drv_cancel_all_transfers(void) | |||
331 | restore_irq(flags); | 351 | restore_irq(flags); |
332 | } | 352 | } |
333 | 353 | ||
334 | void usb_drv_set_test_mode(int mode) | ||
335 | { | ||
336 | (void)mode; | ||
337 | } | ||
338 | |||
339 | void usb_drv_init(void) | 354 | void usb_drv_init(void) |
340 | { | 355 | { |
341 | for (unsigned i = 0; i < sizeof(endpoints)/sizeof(struct ep_type); i++) | 356 | for (unsigned i = 0; i < sizeof(endpoints)/sizeof(struct ep_type); i++) |