aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/usb/renesas_usbhs
diff options
context:
space:
mode:
authorShimoda, Yoshihiro <yoshihiro.shimoda.uh@renesas.com>2012-03-16 00:10:15 -0400
committerFelipe Balbi <balbi@ti.com>2012-05-04 08:53:05 -0400
commitcac402dd0832e9c63929eff70d6766cd8623e5fc (patch)
tree7238b823c55e9defe7ff725ca58577b195f4f789 /drivers/usb/renesas_usbhs
parentf99987bb261ed80f645ed0acd13732922ca10138 (diff)
usb: renesas_usbhs: gadget: add support for set_selfpowered
The previous code always set to USB_DEVICE_SELF_POWERED in GET_STATUS. So, this patch adds set_selfpowered(). Signed-off-by: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com> Signed-off-by: Felipe Balbi <balbi@ti.com>
Diffstat (limited to 'drivers/usb/renesas_usbhs')
-rw-r--r--drivers/usb/renesas_usbhs/mod_gadget.c19
1 files changed, 18 insertions, 1 deletions
diff --git a/drivers/usb/renesas_usbhs/mod_gadget.c b/drivers/usb/renesas_usbhs/mod_gadget.c
index 00bd2a5e0362..28478ce26c34 100644
--- a/drivers/usb/renesas_usbhs/mod_gadget.c
+++ b/drivers/usb/renesas_usbhs/mod_gadget.c
@@ -55,6 +55,7 @@ struct usbhsg_gpriv {
55#define USBHSG_STATUS_STARTED (1 << 0) 55#define USBHSG_STATUS_STARTED (1 << 0)
56#define USBHSG_STATUS_REGISTERD (1 << 1) 56#define USBHSG_STATUS_REGISTERD (1 << 1)
57#define USBHSG_STATUS_WEDGE (1 << 2) 57#define USBHSG_STATUS_WEDGE (1 << 2)
58#define USBHSG_STATUS_SELF_POWERED (1 << 3)
58}; 59};
59 60
60struct usbhsg_recip_handle { 61struct usbhsg_recip_handle {
@@ -333,7 +334,10 @@ static int usbhsg_recip_handler_std_get_device(struct usbhs_priv *priv,
333 struct usb_ctrlrequest *ctrl) 334 struct usb_ctrlrequest *ctrl)
334{ 335{
335 struct usbhsg_gpriv *gpriv = usbhsg_uep_to_gpriv(uep); 336 struct usbhsg_gpriv *gpriv = usbhsg_uep_to_gpriv(uep);
336 unsigned short status = 1 << USB_DEVICE_SELF_POWERED; 337 unsigned short status = 0;
338
339 if (usbhsg_status_has(gpriv, USBHSG_STATUS_SELF_POWERED))
340 status = 1 << USB_DEVICE_SELF_POWERED;
337 341
338 __usbhsg_recip_send_status(gpriv, status); 342 __usbhsg_recip_send_status(gpriv, status);
339 343
@@ -879,8 +883,21 @@ static int usbhsg_get_frame(struct usb_gadget *gadget)
879 return usbhs_frame_get_num(priv); 883 return usbhs_frame_get_num(priv);
880} 884}
881 885
886static int usbhsg_set_selfpowered(struct usb_gadget *gadget, int is_self)
887{
888 struct usbhsg_gpriv *gpriv = usbhsg_gadget_to_gpriv(gadget);
889
890 if (is_self)
891 usbhsg_status_set(gpriv, USBHSG_STATUS_SELF_POWERED);
892 else
893 usbhsg_status_clr(gpriv, USBHSG_STATUS_SELF_POWERED);
894
895 return 0;
896}
897
882static struct usb_gadget_ops usbhsg_gadget_ops = { 898static struct usb_gadget_ops usbhsg_gadget_ops = {
883 .get_frame = usbhsg_get_frame, 899 .get_frame = usbhsg_get_frame,
900 .set_selfpowered = usbhsg_set_selfpowered,
884 .udc_start = usbhsg_gadget_start, 901 .udc_start = usbhsg_gadget_start,
885 .udc_stop = usbhsg_gadget_stop, 902 .udc_stop = usbhsg_gadget_stop,
886}; 903};