Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

phy: tegra: xusb: Support USB role default mode

Support role-switch-default-mode property when usb-role-switch is
enabled.

Signed-off-by: Haotien Hsu <haotienh@nvidia.com>
Link: https://lore.kernel.org/r/20221216042146.99307-1-haotienh@nvidia.com
Signed-off-by: Vinod Koul <vkoul@kernel.org>

authored by

Haotien Hsu and committed by
Vinod Koul
3cde1ef6 724dbe3c

+17
+17
drivers/phy/tegra/xusb.c
··· 718 718 return err; 719 719 } 720 720 721 + static void tegra_xusb_parse_usb_role_default_mode(struct tegra_xusb_port *port) 722 + { 723 + enum usb_role role = USB_ROLE_NONE; 724 + enum usb_dr_mode mode = usb_get_role_switch_default_mode(&port->dev); 725 + 726 + if (mode == USB_DR_MODE_HOST) 727 + role = USB_ROLE_HOST; 728 + else if (mode == USB_DR_MODE_PERIPHERAL) 729 + role = USB_ROLE_DEVICE; 730 + 731 + if (role != USB_ROLE_NONE) { 732 + usb_role_switch_set_role(port->usb_role_sw, role); 733 + dev_dbg(&port->dev, "usb role default mode is %s", modes[mode]); 734 + } 735 + } 736 + 721 737 static int tegra_xusb_usb2_port_parse_dt(struct tegra_xusb_usb2_port *usb2) 722 738 { 723 739 struct tegra_xusb_port *port = &usb2->base; ··· 763 747 err = tegra_xusb_setup_usb_role_switch(port); 764 748 if (err < 0) 765 749 return err; 750 + tegra_xusb_parse_usb_role_default_mode(port); 766 751 } else { 767 752 dev_err(&port->dev, "usb-role-switch not found for %s mode", 768 753 modes[usb2->mode]);