devicetree.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v6 00/13] Add Qualcomm PMIC TPCM support
@ 2023-05-01 12:10 Bryan O'Donoghue
  2023-05-01 12:10 ` [PATCH v6 01/13] dt-bindings: regulator: qcom,usb-vbus-regulator: Mark reg as required Bryan O'Donoghue
                   ` (12 more replies)
  0 siblings, 13 replies; 39+ messages in thread
From: Bryan O'Donoghue @ 2023-05-01 12:10 UTC (permalink / raw)
  To: linux, heikki.krogerus, gregkh, andersson, robh+dt,
	krzysztof.kozlowski+dt, luca.weiss, linux-usb, linux-arm-msm,
	devicetree
  Cc: caleb.connolly, bryan.odonoghue, konrad.dybcio, subbaram, jackp,
	robertom

I'm dropping the previous V1-V5 log because the text is getting too long
here's a link to the previous cover letter instead
Link: https://lore.kernel.org/linux-usb/20230413113438.1577658-1-bryan.odonoghue@linaro.org/

Bootable tree
Link: https://git.codelinaro.org/bryan.odonoghue/kernel/-/tree/linux-next-23-04-28-pm8150b-tcpm-qcom-wrapper-typec-mux-bjorn 

Please note patch#5 and patch#6 should be merged in tandem not separately.

V6:

- I found an off-by-one bug when connecting a Type-C DP cable from Amazon
  which sends the max PD PDU - bod patch#7

- Drops the partial PHY orientation patch in favour of Bjorn's sc8280xp series
 
- Updates the commit log for the driver per Heikki's comment patch#7
- Adds Heikki's Acked-by to the driver patch#7

- Ammends commit log text - Marijn patch#4
- Typos highlithed - Marijn patch#4

- Adds Reviewed-by - Krzysztof patch#1
- Makes port@0 input required - Krzysztof patch#4
- Incorporate's Krzysztof's comments for quotation marks, minItems patch#5
- Adds Reviewed-by - Krzysztof patch#6

- Defines port/endpoint in sm8250.dtsi - patch#13 Konrad

- Luca. Would appreciate your testing.
  I don't see anything wrong with your reference dts
  Link: https://github.com/z3ntu/linux/blob/5db89528bd6f0f2e6027f2ad64a9178699be9bc0/arch/arm64/boot/dts/qcom/sm7225-fairphone-fp4.dts

  If we still can't get it working for you with Bjorn's patches maybe I can find
  a few cycles to debug with a FP4 after landing the 8250 bit.

  Caleb has something working for the rb3 based on these patches so, the gap can't be too big.

Here's how I'm testing using an RB5/SM8250

A) Confirm device mode works in both orientations

- Boot to a Linux shell
- Run usb-ecm-up.sh [1]
- This provides usb0 on the device side @ 192.168.8.2
- Attach Type-C cable to host PC
- On host PC "sudo ifconfig usb0 192.168.8.1"
- Ping 192.168.8.2 confirming ping works
- Switch cable orientation
- On the PC side re-assign the ip address "sudo ifconfig usb0 192.168.8.1"
- Ping again confirming connectivity

B) Test automatic host-mode transition, orientation and SuperSpeed
- Remove cable from PC
- Attach a Type-C USB key
- Validate the orientation detection
  cat /sys/class/typec/port0/orientation 
  normal 
- Confirm the RB5 sees the USB key as a SuperSpeed device
- Remove USB key and physically invert it along the horizontal axis
- Re-insert the key
- Confirm the RB5 sees the USB key as a SuperSpeed device
- Validate the orientation detection
  cat /sys/class/typec/port0/orientation 
  reverse

C) Test Type-C accessory automatic host-mode transition, orientation and SuperSpeed
- Remove USB key from RB5
- Attach a Type-C USB accessory
- Validate the orientation detection
  cat /sys/class/typec/port0/orientation 
  normal
- Attach a SuperSpeed capable USB key to the Type-C accessory
- Confirm the RB5 sees the USB key as a SuperSpeed device
- Remove the USB key from the Type-C accessory
- Remove the Type-C accessory from the RB5
- Physically invert the Type-C accessory along the horizontal axis
- Re-insert the Type-C accessory
- Validate the orientation detection
  cat /sys/class/typec/port0/orientation 
  reverse
- Re-insert the key
- Confirm the RB5 sees the USB key as a SuperSpeed device

D) Goto Test-A
- Confirming that automatic switch to device mode happens
- Repeat the above loop in ~ any order

[1] usb-ecm-up.sh 
#!/usr/bin/env bash

# load libcomposite module
modprobe libcomposite

