usb: Introduce DesignWare USB3 DRD Driver

STILL TODO SOME HUGE TEXT HERE.

Signed-off-by: Felipe Balbi <balbi@ti.com>
usb: dwc3: move structures to core.h

starting to split files. About to create gadget.c

Signed-off-by: Felipe Balbi <balbi@ti.com>
usb: dwc3: split gadget functions to gadget.c

better code organization.

Signed-off-by: Felipe Balbi <balbi@ti.com>
usb: dwc3: more __devinit annotations

event buffer allocation will only happen during
init, so mark those as __devinit.

Signed-off-by: Felipe Balbi <balbi@ti.com>
usb: dwc3: fix event buffer memleak

event buffers would leak on multiple modprobe
rmmod cycles, fix that.

Signed-off-by: Felipe Balbi <balbi@ti.com>
usb: dwc3: add the basic OMAP glue

The minimum required to glue to initialize
a dwc3 device. Borrowed the same solution
used on MUSB.

Signed-off-by: Felipe Balbi <balbi@ti.com>
usb: dwc3: start implement IRQ handling

Inside an event buffer there are N 32-bit
events which we use to decode the IRQ.

Signed-off-by: Felipe Balbi <balbi@ti.com>
usb: dwc3: gadget: implement depcfg command

I've decided to use a rather annoying but
somewhat helpful sequence of unions to describe
the parameters for each command.

One way to make it simpler later, is to create
per-command APIs which will generate correct
structures and bounce that to the lower level
API talking to HW.

Signed-off-by: Felipe Balbi <balbi@ti.com>
usb: dwc3: add a few more parameters

There are still plenty of command parameters to
be handled. Just gotta keep going.

Signed-off-by: Felipe Balbi <balbi@ti.com>
usb: dwc3: gadget: fix parameter setting of DEPXFERCFG

DEPXFERCFG only needs parameter0, so only set
the correct parameter for that command.

Signed-off-by: Felipe Balbi <balbi@ti.com>
usb: gadget: introduce gadget_is_dwc3()

... to check whether we're running on DesignWare
USB3 DRD Controller.

Signed-off-by: Felipe Balbi <balbi@ti.com>
usb: dwc3: gadget: half initialization of endpoints

we're almost there, a few questions came up WRT the
current design of the driver, maybe our structure
for the event buffer needs to know which endpoint
it's listening events to.

Signed-off-by: Felipe Balbi <balbi@ti.com>
usb: dwc: gadget: split more of the generic stuff

split more of the generic stuff from HW-related
operations.

Signed-off-by: Felipe Balbi <balbi@ti.com>
usb: dwc: gadget: add more nops

all the gadget operations are nops now.

Signed-off-by: Felipe Balbi <balbi@ti.com>
usb: dwc3: add structures for all events

It makes it easier to decode the events by just
reading from the structure instead of playing with
lots of different shifts.

Yes, I'm lazy, so what ?!?

PS: Databook v1.73 doesn't describe OTG event buffer
content.

Signed-off-by: Felipe Balbi <balbi@ti.com>
usb: dwc3: use platform_device_unregister()

platform_device_unregister() already calls
platform_device_del() and platform_device_put().

Let's be lazier and let driver core handle both for
us.

Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
Signed-off-by: Felipe Balbi <balbi@ti.com>
usb: dwc3: add a comment about the error case / use list iterator

Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
Signed-off-by: Felipe Balbi <balbi@ti.com>
usb: dwc3: add missing break to dwc3_interrupt

There was a missing break after handling CARKIT
interrupt. Add it.

Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
Signed-off-by: Felipe Balbi <balbi@ti.com>
usb: dwc3: implement disconnect IRQ

... this is based on the code present on the
example driver from Synopsys. Can't find
iformation on databook about this.

At least section 9.1.6 mentions completely
different programming model :-s

Signed-off-by: Felipe Balbi <balbi@ti.com>
usb: dwc3: handle in and out ep irq separately

Later we'll see if this is really necessary,
but for now it'll let us see the similarities
on the code once it's implemented.

There are plenty of structures which we still
don't have. Before we can implement this, we
need e.g. a structure to represent the HW
endpoint and a list or array of endpoints
in struct dwc. See musb driver for a reference.

Signed-off-by: Felipe Balbi <balbi@ti.com>