Vim2 Mainline linux kernel dwc2 - usb otg - device mode

hi guys

tested for VIM2

i try activate usb-otg in device mode for mainline kernel without success ;(

for legacy kernel its works fine if we change dts

	dwc2_a {
		compatible = "amlogic, dwc2";
		device_name = "dwc2_a";
		reg = <0x0 0xc9100000 0x0 0x40000>;
		status = "okay";
		interrupts = <0 31 4>;
		pl-periph-id = <0>; /** lm name */
		clock-src = "usb0"; /** clock src */
		port-id = <0>;  /** ref to mach/usb.h */
		port-type = <2>;        /** 0: otg, 1: host, 2: slave */
		port-speed = <0>; /** 0: default, high, 1: full */
		port-config = <0>; /** 0: default */
		port-dma = <0>; /** 0: default ... 6: disable*/
		port-id-mode = <0>; /** 0: hardware, 1: sw_host, 2: sw_slave*/
		usb-fifo = <728>;
		cpu-type = "gxl";
//		controller-type = <3>; /** 0: normal,1:host,2:device,3:otg*/
// force change to device
		controller-type = <2>; /** 0: normal,1:host,2:device,3:otg*/
		phy-reg = <0xd0078000>;
		phy-reg-size = <0xa0>;
		clocks = <&clkc CLKID_USB_GENERAL
			&clkc CLKID_USB1_TO_DDR
			&clkc CLKID_USB1>;
		clock-names = "usb_general",
			"usb1",
			"usb1_to_ddr";
	};

but for mainline I’m confused !!! becouse dwc2 definition is missed ;(

i have try write something like this ( i’m not dts guru )
make dtbs its okay

/tmp/linux-5.3-rc4/arch/arm64/boot/dts/amlogic$ grep usb1 meson-gxl.dtsi -A30
		usb1: usb@c9100000 {
			status = "okay";
			compatible = "amlogic,meson-gxl-dwc3";
			#address-cells = <2>;
			#size-cells = <2>;
			ranges;

			clocks = <&clkc CLKID_USB>,
			     <&clkc CLKID_USB1_DDR_BRIDGE>;
			clock-names = "usb_otg";
			resets = <&reset RESET_USB_OTG>;
			reset-names = "usb_otg";

			dwc2: dwc2@c9100000 {
			//	compatible = "snps,dwc2";
				compatible = "amlogic,meson-g12a-usb", "snps,dwc2";
				reg = <0x0 0xc9100000 0x0 0x400000>;
				interrupts = <GIC_SPI 31 IRQ_TYPE_LEVEL_HIGH>;
			//	dr_mode = "device";
				maximum-speed = "high-speed";
				dr_mode = "peripheral";
				snps,dis_u2_susphy_quirk;
				phys = <&usb2_phy0>;
			};
		};

	};

and of cause its wrong

root@(none):/# dmesg | grep dwc
[    0.396135] dwc3 c9000000.dwc3: Failed to get clk 'ref': -2
[    0.397304] dwc2 c9100000.dwc2: c9100000.dwc2 supply vusb_d not found, using dummy regulator
[    0.397382] dwc2 c9100000.dwc2: c9100000.dwc2 supply vusb_a not found, using dummy regulator
[    0.397581] dwc2 c9100000.dwc2: dwc2_core_reset: HANG! Soft Reset timeout GRSTCTL GRSTCTL_CSFTRST
[    0.397737] dwc2: probe of c9100000.dwc2 failed with error -16

anybody can help me ? its possible for mainline or totally broken ???
tnx for any helps

1 Like

@hyphop Do you have solution?

was solved long time ago please check last oowow images from vim2