Commit c0a48e6c authored by Michael Grzeschik's avatar Michael Grzeschik Committed by Greg Kroah-Hartman

usb: chipidea: udc: add pullup fuction, needed by the uvc gadget

Add function to physicaly enable or disable of pullup connection on the USB-D+
line. The uvc gaget will fail, if this function is not implemented.

Cc: stable <stable@vger.kernel.org>
Signed-off-by: default avatarMichael Grzeschik <m.grzeschik@pengutronix.de>
Acked-by: default avatarFelipe Balbi <balbi@ti.com>
Signed-off-by: default avatarMarc Kleine-Budde <mkl@pengutronix.de>
Signed-off-by: default avatarAlexander Shishkin <alexander.shishkin@linux.intel.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 7f67c38b
...@@ -78,8 +78,7 @@ static inline int ep_to_bit(struct ci13xxx *ci, int n) ...@@ -78,8 +78,7 @@ static inline int ep_to_bit(struct ci13xxx *ci, int n)
} }
/** /**
* hw_device_state: enables/disables interrupts & starts/stops device (execute * hw_device_state: enables/disables interrupts (execute without interruption)
* without interruption)
* @dma: 0 => disable, !0 => enable and set dma engine * @dma: 0 => disable, !0 => enable and set dma engine
* *
* This function returns an error code * This function returns an error code
...@@ -91,9 +90,7 @@ static int hw_device_state(struct ci13xxx *ci, u32 dma) ...@@ -91,9 +90,7 @@ static int hw_device_state(struct ci13xxx *ci, u32 dma)
/* interrupt, error, port change, reset, sleep/suspend */ /* interrupt, error, port change, reset, sleep/suspend */
hw_write(ci, OP_USBINTR, ~0, hw_write(ci, OP_USBINTR, ~0,
USBi_UI|USBi_UEI|USBi_PCI|USBi_URI|USBi_SLI); USBi_UI|USBi_UEI|USBi_PCI|USBi_URI|USBi_SLI);
hw_write(ci, OP_USBCMD, USBCMD_RS, USBCMD_RS);
} else { } else {
hw_write(ci, OP_USBCMD, USBCMD_RS, 0);
hw_write(ci, OP_USBINTR, ~0, 0); hw_write(ci, OP_USBINTR, ~0, 0);
} }
return 0; return 0;
...@@ -1420,6 +1417,21 @@ static int ci13xxx_vbus_draw(struct usb_gadget *_gadget, unsigned mA) ...@@ -1420,6 +1417,21 @@ static int ci13xxx_vbus_draw(struct usb_gadget *_gadget, unsigned mA)
return -ENOTSUPP; return -ENOTSUPP;
} }
/* Change Data+ pullup status
* this func is used by usb_gadget_connect/disconnet
*/
static int ci13xxx_pullup(struct usb_gadget *_gadget, int is_on)
{
struct ci13xxx *ci = container_of(_gadget, struct ci13xxx, gadget);
if (is_on)
hw_write(ci, OP_USBCMD, USBCMD_RS, USBCMD_RS);
else
hw_write(ci, OP_USBCMD, USBCMD_RS, 0);
return 0;
}
static int ci13xxx_start(struct usb_gadget *gadget, static int ci13xxx_start(struct usb_gadget *gadget,
struct usb_gadget_driver *driver); struct usb_gadget_driver *driver);
static int ci13xxx_stop(struct usb_gadget *gadget, static int ci13xxx_stop(struct usb_gadget *gadget,
...@@ -1432,6 +1444,7 @@ static int ci13xxx_stop(struct usb_gadget *gadget, ...@@ -1432,6 +1444,7 @@ static int ci13xxx_stop(struct usb_gadget *gadget,
static const struct usb_gadget_ops usb_gadget_ops = { static const struct usb_gadget_ops usb_gadget_ops = {
.vbus_session = ci13xxx_vbus_session, .vbus_session = ci13xxx_vbus_session,
.wakeup = ci13xxx_wakeup, .wakeup = ci13xxx_wakeup,
.pullup = ci13xxx_pullup,
.vbus_draw = ci13xxx_vbus_draw, .vbus_draw = ci13xxx_vbus_draw,
.udc_start = ci13xxx_start, .udc_start = ci13xxx_start,
.udc_stop = ci13xxx_stop, .udc_stop = ci13xxx_stop,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment