Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

dt-bindings: connector: Add PD rev 2.0 VDO definition

Add the VDO definition for USB PD rev 2.0 in the bindings and define a
new property snk-vdos-v1 containing legacy VDOs as the responses to the
port partner which only supports PD rev 2.0.

Reviewed-by: Rob Herring <robh@kernel.org>
Signed-off-by: Kyle Tso <kyletso@google.com>
Link: https://lore.kernel.org/r/20210601123151.3441914-3-kyletso@google.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

authored by

Kyle Tso and committed by
Greg Kroah-Hartman
55b54c26 f41bfc7e

+81 -3
+15
Documentation/devicetree/bindings/connector/usb-connector.yaml
··· 149 149 maxItems: 6 150 150 $ref: /schemas/types.yaml#/definitions/uint32-array 151 151 152 + sink-vdos-v1: 153 + description: An array of u32 with each entry, a Vendor Defined Message Object (VDO), 154 + providing additional information corresponding to the product, the detailed bit 155 + definitions and the order of each VDO can be found in 156 + "USB Power Delivery Specification Revision 2.0, Version 1.3" chapter 6.4.4.3.1 Discover 157 + Identity. User can specify the VDO array via VDO_IDH/_CERT/_PRODUCT/_CABLE/_AMA defined in 158 + dt-bindings/usb/pd.h. 159 + minItems: 3 160 + maxItems: 6 161 + $ref: /schemas/types.yaml#/definitions/uint32-array 162 + 152 163 op-sink-microwatt: 153 164 description: Sink required operating power in microwatt, if source can't 154 165 offer the power, Capability Mismatch is set. Required for power sink and ··· 217 206 SNK_DISCOVERY) and the actual currrent limit after reception of PS_Ready for PD link or during 218 207 SNK_READY for non-pd link. 219 208 type: boolean 209 + 210 + dependencies: 211 + sink-vdos-v1: [ 'sink-vdos' ] 212 + sink-vdos: [ 'sink-vdos-v1' ] 220 213 221 214 required: 222 215 - compatible
+66 -3
include/dt-bindings/usb/pd.h
··· 106 106 * <20:16> :: Reserved, Shall be set to zero 107 107 * <15:0> :: USB-IF assigned VID for this cable vendor 108 108 */ 109 + 110 + /* PD Rev2.0 definition */ 111 + #define IDH_PTYPE_UNDEF 0 112 + 109 113 /* SOP Product Type (UFP) */ 110 114 #define IDH_PTYPE_NOT_UFP 0 111 115 #define IDH_PTYPE_HUB 1 ··· 232 228 | ((pnum) & 0x1f)) 233 229 234 230 /* 235 - * Passive Cable VDO 231 + * Cable VDO (for both Passive and Active Cable VDO in PD Rev2.0) 232 + * --------- 233 + * <31:28> :: Cable HW version 234 + * <27:24> :: Cable FW version 235 + * <23:20> :: Reserved, Shall be set to zero 236 + * <19:18> :: type-C to Type-A/B/C/Captive (00b == A, 01 == B, 10 == C, 11 == Captive) 237 + * <17> :: Reserved, Shall be set to zero 238 + * <16:13> :: cable latency (0001 == <10ns(~1m length)) 239 + * <12:11> :: cable termination type (11b == both ends active VCONN req) 240 + * <10> :: SSTX1 Directionality support (0b == fixed, 1b == cfgable) 241 + * <9> :: SSTX2 Directionality support 242 + * <8> :: SSRX1 Directionality support 243 + * <7> :: SSRX2 Directionality support 244 + * <6:5> :: Vbus current handling capability (01b == 3A, 10b == 5A) 245 + * <4> :: Vbus through cable (0b == no, 1b == yes) 246 + * <3> :: SOP" controller present? (0b == no, 1b == yes) 247 + * <2:0> :: USB SS Signaling support 248 + * 249 + * Passive Cable VDO (PD Rev3.0+) 236 250 * --------- 237 251 * <31:28> :: Cable HW version 238 252 * <27:24> :: Cable FW version ··· 266 244 * <4:3> :: Reserved, Shall be set to zero 267 245 * <2:0> :: USB highest speed 268 246 * 269 - * Active Cable VDO 1 247 + * Active Cable VDO 1 (PD Rev3.0+) 270 248 * --------- 271 249 * <31:28> :: Cable HW version 272 250 * <27:24> :: Cable FW version ··· 288 266 #define CABLE_VDO_VER1_0 0 289 267 #define CABLE_VDO_VER1_3 3 290 268 291 - /* Connector Type */ 269 + /* Connector Type (_ATYPE and _BTYPE are for PD Rev2.0 only) */ 270 + #define CABLE_ATYPE 0 271 + #define CABLE_BTYPE 1 292 272 #define CABLE_CTYPE 2 293 273 #define CABLE_CAPTIVE 3 294 274 ··· 327 303 #define CABLE_CURR_3A 1 328 304 #define CABLE_CURR_5A 2 329 305 306 + /* USB SuperSpeed Signaling Support (PD Rev2.0) */ 307 + #define CABLE_USBSS_U2_ONLY 0 308 + #define CABLE_USBSS_U31_GEN1 1 309 + #define CABLE_USBSS_U31_GEN2 2 310 + 330 311 /* USB Highest Speed */ 331 312 #define CABLE_USB2_ONLY 0 332 313 #define CABLE_USB32_GEN1 1 333 314 #define CABLE_USB32_4_GEN2 2 334 315 #define CABLE_USB4_GEN3 3 335 316 317 + #define VDO_CABLE(hw, fw, cbl, lat, term, tx1d, tx2d, rx1d, rx2d, cur, vps, sopp, usbss) \ 318 + (((hw) & 0x7) << 28 | ((fw) & 0x7) << 24 | ((cbl) & 0x3) << 18 \ 319 + | ((lat) & 0x7) << 13 | ((term) & 0x3) << 11 | (tx1d) << 10 \ 320 + | (tx2d) << 9 | (rx1d) << 8 | (rx2d) << 7 | ((cur) & 0x3) << 5 \ 321 + | (vps) << 4 | (sopp) << 3 | ((usbss) & 0x7)) 336 322 #define VDO_PCABLE(hw, fw, ver, conn, lat, term, vbm, cur, spd) \ 337 323 (((hw) & 0xf) << 28 | ((fw) & 0xf) << 24 | ((ver) & 0x7) << 21 \ 338 324 | ((conn) & 0x3) << 18 | ((lat) & 0xf) << 13 | ((term) & 0x3) << 11 \ ··· 406 372 | (trans) << 11 | (phy) << 10 | (ele) << 9 | (u4) << 8 \ 407 373 | ((hops) & 0x3) << 6 | (u2) << 5 | (u32) << 4 | (lane) << 3 \ 408 374 | (iso) << 2 | (gen)) 375 + 376 + /* 377 + * AMA VDO (PD Rev2.0) 378 + * --------- 379 + * <31:28> :: Cable HW version 380 + * <27:24> :: Cable FW version 381 + * <23:12> :: Reserved, Shall be set to zero 382 + * <11> :: SSTX1 Directionality support (0b == fixed, 1b == cfgable) 383 + * <10> :: SSTX2 Directionality support 384 + * <9> :: SSRX1 Directionality support 385 + * <8> :: SSRX2 Directionality support 386 + * <7:5> :: Vconn power 387 + * <4> :: Vconn power required 388 + * <3> :: Vbus power required 389 + * <2:0> :: USB SS Signaling support 390 + */ 391 + #define VDO_AMA(hw, fw, tx1d, tx2d, rx1d, rx2d, vcpwr, vcr, vbr, usbss) \ 392 + (((hw) & 0x7) << 28 | ((fw) & 0x7) << 24 \ 393 + | (tx1d) << 11 | (tx2d) << 10 | (rx1d) << 9 | (rx2d) << 8 \ 394 + | ((vcpwr) & 0x7) << 5 | (vcr) << 4 | (vbr) << 3 \ 395 + | ((usbss) & 0x7)) 396 + 397 + #define PD_VDO_AMA_VCONN_REQ(vdo) (((vdo) >> 4) & 1) 398 + #define PD_VDO_AMA_VBUS_REQ(vdo) (((vdo) >> 3) & 1) 399 + 400 + #define AMA_USBSS_U2_ONLY 0 401 + #define AMA_USBSS_U31_GEN1 1 402 + #define AMA_USBSS_U31_GEN2 2 403 + #define AMA_USBSS_BBONLY 3 409 404 410 405 /* 411 406 * VPD VDO