History

Merge git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb-2.6

* git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb-2.6: USB: unbind all interfaces before rebinding them USB: serial: digi_acceleport: Eliminate a NULL pointer dereference usb: fix ehci_hcd build failure when both generic-OF and xilinx is selected USB: cdc-acm: fix resource reclaim in error path of acm_probe USB: ftdi_sio: fix DTR/RTS line modes USB: s3c-hsotg: Ensure FIFOs are fully flushed after layout USB: s3c-hsotg: SoftDisconnect minimum 3ms USB: s3c-hsotg: Ensure TX FIFO addresses setup when initialising FIFOs USB: s3c_hsotg: define USB_GADGET_DUALSPEED in Kconfig USB: s3c: Enable soft disconnect during initialization USB: xhci: Print NEC firmware version. USB: xhci: Wait for host to start running. USB: xhci: Wait for controller to be ready after reset. USB: isp1362: fix inw warning on Blackfin systems USB: mos7840: fix null-pointer dereference

Linus Torvalds committed 16 years ago

Commit d7940b02 parents 683eb94 c043f1213 files · +180 −18Browse files

Unified · Split

13 files
  1. drivers/usb/class/cdc-acm.c +4 −2
  2. drivers/usb/core/driver.c +2 −0
  3. drivers/usb/gadget/Kconfig +1 −0
  4. drivers/usb/gadget/s3c-hsotg.c +57 −0
  5. drivers/usb/host/ehci-hcd.c +17 −3
  6. drivers/usb/host/isp1362.h +1 −1
  7. drivers/usb/host/xhci-pci.c +2 −0
  8. drivers/usb/host/xhci-ring.c +30 −1
  9. drivers/usb/host/xhci.c +49 −8
  10. drivers/usb/host/xhci.h +12 −0
  11. drivers/usb/serial/digi_acceleport.c +1 −2
  12. drivers/usb/serial/ftdi_sio.c +4 −0
  13. drivers/usb/serial/mos7840.c +0 −1
