diff options
Diffstat (limited to 'meta/recipes-kernel/linux/linux-omap-2.6.29/musb/0016-musb_host-factor-out-musb_ep_-get-set-_qh.patch')
-rw-r--r-- | meta/recipes-kernel/linux/linux-omap-2.6.29/musb/0016-musb_host-factor-out-musb_ep_-get-set-_qh.patch | 146 |
1 files changed, 146 insertions, 0 deletions
diff --git a/meta/recipes-kernel/linux/linux-omap-2.6.29/musb/0016-musb_host-factor-out-musb_ep_-get-set-_qh.patch b/meta/recipes-kernel/linux/linux-omap-2.6.29/musb/0016-musb_host-factor-out-musb_ep_-get-set-_qh.patch new file mode 100644 index 0000000000..a2f54ff47b --- /dev/null +++ b/meta/recipes-kernel/linux/linux-omap-2.6.29/musb/0016-musb_host-factor-out-musb_ep_-get-set-_qh.patch | |||
@@ -0,0 +1,146 @@ | |||
1 | From f9ca8154cf395ec00129f12016697ef610a826ff Mon Sep 17 00:00:00 2001 | ||
2 | From: Sergei Shtylyov <sshtylyov-hkdhdckH98+B+jHODAdFcQ@public.gmane.org> | ||
3 | Date: Fri, 27 Mar 2009 12:55:16 -0700 | ||
4 | Subject: [PATCH] musb_host: factor out musb_ep_{get|set}_qh() | ||
5 | |||
6 | Factor out the often used code to get/set the active 'qh' | ||
7 | pointer for the hardware endpoint. Change the way the case | ||
8 | of a shared FIFO is handled by setting *both* 'in_qh' and | ||
9 | 'out_qh' fields of 'struct musb_hw_ep'. That seems more | ||
10 | consistent and makes getting to the current 'qh' easy when | ||
11 | the code knows the direction beforehand. | ||
12 | |||
13 | While at it, turn some assignments into intializers and | ||
14 | fix declaration style in the vicinity. | ||
15 | |||
16 | Signed-off-by: Sergei Shtylyov <sshtylyov-hkdhdckH98+B+jHODAdFcQ@public.gmane.org> | ||
17 | Signed-off-by: David Brownell <dbrownell-Rn4VEauK+AKRv+LV9MX5uipxlwaOVQ5f@public.gmane.org> | ||
18 | --- | ||
19 | drivers/usb/musb/musb_host.c | 56 ++++++++++++++++------------------------- | ||
20 | 1 files changed, 22 insertions(+), 34 deletions(-) | ||
21 | |||
22 | diff --git a/drivers/usb/musb/musb_host.c b/drivers/usb/musb/musb_host.c | ||
23 | index dc32ce4..bc89079 100644 | ||
24 | --- a/drivers/usb/musb/musb_host.c | ||
25 | +++ b/drivers/usb/musb/musb_host.c | ||
26 | @@ -178,6 +178,19 @@ static inline void cppi_host_txdma_start(struct musb_hw_ep *ep) | ||
27 | musb_writew(ep->regs, MUSB_TXCSR, txcsr); | ||
28 | } | ||
29 | |||
30 | +static void musb_ep_set_qh(struct musb_hw_ep *ep, int is_in, struct musb_qh *qh) | ||
31 | +{ | ||
32 | + if (is_in != 0 || ep->is_shared_fifo) | ||
33 | + ep->in_qh = qh; | ||
34 | + if (is_in == 0 || ep->is_shared_fifo) | ||
35 | + ep->out_qh = qh; | ||
36 | +} | ||
37 | + | ||
38 | +static struct musb_qh *musb_ep_get_qh(struct musb_hw_ep *ep, int is_in) | ||
39 | +{ | ||
40 | + return is_in ? ep->in_qh : ep->out_qh; | ||
41 | +} | ||
42 | + | ||
43 | /* | ||
44 | * Start the URB at the front of an endpoint's queue | ||
45 | * end must be claimed from the caller. | ||
46 | @@ -207,7 +220,6 @@ musb_start_urb(struct musb *musb, int is_in, struct musb_qh *qh) | ||
47 | case USB_ENDPOINT_XFER_CONTROL: | ||
48 | /* control transfers always start with SETUP */ | ||
49 | is_in = 0; | ||
50 | - hw_ep->out_qh = qh; | ||
51 | musb->ep0_stage = MUSB_EP0_START; | ||
52 | buf = urb->setup_packet; | ||
53 | len = 8; | ||
54 | @@ -236,10 +248,7 @@ musb_start_urb(struct musb *musb, int is_in, struct musb_qh *qh) | ||
55 | epnum, buf + offset, len); | ||
56 | |||
57 | /* Configure endpoint */ | ||
58 | - if (is_in || hw_ep->is_shared_fifo) | ||
59 | - hw_ep->in_qh = qh; | ||
60 | - else | ||
61 | - hw_ep->out_qh = qh; | ||
62 | + musb_ep_set_qh(hw_ep, is_in, qh); | ||
63 | musb_ep_program(musb, epnum, urb, !is_in, buf, offset, len); | ||
64 | |||
65 | /* transmit may have more work: start it when it is time */ | ||
66 | @@ -374,11 +383,8 @@ musb_giveback(struct musb_qh *qh, struct urb *urb, int status) | ||
67 | else | ||
68 | ep->tx_reinit = 1; | ||
69 | |||
70 | - /* clobber old pointers to this qh */ | ||
71 | - if (is_in || ep->is_shared_fifo) | ||
72 | - ep->in_qh = NULL; | ||
73 | - else | ||
74 | - ep->out_qh = NULL; | ||
75 | + /* Clobber old pointers to this qh */ | ||
76 | + musb_ep_set_qh(ep, is_in, NULL); | ||
77 | qh->hep->hcpriv = NULL; | ||
78 | |||
79 | switch (qh->type) { | ||
80 | @@ -421,12 +427,7 @@ static void | ||
81 | musb_advance_schedule(struct musb *musb, struct urb *urb, | ||
82 | struct musb_hw_ep *hw_ep, int is_in) | ||
83 | { | ||
84 | - struct musb_qh *qh; | ||
85 | - | ||
86 | - if (is_in || hw_ep->is_shared_fifo) | ||
87 | - qh = hw_ep->in_qh; | ||
88 | - else | ||
89 | - qh = hw_ep->out_qh; | ||
90 | + struct musb_qh *qh = musb_ep_get_qh(hw_ep, is_in); | ||
91 | |||
92 | if (urb->status == -EINPROGRESS) | ||
93 | qh = musb_giveback(qh, urb, 0); | ||
94 | @@ -689,15 +690,8 @@ static void musb_ep_program(struct musb *musb, u8 epnum, | ||
95 | void __iomem *mbase = musb->mregs; | ||
96 | struct musb_hw_ep *hw_ep = musb->endpoints + epnum; | ||
97 | void __iomem *epio = hw_ep->regs; | ||
98 | - struct musb_qh *qh; | ||
99 | - u16 packet_sz; | ||
100 | - | ||
101 | - if (!is_out || hw_ep->is_shared_fifo) | ||
102 | - qh = hw_ep->in_qh; | ||
103 | - else | ||
104 | - qh = hw_ep->out_qh; | ||
105 | - | ||
106 | - packet_sz = qh->maxpacket; | ||
107 | + struct musb_qh *qh = musb_ep_get_qh(hw_ep, !is_out); | ||
108 | + u16 packet_sz = qh->maxpacket; | ||
109 | |||
110 | DBG(3, "%s hw%d urb %p spd%d dev%d ep%d%s " | ||
111 | "h_addr%02x h_port%02x bytes %d\n", | ||
112 | @@ -1114,17 +1108,14 @@ void musb_host_tx(struct musb *musb, u8 epnum) | ||
113 | u16 tx_csr; | ||
114 | size_t length = 0; | ||
115 | size_t offset = 0; | ||
116 | - struct urb *urb; | ||
117 | struct musb_hw_ep *hw_ep = musb->endpoints + epnum; | ||
118 | void __iomem *epio = hw_ep->regs; | ||
119 | - struct musb_qh *qh = hw_ep->is_shared_fifo ? hw_ep->in_qh | ||
120 | - : hw_ep->out_qh; | ||
121 | + struct musb_qh *qh = hw_ep->out_qh; | ||
122 | + struct urb *urb = next_urb(qh); | ||
123 | u32 status = 0; | ||
124 | void __iomem *mbase = musb->mregs; | ||
125 | struct dma_channel *dma; | ||
126 | |||
127 | - urb = next_urb(qh); | ||
128 | - | ||
129 | musb_ep_select(mbase, epnum); | ||
130 | tx_csr = musb_readw(epio, MUSB_TXCSR); | ||
131 | |||
132 | @@ -1741,10 +1732,7 @@ static int musb_schedule( | ||
133 | epnum++, hw_ep++) { | ||
134 | int diff; | ||
135 | |||
136 | - if (is_in || hw_ep->is_shared_fifo) { | ||
137 | - if (hw_ep->in_qh != NULL) | ||
138 | - continue; | ||
139 | - } else if (hw_ep->out_qh != NULL) | ||
140 | + if (musb_ep_get_qh(hw_ep, is_in) != NULL) | ||
141 | continue; | ||
142 | |||
143 | if (hw_ep == musb->bulk_ep) | ||
144 | -- | ||
145 | 1.6.0.4 | ||
146 | |||