1 /* $NetBSD: sl811hs.c,v 1.5 2005/02/27 00:27:02 perry Exp $ */
4 * Copyright (c) 2001 The NetBSD Foundation, Inc.
7 * This code is derived from software contributed to The NetBSD Foundation
10 * Redistribution and use in source and binary forms, with or without
11 * modification, are permitted provided that the following conditions
13 * 1. Redistributions of source code must retain the above copyright
14 * notice, this list of conditions and the following disclaimer.
15 * 2. Redistributions in binary form must reproduce the above copyright
16 * notice, this list of conditions and the following disclaimer in the
17 * documentation and/or other materials provided with the distribution.
18 * 3. All advertising materials mentioning features or use of this software
19 * must display the following acknowledgement:
20 * This product includes software developed by the NetBSD
21 * Foundation, Inc. and its contributors.
22 * 4. Neither the name of The NetBSD Foundation nor the names of its
23 * contributors may be used to endorse or promote products derived
24 * from this software without specific prior written permission.
26 * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
27 * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
28 * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
29 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
30 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
31 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
32 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
33 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
34 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
35 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
36 * POSSIBILITY OF SUCH DAMAGE.
41 * ScanLogic SL811HS/T USB Host Controller
44 * !! HIGHLY EXPERIMENTAL CODE !!
47 #include <sys/cdefs.h>
48 //_RCSID(0, "$NetBSD: sl811hs.c,v 1.5 2005/02/27 00:27:02 perry Exp $");
50 #include "opt_slhci.h"
52 #include <sys/param.h>
53 #include <sys/systm.h>
54 #include <sys/kernel.h>
57 #include <sys/malloc.h>
59 #include <machine/bus.h>
60 #include <machine/cpu.h>
61 #include <sys/module.h>
63 #include <dev/usb/usb.h>
64 #include <dev/usb/usbdi.h>
65 #include <dev/usb/usbdivar.h>
66 #include <dev/usb/usb_mem.h>
67 #include <dev/usb/usb_port.h>
70 #include <dev/usb/sl811hsreg.h>
71 #include <dev/usb/sl811hsvar.h>
73 __FBSDID("$FreeBSD$");
75 static inline u_int8_t sl11read(struct slhci_softc *, int);
76 static inline void sl11write(struct slhci_softc *, int, u_int8_t);
77 static inline void sl11read_region(struct slhci_softc *, u_char *, int, int);
78 static inline void sl11write_region(struct slhci_softc *, int, u_char *, int);
80 static void sl11_reset(struct slhci_softc *);
81 static void sl11_speed(struct slhci_softc *);
83 static usbd_status slhci_open(usbd_pipe_handle);
84 static void slhci_softintr(void *);
85 static void slhci_poll(struct usbd_bus *);
86 static void slhci_poll_hub(void *);
87 static void slhci_poll_device(void *arg);
88 static usbd_status slhci_allocm(struct usbd_bus *, usb_dma_t *, u_int32_t);
89 static void slhci_freem(struct usbd_bus *, usb_dma_t *);
90 static usbd_xfer_handle slhci_allocx(struct usbd_bus *);
91 static void slhci_freex(struct usbd_bus *, usbd_xfer_handle);
93 static int slhci_str(usb_string_descriptor_t *, int, const char *);
95 static usbd_status slhci_root_ctrl_transfer(usbd_xfer_handle);
96 static usbd_status slhci_root_ctrl_start(usbd_xfer_handle);
97 static void slhci_root_ctrl_abort(usbd_xfer_handle);
98 static void slhci_root_ctrl_close(usbd_pipe_handle);
99 static void slhci_root_ctrl_done(usbd_xfer_handle);
101 static usbd_status slhci_root_intr_transfer(usbd_xfer_handle);
102 static usbd_status slhci_root_intr_start(usbd_xfer_handle);
103 static void slhci_root_intr_abort(usbd_xfer_handle);
104 static void slhci_root_intr_close(usbd_pipe_handle);
105 static void slhci_root_intr_done(usbd_xfer_handle);
107 static usbd_status slhci_device_ctrl_transfer(usbd_xfer_handle);
108 static usbd_status slhci_device_ctrl_start(usbd_xfer_handle);
109 static void slhci_device_ctrl_abort(usbd_xfer_handle);
110 static void slhci_device_ctrl_close(usbd_pipe_handle);
111 static void slhci_device_ctrl_done(usbd_xfer_handle);
113 static usbd_status slhci_device_intr_transfer(usbd_xfer_handle);
114 static usbd_status slhci_device_intr_start(usbd_xfer_handle);
115 static void slhci_device_intr_abort(usbd_xfer_handle);
116 static void slhci_device_intr_close(usbd_pipe_handle);
117 static void slhci_device_intr_done(usbd_xfer_handle);
119 static usbd_status slhci_device_isoc_transfer(usbd_xfer_handle);
120 static usbd_status slhci_device_isoc_start(usbd_xfer_handle);
121 static void slhci_device_isoc_abort(usbd_xfer_handle);
122 static void slhci_device_isoc_close(usbd_pipe_handle);
123 static void slhci_device_isoc_done(usbd_xfer_handle);
125 static usbd_status slhci_device_bulk_transfer(usbd_xfer_handle);
126 static usbd_status slhci_device_bulk_start(usbd_xfer_handle);
127 static void slhci_device_bulk_abort(usbd_xfer_handle);
128 static void slhci_device_bulk_close(usbd_pipe_handle);
129 static void slhci_device_bulk_done(usbd_xfer_handle);
131 static int slhci_transaction(struct slhci_softc *,
132 usbd_pipe_handle, u_int8_t, int, u_char *, u_int8_t);
133 static void slhci_noop(usbd_pipe_handle);
134 static void slhci_abort_xfer(usbd_xfer_handle, usbd_status);
135 static void slhci_device_clear_toggle(usbd_pipe_handle);
140 #define SLHCI_INTR_ENDPT (1)
143 #define D_TRACE (0x0001) /* function trace */
144 #define D_MSG (0x0002) /* debug messages */
145 #define D_XFER (0x0004) /* transfer messages (noisy!) */
146 #define D_MEM (0x0008) /* memory allocation */
148 int slhci_debug = D_MSG | D_XFER;
149 #define DPRINTF(z,x) if((slhci_debug&(z))!=0)printf x
150 void print_req(usb_device_request_t *);
151 void print_req_hub(usb_device_request_t *);
152 void print_dumpreg(struct slhci_softc *);
153 void print_xfer(usbd_xfer_handle);
159 /* XXX: sync with argument */
160 static const char *sltypestr [] = {
166 struct usbd_bus_methods slhci_bus_methods = {
176 struct usbd_pipe_methods slhci_root_ctrl_methods = {
177 slhci_root_ctrl_transfer,
178 slhci_root_ctrl_start,
179 slhci_root_ctrl_abort,
180 slhci_root_ctrl_close,
182 slhci_root_ctrl_done,
185 struct usbd_pipe_methods slhci_root_intr_methods = {
186 slhci_root_intr_transfer,
187 slhci_root_intr_start,
188 slhci_root_intr_abort,
189 slhci_root_intr_close,
191 slhci_root_intr_done,
194 struct usbd_pipe_methods slhci_device_ctrl_methods = {
195 slhci_device_ctrl_transfer,
196 slhci_device_ctrl_start,
197 slhci_device_ctrl_abort,
198 slhci_device_ctrl_close,
200 slhci_device_ctrl_done,
203 struct usbd_pipe_methods slhci_device_intr_methods = {
204 slhci_device_intr_transfer,
205 slhci_device_intr_start,
206 slhci_device_intr_abort,
207 slhci_device_intr_close,
208 slhci_device_clear_toggle,
209 slhci_device_intr_done,
212 struct usbd_pipe_methods slhci_device_isoc_methods = {
213 slhci_device_isoc_transfer,
214 slhci_device_isoc_start,
215 slhci_device_isoc_abort,
216 slhci_device_isoc_close,
218 slhci_device_isoc_done,
221 struct usbd_pipe_methods slhci_device_bulk_methods = {
222 slhci_device_bulk_transfer,
223 slhci_device_bulk_start,
224 slhci_device_bulk_abort,
225 slhci_device_bulk_close,
227 slhci_device_bulk_done,
231 struct usbd_pipe pipe;
236 * SL811HS Register read/write routine
238 static inline u_int8_t
239 sl11read(struct slhci_softc *sc, int reg)
244 bus_space_write_1(sc->sc_iot, sc->sc_ioh, SL11_IDX_ADDR, reg);
245 b = bus_space_read_1(sc->sc_iot, sc->sc_ioh, SL11_IDX_DATA);
248 outb(0x4000, reg&0xff);
249 return (inb(0x4001)&0xff);
254 sl11write(struct slhci_softc *sc, int reg, u_int8_t data)
258 bus_space_write_1(sc->sc_iot, sc->sc_ioh, SL11_IDX_ADDR, reg);
259 bus_space_write_1(sc->sc_iot, sc->sc_ioh, SL11_IDX_DATA, data);
261 outb(0x4000, reg&0xff);
262 outb(0x4000, data&0xff);
267 sl11read_region(struct slhci_softc *sc, u_char *buf, int reg, int len)
270 bus_space_write_1(sc->sc_iot, sc->sc_ioh, SL11_IDX_ADDR, reg);
271 for (i = 0; i < len; i++)
272 buf[i] = bus_space_read_1(sc->sc_iot, sc->sc_ioh, SL11_IDX_DATA);
276 sl11write_region(struct slhci_softc *sc, int reg, u_char *buf, int len)
279 bus_space_write_1(sc->sc_iot, sc->sc_ioh, SL11_IDX_ADDR, reg);
280 for (i = 0; i < len; i++)
281 bus_space_write_1(sc->sc_iot, sc->sc_ioh, SL11_IDX_DATA, buf[i]);
285 * USB bus reset. From sl811hs_appnote.pdf, p22
288 sl11_reset(struct slhci_softc *sc)
292 DPRINTF(D_TRACE, ("%s() ", __FUNCTION__));
293 // r = sl11read(sc, SL11_CTRL);
295 sl11write(sc, SL11_CTRL, r | SL11_CTRL_RESETENGINE);
297 sl11write(sc, SL11_CTRL, r | SL11_CTRL_JKSTATE | SL11_CTRL_RESETENGINE); delay_ms(150);
298 sl11write(sc, SL11_CTRL, r | SL11_CTRL_RESETENGINE);
300 sl11write(sc, SL11_CTRL, r);
304 * Detect the speed of attached device.
307 sl11_speed(struct slhci_softc *sc)
311 sl11write(sc, SL11_ISR, 0xff);
312 r = sl11read(sc, SL11_ISR);
313 if ((r & SL11_ISR_RESET)) {
314 DPRINTF(D_MSG, ("NC "));
315 sl11write(sc, SL11_ISR, SL11_ISR_RESET);
319 if ((sl11read(sc, SL11_ISR) & SL11_ISR_RESET)) {
320 sl11write(sc, SL11_ISR, 0xff);
322 u_int8_t pol = 0, ctrl = 0;
325 if (r & SL11_ISR_DATA) {
326 DPRINTF(D_MSG, ("FS "));
328 ctrl = SL11_CTRL_EOF2;
329 sc->sc_fullspeed = 1;
331 DPRINTF(D_MSG, ("LS "));
332 pol = SL811_CSOF_POLARITY;
333 ctrl = SL11_CTRL_LOWSPEED;
334 sc->sc_fullspeed = 0;
336 sl11write(sc, SL811_CSOF, pol | SL811_CSOF_MASTER | 0x2e);
337 sl11write(sc, SL11_DATA, 0xe0);
338 sl11write(sc, SL11_CTRL, ctrl | SL11_CTRL_ENABLESOF);
341 sl11write(sc, SL11_E0PID, (SL11_PID_SOF << 4) + 0);
342 sl11write(sc, SL11_E0DEV, 0);
343 sl11write(sc, SL11_E0CTRL, SL11_EPCTRL_ARM);
348 * If detect some known controller, return the type.
349 * If does not, return -1.
352 sl811hs_find(struct slhci_softc *sc)
357 rev = sl11read(sc, SL11_REV) >> 4;
358 if (rev >= SLTYPE_SL11H && rev <= SLTYPE_SL811HS_R14)
360 return sc->sc_sltype;
364 * Attach SL11H/SL811HS. Return 0 if success.
367 slhci_attach(struct slhci_softc *sc)
370 /* Detect and check the controller type */
372 rev = sl811hs_find(sc);
376 printf("%s: ScanLogic %s USB Host Controller",
377 device_get_nameunit(sc->sc_bus.bdev), sltypestr[(rev > 0)]);
381 case SLTYPE_SL811HS_R12:
382 printf(" (rev 1.2)");
384 case SLTYPE_SL811HS_R14:
385 printf(" (rev 1.4)");
388 printf(" (unknown revision)");
395 sc->sc_bus.usbrev = USBREV_1_1;
396 sc->sc_bus.methods = &slhci_bus_methods;
397 sc->sc_bus.pipe_size = sizeof(struct slhci_pipe);
398 sc->sc_bus.parent_dmatag = NULL; /* XXX */
399 sc->sc_bus.buffer_dmatag = NULL; /* XXX */
400 STAILQ_INIT(&sc->sc_free_xfers);
402 usb_callout_init(sc->sc_poll_handle);
404 /* Disable interrupt, then wait 40msec */
405 sl11write(sc, SL11_IER, 0x00);
408 /* Initialize controller */
409 sl11write(sc, SL811_CSOF, SL811_CSOF_MASTER | 0x2e);
412 sl11write(sc, SL11_ISR, 0xff);
414 /* Disable interrupt, then wait 40msec */
415 sl11write(sc, SL11_IER, 0x00);
417 /* Reset USB engine */
418 sl11write(sc, SL11_CTRL, SL11_CTRL_JKSTATE| SL11_CTRL_RESETENGINE);
420 sl11write(sc, SL11_CTRL, 0x00);
423 /* USB Bus reset for GET_PORT_STATUS */
425 sc->sc_flags = SLF_ATTACHED;
427 /* Enable interrupt */
428 sl11write(sc, SL11_IER, SL11_IER_INSERT);
429 /* x68k Nereid USB controller needs it */
430 if (sc->sc_enable_intr)
431 sc->sc_enable_intr(sc->sc_arg, INTR_ON);
440 slhci_intr(void *arg)
442 struct slhci_softc *sc = arg;
449 if((sc->sc_flags & SLF_ATTACHED) == 0)
452 r = sl11read(sc, SL11_ISR);
456 sl11write(sc, SL11_ISR, SL11_ISR_DATA | SL11_ISR_SOFTIMER);
458 if ((r & SL11_ISR_RESET)) {
459 sc->sc_flags |= SLF_RESET;
460 sl11write(sc, SL11_ISR, SL11_ISR_RESET);
462 if ((r & SL11_ISR_INSERT)) {
463 sc->sc_flags |= SLF_INSERT;
464 sl11write(sc, SL11_ISR, SL11_ISR_INSERT);
469 (sl11read(sc, SL11_CTRL) & SL11_CTRL_SUSPEND)
470 ? "\20\x8""D+\7RESUME\6INSERT\5SOF\4res\3""BABBLE\2USBB\1USBA"
471 : "\20\x8""D+\7RESET\6INSERT\5SOF\4res\3""BABBLE\2USBB\1USBA",
472 bitbuf, sizeof(bitbuf));
473 DPRINTF(D_XFER, ("I=%s ", bitbuf));
474 #endif /* SLHCI_DEBUG */
480 slhci_open(usbd_pipe_handle pipe)
482 usbd_device_handle dev = pipe->device;
483 struct slhci_softc *sc = (struct slhci_softc *)dev->bus;
484 usb_endpoint_descriptor_t *ed = pipe->endpoint->edesc;
486 DPRINTF(D_TRACE, ("slhci_open(addr=%d,ep=%d,scaddr=%d)",
487 dev->address, ed->bEndpointAddress, sc->sc_addr));
489 if (dev->address == sc->sc_addr) {
490 switch (ed->bEndpointAddress) {
491 case USB_CONTROL_ENDPOINT:
492 pipe->methods = &slhci_root_ctrl_methods;
494 case UE_DIR_IN | SLHCI_INTR_ENDPT:
495 pipe->methods = &slhci_root_intr_methods;
498 printf("open:endpointErr!\n");
502 switch (ed->bmAttributes & UE_XFERTYPE) {
504 DPRINTF(D_MSG, ("control "));
505 pipe->methods = &slhci_device_ctrl_methods;
508 DPRINTF(D_MSG, ("interrupt "));
509 pipe->methods = &slhci_device_intr_methods;
512 DPRINTF(D_MSG, ("isochronous "));
513 pipe->methods = &slhci_device_isoc_methods;
516 DPRINTF(D_MSG, ("bluk "));
517 pipe->methods = &slhci_device_bulk_methods;
521 return USBD_NORMAL_COMPLETION;
525 slhci_softintr(void *arg)
527 DPRINTF(D_TRACE, ("%s()", __FUNCTION__));
531 slhci_poll(struct usbd_bus *bus)
533 DPRINTF(D_TRACE, ("%s()", __FUNCTION__));
537 * Emulation of interrupt transfer for status change endpoint
541 slhci_poll_hub(void *arg)
543 usbd_xfer_handle xfer = arg;
544 usbd_pipe_handle pipe = xfer->pipe;
545 struct slhci_softc *sc = (struct slhci_softc *)pipe->device->bus;
549 usb_callout(sc->sc_poll_handle, sc->sc_interval, slhci_poll_hub, xfer);
551 /* USB spec 11.13.3 (p.260) */
554 if ((sc->sc_flags & (SLF_INSERT | SLF_RESET))) {
556 DPRINTF(D_TRACE, ("!"));
559 /* no change, return NAK */
564 xfer->status = USBD_NORMAL_COMPLETION;
566 xfer->device->bus->intr_context++;
567 usb_transfer_complete(xfer);
568 xfer->device->bus->intr_context--;
573 slhci_allocm(struct usbd_bus *bus, usb_dma_t *dma, u_int32_t size)
575 struct slhci_softc *sc = (struct slhci_softc *)bus;
577 DPRINTF(D_MEM, ("SLallocm"));
578 return usb_allocmem(&sc->sc_bus, size, 0, dma);
582 slhci_freem(struct usbd_bus *bus, usb_dma_t *dma)
584 struct slhci_softc *sc = (struct slhci_softc *)bus;
586 DPRINTF(D_MEM, ("SLfreem"));
587 usb_freemem(&sc->sc_bus, dma);
591 slhci_allocx(struct usbd_bus *bus)
593 struct slhci_softc *sc = (struct slhci_softc *)bus;
594 usbd_xfer_handle xfer;
596 DPRINTF(D_MEM, ("SLallocx"));
598 xfer = STAILQ_FIRST(&sc->sc_free_xfers);
600 STAILQ_REMOVE_HEAD(&sc->sc_free_xfers, next);
602 if (xfer->busy_free != XFER_FREE) {
603 printf("slhci_allocx: xfer=%p not free, 0x%08x\n",
604 xfer, xfer->busy_free);
608 xfer = malloc(sizeof(*xfer), M_USB, M_NOWAIT);
612 memset(xfer, 0, sizeof(*xfer));
614 xfer->busy_free = XFER_BUSY;
622 slhci_freex(struct usbd_bus *bus, usbd_xfer_handle xfer)
624 struct slhci_softc *sc = (struct slhci_softc *)bus;
626 DPRINTF(D_MEM, ("SLfreex"));
629 if (xfer->busy_free != XFER_BUSY) {
630 printf("slhci_freex: xfer=%p not busy, 0x%08x\n",
631 xfer, xfer->busy_free);
634 xfer->busy_free = XFER_FREE;
636 STAILQ_INSERT_HEAD(&sc->sc_free_xfers, xfer, next);
640 slhci_noop(usbd_pipe_handle pipe)
642 DPRINTF(D_TRACE, ("%s()", __FUNCTION__));
646 * Data structures and routines to emulate the root hub.
648 usb_device_descriptor_t slhci_devd = {
649 USB_DEVICE_DESCRIPTOR_SIZE,
650 UDESC_DEVICE, /* type */
651 {0x01, 0x01}, /* USB version */
652 UDCLASS_HUB, /* class */
653 UDSUBCLASS_HUB, /* subclass */
656 {USB_VENDOR_SCANLOGIC & 0xff, /* vendor ID (low) */
657 USB_VENDOR_SCANLOGIC >> 8 }, /* vendor ID (high) */
658 {0} /* ? */, /* product ID */
660 1, /* index to manufacturer */
661 2, /* index to product */
662 0, /* index to serial number */
663 1 /* number of configurations */
666 usb_config_descriptor_t slhci_confd = {
667 USB_CONFIG_DESCRIPTOR_SIZE,
669 {USB_CONFIG_DESCRIPTOR_SIZE +
670 USB_INTERFACE_DESCRIPTOR_SIZE +
671 USB_ENDPOINT_DESCRIPTOR_SIZE},
672 1, /* number of interfaces */
673 1, /* configuration value */
674 0, /* index to configuration */
675 UC_SELF_POWERED, /* attributes */
676 15 /* max current is 30mA... */
679 usb_interface_descriptor_t slhci_ifcd = {
680 USB_INTERFACE_DESCRIPTOR_SIZE,
682 0, /* interface number */
683 0, /* alternate setting */
684 1, /* number of endpoint */
685 UICLASS_HUB, /* class */
686 UISUBCLASS_HUB, /* subclass */
688 0 /* index to interface */
691 usb_endpoint_descriptor_t slhci_endpd = {
692 USB_ENDPOINT_DESCRIPTOR_SIZE,
694 UE_DIR_IN | SLHCI_INTR_ENDPT, /* endpoint address */
695 UE_INTERRUPT, /* attributes */
696 {8}, /* max packet size */
700 usb_hub_descriptor_t slhci_hubd = {
701 USB_HUB_DESCRIPTOR_SIZE,
703 1, /* number of ports */
704 {UHD_PWR_INDIVIDUAL | UHD_OC_NONE, 0}, /* hub characteristics */
705 20 /* ? */, /* 5:power on to power good */
706 50, /* 6:maximum current */
707 { 0x00 }, /* both ports are removable */
708 { 0x00 } /* port power control mask */
712 slhci_str(usb_string_descriptor_t *p, int l, const char *s)
718 p->bLength = 2 * strlen(s) + 2;
721 p->bDescriptorType = UDESC_STRING;
723 for (i = 0; s[i] && l > 1; i++, l -= 2)
724 USETW2(p->bString[i], 0, s[i]);
729 slhci_root_ctrl_transfer(usbd_xfer_handle xfer)
733 DPRINTF(D_TRACE, ("SLRCtrans "));
735 /* Insert last in queue */
736 error = usb_insert_transfer(xfer);
738 DPRINTF(D_MSG, ("usb_insert_transfer returns err! "));
743 * Pipe isn't running (otherwise error would be USBD_INPROG),
746 return slhci_root_ctrl_start(STAILQ_FIRST(&xfer->pipe->queue));
750 slhci_root_ctrl_start(usbd_xfer_handle xfer)
752 struct slhci_softc *sc = (struct slhci_softc *)xfer->pipe->device->bus;
753 usb_device_request_t *req;
754 int len, value, index, l, s, status;
757 usb_port_status_t ps;
762 DPRINTF(D_TRACE, ("SLRCstart "));
764 req = &xfer->request;
766 len = UGETW(req->wLength);
767 value = UGETW(req->wValue);
768 index = UGETW(req->wIndex);
774 if ((slhci_debug & D_TRACE))
778 #define C(x,y) ((x) | ((y) << 8))
779 switch (C(req->bRequest, req->bmRequestType)) {
780 case C(UR_CLEAR_FEATURE, UT_WRITE_DEVICE):
781 case C(UR_CLEAR_FEATURE, UT_WRITE_INTERFACE):
782 case C(UR_CLEAR_FEATURE, UT_WRITE_ENDPOINT):
783 DPRINTF(D_MSG, ("UR_CLEAR_FEATURE "));
785 case C(UR_GET_CONFIG, UT_READ_DEVICE):
786 DPRINTF(D_MSG, ("UR_GET_CONFIG "));
788 *(u_int8_t *)buf = sc->sc_conf;
792 case C(UR_GET_DESCRIPTOR, UT_READ_DEVICE):
793 switch (value >> 8) {
795 DPRINTF(D_MSG, ("UDESC_DEVICE "));
796 if ((value & 0xff) != 0) {
797 error = USBD_IOERROR;
800 totlen = l = min(len, USB_DEVICE_DESCRIPTOR_SIZE);
801 memcpy(buf, &slhci_devd, l);
804 DPRINTF(D_MSG, ("UDESC_CONFIG "));
805 if ((value & 0xff) != 0) {
806 error = USBD_IOERROR;
809 totlen = l = min(len, USB_CONFIG_DESCRIPTOR_SIZE);
810 memcpy(buf, &slhci_confd, l);
811 buf = (char *)buf + l;
814 l = min(len, USB_INTERFACE_DESCRIPTOR_SIZE);
816 memcpy(buf, &slhci_ifcd, l);
817 buf = (char *)buf + l;
820 l = min(len, USB_ENDPOINT_DESCRIPTOR_SIZE);
822 memcpy(buf, &slhci_endpd, l);
825 DPRINTF(D_MSG, ("UDESC_STR "));
828 *(u_int8_t *)buf = 0;
830 switch (value & 0xff) {
834 totlen = slhci_str(buf, len, "ScanLogic");
836 case 2: /* Product */
837 snprintf(slbuf, sizeof(slbuf), "%s root hub",
838 sltypestr[sc->sc_sltype>0]);
839 totlen = slhci_str(buf, len, slbuf);
842 printf("strerr%d ", value & 0xff);
847 printf("unknownGetDescriptor=%x", value);
848 error = USBD_IOERROR;
852 case C(UR_GET_INTERFACE, UT_READ_INTERFACE):
853 /* Get Interface, 9.4.4 */
855 *(u_int8_t *)buf = 0;
859 case C(UR_GET_STATUS, UT_READ_DEVICE):
860 /* Get Status from device, 9.4.5 */
862 USETW(((usb_status_t *)buf)->wStatus, UDS_SELF_POWERED);
866 case C(UR_GET_STATUS, UT_READ_INTERFACE):
867 case C(UR_GET_STATUS, UT_READ_ENDPOINT):
868 /* Get Status from interface, endpoint, 9.4.5 */
870 USETW(((usb_status_t *)buf)->wStatus, 0);
874 case C(UR_SET_ADDRESS, UT_WRITE_DEVICE):
875 /* Set Address, 9.4.6 */
876 DPRINTF(D_MSG, ("UR_SET_ADDRESS "));
877 if (value >= USB_MAX_DEVICES) {
878 error = USBD_IOERROR;
883 case C(UR_SET_CONFIG, UT_WRITE_DEVICE):
884 /* Set Configuration, 9.4.7 */
885 DPRINTF(D_MSG, ("UR_SET_CONFIG "));
886 if (value != 0 && value != 1) {
887 error = USBD_IOERROR;
892 case C(UR_SET_DESCRIPTOR, UT_WRITE_DEVICE):
893 /* Set Descriptor, 9.4.8, not supported */
894 DPRINTF(D_MSG, ("UR_SET_DESCRIPTOR,WRITE_DEVICE not supported\n"));
896 case C(UR_SET_FEATURE, UT_WRITE_DEVICE):
897 case C(UR_SET_FEATURE, UT_WRITE_INTERFACE):
898 case C(UR_SET_FEATURE, UT_WRITE_ENDPOINT):
899 /* Set Feature, 9.4.9, not supported */
900 DPRINTF(D_MSG, ("UR_SET_FEATURE not supported\n"));
901 error = USBD_IOERROR;
903 case C(UR_SET_INTERFACE, UT_WRITE_INTERFACE):
904 /* Set Interface, 9.4.10, not supported */
906 case C(UR_SYNCH_FRAME, UT_WRITE_ENDPOINT):
907 /* Synch Frame, 9.4.11, not supported */
911 * Hub specific requests
913 case C(UR_CLEAR_FEATURE, UT_WRITE_CLASS_DEVICE):
914 /* Clear Hub Feature, 11.16.2.1, not supported */
915 DPRINTF(D_MSG, ("ClearHubFeature not supported\n"));
917 case C(UR_CLEAR_FEATURE, UT_WRITE_CLASS_OTHER):
918 /* Clear Port Feature, 11.16.2.2 */
920 error = USBD_IOERROR;
925 DPRINTF(D_MSG, ("POWER_OFF "));
926 sc->sc_powerstat = POWER_OFF;
927 /* x68k Nereid USB controller needs it */
928 if (sc->sc_enable_power)
929 sc->sc_enable_power(sc, sc->sc_powerstat);
931 case UHF_PORT_SUSPEND:
932 DPRINTF(D_MSG, ("SUSPEND "));
933 sl11write(sc, SL11_CTRL,
934 sl11read(sc, SL11_CTRL) & ~SL11_CTRL_SUSPEND);
936 case UHF_C_PORT_CONNECTION:
937 sc->sc_change &= ~UPS_C_CONNECT_STATUS;
939 case UHF_C_PORT_RESET:
940 sc->sc_change &= ~UPS_C_PORT_RESET;
942 case UHF_PORT_ENABLE:
944 case UHF_C_PORT_SUSPEND:
945 case UHF_C_PORT_ENABLE:
946 case UHF_C_PORT_OVER_CURRENT:
948 printf("ClrPortFeatERR:value=0x%x ", value);
949 error = USBD_IOERROR;
952 //DPRINTF(D_XFER, ("CH=%04x ", sc->sc_change));
954 case C(UR_GET_BUS_STATE, UT_READ_CLASS_OTHER):
955 /* Get Bus State, 11.16.2.3, not supported */
956 /* shall return a STALL... */
958 case C(UR_GET_DESCRIPTOR, UT_READ_CLASS_DEVICE):
959 /* Get Hub Descriptor, 11.16.2.4 */
961 error = USBD_IOERROR;
964 l = min(len, USB_HUB_DESCRIPTOR_SIZE);
966 memcpy(buf, &slhci_hubd, l);
968 case C(UR_GET_STATUS, UT_READ_CLASS_DEVICE):
969 /* Get Hub Status, 11.16.2.5 */
970 DPRINTF(D_MSG, ("UR_GET_STATUS RCD"));
972 error = USBD_IOERROR;
978 case C(UR_GET_STATUS, UT_READ_CLASS_OTHER):
979 /* Get Port Status, 11.16.2.6 */
980 if (index != 1 || len != 4) {
981 printf("index=%d,len=%d ", index, len);
982 error = USBD_IOERROR;
987 * o port is always enabled.
988 * o cannot detect over current.
991 sc->sc_change &= ~(UPS_C_CONNECT_STATUS | UPS_C_PORT_RESET);
992 if ((sc->sc_flags & SLF_INSERT)) {
993 sc->sc_flags &= ~SLF_INSERT;
994 sc->sc_change |= UPS_C_CONNECT_STATUS;
996 if ((sc->sc_flags & SLF_RESET)) {
997 sc->sc_flags &= ~SLF_RESET;
998 sc->sc_change |= UPS_C_PORT_RESET;
1002 * XXX It can recognize that device is detached,
1003 * while there is sl11_speed() here.
1009 * o port is always enabled.
1010 * o cannot detect over current.
1014 status |= UPS_CURRENT_CONNECT_STATUS | UPS_PORT_ENABLED;
1015 r = sl11read(sc, SL11_CTRL);
1016 if (r & SL11_CTRL_SUSPEND)
1017 status |= UPS_SUSPEND;
1018 if (sc->sc_powerstat)
1019 status |= UPS_PORT_POWER;
1020 if (!sc->sc_fullspeed)
1021 status |= UPS_LOW_SPEED;
1023 //DPRINTF(D_XFER, ("ST=%04x,CH=%04x ", status, sc->sc_change));
1024 USETW(ps.wPortStatus, status);
1025 USETW(ps.wPortChange, sc->sc_change);
1026 l = min(len, sizeof(ps));
1027 memcpy(buf, &ps, l);
1030 case C(UR_SET_DESCRIPTOR, UT_WRITE_CLASS_DEVICE):
1031 /* Set Hub Descriptor, 11.16.2.7, not supported */
1033 error = USBD_IOERROR;
1035 case C(UR_SET_FEATURE, UT_WRITE_CLASS_DEVICE):
1036 /* Set Hub Feature, 11.16.2.8, not supported */
1038 case C(UR_SET_FEATURE, UT_WRITE_CLASS_OTHER):
1039 /* Set Port Feature, 11.16.2.9 */
1041 printf("index=%d ", index);
1042 error = USBD_IOERROR;
1046 case UHF_PORT_RESET:
1047 DPRINTF(D_MSG, ("PORT_RESET "));
1052 case UHF_PORT_POWER:
1053 DPRINTF(D_MSG, ("PORT_POWER "));
1054 sc->sc_powerstat = POWER_ON;
1055 /* x68k Nereid USB controller needs it */
1056 if (sc->sc_enable_power)
1057 sc->sc_enable_power(sc, sc->sc_powerstat);
1061 printf("SetPortFeatERR=0x%x ", value);
1062 error = USBD_IOERROR;
1067 DPRINTF(D_MSG, ("ioerr(UR=%02x,UT=%02x) ",
1068 req->bRequest, req->bmRequestType));
1069 error = USBD_IOERROR;
1072 xfer->actlen = totlen;
1073 error = USBD_NORMAL_COMPLETION;
1075 xfer->status = error;
1077 usb_transfer_complete(xfer);
1079 return USBD_IN_PROGRESS;
1083 slhci_root_ctrl_abort(usbd_xfer_handle xfer)
1085 DPRINTF(D_TRACE, ("SLRCabort "));
1089 slhci_root_ctrl_close(usbd_pipe_handle pipe)
1091 DPRINTF(D_TRACE, ("SLRCclose "));
1095 slhci_root_ctrl_done(usbd_xfer_handle xfer)
1097 DPRINTF(D_TRACE, ("SLRCdone\n"));
1101 slhci_root_intr_transfer(usbd_xfer_handle xfer)
1105 DPRINTF(D_TRACE, ("SLRItransfer "));
1107 /* Insert last in queue */
1108 error = usb_insert_transfer(xfer);
1113 * Pipe isn't running (otherwise error would be USBD_INPROG),
1116 return slhci_root_intr_start(STAILQ_FIRST(&xfer->pipe->queue));
1120 slhci_root_intr_start(usbd_xfer_handle xfer)
1122 usbd_pipe_handle pipe = xfer->pipe;
1123 struct slhci_softc *sc = (struct slhci_softc *)pipe->device->bus;
1125 DPRINTF(D_TRACE, ("SLRIstart "));
1127 sc->sc_interval = MS_TO_TICKS(xfer->pipe->endpoint->edesc->bInterval);
1128 usb_callout(sc->sc_poll_handle, sc->sc_interval, slhci_poll_hub, xfer);
1129 sc->sc_intr_xfer = xfer;
1130 return USBD_IN_PROGRESS;
1134 slhci_root_intr_abort(usbd_xfer_handle xfer)
1136 DPRINTF(D_TRACE, ("SLRIabort "));
1140 slhci_root_intr_close(usbd_pipe_handle pipe)
1142 struct slhci_softc *sc = (struct slhci_softc *)pipe->device->bus;
1144 DPRINTF(D_TRACE, ("SLRIclose "));
1146 usb_uncallout(sc->sc_poll_handle, slhci_poll_hub, sc->sc_intr_xfer);
1147 sc->sc_intr_xfer = NULL;
1151 slhci_root_intr_done(usbd_xfer_handle xfer)
1153 //DPRINTF(D_XFER, ("RIdn "));
1157 slhci_device_ctrl_transfer(usbd_xfer_handle xfer)
1161 DPRINTF(D_TRACE, ("C"));
1163 error = usb_insert_transfer(xfer);
1167 return slhci_device_ctrl_start(STAILQ_FIRST(&xfer->pipe->queue));
1171 slhci_device_ctrl_start(usbd_xfer_handle xfer)
1173 usb_device_request_t *req = &xfer->request;
1174 usbd_pipe_handle pipe = xfer->pipe;
1175 struct slhci_softc *sc = (struct slhci_softc *)pipe->device->bus;
1176 usbd_status status = USBD_NORMAL_COMPLETION;
1178 int pid = SL11_PID_OUT;
1179 int len, actlen, size;
1181 u_int8_t toggle = 0;
1183 DPRINTF(D_TRACE, ("st "));
1185 if ((slhci_debug & D_TRACE))
1189 /* SETUP transaction */
1190 if (slhci_transaction(sc, pipe, SL11_PID_SETUP,
1191 sizeof(*req), (u_char*)req, toggle) == -1) {
1192 status = USBD_IOERROR;
1195 toggle ^= SL11_EPCTRL_DATATOGGLE;
1197 /* DATA transaction */
1199 len = UGETW(req->wLength);
1202 if (req->bmRequestType & UT_READ)
1204 for (; actlen < len; ) {
1205 size = min(len - actlen, 8/* Minimum size */);
1206 if (slhci_transaction(sc, pipe, pid, size, buf, toggle) == -1)
1208 toggle ^= SL11_EPCTRL_DATATOGGLE;
1213 xfer->actlen = actlen;
1216 if (pid == SL11_PID_IN)
1220 if (slhci_transaction(sc, pipe, pid, 0, NULL, toggle) == -1)
1221 status = USBD_IOERROR;
1224 xfer->status = status;
1227 if((slhci_debug & D_TRACE) && UGETW(req->wLength) > 0){
1229 for(i=0; i < UGETW(req->wLength); i++)
1230 printf("%02x", ((unsigned char *)xfer->buffer)[i]);
1235 usb_transfer_complete(xfer);
1237 return USBD_IN_PROGRESS;
1241 slhci_device_ctrl_abort(usbd_xfer_handle xfer)
1243 DPRINTF(D_TRACE, ("Cab "));
1244 slhci_abort_xfer(xfer, USBD_CANCELLED);
1248 slhci_device_ctrl_close(usbd_pipe_handle pipe)
1250 DPRINTF(D_TRACE, ("Ccl "));
1254 slhci_device_ctrl_done(usbd_xfer_handle xfer)
1256 DPRINTF(D_TRACE, ("Cdn "));
1260 slhci_device_intr_transfer(usbd_xfer_handle xfer)
1264 DPRINTF(D_TRACE, ("INTRtrans "));
1266 error = usb_insert_transfer(xfer);
1270 return slhci_device_intr_start(STAILQ_FIRST(&xfer->pipe->queue));
1274 slhci_device_intr_start(usbd_xfer_handle xfer)
1276 usbd_pipe_handle pipe = xfer->pipe;
1277 struct slhci_xfer *sx;
1279 DPRINTF(D_TRACE, ("INTRstart "));
1281 sx = malloc(sizeof(*sx), M_USB, M_NOWAIT);
1284 memset(sx, 0, sizeof(*sx));
1288 /* initialize callout */
1289 usb_callout_init(sx->sx_callout_t);
1290 usb_callout(sx->sx_callout_t,
1291 MS_TO_TICKS(pipe->endpoint->edesc->bInterval),
1292 slhci_poll_device, sx);
1295 return USBD_IN_PROGRESS;
1298 return USBD_IOERROR;
1302 slhci_poll_device(void *arg)
1304 struct slhci_xfer *sx = (struct slhci_xfer *)arg;
1305 usbd_xfer_handle xfer = sx->sx_xfer;
1306 usbd_pipe_handle pipe = xfer->pipe;
1307 struct slhci_softc *sc = (struct slhci_softc *)pipe->device->bus;
1313 DPRINTF(D_TRACE, ("pldev"));
1315 usb_callout(sx->sx_callout_t,
1316 MS_TO_TICKS(pipe->endpoint->edesc->bInterval),
1317 slhci_poll_device, sx);
1319 /* interrupt transfer */
1320 pid = (UE_GET_DIR(pipe->endpoint->edesc->bEndpointAddress) == UE_DIR_IN)
1321 ? SL11_PID_IN : SL11_PID_OUT;
1324 r = slhci_transaction(sc, pipe, pid, xfer->length, buf, 0/*toggle*/);
1326 DPRINTF(D_MSG, ("%s error", __FUNCTION__));
1329 /* no change, return NAK */
1333 xfer->status = USBD_NORMAL_COMPLETION;
1335 xfer->device->bus->intr_context++;
1336 usb_transfer_complete(xfer);
1337 xfer->device->bus->intr_context--;
1342 slhci_device_intr_abort(usbd_xfer_handle xfer)
1344 struct slhci_xfer *sx;
1346 DPRINTF(D_TRACE, ("INTRabort "));
1350 usb_uncallout(sx->sx_callout_t, slhci_poll_device, sx);
1352 xfer->hcpriv = NULL;
1354 printf("%s: sx == NULL!\n", __FUNCTION__);
1356 slhci_abort_xfer(xfer, USBD_CANCELLED);
1360 slhci_device_intr_close(usbd_pipe_handle pipe)
1362 DPRINTF(D_TRACE, ("INTRclose "));
1366 slhci_device_intr_done(usbd_xfer_handle xfer)
1368 DPRINTF(D_TRACE, ("INTRdone "));
1372 slhci_device_isoc_transfer(usbd_xfer_handle xfer)
1374 DPRINTF(D_TRACE, ("S"));
1375 return USBD_NORMAL_COMPLETION;
1379 slhci_device_isoc_start(usbd_xfer_handle xfer)
1381 DPRINTF(D_TRACE, ("st "));
1382 return USBD_NORMAL_COMPLETION;
1386 slhci_device_isoc_abort(usbd_xfer_handle xfer)
1388 DPRINTF(D_TRACE, ("Sab "));
1392 slhci_device_isoc_close(usbd_pipe_handle pipe)
1394 DPRINTF(D_TRACE, ("Scl "));
1398 slhci_device_isoc_done(usbd_xfer_handle xfer)
1400 DPRINTF(D_TRACE, ("Sdn "));
1404 slhci_device_bulk_transfer(usbd_xfer_handle xfer)
1406 DPRINTF(D_TRACE, ("B"));
1407 return USBD_NORMAL_COMPLETION;
1411 slhci_device_bulk_start(usbd_xfer_handle xfer)
1413 DPRINTF(D_TRACE, ("st "));
1414 return USBD_NORMAL_COMPLETION;
1418 slhci_device_bulk_abort(usbd_xfer_handle xfer)
1420 DPRINTF(D_TRACE, ("Bab "));
1424 slhci_device_bulk_close(usbd_pipe_handle pipe)
1426 DPRINTF(D_TRACE, ("Bcl "));
1430 slhci_device_bulk_done(usbd_xfer_handle xfer)
1432 DPRINTF(D_TRACE, ("Bdn "));
1435 #define DATA0_RD (0x03)
1436 #define DATA0_WR (0x07)
1437 #define SLHCI_TIMEOUT (5000)
1441 * return 1 if ACK, 0 if NAK, -1 if error.
1444 slhci_transaction(struct slhci_softc *sc, usbd_pipe_handle pipe,
1445 u_int8_t pid, int len, u_char *buf, u_int8_t toggle)
1455 u_int8_t result = 0;
1456 u_int8_t devaddr = pipe->device->address;
1457 u_int8_t endpointaddr = pipe->endpoint->edesc->bEndpointAddress;
1459 u_int8_t cmd = DATA0_RD;
1461 endpoint = UE_GET_ADDR(endpointaddr);
1462 DPRINTF(D_XFER, ("\n(%x,%d%s%d,%d) ",
1463 pid, len, (pid == SL11_PID_IN) ? "<-" : "->", devaddr, endpoint));
1466 sl11write(sc, SL11_E0ADDR, 0x40);
1467 sl11write(sc, SL11_E0LEN, len);
1468 sl11write(sc, SL11_E0PID, (pid << 4) + endpoint);
1469 sl11write(sc, SL11_E0DEV, devaddr);
1471 /* Set buffer unless PID_IN */
1472 if (pid != SL11_PID_IN) {
1474 sl11write_region(sc, 0x40, buf, len);
1479 pl = (len >> 3) + 3;
1481 /* Low speed device via HUB */
1482 /* XXX does not work... */
1483 if ((sc->sc_fullspeed) && pipe->device->speed == USB_SPEED_LOW) {
1485 cmd |= SL11_EPCTRL_PREAMBLE;
1488 * SL811HS/T rev 1.2 has a bug, when it got PID_IN
1489 * from LowSpeed device via HUB.
1491 if (sc->sc_sltype == SLTYPE_SL811HS_R12 && pid == SL11_PID_IN) {
1493 DPRINTF(D_MSG, ("LSvH "));
1498 if (sl11read(sc, SL811_CSOF) <= (u_int8_t)pl)
1499 cmd |= SL11_EPCTRL_SOF;
1502 sl11write(sc, SL11_ISR, 0xff);
1503 sl11write(sc, SL11_E0CTRL, cmd | toggle);
1506 for (timeout = SLHCI_TIMEOUT; timeout; timeout--) {
1507 isr = sl11read(sc, SL11_ISR);
1508 if ((isr & SL11_ISR_USBA))
1512 /* Check result status */
1513 result = sl11read(sc, SL11_E0STAT);
1514 if (!(result & SL11_EPSTAT_NAK) && ls_via_hub) {
1515 /* Resend PID_IN within 20usec */
1516 sl11write(sc, SL11_ISR, 0xff);
1517 sl11write(sc, SL11_E0CTRL, SL11_EPCTRL_ARM);
1520 sl11write(sc, SL11_ISR, 0xff);
1522 DPRINTF(D_XFER, ("t=%d i=%x ", SLHCI_TIMEOUT - timeout, isr));
1524 bitmask_snprintf(result,
1525 "\20\x8STALL\7NAK\6OV\5SETUP\4DATA1\3TIMEOUT\2ERR\1ACK",
1527 DPRINTF(D_XFER, ("STAT=%s ", str));
1530 if ((result & SL11_EPSTAT_ERROR))
1533 if ((result & SL11_EPSTAT_NAK))
1536 /* Read buffer if PID_IN */
1537 if (pid == SL11_PID_IN && len > 0) {
1538 sl11read_region(sc, buf, 0x40, len);
1540 for (i = 0; i < len; i++)
1541 DPRINTF(D_XFER, ("%02X ", buf[i]));
1549 slhci_abort_xfer(usbd_xfer_handle xfer, usbd_status status)
1551 xfer->status = status;
1552 usb_transfer_complete(xfer);
1556 slhci_device_clear_toggle(usbd_pipe_handle pipe)
1558 DPRINTF(D_TRACE, ("SLdevice_clear_toggle "));
1563 print_req(usb_device_request_t *r)
1580 int req, type, value, index, len;
1583 type = r->bmRequestType;
1584 value = UGETW(r->wValue);
1585 index = UGETW(r->wIndex);
1586 len = UGETW(r->wLength);
1588 printf("%x,%s,v=%d,i=%d,l=%d ",
1589 type, xmes[req], value, index, len);
1593 print_req_hub(usb_device_request_t *r)
1600 { 1, 0x20, "ClrHubFeat" },
1601 { 1, 0x23, "ClrPortFeat" },
1602 { 2, 0xa3, "GetBusState" },
1603 { 6, 0xa0, "GetHubDesc" },
1604 { 0, 0xa0, "GetHubStat" },
1605 { 0, 0xa3, "GetPortStat" },
1606 { 7, 0x20, "SetHubDesc" },
1607 { 3, 0x20, "SetHubFeat" },
1608 { 3, 0x23, "SetPortFeat" },
1612 int value, index, len;
1614 value = UGETW(r->wValue);
1615 index = UGETW(r->wIndex);
1616 len = UGETW(r->wLength);
1617 for (i = 0; ; i++) {
1618 if (conf[i].req == -1 )
1619 return print_req(r);
1620 if (r->bmRequestType == conf[i].type && r->bRequest == conf[i].req) {
1621 printf("%s", conf[i].str);
1625 printf(",v=%d,i=%d,l=%d ", value, index, len);
1629 print_dumpreg(struct slhci_softc *sc)
1631 printf("00=%02x,01=%02x,02=%02x,03=%02x,04=%02x,"
1632 "08=%02x,09=%02x,0A=%02x,0B=%02x,0C=%02x,",
1633 sl11read(sc, 0), sl11read(sc, 1),
1634 sl11read(sc, 2), sl11read(sc, 3),
1635 sl11read(sc, 4), sl11read(sc, 8),
1636 sl11read(sc, 9), sl11read(sc, 10),
1637 sl11read(sc, 11), sl11read(sc, 12)
1639 printf("CR1=%02x,IER=%02x,0D=%02x,0E=%02x,0F=%02x ",
1640 sl11read(sc, 5), sl11read(sc, 6),
1641 sl11read(sc, 13), sl11read(sc, 14), sl11read(sc, 15)
1646 print_xfer(usbd_xfer_handle xfer)
1648 printf("xfer: length=%d, actlen=%d, flags=%x, timeout=%d,",
1649 xfer->length, xfer->actlen, xfer->flags, xfer->timeout);
1650 printf("request{ ");
1651 print_req_hub(&xfer->request);
1654 #endif /* SLHCI_DEBUG */