Commit Graph

1186711 Commits

Author SHA1 Message Date
Neil Armstrong
ef1e29c6f6 usb: typec: fsa4480: add support for Audio Accessory Mode
The FSA4480 Type-C switch supports switching the Audio R/L,
AGND and MIC signals to the USB-C DP/DM and SBU1/2 to support
the Audio Accessory Mode.

The FSA4480 has an integrated Audio jack detection mechanism
to automatically mux the AGND, MIX and Sense to the correct
SBU lines to support 3 pole and both 4 pole TRRS pinouts.

Signed-off-by: Neil Armstrong <neil.armstrong@linaro.org>
Tested-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
Link: https://lore.kernel.org/r/20230614-topic-sm8550-upstream-type-c-audio-v1-3-15a92565146b@linaro.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2023-06-21 18:07:55 +02:00
Neil Armstrong
c7054c31c1 usb: typec: fsa4480: rework mux & switch setup to handle more states
In order to handle the Audio Accessory mode, refactor the mux
and switch setup in a single function.

The refactor will help add new states and make the process
simpler to understand.

Signed-off-by: Neil Armstrong <neil.armstrong@linaro.org>
Tested-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
Link: https://lore.kernel.org/r/20230614-topic-sm8550-upstream-type-c-audio-v1-2-15a92565146b@linaro.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2023-06-21 18:07:55 +02:00
Neil Armstrong
25a2bc21c8 usb: typec: ucsi: call typec_set_mode on non-altmode partner change
Add support for calling typec_set_mode() for the DEBUG, AUDIO
accessory modes.

Let's also call typec_set_mode() for USB as default and SAFE
when partner is disconnected.

The USB state is only called when ALT mode is specifically
not specified by the partner status flags in order
to leave the altmode handlers setup the proper mode to
switches, muxes and retimers.

Signed-off-by: Neil Armstrong <neil.armstrong@linaro.org>
Tested-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
Link: https://lore.kernel.org/r/20230614-topic-sm8550-upstream-type-c-audio-v1-1-15a92565146b@linaro.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2023-06-21 18:07:55 +02:00
Greg Kroah-Hartman
aed1a2a5a6 thunderbolt: Changes for v6.5 merge window
This includes following Thunderbolt/USB4 changes for the v6.5 merge
 window:
 
   - Improve debug logging
   - Rework for TMU and CL states handling
   - Retimer access improvements
   - Initial support for USB4 v2 features:
 
     * 80G symmetric link support
     * New notifications
     * PCIe extended encapsulation
     * enhanced uni-directional TMU mode
     * CL2 link low power state
     * DisplayPort 2.x tunneling
 
   - Support for Intel Barlow Ridge Thunderbolt/USB4 controller
   - Minor fixes and improvements.
 
 All these have been in linux-next with no reported issues.
 -----BEGIN PGP SIGNATURE-----
 
 iQJUBAABCgA+FiEEVTdhRGBbNzLrSUBaAP2fSd+ZWKAFAmSSoXQgHG1pa2Eud2Vz
 dGVyYmVyZ0BsaW51eC5pbnRlbC5jb20ACgkQAP2fSd+ZWKB9eA/8CPi8+1RByJsn
 CDx5880erO/YJVvtctBoESJo1MZS4l3JkBKtwkEVJcyTTtS8tN7QBk7dBr0rj9Fp
 vRvOdvQY05JYp1JGYxIouzLVIg3ffrxigLd1CURWdS10YgJrJ15P9A5cYuQOlzo8
 DoKFmZdt0R6Mj5gvYGjvfsVp9Pp0QbsizRPzau8zccUZWS43rsaiE3JLjqZSuNw5
 2ajm699i1/wC0se4/RqYQl4+6clMDC0Rmt4UJQxGUQaInOtqXDyJYCkYSmptuBOQ
 FsPce7yXWnSeYYHEn5WFFPpRfHDwyKMF59/Yq3dL5fvy6qBcM7AJ0NAjTzJaAcor
 LdQaaYwFpZ0+6pBk77y9wCI8UDldmPcmnwNTFzLsXJMsMwePn4GCuvwtmOGmoME5
 8SDTQM8wrM4A5aBO08noFsse1wbYg577rhTj5fmGnxtTjMHuX0bfaRwvyGDAbOyD
 qEj++vjK9xucwR70M++tufB/Orsc77Q8HNxWLAYNSQWW11kknKtwZfsXLRUD8meW
 MQDShD9MtL0tJpqdCr0cPHVKnlsoqwopIg92T4N1sffVzQzdkJsQ0K7Iweg5Y72b
 9qYB2KbjRADjIkGa3ZmnYNIvlJMpILkuJM12NHa5y2vwY8bt9bzoKt3KBdXp5kU7
 ZoD4rMoAWZI2HG5YtbCHf1lJlmjjLcM=
 =DaGL
 -----END PGP SIGNATURE-----

Merge tag 'thunderbolt-for-v6.5-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/westeri/thunderbolt into usb-next

Mika writes:

thunderbolt: Changes for v6.5 merge window

This includes following Thunderbolt/USB4 changes for the v6.5 merge
window:

  - Improve debug logging
  - Rework for TMU and CL states handling
  - Retimer access improvements
  - Initial support for USB4 v2 features:

    * 80G symmetric link support
    * New notifications
    * PCIe extended encapsulation
    * enhanced uni-directional TMU mode
    * CL2 link low power state
    * DisplayPort 2.x tunneling

  - Support for Intel Barlow Ridge Thunderbolt/USB4 controller
  - Minor fixes and improvements.

All these have been in linux-next with no reported issues.

* tag 'thunderbolt-for-v6.5-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/westeri/thunderbolt: (55 commits)
  thunderbolt: Add test case for 3 DisplayPort tunnels
  thunderbolt: Add DisplayPort 2.x tunneling support
  thunderbolt: Make bandwidth allocation mode function names consistent
  thunderbolt: Enable CL2 low power state
  thunderbolt: Add support for enhanced uni-directional TMU mode
  thunderbolt: Increase NVM_MAX_SIZE to support Intel Barlow Ridge controller
  thunderbolt: Move constants related to NVM into nvm.c
  thunderbolt: Limit Intel Barlow Ridge USB3 bandwidth
  thunderbolt: Add Intel Barlow Ridge PCI ID
  thunderbolt: Fix PCIe adapter capability length for USB4 v2 routers
  thunderbolt: Fix DisplayPort IN adapter capability length for USB4 v2 routers
  thunderbolt: Add two additional double words for adapters TMU for USB4 v2 routers
  thunderbolt: Enable USB4 v2 PCIe TLP/DLLP extended encapsulation
  thunderbolt: Announce USB4 v2 connection manager support
  thunderbolt: Reset USB4 v2 host router
  thunderbolt: Add the new USB4 v2 notification types
  thunderbolt: Add support for USB4 v2 80 Gb/s link
  thunderbolt: Identify USB4 v2 routers
  thunderbolt: Do not touch lane 1 adapter path config space
  thunderbolt: Ignore data CRC mismatch for USB4 routers
  ...
2023-06-21 18:02:00 +02:00
Ivan Orlov
99f2d956e1 USB: gadget: f_hid: make hidg_class a static const structure
Now that the driver core allows for struct class to be in read-only
memory, move the hidg_class structure to be declared at build time
placing it into read-only memory, instead of having to be dynamically
allocated at load time.

Suggested-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Ivan Orlov <ivan.orlov0322@gmail.com>
Link: https://lore.kernel.org/r/20230620094412.508580-11-gregkh@linuxfoundation.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2023-06-20 16:20:48 +02:00
Ivan Orlov
2c10e7a049 USB: gadget: f_printer: make usb_gadget_class a static const structure
Now that the driver core allows for struct class to be in read-only
memory, move the usb_gadget_class structure to be declared at build time
placing it into read-only memory, instead of having to be dynamically
allocated at load time.

Suggested-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Ivan Orlov <ivan.orlov0322@gmail.com>
Link: https://lore.kernel.org/r/20230620094412.508580-10-gregkh@linuxfoundation.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2023-06-20 16:20:47 +02:00
Ivan Orlov
e571e843f0 USB: mon: make mon_bin_class a static const structure
Now that the driver core allows for struct class to be in read-only
memory, move the mon_bin_class structure to be declared at build time
placing it into read-only memory, instead of having to be dynamically
allocated at load time.

