I've spent around 10 hours on this issue. I used the most recent rockpi image for Armbian (Armbian_21.08.1_Rockpi-4b_hirsute_edge_5.13.12_xfce_desktop.img.xz)
I managed to finally make it work by adding this dts file:
/dts-v1/;
/plugin/;
/ {
compatible = "rockchip,rk3399";
fragment@0 {
target = <&usbdrd_dwc3_0>;
__overlay__ {
dr_mode = "peripheral";
compatible = "snps,dwc3";
reg = <0x0 0xfe800000 0x0 0x100000>;
phys = <&tcphy0_usb3>;
phy-names = "usb3-phy";
phy_type = "utmi_wide";
snps,dis_enblslpm_quirk;
snps,dis-u2-freeclk-exists-quirk;
snps,dis_u2_susphy_quirk;
snps,dis-del-phy-power-chg-quirk;
snps,xhci-slow-suspend-quirk;
};
};
};
So, write the above to dwc3-0-device.dts and then run:
sudo armbian-add-overlay dwc3-0-device.dts
After this, loading g_ether or g_mass_storage worked fine.