I am implementing non-standard dual-role USB support for my SAMA5D27 board, using an external usb-c controller (FUSB302) to determine the required role and then set things up as necessary.
Nearly there and, although it is mostly board-specific, it does need some minor changes to one or more core "arch" files (e.g. sam_udphs.c). These changes need to/must be neutral to 99.9% users of NuttX using SAMA5 processors. I'd been hoping to do this via my board's custom Kconfig but currently the main SAMA5 Kconfig prevents the selection of something I need for this. Although for a good reason (to prevent a board turning on Vbus +5V to a port that is 99.8% of the time used as a device port) there are plenty of guards in the underlying code to #undef the option just in case. Unless someone has a better idea, my proposal is: 1) to have a CONFIG_SAMA5_USB_DRP option in the SAMA5 Kconfig. If set, it will disable the Kconfig "depends on" that prevents the selection of the relevant usb port as a host. Just for SAMA5 - but it could be just for SAM5D2 if preferred to further limit it? 2) The CONFIG_SAMA5_USB_DRP option will be used to modify the #undef guards in the SAMA5 usb code. 3) The same option will be used disable/enable code as required, to allow for dual-role port functionality 4) I could include #warning directives if CONFIG_SAMA5_USB_DRP is set to ensure anyone setting it sits backs and thinks! Does that all seem reasonable? I can post as an issue on GitHub if wanted, for discussion pending a PR (assuming I do actually get this to work as wanted)? Thanks, TimH/TimJTi