> From: Stephen Warren [mailto:swarren@xxxxxxxxxxxxx] > Sent: Monday, July 08, 2013 8:41 PM > > On 07/08/2013 03:40 PM, Paul Zimmerman wrote: > >> From: Stephen Warren [mailto:swarren@xxxxxxxxxxxxx] > >> Sent: Tuesday, July 02, 2013 7:41 PM > >> > >> On 07/02/2013 07:47 PM, Stephen Warren wrote: > >>> On 06/26/2013 02:20 PM, Paul Zimmerman wrote: > >> ... > >>>> I hope whoever is supporting the Pi in the mainline kernel will try adding > >>>> dwc2 support now that it seems to be working. I'm not sure who that would > >>>> be, though. > >>> > >>> Well, it appears to work! I tested it on both a model A and B (rev 2) > >>> and devices enumerate on the bus OK now. I haven't actually tested data > >>> transfer yet though. > >> > >> ... although unfortunately, pretty much any use of the USB devices > >> crashes or hangs the kernel:-( I guess due to the wildly varying > >> symptoms, there is some random memory corruption going on. > >> > >> I did manage to dd about 1MiB off an SD card in a USB->SD card adapter > >> (with powered hub between the adapter and the Pi), but often just > >> plugging in the card or having it plugged in during boot causes hangs > >> and crashes. Similarly, I have a ZD1211 WiFi USB adapter, and having > >> that plugged during boot in causes all kinds of oops within a few or > >> tens of seconds after booting, in code unrelated to USB or networking. > >> > >> Paul, are you able to try out upstream Linux and see what the issue > >> might be? The following G+ post should outline the steps required: > >> > >> https://plus.google.com/101715070573995136397/posts/gWkwrfNfYVm > >> > >> although these days you might want to use u-boot.git not u-boot-arm.git > >> (or perhaps git://github.com/swarren/u-boot.git rpi_dev), and > >> git://github.com/swarren/linux-rpi.git rpi_dev to get the USB enabled. ... > > I suspect the majority of the issues you saw are due to missing dt > > support for several of the module parameters that need to be set to > > non-default values for the pi, like the DMA mode and the FIFO sizes. > > Hmm. I thought the HW config registers reflected exactly how the USB HW > was synthesized? It'd be odd to have registers that attempt to reflect > that, but actually have incorrect data! I vaguely recall an earlier > version of the DWC2 driver complaining, or perhaps even outright > refusing to initialize(?), if the parameters provided to th driver > didn't match up with the values in the HW registers. Hi Stephen, I just sent out a patch series with a number of fixes for the dwc2 driver. With that, plus the hack patch below to add all the driver parameters from the downstream Pi kernel, the driver is working pretty well. However, I am seeing an issue that I don't think is caused by the driver. If I copy a large file from a thumb drive to the SD card, the mmcqd process starts taking 90%+ of the CPU, and the whole system slows to a crawl. After several seconds of that, it returns to normal. If I copy a file from the thumb drive to the thumb drive, or cat it to /dev/null, everything is normal, which is why I don't think it is caused by the dwc2 driver. I'm not sure how many of the below driver parameters are actually required. I think as least the three fifo size parameters, plus max_transfer_size and max_packet_count, are needed. -- Paul diff --git a/drivers/staging/dwc2/platform.c b/drivers/staging/dwc2/platform.c index 44cce2f..2950824 100644 --- a/drivers/staging/dwc2/platform.c +++ b/drivers/staging/dwc2/platform.c @@ -46,6 +46,33 @@ static const char dwc2_driver_name[] = "dwc2"; +static struct dwc2_core_params dwc2_module_params = { + .otg_cap = 0, /* HNP/SRP capable */ + .otg_ver = 0, /* 1.3 */ + .dma_enable = 1, + .dma_desc_enable = 0, + .speed = 0, /* High Speed */ + .enable_dynamic_fifo = 1, + .en_multiple_tx_fifo = 1, + .host_rx_fifo_size = 774, /* 774 DWORDs */ + .host_nperio_tx_fifo_size = 256, /* 256 DWORDs */ + .host_perio_tx_fifo_size = 512, /* 512 DWORDs */ + .max_transfer_size = 65535, + .max_packet_count = 511, + .host_channels = 8, + .phy_type = 1, /* UTMI */ + .phy_utmi_width = 8, /* 8 bits */ + .phy_ulpi_ddr = 0, /* Single */ + .phy_ulpi_ext_vbus = 0, + .i2c_enable = 0, + .ulpi_fs_ls = 0, + .host_support_fs_ls_low_power = 0, + .host_ls_low_power_phy_clk = 0, /* 48 MHz */ + .ts_dline = 0, + .reload_ctl = 0, + .ahb_single = 0, +}; + /** * dwc2_driver_remove() - Called when the DWC_otg core is unregistered with the * DWC_otg driver @@ -84,10 +111,10 @@ static int dwc2_driver_probe(struct platform_device *dev) struct resource *res; int retval; int irq; - struct dwc2_core_params params; +// struct dwc2_core_params params; /* Default all params to autodetect */ - dwc2_set_all_params(¶ms, -1); +// dwc2_set_all_params(¶ms, -1); hsotg = devm_kzalloc(&dev->dev, sizeof(*hsotg), GFP_KERNEL); if (!hsotg) @@ -117,7 +144,8 @@ static int dwc2_driver_probe(struct platform_device *dev) dev_dbg(&dev->dev, "mapped PA %08lx to VA %p\n", (unsigned long)res->start, hsotg->regs); - retval = dwc2_hcd_init(hsotg, irq, ¶ms); +// retval = dwc2_hcd_init(hsotg, irq, ¶ms); + retval = dwc2_hcd_init(hsotg, irq, &dwc2_module_params); if (retval) return retval; -- 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