On Tue, 26 Feb 2013, Paul Zimmerman wrote: > These files contain the HCD code, and implement the Linux > hc_driver API. Support for both slave mode and buffer DMA mode > of the controller is included. > > Signed-off-by: Paul Zimmerman <paulz@xxxxxxxxxxxx> ... > +#define BITSTUFFTIME(bytecount) ((8 * 7 * (bytecount)) / 6) > +#define HS_HOST_DELAY 5 /* nanoseconds */ > +#define FS_LS_HOST_DELAY 1000 /* nanoseconds */ > +#define HUB_LS_SETUP 333 /* nanoseconds */ > + > +static u32 dwc2_calc_bus_time(struct dwc2_hsotg *hsotg, int speed, int is_in, > + int is_isoc, int bytecount) > +{ > + unsigned long retval; > + > + switch (speed) { > + case USB_SPEED_HIGH: > + if (is_isoc) > + retval = > + ((38 * 8 * 2083) + > + (2083 * (3 + BITSTUFFTIME(bytecount)))) / 1000 + > + HS_HOST_DELAY; > + else > + retval = > + ((55 * 8 * 2083) + > + (2083 * (3 + BITSTUFFTIME(bytecount)))) / 1000 + > + HS_HOST_DELAY; > + break; > + case USB_SPEED_FULL: > + if (is_isoc) { > + retval = > + (8354 * (31 + 10 * BITSTUFFTIME(bytecount))) / 1000; > + if (is_in) > + retval = 7268 + FS_LS_HOST_DELAY + retval; > + else > + retval = 6265 + FS_LS_HOST_DELAY + retval; > + } else { > + retval = > + (8354 * (31 + 10 * BITSTUFFTIME(bytecount))) / 1000; > + retval = 9107 + FS_LS_HOST_DELAY + retval; > + } > + break; > + case USB_SPEED_LOW: > + if (is_in) { > + retval = > + (67667 * (31 + 10 * BITSTUFFTIME(bytecount))) / > + 1000; > + retval = > + 64060 + (2 * HUB_LS_SETUP) + FS_LS_HOST_DELAY + > + retval; > + } else { > + retval = > + (66700 * (31 + 10 * BITSTUFFTIME(bytecount))) / > + 1000; > + retval = > + 64107 + (2 * HUB_LS_SETUP) + FS_LS_HOST_DELAY + > + retval; > + } > + break; > + default: > + dev_warn(hsotg->dev, "Unknown device speed\n"); > + retval = -1; > + } > + > + return NS_TO_US(retval); > +} Is there some specific reason for rolling your own version of usb_calc_bus_time()? I presume you copied these timing values from the USB spec. Note that the formulas in the spec are full of mistakes. At some point I will submit corrections to the core routine, along with a document explaining how they are calculated. But if you have your own separate timing routine like this, I won't change it. Alan Stern -- To unsubscribe from this list: send the line "unsubscribe linux-usb" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html