summaryrefslogtreecommitdiff
path: root/drivers/usb/dwc3/core.h
AgeCommit message (Collapse)Author
2015-01-12usb: dwc3: Remove current_trb as it is unusedAmit Virdi
This field was introduced but never used. So, remove it. Signed-off-by: Amit Virdi <amit.virdi@st.com> Signed-off-by: Felipe Balbi <balbi@ti.com>
2014-11-03usb: dwc3: make HIRD threshold configurableHuang Rui
HIRD threshold should be configurable by different platforms. From DesignWare databook: When HIRD_Threshold[4] is set to 1b1 and HIRD value is greater than or equal to the value in HIRD_Threshold[3:0], dwc3 asserts output signals utmi_l1_suspend_n to put PHY into Deep Low-Power mode in L1. When HIRD_Threshold[4] is set to 1b0 or the HIRD value is less than HIRD_Threshold[3:0], dwc3 asserts output signals utmi_sleep_n on L1. Signed-off-by: Huang Rui <ray.huang@amd.com> Signed-off-by: Felipe Balbi <balbi@ti.com>
2014-11-03usb: dwc3: add disable usb2 suspend phy quirkHuang Rui
This patch adds disable usb2 suspend phy quirk, and some special platforms can configure that if it is needed. Signed-off-by: Huang Rui <ray.huang@amd.com> Signed-off-by: Felipe Balbi <balbi@ti.com>
2014-11-03usb: dwc3: add disable usb3 suspend phy quirkHuang Rui
This patch adds disable usb3 suspend phy quirk, and some special platforms can configure that if it is needed. Signed-off-by: Huang Rui <ray.huang@amd.com> Signed-off-by: Felipe Balbi <balbi@ti.com>
2014-11-03usb: dwc3: add Tx de-emphasis quirkHuang Rui
This patch adds Tx de-emphasis quirk, and the Tx de-emphasis value is configurable according to PIPE3 specification. Value Description 0 -6dB de-emphasis 1 -3.5dB de-emphasis 2 No de-emphasis 3 Reserved It can be configured on DT or platform data. Signed-off-by: Huang Rui <ray.huang@amd.com> Signed-off-by: Felipe Balbi <balbi@ti.com>
2014-11-03usb: dwc3: add rx_detect to polling lfps quirkHuang Rui
This patch adds RX_DETECT to Polling.LFPS control quirk, and some special platforms can configure that if it is needed. [ balbi@ti.com : added DeviceTree binding documentation ] Signed-off-by: Huang Rui <ray.huang@amd.com> Signed-off-by: Felipe Balbi <balbi@ti.com>
2014-11-03usb: dwc3: add lfps filter quirkHuang Rui
This patch adds LFPS filter quirk, and some special platforms can configure that if it is needed. [ balbi@ti.com : added DeviceTree binding documentation ] Signed-off-by: Huang Rui <ray.huang@amd.com> Signed-off-by: Felipe Balbi <balbi@ti.com>
2014-11-03usb: dwc3: add delay phy power change quirkHuang Rui
This patch adds delay PHY power change from P0 to P1/P2/P3 when link state changing from U0 to U1/U2/U3 respectively, and some special platforms can configure that if it is needed. [ balbi@ti.com : added DeviceTree binding documentation ] Signed-off-by: Huang Rui <ray.huang@amd.com> Signed-off-by: Felipe Balbi <balbi@ti.com>
2014-11-03usb: dwc3: add delay p1p2p3 quirkHuang Rui
This patch adds delay P0 to P1/P2/P3 quirk for U2/U2/U3, and some special platforms can configure that if it is needed. [ balbi@ti.com : added DeviceTree binding documentation ] Signed-off-by: Huang Rui <ray.huang@amd.com> Signed-off-by: Felipe Balbi <balbi@ti.com>
2014-11-03usb: dwc3: add request p1p2p3 quirkHuang Rui
This patch adds request P1/P2/P3 quirk for U2/U2/U3, and some special platforms can configure that if it is needed. [ balbi@ti.com : added DeviceTree binding documentation ] Signed-off-by: Huang Rui <ray.huang@amd.com> Signed-off-by: Felipe Balbi <balbi@ti.com>
2014-11-03usb: dwc3: add P3 in U2 SS inactive quirkHuang Rui
This patch adds P3 in U2 SS inactive quirk, and some special platforms can configure that if it is needed. [ balbi@ti.com : added DeviceTree binding documentation ] Signed-off-by: Huang Rui <ray.huang@amd.com> Signed-off-by: Felipe Balbi <balbi@ti.com>
2014-11-03usb: dwc3: add u2exit lfps quirkHuang Rui
This patch adds u2exit lfps quirk, and some special platforms can configure that if it is needed. [ balbi@ti.com : added DeviceTree binding documentation ] Signed-off-by: Huang Rui <ray.huang@amd.com> Signed-off-by: Felipe Balbi <balbi@ti.com>
2014-11-03usb: dwc3: add lpm erratum supportHuang Rui
When parameter DWC_USB3_LPM_ERRATA_ENABLE is enabled in Andvanced Configuration of coreConsultant, it supports of xHCI BESL Errata Dated 10/19/2011 is enabled in host mode. In device mode it adds the capability to send NYET response threshold based on the BESL value received in the LPM token, and the threhold is configurable for each soc platform. This patch adds an entry that soc platform is able to define the lpm capacity with their own device tree or bus glue layer. [ balbi@ti.com : added devicetree documentation, spelled threshold completely, made sure threshold is only applied to proper core revisions. ] Signed-off-by: Huang Rui <ray.huang@amd.com> Signed-off-by: Felipe Balbi <balbi@ti.com>
2014-11-03usb: dwc3: add disscramble quirkHuang Rui
This patch adds disscramble quirk, and it only needs to be enabled at fpga board on some vendor platforms. Signed-off-by: Huang Rui <ray.huang@amd.com> Signed-off-by: Felipe Balbi <balbi@ti.com>
2014-11-03usb: dwc3: add a flag to check if it is fpga boardHuang Rui
Some chip vendor is on pre-silicon phase, which needs to use the simulation board. It should have the same product and vendor id with the true soc, but might have some minor different configurations. Below thread discussion proposes to find a method to distinguish between simulation board and soc. http://marc.info/?l=linux-usb&m=141194772206369&w=2 In Andvanced Configuration of coreConsultant, there is the parameter of DWC_USB_EN_FPGA. This bit has the function we need. And it would response as 7 bit of GHWPARAMS6 register. So it's able to check this functional bit to confirm if works on FPGA board. Reported-by: Felipe Balbi <balbi@ti.com> Signed-off-by: Huang Rui <ray.huang@amd.com> Signed-off-by: Felipe Balbi <balbi@ti.com>
2014-11-03usb: dwc3: get rid of ->prepare()/->complete()Felipe Balbi
Using ->prepare()/->complete() to mask/unmask IRQs is wrong at least for dwc3. We need to make sure that by the end of ->resume(), IRQs are working and ready to fire because a child device may need working IRQs for its own ->resume() method. Signed-off-by: Felipe Balbi <balbi@ti.com>
2014-09-05usb: dwc3: add tracepoints to aid debuggingFelipe Balbi
When we're debugging hard-to-reproduce and time-sensitive use cases, printk() poses too much overhead. That's when the kernel's tracing infrastructure comes into play. This patch implements a few initial tracepoints for the dwc3 driver. More traces can be added as necessary in order to ease the task of debugging dwc3. Reviewed-by: Paul Zimmerman <paulz@synopsys.com> Signed-off-by: Felipe Balbi <balbi@ti.com>
2014-09-05usb: dwc3: gadget: cmd argument should always be unsignedFelipe Balbi
No functional changes, just making sure we're dealing with unsigned ints. Signed-off-by: Felipe Balbi <balbi@ti.com>
2014-06-30usb: dwc3: add support for USB 2.0-only core configurationPaul Zimmerman
Newer DWC3 controllers can be built for USB 2.0-only mode, where most of the USB 3.0 circuitry is left out. To support this mode, the driver must limit the speed programmed into the DCFG register to Hi-Speed or lower. Reads and writes to the PIPECTL register are left as-is, since they should be no-ops in USB 2.0-only mode. Calls to phy_init() etc. for the USB3 phy are also left as-is, since the no-op USB3 phy should be used for USB 2.0-only mode controllers. Signed-off-by: Paul Zimmerman <paulz@synopsys.com> Signed-off-by: Felipe Balbi <balbi@ti.com>
2014-03-05usb: dwc3: adapt dwc3 core to use Generic PHY FrameworkKishon Vijay Abraham I
Adapted dwc3 core to use the Generic PHY Framework. So for init, exit, power_on and power_off the following APIs are used phy_init(), phy_exit(), phy_power_on() and phy_power_off(). However using the old USB phy library wont be removed till the PHYs of all other SoC's using dwc3 core is adapted to the Generic PHY Framework. Signed-off-by: Kishon Vijay Abraham I <kishon@ti.com> Signed-off-by: Felipe Balbi <balbi@ti.com>
2014-03-05usb: dwc3: define more revisionsFelipe Balbi
few new revisions of the core have been released, add them to our list of revisions so we can apply workarounds if necessary. Signed-off-by: Felipe Balbi <balbi@ti.com>
2014-03-05usb: dwc3: fix randconfig build errorsFelipe Balbi
commit 388e5c5 (usb: dwc3: remove dwc3 dependency on host AND gadget.) created the possibility for host-only and peripheral-only dwc3 builds but left a possible randconfig build error when host-only builds are selected. Cc: <stable@vger.kernel.org> # v3.8+ Reported-by: Jim Davis <jim.epost@gmail.com> Signed-off-by: Felipe Balbi <balbi@ti.com>
2014-03-05usb: dwc3: core: fix indentationFelipe Balbi
no functional changes, just converting spaces into tab. Signed-off-by: Felipe Balbi <balbi@ti.com>
2014-03-05usb: dwc3: core: allocate scratch buffersFelipe Balbi
We must read HWPARAMS4 register to figure out how many scratch buffers we should allocate. Later patch will use "Set Scratchpad Buffer Array" command to pass the pointer to the IP so it can be used during hibernation. Signed-off-by: Felipe Balbi <balbi@ti.com>
2014-03-05usb: dwc3: add 'saved_state' field to dwc3_ep structurePaul Zimmerman
This extra field will save endpoint state when we're about to enter hibernation. It will be used later to restore the endpoint state when resuming. Signed-off-by: Paul Zimmerman <paulz@synopsys.com> Signed-off-by: Felipe Balbi <balbi@ti.com>
2014-03-05usb: dwc3: add has_hibernation flagFelipe Balbi
this will tell driver that this version of the core was configured with hibernation feature enabled. Signed-off-by: Felipe Balbi <balbi@ti.com>
2014-03-05usb: dwc3: cleanup struct dwc3Felipe Balbi
move 1-bit flags to the bottom of the structure, sort all bit flags alphabetically, add documentation which was missing. Signed-off-by: Felipe Balbi <balbi@ti.com>
2014-03-05usb: dwc3: core: define bit 10 of GCTL registerFelipe Balbi
This bit is necessary for implemeting workaround for known issue with some revisions of this core. Signed-off-by: Felipe Balbi <balbi@ti.com>
2014-02-20usb: dwc3: fix wrong bit mask in dwc3_event_devtHuang Rui
Around DWC USB3 2.30a release another bit has been added to the Device-Specific Event (DEVT) Event Information (EvtInfo) bitfield. Because of that, what used to be 8 bits long, has become 9 bits long. Per dwc3 2.30a+ spec in the Device-Specific Event (DEVT), the field of Event Information Bits(EvtInfo) uses [24:16] bits, and it has 9 bits not 8 bits. And the following reserved field uses [31:25] bits not [31:24] bits, and it has 7 bits. So in dwc3_event_devt, the bit mask should be: event_info [24:16] 9 bits reserved31_25 [31:25] 7 bits This patch makes sure that newer core releases will work fine with Linux and that we will decode the event information properly on new core releases. [ balbi@ti.com : improve commit log a bit ] Cc: <stable@vger.kernel.org> Signed-off-by: Huang Rui <ray.huang@amd.com> Signed-off-by: Felipe Balbi <balbi@ti.com>
2013-07-29usb: dwc3: fix typo in comment of dwc3_epHuang Rui
Change intervall into interval. Signed-off-by: Huang Rui <ray.huang@amd.com> Signed-off-by: Felipe Balbi <balbi@ti.com>
2013-07-29usb: dwc3: core: introduce and use macros for Event Size registerFelipe Balbi
That register has more than just the event buffer size; we can also mask and unmask that particular interrupter on bit 31 of that register. In this patch we introduce the necessary macros and make sure to use the new macros while also making sure we mask interrupts during driver removal. Signed-off-by: Felipe Balbi <balbi@ti.com>
2013-07-29usb: dwc3: core: don't redefine DWC3_DCFG_LPM_CAPFelipe Balbi
the macro DWC3_DCFG_LPM_CAP was defined twice. This patch just removes one of the definitions, no functional changes. Signed-off-by: Felipe Balbi <balbi@ti.com>
2013-07-29usb: dwc3: adapt to use dr_mode device tree helperRuchika Kharwar
This patch adapts the dwc3 to use the device tree helper "of_usb_get_dr_mode" for the mode of operation of the dwc3 instance being probed. [ balbi@ti.com : make of_usb_get_dr_mode() conditional on dev->of_node and let pdata pass dr_mode too ] Reviewed-by: Roger Quadros <rogerq@ti.com> Signed-off-by: Ruchika Kharwar <ruchika@ti.com> Signed-off-by: Felipe Balbi <balbi@ti.com>
2013-07-29usb: dwc3: switch to GPL v2 onlyFelipe Balbi
This is a Linux-only driver which makes use of GPL-only symbols. It makes no sense to maintain Dual BSD/GPL licensing for this driver. Considering that the amount of work to use this driver in any different operating system would likely be as large as developing the driver from scratch and considering that we depend on GPL-only symbols, we will switch over to a GPL v2-only license. Cc: Anton Tikhomirov <av.tikhomirov@samsung.com> Acked-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de> Signed-off-by: Felipe Balbi <balbi@ti.com>
2013-07-29usb: dwc3: clean up redundant parameter commentHuang Rui
@list is not as a parameter of dwc3_event_buffer, so remove it in comments. Signed-off-by: Huang Rui <ray.huang@amd.com> Signed-off-by: Felipe Balbi <balbi@ti.com>
2013-07-15usb: dwc3: fix wrong bit mask in dwc3_event_typeHuang Rui
Per dwc3 2.50a spec, the is_devspec bit is used to distinguish the Device Endpoint-Specific Event or Device-Specific Event (DEVT). If the bit is 1, the event is represented Device-Specific Event, then use [7:1] bits as Device Specific Event to marked the type. It has 7 bits, and we can see the reserved8_31 variable name which means from 8 to 31 bits marked reserved, actually there are 24 bits not 25 bits between that. And 1 + 7 + 24 = 32, the event size is 4 byes. So in dwc3_event_type, the bit mask should be: is_devspec [0] 1 bit type [7:1] 7 bits reserved8_31 [31:8] 24 bits This patch should be backported to kernels as old as 3.2, that contain the commit 72246da40f3719af3bfd104a2365b32537c27d83 "usb: Introduce DesignWare USB3 DRD Driver". Cc: <stable@vger.kernel.org> Signed-off-by: Huang Rui <ray.huang@amd.com> Signed-off-by: Felipe Balbi <balbi@ti.com>
2013-03-18usb: dwc3: core: fix wrong OTG event regitser offsetGeorge Cherian
This patch fixes the wrong OTG_EVT,OTG_EVTEN and OTG_STS register offsets. While at that, also add a missing register to debugfs regdump utility. Signed-off-by: George Cherian <george.cherian@ti.com> Signed-off-by: Felipe Balbi <balbi@ti.com>
2013-03-18usb: dwc3: calculate the number of endpointsFelipe Balbi
hwparams2 holds the number of endpoints which were selected during RTL generation, we can use that on our driver. Signed-off-by: Felipe Balbi <balbi@ti.com>
2013-03-18usb: dwc3: core: define more revisionsFelipe Balbi
Some new revisions of the DWC3 core have been released, let's add our defines to help implementing known erratas. Signed-off-by: Felipe Balbi <balbi@ti.com>
2013-03-18usb: dwc3: remove our homebrew state mechanismFelipe Balbi
We can reuse the generic implementation via our struct usb_gadget. Signed-off-by: Felipe Balbi <balbi@ti.com>
2013-03-18usb: dwc3: add count field to event bufferFelipe Balbi
we can cache the last read value of the event buffer count register on this field, for later handling. Signed-off-by: Felipe Balbi <balbi@ti.com>
2013-03-18usb: dwc3: add a flags field to event bufferFelipe Balbi
that way we know if a particular event buffer has pending events, or not. Signed-off-by: Felipe Balbi <balbi@ti.com>
2013-03-18usb: dwc3: core: remove bogus comment to our structureFelipe Balbi
that irq field has been removed already. This patch just removes its documentation. Signed-off-by: Felipe Balbi <balbi@ti.com>
2013-03-18usb: dwc3: core: add power management supportFelipe Balbi
Add support for basic power management on the dwc3 driver. While there is still lots to improve for full PM support, this minimal patch will already make sure that we survive suspend-to-ram and suspend-to-disk without major issues. Cc: Vikas C Sajjan <vikas.sajjan@linaro.org> Tested-by: Vivek Gautam <gautam.vivek@samsung.com> Signed-off-by: Felipe Balbi <balbi@ti.com>
2013-03-18usb: dwc3: gadget: save state of pullupsFelipe Balbi
This will be used during resume to verify if we should reconnect our pullups or not. Tested-by: Vivek Gautam <gautam.vivek@samsung.com> Signed-off-by: Felipe Balbi <balbi@ti.com>
2013-01-18usb: dwc3: remove dwc3 dependency on host AND gadget.Vivek Gautam
DWC3 controller curretly depends on USB && USB_GADGET. Some hardware may like to use only host feature on dwc3, or only gadget feature. So, removing this dependency of USB_DWC3 on USB and USB_GADGET. Adding the mode of operaiton of DWC3 also here HOST/GADGET/DUAL_ROLE based on which features are enabled. [ balbi@ti.com : . make sure we have default modes for all possible Kernel configurations. . Remove the config -> menuconfig change as it's unnecessary . switch over to IS_ENABLED() ] CC: Doug Anderson <dianders@chromium.org> Signed-off-by: Vivek Gautam <gautam.vivek@samsung.com> Signed-off-by: Felipe Balbi <balbi@ti.com>
2013-01-18usb: dwc3: gadget: fix scatter gather implementationPratyush Anand
To work with scatter gather properly, fixes have been done in number of functions. I will explain requirement of each fixes one by one. start_slot: used to retrieve all request of SG during cleanup dwc3_gadget_giveback: We need to skip link TRB if it was one of the intermediate TRB of SG. dwc3_prepare_one_trb: We need to track all submitted TRBs during cleanup. Since, all TRBs would be serially allocated, so we can just keep starting slot info and we can always find rest of them. We need to pass sg node number, so that we cab appropriately program ISOC_FIRST/ISOC, Chain etc. dwc3_prepare_trbs: last_one should be set when it is last node of SG as well as last node of request_list. __dwc3_cleanup_done_trbs: It has been prepared after re-factorization of dwc3_cleanup_done_reqs. It is called for each TRB of SG. Signed-off-by: Pratyush Anand <pratyush.anand@st.com> Signed-off-by: Felipe Balbi <balbi@ti.com>
2013-01-18usb: dwc3: gadget: fix missed isocPratyush Anand
There are two reasons to generate missed isoc. 1. when the host does not poll for all the data. 2. because of application-side delays that prevent all the data from being transferred in programmed microframe. Current code was able to handle first case only. This patch handles scenario 2 as well.Scenario 2 sometime may occur with complex gadget application, however it can be easily reproduced for testing purpose as follows: a. use isoc binterval as 1 in f_sourcesink. b. use pattern=0 c. introduce a delay of 150us deliberately in source_sink_complete, so that after few frames it lands into scenario 2. d. now run testusb 16 (isoc in test). You will notice that if this patch is not applied then isoc transfer is not able to recover after first missed. Current patch's approach is as under: If missed isoc occurs and there is no request queued then issue END TRANSFER, so that core generates next xfernotready and we will issue a fresh START TRANSFER. If there are still queued request then wait, do not issue either END or UPDATE TRANSFER, just attach next request in request_list during giveback. If any future queued request is successfully transferred then we will issue UPDATE TRANSFER for all request in the request_list. Cc: <stable@vger.kernel.org> # v3.6 v3.7 v3.8 Signed-off-by: Pratyush Anand <pratyush.anand@st.com> Signed-off-by: Felipe Balbi <balbi@ti.com>
2013-01-18usb: dwc3: debugfs: convert our regdump to use regsetsFelipe Balbi
regset is a generic implementation of regdump utility through debugfs. Signed-off-by: Felipe Balbi <balbi@ti.com>
2013-01-18usb: dwc3: decrease event buffer sizeFelipe Balbi
Currently we're allocating an entire page to serve as our event buffer. Provided our events are 4 bytes long, it's very unlikely we will even trigger 1k events at once. Even in the worst case scenario where every endpoint triggers one event and we still have a couple of error events, that would still be less than 40 events. In order to cope with future versions of the IP which could (or could not) increase the amount of possible events to trigger simultaneously, we're using an arbitrary size of 64 events for our event buffer. We're saving 3840 bytes by doing so. Signed-off-by: Felipe Balbi <balbi@ti.com>