aboutsummaryrefslogtreecommitdiff
path: root/drivers/usb/dwc2/params.c
AgeCommit message (Collapse)AuthorFilesLines
2017-01-24usb: dwc2: Remove platform static paramsJohn Youn1-154/+108
Remove the platform-specific static param structs and set only those params that are necessary for each platform. Signed-off-by: John Youn <[email protected]> Signed-off-by: Felipe Balbi <[email protected]>
2017-01-24usb: dwc2: Check core parametersJohn Youn1-0/+185
Check that core parameters have valid values and adjust them if they aren't. Signed-off-by: John Youn <[email protected]> Signed-off-by: Felipe Balbi <[email protected]>
2017-01-24usb: dwc2: Get device propertiesJohn Youn1-0/+35
After setting the default core parameter values, read in the device properties and modify core parameter values if needed. Signed-off-by: John Youn <[email protected]> Signed-off-by: Felipe Balbi <[email protected]>
2017-01-24usb: dwc2: Set core parameters to default valuesJohn Youn1-915/+75
Initialize the core parameters to their default, auto-detected values. Remove all the previous dwc2_set_param* methods. Most of what this code is doing is handling defaults for "not set" values and other trivial checks. The checking can be simplified and will be done in a later commit. This allows us to change only those parameters that won't work with default settings. It also allows us to use non-int parameters. Signed-off-by: John Youn <[email protected]> Signed-off-by: Felipe Balbi <[email protected]>
2017-01-24usb: dwc2: Remove unused otg_ver parameterJohn Youn1-23/+0
The otg_ver parameter only controls the SRP pulsing method and defaults to the 1.3 behavior. It is unused and can be removed. Signed-off-by: John Youn <[email protected]> Signed-off-by: Felipe Balbi <[email protected]>
2017-01-24usb: dwc2: Fix lines over 80 charactersJohn Youn1-7/+7
Fix lines over 80 characters. Signed-off-by: John Youn <[email protected]> Signed-off-by: Felipe Balbi <[email protected]>
2017-01-24usb: dwc2: Cleanup some checkpatch issuesJohn Youn1-7/+7
This commmit is the result of running checkpatch --fix. The results were verified for correctness. Some of the fixes result in line over 80 char which we will fix manually later. The following is a summary of what was done by checkpatch: * Remove externs on function prototypes. * Replace symbolic permissions with octal. * Align code to open parens. * Replace 'unsigned' with 'unsigned int'. * Remove unneccessary blank lines. * Add blank lines after declarations. * Add spaces around operators. * Remove unnecessary spaces after casts. * Replace 'x == NULL' with '!x'. * Replace kzalloc() with kcalloc(). * Concatenate multi-line strings. * Use the BIT() macro. Signed-off-by: John Youn <[email protected]> Signed-off-by: Felipe Balbi <[email protected]>
2017-01-24usb: dwc2: use u32 for DT binding parametersLeo Yan1-5/+5
Commit 05ee799f2021 ("usb: dwc2: Move gadget settings into core_params") changes to type u16 for DT binding "g-rx-fifo-size" and "g-np-tx-fifo-size" but use type u32 for "g-tx-fifo-size". Finally the the first two parameters cannot be passed successfully with wrong data format. This is found the data transferring broken on 96boards Hikey. This patch is to change all parameters to u32 type, and verified on Hikey board the DT parameters can pass successfully. [johnyoun: minor rebase] Signed-off-by: Leo Yan <[email protected]> Signed-off-by: John Youn <[email protected]> Tested-by: John Stultz <[email protected]> Signed-off-by: Felipe Balbi <[email protected]>
2017-01-02usb: dwc2: gadget: fix default value for gadget-dma-descStefan Wahren1-1/+1
The current default for gadget DMA descriptor results on bcm2835 in a unnecessary error message: Invalid value 1 for param gadget-dma-desc So fix this by using hw->dma_desc_enable as default value. Fixes: dec4b55677e ("usb: dwc2: gadget: Add descriptor DMA parameter") Acked-by: John Youn <[email protected]> Signed-off-by: Stefan Wahren <[email protected]> Signed-off-by: Felipe Balbi <[email protected]>
2017-01-02usb: dwc2: fix default value for DMA supportStefan Wahren1-2/+2
The current defaults for DMA results on a non-DMA platform in a unnecessary error message: Invalid value 0 for param gadget-dma So fix this by using dma_capable as default value. Fixes: 9962b62f1be ("usb: dwc2: Deprecate g-use-dma binding") Acked-by: John Youn <[email protected]> Signed-off-by: Stefan Wahren <[email protected]> Signed-off-by: Felipe Balbi <[email protected]>
2017-01-02usb: dwc2: fix dwc2_get_device_property for u8 and u16Stefan Wahren1-12/+0
According to the Devicetree ePAPR [1] the datatypes u8 and u16 are not defined. So using device_property_read_u16() would result in a partial read of a 32-bit big-endian integer which is not intended. So we better read the complete 32-bit value. This fixes a regression on bcm2835 where the values for g-rx-fifo-size and g-np-tx-fifo-size always read as zero: Invalid value 0 for param g-rx-fifo-size Invalid value 0 for param g-np-tx-fifo-size [1] - http://elinux.org/images/c/cf/Power_ePAPR_APPROVED_v1.1.pdf Fixes: 05ee799f202 ("usb: dwc2: Move gadget settings into core_params") Acked-by: John Youn <[email protected]> Signed-off-by: Stefan Wahren <[email protected]> Signed-off-by: Felipe Balbi <[email protected]>
2017-01-02usb: dwc2: Do not set host parameter in peripheral modeStefan Wahren1-6/+6
Since commit "usb: dwc2: Improve handling of host and device hwparams" the host mode specific hardware parameter aren't initialized in peripheral mode from the register settings anymore. So we better do not set them in this case which avoids the following warnings on bcm2835: 256 invalid for host_nperio_tx_fifo_size. Check HW configuration. 512 invalid for host_perio_tx_fifo_size. Check HW configuration. Fixes: 55e1040e424b ("usb: dwc2: Improve handling of host and device hwparams") Acked-by: John Youn <[email protected]> Signed-off-by: Stefan Wahren <[email protected]> Signed-off-by: Felipe Balbi <[email protected]>
2016-11-18usb: dwc2: add amcc,dwc-otg supportChristian Lamparter1-0/+1
This patch adds support for the "amcc,usb-otg" device which is found in the PowerPC Canyonlands' dts. The device definition was added by: commit c89b3458d8cc ("powerpc/44x: Add USB DWC DTS entry to Canyonlands board") but without any driver support as the dwc2 driver wasn't available at that time. Note: The system can't use the generic "snps,dwc2" compatible because of the special ahbcfg configuration. The default GAHBCFG_HBSTLEN_INCR4 of snps,dwc2 can cause a system hang when the USB and SATA is used concurrently. Signed-off-by: Christian Lamparter <[email protected]> Signed-off-by: John Youn <[email protected]> Signed-off-by: Felipe Balbi <[email protected]>
2016-11-18usb: dwc2: fixes host_dma logicChristian Lamparter1-3/+2
This patch moves the the host_dma initialization before dwc2_set_param_dma_desc_enable() and dwc2_set_param_dma_desc_fs_enable(). The reason being that both function need it. Fixes: 1205489cee75bf39 ("usb: dwc2: Get host DMA device properties") Acked-by: John Youn <[email protected]> Signed-off-by: Christian Lamparter <[email protected]> Signed-off-by: Felipe Balbi <[email protected]>
2016-11-18usb: dwc2: gadget: Add new core parameter for low speedVardan Mikayelyan1-2/+6
Added new core param for low speed, which can be used only when SNPSID is equal to DWC2_CORE_FS_IOT. When LS mode is enabled, we are restricting ep types and providing to upper layer only INTR and CTRL endpoints. Signed-off-by: Vardan Mikayelyan <[email protected]> Signed-off-by: John Youn <[email protected]> Signed-off-by: Felipe Balbi <[email protected]>
2016-11-18usb: dwc2: gadget: Add IOT device IDs, configure core accordinglyVardan Mikayelyan1-1/+8
Add new device IDs for IOT gadget. Done changes in probe to configure core accordingly depending on device ID value. Signed-off-by: Vardan Mikayelyan <[email protected]> Signed-off-by: John Youn <[email protected]> Signed-off-by: Felipe Balbi <[email protected]>
2016-11-18usb: dwc2: Remove reading in of invalid propertyJohn Youn1-6/+1
This property was mistakenly added, then removed, so don't read it in. Signed-off-by: John Youn <[email protected]> Signed-off-by: Felipe Balbi <[email protected]>
2016-11-18usb: dwc2: gadget: Add descriptor DMA parameterVahram Aharonyan1-0/+6
Add a parameter for descriptor DMA and set it based on hardware capabilities. This won't actually be used by the gadget until later, when the descriptor DMA code is in place. Signed-off-by: Vahram Aharonyan <[email protected]> Signed-off-by: John Youn <[email protected]> Signed-off-by: Felipe Balbi <[email protected]>
2016-11-18usb: dwc2: Deprecate g-use-dma bindingJohn Youn1-3/+14
This is not needed as the gadget now fully supports DMA and it can autodetect it. This was initially added because gadget DMA mode was only partially implemented so could not be automatically enabled. Signed-off-by: John Youn <[email protected]> Signed-off-by: Felipe Balbi <[email protected]>
2016-11-18usb: dwc2: Get host DMA device propertiesJohn Youn1-30/+18
The driver will automatically enable host DMA and use it if available. This is consistent with the behavior of all existing platforms. Read in the "snps,host-dma-disable" device property to disable it. Signed-off-by: John Youn <[email protected]> Signed-off-by: Felipe Balbi <[email protected]>
2016-11-18usb: dwc2: Rename the dma_enable parameter to host_dmaJohn Youn1-15/+15
Rename it so that it is more consistent with the gadget dma parameter. It only affects host-mode operation so prefix it with "host". Signed-off-by: John Youn <[email protected]> Signed-off-by: Felipe Balbi <[email protected]>
2016-11-18usb: dwc2: Move gadget settings into core_paramsJohn Youn1-4/+258
Move the gadget devicetree settings into the core_params structure and document them. Then set and check them in params.c, with the addition of some helper functions, and remove the equivalent code in gadget.c. Because these parameters came from the standalone s3c driver, they have a fixed default value rather than an autodetected one. Preserve and document this behavior to avoid any compatibility issues. Signed-off-by: John Youn <[email protected]> Signed-off-by: Felipe Balbi <[email protected]>
2016-11-18usb: dwc2: Rename host_rx_fifo_size hardware parameterJohn Youn1-5/+5
This hardware parameter is not host specific. It also applies to device mode. Drop the "host" from the name to make that clear. Signed-off-by: John Youn <[email protected]> Signed-off-by: Felipe Balbi <[email protected]>
2016-11-18usb: dwc2: Remove unnecessary prototypesJohn Youn1-28/+34
Remove the unnecessary prototypes for all the parameter setting functions and declare those functions 'static' in the params.c file. Also remove the duplicate documentation that went along with them. They are already documented as part of the params structure definition. Then move the constants that went along with the prototype into the structure. Signed-off-by: John Youn <[email protected]> Signed-off-by: Felipe Balbi <[email protected]>
2016-11-18usb: dwc2: Remove dwc2_set_all_params functionJohn Youn1-34/+44
Replace this by statically defining a function with defaults, and just assigning it. This will allow us to use parameters of any type and any default value. Signed-off-by: John Youn <[email protected]> Signed-off-by: Felipe Balbi <[email protected]>
2016-11-18usb: dwc2: Move parameter initialization into params.cJohn Youn1-0/+29
Consolidate and move all the parameter initialization code from the probe function to params.c. Signed-off-by: John Youn <[email protected]> Signed-off-by: Felipe Balbi <[email protected]>
2016-11-18usb: dwc2: Declare the core params struct staticallyJohn Youn1-34/+34
This makes it consistent with the hw_params struct and simplifies the memory management for future refactoring. Fix up usage in all files. Signed-off-by: John Youn <[email protected]> Signed-off-by: Felipe Balbi <[email protected]>
2016-11-18usb: dwc2: Add params.c fileJohn Youn1-0/+1125
Add a params.c file and move all driver parameter code there, including all the static parameter definitions. Signed-off-by: John Youn <[email protected]> Signed-off-by: Felipe Balbi <[email protected]>