Jump to content

mdrmdr

Members
  • Posts

    41
  • Joined

  • Last visited

Community Answers

  1. mdrmdr's post in NanoPi Neo2 V1.1 / how to control OTG port power with GPIO 354? was marked as the answer   
    A long time ago, that I started the question, but a few days ago, I started again to solve it.
    And with the help of several AI, I found a working solution. This is the working overlay:
     
    /dts-v1/; /plugin/; /* * NanoPI Neo2 H5 - OTG USB with switchable VBUS * Allows SD-Card as USB device on OTG port with GPIO-controlled power * * Key points: * - fragment 0: dr_mode "otg" enables dual-role (host+device detection) * - fragment 1: Removing usb0_id_det-gpios prevents "External vbus detected" error * - fragment 2: Removing gpio property from regulator keeps GPIO 354 (PR2) free for manual control * - fragment 3: GPIO 354 is controlled via usb.sh script (echo 1/0 to /sys/class/gpio/gpio354/value) * * GPIO 354 (PR2) state: * 1 = VBUS ON (USB device recognized) * 0 = VBUS OFF (USB device disconnected) */ / { compatible = "allwinner,sun50i-h5"; fragment@0 { target = <&usb_otg>; __overlay__ { dr_mode = "otg"; status = "okay"; }; }; fragment@1 { target = <&usbphy>; __overlay__ { usb0_id_det-gpios; }; }; fragment@2 { target-path = "/usb0-vbus"; __overlay__ { gpio; status = "okay"; }; }; fragment@3 { target = <&r_pio>; __overlay__ { usb0_vbus_pin: usb0_vbus_pin { pins = "PR2"; function = "gpio_out"; output-high; }; }; }; };  
    This allows the standard GPIO controls using sysfs in /sys/class/gpio.
    I'm using the kernel Linux nanopineo2 6.6.75-current-sunxi64 on Armbian 25.11.2 bookworm (32 bit userland).
     
    Hope this helps everybody trying to achive the same 😉
     
×
×
  • Create New...

Important Information

Terms of Use - Privacy Policy - Guidelines