Suggested-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Ivan Orlov <ivan.orlov0322@gmail.com>
Link: https://lore.kernel.org/r/20230620094412.508580-9-gregkh@linuxfoundation.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2023-06-20 16:20:45 +02:00
Ivan Orlov
8e99143649 USB: gadget: udc: core: make udc_class a static const structure
Now that the driver core allows for struct class to be in read-only
memory, move the udc_class structure to be declared at build time
placing it into read-only memory, instead of having to be dynamically
allocated at load time.

Suggested-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Ivan Orlov <ivan.orlov0322@gmail.com>
Link: https://lore.kernel.org/r/20230620094412.508580-8-gregkh@linuxfoundation.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2023-06-20 16:20:43 +02:00
Ivan Orlov
044a61158b USB: roles: make role_class a static const structure
Now that the driver core allows for struct class to be in read-only
memory, move the role_class structure to be declared at build time
placing it into read-only memory, instead of having to be dynamically
allocated at load time.

Suggested-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Ivan Orlov <ivan.orlov0322@gmail.com>
Link: https://lore.kernel.org/r/20230620094412.508580-7-gregkh@linuxfoundation.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2023-06-20 16:20:40 +02:00
Piyush Mehta
34d401a191 dt-bindings: usb: dwc3: Add interrupt-names property support for wakeup interrupt
The hibernation feature enabled for Xilinx Versal NET SoC in DWC3 IP.
As the DWC3 IP supports the hibernation feature, to handle the wakeup
or hibernation interrupt, add host mode "wakeup" interrupt-names
optional property in the binding schema to capture remote-wakeup and
connect/ disconnect event in the hibernation state and increased maxItems
to 4 for the interrupts and interrupt-names property.

We have a dedicated IRQ line specifically for the hibernation feature.
When the "wakeup" IRQ line is triggered, it initiates a hibernation
interrupt, causing the system to wake up from the hibernation state.

Signed-off-by: Piyush Mehta <piyush.mehta@amd.com>
Acked-by: Conor Dooley <conor.dooley@microchip.com>
Reviewed-by: Rob Herring <robh@kernel.org>
Link: https://lore.kernel.org/r/20230619105032.2888128-1-piyush.mehta@amd.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2023-06-20 16:20:10 +02:00
Minda Chen
5aa735a474 dt-bindings: usb: Add StarFive JH7110 USB controller
StarFive JH7110 platforms USB have a wrapper module around
the Cadence USBSS-DRD controller. Add binding information doc
for that.

Signed-off-by: Minda Chen <minda.chen@starfivetech.com>
Reviewed-by: Peter Chen <peter.chen@kernel.org>
Reviewed-by: Hal Feng <hal.feng@starfivetech.com>
Reviewed-by: Conor Dooley <conor.dooley@microchip.com>
Link: https://lore.kernel.org/r/20230518112750.57924-6-minda.chen@starfivetech.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2023-06-19 15:36:31 +02:00
Varadarajan Narayanan
6059d81243 dt-bindings: usb: dwc3: Add IPQ9574 compatible
* Document the IPQ9574 dwc3 compatible.

* Make power-domains as optional since IPQ9574 doesn't have GDSCs

Reviewed-by: Rob Herring <robh@kernel.org>
Signed-off-by: Varadarajan Narayanan <quic_varada@quicinc.com>
Link: https://lore.kernel.org/r/27fc578e549e12a4d689cdd434107964b529c4f4.1686289721.git.quic_varada@quicinc.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2023-06-19 15:34:48 +02:00
Colin Ian King
55f90c3f83 usb: cdns2: Fix spelling mistake in a trace message "Wakupe" -> "Wakeup"
There is a spelling mistake in a trace message. Fix it.

