mbox series

[v2,0/2] enable USB on Pixel 6 (Oriole)

Message ID 20240429-usb-dts-gs101-v2-0-7c1797c9db80@linaro.org (mailing list archive)
Headers show
Series enable USB on Pixel 6 (Oriole) | expand

Message

André Draszik April 29, 2024, 10:35 a.m. UTC
These patches enable USB in peripheral mode on Pixel 6.

We can only support peripheral mode at this stage, as the MAX77759 TCPCI
controller used on Pixel 6 to do the role selection doesn't have a(n
upstream) Linux driver. Therefore the role is defaulted to peripheral
without any endpoints / ports.

For the same reason, we can not detect the orientation of a SS USB-C cable
and therefore it will only establish a link in SS mode in one of the
possible orientations of the cable. In all other cases, the link will be HS.

This series has a dependency on other patches, please see below.

I have mainly tested this as CDC ECM Ethernet device using the following:

    mount -t configfs configfs /sys/kernel/config/
    modprobe libcomposite
    modprobe usb_f_ecm
    mkdir /sys/kernel/config/usb_gadget/g3
    cd /sys/kernel/config/usb_gadget/g3

    echo 0xadad > idVendor
    echo 0xddaa > idProduct
    mkdir strings/0x409
    echo 01234567 > strings/0x409/serialnumber
    echo ADADAD > strings/0x409/manufacturer
    cat /proc/device-tree/model > strings/0x409/product
    # create the function (name must match a usb_f_<name> module such as 'acm')
    mkdir functions/ecm.usb0
    # stable MAC addresses
    echo "6e:27:3a:b9:40:87" > functions/ecm.usb0/dev_addr
    echo "ca:49:84:b0:3b:bc" > functions/ecm.usb0/host_addr

    mkdir configs/c.1
    ln -s functions/ecm.usb0 configs/c.1/
    echo $(ls -1 /sys/class/udc/) > UDC

    ifconfig usb0 192.168.1.2 up

at which point the other side should detect it and network communication
becomes possible (once the other side also configures its network
interface).

Due to the clock IDs and DTS phandle references, this series depends on the
bindings and DTS patches 
"dt-bindings: clock: google,gs101-clock: add HSI0 clock management unit"
"arm64: dts: exynos: gs101: enable cmu-hsi0 clock controller" of
the series in
https://lore.kernel.org/r/20240423-hsi0-gs101-v1-0-2c3ddb50c720@linaro.org
(which have been merged to linux-next already)

Furthermore, it also depends on the bindings for USB and USB-phy which have
been proposed as part of:
https://lore.kernel.org/r/20240423-usb-dwc3-gs101-v1-0-2f331f88203f@linaro.org
and
https://lore.kernel.org/r/20240423-usb-phy-gs101-v1-0-ebdcb3ac174d@linaro.org
respectively and haven't been merged yet.

Signed-off-by: André Draszik <andre.draszik@linaro.org>
---
Changes in v2:
- fix commit messages
- rebase against 20240429 linux-next
- Link to v1: https://lore.kernel.org/r/20240423-usb-dts-gs101-v1-0-3421b0371298@linaro.org

---
André Draszik (2):
      arm64: dts: exynos: gs101: add USB & USB-phy nodes
      arm64: dts: exynos: gs101-oriole: enable USB on this board

 arch/arm64/boot/dts/exynos/google/gs101-oriole.dts | 24 +++++++++++++
 arch/arm64/boot/dts/exynos/google/gs101.dtsi       | 41 ++++++++++++++++++++++
 2 files changed, 65 insertions(+)
---
base-commit: b0a2c79c6f3590b74742cbbc76687014d47972d8
change-id: 20240423-usb-dts-gs101-4269e0177c0f

Best regards,

Comments

Krzysztof Kozlowski April 29, 2024, 5:30 p.m. UTC | #1
On Mon, 29 Apr 2024 11:35:48 +0100, André Draszik wrote:
> These patches enable USB in peripheral mode on Pixel 6.
> 
> We can only support peripheral mode at this stage, as the MAX77759 TCPCI
> controller used on Pixel 6 to do the role selection doesn't have a(n
> upstream) Linux driver. Therefore the role is defaulted to peripheral
> without any endpoints / ports.
> 
> [...]

Applied, thanks!

[1/2] arm64: dts: exynos: gs101: add USB & USB-phy nodes
      https://git.kernel.org/krzk/linux/c/14d15fcbe0f1fac5979a0b01160f3651340e38b4
[2/2] arm64: dts: exynos: gs101-oriole: enable USB on this board
      https://git.kernel.org/krzk/linux/c/b93b3140e82a0e48442087c38346eabfb92c63af

Best regards,