diff options
Diffstat (limited to 'drivers/usb/gadget/udc/pxa27x_udc.c')
-rw-r--r-- | drivers/usb/gadget/udc/pxa27x_udc.c | 132 |
1 files changed, 60 insertions, 72 deletions
diff --git a/drivers/usb/gadget/udc/pxa27x_udc.c b/drivers/usb/gadget/udc/pxa27x_udc.c index f0ae143dab6d..b51226abade6 100644 --- a/drivers/usb/gadget/udc/pxa27x_udc.c +++ b/drivers/usb/gadget/udc/pxa27x_udc.c | |||
@@ -93,50 +93,46 @@ static void handle_ep(struct pxa_ep *ep); | |||
93 | static int state_dbg_show(struct seq_file *s, void *p) | 93 | static int state_dbg_show(struct seq_file *s, void *p) |
94 | { | 94 | { |
95 | struct pxa_udc *udc = s->private; | 95 | struct pxa_udc *udc = s->private; |
96 | int pos = 0, ret; | ||
97 | u32 tmp; | 96 | u32 tmp; |
98 | 97 | ||
99 | ret = -ENODEV; | ||
100 | if (!udc->driver) | 98 | if (!udc->driver) |
101 | goto out; | 99 | return -ENODEV; |
102 | 100 | ||
103 | /* basic device status */ | 101 | /* basic device status */ |
104 | pos += seq_printf(s, DRIVER_DESC "\n" | 102 | seq_printf(s, DRIVER_DESC "\n" |
105 | "%s version: %s\nGadget driver: %s\n", | 103 | "%s version: %s\n" |
106 | driver_name, DRIVER_VERSION, | 104 | "Gadget driver: %s\n", |
107 | udc->driver ? udc->driver->driver.name : "(none)"); | 105 | driver_name, DRIVER_VERSION, |
106 | udc->driver ? udc->driver->driver.name : "(none)"); | ||
108 | 107 | ||
109 | tmp = udc_readl(udc, UDCCR); | 108 | tmp = udc_readl(udc, UDCCR); |
110 | pos += seq_printf(s, | 109 | seq_printf(s, |
111 | "udccr=0x%0x(%s%s%s%s%s%s%s%s%s%s), " | 110 | "udccr=0x%0x(%s%s%s%s%s%s%s%s%s%s), con=%d,inter=%d,altinter=%d\n", |
112 | "con=%d,inter=%d,altinter=%d\n", tmp, | 111 | tmp, |
113 | (tmp & UDCCR_OEN) ? " oen":"", | 112 | (tmp & UDCCR_OEN) ? " oen":"", |
114 | (tmp & UDCCR_AALTHNP) ? " aalthnp":"", | 113 | (tmp & UDCCR_AALTHNP) ? " aalthnp":"", |
115 | (tmp & UDCCR_AHNP) ? " rem" : "", | 114 | (tmp & UDCCR_AHNP) ? " rem" : "", |
116 | (tmp & UDCCR_BHNP) ? " rstir" : "", | 115 | (tmp & UDCCR_BHNP) ? " rstir" : "", |
117 | (tmp & UDCCR_DWRE) ? " dwre" : "", | 116 | (tmp & UDCCR_DWRE) ? " dwre" : "", |
118 | (tmp & UDCCR_SMAC) ? " smac" : "", | 117 | (tmp & UDCCR_SMAC) ? " smac" : "", |
119 | (tmp & UDCCR_EMCE) ? " emce" : "", | 118 | (tmp & UDCCR_EMCE) ? " emce" : "", |
120 | (tmp & UDCCR_UDR) ? " udr" : "", | 119 | (tmp & UDCCR_UDR) ? " udr" : "", |
121 | (tmp & UDCCR_UDA) ? " uda" : "", | 120 | (tmp & UDCCR_UDA) ? " uda" : "", |
122 | (tmp & UDCCR_UDE) ? " ude" : "", | 121 | (tmp & UDCCR_UDE) ? " ude" : "", |
123 | (tmp & UDCCR_ACN) >> UDCCR_ACN_S, | 122 | (tmp & UDCCR_ACN) >> UDCCR_ACN_S, |
124 | (tmp & UDCCR_AIN) >> UDCCR_AIN_S, | 123 | (tmp & UDCCR_AIN) >> UDCCR_AIN_S, |
125 | (tmp & UDCCR_AAISN) >> UDCCR_AAISN_S); | 124 | (tmp & UDCCR_AAISN) >> UDCCR_AAISN_S); |
126 | /* registers for device and ep0 */ | 125 | /* registers for device and ep0 */ |
127 | pos += seq_printf(s, "udcicr0=0x%08x udcicr1=0x%08x\n", | 126 | seq_printf(s, "udcicr0=0x%08x udcicr1=0x%08x\n", |
128 | udc_readl(udc, UDCICR0), udc_readl(udc, UDCICR1)); | 127 | udc_readl(udc, UDCICR0), udc_readl(udc, UDCICR1)); |
129 | pos += seq_printf(s, "udcisr0=0x%08x udcisr1=0x%08x\n", | 128 | seq_printf(s, "udcisr0=0x%08x udcisr1=0x%08x\n", |
130 | udc_readl(udc, UDCISR0), udc_readl(udc, UDCISR1)); | 129 | udc_readl(udc, UDCISR0), udc_readl(udc, UDCISR1)); |
131 | pos += seq_printf(s, "udcfnr=%d\n", udc_readl(udc, UDCFNR)); | 130 | seq_printf(s, "udcfnr=%d\n", udc_readl(udc, UDCFNR)); |
132 | pos += seq_printf(s, "irqs: reset=%lu, suspend=%lu, resume=%lu, " | 131 | seq_printf(s, "irqs: reset=%lu, suspend=%lu, resume=%lu, reconfig=%lu\n", |
133 | "reconfig=%lu\n", | 132 | udc->stats.irqs_reset, udc->stats.irqs_suspend, |
134 | udc->stats.irqs_reset, udc->stats.irqs_suspend, | 133 | udc->stats.irqs_resume, udc->stats.irqs_reconfig); |
135 | udc->stats.irqs_resume, udc->stats.irqs_reconfig); | 134 | |
136 | 135 | return 0; | |
137 | ret = 0; | ||
138 | out: | ||
139 | return ret; | ||
140 | } | 136 | } |
141 | 137 | ||
142 | static int queues_dbg_show(struct seq_file *s, void *p) | 138 | static int queues_dbg_show(struct seq_file *s, void *p) |
@@ -144,75 +140,67 @@ static int queues_dbg_show(struct seq_file *s, void *p) | |||
144 | struct pxa_udc *udc = s->private; | 140 | struct pxa_udc *udc = s->private; |
145 | struct pxa_ep *ep; | 141 | struct pxa_ep *ep; |
146 | struct pxa27x_request *req; | 142 | struct pxa27x_request *req; |
147 | int pos = 0, i, maxpkt, ret; | 143 | int i, maxpkt; |
148 | 144 | ||
149 | ret = -ENODEV; | ||
150 | if (!udc->driver) | 145 | if (!udc->driver) |
151 | goto out; | 146 | return -ENODEV; |
152 | 147 | ||
153 | /* dump endpoint queues */ | 148 | /* dump endpoint queues */ |
154 | for (i = 0; i < NR_PXA_ENDPOINTS; i++) { | 149 | for (i = 0; i < NR_PXA_ENDPOINTS; i++) { |
155 | ep = &udc->pxa_ep[i]; | 150 | ep = &udc->pxa_ep[i]; |
156 | maxpkt = ep->fifo_size; | 151 | maxpkt = ep->fifo_size; |
157 | pos += seq_printf(s, "%-12s max_pkt=%d %s\n", | 152 | seq_printf(s, "%-12s max_pkt=%d %s\n", |
158 | EPNAME(ep), maxpkt, "pio"); | 153 | EPNAME(ep), maxpkt, "pio"); |
159 | 154 | ||
160 | if (list_empty(&ep->queue)) { | 155 | if (list_empty(&ep->queue)) { |
161 | pos += seq_printf(s, "\t(nothing queued)\n"); | 156 | seq_puts(s, "\t(nothing queued)\n"); |
162 | continue; | 157 | continue; |
163 | } | 158 | } |
164 | 159 | ||
165 | list_for_each_entry(req, &ep->queue, queue) { | 160 | list_for_each_entry(req, &ep->queue, queue) { |
166 | pos += seq_printf(s, "\treq %p len %d/%d buf %p\n", | 161 | seq_printf(s, "\treq %p len %d/%d buf %p\n", |
167 | &req->req, req->req.actual, | 162 | &req->req, req->req.actual, |
168 | req->req.length, req->req.buf); | 163 | req->req.length, req->req.buf); |
169 | } | 164 | } |
170 | } | 165 | } |
171 | 166 | ||
172 | ret = 0; | 167 | return 0; |
173 | out: | ||
174 | return ret; | ||
175 | } | 168 | } |
176 | 169 | ||
177 | static int eps_dbg_show(struct seq_file *s, void *p) | 170 | static int eps_dbg_show(struct seq_file *s, void *p) |
178 | { | 171 | { |
179 | struct pxa_udc *udc = s->private; | 172 | struct pxa_udc *udc = s->private; |
180 | struct pxa_ep *ep; | 173 | struct pxa_ep *ep; |
181 | int pos = 0, i, ret; | 174 | int i; |
182 | u32 tmp; | 175 | u32 tmp; |
183 | 176 | ||
184 | ret = -ENODEV; | ||
185 | if (!udc->driver) | 177 | if (!udc->driver) |
186 | goto out; | 178 | return -ENODEV; |
187 | 179 | ||
188 | ep = &udc->pxa_ep[0]; | 180 | ep = &udc->pxa_ep[0]; |
189 | tmp = udc_ep_readl(ep, UDCCSR); | 181 | tmp = udc_ep_readl(ep, UDCCSR); |
190 | pos += seq_printf(s, "udccsr0=0x%03x(%s%s%s%s%s%s%s)\n", tmp, | 182 | seq_printf(s, "udccsr0=0x%03x(%s%s%s%s%s%s%s)\n", |
191 | (tmp & UDCCSR0_SA) ? " sa" : "", | 183 | tmp, |
192 | (tmp & UDCCSR0_RNE) ? " rne" : "", | 184 | (tmp & UDCCSR0_SA) ? " sa" : "", |
193 | (tmp & UDCCSR0_FST) ? " fst" : "", | 185 | (tmp & UDCCSR0_RNE) ? " rne" : "", |
194 | (tmp & UDCCSR0_SST) ? " sst" : "", | 186 | (tmp & UDCCSR0_FST) ? " fst" : "", |
195 | (tmp & UDCCSR0_DME) ? " dme" : "", | 187 | (tmp & UDCCSR0_SST) ? " sst" : "", |
196 | (tmp & UDCCSR0_IPR) ? " ipr" : "", | 188 | (tmp & UDCCSR0_DME) ? " dme" : "", |
197 | (tmp & UDCCSR0_OPC) ? " opc" : ""); | 189 | (tmp & UDCCSR0_IPR) ? " ipr" : "", |
190 | (tmp & UDCCSR0_OPC) ? " opc" : ""); | ||
198 | for (i = 0; i < NR_PXA_ENDPOINTS; i++) { | 191 | for (i = 0; i < NR_PXA_ENDPOINTS; i++) { |
199 | ep = &udc->pxa_ep[i]; | 192 | ep = &udc->pxa_ep[i]; |
200 | tmp = i? udc_ep_readl(ep, UDCCR) : udc_readl(udc, UDCCR); | 193 | tmp = i? udc_ep_readl(ep, UDCCR) : udc_readl(udc, UDCCR); |
201 | pos += seq_printf(s, "%-12s: " | 194 | seq_printf(s, "%-12s: IN %lu(%lu reqs), OUT %lu(%lu reqs), irqs=%lu, udccr=0x%08x, udccsr=0x%03x, udcbcr=%d\n", |
202 | "IN %lu(%lu reqs), OUT %lu(%lu reqs), " | 195 | EPNAME(ep), |
203 | "irqs=%lu, udccr=0x%08x, udccsr=0x%03x, " | 196 | ep->stats.in_bytes, ep->stats.in_ops, |
204 | "udcbcr=%d\n", | 197 | ep->stats.out_bytes, ep->stats.out_ops, |
205 | EPNAME(ep), | 198 | ep->stats.irqs, |
206 | ep->stats.in_bytes, ep->stats.in_ops, | 199 | tmp, udc_ep_readl(ep, UDCCSR), |
207 | ep->stats.out_bytes, ep->stats.out_ops, | 200 | udc_ep_readl(ep, UDCBCR)); |
208 | ep->stats.irqs, | ||
209 | tmp, udc_ep_readl(ep, UDCCSR), | ||
210 | udc_ep_readl(ep, UDCBCR)); | ||
211 | } | 201 | } |
212 | 202 | ||
213 | ret = 0; | 203 | return 0; |
214 | out: | ||
215 | return ret; | ||
216 | } | 204 | } |
217 | 205 | ||
218 | static int eps_dbg_open(struct inode *inode, struct file *file) | 206 | static int eps_dbg_open(struct inode *inode, struct file *file) |