Signed-off-by: Colin Ian King <colin.i.king@gmail.com>
Link: https://lore.kernel.org/r/20230615144052.2254528-1-colin.i.king@gmail.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2023-06-19 15:34:44 +02:00
Azeem Shaikh
ee400a1be1 usb: gadget: function: printer: Replace strlcpy with strscpy
strlcpy() reads the entire source buffer first.
This read may exceed the destination size limit.
This is both inefficient and can lead to linear read
overflows if a source string is not NUL-terminated [1].
In an effort to remove strlcpy() completely [2], replace
strlcpy() here with strscpy().

Direct replacement is safe here since return value of -errno
is used to check for truncation instead of PAGE_SIZE.

[1] https://www.kernel.org/doc/html/latest/process/deprecated.html#strlcpy
[2] https://github.com/KSPP/linux/issues/89

Signed-off-by: Azeem Shaikh <azeemshaikh38@gmail.com>
Link: https://lore.kernel.org/r/20230615180318.400639-1-azeemshaikh38@gmail.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2023-06-19 15:34:40 +02:00
Frank Wang
8be558dcff usb: typec: tcpm: add get max power support
Traverse fixed pdos to calculate the maximum power that the charger
can provide, and it can be get by POWER_SUPPLY_PROP_INPUT_POWER_LIMIT
property.

Signed-off-by: Frank Wang <frank.wang@rock-chips.com>
Reviewed-by: Guenter Roeck <linux@roeck-us.net>
Link: https://lore.kernel.org/r/20230616075241.27690-2-frank.wang@rock-chips.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2023-06-19 15:34:35 +02:00
Frank Wang
1e35f07439 usb: typec: tcpm: fix cc role at port reset
In the current implementation, the tcpm set CC1/CC2 role to open when
it do port reset would cause the VBUS removed by the Type-C partner.

This sets CC1/CC2 according to the default state of port to fix it.

Signed-off-by: Frank Wang <frank.wang@rock-chips.com>
Reviewed-by: Guenter Roeck <linux@roeck-us.net>
Link: https://lore.kernel.org/r/20230616075241.27690-1-frank.wang@rock-chips.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2023-06-19 15:34:28 +02:00
Mika Westerberg
481012b479 thunderbolt: Add test case for 3 DisplayPort tunnels
Intel Barlow Ridge Thunderbolt controller has 3 DP IN adapters. This
allows 3 simultaneus DisplayPort tunnels through either one or two USB4
downstream ports (in any possible configuration). Add test case for
this.

Signed-off-by: Mika Westerberg <mika.westerberg@linux.intel.com>
2023-06-16 09:53:29 +03:00
Mika Westerberg
2d7e047297 thunderbolt: Add DisplayPort 2.x tunneling support
This adds support for the UHBR (Ultra High Bit Rate) bandwidths
introduced with DisplayPort 2.0 (and refined in 2.1). These can go up to
80 Gbit/s and their support is represent in additional bits in the DP IN
capability.

This updates the DisplayPort tunneling to support these new rates too.

Signed-off-by: Mika Westerberg <mika.westerberg@linux.intel.com>
2023-06-16 09:53:29 +03:00
Mika Westerberg
8d73f6b8e0 thunderbolt: Make bandwidth allocation mode function names consistent
Make sure the DisplayPort bandwidth allocation mode function names are
consistent with the existing ones, such as USB3.

No functional changes.

Signed-off-by: Mika Westerberg <mika.westerberg@linux.intel.com>
2023-06-16 09:53:29 +03:00
Mika Westerberg
fd4d58d1fe thunderbolt: Enable CL2 low power state
For USB4 v2 routers we can also enable CL2 which allows better power
savings and thermal management than CL0s and CL1.

Signed-off-by: Mika Westerberg <mika.westerberg@linux.intel.com>
2023-06-16 09:53:28 +03:00
Mika Westerberg
d49b4f043d thunderbolt: Add support for enhanced uni-directional TMU mode
This is new TMU mode introduced with the USB4 v2. This mode is simpler
than the existing ones and allows all CL states as well. Enable this for
all links where both side routers are v2 and keep the existing
functionality for the v1 and earlier links.

Currently only support the MedRes rate. We can add the HiFi rate later
too if it turns out to be useful.

