RockPi 4(A/B/C) - USB OTG mode in current/mainline kernels?


1 1

Recommended Posts

I know that not all features of legacy vendor kernels can be supported in mainline kernels.  However, has anyone considered and/or attempted to get the OTG capability working in a current/mainline kernel?


I have a couple different projects where I need to have OTG working so I can have the RockPi 4 be a USB device (e.g. mass storage, ethernet, etc.).  For the time being this means I can only use the legacy kernels, but I am hoping that might change in the future.


There are a number of different RK3399 boards with DWC3 controllers that could benefit from such a feature being available, right?  Since I don't understand the kernel/driver/platform glue layers well enough to make an attempt myself,  I am hoping someone who knows more about this might have some extra info?  Is it planned for the future?  Too complex? Something else?


Link to post
Share on other sites

Donate and support the project!

8 hours ago, amcduffee said:

Is it planned for the future?


In the future we plan to provide some sort of bounty to cover this, but for now, we can do nothing but skip. Current short term plan is to remove support (unless someone will join and pick it up) since we are already working more then possible and users contribution is barely enough to cover the bill for their download habits. There is already a big bill for the features that we have ported, working fine and nobody complains for but also nobody wants to cover. Board support is expensive and public share in that cost management is below 1% ... Anyone can try to hire someone to fix / port / support this - we really don't need more work on our expense - we have plenty of ... When / if this is fixed, send a patch. To mainline kernel  mailing list or to, which will be far easier & cheaper.

Link to post
Share on other sites

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:


/ {
        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";

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.

Edited by Terry Hardie
Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


1 1