diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2015-07-17 14:24:31 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2015-07-17 14:24:31 -0400 |
commit | 2b3eb6e33723a0d2ce2b2a56dda8a793460d66cc (patch) | |
tree | e627461ede3b9a1d2e4cff625033b27abc1b9d3d | |
parent | 1ea2a01c1db326f5b594ac086255ed2d9387603b (diff) | |
parent | 51f007e1a1f11d5aaa189c1a5cfbae0e8793fe50 (diff) |
Merge tag 'usb-4.2-rc3' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb
Pull USB driver fixes from Greg KH:
"Here's some USB driver fixes for 4.2-rc3.
The ususal number of gadget driver fixes are in here, along with some
new device ids and a build fix for the mn10300 arch which required
some symbols to be renamed in the mos7720 driver.
All have been in linux-next for a while with no reported issues"
* tag 'usb-4.2-rc3' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb:
USB: serial: Destroy serial_minors IDR on module exit
usb: gadget: f_midi: fix error recovery path
usb: phy: mxs: suspend to RAM causes NULL pointer dereference
usb: gadget: udc: fix free_irq() after request_irq() failed
usb: gadget: composite: Fix NULL pointer dereference
usb: gadget: f_fs: do not set cancel function on synchronous {read,write}
usb: f_mass_storage: limit number of reported LUNs
usb: dwc3: core: avoid NULL pointer dereference
usb: dwc2: embed storage for reg backup in struct dwc2_hsotg
usb: dwc2: host: allocate qtd before atomic enqueue
usb: dwc2: host: allocate qh before atomic enqueue
usb: musb: host: rely on port_mode to call musb_start()
USB: cp210x: add ID for Aruba Networks controllers
USB: mos7720: rename registers
USB: option: add 2020:4000 ID
-rw-r--r-- | drivers/usb/dwc2/core.c | 55 | ||||
-rw-r--r-- | drivers/usb/dwc2/core.h | 9 | ||||
-rw-r--r-- | drivers/usb/dwc2/hcd.c | 55 | ||||
-rw-r--r-- | drivers/usb/dwc2/hcd.h | 5 | ||||
-rw-r--r-- | drivers/usb/dwc2/hcd_queue.c | 49 | ||||
-rw-r--r-- | drivers/usb/dwc3/core.c | 6 | ||||
-rw-r--r-- | drivers/usb/gadget/composite.c | 11 | ||||
-rw-r--r-- | drivers/usb/gadget/function/f_fs.c | 6 | ||||
-rw-r--r-- | drivers/usb/gadget/function/f_mass_storage.c | 16 | ||||
-rw-r--r-- | drivers/usb/gadget/function/f_midi.c | 4 | ||||
-rw-r--r-- | drivers/usb/gadget/udc/fotg210-udc.c | 3 | ||||
-rw-r--r-- | drivers/usb/musb/musb_virthub.c | 4 | ||||
-rw-r--r-- | drivers/usb/phy/phy-mxs-usb.c | 3 | ||||
-rw-r--r-- | drivers/usb/serial/cp210x.c | 1 | ||||
-rw-r--r-- | drivers/usb/serial/mos7720.c | 253 | ||||
-rw-r--r-- | drivers/usb/serial/option.c | 1 | ||||
-rw-r--r-- | drivers/usb/serial/usb-serial.c | 1 |
17 files changed, 254 insertions, 228 deletions
diff --git a/drivers/usb/dwc2/core.c b/drivers/usb/dwc2/core.c index e5b546f1152e..c3cc1a78d1e2 100644 --- a/drivers/usb/dwc2/core.c +++ b/drivers/usb/dwc2/core.c | |||
@@ -72,17 +72,7 @@ static int dwc2_backup_host_registers(struct dwc2_hsotg *hsotg) | |||
72 | dev_dbg(hsotg->dev, "%s\n", __func__); | 72 | dev_dbg(hsotg->dev, "%s\n", __func__); |
73 | 73 | ||
74 | /* Backup Host regs */ | 74 | /* Backup Host regs */ |
75 | hr = hsotg->hr_backup; | 75 | hr = &hsotg->hr_backup; |
76 | if (!hr) { | ||
77 | hr = devm_kzalloc(hsotg->dev, sizeof(*hr), GFP_KERNEL); | ||
78 | if (!hr) { | ||
79 | dev_err(hsotg->dev, "%s: can't allocate host regs\n", | ||
80 | __func__); | ||
81 | return -ENOMEM; | ||
82 | } | ||
83 | |||
84 | hsotg->hr_backup = hr; | ||
85 | } | ||
86 | hr->hcfg = readl(hsotg->regs + HCFG); | 76 | hr->hcfg = readl(hsotg->regs + HCFG); |
87 | hr->haintmsk = readl(hsotg->regs + HAINTMSK); | 77 | hr->haintmsk = readl(hsotg->regs + HAINTMSK); |
88 | for (i = 0; i < hsotg->core_params->host_channels; ++i) | 78 | for (i = 0; i < hsotg->core_params->host_channels; ++i) |
@@ -90,6 +80,7 @@ static int dwc2_backup_host_registers(struct dwc2_hsotg *hsotg) | |||
90 | 80 | ||
91 | hr->hprt0 = readl(hsotg->regs + HPRT0); | 81 | hr->hprt0 = readl(hsotg->regs + HPRT0); |
92 | hr->hfir = readl(hsotg->regs + HFIR); | 82 | hr->hfir = readl(hsotg->regs + HFIR); |
83 | hr->valid = true; | ||
93 | 84 | ||
94 | return 0; | 85 | return 0; |
95 | } | 86 | } |
@@ -109,12 +100,13 @@ static int dwc2_restore_host_registers(struct dwc2_hsotg *hsotg) | |||
109 | dev_dbg(hsotg->dev, "%s\n", __func__); | 100 | dev_dbg(hsotg->dev, "%s\n", __func__); |
110 | 101 | ||
111 | /* Restore host regs */ | 102 | /* Restore host regs */ |
112 | hr = hsotg->hr_backup; | 103 | hr = &hsotg->hr_backup; |
113 | if (!hr) { | 104 | if (!hr->valid) { |
114 | dev_err(hsotg->dev, "%s: no host registers to restore\n", | 105 | dev_err(hsotg->dev, "%s: no host registers to restore\n", |
115 | __func__); | 106 | __func__); |
116 | return -EINVAL; | 107 | return -EINVAL; |
117 | } | 108 | } |
109 | hr->valid = false; | ||
118 | 110 | ||
119 | writel(hr->hcfg, hsotg->regs + HCFG); | 111 | writel(hr->hcfg, hsotg->regs + HCFG); |
120 | writel(hr->haintmsk, hsotg->regs + HAINTMSK); | 112 | writel(hr->haintmsk, hsotg->regs + HAINTMSK); |
@@ -152,17 +144,7 @@ static int dwc2_backup_device_registers(struct dwc2_hsotg *hsotg) | |||
152 | dev_dbg(hsotg->dev, "%s\n", __func__); | 144 | dev_dbg(hsotg->dev, "%s\n", __func__); |
153 | 145 | ||
154 | /* Backup dev regs */ | 146 | /* Backup dev regs */ |
155 | dr = hsotg->dr_backup; | 147 | dr = &hsotg->dr_backup; |
156 | if (!dr) { | ||
157 | dr = devm_kzalloc(hsotg->dev, sizeof(*dr), GFP_KERNEL); | ||
158 | if (!dr) { | ||
159 | dev_err(hsotg->dev, "%s: can't allocate device regs\n", | ||
160 | __func__); | ||
161 | return -ENOMEM; | ||
162 | } | ||
163 | |||
164 | hsotg->dr_backup = dr; | ||
165 | } | ||
166 | 148 | ||
167 | dr->dcfg = readl(hsotg->regs + DCFG); | 149 | dr->dcfg = readl(hsotg->regs + DCFG); |
168 | dr->dctl = readl(hsotg->regs + DCTL); | 150 | dr->dctl = readl(hsotg->regs + DCTL); |
@@ -195,7 +177,7 @@ static int dwc2_backup_device_registers(struct dwc2_hsotg *hsotg) | |||
195 | dr->doeptsiz[i] = readl(hsotg->regs + DOEPTSIZ(i)); | 177 | dr->doeptsiz[i] = readl(hsotg->regs + DOEPTSIZ(i)); |
196 | dr->doepdma[i] = readl(hsotg->regs + DOEPDMA(i)); | 178 | dr->doepdma[i] = readl(hsotg->regs + DOEPDMA(i)); |
197 | } | 179 | } |
198 | 180 | dr->valid = true; | |
199 | return 0; | 181 | return 0; |
200 | } | 182 | } |
201 | 183 | ||
@@ -215,12 +197,13 @@ static int dwc2_restore_device_registers(struct dwc2_hsotg *hsotg) | |||
215 | dev_dbg(hsotg->dev, "%s\n", __func__); | 197 | dev_dbg(hsotg->dev, "%s\n", __func__); |
216 | 198 | ||
217 | /* Restore dev regs */ | 199 | /* Restore dev regs */ |
218 | dr = hsotg->dr_backup; | 200 | dr = &hsotg->dr_backup; |
219 | if (!dr) { | 201 | if (!dr->valid) { |
220 | dev_err(hsotg->dev, "%s: no device registers to restore\n", | 202 | dev_err(hsotg->dev, "%s: no device registers to restore\n", |
221 | __func__); | 203 | __func__); |
222 | return -EINVAL; | 204 | return -EINVAL; |
223 | } | 205 | } |
206 | dr->valid = false; | ||
224 | 207 | ||
225 | writel(dr->dcfg, hsotg->regs + DCFG); | 208 | writel(dr->dcfg, hsotg->regs + DCFG); |
226 | writel(dr->dctl, hsotg->regs + DCTL); | 209 | writel(dr->dctl, hsotg->regs + DCTL); |
@@ -268,17 +251,7 @@ static int dwc2_backup_global_registers(struct dwc2_hsotg *hsotg) | |||
268 | int i; | 251 | int i; |
269 | 252 | ||
270 | /* Backup global regs */ | 253 | /* Backup global regs */ |
271 | gr = hsotg->gr_backup; | 254 | gr = &hsotg->gr_backup; |
272 | if (!gr) { | ||
273 | gr = devm_kzalloc(hsotg->dev, sizeof(*gr), GFP_KERNEL); | ||
274 | if (!gr) { | ||
275 | dev_err(hsotg->dev, "%s: can't allocate global regs\n", | ||
276 | __func__); | ||
277 | return -ENOMEM; | ||
278 | } | ||
279 | |||
280 | hsotg->gr_backup = gr; | ||
281 | } | ||
282 | 255 | ||
283 | gr->gotgctl = readl(hsotg->regs + GOTGCTL); | 256 | gr->gotgctl = readl(hsotg->regs + GOTGCTL); |
284 | gr->gintmsk = readl(hsotg->regs + GINTMSK); | 257 | gr->gintmsk = readl(hsotg->regs + GINTMSK); |
@@ -291,6 +264,7 @@ static int dwc2_backup_global_registers(struct dwc2_hsotg *hsotg) | |||
291 | for (i = 0; i < MAX_EPS_CHANNELS; i++) | 264 | for (i = 0; i < MAX_EPS_CHANNELS; i++) |
292 | gr->dtxfsiz[i] = readl(hsotg->regs + DPTXFSIZN(i)); | 265 | gr->dtxfsiz[i] = readl(hsotg->regs + DPTXFSIZN(i)); |
293 | 266 | ||
267 | gr->valid = true; | ||
294 | return 0; | 268 | return 0; |
295 | } | 269 | } |
296 | 270 | ||
@@ -309,12 +283,13 @@ static int dwc2_restore_global_registers(struct dwc2_hsotg *hsotg) | |||
309 | dev_dbg(hsotg->dev, "%s\n", __func__); | 283 | dev_dbg(hsotg->dev, "%s\n", __func__); |
310 | 284 | ||
311 | /* Restore global regs */ | 285 | /* Restore global regs */ |
312 | gr = hsotg->gr_backup; | 286 | gr = &hsotg->gr_backup; |
313 | if (!gr) { | 287 | if (!gr->valid) { |
314 | dev_err(hsotg->dev, "%s: no global registers to restore\n", | 288 | dev_err(hsotg->dev, "%s: no global registers to restore\n", |
315 | __func__); | 289 | __func__); |
316 | return -EINVAL; | 290 | return -EINVAL; |
317 | } | 291 | } |
292 | gr->valid = false; | ||
318 | 293 | ||
319 | writel(0xffffffff, hsotg->regs + GINTSTS); | 294 | writel(0xffffffff, hsotg->regs + GINTSTS); |
320 | writel(gr->gotgctl, hsotg->regs + GOTGCTL); | 295 | writel(gr->gotgctl, hsotg->regs + GOTGCTL); |
diff --git a/drivers/usb/dwc2/core.h b/drivers/usb/dwc2/core.h index 53b8de03f102..0ed87620941b 100644 --- a/drivers/usb/dwc2/core.h +++ b/drivers/usb/dwc2/core.h | |||
@@ -492,6 +492,7 @@ struct dwc2_gregs_backup { | |||
492 | u32 gdfifocfg; | 492 | u32 gdfifocfg; |
493 | u32 dtxfsiz[MAX_EPS_CHANNELS]; | 493 | u32 dtxfsiz[MAX_EPS_CHANNELS]; |
494 | u32 gpwrdn; | 494 | u32 gpwrdn; |
495 | bool valid; | ||
495 | }; | 496 | }; |
496 | 497 | ||
497 | /** | 498 | /** |
@@ -521,6 +522,7 @@ struct dwc2_dregs_backup { | |||
521 | u32 doepctl[MAX_EPS_CHANNELS]; | 522 | u32 doepctl[MAX_EPS_CHANNELS]; |
522 | u32 doeptsiz[MAX_EPS_CHANNELS]; | 523 | u32 doeptsiz[MAX_EPS_CHANNELS]; |
523 | u32 doepdma[MAX_EPS_CHANNELS]; | 524 | u32 doepdma[MAX_EPS_CHANNELS]; |
525 | bool valid; | ||
524 | }; | 526 | }; |
525 | 527 | ||
526 | /** | 528 | /** |
@@ -538,6 +540,7 @@ struct dwc2_hregs_backup { | |||
538 | u32 hcintmsk[MAX_EPS_CHANNELS]; | 540 | u32 hcintmsk[MAX_EPS_CHANNELS]; |
539 | u32 hprt0; | 541 | u32 hprt0; |
540 | u32 hfir; | 542 | u32 hfir; |
543 | bool valid; | ||
541 | }; | 544 | }; |
542 | 545 | ||
543 | /** | 546 | /** |
@@ -705,9 +708,9 @@ struct dwc2_hsotg { | |||
705 | struct work_struct wf_otg; | 708 | struct work_struct wf_otg; |
706 | struct timer_list wkp_timer; | 709 | struct timer_list wkp_timer; |
707 | enum dwc2_lx_state lx_state; | 710 | enum dwc2_lx_state lx_state; |
708 | struct dwc2_gregs_backup *gr_backup; | 711 | struct dwc2_gregs_backup gr_backup; |
709 | struct dwc2_dregs_backup *dr_backup; | 712 | struct dwc2_dregs_backup dr_backup; |
710 | struct dwc2_hregs_backup *hr_backup; | 713 | struct dwc2_hregs_backup hr_backup; |
711 | 714 | ||
712 | struct dentry *debug_root; | 715 | struct dentry *debug_root; |
713 | struct debugfs_regset32 *regset; | 716 | struct debugfs_regset32 *regset; |
diff --git a/drivers/usb/dwc2/hcd.c b/drivers/usb/dwc2/hcd.c index b10377c65064..f845c41fe9e5 100644 --- a/drivers/usb/dwc2/hcd.c +++ b/drivers/usb/dwc2/hcd.c | |||
@@ -359,10 +359,9 @@ void dwc2_hcd_stop(struct dwc2_hsotg *hsotg) | |||
359 | 359 | ||
360 | /* Caller must hold driver lock */ | 360 | /* Caller must hold driver lock */ |
361 | static int dwc2_hcd_urb_enqueue(struct dwc2_hsotg *hsotg, | 361 | static int dwc2_hcd_urb_enqueue(struct dwc2_hsotg *hsotg, |
362 | struct dwc2_hcd_urb *urb, void **ep_handle, | 362 | struct dwc2_hcd_urb *urb, struct dwc2_qh *qh, |
363 | gfp_t mem_flags) | 363 | struct dwc2_qtd *qtd) |
364 | { | 364 | { |
365 | struct dwc2_qtd *qtd; | ||
366 | u32 intr_mask; | 365 | u32 intr_mask; |
367 | int retval; | 366 | int retval; |
368 | int dev_speed; | 367 | int dev_speed; |
@@ -386,18 +385,15 @@ static int dwc2_hcd_urb_enqueue(struct dwc2_hsotg *hsotg, | |||
386 | return -ENODEV; | 385 | return -ENODEV; |
387 | } | 386 | } |
388 | 387 | ||
389 | qtd = kzalloc(sizeof(*qtd), mem_flags); | ||
390 | if (!qtd) | 388 | if (!qtd) |
391 | return -ENOMEM; | 389 | return -EINVAL; |
392 | 390 | ||
393 | dwc2_hcd_qtd_init(qtd, urb); | 391 | dwc2_hcd_qtd_init(qtd, urb); |
394 | retval = dwc2_hcd_qtd_add(hsotg, qtd, (struct dwc2_qh **)ep_handle, | 392 | retval = dwc2_hcd_qtd_add(hsotg, qtd, qh); |
395 | mem_flags); | ||
396 | if (retval) { | 393 | if (retval) { |
397 | dev_err(hsotg->dev, | 394 | dev_err(hsotg->dev, |
398 | "DWC OTG HCD URB Enqueue failed adding QTD. Error status %d\n", | 395 | "DWC OTG HCD URB Enqueue failed adding QTD. Error status %d\n", |
399 | retval); | 396 | retval); |
400 | kfree(qtd); | ||
401 | return retval; | 397 | return retval; |
402 | } | 398 | } |
403 | 399 | ||
@@ -2445,6 +2441,9 @@ static int _dwc2_hcd_urb_enqueue(struct usb_hcd *hcd, struct urb *urb, | |||
2445 | u32 tflags = 0; | 2441 | u32 tflags = 0; |
2446 | void *buf; | 2442 | void *buf; |
2447 | unsigned long flags; | 2443 | unsigned long flags; |
2444 | struct dwc2_qh *qh; | ||
2445 | bool qh_allocated = false; | ||
2446 | struct dwc2_qtd *qtd; | ||
2448 | 2447 | ||
2449 | if (dbg_urb(urb)) { | 2448 | if (dbg_urb(urb)) { |
2450 | dev_vdbg(hsotg->dev, "DWC OTG HCD URB Enqueue\n"); | 2449 | dev_vdbg(hsotg->dev, "DWC OTG HCD URB Enqueue\n"); |
@@ -2523,15 +2522,32 @@ static int _dwc2_hcd_urb_enqueue(struct usb_hcd *hcd, struct urb *urb, | |||
2523 | urb->iso_frame_desc[i].length); | 2522 | urb->iso_frame_desc[i].length); |
2524 | 2523 | ||
2525 | urb->hcpriv = dwc2_urb; | 2524 | urb->hcpriv = dwc2_urb; |
2525 | qh = (struct dwc2_qh *) ep->hcpriv; | ||
2526 | /* Create QH for the endpoint if it doesn't exist */ | ||
2527 | if (!qh) { | ||
2528 | qh = dwc2_hcd_qh_create(hsotg, dwc2_urb, mem_flags); | ||
2529 | if (!qh) { | ||
2530 | retval = -ENOMEM; | ||
2531 | goto fail0; | ||
2532 | } | ||
2533 | ep->hcpriv = qh; | ||
2534 | qh_allocated = true; | ||
2535 | } | ||
2536 | |||
2537 | qtd = kzalloc(sizeof(*qtd), mem_flags); | ||
2538 | if (!qtd) { | ||
2539 | retval = -ENOMEM; | ||
2540 | goto fail1; | ||
2541 | } | ||
2526 | 2542 | ||
2527 | spin_lock_irqsave(&hsotg->lock, flags); | 2543 | spin_lock_irqsave(&hsotg->lock, flags); |
2528 | retval = usb_hcd_link_urb_to_ep(hcd, urb); | 2544 | retval = usb_hcd_link_urb_to_ep(hcd, urb); |
2529 | if (retval) | 2545 | if (retval) |
2530 | goto fail1; | 2546 | goto fail2; |
2531 | 2547 | ||
2532 | retval = dwc2_hcd_urb_enqueue(hsotg, dwc2_urb, &ep->hcpriv, mem_flags); | 2548 | retval = dwc2_hcd_urb_enqueue(hsotg, dwc2_urb, qh, qtd); |
2533 | if (retval) | 2549 | if (retval) |
2534 | goto fail2; | 2550 | goto fail3; |
2535 | 2551 | ||
2536 | if (alloc_bandwidth) { | 2552 | if (alloc_bandwidth) { |
2537 | dwc2_allocate_bus_bandwidth(hcd, | 2553 | dwc2_allocate_bus_bandwidth(hcd, |
@@ -2543,12 +2559,25 @@ static int _dwc2_hcd_urb_enqueue(struct usb_hcd *hcd, struct urb *urb, | |||
2543 | 2559 | ||
2544 | return 0; | 2560 | return 0; |
2545 | 2561 | ||
2546 | fail2: | 2562 | fail3: |
2547 | dwc2_urb->priv = NULL; | 2563 | dwc2_urb->priv = NULL; |
2548 | usb_hcd_unlink_urb_from_ep(hcd, urb); | 2564 | usb_hcd_unlink_urb_from_ep(hcd, urb); |
2549 | fail1: | 2565 | fail2: |
2550 | spin_unlock_irqrestore(&hsotg->lock, flags); | 2566 | spin_unlock_irqrestore(&hsotg->lock, flags); |
2551 | urb->hcpriv = NULL; | 2567 | urb->hcpriv = NULL; |
2568 | kfree(qtd); | ||
2569 | fail1: | ||
2570 | if (qh_allocated) { | ||
2571 | struct dwc2_qtd *qtd2, *qtd2_tmp; | ||
2572 | |||
2573 | ep->hcpriv = NULL; | ||
2574 | dwc2_hcd_qh_unlink(hsotg, qh); | ||
2575 | /* Free each QTD in the QH's QTD list */ | ||
2576 | list_for_each_entry_safe(qtd2, qtd2_tmp, &qh->qtd_list, | ||
2577 | qtd_list_entry) | ||
2578 | dwc2_hcd_qtd_unlink_and_free(hsotg, qtd2, qh); | ||
2579 | dwc2_hcd_qh_free(hsotg, qh); | ||
2580 | } | ||
2552 | fail0: | 2581 | fail0: |
2553 | kfree(dwc2_urb); | 2582 | kfree(dwc2_urb); |
2554 | 2583 | ||
diff --git a/drivers/usb/dwc2/hcd.h b/drivers/usb/dwc2/hcd.h index 7b5841c40033..fc1054965552 100644 --- a/drivers/usb/dwc2/hcd.h +++ b/drivers/usb/dwc2/hcd.h | |||
@@ -463,6 +463,9 @@ extern void dwc2_hcd_queue_transactions(struct dwc2_hsotg *hsotg, | |||
463 | /* Schedule Queue Functions */ | 463 | /* Schedule Queue Functions */ |
464 | /* Implemented in hcd_queue.c */ | 464 | /* Implemented in hcd_queue.c */ |
465 | extern void dwc2_hcd_init_usecs(struct dwc2_hsotg *hsotg); | 465 | extern void dwc2_hcd_init_usecs(struct dwc2_hsotg *hsotg); |
466 | extern struct dwc2_qh *dwc2_hcd_qh_create(struct dwc2_hsotg *hsotg, | ||
467 | struct dwc2_hcd_urb *urb, | ||
468 | gfp_t mem_flags); | ||
466 | extern void dwc2_hcd_qh_free(struct dwc2_hsotg *hsotg, struct dwc2_qh *qh); | 469 | extern void dwc2_hcd_qh_free(struct dwc2_hsotg *hsotg, struct dwc2_qh *qh); |
467 | extern int dwc2_hcd_qh_add(struct dwc2_hsotg *hsotg, struct dwc2_qh *qh); | 470 | extern int dwc2_hcd_qh_add(struct dwc2_hsotg *hsotg, struct dwc2_qh *qh); |
468 | extern void dwc2_hcd_qh_unlink(struct dwc2_hsotg *hsotg, struct dwc2_qh *qh); | 471 | extern void dwc2_hcd_qh_unlink(struct dwc2_hsotg *hsotg, struct dwc2_qh *qh); |
@@ -471,7 +474,7 @@ extern void dwc2_hcd_qh_deactivate(struct dwc2_hsotg *hsotg, struct dwc2_qh *qh, | |||
471 | 474 | ||
472 | extern void dwc2_hcd_qtd_init(struct dwc2_qtd *qtd, struct dwc2_hcd_urb *urb); | 475 | extern void dwc2_hcd_qtd_init(struct dwc2_qtd *qtd, struct dwc2_hcd_urb *urb); |
473 | extern int dwc2_hcd_qtd_add(struct dwc2_hsotg *hsotg, struct dwc2_qtd *qtd, | 476 | extern int dwc2_hcd_qtd_add(struct dwc2_hsotg *hsotg, struct dwc2_qtd *qtd, |
474 | struct dwc2_qh **qh, gfp_t mem_flags); | 477 | struct dwc2_qh *qh); |
475 | 478 | ||
476 | /* Unlinks and frees a QTD */ | 479 | /* Unlinks and frees a QTD */ |
477 | static inline void dwc2_hcd_qtd_unlink_and_free(struct dwc2_hsotg *hsotg, | 480 | static inline void dwc2_hcd_qtd_unlink_and_free(struct dwc2_hsotg *hsotg, |
diff --git a/drivers/usb/dwc2/hcd_queue.c b/drivers/usb/dwc2/hcd_queue.c index 9b5c36256627..3ad63d392e13 100644 --- a/drivers/usb/dwc2/hcd_queue.c +++ b/drivers/usb/dwc2/hcd_queue.c | |||
@@ -191,7 +191,7 @@ static void dwc2_qh_init(struct dwc2_hsotg *hsotg, struct dwc2_qh *qh, | |||
191 | * | 191 | * |
192 | * Return: Pointer to the newly allocated QH, or NULL on error | 192 | * Return: Pointer to the newly allocated QH, or NULL on error |
193 | */ | 193 | */ |
194 | static struct dwc2_qh *dwc2_hcd_qh_create(struct dwc2_hsotg *hsotg, | 194 | struct dwc2_qh *dwc2_hcd_qh_create(struct dwc2_hsotg *hsotg, |
195 | struct dwc2_hcd_urb *urb, | 195 | struct dwc2_hcd_urb *urb, |
196 | gfp_t mem_flags) | 196 | gfp_t mem_flags) |
197 | { | 197 | { |
@@ -767,57 +767,32 @@ void dwc2_hcd_qtd_init(struct dwc2_qtd *qtd, struct dwc2_hcd_urb *urb) | |||
767 | * | 767 | * |
768 | * @hsotg: The DWC HCD structure | 768 | * @hsotg: The DWC HCD structure |
769 | * @qtd: The QTD to add | 769 | * @qtd: The QTD to add |
770 | * @qh: Out parameter to return queue head | 770 | * @qh: Queue head to add qtd to |
771 | * @atomic_alloc: Flag to do atomic alloc if needed | ||
772 | * | 771 | * |
773 | * Return: 0 if successful, negative error code otherwise | 772 | * Return: 0 if successful, negative error code otherwise |
774 | * | 773 | * |
775 | * Finds the correct QH to place the QTD into. If it does not find a QH, it | 774 | * If the QH to which the QTD is added is not currently scheduled, it is placed |
776 | * will create a new QH. If the QH to which the QTD is added is not currently | 775 | * into the proper schedule based on its EP type. |
777 | * scheduled, it is placed into the proper schedule based on its EP type. | ||
778 | */ | 776 | */ |
779 | int dwc2_hcd_qtd_add(struct dwc2_hsotg *hsotg, struct dwc2_qtd *qtd, | 777 | int dwc2_hcd_qtd_add(struct dwc2_hsotg *hsotg, struct dwc2_qtd *qtd, |
780 | struct dwc2_qh **qh, gfp_t mem_flags) | 778 | struct dwc2_qh *qh) |
781 | { | 779 | { |
782 | struct dwc2_hcd_urb *urb = qtd->urb; | ||
783 | int allocated = 0; | ||
784 | int retval; | 780 | int retval; |
785 | 781 | ||
786 | /* | 782 | if (unlikely(!qh)) { |
787 | * Get the QH which holds the QTD-list to insert to. Create QH if it | 783 | dev_err(hsotg->dev, "%s: Invalid QH\n", __func__); |
788 | * doesn't exist. | 784 | retval = -EINVAL; |
789 | */ | 785 | goto fail; |
790 | if (*qh == NULL) { | ||
791 | *qh = dwc2_hcd_qh_create(hsotg, urb, mem_flags); | ||
792 | if (*qh == NULL) | ||
793 | return -ENOMEM; | ||
794 | allocated = 1; | ||
795 | } | 786 | } |
796 | 787 | ||
797 | retval = dwc2_hcd_qh_add(hsotg, *qh); | 788 | retval = dwc2_hcd_qh_add(hsotg, qh); |
798 | if (retval) | 789 | if (retval) |
799 | goto fail; | 790 | goto fail; |
800 | 791 | ||
801 | qtd->qh = *qh; | 792 | qtd->qh = qh; |
802 | list_add_tail(&qtd->qtd_list_entry, &(*qh)->qtd_list); | 793 | list_add_tail(&qtd->qtd_list_entry, &qh->qtd_list); |
803 | 794 | ||
804 | return 0; | 795 | return 0; |
805 | |||
806 | fail: | 796 | fail: |
807 | if (allocated) { | ||
808 | struct dwc2_qtd *qtd2, *qtd2_tmp; | ||
809 | struct dwc2_qh *qh_tmp = *qh; | ||
810 | |||
811 | *qh = NULL; | ||
812 | dwc2_hcd_qh_unlink(hsotg, qh_tmp); | ||
813 | |||
814 | /* Free each QTD in the QH's QTD list */ | ||
815 | list_for_each_entry_safe(qtd2, qtd2_tmp, &qh_tmp->qtd_list, | ||
816 | qtd_list_entry) | ||
817 | dwc2_hcd_qtd_unlink_and_free(hsotg, qtd2, qh_tmp); | ||
818 | |||
819 | dwc2_hcd_qh_free(hsotg, qh_tmp); | ||
820 | } | ||
821 | |||
822 | return retval; | 797 | return retval; |
823 | } | 798 | } |
diff --git a/drivers/usb/dwc3/core.c b/drivers/usb/dwc3/core.c index 5c110d8e293b..ff5773c66b84 100644 --- a/drivers/usb/dwc3/core.c +++ b/drivers/usb/dwc3/core.c | |||
@@ -446,10 +446,12 @@ static int dwc3_phy_setup(struct dwc3 *dwc) | |||
446 | /* Select the HS PHY interface */ | 446 | /* Select the HS PHY interface */ |
447 | switch (DWC3_GHWPARAMS3_HSPHY_IFC(dwc->hwparams.hwparams3)) { | 447 | switch (DWC3_GHWPARAMS3_HSPHY_IFC(dwc->hwparams.hwparams3)) { |
448 | case DWC3_GHWPARAMS3_HSPHY_IFC_UTMI_ULPI: | 448 | case DWC3_GHWPARAMS3_HSPHY_IFC_UTMI_ULPI: |
449 | if (!strncmp(dwc->hsphy_interface, "utmi", 4)) { | 449 | if (dwc->hsphy_interface && |
450 | !strncmp(dwc->hsphy_interface, "utmi", 4)) { | ||
450 | reg &= ~DWC3_GUSB2PHYCFG_ULPI_UTMI; | 451 | reg &= ~DWC3_GUSB2PHYCFG_ULPI_UTMI; |
451 | break; | 452 | break; |
452 | } else if (!strncmp(dwc->hsphy_interface, "ulpi", 4)) { | 453 | } else if (dwc->hsphy_interface && |
454 | !strncmp(dwc->hsphy_interface, "ulpi", 4)) { | ||
453 | reg |= DWC3_GUSB2PHYCFG_ULPI_UTMI; | 455 | reg |= DWC3_GUSB2PHYCFG_ULPI_UTMI; |
454 | dwc3_writel(dwc->regs, DWC3_GUSB2PHYCFG(0), reg); | 456 | dwc3_writel(dwc->regs, DWC3_GUSB2PHYCFG(0), reg); |
455 | } else { | 457 | } else { |
diff --git a/drivers/usb/gadget/composite.c b/drivers/usb/gadget/composite.c index 4e3447bbd097..58b4657fc721 100644 --- a/drivers/usb/gadget/composite.c +++ b/drivers/usb/gadget/composite.c | |||
@@ -1758,10 +1758,13 @@ unknown: | |||
1758 | * take such requests too, if that's ever needed: to work | 1758 | * take such requests too, if that's ever needed: to work |
1759 | * in config 0, etc. | 1759 | * in config 0, etc. |
1760 | */ | 1760 | */ |
1761 | list_for_each_entry(f, &cdev->config->functions, list) | 1761 | if (cdev->config) { |
1762 | if (f->req_match && f->req_match(f, ctrl)) | 1762 | list_for_each_entry(f, &cdev->config->functions, list) |
1763 | goto try_fun_setup; | 1763 | if (f->req_match && f->req_match(f, ctrl)) |
1764 | f = NULL; | 1764 | goto try_fun_setup; |
1765 | f = NULL; | ||
1766 | } | ||
1767 | |||
1765 | switch (ctrl->bRequestType & USB_RECIP_MASK) { | 1768 | switch (ctrl->bRequestType & USB_RECIP_MASK) { |
1766 | case USB_RECIP_INTERFACE: | 1769 | case USB_RECIP_INTERFACE: |
1767 | if (!cdev->config || intf >= MAX_CONFIG_INTERFACES) | 1770 | if (!cdev->config || intf >= MAX_CONFIG_INTERFACES) |
diff --git a/drivers/usb/gadget/function/f_fs.c b/drivers/usb/gadget/function/f_fs.c index 45b8c8b338df..6e7be91e6097 100644 --- a/drivers/usb/gadget/function/f_fs.c +++ b/drivers/usb/gadget/function/f_fs.c | |||
@@ -924,7 +924,8 @@ static ssize_t ffs_epfile_write_iter(struct kiocb *kiocb, struct iov_iter *from) | |||
924 | 924 | ||
925 | kiocb->private = p; | 925 | kiocb->private = p; |
926 | 926 | ||
927 | kiocb_set_cancel_fn(kiocb, ffs_aio_cancel); | 927 | if (p->aio) |
928 | kiocb_set_cancel_fn(kiocb, ffs_aio_cancel); | ||
928 | 929 | ||
929 | res = ffs_epfile_io(kiocb->ki_filp, p); | 930 | res = ffs_epfile_io(kiocb->ki_filp, p); |
930 | if (res == -EIOCBQUEUED) | 931 | if (res == -EIOCBQUEUED) |
@@ -968,7 +969,8 @@ static ssize_t ffs_epfile_read_iter(struct kiocb *kiocb, struct iov_iter *to) | |||
968 | 969 | ||
969 | kiocb->private = p; | 970 | kiocb->private = p; |
970 | 971 | ||
971 | kiocb_set_cancel_fn(kiocb, ffs_aio_cancel); | 972 | if (p->aio) |
973 | kiocb_set_cancel_fn(kiocb, ffs_aio_cancel); | ||
972 | 974 | ||
973 | res = ffs_epfile_io(kiocb->ki_filp, p); | 975 | res = ffs_epfile_io(kiocb->ki_filp, p); |
974 | if (res == -EIOCBQUEUED) | 976 | if (res == -EIOCBQUEUED) |
diff --git a/drivers/usb/gadget/function/f_mass_storage.c b/drivers/usb/gadget/function/f_mass_storage.c index d2259c663996..f936268d26c6 100644 --- a/drivers/usb/gadget/function/f_mass_storage.c +++ b/drivers/usb/gadget/function/f_mass_storage.c | |||
@@ -2786,7 +2786,7 @@ int fsg_common_set_nluns(struct fsg_common *common, int nluns) | |||
2786 | return -EINVAL; | 2786 | return -EINVAL; |
2787 | } | 2787 | } |
2788 | 2788 | ||
2789 | curlun = kcalloc(nluns, sizeof(*curlun), GFP_KERNEL); | 2789 | curlun = kcalloc(FSG_MAX_LUNS, sizeof(*curlun), GFP_KERNEL); |
2790 | if (unlikely(!curlun)) | 2790 | if (unlikely(!curlun)) |
2791 | return -ENOMEM; | 2791 | return -ENOMEM; |
2792 | 2792 | ||
@@ -2796,8 +2796,6 @@ int fsg_common_set_nluns(struct fsg_common *common, int nluns) | |||
2796 | common->luns = curlun; | 2796 | common->luns = curlun; |
2797 | common->nluns = nluns; | 2797 | common->nluns = nluns; |
2798 | 2798 | ||
2799 | pr_info("Number of LUNs=%d\n", common->nluns); | ||
2800 | |||
2801 | return 0; | 2799 | return 0; |
2802 | } | 2800 | } |
2803 | EXPORT_SYMBOL_GPL(fsg_common_set_nluns); | 2801 | EXPORT_SYMBOL_GPL(fsg_common_set_nluns); |
@@ -3563,14 +3561,26 @@ static struct usb_function *fsg_alloc(struct usb_function_instance *fi) | |||
3563 | struct fsg_opts *opts = fsg_opts_from_func_inst(fi); | 3561 | struct fsg_opts *opts = fsg_opts_from_func_inst(fi); |
3564 | struct fsg_common *common = opts->common; | 3562 | struct fsg_common *common = opts->common; |
3565 | struct fsg_dev *fsg; | 3563 | struct fsg_dev *fsg; |
3564 | unsigned nluns, i; | ||
3566 | 3565 | ||
3567 | fsg = kzalloc(sizeof(*fsg), GFP_KERNEL); | 3566 | fsg = kzalloc(sizeof(*fsg), GFP_KERNEL); |
3568 | if (unlikely(!fsg)) | 3567 | if (unlikely(!fsg)) |
3569 | return ERR_PTR(-ENOMEM); | 3568 | return ERR_PTR(-ENOMEM); |
3570 | 3569 | ||
3571 | mutex_lock(&opts->lock); | 3570 | mutex_lock(&opts->lock); |
3571 | if (!opts->refcnt) { | ||
3572 | for (nluns = i = 0; i < FSG_MAX_LUNS; ++i) | ||
3573 | if (common->luns[i]) | ||
3574 | nluns = i + 1; | ||
3575 | if (!nluns) | ||
3576 | pr_warn("No LUNS defined, continuing anyway\n"); | ||
3577 | else | ||
3578 | common->nluns = nluns; | ||
3579 | pr_info("Number of LUNs=%u\n", common->nluns); | ||
3580 | } | ||
3572 | opts->refcnt++; | 3581 | opts->refcnt++; |
3573 | mutex_unlock(&opts->lock); | 3582 | mutex_unlock(&opts->lock); |
3583 | |||
3574 | fsg->function.name = FSG_DRIVER_DESC; | 3584 | fsg->function.name = FSG_DRIVER_DESC; |
3575 | fsg->function.bind = fsg_bind; | 3585 | fsg->function.bind = fsg_bind; |
3576 | fsg->function.unbind = fsg_unbind; | 3586 | fsg->function.unbind = fsg_unbind; |
diff --git a/drivers/usb/gadget/function/f_midi.c b/drivers/usb/gadget/function/f_midi.c index 6316aa5b1c49..ad50a67c1465 100644 --- a/drivers/usb/gadget/function/f_midi.c +++ b/drivers/usb/gadget/function/f_midi.c | |||
@@ -1145,7 +1145,7 @@ static struct usb_function *f_midi_alloc(struct usb_function_instance *fi) | |||
1145 | if (opts->id && !midi->id) { | 1145 | if (opts->id && !midi->id) { |
1146 | status = -ENOMEM; | 1146 | status = -ENOMEM; |
1147 | mutex_unlock(&opts->lock); | 1147 | mutex_unlock(&opts->lock); |
1148 | goto kstrdup_fail; | 1148 | goto setup_fail; |
1149 | } | 1149 | } |
1150 | midi->in_ports = opts->in_ports; | 1150 | midi->in_ports = opts->in_ports; |
1151 | midi->out_ports = opts->out_ports; | 1151 | midi->out_ports = opts->out_ports; |
@@ -1164,8 +1164,6 @@ static struct usb_function *f_midi_alloc(struct usb_function_instance *fi) | |||
1164 | 1164 | ||
1165 | return &midi->func; | 1165 | return &midi->func; |
1166 | 1166 | ||
1167 | kstrdup_fail: | ||
1168 | f_midi_unregister_card(midi); | ||
1169 | setup_fail: | 1167 | setup_fail: |
1170 | for (--i; i >= 0; i--) | 1168 | for (--i; i >= 0; i--) |
1171 | kfree(midi->in_port[i]); | 1169 | kfree(midi->in_port[i]); |
diff --git a/drivers/usb/gadget/udc/fotg210-udc.c b/drivers/usb/gadget/udc/fotg210-udc.c index e547ea7f56b1..1137e3384218 100644 --- a/drivers/usb/gadget/udc/fotg210-udc.c +++ b/drivers/usb/gadget/udc/fotg210-udc.c | |||
@@ -1171,7 +1171,7 @@ static int fotg210_udc_probe(struct platform_device *pdev) | |||
1171 | udc_name, fotg210); | 1171 | udc_name, fotg210); |
1172 | if (ret < 0) { | 1172 | if (ret < 0) { |
1173 | pr_err("request_irq error (%d)\n", ret); | 1173 | pr_err("request_irq error (%d)\n", ret); |
1174 | goto err_irq; | 1174 | goto err_req; |
1175 | } | 1175 | } |
1176 | 1176 | ||
1177 | ret = usb_add_gadget_udc(&pdev->dev, &fotg210->gadget); | 1177 | ret = usb_add_gadget_udc(&pdev->dev, &fotg210->gadget); |
@@ -1183,7 +1183,6 @@ static int fotg210_udc_probe(struct platform_device *pdev) | |||
1183 | return 0; | 1183 | return 0; |
1184 | 1184 | ||
1185 | err_add_udc: | 1185 | err_add_udc: |
1186 | err_irq: | ||
1187 | free_irq(ires->start, fotg210); | 1186 | free_irq(ires->start, fotg210); |
1188 | 1187 | ||
1189 | err_req: | 1188 | err_req: |
diff --git a/drivers/usb/musb/musb_virthub.c b/drivers/usb/musb/musb_virthub.c index 30842bc195f5..92d5f718659b 100644 --- a/drivers/usb/musb/musb_virthub.c +++ b/drivers/usb/musb/musb_virthub.c | |||
@@ -275,9 +275,7 @@ static int musb_has_gadget(struct musb *musb) | |||
275 | #ifdef CONFIG_USB_MUSB_HOST | 275 | #ifdef CONFIG_USB_MUSB_HOST |
276 | return 1; | 276 | return 1; |
277 | #else | 277 | #else |
278 | if (musb->port_mode == MUSB_PORT_MODE_HOST) | 278 | return musb->port_mode == MUSB_PORT_MODE_HOST; |
279 | return 1; | ||
280 | return musb->g.dev.driver != NULL; | ||
281 | #endif | 279 | #endif |
282 | } | 280 | } |
283 | 281 | ||
diff --git a/drivers/usb/phy/phy-mxs-usb.c b/drivers/usb/phy/phy-mxs-usb.c index 8f7cb068d29b..3fcc0483a081 100644 --- a/drivers/usb/phy/phy-mxs-usb.c +++ b/drivers/usb/phy/phy-mxs-usb.c | |||
@@ -217,6 +217,9 @@ static bool mxs_phy_get_vbus_status(struct mxs_phy *mxs_phy) | |||
217 | { | 217 | { |
218 | unsigned int vbus_value; | 218 | unsigned int vbus_value; |
219 | 219 | ||
220 | if (!mxs_phy->regmap_anatop) | ||
221 | return false; | ||
222 | |||
220 | if (mxs_phy->port_id == 0) | 223 | if (mxs_phy->port_id == 0) |
221 | regmap_read(mxs_phy->regmap_anatop, | 224 | regmap_read(mxs_phy->regmap_anatop, |
222 | ANADIG_USB1_VBUS_DET_STAT, | 225 | ANADIG_USB1_VBUS_DET_STAT, |
diff --git a/drivers/usb/serial/cp210x.c b/drivers/usb/serial/cp210x.c index ffd739e31bfc..eac7ccaa3c85 100644 --- a/drivers/usb/serial/cp210x.c +++ b/drivers/usb/serial/cp210x.c | |||
@@ -187,6 +187,7 @@ static const struct usb_device_id id_table[] = { | |||
187 | { USB_DEVICE(0x1FB9, 0x0602) }, /* Lake Shore Model 648 Magnet Power Supply */ | 187 | { USB_DEVICE(0x1FB9, 0x0602) }, /* Lake Shore Model 648 Magnet Power Supply */ |
188 | { USB_DEVICE(0x1FB9, 0x0700) }, /* Lake Shore Model 737 VSM Controller */ | 188 | { USB_DEVICE(0x1FB9, 0x0700) }, /* Lake Shore Model 737 VSM Controller */ |
189 | { USB_DEVICE(0x1FB9, 0x0701) }, /* Lake Shore Model 776 Hall Matrix */ | 189 | { USB_DEVICE(0x1FB9, 0x0701) }, /* Lake Shore Model 776 Hall Matrix */ |
190 | { USB_DEVICE(0x2626, 0xEA60) }, /* Aruba Networks 7xxx USB Serial Console */ | ||
190 | { USB_DEVICE(0x3195, 0xF190) }, /* Link Instruments MSO-19 */ | 191 | { USB_DEVICE(0x3195, 0xF190) }, /* Link Instruments MSO-19 */ |
191 | { USB_DEVICE(0x3195, 0xF280) }, /* Link Instruments MSO-28 */ | 192 | { USB_DEVICE(0x3195, 0xF280) }, /* Link Instruments MSO-28 */ |
192 | { USB_DEVICE(0x3195, 0xF281) }, /* Link Instruments MSO-28 */ | 193 | { USB_DEVICE(0x3195, 0xF281) }, /* Link Instruments MSO-28 */ |
diff --git a/drivers/usb/serial/mos7720.c b/drivers/usb/serial/mos7720.c index 4f70df33975a..78b4f64c6b00 100644 --- a/drivers/usb/serial/mos7720.c +++ b/drivers/usb/serial/mos7720.c | |||
@@ -121,26 +121,26 @@ static DEFINE_SPINLOCK(release_lock); | |||
121 | static const unsigned int dummy; /* for clarity in register access fns */ | 121 | static const unsigned int dummy; /* for clarity in register access fns */ |
122 | 122 | ||
123 | enum mos_regs { | 123 | enum mos_regs { |
124 | THR, /* serial port regs */ | 124 | MOS7720_THR, /* serial port regs */ |
125 | RHR, | 125 | MOS7720_RHR, |
126 | IER, | 126 | MOS7720_IER, |
127 | FCR, | 127 | MOS7720_FCR, |
128 | ISR, | 128 | MOS7720_ISR, |
129 | LCR, | 129 | MOS7720_LCR, |
130 | MCR, | 130 | MOS7720_MCR, |
131 | LSR, | 131 | MOS7720_LSR, |
132 | MSR, | 132 | MOS7720_MSR, |
133 | SPR, | 133 | MOS7720_SPR, |
134 | DLL, | 134 | MOS7720_DLL, |
135 | DLM, | 135 | MOS7720_DLM, |
136 | DPR, /* parallel port regs */ | 136 | MOS7720_DPR, /* parallel port regs */ |
137 | DSR, | 137 | MOS7720_DSR, |
138 | DCR, | 138 | MOS7720_DCR, |
139 | ECR, | 139 | MOS7720_ECR, |
140 | SP1_REG, /* device control regs */ | 140 | MOS7720_SP1_REG, /* device control regs */ |
141 | SP2_REG, /* serial port 2 (7720 only) */ | 141 | MOS7720_SP2_REG, /* serial port 2 (7720 only) */ |
142 | PP_REG, | 142 | MOS7720_PP_REG, |
143 | SP_CONTROL_REG, | 143 | MOS7720_SP_CONTROL_REG, |
144 | }; | 144 | }; |
145 | 145 | ||
146 | /* | 146 | /* |
@@ -150,26 +150,26 @@ enum mos_regs { | |||
150 | static inline __u16 get_reg_index(enum mos_regs reg) | 150 | static inline __u16 get_reg_index(enum mos_regs reg) |
151 | { | 151 | { |
152 | static const __u16 mos7715_index_lookup_table[] = { | 152 | static const __u16 mos7715_index_lookup_table[] = { |
153 | 0x00, /* THR */ | 153 | 0x00, /* MOS7720_THR */ |
154 | 0x00, /* RHR */ | 154 | 0x00, /* MOS7720_RHR */ |
155 | 0x01, /* IER */ | 155 | 0x01, /* MOS7720_IER */ |
156 | 0x02, /* FCR */ | 156 | 0x02, /* MOS7720_FCR */ |
157 | 0x02, /* ISR */ | 157 | 0x02, /* MOS7720_ISR */ |
158 | 0x03, /* LCR */ | 158 | 0x03, /* MOS7720_LCR */ |
159 | 0x04, /* MCR */ | 159 | 0x04, /* MOS7720_MCR */ |
160 | 0x05, /* LSR */ | 160 | 0x05, /* MOS7720_LSR */ |
161 | 0x06, /* MSR */ | 161 | 0x06, /* MOS7720_MSR */ |
162 | 0x07, /* SPR */ | 162 | 0x07, /* MOS7720_SPR */ |
163 | 0x00, /* DLL */ | 163 | 0x00, /* MOS7720_DLL */ |
164 | 0x01, /* DLM */ | 164 | 0x01, /* MOS7720_DLM */ |
165 | 0x00, /* DPR */ | 165 | 0x00, /* MOS7720_DPR */ |
166 | 0x01, /* DSR */ | 166 | 0x01, /* MOS7720_DSR */ |
167 | 0x02, /* DCR */ | 167 | 0x02, /* MOS7720_DCR */ |
168 | 0x0a, /* ECR */ | 168 | 0x0a, /* MOS7720_ECR */ |
169 | 0x01, /* SP1_REG */ | 169 | 0x01, /* MOS7720_SP1_REG */ |
170 | 0x02, /* SP2_REG (7720 only) */ | 170 | 0x02, /* MOS7720_SP2_REG (7720 only) */ |
171 | 0x04, /* PP_REG (7715 only) */ | 171 | 0x04, /* MOS7720_PP_REG (7715 only) */ |
172 | 0x08, /* SP_CONTROL_REG */ | 172 | 0x08, /* MOS7720_SP_CONTROL_REG */ |
173 | }; | 173 | }; |
174 | return mos7715_index_lookup_table[reg]; | 174 | return mos7715_index_lookup_table[reg]; |
175 | } | 175 | } |
@@ -181,10 +181,10 @@ static inline __u16 get_reg_index(enum mos_regs reg) | |||
181 | static inline __u16 get_reg_value(enum mos_regs reg, | 181 | static inline __u16 get_reg_value(enum mos_regs reg, |
182 | unsigned int serial_portnum) | 182 | unsigned int serial_portnum) |
183 | { | 183 | { |
184 | if (reg >= SP1_REG) /* control reg */ | 184 | if (reg >= MOS7720_SP1_REG) /* control reg */ |
185 | return 0x0000; | 185 | return 0x0000; |
186 | 186 | ||
187 | else if (reg >= DPR) /* parallel port reg (7715 only) */ | 187 | else if (reg >= MOS7720_DPR) /* parallel port reg (7715 only) */ |
188 | return 0x0100; | 188 | return 0x0100; |
189 | 189 | ||
190 | else /* serial port reg */ | 190 | else /* serial port reg */ |
@@ -252,7 +252,8 @@ static inline int mos7715_change_mode(struct mos7715_parport *mos_parport, | |||
252 | enum mos7715_pp_modes mode) | 252 | enum mos7715_pp_modes mode) |
253 | { | 253 | { |
254 | mos_parport->shadowECR = mode; | 254 | mos_parport->shadowECR = mode; |
255 | write_mos_reg(mos_parport->serial, dummy, ECR, mos_parport->shadowECR); | 255 | write_mos_reg(mos_parport->serial, dummy, MOS7720_ECR, |
256 | mos_parport->shadowECR); | ||
256 | return 0; | 257 | return 0; |
257 | } | 258 | } |
258 | 259 | ||
@@ -486,7 +487,7 @@ static void parport_mos7715_write_data(struct parport *pp, unsigned char d) | |||
486 | if (parport_prologue(pp) < 0) | 487 | if (parport_prologue(pp) < 0) |
487 | return; | 488 | return; |
488 | mos7715_change_mode(mos_parport, SPP); | 489 | mos7715_change_mode(mos_parport, SPP); |
489 | write_mos_reg(mos_parport->serial, dummy, DPR, (__u8)d); | 490 | write_mos_reg(mos_parport->serial, dummy, MOS7720_DPR, (__u8)d); |
490 | parport_epilogue(pp); | 491 | parport_epilogue(pp); |
491 | } | 492 | } |
492 | 493 | ||
@@ -497,7 +498,7 @@ static unsigned char parport_mos7715_read_data(struct parport *pp) | |||
497 | 498 | ||
498 | if (parport_prologue(pp) < 0) | 499 | if (parport_prologue(pp) < 0) |
499 | return 0; | 500 | return 0; |
500 | read_mos_reg(mos_parport->serial, dummy, DPR, &d); | 501 | read_mos_reg(mos_parport->serial, dummy, MOS7720_DPR, &d); |
501 | parport_epilogue(pp); | 502 | parport_epilogue(pp); |
502 | return d; | 503 | return d; |
503 | } | 504 | } |
@@ -510,7 +511,7 @@ static void parport_mos7715_write_control(struct parport *pp, unsigned char d) | |||
510 | if (parport_prologue(pp) < 0) | 511 | if (parport_prologue(pp) < 0) |
511 | return; | 512 | return; |
512 | data = ((__u8)d & 0x0f) | (mos_parport->shadowDCR & 0xf0); | 513 | data = ((__u8)d & 0x0f) | (mos_parport->shadowDCR & 0xf0); |
513 | write_mos_reg(mos_parport->serial, dummy, DCR, data); | 514 | write_mos_reg(mos_parport->serial, dummy, MOS7720_DCR, data); |
514 | mos_parport->shadowDCR = data; | 515 | mos_parport->shadowDCR = data; |
515 | parport_epilogue(pp); | 516 | parport_epilogue(pp); |
516 | } | 517 | } |
@@ -543,7 +544,8 @@ static unsigned char parport_mos7715_frob_control(struct parport *pp, | |||
543 | if (parport_prologue(pp) < 0) | 544 | if (parport_prologue(pp) < 0) |
544 | return 0; | 545 | return 0; |
545 | mos_parport->shadowDCR = (mos_parport->shadowDCR & (~mask)) ^ val; | 546 | mos_parport->shadowDCR = (mos_parport->shadowDCR & (~mask)) ^ val; |
546 | write_mos_reg(mos_parport->serial, dummy, DCR, mos_parport->shadowDCR); | 547 | write_mos_reg(mos_parport->serial, dummy, MOS7720_DCR, |
548 | mos_parport->shadowDCR); | ||
547 | dcr = mos_parport->shadowDCR & 0x0f; | 549 | dcr = mos_parport->shadowDCR & 0x0f; |
548 | parport_epilogue(pp); | 550 | parport_epilogue(pp); |
549 | return dcr; | 551 | return dcr; |
@@ -581,7 +583,8 @@ static void parport_mos7715_data_forward(struct parport *pp) | |||
581 | return; | 583 | return; |
582 | mos7715_change_mode(mos_parport, PS2); | 584 | mos7715_change_mode(mos_parport, PS2); |
583 | mos_parport->shadowDCR &= ~0x20; | 585 | mos_parport->shadowDCR &= ~0x20; |
584 | write_mos_reg(mos_parport->serial, dummy, DCR, mos_parport->shadowDCR); | 586 | write_mos_reg(mos_parport->serial, dummy, MOS7720_DCR, |
587 | mos_parport->shadowDCR); | ||
585 | parport_epilogue(pp); | 588 | parport_epilogue(pp); |
586 | } | 589 | } |
587 | 590 | ||
@@ -593,7 +596,8 @@ static void parport_mos7715_data_reverse(struct parport *pp) | |||
593 | return; | 596 | return; |
594 | mos7715_change_mode(mos_parport, PS2); | 597 | mos7715_change_mode(mos_parport, PS2); |
595 | mos_parport->shadowDCR |= 0x20; | 598 | mos_parport->shadowDCR |= 0x20; |
596 | write_mos_reg(mos_parport->serial, dummy, DCR, mos_parport->shadowDCR); | 599 | write_mos_reg(mos_parport->serial, dummy, MOS7720_DCR, |
600 | mos_parport->shadowDCR); | ||
597 | parport_epilogue(pp); | 601 | parport_epilogue(pp); |
598 | } | 602 | } |
599 | 603 | ||
@@ -633,8 +637,10 @@ static void parport_mos7715_restore_state(struct parport *pp, | |||
633 | spin_unlock(&release_lock); | 637 | spin_unlock(&release_lock); |
634 | return; | 638 | return; |
635 | } | 639 | } |
636 | write_parport_reg_nonblock(mos_parport, DCR, mos_parport->shadowDCR); | 640 | write_parport_reg_nonblock(mos_parport, MOS7720_DCR, |
637 | write_parport_reg_nonblock(mos_parport, ECR, mos_parport->shadowECR); | 641 | mos_parport->shadowDCR); |
642 | write_parport_reg_nonblock(mos_parport, MOS7720_ECR, | ||
643 | mos_parport->shadowECR); | ||
638 | spin_unlock(&release_lock); | 644 | spin_unlock(&release_lock); |
639 | } | 645 | } |
640 | 646 | ||
@@ -714,14 +720,16 @@ static int mos7715_parport_init(struct usb_serial *serial) | |||
714 | init_completion(&mos_parport->syncmsg_compl); | 720 | init_completion(&mos_parport->syncmsg_compl); |
715 | 721 | ||
716 | /* cycle parallel port reset bit */ | 722 | /* cycle parallel port reset bit */ |
717 | write_mos_reg(mos_parport->serial, dummy, PP_REG, (__u8)0x80); | 723 | write_mos_reg(mos_parport->serial, dummy, MOS7720_PP_REG, (__u8)0x80); |
718 | write_mos_reg(mos_parport->serial, dummy, PP_REG, (__u8)0x00); | 724 | write_mos_reg(mos_parport->serial, dummy, MOS7720_PP_REG, (__u8)0x00); |
719 | 725 | ||
720 | /* initialize device registers */ | 726 | /* initialize device registers */ |
721 | mos_parport->shadowDCR = DCR_INIT_VAL; | 727 | mos_parport->shadowDCR = DCR_INIT_VAL; |
722 | write_mos_reg(mos_parport->serial, dummy, DCR, mos_parport->shadowDCR); | 728 | write_mos_reg(mos_parport->serial, dummy, MOS7720_DCR, |
729 | mos_parport->shadowDCR); | ||
723 | mos_parport->shadowECR = ECR_INIT_VAL; | 730 | mos_parport->shadowECR = ECR_INIT_VAL; |
724 | write_mos_reg(mos_parport->serial, dummy, ECR, mos_parport->shadowECR); | 731 | write_mos_reg(mos_parport->serial, dummy, MOS7720_ECR, |
732 | mos_parport->shadowECR); | ||
725 | 733 | ||
726 | /* register with parport core */ | 734 | /* register with parport core */ |
727 | mos_parport->pp = parport_register_port(0, PARPORT_IRQ_NONE, | 735 | mos_parport->pp = parport_register_port(0, PARPORT_IRQ_NONE, |
@@ -1033,45 +1041,49 @@ static int mos7720_open(struct tty_struct *tty, struct usb_serial_port *port) | |||
1033 | /* Initialize MCS7720 -- Write Init values to corresponding Registers | 1041 | /* Initialize MCS7720 -- Write Init values to corresponding Registers |
1034 | * | 1042 | * |
1035 | * Register Index | 1043 | * Register Index |
1036 | * 0 : THR/RHR | 1044 | * 0 : MOS7720_THR/MOS7720_RHR |
1037 | * 1 : IER | 1045 | * 1 : MOS7720_IER |
1038 | * 2 : FCR | 1046 | * 2 : MOS7720_FCR |
1039 | * 3 : LCR | 1047 | * 3 : MOS7720_LCR |
1040 | * 4 : MCR | 1048 | * 4 : MOS7720_MCR |
1041 | * 5 : LSR | 1049 | * 5 : MOS7720_LSR |
1042 | * 6 : MSR | 1050 | * 6 : MOS7720_MSR |
1043 | * 7 : SPR | 1051 | * 7 : MOS7720_SPR |
1044 | * | 1052 | * |
1045 | * 0x08 : SP1/2 Control Reg | 1053 | * 0x08 : SP1/2 Control Reg |
1046 | */ | 1054 | */ |
1047 | port_number = port->port_number; | 1055 | port_number = port->port_number; |
1048 | read_mos_reg(serial, port_number, LSR, &data); | 1056 | read_mos_reg(serial, port_number, MOS7720_LSR, &data); |
1049 | 1057 | ||
1050 | dev_dbg(&port->dev, "SS::%p LSR:%x\n", mos7720_port, data); | 1058 | dev_dbg(&port->dev, "SS::%p LSR:%x\n", mos7720_port, data); |
1051 | 1059 | ||
1052 | write_mos_reg(serial, dummy, SP1_REG, 0x02); | 1060 | write_mos_reg(serial, dummy, MOS7720_SP1_REG, 0x02); |
1053 | write_mos_reg(serial, dummy, SP2_REG, 0x02); | 1061 | write_mos_reg(serial, dummy, MOS7720_SP2_REG, 0x02); |
1054 | 1062 | ||
1055 | write_mos_reg(serial, port_number, IER, 0x00); | 1063 | write_mos_reg(serial, port_number, MOS7720_IER, 0x00); |
1056 | write_mos_reg(serial, port_number, FCR, 0x00); | 1064 | write_mos_reg(serial, port_number, MOS7720_FCR, 0x00); |
1057 | 1065 | ||
1058 | write_mos_reg(serial, port_number, FCR, 0xcf); | 1066 | write_mos_reg(serial, port_number, MOS7720_FCR, 0xcf); |
1059 | mos7720_port->shadowLCR = 0x03; | 1067 | mos7720_port->shadowLCR = 0x03; |
1060 | write_mos_reg(serial, port_number, LCR, mos7720_port->shadowLCR); | 1068 | write_mos_reg(serial, port_number, MOS7720_LCR, |
1069 | mos7720_port->shadowLCR); | ||
1061 | mos7720_port->shadowMCR = 0x0b; | 1070 | mos7720_port->shadowMCR = 0x0b; |
1062 | write_mos_reg(serial, port_number, MCR, mos7720_port->shadowMCR); | 1071 | write_mos_reg(serial, port_number, MOS7720_MCR, |
1072 | mos7720_port->shadowMCR); | ||
1063 | 1073 | ||
1064 | write_mos_reg(serial, port_number, SP_CONTROL_REG, 0x00); | 1074 | write_mos_reg(serial, port_number, MOS7720_SP_CONTROL_REG, 0x00); |
1065 | read_mos_reg(serial, dummy, SP_CONTROL_REG, &data); | 1075 | read_mos_reg(serial, dummy, MOS7720_SP_CONTROL_REG, &data); |
1066 | data = data | (port->port_number + 1); | 1076 | data = data | (port->port_number + 1); |
1067 | write_mos_reg(serial, dummy, SP_CONTROL_REG, data); | 1077 | write_mos_reg(serial, dummy, MOS7720_SP_CONTROL_REG, data); |
1068 | mos7720_port->shadowLCR = 0x83; | 1078 | mos7720_port->shadowLCR = 0x83; |
1069 | write_mos_reg(serial, port_number, LCR, mos7720_port->shadowLCR); | 1079 | write_mos_reg(serial, port_number, MOS7720_LCR, |
1070 | write_mos_reg(serial, port_number, THR, 0x0c); | 1080 | mos7720_port->shadowLCR); |
1071 | write_mos_reg(serial, port_number, IER, 0x00); | 1081 | write_mos_reg(serial, port_number, MOS7720_THR, 0x0c); |
1082 | write_mos_reg(serial, port_number, MOS7720_IER, 0x00); | ||
1072 | mos7720_port->shadowLCR = 0x03; | 1083 | mos7720_port->shadowLCR = 0x03; |
1073 | write_mos_reg(serial, port_number, LCR, mos7720_port->shadowLCR); | 1084 | write_mos_reg(serial, port_number, MOS7720_LCR, |
1074 | write_mos_reg(serial, port_number, IER, 0x0c); | 1085 | mos7720_port->shadowLCR); |
1086 | write_mos_reg(serial, port_number, MOS7720_IER, 0x0c); | ||
1075 | 1087 | ||
1076 | response = usb_submit_urb(port->read_urb, GFP_KERNEL); | 1088 | response = usb_submit_urb(port->read_urb, GFP_KERNEL); |
1077 | if (response) | 1089 | if (response) |
@@ -1144,8 +1156,8 @@ static void mos7720_close(struct usb_serial_port *port) | |||
1144 | usb_kill_urb(port->write_urb); | 1156 | usb_kill_urb(port->write_urb); |
1145 | usb_kill_urb(port->read_urb); | 1157 | usb_kill_urb(port->read_urb); |
1146 | 1158 | ||
1147 | write_mos_reg(serial, port->port_number, MCR, 0x00); | 1159 | write_mos_reg(serial, port->port_number, MOS7720_MCR, 0x00); |
1148 | write_mos_reg(serial, port->port_number, IER, 0x00); | 1160 | write_mos_reg(serial, port->port_number, MOS7720_IER, 0x00); |
1149 | 1161 | ||
1150 | mos7720_port->open = 0; | 1162 | mos7720_port->open = 0; |
1151 | } | 1163 | } |
@@ -1169,7 +1181,8 @@ static void mos7720_break(struct tty_struct *tty, int break_state) | |||
1169 | data = mos7720_port->shadowLCR & ~UART_LCR_SBC; | 1181 | data = mos7720_port->shadowLCR & ~UART_LCR_SBC; |
1170 | 1182 | ||
1171 | mos7720_port->shadowLCR = data; | 1183 | mos7720_port->shadowLCR = data; |
1172 | write_mos_reg(serial, port->port_number, LCR, mos7720_port->shadowLCR); | 1184 | write_mos_reg(serial, port->port_number, MOS7720_LCR, |
1185 | mos7720_port->shadowLCR); | ||
1173 | } | 1186 | } |
1174 | 1187 | ||
1175 | /* | 1188 | /* |
@@ -1297,7 +1310,7 @@ static void mos7720_throttle(struct tty_struct *tty) | |||
1297 | /* if we are implementing RTS/CTS, toggle that line */ | 1310 | /* if we are implementing RTS/CTS, toggle that line */ |
1298 | if (tty->termios.c_cflag & CRTSCTS) { | 1311 | if (tty->termios.c_cflag & CRTSCTS) { |
1299 | mos7720_port->shadowMCR &= ~UART_MCR_RTS; | 1312 | mos7720_port->shadowMCR &= ~UART_MCR_RTS; |
1300 | write_mos_reg(port->serial, port->port_number, MCR, | 1313 | write_mos_reg(port->serial, port->port_number, MOS7720_MCR, |
1301 | mos7720_port->shadowMCR); | 1314 | mos7720_port->shadowMCR); |
1302 | } | 1315 | } |
1303 | } | 1316 | } |
@@ -1327,7 +1340,7 @@ static void mos7720_unthrottle(struct tty_struct *tty) | |||
1327 | /* if we are implementing RTS/CTS, toggle that line */ | 1340 | /* if we are implementing RTS/CTS, toggle that line */ |
1328 | if (tty->termios.c_cflag & CRTSCTS) { | 1341 | if (tty->termios.c_cflag & CRTSCTS) { |
1329 | mos7720_port->shadowMCR |= UART_MCR_RTS; | 1342 | mos7720_port->shadowMCR |= UART_MCR_RTS; |
1330 | write_mos_reg(port->serial, port->port_number, MCR, | 1343 | write_mos_reg(port->serial, port->port_number, MOS7720_MCR, |
1331 | mos7720_port->shadowMCR); | 1344 | mos7720_port->shadowMCR); |
1332 | } | 1345 | } |
1333 | } | 1346 | } |
@@ -1352,35 +1365,39 @@ static int set_higher_rates(struct moschip_port *mos7720_port, | |||
1352 | dev_dbg(&port->dev, "Sending Setting Commands ..........\n"); | 1365 | dev_dbg(&port->dev, "Sending Setting Commands ..........\n"); |
1353 | port_number = port->port_number; | 1366 | port_number = port->port_number; |
1354 | 1367 | ||
1355 | write_mos_reg(serial, port_number, IER, 0x00); | 1368 | write_mos_reg(serial, port_number, MOS7720_IER, 0x00); |
1356 | write_mos_reg(serial, port_number, FCR, 0x00); | 1369 | write_mos_reg(serial, port_number, MOS7720_FCR, 0x00); |
1357 | write_mos_reg(serial, port_number, FCR, 0xcf); | 1370 | write_mos_reg(serial, port_number, MOS7720_FCR, 0xcf); |
1358 | mos7720_port->shadowMCR = 0x0b; | 1371 | mos7720_port->shadowMCR = 0x0b; |
1359 | write_mos_reg(serial, port_number, MCR, mos7720_port->shadowMCR); | 1372 | write_mos_reg(serial, port_number, MOS7720_MCR, |
1360 | write_mos_reg(serial, dummy, SP_CONTROL_REG, 0x00); | 1373 | mos7720_port->shadowMCR); |
1374 | write_mos_reg(serial, dummy, MOS7720_SP_CONTROL_REG, 0x00); | ||
1361 | 1375 | ||
1362 | /*********************************************** | 1376 | /*********************************************** |
1363 | * Set for higher rates * | 1377 | * Set for higher rates * |
1364 | ***********************************************/ | 1378 | ***********************************************/ |
1365 | /* writing baud rate verbatum into uart clock field clearly not right */ | 1379 | /* writing baud rate verbatum into uart clock field clearly not right */ |
1366 | if (port_number == 0) | 1380 | if (port_number == 0) |
1367 | sp_reg = SP1_REG; | 1381 | sp_reg = MOS7720_SP1_REG; |
1368 | else | 1382 | else |
1369 | sp_reg = SP2_REG; | 1383 | sp_reg = MOS7720_SP2_REG; |
1370 | write_mos_reg(serial, dummy, sp_reg, baud * 0x10); | 1384 | write_mos_reg(serial, dummy, sp_reg, baud * 0x10); |
1371 | write_mos_reg(serial, dummy, SP_CONTROL_REG, 0x03); | 1385 | write_mos_reg(serial, dummy, MOS7720_SP_CONTROL_REG, 0x03); |
1372 | mos7720_port->shadowMCR = 0x2b; | 1386 | mos7720_port->shadowMCR = 0x2b; |
1373 | write_mos_reg(serial, port_number, MCR, mos7720_port->shadowMCR); | 1387 | write_mos_reg(serial, port_number, MOS7720_MCR, |
1388 | mos7720_port->shadowMCR); | ||
1374 | 1389 | ||
1375 | /*********************************************** | 1390 | /*********************************************** |
1376 | * Set DLL/DLM | 1391 | * Set DLL/DLM |
1377 | ***********************************************/ | 1392 | ***********************************************/ |
1378 | mos7720_port->shadowLCR = mos7720_port->shadowLCR | UART_LCR_DLAB; | 1393 | mos7720_port->shadowLCR = mos7720_port->shadowLCR | UART_LCR_DLAB; |
1379 | write_mos_reg(serial, port_number, LCR, mos7720_port->shadowLCR); | 1394 | write_mos_reg(serial, port_number, MOS7720_LCR, |
1380 | write_mos_reg(serial, port_number, DLL, 0x01); | 1395 | mos7720_port->shadowLCR); |
1381 | write_mos_reg(serial, port_number, DLM, 0x00); | 1396 | write_mos_reg(serial, port_number, MOS7720_DLL, 0x01); |
1397 | write_mos_reg(serial, port_number, MOS7720_DLM, 0x00); | ||
1382 | mos7720_port->shadowLCR = mos7720_port->shadowLCR & ~UART_LCR_DLAB; | 1398 | mos7720_port->shadowLCR = mos7720_port->shadowLCR & ~UART_LCR_DLAB; |
1383 | write_mos_reg(serial, port_number, LCR, mos7720_port->shadowLCR); | 1399 | write_mos_reg(serial, port_number, MOS7720_LCR, |
1400 | mos7720_port->shadowLCR); | ||
1384 | 1401 | ||
1385 | return 0; | 1402 | return 0; |
1386 | } | 1403 | } |
@@ -1488,15 +1505,16 @@ static int send_cmd_write_baud_rate(struct moschip_port *mos7720_port, | |||
1488 | 1505 | ||
1489 | /* Enable access to divisor latch */ | 1506 | /* Enable access to divisor latch */ |
1490 | mos7720_port->shadowLCR = mos7720_port->shadowLCR | UART_LCR_DLAB; | 1507 | mos7720_port->shadowLCR = mos7720_port->shadowLCR | UART_LCR_DLAB; |
1491 | write_mos_reg(serial, number, LCR, mos7720_port->shadowLCR); | 1508 | write_mos_reg(serial, number, MOS7720_LCR, mos7720_port->shadowLCR); |
1492 | 1509 | ||
1493 | /* Write the divisor */ | 1510 | /* Write the divisor */ |
1494 | write_mos_reg(serial, number, DLL, (__u8)(divisor & 0xff)); | 1511 | write_mos_reg(serial, number, MOS7720_DLL, (__u8)(divisor & 0xff)); |
1495 | write_mos_reg(serial, number, DLM, (__u8)((divisor & 0xff00) >> 8)); | 1512 | write_mos_reg(serial, number, MOS7720_DLM, |
1513 | (__u8)((divisor & 0xff00) >> 8)); | ||
1496 | 1514 | ||
1497 | /* Disable access to divisor latch */ | 1515 | /* Disable access to divisor latch */ |
1498 | mos7720_port->shadowLCR = mos7720_port->shadowLCR & ~UART_LCR_DLAB; | 1516 | mos7720_port->shadowLCR = mos7720_port->shadowLCR & ~UART_LCR_DLAB; |
1499 | write_mos_reg(serial, number, LCR, mos7720_port->shadowLCR); | 1517 | write_mos_reg(serial, number, MOS7720_LCR, mos7720_port->shadowLCR); |
1500 | 1518 | ||
1501 | return status; | 1519 | return status; |
1502 | } | 1520 | } |
@@ -1600,14 +1618,16 @@ static void change_port_settings(struct tty_struct *tty, | |||
1600 | 1618 | ||
1601 | 1619 | ||
1602 | /* Disable Interrupts */ | 1620 | /* Disable Interrupts */ |
1603 | write_mos_reg(serial, port_number, IER, 0x00); | 1621 | write_mos_reg(serial, port_number, MOS7720_IER, 0x00); |
1604 | write_mos_reg(serial, port_number, FCR, 0x00); | 1622 | write_mos_reg(serial, port_number, MOS7720_FCR, 0x00); |
1605 | write_mos_reg(serial, port_number, FCR, 0xcf); | 1623 | write_mos_reg(serial, port_number, MOS7720_FCR, 0xcf); |
1606 | 1624 | ||
1607 | /* Send the updated LCR value to the mos7720 */ | 1625 | /* Send the updated LCR value to the mos7720 */ |
1608 | write_mos_reg(serial, port_number, LCR, mos7720_port->shadowLCR); | 1626 | write_mos_reg(serial, port_number, MOS7720_LCR, |
1627 | mos7720_port->shadowLCR); | ||
1609 | mos7720_port->shadowMCR = 0x0b; | 1628 | mos7720_port->shadowMCR = 0x0b; |
1610 | write_mos_reg(serial, port_number, MCR, mos7720_port->shadowMCR); | 1629 | write_mos_reg(serial, port_number, MOS7720_MCR, |
1630 | mos7720_port->shadowMCR); | ||
1611 | 1631 | ||
1612 | /* set up the MCR register and send it to the mos7720 */ | 1632 | /* set up the MCR register and send it to the mos7720 */ |
1613 | mos7720_port->shadowMCR = UART_MCR_OUT2; | 1633 | mos7720_port->shadowMCR = UART_MCR_OUT2; |
@@ -1619,14 +1639,17 @@ static void change_port_settings(struct tty_struct *tty, | |||
1619 | /* To set hardware flow control to the specified * | 1639 | /* To set hardware flow control to the specified * |
1620 | * serial port, in SP1/2_CONTROL_REG */ | 1640 | * serial port, in SP1/2_CONTROL_REG */ |
1621 | if (port_number) | 1641 | if (port_number) |
1622 | write_mos_reg(serial, dummy, SP_CONTROL_REG, 0x01); | 1642 | write_mos_reg(serial, dummy, MOS7720_SP_CONTROL_REG, |
1643 | 0x01); | ||
1623 | else | 1644 | else |
1624 | write_mos_reg(serial, dummy, SP_CONTROL_REG, 0x02); | 1645 | write_mos_reg(serial, dummy, MOS7720_SP_CONTROL_REG, |
1646 | 0x02); | ||
1625 | 1647 | ||
1626 | } else | 1648 | } else |
1627 | mos7720_port->shadowMCR &= ~(UART_MCR_XONANY); | 1649 | mos7720_port->shadowMCR &= ~(UART_MCR_XONANY); |
1628 | 1650 | ||
1629 | write_mos_reg(serial, port_number, MCR, mos7720_port->shadowMCR); | 1651 | write_mos_reg(serial, port_number, MOS7720_MCR, |
1652 | mos7720_port->shadowMCR); | ||
1630 | 1653 | ||
1631 | /* Determine divisor based on baud rate */ | 1654 | /* Determine divisor based on baud rate */ |
1632 | baud = tty_get_baud_rate(tty); | 1655 | baud = tty_get_baud_rate(tty); |
@@ -1639,7 +1662,7 @@ static void change_port_settings(struct tty_struct *tty, | |||
1639 | if (baud >= 230400) { | 1662 | if (baud >= 230400) { |
1640 | set_higher_rates(mos7720_port, baud); | 1663 | set_higher_rates(mos7720_port, baud); |
1641 | /* Enable Interrupts */ | 1664 | /* Enable Interrupts */ |
1642 | write_mos_reg(serial, port_number, IER, 0x0c); | 1665 | write_mos_reg(serial, port_number, MOS7720_IER, 0x0c); |
1643 | return; | 1666 | return; |
1644 | } | 1667 | } |
1645 | 1668 | ||
@@ -1650,7 +1673,7 @@ static void change_port_settings(struct tty_struct *tty, | |||
1650 | if (cflag & CBAUD) | 1673 | if (cflag & CBAUD) |
1651 | tty_encode_baud_rate(tty, baud, baud); | 1674 | tty_encode_baud_rate(tty, baud, baud); |
1652 | /* Enable Interrupts */ | 1675 | /* Enable Interrupts */ |
1653 | write_mos_reg(serial, port_number, IER, 0x0c); | 1676 | write_mos_reg(serial, port_number, MOS7720_IER, 0x0c); |
1654 | 1677 | ||
1655 | if (port->read_urb->status != -EINPROGRESS) { | 1678 | if (port->read_urb->status != -EINPROGRESS) { |
1656 | status = usb_submit_urb(port->read_urb, GFP_KERNEL); | 1679 | status = usb_submit_urb(port->read_urb, GFP_KERNEL); |
@@ -1725,7 +1748,7 @@ static int get_lsr_info(struct tty_struct *tty, | |||
1725 | 1748 | ||
1726 | count = mos7720_chars_in_buffer(tty); | 1749 | count = mos7720_chars_in_buffer(tty); |
1727 | if (count == 0) { | 1750 | if (count == 0) { |
1728 | read_mos_reg(port->serial, port_number, LSR, &data); | 1751 | read_mos_reg(port->serial, port_number, MOS7720_LSR, &data); |
1729 | if ((data & (UART_LSR_TEMT | UART_LSR_THRE)) | 1752 | if ((data & (UART_LSR_TEMT | UART_LSR_THRE)) |
1730 | == (UART_LSR_TEMT | UART_LSR_THRE)) { | 1753 | == (UART_LSR_TEMT | UART_LSR_THRE)) { |
1731 | dev_dbg(&port->dev, "%s -- Empty\n", __func__); | 1754 | dev_dbg(&port->dev, "%s -- Empty\n", __func__); |
@@ -1782,7 +1805,7 @@ static int mos7720_tiocmset(struct tty_struct *tty, | |||
1782 | mcr &= ~UART_MCR_LOOP; | 1805 | mcr &= ~UART_MCR_LOOP; |
1783 | 1806 | ||
1784 | mos7720_port->shadowMCR = mcr; | 1807 | mos7720_port->shadowMCR = mcr; |
1785 | write_mos_reg(port->serial, port->port_number, MCR, | 1808 | write_mos_reg(port->serial, port->port_number, MOS7720_MCR, |
1786 | mos7720_port->shadowMCR); | 1809 | mos7720_port->shadowMCR); |
1787 | 1810 | ||
1788 | return 0; | 1811 | return 0; |
@@ -1827,7 +1850,7 @@ static int set_modem_info(struct moschip_port *mos7720_port, unsigned int cmd, | |||
1827 | } | 1850 | } |
1828 | 1851 | ||
1829 | mos7720_port->shadowMCR = mcr; | 1852 | mos7720_port->shadowMCR = mcr; |
1830 | write_mos_reg(port->serial, port->port_number, MCR, | 1853 | write_mos_reg(port->serial, port->port_number, MOS7720_MCR, |
1831 | mos7720_port->shadowMCR); | 1854 | mos7720_port->shadowMCR); |
1832 | 1855 | ||
1833 | return 0; | 1856 | return 0; |
@@ -1942,7 +1965,7 @@ static int mos7720_startup(struct usb_serial *serial) | |||
1942 | } | 1965 | } |
1943 | #endif | 1966 | #endif |
1944 | /* LSR For Port 1 */ | 1967 | /* LSR For Port 1 */ |
1945 | read_mos_reg(serial, 0, LSR, &data); | 1968 | read_mos_reg(serial, 0, MOS7720_LSR, &data); |
1946 | dev_dbg(&dev->dev, "LSR:%x\n", data); | 1969 | dev_dbg(&dev->dev, "LSR:%x\n", data); |
1947 | 1970 | ||
1948 | return 0; | 1971 | return 0; |
diff --git a/drivers/usb/serial/option.c b/drivers/usb/serial/option.c index f0c0c53359ad..19b85ee98a72 100644 --- a/drivers/usb/serial/option.c +++ b/drivers/usb/serial/option.c | |||
@@ -1765,6 +1765,7 @@ static const struct usb_device_id option_ids[] = { | |||
1765 | { USB_DEVICE_AND_INTERFACE_INFO(0x2001, 0x7d03, 0xff, 0x00, 0x00) }, | 1765 | { USB_DEVICE_AND_INTERFACE_INFO(0x2001, 0x7d03, 0xff, 0x00, 0x00) }, |
1766 | { USB_DEVICE_AND_INTERFACE_INFO(0x07d1, 0x3e01, 0xff, 0xff, 0xff) }, /* D-Link DWM-152/C1 */ | 1766 | { USB_DEVICE_AND_INTERFACE_INFO(0x07d1, 0x3e01, 0xff, 0xff, 0xff) }, /* D-Link DWM-152/C1 */ |
1767 | { USB_DEVICE_AND_INTERFACE_INFO(0x07d1, 0x3e02, 0xff, 0xff, 0xff) }, /* D-Link DWM-156/C1 */ | 1767 | { USB_DEVICE_AND_INTERFACE_INFO(0x07d1, 0x3e02, 0xff, 0xff, 0xff) }, /* D-Link DWM-156/C1 */ |
1768 | { USB_DEVICE_INTERFACE_CLASS(0x2020, 0x4000, 0xff) }, /* OLICARD300 - MT6225 */ | ||
1768 | { USB_DEVICE(INOVIA_VENDOR_ID, INOVIA_SEW858) }, | 1769 | { USB_DEVICE(INOVIA_VENDOR_ID, INOVIA_SEW858) }, |
1769 | { USB_DEVICE(VIATELECOM_VENDOR_ID, VIATELECOM_PRODUCT_CDS7) }, | 1770 | { USB_DEVICE(VIATELECOM_VENDOR_ID, VIATELECOM_PRODUCT_CDS7) }, |
1770 | { } /* Terminating entry */ | 1771 | { } /* Terminating entry */ |
diff --git a/drivers/usb/serial/usb-serial.c b/drivers/usb/serial/usb-serial.c index 529066bbc7e8..46f1f13b41f1 100644 --- a/drivers/usb/serial/usb-serial.c +++ b/drivers/usb/serial/usb-serial.c | |||
@@ -1306,6 +1306,7 @@ static void __exit usb_serial_exit(void) | |||
1306 | tty_unregister_driver(usb_serial_tty_driver); | 1306 | tty_unregister_driver(usb_serial_tty_driver); |
1307 | put_tty_driver(usb_serial_tty_driver); | 1307 | put_tty_driver(usb_serial_tty_driver); |
1308 | bus_unregister(&usb_serial_bus_type); | 1308 | bus_unregister(&usb_serial_bus_type); |
1309 | idr_destroy(&serial_minors); | ||
1309 | } | 1310 | } |
1310 | 1311 | ||
1311 | 1312 | ||