diff options
author | David Brownell <david-b@pacbell.net> | 2005-07-13 18:18:30 -0400 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@suse.de> | 2005-09-08 19:22:16 -0400 |
commit | 91e79c91fab10f5790159d8d0c1d16da2a9653f9 (patch) | |
tree | a557a39bfe9dce508317baf7cd2e5217ac6f0c5d /drivers/usb/gadget/serial.c | |
parent | 81671ddb7e24e9d1f84812dba8ed810935f77d40 (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/serial.c')
-rw-r--r-- | drivers/usb/gadget/serial.c | 51 |
1 files changed, 11 insertions, 40 deletions
diff --git a/drivers/usb/gadget/serial.c b/drivers/usb/gadget/serial.c index 9e4f1c6935a5..c925d9222f53 100644 --- a/drivers/usb/gadget/serial.c +++ b/drivers/usb/gadget/serial.c | |||
@@ -1422,49 +1422,20 @@ static int gs_bind(struct usb_gadget *gadget) | |||
1422 | int ret; | 1422 | int ret; |
1423 | struct usb_ep *ep; | 1423 | struct usb_ep *ep; |
1424 | struct gs_dev *dev; | 1424 | struct gs_dev *dev; |
1425 | int gcnum; | ||
1425 | 1426 | ||
1426 | /* device specific */ | 1427 | /* Some controllers can't support CDC ACM: |
1427 | if (gadget_is_net2280(gadget)) { | 1428 | * - sh doesn't support multiple interfaces or configs; |
1428 | gs_device_desc.bcdDevice = | 1429 | * - sa1100 doesn't have a third interrupt endpoint |
1429 | __constant_cpu_to_le16(GS_VERSION_NUM|0x0001); | 1430 | */ |
1430 | } else if (gadget_is_pxa(gadget)) { | 1431 | if (gadget_is_sh(gadget) || gadget_is_sa1100(gadget)) |
1431 | gs_device_desc.bcdDevice = | ||
1432 | __constant_cpu_to_le16(GS_VERSION_NUM|0x0002); | ||
1433 | } else if (gadget_is_sh(gadget)) { | ||
1434 | gs_device_desc.bcdDevice = | ||
1435 | __constant_cpu_to_le16(GS_VERSION_NUM|0x0003); | ||
1436 | /* sh doesn't support multiple interfaces or configs */ | ||
1437 | use_acm = 0; | 1432 | use_acm = 0; |
1438 | } else if (gadget_is_sa1100(gadget)) { | 1433 | |
1439 | gs_device_desc.bcdDevice = | 1434 | gcnum = usb_gadget_controller_number(gadget); |
1440 | __constant_cpu_to_le16(GS_VERSION_NUM|0x0004); | 1435 | if (gcnum >= 0) |
1441 | /* sa1100 doesn't support necessary endpoints */ | ||
1442 | use_acm = 0; | ||
1443 | } else if (gadget_is_goku(gadget)) { | ||
1444 | gs_device_desc.bcdDevice = | ||
1445 | __constant_cpu_to_le16(GS_VERSION_NUM|0x0005); | ||
1446 | } else if (gadget_is_mq11xx(gadget)) { | ||
1447 | gs_device_desc.bcdDevice = | ||
1448 | __constant_cpu_to_le16(GS_VERSION_NUM|0x0006); | ||
1449 | } else if (gadget_is_omap(gadget)) { | ||
1450 | gs_device_desc.bcdDevice = | ||
1451 | __constant_cpu_to_le16(GS_VERSION_NUM|0x0007); | ||
1452 | } else if (gadget_is_lh7a40x(gadget)) { | ||
1453 | gs_device_desc.bcdDevice = | ||
1454 | __constant_cpu_to_le16(GS_VERSION_NUM|0x0008); | ||
1455 | } else if (gadget_is_n9604(gadget)) { | ||
1456 | gs_device_desc.bcdDevice = | ||
1457 | __constant_cpu_to_le16(GS_VERSION_NUM|0x0009); | ||
1458 | } else if (gadget_is_pxa27x(gadget)) { | ||
1459 | gs_device_desc.bcdDevice = | ||
1460 | __constant_cpu_to_le16(GS_VERSION_NUM|0x0011); | ||
1461 | } else if (gadget_is_s3c2410(gadget)) { | ||
1462 | gs_device_desc.bcdDevice = | ||
1463 | __constant_cpu_to_le16(GS_VERSION_NUM|0x0012); | ||
1464 | } else if (gadget_is_at91(gadget)) { | ||
1465 | gs_device_desc.bcdDevice = | 1436 | gs_device_desc.bcdDevice = |
1466 | __constant_cpu_to_le16(GS_VERSION_NUM|0x0013); | 1437 | cpu_to_le16(GS_VERSION_NUM | gcnum); |
1467 | } else { | 1438 | else { |
1468 | printk(KERN_WARNING "gs_bind: controller '%s' not recognized\n", | 1439 | printk(KERN_WARNING "gs_bind: controller '%s' not recognized\n", |
1469 | gadget->name); | 1440 | gadget->name); |
1470 | /* unrecognized, but safe unless bulk is REALLY quirky */ | 1441 | /* unrecognized, but safe unless bulk is REALLY quirky */ |