72 #include <linux/slab.h>
73 #include <linux/export.h>
99 static int wusbhc_rh_port_reset(
struct wusbhc *
wusbhc,
u8 port_idx)
105 if (wusb_dev ==
NULL)
145 unsigned long *
buf = (
unsigned long *) _buf;
149 size = (size + 8 - 1) / 8;
150 for (cnt = 0; cnt < wusbhc->
ports_max; cnt++)
151 if (wusb_port_by_idx(wusbhc, cnt)->change)
166 static int wusbhc_rh_get_hub_descr(
struct wusbhc *wusbhc,
u16 wValue,
174 if (wLength < length)
200 static int wusbhc_rh_clear_hub_feat(
struct wusbhc *wusbhc,
u16 feature)
225 static int wusbhc_rh_get_hub_status(
struct wusbhc *wusbhc,
u32 *
buf,
238 static int wusbhc_rh_set_port_feat(
struct wusbhc *wusbhc,
u16 feature,
262 return wusbhc_rh_port_reset(wusbhc, port_idx);
265 dev_err(dev,
"(port_idx %d) set feat %d/%d UNIMPLEMENTED\n",
266 port_idx, feature, selector);
269 dev_err(dev,
"(port_idx %d) set feat %d/%d UNKNOWN\n",
270 port_idx, feature, selector);
282 static int wusbhc_rh_clear_port_feat(
struct wusbhc *wusbhc,
u16 feature,
283 u8 selector,
u8 port_idx)
311 dev_err(dev,
"(port_idx %d) Clear feat %d/%d UNIMPLEMENTED\n",
312 port_idx, feature, selector);
316 dev_err(dev,
"(port_idx %d) Clear feat %d/%d UNKNOWN\n",
317 port_idx, feature, selector);
331 static int wusbhc_rh_get_port_status(
struct wusbhc *wusbhc,
u16 port_idx,
341 buf[1] =
cpu_to_le16(wusb_port_by_idx(wusbhc, port_idx)->change);
353 u16 wIndex,
char *buf,
u16 wLength)
359 case GetHubDescriptor:
360 result = wusbhc_rh_get_hub_descr(
361 wusbhc, wValue, wIndex,
364 case ClearHubFeature:
365 result = wusbhc_rh_clear_hub_feat(wusbhc, wValue);
368 result = wusbhc_rh_get_hub_status(wusbhc, (
u32 *)buf, wLength);
372 result = wusbhc_rh_set_port_feat(wusbhc, wValue, wIndex >> 8,
373 (wIndex & 0xff) - 1);
375 case ClearPortFeature:
376 result = wusbhc_rh_clear_port_feat(wusbhc, wValue, wIndex >> 8,
377 (wIndex & 0xff) - 1);
380 result = wusbhc_rh_get_port_status(wusbhc, wIndex - 1,
381 (
u32 *)buf, wLength);
386 dev_err(wusbhc->
dev,
"%s (%p [%p], %x, %x, %x, %p, %x) "
387 "UNIMPLEMENTED\n", __func__, usb_hcd, wusbhc, reqntype,
388 wValue, wIndex, buf, wLength);
399 dev_err(wusbhc->
dev,
"%s (%p [%p]) UNIMPLEMENTED\n", __func__,
409 dev_err(wusbhc->
dev,
"%s (%p [%p]) UNIMPLEMENTED\n", __func__,
419 dev_err(wusbhc->
dev,
"%s (%p [%p], port_idx %u) UNIMPLEMENTED\n",
420 __func__, usb_hcd, wusbhc, port_idx);
426 static void wusb_port_init(
struct wusb_port *port)
437 size_t port_size, itr;
441 goto error_port_alloc;
442 for (itr = 0; itr < wusbhc->
ports_max; itr++)
443 wusb_port_init(&wusbhc->
port[itr]);