aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/usb/gadget/zero.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/zero.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/zero.c')
-rw-r--r--drivers/usb/gadget/zero.c48
1 files changed, 11 insertions, 37 deletions
diff --git a/drivers/usb/gadget/zero.c b/drivers/usb/gadget/zero.c
index bb9b2d94eed5..6890e773b2a2 100644
--- a/drivers/usb/gadget/zero.c
+++ b/drivers/usb/gadget/zero.c
@@ -1139,6 +1139,13 @@ zero_bind (struct usb_gadget *gadget)
1139{ 1139{
1140 struct zero_dev *dev; 1140 struct zero_dev *dev;
1141 struct usb_ep *ep; 1141 struct usb_ep *ep;
1142 int gcnum;
1143
1144 /* FIXME this can't yet work right with SH ... it has only
1145 * one configuration, numbered one.
1146 */
1147 if (gadget_is_sh(gadget))
1148 return -ENODEV;
1142 1149
1143 /* Bulk-only drivers like this one SHOULD be able to 1150 /* Bulk-only drivers like this one SHOULD be able to
1144 * autoconfigure on any sane usb controller driver, 1151 * autoconfigure on any sane usb controller driver,
@@ -1161,43 +1168,10 @@ autoconf_fail:
1161 EP_OUT_NAME = ep->name; 1168 EP_OUT_NAME = ep->name;
1162 ep->driver_data = ep; /* claim */ 1169 ep->driver_data = ep; /* claim */
1163 1170
1164 1171 gcnum = usb_gadget_controller_number (gadget);
1165 /* 1172 if (gcnum >= 0)
1166 * DRIVER POLICY CHOICE: you may want to do this differently. 1173 device_desc.bcdDevice = cpu_to_le16 (0x0200 + gcnum);
1167 * One thing to avoid is reusing a bcdDevice revision code 1174 else {
1168 * with different host-visible configurations or behavior
1169 * restrictions -- using ep1in/ep2out vs ep1out/ep3in, etc
1170 */
1171 if (gadget_is_net2280 (gadget)) {
1172 device_desc.bcdDevice = __constant_cpu_to_le16 (0x0201);
1173 } else if (gadget_is_pxa (gadget)) {
1174 device_desc.bcdDevice = __constant_cpu_to_le16 (0x0203);
1175#if 0
1176 } else if (gadget_is_sh(gadget)) {
1177 device_desc.bcdDevice = __constant_cpu_to_le16 (0x0204);
1178 /* SH has only one configuration; see "loopdefault" */
1179 device_desc.bNumConfigurations = 1;
1180 /* FIXME make 1 == default.bConfigurationValue */
1181#endif
1182 } else if (gadget_is_sa1100 (gadget)) {
1183 device_desc.bcdDevice = __constant_cpu_to_le16 (0x0205);
1184 } else if (gadget_is_goku (gadget)) {
1185 device_desc.bcdDevice = __constant_cpu_to_le16 (0x0206);
1186 } else if (gadget_is_mq11xx (gadget)) {
1187 device_desc.bcdDevice = __constant_cpu_to_le16 (0x0207);
1188 } else if (gadget_is_omap (gadget)) {
1189 device_desc.bcdDevice = __constant_cpu_to_le16 (0x0208);
1190 } else if (gadget_is_lh7a40x(gadget)) {
1191 device_desc.bcdDevice = __constant_cpu_to_le16 (0x0209);
1192 } else if (gadget_is_n9604(gadget)) {
1193 device_desc.bcdDevice = __constant_cpu_to_le16 (0x0210);
1194 } else if (gadget_is_pxa27x(gadget)) {
1195 device_desc.bcdDevice = __constant_cpu_to_le16 (0x0211);
1196 } else if (gadget_is_s3c2410(gadget)) {
1197 device_desc.bcdDevice = __constant_cpu_to_le16 (0x0212);
1198 } else if (gadget_is_at91(gadget)) {
1199 device_desc.bcdDevice = __constant_cpu_to_le16 (0x0213);
1200 } else {
1201 /* gadget zero is so simple (for now, no altsettings) that 1175 /* gadget zero is so simple (for now, no altsettings) that
1202 * it SHOULD NOT have problems with bulk-capable hardware. 1176 * it SHOULD NOT have problems with bulk-capable hardware.
1203 * so warn about unrcognized controllers, don't panic. 1177 * so warn about unrcognized controllers, don't panic.