Signed-off-by: Mika Westerberg <mika.westerberg@linux.intel.com>
2023-06-16 09:53:28 +03:00
Gil Fine
322ff701ff thunderbolt: Increase NVM_MAX_SIZE to support Intel Barlow Ridge controller
Intel Barlow Ridge discrete USB4 controller has larger NOR Flash, hence
increase NVM_MAX_SIZE to support it.

Signed-off-by: Gil Fine <gil.fine@linux.intel.com>
Signed-off-by: Mika Westerberg <mika.westerberg@linux.intel.com>
2023-06-16 09:53:28 +03:00
Gil Fine
7c81a578cb thunderbolt: Move constants related to NVM into nvm.c
Move constants related to NVM into nvm.c to make the code cleaner. Use a
separate constant for USB4_DATA_DWORDS in usb4.c.

No functional changes.

Signed-off-by: Gil Fine <gil.fine@linux.intel.com>
Signed-off-by: Mika Westerberg <mika.westerberg@linux.intel.com>
2023-06-16 09:53:28 +03:00
Mika Westerberg
f2bfa94408 thunderbolt: Limit Intel Barlow Ridge USB3 bandwidth
Intel Barlow Ridge discrete USB4 host router has the same limitation as
the previous generations so make sure the USB3 bandwidth limitation
quirk is applied to Barlow Ridge too.

Signed-off-by: Gil Fine <gil.fine@linux.intel.com>
Signed-off-by: Mika Westerberg <mika.westerberg@linux.intel.com>
2023-06-16 09:53:28 +03:00
Mika Westerberg
6f14a21066 thunderbolt: Add Intel Barlow Ridge PCI ID
Intel Barlow Ridge is the first USB4 v2 controller from Intel. The
controller exposes standard USB4 PCI class ID in typical configurations,
however there is a way to configure it so that it uses a special class
ID to allow using s different driver than the Windows inbox one. For
this reason add the Barlow Ridge PCI ID to the Linux driver too so that
the driver can attach regardless of the class ID.

Tested-by: Pengfei Xu <pengfei.xu@intel.com>
Signed-off-by: Mika Westerberg <mika.westerberg@linux.intel.com>
2023-06-16 09:53:28 +03:00
Gil Fine
0209c808a5 thunderbolt: Fix PCIe adapter capability length for USB4 v2 routers
For USB4 v2 routers, the PCIe adapter capability length is longer.
Display the correct capability length in the debugfs register dump.

Signed-off-by: Gil Fine <gil.fine@linux.intel.com>
Signed-off-by: Mika Westerberg <mika.westerberg@linux.intel.com>
2023-06-16 09:53:28 +03:00
Gil Fine
75abb4f5ff thunderbolt: Fix DisplayPort IN adapter capability length for USB4 v2 routers
For USB4 v2 routers, the DisplayPort IN adapter capability length is
longer. Display the correct capability length in the debugfs register
dump.

Signed-off-by: Gil Fine <gil.fine@linux.intel.com>
Signed-off-by: Mika Westerberg <mika.westerberg@linux.intel.com>
2023-06-16 09:53:28 +03:00
Gil Fine
ee22d52aee thunderbolt: Add two additional double words for adapters TMU for USB4 v2 routers
For USB4 v2 routers, the adapters's TMU capability has two additional
double words. Include them in the debugfs register dump.

Signed-off-by: Gil Fine <gil.fine@linux.intel.com>
Signed-off-by: Mika Westerberg <mika.westerberg@linux.intel.com>
2023-06-16 09:53:28 +03:00
Gil Fine
6e19d48ea0 thunderbolt: Enable USB4 v2 PCIe TLP/DLLP extended encapsulation
USB4 v2 spec introduces modified encapsulation of PCIe TLP and DLLP
packets. This improves the PCIe tunneled traffic usage by reducing
overhead. Enable this if both sides of the link support it.

Signed-off-by: Gil Fine <gil.fine@intel.com>
Signed-off-by: Mika Westerberg <mika.westerberg@linux.intel.com>
2023-06-16 09:53:28 +03:00
Gil Fine
14200a2631 thunderbolt: Announce USB4 v2 connection manager support
Program the CMUV (Connection Manager USB4 Version) field for USB4 v2 and
v1 routers according to the spec.

