aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/usb/gadget/ether.c
diff options
context:
space:
mode:
authorDavid Brownell <david-b@pacbell.net>2005-07-13 18:18:30 -0400
committerGreg Kroah-Hartman <gregkh@suse.de>2005-09-08 19:22:16 -0400
commit91e79c91fab10f5790159d8d0c1d16da2a9653f9 (patch)
treea557a39bfe9dce508317baf7cd2e5217ac6f0c5d /drivers/usb/gadget/ether.c
parent81671ddb7e24e9d1f84812dba8ed810935f77d40 (diff)
[PATCH] USB: Gadget library: centralize gadget controller numbers
This patch centralizes the assignment of bcdDevice numbers for different gadget controllers. This won't improve the object code at all, but it does save a lot of repetitive and error-prone source code ... and will simplify the work of supporting a new controller driver, since most new gadget drivers will no longer need patches (unless some hardware quirks limit USB protocol messaging). Added minor cleanups and identifer hooks for the UDC in the Freescale iMX series processors. Signed-off-by: Alan Stern <stern@rowland.harvard.edu> Signed-off-by: David Brownell <dbrownell@users.sourceforge.net> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'drivers/usb/gadget/ether.c')
-rw-r--r--drivers/usb/gadget/ether.c33
1 files changed, 8 insertions, 25 deletions
diff --git a/drivers/usb/gadget/ether.c b/drivers/usb/gadget/ether.c
index 8509e955007d..49459e33e952 100644
--- a/drivers/usb/gadget/ether.c
+++ b/drivers/usb/gadget/ether.c
@@ -2181,6 +2181,7 @@ eth_bind (struct usb_gadget *gadget)
2181 u8 cdc = 1, zlp = 1, rndis = 1; 2181 u8 cdc = 1, zlp = 1, rndis = 1;
2182 struct usb_ep *in_ep, *out_ep, *status_ep = NULL; 2182 struct usb_ep *in_ep, *out_ep, *status_ep = NULL;
2183 int status = -ENOMEM; 2183 int status = -ENOMEM;
2184 int gcnum;
2184 2185
2185 /* these flags are only ever cleared; compiler take note */ 2186 /* these flags are only ever cleared; compiler take note */
2186#ifndef DEV_CONFIG_CDC 2187#ifndef DEV_CONFIG_CDC
@@ -2194,44 +2195,26 @@ eth_bind (struct usb_gadget *gadget)
2194 * standard protocol is _strongly_ preferred for interop purposes. 2195 * standard protocol is _strongly_ preferred for interop purposes.
2195 * (By everyone except Microsoft.) 2196 * (By everyone except Microsoft.)
2196 */ 2197 */
2197 if (gadget_is_net2280 (gadget)) { 2198 if (gadget_is_pxa (gadget)) {
2198 device_desc.bcdDevice = __constant_cpu_to_le16 (0x0201);
2199 } else if (gadget_is_dummy (gadget)) {
2200 device_desc.bcdDevice = __constant_cpu_to_le16 (0x0202);
2201 } else if (gadget_is_pxa (gadget)) {
2202 device_desc.bcdDevice = __constant_cpu_to_le16 (0x0203);
2203 /* pxa doesn't support altsettings */ 2199 /* pxa doesn't support altsettings */
2204 cdc = 0; 2200 cdc = 0;
2205 } else if (gadget_is_sh(gadget)) { 2201 } else if (gadget_is_sh(gadget)) {
2206 device_desc.bcdDevice = __constant_cpu_to_le16 (0x0204);
2207 /* sh doesn't support multiple interfaces or configs */ 2202 /* sh doesn't support multiple interfaces or configs */
2208 cdc = 0; 2203 cdc = 0;
2209 rndis = 0; 2204 rndis = 0;
2210 } else if (gadget_is_sa1100 (gadget)) { 2205 } else if (gadget_is_sa1100 (gadget)) {
2211 device_desc.bcdDevice = __constant_cpu_to_le16 (0x0205);
2212 /* hardware can't write zlps */ 2206 /* hardware can't write zlps */
2213 zlp = 0; 2207 zlp = 0;
2214 /* sa1100 CAN do CDC, without status endpoint ... we use 2208 /* sa1100 CAN do CDC, without status endpoint ... we use
2215 * non-CDC to be compatible with ARM Linux-2.4 "usb-eth". 2209 * non-CDC to be compatible with ARM Linux-2.4 "usb-eth".
2216 */ 2210 */
2217 cdc = 0; 2211 cdc = 0;
2218 } else if (gadget_is_goku (gadget)) { 2212 }
2219 device_desc.bcdDevice = __constant_cpu_to_le16 (0x0206); 2213
2220 } else if (gadget_is_mq11xx (gadget)) { 2214 gcnum = usb_gadget_controller_number (gadget);
2221 device_desc.bcdDevice = __constant_cpu_to_le16 (0x0207); 2215 if (gcnum >= 0)
2222 } else if (gadget_is_omap (gadget)) { 2216 device_desc.bcdDevice = cpu_to_le16 (0x0200 + gcnum);
2223 device_desc.bcdDevice = __constant_cpu_to_le16 (0x0208); 2217 else {
2224 } else if (gadget_is_lh7a40x(gadget)) {
2225 device_desc.bcdDevice = __constant_cpu_to_le16 (0x0209);
2226 } else if (gadget_is_n9604(gadget)) {
2227 device_desc.bcdDevice = __constant_cpu_to_le16 (0x0210);
2228 } else if (gadget_is_pxa27x(gadget)) {
2229 device_desc.bcdDevice = __constant_cpu_to_le16 (0x0211);
2230 } else if (gadget_is_s3c2410(gadget)) {
2231 device_desc.bcdDevice = __constant_cpu_to_le16 (0x0212);
2232 } else if (gadget_is_at91(gadget)) {
2233 device_desc.bcdDevice = __constant_cpu_to_le16 (0x0213);
2234 } else {
2235 /* can't assume CDC works. don't want to default to 2218 /* can't assume CDC works. don't want to default to
2236 * anything less functional on CDC-capable hardware, 2219 * anything less functional on CDC-capable hardware,
2237 * so we fail in this case. 2220 * so we fail in this case.