How to enable USB-C host mode on Raspberry Pi
If you want to connect an USB device such as a 3D printer mainboard to your Raspberry Pi 4 using the USB-C connector as opposed to the larger USB-A connector, you need to first configure the Raspberry Pi kernel to use host mode for the USB-C connector.
To temporarily enable it:
sudo modprobe -r dwc2 && sudo dtoverlay dwc2 dr_mode=host && sudo modprobe dwc2
This method has the advantage of not requiring a reboot.
To permanently enable it:
Edit /boot/config.txt
and add
dtoverlay=dwc2,dr_mode=host
at the end of the file (in the [all] section). Then
reboot