[PATCH] arm64: dts: imx8mp-evk: add dual-role usb port1 support

Marco Felsch m.felsch at pengutronix.de
Mon Mar 27 01:22:10 PDT 2023


Hi,

On 23-03-24, Jun Li wrote:
> 
> 
> > -----Original Message-----
> > From: Marco Felsch <m.felsch at pengutronix.de>
> > Sent: Thursday, March 23, 2023 6:58 PM
> > To: robh+dt at kernel.org; krzysztof.kozlowski+dt at linaro.org;
> > shawnguo at kernel.org; dl-linux-imx <linux-imx at nxp.com>; festevam at gmail.com
> > Cc: linux-arm-kernel at lists.infradead.org; linux-kernel at vger.kernel.org;
> > kernel at pengutronix.de
> > Subject: [PATCH] arm64: dts: imx8mp-evk: add dual-role usb port1 support
> > 
> > The i.MX8MP-EVK has a dual-role usb-type-c port marked as PORT1. By this
> > commit the dual-role support is added which allows the user-space to assign
> > usb-gadget functions to it via the configFS.
> 
> So just ignore the orientation switch will make this port cannot work
> at super speed, this is actually why this port is not enabled at upstream.

I saw comments on the i.MX8MP-EVK schematic but no erratum listed. Can
you explain this a bit more in detail? Since the USBx_ID pin is
unconnected, the role is described via DTs as otg and the tcpc can be
configured via user-space. I tested this at least for the device mode.

> I see the orientation switch via GPIO for SBU is already merged:
> drivers/usb/typec/mux/gpio-sbu-mux.c
> Do you have interest to expand this driver to support super speed
> switch for this case? 

My intention was to enable this port to be able to have it as device
which is useful for bootloaders. The speed doesn't matter to me, at
least not now.

Regards,
  Marco


> 
> Thanks
> Li Jun
> > 
> > Signed-off-by: Marco Felsch <m.felsch at pengutronix.de>
> > ---
> >  arch/arm64/boot/dts/freescale/imx8mp-evk.dts | 59 ++++++++++++++++++++
> >  1 file changed, 59 insertions(+)
> > 
> > diff --git a/arch/arm64/boot/dts/freescale/imx8mp-evk.dts
> > b/arch/arm64/boot/dts/freescale/imx8mp-evk.dts
> > index f2d93437084be..982fe35f09a7e 100644
> > --- a/arch/arm64/boot/dts/freescale/imx8mp-evk.dts
> > +++ b/arch/arm64/boot/dts/freescale/imx8mp-evk.dts
> > @@ -5,7 +5,9 @@
> > 
> >  /dts-v1/;
> > 
> > +#include <dt-bindings/interrupt-controller/irq.h>
> >  #include <dt-bindings/phy/phy-imx8-pcie.h>
> > +#include <dt-bindings/usb/pd.h>
> >  #include "imx8mp.dtsi"
> > 
> >  / {
> > @@ -336,6 +338,34 @@ &i2c2 {
> >  	pinctrl-names = "default";
> >  	pinctrl-0 = <&pinctrl_i2c2>;
> >  	status = "okay";
> > +
> > +	tcpc at 50 {
> > +		compatible = "nxp,ptn5110";
> > +		reg = <0x50>;
> > +		pinctrl-names = "default";
> > +		pinctrl-0 = <&pinctrl_tcpc>;
> > +		interrupt-parent = <&gpio4>;
> > +		interrupts = <19 IRQ_TYPE_LEVEL_LOW>;
> > +
> > +		connector {
> > +			compatible = "usb-c-connector";
> > +			label = "USB-C";
> > +			power-role = "dual";
> > +			data-role = "dual";
> > +			try-power-role = "sink";
> > +			source-pdos = <PDO_FIXED(5000, 3000, PDO_FIXED_USB_COMM)>;
> > +			sink-pdos = <PDO_FIXED(5000, 3000, PDO_FIXED_USB_COMM)
> > +				     PDO_VAR(5000, 20000, 3000)>;
> > +			op-sink-microwatt = <15000000>;
> > +			self-powered;
> > +		};
> > +
> > +		port {
> > +			usb_con_ss: endpoint {
> > +				remote-endpoint = <&usb_dwc3_0_drd>;
> > +			};
> > +		};
> > +	};
> >  };
> > 
> >  &i2c3 {
> > @@ -449,14 +479,37 @@ &uart2 {
> >  	status = "okay";
> >  };
> > 
> > +&usb3_phy0 {
> > +	status = "okay";
> > +};
> > +
> >  &usb3_phy1 {
> >  	status = "okay";
> >  };
> > 
> > +&usb3_0 {
> > +	status = "okay";
> > +};
> > +
> >  &usb3_1 {
> >  	status = "okay";
> >  };
> > 
> > +&usb_dwc3_0 {
> > +	dr_mode = "otg";
> > +	hnp-disable;
> > +	srp-disable;
> > +	adp-disable;
> > +	usb-role-switch;
> > +	status = "okay";
> > +
> > +	port {
> > +		usb_dwc3_0_drd: endpoint {
> > +			remote-endpoint = <&usb_con_ss>;
> > +		};
> > +	};
> > +};
> > +
> >  &usb_dwc3_1 {
> >  	pinctrl-names = "default";
> >  	pinctrl-0 = <&pinctrl_usb1_vbus>;
> > @@ -666,6 +719,12 @@ MX8MP_IOMUXC_SD2_RESET_B__GPIO2_IO19	0x40
> >  		>;
> >  	};
> > 
> > +	pinctrl_tcpc: tcpcgrp {
> > +		fsl,pins = <
> > +			MX8MP_IOMUXC_SAI1_TXD7__GPIO4_IO19	0x159
> > +		>;
> > +	};
> > +
> >  	pinctrl_uart1: uart1grp {
> >  		fsl,pins = <
> >  			MX8MP_IOMUXC_UART1_RXD__UART1_DCE_RX	0x140
> > --
> > 2.30.2
> 
> 



More information about the linux-arm-kernel mailing list