From 6a6468f479a7e816fb656b3e1d8af30c7de837a4 Mon Sep 17 00:00:00 2001 From: Mark Kettenis Date: Tue, 19 Apr 2022 21:06:33 +0200 Subject: usb: xhci-dwc3: Support role switch default role When the device tree indicates support for role switching through the "usb-role-switch" property, take the "role-switch-default-mode" property into account when deciding which role to put the controller into. This makes USB devices work on Apple M1 systems where the device tree may include a "dr_mode" property that is set to "otg", but where we need to put the controller into "host" mode to see devices connected to the type-C ports. Signed-off-by: Mark Kettenis --- include/linux/usb/otg.h | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'include') diff --git a/include/linux/usb/otg.h b/include/linux/usb/otg.h index c19b916..5d0dac9 100644 --- a/include/linux/usb/otg.h +++ b/include/linux/usb/otg.h @@ -28,6 +28,16 @@ enum usb_dr_mode { enum usb_dr_mode usb_get_dr_mode(ofnode node); /** + * usb_get_dr_mode() - Get dual role mode for given device + * @node: ofnode of the given device + * + * The function gets phy interface string from property + * 'role-switch-defaulr-mode', and returns the correspondig enum + * usb_dr_mode + */ +enum usb_dr_mode usb_get_role_switch_default_mode(ofnode node); + +/** * usb_get_maximum_speed() - Get maximum speed for given device * @node: ofnode of the given device * -- cgit v1.1