Signed-off-by: Gil Fine <gil.fine@intel.com>
Signed-off-by: Mika Westerberg <mika.westerberg@linux.intel.com>
2023-06-16 09:53:28 +03:00
Mika Westerberg
0fc7088656 thunderbolt: Reset USB4 v2 host router
USB4 v2 added a bit that can be used to reset the host router so we use
this to trigger reset when the driver probes. This will reset the
already connected topology as well but doing this simplifies things a
lot if for instance the link is already set to asymmetric. We also add
a module parameter to prevent this in case of problems.

While there rename the REG_HOP_COUNT to REG_CAPS to match the USB4 spec
naming better.

Signed-off-by: Mika Westerberg <mika.westerberg@linux.intel.com>
2023-06-16 09:53:28 +03:00
Mika Westerberg
235d019481 thunderbolt: Add the new USB4 v2 notification types
USB4 v2 spec adds a bunch of new notifications that the connection
manager can use instead of polling. While we do not use these yet we
need to ack the ones routers expect to be acked.

Signed-off-by: Mika Westerberg <mika.westerberg@linux.intel.com>
2023-06-16 09:53:28 +03:00
Gil Fine
e111fb9251 thunderbolt: Add support for USB4 v2 80 Gb/s link
USB4 v2 bumps the per-lane speed up to 40 Gb/s. Also the lanes are
always bonded which gives 80 Gb/s symmetric link (and 120/40 Gb/s
asymmetric). This updates the speed and width of routers and XDomain
connections to support the Gen 4 link. For now we keep the link as is
even if it is already asymmetric.

While there make tb_port_set_link_width() static.

Signed-off-by: Gil Fine <gil.fine@intel.com>
Signed-off-by: Mika Westerberg <mika.westerberg@linux.intel.com>
2023-06-16 09:53:27 +03:00
Gil Fine
6e21007d0f thunderbolt: Identify USB4 v2 routers
Add a new function usb4_switch_version() that can be used to figure out
the spec version of the router and make tb_switch_is_usb4() to use it as
well. Update the uevent accordingly.

Signed-off-by: Gil Fine <gil.fine@intel.com>
Signed-off-by: Mika Westerberg <mika.westerberg@linux.intel.com>
2023-06-16 09:53:27 +03:00
Mika Westerberg
2ad3e1314c thunderbolt: Do not touch lane 1 adapter path config space
It is not required to be implemented at all because USB4 does not use
lane 1 for tunneling except when aggregated with lane 0. For this reason
do not try to read the path config space of USB4 lane 1 adapters.

Signed-off-by: Mika Westerberg <mika.westerberg@linux.intel.com>
2023-06-16 09:53:27 +03:00
Mika Westerberg
4796efdd16 thunderbolt: Ignore data CRC mismatch for USB4 routers
This is also something not always updated after the DROM contents itself
so issue warning but continue parsing it as we do for pre-USB4 DROMs
too.

Signed-off-by: Mika Westerberg <mika.westerberg@linux.intel.com>
2023-06-16 09:53:27 +03:00
Dmitry Baryshkov
88d8f3ac9c usb: typec: add support for the nb7vpq904m Type-C Linear Redriver
Add support for the ON Semiconductor NB7VPQ904M Type-C USB SuperSpeed
and DisplayPort ALT Mode Linear Redriver chip found on some devices
with a Type-C port.

The redriver compensates ultra High-Speeed DisplayPort and USB
Super Speed signal integrity losses mainly due to PCB & transmission
cables.

The redriver doesn't support SuperSpeed lines swapping, but
can support Type-C SBU lines swapping.

Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
Reviewed-by: Heikki Krogerus <heikki.krogerus@linux.intel.com>
Signed-off-by: Neil Armstrong <neil.armstrong@linaro.org>
Message-ID: <20230601-topic-sm8x50-upstream-redriver-v4-2-91d5820f3a03@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2023-06-15 12:41:18 +02:00
Greg Kroah-Hartman
4ee94d9407 MAINTAINERS: USB: add uapi header files to USB SUBSYSTEM entry
For some reason the include/uapi/linux/usb/ directory is missing in the
USB SUBSYSTEM entry, so get_maintainer will not know to cc: the proper
mailing lists.  Fix this up by adding an entry for this directory.

