mirror of https://gitee.com/openkylin/linux.git
PXA UDC - allow use of inverted GPIO for pullup
Signed-off-by: Ian Molton <spyro@f2s.com>
This commit is contained in:
parent
b3d354b8d8
commit
8fb105f5cc
|
@ -152,9 +152,10 @@ static int is_vbus_present(void)
|
||||||
static void pullup_off(void)
|
static void pullup_off(void)
|
||||||
{
|
{
|
||||||
struct pxa2xx_udc_mach_info *mach = the_controller->mach;
|
struct pxa2xx_udc_mach_info *mach = the_controller->mach;
|
||||||
|
int off_level = mach->gpio_pullup_inverted;
|
||||||
|
|
||||||
if (mach->gpio_pullup)
|
if (mach->gpio_pullup)
|
||||||
gpio_set_value(mach->gpio_pullup, 0);
|
gpio_set_value(mach->gpio_pullup, off_level);
|
||||||
else if (mach->udc_command)
|
else if (mach->udc_command)
|
||||||
mach->udc_command(PXA2XX_UDC_CMD_DISCONNECT);
|
mach->udc_command(PXA2XX_UDC_CMD_DISCONNECT);
|
||||||
}
|
}
|
||||||
|
@ -162,9 +163,10 @@ static void pullup_off(void)
|
||||||
static void pullup_on(void)
|
static void pullup_on(void)
|
||||||
{
|
{
|
||||||
struct pxa2xx_udc_mach_info *mach = the_controller->mach;
|
struct pxa2xx_udc_mach_info *mach = the_controller->mach;
|
||||||
|
int on_level = !mach->gpio_pullup_inverted;
|
||||||
|
|
||||||
if (mach->gpio_pullup)
|
if (mach->gpio_pullup)
|
||||||
gpio_set_value(mach->gpio_pullup, 1);
|
gpio_set_value(mach->gpio_pullup, on_level);
|
||||||
else if (mach->udc_command)
|
else if (mach->udc_command)
|
||||||
mach->udc_command(PXA2XX_UDC_CMD_CONNECT);
|
mach->udc_command(PXA2XX_UDC_CMD_CONNECT);
|
||||||
}
|
}
|
||||||
|
|
|
@ -23,6 +23,7 @@ struct pxa2xx_udc_mach_info {
|
||||||
*/
|
*/
|
||||||
bool gpio_vbus_inverted;
|
bool gpio_vbus_inverted;
|
||||||
u16 gpio_vbus; /* high == vbus present */
|
u16 gpio_vbus; /* high == vbus present */
|
||||||
|
bool gpio_pullup_inverted;
|
||||||
u16 gpio_pullup; /* high == pullup activated */
|
u16 gpio_pullup; /* high == pullup activated */
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue