mirror of
https://git.yoctoproject.org/meta-raspberrypi
synced 2026-10-21 05:38:11 +00:00
rpi-config: make DWC2 USB modes mutually exclusive
ENABLE_DWC2_HOST was not checked against the other DWC2 modes, so enabling it with ENABLE_DWC2_PERIPHERAL or ENABLE_DWC2_OTG resulted in conflicting dr_mode overlays in config.txt. Enabling both PERIPHERAL and OTG resulted in no overlay at all. Fail the build when more than one mode is enabled. Fixes #1590 Signed-off-by: Andrei Gherzan <andrei@gherzan.com>
This commit is contained in:
1 parent
3434e412ba
commit
0e32644279
1 file changed
+7
-10
@@ -247,20 +247,17 @@ do_deploy() {
|
||||
echo "hdmi_drive=1" >> $CONFIG
|
||||
fi
|
||||
|
||||
# DWC2 USB peripheral support
|
||||
if ([ "${ENABLE_DWC2_PERIPHERAL}" = "1" ] && [ "${ENABLE_DWC2_OTG}" != "1" ]); then
|
||||
# DWC2 USB support (peripheral, host or OTG - mutually exclusive)
|
||||
if [ "${@sum(d.getVar(v) == '1' for v in ['ENABLE_DWC2_PERIPHERAL', 'ENABLE_DWC2_HOST', 'ENABLE_DWC2_OTG'])}" -gt 1 ]; then
|
||||
bbfatal "Only one of ENABLE_DWC2_PERIPHERAL, ENABLE_DWC2_HOST and ENABLE_DWC2_OTG can be enabled"
|
||||
fi
|
||||
if [ "${ENABLE_DWC2_PERIPHERAL}" = "1" ]; then
|
||||
echo "# Enable USB peripheral mode" >> $CONFIG
|
||||
echo "dtoverlay=dwc2,dr_mode=peripheral" >> $CONFIG
|
||||
fi
|
||||
|
||||
# DWC2 USB host mode support
|
||||
if [ "${ENABLE_DWC2_HOST}" = "1" ]; then
|
||||
elif [ "${ENABLE_DWC2_HOST}" = "1" ]; then
|
||||
echo "# Enable USB host mode" >> $CONFIG
|
||||
echo "dtoverlay=dwc2,dr_mode=host" >> $CONFIG
|
||||
fi
|
||||
|
||||
# DWC2 USB OTG support
|
||||
if ([ "${ENABLE_DWC2_OTG}" = "1" ] && [ "${ENABLE_DWC2_PERIPHERAL}" != "1" ]); then
|
||||
elif [ "${ENABLE_DWC2_OTG}" = "1" ]; then
|
||||
echo "# Enable USB OTG mode" >> $CONFIG
|
||||
echo "dtoverlay=dwc2,dr_mode=otg" >> $CONFIG
|
||||
fi
|
||||
|
||||
Reference in new issue
Block a user