Message-ID: <20230615094306.2072827-2-gregkh@linuxfoundation.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2023-06-15 11:50:03 +02:00
Piyush Mehta
c43e7983fc dt-bindings: reset: convert the xlnx,zynqmp-reset.txt to yaml
Convert the binding to DT schema format. It also updates the
reset-controller description.

Signed-off-by: Piyush Mehta <piyush.mehta@amd.com>
Reviewed-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
Message-ID: <20230613123048.2935502-1-piyush.mehta@amd.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2023-06-15 11:46:53 +02:00
Neil Armstrong
771e0e37bf dt-bindings: usb: add ON Semiconductor nb7vpq904m Type-C Linear Redriver bindings
Document bindings for this ON Semiconductor Type-C USB SuperSpeed
and DisplayPort ALT Mode Linear Redriver.

Signed-off-by: Neil Armstrong <neil.armstrong@linaro.org>
Reviewed-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
Message-ID: <20230601-topic-sm8x50-upstream-redriver-v3-1-988c560e2195@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2023-06-15 11:43:38 +02:00
Kees Cook
09b69dd437 usb: ch9: Replace 1-element array with flexible array
Since commit df8fc4e934 ("kbuild: Enable -fstrict-flex-arrays=3"),
UBSAN_BOUNDS no longer pretends 1-element arrays are unbounded. Walking
wData will trigger a warning, so make it a proper flexible array. Add a
union to keep the struct size identical for userspace in case anything
was depending on the old size.

Reported-by: kernel test robot <oliver.sang@intel.com>
Closes: https://lore.kernel.org/oe-lkp/202306102333.8f5a7443-oliver.sang@intel.com
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: kernel test robot <lkp@intel.com>
Cc: "Gustavo A. R. Silva" <gustavoars@kernel.org>
Cc: Dan Williams <dan.j.williams@intel.com>
Cc: "Jó Ágila Bitsch" <jgilab@gmail.com>
Signed-off-by: Kees Cook <keescook@chromium.org>
Message-ID: <20230614181307.gonna.256-kees@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2023-06-15 11:43:29 +02:00
Greg Kroah-Hartman
df49f2a0ac Revert "usb: common: usb-conn-gpio: Set last role to unknown before initial detection"
This reverts commit edd60d24bd.

Heikki reports that this should not be a global flag just to work around
one broken driver and should be fixed differently, so revert it.

Reported-by: Heikki Krogerus <heikki.krogerus@linux.intel.com>
Fixes: edd60d24bd ("usb: common: usb-conn-gpio: Set last role to unknown before initial detection")
Link: https://lore.kernel.org/r/ZImE4L3YgABnCIsP@kuha.fi.intel.com
Cc: Prashanth K <quic_prashk@quicinc.com>
Cc: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2023-06-15 11:30:35 +02:00
Xu Yang
53d061c19d usb: chipidea: imx: add missing USB PHY DPDM wakeup setting
USB PHY DPDM wakeup bit is enabled by default, when USB wakeup
is not required(/sys/.../wakeup is disabled), this bit should be
disabled, otherwise we will have unexpected wakeup if do USB device
connect/disconnect while system sleep.
This bit can be enabled for both host and device mode.

Signed-off-by: Li Jun <jun.li@nxp.com>
Signed-off-by: Xu Yang <xu.yang_2@nxp.com>
Acked-by: Peter Chen <peter.chen@kernel.org>
Message-ID: <20230517081907.3410465-3-xu.yang_2@nxp.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2023-06-13 12:05:42 +02:00
Xu Yang
0ac37fbdad usb: chipidea: imx: turn off vbus comparator when suspend
As we use bvalid for vbus wakeup source, to save power when
suspend, turn off the vbus comparator for imx7d and imx8mm.

Below is this bit description from RM of iMX8MM
"VBUS Valid Comparator Enable:

