Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 303906
b: refs/heads/master
c: ef15e54
h: refs/heads/master
v: v3
  • Loading branch information
Alexander Shishkin authored and Greg Kroah-Hartman committed May 11, 2012
1 parent c13b9ee commit 0605bc7
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 11 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 405b84487438efa1360740a70ec3e3cd1a90bd62
refs/heads/master: ef15e5490edc7edf808d3477ab32e0e320792f65
22 changes: 12 additions & 10 deletions trunk/drivers/usb/gadget/ci13xxx_udc.c
Original file line number Diff line number Diff line change
Expand Up @@ -722,14 +722,13 @@ static int hw_test_and_set_setup_guard(struct ci13xxx *udc)
* hw_usb_set_address: configures USB address (execute without interruption)
* @value: new USB address
*
* This function returns an error code
* This function explicitly sets the address, without the "USBADRA" (advance)
* feature, which is not supported by older versions of the controller.
*/
static int hw_usb_set_address(struct ci13xxx *udc, u8 value)
static void hw_usb_set_address(struct ci13xxx *udc, u8 value)
{
/* advance */
hw_write(udc, OP_DEVICEADDR, DEVICEADDR_USBADR | DEVICEADDR_USBADRA,
value << ffs_nr(DEVICEADDR_USBADR) | DEVICEADDR_USBADRA);
return 0;
hw_write(udc, OP_DEVICEADDR, DEVICEADDR_USBADR,
value << ffs_nr(DEVICEADDR_USBADR));
}

/**
Expand Down Expand Up @@ -1803,6 +1802,11 @@ isr_setup_status_complete(struct usb_ep *ep, struct usb_request *req)
struct ci13xxx *udc = req->context;
unsigned long flags;

if (udc->setaddr) {
hw_usb_set_address(udc, udc->address);
udc->setaddr = false;
}

spin_lock_irqsave(&udc->lock, flags);
if (udc->test_mode)
hw_port_test_set(udc, udc->test_mode);
Expand Down Expand Up @@ -1990,10 +1994,8 @@ __acquires(udc->lock)
if (le16_to_cpu(req.wLength) != 0 ||
le16_to_cpu(req.wIndex) != 0)
break;
err = hw_usb_set_address(udc,
(u8)le16_to_cpu(req.wValue));
if (err)
break;
udc->address = (u8)le16_to_cpu(req.wValue);
udc->setaddr = true;
err = isr_setup_status_phase(udc);
break;
case USB_REQ_SET_FEATURE:
Expand Down
2 changes: 2 additions & 0 deletions trunk/drivers/usb/gadget/ci13xxx_udc.h
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,8 @@ struct ci13xxx {
struct ci13xxx_ep *ep0out, *ep0in;
unsigned hw_ep_max; /* number of hw endpoints */

bool setaddr;
u8 address;
u8 remote_wakeup; /* Is remote wakeup feature
enabled by the host? */
u8 suspended; /* suspended by the host */
Expand Down

0 comments on commit 0605bc7

Please sign in to comment.