Orange Pi Zero 2 W - Enable USB0 (host mode)

The Orange Pi Zero 2 W currently only support one USB port in host mode (the one further from the edge of the board). If you want to be able to use the one near the edge (USB0) you can do so by modifying the system device tree.

Decompile device tree, into user’s home directory:

dtc -I dtb -O dts -o sun50i-h618-orangepi-zero2w.dts /boot/dtb/allwinner/sun50i-h618-orangepi-zero2w.dtb

Modify sun50i-h618-orangepi-zero2w.dts

...
usb@5100000 {
  ...
  status="disabled"
  dr_mode="host"
  ...
}

usb@5101400 {
  ...
  status = "okay";
  ...
};

usb@5101000 {
  ...
  status = "okay";
  ...
};
...

Backup the existing system device tree:

sudo cp /boot/dtb/allwinner/sun50i-h618-orangepi-zero2w.dtb /boot/dtb/allwinner/sun50i-h618-orangepi-zero2w.dtb.bak

Compile the modified device tree from user’s home directory into the system location:

sudo dtc -O dtb -o /boot/dtb/allwinner/sun50i-h618-orangepi-zero2w.dtb sun50i-h618-orangepi-zero2w.dts

Reboot:

sudo reboot

I’m trying to turn this into a device tree overlay so the configuration will be easier and safer.

Ok, the much safer way to set this up is using overlays. Don’t use the method above, but rather try this method first:

Modify ~/sun50i-h616-usbhost0.dts

/dts-v1/;
/plugin/;

/ {
    compatible = "allwinner,sun50i-h618";

    fragment@0 {
        target-path = "/soc/usb@5100000";
        __overlay__ {
            status = "disabled";
            dr_mode = "host";
        };
    };

    fragment@1 {
        target-path = "/soc/usb@5101400";
        __overlay__ {
            status = "okay";
        };
    };

    fragment@2 {
        target-path = "/soc/usb@5101000";
        __overlay__ {
            status = "okay";
        };
    };
};

Compile the overlay:

dtc -@ -I dts -O dtb -o ~/sun50i-h616-usbhost0.dtbo ~/sun50i-h618-orangepi-zero2w-usb0-host-mode-overlay.dts

Copy it to the system directory:

sudo cp sun50i-h616-usbhost0.dtbo /boot/dtb/allwinner/overlay

Enable it in the DietPi environment by modyfing /boot/dietpiEnv.txt

Append this overlay to any others on the line overlays= e.g.:

overlays=usbhost0

Save and reboot.

1 Like