usb: dwc2: Pull Ext VBUS macro from dwc_otg_core_init()
Introduce a boolean flag in the dwc2 controller private data and set it according to the macro (for now) instead of having this macro directly in the dwc_otg_core_init(). This will let us configure the flag from DT or such later on, if needed. Signed-off-by: Marek Vasut <marex@denx.de> Cc: Stefan Roese <sr@denx.de> Cc: Dinh Nguyen <dinguyen@kernel.org>
This commit is contained in:
parent
559019894b
commit
618da5630b
|
|
@ -39,6 +39,7 @@ struct dwc2_priv {
|
||||||
u8 out_data_toggle[MAX_DEVICE][MAX_ENDPOINT];
|
u8 out_data_toggle[MAX_DEVICE][MAX_ENDPOINT];
|
||||||
struct dwc2_core_regs *regs;
|
struct dwc2_core_regs *regs;
|
||||||
int root_hub_devnum;
|
int root_hub_devnum;
|
||||||
|
bool ext_vbus;
|
||||||
};
|
};
|
||||||
|
|
||||||
#ifndef CONFIG_DM_USB
|
#ifndef CONFIG_DM_USB
|
||||||
|
|
@ -263,13 +264,13 @@ static void dwc_otg_core_init(struct dwc2_priv *priv)
|
||||||
usbcfg = readl(®s->gusbcfg);
|
usbcfg = readl(®s->gusbcfg);
|
||||||
|
|
||||||
/* Program the ULPI External VBUS bit if needed */
|
/* Program the ULPI External VBUS bit if needed */
|
||||||
#ifdef CONFIG_DWC2_PHY_ULPI_EXT_VBUS
|
if (priv->ext_vbus) {
|
||||||
usbcfg |= (DWC2_GUSBCFG_ULPI_EXT_VBUS_DRV |
|
usbcfg |= (DWC2_GUSBCFG_ULPI_EXT_VBUS_DRV |
|
||||||
DWC2_GUSBCFG_ULPI_INT_VBUS_INDICATOR |
|
DWC2_GUSBCFG_ULPI_INT_VBUS_INDICATOR |
|
||||||
DWC2_GUSBCFG_INDICATOR_PASSTHROUGH);
|
DWC2_GUSBCFG_INDICATOR_PASSTHROUGH);
|
||||||
#else
|
} else {
|
||||||
usbcfg &= ~DWC2_GUSBCFG_ULPI_EXT_VBUS_DRV;
|
usbcfg &= ~DWC2_GUSBCFG_ULPI_EXT_VBUS_DRV;
|
||||||
#endif
|
}
|
||||||
|
|
||||||
/* Set external TS Dline pulsing */
|
/* Set external TS Dline pulsing */
|
||||||
#ifdef CONFIG_DWC2_TS_DLINE
|
#ifdef CONFIG_DWC2_TS_DLINE
|
||||||
|
|
@ -1057,6 +1058,12 @@ static int dwc2_init_common(struct dwc2_priv *priv)
|
||||||
return -ENODEV;
|
return -ENODEV;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef CONFIG_DWC2_PHY_ULPI_EXT_VBUS
|
||||||
|
priv->ext_vbus = 1;
|
||||||
|
#else
|
||||||
|
priv->ext_vbus = 0;
|
||||||
|
#endif
|
||||||
|
|
||||||
dwc_otg_core_init(priv);
|
dwc_otg_core_init(priv);
|
||||||
dwc_otg_core_host_init(regs);
|
dwc_otg_core_host_init(regs);
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue