Skip to content

Commit

Permalink
usb: dwc3: Hack to phy_power_on() additional PHYs
Browse files Browse the repository at this point in the history
Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
  • Loading branch information
andersson committed May 13, 2022
1 parent d217b65 commit 97752ef
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions drivers/usb/dwc3/core.c
Original file line number Diff line number Diff line change
Expand Up @@ -716,6 +716,9 @@ static int dwc3_phy_setup(struct dwc3 *dwc)
reg &= ~DWC3_GUSB3PIPECTL_DEPOCHANGE;

dwc3_writel(dwc->regs, DWC3_GUSB3PIPECTL(0), reg);
dwc3_writel(dwc->regs, DWC3_GUSB3PIPECTL(1), reg);
dwc3_writel(dwc->regs, DWC3_GUSB3PIPECTL(2), reg);
dwc3_writel(dwc->regs, DWC3_GUSB3PIPECTL(3), reg);

reg = dwc3_readl(dwc->regs, DWC3_GUSB2PHYCFG(0));

Expand Down Expand Up @@ -787,6 +790,9 @@ static int dwc3_phy_setup(struct dwc3 *dwc)
reg &= ~DWC3_GUSB2PHYCFG_U2_FREECLK_EXISTS;

dwc3_writel(dwc->regs, DWC3_GUSB2PHYCFG(0), reg);
dwc3_writel(dwc->regs, DWC3_GUSB2PHYCFG(1), reg);
dwc3_writel(dwc->regs, DWC3_GUSB2PHYCFG(2), reg);
dwc3_writel(dwc->regs, DWC3_GUSB2PHYCFG(3), reg);

return 0;
}
Expand Down Expand Up @@ -1254,7 +1260,9 @@ static int dwc3_core_get_phy(struct dwc3 *dwc)
{
struct device *dev = dwc->dev;
struct device_node *node = dev->of_node;
struct phy *phy;
int ret;
int i;

if (node) {
dwc->usb2_phy = devm_usb_get_phy_by_phandle(dev, "usb-phy", 0);
Expand Down Expand Up @@ -1302,6 +1310,17 @@ static int dwc3_core_get_phy(struct dwc3 *dwc)
}
}

for (i = 2; i < 100; i++) {
phy = devm_of_phy_get_by_index(dev, dev->of_node, i);
if (IS_ERR(phy))
continue;

printk(KERN_ERR "%s() powering up %d\n", __func__, i);
phy_set_mode(phy, PHY_MODE_USB_HOST);
phy_init(phy);
phy_power_on(phy);
}

return 0;
}

Expand Down

0 comments on commit 97752ef

Please sign in to comment.