From: Bryan O'Donoghue <bryan.odonoghue@linaro.org>
To: Luca Weiss <luca.weiss@fairphone.com>,
linux@roeck-us.net, heikki.krogerus@linux.intel.com,
gregkh@linuxfoundation.org, andersson@kernel.org,
robh+dt@kernel.org, krzysztof.kozlowski+dt@linaro.org,
linux-usb@vger.kernel.org, linux-arm-msm@vger.kernel.org,
devicetree@vger.kernel.org
Cc: caleb.connolly@linaro.org, konrad.dybcio@linaro.org,
subbaram@quicinc.com, jackp@quicinc.com,
robertom@qti.qualcomm.com
Subject: Re: [PATCH v5 00/14] Add Qualcomm PMIC TPCM support
Date: Mon, 17 Apr 2023 11:04:42 +0100 [thread overview]
Message-ID: <75d00efb-ff3c-b1f8-a141-3fa78a39557a@linaro.org> (raw)
In-Reply-To: <CRYUWMIJDSB2.BJWEPJEA3Y1D@otso>
On 17/04/2023 08:35, Luca Weiss wrote:
> Do you have an idea in which part of the code to start debugging this?
> Since orientation detection is working is it maybe in the phy code and
> not in the tcpm driver? Or does that also touch crucial stuff for USB
> apart from telling phy which direction to use?
PHY - I'd almost just do the following
diff --git a/drivers/phy/qualcomm/phy-qcom-qmp-combo.c
b/drivers/phy/qualcomm/phy-qcom-qmp-combo.c
index edb788a71edeb..bbac82bd093f8 100644
--- a/drivers/phy/qualcomm/phy-qcom-qmp-combo.c
+++ b/drivers/phy/qualcomm/phy-qcom-qmp-combo.c
@@ -3369,7 +3369,7 @@ static int qmp_combo_typec_switch_set(struct
typec_switch_dev *sw,
dev_dbg(qmp->dev, "Toggling orientation current %d requested %d\n",
qmp->orientation, orientation);
-
+return 0;
In that case the PHY should "just work" for host or device in one
orientation.
The other possibility is that the data role message is not hitting dwc3
drd on your platform.
If you take the last commit on this branch - plus the updated PHY commit
Commit: 171d7f507511 ("usb: dwc3: drd: Enable user-space triggered
role-switching")
Commit: eb0daa19f3ad ("phy: qcom-qmp: Register as a typec switch for
orientation detection")
https://git.codelinaro.org/bryan.odonoghue/kernel/-/tree/linux-next-23-04-17-pm8150b-tcpm-qcom-wrapper-typec-mux
cat /sys/class/usb_role/a600000.usb-role-switch/role
On SM8250 it looks like this
- Attach TypeC accessory with USB key plugged in [1]
Mount USB key, read/write some data
Unmount USB key
cat /sys/class/usb_role/a600000.usb-role-switch/role
host
- Attach TypeC accessory in opposite orientation
Run same test
- Connect to PC via TypeC cable
Run usb-ecm-up.sh [2]
cat /sys/class/usb_role/a600000.usb-role-switch/role
device
PC : ifconfig enp49s0f3u2u4 192.168.8.1
SM8250 : ifconfig usb0 192.168.8.2
Then
PC : iperf -s
SM8250 : iperf -c 192.168.8.1 -t 10
[ 1] 0.0000-10.0706 sec 307 MBytes 256 Mbits/sec
- Unplug from PC - replug TypeC accessory
Rerun test in both orientations
- Replug target to PC
In this case we only have to reset the IP address
PC : ifconfig enp49s0f3u2u4 192.168.8.1
SM8250 : ifconfig usb0 192.168.8.2
Yep its worth checking out that the data-role switch is working, we
might be looking at the wrong thing for you on the PHY.
[1]
https://www.amazon.com/CableCreation-Multiport-Adapter-Gigabit-Ethernet/dp/B08FWMWGTD
[2] usb-ecm-up.sh
root@linaro-gnome:~# cat 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.dwc3 > 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
next prev parent reply other threads:[~2023-04-17 10:07 UTC|newest]
Thread overview: 40+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-04-13 11:34 [PATCH v5 00/14] Add Qualcomm PMIC TPCM support Bryan O'Donoghue
2023-04-13 11:34 ` [PATCH v5 01/14] dt-bindings: regulator: qcom,usb-vbus-regulator: Mark reg as required Bryan O'Donoghue
2023-04-16 17:43 ` Krzysztof Kozlowski
2023-04-13 11:34 ` [PATCH v5 02/14] dt-bindings: regulator: qcom,usb-vbus-regulator: Mark regulator-*-microamp required Bryan O'Donoghue
2023-04-13 11:34 ` [PATCH v5 03/14] dt-bindings: phy: qcom,sc7180-qmp-usb3-dp-phy: Add orientation-switch as optional Bryan O'Donoghue
2023-04-13 11:34 ` [PATCH v5 04/14] dt-bindings: phy: qcom,sc7180-qmp-usb3-dp-phy: Add ports as an optional Bryan O'Donoghue
2023-04-14 7:23 ` Marijn Suijten
2023-04-16 17:47 ` Krzysztof Kozlowski
2023-04-17 0:09 ` Bryan O'Donoghue
2023-04-17 6:16 ` Krzysztof Kozlowski
2023-04-13 11:34 ` [PATCH v5 05/14] dt-bindings: usb: Add Qualcomm PMIC Type-C YAML schema Bryan O'Donoghue
2023-04-14 7:27 ` Marijn Suijten
2023-04-16 17:49 ` Krzysztof Kozlowski
2023-04-13 11:34 ` [PATCH v5 06/14] dt-bindings: mfd: qcom,spmi-pmic: Add typec to SPMI device types Bryan O'Donoghue
2023-04-16 17:50 ` Krzysztof Kozlowski
2023-04-13 11:34 ` [PATCH v5 07/14] arm64: dts: qcom: sm8250: Define ports for qmpphy orientation-switching Bryan O'Donoghue
2023-04-13 11:34 ` [PATCH v5 08/14] arm64: dts: qcom: pm8150b: Add a TCPM description Bryan O'Donoghue
2023-04-13 11:34 ` [PATCH v5 09/14] arm64: dts: qcom: qrb5165-rb5: Switch on Type-C VBUS boost Bryan O'Donoghue
2023-04-13 11:34 ` [PATCH v5 10/14] arm64: dts: qcom: qrb5165-rb5: Switch on basic TCPM Bryan O'Donoghue
2023-04-13 11:34 ` [PATCH v5 11/14] arm64: dts: qcom: qrb5165-rb5: Switch on TCPM usb-role-switching for usb_1 Bryan O'Donoghue
2023-04-22 14:52 ` Konrad Dybcio
2023-04-22 14:53 ` Konrad Dybcio
2023-04-13 11:34 ` [PATCH v5 12/14] arm64: dts: qcom: qrb5165-rb5: Switch on TCPM orientation-switch for usb_1_qmpphy Bryan O'Donoghue
2023-04-13 11:34 ` [PATCH v5 13/14] usb: typec: qcom: Add Qualcomm PMIC TCPM support Bryan O'Donoghue
2023-04-24 13:11 ` Heikki Krogerus
2023-04-24 13:48 ` Bryan O'Donoghue
2023-04-13 11:34 ` [PATCH v5 14/14] phy: qcom-qmp: Register as a typec switch for orientation detection Bryan O'Donoghue
2023-04-18 12:57 ` Bjorn Andersson
2023-04-18 16:54 ` Bryan O'Donoghue
2023-04-13 14:19 ` [PATCH v5 00/14] Add Qualcomm PMIC TPCM support Luca Weiss
2023-04-13 15:08 ` Bryan O'Donoghue
2023-04-14 6:51 ` Luca Weiss
2023-04-17 0:30 ` Bryan O'Donoghue
2023-04-17 7:35 ` Luca Weiss
2023-04-17 10:04 ` Bryan O'Donoghue [this message]
2023-04-17 10:11 ` Bryan O'Donoghue
2023-04-21 10:26 ` Luca Weiss
2023-04-22 22:16 ` Bryan O'Donoghue
2023-04-25 7:29 ` Luca Weiss
2023-09-20 2:13 ` Bjorn Andersson
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=75d00efb-ff3c-b1f8-a141-3fa78a39557a@linaro.org \
--to=bryan.odonoghue@linaro.org \
--cc=andersson@kernel.org \
--cc=caleb.connolly@linaro.org \
--cc=devicetree@vger.kernel.org \
--cc=gregkh@linuxfoundation.org \
--cc=heikki.krogerus@linux.intel.com \
--cc=jackp@quicinc.com \
--cc=konrad.dybcio@linaro.org \
--cc=krzysztof.kozlowski+dt@linaro.org \
--cc=linux-arm-msm@vger.kernel.org \
--cc=linux-usb@vger.kernel.org \
--cc=linux@roeck-us.net \
--cc=luca.weiss@fairphone.com \
--cc=robertom@qti.qualcomm.com \
--cc=robh+dt@kernel.org \
--cc=subbaram@quicinc.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).