View | Details | Raw Unified | Return to bug 100533
Collapse All | Expand All

(-)g26.orig/drivers/usb/core/hub.c (-9 / +19 lines)
Lines 435-440 void usb_hub_tt_clear_buffer (struct usb Link Here
435
static void hub_power_on(struct usb_hub *hub)
435
static void hub_power_on(struct usb_hub *hub)
436
{
436
{
437
	int port1;
437
	int port1;
438
	unsigned pgood_delay = hub->descriptor->bPwrOn2PwrGood * 2;
438
439
439
	/* if hub supports power switching, enable power on each port */
440
	/* if hub supports power switching, enable power on each port */
440
	if ((hub->descriptor->wHubCharacteristics & HUB_CHAR_LPSM) < 2) {
441
	if ((hub->descriptor->wHubCharacteristics & HUB_CHAR_LPSM) < 2) {
Lines 444-451 static void hub_power_on(struct usb_hub Link Here
444
					USB_PORT_FEAT_POWER);
445
					USB_PORT_FEAT_POWER);
445
	}
446
	}
446
447
447
	/* Wait for power to be enabled */
448
	/* Wait 200+ msec for power to be enabled */
448
	msleep(hub->descriptor->bPwrOn2PwrGood * 2);
449
	msleep(max(pgood_delay, (unsigned) 200));
449
}
450
}
450
451
451
static void hub_quiesce(struct usb_hub *hub)
452
static void hub_quiesce(struct usb_hub *hub)
Lines 1401-1408 static int hub_port_reset(struct usb_hub Link Here
1401
		/* return on disconnect or reset */
1402
		/* return on disconnect or reset */
1402
		switch (status) {
1403
		switch (status) {
1403
		case 0:
1404
		case 0:
1404
			/* TRSTRCY = 10 ms */
1405
			/* TRSTRCY = 10 ms; plus some extra */
1405
			msleep(10);
1406
			msleep(10 + 40);
1406
			/* FALL THROUGH */
1407
			/* FALL THROUGH */
1407
		case -ENOTCONN:
1408
		case -ENOTCONN:
1408
		case -ENODEV:
1409
		case -ENODEV:
Lines 2153-2158 hub_port_init (struct usb_hub *hub, stru Link Here
2153
	 */
2154
	 */
2154
	switch (udev->speed) {
2155
	switch (udev->speed) {
2155
	case USB_SPEED_HIGH:		/* fixed at 64 */
2156
	case USB_SPEED_HIGH:		/* fixed at 64 */
2157
		udev->descriptor.bMaxPacketSize0 =
2156
		udev->ep0.desc.wMaxPacketSize = __constant_cpu_to_le16(64);
2158
		udev->ep0.desc.wMaxPacketSize = __constant_cpu_to_le16(64);
2157
		break;
2159
		break;
2158
	case USB_SPEED_FULL:		/* 8, 16, 32, or 64 */
2160
	case USB_SPEED_FULL:		/* 8, 16, 32, or 64 */
Lines 2163-2168 hub_port_init (struct usb_hub *hub, stru Link Here
2163
		udev->ep0.desc.wMaxPacketSize = __constant_cpu_to_le16(64);
2165
		udev->ep0.desc.wMaxPacketSize = __constant_cpu_to_le16(64);
2164
		break;
2166
		break;
2165
	case USB_SPEED_LOW:		/* fixed at 8 */
2167
	case USB_SPEED_LOW:		/* fixed at 8 */
2168
		udev->descriptor.bMaxPacketSize0 =
2166
		udev->ep0.desc.wMaxPacketSize = __constant_cpu_to_le16(8);
2169
		udev->ep0.desc.wMaxPacketSize = __constant_cpu_to_le16(8);
2167
		break;
2170
		break;
2168
	default:
2171
	default:
Lines 2193-2199 hub_port_init (struct usb_hub *hub, stru Link Here
2193
 
2196
 
2194
	/* Why interleave GET_DESCRIPTOR and SET_ADDRESS this way?
2197
	/* Why interleave GET_DESCRIPTOR and SET_ADDRESS this way?
2195
	 * Because device hardware and firmware is sometimes buggy in
2198
	 * Because device hardware and firmware is sometimes buggy in
2196
	 * this area, and this is how Linux has done it for ages.
2199
	 * this area.
2197
	 * Change it cautiously.
2200
	 * Change it cautiously.
2198
	 *
2201
	 *
2199
	 * NOTE:  If USE_NEW_SCHEME() is true we will start by issuing
2202
	 * NOTE:  If USE_NEW_SCHEME() is true we will start by issuing
Lines 2204-2210 hub_port_init (struct usb_hub *hub, stru Link Here
2204
	 * value.
2207
	 * value.
2205
	 */
2208
	 */
2206
	for (i = 0; i < GET_DESCRIPTOR_TRIES; (++i, msleep(100))) {
2209
	for (i = 0; i < GET_DESCRIPTOR_TRIES; (++i, msleep(100))) {
2207
		if (USE_NEW_SCHEME(retry_counter)) {
2210
		if (USE_NEW_SCHEME(retry_counter)
2211
				&& !udev->descriptor.bMaxPacketSize0) {
2208
			struct usb_device_descriptor *buf;
2212
			struct usb_device_descriptor *buf;
2209
			int r = 0;
2213
			int r = 0;
2210
2214
Lines 2268-2289 hub_port_init (struct usb_hub *hub, stru Link Here
2268
#undef GET_DESCRIPTOR_BUFSIZE
2272
#undef GET_DESCRIPTOR_BUFSIZE
2269
		}
2273
		}
2270
2274
2275
		/* after set_address errors it's not clear what the
2276
		 * device's address will be; so reset, and be sure.
2277
		 */
2271
		for (j = 0; j < SET_ADDRESS_TRIES; ++j) {
2278
		for (j = 0; j < SET_ADDRESS_TRIES; ++j) {
2272
			retval = hub_set_address(udev);
2279
			retval = hub_set_address(udev);
2273
			if (retval >= 0)
2280
			if (retval >= 0)
2274
				break;
2281
				break;
2275
			msleep(200);
2282
			(void) hub_port_reset(hub, port1, udev, delay);
2276
		}
2283
		}
2277
		if (retval < 0) {
2284
		if (retval < 0) {
2278
			dev_err(&udev->dev,
2285
			dev_err(&udev->dev,
2279
				"device not accepting address %d, error %d\n",
2286
				"device not accepting address %d, error %d\n",
2280
				udev->devnum, retval);
2287
				udev->devnum, retval);
2281
			goto fail;
2288
			continue;
2282
		}
2289
		}
2290
2291
		/* don't expect hardware to jump through needless hoops */
2292
		if (udev->descriptor.bMaxPacketSize0)
2293
			break;
2283
 
2294
 
2284
		/* cope with hardware quirkiness:
2295
		/* cope with hardware quirkiness:
2285
		 *  - let SET_ADDRESS settle, some device hardware wants it
2296
		 *  - let SET_ADDRESS settle, some device hardware wants it
2286
		 *  - read ep0 maxpacket even for high and low speed,
2287
  		 */
2297
  		 */
2288
		msleep(10);
2298
		msleep(10);
2289
		if (USE_NEW_SCHEME(retry_counter))
2299
		if (USE_NEW_SCHEME(retry_counter))

Return to bug 100533