Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 280854
b: refs/heads/master
c: dd39c35
h: refs/heads/master
v: v3
  • Loading branch information
Marc Kleine-Budde authored and Felipe Balbi committed Dec 12, 2011
1 parent 595f7a9 commit 916a93b
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 4 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: 7bb4fdc602c6cc763185d88f58ed75c84eb32158
refs/heads/master: dd39c358dff41394f20b623fc68be857b6d702ad
16 changes: 14 additions & 2 deletions trunk/drivers/usb/gadget/ci13xxx_udc.c
Original file line number Diff line number Diff line change
Expand Up @@ -182,6 +182,16 @@ static inline int hw_ep_bit(int num, int dir)
return num + (dir ? 16 : 0);
}

static int ep_to_bit(int n)
{
int fill = 16 - hw_ep_max / 2;

if (n >= hw_ep_max / 2)
n += fill;

return n;
}

/**
* hw_aread: reads from register bitfield
* @addr: address relative to bus map
Expand Down Expand Up @@ -440,12 +450,13 @@ static int hw_ep_get_halt(int num, int dir)
/**
* hw_test_and_clear_setup_status: test & clear setup status (execute without
* interruption)
* @n: bit number (endpoint)
* @n: endpoint number
*
* This function returns setup status
*/
static int hw_test_and_clear_setup_status(int n)
{
n = ep_to_bit(n);
return hw_ctest_and_clear(CAP_ENDPTSETUPSTAT, BIT(n));
}

Expand Down Expand Up @@ -641,12 +652,13 @@ static int hw_register_write(u16 addr, u32 data)
/**
* hw_test_and_clear_complete: test & clear complete status (execute without
* interruption)
* @n: bit number (endpoint)
* @n: endpoint number
*
* This function returns complete status
*/
static int hw_test_and_clear_complete(int n)
{
n = ep_to_bit(n);
return hw_ctest_and_clear(CAP_ENDPTCOMPLETE, BIT(n));
}

Expand Down
2 changes: 1 addition & 1 deletion trunk/drivers/usb/gadget/ci13xxx_udc.h
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ struct ci13xxx {
struct ci13xxx_ep ci13xxx_ep[ENDPT_MAX]; /* extended endpts */
u32 ep0_dir; /* ep0 direction */
#define ep0out ci13xxx_ep[0]
#define ep0in ci13xxx_ep[16]
#define ep0in ci13xxx_ep[hw_ep_max / 2]
u8 remote_wakeup; /* Is remote wakeup feature
enabled by the host? */
u8 suspended; /* suspended by the host */
Expand Down

0 comments on commit 916a93b

Please sign in to comment.