Here are some notes from experiments with dwc2 otg enabled on a Raspberry Pi Zero.

Dependencies

$ sudo apt-get install -y device-tree-compiler bc ncurses-dev

Files

$  git clone --depth 1 --branch 4.1.y-dwc2 https://github.com/adafruit/adafruit-raspberrypi-linux.git

gadget.dts - device tree overlay to enable dwc2

/dts-v1/;
/plugin/;

/{
    compatible = "brcm,bcm2835";

    fragment@0 {
        target = <&usb>;
        #address-cells = <1>;
        #size-cells = <0>;
        __overlay__ {
            compatible = "brcm,bcm2835-usb";
            reg = <0x7e980000 0x10000>;
            interrupts = <1 9>;
            dr_mode = "otg";
            clocks = <&clocks>;
            clock-names = "otg";
        };
    };
};

.config - kernel config

Building

compile gadget.dts:

sudo dtc -@ -I dts -O dtb -o /boot/overlays/usb-otg.dtb gadget.dts

enable the usb-otg overlay by adding the following to your /boot/config.txt:

dtoverlay=usb-otg