mirror of
https://github.com/Stichting-MINIX-Research-Foundation/u-boot.git
synced 2025-09-09 20:18:54 -04:00
usb: ulpi: add indicator configuration function
Allows for easy configuration of the VBUS indicator related ULPI config bits. Also move the external indicator setup from ulpi_set_vbus() to the new function. Signed-off-by: Lucas Stach <dev@lynxeye.de> Acked-by: Igor Grinberg <grinberg@compulab.co.il>
This commit is contained in:
parent
7a46b2c7f2
commit
141288b3a3
@ -106,20 +106,44 @@ int ulpi_select_transceiver(struct ulpi_viewport *ulpi_vp, unsigned speed)
|
|||||||
return ulpi_write(ulpi_vp, &ulpi->function_ctrl, val);
|
return ulpi_write(ulpi_vp, &ulpi->function_ctrl, val);
|
||||||
}
|
}
|
||||||
|
|
||||||
int ulpi_set_vbus(struct ulpi_viewport *ulpi_vp, int on, int ext_power,
|
int ulpi_set_vbus(struct ulpi_viewport *ulpi_vp, int on, int ext_power)
|
||||||
int ext_ind)
|
|
||||||
{
|
{
|
||||||
u32 flags = ULPI_OTG_DRVVBUS;
|
u32 flags = ULPI_OTG_DRVVBUS;
|
||||||
u8 *reg = on ? &ulpi->otg_ctrl_set : &ulpi->otg_ctrl_clear;
|
u8 *reg = on ? &ulpi->otg_ctrl_set : &ulpi->otg_ctrl_clear;
|
||||||
|
|
||||||
if (ext_power)
|
if (ext_power)
|
||||||
flags |= ULPI_OTG_DRVVBUS_EXT;
|
flags |= ULPI_OTG_DRVVBUS_EXT;
|
||||||
if (ext_ind)
|
|
||||||
flags |= ULPI_OTG_EXTVBUSIND;
|
|
||||||
|
|
||||||
return ulpi_write(ulpi_vp, reg, flags);
|
return ulpi_write(ulpi_vp, reg, flags);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int ulpi_set_vbus_indicator(struct ulpi_viewport *ulpi_vp, int external,
|
||||||
|
int passthu, int complement)
|
||||||
|
{
|
||||||
|
u32 flags, val;
|
||||||
|
u8 *reg;
|
||||||
|
|
||||||
|
reg = external ? &ulpi->otg_ctrl_set : &ulpi->otg_ctrl_clear;
|
||||||
|
val = ulpi_write(ulpi_vp, reg, ULPI_OTG_EXTVBUSIND);
|
||||||
|
if (val)
|
||||||
|
return val;
|
||||||
|
|
||||||
|
flags = passthu ? ULPI_IFACE_PASSTHRU : 0;
|
||||||
|
flags |= complement ? ULPI_IFACE_EXTVBUS_COMPLEMENT : 0;
|
||||||
|
|
||||||
|
val = ulpi_read(ulpi_vp, &ulpi->iface_ctrl);
|
||||||
|
if (val == ULPI_ERROR)
|
||||||
|
return val;
|
||||||
|
|
||||||
|
val = val & ~(ULPI_IFACE_PASSTHRU & ULPI_IFACE_EXTVBUS_COMPLEMENT);
|
||||||
|
val |= flags;
|
||||||
|
val = ulpi_write(ulpi_vp, &ulpi->iface_ctrl, val);
|
||||||
|
if (val)
|
||||||
|
return val;
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
int ulpi_set_pd(struct ulpi_viewport *ulpi_vp, int enable)
|
int ulpi_set_pd(struct ulpi_viewport *ulpi_vp, int enable)
|
||||||
{
|
{
|
||||||
u32 val = ULPI_OTG_DP_PULLDOWN | ULPI_OTG_DM_PULLDOWN;
|
u32 val = ULPI_OTG_DP_PULLDOWN | ULPI_OTG_DM_PULLDOWN;
|
||||||
|
@ -61,8 +61,17 @@ int ulpi_select_transceiver(struct ulpi_viewport *ulpi_vp, unsigned speed);
|
|||||||
*
|
*
|
||||||
* returns 0 on success, ULPI_ERROR on failure.
|
* returns 0 on success, ULPI_ERROR on failure.
|
||||||
*/
|
*/
|
||||||
int ulpi_set_vbus(struct ulpi_viewport *ulpi_vp,
|
int ulpi_set_vbus(struct ulpi_viewport *ulpi_vp, int on, int ext_power);
|
||||||
int on, int ext_power, int ext_ind);
|
|
||||||
|
/*
|
||||||
|
* Configure VBUS indicator
|
||||||
|
* @external - external VBUS over-current indicator is used
|
||||||
|
* @passthru - disables ANDing of internal VBUS comparator
|
||||||
|
* with external VBUS input
|
||||||
|
* @complement - inverts the external VBUS input
|
||||||
|
*/
|
||||||
|
int ulpi_set_vbus_indicator(struct ulpi_viewport *ulpi_vp, int external,
|
||||||
|
int passthru, int complement);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Enable/disable pull-down resistors on D+ and D- USB lines.
|
* Enable/disable pull-down resistors on D+ and D- USB lines.
|
||||||
|
Loading…
x
Reference in New Issue
Block a user