diff options
author | Richard Zhao <richard.zhao@freescale.com> | 2012-07-07 10:56:40 -0400 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2012-07-09 12:52:15 -0400 |
commit | 26c696c678c4ce180599330999e895cded0f625b (patch) | |
tree | 4a9c2e8e34b76c837d86b91e6b8d15ef83cf8b75 | |
parent | 2f0de9d844d6c08a8e9059ed0b8d3d5ab6b7911b (diff) |
USB: Chipidea: rename struct ci13xxx variables from udc to ci
struct ci13xxx represent the controller, which may be device or host,
so name its variables as ci.
Signed-off-by: Richard Zhao <richard.zhao@freescale.com>
Reviewed-by: Felipe Balbi <balbi@ti.com>
Signed-off-by: Alexander Shishkin <alexander.shishkin@linux.intel.com>
Reviewed-by: Marek Vasut <marex@denx.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-rw-r--r-- | drivers/usb/chipidea/ci.h | 26 | ||||
-rw-r--r-- | drivers/usb/chipidea/ci13xxx_msm.c | 12 | ||||
-rw-r--r-- | drivers/usb/chipidea/debug.c | 146 | ||||
-rw-r--r-- | drivers/usb/chipidea/udc.c | 628 | ||||
-rw-r--r-- | include/linux/usb/chipidea.h | 2 |
5 files changed, 407 insertions, 407 deletions
diff --git a/drivers/usb/chipidea/ci.h b/drivers/usb/chipidea/ci.h index 0b093308548d..9655e3569d4c 100644 --- a/drivers/usb/chipidea/ci.h +++ b/drivers/usb/chipidea/ci.h | |||
@@ -36,7 +36,7 @@ | |||
36 | * @name: string description of the endpoint | 36 | * @name: string description of the endpoint |
37 | * @qh: queue head for this endpoint | 37 | * @qh: queue head for this endpoint |
38 | * @wedge: is the endpoint wedged | 38 | * @wedge: is the endpoint wedged |
39 | * @udc: pointer to the controller | 39 | * @ci: pointer to the controller |
40 | * @lock: pointer to controller's spinlock | 40 | * @lock: pointer to controller's spinlock |
41 | * @td_pool: pointer to controller's TD pool | 41 | * @td_pool: pointer to controller's TD pool |
42 | */ | 42 | */ |
@@ -54,7 +54,7 @@ struct ci13xxx_ep { | |||
54 | int wedge; | 54 | int wedge; |
55 | 55 | ||
56 | /* global resources */ | 56 | /* global resources */ |
57 | struct ci13xxx *udc; | 57 | struct ci13xxx *ci; |
58 | spinlock_t *lock; | 58 | spinlock_t *lock; |
59 | struct dma_pool *td_pool; | 59 | struct dma_pool *td_pool; |
60 | }; | 60 | }; |
@@ -250,9 +250,9 @@ static inline int ffs_nr(u32 x) | |||
250 | * | 250 | * |
251 | * This function returns register contents | 251 | * This function returns register contents |
252 | */ | 252 | */ |
253 | static inline u32 hw_read(struct ci13xxx *udc, enum ci13xxx_regs reg, u32 mask) | 253 | static inline u32 hw_read(struct ci13xxx *ci, enum ci13xxx_regs reg, u32 mask) |
254 | { | 254 | { |
255 | return ioread32(udc->hw_bank.regmap[reg]) & mask; | 255 | return ioread32(ci->hw_bank.regmap[reg]) & mask; |
256 | } | 256 | } |
257 | 257 | ||
258 | /** | 258 | /** |
@@ -261,14 +261,14 @@ static inline u32 hw_read(struct ci13xxx *udc, enum ci13xxx_regs reg, u32 mask) | |||
261 | * @mask: bitfield mask | 261 | * @mask: bitfield mask |
262 | * @data: new value | 262 | * @data: new value |
263 | */ | 263 | */ |
264 | static inline void hw_write(struct ci13xxx *udc, enum ci13xxx_regs reg, | 264 | static inline void hw_write(struct ci13xxx *ci, enum ci13xxx_regs reg, |
265 | u32 mask, u32 data) | 265 | u32 mask, u32 data) |
266 | { | 266 | { |
267 | if (~mask) | 267 | if (~mask) |
268 | data = (ioread32(udc->hw_bank.regmap[reg]) & ~mask) | 268 | data = (ioread32(ci->hw_bank.regmap[reg]) & ~mask) |
269 | | (data & mask); | 269 | | (data & mask); |
270 | 270 | ||
271 | iowrite32(data, udc->hw_bank.regmap[reg]); | 271 | iowrite32(data, ci->hw_bank.regmap[reg]); |
272 | } | 272 | } |
273 | 273 | ||
274 | /** | 274 | /** |
@@ -278,12 +278,12 @@ static inline void hw_write(struct ci13xxx *udc, enum ci13xxx_regs reg, | |||
278 | * | 278 | * |
279 | * This function returns register contents | 279 | * This function returns register contents |
280 | */ | 280 | */ |
281 | static inline u32 hw_test_and_clear(struct ci13xxx *udc, enum ci13xxx_regs reg, | 281 | static inline u32 hw_test_and_clear(struct ci13xxx *ci, enum ci13xxx_regs reg, |
282 | u32 mask) | 282 | u32 mask) |
283 | { | 283 | { |
284 | u32 val = ioread32(udc->hw_bank.regmap[reg]) & mask; | 284 | u32 val = ioread32(ci->hw_bank.regmap[reg]) & mask; |
285 | 285 | ||
286 | iowrite32(val, udc->hw_bank.regmap[reg]); | 286 | iowrite32(val, ci->hw_bank.regmap[reg]); |
287 | return val; | 287 | return val; |
288 | } | 288 | } |
289 | 289 | ||
@@ -295,12 +295,12 @@ static inline u32 hw_test_and_clear(struct ci13xxx *udc, enum ci13xxx_regs reg, | |||
295 | * | 295 | * |
296 | * This function returns register contents | 296 | * This function returns register contents |
297 | */ | 297 | */ |
298 | static inline u32 hw_test_and_write(struct ci13xxx *udc, enum ci13xxx_regs reg, | 298 | static inline u32 hw_test_and_write(struct ci13xxx *ci, enum ci13xxx_regs reg, |
299 | u32 mask, u32 data) | 299 | u32 mask, u32 data) |
300 | { | 300 | { |
301 | u32 val = hw_read(udc, reg, ~0); | 301 | u32 val = hw_read(ci, reg, ~0); |
302 | 302 | ||
303 | hw_write(udc, reg, mask, data); | 303 | hw_write(ci, reg, mask, data); |
304 | return (val & mask) >> ffs_nr(mask); | 304 | return (val & mask) >> ffs_nr(mask); |
305 | } | 305 | } |
306 | 306 | ||
diff --git a/drivers/usb/chipidea/ci13xxx_msm.c b/drivers/usb/chipidea/ci13xxx_msm.c index 12c0dd6a300c..5a2fe5f9b6c3 100644 --- a/drivers/usb/chipidea/ci13xxx_msm.c +++ b/drivers/usb/chipidea/ci13xxx_msm.c | |||
@@ -15,11 +15,11 @@ | |||
15 | 15 | ||
16 | #include "ci.h" | 16 | #include "ci.h" |
17 | 17 | ||
18 | #define MSM_USB_BASE (udc->hw_bank.abs) | 18 | #define MSM_USB_BASE (ci->hw_bank.abs) |
19 | 19 | ||
20 | static void ci13xxx_msm_notify_event(struct ci13xxx *udc, unsigned event) | 20 | static void ci13xxx_msm_notify_event(struct ci13xxx *ci, unsigned event) |
21 | { | 21 | { |
22 | struct device *dev = udc->gadget.dev.parent; | 22 | struct device *dev = ci->gadget.dev.parent; |
23 | int val; | 23 | int val; |
24 | 24 | ||
25 | switch (event) { | 25 | switch (event) { |
@@ -34,13 +34,13 @@ static void ci13xxx_msm_notify_event(struct ci13xxx *udc, unsigned event) | |||
34 | * Put the transceiver in non-driving mode. Otherwise host | 34 | * Put the transceiver in non-driving mode. Otherwise host |
35 | * may not detect soft-disconnection. | 35 | * may not detect soft-disconnection. |
36 | */ | 36 | */ |
37 | val = usb_phy_io_read(udc->transceiver, ULPI_FUNC_CTRL); | 37 | val = usb_phy_io_read(ci->transceiver, ULPI_FUNC_CTRL); |
38 | val &= ~ULPI_FUNC_CTRL_OPMODE_MASK; | 38 | val &= ~ULPI_FUNC_CTRL_OPMODE_MASK; |
39 | val |= ULPI_FUNC_CTRL_OPMODE_NONDRIVING; | 39 | val |= ULPI_FUNC_CTRL_OPMODE_NONDRIVING; |
40 | usb_phy_io_write(udc->transceiver, val, ULPI_FUNC_CTRL); | 40 | usb_phy_io_write(ci->transceiver, val, ULPI_FUNC_CTRL); |
41 | break; | 41 | break; |
42 | default: | 42 | default: |
43 | dev_dbg(dev, "unknown ci13xxx_udc event\n"); | 43 | dev_dbg(dev, "unknown ci13xxx event\n"); |
44 | break; | 44 | break; |
45 | } | 45 | } |
46 | } | 46 | } |
diff --git a/drivers/usb/chipidea/debug.c b/drivers/usb/chipidea/debug.c index c4b3e15532db..c6f50a257565 100644 --- a/drivers/usb/chipidea/debug.c +++ b/drivers/usb/chipidea/debug.c | |||
@@ -68,15 +68,15 @@ void dbg_interrupt(u32 intmask) | |||
68 | * | 68 | * |
69 | * This function returns number of registers read | 69 | * This function returns number of registers read |
70 | */ | 70 | */ |
71 | static size_t hw_register_read(struct ci13xxx *udc, u32 *buf, size_t size) | 71 | static size_t hw_register_read(struct ci13xxx *ci, u32 *buf, size_t size) |
72 | { | 72 | { |
73 | unsigned i; | 73 | unsigned i; |
74 | 74 | ||
75 | if (size > udc->hw_bank.size) | 75 | if (size > ci->hw_bank.size) |
76 | size = udc->hw_bank.size; | 76 | size = ci->hw_bank.size; |
77 | 77 | ||
78 | for (i = 0; i < size; i++) | 78 | for (i = 0; i < size; i++) |
79 | buf[i] = hw_read(udc, i * sizeof(u32), ~0); | 79 | buf[i] = hw_read(ci, i * sizeof(u32), ~0); |
80 | 80 | ||
81 | return size; | 81 | return size; |
82 | } | 82 | } |
@@ -88,18 +88,18 @@ static size_t hw_register_read(struct ci13xxx *udc, u32 *buf, size_t size) | |||
88 | * | 88 | * |
89 | * This function returns an error code | 89 | * This function returns an error code |
90 | */ | 90 | */ |
91 | static int hw_register_write(struct ci13xxx *udc, u16 addr, u32 data) | 91 | static int hw_register_write(struct ci13xxx *ci, u16 addr, u32 data) |
92 | { | 92 | { |
93 | /* align */ | 93 | /* align */ |
94 | addr /= sizeof(u32); | 94 | addr /= sizeof(u32); |
95 | 95 | ||
96 | if (addr >= udc->hw_bank.size) | 96 | if (addr >= ci->hw_bank.size) |
97 | return -EINVAL; | 97 | return -EINVAL; |
98 | 98 | ||
99 | /* align */ | 99 | /* align */ |
100 | addr *= sizeof(u32); | 100 | addr *= sizeof(u32); |
101 | 101 | ||
102 | hw_write(udc, addr, ~0, data); | 102 | hw_write(ci, addr, ~0, data); |
103 | return 0; | 103 | return 0; |
104 | } | 104 | } |
105 | 105 | ||
@@ -110,13 +110,13 @@ static int hw_register_write(struct ci13xxx *udc, u16 addr, u32 data) | |||
110 | * | 110 | * |
111 | * This function returns an error code | 111 | * This function returns an error code |
112 | */ | 112 | */ |
113 | static int hw_intr_clear(struct ci13xxx *udc, int n) | 113 | static int hw_intr_clear(struct ci13xxx *ci, int n) |
114 | { | 114 | { |
115 | if (n >= REG_BITS) | 115 | if (n >= REG_BITS) |
116 | return -EINVAL; | 116 | return -EINVAL; |
117 | 117 | ||
118 | hw_write(udc, OP_USBINTR, BIT(n), 0); | 118 | hw_write(ci, OP_USBINTR, BIT(n), 0); |
119 | hw_write(udc, OP_USBSTS, BIT(n), BIT(n)); | 119 | hw_write(ci, OP_USBSTS, BIT(n), BIT(n)); |
120 | return 0; | 120 | return 0; |
121 | } | 121 | } |
122 | 122 | ||
@@ -127,15 +127,15 @@ static int hw_intr_clear(struct ci13xxx *udc, int n) | |||
127 | * | 127 | * |
128 | * This function returns an error code | 128 | * This function returns an error code |
129 | */ | 129 | */ |
130 | static int hw_intr_force(struct ci13xxx *udc, int n) | 130 | static int hw_intr_force(struct ci13xxx *ci, int n) |
131 | { | 131 | { |
132 | if (n >= REG_BITS) | 132 | if (n >= REG_BITS) |
133 | return -EINVAL; | 133 | return -EINVAL; |
134 | 134 | ||
135 | hw_write(udc, CAP_TESTMODE, TESTMODE_FORCE, TESTMODE_FORCE); | 135 | hw_write(ci, CAP_TESTMODE, TESTMODE_FORCE, TESTMODE_FORCE); |
136 | hw_write(udc, OP_USBINTR, BIT(n), BIT(n)); | 136 | hw_write(ci, OP_USBINTR, BIT(n), BIT(n)); |
137 | hw_write(udc, OP_USBSTS, BIT(n), BIT(n)); | 137 | hw_write(ci, OP_USBSTS, BIT(n), BIT(n)); |
138 | hw_write(udc, CAP_TESTMODE, TESTMODE_FORCE, 0); | 138 | hw_write(ci, CAP_TESTMODE, TESTMODE_FORCE, 0); |
139 | return 0; | 139 | return 0; |
140 | } | 140 | } |
141 | 141 | ||
@@ -147,12 +147,12 @@ static int hw_intr_force(struct ci13xxx *udc, int n) | |||
147 | static ssize_t show_device(struct device *dev, struct device_attribute *attr, | 147 | static ssize_t show_device(struct device *dev, struct device_attribute *attr, |
148 | char *buf) | 148 | char *buf) |
149 | { | 149 | { |
150 | struct ci13xxx *udc = container_of(dev, struct ci13xxx, gadget.dev); | 150 | struct ci13xxx *ci = container_of(dev, struct ci13xxx, gadget.dev); |
151 | struct usb_gadget *gadget = &udc->gadget; | 151 | struct usb_gadget *gadget = &ci->gadget; |
152 | int n = 0; | 152 | int n = 0; |
153 | 153 | ||
154 | if (attr == NULL || buf == NULL) { | 154 | if (attr == NULL || buf == NULL) { |
155 | dev_err(udc->dev, "[%s] EINVAL\n", __func__); | 155 | dev_err(ci->dev, "[%s] EINVAL\n", __func__); |
156 | return 0; | 156 | return 0; |
157 | } | 157 | } |
158 | 158 | ||
@@ -188,8 +188,8 @@ static DEVICE_ATTR(device, S_IRUSR, show_device, NULL); | |||
188 | static ssize_t show_driver(struct device *dev, struct device_attribute *attr, | 188 | static ssize_t show_driver(struct device *dev, struct device_attribute *attr, |
189 | char *buf) | 189 | char *buf) |
190 | { | 190 | { |
191 | struct ci13xxx *udc = container_of(dev, struct ci13xxx, gadget.dev); | 191 | struct ci13xxx *ci = container_of(dev, struct ci13xxx, gadget.dev); |
192 | struct usb_gadget_driver *driver = udc->driver; | 192 | struct usb_gadget_driver *driver = ci->driver; |
193 | int n = 0; | 193 | int n = 0; |
194 | 194 | ||
195 | if (attr == NULL || buf == NULL) { | 195 | if (attr == NULL || buf == NULL) { |
@@ -412,22 +412,22 @@ static DEVICE_ATTR(events, S_IRUSR | S_IWUSR, show_events, store_events); | |||
412 | static ssize_t show_inters(struct device *dev, struct device_attribute *attr, | 412 | static ssize_t show_inters(struct device *dev, struct device_attribute *attr, |
413 | char *buf) | 413 | char *buf) |
414 | { | 414 | { |
415 | struct ci13xxx *udc = container_of(dev, struct ci13xxx, gadget.dev); | 415 | struct ci13xxx *ci = container_of(dev, struct ci13xxx, gadget.dev); |
416 | unsigned long flags; | 416 | unsigned long flags; |
417 | u32 intr; | 417 | u32 intr; |
418 | unsigned i, j, n = 0; | 418 | unsigned i, j, n = 0; |
419 | 419 | ||
420 | if (attr == NULL || buf == NULL) { | 420 | if (attr == NULL || buf == NULL) { |
421 | dev_err(udc->dev, "[%s] EINVAL\n", __func__); | 421 | dev_err(ci->dev, "[%s] EINVAL\n", __func__); |
422 | return 0; | 422 | return 0; |
423 | } | 423 | } |
424 | 424 | ||
425 | spin_lock_irqsave(&udc->lock, flags); | 425 | spin_lock_irqsave(&ci->lock, flags); |
426 | 426 | ||
427 | /*n += scnprintf(buf + n, PAGE_SIZE - n, | 427 | /*n += scnprintf(buf + n, PAGE_SIZE - n, |
428 | "status = %08x\n", hw_read_intr_status(udc)); | 428 | "status = %08x\n", hw_read_intr_status(ci)); |
429 | n += scnprintf(buf + n, PAGE_SIZE - n, | 429 | n += scnprintf(buf + n, PAGE_SIZE - n, |
430 | "enable = %08x\n", hw_read_intr_enable(udc));*/ | 430 | "enable = %08x\n", hw_read_intr_enable(ci));*/ |
431 | 431 | ||
432 | n += scnprintf(buf + n, PAGE_SIZE - n, "*test = %d\n", | 432 | n += scnprintf(buf + n, PAGE_SIZE - n, "*test = %d\n", |
433 | isr_statistics.test); | 433 | isr_statistics.test); |
@@ -471,7 +471,7 @@ static ssize_t show_inters(struct device *dev, struct device_attribute *attr, | |||
471 | n += scnprintf(buf + n, PAGE_SIZE - n, "\n"); | 471 | n += scnprintf(buf + n, PAGE_SIZE - n, "\n"); |
472 | } | 472 | } |
473 | 473 | ||
474 | spin_unlock_irqrestore(&udc->lock, flags); | 474 | spin_unlock_irqrestore(&ci->lock, flags); |
475 | 475 | ||
476 | return n; | 476 | return n; |
477 | } | 477 | } |
@@ -485,31 +485,31 @@ static ssize_t show_inters(struct device *dev, struct device_attribute *attr, | |||
485 | static ssize_t store_inters(struct device *dev, struct device_attribute *attr, | 485 | static ssize_t store_inters(struct device *dev, struct device_attribute *attr, |
486 | const char *buf, size_t count) | 486 | const char *buf, size_t count) |
487 | { | 487 | { |
488 | struct ci13xxx *udc = container_of(dev, struct ci13xxx, gadget.dev); | 488 | struct ci13xxx *ci = container_of(dev, struct ci13xxx, gadget.dev); |
489 | unsigned long flags; | 489 | unsigned long flags; |
490 | unsigned en, bit; | 490 | unsigned en, bit; |
491 | 491 | ||
492 | if (attr == NULL || buf == NULL) { | 492 | if (attr == NULL || buf == NULL) { |
493 | dev_err(udc->dev, "EINVAL\n"); | 493 | dev_err(ci->dev, "EINVAL\n"); |
494 | goto done; | 494 | goto done; |
495 | } | 495 | } |
496 | 496 | ||
497 | if (sscanf(buf, "%u %u", &en, &bit) != 2 || en > 1) { | 497 | if (sscanf(buf, "%u %u", &en, &bit) != 2 || en > 1) { |
498 | dev_err(udc->dev, "<1|0> <bit>: enable|disable interrupt\n"); | 498 | dev_err(ci->dev, "<1|0> <bit>: enable|disable interrupt\n"); |
499 | goto done; | 499 | goto done; |
500 | } | 500 | } |
501 | 501 | ||
502 | spin_lock_irqsave(&udc->lock, flags); | 502 | spin_lock_irqsave(&ci->lock, flags); |
503 | if (en) { | 503 | if (en) { |
504 | if (hw_intr_force(udc, bit)) | 504 | if (hw_intr_force(ci, bit)) |
505 | dev_err(dev, "invalid bit number\n"); | 505 | dev_err(dev, "invalid bit number\n"); |
506 | else | 506 | else |
507 | isr_statistics.test++; | 507 | isr_statistics.test++; |
508 | } else { | 508 | } else { |
509 | if (hw_intr_clear(udc, bit)) | 509 | if (hw_intr_clear(ci, bit)) |
510 | dev_err(dev, "invalid bit number\n"); | 510 | dev_err(dev, "invalid bit number\n"); |
511 | } | 511 | } |
512 | spin_unlock_irqrestore(&udc->lock, flags); | 512 | spin_unlock_irqrestore(&ci->lock, flags); |
513 | 513 | ||
514 | done: | 514 | done: |
515 | return count; | 515 | return count; |
@@ -524,18 +524,18 @@ static DEVICE_ATTR(inters, S_IRUSR | S_IWUSR, show_inters, store_inters); | |||
524 | static ssize_t show_port_test(struct device *dev, | 524 | static ssize_t show_port_test(struct device *dev, |
525 | struct device_attribute *attr, char *buf) | 525 | struct device_attribute *attr, char *buf) |
526 | { | 526 | { |
527 | struct ci13xxx *udc = container_of(dev, struct ci13xxx, gadget.dev); | 527 | struct ci13xxx *ci = container_of(dev, struct ci13xxx, gadget.dev); |
528 | unsigned long flags; | 528 | unsigned long flags; |
529 | unsigned mode; | 529 | unsigned mode; |
530 | 530 | ||
531 | if (attr == NULL || buf == NULL) { | 531 | if (attr == NULL || buf == NULL) { |
532 | dev_err(udc->dev, "EINVAL\n"); | 532 | dev_err(ci->dev, "EINVAL\n"); |
533 | return 0; | 533 | return 0; |
534 | } | 534 | } |
535 | 535 | ||
536 | spin_lock_irqsave(&udc->lock, flags); | 536 | spin_lock_irqsave(&ci->lock, flags); |
537 | mode = hw_port_test_get(udc); | 537 | mode = hw_port_test_get(ci); |
538 | spin_unlock_irqrestore(&udc->lock, flags); | 538 | spin_unlock_irqrestore(&ci->lock, flags); |
539 | 539 | ||
540 | return scnprintf(buf, PAGE_SIZE, "mode = %u\n", mode); | 540 | return scnprintf(buf, PAGE_SIZE, "mode = %u\n", mode); |
541 | } | 541 | } |
@@ -549,24 +549,24 @@ static ssize_t store_port_test(struct device *dev, | |||
549 | struct device_attribute *attr, | 549 | struct device_attribute *attr, |
550 | const char *buf, size_t count) | 550 | const char *buf, size_t count) |
551 | { | 551 | { |
552 | struct ci13xxx *udc = container_of(dev, struct ci13xxx, gadget.dev); | 552 | struct ci13xxx *ci = container_of(dev, struct ci13xxx, gadget.dev); |
553 | unsigned long flags; | 553 | unsigned long flags; |
554 | unsigned mode; | 554 | unsigned mode; |
555 | 555 | ||
556 | if (attr == NULL || buf == NULL) { | 556 | if (attr == NULL || buf == NULL) { |
557 | dev_err(udc->dev, "[%s] EINVAL\n", __func__); | 557 | dev_err(ci->dev, "[%s] EINVAL\n", __func__); |
558 | goto done; | 558 | goto done; |
559 | } | 559 | } |
560 | 560 | ||
561 | if (sscanf(buf, "%u", &mode) != 1) { | 561 | if (sscanf(buf, "%u", &mode) != 1) { |
562 | dev_err(udc->dev, "<mode>: set port test mode"); | 562 | dev_err(ci->dev, "<mode>: set port test mode"); |
563 | goto done; | 563 | goto done; |
564 | } | 564 | } |
565 | 565 | ||
566 | spin_lock_irqsave(&udc->lock, flags); | 566 | spin_lock_irqsave(&ci->lock, flags); |
567 | if (hw_port_test_set(udc, mode)) | 567 | if (hw_port_test_set(ci, mode)) |
568 | dev_err(udc->dev, "invalid mode\n"); | 568 | dev_err(ci->dev, "invalid mode\n"); |
569 | spin_unlock_irqrestore(&udc->lock, flags); | 569 | spin_unlock_irqrestore(&ci->lock, flags); |
570 | 570 | ||
571 | done: | 571 | done: |
572 | return count; | 572 | return count; |
@@ -582,20 +582,20 @@ static DEVICE_ATTR(port_test, S_IRUSR | S_IWUSR, | |||
582 | static ssize_t show_qheads(struct device *dev, struct device_attribute *attr, | 582 | static ssize_t show_qheads(struct device *dev, struct device_attribute *attr, |
583 | char *buf) | 583 | char *buf) |
584 | { | 584 | { |
585 | struct ci13xxx *udc = container_of(dev, struct ci13xxx, gadget.dev); | 585 | struct ci13xxx *ci = container_of(dev, struct ci13xxx, gadget.dev); |
586 | unsigned long flags; | 586 | unsigned long flags; |
587 | unsigned i, j, n = 0; | 587 | unsigned i, j, n = 0; |
588 | 588 | ||
589 | if (attr == NULL || buf == NULL) { | 589 | if (attr == NULL || buf == NULL) { |
590 | dev_err(udc->dev, "[%s] EINVAL\n", __func__); | 590 | dev_err(ci->dev, "[%s] EINVAL\n", __func__); |
591 | return 0; | 591 | return 0; |
592 | } | 592 | } |
593 | 593 | ||
594 | spin_lock_irqsave(&udc->lock, flags); | 594 | spin_lock_irqsave(&ci->lock, flags); |
595 | for (i = 0; i < udc->hw_ep_max/2; i++) { | 595 | for (i = 0; i < ci->hw_ep_max/2; i++) { |
596 | struct ci13xxx_ep *mEpRx = &udc->ci13xxx_ep[i]; | 596 | struct ci13xxx_ep *mEpRx = &ci->ci13xxx_ep[i]; |
597 | struct ci13xxx_ep *mEpTx = | 597 | struct ci13xxx_ep *mEpTx = |
598 | &udc->ci13xxx_ep[i + udc->hw_ep_max/2]; | 598 | &ci->ci13xxx_ep[i + ci->hw_ep_max/2]; |
599 | n += scnprintf(buf + n, PAGE_SIZE - n, | 599 | n += scnprintf(buf + n, PAGE_SIZE - n, |
600 | "EP=%02i: RX=%08X TX=%08X\n", | 600 | "EP=%02i: RX=%08X TX=%08X\n", |
601 | i, (u32)mEpRx->qh.dma, (u32)mEpTx->qh.dma); | 601 | i, (u32)mEpRx->qh.dma, (u32)mEpTx->qh.dma); |
@@ -606,7 +606,7 @@ static ssize_t show_qheads(struct device *dev, struct device_attribute *attr, | |||
606 | *((u32 *)mEpTx->qh.ptr + j)); | 606 | *((u32 *)mEpTx->qh.ptr + j)); |
607 | } | 607 | } |
608 | } | 608 | } |
609 | spin_unlock_irqrestore(&udc->lock, flags); | 609 | spin_unlock_irqrestore(&ci->lock, flags); |
610 | 610 | ||
611 | return n; | 611 | return n; |
612 | } | 612 | } |
@@ -621,25 +621,25 @@ static DEVICE_ATTR(qheads, S_IRUSR, show_qheads, NULL); | |||
621 | static ssize_t show_registers(struct device *dev, | 621 | static ssize_t show_registers(struct device *dev, |
622 | struct device_attribute *attr, char *buf) | 622 | struct device_attribute *attr, char *buf) |
623 | { | 623 | { |
624 | struct ci13xxx *udc = container_of(dev, struct ci13xxx, gadget.dev); | 624 | struct ci13xxx *ci = container_of(dev, struct ci13xxx, gadget.dev); |
625 | unsigned long flags; | 625 | unsigned long flags; |
626 | u32 *dump; | 626 | u32 *dump; |
627 | unsigned i, k, n = 0; | 627 | unsigned i, k, n = 0; |
628 | 628 | ||
629 | if (attr == NULL || buf == NULL) { | 629 | if (attr == NULL || buf == NULL) { |
630 | dev_err(udc->dev, "[%s] EINVAL\n", __func__); | 630 | dev_err(ci->dev, "[%s] EINVAL\n", __func__); |
631 | return 0; | 631 | return 0; |
632 | } | 632 | } |
633 | 633 | ||
634 | dump = kmalloc(sizeof(u32) * DUMP_ENTRIES, GFP_KERNEL); | 634 | dump = kmalloc(sizeof(u32) * DUMP_ENTRIES, GFP_KERNEL); |
635 | if (!dump) { | 635 | if (!dump) { |
636 | dev_err(udc->dev, "%s: out of memory\n", __func__); | 636 | dev_err(ci->dev, "%s: out of memory\n", __func__); |
637 | return 0; | 637 | return 0; |
638 | } | 638 | } |
639 | 639 | ||
640 | spin_lock_irqsave(&udc->lock, flags); | 640 | spin_lock_irqsave(&ci->lock, flags); |
641 | k = hw_register_read(udc, dump, DUMP_ENTRIES); | 641 | k = hw_register_read(ci, dump, DUMP_ENTRIES); |
642 | spin_unlock_irqrestore(&udc->lock, flags); | 642 | spin_unlock_irqrestore(&ci->lock, flags); |
643 | 643 | ||
644 | for (i = 0; i < k; i++) { | 644 | for (i = 0; i < k; i++) { |
645 | n += scnprintf(buf + n, PAGE_SIZE - n, | 645 | n += scnprintf(buf + n, PAGE_SIZE - n, |
@@ -660,24 +660,24 @@ static ssize_t store_registers(struct device *dev, | |||
660 | struct device_attribute *attr, | 660 | struct device_attribute *attr, |
661 | const char *buf, size_t count) | 661 | const char *buf, size_t count) |
662 | { | 662 | { |
663 | struct ci13xxx *udc = container_of(dev, struct ci13xxx, gadget.dev); | 663 | struct ci13xxx *ci = container_of(dev, struct ci13xxx, gadget.dev); |
664 | unsigned long addr, data, flags; | 664 | unsigned long addr, data, flags; |
665 | 665 | ||
666 | if (attr == NULL || buf == NULL) { | 666 | if (attr == NULL || buf == NULL) { |
667 | dev_err(udc->dev, "[%s] EINVAL\n", __func__); | 667 | dev_err(ci->dev, "[%s] EINVAL\n", __func__); |
668 | goto done; | 668 | goto done; |
669 | } | 669 | } |
670 | 670 | ||
671 | if (sscanf(buf, "%li %li", &addr, &data) != 2) { | 671 | if (sscanf(buf, "%li %li", &addr, &data) != 2) { |
672 | dev_err(udc->dev, | 672 | dev_err(ci->dev, |
673 | "<addr> <data>: write data to register address\n"); | 673 | "<addr> <data>: write data to register address\n"); |
674 | goto done; | 674 | goto done; |
675 | } | 675 | } |
676 | 676 | ||
677 | spin_lock_irqsave(&udc->lock, flags); | 677 | spin_lock_irqsave(&ci->lock, flags); |
678 | if (hw_register_write(udc, addr, data)) | 678 | if (hw_register_write(ci, addr, data)) |
679 | dev_err(udc->dev, "invalid address range\n"); | 679 | dev_err(ci->dev, "invalid address range\n"); |
680 | spin_unlock_irqrestore(&udc->lock, flags); | 680 | spin_unlock_irqrestore(&ci->lock, flags); |
681 | 681 | ||
682 | done: | 682 | done: |
683 | return count; | 683 | return count; |
@@ -693,34 +693,34 @@ static DEVICE_ATTR(registers, S_IRUSR | S_IWUSR, | |||
693 | static ssize_t show_requests(struct device *dev, struct device_attribute *attr, | 693 | static ssize_t show_requests(struct device *dev, struct device_attribute *attr, |
694 | char *buf) | 694 | char *buf) |
695 | { | 695 | { |
696 | struct ci13xxx *udc = container_of(dev, struct ci13xxx, gadget.dev); | 696 | struct ci13xxx *ci = container_of(dev, struct ci13xxx, gadget.dev); |
697 | unsigned long flags; | 697 | unsigned long flags; |
698 | struct list_head *ptr = NULL; | 698 | struct list_head *ptr = NULL; |
699 | struct ci13xxx_req *req = NULL; | 699 | struct ci13xxx_req *req = NULL; |
700 | unsigned i, j, n = 0, qSize = sizeof(struct ci13xxx_td)/sizeof(u32); | 700 | unsigned i, j, n = 0, qSize = sizeof(struct ci13xxx_td)/sizeof(u32); |
701 | 701 | ||
702 | if (attr == NULL || buf == NULL) { | 702 | if (attr == NULL || buf == NULL) { |
703 | dev_err(udc->dev, "[%s] EINVAL\n", __func__); | 703 | dev_err(ci->dev, "[%s] EINVAL\n", __func__); |
704 | return 0; | 704 | return 0; |
705 | } | 705 | } |
706 | 706 | ||
707 | spin_lock_irqsave(&udc->lock, flags); | 707 | spin_lock_irqsave(&ci->lock, flags); |
708 | for (i = 0; i < udc->hw_ep_max; i++) | 708 | for (i = 0; i < ci->hw_ep_max; i++) |
709 | list_for_each(ptr, &udc->ci13xxx_ep[i].qh.queue) | 709 | list_for_each(ptr, &ci->ci13xxx_ep[i].qh.queue) |
710 | { | 710 | { |
711 | req = list_entry(ptr, struct ci13xxx_req, queue); | 711 | req = list_entry(ptr, struct ci13xxx_req, queue); |
712 | 712 | ||
713 | n += scnprintf(buf + n, PAGE_SIZE - n, | 713 | n += scnprintf(buf + n, PAGE_SIZE - n, |
714 | "EP=%02i: TD=%08X %s\n", | 714 | "EP=%02i: TD=%08X %s\n", |
715 | i % udc->hw_ep_max/2, (u32)req->dma, | 715 | i % ci->hw_ep_max/2, (u32)req->dma, |
716 | ((i < udc->hw_ep_max/2) ? "RX" : "TX")); | 716 | ((i < ci->hw_ep_max/2) ? "RX" : "TX")); |
717 | 717 | ||
718 | for (j = 0; j < qSize; j++) | 718 | for (j = 0; j < qSize; j++) |
719 | n += scnprintf(buf + n, PAGE_SIZE - n, | 719 | n += scnprintf(buf + n, PAGE_SIZE - n, |
720 | " %04X: %08X\n", j, | 720 | " %04X: %08X\n", j, |
721 | *((u32 *)req->ptr + j)); | 721 | *((u32 *)req->ptr + j)); |
722 | } | 722 | } |
723 | spin_unlock_irqrestore(&udc->lock, flags); | 723 | spin_unlock_irqrestore(&ci->lock, flags); |
724 | 724 | ||
725 | return n; | 725 | return n; |
726 | } | 726 | } |
diff --git a/drivers/usb/chipidea/udc.c b/drivers/usb/chipidea/udc.c index 3094c85dc0b5..ba8284e2a237 100644 --- a/drivers/usb/chipidea/udc.c +++ b/drivers/usb/chipidea/udc.c | |||
@@ -67,11 +67,11 @@ static inline int hw_ep_bit(int num, int dir) | |||
67 | return num + (dir ? 16 : 0); | 67 | return num + (dir ? 16 : 0); |
68 | } | 68 | } |
69 | 69 | ||
70 | static inline int ep_to_bit(struct ci13xxx *udc, int n) | 70 | static inline int ep_to_bit(struct ci13xxx *ci, int n) |
71 | { | 71 | { |
72 | int fill = 16 - udc->hw_ep_max / 2; | 72 | int fill = 16 - ci->hw_ep_max / 2; |
73 | 73 | ||
74 | if (n >= udc->hw_ep_max / 2) | 74 | if (n >= ci->hw_ep_max / 2) |
75 | n += fill; | 75 | n += fill; |
76 | 76 | ||
77 | return n; | 77 | return n; |
@@ -84,17 +84,17 @@ static inline int ep_to_bit(struct ci13xxx *udc, int n) | |||
84 | * | 84 | * |
85 | * This function returns an error code | 85 | * This function returns an error code |
86 | */ | 86 | */ |
87 | static int hw_device_state(struct ci13xxx *udc, u32 dma) | 87 | static int hw_device_state(struct ci13xxx *ci, u32 dma) |
88 | { | 88 | { |
89 | if (dma) { | 89 | if (dma) { |
90 | hw_write(udc, OP_ENDPTLISTADDR, ~0, dma); | 90 | hw_write(ci, OP_ENDPTLISTADDR, ~0, dma); |
91 | /* interrupt, error, port change, reset, sleep/suspend */ | 91 | /* interrupt, error, port change, reset, sleep/suspend */ |
92 | hw_write(udc, OP_USBINTR, ~0, | 92 | hw_write(ci, OP_USBINTR, ~0, |
93 | USBi_UI|USBi_UEI|USBi_PCI|USBi_URI|USBi_SLI); | 93 | USBi_UI|USBi_UEI|USBi_PCI|USBi_URI|USBi_SLI); |
94 | hw_write(udc, OP_USBCMD, USBCMD_RS, USBCMD_RS); | 94 | hw_write(ci, OP_USBCMD, USBCMD_RS, USBCMD_RS); |
95 | } else { | 95 | } else { |
96 | hw_write(udc, OP_USBCMD, USBCMD_RS, 0); | 96 | hw_write(ci, OP_USBCMD, USBCMD_RS, 0); |
97 | hw_write(udc, OP_USBINTR, ~0, 0); | 97 | hw_write(ci, OP_USBINTR, ~0, 0); |
98 | } | 98 | } |
99 | return 0; | 99 | return 0; |
100 | } | 100 | } |
@@ -106,16 +106,16 @@ static int hw_device_state(struct ci13xxx *udc, u32 dma) | |||
106 | * | 106 | * |
107 | * This function returns an error code | 107 | * This function returns an error code |
108 | */ | 108 | */ |
109 | static int hw_ep_flush(struct ci13xxx *udc, int num, int dir) | 109 | static int hw_ep_flush(struct ci13xxx *ci, int num, int dir) |
110 | { | 110 | { |
111 | int n = hw_ep_bit(num, dir); | 111 | int n = hw_ep_bit(num, dir); |
112 | 112 | ||
113 | do { | 113 | do { |
114 | /* flush any pending transfer */ | 114 | /* flush any pending transfer */ |
115 | hw_write(udc, OP_ENDPTFLUSH, BIT(n), BIT(n)); | 115 | hw_write(ci, OP_ENDPTFLUSH, BIT(n), BIT(n)); |
116 | while (hw_read(udc, OP_ENDPTFLUSH, BIT(n))) | 116 | while (hw_read(ci, OP_ENDPTFLUSH, BIT(n))) |
117 | cpu_relax(); | 117 | cpu_relax(); |
118 | } while (hw_read(udc, OP_ENDPTSTAT, BIT(n))); | 118 | } while (hw_read(ci, OP_ENDPTSTAT, BIT(n))); |
119 | 119 | ||
120 | return 0; | 120 | return 0; |
121 | } | 121 | } |
@@ -127,10 +127,10 @@ static int hw_ep_flush(struct ci13xxx *udc, int num, int dir) | |||
127 | * | 127 | * |
128 | * This function returns an error code | 128 | * This function returns an error code |
129 | */ | 129 | */ |
130 | static int hw_ep_disable(struct ci13xxx *udc, int num, int dir) | 130 | static int hw_ep_disable(struct ci13xxx *ci, int num, int dir) |
131 | { | 131 | { |
132 | hw_ep_flush(udc, num, dir); | 132 | hw_ep_flush(ci, num, dir); |
133 | hw_write(udc, OP_ENDPTCTRL + num, | 133 | hw_write(ci, OP_ENDPTCTRL + num, |
134 | dir ? ENDPTCTRL_TXE : ENDPTCTRL_RXE, 0); | 134 | dir ? ENDPTCTRL_TXE : ENDPTCTRL_RXE, 0); |
135 | return 0; | 135 | return 0; |
136 | } | 136 | } |
@@ -143,7 +143,7 @@ static int hw_ep_disable(struct ci13xxx *udc, int num, int dir) | |||
143 | * | 143 | * |
144 | * This function returns an error code | 144 | * This function returns an error code |
145 | */ | 145 | */ |
146 | static int hw_ep_enable(struct ci13xxx *udc, int num, int dir, int type) | 146 | static int hw_ep_enable(struct ci13xxx *ci, int num, int dir, int type) |
147 | { | 147 | { |
148 | u32 mask, data; | 148 | u32 mask, data; |
149 | 149 | ||
@@ -166,7 +166,7 @@ static int hw_ep_enable(struct ci13xxx *udc, int num, int dir, int type) | |||
166 | mask |= ENDPTCTRL_RXE; /* enable */ | 166 | mask |= ENDPTCTRL_RXE; /* enable */ |
167 | data |= ENDPTCTRL_RXE; | 167 | data |= ENDPTCTRL_RXE; |
168 | } | 168 | } |
169 | hw_write(udc, OP_ENDPTCTRL + num, mask, data); | 169 | hw_write(ci, OP_ENDPTCTRL + num, mask, data); |
170 | return 0; | 170 | return 0; |
171 | } | 171 | } |
172 | 172 | ||
@@ -177,11 +177,11 @@ static int hw_ep_enable(struct ci13xxx *udc, int num, int dir, int type) | |||
177 | * | 177 | * |
178 | * This function returns 1 if endpoint halted | 178 | * This function returns 1 if endpoint halted |
179 | */ | 179 | */ |
180 | static int hw_ep_get_halt(struct ci13xxx *udc, int num, int dir) | 180 | static int hw_ep_get_halt(struct ci13xxx *ci, int num, int dir) |
181 | { | 181 | { |
182 | u32 mask = dir ? ENDPTCTRL_TXS : ENDPTCTRL_RXS; | 182 | u32 mask = dir ? ENDPTCTRL_TXS : ENDPTCTRL_RXS; |
183 | 183 | ||
184 | return hw_read(udc, OP_ENDPTCTRL + num, mask) ? 1 : 0; | 184 | return hw_read(ci, OP_ENDPTCTRL + num, mask) ? 1 : 0; |
185 | } | 185 | } |
186 | 186 | ||
187 | /** | 187 | /** |
@@ -191,10 +191,10 @@ static int hw_ep_get_halt(struct ci13xxx *udc, int num, int dir) | |||
191 | * | 191 | * |
192 | * This function returns setup status | 192 | * This function returns setup status |
193 | */ | 193 | */ |
194 | static int hw_test_and_clear_setup_status(struct ci13xxx *udc, int n) | 194 | static int hw_test_and_clear_setup_status(struct ci13xxx *ci, int n) |
195 | { | 195 | { |
196 | n = ep_to_bit(udc, n); | 196 | n = ep_to_bit(ci, n); |
197 | return hw_test_and_clear(udc, OP_ENDPTSETUPSTAT, BIT(n)); | 197 | return hw_test_and_clear(ci, OP_ENDPTSETUPSTAT, BIT(n)); |
198 | } | 198 | } |
199 | 199 | ||
200 | /** | 200 | /** |
@@ -205,18 +205,18 @@ static int hw_test_and_clear_setup_status(struct ci13xxx *udc, int n) | |||
205 | * | 205 | * |
206 | * This function returns an error code | 206 | * This function returns an error code |
207 | */ | 207 | */ |
208 | static int hw_ep_prime(struct ci13xxx *udc, int num, int dir, int is_ctrl) | 208 | static int hw_ep_prime(struct ci13xxx *ci, int num, int dir, int is_ctrl) |
209 | { | 209 | { |
210 | int n = hw_ep_bit(num, dir); | 210 | int n = hw_ep_bit(num, dir); |
211 | 211 | ||
212 | if (is_ctrl && dir == RX && hw_read(udc, OP_ENDPTSETUPSTAT, BIT(num))) | 212 | if (is_ctrl && dir == RX && hw_read(ci, OP_ENDPTSETUPSTAT, BIT(num))) |
213 | return -EAGAIN; | 213 | return -EAGAIN; |
214 | 214 | ||
215 | hw_write(udc, OP_ENDPTPRIME, BIT(n), BIT(n)); | 215 | hw_write(ci, OP_ENDPTPRIME, BIT(n), BIT(n)); |
216 | 216 | ||
217 | while (hw_read(udc, OP_ENDPTPRIME, BIT(n))) | 217 | while (hw_read(ci, OP_ENDPTPRIME, BIT(n))) |
218 | cpu_relax(); | 218 | cpu_relax(); |
219 | if (is_ctrl && dir == RX && hw_read(udc, OP_ENDPTSETUPSTAT, BIT(num))) | 219 | if (is_ctrl && dir == RX && hw_read(ci, OP_ENDPTSETUPSTAT, BIT(num))) |
220 | return -EAGAIN; | 220 | return -EAGAIN; |
221 | 221 | ||
222 | /* status shoult be tested according with manual but it doesn't work */ | 222 | /* status shoult be tested according with manual but it doesn't work */ |
@@ -232,7 +232,7 @@ static int hw_ep_prime(struct ci13xxx *udc, int num, int dir, int is_ctrl) | |||
232 | * | 232 | * |
233 | * This function returns an error code | 233 | * This function returns an error code |
234 | */ | 234 | */ |
235 | static int hw_ep_set_halt(struct ci13xxx *udc, int num, int dir, int value) | 235 | static int hw_ep_set_halt(struct ci13xxx *ci, int num, int dir, int value) |
236 | { | 236 | { |
237 | if (value != 0 && value != 1) | 237 | if (value != 0 && value != 1) |
238 | return -EINVAL; | 238 | return -EINVAL; |
@@ -243,9 +243,9 @@ static int hw_ep_set_halt(struct ci13xxx *udc, int num, int dir, int value) | |||
243 | u32 mask_xr = dir ? ENDPTCTRL_TXR : ENDPTCTRL_RXR; | 243 | u32 mask_xr = dir ? ENDPTCTRL_TXR : ENDPTCTRL_RXR; |
244 | 244 | ||
245 | /* data toggle - reserved for EP0 but it's in ESS */ | 245 | /* data toggle - reserved for EP0 but it's in ESS */ |
246 | hw_write(udc, reg, mask_xs|mask_xr, | 246 | hw_write(ci, reg, mask_xs|mask_xr, |
247 | value ? mask_xs : mask_xr); | 247 | value ? mask_xs : mask_xr); |
248 | } while (value != hw_ep_get_halt(udc, num, dir)); | 248 | } while (value != hw_ep_get_halt(ci, num, dir)); |
249 | 249 | ||
250 | return 0; | 250 | return 0; |
251 | } | 251 | } |
@@ -255,10 +255,10 @@ static int hw_ep_set_halt(struct ci13xxx *udc, int num, int dir, int value) | |||
255 | * | 255 | * |
256 | * This function returns true if high speed port | 256 | * This function returns true if high speed port |
257 | */ | 257 | */ |
258 | static int hw_port_is_high_speed(struct ci13xxx *udc) | 258 | static int hw_port_is_high_speed(struct ci13xxx *ci) |
259 | { | 259 | { |
260 | return udc->hw_bank.lpm ? hw_read(udc, OP_DEVLC, DEVLC_PSPD) : | 260 | return ci->hw_bank.lpm ? hw_read(ci, OP_DEVLC, DEVLC_PSPD) : |
261 | hw_read(udc, OP_PORTSC, PORTSC_HSP); | 261 | hw_read(ci, OP_PORTSC, PORTSC_HSP); |
262 | } | 262 | } |
263 | 263 | ||
264 | /** | 264 | /** |
@@ -266,9 +266,9 @@ static int hw_port_is_high_speed(struct ci13xxx *udc) | |||
266 | * | 266 | * |
267 | * This function returns register data | 267 | * This function returns register data |
268 | */ | 268 | */ |
269 | static u32 hw_read_intr_enable(struct ci13xxx *udc) | 269 | static u32 hw_read_intr_enable(struct ci13xxx *ci) |
270 | { | 270 | { |
271 | return hw_read(udc, OP_USBINTR, ~0); | 271 | return hw_read(ci, OP_USBINTR, ~0); |
272 | } | 272 | } |
273 | 273 | ||
274 | /** | 274 | /** |
@@ -276,9 +276,9 @@ static u32 hw_read_intr_enable(struct ci13xxx *udc) | |||
276 | * | 276 | * |
277 | * This function returns register data | 277 | * This function returns register data |
278 | */ | 278 | */ |
279 | static u32 hw_read_intr_status(struct ci13xxx *udc) | 279 | static u32 hw_read_intr_status(struct ci13xxx *ci) |
280 | { | 280 | { |
281 | return hw_read(udc, OP_USBSTS, ~0); | 281 | return hw_read(ci, OP_USBSTS, ~0); |
282 | } | 282 | } |
283 | 283 | ||
284 | /** | 284 | /** |
@@ -288,10 +288,10 @@ static u32 hw_read_intr_status(struct ci13xxx *udc) | |||
288 | * | 288 | * |
289 | * This function returns complete status | 289 | * This function returns complete status |
290 | */ | 290 | */ |
291 | static int hw_test_and_clear_complete(struct ci13xxx *udc, int n) | 291 | static int hw_test_and_clear_complete(struct ci13xxx *ci, int n) |
292 | { | 292 | { |
293 | n = ep_to_bit(udc, n); | 293 | n = ep_to_bit(ci, n); |
294 | return hw_test_and_clear(udc, OP_ENDPTCOMPLETE, BIT(n)); | 294 | return hw_test_and_clear(ci, OP_ENDPTCOMPLETE, BIT(n)); |
295 | } | 295 | } |
296 | 296 | ||
297 | /** | 297 | /** |
@@ -300,11 +300,11 @@ static int hw_test_and_clear_complete(struct ci13xxx *udc, int n) | |||
300 | * | 300 | * |
301 | * This function returns active interrutps | 301 | * This function returns active interrutps |
302 | */ | 302 | */ |
303 | static u32 hw_test_and_clear_intr_active(struct ci13xxx *udc) | 303 | static u32 hw_test_and_clear_intr_active(struct ci13xxx *ci) |
304 | { | 304 | { |
305 | u32 reg = hw_read_intr_status(udc) & hw_read_intr_enable(udc); | 305 | u32 reg = hw_read_intr_status(ci) & hw_read_intr_enable(ci); |
306 | 306 | ||
307 | hw_write(udc, OP_USBSTS, ~0, reg); | 307 | hw_write(ci, OP_USBSTS, ~0, reg); |
308 | return reg; | 308 | return reg; |
309 | } | 309 | } |
310 | 310 | ||
@@ -314,9 +314,9 @@ static u32 hw_test_and_clear_intr_active(struct ci13xxx *udc) | |||
314 | * | 314 | * |
315 | * This function returns guard value | 315 | * This function returns guard value |
316 | */ | 316 | */ |
317 | static int hw_test_and_clear_setup_guard(struct ci13xxx *udc) | 317 | static int hw_test_and_clear_setup_guard(struct ci13xxx *ci) |
318 | { | 318 | { |
319 | return hw_test_and_write(udc, OP_USBCMD, USBCMD_SUTW, 0); | 319 | return hw_test_and_write(ci, OP_USBCMD, USBCMD_SUTW, 0); |
320 | } | 320 | } |
321 | 321 | ||
322 | /** | 322 | /** |
@@ -325,9 +325,9 @@ static int hw_test_and_clear_setup_guard(struct ci13xxx *udc) | |||
325 | * | 325 | * |
326 | * This function returns guard value | 326 | * This function returns guard value |
327 | */ | 327 | */ |
328 | static int hw_test_and_set_setup_guard(struct ci13xxx *udc) | 328 | static int hw_test_and_set_setup_guard(struct ci13xxx *ci) |
329 | { | 329 | { |
330 | return hw_test_and_write(udc, OP_USBCMD, USBCMD_SUTW, USBCMD_SUTW); | 330 | return hw_test_and_write(ci, OP_USBCMD, USBCMD_SUTW, USBCMD_SUTW); |
331 | } | 331 | } |
332 | 332 | ||
333 | /** | 333 | /** |
@@ -337,9 +337,9 @@ static int hw_test_and_set_setup_guard(struct ci13xxx *udc) | |||
337 | * This function explicitly sets the address, without the "USBADRA" (advance) | 337 | * This function explicitly sets the address, without the "USBADRA" (advance) |
338 | * feature, which is not supported by older versions of the controller. | 338 | * feature, which is not supported by older versions of the controller. |
339 | */ | 339 | */ |
340 | static void hw_usb_set_address(struct ci13xxx *udc, u8 value) | 340 | static void hw_usb_set_address(struct ci13xxx *ci, u8 value) |
341 | { | 341 | { |
342 | hw_write(udc, OP_DEVICEADDR, DEVICEADDR_USBADR, | 342 | hw_write(ci, OP_DEVICEADDR, DEVICEADDR_USBADR, |
343 | value << ffs_nr(DEVICEADDR_USBADR)); | 343 | value << ffs_nr(DEVICEADDR_USBADR)); |
344 | } | 344 | } |
345 | 345 | ||
@@ -349,21 +349,21 @@ static void hw_usb_set_address(struct ci13xxx *udc, u8 value) | |||
349 | * | 349 | * |
350 | * This function returns an error code | 350 | * This function returns an error code |
351 | */ | 351 | */ |
352 | static int hw_usb_reset(struct ci13xxx *udc) | 352 | static int hw_usb_reset(struct ci13xxx *ci) |
353 | { | 353 | { |
354 | hw_usb_set_address(udc, 0); | 354 | hw_usb_set_address(ci, 0); |
355 | 355 | ||
356 | /* ESS flushes only at end?!? */ | 356 | /* ESS flushes only at end?!? */ |
357 | hw_write(udc, OP_ENDPTFLUSH, ~0, ~0); | 357 | hw_write(ci, OP_ENDPTFLUSH, ~0, ~0); |
358 | 358 | ||
359 | /* clear setup token semaphores */ | 359 | /* clear setup token semaphores */ |
360 | hw_write(udc, OP_ENDPTSETUPSTAT, 0, 0); | 360 | hw_write(ci, OP_ENDPTSETUPSTAT, 0, 0); |
361 | 361 | ||
362 | /* clear complete status */ | 362 | /* clear complete status */ |
363 | hw_write(udc, OP_ENDPTCOMPLETE, 0, 0); | 363 | hw_write(ci, OP_ENDPTCOMPLETE, 0, 0); |
364 | 364 | ||
365 | /* wait until all bits cleared */ | 365 | /* wait until all bits cleared */ |
366 | while (hw_read(udc, OP_ENDPTPRIME, ~0)) | 366 | while (hw_read(ci, OP_ENDPTPRIME, ~0)) |
367 | udelay(10); /* not RTOS friendly */ | 367 | udelay(10); /* not RTOS friendly */ |
368 | 368 | ||
369 | /* reset all endpoints ? */ | 369 | /* reset all endpoints ? */ |
@@ -395,7 +395,7 @@ static inline u8 _usb_addr(struct ci13xxx_ep *ep) | |||
395 | */ | 395 | */ |
396 | static int _hardware_enqueue(struct ci13xxx_ep *mEp, struct ci13xxx_req *mReq) | 396 | static int _hardware_enqueue(struct ci13xxx_ep *mEp, struct ci13xxx_req *mReq) |
397 | { | 397 | { |
398 | struct ci13xxx *udc = mEp->udc; | 398 | struct ci13xxx *ci = mEp->ci; |
399 | unsigned i; | 399 | unsigned i; |
400 | int ret = 0; | 400 | int ret = 0; |
401 | unsigned length = mReq->req.length; | 401 | unsigned length = mReq->req.length; |
@@ -418,7 +418,7 @@ static int _hardware_enqueue(struct ci13xxx_ep *mEp, struct ci13xxx_req *mReq) | |||
418 | if (!mReq->req.no_interrupt) | 418 | if (!mReq->req.no_interrupt) |
419 | mReq->zptr->token |= TD_IOC; | 419 | mReq->zptr->token |= TD_IOC; |
420 | } | 420 | } |
421 | ret = usb_gadget_map_request(&udc->gadget, &mReq->req, mEp->dir); | 421 | ret = usb_gadget_map_request(&ci->gadget, &mReq->req, mEp->dir); |
422 | if (ret) | 422 | if (ret) |
423 | return ret; | 423 | return ret; |
424 | 424 | ||
@@ -454,13 +454,13 @@ static int _hardware_enqueue(struct ci13xxx_ep *mEp, struct ci13xxx_req *mReq) | |||
454 | else | 454 | else |
455 | mReqPrev->ptr->next = mReq->dma & TD_ADDR_MASK; | 455 | mReqPrev->ptr->next = mReq->dma & TD_ADDR_MASK; |
456 | wmb(); | 456 | wmb(); |
457 | if (hw_read(udc, OP_ENDPTPRIME, BIT(n))) | 457 | if (hw_read(ci, OP_ENDPTPRIME, BIT(n))) |
458 | goto done; | 458 | goto done; |
459 | do { | 459 | do { |
460 | hw_write(udc, OP_USBCMD, USBCMD_ATDTW, USBCMD_ATDTW); | 460 | hw_write(ci, OP_USBCMD, USBCMD_ATDTW, USBCMD_ATDTW); |
461 | tmp_stat = hw_read(udc, OP_ENDPTSTAT, BIT(n)); | 461 | tmp_stat = hw_read(ci, OP_ENDPTSTAT, BIT(n)); |
462 | } while (!hw_read(udc, OP_USBCMD, USBCMD_ATDTW)); | 462 | } while (!hw_read(ci, OP_USBCMD, USBCMD_ATDTW)); |
463 | hw_write(udc, OP_USBCMD, USBCMD_ATDTW, 0); | 463 | hw_write(ci, OP_USBCMD, USBCMD_ATDTW, 0); |
464 | if (tmp_stat) | 464 | if (tmp_stat) |
465 | goto done; | 465 | goto done; |
466 | } | 466 | } |
@@ -472,7 +472,7 @@ static int _hardware_enqueue(struct ci13xxx_ep *mEp, struct ci13xxx_req *mReq) | |||
472 | 472 | ||
473 | wmb(); /* synchronize before ep prime */ | 473 | wmb(); /* synchronize before ep prime */ |
474 | 474 | ||
475 | ret = hw_ep_prime(udc, mEp->num, mEp->dir, | 475 | ret = hw_ep_prime(ci, mEp->num, mEp->dir, |
476 | mEp->type == USB_ENDPOINT_XFER_CONTROL); | 476 | mEp->type == USB_ENDPOINT_XFER_CONTROL); |
477 | done: | 477 | done: |
478 | return ret; | 478 | return ret; |
@@ -502,7 +502,7 @@ static int _hardware_dequeue(struct ci13xxx_ep *mEp, struct ci13xxx_req *mReq) | |||
502 | 502 | ||
503 | mReq->req.status = 0; | 503 | mReq->req.status = 0; |
504 | 504 | ||
505 | usb_gadget_unmap_request(&mEp->udc->gadget, &mReq->req, mEp->dir); | 505 | usb_gadget_unmap_request(&mEp->ci->gadget, &mReq->req, mEp->dir); |
506 | 506 | ||
507 | mReq->req.status = mReq->ptr->token & TD_STATUS; | 507 | mReq->req.status = mReq->ptr->token & TD_STATUS; |
508 | if ((TD_STATUS_HALTED & mReq->req.status) != 0) | 508 | if ((TD_STATUS_HALTED & mReq->req.status) != 0) |
@@ -534,7 +534,7 @@ __acquires(mEp->lock) | |||
534 | if (mEp == NULL) | 534 | if (mEp == NULL) |
535 | return -EINVAL; | 535 | return -EINVAL; |
536 | 536 | ||
537 | hw_ep_flush(mEp->udc, mEp->num, mEp->dir); | 537 | hw_ep_flush(mEp->ci, mEp->num, mEp->dir); |
538 | 538 | ||
539 | while (!list_empty(&mEp->qh.queue)) { | 539 | while (!list_empty(&mEp->qh.queue)) { |
540 | 540 | ||
@@ -563,33 +563,33 @@ __acquires(mEp->lock) | |||
563 | static int _gadget_stop_activity(struct usb_gadget *gadget) | 563 | static int _gadget_stop_activity(struct usb_gadget *gadget) |
564 | { | 564 | { |
565 | struct usb_ep *ep; | 565 | struct usb_ep *ep; |
566 | struct ci13xxx *udc = container_of(gadget, struct ci13xxx, gadget); | 566 | struct ci13xxx *ci = container_of(gadget, struct ci13xxx, gadget); |
567 | unsigned long flags; | 567 | unsigned long flags; |
568 | 568 | ||
569 | spin_lock_irqsave(&udc->lock, flags); | 569 | spin_lock_irqsave(&ci->lock, flags); |
570 | udc->gadget.speed = USB_SPEED_UNKNOWN; | 570 | ci->gadget.speed = USB_SPEED_UNKNOWN; |
571 | udc->remote_wakeup = 0; | 571 | ci->remote_wakeup = 0; |
572 | udc->suspended = 0; | 572 | ci->suspended = 0; |
573 | spin_unlock_irqrestore(&udc->lock, flags); | 573 | spin_unlock_irqrestore(&ci->lock, flags); |
574 | 574 | ||
575 | /* flush all endpoints */ | 575 | /* flush all endpoints */ |
576 | gadget_for_each_ep(ep, gadget) { | 576 | gadget_for_each_ep(ep, gadget) { |
577 | usb_ep_fifo_flush(ep); | 577 | usb_ep_fifo_flush(ep); |
578 | } | 578 | } |
579 | usb_ep_fifo_flush(&udc->ep0out->ep); | 579 | usb_ep_fifo_flush(&ci->ep0out->ep); |
580 | usb_ep_fifo_flush(&udc->ep0in->ep); | 580 | usb_ep_fifo_flush(&ci->ep0in->ep); |
581 | 581 | ||
582 | if (udc->driver) | 582 | if (ci->driver) |
583 | udc->driver->disconnect(gadget); | 583 | ci->driver->disconnect(gadget); |
584 | 584 | ||
585 | /* make sure to disable all endpoints */ | 585 | /* make sure to disable all endpoints */ |
586 | gadget_for_each_ep(ep, gadget) { | 586 | gadget_for_each_ep(ep, gadget) { |
587 | usb_ep_disable(ep); | 587 | usb_ep_disable(ep); |
588 | } | 588 | } |
589 | 589 | ||
590 | if (udc->status != NULL) { | 590 | if (ci->status != NULL) { |
591 | usb_ep_free_request(&udc->ep0in->ep, udc->status); | 591 | usb_ep_free_request(&ci->ep0in->ep, ci->status); |
592 | udc->status = NULL; | 592 | ci->status = NULL; |
593 | } | 593 | } |
594 | 594 | ||
595 | return 0; | 595 | return 0; |
@@ -600,36 +600,36 @@ static int _gadget_stop_activity(struct usb_gadget *gadget) | |||
600 | *****************************************************************************/ | 600 | *****************************************************************************/ |
601 | /** | 601 | /** |
602 | * isr_reset_handler: USB reset interrupt handler | 602 | * isr_reset_handler: USB reset interrupt handler |
603 | * @udc: UDC device | 603 | * @ci: UDC device |
604 | * | 604 | * |
605 | * This function resets USB engine after a bus reset occurred | 605 | * This function resets USB engine after a bus reset occurred |
606 | */ | 606 | */ |
607 | static void isr_reset_handler(struct ci13xxx *udc) | 607 | static void isr_reset_handler(struct ci13xxx *ci) |
608 | __releases(udc->lock) | 608 | __releases(ci->lock) |
609 | __acquires(udc->lock) | 609 | __acquires(ci->lock) |
610 | { | 610 | { |
611 | int retval; | 611 | int retval; |
612 | 612 | ||
613 | dbg_event(0xFF, "BUS RST", 0); | 613 | dbg_event(0xFF, "BUS RST", 0); |
614 | 614 | ||
615 | spin_unlock(&udc->lock); | 615 | spin_unlock(&ci->lock); |
616 | retval = _gadget_stop_activity(&udc->gadget); | 616 | retval = _gadget_stop_activity(&ci->gadget); |
617 | if (retval) | 617 | if (retval) |
618 | goto done; | 618 | goto done; |
619 | 619 | ||
620 | retval = hw_usb_reset(udc); | 620 | retval = hw_usb_reset(ci); |
621 | if (retval) | 621 | if (retval) |
622 | goto done; | 622 | goto done; |
623 | 623 | ||
624 | udc->status = usb_ep_alloc_request(&udc->ep0in->ep, GFP_ATOMIC); | 624 | ci->status = usb_ep_alloc_request(&ci->ep0in->ep, GFP_ATOMIC); |
625 | if (udc->status == NULL) | 625 | if (ci->status == NULL) |
626 | retval = -ENOMEM; | 626 | retval = -ENOMEM; |
627 | 627 | ||
628 | done: | 628 | done: |
629 | spin_lock(&udc->lock); | 629 | spin_lock(&ci->lock); |
630 | 630 | ||
631 | if (retval) | 631 | if (retval) |
632 | dev_err(udc->dev, "error: %i\n", retval); | 632 | dev_err(ci->dev, "error: %i\n", retval); |
633 | } | 633 | } |
634 | 634 | ||
635 | /** | 635 | /** |
@@ -650,17 +650,17 @@ static void isr_get_status_complete(struct usb_ep *ep, struct usb_request *req) | |||
650 | 650 | ||
651 | /** | 651 | /** |
652 | * isr_get_status_response: get_status request response | 652 | * isr_get_status_response: get_status request response |
653 | * @udc: udc struct | 653 | * @ci: ci struct |
654 | * @setup: setup request packet | 654 | * @setup: setup request packet |
655 | * | 655 | * |
656 | * This function returns an error code | 656 | * This function returns an error code |
657 | */ | 657 | */ |
658 | static int isr_get_status_response(struct ci13xxx *udc, | 658 | static int isr_get_status_response(struct ci13xxx *ci, |
659 | struct usb_ctrlrequest *setup) | 659 | struct usb_ctrlrequest *setup) |
660 | __releases(mEp->lock) | 660 | __releases(mEp->lock) |
661 | __acquires(mEp->lock) | 661 | __acquires(mEp->lock) |
662 | { | 662 | { |
663 | struct ci13xxx_ep *mEp = udc->ep0in; | 663 | struct ci13xxx_ep *mEp = ci->ep0in; |
664 | struct usb_request *req = NULL; | 664 | struct usb_request *req = NULL; |
665 | gfp_t gfp_flags = GFP_ATOMIC; | 665 | gfp_t gfp_flags = GFP_ATOMIC; |
666 | int dir, num, retval; | 666 | int dir, num, retval; |
@@ -684,14 +684,14 @@ __acquires(mEp->lock) | |||
684 | 684 | ||
685 | if ((setup->bRequestType & USB_RECIP_MASK) == USB_RECIP_DEVICE) { | 685 | if ((setup->bRequestType & USB_RECIP_MASK) == USB_RECIP_DEVICE) { |
686 | /* Assume that device is bus powered for now. */ | 686 | /* Assume that device is bus powered for now. */ |
687 | *(u16 *)req->buf = udc->remote_wakeup << 1; | 687 | *(u16 *)req->buf = ci->remote_wakeup << 1; |
688 | retval = 0; | 688 | retval = 0; |
689 | } else if ((setup->bRequestType & USB_RECIP_MASK) \ | 689 | } else if ((setup->bRequestType & USB_RECIP_MASK) \ |
690 | == USB_RECIP_ENDPOINT) { | 690 | == USB_RECIP_ENDPOINT) { |
691 | dir = (le16_to_cpu(setup->wIndex) & USB_ENDPOINT_DIR_MASK) ? | 691 | dir = (le16_to_cpu(setup->wIndex) & USB_ENDPOINT_DIR_MASK) ? |
692 | TX : RX; | 692 | TX : RX; |
693 | num = le16_to_cpu(setup->wIndex) & USB_ENDPOINT_NUMBER_MASK; | 693 | num = le16_to_cpu(setup->wIndex) & USB_ENDPOINT_NUMBER_MASK; |
694 | *(u16 *)req->buf = hw_ep_get_halt(udc, num, dir); | 694 | *(u16 *)req->buf = hw_ep_get_halt(ci, num, dir); |
695 | } | 695 | } |
696 | /* else do nothing; reserved for future use */ | 696 | /* else do nothing; reserved for future use */ |
697 | 697 | ||
@@ -723,39 +723,39 @@ __acquires(mEp->lock) | |||
723 | static void | 723 | static void |
724 | isr_setup_status_complete(struct usb_ep *ep, struct usb_request *req) | 724 | isr_setup_status_complete(struct usb_ep *ep, struct usb_request *req) |
725 | { | 725 | { |
726 | struct ci13xxx *udc = req->context; | 726 | struct ci13xxx *ci = req->context; |
727 | unsigned long flags; | 727 | unsigned long flags; |
728 | 728 | ||
729 | if (udc->setaddr) { | 729 | if (ci->setaddr) { |
730 | hw_usb_set_address(udc, udc->address); | 730 | hw_usb_set_address(ci, ci->address); |
731 | udc->setaddr = false; | 731 | ci->setaddr = false; |
732 | } | 732 | } |
733 | 733 | ||
734 | spin_lock_irqsave(&udc->lock, flags); | 734 | spin_lock_irqsave(&ci->lock, flags); |
735 | if (udc->test_mode) | 735 | if (ci->test_mode) |
736 | hw_port_test_set(udc, udc->test_mode); | 736 | hw_port_test_set(ci, ci->test_mode); |
737 | spin_unlock_irqrestore(&udc->lock, flags); | 737 | spin_unlock_irqrestore(&ci->lock, flags); |
738 | } | 738 | } |
739 | 739 | ||
740 | /** | 740 | /** |
741 | * isr_setup_status_phase: queues the status phase of a setup transation | 741 | * isr_setup_status_phase: queues the status phase of a setup transation |
742 | * @udc: udc struct | 742 | * @ci: ci struct |
743 | * | 743 | * |
744 | * This function returns an error code | 744 | * This function returns an error code |
745 | */ | 745 | */ |
746 | static int isr_setup_status_phase(struct ci13xxx *udc) | 746 | static int isr_setup_status_phase(struct ci13xxx *ci) |
747 | __releases(mEp->lock) | 747 | __releases(mEp->lock) |
748 | __acquires(mEp->lock) | 748 | __acquires(mEp->lock) |
749 | { | 749 | { |
750 | int retval; | 750 | int retval; |
751 | struct ci13xxx_ep *mEp; | 751 | struct ci13xxx_ep *mEp; |
752 | 752 | ||
753 | mEp = (udc->ep0_dir == TX) ? udc->ep0out : udc->ep0in; | 753 | mEp = (ci->ep0_dir == TX) ? ci->ep0out : ci->ep0in; |
754 | udc->status->context = udc; | 754 | ci->status->context = ci; |
755 | udc->status->complete = isr_setup_status_complete; | 755 | ci->status->complete = isr_setup_status_complete; |
756 | 756 | ||
757 | spin_unlock(mEp->lock); | 757 | spin_unlock(mEp->lock); |
758 | retval = usb_ep_queue(&mEp->ep, udc->status, GFP_ATOMIC); | 758 | retval = usb_ep_queue(&mEp->ep, ci->status, GFP_ATOMIC); |
759 | spin_lock(mEp->lock); | 759 | spin_lock(mEp->lock); |
760 | 760 | ||
761 | return retval; | 761 | return retval; |
@@ -790,7 +790,7 @@ __acquires(mEp->lock) | |||
790 | spin_unlock(mEp->lock); | 790 | spin_unlock(mEp->lock); |
791 | if ((mEp->type == USB_ENDPOINT_XFER_CONTROL) && | 791 | if ((mEp->type == USB_ENDPOINT_XFER_CONTROL) && |
792 | mReq->req.length) | 792 | mReq->req.length) |
793 | mEpTemp = mEp->udc->ep0in; | 793 | mEpTemp = mEp->ci->ep0in; |
794 | mReq->req.complete(&mEpTemp->ep, &mReq->req); | 794 | mReq->req.complete(&mEpTemp->ep, &mReq->req); |
795 | spin_lock(mEp->lock); | 795 | spin_lock(mEp->lock); |
796 | } | 796 | } |
@@ -806,48 +806,48 @@ __acquires(mEp->lock) | |||
806 | 806 | ||
807 | /** | 807 | /** |
808 | * isr_tr_complete_handler: transaction complete interrupt handler | 808 | * isr_tr_complete_handler: transaction complete interrupt handler |
809 | * @udc: UDC descriptor | 809 | * @ci: UDC descriptor |
810 | * | 810 | * |
811 | * This function handles traffic events | 811 | * This function handles traffic events |
812 | */ | 812 | */ |
813 | static void isr_tr_complete_handler(struct ci13xxx *udc) | 813 | static void isr_tr_complete_handler(struct ci13xxx *ci) |
814 | __releases(udc->lock) | 814 | __releases(ci->lock) |
815 | __acquires(udc->lock) | 815 | __acquires(ci->lock) |
816 | { | 816 | { |
817 | unsigned i; | 817 | unsigned i; |
818 | u8 tmode = 0; | 818 | u8 tmode = 0; |
819 | 819 | ||
820 | for (i = 0; i < udc->hw_ep_max; i++) { | 820 | for (i = 0; i < ci->hw_ep_max; i++) { |
821 | struct ci13xxx_ep *mEp = &udc->ci13xxx_ep[i]; | 821 | struct ci13xxx_ep *mEp = &ci->ci13xxx_ep[i]; |
822 | int type, num, dir, err = -EINVAL; | 822 | int type, num, dir, err = -EINVAL; |
823 | struct usb_ctrlrequest req; | 823 | struct usb_ctrlrequest req; |
824 | 824 | ||
825 | if (mEp->ep.desc == NULL) | 825 | if (mEp->ep.desc == NULL) |
826 | continue; /* not configured */ | 826 | continue; /* not configured */ |
827 | 827 | ||
828 | if (hw_test_and_clear_complete(udc, i)) { | 828 | if (hw_test_and_clear_complete(ci, i)) { |
829 | err = isr_tr_complete_low(mEp); | 829 | err = isr_tr_complete_low(mEp); |
830 | if (mEp->type == USB_ENDPOINT_XFER_CONTROL) { | 830 | if (mEp->type == USB_ENDPOINT_XFER_CONTROL) { |
831 | if (err > 0) /* needs status phase */ | 831 | if (err > 0) /* needs status phase */ |
832 | err = isr_setup_status_phase(udc); | 832 | err = isr_setup_status_phase(ci); |
833 | if (err < 0) { | 833 | if (err < 0) { |
834 | dbg_event(_usb_addr(mEp), | 834 | dbg_event(_usb_addr(mEp), |
835 | "ERROR", err); | 835 | "ERROR", err); |
836 | spin_unlock(&udc->lock); | 836 | spin_unlock(&ci->lock); |
837 | if (usb_ep_set_halt(&mEp->ep)) | 837 | if (usb_ep_set_halt(&mEp->ep)) |
838 | dev_err(udc->dev, | 838 | dev_err(ci->dev, |
839 | "error: ep_set_halt\n"); | 839 | "error: ep_set_halt\n"); |
840 | spin_lock(&udc->lock); | 840 | spin_lock(&ci->lock); |
841 | } | 841 | } |
842 | } | 842 | } |
843 | } | 843 | } |
844 | 844 | ||
845 | if (mEp->type != USB_ENDPOINT_XFER_CONTROL || | 845 | if (mEp->type != USB_ENDPOINT_XFER_CONTROL || |
846 | !hw_test_and_clear_setup_status(udc, i)) | 846 | !hw_test_and_clear_setup_status(ci, i)) |
847 | continue; | 847 | continue; |
848 | 848 | ||
849 | if (i != 0) { | 849 | if (i != 0) { |
850 | dev_warn(udc->dev, "ctrl traffic at endpoint %d\n", i); | 850 | dev_warn(ci->dev, "ctrl traffic at endpoint %d\n", i); |
851 | continue; | 851 | continue; |
852 | } | 852 | } |
853 | 853 | ||
@@ -855,18 +855,18 @@ __acquires(udc->lock) | |||
855 | * Flush data and handshake transactions of previous | 855 | * Flush data and handshake transactions of previous |
856 | * setup packet. | 856 | * setup packet. |
857 | */ | 857 | */ |
858 | _ep_nuke(udc->ep0out); | 858 | _ep_nuke(ci->ep0out); |
859 | _ep_nuke(udc->ep0in); | 859 | _ep_nuke(ci->ep0in); |
860 | 860 | ||
861 | /* read_setup_packet */ | 861 | /* read_setup_packet */ |
862 | do { | 862 | do { |
863 | hw_test_and_set_setup_guard(udc); | 863 | hw_test_and_set_setup_guard(ci); |
864 | memcpy(&req, &mEp->qh.ptr->setup, sizeof(req)); | 864 | memcpy(&req, &mEp->qh.ptr->setup, sizeof(req)); |
865 | } while (!hw_test_and_clear_setup_guard(udc)); | 865 | } while (!hw_test_and_clear_setup_guard(ci)); |
866 | 866 | ||
867 | type = req.bRequestType; | 867 | type = req.bRequestType; |
868 | 868 | ||
869 | udc->ep0_dir = (type & USB_DIR_IN) ? TX : RX; | 869 | ci->ep0_dir = (type & USB_DIR_IN) ? TX : RX; |
870 | 870 | ||
871 | dbg_setup(_usb_addr(mEp), &req); | 871 | dbg_setup(_usb_addr(mEp), &req); |
872 | 872 | ||
@@ -881,23 +881,23 @@ __acquires(udc->lock) | |||
881 | dir = num & USB_ENDPOINT_DIR_MASK; | 881 | dir = num & USB_ENDPOINT_DIR_MASK; |
882 | num &= USB_ENDPOINT_NUMBER_MASK; | 882 | num &= USB_ENDPOINT_NUMBER_MASK; |
883 | if (dir) /* TX */ | 883 | if (dir) /* TX */ |
884 | num += udc->hw_ep_max/2; | 884 | num += ci->hw_ep_max/2; |
885 | if (!udc->ci13xxx_ep[num].wedge) { | 885 | if (!ci->ci13xxx_ep[num].wedge) { |
886 | spin_unlock(&udc->lock); | 886 | spin_unlock(&ci->lock); |
887 | err = usb_ep_clear_halt( | 887 | err = usb_ep_clear_halt( |
888 | &udc->ci13xxx_ep[num].ep); | 888 | &ci->ci13xxx_ep[num].ep); |
889 | spin_lock(&udc->lock); | 889 | spin_lock(&ci->lock); |
890 | if (err) | 890 | if (err) |
891 | break; | 891 | break; |
892 | } | 892 | } |
893 | err = isr_setup_status_phase(udc); | 893 | err = isr_setup_status_phase(ci); |
894 | } else if (type == (USB_DIR_OUT|USB_RECIP_DEVICE) && | 894 | } else if (type == (USB_DIR_OUT|USB_RECIP_DEVICE) && |
895 | le16_to_cpu(req.wValue) == | 895 | le16_to_cpu(req.wValue) == |
896 | USB_DEVICE_REMOTE_WAKEUP) { | 896 | USB_DEVICE_REMOTE_WAKEUP) { |
897 | if (req.wLength != 0) | 897 | if (req.wLength != 0) |
898 | break; | 898 | break; |
899 | udc->remote_wakeup = 0; | 899 | ci->remote_wakeup = 0; |
900 | err = isr_setup_status_phase(udc); | 900 | err = isr_setup_status_phase(ci); |
901 | } else { | 901 | } else { |
902 | goto delegate; | 902 | goto delegate; |
903 | } | 903 | } |
@@ -910,7 +910,7 @@ __acquires(udc->lock) | |||
910 | if (le16_to_cpu(req.wLength) != 2 || | 910 | if (le16_to_cpu(req.wLength) != 2 || |
911 | le16_to_cpu(req.wValue) != 0) | 911 | le16_to_cpu(req.wValue) != 0) |
912 | break; | 912 | break; |
913 | err = isr_get_status_response(udc, &req); | 913 | err = isr_get_status_response(ci, &req); |
914 | break; | 914 | break; |
915 | case USB_REQ_SET_ADDRESS: | 915 | case USB_REQ_SET_ADDRESS: |
916 | if (type != (USB_DIR_OUT|USB_RECIP_DEVICE)) | 916 | if (type != (USB_DIR_OUT|USB_RECIP_DEVICE)) |
@@ -918,9 +918,9 @@ __acquires(udc->lock) | |||
918 | if (le16_to_cpu(req.wLength) != 0 || | 918 | if (le16_to_cpu(req.wLength) != 0 || |
919 | le16_to_cpu(req.wIndex) != 0) | 919 | le16_to_cpu(req.wIndex) != 0) |
920 | break; | 920 | break; |
921 | udc->address = (u8)le16_to_cpu(req.wValue); | 921 | ci->address = (u8)le16_to_cpu(req.wValue); |
922 | udc->setaddr = true; | 922 | ci->setaddr = true; |
923 | err = isr_setup_status_phase(udc); | 923 | err = isr_setup_status_phase(ci); |
924 | break; | 924 | break; |
925 | case USB_REQ_SET_FEATURE: | 925 | case USB_REQ_SET_FEATURE: |
926 | if (type == (USB_DIR_OUT|USB_RECIP_ENDPOINT) && | 926 | if (type == (USB_DIR_OUT|USB_RECIP_ENDPOINT) && |
@@ -932,20 +932,20 @@ __acquires(udc->lock) | |||
932 | dir = num & USB_ENDPOINT_DIR_MASK; | 932 | dir = num & USB_ENDPOINT_DIR_MASK; |
933 | num &= USB_ENDPOINT_NUMBER_MASK; | 933 | num &= USB_ENDPOINT_NUMBER_MASK; |
934 | if (dir) /* TX */ | 934 | if (dir) /* TX */ |
935 | num += udc->hw_ep_max/2; | 935 | num += ci->hw_ep_max/2; |
936 | 936 | ||
937 | spin_unlock(&udc->lock); | 937 | spin_unlock(&ci->lock); |
938 | err = usb_ep_set_halt(&udc->ci13xxx_ep[num].ep); | 938 | err = usb_ep_set_halt(&ci->ci13xxx_ep[num].ep); |
939 | spin_lock(&udc->lock); | 939 | spin_lock(&ci->lock); |
940 | if (!err) | 940 | if (!err) |
941 | isr_setup_status_phase(udc); | 941 | isr_setup_status_phase(ci); |
942 | } else if (type == (USB_DIR_OUT|USB_RECIP_DEVICE)) { | 942 | } else if (type == (USB_DIR_OUT|USB_RECIP_DEVICE)) { |
943 | if (req.wLength != 0) | 943 | if (req.wLength != 0) |
944 | break; | 944 | break; |
945 | switch (le16_to_cpu(req.wValue)) { | 945 | switch (le16_to_cpu(req.wValue)) { |
946 | case USB_DEVICE_REMOTE_WAKEUP: | 946 | case USB_DEVICE_REMOTE_WAKEUP: |
947 | udc->remote_wakeup = 1; | 947 | ci->remote_wakeup = 1; |
948 | err = isr_setup_status_phase(udc); | 948 | err = isr_setup_status_phase(ci); |
949 | break; | 949 | break; |
950 | case USB_DEVICE_TEST_MODE: | 950 | case USB_DEVICE_TEST_MODE: |
951 | tmode = le16_to_cpu(req.wIndex) >> 8; | 951 | tmode = le16_to_cpu(req.wIndex) >> 8; |
@@ -955,9 +955,9 @@ __acquires(udc->lock) | |||
955 | case TEST_SE0_NAK: | 955 | case TEST_SE0_NAK: |
956 | case TEST_PACKET: | 956 | case TEST_PACKET: |
957 | case TEST_FORCE_EN: | 957 | case TEST_FORCE_EN: |
958 | udc->test_mode = tmode; | 958 | ci->test_mode = tmode; |
959 | err = isr_setup_status_phase( | 959 | err = isr_setup_status_phase( |
960 | udc); | 960 | ci); |
961 | break; | 961 | break; |
962 | default: | 962 | default: |
963 | break; | 963 | break; |
@@ -972,21 +972,21 @@ __acquires(udc->lock) | |||
972 | default: | 972 | default: |
973 | delegate: | 973 | delegate: |
974 | if (req.wLength == 0) /* no data phase */ | 974 | if (req.wLength == 0) /* no data phase */ |
975 | udc->ep0_dir = TX; | 975 | ci->ep0_dir = TX; |
976 | 976 | ||
977 | spin_unlock(&udc->lock); | 977 | spin_unlock(&ci->lock); |
978 | err = udc->driver->setup(&udc->gadget, &req); | 978 | err = ci->driver->setup(&ci->gadget, &req); |
979 | spin_lock(&udc->lock); | 979 | spin_lock(&ci->lock); |
980 | break; | 980 | break; |
981 | } | 981 | } |
982 | 982 | ||
983 | if (err < 0) { | 983 | if (err < 0) { |
984 | dbg_event(_usb_addr(mEp), "ERROR", err); | 984 | dbg_event(_usb_addr(mEp), "ERROR", err); |
985 | 985 | ||
986 | spin_unlock(&udc->lock); | 986 | spin_unlock(&ci->lock); |
987 | if (usb_ep_set_halt(&mEp->ep)) | 987 | if (usb_ep_set_halt(&mEp->ep)) |
988 | dev_err(udc->dev, "error: ep_set_halt\n"); | 988 | dev_err(ci->dev, "error: ep_set_halt\n"); |
989 | spin_lock(&udc->lock); | 989 | spin_lock(&ci->lock); |
990 | } | 990 | } |
991 | } | 991 | } |
992 | } | 992 | } |
@@ -1016,7 +1016,7 @@ static int ep_enable(struct usb_ep *ep, | |||
1016 | mEp->ep.desc = desc; | 1016 | mEp->ep.desc = desc; |
1017 | 1017 | ||
1018 | if (!list_empty(&mEp->qh.queue)) | 1018 | if (!list_empty(&mEp->qh.queue)) |
1019 | dev_warn(mEp->udc->dev, "enabling a non-empty endpoint!\n"); | 1019 | dev_warn(mEp->ci->dev, "enabling a non-empty endpoint!\n"); |
1020 | 1020 | ||
1021 | mEp->dir = usb_endpoint_dir_in(desc) ? TX : RX; | 1021 | mEp->dir = usb_endpoint_dir_in(desc) ? TX : RX; |
1022 | mEp->num = usb_endpoint_num(desc); | 1022 | mEp->num = usb_endpoint_num(desc); |
@@ -1044,7 +1044,7 @@ static int ep_enable(struct usb_ep *ep, | |||
1044 | * is always enabled | 1044 | * is always enabled |
1045 | */ | 1045 | */ |
1046 | if (mEp->num) | 1046 | if (mEp->num) |
1047 | retval |= hw_ep_enable(mEp->udc, mEp->num, mEp->dir, mEp->type); | 1047 | retval |= hw_ep_enable(mEp->ci, mEp->num, mEp->dir, mEp->type); |
1048 | 1048 | ||
1049 | spin_unlock_irqrestore(mEp->lock, flags); | 1049 | spin_unlock_irqrestore(mEp->lock, flags); |
1050 | return retval; | 1050 | return retval; |
@@ -1075,7 +1075,7 @@ static int ep_disable(struct usb_ep *ep) | |||
1075 | dbg_event(_usb_addr(mEp), "DISABLE", 0); | 1075 | dbg_event(_usb_addr(mEp), "DISABLE", 0); |
1076 | 1076 | ||
1077 | retval |= _ep_nuke(mEp); | 1077 | retval |= _ep_nuke(mEp); |
1078 | retval |= hw_ep_disable(mEp->udc, mEp->num, mEp->dir); | 1078 | retval |= hw_ep_disable(mEp->ci, mEp->num, mEp->dir); |
1079 | 1079 | ||
1080 | if (mEp->type == USB_ENDPOINT_XFER_CONTROL) | 1080 | if (mEp->type == USB_ENDPOINT_XFER_CONTROL) |
1081 | mEp->dir = (mEp->dir == TX) ? RX : TX; | 1081 | mEp->dir = (mEp->dir == TX) ? RX : TX; |
@@ -1132,7 +1132,7 @@ static void ep_free_request(struct usb_ep *ep, struct usb_request *req) | |||
1132 | if (ep == NULL || req == NULL) { | 1132 | if (ep == NULL || req == NULL) { |
1133 | return; | 1133 | return; |
1134 | } else if (!list_empty(&mReq->queue)) { | 1134 | } else if (!list_empty(&mReq->queue)) { |
1135 | dev_err(mEp->udc->dev, "freeing queued request\n"); | 1135 | dev_err(mEp->ci->dev, "freeing queued request\n"); |
1136 | return; | 1136 | return; |
1137 | } | 1137 | } |
1138 | 1138 | ||
@@ -1157,7 +1157,7 @@ static int ep_queue(struct usb_ep *ep, struct usb_request *req, | |||
1157 | { | 1157 | { |
1158 | struct ci13xxx_ep *mEp = container_of(ep, struct ci13xxx_ep, ep); | 1158 | struct ci13xxx_ep *mEp = container_of(ep, struct ci13xxx_ep, ep); |
1159 | struct ci13xxx_req *mReq = container_of(req, struct ci13xxx_req, req); | 1159 | struct ci13xxx_req *mReq = container_of(req, struct ci13xxx_req, req); |
1160 | struct ci13xxx *udc = mEp->udc; | 1160 | struct ci13xxx *ci = mEp->ci; |
1161 | int retval = 0; | 1161 | int retval = 0; |
1162 | unsigned long flags; | 1162 | unsigned long flags; |
1163 | 1163 | ||
@@ -1168,12 +1168,12 @@ static int ep_queue(struct usb_ep *ep, struct usb_request *req, | |||
1168 | 1168 | ||
1169 | if (mEp->type == USB_ENDPOINT_XFER_CONTROL) { | 1169 | if (mEp->type == USB_ENDPOINT_XFER_CONTROL) { |
1170 | if (req->length) | 1170 | if (req->length) |
1171 | mEp = (udc->ep0_dir == RX) ? | 1171 | mEp = (ci->ep0_dir == RX) ? |
1172 | udc->ep0out : udc->ep0in; | 1172 | ci->ep0out : ci->ep0in; |
1173 | if (!list_empty(&mEp->qh.queue)) { | 1173 | if (!list_empty(&mEp->qh.queue)) { |
1174 | _ep_nuke(mEp); | 1174 | _ep_nuke(mEp); |
1175 | retval = -EOVERFLOW; | 1175 | retval = -EOVERFLOW; |
1176 | dev_warn(mEp->udc->dev, "endpoint ctrl %X nuked\n", | 1176 | dev_warn(mEp->ci->dev, "endpoint ctrl %X nuked\n", |
1177 | _usb_addr(mEp)); | 1177 | _usb_addr(mEp)); |
1178 | } | 1178 | } |
1179 | } | 1179 | } |
@@ -1181,14 +1181,14 @@ static int ep_queue(struct usb_ep *ep, struct usb_request *req, | |||
1181 | /* first nuke then test link, e.g. previous status has not sent */ | 1181 | /* first nuke then test link, e.g. previous status has not sent */ |
1182 | if (!list_empty(&mReq->queue)) { | 1182 | if (!list_empty(&mReq->queue)) { |
1183 | retval = -EBUSY; | 1183 | retval = -EBUSY; |
1184 | dev_err(mEp->udc->dev, "request already in queue\n"); | 1184 | dev_err(mEp->ci->dev, "request already in queue\n"); |
1185 | goto done; | 1185 | goto done; |
1186 | } | 1186 | } |
1187 | 1187 | ||
1188 | if (req->length > 4 * CI13XXX_PAGE_SIZE) { | 1188 | if (req->length > 4 * CI13XXX_PAGE_SIZE) { |
1189 | req->length = 4 * CI13XXX_PAGE_SIZE; | 1189 | req->length = 4 * CI13XXX_PAGE_SIZE; |
1190 | retval = -EMSGSIZE; | 1190 | retval = -EMSGSIZE; |
1191 | dev_warn(mEp->udc->dev, "request length truncated\n"); | 1191 | dev_warn(mEp->ci->dev, "request length truncated\n"); |
1192 | } | 1192 | } |
1193 | 1193 | ||
1194 | dbg_queue(_usb_addr(mEp), req, retval); | 1194 | dbg_queue(_usb_addr(mEp), req, retval); |
@@ -1231,12 +1231,12 @@ static int ep_dequeue(struct usb_ep *ep, struct usb_request *req) | |||
1231 | 1231 | ||
1232 | dbg_event(_usb_addr(mEp), "DEQUEUE", 0); | 1232 | dbg_event(_usb_addr(mEp), "DEQUEUE", 0); |
1233 | 1233 | ||
1234 | hw_ep_flush(mEp->udc, mEp->num, mEp->dir); | 1234 | hw_ep_flush(mEp->ci, mEp->num, mEp->dir); |
1235 | 1235 | ||
1236 | /* pop request */ | 1236 | /* pop request */ |
1237 | list_del_init(&mReq->queue); | 1237 | list_del_init(&mReq->queue); |
1238 | 1238 | ||
1239 | usb_gadget_unmap_request(&mEp->udc->gadget, req, mEp->dir); | 1239 | usb_gadget_unmap_request(&mEp->ci->gadget, req, mEp->dir); |
1240 | 1240 | ||
1241 | req->status = -ECONNRESET; | 1241 | req->status = -ECONNRESET; |
1242 | 1242 | ||
@@ -1278,7 +1278,7 @@ static int ep_set_halt(struct usb_ep *ep, int value) | |||
1278 | direction = mEp->dir; | 1278 | direction = mEp->dir; |
1279 | do { | 1279 | do { |
1280 | dbg_event(_usb_addr(mEp), "HALT", value); | 1280 | dbg_event(_usb_addr(mEp), "HALT", value); |
1281 | retval |= hw_ep_set_halt(mEp->udc, mEp->num, mEp->dir, value); | 1281 | retval |= hw_ep_set_halt(mEp->ci, mEp->num, mEp->dir, value); |
1282 | 1282 | ||
1283 | if (!value) | 1283 | if (!value) |
1284 | mEp->wedge = 0; | 1284 | mEp->wedge = 0; |
@@ -1326,14 +1326,14 @@ static void ep_fifo_flush(struct usb_ep *ep) | |||
1326 | unsigned long flags; | 1326 | unsigned long flags; |
1327 | 1327 | ||
1328 | if (ep == NULL) { | 1328 | if (ep == NULL) { |
1329 | dev_err(mEp->udc->dev, "%02X: -EINVAL\n", _usb_addr(mEp)); | 1329 | dev_err(mEp->ci->dev, "%02X: -EINVAL\n", _usb_addr(mEp)); |
1330 | return; | 1330 | return; |
1331 | } | 1331 | } |
1332 | 1332 | ||
1333 | spin_lock_irqsave(mEp->lock, flags); | 1333 | spin_lock_irqsave(mEp->lock, flags); |
1334 | 1334 | ||
1335 | dbg_event(_usb_addr(mEp), "FFLUSH", 0); | 1335 | dbg_event(_usb_addr(mEp), "FFLUSH", 0); |
1336 | hw_ep_flush(mEp->udc, mEp->num, mEp->dir); | 1336 | hw_ep_flush(mEp->ci, mEp->num, mEp->dir); |
1337 | 1337 | ||
1338 | spin_unlock_irqrestore(mEp->lock, flags); | 1338 | spin_unlock_irqrestore(mEp->lock, flags); |
1339 | } | 1339 | } |
@@ -1359,30 +1359,30 @@ static const struct usb_ep_ops usb_ep_ops = { | |||
1359 | *****************************************************************************/ | 1359 | *****************************************************************************/ |
1360 | static int ci13xxx_vbus_session(struct usb_gadget *_gadget, int is_active) | 1360 | static int ci13xxx_vbus_session(struct usb_gadget *_gadget, int is_active) |
1361 | { | 1361 | { |
1362 | struct ci13xxx *udc = container_of(_gadget, struct ci13xxx, gadget); | 1362 | struct ci13xxx *ci = container_of(_gadget, struct ci13xxx, gadget); |
1363 | unsigned long flags; | 1363 | unsigned long flags; |
1364 | int gadget_ready = 0; | 1364 | int gadget_ready = 0; |
1365 | 1365 | ||
1366 | if (!(udc->platdata->flags & CI13XXX_PULLUP_ON_VBUS)) | 1366 | if (!(ci->platdata->flags & CI13XXX_PULLUP_ON_VBUS)) |
1367 | return -EOPNOTSUPP; | 1367 | return -EOPNOTSUPP; |
1368 | 1368 | ||
1369 | spin_lock_irqsave(&udc->lock, flags); | 1369 | spin_lock_irqsave(&ci->lock, flags); |
1370 | udc->vbus_active = is_active; | 1370 | ci->vbus_active = is_active; |
1371 | if (udc->driver) | 1371 | if (ci->driver) |
1372 | gadget_ready = 1; | 1372 | gadget_ready = 1; |
1373 | spin_unlock_irqrestore(&udc->lock, flags); | 1373 | spin_unlock_irqrestore(&ci->lock, flags); |
1374 | 1374 | ||
1375 | if (gadget_ready) { | 1375 | if (gadget_ready) { |
1376 | if (is_active) { | 1376 | if (is_active) { |
1377 | pm_runtime_get_sync(&_gadget->dev); | 1377 | pm_runtime_get_sync(&_gadget->dev); |
1378 | hw_device_reset(udc, USBMODE_CM_DC); | 1378 | hw_device_reset(ci, USBMODE_CM_DC); |
1379 | hw_device_state(udc, udc->ep0out->qh.dma); | 1379 | hw_device_state(ci, ci->ep0out->qh.dma); |
1380 | } else { | 1380 | } else { |
1381 | hw_device_state(udc, 0); | 1381 | hw_device_state(ci, 0); |
1382 | if (udc->platdata->notify_event) | 1382 | if (ci->platdata->notify_event) |
1383 | udc->platdata->notify_event(udc, | 1383 | ci->platdata->notify_event(ci, |
1384 | CI13XXX_CONTROLLER_STOPPED_EVENT); | 1384 | CI13XXX_CONTROLLER_STOPPED_EVENT); |
1385 | _gadget_stop_activity(&udc->gadget); | 1385 | _gadget_stop_activity(&ci->gadget); |
1386 | pm_runtime_put_sync(&_gadget->dev); | 1386 | pm_runtime_put_sync(&_gadget->dev); |
1387 | } | 1387 | } |
1388 | } | 1388 | } |
@@ -1392,31 +1392,31 @@ static int ci13xxx_vbus_session(struct usb_gadget *_gadget, int is_active) | |||
1392 | 1392 | ||
1393 | static int ci13xxx_wakeup(struct usb_gadget *_gadget) | 1393 | static int ci13xxx_wakeup(struct usb_gadget *_gadget) |
1394 | { | 1394 | { |
1395 | struct ci13xxx *udc = container_of(_gadget, struct ci13xxx, gadget); | 1395 | struct ci13xxx *ci = container_of(_gadget, struct ci13xxx, gadget); |
1396 | unsigned long flags; | 1396 | unsigned long flags; |
1397 | int ret = 0; | 1397 | int ret = 0; |
1398 | 1398 | ||
1399 | spin_lock_irqsave(&udc->lock, flags); | 1399 | spin_lock_irqsave(&ci->lock, flags); |
1400 | if (!udc->remote_wakeup) { | 1400 | if (!ci->remote_wakeup) { |
1401 | ret = -EOPNOTSUPP; | 1401 | ret = -EOPNOTSUPP; |
1402 | goto out; | 1402 | goto out; |
1403 | } | 1403 | } |
1404 | if (!hw_read(udc, OP_PORTSC, PORTSC_SUSP)) { | 1404 | if (!hw_read(ci, OP_PORTSC, PORTSC_SUSP)) { |
1405 | ret = -EINVAL; | 1405 | ret = -EINVAL; |
1406 | goto out; | 1406 | goto out; |
1407 | } | 1407 | } |
1408 | hw_write(udc, OP_PORTSC, PORTSC_FPR, PORTSC_FPR); | 1408 | hw_write(ci, OP_PORTSC, PORTSC_FPR, PORTSC_FPR); |
1409 | out: | 1409 | out: |
1410 | spin_unlock_irqrestore(&udc->lock, flags); | 1410 | spin_unlock_irqrestore(&ci->lock, flags); |
1411 | return ret; | 1411 | return ret; |
1412 | } | 1412 | } |
1413 | 1413 | ||
1414 | static int ci13xxx_vbus_draw(struct usb_gadget *_gadget, unsigned mA) | 1414 | static int ci13xxx_vbus_draw(struct usb_gadget *_gadget, unsigned mA) |
1415 | { | 1415 | { |
1416 | struct ci13xxx *udc = container_of(_gadget, struct ci13xxx, gadget); | 1416 | struct ci13xxx *ci = container_of(_gadget, struct ci13xxx, gadget); |
1417 | 1417 | ||
1418 | if (udc->transceiver) | 1418 | if (ci->transceiver) |
1419 | return usb_phy_set_power(udc->transceiver, mA); | 1419 | return usb_phy_set_power(ci->transceiver, mA); |
1420 | return -ENOTSUPP; | 1420 | return -ENOTSUPP; |
1421 | } | 1421 | } |
1422 | 1422 | ||
@@ -1437,28 +1437,28 @@ static const struct usb_gadget_ops usb_gadget_ops = { | |||
1437 | .udc_stop = ci13xxx_stop, | 1437 | .udc_stop = ci13xxx_stop, |
1438 | }; | 1438 | }; |
1439 | 1439 | ||
1440 | static int init_eps(struct ci13xxx *udc) | 1440 | static int init_eps(struct ci13xxx *ci) |
1441 | { | 1441 | { |
1442 | int retval = 0, i, j; | 1442 | int retval = 0, i, j; |
1443 | 1443 | ||
1444 | for (i = 0; i < udc->hw_ep_max/2; i++) | 1444 | for (i = 0; i < ci->hw_ep_max/2; i++) |
1445 | for (j = RX; j <= TX; j++) { | 1445 | for (j = RX; j <= TX; j++) { |
1446 | int k = i + j * udc->hw_ep_max/2; | 1446 | int k = i + j * ci->hw_ep_max/2; |
1447 | struct ci13xxx_ep *mEp = &udc->ci13xxx_ep[k]; | 1447 | struct ci13xxx_ep *mEp = &ci->ci13xxx_ep[k]; |
1448 | 1448 | ||
1449 | scnprintf(mEp->name, sizeof(mEp->name), "ep%i%s", i, | 1449 | scnprintf(mEp->name, sizeof(mEp->name), "ep%i%s", i, |
1450 | (j == TX) ? "in" : "out"); | 1450 | (j == TX) ? "in" : "out"); |
1451 | 1451 | ||
1452 | mEp->udc = udc; | 1452 | mEp->ci = ci; |
1453 | mEp->lock = &udc->lock; | 1453 | mEp->lock = &ci->lock; |
1454 | mEp->td_pool = udc->td_pool; | 1454 | mEp->td_pool = ci->td_pool; |
1455 | 1455 | ||
1456 | mEp->ep.name = mEp->name; | 1456 | mEp->ep.name = mEp->name; |
1457 | mEp->ep.ops = &usb_ep_ops; | 1457 | mEp->ep.ops = &usb_ep_ops; |
1458 | mEp->ep.maxpacket = CTRL_PAYLOAD_MAX; | 1458 | mEp->ep.maxpacket = CTRL_PAYLOAD_MAX; |
1459 | 1459 | ||
1460 | INIT_LIST_HEAD(&mEp->qh.queue); | 1460 | INIT_LIST_HEAD(&mEp->qh.queue); |
1461 | mEp->qh.ptr = dma_pool_alloc(udc->qh_pool, GFP_KERNEL, | 1461 | mEp->qh.ptr = dma_pool_alloc(ci->qh_pool, GFP_KERNEL, |
1462 | &mEp->qh.dma); | 1462 | &mEp->qh.dma); |
1463 | if (mEp->qh.ptr == NULL) | 1463 | if (mEp->qh.ptr == NULL) |
1464 | retval = -ENOMEM; | 1464 | retval = -ENOMEM; |
@@ -1471,14 +1471,14 @@ static int init_eps(struct ci13xxx *udc) | |||
1471 | */ | 1471 | */ |
1472 | if (i == 0) { | 1472 | if (i == 0) { |
1473 | if (j == RX) | 1473 | if (j == RX) |
1474 | udc->ep0out = mEp; | 1474 | ci->ep0out = mEp; |
1475 | else | 1475 | else |
1476 | udc->ep0in = mEp; | 1476 | ci->ep0in = mEp; |
1477 | 1477 | ||
1478 | continue; | 1478 | continue; |
1479 | } | 1479 | } |
1480 | 1480 | ||
1481 | list_add_tail(&mEp->ep.ep_list, &udc->gadget.ep_list); | 1481 | list_add_tail(&mEp->ep.ep_list, &ci->gadget.ep_list); |
1482 | } | 1482 | } |
1483 | 1483 | ||
1484 | return retval; | 1484 | return retval; |
@@ -1494,7 +1494,7 @@ static int init_eps(struct ci13xxx *udc) | |||
1494 | static int ci13xxx_start(struct usb_gadget *gadget, | 1494 | static int ci13xxx_start(struct usb_gadget *gadget, |
1495 | struct usb_gadget_driver *driver) | 1495 | struct usb_gadget_driver *driver) |
1496 | { | 1496 | { |
1497 | struct ci13xxx *udc = container_of(gadget, struct ci13xxx, gadget); | 1497 | struct ci13xxx *ci = container_of(gadget, struct ci13xxx, gadget); |
1498 | unsigned long flags; | 1498 | unsigned long flags; |
1499 | int retval = -ENOMEM; | 1499 | int retval = -ENOMEM; |
1500 | 1500 | ||
@@ -1502,35 +1502,35 @@ static int ci13xxx_start(struct usb_gadget *gadget, | |||
1502 | return -EINVAL; | 1502 | return -EINVAL; |
1503 | 1503 | ||
1504 | 1504 | ||
1505 | udc->ep0out->ep.desc = &ctrl_endpt_out_desc; | 1505 | ci->ep0out->ep.desc = &ctrl_endpt_out_desc; |
1506 | retval = usb_ep_enable(&udc->ep0out->ep); | 1506 | retval = usb_ep_enable(&ci->ep0out->ep); |
1507 | if (retval) | 1507 | if (retval) |
1508 | return retval; | 1508 | return retval; |
1509 | 1509 | ||
1510 | udc->ep0in->ep.desc = &ctrl_endpt_in_desc; | 1510 | ci->ep0in->ep.desc = &ctrl_endpt_in_desc; |
1511 | retval = usb_ep_enable(&udc->ep0in->ep); | 1511 | retval = usb_ep_enable(&ci->ep0in->ep); |
1512 | if (retval) | 1512 | if (retval) |
1513 | return retval; | 1513 | return retval; |
1514 | spin_lock_irqsave(&udc->lock, flags); | 1514 | spin_lock_irqsave(&ci->lock, flags); |
1515 | 1515 | ||
1516 | udc->driver = driver; | 1516 | ci->driver = driver; |
1517 | pm_runtime_get_sync(&udc->gadget.dev); | 1517 | pm_runtime_get_sync(&ci->gadget.dev); |
1518 | if (udc->platdata->flags & CI13XXX_PULLUP_ON_VBUS) { | 1518 | if (ci->platdata->flags & CI13XXX_PULLUP_ON_VBUS) { |
1519 | if (udc->vbus_active) { | 1519 | if (ci->vbus_active) { |
1520 | if (udc->platdata->flags & CI13XXX_REGS_SHARED) | 1520 | if (ci->platdata->flags & CI13XXX_REGS_SHARED) |
1521 | hw_device_reset(udc, USBMODE_CM_DC); | 1521 | hw_device_reset(ci, USBMODE_CM_DC); |
1522 | } else { | 1522 | } else { |
1523 | pm_runtime_put_sync(&udc->gadget.dev); | 1523 | pm_runtime_put_sync(&ci->gadget.dev); |
1524 | goto done; | 1524 | goto done; |
1525 | } | 1525 | } |
1526 | } | 1526 | } |
1527 | 1527 | ||
1528 | retval = hw_device_state(udc, udc->ep0out->qh.dma); | 1528 | retval = hw_device_state(ci, ci->ep0out->qh.dma); |
1529 | if (retval) | 1529 | if (retval) |
1530 | pm_runtime_put_sync(&udc->gadget.dev); | 1530 | pm_runtime_put_sync(&ci->gadget.dev); |
1531 | 1531 | ||
1532 | done: | 1532 | done: |
1533 | spin_unlock_irqrestore(&udc->lock, flags); | 1533 | spin_unlock_irqrestore(&ci->lock, flags); |
1534 | return retval; | 1534 | return retval; |
1535 | } | 1535 | } |
1536 | 1536 | ||
@@ -1540,25 +1540,25 @@ static int ci13xxx_start(struct usb_gadget *gadget, | |||
1540 | static int ci13xxx_stop(struct usb_gadget *gadget, | 1540 | static int ci13xxx_stop(struct usb_gadget *gadget, |
1541 | struct usb_gadget_driver *driver) | 1541 | struct usb_gadget_driver *driver) |
1542 | { | 1542 | { |
1543 | struct ci13xxx *udc = container_of(gadget, struct ci13xxx, gadget); | 1543 | struct ci13xxx *ci = container_of(gadget, struct ci13xxx, gadget); |
1544 | unsigned long flags; | 1544 | unsigned long flags; |
1545 | 1545 | ||
1546 | spin_lock_irqsave(&udc->lock, flags); | 1546 | spin_lock_irqsave(&ci->lock, flags); |
1547 | 1547 | ||
1548 | if (!(udc->platdata->flags & CI13XXX_PULLUP_ON_VBUS) || | 1548 | if (!(ci->platdata->flags & CI13XXX_PULLUP_ON_VBUS) || |
1549 | udc->vbus_active) { | 1549 | ci->vbus_active) { |
1550 | hw_device_state(udc, 0); | 1550 | hw_device_state(ci, 0); |
1551 | if (udc->platdata->notify_event) | 1551 | if (ci->platdata->notify_event) |
1552 | udc->platdata->notify_event(udc, | 1552 | ci->platdata->notify_event(ci, |
1553 | CI13XXX_CONTROLLER_STOPPED_EVENT); | 1553 | CI13XXX_CONTROLLER_STOPPED_EVENT); |
1554 | udc->driver = NULL; | 1554 | ci->driver = NULL; |
1555 | spin_unlock_irqrestore(&udc->lock, flags); | 1555 | spin_unlock_irqrestore(&ci->lock, flags); |
1556 | _gadget_stop_activity(&udc->gadget); | 1556 | _gadget_stop_activity(&ci->gadget); |
1557 | spin_lock_irqsave(&udc->lock, flags); | 1557 | spin_lock_irqsave(&ci->lock, flags); |
1558 | pm_runtime_put(&udc->gadget.dev); | 1558 | pm_runtime_put(&ci->gadget.dev); |
1559 | } | 1559 | } |
1560 | 1560 | ||
1561 | spin_unlock_irqrestore(&udc->lock, flags); | 1561 | spin_unlock_irqrestore(&ci->lock, flags); |
1562 | 1562 | ||
1563 | return 0; | 1563 | return 0; |
1564 | } | 1564 | } |
@@ -1567,64 +1567,64 @@ static int ci13xxx_stop(struct usb_gadget *gadget, | |||
1567 | * BUS block | 1567 | * BUS block |
1568 | *****************************************************************************/ | 1568 | *****************************************************************************/ |
1569 | /** | 1569 | /** |
1570 | * udc_irq: udc interrupt handler | 1570 | * udc_irq: ci interrupt handler |
1571 | * | 1571 | * |
1572 | * This function returns IRQ_HANDLED if the IRQ has been handled | 1572 | * This function returns IRQ_HANDLED if the IRQ has been handled |
1573 | * It locks access to registers | 1573 | * It locks access to registers |
1574 | */ | 1574 | */ |
1575 | static irqreturn_t udc_irq(struct ci13xxx *udc) | 1575 | static irqreturn_t udc_irq(struct ci13xxx *ci) |
1576 | { | 1576 | { |
1577 | irqreturn_t retval; | 1577 | irqreturn_t retval; |
1578 | u32 intr; | 1578 | u32 intr; |
1579 | 1579 | ||
1580 | if (udc == NULL) | 1580 | if (ci == NULL) |
1581 | return IRQ_HANDLED; | 1581 | return IRQ_HANDLED; |
1582 | 1582 | ||
1583 | spin_lock(&udc->lock); | 1583 | spin_lock(&ci->lock); |
1584 | 1584 | ||
1585 | if (udc->platdata->flags & CI13XXX_REGS_SHARED) { | 1585 | if (ci->platdata->flags & CI13XXX_REGS_SHARED) { |
1586 | if (hw_read(udc, OP_USBMODE, USBMODE_CM) != | 1586 | if (hw_read(ci, OP_USBMODE, USBMODE_CM) != |
1587 | USBMODE_CM_DC) { | 1587 | USBMODE_CM_DC) { |
1588 | spin_unlock(&udc->lock); | 1588 | spin_unlock(&ci->lock); |
1589 | return IRQ_NONE; | 1589 | return IRQ_NONE; |
1590 | } | 1590 | } |
1591 | } | 1591 | } |
1592 | intr = hw_test_and_clear_intr_active(udc); | 1592 | intr = hw_test_and_clear_intr_active(ci); |
1593 | dbg_interrupt(intr); | 1593 | dbg_interrupt(intr); |
1594 | 1594 | ||
1595 | if (intr) { | 1595 | if (intr) { |
1596 | /* order defines priority - do NOT change it */ | 1596 | /* order defines priority - do NOT change it */ |
1597 | if (USBi_URI & intr) | 1597 | if (USBi_URI & intr) |
1598 | isr_reset_handler(udc); | 1598 | isr_reset_handler(ci); |
1599 | 1599 | ||
1600 | if (USBi_PCI & intr) { | 1600 | if (USBi_PCI & intr) { |
1601 | udc->gadget.speed = hw_port_is_high_speed(udc) ? | 1601 | ci->gadget.speed = hw_port_is_high_speed(ci) ? |
1602 | USB_SPEED_HIGH : USB_SPEED_FULL; | 1602 | USB_SPEED_HIGH : USB_SPEED_FULL; |
1603 | if (udc->suspended && udc->driver->resume) { | 1603 | if (ci->suspended && ci->driver->resume) { |
1604 | spin_unlock(&udc->lock); | 1604 | spin_unlock(&ci->lock); |
1605 | udc->driver->resume(&udc->gadget); | 1605 | ci->driver->resume(&ci->gadget); |
1606 | spin_lock(&udc->lock); | 1606 | spin_lock(&ci->lock); |
1607 | udc->suspended = 0; | 1607 | ci->suspended = 0; |
1608 | } | 1608 | } |
1609 | } | 1609 | } |
1610 | 1610 | ||
1611 | if (USBi_UI & intr) | 1611 | if (USBi_UI & intr) |
1612 | isr_tr_complete_handler(udc); | 1612 | isr_tr_complete_handler(ci); |
1613 | 1613 | ||
1614 | if (USBi_SLI & intr) { | 1614 | if (USBi_SLI & intr) { |
1615 | if (udc->gadget.speed != USB_SPEED_UNKNOWN && | 1615 | if (ci->gadget.speed != USB_SPEED_UNKNOWN && |
1616 | udc->driver->suspend) { | 1616 | ci->driver->suspend) { |
1617 | udc->suspended = 1; | 1617 | ci->suspended = 1; |
1618 | spin_unlock(&udc->lock); | 1618 | spin_unlock(&ci->lock); |
1619 | udc->driver->suspend(&udc->gadget); | 1619 | ci->driver->suspend(&ci->gadget); |
1620 | spin_lock(&udc->lock); | 1620 | spin_lock(&ci->lock); |
1621 | } | 1621 | } |
1622 | } | 1622 | } |
1623 | retval = IRQ_HANDLED; | 1623 | retval = IRQ_HANDLED; |
1624 | } else { | 1624 | } else { |
1625 | retval = IRQ_NONE; | 1625 | retval = IRQ_NONE; |
1626 | } | 1626 | } |
1627 | spin_unlock(&udc->lock); | 1627 | spin_unlock(&ci->lock); |
1628 | 1628 | ||
1629 | return retval; | 1629 | return retval; |
1630 | } | 1630 | } |
@@ -1641,109 +1641,109 @@ static void udc_release(struct device *dev) | |||
1641 | 1641 | ||
1642 | /** | 1642 | /** |
1643 | * udc_start: initialize gadget role | 1643 | * udc_start: initialize gadget role |
1644 | * @udc: chipidea controller | 1644 | * @ci: chipidea controller |
1645 | */ | 1645 | */ |
1646 | static int udc_start(struct ci13xxx *udc) | 1646 | static int udc_start(struct ci13xxx *ci) |
1647 | { | 1647 | { |
1648 | struct device *dev = udc->dev; | 1648 | struct device *dev = ci->dev; |
1649 | int retval = 0; | 1649 | int retval = 0; |
1650 | 1650 | ||
1651 | spin_lock_init(&udc->lock); | 1651 | spin_lock_init(&ci->lock); |
1652 | 1652 | ||
1653 | udc->gadget.ops = &usb_gadget_ops; | 1653 | ci->gadget.ops = &usb_gadget_ops; |
1654 | udc->gadget.speed = USB_SPEED_UNKNOWN; | 1654 | ci->gadget.speed = USB_SPEED_UNKNOWN; |
1655 | udc->gadget.max_speed = USB_SPEED_HIGH; | 1655 | ci->gadget.max_speed = USB_SPEED_HIGH; |
1656 | udc->gadget.is_otg = 0; | 1656 | ci->gadget.is_otg = 0; |
1657 | udc->gadget.name = udc->platdata->name; | 1657 | ci->gadget.name = ci->platdata->name; |
1658 | 1658 | ||
1659 | INIT_LIST_HEAD(&udc->gadget.ep_list); | 1659 | INIT_LIST_HEAD(&ci->gadget.ep_list); |
1660 | 1660 | ||
1661 | dev_set_name(&udc->gadget.dev, "gadget"); | 1661 | dev_set_name(&ci->gadget.dev, "gadget"); |
1662 | udc->gadget.dev.dma_mask = dev->dma_mask; | 1662 | ci->gadget.dev.dma_mask = dev->dma_mask; |
1663 | udc->gadget.dev.coherent_dma_mask = dev->coherent_dma_mask; | 1663 | ci->gadget.dev.coherent_dma_mask = dev->coherent_dma_mask; |
1664 | udc->gadget.dev.parent = dev; | 1664 | ci->gadget.dev.parent = dev; |
1665 | udc->gadget.dev.release = udc_release; | 1665 | ci->gadget.dev.release = udc_release; |
1666 | 1666 | ||
1667 | /* alloc resources */ | 1667 | /* alloc resources */ |
1668 | udc->qh_pool = dma_pool_create("ci13xxx_qh", dev, | 1668 | ci->qh_pool = dma_pool_create("ci13xxx_qh", dev, |
1669 | sizeof(struct ci13xxx_qh), | 1669 | sizeof(struct ci13xxx_qh), |
1670 | 64, CI13XXX_PAGE_SIZE); | 1670 | 64, CI13XXX_PAGE_SIZE); |
1671 | if (udc->qh_pool == NULL) | 1671 | if (ci->qh_pool == NULL) |
1672 | return -ENOMEM; | 1672 | return -ENOMEM; |
1673 | 1673 | ||
1674 | udc->td_pool = dma_pool_create("ci13xxx_td", dev, | 1674 | ci->td_pool = dma_pool_create("ci13xxx_td", dev, |
1675 | sizeof(struct ci13xxx_td), | 1675 | sizeof(struct ci13xxx_td), |
1676 | 64, CI13XXX_PAGE_SIZE); | 1676 | 64, CI13XXX_PAGE_SIZE); |
1677 | if (udc->td_pool == NULL) { | 1677 | if (ci->td_pool == NULL) { |
1678 | retval = -ENOMEM; | 1678 | retval = -ENOMEM; |
1679 | goto free_qh_pool; | 1679 | goto free_qh_pool; |
1680 | } | 1680 | } |
1681 | 1681 | ||
1682 | retval = init_eps(udc); | 1682 | retval = init_eps(ci); |
1683 | if (retval) | 1683 | if (retval) |
1684 | goto free_pools; | 1684 | goto free_pools; |
1685 | 1685 | ||
1686 | udc->gadget.ep0 = &udc->ep0in->ep; | 1686 | ci->gadget.ep0 = &ci->ep0in->ep; |
1687 | 1687 | ||
1688 | udc->transceiver = usb_get_phy(USB_PHY_TYPE_USB2); | 1688 | ci->transceiver = usb_get_phy(USB_PHY_TYPE_USB2); |
1689 | 1689 | ||
1690 | if (udc->platdata->flags & CI13XXX_REQUIRE_TRANSCEIVER) { | 1690 | if (ci->platdata->flags & CI13XXX_REQUIRE_TRANSCEIVER) { |
1691 | if (udc->transceiver == NULL) { | 1691 | if (ci->transceiver == NULL) { |
1692 | retval = -ENODEV; | 1692 | retval = -ENODEV; |
1693 | goto free_pools; | 1693 | goto free_pools; |
1694 | } | 1694 | } |
1695 | } | 1695 | } |
1696 | 1696 | ||
1697 | if (!(udc->platdata->flags & CI13XXX_REGS_SHARED)) { | 1697 | if (!(ci->platdata->flags & CI13XXX_REGS_SHARED)) { |
1698 | retval = hw_device_reset(udc, USBMODE_CM_DC); | 1698 | retval = hw_device_reset(ci, USBMODE_CM_DC); |
1699 | if (retval) | 1699 | if (retval) |
1700 | goto put_transceiver; | 1700 | goto put_transceiver; |
1701 | } | 1701 | } |
1702 | 1702 | ||
1703 | retval = device_register(&udc->gadget.dev); | 1703 | retval = device_register(&ci->gadget.dev); |
1704 | if (retval) { | 1704 | if (retval) { |
1705 | put_device(&udc->gadget.dev); | 1705 | put_device(&ci->gadget.dev); |
1706 | goto put_transceiver; | 1706 | goto put_transceiver; |
1707 | } | 1707 | } |
1708 | 1708 | ||
1709 | retval = dbg_create_files(&udc->gadget.dev); | 1709 | retval = dbg_create_files(&ci->gadget.dev); |
1710 | if (retval) | 1710 | if (retval) |
1711 | goto unreg_device; | 1711 | goto unreg_device; |
1712 | 1712 | ||
1713 | if (!IS_ERR_OR_NULL(udc->transceiver)) { | 1713 | if (!IS_ERR_OR_NULL(ci->transceiver)) { |
1714 | retval = otg_set_peripheral(udc->transceiver->otg, | 1714 | retval = otg_set_peripheral(ci->transceiver->otg, |
1715 | &udc->gadget); | 1715 | &ci->gadget); |
1716 | if (retval) | 1716 | if (retval) |
1717 | goto remove_dbg; | 1717 | goto remove_dbg; |
1718 | } | 1718 | } |
1719 | 1719 | ||
1720 | retval = usb_add_gadget_udc(dev, &udc->gadget); | 1720 | retval = usb_add_gadget_udc(dev, &ci->gadget); |
1721 | if (retval) | 1721 | if (retval) |
1722 | goto remove_trans; | 1722 | goto remove_trans; |
1723 | 1723 | ||
1724 | pm_runtime_no_callbacks(&udc->gadget.dev); | 1724 | pm_runtime_no_callbacks(&ci->gadget.dev); |
1725 | pm_runtime_enable(&udc->gadget.dev); | 1725 | pm_runtime_enable(&ci->gadget.dev); |
1726 | 1726 | ||
1727 | return retval; | 1727 | return retval; |
1728 | 1728 | ||
1729 | remove_trans: | 1729 | remove_trans: |
1730 | if (!IS_ERR_OR_NULL(udc->transceiver)) { | 1730 | if (!IS_ERR_OR_NULL(ci->transceiver)) { |
1731 | otg_set_peripheral(udc->transceiver->otg, &udc->gadget); | 1731 | otg_set_peripheral(ci->transceiver->otg, &ci->gadget); |
1732 | usb_put_phy(udc->transceiver); | 1732 | usb_put_phy(ci->transceiver); |
1733 | } | 1733 | } |
1734 | 1734 | ||
1735 | dev_err(dev, "error = %i\n", retval); | 1735 | dev_err(dev, "error = %i\n", retval); |
1736 | remove_dbg: | 1736 | remove_dbg: |
1737 | dbg_remove_files(&udc->gadget.dev); | 1737 | dbg_remove_files(&ci->gadget.dev); |
1738 | unreg_device: | 1738 | unreg_device: |
1739 | device_unregister(&udc->gadget.dev); | 1739 | device_unregister(&ci->gadget.dev); |
1740 | put_transceiver: | 1740 | put_transceiver: |
1741 | if (!IS_ERR_OR_NULL(udc->transceiver)) | 1741 | if (!IS_ERR_OR_NULL(ci->transceiver)) |
1742 | usb_put_phy(udc->transceiver); | 1742 | usb_put_phy(ci->transceiver); |
1743 | free_pools: | 1743 | free_pools: |
1744 | dma_pool_destroy(udc->td_pool); | 1744 | dma_pool_destroy(ci->td_pool); |
1745 | free_qh_pool: | 1745 | free_qh_pool: |
1746 | dma_pool_destroy(udc->qh_pool); | 1746 | dma_pool_destroy(ci->qh_pool); |
1747 | return retval; | 1747 | return retval; |
1748 | } | 1748 | } |
1749 | 1749 | ||
@@ -1752,32 +1752,32 @@ free_qh_pool: | |||
1752 | * | 1752 | * |
1753 | * No interrupts active, the IRQ has been released | 1753 | * No interrupts active, the IRQ has been released |
1754 | */ | 1754 | */ |
1755 | static void udc_stop(struct ci13xxx *udc) | 1755 | static void udc_stop(struct ci13xxx *ci) |
1756 | { | 1756 | { |
1757 | int i; | 1757 | int i; |
1758 | 1758 | ||
1759 | if (udc == NULL) | 1759 | if (ci == NULL) |
1760 | return; | 1760 | return; |
1761 | 1761 | ||
1762 | usb_del_gadget_udc(&udc->gadget); | 1762 | usb_del_gadget_udc(&ci->gadget); |
1763 | 1763 | ||
1764 | for (i = 0; i < udc->hw_ep_max; i++) { | 1764 | for (i = 0; i < ci->hw_ep_max; i++) { |
1765 | struct ci13xxx_ep *mEp = &udc->ci13xxx_ep[i]; | 1765 | struct ci13xxx_ep *mEp = &ci->ci13xxx_ep[i]; |
1766 | 1766 | ||
1767 | dma_pool_free(udc->qh_pool, mEp->qh.ptr, mEp->qh.dma); | 1767 | dma_pool_free(ci->qh_pool, mEp->qh.ptr, mEp->qh.dma); |
1768 | } | 1768 | } |
1769 | 1769 | ||
1770 | dma_pool_destroy(udc->td_pool); | 1770 | dma_pool_destroy(ci->td_pool); |
1771 | dma_pool_destroy(udc->qh_pool); | 1771 | dma_pool_destroy(ci->qh_pool); |
1772 | 1772 | ||
1773 | if (!IS_ERR_OR_NULL(udc->transceiver)) { | 1773 | if (!IS_ERR_OR_NULL(ci->transceiver)) { |
1774 | otg_set_peripheral(udc->transceiver->otg, NULL); | 1774 | otg_set_peripheral(ci->transceiver->otg, NULL); |
1775 | usb_put_phy(udc->transceiver); | 1775 | usb_put_phy(ci->transceiver); |
1776 | } | 1776 | } |
1777 | dbg_remove_files(&udc->gadget.dev); | 1777 | dbg_remove_files(&ci->gadget.dev); |
1778 | device_unregister(&udc->gadget.dev); | 1778 | device_unregister(&ci->gadget.dev); |
1779 | /* my kobject is dynamic, I swear! */ | 1779 | /* my kobject is dynamic, I swear! */ |
1780 | memset(&udc->gadget, 0, sizeof(udc->gadget)); | 1780 | memset(&ci->gadget, 0, sizeof(ci->gadget)); |
1781 | } | 1781 | } |
1782 | 1782 | ||
1783 | /** | 1783 | /** |
diff --git a/include/linux/usb/chipidea.h b/include/linux/usb/chipidea.h index d4cf970656fb..d2f7e494f5c0 100644 --- a/include/linux/usb/chipidea.h +++ b/include/linux/usb/chipidea.h | |||
@@ -19,7 +19,7 @@ struct ci13xxx_platform_data { | |||
19 | 19 | ||
20 | #define CI13XXX_CONTROLLER_RESET_EVENT 0 | 20 | #define CI13XXX_CONTROLLER_RESET_EVENT 0 |
21 | #define CI13XXX_CONTROLLER_STOPPED_EVENT 1 | 21 | #define CI13XXX_CONTROLLER_STOPPED_EVENT 1 |
22 | void (*notify_event) (struct ci13xxx *udc, unsigned event); | 22 | void (*notify_event) (struct ci13xxx *ci, unsigned event); |
23 | }; | 23 | }; |
24 | 24 | ||
25 | /* Default offset of capability registers */ | 25 | /* Default offset of capability registers */ |