This signal controls the USB OTG PHY VBUS Valid comparator which
indicates whether the voltage on the USB_OTG*_VBUS pin is below
the VBUS Valid threshold. The VBUS Valid threshold is nominally
4.75V on this USB PHY. The VBUS Valid threshold can be adjusted
using the USBNC_OTGn_PHY_CFG1[OTGTUNE0] bit field. Status of the
VBUS Valid comparator, when it is enabled, is reported on the
USBNC_OTGn_PHY_STATUS[VBUS_VLD] bit.
When OTGDISABLE0 (USBNC_USB_OTGx_PHY_CFG2[10])is set to 1'b0 and
DRVVBUS0 is set to 1'b1, the Bandgap circuitry and VBUS Valid
comparator are powered, even in Suspend or Sleep mode.
DRVVBUS0 should be reset to 1'b0 when the internal VBUS Valid comparator
is not required, to reduce quiescent current in Suspend or Sleep mode.
 - 0 The VBUS Valid comparator is disabled
  - 1 The VBUS Valid comparator is enabled"

Signed-off-by: Li Jun <jun.li@nxp.com>
Signed-off-by: Xu Yang <xu.yang_2@nxp.com>
Acked-by: Peter Chen <peter.chen@kernel.org>
Message-ID: <20230517081907.3410465-2-xu.yang_2@nxp.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2023-06-13 12:05:42 +02:00
Pawel Laszczak
41e2f976b5 MAINTAINERS: add Cadence USBHS driver entry
Patch adds entry for USBHS (CDNS2) driver into MAINTARNERS file

Signed-off-by: Pawel Laszczak <pawell@cadence.com>
Message-ID: <20230602102644.77470-5-pawell@cadence.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2023-06-13 11:59:29 +02:00
Pawel Laszczak
07a3aef249 usb: cdns2: Add tracepoints for CDNS2 driver
Patch adds the series of tracepoints that can be used for
debugging issues detected in driver.

Signed-off-by: Pawel Laszczak <pawell@cadence.com>
Message-ID: <20230602102644.77470-4-pawell@cadence.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2023-06-13 11:59:29 +02:00
Pawel Laszczak
3eb1f1efe2 usb: cdns2: Add main part of Cadence USBHS driver
This patch introduces the main part of Cadence USBHS driver
to Linux kernel.
To reduce the patch size a little bit, the header file gadget.h was
intentionally added as separate patch.

The Cadence USB 2.0 Controller is a highly configurable IP Core which
supports both full and high speed data transfer.

The current driver has been validated with FPGA platform. We have
support for PCIe bus, which is used on FPGA prototyping.

Signed-off-by: Pawel Laszczak <pawell@cadence.com>
Message-ID: <20230602102644.77470-3-pawell@cadence.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2023-06-13 11:59:29 +02:00
Pawel Laszczak
0ca2026eea usb: cdns2: Device side header file for CDNS2 driver
Patch defines macros, registers and structures used by
Device side driver.

Signed-off-by: Pawel Laszczak <pawell@cadence.com>
Message-ID: <20230602102644.77470-2-pawell@cadence.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2023-06-13 11:59:29 +02:00
Christophe JAILLET
01052b91c9 usb: dwc3-meson-g12a: Fix an error handling path in dwc3_meson_g12a_probe()
If dwc3_meson_g12a_otg_init() fails, resources allocated by the previous
of_platform_populate() call should be released, as already done in the
error handling path.

Fixes: 1e355f21d3 ("usb: dwc3: Add Amlogic A1 DWC3 glue")
Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
Reviewed-by: Martin Blumenstingl <martin.blumenstingl@googlemail.com>
Reviewed-by: Neil Armstrong <neil.armstrong@linaro.org>
Message-ID: <9d28466de1808ccc756b4cc25fc72c482d133d13.1686403934.git.christophe.jaillet@wanadoo.fr>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2023-06-13 11:59:01 +02:00
Jeff Layton
a053d9dc45 usb: update the ctime as well when updating mtime after an ioctl
In general, POSIX requires that when the mtime is updated that the ctime
be updated as well. Add the missing timestamp updates to the usb ioctls.

Signed-off-by: Jeff Layton <jlayton@kernel.org>
Message-ID: <20230612104524.17058-3-jlayton@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2023-06-13 11:58:50 +02:00