diff options
author | James Bottomley <jejb@mulgrave.il.steeleye.com> | 2006-06-10 14:47:26 -0400 |
---|---|---|
committer | James Bottomley <jejb@mulgrave.il.steeleye.com> | 2006-06-10 14:47:26 -0400 |
commit | f0cd91a68acdc9b49d7f6738b514a426da627649 (patch) | |
tree | 8ad73564015794197583b094217ae0a71e71e753 /drivers/usb | |
parent | 60eef25701d25e99c991dd0f4a9f3832a0c3ad3e (diff) | |
parent | 128e6ced247cda88f96fa9f2e4ba8b2c4a681560 (diff) |
Merge ../linux-2.6
Diffstat (limited to 'drivers/usb')
59 files changed, 1897 insertions, 852 deletions
diff --git a/drivers/usb/atm/speedtch.c b/drivers/usb/atm/speedtch.c index 7860c8a5800d..956b7a1e8af9 100644 --- a/drivers/usb/atm/speedtch.c +++ b/drivers/usb/atm/speedtch.c | |||
@@ -69,7 +69,7 @@ static const char speedtch_driver_name[] = "speedtch"; | |||
69 | #define RESUBMIT_DELAY 1000 /* milliseconds */ | 69 | #define RESUBMIT_DELAY 1000 /* milliseconds */ |
70 | 70 | ||
71 | #define DEFAULT_BULK_ALTSETTING 1 | 71 | #define DEFAULT_BULK_ALTSETTING 1 |
72 | #define DEFAULT_ISOC_ALTSETTING 2 | 72 | #define DEFAULT_ISOC_ALTSETTING 3 |
73 | #define DEFAULT_DL_512_FIRST 0 | 73 | #define DEFAULT_DL_512_FIRST 0 |
74 | #define DEFAULT_ENABLE_ISOC 0 | 74 | #define DEFAULT_ENABLE_ISOC 0 |
75 | #define DEFAULT_SW_BUFFERING 0 | 75 | #define DEFAULT_SW_BUFFERING 0 |
diff --git a/drivers/usb/atm/ueagle-atm.c b/drivers/usb/atm/ueagle-atm.c index 830d2c982670..b38990adf1cd 100644 --- a/drivers/usb/atm/ueagle-atm.c +++ b/drivers/usb/atm/ueagle-atm.c | |||
@@ -68,7 +68,7 @@ | |||
68 | 68 | ||
69 | #include "usbatm.h" | 69 | #include "usbatm.h" |
70 | 70 | ||
71 | #define EAGLEUSBVERSION "ueagle 1.2" | 71 | #define EAGLEUSBVERSION "ueagle 1.3" |
72 | 72 | ||
73 | 73 | ||
74 | /* | 74 | /* |
@@ -243,7 +243,7 @@ enum { | |||
243 | #define BULK_TIMEOUT 300 | 243 | #define BULK_TIMEOUT 300 |
244 | #define CTRL_TIMEOUT 1000 | 244 | #define CTRL_TIMEOUT 1000 |
245 | 245 | ||
246 | #define ACK_TIMEOUT msecs_to_jiffies(1500) | 246 | #define ACK_TIMEOUT msecs_to_jiffies(3000) |
247 | 247 | ||
248 | #define UEA_INTR_IFACE_NO 0 | 248 | #define UEA_INTR_IFACE_NO 0 |
249 | #define UEA_US_IFACE_NO 1 | 249 | #define UEA_US_IFACE_NO 1 |
@@ -314,6 +314,10 @@ struct cmv { | |||
314 | ((d) & 0xff) << 16 | \ | 314 | ((d) & 0xff) << 16 | \ |
315 | ((a) & 0xff) << 8 | \ | 315 | ((a) & 0xff) << 8 | \ |
316 | ((b) & 0xff)) | 316 | ((b) & 0xff)) |
317 | #define GETSA1(a) ((a >> 8) & 0xff) | ||
318 | #define GETSA2(a) (a & 0xff) | ||
319 | #define GETSA3(a) ((a >> 24) & 0xff) | ||
320 | #define GETSA4(a) ((a >> 16) & 0xff) | ||
317 | 321 | ||
318 | #define SA_CNTL MAKESA('C', 'N', 'T', 'L') | 322 | #define SA_CNTL MAKESA('C', 'N', 'T', 'L') |
319 | #define SA_DIAG MAKESA('D', 'I', 'A', 'G') | 323 | #define SA_DIAG MAKESA('D', 'I', 'A', 'G') |
@@ -728,11 +732,12 @@ bad2: | |||
728 | uea_err(INS_TO_USBDEV(sc), "sending DSP block %u failed\n", i); | 732 | uea_err(INS_TO_USBDEV(sc), "sending DSP block %u failed\n", i); |
729 | return; | 733 | return; |
730 | bad1: | 734 | bad1: |
731 | uea_err(INS_TO_USBDEV(sc), "invalid DSP page %u requested\n",pageno); | 735 | uea_err(INS_TO_USBDEV(sc), "invalid DSP page %u requested\n", pageno); |
732 | } | 736 | } |
733 | 737 | ||
734 | static inline void wake_up_cmv_ack(struct uea_softc *sc) | 738 | static inline void wake_up_cmv_ack(struct uea_softc *sc) |
735 | { | 739 | { |
740 | BUG_ON(sc->cmv_ack); | ||
736 | sc->cmv_ack = 1; | 741 | sc->cmv_ack = 1; |
737 | wake_up(&sc->cmv_ack_wait); | 742 | wake_up(&sc->cmv_ack_wait); |
738 | } | 743 | } |
@@ -743,6 +748,9 @@ static inline int wait_cmv_ack(struct uea_softc *sc) | |||
743 | sc->cmv_ack, ACK_TIMEOUT); | 748 | sc->cmv_ack, ACK_TIMEOUT); |
744 | sc->cmv_ack = 0; | 749 | sc->cmv_ack = 0; |
745 | 750 | ||
751 | uea_dbg(INS_TO_USBDEV(sc), "wait_event_timeout : %d ms\n", | ||
752 | jiffies_to_msecs(ret)); | ||
753 | |||
746 | if (ret < 0) | 754 | if (ret < 0) |
747 | return ret; | 755 | return ret; |
748 | 756 | ||
@@ -791,6 +799,12 @@ static int uea_cmv(struct uea_softc *sc, | |||
791 | struct cmv cmv; | 799 | struct cmv cmv; |
792 | int ret; | 800 | int ret; |
793 | 801 | ||
802 | uea_enters(INS_TO_USBDEV(sc)); | ||
803 | uea_vdbg(INS_TO_USBDEV(sc), "Function : %d-%d, Address : %c%c%c%c, " | ||
804 | "offset : 0x%04x, data : 0x%08x\n", | ||
805 | FUNCTION_TYPE(function), FUNCTION_SUBTYPE(function), | ||
806 | GETSA1(address), GETSA2(address), GETSA3(address), | ||
807 | GETSA4(address), offset, data); | ||
794 | /* we send a request, but we expect a reply */ | 808 | /* we send a request, but we expect a reply */ |
795 | sc->cmv_function = function | 0x2; | 809 | sc->cmv_function = function | 0x2; |
796 | sc->cmv_idx++; | 810 | sc->cmv_idx++; |
@@ -808,7 +822,9 @@ static int uea_cmv(struct uea_softc *sc, | |||
808 | ret = uea_request(sc, UEA_SET_BLOCK, UEA_MPTX_START, CMV_SIZE, &cmv); | 822 | ret = uea_request(sc, UEA_SET_BLOCK, UEA_MPTX_START, CMV_SIZE, &cmv); |
809 | if (ret < 0) | 823 | if (ret < 0) |
810 | return ret; | 824 | return ret; |
811 | return wait_cmv_ack(sc); | 825 | ret = wait_cmv_ack(sc); |
826 | uea_leaves(INS_TO_USBDEV(sc)); | ||
827 | return ret; | ||
812 | } | 828 | } |
813 | 829 | ||
814 | static inline int uea_read_cmv(struct uea_softc *sc, | 830 | static inline int uea_read_cmv(struct uea_softc *sc, |
@@ -922,7 +938,7 @@ static int uea_stat(struct uea_softc *sc) | |||
922 | * we check the status again in order to detect the failure earlier | 938 | * we check the status again in order to detect the failure earlier |
923 | */ | 939 | */ |
924 | if (sc->stats.phy.flags) { | 940 | if (sc->stats.phy.flags) { |
925 | uea_dbg(INS_TO_USBDEV(sc), "Stat flag = %d\n", | 941 | uea_dbg(INS_TO_USBDEV(sc), "Stat flag = 0x%x\n", |
926 | sc->stats.phy.flags); | 942 | sc->stats.phy.flags); |
927 | return 0; | 943 | return 0; |
928 | } | 944 | } |
@@ -1063,7 +1079,13 @@ static int uea_start_reset(struct uea_softc *sc) | |||
1063 | uea_enters(INS_TO_USBDEV(sc)); | 1079 | uea_enters(INS_TO_USBDEV(sc)); |
1064 | uea_info(INS_TO_USBDEV(sc), "(re)booting started\n"); | 1080 | uea_info(INS_TO_USBDEV(sc), "(re)booting started\n"); |
1065 | 1081 | ||
1082 | /* mask interrupt */ | ||
1066 | sc->booting = 1; | 1083 | sc->booting = 1; |
1084 | /* We need to set this here because, a ack timeout could have occured, | ||
1085 | * but before we start the reboot, the ack occurs and set this to 1. | ||
1086 | * So we will failed to wait Ready CMV. | ||
1087 | */ | ||
1088 | sc->cmv_ack = 0; | ||
1067 | UPDATE_ATM_STAT(signal, ATM_PHY_SIG_LOST); | 1089 | UPDATE_ATM_STAT(signal, ATM_PHY_SIG_LOST); |
1068 | 1090 | ||
1069 | /* reset statistics */ | 1091 | /* reset statistics */ |
@@ -1089,6 +1111,7 @@ static int uea_start_reset(struct uea_softc *sc) | |||
1089 | 1111 | ||
1090 | msleep(1000); | 1112 | msleep(1000); |
1091 | sc->cmv_function = MAKEFUNCTION(ADSLDIRECTIVE, MODEMREADY); | 1113 | sc->cmv_function = MAKEFUNCTION(ADSLDIRECTIVE, MODEMREADY); |
1114 | /* demask interrupt */ | ||
1092 | sc->booting = 0; | 1115 | sc->booting = 0; |
1093 | 1116 | ||
1094 | /* start loading DSP */ | 1117 | /* start loading DSP */ |
@@ -1101,6 +1124,8 @@ static int uea_start_reset(struct uea_softc *sc) | |||
1101 | if (ret < 0) | 1124 | if (ret < 0) |
1102 | return ret; | 1125 | return ret; |
1103 | 1126 | ||
1127 | uea_vdbg(INS_TO_USBDEV(sc), "Ready CMV received\n"); | ||
1128 | |||
1104 | /* Enter in R-IDLE (cmv) until instructed otherwise */ | 1129 | /* Enter in R-IDLE (cmv) until instructed otherwise */ |
1105 | ret = uea_write_cmv(sc, SA_CNTL, 0, 1); | 1130 | ret = uea_write_cmv(sc, SA_CNTL, 0, 1); |
1106 | if (ret < 0) | 1131 | if (ret < 0) |
@@ -1121,6 +1146,7 @@ static int uea_start_reset(struct uea_softc *sc) | |||
1121 | } | 1146 | } |
1122 | /* Enter in R-ACT-REQ */ | 1147 | /* Enter in R-ACT-REQ */ |
1123 | ret = uea_write_cmv(sc, SA_CNTL, 0, 2); | 1148 | ret = uea_write_cmv(sc, SA_CNTL, 0, 2); |
1149 | uea_vdbg(INS_TO_USBDEV(sc), "Entering in R-ACT-REQ state\n"); | ||
1124 | out: | 1150 | out: |
1125 | release_firmware(cmvs_fw); | 1151 | release_firmware(cmvs_fw); |
1126 | sc->reset = 0; | 1152 | sc->reset = 0; |
@@ -1235,6 +1261,7 @@ static void uea_dispatch_cmv(struct uea_softc *sc, struct cmv* cmv) | |||
1235 | 1261 | ||
1236 | if (cmv->bFunction == MAKEFUNCTION(ADSLDIRECTIVE, MODEMREADY)) { | 1262 | if (cmv->bFunction == MAKEFUNCTION(ADSLDIRECTIVE, MODEMREADY)) { |
1237 | wake_up_cmv_ack(sc); | 1263 | wake_up_cmv_ack(sc); |
1264 | uea_leaves(INS_TO_USBDEV(sc)); | ||
1238 | return; | 1265 | return; |
1239 | } | 1266 | } |
1240 | 1267 | ||
@@ -1249,6 +1276,7 @@ static void uea_dispatch_cmv(struct uea_softc *sc, struct cmv* cmv) | |||
1249 | sc->data = sc->data << 16 | sc->data >> 16; | 1276 | sc->data = sc->data << 16 | sc->data >> 16; |
1250 | 1277 | ||
1251 | wake_up_cmv_ack(sc); | 1278 | wake_up_cmv_ack(sc); |
1279 | uea_leaves(INS_TO_USBDEV(sc)); | ||
1252 | return; | 1280 | return; |
1253 | 1281 | ||
1254 | bad2: | 1282 | bad2: |
@@ -1256,12 +1284,14 @@ bad2: | |||
1256 | "Function : %d, Subfunction : %d\n", | 1284 | "Function : %d, Subfunction : %d\n", |
1257 | FUNCTION_TYPE(cmv->bFunction), | 1285 | FUNCTION_TYPE(cmv->bFunction), |
1258 | FUNCTION_SUBTYPE(cmv->bFunction)); | 1286 | FUNCTION_SUBTYPE(cmv->bFunction)); |
1287 | uea_leaves(INS_TO_USBDEV(sc)); | ||
1259 | return; | 1288 | return; |
1260 | 1289 | ||
1261 | bad1: | 1290 | bad1: |
1262 | uea_err(INS_TO_USBDEV(sc), "invalid cmv received, " | 1291 | uea_err(INS_TO_USBDEV(sc), "invalid cmv received, " |
1263 | "wPreamble %d, bDirection %d\n", | 1292 | "wPreamble %d, bDirection %d\n", |
1264 | le16_to_cpu(cmv->wPreamble), cmv->bDirection); | 1293 | le16_to_cpu(cmv->wPreamble), cmv->bDirection); |
1294 | uea_leaves(INS_TO_USBDEV(sc)); | ||
1265 | } | 1295 | } |
1266 | 1296 | ||
1267 | /* | 1297 | /* |
@@ -1346,7 +1376,7 @@ static int uea_boot(struct uea_softc *sc) | |||
1346 | if (ret < 0) { | 1376 | if (ret < 0) { |
1347 | uea_err(INS_TO_USBDEV(sc), | 1377 | uea_err(INS_TO_USBDEV(sc), |
1348 | "urb submition failed with error %d\n", ret); | 1378 | "urb submition failed with error %d\n", ret); |
1349 | goto err1; | 1379 | goto err; |
1350 | } | 1380 | } |
1351 | 1381 | ||
1352 | sc->kthread = kthread_run(uea_kthread, sc, "ueagle-atm"); | 1382 | sc->kthread = kthread_run(uea_kthread, sc, "ueagle-atm"); |
@@ -1360,10 +1390,10 @@ static int uea_boot(struct uea_softc *sc) | |||
1360 | 1390 | ||
1361 | err2: | 1391 | err2: |
1362 | usb_kill_urb(sc->urb_int); | 1392 | usb_kill_urb(sc->urb_int); |
1363 | err1: | ||
1364 | kfree(intr); | ||
1365 | err: | 1393 | err: |
1366 | usb_free_urb(sc->urb_int); | 1394 | usb_free_urb(sc->urb_int); |
1395 | sc->urb_int = NULL; | ||
1396 | kfree(intr); | ||
1367 | uea_leaves(INS_TO_USBDEV(sc)); | 1397 | uea_leaves(INS_TO_USBDEV(sc)); |
1368 | return -ENOMEM; | 1398 | return -ENOMEM; |
1369 | } | 1399 | } |
@@ -1508,7 +1538,7 @@ static ssize_t read_##name(struct device *dev, \ | |||
1508 | int ret = -ENODEV; \ | 1538 | int ret = -ENODEV; \ |
1509 | struct uea_softc *sc; \ | 1539 | struct uea_softc *sc; \ |
1510 | \ | 1540 | \ |
1511 | mutex_lock(&uea_mutex); \ | 1541 | mutex_lock(&uea_mutex); \ |
1512 | sc = dev_to_uea(dev); \ | 1542 | sc = dev_to_uea(dev); \ |
1513 | if (!sc) \ | 1543 | if (!sc) \ |
1514 | goto out; \ | 1544 | goto out; \ |
@@ -1516,7 +1546,7 @@ static ssize_t read_##name(struct device *dev, \ | |||
1516 | if (reset) \ | 1546 | if (reset) \ |
1517 | sc->stats.phy.name = 0; \ | 1547 | sc->stats.phy.name = 0; \ |
1518 | out: \ | 1548 | out: \ |
1519 | mutex_unlock(&uea_mutex); \ | 1549 | mutex_unlock(&uea_mutex); \ |
1520 | return ret; \ | 1550 | return ret; \ |
1521 | } \ | 1551 | } \ |
1522 | \ | 1552 | \ |
@@ -1643,7 +1673,7 @@ static int uea_bind(struct usbatm_data *usbatm, struct usb_interface *intf, | |||
1643 | 1673 | ||
1644 | sc = kzalloc(sizeof(struct uea_softc), GFP_KERNEL); | 1674 | sc = kzalloc(sizeof(struct uea_softc), GFP_KERNEL); |
1645 | if (!sc) { | 1675 | if (!sc) { |
1646 | uea_err(INS_TO_USBDEV(sc), "uea_init: not enough memory !\n"); | 1676 | uea_err(usb, "uea_init: not enough memory !\n"); |
1647 | return -ENOMEM; | 1677 | return -ENOMEM; |
1648 | } | 1678 | } |
1649 | 1679 | ||
diff --git a/drivers/usb/atm/usbatm.c b/drivers/usb/atm/usbatm.c index c1211fc037d9..546249843b8e 100644 --- a/drivers/usb/atm/usbatm.c +++ b/drivers/usb/atm/usbatm.c | |||
@@ -99,11 +99,11 @@ static const char usbatm_driver_name[] = "usbatm"; | |||
99 | 99 | ||
100 | #define UDSL_MAX_RCV_URBS 16 | 100 | #define UDSL_MAX_RCV_URBS 16 |
101 | #define UDSL_MAX_SND_URBS 16 | 101 | #define UDSL_MAX_SND_URBS 16 |
102 | #define UDSL_MAX_BUF_SIZE 64 * 1024 /* bytes */ | 102 | #define UDSL_MAX_BUF_SIZE 65536 |
103 | #define UDSL_DEFAULT_RCV_URBS 4 | 103 | #define UDSL_DEFAULT_RCV_URBS 4 |
104 | #define UDSL_DEFAULT_SND_URBS 4 | 104 | #define UDSL_DEFAULT_SND_URBS 4 |
105 | #define UDSL_DEFAULT_RCV_BUF_SIZE 64 * ATM_CELL_SIZE /* bytes */ | 105 | #define UDSL_DEFAULT_RCV_BUF_SIZE 3392 /* 64 * ATM_CELL_SIZE */ |
106 | #define UDSL_DEFAULT_SND_BUF_SIZE 64 * ATM_CELL_SIZE /* bytes */ | 106 | #define UDSL_DEFAULT_SND_BUF_SIZE 3392 /* 64 * ATM_CELL_SIZE */ |
107 | 107 | ||
108 | #define ATM_CELL_HEADER (ATM_CELL_SIZE - ATM_CELL_PAYLOAD) | 108 | #define ATM_CELL_HEADER (ATM_CELL_SIZE - ATM_CELL_PAYLOAD) |
109 | 109 | ||
@@ -135,7 +135,7 @@ MODULE_PARM_DESC(rcv_buf_bytes, | |||
135 | module_param(snd_buf_bytes, uint, S_IRUGO); | 135 | module_param(snd_buf_bytes, uint, S_IRUGO); |
136 | MODULE_PARM_DESC(snd_buf_bytes, | 136 | MODULE_PARM_DESC(snd_buf_bytes, |
137 | "Size of the buffers used for transmission, in bytes (range: 1-" | 137 | "Size of the buffers used for transmission, in bytes (range: 1-" |
138 | __MODULE_STRING(UDSL_MAX_SND_BUF_SIZE) ", default: " | 138 | __MODULE_STRING(UDSL_MAX_BUF_SIZE) ", default: " |
139 | __MODULE_STRING(UDSL_DEFAULT_SND_BUF_SIZE) ")"); | 139 | __MODULE_STRING(UDSL_DEFAULT_SND_BUF_SIZE) ")"); |
140 | 140 | ||
141 | 141 | ||
diff --git a/drivers/usb/core/Kconfig b/drivers/usb/core/Kconfig index ff03184da403..a08787e253aa 100644 --- a/drivers/usb/core/Kconfig +++ b/drivers/usb/core/Kconfig | |||
@@ -99,4 +99,11 @@ config USB_OTG_WHITELIST | |||
99 | normal Linux-USB hosts do (other than the warning), and is | 99 | normal Linux-USB hosts do (other than the warning), and is |
100 | convenient for many stages of product development. | 100 | convenient for many stages of product development. |
101 | 101 | ||
102 | config USB_OTG_BLACKLIST_HUB | ||
103 | bool "Disable external hubs" | ||
104 | depends on USB_OTG | ||
105 | help | ||
106 | If you say Y here, then Linux will refuse to enumerate | ||
107 | external hubs. OTG hosts are allowed to reduce hardware | ||
108 | and software costs by not supporting external hubs. | ||
102 | 109 | ||
diff --git a/drivers/usb/core/hcd-pci.c b/drivers/usb/core/hcd-pci.c index 0d2193b69235..66b78404ab34 100644 --- a/drivers/usb/core/hcd-pci.c +++ b/drivers/usb/core/hcd-pci.c | |||
@@ -213,11 +213,9 @@ int usb_hcd_pci_suspend (struct pci_dev *dev, pm_message_t message) | |||
213 | 213 | ||
214 | if (hcd->driver->suspend) { | 214 | if (hcd->driver->suspend) { |
215 | retval = hcd->driver->suspend(hcd, message); | 215 | retval = hcd->driver->suspend(hcd, message); |
216 | if (retval) { | 216 | suspend_report_result(hcd->driver->suspend, retval); |
217 | dev_dbg (&dev->dev, "PCI pre-suspend fail, %d\n", | 217 | if (retval) |
218 | retval); | ||
219 | goto done; | 218 | goto done; |
220 | } | ||
221 | } | 219 | } |
222 | synchronize_irq(dev->irq); | 220 | synchronize_irq(dev->irq); |
223 | 221 | ||
@@ -263,6 +261,7 @@ int usb_hcd_pci_suspend (struct pci_dev *dev, pm_message_t message) | |||
263 | * some device state (e.g. as part of clock reinit). | 261 | * some device state (e.g. as part of clock reinit). |
264 | */ | 262 | */ |
265 | retval = pci_set_power_state (dev, PCI_D3hot); | 263 | retval = pci_set_power_state (dev, PCI_D3hot); |
264 | suspend_report_result(pci_set_power_state, retval); | ||
266 | if (retval == 0) { | 265 | if (retval == 0) { |
267 | int wake = device_can_wakeup(&hcd->self.root_hub->dev); | 266 | int wake = device_can_wakeup(&hcd->self.root_hub->dev); |
268 | 267 | ||
diff --git a/drivers/usb/core/hcd.c b/drivers/usb/core/hcd.c index fbd938d4ea58..e2e00ba4e1e6 100644 --- a/drivers/usb/core/hcd.c +++ b/drivers/usb/core/hcd.c | |||
@@ -1805,6 +1805,12 @@ int usb_add_hcd(struct usb_hcd *hcd, | |||
1805 | USB_SPEED_FULL; | 1805 | USB_SPEED_FULL; |
1806 | hcd->self.root_hub = rhdev; | 1806 | hcd->self.root_hub = rhdev; |
1807 | 1807 | ||
1808 | /* wakeup flag init defaults to "everything works" for root hubs, | ||
1809 | * but drivers can override it in reset() if needed, along with | ||
1810 | * recording the overall controller's system wakeup capability. | ||
1811 | */ | ||
1812 | device_init_wakeup(&rhdev->dev, 1); | ||
1813 | |||
1808 | /* "reset" is misnamed; its role is now one-time init. the controller | 1814 | /* "reset" is misnamed; its role is now one-time init. the controller |
1809 | * should already have been reset (and boot firmware kicked off etc). | 1815 | * should already have been reset (and boot firmware kicked off etc). |
1810 | */ | 1816 | */ |
@@ -1813,13 +1819,6 @@ int usb_add_hcd(struct usb_hcd *hcd, | |||
1813 | goto err_hcd_driver_setup; | 1819 | goto err_hcd_driver_setup; |
1814 | } | 1820 | } |
1815 | 1821 | ||
1816 | /* wakeup flag init is in transition; for now we can't rely on PCI to | ||
1817 | * initialize these bits properly, so we let reset() override it. | ||
1818 | * This init should _precede_ the reset() once PCI behaves. | ||
1819 | */ | ||
1820 | device_init_wakeup(&rhdev->dev, | ||
1821 | device_can_wakeup(hcd->self.controller)); | ||
1822 | |||
1823 | /* NOTE: root hub and controller capabilities may not be the same */ | 1822 | /* NOTE: root hub and controller capabilities may not be the same */ |
1824 | if (device_can_wakeup(hcd->self.controller) | 1823 | if (device_can_wakeup(hcd->self.controller) |
1825 | && device_can_wakeup(&hcd->self.root_hub->dev)) | 1824 | && device_can_wakeup(&hcd->self.root_hub->dev)) |
diff --git a/drivers/usb/core/hub.c b/drivers/usb/core/hub.c index 8e65f7a237e4..90b8d43c6b33 100644 --- a/drivers/usb/core/hub.c +++ b/drivers/usb/core/hub.c | |||
@@ -836,6 +836,13 @@ static int hub_probe(struct usb_interface *intf, const struct usb_device_id *id) | |||
836 | desc = intf->cur_altsetting; | 836 | desc = intf->cur_altsetting; |
837 | hdev = interface_to_usbdev(intf); | 837 | hdev = interface_to_usbdev(intf); |
838 | 838 | ||
839 | #ifdef CONFIG_USB_OTG_BLACKLIST_HUB | ||
840 | if (hdev->parent) { | ||
841 | dev_warn(&intf->dev, "ignoring external hub\n"); | ||
842 | return -ENODEV; | ||
843 | } | ||
844 | #endif | ||
845 | |||
839 | /* Some hubs have a subclass of 1, which AFAICT according to the */ | 846 | /* Some hubs have a subclass of 1, which AFAICT according to the */ |
840 | /* specs is not defined, but it works */ | 847 | /* specs is not defined, but it works */ |
841 | if ((desc->desc.bInterfaceSubClass != 0) && | 848 | if ((desc->desc.bInterfaceSubClass != 0) && |
@@ -1022,7 +1029,6 @@ void usb_set_device_state(struct usb_device *udev, | |||
1022 | recursively_mark_NOTATTACHED(udev); | 1029 | recursively_mark_NOTATTACHED(udev); |
1023 | spin_unlock_irqrestore(&device_state_lock, flags); | 1030 | spin_unlock_irqrestore(&device_state_lock, flags); |
1024 | } | 1031 | } |
1025 | EXPORT_SYMBOL(usb_set_device_state); | ||
1026 | 1032 | ||
1027 | 1033 | ||
1028 | #ifdef CONFIG_PM | 1034 | #ifdef CONFIG_PM |
@@ -1162,19 +1168,9 @@ static inline const char *plural(int n) | |||
1162 | static int choose_configuration(struct usb_device *udev) | 1168 | static int choose_configuration(struct usb_device *udev) |
1163 | { | 1169 | { |
1164 | int i; | 1170 | int i; |
1165 | u16 devstatus; | ||
1166 | int bus_powered; | ||
1167 | int num_configs; | 1171 | int num_configs; |
1168 | struct usb_host_config *c, *best; | 1172 | struct usb_host_config *c, *best; |
1169 | 1173 | ||
1170 | /* If this fails, assume the device is bus-powered */ | ||
1171 | devstatus = 0; | ||
1172 | usb_get_status(udev, USB_RECIP_DEVICE, 0, &devstatus); | ||
1173 | le16_to_cpus(&devstatus); | ||
1174 | bus_powered = ((devstatus & (1 << USB_DEVICE_SELF_POWERED)) == 0); | ||
1175 | dev_dbg(&udev->dev, "device is %s-powered\n", | ||
1176 | bus_powered ? "bus" : "self"); | ||
1177 | |||
1178 | best = NULL; | 1174 | best = NULL; |
1179 | c = udev->config; | 1175 | c = udev->config; |
1180 | num_configs = udev->descriptor.bNumConfigurations; | 1176 | num_configs = udev->descriptor.bNumConfigurations; |
@@ -1191,6 +1187,19 @@ static int choose_configuration(struct usb_device *udev) | |||
1191 | * similar errors in their descriptors. If the next test | 1187 | * similar errors in their descriptors. If the next test |
1192 | * were allowed to execute, such configurations would always | 1188 | * were allowed to execute, such configurations would always |
1193 | * be rejected and the devices would not work as expected. | 1189 | * be rejected and the devices would not work as expected. |
1190 | * In the meantime, we run the risk of selecting a config | ||
1191 | * that requires external power at a time when that power | ||
1192 | * isn't available. It seems to be the lesser of two evils. | ||
1193 | * | ||
1194 | * Bugzilla #6448 reports a device that appears to crash | ||
1195 | * when it receives a GET_DEVICE_STATUS request! We don't | ||
1196 | * have any other way to tell whether a device is self-powered, | ||
1197 | * but since we don't use that information anywhere but here, | ||
1198 | * the call has been removed. | ||
1199 | * | ||
1200 | * Maybe the GET_DEVICE_STATUS call and the test below can | ||
1201 | * be reinstated when device firmwares become more reliable. | ||
1202 | * Don't hold your breath. | ||
1194 | */ | 1203 | */ |
1195 | #if 0 | 1204 | #if 0 |
1196 | /* Rule out self-powered configs for a bus-powered device */ | 1205 | /* Rule out self-powered configs for a bus-powered device */ |
diff --git a/drivers/usb/core/usb.c b/drivers/usb/core/usb.c index d7352aa73b5e..b7fdc1cd134a 100644 --- a/drivers/usb/core/usb.c +++ b/drivers/usb/core/usb.c | |||
@@ -1194,7 +1194,6 @@ EXPORT_SYMBOL(usb_disabled); | |||
1194 | EXPORT_SYMBOL_GPL(usb_get_intf); | 1194 | EXPORT_SYMBOL_GPL(usb_get_intf); |
1195 | EXPORT_SYMBOL_GPL(usb_put_intf); | 1195 | EXPORT_SYMBOL_GPL(usb_put_intf); |
1196 | 1196 | ||
1197 | EXPORT_SYMBOL(usb_alloc_dev); | ||
1198 | EXPORT_SYMBOL(usb_put_dev); | 1197 | EXPORT_SYMBOL(usb_put_dev); |
1199 | EXPORT_SYMBOL(usb_get_dev); | 1198 | EXPORT_SYMBOL(usb_get_dev); |
1200 | EXPORT_SYMBOL(usb_hub_tt_clear_buffer); | 1199 | EXPORT_SYMBOL(usb_hub_tt_clear_buffer); |
@@ -1208,7 +1207,6 @@ EXPORT_SYMBOL(usb_ifnum_to_if); | |||
1208 | EXPORT_SYMBOL(usb_altnum_to_altsetting); | 1207 | EXPORT_SYMBOL(usb_altnum_to_altsetting); |
1209 | 1208 | ||
1210 | EXPORT_SYMBOL(usb_reset_device); | 1209 | EXPORT_SYMBOL(usb_reset_device); |
1211 | EXPORT_SYMBOL(usb_disconnect); | ||
1212 | 1210 | ||
1213 | EXPORT_SYMBOL(__usb_get_extra_descriptor); | 1211 | EXPORT_SYMBOL(__usb_get_extra_descriptor); |
1214 | 1212 | ||
diff --git a/drivers/usb/gadget/Kconfig b/drivers/usb/gadget/Kconfig index d80f71877d68..363b2ad74ae6 100644 --- a/drivers/usb/gadget/Kconfig +++ b/drivers/usb/gadget/Kconfig | |||
@@ -69,11 +69,11 @@ choice | |||
69 | often need board-specific hooks. | 69 | often need board-specific hooks. |
70 | 70 | ||
71 | config USB_GADGET_NET2280 | 71 | config USB_GADGET_NET2280 |
72 | boolean "NetChip 2280" | 72 | boolean "NetChip 228x" |
73 | depends on PCI | 73 | depends on PCI |
74 | select USB_GADGET_DUALSPEED | 74 | select USB_GADGET_DUALSPEED |
75 | help | 75 | help |
76 | NetChip 2280 is a PCI based USB peripheral controller which | 76 | NetChip 2280 / 2282 is a PCI based USB peripheral controller which |
77 | supports both full and high speed USB 2.0 data transfers. | 77 | supports both full and high speed USB 2.0 data transfers. |
78 | 78 | ||
79 | It has six configurable endpoints, as well as endpoint zero | 79 | It has six configurable endpoints, as well as endpoint zero |
diff --git a/drivers/usb/gadget/at91_udc.c b/drivers/usb/gadget/at91_udc.c index 865858cfd1c2..b8d0b7825bf3 100644 --- a/drivers/usb/gadget/at91_udc.c +++ b/drivers/usb/gadget/at91_udc.c | |||
@@ -1709,7 +1709,7 @@ static int __devexit at91udc_remove(struct platform_device *dev) | |||
1709 | } | 1709 | } |
1710 | 1710 | ||
1711 | #ifdef CONFIG_PM | 1711 | #ifdef CONFIG_PM |
1712 | static int at91udc_suspend(struct platform_device *dev, u32 state, u32 level) | 1712 | static int at91udc_suspend(struct platform_device *dev, pm_message_t mesg) |
1713 | { | 1713 | { |
1714 | struct at91_udc *udc = platform_get_drvdata(dev); | 1714 | struct at91_udc *udc = platform_get_drvdata(dev); |
1715 | 1715 | ||
@@ -1731,7 +1731,7 @@ static int at91udc_suspend(struct platform_device *dev, u32 state, u32 level) | |||
1731 | return 0; | 1731 | return 0; |
1732 | } | 1732 | } |
1733 | 1733 | ||
1734 | static int at91udc_resume(struct platform_device *dev, u32 level) | 1734 | static int at91udc_resume(struct platform_device *dev) |
1735 | { | 1735 | { |
1736 | struct at91_udc *udc = platform_get_drvdata(dev); | 1736 | struct at91_udc *udc = platform_get_drvdata(dev); |
1737 | 1737 | ||
diff --git a/drivers/usb/gadget/ether.c b/drivers/usb/gadget/ether.c index c3d8e5c5bf28..9c4422ac9de4 100644 --- a/drivers/usb/gadget/ether.c +++ b/drivers/usb/gadget/ether.c | |||
@@ -2338,6 +2338,9 @@ autoconf_fail: | |||
2338 | hs_subset_descriptors(); | 2338 | hs_subset_descriptors(); |
2339 | } | 2339 | } |
2340 | 2340 | ||
2341 | device_desc.bMaxPacketSize0 = gadget->ep0->maxpacket; | ||
2342 | usb_gadget_set_selfpowered (gadget); | ||
2343 | |||
2341 | /* For now RNDIS is always a second config */ | 2344 | /* For now RNDIS is always a second config */ |
2342 | if (rndis) | 2345 | if (rndis) |
2343 | device_desc.bNumConfigurations = 2; | 2346 | device_desc.bNumConfigurations = 2; |
@@ -2361,9 +2364,6 @@ autoconf_fail: | |||
2361 | #endif | 2364 | #endif |
2362 | #endif /* DUALSPEED */ | 2365 | #endif /* DUALSPEED */ |
2363 | 2366 | ||
2364 | device_desc.bMaxPacketSize0 = gadget->ep0->maxpacket; | ||
2365 | usb_gadget_set_selfpowered (gadget); | ||
2366 | |||
2367 | if (gadget->is_otg) { | 2367 | if (gadget->is_otg) { |
2368 | otg_descriptor.bmAttributes |= USB_OTG_HNP, | 2368 | otg_descriptor.bmAttributes |= USB_OTG_HNP, |
2369 | eth_config.bmAttributes |= USB_CONFIG_ATT_WAKEUP; | 2369 | eth_config.bmAttributes |= USB_CONFIG_ATT_WAKEUP; |
diff --git a/drivers/usb/gadget/file_storage.c b/drivers/usb/gadget/file_storage.c index cf3be299e353..6f887478b148 100644 --- a/drivers/usb/gadget/file_storage.c +++ b/drivers/usb/gadget/file_storage.c | |||
@@ -71,6 +71,12 @@ | |||
71 | * requirement amounts to two 16K buffers, size configurable by a parameter. | 71 | * requirement amounts to two 16K buffers, size configurable by a parameter. |
72 | * Support is included for both full-speed and high-speed operation. | 72 | * Support is included for both full-speed and high-speed operation. |
73 | * | 73 | * |
74 | * Note that the driver is slightly non-portable in that it assumes a | ||
75 | * single memory/DMA buffer will be useable for bulk-in, bulk-out, and | ||
76 | * interrupt-in endpoints. With most device controllers this isn't an | ||
77 | * issue, but there may be some with hardware restrictions that prevent | ||
78 | * a buffer from being used by more than one endpoint. | ||
79 | * | ||
74 | * Module options: | 80 | * Module options: |
75 | * | 81 | * |
76 | * file=filename[,filename...] | 82 | * file=filename[,filename...] |
@@ -108,6 +114,14 @@ | |||
108 | * setting are not allowed when the medium is loaded. | 114 | * setting are not allowed when the medium is loaded. |
109 | * | 115 | * |
110 | * This gadget driver is heavily based on "Gadget Zero" by David Brownell. | 116 | * This gadget driver is heavily based on "Gadget Zero" by David Brownell. |
117 | * The driver's SCSI command interface was based on the "Information | ||
118 | * technology - Small Computer System Interface - 2" document from | ||
119 | * X3T9.2 Project 375D, Revision 10L, 7-SEP-93, available at | ||
120 | * <http://www.t10.org/ftp/t10/drafts/s2/s2-r10l.pdf>. The single exception | ||
121 | * is opcode 0x23 (READ FORMAT CAPACITIES), which was based on the | ||
122 | * "Universal Serial Bus Mass Storage Class UFI Command Specification" | ||
123 | * document, Revision 1.0, December 14, 1998, available at | ||
124 | * <http://www.usb.org/developers/devclass_docs/usbmass-ufi10.pdf>. | ||
111 | */ | 125 | */ |
112 | 126 | ||
113 | 127 | ||
@@ -334,11 +348,9 @@ MODULE_LICENSE("Dual BSD/GPL"); | |||
334 | 348 | ||
335 | #define MAX_LUNS 8 | 349 | #define MAX_LUNS 8 |
336 | 350 | ||
337 | /* Arggh! There should be a module_param_array_named macro! */ | ||
338 | static char *file[MAX_LUNS]; | ||
339 | static int ro[MAX_LUNS]; | ||
340 | |||
341 | static struct { | 351 | static struct { |
352 | char *file[MAX_LUNS]; | ||
353 | int ro[MAX_LUNS]; | ||
342 | int num_filenames; | 354 | int num_filenames; |
343 | int num_ros; | 355 | int num_ros; |
344 | unsigned int nluns; | 356 | unsigned int nluns; |
@@ -370,10 +382,11 @@ static struct { | |||
370 | }; | 382 | }; |
371 | 383 | ||
372 | 384 | ||
373 | module_param_array(file, charp, &mod_data.num_filenames, S_IRUGO); | 385 | module_param_array_named(file, mod_data.file, charp, &mod_data.num_filenames, |
386 | S_IRUGO); | ||
374 | MODULE_PARM_DESC(file, "names of backing files or devices"); | 387 | MODULE_PARM_DESC(file, "names of backing files or devices"); |
375 | 388 | ||
376 | module_param_array(ro, bool, &mod_data.num_ros, S_IRUGO); | 389 | module_param_array_named(ro, mod_data.ro, bool, &mod_data.num_ros, S_IRUGO); |
377 | MODULE_PARM_DESC(ro, "true to force read-only"); | 390 | MODULE_PARM_DESC(ro, "true to force read-only"); |
378 | 391 | ||
379 | module_param_named(luns, mod_data.nluns, uint, S_IRUGO); | 392 | module_param_named(luns, mod_data.nluns, uint, S_IRUGO); |
@@ -1795,6 +1808,7 @@ static int do_write(struct fsg_dev *fsg) | |||
1795 | * the bulk-out maxpacket size */ | 1808 | * the bulk-out maxpacket size */ |
1796 | bh->outreq->length = bh->bulk_out_intended_length = | 1809 | bh->outreq->length = bh->bulk_out_intended_length = |
1797 | amount; | 1810 | amount; |
1811 | bh->outreq->short_not_ok = 1; | ||
1798 | start_transfer(fsg, fsg->bulk_out, bh->outreq, | 1812 | start_transfer(fsg, fsg->bulk_out, bh->outreq, |
1799 | &bh->outreq_busy, &bh->state); | 1813 | &bh->outreq_busy, &bh->state); |
1800 | fsg->next_buffhd_to_fill = bh->next; | 1814 | fsg->next_buffhd_to_fill = bh->next; |
@@ -2398,6 +2412,7 @@ static int throw_away_data(struct fsg_dev *fsg) | |||
2398 | * the bulk-out maxpacket size */ | 2412 | * the bulk-out maxpacket size */ |
2399 | bh->outreq->length = bh->bulk_out_intended_length = | 2413 | bh->outreq->length = bh->bulk_out_intended_length = |
2400 | amount; | 2414 | amount; |
2415 | bh->outreq->short_not_ok = 1; | ||
2401 | start_transfer(fsg, fsg->bulk_out, bh->outreq, | 2416 | start_transfer(fsg, fsg->bulk_out, bh->outreq, |
2402 | &bh->outreq_busy, &bh->state); | 2417 | &bh->outreq_busy, &bh->state); |
2403 | fsg->next_buffhd_to_fill = bh->next; | 2418 | fsg->next_buffhd_to_fill = bh->next; |
@@ -3029,6 +3044,7 @@ static int get_next_command(struct fsg_dev *fsg) | |||
3029 | 3044 | ||
3030 | /* Queue a request to read a Bulk-only CBW */ | 3045 | /* Queue a request to read a Bulk-only CBW */ |
3031 | set_bulk_out_req_length(fsg, bh, USB_BULK_CB_WRAP_LEN); | 3046 | set_bulk_out_req_length(fsg, bh, USB_BULK_CB_WRAP_LEN); |
3047 | bh->outreq->short_not_ok = 1; | ||
3032 | start_transfer(fsg, fsg->bulk_out, bh->outreq, | 3048 | start_transfer(fsg, fsg->bulk_out, bh->outreq, |
3033 | &bh->outreq_busy, &bh->state); | 3049 | &bh->outreq_busy, &bh->state); |
3034 | 3050 | ||
@@ -3859,7 +3875,7 @@ static int __init fsg_bind(struct usb_gadget *gadget) | |||
3859 | 3875 | ||
3860 | for (i = 0; i < fsg->nluns; ++i) { | 3876 | for (i = 0; i < fsg->nluns; ++i) { |
3861 | curlun = &fsg->luns[i]; | 3877 | curlun = &fsg->luns[i]; |
3862 | curlun->ro = ro[i]; | 3878 | curlun->ro = mod_data.ro[i]; |
3863 | curlun->dev.parent = &gadget->dev; | 3879 | curlun->dev.parent = &gadget->dev; |
3864 | curlun->dev.driver = &fsg_driver.driver; | 3880 | curlun->dev.driver = &fsg_driver.driver; |
3865 | dev_set_drvdata(&curlun->dev, fsg); | 3881 | dev_set_drvdata(&curlun->dev, fsg); |
@@ -3876,8 +3892,9 @@ static int __init fsg_bind(struct usb_gadget *gadget) | |||
3876 | kref_get(&fsg->ref); | 3892 | kref_get(&fsg->ref); |
3877 | } | 3893 | } |
3878 | 3894 | ||
3879 | if (file[i] && *file[i]) { | 3895 | if (mod_data.file[i] && *mod_data.file[i]) { |
3880 | if ((rc = open_backing_file(curlun, file[i])) != 0) | 3896 | if ((rc = open_backing_file(curlun, |
3897 | mod_data.file[i])) != 0) | ||
3881 | goto out; | 3898 | goto out; |
3882 | } else if (!mod_data.removable) { | 3899 | } else if (!mod_data.removable) { |
3883 | ERROR(fsg, "no file given for LUN%d\n", i); | 3900 | ERROR(fsg, "no file given for LUN%d\n", i); |
@@ -3953,6 +3970,9 @@ static int __init fsg_bind(struct usb_gadget *gadget) | |||
3953 | for (i = 0; i < NUM_BUFFERS; ++i) { | 3970 | for (i = 0; i < NUM_BUFFERS; ++i) { |
3954 | struct fsg_buffhd *bh = &fsg->buffhds[i]; | 3971 | struct fsg_buffhd *bh = &fsg->buffhds[i]; |
3955 | 3972 | ||
3973 | /* Allocate for the bulk-in endpoint. We assume that | ||
3974 | * the buffer will also work with the bulk-out (and | ||
3975 | * interrupt-in) endpoint. */ | ||
3956 | bh->buf = usb_ep_alloc_buffer(fsg->bulk_in, mod_data.buflen, | 3976 | bh->buf = usb_ep_alloc_buffer(fsg->bulk_in, mod_data.buflen, |
3957 | &bh->dma, GFP_KERNEL); | 3977 | &bh->dma, GFP_KERNEL); |
3958 | if (!bh->buf) | 3978 | if (!bh->buf) |
diff --git a/drivers/usb/gadget/gadget_chips.h b/drivers/usb/gadget/gadget_chips.h index c4081407171f..aa80f0910720 100644 --- a/drivers/usb/gadget/gadget_chips.h +++ b/drivers/usb/gadget/gadget_chips.h | |||
@@ -100,9 +100,9 @@ | |||
100 | #define gadget_is_musbhsfc(g) 0 | 100 | #define gadget_is_musbhsfc(g) 0 |
101 | #endif | 101 | #endif |
102 | 102 | ||
103 | /* Mentor high speed "dual role" controller, peripheral mode */ | 103 | /* Mentor high speed "dual role" controller, in peripheral role */ |
104 | #ifdef CONFIG_USB_GADGET_MUSBHDRC | 104 | #ifdef CONFIG_USB_GADGET_MUSB_HDRC |
105 | #define gadget_is_musbhdrc(g) !strcmp("musbhdrc_udc", (g)->name) | 105 | #define gadget_is_musbhdrc(g) !strcmp("musb_hdrc", (g)->name) |
106 | #else | 106 | #else |
107 | #define gadget_is_musbhdrc(g) 0 | 107 | #define gadget_is_musbhdrc(g) 0 |
108 | #endif | 108 | #endif |
diff --git a/drivers/usb/gadget/inode.c b/drivers/usb/gadget/inode.c index 3f618ce6998d..0eb010a3f5bc 100644 --- a/drivers/usb/gadget/inode.c +++ b/drivers/usb/gadget/inode.c | |||
@@ -810,7 +810,7 @@ ep_config (struct file *fd, const char __user *buf, size_t len, loff_t *ptr) | |||
810 | if (value == 0) | 810 | if (value == 0) |
811 | data->state = STATE_EP_ENABLED; | 811 | data->state = STATE_EP_ENABLED; |
812 | break; | 812 | break; |
813 | #ifdef HIGHSPEED | 813 | #ifdef CONFIG_USB_GADGET_DUALSPEED |
814 | case USB_SPEED_HIGH: | 814 | case USB_SPEED_HIGH: |
815 | /* fails if caller didn't provide that descriptor... */ | 815 | /* fails if caller didn't provide that descriptor... */ |
816 | value = usb_ep_enable (ep, &data->hs_desc); | 816 | value = usb_ep_enable (ep, &data->hs_desc); |
@@ -982,7 +982,7 @@ ep0_read (struct file *fd, char __user *buf, size_t len, loff_t *ptr) | |||
982 | /* assume that was SET_CONFIGURATION */ | 982 | /* assume that was SET_CONFIGURATION */ |
983 | if (dev->current_config) { | 983 | if (dev->current_config) { |
984 | unsigned power; | 984 | unsigned power; |
985 | #ifdef HIGHSPEED | 985 | #ifdef CONFIG_USB_GADGET_DUALSPEED |
986 | if (dev->gadget->speed == USB_SPEED_HIGH) | 986 | if (dev->gadget->speed == USB_SPEED_HIGH) |
987 | power = dev->hs_config->bMaxPower; | 987 | power = dev->hs_config->bMaxPower; |
988 | else | 988 | else |
@@ -1262,7 +1262,7 @@ static struct file_operations ep0_io_operations = { | |||
1262 | * Unrecognized ep0 requests may be handled in user space. | 1262 | * Unrecognized ep0 requests may be handled in user space. |
1263 | */ | 1263 | */ |
1264 | 1264 | ||
1265 | #ifdef HIGHSPEED | 1265 | #ifdef CONFIG_USB_GADGET_DUALSPEED |
1266 | static void make_qualifier (struct dev_data *dev) | 1266 | static void make_qualifier (struct dev_data *dev) |
1267 | { | 1267 | { |
1268 | struct usb_qualifier_descriptor qual; | 1268 | struct usb_qualifier_descriptor qual; |
@@ -1291,7 +1291,7 @@ static int | |||
1291 | config_buf (struct dev_data *dev, u8 type, unsigned index) | 1291 | config_buf (struct dev_data *dev, u8 type, unsigned index) |
1292 | { | 1292 | { |
1293 | int len; | 1293 | int len; |
1294 | #ifdef HIGHSPEED | 1294 | #ifdef CONFIG_USB_GADGET_DUALSPEED |
1295 | int hs; | 1295 | int hs; |
1296 | #endif | 1296 | #endif |
1297 | 1297 | ||
@@ -1299,7 +1299,7 @@ config_buf (struct dev_data *dev, u8 type, unsigned index) | |||
1299 | if (index > 0) | 1299 | if (index > 0) |
1300 | return -EINVAL; | 1300 | return -EINVAL; |
1301 | 1301 | ||
1302 | #ifdef HIGHSPEED | 1302 | #ifdef CONFIG_USB_GADGET_DUALSPEED |
1303 | hs = (dev->gadget->speed == USB_SPEED_HIGH); | 1303 | hs = (dev->gadget->speed == USB_SPEED_HIGH); |
1304 | if (type == USB_DT_OTHER_SPEED_CONFIG) | 1304 | if (type == USB_DT_OTHER_SPEED_CONFIG) |
1305 | hs = !hs; | 1305 | hs = !hs; |
@@ -1335,12 +1335,12 @@ gadgetfs_setup (struct usb_gadget *gadget, const struct usb_ctrlrequest *ctrl) | |||
1335 | dev->state = STATE_CONNECTED; | 1335 | dev->state = STATE_CONNECTED; |
1336 | dev->dev->bMaxPacketSize0 = gadget->ep0->maxpacket; | 1336 | dev->dev->bMaxPacketSize0 = gadget->ep0->maxpacket; |
1337 | 1337 | ||
1338 | #ifdef HIGHSPEED | 1338 | #ifdef CONFIG_USB_GADGET_DUALSPEED |
1339 | if (gadget->speed == USB_SPEED_HIGH && dev->hs_config == 0) { | 1339 | if (gadget->speed == USB_SPEED_HIGH && dev->hs_config == 0) { |
1340 | ERROR (dev, "no high speed config??\n"); | 1340 | ERROR (dev, "no high speed config??\n"); |
1341 | return -EINVAL; | 1341 | return -EINVAL; |
1342 | } | 1342 | } |
1343 | #endif /* HIGHSPEED */ | 1343 | #endif /* CONFIG_USB_GADGET_DUALSPEED */ |
1344 | 1344 | ||
1345 | INFO (dev, "connected\n"); | 1345 | INFO (dev, "connected\n"); |
1346 | event = next_event (dev, GADGETFS_CONNECT); | 1346 | event = next_event (dev, GADGETFS_CONNECT); |
@@ -1352,11 +1352,11 @@ gadgetfs_setup (struct usb_gadget *gadget, const struct usb_ctrlrequest *ctrl) | |||
1352 | /* ... down_trylock (&data->lock) ... */ | 1352 | /* ... down_trylock (&data->lock) ... */ |
1353 | if (data->state != STATE_EP_DEFER_ENABLE) | 1353 | if (data->state != STATE_EP_DEFER_ENABLE) |
1354 | continue; | 1354 | continue; |
1355 | #ifdef HIGHSPEED | 1355 | #ifdef CONFIG_USB_GADGET_DUALSPEED |
1356 | if (gadget->speed == USB_SPEED_HIGH) | 1356 | if (gadget->speed == USB_SPEED_HIGH) |
1357 | value = usb_ep_enable (ep, &data->hs_desc); | 1357 | value = usb_ep_enable (ep, &data->hs_desc); |
1358 | else | 1358 | else |
1359 | #endif /* HIGHSPEED */ | 1359 | #endif /* CONFIG_USB_GADGET_DUALSPEED */ |
1360 | value = usb_ep_enable (ep, &data->desc); | 1360 | value = usb_ep_enable (ep, &data->desc); |
1361 | if (value) { | 1361 | if (value) { |
1362 | ERROR (dev, "deferred %s enable --> %d\n", | 1362 | ERROR (dev, "deferred %s enable --> %d\n", |
@@ -1391,7 +1391,7 @@ gadgetfs_setup (struct usb_gadget *gadget, const struct usb_ctrlrequest *ctrl) | |||
1391 | value = min (w_length, (u16) sizeof *dev->dev); | 1391 | value = min (w_length, (u16) sizeof *dev->dev); |
1392 | req->buf = dev->dev; | 1392 | req->buf = dev->dev; |
1393 | break; | 1393 | break; |
1394 | #ifdef HIGHSPEED | 1394 | #ifdef CONFIG_USB_GADGET_DUALSPEED |
1395 | case USB_DT_DEVICE_QUALIFIER: | 1395 | case USB_DT_DEVICE_QUALIFIER: |
1396 | if (!dev->hs_config) | 1396 | if (!dev->hs_config) |
1397 | break; | 1397 | break; |
@@ -1428,7 +1428,7 @@ gadgetfs_setup (struct usb_gadget *gadget, const struct usb_ctrlrequest *ctrl) | |||
1428 | // user mode expected to disable endpoints | 1428 | // user mode expected to disable endpoints |
1429 | } else { | 1429 | } else { |
1430 | u8 config, power; | 1430 | u8 config, power; |
1431 | #ifdef HIGHSPEED | 1431 | #ifdef CONFIG_USB_GADGET_DUALSPEED |
1432 | if (gadget->speed == USB_SPEED_HIGH) { | 1432 | if (gadget->speed == USB_SPEED_HIGH) { |
1433 | config = dev->hs_config->bConfigurationValue; | 1433 | config = dev->hs_config->bConfigurationValue; |
1434 | power = dev->hs_config->bMaxPower; | 1434 | power = dev->hs_config->bMaxPower; |
@@ -1614,6 +1614,7 @@ static int activate_ep_files (struct dev_data *dev) | |||
1614 | data, &ep_config_operations, | 1614 | data, &ep_config_operations, |
1615 | &data->dentry); | 1615 | &data->dentry); |
1616 | if (!data->inode) { | 1616 | if (!data->inode) { |
1617 | usb_ep_free_request(ep, data->req); | ||
1617 | kfree (data); | 1618 | kfree (data); |
1618 | goto enomem; | 1619 | goto enomem; |
1619 | } | 1620 | } |
@@ -1728,7 +1729,7 @@ gadgetfs_suspend (struct usb_gadget *gadget) | |||
1728 | } | 1729 | } |
1729 | 1730 | ||
1730 | static struct usb_gadget_driver gadgetfs_driver = { | 1731 | static struct usb_gadget_driver gadgetfs_driver = { |
1731 | #ifdef HIGHSPEED | 1732 | #ifdef CONFIG_USB_GADGET_DUALSPEED |
1732 | .speed = USB_SPEED_HIGH, | 1733 | .speed = USB_SPEED_HIGH, |
1733 | #else | 1734 | #else |
1734 | .speed = USB_SPEED_FULL, | 1735 | .speed = USB_SPEED_FULL, |
diff --git a/drivers/usb/gadget/net2280.c b/drivers/usb/gadget/net2280.c index fb73dc100535..0b9293493957 100644 --- a/drivers/usb/gadget/net2280.c +++ b/drivers/usb/gadget/net2280.c | |||
@@ -26,6 +26,8 @@ | |||
26 | * Copyright (C) 2003 David Brownell | 26 | * Copyright (C) 2003 David Brownell |
27 | * Copyright (C) 2003-2005 PLX Technology, Inc. | 27 | * Copyright (C) 2003-2005 PLX Technology, Inc. |
28 | * | 28 | * |
29 | * Modified Seth Levy 2005 PLX Technology, Inc. to provide compatibility with 2282 chip | ||
30 | * | ||
29 | * This program is free software; you can redistribute it and/or modify | 31 | * This program is free software; you can redistribute it and/or modify |
30 | * it under the terms of the GNU General Public License as published by | 32 | * it under the terms of the GNU General Public License as published by |
31 | * the Free Software Foundation; either version 2 of the License, or | 33 | * the Free Software Foundation; either version 2 of the License, or |
@@ -71,8 +73,8 @@ | |||
71 | #include <asm/unaligned.h> | 73 | #include <asm/unaligned.h> |
72 | 74 | ||
73 | 75 | ||
74 | #define DRIVER_DESC "PLX NET2280 USB Peripheral Controller" | 76 | #define DRIVER_DESC "PLX NET228x USB Peripheral Controller" |
75 | #define DRIVER_VERSION "2005 Feb 03" | 77 | #define DRIVER_VERSION "2005 Sept 27" |
76 | 78 | ||
77 | #define DMA_ADDR_INVALID (~(dma_addr_t)0) | 79 | #define DMA_ADDR_INVALID (~(dma_addr_t)0) |
78 | #define EP_DONTUSE 13 /* nonzero */ | 80 | #define EP_DONTUSE 13 /* nonzero */ |
@@ -118,7 +120,7 @@ module_param (fifo_mode, ushort, 0644); | |||
118 | /* enable_suspend -- When enabled, the driver will respond to | 120 | /* enable_suspend -- When enabled, the driver will respond to |
119 | * USB suspend requests by powering down the NET2280. Otherwise, | 121 | * USB suspend requests by powering down the NET2280. Otherwise, |
120 | * USB suspend requests will be ignored. This is acceptible for | 122 | * USB suspend requests will be ignored. This is acceptible for |
121 | * self-powered devices, and helps avoid some quirks. | 123 | * self-powered devices |
122 | */ | 124 | */ |
123 | static int enable_suspend = 0; | 125 | static int enable_suspend = 0; |
124 | 126 | ||
@@ -223,6 +225,11 @@ net2280_enable (struct usb_ep *_ep, const struct usb_endpoint_descriptor *desc) | |||
223 | ep->is_in = (tmp & USB_DIR_IN) != 0; | 225 | ep->is_in = (tmp & USB_DIR_IN) != 0; |
224 | if (!ep->is_in) | 226 | if (!ep->is_in) |
225 | writel ((1 << SET_NAK_OUT_PACKETS), &ep->regs->ep_rsp); | 227 | writel ((1 << SET_NAK_OUT_PACKETS), &ep->regs->ep_rsp); |
228 | else if (dev->pdev->device != 0x2280) { | ||
229 | /* Added for 2282, Don't use nak packets on an in endpoint, this was ignored on 2280 */ | ||
230 | writel ((1 << CLEAR_NAK_OUT_PACKETS) | ||
231 | | (1 << CLEAR_NAK_OUT_PACKETS_MODE), &ep->regs->ep_rsp); | ||
232 | } | ||
226 | 233 | ||
227 | writel (tmp, &ep->regs->ep_cfg); | 234 | writel (tmp, &ep->regs->ep_cfg); |
228 | 235 | ||
@@ -232,8 +239,9 @@ net2280_enable (struct usb_ep *_ep, const struct usb_endpoint_descriptor *desc) | |||
232 | writel (tmp, &dev->regs->pciirqenb0); | 239 | writel (tmp, &dev->regs->pciirqenb0); |
233 | 240 | ||
234 | tmp = (1 << DATA_PACKET_RECEIVED_INTERRUPT_ENABLE) | 241 | tmp = (1 << DATA_PACKET_RECEIVED_INTERRUPT_ENABLE) |
235 | | (1 << DATA_PACKET_TRANSMITTED_INTERRUPT_ENABLE) | 242 | | (1 << DATA_PACKET_TRANSMITTED_INTERRUPT_ENABLE); |
236 | | readl (&ep->regs->ep_irqenb); | 243 | if (dev->pdev->device == 0x2280) |
244 | tmp |= readl (&ep->regs->ep_irqenb); | ||
237 | writel (tmp, &ep->regs->ep_irqenb); | 245 | writel (tmp, &ep->regs->ep_irqenb); |
238 | } else { /* dma, per-request */ | 246 | } else { /* dma, per-request */ |
239 | tmp = (1 << (8 + ep->num)); /* completion */ | 247 | tmp = (1 << (8 + ep->num)); /* completion */ |
@@ -314,10 +322,18 @@ static void ep_reset (struct net2280_regs __iomem *regs, struct net2280_ep *ep) | |||
314 | /* init to our chosen defaults, notably so that we NAK OUT | 322 | /* init to our chosen defaults, notably so that we NAK OUT |
315 | * packets until the driver queues a read (+note erratum 0112) | 323 | * packets until the driver queues a read (+note erratum 0112) |
316 | */ | 324 | */ |
317 | tmp = (1 << SET_NAK_OUT_PACKETS_MODE) | 325 | if (!ep->is_in || ep->dev->pdev->device == 0x2280) { |
326 | tmp = (1 << SET_NAK_OUT_PACKETS_MODE) | ||
318 | | (1 << SET_NAK_OUT_PACKETS) | 327 | | (1 << SET_NAK_OUT_PACKETS) |
319 | | (1 << CLEAR_EP_HIDE_STATUS_PHASE) | 328 | | (1 << CLEAR_EP_HIDE_STATUS_PHASE) |
320 | | (1 << CLEAR_INTERRUPT_MODE); | 329 | | (1 << CLEAR_INTERRUPT_MODE); |
330 | } else { | ||
331 | /* added for 2282 */ | ||
332 | tmp = (1 << CLEAR_NAK_OUT_PACKETS_MODE) | ||
333 | | (1 << CLEAR_NAK_OUT_PACKETS) | ||
334 | | (1 << CLEAR_EP_HIDE_STATUS_PHASE) | ||
335 | | (1 << CLEAR_INTERRUPT_MODE); | ||
336 | } | ||
321 | 337 | ||
322 | if (ep->num != 0) { | 338 | if (ep->num != 0) { |
323 | tmp |= (1 << CLEAR_ENDPOINT_TOGGLE) | 339 | tmp |= (1 << CLEAR_ENDPOINT_TOGGLE) |
@@ -326,14 +342,18 @@ static void ep_reset (struct net2280_regs __iomem *regs, struct net2280_ep *ep) | |||
326 | writel (tmp, &ep->regs->ep_rsp); | 342 | writel (tmp, &ep->regs->ep_rsp); |
327 | 343 | ||
328 | /* scrub most status bits, and flush any fifo state */ | 344 | /* scrub most status bits, and flush any fifo state */ |
329 | writel ( (1 << TIMEOUT) | 345 | if (ep->dev->pdev->device == 0x2280) |
346 | tmp = (1 << FIFO_OVERFLOW) | ||
347 | | (1 << FIFO_UNDERFLOW); | ||
348 | else | ||
349 | tmp = 0; | ||
350 | |||
351 | writel (tmp | (1 << TIMEOUT) | ||
330 | | (1 << USB_STALL_SENT) | 352 | | (1 << USB_STALL_SENT) |
331 | | (1 << USB_IN_NAK_SENT) | 353 | | (1 << USB_IN_NAK_SENT) |
332 | | (1 << USB_IN_ACK_RCVD) | 354 | | (1 << USB_IN_ACK_RCVD) |
333 | | (1 << USB_OUT_PING_NAK_SENT) | 355 | | (1 << USB_OUT_PING_NAK_SENT) |
334 | | (1 << USB_OUT_ACK_SENT) | 356 | | (1 << USB_OUT_ACK_SENT) |
335 | | (1 << FIFO_OVERFLOW) | ||
336 | | (1 << FIFO_UNDERFLOW) | ||
337 | | (1 << FIFO_FLUSH) | 357 | | (1 << FIFO_FLUSH) |
338 | | (1 << SHORT_PACKET_OUT_DONE_INTERRUPT) | 358 | | (1 << SHORT_PACKET_OUT_DONE_INTERRUPT) |
339 | | (1 << SHORT_PACKET_TRANSFERRED_INTERRUPT) | 359 | | (1 << SHORT_PACKET_TRANSFERRED_INTERRUPT) |
@@ -718,7 +738,7 @@ fill_dma_desc (struct net2280_ep *ep, struct net2280_request *req, int valid) | |||
718 | */ | 738 | */ |
719 | if (ep->is_in) | 739 | if (ep->is_in) |
720 | dmacount |= (1 << DMA_DIRECTION); | 740 | dmacount |= (1 << DMA_DIRECTION); |
721 | else if ((dmacount % ep->ep.maxpacket) != 0) | 741 | if ((!ep->is_in && (dmacount % ep->ep.maxpacket) != 0) || ep->dev->pdev->device != 0x2280) |
722 | dmacount |= (1 << END_OF_CHAIN); | 742 | dmacount |= (1 << END_OF_CHAIN); |
723 | 743 | ||
724 | req->valid = valid; | 744 | req->valid = valid; |
@@ -760,9 +780,12 @@ static inline void stop_dma (struct net2280_dma_regs __iomem *dma) | |||
760 | static void start_queue (struct net2280_ep *ep, u32 dmactl, u32 td_dma) | 780 | static void start_queue (struct net2280_ep *ep, u32 dmactl, u32 td_dma) |
761 | { | 781 | { |
762 | struct net2280_dma_regs __iomem *dma = ep->dma; | 782 | struct net2280_dma_regs __iomem *dma = ep->dma; |
783 | unsigned int tmp = (1 << VALID_BIT) | (ep->is_in << DMA_DIRECTION); | ||
784 | |||
785 | if (ep->dev->pdev->device != 0x2280) | ||
786 | tmp |= (1 << END_OF_CHAIN); | ||
763 | 787 | ||
764 | writel ((1 << VALID_BIT) | (ep->is_in << DMA_DIRECTION), | 788 | writel (tmp, &dma->dmacount); |
765 | &dma->dmacount); | ||
766 | writel (readl (&dma->dmastat), &dma->dmastat); | 789 | writel (readl (&dma->dmastat), &dma->dmastat); |
767 | 790 | ||
768 | writel (td_dma, &dma->dmadesc); | 791 | writel (td_dma, &dma->dmadesc); |
@@ -2110,7 +2133,11 @@ static void handle_ep_small (struct net2280_ep *ep) | |||
2110 | VDEBUG (ep->dev, "%s ack ep_stat %08x, req %p\n", | 2133 | VDEBUG (ep->dev, "%s ack ep_stat %08x, req %p\n", |
2111 | ep->ep.name, t, req ? &req->req : 0); | 2134 | ep->ep.name, t, req ? &req->req : 0); |
2112 | #endif | 2135 | #endif |
2113 | writel (t & ~(1 << NAK_OUT_PACKETS), &ep->regs->ep_stat); | 2136 | if (!ep->is_in || ep->dev->pdev->device == 0x2280) |
2137 | writel (t & ~(1 << NAK_OUT_PACKETS), &ep->regs->ep_stat); | ||
2138 | else | ||
2139 | /* Added for 2282 */ | ||
2140 | writel (t, &ep->regs->ep_stat); | ||
2114 | 2141 | ||
2115 | /* for ep0, monitor token irqs to catch data stage length errors | 2142 | /* for ep0, monitor token irqs to catch data stage length errors |
2116 | * and to synchronize on status. | 2143 | * and to synchronize on status. |
@@ -2139,7 +2166,7 @@ static void handle_ep_small (struct net2280_ep *ep) | |||
2139 | ep->stopped = 1; | 2166 | ep->stopped = 1; |
2140 | set_halt (ep); | 2167 | set_halt (ep); |
2141 | mode = 2; | 2168 | mode = 2; |
2142 | } else if (!req && ep->stopped) | 2169 | } else if (!req && !ep->stopped) |
2143 | write_fifo (ep, NULL); | 2170 | write_fifo (ep, NULL); |
2144 | } | 2171 | } |
2145 | } else { | 2172 | } else { |
@@ -2214,7 +2241,8 @@ static void handle_ep_small (struct net2280_ep *ep) | |||
2214 | if (likely (req)) { | 2241 | if (likely (req)) { |
2215 | req->td->dmacount = 0; | 2242 | req->td->dmacount = 0; |
2216 | t = readl (&ep->regs->ep_avail); | 2243 | t = readl (&ep->regs->ep_avail); |
2217 | dma_done (ep, req, count, t); | 2244 | dma_done (ep, req, count, |
2245 | (ep->out_overflow || t) ? -EOVERFLOW : 0); | ||
2218 | } | 2246 | } |
2219 | 2247 | ||
2220 | /* also flush to prevent erratum 0106 trouble */ | 2248 | /* also flush to prevent erratum 0106 trouble */ |
@@ -2252,9 +2280,7 @@ static void handle_ep_small (struct net2280_ep *ep) | |||
2252 | /* if we wrote it all, we're usually done */ | 2280 | /* if we wrote it all, we're usually done */ |
2253 | if (req->req.actual == req->req.length) { | 2281 | if (req->req.actual == req->req.length) { |
2254 | if (ep->num == 0) { | 2282 | if (ep->num == 0) { |
2255 | /* wait for control status */ | 2283 | /* send zlps until the status stage */ |
2256 | if (mode != 2) | ||
2257 | req = NULL; | ||
2258 | } else if (!req->req.zero || len != ep->ep.maxpacket) | 2284 | } else if (!req->req.zero || len != ep->ep.maxpacket) |
2259 | mode = 2; | 2285 | mode = 2; |
2260 | } | 2286 | } |
@@ -2337,7 +2363,7 @@ static void handle_stat0_irqs (struct net2280 *dev, u32 stat) | |||
2337 | u32 raw [2]; | 2363 | u32 raw [2]; |
2338 | struct usb_ctrlrequest r; | 2364 | struct usb_ctrlrequest r; |
2339 | } u; | 2365 | } u; |
2340 | int tmp = 0; | 2366 | int tmp; |
2341 | struct net2280_request *req; | 2367 | struct net2280_request *req; |
2342 | 2368 | ||
2343 | if (dev->gadget.speed == USB_SPEED_UNKNOWN) { | 2369 | if (dev->gadget.speed == USB_SPEED_UNKNOWN) { |
@@ -2364,14 +2390,19 @@ static void handle_stat0_irqs (struct net2280 *dev, u32 stat) | |||
2364 | } | 2390 | } |
2365 | ep->stopped = 0; | 2391 | ep->stopped = 0; |
2366 | dev->protocol_stall = 0; | 2392 | dev->protocol_stall = 0; |
2367 | writel ( (1 << TIMEOUT) | 2393 | |
2394 | if (ep->dev->pdev->device == 0x2280) | ||
2395 | tmp = (1 << FIFO_OVERFLOW) | ||
2396 | | (1 << FIFO_UNDERFLOW); | ||
2397 | else | ||
2398 | tmp = 0; | ||
2399 | |||
2400 | writel (tmp | (1 << TIMEOUT) | ||
2368 | | (1 << USB_STALL_SENT) | 2401 | | (1 << USB_STALL_SENT) |
2369 | | (1 << USB_IN_NAK_SENT) | 2402 | | (1 << USB_IN_NAK_SENT) |
2370 | | (1 << USB_IN_ACK_RCVD) | 2403 | | (1 << USB_IN_ACK_RCVD) |
2371 | | (1 << USB_OUT_PING_NAK_SENT) | 2404 | | (1 << USB_OUT_PING_NAK_SENT) |
2372 | | (1 << USB_OUT_ACK_SENT) | 2405 | | (1 << USB_OUT_ACK_SENT) |
2373 | | (1 << FIFO_OVERFLOW) | ||
2374 | | (1 << FIFO_UNDERFLOW) | ||
2375 | | (1 << SHORT_PACKET_OUT_DONE_INTERRUPT) | 2406 | | (1 << SHORT_PACKET_OUT_DONE_INTERRUPT) |
2376 | | (1 << SHORT_PACKET_TRANSFERRED_INTERRUPT) | 2407 | | (1 << SHORT_PACKET_TRANSFERRED_INTERRUPT) |
2377 | | (1 << DATA_PACKET_RECEIVED_INTERRUPT) | 2408 | | (1 << DATA_PACKET_RECEIVED_INTERRUPT) |
@@ -2385,6 +2416,8 @@ static void handle_stat0_irqs (struct net2280 *dev, u32 stat) | |||
2385 | cpu_to_le32s (&u.raw [0]); | 2416 | cpu_to_le32s (&u.raw [0]); |
2386 | cpu_to_le32s (&u.raw [1]); | 2417 | cpu_to_le32s (&u.raw [1]); |
2387 | 2418 | ||
2419 | tmp = 0; | ||
2420 | |||
2388 | #define w_value le16_to_cpup (&u.r.wValue) | 2421 | #define w_value le16_to_cpup (&u.r.wValue) |
2389 | #define w_index le16_to_cpup (&u.r.wIndex) | 2422 | #define w_index le16_to_cpup (&u.r.wIndex) |
2390 | #define w_length le16_to_cpup (&u.r.wLength) | 2423 | #define w_length le16_to_cpup (&u.r.wLength) |
@@ -2594,10 +2627,17 @@ static void handle_stat1_irqs (struct net2280 *dev, u32 stat) | |||
2594 | writel (stat, &dev->regs->irqstat1); | 2627 | writel (stat, &dev->regs->irqstat1); |
2595 | 2628 | ||
2596 | /* some status we can just ignore */ | 2629 | /* some status we can just ignore */ |
2597 | stat &= ~((1 << CONTROL_STATUS_INTERRUPT) | 2630 | if (dev->pdev->device == 0x2280) |
2598 | | (1 << SUSPEND_REQUEST_INTERRUPT) | 2631 | stat &= ~((1 << CONTROL_STATUS_INTERRUPT) |
2599 | | (1 << RESUME_INTERRUPT) | 2632 | | (1 << SUSPEND_REQUEST_INTERRUPT) |
2600 | | (1 << SOF_INTERRUPT)); | 2633 | | (1 << RESUME_INTERRUPT) |
2634 | | (1 << SOF_INTERRUPT)); | ||
2635 | else | ||
2636 | stat &= ~((1 << CONTROL_STATUS_INTERRUPT) | ||
2637 | | (1 << RESUME_INTERRUPT) | ||
2638 | | (1 << SOF_DOWN_INTERRUPT) | ||
2639 | | (1 << SOF_INTERRUPT)); | ||
2640 | |||
2601 | if (!stat) | 2641 | if (!stat) |
2602 | return; | 2642 | return; |
2603 | // DEBUG (dev, "irqstat1 %08x\n", stat); | 2643 | // DEBUG (dev, "irqstat1 %08x\n", stat); |
@@ -2702,6 +2742,10 @@ static irqreturn_t net2280_irq (int irq, void *_dev, struct pt_regs * r) | |||
2702 | { | 2742 | { |
2703 | struct net2280 *dev = _dev; | 2743 | struct net2280 *dev = _dev; |
2704 | 2744 | ||
2745 | /* shared interrupt, not ours */ | ||
2746 | if (!(readl(&dev->regs->irqstat0) & (1 << INTA_ASSERTED))) | ||
2747 | return IRQ_NONE; | ||
2748 | |||
2705 | spin_lock (&dev->lock); | 2749 | spin_lock (&dev->lock); |
2706 | 2750 | ||
2707 | /* handle disconnect, dma, and more */ | 2751 | /* handle disconnect, dma, and more */ |
@@ -2789,13 +2833,13 @@ static int net2280_probe (struct pci_dev *pdev, const struct pci_device_id *id) | |||
2789 | } | 2833 | } |
2790 | 2834 | ||
2791 | /* alloc, and start init */ | 2835 | /* alloc, and start init */ |
2792 | dev = kmalloc (sizeof *dev, SLAB_KERNEL); | 2836 | dev = kzalloc (sizeof *dev, SLAB_KERNEL); |
2793 | if (dev == NULL){ | 2837 | if (dev == NULL){ |
2794 | retval = -ENOMEM; | 2838 | retval = -ENOMEM; |
2795 | goto done; | 2839 | goto done; |
2796 | } | 2840 | } |
2797 | 2841 | ||
2798 | memset (dev, 0, sizeof *dev); | 2842 | pci_set_drvdata (pdev, dev); |
2799 | spin_lock_init (&dev->lock); | 2843 | spin_lock_init (&dev->lock); |
2800 | dev->pdev = pdev; | 2844 | dev->pdev = pdev; |
2801 | dev->gadget.ops = &net2280_ops; | 2845 | dev->gadget.ops = &net2280_ops; |
@@ -2908,7 +2952,6 @@ static int net2280_probe (struct pci_dev *pdev, const struct pci_device_id *id) | |||
2908 | dev->chiprev = get_idx_reg (dev->regs, REG_CHIPREV) & 0xffff; | 2952 | dev->chiprev = get_idx_reg (dev->regs, REG_CHIPREV) & 0xffff; |
2909 | 2953 | ||
2910 | /* done */ | 2954 | /* done */ |
2911 | pci_set_drvdata (pdev, dev); | ||
2912 | INFO (dev, "%s\n", driver_desc); | 2955 | INFO (dev, "%s\n", driver_desc); |
2913 | INFO (dev, "irq %s, pci mem %p, chip rev %04x\n", | 2956 | INFO (dev, "irq %s, pci mem %p, chip rev %04x\n", |
2914 | bufp, base, dev->chiprev); | 2957 | bufp, base, dev->chiprev); |
@@ -2939,6 +2982,13 @@ static struct pci_device_id pci_ids [] = { { | |||
2939 | .device = 0x2280, | 2982 | .device = 0x2280, |
2940 | .subvendor = PCI_ANY_ID, | 2983 | .subvendor = PCI_ANY_ID, |
2941 | .subdevice = PCI_ANY_ID, | 2984 | .subdevice = PCI_ANY_ID, |
2985 | }, { | ||
2986 | .class = ((PCI_CLASS_SERIAL_USB << 8) | 0xfe), | ||
2987 | .class_mask = ~0, | ||
2988 | .vendor = 0x17cc, | ||
2989 | .device = 0x2282, | ||
2990 | .subvendor = PCI_ANY_ID, | ||
2991 | .subdevice = PCI_ANY_ID, | ||
2942 | 2992 | ||
2943 | }, { /* end: all zeroes */ } | 2993 | }, { /* end: all zeroes */ } |
2944 | }; | 2994 | }; |
diff --git a/drivers/usb/gadget/net2280.h b/drivers/usb/gadget/net2280.h index fff4509cf340..957d6df34015 100644 --- a/drivers/usb/gadget/net2280.h +++ b/drivers/usb/gadget/net2280.h | |||
@@ -22,420 +22,7 @@ | |||
22 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | 22 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
23 | */ | 23 | */ |
24 | 24 | ||
25 | /*-------------------------------------------------------------------------*/ | 25 | #include <linux/usb/net2280.h> |
26 | |||
27 | /* NET2280 MEMORY MAPPED REGISTERS | ||
28 | * | ||
29 | * The register layout came from the chip documentation, and the bit | ||
30 | * number definitions were extracted from chip specification. | ||
31 | * | ||
32 | * Use the shift operator ('<<') to build bit masks, with readl/writel | ||
33 | * to access the registers through PCI. | ||
34 | */ | ||
35 | |||
36 | /* main registers, BAR0 + 0x0000 */ | ||
37 | struct net2280_regs { | ||
38 | // offset 0x0000 | ||
39 | u32 devinit; | ||
40 | #define LOCAL_CLOCK_FREQUENCY 8 | ||
41 | #define FORCE_PCI_RESET 7 | ||
42 | #define PCI_ID 6 | ||
43 | #define PCI_ENABLE 5 | ||
44 | #define FIFO_SOFT_RESET 4 | ||
45 | #define CFG_SOFT_RESET 3 | ||
46 | #define PCI_SOFT_RESET 2 | ||
47 | #define USB_SOFT_RESET 1 | ||
48 | #define M8051_RESET 0 | ||
49 | u32 eectl; | ||
50 | #define EEPROM_ADDRESS_WIDTH 23 | ||
51 | #define EEPROM_CHIP_SELECT_ACTIVE 22 | ||
52 | #define EEPROM_PRESENT 21 | ||
53 | #define EEPROM_VALID 20 | ||
54 | #define EEPROM_BUSY 19 | ||
55 | #define EEPROM_CHIP_SELECT_ENABLE 18 | ||
56 | #define EEPROM_BYTE_READ_START 17 | ||
57 | #define EEPROM_BYTE_WRITE_START 16 | ||
58 | #define EEPROM_READ_DATA 8 | ||
59 | #define EEPROM_WRITE_DATA 0 | ||
60 | u32 eeclkfreq; | ||
61 | u32 _unused0; | ||
62 | // offset 0x0010 | ||
63 | |||
64 | u32 pciirqenb0; /* interrupt PCI master ... */ | ||
65 | #define SETUP_PACKET_INTERRUPT_ENABLE 7 | ||
66 | #define ENDPOINT_F_INTERRUPT_ENABLE 6 | ||
67 | #define ENDPOINT_E_INTERRUPT_ENABLE 5 | ||
68 | #define ENDPOINT_D_INTERRUPT_ENABLE 4 | ||
69 | #define ENDPOINT_C_INTERRUPT_ENABLE 3 | ||
70 | #define ENDPOINT_B_INTERRUPT_ENABLE 2 | ||
71 | #define ENDPOINT_A_INTERRUPT_ENABLE 1 | ||
72 | #define ENDPOINT_0_INTERRUPT_ENABLE 0 | ||
73 | u32 pciirqenb1; | ||
74 | #define PCI_INTERRUPT_ENABLE 31 | ||
75 | #define POWER_STATE_CHANGE_INTERRUPT_ENABLE 27 | ||
76 | #define PCI_ARBITER_TIMEOUT_INTERRUPT_ENABLE 26 | ||
77 | #define PCI_PARITY_ERROR_INTERRUPT_ENABLE 25 | ||
78 | #define PCI_MASTER_ABORT_RECEIVED_INTERRUPT_ENABLE 20 | ||
79 | #define PCI_TARGET_ABORT_RECEIVED_INTERRUPT_ENABLE 19 | ||
80 | #define PCI_TARGET_ABORT_ASSERTED_INTERRUPT_ENABLE 18 | ||
81 | #define PCI_RETRY_ABORT_INTERRUPT_ENABLE 17 | ||
82 | #define PCI_MASTER_CYCLE_DONE_INTERRUPT_ENABLE 16 | ||
83 | #define GPIO_INTERRUPT_ENABLE 13 | ||
84 | #define DMA_D_INTERRUPT_ENABLE 12 | ||
85 | #define DMA_C_INTERRUPT_ENABLE 11 | ||
86 | #define DMA_B_INTERRUPT_ENABLE 10 | ||
87 | #define DMA_A_INTERRUPT_ENABLE 9 | ||
88 | #define EEPROM_DONE_INTERRUPT_ENABLE 8 | ||
89 | #define VBUS_INTERRUPT_ENABLE 7 | ||
90 | #define CONTROL_STATUS_INTERRUPT_ENABLE 6 | ||
91 | #define ROOT_PORT_RESET_INTERRUPT_ENABLE 4 | ||
92 | #define SUSPEND_REQUEST_INTERRUPT_ENABLE 3 | ||
93 | #define SUSPEND_REQUEST_CHANGE_INTERRUPT_ENABLE 2 | ||
94 | #define RESUME_INTERRUPT_ENABLE 1 | ||
95 | #define SOF_INTERRUPT_ENABLE 0 | ||
96 | u32 cpu_irqenb0; /* ... or onboard 8051 */ | ||
97 | #define SETUP_PACKET_INTERRUPT_ENABLE 7 | ||
98 | #define ENDPOINT_F_INTERRUPT_ENABLE 6 | ||
99 | #define ENDPOINT_E_INTERRUPT_ENABLE 5 | ||
100 | #define ENDPOINT_D_INTERRUPT_ENABLE 4 | ||
101 | #define ENDPOINT_C_INTERRUPT_ENABLE 3 | ||
102 | #define ENDPOINT_B_INTERRUPT_ENABLE 2 | ||
103 | #define ENDPOINT_A_INTERRUPT_ENABLE 1 | ||
104 | #define ENDPOINT_0_INTERRUPT_ENABLE 0 | ||
105 | u32 cpu_irqenb1; | ||
106 | #define CPU_INTERRUPT_ENABLE 31 | ||
107 | #define POWER_STATE_CHANGE_INTERRUPT_ENABLE 27 | ||
108 | #define PCI_ARBITER_TIMEOUT_INTERRUPT_ENABLE 26 | ||
109 | #define PCI_PARITY_ERROR_INTERRUPT_ENABLE 25 | ||
110 | #define PCI_INTA_INTERRUPT_ENABLE 24 | ||
111 | #define PCI_PME_INTERRUPT_ENABLE 23 | ||
112 | #define PCI_SERR_INTERRUPT_ENABLE 22 | ||
113 | #define PCI_PERR_INTERRUPT_ENABLE 21 | ||
114 | #define PCI_MASTER_ABORT_RECEIVED_INTERRUPT_ENABLE 20 | ||
115 | #define PCI_TARGET_ABORT_RECEIVED_INTERRUPT_ENABLE 19 | ||
116 | #define PCI_RETRY_ABORT_INTERRUPT_ENABLE 17 | ||
117 | #define PCI_MASTER_CYCLE_DONE_INTERRUPT_ENABLE 16 | ||
118 | #define GPIO_INTERRUPT_ENABLE 13 | ||
119 | #define DMA_D_INTERRUPT_ENABLE 12 | ||
120 | #define DMA_C_INTERRUPT_ENABLE 11 | ||
121 | #define DMA_B_INTERRUPT_ENABLE 10 | ||
122 | #define DMA_A_INTERRUPT_ENABLE 9 | ||
123 | #define EEPROM_DONE_INTERRUPT_ENABLE 8 | ||
124 | #define VBUS_INTERRUPT_ENABLE 7 | ||
125 | #define CONTROL_STATUS_INTERRUPT_ENABLE 6 | ||
126 | #define ROOT_PORT_RESET_INTERRUPT_ENABLE 4 | ||
127 | #define SUSPEND_REQUEST_INTERRUPT_ENABLE 3 | ||
128 | #define SUSPEND_REQUEST_CHANGE_INTERRUPT_ENABLE 2 | ||
129 | #define RESUME_INTERRUPT_ENABLE 1 | ||
130 | #define SOF_INTERRUPT_ENABLE 0 | ||
131 | |||
132 | // offset 0x0020 | ||
133 | u32 _unused1; | ||
134 | u32 usbirqenb1; | ||
135 | #define USB_INTERRUPT_ENABLE 31 | ||
136 | #define POWER_STATE_CHANGE_INTERRUPT_ENABLE 27 | ||
137 | #define PCI_ARBITER_TIMEOUT_INTERRUPT_ENABLE 26 | ||
138 | #define PCI_PARITY_ERROR_INTERRUPT_ENABLE 25 | ||
139 | #define PCI_INTA_INTERRUPT_ENABLE 24 | ||
140 | #define PCI_PME_INTERRUPT_ENABLE 23 | ||
141 | #define PCI_SERR_INTERRUPT_ENABLE 22 | ||
142 | #define PCI_PERR_INTERRUPT_ENABLE 21 | ||
143 | #define PCI_MASTER_ABORT_RECEIVED_INTERRUPT_ENABLE 20 | ||
144 | #define PCI_TARGET_ABORT_RECEIVED_INTERRUPT_ENABLE 19 | ||
145 | #define PCI_RETRY_ABORT_INTERRUPT_ENABLE 17 | ||
146 | #define PCI_MASTER_CYCLE_DONE_INTERRUPT_ENABLE 16 | ||
147 | #define GPIO_INTERRUPT_ENABLE 13 | ||
148 | #define DMA_D_INTERRUPT_ENABLE 12 | ||
149 | #define DMA_C_INTERRUPT_ENABLE 11 | ||
150 | #define DMA_B_INTERRUPT_ENABLE 10 | ||
151 | #define DMA_A_INTERRUPT_ENABLE 9 | ||
152 | #define EEPROM_DONE_INTERRUPT_ENABLE 8 | ||
153 | #define VBUS_INTERRUPT_ENABLE 7 | ||
154 | #define CONTROL_STATUS_INTERRUPT_ENABLE 6 | ||
155 | #define ROOT_PORT_RESET_INTERRUPT_ENABLE 4 | ||
156 | #define SUSPEND_REQUEST_INTERRUPT_ENABLE 3 | ||
157 | #define SUSPEND_REQUEST_CHANGE_INTERRUPT_ENABLE 2 | ||
158 | #define RESUME_INTERRUPT_ENABLE 1 | ||
159 | #define SOF_INTERRUPT_ENABLE 0 | ||
160 | u32 irqstat0; | ||
161 | #define INTA_ASSERTED 12 | ||
162 | #define SETUP_PACKET_INTERRUPT 7 | ||
163 | #define ENDPOINT_F_INTERRUPT 6 | ||
164 | #define ENDPOINT_E_INTERRUPT 5 | ||
165 | #define ENDPOINT_D_INTERRUPT 4 | ||
166 | #define ENDPOINT_C_INTERRUPT 3 | ||
167 | #define ENDPOINT_B_INTERRUPT 2 | ||
168 | #define ENDPOINT_A_INTERRUPT 1 | ||
169 | #define ENDPOINT_0_INTERRUPT 0 | ||
170 | u32 irqstat1; | ||
171 | #define POWER_STATE_CHANGE_INTERRUPT 27 | ||
172 | #define PCI_ARBITER_TIMEOUT_INTERRUPT 26 | ||
173 | #define PCI_PARITY_ERROR_INTERRUPT 25 | ||
174 | #define PCI_INTA_INTERRUPT 24 | ||
175 | #define PCI_PME_INTERRUPT 23 | ||
176 | #define PCI_SERR_INTERRUPT 22 | ||
177 | #define PCI_PERR_INTERRUPT 21 | ||
178 | #define PCI_MASTER_ABORT_RECEIVED_INTERRUPT 20 | ||
179 | #define PCI_TARGET_ABORT_RECEIVED_INTERRUPT 19 | ||
180 | #define PCI_RETRY_ABORT_INTERRUPT 17 | ||
181 | #define PCI_MASTER_CYCLE_DONE_INTERRUPT 16 | ||
182 | #define GPIO_INTERRUPT 13 | ||
183 | #define DMA_D_INTERRUPT 12 | ||
184 | #define DMA_C_INTERRUPT 11 | ||
185 | #define DMA_B_INTERRUPT 10 | ||
186 | #define DMA_A_INTERRUPT 9 | ||
187 | #define EEPROM_DONE_INTERRUPT 8 | ||
188 | #define VBUS_INTERRUPT 7 | ||
189 | #define CONTROL_STATUS_INTERRUPT 6 | ||
190 | #define ROOT_PORT_RESET_INTERRUPT 4 | ||
191 | #define SUSPEND_REQUEST_INTERRUPT 3 | ||
192 | #define SUSPEND_REQUEST_CHANGE_INTERRUPT 2 | ||
193 | #define RESUME_INTERRUPT 1 | ||
194 | #define SOF_INTERRUPT 0 | ||
195 | // offset 0x0030 | ||
196 | u32 idxaddr; | ||
197 | u32 idxdata; | ||
198 | u32 fifoctl; | ||
199 | #define PCI_BASE2_RANGE 16 | ||
200 | #define IGNORE_FIFO_AVAILABILITY 3 | ||
201 | #define PCI_BASE2_SELECT 2 | ||
202 | #define FIFO_CONFIGURATION_SELECT 0 | ||
203 | u32 _unused2; | ||
204 | // offset 0x0040 | ||
205 | u32 memaddr; | ||
206 | #define START 28 | ||
207 | #define DIRECTION 27 | ||
208 | #define FIFO_DIAGNOSTIC_SELECT 24 | ||
209 | #define MEMORY_ADDRESS 0 | ||
210 | u32 memdata0; | ||
211 | u32 memdata1; | ||
212 | u32 _unused3; | ||
213 | // offset 0x0050 | ||
214 | u32 gpioctl; | ||
215 | #define GPIO3_LED_SELECT 12 | ||
216 | #define GPIO3_INTERRUPT_ENABLE 11 | ||
217 | #define GPIO2_INTERRUPT_ENABLE 10 | ||
218 | #define GPIO1_INTERRUPT_ENABLE 9 | ||
219 | #define GPIO0_INTERRUPT_ENABLE 8 | ||
220 | #define GPIO3_OUTPUT_ENABLE 7 | ||
221 | #define GPIO2_OUTPUT_ENABLE 6 | ||
222 | #define GPIO1_OUTPUT_ENABLE 5 | ||
223 | #define GPIO0_OUTPUT_ENABLE 4 | ||
224 | #define GPIO3_DATA 3 | ||
225 | #define GPIO2_DATA 2 | ||
226 | #define GPIO1_DATA 1 | ||
227 | #define GPIO0_DATA 0 | ||
228 | u32 gpiostat; | ||
229 | #define GPIO3_INTERRUPT 3 | ||
230 | #define GPIO2_INTERRUPT 2 | ||
231 | #define GPIO1_INTERRUPT 1 | ||
232 | #define GPIO0_INTERRUPT 0 | ||
233 | } __attribute__ ((packed)); | ||
234 | |||
235 | /* usb control, BAR0 + 0x0080 */ | ||
236 | struct net2280_usb_regs { | ||
237 | // offset 0x0080 | ||
238 | u32 stdrsp; | ||
239 | #define STALL_UNSUPPORTED_REQUESTS 31 | ||
240 | #define SET_TEST_MODE 16 | ||
241 | #define GET_OTHER_SPEED_CONFIGURATION 15 | ||
242 | #define GET_DEVICE_QUALIFIER 14 | ||
243 | #define SET_ADDRESS 13 | ||
244 | #define ENDPOINT_SET_CLEAR_HALT 12 | ||
245 | #define DEVICE_SET_CLEAR_DEVICE_REMOTE_WAKEUP 11 | ||
246 | #define GET_STRING_DESCRIPTOR_2 10 | ||
247 | #define GET_STRING_DESCRIPTOR_1 9 | ||
248 | #define GET_STRING_DESCRIPTOR_0 8 | ||
249 | #define GET_SET_INTERFACE 6 | ||
250 | #define GET_SET_CONFIGURATION 5 | ||
251 | #define GET_CONFIGURATION_DESCRIPTOR 4 | ||
252 | #define GET_DEVICE_DESCRIPTOR 3 | ||
253 | #define GET_ENDPOINT_STATUS 2 | ||
254 | #define GET_INTERFACE_STATUS 1 | ||
255 | #define GET_DEVICE_STATUS 0 | ||
256 | u32 prodvendid; | ||
257 | #define PRODUCT_ID 16 | ||
258 | #define VENDOR_ID 0 | ||
259 | u32 relnum; | ||
260 | u32 usbctl; | ||
261 | #define SERIAL_NUMBER_INDEX 16 | ||
262 | #define PRODUCT_ID_STRING_ENABLE 13 | ||
263 | #define VENDOR_ID_STRING_ENABLE 12 | ||
264 | #define USB_ROOT_PORT_WAKEUP_ENABLE 11 | ||
265 | #define VBUS_PIN 10 | ||
266 | #define TIMED_DISCONNECT 9 | ||
267 | #define SUSPEND_IMMEDIATELY 7 | ||
268 | #define SELF_POWERED_USB_DEVICE 6 | ||
269 | #define REMOTE_WAKEUP_SUPPORT 5 | ||
270 | #define PME_POLARITY 4 | ||
271 | #define USB_DETECT_ENABLE 3 | ||
272 | #define PME_WAKEUP_ENABLE 2 | ||
273 | #define DEVICE_REMOTE_WAKEUP_ENABLE 1 | ||
274 | #define SELF_POWERED_STATUS 0 | ||
275 | // offset 0x0090 | ||
276 | u32 usbstat; | ||
277 | #define HIGH_SPEED 7 | ||
278 | #define FULL_SPEED 6 | ||
279 | #define GENERATE_RESUME 5 | ||
280 | #define GENERATE_DEVICE_REMOTE_WAKEUP 4 | ||
281 | u32 xcvrdiag; | ||
282 | #define FORCE_HIGH_SPEED_MODE 31 | ||
283 | #define FORCE_FULL_SPEED_MODE 30 | ||
284 | #define USB_TEST_MODE 24 | ||
285 | #define LINE_STATE 16 | ||
286 | #define TRANSCEIVER_OPERATION_MODE 2 | ||
287 | #define TRANSCEIVER_SELECT 1 | ||
288 | #define TERMINATION_SELECT 0 | ||
289 | u32 setup0123; | ||
290 | u32 setup4567; | ||
291 | // offset 0x0090 | ||
292 | u32 _unused0; | ||
293 | u32 ouraddr; | ||
294 | #define FORCE_IMMEDIATE 7 | ||
295 | #define OUR_USB_ADDRESS 0 | ||
296 | u32 ourconfig; | ||
297 | } __attribute__ ((packed)); | ||
298 | |||
299 | /* pci control, BAR0 + 0x0100 */ | ||
300 | struct net2280_pci_regs { | ||
301 | // offset 0x0100 | ||
302 | u32 pcimstctl; | ||
303 | #define PCI_ARBITER_PARK_SELECT 13 | ||
304 | #define PCI_MULTI LEVEL_ARBITER 12 | ||
305 | #define PCI_RETRY_ABORT_ENABLE 11 | ||
306 | #define DMA_MEMORY_WRITE_AND_INVALIDATE_ENABLE 10 | ||
307 | #define DMA_READ_MULTIPLE_ENABLE 9 | ||
308 | #define DMA_READ_LINE_ENABLE 8 | ||
309 | #define PCI_MASTER_COMMAND_SELECT 6 | ||
310 | #define MEM_READ_OR_WRITE 0 | ||
311 | #define IO_READ_OR_WRITE 1 | ||
312 | #define CFG_READ_OR_WRITE 2 | ||
313 | #define PCI_MASTER_START 5 | ||
314 | #define PCI_MASTER_READ_WRITE 4 | ||
315 | #define PCI_MASTER_WRITE 0 | ||
316 | #define PCI_MASTER_READ 1 | ||
317 | #define PCI_MASTER_BYTE_WRITE_ENABLES 0 | ||
318 | u32 pcimstaddr; | ||
319 | u32 pcimstdata; | ||
320 | u32 pcimststat; | ||
321 | #define PCI_ARBITER_CLEAR 2 | ||
322 | #define PCI_EXTERNAL_ARBITER 1 | ||
323 | #define PCI_HOST_MODE 0 | ||
324 | } __attribute__ ((packed)); | ||
325 | |||
326 | /* dma control, BAR0 + 0x0180 ... array of four structs like this, | ||
327 | * for channels 0..3. see also struct net2280_dma: descriptor | ||
328 | * that can be loaded into some of these registers. | ||
329 | */ | ||
330 | struct net2280_dma_regs { /* [11.7] */ | ||
331 | // offset 0x0180, 0x01a0, 0x01c0, 0x01e0, | ||
332 | u32 dmactl; | ||
333 | #define DMA_SCATTER_GATHER_DONE_INTERRUPT_ENABLE 25 | ||
334 | #define DMA_CLEAR_COUNT_ENABLE 21 | ||
335 | #define DESCRIPTOR_POLLING_RATE 19 | ||
336 | #define POLL_CONTINUOUS 0 | ||
337 | #define POLL_1_USEC 1 | ||
338 | #define POLL_100_USEC 2 | ||
339 | #define POLL_1_MSEC 3 | ||
340 | #define DMA_VALID_BIT_POLLING_ENABLE 18 | ||
341 | #define DMA_VALID_BIT_ENABLE 17 | ||
342 | #define DMA_SCATTER_GATHER_ENABLE 16 | ||
343 | #define DMA_OUT_AUTO_START_ENABLE 4 | ||
344 | #define DMA_PREEMPT_ENABLE 3 | ||
345 | #define DMA_FIFO_VALIDATE 2 | ||
346 | #define DMA_ENABLE 1 | ||
347 | #define DMA_ADDRESS_HOLD 0 | ||
348 | u32 dmastat; | ||
349 | #define DMA_SCATTER_GATHER_DONE_INTERRUPT 25 | ||
350 | #define DMA_TRANSACTION_DONE_INTERRUPT 24 | ||
351 | #define DMA_ABORT 1 | ||
352 | #define DMA_START 0 | ||
353 | u32 _unused0 [2]; | ||
354 | // offset 0x0190, 0x01b0, 0x01d0, 0x01f0, | ||
355 | u32 dmacount; | ||
356 | #define VALID_BIT 31 | ||
357 | #define DMA_DIRECTION 30 | ||
358 | #define DMA_DONE_INTERRUPT_ENABLE 29 | ||
359 | #define END_OF_CHAIN 28 | ||
360 | #define DMA_BYTE_COUNT_MASK ((1<<24)-1) | ||
361 | #define DMA_BYTE_COUNT 0 | ||
362 | u32 dmaaddr; | ||
363 | u32 dmadesc; | ||
364 | u32 _unused1; | ||
365 | } __attribute__ ((packed)); | ||
366 | |||
367 | /* dedicated endpoint registers, BAR0 + 0x0200 */ | ||
368 | |||
369 | struct net2280_dep_regs { /* [11.8] */ | ||
370 | // offset 0x0200, 0x0210, 0x220, 0x230, 0x240 | ||
371 | u32 dep_cfg; | ||
372 | // offset 0x0204, 0x0214, 0x224, 0x234, 0x244 | ||
373 | u32 dep_rsp; | ||
374 | u32 _unused [2]; | ||
375 | } __attribute__ ((packed)); | ||
376 | |||
377 | /* configurable endpoint registers, BAR0 + 0x0300 ... array of seven structs | ||
378 | * like this, for ep0 then the configurable endpoints A..F | ||
379 | * ep0 reserved for control; E and F have only 64 bytes of fifo | ||
380 | */ | ||
381 | struct net2280_ep_regs { /* [11.9] */ | ||
382 | // offset 0x0300, 0x0320, 0x0340, 0x0360, 0x0380, 0x03a0, 0x03c0 | ||
383 | u32 ep_cfg; | ||
384 | #define ENDPOINT_BYTE_COUNT 16 | ||
385 | #define ENDPOINT_ENABLE 10 | ||
386 | #define ENDPOINT_TYPE 8 | ||
387 | #define ENDPOINT_DIRECTION 7 | ||
388 | #define ENDPOINT_NUMBER 0 | ||
389 | u32 ep_rsp; | ||
390 | #define SET_NAK_OUT_PACKETS 15 | ||
391 | #define SET_EP_HIDE_STATUS_PHASE 14 | ||
392 | #define SET_EP_FORCE_CRC_ERROR 13 | ||
393 | #define SET_INTERRUPT_MODE 12 | ||
394 | #define SET_CONTROL_STATUS_PHASE_HANDSHAKE 11 | ||
395 | #define SET_NAK_OUT_PACKETS_MODE 10 | ||
396 | #define SET_ENDPOINT_TOGGLE 9 | ||
397 | #define SET_ENDPOINT_HALT 8 | ||
398 | #define CLEAR_NAK_OUT_PACKETS 7 | ||
399 | #define CLEAR_EP_HIDE_STATUS_PHASE 6 | ||
400 | #define CLEAR_EP_FORCE_CRC_ERROR 5 | ||
401 | #define CLEAR_INTERRUPT_MODE 4 | ||
402 | #define CLEAR_CONTROL_STATUS_PHASE_HANDSHAKE 3 | ||
403 | #define CLEAR_NAK_OUT_PACKETS_MODE 2 | ||
404 | #define CLEAR_ENDPOINT_TOGGLE 1 | ||
405 | #define CLEAR_ENDPOINT_HALT 0 | ||
406 | u32 ep_irqenb; | ||
407 | #define SHORT_PACKET_OUT_DONE_INTERRUPT_ENABLE 6 | ||
408 | #define SHORT_PACKET_TRANSFERRED_INTERRUPT_ENABLE 5 | ||
409 | #define DATA_PACKET_RECEIVED_INTERRUPT_ENABLE 3 | ||
410 | #define DATA_PACKET_TRANSMITTED_INTERRUPT_ENABLE 2 | ||
411 | #define DATA_OUT_PING_TOKEN_INTERRUPT_ENABLE 1 | ||
412 | #define DATA_IN_TOKEN_INTERRUPT_ENABLE 0 | ||
413 | u32 ep_stat; | ||
414 | #define FIFO_VALID_COUNT 24 | ||
415 | #define HIGH_BANDWIDTH_OUT_TRANSACTION_PID 22 | ||
416 | #define TIMEOUT 21 | ||
417 | #define USB_STALL_SENT 20 | ||
418 | #define USB_IN_NAK_SENT 19 | ||
419 | #define USB_IN_ACK_RCVD 18 | ||
420 | #define USB_OUT_PING_NAK_SENT 17 | ||
421 | #define USB_OUT_ACK_SENT 16 | ||
422 | #define FIFO_OVERFLOW 13 | ||
423 | #define FIFO_UNDERFLOW 12 | ||
424 | #define FIFO_FULL 11 | ||
425 | #define FIFO_EMPTY 10 | ||
426 | #define FIFO_FLUSH 9 | ||
427 | #define SHORT_PACKET_OUT_DONE_INTERRUPT 6 | ||
428 | #define SHORT_PACKET_TRANSFERRED_INTERRUPT 5 | ||
429 | #define NAK_OUT_PACKETS 4 | ||
430 | #define DATA_PACKET_RECEIVED_INTERRUPT 3 | ||
431 | #define DATA_PACKET_TRANSMITTED_INTERRUPT 2 | ||
432 | #define DATA_OUT_PING_TOKEN_INTERRUPT 1 | ||
433 | #define DATA_IN_TOKEN_INTERRUPT 0 | ||
434 | // offset 0x0310, 0x0330, 0x0350, 0x0370, 0x0390, 0x03b0, 0x03d0 | ||
435 | u32 ep_avail; | ||
436 | u32 ep_data; | ||
437 | u32 _unused0 [2]; | ||
438 | } __attribute__ ((packed)); | ||
439 | 26 | ||
440 | /*-------------------------------------------------------------------------*/ | 27 | /*-------------------------------------------------------------------------*/ |
441 | 28 | ||
diff --git a/drivers/usb/gadget/zero.c b/drivers/usb/gadget/zero.c index 51424f66a765..68e3d8f5da89 100644 --- a/drivers/usb/gadget/zero.c +++ b/drivers/usb/gadget/zero.c | |||
@@ -572,9 +572,10 @@ static void source_sink_complete (struct usb_ep *ep, struct usb_request *req) | |||
572 | switch (status) { | 572 | switch (status) { |
573 | 573 | ||
574 | case 0: /* normal completion? */ | 574 | case 0: /* normal completion? */ |
575 | if (ep == dev->out_ep) | 575 | if (ep == dev->out_ep) { |
576 | check_read_data (dev, ep, req); | 576 | check_read_data (dev, ep, req); |
577 | else | 577 | memset (req->buf, 0x55, req->length); |
578 | } else | ||
578 | reinit_write_data (dev, ep, req); | 579 | reinit_write_data (dev, ep, req); |
579 | break; | 580 | break; |
580 | 581 | ||
@@ -626,6 +627,8 @@ source_sink_start_ep (struct usb_ep *ep, gfp_t gfp_flags) | |||
626 | 627 | ||
627 | if (strcmp (ep->name, EP_IN_NAME) == 0) | 628 | if (strcmp (ep->name, EP_IN_NAME) == 0) |
628 | reinit_write_data (ep->driver_data, ep, req); | 629 | reinit_write_data (ep->driver_data, ep, req); |
630 | else | ||
631 | memset (req->buf, 0x55, req->length); | ||
629 | 632 | ||
630 | status = usb_ep_queue (ep, req, gfp_flags); | 633 | status = usb_ep_queue (ep, req, gfp_flags); |
631 | if (status) { | 634 | if (status) { |
diff --git a/drivers/usb/host/ehci-pci.c b/drivers/usb/host/ehci-pci.c index 1e03f1a5a5fd..a1bd2bea6deb 100644 --- a/drivers/usb/host/ehci-pci.c +++ b/drivers/usb/host/ehci-pci.c | |||
@@ -350,7 +350,7 @@ static const struct hc_driver ehci_pci_hc_driver = { | |||
350 | /* PCI driver selection metadata; PCI hotplugging uses this */ | 350 | /* PCI driver selection metadata; PCI hotplugging uses this */ |
351 | static const struct pci_device_id pci_ids [] = { { | 351 | static const struct pci_device_id pci_ids [] = { { |
352 | /* handle any USB 2.0 EHCI controller */ | 352 | /* handle any USB 2.0 EHCI controller */ |
353 | PCI_DEVICE_CLASS(((PCI_CLASS_SERIAL_USB << 8) | 0x20), ~0), | 353 | PCI_DEVICE_CLASS(PCI_CLASS_SERIAL_USB_EHCI, ~0), |
354 | .driver_data = (unsigned long) &ehci_pci_hc_driver, | 354 | .driver_data = (unsigned long) &ehci_pci_hc_driver, |
355 | }, | 355 | }, |
356 | { /* end: all zeroes */ } | 356 | { /* end: all zeroes */ } |
diff --git a/drivers/usb/host/ohci-at91.c b/drivers/usb/host/ohci-at91.c index 980030d684d5..6b7350b52419 100644 --- a/drivers/usb/host/ohci-at91.c +++ b/drivers/usb/host/ohci-at91.c | |||
@@ -20,7 +20,7 @@ | |||
20 | #include <asm/arch/board.h> | 20 | #include <asm/arch/board.h> |
21 | 21 | ||
22 | #ifndef CONFIG_ARCH_AT91RM9200 | 22 | #ifndef CONFIG_ARCH_AT91RM9200 |
23 | #error "This file is AT91RM9200 bus glue. CONFIG_ARCH_AT91RM9200 must be defined." | 23 | #error "CONFIG_ARCH_AT91RM9200 must be defined." |
24 | #endif | 24 | #endif |
25 | 25 | ||
26 | /* interface and function clocks */ | 26 | /* interface and function clocks */ |
@@ -84,8 +84,6 @@ static int usb_hcd_at91_remove (struct usb_hcd *, struct platform_device *); | |||
84 | * Allocates basic resources for this USB host controller, and | 84 | * Allocates basic resources for this USB host controller, and |
85 | * then invokes the start() method for the HCD associated with it | 85 | * then invokes the start() method for the HCD associated with it |
86 | * through the hotplug entry's driver_data. | 86 | * through the hotplug entry's driver_data. |
87 | * | ||
88 | * Store this function in the HCD's struct pci_driver as probe(). | ||
89 | */ | 87 | */ |
90 | int usb_hcd_at91_probe (const struct hc_driver *driver, struct platform_device *pdev) | 88 | int usb_hcd_at91_probe (const struct hc_driver *driver, struct platform_device *pdev) |
91 | { | 89 | { |
@@ -148,7 +146,6 @@ int usb_hcd_at91_probe (const struct hc_driver *driver, struct platform_device * | |||
148 | } | 146 | } |
149 | 147 | ||
150 | 148 | ||
151 | /* may be called without controller electrically present */ | ||
152 | /* may be called with controller, bus, and devices active */ | 149 | /* may be called with controller, bus, and devices active */ |
153 | 150 | ||
154 | /** | 151 | /** |
@@ -166,11 +163,11 @@ static int usb_hcd_at91_remove (struct usb_hcd *hcd, struct platform_device *pde | |||
166 | usb_remove_hcd(hcd); | 163 | usb_remove_hcd(hcd); |
167 | at91_stop_hc(pdev); | 164 | at91_stop_hc(pdev); |
168 | iounmap(hcd->regs); | 165 | iounmap(hcd->regs); |
169 | release_mem_region(hcd->rsrc_start, hcd->rsrc_len); | 166 | release_mem_region(hcd->rsrc_start, hcd->rsrc_len); |
170 | 167 | ||
171 | clk_put(fclk); | 168 | clk_put(fclk); |
172 | clk_put(iclk); | 169 | clk_put(iclk); |
173 | fclk = iclk = NULL; | 170 | fclk = iclk = NULL; |
174 | 171 | ||
175 | dev_set_drvdata(&pdev->dev, NULL); | 172 | dev_set_drvdata(&pdev->dev, NULL); |
176 | return 0; | 173 | return 0; |
@@ -235,8 +232,8 @@ static const struct hc_driver ohci_at91_hc_driver = { | |||
235 | .hub_control = ohci_hub_control, | 232 | .hub_control = ohci_hub_control, |
236 | 233 | ||
237 | #ifdef CONFIG_PM | 234 | #ifdef CONFIG_PM |
238 | .hub_suspend = ohci_hub_suspend, | 235 | .bus_suspend = ohci_bus_suspend, |
239 | .hub_resume = ohci_hub_resume, | 236 | .bus_resume = ohci_bus_resume, |
240 | #endif | 237 | #endif |
241 | .start_port_reset = ohci_start_port_reset, | 238 | .start_port_reset = ohci_start_port_reset, |
242 | }; | 239 | }; |
@@ -254,21 +251,21 @@ static int ohci_hcd_at91_drv_remove(struct platform_device *dev) | |||
254 | } | 251 | } |
255 | 252 | ||
256 | #ifdef CONFIG_PM | 253 | #ifdef CONFIG_PM |
257 | static int ohci_hcd_at91_drv_suspend(struct platform_device *dev, u32 state, u32 level) | ||
258 | { | ||
259 | printk("%s(%s:%d): not implemented yet\n", | ||
260 | __func__, __FILE__, __LINE__); | ||
261 | 254 | ||
255 | /* REVISIT suspend/resume look "too" simple here */ | ||
256 | |||
257 | static int | ||
258 | ohci_hcd_at91_drv_suspend(struct platform_device *dev, pm_message_t mesg) | ||
259 | { | ||
262 | clk_disable(fclk); | 260 | clk_disable(fclk); |
261 | clk_disable(iclk); | ||
263 | 262 | ||
264 | return 0; | 263 | return 0; |
265 | } | 264 | } |
266 | 265 | ||
267 | static int ohci_hcd_at91_drv_resume(struct platform_device *dev, u32 state) | 266 | static int ohci_hcd_at91_drv_resume(struct platform_device *dev) |
268 | { | 267 | { |
269 | printk("%s(%s:%d): not implemented yet\n", | 268 | clk_enable(iclk); |
270 | __func__, __FILE__, __LINE__); | ||
271 | |||
272 | clk_enable(fclk); | 269 | clk_enable(fclk); |
273 | 270 | ||
274 | return 0; | 271 | return 0; |
@@ -278,6 +275,8 @@ static int ohci_hcd_at91_drv_resume(struct platform_device *dev, u32 state) | |||
278 | #define ohci_hcd_at91_drv_resume NULL | 275 | #define ohci_hcd_at91_drv_resume NULL |
279 | #endif | 276 | #endif |
280 | 277 | ||
278 | MODULE_ALIAS("at91rm9200-ohci"); | ||
279 | |||
281 | static struct platform_driver ohci_hcd_at91_driver = { | 280 | static struct platform_driver ohci_hcd_at91_driver = { |
282 | .probe = ohci_hcd_at91_drv_probe, | 281 | .probe = ohci_hcd_at91_drv_probe, |
283 | .remove = ohci_hcd_at91_drv_remove, | 282 | .remove = ohci_hcd_at91_drv_remove, |
diff --git a/drivers/usb/host/ohci-hcd.c b/drivers/usb/host/ohci-hcd.c index 544f7589912f..73f5a379d9b3 100644 --- a/drivers/usb/host/ohci-hcd.c +++ b/drivers/usb/host/ohci-hcd.c | |||
@@ -863,7 +863,7 @@ static int ohci_restart (struct ohci_hcd *ohci) | |||
863 | i = ohci->num_ports; | 863 | i = ohci->num_ports; |
864 | while (i--) | 864 | while (i--) |
865 | ohci_writel (ohci, RH_PS_PSS, | 865 | ohci_writel (ohci, RH_PS_PSS, |
866 | &ohci->regs->roothub.portstatus [temp]); | 866 | &ohci->regs->roothub.portstatus [i]); |
867 | ohci_dbg (ohci, "restart complete\n"); | 867 | ohci_dbg (ohci, "restart complete\n"); |
868 | } | 868 | } |
869 | return 0; | 869 | return 0; |
diff --git a/drivers/usb/host/ohci-pci.c b/drivers/usb/host/ohci-pci.c index 1bfe96f4d045..b268537e389e 100644 --- a/drivers/usb/host/ohci-pci.c +++ b/drivers/usb/host/ohci-pci.c | |||
@@ -206,7 +206,7 @@ static const struct hc_driver ohci_pci_hc_driver = { | |||
206 | 206 | ||
207 | static const struct pci_device_id pci_ids [] = { { | 207 | static const struct pci_device_id pci_ids [] = { { |
208 | /* handle any USB OHCI controller */ | 208 | /* handle any USB OHCI controller */ |
209 | PCI_DEVICE_CLASS((PCI_CLASS_SERIAL_USB << 8) | 0x10, ~0), | 209 | PCI_DEVICE_CLASS(PCI_CLASS_SERIAL_USB_OHCI, ~0), |
210 | .driver_data = (unsigned long) &ohci_pci_hc_driver, | 210 | .driver_data = (unsigned long) &ohci_pci_hc_driver, |
211 | }, { /* end: all zeroes */ } | 211 | }, { /* end: all zeroes */ } |
212 | }; | 212 | }; |
diff --git a/drivers/usb/host/ohci-s3c2410.c b/drivers/usb/host/ohci-s3c2410.c index 682bf2215660..1da5de573a6f 100644 --- a/drivers/usb/host/ohci-s3c2410.c +++ b/drivers/usb/host/ohci-s3c2410.c | |||
@@ -30,6 +30,7 @@ | |||
30 | /* clock device associated with the hcd */ | 30 | /* clock device associated with the hcd */ |
31 | 31 | ||
32 | static struct clk *clk; | 32 | static struct clk *clk; |
33 | static struct clk *usb_clk; | ||
33 | 34 | ||
34 | /* forward definitions */ | 35 | /* forward definitions */ |
35 | 36 | ||
@@ -37,7 +38,7 @@ static void s3c2410_hcd_oc(struct s3c2410_hcd_info *info, int port_oc); | |||
37 | 38 | ||
38 | /* conversion functions */ | 39 | /* conversion functions */ |
39 | 40 | ||
40 | struct s3c2410_hcd_info *to_s3c2410_info(struct usb_hcd *hcd) | 41 | static struct s3c2410_hcd_info *to_s3c2410_info(struct usb_hcd *hcd) |
41 | { | 42 | { |
42 | return hcd->self.controller->platform_data; | 43 | return hcd->self.controller->platform_data; |
43 | } | 44 | } |
@@ -47,6 +48,10 @@ static void s3c2410_start_hc(struct platform_device *dev, struct usb_hcd *hcd) | |||
47 | struct s3c2410_hcd_info *info = dev->dev.platform_data; | 48 | struct s3c2410_hcd_info *info = dev->dev.platform_data; |
48 | 49 | ||
49 | dev_dbg(&dev->dev, "s3c2410_start_hc:\n"); | 50 | dev_dbg(&dev->dev, "s3c2410_start_hc:\n"); |
51 | |||
52 | clk_enable(usb_clk); | ||
53 | mdelay(2); /* let the bus clock stabilise */ | ||
54 | |||
50 | clk_enable(clk); | 55 | clk_enable(clk); |
51 | 56 | ||
52 | if (info != NULL) { | 57 | if (info != NULL) { |
@@ -75,6 +80,7 @@ static void s3c2410_stop_hc(struct platform_device *dev) | |||
75 | } | 80 | } |
76 | 81 | ||
77 | clk_disable(clk); | 82 | clk_disable(clk); |
83 | clk_disable(usb_clk); | ||
78 | } | 84 | } |
79 | 85 | ||
80 | /* ohci_s3c2410_hub_status_data | 86 | /* ohci_s3c2410_hub_status_data |
@@ -316,7 +322,8 @@ static void s3c2410_hcd_oc(struct s3c2410_hcd_info *info, int port_oc) | |||
316 | * | 322 | * |
317 | */ | 323 | */ |
318 | 324 | ||
319 | void usb_hcd_s3c2410_remove (struct usb_hcd *hcd, struct platform_device *dev) | 325 | static void |
326 | usb_hcd_s3c2410_remove (struct usb_hcd *hcd, struct platform_device *dev) | ||
320 | { | 327 | { |
321 | usb_remove_hcd(hcd); | 328 | usb_remove_hcd(hcd); |
322 | s3c2410_stop_hc(dev); | 329 | s3c2410_stop_hc(dev); |
@@ -334,8 +341,8 @@ void usb_hcd_s3c2410_remove (struct usb_hcd *hcd, struct platform_device *dev) | |||
334 | * through the hotplug entry's driver_data. | 341 | * through the hotplug entry's driver_data. |
335 | * | 342 | * |
336 | */ | 343 | */ |
337 | int usb_hcd_s3c2410_probe (const struct hc_driver *driver, | 344 | static int usb_hcd_s3c2410_probe (const struct hc_driver *driver, |
338 | struct platform_device *dev) | 345 | struct platform_device *dev) |
339 | { | 346 | { |
340 | struct usb_hcd *hcd = NULL; | 347 | struct usb_hcd *hcd = NULL; |
341 | int retval; | 348 | int retval; |
@@ -353,14 +360,21 @@ int usb_hcd_s3c2410_probe (const struct hc_driver *driver, | |||
353 | if (!request_mem_region(hcd->rsrc_start, hcd->rsrc_len, hcd_name)) { | 360 | if (!request_mem_region(hcd->rsrc_start, hcd->rsrc_len, hcd_name)) { |
354 | dev_err(&dev->dev, "request_mem_region failed"); | 361 | dev_err(&dev->dev, "request_mem_region failed"); |
355 | retval = -EBUSY; | 362 | retval = -EBUSY; |
356 | goto err0; | 363 | goto err_put; |
357 | } | 364 | } |
358 | 365 | ||
359 | clk = clk_get(NULL, "usb-host"); | 366 | clk = clk_get(&dev->dev, "usb-host"); |
360 | if (IS_ERR(clk)) { | 367 | if (IS_ERR(clk)) { |
361 | dev_err(&dev->dev, "cannot get usb-host clock\n"); | 368 | dev_err(&dev->dev, "cannot get usb-host clock\n"); |
362 | retval = -ENOENT; | 369 | retval = -ENOENT; |
363 | goto err1; | 370 | goto err_mem; |
371 | } | ||
372 | |||
373 | usb_clk = clk_get(&dev->dev, "upll"); | ||
374 | if (IS_ERR(usb_clk)) { | ||
375 | dev_err(&dev->dev, "cannot get usb-host clock\n"); | ||
376 | retval = -ENOENT; | ||
377 | goto err_clk; | ||
364 | } | 378 | } |
365 | 379 | ||
366 | s3c2410_start_hc(dev, hcd); | 380 | s3c2410_start_hc(dev, hcd); |
@@ -369,26 +383,29 @@ int usb_hcd_s3c2410_probe (const struct hc_driver *driver, | |||
369 | if (!hcd->regs) { | 383 | if (!hcd->regs) { |
370 | dev_err(&dev->dev, "ioremap failed\n"); | 384 | dev_err(&dev->dev, "ioremap failed\n"); |
371 | retval = -ENOMEM; | 385 | retval = -ENOMEM; |
372 | goto err2; | 386 | goto err_ioremap; |
373 | } | 387 | } |
374 | 388 | ||
375 | ohci_hcd_init(hcd_to_ohci(hcd)); | 389 | ohci_hcd_init(hcd_to_ohci(hcd)); |
376 | 390 | ||
377 | retval = usb_add_hcd(hcd, dev->resource[1].start, SA_INTERRUPT); | 391 | retval = usb_add_hcd(hcd, dev->resource[1].start, SA_INTERRUPT); |
378 | if (retval != 0) | 392 | if (retval != 0) |
379 | goto err2; | 393 | goto err_ioremap; |
380 | 394 | ||
381 | return 0; | 395 | return 0; |
382 | 396 | ||
383 | err2: | 397 | err_ioremap: |
384 | s3c2410_stop_hc(dev); | 398 | s3c2410_stop_hc(dev); |
385 | iounmap(hcd->regs); | 399 | iounmap(hcd->regs); |
400 | clk_put(usb_clk); | ||
401 | |||
402 | err_clk: | ||
386 | clk_put(clk); | 403 | clk_put(clk); |
387 | 404 | ||
388 | err1: | 405 | err_mem: |
389 | release_mem_region(hcd->rsrc_start, hcd->rsrc_len); | 406 | release_mem_region(hcd->rsrc_start, hcd->rsrc_len); |
390 | 407 | ||
391 | err0: | 408 | err_put: |
392 | usb_put_hcd(hcd); | 409 | usb_put_hcd(hcd); |
393 | return retval; | 410 | return retval; |
394 | } | 411 | } |
diff --git a/drivers/usb/host/pci-quirks.c b/drivers/usb/host/pci-quirks.c index 9e81c26313f9..1045f846fbe2 100644 --- a/drivers/usb/host/pci-quirks.c +++ b/drivers/usb/host/pci-quirks.c | |||
@@ -15,6 +15,7 @@ | |||
15 | #include <linux/init.h> | 15 | #include <linux/init.h> |
16 | #include <linux/delay.h> | 16 | #include <linux/delay.h> |
17 | #include <linux/acpi.h> | 17 | #include <linux/acpi.h> |
18 | #include "pci-quirks.h" | ||
18 | 19 | ||
19 | 20 | ||
20 | #define UHCI_USBLEGSUP 0xc0 /* legacy support */ | 21 | #define UHCI_USBLEGSUP 0xc0 /* legacy support */ |
diff --git a/drivers/usb/host/pci-quirks.h b/drivers/usb/host/pci-quirks.h new file mode 100644 index 000000000000..1564edfff6fe --- /dev/null +++ b/drivers/usb/host/pci-quirks.h | |||
@@ -0,0 +1,7 @@ | |||
1 | #ifndef __LINUX_USB_PCI_QUIRKS_H | ||
2 | #define __LINUX_USB_PCI_QUIRKS_H | ||
3 | |||
4 | void uhci_reset_hc(struct pci_dev *pdev, unsigned long base); | ||
5 | int uhci_check_and_reset_hc(struct pci_dev *pdev, unsigned long base); | ||
6 | |||
7 | #endif /* __LINUX_USB_PCI_QUIRKS_H */ | ||
diff --git a/drivers/usb/host/uhci-hcd.c b/drivers/usb/host/uhci-hcd.c index 4edb8330c440..d225e11f4055 100644 --- a/drivers/usb/host/uhci-hcd.c +++ b/drivers/usb/host/uhci-hcd.c | |||
@@ -50,6 +50,7 @@ | |||
50 | 50 | ||
51 | #include "../core/hcd.h" | 51 | #include "../core/hcd.h" |
52 | #include "uhci-hcd.h" | 52 | #include "uhci-hcd.h" |
53 | #include "pci-quirks.h" | ||
53 | 54 | ||
54 | /* | 55 | /* |
55 | * Version Information | 56 | * Version Information |
@@ -100,9 +101,6 @@ static void uhci_get_current_frame_number(struct uhci_hcd *uhci); | |||
100 | #include "uhci-q.c" | 101 | #include "uhci-q.c" |
101 | #include "uhci-hub.c" | 102 | #include "uhci-hub.c" |
102 | 103 | ||
103 | extern void uhci_reset_hc(struct pci_dev *pdev, unsigned long base); | ||
104 | extern int uhci_check_and_reset_hc(struct pci_dev *pdev, unsigned long base); | ||
105 | |||
106 | /* | 104 | /* |
107 | * Finish up a host controller reset and update the recorded state. | 105 | * Finish up a host controller reset and update the recorded state. |
108 | */ | 106 | */ |
@@ -117,8 +115,7 @@ static void finish_reset(struct uhci_hcd *uhci) | |||
117 | for (port = 0; port < uhci->rh_numports; ++port) | 115 | for (port = 0; port < uhci->rh_numports; ++port) |
118 | outw(0, uhci->io_addr + USBPORTSC1 + (port * 2)); | 116 | outw(0, uhci->io_addr + USBPORTSC1 + (port * 2)); |
119 | 117 | ||
120 | uhci->port_c_suspend = uhci->suspended_ports = | 118 | uhci->port_c_suspend = uhci->resuming_ports = 0; |
121 | uhci->resuming_ports = 0; | ||
122 | uhci->rh_state = UHCI_RH_RESET; | 119 | uhci->rh_state = UHCI_RH_RESET; |
123 | uhci->is_stopped = UHCI_IS_STOPPED; | 120 | uhci->is_stopped = UHCI_IS_STOPPED; |
124 | uhci_to_hcd(uhci)->state = HC_STATE_HALT; | 121 | uhci_to_hcd(uhci)->state = HC_STATE_HALT; |
@@ -861,7 +858,7 @@ static const struct hc_driver uhci_driver = { | |||
861 | 858 | ||
862 | static const struct pci_device_id uhci_pci_ids[] = { { | 859 | static const struct pci_device_id uhci_pci_ids[] = { { |
863 | /* handle any USB UHCI controller */ | 860 | /* handle any USB UHCI controller */ |
864 | PCI_DEVICE_CLASS(((PCI_CLASS_SERIAL_USB << 8) | 0x00), ~0), | 861 | PCI_DEVICE_CLASS(PCI_CLASS_SERIAL_USB_UHCI, ~0), |
865 | .driver_data = (unsigned long) &uhci_driver, | 862 | .driver_data = (unsigned long) &uhci_driver, |
866 | }, { /* end: all zeroes */ } | 863 | }, { /* end: all zeroes */ } |
867 | }; | 864 | }; |
diff --git a/drivers/usb/host/uhci-hcd.h b/drivers/usb/host/uhci-hcd.h index 4a69c7eb09bd..d5c8f4d92823 100644 --- a/drivers/usb/host/uhci-hcd.h +++ b/drivers/usb/host/uhci-hcd.h | |||
@@ -415,7 +415,6 @@ struct uhci_hcd { | |||
415 | 415 | ||
416 | /* Support for port suspend/resume/reset */ | 416 | /* Support for port suspend/resume/reset */ |
417 | unsigned long port_c_suspend; /* Bit-arrays of ports */ | 417 | unsigned long port_c_suspend; /* Bit-arrays of ports */ |
418 | unsigned long suspended_ports; | ||
419 | unsigned long resuming_ports; | 418 | unsigned long resuming_ports; |
420 | unsigned long ports_timeout; /* Time to stop signalling */ | 419 | unsigned long ports_timeout; /* Time to stop signalling */ |
421 | 420 | ||
diff --git a/drivers/usb/host/uhci-hub.c b/drivers/usb/host/uhci-hub.c index 152971d16769..c8451d9578f1 100644 --- a/drivers/usb/host/uhci-hub.c +++ b/drivers/usb/host/uhci-hub.c | |||
@@ -85,11 +85,10 @@ static void uhci_finish_suspend(struct uhci_hcd *uhci, int port, | |||
85 | { | 85 | { |
86 | int status; | 86 | int status; |
87 | 87 | ||
88 | if (test_bit(port, &uhci->suspended_ports)) { | 88 | if (inw(port_addr) & (USBPORTSC_SUSP | USBPORTSC_RD)) { |
89 | CLR_RH_PORTSTAT(USBPORTSC_SUSP | USBPORTSC_RD); | 89 | CLR_RH_PORTSTAT(USBPORTSC_SUSP | USBPORTSC_RD); |
90 | clear_bit(port, &uhci->suspended_ports); | 90 | if (test_bit(port, &uhci->resuming_ports)) |
91 | clear_bit(port, &uhci->resuming_ports); | 91 | set_bit(port, &uhci->port_c_suspend); |
92 | set_bit(port, &uhci->port_c_suspend); | ||
93 | 92 | ||
94 | /* The controller won't actually turn off the RD bit until | 93 | /* The controller won't actually turn off the RD bit until |
95 | * it has had a chance to send a low-speed EOP sequence, | 94 | * it has had a chance to send a low-speed EOP sequence, |
@@ -97,6 +96,7 @@ static void uhci_finish_suspend(struct uhci_hcd *uhci, int port, | |||
97 | * slightly longer for good luck. */ | 96 | * slightly longer for good luck. */ |
98 | udelay(4); | 97 | udelay(4); |
99 | } | 98 | } |
99 | clear_bit(port, &uhci->resuming_ports); | ||
100 | } | 100 | } |
101 | 101 | ||
102 | /* Wait for the UHCI controller in HP's iLO2 server management chip. | 102 | /* Wait for the UHCI controller in HP's iLO2 server management chip. |
@@ -265,8 +265,6 @@ static int uhci_hub_control(struct usb_hcd *hcd, u16 typeReq, u16 wValue, | |||
265 | wPortChange |= USB_PORT_STAT_C_SUSPEND; | 265 | wPortChange |= USB_PORT_STAT_C_SUSPEND; |
266 | lstatus |= 1; | 266 | lstatus |= 1; |
267 | } | 267 | } |
268 | if (test_bit(port, &uhci->suspended_ports)) | ||
269 | lstatus |= 2; | ||
270 | if (test_bit(port, &uhci->resuming_ports)) | 268 | if (test_bit(port, &uhci->resuming_ports)) |
271 | lstatus |= 4; | 269 | lstatus |= 4; |
272 | 270 | ||
@@ -309,7 +307,6 @@ static int uhci_hub_control(struct usb_hcd *hcd, u16 typeReq, u16 wValue, | |||
309 | 307 | ||
310 | switch (wValue) { | 308 | switch (wValue) { |
311 | case USB_PORT_FEAT_SUSPEND: | 309 | case USB_PORT_FEAT_SUSPEND: |
312 | set_bit(port, &uhci->suspended_ports); | ||
313 | SET_RH_PORTSTAT(USBPORTSC_SUSP); | 310 | SET_RH_PORTSTAT(USBPORTSC_SUSP); |
314 | OK(0); | 311 | OK(0); |
315 | case USB_PORT_FEAT_RESET: | 312 | case USB_PORT_FEAT_RESET: |
@@ -343,8 +340,11 @@ static int uhci_hub_control(struct usb_hcd *hcd, u16 typeReq, u16 wValue, | |||
343 | CLR_RH_PORTSTAT(USBPORTSC_PEC); | 340 | CLR_RH_PORTSTAT(USBPORTSC_PEC); |
344 | OK(0); | 341 | OK(0); |
345 | case USB_PORT_FEAT_SUSPEND: | 342 | case USB_PORT_FEAT_SUSPEND: |
346 | if (test_bit(port, &uhci->suspended_ports) && | 343 | if (!(inw(port_addr) & USBPORTSC_SUSP)) { |
347 | !test_and_set_bit(port, | 344 | |
345 | /* Make certain the port isn't suspended */ | ||
346 | uhci_finish_suspend(uhci, port, port_addr); | ||
347 | } else if (!test_and_set_bit(port, | ||
348 | &uhci->resuming_ports)) { | 348 | &uhci->resuming_ports)) { |
349 | SET_RH_PORTSTAT(USBPORTSC_RD); | 349 | SET_RH_PORTSTAT(USBPORTSC_RD); |
350 | 350 | ||
diff --git a/drivers/usb/input/Kconfig b/drivers/usb/input/Kconfig index 5246b35301de..650103bc9618 100644 --- a/drivers/usb/input/Kconfig +++ b/drivers/usb/input/Kconfig | |||
@@ -200,45 +200,41 @@ config USB_POWERMATE | |||
200 | To compile this driver as a module, choose M here: the | 200 | To compile this driver as a module, choose M here: the |
201 | module will be called powermate. | 201 | module will be called powermate. |
202 | 202 | ||
203 | config USB_MTOUCH | 203 | config USB_TOUCHSCREEN |
204 | tristate "MicroTouch USB Touchscreen Driver" | 204 | tristate "USB Touchscreen Driver" |
205 | depends on USB && INPUT | 205 | depends on USB && INPUT |
206 | ---help--- | 206 | ---help--- |
207 | Say Y here if you want to use a MicroTouch (Now 3M) USB | 207 | USB Touchscreen driver for: |
208 | Touchscreen controller. | 208 | - eGalax Touchkit USB |
209 | - PanJit TouchSet USB | ||
210 | - 3M MicroTouch USB | ||
211 | - ITM | ||
209 | 212 | ||
210 | See <file:Documentation/usb/mtouch.txt> for additional information. | 213 | Have a look at <http://linux.chapter7.ch/touchkit/> for |
211 | 214 | a usage description and the required user-space stuff. | |
212 | To compile this driver as a module, choose M here: the | ||
213 | module will be called mtouchusb. | ||
214 | |||
215 | config USB_ITMTOUCH | ||
216 | tristate "ITM Touch USB Touchscreen Driver" | ||
217 | depends on USB && INPUT | ||
218 | ---help--- | ||
219 | Say Y here if you want to use a ITM Touch USB | ||
220 | Touchscreen controller. | ||
221 | |||
222 | This touchscreen is used in LG 1510SF monitors. | ||
223 | 215 | ||
224 | To compile this driver as a module, choose M here: the | 216 | To compile this driver as a module, choose M here: the |
225 | module will be called itmtouch. | 217 | module will be called usbtouchscreen. |
226 | 218 | ||
227 | config USB_EGALAX | 219 | config USB_TOUCHSCREEN_EGALAX |
228 | tristate "eGalax TouchKit USB Touchscreen Driver" | 220 | default y |
229 | depends on USB && INPUT | 221 | bool "eGalax device support" if EMBEDDED |
230 | ---help--- | 222 | depends on USB_TOUCHSCREEN |
231 | Say Y here if you want to use a eGalax TouchKit USB | ||
232 | Touchscreen controller. | ||
233 | 223 | ||
234 | The driver has been tested on a Xenarc 700TSV monitor | 224 | config USB_TOUCHSCREEN_PANJIT |
235 | with eGalax touchscreen. | 225 | default y |
226 | bool "PanJit device support" if EMBEDDED | ||
227 | depends on USB_TOUCHSCREEN | ||
236 | 228 | ||
237 | Have a look at <http://linux.chapter7.ch/touchkit/> for | 229 | config USB_TOUCHSCREEN_3M |
238 | a usage description and the required user-space stuff. | 230 | default y |
231 | bool "3M/Microtouch device support" if EMBEDDED | ||
232 | depends on USB_TOUCHSCREEN | ||
239 | 233 | ||
240 | To compile this driver as a module, choose M here: the | 234 | config USB_TOUCHSCREEN_ITM |
241 | module will be called touchkitusb. | 235 | default y |
236 | bool "ITM device support" if EMBEDDED | ||
237 | depends on USB_TOUCHSCREEN | ||
242 | 238 | ||
243 | config USB_YEALINK | 239 | config USB_YEALINK |
244 | tristate "Yealink usb-p1k voip phone" | 240 | tristate "Yealink usb-p1k voip phone" |
diff --git a/drivers/usb/input/Makefile b/drivers/usb/input/Makefile index d512d9f488fe..764114529c56 100644 --- a/drivers/usb/input/Makefile +++ b/drivers/usb/input/Makefile | |||
@@ -37,6 +37,7 @@ obj-$(CONFIG_USB_MOUSE) += usbmouse.o | |||
37 | obj-$(CONFIG_USB_MTOUCH) += mtouchusb.o | 37 | obj-$(CONFIG_USB_MTOUCH) += mtouchusb.o |
38 | obj-$(CONFIG_USB_ITMTOUCH) += itmtouch.o | 38 | obj-$(CONFIG_USB_ITMTOUCH) += itmtouch.o |
39 | obj-$(CONFIG_USB_EGALAX) += touchkitusb.o | 39 | obj-$(CONFIG_USB_EGALAX) += touchkitusb.o |
40 | obj-$(CONFIG_USB_TOUCHSCREEN) += usbtouchscreen.o | ||
40 | obj-$(CONFIG_USB_POWERMATE) += powermate.o | 41 | obj-$(CONFIG_USB_POWERMATE) += powermate.o |
41 | obj-$(CONFIG_USB_WACOM) += wacom.o | 42 | obj-$(CONFIG_USB_WACOM) += wacom.o |
42 | obj-$(CONFIG_USB_ACECAD) += acecad.o | 43 | obj-$(CONFIG_USB_ACECAD) += acecad.o |
diff --git a/drivers/usb/input/hid-core.c b/drivers/usb/input/hid-core.c index d4bf1701046b..435273e7c85c 100644 --- a/drivers/usb/input/hid-core.c +++ b/drivers/usb/input/hid-core.c | |||
@@ -1372,6 +1372,11 @@ void hid_close(struct hid_device *hid) | |||
1372 | usb_kill_urb(hid->urbin); | 1372 | usb_kill_urb(hid->urbin); |
1373 | } | 1373 | } |
1374 | 1374 | ||
1375 | #define USB_VENDOR_ID_PANJIT 0x134c | ||
1376 | |||
1377 | #define USB_VENDOR_ID_SILVERCREST 0x062a | ||
1378 | #define USB_DEVICE_ID_SILVERCREST_KB 0x0201 | ||
1379 | |||
1375 | /* | 1380 | /* |
1376 | * Initialize all reports | 1381 | * Initialize all reports |
1377 | */ | 1382 | */ |
@@ -1552,6 +1557,9 @@ void hid_init_reports(struct hid_device *hid) | |||
1552 | #define USB_VENDOR_ID_HP 0x03f0 | 1557 | #define USB_VENDOR_ID_HP 0x03f0 |
1553 | #define USB_DEVICE_ID_HP_USBHUB_KB 0x020c | 1558 | #define USB_DEVICE_ID_HP_USBHUB_KB 0x020c |
1554 | 1559 | ||
1560 | #define USB_VENDOR_ID_IBM 0x04b3 | ||
1561 | #define USB_DEVICE_ID_IBM_USBHUB_KB 0x3005 | ||
1562 | |||
1555 | #define USB_VENDOR_ID_CREATIVELABS 0x062a | 1563 | #define USB_VENDOR_ID_CREATIVELABS 0x062a |
1556 | #define USB_DEVICE_ID_CREATIVELABS_SILVERCREST 0x0201 | 1564 | #define USB_DEVICE_ID_CREATIVELABS_SILVERCREST 0x0201 |
1557 | 1565 | ||
@@ -1655,9 +1663,12 @@ static const struct hid_blacklist { | |||
1655 | { USB_VENDOR_ID_WACOM, USB_DEVICE_ID_WACOM_INTUOS3, HID_QUIRK_IGNORE }, | 1663 | { USB_VENDOR_ID_WACOM, USB_DEVICE_ID_WACOM_INTUOS3, HID_QUIRK_IGNORE }, |
1656 | { USB_VENDOR_ID_WACOM, USB_DEVICE_ID_WACOM_INTUOS3 + 1, HID_QUIRK_IGNORE }, | 1664 | { USB_VENDOR_ID_WACOM, USB_DEVICE_ID_WACOM_INTUOS3 + 1, HID_QUIRK_IGNORE }, |
1657 | { USB_VENDOR_ID_WACOM, USB_DEVICE_ID_WACOM_INTUOS3 + 2, HID_QUIRK_IGNORE }, | 1665 | { USB_VENDOR_ID_WACOM, USB_DEVICE_ID_WACOM_INTUOS3 + 2, HID_QUIRK_IGNORE }, |
1666 | { USB_VENDOR_ID_WACOM, USB_DEVICE_ID_WACOM_INTUOS3 + 3, HID_QUIRK_IGNORE }, | ||
1667 | { USB_VENDOR_ID_WACOM, USB_DEVICE_ID_WACOM_INTUOS3 + 4, HID_QUIRK_IGNORE }, | ||
1658 | { USB_VENDOR_ID_WACOM, USB_DEVICE_ID_WACOM_INTUOS3 + 5, HID_QUIRK_IGNORE }, | 1668 | { USB_VENDOR_ID_WACOM, USB_DEVICE_ID_WACOM_INTUOS3 + 5, HID_QUIRK_IGNORE }, |
1659 | { USB_VENDOR_ID_WACOM, USB_DEVICE_ID_WACOM_CINTIQ, HID_QUIRK_IGNORE }, | 1669 | { USB_VENDOR_ID_WACOM, USB_DEVICE_ID_WACOM_CINTIQ, HID_QUIRK_IGNORE }, |
1660 | { USB_VENDOR_ID_WACOM, USB_DEVICE_ID_WACOM_DTF, HID_QUIRK_IGNORE }, | 1670 | { USB_VENDOR_ID_WACOM, USB_DEVICE_ID_WACOM_DTF, HID_QUIRK_IGNORE }, |
1671 | { USB_VENDOR_ID_WACOM, USB_DEVICE_ID_WACOM_DTF + 3, HID_QUIRK_IGNORE }, | ||
1661 | { USB_VENDOR_ID_WISEGROUP, USB_DEVICE_ID_4_PHIDGETSERVO_20, HID_QUIRK_IGNORE }, | 1672 | { USB_VENDOR_ID_WISEGROUP, USB_DEVICE_ID_4_PHIDGETSERVO_20, HID_QUIRK_IGNORE }, |
1662 | { USB_VENDOR_ID_WISEGROUP, USB_DEVICE_ID_1_PHIDGETSERVO_20, HID_QUIRK_IGNORE }, | 1673 | { USB_VENDOR_ID_WISEGROUP, USB_DEVICE_ID_1_PHIDGETSERVO_20, HID_QUIRK_IGNORE }, |
1663 | 1674 | ||
@@ -1673,8 +1684,10 @@ static const struct hid_blacklist { | |||
1673 | { USB_VENDOR_ID_CHICONY, USB_DEVICE_ID_CHICONY_USBHUB_KB, HID_QUIRK_NOGET}, | 1684 | { USB_VENDOR_ID_CHICONY, USB_DEVICE_ID_CHICONY_USBHUB_KB, HID_QUIRK_NOGET}, |
1674 | { USB_VENDOR_ID_CREATIVELABS, USB_DEVICE_ID_CREATIVELABS_SILVERCREST, HID_QUIRK_NOGET }, | 1685 | { USB_VENDOR_ID_CREATIVELABS, USB_DEVICE_ID_CREATIVELABS_SILVERCREST, HID_QUIRK_NOGET }, |
1675 | { USB_VENDOR_ID_HP, USB_DEVICE_ID_HP_USBHUB_KB, HID_QUIRK_NOGET }, | 1686 | { USB_VENDOR_ID_HP, USB_DEVICE_ID_HP_USBHUB_KB, HID_QUIRK_NOGET }, |
1687 | { USB_VENDOR_ID_IBM, USB_DEVICE_ID_IBM_USBHUB_KB, HID_QUIRK_NOGET }, | ||
1676 | { USB_VENDOR_ID_TANGTOP, USB_DEVICE_ID_TANGTOP_USBPS2, HID_QUIRK_NOGET }, | 1688 | { USB_VENDOR_ID_TANGTOP, USB_DEVICE_ID_TANGTOP_USBPS2, HID_QUIRK_NOGET }, |
1677 | { USB_VENDOR_ID_WISEGROUP, USB_DEVICE_ID_DUAL_USB_JOYPAD, HID_QUIRK_NOGET | HID_QUIRK_MULTI_INPUT }, | 1689 | { USB_VENDOR_ID_WISEGROUP, USB_DEVICE_ID_DUAL_USB_JOYPAD, HID_QUIRK_NOGET | HID_QUIRK_MULTI_INPUT }, |
1690 | { USB_VENDOR_ID_SILVERCREST, USB_DEVICE_ID_SILVERCREST_KB, HID_QUIRK_NOGET }, | ||
1678 | 1691 | ||
1679 | { USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_POWERMOUSE, HID_QUIRK_2WHEEL_POWERMOUSE }, | 1692 | { USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_POWERMOUSE, HID_QUIRK_2WHEEL_POWERMOUSE }, |
1680 | { USB_VENDOR_ID_A4TECH, USB_DEVICE_ID_A4TECH_WCP32PU, HID_QUIRK_2WHEEL_MOUSE_HACK_7 }, | 1693 | { USB_VENDOR_ID_A4TECH, USB_DEVICE_ID_A4TECH_WCP32PU, HID_QUIRK_2WHEEL_MOUSE_HACK_7 }, |
@@ -1701,6 +1714,11 @@ static const struct hid_blacklist { | |||
1701 | { USB_VENDOR_ID_APPLE, 0x030A, HID_QUIRK_POWERBOOK_HAS_FN }, | 1714 | { USB_VENDOR_ID_APPLE, 0x030A, HID_QUIRK_POWERBOOK_HAS_FN }, |
1702 | { USB_VENDOR_ID_APPLE, 0x030B, HID_QUIRK_POWERBOOK_HAS_FN }, | 1715 | { USB_VENDOR_ID_APPLE, 0x030B, HID_QUIRK_POWERBOOK_HAS_FN }, |
1703 | 1716 | ||
1717 | { USB_VENDOR_ID_PANJIT, 0x0001, HID_QUIRK_IGNORE }, | ||
1718 | { USB_VENDOR_ID_PANJIT, 0x0002, HID_QUIRK_IGNORE }, | ||
1719 | { USB_VENDOR_ID_PANJIT, 0x0003, HID_QUIRK_IGNORE }, | ||
1720 | { USB_VENDOR_ID_PANJIT, 0x0004, HID_QUIRK_IGNORE }, | ||
1721 | |||
1704 | { 0, 0 } | 1722 | { 0, 0 } |
1705 | }; | 1723 | }; |
1706 | 1724 | ||
diff --git a/drivers/usb/input/hid-ff.c b/drivers/usb/input/hid-ff.c index 72e698658b53..d5c91ee67991 100644 --- a/drivers/usb/input/hid-ff.c +++ b/drivers/usb/input/hid-ff.c | |||
@@ -34,12 +34,6 @@ | |||
34 | 34 | ||
35 | #include "hid.h" | 35 | #include "hid.h" |
36 | 36 | ||
37 | /* Drivers' initializing functions */ | ||
38 | extern int hid_lgff_init(struct hid_device* hid); | ||
39 | extern int hid_lg3d_init(struct hid_device* hid); | ||
40 | extern int hid_pid_init(struct hid_device* hid); | ||
41 | extern int hid_tmff_init(struct hid_device* hid); | ||
42 | |||
43 | /* | 37 | /* |
44 | * This table contains pointers to initializers. To add support for new | 38 | * This table contains pointers to initializers. To add support for new |
45 | * devices, you need to add the USB vendor and product ids here. | 39 | * devices, you need to add the USB vendor and product ids here. |
diff --git a/drivers/usb/input/hid.h b/drivers/usb/input/hid.h index 4e1b784fe527..9c62837b5b89 100644 --- a/drivers/usb/input/hid.h +++ b/drivers/usb/input/hid.h | |||
@@ -533,3 +533,8 @@ static inline int hid_ff_event(struct hid_device *hid, struct input_dev *input, | |||
533 | return hid->ff_event(hid, input, type, code, value); | 533 | return hid->ff_event(hid, input, type, code, value); |
534 | return -ENOSYS; | 534 | return -ENOSYS; |
535 | } | 535 | } |
536 | |||
537 | int hid_lgff_init(struct hid_device* hid); | ||
538 | int hid_tmff_init(struct hid_device* hid); | ||
539 | int hid_pid_init(struct hid_device* hid); | ||
540 | |||
diff --git a/drivers/usb/input/hiddev.c b/drivers/usb/input/hiddev.c index 6dd666696178..c4670e1d4654 100644 --- a/drivers/usb/input/hiddev.c +++ b/drivers/usb/input/hiddev.c | |||
@@ -317,6 +317,7 @@ static ssize_t hiddev_read(struct file * file, char __user * buffer, size_t coun | |||
317 | } | 317 | } |
318 | 318 | ||
319 | schedule(); | 319 | schedule(); |
320 | set_current_state(TASK_INTERRUPTIBLE); | ||
320 | } | 321 | } |
321 | 322 | ||
322 | set_current_state(TASK_RUNNING); | 323 | set_current_state(TASK_RUNNING); |
diff --git a/drivers/usb/input/keyspan_remote.c b/drivers/usb/input/keyspan_remote.c index b4a051b549d1..3d911976f378 100644 --- a/drivers/usb/input/keyspan_remote.c +++ b/drivers/usb/input/keyspan_remote.c | |||
@@ -297,6 +297,8 @@ static void keyspan_check_data(struct usb_keyspan *remote, struct pt_regs *regs) | |||
297 | remote->data.bits_left -= 6; | 297 | remote->data.bits_left -= 6; |
298 | } else { | 298 | } else { |
299 | err("%s - Error in message, invalid toggle.\n", __FUNCTION__); | 299 | err("%s - Error in message, invalid toggle.\n", __FUNCTION__); |
300 | remote->stage = 0; | ||
301 | return; | ||
300 | } | 302 | } |
301 | 303 | ||
302 | keyspan_load_tester(remote, 5); | 304 | keyspan_load_tester(remote, 5); |
diff --git a/drivers/usb/input/usbtouchscreen.c b/drivers/usb/input/usbtouchscreen.c new file mode 100644 index 000000000000..e9a07c1e905b --- /dev/null +++ b/drivers/usb/input/usbtouchscreen.c | |||
@@ -0,0 +1,605 @@ | |||
1 | /****************************************************************************** | ||
2 | * usbtouchscreen.c | ||
3 | * Driver for USB Touchscreens, supporting those devices: | ||
4 | * - eGalax Touchkit | ||
5 | * - 3M/Microtouch | ||
6 | * - ITM | ||
7 | * - PanJit TouchSet | ||
8 | * | ||
9 | * Copyright (C) 2004-2006 by Daniel Ritz <daniel.ritz@gmx.ch> | ||
10 | * Copyright (C) by Todd E. Johnson (mtouchusb.c) | ||
11 | * | ||
12 | * This program is free software; you can redistribute it and/or | ||
13 | * modify it under the terms of the GNU General Public License as | ||
14 | * published by the Free Software Foundation; either version 2 of the | ||
15 | * License, or (at your option) any later version. | ||
16 | * | ||
17 | * This program is distributed in the hope that it will be useful, but | ||
18 | * WITHOUT ANY WARRANTY; without even the implied warranty of | ||
19 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
20 | * General Public License for more details. | ||
21 | * | ||
22 | * You should have received a copy of the GNU General Public License | ||
23 | * along with this program; if not, write to the Free Software | ||
24 | * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. | ||
25 | * | ||
26 | * Driver is based on touchkitusb.c | ||
27 | * - ITM parts are from itmtouch.c | ||
28 | * - 3M parts are from mtouchusb.c | ||
29 | * - PanJit parts are from an unmerged driver by Lanslott Gish | ||
30 | * | ||
31 | *****************************************************************************/ | ||
32 | |||
33 | //#define DEBUG | ||
34 | |||
35 | #include <linux/config.h> | ||
36 | #include <linux/kernel.h> | ||
37 | #include <linux/slab.h> | ||
38 | #include <linux/input.h> | ||
39 | #include <linux/module.h> | ||
40 | #include <linux/init.h> | ||
41 | #include <linux/usb.h> | ||
42 | #include <linux/usb_input.h> | ||
43 | |||
44 | |||
45 | #define DRIVER_VERSION "v0.3" | ||
46 | #define DRIVER_AUTHOR "Daniel Ritz <daniel.ritz@gmx.ch>" | ||
47 | #define DRIVER_DESC "USB Touchscreen Driver" | ||
48 | |||
49 | static int swap_xy; | ||
50 | module_param(swap_xy, bool, 0644); | ||
51 | MODULE_PARM_DESC(swap_xy, "If set X and Y axes are swapped."); | ||
52 | |||
53 | /* device specifc data/functions */ | ||
54 | struct usbtouch_usb; | ||
55 | struct usbtouch_device_info { | ||
56 | int min_xc, max_xc; | ||
57 | int min_yc, max_yc; | ||
58 | int min_press, max_press; | ||
59 | int rept_size; | ||
60 | int flags; | ||
61 | |||
62 | void (*process_pkt) (struct usbtouch_usb *usbtouch, struct pt_regs *regs, unsigned char *pkt, int len); | ||
63 | int (*read_data) (unsigned char *pkt, int *x, int *y, int *touch, int *press); | ||
64 | int (*init) (struct usbtouch_usb *usbtouch); | ||
65 | }; | ||
66 | |||
67 | #define USBTOUCH_FLG_BUFFER 0x01 | ||
68 | |||
69 | |||
70 | /* a usbtouch device */ | ||
71 | struct usbtouch_usb { | ||
72 | unsigned char *data; | ||
73 | dma_addr_t data_dma; | ||
74 | unsigned char *buffer; | ||
75 | int buf_len; | ||
76 | struct urb *irq; | ||
77 | struct usb_device *udev; | ||
78 | struct input_dev *input; | ||
79 | struct usbtouch_device_info *type; | ||
80 | char name[128]; | ||
81 | char phys[64]; | ||
82 | }; | ||
83 | |||
84 | static void usbtouch_process_pkt(struct usbtouch_usb *usbtouch, | ||
85 | struct pt_regs *regs, unsigned char *pkt, int len); | ||
86 | |||
87 | /* device types */ | ||
88 | enum { | ||
89 | DEVTPYE_DUMMY = -1, | ||
90 | DEVTYPE_EGALAX, | ||
91 | DEVTYPE_PANJIT, | ||
92 | DEVTYPE_3M, | ||
93 | DEVTYPE_ITM, | ||
94 | }; | ||
95 | |||
96 | static struct usb_device_id usbtouch_devices[] = { | ||
97 | #ifdef CONFIG_USB_TOUCHSCREEN_EGALAX | ||
98 | {USB_DEVICE(0x3823, 0x0001), .driver_info = DEVTYPE_EGALAX}, | ||
99 | {USB_DEVICE(0x0123, 0x0001), .driver_info = DEVTYPE_EGALAX}, | ||
100 | {USB_DEVICE(0x0eef, 0x0001), .driver_info = DEVTYPE_EGALAX}, | ||
101 | {USB_DEVICE(0x0eef, 0x0002), .driver_info = DEVTYPE_EGALAX}, | ||
102 | #endif | ||
103 | |||
104 | #ifdef CONFIG_USB_TOUCHSCREEN_PANJIT | ||
105 | {USB_DEVICE(0x134c, 0x0001), .driver_info = DEVTYPE_PANJIT}, | ||
106 | {USB_DEVICE(0x134c, 0x0002), .driver_info = DEVTYPE_PANJIT}, | ||
107 | {USB_DEVICE(0x134c, 0x0003), .driver_info = DEVTYPE_PANJIT}, | ||
108 | {USB_DEVICE(0x134c, 0x0004), .driver_info = DEVTYPE_PANJIT}, | ||
109 | #endif | ||
110 | |||
111 | #ifdef CONFIG_USB_TOUCHSCREEN_3M | ||
112 | {USB_DEVICE(0x0596, 0x0001), .driver_info = DEVTYPE_3M}, | ||
113 | #endif | ||
114 | |||
115 | #ifdef CONFIG_USB_TOUCHSCREEN_ITM | ||
116 | {USB_DEVICE(0x0403, 0xf9e9), .driver_info = DEVTYPE_ITM}, | ||
117 | #endif | ||
118 | |||
119 | {} | ||
120 | }; | ||
121 | |||
122 | |||
123 | /***************************************************************************** | ||
124 | * eGalax part | ||
125 | */ | ||
126 | |||
127 | #ifdef CONFIG_USB_TOUCHSCREEN_EGALAX | ||
128 | |||
129 | #define EGALAX_PKT_TYPE_MASK 0xFE | ||
130 | #define EGALAX_PKT_TYPE_REPT 0x80 | ||
131 | #define EGALAX_PKT_TYPE_DIAG 0x0A | ||
132 | |||
133 | static int egalax_read_data(unsigned char *pkt, int *x, int *y, int *touch, int *press) | ||
134 | { | ||
135 | if ((pkt[0] & EGALAX_PKT_TYPE_MASK) != EGALAX_PKT_TYPE_REPT) | ||
136 | return 0; | ||
137 | |||
138 | *x = ((pkt[3] & 0x0F) << 7) | (pkt[4] & 0x7F); | ||
139 | *y = ((pkt[1] & 0x0F) << 7) | (pkt[2] & 0x7F); | ||
140 | *touch = pkt[0] & 0x01; | ||
141 | |||
142 | return 1; | ||
143 | |||
144 | } | ||
145 | |||
146 | static int egalax_get_pkt_len(unsigned char *buf) | ||
147 | { | ||
148 | switch (buf[0] & EGALAX_PKT_TYPE_MASK) { | ||
149 | case EGALAX_PKT_TYPE_REPT: | ||
150 | return 5; | ||
151 | |||
152 | case EGALAX_PKT_TYPE_DIAG: | ||
153 | return buf[1] + 2; | ||
154 | } | ||
155 | |||
156 | return 0; | ||
157 | } | ||
158 | |||
159 | static void egalax_process(struct usbtouch_usb *usbtouch, struct pt_regs *regs, | ||
160 | unsigned char *pkt, int len) | ||
161 | { | ||
162 | unsigned char *buffer; | ||
163 | int pkt_len, buf_len, pos; | ||
164 | |||
165 | /* if the buffer contains data, append */ | ||
166 | if (unlikely(usbtouch->buf_len)) { | ||
167 | int tmp; | ||
168 | |||
169 | /* if only 1 byte in buffer, add another one to get length */ | ||
170 | if (usbtouch->buf_len == 1) | ||
171 | usbtouch->buffer[1] = pkt[0]; | ||
172 | |||
173 | pkt_len = egalax_get_pkt_len(usbtouch->buffer); | ||
174 | |||
175 | /* unknown packet: drop everything */ | ||
176 | if (!pkt_len) | ||
177 | return; | ||
178 | |||
179 | /* append, process */ | ||
180 | tmp = pkt_len - usbtouch->buf_len; | ||
181 | memcpy(usbtouch->buffer + usbtouch->buf_len, pkt, tmp); | ||
182 | usbtouch_process_pkt(usbtouch, regs, usbtouch->buffer, pkt_len); | ||
183 | |||
184 | buffer = pkt + tmp; | ||
185 | buf_len = len - tmp; | ||
186 | } else { | ||
187 | buffer = pkt; | ||
188 | buf_len = len; | ||
189 | } | ||
190 | |||
191 | /* only one byte left in buffer */ | ||
192 | if (unlikely(buf_len == 1)) { | ||
193 | usbtouch->buffer[0] = buffer[0]; | ||
194 | usbtouch->buf_len = 1; | ||
195 | return; | ||
196 | } | ||
197 | |||
198 | /* loop over the buffer */ | ||
199 | pos = 0; | ||
200 | while (pos < buf_len) { | ||
201 | /* get packet len */ | ||
202 | pkt_len = egalax_get_pkt_len(buffer + pos); | ||
203 | |||
204 | /* unknown packet: drop everything */ | ||
205 | if (unlikely(!pkt_len)) | ||
206 | return; | ||
207 | |||
208 | /* full packet: process */ | ||
209 | if (likely(pkt_len <= buf_len)) { | ||
210 | usbtouch_process_pkt(usbtouch, regs, buffer + pos, pkt_len); | ||
211 | } else { | ||
212 | /* incomplete packet: save in buffer */ | ||
213 | memcpy(usbtouch->buffer, buffer + pos, buf_len - pos); | ||
214 | usbtouch->buf_len = buf_len - pos; | ||
215 | } | ||
216 | pos += pkt_len; | ||
217 | } | ||
218 | } | ||
219 | #endif | ||
220 | |||
221 | |||
222 | /***************************************************************************** | ||
223 | * PanJit Part | ||
224 | */ | ||
225 | #ifdef CONFIG_USB_TOUCHSCREEN_PANJIT | ||
226 | static int panjit_read_data(unsigned char *pkt, int *x, int *y, int *touch, int *press) | ||
227 | { | ||
228 | *x = ((pkt[2] & 0x0F) << 8) | pkt[1]; | ||
229 | *y = ((pkt[4] & 0x0F) << 8) | pkt[3]; | ||
230 | *touch = pkt[0] & 0x01; | ||
231 | |||
232 | return 1; | ||
233 | } | ||
234 | #endif | ||
235 | |||
236 | |||
237 | /***************************************************************************** | ||
238 | * 3M/Microtouch Part | ||
239 | */ | ||
240 | #ifdef CONFIG_USB_TOUCHSCREEN_3M | ||
241 | |||
242 | #define MTOUCHUSB_ASYNC_REPORT 1 | ||
243 | #define MTOUCHUSB_RESET 7 | ||
244 | #define MTOUCHUSB_REQ_CTRLLR_ID 10 | ||
245 | |||
246 | static int mtouch_read_data(unsigned char *pkt, int *x, int *y, int *touch, int *press) | ||
247 | { | ||
248 | *x = (pkt[8] << 8) | pkt[7]; | ||
249 | *y = (pkt[10] << 8) | pkt[9]; | ||
250 | *touch = (pkt[2] & 0x40) ? 1 : 0; | ||
251 | |||
252 | return 1; | ||
253 | } | ||
254 | |||
255 | static int mtouch_init(struct usbtouch_usb *usbtouch) | ||
256 | { | ||
257 | int ret; | ||
258 | |||
259 | ret = usb_control_msg(usbtouch->udev, usb_rcvctrlpipe(usbtouch->udev, 0), | ||
260 | MTOUCHUSB_RESET, | ||
261 | USB_DIR_OUT | USB_TYPE_VENDOR | USB_RECIP_DEVICE, | ||
262 | 1, 0, NULL, 0, USB_CTRL_SET_TIMEOUT); | ||
263 | dbg("%s - usb_control_msg - MTOUCHUSB_RESET - bytes|err: %d", | ||
264 | __FUNCTION__, ret); | ||
265 | if (ret < 0) | ||
266 | return ret; | ||
267 | |||
268 | ret = usb_control_msg(usbtouch->udev, usb_rcvctrlpipe(usbtouch->udev, 0), | ||
269 | MTOUCHUSB_ASYNC_REPORT, | ||
270 | USB_DIR_OUT | USB_TYPE_VENDOR | USB_RECIP_DEVICE, | ||
271 | 1, 1, NULL, 0, USB_CTRL_SET_TIMEOUT); | ||
272 | dbg("%s - usb_control_msg - MTOUCHUSB_ASYNC_REPORT - bytes|err: %d", | ||
273 | __FUNCTION__, ret); | ||
274 | if (ret < 0) | ||
275 | return ret; | ||
276 | |||
277 | return 0; | ||
278 | } | ||
279 | #endif | ||
280 | |||
281 | |||
282 | /***************************************************************************** | ||
283 | * ITM Part | ||
284 | */ | ||
285 | #ifdef CONFIG_USB_TOUCHSCREEN_ITM | ||
286 | static int itm_read_data(unsigned char *pkt, int *x, int *y, int *touch, int *press) | ||
287 | { | ||
288 | *x = ((pkt[0] & 0x1F) << 7) | (pkt[3] & 0x7F); | ||
289 | *x = ((pkt[1] & 0x1F) << 7) | (pkt[4] & 0x7F); | ||
290 | *press = ((pkt[2] & 0x1F) << 7) | (pkt[5] & 0x7F); | ||
291 | *touch = ~pkt[7] & 0x20; | ||
292 | |||
293 | return 1; | ||
294 | } | ||
295 | #endif | ||
296 | |||
297 | |||
298 | /***************************************************************************** | ||
299 | * the different device descriptors | ||
300 | */ | ||
301 | static struct usbtouch_device_info usbtouch_dev_info[] = { | ||
302 | #ifdef CONFIG_USB_TOUCHSCREEN_EGALAX | ||
303 | [DEVTYPE_EGALAX] = { | ||
304 | .min_xc = 0x0, | ||
305 | .max_xc = 0x07ff, | ||
306 | .min_yc = 0x0, | ||
307 | .max_yc = 0x07ff, | ||
308 | .rept_size = 16, | ||
309 | .flags = USBTOUCH_FLG_BUFFER, | ||
310 | .process_pkt = egalax_process, | ||
311 | .read_data = egalax_read_data, | ||
312 | }, | ||
313 | #endif | ||
314 | |||
315 | #ifdef CONFIG_USB_TOUCHSCREEN_PANJIT | ||
316 | [DEVTYPE_PANJIT] = { | ||
317 | .min_xc = 0x0, | ||
318 | .max_xc = 0x0fff, | ||
319 | .min_yc = 0x0, | ||
320 | .max_yc = 0x0fff, | ||
321 | .rept_size = 8, | ||
322 | .read_data = panjit_read_data, | ||
323 | }, | ||
324 | #endif | ||
325 | |||
326 | #ifdef CONFIG_USB_TOUCHSCREEN_3M | ||
327 | [DEVTYPE_3M] = { | ||
328 | .min_xc = 0x0, | ||
329 | .max_xc = 0x4000, | ||
330 | .min_yc = 0x0, | ||
331 | .max_yc = 0x4000, | ||
332 | .rept_size = 11, | ||
333 | .read_data = mtouch_read_data, | ||
334 | .init = mtouch_init, | ||
335 | }, | ||
336 | #endif | ||
337 | |||
338 | #ifdef CONFIG_USB_TOUCHSCREEN_ITM | ||
339 | [DEVTYPE_ITM] = { | ||
340 | .min_xc = 0x0, | ||
341 | .max_xc = 0x0fff, | ||
342 | .min_yc = 0x0, | ||
343 | .max_yc = 0x0fff, | ||
344 | .max_press = 0xff, | ||
345 | .rept_size = 8, | ||
346 | .read_data = itm_read_data, | ||
347 | }, | ||
348 | #endif | ||
349 | }; | ||
350 | |||
351 | |||
352 | /***************************************************************************** | ||
353 | * Generic Part | ||
354 | */ | ||
355 | static void usbtouch_process_pkt(struct usbtouch_usb *usbtouch, | ||
356 | struct pt_regs *regs, unsigned char *pkt, int len) | ||
357 | { | ||
358 | int x, y, touch, press; | ||
359 | struct usbtouch_device_info *type = usbtouch->type; | ||
360 | |||
361 | if (!type->read_data(pkt, &x, &y, &touch, &press)) | ||
362 | return; | ||
363 | |||
364 | input_regs(usbtouch->input, regs); | ||
365 | input_report_key(usbtouch->input, BTN_TOUCH, touch); | ||
366 | |||
367 | if (swap_xy) { | ||
368 | input_report_abs(usbtouch->input, ABS_X, y); | ||
369 | input_report_abs(usbtouch->input, ABS_Y, x); | ||
370 | } else { | ||
371 | input_report_abs(usbtouch->input, ABS_X, x); | ||
372 | input_report_abs(usbtouch->input, ABS_Y, y); | ||
373 | } | ||
374 | if (type->max_press) | ||
375 | input_report_abs(usbtouch->input, ABS_PRESSURE, press); | ||
376 | input_sync(usbtouch->input); | ||
377 | } | ||
378 | |||
379 | |||
380 | static void usbtouch_irq(struct urb *urb, struct pt_regs *regs) | ||
381 | { | ||
382 | struct usbtouch_usb *usbtouch = urb->context; | ||
383 | int retval; | ||
384 | |||
385 | switch (urb->status) { | ||
386 | case 0: | ||
387 | /* success */ | ||
388 | break; | ||
389 | case -ETIMEDOUT: | ||
390 | /* this urb is timing out */ | ||
391 | dbg("%s - urb timed out - was the device unplugged?", | ||
392 | __FUNCTION__); | ||
393 | return; | ||
394 | case -ECONNRESET: | ||
395 | case -ENOENT: | ||
396 | case -ESHUTDOWN: | ||
397 | /* this urb is terminated, clean up */ | ||
398 | dbg("%s - urb shutting down with status: %d", | ||
399 | __FUNCTION__, urb->status); | ||
400 | return; | ||
401 | default: | ||
402 | dbg("%s - nonzero urb status received: %d", | ||
403 | __FUNCTION__, urb->status); | ||
404 | goto exit; | ||
405 | } | ||
406 | |||
407 | usbtouch->type->process_pkt(usbtouch, regs, usbtouch->data, urb->actual_length); | ||
408 | |||
409 | exit: | ||
410 | retval = usb_submit_urb(urb, GFP_ATOMIC); | ||
411 | if (retval) | ||
412 | err("%s - usb_submit_urb failed with result: %d", | ||
413 | __FUNCTION__, retval); | ||
414 | } | ||
415 | |||
416 | static int usbtouch_open(struct input_dev *input) | ||
417 | { | ||
418 | struct usbtouch_usb *usbtouch = input->private; | ||
419 | |||
420 | usbtouch->irq->dev = usbtouch->udev; | ||
421 | |||
422 | if (usb_submit_urb(usbtouch->irq, GFP_KERNEL)) | ||
423 | return -EIO; | ||
424 | |||
425 | return 0; | ||
426 | } | ||
427 | |||
428 | static void usbtouch_close(struct input_dev *input) | ||
429 | { | ||
430 | struct usbtouch_usb *usbtouch = input->private; | ||
431 | |||
432 | usb_kill_urb(usbtouch->irq); | ||
433 | } | ||
434 | |||
435 | |||
436 | static void usbtouch_free_buffers(struct usb_device *udev, | ||
437 | struct usbtouch_usb *usbtouch) | ||
438 | { | ||
439 | if (usbtouch->data) | ||
440 | usb_buffer_free(udev, usbtouch->type->rept_size, | ||
441 | usbtouch->data, usbtouch->data_dma); | ||
442 | kfree(usbtouch->buffer); | ||
443 | } | ||
444 | |||
445 | |||
446 | static int usbtouch_probe(struct usb_interface *intf, | ||
447 | const struct usb_device_id *id) | ||
448 | { | ||
449 | struct usbtouch_usb *usbtouch; | ||
450 | struct input_dev *input_dev; | ||
451 | struct usb_host_interface *interface; | ||
452 | struct usb_endpoint_descriptor *endpoint; | ||
453 | struct usb_device *udev = interface_to_usbdev(intf); | ||
454 | struct usbtouch_device_info *type; | ||
455 | int err; | ||
456 | |||
457 | interface = intf->cur_altsetting; | ||
458 | endpoint = &interface->endpoint[0].desc; | ||
459 | |||
460 | usbtouch = kzalloc(sizeof(struct usbtouch_usb), GFP_KERNEL); | ||
461 | input_dev = input_allocate_device(); | ||
462 | if (!usbtouch || !input_dev) | ||
463 | goto out_free; | ||
464 | |||
465 | type = &usbtouch_dev_info[id->driver_info]; | ||
466 | usbtouch->type = type; | ||
467 | if (!type->process_pkt) | ||
468 | type->process_pkt = usbtouch_process_pkt; | ||
469 | |||
470 | usbtouch->data = usb_buffer_alloc(udev, type->rept_size, | ||
471 | SLAB_KERNEL, &usbtouch->data_dma); | ||
472 | if (!usbtouch->data) | ||
473 | goto out_free; | ||
474 | |||
475 | if (type->flags & USBTOUCH_FLG_BUFFER) { | ||
476 | usbtouch->buffer = kmalloc(type->rept_size, GFP_KERNEL); | ||
477 | if (!usbtouch->buffer) | ||
478 | goto out_free_buffers; | ||
479 | } | ||
480 | |||
481 | usbtouch->irq = usb_alloc_urb(0, GFP_KERNEL); | ||
482 | if (!usbtouch->irq) { | ||
483 | dbg("%s - usb_alloc_urb failed: usbtouch->irq", __FUNCTION__); | ||
484 | goto out_free_buffers; | ||
485 | } | ||
486 | |||
487 | usbtouch->udev = udev; | ||
488 | usbtouch->input = input_dev; | ||
489 | |||
490 | if (udev->manufacturer) | ||
491 | strlcpy(usbtouch->name, udev->manufacturer, sizeof(usbtouch->name)); | ||
492 | |||
493 | if (udev->product) { | ||
494 | if (udev->manufacturer) | ||
495 | strlcat(usbtouch->name, " ", sizeof(usbtouch->name)); | ||
496 | strlcat(usbtouch->name, udev->product, sizeof(usbtouch->name)); | ||
497 | } | ||
498 | |||
499 | if (!strlen(usbtouch->name)) | ||
500 | snprintf(usbtouch->name, sizeof(usbtouch->name), | ||
501 | "USB Touchscreen %04x:%04x", | ||
502 | le16_to_cpu(udev->descriptor.idVendor), | ||
503 | le16_to_cpu(udev->descriptor.idProduct)); | ||
504 | |||
505 | usb_make_path(udev, usbtouch->phys, sizeof(usbtouch->phys)); | ||
506 | strlcpy(usbtouch->phys, "/input0", sizeof(usbtouch->phys)); | ||
507 | |||
508 | input_dev->name = usbtouch->name; | ||
509 | input_dev->phys = usbtouch->phys; | ||
510 | usb_to_input_id(udev, &input_dev->id); | ||
511 | input_dev->cdev.dev = &intf->dev; | ||
512 | input_dev->private = usbtouch; | ||
513 | input_dev->open = usbtouch_open; | ||
514 | input_dev->close = usbtouch_close; | ||
515 | |||
516 | input_dev->evbit[0] = BIT(EV_KEY) | BIT(EV_ABS); | ||
517 | input_dev->keybit[LONG(BTN_TOUCH)] = BIT(BTN_TOUCH); | ||
518 | input_set_abs_params(input_dev, ABS_X, type->min_xc, type->max_xc, 0, 0); | ||
519 | input_set_abs_params(input_dev, ABS_Y, type->min_yc, type->max_yc, 0, 0); | ||
520 | if (type->max_press) | ||
521 | input_set_abs_params(input_dev, ABS_PRESSURE, type->min_press, | ||
522 | type->max_press, 0, 0); | ||
523 | |||
524 | usb_fill_int_urb(usbtouch->irq, usbtouch->udev, | ||
525 | usb_rcvintpipe(usbtouch->udev, 0x81), | ||
526 | usbtouch->data, type->rept_size, | ||
527 | usbtouch_irq, usbtouch, endpoint->bInterval); | ||
528 | |||
529 | usbtouch->irq->transfer_dma = usbtouch->data_dma; | ||
530 | usbtouch->irq->transfer_flags |= URB_NO_TRANSFER_DMA_MAP; | ||
531 | |||
532 | /* device specific init */ | ||
533 | if (type->init) { | ||
534 | err = type->init(usbtouch); | ||
535 | if (err) { | ||
536 | dbg("%s - type->init() failed, err: %d", __FUNCTION__, err); | ||
537 | goto out_free_buffers; | ||
538 | } | ||
539 | } | ||
540 | |||
541 | err = input_register_device(usbtouch->input); | ||
542 | if (err) { | ||
543 | dbg("%s - input_register_device failed, err: %d", __FUNCTION__, err); | ||
544 | goto out_free_buffers; | ||
545 | } | ||
546 | |||
547 | usb_set_intfdata(intf, usbtouch); | ||
548 | |||
549 | return 0; | ||
550 | |||
551 | out_free_buffers: | ||
552 | usbtouch_free_buffers(udev, usbtouch); | ||
553 | out_free: | ||
554 | input_free_device(input_dev); | ||
555 | kfree(usbtouch); | ||
556 | return -ENOMEM; | ||
557 | } | ||
558 | |||
559 | static void usbtouch_disconnect(struct usb_interface *intf) | ||
560 | { | ||
561 | struct usbtouch_usb *usbtouch = usb_get_intfdata(intf); | ||
562 | |||
563 | dbg("%s - called", __FUNCTION__); | ||
564 | |||
565 | if (!usbtouch) | ||
566 | return; | ||
567 | |||
568 | dbg("%s - usbtouch is initialized, cleaning up", __FUNCTION__); | ||
569 | usb_set_intfdata(intf, NULL); | ||
570 | usb_kill_urb(usbtouch->irq); | ||
571 | input_unregister_device(usbtouch->input); | ||
572 | usb_free_urb(usbtouch->irq); | ||
573 | usbtouch_free_buffers(interface_to_usbdev(intf), usbtouch); | ||
574 | kfree(usbtouch); | ||
575 | } | ||
576 | |||
577 | MODULE_DEVICE_TABLE(usb, usbtouch_devices); | ||
578 | |||
579 | static struct usb_driver usbtouch_driver = { | ||
580 | .name = "usbtouchscreen", | ||
581 | .probe = usbtouch_probe, | ||
582 | .disconnect = usbtouch_disconnect, | ||
583 | .id_table = usbtouch_devices, | ||
584 | }; | ||
585 | |||
586 | static int __init usbtouch_init(void) | ||
587 | { | ||
588 | return usb_register(&usbtouch_driver); | ||
589 | } | ||
590 | |||
591 | static void __exit usbtouch_cleanup(void) | ||
592 | { | ||
593 | usb_deregister(&usbtouch_driver); | ||
594 | } | ||
595 | |||
596 | module_init(usbtouch_init); | ||
597 | module_exit(usbtouch_cleanup); | ||
598 | |||
599 | MODULE_AUTHOR(DRIVER_AUTHOR); | ||
600 | MODULE_DESCRIPTION(DRIVER_DESC); | ||
601 | MODULE_LICENSE("GPL"); | ||
602 | |||
603 | MODULE_ALIAS("touchkitusb"); | ||
604 | MODULE_ALIAS("itmtouch"); | ||
605 | MODULE_ALIAS("mtouchusb"); | ||
diff --git a/drivers/usb/input/wacom.c b/drivers/usb/input/wacom.c index d3e15df9e815..cf84c6096f29 100644 --- a/drivers/usb/input/wacom.c +++ b/drivers/usb/input/wacom.c | |||
@@ -9,7 +9,7 @@ | |||
9 | * Copyright (c) 2000 Daniel Egger <egger@suse.de> | 9 | * Copyright (c) 2000 Daniel Egger <egger@suse.de> |
10 | * Copyright (c) 2001 Frederic Lepied <flepied@mandrakesoft.com> | 10 | * Copyright (c) 2001 Frederic Lepied <flepied@mandrakesoft.com> |
11 | * Copyright (c) 2004 Panagiotis Issaris <panagiotis.issaris@mech.kuleuven.ac.be> | 11 | * Copyright (c) 2004 Panagiotis Issaris <panagiotis.issaris@mech.kuleuven.ac.be> |
12 | * Copyright (c) 2002-2005 Ping Cheng <pingc@wacom.com> | 12 | * Copyright (c) 2002-2006 Ping Cheng <pingc@wacom.com> |
13 | * | 13 | * |
14 | * ChangeLog: | 14 | * ChangeLog: |
15 | * v0.1 (vp) - Initial release | 15 | * v0.1 (vp) - Initial release |
@@ -56,6 +56,8 @@ | |||
56 | * - Merged wacom_intuos3_irq into wacom_intuos_irq | 56 | * - Merged wacom_intuos3_irq into wacom_intuos_irq |
57 | * v1.44 (pc) - Added support for Graphire4, Cintiq 710, Intuos3 6x11, etc. | 57 | * v1.44 (pc) - Added support for Graphire4, Cintiq 710, Intuos3 6x11, etc. |
58 | * - Report Device IDs | 58 | * - Report Device IDs |
59 | * v1.45 (pc) - Added support for DTF 521, Intuos3 12x12 and 12x19 | ||
60 | * - Minor data report fix | ||
59 | */ | 61 | */ |
60 | 62 | ||
61 | /* | 63 | /* |
@@ -78,7 +80,7 @@ | |||
78 | /* | 80 | /* |
79 | * Version Information | 81 | * Version Information |
80 | */ | 82 | */ |
81 | #define DRIVER_VERSION "v1.44" | 83 | #define DRIVER_VERSION "v1.45" |
82 | #define DRIVER_AUTHOR "Vojtech Pavlik <vojtech@ucw.cz>" | 84 | #define DRIVER_AUTHOR "Vojtech Pavlik <vojtech@ucw.cz>" |
83 | #define DRIVER_DESC "USB Wacom Graphire and Wacom Intuos tablet driver" | 85 | #define DRIVER_DESC "USB Wacom Graphire and Wacom Intuos tablet driver" |
84 | #define DRIVER_LICENSE "GPL" | 86 | #define DRIVER_LICENSE "GPL" |
@@ -99,6 +101,8 @@ enum { | |||
99 | PL, | 101 | PL, |
100 | INTUOS, | 102 | INTUOS, |
101 | INTUOS3, | 103 | INTUOS3, |
104 | INTUOS312, | ||
105 | INTUOS319, | ||
102 | CINTIQ, | 106 | CINTIQ, |
103 | MAX_TYPE | 107 | MAX_TYPE |
104 | }; | 108 | }; |
@@ -127,7 +131,19 @@ struct wacom { | |||
127 | char phys[32]; | 131 | char phys[32]; |
128 | }; | 132 | }; |
129 | 133 | ||
134 | #define USB_REQ_GET_REPORT 0x01 | ||
130 | #define USB_REQ_SET_REPORT 0x09 | 135 | #define USB_REQ_SET_REPORT 0x09 |
136 | |||
137 | static int usb_get_report(struct usb_interface *intf, unsigned char type, | ||
138 | unsigned char id, void *buf, int size) | ||
139 | { | ||
140 | return usb_control_msg(interface_to_usbdev(intf), | ||
141 | usb_rcvctrlpipe(interface_to_usbdev(intf), 0), | ||
142 | USB_REQ_GET_REPORT, USB_TYPE_CLASS | USB_RECIP_INTERFACE, | ||
143 | (type << 8) + id, intf->altsetting[0].desc.bInterfaceNumber, | ||
144 | buf, size, 100); | ||
145 | } | ||
146 | |||
131 | static int usb_set_report(struct usb_interface *intf, unsigned char type, | 147 | static int usb_set_report(struct usb_interface *intf, unsigned char type, |
132 | unsigned char id, void *buf, int size) | 148 | unsigned char id, void *buf, int size) |
133 | { | 149 | { |
@@ -206,7 +222,8 @@ static void wacom_pl_irq(struct urb *urb, struct pt_regs *regs) | |||
206 | wacom->tool[1] = BTN_TOOL_PEN; | 222 | wacom->tool[1] = BTN_TOOL_PEN; |
207 | id = STYLUS_DEVICE_ID; | 223 | id = STYLUS_DEVICE_ID; |
208 | } | 224 | } |
209 | input_report_key(dev, wacom->tool[1], id); /* report in proximity for tool */ | 225 | input_report_key(dev, wacom->tool[1], prox); /* report in proximity for tool */ |
226 | input_report_abs(dev, ABS_MISC, id); /* report tool id */ | ||
210 | input_report_abs(dev, ABS_X, data[3] | (data[2] << 7) | ((data[1] & 0x03) << 14)); | 227 | input_report_abs(dev, ABS_X, data[3] | (data[2] << 7) | ((data[1] & 0x03) << 14)); |
211 | input_report_abs(dev, ABS_Y, data[6] | (data[5] << 7) | ((data[4] & 0x03) << 14)); | 228 | input_report_abs(dev, ABS_Y, data[6] | (data[5] << 7) | ((data[4] & 0x03) << 14)); |
212 | input_report_abs(dev, ABS_PRESSURE, pressure); | 229 | input_report_abs(dev, ABS_PRESSURE, pressure); |
@@ -239,7 +256,7 @@ static void wacom_ptu_irq(struct urb *urb, struct pt_regs *regs) | |||
239 | struct wacom *wacom = urb->context; | 256 | struct wacom *wacom = urb->context; |
240 | unsigned char *data = wacom->data; | 257 | unsigned char *data = wacom->data; |
241 | struct input_dev *dev = wacom->dev; | 258 | struct input_dev *dev = wacom->dev; |
242 | int retval; | 259 | int retval, id; |
243 | 260 | ||
244 | switch (urb->status) { | 261 | switch (urb->status) { |
245 | case 0: | 262 | case 0: |
@@ -263,12 +280,15 @@ static void wacom_ptu_irq(struct urb *urb, struct pt_regs *regs) | |||
263 | 280 | ||
264 | input_regs(dev, regs); | 281 | input_regs(dev, regs); |
265 | if (data[1] & 0x04) { | 282 | if (data[1] & 0x04) { |
266 | input_report_key(dev, BTN_TOOL_RUBBER, (data[1] & 0x20) ? ERASER_DEVICE_ID : 0); | 283 | input_report_key(dev, BTN_TOOL_RUBBER, data[1] & 0x20); |
267 | input_report_key(dev, BTN_TOUCH, data[1] & 0x08); | 284 | input_report_key(dev, BTN_TOUCH, data[1] & 0x08); |
285 | id = ERASER_DEVICE_ID; | ||
268 | } else { | 286 | } else { |
269 | input_report_key(dev, BTN_TOOL_PEN, (data[1] & 0x20) ? STYLUS_DEVICE_ID : 0); | 287 | input_report_key(dev, BTN_TOOL_PEN, data[1] & 0x20); |
270 | input_report_key(dev, BTN_TOUCH, data[1] & 0x01); | 288 | input_report_key(dev, BTN_TOUCH, data[1] & 0x01); |
289 | id = STYLUS_DEVICE_ID; | ||
271 | } | 290 | } |
291 | input_report_abs(dev, ABS_MISC, id); /* report tool id */ | ||
272 | input_report_abs(dev, ABS_X, le16_to_cpu(*(__le16 *) &data[2])); | 292 | input_report_abs(dev, ABS_X, le16_to_cpu(*(__le16 *) &data[2])); |
273 | input_report_abs(dev, ABS_Y, le16_to_cpu(*(__le16 *) &data[4])); | 293 | input_report_abs(dev, ABS_Y, le16_to_cpu(*(__le16 *) &data[4])); |
274 | input_report_abs(dev, ABS_PRESSURE, le16_to_cpu(*(__le16 *) &data[6])); | 294 | input_report_abs(dev, ABS_PRESSURE, le16_to_cpu(*(__le16 *) &data[6])); |
@@ -312,7 +332,8 @@ static void wacom_penpartner_irq(struct urb *urb, struct pt_regs *regs) | |||
312 | } | 332 | } |
313 | 333 | ||
314 | input_regs(dev, regs); | 334 | input_regs(dev, regs); |
315 | input_report_key(dev, BTN_TOOL_PEN, STYLUS_DEVICE_ID); | 335 | input_report_key(dev, BTN_TOOL_PEN, 1); |
336 | input_report_abs(dev, ABS_MISC, STYLUS_DEVICE_ID); /* report tool id */ | ||
316 | input_report_abs(dev, ABS_X, le16_to_cpu(*(__le16 *) &data[1])); | 337 | input_report_abs(dev, ABS_X, le16_to_cpu(*(__le16 *) &data[1])); |
317 | input_report_abs(dev, ABS_Y, le16_to_cpu(*(__le16 *) &data[3])); | 338 | input_report_abs(dev, ABS_Y, le16_to_cpu(*(__le16 *) &data[3])); |
318 | input_report_abs(dev, ABS_PRESSURE, (signed char)data[6] + 127); | 339 | input_report_abs(dev, ABS_PRESSURE, (signed char)data[6] + 127); |
@@ -350,6 +371,8 @@ static void wacom_graphire_irq(struct urb *urb, struct pt_regs *regs) | |||
350 | goto exit; | 371 | goto exit; |
351 | } | 372 | } |
352 | 373 | ||
374 | if (data[0] == 99) return; /* for Volito tablets */ | ||
375 | |||
353 | if (data[0] != 2) { | 376 | if (data[0] != 2) { |
354 | dbg("wacom_graphire_irq: received unknown report #%d", data[0]); | 377 | dbg("wacom_graphire_irq: received unknown report #%d", data[0]); |
355 | goto exit; | 378 | goto exit; |
@@ -374,10 +397,10 @@ static void wacom_graphire_irq(struct urb *urb, struct pt_regs *regs) | |||
374 | case 2: /* Mouse with wheel */ | 397 | case 2: /* Mouse with wheel */ |
375 | input_report_key(dev, BTN_MIDDLE, data[1] & 0x04); | 398 | input_report_key(dev, BTN_MIDDLE, data[1] & 0x04); |
376 | if (wacom->features->type == WACOM_G4) { | 399 | if (wacom->features->type == WACOM_G4) { |
377 | rw = data[7] & 0x04 ? -(data[7] & 0x03) : (data[7] & 0x03); | 400 | rw = data[7] & 0x04 ? (data[7] & 0x03)-4 : (data[7] & 0x03); |
378 | input_report_rel(dev, REL_WHEEL, rw); | 401 | input_report_rel(dev, REL_WHEEL, -rw); |
379 | } else | 402 | } else |
380 | input_report_rel(dev, REL_WHEEL, (signed char) data[6]); | 403 | input_report_rel(dev, REL_WHEEL, -(signed char) data[6]); |
381 | /* fall through */ | 404 | /* fall through */ |
382 | 405 | ||
383 | case 3: /* Mouse without wheel */ | 406 | case 3: /* Mouse without wheel */ |
@@ -406,39 +429,27 @@ static void wacom_graphire_irq(struct urb *urb, struct pt_regs *regs) | |||
406 | } | 429 | } |
407 | } | 430 | } |
408 | 431 | ||
409 | input_report_key(dev, wacom->tool[0], (data[1] & 0x10) ? id : 0); | 432 | if (data[1] & 0x10) |
433 | input_report_abs(dev, ABS_MISC, id); /* report tool id */ | ||
434 | else | ||
435 | input_report_abs(dev, ABS_MISC, 0); /* reset tool id */ | ||
436 | input_report_key(dev, wacom->tool[0], data[1] & 0x10); | ||
410 | input_sync(dev); | 437 | input_sync(dev); |
411 | 438 | ||
412 | /* send pad data */ | 439 | /* send pad data */ |
413 | if (wacom->features->type == WACOM_G4) { | 440 | if (wacom->features->type == WACOM_G4) { |
414 | /* fist time sending pad data */ | 441 | if ((wacom->serial[1] & 0xc0) != (data[7] & 0xf8)) { |
415 | if (wacom->tool[1] != BTN_TOOL_FINGER) { | 442 | wacom->id[1] = 1; |
416 | wacom->id[1] = 0; | 443 | wacom->serial[1] = (data[7] & 0xf8); |
417 | wacom->serial[1] = (data[7] & 0x38) >> 2; | ||
418 | } | ||
419 | if (data[7] & 0xf8) { | ||
420 | input_report_key(dev, BTN_0, (data[7] & 0x40)); | 444 | input_report_key(dev, BTN_0, (data[7] & 0x40)); |
421 | input_report_key(dev, BTN_4, (data[7] & 0x80)); | 445 | input_report_key(dev, BTN_4, (data[7] & 0x80)); |
422 | if (((data[7] & 0x38) >> 2) == (wacom->serial[1] & 0x0e)) | 446 | rw = ((data[7] & 0x18) >> 3) - ((data[7] & 0x20) >> 3); |
423 | /* alter REL_WHEEL value so X apps can get it */ | ||
424 | wacom->serial[1] += (wacom->serial[1] & 0x01) ? -1 : 1; | ||
425 | else | ||
426 | wacom->serial[1] = (data[7] & 0x38 ) >> 2; | ||
427 | |||
428 | /* don't alter the value when there is no wheel event */ | ||
429 | if (wacom->serial[1] == 1) | ||
430 | wacom->serial[1] = 0; | ||
431 | rw = wacom->serial[1]; | ||
432 | rw = (rw & 0x08) ? -(rw & 0x07) : (rw & 0x07); | ||
433 | input_report_rel(dev, REL_WHEEL, rw); | 447 | input_report_rel(dev, REL_WHEEL, rw); |
434 | wacom->tool[1] = BTN_TOOL_FINGER; | 448 | input_report_key(dev, BTN_TOOL_FINGER, 0xf0); |
435 | wacom->id[1] = data[7] & 0xf8; | ||
436 | input_report_key(dev, wacom->tool[1], 0xf0); | ||
437 | input_event(dev, EV_MSC, MSC_SERIAL, 0xf0); | 449 | input_event(dev, EV_MSC, MSC_SERIAL, 0xf0); |
438 | } else if (wacom->id[1]) { | 450 | } else if (wacom->id[1]) { |
439 | wacom->id[1] = 0; | 451 | wacom->id[1] = 0; |
440 | wacom->serial[1] = 0; | 452 | input_report_key(dev, BTN_TOOL_FINGER, 0); |
441 | input_report_key(dev, wacom->tool[1], 0); | ||
442 | input_event(dev, EV_MSC, MSC_SERIAL, 0xf0); | 453 | input_event(dev, EV_MSC, MSC_SERIAL, 0xf0); |
443 | } | 454 | } |
444 | input_sync(dev); | 455 | input_sync(dev); |
@@ -516,21 +527,31 @@ static int wacom_intuos_inout(struct urb *urb) | |||
516 | default: /* Unknown tool */ | 527 | default: /* Unknown tool */ |
517 | wacom->tool[idx] = BTN_TOOL_PEN; | 528 | wacom->tool[idx] = BTN_TOOL_PEN; |
518 | } | 529 | } |
519 | input_report_key(dev, wacom->tool[idx], wacom->id[idx]); | 530 | if(!((wacom->tool[idx] == BTN_TOOL_LENS) && |
520 | input_event(dev, EV_MSC, MSC_SERIAL, wacom->serial[idx]); | 531 | ((wacom->features->type == INTUOS312) |
521 | input_sync(dev); | 532 | || (wacom->features->type == INTUOS319)))) { |
533 | input_report_abs(dev, ABS_MISC, wacom->id[idx]); /* report tool id */ | ||
534 | input_report_key(dev, wacom->tool[idx], 1); | ||
535 | input_event(dev, EV_MSC, MSC_SERIAL, wacom->serial[idx]); | ||
536 | input_sync(dev); | ||
537 | } | ||
522 | return 1; | 538 | return 1; |
523 | } | 539 | } |
524 | 540 | ||
525 | /* Exit report */ | 541 | /* Exit report */ |
526 | if ((data[1] & 0xfe) == 0x80) { | 542 | if ((data[1] & 0xfe) == 0x80) { |
527 | input_report_key(dev, wacom->tool[idx], 0); | 543 | input_report_key(dev, wacom->tool[idx], 0); |
544 | input_report_abs(dev, ABS_MISC, 0); /* reset tool id */ | ||
528 | input_event(dev, EV_MSC, MSC_SERIAL, wacom->serial[idx]); | 545 | input_event(dev, EV_MSC, MSC_SERIAL, wacom->serial[idx]); |
529 | input_sync(dev); | 546 | input_sync(dev); |
530 | return 1; | 547 | return 1; |
531 | } | 548 | } |
532 | 549 | ||
533 | return 0; | 550 | if((wacom->tool[idx] == BTN_TOOL_LENS) && ((wacom->features->type == INTUOS312) |
551 | || (wacom->features->type == INTUOS319))) | ||
552 | return 1; | ||
553 | else | ||
554 | return 0; | ||
534 | } | 555 | } |
535 | 556 | ||
536 | static void wacom_intuos_general(struct urb *urb) | 557 | static void wacom_intuos_general(struct urb *urb) |
@@ -600,10 +621,9 @@ static void wacom_intuos_irq(struct urb *urb, struct pt_regs *regs) | |||
600 | /* pad packets. Works as a second tool and is always in prox */ | 621 | /* pad packets. Works as a second tool and is always in prox */ |
601 | if (data[0] == 12) { | 622 | if (data[0] == 12) { |
602 | /* initiate the pad as a device */ | 623 | /* initiate the pad as a device */ |
603 | if (wacom->tool[1] != BTN_TOOL_FINGER) { | 624 | if (wacom->tool[1] != BTN_TOOL_FINGER) |
604 | wacom->tool[1] = BTN_TOOL_FINGER; | 625 | wacom->tool[1] = BTN_TOOL_FINGER; |
605 | input_report_key(dev, wacom->tool[1], 1); | 626 | |
606 | } | ||
607 | input_report_key(dev, BTN_0, (data[5] & 0x01)); | 627 | input_report_key(dev, BTN_0, (data[5] & 0x01)); |
608 | input_report_key(dev, BTN_1, (data[5] & 0x02)); | 628 | input_report_key(dev, BTN_1, (data[5] & 0x02)); |
609 | input_report_key(dev, BTN_2, (data[5] & 0x04)); | 629 | input_report_key(dev, BTN_2, (data[5] & 0x04)); |
@@ -614,6 +634,11 @@ static void wacom_intuos_irq(struct urb *urb, struct pt_regs *regs) | |||
614 | input_report_key(dev, BTN_7, (data[6] & 0x08)); | 634 | input_report_key(dev, BTN_7, (data[6] & 0x08)); |
615 | input_report_abs(dev, ABS_RX, ((data[1] & 0x1f) << 8) | data[2]); | 635 | input_report_abs(dev, ABS_RX, ((data[1] & 0x1f) << 8) | data[2]); |
616 | input_report_abs(dev, ABS_RY, ((data[3] & 0x1f) << 8) | data[4]); | 636 | input_report_abs(dev, ABS_RY, ((data[3] & 0x1f) << 8) | data[4]); |
637 | |||
638 | if((data[5] & 0x0f) | (data[6] & 0x0f) | (data[1] & 0x1f) | data[2]) | ||
639 | input_report_key(dev, wacom->tool[1], 1); | ||
640 | else | ||
641 | input_report_key(dev, wacom->tool[1], 0); | ||
617 | input_event(dev, EV_MSC, MSC_SERIAL, 0xffffffff); | 642 | input_event(dev, EV_MSC, MSC_SERIAL, 0xffffffff); |
618 | input_sync(dev); | 643 | input_sync(dev); |
619 | goto exit; | 644 | goto exit; |
@@ -676,8 +701,8 @@ static void wacom_intuos_irq(struct urb *urb, struct pt_regs *regs) | |||
676 | input_report_key(dev, BTN_LEFT, data[8] & 0x04); | 701 | input_report_key(dev, BTN_LEFT, data[8] & 0x04); |
677 | input_report_key(dev, BTN_MIDDLE, data[8] & 0x08); | 702 | input_report_key(dev, BTN_MIDDLE, data[8] & 0x08); |
678 | input_report_key(dev, BTN_RIGHT, data[8] & 0x10); | 703 | input_report_key(dev, BTN_RIGHT, data[8] & 0x10); |
679 | input_report_rel(dev, REL_WHEEL, ((data[8] & 0x02) >> 1) | 704 | input_report_rel(dev, REL_WHEEL, (data[8] & 0x01) |
680 | - (data[8] & 0x01)); | 705 | - ((data[8] & 0x02) >> 1)); |
681 | 706 | ||
682 | /* I3 2D mouse side buttons */ | 707 | /* I3 2D mouse side buttons */ |
683 | if (wacom->features->type == INTUOS3) { | 708 | if (wacom->features->type == INTUOS3) { |
@@ -695,7 +720,8 @@ static void wacom_intuos_irq(struct urb *urb, struct pt_regs *regs) | |||
695 | } | 720 | } |
696 | } | 721 | } |
697 | 722 | ||
698 | input_report_key(dev, wacom->tool[idx], wacom->id[idx]); | 723 | input_report_abs(dev, ABS_MISC, wacom->id[idx]); /* report tool id */ |
724 | input_report_key(dev, wacom->tool[idx], 1); | ||
699 | input_event(dev, EV_MSC, MSC_SERIAL, wacom->serial[idx]); | 725 | input_event(dev, EV_MSC, MSC_SERIAL, wacom->serial[idx]); |
700 | input_sync(dev); | 726 | input_sync(dev); |
701 | 727 | ||
@@ -733,7 +759,8 @@ static struct wacom_features wacom_features[] = { | |||
733 | { "Wacom PL800", 8, 7220, 5780, 511, 32, PL, wacom_pl_irq }, | 759 | { "Wacom PL800", 8, 7220, 5780, 511, 32, PL, wacom_pl_irq }, |
734 | { "Wacom PL700", 8, 6758, 5406, 511, 32, PL, wacom_pl_irq }, | 760 | { "Wacom PL700", 8, 6758, 5406, 511, 32, PL, wacom_pl_irq }, |
735 | { "Wacom PL510", 8, 6282, 4762, 511, 32, PL, wacom_pl_irq }, | 761 | { "Wacom PL510", 8, 6282, 4762, 511, 32, PL, wacom_pl_irq }, |
736 | { "Wacom PL710", 8, 34080, 27660, 511, 32, PL, wacom_pl_irq }, | 762 | { "Wacom DTU710", 8, 34080, 27660, 511, 32, PL, wacom_pl_irq }, |
763 | { "Wacom DTF521", 8, 6282, 4762, 511, 32, PL, wacom_pl_irq }, | ||
737 | { "Wacom DTF720", 8, 6858, 5506, 511, 32, PL, wacom_pl_irq }, | 764 | { "Wacom DTF720", 8, 6858, 5506, 511, 32, PL, wacom_pl_irq }, |
738 | { "Wacom Cintiq Partner",8, 20480, 15360, 511, 32, PL, wacom_ptu_irq }, | 765 | { "Wacom Cintiq Partner",8, 20480, 15360, 511, 32, PL, wacom_ptu_irq }, |
739 | { "Wacom Intuos2 4x5", 10, 12700, 10600, 1023, 15, INTUOS, wacom_intuos_irq }, | 766 | { "Wacom Intuos2 4x5", 10, 12700, 10600, 1023, 15, INTUOS, wacom_intuos_irq }, |
@@ -744,6 +771,8 @@ static struct wacom_features wacom_features[] = { | |||
744 | { "Wacom Intuos3 4x5", 10, 25400, 20320, 1023, 15, INTUOS3, wacom_intuos_irq }, | 771 | { "Wacom Intuos3 4x5", 10, 25400, 20320, 1023, 15, INTUOS3, wacom_intuos_irq }, |
745 | { "Wacom Intuos3 6x8", 10, 40640, 30480, 1023, 15, INTUOS3, wacom_intuos_irq }, | 772 | { "Wacom Intuos3 6x8", 10, 40640, 30480, 1023, 15, INTUOS3, wacom_intuos_irq }, |
746 | { "Wacom Intuos3 9x12", 10, 60960, 45720, 1023, 15, INTUOS3, wacom_intuos_irq }, | 773 | { "Wacom Intuos3 9x12", 10, 60960, 45720, 1023, 15, INTUOS3, wacom_intuos_irq }, |
774 | { "Wacom Intuos3 12x12", 10, 60960, 60960, 1023, 15, INTUOS312, wacom_intuos_irq }, | ||
775 | { "Wacom Intuos3 12x19", 10, 97536, 60960, 1023, 15, INTUOS319, wacom_intuos_irq }, | ||
747 | { "Wacom Intuos3 6x11", 10, 54204, 31750, 1023, 15, INTUOS3, wacom_intuos_irq }, | 776 | { "Wacom Intuos3 6x11", 10, 54204, 31750, 1023, 15, INTUOS3, wacom_intuos_irq }, |
748 | { "Wacom Cintiq 21UX", 10, 87200, 65600, 1023, 15, CINTIQ, wacom_intuos_irq }, | 777 | { "Wacom Cintiq 21UX", 10, 87200, 65600, 1023, 15, CINTIQ, wacom_intuos_irq }, |
749 | { "Wacom Intuos2 6x8", 10, 20320, 16240, 1023, 15, INTUOS, wacom_intuos_irq }, | 778 | { "Wacom Intuos2 6x8", 10, 20320, 16240, 1023, 15, INTUOS, wacom_intuos_irq }, |
@@ -779,6 +808,7 @@ static struct usb_device_id wacom_ids[] = { | |||
779 | { USB_DEVICE(USB_VENDOR_ID_WACOM, 0x38) }, | 808 | { USB_DEVICE(USB_VENDOR_ID_WACOM, 0x38) }, |
780 | { USB_DEVICE(USB_VENDOR_ID_WACOM, 0x39) }, | 809 | { USB_DEVICE(USB_VENDOR_ID_WACOM, 0x39) }, |
781 | { USB_DEVICE(USB_VENDOR_ID_WACOM, 0xC0) }, | 810 | { USB_DEVICE(USB_VENDOR_ID_WACOM, 0xC0) }, |
811 | { USB_DEVICE(USB_VENDOR_ID_WACOM, 0xC3) }, | ||
782 | { USB_DEVICE(USB_VENDOR_ID_WACOM, 0x03) }, | 812 | { USB_DEVICE(USB_VENDOR_ID_WACOM, 0x03) }, |
783 | { USB_DEVICE(USB_VENDOR_ID_WACOM, 0x41) }, | 813 | { USB_DEVICE(USB_VENDOR_ID_WACOM, 0x41) }, |
784 | { USB_DEVICE(USB_VENDOR_ID_WACOM, 0x42) }, | 814 | { USB_DEVICE(USB_VENDOR_ID_WACOM, 0x42) }, |
@@ -788,6 +818,8 @@ static struct usb_device_id wacom_ids[] = { | |||
788 | { USB_DEVICE(USB_VENDOR_ID_WACOM, 0xB0) }, | 818 | { USB_DEVICE(USB_VENDOR_ID_WACOM, 0xB0) }, |
789 | { USB_DEVICE(USB_VENDOR_ID_WACOM, 0xB1) }, | 819 | { USB_DEVICE(USB_VENDOR_ID_WACOM, 0xB1) }, |
790 | { USB_DEVICE(USB_VENDOR_ID_WACOM, 0xB2) }, | 820 | { USB_DEVICE(USB_VENDOR_ID_WACOM, 0xB2) }, |
821 | { USB_DEVICE(USB_VENDOR_ID_WACOM, 0xB3) }, | ||
822 | { USB_DEVICE(USB_VENDOR_ID_WACOM, 0xB4) }, | ||
791 | { USB_DEVICE(USB_VENDOR_ID_WACOM, 0xB5) }, | 823 | { USB_DEVICE(USB_VENDOR_ID_WACOM, 0xB5) }, |
792 | { USB_DEVICE(USB_VENDOR_ID_WACOM, 0x3F) }, | 824 | { USB_DEVICE(USB_VENDOR_ID_WACOM, 0x3F) }, |
793 | { USB_DEVICE(USB_VENDOR_ID_WACOM, 0x47) }, | 825 | { USB_DEVICE(USB_VENDOR_ID_WACOM, 0x47) }, |
@@ -820,7 +852,7 @@ static int wacom_probe(struct usb_interface *intf, const struct usb_device_id *i | |||
820 | struct usb_endpoint_descriptor *endpoint; | 852 | struct usb_endpoint_descriptor *endpoint; |
821 | struct wacom *wacom; | 853 | struct wacom *wacom; |
822 | struct input_dev *input_dev; | 854 | struct input_dev *input_dev; |
823 | char rep_data[2] = {0x02, 0x02}; | 855 | char rep_data[2], limit = 0; |
824 | 856 | ||
825 | wacom = kzalloc(sizeof(struct wacom), GFP_KERNEL); | 857 | wacom = kzalloc(sizeof(struct wacom), GFP_KERNEL); |
826 | input_dev = input_allocate_device(); | 858 | input_dev = input_allocate_device(); |
@@ -857,6 +889,7 @@ static int wacom_probe(struct usb_interface *intf, const struct usb_device_id *i | |||
857 | input_set_abs_params(input_dev, ABS_X, 0, wacom->features->x_max, 4, 0); | 889 | input_set_abs_params(input_dev, ABS_X, 0, wacom->features->x_max, 4, 0); |
858 | input_set_abs_params(input_dev, ABS_Y, 0, wacom->features->y_max, 4, 0); | 890 | input_set_abs_params(input_dev, ABS_Y, 0, wacom->features->y_max, 4, 0); |
859 | input_set_abs_params(input_dev, ABS_PRESSURE, 0, wacom->features->pressure_max, 0, 0); | 891 | input_set_abs_params(input_dev, ABS_PRESSURE, 0, wacom->features->pressure_max, 0, 0); |
892 | input_dev->absbit[LONG(ABS_MISC)] |= BIT(ABS_MISC); | ||
860 | 893 | ||
861 | switch (wacom->features->type) { | 894 | switch (wacom->features->type) { |
862 | case WACOM_G4: | 895 | case WACOM_G4: |
@@ -875,6 +908,8 @@ static int wacom_probe(struct usb_interface *intf, const struct usb_device_id *i | |||
875 | break; | 908 | break; |
876 | 909 | ||
877 | case INTUOS3: | 910 | case INTUOS3: |
911 | case INTUOS312: | ||
912 | case INTUOS319: | ||
878 | case CINTIQ: | 913 | case CINTIQ: |
879 | input_dev->keybit[LONG(BTN_DIGI)] |= BIT(BTN_TOOL_FINGER); | 914 | input_dev->keybit[LONG(BTN_DIGI)] |= BIT(BTN_TOOL_FINGER); |
880 | input_dev->keybit[LONG(BTN_LEFT)] |= BIT(BTN_0) | BIT(BTN_1) | BIT(BTN_2) | BIT(BTN_3) | BIT(BTN_4) | BIT(BTN_5) | BIT(BTN_6) | BIT(BTN_7); | 915 | input_dev->keybit[LONG(BTN_LEFT)] |= BIT(BTN_0) | BIT(BTN_1) | BIT(BTN_2) | BIT(BTN_3) | BIT(BTN_4) | BIT(BTN_5) | BIT(BTN_6) | BIT(BTN_7); |
@@ -916,10 +951,13 @@ static int wacom_probe(struct usb_interface *intf, const struct usb_device_id *i | |||
916 | 951 | ||
917 | input_register_device(wacom->dev); | 952 | input_register_device(wacom->dev); |
918 | 953 | ||
919 | /* ask the tablet to report tablet data */ | 954 | /* Ask the tablet to report tablet data. Repeat until it succeeds */ |
920 | usb_set_report(intf, 3, 2, rep_data, 2); | 955 | do { |
921 | /* repeat once (not sure why the first call often fails) */ | 956 | rep_data[0] = 2; |
922 | usb_set_report(intf, 3, 2, rep_data, 2); | 957 | rep_data[1] = 2; |
958 | usb_set_report(intf, 3, 2, rep_data, 2); | ||
959 | usb_get_report(intf, 3, 2, rep_data, 2); | ||
960 | } while (rep_data[1] != 2 && limit++ < 5); | ||
923 | 961 | ||
924 | usb_set_intfdata(intf, wacom); | 962 | usb_set_intfdata(intf, wacom); |
925 | return 0; | 963 | return 0; |
diff --git a/drivers/usb/misc/emi26.c b/drivers/usb/misc/emi26.c index 3824df33094e..1fd9cb85f4ca 100644 --- a/drivers/usb/misc/emi26.c +++ b/drivers/usb/misc/emi26.c | |||
@@ -15,6 +15,7 @@ | |||
15 | #include <linux/module.h> | 15 | #include <linux/module.h> |
16 | #include <linux/init.h> | 16 | #include <linux/init.h> |
17 | #include <linux/usb.h> | 17 | #include <linux/usb.h> |
18 | #include <linux/delay.h> | ||
18 | 19 | ||
19 | #define MAX_INTEL_HEX_RECORD_LENGTH 16 | 20 | #define MAX_INTEL_HEX_RECORD_LENGTH 16 |
20 | typedef struct _INTEL_HEX_RECORD | 21 | typedef struct _INTEL_HEX_RECORD |
@@ -114,6 +115,7 @@ static int emi26_load_firmware (struct usb_device *dev) | |||
114 | 115 | ||
115 | /* De-assert reset (let the CPU run) */ | 116 | /* De-assert reset (let the CPU run) */ |
116 | err = emi26_set_reset(dev,0); | 117 | err = emi26_set_reset(dev,0); |
118 | msleep(250); /* let device settle */ | ||
117 | 119 | ||
118 | /* 2. We upload the FPGA firmware into the EMI | 120 | /* 2. We upload the FPGA firmware into the EMI |
119 | * Note: collect up to 1023 (yes!) bytes and send them with | 121 | * Note: collect up to 1023 (yes!) bytes and send them with |
@@ -150,6 +152,7 @@ static int emi26_load_firmware (struct usb_device *dev) | |||
150 | goto wraperr; | 152 | goto wraperr; |
151 | } | 153 | } |
152 | } | 154 | } |
155 | msleep(250); /* let device settle */ | ||
153 | 156 | ||
154 | /* De-assert reset (let the CPU run) */ | 157 | /* De-assert reset (let the CPU run) */ |
155 | err = emi26_set_reset(dev,0); | 158 | err = emi26_set_reset(dev,0); |
@@ -192,6 +195,7 @@ static int emi26_load_firmware (struct usb_device *dev) | |||
192 | err("%s - error loading firmware: error = %d", __FUNCTION__, err); | 195 | err("%s - error loading firmware: error = %d", __FUNCTION__, err); |
193 | goto wraperr; | 196 | goto wraperr; |
194 | } | 197 | } |
198 | msleep(250); /* let device settle */ | ||
195 | 199 | ||
196 | /* return 1 to fail the driver inialization | 200 | /* return 1 to fail the driver inialization |
197 | * and give real driver change to load */ | 201 | * and give real driver change to load */ |
diff --git a/drivers/usb/misc/emi62.c b/drivers/usb/misc/emi62.c index 52fea2e08db8..fe351371f274 100644 --- a/drivers/usb/misc/emi62.c +++ b/drivers/usb/misc/emi62.c | |||
@@ -15,6 +15,7 @@ | |||
15 | #include <linux/init.h> | 15 | #include <linux/init.h> |
16 | #include <linux/module.h> | 16 | #include <linux/module.h> |
17 | #include <linux/usb.h> | 17 | #include <linux/usb.h> |
18 | #include <linux/delay.h> | ||
18 | 19 | ||
19 | #define MAX_INTEL_HEX_RECORD_LENGTH 16 | 20 | #define MAX_INTEL_HEX_RECORD_LENGTH 16 |
20 | typedef struct _INTEL_HEX_RECORD | 21 | typedef struct _INTEL_HEX_RECORD |
@@ -123,6 +124,7 @@ static int emi62_load_firmware (struct usb_device *dev) | |||
123 | 124 | ||
124 | /* De-assert reset (let the CPU run) */ | 125 | /* De-assert reset (let the CPU run) */ |
125 | err = emi62_set_reset(dev,0); | 126 | err = emi62_set_reset(dev,0); |
127 | msleep(250); /* let device settle */ | ||
126 | 128 | ||
127 | /* 2. We upload the FPGA firmware into the EMI | 129 | /* 2. We upload the FPGA firmware into the EMI |
128 | * Note: collect up to 1023 (yes!) bytes and send them with | 130 | * Note: collect up to 1023 (yes!) bytes and send them with |
@@ -166,6 +168,7 @@ static int emi62_load_firmware (struct usb_device *dev) | |||
166 | err("%s - error loading firmware: error = %d", __FUNCTION__, err); | 168 | err("%s - error loading firmware: error = %d", __FUNCTION__, err); |
167 | goto wraperr; | 169 | goto wraperr; |
168 | } | 170 | } |
171 | msleep(250); /* let device settle */ | ||
169 | 172 | ||
170 | /* 4. We put the part of the firmware that lies in the external RAM into the EZ-USB */ | 173 | /* 4. We put the part of the firmware that lies in the external RAM into the EZ-USB */ |
171 | 174 | ||
@@ -228,6 +231,7 @@ static int emi62_load_firmware (struct usb_device *dev) | |||
228 | err("%s - error loading firmware: error = %d", __FUNCTION__, err); | 231 | err("%s - error loading firmware: error = %d", __FUNCTION__, err); |
229 | goto wraperr; | 232 | goto wraperr; |
230 | } | 233 | } |
234 | msleep(250); /* let device settle */ | ||
231 | 235 | ||
232 | kfree(buf); | 236 | kfree(buf); |
233 | 237 | ||
diff --git a/drivers/usb/misc/usbtest.c b/drivers/usb/misc/usbtest.c index 9d59b901841c..ccc5e8238bd8 100644 --- a/drivers/usb/misc/usbtest.c +++ b/drivers/usb/misc/usbtest.c | |||
@@ -381,6 +381,7 @@ alloc_sglist (int nents, int max, int vary) | |||
381 | 381 | ||
382 | for (i = 0; i < nents; i++) { | 382 | for (i = 0; i < nents; i++) { |
383 | char *buf; | 383 | char *buf; |
384 | unsigned j; | ||
384 | 385 | ||
385 | buf = kzalloc (size, SLAB_KERNEL); | 386 | buf = kzalloc (size, SLAB_KERNEL); |
386 | if (!buf) { | 387 | if (!buf) { |
@@ -391,6 +392,16 @@ alloc_sglist (int nents, int max, int vary) | |||
391 | /* kmalloc pages are always physically contiguous! */ | 392 | /* kmalloc pages are always physically contiguous! */ |
392 | sg_init_one(&sg[i], buf, size); | 393 | sg_init_one(&sg[i], buf, size); |
393 | 394 | ||
395 | switch (pattern) { | ||
396 | case 0: | ||
397 | /* already zeroed */ | ||
398 | break; | ||
399 | case 1: | ||
400 | for (j = 0; j < size; j++) | ||
401 | *buf++ = (u8) (j % 63); | ||
402 | break; | ||
403 | } | ||
404 | |||
394 | if (vary) { | 405 | if (vary) { |
395 | size += vary; | 406 | size += vary; |
396 | size %= max; | 407 | size %= max; |
@@ -425,6 +436,8 @@ static int perform_sglist ( | |||
425 | usb_sg_wait (req); | 436 | usb_sg_wait (req); |
426 | retval = req->status; | 437 | retval = req->status; |
427 | 438 | ||
439 | /* FIXME check resulting data pattern */ | ||
440 | |||
428 | /* FIXME if endpoint halted, clear halt (and log) */ | 441 | /* FIXME if endpoint halted, clear halt (and log) */ |
429 | } | 442 | } |
430 | 443 | ||
diff --git a/drivers/usb/net/asix.c b/drivers/usb/net/asix.c index 3094970615cb..12b599a0b539 100644 --- a/drivers/usb/net/asix.c +++ b/drivers/usb/net/asix.c | |||
@@ -37,7 +37,6 @@ | |||
37 | 37 | ||
38 | #include "usbnet.h" | 38 | #include "usbnet.h" |
39 | 39 | ||
40 | |||
41 | /* ASIX AX8817X based USB 2.0 Ethernet Devices */ | 40 | /* ASIX AX8817X based USB 2.0 Ethernet Devices */ |
42 | 41 | ||
43 | #define AX_CMD_SET_SW_MII 0x06 | 42 | #define AX_CMD_SET_SW_MII 0x06 |
@@ -109,7 +108,7 @@ | |||
109 | #define AX_EEPROM_MAGIC 0xdeadbeef | 108 | #define AX_EEPROM_MAGIC 0xdeadbeef |
110 | 109 | ||
111 | /* This structure cannot exceed sizeof(unsigned long [5]) AKA 20 bytes */ | 110 | /* This structure cannot exceed sizeof(unsigned long [5]) AKA 20 bytes */ |
112 | struct ax8817x_data { | 111 | struct asix_data { |
113 | u8 multi_filter[AX_MCAST_FILTER_SIZE]; | 112 | u8 multi_filter[AX_MCAST_FILTER_SIZE]; |
114 | }; | 113 | }; |
115 | 114 | ||
@@ -121,7 +120,7 @@ struct ax88172_int_data { | |||
121 | u16 res3; | 120 | u16 res3; |
122 | } __attribute__ ((packed)); | 121 | } __attribute__ ((packed)); |
123 | 122 | ||
124 | static int ax8817x_read_cmd(struct usbnet *dev, u8 cmd, u16 value, u16 index, | 123 | static int asix_read_cmd(struct usbnet *dev, u8 cmd, u16 value, u16 index, |
125 | u16 size, void *data) | 124 | u16 size, void *data) |
126 | { | 125 | { |
127 | return usb_control_msg( | 126 | return usb_control_msg( |
@@ -136,7 +135,7 @@ static int ax8817x_read_cmd(struct usbnet *dev, u8 cmd, u16 value, u16 index, | |||
136 | USB_CTRL_GET_TIMEOUT); | 135 | USB_CTRL_GET_TIMEOUT); |
137 | } | 136 | } |
138 | 137 | ||
139 | static int ax8817x_write_cmd(struct usbnet *dev, u8 cmd, u16 value, u16 index, | 138 | static int asix_write_cmd(struct usbnet *dev, u8 cmd, u16 value, u16 index, |
140 | u16 size, void *data) | 139 | u16 size, void *data) |
141 | { | 140 | { |
142 | return usb_control_msg( | 141 | return usb_control_msg( |
@@ -151,19 +150,80 @@ static int ax8817x_write_cmd(struct usbnet *dev, u8 cmd, u16 value, u16 index, | |||
151 | USB_CTRL_SET_TIMEOUT); | 150 | USB_CTRL_SET_TIMEOUT); |
152 | } | 151 | } |
153 | 152 | ||
154 | static void ax8817x_async_cmd_callback(struct urb *urb, struct pt_regs *regs) | 153 | static void asix_async_cmd_callback(struct urb *urb, struct pt_regs *regs) |
155 | { | 154 | { |
156 | struct usb_ctrlrequest *req = (struct usb_ctrlrequest *)urb->context; | 155 | struct usb_ctrlrequest *req = (struct usb_ctrlrequest *)urb->context; |
157 | 156 | ||
158 | if (urb->status < 0) | 157 | if (urb->status < 0) |
159 | printk(KERN_DEBUG "ax8817x_async_cmd_callback() failed with %d", | 158 | printk(KERN_DEBUG "asix_async_cmd_callback() failed with %d", |
160 | urb->status); | 159 | urb->status); |
161 | 160 | ||
162 | kfree(req); | 161 | kfree(req); |
163 | usb_free_urb(urb); | 162 | usb_free_urb(urb); |
164 | } | 163 | } |
165 | 164 | ||
166 | static void ax8817x_status(struct usbnet *dev, struct urb *urb) | 165 | static inline int asix_set_sw_mii(struct usbnet *dev) |
166 | { | ||
167 | int ret; | ||
168 | ret = asix_write_cmd(dev, AX_CMD_SET_SW_MII, 0x0000, 0, 0, NULL); | ||
169 | if (ret < 0) | ||
170 | devdbg(dev, "Failed to enable software MII access"); | ||
171 | return ret; | ||
172 | } | ||
173 | |||
174 | static inline int asix_set_hw_mii(struct usbnet *dev) | ||
175 | { | ||
176 | int ret; | ||
177 | ret = asix_write_cmd(dev, AX_CMD_SET_HW_MII, 0x0000, 0, 0, NULL); | ||
178 | if (ret < 0) | ||
179 | devdbg(dev, "Failed to enable hardware MII access"); | ||
180 | return ret; | ||
181 | } | ||
182 | |||
183 | static inline int asix_get_phyid(struct usbnet *dev) | ||
184 | { | ||
185 | int ret = 0; | ||
186 | void *buf; | ||
187 | |||
188 | buf = kmalloc(2, GFP_KERNEL); | ||
189 | if (!buf) | ||
190 | goto out1; | ||
191 | |||
192 | if ((ret = asix_read_cmd(dev, AX_CMD_READ_PHY_ID, | ||
193 | 0, 0, 2, buf)) < 2) { | ||
194 | devdbg(dev, "Error reading PHYID register: %02x", ret); | ||
195 | goto out2; | ||
196 | } | ||
197 | ret = *((u8 *)buf + 1); | ||
198 | out2: | ||
199 | kfree(buf); | ||
200 | out1: | ||
201 | return ret; | ||
202 | } | ||
203 | |||
204 | static int asix_sw_reset(struct usbnet *dev, u8 flags) | ||
205 | { | ||
206 | int ret; | ||
207 | |||
208 | ret = asix_write_cmd(dev, AX_CMD_SW_RESET, flags, 0, 0, NULL); | ||
209 | if (ret < 0) | ||
210 | devdbg(dev,"Failed to send software reset: %02x", ret); | ||
211 | |||
212 | return ret; | ||
213 | } | ||
214 | |||
215 | static int asix_write_rx_ctl(struct usbnet *dev, u16 mode) | ||
216 | { | ||
217 | int ret; | ||
218 | |||
219 | ret = asix_write_cmd(dev, AX_CMD_WRITE_RX_CTL, mode, 0, 0, NULL); | ||
220 | if (ret < 0) | ||
221 | devdbg(dev, "Failed to write RX_CTL mode: %02x", ret); | ||
222 | |||
223 | return ret; | ||
224 | } | ||
225 | |||
226 | static void asix_status(struct usbnet *dev, struct urb *urb) | ||
167 | { | 227 | { |
168 | struct ax88172_int_data *event; | 228 | struct ax88172_int_data *event; |
169 | int link; | 229 | int link; |
@@ -179,12 +239,12 @@ static void ax8817x_status(struct usbnet *dev, struct urb *urb) | |||
179 | usbnet_defer_kevent (dev, EVENT_LINK_RESET ); | 239 | usbnet_defer_kevent (dev, EVENT_LINK_RESET ); |
180 | } else | 240 | } else |
181 | netif_carrier_off(dev->net); | 241 | netif_carrier_off(dev->net); |
182 | devdbg(dev, "ax8817x - Link Status is: %d", link); | 242 | devdbg(dev, "Link Status is: %d", link); |
183 | } | 243 | } |
184 | } | 244 | } |
185 | 245 | ||
186 | static void | 246 | static void |
187 | ax8817x_write_cmd_async(struct usbnet *dev, u8 cmd, u16 value, u16 index, | 247 | asix_write_cmd_async(struct usbnet *dev, u8 cmd, u16 value, u16 index, |
188 | u16 size, void *data) | 248 | u16 size, void *data) |
189 | { | 249 | { |
190 | struct usb_ctrlrequest *req; | 250 | struct usb_ctrlrequest *req; |
@@ -211,7 +271,7 @@ ax8817x_write_cmd_async(struct usbnet *dev, u8 cmd, u16 value, u16 index, | |||
211 | usb_fill_control_urb(urb, dev->udev, | 271 | usb_fill_control_urb(urb, dev->udev, |
212 | usb_sndctrlpipe(dev->udev, 0), | 272 | usb_sndctrlpipe(dev->udev, 0), |
213 | (void *)req, data, size, | 273 | (void *)req, data, size, |
214 | ax8817x_async_cmd_callback, req); | 274 | asix_async_cmd_callback, req); |
215 | 275 | ||
216 | if((status = usb_submit_urb(urb, GFP_ATOMIC)) < 0) { | 276 | if((status = usb_submit_urb(urb, GFP_ATOMIC)) < 0) { |
217 | deverr(dev, "Error submitting the control message: status=%d", | 277 | deverr(dev, "Error submitting the control message: status=%d", |
@@ -221,10 +281,10 @@ ax8817x_write_cmd_async(struct usbnet *dev, u8 cmd, u16 value, u16 index, | |||
221 | } | 281 | } |
222 | } | 282 | } |
223 | 283 | ||
224 | static void ax8817x_set_multicast(struct net_device *net) | 284 | static void asix_set_multicast(struct net_device *net) |
225 | { | 285 | { |
226 | struct usbnet *dev = netdev_priv(net); | 286 | struct usbnet *dev = netdev_priv(net); |
227 | struct ax8817x_data *data = (struct ax8817x_data *)&dev->data; | 287 | struct asix_data *data = (struct asix_data *)&dev->data; |
228 | u8 rx_ctl = 0x8c; | 288 | u8 rx_ctl = 0x8c; |
229 | 289 | ||
230 | if (net->flags & IFF_PROMISC) { | 290 | if (net->flags & IFF_PROMISC) { |
@@ -255,53 +315,51 @@ static void ax8817x_set_multicast(struct net_device *net) | |||
255 | mc_list = mc_list->next; | 315 | mc_list = mc_list->next; |
256 | } | 316 | } |
257 | 317 | ||
258 | ax8817x_write_cmd_async(dev, AX_CMD_WRITE_MULTI_FILTER, 0, 0, | 318 | asix_write_cmd_async(dev, AX_CMD_WRITE_MULTI_FILTER, 0, 0, |
259 | AX_MCAST_FILTER_SIZE, data->multi_filter); | 319 | AX_MCAST_FILTER_SIZE, data->multi_filter); |
260 | 320 | ||
261 | rx_ctl |= 0x10; | 321 | rx_ctl |= 0x10; |
262 | } | 322 | } |
263 | 323 | ||
264 | ax8817x_write_cmd_async(dev, AX_CMD_WRITE_RX_CTL, rx_ctl, 0, 0, NULL); | 324 | asix_write_cmd_async(dev, AX_CMD_WRITE_RX_CTL, rx_ctl, 0, 0, NULL); |
265 | } | 325 | } |
266 | 326 | ||
267 | static int ax8817x_mdio_read(struct net_device *netdev, int phy_id, int loc) | 327 | static int asix_mdio_read(struct net_device *netdev, int phy_id, int loc) |
268 | { | 328 | { |
269 | struct usbnet *dev = netdev_priv(netdev); | 329 | struct usbnet *dev = netdev_priv(netdev); |
270 | u16 res; | 330 | u16 res; |
271 | u8 buf[1]; | ||
272 | 331 | ||
273 | ax8817x_write_cmd(dev, AX_CMD_SET_SW_MII, 0, 0, 0, &buf); | 332 | asix_set_sw_mii(dev); |
274 | ax8817x_read_cmd(dev, AX_CMD_READ_MII_REG, phy_id, | 333 | asix_read_cmd(dev, AX_CMD_READ_MII_REG, phy_id, |
275 | (__u16)loc, 2, (u16 *)&res); | 334 | (__u16)loc, 2, (u16 *)&res); |
276 | ax8817x_write_cmd(dev, AX_CMD_SET_HW_MII, 0, 0, 0, &buf); | 335 | asix_set_hw_mii(dev); |
277 | 336 | ||
278 | return res & 0xffff; | 337 | return res & 0xffff; |
279 | } | 338 | } |
280 | 339 | ||
281 | /* same as above, but converts resulting value to cpu byte order */ | 340 | /* same as above, but converts resulting value to cpu byte order */ |
282 | static int ax8817x_mdio_read_le(struct net_device *netdev, int phy_id, int loc) | 341 | static int asix_mdio_read_le(struct net_device *netdev, int phy_id, int loc) |
283 | { | 342 | { |
284 | return le16_to_cpu(ax8817x_mdio_read(netdev,phy_id, loc)); | 343 | return le16_to_cpu(asix_mdio_read(netdev,phy_id, loc)); |
285 | } | 344 | } |
286 | 345 | ||
287 | static void | 346 | static void |
288 | ax8817x_mdio_write(struct net_device *netdev, int phy_id, int loc, int val) | 347 | asix_mdio_write(struct net_device *netdev, int phy_id, int loc, int val) |
289 | { | 348 | { |
290 | struct usbnet *dev = netdev_priv(netdev); | 349 | struct usbnet *dev = netdev_priv(netdev); |
291 | u16 res = val; | 350 | u16 res = val; |
292 | u8 buf[1]; | ||
293 | 351 | ||
294 | ax8817x_write_cmd(dev, AX_CMD_SET_SW_MII, 0, 0, 0, &buf); | 352 | asix_set_sw_mii(dev); |
295 | ax8817x_write_cmd(dev, AX_CMD_WRITE_MII_REG, phy_id, | 353 | asix_write_cmd(dev, AX_CMD_WRITE_MII_REG, phy_id, |
296 | (__u16)loc, 2, (u16 *)&res); | 354 | (__u16)loc, 2, (u16 *)&res); |
297 | ax8817x_write_cmd(dev, AX_CMD_SET_HW_MII, 0, 0, 0, &buf); | 355 | asix_set_hw_mii(dev); |
298 | } | 356 | } |
299 | 357 | ||
300 | /* same as above, but converts new value to le16 byte order before writing */ | 358 | /* same as above, but converts new value to le16 byte order before writing */ |
301 | static void | 359 | static void |
302 | ax8817x_mdio_write_le(struct net_device *netdev, int phy_id, int loc, int val) | 360 | asix_mdio_write_le(struct net_device *netdev, int phy_id, int loc, int val) |
303 | { | 361 | { |
304 | ax8817x_mdio_write( netdev, phy_id, loc, cpu_to_le16(val) ); | 362 | asix_mdio_write( netdev, phy_id, loc, cpu_to_le16(val) ); |
305 | } | 363 | } |
306 | 364 | ||
307 | static int ax88172_link_reset(struct usbnet *dev) | 365 | static int ax88172_link_reset(struct usbnet *dev) |
@@ -312,23 +370,23 @@ static int ax88172_link_reset(struct usbnet *dev) | |||
312 | u8 mode; | 370 | u8 mode; |
313 | 371 | ||
314 | mode = AX_MEDIUM_TX_ABORT_ALLOW | AX_MEDIUM_FLOW_CONTROL_EN; | 372 | mode = AX_MEDIUM_TX_ABORT_ALLOW | AX_MEDIUM_FLOW_CONTROL_EN; |
315 | lpa = ax8817x_mdio_read_le(dev->net, dev->mii.phy_id, MII_LPA); | 373 | lpa = asix_mdio_read_le(dev->net, dev->mii.phy_id, MII_LPA); |
316 | adv = ax8817x_mdio_read_le(dev->net, dev->mii.phy_id, MII_ADVERTISE); | 374 | adv = asix_mdio_read_le(dev->net, dev->mii.phy_id, MII_ADVERTISE); |
317 | res = mii_nway_result(lpa|adv); | 375 | res = mii_nway_result(lpa|adv); |
318 | if (res & LPA_DUPLEX) | 376 | if (res & LPA_DUPLEX) |
319 | mode |= AX_MEDIUM_FULL_DUPLEX; | 377 | mode |= AX_MEDIUM_FULL_DUPLEX; |
320 | ax8817x_write_cmd(dev, AX_CMD_WRITE_MEDIUM_MODE, mode, 0, 0, NULL); | 378 | asix_write_cmd(dev, AX_CMD_WRITE_MEDIUM_MODE, mode, 0, 0, NULL); |
321 | 379 | ||
322 | return 0; | 380 | return 0; |
323 | } | 381 | } |
324 | 382 | ||
325 | static void | 383 | static void |
326 | ax8817x_get_wol(struct net_device *net, struct ethtool_wolinfo *wolinfo) | 384 | asix_get_wol(struct net_device *net, struct ethtool_wolinfo *wolinfo) |
327 | { | 385 | { |
328 | struct usbnet *dev = netdev_priv(net); | 386 | struct usbnet *dev = netdev_priv(net); |
329 | u8 opt; | 387 | u8 opt; |
330 | 388 | ||
331 | if (ax8817x_read_cmd(dev, AX_CMD_READ_MONITOR_MODE, 0, 0, 1, &opt) < 0) { | 389 | if (asix_read_cmd(dev, AX_CMD_READ_MONITOR_MODE, 0, 0, 1, &opt) < 0) { |
332 | wolinfo->supported = 0; | 390 | wolinfo->supported = 0; |
333 | wolinfo->wolopts = 0; | 391 | wolinfo->wolopts = 0; |
334 | return; | 392 | return; |
@@ -344,7 +402,7 @@ ax8817x_get_wol(struct net_device *net, struct ethtool_wolinfo *wolinfo) | |||
344 | } | 402 | } |
345 | 403 | ||
346 | static int | 404 | static int |
347 | ax8817x_set_wol(struct net_device *net, struct ethtool_wolinfo *wolinfo) | 405 | asix_set_wol(struct net_device *net, struct ethtool_wolinfo *wolinfo) |
348 | { | 406 | { |
349 | struct usbnet *dev = netdev_priv(net); | 407 | struct usbnet *dev = netdev_priv(net); |
350 | u8 opt = 0; | 408 | u8 opt = 0; |
@@ -357,19 +415,19 @@ ax8817x_set_wol(struct net_device *net, struct ethtool_wolinfo *wolinfo) | |||
357 | if (opt != 0) | 415 | if (opt != 0) |
358 | opt |= AX_MONITOR_MODE; | 416 | opt |= AX_MONITOR_MODE; |
359 | 417 | ||
360 | if (ax8817x_write_cmd(dev, AX_CMD_WRITE_MONITOR_MODE, | 418 | if (asix_write_cmd(dev, AX_CMD_WRITE_MONITOR_MODE, |
361 | opt, 0, 0, &buf) < 0) | 419 | opt, 0, 0, &buf) < 0) |
362 | return -EINVAL; | 420 | return -EINVAL; |
363 | 421 | ||
364 | return 0; | 422 | return 0; |
365 | } | 423 | } |
366 | 424 | ||
367 | static int ax8817x_get_eeprom_len(struct net_device *net) | 425 | static int asix_get_eeprom_len(struct net_device *net) |
368 | { | 426 | { |
369 | return AX_EEPROM_LEN; | 427 | return AX_EEPROM_LEN; |
370 | } | 428 | } |
371 | 429 | ||
372 | static int ax8817x_get_eeprom(struct net_device *net, | 430 | static int asix_get_eeprom(struct net_device *net, |
373 | struct ethtool_eeprom *eeprom, u8 *data) | 431 | struct ethtool_eeprom *eeprom, u8 *data) |
374 | { | 432 | { |
375 | struct usbnet *dev = netdev_priv(net); | 433 | struct usbnet *dev = netdev_priv(net); |
@@ -386,14 +444,14 @@ static int ax8817x_get_eeprom(struct net_device *net, | |||
386 | 444 | ||
387 | /* ax8817x returns 2 bytes from eeprom on read */ | 445 | /* ax8817x returns 2 bytes from eeprom on read */ |
388 | for (i=0; i < eeprom->len / 2; i++) { | 446 | for (i=0; i < eeprom->len / 2; i++) { |
389 | if (ax8817x_read_cmd(dev, AX_CMD_READ_EEPROM, | 447 | if (asix_read_cmd(dev, AX_CMD_READ_EEPROM, |
390 | eeprom->offset + i, 0, 2, &ebuf[i]) < 0) | 448 | eeprom->offset + i, 0, 2, &ebuf[i]) < 0) |
391 | return -EINVAL; | 449 | return -EINVAL; |
392 | } | 450 | } |
393 | return 0; | 451 | return 0; |
394 | } | 452 | } |
395 | 453 | ||
396 | static void ax8817x_get_drvinfo (struct net_device *net, | 454 | static void asix_get_drvinfo (struct net_device *net, |
397 | struct ethtool_drvinfo *info) | 455 | struct ethtool_drvinfo *info) |
398 | { | 456 | { |
399 | /* Inherit standard device info */ | 457 | /* Inherit standard device info */ |
@@ -401,14 +459,14 @@ static void ax8817x_get_drvinfo (struct net_device *net, | |||
401 | info->eedump_len = 0x3e; | 459 | info->eedump_len = 0x3e; |
402 | } | 460 | } |
403 | 461 | ||
404 | static int ax8817x_get_settings(struct net_device *net, struct ethtool_cmd *cmd) | 462 | static int asix_get_settings(struct net_device *net, struct ethtool_cmd *cmd) |
405 | { | 463 | { |
406 | struct usbnet *dev = netdev_priv(net); | 464 | struct usbnet *dev = netdev_priv(net); |
407 | 465 | ||
408 | return mii_ethtool_gset(&dev->mii,cmd); | 466 | return mii_ethtool_gset(&dev->mii,cmd); |
409 | } | 467 | } |
410 | 468 | ||
411 | static int ax8817x_set_settings(struct net_device *net, struct ethtool_cmd *cmd) | 469 | static int asix_set_settings(struct net_device *net, struct ethtool_cmd *cmd) |
412 | { | 470 | { |
413 | struct usbnet *dev = netdev_priv(net); | 471 | struct usbnet *dev = netdev_priv(net); |
414 | 472 | ||
@@ -418,27 +476,27 @@ static int ax8817x_set_settings(struct net_device *net, struct ethtool_cmd *cmd) | |||
418 | /* We need to override some ethtool_ops so we require our | 476 | /* We need to override some ethtool_ops so we require our |
419 | own structure so we don't interfere with other usbnet | 477 | own structure so we don't interfere with other usbnet |
420 | devices that may be connected at the same time. */ | 478 | devices that may be connected at the same time. */ |
421 | static struct ethtool_ops ax8817x_ethtool_ops = { | 479 | static struct ethtool_ops ax88172_ethtool_ops = { |
422 | .get_drvinfo = ax8817x_get_drvinfo, | 480 | .get_drvinfo = asix_get_drvinfo, |
423 | .get_link = ethtool_op_get_link, | 481 | .get_link = ethtool_op_get_link, |
424 | .get_msglevel = usbnet_get_msglevel, | 482 | .get_msglevel = usbnet_get_msglevel, |
425 | .set_msglevel = usbnet_set_msglevel, | 483 | .set_msglevel = usbnet_set_msglevel, |
426 | .get_wol = ax8817x_get_wol, | 484 | .get_wol = asix_get_wol, |
427 | .set_wol = ax8817x_set_wol, | 485 | .set_wol = asix_set_wol, |
428 | .get_eeprom_len = ax8817x_get_eeprom_len, | 486 | .get_eeprom_len = asix_get_eeprom_len, |
429 | .get_eeprom = ax8817x_get_eeprom, | 487 | .get_eeprom = asix_get_eeprom, |
430 | .get_settings = ax8817x_get_settings, | 488 | .get_settings = asix_get_settings, |
431 | .set_settings = ax8817x_set_settings, | 489 | .set_settings = asix_set_settings, |
432 | }; | 490 | }; |
433 | 491 | ||
434 | static int ax8817x_ioctl (struct net_device *net, struct ifreq *rq, int cmd) | 492 | static int asix_ioctl (struct net_device *net, struct ifreq *rq, int cmd) |
435 | { | 493 | { |
436 | struct usbnet *dev = netdev_priv(net); | 494 | struct usbnet *dev = netdev_priv(net); |
437 | 495 | ||
438 | return generic_mii_ioctl(&dev->mii, if_mii(rq), cmd, NULL); | 496 | return generic_mii_ioctl(&dev->mii, if_mii(rq), cmd, NULL); |
439 | } | 497 | } |
440 | 498 | ||
441 | static int ax8817x_bind(struct usbnet *dev, struct usb_interface *intf) | 499 | static int ax88172_bind(struct usbnet *dev, struct usb_interface *intf) |
442 | { | 500 | { |
443 | int ret = 0; | 501 | int ret = 0; |
444 | void *buf; | 502 | void *buf; |
@@ -455,55 +513,39 @@ static int ax8817x_bind(struct usbnet *dev, struct usb_interface *intf) | |||
455 | 513 | ||
456 | /* Toggle the GPIOs in a manufacturer/model specific way */ | 514 | /* Toggle the GPIOs in a manufacturer/model specific way */ |
457 | for (i = 2; i >= 0; i--) { | 515 | for (i = 2; i >= 0; i--) { |
458 | if ((ret = ax8817x_write_cmd(dev, AX_CMD_WRITE_GPIOS, | 516 | if ((ret = asix_write_cmd(dev, AX_CMD_WRITE_GPIOS, |
459 | (gpio_bits >> (i * 8)) & 0xff, 0, 0, | 517 | (gpio_bits >> (i * 8)) & 0xff, 0, 0, |
460 | buf)) < 0) | 518 | buf)) < 0) |
461 | goto out2; | 519 | goto out2; |
462 | msleep(5); | 520 | msleep(5); |
463 | } | 521 | } |
464 | 522 | ||
465 | if ((ret = ax8817x_write_cmd(dev, AX_CMD_WRITE_RX_CTL, | 523 | if ((ret = asix_write_rx_ctl(dev,0x80)) < 0) |
466 | 0x80, 0, 0, buf)) < 0) { | ||
467 | dbg("send AX_CMD_WRITE_RX_CTL failed: %d", ret); | ||
468 | goto out2; | 524 | goto out2; |
469 | } | ||
470 | 525 | ||
471 | /* Get the MAC address */ | 526 | /* Get the MAC address */ |
472 | memset(buf, 0, ETH_ALEN); | 527 | memset(buf, 0, ETH_ALEN); |
473 | if ((ret = ax8817x_read_cmd(dev, AX_CMD_READ_NODE_ID, | 528 | if ((ret = asix_read_cmd(dev, AX_CMD_READ_NODE_ID, |
474 | 0, 0, 6, buf)) < 0) { | 529 | 0, 0, 6, buf)) < 0) { |
475 | dbg("read AX_CMD_READ_NODE_ID failed: %d", ret); | 530 | dbg("read AX_CMD_READ_NODE_ID failed: %d", ret); |
476 | goto out2; | 531 | goto out2; |
477 | } | 532 | } |
478 | memcpy(dev->net->dev_addr, buf, ETH_ALEN); | 533 | memcpy(dev->net->dev_addr, buf, ETH_ALEN); |
479 | 534 | ||
480 | /* Get the PHY id */ | ||
481 | if ((ret = ax8817x_read_cmd(dev, AX_CMD_READ_PHY_ID, | ||
482 | 0, 0, 2, buf)) < 0) { | ||
483 | dbg("error on read AX_CMD_READ_PHY_ID: %02x", ret); | ||
484 | goto out2; | ||
485 | } else if (ret < 2) { | ||
486 | /* this should always return 2 bytes */ | ||
487 | dbg("AX_CMD_READ_PHY_ID returned less than 2 bytes: ret=%02x", | ||
488 | ret); | ||
489 | ret = -EIO; | ||
490 | goto out2; | ||
491 | } | ||
492 | |||
493 | /* Initialize MII structure */ | 535 | /* Initialize MII structure */ |
494 | dev->mii.dev = dev->net; | 536 | dev->mii.dev = dev->net; |
495 | dev->mii.mdio_read = ax8817x_mdio_read; | 537 | dev->mii.mdio_read = asix_mdio_read; |
496 | dev->mii.mdio_write = ax8817x_mdio_write; | 538 | dev->mii.mdio_write = asix_mdio_write; |
497 | dev->mii.phy_id_mask = 0x3f; | 539 | dev->mii.phy_id_mask = 0x3f; |
498 | dev->mii.reg_num_mask = 0x1f; | 540 | dev->mii.reg_num_mask = 0x1f; |
499 | dev->mii.phy_id = *((u8 *)buf + 1); | 541 | dev->mii.phy_id = asix_get_phyid(dev); |
500 | dev->net->do_ioctl = ax8817x_ioctl; | 542 | dev->net->do_ioctl = asix_ioctl; |
501 | 543 | ||
502 | dev->net->set_multicast_list = ax8817x_set_multicast; | 544 | dev->net->set_multicast_list = asix_set_multicast; |
503 | dev->net->ethtool_ops = &ax8817x_ethtool_ops; | 545 | dev->net->ethtool_ops = &ax88172_ethtool_ops; |
504 | 546 | ||
505 | ax8817x_mdio_write_le(dev->net, dev->mii.phy_id, MII_BMCR, BMCR_RESET); | 547 | asix_mdio_write_le(dev->net, dev->mii.phy_id, MII_BMCR, BMCR_RESET); |
506 | ax8817x_mdio_write_le(dev->net, dev->mii.phy_id, MII_ADVERTISE, | 548 | asix_mdio_write_le(dev->net, dev->mii.phy_id, MII_ADVERTISE, |
507 | ADVERTISE_ALL | ADVERTISE_CSMA | ADVERTISE_PAUSE_CAP); | 549 | ADVERTISE_ALL | ADVERTISE_CSMA | ADVERTISE_PAUSE_CAP); |
508 | mii_nway_restart(&dev->mii); | 550 | mii_nway_restart(&dev->mii); |
509 | 551 | ||
@@ -515,16 +557,16 @@ out1: | |||
515 | } | 557 | } |
516 | 558 | ||
517 | static struct ethtool_ops ax88772_ethtool_ops = { | 559 | static struct ethtool_ops ax88772_ethtool_ops = { |
518 | .get_drvinfo = ax8817x_get_drvinfo, | 560 | .get_drvinfo = asix_get_drvinfo, |
519 | .get_link = ethtool_op_get_link, | 561 | .get_link = ethtool_op_get_link, |
520 | .get_msglevel = usbnet_get_msglevel, | 562 | .get_msglevel = usbnet_get_msglevel, |
521 | .set_msglevel = usbnet_set_msglevel, | 563 | .set_msglevel = usbnet_set_msglevel, |
522 | .get_wol = ax8817x_get_wol, | 564 | .get_wol = asix_get_wol, |
523 | .set_wol = ax8817x_set_wol, | 565 | .set_wol = asix_set_wol, |
524 | .get_eeprom_len = ax8817x_get_eeprom_len, | 566 | .get_eeprom_len = asix_get_eeprom_len, |
525 | .get_eeprom = ax8817x_get_eeprom, | 567 | .get_eeprom = asix_get_eeprom, |
526 | .get_settings = ax8817x_get_settings, | 568 | .get_settings = asix_get_settings, |
527 | .set_settings = ax8817x_set_settings, | 569 | .set_settings = asix_set_settings, |
528 | }; | 570 | }; |
529 | 571 | ||
530 | static int ax88772_bind(struct usbnet *dev, struct usb_interface *intf) | 572 | static int ax88772_bind(struct usbnet *dev, struct usb_interface *intf) |
@@ -541,62 +583,45 @@ static int ax88772_bind(struct usbnet *dev, struct usb_interface *intf) | |||
541 | goto out1; | 583 | goto out1; |
542 | } | 584 | } |
543 | 585 | ||
544 | if ((ret = ax8817x_write_cmd(dev, AX_CMD_WRITE_GPIOS, | 586 | if ((ret = asix_write_cmd(dev, AX_CMD_WRITE_GPIOS, |
545 | 0x00B0, 0, 0, buf)) < 0) | 587 | 0x00B0, 0, 0, buf)) < 0) |
546 | goto out2; | 588 | goto out2; |
547 | 589 | ||
548 | msleep(5); | 590 | msleep(5); |
549 | if ((ret = ax8817x_write_cmd(dev, AX_CMD_SW_PHY_SELECT, | 591 | if ((ret = asix_write_cmd(dev, AX_CMD_SW_PHY_SELECT, |
550 | 0x0001, 0, 0, buf)) < 0) { | 592 | 0x0001, 0, 0, buf)) < 0) { |
551 | dbg("Select PHY #1 failed: %d", ret); | 593 | dbg("Select PHY #1 failed: %d", ret); |
552 | goto out2; | 594 | goto out2; |
553 | } | 595 | } |
554 | 596 | ||
555 | if ((ret = ax8817x_write_cmd(dev, AX_CMD_SW_RESET, AX_SWRESET_IPPD, | 597 | if ((ret = asix_sw_reset(dev, AX_SWRESET_IPPD)) < 0) |
556 | 0, 0, buf)) < 0) { | ||
557 | dbg("Failed to power down internal PHY: %d", ret); | ||
558 | goto out2; | 598 | goto out2; |
559 | } | ||
560 | 599 | ||
561 | msleep(150); | 600 | msleep(150); |
562 | if ((ret = ax8817x_write_cmd(dev, AX_CMD_SW_RESET, AX_SWRESET_CLEAR, | 601 | if ((ret = asix_sw_reset(dev, AX_SWRESET_CLEAR)) < 0) |
563 | 0, 0, buf)) < 0) { | ||
564 | dbg("Failed to perform software reset: %d", ret); | ||
565 | goto out2; | 602 | goto out2; |
566 | } | ||
567 | 603 | ||
568 | msleep(150); | 604 | msleep(150); |
569 | if ((ret = ax8817x_write_cmd(dev, AX_CMD_SW_RESET, | 605 | if ((ret = asix_sw_reset(dev, AX_SWRESET_IPRL | AX_SWRESET_PRL)) < 0) |
570 | AX_SWRESET_IPRL | AX_SWRESET_PRL, | ||
571 | 0, 0, buf)) < 0) { | ||
572 | dbg("Failed to set Internal/External PHY reset control: %d", | ||
573 | ret); | ||
574 | goto out2; | 606 | goto out2; |
575 | } | ||
576 | 607 | ||
577 | msleep(150); | 608 | msleep(150); |
578 | if ((ret = ax8817x_write_cmd(dev, AX_CMD_WRITE_RX_CTL, | 609 | if ((ret = asix_write_rx_ctl(dev, 0x00)) < 0) |
579 | 0x0000, 0, 0, buf)) < 0) { | ||
580 | dbg("Failed to reset RX_CTL: %d", ret); | ||
581 | goto out2; | 610 | goto out2; |
582 | } | ||
583 | 611 | ||
584 | /* Get the MAC address */ | 612 | /* Get the MAC address */ |
585 | memset(buf, 0, ETH_ALEN); | 613 | memset(buf, 0, ETH_ALEN); |
586 | if ((ret = ax8817x_read_cmd(dev, AX88772_CMD_READ_NODE_ID, | 614 | if ((ret = asix_read_cmd(dev, AX88772_CMD_READ_NODE_ID, |
587 | 0, 0, ETH_ALEN, buf)) < 0) { | 615 | 0, 0, ETH_ALEN, buf)) < 0) { |
588 | dbg("Failed to read MAC address: %d", ret); | 616 | dbg("Failed to read MAC address: %d", ret); |
589 | goto out2; | 617 | goto out2; |
590 | } | 618 | } |
591 | memcpy(dev->net->dev_addr, buf, ETH_ALEN); | 619 | memcpy(dev->net->dev_addr, buf, ETH_ALEN); |
592 | 620 | ||
593 | if ((ret = ax8817x_write_cmd(dev, AX_CMD_SET_SW_MII, | 621 | if ((ret = asix_set_sw_mii(dev)) < 0) |
594 | 0, 0, 0, buf)) < 0) { | ||
595 | dbg("Enabling software MII failed: %d", ret); | ||
596 | goto out2; | 622 | goto out2; |
597 | } | ||
598 | 623 | ||
599 | if (((ret = ax8817x_read_cmd(dev, AX_CMD_READ_MII_REG, | 624 | if (((ret = asix_read_cmd(dev, AX_CMD_READ_MII_REG, |
600 | 0x0010, 2, 2, buf)) < 0) | 625 | 0x0010, 2, 2, buf)) < 0) |
601 | || (*((u16 *)buf) != 0x003b)) { | 626 | || (*((u16 *)buf) != 0x003b)) { |
602 | dbg("Read PHY register 2 must be 0x3b00: %d", ret); | 627 | dbg("Read PHY register 2 must be 0x3b00: %d", ret); |
@@ -605,74 +630,49 @@ static int ax88772_bind(struct usbnet *dev, struct usb_interface *intf) | |||
605 | 630 | ||
606 | /* Initialize MII structure */ | 631 | /* Initialize MII structure */ |
607 | dev->mii.dev = dev->net; | 632 | dev->mii.dev = dev->net; |
608 | dev->mii.mdio_read = ax8817x_mdio_read; | 633 | dev->mii.mdio_read = asix_mdio_read; |
609 | dev->mii.mdio_write = ax8817x_mdio_write; | 634 | dev->mii.mdio_write = asix_mdio_write; |
610 | dev->mii.phy_id_mask = 0xff; | 635 | dev->mii.phy_id_mask = 0xff; |
611 | dev->mii.reg_num_mask = 0xff; | 636 | dev->mii.reg_num_mask = 0xff; |
612 | dev->net->do_ioctl = ax8817x_ioctl; | 637 | dev->net->do_ioctl = asix_ioctl; |
638 | dev->mii.phy_id = asix_get_phyid(dev); | ||
613 | 639 | ||
614 | /* Get the PHY id */ | 640 | if ((ret = asix_sw_reset(dev, AX_SWRESET_PRL)) < 0) |
615 | if ((ret = ax8817x_read_cmd(dev, AX_CMD_READ_PHY_ID, | ||
616 | 0, 0, 2, buf)) < 0) { | ||
617 | dbg("Error reading PHY ID: %02x", ret); | ||
618 | goto out2; | 641 | goto out2; |
619 | } else if (ret < 2) { | ||
620 | /* this should always return 2 bytes */ | ||
621 | dbg("AX_CMD_READ_PHY_ID returned less than 2 bytes: ret=%02x", | ||
622 | ret); | ||
623 | ret = -EIO; | ||
624 | goto out2; | ||
625 | } | ||
626 | dev->mii.phy_id = *((u8 *)buf + 1); | ||
627 | 642 | ||
628 | if ((ret = ax8817x_write_cmd(dev, AX_CMD_SW_RESET, AX_SWRESET_PRL, | ||
629 | 0, 0, buf)) < 0) { | ||
630 | dbg("Set external PHY reset pin level: %d", ret); | ||
631 | goto out2; | ||
632 | } | ||
633 | msleep(150); | 643 | msleep(150); |
634 | if ((ret = ax8817x_write_cmd(dev, AX_CMD_SW_RESET, | 644 | |
635 | AX_SWRESET_IPRL | AX_SWRESET_PRL, | 645 | if ((ret = asix_sw_reset(dev, AX_SWRESET_IPRL | AX_SWRESET_PRL)) < 0) |
636 | 0, 0, buf)) < 0) { | ||
637 | dbg("Set Internal/External PHY reset control: %d", ret); | ||
638 | goto out2; | 646 | goto out2; |
639 | } | ||
640 | msleep(150); | ||
641 | 647 | ||
648 | msleep(150); | ||
642 | 649 | ||
643 | dev->net->set_multicast_list = ax8817x_set_multicast; | 650 | dev->net->set_multicast_list = asix_set_multicast; |
644 | dev->net->ethtool_ops = &ax88772_ethtool_ops; | 651 | dev->net->ethtool_ops = &ax88772_ethtool_ops; |
645 | 652 | ||
646 | ax8817x_mdio_write_le(dev->net, dev->mii.phy_id, MII_BMCR, BMCR_RESET); | 653 | asix_mdio_write_le(dev->net, dev->mii.phy_id, MII_BMCR, BMCR_RESET); |
647 | ax8817x_mdio_write_le(dev->net, dev->mii.phy_id, MII_ADVERTISE, | 654 | asix_mdio_write_le(dev->net, dev->mii.phy_id, MII_ADVERTISE, |
648 | ADVERTISE_ALL | ADVERTISE_CSMA); | 655 | ADVERTISE_ALL | ADVERTISE_CSMA); |
649 | mii_nway_restart(&dev->mii); | 656 | mii_nway_restart(&dev->mii); |
650 | 657 | ||
651 | if ((ret = ax8817x_write_cmd(dev, AX_CMD_WRITE_MEDIUM_MODE, | 658 | if ((ret = asix_write_cmd(dev, AX_CMD_WRITE_MEDIUM_MODE, |
652 | AX88772_MEDIUM_DEFAULT, 0, 0, buf)) < 0) { | 659 | AX88772_MEDIUM_DEFAULT, 0, 0, buf)) < 0) { |
653 | dbg("Write medium mode register: %d", ret); | 660 | dbg("Write medium mode register: %d", ret); |
654 | goto out2; | 661 | goto out2; |
655 | } | 662 | } |
656 | 663 | ||
657 | if ((ret = ax8817x_write_cmd(dev, AX_CMD_WRITE_IPG0, | 664 | if ((ret = asix_write_cmd(dev, AX_CMD_WRITE_IPG0, |
658 | AX88772_IPG0_DEFAULT | AX88772_IPG1_DEFAULT, | 665 | AX88772_IPG0_DEFAULT | AX88772_IPG1_DEFAULT, |
659 | AX88772_IPG2_DEFAULT, 0, buf)) < 0) { | 666 | AX88772_IPG2_DEFAULT, 0, buf)) < 0) { |
660 | dbg("Write IPG,IPG1,IPG2 failed: %d", ret); | 667 | dbg("Write IPG,IPG1,IPG2 failed: %d", ret); |
661 | goto out2; | 668 | goto out2; |
662 | } | 669 | } |
663 | if ((ret = | 670 | if ((ret = asix_set_hw_mii(dev)) < 0) |
664 | ax8817x_write_cmd(dev, AX_CMD_SET_HW_MII, 0, 0, 0, &buf)) < 0) { | ||
665 | dbg("Failed to set hardware MII: %02x", ret); | ||
666 | goto out2; | 671 | goto out2; |
667 | } | ||
668 | 672 | ||
669 | /* Set RX_CTL to default values with 2k buffer, and enable cactus */ | 673 | /* Set RX_CTL to default values with 2k buffer, and enable cactus */ |
670 | if ((ret = | 674 | if ((ret = asix_write_rx_ctl(dev, 0x0088)) < 0) |
671 | ax8817x_write_cmd(dev, AX_CMD_WRITE_RX_CTL, 0x0088, 0, 0, | ||
672 | buf)) < 0) { | ||
673 | dbg("Reset RX_CTL failed: %d", ret); | ||
674 | goto out2; | 675 | goto out2; |
675 | } | ||
676 | 676 | ||
677 | kfree(buf); | 677 | kfree(buf); |
678 | 678 | ||
@@ -794,23 +794,23 @@ static int ax88772_link_reset(struct usbnet *dev) | |||
794 | u16 mode; | 794 | u16 mode; |
795 | 795 | ||
796 | mode = AX88772_MEDIUM_DEFAULT; | 796 | mode = AX88772_MEDIUM_DEFAULT; |
797 | lpa = ax8817x_mdio_read_le(dev->net, dev->mii.phy_id, MII_LPA); | 797 | lpa = asix_mdio_read_le(dev->net, dev->mii.phy_id, MII_LPA); |
798 | adv = ax8817x_mdio_read_le(dev->net, dev->mii.phy_id, MII_ADVERTISE); | 798 | adv = asix_mdio_read_le(dev->net, dev->mii.phy_id, MII_ADVERTISE); |
799 | res = mii_nway_result(lpa|adv); | 799 | res = mii_nway_result(lpa|adv); |
800 | 800 | ||
801 | if ((res & LPA_DUPLEX) == 0) | 801 | if ((res & LPA_DUPLEX) == 0) |
802 | mode &= ~AX88772_MEDIUM_FULL_DUPLEX; | 802 | mode &= ~AX88772_MEDIUM_FULL_DUPLEX; |
803 | if ((res & LPA_100) == 0) | 803 | if ((res & LPA_100) == 0) |
804 | mode &= ~AX88772_MEDIUM_100MB; | 804 | mode &= ~AX88772_MEDIUM_100MB; |
805 | ax8817x_write_cmd(dev, AX_CMD_WRITE_MEDIUM_MODE, mode, 0, 0, NULL); | 805 | asix_write_cmd(dev, AX_CMD_WRITE_MEDIUM_MODE, mode, 0, 0, NULL); |
806 | 806 | ||
807 | return 0; | 807 | return 0; |
808 | } | 808 | } |
809 | 809 | ||
810 | static const struct driver_info ax8817x_info = { | 810 | static const struct driver_info ax8817x_info = { |
811 | .description = "ASIX AX8817x USB 2.0 Ethernet", | 811 | .description = "ASIX AX8817x USB 2.0 Ethernet", |
812 | .bind = ax8817x_bind, | 812 | .bind = ax88172_bind, |
813 | .status = ax8817x_status, | 813 | .status = asix_status, |
814 | .link_reset = ax88172_link_reset, | 814 | .link_reset = ax88172_link_reset, |
815 | .reset = ax88172_link_reset, | 815 | .reset = ax88172_link_reset, |
816 | .flags = FLAG_ETHER, | 816 | .flags = FLAG_ETHER, |
@@ -819,8 +819,8 @@ static const struct driver_info ax8817x_info = { | |||
819 | 819 | ||
820 | static const struct driver_info dlink_dub_e100_info = { | 820 | static const struct driver_info dlink_dub_e100_info = { |
821 | .description = "DLink DUB-E100 USB Ethernet", | 821 | .description = "DLink DUB-E100 USB Ethernet", |
822 | .bind = ax8817x_bind, | 822 | .bind = ax88172_bind, |
823 | .status = ax8817x_status, | 823 | .status = asix_status, |
824 | .link_reset = ax88172_link_reset, | 824 | .link_reset = ax88172_link_reset, |
825 | .reset = ax88172_link_reset, | 825 | .reset = ax88172_link_reset, |
826 | .flags = FLAG_ETHER, | 826 | .flags = FLAG_ETHER, |
@@ -829,8 +829,8 @@ static const struct driver_info dlink_dub_e100_info = { | |||
829 | 829 | ||
830 | static const struct driver_info netgear_fa120_info = { | 830 | static const struct driver_info netgear_fa120_info = { |
831 | .description = "Netgear FA-120 USB Ethernet", | 831 | .description = "Netgear FA-120 USB Ethernet", |
832 | .bind = ax8817x_bind, | 832 | .bind = ax88172_bind, |
833 | .status = ax8817x_status, | 833 | .status = asix_status, |
834 | .link_reset = ax88172_link_reset, | 834 | .link_reset = ax88172_link_reset, |
835 | .reset = ax88172_link_reset, | 835 | .reset = ax88172_link_reset, |
836 | .flags = FLAG_ETHER, | 836 | .flags = FLAG_ETHER, |
@@ -839,8 +839,8 @@ static const struct driver_info netgear_fa120_info = { | |||
839 | 839 | ||
840 | static const struct driver_info hawking_uf200_info = { | 840 | static const struct driver_info hawking_uf200_info = { |
841 | .description = "Hawking UF200 USB Ethernet", | 841 | .description = "Hawking UF200 USB Ethernet", |
842 | .bind = ax8817x_bind, | 842 | .bind = ax88172_bind, |
843 | .status = ax8817x_status, | 843 | .status = asix_status, |
844 | .link_reset = ax88172_link_reset, | 844 | .link_reset = ax88172_link_reset, |
845 | .reset = ax88172_link_reset, | 845 | .reset = ax88172_link_reset, |
846 | .flags = FLAG_ETHER, | 846 | .flags = FLAG_ETHER, |
@@ -850,13 +850,12 @@ static const struct driver_info hawking_uf200_info = { | |||
850 | static const struct driver_info ax88772_info = { | 850 | static const struct driver_info ax88772_info = { |
851 | .description = "ASIX AX88772 USB 2.0 Ethernet", | 851 | .description = "ASIX AX88772 USB 2.0 Ethernet", |
852 | .bind = ax88772_bind, | 852 | .bind = ax88772_bind, |
853 | .status = ax8817x_status, | 853 | .status = asix_status, |
854 | .link_reset = ax88772_link_reset, | 854 | .link_reset = ax88772_link_reset, |
855 | .reset = ax88772_link_reset, | 855 | .reset = ax88772_link_reset, |
856 | .flags = FLAG_ETHER | FLAG_FRAMING_AX, | 856 | .flags = FLAG_ETHER | FLAG_FRAMING_AX, |
857 | .rx_fixup = ax88772_rx_fixup, | 857 | .rx_fixup = ax88772_rx_fixup, |
858 | .tx_fixup = ax88772_tx_fixup, | 858 | .tx_fixup = ax88772_tx_fixup, |
859 | .data = 0x00130103, | ||
860 | }; | 859 | }; |
861 | 860 | ||
862 | static const struct usb_device_id products [] = { | 861 | static const struct usb_device_id products [] = { |
diff --git a/drivers/usb/net/pegasus.c b/drivers/usb/net/pegasus.c index 5b6675684567..7683926a1b6f 100644 --- a/drivers/usb/net/pegasus.c +++ b/drivers/usb/net/pegasus.c | |||
@@ -262,7 +262,7 @@ static int set_register(pegasus_t * pegasus, __u16 indx, __u8 data) | |||
262 | usb_fill_control_urb(pegasus->ctrl_urb, pegasus->usb, | 262 | usb_fill_control_urb(pegasus->ctrl_urb, pegasus->usb, |
263 | usb_sndctrlpipe(pegasus->usb, 0), | 263 | usb_sndctrlpipe(pegasus->usb, 0), |
264 | (char *) &pegasus->dr, | 264 | (char *) &pegasus->dr, |
265 | &tmp, 1, ctrl_callback, pegasus); | 265 | tmp, 1, ctrl_callback, pegasus); |
266 | 266 | ||
267 | add_wait_queue(&pegasus->ctrl_wait, &wait); | 267 | add_wait_queue(&pegasus->ctrl_wait, &wait); |
268 | set_current_state(TASK_UNINTERRUPTIBLE); | 268 | set_current_state(TASK_UNINTERRUPTIBLE); |
@@ -318,6 +318,8 @@ static int read_mii_word(pegasus_t * pegasus, __u8 phy, __u8 indx, __u16 * regd) | |||
318 | set_register(pegasus, PhyCtrl, (indx | PHY_READ)); | 318 | set_register(pegasus, PhyCtrl, (indx | PHY_READ)); |
319 | for (i = 0; i < REG_TIMEOUT; i++) { | 319 | for (i = 0; i < REG_TIMEOUT; i++) { |
320 | ret = get_registers(pegasus, PhyCtrl, 1, data); | 320 | ret = get_registers(pegasus, PhyCtrl, 1, data); |
321 | if (ret == -ESHUTDOWN) | ||
322 | goto fail; | ||
321 | if (data[0] & PHY_DONE) | 323 | if (data[0] & PHY_DONE) |
322 | break; | 324 | break; |
323 | } | 325 | } |
@@ -326,6 +328,7 @@ static int read_mii_word(pegasus_t * pegasus, __u8 phy, __u8 indx, __u16 * regd) | |||
326 | *regd = le16_to_cpu(regdi); | 328 | *regd = le16_to_cpu(regdi); |
327 | return ret; | 329 | return ret; |
328 | } | 330 | } |
331 | fail: | ||
329 | if (netif_msg_drv(pegasus)) | 332 | if (netif_msg_drv(pegasus)) |
330 | dev_warn(&pegasus->intf->dev, "fail %s\n", __FUNCTION__); | 333 | dev_warn(&pegasus->intf->dev, "fail %s\n", __FUNCTION__); |
331 | 334 | ||
@@ -354,12 +357,15 @@ static int write_mii_word(pegasus_t * pegasus, __u8 phy, __u8 indx, __u16 regd) | |||
354 | set_register(pegasus, PhyCtrl, (indx | PHY_WRITE)); | 357 | set_register(pegasus, PhyCtrl, (indx | PHY_WRITE)); |
355 | for (i = 0; i < REG_TIMEOUT; i++) { | 358 | for (i = 0; i < REG_TIMEOUT; i++) { |
356 | ret = get_registers(pegasus, PhyCtrl, 1, data); | 359 | ret = get_registers(pegasus, PhyCtrl, 1, data); |
360 | if (ret == -ESHUTDOWN) | ||
361 | goto fail; | ||
357 | if (data[0] & PHY_DONE) | 362 | if (data[0] & PHY_DONE) |
358 | break; | 363 | break; |
359 | } | 364 | } |
360 | if (i < REG_TIMEOUT) | 365 | if (i < REG_TIMEOUT) |
361 | return ret; | 366 | return ret; |
362 | 367 | ||
368 | fail: | ||
363 | if (netif_msg_drv(pegasus)) | 369 | if (netif_msg_drv(pegasus)) |
364 | dev_warn(&pegasus->intf->dev, "fail %s\n", __FUNCTION__); | 370 | dev_warn(&pegasus->intf->dev, "fail %s\n", __FUNCTION__); |
365 | return -ETIMEDOUT; | 371 | return -ETIMEDOUT; |
@@ -387,6 +393,8 @@ static int read_eprom_word(pegasus_t * pegasus, __u8 index, __u16 * retdata) | |||
387 | ret = get_registers(pegasus, EpromCtrl, 1, &tmp); | 393 | ret = get_registers(pegasus, EpromCtrl, 1, &tmp); |
388 | if (tmp & EPROM_DONE) | 394 | if (tmp & EPROM_DONE) |
389 | break; | 395 | break; |
396 | if (ret == -ESHUTDOWN) | ||
397 | goto fail; | ||
390 | } | 398 | } |
391 | if (i < REG_TIMEOUT) { | 399 | if (i < REG_TIMEOUT) { |
392 | ret = get_registers(pegasus, EpromData, 2, &retdatai); | 400 | ret = get_registers(pegasus, EpromData, 2, &retdatai); |
@@ -394,6 +402,7 @@ static int read_eprom_word(pegasus_t * pegasus, __u8 index, __u16 * retdata) | |||
394 | return ret; | 402 | return ret; |
395 | } | 403 | } |
396 | 404 | ||
405 | fail: | ||
397 | if (netif_msg_drv(pegasus)) | 406 | if (netif_msg_drv(pegasus)) |
398 | dev_warn(&pegasus->intf->dev, "fail %s\n", __FUNCTION__); | 407 | dev_warn(&pegasus->intf->dev, "fail %s\n", __FUNCTION__); |
399 | return -ETIMEDOUT; | 408 | return -ETIMEDOUT; |
@@ -433,12 +442,15 @@ static int write_eprom_word(pegasus_t * pegasus, __u8 index, __u16 data) | |||
433 | 442 | ||
434 | for (i = 0; i < REG_TIMEOUT; i++) { | 443 | for (i = 0; i < REG_TIMEOUT; i++) { |
435 | ret = get_registers(pegasus, EpromCtrl, 1, &tmp); | 444 | ret = get_registers(pegasus, EpromCtrl, 1, &tmp); |
445 | if (ret == -ESHUTDOWN) | ||
446 | goto fail; | ||
436 | if (tmp & EPROM_DONE) | 447 | if (tmp & EPROM_DONE) |
437 | break; | 448 | break; |
438 | } | 449 | } |
439 | disable_eprom_write(pegasus); | 450 | disable_eprom_write(pegasus); |
440 | if (i < REG_TIMEOUT) | 451 | if (i < REG_TIMEOUT) |
441 | return ret; | 452 | return ret; |
453 | fail: | ||
442 | if (netif_msg_drv(pegasus)) | 454 | if (netif_msg_drv(pegasus)) |
443 | dev_warn(&pegasus->intf->dev, "fail %s\n", __FUNCTION__); | 455 | dev_warn(&pegasus->intf->dev, "fail %s\n", __FUNCTION__); |
444 | return -ETIMEDOUT; | 456 | return -ETIMEDOUT; |
@@ -1378,9 +1390,8 @@ static int pegasus_suspend (struct usb_interface *intf, pm_message_t message) | |||
1378 | struct pegasus *pegasus = usb_get_intfdata(intf); | 1390 | struct pegasus *pegasus = usb_get_intfdata(intf); |
1379 | 1391 | ||
1380 | netif_device_detach (pegasus->net); | 1392 | netif_device_detach (pegasus->net); |
1393 | cancel_delayed_work(&pegasus->carrier_check); | ||
1381 | if (netif_running(pegasus->net)) { | 1394 | if (netif_running(pegasus->net)) { |
1382 | cancel_delayed_work(&pegasus->carrier_check); | ||
1383 | |||
1384 | usb_kill_urb(pegasus->rx_urb); | 1395 | usb_kill_urb(pegasus->rx_urb); |
1385 | usb_kill_urb(pegasus->intr_urb); | 1396 | usb_kill_urb(pegasus->intr_urb); |
1386 | } | 1397 | } |
@@ -1400,10 +1411,9 @@ static int pegasus_resume (struct usb_interface *intf) | |||
1400 | pegasus->intr_urb->status = 0; | 1411 | pegasus->intr_urb->status = 0; |
1401 | pegasus->intr_urb->actual_length = 0; | 1412 | pegasus->intr_urb->actual_length = 0; |
1402 | intr_callback(pegasus->intr_urb, NULL); | 1413 | intr_callback(pegasus->intr_urb, NULL); |
1403 | |||
1404 | queue_delayed_work(pegasus_workqueue, &pegasus->carrier_check, | ||
1405 | CARRIER_CHECK_DELAY); | ||
1406 | } | 1414 | } |
1415 | queue_delayed_work(pegasus_workqueue, &pegasus->carrier_check, | ||
1416 | CARRIER_CHECK_DELAY); | ||
1407 | return 0; | 1417 | return 0; |
1408 | } | 1418 | } |
1409 | 1419 | ||
diff --git a/drivers/usb/net/rndis_host.c b/drivers/usb/net/rndis_host.c index 49991ac1bf3b..94ddfe16fdda 100644 --- a/drivers/usb/net/rndis_host.c +++ b/drivers/usb/net/rndis_host.c | |||
@@ -39,6 +39,20 @@ | |||
39 | * RNDIS is NDIS remoted over USB. It's a MSFT variant of CDC ACM ... of | 39 | * RNDIS is NDIS remoted over USB. It's a MSFT variant of CDC ACM ... of |
40 | * course ACM was intended for modems, not Ethernet links! USB's standard | 40 | * course ACM was intended for modems, not Ethernet links! USB's standard |
41 | * for Ethernet links is "CDC Ethernet", which is significantly simpler. | 41 | * for Ethernet links is "CDC Ethernet", which is significantly simpler. |
42 | * | ||
43 | * NOTE that Microsoft's "RNDIS 1.0" specification is incomplete. Issues | ||
44 | * include: | ||
45 | * - Power management in particular relies on information that's scattered | ||
46 | * through other documentation, and which is incomplete or incorrect even | ||
47 | * there. | ||
48 | * - There are various undocumented protocol requirements, such as the | ||
49 | * need to send unused garbage in control-OUT messages. | ||
50 | * - In some cases, MS-Windows will emit undocumented requests; this | ||
51 | * matters more to peripheral implementations than host ones. | ||
52 | * | ||
53 | * For these reasons and others, ** USE OF RNDIS IS STRONGLY DISCOURAGED ** in | ||
54 | * favor of such non-proprietary alternatives as CDC Ethernet or the newer (and | ||
55 | * currently rare) "Ethernet Emulation Model" (EEM). | ||
42 | */ | 56 | */ |
43 | 57 | ||
44 | /* | 58 | /* |
@@ -72,17 +86,17 @@ struct rndis_msg_hdr { | |||
72 | */ | 86 | */ |
73 | #define RNDIS_MSG_PACKET ccpu2(0x00000001) /* 1-N packets */ | 87 | #define RNDIS_MSG_PACKET ccpu2(0x00000001) /* 1-N packets */ |
74 | #define RNDIS_MSG_INIT ccpu2(0x00000002) | 88 | #define RNDIS_MSG_INIT ccpu2(0x00000002) |
75 | #define RNDIS_MSG_INIT_C (RNDIS_MSG_INIT|RNDIS_MSG_COMPLETION) | 89 | #define RNDIS_MSG_INIT_C (RNDIS_MSG_INIT|RNDIS_MSG_COMPLETION) |
76 | #define RNDIS_MSG_HALT ccpu2(0x00000003) | 90 | #define RNDIS_MSG_HALT ccpu2(0x00000003) |
77 | #define RNDIS_MSG_QUERY ccpu2(0x00000004) | 91 | #define RNDIS_MSG_QUERY ccpu2(0x00000004) |
78 | #define RNDIS_MSG_QUERY_C (RNDIS_MSG_QUERY|RNDIS_MSG_COMPLETION) | 92 | #define RNDIS_MSG_QUERY_C (RNDIS_MSG_QUERY|RNDIS_MSG_COMPLETION) |
79 | #define RNDIS_MSG_SET ccpu2(0x00000005) | 93 | #define RNDIS_MSG_SET ccpu2(0x00000005) |
80 | #define RNDIS_MSG_SET_C (RNDIS_MSG_SET|RNDIS_MSG_COMPLETION) | 94 | #define RNDIS_MSG_SET_C (RNDIS_MSG_SET|RNDIS_MSG_COMPLETION) |
81 | #define RNDIS_MSG_RESET ccpu2(0x00000006) | 95 | #define RNDIS_MSG_RESET ccpu2(0x00000006) |
82 | #define RNDIS_MSG_RESET_C (RNDIS_MSG_RESET|RNDIS_MSG_COMPLETION) | 96 | #define RNDIS_MSG_RESET_C (RNDIS_MSG_RESET|RNDIS_MSG_COMPLETION) |
83 | #define RNDIS_MSG_INDICATE ccpu2(0x00000007) | 97 | #define RNDIS_MSG_INDICATE ccpu2(0x00000007) |
84 | #define RNDIS_MSG_KEEPALIVE ccpu2(0x00000008) | 98 | #define RNDIS_MSG_KEEPALIVE ccpu2(0x00000008) |
85 | #define RNDIS_MSG_KEEPALIVE_C (RNDIS_MSG_KEEPALIVE|RNDIS_MSG_COMPLETION) | 99 | #define RNDIS_MSG_KEEPALIVE_C (RNDIS_MSG_KEEPALIVE|RNDIS_MSG_COMPLETION) |
86 | 100 | ||
87 | /* codes for "status" field of completion messages */ | 101 | /* codes for "status" field of completion messages */ |
88 | #define RNDIS_STATUS_SUCCESS ccpu2(0x00000000) | 102 | #define RNDIS_STATUS_SUCCESS ccpu2(0x00000000) |
@@ -596,13 +610,13 @@ static struct usb_driver rndis_driver = { | |||
596 | 610 | ||
597 | static int __init rndis_init(void) | 611 | static int __init rndis_init(void) |
598 | { | 612 | { |
599 | return usb_register(&rndis_driver); | 613 | return usb_register(&rndis_driver); |
600 | } | 614 | } |
601 | module_init(rndis_init); | 615 | module_init(rndis_init); |
602 | 616 | ||
603 | static void __exit rndis_exit(void) | 617 | static void __exit rndis_exit(void) |
604 | { | 618 | { |
605 | usb_deregister(&rndis_driver); | 619 | usb_deregister(&rndis_driver); |
606 | } | 620 | } |
607 | module_exit(rndis_exit); | 621 | module_exit(rndis_exit); |
608 | 622 | ||
diff --git a/drivers/usb/serial/Kconfig b/drivers/usb/serial/Kconfig index 5a8a2c91c2b2..5c60be521561 100644 --- a/drivers/usb/serial/Kconfig +++ b/drivers/usb/serial/Kconfig | |||
@@ -71,6 +71,16 @@ config USB_SERIAL_ANYDATA | |||
71 | To compile this driver as a module, choose M here: the | 71 | To compile this driver as a module, choose M here: the |
72 | module will be called anydata. | 72 | module will be called anydata. |
73 | 73 | ||
74 | config USB_SERIAL_ARK3116 | ||
75 | tristate "USB ARK Micro 3116 USB Serial Driver (EXPERIMENTAL)" | ||
76 | depends on USB_SERIAL && EXPERIMENTAL | ||
77 | help | ||
78 | Say Y here if you want to use a ARK Micro 3116 USB to Serial | ||
79 | device. | ||
80 | |||
81 | To compile this driver as a module, choose M here: the | ||
82 | module will be called ark3116 | ||
83 | |||
74 | config USB_SERIAL_BELKIN | 84 | config USB_SERIAL_BELKIN |
75 | tristate "USB Belkin and Peracom Single Port Serial Driver" | 85 | tristate "USB Belkin and Peracom Single Port Serial Driver" |
76 | depends on USB_SERIAL | 86 | depends on USB_SERIAL |
@@ -158,6 +168,15 @@ config USB_SERIAL_FTDI_SIO | |||
158 | To compile this driver as a module, choose M here: the | 168 | To compile this driver as a module, choose M here: the |
159 | module will be called ftdi_sio. | 169 | module will be called ftdi_sio. |
160 | 170 | ||
171 | config USB_SERIAL_FUNSOFT | ||
172 | tristate "USB Fundamental Software Dongle Driver" | ||
173 | depends on USB_SERIAL | ||
174 | ---help--- | ||
175 | Say Y here if you want to use the Fundamental Software dongle. | ||
176 | |||
177 | To compile this driver as a module, choose M here: the | ||
178 | module will be called funsoft. | ||
179 | |||
161 | config USB_SERIAL_VISOR | 180 | config USB_SERIAL_VISOR |
162 | tristate "USB Handspring Visor / Palm m50x / Sony Clie Driver" | 181 | tristate "USB Handspring Visor / Palm m50x / Sony Clie Driver" |
163 | depends on USB_SERIAL | 182 | depends on USB_SERIAL |
diff --git a/drivers/usb/serial/Makefile b/drivers/usb/serial/Makefile index f7fe4172efed..5a0960fc9d3e 100644 --- a/drivers/usb/serial/Makefile +++ b/drivers/usb/serial/Makefile | |||
@@ -13,6 +13,7 @@ usbserial-objs := usb-serial.o generic.o bus.o $(usbserial-obj-y) | |||
13 | 13 | ||
14 | obj-$(CONFIG_USB_SERIAL_AIRPRIME) += airprime.o | 14 | obj-$(CONFIG_USB_SERIAL_AIRPRIME) += airprime.o |
15 | obj-$(CONFIG_USB_SERIAL_ANYDATA) += anydata.o | 15 | obj-$(CONFIG_USB_SERIAL_ANYDATA) += anydata.o |
16 | obj-$(CONFIG_USB_SERIAL_ARK3116) += ark3116.o | ||
16 | obj-$(CONFIG_USB_SERIAL_BELKIN) += belkin_sa.o | 17 | obj-$(CONFIG_USB_SERIAL_BELKIN) += belkin_sa.o |
17 | obj-$(CONFIG_USB_SERIAL_CP2101) += cp2101.o | 18 | obj-$(CONFIG_USB_SERIAL_CP2101) += cp2101.o |
18 | obj-$(CONFIG_USB_SERIAL_CYBERJACK) += cyberjack.o | 19 | obj-$(CONFIG_USB_SERIAL_CYBERJACK) += cyberjack.o |
@@ -22,6 +23,7 @@ obj-$(CONFIG_USB_SERIAL_EDGEPORT) += io_edgeport.o | |||
22 | obj-$(CONFIG_USB_SERIAL_EDGEPORT_TI) += io_ti.o | 23 | obj-$(CONFIG_USB_SERIAL_EDGEPORT_TI) += io_ti.o |
23 | obj-$(CONFIG_USB_SERIAL_EMPEG) += empeg.o | 24 | obj-$(CONFIG_USB_SERIAL_EMPEG) += empeg.o |
24 | obj-$(CONFIG_USB_SERIAL_FTDI_SIO) += ftdi_sio.o | 25 | obj-$(CONFIG_USB_SERIAL_FTDI_SIO) += ftdi_sio.o |
26 | obj-$(CONFIG_USB_SERIAL_FUNSOFT) += funsoft.o | ||
25 | obj-$(CONFIG_USB_SERIAL_GARMIN) += garmin_gps.o | 27 | obj-$(CONFIG_USB_SERIAL_GARMIN) += garmin_gps.o |
26 | obj-$(CONFIG_USB_SERIAL_HP4X) += hp4x.o | 28 | obj-$(CONFIG_USB_SERIAL_HP4X) += hp4x.o |
27 | obj-$(CONFIG_USB_SERIAL_IPAQ) += ipaq.o | 29 | obj-$(CONFIG_USB_SERIAL_IPAQ) += ipaq.o |
diff --git a/drivers/usb/serial/airprime.c b/drivers/usb/serial/airprime.c index dbf1f063098c..694b205f9b73 100644 --- a/drivers/usb/serial/airprime.c +++ b/drivers/usb/serial/airprime.c | |||
@@ -18,6 +18,7 @@ | |||
18 | static struct usb_device_id id_table [] = { | 18 | static struct usb_device_id id_table [] = { |
19 | { USB_DEVICE(0xf3d, 0x0112) }, /* AirPrime CDMA Wireless PC Card */ | 19 | { USB_DEVICE(0xf3d, 0x0112) }, /* AirPrime CDMA Wireless PC Card */ |
20 | { USB_DEVICE(0x1410, 0x1110) }, /* Novatel Wireless Merlin CDMA */ | 20 | { USB_DEVICE(0x1410, 0x1110) }, /* Novatel Wireless Merlin CDMA */ |
21 | { USB_DEVICE(0x1199, 0x0112) }, /* Sierra Wireless Aircard 580 */ | ||
21 | { }, | 22 | { }, |
22 | }; | 23 | }; |
23 | MODULE_DEVICE_TABLE(usb, id_table); | 24 | MODULE_DEVICE_TABLE(usb, id_table); |
diff --git a/drivers/usb/serial/ark3116.c b/drivers/usb/serial/ark3116.c new file mode 100644 index 000000000000..8dec796222a0 --- /dev/null +++ b/drivers/usb/serial/ark3116.c | |||
@@ -0,0 +1,465 @@ | |||
1 | /* | ||
2 | * ark3116 | ||
3 | * - implements a driver for the arkmicro ark3116 chipset (vendor=0x6547, | ||
4 | * productid=0x0232) (used in a datacable called KQ-U8A) | ||
5 | * | ||
6 | * - based on code by krisfx -> thanks !! | ||
7 | * (see http://www.linuxquestions.org/questions/showthread.php?p=2184457#post2184457) | ||
8 | * | ||
9 | * - based on logs created by usbsnoopy | ||
10 | * | ||
11 | * Author : Simon Schulz [ark3116_driver<AT>auctionant.de] | ||
12 | * | ||
13 | * This program is free software; you can redistribute it and/or modify it | ||
14 | * under the terms of the GNU General Public License as published by the | ||
15 | * Free Software Foundation; either version 2 of the License, or (at your | ||
16 | * option) any later version. | ||
17 | */ | ||
18 | |||
19 | #include <linux/kernel.h> | ||
20 | #include <linux/init.h> | ||
21 | #include <linux/tty.h> | ||
22 | #include <linux/module.h> | ||
23 | #include <linux/usb.h> | ||
24 | #include "usb-serial.h" | ||
25 | |||
26 | |||
27 | static int debug; | ||
28 | |||
29 | static struct usb_device_id id_table [] = { | ||
30 | { USB_DEVICE(0x6547, 0x0232) }, | ||
31 | { }, | ||
32 | }; | ||
33 | MODULE_DEVICE_TABLE(usb, id_table); | ||
34 | |||
35 | struct ark3116_private { | ||
36 | spinlock_t lock; | ||
37 | u8 termios_initialized; | ||
38 | }; | ||
39 | |||
40 | static inline void ARK3116_SND(struct usb_serial *serial, int seq, | ||
41 | __u8 request, __u8 requesttype, | ||
42 | __u16 value, __u16 index) | ||
43 | { | ||
44 | int result; | ||
45 | result = usb_control_msg(serial->dev, | ||
46 | usb_sndctrlpipe(serial->dev,0), | ||
47 | request, requesttype, value, index, | ||
48 | NULL,0x00, 1000); | ||
49 | dbg("%03d > ok",seq); | ||
50 | } | ||
51 | |||
52 | static inline void ARK3116_RCV(struct usb_serial *serial, int seq, | ||
53 | __u8 request, __u8 requesttype, | ||
54 | __u16 value, __u16 index, __u8 expected, | ||
55 | char *buf) | ||
56 | { | ||
57 | int result; | ||
58 | result = usb_control_msg(serial->dev, | ||
59 | usb_rcvctrlpipe(serial->dev,0), | ||
60 | request, requesttype, value, index, | ||
61 | buf, 0x0000001, 1000); | ||
62 | if (result) | ||
63 | dbg("%03d < %d bytes [0x%02X]",seq, result, buf[0]); | ||
64 | else | ||
65 | dbg("%03d < 0 bytes", seq); | ||
66 | } | ||
67 | |||
68 | |||
69 | static inline void ARK3116_RCV_QUIET(struct usb_serial *serial, | ||
70 | __u8 request, __u8 requesttype, | ||
71 | __u16 value, __u16 index, char *buf) | ||
72 | { | ||
73 | usb_control_msg(serial->dev, | ||
74 | usb_rcvctrlpipe(serial->dev,0), | ||
75 | request, requesttype, value, index, | ||
76 | buf, 0x0000001, 1000); | ||
77 | } | ||
78 | |||
79 | |||
80 | static int ark3116_attach(struct usb_serial *serial) | ||
81 | { | ||
82 | char *buf; | ||
83 | struct ark3116_private *priv; | ||
84 | int i; | ||
85 | |||
86 | for (i = 0; i < serial->num_ports; ++i) { | ||
87 | priv = kmalloc (sizeof (struct ark3116_private), GFP_KERNEL); | ||
88 | if (!priv) | ||
89 | goto cleanup; | ||
90 | memset (priv, 0x00, sizeof (struct ark3116_private)); | ||
91 | spin_lock_init(&priv->lock); | ||
92 | |||
93 | usb_set_serial_port_data(serial->port[i], priv); | ||
94 | } | ||
95 | |||
96 | buf = kmalloc(1, GFP_KERNEL); | ||
97 | if (!buf) { | ||
98 | dbg("error kmalloc -> out of mem ?"); | ||
99 | goto cleanup; | ||
100 | } | ||
101 | |||
102 | /* 3 */ | ||
103 | ARK3116_SND(serial, 3,0xFE,0x40,0x0008,0x0002); | ||
104 | ARK3116_SND(serial, 4,0xFE,0x40,0x0008,0x0001); | ||
105 | ARK3116_SND(serial, 5,0xFE,0x40,0x0000,0x0008); | ||
106 | ARK3116_SND(serial, 6,0xFE,0x40,0x0000,0x000B); | ||
107 | |||
108 | /* <-- seq7 */ | ||
109 | ARK3116_RCV(serial, 7,0xFE,0xC0,0x0000,0x0003, 0x00, buf); | ||
110 | ARK3116_SND(serial, 8,0xFE,0x40,0x0080,0x0003); | ||
111 | ARK3116_SND(serial, 9,0xFE,0x40,0x001A,0x0000); | ||
112 | ARK3116_SND(serial,10,0xFE,0x40,0x0000,0x0001); | ||
113 | ARK3116_SND(serial,11,0xFE,0x40,0x0000,0x0003); | ||
114 | |||
115 | /* <-- seq12 */ | ||
116 | ARK3116_RCV(serial,12,0xFE,0xC0,0x0000,0x0004, 0x00, buf); | ||
117 | ARK3116_SND(serial,13,0xFE,0x40,0x0000,0x0004); | ||
118 | |||
119 | /* 14 */ | ||
120 | ARK3116_RCV(serial,14,0xFE,0xC0,0x0000,0x0004, 0x00, buf); | ||
121 | ARK3116_SND(serial,15,0xFE,0x40,0x0000,0x0004); | ||
122 | |||
123 | /* 16 */ | ||
124 | ARK3116_RCV(serial,16,0xFE,0xC0,0x0000,0x0004, 0x00, buf); | ||
125 | /* --> seq17 */ | ||
126 | ARK3116_SND(serial,17,0xFE,0x40,0x0001,0x0004); | ||
127 | |||
128 | /* <-- seq18 */ | ||
129 | ARK3116_RCV(serial,18,0xFE,0xC0,0x0000,0x0004, 0x01, buf); | ||
130 | |||
131 | /* --> seq19 */ | ||
132 | ARK3116_SND(serial,19,0xFE,0x40,0x0003,0x0004); | ||
133 | |||
134 | |||
135 | /* <-- seq20 */ | ||
136 | /* seems like serial port status info (RTS, CTS,...) */ | ||
137 | /* returns modem control line status ?! */ | ||
138 | ARK3116_RCV(serial,20,0xFE,0xC0,0x0000,0x0006, 0xFF, buf); | ||
139 | |||
140 | /* set 9600 baud & do some init ?! */ | ||
141 | ARK3116_SND(serial,147,0xFE,0x40,0x0083,0x0003); | ||
142 | ARK3116_SND(serial,148,0xFE,0x40,0x0038,0x0000); | ||
143 | ARK3116_SND(serial,149,0xFE,0x40,0x0001,0x0001); | ||
144 | ARK3116_SND(serial,150,0xFE,0x40,0x0003,0x0003); | ||
145 | ARK3116_RCV(serial,151,0xFE,0xC0,0x0000,0x0004,0x03, buf); | ||
146 | ARK3116_SND(serial,152,0xFE,0x40,0x0000,0x0003); | ||
147 | ARK3116_RCV(serial,153,0xFE,0xC0,0x0000,0x0003,0x00, buf); | ||
148 | ARK3116_SND(serial,154,0xFE,0x40,0x0003,0x0003); | ||
149 | |||
150 | kfree(buf); | ||
151 | return(0); | ||
152 | |||
153 | cleanup: | ||
154 | for (--i; i>=0; --i) | ||
155 | usb_set_serial_port_data(serial->port[i], NULL); | ||
156 | return -ENOMEM; | ||
157 | } | ||
158 | |||
159 | static void ark3116_set_termios(struct usb_serial_port *port, | ||
160 | struct termios *old_termios) | ||
161 | { | ||
162 | struct usb_serial *serial = port->serial; | ||
163 | struct ark3116_private *priv = usb_get_serial_port_data(port); | ||
164 | unsigned int cflag = port->tty->termios->c_cflag; | ||
165 | unsigned long flags; | ||
166 | int baud; | ||
167 | int ark3116_baud; | ||
168 | char *buf; | ||
169 | char config; | ||
170 | |||
171 | config = 0; | ||
172 | |||
173 | dbg("%s - port %d", __FUNCTION__, port->number); | ||
174 | |||
175 | if ((!port->tty) || (!port->tty->termios)) { | ||
176 | dbg("%s - no tty structures", __FUNCTION__); | ||
177 | return; | ||
178 | } | ||
179 | |||
180 | spin_lock_irqsave(&priv->lock, flags); | ||
181 | if (!priv->termios_initialized) { | ||
182 | *(port->tty->termios) = tty_std_termios; | ||
183 | port->tty->termios->c_cflag = B9600 | CS8 | CREAD | HUPCL | CLOCAL; | ||
184 | priv->termios_initialized = 1; | ||
185 | } | ||
186 | spin_unlock_irqrestore(&priv->lock, flags); | ||
187 | |||
188 | cflag = port->tty->termios->c_cflag; | ||
189 | |||
190 | /* check that they really want us to change something: */ | ||
191 | if (old_termios) { | ||
192 | if ((cflag == old_termios->c_cflag) && | ||
193 | (RELEVANT_IFLAG(port->tty->termios->c_iflag) == | ||
194 | RELEVANT_IFLAG(old_termios->c_iflag))) { | ||
195 | dbg("%s - nothing to change...", __FUNCTION__); | ||
196 | return; | ||
197 | } | ||
198 | } | ||
199 | |||
200 | buf = kmalloc(1, GFP_KERNEL); | ||
201 | if (!buf) { | ||
202 | dbg("error kmalloc"); | ||
203 | return; | ||
204 | } | ||
205 | |||
206 | /* set data bit count (8/7/6/5) */ | ||
207 | if (cflag & CSIZE){ | ||
208 | switch (cflag & CSIZE){ | ||
209 | case CS5: | ||
210 | config |= 0x00; | ||
211 | dbg("setting CS5"); | ||
212 | break; | ||
213 | case CS6: | ||
214 | config |= 0x01; | ||
215 | dbg("setting CS6"); | ||
216 | break; | ||
217 | case CS7: | ||
218 | config |= 0x02; | ||
219 | dbg("setting CS7"); | ||
220 | break; | ||
221 | default: | ||
222 | err ("CSIZE was set but not CS5-CS8, using CS8!"); | ||
223 | case CS8: | ||
224 | config |= 0x03; | ||
225 | dbg("setting CS8"); | ||
226 | break; | ||
227 | } | ||
228 | } | ||
229 | |||
230 | /* set parity (NONE,EVEN,ODD) */ | ||
231 | if (cflag & PARENB){ | ||
232 | if (cflag & PARODD) { | ||
233 | config |= 0x08; | ||
234 | dbg("setting parity to ODD"); | ||
235 | } else { | ||
236 | config |= 0x18; | ||
237 | dbg("setting parity to EVEN"); | ||
238 | } | ||
239 | } else { | ||
240 | dbg("setting parity to NONE"); | ||
241 | } | ||
242 | |||
243 | /* SET STOPBIT (1/2) */ | ||
244 | if (cflag & CSTOPB) { | ||
245 | config |= 0x04; | ||
246 | dbg ("setting 2 stop bits"); | ||
247 | } else { | ||
248 | dbg ("setting 1 stop bit"); | ||
249 | } | ||
250 | |||
251 | |||
252 | /* set baudrate: */ | ||
253 | baud = 0; | ||
254 | switch (cflag & CBAUD){ | ||
255 | case B0: | ||
256 | err("can't set 0baud, using 9600 instead"); | ||
257 | break; | ||
258 | case B75: baud = 75; break; | ||
259 | case B150: baud = 150; break; | ||
260 | case B300: baud = 300; break; | ||
261 | case B600: baud = 600; break; | ||
262 | case B1200: baud = 1200; break; | ||
263 | case B1800: baud = 1800; break; | ||
264 | case B2400: baud = 2400; break; | ||
265 | case B4800: baud = 4800; break; | ||
266 | case B9600: baud = 9600; break; | ||
267 | case B19200: baud = 19200; break; | ||
268 | case B38400: baud = 38400; break; | ||
269 | case B57600: baud = 57600; break; | ||
270 | case B115200: baud = 115200; break; | ||
271 | case B230400: baud = 230400; break; | ||
272 | case B460800: baud = 460800; break; | ||
273 | default: | ||
274 | dbg("does not support the baudrate requested (fix it)"); | ||
275 | break; | ||
276 | } | ||
277 | |||
278 | /* set 9600 as default (if given baudrate is invalid for example) */ | ||
279 | if (baud == 0) | ||
280 | baud = 9600; | ||
281 | |||
282 | /* | ||
283 | * found by try'n'error, be careful, maybe there are other options | ||
284 | * for multiplicator etc! | ||
285 | */ | ||
286 | if (baud == 460800) | ||
287 | /* strange, for 460800 the formula is wrong | ||
288 | * (dont use round(), then 9600baud is wrong) */ | ||
289 | ark3116_baud = 7; | ||
290 | else | ||
291 | ark3116_baud = 3000000 / baud; | ||
292 | |||
293 | /* ? */ | ||
294 | ARK3116_RCV(serial,0,0xFE,0xC0,0x0000,0x0003, 0x03, buf); | ||
295 | /* offset = buf[0]; */ | ||
296 | /* offset = 0x03; */ | ||
297 | /* dbg("using 0x%04X as target for 0x0003:",0x0080+offset); */ | ||
298 | |||
299 | |||
300 | /* set baudrate */ | ||
301 | dbg("setting baudrate to %d (->reg=%d)",baud,ark3116_baud); | ||
302 | ARK3116_SND(serial,147,0xFE,0x40,0x0083,0x0003); | ||
303 | ARK3116_SND(serial,148,0xFE,0x40,(ark3116_baud & 0x00FF) ,0x0000); | ||
304 | ARK3116_SND(serial,149,0xFE,0x40,(ark3116_baud & 0xFF00)>>8,0x0001); | ||
305 | ARK3116_SND(serial,150,0xFE,0x40,0x0003,0x0003); | ||
306 | |||
307 | /* ? */ | ||
308 | ARK3116_RCV(serial,151,0xFE,0xC0,0x0000,0x0004,0x03, buf); | ||
309 | ARK3116_SND(serial,152,0xFE,0x40,0x0000,0x0003); | ||
310 | |||
311 | /* set data bit count, stop bit count & parity: */ | ||
312 | dbg("updating bit count, stop bit or parity (cfg=0x%02X)", config); | ||
313 | ARK3116_RCV(serial,153,0xFE,0xC0,0x0000,0x0003,0x00, buf); | ||
314 | ARK3116_SND(serial,154,0xFE,0x40,config,0x0003); | ||
315 | |||
316 | if (cflag & CRTSCTS) | ||
317 | dbg("CRTSCTS not supported by chipset ?!"); | ||
318 | |||
319 | /* TEST ARK3116_SND(154,0xFE,0x40,0xFFFF, 0x0006); */ | ||
320 | |||
321 | kfree(buf); | ||
322 | return; | ||
323 | } | ||
324 | |||
325 | static int ark3116_open(struct usb_serial_port *port, struct file *filp) | ||
326 | { | ||
327 | struct termios tmp_termios; | ||
328 | struct usb_serial *serial = port->serial; | ||
329 | char *buf; | ||
330 | int result = 0; | ||
331 | |||
332 | dbg("%s - port %d", __FUNCTION__, port->number); | ||
333 | |||
334 | buf = kmalloc(1, GFP_KERNEL); | ||
335 | if (!buf) { | ||
336 | dbg("error kmalloc -> out of mem ?"); | ||
337 | return -ENOMEM; | ||
338 | } | ||
339 | |||
340 | result = usb_serial_generic_open(port, filp); | ||
341 | if (result) | ||
342 | return result; | ||
343 | |||
344 | /* open */ | ||
345 | ARK3116_RCV(serial,111,0xFE,0xC0,0x0000,0x0003, 0x02, buf); | ||
346 | |||
347 | ARK3116_SND(serial,112,0xFE,0x40,0x0082,0x0003); | ||
348 | ARK3116_SND(serial,113,0xFE,0x40,0x001A,0x0000); | ||
349 | ARK3116_SND(serial,114,0xFE,0x40,0x0000,0x0001); | ||
350 | ARK3116_SND(serial,115,0xFE,0x40,0x0002,0x0003); | ||
351 | |||
352 | ARK3116_RCV(serial,116,0xFE,0xC0,0x0000,0x0004, 0x03, buf); | ||
353 | ARK3116_SND(serial,117,0xFE,0x40,0x0002,0x0004); | ||
354 | |||
355 | ARK3116_RCV(serial,118,0xFE,0xC0,0x0000,0x0004, 0x02, buf); | ||
356 | ARK3116_SND(serial,119,0xFE,0x40,0x0000,0x0004); | ||
357 | |||
358 | ARK3116_RCV(serial,120,0xFE,0xC0,0x0000,0x0004, 0x00, buf); | ||
359 | |||
360 | ARK3116_SND(serial,121,0xFE,0x40,0x0001,0x0004); | ||
361 | |||
362 | ARK3116_RCV(serial,122,0xFE,0xC0,0x0000,0x0004, 0x01, buf); | ||
363 | |||
364 | ARK3116_SND(serial,123,0xFE,0x40,0x0003,0x0004); | ||
365 | |||
366 | /* returns different values (control lines ?!) */ | ||
367 | ARK3116_RCV(serial,124,0xFE,0xC0,0x0000,0x0006, 0xFF, buf); | ||
368 | |||
369 | /* initialise termios: */ | ||
370 | if (port->tty) | ||
371 | ark3116_set_termios(port, &tmp_termios); | ||
372 | |||
373 | kfree(buf); | ||
374 | |||
375 | return result; | ||
376 | |||
377 | } | ||
378 | |||
379 | static int ark3116_ioctl(struct usb_serial_port *port, struct file *file, | ||
380 | unsigned int cmd, unsigned long arg) | ||
381 | { | ||
382 | dbg("ioctl not supported yet..."); | ||
383 | return -ENOIOCTLCMD; | ||
384 | } | ||
385 | |||
386 | static int ark3116_tiocmget(struct usb_serial_port *port, struct file *file) | ||
387 | { | ||
388 | struct usb_serial *serial = port->serial; | ||
389 | char *buf; | ||
390 | char temp; | ||
391 | |||
392 | /* seems like serial port status info (RTS, CTS,...) is stored | ||
393 | * in reg(?) 0x0006 | ||
394 | * pcb connection point 11 = GND -> sets bit4 of response | ||
395 | * pcb connection point 7 = GND -> sets bit6 of response | ||
396 | */ | ||
397 | |||
398 | buf = kmalloc(1, GFP_KERNEL); | ||
399 | if (!buf) { | ||
400 | dbg("error kmalloc"); | ||
401 | return -ENOMEM; | ||
402 | } | ||
403 | |||
404 | /* read register: */ | ||
405 | ARK3116_RCV_QUIET(serial,0xFE,0xC0,0x0000,0x0006,buf); | ||
406 | temp = buf[0]; | ||
407 | kfree(buf); | ||
408 | |||
409 | /* i do not really know if bit4=CTS and bit6=DSR... was just a | ||
410 | * quick guess !! | ||
411 | */ | ||
412 | return (temp & (1<<4) ? TIOCM_CTS : 0) | | ||
413 | (temp & (1<<6) ? TIOCM_DSR : 0); | ||
414 | } | ||
415 | |||
416 | static struct usb_driver ark3116_driver = { | ||
417 | .name = "ark3116", | ||
418 | .probe = usb_serial_probe, | ||
419 | .disconnect = usb_serial_disconnect, | ||
420 | .id_table = id_table, | ||
421 | }; | ||
422 | |||
423 | static struct usb_serial_driver ark3116_device = { | ||
424 | .driver = { | ||
425 | .owner = THIS_MODULE, | ||
426 | .name = "ark3116", | ||
427 | }, | ||
428 | .id_table = id_table, | ||
429 | .num_interrupt_in = 1, | ||
430 | .num_bulk_in = 1, | ||
431 | .num_bulk_out = 1, | ||
432 | .num_ports = 1, | ||
433 | .attach = ark3116_attach, | ||
434 | .set_termios = ark3116_set_termios, | ||
435 | .ioctl = ark3116_ioctl, | ||
436 | .tiocmget = ark3116_tiocmget, | ||
437 | .open = ark3116_open, | ||
438 | }; | ||
439 | |||
440 | static int __init ark3116_init(void) | ||
441 | { | ||
442 | int retval; | ||
443 | |||
444 | retval = usb_serial_register(&ark3116_device); | ||
445 | if (retval) | ||
446 | return retval; | ||
447 | retval = usb_register(&ark3116_driver); | ||
448 | if (retval) | ||
449 | usb_serial_deregister(&ark3116_device); | ||
450 | return retval; | ||
451 | } | ||
452 | |||
453 | static void __exit ark3116_exit(void) | ||
454 | { | ||
455 | usb_deregister(&ark3116_driver); | ||
456 | usb_serial_deregister(&ark3116_device); | ||
457 | } | ||
458 | |||
459 | module_init(ark3116_init); | ||
460 | module_exit(ark3116_exit); | ||
461 | MODULE_LICENSE("GPL"); | ||
462 | |||
463 | module_param(debug, bool, S_IRUGO | S_IWUSR); | ||
464 | MODULE_PARM_DESC(debug, "Debug enabled or not"); | ||
465 | |||
diff --git a/drivers/usb/serial/console.c b/drivers/usb/serial/console.c index 167f8ec56131..8023bb7279b1 100644 --- a/drivers/usb/serial/console.c +++ b/drivers/usb/serial/console.c | |||
@@ -54,7 +54,7 @@ static struct console usbcons; | |||
54 | * serial.c code, except that the specifier is "ttyUSB" instead | 54 | * serial.c code, except that the specifier is "ttyUSB" instead |
55 | * of "ttyS". | 55 | * of "ttyS". |
56 | */ | 56 | */ |
57 | static int __init usb_console_setup(struct console *co, char *options) | 57 | static int usb_console_setup(struct console *co, char *options) |
58 | { | 58 | { |
59 | struct usbcons_info *info = &usbcons_info; | 59 | struct usbcons_info *info = &usbcons_info; |
60 | int baud = 9600; | 60 | int baud = 9600; |
diff --git a/drivers/usb/serial/ftdi_sio.c b/drivers/usb/serial/ftdi_sio.c index f3af81b4dd29..986d7622273d 100644 --- a/drivers/usb/serial/ftdi_sio.c +++ b/drivers/usb/serial/ftdi_sio.c | |||
@@ -307,7 +307,9 @@ static struct ftdi_sio_quirk ftdi_HE_TIRA1_quirk = { | |||
307 | 307 | ||
308 | 308 | ||
309 | static struct usb_device_id id_table_combined [] = { | 309 | static struct usb_device_id id_table_combined [] = { |
310 | { USB_DEVICE(FTDI_VID, FTDI_ACTZWAVE_PID) }, | ||
310 | { USB_DEVICE(FTDI_VID, FTDI_IRTRANS_PID) }, | 311 | { USB_DEVICE(FTDI_VID, FTDI_IRTRANS_PID) }, |
312 | { USB_DEVICE(FTDI_VID, FTDI_IPLUS_PID) }, | ||
311 | { USB_DEVICE(FTDI_VID, FTDI_SIO_PID) }, | 313 | { USB_DEVICE(FTDI_VID, FTDI_SIO_PID) }, |
312 | { USB_DEVICE(FTDI_VID, FTDI_8U232AM_PID) }, | 314 | { USB_DEVICE(FTDI_VID, FTDI_8U232AM_PID) }, |
313 | { USB_DEVICE(FTDI_VID, FTDI_8U232AM_ALT_PID) }, | 315 | { USB_DEVICE(FTDI_VID, FTDI_8U232AM_ALT_PID) }, |
@@ -489,10 +491,15 @@ static struct usb_device_id id_table_combined [] = { | |||
489 | { USB_DEVICE(KOBIL_VID, KOBIL_CONV_KAAN_PID) }, | 491 | { USB_DEVICE(KOBIL_VID, KOBIL_CONV_KAAN_PID) }, |
490 | { USB_DEVICE(POSIFLEX_VID, POSIFLEX_PP7000_PID) }, | 492 | { USB_DEVICE(POSIFLEX_VID, POSIFLEX_PP7000_PID) }, |
491 | { USB_DEVICE(FTDI_VID, FTDI_TTUSB_PID) }, | 493 | { USB_DEVICE(FTDI_VID, FTDI_TTUSB_PID) }, |
494 | { USB_DEVICE(FTDI_VID, FTDI_ECLO_COM_1WIRE_PID) }, | ||
492 | { USB_DEVICE(FTDI_VID, FTDI_WESTREX_MODEL_777_PID) }, | 495 | { USB_DEVICE(FTDI_VID, FTDI_WESTREX_MODEL_777_PID) }, |
493 | { USB_DEVICE(FTDI_VID, FTDI_WESTREX_MODEL_8900F_PID) }, | 496 | { USB_DEVICE(FTDI_VID, FTDI_WESTREX_MODEL_8900F_PID) }, |
494 | { USB_DEVICE(FTDI_VID, FTDI_PCDJ_DAC2_PID) }, | 497 | { USB_DEVICE(FTDI_VID, FTDI_PCDJ_DAC2_PID) }, |
498 | { USB_DEVICE(FTDI_VID, FTDI_RRCIRKITS_LOCOBUFFER_PID) }, | ||
499 | { USB_DEVICE(FTDI_VID, FTDI_ASK_RDR400_PID) }, | ||
495 | { USB_DEVICE(ICOM_ID1_VID, ICOM_ID1_PID) }, | 500 | { USB_DEVICE(ICOM_ID1_VID, ICOM_ID1_PID) }, |
501 | { USB_DEVICE(PAPOUCH_VID, PAPOUCH_TMU_PID) }, | ||
502 | { USB_DEVICE(FTDI_VID, FTDI_ACG_HFDUAL_PID) }, | ||
496 | { }, /* Optional parameter entry */ | 503 | { }, /* Optional parameter entry */ |
497 | { } /* Terminating entry */ | 504 | { } /* Terminating entry */ |
498 | }; | 505 | }; |
diff --git a/drivers/usb/serial/ftdi_sio.h b/drivers/usb/serial/ftdi_sio.h index 8da773c2744d..d69a917e768f 100644 --- a/drivers/usb/serial/ftdi_sio.h +++ b/drivers/usb/serial/ftdi_sio.h | |||
@@ -32,6 +32,10 @@ | |||
32 | #define FTDI_NF_RIC_PID 0x0001 /* Product Id */ | 32 | #define FTDI_NF_RIC_PID 0x0001 /* Product Id */ |
33 | 33 | ||
34 | 34 | ||
35 | /* ACT Solutions HomePro ZWave interface (http://www.act-solutions.com/HomePro.htm) */ | ||
36 | #define FTDI_ACTZWAVE_PID 0xF2D0 | ||
37 | |||
38 | |||
35 | /* www.irtrans.de device */ | 39 | /* www.irtrans.de device */ |
36 | #define FTDI_IRTRANS_PID 0xFC60 /* Product Id */ | 40 | #define FTDI_IRTRANS_PID 0xFC60 /* Product Id */ |
37 | 41 | ||
@@ -39,6 +43,9 @@ | |||
39 | /* www.thoughttechnology.com/ TT-USB provide with procomp use ftdi_sio */ | 43 | /* www.thoughttechnology.com/ TT-USB provide with procomp use ftdi_sio */ |
40 | #define FTDI_TTUSB_PID 0xFF20 /* Product Id */ | 44 | #define FTDI_TTUSB_PID 0xFF20 /* Product Id */ |
41 | 45 | ||
46 | /* iPlus device */ | ||
47 | #define FTDI_IPLUS_PID 0xD070 /* Product Id */ | ||
48 | |||
42 | /* www.crystalfontz.com devices - thanx for providing free devices for evaluation ! */ | 49 | /* www.crystalfontz.com devices - thanx for providing free devices for evaluation ! */ |
43 | /* they use the ftdi chipset for the USB interface and the vendor id is the same */ | 50 | /* they use the ftdi chipset for the USB interface and the vendor id is the same */ |
44 | #define FTDI_XF_632_PID 0xFC08 /* 632: 16x2 Character Display */ | 51 | #define FTDI_XF_632_PID 0xFC08 /* 632: 16x2 Character Display */ |
@@ -153,6 +160,11 @@ | |||
153 | #define ICOM_ID1_PID 0x0004 | 160 | #define ICOM_ID1_PID 0x0004 |
154 | 161 | ||
155 | /* | 162 | /* |
163 | * ASK.fr devices | ||
164 | */ | ||
165 | #define FTDI_ASK_RDR400_PID 0xC991 /* ASK RDR 400 series card reader */ | ||
166 | |||
167 | /* | ||
156 | * DSS-20 Sync Station for Sony Ericsson P800 | 168 | * DSS-20 Sync Station for Sony Ericsson P800 |
157 | */ | 169 | */ |
158 | 170 | ||
@@ -399,6 +411,31 @@ | |||
399 | #define FTDI_WESTREX_MODEL_777_PID 0xDC00 /* Model 777 */ | 411 | #define FTDI_WESTREX_MODEL_777_PID 0xDC00 /* Model 777 */ |
400 | #define FTDI_WESTREX_MODEL_8900F_PID 0xDC01 /* Model 8900F */ | 412 | #define FTDI_WESTREX_MODEL_8900F_PID 0xDC01 /* Model 8900F */ |
401 | 413 | ||
414 | /* | ||
415 | * RR-CirKits LocoBuffer USB (http://www.rr-cirkits.com) | ||
416 | */ | ||
417 | #define FTDI_RRCIRKITS_LOCOBUFFER_PID 0xc7d0 /* LocoBuffer USB */ | ||
418 | |||
419 | /* | ||
420 | * Eclo (http://www.eclo.pt/) product IDs. | ||
421 | * PID 0xEA90 submitted by Martin Grill. | ||
422 | */ | ||
423 | #define FTDI_ECLO_COM_1WIRE_PID 0xEA90 /* COM to 1-Wire USB adaptor */ | ||
424 | |||
425 | /* | ||
426 | * Papouch products (http://www.papouch.com/) | ||
427 | * Submitted by Folkert van Heusden | ||
428 | */ | ||
429 | |||
430 | #define PAPOUCH_VID 0x5050 /* Vendor ID */ | ||
431 | #define PAPOUCH_TMU_PID 0x0400 /* TMU USB Thermometer */ | ||
432 | |||
433 | /* | ||
434 | * ACG Identification Technologies GmbH products (http://www.acg.de/). | ||
435 | * Submitted by anton -at- goto10 -dot- org. | ||
436 | */ | ||
437 | #define FTDI_ACG_HFDUAL_PID 0xDD20 /* HF Dual ISO Reader (RFID) */ | ||
438 | |||
402 | /* Commands */ | 439 | /* Commands */ |
403 | #define FTDI_SIO_RESET 0 /* Reset the port */ | 440 | #define FTDI_SIO_RESET 0 /* Reset the port */ |
404 | #define FTDI_SIO_MODEM_CTRL 1 /* Set the modem control register */ | 441 | #define FTDI_SIO_MODEM_CTRL 1 /* Set the modem control register */ |
diff --git a/drivers/usb/serial/funsoft.c b/drivers/usb/serial/funsoft.c new file mode 100644 index 000000000000..803721b97e2e --- /dev/null +++ b/drivers/usb/serial/funsoft.c | |||
@@ -0,0 +1,65 @@ | |||
1 | /* | ||
2 | * Funsoft Serial USB driver | ||
3 | * | ||
4 | * Copyright (C) 2006 Greg Kroah-Hartman <gregkh@suse.de> | ||
5 | * | ||
6 | * This program is free software; you can redistribute it and/or | ||
7 | * modify it under the terms of the GNU General Public License version | ||
8 | * 2 as published by the Free Software Foundation. | ||
9 | */ | ||
10 | |||
11 | #include <linux/kernel.h> | ||
12 | #include <linux/init.h> | ||
13 | #include <linux/tty.h> | ||
14 | #include <linux/module.h> | ||
15 | #include <linux/usb.h> | ||
16 | #include "usb-serial.h" | ||
17 | |||
18 | static struct usb_device_id id_table [] = { | ||
19 | { USB_DEVICE(0x1404, 0xcddc) }, | ||
20 | { }, | ||
21 | }; | ||
22 | MODULE_DEVICE_TABLE(usb, id_table); | ||
23 | |||
24 | static struct usb_driver funsoft_driver = { | ||
25 | .name = "funsoft", | ||
26 | .probe = usb_serial_probe, | ||
27 | .disconnect = usb_serial_disconnect, | ||
28 | .id_table = id_table, | ||
29 | .no_dynamic_id = 1, | ||
30 | }; | ||
31 | |||
32 | static struct usb_serial_driver funsoft_device = { | ||
33 | .driver = { | ||
34 | .owner = THIS_MODULE, | ||
35 | .name = "funsoft", | ||
36 | }, | ||
37 | .id_table = id_table, | ||
38 | .num_interrupt_in = NUM_DONT_CARE, | ||
39 | .num_bulk_in = NUM_DONT_CARE, | ||
40 | .num_bulk_out = NUM_DONT_CARE, | ||
41 | .num_ports = 1, | ||
42 | }; | ||
43 | |||
44 | static int __init funsoft_init(void) | ||
45 | { | ||
46 | int retval; | ||
47 | |||
48 | retval = usb_serial_register(&funsoft_device); | ||
49 | if (retval) | ||
50 | return retval; | ||
51 | retval = usb_register(&funsoft_driver); | ||
52 | if (retval) | ||
53 | usb_serial_deregister(&funsoft_device); | ||
54 | return retval; | ||
55 | } | ||
56 | |||
57 | static void __exit funsoft_exit(void) | ||
58 | { | ||
59 | usb_deregister(&funsoft_driver); | ||
60 | usb_serial_deregister(&funsoft_device); | ||
61 | } | ||
62 | |||
63 | module_init(funsoft_init); | ||
64 | module_exit(funsoft_exit); | ||
65 | MODULE_LICENSE("GPL"); | ||
diff --git a/drivers/usb/serial/generic.c b/drivers/usb/serial/generic.c index 476cda107f4f..c62cc2876519 100644 --- a/drivers/usb/serial/generic.c +++ b/drivers/usb/serial/generic.c | |||
@@ -138,6 +138,7 @@ int usb_serial_generic_open (struct usb_serial_port *port, struct file *filp) | |||
138 | 138 | ||
139 | return result; | 139 | return result; |
140 | } | 140 | } |
141 | EXPORT_SYMBOL_GPL(usb_serial_generic_open); | ||
141 | 142 | ||
142 | static void generic_cleanup (struct usb_serial_port *port) | 143 | static void generic_cleanup (struct usb_serial_port *port) |
143 | { | 144 | { |
diff --git a/drivers/usb/serial/omninet.c b/drivers/usb/serial/omninet.c index 4d40704dea2c..238033a87092 100644 --- a/drivers/usb/serial/omninet.c +++ b/drivers/usb/serial/omninet.c | |||
@@ -257,14 +257,14 @@ static int omninet_write (struct usb_serial_port *port, const unsigned char *buf | |||
257 | return (0); | 257 | return (0); |
258 | } | 258 | } |
259 | 259 | ||
260 | spin_lock(&port->lock); | 260 | spin_lock(&wport->lock); |
261 | if (port->write_urb_busy) { | 261 | if (wport->write_urb_busy) { |
262 | spin_unlock(&port->lock); | 262 | spin_unlock(&wport->lock); |
263 | dbg("%s - already writing", __FUNCTION__); | 263 | dbg("%s - already writing", __FUNCTION__); |
264 | return 0; | 264 | return 0; |
265 | } | 265 | } |
266 | port->write_urb_busy = 1; | 266 | wport->write_urb_busy = 1; |
267 | spin_unlock(&port->lock); | 267 | spin_unlock(&wport->lock); |
268 | 268 | ||
269 | count = (count > OMNINET_BULKOUTSIZE) ? OMNINET_BULKOUTSIZE : count; | 269 | count = (count > OMNINET_BULKOUTSIZE) ? OMNINET_BULKOUTSIZE : count; |
270 | 270 | ||
@@ -283,7 +283,7 @@ static int omninet_write (struct usb_serial_port *port, const unsigned char *buf | |||
283 | wport->write_urb->dev = serial->dev; | 283 | wport->write_urb->dev = serial->dev; |
284 | result = usb_submit_urb(wport->write_urb, GFP_ATOMIC); | 284 | result = usb_submit_urb(wport->write_urb, GFP_ATOMIC); |
285 | if (result) { | 285 | if (result) { |
286 | port->write_urb_busy = 0; | 286 | wport->write_urb_busy = 0; |
287 | err("%s - failed submitting write urb, error %d", __FUNCTION__, result); | 287 | err("%s - failed submitting write urb, error %d", __FUNCTION__, result); |
288 | } else | 288 | } else |
289 | result = count; | 289 | result = count; |
diff --git a/drivers/usb/serial/pl2303.c b/drivers/usb/serial/pl2303.c index b3014fda645c..c96714bb1cb8 100644 --- a/drivers/usb/serial/pl2303.c +++ b/drivers/usb/serial/pl2303.c | |||
@@ -61,6 +61,7 @@ static struct usb_device_id id_table [] = { | |||
61 | { USB_DEVICE(ELCOM_VENDOR_ID, ELCOM_PRODUCT_ID) }, | 61 | { USB_DEVICE(ELCOM_VENDOR_ID, ELCOM_PRODUCT_ID) }, |
62 | { USB_DEVICE(ELCOM_VENDOR_ID, ELCOM_PRODUCT_ID_UCSGT) }, | 62 | { USB_DEVICE(ELCOM_VENDOR_ID, ELCOM_PRODUCT_ID_UCSGT) }, |
63 | { USB_DEVICE(ITEGNO_VENDOR_ID, ITEGNO_PRODUCT_ID) }, | 63 | { USB_DEVICE(ITEGNO_VENDOR_ID, ITEGNO_PRODUCT_ID) }, |
64 | { USB_DEVICE(ITEGNO_VENDOR_ID, ITEGNO_PRODUCT_ID_2080) }, | ||
64 | { USB_DEVICE(MA620_VENDOR_ID, MA620_PRODUCT_ID) }, | 65 | { USB_DEVICE(MA620_VENDOR_ID, MA620_PRODUCT_ID) }, |
65 | { USB_DEVICE(RATOC_VENDOR_ID, RATOC_PRODUCT_ID) }, | 66 | { USB_DEVICE(RATOC_VENDOR_ID, RATOC_PRODUCT_ID) }, |
66 | { USB_DEVICE(TRIPP_VENDOR_ID, TRIPP_PRODUCT_ID) }, | 67 | { USB_DEVICE(TRIPP_VENDOR_ID, TRIPP_PRODUCT_ID) }, |
@@ -78,6 +79,7 @@ static struct usb_device_id id_table [] = { | |||
78 | { USB_DEVICE(SAGEM_VENDOR_ID, SAGEM_PRODUCT_ID) }, | 79 | { USB_DEVICE(SAGEM_VENDOR_ID, SAGEM_PRODUCT_ID) }, |
79 | { USB_DEVICE(LEADTEK_VENDOR_ID, LEADTEK_9531_PRODUCT_ID) }, | 80 | { USB_DEVICE(LEADTEK_VENDOR_ID, LEADTEK_9531_PRODUCT_ID) }, |
80 | { USB_DEVICE(SPEEDDRAGON_VENDOR_ID, SPEEDDRAGON_PRODUCT_ID) }, | 81 | { USB_DEVICE(SPEEDDRAGON_VENDOR_ID, SPEEDDRAGON_PRODUCT_ID) }, |
82 | { USB_DEVICE(OTI_VENDOR_ID, OTI_PRODUCT_ID) }, | ||
81 | { } /* Terminating entry */ | 83 | { } /* Terminating entry */ |
82 | }; | 84 | }; |
83 | 85 | ||
diff --git a/drivers/usb/serial/pl2303.h b/drivers/usb/serial/pl2303.h index 77901d143979..7f29e81d3e35 100644 --- a/drivers/usb/serial/pl2303.h +++ b/drivers/usb/serial/pl2303.h | |||
@@ -26,6 +26,7 @@ | |||
26 | 26 | ||
27 | #define ITEGNO_VENDOR_ID 0x0eba | 27 | #define ITEGNO_VENDOR_ID 0x0eba |
28 | #define ITEGNO_PRODUCT_ID 0x1080 | 28 | #define ITEGNO_PRODUCT_ID 0x1080 |
29 | #define ITEGNO_PRODUCT_ID_2080 0x2080 | ||
29 | 30 | ||
30 | #define MA620_VENDOR_ID 0x0df7 | 31 | #define MA620_VENDOR_ID 0x0df7 |
31 | #define MA620_PRODUCT_ID 0x0620 | 32 | #define MA620_PRODUCT_ID 0x0620 |
@@ -79,3 +80,7 @@ | |||
79 | /* USB GSM cable from Speed Dragon Multimedia, Ltd */ | 80 | /* USB GSM cable from Speed Dragon Multimedia, Ltd */ |
80 | #define SPEEDDRAGON_VENDOR_ID 0x0e55 | 81 | #define SPEEDDRAGON_VENDOR_ID 0x0e55 |
81 | #define SPEEDDRAGON_PRODUCT_ID 0x110b | 82 | #define SPEEDDRAGON_PRODUCT_ID 0x110b |
83 | |||
84 | /* Ours Technology Inc DKU-5 clone, chipset: Prolific Technology Inc */ | ||
85 | #define OTI_VENDOR_ID 0x0ea0 | ||
86 | #define OTI_PRODUCT_ID 0x6858 | ||
diff --git a/drivers/usb/serial/usb-serial.c b/drivers/usb/serial/usb-serial.c index 097f4e8488fe..9c36f0ece20f 100644 --- a/drivers/usb/serial/usb-serial.c +++ b/drivers/usb/serial/usb-serial.c | |||
@@ -27,10 +27,10 @@ | |||
27 | #include <linux/module.h> | 27 | #include <linux/module.h> |
28 | #include <linux/moduleparam.h> | 28 | #include <linux/moduleparam.h> |
29 | #include <linux/spinlock.h> | 29 | #include <linux/spinlock.h> |
30 | #include <linux/mutex.h> | ||
30 | #include <linux/list.h> | 31 | #include <linux/list.h> |
31 | #include <linux/smp_lock.h> | 32 | #include <linux/smp_lock.h> |
32 | #include <asm/uaccess.h> | 33 | #include <asm/uaccess.h> |
33 | #include <asm/semaphore.h> | ||
34 | #include <linux/usb.h> | 34 | #include <linux/usb.h> |
35 | #include "usb-serial.h" | 35 | #include "usb-serial.h" |
36 | #include "pl2303.h" | 36 | #include "pl2303.h" |
@@ -189,11 +189,15 @@ static int serial_open (struct tty_struct *tty, struct file * filp) | |||
189 | 189 | ||
190 | portNumber = tty->index - serial->minor; | 190 | portNumber = tty->index - serial->minor; |
191 | port = serial->port[portNumber]; | 191 | port = serial->port[portNumber]; |
192 | if (!port) | 192 | if (!port) { |
193 | return -ENODEV; | 193 | retval = -ENODEV; |
194 | goto bailout_kref_put; | ||
195 | } | ||
194 | 196 | ||
195 | if (down_interruptible(&port->sem)) | 197 | if (mutex_lock_interruptible(&port->mutex)) { |
196 | return -ERESTARTSYS; | 198 | retval = -ERESTARTSYS; |
199 | goto bailout_kref_put; | ||
200 | } | ||
197 | 201 | ||
198 | ++port->open_count; | 202 | ++port->open_count; |
199 | 203 | ||
@@ -209,7 +213,7 @@ static int serial_open (struct tty_struct *tty, struct file * filp) | |||
209 | * safe because we are called with BKL held */ | 213 | * safe because we are called with BKL held */ |
210 | if (!try_module_get(serial->type->driver.owner)) { | 214 | if (!try_module_get(serial->type->driver.owner)) { |
211 | retval = -ENODEV; | 215 | retval = -ENODEV; |
212 | goto bailout_kref_put; | 216 | goto bailout_mutex_unlock; |
213 | } | 217 | } |
214 | 218 | ||
215 | /* only call the device specific open if this | 219 | /* only call the device specific open if this |
@@ -219,15 +223,16 @@ static int serial_open (struct tty_struct *tty, struct file * filp) | |||
219 | goto bailout_module_put; | 223 | goto bailout_module_put; |
220 | } | 224 | } |
221 | 225 | ||
222 | up(&port->sem); | 226 | mutex_unlock(&port->mutex); |
223 | return 0; | 227 | return 0; |
224 | 228 | ||
225 | bailout_module_put: | 229 | bailout_module_put: |
226 | module_put(serial->type->driver.owner); | 230 | module_put(serial->type->driver.owner); |
231 | bailout_mutex_unlock: | ||
232 | port->open_count = 0; | ||
233 | mutex_unlock(&port->mutex); | ||
227 | bailout_kref_put: | 234 | bailout_kref_put: |
228 | kref_put(&serial->kref, destroy_serial); | 235 | kref_put(&serial->kref, destroy_serial); |
229 | port->open_count = 0; | ||
230 | up(&port->sem); | ||
231 | return retval; | 236 | return retval; |
232 | } | 237 | } |
233 | 238 | ||
@@ -240,10 +245,10 @@ static void serial_close(struct tty_struct *tty, struct file * filp) | |||
240 | 245 | ||
241 | dbg("%s - port %d", __FUNCTION__, port->number); | 246 | dbg("%s - port %d", __FUNCTION__, port->number); |
242 | 247 | ||
243 | down(&port->sem); | 248 | mutex_lock(&port->mutex); |
244 | 249 | ||
245 | if (port->open_count == 0) { | 250 | if (port->open_count == 0) { |
246 | up(&port->sem); | 251 | mutex_unlock(&port->mutex); |
247 | return; | 252 | return; |
248 | } | 253 | } |
249 | 254 | ||
@@ -262,7 +267,7 @@ static void serial_close(struct tty_struct *tty, struct file * filp) | |||
262 | module_put(port->serial->type->driver.owner); | 267 | module_put(port->serial->type->driver.owner); |
263 | } | 268 | } |
264 | 269 | ||
265 | up(&port->sem); | 270 | mutex_unlock(&port->mutex); |
266 | kref_put(&port->serial->kref, destroy_serial); | 271 | kref_put(&port->serial->kref, destroy_serial); |
267 | } | 272 | } |
268 | 273 | ||
@@ -783,7 +788,7 @@ int usb_serial_probe(struct usb_interface *interface, | |||
783 | port->number = i + serial->minor; | 788 | port->number = i + serial->minor; |
784 | port->serial = serial; | 789 | port->serial = serial; |
785 | spin_lock_init(&port->lock); | 790 | spin_lock_init(&port->lock); |
786 | sema_init(&port->sem, 1); | 791 | mutex_init(&port->mutex); |
787 | INIT_WORK(&port->work, usb_serial_port_softint, port); | 792 | INIT_WORK(&port->work, usb_serial_port_softint, port); |
788 | serial->port[i] = port; | 793 | serial->port[i] = port; |
789 | } | 794 | } |
diff --git a/drivers/usb/serial/usb-serial.h b/drivers/usb/serial/usb-serial.h index d7d27c3385b3..dc89d8710460 100644 --- a/drivers/usb/serial/usb-serial.h +++ b/drivers/usb/serial/usb-serial.h | |||
@@ -16,7 +16,7 @@ | |||
16 | 16 | ||
17 | #include <linux/config.h> | 17 | #include <linux/config.h> |
18 | #include <linux/kref.h> | 18 | #include <linux/kref.h> |
19 | #include <asm/semaphore.h> | 19 | #include <linux/mutex.h> |
20 | 20 | ||
21 | #define SERIAL_TTY_MAJOR 188 /* Nice legal number now */ | 21 | #define SERIAL_TTY_MAJOR 188 /* Nice legal number now */ |
22 | #define SERIAL_TTY_MINORS 255 /* loads of devices :) */ | 22 | #define SERIAL_TTY_MINORS 255 /* loads of devices :) */ |
@@ -31,7 +31,7 @@ | |||
31 | * @serial: pointer back to the struct usb_serial owner of this port. | 31 | * @serial: pointer back to the struct usb_serial owner of this port. |
32 | * @tty: pointer to the corresponding tty for this port. | 32 | * @tty: pointer to the corresponding tty for this port. |
33 | * @lock: spinlock to grab when updating portions of this structure. | 33 | * @lock: spinlock to grab when updating portions of this structure. |
34 | * @sem: semaphore used to synchronize serial_open() and serial_close() | 34 | * @mutex: mutex used to synchronize serial_open() and serial_close() |
35 | * access for this port. | 35 | * access for this port. |
36 | * @number: the number of the port (the minor number). | 36 | * @number: the number of the port (the minor number). |
37 | * @interrupt_in_buffer: pointer to the interrupt in buffer for this port. | 37 | * @interrupt_in_buffer: pointer to the interrupt in buffer for this port. |
@@ -63,7 +63,7 @@ struct usb_serial_port { | |||
63 | struct usb_serial * serial; | 63 | struct usb_serial * serial; |
64 | struct tty_struct * tty; | 64 | struct tty_struct * tty; |
65 | spinlock_t lock; | 65 | spinlock_t lock; |
66 | struct semaphore sem; | 66 | struct mutex mutex; |
67 | unsigned char number; | 67 | unsigned char number; |
68 | 68 | ||
69 | unsigned char * interrupt_in_buffer; | 69 | unsigned char * interrupt_in_buffer; |
diff --git a/drivers/usb/serial/whiteheat.c b/drivers/usb/serial/whiteheat.c index 557411c6e7c7..f806553cd9a4 100644 --- a/drivers/usb/serial/whiteheat.c +++ b/drivers/usb/serial/whiteheat.c | |||
@@ -508,6 +508,7 @@ no_firmware: | |||
508 | err("%s: Unable to retrieve firmware version, try replugging\n", serial->type->description); | 508 | err("%s: Unable to retrieve firmware version, try replugging\n", serial->type->description); |
509 | err("%s: If the firmware is not running (status led not blinking)\n", serial->type->description); | 509 | err("%s: If the firmware is not running (status led not blinking)\n", serial->type->description); |
510 | err("%s: please contact support@connecttech.com\n", serial->type->description); | 510 | err("%s: please contact support@connecttech.com\n", serial->type->description); |
511 | kfree(result); | ||
511 | return -ENODEV; | 512 | return -ENODEV; |
512 | 513 | ||
513 | no_command_private: | 514 | no_command_private: |
diff --git a/drivers/usb/storage/Kconfig b/drivers/usb/storage/Kconfig index 92be101feba7..be9eec225743 100644 --- a/drivers/usb/storage/Kconfig +++ b/drivers/usb/storage/Kconfig | |||
@@ -48,7 +48,8 @@ config USB_STORAGE_FREECOM | |||
48 | 48 | ||
49 | config USB_STORAGE_ISD200 | 49 | config USB_STORAGE_ISD200 |
50 | bool "ISD-200 USB/ATA Bridge support" | 50 | bool "ISD-200 USB/ATA Bridge support" |
51 | depends on USB_STORAGE && BLK_DEV_IDE | 51 | depends on USB_STORAGE |
52 | depends on BLK_DEV_IDE=y || BLK_DEV_IDE=USB_STORAGE | ||
52 | ---help--- | 53 | ---help--- |
53 | Say Y here if you want to use USB Mass Store devices based | 54 | Say Y here if you want to use USB Mass Store devices based |
54 | on the In-Systems Design ISD-200 USB/ATA bridge. | 55 | on the In-Systems Design ISD-200 USB/ATA bridge. |
diff --git a/drivers/usb/storage/unusual_devs.h b/drivers/usb/storage/unusual_devs.h index c4a9dcff5f2b..aec5ea8682d5 100644 --- a/drivers/usb/storage/unusual_devs.h +++ b/drivers/usb/storage/unusual_devs.h | |||
@@ -411,7 +411,7 @@ UNUSUAL_DEV( 0x050d, 0x0115, 0x0133, 0x0133, | |||
411 | UNUSUAL_DEV( 0x0525, 0xa140, 0x0100, 0x0100, | 411 | UNUSUAL_DEV( 0x0525, 0xa140, 0x0100, 0x0100, |
412 | "Iomega", | 412 | "Iomega", |
413 | "USB Clik! 40", | 413 | "USB Clik! 40", |
414 | US_SC_8070, US_PR_BULK, NULL, | 414 | US_SC_8070, US_PR_DEVICE, NULL, |
415 | US_FL_FIX_INQUIRY ), | 415 | US_FL_FIX_INQUIRY ), |
416 | 416 | ||
417 | /* Yakumo Mega Image 37 | 417 | /* Yakumo Mega Image 37 |
@@ -773,6 +773,13 @@ UNUSUAL_DEV( 0x069b, 0x3004, 0x0001, 0x0001, | |||
773 | US_SC_DEVICE, US_PR_DEVICE, NULL, | 773 | US_SC_DEVICE, US_PR_DEVICE, NULL, |
774 | US_FL_FIX_CAPACITY ), | 774 | US_FL_FIX_CAPACITY ), |
775 | 775 | ||
776 | /* Reported by Olivier Blondeau <zeitoun@gmail.com> */ | ||
777 | UNUSUAL_DEV( 0x0727, 0x0306, 0x0100, 0x0100, | ||
778 | "ATMEL", | ||
779 | "SND1 Storage", | ||
780 | US_SC_DEVICE, US_PR_DEVICE, NULL, | ||
781 | US_FL_IGNORE_RESIDUE), | ||
782 | |||
776 | /* Submitted by Roman Hodek <roman@hodek.net> */ | 783 | /* Submitted by Roman Hodek <roman@hodek.net> */ |
777 | UNUSUAL_DEV( 0x0781, 0x0001, 0x0200, 0x0200, | 784 | UNUSUAL_DEV( 0x0781, 0x0001, 0x0200, 0x0200, |
778 | "Sandisk", | 785 | "Sandisk", |