diff options
author | Alexander Shishkin <alexander.shishkin@linux.intel.com> | 2013-06-24 07:46:36 -0400 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2013-06-24 19:16:55 -0400 |
commit | 8e22978c57087aac4d88693278db1cc3e94f1253 (patch) | |
tree | 37394ec786b6e51cdc2c71d4c37aabbf969fe011 /drivers/usb/chipidea/udc.c | |
parent | 38dcdb3a7db757203b71faf0a49710685d897852 (diff) |
usb: chipidea: drop "13xxx" infix
"ci13xxx" is bad for at least the following reasons:
* people often mistype it
* it doesn't add any informational value to the names it's used in
* it needlessly attracts mail filters
This patch replaces it with "ci_hdrc", "ci_udc" or "ci_hw", depending
on the situation. Modules with ci13xxx prefix are also renamed accordingly
and aliases are added for compatibility. Otherwise, no functional changes.
Signed-off-by: Alexander Shishkin <alexander.shishkin@linux.intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/usb/chipidea/udc.c')
-rw-r--r-- | drivers/usb/chipidea/udc.c | 217 |
1 files changed, 108 insertions, 109 deletions
diff --git a/drivers/usb/chipidea/udc.c b/drivers/usb/chipidea/udc.c index 0a9dcc9a82aa..e475fcda1d68 100644 --- a/drivers/usb/chipidea/udc.c +++ b/drivers/usb/chipidea/udc.c | |||
@@ -61,7 +61,7 @@ static inline int hw_ep_bit(int num, int dir) | |||
61 | return num + (dir ? 16 : 0); | 61 | return num + (dir ? 16 : 0); |
62 | } | 62 | } |
63 | 63 | ||
64 | static inline int ep_to_bit(struct ci13xxx *ci, int n) | 64 | static inline int ep_to_bit(struct ci_hdrc *ci, int n) |
65 | { | 65 | { |
66 | int fill = 16 - ci->hw_ep_max / 2; | 66 | int fill = 16 - ci->hw_ep_max / 2; |
67 | 67 | ||
@@ -77,7 +77,7 @@ static inline int ep_to_bit(struct ci13xxx *ci, int n) | |||
77 | * | 77 | * |
78 | * This function returns an error code | 78 | * This function returns an error code |
79 | */ | 79 | */ |
80 | static int hw_device_state(struct ci13xxx *ci, u32 dma) | 80 | static int hw_device_state(struct ci_hdrc *ci, u32 dma) |
81 | { | 81 | { |
82 | if (dma) { | 82 | if (dma) { |
83 | hw_write(ci, OP_ENDPTLISTADDR, ~0, dma); | 83 | hw_write(ci, OP_ENDPTLISTADDR, ~0, dma); |
@@ -97,7 +97,7 @@ static int hw_device_state(struct ci13xxx *ci, u32 dma) | |||
97 | * | 97 | * |
98 | * This function returns an error code | 98 | * This function returns an error code |
99 | */ | 99 | */ |
100 | static int hw_ep_flush(struct ci13xxx *ci, int num, int dir) | 100 | static int hw_ep_flush(struct ci_hdrc *ci, int num, int dir) |
101 | { | 101 | { |
102 | int n = hw_ep_bit(num, dir); | 102 | int n = hw_ep_bit(num, dir); |
103 | 103 | ||
@@ -118,7 +118,7 @@ static int hw_ep_flush(struct ci13xxx *ci, int num, int dir) | |||
118 | * | 118 | * |
119 | * This function returns an error code | 119 | * This function returns an error code |
120 | */ | 120 | */ |
121 | static int hw_ep_disable(struct ci13xxx *ci, int num, int dir) | 121 | static int hw_ep_disable(struct ci_hdrc *ci, int num, int dir) |
122 | { | 122 | { |
123 | hw_ep_flush(ci, num, dir); | 123 | hw_ep_flush(ci, num, dir); |
124 | hw_write(ci, OP_ENDPTCTRL + num, | 124 | hw_write(ci, OP_ENDPTCTRL + num, |
@@ -134,7 +134,7 @@ static int hw_ep_disable(struct ci13xxx *ci, int num, int dir) | |||
134 | * | 134 | * |
135 | * This function returns an error code | 135 | * This function returns an error code |
136 | */ | 136 | */ |
137 | static int hw_ep_enable(struct ci13xxx *ci, int num, int dir, int type) | 137 | static int hw_ep_enable(struct ci_hdrc *ci, int num, int dir, int type) |
138 | { | 138 | { |
139 | u32 mask, data; | 139 | u32 mask, data; |
140 | 140 | ||
@@ -168,7 +168,7 @@ static int hw_ep_enable(struct ci13xxx *ci, int num, int dir, int type) | |||
168 | * | 168 | * |
169 | * This function returns 1 if endpoint halted | 169 | * This function returns 1 if endpoint halted |
170 | */ | 170 | */ |
171 | static int hw_ep_get_halt(struct ci13xxx *ci, int num, int dir) | 171 | static int hw_ep_get_halt(struct ci_hdrc *ci, int num, int dir) |
172 | { | 172 | { |
173 | u32 mask = dir ? ENDPTCTRL_TXS : ENDPTCTRL_RXS; | 173 | u32 mask = dir ? ENDPTCTRL_TXS : ENDPTCTRL_RXS; |
174 | 174 | ||
@@ -182,7 +182,7 @@ static int hw_ep_get_halt(struct ci13xxx *ci, int num, int dir) | |||
182 | * | 182 | * |
183 | * This function returns setup status | 183 | * This function returns setup status |
184 | */ | 184 | */ |
185 | static int hw_test_and_clear_setup_status(struct ci13xxx *ci, int n) | 185 | static int hw_test_and_clear_setup_status(struct ci_hdrc *ci, int n) |
186 | { | 186 | { |
187 | n = ep_to_bit(ci, n); | 187 | n = ep_to_bit(ci, n); |
188 | return hw_test_and_clear(ci, OP_ENDPTSETUPSTAT, BIT(n)); | 188 | return hw_test_and_clear(ci, OP_ENDPTSETUPSTAT, BIT(n)); |
@@ -196,7 +196,7 @@ static int hw_test_and_clear_setup_status(struct ci13xxx *ci, int n) | |||
196 | * | 196 | * |
197 | * This function returns an error code | 197 | * This function returns an error code |
198 | */ | 198 | */ |
199 | static int hw_ep_prime(struct ci13xxx *ci, int num, int dir, int is_ctrl) | 199 | static int hw_ep_prime(struct ci_hdrc *ci, int num, int dir, int is_ctrl) |
200 | { | 200 | { |
201 | int n = hw_ep_bit(num, dir); | 201 | int n = hw_ep_bit(num, dir); |
202 | 202 | ||
@@ -223,13 +223,13 @@ static int hw_ep_prime(struct ci13xxx *ci, int num, int dir, int is_ctrl) | |||
223 | * | 223 | * |
224 | * This function returns an error code | 224 | * This function returns an error code |
225 | */ | 225 | */ |
226 | static int hw_ep_set_halt(struct ci13xxx *ci, int num, int dir, int value) | 226 | static int hw_ep_set_halt(struct ci_hdrc *ci, int num, int dir, int value) |
227 | { | 227 | { |
228 | if (value != 0 && value != 1) | 228 | if (value != 0 && value != 1) |
229 | return -EINVAL; | 229 | return -EINVAL; |
230 | 230 | ||
231 | do { | 231 | do { |
232 | enum ci13xxx_regs reg = OP_ENDPTCTRL + num; | 232 | enum ci_hw_regs reg = OP_ENDPTCTRL + num; |
233 | u32 mask_xs = dir ? ENDPTCTRL_TXS : ENDPTCTRL_RXS; | 233 | u32 mask_xs = dir ? ENDPTCTRL_TXS : ENDPTCTRL_RXS; |
234 | u32 mask_xr = dir ? ENDPTCTRL_TXR : ENDPTCTRL_RXR; | 234 | u32 mask_xr = dir ? ENDPTCTRL_TXR : ENDPTCTRL_RXR; |
235 | 235 | ||
@@ -246,7 +246,7 @@ static int hw_ep_set_halt(struct ci13xxx *ci, int num, int dir, int value) | |||
246 | * | 246 | * |
247 | * This function returns true if high speed port | 247 | * This function returns true if high speed port |
248 | */ | 248 | */ |
249 | static int hw_port_is_high_speed(struct ci13xxx *ci) | 249 | static int hw_port_is_high_speed(struct ci_hdrc *ci) |
250 | { | 250 | { |
251 | return ci->hw_bank.lpm ? hw_read(ci, OP_DEVLC, DEVLC_PSPD) : | 251 | return ci->hw_bank.lpm ? hw_read(ci, OP_DEVLC, DEVLC_PSPD) : |
252 | hw_read(ci, OP_PORTSC, PORTSC_HSP); | 252 | hw_read(ci, OP_PORTSC, PORTSC_HSP); |
@@ -257,7 +257,7 @@ static int hw_port_is_high_speed(struct ci13xxx *ci) | |||
257 | * | 257 | * |
258 | * This function returns register data | 258 | * This function returns register data |
259 | */ | 259 | */ |
260 | static u32 hw_read_intr_enable(struct ci13xxx *ci) | 260 | static u32 hw_read_intr_enable(struct ci_hdrc *ci) |
261 | { | 261 | { |
262 | return hw_read(ci, OP_USBINTR, ~0); | 262 | return hw_read(ci, OP_USBINTR, ~0); |
263 | } | 263 | } |
@@ -267,7 +267,7 @@ static u32 hw_read_intr_enable(struct ci13xxx *ci) | |||
267 | * | 267 | * |
268 | * This function returns register data | 268 | * This function returns register data |
269 | */ | 269 | */ |
270 | static u32 hw_read_intr_status(struct ci13xxx *ci) | 270 | static u32 hw_read_intr_status(struct ci_hdrc *ci) |
271 | { | 271 | { |
272 | return hw_read(ci, OP_USBSTS, ~0); | 272 | return hw_read(ci, OP_USBSTS, ~0); |
273 | } | 273 | } |
@@ -279,7 +279,7 @@ static u32 hw_read_intr_status(struct ci13xxx *ci) | |||
279 | * | 279 | * |
280 | * This function returns complete status | 280 | * This function returns complete status |
281 | */ | 281 | */ |
282 | static int hw_test_and_clear_complete(struct ci13xxx *ci, int n) | 282 | static int hw_test_and_clear_complete(struct ci_hdrc *ci, int n) |
283 | { | 283 | { |
284 | n = ep_to_bit(ci, n); | 284 | n = ep_to_bit(ci, n); |
285 | return hw_test_and_clear(ci, OP_ENDPTCOMPLETE, BIT(n)); | 285 | return hw_test_and_clear(ci, OP_ENDPTCOMPLETE, BIT(n)); |
@@ -291,7 +291,7 @@ static int hw_test_and_clear_complete(struct ci13xxx *ci, int n) | |||
291 | * | 291 | * |
292 | * This function returns active interrutps | 292 | * This function returns active interrutps |
293 | */ | 293 | */ |
294 | static u32 hw_test_and_clear_intr_active(struct ci13xxx *ci) | 294 | static u32 hw_test_and_clear_intr_active(struct ci_hdrc *ci) |
295 | { | 295 | { |
296 | u32 reg = hw_read_intr_status(ci) & hw_read_intr_enable(ci); | 296 | u32 reg = hw_read_intr_status(ci) & hw_read_intr_enable(ci); |
297 | 297 | ||
@@ -305,7 +305,7 @@ static u32 hw_test_and_clear_intr_active(struct ci13xxx *ci) | |||
305 | * | 305 | * |
306 | * This function returns guard value | 306 | * This function returns guard value |
307 | */ | 307 | */ |
308 | static int hw_test_and_clear_setup_guard(struct ci13xxx *ci) | 308 | static int hw_test_and_clear_setup_guard(struct ci_hdrc *ci) |
309 | { | 309 | { |
310 | return hw_test_and_write(ci, OP_USBCMD, USBCMD_SUTW, 0); | 310 | return hw_test_and_write(ci, OP_USBCMD, USBCMD_SUTW, 0); |
311 | } | 311 | } |
@@ -316,7 +316,7 @@ static int hw_test_and_clear_setup_guard(struct ci13xxx *ci) | |||
316 | * | 316 | * |
317 | * This function returns guard value | 317 | * This function returns guard value |
318 | */ | 318 | */ |
319 | static int hw_test_and_set_setup_guard(struct ci13xxx *ci) | 319 | static int hw_test_and_set_setup_guard(struct ci_hdrc *ci) |
320 | { | 320 | { |
321 | return hw_test_and_write(ci, OP_USBCMD, USBCMD_SUTW, USBCMD_SUTW); | 321 | return hw_test_and_write(ci, OP_USBCMD, USBCMD_SUTW, USBCMD_SUTW); |
322 | } | 322 | } |
@@ -328,7 +328,7 @@ static int hw_test_and_set_setup_guard(struct ci13xxx *ci) | |||
328 | * This function explicitly sets the address, without the "USBADRA" (advance) | 328 | * This function explicitly sets the address, without the "USBADRA" (advance) |
329 | * feature, which is not supported by older versions of the controller. | 329 | * feature, which is not supported by older versions of the controller. |
330 | */ | 330 | */ |
331 | static void hw_usb_set_address(struct ci13xxx *ci, u8 value) | 331 | static void hw_usb_set_address(struct ci_hdrc *ci, u8 value) |
332 | { | 332 | { |
333 | hw_write(ci, OP_DEVICEADDR, DEVICEADDR_USBADR, | 333 | hw_write(ci, OP_DEVICEADDR, DEVICEADDR_USBADR, |
334 | value << __ffs(DEVICEADDR_USBADR)); | 334 | value << __ffs(DEVICEADDR_USBADR)); |
@@ -340,7 +340,7 @@ static void hw_usb_set_address(struct ci13xxx *ci, u8 value) | |||
340 | * | 340 | * |
341 | * This function returns an error code | 341 | * This function returns an error code |
342 | */ | 342 | */ |
343 | static int hw_usb_reset(struct ci13xxx *ci) | 343 | static int hw_usb_reset(struct ci_hdrc *ci) |
344 | { | 344 | { |
345 | hw_usb_set_address(ci, 0); | 345 | hw_usb_set_address(ci, 0); |
346 | 346 | ||
@@ -369,7 +369,7 @@ static int hw_usb_reset(struct ci13xxx *ci) | |||
369 | * UTIL block | 369 | * UTIL block |
370 | *****************************************************************************/ | 370 | *****************************************************************************/ |
371 | 371 | ||
372 | static int add_td_to_list(struct ci13xxx_ep *hwep, struct ci13xxx_req *hwreq, | 372 | static int add_td_to_list(struct ci_hw_ep *hwep, struct ci_hw_req *hwreq, |
373 | unsigned length) | 373 | unsigned length) |
374 | { | 374 | { |
375 | int i; | 375 | int i; |
@@ -387,7 +387,7 @@ static int add_td_to_list(struct ci13xxx_ep *hwep, struct ci13xxx_req *hwreq, | |||
387 | return -ENOMEM; | 387 | return -ENOMEM; |
388 | } | 388 | } |
389 | 389 | ||
390 | memset(node->ptr, 0, sizeof(struct ci13xxx_td)); | 390 | memset(node->ptr, 0, sizeof(struct ci_hw_td)); |
391 | node->ptr->token = cpu_to_le32(length << __ffs(TD_TOTAL_BYTES)); | 391 | node->ptr->token = cpu_to_le32(length << __ffs(TD_TOTAL_BYTES)); |
392 | node->ptr->token &= cpu_to_le32(TD_TOTAL_BYTES); | 392 | node->ptr->token &= cpu_to_le32(TD_TOTAL_BYTES); |
393 | node->ptr->token |= cpu_to_le32(TD_STATUS_ACTIVE); | 393 | node->ptr->token |= cpu_to_le32(TD_STATUS_ACTIVE); |
@@ -396,7 +396,7 @@ static int add_td_to_list(struct ci13xxx_ep *hwep, struct ci13xxx_req *hwreq, | |||
396 | if (length) { | 396 | if (length) { |
397 | node->ptr->page[0] = cpu_to_le32(temp); | 397 | node->ptr->page[0] = cpu_to_le32(temp); |
398 | for (i = 1; i < TD_PAGE_COUNT; i++) { | 398 | for (i = 1; i < TD_PAGE_COUNT; i++) { |
399 | u32 page = temp + i * CI13XXX_PAGE_SIZE; | 399 | u32 page = temp + i * CI_HDRC_PAGE_SIZE; |
400 | page &= ~TD_RESERVED_MASK; | 400 | page &= ~TD_RESERVED_MASK; |
401 | node->ptr->page[i] = cpu_to_le32(page); | 401 | node->ptr->page[i] = cpu_to_le32(page); |
402 | } | 402 | } |
@@ -421,7 +421,7 @@ static int add_td_to_list(struct ci13xxx_ep *hwep, struct ci13xxx_req *hwreq, | |||
421 | * _usb_addr: calculates endpoint address from direction & number | 421 | * _usb_addr: calculates endpoint address from direction & number |
422 | * @ep: endpoint | 422 | * @ep: endpoint |
423 | */ | 423 | */ |
424 | static inline u8 _usb_addr(struct ci13xxx_ep *ep) | 424 | static inline u8 _usb_addr(struct ci_hw_ep *ep) |
425 | { | 425 | { |
426 | return ((ep->dir == TX) ? USB_ENDPOINT_DIR_MASK : 0) | ep->num; | 426 | return ((ep->dir == TX) ? USB_ENDPOINT_DIR_MASK : 0) | ep->num; |
427 | } | 427 | } |
@@ -433,9 +433,9 @@ static inline u8 _usb_addr(struct ci13xxx_ep *ep) | |||
433 | * | 433 | * |
434 | * This function returns an error code | 434 | * This function returns an error code |
435 | */ | 435 | */ |
436 | static int _hardware_enqueue(struct ci13xxx_ep *hwep, struct ci13xxx_req *hwreq) | 436 | static int _hardware_enqueue(struct ci_hw_ep *hwep, struct ci_hw_req *hwreq) |
437 | { | 437 | { |
438 | struct ci13xxx *ci = hwep->ci; | 438 | struct ci_hdrc *ci = hwep->ci; |
439 | int ret = 0; | 439 | int ret = 0; |
440 | unsigned rest = hwreq->req.length; | 440 | unsigned rest = hwreq->req.length; |
441 | int pages = TD_PAGE_COUNT; | 441 | int pages = TD_PAGE_COUNT; |
@@ -463,7 +463,7 @@ static int _hardware_enqueue(struct ci13xxx_ep *hwep, struct ci13xxx_req *hwreq) | |||
463 | 463 | ||
464 | while (rest > 0) { | 464 | while (rest > 0) { |
465 | unsigned count = min(hwreq->req.length - hwreq->req.actual, | 465 | unsigned count = min(hwreq->req.length - hwreq->req.actual, |
466 | (unsigned)(pages * CI13XXX_PAGE_SIZE)); | 466 | (unsigned)(pages * CI_HDRC_PAGE_SIZE)); |
467 | add_td_to_list(hwep, hwreq, count); | 467 | add_td_to_list(hwep, hwreq, count); |
468 | rest -= count; | 468 | rest -= count; |
469 | } | 469 | } |
@@ -484,14 +484,14 @@ static int _hardware_enqueue(struct ci13xxx_ep *hwep, struct ci13xxx_req *hwreq) | |||
484 | 484 | ||
485 | hwreq->req.actual = 0; | 485 | hwreq->req.actual = 0; |
486 | if (!list_empty(&hwep->qh.queue)) { | 486 | if (!list_empty(&hwep->qh.queue)) { |
487 | struct ci13xxx_req *hwreqprev; | 487 | struct ci_hw_req *hwreqprev; |
488 | int n = hw_ep_bit(hwep->num, hwep->dir); | 488 | int n = hw_ep_bit(hwep->num, hwep->dir); |
489 | int tmp_stat; | 489 | int tmp_stat; |
490 | struct td_node *prevlastnode; | 490 | struct td_node *prevlastnode; |
491 | u32 next = firstnode->dma & TD_ADDR_MASK; | 491 | u32 next = firstnode->dma & TD_ADDR_MASK; |
492 | 492 | ||
493 | hwreqprev = list_entry(hwep->qh.queue.prev, | 493 | hwreqprev = list_entry(hwep->qh.queue.prev, |
494 | struct ci13xxx_req, queue); | 494 | struct ci_hw_req, queue); |
495 | prevlastnode = list_entry(hwreqprev->tds.prev, | 495 | prevlastnode = list_entry(hwreqprev->tds.prev, |
496 | struct td_node, td); | 496 | struct td_node, td); |
497 | 497 | ||
@@ -533,7 +533,7 @@ done: | |||
533 | * free_pending_td: remove a pending request for the endpoint | 533 | * free_pending_td: remove a pending request for the endpoint |
534 | * @hwep: endpoint | 534 | * @hwep: endpoint |
535 | */ | 535 | */ |
536 | static void free_pending_td(struct ci13xxx_ep *hwep) | 536 | static void free_pending_td(struct ci_hw_ep *hwep) |
537 | { | 537 | { |
538 | struct td_node *pending = hwep->pending_td; | 538 | struct td_node *pending = hwep->pending_td; |
539 | 539 | ||
@@ -549,7 +549,7 @@ static void free_pending_td(struct ci13xxx_ep *hwep) | |||
549 | * | 549 | * |
550 | * This function returns an error code | 550 | * This function returns an error code |
551 | */ | 551 | */ |
552 | static int _hardware_dequeue(struct ci13xxx_ep *hwep, struct ci13xxx_req *hwreq) | 552 | static int _hardware_dequeue(struct ci_hw_ep *hwep, struct ci_hw_req *hwreq) |
553 | { | 553 | { |
554 | u32 tmptoken; | 554 | u32 tmptoken; |
555 | struct td_node *node, *tmpnode; | 555 | struct td_node *node, *tmpnode; |
@@ -619,7 +619,7 @@ static int _hardware_dequeue(struct ci13xxx_ep *hwep, struct ci13xxx_req *hwreq) | |||
619 | * This function returns an error code | 619 | * This function returns an error code |
620 | * Caller must hold lock | 620 | * Caller must hold lock |
621 | */ | 621 | */ |
622 | static int _ep_nuke(struct ci13xxx_ep *hwep) | 622 | static int _ep_nuke(struct ci_hw_ep *hwep) |
623 | __releases(hwep->lock) | 623 | __releases(hwep->lock) |
624 | __acquires(hwep->lock) | 624 | __acquires(hwep->lock) |
625 | { | 625 | { |
@@ -632,9 +632,8 @@ __acquires(hwep->lock) | |||
632 | while (!list_empty(&hwep->qh.queue)) { | 632 | while (!list_empty(&hwep->qh.queue)) { |
633 | 633 | ||
634 | /* pop oldest request */ | 634 | /* pop oldest request */ |
635 | struct ci13xxx_req *hwreq = list_entry(hwep->qh.queue.next, | 635 | struct ci_hw_req *hwreq = list_entry(hwep->qh.queue.next, |
636 | struct ci13xxx_req, | 636 | struct ci_hw_req, queue); |
637 | queue); | ||
638 | 637 | ||
639 | list_for_each_entry_safe(node, tmpnode, &hwreq->tds, td) { | 638 | list_for_each_entry_safe(node, tmpnode, &hwreq->tds, td) { |
640 | dma_pool_free(hwep->td_pool, node->ptr, node->dma); | 639 | dma_pool_free(hwep->td_pool, node->ptr, node->dma); |
@@ -668,7 +667,7 @@ __acquires(hwep->lock) | |||
668 | static int _gadget_stop_activity(struct usb_gadget *gadget) | 667 | static int _gadget_stop_activity(struct usb_gadget *gadget) |
669 | { | 668 | { |
670 | struct usb_ep *ep; | 669 | struct usb_ep *ep; |
671 | struct ci13xxx *ci = container_of(gadget, struct ci13xxx, gadget); | 670 | struct ci_hdrc *ci = container_of(gadget, struct ci_hdrc, gadget); |
672 | unsigned long flags; | 671 | unsigned long flags; |
673 | 672 | ||
674 | spin_lock_irqsave(&ci->lock, flags); | 673 | spin_lock_irqsave(&ci->lock, flags); |
@@ -709,7 +708,7 @@ static int _gadget_stop_activity(struct usb_gadget *gadget) | |||
709 | * | 708 | * |
710 | * This function resets USB engine after a bus reset occurred | 709 | * This function resets USB engine after a bus reset occurred |
711 | */ | 710 | */ |
712 | static void isr_reset_handler(struct ci13xxx *ci) | 711 | static void isr_reset_handler(struct ci_hdrc *ci) |
713 | __releases(ci->lock) | 712 | __releases(ci->lock) |
714 | __acquires(ci->lock) | 713 | __acquires(ci->lock) |
715 | { | 714 | { |
@@ -759,9 +758,9 @@ static void isr_get_status_complete(struct usb_ep *ep, struct usb_request *req) | |||
759 | static int _ep_queue(struct usb_ep *ep, struct usb_request *req, | 758 | static int _ep_queue(struct usb_ep *ep, struct usb_request *req, |
760 | gfp_t __maybe_unused gfp_flags) | 759 | gfp_t __maybe_unused gfp_flags) |
761 | { | 760 | { |
762 | struct ci13xxx_ep *hwep = container_of(ep, struct ci13xxx_ep, ep); | 761 | struct ci_hw_ep *hwep = container_of(ep, struct ci_hw_ep, ep); |
763 | struct ci13xxx_req *hwreq = container_of(req, struct ci13xxx_req, req); | 762 | struct ci_hw_req *hwreq = container_of(req, struct ci_hw_req, req); |
764 | struct ci13xxx *ci = hwep->ci; | 763 | struct ci_hdrc *ci = hwep->ci; |
765 | int retval = 0; | 764 | int retval = 0; |
766 | 765 | ||
767 | if (ep == NULL || req == NULL || hwep->ep.desc == NULL) | 766 | if (ep == NULL || req == NULL || hwep->ep.desc == NULL) |
@@ -812,12 +811,12 @@ static int _ep_queue(struct usb_ep *ep, struct usb_request *req, | |||
812 | * | 811 | * |
813 | * This function returns an error code | 812 | * This function returns an error code |
814 | */ | 813 | */ |
815 | static int isr_get_status_response(struct ci13xxx *ci, | 814 | static int isr_get_status_response(struct ci_hdrc *ci, |
816 | struct usb_ctrlrequest *setup) | 815 | struct usb_ctrlrequest *setup) |
817 | __releases(hwep->lock) | 816 | __releases(hwep->lock) |
818 | __acquires(hwep->lock) | 817 | __acquires(hwep->lock) |
819 | { | 818 | { |
820 | struct ci13xxx_ep *hwep = ci->ep0in; | 819 | struct ci_hw_ep *hwep = ci->ep0in; |
821 | struct usb_request *req = NULL; | 820 | struct usb_request *req = NULL; |
822 | gfp_t gfp_flags = GFP_ATOMIC; | 821 | gfp_t gfp_flags = GFP_ATOMIC; |
823 | int dir, num, retval; | 822 | int dir, num, retval; |
@@ -878,7 +877,7 @@ __acquires(hwep->lock) | |||
878 | static void | 877 | static void |
879 | isr_setup_status_complete(struct usb_ep *ep, struct usb_request *req) | 878 | isr_setup_status_complete(struct usb_ep *ep, struct usb_request *req) |
880 | { | 879 | { |
881 | struct ci13xxx *ci = req->context; | 880 | struct ci_hdrc *ci = req->context; |
882 | unsigned long flags; | 881 | unsigned long flags; |
883 | 882 | ||
884 | if (ci->setaddr) { | 883 | if (ci->setaddr) { |
@@ -898,10 +897,10 @@ isr_setup_status_complete(struct usb_ep *ep, struct usb_request *req) | |||
898 | * | 897 | * |
899 | * This function returns an error code | 898 | * This function returns an error code |
900 | */ | 899 | */ |
901 | static int isr_setup_status_phase(struct ci13xxx *ci) | 900 | static int isr_setup_status_phase(struct ci_hdrc *ci) |
902 | { | 901 | { |
903 | int retval; | 902 | int retval; |
904 | struct ci13xxx_ep *hwep; | 903 | struct ci_hw_ep *hwep; |
905 | 904 | ||
906 | hwep = (ci->ep0_dir == TX) ? ci->ep0out : ci->ep0in; | 905 | hwep = (ci->ep0_dir == TX) ? ci->ep0out : ci->ep0in; |
907 | ci->status->context = ci; | 906 | ci->status->context = ci; |
@@ -919,12 +918,12 @@ static int isr_setup_status_phase(struct ci13xxx *ci) | |||
919 | * This function returns an error code | 918 | * This function returns an error code |
920 | * Caller must hold lock | 919 | * Caller must hold lock |
921 | */ | 920 | */ |
922 | static int isr_tr_complete_low(struct ci13xxx_ep *hwep) | 921 | static int isr_tr_complete_low(struct ci_hw_ep *hwep) |
923 | __releases(hwep->lock) | 922 | __releases(hwep->lock) |
924 | __acquires(hwep->lock) | 923 | __acquires(hwep->lock) |
925 | { | 924 | { |
926 | struct ci13xxx_req *hwreq, *hwreqtemp; | 925 | struct ci_hw_req *hwreq, *hwreqtemp; |
927 | struct ci13xxx_ep *hweptemp = hwep; | 926 | struct ci_hw_ep *hweptemp = hwep; |
928 | int retval = 0; | 927 | int retval = 0; |
929 | 928 | ||
930 | list_for_each_entry_safe(hwreq, hwreqtemp, &hwep->qh.queue, | 929 | list_for_each_entry_safe(hwreq, hwreqtemp, &hwep->qh.queue, |
@@ -955,7 +954,7 @@ __acquires(hwep->lock) | |||
955 | * | 954 | * |
956 | * This function handles traffic events | 955 | * This function handles traffic events |
957 | */ | 956 | */ |
958 | static void isr_tr_complete_handler(struct ci13xxx *ci) | 957 | static void isr_tr_complete_handler(struct ci_hdrc *ci) |
959 | __releases(ci->lock) | 958 | __releases(ci->lock) |
960 | __acquires(ci->lock) | 959 | __acquires(ci->lock) |
961 | { | 960 | { |
@@ -963,7 +962,7 @@ __acquires(ci->lock) | |||
963 | u8 tmode = 0; | 962 | u8 tmode = 0; |
964 | 963 | ||
965 | for (i = 0; i < ci->hw_ep_max; i++) { | 964 | for (i = 0; i < ci->hw_ep_max; i++) { |
966 | struct ci13xxx_ep *hwep = &ci->ci13xxx_ep[i]; | 965 | struct ci_hw_ep *hwep = &ci->ci_hw_ep[i]; |
967 | int type, num, dir, err = -EINVAL; | 966 | int type, num, dir, err = -EINVAL; |
968 | struct usb_ctrlrequest req; | 967 | struct usb_ctrlrequest req; |
969 | 968 | ||
@@ -1023,10 +1022,10 @@ __acquires(ci->lock) | |||
1023 | num &= USB_ENDPOINT_NUMBER_MASK; | 1022 | num &= USB_ENDPOINT_NUMBER_MASK; |
1024 | if (dir) /* TX */ | 1023 | if (dir) /* TX */ |
1025 | num += ci->hw_ep_max/2; | 1024 | num += ci->hw_ep_max/2; |
1026 | if (!ci->ci13xxx_ep[num].wedge) { | 1025 | if (!ci->ci_hw_ep[num].wedge) { |
1027 | spin_unlock(&ci->lock); | 1026 | spin_unlock(&ci->lock); |
1028 | err = usb_ep_clear_halt( | 1027 | err = usb_ep_clear_halt( |
1029 | &ci->ci13xxx_ep[num].ep); | 1028 | &ci->ci_hw_ep[num].ep); |
1030 | spin_lock(&ci->lock); | 1029 | spin_lock(&ci->lock); |
1031 | if (err) | 1030 | if (err) |
1032 | break; | 1031 | break; |
@@ -1076,7 +1075,7 @@ __acquires(ci->lock) | |||
1076 | num += ci->hw_ep_max/2; | 1075 | num += ci->hw_ep_max/2; |
1077 | 1076 | ||
1078 | spin_unlock(&ci->lock); | 1077 | spin_unlock(&ci->lock); |
1079 | err = usb_ep_set_halt(&ci->ci13xxx_ep[num].ep); | 1078 | err = usb_ep_set_halt(&ci->ci_hw_ep[num].ep); |
1080 | spin_lock(&ci->lock); | 1079 | spin_lock(&ci->lock); |
1081 | if (!err) | 1080 | if (!err) |
1082 | isr_setup_status_phase(ci); | 1081 | isr_setup_status_phase(ci); |
@@ -1141,7 +1140,7 @@ delegate: | |||
1141 | static int ep_enable(struct usb_ep *ep, | 1140 | static int ep_enable(struct usb_ep *ep, |
1142 | const struct usb_endpoint_descriptor *desc) | 1141 | const struct usb_endpoint_descriptor *desc) |
1143 | { | 1142 | { |
1144 | struct ci13xxx_ep *hwep = container_of(ep, struct ci13xxx_ep, ep); | 1143 | struct ci_hw_ep *hwep = container_of(ep, struct ci_hw_ep, ep); |
1145 | int retval = 0; | 1144 | int retval = 0; |
1146 | unsigned long flags; | 1145 | unsigned long flags; |
1147 | u32 cap = 0; | 1146 | u32 cap = 0; |
@@ -1194,7 +1193,7 @@ static int ep_enable(struct usb_ep *ep, | |||
1194 | */ | 1193 | */ |
1195 | static int ep_disable(struct usb_ep *ep) | 1194 | static int ep_disable(struct usb_ep *ep) |
1196 | { | 1195 | { |
1197 | struct ci13xxx_ep *hwep = container_of(ep, struct ci13xxx_ep, ep); | 1196 | struct ci_hw_ep *hwep = container_of(ep, struct ci_hw_ep, ep); |
1198 | int direction, retval = 0; | 1197 | int direction, retval = 0; |
1199 | unsigned long flags; | 1198 | unsigned long flags; |
1200 | 1199 | ||
@@ -1230,12 +1229,12 @@ static int ep_disable(struct usb_ep *ep) | |||
1230 | */ | 1229 | */ |
1231 | static struct usb_request *ep_alloc_request(struct usb_ep *ep, gfp_t gfp_flags) | 1230 | static struct usb_request *ep_alloc_request(struct usb_ep *ep, gfp_t gfp_flags) |
1232 | { | 1231 | { |
1233 | struct ci13xxx_req *hwreq = NULL; | 1232 | struct ci_hw_req *hwreq = NULL; |
1234 | 1233 | ||
1235 | if (ep == NULL) | 1234 | if (ep == NULL) |
1236 | return NULL; | 1235 | return NULL; |
1237 | 1236 | ||
1238 | hwreq = kzalloc(sizeof(struct ci13xxx_req), gfp_flags); | 1237 | hwreq = kzalloc(sizeof(struct ci_hw_req), gfp_flags); |
1239 | if (hwreq != NULL) { | 1238 | if (hwreq != NULL) { |
1240 | INIT_LIST_HEAD(&hwreq->queue); | 1239 | INIT_LIST_HEAD(&hwreq->queue); |
1241 | INIT_LIST_HEAD(&hwreq->tds); | 1240 | INIT_LIST_HEAD(&hwreq->tds); |
@@ -1251,8 +1250,8 @@ static struct usb_request *ep_alloc_request(struct usb_ep *ep, gfp_t gfp_flags) | |||
1251 | */ | 1250 | */ |
1252 | static void ep_free_request(struct usb_ep *ep, struct usb_request *req) | 1251 | static void ep_free_request(struct usb_ep *ep, struct usb_request *req) |
1253 | { | 1252 | { |
1254 | struct ci13xxx_ep *hwep = container_of(ep, struct ci13xxx_ep, ep); | 1253 | struct ci_hw_ep *hwep = container_of(ep, struct ci_hw_ep, ep); |
1255 | struct ci13xxx_req *hwreq = container_of(req, struct ci13xxx_req, req); | 1254 | struct ci_hw_req *hwreq = container_of(req, struct ci_hw_req, req); |
1256 | struct td_node *node, *tmpnode; | 1255 | struct td_node *node, *tmpnode; |
1257 | unsigned long flags; | 1256 | unsigned long flags; |
1258 | 1257 | ||
@@ -1285,7 +1284,7 @@ static void ep_free_request(struct usb_ep *ep, struct usb_request *req) | |||
1285 | static int ep_queue(struct usb_ep *ep, struct usb_request *req, | 1284 | static int ep_queue(struct usb_ep *ep, struct usb_request *req, |
1286 | gfp_t __maybe_unused gfp_flags) | 1285 | gfp_t __maybe_unused gfp_flags) |
1287 | { | 1286 | { |
1288 | struct ci13xxx_ep *hwep = container_of(ep, struct ci13xxx_ep, ep); | 1287 | struct ci_hw_ep *hwep = container_of(ep, struct ci_hw_ep, ep); |
1289 | int retval = 0; | 1288 | int retval = 0; |
1290 | unsigned long flags; | 1289 | unsigned long flags; |
1291 | 1290 | ||
@@ -1305,8 +1304,8 @@ static int ep_queue(struct usb_ep *ep, struct usb_request *req, | |||
1305 | */ | 1304 | */ |
1306 | static int ep_dequeue(struct usb_ep *ep, struct usb_request *req) | 1305 | static int ep_dequeue(struct usb_ep *ep, struct usb_request *req) |
1307 | { | 1306 | { |
1308 | struct ci13xxx_ep *hwep = container_of(ep, struct ci13xxx_ep, ep); | 1307 | struct ci_hw_ep *hwep = container_of(ep, struct ci_hw_ep, ep); |
1309 | struct ci13xxx_req *hwreq = container_of(req, struct ci13xxx_req, req); | 1308 | struct ci_hw_req *hwreq = container_of(req, struct ci_hw_req, req); |
1310 | unsigned long flags; | 1309 | unsigned long flags; |
1311 | 1310 | ||
1312 | if (ep == NULL || req == NULL || hwreq->req.status != -EALREADY || | 1311 | if (ep == NULL || req == NULL || hwreq->req.status != -EALREADY || |
@@ -1342,7 +1341,7 @@ static int ep_dequeue(struct usb_ep *ep, struct usb_request *req) | |||
1342 | */ | 1341 | */ |
1343 | static int ep_set_halt(struct usb_ep *ep, int value) | 1342 | static int ep_set_halt(struct usb_ep *ep, int value) |
1344 | { | 1343 | { |
1345 | struct ci13xxx_ep *hwep = container_of(ep, struct ci13xxx_ep, ep); | 1344 | struct ci_hw_ep *hwep = container_of(ep, struct ci_hw_ep, ep); |
1346 | int direction, retval = 0; | 1345 | int direction, retval = 0; |
1347 | unsigned long flags; | 1346 | unsigned long flags; |
1348 | 1347 | ||
@@ -1386,7 +1385,7 @@ static int ep_set_halt(struct usb_ep *ep, int value) | |||
1386 | */ | 1385 | */ |
1387 | static int ep_set_wedge(struct usb_ep *ep) | 1386 | static int ep_set_wedge(struct usb_ep *ep) |
1388 | { | 1387 | { |
1389 | struct ci13xxx_ep *hwep = container_of(ep, struct ci13xxx_ep, ep); | 1388 | struct ci_hw_ep *hwep = container_of(ep, struct ci_hw_ep, ep); |
1390 | unsigned long flags; | 1389 | unsigned long flags; |
1391 | 1390 | ||
1392 | if (ep == NULL || hwep->ep.desc == NULL) | 1391 | if (ep == NULL || hwep->ep.desc == NULL) |
@@ -1406,7 +1405,7 @@ static int ep_set_wedge(struct usb_ep *ep) | |||
1406 | */ | 1405 | */ |
1407 | static void ep_fifo_flush(struct usb_ep *ep) | 1406 | static void ep_fifo_flush(struct usb_ep *ep) |
1408 | { | 1407 | { |
1409 | struct ci13xxx_ep *hwep = container_of(ep, struct ci13xxx_ep, ep); | 1408 | struct ci_hw_ep *hwep = container_of(ep, struct ci_hw_ep, ep); |
1410 | unsigned long flags; | 1409 | unsigned long flags; |
1411 | 1410 | ||
1412 | if (ep == NULL) { | 1411 | if (ep == NULL) { |
@@ -1440,13 +1439,13 @@ static const struct usb_ep_ops usb_ep_ops = { | |||
1440 | /****************************************************************************** | 1439 | /****************************************************************************** |
1441 | * GADGET block | 1440 | * GADGET block |
1442 | *****************************************************************************/ | 1441 | *****************************************************************************/ |
1443 | static int ci13xxx_vbus_session(struct usb_gadget *_gadget, int is_active) | 1442 | static int ci_udc_vbus_session(struct usb_gadget *_gadget, int is_active) |
1444 | { | 1443 | { |
1445 | struct ci13xxx *ci = container_of(_gadget, struct ci13xxx, gadget); | 1444 | struct ci_hdrc *ci = container_of(_gadget, struct ci_hdrc, gadget); |
1446 | unsigned long flags; | 1445 | unsigned long flags; |
1447 | int gadget_ready = 0; | 1446 | int gadget_ready = 0; |
1448 | 1447 | ||
1449 | if (!(ci->platdata->flags & CI13XXX_PULLUP_ON_VBUS)) | 1448 | if (!(ci->platdata->flags & CI_HDRC_PULLUP_ON_VBUS)) |
1450 | return -EOPNOTSUPP; | 1449 | return -EOPNOTSUPP; |
1451 | 1450 | ||
1452 | spin_lock_irqsave(&ci->lock, flags); | 1451 | spin_lock_irqsave(&ci->lock, flags); |
@@ -1464,7 +1463,7 @@ static int ci13xxx_vbus_session(struct usb_gadget *_gadget, int is_active) | |||
1464 | hw_device_state(ci, 0); | 1463 | hw_device_state(ci, 0); |
1465 | if (ci->platdata->notify_event) | 1464 | if (ci->platdata->notify_event) |
1466 | ci->platdata->notify_event(ci, | 1465 | ci->platdata->notify_event(ci, |
1467 | CI13XXX_CONTROLLER_STOPPED_EVENT); | 1466 | CI_HDRC_CONTROLLER_STOPPED_EVENT); |
1468 | _gadget_stop_activity(&ci->gadget); | 1467 | _gadget_stop_activity(&ci->gadget); |
1469 | pm_runtime_put_sync(&_gadget->dev); | 1468 | pm_runtime_put_sync(&_gadget->dev); |
1470 | } | 1469 | } |
@@ -1473,9 +1472,9 @@ static int ci13xxx_vbus_session(struct usb_gadget *_gadget, int is_active) | |||
1473 | return 0; | 1472 | return 0; |
1474 | } | 1473 | } |
1475 | 1474 | ||
1476 | static int ci13xxx_wakeup(struct usb_gadget *_gadget) | 1475 | static int ci_udc_wakeup(struct usb_gadget *_gadget) |
1477 | { | 1476 | { |
1478 | struct ci13xxx *ci = container_of(_gadget, struct ci13xxx, gadget); | 1477 | struct ci_hdrc *ci = container_of(_gadget, struct ci_hdrc, gadget); |
1479 | unsigned long flags; | 1478 | unsigned long flags; |
1480 | int ret = 0; | 1479 | int ret = 0; |
1481 | 1480 | ||
@@ -1494,9 +1493,9 @@ out: | |||
1494 | return ret; | 1493 | return ret; |
1495 | } | 1494 | } |
1496 | 1495 | ||
1497 | static int ci13xxx_vbus_draw(struct usb_gadget *_gadget, unsigned ma) | 1496 | static int ci_udc_vbus_draw(struct usb_gadget *_gadget, unsigned ma) |
1498 | { | 1497 | { |
1499 | struct ci13xxx *ci = container_of(_gadget, struct ci13xxx, gadget); | 1498 | struct ci_hdrc *ci = container_of(_gadget, struct ci_hdrc, gadget); |
1500 | 1499 | ||
1501 | if (ci->transceiver) | 1500 | if (ci->transceiver) |
1502 | return usb_phy_set_power(ci->transceiver, ma); | 1501 | return usb_phy_set_power(ci->transceiver, ma); |
@@ -1506,9 +1505,9 @@ static int ci13xxx_vbus_draw(struct usb_gadget *_gadget, unsigned ma) | |||
1506 | /* Change Data+ pullup status | 1505 | /* Change Data+ pullup status |
1507 | * this func is used by usb_gadget_connect/disconnet | 1506 | * this func is used by usb_gadget_connect/disconnet |
1508 | */ | 1507 | */ |
1509 | static int ci13xxx_pullup(struct usb_gadget *_gadget, int is_on) | 1508 | static int ci_udc_pullup(struct usb_gadget *_gadget, int is_on) |
1510 | { | 1509 | { |
1511 | struct ci13xxx *ci = container_of(_gadget, struct ci13xxx, gadget); | 1510 | struct ci_hdrc *ci = container_of(_gadget, struct ci_hdrc, gadget); |
1512 | 1511 | ||
1513 | if (is_on) | 1512 | if (is_on) |
1514 | hw_write(ci, OP_USBCMD, USBCMD_RS, USBCMD_RS); | 1513 | hw_write(ci, OP_USBCMD, USBCMD_RS, USBCMD_RS); |
@@ -1518,9 +1517,9 @@ static int ci13xxx_pullup(struct usb_gadget *_gadget, int is_on) | |||
1518 | return 0; | 1517 | return 0; |
1519 | } | 1518 | } |
1520 | 1519 | ||
1521 | static int ci13xxx_start(struct usb_gadget *gadget, | 1520 | static int ci_udc_start(struct usb_gadget *gadget, |
1522 | struct usb_gadget_driver *driver); | 1521 | struct usb_gadget_driver *driver); |
1523 | static int ci13xxx_stop(struct usb_gadget *gadget, | 1522 | static int ci_udc_stop(struct usb_gadget *gadget, |
1524 | struct usb_gadget_driver *driver); | 1523 | struct usb_gadget_driver *driver); |
1525 | /** | 1524 | /** |
1526 | * Device operations part of the API to the USB controller hardware, | 1525 | * Device operations part of the API to the USB controller hardware, |
@@ -1528,22 +1527,22 @@ static int ci13xxx_stop(struct usb_gadget *gadget, | |||
1528 | * Check "usb_gadget.h" for details | 1527 | * Check "usb_gadget.h" for details |
1529 | */ | 1528 | */ |
1530 | static const struct usb_gadget_ops usb_gadget_ops = { | 1529 | static const struct usb_gadget_ops usb_gadget_ops = { |
1531 | .vbus_session = ci13xxx_vbus_session, | 1530 | .vbus_session = ci_udc_vbus_session, |
1532 | .wakeup = ci13xxx_wakeup, | 1531 | .wakeup = ci_udc_wakeup, |
1533 | .pullup = ci13xxx_pullup, | 1532 | .pullup = ci_udc_pullup, |
1534 | .vbus_draw = ci13xxx_vbus_draw, | 1533 | .vbus_draw = ci_udc_vbus_draw, |
1535 | .udc_start = ci13xxx_start, | 1534 | .udc_start = ci_udc_start, |
1536 | .udc_stop = ci13xxx_stop, | 1535 | .udc_stop = ci_udc_stop, |
1537 | }; | 1536 | }; |
1538 | 1537 | ||
1539 | static int init_eps(struct ci13xxx *ci) | 1538 | static int init_eps(struct ci_hdrc *ci) |
1540 | { | 1539 | { |
1541 | int retval = 0, i, j; | 1540 | int retval = 0, i, j; |
1542 | 1541 | ||
1543 | for (i = 0; i < ci->hw_ep_max/2; i++) | 1542 | for (i = 0; i < ci->hw_ep_max/2; i++) |
1544 | for (j = RX; j <= TX; j++) { | 1543 | for (j = RX; j <= TX; j++) { |
1545 | int k = i + j * ci->hw_ep_max/2; | 1544 | int k = i + j * ci->hw_ep_max/2; |
1546 | struct ci13xxx_ep *hwep = &ci->ci13xxx_ep[k]; | 1545 | struct ci_hw_ep *hwep = &ci->ci_hw_ep[k]; |
1547 | 1546 | ||
1548 | scnprintf(hwep->name, sizeof(hwep->name), "ep%i%s", i, | 1547 | scnprintf(hwep->name, sizeof(hwep->name), "ep%i%s", i, |
1549 | (j == TX) ? "in" : "out"); | 1548 | (j == TX) ? "in" : "out"); |
@@ -1589,28 +1588,28 @@ static int init_eps(struct ci13xxx *ci) | |||
1589 | return retval; | 1588 | return retval; |
1590 | } | 1589 | } |
1591 | 1590 | ||
1592 | static void destroy_eps(struct ci13xxx *ci) | 1591 | static void destroy_eps(struct ci_hdrc *ci) |
1593 | { | 1592 | { |
1594 | int i; | 1593 | int i; |
1595 | 1594 | ||
1596 | for (i = 0; i < ci->hw_ep_max; i++) { | 1595 | for (i = 0; i < ci->hw_ep_max; i++) { |
1597 | struct ci13xxx_ep *hwep = &ci->ci13xxx_ep[i]; | 1596 | struct ci_hw_ep *hwep = &ci->ci_hw_ep[i]; |
1598 | 1597 | ||
1599 | dma_pool_free(ci->qh_pool, hwep->qh.ptr, hwep->qh.dma); | 1598 | dma_pool_free(ci->qh_pool, hwep->qh.ptr, hwep->qh.dma); |
1600 | } | 1599 | } |
1601 | } | 1600 | } |
1602 | 1601 | ||
1603 | /** | 1602 | /** |
1604 | * ci13xxx_start: register a gadget driver | 1603 | * ci_udc_start: register a gadget driver |
1605 | * @gadget: our gadget | 1604 | * @gadget: our gadget |
1606 | * @driver: the driver being registered | 1605 | * @driver: the driver being registered |
1607 | * | 1606 | * |
1608 | * Interrupts are enabled here. | 1607 | * Interrupts are enabled here. |
1609 | */ | 1608 | */ |
1610 | static int ci13xxx_start(struct usb_gadget *gadget, | 1609 | static int ci_udc_start(struct usb_gadget *gadget, |
1611 | struct usb_gadget_driver *driver) | 1610 | struct usb_gadget_driver *driver) |
1612 | { | 1611 | { |
1613 | struct ci13xxx *ci = container_of(gadget, struct ci13xxx, gadget); | 1612 | struct ci_hdrc *ci = container_of(gadget, struct ci_hdrc, gadget); |
1614 | unsigned long flags; | 1613 | unsigned long flags; |
1615 | int retval = -ENOMEM; | 1614 | int retval = -ENOMEM; |
1616 | 1615 | ||
@@ -1631,9 +1630,9 @@ static int ci13xxx_start(struct usb_gadget *gadget, | |||
1631 | 1630 | ||
1632 | ci->driver = driver; | 1631 | ci->driver = driver; |
1633 | pm_runtime_get_sync(&ci->gadget.dev); | 1632 | pm_runtime_get_sync(&ci->gadget.dev); |
1634 | if (ci->platdata->flags & CI13XXX_PULLUP_ON_VBUS) { | 1633 | if (ci->platdata->flags & CI_HDRC_PULLUP_ON_VBUS) { |
1635 | if (ci->vbus_active) { | 1634 | if (ci->vbus_active) { |
1636 | if (ci->platdata->flags & CI13XXX_REGS_SHARED) | 1635 | if (ci->platdata->flags & CI_HDRC_REGS_SHARED) |
1637 | hw_device_reset(ci, USBMODE_CM_DC); | 1636 | hw_device_reset(ci, USBMODE_CM_DC); |
1638 | } else { | 1637 | } else { |
1639 | pm_runtime_put_sync(&ci->gadget.dev); | 1638 | pm_runtime_put_sync(&ci->gadget.dev); |
@@ -1651,22 +1650,22 @@ static int ci13xxx_start(struct usb_gadget *gadget, | |||
1651 | } | 1650 | } |
1652 | 1651 | ||
1653 | /** | 1652 | /** |
1654 | * ci13xxx_stop: unregister a gadget driver | 1653 | * ci_udc_stop: unregister a gadget driver |
1655 | */ | 1654 | */ |
1656 | static int ci13xxx_stop(struct usb_gadget *gadget, | 1655 | static int ci_udc_stop(struct usb_gadget *gadget, |
1657 | struct usb_gadget_driver *driver) | 1656 | struct usb_gadget_driver *driver) |
1658 | { | 1657 | { |
1659 | struct ci13xxx *ci = container_of(gadget, struct ci13xxx, gadget); | 1658 | struct ci_hdrc *ci = container_of(gadget, struct ci_hdrc, gadget); |
1660 | unsigned long flags; | 1659 | unsigned long flags; |
1661 | 1660 | ||
1662 | spin_lock_irqsave(&ci->lock, flags); | 1661 | spin_lock_irqsave(&ci->lock, flags); |
1663 | 1662 | ||
1664 | if (!(ci->platdata->flags & CI13XXX_PULLUP_ON_VBUS) || | 1663 | if (!(ci->platdata->flags & CI_HDRC_PULLUP_ON_VBUS) || |
1665 | ci->vbus_active) { | 1664 | ci->vbus_active) { |
1666 | hw_device_state(ci, 0); | 1665 | hw_device_state(ci, 0); |
1667 | if (ci->platdata->notify_event) | 1666 | if (ci->platdata->notify_event) |
1668 | ci->platdata->notify_event(ci, | 1667 | ci->platdata->notify_event(ci, |
1669 | CI13XXX_CONTROLLER_STOPPED_EVENT); | 1668 | CI_HDRC_CONTROLLER_STOPPED_EVENT); |
1670 | ci->driver = NULL; | 1669 | ci->driver = NULL; |
1671 | spin_unlock_irqrestore(&ci->lock, flags); | 1670 | spin_unlock_irqrestore(&ci->lock, flags); |
1672 | _gadget_stop_activity(&ci->gadget); | 1671 | _gadget_stop_activity(&ci->gadget); |
@@ -1688,7 +1687,7 @@ static int ci13xxx_stop(struct usb_gadget *gadget, | |||
1688 | * This function returns IRQ_HANDLED if the IRQ has been handled | 1687 | * This function returns IRQ_HANDLED if the IRQ has been handled |
1689 | * It locks access to registers | 1688 | * It locks access to registers |
1690 | */ | 1689 | */ |
1691 | static irqreturn_t udc_irq(struct ci13xxx *ci) | 1690 | static irqreturn_t udc_irq(struct ci_hdrc *ci) |
1692 | { | 1691 | { |
1693 | irqreturn_t retval; | 1692 | irqreturn_t retval; |
1694 | u32 intr; | 1693 | u32 intr; |
@@ -1698,7 +1697,7 @@ static irqreturn_t udc_irq(struct ci13xxx *ci) | |||
1698 | 1697 | ||
1699 | spin_lock(&ci->lock); | 1698 | spin_lock(&ci->lock); |
1700 | 1699 | ||
1701 | if (ci->platdata->flags & CI13XXX_REGS_SHARED) { | 1700 | if (ci->platdata->flags & CI_HDRC_REGS_SHARED) { |
1702 | if (hw_read(ci, OP_USBMODE, USBMODE_CM) != | 1701 | if (hw_read(ci, OP_USBMODE, USBMODE_CM) != |
1703 | USBMODE_CM_DC) { | 1702 | USBMODE_CM_DC) { |
1704 | spin_unlock(&ci->lock); | 1703 | spin_unlock(&ci->lock); |
@@ -1748,7 +1747,7 @@ static irqreturn_t udc_irq(struct ci13xxx *ci) | |||
1748 | * udc_start: initialize gadget role | 1747 | * udc_start: initialize gadget role |
1749 | * @ci: chipidea controller | 1748 | * @ci: chipidea controller |
1750 | */ | 1749 | */ |
1751 | static int udc_start(struct ci13xxx *ci) | 1750 | static int udc_start(struct ci_hdrc *ci) |
1752 | { | 1751 | { |
1753 | struct device *dev = ci->dev; | 1752 | struct device *dev = ci->dev; |
1754 | int retval = 0; | 1753 | int retval = 0; |
@@ -1764,15 +1763,15 @@ static int udc_start(struct ci13xxx *ci) | |||
1764 | INIT_LIST_HEAD(&ci->gadget.ep_list); | 1763 | INIT_LIST_HEAD(&ci->gadget.ep_list); |
1765 | 1764 | ||
1766 | /* alloc resources */ | 1765 | /* alloc resources */ |
1767 | ci->qh_pool = dma_pool_create("ci13xxx_qh", dev, | 1766 | ci->qh_pool = dma_pool_create("ci_hw_qh", dev, |
1768 | sizeof(struct ci13xxx_qh), | 1767 | sizeof(struct ci_hw_qh), |
1769 | 64, CI13XXX_PAGE_SIZE); | 1768 | 64, CI_HDRC_PAGE_SIZE); |
1770 | if (ci->qh_pool == NULL) | 1769 | if (ci->qh_pool == NULL) |
1771 | return -ENOMEM; | 1770 | return -ENOMEM; |
1772 | 1771 | ||
1773 | ci->td_pool = dma_pool_create("ci13xxx_td", dev, | 1772 | ci->td_pool = dma_pool_create("ci_hw_td", dev, |
1774 | sizeof(struct ci13xxx_td), | 1773 | sizeof(struct ci_hw_td), |
1775 | 64, CI13XXX_PAGE_SIZE); | 1774 | 64, CI_HDRC_PAGE_SIZE); |
1776 | if (ci->td_pool == NULL) { | 1775 | if (ci->td_pool == NULL) { |
1777 | retval = -ENOMEM; | 1776 | retval = -ENOMEM; |
1778 | goto free_qh_pool; | 1777 | goto free_qh_pool; |
@@ -1790,14 +1789,14 @@ static int udc_start(struct ci13xxx *ci) | |||
1790 | ci->transceiver = NULL; | 1789 | ci->transceiver = NULL; |
1791 | } | 1790 | } |
1792 | 1791 | ||
1793 | if (ci->platdata->flags & CI13XXX_REQUIRE_TRANSCEIVER) { | 1792 | if (ci->platdata->flags & CI_HDRC_REQUIRE_TRANSCEIVER) { |
1794 | if (ci->transceiver == NULL) { | 1793 | if (ci->transceiver == NULL) { |
1795 | retval = -ENODEV; | 1794 | retval = -ENODEV; |
1796 | goto destroy_eps; | 1795 | goto destroy_eps; |
1797 | } | 1796 | } |
1798 | } | 1797 | } |
1799 | 1798 | ||
1800 | if (!(ci->platdata->flags & CI13XXX_REGS_SHARED)) { | 1799 | if (!(ci->platdata->flags & CI_HDRC_REGS_SHARED)) { |
1801 | retval = hw_device_reset(ci, USBMODE_CM_DC); | 1800 | retval = hw_device_reset(ci, USBMODE_CM_DC); |
1802 | if (retval) | 1801 | if (retval) |
1803 | goto put_transceiver; | 1802 | goto put_transceiver; |
@@ -1844,7 +1843,7 @@ free_qh_pool: | |||
1844 | * | 1843 | * |
1845 | * No interrupts active, the IRQ has been released | 1844 | * No interrupts active, the IRQ has been released |
1846 | */ | 1845 | */ |
1847 | static void udc_stop(struct ci13xxx *ci) | 1846 | static void udc_stop(struct ci_hdrc *ci) |
1848 | { | 1847 | { |
1849 | if (ci == NULL) | 1848 | if (ci == NULL) |
1850 | return; | 1849 | return; |
@@ -1871,7 +1870,7 @@ static void udc_stop(struct ci13xxx *ci) | |||
1871 | * | 1870 | * |
1872 | * This function enables the gadget role, if the device is "device capable". | 1871 | * This function enables the gadget role, if the device is "device capable". |
1873 | */ | 1872 | */ |
1874 | int ci_hdrc_gadget_init(struct ci13xxx *ci) | 1873 | int ci_hdrc_gadget_init(struct ci_hdrc *ci) |
1875 | { | 1874 | { |
1876 | struct ci_role_driver *rdrv; | 1875 | struct ci_role_driver *rdrv; |
1877 | 1876 | ||