usb: dwc3: core: add external vBus supply support for ulpi phy
Subsystems (2)
PATCH 1/1 usb: dwc3: core: add external vBus supply support for ulpi phy
[ Piyush: Ported from Linux kernel commit
b84ba26c922a ("usb: dwc3: core: add external vBus
supply support for ulpi phy") ]Some ULPI USB PHY does not support internal VBUS supply, to drive the CPEN pin, which requires the configuration of the ULPI DRVVBUSEXTERNAL bit of OTG_CTRL register.
Added 'snps,ulpi-ext-vbus-drv' a DT property to configure the USB2 PHY to drive VBUS with an external supply, by setting the USB2 PHY ULPIEXTVBUSDRV bit[:17] of the GUSB2PHYCFG register to drive VBUS with an external supply.
--- drivers/usb/dwc3/core.c | 13 +++++++++++++ drivers/usb/dwc3/core.h | 4 ++++ include/dwc3-uboot.h | 1 + 3 files changed, 18 insertions(+)
drivers/usb/dwc3/core.c +13 -0
@@ -529,6 +529,16 @@ static void dwc3_phy_setup(struct dwc3 *dwc)if (dwc->dis_u2_freeclk_exists_quirk) reg &= ~DWC3_GUSB2PHYCFG_U2_FREECLK_EXISTS ; +/* +* Some ULPI USB PHY does not support internal VBUS supply, to drive +* the CPEN pin requires the configuration of the ULPI DRVVBUSEXTERNAL +* bit of OTG_CTRL register. Controller configures the USB2 PHY +* ULPIEXTVBUSDRV bit[17] of the GUSB2PHYCFG register to drive vBus +* with an external supply. +*/ +if (dwc->ulpi_ext_vbus_drv) + reg |=DWC3_GUSB2PHYCFG_ULPIEXTVBUSDRV ; +dwc3_writel (dwc->regs,DWC3_GUSB2PHYCFG (0 ), reg);mdelay (100 );
@@ -888,6 +898,7 @@ int dwc3_uboot_init(struct dwc3_device *dwc3_dev) dwc->dis_tx_ipgap_linecheck_quirk = dwc3_dev->dis_tx_ipgap_linecheck_quirk; dwc->dis_enblslpm_quirk = dwc3_dev->dis_enblslpm_quirk; dwc->dis_u2_freeclk_exists_quirk = dwc3_dev->dis_u2_freeclk_exists_quirk; + dwc->ulpi_ext_vbus_drv = dwc3_dev->ulpi_ext_vbus_drv; dwc->tx_de_emphasis_quirk = dwc3_dev->tx_de_emphasis_quirk;if (dwc3_dev->tx_de_emphasis)
@@ -1107,6 +1118,8 @@ void dwc3_of_parse(struct dwc3 *dwc) "snps,dis-u2-freeclk-exists-quirk"); dwc->tx_de_emphasis_quirk =dev_read_bool (dev,"snps,tx_de_emphasis_quirk" ); + dwc->ulpi_ext_vbus_drv =dev_read_bool (dev, +"snps,ulpi-ext-vbus-drv" ); tmp =dev_read_u8_array_ptr (dev,"snps,tx_de_emphasis" ,1 );if (tmp) tx_de_emphasis = *tmp;
drivers/usb/dwc3/core.h +4 -0
@@ -184,6 +184,7 @@/* Global USB2 PHY Configuration Register */ #define DWC3_GUSB2PHYCFG_PHYSOFTRST (1 << 31)#define DWC3_GUSB2PHYCFG_U2_FREECLK_EXISTS (1 << 30) +#define DWC3_GUSB2PHYCFG_ULPIEXTVBUSDRV BIT(17)#define DWC3_GUSB2PHYCFG_SUSPHY (1 << 6)#define DWC3_GUSB2PHYCFG_ENBLSLPM (1 << 8)#define DWC3_GUSB2PHYCFG_PHYIF (n) ((n) << 3)
@@ -742,6 +743,8 @@ struct dwc3_scratchpad_array {* 1 - -3.5dB de-emphasis * 2 - No de-emphasis * 3 - Reserved +* @ulpi_ext_vbus_drv: Set to confiure the upli chip to drives CPEN pin +* VBUS with an external supply. * @index: index of _this_ controller * @list: to maintain the list of dwc3 controllers */
@@ -876,6 +879,7 @@ struct dwc3 { unsigned tx_de_emphasis_quirk:1; unsigned tx_de_emphasis:2; + unsigned ulpi_ext_vbus_drv:1;int index;struct list_head list; };
include/dwc3-uboot.h +1 -0
@@ -39,6 +39,7 @@ struct dwc3_device {unsigned dis_u2_freeclk_exists_quirk;unsigned tx_de_emphasis_quirk;unsigned tx_de_emphasis; +unsigned ulpi_ext_vbus_drv;int index; };
Signature · 1 line
2.17.1
Quoted 8 lines · Venkatesh Yadav Abbarapu
[ Piyush: Ported from Linux kernel commit
b84ba26c922a ("usb: dwc3: core: add external vBus supply support for ulpi phy") ]Some ULPI USB PHY does not support internal VBUS supply, to drive the CPEN pin, which requires the configuration of the ULPI DRVVBUSEXTERNAL bit of
OTG_CTRLregister.
Quoted 5 lines
Added 'snps,ulpi-ext-vbus-drv' a DT property to configure the USB2 PHY to drive VBUS with an external supply, by setting the USB2 PHY ULPIEXTVBUSDRV bit[:17] of the GUSB2PHYCFG register to drive VBUS with an external supply.
Signed-off-by Venkatesh Yadav Abbarapu <[email protected]>
Please sync the DWC3 driver with Linux first.