# ensure function is loaded
modprobe usb_f_ecm
modprobe usb_f_ncm

mount -t configfs none /sys/kernel/config/

# create a gadget
mkdir /sys/kernel/config/usb_gadget/g0

# cd to its configfs node
cd /sys/kernel/config/usb_gadget/g0

# configure it (vid/pid can be anything if USB Class is used for driver compat)
echo 0x0525 > idVendor
echo 0xa4a4 > idProduct

# configure its serial/mfg/product
mkdir strings/0x409

echo 0xCAFEBABE > strings/0x409/serialnumber
echo Linaro > strings/0x409/manufacturer
echo qrb5165-rb5 > strings/0x409/product

# create configs
mkdir configs/c.1
mkdir configs/c.1/strings/0x409

# create the function (name must match a usb_f_<name> module such as 'acm')
mkdir functions/ncm.0

echo "CDC ECM" > configs/c.1/strings/0x409/configuration

# associate function with config
ln -s functions/ncm.0 configs/c.1

# Set USB version 3.1
echo 0x0310 > bcdUSB

echo "super-speed-plus" > max_speed

# enable gadget by binding it to a UDC from /sys/class/udc
echo a600000.usb > UDC
# to unbind it: echo "" > UDC; sleep 1; rm -rf /sys/kernel/config/usb_gadget/g0

sleep 1

ifconfig usb0 192.168.8.2

Bryan O'Donoghue (13):
  dt-bindings: regulator: qcom,usb-vbus-regulator: Mark reg as required
  dt-bindings: regulator: qcom,usb-vbus-regulator: Mark
    regulator-*-microamp required
  dt-bindings: phy: qcom,sc7180-qmp-usb3-dp-phy: Add orientation-switch
    as optional
  dt-bindings: phy: qcom,sc7180-qmp-usb3-dp-phy: Add input and output
    ports
  dt-bindings: usb: Add Qualcomm PMIC Type-C
  dt-bindings: mfd: qcom,spmi-pmic: Add typec to SPMI device types
  usb: typec: qcom: Add Qualcomm PMIC Type-C driver
  arm64: dts: qcom: sm8250: Define ports for qmpphy
    orientation-switching
  arm64: dts: qcom: pm8150b: Add a TCPM description
  arm64: dts: qcom: qrb5165-rb5: Switch on Type-C VBUS boost
  arm64: dts: qcom: qrb5165-rb5: Switch on basic TCPM
  arm64: dts: qcom: qrb5165-rb5: Switch on TCPM usb-role-switching for
    usb_1
  arm64: dts: qcom: qrb5165-rb5: Switch on TCPM orientation-switch for
    usb_1_qmpphy

 .../bindings/mfd/qcom,spmi-pmic.yaml          |   4 +
 .../phy/qcom,sc7180-qmp-usb3-dp-phy.yaml      |  44 ++
 .../regulator/qcom,usb-vbus-regulator.yaml    |  10 +-
 .../bindings/usb/qcom,pmic-typec.yaml         | 190 ++++++
 MAINTAINERS                                   |  10 +
 arch/arm64/boot/dts/qcom/pm8150b.dtsi         |  40 ++
 arch/arm64/boot/dts/qcom/qrb5165-rb5.dts      |  56 +-
 arch/arm64/boot/dts/qcom/sm8250.dtsi          |  17 +
 drivers/usb/typec/Kconfig                     |  13 -
 drivers/usb/typec/Makefile                    |   1 -
 drivers/usb/typec/qcom-pmic-typec.c           | 261 --------
 drivers/usb/typec/tcpm/Kconfig                |  11 +
 drivers/usb/typec/tcpm/Makefile               |   1 +
 drivers/usb/typec/tcpm/qcom/Makefile          |   6 +
 drivers/usb/typec/tcpm/qcom/qcom_pmic_typec.c | 362 +++++++++++
 .../typec/tcpm/qcom/qcom_pmic_typec_pdphy.c   | 528 +++++++++++++++++
 .../typec/tcpm/qcom/qcom_pmic_typec_pdphy.h   | 115 ++++
 .../typec/tcpm/qcom/qcom_pmic_typec_port.c    | 560 ++++++++++++++++++
 .../typec/tcpm/qcom/qcom_pmic_typec_port.h    | 194 ++++++
 19 files changed, 2146 insertions(+), 277 deletions(-)
 create mode 100644 Documentation/devicetree/bindings/usb/qcom,pmic-typec.yaml
 delete mode 100644 drivers/usb/typec/qcom-pmic-typec.c
 create mode 100644 drivers/usb/typec/tcpm/qcom/Makefile
 create mode 100644 drivers/usb/typec/tcpm/qcom/qcom_pmic_typec.c
 create mode 100644 drivers/usb/typec/tcpm/qcom/qcom_pmic_typec_pdphy.c
 create mode 100644 drivers/usb/typec/tcpm/qcom/qcom_pmic_typec_pdphy.h
 create mode 100644 drivers/usb/typec/tcpm/qcom/qcom_pmic_typec_port.c
 create mode 100644 drivers/usb/typec/tcpm/qcom/qcom_pmic_typec_port.h

-- 
2.39.2


^ permalink raw reply	[flat|nested] 39+ messages in thread

end of thread, other threads:[~2023-05-07 21:09 UTC | newest]

Thread overview: 39+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-05-01 12:10 [PATCH v6 00/13] Add Qualcomm PMIC TPCM support Bryan O'Donoghue
2023-05-01 12:10 ` [PATCH v6 01/13] dt-bindings: regulator: qcom,usb-vbus-regulator: Mark reg as required Bryan O'Donoghue
2023-05-01 12:11 ` [PATCH v6 02/13] dt-bindings: regulator: qcom,usb-vbus-regulator: Mark regulator-*-microamp required Bryan O'Donoghue
2023-05-01 12:11 ` [PATCH v6 03/13] dt-bindings: phy: qcom,sc7180-qmp-usb3-dp-phy: Add orientation-switch as optional Bryan O'Donoghue
2023-05-01 12:11 ` [PATCH v6 04/13] dt-bindings: phy: qcom,sc7180-qmp-usb3-dp-phy: Add input and output ports Bryan O'Donoghue
2023-05-02 10:45   ` Krzysztof Kozlowski
2023-05-02 10:51     ` Krzysztof Kozlowski
2023-05-01 12:11 ` [PATCH v6 05/13] dt-bindings: usb: Add Qualcomm PMIC Type-C Bryan O'Donoghue
2023-05-02 10:56   ` Krzysztof Kozlowski
2023-05-01 12:11 ` [PATCH v6 06/13] dt-bindings: mfd: qcom,spmi-pmic: Add typec to SPMI device types Bryan O'Donoghue
2023-05-01 12:11 ` [PATCH v6 07/13] usb: typec: qcom: Add Qualcomm PMIC Type-C driver Bryan O'Donoghue
2023-05-01 13:31   ` Guenter Roeck
2023-05-01 17:50   ` Caleb Connolly
2023-05-01 12:11 ` [PATCH v6 08/13] arm64: dts: qcom: sm8250: Define ports for qmpphy orientation-switching Bryan O'Donoghue
2023-05-02 11:01   ` Konrad Dybcio
2023-05-01 12:11 ` [PATCH v6 09/13] arm64: dts: qcom: pm8150b: Add a TCPM description Bryan O'Donoghue
2023-05-01 12:11 ` [PATCH v6 10/13] arm64: dts: qcom: qrb5165-rb5: Switch on Type-C VBUS boost Bryan O'Donoghue
2023-05-02 10:56   ` Konrad Dybcio
2023-05-01 12:11 ` [PATCH v6 11/13] arm64: dts: qcom: qrb5165-rb5: Switch on basic TCPM Bryan O'Donoghue
2023-05-01 15:28   ` Jianhua Lu
2023-05-02 10:57   ` Konrad Dybcio
2023-05-01 12:11 ` [PATCH v6 12/13] arm64: dts: qcom: qrb5165-rb5: Switch on TCPM usb-role-switching for usb_1 Bryan O'Donoghue
2023-05-01 15:21   ` Jianhua Lu
2023-05-01 15:53     ` Bryan O'Donoghue
2023-05-01 16:04       ` Jianhua Lu
2023-05-01 15:30   ` Jianhua Lu
2023-05-02 11:00   ` Konrad Dybcio
2023-05-02 11:03     ` Bryan O'Donoghue
2023-05-02 11:13       ` Konrad Dybcio
2023-05-02 11:16         ` Bryan O'Donoghue
2023-05-02 11:47           ` Konrad Dybcio
2023-05-02 12:10             ` Bryan O'Donoghue
2023-05-07 21:09             ` Bryan O'Donoghue
2023-05-01 12:11 ` [PATCH v6 13/13] arm64: dts: qcom: qrb5165-rb5: Switch on TCPM orientation-switch for usb_1_qmpphy Bryan O'Donoghue
2023-05-01 15:34   ` Jianhua Lu
2023-05-01 16:00     ` Bryan O'Donoghue
2023-05-01 15:37   ` Jianhua Lu
2023-05-01 17:04     ` Bryan O'Donoghue
2023-05-02 11:01   ` Konrad Dybcio

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).