aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/usb
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/usb')
-rw-r--r--drivers/usb/atm/ueagle-atm.c2
-rw-r--r--drivers/usb/class/cdc-acm.c5
-rw-r--r--drivers/usb/gadget/Kconfig2
-rw-r--r--drivers/usb/gadget/atmel_usba_udc.c14
-rw-r--r--drivers/usb/host/ehci-hcd.c2
-rw-r--r--drivers/usb/host/ehci-pci.c2
-rw-r--r--drivers/usb/host/ehci-ps3.c2
-rw-r--r--drivers/usb/host/ohci-ps3.c2
-rw-r--r--drivers/usb/serial/ChangeLog.history2
-rw-r--r--drivers/usb/serial/Kconfig4
-rw-r--r--drivers/usb/serial/pl2303.c1
-rw-r--r--drivers/usb/serial/pl2303.h4
-rw-r--r--drivers/usb/serial/symbolserial.c67
-rw-r--r--drivers/usb/storage/isd200.c239
-rw-r--r--drivers/usb/wusbcore/devconnect.c2
-rw-r--r--drivers/usb/wusbcore/security.c2
16 files changed, 107 insertions, 245 deletions
diff --git a/drivers/usb/atm/ueagle-atm.c b/drivers/usb/atm/ueagle-atm.c
index b6483dd98acc..9cf9ff69e3e3 100644
--- a/drivers/usb/atm/ueagle-atm.c
+++ b/drivers/usb/atm/ueagle-atm.c
@@ -626,7 +626,7 @@ static void uea_upload_pre_firmware(const struct firmware *fw_entry, void *conte
626 goto err_fw_corrupted; 626 goto err_fw_corrupted;
627 627
628 /* 628 /*
629 * Start to upload formware : send reset 629 * Start to upload firmware : send reset
630 */ 630 */
631 value = 1; 631 value = 1;
632 ret = uea_send_modem_cmd(usb, F8051_USBCS, sizeof(value), &value); 632 ret = uea_send_modem_cmd(usb, F8051_USBCS, sizeof(value), &value);
diff --git a/drivers/usb/class/cdc-acm.c b/drivers/usb/class/cdc-acm.c
index b3d5a23ab56f..869d47cb6db3 100644
--- a/drivers/usb/class/cdc-acm.c
+++ b/drivers/usb/class/cdc-acm.c
@@ -1358,6 +1358,9 @@ static struct usb_device_id acm_ids[] = {
1358 { USB_DEVICE(0x079b, 0x000f), /* BT On-Air USB MODEM */ 1358 { USB_DEVICE(0x079b, 0x000f), /* BT On-Air USB MODEM */
1359 .driver_info = NO_UNION_NORMAL, /* has no union descriptor */ 1359 .driver_info = NO_UNION_NORMAL, /* has no union descriptor */
1360 }, 1360 },
1361 { USB_DEVICE(0x0ace, 0x1602), /* ZyDAS 56K USB MODEM */
1362 .driver_info = SINGLE_RX_URB,
1363 },
1361 { USB_DEVICE(0x0ace, 0x1608), /* ZyDAS 56K USB MODEM */ 1364 { USB_DEVICE(0x0ace, 0x1608), /* ZyDAS 56K USB MODEM */
1362 .driver_info = SINGLE_RX_URB, /* firmware bug */ 1365 .driver_info = SINGLE_RX_URB, /* firmware bug */
1363 }, 1366 },
@@ -1493,4 +1496,4 @@ module_exit(acm_exit);
1493MODULE_AUTHOR( DRIVER_AUTHOR ); 1496MODULE_AUTHOR( DRIVER_AUTHOR );
1494MODULE_DESCRIPTION( DRIVER_DESC ); 1497MODULE_DESCRIPTION( DRIVER_DESC );
1495MODULE_LICENSE("GPL"); 1498MODULE_LICENSE("GPL");
1496 1499MODULE_ALIAS_CHARDEV_MAJOR(ACM_TTY_MAJOR);
diff --git a/drivers/usb/gadget/Kconfig b/drivers/usb/gadget/Kconfig
index 770b3eaa9184..080bb1e4b847 100644
--- a/drivers/usb/gadget/Kconfig
+++ b/drivers/usb/gadget/Kconfig
@@ -392,7 +392,7 @@ config USB_GADGET_FSL_QE
392 controllers having QE or CPM2, given minor tweaks. 392 controllers having QE or CPM2, given minor tweaks.
393 393
394 Set CONFIG_USB_GADGET to "m" to build this driver as a 394 Set CONFIG_USB_GADGET to "m" to build this driver as a
395 dynmically linked module called "fsl_qe_udc". 395 dynamically linked module called "fsl_qe_udc".
396 396
397config USB_FSL_QE 397config USB_FSL_QE
398 tristate 398 tristate
diff --git a/drivers/usb/gadget/atmel_usba_udc.c b/drivers/usb/gadget/atmel_usba_udc.c
index c22fab164113..563d57275448 100644
--- a/drivers/usb/gadget/atmel_usba_udc.c
+++ b/drivers/usb/gadget/atmel_usba_udc.c
@@ -319,7 +319,7 @@ static inline void usba_cleanup_debugfs(struct usba_udc *udc)
319 319
320static int vbus_is_present(struct usba_udc *udc) 320static int vbus_is_present(struct usba_udc *udc)
321{ 321{
322 if (udc->vbus_pin != -1) 322 if (gpio_is_valid(udc->vbus_pin))
323 return gpio_get_value(udc->vbus_pin); 323 return gpio_get_value(udc->vbus_pin);
324 324
325 /* No Vbus detection: Assume always present */ 325 /* No Vbus detection: Assume always present */
@@ -1821,7 +1821,7 @@ int usb_gadget_register_driver(struct usb_gadget_driver *driver)
1821 DBG(DBG_GADGET, "registered driver `%s'\n", driver->driver.name); 1821 DBG(DBG_GADGET, "registered driver `%s'\n", driver->driver.name);
1822 1822
1823 udc->vbus_prev = 0; 1823 udc->vbus_prev = 0;
1824 if (udc->vbus_pin != -1) 1824 if (gpio_is_valid(udc->vbus_pin))
1825 enable_irq(gpio_to_irq(udc->vbus_pin)); 1825 enable_irq(gpio_to_irq(udc->vbus_pin));
1826 1826
1827 /* If Vbus is present, enable the controller and wait for reset */ 1827 /* If Vbus is present, enable the controller and wait for reset */
@@ -1852,7 +1852,7 @@ int usb_gadget_unregister_driver(struct usb_gadget_driver *driver)
1852 if (driver != udc->driver || !driver->unbind) 1852 if (driver != udc->driver || !driver->unbind)
1853 return -EINVAL; 1853 return -EINVAL;
1854 1854
1855 if (udc->vbus_pin != -1) 1855 if (gpio_is_valid(udc->vbus_pin))
1856 disable_irq(gpio_to_irq(udc->vbus_pin)); 1856 disable_irq(gpio_to_irq(udc->vbus_pin));
1857 1857
1858 spin_lock_irqsave(&udc->lock, flags); 1858 spin_lock_irqsave(&udc->lock, flags);
@@ -1910,7 +1910,7 @@ static int __init usba_udc_probe(struct platform_device *pdev)
1910 udc->pdev = pdev; 1910 udc->pdev = pdev;
1911 udc->pclk = pclk; 1911 udc->pclk = pclk;
1912 udc->hclk = hclk; 1912 udc->hclk = hclk;
1913 udc->vbus_pin = -1; 1913 udc->vbus_pin = -ENODEV;
1914 1914
1915 ret = -ENOMEM; 1915 ret = -ENOMEM;
1916 udc->regs = ioremap(regs->start, regs->end - regs->start + 1); 1916 udc->regs = ioremap(regs->start, regs->end - regs->start + 1);
@@ -1996,7 +1996,7 @@ static int __init usba_udc_probe(struct platform_device *pdev)
1996 goto err_device_add; 1996 goto err_device_add;
1997 } 1997 }
1998 1998
1999 if (pdata->vbus_pin >= 0) { 1999 if (gpio_is_valid(pdata->vbus_pin)) {
2000 if (!gpio_request(pdata->vbus_pin, "atmel_usba_udc")) { 2000 if (!gpio_request(pdata->vbus_pin, "atmel_usba_udc")) {
2001 udc->vbus_pin = pdata->vbus_pin; 2001 udc->vbus_pin = pdata->vbus_pin;
2002 2002
@@ -2005,7 +2005,7 @@ static int __init usba_udc_probe(struct platform_device *pdev)
2005 "atmel_usba_udc", udc); 2005 "atmel_usba_udc", udc);
2006 if (ret) { 2006 if (ret) {
2007 gpio_free(udc->vbus_pin); 2007 gpio_free(udc->vbus_pin);
2008 udc->vbus_pin = -1; 2008 udc->vbus_pin = -ENODEV;
2009 dev_warn(&udc->pdev->dev, 2009 dev_warn(&udc->pdev->dev,
2010 "failed to request vbus irq; " 2010 "failed to request vbus irq; "
2011 "assuming always on\n"); 2011 "assuming always on\n");
@@ -2051,7 +2051,7 @@ static int __exit usba_udc_remove(struct platform_device *pdev)
2051 usba_ep_cleanup_debugfs(&usba_ep[i]); 2051 usba_ep_cleanup_debugfs(&usba_ep[i]);
2052 usba_cleanup_debugfs(udc); 2052 usba_cleanup_debugfs(udc);
2053 2053
2054 if (udc->vbus_pin != -1) 2054 if (gpio_is_valid(udc->vbus_pin))
2055 gpio_free(udc->vbus_pin); 2055 gpio_free(udc->vbus_pin);
2056 2056
2057 free_irq(udc->irq, udc); 2057 free_irq(udc->irq, udc);
diff --git a/drivers/usb/host/ehci-hcd.c b/drivers/usb/host/ehci-hcd.c
index f2618d17710d..c637207a1c80 100644
--- a/drivers/usb/host/ehci-hcd.c
+++ b/drivers/usb/host/ehci-hcd.c
@@ -622,7 +622,7 @@ static int ehci_run (struct usb_hcd *hcd)
622 ehci_writel(ehci, 0, &ehci->regs->segment); 622 ehci_writel(ehci, 0, &ehci->regs->segment);
623#if 0 623#if 0
624// this is deeply broken on almost all architectures 624// this is deeply broken on almost all architectures
625 if (!dma_set_mask(hcd->self.controller, DMA_64BIT_MASK)) 625 if (!dma_set_mask(hcd->self.controller, DMA_BIT_MASK(64)))
626 ehci_info(ehci, "enabled 64bit DMA\n"); 626 ehci_info(ehci, "enabled 64bit DMA\n");
627#endif 627#endif
628 } 628 }
diff --git a/drivers/usb/host/ehci-pci.c b/drivers/usb/host/ehci-pci.c
index abb9a7706ec7..5aa8bce90e1f 100644
--- a/drivers/usb/host/ehci-pci.c
+++ b/drivers/usb/host/ehci-pci.c
@@ -108,7 +108,7 @@ static int ehci_pci_setup(struct usb_hcd *hcd)
108 case 0x00d8: /* CK8 */ 108 case 0x00d8: /* CK8 */
109 case 0x00e8: /* CK8S */ 109 case 0x00e8: /* CK8S */
110 if (pci_set_consistent_dma_mask(pdev, 110 if (pci_set_consistent_dma_mask(pdev,
111 DMA_31BIT_MASK) < 0) 111 DMA_BIT_MASK(31)) < 0)
112 ehci_warn(ehci, "can't enable NVidia " 112 ehci_warn(ehci, "can't enable NVidia "
113 "workaround for >2GB RAM\n"); 113 "workaround for >2GB RAM\n");
114 break; 114 break;
diff --git a/drivers/usb/host/ehci-ps3.c b/drivers/usb/host/ehci-ps3.c
index 9c9da35abc6c..1ba9f9a8c308 100644
--- a/drivers/usb/host/ehci-ps3.c
+++ b/drivers/usb/host/ehci-ps3.c
@@ -81,7 +81,7 @@ static int ps3_ehci_probe(struct ps3_system_bus_device *dev)
81 int result; 81 int result;
82 struct usb_hcd *hcd; 82 struct usb_hcd *hcd;
83 unsigned int virq; 83 unsigned int virq;
84 static u64 dummy_mask = DMA_32BIT_MASK; 84 static u64 dummy_mask = DMA_BIT_MASK(32);
85 85
86 if (usb_disabled()) { 86 if (usb_disabled()) {
87 result = -ENODEV; 87 result = -ENODEV;
diff --git a/drivers/usb/host/ohci-ps3.c b/drivers/usb/host/ohci-ps3.c
index 3c1a3b5f89f1..3d1910317328 100644
--- a/drivers/usb/host/ohci-ps3.c
+++ b/drivers/usb/host/ohci-ps3.c
@@ -80,7 +80,7 @@ static int ps3_ohci_probe(struct ps3_system_bus_device *dev)
80 int result; 80 int result;
81 struct usb_hcd *hcd; 81 struct usb_hcd *hcd;
82 unsigned int virq; 82 unsigned int virq;
83 static u64 dummy_mask = DMA_32BIT_MASK; 83 static u64 dummy_mask = DMA_BIT_MASK(32);
84 84
85 if (usb_disabled()) { 85 if (usb_disabled()) {
86 result = -ENODEV; 86 result = -ENODEV;
diff --git a/drivers/usb/serial/ChangeLog.history b/drivers/usb/serial/ChangeLog.history
index c1b279939bbf..f13fd488ebec 100644
--- a/drivers/usb/serial/ChangeLog.history
+++ b/drivers/usb/serial/ChangeLog.history
@@ -715,7 +715,7 @@ io_edgeport.c Change Log comments:
715 715
716 0.2 (01/30/2000) greg kroah-hartman 716 0.2 (01/30/2000) greg kroah-hartman
717 Milestone 1 release. 717 Milestone 1 release.
718 Device is found by USB subsystem, enumerated, fimware is downloaded 718 Device is found by USB subsystem, enumerated, firmware is downloaded
719 and the descriptors are printed to the debug log, config is set, and 719 and the descriptors are printed to the debug log, config is set, and
720 green light starts to blink. Open port works, and data can be sent 720 green light starts to blink. Open port works, and data can be sent
721 and received at the default settings of the UART. Loopback connector 721 and received at the default settings of the UART. Loopback connector
diff --git a/drivers/usb/serial/Kconfig b/drivers/usb/serial/Kconfig
index a65f9196b0a0..c480ea4c19f2 100644
--- a/drivers/usb/serial/Kconfig
+++ b/drivers/usb/serial/Kconfig
@@ -518,8 +518,8 @@ config USB_SERIAL_SIERRAWIRELESS
518 help 518 help
519 Say M here if you want to use Sierra Wireless devices. 519 Say M here if you want to use Sierra Wireless devices.
520 520
521 Many deviecs have a feature known as TRU-Install, for those devices 521 Many devices have a feature known as TRU-Install. For those devices
522 to work properly the USB Storage Sierra feature must be enabled. 522 to work properly, the USB Storage Sierra feature must be enabled.
523 523
524 To compile this driver as a module, choose M here: the 524 To compile this driver as a module, choose M here: the
525 module will be called sierra. 525 module will be called sierra.
diff --git a/drivers/usb/serial/pl2303.c b/drivers/usb/serial/pl2303.c
index 1aed584be5eb..751a533a4347 100644
--- a/drivers/usb/serial/pl2303.c
+++ b/drivers/usb/serial/pl2303.c
@@ -79,6 +79,7 @@ static struct usb_device_id id_table [] = {
79 { USB_DEVICE(SIEMENS_VENDOR_ID, SIEMENS_PRODUCT_ID_X65) }, 79 { USB_DEVICE(SIEMENS_VENDOR_ID, SIEMENS_PRODUCT_ID_X65) },
80 { USB_DEVICE(SIEMENS_VENDOR_ID, SIEMENS_PRODUCT_ID_X75) }, 80 { USB_DEVICE(SIEMENS_VENDOR_ID, SIEMENS_PRODUCT_ID_X75) },
81 { USB_DEVICE(SIEMENS_VENDOR_ID, SIEMENS_PRODUCT_ID_EF81) }, 81 { USB_DEVICE(SIEMENS_VENDOR_ID, SIEMENS_PRODUCT_ID_EF81) },
82 { USB_DEVICE(BENQ_VENDOR_ID, BENQ_PRODUCT_ID_S81) }, /* Benq/Siemens S81 */
82 { USB_DEVICE(SYNTECH_VENDOR_ID, SYNTECH_PRODUCT_ID) }, 83 { USB_DEVICE(SYNTECH_VENDOR_ID, SYNTECH_PRODUCT_ID) },
83 { USB_DEVICE(NOKIA_CA42_VENDOR_ID, NOKIA_CA42_PRODUCT_ID) }, 84 { USB_DEVICE(NOKIA_CA42_VENDOR_ID, NOKIA_CA42_PRODUCT_ID) },
84 { USB_DEVICE(CA_42_CA42_VENDOR_ID, CA_42_CA42_PRODUCT_ID) }, 85 { USB_DEVICE(CA_42_CA42_VENDOR_ID, CA_42_CA42_PRODUCT_ID) },
diff --git a/drivers/usb/serial/pl2303.h b/drivers/usb/serial/pl2303.h
index 54974f446a8c..1d7a22e3a9fd 100644
--- a/drivers/usb/serial/pl2303.h
+++ b/drivers/usb/serial/pl2303.h
@@ -7,6 +7,10 @@
7 * (at your option) any later version. 7 * (at your option) any later version.
8 * 8 *
9 */ 9 */
10
11#define BENQ_VENDOR_ID 0x04a5
12#define BENQ_PRODUCT_ID_S81 0x4027
13
10#define PL2303_VENDOR_ID 0x067b 14#define PL2303_VENDOR_ID 0x067b
11#define PL2303_PRODUCT_ID 0x2303 15#define PL2303_PRODUCT_ID 0x2303
12#define PL2303_PRODUCT_ID_RSAQ2 0x04bb 16#define PL2303_PRODUCT_ID_RSAQ2 0x04bb
diff --git a/drivers/usb/serial/symbolserial.c b/drivers/usb/serial/symbolserial.c
index 8b3cbc87adc7..69879e437940 100644
--- a/drivers/usb/serial/symbolserial.c
+++ b/drivers/usb/serial/symbolserial.c
@@ -139,14 +139,6 @@ static int symbol_open(struct tty_struct *tty, struct usb_serial_port *port,
139 priv->port = port; 139 priv->port = port;
140 spin_unlock_irqrestore(&priv->lock, flags); 140 spin_unlock_irqrestore(&priv->lock, flags);
141 141
142 /*
143 * Force low_latency on so that our tty_push actually forces the data
144 * through, otherwise it is scheduled, and with high data rates (like
145 * with OHCI) data can get lost.
146 */
147 if (tty)
148 tty->low_latency = 1;
149
150 /* Start reading from the device */ 142 /* Start reading from the device */
151 usb_fill_int_urb(priv->int_urb, priv->udev, 143 usb_fill_int_urb(priv->int_urb, priv->udev,
152 usb_rcvintpipe(priv->udev, priv->int_address), 144 usb_rcvintpipe(priv->udev, priv->int_address),
@@ -205,62 +197,6 @@ static void symbol_unthrottle(struct tty_struct *tty)
205 __func__, result); 197 __func__, result);
206} 198}
207 199
208static int symbol_ioctl(struct tty_struct *tty, struct file *file,
209 unsigned int cmd, unsigned long arg)
210{
211 struct usb_serial_port *port = tty->driver_data;
212 struct device *dev = &port->dev;
213
214 /*
215 * Right now we need to figure out what commands
216 * most userspace tools want to see for this driver,
217 * so just log the things.
218 */
219 switch (cmd) {
220 case TIOCSERGETLSR:
221 dev_info(dev, "%s: TIOCSERGETLSR\n", __func__);
222 break;
223
224 case TIOCGSERIAL:
225 dev_info(dev, "%s: TIOCGSERIAL\n", __func__);
226 break;
227
228 case TIOCMIWAIT:
229 dev_info(dev, "%s: TIOCMIWAIT\n", __func__);
230 break;
231
232 case TIOCGICOUNT:
233 dev_info(dev, "%s: TIOCGICOUNT\n", __func__);
234 break;
235 default:
236 dev_info(dev, "%s: unknown (%d)\n", __func__, cmd);
237 }
238 return -ENOIOCTLCMD;
239}
240
241static int symbol_tiocmget(struct tty_struct *tty, struct file *file)
242{
243 struct usb_serial_port *port = tty->driver_data;
244 struct device *dev = &port->dev;
245
246 /* TODO */
247 /* probably just need to shadow whatever was sent to us here */
248 dev_info(dev, "%s\n", __func__);
249 return 0;
250}
251
252static int symbol_tiocmset(struct tty_struct *tty, struct file *file,
253 unsigned int set, unsigned int clear)
254{
255 struct usb_serial_port *port = tty->driver_data;
256 struct device *dev = &port->dev;
257
258 /* TODO */
259 /* probably just need to shadow whatever was sent to us here */
260 dev_info(dev, "%s\n", __func__);
261 return 0;
262}
263
264static int symbol_startup(struct usb_serial *serial) 200static int symbol_startup(struct usb_serial *serial)
265{ 201{
266 struct symbol_private *priv; 202 struct symbol_private *priv;
@@ -367,9 +303,6 @@ static struct usb_serial_driver symbol_device = {
367 .shutdown = symbol_shutdown, 303 .shutdown = symbol_shutdown,
368 .throttle = symbol_throttle, 304 .throttle = symbol_throttle,
369 .unthrottle = symbol_unthrottle, 305 .unthrottle = symbol_unthrottle,
370 .ioctl = symbol_ioctl,
371 .tiocmget = symbol_tiocmget,
372 .tiocmset = symbol_tiocmset,
373}; 306};
374 307
375static int __init symbol_init(void) 308static int __init symbol_init(void)
diff --git a/drivers/usb/storage/isd200.c b/drivers/usb/storage/isd200.c
index 882c57b399f7..fdba2f69d4c9 100644
--- a/drivers/usb/storage/isd200.c
+++ b/drivers/usb/storage/isd200.c
@@ -46,6 +46,7 @@
46#include <linux/errno.h> 46#include <linux/errno.h>
47#include <linux/module.h> 47#include <linux/module.h>
48#include <linux/slab.h> 48#include <linux/slab.h>
49#include <linux/ata.h>
49#include <linux/hdreg.h> 50#include <linux/hdreg.h>
50#include <linux/scatterlist.h> 51#include <linux/scatterlist.h>
51 52
@@ -328,7 +329,7 @@ struct isd200_config {
328 329
329struct isd200_info { 330struct isd200_info {
330 struct inquiry_data InquiryData; 331 struct inquiry_data InquiryData;
331 struct hd_driveid *id; 332 u16 *id;
332 struct isd200_config ConfigData; 333 struct isd200_config ConfigData;
333 unsigned char *RegsBuf; 334 unsigned char *RegsBuf;
334 unsigned char ATARegs[8]; 335 unsigned char ATARegs[8];
@@ -419,19 +420,19 @@ static void isd200_build_sense(struct us_data *us, struct scsi_cmnd *srb)
419 buf->Flags = UNIT_ATTENTION; 420 buf->Flags = UNIT_ATTENTION;
420 buf->AdditionalSenseCode = 0; 421 buf->AdditionalSenseCode = 0;
421 buf->AdditionalSenseCodeQualifier = 0; 422 buf->AdditionalSenseCodeQualifier = 0;
422 } else if(error & MCR_ERR) { 423 } else if (error & ATA_MCR) {
423 buf->ErrorCode = 0x70 | SENSE_ERRCODE_VALID; 424 buf->ErrorCode = 0x70 | SENSE_ERRCODE_VALID;
424 buf->AdditionalSenseLength = 0xb; 425 buf->AdditionalSenseLength = 0xb;
425 buf->Flags = UNIT_ATTENTION; 426 buf->Flags = UNIT_ATTENTION;
426 buf->AdditionalSenseCode = 0; 427 buf->AdditionalSenseCode = 0;
427 buf->AdditionalSenseCodeQualifier = 0; 428 buf->AdditionalSenseCodeQualifier = 0;
428 } else if(error & TRK0_ERR) { 429 } else if (error & ATA_TRK0NF) {
429 buf->ErrorCode = 0x70 | SENSE_ERRCODE_VALID; 430 buf->ErrorCode = 0x70 | SENSE_ERRCODE_VALID;
430 buf->AdditionalSenseLength = 0xb; 431 buf->AdditionalSenseLength = 0xb;
431 buf->Flags = NOT_READY; 432 buf->Flags = NOT_READY;
432 buf->AdditionalSenseCode = 0; 433 buf->AdditionalSenseCode = 0;
433 buf->AdditionalSenseCodeQualifier = 0; 434 buf->AdditionalSenseCodeQualifier = 0;
434 } else if(error & ECC_ERR) { 435 } else if (error & ATA_UNC) {
435 buf->ErrorCode = 0x70 | SENSE_ERRCODE_VALID; 436 buf->ErrorCode = 0x70 | SENSE_ERRCODE_VALID;
436 buf->AdditionalSenseLength = 0xb; 437 buf->AdditionalSenseLength = 0xb;
437 buf->Flags = DATA_PROTECT; 438 buf->Flags = DATA_PROTECT;
@@ -547,16 +548,16 @@ static int isd200_action( struct us_data *us, int action,
547 ata.generic.ActionSelect = ACTION_SELECT_1|ACTION_SELECT_5; 548 ata.generic.ActionSelect = ACTION_SELECT_1|ACTION_SELECT_5;
548 ata.generic.RegisterSelect = REG_DEVICE_HEAD | REG_COMMAND; 549 ata.generic.RegisterSelect = REG_DEVICE_HEAD | REG_COMMAND;
549 ata.write.DeviceHeadByte = info->DeviceHead; 550 ata.write.DeviceHeadByte = info->DeviceHead;
550 ata.write.CommandByte = WIN_SRST; 551 ata.write.CommandByte = ATA_CMD_DEV_RESET;
551 isd200_set_srb(info, DMA_NONE, NULL, 0); 552 isd200_set_srb(info, DMA_NONE, NULL, 0);
552 break; 553 break;
553 554
554 case ACTION_IDENTIFY: 555 case ACTION_IDENTIFY:
555 US_DEBUGP(" isd200_action(IDENTIFY)\n"); 556 US_DEBUGP(" isd200_action(IDENTIFY)\n");
556 ata.generic.RegisterSelect = REG_COMMAND; 557 ata.generic.RegisterSelect = REG_COMMAND;
557 ata.write.CommandByte = WIN_IDENTIFY; 558 ata.write.CommandByte = ATA_CMD_ID_ATA;
558 isd200_set_srb(info, DMA_FROM_DEVICE, info->id, 559 isd200_set_srb(info, DMA_FROM_DEVICE, info->id,
559 sizeof(struct hd_driveid)); 560 ATA_ID_WORDS * 2);
560 break; 561 break;
561 562
562 default: 563 default:
@@ -944,22 +945,22 @@ static int isd200_try_enum(struct us_data *us, unsigned char master_slave,
944 break; 945 break;
945 946
946 if (!detect) { 947 if (!detect) {
947 if (regs[ATA_REG_STATUS_OFFSET] & BUSY_STAT) { 948 if (regs[ATA_REG_STATUS_OFFSET] & ATA_BUSY) {
948 US_DEBUGP(" %s status is still BSY, try again...\n",mstr); 949 US_DEBUGP(" %s status is still BSY, try again...\n",mstr);
949 } else { 950 } else {
950 US_DEBUGP(" %s status !BSY, continue with next operation\n",mstr); 951 US_DEBUGP(" %s status !BSY, continue with next operation\n",mstr);
951 break; 952 break;
952 } 953 }
953 } 954 }
954 /* check for BUSY_STAT and */ 955 /* check for ATA_BUSY and */
955 /* WRERR_STAT (workaround ATA Zip drive) and */ 956 /* ATA_DF (workaround ATA Zip drive) and */
956 /* ERR_STAT (workaround for Archos CD-ROM) */ 957 /* ATA_ERR (workaround for Archos CD-ROM) */
957 else if (regs[ATA_REG_STATUS_OFFSET] & 958 else if (regs[ATA_REG_STATUS_OFFSET] &
958 (BUSY_STAT | WRERR_STAT | ERR_STAT )) { 959 (ATA_BUSY | ATA_DF | ATA_ERR)) {
959 US_DEBUGP(" Status indicates it is not ready, try again...\n"); 960 US_DEBUGP(" Status indicates it is not ready, try again...\n");
960 } 961 }
961 /* check for DRDY, ATA devices set DRDY after SRST */ 962 /* check for DRDY, ATA devices set DRDY after SRST */
962 else if (regs[ATA_REG_STATUS_OFFSET] & READY_STAT) { 963 else if (regs[ATA_REG_STATUS_OFFSET] & ATA_DRDY) {
963 US_DEBUGP(" Identified ATA device\n"); 964 US_DEBUGP(" Identified ATA device\n");
964 info->DeviceFlags |= DF_ATA_DEVICE; 965 info->DeviceFlags |= DF_ATA_DEVICE;
965 info->DeviceHead = master_slave; 966 info->DeviceHead = master_slave;
@@ -1053,103 +1054,50 @@ static int isd200_manual_enum(struct us_data *us)
1053 return(retStatus); 1054 return(retStatus);
1054} 1055}
1055 1056
1056static void isd200_fix_driveid (struct hd_driveid *id) 1057static void isd200_fix_driveid(u16 *id)
1057{ 1058{
1058#ifndef __LITTLE_ENDIAN 1059#ifndef __LITTLE_ENDIAN
1059# ifdef __BIG_ENDIAN 1060# ifdef __BIG_ENDIAN
1060 int i; 1061 int i;
1061 u16 *stringcast; 1062
1062 1063 for (i = 0; i < ATA_ID_WORDS; i++)
1063 id->config = __le16_to_cpu(id->config); 1064 id[i] = __le16_to_cpu(id[i]);
1064 id->cyls = __le16_to_cpu(id->cyls);
1065 id->reserved2 = __le16_to_cpu(id->reserved2);
1066 id->heads = __le16_to_cpu(id->heads);
1067 id->track_bytes = __le16_to_cpu(id->track_bytes);
1068 id->sector_bytes = __le16_to_cpu(id->sector_bytes);
1069 id->sectors = __le16_to_cpu(id->sectors);
1070 id->vendor0 = __le16_to_cpu(id->vendor0);
1071 id->vendor1 = __le16_to_cpu(id->vendor1);
1072 id->vendor2 = __le16_to_cpu(id->vendor2);
1073 stringcast = (u16 *)&id->serial_no[0];
1074 for (i = 0; i < (20/2); i++)
1075 stringcast[i] = __le16_to_cpu(stringcast[i]);
1076 id->buf_type = __le16_to_cpu(id->buf_type);
1077 id->buf_size = __le16_to_cpu(id->buf_size);
1078 id->ecc_bytes = __le16_to_cpu(id->ecc_bytes);
1079 stringcast = (u16 *)&id->fw_rev[0];
1080 for (i = 0; i < (8/2); i++)
1081 stringcast[i] = __le16_to_cpu(stringcast[i]);
1082 stringcast = (u16 *)&id->model[0];
1083 for (i = 0; i < (40/2); i++)
1084 stringcast[i] = __le16_to_cpu(stringcast[i]);
1085 id->dword_io = __le16_to_cpu(id->dword_io);
1086 id->reserved50 = __le16_to_cpu(id->reserved50);
1087 id->field_valid = __le16_to_cpu(id->field_valid);
1088 id->cur_cyls = __le16_to_cpu(id->cur_cyls);
1089 id->cur_heads = __le16_to_cpu(id->cur_heads);
1090 id->cur_sectors = __le16_to_cpu(id->cur_sectors);
1091 id->cur_capacity0 = __le16_to_cpu(id->cur_capacity0);
1092 id->cur_capacity1 = __le16_to_cpu(id->cur_capacity1);
1093 id->lba_capacity = __le32_to_cpu(id->lba_capacity);
1094 id->dma_1word = __le16_to_cpu(id->dma_1word);
1095 id->dma_mword = __le16_to_cpu(id->dma_mword);
1096 id->eide_pio_modes = __le16_to_cpu(id->eide_pio_modes);
1097 id->eide_dma_min = __le16_to_cpu(id->eide_dma_min);
1098 id->eide_dma_time = __le16_to_cpu(id->eide_dma_time);
1099 id->eide_pio = __le16_to_cpu(id->eide_pio);
1100 id->eide_pio_iordy = __le16_to_cpu(id->eide_pio_iordy);
1101 for (i = 0; i < 2; ++i)
1102 id->words69_70[i] = __le16_to_cpu(id->words69_70[i]);
1103 for (i = 0; i < 4; ++i)
1104 id->words71_74[i] = __le16_to_cpu(id->words71_74[i]);
1105 id->queue_depth = __le16_to_cpu(id->queue_depth);
1106 for (i = 0; i < 4; ++i)
1107 id->words76_79[i] = __le16_to_cpu(id->words76_79[i]);
1108 id->major_rev_num = __le16_to_cpu(id->major_rev_num);
1109 id->minor_rev_num = __le16_to_cpu(id->minor_rev_num);
1110 id->command_set_1 = __le16_to_cpu(id->command_set_1);
1111 id->command_set_2 = __le16_to_cpu(id->command_set_2);
1112 id->cfsse = __le16_to_cpu(id->cfsse);
1113 id->cfs_enable_1 = __le16_to_cpu(id->cfs_enable_1);
1114 id->cfs_enable_2 = __le16_to_cpu(id->cfs_enable_2);
1115 id->csf_default = __le16_to_cpu(id->csf_default);
1116 id->dma_ultra = __le16_to_cpu(id->dma_ultra);
1117 id->trseuc = __le16_to_cpu(id->trseuc);
1118 id->trsEuc = __le16_to_cpu(id->trsEuc);
1119 id->CurAPMvalues = __le16_to_cpu(id->CurAPMvalues);
1120 id->mprc = __le16_to_cpu(id->mprc);
1121 id->hw_config = __le16_to_cpu(id->hw_config);
1122 id->acoustic = __le16_to_cpu(id->acoustic);
1123 id->msrqs = __le16_to_cpu(id->msrqs);
1124 id->sxfert = __le16_to_cpu(id->sxfert);
1125 id->sal = __le16_to_cpu(id->sal);
1126 id->spg = __le32_to_cpu(id->spg);
1127 id->lba_capacity_2 = __le64_to_cpu(id->lba_capacity_2);
1128 for (i = 0; i < 22; i++)
1129 id->words104_125[i] = __le16_to_cpu(id->words104_125[i]);
1130 id->last_lun = __le16_to_cpu(id->last_lun);
1131 id->word127 = __le16_to_cpu(id->word127);
1132 id->dlf = __le16_to_cpu(id->dlf);
1133 id->csfo = __le16_to_cpu(id->csfo);
1134 for (i = 0; i < 26; i++)
1135 id->words130_155[i] = __le16_to_cpu(id->words130_155[i]);
1136 id->word156 = __le16_to_cpu(id->word156);
1137 for (i = 0; i < 3; i++)
1138 id->words157_159[i] = __le16_to_cpu(id->words157_159[i]);
1139 id->cfa_power = __le16_to_cpu(id->cfa_power);
1140 for (i = 0; i < 14; i++)
1141 id->words161_175[i] = __le16_to_cpu(id->words161_175[i]);
1142 for (i = 0; i < 31; i++)
1143 id->words176_205[i] = __le16_to_cpu(id->words176_205[i]);
1144 for (i = 0; i < 48; i++)
1145 id->words206_254[i] = __le16_to_cpu(id->words206_254[i]);
1146 id->integrity_word = __le16_to_cpu(id->integrity_word);
1147# else 1065# else
1148# error "Please fix <asm/byteorder.h>" 1066# error "Please fix <asm/byteorder.h>"
1149# endif 1067# endif
1150#endif 1068#endif
1151} 1069}
1152 1070
1071static void isd200_dump_driveid(u16 *id)
1072{
1073 US_DEBUGP(" Identify Data Structure:\n");
1074 US_DEBUGP(" config = 0x%x\n", id[ATA_ID_CONFIG]);
1075 US_DEBUGP(" cyls = 0x%x\n", id[ATA_ID_CYLS]);
1076 US_DEBUGP(" heads = 0x%x\n", id[ATA_ID_HEADS]);
1077 US_DEBUGP(" track_bytes = 0x%x\n", id[4]);
1078 US_DEBUGP(" sector_bytes = 0x%x\n", id[5]);
1079 US_DEBUGP(" sectors = 0x%x\n", id[ATA_ID_SECTORS]);
1080 US_DEBUGP(" serial_no[0] = 0x%x\n", *(char *)&id[ATA_ID_SERNO]);
1081 US_DEBUGP(" buf_type = 0x%x\n", id[20]);
1082 US_DEBUGP(" buf_size = 0x%x\n", id[ATA_ID_BUF_SIZE]);
1083 US_DEBUGP(" ecc_bytes = 0x%x\n", id[22]);
1084 US_DEBUGP(" fw_rev[0] = 0x%x\n", *(char *)&id[ATA_ID_FW_REV]);
1085 US_DEBUGP(" model[0] = 0x%x\n", *(char *)&id[ATA_ID_PROD]);
1086 US_DEBUGP(" max_multsect = 0x%x\n", id[ATA_ID_MAX_MULTSECT] & 0xff);
1087 US_DEBUGP(" dword_io = 0x%x\n", id[ATA_ID_DWORD_IO]);
1088 US_DEBUGP(" capability = 0x%x\n", id[ATA_ID_CAPABILITY] >> 8);
1089 US_DEBUGP(" tPIO = 0x%x\n", id[ATA_ID_OLD_PIO_MODES] >> 8);
1090 US_DEBUGP(" tDMA = 0x%x\n", id[ATA_ID_OLD_DMA_MODES] >> 8);
1091 US_DEBUGP(" field_valid = 0x%x\n", id[ATA_ID_FIELD_VALID]);
1092 US_DEBUGP(" cur_cyls = 0x%x\n", id[ATA_ID_CUR_CYLS]);
1093 US_DEBUGP(" cur_heads = 0x%x\n", id[ATA_ID_CUR_HEADS]);
1094 US_DEBUGP(" cur_sectors = 0x%x\n", id[ATA_ID_CUR_SECTORS]);
1095 US_DEBUGP(" cur_capacity = 0x%x\n", ata_id_u32(id, 57));
1096 US_DEBUGP(" multsect = 0x%x\n", id[ATA_ID_MULTSECT] & 0xff);
1097 US_DEBUGP(" lba_capacity = 0x%x\n", ata_id_u32(id, ATA_ID_LBA_CAPACITY));
1098 US_DEBUGP(" command_set_1 = 0x%x\n", id[ATA_ID_COMMAND_SET_1]);
1099 US_DEBUGP(" command_set_2 = 0x%x\n", id[ATA_ID_COMMAND_SET_2]);
1100}
1153 1101
1154/************************************************************************** 1102/**************************************************************************
1155 * isd200_get_inquiry_data 1103 * isd200_get_inquiry_data
@@ -1163,7 +1111,7 @@ static int isd200_get_inquiry_data( struct us_data *us )
1163{ 1111{
1164 struct isd200_info *info = (struct isd200_info *)us->extra; 1112 struct isd200_info *info = (struct isd200_info *)us->extra;
1165 int retStatus = ISD200_GOOD; 1113 int retStatus = ISD200_GOOD;
1166 struct hd_driveid *id = info->id; 1114 u16 *id = info->id;
1167 1115
1168 US_DEBUGP("Entering isd200_get_inquiry_data\n"); 1116 US_DEBUGP("Entering isd200_get_inquiry_data\n");
1169 1117
@@ -1180,8 +1128,7 @@ static int isd200_get_inquiry_data( struct us_data *us )
1180 /* this must be an ATA device */ 1128 /* this must be an ATA device */
1181 /* perform an ATA Command Identify */ 1129 /* perform an ATA Command Identify */
1182 transferStatus = isd200_action( us, ACTION_IDENTIFY, 1130 transferStatus = isd200_action( us, ACTION_IDENTIFY,
1183 id, 1131 id, ATA_ID_WORDS * 2);
1184 sizeof(struct hd_driveid) );
1185 if (transferStatus != ISD200_TRANSPORT_GOOD) { 1132 if (transferStatus != ISD200_TRANSPORT_GOOD) {
1186 /* Error issuing ATA Command Identify */ 1133 /* Error issuing ATA Command Identify */
1187 US_DEBUGP(" Error issuing ATA Command Identify\n"); 1134 US_DEBUGP(" Error issuing ATA Command Identify\n");
@@ -1191,35 +1138,9 @@ static int isd200_get_inquiry_data( struct us_data *us )
1191 int i; 1138 int i;
1192 __be16 *src; 1139 __be16 *src;
1193 __u16 *dest; 1140 __u16 *dest;
1194 isd200_fix_driveid(id);
1195 1141
1196 US_DEBUGP(" Identify Data Structure:\n"); 1142 isd200_fix_driveid(id);
1197 US_DEBUGP(" config = 0x%x\n", id->config); 1143 isd200_dump_driveid(id);
1198 US_DEBUGP(" cyls = 0x%x\n", id->cyls);
1199 US_DEBUGP(" heads = 0x%x\n", id->heads);
1200 US_DEBUGP(" track_bytes = 0x%x\n", id->track_bytes);
1201 US_DEBUGP(" sector_bytes = 0x%x\n", id->sector_bytes);
1202 US_DEBUGP(" sectors = 0x%x\n", id->sectors);
1203 US_DEBUGP(" serial_no[0] = 0x%x\n", id->serial_no[0]);
1204 US_DEBUGP(" buf_type = 0x%x\n", id->buf_type);
1205 US_DEBUGP(" buf_size = 0x%x\n", id->buf_size);
1206 US_DEBUGP(" ecc_bytes = 0x%x\n", id->ecc_bytes);
1207 US_DEBUGP(" fw_rev[0] = 0x%x\n", id->fw_rev[0]);
1208 US_DEBUGP(" model[0] = 0x%x\n", id->model[0]);
1209 US_DEBUGP(" max_multsect = 0x%x\n", id->max_multsect);
1210 US_DEBUGP(" dword_io = 0x%x\n", id->dword_io);
1211 US_DEBUGP(" capability = 0x%x\n", id->capability);
1212 US_DEBUGP(" tPIO = 0x%x\n", id->tPIO);
1213 US_DEBUGP(" tDMA = 0x%x\n", id->tDMA);
1214 US_DEBUGP(" field_valid = 0x%x\n", id->field_valid);
1215 US_DEBUGP(" cur_cyls = 0x%x\n", id->cur_cyls);
1216 US_DEBUGP(" cur_heads = 0x%x\n", id->cur_heads);
1217 US_DEBUGP(" cur_sectors = 0x%x\n", id->cur_sectors);
1218 US_DEBUGP(" cur_capacity = 0x%x\n", (id->cur_capacity1 << 16) + id->cur_capacity0 );
1219 US_DEBUGP(" multsect = 0x%x\n", id->multsect);
1220 US_DEBUGP(" lba_capacity = 0x%x\n", id->lba_capacity);
1221 US_DEBUGP(" command_set_1 = 0x%x\n", id->command_set_1);
1222 US_DEBUGP(" command_set_2 = 0x%x\n", id->command_set_2);
1223 1144
1224 memset(&info->InquiryData, 0, sizeof(info->InquiryData)); 1145 memset(&info->InquiryData, 0, sizeof(info->InquiryData));
1225 1146
@@ -1229,30 +1150,30 @@ static int isd200_get_inquiry_data( struct us_data *us )
1229 /* The length must be at least 36 (5 + 31) */ 1150 /* The length must be at least 36 (5 + 31) */
1230 info->InquiryData.AdditionalLength = 0x1F; 1151 info->InquiryData.AdditionalLength = 0x1F;
1231 1152
1232 if (id->command_set_1 & COMMANDSET_MEDIA_STATUS) { 1153 if (id[ATA_ID_COMMAND_SET_1] & COMMANDSET_MEDIA_STATUS) {
1233 /* set the removable bit */ 1154 /* set the removable bit */
1234 info->InquiryData.DeviceTypeModifier = DEVICE_REMOVABLE; 1155 info->InquiryData.DeviceTypeModifier = DEVICE_REMOVABLE;
1235 info->DeviceFlags |= DF_REMOVABLE_MEDIA; 1156 info->DeviceFlags |= DF_REMOVABLE_MEDIA;
1236 } 1157 }
1237 1158
1238 /* Fill in vendor identification fields */ 1159 /* Fill in vendor identification fields */
1239 src = (__be16*)id->model; 1160 src = (__be16 *)&id[ATA_ID_PROD];
1240 dest = (__u16*)info->InquiryData.VendorId; 1161 dest = (__u16*)info->InquiryData.VendorId;
1241 for (i=0;i<4;i++) 1162 for (i=0;i<4;i++)
1242 dest[i] = be16_to_cpu(src[i]); 1163 dest[i] = be16_to_cpu(src[i]);
1243 1164
1244 src = (__be16*)(id->model+8); 1165 src = (__be16 *)&id[ATA_ID_PROD + 8/2];
1245 dest = (__u16*)info->InquiryData.ProductId; 1166 dest = (__u16*)info->InquiryData.ProductId;
1246 for (i=0;i<8;i++) 1167 for (i=0;i<8;i++)
1247 dest[i] = be16_to_cpu(src[i]); 1168 dest[i] = be16_to_cpu(src[i]);
1248 1169
1249 src = (__be16*)id->fw_rev; 1170 src = (__be16 *)&id[ATA_ID_FW_REV];
1250 dest = (__u16*)info->InquiryData.ProductRevisionLevel; 1171 dest = (__u16*)info->InquiryData.ProductRevisionLevel;
1251 for (i=0;i<2;i++) 1172 for (i=0;i<2;i++)
1252 dest[i] = be16_to_cpu(src[i]); 1173 dest[i] = be16_to_cpu(src[i]);
1253 1174
1254 /* determine if it supports Media Status Notification */ 1175 /* determine if it supports Media Status Notification */
1255 if (id->command_set_2 & COMMANDSET_MEDIA_STATUS) { 1176 if (id[ATA_ID_COMMAND_SET_2] & COMMANDSET_MEDIA_STATUS) {
1256 US_DEBUGP(" Device supports Media Status Notification\n"); 1177 US_DEBUGP(" Device supports Media Status Notification\n");
1257 1178
1258 /* Indicate that it is enabled, even though it is not 1179 /* Indicate that it is enabled, even though it is not
@@ -1301,7 +1222,7 @@ static int isd200_scsi_to_ata(struct scsi_cmnd *srb, struct us_data *us,
1301 union ata_cdb * ataCdb) 1222 union ata_cdb * ataCdb)
1302{ 1223{
1303 struct isd200_info *info = (struct isd200_info *)us->extra; 1224 struct isd200_info *info = (struct isd200_info *)us->extra;
1304 struct hd_driveid *id = info->id; 1225 u16 *id = info->id;
1305 int sendToTransport = 1; 1226 int sendToTransport = 1;
1306 unsigned char sectnum, head; 1227 unsigned char sectnum, head;
1307 unsigned short cylinder; 1228 unsigned short cylinder;
@@ -1369,13 +1290,12 @@ static int isd200_scsi_to_ata(struct scsi_cmnd *srb, struct us_data *us,
1369 1290
1370 US_DEBUGP(" ATA OUT - SCSIOP_READ_CAPACITY\n"); 1291 US_DEBUGP(" ATA OUT - SCSIOP_READ_CAPACITY\n");
1371 1292
1372 if (id->capability & CAPABILITY_LBA ) { 1293 if (ata_id_has_lba(id))
1373 capacity = id->lba_capacity - 1; 1294 capacity = ata_id_u32(id, ATA_ID_LBA_CAPACITY) - 1;
1374 } else { 1295 else
1375 capacity = (id->heads * 1296 capacity = (id[ATA_ID_HEADS] * id[ATA_ID_CYLS] *
1376 id->cyls * 1297 id[ATA_ID_SECTORS]) - 1;
1377 id->sectors) - 1; 1298
1378 }
1379 readCapacityData.LogicalBlockAddress = cpu_to_be32(capacity); 1299 readCapacityData.LogicalBlockAddress = cpu_to_be32(capacity);
1380 readCapacityData.BytesPerBlock = cpu_to_be32(0x200); 1300 readCapacityData.BytesPerBlock = cpu_to_be32(0x200);
1381 1301
@@ -1392,16 +1312,16 @@ static int isd200_scsi_to_ata(struct scsi_cmnd *srb, struct us_data *us,
1392 lba = be32_to_cpu(*(__be32 *)&srb->cmnd[2]); 1312 lba = be32_to_cpu(*(__be32 *)&srb->cmnd[2]);
1393 blockCount = (unsigned long)srb->cmnd[7]<<8 | (unsigned long)srb->cmnd[8]; 1313 blockCount = (unsigned long)srb->cmnd[7]<<8 | (unsigned long)srb->cmnd[8];
1394 1314
1395 if (id->capability & CAPABILITY_LBA) { 1315 if (ata_id_has_lba(id)) {
1396 sectnum = (unsigned char)(lba); 1316 sectnum = (unsigned char)(lba);
1397 cylinder = (unsigned short)(lba>>8); 1317 cylinder = (unsigned short)(lba>>8);
1398 head = ATA_ADDRESS_DEVHEAD_LBA_MODE | (unsigned char)(lba>>24 & 0x0F); 1318 head = ATA_ADDRESS_DEVHEAD_LBA_MODE | (unsigned char)(lba>>24 & 0x0F);
1399 } else { 1319 } else {
1400 sectnum = (unsigned char)((lba % id->sectors) + 1); 1320 sectnum = (u8)((lba % id[ATA_ID_SECTORS]) + 1);
1401 cylinder = (unsigned short)(lba / (id->sectors * 1321 cylinder = (u16)(lba / (id[ATA_ID_SECTORS] *
1402 id->heads)); 1322 id[ATA_ID_HEADS]));
1403 head = (unsigned char)((lba / id->sectors) % 1323 head = (u8)((lba / id[ATA_ID_SECTORS]) %
1404 id->heads); 1324 id[ATA_ID_HEADS]);
1405 } 1325 }
1406 ataCdb->generic.SignatureByte0 = info->ConfigData.ATAMajorCommand; 1326 ataCdb->generic.SignatureByte0 = info->ConfigData.ATAMajorCommand;
1407 ataCdb->generic.SignatureByte1 = info->ConfigData.ATAMinorCommand; 1327 ataCdb->generic.SignatureByte1 = info->ConfigData.ATAMinorCommand;
@@ -1415,7 +1335,7 @@ static int isd200_scsi_to_ata(struct scsi_cmnd *srb, struct us_data *us,
1415 ataCdb->write.CylinderHighByte = (unsigned char)(cylinder>>8); 1335 ataCdb->write.CylinderHighByte = (unsigned char)(cylinder>>8);
1416 ataCdb->write.CylinderLowByte = (unsigned char)cylinder; 1336 ataCdb->write.CylinderLowByte = (unsigned char)cylinder;
1417 ataCdb->write.DeviceHeadByte = (head | ATA_ADDRESS_DEVHEAD_STD); 1337 ataCdb->write.DeviceHeadByte = (head | ATA_ADDRESS_DEVHEAD_STD);
1418 ataCdb->write.CommandByte = WIN_READ; 1338 ataCdb->write.CommandByte = ATA_CMD_PIO_READ;
1419 break; 1339 break;
1420 1340
1421 case WRITE_10: 1341 case WRITE_10:
@@ -1424,14 +1344,16 @@ static int isd200_scsi_to_ata(struct scsi_cmnd *srb, struct us_data *us,
1424 lba = be32_to_cpu(*(__be32 *)&srb->cmnd[2]); 1344 lba = be32_to_cpu(*(__be32 *)&srb->cmnd[2]);
1425 blockCount = (unsigned long)srb->cmnd[7]<<8 | (unsigned long)srb->cmnd[8]; 1345 blockCount = (unsigned long)srb->cmnd[7]<<8 | (unsigned long)srb->cmnd[8];
1426 1346
1427 if (id->capability & CAPABILITY_LBA) { 1347 if (ata_id_has_lba(id)) {
1428 sectnum = (unsigned char)(lba); 1348 sectnum = (unsigned char)(lba);
1429 cylinder = (unsigned short)(lba>>8); 1349 cylinder = (unsigned short)(lba>>8);
1430 head = ATA_ADDRESS_DEVHEAD_LBA_MODE | (unsigned char)(lba>>24 & 0x0F); 1350 head = ATA_ADDRESS_DEVHEAD_LBA_MODE | (unsigned char)(lba>>24 & 0x0F);
1431 } else { 1351 } else {
1432 sectnum = (unsigned char)((lba % id->sectors) + 1); 1352 sectnum = (u8)((lba % id[ATA_ID_SECTORS]) + 1);
1433 cylinder = (unsigned short)(lba / (id->sectors * id->heads)); 1353 cylinder = (u16)(lba / (id[ATA_ID_SECTORS] *
1434 head = (unsigned char)((lba / id->sectors) % id->heads); 1354 id[ATA_ID_HEADS]));
1355 head = (u8)((lba / id[ATA_ID_SECTORS]) %
1356 id[ATA_ID_HEADS]);
1435 } 1357 }
1436 ataCdb->generic.SignatureByte0 = info->ConfigData.ATAMajorCommand; 1358 ataCdb->generic.SignatureByte0 = info->ConfigData.ATAMajorCommand;
1437 ataCdb->generic.SignatureByte1 = info->ConfigData.ATAMinorCommand; 1359 ataCdb->generic.SignatureByte1 = info->ConfigData.ATAMinorCommand;
@@ -1445,7 +1367,7 @@ static int isd200_scsi_to_ata(struct scsi_cmnd *srb, struct us_data *us,
1445 ataCdb->write.CylinderHighByte = (unsigned char)(cylinder>>8); 1367 ataCdb->write.CylinderHighByte = (unsigned char)(cylinder>>8);
1446 ataCdb->write.CylinderLowByte = (unsigned char)cylinder; 1368 ataCdb->write.CylinderLowByte = (unsigned char)cylinder;
1447 ataCdb->write.DeviceHeadByte = (head | ATA_ADDRESS_DEVHEAD_STD); 1369 ataCdb->write.DeviceHeadByte = (head | ATA_ADDRESS_DEVHEAD_STD);
1448 ataCdb->write.CommandByte = WIN_WRITE; 1370 ataCdb->write.CommandByte = ATA_CMD_PIO_WRITE;
1449 break; 1371 break;
1450 1372
1451 case ALLOW_MEDIUM_REMOVAL: 1373 case ALLOW_MEDIUM_REMOVAL:
@@ -1459,7 +1381,7 @@ static int isd200_scsi_to_ata(struct scsi_cmnd *srb, struct us_data *us,
1459 ataCdb->generic.TransferBlockSize = 1; 1381 ataCdb->generic.TransferBlockSize = 1;
1460 ataCdb->generic.RegisterSelect = REG_COMMAND; 1382 ataCdb->generic.RegisterSelect = REG_COMMAND;
1461 ataCdb->write.CommandByte = (srb->cmnd[4] & 0x1) ? 1383 ataCdb->write.CommandByte = (srb->cmnd[4] & 0x1) ?
1462 WIN_DOORLOCK : WIN_DOORUNLOCK; 1384 ATA_CMD_MEDIA_LOCK : ATA_CMD_MEDIA_UNLOCK;
1463 isd200_srb_set_bufflen(srb, 0); 1385 isd200_srb_set_bufflen(srb, 0);
1464 } else { 1386 } else {
1465 US_DEBUGP(" Not removeable media, just report okay\n"); 1387 US_DEBUGP(" Not removeable media, just report okay\n");
@@ -1539,8 +1461,7 @@ static int isd200_init_info(struct us_data *us)
1539 if (!info) 1461 if (!info)
1540 retStatus = ISD200_ERROR; 1462 retStatus = ISD200_ERROR;
1541 else { 1463 else {
1542 info->id = (struct hd_driveid *) 1464 info->id = kzalloc(ATA_ID_WORDS * 2, GFP_KERNEL);
1543 kzalloc(sizeof(struct hd_driveid), GFP_KERNEL);
1544 info->RegsBuf = (unsigned char *) 1465 info->RegsBuf = (unsigned char *)
1545 kmalloc(sizeof(info->ATARegs), GFP_KERNEL); 1466 kmalloc(sizeof(info->ATARegs), GFP_KERNEL);
1546 info->srb.sense_buffer = 1467 info->srb.sense_buffer =
diff --git a/drivers/usb/wusbcore/devconnect.c b/drivers/usb/wusbcore/devconnect.c
index f0aac0cf315a..386eaa22d215 100644
--- a/drivers/usb/wusbcore/devconnect.c
+++ b/drivers/usb/wusbcore/devconnect.c
@@ -471,7 +471,7 @@ static void __wusbhc_keep_alive(struct wusbhc *wusbhc)
471 */ 471 */
472static void wusbhc_keep_alive_run(struct work_struct *ws) 472static void wusbhc_keep_alive_run(struct work_struct *ws)
473{ 473{
474 struct delayed_work *dw = container_of(ws, struct delayed_work, work); 474 struct delayed_work *dw = to_delayed_work(ws);
475 struct wusbhc *wusbhc = container_of(dw, struct wusbhc, keep_alive_timer); 475 struct wusbhc *wusbhc = container_of(dw, struct wusbhc, keep_alive_timer);
476 476
477 mutex_lock(&wusbhc->mutex); 477 mutex_lock(&wusbhc->mutex);
diff --git a/drivers/usb/wusbcore/security.c b/drivers/usb/wusbcore/security.c
index 8118db7f1d8d..b2f149fedcc5 100644
--- a/drivers/usb/wusbcore/security.c
+++ b/drivers/usb/wusbcore/security.c
@@ -562,7 +562,7 @@ void wusbhc_gtk_rekey(struct wusbhc *wusbhc)
562 struct wusb_dev *wusb_dev; 562 struct wusb_dev *wusb_dev;
563 563
564 wusb_dev = wusbhc->port[p].wusb_dev; 564 wusb_dev = wusbhc->port[p].wusb_dev;
565 if (!wusb_dev || !wusb_dev->usb_dev | !wusb_dev->usb_dev->authenticated) 565 if (!wusb_dev || !wusb_dev->usb_dev || !wusb_dev->usb_dev->authenticated)
566 continue; 566 continue;
567 567
568 usb_fill_control_urb(wusb_dev->set_gtk_urb, wusb_dev->usb_dev, 568 usb_fill_control_urb(wusb_dev->set_gtk_urb, wusb_dev->usb_dev,