Krzysztof Kozlowski
653e11eae2
dt-bindings: usb: Correct indentation and style in DTS example
...
DTS example in the bindings should be indented with 2- or 4-spaces and
aligned with opening '- |', so correct any differences like 3-spaces or
mixtures 2- and 4-spaces in one binding.
No functional changes here, but saves some comments during reviews of
new patches built on existing code.
Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org >
Reviewed-by: Alexander Stein <alexander.stein@ew.tq-group.com >
Acked-by: Andrew Jeffery <andrew@codeconstruct.com.au > # aspeed,usb-vhub.yaml
Reviewed-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com >
Acked-by: Thierry Reding <treding@nvidia.com >
Acked-by: Francesco Dolcini <francesco.dolcini@toradex.com > # ti,tusb73x0-pci.yaml
Acked-by: Florian Fainelli <florian.fainelli@broadcom.com > # brcm,bdc.yaml
Acked-by: Benjamin Bara <benjamin.bara@skidata.com > # cypress,hx3.yaml
Reviewed-by: Geert Uytterhoeven <geert+renesas@glider.be > # renesas
Link: https://lore.kernel.org/r/20250107131015.246461-1-krzysztof.kozlowski@linaro.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org >
2025-01-11 17:02:29 +01:00
Pavan Holla
f1a2241778
usb: typec: ucsi: Implement ChromeOS UCSI driver
...
Implementation of a UCSI transport driver for ChromeOS.
This driver will be loaded if the ChromeOS EC implements a PPM.
Signed-off-by: Pavan Holla <pholla@chromium.org >
Co-developed-by: Abhishek Pandit-Subedi <abhishekpandit@chromium.org >
Signed-off-by: Abhishek Pandit-Subedi <abhishekpandit@chromium.org >
Co-developed-by: Łukasz Bartosik <ukaszb@chromium.org >
Signed-off-by: Łukasz Bartosik <ukaszb@chromium.org >
Link: https://lore.kernel.org/r/20241231131047.1757434-3-ukaszb@chromium.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org >
2025-01-03 11:14:17 +01:00
Pavan Holla
401d07d530
platform/chrome: Update ChromeOS EC header for UCSI
...
Add EC host commands for reading and writing UCSI structures
in the EC. The corresponding kernel driver is cros-ec-ucsi.
Also update PD events supported by the EC.
Acked-by: Tzung-Bi Shih <tzungbi@kernel.org >
Signed-off-by: Pavan Holla <pholla@chromium.org >
Signed-off-by: Łukasz Bartosik <ukaszb@chromium.org >
Link: https://lore.kernel.org/r/20241231131047.1757434-2-ukaszb@chromium.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org >
2025-01-03 11:14:17 +01:00
Rob Herring (Arm)
533561a8aa
usb: dwc3: omap: Use devm_regulator_get_optional()
...
The 'vbus-supply' regulator is optional, so use
devm_regulator_get_optional() instead of checking for property presence
first.
While here, rework the error handling to use dev_err_probe() which
handles deferred probe correctly without an error message.
Signed-off-by: Rob Herring (Arm) <robh@kernel.org >
Link: https://lore.kernel.org/r/20241231164456.262581-1-robh@kernel.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org >
2025-01-03 11:14:05 +01:00
Hongyu Xie
dedab67442
usb: cdns3: remove redundant if branch
...
cdns->role_sw->dev->driver_data gets set in routines showing below,
cdns_init
sw_desc.driver_data = cdns;
cdns->role_sw = usb_role_switch_register(dev, &sw_desc);
dev_set_drvdata(&sw->dev, desc->driver_data);
In cdns_resume,
cdns->role = cdns_role_get(cdns->role_sw); //line redundant
struct cdns *cdns = usb_role_switch_get_drvdata(sw);
dev_get_drvdata(&sw->dev)
return dev->driver_data
return cdns->role;
"line redundant" equals to,
cdns->role = cdns->role;
So fix this if branch.
Signed-off-by: Hongyu Xie <xiehongyu1@kylinos.cn >
Acked-by: Peter Chen <peter.chen@kernel.org >
Link: https://lore.kernel.org/r/20241231013641.23908-1-xiehongyu1@kylinos.cn
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org >
2025-01-03 11:13:52 +01:00
Krishna Kurapati
f097a36ef8
dt-bindings: usb: qcom,dwc3: Add QCS615 to USB DWC3 bindings
...
Update dt-bindings to add primary controller of QCS615 to USB
DWC3 controller list.
Although this controller has a QUSB2 Phy, it belongs to a
generation of SoCs like SDM670/SDM845/SM6350 where DP/DM is
used for wakeup instead of qusb2_phy interrupt.
Signed-off-by: Krishna Kurapati <krishna.kurapati@oss.qualcomm.com >
Reviewed-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org >
Link: https://lore.kernel.org/r/20241224084621.4139021-2-krishna.kurapati@oss.qualcomm.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org >
2024-12-27 13:09:50 +01:00
Gordon Ou
63f0abcb47
USB: usbip: Update USB/IP OP_REP_IMPORT documentation.
...
This is to correct the mistaken byte offset of the field bDeviceClass in
OP_REP_IMPORT documentation. The previous field bcdDevice has length 2 and
the offset for bDeviceClass should be 0x138 + 2 = 0x13A instead of 0x139.
Offsets for subsequent fields are also affected and fixed in this patch.
Signed-off-by: Gordon Ou <gordon.xwj@gmail.com >
Reviewed-by: Shuah Khan <skhan@linuxfoundation.org >
Link: https://lore.kernel.org/r/20241224062336.63215-1-gordon.xwj@gmail.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org >
2024-12-27 13:07:22 +01:00
Pei Xiao
da31486bf2
usb: typec: ucsi: make yoga_c630_ucsi_ops be static
...
sparse warnings:
drivers/usb/typec/ucsi/ucsi_yoga_c630.c:101:30: sparse: sparse:
symbol 'yoga_c630_ucsi_ops' was not declared. Should it be static?
Add static to fix sparse warnings.
Reported-by: kernel test robot <lkp@intel.com >
Closes: https://lore.kernel.org/oe-kbuild-all/202412102033.J4vZNaaR-lkp@intel.com/
Signed-off-by: Pei Xiao <xiaopei01@kylinos.cn >
Link: https://lore.kernel.org/r/cefe3bc20b2ddaee2a0924ba32243f035e92a025.1735289530.git.xiaopei01@kylinos.cn
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org >
2024-12-27 13:06:53 +01:00
Mathias Nyman
8a95c9e10f
xhci: Add missing capability definition bits
...
Add capability bits for the xHC Capability Parameters 2 (HCCPARAMS2)
register described in xHCI specification section 5.3.9
bit 7 Extended TBC TRB Status Capability (ETC_TSC)
bit 8 Get/Set Extended Property Capability (GSC)
bit 9 Virtualization Based Trusted I/O Capability (VTC)
Signed-off-by: Mathias Nyman <mathias.nyman@linux.intel.com >
Link: https://lore.kernel.org/r/20241227120142.1035206-6-mathias.nyman@linux.intel.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org >
2024-12-27 13:06:10 +01:00
Mathias Nyman
3ac820f9d4
xhci: Add command completion parameter support
...
xHC hosts can pass 24 bits of data with a command completion event TRB
as the completion code only uses 8 bits of the 32 bit status field.
Only Configure Endpoint, and Get Extended Property commands utilize
this "command completion parameter" 24 bit field.
For other command completion events the xHC should keep it RsvdZ.
Signed-off-by: Mathias Nyman <mathias.nyman@linux.intel.com >
Link: https://lore.kernel.org/r/20241227120142.1035206-5-mathias.nyman@linux.intel.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org >
2024-12-27 13:06:10 +01:00
Michal Pecio
1e0a19912a
usb: xhci: Fix NULL pointer dereference on certain command aborts
...
If a command is queued to the final usable TRB of a ring segment, the
enqueue pointer is advanced to the subsequent link TRB and no further.
If the command is later aborted, when the abort completion is handled
the dequeue pointer is advanced to the first TRB of the next segment.
If no further commands are queued, xhci_handle_stopped_cmd_ring() sees
the ring pointers unequal and assumes that there is a pending command,
so it calls xhci_mod_cmd_timer() which crashes if cur_cmd was NULL.
Don't attempt timer setup if cur_cmd is NULL. The subsequent doorbell
ring likely is unnecessary too, but it's harmless. Leave it alone.
This is probably Bug 219532, but no confirmation has been received.
The issue has been independently reproduced and confirmed fixed using
a USB MCU programmed to NAK the Status stage of SET_ADDRESS forever.
Everything continued working normally after several prevented crashes.
Link: https://bugzilla.kernel.org/show_bug.cgi?id=219532
Fixes: c311e391a7 ("xhci: rework command timeout and cancellation,")
CC: stable@vger.kernel.org
Signed-off-by: Michal Pecio <michal.pecio@gmail.com >
Signed-off-by: Mathias Nyman <mathias.nyman@linux.intel.com >
Link: https://lore.kernel.org/r/20241227120142.1035206-4-mathias.nyman@linux.intel.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org >
2024-12-27 13:06:10 +01:00
Mathias Nyman
d157a2bcf9
xhci: dbgtty: Improve performance by handling received data immediately.
...
Improve dbc transfer rate performance by copying the received data to
the tty buffer directly in the request complete callback function if
possible.
Only defer it in case there is already pending deferred work, tty is
throttled, or we fail copy the data to the tty buffer
The request complete callback is already called by a workqueue.
This is part 3/3 of a dbc performance improvement series that roughly
triples dbc performace when using adb push and pull over dbc.
Max/min push rate after patches is 210/118 MB/s, pull rate 171/133 MB/s,
tested with large files (300MB-9GB) by Łukasz Bartosik
Cc: Łukasz Bartosik <ukaszb@chromium.org >
Signed-off-by: Mathias Nyman <mathias.nyman@linux.intel.com >
Link: https://lore.kernel.org/r/20241227120142.1035206-3-mathias.nyman@linux.intel.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org >
2024-12-27 13:06:10 +01:00
Mathias Nyman
03e3d9c2bd
xhci: dbc: Improve performance by removing delay in transfer event polling.
...
Queue event polling work with 0 delay in case there are pending transfers
queued up. This is part 2 of a 3 part series that roughly triples dbc
performace when using adb push and pull over dbc.
Max/min push rate after patches is 210/118 MB/s, pull rate 171/133 MB/s,
tested with large files (300MB-9GB) by Łukasz Bartosik
First performance improvement patch was commit 31128e7492
("xhci: dbc: add dbgtty request to end of list once it completes")
Cc: Łukasz Bartosik <ukaszb@chromium.org >
Signed-off-by: Mathias Nyman <mathias.nyman@linux.intel.com >
Link: https://lore.kernel.org/r/20241227120142.1035206-2-mathias.nyman@linux.intel.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org >
2024-12-27 13:06:10 +01:00
Thinh Nguyen
d7123c77dc
usb: gadget: f_tcm: Refactor goto check_condition
...
Move the command initialization before the check_condition to after the
goto statement for a cleaner look. No functional change here.
Signed-off-by: Thinh Nguyen <Thinh.Nguyen@synopsys.com >
Link: https://lore.kernel.org/r/8442364f51f2788d2a191997581a8eda7a143272.1733876548.git.Thinh.Nguyen@synopsys.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org >
2024-12-24 08:56:08 +01:00
Thinh Nguyen
de92fb3fc2
usb: gadget: f_tcm: Track BOT command kref
...
Set TARGET_SCF_ACK_KREF flag and allow f_tcm to take the BOT command
reference. A usb request may be canceled, the f_tcm knows this. Let it
decides if the command should be freed. This is the same as how the UAS
interface is done.
Signed-off-by: Thinh Nguyen <Thinh.Nguyen@synopsys.com >
Link: https://lore.kernel.org/r/e791c639e91b5d91a8787f5d6902e8c58f1dc172.1733876548.git.Thinh.Nguyen@synopsys.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org >
2024-12-24 08:56:08 +01:00
Thinh Nguyen
3ce3b2108f
usb: gadget: f_tcm: Requeue command request on error
...
If there's error on command request, make sure to requeue to receive the
next one.
Signed-off-by: Thinh Nguyen <Thinh.Nguyen@synopsys.com >
Link: https://lore.kernel.org/r/d4e55c13be8f83f99ee55f7b979a99e2c14fc4c8.1733876548.git.Thinh.Nguyen@synopsys.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org >
2024-12-24 08:56:08 +01:00
Thinh Nguyen
a4d7274d07
usb: gadget: f_tcm: Stall on invalid CBW
...
If the BOT command CBW is invalid, make sure to respond by setting
status endpoint STALL until the next proper CBW or reset.
Signed-off-by: Thinh Nguyen <Thinh.Nguyen@synopsys.com >
Link: https://lore.kernel.org/r/96022e2d5225f01a20263a4ba9c2e2c8a63328b8.1733876548.git.Thinh.Nguyen@synopsys.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org >
2024-12-24 08:56:07 +01:00
Thinh Nguyen
29ed170538
usb: gadget: f_tcm: Check overlapped command
...
If there's an overlapped command tag, cancel the command and respond
with RC_OVERLAPPED_TAG to host.
Signed-off-by: Thinh Nguyen <Thinh.Nguyen@synopsys.com >
Link: https://lore.kernel.org/r/6bffc2903d0cd1e7c7afca837053a48e883d8903.1733876548.git.Thinh.Nguyen@synopsys.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org >
2024-12-24 08:56:07 +01:00
Thinh Nguyen
20e9ab60e6
usb: gadget: f_tcm: Handle TASK_MANAGEMENT commands
...
Handle target_core_fabric_ops TASK MANAGEMENT functions and their
response. If a TASK MANAGEMENT command is received, the driver will
interpret the function TMF_*, translate to TMR_*, and fire off a command
work executing target_submit_tmr(). On completion, it will handle the
TASK MANAGEMENT response through uasp_send_tm_response().
Signed-off-by: Thinh Nguyen <Thinh.Nguyen@synopsys.com >
Link: https://lore.kernel.org/r/50339586e36509dadb9c208b3314530993e673b6.1733876548.git.Thinh.Nguyen@synopsys.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org >
2024-12-24 08:56:07 +01:00
Thinh Nguyen
1d5d4e1153
usb: gadget: f_tcm: Send sense on cancelled transfer
...
If the transfer is cancelled due to a disconnect or driver tear down
(error code -ESHUTDOWN), then just free the command. However, if it got
cancelled due to other reasons, then send a sense CHECK CONDITION status
with TCM_CHECK_CONDITION_ABORT_CMD status to host notifying the delivery
failure. Note that this is separate from TASK MANAGEMENT function abort
task command, which will require a separate response IU.
See UAS-r04 section 8.
Signed-off-by: Thinh Nguyen <Thinh.Nguyen@synopsys.com >
Link: https://lore.kernel.org/r/f2ae293c1fc39df4d242a2f724584bf4ec105ece.1733876548.git.Thinh.Nguyen@synopsys.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org >
2024-12-24 08:56:07 +01:00
Thinh Nguyen
4726152153
usb: gadget: f_tcm: Save CPU ID per command
...
Normally we don't care about the CPU id, but if we ever use
TARGET_SCF_USE_CPUID, then we need to save the cpuid.
Signed-off-by: Thinh Nguyen <Thinh.Nguyen@synopsys.com >
Link: https://lore.kernel.org/r/ab45e37314405d9cdd7a8e3b761c654400bb2270.1733876548.git.Thinh.Nguyen@synopsys.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org >
2024-12-24 08:56:07 +01:00
Thinh Nguyen
2d6d0c695e
usb: gadget: f_tcm: Stop proceeding further on -ESHUTDOWN
...
If the error code is -ESHUTDOWN, stop processing the request/command
further and prepare for teardown. -ESHUTDOWN is for device reset or
disconnection.
Signed-off-by: Thinh Nguyen <Thinh.Nguyen@synopsys.com >
Link: https://lore.kernel.org/r/b14410cce6bc7b8a0b43da23a8e0cf1ed1fa8ab6.1733876548.git.Thinh.Nguyen@synopsys.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org >
2024-12-24 08:56:07 +01:00
Thinh Nguyen
89e4ec503d
usb: gadget: f_tcm: Cleanup requests on ep disable
...
There may be different reasons for the transfer to be cancelled. Don't
blindly free the command without checking its status. We may still need
to properly respond to cancelled command. Check and only free the
command on endpoint disable.
Signed-off-by: Thinh Nguyen <Thinh.Nguyen@synopsys.com >
Link: https://lore.kernel.org/r/6c4ae2b4c2a9037bdcb6f909e173a94b11f04657.1733876548.git.Thinh.Nguyen@synopsys.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org >
2024-12-24 08:56:07 +01:00
Thinh Nguyen
76003eb6d0
usb: gadget: f_tcm: Handle abort command
...
Implement usbg_aborted_task() to cancel aborted outstanding requests.
Signed-off-by: Thinh Nguyen <Thinh.Nguyen@synopsys.com >
Link: https://lore.kernel.org/r/6d2a05f120a0384e36b5150b50eec53a0991f400.1733876548.git.Thinh.Nguyen@synopsys.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org >
2024-12-24 08:56:07 +01:00
Thinh Nguyen
360715d567
usb: gadget: f_tcm: Minor cleanup redundant code
...
The status request preparation is done in uasp_prepare_status(). Remove
duplicate code. No functional change here.
Signed-off-by: Thinh Nguyen <Thinh.Nguyen@synopsys.com >
Link: https://lore.kernel.org/r/2b2200a9022296f520e26f61ed6aaa6eb34d466f.1733876548.git.Thinh.Nguyen@synopsys.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org >
2024-12-24 08:56:07 +01:00
Thinh Nguyen
70fda9e6da
usb: gadget: f_tcm: Execute command on write completion
...
Don't just wait for the data write completion and execute the target
command. We need to verify if the request completed successfully and not
just sending invalid data. The verification is done in the write request
completion routine. Queue the same work of the command to execute the
target_execute_cmd() on data write.
Signed-off-by: Thinh Nguyen <Thinh.Nguyen@synopsys.com >
Link: https://lore.kernel.org/r/9f6b1c6946cf49eeba0173e405678b9b7786636b.1733876548.git.Thinh.Nguyen@synopsys.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org >
2024-12-24 08:56:07 +01:00
Thinh Nguyen
5cf091d59e
usb: gadget: f_tcm: Return ATA cmd direction
...
Check ATA Pass-Through for direction.
Signed-off-by: Thinh Nguyen <Thinh.Nguyen@synopsys.com >
Link: https://lore.kernel.org/r/c22215f7925581684a13eae9a14afb47fb60c061.1733876548.git.Thinh.Nguyen@synopsys.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org >
2024-12-24 08:56:07 +01:00
Thinh Nguyen
9e0f5819ba
usb: gadget: f_tcm: Use extra number of commands
...
To properly respond to host sending more commands than the number of
streams the device advertises, the device needs to be able to reject the
command with a response. Allocate an extra request to handle 1 more
command than the number of streams.
Signed-off-by: Thinh Nguyen <Thinh.Nguyen@synopsys.com >
Link: https://lore.kernel.org/r/256f2ec8f5e042ab692d9593144fa75f3d3ce94b.1733876548.git.Thinh.Nguyen@synopsys.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org >
2024-12-24 08:56:07 +01:00
Thinh Nguyen
0d2d759c9a
usb: gadget: f_tcm: Handle multiple commands in parallel
...
Resubmit command on completion to fetch more commands and service them
in parallel. Increase the number of work in a queue. Each work will be
for each command allowing them to be processed concurrently. Also, set
them to be unbounded by cpu to improve performance.
Signed-off-by: Thinh Nguyen <Thinh.Nguyen@synopsys.com >
Link: https://lore.kernel.org/r/933cf7191b672bf4cfbea4df19af1b08dc1baca9.1733876548.git.Thinh.Nguyen@synopsys.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org >
2024-12-24 08:56:06 +01:00
Thinh Nguyen
a570559a4f
usb: gadget: f_tcm: Allocate matching number of commands to streams
...
We can handle multiple commands concurently. Each command services a
stream id. At the moment, the driver will handle 32 outstanding streams,
which is equivalent to 32 commands. Make sure to allocate a matching
number of commands to the number of streams.
Signed-off-by: Thinh Nguyen <Thinh.Nguyen@synopsys.com >
Link: https://lore.kernel.org/r/2d806120dcc10c88fef21865b7bc1d2b6604fe42.1733876548.git.Thinh.Nguyen@synopsys.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org >
2024-12-24 08:56:06 +01:00
Thinh Nguyen
34579e98a4
usb: gadget: f_tcm: Don't set static stream_id
...
Host can assign stream ID value greater than number of streams
allocated. The tcm function needs to keep track of which stream is
available to assign the stream ID. This patch doesn't track that, but at
least it makes sure that there's no Oops if the host send tag with a
value greater than the number of supported streams.
Signed-off-by: Thinh Nguyen <Thinh.Nguyen@synopsys.com >
Link: https://lore.kernel.org/r/d57b7dfd228199cef811206b1b83ec649f742752.1733876548.git.Thinh.Nguyen@synopsys.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org >
2024-12-24 08:56:06 +01:00
Thinh Nguyen
1f0d96f5d1
usb: gadget: f_tcm: Get stream by sbitmap number
...
We prepare same number of sbitmap as the number of streams. Use the
returned sbitmap number as index to the selected stream for a usbg_cmd.
Signed-off-by: Thinh Nguyen <Thinh.Nguyen@synopsys.com >
Link: https://lore.kernel.org/r/169f67261162c16342bc8543db93c259b05ead0b.1733876548.git.Thinh.Nguyen@synopsys.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org >
2024-12-24 08:56:06 +01:00
Thinh Nguyen
8840047985
usb: gadget: f_tcm: Limit number of sessions
...
Only allocate up to UASP_SS_EP_COMP_NUM_STREAMS number of session tags.
We should not be using more than UASP_SS_EP_COMP_NUM_STREAMS of tags due
to the number of commands limit we imposed. Each command uses a unique
tag. Any more than that is unnecessary. By limiting it, we can detect an
issue in our driver immediately should we run out of session tags.
Signed-off-by: Thinh Nguyen <Thinh.Nguyen@synopsys.com >
Link: https://lore.kernel.org/r/017016ffcab2f3c284d863fc42483b83dbd21b35.1733876548.git.Thinh.Nguyen@synopsys.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org >
2024-12-24 08:56:06 +01:00
Thinh Nguyen
d0c188cd8d
usb: gadget: f_tcm: Increase bMaxBurst
...
Currently the default bMaxBurst is 0. Set default bMaxBurst to 15 (i.e.
16 bursts) to Data IN and OUT endpoints to improve performance. It
should be fine for a controller that supports less than 16 bursts. It
should be able to negotiate properly with the host at packet level for
the end of burst.
If the controller can't handle a burst of 16, and high performance isn't
important, the user can use BOT protocol from mass_storage gadget driver
instead.
Signed-off-by: Thinh Nguyen <Thinh.Nguyen@synopsys.com >
Link: https://lore.kernel.org/r/9d6265db4d138e542f281988362bc4392b034d43.1733876548.git.Thinh.Nguyen@synopsys.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org >
2024-12-24 08:56:06 +01:00
Thinh Nguyen
e577ae94cd
usb: gadget: f_tcm: Increase stream count
...
Some old builds of Microsoft Windows 10 UASP class driver reject UASP
device with stream count of 2^4. To keep compatibility with both Linux
and Windows, let's increase the stream count to 2^5. Also, internal
tests show that stream count of 2^5 increases performance slightly.
Signed-off-by: Thinh Nguyen <Thinh.Nguyen@synopsys.com >
Link: https://lore.kernel.org/r/23bf7f5cb04da691fd6ba0a77babee9ad3195f44.1733876548.git.Thinh.Nguyen@synopsys.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org >
2024-12-24 08:56:06 +01:00
Thinh Nguyen
94d9bf671a
usb: gadget: f_tcm: Don't prepare BOT write request twice
...
The duplicate kmalloc here is causing memory leak. The request
preparation in bot_send_write_request is also done in
usbg_prepare_w_request. Remove the duplicate work.
Fixes: c52661d60f ("usb-gadget: Initial merge of target module for UASP + BOT")
Cc: stable@vger.kernel.org
Signed-off-by: Thinh Nguyen <Thinh.Nguyen@synopsys.com >
Link: https://lore.kernel.org/r/f4f26c3d586cde0d46f8c3bcb4e8ae32311b650d.1733876548.git.Thinh.Nguyen@synopsys.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org >
2024-12-24 08:56:06 +01:00
Thinh Nguyen
25224c1f07
usb: gadget: f_tcm: ep_autoconfig with fullspeed endpoint
...
Match usb endpoint using fullspeed endpoint descriptor to make sure the
wMaxPacketSize for fullspeed descriptors is automatically configured.
Fixes: c52661d60f ("usb-gadget: Initial merge of target module for UASP + BOT")
Cc: stable@vger.kernel.org
Signed-off-by: Thinh Nguyen <Thinh.Nguyen@synopsys.com >
Link: https://lore.kernel.org/r/e4507bc824aed6e7c7f5a718392ab6a7c1480a7f.1733876548.git.Thinh.Nguyen@synopsys.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org >
2024-12-24 08:56:06 +01:00
Thinh Nguyen
3b99708990
usb: gadget: f_tcm: Fix Get/SetInterface return value
...
Check to make sure that the GetInterface and SetInterface are for valid
interface. Return proper alternate setting number on GetInterface.
Fixes: 0b8b1a1fed ("usb: gadget: f_tcm: Provide support to get alternate setting in tcm function")
Cc: stable@vger.kernel.org
Signed-off-by: Thinh Nguyen <Thinh.Nguyen@synopsys.com >
Link: https://lore.kernel.org/r/ffd91b4640945ea4d3b4f4091cf1abbdbd9cf4fc.1733876548.git.Thinh.Nguyen@synopsys.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org >
2024-12-24 08:56:06 +01:00
Thinh Nguyen
3b2a52e88a
usb: gadget: f_tcm: Decrement command ref count on cleanup
...
We submitted the command with TARGET_SCF_ACK_KREF, which requires
acknowledgment of command completion. If the command fails, make sure to
decrement the ref count.
Fixes: cff834c16d ("usb-gadget/tcm: Convert to TARGET_SCF_ACK_KREF I/O krefs")
Cc: stable@vger.kernel.org
Signed-off-by: Thinh Nguyen <Thinh.Nguyen@synopsys.com >
Link: https://lore.kernel.org/r/3c667b4d9c8b0b580346a69ff53616b6a74cfea2.1733876548.git.Thinh.Nguyen@synopsys.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org >
2024-12-24 08:56:06 +01:00
Thinh Nguyen
98fa00fd3a
usb: gadget: f_tcm: Translate error to sense
...
When respond with check_condition error status, clear from_transport
input so the target layer can translate the sense reason reported by
f_tcm.
Fixes: c52661d60f ("usb-gadget: Initial merge of target module for UASP + BOT")
Cc: stable@vger.kernel.org
Signed-off-by: Thinh Nguyen <Thinh.Nguyen@synopsys.com >
Link: https://lore.kernel.org/r/b2a5577efe7abd0af0051229622cf7d3be5cdcd0.1733876548.git.Thinh.Nguyen@synopsys.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org >
2024-12-24 08:56:05 +01:00
Thinh Nguyen
c225d006a3
usb: gadget: f_tcm: Don't free command immediately
...
Don't prematurely free the command. Wait for the status completion of
the sense status. It can be freed then. Otherwise we will double-free
the command.
Fixes: cff834c16d ("usb-gadget/tcm: Convert to TARGET_SCF_ACK_KREF I/O krefs")
Cc: stable@vger.kernel.org
Signed-off-by: Thinh Nguyen <Thinh.Nguyen@synopsys.com >
Link: https://lore.kernel.org/r/ae919ac431f16275e05ec819bdffb3ac5f44cbe1.1733876548.git.Thinh.Nguyen@synopsys.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org >
2024-12-24 08:56:05 +01:00
Abhishek Pandit-Subedi
1aede06981
platform/chrome: cros_ec_typec: Disable tbt on port
...
Altmodes with cros_ec are either automatically entered by the EC or
entered by the AP if TBT or USB4 are supported on the system. Due to the
security risk of PCIe tunneling, TBT modes should not be auto entered by
the kernel at this time and will require user intervention.
With this change, a userspace program will need to explicitly activate
the thunderbolt mode on the port and partner in order to enter the mode
and the thunderbolt driver will not automatically enter when a partner
is connected.
Signed-off-by: Abhishek Pandit-Subedi <abhishekpandit@chromium.org >
Reviewed-by: Benson Leung <bleung@chromium.org >
Link: https://lore.kernel.org/r/20241213153543.v5.8.Ic14738918e3d026fa2d85e95fb68f8e07a0828d0@changeid
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org >
2024-12-24 08:56:05 +01:00
Abhishek Pandit-Subedi
3b00be26b1
platform/chrome: cros_ec_typec: Thunderbolt support
...
Add support for entering and exiting Thunderbolt alt-mode using AP
driven alt-mode.
Signed-off-by: Abhishek Pandit-Subedi <abhishekpandit@chromium.org >
Reviewed-by: Benson Leung <bleung@chromium.org >
Link: https://lore.kernel.org/r/20241213153543.v5.7.Ic61ced3cdfb5d6776435356061f12307da719829@changeid
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org >
2024-12-24 08:56:05 +01:00
Abhishek Pandit-Subedi
dbb3fc0ffa
platform/chrome: cros_ec_typec: Displayport support
...
Add support for entering and exiting displayport alt-mode on systems
using AP driven alt-mode.
Signed-off-by: Abhishek Pandit-Subedi <abhishekpandit@chromium.org >
Link: https://lore.kernel.org/r/20241213153543.v5.6.I142fc0c09df58689b98f0cebf1c5e48b9d4fa800@changeid
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org >
2024-12-24 08:56:05 +01:00
Abhishek Pandit-Subedi
5b2f3305a9
platform/chrome: cros_ec_typec: Update partner altmode active
...
Mux configuration is often the final piece of mode entry and can be used
to determine whether a partner altmode is active. When mux configuration
is done, use the active port altmode's SVID to set the partner active
field for all partner alt modes.
Signed-off-by: Abhishek Pandit-Subedi <abhishekpandit@chromium.org >
Reviewed-by: Benson Leung <bleung@chromium.org >
Link: https://lore.kernel.org/r/20241213153543.v5.5.I083bf9188947be8cb7460211cfdf3233370a28f6@changeid
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org >
2024-12-24 08:56:05 +01:00
Abhishek Pandit-Subedi
5399a1bac6
usb: typec: Print err when displayport fails to enter
...
Print the error reason for typec_altmode_enter so users can understand
why displayport failed to enter.
Signed-off-by: Abhishek Pandit-Subedi <abhishekpandit@chromium.org >
Reviewed-by: Heikki Krogerus <heikki.krogerus@linux.intel.com >
Reviewed-by: Benson Leung <bleung@chromium.org >
Link: https://lore.kernel.org/r/20241213153543.v5.4.I6cff9d767b0f8ab6458d8940941e42c920902d49@changeid
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org >
2024-12-24 08:56:05 +01:00
Abhishek Pandit-Subedi
183b194d8f
usb: typec: Make active on port altmode writable
...
The active property of port altmode should be writable (to prevent or
allow partner altmodes from entering) and needs to be part of
typec_altmode_desc so we can initialize the port to an inactive state if
desired.
Signed-off-by: Abhishek Pandit-Subedi <abhishekpandit@chromium.org >
Reviewed-by: Heikki Krogerus <heikki.krogerus@linux.intel.com >
Reviewed-by: Benson Leung <bleung@chromium.org >
Link: https://lore.kernel.org/r/20241213153543.v5.3.I794566684ab2965e209f326b08232006eff333f8@changeid
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org >
2024-12-24 08:56:05 +01:00
Heikki Krogerus
100e257386
usb: typec: Add driver for Thunderbolt 3 Alternate Mode
...
Thunderbolt 3 Alternate Mode entry flow is described in
USB Type-C Specification Release 2.0.
Signed-off-by: Heikki Krogerus <heikki.krogerus@linux.intel.com >
Co-developed-by: Abhishek Pandit-Subedi <abhishekpandit@chromium.org >
Signed-off-by: Abhishek Pandit-Subedi <abhishekpandit@chromium.org >
Reviewed-by: Benson Leung <bleung@chromium.org >
Link: https://lore.kernel.org/r/20241213153543.v5.2.I3080b036e8de0b9957c57c1c3059db7149c5e549@changeid
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org >
2024-12-24 08:56:05 +01:00
Abhishek Pandit-Subedi
8541bf0239
usb: typec: Only use SVID for matching altmodes
...
Mode in struct typec_altmode is used to indicate the index of the
altmode on a port, partner or plug. It is used in enter mode VDMs but
doesn't make much sense for matching against altmode drivers or for
matching partner to port altmodes.
Signed-off-by: Abhishek Pandit-Subedi <abhishekpandit@chromium.org >
Reviewed-by: Heikki Krogerus <heikki.krogerus@linux.intel.com >
Reviewed-by: Benson Leung <bleung@chromium.org >
Link: https://lore.kernel.org/r/20241213153543.v5.1.Ie0d37646f18461234777d88b4c3e21faed92ed4f@changeid
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org >
2024-12-24 08:56:05 +01:00
Roy Luo
1ff24d40b3
usb: dwc3: gadget: Fix incorrect UDC state after manual deconfiguration
...
The UDC state in sysfs (/sys/class/udc/<udc>/state) should accurately
reflect the current state of the USB Device Controller.
Currently, the UDC state is not handled consistently during gadget
disconnection. While the disconnect interrupt path correctly sets the
state to "not-attached", manual deconfiguration leaves the state in
"configured", misrepresenting the actual situation.
This commit ensures consistent UDC state handling by setting the state to
"not-attached" after manual deconfiguration. This accurately reflects the
UDC's state and provides a consistent behavior regardless of the
disconnection method.
Signed-off-by: Roy Luo <royluo@google.com >
Reviewed-by: André Draszik <andre.draszik@linaro.org >
Tested-by: André Draszik <andre.draszik@linaro.org >
Link: https://lore.kernel.org/r/20241223042536.1465299-1-royluo@google.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org >
2024-12-24 08:56:05 +01:00