This might help, https://github.com/dumtux/agpio-switch-mt7688 I wrote this for enabling all 5 ethernet ports for Ethernet switch. But I think you can modify this for disabling all of them to use digital I/O, by modifying AGPIO_CFG.