Re: Patch: xhci controller driver improvements
On 08/12/14 17:20, Takahiro HAYASHI wrote: On 08/12/14 23:07, Nick Hudson wrote: On 08/12/14 10:42, Takahiro HAYASHI wrote: On 08/12/14 07:45, Takahiro HAYASHI wrote: Please send diff :) Wait for a while plz. lessprf.diff replaces most of device_printf. I define new macros DPRINTD and DPRINTDF. former prints args with device_xname(sc-sc_dev), latter prints args with device name and function name. Can you check that this compiles with all the combinations of USB_DEBUG, XHCI_DEBUG and DIAGNOSTIC please? Sorry, some declrations was reported unused. New patch is attached. Hi, Can you convert the DPRINTFs to USBHIST_LOG, please? Thanks, Nick
Re: Patch: xhci controller driver improvements
On 08/12/14 07:45, Takahiro HAYASHI wrote: Please send diff :) Wait for a while plz. lessprf.diff replaces most of device_printf. I define new macros DPRINTD and DPRINTDF. former prints args with device_xname(sc-sc_dev), latter prints args with device name and function name. I'll dump my local misc patches too. usb3.diff tries to make usb stack recognize super speed and make usbdevs(8) print super speed. This patch also adds XHCI_DEBUG flag to opt_usb.h. lockmore.diff adds lock with sc_intr_lock to xhci_intr and xhci_poll. lsmps.diff makes use 8 as wMaxPacketSize for LS when addressing device. http://mail-index.netbsd.org/source-changes/2013/03/20/msg042367.html Thanks, -- t-hash --- xhci.c.orig 2014-08-12 09:00:14.0 +0900 +++ xhci.c 2014-08-12 09:03:53.0 +0900 @@ -59,9 +59,24 @@ __KERNEL_RCSID(0, $NetBSD: xhci.c,v 1.2 int xhcidebug = 0; #define DPRINTF(x) do { if (xhcidebug) printf x; } while(0) #define DPRINTFN(n,x) do { if (xhcidebug(n)) printf x; } while (0) +#define DPRINTD(n,fmt,...) do {\ + if (xhcidebug (n)) { \ + printf(%s: fmt, \ + device_xname(sc-sc_dev),## __VA_ARGS__); \ + } \ +} while (0/*CONSTCOND*/) +#define DPRINTDF(n,fmt,...)do {\ + if (xhcidebug (n)) { \ + printf(%s: %s: fmt, \ + device_xname(sc-sc_dev), \ + __FUNCTION__,## __VA_ARGS__); \ + } \ +} while (0/*CONSTCOND*/) #else #define DPRINTF(x) #define DPRINTFN(n,x) +#define DPRINTD(...) ((void)0) +#define DPRINTDF(...) ((void)0) #endif #define XHCI_DCI_SLOT 0 @@ -857,7 +872,7 @@ xhci_intr(void *v) if (sc == NULL || sc-sc_dying || !device_has_power(sc-sc_dev)) return 0; - DPRINTF((%s: %s\n, __func__, device_xname(sc-sc_dev))); + DPRINTDF(16, \n); /* If we get an interrupt while polling, then just ignore it. */ if (sc-sc_bus.use_polling) { @@ -917,13 +932,18 @@ xhci_configure_endpoint(usbd_pipe_handle usbd_status err; uint32_t *cp; - device_printf(sc-sc_dev, %s dci %u (0x%x)\n, __func__, dci, - pipe-endpoint-edesc-bEndpointAddress); + DPRINTDF(0, dci %u (0x%x (addr %u dir %s) xtype %u)\n, + dci, pipe-endpoint-edesc-bEndpointAddress, + UE_GET_ADDR(ed-bEndpointAddress), + UE_GET_DIR(ed-bEndpointAddress) == UE_DIR_IN ? in : out, + UE_GET_XFERTYPE(ed-bmAttributes) + ); /* XXX ensure input context is available? */ memset(xhci_slot_get_icv(sc, xs, 0), 0, sc-sc_pgsz); + /* set up initial input control context */ cp = xhci_slot_get_icv(sc, xs, XHCI_ICI_INPUT_CONTROL); cp[0] = htole32(0); cp[1] = htole32(XHCI_INCTX_1_ADD_MASK(dci)); @@ -998,8 +1018,9 @@ xhci_reset_endpoint(usbd_pipe_handle pip struct xhci_trb trb; usbd_status err; - device_printf(sc-sc_dev, %s\n, __func__); + DPRINTDF(0, \n); + /* XXX byte order */ trb.trb_0 = 0; trb.trb_2 = 0; trb.trb_3 = XHCI_TRB_3_SLOT_SET(xs-xs_idx) | @@ -1021,8 +1042,9 @@ xhci_stop_endpoint(usbd_pipe_handle pipe usbd_status err; const u_int dci = xhci_ep_get_dci(pipe-endpoint-edesc); - device_printf(sc-sc_dev, %s\n, __func__); + DPRINTDF(0, \n); + /* XXX byte order */ trb.trb_0 = 0; trb.trb_2 = 0; trb.trb_3 = XHCI_TRB_3_SLOT_SET(xs-xs_idx) | @@ -1045,7 +1067,7 @@ xhci_set_dequeue(usbd_pipe_handle pipe) struct xhci_trb trb; usbd_status err; - device_printf(sc-sc_dev, %s\n, __func__); + DPRINTDF(0, \n); memset(xr-xr_trb, 0, xr-xr_ntrb * XHCI_TRB_SIZE); usb_syncmem(xr-xr_dma, 0, xr-xr_ntrb * XHCI_TRB_SIZE, @@ -1074,10 +1096,8 @@ xhci_open(usbd_pipe_handle pipe) const int8_t addr = dev-address; const uint8_t xfertype = UE_GET_XFERTYPE(ed-bmAttributes); - DPRINTF((%s\n, __func__)); - DPRINTF((addr %d\n, addr)); - device_printf(sc-sc_dev, %s addr %d depth %d port %d speed %d\n, - __func__, addr, dev-depth, dev-powersrc-portno, dev-speed); + DPRINTDF(0, addr %d depth %d port %d speed %d\n, + addr, dev-depth, dev-powersrc-portno, dev-speed); if (sc-sc_dying) return USBD_IOERROR; @@ -1132,7 +1152,7 @@ xhci_rhpsc(struct xhci_softc * const sc, usbd_xfer_handle const xfer = sc-sc_intrxfer; uint8_t *p; - device_printf(sc-sc_dev, port %u status change\n, port); + DPRINTD(0, port %u status change\n, port); if (xfer == NULL)
Re: Patch: xhci controller driver improvements
On 08/12/14 10:42, Takahiro HAYASHI wrote: On 08/12/14 07:45, Takahiro HAYASHI wrote: Please send diff :) Wait for a while plz. lessprf.diff replaces most of device_printf. I define new macros DPRINTD and DPRINTDF. former prints args with device_xname(sc-sc_dev), latter prints args with device name and function name. Can you check that this compiles with all the combinations of USB_DEBUG, XHCI_DEBUG and DIAGNOSTIC please? I'll dump my local misc patches too. usb3.diff tries to make usb stack recognize super speed and make usbdevs(8) print super speed. This patch also adds XHCI_DEBUG flag to opt_usb.h. I committed most of this apart from the memset as I don't think it's required. lockmore.diff adds lock with sc_intr_lock to xhci_intr and xhci_poll. committed lsmps.diff makes use 8 as wMaxPacketSize for LS when addressing device. http://mail-index.netbsd.org/source-changes/2013/03/20/msg042367.html Committed. Thanks, Nick
Re: Patch: xhci controller driver improvements
On 08/12/14 15:07, Nick Hudson wrote: On 08/12/14 10:42, Takahiro HAYASHI wrote: I'll dump my local misc patches too. usb3.diff tries to make usb stack recognize super speed and make usbdevs(8) print super speed. This patch also adds XHCI_DEBUG flag to opt_usb.h. I committed most of this apart from the memset as I don't think it's required. UPS_SUPER_SPEED should be done differently in the long run by adding super speed hub support properly Nick
Re: Patch: xhci controller driver improvements
On 08/12/14 23:07, Nick Hudson wrote: On 08/12/14 10:42, Takahiro HAYASHI wrote: On 08/12/14 07:45, Takahiro HAYASHI wrote: Please send diff :) Wait for a while plz. lessprf.diff replaces most of device_printf. I define new macros DPRINTD and DPRINTDF. former prints args with device_xname(sc-sc_dev), latter prints args with device name and function name. Can you check that this compiles with all the combinations of USB_DEBUG, XHCI_DEBUG and DIAGNOSTIC please? Sorry, some declrations was reported unused. New patch is attached. I'll dump my local misc patches too. usb3.diff tries to make usb stack recognize super speed and make usbdevs(8) print super speed. This patch also adds XHCI_DEBUG flag to opt_usb.h. I committed most of this apart from the memset as I don't think it's required. lockmore.diff adds lock with sc_intr_lock to xhci_intr and xhci_poll. committed lsmps.diff makes use 8 as wMaxPacketSize for LS when addressing device. http://mail-index.netbsd.org/source-changes/2013/03/20/msg042367.html Committed. Thank you for commit! -- t-hash --- xhci.c.orig 2014-08-12 23:29:37.0 +0900 +++ xhci.c 2014-08-13 00:40:38.0 +0900 @@ -59,9 +59,24 @@ __KERNEL_RCSID(0, $NetBSD: xhci.c,v 1.2 int xhcidebug = 0; #define DPRINTF(x) do { if (xhcidebug) printf x; } while(0) #define DPRINTFN(n,x) do { if (xhcidebug(n)) printf x; } while (0) +#define DPRINTD(n,fmt,...) do {\ + if (xhcidebug (n)) { \ + printf(%s: fmt, \ + device_xname(sc-sc_dev),## __VA_ARGS__); \ + } \ +} while (0/*CONSTCOND*/) +#define DPRINTDF(n,fmt,...)do {\ + if (xhcidebug (n)) { \ + printf(%s: %s: fmt, \ + device_xname(sc-sc_dev), \ + __FUNCTION__,## __VA_ARGS__); \ + } \ +} while (0/*CONSTCOND*/) #else #define DPRINTF(x) #define DPRINTFN(n,x) +#define DPRINTD(...) ((void)0) +#define DPRINTDF(...) ((void)0) #endif #define XHCI_DCI_SLOT 0 @@ -863,7 +878,7 @@ xhci_intr(void *v) if (sc-sc_dying || !device_has_power(sc-sc_dev)) goto done; - DPRINTF((%s: %s\n, __func__, device_xname(sc-sc_dev))); + DPRINTDF(16, \n); /* If we get an interrupt while polling, then just ignore it. */ if (sc-sc_bus.use_polling) { @@ -926,13 +941,18 @@ xhci_configure_endpoint(usbd_pipe_handle usbd_status err; uint32_t *cp; - device_printf(sc-sc_dev, %s dci %u (0x%x)\n, __func__, dci, - pipe-endpoint-edesc-bEndpointAddress); + DPRINTDF(0, dci %u (0x%x (addr %u dir %s) xtype %u)\n, + dci, pipe-endpoint-edesc-bEndpointAddress, + UE_GET_ADDR(ed-bEndpointAddress), + UE_GET_DIR(ed-bEndpointAddress) == UE_DIR_IN ? in : out, + UE_GET_XFERTYPE(ed-bmAttributes) + ); /* XXX ensure input context is available? */ memset(xhci_slot_get_icv(sc, xs, 0), 0, sc-sc_pgsz); + /* set up initial input control context */ cp = xhci_slot_get_icv(sc, xs, XHCI_ICI_INPUT_CONTROL); cp[0] = htole32(0); cp[1] = htole32(XHCI_INCTX_1_ADD_MASK(dci)); @@ -1007,8 +1027,9 @@ xhci_reset_endpoint(usbd_pipe_handle pip struct xhci_trb trb; usbd_status err; - device_printf(sc-sc_dev, %s\n, __func__); + DPRINTDF(0, \n); + /* XXX byte order */ trb.trb_0 = 0; trb.trb_2 = 0; trb.trb_3 = XHCI_TRB_3_SLOT_SET(xs-xs_idx) | @@ -1030,8 +1051,9 @@ xhci_stop_endpoint(usbd_pipe_handle pipe usbd_status err; const u_int dci = xhci_ep_get_dci(pipe-endpoint-edesc); - device_printf(sc-sc_dev, %s\n, __func__); + DPRINTDF(0, \n); + /* XXX byte order */ trb.trb_0 = 0; trb.trb_2 = 0; trb.trb_3 = XHCI_TRB_3_SLOT_SET(xs-xs_idx) | @@ -1054,7 +1076,7 @@ xhci_set_dequeue(usbd_pipe_handle pipe) struct xhci_trb trb; usbd_status err; - device_printf(sc-sc_dev, %s\n, __func__); + DPRINTDF(0, \n); memset(xr-xr_trb, 0, xr-xr_ntrb * XHCI_TRB_SIZE); usb_syncmem(xr-xr_dma, 0, xr-xr_ntrb * XHCI_TRB_SIZE, @@ -1080,13 +1102,13 @@ xhci_open(usbd_pipe_handle pipe) usbd_device_handle const dev = pipe-device; struct xhci_softc * const sc = dev-bus-hci_private; usb_endpoint_descriptor_t * const ed = pipe-endpoint-edesc; +#ifdef XHCI_DEBUG const int8_t addr = dev-address; +#endif const uint8_t xfertype = UE_GET_XFERTYPE(ed-bmAttributes); - DPRINTF((%s\n, __func__)); - DPRINTF((addr %d\n, addr)); - device_printf(sc-sc_dev, %s addr
Re: Patch: xhci controller driver improvements
On 08/10/14 12:54, Takahiro HAYASHI wrote: Hi, Hi, On 08/10/14 17:06, Nick Hudson wrote: Some comments... @@ -2889,6 +3028,7 @@ xhci_timeout(void *addr) struct xhci_softc * const sc = xfer-pipe-device-bus-hci_private; if (sc-sc_dying) { +xhci_abort_xfer(xfer, USBD_TIMEOUT); return; } This looks very strange. Does it need sc_lock and unlock? or it's strange that xhci_abort_xfer is called from callout(softclock) interrupt context? Calling xhci_abort_xfer while dying. The driver makes far too much use of device_printf and all USB should move to KERNHIST. I didn't know about KERNHIST, thanks for notifying. I've replaced device_printf with DPRINTF or DPRINTFN in my local tree. Please send diff :) Nick
Re: Patch: xhci controller driver improvements
On 08/11/14 19:40, Nick Hudson wrote: @@ -2889,6 +3028,7 @@ xhci_timeout(void *addr) struct xhci_softc * const sc = xfer-pipe-device-bus-hci_private; if (sc-sc_dying) { +xhci_abort_xfer(xfer, USBD_TIMEOUT); return; } This looks very strange. Does it need sc_lock and unlock? or it's strange that xhci_abort_xfer is called from callout(softclock) interrupt context? Calling xhci_abort_xfer while dying. well, should it be like this? --- xhci.c.orig 2014-08-11 20:14:13.0 +0900 +++ xhci.c 2014-08-12 06:41:55.0 +0900 @@ -2896,6 +3492,11 @@ xhci_timeout(void *addr) struct xhci_softc * const sc = xfer-pipe-device-bus-hci_private; if (sc-sc_dying) { + mutex_enter(sc-sc_lock); + xfer-status = USBD_TIMEOUT; + callout_stop(xfer-timeout_handle); + usb_transfer_complete(xfer); + mutex_exit(sc-sc_lock); return; } This resembles {u,o,e}hci.c do in dying path. The driver makes far too much use of device_printf and all USB should move to KERNHIST. I didn't know about KERNHIST, thanks for notifying. I've replaced device_printf with DPRINTF or DPRINTFN in my local tree. Please send diff :) Wait for a while plz. -- t-hash
Re: Patch: xhci controller driver improvements
On 08/10/14 04:27, Takahiro HAYASHI wrote: Hello, (05/11/14 02:57), Rajasekhar Pulluru wrote: Hi, The attached patch addresses following points. - With some usb devices, often some endpoints gets stalled. Resetting the endpoint helps recover usb transactions. - When a usb device is removed while data is being copied to/from, all the queued transfer requests needs to be aborted gracefully so that transfer status is reported up to the application. - Some boards require an additional interrupt acknowledgement specific to the architecture. Added a function pointer that needs to be set during that board arch-specific initialization. If this is not required, function pointer needs to be set to NULL. - Added debug functions to dump xhci registers that could help us in case of any issue. Note: I have manually patched the code changes from my older version(verified) of code to the latest as of today in MAIN branch. And the code is not compiled either, sorry about that. If anyone is interested to patch this and verify, it would be really helpful. I reformatted whitespace and made several changes: - avoid lock error when calling xhci_do_command from xhci_stop_endpoint - assume usb_uncallout(a,b,c) is callout_stop(a) - comment out checking xfer-device-bus-intr_context - declare gsc used in debug code (would be set in ddb?) It should build at least, but still experimental. Some comments... --- src/sys/dev/usb/xhci.c.orig 2014-08-05 22:24:27.0 +0900 +++ src/sys/dev/usb/xhci.c 2014-08-07 17:35:16.0 +0900 @@ -55,6 +55,8 @@ __KERNEL_RCSID(0, $NetBSD: xhci.c,v 1.2 #include dev/usb/xhcivar.h #include dev/usb/usbroothub_subr.h +#include uvm/uvm.h /* for vtophys on arm */ + Shouldn't be needed at all - the hexdump use is questionable. @@ -1127,6 +1165,81 @@ xhci_open(usbd_pipe_handle pipe) } static void +xhci_abort_xfer(usbd_xfer_handle xfer, usbd_status status) This function needs usbmp-ifiction, i.e. updating for -current by removing spl, tsleep, wakeup, etc. @@ -2889,6 +3028,7 @@ xhci_timeout(void *addr) struct xhci_softc * const sc = xfer-pipe-device-bus-hci_private; if (sc-sc_dying) { + xhci_abort_xfer(xfer, USBD_TIMEOUT); return; } This looks very strange. The driver makes far too much use of device_printf and all USB should move to KERNHIST. Nick
Re: Patch: xhci controller driver improvements
Hi, On 08/10/14 17:06, Nick Hudson wrote: Some comments... --- src/sys/dev/usb/xhci.c.orig2014-08-05 22:24:27.0 +0900 +++ src/sys/dev/usb/xhci.c2014-08-07 17:35:16.0 +0900 @@ -55,6 +55,8 @@ __KERNEL_RCSID(0, $NetBSD: xhci.c,v 1.2 #include dev/usb/xhcivar.h #include dev/usb/usbroothub_subr.h +#include uvm/uvm.h /* for vtophys on arm */ + Shouldn't be needed at all - the hexdump use is questionable. The code of hexdump is wrapperd with #if 0, but I added this just for someone who wants enable this and dump TRBs on arm e.g. mirabox. @@ -1127,6 +1165,81 @@ xhci_open(usbd_pipe_handle pipe) } static void +xhci_abort_xfer(usbd_xfer_handle xfer, usbd_status status) This function needs usbmp-ifiction, i.e. updating for -current by removing spl, tsleep, wakeup, etc. Hmm, I need to learn about them. I guess this patch is based on netbsd-5 so it uses spl family. @@ -2889,6 +3028,7 @@ xhci_timeout(void *addr) struct xhci_softc * const sc = xfer-pipe-device-bus-hci_private; if (sc-sc_dying) { +xhci_abort_xfer(xfer, USBD_TIMEOUT); return; } This looks very strange. Does it need sc_lock and unlock? or it's strange that xhci_abort_xfer is called from callout(softclock) interrupt context? The driver makes far too much use of device_printf and all USB should move to KERNHIST. I didn't know about KERNHIST, thanks for notifying. I've replaced device_printf with DPRINTF or DPRINTFN in my local tree. -- t-hash
Re: Patch: xhci controller driver improvements
Hello, (05/11/14 02:57), Rajasekhar Pulluru wrote: Hi, The attached patch addresses following points. - With some usb devices, often some endpoints gets stalled. Resetting the endpoint helps recover usb transactions. - When a usb device is removed while data is being copied to/from, all the queued transfer requests needs to be aborted gracefully so that transfer status is reported up to the application. - Some boards require an additional interrupt acknowledgement specific to the architecture. Added a function pointer that needs to be set during that board arch-specific initialization. If this is not required, function pointer needs to be set to NULL. - Added debug functions to dump xhci registers that could help us in case of any issue. Note: I have manually patched the code changes from my older version(verified) of code to the latest as of today in MAIN branch. And the code is not compiled either, sorry about that. If anyone is interested to patch this and verify, it would be really helpful. I reformatted whitespace and made several changes: - avoid lock error when calling xhci_do_command from xhci_stop_endpoint - assume usb_uncallout(a,b,c) is callout_stop(a) - comment out checking xfer-device-bus-intr_context - declare gsc used in debug code (would be set in ddb?) It should build at least, but still experimental. -- t-hash --- src/sys/dev/usb/xhci.c.orig 2014-08-05 22:24:27.0 +0900 +++ src/sys/dev/usb/xhci.c 2014-08-07 17:35:16.0 +0900 @@ -55,6 +55,8 @@ __KERNEL_RCSID(0, $NetBSD: xhci.c,v 1.2 #include dev/usb/xhcivar.h #include dev/usb/usbroothub_subr.h +#include uvm/uvm.h /* for vtophys on arm */ + #ifdef XHCI_DEBUG int xhcidebug = 0; #define DPRINTF(x) do { if (xhcidebug) printf x; } while(0) @@ -79,6 +81,7 @@ struct xhci_pipe { #define XHCI_EVENT_RING_SEGMENTS 1 #define XHCI_TRB_3_ED_BIT XHCI_TRB_3_ISP_BIT +static void xhci_abort_xfer(usbd_xfer_handle xfer, usbd_status status); static usbd_status xhci_open(usbd_pipe_handle); static int xhci_intr1(struct xhci_softc * const); static void xhci_softintr(void *); @@ -94,12 +97,16 @@ static usbd_status xhci_new_device(devic static usbd_status xhci_configure_endpoint(usbd_pipe_handle); static usbd_status xhci_unconfigure_endpoint(usbd_pipe_handle); static usbd_status xhci_reset_endpoint(usbd_pipe_handle); -//static usbd_status xhci_stop_endpoint(usbd_pipe_handle); +static usbd_status xhci_stop_endpoint(usbd_pipe_handle); static usbd_status xhci_set_dequeue(usbd_pipe_handle); static usbd_status xhci_do_command(struct xhci_softc * const, struct xhci_trb * const, int); +static usbd_status xhci_do_command1(struct xhci_softc * const, +struct xhci_trb * const, int, int); +static usbd_status xhci_do_command_locked(struct xhci_softc * const, +struct xhci_trb * const, int); static usbd_status xhci_init_slot(struct xhci_softc * const, uint32_t, int, int, int, int); static usbd_status xhci_enable_slot(struct xhci_softc * const, @@ -336,13 +343,13 @@ xhci_rt_write_8(const struct xhci_softc } } -#if 0 /* unused */ +#ifdef XHCI_DEBUG static inline uint32_t xhci_db_read_4(const struct xhci_softc * const sc, bus_size_t offset) { return bus_space_read_4(sc-sc_iot, sc-sc_dbh, offset); } -#endif /* unused */ +#endif static inline void xhci_db_write_4(const struct xhci_softc * const sc, bus_size_t offset, @@ -888,6 +895,14 @@ xhci_intr1(struct xhci_softc * const sc) usbsts = xhci_op_read_4(sc, XHCI_USBSTS); //device_printf(sc-sc_dev, %s USBSTS %08x\n, __func__, usbsts); + /* +* some arch requires additional arch specific xhci intr ack +* this function pointer needs to be implemented and assigned +* in arch specifc code +*/ + if (sc-sc_quirk_intr_ack != NULL) + sc-sc_quirk_intr_ack((void*)sc); + iman = xhci_rt_read_4(sc, XHCI_IMAN(0)); //device_printf(sc-sc_dev, %s IMAN0 %08x\n, __func__, iman); if ((iman XHCI_IMAN_INTR_PEND) == 0) { @@ -1011,7 +1026,6 @@ xhci_reset_endpoint(usbd_pipe_handle pip return err; } -#if 0 static usbd_status xhci_stop_endpoint(usbd_pipe_handle pipe) { @@ -1029,11 +1043,10 @@ xhci_stop_endpoint(usbd_pipe_handle pipe XHCI_TRB_3_EP_SET(dci) | XHCI_TRB_3_TYPE_SET(XHCI_TRB_TYPE_STOP_EP); - err = xhci_do_command(sc, trb, USBD_DEFAULT_TIMEOUT); + err = xhci_do_command_locked(sc, trb, USBD_DEFAULT_TIMEOUT); return err; } -#endif static usbd_status xhci_set_dequeue(usbd_pipe_handle pipe) @@ -1065,6 +1078,26 @@ xhci_set_dequeue(usbd_pipe_handle pipe) return err; } +#ifdef XHCI_DEBUG +static void +dump_endpoint_info(usb_endpoint_descriptor_t * const ed) +{ + const uint8_t xfertype = UE_GET_XFERTYPE(ed-bmAttributes); + printf(direction (%08x) : %s\n, xfertype (%08x) : , ed-bEndpointAddress, + UE_GET_DIR(ed-bEndpointAddress) ? in : out,
re: Patch: xhci controller driver improvements
i didn't look too closely, but this: +#include uvm/uvm.h /* for vtophys on arm */ should probably be uvm_extern.h. .mrg.
Re: Patch: xhci controller driver improvements
On 08/10/14 12:31, matthew green wrote: i didn't look too closely, but this: +#include uvm/uvm.h /* for vtophys on arm */ should probably be uvm_extern.h. I see, thank you. -- t-hash
PATCH: xhci controller driver improvements
Hi, The attached patch addresses following points. - With some usb devices, often some endpoints gets stalled. Resetting the endpoint helps recover usb transactions. - When a usb device is removed while data is being copied to/from, all the queued transfer requests needs to be aborted gracefully so that transfer status is reported up to the application. - Some boards require an additional interrupt acknowledgement specific to the architecture. Added a function pointer that needs to be set during that board arch-specific initialization. If this is not required, function pointer needs to be set to NULL. - Added debug functions to dump xhci registers that could help us in case of any issue. Note: I have manually patched the code changes from my older version(verified) of code to the latest as of today in MAIN branch. And the code is not compiled either, sorry about that. If anyone is interested to patch this and verify, it would be really helpful. Thanks Regards, Rajasekhar xhci.patch Description: Binary data