drivers/usb/class/cdc-acm.c+4−2
@@ -1201,7 +1201,7 @@ made_compressed_probe: · 1200 unmodified lines
12011201 if (rcv->urb == NULL) {
12021202 dev_dbg(&intf->dev,
12031203 "out of memory (read urbs usb_alloc_urb)\n");
1204− goto alloc_fail7;
1204+ goto alloc_fail6;
12051205 }
12061206
12071207 rcv->urb->transfer_flags |= URB_NO_TRANSFER_DMA_MAP;
@@ -1225,7 +1225,7 @@ made_compressed_probe: · 17 unmodified lines
12251225 if (snd->urb == NULL) {
12261226 dev_dbg(&intf->dev,
12271227 "out of memory (write urbs usb_alloc_urb)");
1228− goto alloc_fail7;
1228+ goto alloc_fail8;
12291229 }
12301230
12311231 if (usb_endpoint_xfer_int(epwrite))
@@ -1264,6 +1264,7 @@ made_compressed_probe: · 32 unmodified lines
12641264 i = device_create_file(&intf->dev,
12651265 &dev_attr_iCountryCodeRelDate);
12661266 if (i < 0) {
1267+ device_remove_file(&intf->dev, &dev_attr_wCountryCodes);
12671268 kfree(acm->country_codes);
12681269 goto skip_countries;
12691270 }
@@ -1300,6 +1301,7 @@ alloc_fail8: · 30 unmodified lines
13001301 usb_free_urb(acm->wb[i].urb);
13011302 alloc_fail7:
13021303 acm_read_buffers_free(acm);
1304+alloc_fail6:
13031305 for (i = 0; i < num_rx_buf; i++)
13041306 usb_free_urb(acm->ru[i].urb);
13051307 usb_free_urb(acm->ctrlurb);
drivers/usb/core/driver.c+2−0
@@ -1328,6 +1328,7 @@ int usb_resume(struct device *dev, pm_message_t msg) · 1327 unmodified lines
13281328
13291329 /* For all other calls, take the device back to full power and
13301330 * tell the PM core in case it was autosuspended previously.
1331+ * Unbind the interfaces that will need rebinding later.
13311332 */
13321333 } else {
13331334 status = usb_resume_both(udev, msg);
@@ -1336,6 +1337,7 @@ int usb_resume(struct device *dev, pm_message_t msg) · 2 unmodified lines
13361337 pm_runtime_set_active(dev);
13371338 pm_runtime_enable(dev);
13381339 udev->last_busy = jiffies;
1340+ do_unbind_rebind(udev, DO_REBIND);
13391341 }
13401342 }
13411343
drivers/usb/gadget/Kconfig+1−0
@@ -295,6 +295,7 @@ config USB_GADGET_S3C_HSOTG · 294 unmodified lines
295295 boolean "S3C HS/OtG USB Device controller"
296296 depends on S3C_DEV_USB_HSOTG
297297 select USB_GADGET_S3C_HSOTG_PIO
298+ select USB_GADGET_DUALSPEED
298299 help
299300 The Samsung S3C64XX USB2.0 high-speed gadget controller
300301 integrated into the S3C64XX series SoC.
drivers/usb/gadget/s3c-hsotg.c+57−0
@@ -297,6 +297,12 @@ static void s3c_hsotg_ctrl_epint(struct s3c_hsotg *hsotg, · 296 unmodified lines
297297 */
298298 static void s3c_hsotg_init_fifo(struct s3c_hsotg *hsotg)
299299 {
300+ unsigned int ep;
301+ unsigned int addr;
302+ unsigned int size;
303+ int timeout;
304+ u32 val;
305+
300306 /* the ryu 2.6.24 release ahs
301307 writel(0x1C0, hsotg->regs + S3C_GRXFSIZ);
302308 writel(S3C_GNPTXFSIZ_NPTxFStAddr(0x200) |
@@ -310,6 +316,51 @@ static void s3c_hsotg_init_fifo(struct s3c_hsotg *hsotg) · 7 unmodified lines
310316 writel(S3C_GNPTXFSIZ_NPTxFStAddr(2048) |
311317 S3C_GNPTXFSIZ_NPTxFDep(0x1C0),
312318 hsotg->regs + S3C_GNPTXFSIZ);
319+
320+ /* arange all the rest of the TX FIFOs, as some versions of this
321+ * block have overlapping default addresses. This also ensures
322+ * that if the settings have been changed, then they are set to
323+ * known values. */
324+
325+ /* start at the end of the GNPTXFSIZ, rounded up */
326+ addr = 2048 + 1024;
327+ size = 768;
328+
329+ /* currently we allocate TX FIFOs for all possible endpoints,
330+ * and assume that they are all the same size. */
331+
332+ for (ep = 0; ep <= 15; ep++) {
333+ val = addr;
334+ val |= size << S3C_DPTXFSIZn_DPTxFSize_SHIFT;
335+ addr += size;
336+
337+ writel(val, hsotg->regs + S3C_DPTXFSIZn(ep));
338+ }
339+
340+ /* according to p428 of the design guide, we need to ensure that
341+ * all fifos are flushed before continuing */
342+
343+ writel(S3C_GRSTCTL_TxFNum(0x10) | S3C_GRSTCTL_TxFFlsh |
344+ S3C_GRSTCTL_RxFFlsh, hsotg->regs + S3C_GRSTCTL);
345+
346+ /* wait until the fifos are both flushed */
347+ timeout = 100;
348+ while (1) {
349+ val = readl(hsotg->regs + S3C_GRSTCTL);
350+
351+ if ((val & (S3C_GRSTCTL_TxFFlsh | S3C_GRSTCTL_RxFFlsh)) == 0)
352+ break;
353+
354+ if (--timeout == 0) {
355+ dev_err(hsotg->dev,
356+ "%s: timeout flushing fifos (GRSTCTL=%08x)\n",
357+ __func__, val);
358+ }
359+
360+ udelay(1);
361+ }
362+
363+ dev_dbg(hsotg->dev, "FIFOs reset, timeout at %d\n", timeout);
313364 }
314365
315366 /**
@@ -2574,6 +2625,9 @@ int usb_gadget_register_driver(struct usb_gadget_driver *driver) · 2258 unmodified lines
25742625 writel(S3C_DCTL_CGOUTNak | S3C_DCTL_CGNPInNAK,
25752626 hsotg->regs + S3C_DCTL);
25762627
2628+ /* must be at-least 3ms to allow bus to see disconnect */
2629+ msleep(3);
2630+
25772631 /* remove the soft-disconnect and let's go */
25782632 __bic32(hsotg->regs + S3C_DCTL, S3C_DCTL_SftDiscon);
25792633
@@ -2730,6 +2784,9 @@ static void s3c_hsotg_init(struct s3c_hsotg *hsotg) · 150 unmodified lines
27302784
27312785 writel(0, hsotg->regs + S3C_DAINTMSK);
27322786
2787+ /* Be in disconnected state until gadget is registered */
2788+ __orr32(hsotg->regs + S3C_DCTL, S3C_DCTL_SftDiscon);
2789+
27332790 if (0) {
27342791 /* post global nak until we're ready */
27352792 writel(S3C_DCTL_SGNPInNAK | S3C_DCTL_SGOUTNak,
drivers/usb/host/ehci-hcd.c+17−3
@@ -1135,7 +1135,7 @@ MODULE_LICENSE ("GPL"); · 1134 unmodified lines
11351135
11361136 #ifdef CONFIG_XPS_USB_HCD_XILINX
11371137 #include "ehci-xilinx-of.c"
1138−#define OF_PLATFORM_DRIVER ehci_hcd_xilinx_of_driver
1138+#define XILINX_OF_PLATFORM_DRIVER ehci_hcd_xilinx_of_driver
11391139 #endif
11401140
11411141 #ifdef CONFIG_PLAT_ORION
@@ -1159,7 +1159,8 @@ MODULE_LICENSE ("GPL"); · 17 unmodified lines
11591159 #endif
11601160
11611161 #if !defined(PCI_DRIVER) && !defined(PLATFORM_DRIVER) && \
1162− !defined(PS3_SYSTEM_BUS_DRIVER) && !defined(OF_PLATFORM_DRIVER)
1162+ !defined(PS3_SYSTEM_BUS_DRIVER) && !defined(OF_PLATFORM_DRIVER) && \
1163+ !defined(XILINX_OF_PLATFORM_DRIVER)
11631164 #error "missing bus glue for ehci-hcd"
11641165 #endif
11651166
@@ -1213,10 +1214,20 @@ static int __init ehci_hcd_init(void) · 47 unmodified lines
12131214 if (retval < 0)
12141215 goto clean3;
12151216 #endif
1217+
1218+#ifdef XILINX_OF_PLATFORM_DRIVER
1219+ retval = of_register_platform_driver(&XILINX_OF_PLATFORM_DRIVER);
1220+ if (retval < 0)
1221+ goto clean4;
1222+#endif
12161223 return retval;
12171224
1225+#ifdef XILINX_OF_PLATFORM_DRIVER
1226+ /* of_unregister_platform_driver(&XILINX_OF_PLATFORM_DRIVER); */
1227+clean4:
1228+#endif
12181229 #ifdef OF_PLATFORM_DRIVER
1219− /* of_unregister_platform_driver(&OF_PLATFORM_DRIVER); */
1230+ of_unregister_platform_driver(&OF_PLATFORM_DRIVER);
12201231 clean3:
12211232 #endif
12221233 #ifdef PS3_SYSTEM_BUS_DRIVER
@@ -1243,6 +1254,9 @@ module_init(ehci_hcd_init); · 20 unmodified lines
12431254
12441255 static void __exit ehci_hcd_cleanup(void)
12451256 {
1257+#ifdef XILINX_OF_PLATFORM_DRIVER
1258+ of_unregister_platform_driver(&XILINX_OF_PLATFORM_DRIVER);
1259+#endif
12461260 #ifdef OF_PLATFORM_DRIVER
12471261 of_unregister_platform_driver(&OF_PLATFORM_DRIVER);
12481262 #endif
drivers/usb/host/isp1362.h+1−1
@@ -65,7 +65,7 @@ static inline void delayed_insw(unsigned int addr, void *buf, int len) · 64 unmodified lines
6565 unsigned short *bp = (unsigned short *)buf;
6666 while (len--) {
6767 DUMMY_DELAY_ACCESS;
68− *bp++ = inw((void *)addr);
68+ *bp++ = inw(addr);
6969 }
7070 }
7171
drivers/usb/host/xhci-pci.c+2−0
@@ -78,6 +78,8 @@ static int xhci_pci_setup(struct usb_hcd *hcd) · 77 unmodified lines
7878 xhci_dbg(xhci, "QUIRK: Fresco Logic xHC needs configure"
7979 " endpoint cmd after reset endpoint\n");
8080 }
81+ if (pdev->vendor == PCI_VENDOR_ID_NEC)
82+ xhci->quirks |= XHCI_NEC_HOST;
8183
8284 /* Make sure the HC is halted. */
8385 retval = xhci_halt(xhci);
drivers/usb/host/xhci-ring.c+30−1
@@ -1071,6 +1071,15 @@ bandwidth_change: · 1070 unmodified lines
10711071 xhci_warn(xhci, "Reset device command completion "
10721072 "for disabled slot %u\n", slot_id);
10731073 break;
1074+ case TRB_TYPE(TRB_NEC_GET_FW):
1075+ if (!(xhci->quirks & XHCI_NEC_HOST)) {
1076+ xhci->error_bitmask |= 1 << 6;
1077+ break;
1078+ }
1079+ xhci_dbg(xhci, "NEC firmware version %2x.%02x\n",
1080+ NEC_FW_MAJOR(event->status),
1081+ NEC_FW_MINOR(event->status));
1082+ break;
10741083 default:
10751084 /* Skip over unknown commands on the event ring */
10761085 xhci->error_bitmask |= 1 << 6;
@@ -1079,6 +1088,17 @@ bandwidth_change: · 2 unmodified lines
10791088 inc_deq(xhci, xhci->cmd_ring, false);
10801089 }
10811090
1091+static void handle_vendor_event(struct xhci_hcd *xhci,
1092+ union xhci_trb *event)
1093+{
1094+ u32 trb_type;
1095+
1096+ trb_type = TRB_FIELD_TO_TYPE(event->generic.field[3]);
1097+ xhci_dbg(xhci, "Vendor specific event TRB type = %u\n", trb_type);
1098+ if (trb_type == TRB_NEC_CMD_COMP && (xhci->quirks & XHCI_NEC_HOST))
1099+ handle_cmd_completion(xhci, &event->event_cmd);
1100+}
1101+
10821102 static void handle_port_status(struct xhci_hcd *xhci,
10831103 union xhci_trb *event)
10841104 {
@@ -1659,7 +1679,10 @@ void xhci_handle_event(struct xhci_hcd *xhci) · 574 unmodified lines
16591679 update_ptrs = 0;
16601680 break;
16611681 default:
1662− xhci->error_bitmask |= 1 << 3;
1682+ if ((event->event_cmd.flags & TRB_TYPE_BITMASK) >= TRB_TYPE(48))
1683+ handle_vendor_event(xhci, event);
1684+ else
1685+ xhci->error_bitmask |= 1 << 3;
16631686 }
16641687 /* Any of the above functions may drop and re-acquire the lock, so check
16651688 * to make sure a watchdog timer didn't mark the host as non-responsive.
@@ -2378,6 +2401,12 @@ int xhci_queue_address_device(struct xhci_hcd *xhci, dma_addr_t in_ctx_ptr, · 712 unmodified lines
23782401 false);
23792402 }
23802403
2404+int xhci_queue_vendor_command(struct xhci_hcd *xhci,
2405+ u32 field1, u32 field2, u32 field3, u32 field4)
2406+{
2407+ return queue_command(xhci, field1, field2, field3, field4, false);
2408+}
2409+
23812410 /* Queue a reset device command TRB */
23822411 int xhci_queue_reset_device(struct xhci_hcd *xhci, u32 slot_id)
23832412 {
drivers/usb/host/xhci.c+49−8
@@ -105,6 +105,33 @@ int xhci_halt(struct xhci_hcd *xhci) · 104 unmodified lines
105105 STS_HALT, STS_HALT, XHCI_MAX_HALT_USEC);
106106 }
107107
108+/*
109+ * Set the run bit and wait for the host to be running.
110+ */
111+int xhci_start(struct xhci_hcd *xhci)
112+{
113+ u32 temp;
114+ int ret;
115+
116+ temp = xhci_readl(xhci, &xhci->op_regs->command);
117+ temp |= (CMD_RUN);
118+ xhci_dbg(xhci, "// Turn on HC, cmd = 0x%x.\n",
119+ temp);
120+ xhci_writel(xhci, temp, &xhci->op_regs->command);
121+
122+ /*
123+ * Wait for the HCHalted Status bit to be 0 to indicate the host is
124+ * running.
125+ */
126+ ret = handshake(xhci, &xhci->op_regs->status,
127+ STS_HALT, 0, XHCI_MAX_HALT_USEC);
128+ if (ret == -ETIMEDOUT)
129+ xhci_err(xhci, "Host took too long to start, "
130+ "waited %u microseconds.\n",
131+ XHCI_MAX_HALT_USEC);
132+ return ret;
133+}
134+
108135 /*
109136 * Reset a halted HC, and set the internal HC state to HC_STATE_HALT.
110137 *
@@ -116,6 +143,7 @@ int xhci_reset(struct xhci_hcd *xhci) · 5 unmodified lines
116143 {
117144 u32 command;
118145 u32 state;
146+ int ret;
119147
120148 state = xhci_readl(xhci, &xhci->op_regs->status);
121149 if ((state & STS_HALT) == 0) {
@@ -130,7 +158,17 @@ int xhci_reset(struct xhci_hcd *xhci) · 8 unmodified lines
130158 /* XXX: Why does EHCI set this here? Shouldn't other code do this? */
131159 xhci_to_hcd(xhci)->state = HC_STATE_HALT;
132160
133− return handshake(xhci, &xhci->op_regs->command, CMD_RESET, 0, 250 * 1000);
161+ ret = handshake(xhci, &xhci->op_regs->command,
162+ CMD_RESET, 0, 250 * 1000);
163+ if (ret)
164+ return ret;
165+
166+ xhci_dbg(xhci, "Wait for controller to be ready for doorbell rings\n");
167+ /*
168+ * xHCI cannot write to any doorbells or operational registers other
169+ * than status until the "Controller Not Ready" flag is cleared.
170+ */
171+ return handshake(xhci, &xhci->op_regs->status, STS_CNR, 0, 250 * 1000);
134172 }
135173
136174
@@ -448,17 +486,20 @@ int xhci_run(struct usb_hcd *hcd) · 311 unmodified lines
448486
449487 if (NUM_TEST_NOOPS > 0)
450488 doorbell = xhci_setup_one_noop(xhci);
489+ if (xhci->quirks & XHCI_NEC_HOST)
490+ xhci_queue_vendor_command(xhci, 0, 0, 0,
491+ TRB_TYPE(TRB_NEC_GET_FW));
492+
493+ if (xhci_start(xhci)) {
494+ xhci_halt(xhci);
495+ return -ENODEV;
496+ }
451497
452− temp = xhci_readl(xhci, &xhci->op_regs->command);
453− temp |= (CMD_RUN);
454− xhci_dbg(xhci, "// Turn on HC, cmd = 0x%x.\n",
455− temp);
456− xhci_writel(xhci, temp, &xhci->op_regs->command);
457− /* Flush PCI posted writes */
458− temp = xhci_readl(xhci, &xhci->op_regs->command);
459498 xhci_dbg(xhci, "// @%p = 0x%x\n", &xhci->op_regs->command, temp);
460499 if (doorbell)
461500 (*doorbell)(xhci);
501+ if (xhci->quirks & XHCI_NEC_HOST)
502+ xhci_ring_cmd_db(xhci);
462503
463504 xhci_dbg(xhci, "Finished xhci_run\n");
464505 return 0;
drivers/usb/host/xhci.h+12−0
@@ -925,6 +925,7 @@ union xhci_trb { · 924 unmodified lines
925925 /* TRB bit mask */
926926 #define TRB_TYPE_BITMASK (0xfc00)
927927 #define TRB_TYPE(p) ((p) << 10)
928+#define TRB_FIELD_TO_TYPE(p) (((p) & TRB_TYPE_BITMASK) >> 10)
928929 /* TRB type IDs */
929930 /* bulk, interrupt, isoc scatter/gather, and control data stage */
930931 #define TRB_NORMAL 1
@@ -992,6 +993,14 @@ union xhci_trb { · 61 unmodified lines
992993 #define TRB_MFINDEX_WRAP 39
993994 /* TRB IDs 40-47 reserved, 48-63 is vendor-defined */
994995
996+/* Nec vendor-specific command completion event. */
997+#define TRB_NEC_CMD_COMP 48
998+/* Get NEC firmware revision. */
999+#define TRB_NEC_GET_FW 49
1000+
1001+#define NEC_FW_MINOR(p) (((p) >> 0) & 0xff)
1002+#define NEC_FW_MAJOR(p) (((p) >> 8) & 0xff)
1003+
9951004 /*
9961005 * TRBS_PER_SEGMENT must be a multiple of 4,
9971006 * since the command ring is 64-byte aligned.
@@ -1172,6 +1181,7 @@ struct xhci_hcd { · 174 unmodified lines
11721181 unsigned int quirks;
11731182 #define XHCI_LINK_TRB_QUIRK (1 << 0)
11741183 #define XHCI_RESET_EP_QUIRK (1 << 1)
1184+#define XHCI_NEC_HOST (1 << 2)
11751185 };
11761186
11771187 /* For testing purposes */
@@ -1379,6 +1389,8 @@ void xhci_set_hc_event_deq(struct xhci_hcd *xhci); · 201 unmodified lines
13791389 int xhci_queue_slot_control(struct xhci_hcd *xhci, u32 trb_type, u32 slot_id);
13801390 int xhci_queue_address_device(struct xhci_hcd *xhci, dma_addr_t in_ctx_ptr,
13811391 u32 slot_id);
1392+int xhci_queue_vendor_command(struct xhci_hcd *xhci,
1393+ u32 field1, u32 field2, u32 field3, u32 field4);
13821394 int xhci_queue_stop_endpoint(struct xhci_hcd *xhci, int slot_id,
13831395 unsigned int ep_index);
13841396 int xhci_queue_ctrl_tx(struct xhci_hcd *xhci, gfp_t mem_flags, struct urb *urb,
drivers/usb/serial/digi_acceleport.c+1−2
@@ -1239,8 +1239,7 @@ static void digi_write_bulk_callback(struct urb *urb) · 1238 unmodified lines
12391239
12401240 /* port and serial sanity check */
12411241 if (port == NULL || (priv = usb_get_serial_port_data(port)) == NULL) {
1242− dev_err(&port->dev,
1243− "%s: port or port->private is NULL, status=%d\n",
1242+ pr_err("%s: port or port->private is NULL, status=%d\n",
12441243 __func__, status);
12451244 return;
12461245 }
drivers/usb/serial/ftdi_sio.c+4−0
@@ -2005,6 +2005,8 @@ static void ftdi_set_termios(struct tty_struct *tty, · 2004 unmodified lines
20052005 "urb failed to set to rts/cts flow control\n");
20062006 }
20072007
2008+ /* raise DTR/RTS */
2009+ set_mctrl(port, TIOCM_DTR | TIOCM_RTS);
20082010 } else {
20092011 /*
20102012 * Xon/Xoff code
@@ -2052,6 +2054,8 @@ static void ftdi_set_termios(struct tty_struct *tty, · 41 unmodified lines
20522054 }
20532055 }
20542056
2057+ /* lower DTR/RTS */
2058+ clear_mctrl(port, TIOCM_DTR | TIOCM_RTS);
20552059 }
20562060 return;
20572061 }
drivers/usb/serial/mos7840.c+0−1
@@ -730,7 +730,6 @@ static void mos7840_bulk_in_callback(struct urb *urb) · 729 unmodified lines
730730 mos7840_port = urb->context;
731731 if (!mos7840_port) {
732732 dbg("%s", "NULL mos7840_port pointer");
733− mos7840_port->read_urb_busy = false;
734733 return;
735734 }
736735

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t