Minas Harutyunyan [Thu, 21 May 2020 06:05:44 +0000 (10:05 +0400)]
usb: dwc2: Update Core Reset programming flow.
Starting from core version 4.20a Core Reset flow is changed.
Introduced new bit in GRSTCTL register - GRSTCTL_CSFTRST_DONE.
Core Reset new programming flow steps are follow:
1. Set GRSTCTL_CSFTRST bit.
2. Wait for bit GRSTCTL_CSFTRST_DONE is set.
3. Clear GRSTCTL_CSFTRST and GRSTCTL_CSFTRST_DONE bits.
Check core version functionality separated from dwc2_get_hwparams() to
new dwc2_check_core_version() function because Core Reset flow depend
on SNPSID.
Signed-off-by: Minas Harutyunyan <hminas@synopsys.com>
Signed-off-by: Felipe Balbi <balbi@kernel.org>
Tang Bin [Fri, 10 Apr 2020 01:58:32 +0000 (09:58 +0800)]
usb: gadget: fsl: Fix a wrong judgment in fsl_udc_probe()
If the function "platform_get_irq()" failed, the negative value
returned will not be detected here, including "-EPROBE_DEFER", which
causes the application to fail to get the correct error message.
Thus it must be fixed.
Acked-by: Li Yang <leoyang.li@nxp.com>
Signed-off-by: Tang Bin <tangbin@cmss.chinamobile.com>
Signed-off-by: Shengju Zhang <zhangshengju@cmss.chinamobile.com>
Signed-off-by: Felipe Balbi <balbi@kernel.org>
Qiushi Wu [Sat, 23 May 2020 04:06:25 +0000 (23:06 -0500)]
usb: gadget: fix potential double-free in m66592_probe.
m66592_free_request() is called under label "err_add_udc"
and "clean_up", and m66592->ep0_req is not set to NULL after
first free, leading to a double-free. Fix this issue by
setting m66592->ep0_req to NULL after the first free.
Fixes:
0f91349b89f3 ("usb: gadget: convert all users to the new udc infrastructure")
Signed-off-by: Qiushi Wu <wu000273@umn.edu>
Signed-off-by: Felipe Balbi <balbi@kernel.org>
Dinghao Liu [Thu, 21 May 2020 07:39:19 +0000 (15:39 +0800)]
usb: cdns3: Fix runtime PM imbalance on error
pm_runtime_get_sync() increments the runtime PM usage counter even
when it returns an error code. Thus a pairing decrement is needed on
the error handling path to keep the counter balanced.
Reviewed-by: Peter Chen <peter.chen@nxp.com>
Signed-off-by: Dinghao Liu <dinghao.liu@zju.edu.cn>
Signed-off-by: Felipe Balbi <balbi@kernel.org>
Colin Ian King [Thu, 21 May 2020 15:13:00 +0000 (16:13 +0100)]
usb: gadget: lpc32xx_udc: don't dereference ep pointer before null check
Currently pointer ep is being dereferenced before it is null checked
leading to a null pointer dereference issue. Fix this by only assigning
pointer udc once ep is known to be not null. Also remove a debug
message that requires a valid udc which may not be possible at that
point.
Addresses-Coverity: ("Dereference before null check")
Fixes:
24a28e428351 ("USB: gadget driver for LPC32xx")
Signed-off-by: Colin Ian King <colin.king@canonical.com>
Signed-off-by: Felipe Balbi <balbi@kernel.org>
Yu Chen [Thu, 21 May 2020 08:46:43 +0000 (16:46 +0800)]
usb: dwc3: Increase timeout for CmdAct cleared by device controller
If the SS PHY is in P3, there is no pipe_clk, HW may use suspend_clk
for function, as suspend_clk is slow so EP command need more time to
complete, e.g, imx8M suspend_clk is 32K, set ep configuration will
take about 380us per below trace time stamp(44.286278 - 44.285897
= 0.000381):
configfs_acm.sh-822 [000] d..1 44.285896: dwc3_writel: addr
000000006d59aae1 value
00000401
configfs_acm.sh-822 [000] d..1 44.285897: dwc3_readl: addr
000000006d59aae1 value
00000401
... ...
configfs_acm.sh-822 [000] d..1 44.286278: dwc3_readl: addr
000000006d59aae1 value
00000001
configfs_acm.sh-822 [000] d..1 44.286279: dwc3_gadget_ep_cmd:
ep0out: cmd 'Set Endpoint Configuration' [401] params
00001000
00000500 00000000 --> status: Successful
This was originally found on Hisilicon Kirin Soc that need more time
for the device controller to clear the CmdAct of DEPCMD.
Signed-off-by: Yu Chen <chenyu56@huawei.com>
Signed-off-by: John Stultz <john.stultz@linaro.org>
Signed-off-by: Li Jun <jun.li@nxp.com>
Signed-off-by: Felipe Balbi <balbi@kernel.org>
Andrey Konovalov [Wed, 13 May 2020 20:52:56 +0000 (22:52 +0200)]
USB: dummy-hcd: use configurable endpoint naming scheme
USB gadget subsystem uses the following naming convention for UDC
endpoints:
- "ep-a" names for fully configurable endpoints (address, direction and
transfer type can be changed);
- "ep1in", "ep12out-bulk" names for fixed function endpoints (fixed
address, direction and/or transfer type).
Dummy UDC endpoints are capable of full configuration, but named using
the second scheme.
This patch changes the names of generic Dummy UDC endpoints to "ep-aout",
"ep-bin", etc., to advertise that they have configurable addresses and
transfer types (except that Dummy UDC doesn't support ISO transfers), but
fixed direction.
This is required for Raw Gadget (and perhaps for some other drivers),
that reasons about whether an endpoint has configurable address based
on its name.
Suggested-by: Alan Stern <stern@rowland.harvard.edu>
Acked-by: Alan Stern <stern@rowland.harvard.edu>
Signed-off-by: Andrey Konovalov <andreyknvl@google.com>
Signed-off-by: Felipe Balbi <balbi@kernel.org>
Peter Chen [Sun, 10 May 2020 05:30:42 +0000 (13:30 +0800)]
usb: cdns3: gadget: assign interrupt number to USB gadget structure
Assign interrupt number to USB gadget structure.
Reviewed-by: Jun Li <jun.li@nxp.com>
Signed-off-by: Peter Chen <peter.chen@nxp.com>
Signed-off-by: Felipe Balbi <balbi@kernel.org>
Peter Chen [Sun, 10 May 2020 05:30:41 +0000 (13:30 +0800)]
usb: gadget: core: sync interrupt before unbind the udc
The threaded interrupt handler may still be called after the
usb_gadget_disconnect is called, it causes the structures used
at interrupt handler was freed before it uses, eg the
usb_request. This issue usually occurs we remove the udc function
during the transfer. Below is the example when doing stress
test for android switch function, the EP0's request is freed
by .unbind (configfs_composite_unbind -> composite_dev_cleanup),
but the threaded handler accesses this request during handling
setup packet request.
In fact, there is no protection between unbind the udc
and udc interrupt handling, so we have to avoid the interrupt
handler is occurred or scheduled during the .unbind flow.
init: Sending signal 9 to service 'adbd' (pid 18077) process group...
android_work: did not send uevent (0 0
000000007bec2039)
libprocessgroup: Successfully killed process cgroup uid 0 pid 18077 in 6ms
init: Service 'adbd' (pid 18077) received signal 9
init: Sending signal 9 to service 'adbd' (pid 18077) process group...
libprocessgroup: Successfully killed process cgroup uid 0 pid 18077 in 0ms
init: processing action (init.svc.adbd=stopped) from (/init.usb.configfs.rc:14)
init: Received control message 'start' for 'adbd' from pid: 399 (/vendor/bin/hw/android.hardware.usb@1.
init: starting service 'adbd'...
read descriptors
read strings
Unable to handle kernel read from unreadable memory at virtual address
000000000000002a
android_work: sent uevent USB_STATE=CONNECTED
Mem abort info:
ESR = 0x96000004
EC = 0x25: DABT (current EL), IL = 32 bits
SET = 0, FnV = 0
EA = 0, S1PTW = 0
Data abort info:
ISV = 0, ISS = 0x00000004
CM = 0, WnR = 0
user pgtable: 4k pages, 48-bit VAs, pgdp=
00000000e97f1000
using random self ethernet address
[
000000000000002a] pgd=
0000000000000000
Internal error: Oops:
96000004 [#1] PREEMPT SMP
Modules linked in:
CPU: 0 PID: 232 Comm: irq/68-
5b110000 Not tainted 5.4.24-06075-g94a6b52b5815 #92
Hardware name: Freescale i.MX8QXP MEK (DT)
pstate:
00400085 (nzcv daIf +PAN -UAO)
using random host ethernet address
pc : composite_setup+0x5c/0x1730
lr : android_setup+0xc0/0x148
sp :
ffff80001349bba0
x29:
ffff80001349bba0 x28:
ffff00083a50da00
x27:
ffff8000124e6000 x26:
ffff800010177950
x25:
0000000000000040 x24:
ffff000834e18010
x23:
0000000000000000 x22:
0000000000000000
x21:
ffff00083a50da00 x20:
ffff00082e75ec40
x19:
0000000000000000 x18:
0000000000000000
x17:
0000000000000000 x16:
0000000000000000
x15:
0000000000000000 x14:
0000000000000000
x13:
0000000000000000 x12:
0000000000000001
x11:
ffff80001180fb58 x10:
0000000000000040
x9 :
ffff8000120fc980 x8 :
0000000000000000
x7 :
ffff00083f98df50 x6 :
0000000000000100
x5 :
00000307e8978431 x4 :
ffff800011386788
x3 :
0000000000000000 x2 :
ffff800012342000
x1 :
0000000000000000 x0 :
ffff800010c6d3a0
Call trace:
composite_setup+0x5c/0x1730
android_setup+0xc0/0x148
cdns3_ep0_delegate_req+0x64/0x90
cdns3_check_ep0_interrupt_proceed+0x384/0x738
cdns3_device_thread_irq_handler+0x124/0x6e0
cdns3_thread_irq+0x94/0xa0
irq_thread_fn+0x30/0xa0
irq_thread+0x150/0x248
kthread+0xfc/0x128
ret_from_fork+0x10/0x18
Code:
910e8000 f9400693 12001ed7 79400f79 (
3940aa61)
---[ end trace
c685db37f8773fba ]---
Kernel panic - not syncing: Fatal exception
SMP: stopping secondary CPUs
Kernel Offset: disabled
CPU features: 0x0002,
20002008
Memory Limit: none
Rebooting in 5 seconds..
Reviewed-by: Jun Li <jun.li@nxp.com>
Signed-off-by: Peter Chen <peter.chen@nxp.com>
Signed-off-by: Felipe Balbi <balbi@kernel.org>
Sandeep Maheswaram [Wed, 1 Apr 2020 05:15:45 +0000 (10:45 +0530)]
arm64: dts: qcom: sc7180: Add interconnect properties for USB
Populate USB DT nodes with interconnect properties.
Reviewed-by: Stephen Boyd <swboyd@chromium.org>
Signed-off-by: Sandeep Maheswaram <sanm@codeaurora.org>
Signed-off-by: Felipe Balbi <balbi@kernel.org>
Sandeep Maheswaram [Wed, 1 Apr 2020 05:15:44 +0000 (10:45 +0530)]
arm64: dts: qcom: sdm845: Add interconnect properties for USB
Populate USB DT nodes with interconnect properties.
Reviewed-by: Stephen Boyd <swboyd@chromium.org>
Signed-off-by: Sandeep Maheswaram <sanm@codeaurora.org>
Signed-off-by: Felipe Balbi <balbi@kernel.org>
Sandeep Maheswaram [Wed, 1 Apr 2020 05:15:42 +0000 (10:45 +0530)]
dt-bindings: usb: qcom,dwc3: Introduce interconnect properties for Qualcomm DWC3 driver
Add documentation for the interconnects and interconnect-names
properties for USB.
Reviewed-by: Rob Herring <robh@kernel.org>
Reviewed-by: Stephen Boyd <swboyd@chromium.org>
Signed-off-by: Sandeep Maheswaram <sanm@codeaurora.org>
Signed-off-by: Felipe Balbi <balbi@kernel.org>
Gregory CLEMENT [Thu, 7 May 2020 15:56:51 +0000 (17:56 +0200)]
ARM: dts: at91: Remove the USB EP child node
The endpoint configuration used to be stored in the device tree,
however the configuration depend on the "version" of the controller
itself.
Then the EP child node are useless and describe as deprecated in the
documentation binding: remove all the nodes from the SoC device tree
file. Remove also the #address-cells and #size-cells properties that
are no longer needed.
Signed-off-by: Gregory CLEMENT <gregory.clement@bootlin.com>
Signed-off-by: Felipe Balbi <balbi@kernel.org>
Gregory CLEMENT [Thu, 7 May 2020 15:56:50 +0000 (17:56 +0200)]
dt-bindings: usb: atmel: Mark EP child node as deprecated
There is no need to describe the end point in the deice tree. These
properties won't be use anymore, so mark them as deprecated to keep
the old device tree documented.
Reviewed-by: Rob Herring <robh@kernel.org>
Signed-off-by: Gregory CLEMENT <gregory.clement@bootlin.com>
Signed-off-by: Felipe Balbi <balbi@kernel.org>
Gregory CLEMENT [Thu, 7 May 2020 15:56:49 +0000 (17:56 +0200)]
usb: gadget: udc: atmel: Don't use DT to configure end point
The endpoint configuration used to be stored in the device tree,
however the configuration depend on the "version" of the controller
itself.
This information is already documented by the compatible string. It
then possible to just rely on the compatible string and completely
remove the full ep configuration done in the device tree as it was
already the case for all the other USB device controller.
Acked-by: Cristian Birsan <cristian.birsan@microchip.com>
Signed-off-by: Gregory CLEMENT <gregory.clement@bootlin.com>
Signed-off-by: Felipe Balbi <balbi@kernel.org>
Thinh Nguyen [Wed, 6 May 2020 02:47:15 +0000 (19:47 -0700)]
usb: dwc3: gadget: Use SET_EP_PRIME for NoStream
DWC_usb32 v1.00a and later can use SET_EP_PRIME command to reinitiate a
stream. Use the command to handle NoStream rejection instead of ending
and restarting the endpoint.
Signed-off-by: Thinh Nguyen <thinhn@synopsys.com>
Signed-off-by: Felipe Balbi <balbi@kernel.org>
Thinh Nguyen [Wed, 6 May 2020 02:47:09 +0000 (19:47 -0700)]
usb: dwc3: gadget: Handle stream transfers
Overview of stream transfer requirement:
* A transfer will have a set of TRBs of the same stream ID.
* A transfer is started with a stream ID in START_TRANSFER command.
* A new stream will only start when the previous completes.
Overview of stream events:
* A "prime" from host indicates that its endpoints are active
(buffers prepared and ready to receive/transmit data). The controller
automatically initiates stream if it sees this.
* A "NoStream" rejection event indicates that the host isn't ready.
Host will put the endpoint back to idle state. Device may need to
reinitiate the stream to start transfer again.
* A Stream Found event means host accepted device initiated stream.
Nothing needs to be done from driver.
To initiate a stream, the driver will issue START_TRANSFER command with
a stream ID. To reinitiate the stream, the driver must issue
END_TRANSFER and restart the transfer with START_TRANSFER command with
the same stream ID.
This implementation handles device-initated streams (e.g. UASP driver).
It also handles some hosts' quirky behavior where they only prime each
endpoint once.
Signed-off-by: Thinh Nguyen <thinhn@synopsys.com>
Signed-off-by: Felipe Balbi <balbi@kernel.org>
Thinh Nguyen [Wed, 6 May 2020 02:47:03 +0000 (19:47 -0700)]
usb: dwc3: gadget: Don't prepare beyond a transfer
Don't prepare TRBs beyond a transfer. In DWC_usb32, its transfer burst
capability may try to read and use TRBs beyond the active transfer. For
other controllers, they don't process the next transfer TRBs until the
current transfer is completed. Explicitly prevent preparing TRBs ahead
for all controllers.
Signed-off-by: Thinh Nguyen <thinhn@synopsys.com>
Signed-off-by: Felipe Balbi <balbi@kernel.org>
Thinh Nguyen [Wed, 6 May 2020 02:46:57 +0000 (19:46 -0700)]
usb: dwc3: gadget: Wait for transfer completion
If a transfer is in-progress, any new request should not kick off
another transfer. The driver needs to wait for the current transfer to
complete before starting off the next transfer. Introduce a new flag
DWC3_EP_WAIT_TRANSFER_COMPLETE for this.
Signed-off-by: Thinh Nguyen <thinhn@synopsys.com>
Signed-off-by: Felipe Balbi <balbi@kernel.org>
Thinh Nguyen [Wed, 6 May 2020 02:46:51 +0000 (19:46 -0700)]
usb: dwc3: gadget: Handle XferComplete for streams
In DWC3, to prepare TRBs for streams, all the TRBs of a transfer will
use the same stream ID. To start a new stream, the driver needs to wait
for the current transfer to complete or ended (by END_TRANFER command).
As a result, inform the controller of the last TRB of a transfer so that
it knows when a transfer completes and start a new transfer of a new
stream.
Even though the transfer completion handling can be applied for other
non-isoc endpoints, only do it for streams due to its requirement.
It's better to keep the controller's TRB cache full than waiting for
transfer completion and starting a new transfer.
Signed-off-by: Thinh Nguyen <thinhn@synopsys.com>
Signed-off-by: Felipe Balbi <balbi@kernel.org>
Thinh Nguyen [Wed, 6 May 2020 02:46:45 +0000 (19:46 -0700)]
usb: dwc3: gadget: Enable XferComplete event
To switch from one stream to another, this requires the driver to start
a new transfer with a specific stream ID. For a transfer to complete,
the driver needs to indicate the last TRB of a transfer, and it needs to
enable XferComplete event to handle completed TRBs of a transfer. Let's
enable this event only for stream capable endpoints.
Signed-off-by: Thinh Nguyen <thinhn@synopsys.com>
Signed-off-by: Felipe Balbi <balbi@kernel.org>
Thinh Nguyen [Wed, 6 May 2020 02:46:39 +0000 (19:46 -0700)]
usb: dwc3: gadget: Refactor TRB completion handler
To prepare for handling of XferComplete event, let's refactor and split
up dwc3_gadget_endpoint_transfer_in_progress() to handle TRBs completion
for different events. The handling of TRBs completion will be the same,
but the status of XferComplete event is different than XferInProgress.
No functional change in this commit.
Signed-off-by: Thinh Nguyen <thinhn@synopsys.com>
Signed-off-by: Felipe Balbi <balbi@kernel.org>
Thinh Nguyen [Wed, 6 May 2020 02:46:33 +0000 (19:46 -0700)]
usb: dwc3: gadget: Check for in-progress END_TRANSFER
While handling TRBs completion, if a END_TRANSFER command isn't
completed, don't kick new transfer or issue END_TRANSFER command.
Signed-off-by: Thinh Nguyen <thinhn@synopsys.com>
Signed-off-by: Felipe Balbi <balbi@kernel.org>
Thinh Nguyen [Wed, 6 May 2020 02:46:19 +0000 (19:46 -0700)]
usb: gadget: f_tcm: Inform last stream request
Set the request->is_last to each stream request to indicate that the
request is the last stream request of a transfer. The DWC3 controller
needs to know this info to properly switch streams. The current
implementation of f_tcm uses a single request per transfer, so every
stream request is the last of its stream.
Signed-off-by: Thinh Nguyen <thinhn@synopsys.com>
Signed-off-by: Felipe Balbi <balbi@kernel.org>
Thinh Nguyen [Wed, 6 May 2020 02:46:13 +0000 (19:46 -0700)]
usb: gadget: Introduce usb_request->is_last
To take advantage of DWC3 internal TRB prefetch and cache for
performance, inform the controller the last request with stream_id
before switching to a different stream transfer. This allows the
controller to maintain its transfer burst within the stream ID.
Introduce the usb-request is_last field to help inform the DWC3
controller of this.
Signed-off-by: Thinh Nguyen <thinhn@synopsys.com>
Signed-off-by: Felipe Balbi <balbi@kernel.org>
Thinh Nguyen [Sun, 12 Apr 2020 02:20:07 +0000 (19:20 -0700)]
usb: dwc3: Get MDWIDTH for DWC_usb32
DWC_usb32 supports MDWIDTH value larger than 255 and up to 1023. The
field HWPARAMS6[9:8] stores the upper 2-bit values of the DWC_usb32's
MDWIDTH. Check that parameter and properly get the MDWIDTH for
DWC_usb32.
Signed-off-by: Thinh Nguyen <thinhn@synopsys.com>
Signed-off-by: Felipe Balbi <balbi@kernel.org>
Thinh Nguyen [Sun, 12 Apr 2020 02:20:01 +0000 (19:20 -0700)]
usb: dwc3: Add support for DWC_usb32 IP
Synopsys introduces a new controller DWC_usb32. It supports dual-lane
and speed up to 20 Gbps, and the DWC3 driver will drive this controller.
Currently the driver uses a single field dwc->revision to ID both
DWC_usb3 and DWC_usb31 and their version number. This was sufficient for
two IPs, but this method doesn't work with additional IPs. As a result,
let's separate the dwc->revision field to 2 separate fields: ip and
revision. The ip field now stores the ID of the controller's IP while
the revision field stores the controller's version number.
This new scheme enforces DWC3 to compare the revision within the same IP
only. As a result, we must update all the revision check of the
controller to check its corresponding IP.
To help with this enforcement, we create a few macros to help with
the common version checks:
DWC3_IP_IS(IP)
DWC3_VER_IS(IP, VERSION)
DWC3_VER_IS_PRIOR(IP, VERSION)
DWC3_VER_IS_WITHIN(IP, LOWER_VERSION, UPPER_VERSION)
DWC3_VER_TYPE_IS_WITHIN(IP, VERSION,
LOWER_VERSION_TYPE,
UPPER_VERSION_TYPE)
The DWC_usb32 controller operates using the same programming model and
with very similar configurations as its previous controllers. Please
note that the various IP and revision checks in this patch match the
current checks for DWC_usb31 version 1.90a. Additional configurations
that are unique to DWC_usb32 are applied separately.
Signed-off-by: Thinh Nguyen <thinhn@synopsys.com>
Signed-off-by: Felipe Balbi <balbi@kernel.org>
Nagarjuna Kristam [Mon, 4 May 2020 06:34:41 +0000 (12:04 +0530)]
usb: gadget: tegra-xudc: add port_speed_quirk
OTG port on Tegra194 supports GEN1 speeds when in device mode and GEN2
speeds when in host mode. dd port_speed_quirk that configures port to
GEN1/GEN2 speds, corresponding to the mode.
Based on work by WayneChang <waynec@nvidia.com>
Signed-off-by: Nagarjuna Kristam <nkristam@nvidia.com>
Signed-off-by: Felipe Balbi <balbi@kernel.org>
Nagarjuna Kristam [Mon, 4 May 2020 06:34:40 +0000 (12:04 +0530)]
usb: gadget: tegra-xudc: Add Tegra194 support
This commit adds support for XUSB device mode controller support on
Tegra194 SoC. This is very similar to the existing Tegra186 XUDC, with lpm
support added in addition.
Signed-off-by: Nagarjuna Kristam <nkristam@nvidia.com>
Acked-by: Thierry Reding <treding@nvidia.com>
Signed-off-by: Felipe Balbi <balbi@kernel.org>
Nagarjuna Kristam [Mon, 4 May 2020 06:34:39 +0000 (12:04 +0530)]
dt-bindings: usb: tegra-xudc: Add Tegra194 XUSB controller support
Extend the Tegra XUSB controller device tree binding with Tegra194
support.
Signed-off-by: Nagarjuna Kristam <nkristam@nvidia.com>
Acked-by: Thierry Reding <treding@nvidia.com>
Acked-by: Rob Herring <robh@kernel.org>
Signed-off-by: Felipe Balbi <balbi@kernel.org>
Jules Irenge [Wed, 29 Apr 2020 10:05:27 +0000 (11:05 +0100)]
USB: dummy-hcd: Add missing annotation for set_link_state()
Sparse reports a warning at set_link_state()
warning: context imbalance in set_link_state() - unexpected unlock
The root cause is the missing annotation at set_link_state()
Add the missing __must_hold(&dum->lock)
Signed-off-by: Jules Irenge <jbi.octave@gmail.com>
Signed-off-by: Felipe Balbi <balbi@kernel.org>
Jules Irenge [Wed, 29 Apr 2020 10:05:23 +0000 (11:05 +0100)]
usb: gadget: Add missing annotation for xudc_handle_setup()
Sparse reports a warning at xudc_handle_setup()
warning: context imbalance in xudc_handle_setup() - unexpected unlock
The root cause is the missing annotation at xudc_handle_setup()
Add the missing __must_hold(&udc->lock) annotation
Signed-off-by: Jules Irenge <jbi.octave@gmail.com>
Signed-off-by: Felipe Balbi <balbi@kernel.org>
Wei Yongjun [Tue, 28 Apr 2020 13:39:34 +0000 (13:39 +0000)]
usb: gadget: mass_storage: use module_usb_composite_driver to simplify the code
module_usb_composite_driver() makes the code simpler by
eliminating boilerplate code.
Signed-off-by: Wei Yongjun <weiyongjun1@huawei.com>
Signed-off-by: Felipe Balbi <balbi@kernel.org>
Jason Yan [Tue, 28 Apr 2020 06:33:46 +0000 (14:33 +0800)]
usb: gadget: omap_udc: remove unneeded semicolon
Fix the following coccicheck warning:
drivers/usb/gadget/udc/omap_udc.c:2579:2-3: Unneeded semicolon
Signed-off-by: Jason Yan <yanaijie@huawei.com>
Signed-off-by: Felipe Balbi <balbi@kernel.org>
Jason Yan [Sun, 26 Apr 2020 09:42:19 +0000 (17:42 +0800)]
usb: gadget: udc: remove comparison to bool in mv_u3d_core.c
Fix the following coccicheck warning:
drivers/usb/gadget/udc/mv_u3d_core.c:1551:5-13: WARNING: Comparison to
bool
Signed-off-by: Jason Yan <yanaijie@huawei.com>
Signed-off-by: Felipe Balbi <balbi@kernel.org>
Jason Yan [Sun, 26 Apr 2020 09:42:10 +0000 (17:42 +0800)]
usb: gadget: net2272: use false for 'use_dma'
Fix the following coccicheck warning:
drivers/usb/gadget/udc/net2272.c:57:12-19: WARNING: Assignment of 0/1 to
bool variable
Signed-off-by: Jason Yan <yanaijie@huawei.com>
Signed-off-by: Felipe Balbi <balbi@kernel.org>
Jason Yan [Sun, 26 Apr 2020 09:41:56 +0000 (17:41 +0800)]
usb: dwc3: use true,false for dwc->otg_restart_host
Fix the following coccicheck warning:
drivers/usb/dwc3/drd.c:85:3-24: WARNING: Assignment of 0/1 to bool
variable
drivers/usb/dwc3/drd.c:59:2-23: WARNING: Assignment of 0/1 to bool
variable
Signed-off-by: Jason Yan <yanaijie@huawei.com>
Signed-off-by: Felipe Balbi <balbi@kernel.org>
Colin Ian King [Fri, 24 Apr 2020 11:35:06 +0000 (12:35 +0100)]
usb: gadget: function: remove redundant assignment to variable 'status'
The variable status is being assigned a value that is never read
and it is being updated later with a new value. The assignment
is redundant and can be removed.
Addresses-Coverity: ("Unused value")
Signed-off-by: Colin Ian King <colin.king@canonical.com>
Signed-off-by: Felipe Balbi <balbi@kernel.org>
Nathan Chancellor [Thu, 23 Apr 2020 16:29:24 +0000 (09:29 -0700)]
USB: gadget: udc: s3c2410_udc: Remove pointless NULL check in s3c2410_udc_nuke
Clang warns:
drivers/usb/gadget/udc/s3c2410_udc.c:255:11: warning: comparison of
address of 'ep->queue' equal to a null pointer is always false
[-Wtautological-pointer-compare]
if (&ep->queue == NULL)
~~~~^~~~~ ~~~~
1 warning generated.
It is not wrong, queue is not a pointer so if ep is not NULL, the
address of queue cannot be NULL. No other driver does a check like this
and this check has been around since the driver was first introduced,
presumably with no issues so it does not seem like this check should be
something else. Just remove it.
Commit
afe956c577b2d ("kbuild: Enable -Wtautological-compare") exposed
this but it is not the root cause of the warning.
Fixes:
3fc154b6b8134 ("USB Gadget driver for Samsung s3c2410 ARM SoC")
Link: https://github.com/ClangBuiltLinux/linux/issues/1004
Reviewed-by: Nick Desaulniers <ndesaulniers@google.com>
Reported-by: kbuild test robot <lkp@intel.com>
Signed-off-by: Nathan Chancellor <natechancellor@gmail.com>
Signed-off-by: Felipe Balbi <balbi@kernel.org>
Fabrice Gasnier [Thu, 23 Apr 2020 11:55:56 +0000 (13:55 +0200)]
usb: gadget: f_acm: add suspend resume callbacks
Add suspend resume callbacks to notify u_serial of the bus suspend/resume
state.
Signed-off-by: Fabrice Gasnier <fabrice.gasnier@st.com>
Signed-off-by: Felipe Balbi <balbi@kernel.org>
Fabrice Gasnier [Thu, 23 Apr 2020 11:55:55 +0000 (13:55 +0200)]
usb: gadget: f_serial: add suspend resume callbacks
Add suspend resume callbacks to notify u_serial of the bus suspend/resume
state.
Signed-off-by: Fabrice Gasnier <fabrice.gasnier@st.com>
Signed-off-by: Felipe Balbi <balbi@kernel.org>
Fabrice Gasnier [Thu, 23 Apr 2020 11:55:54 +0000 (13:55 +0200)]
usb: gadget: u_serial: add suspend resume callbacks
Add suspend resume callbacks to handle the case seen when the bus is
suspended by the HOST, and the device opens the port (cat /dev/ttyGS0).
Gadget controller (like DWC2) doesn't accept usb requests to be queued in
this case (when in L2 state), from the gs_open() call. Error log is printed
- configfs-gadget gadget: acm ttyGS0 can't notify serial state, -11
If the HOST resumes (opens) the bus, the port still isn't functional.
Use suspend/resume callbacks to monitor the gadget suspended state by using
'suspended' flag. In case the port gets opened (cat /dev/ttyGS0), the I/O
stream will be delayed until the bus gets resumed by the HOST.
Signed-off-by: Fabrice Gasnier <fabrice.gasnier@st.com>
Signed-off-by: Felipe Balbi <balbi@kernel.org>
Fabrice Gasnier [Thu, 23 Apr 2020 11:55:53 +0000 (13:55 +0200)]
usb: dwc2: gadget: move gadget resume after the core is in L0 state
When the remote wakeup interrupt is triggered, lx_state is resumed from L2
to L0 state. But when the gadget resume is called, lx_state is still L2.
This prevents the resume callback to queue any request. Any attempt
to queue a request from resume callback will result in:
- "submit request only in active state" debug message to be issued
- dwc2_hsotg_ep_queue() returns -EAGAIN
Call the gadget resume routine after the core is in L0 state.
Fixes:
f81f46e1f530 ("usb: dwc2: implement hibernation during bus suspend/resume")
Acked-by: Minas Harutyunyan <hminas@synopsys.com>
Signed-off-by: Fabrice Gasnier <fabrice.gasnier@st.com>
Signed-off-by: Felipe Balbi <balbi@kernel.org>
Michael Grzeschik [Tue, 21 Apr 2020 13:28:14 +0000 (15:28 +0200)]
usb: gadget: uvc_video: add worker to handle the frame pumping
This patch changes the function uvc_video_pump to be a separate
scheduled worker. This way the completion handler of each usb request
and every direct caller of the pump has only to schedule the worker
instead of doing the request handling by itself.
Moving the request handling to one thread solves the locking problems
between the three queueing cases in the completion handler, v4l2_qbuf
and video_enable.
Many drivers handle the completion handlers directly in their interrupt
handlers. This patch also reduces the workload on each interrupt.
Signed-off-by: Michael Grzeschik <m.grzeschik@pengutronix.de>
Signed-off-by: Felipe Balbi <balbi@kernel.org>
Nishad Kamdar [Sun, 19 Apr 2020 12:57:10 +0000 (18:27 +0530)]
usb: renesas_usbhs: Use the correct style for SPDX License Identifier
This patch corrects the SPDX License Identifier style in
header files related to Renesas USBHS Controller Drivers.
For C header files Documentation/process/license-rules.rst
mandates C-like comments (opposed to C source files where
C++ style should be used).
Changes made by using a script provided by Joe Perches here:
https://lkml.org/lkml/2019/2/7/46.
Reviewed-by: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>
Suggested-by: Joe Perches <joe@perches.com>
Signed-off-by: Nishad Kamdar <nishadkamdar@gmail.com>
Signed-off-by: Felipe Balbi <balbi@kernel.org>
Jason Yan [Sat, 18 Apr 2020 08:18:07 +0000 (16:18 +0800)]
usb: gadget: f_fs: remove unneeded semicolon in __ffs_data_got_descs()
Fix the following coccicheck warning:
drivers/usb/gadget/function/f_fs.c:2507:2-3: Unneeded semicolon
Reported-by: Hulk Robot <hulkci@huawei.com>
Signed-off-by: Jason Yan <yanaijie@huawei.com>
Signed-off-by: Felipe Balbi <balbi@kernel.org>
Martin Blumenstingl [Thu, 16 Apr 2020 12:19:10 +0000 (14:19 +0200)]
dt-bindings: usb: dwc3: remove old DWC3 wrapper
There is now an updated bindings for these SoCs making the old
compatible obsolete.
Acked-by: Rob Herring <robh@kernel.org>
Signed-off-by: Martin Blumenstingl <martin.blumenstingl@googlemail.com>
Signed-off-by: Neil Armstrong <narmstrong@baylibre.com>
Signed-off-by: Felipe Balbi <balbi@kernel.org>
Neil Armstrong [Thu, 16 Apr 2020 12:19:09 +0000 (14:19 +0200)]
doc: dt: bindings: usb: dwc3: remove amlogic compatible entries
Acked-by: Rob Herring <robh@kernel.org>
Signed-off-by: Neil Armstrong <narmstrong@baylibre.com>
Signed-off-by: Felipe Balbi <balbi@kernel.org>
Martin Blumenstingl [Thu, 16 Apr 2020 12:19:08 +0000 (14:19 +0200)]
usb: dwc3: of-simple: remove Amlogic GXL and AXG compatibles
There is now a dedicated driver for these SoCs making the old compatible
obsolete.
Signed-off-by: Martin Blumenstingl <martin.blumenstingl@googlemail.com>
Signed-off-by: Neil Armstrong <narmstrong@baylibre.com>
Signed-off-by: Felipe Balbi <balbi@kernel.org>
Martin Blumenstingl [Thu, 16 Apr 2020 12:19:07 +0000 (14:19 +0200)]
phy: amlogic: meson-gxl-usb3: remove code for non-existing PHY
The registers which are managed by the meson-gxl-usb3 PHY driver are
actually "USB control" registers (which are "glue" registers which
manage OTG detection and routing of the OTG capable port between the
DWC2 peripheral-only controller and the DWC3 host-only controller).
Drop the meson-gxl-usb3 PHY driver now that the dwc3-meson-g12a-usb
driver supports the USB control registers on GXL and GXM SoCs (these
were previously managed by the meson-gxl-usb3 PHY driver).
Signed-off-by: Martin Blumenstingl <martin.blumenstingl@googlemail.com>
Signed-off-by: Neil Armstrong <narmstrong@baylibre.com>
Signed-off-by: Felipe Balbi <balbi@kernel.org>
Martin Blumenstingl [Thu, 16 Apr 2020 12:19:06 +0000 (14:19 +0200)]
arm64: dts: amlogic: use the new USB control driver for GXL and GXM
Add the correcly architectured USB Glue node and adapt all the Amlogic
GXL and GXM board to the new organization.
Signed-off-by: Martin Blumenstingl <martin.blumenstingl@googlemail.com>
Signed-off-by: Neil Armstrong <narmstrong@baylibre.com>
Signed-off-by: Felipe Balbi <balbi@kernel.org>
Neil Armstrong [Thu, 16 Apr 2020 12:19:05 +0000 (14:19 +0200)]
usb: dwc3: meson-g12a: add support for GXL and GXM SoCs
In order to add support for the Amlogic GXL/GXM USB Glue, this adds
the corresponding :
- PHY names
- clock names
- USB2 PHY init and mode set
- regmap setup
Reviewed-by: Martin Blumenstingl <martin.blumenstingl@googlemail.com>
Signed-off-by: Neil Armstrong <narmstrong@baylibre.com>
Signed-off-by: Felipe Balbi <balbi@kernel.org>
Neil Armstrong [Thu, 16 Apr 2020 12:19:04 +0000 (14:19 +0200)]
usb: dwc3: meson-g12a: support the GXL/GXM DWC3 host phy disconnect
On the Amlogic GXL/GXM SoCs, the OTG PHY status signals are always
connected to the DWC3 controller, thus crashing the controller when
switching to OTG mode when port is not populated with a device/cable to
Host.
Amlogic added a bit to disconnect the OTG PHY status signals from the DWC3
to be used when switching the OTG PHY as Device to the DWC2 controller.
The drawback is that it makes the DWC3 port state machine stall and needs
a full reset of the DWC3 controller to get connect status to the port
connected to the OTG PHY, but not the other one.
Reviewed-by: Martin Blumenstingl <martin.blumenstingl@googlemail.com>
Signed-off-by: Neil Armstrong <narmstrong@baylibre.com>
Signed-off-by: Felipe Balbi <balbi@kernel.org>
Neil Armstrong [Thu, 16 Apr 2020 12:19:03 +0000 (14:19 +0200)]
usb: dwc3: meson-g12a: refactor usb init
Refactor the USB init code patch to handle the Amlogic GXL/GXM needing
to initialize the OTG port as Peripheral mode for the DWC2 IP to probe
correctly.
A secondary, post_init callback is added to setup the OTG PHY mode after
powering up the PHYs and before probing the DWC2 and DWC3 controllers.
Reviewed-by: Martin Blumenstingl <martin.blumenstingl@googlemail.com>
Signed-off-by: Neil Armstrong <narmstrong@baylibre.com>
Signed-off-by: Felipe Balbi <balbi@kernel.org>
Jason Yan [Fri, 17 Apr 2020 07:31:37 +0000 (15:31 +0800)]
usb: gadget: udc: remove unused 'driver_desc'
Fix the following gcc warning:
drivers/usb/gadget/udc/gr_udc.c:51:19: warning: ‘driver_desc’ defined
but not used [-Wunused-const-variable=]
static const char driver_desc[] = DRIVER_DESC;
^~~~~~~~~~~
Reported-by: Hulk Robot <hulkci@huawei.com>
Signed-off-by: Jason Yan <yanaijie@huawei.com>
Signed-off-by: Felipe Balbi <balbi@kernel.org>
Christophe JAILLET [Sat, 11 Apr 2020 06:56:21 +0000 (08:56 +0200)]
usb: gadget: max3420: Add a missing '\n' in a log message
Message logged by 'dev_xxx()' or 'pr_xxx()' should end with a '\n'.
Fixes:
48ba02b2e2b1 ("usb: gadget: add udc driver for max3420")
Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
Signed-off-by: Felipe Balbi <balbi@kernel.org>
Nishad Kamdar [Sat, 4 Apr 2020 10:37:31 +0000 (16:07 +0530)]
USB: mtu3: Use the correct style for SPDX License Identifier
This patch corrects the SPDX License Identifier style in
header files related to MediaTek USB3 Dual Role controller.
For C header files Documentation/process/license-rules.rst
mandates C-like comments (opposed to C source files where
C++ style should be used).
Changes made by using a script provided by Joe Perches here:
https://lkml.org/lkml/2019/2/7/46.
Reviewed-by: Chunfeng Yun <chunfeng.yun@mediatek.com>
Suggested-by: Joe Perches <joe@perches.com>
Signed-off-by: Nishad Kamdar <nishadkamdar@gmail.com>
Signed-off-by: Felipe Balbi <balbi@kernel.org>
Peter Chen [Tue, 31 Mar 2020 08:10:05 +0000 (16:10 +0800)]
usb: cdns3: change dev_info to dev_dbg for debug message
During device mode initialization, lots of device information
are printed to console, see below. Change them as debug message.
cdns-usb3
5b130000.cdns3: Initialized ep0 support:
cdns-usb3
5b130000.cdns3: Initialized ep1out support: BULK, INT ISO
cdns-usb3
5b130000.cdns3: Initialized ep2out support: BULK, INT ISO
cdns-usb3
5b130000.cdns3: Initialized ep3out support: BULK, INT ISO
cdns-usb3
5b130000.cdns3: Initialized ep4out support: BULK, INT ISO
cdns-usb3
5b130000.cdns3: Initialized ep5out support: BULK, INT ISO
cdns-usb3
5b130000.cdns3: Initialized ep6out support: BULK, INT ISO
cdns-usb3
5b130000.cdns3: Initialized ep7out support: BULK, INT ISO
cdns-usb3
5b130000.cdns3: Initialized ep1in support: BULK, INT ISO
cdns-usb3
5b130000.cdns3: Initialized ep2in support: BULK, INT ISO
cdns-usb3
5b130000.cdns3: Initialized ep3in support: BULK, INT ISO
cdns-usb3
5b130000.cdns3: Initialized ep4in support: BULK, INT ISO
cdns-usb3
5b130000.cdns3: Initialized ep5in support: BULK, INT ISO
cdns-usb3
5b130000.cdns3: Initialized ep6in support: BULK, INT ISO
cdns-usb3
5b130000.cdns3: Initialized ep7in support: BULK, INT ISO
Reviewed-by: Roger Quadros <rogerq@ti.com>
Signed-off-by: Peter Chen <peter.chen@nxp.com>
Signed-off-by: Felipe Balbi <balbi@kernel.org>
Peter Chen [Tue, 31 Mar 2020 08:10:04 +0000 (16:10 +0800)]
usb: cdns3: change "cdsn3" to"cdns3"
And delete cdsn3_hw_role_state_machine declare which doesn't
be needed.
Reviewed-by: Roger Quadros <rogerq@ti.com>
Signed-off-by: Peter Chen <peter.chen@nxp.com>
Signed-off-by: Felipe Balbi <balbi@kernel.org>
Peter Chen [Tue, 31 Mar 2020 08:10:03 +0000 (16:10 +0800)]
usb: cdns3: delete role_override
In short, we have three kinds of role switches:
- Based on SoC: ID and VBUS
- Based on external connnctor, eg, Type-C or GPIO Connector
- Based on user choices through sysfs
Since HW handling and usb-role-switch handling are at
different places, we do not need role_override any more,
and this flag could not judge external connector case well.
With role_override deleted, We use cdns3_hw_role_switch for
the 1st use case, and usb-role-switch for the 2nd and 3rd cases.
Reviewed-by: Roger Quadros <rogerq@ti.com>
Signed-off-by: Peter Chen <peter.chen@nxp.com>
Signed-off-by: Felipe Balbi <balbi@kernel.org>
Peter Chen [Tue, 31 Mar 2020 08:10:02 +0000 (16:10 +0800)]
usb: cdns3: core: get role switch node from firmware
After that, the role switch device (eg, Type-C device) could call
cdns3_role_set to finish the role switch.
Reviewed-by: Roger Quadros <rogerq@ti.com>
Signed-off-by: Peter Chen <peter.chen@nxp.com>
Signed-off-by: Felipe Balbi <balbi@kernel.org>
Thinh Nguyen [Tue, 31 Mar 2020 08:40:42 +0000 (01:40 -0700)]
usb: dwc3: gadget: Continue to process pending requests
If there are still pending requests because no TRB was available,
prepare more when started requests are completed.
Introduce dwc3_gadget_ep_should_continue() to check for incomplete and
pending requests to resume updating new TRBs to the controller's TRB
cache.
Signed-off-by: Thinh Nguyen <thinhn@synopsys.com>
Signed-off-by: Felipe Balbi <balbi@kernel.org>
Nagarjuna Kristam [Thu, 14 May 2020 06:22:37 +0000 (11:52 +0530)]
usb: gadget: tegra-xudc: Add vbus_draw support
Register vbus_draw to gadget ops and update corresponding vbus
draw current to usb_phy.
Signed-off-by: Nagarjuna Kristam <nkristam@nvidia.com>
Signed-off-by: Felipe Balbi <balbi@kernel.org>
Thinh Nguyen [Sun, 29 Mar 2020 23:13:16 +0000 (16:13 -0700)]
usb: dwc3: gadget: WARN on no-resource status
If the driver issued START_TRANSFER and received a no-resource status,
then generally there are a few reasons for this:
1) The driver did not allocate resource for the endpoint during
power-on-reset initialization.
2) The transfer resource was reset. At this moment, we don't do this in
the driver, but it occurs when the driver issues START_CONFIG cmd to ep0
with resource index=2.
3) The driver issues the START_TRANSFER command to an already started
endpoint. Usually, this is because the END_TRANSFER command hasn't
completed yet.
Print out a warning to help debug this issue in the driver.
Signed-off-by: Thinh Nguyen <thinhn@synopsys.com>
Signed-off-by: Felipe Balbi <balbi@kernel.org>
Thinh Nguyen [Sun, 29 Mar 2020 23:13:10 +0000 (16:13 -0700)]
usb: dwc3: gadget: Issue END_TRANSFER to retry isoc transfer
After a number of unsuccessful start isoc attempts due to bus-expiry
status, issue END_TRANSFER command and retry on the next XferNotReady
event.
Signed-off-by: Thinh Nguyen <thinhn@synopsys.com>
Signed-off-by: Felipe Balbi <balbi@kernel.org>
Thinh Nguyen [Sun, 29 Mar 2020 23:13:04 +0000 (16:13 -0700)]
usb: dwc3: gadget: Store resource index of start cmd
As long as the START_TRANSFER command completes, it provides the
resource index of the endpoint. Use this when we need to issue
END_TRANSFER command to an isoc endpoint to retry with a new
XferNotReady event.
Signed-off-by: Thinh Nguyen <thinhn@synopsys.com>
Signed-off-by: Felipe Balbi <balbi@kernel.org>
Thinh Nguyen [Sun, 29 Mar 2020 23:12:57 +0000 (16:12 -0700)]
usb: dwc3: gadget: Properly handle failed kick_transfer
If dwc3 fails to issue START_TRANSFER/UPDATE_TRANSFER command, then we
should properly end an active transfer and give back all the started
requests. However if it's for an isoc endpoint, the failure maybe due to
bus-expiry status. In this case, don't give back the requests and wait
for the next retry.
Fixes:
72246da40f37 ("usb: Introduce DesignWare USB3 DRD Driver")
Signed-off-by: Thinh Nguyen <thinhn@synopsys.com>
Signed-off-by: Felipe Balbi <balbi@kernel.org>
Thinh Nguyen [Mon, 30 Mar 2020 00:10:05 +0000 (17:10 -0700)]
usb: dwc3: core: Use role-switch default dr_mode
If the driver is configured to use DRD role-switch, let the drd code
path decide the default dr_mode.
Signed-off-by: Thinh Nguyen <thinhn@synopsys.com>
Signed-off-by: Felipe Balbi <balbi@kernel.org>
Thinh Nguyen [Mon, 30 Mar 2020 00:09:59 +0000 (17:09 -0700)]
usb: dwc3: drd: Don't free non-existing irq
If the driver is configured to use DRD role-switch, it's not OTG. There
won't be OTG irq to free. Check for dwc->otg_irq before freeing it.
Signed-off-by: Thinh Nguyen <thinhn@synopsys.com>
Signed-off-by: Felipe Balbi <balbi@kernel.org>
Neil Armstrong [Thu, 26 Mar 2020 13:44:58 +0000 (14:44 +0100)]
usb: dwc3: meson-g12a: refactor usb2 phy init
Refactor the USB2 PHY init code patch to handle the Amlogic GXL/GXM
not having the PHY mode control registers in the Glue but in the PHY
registers.
The Amlogic GXL/GXM will call phy_set_mode() instead of programming the
PHY mode control registers, thus add two new callbacks to the SoC match
data.
Reviewed-by: Martin Blumenstingl <martin.blumenstingl@googlemail.com>
Signed-off-by: Neil Armstrong <narmstrong@baylibre.com>
Signed-off-by: Felipe Balbi <balbi@kernel.org>
Neil Armstrong [Thu, 26 Mar 2020 13:44:57 +0000 (14:44 +0100)]
usb: dwc3: meson-g12a: check return of dwc3_meson_g12a_usb_init
The dwc3_meson_g12a_usb_init function can return an error, check it.
Fixes:
c99993376f72ca ("usb: dwc3: Add Amlogic G12A DWC3 glue")
Reviewed-by: Martin Blumenstingl <martin.blumenstingl@googlemail.com>
Signed-off-by: Neil Armstrong <narmstrong@baylibre.com>
Signed-off-by: Felipe Balbi <balbi@kernel.org>
Neil Armstrong [Thu, 26 Mar 2020 13:44:56 +0000 (14:44 +0100)]
usb: dwc3: meson-g12a: get the reset as shared
In order to support the Amlogic GXL/GXM SoCs, the reset line must
be handled as shared since also used by the PHYs.
Reviewed-by: Martin Blumenstingl <martin.blumenstingl@googlemail.com>
Signed-off-by: Neil Armstrong <narmstrong@baylibre.com>
Signed-off-by: Felipe Balbi <balbi@kernel.org>
Neil Armstrong [Thu, 26 Mar 2020 13:44:55 +0000 (14:44 +0100)]
usb: dwc3: meson-g12a: handle the phy and glue registers separately
On the Amlogic GXL/GXM SoCs, only the USB control registers are available,
the PHY mode being handled in the PHY registers.
Thus, handle the PHY mode registers in separate regmaps and prepare
support for Amlogic GXL/GXM SoCs by moving the regmap setup in a callback
set in the SoC match data.
Reviewed-by: Martin Blumenstingl <martin.blumenstingl@googlemail.com>
Signed-off-by: Neil Armstrong <narmstrong@baylibre.com>
Signed-off-by: Felipe Balbi <balbi@kernel.org>
Neil Armstrong [Thu, 26 Mar 2020 13:44:54 +0000 (14:44 +0100)]
usb: dwc3: meson-g12a: specify phy names in soc data
To handle the variable USB2 PHY counts on GXL and GXM SoCs, add the
possible PHY names for each SoC in the compatible match data.
Reviewed-by: Martin Blumenstingl <martin.blumenstingl@googlemail.com>
Acked-by: Hanjie Lin <hanjie.lin@amlogic.com>
Signed-off-by: Neil Armstrong <narmstrong@baylibre.com>
Signed-off-by: Felipe Balbi <balbi@kernel.org>
Neil Armstrong [Thu, 26 Mar 2020 13:44:53 +0000 (14:44 +0100)]
dt-bindings: usb: amlogic,meson-g12a-usb-ctrl: add the Amlogic GXL and GXM Families USB Glue Bindings
The Amlogic GXL and GXM is slightly different from the Amlogic G12A Glue.
The GXL SoCs only embeds 2 USB2 PHYs and no USB3 PHYs, and the GXM SoCs
embeds 3 USB2 PHYs.
Reviewed-by: Martin Blumenstingl <martin.blumenstingl@googlemail.com>
Signed-off-by: Neil Armstrong <narmstrong@baylibre.com>
Signed-off-by: Felipe Balbi <balbi@kernel.org>
Sandeep Maheswaram [Thu, 26 Mar 2020 07:06:08 +0000 (12:36 +0530)]
dt-bindings: usb: qcom,dwc3: Add compatible for SC7180
Add compatible for SC7180 in usb dwc3 bindings.
Signed-off-by: Sandeep Maheswaram <sanm@codeaurora.org>
Reviewed-by: Douglas Anderson <dianders@chromium.org>
Acked-by: Rob Herring <robh@kernel.org>
Reviewed-by: Stephen Boyd <swboyd@chromium.org>
Signed-off-by: Felipe Balbi <balbi@kernel.org>
Sandeep Maheswaram [Thu, 26 Mar 2020 07:06:07 +0000 (12:36 +0530)]
dt-bindings: usb: qcom,dwc3: Convert USB DWC3 bindings
Convert USB DWC3 bindings to DT schema format using json-schema.
Signed-off-by: Sandeep Maheswaram <sanm@codeaurora.org>
Signed-off-by: Felipe Balbi <balbi@kernel.org>
Thinh Nguyen [Thu, 5 Mar 2020 21:24:20 +0000 (13:24 -0800)]
usb: dwc3: gadget: Refactor dwc3_gadget_ep_dequeue
The flow from function dwc3_gadget_ep_dequeue() is not easy to follow.
Refactor it for easier read. No functional change in this commit.
Signed-off-by: Thinh Nguyen <thinhn@synopsys.com>
Signed-off-by: Felipe Balbi <balbi@kernel.org>
Thinh Nguyen [Thu, 5 Mar 2020 21:24:14 +0000 (13:24 -0800)]
usb: dwc3: gadget: Remove unnecessary checks
Remove 2 unnecessary checks:
1) A request in the started_list must have its trb field set. So
checking for req->trb is unnecessary.
2) An endpoint must have started (and have not ended) for the request to
still be in the started_list. There's no point to check if the endpoint
is started. We had this check because previously the driver didn't
handle the endpoint's started/ended flags for END_TRANSFER command
properly. See commit
9f45581f5eec ("usb: dwc3: gadget: early giveback
if End Transfer already completed").
Signed-off-by: Thinh Nguyen <thinhn@synopsys.com>
Signed-off-by: Felipe Balbi <balbi@kernel.org>
Thinh Nguyen [Thu, 5 Mar 2020 21:24:08 +0000 (13:24 -0800)]
usb: dwc3: gadget: Give back staled requests
If a request is dequeued, the transfer is cancelled. Give back all
the started requests.
In most scenarios, the function driver dequeues all requests of a
transfer when there's a failure. If the function driver follows this,
then it's fine. If not, then we'd be skipping TRBs at different points
within the dequeue and enqueue pointers, making dequeue/enqueue pointers
useless. To enforce and make sure that we're properly skipping TRBs,
cancel all the started requests and give back all the cancelled requests
to the function drivers.
Signed-off-by: Thinh Nguyen <thinhn@synopsys.com>
Signed-off-by: Felipe Balbi <balbi@kernel.org>
Thinh Nguyen [Thu, 5 Mar 2020 21:23:55 +0000 (13:23 -0800)]
usb: dwc3: gadget: Properly handle ClearFeature(halt)
DWC3 must not issue CLEAR_STALL command to control endpoints. The
controller automatically clears the STALL when it receives the SETUP
token. Also, when the driver receives ClearFeature(halt_ep), DWC3 must
stop any active transfer from the endpoint and give back all the
requests to the function drivers.
Fixes:
72246da40f37 ("usb: Introduce DesignWare USB3 DRD Driver")
Signed-off-by: Thinh Nguyen <thinhn@synopsys.com>
Signed-off-by: Felipe Balbi <balbi@kernel.org>
Tao Ren [Sun, 15 Mar 2020 19:16:32 +0000 (12:16 -0700)]
dt-bindings: usb: document aspeed vhub device ID/string properties
Update device tree binding document for aspeed vhub's device IDs and
string properties.
Signed-off-by: Tao Ren <rentao.bupt@gmail.com>
Signed-off-by: Felipe Balbi <balbi@kernel.org>
Tao Ren [Sun, 15 Mar 2020 19:16:31 +0000 (12:16 -0700)]
usb: gadget: aspeed: fixup usb1 device descriptor at init time
This patch moves patch-usb1-dev-desc logic from get-descriptor handler
to "ast_vhub_fixup_usb1_dev_desc" function so the code is executed only
once (at vhub initial time).
Signed-off-by: Tao Ren <rentao.bupt@gmail.com>
Signed-off-by: Felipe Balbi <balbi@kernel.org>
Tao Ren [Sun, 15 Mar 2020 19:16:30 +0000 (12:16 -0700)]
usb: gadget: aspeed: allow to set device IDs in device tree
The patch overrides idVendor, idProduct and bcdDevice fields in vhub
Device Descriptor if according device tree properties are defined.
Signed-off-by: Tao Ren <rentao.bupt@gmail.com>
Signed-off-by: Felipe Balbi <balbi@kernel.org>
Tao Ren [Sun, 15 Mar 2020 19:16:29 +0000 (12:16 -0700)]
usb: gadget: aspeed: allow to set usb strings in device tree
If "vhub,string-descriptor" device tree property is defined, the driver
will load string descriptors from device tree; otherwise, the default
string descriptors will be used.
Signed-off-by: Tao Ren <rentao.bupt@gmail.com>
Signed-off-by: Felipe Balbi <balbi@kernel.org>
Tao Ren [Sun, 15 Mar 2020 19:16:28 +0000 (12:16 -0700)]
usb: gadget: add "usb_validate_langid" function
The USB LANGID validation code in "check_user_usb_string" function is
moved to "usb_validate_langid" function which can be used by other usb
gadget drivers.
Signed-off-by: Tao Ren <rentao.bupt@gmail.com>
Signed-off-by: Felipe Balbi <balbi@kernel.org>
Tao Ren [Sun, 15 Mar 2020 19:16:27 +0000 (12:16 -0700)]
usb: gadget: aspeed: support multiple language strings
This patch introduces a link list to store string descriptors with
different languages, and "ast_vhub_rep_string" function is also improved
to support multiple language usb strings.
Signed-off-by: Tao Ren <rentao.bupt@gmail.com>
Signed-off-by: Felipe Balbi <balbi@kernel.org>
Tao Ren [Sun, 15 Mar 2020 19:14:30 +0000 (12:14 -0700)]
usb: gadget: aspeed: improve vhub port irq handling
This patch evaluates vhub ports' irq mask before going through per-port
irq handling one by one, which helps to speed up irq handling in case
there is no port interrupt.
Signed-off-by: Tao Ren <rentao.bupt@gmail.com>
Signed-off-by: Felipe Balbi <balbi@kernel.org>
Martin Kepplinger [Thu, 19 Mar 2020 10:02:07 +0000 (11:02 +0100)]
usb: dwc3: support continuous runtime PM with dual role
The DRD module calls dwc3_set_mode() on role switches, i.e. when a device is
being plugged in. In order to support continuous runtime power management when
plugging in / unplugging a cable, we need to call pm_runtime_get_sync() in
this path.
Signed-off-by: Martin Kepplinger <martin.kepplinger@puri.sm>
Signed-off-by: Felipe Balbi <balbi@kernel.org>
kbuild test robot [Fri, 27 Mar 2020 01:12:01 +0000 (09:12 +0800)]
usb: cdns3: mark local functions static
Mark all local functions static to fix sparse warnings.
Signed-off-by: kbuild test robot <lkp@intel.com>
Signed-off-by: Felipe Balbi <balbi@kernel.org>
Nishad Kamdar [Sat, 28 Mar 2020 09:48:32 +0000 (15:18 +0530)]
USB: dwc2: Use the correct style for SPDX License Identifier
This patch corrects the SPDX License Identifier style in
header files related to DesignWare USB2 DRD Core Support.
For C header files Documentation/process/license-rules.rst
mandates C-like comments (opposed to C source files where
C++ style should be used).
Changes made by using a script provided by Joe Perches here:
https://lkml.org/lkml/2019/2/7/46.
Suggested-by: Joe Perches <joe@perches.com>
Signed-off-by: Nishad Kamdar <nishadkamdar@gmail.com>
Signed-off-by: Felipe Balbi <balbi@kernel.org>
Nishad Kamdar [Sat, 28 Mar 2020 10:04:46 +0000 (15:34 +0530)]
USB: dwc3: Use the correct style for SPDX License Identifier
This patch corrects the SPDX License Identifier style in
header files related to DesignWare USB3 DRD Core Support.
For C header files Documentation/process/license-rules.rst
mandates C-like comments (opposed to C source files where
C++ style should be used).
Changes made by using a script provided by Joe Perches here:
https://lkml.org/lkml/2019/2/7/46.
Suggested-by: Joe Perches <joe@perches.com>
Signed-off-by: Nishad Kamdar <nishadkamdar@gmail.com>
Signed-off-by: Felipe Balbi <balbi@kernel.org>
Nishad Kamdar [Sat, 28 Mar 2020 11:11:15 +0000 (16:41 +0530)]
USB: gadget: Use the correct style for SPDX License Identifier
This patch corrects the SPDX License Identifier style in
header files related to USB peripheral controller drivers.
For C header files Documentation/process/license-rules.rst
mandates C-like comments (opposed to C source files where
C++ style should be used).
Changes made by using a script provided by Joe Perches here:
https://lkml.org/lkml/2019/2/7/46.
Suggested-by: Joe Perches <joe@perches.com>
Signed-off-by: Nishad Kamdar <nishadkamdar@gmail.com>
Signed-off-by: Felipe Balbi <balbi@kernel.org>
Linus Torvalds [Sun, 3 May 2020 21:56:04 +0000 (14:56 -0700)]
Linux 5.7-rc4
Linus Torvalds [Sun, 3 May 2020 18:30:08 +0000 (11:30 -0700)]
Merge tag 'for-5.7-rc3-tag' of git://git./linux/kernel/git/kdave/linux
Pull more btrfs fixes from David Sterba:
"A few more stability fixes, minor build warning fixes and git url
fixup:
- fix partial loss of prealloc extent past i_size after fsync
- fix potential deadlock due to wrong transaction handle passing via
journal_info
- fix gcc 4.8 struct intialization warning
- update git URL in MAINTAINERS entry"
* tag 'for-5.7-rc3-tag' of git://git.kernel.org/pub/scm/linux/kernel/git/kdave/linux:
MAINTAINERS: btrfs: fix git repo URL
btrfs: fix gcc-4.8 build warning for struct initializer
btrfs: transaction: Avoid deadlock due to bad initialization timing of fs_info::journal_info
btrfs: fix partial loss of prealloc extent past i_size after fsync
Linus Torvalds [Sun, 3 May 2020 18:04:57 +0000 (11:04 -0700)]
Merge tag 'iommu-fixes-v5.7-rc3' of git://git./linux/kernel/git/joro/iommu
Pull IOMMU fixes from Joerg Roedel:
- Fix a memory leak when dev_iommu gets freed and a sub-pointer does
not
- Build dependency fixes for Mediatek, spapr_tce, and Intel IOMMU
driver
- Export iommu_group_get_for_dev() only for GPLed modules
- Fix AMD IOMMU interrupt remapping when x2apic is enabled
- Fix error path in the QCOM IOMMU driver probe function
* tag 'iommu-fixes-v5.7-rc3' of git://git.kernel.org/pub/scm/linux/kernel/git/joro/iommu:
iommu/qcom: Fix local_base status check
iommu: Properly export iommu_group_get_for_dev()
iommu/vt-d: Use right Kconfig option name
iommu/amd: Fix legacy interrupt remapping for x2APIC-enabled system
iommu: spapr_tce: Disable compile testing to fix build on book3s_32 config
iommu/mediatek: Fix MTK_IOMMU dependencies
iommu: Fix the memory leak in dev_iommu_free()
Eric Biggers [Fri, 1 May 2020 23:44:17 +0000 (16:44 -0700)]
MAINTAINERS: btrfs: fix git repo URL
The git repo listed for btrfs hasn't been updated in over a year.
List the current one instead.
Signed-off-by: Eric Biggers <ebiggers@google.com>
Reviewed-by: David Sterba <dsterba@suse.com>
Signed-off-by: David Sterba <dsterba@suse.com>
Linus Torvalds [Sat, 2 May 2020 20:45:30 +0000 (13:45 -0700)]
Merge tag 'pm-5.7-rc4' of git://git./linux/kernel/git/rafael/linux-pm
Pull power management fixes from Rafael Wysocki:
- prevent the intel_pstate driver from printing excessive diagnostic
messages in some cases (Chris Wilson)
- make the hibernation restore kernel freeze kernel threads as well as
user space tasks (Dexuan Cui)
- fix the ACPI device PM disagnostic messages to include the correct
power state name (Kai-Heng Feng).
* tag 'pm-5.7-rc4' of git://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm:
PM: ACPI: Output correct message on target power state
PM: hibernate: Freeze kernel threads in software_resume()
cpufreq: intel_pstate: Only mention the BIOS disabling turbo mode once
Rafael J. Wysocki [Sat, 2 May 2020 19:39:17 +0000 (21:39 +0200)]
Merge branches 'pm-cpufreq' and 'pm-sleep'
* pm-cpufreq:
cpufreq: intel_pstate: Only mention the BIOS disabling turbo mode once
* pm-sleep:
PM: hibernate: Freeze kernel threads in software_resume()
Linus Torvalds [Sat, 2 May 2020 18:31:12 +0000 (11:31 -0700)]
Merge tag 'iomap-5.7-fixes-1' of git://git./fs/xfs/xfs-linux
Pull iomap fix from Darrick Wong:
"Hoist the check for an unrepresentable FIBMAP return value into
ioctl_fibmap.
The internal kernel function can handle 64-bit values (and is needed
to fix a regression on ext4 + jbd2). It is only the userspace ioctl
that is so old that it cannot deal"
* tag 'iomap-5.7-fixes-1' of git://git.kernel.org/pub/scm/fs/xfs/xfs-linux:
fibmap: Warn and return an error in case of block > INT_MAX