Controlling USB Port's Power on ROC-RK3328-CC

Hello! I would like to power on and off the USB ports in ROC-RK3328-CC so that I can do a hard reset of whatever device is connected on the port. This is crucial for my project as the board is going act as a remote server with a 4G dongle providing internet. The idea is to power cycle the dongle if something goes wrong with it.

I know from the schematics that this can be done as all the USB ports are controlled by a regulator which in turn is controlled by GPIO1_D2 which is gpiochip1-line26.

The problem is I couldn’t take control of this line with lgpio as it is being used by vcc-host1-5v-regulator. Can anyone guide me how to take control of this line? I would really appreciate the help. Thank you.

PS: I switched my project from LePotato to Renegrade as the former doesn’t have a ability to control the power over USB. So this is a deal breaker for me.

You have to manually modify the device tree (dtb) by hand to remove or disable that regulator.

The ldto command will generate a dtb file and place it in /boot/efi. You need to convert it with device tree compiler, dtc, to the dts format and then edit it and then convert it back into a dtb. Please note that this has implications on other parts of the system that relies on the same regulator. You have to check the Libre Computer Board Hardware Schematics Links to see which other devices are using the same regulator.