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>
69 #include <dev/usb/sl811hsreg.h>
70 #include <dev/usb/sl811hsvar.h>
72 __FBSDID("$FreeBSD$");
74 static inline u_int8_t sl11read(struct slhci_softc *, int);
75 static inline void sl11write(struct slhci_softc *, int, u_int8_t);
76 static inline void sl11read_region(struct slhci_softc *, u_char *, int, int);
77 static inline void sl11write_region(struct slhci_softc *, int, u_char *, int);
79 static void sl11_reset(struct slhci_softc *);
80 static void sl11_speed(struct slhci_softc *);
82 static usbd_status slhci_open(usbd_pipe_handle);
83 static void slhci_softintr(void *);
84 static void slhci_poll(struct usbd_bus *);
85 static void slhci_poll_hub(void *);
86 static void slhci_poll_device(void *arg);
87 static usbd_status slhci_allocm(struct usbd_bus *, usb_dma_t *, u_int32_t);
88 static void slhci_freem(struct usbd_bus *, usb_dma_t *);
89 static usbd_xfer_handle slhci_allocx(struct usbd_bus *);
90 static void slhci_freex(struct usbd_bus *, usbd_xfer_handle);
92 static int slhci_str(usb_string_descriptor_t *, int, const char *);
94 static usbd_status slhci_root_ctrl_transfer(usbd_xfer_handle);
95 static usbd_status slhci_root_ctrl_start(usbd_xfer_handle);
96 static void slhci_root_ctrl_abort(usbd_xfer_handle);
97 static void slhci_root_ctrl_close(usbd_pipe_handle);
98 static void slhci_root_ctrl_done(usbd_xfer_handle);
100 static usbd_status slhci_root_intr_transfer(usbd_xfer_handle);
101 static usbd_status slhci_root_intr_start(usbd_xfer_handle);
102 static void slhci_root_intr_abort(usbd_xfer_handle);
103 static void slhci_root_intr_close(usbd_pipe_handle);
104 static void slhci_root_intr_done(usbd_xfer_handle);
106 static usbd_status slhci_device_ctrl_transfer(usbd_xfer_handle);
107 static usbd_status slhci_device_ctrl_start(usbd_xfer_handle);
108 static void slhci_device_ctrl_abort(usbd_xfer_handle);
109 static void slhci_device_ctrl_close(usbd_pipe_handle);
110 static void slhci_device_ctrl_done(usbd_xfer_handle);
112 static usbd_status slhci_device_intr_transfer(usbd_xfer_handle);
113 static usbd_status slhci_device_intr_start(usbd_xfer_handle);
114 static void slhci_device_intr_abort(usbd_xfer_handle);
115 static void slhci_device_intr_close(usbd_pipe_handle);
116 static void slhci_device_intr_done(usbd_xfer_handle);
118 static usbd_status slhci_device_isoc_transfer(usbd_xfer_handle);
119 static usbd_status slhci_device_isoc_start(usbd_xfer_handle);
120 static void slhci_device_isoc_abort(usbd_xfer_handle);
121 static void slhci_device_isoc_close(usbd_pipe_handle);
122 static void slhci_device_isoc_done(usbd_xfer_handle);
124 static usbd_status slhci_device_bulk_transfer(usbd_xfer_handle);
125 static usbd_status slhci_device_bulk_start(usbd_xfer_handle);
126 static void slhci_device_bulk_abort(usbd_xfer_handle);
127 static void slhci_device_bulk_close(usbd_pipe_handle);
128 static void slhci_device_bulk_done(usbd_xfer_handle);
130 static int slhci_transaction(struct slhci_softc *,
131 usbd_pipe_handle, u_int8_t, int, u_char *, u_int8_t);
132 static void slhci_noop(usbd_pipe_handle);
133 static void slhci_abort_xfer(usbd_xfer_handle, usbd_status);
134 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 USBDEVNAME(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.dmatag = sc->sc_dmat;
399 SIMPLEQ_INIT(&sc->sc_free_xfers);
401 usb_callout_init(sc->sc_poll_handle);
403 /* Disable interrupt, then wait 40msec */
404 sl11write(sc, SL11_IER, 0x00);
407 /* Initialize controller */
408 sl11write(sc, SL811_CSOF, SL811_CSOF_MASTER | 0x2e);
411 sl11write(sc, SL11_ISR, 0xff);
413 /* Disable interrupt, then wait 40msec */
414 sl11write(sc, SL11_IER, 0x00);
416 /* Reset USB engine */
417 sl11write(sc, SL11_CTRL, SL11_CTRL_JKSTATE| SL11_CTRL_RESETENGINE);
419 sl11write(sc, SL11_CTRL, 0x00);
422 /* USB Bus reset for GET_PORT_STATUS */
424 sc->sc_flags = SLF_ATTACHED;
426 /* Enable interrupt */
427 sl11write(sc, SL11_IER, SL11_IER_INSERT);
428 /* x68k Nereid USB controller needs it */
429 if (sc->sc_enable_intr)
430 sc->sc_enable_intr(sc->sc_arg, INTR_ON);
439 slhci_intr(void *arg)
441 struct slhci_softc *sc = arg;
448 if((sc->sc_flags & SLF_ATTACHED) == 0)
451 r = sl11read(sc, SL11_ISR);
455 sl11write(sc, SL11_ISR, SL11_ISR_DATA | SL11_ISR_SOFTIMER);
457 if ((r & SL11_ISR_RESET)) {
458 sc->sc_flags |= SLF_RESET;
459 sl11write(sc, SL11_ISR, SL11_ISR_RESET);
461 if ((r & SL11_ISR_INSERT)) {
462 sc->sc_flags |= SLF_INSERT;
463 sl11write(sc, SL11_ISR, SL11_ISR_INSERT);
468 (sl11read(sc, SL11_CTRL) & SL11_CTRL_SUSPEND)
469 ? "\20\x8""D+\7RESUME\6INSERT\5SOF\4res\3""BABBLE\2USBB\1USBA"
470 : "\20\x8""D+\7RESET\6INSERT\5SOF\4res\3""BABBLE\2USBB\1USBA",
471 bitbuf, sizeof(bitbuf));
472 DPRINTF(D_XFER, ("I=%s ", bitbuf));
473 #endif /* SLHCI_DEBUG */
479 slhci_open(usbd_pipe_handle pipe)
481 usbd_device_handle dev = pipe->device;
482 struct slhci_softc *sc = (struct slhci_softc *)dev->bus;
483 usb_endpoint_descriptor_t *ed = pipe->endpoint->edesc;
485 DPRINTF(D_TRACE, ("slhci_open(addr=%d,ep=%d,scaddr=%d)",
486 dev->address, ed->bEndpointAddress, sc->sc_addr));
488 if (dev->address == sc->sc_addr) {
489 switch (ed->bEndpointAddress) {
490 case USB_CONTROL_ENDPOINT:
491 pipe->methods = &slhci_root_ctrl_methods;
493 case UE_DIR_IN | SLHCI_INTR_ENDPT:
494 pipe->methods = &slhci_root_intr_methods;
497 printf("open:endpointErr!\n");
501 switch (ed->bmAttributes & UE_XFERTYPE) {
503 DPRINTF(D_MSG, ("control "));
504 pipe->methods = &slhci_device_ctrl_methods;
507 DPRINTF(D_MSG, ("interrupt "));
508 pipe->methods = &slhci_device_intr_methods;
511 DPRINTF(D_MSG, ("isochronous "));
512 pipe->methods = &slhci_device_isoc_methods;
515 DPRINTF(D_MSG, ("bluk "));
516 pipe->methods = &slhci_device_bulk_methods;
520 return USBD_NORMAL_COMPLETION;
524 slhci_softintr(void *arg)
526 DPRINTF(D_TRACE, ("%s()", __FUNCTION__));
530 slhci_poll(struct usbd_bus *bus)
532 DPRINTF(D_TRACE, ("%s()", __FUNCTION__));
536 * Emulation of interrupt transfer for status change endpoint
540 slhci_poll_hub(void *arg)
542 usbd_xfer_handle xfer = arg;
543 usbd_pipe_handle pipe = xfer->pipe;
544 struct slhci_softc *sc = (struct slhci_softc *)pipe->device->bus;
548 usb_callout(sc->sc_poll_handle, sc->sc_interval, slhci_poll_hub, xfer);
550 /* USB spec 11.13.3 (p.260) */
551 p = KERNADDR(&xfer->dmabuf, 0);
553 if ((sc->sc_flags & (SLF_INSERT | SLF_RESET))) {
555 DPRINTF(D_TRACE, ("!"));
558 /* no change, return NAK */
563 xfer->status = USBD_NORMAL_COMPLETION;
565 xfer->device->bus->intr_context++;
566 usb_transfer_complete(xfer);
567 xfer->device->bus->intr_context--;
572 slhci_allocm(struct usbd_bus *bus, usb_dma_t *dma, u_int32_t size)
574 struct slhci_softc *sc = (struct slhci_softc *)bus;
576 DPRINTF(D_MEM, ("SLallocm"));
577 return usb_allocmem(&sc->sc_bus, size, 0, dma);
581 slhci_freem(struct usbd_bus *bus, usb_dma_t *dma)
583 struct slhci_softc *sc = (struct slhci_softc *)bus;
585 DPRINTF(D_MEM, ("SLfreem"));
586 usb_freemem(&sc->sc_bus, dma);
590 slhci_allocx(struct usbd_bus *bus)
592 struct slhci_softc *sc = (struct slhci_softc *)bus;
593 usbd_xfer_handle xfer;
595 DPRINTF(D_MEM, ("SLallocx"));
597 xfer = SIMPLEQ_FIRST(&sc->sc_free_xfers);
599 SIMPLEQ_REMOVE_HEAD(&sc->sc_free_xfers, next);
601 if (xfer->busy_free != XFER_FREE) {
602 printf("slhci_allocx: xfer=%p not free, 0x%08x\n",
603 xfer, xfer->busy_free);
607 xfer = malloc(sizeof(*xfer), M_USB, M_NOWAIT);
611 memset(xfer, 0, sizeof(*xfer));
613 xfer->busy_free = XFER_BUSY;
621 slhci_freex(struct usbd_bus *bus, usbd_xfer_handle xfer)
623 struct slhci_softc *sc = (struct slhci_softc *)bus;
625 DPRINTF(D_MEM, ("SLfreex"));
628 if (xfer->busy_free != XFER_BUSY) {
629 printf("slhci_freex: xfer=%p not busy, 0x%08x\n",
630 xfer, xfer->busy_free);
633 xfer->busy_free = XFER_FREE;
635 SIMPLEQ_INSERT_HEAD(&sc->sc_free_xfers, xfer, next);
639 slhci_noop(usbd_pipe_handle pipe)
641 DPRINTF(D_TRACE, ("%s()", __FUNCTION__));
645 * Data structures and routines to emulate the root hub.
647 usb_device_descriptor_t slhci_devd = {
648 USB_DEVICE_DESCRIPTOR_SIZE,
649 UDESC_DEVICE, /* type */
650 {0x01, 0x01}, /* USB version */
651 UDCLASS_HUB, /* class */
652 UDSUBCLASS_HUB, /* subclass */
655 {USB_VENDOR_SCANLOGIC & 0xff, /* vendor ID (low) */
656 USB_VENDOR_SCANLOGIC >> 8 }, /* vendor ID (high) */
657 {0} /* ? */, /* product ID */
659 1, /* index to manufacturer */
660 2, /* index to product */
661 0, /* index to serial number */
662 1 /* number of configurations */
665 usb_config_descriptor_t slhci_confd = {
666 USB_CONFIG_DESCRIPTOR_SIZE,
668 {USB_CONFIG_DESCRIPTOR_SIZE +
669 USB_INTERFACE_DESCRIPTOR_SIZE +
670 USB_ENDPOINT_DESCRIPTOR_SIZE},
671 1, /* number of interfaces */
672 1, /* configuration value */
673 0, /* index to configuration */
674 UC_SELF_POWERED, /* attributes */
675 15 /* max current is 30mA... */
678 usb_interface_descriptor_t slhci_ifcd = {
679 USB_INTERFACE_DESCRIPTOR_SIZE,
681 0, /* interface number */
682 0, /* alternate setting */
683 1, /* number of endpoint */
684 UICLASS_HUB, /* class */
685 UISUBCLASS_HUB, /* subclass */
687 0 /* index to interface */
690 usb_endpoint_descriptor_t slhci_endpd = {
691 USB_ENDPOINT_DESCRIPTOR_SIZE,
693 UE_DIR_IN | SLHCI_INTR_ENDPT, /* endpoint address */
694 UE_INTERRUPT, /* attributes */
695 {8}, /* max packet size */
699 usb_hub_descriptor_t slhci_hubd = {
700 USB_HUB_DESCRIPTOR_SIZE,
702 1, /* number of ports */
703 {UHD_PWR_INDIVIDUAL | UHD_OC_NONE, 0}, /* hub characteristics */
704 20 /* ? */, /* 5:power on to power good */
705 50, /* 6:maximum current */
706 { 0x00 }, /* both ports are removable */
707 { 0x00 } /* port power control mask */
711 slhci_str(usb_string_descriptor_t *p, int l, const char *s)
717 p->bLength = 2 * strlen(s) + 2;
720 p->bDescriptorType = UDESC_STRING;
722 for (i = 0; s[i] && l > 1; i++, l -= 2)
723 USETW2(p->bString[i], 0, s[i]);
728 slhci_root_ctrl_transfer(usbd_xfer_handle xfer)
732 DPRINTF(D_TRACE, ("SLRCtrans "));
734 /* Insert last in queue */
735 error = usb_insert_transfer(xfer);
737 DPRINTF(D_MSG, ("usb_insert_transfer returns err! "));
742 * Pipe isn't running (otherwise error would be USBD_INPROG),
745 return slhci_root_ctrl_start(SIMPLEQ_FIRST(&xfer->pipe->queue));
749 slhci_root_ctrl_start(usbd_xfer_handle xfer)
751 struct slhci_softc *sc = (struct slhci_softc *)xfer->pipe->device->bus;
752 usb_device_request_t *req;
753 int len, value, index, l, s, status;
756 usb_port_status_t ps;
761 DPRINTF(D_TRACE, ("SLRCstart "));
763 req = &xfer->request;
765 len = UGETW(req->wLength);
766 value = UGETW(req->wValue);
767 index = UGETW(req->wIndex);
770 buf = KERNADDR(&xfer->dmabuf, 0);
773 if ((slhci_debug & D_TRACE))
777 #define C(x,y) ((x) | ((y) << 8))
778 switch (C(req->bRequest, req->bmRequestType)) {
779 case C(UR_CLEAR_FEATURE, UT_WRITE_DEVICE):
780 case C(UR_CLEAR_FEATURE, UT_WRITE_INTERFACE):
781 case C(UR_CLEAR_FEATURE, UT_WRITE_ENDPOINT):
782 DPRINTF(D_MSG, ("UR_CLEAR_FEATURE "));
784 case C(UR_GET_CONFIG, UT_READ_DEVICE):
785 DPRINTF(D_MSG, ("UR_GET_CONFIG "));
787 *(u_int8_t *)buf = sc->sc_conf;
791 case C(UR_GET_DESCRIPTOR, UT_READ_DEVICE):
792 switch (value >> 8) {
794 DPRINTF(D_MSG, ("UDESC_DEVICE "));
795 if ((value & 0xff) != 0) {
796 error = USBD_IOERROR;
799 totlen = l = min(len, USB_DEVICE_DESCRIPTOR_SIZE);
800 memcpy(buf, &slhci_devd, l);
803 DPRINTF(D_MSG, ("UDESC_CONFIG "));
804 if ((value & 0xff) != 0) {
805 error = USBD_IOERROR;
808 totlen = l = min(len, USB_CONFIG_DESCRIPTOR_SIZE);
809 memcpy(buf, &slhci_confd, l);
810 buf = (char *)buf + l;
813 l = min(len, USB_INTERFACE_DESCRIPTOR_SIZE);
815 memcpy(buf, &slhci_ifcd, l);
816 buf = (char *)buf + l;
819 l = min(len, USB_ENDPOINT_DESCRIPTOR_SIZE);
821 memcpy(buf, &slhci_endpd, l);
824 DPRINTF(D_MSG, ("UDESC_STR "));
827 *(u_int8_t *)buf = 0;
829 switch (value & 0xff) {
833 totlen = slhci_str(buf, len, "ScanLogic");
835 case 2: /* Product */
836 snprintf(slbuf, sizeof(slbuf), "%s root hub",
837 sltypestr[sc->sc_sltype>0]);
838 totlen = slhci_str(buf, len, slbuf);
841 printf("strerr%d ", value & 0xff);
846 printf("unknownGetDescriptor=%x", value);
847 error = USBD_IOERROR;
851 case C(UR_GET_INTERFACE, UT_READ_INTERFACE):
852 /* Get Interface, 9.4.4 */
854 *(u_int8_t *)buf = 0;
858 case C(UR_GET_STATUS, UT_READ_DEVICE):
859 /* Get Status from device, 9.4.5 */
861 USETW(((usb_status_t *)buf)->wStatus, UDS_SELF_POWERED);
865 case C(UR_GET_STATUS, UT_READ_INTERFACE):
866 case C(UR_GET_STATUS, UT_READ_ENDPOINT):
867 /* Get Status from interface, endpoint, 9.4.5 */
869 USETW(((usb_status_t *)buf)->wStatus, 0);
873 case C(UR_SET_ADDRESS, UT_WRITE_DEVICE):
874 /* Set Address, 9.4.6 */
875 DPRINTF(D_MSG, ("UR_SET_ADDRESS "));
876 if (value >= USB_MAX_DEVICES) {
877 error = USBD_IOERROR;
882 case C(UR_SET_CONFIG, UT_WRITE_DEVICE):
883 /* Set Configuration, 9.4.7 */
884 DPRINTF(D_MSG, ("UR_SET_CONFIG "));
885 if (value != 0 && value != 1) {
886 error = USBD_IOERROR;
891 case C(UR_SET_DESCRIPTOR, UT_WRITE_DEVICE):
892 /* Set Descriptor, 9.4.8, not supported */
893 DPRINTF(D_MSG, ("UR_SET_DESCRIPTOR,WRITE_DEVICE not supported\n"));
895 case C(UR_SET_FEATURE, UT_WRITE_DEVICE):
896 case C(UR_SET_FEATURE, UT_WRITE_INTERFACE):
897 case C(UR_SET_FEATURE, UT_WRITE_ENDPOINT):
898 /* Set Feature, 9.4.9, not supported */
899 DPRINTF(D_MSG, ("UR_SET_FEATURE not supported\n"));
900 error = USBD_IOERROR;
902 case C(UR_SET_INTERFACE, UT_WRITE_INTERFACE):
903 /* Set Interface, 9.4.10, not supported */
905 case C(UR_SYNCH_FRAME, UT_WRITE_ENDPOINT):
906 /* Synch Frame, 9.4.11, not supported */
910 * Hub specific requests
912 case C(UR_CLEAR_FEATURE, UT_WRITE_CLASS_DEVICE):
913 /* Clear Hub Feature, 11.16.2.1, not supported */
914 DPRINTF(D_MSG, ("ClearHubFeature not supported\n"));
916 case C(UR_CLEAR_FEATURE, UT_WRITE_CLASS_OTHER):
917 /* Clear Port Feature, 11.16.2.2 */
919 error = USBD_IOERROR;
924 DPRINTF(D_MSG, ("POWER_OFF "));
925 sc->sc_powerstat = POWER_OFF;
926 /* x68k Nereid USB controller needs it */
927 if (sc->sc_enable_power)
928 sc->sc_enable_power(sc, sc->sc_powerstat);
930 case UHF_PORT_SUSPEND:
931 DPRINTF(D_MSG, ("SUSPEND "));
932 sl11write(sc, SL11_CTRL,
933 sl11read(sc, SL11_CTRL) & ~SL11_CTRL_SUSPEND);
935 case UHF_C_PORT_CONNECTION:
936 sc->sc_change &= ~UPS_C_CONNECT_STATUS;
938 case UHF_C_PORT_RESET:
939 sc->sc_change &= ~UPS_C_PORT_RESET;
941 case UHF_PORT_ENABLE:
943 case UHF_C_PORT_SUSPEND:
944 case UHF_C_PORT_ENABLE:
945 case UHF_C_PORT_OVER_CURRENT:
947 printf("ClrPortFeatERR:value=0x%x ", value);
948 error = USBD_IOERROR;
951 //DPRINTF(D_XFER, ("CH=%04x ", sc->sc_change));
953 case C(UR_GET_BUS_STATE, UT_READ_CLASS_OTHER):
954 /* Get Bus State, 11.16.2.3, not supported */
955 /* shall return a STALL... */
957 case C(UR_GET_DESCRIPTOR, UT_READ_CLASS_DEVICE):
958 /* Get Hub Descriptor, 11.16.2.4 */
960 error = USBD_IOERROR;
963 l = min(len, USB_HUB_DESCRIPTOR_SIZE);
965 memcpy(buf, &slhci_hubd, l);
967 case C(UR_GET_STATUS, UT_READ_CLASS_DEVICE):
968 /* Get Hub Status, 11.16.2.5 */
969 DPRINTF(D_MSG, ("UR_GET_STATUS RCD"));
971 error = USBD_IOERROR;
977 case C(UR_GET_STATUS, UT_READ_CLASS_OTHER):
978 /* Get Port Status, 11.16.2.6 */
979 if (index != 1 || len != 4) {
980 printf("index=%d,len=%d ", index, len);
981 error = USBD_IOERROR;
986 * o port is always enabled.
987 * o cannot detect over current.
990 sc->sc_change &= ~(UPS_C_CONNECT_STATUS | UPS_C_PORT_RESET);
991 if ((sc->sc_flags & SLF_INSERT)) {
992 sc->sc_flags &= ~SLF_INSERT;
993 sc->sc_change |= UPS_C_CONNECT_STATUS;
995 if ((sc->sc_flags & SLF_RESET)) {
996 sc->sc_flags &= ~SLF_RESET;
997 sc->sc_change |= UPS_C_PORT_RESET;
1001 * XXX It can recognize that device is detached,
1002 * while there is sl11_speed() here.
1008 * o port is always enabled.
1009 * o cannot detect over current.
1013 status |= UPS_CURRENT_CONNECT_STATUS | UPS_PORT_ENABLED;
1014 r = sl11read(sc, SL11_CTRL);
1015 if (r & SL11_CTRL_SUSPEND)
1016 status |= UPS_SUSPEND;
1017 if (sc->sc_powerstat)
1018 status |= UPS_PORT_POWER;
1019 if (!sc->sc_fullspeed)
1020 status |= UPS_LOW_SPEED;
1022 //DPRINTF(D_XFER, ("ST=%04x,CH=%04x ", status, sc->sc_change));
1023 USETW(ps.wPortStatus, status);
1024 USETW(ps.wPortChange, sc->sc_change);
1025 l = min(len, sizeof(ps));
1026 memcpy(buf, &ps, l);
1029 case C(UR_SET_DESCRIPTOR, UT_WRITE_CLASS_DEVICE):
1030 /* Set Hub Descriptor, 11.16.2.7, not supported */
1032 error = USBD_IOERROR;
1034 case C(UR_SET_FEATURE, UT_WRITE_CLASS_DEVICE):
1035 /* Set Hub Feature, 11.16.2.8, not supported */
1037 case C(UR_SET_FEATURE, UT_WRITE_CLASS_OTHER):
1038 /* Set Port Feature, 11.16.2.9 */
1040 printf("index=%d ", index);
1041 error = USBD_IOERROR;
1045 case UHF_PORT_RESET:
1046 DPRINTF(D_MSG, ("PORT_RESET "));
1051 case UHF_PORT_POWER:
1052 DPRINTF(D_MSG, ("PORT_POWER "));
1053 sc->sc_powerstat = POWER_ON;
1054 /* x68k Nereid USB controller needs it */
1055 if (sc->sc_enable_power)
1056 sc->sc_enable_power(sc, sc->sc_powerstat);
1060 printf("SetPortFeatERR=0x%x ", value);
1061 error = USBD_IOERROR;
1066 DPRINTF(D_MSG, ("ioerr(UR=%02x,UT=%02x) ",
1067 req->bRequest, req->bmRequestType));
1068 error = USBD_IOERROR;
1071 xfer->actlen = totlen;
1072 error = USBD_NORMAL_COMPLETION;
1074 xfer->status = error;
1076 usb_transfer_complete(xfer);
1078 return USBD_IN_PROGRESS;
1082 slhci_root_ctrl_abort(usbd_xfer_handle xfer)
1084 DPRINTF(D_TRACE, ("SLRCabort "));
1088 slhci_root_ctrl_close(usbd_pipe_handle pipe)
1090 DPRINTF(D_TRACE, ("SLRCclose "));
1094 slhci_root_ctrl_done(usbd_xfer_handle xfer)
1096 DPRINTF(D_TRACE, ("SLRCdone\n"));
1100 slhci_root_intr_transfer(usbd_xfer_handle xfer)
1104 DPRINTF(D_TRACE, ("SLRItransfer "));
1106 /* Insert last in queue */
1107 error = usb_insert_transfer(xfer);
1112 * Pipe isn't running (otherwise error would be USBD_INPROG),
1115 return slhci_root_intr_start(SIMPLEQ_FIRST(&xfer->pipe->queue));
1119 slhci_root_intr_start(usbd_xfer_handle xfer)
1121 usbd_pipe_handle pipe = xfer->pipe;
1122 struct slhci_softc *sc = (struct slhci_softc *)pipe->device->bus;
1124 DPRINTF(D_TRACE, ("SLRIstart "));
1126 sc->sc_interval = MS_TO_TICKS(xfer->pipe->endpoint->edesc->bInterval);
1127 usb_callout(sc->sc_poll_handle, sc->sc_interval, slhci_poll_hub, xfer);
1128 sc->sc_intr_xfer = xfer;
1129 return USBD_IN_PROGRESS;
1133 slhci_root_intr_abort(usbd_xfer_handle xfer)
1135 DPRINTF(D_TRACE, ("SLRIabort "));
1139 slhci_root_intr_close(usbd_pipe_handle pipe)
1141 struct slhci_softc *sc = (struct slhci_softc *)pipe->device->bus;
1143 DPRINTF(D_TRACE, ("SLRIclose "));
1145 usb_uncallout(sc->sc_poll_handle, slhci_poll_hub, sc->sc_intr_xfer);
1146 sc->sc_intr_xfer = NULL;
1150 slhci_root_intr_done(usbd_xfer_handle xfer)
1152 //DPRINTF(D_XFER, ("RIdn "));
1156 slhci_device_ctrl_transfer(usbd_xfer_handle xfer)
1160 DPRINTF(D_TRACE, ("C"));
1162 error = usb_insert_transfer(xfer);
1166 return slhci_device_ctrl_start(SIMPLEQ_FIRST(&xfer->pipe->queue));
1170 slhci_device_ctrl_start(usbd_xfer_handle xfer)
1172 usb_device_request_t *req = &xfer->request;
1173 usbd_pipe_handle pipe = xfer->pipe;
1174 struct slhci_softc *sc = (struct slhci_softc *)pipe->device->bus;
1175 usbd_status status = USBD_NORMAL_COMPLETION;
1177 int pid = SL11_PID_OUT;
1178 int len, actlen, size;
1180 u_int8_t toggle = 0;
1182 DPRINTF(D_TRACE, ("st "));
1184 if ((slhci_debug & D_TRACE))
1188 /* SETUP transaction */
1189 if (slhci_transaction(sc, pipe, SL11_PID_SETUP,
1190 sizeof(*req), (u_char*)req, toggle) == -1) {
1191 status = USBD_IOERROR;
1194 toggle ^= SL11_EPCTRL_DATATOGGLE;
1196 /* DATA transaction */
1198 len = UGETW(req->wLength);
1200 buf = KERNADDR(&xfer->dmabuf, 0);
1201 if (req->bmRequestType & UT_READ)
1203 for (; actlen < len; ) {
1204 size = min(len - actlen, 8/* Minimum size */);
1205 if (slhci_transaction(sc, pipe, pid, size, buf, toggle) == -1)
1207 toggle ^= SL11_EPCTRL_DATATOGGLE;
1212 xfer->actlen = actlen;
1215 if (pid == SL11_PID_IN)
1219 if (slhci_transaction(sc, pipe, pid, 0, NULL, toggle) == -1)
1220 status = USBD_IOERROR;
1223 xfer->status = status;
1226 if((slhci_debug & D_TRACE) && UGETW(req->wLength) > 0){
1228 for(i=0; i < UGETW(req->wLength); i++)
1229 printf("%02x", *(unsigned char*)(KERNADDR(&xfer->dmabuf, i)));
1234 usb_transfer_complete(xfer);
1236 return USBD_IN_PROGRESS;
1240 slhci_device_ctrl_abort(usbd_xfer_handle xfer)
1242 DPRINTF(D_TRACE, ("Cab "));
1243 slhci_abort_xfer(xfer, USBD_CANCELLED);
1247 slhci_device_ctrl_close(usbd_pipe_handle pipe)
1249 DPRINTF(D_TRACE, ("Ccl "));
1253 slhci_device_ctrl_done(usbd_xfer_handle xfer)
1255 DPRINTF(D_TRACE, ("Cdn "));
1259 slhci_device_intr_transfer(usbd_xfer_handle xfer)
1263 DPRINTF(D_TRACE, ("INTRtrans "));
1265 error = usb_insert_transfer(xfer);
1269 return slhci_device_intr_start(SIMPLEQ_FIRST(&xfer->pipe->queue));
1273 slhci_device_intr_start(usbd_xfer_handle xfer)
1275 usbd_pipe_handle pipe = xfer->pipe;
1276 struct slhci_xfer *sx;
1278 DPRINTF(D_TRACE, ("INTRstart "));
1280 sx = malloc(sizeof(*sx), M_USB, M_NOWAIT);
1283 memset(sx, 0, sizeof(*sx));
1287 /* initialize callout */
1288 usb_callout_init(sx->sx_callout_t);
1289 usb_callout(sx->sx_callout_t,
1290 MS_TO_TICKS(pipe->endpoint->edesc->bInterval),
1291 slhci_poll_device, sx);
1294 return USBD_IN_PROGRESS;
1297 return USBD_IOERROR;
1301 slhci_poll_device(void *arg)
1303 struct slhci_xfer *sx = (struct slhci_xfer *)arg;
1304 usbd_xfer_handle xfer = sx->sx_xfer;
1305 usbd_pipe_handle pipe = xfer->pipe;
1306 struct slhci_softc *sc = (struct slhci_softc *)pipe->device->bus;
1312 DPRINTF(D_TRACE, ("pldev"));
1314 usb_callout(sx->sx_callout_t,
1315 MS_TO_TICKS(pipe->endpoint->edesc->bInterval),
1316 slhci_poll_device, sx);
1318 /* interrupt transfer */
1319 pid = (UE_GET_DIR(pipe->endpoint->edesc->bEndpointAddress) == UE_DIR_IN)
1320 ? SL11_PID_IN : SL11_PID_OUT;
1321 buf = KERNADDR(&xfer->dmabuf, 0);
1323 r = slhci_transaction(sc, pipe, pid, xfer->length, buf, 0/*toggle*/);
1325 DPRINTF(D_MSG, ("%s error", __FUNCTION__));
1328 /* no change, return NAK */
1332 xfer->status = USBD_NORMAL_COMPLETION;
1334 xfer->device->bus->intr_context++;
1335 usb_transfer_complete(xfer);
1336 xfer->device->bus->intr_context--;
1341 slhci_device_intr_abort(usbd_xfer_handle xfer)
1343 struct slhci_xfer *sx;
1345 DPRINTF(D_TRACE, ("INTRabort "));
1349 usb_uncallout(sx->sx_callout_t, slhci_poll_device, sx);
1351 xfer->hcpriv = NULL;
1353 printf("%s: sx == NULL!\n", __FUNCTION__);
1355 slhci_abort_xfer(xfer, USBD_CANCELLED);
1359 slhci_device_intr_close(usbd_pipe_handle pipe)
1361 DPRINTF(D_TRACE, ("INTRclose "));
1365 slhci_device_intr_done(usbd_xfer_handle xfer)
1367 DPRINTF(D_TRACE, ("INTRdone "));
1371 slhci_device_isoc_transfer(usbd_xfer_handle xfer)
1373 DPRINTF(D_TRACE, ("S"));
1374 return USBD_NORMAL_COMPLETION;
1378 slhci_device_isoc_start(usbd_xfer_handle xfer)
1380 DPRINTF(D_TRACE, ("st "));
1381 return USBD_NORMAL_COMPLETION;
1385 slhci_device_isoc_abort(usbd_xfer_handle xfer)
1387 DPRINTF(D_TRACE, ("Sab "));
1391 slhci_device_isoc_close(usbd_pipe_handle pipe)
1393 DPRINTF(D_TRACE, ("Scl "));
1397 slhci_device_isoc_done(usbd_xfer_handle xfer)
1399 DPRINTF(D_TRACE, ("Sdn "));
1403 slhci_device_bulk_transfer(usbd_xfer_handle xfer)
1405 DPRINTF(D_TRACE, ("B"));
1406 return USBD_NORMAL_COMPLETION;
1410 slhci_device_bulk_start(usbd_xfer_handle xfer)
1412 DPRINTF(D_TRACE, ("st "));
1413 return USBD_NORMAL_COMPLETION;
1417 slhci_device_bulk_abort(usbd_xfer_handle xfer)
1419 DPRINTF(D_TRACE, ("Bab "));
1423 slhci_device_bulk_close(usbd_pipe_handle pipe)
1425 DPRINTF(D_TRACE, ("Bcl "));
1429 slhci_device_bulk_done(usbd_xfer_handle xfer)
1431 DPRINTF(D_TRACE, ("Bdn "));
1434 #define DATA0_RD (0x03)
1435 #define DATA0_WR (0x07)
1436 #define SLHCI_TIMEOUT (5000)
1440 * return 1 if ACK, 0 if NAK, -1 if error.
1443 slhci_transaction(struct slhci_softc *sc, usbd_pipe_handle pipe,
1444 u_int8_t pid, int len, u_char *buf, u_int8_t toggle)
1454 u_int8_t result = 0;
1455 u_int8_t devaddr = pipe->device->address;
1456 u_int8_t endpointaddr = pipe->endpoint->edesc->bEndpointAddress;
1458 u_int8_t cmd = DATA0_RD;
1460 endpoint = UE_GET_ADDR(endpointaddr);
1461 DPRINTF(D_XFER, ("\n(%x,%d%s%d,%d) ",
1462 pid, len, (pid == SL11_PID_IN) ? "<-" : "->", devaddr, endpoint));
1465 sl11write(sc, SL11_E0ADDR, 0x40);
1466 sl11write(sc, SL11_E0LEN, len);
1467 sl11write(sc, SL11_E0PID, (pid << 4) + endpoint);
1468 sl11write(sc, SL11_E0DEV, devaddr);
1470 /* Set buffer unless PID_IN */
1471 if (pid != SL11_PID_IN) {
1473 sl11write_region(sc, 0x40, buf, len);
1478 pl = (len >> 3) + 3;
1480 /* Low speed device via HUB */
1481 /* XXX does not work... */
1482 if ((sc->sc_fullspeed) && pipe->device->speed == USB_SPEED_LOW) {
1484 cmd |= SL11_EPCTRL_PREAMBLE;
1487 * SL811HS/T rev 1.2 has a bug, when it got PID_IN
1488 * from LowSpeed device via HUB.
1490 if (sc->sc_sltype == SLTYPE_SL811HS_R12 && pid == SL11_PID_IN) {
1492 DPRINTF(D_MSG, ("LSvH "));
1497 if (sl11read(sc, SL811_CSOF) <= (u_int8_t)pl)
1498 cmd |= SL11_EPCTRL_SOF;
1501 sl11write(sc, SL11_ISR, 0xff);
1502 sl11write(sc, SL11_E0CTRL, cmd | toggle);
1505 for (timeout = SLHCI_TIMEOUT; timeout; timeout--) {
1506 isr = sl11read(sc, SL11_ISR);
1507 if ((isr & SL11_ISR_USBA))
1511 /* Check result status */
1512 result = sl11read(sc, SL11_E0STAT);
1513 if (!(result & SL11_EPSTAT_NAK) && ls_via_hub) {
1514 /* Resend PID_IN within 20usec */
1515 sl11write(sc, SL11_ISR, 0xff);
1516 sl11write(sc, SL11_E0CTRL, SL11_EPCTRL_ARM);
1519 sl11write(sc, SL11_ISR, 0xff);
1521 DPRINTF(D_XFER, ("t=%d i=%x ", SLHCI_TIMEOUT - timeout, isr));
1523 bitmask_snprintf(result,
1524 "\20\x8STALL\7NAK\6OV\5SETUP\4DATA1\3TIMEOUT\2ERR\1ACK",
1526 DPRINTF(D_XFER, ("STAT=%s ", str));
1529 if ((result & SL11_EPSTAT_ERROR))
1532 if ((result & SL11_EPSTAT_NAK))
1535 /* Read buffer if PID_IN */
1536 if (pid == SL11_PID_IN && len > 0) {
1537 sl11read_region(sc, buf, 0x40, len);
1539 for (i = 0; i < len; i++)
1540 DPRINTF(D_XFER, ("%02X ", buf[i]));
1548 slhci_abort_xfer(usbd_xfer_handle xfer, usbd_status status)
1550 xfer->status = status;
1551 usb_transfer_complete(xfer);
1555 slhci_device_clear_toggle(usbd_pipe_handle pipe)
1557 DPRINTF(D_TRACE, ("SLdevice_clear_toggle "));
1562 print_req(usb_device_request_t *r)
1579 int req, type, value, index, len;
1582 type = r->bmRequestType;
1583 value = UGETW(r->wValue);
1584 index = UGETW(r->wIndex);
1585 len = UGETW(r->wLength);
1587 printf("%x,%s,v=%d,i=%d,l=%d ",
1588 type, xmes[req], value, index, len);
1592 print_req_hub(usb_device_request_t *r)
1599 { 1, 0x20, "ClrHubFeat" },
1600 { 1, 0x23, "ClrPortFeat" },
1601 { 2, 0xa3, "GetBusState" },
1602 { 6, 0xa0, "GetHubDesc" },
1603 { 0, 0xa0, "GetHubStat" },
1604 { 0, 0xa3, "GetPortStat" },
1605 { 7, 0x20, "SetHubDesc" },
1606 { 3, 0x20, "SetHubFeat" },
1607 { 3, 0x23, "SetPortFeat" },
1611 int value, index, len;
1613 value = UGETW(r->wValue);
1614 index = UGETW(r->wIndex);
1615 len = UGETW(r->wLength);
1616 for (i = 0; ; i++) {
1617 if (conf[i].req == -1 )
1618 return print_req(r);
1619 if (r->bmRequestType == conf[i].type && r->bRequest == conf[i].req) {
1620 printf("%s", conf[i].str);
1624 printf(",v=%d,i=%d,l=%d ", value, index, len);
1628 print_dumpreg(struct slhci_softc *sc)
1630 printf("00=%02x,01=%02x,02=%02x,03=%02x,04=%02x,"
1631 "08=%02x,09=%02x,0A=%02x,0B=%02x,0C=%02x,",
1632 sl11read(sc, 0), sl11read(sc, 1),
1633 sl11read(sc, 2), sl11read(sc, 3),
1634 sl11read(sc, 4), sl11read(sc, 8),
1635 sl11read(sc, 9), sl11read(sc, 10),
1636 sl11read(sc, 11), sl11read(sc, 12)
1638 printf("CR1=%02x,IER=%02x,0D=%02x,0E=%02x,0F=%02x ",
1639 sl11read(sc, 5), sl11read(sc, 6),
1640 sl11read(sc, 13), sl11read(sc, 14), sl11read(sc, 15)
1645 print_xfer(usbd_xfer_handle xfer)
1647 printf("xfer: length=%d, actlen=%d, flags=%x, timeout=%d,",
1648 xfer->length, xfer->actlen, xfer->flags, xfer->timeout);
1649 printf("request{ ");
1650 print_req_hub(&xfer->request);
1653 #endif /* SLHCI_DEBUG */