diff options
author | Michael Grzeschik <m.grzeschik@pengutronix.de> | 2012-09-12 07:58:01 -0400 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2012-09-12 13:58:38 -0400 |
commit | c0a48e6c75f2ac190d812bea5fc339696e434c2e (patch) | |
tree | 3df00cb5663d7fa3a38ba1f334fb82131814783d /drivers/usb | |
parent | 7f67c38bdcb6d8bce02e10521fbf1618b586319f (diff) |
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: Michael Grzeschik <m.grzeschik@pengutronix.de>
Acked-by: Felipe Balbi <balbi@ti.com>
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
Signed-off-by: Alexander Shishkin <alexander.shishkin@linux.intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/usb')
-rw-r--r-- | drivers/usb/chipidea/udc.c | 21 |
1 files changed, 17 insertions, 4 deletions
diff --git a/drivers/usb/chipidea/udc.c b/drivers/usb/chipidea/udc.c index 7801a3f8be90..32ee8701e199 100644 --- a/drivers/usb/chipidea/udc.c +++ b/drivers/usb/chipidea/udc.c | |||
@@ -78,8 +78,7 @@ static inline int ep_to_bit(struct ci13xxx *ci, int n) | |||
78 | } | 78 | } |
79 | 79 | ||
80 | /** | 80 | /** |
81 | * hw_device_state: enables/disables interrupts & starts/stops device (execute | 81 | * hw_device_state: enables/disables interrupts (execute without interruption) |
82 | * without interruption) | ||
83 | * @dma: 0 => disable, !0 => enable and set dma engine | 82 | * @dma: 0 => disable, !0 => enable and set dma engine |
84 | * | 83 | * |
85 | * This function returns an error code | 84 | * This function returns an error code |
@@ -91,9 +90,7 @@ static int hw_device_state(struct ci13xxx *ci, u32 dma) | |||
91 | /* interrupt, error, port change, reset, sleep/suspend */ | 90 | /* interrupt, error, port change, reset, sleep/suspend */ |
92 | hw_write(ci, OP_USBINTR, ~0, | 91 | hw_write(ci, OP_USBINTR, ~0, |
93 | USBi_UI|USBi_UEI|USBi_PCI|USBi_URI|USBi_SLI); | 92 | USBi_UI|USBi_UEI|USBi_PCI|USBi_URI|USBi_SLI); |
94 | hw_write(ci, OP_USBCMD, USBCMD_RS, USBCMD_RS); | ||
95 | } else { | 93 | } else { |
96 | hw_write(ci, OP_USBCMD, USBCMD_RS, 0); | ||
97 | hw_write(ci, OP_USBINTR, ~0, 0); | 94 | hw_write(ci, OP_USBINTR, ~0, 0); |
98 | } | 95 | } |
99 | return 0; | 96 | return 0; |
@@ -1420,6 +1417,21 @@ static int ci13xxx_vbus_draw(struct usb_gadget *_gadget, unsigned mA) | |||
1420 | return -ENOTSUPP; | 1417 | return -ENOTSUPP; |
1421 | } | 1418 | } |
1422 | 1419 | ||
1420 | /* Change Data+ pullup status | ||
1421 | * this func is used by usb_gadget_connect/disconnet | ||
1422 | */ | ||
1423 | static int ci13xxx_pullup(struct usb_gadget *_gadget, int is_on) | ||
1424 | { | ||
1425 | struct ci13xxx *ci = container_of(_gadget, struct ci13xxx, gadget); | ||
1426 | |||
1427 | if (is_on) | ||
1428 | hw_write(ci, OP_USBCMD, USBCMD_RS, USBCMD_RS); | ||
1429 | else | ||
1430 | hw_write(ci, OP_USBCMD, USBCMD_RS, 0); | ||
1431 | |||
1432 | return 0; | ||
1433 | } | ||
1434 | |||
1423 | static int ci13xxx_start(struct usb_gadget *gadget, | 1435 | static int ci13xxx_start(struct usb_gadget *gadget, |
1424 | struct usb_gadget_driver *driver); | 1436 | struct usb_gadget_driver *driver); |
1425 | static int ci13xxx_stop(struct usb_gadget *gadget, | 1437 | static int ci13xxx_stop(struct usb_gadget *gadget, |
@@ -1432,6 +1444,7 @@ static int ci13xxx_stop(struct usb_gadget *gadget, | |||
1432 | static const struct usb_gadget_ops usb_gadget_ops = { | 1444 | static const struct usb_gadget_ops usb_gadget_ops = { |
1433 | .vbus_session = ci13xxx_vbus_session, | 1445 | .vbus_session = ci13xxx_vbus_session, |
1434 | .wakeup = ci13xxx_wakeup, | 1446 | .wakeup = ci13xxx_wakeup, |
1447 | .pullup = ci13xxx_pullup, | ||
1435 | .vbus_draw = ci13xxx_vbus_draw, | 1448 | .vbus_draw = ci13xxx_vbus_draw, |
1436 | .udc_start = ci13xxx_start, | 1449 | .udc_start = ci13xxx_start, |
1437 | .udc_stop = ci13xxx_stop, | 1450 | .udc_stop = ci13xxx_stop, |