DWC-OTG drivers

Several SoC manufacturers use DWC-OTG USB 2.0 controller from Designware/Synopsys (Some use it only partially)

Linux doesn’t include it officially but several vendors took the code from Designware and adapted it for themselves.
Usually once they did this they did’t update the code. Synopsys only allow customers to download the latest versions.
The code is filled with bugs and the old code is really slow.

The most recent/decent driver is the one used in the Raspberry PI and I’ve to port it to an older Kernel in another SoC. It is not documented but there seems to be a bit of info aroud the net since a lots of Soc manufacturers use it. I’ll update here the public documentation.

Raspi Broadcom: Cambridge info

Raspi Broadcom: Unnoficial Raspberri PI USB-OTG info  dwc_otg: version 3.00a 10-AUG-2012", "dwc_otg: version 2.90b 6-MAY-2010"

Ralink: Ralink info

Other usefull info:

* Open-wrt uses it a lot (including Fonera) and can be usefull to find kernel patches. They use from “2.72a 24-JUN-2008” to “2.93a 15-MAY-2011”

* Altera has it for the Cyclone v5 FPGAs (socfpga_cyclone5)

    *Altera USB-OTG official documentation

Rockchip RK3066 SDKs Their driver version is a WTF:

dummy_audio.c:#define DRIVER_VERSION        "St Patrick's Day 2004"
dummy_audio.c:    INFO (dev, "%s, version: " DRIVER_VERSION "\n", longname);
dwc_otg_driver.c://#define DWC_DRIVER_VERSION    "2.60a 22-NOV-2006"
dwc_otg_driver.c://#define DWC_DRIVER_VERSION    "2.70 2009-12-31"
dwc_otg_driver.c:#define DWC_DRIVER_VERSION    "3.00 2010-12-12 rockchip" ss

They didn't change it for the rk3188 even on their kernel for kitkat

* Telechips TCC8900 SDK  They use “2.81a 04-FEB-2009″

Other usefull links now:

http://labs.opinsys.com/blog/2012/11/01/debugging-smartboards-in-linux/


Mindspeed C2000 uses it for open-wrt “2.93a 15-MAY-2011

Main integrator: http://www.linkedin.com/pub/rajiv-kulkarni/12/876/812
Which company uses it: http://mybookworld.wikidot.com/forum/t-768658/wd-my-cloud:some-specifications
Bingo :) the source code: http://support.wd.com/product/download.asp?groupid=904&sid=211&lang=en

5 pensamientos en “DWC-OTG drivers

  1. Hi there,

    You mentioned that you ported to another SoC… is it possible for you to port the latest DWC OTG driver version to the RK3066 device? I’d be happy to contribute some funding if you were interested?
    Cheers

    • I’m glad this was found usefull by someone. I went though hell while developing for it.

      It was not the rk3066, it was the rk3188 (practically the same and with no differences on the USB part) but I can not publish yet the code I did because of an NDA and I can’t do it for you but I can tell you what was already public 😉

      I can tell you that we had lots of problems making it work with a broadcom SDIO wifi card but we did it and that the number of interrupts per second caused by the USB (8K/s) made it nearly imposible to use the wifi card properly if they were used at the same time (ej: high bandwith videoconferencing). We hoped a SDIO wifi card could make the difference since it does not use the USB but it didn’t. We did videoconferencing but using already compressed video from H264 cams)

      The Raspi now uses the trick of FIQ interrupts to see if something is using the USB in order to avoid the 8K/s but sadly that doesn’t help for videoconferencing since a USB cam has to be used.

      You can find Rk3066 sources in many places, there is even a github page with the RT kernel patches https://github.com/AutoStatic/rk3066-rt

      We ended using the rk3188 for 720p videoconferencing using H264 cams and it worked but the wifi was still laging a bit due to the USB interrupts.

      DWC USB 2.0 drivers are the _WORST_ on the market. Avoid it if you’re still on time. It you have to use SDIO and USB look at this:

      I mentioned the RT patches because they included a very old patch for the SDIO that DOES make a lot of difference (we didn’t use the RT kernel but we did use this patch):

      Read this to understand what it does:
      https://www.kernel.org/doc/htmldocs/kernel-api/API-disable-irq-nosync.html
      disable_irq_nosync — disable an irq without waiting

      I’ll put you the chronology of the most important patch for SDIO since no one seems to give credit to the previous ones.
      It was originally done for the MMC cards on different plattforms so it might not seem obvious without this:

      Initially if was put on the OMAP:
      9 june 2009
      http://lists.openezx.org/pipermail/openezx-svnlog/2009-June/001329.html

      23 april 2012 it was put on a freescale
      http://lists.infradead.org/pipermail/linux-mtd/2012-April/040852.html

      3 July de 2013 it was put on the raspberry PI
      but only for the RT:
      http://www.raspberrypi.org/forums/viewtopic.php?f=29&t=39951&start=25

      4 July 2013
      Someone takes it from the PI and tries it on the rk3066 Real Time kernel.
      http://www.spinics.net/lists/linux-audio-users/msg92803.html

      30 July 2013 it was sent to the rk3066 (it does work on the non RT one)
      http://www.spinics.net/lists/linux-rt-users/msg10255.html

      17 January 2014
      A generic patch coming from chromium devs is made for many systems. NOT for the generic SDIO but for the SDHC and in a better way than all the previous ones.
      https://lkml.org/lkml/2014/1/17/481

      • Hi there,

        Thanks for reply it’s really appreciated.

        I understand re: NDA no problem.

        I wonder if we could chat with you privately to describe our issue (happy to pay for your time) and perhaps you can help with some pointers?

        Skype: john_whiteman
        Email: grasshopper.master at gmail com

        Thanks!

  2. Hola, I found your article to be very interesting as I was searching for someone who also had/has issues with the Synopsys DWC-OTG controller and related driver.

    I am currently working on a development board based on the Rockchip RK3288 – this SoC seems to use exactly the same DWC-OTG controller as the earlier RK3188 although the kernel driver is a later version (3.10a).

    Because the project I am involved in requires to use an external USB hub (Cypress HX3 based) for various input devices, I had the chance to observe quite a few issues with (for example) one or more USB keyboards and a touchscreen controller (USB) plugged in at the same time. The keyboard might start missing keystrokes (or repeat keystrokes endlessly) and the touchscreen might miss touch events randomly.

    The same USB hub and connected devices do not present any issues when used on a Nexus 7 tablet or a Freescale i.MX6 based board.

    I have tried different hubs, input devices AND different boards all based on the RK3288 – the problems still persist. Debugging the USB bus with usbmon + debugfs did not reveal any missing IRQs or USB data packets so I started to suspect that something is going on with the host-controller driver (the Synopsys one).

    I contacted Synopsys and they confessed that the DWC-OTG controller works much better in “device mode” rather than “host mode”, especially with USB hubs – there is a driver revision for the controller (3.10b) which unfortunately is only available for partners.

    Although this sounds like the end of the road in relation to these issues, I am not understanding one fundamental concept with this controller and perhaps you have some useful insights. The RK3288 (as per datasheet) provides 1 OTG controller AND 2 USB 2.0 interfaces – are these “USB 2.0 interfaces” still handled by the same OTG controller driver?

    The Rockchip kernel ships with the DWC-OTG driver: https://crewrktablets.arctablet.com:8081/opendev/kernel_rockchip/tree/c1223c73a70e1cece09676d0f2cfcfe136a25ac6/drivers/usb/dwc_otg_310?ModPagespeed=noscript

    And a modified version of the EHCI driver: https://crewrktablets.arctablet.com:8081/opendev/kernel_rockchip/blob/rockchip-3.10-rk3288/drivers/usb/host/ehci-rockchip.c

    These two are related for sure (clock dependencies) but what I am not sure about is if they also relate to separate controllers (an EHCI host controller and an OTG controller) or a single controller which uses both the drivers.

    Cheers and apologies for the long post!

Responder

Introduce tus datos o haz clic en un icono para iniciar sesión:

Logo de WordPress.com

Estás comentando usando tu cuenta de WordPress.com. Cerrar sesión / Cambiar )

Imagen de Twitter

Estás comentando usando tu cuenta de Twitter. Cerrar sesión / Cambiar )

Foto de Facebook

Estás comentando usando tu cuenta de Facebook. Cerrar sesión / Cambiar )

Google+ photo

Estás comentando usando tu cuenta de Google+. Cerrar sesión / Cambiar )

Conectando a %s