diff options
author | Dave Jones <davej@redhat.com> | 2005-11-21 09:56:52 -0500 |
---|---|---|
committer | Dave Jones <davej@redhat.com> | 2005-11-21 09:56:52 -0500 |
commit | e7e37ee9c547213d726b29c2510cbb6696050405 (patch) | |
tree | 50c45625de666b23f209d79eb1bfae05c64feee9 /drivers | |
parent | c243f1f1f6545985afcc6adf1fc085729029c3ee (diff) | |
parent | db93a82fa9d8b4d6e31c227922eaae829253bb88 (diff) |
Merge ../linus/
Diffstat (limited to 'drivers')
150 files changed, 3334 insertions, 1537 deletions
diff --git a/drivers/acpi/processor_idle.c b/drivers/acpi/processor_idle.c index 573b6a97bb1f..70d8a6ec0920 100644 --- a/drivers/acpi/processor_idle.c +++ b/drivers/acpi/processor_idle.c | |||
@@ -514,8 +514,6 @@ static int acpi_processor_set_power_policy(struct acpi_processor *pr) | |||
514 | 514 | ||
515 | static int acpi_processor_get_power_info_fadt(struct acpi_processor *pr) | 515 | static int acpi_processor_get_power_info_fadt(struct acpi_processor *pr) |
516 | { | 516 | { |
517 | int i; | ||
518 | |||
519 | ACPI_FUNCTION_TRACE("acpi_processor_get_power_info_fadt"); | 517 | ACPI_FUNCTION_TRACE("acpi_processor_get_power_info_fadt"); |
520 | 518 | ||
521 | if (!pr) | 519 | if (!pr) |
@@ -524,8 +522,7 @@ static int acpi_processor_get_power_info_fadt(struct acpi_processor *pr) | |||
524 | if (!pr->pblk) | 522 | if (!pr->pblk) |
525 | return_VALUE(-ENODEV); | 523 | return_VALUE(-ENODEV); |
526 | 524 | ||
527 | for (i = 0; i < ACPI_PROCESSOR_MAX_POWER; i++) | 525 | memset(pr->power.states, 0, sizeof(pr->power.states)); |
528 | memset(pr->power.states, 0, sizeof(struct acpi_processor_cx)); | ||
529 | 526 | ||
530 | /* if info is obtained from pblk/fadt, type equals state */ | 527 | /* if info is obtained from pblk/fadt, type equals state */ |
531 | pr->power.states[ACPI_STATE_C1].type = ACPI_STATE_C1; | 528 | pr->power.states[ACPI_STATE_C1].type = ACPI_STATE_C1; |
@@ -555,13 +552,9 @@ static int acpi_processor_get_power_info_fadt(struct acpi_processor *pr) | |||
555 | 552 | ||
556 | static int acpi_processor_get_power_info_default_c1(struct acpi_processor *pr) | 553 | static int acpi_processor_get_power_info_default_c1(struct acpi_processor *pr) |
557 | { | 554 | { |
558 | int i; | ||
559 | |||
560 | ACPI_FUNCTION_TRACE("acpi_processor_get_power_info_default_c1"); | 555 | ACPI_FUNCTION_TRACE("acpi_processor_get_power_info_default_c1"); |
561 | 556 | ||
562 | for (i = 0; i < ACPI_PROCESSOR_MAX_POWER; i++) | 557 | memset(pr->power.states, 0, sizeof(pr->power.states)); |
563 | memset(&(pr->power.states[i]), 0, | ||
564 | sizeof(struct acpi_processor_cx)); | ||
565 | 558 | ||
566 | /* if info is obtained from pblk/fadt, type equals state */ | 559 | /* if info is obtained from pblk/fadt, type equals state */ |
567 | pr->power.states[ACPI_STATE_C1].type = ACPI_STATE_C1; | 560 | pr->power.states[ACPI_STATE_C1].type = ACPI_STATE_C1; |
@@ -873,7 +866,8 @@ static int acpi_processor_get_power_info(struct acpi_processor *pr) | |||
873 | for (i = 1; i < ACPI_PROCESSOR_MAX_POWER; i++) { | 866 | for (i = 1; i < ACPI_PROCESSOR_MAX_POWER; i++) { |
874 | if (pr->power.states[i].valid) { | 867 | if (pr->power.states[i].valid) { |
875 | pr->power.count = i; | 868 | pr->power.count = i; |
876 | pr->flags.power = 1; | 869 | if (pr->power.states[i].type >= ACPI_STATE_C2) |
870 | pr->flags.power = 1; | ||
877 | } | 871 | } |
878 | } | 872 | } |
879 | 873 | ||
diff --git a/drivers/block/cciss.c b/drivers/block/cciss.c index e239a6c29230..a9e33db46e68 100644 --- a/drivers/block/cciss.c +++ b/drivers/block/cciss.c | |||
@@ -1017,10 +1017,11 @@ static int cciss_ioctl(struct inode *inode, struct file *filep, | |||
1017 | status = -ENOMEM; | 1017 | status = -ENOMEM; |
1018 | goto cleanup1; | 1018 | goto cleanup1; |
1019 | } | 1019 | } |
1020 | if (ioc->Request.Type.Direction == XFER_WRITE && | 1020 | if (ioc->Request.Type.Direction == XFER_WRITE) { |
1021 | copy_from_user(buff[sg_used], data_ptr, sz)) { | 1021 | if (copy_from_user(buff[sg_used], data_ptr, sz)) { |
1022 | status = -ENOMEM; | 1022 | status = -ENOMEM; |
1023 | goto cleanup1; | 1023 | goto cleanup1; |
1024 | } | ||
1024 | } else { | 1025 | } else { |
1025 | memset(buff[sg_used], 0, sz); | 1026 | memset(buff[sg_used], 0, sz); |
1026 | } | 1027 | } |
@@ -1138,8 +1139,15 @@ static int revalidate_allvol(ctlr_info_t *host) | |||
1138 | 1139 | ||
1139 | for(i=0; i< NWD; i++) { | 1140 | for(i=0; i< NWD; i++) { |
1140 | struct gendisk *disk = host->gendisk[i]; | 1141 | struct gendisk *disk = host->gendisk[i]; |
1141 | if (disk->flags & GENHD_FL_UP) | 1142 | if (disk) { |
1142 | del_gendisk(disk); | 1143 | request_queue_t *q = disk->queue; |
1144 | |||
1145 | if (disk->flags & GENHD_FL_UP) | ||
1146 | del_gendisk(disk); | ||
1147 | if (q) | ||
1148 | blk_cleanup_queue(q); | ||
1149 | put_disk(disk); | ||
1150 | } | ||
1143 | } | 1151 | } |
1144 | 1152 | ||
1145 | /* | 1153 | /* |
@@ -1453,10 +1461,13 @@ static int deregister_disk(struct gendisk *disk, drive_info_struct *drv, | |||
1453 | * allows us to delete disk zero but keep the controller registered. | 1461 | * allows us to delete disk zero but keep the controller registered. |
1454 | */ | 1462 | */ |
1455 | if (h->gendisk[0] != disk){ | 1463 | if (h->gendisk[0] != disk){ |
1456 | if (disk->flags & GENHD_FL_UP){ | 1464 | if (disk) { |
1457 | blk_cleanup_queue(disk->queue); | 1465 | request_queue_t *q = disk->queue; |
1458 | del_gendisk(disk); | 1466 | if (disk->flags & GENHD_FL_UP) |
1459 | drv->queue = NULL; | 1467 | del_gendisk(disk); |
1468 | if (q) | ||
1469 | blk_cleanup_queue(q); | ||
1470 | put_disk(disk); | ||
1460 | } | 1471 | } |
1461 | } | 1472 | } |
1462 | 1473 | ||
@@ -3225,9 +3236,14 @@ static void __devexit cciss_remove_one (struct pci_dev *pdev) | |||
3225 | /* remove it from the disk list */ | 3236 | /* remove it from the disk list */ |
3226 | for (j = 0; j < NWD; j++) { | 3237 | for (j = 0; j < NWD; j++) { |
3227 | struct gendisk *disk = hba[i]->gendisk[j]; | 3238 | struct gendisk *disk = hba[i]->gendisk[j]; |
3228 | if (disk->flags & GENHD_FL_UP) { | 3239 | if (disk) { |
3229 | del_gendisk(disk); | 3240 | request_queue_t *q = disk->queue; |
3230 | blk_cleanup_queue(disk->queue); | 3241 | |
3242 | if (disk->flags & GENHD_FL_UP) | ||
3243 | del_gendisk(disk); | ||
3244 | if (q) | ||
3245 | blk_cleanup_queue(q); | ||
3246 | put_disk(disk); | ||
3231 | } | 3247 | } |
3232 | } | 3248 | } |
3233 | 3249 | ||
diff --git a/drivers/char/ipmi/ipmi_si_intf.c b/drivers/char/ipmi/ipmi_si_intf.c index ea89dca3dbb5..01a1f6badb53 100644 --- a/drivers/char/ipmi/ipmi_si_intf.c +++ b/drivers/char/ipmi/ipmi_si_intf.c | |||
@@ -2203,7 +2203,7 @@ static void setup_xaction_handlers(struct smi_info *smi_info) | |||
2203 | 2203 | ||
2204 | static inline void wait_for_timer_and_thread(struct smi_info *smi_info) | 2204 | static inline void wait_for_timer_and_thread(struct smi_info *smi_info) |
2205 | { | 2205 | { |
2206 | if (smi_info->thread != ERR_PTR(-ENOMEM)) | 2206 | if (smi_info->thread != NULL && smi_info->thread != ERR_PTR(-ENOMEM)) |
2207 | kthread_stop(smi_info->thread); | 2207 | kthread_stop(smi_info->thread); |
2208 | del_timer_sync(&smi_info->si_timer); | 2208 | del_timer_sync(&smi_info->si_timer); |
2209 | } | 2209 | } |
diff --git a/drivers/char/tpm/Kconfig b/drivers/char/tpm/Kconfig index b58adfe3ed19..a6873bf89ffa 100644 --- a/drivers/char/tpm/Kconfig +++ b/drivers/char/tpm/Kconfig | |||
@@ -6,7 +6,7 @@ menu "TPM devices" | |||
6 | 6 | ||
7 | config TCG_TPM | 7 | config TCG_TPM |
8 | tristate "TPM Hardware Support" | 8 | tristate "TPM Hardware Support" |
9 | depends on EXPERIMENTAL && PCI | 9 | depends on EXPERIMENTAL |
10 | ---help--- | 10 | ---help--- |
11 | If you have a TPM security chip in your system, which | 11 | If you have a TPM security chip in your system, which |
12 | implements the Trusted Computing Group's specification, | 12 | implements the Trusted Computing Group's specification, |
diff --git a/drivers/char/tpm/tpm.c b/drivers/char/tpm/tpm.c index 0b283d246730..a9be0e8eaea5 100644 --- a/drivers/char/tpm/tpm.c +++ b/drivers/char/tpm/tpm.c | |||
@@ -377,6 +377,7 @@ int tpm_release(struct inode *inode, struct file *file) | |||
377 | file->private_data = NULL; | 377 | file->private_data = NULL; |
378 | chip->num_opens--; | 378 | chip->num_opens--; |
379 | del_singleshot_timer_sync(&chip->user_read_timer); | 379 | del_singleshot_timer_sync(&chip->user_read_timer); |
380 | flush_scheduled_work(); | ||
380 | atomic_set(&chip->data_pending, 0); | 381 | atomic_set(&chip->data_pending, 0); |
381 | put_device(chip->dev); | 382 | put_device(chip->dev); |
382 | kfree(chip->data_buffer); | 383 | kfree(chip->data_buffer); |
@@ -428,6 +429,7 @@ ssize_t tpm_read(struct file * file, char __user *buf, | |||
428 | int ret_size; | 429 | int ret_size; |
429 | 430 | ||
430 | del_singleshot_timer_sync(&chip->user_read_timer); | 431 | del_singleshot_timer_sync(&chip->user_read_timer); |
432 | flush_scheduled_work(); | ||
431 | ret_size = atomic_read(&chip->data_pending); | 433 | ret_size = atomic_read(&chip->data_pending); |
432 | atomic_set(&chip->data_pending, 0); | 434 | atomic_set(&chip->data_pending, 0); |
433 | if (ret_size > 0) { /* relay data */ | 435 | if (ret_size > 0) { /* relay data */ |
diff --git a/drivers/char/tpm/tpm_atmel.c b/drivers/char/tpm/tpm_atmel.c index deb4b5c80914..ff3654964fe3 100644 --- a/drivers/char/tpm/tpm_atmel.c +++ b/drivers/char/tpm/tpm_atmel.c | |||
@@ -47,13 +47,12 @@ static int tpm_atml_recv(struct tpm_chip *chip, u8 *buf, size_t count) | |||
47 | return -EIO; | 47 | return -EIO; |
48 | 48 | ||
49 | for (i = 0; i < 6; i++) { | 49 | for (i = 0; i < 6; i++) { |
50 | status = atmel_getb(chip, 1); | 50 | status = ioread8(chip->vendor->iobase + 1); |
51 | if ((status & ATML_STATUS_DATA_AVAIL) == 0) { | 51 | if ((status & ATML_STATUS_DATA_AVAIL) == 0) { |
52 | dev_err(chip->dev, | 52 | dev_err(chip->dev, "error reading header\n"); |
53 | "error reading header\n"); | ||
54 | return -EIO; | 53 | return -EIO; |
55 | } | 54 | } |
56 | *buf++ = atmel_getb(chip, 0); | 55 | *buf++ = ioread8(chip->vendor->iobase); |
57 | } | 56 | } |
58 | 57 | ||
59 | /* size of the data received */ | 58 | /* size of the data received */ |
@@ -64,10 +63,9 @@ static int tpm_atml_recv(struct tpm_chip *chip, u8 *buf, size_t count) | |||
64 | dev_err(chip->dev, | 63 | dev_err(chip->dev, |
65 | "Recv size(%d) less than available space\n", size); | 64 | "Recv size(%d) less than available space\n", size); |
66 | for (; i < size; i++) { /* clear the waiting data anyway */ | 65 | for (; i < size; i++) { /* clear the waiting data anyway */ |
67 | status = atmel_getb(chip, 1); | 66 | status = ioread8(chip->vendor->iobase + 1); |
68 | if ((status & ATML_STATUS_DATA_AVAIL) == 0) { | 67 | if ((status & ATML_STATUS_DATA_AVAIL) == 0) { |
69 | dev_err(chip->dev, | 68 | dev_err(chip->dev, "error reading data\n"); |
70 | "error reading data\n"); | ||
71 | return -EIO; | 69 | return -EIO; |
72 | } | 70 | } |
73 | } | 71 | } |
@@ -76,17 +74,17 @@ static int tpm_atml_recv(struct tpm_chip *chip, u8 *buf, size_t count) | |||
76 | 74 | ||
77 | /* read all the data available */ | 75 | /* read all the data available */ |
78 | for (; i < size; i++) { | 76 | for (; i < size; i++) { |
79 | status = atmel_getb(chip, 1); | 77 | status = ioread8(chip->vendor->iobase + 1); |
80 | if ((status & ATML_STATUS_DATA_AVAIL) == 0) { | 78 | if ((status & ATML_STATUS_DATA_AVAIL) == 0) { |
81 | dev_err(chip->dev, | 79 | dev_err(chip->dev, "error reading data\n"); |
82 | "error reading data\n"); | ||
83 | return -EIO; | 80 | return -EIO; |
84 | } | 81 | } |
85 | *buf++ = atmel_getb(chip, 0); | 82 | *buf++ = ioread8(chip->vendor->iobase); |
86 | } | 83 | } |
87 | 84 | ||
88 | /* make sure data available is gone */ | 85 | /* make sure data available is gone */ |
89 | status = atmel_getb(chip, 1); | 86 | status = ioread8(chip->vendor->iobase + 1); |
87 | |||
90 | if (status & ATML_STATUS_DATA_AVAIL) { | 88 | if (status & ATML_STATUS_DATA_AVAIL) { |
91 | dev_err(chip->dev, "data available is stuck\n"); | 89 | dev_err(chip->dev, "data available is stuck\n"); |
92 | return -EIO; | 90 | return -EIO; |
@@ -102,7 +100,7 @@ static int tpm_atml_send(struct tpm_chip *chip, u8 *buf, size_t count) | |||
102 | dev_dbg(chip->dev, "tpm_atml_send:\n"); | 100 | dev_dbg(chip->dev, "tpm_atml_send:\n"); |
103 | for (i = 0; i < count; i++) { | 101 | for (i = 0; i < count; i++) { |
104 | dev_dbg(chip->dev, "%d 0x%x(%d)\n", i, buf[i], buf[i]); | 102 | dev_dbg(chip->dev, "%d 0x%x(%d)\n", i, buf[i], buf[i]); |
105 | atmel_putb(buf[i], chip, 0); | 103 | iowrite8(buf[i], chip->vendor->iobase); |
106 | } | 104 | } |
107 | 105 | ||
108 | return count; | 106 | return count; |
@@ -110,12 +108,12 @@ static int tpm_atml_send(struct tpm_chip *chip, u8 *buf, size_t count) | |||
110 | 108 | ||
111 | static void tpm_atml_cancel(struct tpm_chip *chip) | 109 | static void tpm_atml_cancel(struct tpm_chip *chip) |
112 | { | 110 | { |
113 | atmel_putb(ATML_STATUS_ABORT, chip, 1); | 111 | iowrite8(ATML_STATUS_ABORT, chip->vendor->iobase + 1); |
114 | } | 112 | } |
115 | 113 | ||
116 | static u8 tpm_atml_status(struct tpm_chip *chip) | 114 | static u8 tpm_atml_status(struct tpm_chip *chip) |
117 | { | 115 | { |
118 | return atmel_getb(chip, 1); | 116 | return ioread8(chip->vendor->iobase + 1); |
119 | } | 117 | } |
120 | 118 | ||
121 | static struct file_operations atmel_ops = { | 119 | static struct file_operations atmel_ops = { |
@@ -162,7 +160,8 @@ static void atml_plat_remove(void) | |||
162 | 160 | ||
163 | if (chip) { | 161 | if (chip) { |
164 | if (chip->vendor->have_region) | 162 | if (chip->vendor->have_region) |
165 | atmel_release_region(chip->vendor->base, chip->vendor->region_size); | 163 | atmel_release_region(chip->vendor->base, |
164 | chip->vendor->region_size); | ||
166 | atmel_put_base_addr(chip->vendor); | 165 | atmel_put_base_addr(chip->vendor); |
167 | tpm_remove_hardware(chip->dev); | 166 | tpm_remove_hardware(chip->dev); |
168 | platform_device_unregister(pdev); | 167 | platform_device_unregister(pdev); |
@@ -183,14 +182,19 @@ static int __init init_atmel(void) | |||
183 | 182 | ||
184 | driver_register(&atml_drv); | 183 | driver_register(&atml_drv); |
185 | 184 | ||
186 | if (atmel_get_base_addr(&tpm_atmel) != 0) { | 185 | if ((tpm_atmel.iobase = atmel_get_base_addr(&tpm_atmel)) == NULL) { |
187 | rc = -ENODEV; | 186 | rc = -ENODEV; |
188 | goto err_unreg_drv; | 187 | goto err_unreg_drv; |
189 | } | 188 | } |
190 | 189 | ||
191 | tpm_atmel.have_region = (atmel_request_region( tpm_atmel.base, tpm_atmel.region_size, "tpm_atmel0") == NULL) ? 0 : 1; | 190 | tpm_atmel.have_region = |
191 | (atmel_request_region | ||
192 | (tpm_atmel.base, tpm_atmel.region_size, | ||
193 | "tpm_atmel0") == NULL) ? 0 : 1; | ||
192 | 194 | ||
193 | if (IS_ERR(pdev = platform_device_register_simple("tpm_atmel", -1, NULL, 0 ))) { | 195 | if (IS_ERR |
196 | (pdev = | ||
197 | platform_device_register_simple("tpm_atmel", -1, NULL, 0))) { | ||
194 | rc = PTR_ERR(pdev); | 198 | rc = PTR_ERR(pdev); |
195 | goto err_rel_reg; | 199 | goto err_rel_reg; |
196 | } | 200 | } |
@@ -202,9 +206,10 @@ static int __init init_atmel(void) | |||
202 | err_unreg_dev: | 206 | err_unreg_dev: |
203 | platform_device_unregister(pdev); | 207 | platform_device_unregister(pdev); |
204 | err_rel_reg: | 208 | err_rel_reg: |
205 | if (tpm_atmel.have_region) | ||
206 | atmel_release_region(tpm_atmel.base, tpm_atmel.region_size); | ||
207 | atmel_put_base_addr(&tpm_atmel); | 209 | atmel_put_base_addr(&tpm_atmel); |
210 | if (tpm_atmel.have_region) | ||
211 | atmel_release_region(tpm_atmel.base, | ||
212 | tpm_atmel.region_size); | ||
208 | err_unreg_drv: | 213 | err_unreg_drv: |
209 | driver_unregister(&atml_drv); | 214 | driver_unregister(&atml_drv); |
210 | return rc; | 215 | return rc; |
diff --git a/drivers/char/tpm/tpm_atmel.h b/drivers/char/tpm/tpm_atmel.h index 3c5b9a8d1c49..d3478aaadd77 100644 --- a/drivers/char/tpm/tpm_atmel.h +++ b/drivers/char/tpm/tpm_atmel.h | |||
@@ -27,12 +27,14 @@ | |||
27 | #define atmel_putb(val, chip, offset) writeb(val, chip->vendor->iobase + offset) | 27 | #define atmel_putb(val, chip, offset) writeb(val, chip->vendor->iobase + offset) |
28 | #define atmel_request_region request_mem_region | 28 | #define atmel_request_region request_mem_region |
29 | #define atmel_release_region release_mem_region | 29 | #define atmel_release_region release_mem_region |
30 | static inline void atmel_put_base_addr(struct tpm_vendor_specific *vendor) | 30 | |
31 | static inline void atmel_put_base_addr(struct tpm_vendor_specific | ||
32 | *vendor) | ||
31 | { | 33 | { |
32 | iounmap(vendor->iobase); | 34 | iounmap(vendor->iobase); |
33 | } | 35 | } |
34 | 36 | ||
35 | static int atmel_get_base_addr(struct tpm_vendor_specific *vendor) | 37 | static void __iomem * atmel_get_base_addr(struct tpm_vendor_specific *vendor) |
36 | { | 38 | { |
37 | struct device_node *dn; | 39 | struct device_node *dn; |
38 | unsigned long address, size; | 40 | unsigned long address, size; |
@@ -44,11 +46,11 @@ static int atmel_get_base_addr(struct tpm_vendor_specific *vendor) | |||
44 | dn = of_find_node_by_name(NULL, "tpm"); | 46 | dn = of_find_node_by_name(NULL, "tpm"); |
45 | 47 | ||
46 | if (!dn) | 48 | if (!dn) |
47 | return 1; | 49 | return NULL; |
48 | 50 | ||
49 | if (!device_is_compatible(dn, "AT97SC3201")) { | 51 | if (!device_is_compatible(dn, "AT97SC3201")) { |
50 | of_node_put(dn); | 52 | of_node_put(dn); |
51 | return 1; | 53 | return NULL; |
52 | } | 54 | } |
53 | 55 | ||
54 | reg = (unsigned int *) get_property(dn, "reg", ®len); | 56 | reg = (unsigned int *) get_property(dn, "reg", ®len); |
@@ -71,8 +73,7 @@ static int atmel_get_base_addr(struct tpm_vendor_specific *vendor) | |||
71 | 73 | ||
72 | vendor->base = address; | 74 | vendor->base = address; |
73 | vendor->region_size = size; | 75 | vendor->region_size = size; |
74 | vendor->iobase = ioremap(address, size); | 76 | return ioremap(vendor->base, vendor->region_size); |
75 | return 0; | ||
76 | } | 77 | } |
77 | #else | 78 | #else |
78 | #define atmel_getb(chip, offset) inb(chip->vendor->base + offset) | 79 | #define atmel_getb(chip, offset) inb(chip->vendor->base + offset) |
@@ -105,18 +106,19 @@ static int atmel_verify_tpm11(void) | |||
105 | return 0; | 106 | return 0; |
106 | } | 107 | } |
107 | 108 | ||
108 | static inline void atmel_put_base_addr(struct tpm_vendor_specific *vendor) | 109 | static inline void atmel_put_base_addr(struct tpm_vendor_specific |
110 | *vendor) | ||
109 | { | 111 | { |
110 | } | 112 | } |
111 | 113 | ||
112 | /* Determine where to talk to device */ | 114 | /* Determine where to talk to device */ |
113 | static unsigned long atmel_get_base_addr(struct tpm_vendor_specific | 115 | static void __iomem * atmel_get_base_addr(struct tpm_vendor_specific |
114 | *vendor) | 116 | *vendor) |
115 | { | 117 | { |
116 | int lo, hi; | 118 | int lo, hi; |
117 | 119 | ||
118 | if (atmel_verify_tpm11() != 0) | 120 | if (atmel_verify_tpm11() != 0) |
119 | return 1; | 121 | return NULL; |
120 | 122 | ||
121 | lo = tpm_read_index(TPM_ADDR, TPM_ATMEL_BASE_ADDR_LO); | 123 | lo = tpm_read_index(TPM_ADDR, TPM_ATMEL_BASE_ADDR_LO); |
122 | hi = tpm_read_index(TPM_ADDR, TPM_ATMEL_BASE_ADDR_HI); | 124 | hi = tpm_read_index(TPM_ADDR, TPM_ATMEL_BASE_ADDR_HI); |
@@ -124,6 +126,6 @@ static unsigned long atmel_get_base_addr(struct tpm_vendor_specific | |||
124 | vendor->base = (hi << 8) | lo; | 126 | vendor->base = (hi << 8) | lo; |
125 | vendor->region_size = 2; | 127 | vendor->region_size = 2; |
126 | 128 | ||
127 | return 0; | 129 | return ioport_map(vendor->base, vendor->region_size); |
128 | } | 130 | } |
129 | #endif | 131 | #endif |
diff --git a/drivers/i2c/busses/i2c-ixp2000.c b/drivers/i2c/busses/i2c-ixp2000.c index cef024a7d048..cd6f45d186ab 100644 --- a/drivers/i2c/busses/i2c-ixp2000.c +++ b/drivers/i2c/busses/i2c-ixp2000.c | |||
@@ -36,8 +36,6 @@ | |||
36 | #include <asm/hardware.h> /* Pick up IXP2000-specific bits */ | 36 | #include <asm/hardware.h> /* Pick up IXP2000-specific bits */ |
37 | #include <asm/arch/gpio.h> | 37 | #include <asm/arch/gpio.h> |
38 | 38 | ||
39 | static struct device_driver ixp2000_i2c_driver; | ||
40 | |||
41 | static inline int ixp2000_scl_pin(void *data) | 39 | static inline int ixp2000_scl_pin(void *data) |
42 | { | 40 | { |
43 | return ((struct ixp2000_i2c_pins*)data)->scl_pin; | 41 | return ((struct ixp2000_i2c_pins*)data)->scl_pin; |
@@ -120,7 +118,7 @@ static int ixp2000_i2c_probe(struct platform_device *plat_dev) | |||
120 | drv_data->algo_data.timeout = 100; | 118 | drv_data->algo_data.timeout = 100; |
121 | 119 | ||
122 | drv_data->adapter.id = I2C_HW_B_IXP2000, | 120 | drv_data->adapter.id = I2C_HW_B_IXP2000, |
123 | strlcpy(drv_data->adapter.name, ixp2000_i2c_driver.name, | 121 | strlcpy(drv_data->adapter.name, plat_dev->dev.driver->name, |
124 | I2C_NAME_SIZE); | 122 | I2C_NAME_SIZE); |
125 | drv_data->adapter.algo_data = &drv_data->algo_data, | 123 | drv_data->adapter.algo_data = &drv_data->algo_data, |
126 | 124 | ||
@@ -132,7 +130,7 @@ static int ixp2000_i2c_probe(struct platform_device *plat_dev) | |||
132 | gpio_line_set(gpio->sda_pin, 0); | 130 | gpio_line_set(gpio->sda_pin, 0); |
133 | 131 | ||
134 | if ((err = i2c_bit_add_bus(&drv_data->adapter)) != 0) { | 132 | if ((err = i2c_bit_add_bus(&drv_data->adapter)) != 0) { |
135 | dev_err(dev, "Could not install, error %d\n", err); | 133 | dev_err(&plat_dev->dev, "Could not install, error %d\n", err); |
136 | kfree(drv_data); | 134 | kfree(drv_data); |
137 | return err; | 135 | return err; |
138 | } | 136 | } |
diff --git a/drivers/i2c/busses/i2c-ixp4xx.c b/drivers/i2c/busses/i2c-ixp4xx.c index aa36855fa995..e422d8b2d4d6 100644 --- a/drivers/i2c/busses/i2c-ixp4xx.c +++ b/drivers/i2c/busses/i2c-ixp4xx.c | |||
@@ -35,8 +35,6 @@ | |||
35 | 35 | ||
36 | #include <asm/hardware.h> /* Pick up IXP4xx-specific bits */ | 36 | #include <asm/hardware.h> /* Pick up IXP4xx-specific bits */ |
37 | 37 | ||
38 | static struct device_driver ixp4xx_i2c_driver; | ||
39 | |||
40 | static inline int ixp4xx_scl_pin(void *data) | 38 | static inline int ixp4xx_scl_pin(void *data) |
41 | { | 39 | { |
42 | return ((struct ixp4xx_i2c_pins*)data)->scl_pin; | 40 | return ((struct ixp4xx_i2c_pins*)data)->scl_pin; |
@@ -128,7 +126,7 @@ static int ixp4xx_i2c_probe(struct platform_device *plat_dev) | |||
128 | drv_data->algo_data.timeout = 100; | 126 | drv_data->algo_data.timeout = 100; |
129 | 127 | ||
130 | drv_data->adapter.id = I2C_HW_B_IXP4XX; | 128 | drv_data->adapter.id = I2C_HW_B_IXP4XX; |
131 | strlcpy(drv_data->adapter.name, ixp4xx_i2c_driver.name, | 129 | strlcpy(drv_data->adapter.name, plat_dev->dev.driver->name, |
132 | I2C_NAME_SIZE); | 130 | I2C_NAME_SIZE); |
133 | drv_data->adapter.algo_data = &drv_data->algo_data; | 131 | drv_data->adapter.algo_data = &drv_data->algo_data; |
134 | 132 | ||
@@ -140,7 +138,7 @@ static int ixp4xx_i2c_probe(struct platform_device *plat_dev) | |||
140 | gpio_line_set(gpio->sda_pin, 0); | 138 | gpio_line_set(gpio->sda_pin, 0); |
141 | 139 | ||
142 | if ((err = i2c_bit_add_bus(&drv_data->adapter) != 0)) { | 140 | if ((err = i2c_bit_add_bus(&drv_data->adapter) != 0)) { |
143 | printk(KERN_ERR "ERROR: Could not install %s\n", dev->bus_id); | 141 | printk(KERN_ERR "ERROR: Could not install %s\n", plat_dev->dev.bus_id); |
144 | 142 | ||
145 | kfree(drv_data); | 143 | kfree(drv_data); |
146 | return err; | 144 | return err; |
diff --git a/drivers/ide/Kconfig b/drivers/ide/Kconfig index 42e5b8175cbf..31e649a9ff71 100644 --- a/drivers/ide/Kconfig +++ b/drivers/ide/Kconfig | |||
@@ -625,7 +625,7 @@ config BLK_DEV_NS87415 | |||
625 | tristate "NS87415 chipset support" | 625 | tristate "NS87415 chipset support" |
626 | help | 626 | help |
627 | This driver adds detection and support for the NS87415 chip | 627 | This driver adds detection and support for the NS87415 chip |
628 | (used in SPARC64, among others). | 628 | (used mainly on SPARC64 and PA-RISC machines). |
629 | 629 | ||
630 | Please read the comments at the top of <file:drivers/ide/pci/ns87415.c>. | 630 | Please read the comments at the top of <file:drivers/ide/pci/ns87415.c>. |
631 | 631 | ||
@@ -787,6 +787,10 @@ config BLK_DEV_IDE_PMAC_BLINK | |||
787 | This option enables the use of the sleep LED as a hard drive | 787 | This option enables the use of the sleep LED as a hard drive |
788 | activity LED. | 788 | activity LED. |
789 | 789 | ||
790 | config BLK_DEV_IDE_SWARM | ||
791 | tristate "IDE for Sibyte evaluation boards" | ||
792 | depends on SIBYTE_SB1xxx_SOC | ||
793 | |||
790 | config BLK_DEV_IDE_AU1XXX | 794 | config BLK_DEV_IDE_AU1XXX |
791 | bool "IDE for AMD Alchemy Au1200" | 795 | bool "IDE for AMD Alchemy Au1200" |
792 | depends on SOC_AU1200 | 796 | depends on SOC_AU1200 |
diff --git a/drivers/ide/Makefile b/drivers/ide/Makefile index cca9c075966d..569fae717503 100644 --- a/drivers/ide/Makefile +++ b/drivers/ide/Makefile | |||
@@ -48,6 +48,6 @@ obj-$(CONFIG_BLK_DEV_IDECD) += ide-cd.o | |||
48 | obj-$(CONFIG_BLK_DEV_IDETAPE) += ide-tape.o | 48 | obj-$(CONFIG_BLK_DEV_IDETAPE) += ide-tape.o |
49 | obj-$(CONFIG_BLK_DEV_IDEFLOPPY) += ide-floppy.o | 49 | obj-$(CONFIG_BLK_DEV_IDEFLOPPY) += ide-floppy.o |
50 | 50 | ||
51 | obj-$(CONFIG_BLK_DEV_IDE) += legacy/ arm/ | 51 | obj-$(CONFIG_BLK_DEV_IDE) += legacy/ arm/ mips/ |
52 | obj-$(CONFIG_BLK_DEV_HD) += legacy/ | 52 | obj-$(CONFIG_BLK_DEV_HD) += legacy/ |
53 | obj-$(CONFIG_ETRAX_IDE) += cris/ | 53 | obj-$(CONFIG_ETRAX_IDE) += cris/ |
diff --git a/drivers/ide/ide-cd.c b/drivers/ide/ide-cd.c index c2f47923d174..9455e42abb23 100644 --- a/drivers/ide/ide-cd.c +++ b/drivers/ide/ide-cd.c | |||
@@ -3328,8 +3328,8 @@ static ide_proc_entry_t idecd_proc[] = { | |||
3328 | #endif | 3328 | #endif |
3329 | 3329 | ||
3330 | static ide_driver_t ide_cdrom_driver = { | 3330 | static ide_driver_t ide_cdrom_driver = { |
3331 | .owner = THIS_MODULE, | ||
3332 | .gen_driver = { | 3331 | .gen_driver = { |
3332 | .owner = THIS_MODULE, | ||
3333 | .name = "ide-cdrom", | 3333 | .name = "ide-cdrom", |
3334 | .bus = &ide_bus_type, | 3334 | .bus = &ide_bus_type, |
3335 | .probe = ide_cd_probe, | 3335 | .probe = ide_cd_probe, |
@@ -3510,8 +3510,8 @@ static void __exit ide_cdrom_exit(void) | |||
3510 | { | 3510 | { |
3511 | driver_unregister(&ide_cdrom_driver.gen_driver); | 3511 | driver_unregister(&ide_cdrom_driver.gen_driver); |
3512 | } | 3512 | } |
3513 | 3513 | ||
3514 | static int ide_cdrom_init(void) | 3514 | static int __init ide_cdrom_init(void) |
3515 | { | 3515 | { |
3516 | return driver_register(&ide_cdrom_driver.gen_driver); | 3516 | return driver_register(&ide_cdrom_driver.gen_driver); |
3517 | } | 3517 | } |
diff --git a/drivers/ide/ide-disk.c b/drivers/ide/ide-disk.c index e827b39e4b3c..f4e3d3527b0e 100644 --- a/drivers/ide/ide-disk.c +++ b/drivers/ide/ide-disk.c | |||
@@ -1089,8 +1089,8 @@ static void ide_device_shutdown(struct device *dev) | |||
1089 | } | 1089 | } |
1090 | 1090 | ||
1091 | static ide_driver_t idedisk_driver = { | 1091 | static ide_driver_t idedisk_driver = { |
1092 | .owner = THIS_MODULE, | ||
1093 | .gen_driver = { | 1092 | .gen_driver = { |
1093 | .owner = THIS_MODULE, | ||
1094 | .name = "ide-disk", | 1094 | .name = "ide-disk", |
1095 | .bus = &ide_bus_type, | 1095 | .bus = &ide_bus_type, |
1096 | .probe = ide_disk_probe, | 1096 | .probe = ide_disk_probe, |
@@ -1266,7 +1266,7 @@ static void __exit idedisk_exit (void) | |||
1266 | driver_unregister(&idedisk_driver.gen_driver); | 1266 | driver_unregister(&idedisk_driver.gen_driver); |
1267 | } | 1267 | } |
1268 | 1268 | ||
1269 | static int idedisk_init (void) | 1269 | static int __init idedisk_init(void) |
1270 | { | 1270 | { |
1271 | return driver_register(&idedisk_driver.gen_driver); | 1271 | return driver_register(&idedisk_driver.gen_driver); |
1272 | } | 1272 | } |
diff --git a/drivers/ide/ide-floppy.c b/drivers/ide/ide-floppy.c index f615ab759962..9e293c8063dc 100644 --- a/drivers/ide/ide-floppy.c +++ b/drivers/ide/ide-floppy.c | |||
@@ -1925,8 +1925,8 @@ static ide_proc_entry_t idefloppy_proc[] = { | |||
1925 | static int ide_floppy_probe(struct device *); | 1925 | static int ide_floppy_probe(struct device *); |
1926 | 1926 | ||
1927 | static ide_driver_t idefloppy_driver = { | 1927 | static ide_driver_t idefloppy_driver = { |
1928 | .owner = THIS_MODULE, | ||
1929 | .gen_driver = { | 1928 | .gen_driver = { |
1929 | .owner = THIS_MODULE, | ||
1930 | .name = "ide-floppy", | 1930 | .name = "ide-floppy", |
1931 | .bus = &ide_bus_type, | 1931 | .bus = &ide_bus_type, |
1932 | .probe = ide_floppy_probe, | 1932 | .probe = ide_floppy_probe, |
@@ -2191,10 +2191,7 @@ static void __exit idefloppy_exit (void) | |||
2191 | driver_unregister(&idefloppy_driver.gen_driver); | 2191 | driver_unregister(&idefloppy_driver.gen_driver); |
2192 | } | 2192 | } |
2193 | 2193 | ||
2194 | /* | 2194 | static int __init idefloppy_init(void) |
2195 | * idefloppy_init will register the driver for each floppy. | ||
2196 | */ | ||
2197 | static int idefloppy_init (void) | ||
2198 | { | 2195 | { |
2199 | printk("ide-floppy driver " IDEFLOPPY_VERSION "\n"); | 2196 | printk("ide-floppy driver " IDEFLOPPY_VERSION "\n"); |
2200 | return driver_register(&idefloppy_driver.gen_driver); | 2197 | return driver_register(&idefloppy_driver.gen_driver); |
diff --git a/drivers/ide/ide-io.c b/drivers/ide/ide-io.c index 5275cbb1afe9..ecfafcdafea4 100644 --- a/drivers/ide/ide-io.c +++ b/drivers/ide/ide-io.c | |||
@@ -1629,12 +1629,6 @@ EXPORT_SYMBOL(ide_init_drive_cmd); | |||
1629 | * for the new rq to be completed. This is VERY DANGEROUS, and is | 1629 | * for the new rq to be completed. This is VERY DANGEROUS, and is |
1630 | * intended for careful use by the ATAPI tape/cdrom driver code. | 1630 | * intended for careful use by the ATAPI tape/cdrom driver code. |
1631 | * | 1631 | * |
1632 | * If action is ide_next, then the rq is queued immediately after | ||
1633 | * the currently-being-processed-request (if any), and the function | ||
1634 | * returns without waiting for the new rq to be completed. As above, | ||
1635 | * This is VERY DANGEROUS, and is intended for careful use by the | ||
1636 | * ATAPI tape/cdrom driver code. | ||
1637 | * | ||
1638 | * If action is ide_end, then the rq is queued at the end of the | 1632 | * If action is ide_end, then the rq is queued at the end of the |
1639 | * request queue, and the function returns immediately without waiting | 1633 | * request queue, and the function returns immediately without waiting |
1640 | * for the new rq to be completed. This is again intended for careful | 1634 | * for the new rq to be completed. This is again intended for careful |
diff --git a/drivers/ide/ide-lib.c b/drivers/ide/ide-lib.c index b09a6537c7a8..41d46dbe6c24 100644 --- a/drivers/ide/ide-lib.c +++ b/drivers/ide/ide-lib.c | |||
@@ -410,10 +410,10 @@ void ide_toggle_bounce(ide_drive_t *drive, int on) | |||
410 | { | 410 | { |
411 | u64 addr = BLK_BOUNCE_HIGH; /* dma64_addr_t */ | 411 | u64 addr = BLK_BOUNCE_HIGH; /* dma64_addr_t */ |
412 | 412 | ||
413 | if (on && drive->media == ide_disk) { | 413 | if (!PCI_DMA_BUS_IS_PHYS) { |
414 | if (!PCI_DMA_BUS_IS_PHYS) | 414 | addr = BLK_BOUNCE_ANY; |
415 | addr = BLK_BOUNCE_ANY; | 415 | } else if (on && drive->media == ide_disk) { |
416 | else if (HWIF(drive)->pci_dev) | 416 | if (HWIF(drive)->pci_dev) |
417 | addr = HWIF(drive)->pci_dev->dma_mask; | 417 | addr = HWIF(drive)->pci_dev->dma_mask; |
418 | } | 418 | } |
419 | 419 | ||
diff --git a/drivers/ide/ide-tape.c b/drivers/ide/ide-tape.c index 0ac7eb8f40d5..7d7944ed4158 100644 --- a/drivers/ide/ide-tape.c +++ b/drivers/ide/ide-tape.c | |||
@@ -4748,8 +4748,8 @@ static ide_proc_entry_t idetape_proc[] = { | |||
4748 | static int ide_tape_probe(struct device *); | 4748 | static int ide_tape_probe(struct device *); |
4749 | 4749 | ||
4750 | static ide_driver_t idetape_driver = { | 4750 | static ide_driver_t idetape_driver = { |
4751 | .owner = THIS_MODULE, | ||
4752 | .gen_driver = { | 4751 | .gen_driver = { |
4752 | .owner = THIS_MODULE, | ||
4753 | .name = "ide-tape", | 4753 | .name = "ide-tape", |
4754 | .bus = &ide_bus_type, | 4754 | .bus = &ide_bus_type, |
4755 | .probe = ide_tape_probe, | 4755 | .probe = ide_tape_probe, |
@@ -4916,10 +4916,7 @@ static void __exit idetape_exit (void) | |||
4916 | unregister_chrdev(IDETAPE_MAJOR, "ht"); | 4916 | unregister_chrdev(IDETAPE_MAJOR, "ht"); |
4917 | } | 4917 | } |
4918 | 4918 | ||
4919 | /* | 4919 | static int __init idetape_init(void) |
4920 | * idetape_init will register the driver for each tape. | ||
4921 | */ | ||
4922 | static int idetape_init (void) | ||
4923 | { | 4920 | { |
4924 | int error = 1; | 4921 | int error = 1; |
4925 | idetape_sysfs_class = class_create(THIS_MODULE, "ide_tape"); | 4922 | idetape_sysfs_class = class_create(THIS_MODULE, "ide_tape"); |
diff --git a/drivers/ide/ide-taskfile.c b/drivers/ide/ide-taskfile.c index 54f9639c2a8c..62ebefd6394a 100644 --- a/drivers/ide/ide-taskfile.c +++ b/drivers/ide/ide-taskfile.c | |||
@@ -51,8 +51,6 @@ | |||
51 | #include <asm/uaccess.h> | 51 | #include <asm/uaccess.h> |
52 | #include <asm/io.h> | 52 | #include <asm/io.h> |
53 | 53 | ||
54 | #define DEBUG_TASKFILE 0 /* unset when fixed */ | ||
55 | |||
56 | static void ata_bswap_data (void *buffer, int wcount) | 54 | static void ata_bswap_data (void *buffer, int wcount) |
57 | { | 55 | { |
58 | u16 *p = buffer; | 56 | u16 *p = buffer; |
@@ -765,9 +763,6 @@ ide_startstop_t flagged_taskfile (ide_drive_t *drive, ide_task_t *task) | |||
765 | ide_hwif_t *hwif = HWIF(drive); | 763 | ide_hwif_t *hwif = HWIF(drive); |
766 | task_struct_t *taskfile = (task_struct_t *) task->tfRegister; | 764 | task_struct_t *taskfile = (task_struct_t *) task->tfRegister; |
767 | hob_struct_t *hobfile = (hob_struct_t *) task->hobRegister; | 765 | hob_struct_t *hobfile = (hob_struct_t *) task->hobRegister; |
768 | #if DEBUG_TASKFILE | ||
769 | u8 status; | ||
770 | #endif | ||
771 | 766 | ||
772 | if (task->data_phase == TASKFILE_MULTI_IN || | 767 | if (task->data_phase == TASKFILE_MULTI_IN || |
773 | task->data_phase == TASKFILE_MULTI_OUT) { | 768 | task->data_phase == TASKFILE_MULTI_OUT) { |
@@ -778,19 +773,13 @@ ide_startstop_t flagged_taskfile (ide_drive_t *drive, ide_task_t *task) | |||
778 | } | 773 | } |
779 | 774 | ||
780 | /* | 775 | /* |
781 | * (ks) Check taskfile in/out flags. | 776 | * (ks) Check taskfile in flags. |
782 | * If set, then execute as it is defined. | 777 | * If set, then execute as it is defined. |
783 | * If not set, then define default settings. | 778 | * If not set, then define default settings. |
784 | * The default values are: | 779 | * The default values are: |
785 | * write and read all taskfile registers (except data) | 780 | * read all taskfile registers (except data) |
786 | * write and read the hob registers (sector,nsector,lcyl,hcyl) | 781 | * read the hob registers (sector, nsector, lcyl, hcyl) |
787 | */ | 782 | */ |
788 | if (task->tf_out_flags.all == 0) { | ||
789 | task->tf_out_flags.all = IDE_TASKFILE_STD_OUT_FLAGS; | ||
790 | if (drive->addressing == 1) | ||
791 | task->tf_out_flags.all |= (IDE_HOB_STD_OUT_FLAGS << 8); | ||
792 | } | ||
793 | |||
794 | if (task->tf_in_flags.all == 0) { | 783 | if (task->tf_in_flags.all == 0) { |
795 | task->tf_in_flags.all = IDE_TASKFILE_STD_IN_FLAGS; | 784 | task->tf_in_flags.all = IDE_TASKFILE_STD_IN_FLAGS; |
796 | if (drive->addressing == 1) | 785 | if (drive->addressing == 1) |
@@ -803,16 +792,6 @@ ide_startstop_t flagged_taskfile (ide_drive_t *drive, ide_task_t *task) | |||
803 | hwif->OUTB(drive->ctl, IDE_CONTROL_REG); | 792 | hwif->OUTB(drive->ctl, IDE_CONTROL_REG); |
804 | SELECT_MASK(drive, 0); | 793 | SELECT_MASK(drive, 0); |
805 | 794 | ||
806 | #if DEBUG_TASKFILE | ||
807 | status = hwif->INB(IDE_STATUS_REG); | ||
808 | if (status & 0x80) { | ||
809 | printk("flagged_taskfile -> Bad status. Status = %02x. wait 100 usec ...\n", status); | ||
810 | udelay(100); | ||
811 | status = hwif->INB(IDE_STATUS_REG); | ||
812 | printk("flagged_taskfile -> Status = %02x\n", status); | ||
813 | } | ||
814 | #endif | ||
815 | |||
816 | if (task->tf_out_flags.b.data) { | 795 | if (task->tf_out_flags.b.data) { |
817 | u16 data = taskfile->data + (hobfile->data << 8); | 796 | u16 data = taskfile->data + (hobfile->data << 8); |
818 | hwif->OUTW(data, IDE_DATA_REG); | 797 | hwif->OUTW(data, IDE_DATA_REG); |
diff --git a/drivers/ide/mips/Makefile b/drivers/ide/mips/Makefile new file mode 100644 index 000000000000..578e52a59588 --- /dev/null +++ b/drivers/ide/mips/Makefile | |||
@@ -0,0 +1 @@ | |||
obj-$(CONFIG_BLK_DEV_IDE_SWARM) += swarm.o | |||
diff --git a/drivers/ide/mips/swarm.c b/drivers/ide/mips/swarm.c new file mode 100644 index 000000000000..66f6064f4640 --- /dev/null +++ b/drivers/ide/mips/swarm.c | |||
@@ -0,0 +1,201 @@ | |||
1 | /* | ||
2 | * Copyright (C) 2001, 2002, 2003 Broadcom Corporation | ||
3 | * Copyright (C) 2004 MontaVista Software Inc. | ||
4 | * Author: Manish Lachwani, mlachwani@mvista.com | ||
5 | * Copyright (C) 2004 MIPS Technologies, Inc. All rights reserved. | ||
6 | * Author: Maciej W. Rozycki <macro@mips.com> | ||
7 | * | ||
8 | * This program is free software; you can redistribute it and/or | ||
9 | * modify it under the terms of the GNU General Public License | ||
10 | * as published by the Free Software Foundation; either version 2 | ||
11 | * of the License, or (at your option) any later version. | ||
12 | * | ||
13 | * This program is distributed in the hope that it will be useful, | ||
14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
16 | * GNU General Public License for more details. | ||
17 | * | ||
18 | * You should have received a copy of the GNU General Public License | ||
19 | * along with this program; if not, write to the Free Software | ||
20 | * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. | ||
21 | */ | ||
22 | |||
23 | /* | ||
24 | * Derived loosely from ide-pmac.c, so: | ||
25 | * Copyright (C) 1998 Paul Mackerras. | ||
26 | * Copyright (C) 1995-1998 Mark Lord | ||
27 | */ | ||
28 | |||
29 | /* | ||
30 | * Boards with SiByte processors so far have supported IDE devices via | ||
31 | * the Generic Bus, PCI bus, and built-in PCMCIA interface. In all | ||
32 | * cases, byte-swapping must be avoided for these devices (whereas | ||
33 | * other PCI devices, for example, will require swapping). Any | ||
34 | * SiByte-targetted kernel including IDE support will include this | ||
35 | * file. Probing of a Generic Bus for an IDE device is controlled by | ||
36 | * the definition of "SIBYTE_HAVE_IDE", which is provided by | ||
37 | * <asm/sibyte/board.h> for Broadcom boards. | ||
38 | */ | ||
39 | |||
40 | #include <linux/ide.h> | ||
41 | #include <linux/ioport.h> | ||
42 | #include <linux/kernel.h> | ||
43 | #include <linux/types.h> | ||
44 | #include <linux/platform_device.h> | ||
45 | |||
46 | #include <asm/io.h> | ||
47 | |||
48 | #include <asm/sibyte/board.h> | ||
49 | #include <asm/sibyte/sb1250_genbus.h> | ||
50 | #include <asm/sibyte/sb1250_regs.h> | ||
51 | |||
52 | #define DRV_NAME "ide-swarm" | ||
53 | |||
54 | static char swarm_ide_string[] = DRV_NAME; | ||
55 | |||
56 | static struct resource swarm_ide_resource = { | ||
57 | .name = "SWARM GenBus IDE", | ||
58 | .flags = IORESOURCE_MEM, | ||
59 | }; | ||
60 | |||
61 | static struct platform_device *swarm_ide_dev; | ||
62 | |||
63 | /* | ||
64 | * swarm_ide_probe - if the board header indicates the existence of | ||
65 | * Generic Bus IDE, allocate a HWIF for it. | ||
66 | */ | ||
67 | static int __devinit swarm_ide_probe(struct device *dev) | ||
68 | { | ||
69 | ide_hwif_t *hwif; | ||
70 | u8 __iomem *base; | ||
71 | phys_t offset, size; | ||
72 | int i; | ||
73 | |||
74 | if (!SIBYTE_HAVE_IDE) | ||
75 | return -ENODEV; | ||
76 | |||
77 | /* Find an empty slot. */ | ||
78 | for (i = 0; i < MAX_HWIFS; i++) | ||
79 | if (!ide_hwifs[i].io_ports[IDE_DATA_OFFSET]) | ||
80 | break; | ||
81 | if (i >= MAX_HWIFS) { | ||
82 | printk(KERN_ERR DRV_NAME ": no free slot for interface\n"); | ||
83 | return -ENOMEM; | ||
84 | } | ||
85 | |||
86 | hwif = ide_hwifs + i; | ||
87 | |||
88 | base = ioremap(A_IO_EXT_BASE, 0x800); | ||
89 | offset = __raw_readq(base + R_IO_EXT_REG(R_IO_EXT_START_ADDR, IDE_CS)); | ||
90 | size = __raw_readq(base + R_IO_EXT_REG(R_IO_EXT_MULT_SIZE, IDE_CS)); | ||
91 | iounmap(base); | ||
92 | |||
93 | offset = G_IO_START_ADDR(offset) << S_IO_ADDRBASE; | ||
94 | size = (G_IO_MULT_SIZE(size) + 1) << S_IO_REGSIZE; | ||
95 | if (offset < A_PHYS_GENBUS || offset >= A_PHYS_GENBUS_END) { | ||
96 | printk(KERN_INFO DRV_NAME | ||
97 | ": IDE interface at GenBus disabled\n"); | ||
98 | return -EBUSY; | ||
99 | } | ||
100 | |||
101 | printk(KERN_INFO DRV_NAME ": IDE interface at GenBus slot %i\n", | ||
102 | IDE_CS); | ||
103 | |||
104 | swarm_ide_resource.start = offset; | ||
105 | swarm_ide_resource.end = offset + size - 1; | ||
106 | if (request_resource(&iomem_resource, &swarm_ide_resource)) { | ||
107 | printk(KERN_ERR DRV_NAME | ||
108 | ": can't request I/O memory resource\n"); | ||
109 | return -EBUSY; | ||
110 | } | ||
111 | |||
112 | base = ioremap(offset, size); | ||
113 | |||
114 | /* Setup MMIO ops. */ | ||
115 | default_hwif_mmiops(hwif); | ||
116 | /* Prevent resource map manipulation. */ | ||
117 | hwif->mmio = 2; | ||
118 | hwif->noprobe = 0; | ||
119 | |||
120 | for (i = IDE_DATA_OFFSET; i <= IDE_STATUS_OFFSET; i++) | ||
121 | hwif->hw.io_ports[i] = | ||
122 | (unsigned long)(base + ((0x1f0 + i) << 5)); | ||
123 | hwif->hw.io_ports[IDE_CONTROL_OFFSET] = | ||
124 | (unsigned long)(base + (0x3f6 << 5)); | ||
125 | hwif->hw.irq = K_INT_GB_IDE; | ||
126 | |||
127 | memcpy(hwif->io_ports, hwif->hw.io_ports, sizeof(hwif->io_ports)); | ||
128 | hwif->irq = hwif->hw.irq; | ||
129 | |||
130 | dev_set_drvdata(dev, hwif); | ||
131 | |||
132 | return 0; | ||
133 | } | ||
134 | |||
135 | static struct device_driver swarm_ide_driver = { | ||
136 | .name = swarm_ide_string, | ||
137 | .bus = &platform_bus_type, | ||
138 | .probe = swarm_ide_probe, | ||
139 | }; | ||
140 | |||
141 | static void swarm_ide_platform_release(struct device *device) | ||
142 | { | ||
143 | struct platform_device *pldev; | ||
144 | |||
145 | /* free device */ | ||
146 | pldev = to_platform_device(device); | ||
147 | kfree(pldev); | ||
148 | } | ||
149 | |||
150 | static int __devinit swarm_ide_init_module(void) | ||
151 | { | ||
152 | struct platform_device *pldev; | ||
153 | int err; | ||
154 | |||
155 | printk(KERN_INFO "SWARM IDE driver\n"); | ||
156 | |||
157 | if (driver_register(&swarm_ide_driver)) { | ||
158 | printk(KERN_ERR "Driver registration failed\n"); | ||
159 | err = -ENODEV; | ||
160 | goto out; | ||
161 | } | ||
162 | |||
163 | if (!(pldev = kmalloc(sizeof (*pldev), GFP_KERNEL))) { | ||
164 | err = -ENOMEM; | ||
165 | goto out_unregister_driver; | ||
166 | } | ||
167 | |||
168 | memset (pldev, 0, sizeof (*pldev)); | ||
169 | pldev->name = swarm_ide_string; | ||
170 | pldev->id = 0; | ||
171 | pldev->dev.release = swarm_ide_platform_release; | ||
172 | |||
173 | if (platform_device_register(pldev)) { | ||
174 | err = -ENODEV; | ||
175 | goto out_free_pldev; | ||
176 | } | ||
177 | |||
178 | if (!pldev->dev.driver) { | ||
179 | /* | ||
180 | * The driver was not bound to this device, there was | ||
181 | * no hardware at this address. Unregister it, as the | ||
182 | * release fuction will take care of freeing the | ||
183 | * allocated structure | ||
184 | */ | ||
185 | platform_device_unregister (pldev); | ||
186 | } | ||
187 | |||
188 | swarm_ide_dev = pldev; | ||
189 | |||
190 | return 0; | ||
191 | |||
192 | out_free_pldev: | ||
193 | kfree(pldev); | ||
194 | |||
195 | out_unregister_driver: | ||
196 | driver_unregister(&swarm_ide_driver); | ||
197 | out: | ||
198 | return err; | ||
199 | } | ||
200 | |||
201 | module_init(swarm_ide_init_module); | ||
diff --git a/drivers/ide/pci/aec62xx.c b/drivers/ide/pci/aec62xx.c index 52cadc005d72..a21b1e11eef4 100644 --- a/drivers/ide/pci/aec62xx.c +++ b/drivers/ide/pci/aec62xx.c | |||
@@ -65,23 +65,6 @@ static struct chipset_bus_clock_list_entry aec6xxx_34_base [] = { | |||
65 | #define BUSCLOCK(D) \ | 65 | #define BUSCLOCK(D) \ |
66 | ((struct chipset_bus_clock_list_entry *) pci_get_drvdata((D))) | 66 | ((struct chipset_bus_clock_list_entry *) pci_get_drvdata((D))) |
67 | 67 | ||
68 | #if 0 | ||
69 | if (dev->device == PCI_DEVICE_ID_ARTOP_ATP850UF) { | ||
70 | (void) pci_read_config_byte(dev, 0x54, &art); | ||
71 | p += sprintf(p, "DMA Mode: %s(%s)", | ||
72 | (c0&0x20)?((art&0x03)?"UDMA":" DMA"):" PIO", | ||
73 | (art&0x02)?"2":(art&0x01)?"1":"0"); | ||
74 | p += sprintf(p, " %s(%s)", | ||
75 | (c0&0x40)?((art&0x0c)?"UDMA":" DMA"):" PIO", | ||
76 | (art&0x08)?"2":(art&0x04)?"1":"0"); | ||
77 | p += sprintf(p, " %s(%s)", | ||
78 | (c1&0x20)?((art&0x30)?"UDMA":" DMA"):" PIO", | ||
79 | (art&0x20)?"2":(art&0x10)?"1":"0"); | ||
80 | p += sprintf(p, " %s(%s)\n", | ||
81 | (c1&0x40)?((art&0xc0)?"UDMA":" DMA"):" PIO", | ||
82 | (art&0x80)?"2":(art&0x40)?"1":"0"); | ||
83 | } else { | ||
84 | #endif | ||
85 | 68 | ||
86 | /* | 69 | /* |
87 | * TO DO: active tuning and correction of cards without a bios. | 70 | * TO DO: active tuning and correction of cards without a bios. |
@@ -112,13 +95,9 @@ static u8 aec62xx_ratemask (ide_drive_t *drive) | |||
112 | switch(hwif->pci_dev->device) { | 95 | switch(hwif->pci_dev->device) { |
113 | case PCI_DEVICE_ID_ARTOP_ATP865: | 96 | case PCI_DEVICE_ID_ARTOP_ATP865: |
114 | case PCI_DEVICE_ID_ARTOP_ATP865R: | 97 | case PCI_DEVICE_ID_ARTOP_ATP865R: |
115 | #if 0 | ||
116 | mode = (hwif->INB(hwif->dma_master) & 0x10) ? 4 : 3; | ||
117 | #else | ||
118 | mode = (hwif->INB(((hwif->channel) ? | 98 | mode = (hwif->INB(((hwif->channel) ? |
119 | hwif->mate->dma_status : | 99 | hwif->mate->dma_status : |
120 | hwif->dma_status)) & 0x10) ? 4 : 3; | 100 | hwif->dma_status)) & 0x10) ? 4 : 3; |
121 | #endif | ||
122 | break; | 101 | break; |
123 | case PCI_DEVICE_ID_ARTOP_ATP860: | 102 | case PCI_DEVICE_ID_ARTOP_ATP860: |
124 | case PCI_DEVICE_ID_ARTOP_ATP860R: | 103 | case PCI_DEVICE_ID_ARTOP_ATP860R: |
@@ -263,35 +242,9 @@ static int aec62xx_irq_timeout (ide_drive_t *drive) | |||
263 | case PCI_DEVICE_ID_ARTOP_ATP865: | 242 | case PCI_DEVICE_ID_ARTOP_ATP865: |
264 | case PCI_DEVICE_ID_ARTOP_ATP865R: | 243 | case PCI_DEVICE_ID_ARTOP_ATP865R: |
265 | printk(" AEC62XX time out "); | 244 | printk(" AEC62XX time out "); |
266 | #if 0 | ||
267 | { | ||
268 | int i = 0; | ||
269 | u8 reg49h = 0; | ||
270 | pci_read_config_byte(HWIF(drive)->pci_dev, 0x49, ®49h); | ||
271 | for (i=0;i<256;i++) | ||
272 | pci_write_config_byte(HWIF(drive)->pci_dev, 0x49, reg49h|0x10); | ||
273 | pci_write_config_byte(HWIF(drive)->pci_dev, 0x49, reg49h & ~0x10); | ||
274 | } | ||
275 | return 0; | ||
276 | #endif | ||
277 | default: | 245 | default: |
278 | break; | 246 | break; |
279 | } | 247 | } |
280 | #if 0 | ||
281 | { | ||
282 | ide_hwif_t *hwif = HWIF(drive); | ||
283 | struct pci_dev *dev = hwif->pci_dev; | ||
284 | u8 tmp1 = 0, tmp2 = 0, mode6 = 0; | ||
285 | |||
286 | pci_read_config_byte(dev, 0x44, &tmp1); | ||
287 | pci_read_config_byte(dev, 0x45, &tmp2); | ||
288 | printk(" AEC6280 r44=%x r45=%x ",tmp1,tmp2); | ||
289 | mode6 = HWIF(drive)->INB(((hwif->channel) ? | ||
290 | hwif->mate->dma_status : | ||
291 | hwif->dma_status)); | ||
292 | printk(" AEC6280 133=%x ", (mode6 & 0x10)); | ||
293 | } | ||
294 | #endif | ||
295 | return 0; | 248 | return 0; |
296 | } | 249 | } |
297 | 250 | ||
diff --git a/drivers/ide/pci/alim15x3.c b/drivers/ide/pci/alim15x3.c index 6cf49394a80f..cf84350efc55 100644 --- a/drivers/ide/pci/alim15x3.c +++ b/drivers/ide/pci/alim15x3.c | |||
@@ -876,10 +876,15 @@ static ide_pci_device_t ali15x3_chipset __devinitdata = { | |||
876 | 876 | ||
877 | static int __devinit alim15x3_init_one(struct pci_dev *dev, const struct pci_device_id *id) | 877 | static int __devinit alim15x3_init_one(struct pci_dev *dev, const struct pci_device_id *id) |
878 | { | 878 | { |
879 | static struct pci_device_id ati_rs100[] = { | ||
880 | { PCI_DEVICE(PCI_VENDOR_ID_ATI, PCI_DEVICE_ID_ATI_RS100) }, | ||
881 | { }, | ||
882 | }; | ||
883 | |||
879 | ide_pci_device_t *d = &ali15x3_chipset; | 884 | ide_pci_device_t *d = &ali15x3_chipset; |
880 | 885 | ||
881 | if(pci_find_device(PCI_VENDOR_ID_ATI, PCI_DEVICE_ID_ATI_RS100, NULL)) | 886 | if (pci_dev_present(ati_rs100)) |
882 | printk(KERN_ERR "Warning: ATI Radeon IGP Northbridge is not yet fully tested.\n"); | 887 | printk(KERN_WARNING "alim15x3: ATI Radeon IGP Northbridge is not yet fully tested.\n"); |
883 | 888 | ||
884 | #if defined(CONFIG_SPARC64) | 889 | #if defined(CONFIG_SPARC64) |
885 | d->init_hwif = init_hwif_common_ali15x3; | 890 | d->init_hwif = init_hwif_common_ali15x3; |
diff --git a/drivers/ide/pci/cs5520.c b/drivers/ide/pci/cs5520.c index 7dc24682d197..ea3c52cc8ac1 100644 --- a/drivers/ide/pci/cs5520.c +++ b/drivers/ide/pci/cs5520.c | |||
@@ -222,10 +222,9 @@ static int __devinit cs5520_init_one(struct pci_dev *dev, const struct pci_devic | |||
222 | 222 | ||
223 | /* We must not grab the entire device, it has 'ISA' space in its | 223 | /* We must not grab the entire device, it has 'ISA' space in its |
224 | BARS too and we will freak out other bits of the kernel */ | 224 | BARS too and we will freak out other bits of the kernel */ |
225 | if(pci_enable_device_bars(dev, 1<<2)) | 225 | if (pci_enable_device_bars(dev, 1<<2)) { |
226 | { | ||
227 | printk(KERN_WARNING "%s: Unable to enable 55x0.\n", d->name); | 226 | printk(KERN_WARNING "%s: Unable to enable 55x0.\n", d->name); |
228 | return 1; | 227 | return -ENODEV; |
229 | } | 228 | } |
230 | pci_set_master(dev); | 229 | pci_set_master(dev); |
231 | if (pci_set_dma_mask(dev, DMA_32BIT_MASK)) { | 230 | if (pci_set_dma_mask(dev, DMA_32BIT_MASK)) { |
diff --git a/drivers/ide/pci/siimage.c b/drivers/ide/pci/siimage.c index 022d244f2eb0..f1ca154dd52c 100644 --- a/drivers/ide/pci/siimage.c +++ b/drivers/ide/pci/siimage.c | |||
@@ -6,7 +6,13 @@ | |||
6 | * | 6 | * |
7 | * May be copied or modified under the terms of the GNU General Public License | 7 | * May be copied or modified under the terms of the GNU General Public License |
8 | * | 8 | * |
9 | * Documentation available under NDA only | 9 | * Documentation for CMD680: |
10 | * http://gkernel.sourceforge.net/specs/sii/sii-0680a-v1.31.pdf.bz2 | ||
11 | * | ||
12 | * Documentation for SiI 3112: | ||
13 | * http://gkernel.sourceforge.net/specs/sii/3112A_SiI-DS-0095-B2.pdf.bz2 | ||
14 | * | ||
15 | * Errata and other documentation only available under NDA. | ||
10 | * | 16 | * |
11 | * | 17 | * |
12 | * FAQ Items: | 18 | * FAQ Items: |
diff --git a/drivers/ide/pci/sis5513.c b/drivers/ide/pci/sis5513.c index 16b3e2d8bfb1..75a2253a3e68 100644 --- a/drivers/ide/pci/sis5513.c +++ b/drivers/ide/pci/sis5513.c | |||
@@ -87,6 +87,7 @@ static const struct { | |||
87 | u8 chipset_family; | 87 | u8 chipset_family; |
88 | u8 flags; | 88 | u8 flags; |
89 | } SiSHostChipInfo[] = { | 89 | } SiSHostChipInfo[] = { |
90 | { "SiS965", PCI_DEVICE_ID_SI_965, ATA_133 }, | ||
90 | { "SiS745", PCI_DEVICE_ID_SI_745, ATA_100 }, | 91 | { "SiS745", PCI_DEVICE_ID_SI_745, ATA_100 }, |
91 | { "SiS735", PCI_DEVICE_ID_SI_735, ATA_100 }, | 92 | { "SiS735", PCI_DEVICE_ID_SI_735, ATA_100 }, |
92 | { "SiS733", PCI_DEVICE_ID_SI_733, ATA_100 }, | 93 | { "SiS733", PCI_DEVICE_ID_SI_733, ATA_100 }, |
diff --git a/drivers/ide/pci/via82cxxx.c b/drivers/ide/pci/via82cxxx.c index a4d099c937ff..7161ce0ef5aa 100644 --- a/drivers/ide/pci/via82cxxx.c +++ b/drivers/ide/pci/via82cxxx.c | |||
@@ -79,6 +79,7 @@ static struct via_isa_bridge { | |||
79 | u8 rev_max; | 79 | u8 rev_max; |
80 | u16 flags; | 80 | u16 flags; |
81 | } via_isa_bridges[] = { | 81 | } via_isa_bridges[] = { |
82 | { "vt6410", PCI_DEVICE_ID_VIA_6410, 0x00, 0x2f, VIA_UDMA_133 | VIA_BAD_AST }, | ||
82 | { "vt8237", PCI_DEVICE_ID_VIA_8237, 0x00, 0x2f, VIA_UDMA_133 | VIA_BAD_AST }, | 83 | { "vt8237", PCI_DEVICE_ID_VIA_8237, 0x00, 0x2f, VIA_UDMA_133 | VIA_BAD_AST }, |
83 | { "vt8235", PCI_DEVICE_ID_VIA_8235, 0x00, 0x2f, VIA_UDMA_133 | VIA_BAD_AST }, | 84 | { "vt8235", PCI_DEVICE_ID_VIA_8235, 0x00, 0x2f, VIA_UDMA_133 | VIA_BAD_AST }, |
84 | { "vt8233a", PCI_DEVICE_ID_VIA_8233A, 0x00, 0x2f, VIA_UDMA_133 | VIA_BAD_AST }, | 85 | { "vt8233a", PCI_DEVICE_ID_VIA_8233A, 0x00, 0x2f, VIA_UDMA_133 | VIA_BAD_AST }, |
@@ -100,185 +101,14 @@ static struct via_isa_bridge { | |||
100 | { NULL } | 101 | { NULL } |
101 | }; | 102 | }; |
102 | 103 | ||
103 | static struct via_isa_bridge *via_config; | ||
104 | static unsigned int via_80w; | ||
105 | static unsigned int via_clock; | 104 | static unsigned int via_clock; |
106 | static char *via_dma[] = { "MWDMA16", "UDMA33", "UDMA66", "UDMA100", "UDMA133" }; | 105 | static char *via_dma[] = { "MWDMA16", "UDMA33", "UDMA66", "UDMA100", "UDMA133" }; |
107 | 106 | ||
108 | /* | 107 | struct via82cxxx_dev |
109 | * VIA /proc entry. | ||
110 | */ | ||
111 | |||
112 | #if defined(DISPLAY_VIA_TIMINGS) && defined(CONFIG_PROC_FS) | ||
113 | |||
114 | #include <linux/stat.h> | ||
115 | #include <linux/proc_fs.h> | ||
116 | |||
117 | static u8 via_proc = 0; | ||
118 | static unsigned long via_base; | ||
119 | static struct pci_dev *bmide_dev, *isa_dev; | ||
120 | |||
121 | static char *via_control3[] = { "No limit", "64", "128", "192" }; | ||
122 | |||
123 | #define via_print(format, arg...) p += sprintf(p, format "\n" , ## arg) | ||
124 | #define via_print_drive(name, format, arg...)\ | ||
125 | p += sprintf(p, name); for (i = 0; i < 4; i++) p += sprintf(p, format, ## arg); p += sprintf(p, "\n"); | ||
126 | |||
127 | |||
128 | /** | ||
129 | * via_get_info - generate via /proc file | ||
130 | * @buffer: buffer for data | ||
131 | * @addr: set to start of data to use | ||
132 | * @offset: current file offset | ||
133 | * @count: size of read | ||
134 | * | ||
135 | * Fills in buffer with the debugging/configuration information for | ||
136 | * the VIA chipset tuning and attached drives | ||
137 | */ | ||
138 | |||
139 | static int via_get_info(char *buffer, char **addr, off_t offset, int count) | ||
140 | { | 108 | { |
141 | int speed[4], cycle[4], setup[4], active[4], recover[4], den[4], | 109 | struct via_isa_bridge *via_config; |
142 | uen[4], udma[4], umul[4], active8b[4], recover8b[4]; | 110 | unsigned int via_80w; |
143 | struct pci_dev *dev = bmide_dev; | 111 | }; |
144 | unsigned int v, u, i; | ||
145 | int len; | ||
146 | u16 c, w; | ||
147 | u8 t, x; | ||
148 | char *p = buffer; | ||
149 | |||
150 | via_print("----------VIA BusMastering IDE Configuration" | ||
151 | "----------------"); | ||
152 | |||
153 | via_print("Driver Version: 3.38"); | ||
154 | via_print("South Bridge: VIA %s", | ||
155 | via_config->name); | ||
156 | |||
157 | pci_read_config_byte(isa_dev, PCI_REVISION_ID, &t); | ||
158 | pci_read_config_byte(dev, PCI_REVISION_ID, &x); | ||
159 | via_print("Revision: ISA %#x IDE %#x", t, x); | ||
160 | via_print("Highest DMA rate: %s", | ||
161 | via_dma[via_config->flags & VIA_UDMA]); | ||
162 | |||
163 | via_print("BM-DMA base: %#lx", via_base); | ||
164 | via_print("PCI clock: %d.%dMHz", | ||
165 | via_clock / 1000, via_clock / 100 % 10); | ||
166 | |||
167 | pci_read_config_byte(dev, VIA_MISC_1, &t); | ||
168 | via_print("Master Read Cycle IRDY: %dws", | ||
169 | (t & 64) >> 6); | ||
170 | via_print("Master Write Cycle IRDY: %dws", | ||
171 | (t & 32) >> 5); | ||
172 | via_print("BM IDE Status Register Read Retry: %s", | ||
173 | (t & 8) ? "yes" : "no"); | ||
174 | |||
175 | pci_read_config_byte(dev, VIA_MISC_3, &t); | ||
176 | via_print("Max DRDY Pulse Width: %s%s", | ||
177 | via_control3[(t & 0x03)], (t & 0x03) ? " PCI clocks" : ""); | ||
178 | |||
179 | via_print("-----------------------Primary IDE" | ||
180 | "-------Secondary IDE------"); | ||
181 | via_print("Read DMA FIFO flush: %10s%20s", | ||
182 | (t & 0x80) ? "yes" : "no", (t & 0x40) ? "yes" : "no"); | ||
183 | via_print("End Sector FIFO flush: %10s%20s", | ||
184 | (t & 0x20) ? "yes" : "no", (t & 0x10) ? "yes" : "no"); | ||
185 | |||
186 | pci_read_config_byte(dev, VIA_IDE_CONFIG, &t); | ||
187 | via_print("Prefetch Buffer: %10s%20s", | ||
188 | (t & 0x80) ? "yes" : "no", (t & 0x20) ? "yes" : "no"); | ||
189 | via_print("Post Write Buffer: %10s%20s", | ||
190 | (t & 0x40) ? "yes" : "no", (t & 0x10) ? "yes" : "no"); | ||
191 | |||
192 | pci_read_config_byte(dev, VIA_IDE_ENABLE, &t); | ||
193 | via_print("Enabled: %10s%20s", | ||
194 | (t & 0x02) ? "yes" : "no", (t & 0x01) ? "yes" : "no"); | ||
195 | |||
196 | c = inb(via_base + 0x02) | (inb(via_base + 0x0a) << 8); | ||
197 | via_print("Simplex only: %10s%20s", | ||
198 | (c & 0x80) ? "yes" : "no", (c & 0x8000) ? "yes" : "no"); | ||
199 | |||
200 | via_print("Cable Type: %10s%20s", | ||
201 | (via_80w & 1) ? "80w" : "40w", (via_80w & 2) ? "80w" : "40w"); | ||
202 | |||
203 | via_print("-------------------drive0----drive1" | ||
204 | "----drive2----drive3-----"); | ||
205 | |||
206 | pci_read_config_byte(dev, VIA_ADDRESS_SETUP, &t); | ||
207 | pci_read_config_dword(dev, VIA_DRIVE_TIMING, &v); | ||
208 | pci_read_config_word(dev, VIA_8BIT_TIMING, &w); | ||
209 | |||
210 | if (via_config->flags & VIA_UDMA) | ||
211 | pci_read_config_dword(dev, VIA_UDMA_TIMING, &u); | ||
212 | else u = 0; | ||
213 | |||
214 | for (i = 0; i < 4; i++) { | ||
215 | |||
216 | setup[i] = ((t >> ((3 - i) << 1)) & 0x3) + 1; | ||
217 | recover8b[i] = ((w >> ((1 - (i >> 1)) << 3)) & 0xf) + 1; | ||
218 | active8b[i] = ((w >> (((1 - (i >> 1)) << 3) + 4)) & 0xf) + 1; | ||
219 | active[i] = ((v >> (((3 - i) << 3) + 4)) & 0xf) + 1; | ||
220 | recover[i] = ((v >> ((3 - i) << 3)) & 0xf) + 1; | ||
221 | udma[i] = ((u >> ((3 - i) << 3)) & 0x7) + 2; | ||
222 | umul[i] = ((u >> (((3 - i) & 2) << 3)) & 0x8) ? 1 : 2; | ||
223 | uen[i] = ((u >> ((3 - i) << 3)) & 0x20); | ||
224 | den[i] = (c & ((i & 1) ? 0x40 : 0x20) << ((i & 2) << 2)); | ||
225 | |||
226 | speed[i] = 2 * via_clock / (active[i] + recover[i]); | ||
227 | cycle[i] = 1000000 * (active[i] + recover[i]) / via_clock; | ||
228 | |||
229 | if (!uen[i] || !den[i]) | ||
230 | continue; | ||
231 | |||
232 | switch (via_config->flags & VIA_UDMA) { | ||
233 | |||
234 | case VIA_UDMA_33: | ||
235 | speed[i] = 2 * via_clock / udma[i]; | ||
236 | cycle[i] = 1000000 * udma[i] / via_clock; | ||
237 | break; | ||
238 | |||
239 | case VIA_UDMA_66: | ||
240 | speed[i] = 4 * via_clock / (udma[i] * umul[i]); | ||
241 | cycle[i] = 500000 * (udma[i] * umul[i]) / via_clock; | ||
242 | break; | ||
243 | |||
244 | case VIA_UDMA_100: | ||
245 | speed[i] = 6 * via_clock / udma[i]; | ||
246 | cycle[i] = 333333 * udma[i] / via_clock; | ||
247 | break; | ||
248 | |||
249 | case VIA_UDMA_133: | ||
250 | speed[i] = 8 * via_clock / udma[i]; | ||
251 | cycle[i] = 250000 * udma[i] / via_clock; | ||
252 | break; | ||
253 | } | ||
254 | } | ||
255 | |||
256 | via_print_drive("Transfer Mode: ", "%10s", | ||
257 | den[i] ? (uen[i] ? "UDMA" : "DMA") : "PIO"); | ||
258 | |||
259 | via_print_drive("Address Setup: ", "%8dns", | ||
260 | 1000000 * setup[i] / via_clock); | ||
261 | via_print_drive("Cmd Active: ", "%8dns", | ||
262 | 1000000 * active8b[i] / via_clock); | ||
263 | via_print_drive("Cmd Recovery: ", "%8dns", | ||
264 | 1000000 * recover8b[i] / via_clock); | ||
265 | via_print_drive("Data Active: ", "%8dns", | ||
266 | 1000000 * active[i] / via_clock); | ||
267 | via_print_drive("Data Recovery: ", "%8dns", | ||
268 | 1000000 * recover[i] / via_clock); | ||
269 | via_print_drive("Cycle Time: ", "%8dns", | ||
270 | cycle[i]); | ||
271 | via_print_drive("Transfer Rate: ", "%4d.%dMB/s", | ||
272 | speed[i] / 1000, speed[i] / 100 % 10); | ||
273 | |||
274 | /* hoping it is less than 4K... */ | ||
275 | len = (p - buffer) - offset; | ||
276 | *addr = buffer + offset; | ||
277 | |||
278 | return len > count ? count : len; | ||
279 | } | ||
280 | |||
281 | #endif /* DISPLAY_VIA_TIMINGS && CONFIG_PROC_FS */ | ||
282 | 112 | ||
283 | /** | 113 | /** |
284 | * via_set_speed - write timing registers | 114 | * via_set_speed - write timing registers |
@@ -289,11 +119,13 @@ static int via_get_info(char *buffer, char **addr, off_t offset, int count) | |||
289 | * via_set_speed writes timing values to the chipset registers | 119 | * via_set_speed writes timing values to the chipset registers |
290 | */ | 120 | */ |
291 | 121 | ||
292 | static void via_set_speed(struct pci_dev *dev, u8 dn, struct ide_timing *timing) | 122 | static void via_set_speed(ide_hwif_t *hwif, u8 dn, struct ide_timing *timing) |
293 | { | 123 | { |
124 | struct pci_dev *dev = hwif->pci_dev; | ||
125 | struct via82cxxx_dev *vdev = ide_get_hwifdata(hwif); | ||
294 | u8 t; | 126 | u8 t; |
295 | 127 | ||
296 | if (~via_config->flags & VIA_BAD_AST) { | 128 | if (~vdev->via_config->flags & VIA_BAD_AST) { |
297 | pci_read_config_byte(dev, VIA_ADDRESS_SETUP, &t); | 129 | pci_read_config_byte(dev, VIA_ADDRESS_SETUP, &t); |
298 | t = (t & ~(3 << ((3 - dn) << 1))) | ((FIT(timing->setup, 1, 4) - 1) << ((3 - dn) << 1)); | 130 | t = (t & ~(3 << ((3 - dn) << 1))) | ((FIT(timing->setup, 1, 4) - 1) << ((3 - dn) << 1)); |
299 | pci_write_config_byte(dev, VIA_ADDRESS_SETUP, t); | 131 | pci_write_config_byte(dev, VIA_ADDRESS_SETUP, t); |
@@ -305,7 +137,7 @@ static void via_set_speed(struct pci_dev *dev, u8 dn, struct ide_timing *timing) | |||
305 | pci_write_config_byte(dev, VIA_DRIVE_TIMING + (3 - dn), | 137 | pci_write_config_byte(dev, VIA_DRIVE_TIMING + (3 - dn), |
306 | ((FIT(timing->active, 1, 16) - 1) << 4) | (FIT(timing->recover, 1, 16) - 1)); | 138 | ((FIT(timing->active, 1, 16) - 1) << 4) | (FIT(timing->recover, 1, 16) - 1)); |
307 | 139 | ||
308 | switch (via_config->flags & VIA_UDMA) { | 140 | switch (vdev->via_config->flags & VIA_UDMA) { |
309 | case VIA_UDMA_33: t = timing->udma ? (0xe0 | (FIT(timing->udma, 2, 5) - 2)) : 0x03; break; | 141 | case VIA_UDMA_33: t = timing->udma ? (0xe0 | (FIT(timing->udma, 2, 5) - 2)) : 0x03; break; |
310 | case VIA_UDMA_66: t = timing->udma ? (0xe8 | (FIT(timing->udma, 2, 9) - 2)) : 0x0f; break; | 142 | case VIA_UDMA_66: t = timing->udma ? (0xe8 | (FIT(timing->udma, 2, 9) - 2)) : 0x0f; break; |
311 | case VIA_UDMA_100: t = timing->udma ? (0xe0 | (FIT(timing->udma, 2, 9) - 2)) : 0x07; break; | 143 | case VIA_UDMA_100: t = timing->udma ? (0xe0 | (FIT(timing->udma, 2, 9) - 2)) : 0x07; break; |
@@ -329,6 +161,7 @@ static void via_set_speed(struct pci_dev *dev, u8 dn, struct ide_timing *timing) | |||
329 | static int via_set_drive(ide_drive_t *drive, u8 speed) | 161 | static int via_set_drive(ide_drive_t *drive, u8 speed) |
330 | { | 162 | { |
331 | ide_drive_t *peer = HWIF(drive)->drives + (~drive->dn & 1); | 163 | ide_drive_t *peer = HWIF(drive)->drives + (~drive->dn & 1); |
164 | struct via82cxxx_dev *vdev = ide_get_hwifdata(drive->hwif); | ||
332 | struct ide_timing t, p; | 165 | struct ide_timing t, p; |
333 | unsigned int T, UT; | 166 | unsigned int T, UT; |
334 | 167 | ||
@@ -337,7 +170,7 @@ static int via_set_drive(ide_drive_t *drive, u8 speed) | |||
337 | 170 | ||
338 | T = 1000000000 / via_clock; | 171 | T = 1000000000 / via_clock; |
339 | 172 | ||
340 | switch (via_config->flags & VIA_UDMA) { | 173 | switch (vdev->via_config->flags & VIA_UDMA) { |
341 | case VIA_UDMA_33: UT = T; break; | 174 | case VIA_UDMA_33: UT = T; break; |
342 | case VIA_UDMA_66: UT = T/2; break; | 175 | case VIA_UDMA_66: UT = T/2; break; |
343 | case VIA_UDMA_100: UT = T/3; break; | 176 | case VIA_UDMA_100: UT = T/3; break; |
@@ -352,7 +185,7 @@ static int via_set_drive(ide_drive_t *drive, u8 speed) | |||
352 | ide_timing_merge(&p, &t, &t, IDE_TIMING_8BIT); | 185 | ide_timing_merge(&p, &t, &t, IDE_TIMING_8BIT); |
353 | } | 186 | } |
354 | 187 | ||
355 | via_set_speed(HWIF(drive)->pci_dev, drive->dn, &t); | 188 | via_set_speed(HWIF(drive), drive->dn, &t); |
356 | 189 | ||
357 | if (!drive->init_speed) | 190 | if (!drive->init_speed) |
358 | drive->init_speed = speed; | 191 | drive->init_speed = speed; |
@@ -390,20 +223,41 @@ static void via82cxxx_tune_drive(ide_drive_t *drive, u8 pio) | |||
390 | 223 | ||
391 | static int via82cxxx_ide_dma_check (ide_drive_t *drive) | 224 | static int via82cxxx_ide_dma_check (ide_drive_t *drive) |
392 | { | 225 | { |
393 | u16 w80 = HWIF(drive)->udma_four; | 226 | ide_hwif_t *hwif = HWIF(drive); |
227 | struct via82cxxx_dev *vdev = ide_get_hwifdata(hwif); | ||
228 | u16 w80 = hwif->udma_four; | ||
394 | 229 | ||
395 | u16 speed = ide_find_best_mode(drive, | 230 | u16 speed = ide_find_best_mode(drive, |
396 | XFER_PIO | XFER_EPIO | XFER_SWDMA | XFER_MWDMA | | 231 | XFER_PIO | XFER_EPIO | XFER_SWDMA | XFER_MWDMA | |
397 | (via_config->flags & VIA_UDMA ? XFER_UDMA : 0) | | 232 | (vdev->via_config->flags & VIA_UDMA ? XFER_UDMA : 0) | |
398 | (w80 && (via_config->flags & VIA_UDMA) >= VIA_UDMA_66 ? XFER_UDMA_66 : 0) | | 233 | (w80 && (vdev->via_config->flags & VIA_UDMA) >= VIA_UDMA_66 ? XFER_UDMA_66 : 0) | |
399 | (w80 && (via_config->flags & VIA_UDMA) >= VIA_UDMA_100 ? XFER_UDMA_100 : 0) | | 234 | (w80 && (vdev->via_config->flags & VIA_UDMA) >= VIA_UDMA_100 ? XFER_UDMA_100 : 0) | |
400 | (w80 && (via_config->flags & VIA_UDMA) >= VIA_UDMA_133 ? XFER_UDMA_133 : 0)); | 235 | (w80 && (vdev->via_config->flags & VIA_UDMA) >= VIA_UDMA_133 ? XFER_UDMA_133 : 0)); |
401 | 236 | ||
402 | via_set_drive(drive, speed); | 237 | via_set_drive(drive, speed); |
403 | 238 | ||
404 | if (drive->autodma && (speed & XFER_MODE) != XFER_PIO) | 239 | if (drive->autodma && (speed & XFER_MODE) != XFER_PIO) |
405 | return HWIF(drive)->ide_dma_on(drive); | 240 | return hwif->ide_dma_on(drive); |
406 | return HWIF(drive)->ide_dma_off_quietly(drive); | 241 | return hwif->ide_dma_off_quietly(drive); |
242 | } | ||
243 | |||
244 | static struct via_isa_bridge *via_config_find(struct pci_dev **isa) | ||
245 | { | ||
246 | struct via_isa_bridge *via_config; | ||
247 | u8 t; | ||
248 | |||
249 | for (via_config = via_isa_bridges; via_config->id; via_config++) | ||
250 | if ((*isa = pci_find_device(PCI_VENDOR_ID_VIA + | ||
251 | !!(via_config->flags & VIA_BAD_ID), | ||
252 | via_config->id, NULL))) { | ||
253 | |||
254 | pci_read_config_byte(*isa, PCI_REVISION_ID, &t); | ||
255 | if (t >= via_config->rev_min && | ||
256 | t <= via_config->rev_max) | ||
257 | break; | ||
258 | } | ||
259 | |||
260 | return via_config; | ||
407 | } | 261 | } |
408 | 262 | ||
409 | /** | 263 | /** |
@@ -418,82 +272,28 @@ static int via82cxxx_ide_dma_check (ide_drive_t *drive) | |||
418 | static unsigned int __devinit init_chipset_via82cxxx(struct pci_dev *dev, const char *name) | 272 | static unsigned int __devinit init_chipset_via82cxxx(struct pci_dev *dev, const char *name) |
419 | { | 273 | { |
420 | struct pci_dev *isa = NULL; | 274 | struct pci_dev *isa = NULL; |
275 | struct via_isa_bridge *via_config; | ||
421 | u8 t, v; | 276 | u8 t, v; |
422 | unsigned int u; | 277 | unsigned int u; |
423 | int i; | ||
424 | 278 | ||
425 | /* | 279 | /* |
426 | * Find the ISA bridge to see how good the IDE is. | 280 | * Find the ISA bridge to see how good the IDE is. |
427 | */ | 281 | */ |
428 | 282 | via_config = via_config_find(&isa); | |
429 | for (via_config = via_isa_bridges; via_config->id; via_config++) | ||
430 | if ((isa = pci_find_device(PCI_VENDOR_ID_VIA + | ||
431 | !!(via_config->flags & VIA_BAD_ID), | ||
432 | via_config->id, NULL))) { | ||
433 | |||
434 | pci_read_config_byte(isa, PCI_REVISION_ID, &t); | ||
435 | if (t >= via_config->rev_min && | ||
436 | t <= via_config->rev_max) | ||
437 | break; | ||
438 | } | ||
439 | |||
440 | if (!via_config->id) { | 283 | if (!via_config->id) { |
441 | printk(KERN_WARNING "VP_IDE: Unknown VIA SouthBridge, disabling DMA.\n"); | 284 | printk(KERN_WARNING "VP_IDE: Unknown VIA SouthBridge, disabling DMA.\n"); |
442 | return -ENODEV; | 285 | return -ENODEV; |
443 | } | 286 | } |
444 | 287 | ||
445 | /* | 288 | /* |
446 | * Check 80-wire cable presence and setup Clk66. | 289 | * Setup or disable Clk66 if appropriate |
447 | */ | 290 | */ |
448 | 291 | ||
449 | switch (via_config->flags & VIA_UDMA) { | 292 | if ((via_config->flags & VIA_UDMA) == VIA_UDMA_66) { |
450 | 293 | /* Enable Clk66 */ | |
451 | case VIA_UDMA_66: | 294 | pci_read_config_dword(dev, VIA_UDMA_TIMING, &u); |
452 | /* Enable Clk66 */ | 295 | pci_write_config_dword(dev, VIA_UDMA_TIMING, u|0x80008); |
453 | pci_read_config_dword(dev, VIA_UDMA_TIMING, &u); | 296 | } else if (via_config->flags & VIA_BAD_CLK66) { |
454 | pci_write_config_dword(dev, VIA_UDMA_TIMING, u|0x80008); | ||
455 | for (i = 24; i >= 0; i -= 8) | ||
456 | if (((u >> (i & 16)) & 8) && | ||
457 | ((u >> i) & 0x20) && | ||
458 | (((u >> i) & 7) < 2)) { | ||
459 | /* | ||
460 | * 2x PCI clock and | ||
461 | * UDMA w/ < 3T/cycle | ||
462 | */ | ||
463 | via_80w |= (1 << (1 - (i >> 4))); | ||
464 | } | ||
465 | break; | ||
466 | |||
467 | case VIA_UDMA_100: | ||
468 | pci_read_config_dword(dev, VIA_UDMA_TIMING, &u); | ||
469 | for (i = 24; i >= 0; i -= 8) | ||
470 | if (((u >> i) & 0x10) || | ||
471 | (((u >> i) & 0x20) && | ||
472 | (((u >> i) & 7) < 4))) { | ||
473 | /* BIOS 80-wire bit or | ||
474 | * UDMA w/ < 60ns/cycle | ||
475 | */ | ||
476 | via_80w |= (1 << (1 - (i >> 4))); | ||
477 | } | ||
478 | break; | ||
479 | |||
480 | case VIA_UDMA_133: | ||
481 | pci_read_config_dword(dev, VIA_UDMA_TIMING, &u); | ||
482 | for (i = 24; i >= 0; i -= 8) | ||
483 | if (((u >> i) & 0x10) || | ||
484 | (((u >> i) & 0x20) && | ||
485 | (((u >> i) & 7) < 6))) { | ||
486 | /* BIOS 80-wire bit or | ||
487 | * UDMA w/ < 60ns/cycle | ||
488 | */ | ||
489 | via_80w |= (1 << (1 - (i >> 4))); | ||
490 | } | ||
491 | break; | ||
492 | |||
493 | } | ||
494 | |||
495 | /* Disable Clk66 */ | ||
496 | if (via_config->flags & VIA_BAD_CLK66) { | ||
497 | /* Would cause trouble on 596a and 686 */ | 297 | /* Would cause trouble on 596a and 686 */ |
498 | pci_read_config_dword(dev, VIA_UDMA_TIMING, &u); | 298 | pci_read_config_dword(dev, VIA_UDMA_TIMING, &u); |
499 | pci_write_config_dword(dev, VIA_UDMA_TIMING, u & ~0x80008); | 299 | pci_write_config_dword(dev, VIA_UDMA_TIMING, u & ~0x80008); |
@@ -560,26 +360,78 @@ static unsigned int __devinit init_chipset_via82cxxx(struct pci_dev *dev, const | |||
560 | via_dma[via_config->flags & VIA_UDMA], | 360 | via_dma[via_config->flags & VIA_UDMA], |
561 | pci_name(dev)); | 361 | pci_name(dev)); |
562 | 362 | ||
563 | /* | 363 | return 0; |
564 | * Setup /proc/ide/via entry. | 364 | } |
565 | */ | 365 | |
366 | /* | ||
367 | * Check and handle 80-wire cable presence | ||
368 | */ | ||
369 | static void __devinit via_cable_detect(struct pci_dev *dev, struct via82cxxx_dev *vdev) | ||
370 | { | ||
371 | unsigned int u; | ||
372 | int i; | ||
373 | pci_read_config_dword(dev, VIA_UDMA_TIMING, &u); | ||
374 | |||
375 | switch (vdev->via_config->flags & VIA_UDMA) { | ||
376 | |||
377 | case VIA_UDMA_66: | ||
378 | for (i = 24; i >= 0; i -= 8) | ||
379 | if (((u >> (i & 16)) & 8) && | ||
380 | ((u >> i) & 0x20) && | ||
381 | (((u >> i) & 7) < 2)) { | ||
382 | /* | ||
383 | * 2x PCI clock and | ||
384 | * UDMA w/ < 3T/cycle | ||
385 | */ | ||
386 | vdev->via_80w |= (1 << (1 - (i >> 4))); | ||
387 | } | ||
388 | break; | ||
389 | |||
390 | case VIA_UDMA_100: | ||
391 | for (i = 24; i >= 0; i -= 8) | ||
392 | if (((u >> i) & 0x10) || | ||
393 | (((u >> i) & 0x20) && | ||
394 | (((u >> i) & 7) < 4))) { | ||
395 | /* BIOS 80-wire bit or | ||
396 | * UDMA w/ < 60ns/cycle | ||
397 | */ | ||
398 | vdev->via_80w |= (1 << (1 - (i >> 4))); | ||
399 | } | ||
400 | break; | ||
401 | |||
402 | case VIA_UDMA_133: | ||
403 | for (i = 24; i >= 0; i -= 8) | ||
404 | if (((u >> i) & 0x10) || | ||
405 | (((u >> i) & 0x20) && | ||
406 | (((u >> i) & 7) < 6))) { | ||
407 | /* BIOS 80-wire bit or | ||
408 | * UDMA w/ < 60ns/cycle | ||
409 | */ | ||
410 | vdev->via_80w |= (1 << (1 - (i >> 4))); | ||
411 | } | ||
412 | break; | ||
566 | 413 | ||
567 | #if defined(DISPLAY_VIA_TIMINGS) && defined(CONFIG_PROC_FS) | ||
568 | if (!via_proc) { | ||
569 | via_base = pci_resource_start(dev, 4); | ||
570 | bmide_dev = dev; | ||
571 | isa_dev = isa; | ||
572 | ide_pci_create_host_proc("via", via_get_info); | ||
573 | via_proc = 1; | ||
574 | } | 414 | } |
575 | #endif /* DISPLAY_VIA_TIMINGS && CONFIG_PROC_FS */ | ||
576 | return 0; | ||
577 | } | 415 | } |
578 | 416 | ||
579 | static void __devinit init_hwif_via82cxxx(ide_hwif_t *hwif) | 417 | static void __devinit init_hwif_via82cxxx(ide_hwif_t *hwif) |
580 | { | 418 | { |
419 | struct via82cxxx_dev *vdev = kmalloc(sizeof(struct via82cxxx_dev), | ||
420 | GFP_KERNEL); | ||
421 | struct pci_dev *isa = NULL; | ||
581 | int i; | 422 | int i; |
582 | 423 | ||
424 | if (vdev == NULL) { | ||
425 | printk(KERN_ERR "VP_IDE: out of memory :(\n"); | ||
426 | return; | ||
427 | } | ||
428 | |||
429 | memset(vdev, 0, sizeof(struct via82cxxx_dev)); | ||
430 | ide_set_hwifdata(hwif, vdev); | ||
431 | |||
432 | vdev->via_config = via_config_find(&isa); | ||
433 | via_cable_detect(hwif->pci_dev, vdev); | ||
434 | |||
583 | hwif->autodma = 0; | 435 | hwif->autodma = 0; |
584 | 436 | ||
585 | hwif->tuneproc = &via82cxxx_tune_drive; | 437 | hwif->tuneproc = &via82cxxx_tune_drive; |
@@ -594,7 +446,7 @@ static void __devinit init_hwif_via82cxxx(ide_hwif_t *hwif) | |||
594 | 446 | ||
595 | for (i = 0; i < 2; i++) { | 447 | for (i = 0; i < 2; i++) { |
596 | hwif->drives[i].io_32bit = 1; | 448 | hwif->drives[i].io_32bit = 1; |
597 | hwif->drives[i].unmask = (via_config->flags & VIA_NO_UNMASK) ? 0 : 1; | 449 | hwif->drives[i].unmask = (vdev->via_config->flags & VIA_NO_UNMASK) ? 0 : 1; |
598 | hwif->drives[i].autotune = 1; | 450 | hwif->drives[i].autotune = 1; |
599 | hwif->drives[i].dn = hwif->channel * 2 + i; | 451 | hwif->drives[i].dn = hwif->channel * 2 + i; |
600 | } | 452 | } |
@@ -608,7 +460,7 @@ static void __devinit init_hwif_via82cxxx(ide_hwif_t *hwif) | |||
608 | hwif->swdma_mask = 0x07; | 460 | hwif->swdma_mask = 0x07; |
609 | 461 | ||
610 | if (!hwif->udma_four) | 462 | if (!hwif->udma_four) |
611 | hwif->udma_four = (via_80w >> hwif->channel) & 1; | 463 | hwif->udma_four = (vdev->via_80w >> hwif->channel) & 1; |
612 | hwif->ide_dma_check = &via82cxxx_ide_dma_check; | 464 | hwif->ide_dma_check = &via82cxxx_ide_dma_check; |
613 | if (!noautodma) | 465 | if (!noautodma) |
614 | hwif->autodma = 1; | 466 | hwif->autodma = 1; |
@@ -616,24 +468,35 @@ static void __devinit init_hwif_via82cxxx(ide_hwif_t *hwif) | |||
616 | hwif->drives[1].autodma = hwif->autodma; | 468 | hwif->drives[1].autodma = hwif->autodma; |
617 | } | 469 | } |
618 | 470 | ||
619 | static ide_pci_device_t via82cxxx_chipset __devinitdata = { | 471 | static ide_pci_device_t via82cxxx_chipsets[] __devinitdata = { |
620 | .name = "VP_IDE", | 472 | { /* 0 */ |
621 | .init_chipset = init_chipset_via82cxxx, | 473 | .name = "VP_IDE", |
622 | .init_hwif = init_hwif_via82cxxx, | 474 | .init_chipset = init_chipset_via82cxxx, |
623 | .channels = 2, | 475 | .init_hwif = init_hwif_via82cxxx, |
624 | .autodma = NOAUTODMA, | 476 | .channels = 2, |
625 | .enablebits = {{0x40,0x02,0x02}, {0x40,0x01,0x01}}, | 477 | .autodma = NOAUTODMA, |
626 | .bootable = ON_BOARD, | 478 | .enablebits = {{0x40,0x02,0x02}, {0x40,0x01,0x01}}, |
479 | .bootable = ON_BOARD | ||
480 | },{ /* 1 */ | ||
481 | .name = "VP_IDE", | ||
482 | .init_chipset = init_chipset_via82cxxx, | ||
483 | .init_hwif = init_hwif_via82cxxx, | ||
484 | .channels = 2, | ||
485 | .autodma = AUTODMA, | ||
486 | .enablebits = {{0x00,0x00,0x00}, {0x00,0x00,0x00}}, | ||
487 | .bootable = ON_BOARD, | ||
488 | } | ||
627 | }; | 489 | }; |
628 | 490 | ||
629 | static int __devinit via_init_one(struct pci_dev *dev, const struct pci_device_id *id) | 491 | static int __devinit via_init_one(struct pci_dev *dev, const struct pci_device_id *id) |
630 | { | 492 | { |
631 | return ide_setup_pci_device(dev, &via82cxxx_chipset); | 493 | return ide_setup_pci_device(dev, &via82cxxx_chipsets[id->driver_data]); |
632 | } | 494 | } |
633 | 495 | ||
634 | static struct pci_device_id via_pci_tbl[] = { | 496 | static struct pci_device_id via_pci_tbl[] = { |
635 | { PCI_VENDOR_ID_VIA, PCI_DEVICE_ID_VIA_82C576_1, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, | 497 | { PCI_VENDOR_ID_VIA, PCI_DEVICE_ID_VIA_82C576_1, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, |
636 | { PCI_VENDOR_ID_VIA, PCI_DEVICE_ID_VIA_82C586_1, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, | 498 | { PCI_VENDOR_ID_VIA, PCI_DEVICE_ID_VIA_82C586_1, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, |
499 | { PCI_VENDOR_ID_VIA, PCI_DEVICE_ID_VIA_6410, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 1}, | ||
637 | { 0, }, | 500 | { 0, }, |
638 | }; | 501 | }; |
639 | MODULE_DEVICE_TABLE(pci, via_pci_tbl); | 502 | MODULE_DEVICE_TABLE(pci, via_pci_tbl); |
diff --git a/drivers/ide/ppc/pmac.c b/drivers/ide/ppc/pmac.c index 136911a86e84..16b28357885b 100644 --- a/drivers/ide/ppc/pmac.c +++ b/drivers/ide/ppc/pmac.c | |||
@@ -1401,20 +1401,6 @@ pmac_ide_setup_device(pmac_ide_hwif_t *pmif, ide_hwif_t *hwif) | |||
1401 | /* We probe the hwif now */ | 1401 | /* We probe the hwif now */ |
1402 | probe_hwif_init(hwif); | 1402 | probe_hwif_init(hwif); |
1403 | 1403 | ||
1404 | /* The code IDE code will have set hwif->present if we have devices attached, | ||
1405 | * if we don't, the discard the interface except if we are on a media bay slot | ||
1406 | */ | ||
1407 | if (!hwif->present && !pmif->mediabay) { | ||
1408 | printk(KERN_INFO "ide%d: Bus empty, interface released.\n", | ||
1409 | hwif->index); | ||
1410 | default_hwif_iops(hwif); | ||
1411 | for (i = IDE_DATA_OFFSET; i <= IDE_CONTROL_OFFSET; ++i) | ||
1412 | hwif->io_ports[i] = 0; | ||
1413 | hwif->chipset = ide_unknown; | ||
1414 | hwif->noprobe = 1; | ||
1415 | return -ENODEV; | ||
1416 | } | ||
1417 | |||
1418 | return 0; | 1404 | return 0; |
1419 | } | 1405 | } |
1420 | 1406 | ||
diff --git a/drivers/ide/setup-pci.c b/drivers/ide/setup-pci.c index d4f2111d4364..7ebf992e8c2f 100644 --- a/drivers/ide/setup-pci.c +++ b/drivers/ide/setup-pci.c | |||
@@ -787,7 +787,7 @@ static int pre_init = 1; /* Before first ordered IDE scan */ | |||
787 | static LIST_HEAD(ide_pci_drivers); | 787 | static LIST_HEAD(ide_pci_drivers); |
788 | 788 | ||
789 | /* | 789 | /* |
790 | * __ide_register_pci_driver - attach IDE driver | 790 | * __ide_pci_register_driver - attach IDE driver |
791 | * @driver: pci driver | 791 | * @driver: pci driver |
792 | * @module: owner module of the driver | 792 | * @module: owner module of the driver |
793 | * | 793 | * |
diff --git a/drivers/infiniband/core/user_mad.c b/drivers/infiniband/core/user_mad.c index 5ea741f47fc8..e73f81c22381 100644 --- a/drivers/infiniband/core/user_mad.c +++ b/drivers/infiniband/core/user_mad.c | |||
@@ -312,7 +312,7 @@ static ssize_t ib_umad_write(struct file *filp, const char __user *buf, | |||
312 | int ret, length, hdr_len, copy_offset; | 312 | int ret, length, hdr_len, copy_offset; |
313 | int rmpp_active = 0; | 313 | int rmpp_active = 0; |
314 | 314 | ||
315 | if (count < sizeof (struct ib_user_mad)) | 315 | if (count < sizeof (struct ib_user_mad) + IB_MGMT_RMPP_HDR) |
316 | return -EINVAL; | 316 | return -EINVAL; |
317 | 317 | ||
318 | length = count - sizeof (struct ib_user_mad); | 318 | length = count - sizeof (struct ib_user_mad); |
diff --git a/drivers/infiniband/hw/mthca/mthca_qp.c b/drivers/infiniband/hw/mthca/mthca_qp.c index 760c418d5bc9..dd4e13303e96 100644 --- a/drivers/infiniband/hw/mthca/mthca_qp.c +++ b/drivers/infiniband/hw/mthca/mthca_qp.c | |||
@@ -730,15 +730,16 @@ int mthca_modify_qp(struct ib_qp *ibqp, struct ib_qp_attr *attr, int attr_mask) | |||
730 | } | 730 | } |
731 | 731 | ||
732 | if (attr_mask & IB_QP_ACCESS_FLAGS) { | 732 | if (attr_mask & IB_QP_ACCESS_FLAGS) { |
733 | qp_context->params2 |= | ||
734 | cpu_to_be32(attr->qp_access_flags & IB_ACCESS_REMOTE_WRITE ? | ||
735 | MTHCA_QP_BIT_RWE : 0); | ||
736 | |||
733 | /* | 737 | /* |
734 | * Only enable RDMA/atomics if we have responder | 738 | * Only enable RDMA reads and atomics if we have |
735 | * resources set to a non-zero value. | 739 | * responder resources set to a non-zero value. |
736 | */ | 740 | */ |
737 | if (qp->resp_depth) { | 741 | if (qp->resp_depth) { |
738 | qp_context->params2 |= | 742 | qp_context->params2 |= |
739 | cpu_to_be32(attr->qp_access_flags & IB_ACCESS_REMOTE_WRITE ? | ||
740 | MTHCA_QP_BIT_RWE : 0); | ||
741 | qp_context->params2 |= | ||
742 | cpu_to_be32(attr->qp_access_flags & IB_ACCESS_REMOTE_READ ? | 743 | cpu_to_be32(attr->qp_access_flags & IB_ACCESS_REMOTE_READ ? |
743 | MTHCA_QP_BIT_RRE : 0); | 744 | MTHCA_QP_BIT_RRE : 0); |
744 | qp_context->params2 |= | 745 | qp_context->params2 |= |
@@ -759,31 +760,27 @@ int mthca_modify_qp(struct ib_qp *ibqp, struct ib_qp_attr *attr, int attr_mask) | |||
759 | if (qp->resp_depth && !attr->max_dest_rd_atomic) { | 760 | if (qp->resp_depth && !attr->max_dest_rd_atomic) { |
760 | /* | 761 | /* |
761 | * Lowering our responder resources to zero. | 762 | * Lowering our responder resources to zero. |
762 | * Turn off RDMA/atomics as responder. | 763 | * Turn off reads RDMA and atomics as responder. |
763 | * (RWE/RRE/RAE in params2 already zero) | 764 | * (RRE/RAE in params2 already zero) |
764 | */ | 765 | */ |
765 | qp_param->opt_param_mask |= cpu_to_be32(MTHCA_QP_OPTPAR_RWE | | 766 | qp_param->opt_param_mask |= cpu_to_be32(MTHCA_QP_OPTPAR_RRE | |
766 | MTHCA_QP_OPTPAR_RRE | | ||
767 | MTHCA_QP_OPTPAR_RAE); | 767 | MTHCA_QP_OPTPAR_RAE); |
768 | } | 768 | } |
769 | 769 | ||
770 | if (!qp->resp_depth && attr->max_dest_rd_atomic) { | 770 | if (!qp->resp_depth && attr->max_dest_rd_atomic) { |
771 | /* | 771 | /* |
772 | * Increasing our responder resources from | 772 | * Increasing our responder resources from |
773 | * zero. Turn on RDMA/atomics as appropriate. | 773 | * zero. Turn on RDMA reads and atomics as |
774 | * appropriate. | ||
774 | */ | 775 | */ |
775 | qp_context->params2 |= | 776 | qp_context->params2 |= |
776 | cpu_to_be32(qp->atomic_rd_en & IB_ACCESS_REMOTE_WRITE ? | ||
777 | MTHCA_QP_BIT_RWE : 0); | ||
778 | qp_context->params2 |= | ||
779 | cpu_to_be32(qp->atomic_rd_en & IB_ACCESS_REMOTE_READ ? | 777 | cpu_to_be32(qp->atomic_rd_en & IB_ACCESS_REMOTE_READ ? |
780 | MTHCA_QP_BIT_RRE : 0); | 778 | MTHCA_QP_BIT_RRE : 0); |
781 | qp_context->params2 |= | 779 | qp_context->params2 |= |
782 | cpu_to_be32(qp->atomic_rd_en & IB_ACCESS_REMOTE_ATOMIC ? | 780 | cpu_to_be32(qp->atomic_rd_en & IB_ACCESS_REMOTE_ATOMIC ? |
783 | MTHCA_QP_BIT_RAE : 0); | 781 | MTHCA_QP_BIT_RAE : 0); |
784 | 782 | ||
785 | qp_param->opt_param_mask |= cpu_to_be32(MTHCA_QP_OPTPAR_RWE | | 783 | qp_param->opt_param_mask |= cpu_to_be32(MTHCA_QP_OPTPAR_RRE | |
786 | MTHCA_QP_OPTPAR_RRE | | ||
787 | MTHCA_QP_OPTPAR_RAE); | 784 | MTHCA_QP_OPTPAR_RAE); |
788 | } | 785 | } |
789 | 786 | ||
@@ -921,10 +918,12 @@ static void mthca_adjust_qp_caps(struct mthca_dev *dev, | |||
921 | else | 918 | else |
922 | qp->max_inline_data = max_data_size - MTHCA_INLINE_HEADER_SIZE; | 919 | qp->max_inline_data = max_data_size - MTHCA_INLINE_HEADER_SIZE; |
923 | 920 | ||
924 | qp->sq.max_gs = max_data_size / sizeof (struct mthca_data_seg); | 921 | qp->sq.max_gs = min_t(int, dev->limits.max_sg, |
925 | qp->rq.max_gs = (min(dev->limits.max_desc_sz, 1 << qp->rq.wqe_shift) - | 922 | max_data_size / sizeof (struct mthca_data_seg)); |
926 | sizeof (struct mthca_next_seg)) / | 923 | qp->rq.max_gs = min_t(int, dev->limits.max_sg, |
927 | sizeof (struct mthca_data_seg); | 924 | (min(dev->limits.max_desc_sz, 1 << qp->rq.wqe_shift) - |
925 | sizeof (struct mthca_next_seg)) / | ||
926 | sizeof (struct mthca_data_seg)); | ||
928 | } | 927 | } |
929 | 928 | ||
930 | /* | 929 | /* |
diff --git a/drivers/infiniband/ulp/srp/ib_srp.c b/drivers/infiniband/ulp/srp/ib_srp.c index 321a3a10e69b..ee9fe226ae99 100644 --- a/drivers/infiniband/ulp/srp/ib_srp.c +++ b/drivers/infiniband/ulp/srp/ib_srp.c | |||
@@ -802,13 +802,21 @@ static int srp_post_recv(struct srp_target_port *target) | |||
802 | 802 | ||
803 | /* | 803 | /* |
804 | * Must be called with target->scsi_host->host_lock held to protect | 804 | * Must be called with target->scsi_host->host_lock held to protect |
805 | * req_lim and tx_head. | 805 | * req_lim and tx_head. Lock cannot be dropped between call here and |
806 | * call to __srp_post_send(). | ||
806 | */ | 807 | */ |
807 | static struct srp_iu *__srp_get_tx_iu(struct srp_target_port *target) | 808 | static struct srp_iu *__srp_get_tx_iu(struct srp_target_port *target) |
808 | { | 809 | { |
809 | if (target->tx_head - target->tx_tail >= SRP_SQ_SIZE) | 810 | if (target->tx_head - target->tx_tail >= SRP_SQ_SIZE) |
810 | return NULL; | 811 | return NULL; |
811 | 812 | ||
813 | if (unlikely(target->req_lim < 1)) { | ||
814 | if (printk_ratelimit()) | ||
815 | printk(KERN_DEBUG PFX "Target has req_lim %d\n", | ||
816 | target->req_lim); | ||
817 | return NULL; | ||
818 | } | ||
819 | |||
812 | return target->tx_ring[target->tx_head & SRP_SQ_SIZE]; | 820 | return target->tx_ring[target->tx_head & SRP_SQ_SIZE]; |
813 | } | 821 | } |
814 | 822 | ||
@@ -823,11 +831,6 @@ static int __srp_post_send(struct srp_target_port *target, | |||
823 | struct ib_send_wr wr, *bad_wr; | 831 | struct ib_send_wr wr, *bad_wr; |
824 | int ret = 0; | 832 | int ret = 0; |
825 | 833 | ||
826 | if (target->req_lim < 1) { | ||
827 | printk(KERN_ERR PFX "Target has req_lim %d\n", target->req_lim); | ||
828 | return -EAGAIN; | ||
829 | } | ||
830 | |||
831 | list.addr = iu->dma; | 834 | list.addr = iu->dma; |
832 | list.length = len; | 835 | list.length = len; |
833 | list.lkey = target->srp_host->mr->lkey; | 836 | list.lkey = target->srp_host->mr->lkey; |
@@ -1417,6 +1420,8 @@ static ssize_t srp_create_target(struct class_device *class_dev, | |||
1417 | if (!target_host) | 1420 | if (!target_host) |
1418 | return -ENOMEM; | 1421 | return -ENOMEM; |
1419 | 1422 | ||
1423 | target_host->max_lun = SRP_MAX_LUN; | ||
1424 | |||
1420 | target = host_to_target(target_host); | 1425 | target = host_to_target(target_host); |
1421 | memset(target, 0, sizeof *target); | 1426 | memset(target, 0, sizeof *target); |
1422 | 1427 | ||
diff --git a/drivers/infiniband/ulp/srp/ib_srp.h b/drivers/infiniband/ulp/srp/ib_srp.h index 4fec28a71367..b564f18caf78 100644 --- a/drivers/infiniband/ulp/srp/ib_srp.h +++ b/drivers/infiniband/ulp/srp/ib_srp.h | |||
@@ -54,6 +54,7 @@ enum { | |||
54 | SRP_PORT_REDIRECT = 1, | 54 | SRP_PORT_REDIRECT = 1, |
55 | SRP_DLID_REDIRECT = 2, | 55 | SRP_DLID_REDIRECT = 2, |
56 | 56 | ||
57 | SRP_MAX_LUN = 512, | ||
57 | SRP_MAX_IU_LEN = 256, | 58 | SRP_MAX_IU_LEN = 256, |
58 | 59 | ||
59 | SRP_RQ_SHIFT = 6, | 60 | SRP_RQ_SHIFT = 6, |
diff --git a/drivers/input/gameport/gameport.c b/drivers/input/gameport/gameport.c index 0506934244f0..caac6d63d46f 100644 --- a/drivers/input/gameport/gameport.c +++ b/drivers/input/gameport/gameport.c | |||
@@ -339,14 +339,20 @@ static struct gameport_event *gameport_get_event(void) | |||
339 | return event; | 339 | return event; |
340 | } | 340 | } |
341 | 341 | ||
342 | static void gameport_handle_events(void) | 342 | static void gameport_handle_event(void) |
343 | { | 343 | { |
344 | struct gameport_event *event; | 344 | struct gameport_event *event; |
345 | struct gameport_driver *gameport_drv; | 345 | struct gameport_driver *gameport_drv; |
346 | 346 | ||
347 | down(&gameport_sem); | 347 | down(&gameport_sem); |
348 | 348 | ||
349 | while ((event = gameport_get_event())) { | 349 | /* |
350 | * Note that we handle only one event here to give swsusp | ||
351 | * a chance to freeze kgameportd thread. Gameport events | ||
352 | * should be pretty rare so we are not concerned about | ||
353 | * taking performance hit. | ||
354 | */ | ||
355 | if ((event = gameport_get_event())) { | ||
350 | 356 | ||
351 | switch (event->type) { | 357 | switch (event->type) { |
352 | case GAMEPORT_REGISTER_PORT: | 358 | case GAMEPORT_REGISTER_PORT: |
@@ -433,7 +439,7 @@ static struct gameport *gameport_get_pending_child(struct gameport *parent) | |||
433 | static int gameport_thread(void *nothing) | 439 | static int gameport_thread(void *nothing) |
434 | { | 440 | { |
435 | do { | 441 | do { |
436 | gameport_handle_events(); | 442 | gameport_handle_event(); |
437 | wait_event_interruptible(gameport_wait, | 443 | wait_event_interruptible(gameport_wait, |
438 | kthread_should_stop() || !list_empty(&gameport_event_list)); | 444 | kthread_should_stop() || !list_empty(&gameport_event_list)); |
439 | try_to_freeze(); | 445 | try_to_freeze(); |
diff --git a/drivers/input/input.c b/drivers/input/input.c index c8ae2bb054e0..bdd2a7fc268d 100644 --- a/drivers/input/input.c +++ b/drivers/input/input.c | |||
@@ -536,7 +536,7 @@ static struct attribute *input_dev_attrs[] = { | |||
536 | NULL | 536 | NULL |
537 | }; | 537 | }; |
538 | 538 | ||
539 | static struct attribute_group input_dev_group = { | 539 | static struct attribute_group input_dev_attr_group = { |
540 | .attrs = input_dev_attrs, | 540 | .attrs = input_dev_attrs, |
541 | }; | 541 | }; |
542 | 542 | ||
@@ -717,35 +717,14 @@ struct input_dev *input_allocate_device(void) | |||
717 | return dev; | 717 | return dev; |
718 | } | 718 | } |
719 | 719 | ||
720 | static void input_register_classdevice(struct input_dev *dev) | ||
721 | { | ||
722 | static atomic_t input_no = ATOMIC_INIT(0); | ||
723 | const char *path; | ||
724 | |||
725 | __module_get(THIS_MODULE); | ||
726 | |||
727 | dev->dev = dev->cdev.dev; | ||
728 | |||
729 | snprintf(dev->cdev.class_id, sizeof(dev->cdev.class_id), | ||
730 | "input%ld", (unsigned long) atomic_inc_return(&input_no) - 1); | ||
731 | |||
732 | path = kobject_get_path(&dev->cdev.class->subsys.kset.kobj, GFP_KERNEL); | ||
733 | printk(KERN_INFO "input: %s as %s/%s\n", | ||
734 | dev->name ? dev->name : "Unspecified device", | ||
735 | path ? path : "", dev->cdev.class_id); | ||
736 | kfree(path); | ||
737 | |||
738 | class_device_add(&dev->cdev); | ||
739 | sysfs_create_group(&dev->cdev.kobj, &input_dev_group); | ||
740 | sysfs_create_group(&dev->cdev.kobj, &input_dev_id_attr_group); | ||
741 | sysfs_create_group(&dev->cdev.kobj, &input_dev_caps_attr_group); | ||
742 | } | ||
743 | |||
744 | int input_register_device(struct input_dev *dev) | 720 | int input_register_device(struct input_dev *dev) |
745 | { | 721 | { |
722 | static atomic_t input_no = ATOMIC_INIT(0); | ||
746 | struct input_handle *handle; | 723 | struct input_handle *handle; |
747 | struct input_handler *handler; | 724 | struct input_handler *handler; |
748 | struct input_device_id *id; | 725 | struct input_device_id *id; |
726 | const char *path; | ||
727 | int error; | ||
749 | 728 | ||
750 | if (!dev->dynalloc) { | 729 | if (!dev->dynalloc) { |
751 | printk(KERN_WARNING "input: device %s is statically allocated, will not register\n" | 730 | printk(KERN_WARNING "input: device %s is statically allocated, will not register\n" |
@@ -773,7 +752,32 @@ int input_register_device(struct input_dev *dev) | |||
773 | INIT_LIST_HEAD(&dev->h_list); | 752 | INIT_LIST_HEAD(&dev->h_list); |
774 | list_add_tail(&dev->node, &input_dev_list); | 753 | list_add_tail(&dev->node, &input_dev_list); |
775 | 754 | ||
776 | input_register_classdevice(dev); | 755 | dev->cdev.class = &input_class; |
756 | snprintf(dev->cdev.class_id, sizeof(dev->cdev.class_id), | ||
757 | "input%ld", (unsigned long) atomic_inc_return(&input_no) - 1); | ||
758 | |||
759 | error = class_device_add(&dev->cdev); | ||
760 | if (error) | ||
761 | return error; | ||
762 | |||
763 | error = sysfs_create_group(&dev->cdev.kobj, &input_dev_attr_group); | ||
764 | if (error) | ||
765 | goto fail1; | ||
766 | |||
767 | error = sysfs_create_group(&dev->cdev.kobj, &input_dev_id_attr_group); | ||
768 | if (error) | ||
769 | goto fail2; | ||
770 | |||
771 | error = sysfs_create_group(&dev->cdev.kobj, &input_dev_caps_attr_group); | ||
772 | if (error) | ||
773 | goto fail3; | ||
774 | |||
775 | __module_get(THIS_MODULE); | ||
776 | |||
777 | path = kobject_get_path(&dev->cdev.kobj, GFP_KERNEL); | ||
778 | printk(KERN_INFO "input: %s as %s\n", | ||
779 | dev->name ? dev->name : "Unspecified device", path ? path : "N/A"); | ||
780 | kfree(path); | ||
777 | 781 | ||
778 | list_for_each_entry(handler, &input_handler_list, node) | 782 | list_for_each_entry(handler, &input_handler_list, node) |
779 | if (!handler->blacklist || !input_match_device(handler->blacklist, dev)) | 783 | if (!handler->blacklist || !input_match_device(handler->blacklist, dev)) |
@@ -784,6 +788,11 @@ int input_register_device(struct input_dev *dev) | |||
784 | input_wakeup_procfs_readers(); | 788 | input_wakeup_procfs_readers(); |
785 | 789 | ||
786 | return 0; | 790 | return 0; |
791 | |||
792 | fail3: sysfs_remove_group(&dev->cdev.kobj, &input_dev_id_attr_group); | ||
793 | fail2: sysfs_remove_group(&dev->cdev.kobj, &input_dev_attr_group); | ||
794 | fail1: class_device_del(&dev->cdev); | ||
795 | return error; | ||
787 | } | 796 | } |
788 | 797 | ||
789 | void input_unregister_device(struct input_dev *dev) | 798 | void input_unregister_device(struct input_dev *dev) |
@@ -805,7 +814,7 @@ void input_unregister_device(struct input_dev *dev) | |||
805 | 814 | ||
806 | sysfs_remove_group(&dev->cdev.kobj, &input_dev_caps_attr_group); | 815 | sysfs_remove_group(&dev->cdev.kobj, &input_dev_caps_attr_group); |
807 | sysfs_remove_group(&dev->cdev.kobj, &input_dev_id_attr_group); | 816 | sysfs_remove_group(&dev->cdev.kobj, &input_dev_id_attr_group); |
808 | sysfs_remove_group(&dev->cdev.kobj, &input_dev_group); | 817 | sysfs_remove_group(&dev->cdev.kobj, &input_dev_attr_group); |
809 | class_device_unregister(&dev->cdev); | 818 | class_device_unregister(&dev->cdev); |
810 | 819 | ||
811 | input_wakeup_procfs_readers(); | 820 | input_wakeup_procfs_readers(); |
diff --git a/drivers/input/keyboard/atkbd.c b/drivers/input/keyboard/atkbd.c index 820c7fd9a604..a0256f8de8ef 100644 --- a/drivers/input/keyboard/atkbd.c +++ b/drivers/input/keyboard/atkbd.c | |||
@@ -166,6 +166,9 @@ static unsigned char atkbd_unxlate_table[128] = { | |||
166 | 166 | ||
167 | #define ATKBD_SPECIAL 248 | 167 | #define ATKBD_SPECIAL 248 |
168 | 168 | ||
169 | #define ATKBD_LED_EVENT_BIT 0 | ||
170 | #define ATKBD_REP_EVENT_BIT 1 | ||
171 | |||
169 | static struct { | 172 | static struct { |
170 | unsigned char keycode; | 173 | unsigned char keycode; |
171 | unsigned char set2; | 174 | unsigned char set2; |
@@ -211,6 +214,10 @@ struct atkbd { | |||
211 | unsigned char err_xl; | 214 | unsigned char err_xl; |
212 | unsigned int last; | 215 | unsigned int last; |
213 | unsigned long time; | 216 | unsigned long time; |
217 | |||
218 | struct work_struct event_work; | ||
219 | struct semaphore event_sem; | ||
220 | unsigned long event_mask; | ||
214 | }; | 221 | }; |
215 | 222 | ||
216 | static ssize_t atkbd_attr_show_helper(struct device *dev, char *buf, | 223 | static ssize_t atkbd_attr_show_helper(struct device *dev, char *buf, |
@@ -424,58 +431,86 @@ out: | |||
424 | } | 431 | } |
425 | 432 | ||
426 | /* | 433 | /* |
427 | * Event callback from the input module. Events that change the state of | 434 | * atkbd_event_work() is used to complete processing of events that |
428 | * the hardware are processed here. | 435 | * can not be processed by input_event() which is often called from |
436 | * interrupt context. | ||
429 | */ | 437 | */ |
430 | 438 | ||
431 | static int atkbd_event(struct input_dev *dev, unsigned int type, unsigned int code, int value) | 439 | static void atkbd_event_work(void *data) |
432 | { | 440 | { |
433 | struct atkbd *atkbd = dev->private; | ||
434 | const short period[32] = | 441 | const short period[32] = |
435 | { 33, 37, 42, 46, 50, 54, 58, 63, 67, 75, 83, 92, 100, 109, 116, 125, | 442 | { 33, 37, 42, 46, 50, 54, 58, 63, 67, 75, 83, 92, 100, 109, 116, 125, |
436 | 133, 149, 167, 182, 200, 217, 232, 250, 270, 303, 333, 370, 400, 435, 470, 500 }; | 443 | 133, 149, 167, 182, 200, 217, 232, 250, 270, 303, 333, 370, 400, 435, 470, 500 }; |
437 | const short delay[4] = | 444 | const short delay[4] = |
438 | { 250, 500, 750, 1000 }; | 445 | { 250, 500, 750, 1000 }; |
446 | |||
447 | struct atkbd *atkbd = data; | ||
448 | struct input_dev *dev = atkbd->dev; | ||
439 | unsigned char param[2]; | 449 | unsigned char param[2]; |
440 | int i, j; | 450 | int i, j; |
441 | 451 | ||
452 | down(&atkbd->event_sem); | ||
453 | |||
454 | if (test_and_clear_bit(ATKBD_LED_EVENT_BIT, &atkbd->event_mask)) { | ||
455 | param[0] = (test_bit(LED_SCROLLL, dev->led) ? 1 : 0) | ||
456 | | (test_bit(LED_NUML, dev->led) ? 2 : 0) | ||
457 | | (test_bit(LED_CAPSL, dev->led) ? 4 : 0); | ||
458 | ps2_command(&atkbd->ps2dev, param, ATKBD_CMD_SETLEDS); | ||
459 | |||
460 | if (atkbd->extra) { | ||
461 | param[0] = 0; | ||
462 | param[1] = (test_bit(LED_COMPOSE, dev->led) ? 0x01 : 0) | ||
463 | | (test_bit(LED_SLEEP, dev->led) ? 0x02 : 0) | ||
464 | | (test_bit(LED_SUSPEND, dev->led) ? 0x04 : 0) | ||
465 | | (test_bit(LED_MISC, dev->led) ? 0x10 : 0) | ||
466 | | (test_bit(LED_MUTE, dev->led) ? 0x20 : 0); | ||
467 | ps2_command(&atkbd->ps2dev, param, ATKBD_CMD_EX_SETLEDS); | ||
468 | } | ||
469 | } | ||
470 | |||
471 | if (test_and_clear_bit(ATKBD_REP_EVENT_BIT, &atkbd->event_mask)) { | ||
472 | i = j = 0; | ||
473 | while (i < 31 && period[i] < dev->rep[REP_PERIOD]) | ||
474 | i++; | ||
475 | while (j < 3 && delay[j] < dev->rep[REP_DELAY]) | ||
476 | j++; | ||
477 | dev->rep[REP_PERIOD] = period[i]; | ||
478 | dev->rep[REP_DELAY] = delay[j]; | ||
479 | param[0] = i | (j << 5); | ||
480 | ps2_command(&atkbd->ps2dev, param, ATKBD_CMD_SETREP); | ||
481 | } | ||
482 | |||
483 | up(&atkbd->event_sem); | ||
484 | } | ||
485 | |||
486 | /* | ||
487 | * Event callback from the input module. Events that change the state of | ||
488 | * the hardware are processed here. If action can not be performed in | ||
489 | * interrupt context it is offloaded to atkbd_event_work. | ||
490 | */ | ||
491 | |||
492 | static int atkbd_event(struct input_dev *dev, unsigned int type, unsigned int code, int value) | ||
493 | { | ||
494 | struct atkbd *atkbd = dev->private; | ||
495 | |||
442 | if (!atkbd->write) | 496 | if (!atkbd->write) |
443 | return -1; | 497 | return -1; |
444 | 498 | ||
445 | switch (type) { | 499 | switch (type) { |
446 | 500 | ||
447 | case EV_LED: | 501 | case EV_LED: |
448 | 502 | set_bit(ATKBD_LED_EVENT_BIT, &atkbd->event_mask); | |
449 | param[0] = (test_bit(LED_SCROLLL, dev->led) ? 1 : 0) | 503 | wmb(); |
450 | | (test_bit(LED_NUML, dev->led) ? 2 : 0) | 504 | schedule_work(&atkbd->event_work); |
451 | | (test_bit(LED_CAPSL, dev->led) ? 4 : 0); | ||
452 | ps2_schedule_command(&atkbd->ps2dev, param, ATKBD_CMD_SETLEDS); | ||
453 | |||
454 | if (atkbd->extra) { | ||
455 | param[0] = 0; | ||
456 | param[1] = (test_bit(LED_COMPOSE, dev->led) ? 0x01 : 0) | ||
457 | | (test_bit(LED_SLEEP, dev->led) ? 0x02 : 0) | ||
458 | | (test_bit(LED_SUSPEND, dev->led) ? 0x04 : 0) | ||
459 | | (test_bit(LED_MISC, dev->led) ? 0x10 : 0) | ||
460 | | (test_bit(LED_MUTE, dev->led) ? 0x20 : 0); | ||
461 | ps2_schedule_command(&atkbd->ps2dev, param, ATKBD_CMD_EX_SETLEDS); | ||
462 | } | ||
463 | |||
464 | return 0; | 505 | return 0; |
465 | 506 | ||
466 | case EV_REP: | 507 | case EV_REP: |
467 | 508 | ||
468 | if (atkbd->softrepeat) return 0; | 509 | if (!atkbd->softrepeat) { |
469 | 510 | set_bit(ATKBD_REP_EVENT_BIT, &atkbd->event_mask); | |
470 | i = j = 0; | 511 | wmb(); |
471 | while (i < 31 && period[i] < dev->rep[REP_PERIOD]) | 512 | schedule_work(&atkbd->event_work); |
472 | i++; | 513 | } |
473 | while (j < 3 && delay[j] < dev->rep[REP_DELAY]) | ||
474 | j++; | ||
475 | dev->rep[REP_PERIOD] = period[i]; | ||
476 | dev->rep[REP_DELAY] = delay[j]; | ||
477 | param[0] = i | (j << 5); | ||
478 | ps2_schedule_command(&atkbd->ps2dev, param, ATKBD_CMD_SETREP); | ||
479 | 514 | ||
480 | return 0; | 515 | return 0; |
481 | } | 516 | } |
@@ -810,6 +845,8 @@ static int atkbd_connect(struct serio *serio, struct serio_driver *drv) | |||
810 | 845 | ||
811 | atkbd->dev = dev; | 846 | atkbd->dev = dev; |
812 | ps2_init(&atkbd->ps2dev, serio); | 847 | ps2_init(&atkbd->ps2dev, serio); |
848 | INIT_WORK(&atkbd->event_work, atkbd_event_work, atkbd); | ||
849 | init_MUTEX(&atkbd->event_sem); | ||
813 | 850 | ||
814 | switch (serio->id.type) { | 851 | switch (serio->id.type) { |
815 | 852 | ||
diff --git a/drivers/input/misc/Kconfig b/drivers/input/misc/Kconfig index b3eaac1b35b6..07813fc0523f 100644 --- a/drivers/input/misc/Kconfig +++ b/drivers/input/misc/Kconfig | |||
@@ -40,6 +40,16 @@ config INPUT_M68K_BEEP | |||
40 | tristate "M68k Beeper support" | 40 | tristate "M68k Beeper support" |
41 | depends on M68K | 41 | depends on M68K |
42 | 42 | ||
43 | config INPUT_WISTRON_BTNS | ||
44 | tristate "x86 Wistron laptop button interface" | ||
45 | depends on X86 && !X86_64 | ||
46 | help | ||
47 | Say Y here for support of Winstron laptop button interface, used on | ||
48 | laptops of various brands, including Acer and Fujitsu-Siemens. | ||
49 | |||
50 | To compile this driver as a module, choose M here: the module will | ||
51 | be called wistron_btns. | ||
52 | |||
43 | config INPUT_UINPUT | 53 | config INPUT_UINPUT |
44 | tristate "User level driver support" | 54 | tristate "User level driver support" |
45 | help | 55 | help |
diff --git a/drivers/input/misc/Makefile b/drivers/input/misc/Makefile index f8d01c69f349..ce44cce01285 100644 --- a/drivers/input/misc/Makefile +++ b/drivers/input/misc/Makefile | |||
@@ -9,4 +9,5 @@ obj-$(CONFIG_INPUT_PCSPKR) += pcspkr.o | |||
9 | obj-$(CONFIG_INPUT_M68K_BEEP) += m68kspkr.o | 9 | obj-$(CONFIG_INPUT_M68K_BEEP) += m68kspkr.o |
10 | obj-$(CONFIG_INPUT_98SPKR) += 98spkr.o | 10 | obj-$(CONFIG_INPUT_98SPKR) += 98spkr.o |
11 | obj-$(CONFIG_INPUT_UINPUT) += uinput.o | 11 | obj-$(CONFIG_INPUT_UINPUT) += uinput.o |
12 | obj-$(CONFIG_INPUT_WISTRON_BTNS) += wistron_btns.o | ||
12 | obj-$(CONFIG_HP_SDC_RTC) += hp_sdc_rtc.o | 13 | obj-$(CONFIG_HP_SDC_RTC) += hp_sdc_rtc.o |
diff --git a/drivers/input/misc/uinput.c b/drivers/input/misc/uinput.c index 948c1cc01bc9..546ed9b4901d 100644 --- a/drivers/input/misc/uinput.c +++ b/drivers/input/misc/uinput.c | |||
@@ -92,24 +92,19 @@ static void uinput_request_done(struct uinput_device *udev, struct uinput_reques | |||
92 | { | 92 | { |
93 | /* Mark slot as available */ | 93 | /* Mark slot as available */ |
94 | udev->requests[request->id] = NULL; | 94 | udev->requests[request->id] = NULL; |
95 | wake_up_interruptible(&udev->requests_waitq); | 95 | wake_up(&udev->requests_waitq); |
96 | 96 | ||
97 | complete(&request->done); | 97 | complete(&request->done); |
98 | } | 98 | } |
99 | 99 | ||
100 | static int uinput_request_submit(struct input_dev *dev, struct uinput_request *request) | 100 | static int uinput_request_submit(struct input_dev *dev, struct uinput_request *request) |
101 | { | 101 | { |
102 | int retval; | ||
103 | |||
104 | /* Tell our userspace app about this new request by queueing an input event */ | 102 | /* Tell our userspace app about this new request by queueing an input event */ |
105 | uinput_dev_event(dev, EV_UINPUT, request->code, request->id); | 103 | uinput_dev_event(dev, EV_UINPUT, request->code, request->id); |
106 | 104 | ||
107 | /* Wait for the request to complete */ | 105 | /* Wait for the request to complete */ |
108 | retval = wait_for_completion_interruptible(&request->done); | 106 | wait_for_completion(&request->done); |
109 | if (!retval) | 107 | return request->retval; |
110 | retval = request->retval; | ||
111 | |||
112 | return retval; | ||
113 | } | 108 | } |
114 | 109 | ||
115 | static int uinput_dev_upload_effect(struct input_dev *dev, struct ff_effect *effect) | 110 | static int uinput_dev_upload_effect(struct input_dev *dev, struct ff_effect *effect) |
@@ -152,67 +147,62 @@ static int uinput_dev_erase_effect(struct input_dev *dev, int effect_id) | |||
152 | return retval; | 147 | return retval; |
153 | } | 148 | } |
154 | 149 | ||
155 | static int uinput_create_device(struct uinput_device *udev) | 150 | static void uinput_destroy_device(struct uinput_device *udev) |
156 | { | 151 | { |
157 | if (!udev->dev->name) { | 152 | const char *name, *phys; |
158 | printk(KERN_DEBUG "%s: write device info first\n", UINPUT_NAME); | 153 | |
159 | return -EINVAL; | 154 | if (udev->dev) { |
155 | name = udev->dev->name; | ||
156 | phys = udev->dev->phys; | ||
157 | if (udev->state == UIST_CREATED) | ||
158 | input_unregister_device(udev->dev); | ||
159 | else | ||
160 | input_free_device(udev->dev); | ||
161 | kfree(name); | ||
162 | kfree(phys); | ||
163 | udev->dev = NULL; | ||
160 | } | 164 | } |
161 | 165 | ||
162 | udev->dev->event = uinput_dev_event; | 166 | udev->state = UIST_NEW_DEVICE; |
163 | udev->dev->upload_effect = uinput_dev_upload_effect; | ||
164 | udev->dev->erase_effect = uinput_dev_erase_effect; | ||
165 | udev->dev->private = udev; | ||
166 | |||
167 | init_waitqueue_head(&udev->waitq); | ||
168 | |||
169 | input_register_device(udev->dev); | ||
170 | |||
171 | set_bit(UIST_CREATED, &udev->state); | ||
172 | |||
173 | return 0; | ||
174 | } | 167 | } |
175 | 168 | ||
176 | static int uinput_destroy_device(struct uinput_device *udev) | 169 | static int uinput_create_device(struct uinput_device *udev) |
177 | { | 170 | { |
178 | if (!test_bit(UIST_CREATED, &udev->state)) { | 171 | int error; |
179 | printk(KERN_WARNING "%s: create the device first\n", UINPUT_NAME); | 172 | |
173 | if (udev->state != UIST_SETUP_COMPLETE) { | ||
174 | printk(KERN_DEBUG "%s: write device info first\n", UINPUT_NAME); | ||
180 | return -EINVAL; | 175 | return -EINVAL; |
181 | } | 176 | } |
182 | 177 | ||
183 | input_unregister_device(udev->dev); | 178 | error = input_register_device(udev->dev); |
179 | if (error) { | ||
180 | uinput_destroy_device(udev); | ||
181 | return error; | ||
182 | } | ||
184 | 183 | ||
185 | clear_bit(UIST_CREATED, &udev->state); | 184 | udev->state = UIST_CREATED; |
186 | 185 | ||
187 | return 0; | 186 | return 0; |
188 | } | 187 | } |
189 | 188 | ||
190 | static int uinput_open(struct inode *inode, struct file *file) | 189 | static int uinput_open(struct inode *inode, struct file *file) |
191 | { | 190 | { |
192 | struct uinput_device *newdev; | 191 | struct uinput_device *newdev; |
193 | struct input_dev *newinput; | ||
194 | 192 | ||
195 | newdev = kmalloc(sizeof(struct uinput_device), GFP_KERNEL); | 193 | newdev = kzalloc(sizeof(struct uinput_device), GFP_KERNEL); |
196 | if (!newdev) | 194 | if (!newdev) |
197 | goto error; | 195 | return -ENOMEM; |
198 | memset(newdev, 0, sizeof(struct uinput_device)); | 196 | |
197 | init_MUTEX(&newdev->sem); | ||
199 | spin_lock_init(&newdev->requests_lock); | 198 | spin_lock_init(&newdev->requests_lock); |
200 | init_waitqueue_head(&newdev->requests_waitq); | 199 | init_waitqueue_head(&newdev->requests_waitq); |
201 | 200 | init_waitqueue_head(&newdev->waitq); | |
202 | newinput = kmalloc(sizeof(struct input_dev), GFP_KERNEL); | 201 | newdev->state = UIST_NEW_DEVICE; |
203 | if (!newinput) | ||
204 | goto cleanup; | ||
205 | memset(newinput, 0, sizeof(struct input_dev)); | ||
206 | |||
207 | newdev->dev = newinput; | ||
208 | 202 | ||
209 | file->private_data = newdev; | 203 | file->private_data = newdev; |
210 | 204 | ||
211 | return 0; | 205 | return 0; |
212 | cleanup: | ||
213 | kfree(newdev); | ||
214 | error: | ||
215 | return -ENOMEM; | ||
216 | } | 206 | } |
217 | 207 | ||
218 | static int uinput_validate_absbits(struct input_dev *dev) | 208 | static int uinput_validate_absbits(struct input_dev *dev) |
@@ -246,34 +236,55 @@ static int uinput_validate_absbits(struct input_dev *dev) | |||
246 | return retval; | 236 | return retval; |
247 | } | 237 | } |
248 | 238 | ||
249 | static int uinput_alloc_device(struct file *file, const char __user *buffer, size_t count) | 239 | static int uinput_allocate_device(struct uinput_device *udev) |
240 | { | ||
241 | udev->dev = input_allocate_device(); | ||
242 | if (!udev->dev) | ||
243 | return -ENOMEM; | ||
244 | |||
245 | udev->dev->event = uinput_dev_event; | ||
246 | udev->dev->upload_effect = uinput_dev_upload_effect; | ||
247 | udev->dev->erase_effect = uinput_dev_erase_effect; | ||
248 | udev->dev->private = udev; | ||
249 | |||
250 | return 0; | ||
251 | } | ||
252 | |||
253 | static int uinput_setup_device(struct uinput_device *udev, const char __user *buffer, size_t count) | ||
250 | { | 254 | { |
251 | struct uinput_user_dev *user_dev; | 255 | struct uinput_user_dev *user_dev; |
252 | struct input_dev *dev; | 256 | struct input_dev *dev; |
253 | struct uinput_device *udev; | ||
254 | char *name; | 257 | char *name; |
255 | int size; | 258 | int size; |
256 | int retval; | 259 | int retval; |
257 | 260 | ||
258 | retval = count; | 261 | if (count != sizeof(struct uinput_user_dev)) |
262 | return -EINVAL; | ||
263 | |||
264 | if (!udev->dev) { | ||
265 | retval = uinput_allocate_device(udev); | ||
266 | if (retval) | ||
267 | return retval; | ||
268 | } | ||
259 | 269 | ||
260 | udev = file->private_data; | ||
261 | dev = udev->dev; | 270 | dev = udev->dev; |
262 | 271 | ||
263 | user_dev = kmalloc(sizeof(struct uinput_user_dev), GFP_KERNEL); | 272 | user_dev = kmalloc(sizeof(struct uinput_user_dev), GFP_KERNEL); |
264 | if (!user_dev) { | 273 | if (!user_dev) |
265 | retval = -ENOMEM; | 274 | return -ENOMEM; |
266 | goto exit; | ||
267 | } | ||
268 | 275 | ||
269 | if (copy_from_user(user_dev, buffer, sizeof(struct uinput_user_dev))) { | 276 | if (copy_from_user(user_dev, buffer, sizeof(struct uinput_user_dev))) { |
270 | retval = -EFAULT; | 277 | retval = -EFAULT; |
271 | goto exit; | 278 | goto exit; |
272 | } | 279 | } |
273 | 280 | ||
274 | kfree(dev->name); | ||
275 | |||
276 | size = strnlen(user_dev->name, UINPUT_MAX_NAME_SIZE) + 1; | 281 | size = strnlen(user_dev->name, UINPUT_MAX_NAME_SIZE) + 1; |
282 | if (!size) { | ||
283 | retval = -EINVAL; | ||
284 | goto exit; | ||
285 | } | ||
286 | |||
287 | kfree(dev->name); | ||
277 | dev->name = name = kmalloc(size, GFP_KERNEL); | 288 | dev->name = name = kmalloc(size, GFP_KERNEL); |
278 | if (!name) { | 289 | if (!name) { |
279 | retval = -ENOMEM; | 290 | retval = -ENOMEM; |
@@ -296,32 +307,50 @@ static int uinput_alloc_device(struct file *file, const char __user *buffer, siz | |||
296 | /* check if absmin/absmax/absfuzz/absflat are filled as | 307 | /* check if absmin/absmax/absfuzz/absflat are filled as |
297 | * told in Documentation/input/input-programming.txt */ | 308 | * told in Documentation/input/input-programming.txt */ |
298 | if (test_bit(EV_ABS, dev->evbit)) { | 309 | if (test_bit(EV_ABS, dev->evbit)) { |
299 | int err = uinput_validate_absbits(dev); | 310 | retval = uinput_validate_absbits(dev); |
300 | if (err < 0) { | 311 | if (retval < 0) |
301 | retval = err; | 312 | goto exit; |
302 | kfree(dev->name); | ||
303 | } | ||
304 | } | 313 | } |
305 | 314 | ||
306 | exit: | 315 | udev->state = UIST_SETUP_COMPLETE; |
316 | retval = count; | ||
317 | |||
318 | exit: | ||
307 | kfree(user_dev); | 319 | kfree(user_dev); |
308 | return retval; | 320 | return retval; |
309 | } | 321 | } |
310 | 322 | ||
323 | static inline ssize_t uinput_inject_event(struct uinput_device *udev, const char __user *buffer, size_t count) | ||
324 | { | ||
325 | struct input_event ev; | ||
326 | |||
327 | if (count != sizeof(struct input_event)) | ||
328 | return -EINVAL; | ||
329 | |||
330 | if (copy_from_user(&ev, buffer, sizeof(struct input_event))) | ||
331 | return -EFAULT; | ||
332 | |||
333 | input_event(udev->dev, ev.type, ev.code, ev.value); | ||
334 | |||
335 | return sizeof(struct input_event); | ||
336 | } | ||
337 | |||
311 | static ssize_t uinput_write(struct file *file, const char __user *buffer, size_t count, loff_t *ppos) | 338 | static ssize_t uinput_write(struct file *file, const char __user *buffer, size_t count, loff_t *ppos) |
312 | { | 339 | { |
313 | struct uinput_device *udev = file->private_data; | 340 | struct uinput_device *udev = file->private_data; |
341 | int retval; | ||
342 | |||
343 | retval = down_interruptible(&udev->sem); | ||
344 | if (retval) | ||
345 | return retval; | ||
314 | 346 | ||
315 | if (test_bit(UIST_CREATED, &udev->state)) { | 347 | retval = udev->state == UIST_CREATED ? |
316 | struct input_event ev; | 348 | uinput_inject_event(udev, buffer, count) : |
349 | uinput_setup_device(udev, buffer, count); | ||
317 | 350 | ||
318 | if (copy_from_user(&ev, buffer, sizeof(struct input_event))) | 351 | up(&udev->sem); |
319 | return -EFAULT; | ||
320 | input_event(udev->dev, ev.type, ev.code, ev.value); | ||
321 | } else | ||
322 | count = uinput_alloc_device(file, buffer, count); | ||
323 | 352 | ||
324 | return count; | 353 | return retval; |
325 | } | 354 | } |
326 | 355 | ||
327 | static ssize_t uinput_read(struct file *file, char __user *buffer, size_t count, loff_t *ppos) | 356 | static ssize_t uinput_read(struct file *file, char __user *buffer, size_t count, loff_t *ppos) |
@@ -329,28 +358,38 @@ static ssize_t uinput_read(struct file *file, char __user *buffer, size_t count, | |||
329 | struct uinput_device *udev = file->private_data; | 358 | struct uinput_device *udev = file->private_data; |
330 | int retval = 0; | 359 | int retval = 0; |
331 | 360 | ||
332 | if (!test_bit(UIST_CREATED, &udev->state)) | 361 | if (udev->state != UIST_CREATED) |
333 | return -ENODEV; | 362 | return -ENODEV; |
334 | 363 | ||
335 | if (udev->head == udev->tail && (file->f_flags & O_NONBLOCK)) | 364 | if (udev->head == udev->tail && (file->f_flags & O_NONBLOCK)) |
336 | return -EAGAIN; | 365 | return -EAGAIN; |
337 | 366 | ||
338 | retval = wait_event_interruptible(udev->waitq, | 367 | retval = wait_event_interruptible(udev->waitq, |
339 | udev->head != udev->tail || !test_bit(UIST_CREATED, &udev->state)); | 368 | udev->head != udev->tail || udev->state != UIST_CREATED); |
340 | if (retval) | 369 | if (retval) |
341 | return retval; | 370 | return retval; |
342 | 371 | ||
343 | if (!test_bit(UIST_CREATED, &udev->state)) | 372 | retval = down_interruptible(&udev->sem); |
344 | return -ENODEV; | 373 | if (retval) |
374 | return retval; | ||
345 | 375 | ||
346 | while ((udev->head != udev->tail) && | 376 | if (udev->state != UIST_CREATED) { |
347 | (retval + sizeof(struct input_event) <= count)) { | 377 | retval = -ENODEV; |
348 | if (copy_to_user(buffer + retval, &udev->buff[udev->tail], sizeof(struct input_event))) | 378 | goto out; |
349 | return -EFAULT; | 379 | } |
380 | |||
381 | while (udev->head != udev->tail && retval + sizeof(struct input_event) <= count) { | ||
382 | if (copy_to_user(buffer + retval, &udev->buff[udev->tail], sizeof(struct input_event))) { | ||
383 | retval = -EFAULT; | ||
384 | goto out; | ||
385 | } | ||
350 | udev->tail = (udev->tail + 1) % UINPUT_BUFFER_SIZE; | 386 | udev->tail = (udev->tail + 1) % UINPUT_BUFFER_SIZE; |
351 | retval += sizeof(struct input_event); | 387 | retval += sizeof(struct input_event); |
352 | } | 388 | } |
353 | 389 | ||
390 | out: | ||
391 | up(&udev->sem); | ||
392 | |||
354 | return retval; | 393 | return retval; |
355 | } | 394 | } |
356 | 395 | ||
@@ -366,28 +405,30 @@ static unsigned int uinput_poll(struct file *file, poll_table *wait) | |||
366 | return 0; | 405 | return 0; |
367 | } | 406 | } |
368 | 407 | ||
369 | static int uinput_burn_device(struct uinput_device *udev) | 408 | static int uinput_release(struct inode *inode, struct file *file) |
370 | { | 409 | { |
371 | if (test_bit(UIST_CREATED, &udev->state)) | 410 | struct uinput_device *udev = file->private_data; |
372 | uinput_destroy_device(udev); | ||
373 | 411 | ||
374 | kfree(udev->dev->name); | 412 | uinput_destroy_device(udev); |
375 | kfree(udev->dev->phys); | ||
376 | kfree(udev->dev); | ||
377 | kfree(udev); | 413 | kfree(udev); |
378 | 414 | ||
379 | return 0; | 415 | return 0; |
380 | } | 416 | } |
381 | 417 | ||
382 | static int uinput_close(struct inode *inode, struct file *file) | 418 | #define uinput_set_bit(_arg, _bit, _max) \ |
419 | ({ \ | ||
420 | int __ret = 0; \ | ||
421 | if (udev->state == UIST_CREATED) \ | ||
422 | __ret = -EINVAL; \ | ||
423 | else if ((_arg) > (_max)) \ | ||
424 | __ret = -EINVAL; \ | ||
425 | else set_bit((_arg), udev->dev->_bit); \ | ||
426 | __ret; \ | ||
427 | }) | ||
428 | |||
429 | static long uinput_ioctl(struct file *file, unsigned int cmd, unsigned long arg) | ||
383 | { | 430 | { |
384 | uinput_burn_device(file->private_data); | 431 | int retval; |
385 | return 0; | ||
386 | } | ||
387 | |||
388 | static int uinput_ioctl(struct inode *inode, struct file *file, unsigned int cmd, unsigned long arg) | ||
389 | { | ||
390 | int retval = 0; | ||
391 | struct uinput_device *udev; | 432 | struct uinput_device *udev; |
392 | void __user *p = (void __user *)arg; | 433 | void __user *p = (void __user *)arg; |
393 | struct uinput_ff_upload ff_up; | 434 | struct uinput_ff_upload ff_up; |
@@ -398,19 +439,14 @@ static int uinput_ioctl(struct inode *inode, struct file *file, unsigned int cmd | |||
398 | 439 | ||
399 | udev = file->private_data; | 440 | udev = file->private_data; |
400 | 441 | ||
401 | /* device attributes can not be changed after the device is created */ | 442 | retval = down_interruptible(&udev->sem); |
402 | switch (cmd) { | 443 | if (retval) |
403 | case UI_SET_EVBIT: | 444 | return retval; |
404 | case UI_SET_KEYBIT: | 445 | |
405 | case UI_SET_RELBIT: | 446 | if (!udev->dev) { |
406 | case UI_SET_ABSBIT: | 447 | retval = uinput_allocate_device(udev); |
407 | case UI_SET_MSCBIT: | 448 | if (retval) |
408 | case UI_SET_LEDBIT: | 449 | goto out; |
409 | case UI_SET_SNDBIT: | ||
410 | case UI_SET_FFBIT: | ||
411 | case UI_SET_PHYS: | ||
412 | if (test_bit(UIST_CREATED, &udev->state)) | ||
413 | return -EINVAL; | ||
414 | } | 450 | } |
415 | 451 | ||
416 | switch (cmd) { | 452 | switch (cmd) { |
@@ -419,74 +455,50 @@ static int uinput_ioctl(struct inode *inode, struct file *file, unsigned int cmd | |||
419 | break; | 455 | break; |
420 | 456 | ||
421 | case UI_DEV_DESTROY: | 457 | case UI_DEV_DESTROY: |
422 | retval = uinput_destroy_device(udev); | 458 | uinput_destroy_device(udev); |
423 | break; | 459 | break; |
424 | 460 | ||
425 | case UI_SET_EVBIT: | 461 | case UI_SET_EVBIT: |
426 | if (arg > EV_MAX) { | 462 | retval = uinput_set_bit(arg, evbit, EV_MAX); |
427 | retval = -EINVAL; | ||
428 | break; | ||
429 | } | ||
430 | set_bit(arg, udev->dev->evbit); | ||
431 | break; | 463 | break; |
432 | 464 | ||
433 | case UI_SET_KEYBIT: | 465 | case UI_SET_KEYBIT: |
434 | if (arg > KEY_MAX) { | 466 | retval = uinput_set_bit(arg, keybit, KEY_MAX); |
435 | retval = -EINVAL; | ||
436 | break; | ||
437 | } | ||
438 | set_bit(arg, udev->dev->keybit); | ||
439 | break; | 467 | break; |
440 | 468 | ||
441 | case UI_SET_RELBIT: | 469 | case UI_SET_RELBIT: |
442 | if (arg > REL_MAX) { | 470 | retval = uinput_set_bit(arg, relbit, REL_MAX); |
443 | retval = -EINVAL; | ||
444 | break; | ||
445 | } | ||
446 | set_bit(arg, udev->dev->relbit); | ||
447 | break; | 471 | break; |
448 | 472 | ||
449 | case UI_SET_ABSBIT: | 473 | case UI_SET_ABSBIT: |
450 | if (arg > ABS_MAX) { | 474 | retval = uinput_set_bit(arg, absbit, ABS_MAX); |
451 | retval = -EINVAL; | ||
452 | break; | ||
453 | } | ||
454 | set_bit(arg, udev->dev->absbit); | ||
455 | break; | 475 | break; |
456 | 476 | ||
457 | case UI_SET_MSCBIT: | 477 | case UI_SET_MSCBIT: |
458 | if (arg > MSC_MAX) { | 478 | retval = uinput_set_bit(arg, mscbit, MSC_MAX); |
459 | retval = -EINVAL; | ||
460 | break; | ||
461 | } | ||
462 | set_bit(arg, udev->dev->mscbit); | ||
463 | break; | 479 | break; |
464 | 480 | ||
465 | case UI_SET_LEDBIT: | 481 | case UI_SET_LEDBIT: |
466 | if (arg > LED_MAX) { | 482 | retval = uinput_set_bit(arg, ledbit, LED_MAX); |
467 | retval = -EINVAL; | ||
468 | break; | ||
469 | } | ||
470 | set_bit(arg, udev->dev->ledbit); | ||
471 | break; | 483 | break; |
472 | 484 | ||
473 | case UI_SET_SNDBIT: | 485 | case UI_SET_SNDBIT: |
474 | if (arg > SND_MAX) { | 486 | retval = uinput_set_bit(arg, sndbit, SND_MAX); |
475 | retval = -EINVAL; | ||
476 | break; | ||
477 | } | ||
478 | set_bit(arg, udev->dev->sndbit); | ||
479 | break; | 487 | break; |
480 | 488 | ||
481 | case UI_SET_FFBIT: | 489 | case UI_SET_FFBIT: |
482 | if (arg > FF_MAX) { | 490 | retval = uinput_set_bit(arg, ffbit, FF_MAX); |
483 | retval = -EINVAL; | 491 | break; |
484 | break; | 492 | |
485 | } | 493 | case UI_SET_SWBIT: |
486 | set_bit(arg, udev->dev->ffbit); | 494 | retval = uinput_set_bit(arg, swbit, SW_MAX); |
487 | break; | 495 | break; |
488 | 496 | ||
489 | case UI_SET_PHYS: | 497 | case UI_SET_PHYS: |
498 | if (udev->state == UIST_CREATED) { | ||
499 | retval = -EINVAL; | ||
500 | goto out; | ||
501 | } | ||
490 | length = strnlen_user(p, 1024); | 502 | length = strnlen_user(p, 1024); |
491 | if (length <= 0) { | 503 | if (length <= 0) { |
492 | retval = -EFAULT; | 504 | retval = -EFAULT; |
@@ -575,23 +587,26 @@ static int uinput_ioctl(struct inode *inode, struct file *file, unsigned int cmd | |||
575 | default: | 587 | default: |
576 | retval = -EINVAL; | 588 | retval = -EINVAL; |
577 | } | 589 | } |
590 | |||
591 | out: | ||
592 | up(&udev->sem); | ||
578 | return retval; | 593 | return retval; |
579 | } | 594 | } |
580 | 595 | ||
581 | static struct file_operations uinput_fops = { | 596 | static struct file_operations uinput_fops = { |
582 | .owner = THIS_MODULE, | 597 | .owner = THIS_MODULE, |
583 | .open = uinput_open, | 598 | .open = uinput_open, |
584 | .release = uinput_close, | 599 | .release = uinput_release, |
585 | .read = uinput_read, | 600 | .read = uinput_read, |
586 | .write = uinput_write, | 601 | .write = uinput_write, |
587 | .poll = uinput_poll, | 602 | .poll = uinput_poll, |
588 | .ioctl = uinput_ioctl, | 603 | .unlocked_ioctl = uinput_ioctl, |
589 | }; | 604 | }; |
590 | 605 | ||
591 | static struct miscdevice uinput_misc = { | 606 | static struct miscdevice uinput_misc = { |
592 | .fops = &uinput_fops, | 607 | .fops = &uinput_fops, |
593 | .minor = UINPUT_MINOR, | 608 | .minor = UINPUT_MINOR, |
594 | .name = UINPUT_NAME, | 609 | .name = UINPUT_NAME, |
595 | }; | 610 | }; |
596 | 611 | ||
597 | static int __init uinput_init(void) | 612 | static int __init uinput_init(void) |
diff --git a/drivers/input/misc/wistron_btns.c b/drivers/input/misc/wistron_btns.c new file mode 100644 index 000000000000..49d0416a2a9a --- /dev/null +++ b/drivers/input/misc/wistron_btns.c | |||
@@ -0,0 +1,561 @@ | |||
1 | /* | ||
2 | * Wistron laptop button driver | ||
3 | * Copyright (C) 2005 Miloslav Trmac <mitr@volny.cz> | ||
4 | * Copyright (C) 2005 Bernhard Rosenkraenzer <bero@arklinux.org> | ||
5 | * Copyright (C) 2005 Dmitry Torokhov <dtor@mail.ru> | ||
6 | * | ||
7 | * You can redistribute and/or modify this program under the terms of the | ||
8 | * GNU General Public License version 2 as published by the Free Software | ||
9 | * Foundation. | ||
10 | * | ||
11 | * This program is distributed in the hope that it will be useful, but | ||
12 | * WITHOUT ANY WARRANTY; without even the implied warranty of | ||
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General | ||
14 | * Public License for more details. | ||
15 | * | ||
16 | * You should have received a copy of the GNU General Public License along | ||
17 | * with this program; if not, write to the Free Software Foundation, Inc., | ||
18 | * 59 Temple Place Suite 330, Boston, MA 02111-1307, USA. | ||
19 | */ | ||
20 | #include <asm/io.h> | ||
21 | #include <linux/dmi.h> | ||
22 | #include <linux/init.h> | ||
23 | #include <linux/input.h> | ||
24 | #include <linux/interrupt.h> | ||
25 | #include <linux/kernel.h> | ||
26 | #include <linux/mc146818rtc.h> | ||
27 | #include <linux/module.h> | ||
28 | #include <linux/preempt.h> | ||
29 | #include <linux/string.h> | ||
30 | #include <linux/timer.h> | ||
31 | #include <linux/types.h> | ||
32 | #include <linux/platform_device.h> | ||
33 | |||
34 | /* | ||
35 | * Number of attempts to read data from queue per poll; | ||
36 | * the queue can hold up to 31 entries | ||
37 | */ | ||
38 | #define MAX_POLL_ITERATIONS 64 | ||
39 | |||
40 | #define POLL_FREQUENCY 10 /* Number of polls per second */ | ||
41 | |||
42 | #if POLL_FREQUENCY > HZ | ||
43 | #error "POLL_FREQUENCY too high" | ||
44 | #endif | ||
45 | |||
46 | /* BIOS subsystem IDs */ | ||
47 | #define WIFI 0x35 | ||
48 | #define BLUETOOTH 0x34 | ||
49 | |||
50 | MODULE_AUTHOR("Miloslav Trmac <mitr@volny.cz>"); | ||
51 | MODULE_DESCRIPTION("Wistron laptop button driver"); | ||
52 | MODULE_LICENSE("GPL v2"); | ||
53 | MODULE_VERSION("0.1"); | ||
54 | |||
55 | static int force; /* = 0; */ | ||
56 | module_param(force, bool, 0); | ||
57 | MODULE_PARM_DESC(force, "Load even if computer is not in database"); | ||
58 | |||
59 | static char *keymap_name; /* = NULL; */ | ||
60 | module_param_named(keymap, keymap_name, charp, 0); | ||
61 | MODULE_PARM_DESC(keymap, "Keymap name, if it can't be autodetected"); | ||
62 | |||
63 | static struct platform_device *wistron_device; | ||
64 | |||
65 | /* BIOS interface implementation */ | ||
66 | |||
67 | static void __iomem *bios_entry_point; /* BIOS routine entry point */ | ||
68 | static void __iomem *bios_code_map_base; | ||
69 | static void __iomem *bios_data_map_base; | ||
70 | |||
71 | static u8 cmos_address; | ||
72 | |||
73 | struct regs { | ||
74 | u32 eax, ebx, ecx; | ||
75 | }; | ||
76 | |||
77 | static void call_bios(struct regs *regs) | ||
78 | { | ||
79 | unsigned long flags; | ||
80 | |||
81 | preempt_disable(); | ||
82 | local_irq_save(flags); | ||
83 | asm volatile ("pushl %%ebp;" | ||
84 | "movl %7, %%ebp;" | ||
85 | "call *%6;" | ||
86 | "popl %%ebp" | ||
87 | : "=a" (regs->eax), "=b" (regs->ebx), "=c" (regs->ecx) | ||
88 | : "0" (regs->eax), "1" (regs->ebx), "2" (regs->ecx), | ||
89 | "m" (bios_entry_point), "m" (bios_data_map_base) | ||
90 | : "edx", "edi", "esi", "memory"); | ||
91 | local_irq_restore(flags); | ||
92 | preempt_enable(); | ||
93 | } | ||
94 | |||
95 | static size_t __init locate_wistron_bios(void __iomem *base) | ||
96 | { | ||
97 | static const unsigned char __initdata signature[] = | ||
98 | { 0x42, 0x21, 0x55, 0x30 }; | ||
99 | size_t offset; | ||
100 | |||
101 | for (offset = 0; offset < 0x10000; offset += 0x10) { | ||
102 | if (check_signature(base + offset, signature, | ||
103 | sizeof(signature)) != 0) | ||
104 | return offset; | ||
105 | } | ||
106 | return -1; | ||
107 | } | ||
108 | |||
109 | static int __init map_bios(void) | ||
110 | { | ||
111 | void __iomem *base; | ||
112 | size_t offset; | ||
113 | u32 entry_point; | ||
114 | |||
115 | base = ioremap(0xF0000, 0x10000); /* Can't fail */ | ||
116 | offset = locate_wistron_bios(base); | ||
117 | if (offset < 0) { | ||
118 | printk(KERN_ERR "wistron_btns: BIOS entry point not found\n"); | ||
119 | iounmap(base); | ||
120 | return -ENODEV; | ||
121 | } | ||
122 | |||
123 | entry_point = readl(base + offset + 5); | ||
124 | printk(KERN_DEBUG | ||
125 | "wistron_btns: BIOS signature found at %p, entry point %08X\n", | ||
126 | base + offset, entry_point); | ||
127 | |||
128 | if (entry_point >= 0xF0000) { | ||
129 | bios_code_map_base = base; | ||
130 | bios_entry_point = bios_code_map_base + (entry_point & 0xFFFF); | ||
131 | } else { | ||
132 | iounmap(base); | ||
133 | bios_code_map_base = ioremap(entry_point & ~0x3FFF, 0x4000); | ||
134 | if (bios_code_map_base == NULL) { | ||
135 | printk(KERN_ERR | ||
136 | "wistron_btns: Can't map BIOS code at %08X\n", | ||
137 | entry_point & ~0x3FFF); | ||
138 | goto err; | ||
139 | } | ||
140 | bios_entry_point = bios_code_map_base + (entry_point & 0x3FFF); | ||
141 | } | ||
142 | /* The Windows driver maps 0x10000 bytes, we keep only one page... */ | ||
143 | bios_data_map_base = ioremap(0x400, 0xc00); | ||
144 | if (bios_data_map_base == NULL) { | ||
145 | printk(KERN_ERR "wistron_btns: Can't map BIOS data\n"); | ||
146 | goto err_code; | ||
147 | } | ||
148 | return 0; | ||
149 | |||
150 | err_code: | ||
151 | iounmap(bios_code_map_base); | ||
152 | err: | ||
153 | return -ENOMEM; | ||
154 | } | ||
155 | |||
156 | static inline void unmap_bios(void) | ||
157 | { | ||
158 | iounmap(bios_code_map_base); | ||
159 | iounmap(bios_data_map_base); | ||
160 | } | ||
161 | |||
162 | /* BIOS calls */ | ||
163 | |||
164 | static u16 bios_pop_queue(void) | ||
165 | { | ||
166 | struct regs regs; | ||
167 | |||
168 | memset(®s, 0, sizeof (regs)); | ||
169 | regs.eax = 0x9610; | ||
170 | regs.ebx = 0x061C; | ||
171 | regs.ecx = 0x0000; | ||
172 | call_bios(®s); | ||
173 | |||
174 | return regs.eax; | ||
175 | } | ||
176 | |||
177 | static void __init bios_attach(void) | ||
178 | { | ||
179 | struct regs regs; | ||
180 | |||
181 | memset(®s, 0, sizeof (regs)); | ||
182 | regs.eax = 0x9610; | ||
183 | regs.ebx = 0x012E; | ||
184 | call_bios(®s); | ||
185 | } | ||
186 | |||
187 | static void bios_detach(void) | ||
188 | { | ||
189 | struct regs regs; | ||
190 | |||
191 | memset(®s, 0, sizeof (regs)); | ||
192 | regs.eax = 0x9610; | ||
193 | regs.ebx = 0x002E; | ||
194 | call_bios(®s); | ||
195 | } | ||
196 | |||
197 | static u8 __init bios_get_cmos_address(void) | ||
198 | { | ||
199 | struct regs regs; | ||
200 | |||
201 | memset(®s, 0, sizeof (regs)); | ||
202 | regs.eax = 0x9610; | ||
203 | regs.ebx = 0x051C; | ||
204 | call_bios(®s); | ||
205 | |||
206 | return regs.ecx; | ||
207 | } | ||
208 | |||
209 | static u16 __init bios_get_default_setting(u8 subsys) | ||
210 | { | ||
211 | struct regs regs; | ||
212 | |||
213 | memset(®s, 0, sizeof (regs)); | ||
214 | regs.eax = 0x9610; | ||
215 | regs.ebx = 0x0200 | subsys; | ||
216 | call_bios(®s); | ||
217 | |||
218 | return regs.eax; | ||
219 | } | ||
220 | |||
221 | static void bios_set_state(u8 subsys, int enable) | ||
222 | { | ||
223 | struct regs regs; | ||
224 | |||
225 | memset(®s, 0, sizeof (regs)); | ||
226 | regs.eax = 0x9610; | ||
227 | regs.ebx = (enable ? 0x0100 : 0x0000) | subsys; | ||
228 | call_bios(®s); | ||
229 | } | ||
230 | |||
231 | /* Hardware database */ | ||
232 | |||
233 | struct key_entry { | ||
234 | char type; /* See KE_* below */ | ||
235 | u8 code; | ||
236 | unsigned keycode; /* For KE_KEY */ | ||
237 | }; | ||
238 | |||
239 | enum { KE_END, KE_KEY, KE_WIFI, KE_BLUETOOTH }; | ||
240 | |||
241 | static const struct key_entry *keymap; /* = NULL; Current key map */ | ||
242 | static int have_wifi; | ||
243 | static int have_bluetooth; | ||
244 | |||
245 | static int __init dmi_matched(struct dmi_system_id *dmi) | ||
246 | { | ||
247 | const struct key_entry *key; | ||
248 | |||
249 | keymap = dmi->driver_data; | ||
250 | for (key = keymap; key->type != KE_END; key++) { | ||
251 | if (key->type == KE_WIFI) { | ||
252 | have_wifi = 1; | ||
253 | break; | ||
254 | } else if (key->type == KE_BLUETOOTH) { | ||
255 | have_bluetooth = 1; | ||
256 | break; | ||
257 | } | ||
258 | } | ||
259 | return 1; | ||
260 | } | ||
261 | |||
262 | static struct key_entry keymap_empty[] = { | ||
263 | { KE_END, 0 } | ||
264 | }; | ||
265 | |||
266 | static struct key_entry keymap_fs_amilo_pro_v2000[] = { | ||
267 | { KE_KEY, 0x01, KEY_HELP }, | ||
268 | { KE_KEY, 0x11, KEY_PROG1 }, | ||
269 | { KE_KEY, 0x12, KEY_PROG2 }, | ||
270 | { KE_WIFI, 0x30, 0 }, | ||
271 | { KE_KEY, 0x31, KEY_MAIL }, | ||
272 | { KE_KEY, 0x36, KEY_WWW }, | ||
273 | { KE_END, 0 } | ||
274 | }; | ||
275 | |||
276 | static struct key_entry keymap_wistron_ms2141[] = { | ||
277 | { KE_KEY, 0x11, KEY_PROG1 }, | ||
278 | { KE_KEY, 0x12, KEY_PROG2 }, | ||
279 | { KE_WIFI, 0x30, 0 }, | ||
280 | { KE_KEY, 0x22, KEY_REWIND }, | ||
281 | { KE_KEY, 0x23, KEY_FORWARD }, | ||
282 | { KE_KEY, 0x24, KEY_PLAYPAUSE }, | ||
283 | { KE_KEY, 0x25, KEY_STOPCD }, | ||
284 | { KE_KEY, 0x31, KEY_MAIL }, | ||
285 | { KE_KEY, 0x36, KEY_WWW }, | ||
286 | { KE_END, 0 } | ||
287 | }; | ||
288 | |||
289 | static struct key_entry keymap_acer_aspire_1500[] = { | ||
290 | { KE_KEY, 0x11, KEY_PROG1 }, | ||
291 | { KE_KEY, 0x12, KEY_PROG2 }, | ||
292 | { KE_WIFI, 0x30, 0 }, | ||
293 | { KE_KEY, 0x31, KEY_MAIL }, | ||
294 | { KE_KEY, 0x36, KEY_WWW }, | ||
295 | { KE_BLUETOOTH, 0x44, 0 }, | ||
296 | { KE_END, 0 } | ||
297 | }; | ||
298 | |||
299 | /* | ||
300 | * If your machine is not here (which is currently rather likely), please send | ||
301 | * a list of buttons and their key codes (reported when loading this module | ||
302 | * with force=1) and the output of dmidecode to $MODULE_AUTHOR. | ||
303 | */ | ||
304 | static struct dmi_system_id dmi_ids[] = { | ||
305 | { | ||
306 | .callback = dmi_matched, | ||
307 | .ident = "Fujitsu-Siemens Amilo Pro V2000", | ||
308 | .matches = { | ||
309 | DMI_MATCH(DMI_SYS_VENDOR, "FUJITSU SIEMENS"), | ||
310 | DMI_MATCH(DMI_PRODUCT_NAME, "AMILO Pro V2000"), | ||
311 | }, | ||
312 | .driver_data = keymap_fs_amilo_pro_v2000 | ||
313 | }, | ||
314 | { | ||
315 | .callback = dmi_matched, | ||
316 | .ident = "Acer Aspire 1500", | ||
317 | .matches = { | ||
318 | DMI_MATCH(DMI_SYS_VENDOR, "Acer"), | ||
319 | DMI_MATCH(DMI_PRODUCT_NAME, "Aspire 1500"), | ||
320 | }, | ||
321 | .driver_data = keymap_acer_aspire_1500 | ||
322 | }, | ||
323 | { 0, } | ||
324 | }; | ||
325 | |||
326 | static int __init select_keymap(void) | ||
327 | { | ||
328 | if (keymap_name != NULL) { | ||
329 | if (strcmp (keymap_name, "1557/MS2141") == 0) | ||
330 | keymap = keymap_wistron_ms2141; | ||
331 | else { | ||
332 | printk(KERN_ERR "wistron_btns: Keymap unknown\n"); | ||
333 | return -EINVAL; | ||
334 | } | ||
335 | } | ||
336 | dmi_check_system(dmi_ids); | ||
337 | if (keymap == NULL) { | ||
338 | if (!force) { | ||
339 | printk(KERN_ERR "wistron_btns: System unknown\n"); | ||
340 | return -ENODEV; | ||
341 | } | ||
342 | keymap = keymap_empty; | ||
343 | } | ||
344 | return 0; | ||
345 | } | ||
346 | |||
347 | /* Input layer interface */ | ||
348 | |||
349 | static struct input_dev *input_dev; | ||
350 | |||
351 | static int __init setup_input_dev(void) | ||
352 | { | ||
353 | const struct key_entry *key; | ||
354 | int error; | ||
355 | |||
356 | input_dev = input_allocate_device(); | ||
357 | if (!input_dev) | ||
358 | return -ENOMEM; | ||
359 | |||
360 | input_dev->name = "Wistron laptop buttons"; | ||
361 | input_dev->phys = "wistron/input0"; | ||
362 | input_dev->id.bustype = BUS_HOST; | ||
363 | input_dev->cdev.dev = &wistron_device->dev; | ||
364 | |||
365 | for (key = keymap; key->type != KE_END; key++) { | ||
366 | if (key->type == KE_KEY) { | ||
367 | input_dev->evbit[LONG(EV_KEY)] = BIT(EV_KEY); | ||
368 | set_bit(key->keycode, input_dev->keybit); | ||
369 | } | ||
370 | } | ||
371 | |||
372 | error = input_register_device(input_dev); | ||
373 | if (error) { | ||
374 | input_free_device(input_dev); | ||
375 | return error; | ||
376 | } | ||
377 | |||
378 | return 0; | ||
379 | } | ||
380 | |||
381 | static void report_key(unsigned keycode) | ||
382 | { | ||
383 | input_report_key(input_dev, keycode, 1); | ||
384 | input_sync(input_dev); | ||
385 | input_report_key(input_dev, keycode, 0); | ||
386 | input_sync(input_dev); | ||
387 | } | ||
388 | |||
389 | /* Driver core */ | ||
390 | |||
391 | static int wifi_enabled; | ||
392 | static int bluetooth_enabled; | ||
393 | |||
394 | static void poll_bios(unsigned long); | ||
395 | |||
396 | static struct timer_list poll_timer = TIMER_INITIALIZER(poll_bios, 0, 0); | ||
397 | |||
398 | static void handle_key(u8 code) | ||
399 | { | ||
400 | const struct key_entry *key; | ||
401 | |||
402 | for (key = keymap; key->type != KE_END; key++) { | ||
403 | if (code == key->code) { | ||
404 | switch (key->type) { | ||
405 | case KE_KEY: | ||
406 | report_key(key->keycode); | ||
407 | break; | ||
408 | |||
409 | case KE_WIFI: | ||
410 | if (have_wifi) { | ||
411 | wifi_enabled = !wifi_enabled; | ||
412 | bios_set_state(WIFI, wifi_enabled); | ||
413 | } | ||
414 | break; | ||
415 | |||
416 | case KE_BLUETOOTH: | ||
417 | if (have_bluetooth) { | ||
418 | bluetooth_enabled = !bluetooth_enabled; | ||
419 | bios_set_state(BLUETOOTH, bluetooth_enabled); | ||
420 | } | ||
421 | break; | ||
422 | |||
423 | case KE_END: | ||
424 | default: | ||
425 | BUG(); | ||
426 | } | ||
427 | return; | ||
428 | } | ||
429 | } | ||
430 | printk(KERN_NOTICE "wistron_btns: Unknown key code %02X\n", code); | ||
431 | } | ||
432 | |||
433 | static void poll_bios(unsigned long discard) | ||
434 | { | ||
435 | u8 qlen; | ||
436 | u16 val; | ||
437 | |||
438 | for (;;) { | ||
439 | qlen = CMOS_READ(cmos_address); | ||
440 | if (qlen == 0) | ||
441 | break; | ||
442 | val = bios_pop_queue(); | ||
443 | if (val != 0 && !discard) | ||
444 | handle_key((u8)val); | ||
445 | } | ||
446 | |||
447 | mod_timer(&poll_timer, jiffies + HZ / POLL_FREQUENCY); | ||
448 | } | ||
449 | |||
450 | static int wistron_suspend(struct platform_device *dev, pm_message_t state) | ||
451 | { | ||
452 | del_timer_sync(&poll_timer); | ||
453 | |||
454 | if (have_wifi) | ||
455 | bios_set_state(WIFI, 0); | ||
456 | |||
457 | if (have_bluetooth) | ||
458 | bios_set_state(BLUETOOTH, 0); | ||
459 | |||
460 | return 0; | ||
461 | } | ||
462 | |||
463 | static int wistron_resume(struct platform_device *dev) | ||
464 | { | ||
465 | if (have_wifi) | ||
466 | bios_set_state(WIFI, wifi_enabled); | ||
467 | |||
468 | if (have_bluetooth) | ||
469 | bios_set_state(BLUETOOTH, bluetooth_enabled); | ||
470 | |||
471 | poll_bios(1); | ||
472 | |||
473 | return 0; | ||
474 | } | ||
475 | |||
476 | static struct platform_driver wistron_driver = { | ||
477 | .suspend = wistron_suspend, | ||
478 | .resume = wistron_resume, | ||
479 | .driver = { | ||
480 | .name = "wistron-bios", | ||
481 | }, | ||
482 | }; | ||
483 | |||
484 | static int __init wb_module_init(void) | ||
485 | { | ||
486 | int err; | ||
487 | |||
488 | err = select_keymap(); | ||
489 | if (err) | ||
490 | return err; | ||
491 | |||
492 | err = map_bios(); | ||
493 | if (err) | ||
494 | return err; | ||
495 | |||
496 | bios_attach(); | ||
497 | cmos_address = bios_get_cmos_address(); | ||
498 | |||
499 | err = platform_driver_register(&wistron_driver); | ||
500 | if (err) | ||
501 | goto err_detach_bios; | ||
502 | |||
503 | wistron_device = platform_device_register_simple("wistron-bios", -1, NULL, 0); | ||
504 | if (IS_ERR(wistron_device)) { | ||
505 | err = PTR_ERR(wistron_device); | ||
506 | goto err_unregister_driver; | ||
507 | } | ||
508 | |||
509 | if (have_wifi) { | ||
510 | u16 wifi = bios_get_default_setting(WIFI); | ||
511 | if (wifi & 1) | ||
512 | wifi_enabled = (wifi & 2) ? 1 : 0; | ||
513 | else | ||
514 | have_wifi = 0; | ||
515 | |||
516 | if (have_wifi) | ||
517 | bios_set_state(WIFI, wifi_enabled); | ||
518 | } | ||
519 | |||
520 | if (have_bluetooth) { | ||
521 | u16 bt = bios_get_default_setting(BLUETOOTH); | ||
522 | if (bt & 1) | ||
523 | bluetooth_enabled = (bt & 2) ? 1 : 0; | ||
524 | else | ||
525 | have_bluetooth = 0; | ||
526 | |||
527 | if (have_bluetooth) | ||
528 | bios_set_state(BLUETOOTH, bluetooth_enabled); | ||
529 | } | ||
530 | |||
531 | err = setup_input_dev(); | ||
532 | if (err) | ||
533 | goto err_unregister_device; | ||
534 | |||
535 | poll_bios(1); /* Flush stale event queue and arm timer */ | ||
536 | |||
537 | return 0; | ||
538 | |||
539 | err_unregister_device: | ||
540 | platform_device_unregister(wistron_device); | ||
541 | err_unregister_driver: | ||
542 | platform_driver_unregister(&wistron_driver); | ||
543 | err_detach_bios: | ||
544 | bios_detach(); | ||
545 | unmap_bios(); | ||
546 | |||
547 | return err; | ||
548 | } | ||
549 | |||
550 | static void __exit wb_module_exit(void) | ||
551 | { | ||
552 | del_timer_sync(&poll_timer); | ||
553 | input_unregister_device(input_dev); | ||
554 | platform_device_unregister(wistron_device); | ||
555 | platform_driver_unregister(&wistron_driver); | ||
556 | bios_detach(); | ||
557 | unmap_bios(); | ||
558 | } | ||
559 | |||
560 | module_init(wb_module_init); | ||
561 | module_exit(wb_module_exit); | ||
diff --git a/drivers/input/serio/serio.c b/drivers/input/serio/serio.c index edd15db17715..fbb69ef6a77b 100644 --- a/drivers/input/serio/serio.c +++ b/drivers/input/serio/serio.c | |||
@@ -269,14 +269,20 @@ static struct serio_event *serio_get_event(void) | |||
269 | return event; | 269 | return event; |
270 | } | 270 | } |
271 | 271 | ||
272 | static void serio_handle_events(void) | 272 | static void serio_handle_event(void) |
273 | { | 273 | { |
274 | struct serio_event *event; | 274 | struct serio_event *event; |
275 | struct serio_driver *serio_drv; | 275 | struct serio_driver *serio_drv; |
276 | 276 | ||
277 | down(&serio_sem); | 277 | down(&serio_sem); |
278 | 278 | ||
279 | while ((event = serio_get_event())) { | 279 | /* |
280 | * Note that we handle only one event here to give swsusp | ||
281 | * a chance to freeze kseriod thread. Serio events should | ||
282 | * be pretty rare so we are not concerned about taking | ||
283 | * performance hit. | ||
284 | */ | ||
285 | if ((event = serio_get_event())) { | ||
280 | 286 | ||
281 | switch (event->type) { | 287 | switch (event->type) { |
282 | case SERIO_REGISTER_PORT: | 288 | case SERIO_REGISTER_PORT: |
@@ -368,7 +374,7 @@ static struct serio *serio_get_pending_child(struct serio *parent) | |||
368 | static int serio_thread(void *nothing) | 374 | static int serio_thread(void *nothing) |
369 | { | 375 | { |
370 | do { | 376 | do { |
371 | serio_handle_events(); | 377 | serio_handle_event(); |
372 | wait_event_interruptible(serio_wait, | 378 | wait_event_interruptible(serio_wait, |
373 | kthread_should_stop() || !list_empty(&serio_event_list)); | 379 | kthread_should_stop() || !list_empty(&serio_event_list)); |
374 | try_to_freeze(); | 380 | try_to_freeze(); |
diff --git a/drivers/isdn/hisax/Kconfig b/drivers/isdn/hisax/Kconfig index 801c98f30e5c..c82105920d71 100644 --- a/drivers/isdn/hisax/Kconfig +++ b/drivers/isdn/hisax/Kconfig | |||
@@ -110,7 +110,7 @@ config HISAX_16_3 | |||
110 | 110 | ||
111 | config HISAX_TELESPCI | 111 | config HISAX_TELESPCI |
112 | bool "Teles PCI" | 112 | bool "Teles PCI" |
113 | depends on PCI && (BROKEN || !(SPARC64 || PPC)) | 113 | depends on PCI && (BROKEN || !(SPARC || PPC || PARISC || M68K)) |
114 | help | 114 | help |
115 | This enables HiSax support for the Teles PCI. | 115 | This enables HiSax support for the Teles PCI. |
116 | See <file:Documentation/isdn/README.HiSax> on how to configure it. | 116 | See <file:Documentation/isdn/README.HiSax> on how to configure it. |
@@ -238,7 +238,7 @@ config HISAX_MIC | |||
238 | 238 | ||
239 | config HISAX_NETJET | 239 | config HISAX_NETJET |
240 | bool "NETjet card" | 240 | bool "NETjet card" |
241 | depends on PCI && (BROKEN || !(SPARC64 || PPC)) | 241 | depends on PCI && (BROKEN || !(SPARC || PPC || PARISC || M68K)) |
242 | help | 242 | help |
243 | This enables HiSax support for the NetJet from Traverse | 243 | This enables HiSax support for the NetJet from Traverse |
244 | Technologies. | 244 | Technologies. |
@@ -249,7 +249,7 @@ config HISAX_NETJET | |||
249 | 249 | ||
250 | config HISAX_NETJET_U | 250 | config HISAX_NETJET_U |
251 | bool "NETspider U card" | 251 | bool "NETspider U card" |
252 | depends on PCI && (BROKEN || !(SPARC64 || PPC)) | 252 | depends on PCI && (BROKEN || !(SPARC || PPC || PARISC || M68K)) |
253 | help | 253 | help |
254 | This enables HiSax support for the Netspider U interface ISDN card | 254 | This enables HiSax support for the Netspider U interface ISDN card |
255 | from Traverse Technologies. | 255 | from Traverse Technologies. |
@@ -317,7 +317,7 @@ config HISAX_GAZEL | |||
317 | 317 | ||
318 | config HISAX_HFC_PCI | 318 | config HISAX_HFC_PCI |
319 | bool "HFC PCI-Bus cards" | 319 | bool "HFC PCI-Bus cards" |
320 | depends on PCI && (BROKEN || !(SPARC64 || PPC)) | 320 | depends on PCI && (BROKEN || !(SPARC || PPC || PARISC || M68K)) |
321 | help | 321 | help |
322 | This enables HiSax support for the HFC-S PCI 2BDS0 based cards. | 322 | This enables HiSax support for the HFC-S PCI 2BDS0 based cards. |
323 | 323 | ||
@@ -344,14 +344,14 @@ config HISAX_HFC_SX | |||
344 | 344 | ||
345 | config HISAX_ENTERNOW_PCI | 345 | config HISAX_ENTERNOW_PCI |
346 | bool "Formula-n enter:now PCI card" | 346 | bool "Formula-n enter:now PCI card" |
347 | depends on PCI && (BROKEN || !(SPARC64 || PPC)) | 347 | depends on PCI && (BROKEN || !(SPARC || PPC || PARISC || M68K)) |
348 | help | 348 | help |
349 | This enables HiSax support for the Formula-n enter:now PCI | 349 | This enables HiSax support for the Formula-n enter:now PCI |
350 | ISDN card. | 350 | ISDN card. |
351 | 351 | ||
352 | config HISAX_AMD7930 | 352 | config HISAX_AMD7930 |
353 | bool "Am7930 (EXPERIMENTAL)" | 353 | bool "Am7930 (EXPERIMENTAL)" |
354 | depends on EXPERIMENTAL && (SPARC32 || SPARC64) | 354 | depends on EXPERIMENTAL && SPARC |
355 | help | 355 | help |
356 | This enables HiSax support for the AMD7930 chips on some SPARCs. | 356 | This enables HiSax support for the AMD7930 chips on some SPARCs. |
357 | This code is not finished yet. | 357 | This code is not finished yet. |
diff --git a/drivers/isdn/pcbit/Kconfig b/drivers/isdn/pcbit/Kconfig index f06997faef16..0933881ab0c2 100644 --- a/drivers/isdn/pcbit/Kconfig +++ b/drivers/isdn/pcbit/Kconfig | |||
@@ -3,7 +3,7 @@ | |||
3 | # | 3 | # |
4 | config ISDN_DRV_PCBIT | 4 | config ISDN_DRV_PCBIT |
5 | tristate "PCBIT-D support" | 5 | tristate "PCBIT-D support" |
6 | depends on ISDN_I4L && ISA && (BROKEN || !PPC) | 6 | depends on ISDN_I4L && ISA && (BROKEN || X86) |
7 | help | 7 | help |
8 | This enables support for the PCBIT ISDN-card. This card is | 8 | This enables support for the PCBIT ISDN-card. This card is |
9 | manufactured in Portugal by Octal. For running this card, | 9 | manufactured in Portugal by Octal. For running this card, |
diff --git a/drivers/md/bitmap.c b/drivers/md/bitmap.c index 51315302a85e..252d55df9642 100644 --- a/drivers/md/bitmap.c +++ b/drivers/md/bitmap.c | |||
@@ -326,9 +326,9 @@ static int write_page(struct bitmap *bitmap, struct page *page, int wait) | |||
326 | } | 326 | } |
327 | } | 327 | } |
328 | 328 | ||
329 | ret = page->mapping->a_ops->prepare_write(NULL, page, 0, PAGE_SIZE); | 329 | ret = page->mapping->a_ops->prepare_write(bitmap->file, page, 0, PAGE_SIZE); |
330 | if (!ret) | 330 | if (!ret) |
331 | ret = page->mapping->a_ops->commit_write(NULL, page, 0, | 331 | ret = page->mapping->a_ops->commit_write(bitmap->file, page, 0, |
332 | PAGE_SIZE); | 332 | PAGE_SIZE); |
333 | if (ret) { | 333 | if (ret) { |
334 | unlock_page(page); | 334 | unlock_page(page); |
diff --git a/drivers/md/md.c b/drivers/md/md.c index f3fed662f32e..78c7418478d6 100644 --- a/drivers/md/md.c +++ b/drivers/md/md.c | |||
@@ -3846,11 +3846,20 @@ static int is_mddev_idle(mddev_t *mddev) | |||
3846 | curr_events = disk_stat_read(disk, sectors[0]) + | 3846 | curr_events = disk_stat_read(disk, sectors[0]) + |
3847 | disk_stat_read(disk, sectors[1]) - | 3847 | disk_stat_read(disk, sectors[1]) - |
3848 | atomic_read(&disk->sync_io); | 3848 | atomic_read(&disk->sync_io); |
3849 | /* Allow some slack between valud of curr_events and last_events, | 3849 | /* The difference between curr_events and last_events |
3850 | * as there are some uninteresting races. | 3850 | * will be affected by any new non-sync IO (making |
3851 | * curr_events bigger) and any difference in the amount of | ||
3852 | * in-flight syncio (making current_events bigger or smaller) | ||
3853 | * The amount in-flight is currently limited to | ||
3854 | * 32*64K in raid1/10 and 256*PAGE_SIZE in raid5/6 | ||
3855 | * which is at most 4096 sectors. | ||
3856 | * These numbers are fairly fragile and should be made | ||
3857 | * more robust, probably by enforcing the | ||
3858 | * 'window size' that md_do_sync sort-of uses. | ||
3859 | * | ||
3851 | * Note: the following is an unsigned comparison. | 3860 | * Note: the following is an unsigned comparison. |
3852 | */ | 3861 | */ |
3853 | if ((curr_events - rdev->last_events + 32) > 64) { | 3862 | if ((curr_events - rdev->last_events + 4096) > 8192) { |
3854 | rdev->last_events = curr_events; | 3863 | rdev->last_events = curr_events; |
3855 | idle = 0; | 3864 | idle = 0; |
3856 | } | 3865 | } |
@@ -4109,7 +4118,7 @@ static void md_do_sync(mddev_t *mddev) | |||
4109 | if (currspeed > sysctl_speed_limit_min) { | 4118 | if (currspeed > sysctl_speed_limit_min) { |
4110 | if ((currspeed > sysctl_speed_limit_max) || | 4119 | if ((currspeed > sysctl_speed_limit_max) || |
4111 | !is_mddev_idle(mddev)) { | 4120 | !is_mddev_idle(mddev)) { |
4112 | msleep(250); | 4121 | msleep(500); |
4113 | goto repeat; | 4122 | goto repeat; |
4114 | } | 4123 | } |
4115 | } | 4124 | } |
diff --git a/drivers/media/dvb/cinergyT2/cinergyT2.c b/drivers/media/dvb/cinergyT2/cinergyT2.c index fb394a0d838c..336fc284fa52 100644 --- a/drivers/media/dvb/cinergyT2/cinergyT2.c +++ b/drivers/media/dvb/cinergyT2/cinergyT2.c | |||
@@ -772,7 +772,7 @@ static int cinergyt2_register_rc(struct cinergyt2 *cinergyt2) | |||
772 | input_dev->name = DRIVER_NAME " remote control"; | 772 | input_dev->name = DRIVER_NAME " remote control"; |
773 | input_dev->phys = cinergyt2->phys; | 773 | input_dev->phys = cinergyt2->phys; |
774 | input_dev->evbit[0] = BIT(EV_KEY) | BIT(EV_REP); | 774 | input_dev->evbit[0] = BIT(EV_KEY) | BIT(EV_REP); |
775 | for (i = 0; ARRAY_SIZE(rc_keys); i += 3) | 775 | for (i = 0; i < ARRAY_SIZE(rc_keys); i += 3) |
776 | set_bit(rc_keys[i + 2], input_dev->keybit); | 776 | set_bit(rc_keys[i + 2], input_dev->keybit); |
777 | input_dev->keycodesize = 0; | 777 | input_dev->keycodesize = 0; |
778 | input_dev->keycodemax = 0; | 778 | input_dev->keycodemax = 0; |
diff --git a/drivers/media/video/ir-kbd-gpio.c b/drivers/media/video/ir-kbd-gpio.c index 5abfc0fbf6de..6345e29e4951 100644 --- a/drivers/media/video/ir-kbd-gpio.c +++ b/drivers/media/video/ir-kbd-gpio.c | |||
@@ -673,7 +673,6 @@ static int ir_probe(struct device *dev) | |||
673 | snprintf(ir->phys, sizeof(ir->phys), "pci-%s/ir0", | 673 | snprintf(ir->phys, sizeof(ir->phys), "pci-%s/ir0", |
674 | pci_name(sub->core->pci)); | 674 | pci_name(sub->core->pci)); |
675 | 675 | ||
676 | ir->sub = sub; | ||
677 | ir_input_init(input_dev, &ir->ir, ir_type, ir_codes); | 676 | ir_input_init(input_dev, &ir->ir, ir_type, ir_codes); |
678 | input_dev->name = ir->name; | 677 | input_dev->name = ir->name; |
679 | input_dev->phys = ir->phys; | 678 | input_dev->phys = ir->phys; |
@@ -688,6 +687,9 @@ static int ir_probe(struct device *dev) | |||
688 | } | 687 | } |
689 | input_dev->cdev.dev = &sub->core->pci->dev; | 688 | input_dev->cdev.dev = &sub->core->pci->dev; |
690 | 689 | ||
690 | ir->input = input_dev; | ||
691 | ir->sub = sub; | ||
692 | |||
691 | if (ir->polling) { | 693 | if (ir->polling) { |
692 | INIT_WORK(&ir->work, ir_work, ir); | 694 | INIT_WORK(&ir->work, ir_work, ir); |
693 | init_timer(&ir->timer); | 695 | init_timer(&ir->timer); |
@@ -708,7 +710,6 @@ static int ir_probe(struct device *dev) | |||
708 | /* all done */ | 710 | /* all done */ |
709 | dev_set_drvdata(dev, ir); | 711 | dev_set_drvdata(dev, ir); |
710 | input_register_device(ir->input); | 712 | input_register_device(ir->input); |
711 | printk(DEVNAME ": %s detected at %s\n",ir->name,ir->phys); | ||
712 | 713 | ||
713 | /* the remote isn't as bouncy as a keyboard */ | 714 | /* the remote isn't as bouncy as a keyboard */ |
714 | ir->input->rep[REP_DELAY] = repeat_delay; | 715 | ir->input->rep[REP_DELAY] = repeat_delay; |
diff --git a/drivers/media/video/saa7134/saa7134-input.c b/drivers/media/video/saa7134/saa7134-input.c index e648cc3bc96d..ab75ca5ac356 100644 --- a/drivers/media/video/saa7134/saa7134-input.c +++ b/drivers/media/video/saa7134/saa7134-input.c | |||
@@ -713,6 +713,8 @@ int saa7134_input_init1(struct saa7134_dev *dev) | |||
713 | return -ENOMEM; | 713 | return -ENOMEM; |
714 | } | 714 | } |
715 | 715 | ||
716 | ir->dev = input_dev; | ||
717 | |||
716 | /* init hardware-specific stuff */ | 718 | /* init hardware-specific stuff */ |
717 | ir->mask_keycode = mask_keycode; | 719 | ir->mask_keycode = mask_keycode; |
718 | ir->mask_keydown = mask_keydown; | 720 | ir->mask_keydown = mask_keydown; |
diff --git a/drivers/mtd/maps/ipaq-flash.c b/drivers/mtd/maps/ipaq-flash.c index 35097c9bbf50..b8ccb0a95789 100644 --- a/drivers/mtd/maps/ipaq-flash.c +++ b/drivers/mtd/maps/ipaq-flash.c | |||
@@ -246,7 +246,7 @@ int __init ipaq_mtd_init(void) | |||
246 | ipaq_map[i].size = h3xxx_max_flash_size; | 246 | ipaq_map[i].size = h3xxx_max_flash_size; |
247 | ipaq_map[i].set_vpp = h3xxx_set_vpp; | 247 | ipaq_map[i].set_vpp = h3xxx_set_vpp; |
248 | ipaq_map[i].phys = cs_phys[i]; | 248 | ipaq_map[i].phys = cs_phys[i]; |
249 | ipaq_map[i].virt = __ioremap(cs_phys[i], 0x04000000, 0, 1); | 249 | ipaq_map[i].virt = ioremap(cs_phys[i], 0x04000000); |
250 | if (machine_is_h3100 () || machine_is_h1900()) | 250 | if (machine_is_h3100 () || machine_is_h1900()) |
251 | ipaq_map[i].bankwidth = 2; | 251 | ipaq_map[i].bankwidth = 2; |
252 | } | 252 | } |
@@ -280,7 +280,7 @@ int __init ipaq_mtd_init(void) | |||
280 | nb_parts = ARRAY_SIZE(jornada_partitions); | 280 | nb_parts = ARRAY_SIZE(jornada_partitions); |
281 | ipaq_map[0].size = jornada_max_flash_size; | 281 | ipaq_map[0].size = jornada_max_flash_size; |
282 | ipaq_map[0].set_vpp = jornada56x_set_vpp; | 282 | ipaq_map[0].set_vpp = jornada56x_set_vpp; |
283 | ipaq_map[0].virt = (__u32)__ioremap(0x0, 0x04000000, 0, 1); | 283 | ipaq_map[0].virt = (__u32)ioremap(0x0, 0x04000000); |
284 | } | 284 | } |
285 | #endif | 285 | #endif |
286 | #ifdef CONFIG_SA1100_JORNADA720 | 286 | #ifdef CONFIG_SA1100_JORNADA720 |
@@ -442,7 +442,7 @@ static int __init h1900_special_case(void) | |||
442 | ipaq_map[0].size = 0x80000; | 442 | ipaq_map[0].size = 0x80000; |
443 | ipaq_map[0].set_vpp = h3xxx_set_vpp; | 443 | ipaq_map[0].set_vpp = h3xxx_set_vpp; |
444 | ipaq_map[0].phys = 0x0; | 444 | ipaq_map[0].phys = 0x0; |
445 | ipaq_map[0].virt = __ioremap(0x0, 0x04000000, 0, 1); | 445 | ipaq_map[0].virt = ioremap(0x0, 0x04000000); |
446 | ipaq_map[0].bankwidth = 2; | 446 | ipaq_map[0].bankwidth = 2; |
447 | 447 | ||
448 | printk(KERN_NOTICE "iPAQ flash: probing %d-bit flash bus, window=%lx with JEDEC.\n", ipaq_map[0].bankwidth*8, ipaq_map[0].virt); | 448 | printk(KERN_NOTICE "iPAQ flash: probing %d-bit flash bus, window=%lx with JEDEC.\n", ipaq_map[0].bankwidth*8, ipaq_map[0].virt); |
diff --git a/drivers/mtd/maps/ixp2000.c b/drivers/mtd/maps/ixp2000.c index fc7a78e31735..2c9cc7f37e92 100644 --- a/drivers/mtd/maps/ixp2000.c +++ b/drivers/mtd/maps/ixp2000.c | |||
@@ -159,12 +159,12 @@ static int ixp2000_flash_probe(struct platform_device *dev) | |||
159 | return -ENODEV; | 159 | return -ENODEV; |
160 | 160 | ||
161 | window_size = dev->resource->end - dev->resource->start + 1; | 161 | window_size = dev->resource->end - dev->resource->start + 1; |
162 | dev_info(_dev, "Probe of IXP2000 flash(%d banks x %dMiB)\n", | 162 | dev_info(&dev->dev, "Probe of IXP2000 flash(%d banks x %dMiB)\n", |
163 | ixp_data->nr_banks, ((u32)window_size >> 20)); | 163 | ixp_data->nr_banks, ((u32)window_size >> 20)); |
164 | 164 | ||
165 | if (plat->width != 1) { | 165 | if (plat->width != 1) { |
166 | dev_err(_dev, "IXP2000 MTD map only supports 8-bit mode, asking for %d\n", | 166 | dev_err(&dev->dev, "IXP2000 MTD map only supports 8-bit mode, asking for %d\n", |
167 | plat->width * 8); | 167 | plat->width * 8); |
168 | return -EIO; | 168 | return -EIO; |
169 | } | 169 | } |
170 | 170 | ||
@@ -202,7 +202,7 @@ static int ixp2000_flash_probe(struct platform_device *dev) | |||
202 | dev->resource->end - dev->resource->start + 1, | 202 | dev->resource->end - dev->resource->start + 1, |
203 | dev->dev.bus_id); | 203 | dev->dev.bus_id); |
204 | if (!info->res) { | 204 | if (!info->res) { |
205 | dev_err(_dev, "Could not reserve memory region\n"); | 205 | dev_err(&dev->dev, "Could not reserve memory region\n"); |
206 | err = -ENOMEM; | 206 | err = -ENOMEM; |
207 | goto Error; | 207 | goto Error; |
208 | } | 208 | } |
@@ -210,7 +210,7 @@ static int ixp2000_flash_probe(struct platform_device *dev) | |||
210 | info->map.map_priv_1 = (unsigned long) ioremap(dev->resource->start, | 210 | info->map.map_priv_1 = (unsigned long) ioremap(dev->resource->start, |
211 | dev->resource->end - dev->resource->start + 1); | 211 | dev->resource->end - dev->resource->start + 1); |
212 | if (!info->map.map_priv_1) { | 212 | if (!info->map.map_priv_1) { |
213 | dev_err(_dev, "Failed to ioremap flash region\n"); | 213 | dev_err(&dev->dev, "Failed to ioremap flash region\n"); |
214 | err = -EIO; | 214 | err = -EIO; |
215 | goto Error; | 215 | goto Error; |
216 | } | 216 | } |
@@ -221,13 +221,13 @@ static int ixp2000_flash_probe(struct platform_device *dev) | |||
221 | */ | 221 | */ |
222 | 222 | ||
223 | erratum44_workaround = ixp2000_has_broken_slowport(); | 223 | erratum44_workaround = ixp2000_has_broken_slowport(); |
224 | dev_info(_dev, "Erratum 44 workaround %s\n", | 224 | dev_info(&dev->dev, "Erratum 44 workaround %s\n", |
225 | erratum44_workaround ? "enabled" : "disabled"); | 225 | erratum44_workaround ? "enabled" : "disabled"); |
226 | #endif | 226 | #endif |
227 | 227 | ||
228 | info->mtd = do_map_probe(plat->map_name, &info->map); | 228 | info->mtd = do_map_probe(plat->map_name, &info->map); |
229 | if (!info->mtd) { | 229 | if (!info->mtd) { |
230 | dev_err(_dev, "map_probe failed\n"); | 230 | dev_err(&dev->dev, "map_probe failed\n"); |
231 | err = -ENXIO; | 231 | err = -ENXIO; |
232 | goto Error; | 232 | goto Error; |
233 | } | 233 | } |
@@ -237,7 +237,7 @@ static int ixp2000_flash_probe(struct platform_device *dev) | |||
237 | if (err > 0) { | 237 | if (err > 0) { |
238 | err = add_mtd_partitions(info->mtd, info->partitions, err); | 238 | err = add_mtd_partitions(info->mtd, info->partitions, err); |
239 | if(err) | 239 | if(err) |
240 | dev_err(_dev, "Could not parse partitions\n"); | 240 | dev_err(&dev->dev, "Could not parse partitions\n"); |
241 | } | 241 | } |
242 | 242 | ||
243 | if (err) | 243 | if (err) |
@@ -251,8 +251,8 @@ Error: | |||
251 | } | 251 | } |
252 | 252 | ||
253 | static struct platform_driver ixp2000_flash_driver = { | 253 | static struct platform_driver ixp2000_flash_driver = { |
254 | .probe = &ixp2000_flash_probe, | 254 | .probe = ixp2000_flash_probe, |
255 | .remove = &ixp2000_flash_remove | 255 | .remove = ixp2000_flash_remove, |
256 | .driver = { | 256 | .driver = { |
257 | .name = "IXP2000-Flash", | 257 | .name = "IXP2000-Flash", |
258 | }, | 258 | }, |
diff --git a/drivers/mtd/nand/h1910.c b/drivers/mtd/nand/h1910.c index 041e4b3358fb..f68f7a99a630 100644 --- a/drivers/mtd/nand/h1910.c +++ b/drivers/mtd/nand/h1910.c | |||
@@ -112,7 +112,7 @@ static int __init h1910_init (void) | |||
112 | if (!machine_is_h1900()) | 112 | if (!machine_is_h1900()) |
113 | return -ENODEV; | 113 | return -ENODEV; |
114 | 114 | ||
115 | nandaddr = __ioremap(0x08000000, 0x1000, 0, 1); | 115 | nandaddr = ioremap(0x08000000, 0x1000); |
116 | if (!nandaddr) { | 116 | if (!nandaddr) { |
117 | printk("Failed to ioremap nand flash.\n"); | 117 | printk("Failed to ioremap nand flash.\n"); |
118 | return -ENOMEM; | 118 | return -ENOMEM; |
diff --git a/drivers/net/au1000_eth.c b/drivers/net/au1000_eth.c index 332e9953c55c..cd0b1dccfb61 100644 --- a/drivers/net/au1000_eth.c +++ b/drivers/net/au1000_eth.c | |||
@@ -32,6 +32,7 @@ | |||
32 | * | 32 | * |
33 | */ | 33 | */ |
34 | 34 | ||
35 | #include <linux/config.h> | ||
35 | #include <linux/module.h> | 36 | #include <linux/module.h> |
36 | #include <linux/kernel.h> | 37 | #include <linux/kernel.h> |
37 | #include <linux/sched.h> | 38 | #include <linux/sched.h> |
diff --git a/drivers/net/e100.c b/drivers/net/e100.c index 7a6aeae2c9fa..22cd04556707 100644 --- a/drivers/net/e100.c +++ b/drivers/net/e100.c | |||
@@ -156,7 +156,7 @@ | |||
156 | 156 | ||
157 | #define DRV_NAME "e100" | 157 | #define DRV_NAME "e100" |
158 | #define DRV_EXT "-NAPI" | 158 | #define DRV_EXT "-NAPI" |
159 | #define DRV_VERSION "3.4.14-k2"DRV_EXT | 159 | #define DRV_VERSION "3.4.14-k4"DRV_EXT |
160 | #define DRV_DESCRIPTION "Intel(R) PRO/100 Network Driver" | 160 | #define DRV_DESCRIPTION "Intel(R) PRO/100 Network Driver" |
161 | #define DRV_COPYRIGHT "Copyright(c) 1999-2005 Intel Corporation" | 161 | #define DRV_COPYRIGHT "Copyright(c) 1999-2005 Intel Corporation" |
162 | #define PFX DRV_NAME ": " | 162 | #define PFX DRV_NAME ": " |
@@ -903,8 +903,8 @@ static void mdio_write(struct net_device *netdev, int addr, int reg, int data) | |||
903 | 903 | ||
904 | static void e100_get_defaults(struct nic *nic) | 904 | static void e100_get_defaults(struct nic *nic) |
905 | { | 905 | { |
906 | struct param_range rfds = { .min = 16, .max = 256, .count = 64 }; | 906 | struct param_range rfds = { .min = 16, .max = 256, .count = 256 }; |
907 | struct param_range cbs = { .min = 64, .max = 256, .count = 64 }; | 907 | struct param_range cbs = { .min = 64, .max = 256, .count = 128 }; |
908 | 908 | ||
909 | pci_read_config_byte(nic->pdev, PCI_REVISION_ID, &nic->rev_id); | 909 | pci_read_config_byte(nic->pdev, PCI_REVISION_ID, &nic->rev_id); |
910 | /* MAC type is encoded as rev ID; exception: ICH is treated as 82559 */ | 910 | /* MAC type is encoded as rev ID; exception: ICH is treated as 82559 */ |
@@ -1007,25 +1007,264 @@ static void e100_configure(struct nic *nic, struct cb *cb, struct sk_buff *skb) | |||
1007 | c[16], c[17], c[18], c[19], c[20], c[21], c[22], c[23]); | 1007 | c[16], c[17], c[18], c[19], c[20], c[21], c[22], c[23]); |
1008 | } | 1008 | } |
1009 | 1009 | ||
1010 | /********************************************************/ | ||
1011 | /* Micro code for 8086:1229 Rev 8 */ | ||
1012 | /********************************************************/ | ||
1013 | |||
1014 | /* Parameter values for the D101M B-step */ | ||
1015 | #define D101M_CPUSAVER_TIMER_DWORD 78 | ||
1016 | #define D101M_CPUSAVER_BUNDLE_DWORD 65 | ||
1017 | #define D101M_CPUSAVER_MIN_SIZE_DWORD 126 | ||
1018 | |||
1019 | #define D101M_B_RCVBUNDLE_UCODE \ | ||
1020 | {\ | ||
1021 | 0x00550215, 0xFFFF0437, 0xFFFFFFFF, 0x06A70789, 0xFFFFFFFF, 0x0558FFFF, \ | ||
1022 | 0x000C0001, 0x00101312, 0x000C0008, 0x00380216, \ | ||
1023 | 0x0010009C, 0x00204056, 0x002380CC, 0x00380056, \ | ||
1024 | 0x0010009C, 0x00244C0B, 0x00000800, 0x00124818, \ | ||
1025 | 0x00380438, 0x00000000, 0x00140000, 0x00380555, \ | ||
1026 | 0x00308000, 0x00100662, 0x00100561, 0x000E0408, \ | ||
1027 | 0x00134861, 0x000C0002, 0x00103093, 0x00308000, \ | ||
1028 | 0x00100624, 0x00100561, 0x000E0408, 0x00100861, \ | ||
1029 | 0x000C007E, 0x00222C21, 0x000C0002, 0x00103093, \ | ||
1030 | 0x00380C7A, 0x00080000, 0x00103090, 0x00380C7A, \ | ||
1031 | 0x00000000, 0x00000000, 0x00000000, 0x00000000, \ | ||
1032 | 0x0010009C, 0x00244C2D, 0x00010004, 0x00041000, \ | ||
1033 | 0x003A0437, 0x00044010, 0x0038078A, 0x00000000, \ | ||
1034 | 0x00100099, 0x00206C7A, 0x0010009C, 0x00244C48, \ | ||
1035 | 0x00130824, 0x000C0001, 0x00101213, 0x00260C75, \ | ||
1036 | 0x00041000, 0x00010004, 0x00130826, 0x000C0006, \ | ||
1037 | 0x002206A8, 0x0013C926, 0x00101313, 0x003806A8, \ | ||
1038 | 0x00000000, 0x00000000, 0x00000000, 0x00000000, \ | ||
1039 | 0x00000000, 0x00000000, 0x00000000, 0x00000000, \ | ||
1040 | 0x00080600, 0x00101B10, 0x00050004, 0x00100826, \ | ||
1041 | 0x00101210, 0x00380C34, 0x00000000, 0x00000000, \ | ||
1042 | 0x0021155B, 0x00100099, 0x00206559, 0x0010009C, \ | ||
1043 | 0x00244559, 0x00130836, 0x000C0000, 0x00220C62, \ | ||
1044 | 0x000C0001, 0x00101B13, 0x00229C0E, 0x00210C0E, \ | ||
1045 | 0x00226C0E, 0x00216C0E, 0x0022FC0E, 0x00215C0E, \ | ||
1046 | 0x00214C0E, 0x00380555, 0x00010004, 0x00041000, \ | ||
1047 | 0x00278C67, 0x00040800, 0x00018100, 0x003A0437, \ | ||
1048 | 0x00130826, 0x000C0001, 0x00220559, 0x00101313, \ | ||
1049 | 0x00380559, 0x00000000, 0x00000000, 0x00000000, \ | ||
1050 | 0x00000000, 0x00000000, 0x00000000, 0x00000000, \ | ||
1051 | 0x00000000, 0x00130831, 0x0010090B, 0x00124813, \ | ||
1052 | 0x000CFF80, 0x002606AB, 0x00041000, 0x00010004, \ | ||
1053 | 0x003806A8, 0x00000000, 0x00000000, 0x00000000, \ | ||
1054 | } | ||
1055 | |||
1056 | /********************************************************/ | ||
1057 | /* Micro code for 8086:1229 Rev 9 */ | ||
1058 | /********************************************************/ | ||
1059 | |||
1060 | /* Parameter values for the D101S */ | ||
1061 | #define D101S_CPUSAVER_TIMER_DWORD 78 | ||
1062 | #define D101S_CPUSAVER_BUNDLE_DWORD 67 | ||
1063 | #define D101S_CPUSAVER_MIN_SIZE_DWORD 128 | ||
1064 | |||
1065 | #define D101S_RCVBUNDLE_UCODE \ | ||
1066 | {\ | ||
1067 | 0x00550242, 0xFFFF047E, 0xFFFFFFFF, 0x06FF0818, 0xFFFFFFFF, 0x05A6FFFF, \ | ||
1068 | 0x000C0001, 0x00101312, 0x000C0008, 0x00380243, \ | ||
1069 | 0x0010009C, 0x00204056, 0x002380D0, 0x00380056, \ | ||
1070 | 0x0010009C, 0x00244F8B, 0x00000800, 0x00124818, \ | ||
1071 | 0x0038047F, 0x00000000, 0x00140000, 0x003805A3, \ | ||
1072 | 0x00308000, 0x00100610, 0x00100561, 0x000E0408, \ | ||
1073 | 0x00134861, 0x000C0002, 0x00103093, 0x00308000, \ | ||
1074 | 0x00100624, 0x00100561, 0x000E0408, 0x00100861, \ | ||
1075 | 0x000C007E, 0x00222FA1, 0x000C0002, 0x00103093, \ | ||
1076 | 0x00380F90, 0x00080000, 0x00103090, 0x00380F90, \ | ||
1077 | 0x00000000, 0x00000000, 0x00000000, 0x00000000, \ | ||
1078 | 0x0010009C, 0x00244FAD, 0x00010004, 0x00041000, \ | ||
1079 | 0x003A047E, 0x00044010, 0x00380819, 0x00000000, \ | ||
1080 | 0x00100099, 0x00206FFD, 0x0010009A, 0x0020AFFD, \ | ||
1081 | 0x0010009C, 0x00244FC8, 0x00130824, 0x000C0001, \ | ||
1082 | 0x00101213, 0x00260FF7, 0x00041000, 0x00010004, \ | ||
1083 | 0x00130826, 0x000C0006, 0x00220700, 0x0013C926, \ | ||
1084 | 0x00101313, 0x00380700, 0x00000000, 0x00000000, \ | ||
1085 | 0x00000000, 0x00000000, 0x00000000, 0x00000000, \ | ||
1086 | 0x00080600, 0x00101B10, 0x00050004, 0x00100826, \ | ||
1087 | 0x00101210, 0x00380FB6, 0x00000000, 0x00000000, \ | ||
1088 | 0x002115A9, 0x00100099, 0x002065A7, 0x0010009A, \ | ||
1089 | 0x0020A5A7, 0x0010009C, 0x002445A7, 0x00130836, \ | ||
1090 | 0x000C0000, 0x00220FE4, 0x000C0001, 0x00101B13, \ | ||
1091 | 0x00229F8E, 0x00210F8E, 0x00226F8E, 0x00216F8E, \ | ||
1092 | 0x0022FF8E, 0x00215F8E, 0x00214F8E, 0x003805A3, \ | ||
1093 | 0x00010004, 0x00041000, 0x00278FE9, 0x00040800, \ | ||
1094 | 0x00018100, 0x003A047E, 0x00130826, 0x000C0001, \ | ||
1095 | 0x002205A7, 0x00101313, 0x003805A7, 0x00000000, \ | ||
1096 | 0x00000000, 0x00000000, 0x00000000, 0x00000000, \ | ||
1097 | 0x00000000, 0x00000000, 0x00000000, 0x00130831, \ | ||
1098 | 0x0010090B, 0x00124813, 0x000CFF80, 0x00260703, \ | ||
1099 | 0x00041000, 0x00010004, 0x00380700 \ | ||
1100 | } | ||
1101 | |||
1102 | /********************************************************/ | ||
1103 | /* Micro code for the 8086:1229 Rev F/10 */ | ||
1104 | /********************************************************/ | ||
1105 | |||
1106 | /* Parameter values for the D102 E-step */ | ||
1107 | #define D102_E_CPUSAVER_TIMER_DWORD 42 | ||
1108 | #define D102_E_CPUSAVER_BUNDLE_DWORD 54 | ||
1109 | #define D102_E_CPUSAVER_MIN_SIZE_DWORD 46 | ||
1110 | |||
1111 | #define D102_E_RCVBUNDLE_UCODE \ | ||
1112 | {\ | ||
1113 | 0x007D028F, 0x0E4204F9, 0x14ED0C85, 0x14FA14E9, 0x0EF70E36, 0x1FFF1FFF, \ | ||
1114 | 0x00E014B9, 0x00000000, 0x00000000, 0x00000000, \ | ||
1115 | 0x00E014BD, 0x00000000, 0x00000000, 0x00000000, \ | ||
1116 | 0x00E014D5, 0x00000000, 0x00000000, 0x00000000, \ | ||
1117 | 0x00000000, 0x00000000, 0x00000000, 0x00000000, \ | ||
1118 | 0x00E014C1, 0x00000000, 0x00000000, 0x00000000, \ | ||
1119 | 0x00000000, 0x00000000, 0x00000000, 0x00000000, \ | ||
1120 | 0x00000000, 0x00000000, 0x00000000, 0x00000000, \ | ||
1121 | 0x00000000, 0x00000000, 0x00000000, 0x00000000, \ | ||
1122 | 0x00E014C8, 0x00000000, 0x00000000, 0x00000000, \ | ||
1123 | 0x00200600, 0x00E014EE, 0x00000000, 0x00000000, \ | ||
1124 | 0x0030FF80, 0x00940E46, 0x00038200, 0x00102000, \ | ||
1125 | 0x00E00E43, 0x00000000, 0x00000000, 0x00000000, \ | ||
1126 | 0x00300006, 0x00E014FB, 0x00000000, 0x00000000, \ | ||
1127 | 0x00000000, 0x00000000, 0x00000000, 0x00000000, \ | ||
1128 | 0x00000000, 0x00000000, 0x00000000, 0x00000000, \ | ||
1129 | 0x00000000, 0x00000000, 0x00000000, 0x00000000, \ | ||
1130 | 0x00906E41, 0x00800E3C, 0x00E00E39, 0x00000000, \ | ||
1131 | 0x00906EFD, 0x00900EFD, 0x00E00EF8, 0x00000000, \ | ||
1132 | 0x00000000, 0x00000000, 0x00000000, 0x00000000, \ | ||
1133 | 0x00000000, 0x00000000, 0x00000000, 0x00000000, \ | ||
1134 | 0x00000000, 0x00000000, 0x00000000, 0x00000000, \ | ||
1135 | 0x00000000, 0x00000000, 0x00000000, 0x00000000, \ | ||
1136 | 0x00000000, 0x00000000, 0x00000000, 0x00000000, \ | ||
1137 | 0x00000000, 0x00000000, 0x00000000, 0x00000000, \ | ||
1138 | 0x00000000, 0x00000000, 0x00000000, 0x00000000, \ | ||
1139 | 0x00000000, 0x00000000, 0x00000000, 0x00000000, \ | ||
1140 | 0x00000000, 0x00000000, 0x00000000, 0x00000000, \ | ||
1141 | 0x00000000, 0x00000000, 0x00000000, 0x00000000, \ | ||
1142 | 0x00000000, 0x00000000, 0x00000000, 0x00000000, \ | ||
1143 | 0x00000000, 0x00000000, 0x00000000, 0x00000000, \ | ||
1144 | 0x00000000, 0x00000000, 0x00000000, 0x00000000, \ | ||
1145 | 0x00000000, 0x00000000, 0x00000000, 0x00000000, \ | ||
1146 | } | ||
1147 | |||
1010 | static void e100_load_ucode(struct nic *nic, struct cb *cb, struct sk_buff *skb) | 1148 | static void e100_load_ucode(struct nic *nic, struct cb *cb, struct sk_buff *skb) |
1011 | { | 1149 | { |
1012 | int i; | 1150 | /* *INDENT-OFF* */ |
1013 | static const u32 ucode[UCODE_SIZE] = { | 1151 | static struct { |
1014 | /* NFS packets are misinterpreted as TCO packets and | 1152 | u32 ucode[UCODE_SIZE + 1]; |
1015 | * incorrectly routed to the BMC over SMBus. This | 1153 | u8 mac; |
1016 | * microcode patch checks the fragmented IP bit in the | 1154 | u8 timer_dword; |
1017 | * NFS/UDP header to distinguish between NFS and TCO. */ | 1155 | u8 bundle_dword; |
1018 | 0x0EF70E36, 0x1FFF1FFF, 0x1FFF1FFF, 0x1FFF1FFF, 0x1FFF1FFF, | 1156 | u8 min_size_dword; |
1019 | 0x1FFF1FFF, 0x00906E41, 0x00800E3C, 0x00E00E39, 0x00000000, | 1157 | } ucode_opts[] = { |
1020 | 0x00906EFD, 0x00900EFD, 0x00E00EF8, | 1158 | { D101M_B_RCVBUNDLE_UCODE, |
1021 | }; | 1159 | mac_82559_D101M, |
1022 | 1160 | D101M_CPUSAVER_TIMER_DWORD, | |
1023 | if(nic->mac == mac_82551_F || nic->mac == mac_82551_10) { | 1161 | D101M_CPUSAVER_BUNDLE_DWORD, |
1024 | for(i = 0; i < UCODE_SIZE; i++) | 1162 | D101M_CPUSAVER_MIN_SIZE_DWORD }, |
1163 | { D101S_RCVBUNDLE_UCODE, | ||
1164 | mac_82559_D101S, | ||
1165 | D101S_CPUSAVER_TIMER_DWORD, | ||
1166 | D101S_CPUSAVER_BUNDLE_DWORD, | ||
1167 | D101S_CPUSAVER_MIN_SIZE_DWORD }, | ||
1168 | { D102_E_RCVBUNDLE_UCODE, | ||
1169 | mac_82551_F, | ||
1170 | D102_E_CPUSAVER_TIMER_DWORD, | ||
1171 | D102_E_CPUSAVER_BUNDLE_DWORD, | ||
1172 | D102_E_CPUSAVER_MIN_SIZE_DWORD }, | ||
1173 | { D102_E_RCVBUNDLE_UCODE, | ||
1174 | mac_82551_10, | ||
1175 | D102_E_CPUSAVER_TIMER_DWORD, | ||
1176 | D102_E_CPUSAVER_BUNDLE_DWORD, | ||
1177 | D102_E_CPUSAVER_MIN_SIZE_DWORD }, | ||
1178 | { {0}, 0, 0, 0, 0} | ||
1179 | }, *opts; | ||
1180 | /* *INDENT-ON* */ | ||
1181 | |||
1182 | /************************************************************************* | ||
1183 | * CPUSaver parameters | ||
1184 | * | ||
1185 | * All CPUSaver parameters are 16-bit literals that are part of a | ||
1186 | * "move immediate value" instruction. By changing the value of | ||
1187 | * the literal in the instruction before the code is loaded, the | ||
1188 | * driver can change the algorithm. | ||
1189 | * | ||
1190 | * INTDELAY - This loads the dead-man timer with its inital value. | ||
1191 | * When this timer expires the interrupt is asserted, and the | ||
1192 | * timer is reset each time a new packet is received. (see | ||
1193 | * BUNDLEMAX below to set the limit on number of chained packets) | ||
1194 | * The current default is 0x600 or 1536. Experiments show that | ||
1195 | * the value should probably stay within the 0x200 - 0x1000. | ||
1196 | * | ||
1197 | * BUNDLEMAX - | ||
1198 | * This sets the maximum number of frames that will be bundled. In | ||
1199 | * some situations, such as the TCP windowing algorithm, it may be | ||
1200 | * better to limit the growth of the bundle size than let it go as | ||
1201 | * high as it can, because that could cause too much added latency. | ||
1202 | * The default is six, because this is the number of packets in the | ||
1203 | * default TCP window size. A value of 1 would make CPUSaver indicate | ||
1204 | * an interrupt for every frame received. If you do not want to put | ||
1205 | * a limit on the bundle size, set this value to xFFFF. | ||
1206 | * | ||
1207 | * BUNDLESMALL - | ||
1208 | * This contains a bit-mask describing the minimum size frame that | ||
1209 | * will be bundled. The default masks the lower 7 bits, which means | ||
1210 | * that any frame less than 128 bytes in length will not be bundled, | ||
1211 | * but will instead immediately generate an interrupt. This does | ||
1212 | * not affect the current bundle in any way. Any frame that is 128 | ||
1213 | * bytes or large will be bundled normally. This feature is meant | ||
1214 | * to provide immediate indication of ACK frames in a TCP environment. | ||
1215 | * Customers were seeing poor performance when a machine with CPUSaver | ||
1216 | * enabled was sending but not receiving. The delay introduced when | ||
1217 | * the ACKs were received was enough to reduce total throughput, because | ||
1218 | * the sender would sit idle until the ACK was finally seen. | ||
1219 | * | ||
1220 | * The current default is 0xFF80, which masks out the lower 7 bits. | ||
1221 | * This means that any frame which is x7F (127) bytes or smaller | ||
1222 | * will cause an immediate interrupt. Because this value must be a | ||
1223 | * bit mask, there are only a few valid values that can be used. To | ||
1224 | * turn this feature off, the driver can write the value xFFFF to the | ||
1225 | * lower word of this instruction (in the same way that the other | ||
1226 | * parameters are used). Likewise, a value of 0xF800 (2047) would | ||
1227 | * cause an interrupt to be generated for every frame, because all | ||
1228 | * standard Ethernet frames are <= 2047 bytes in length. | ||
1229 | *************************************************************************/ | ||
1230 | |||
1231 | /* if you wish to disable the ucode functionality, while maintaining the | ||
1232 | * workarounds it provides, set the following defines to: | ||
1233 | * BUNDLESMALL 0 | ||
1234 | * BUNDLEMAX 1 | ||
1235 | * INTDELAY 1 | ||
1236 | */ | ||
1237 | #define BUNDLESMALL 1 | ||
1238 | #define BUNDLEMAX (u16)6 | ||
1239 | #define INTDELAY (u16)1536 /* 0x600 */ | ||
1240 | |||
1241 | /* do not load u-code for ICH devices */ | ||
1242 | if (nic->flags & ich) | ||
1243 | goto noloaducode; | ||
1244 | |||
1245 | /* Search for ucode match against h/w rev_id */ | ||
1246 | for (opts = ucode_opts; opts->mac; opts++) { | ||
1247 | int i; | ||
1248 | u32 *ucode = opts->ucode; | ||
1249 | if (nic->mac != opts->mac) | ||
1250 | continue; | ||
1251 | |||
1252 | /* Insert user-tunable settings */ | ||
1253 | ucode[opts->timer_dword] &= 0xFFFF0000; | ||
1254 | ucode[opts->timer_dword] |= INTDELAY; | ||
1255 | ucode[opts->bundle_dword] &= 0xFFFF0000; | ||
1256 | ucode[opts->bundle_dword] |= BUNDLEMAX; | ||
1257 | ucode[opts->min_size_dword] &= 0xFFFF0000; | ||
1258 | ucode[opts->min_size_dword] |= (BUNDLESMALL) ? 0xFFFF : 0xFF80; | ||
1259 | |||
1260 | for (i = 0; i < UCODE_SIZE; i++) | ||
1025 | cb->u.ucode[i] = cpu_to_le32(ucode[i]); | 1261 | cb->u.ucode[i] = cpu_to_le32(ucode[i]); |
1026 | cb->command = cpu_to_le16(cb_ucode); | 1262 | cb->command = cpu_to_le16(cb_ucode); |
1027 | } else | 1263 | return; |
1028 | cb->command = cpu_to_le16(cb_nop); | 1264 | } |
1265 | |||
1266 | noloaducode: | ||
1267 | cb->command = cpu_to_le16(cb_nop); | ||
1029 | } | 1268 | } |
1030 | 1269 | ||
1031 | static void e100_setup_iaaddr(struct nic *nic, struct cb *cb, | 1270 | static void e100_setup_iaaddr(struct nic *nic, struct cb *cb, |
diff --git a/drivers/net/fec_8xx/Kconfig b/drivers/net/fec_8xx/Kconfig index 94e7a9af8705..a84c232395e3 100644 --- a/drivers/net/fec_8xx/Kconfig +++ b/drivers/net/fec_8xx/Kconfig | |||
@@ -1,6 +1,6 @@ | |||
1 | config FEC_8XX | 1 | config FEC_8XX |
2 | tristate "Motorola 8xx FEC driver" | 2 | tristate "Motorola 8xx FEC driver" |
3 | depends on NET_ETHERNET && FEC | 3 | depends on NET_ETHERNET && 8xx |
4 | select MII | 4 | select MII |
5 | 5 | ||
6 | config FEC_8XX_GENERIC_PHY | 6 | config FEC_8XX_GENERIC_PHY |
diff --git a/drivers/net/ioc3-eth.c b/drivers/net/ioc3-eth.c index 6a3129bc15a6..9b8295ee06ef 100644 --- a/drivers/net/ioc3-eth.c +++ b/drivers/net/ioc3-eth.c | |||
@@ -1360,7 +1360,7 @@ static struct pci_driver ioc3_driver = { | |||
1360 | 1360 | ||
1361 | static int __init ioc3_init_module(void) | 1361 | static int __init ioc3_init_module(void) |
1362 | { | 1362 | { |
1363 | return pci_module_init(&ioc3_driver); | 1363 | return pci_register_driver(&ioc3_driver); |
1364 | } | 1364 | } |
1365 | 1365 | ||
1366 | static void __exit ioc3_cleanup_module(void) | 1366 | static void __exit ioc3_cleanup_module(void) |
diff --git a/drivers/net/r8169.c b/drivers/net/r8169.c index 159b56a56ef4..14a76f7cf900 100644 --- a/drivers/net/r8169.c +++ b/drivers/net/r8169.c | |||
@@ -1346,10 +1346,8 @@ rtl8169_init_board(struct pci_dev *pdev, struct net_device **dev_out, | |||
1346 | } else { | 1346 | } else { |
1347 | if (netif_msg_probe(tp)) { | 1347 | if (netif_msg_probe(tp)) { |
1348 | printk(KERN_ERR PFX | 1348 | printk(KERN_ERR PFX |
1349 | "Cannot find PowerManagement capability. " | 1349 | "PowerManagement capability not found.\n"); |
1350 | "Aborting.\n"); | ||
1351 | } | 1350 | } |
1352 | goto err_out_mwi; | ||
1353 | } | 1351 | } |
1354 | 1352 | ||
1355 | /* make sure PCI base addr 1 is MMIO */ | 1353 | /* make sure PCI base addr 1 is MMIO */ |
@@ -2516,7 +2514,7 @@ rtl8169_interrupt(int irq, void *dev_instance, struct pt_regs *regs) | |||
2516 | } while (boguscnt > 0); | 2514 | } while (boguscnt > 0); |
2517 | 2515 | ||
2518 | if (boguscnt <= 0) { | 2516 | if (boguscnt <= 0) { |
2519 | if (net_ratelimit() && netif_msg_intr(tp)) { | 2517 | if (netif_msg_intr(tp) && net_ratelimit() ) { |
2520 | printk(KERN_WARNING | 2518 | printk(KERN_WARNING |
2521 | "%s: Too much work at interrupt!\n", dev->name); | 2519 | "%s: Too much work at interrupt!\n", dev->name); |
2522 | } | 2520 | } |
diff --git a/drivers/net/saa9730.h b/drivers/net/saa9730.h index 9e9da6b4080f..a7e9d29a86a7 100644 --- a/drivers/net/saa9730.h +++ b/drivers/net/saa9730.h | |||
@@ -1,6 +1,7 @@ | |||
1 | /* | 1 | /* |
2 | * Carsten Langgaard, carstenl@mips.com | 2 | * Copyright (C) 2000, 2005 MIPS Technologies, Inc. All rights reserved. |
3 | * Copyright (C) 2000 MIPS Technologies, Inc. All rights reserved. | 3 | * Authors: Carsten Langgaard <carstenl@mips.com> |
4 | * Maciej W. Rozycki <macro@mips.com> | ||
4 | * | 5 | * |
5 | * ######################################################################## | 6 | * ######################################################################## |
6 | * | 7 | * |
@@ -265,6 +266,7 @@ | |||
265 | 266 | ||
266 | /* The SAA9730 (LAN) controller register map, as seen via the PCI-bus. */ | 267 | /* The SAA9730 (LAN) controller register map, as seen via the PCI-bus. */ |
267 | #define SAA9730_LAN_REGS_ADDR 0x20400 | 268 | #define SAA9730_LAN_REGS_ADDR 0x20400 |
269 | #define SAA9730_LAN_REGS_SIZE 0x00400 | ||
268 | 270 | ||
269 | struct lan_saa9730_regmap { | 271 | struct lan_saa9730_regmap { |
270 | volatile unsigned int TxBuffA; /* 0x20400 */ | 272 | volatile unsigned int TxBuffA; /* 0x20400 */ |
@@ -309,6 +311,7 @@ typedef volatile struct lan_saa9730_regmap t_lan_saa9730_regmap; | |||
309 | 311 | ||
310 | /* The SAA9730 (EVM) controller register map, as seen via the PCI-bus. */ | 312 | /* The SAA9730 (EVM) controller register map, as seen via the PCI-bus. */ |
311 | #define SAA9730_EVM_REGS_ADDR 0x02000 | 313 | #define SAA9730_EVM_REGS_ADDR 0x02000 |
314 | #define SAA9730_EVM_REGS_SIZE 0x00400 | ||
312 | 315 | ||
313 | struct evm_saa9730_regmap { | 316 | struct evm_saa9730_regmap { |
314 | volatile unsigned int InterruptStatus1; /* 0x2000 */ | 317 | volatile unsigned int InterruptStatus1; /* 0x2000 */ |
@@ -329,16 +332,32 @@ typedef volatile struct evm_saa9730_regmap t_evm_saa9730_regmap; | |||
329 | 332 | ||
330 | 333 | ||
331 | struct lan_saa9730_private { | 334 | struct lan_saa9730_private { |
335 | /* | ||
336 | * Rx/Tx packet buffers. | ||
337 | * The Rx and Tx packets must be PACKET_SIZE aligned. | ||
338 | */ | ||
339 | void *buffer_start; | ||
340 | unsigned int buffer_size; | ||
341 | |||
342 | /* | ||
343 | * DMA address of beginning of this object, returned | ||
344 | * by pci_alloc_consistent(). | ||
345 | */ | ||
346 | dma_addr_t dma_addr; | ||
347 | |||
348 | /* Pointer to the associated pci device structure */ | ||
349 | struct pci_dev *pci_dev; | ||
350 | |||
332 | /* Pointer for the SAA9730 LAN controller register set. */ | 351 | /* Pointer for the SAA9730 LAN controller register set. */ |
333 | t_lan_saa9730_regmap *lan_saa9730_regs; | 352 | t_lan_saa9730_regmap *lan_saa9730_regs; |
334 | 353 | ||
335 | /* Pointer to the SAA9730 EVM register. */ | 354 | /* Pointer to the SAA9730 EVM register. */ |
336 | t_evm_saa9730_regmap *evm_saa9730_regs; | 355 | t_evm_saa9730_regmap *evm_saa9730_regs; |
337 | 356 | ||
338 | /* TRUE if the next buffer to write is RxBuffA, FALSE if RxBuffB. */ | ||
339 | unsigned char NextRcvToUseIsA; | ||
340 | /* Rcv buffer Index. */ | 357 | /* Rcv buffer Index. */ |
341 | unsigned char NextRcvPacketIndex; | 358 | unsigned char NextRcvPacketIndex; |
359 | /* Next buffer index. */ | ||
360 | unsigned char NextRcvBufferIndex; | ||
342 | 361 | ||
343 | /* Index of next packet to use in that buffer. */ | 362 | /* Index of next packet to use in that buffer. */ |
344 | unsigned char NextTxmPacketIndex; | 363 | unsigned char NextTxmPacketIndex; |
@@ -353,13 +372,8 @@ struct lan_saa9730_private { | |||
353 | unsigned char DmaRcvPackets; | 372 | unsigned char DmaRcvPackets; |
354 | unsigned char DmaTxmPackets; | 373 | unsigned char DmaTxmPackets; |
355 | 374 | ||
356 | unsigned char RcvAIndex; /* index into RcvBufferSpace[] for Blk A */ | 375 | void *TxmBuffer[LAN_SAA9730_BUFFERS][LAN_SAA9730_TXM_Q_SIZE]; |
357 | unsigned char RcvBIndex; /* index into RcvBufferSpace[] for Blk B */ | 376 | void *RcvBuffer[LAN_SAA9730_BUFFERS][LAN_SAA9730_RCV_Q_SIZE]; |
358 | |||
359 | unsigned int | ||
360 | TxmBuffer[LAN_SAA9730_BUFFERS][LAN_SAA9730_TXM_Q_SIZE]; | ||
361 | unsigned int | ||
362 | RcvBuffer[LAN_SAA9730_BUFFERS][LAN_SAA9730_RCV_Q_SIZE]; | ||
363 | unsigned int TxBufferFree[LAN_SAA9730_BUFFERS]; | 377 | unsigned int TxBufferFree[LAN_SAA9730_BUFFERS]; |
364 | 378 | ||
365 | unsigned char PhysicalAddress[LAN_SAA9730_CAM_ENTRIES][6]; | 379 | unsigned char PhysicalAddress[LAN_SAA9730_CAM_ENTRIES][6]; |
diff --git a/drivers/net/smc91x.c b/drivers/net/smc91x.c index c91e2e81f131..28bf2e69eb5e 100644 --- a/drivers/net/smc91x.c +++ b/drivers/net/smc91x.c | |||
@@ -155,6 +155,12 @@ MODULE_LICENSE("GPL"); | |||
155 | #define MEMORY_WAIT_TIME 16 | 155 | #define MEMORY_WAIT_TIME 16 |
156 | 156 | ||
157 | /* | 157 | /* |
158 | * The maximum number of processing loops allowed for each call to the | ||
159 | * IRQ handler. | ||
160 | */ | ||
161 | #define MAX_IRQ_LOOPS 8 | ||
162 | |||
163 | /* | ||
158 | * This selects whether TX packets are sent one by one to the SMC91x internal | 164 | * This selects whether TX packets are sent one by one to the SMC91x internal |
159 | * memory and throttled until transmission completes. This may prevent | 165 | * memory and throttled until transmission completes. This may prevent |
160 | * RX overruns a litle by keeping much of the memory free for RX packets | 166 | * RX overruns a litle by keeping much of the memory free for RX packets |
@@ -684,7 +690,6 @@ static void smc_hardware_send_pkt(unsigned long data) | |||
684 | 690 | ||
685 | /* queue the packet for TX */ | 691 | /* queue the packet for TX */ |
686 | SMC_SET_MMU_CMD(MC_ENQUEUE); | 692 | SMC_SET_MMU_CMD(MC_ENQUEUE); |
687 | SMC_ACK_INT(IM_TX_EMPTY_INT); | ||
688 | smc_special_unlock(&lp->lock); | 693 | smc_special_unlock(&lp->lock); |
689 | 694 | ||
690 | dev->trans_start = jiffies; | 695 | dev->trans_start = jiffies; |
@@ -1207,6 +1212,7 @@ static void smc_phy_configure(void *data) | |||
1207 | smc_phy_check_media(dev, 1); | 1212 | smc_phy_check_media(dev, 1); |
1208 | 1213 | ||
1209 | smc_phy_configure_exit: | 1214 | smc_phy_configure_exit: |
1215 | SMC_SELECT_BANK(2); | ||
1210 | spin_unlock_irq(&lp->lock); | 1216 | spin_unlock_irq(&lp->lock); |
1211 | lp->work_pending = 0; | 1217 | lp->work_pending = 0; |
1212 | } | 1218 | } |
@@ -1305,7 +1311,7 @@ static irqreturn_t smc_interrupt(int irq, void *dev_id, struct pt_regs *regs) | |||
1305 | SMC_SET_INT_MASK(0); | 1311 | SMC_SET_INT_MASK(0); |
1306 | 1312 | ||
1307 | /* set a timeout value, so I don't stay here forever */ | 1313 | /* set a timeout value, so I don't stay here forever */ |
1308 | timeout = 8; | 1314 | timeout = MAX_IRQ_LOOPS; |
1309 | 1315 | ||
1310 | do { | 1316 | do { |
1311 | status = SMC_GET_INT(); | 1317 | status = SMC_GET_INT(); |
@@ -1372,10 +1378,13 @@ static irqreturn_t smc_interrupt(int irq, void *dev_id, struct pt_regs *regs) | |||
1372 | /* restore register states */ | 1378 | /* restore register states */ |
1373 | SMC_SET_PTR(saved_pointer); | 1379 | SMC_SET_PTR(saved_pointer); |
1374 | SMC_SET_INT_MASK(mask); | 1380 | SMC_SET_INT_MASK(mask); |
1375 | |||
1376 | spin_unlock(&lp->lock); | 1381 | spin_unlock(&lp->lock); |
1377 | 1382 | ||
1378 | DBG(3, "%s: Interrupt done (%d loops)\n", dev->name, 8-timeout); | 1383 | if (timeout == MAX_IRQ_LOOPS) |
1384 | PRINTK("%s: spurious interrupt (mask = 0x%02x)\n", | ||
1385 | dev->name, mask); | ||
1386 | DBG(3, "%s: Interrupt done (%d loops)\n", | ||
1387 | dev->name, MAX_IRQ_LOOPS - timeout); | ||
1379 | 1388 | ||
1380 | /* | 1389 | /* |
1381 | * We return IRQ_HANDLED unconditionally here even if there was | 1390 | * We return IRQ_HANDLED unconditionally here even if there was |
diff --git a/drivers/net/wan/hdlc_cisco.c b/drivers/net/wan/hdlc_cisco.c index a01efa6d5c62..1fd04662c4fc 100644 --- a/drivers/net/wan/hdlc_cisco.c +++ b/drivers/net/wan/hdlc_cisco.c | |||
@@ -192,7 +192,9 @@ static int cisco_rx(struct sk_buff *skb) | |||
192 | "uptime %ud%uh%um%us)\n", | 192 | "uptime %ud%uh%um%us)\n", |
193 | dev->name, days, hrs, | 193 | dev->name, days, hrs, |
194 | min, sec); | 194 | min, sec); |
195 | #if 0 | ||
195 | netif_carrier_on(dev); | 196 | netif_carrier_on(dev); |
197 | #endif | ||
196 | hdlc->state.cisco.up = 1; | 198 | hdlc->state.cisco.up = 1; |
197 | } | 199 | } |
198 | } | 200 | } |
@@ -225,7 +227,9 @@ static void cisco_timer(unsigned long arg) | |||
225 | hdlc->state.cisco.settings.timeout * HZ)) { | 227 | hdlc->state.cisco.settings.timeout * HZ)) { |
226 | hdlc->state.cisco.up = 0; | 228 | hdlc->state.cisco.up = 0; |
227 | printk(KERN_INFO "%s: Link down\n", dev->name); | 229 | printk(KERN_INFO "%s: Link down\n", dev->name); |
230 | #if 0 | ||
228 | netif_carrier_off(dev); | 231 | netif_carrier_off(dev); |
232 | #endif | ||
229 | } | 233 | } |
230 | 234 | ||
231 | cisco_keepalive_send(dev, CISCO_KEEPALIVE_REQ, | 235 | cisco_keepalive_send(dev, CISCO_KEEPALIVE_REQ, |
@@ -261,8 +265,10 @@ static void cisco_stop(struct net_device *dev) | |||
261 | { | 265 | { |
262 | hdlc_device *hdlc = dev_to_hdlc(dev); | 266 | hdlc_device *hdlc = dev_to_hdlc(dev); |
263 | del_timer_sync(&hdlc->state.cisco.timer); | 267 | del_timer_sync(&hdlc->state.cisco.timer); |
268 | #if 0 | ||
264 | if (netif_carrier_ok(dev)) | 269 | if (netif_carrier_ok(dev)) |
265 | netif_carrier_off(dev); | 270 | netif_carrier_off(dev); |
271 | #endif | ||
266 | hdlc->state.cisco.up = 0; | 272 | hdlc->state.cisco.up = 0; |
267 | hdlc->state.cisco.request_sent = 0; | 273 | hdlc->state.cisco.request_sent = 0; |
268 | } | 274 | } |
diff --git a/drivers/net/wan/hdlc_fr.c b/drivers/net/wan/hdlc_fr.c index e1601d35dced..523afe17564e 100644 --- a/drivers/net/wan/hdlc_fr.c +++ b/drivers/net/wan/hdlc_fr.c | |||
@@ -545,8 +545,10 @@ static void fr_set_link_state(int reliable, struct net_device *dev) | |||
545 | 545 | ||
546 | hdlc->state.fr.reliable = reliable; | 546 | hdlc->state.fr.reliable = reliable; |
547 | if (reliable) { | 547 | if (reliable) { |
548 | #if 0 | ||
548 | if (!netif_carrier_ok(dev)) | 549 | if (!netif_carrier_ok(dev)) |
549 | netif_carrier_on(dev); | 550 | netif_carrier_on(dev); |
551 | #endif | ||
550 | 552 | ||
551 | hdlc->state.fr.n391cnt = 0; /* Request full status */ | 553 | hdlc->state.fr.n391cnt = 0; /* Request full status */ |
552 | hdlc->state.fr.dce_changed = 1; | 554 | hdlc->state.fr.dce_changed = 1; |
@@ -560,8 +562,10 @@ static void fr_set_link_state(int reliable, struct net_device *dev) | |||
560 | } | 562 | } |
561 | } | 563 | } |
562 | } else { | 564 | } else { |
565 | #if 0 | ||
563 | if (netif_carrier_ok(dev)) | 566 | if (netif_carrier_ok(dev)) |
564 | netif_carrier_off(dev); | 567 | netif_carrier_off(dev); |
568 | #endif | ||
565 | 569 | ||
566 | while (pvc) { /* Deactivate all PVCs */ | 570 | while (pvc) { /* Deactivate all PVCs */ |
567 | pvc_carrier(0, pvc); | 571 | pvc_carrier(0, pvc); |
diff --git a/drivers/net/wan/hdlc_generic.c b/drivers/net/wan/hdlc_generic.c index cdd4c09c2d90..46cef8f92133 100644 --- a/drivers/net/wan/hdlc_generic.c +++ b/drivers/net/wan/hdlc_generic.c | |||
@@ -79,11 +79,13 @@ static void __hdlc_set_carrier_on(struct net_device *dev) | |||
79 | hdlc_device *hdlc = dev_to_hdlc(dev); | 79 | hdlc_device *hdlc = dev_to_hdlc(dev); |
80 | if (hdlc->proto.start) | 80 | if (hdlc->proto.start) |
81 | return hdlc->proto.start(dev); | 81 | return hdlc->proto.start(dev); |
82 | #if 0 | ||
82 | #ifdef DEBUG_LINK | 83 | #ifdef DEBUG_LINK |
83 | if (netif_carrier_ok(dev)) | 84 | if (netif_carrier_ok(dev)) |
84 | printk(KERN_ERR "hdlc_set_carrier_on(): already on\n"); | 85 | printk(KERN_ERR "hdlc_set_carrier_on(): already on\n"); |
85 | #endif | 86 | #endif |
86 | netif_carrier_on(dev); | 87 | netif_carrier_on(dev); |
88 | #endif | ||
87 | } | 89 | } |
88 | 90 | ||
89 | 91 | ||
@@ -94,11 +96,13 @@ static void __hdlc_set_carrier_off(struct net_device *dev) | |||
94 | if (hdlc->proto.stop) | 96 | if (hdlc->proto.stop) |
95 | return hdlc->proto.stop(dev); | 97 | return hdlc->proto.stop(dev); |
96 | 98 | ||
99 | #if 0 | ||
97 | #ifdef DEBUG_LINK | 100 | #ifdef DEBUG_LINK |
98 | if (!netif_carrier_ok(dev)) | 101 | if (!netif_carrier_ok(dev)) |
99 | printk(KERN_ERR "hdlc_set_carrier_off(): already off\n"); | 102 | printk(KERN_ERR "hdlc_set_carrier_off(): already off\n"); |
100 | #endif | 103 | #endif |
101 | netif_carrier_off(dev); | 104 | netif_carrier_off(dev); |
105 | #endif | ||
102 | } | 106 | } |
103 | 107 | ||
104 | 108 | ||
@@ -294,8 +298,10 @@ int register_hdlc_device(struct net_device *dev) | |||
294 | if (result != 0) | 298 | if (result != 0) |
295 | return -EIO; | 299 | return -EIO; |
296 | 300 | ||
301 | #if 0 | ||
297 | if (netif_carrier_ok(dev)) | 302 | if (netif_carrier_ok(dev)) |
298 | netif_carrier_off(dev); /* no carrier until DCD goes up */ | 303 | netif_carrier_off(dev); /* no carrier until DCD goes up */ |
304 | #endif | ||
299 | 305 | ||
300 | return 0; | 306 | return 0; |
301 | } | 307 | } |
diff --git a/drivers/net/wireless/hermes.c b/drivers/net/wireless/hermes.c index 579480dad374..346c6febb033 100644 --- a/drivers/net/wireless/hermes.c +++ b/drivers/net/wireless/hermes.c | |||
@@ -398,7 +398,7 @@ static int hermes_bap_seek(hermes_t *hw, int bap, u16 id, u16 offset) | |||
398 | * | 398 | * |
399 | * Returns: < 0 on internal failure (errno), 0 on success, > 0 on error from firmware | 399 | * Returns: < 0 on internal failure (errno), 0 on success, > 0 on error from firmware |
400 | */ | 400 | */ |
401 | int hermes_bap_pread(hermes_t *hw, int bap, void *buf, unsigned len, | 401 | int hermes_bap_pread(hermes_t *hw, int bap, void *buf, int len, |
402 | u16 id, u16 offset) | 402 | u16 id, u16 offset) |
403 | { | 403 | { |
404 | int dreg = bap ? HERMES_DATA1 : HERMES_DATA0; | 404 | int dreg = bap ? HERMES_DATA1 : HERMES_DATA0; |
@@ -424,7 +424,7 @@ int hermes_bap_pread(hermes_t *hw, int bap, void *buf, unsigned len, | |||
424 | * | 424 | * |
425 | * Returns: < 0 on internal failure (errno), 0 on success, > 0 on error from firmware | 425 | * Returns: < 0 on internal failure (errno), 0 on success, > 0 on error from firmware |
426 | */ | 426 | */ |
427 | int hermes_bap_pwrite(hermes_t *hw, int bap, const void *buf, unsigned len, | 427 | int hermes_bap_pwrite(hermes_t *hw, int bap, const void *buf, int len, |
428 | u16 id, u16 offset) | 428 | u16 id, u16 offset) |
429 | { | 429 | { |
430 | int dreg = bap ? HERMES_DATA1 : HERMES_DATA0; | 430 | int dreg = bap ? HERMES_DATA1 : HERMES_DATA0; |
@@ -450,7 +450,7 @@ int hermes_bap_pwrite(hermes_t *hw, int bap, const void *buf, unsigned len, | |||
450 | * | 450 | * |
451 | * Returns: < 0 on internal failure (errno), 0 on success, > 0 on error from firmware | 451 | * Returns: < 0 on internal failure (errno), 0 on success, > 0 on error from firmware |
452 | */ | 452 | */ |
453 | int hermes_bap_pwrite_pad(hermes_t *hw, int bap, const void *buf, unsigned data_len, unsigned len, | 453 | int hermes_bap_pwrite_pad(hermes_t *hw, int bap, const void *buf, unsigned data_len, int len, |
454 | u16 id, u16 offset) | 454 | u16 id, u16 offset) |
455 | { | 455 | { |
456 | int dreg = bap ? HERMES_DATA1 : HERMES_DATA0; | 456 | int dreg = bap ? HERMES_DATA1 : HERMES_DATA0; |
diff --git a/drivers/net/wireless/hermes.h b/drivers/net/wireless/hermes.h index a6bd472d75d4..7644f72a9f4e 100644 --- a/drivers/net/wireless/hermes.h +++ b/drivers/net/wireless/hermes.h | |||
@@ -372,12 +372,12 @@ int hermes_docmd_wait(hermes_t *hw, u16 cmd, u16 parm0, | |||
372 | struct hermes_response *resp); | 372 | struct hermes_response *resp); |
373 | int hermes_allocate(hermes_t *hw, u16 size, u16 *fid); | 373 | int hermes_allocate(hermes_t *hw, u16 size, u16 *fid); |
374 | 374 | ||
375 | int hermes_bap_pread(hermes_t *hw, int bap, void *buf, unsigned len, | 375 | int hermes_bap_pread(hermes_t *hw, int bap, void *buf, int len, |
376 | u16 id, u16 offset); | 376 | u16 id, u16 offset); |
377 | int hermes_bap_pwrite(hermes_t *hw, int bap, const void *buf, unsigned len, | 377 | int hermes_bap_pwrite(hermes_t *hw, int bap, const void *buf, int len, |
378 | u16 id, u16 offset); | 378 | u16 id, u16 offset); |
379 | int hermes_bap_pwrite_pad(hermes_t *hw, int bap, const void *buf, | 379 | int hermes_bap_pwrite_pad(hermes_t *hw, int bap, const void *buf, |
380 | unsigned data_len, unsigned len, u16 id, u16 offset); | 380 | unsigned data_len, int len, u16 id, u16 offset); |
381 | int hermes_read_ltv(hermes_t *hw, int bap, u16 rid, unsigned buflen, | 381 | int hermes_read_ltv(hermes_t *hw, int bap, u16 rid, unsigned buflen, |
382 | u16 *length, void *buf); | 382 | u16 *length, void *buf); |
383 | int hermes_write_ltv(hermes_t *hw, int bap, u16 rid, | 383 | int hermes_write_ltv(hermes_t *hw, int bap, u16 rid, |
diff --git a/drivers/net/wireless/i82593.h b/drivers/net/wireless/i82593.h index 33acb8add4d6..afac5c7a323d 100644 --- a/drivers/net/wireless/i82593.h +++ b/drivers/net/wireless/i82593.h | |||
@@ -7,11 +7,16 @@ | |||
7 | * | 7 | * |
8 | * Copyright 1994, Anders Klemets <klemets@it.kth.se> | 8 | * Copyright 1994, Anders Klemets <klemets@it.kth.se> |
9 | * | 9 | * |
10 | * This software may be freely distributed for noncommercial purposes | ||
11 | * as long as this notice is retained. | ||
12 | * | ||
13 | * HISTORY | 10 | * HISTORY |
14 | * i82593.h,v | 11 | * i82593.h,v |
12 | * Revision 1.4 2005/11/4 09:15:00 baroniunas | ||
13 | * Modified copyright with permission of author as follows: | ||
14 | * | ||
15 | * "If I82539.H is the only file with my copyright statement | ||
16 | * that is included in the Source Forge project, then you have | ||
17 | * my approval to change the copyright statement to be a GPL | ||
18 | * license, in the way you proposed on October 10." | ||
19 | * | ||
15 | * Revision 1.1 1996/07/17 15:23:12 root | 20 | * Revision 1.1 1996/07/17 15:23:12 root |
16 | * Initial revision | 21 | * Initial revision |
17 | * | 22 | * |
diff --git a/drivers/net/wireless/ipw2100.c b/drivers/net/wireless/ipw2100.c index a2e6214169e9..77d2a21d4cd0 100644 --- a/drivers/net/wireless/ipw2100.c +++ b/drivers/net/wireless/ipw2100.c | |||
@@ -6344,7 +6344,8 @@ static struct net_device *ipw2100_alloc_device(struct pci_dev *pci_dev, | |||
6344 | dev->ethtool_ops = &ipw2100_ethtool_ops; | 6344 | dev->ethtool_ops = &ipw2100_ethtool_ops; |
6345 | dev->tx_timeout = ipw2100_tx_timeout; | 6345 | dev->tx_timeout = ipw2100_tx_timeout; |
6346 | dev->wireless_handlers = &ipw2100_wx_handler_def; | 6346 | dev->wireless_handlers = &ipw2100_wx_handler_def; |
6347 | dev->get_wireless_stats = ipw2100_wx_wireless_stats; | 6347 | priv->wireless_data.ieee80211 = priv->ieee; |
6348 | dev->wireless_data = &priv->wireless_data; | ||
6348 | dev->set_mac_address = ipw2100_set_address; | 6349 | dev->set_mac_address = ipw2100_set_address; |
6349 | dev->watchdog_timeo = 3 * HZ; | 6350 | dev->watchdog_timeo = 3 * HZ; |
6350 | dev->irq = 0; | 6351 | dev->irq = 0; |
@@ -7178,6 +7179,11 @@ static int ipw2100_wx_get_range(struct net_device *dev, | |||
7178 | } | 7179 | } |
7179 | range->num_frequency = val; | 7180 | range->num_frequency = val; |
7180 | 7181 | ||
7182 | /* Event capability (kernel + driver) */ | ||
7183 | range->event_capa[0] = (IW_EVENT_CAPA_K_0 | | ||
7184 | IW_EVENT_CAPA_MASK(SIOCGIWAP)); | ||
7185 | range->event_capa[1] = IW_EVENT_CAPA_K_1; | ||
7186 | |||
7181 | IPW_DEBUG_WX("GET Range\n"); | 7187 | IPW_DEBUG_WX("GET Range\n"); |
7182 | 7188 | ||
7183 | return 0; | 7189 | return 0; |
@@ -8446,16 +8452,6 @@ static iw_handler ipw2100_private_handler[] = { | |||
8446 | #endif /* CONFIG_IPW2100_MONITOR */ | 8452 | #endif /* CONFIG_IPW2100_MONITOR */ |
8447 | }; | 8453 | }; |
8448 | 8454 | ||
8449 | static struct iw_handler_def ipw2100_wx_handler_def = { | ||
8450 | .standard = ipw2100_wx_handlers, | ||
8451 | .num_standard = sizeof(ipw2100_wx_handlers) / sizeof(iw_handler), | ||
8452 | .num_private = sizeof(ipw2100_private_handler) / sizeof(iw_handler), | ||
8453 | .num_private_args = sizeof(ipw2100_private_args) / | ||
8454 | sizeof(struct iw_priv_args), | ||
8455 | .private = (iw_handler *) ipw2100_private_handler, | ||
8456 | .private_args = (struct iw_priv_args *)ipw2100_private_args, | ||
8457 | }; | ||
8458 | |||
8459 | /* | 8455 | /* |
8460 | * Get wireless statistics. | 8456 | * Get wireless statistics. |
8461 | * Called by /proc/net/wireless | 8457 | * Called by /proc/net/wireless |
@@ -8597,6 +8593,17 @@ static struct iw_statistics *ipw2100_wx_wireless_stats(struct net_device *dev) | |||
8597 | return (struct iw_statistics *)NULL; | 8593 | return (struct iw_statistics *)NULL; |
8598 | } | 8594 | } |
8599 | 8595 | ||
8596 | static struct iw_handler_def ipw2100_wx_handler_def = { | ||
8597 | .standard = ipw2100_wx_handlers, | ||
8598 | .num_standard = sizeof(ipw2100_wx_handlers) / sizeof(iw_handler), | ||
8599 | .num_private = sizeof(ipw2100_private_handler) / sizeof(iw_handler), | ||
8600 | .num_private_args = sizeof(ipw2100_private_args) / | ||
8601 | sizeof(struct iw_priv_args), | ||
8602 | .private = (iw_handler *) ipw2100_private_handler, | ||
8603 | .private_args = (struct iw_priv_args *)ipw2100_private_args, | ||
8604 | .get_wireless_stats = ipw2100_wx_wireless_stats, | ||
8605 | }; | ||
8606 | |||
8600 | static void ipw2100_wx_event_work(struct ipw2100_priv *priv) | 8607 | static void ipw2100_wx_event_work(struct ipw2100_priv *priv) |
8601 | { | 8608 | { |
8602 | union iwreq_data wrqu; | 8609 | union iwreq_data wrqu; |
diff --git a/drivers/net/wireless/ipw2100.h b/drivers/net/wireless/ipw2100.h index 140fdf2a0a09..7c65b10bb164 100644 --- a/drivers/net/wireless/ipw2100.h +++ b/drivers/net/wireless/ipw2100.h | |||
@@ -571,6 +571,8 @@ struct ipw2100_priv { | |||
571 | struct net_device *net_dev; | 571 | struct net_device *net_dev; |
572 | struct iw_statistics wstats; | 572 | struct iw_statistics wstats; |
573 | 573 | ||
574 | struct iw_public_data wireless_data; | ||
575 | |||
574 | struct tasklet_struct irq_tasklet; | 576 | struct tasklet_struct irq_tasklet; |
575 | 577 | ||
576 | struct workqueue_struct *workqueue; | 578 | struct workqueue_struct *workqueue; |
diff --git a/drivers/net/wireless/ipw2200.c b/drivers/net/wireless/ipw2200.c index b0d195d1721a..5e7c7e944c9d 100644 --- a/drivers/net/wireless/ipw2200.c +++ b/drivers/net/wireless/ipw2200.c | |||
@@ -1110,8 +1110,7 @@ static struct ipw_fw_error *ipw_alloc_error_log(struct ipw_priv *priv) | |||
1110 | error->elem_len = elem_len; | 1110 | error->elem_len = elem_len; |
1111 | error->log_len = log_len; | 1111 | error->log_len = log_len; |
1112 | error->elem = (struct ipw_error_elem *)error->payload; | 1112 | error->elem = (struct ipw_error_elem *)error->payload; |
1113 | error->log = (struct ipw_event *)(error->elem + | 1113 | error->log = (struct ipw_event *)(error->elem + elem_len); |
1114 | (sizeof(*error->elem) * elem_len)); | ||
1115 | 1114 | ||
1116 | ipw_capture_event_log(priv, log_len, error->log); | 1115 | ipw_capture_event_log(priv, log_len, error->log); |
1117 | 1116 | ||
@@ -8926,6 +8925,10 @@ static int ipw_request_direct_scan(struct ipw_priv *priv, char *essid, | |||
8926 | struct ipw_scan_request_ext scan; | 8925 | struct ipw_scan_request_ext scan; |
8927 | int err = 0, scan_type; | 8926 | int err = 0, scan_type; |
8928 | 8927 | ||
8928 | if (!(priv->status & STATUS_INIT) || | ||
8929 | (priv->status & STATUS_EXIT_PENDING)) | ||
8930 | return 0; | ||
8931 | |||
8929 | down(&priv->sem); | 8932 | down(&priv->sem); |
8930 | 8933 | ||
8931 | if (priv->status & STATUS_RF_KILL_MASK) { | 8934 | if (priv->status & STATUS_RF_KILL_MASK) { |
diff --git a/drivers/net/wireless/prism54/isl_38xx.c b/drivers/net/wireless/prism54/isl_38xx.c index 109a96d90007..23deee69974b 100644 --- a/drivers/net/wireless/prism54/isl_38xx.c +++ b/drivers/net/wireless/prism54/isl_38xx.c | |||
@@ -164,12 +164,12 @@ isl38xx_trigger_device(int asleep, void __iomem *device_base) | |||
164 | /* assert the Wakeup interrupt in the Device Interrupt Register */ | 164 | /* assert the Wakeup interrupt in the Device Interrupt Register */ |
165 | isl38xx_w32_flush(device_base, ISL38XX_DEV_INT_WAKEUP, | 165 | isl38xx_w32_flush(device_base, ISL38XX_DEV_INT_WAKEUP, |
166 | ISL38XX_DEV_INT_REG); | 166 | ISL38XX_DEV_INT_REG); |
167 | |||
168 | #if VERBOSE > SHOW_ERROR_MESSAGES | ||
167 | udelay(ISL38XX_WRITEIO_DELAY); | 169 | udelay(ISL38XX_WRITEIO_DELAY); |
168 | 170 | ||
169 | /* perform another read on the Device Status Register */ | 171 | /* perform another read on the Device Status Register */ |
170 | reg = readl(device_base + ISL38XX_CTRL_STAT_REG); | 172 | reg = readl(device_base + ISL38XX_CTRL_STAT_REG); |
171 | |||
172 | #if VERBOSE > SHOW_ERROR_MESSAGES | ||
173 | do_gettimeofday(¤t_time); | 173 | do_gettimeofday(¤t_time); |
174 | DEBUG(SHOW_TRACING, "%08li.%08li Device register read %08x\n", | 174 | DEBUG(SHOW_TRACING, "%08li.%08li Device register read %08x\n", |
175 | current_time.tv_sec, (long)current_time.tv_usec, reg); | 175 | current_time.tv_sec, (long)current_time.tv_usec, reg); |
diff --git a/drivers/parisc/iosapic.c b/drivers/parisc/iosapic.c index a39fbfef789a..19657efa8dc3 100644 --- a/drivers/parisc/iosapic.c +++ b/drivers/parisc/iosapic.c | |||
@@ -700,6 +700,28 @@ static unsigned int iosapic_startup_irq(unsigned int irq) | |||
700 | return 0; | 700 | return 0; |
701 | } | 701 | } |
702 | 702 | ||
703 | #ifdef CONFIG_SMP | ||
704 | static void iosapic_set_affinity_irq(unsigned int irq, cpumask_t dest) | ||
705 | { | ||
706 | struct vector_info *vi = iosapic_get_vector(irq); | ||
707 | u32 d0, d1, dummy_d0; | ||
708 | unsigned long flags; | ||
709 | |||
710 | if (cpu_check_affinity(irq, &dest)) | ||
711 | return; | ||
712 | |||
713 | vi->txn_addr = txn_affinity_addr(irq, first_cpu(dest)); | ||
714 | |||
715 | spin_lock_irqsave(&iosapic_lock, flags); | ||
716 | /* d1 contains the destination CPU, so only want to set that | ||
717 | * entry */ | ||
718 | iosapic_rd_irt_entry(vi, &d0, &d1); | ||
719 | iosapic_set_irt_data(vi, &dummy_d0, &d1); | ||
720 | iosapic_wr_irt_entry(vi, d0, d1); | ||
721 | spin_unlock_irqrestore(&iosapic_lock, flags); | ||
722 | } | ||
723 | #endif | ||
724 | |||
703 | static struct hw_interrupt_type iosapic_interrupt_type = { | 725 | static struct hw_interrupt_type iosapic_interrupt_type = { |
704 | .typename = "IO-SAPIC-level", | 726 | .typename = "IO-SAPIC-level", |
705 | .startup = iosapic_startup_irq, | 727 | .startup = iosapic_startup_irq, |
@@ -708,7 +730,9 @@ static struct hw_interrupt_type iosapic_interrupt_type = { | |||
708 | .disable = iosapic_disable_irq, | 730 | .disable = iosapic_disable_irq, |
709 | .ack = no_ack_irq, | 731 | .ack = no_ack_irq, |
710 | .end = iosapic_end_irq, | 732 | .end = iosapic_end_irq, |
711 | // .set_affinity = iosapic_set_affinity_irq, | 733 | #ifdef CONFIG_SMP |
734 | .set_affinity = iosapic_set_affinity_irq, | ||
735 | #endif | ||
712 | }; | 736 | }; |
713 | 737 | ||
714 | int iosapic_fixup_irq(void *isi_obj, struct pci_dev *pcidev) | 738 | int iosapic_fixup_irq(void *isi_obj, struct pci_dev *pcidev) |
diff --git a/drivers/parisc/superio.c b/drivers/parisc/superio.c index bab3bcabcb6e..d14888e149bb 100644 --- a/drivers/parisc/superio.c +++ b/drivers/parisc/superio.c | |||
@@ -24,6 +24,9 @@ | |||
24 | * Major changes to get basic interrupt infrastructure working to | 24 | * Major changes to get basic interrupt infrastructure working to |
25 | * hopefully be able to support all SuperIO devices. Currently | 25 | * hopefully be able to support all SuperIO devices. Currently |
26 | * works with serial. -- John Marvin <jsm@fc.hp.com> | 26 | * works with serial. -- John Marvin <jsm@fc.hp.com> |
27 | * | ||
28 | * Converted superio_init() to be a PCI_FIXUP_FINAL callee. | ||
29 | * -- Kyle McMartin <kyle@parisc-linux.org> | ||
27 | */ | 30 | */ |
28 | 31 | ||
29 | 32 | ||
@@ -141,10 +144,10 @@ superio_interrupt(int parent_irq, void *devp, struct pt_regs *regs) | |||
141 | } | 144 | } |
142 | 145 | ||
143 | /* Initialize Super I/O device */ | 146 | /* Initialize Super I/O device */ |
144 | 147 | static void | |
145 | static void __devinit | 148 | superio_init(struct pci_dev *pcidev) |
146 | superio_init(struct superio_device *sio) | ||
147 | { | 149 | { |
150 | struct superio_device *sio = &sio_dev; | ||
148 | struct pci_dev *pdev = sio->lio_pdev; | 151 | struct pci_dev *pdev = sio->lio_pdev; |
149 | u16 word; | 152 | u16 word; |
150 | 153 | ||
@@ -160,8 +163,8 @@ superio_init(struct superio_device *sio) | |||
160 | /* ...then properly fixup the USB to point at suckyio PIC */ | 163 | /* ...then properly fixup the USB to point at suckyio PIC */ |
161 | sio->usb_pdev->irq = superio_fixup_irq(sio->usb_pdev); | 164 | sio->usb_pdev->irq = superio_fixup_irq(sio->usb_pdev); |
162 | 165 | ||
163 | printk (KERN_INFO "SuperIO: Found NS87560 Legacy I/O device at %s (IRQ %i) \n", | 166 | printk(KERN_INFO "SuperIO: Found NS87560 Legacy I/O device at %s (IRQ %i) \n", |
164 | pci_name(pdev),pdev->irq); | 167 | pci_name(pdev), pdev->irq); |
165 | 168 | ||
166 | pci_read_config_dword (pdev, SIO_SP1BAR, &sio->sp1_base); | 169 | pci_read_config_dword (pdev, SIO_SP1BAR, &sio->sp1_base); |
167 | sio->sp1_base &= ~1; | 170 | sio->sp1_base &= ~1; |
@@ -274,7 +277,7 @@ superio_init(struct superio_device *sio) | |||
274 | 277 | ||
275 | sio->suckyio_irq_enabled = 1; | 278 | sio->suckyio_irq_enabled = 1; |
276 | } | 279 | } |
277 | 280 | DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_NS, PCI_DEVICE_ID_NS_87560_LIO, superio_init); | |
278 | 281 | ||
279 | static void superio_disable_irq(unsigned int irq) | 282 | static void superio_disable_irq(unsigned int irq) |
280 | { | 283 | { |
@@ -452,8 +455,10 @@ static void superio_fixup_pci(struct pci_dev *pdev) | |||
452 | DECLARE_PCI_FIXUP_EARLY(PCI_VENDOR_ID_NS, PCI_DEVICE_ID_NS_87415, superio_fixup_pci); | 455 | DECLARE_PCI_FIXUP_EARLY(PCI_VENDOR_ID_NS, PCI_DEVICE_ID_NS_87415, superio_fixup_pci); |
453 | 456 | ||
454 | 457 | ||
455 | static int __devinit superio_probe(struct pci_dev *dev, const struct pci_device_id *id) | 458 | static int __devinit |
459 | superio_probe(struct pci_dev *dev, const struct pci_device_id *id) | ||
456 | { | 460 | { |
461 | struct superio_device *sio = &sio_dev; | ||
457 | 462 | ||
458 | /* | 463 | /* |
459 | ** superio_probe(00:0e.0) ven 0x100b dev 0x2 sv 0x0 sd 0x0 class 0x1018a | 464 | ** superio_probe(00:0e.0) ven 0x100b dev 0x2 sv 0x0 sd 0x0 class 0x1018a |
@@ -466,7 +471,8 @@ static int __devinit superio_probe(struct pci_dev *dev, const struct pci_device_ | |||
466 | dev->subsystem_vendor, dev->subsystem_device, | 471 | dev->subsystem_vendor, dev->subsystem_device, |
467 | dev->class); | 472 | dev->class); |
468 | 473 | ||
469 | superio_init(&sio_dev); | 474 | if (!sio->suckyio_irq_enabled) |
475 | BUG(); /* Enabled by PCI_FIXUP_FINAL */ | ||
470 | 476 | ||
471 | if (dev->device == PCI_DEVICE_ID_NS_87560_LIO) { /* Function 1 */ | 477 | if (dev->device == PCI_DEVICE_ID_NS_87560_LIO) { /* Function 1 */ |
472 | superio_parport_init(); | 478 | superio_parport_init(); |
@@ -481,19 +487,21 @@ static int __devinit superio_probe(struct pci_dev *dev, const struct pci_device_ | |||
481 | DBG_INIT("superio_probe: WTF? Fire Extinguisher?\n"); | 487 | DBG_INIT("superio_probe: WTF? Fire Extinguisher?\n"); |
482 | } | 488 | } |
483 | 489 | ||
484 | /* Let appropriate other driver claim this device. */ | 490 | /* Let appropriate other driver claim this device. */ |
485 | return -ENODEV; | 491 | return -ENODEV; |
486 | } | 492 | } |
487 | 493 | ||
488 | static struct pci_device_id superio_tbl[] = { | 494 | static struct pci_device_id superio_tbl[] = { |
489 | { PCI_VENDOR_ID_NS, PCI_ANY_ID, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0 }, | 495 | { PCI_DEVICE(PCI_VENDOR_ID_NS, PCI_DEVICE_ID_NS_87560_LIO) }, |
496 | { PCI_DEVICE(PCI_VENDOR_ID_NS, PCI_DEVICE_ID_NS_87560_USB) }, | ||
497 | { PCI_DEVICE(PCI_VENDOR_ID_NS, PCI_DEVICE_ID_NS_87415) }, | ||
490 | { 0, } | 498 | { 0, } |
491 | }; | 499 | }; |
492 | 500 | ||
493 | static struct pci_driver superio_driver = { | 501 | static struct pci_driver superio_driver = { |
494 | .name = "SuperIO", | 502 | .name = "SuperIO", |
495 | .id_table = superio_tbl, | 503 | .id_table = superio_tbl, |
496 | .probe = superio_probe, | 504 | .probe = superio_probe, |
497 | }; | 505 | }; |
498 | 506 | ||
499 | static int __init superio_modinit(void) | 507 | static int __init superio_modinit(void) |
@@ -506,6 +514,5 @@ static void __exit superio_exit(void) | |||
506 | pci_unregister_driver(&superio_driver); | 514 | pci_unregister_driver(&superio_driver); |
507 | } | 515 | } |
508 | 516 | ||
509 | |||
510 | module_init(superio_modinit); | 517 | module_init(superio_modinit); |
511 | module_exit(superio_exit); | 518 | module_exit(superio_exit); |
diff --git a/drivers/s390/char/raw3270.c b/drivers/s390/char/raw3270.c index f5b7d360fc10..1026f2bc3185 100644 --- a/drivers/s390/char/raw3270.c +++ b/drivers/s390/char/raw3270.c | |||
@@ -1179,12 +1179,12 @@ raw3270_create_attributes(struct raw3270 *rp) | |||
1179 | //FIXME: check return code | 1179 | //FIXME: check return code |
1180 | sysfs_create_group(&rp->cdev->dev.kobj, &raw3270_attr_group); | 1180 | sysfs_create_group(&rp->cdev->dev.kobj, &raw3270_attr_group); |
1181 | rp->clttydev = | 1181 | rp->clttydev = |
1182 | class_device_create(class3270, | 1182 | class_device_create(class3270, NULL, |
1183 | MKDEV(IBM_TTY3270_MAJOR, rp->minor), | 1183 | MKDEV(IBM_TTY3270_MAJOR, rp->minor), |
1184 | &rp->cdev->dev, "tty%s", | 1184 | &rp->cdev->dev, "tty%s", |
1185 | rp->cdev->dev.bus_id); | 1185 | rp->cdev->dev.bus_id); |
1186 | rp->cltubdev = | 1186 | rp->cltubdev = |
1187 | class_device_create(class3270, | 1187 | class_device_create(class3270, NULL, |
1188 | MKDEV(IBM_FS3270_MAJOR, rp->minor), | 1188 | MKDEV(IBM_FS3270_MAJOR, rp->minor), |
1189 | &rp->cdev->dev, "tub%s", | 1189 | &rp->cdev->dev, "tub%s", |
1190 | rp->cdev->dev.bus_id); | 1190 | rp->cdev->dev.bus_id); |
diff --git a/drivers/scsi/Kconfig b/drivers/scsi/Kconfig index 84c42c44e04d..20dd85a77813 100644 --- a/drivers/scsi/Kconfig +++ b/drivers/scsi/Kconfig | |||
@@ -497,7 +497,7 @@ config SCSI_ATA_PIIX | |||
497 | If unsure, say N. | 497 | If unsure, say N. |
498 | 498 | ||
499 | config SCSI_SATA_MV | 499 | config SCSI_SATA_MV |
500 | tristate "Marvell SATA support" | 500 | tristate "Marvell SATA support (HIGHLY EXPERIMENTAL)" |
501 | depends on SCSI_SATA && PCI && EXPERIMENTAL | 501 | depends on SCSI_SATA && PCI && EXPERIMENTAL |
502 | help | 502 | help |
503 | This option enables support for the Marvell Serial ATA family. | 503 | This option enables support for the Marvell Serial ATA family. |
diff --git a/drivers/scsi/ahci.c b/drivers/scsi/ahci.c index 894e7113e0b3..83467a05dc8e 100644 --- a/drivers/scsi/ahci.c +++ b/drivers/scsi/ahci.c | |||
@@ -48,7 +48,7 @@ | |||
48 | #include <asm/io.h> | 48 | #include <asm/io.h> |
49 | 49 | ||
50 | #define DRV_NAME "ahci" | 50 | #define DRV_NAME "ahci" |
51 | #define DRV_VERSION "1.01" | 51 | #define DRV_VERSION "1.2" |
52 | 52 | ||
53 | 53 | ||
54 | enum { | 54 | enum { |
@@ -558,23 +558,25 @@ static void ahci_qc_prep(struct ata_queued_cmd *qc) | |||
558 | pp->cmd_slot[0].opts |= cpu_to_le32(n_elem << 16); | 558 | pp->cmd_slot[0].opts |= cpu_to_le32(n_elem << 16); |
559 | } | 559 | } |
560 | 560 | ||
561 | static void ahci_intr_error(struct ata_port *ap, u32 irq_stat) | 561 | static void ahci_restart_port(struct ata_port *ap, u32 irq_stat) |
562 | { | 562 | { |
563 | void __iomem *mmio = ap->host_set->mmio_base; | 563 | void __iomem *mmio = ap->host_set->mmio_base; |
564 | void __iomem *port_mmio = ahci_port_base(mmio, ap->port_no); | 564 | void __iomem *port_mmio = ahci_port_base(mmio, ap->port_no); |
565 | u32 tmp; | 565 | u32 tmp; |
566 | int work; | 566 | int work; |
567 | 567 | ||
568 | printk(KERN_WARNING "ata%u: port reset, " | 568 | if ((ap->device[0].class != ATA_DEV_ATAPI) || |
569 | "p_is %x is %x pis %x cmd %x tf %x ss %x se %x\n", | 569 | ((irq_stat & PORT_IRQ_TF_ERR) == 0)) |
570 | ap->id, | 570 | printk(KERN_WARNING "ata%u: port reset, " |
571 | irq_stat, | 571 | "p_is %x is %x pis %x cmd %x tf %x ss %x se %x\n", |
572 | readl(mmio + HOST_IRQ_STAT), | 572 | ap->id, |
573 | readl(port_mmio + PORT_IRQ_STAT), | 573 | irq_stat, |
574 | readl(port_mmio + PORT_CMD), | 574 | readl(mmio + HOST_IRQ_STAT), |
575 | readl(port_mmio + PORT_TFDATA), | 575 | readl(port_mmio + PORT_IRQ_STAT), |
576 | readl(port_mmio + PORT_SCR_STAT), | 576 | readl(port_mmio + PORT_CMD), |
577 | readl(port_mmio + PORT_SCR_ERR)); | 577 | readl(port_mmio + PORT_TFDATA), |
578 | readl(port_mmio + PORT_SCR_STAT), | ||
579 | readl(port_mmio + PORT_SCR_ERR)); | ||
578 | 580 | ||
579 | /* stop DMA */ | 581 | /* stop DMA */ |
580 | tmp = readl(port_mmio + PORT_CMD); | 582 | tmp = readl(port_mmio + PORT_CMD); |
@@ -632,7 +634,7 @@ static void ahci_eng_timeout(struct ata_port *ap) | |||
632 | printk(KERN_ERR "ata%u: BUG: timeout without command\n", | 634 | printk(KERN_ERR "ata%u: BUG: timeout without command\n", |
633 | ap->id); | 635 | ap->id); |
634 | } else { | 636 | } else { |
635 | ahci_intr_error(ap, readl(port_mmio + PORT_IRQ_STAT)); | 637 | ahci_restart_port(ap, readl(port_mmio + PORT_IRQ_STAT)); |
636 | 638 | ||
637 | /* hack alert! We cannot use the supplied completion | 639 | /* hack alert! We cannot use the supplied completion |
638 | * function from inside the ->eh_strategy_handler() thread. | 640 | * function from inside the ->eh_strategy_handler() thread. |
@@ -677,7 +679,7 @@ static inline int ahci_host_intr(struct ata_port *ap, struct ata_queued_cmd *qc) | |||
677 | err_mask = AC_ERR_HOST_BUS; | 679 | err_mask = AC_ERR_HOST_BUS; |
678 | 680 | ||
679 | /* command processing has stopped due to error; restart */ | 681 | /* command processing has stopped due to error; restart */ |
680 | ahci_intr_error(ap, status); | 682 | ahci_restart_port(ap, status); |
681 | 683 | ||
682 | if (qc) | 684 | if (qc) |
683 | ata_qc_complete(qc, err_mask); | 685 | ata_qc_complete(qc, err_mask); |
diff --git a/drivers/scsi/ata_piix.c b/drivers/scsi/ata_piix.c index 855428ff37e9..333d69dd84ef 100644 --- a/drivers/scsi/ata_piix.c +++ b/drivers/scsi/ata_piix.c | |||
@@ -50,7 +50,7 @@ | |||
50 | #include <linux/libata.h> | 50 | #include <linux/libata.h> |
51 | 51 | ||
52 | #define DRV_NAME "ata_piix" | 52 | #define DRV_NAME "ata_piix" |
53 | #define DRV_VERSION "1.04" | 53 | #define DRV_VERSION "1.05" |
54 | 54 | ||
55 | enum { | 55 | enum { |
56 | PIIX_IOCFG = 0x54, /* IDE I/O configuration register */ | 56 | PIIX_IOCFG = 0x54, /* IDE I/O configuration register */ |
diff --git a/drivers/scsi/ide-scsi.c b/drivers/scsi/ide-scsi.c index e1960d69fb90..4cb1f3ed9100 100644 --- a/drivers/scsi/ide-scsi.c +++ b/drivers/scsi/ide-scsi.c | |||
@@ -784,8 +784,8 @@ static ide_proc_entry_t idescsi_proc[] = { | |||
784 | #endif | 784 | #endif |
785 | 785 | ||
786 | static ide_driver_t idescsi_driver = { | 786 | static ide_driver_t idescsi_driver = { |
787 | .owner = THIS_MODULE, | ||
788 | .gen_driver = { | 787 | .gen_driver = { |
788 | .owner = THIS_MODULE, | ||
789 | .name = "ide-scsi", | 789 | .name = "ide-scsi", |
790 | .bus = &ide_bus_type, | 790 | .bus = &ide_bus_type, |
791 | .probe = ide_scsi_probe, | 791 | .probe = ide_scsi_probe, |
diff --git a/drivers/scsi/libata-core.c b/drivers/scsi/libata-core.c index ba1eb8b38e00..665ae79e1fd6 100644 --- a/drivers/scsi/libata-core.c +++ b/drivers/scsi/libata-core.c | |||
@@ -1046,6 +1046,30 @@ static unsigned int ata_pio_modes(const struct ata_device *adev) | |||
1046 | return modes; | 1046 | return modes; |
1047 | } | 1047 | } |
1048 | 1048 | ||
1049 | static int ata_qc_wait_err(struct ata_queued_cmd *qc, | ||
1050 | struct completion *wait) | ||
1051 | { | ||
1052 | int rc = 0; | ||
1053 | |||
1054 | if (wait_for_completion_timeout(wait, 30 * HZ) < 1) { | ||
1055 | /* timeout handling */ | ||
1056 | unsigned int err_mask = ac_err_mask(ata_chk_status(qc->ap)); | ||
1057 | |||
1058 | if (!err_mask) { | ||
1059 | printk(KERN_WARNING "ata%u: slow completion (cmd %x)\n", | ||
1060 | qc->ap->id, qc->tf.command); | ||
1061 | } else { | ||
1062 | printk(KERN_WARNING "ata%u: qc timeout (cmd %x)\n", | ||
1063 | qc->ap->id, qc->tf.command); | ||
1064 | rc = -EIO; | ||
1065 | } | ||
1066 | |||
1067 | ata_qc_complete(qc, err_mask); | ||
1068 | } | ||
1069 | |||
1070 | return rc; | ||
1071 | } | ||
1072 | |||
1049 | /** | 1073 | /** |
1050 | * ata_dev_identify - obtain IDENTIFY x DEVICE page | 1074 | * ata_dev_identify - obtain IDENTIFY x DEVICE page |
1051 | * @ap: port on which device we wish to probe resides | 1075 | * @ap: port on which device we wish to probe resides |
@@ -1125,7 +1149,7 @@ retry: | |||
1125 | if (rc) | 1149 | if (rc) |
1126 | goto err_out; | 1150 | goto err_out; |
1127 | else | 1151 | else |
1128 | wait_for_completion(&wait); | 1152 | ata_qc_wait_err(qc, &wait); |
1129 | 1153 | ||
1130 | spin_lock_irqsave(&ap->host_set->lock, flags); | 1154 | spin_lock_irqsave(&ap->host_set->lock, flags); |
1131 | ap->ops->tf_read(ap, &qc->tf); | 1155 | ap->ops->tf_read(ap, &qc->tf); |
@@ -1570,11 +1594,13 @@ int ata_timing_compute(struct ata_device *adev, unsigned short speed, | |||
1570 | 1594 | ||
1571 | /* | 1595 | /* |
1572 | * Find the mode. | 1596 | * Find the mode. |
1573 | */ | 1597 | */ |
1574 | 1598 | ||
1575 | if (!(s = ata_timing_find_mode(speed))) | 1599 | if (!(s = ata_timing_find_mode(speed))) |
1576 | return -EINVAL; | 1600 | return -EINVAL; |
1577 | 1601 | ||
1602 | memcpy(t, s, sizeof(*s)); | ||
1603 | |||
1578 | /* | 1604 | /* |
1579 | * If the drive is an EIDE drive, it can tell us it needs extended | 1605 | * If the drive is an EIDE drive, it can tell us it needs extended |
1580 | * PIO/MW_DMA cycle timing. | 1606 | * PIO/MW_DMA cycle timing. |
@@ -1595,7 +1621,7 @@ int ata_timing_compute(struct ata_device *adev, unsigned short speed, | |||
1595 | * Convert the timing to bus clock counts. | 1621 | * Convert the timing to bus clock counts. |
1596 | */ | 1622 | */ |
1597 | 1623 | ||
1598 | ata_timing_quantize(s, t, T, UT); | 1624 | ata_timing_quantize(t, t, T, UT); |
1599 | 1625 | ||
1600 | /* | 1626 | /* |
1601 | * Even in DMA/UDMA modes we still use PIO access for IDENTIFY, S.M.A.R.T | 1627 | * Even in DMA/UDMA modes we still use PIO access for IDENTIFY, S.M.A.R.T |
@@ -2267,7 +2293,7 @@ static void ata_dev_set_xfermode(struct ata_port *ap, struct ata_device *dev) | |||
2267 | if (rc) | 2293 | if (rc) |
2268 | ata_port_disable(ap); | 2294 | ata_port_disable(ap); |
2269 | else | 2295 | else |
2270 | wait_for_completion(&wait); | 2296 | ata_qc_wait_err(qc, &wait); |
2271 | 2297 | ||
2272 | DPRINTK("EXIT\n"); | 2298 | DPRINTK("EXIT\n"); |
2273 | } | 2299 | } |
@@ -2315,7 +2341,7 @@ static void ata_dev_reread_id(struct ata_port *ap, struct ata_device *dev) | |||
2315 | if (rc) | 2341 | if (rc) |
2316 | goto err_out; | 2342 | goto err_out; |
2317 | 2343 | ||
2318 | wait_for_completion(&wait); | 2344 | ata_qc_wait_err(qc, &wait); |
2319 | 2345 | ||
2320 | swap_buf_le16(dev->id, ATA_ID_WORDS); | 2346 | swap_buf_le16(dev->id, ATA_ID_WORDS); |
2321 | 2347 | ||
@@ -2371,7 +2397,7 @@ static void ata_dev_init_params(struct ata_port *ap, struct ata_device *dev) | |||
2371 | if (rc) | 2397 | if (rc) |
2372 | ata_port_disable(ap); | 2398 | ata_port_disable(ap); |
2373 | else | 2399 | else |
2374 | wait_for_completion(&wait); | 2400 | ata_qc_wait_err(qc, &wait); |
2375 | 2401 | ||
2376 | DPRINTK("EXIT\n"); | 2402 | DPRINTK("EXIT\n"); |
2377 | } | 2403 | } |
diff --git a/drivers/scsi/libata.h b/drivers/scsi/libata.h index 74a84e0ec0a4..8ebaa694d18e 100644 --- a/drivers/scsi/libata.h +++ b/drivers/scsi/libata.h | |||
@@ -29,7 +29,7 @@ | |||
29 | #define __LIBATA_H__ | 29 | #define __LIBATA_H__ |
30 | 30 | ||
31 | #define DRV_NAME "libata" | 31 | #define DRV_NAME "libata" |
32 | #define DRV_VERSION "1.12" /* must be exactly four chars */ | 32 | #define DRV_VERSION "1.20" /* must be exactly four chars */ |
33 | 33 | ||
34 | struct ata_scsi_args { | 34 | struct ata_scsi_args { |
35 | u16 *id; | 35 | u16 *id; |
diff --git a/drivers/scsi/sata_mv.c b/drivers/scsi/sata_mv.c index 257c128f4aaa..ab7432a5778e 100644 --- a/drivers/scsi/sata_mv.c +++ b/drivers/scsi/sata_mv.c | |||
@@ -1,7 +1,8 @@ | |||
1 | /* | 1 | /* |
2 | * sata_mv.c - Marvell SATA support | 2 | * sata_mv.c - Marvell SATA support |
3 | * | 3 | * |
4 | * Copyright 2005: EMC Corporation, all rights reserved. | 4 | * Copyright 2005: EMC Corporation, all rights reserved. |
5 | * Copyright 2005 Red Hat, Inc. All rights reserved. | ||
5 | * | 6 | * |
6 | * Please ALWAYS copy linux-ide@vger.kernel.org on emails. | 7 | * Please ALWAYS copy linux-ide@vger.kernel.org on emails. |
7 | * | 8 | * |
@@ -36,7 +37,7 @@ | |||
36 | #include <asm/io.h> | 37 | #include <asm/io.h> |
37 | 38 | ||
38 | #define DRV_NAME "sata_mv" | 39 | #define DRV_NAME "sata_mv" |
39 | #define DRV_VERSION "0.25" | 40 | #define DRV_VERSION "0.5" |
40 | 41 | ||
41 | enum { | 42 | enum { |
42 | /* BAR's are enumerated in terms of pci_resource_start() terms */ | 43 | /* BAR's are enumerated in terms of pci_resource_start() terms */ |
@@ -50,6 +51,9 @@ enum { | |||
50 | MV_PCI_REG_BASE = 0, | 51 | MV_PCI_REG_BASE = 0, |
51 | MV_IRQ_COAL_REG_BASE = 0x18000, /* 6xxx part only */ | 52 | MV_IRQ_COAL_REG_BASE = 0x18000, /* 6xxx part only */ |
52 | MV_SATAHC0_REG_BASE = 0x20000, | 53 | MV_SATAHC0_REG_BASE = 0x20000, |
54 | MV_FLASH_CTL = 0x1046c, | ||
55 | MV_GPIO_PORT_CTL = 0x104f0, | ||
56 | MV_RESET_CFG = 0x180d8, | ||
53 | 57 | ||
54 | MV_PCI_REG_SZ = MV_MAJOR_REG_AREA_SZ, | 58 | MV_PCI_REG_SZ = MV_MAJOR_REG_AREA_SZ, |
55 | MV_SATAHC_REG_SZ = MV_MAJOR_REG_AREA_SZ, | 59 | MV_SATAHC_REG_SZ = MV_MAJOR_REG_AREA_SZ, |
@@ -72,11 +76,6 @@ enum { | |||
72 | MV_SG_TBL_SZ = (16 * MV_MAX_SG_CT), | 76 | MV_SG_TBL_SZ = (16 * MV_MAX_SG_CT), |
73 | MV_PORT_PRIV_DMA_SZ = (MV_CRQB_Q_SZ + MV_CRPB_Q_SZ + MV_SG_TBL_SZ), | 77 | MV_PORT_PRIV_DMA_SZ = (MV_CRQB_Q_SZ + MV_CRPB_Q_SZ + MV_SG_TBL_SZ), |
74 | 78 | ||
75 | /* Our DMA boundary is determined by an ePRD being unable to handle | ||
76 | * anything larger than 64KB | ||
77 | */ | ||
78 | MV_DMA_BOUNDARY = 0xffffU, | ||
79 | |||
80 | MV_PORTS_PER_HC = 4, | 79 | MV_PORTS_PER_HC = 4, |
81 | /* == (port / MV_PORTS_PER_HC) to determine HC from 0-7 port */ | 80 | /* == (port / MV_PORTS_PER_HC) to determine HC from 0-7 port */ |
82 | MV_PORT_HC_SHIFT = 2, | 81 | MV_PORT_HC_SHIFT = 2, |
@@ -86,16 +85,9 @@ enum { | |||
86 | /* Host Flags */ | 85 | /* Host Flags */ |
87 | MV_FLAG_DUAL_HC = (1 << 30), /* two SATA Host Controllers */ | 86 | MV_FLAG_DUAL_HC = (1 << 30), /* two SATA Host Controllers */ |
88 | MV_FLAG_IRQ_COALESCE = (1 << 29), /* IRQ coalescing capability */ | 87 | MV_FLAG_IRQ_COALESCE = (1 << 29), /* IRQ coalescing capability */ |
89 | MV_FLAG_GLBL_SFT_RST = (1 << 28), /* Global Soft Reset support */ | ||
90 | MV_COMMON_FLAGS = (ATA_FLAG_SATA | ATA_FLAG_NO_LEGACY | | 88 | MV_COMMON_FLAGS = (ATA_FLAG_SATA | ATA_FLAG_NO_LEGACY | |
91 | ATA_FLAG_SATA_RESET | ATA_FLAG_MMIO), | 89 | ATA_FLAG_SATA_RESET | ATA_FLAG_MMIO), |
92 | MV_6XXX_FLAGS = (MV_FLAG_IRQ_COALESCE | | 90 | MV_6XXX_FLAGS = MV_FLAG_IRQ_COALESCE, |
93 | MV_FLAG_GLBL_SFT_RST), | ||
94 | |||
95 | chip_504x = 0, | ||
96 | chip_508x = 1, | ||
97 | chip_604x = 2, | ||
98 | chip_608x = 3, | ||
99 | 91 | ||
100 | CRQB_FLAG_READ = (1 << 0), | 92 | CRQB_FLAG_READ = (1 << 0), |
101 | CRQB_TAG_SHIFT = 1, | 93 | CRQB_TAG_SHIFT = 1, |
@@ -116,8 +108,19 @@ enum { | |||
116 | PCI_MASTER_EMPTY = (1 << 3), | 108 | PCI_MASTER_EMPTY = (1 << 3), |
117 | GLOB_SFT_RST = (1 << 4), | 109 | GLOB_SFT_RST = (1 << 4), |
118 | 110 | ||
119 | PCI_IRQ_CAUSE_OFS = 0x1d58, | 111 | MV_PCI_MODE = 0xd00, |
120 | PCI_IRQ_MASK_OFS = 0x1d5c, | 112 | MV_PCI_EXP_ROM_BAR_CTL = 0xd2c, |
113 | MV_PCI_DISC_TIMER = 0xd04, | ||
114 | MV_PCI_MSI_TRIGGER = 0xc38, | ||
115 | MV_PCI_SERR_MASK = 0xc28, | ||
116 | MV_PCI_XBAR_TMOUT = 0x1d04, | ||
117 | MV_PCI_ERR_LOW_ADDRESS = 0x1d40, | ||
118 | MV_PCI_ERR_HIGH_ADDRESS = 0x1d44, | ||
119 | MV_PCI_ERR_ATTRIBUTE = 0x1d48, | ||
120 | MV_PCI_ERR_COMMAND = 0x1d50, | ||
121 | |||
122 | PCI_IRQ_CAUSE_OFS = 0x1d58, | ||
123 | PCI_IRQ_MASK_OFS = 0x1d5c, | ||
121 | PCI_UNMASK_ALL_IRQS = 0x7fffff, /* bits 22-0 */ | 124 | PCI_UNMASK_ALL_IRQS = 0x7fffff, /* bits 22-0 */ |
122 | 125 | ||
123 | HC_MAIN_IRQ_CAUSE_OFS = 0x1d60, | 126 | HC_MAIN_IRQ_CAUSE_OFS = 0x1d60, |
@@ -134,7 +137,7 @@ enum { | |||
134 | SELF_INT = (1 << 23), | 137 | SELF_INT = (1 << 23), |
135 | TWSI_INT = (1 << 24), | 138 | TWSI_INT = (1 << 24), |
136 | HC_MAIN_RSVD = (0x7f << 25), /* bits 31-25 */ | 139 | HC_MAIN_RSVD = (0x7f << 25), /* bits 31-25 */ |
137 | HC_MAIN_MASKED_IRQS = (TRAN_LO_DONE | TRAN_HI_DONE | | 140 | HC_MAIN_MASKED_IRQS = (TRAN_LO_DONE | TRAN_HI_DONE | |
138 | PORTS_0_7_COAL_DONE | GPIO_INT | TWSI_INT | | 141 | PORTS_0_7_COAL_DONE | GPIO_INT | TWSI_INT | |
139 | HC_MAIN_RSVD), | 142 | HC_MAIN_RSVD), |
140 | 143 | ||
@@ -153,6 +156,15 @@ enum { | |||
153 | /* SATA registers */ | 156 | /* SATA registers */ |
154 | SATA_STATUS_OFS = 0x300, /* ctrl, err regs follow status */ | 157 | SATA_STATUS_OFS = 0x300, /* ctrl, err regs follow status */ |
155 | SATA_ACTIVE_OFS = 0x350, | 158 | SATA_ACTIVE_OFS = 0x350, |
159 | PHY_MODE3 = 0x310, | ||
160 | PHY_MODE4 = 0x314, | ||
161 | PHY_MODE2 = 0x330, | ||
162 | MV5_PHY_MODE = 0x74, | ||
163 | MV5_LT_MODE = 0x30, | ||
164 | MV5_PHY_CTL = 0x0C, | ||
165 | SATA_INTERFACE_CTL = 0x050, | ||
166 | |||
167 | MV_M2_PREAMP_MASK = 0x7e0, | ||
156 | 168 | ||
157 | /* Port registers */ | 169 | /* Port registers */ |
158 | EDMA_CFG_OFS = 0, | 170 | EDMA_CFG_OFS = 0, |
@@ -182,17 +194,16 @@ enum { | |||
182 | EDMA_ERR_LNK_CTRL_TX = (0x1f << 21), | 194 | EDMA_ERR_LNK_CTRL_TX = (0x1f << 21), |
183 | EDMA_ERR_LNK_DATA_TX = (0x1f << 26), | 195 | EDMA_ERR_LNK_DATA_TX = (0x1f << 26), |
184 | EDMA_ERR_TRANS_PROTO = (1 << 31), | 196 | EDMA_ERR_TRANS_PROTO = (1 << 31), |
185 | EDMA_ERR_FATAL = (EDMA_ERR_D_PAR | EDMA_ERR_PRD_PAR | | 197 | EDMA_ERR_FATAL = (EDMA_ERR_D_PAR | EDMA_ERR_PRD_PAR | |
186 | EDMA_ERR_DEV_DCON | EDMA_ERR_CRBQ_PAR | | 198 | EDMA_ERR_DEV_DCON | EDMA_ERR_CRBQ_PAR | |
187 | EDMA_ERR_CRPB_PAR | EDMA_ERR_INTRL_PAR | | 199 | EDMA_ERR_CRPB_PAR | EDMA_ERR_INTRL_PAR | |
188 | EDMA_ERR_IORDY | EDMA_ERR_LNK_CTRL_RX_2 | | 200 | EDMA_ERR_IORDY | EDMA_ERR_LNK_CTRL_RX_2 | |
189 | EDMA_ERR_LNK_DATA_RX | | 201 | EDMA_ERR_LNK_DATA_RX | |
190 | EDMA_ERR_LNK_DATA_TX | | 202 | EDMA_ERR_LNK_DATA_TX | |
191 | EDMA_ERR_TRANS_PROTO), | 203 | EDMA_ERR_TRANS_PROTO), |
192 | 204 | ||
193 | EDMA_REQ_Q_BASE_HI_OFS = 0x10, | 205 | EDMA_REQ_Q_BASE_HI_OFS = 0x10, |
194 | EDMA_REQ_Q_IN_PTR_OFS = 0x14, /* also contains BASE_LO */ | 206 | EDMA_REQ_Q_IN_PTR_OFS = 0x14, /* also contains BASE_LO */ |
195 | EDMA_REQ_Q_BASE_LO_MASK = 0xfffffc00U, | ||
196 | 207 | ||
197 | EDMA_REQ_Q_OUT_PTR_OFS = 0x18, | 208 | EDMA_REQ_Q_OUT_PTR_OFS = 0x18, |
198 | EDMA_REQ_Q_PTR_SHIFT = 5, | 209 | EDMA_REQ_Q_PTR_SHIFT = 5, |
@@ -200,7 +211,6 @@ enum { | |||
200 | EDMA_RSP_Q_BASE_HI_OFS = 0x1c, | 211 | EDMA_RSP_Q_BASE_HI_OFS = 0x1c, |
201 | EDMA_RSP_Q_IN_PTR_OFS = 0x20, | 212 | EDMA_RSP_Q_IN_PTR_OFS = 0x20, |
202 | EDMA_RSP_Q_OUT_PTR_OFS = 0x24, /* also contains BASE_LO */ | 213 | EDMA_RSP_Q_OUT_PTR_OFS = 0x24, /* also contains BASE_LO */ |
203 | EDMA_RSP_Q_BASE_LO_MASK = 0xffffff00U, | ||
204 | EDMA_RSP_Q_PTR_SHIFT = 3, | 214 | EDMA_RSP_Q_PTR_SHIFT = 3, |
205 | 215 | ||
206 | EDMA_CMD_OFS = 0x28, | 216 | EDMA_CMD_OFS = 0x28, |
@@ -208,14 +218,44 @@ enum { | |||
208 | EDMA_DS = (1 << 1), | 218 | EDMA_DS = (1 << 1), |
209 | ATA_RST = (1 << 2), | 219 | ATA_RST = (1 << 2), |
210 | 220 | ||
221 | EDMA_IORDY_TMOUT = 0x34, | ||
222 | EDMA_ARB_CFG = 0x38, | ||
223 | |||
211 | /* Host private flags (hp_flags) */ | 224 | /* Host private flags (hp_flags) */ |
212 | MV_HP_FLAG_MSI = (1 << 0), | 225 | MV_HP_FLAG_MSI = (1 << 0), |
226 | MV_HP_ERRATA_50XXB0 = (1 << 1), | ||
227 | MV_HP_ERRATA_50XXB2 = (1 << 2), | ||
228 | MV_HP_ERRATA_60X1B2 = (1 << 3), | ||
229 | MV_HP_ERRATA_60X1C0 = (1 << 4), | ||
230 | MV_HP_50XX = (1 << 5), | ||
213 | 231 | ||
214 | /* Port private flags (pp_flags) */ | 232 | /* Port private flags (pp_flags) */ |
215 | MV_PP_FLAG_EDMA_EN = (1 << 0), | 233 | MV_PP_FLAG_EDMA_EN = (1 << 0), |
216 | MV_PP_FLAG_EDMA_DS_ACT = (1 << 1), | 234 | MV_PP_FLAG_EDMA_DS_ACT = (1 << 1), |
217 | }; | 235 | }; |
218 | 236 | ||
237 | #define IS_50XX(hpriv) ((hpriv)->hp_flags & MV_HP_50XX) | ||
238 | #define IS_60XX(hpriv) (((hpriv)->hp_flags & MV_HP_50XX) == 0) | ||
239 | |||
240 | enum { | ||
241 | /* Our DMA boundary is determined by an ePRD being unable to handle | ||
242 | * anything larger than 64KB | ||
243 | */ | ||
244 | MV_DMA_BOUNDARY = 0xffffU, | ||
245 | |||
246 | EDMA_REQ_Q_BASE_LO_MASK = 0xfffffc00U, | ||
247 | |||
248 | EDMA_RSP_Q_BASE_LO_MASK = 0xffffff00U, | ||
249 | }; | ||
250 | |||
251 | enum chip_type { | ||
252 | chip_504x, | ||
253 | chip_508x, | ||
254 | chip_5080, | ||
255 | chip_604x, | ||
256 | chip_608x, | ||
257 | }; | ||
258 | |||
219 | /* Command ReQuest Block: 32B */ | 259 | /* Command ReQuest Block: 32B */ |
220 | struct mv_crqb { | 260 | struct mv_crqb { |
221 | u32 sg_addr; | 261 | u32 sg_addr; |
@@ -252,14 +292,37 @@ struct mv_port_priv { | |||
252 | u32 pp_flags; | 292 | u32 pp_flags; |
253 | }; | 293 | }; |
254 | 294 | ||
295 | struct mv_port_signal { | ||
296 | u32 amps; | ||
297 | u32 pre; | ||
298 | }; | ||
299 | |||
300 | struct mv_host_priv; | ||
301 | struct mv_hw_ops { | ||
302 | void (*phy_errata)(struct mv_host_priv *hpriv, void __iomem *mmio, | ||
303 | unsigned int port); | ||
304 | void (*enable_leds)(struct mv_host_priv *hpriv, void __iomem *mmio); | ||
305 | void (*read_preamp)(struct mv_host_priv *hpriv, int idx, | ||
306 | void __iomem *mmio); | ||
307 | int (*reset_hc)(struct mv_host_priv *hpriv, void __iomem *mmio, | ||
308 | unsigned int n_hc); | ||
309 | void (*reset_flash)(struct mv_host_priv *hpriv, void __iomem *mmio); | ||
310 | void (*reset_bus)(struct pci_dev *pdev, void __iomem *mmio); | ||
311 | }; | ||
312 | |||
255 | struct mv_host_priv { | 313 | struct mv_host_priv { |
256 | u32 hp_flags; | 314 | u32 hp_flags; |
315 | struct mv_port_signal signal[8]; | ||
316 | const struct mv_hw_ops *ops; | ||
257 | }; | 317 | }; |
258 | 318 | ||
259 | static void mv_irq_clear(struct ata_port *ap); | 319 | static void mv_irq_clear(struct ata_port *ap); |
260 | static u32 mv_scr_read(struct ata_port *ap, unsigned int sc_reg_in); | 320 | static u32 mv_scr_read(struct ata_port *ap, unsigned int sc_reg_in); |
261 | static void mv_scr_write(struct ata_port *ap, unsigned int sc_reg_in, u32 val); | 321 | static void mv_scr_write(struct ata_port *ap, unsigned int sc_reg_in, u32 val); |
322 | static u32 mv5_scr_read(struct ata_port *ap, unsigned int sc_reg_in); | ||
323 | static void mv5_scr_write(struct ata_port *ap, unsigned int sc_reg_in, u32 val); | ||
262 | static void mv_phy_reset(struct ata_port *ap); | 324 | static void mv_phy_reset(struct ata_port *ap); |
325 | static void __mv_phy_reset(struct ata_port *ap, int can_sleep); | ||
263 | static void mv_host_stop(struct ata_host_set *host_set); | 326 | static void mv_host_stop(struct ata_host_set *host_set); |
264 | static int mv_port_start(struct ata_port *ap); | 327 | static int mv_port_start(struct ata_port *ap); |
265 | static void mv_port_stop(struct ata_port *ap); | 328 | static void mv_port_stop(struct ata_port *ap); |
@@ -270,6 +333,29 @@ static irqreturn_t mv_interrupt(int irq, void *dev_instance, | |||
270 | static void mv_eng_timeout(struct ata_port *ap); | 333 | static void mv_eng_timeout(struct ata_port *ap); |
271 | static int mv_init_one(struct pci_dev *pdev, const struct pci_device_id *ent); | 334 | static int mv_init_one(struct pci_dev *pdev, const struct pci_device_id *ent); |
272 | 335 | ||
336 | static void mv5_phy_errata(struct mv_host_priv *hpriv, void __iomem *mmio, | ||
337 | unsigned int port); | ||
338 | static void mv5_enable_leds(struct mv_host_priv *hpriv, void __iomem *mmio); | ||
339 | static void mv5_read_preamp(struct mv_host_priv *hpriv, int idx, | ||
340 | void __iomem *mmio); | ||
341 | static int mv5_reset_hc(struct mv_host_priv *hpriv, void __iomem *mmio, | ||
342 | unsigned int n_hc); | ||
343 | static void mv5_reset_flash(struct mv_host_priv *hpriv, void __iomem *mmio); | ||
344 | static void mv5_reset_bus(struct pci_dev *pdev, void __iomem *mmio); | ||
345 | |||
346 | static void mv6_phy_errata(struct mv_host_priv *hpriv, void __iomem *mmio, | ||
347 | unsigned int port); | ||
348 | static void mv6_enable_leds(struct mv_host_priv *hpriv, void __iomem *mmio); | ||
349 | static void mv6_read_preamp(struct mv_host_priv *hpriv, int idx, | ||
350 | void __iomem *mmio); | ||
351 | static int mv6_reset_hc(struct mv_host_priv *hpriv, void __iomem *mmio, | ||
352 | unsigned int n_hc); | ||
353 | static void mv6_reset_flash(struct mv_host_priv *hpriv, void __iomem *mmio); | ||
354 | static void mv_reset_pci_bus(struct pci_dev *pdev, void __iomem *mmio); | ||
355 | static void mv_channel_reset(struct mv_host_priv *hpriv, void __iomem *mmio, | ||
356 | unsigned int port_no); | ||
357 | static void mv_stop_and_reset(struct ata_port *ap); | ||
358 | |||
273 | static struct scsi_host_template mv_sht = { | 359 | static struct scsi_host_template mv_sht = { |
274 | .module = THIS_MODULE, | 360 | .module = THIS_MODULE, |
275 | .name = DRV_NAME, | 361 | .name = DRV_NAME, |
@@ -278,7 +364,7 @@ static struct scsi_host_template mv_sht = { | |||
278 | .eh_strategy_handler = ata_scsi_error, | 364 | .eh_strategy_handler = ata_scsi_error, |
279 | .can_queue = MV_USE_Q_DEPTH, | 365 | .can_queue = MV_USE_Q_DEPTH, |
280 | .this_id = ATA_SHT_THIS_ID, | 366 | .this_id = ATA_SHT_THIS_ID, |
281 | .sg_tablesize = MV_MAX_SG_CT, | 367 | .sg_tablesize = MV_MAX_SG_CT / 2, |
282 | .max_sectors = ATA_MAX_SECTORS, | 368 | .max_sectors = ATA_MAX_SECTORS, |
283 | .cmd_per_lun = ATA_SHT_CMD_PER_LUN, | 369 | .cmd_per_lun = ATA_SHT_CMD_PER_LUN, |
284 | .emulated = ATA_SHT_EMULATED, | 370 | .emulated = ATA_SHT_EMULATED, |
@@ -290,7 +376,34 @@ static struct scsi_host_template mv_sht = { | |||
290 | .ordered_flush = 1, | 376 | .ordered_flush = 1, |
291 | }; | 377 | }; |
292 | 378 | ||
293 | static const struct ata_port_operations mv_ops = { | 379 | static const struct ata_port_operations mv5_ops = { |
380 | .port_disable = ata_port_disable, | ||
381 | |||
382 | .tf_load = ata_tf_load, | ||
383 | .tf_read = ata_tf_read, | ||
384 | .check_status = ata_check_status, | ||
385 | .exec_command = ata_exec_command, | ||
386 | .dev_select = ata_std_dev_select, | ||
387 | |||
388 | .phy_reset = mv_phy_reset, | ||
389 | |||
390 | .qc_prep = mv_qc_prep, | ||
391 | .qc_issue = mv_qc_issue, | ||
392 | |||
393 | .eng_timeout = mv_eng_timeout, | ||
394 | |||
395 | .irq_handler = mv_interrupt, | ||
396 | .irq_clear = mv_irq_clear, | ||
397 | |||
398 | .scr_read = mv5_scr_read, | ||
399 | .scr_write = mv5_scr_write, | ||
400 | |||
401 | .port_start = mv_port_start, | ||
402 | .port_stop = mv_port_stop, | ||
403 | .host_stop = mv_host_stop, | ||
404 | }; | ||
405 | |||
406 | static const struct ata_port_operations mv6_ops = { | ||
294 | .port_disable = ata_port_disable, | 407 | .port_disable = ata_port_disable, |
295 | 408 | ||
296 | .tf_load = ata_tf_load, | 409 | .tf_load = ata_tf_load, |
@@ -322,37 +435,44 @@ static struct ata_port_info mv_port_info[] = { | |||
322 | .sht = &mv_sht, | 435 | .sht = &mv_sht, |
323 | .host_flags = MV_COMMON_FLAGS, | 436 | .host_flags = MV_COMMON_FLAGS, |
324 | .pio_mask = 0x1f, /* pio0-4 */ | 437 | .pio_mask = 0x1f, /* pio0-4 */ |
325 | .udma_mask = 0, /* 0x7f (udma0-6 disabled for now) */ | 438 | .udma_mask = 0x7f, /* udma0-6 */ |
326 | .port_ops = &mv_ops, | 439 | .port_ops = &mv5_ops, |
327 | }, | 440 | }, |
328 | { /* chip_508x */ | 441 | { /* chip_508x */ |
329 | .sht = &mv_sht, | 442 | .sht = &mv_sht, |
330 | .host_flags = (MV_COMMON_FLAGS | MV_FLAG_DUAL_HC), | 443 | .host_flags = (MV_COMMON_FLAGS | MV_FLAG_DUAL_HC), |
331 | .pio_mask = 0x1f, /* pio0-4 */ | 444 | .pio_mask = 0x1f, /* pio0-4 */ |
332 | .udma_mask = 0, /* 0x7f (udma0-6 disabled for now) */ | 445 | .udma_mask = 0x7f, /* udma0-6 */ |
333 | .port_ops = &mv_ops, | 446 | .port_ops = &mv5_ops, |
447 | }, | ||
448 | { /* chip_5080 */ | ||
449 | .sht = &mv_sht, | ||
450 | .host_flags = (MV_COMMON_FLAGS | MV_FLAG_DUAL_HC), | ||
451 | .pio_mask = 0x1f, /* pio0-4 */ | ||
452 | .udma_mask = 0x7f, /* udma0-6 */ | ||
453 | .port_ops = &mv5_ops, | ||
334 | }, | 454 | }, |
335 | { /* chip_604x */ | 455 | { /* chip_604x */ |
336 | .sht = &mv_sht, | 456 | .sht = &mv_sht, |
337 | .host_flags = (MV_COMMON_FLAGS | MV_6XXX_FLAGS), | 457 | .host_flags = (MV_COMMON_FLAGS | MV_6XXX_FLAGS), |
338 | .pio_mask = 0x1f, /* pio0-4 */ | 458 | .pio_mask = 0x1f, /* pio0-4 */ |
339 | .udma_mask = 0x7f, /* udma0-6 */ | 459 | .udma_mask = 0x7f, /* udma0-6 */ |
340 | .port_ops = &mv_ops, | 460 | .port_ops = &mv6_ops, |
341 | }, | 461 | }, |
342 | { /* chip_608x */ | 462 | { /* chip_608x */ |
343 | .sht = &mv_sht, | 463 | .sht = &mv_sht, |
344 | .host_flags = (MV_COMMON_FLAGS | MV_6XXX_FLAGS | | 464 | .host_flags = (MV_COMMON_FLAGS | MV_6XXX_FLAGS | |
345 | MV_FLAG_DUAL_HC), | 465 | MV_FLAG_DUAL_HC), |
346 | .pio_mask = 0x1f, /* pio0-4 */ | 466 | .pio_mask = 0x1f, /* pio0-4 */ |
347 | .udma_mask = 0x7f, /* udma0-6 */ | 467 | .udma_mask = 0x7f, /* udma0-6 */ |
348 | .port_ops = &mv_ops, | 468 | .port_ops = &mv6_ops, |
349 | }, | 469 | }, |
350 | }; | 470 | }; |
351 | 471 | ||
352 | static const struct pci_device_id mv_pci_tbl[] = { | 472 | static const struct pci_device_id mv_pci_tbl[] = { |
353 | {PCI_DEVICE(PCI_VENDOR_ID_MARVELL, 0x5040), 0, 0, chip_504x}, | 473 | {PCI_DEVICE(PCI_VENDOR_ID_MARVELL, 0x5040), 0, 0, chip_504x}, |
354 | {PCI_DEVICE(PCI_VENDOR_ID_MARVELL, 0x5041), 0, 0, chip_504x}, | 474 | {PCI_DEVICE(PCI_VENDOR_ID_MARVELL, 0x5041), 0, 0, chip_504x}, |
355 | {PCI_DEVICE(PCI_VENDOR_ID_MARVELL, 0x5080), 0, 0, chip_508x}, | 475 | {PCI_DEVICE(PCI_VENDOR_ID_MARVELL, 0x5080), 0, 0, chip_5080}, |
356 | {PCI_DEVICE(PCI_VENDOR_ID_MARVELL, 0x5081), 0, 0, chip_508x}, | 476 | {PCI_DEVICE(PCI_VENDOR_ID_MARVELL, 0x5081), 0, 0, chip_508x}, |
357 | 477 | ||
358 | {PCI_DEVICE(PCI_VENDOR_ID_MARVELL, 0x6040), 0, 0, chip_604x}, | 478 | {PCI_DEVICE(PCI_VENDOR_ID_MARVELL, 0x6040), 0, 0, chip_604x}, |
@@ -371,6 +491,24 @@ static struct pci_driver mv_pci_driver = { | |||
371 | .remove = ata_pci_remove_one, | 491 | .remove = ata_pci_remove_one, |
372 | }; | 492 | }; |
373 | 493 | ||
494 | static const struct mv_hw_ops mv5xxx_ops = { | ||
495 | .phy_errata = mv5_phy_errata, | ||
496 | .enable_leds = mv5_enable_leds, | ||
497 | .read_preamp = mv5_read_preamp, | ||
498 | .reset_hc = mv5_reset_hc, | ||
499 | .reset_flash = mv5_reset_flash, | ||
500 | .reset_bus = mv5_reset_bus, | ||
501 | }; | ||
502 | |||
503 | static const struct mv_hw_ops mv6xxx_ops = { | ||
504 | .phy_errata = mv6_phy_errata, | ||
505 | .enable_leds = mv6_enable_leds, | ||
506 | .read_preamp = mv6_read_preamp, | ||
507 | .reset_hc = mv6_reset_hc, | ||
508 | .reset_flash = mv6_reset_flash, | ||
509 | .reset_bus = mv_reset_pci_bus, | ||
510 | }; | ||
511 | |||
374 | /* | 512 | /* |
375 | * Functions | 513 | * Functions |
376 | */ | 514 | */ |
@@ -386,11 +524,27 @@ static inline void __iomem *mv_hc_base(void __iomem *base, unsigned int hc) | |||
386 | return (base + MV_SATAHC0_REG_BASE + (hc * MV_SATAHC_REG_SZ)); | 524 | return (base + MV_SATAHC0_REG_BASE + (hc * MV_SATAHC_REG_SZ)); |
387 | } | 525 | } |
388 | 526 | ||
527 | static inline unsigned int mv_hc_from_port(unsigned int port) | ||
528 | { | ||
529 | return port >> MV_PORT_HC_SHIFT; | ||
530 | } | ||
531 | |||
532 | static inline unsigned int mv_hardport_from_port(unsigned int port) | ||
533 | { | ||
534 | return port & MV_PORT_MASK; | ||
535 | } | ||
536 | |||
537 | static inline void __iomem *mv_hc_base_from_port(void __iomem *base, | ||
538 | unsigned int port) | ||
539 | { | ||
540 | return mv_hc_base(base, mv_hc_from_port(port)); | ||
541 | } | ||
542 | |||
389 | static inline void __iomem *mv_port_base(void __iomem *base, unsigned int port) | 543 | static inline void __iomem *mv_port_base(void __iomem *base, unsigned int port) |
390 | { | 544 | { |
391 | return (mv_hc_base(base, port >> MV_PORT_HC_SHIFT) + | 545 | return mv_hc_base_from_port(base, port) + |
392 | MV_SATAHC_ARBTR_REG_SZ + | 546 | MV_SATAHC_ARBTR_REG_SZ + |
393 | ((port & MV_PORT_MASK) * MV_PORT_REG_SZ)); | 547 | (mv_hardport_from_port(port) * MV_PORT_REG_SZ); |
394 | } | 548 | } |
395 | 549 | ||
396 | static inline void __iomem *mv_ap_base(struct ata_port *ap) | 550 | static inline void __iomem *mv_ap_base(struct ata_port *ap) |
@@ -398,9 +552,9 @@ static inline void __iomem *mv_ap_base(struct ata_port *ap) | |||
398 | return mv_port_base(ap->host_set->mmio_base, ap->port_no); | 552 | return mv_port_base(ap->host_set->mmio_base, ap->port_no); |
399 | } | 553 | } |
400 | 554 | ||
401 | static inline int mv_get_hc_count(unsigned long hp_flags) | 555 | static inline int mv_get_hc_count(unsigned long host_flags) |
402 | { | 556 | { |
403 | return ((hp_flags & MV_FLAG_DUAL_HC) ? 2 : 1); | 557 | return ((host_flags & MV_FLAG_DUAL_HC) ? 2 : 1); |
404 | } | 558 | } |
405 | 559 | ||
406 | static void mv_irq_clear(struct ata_port *ap) | 560 | static void mv_irq_clear(struct ata_port *ap) |
@@ -452,7 +606,7 @@ static void mv_stop_dma(struct ata_port *ap) | |||
452 | } else { | 606 | } else { |
453 | assert(!(EDMA_EN & readl(port_mmio + EDMA_CMD_OFS))); | 607 | assert(!(EDMA_EN & readl(port_mmio + EDMA_CMD_OFS))); |
454 | } | 608 | } |
455 | 609 | ||
456 | /* now properly wait for the eDMA to stop */ | 610 | /* now properly wait for the eDMA to stop */ |
457 | for (i = 1000; i > 0; i--) { | 611 | for (i = 1000; i > 0; i--) { |
458 | reg = readl(port_mmio + EDMA_CMD_OFS); | 612 | reg = readl(port_mmio + EDMA_CMD_OFS); |
@@ -503,7 +657,7 @@ static void mv_dump_all_regs(void __iomem *mmio_base, int port, | |||
503 | struct pci_dev *pdev) | 657 | struct pci_dev *pdev) |
504 | { | 658 | { |
505 | #ifdef ATA_DEBUG | 659 | #ifdef ATA_DEBUG |
506 | void __iomem *hc_base = mv_hc_base(mmio_base, | 660 | void __iomem *hc_base = mv_hc_base(mmio_base, |
507 | port >> MV_PORT_HC_SHIFT); | 661 | port >> MV_PORT_HC_SHIFT); |
508 | void __iomem *port_base; | 662 | void __iomem *port_base; |
509 | int start_port, num_ports, p, start_hc, num_hcs, hc; | 663 | int start_port, num_ports, p, start_hc, num_hcs, hc; |
@@ -517,7 +671,7 @@ static void mv_dump_all_regs(void __iomem *mmio_base, int port, | |||
517 | start_port = port; | 671 | start_port = port; |
518 | num_ports = num_hcs = 1; | 672 | num_ports = num_hcs = 1; |
519 | } | 673 | } |
520 | DPRINTK("All registers for port(s) %u-%u:\n", start_port, | 674 | DPRINTK("All registers for port(s) %u-%u:\n", start_port, |
521 | num_ports > 1 ? num_ports - 1 : start_port); | 675 | num_ports > 1 ? num_ports - 1 : start_port); |
522 | 676 | ||
523 | if (NULL != pdev) { | 677 | if (NULL != pdev) { |
@@ -585,70 +739,6 @@ static void mv_scr_write(struct ata_port *ap, unsigned int sc_reg_in, u32 val) | |||
585 | } | 739 | } |
586 | 740 | ||
587 | /** | 741 | /** |
588 | * mv_global_soft_reset - Perform the 6xxx global soft reset | ||
589 | * @mmio_base: base address of the HBA | ||
590 | * | ||
591 | * This routine only applies to 6xxx parts. | ||
592 | * | ||
593 | * LOCKING: | ||
594 | * Inherited from caller. | ||
595 | */ | ||
596 | static int mv_global_soft_reset(void __iomem *mmio_base) | ||
597 | { | ||
598 | void __iomem *reg = mmio_base + PCI_MAIN_CMD_STS_OFS; | ||
599 | int i, rc = 0; | ||
600 | u32 t; | ||
601 | |||
602 | /* Following procedure defined in PCI "main command and status | ||
603 | * register" table. | ||
604 | */ | ||
605 | t = readl(reg); | ||
606 | writel(t | STOP_PCI_MASTER, reg); | ||
607 | |||
608 | for (i = 0; i < 1000; i++) { | ||
609 | udelay(1); | ||
610 | t = readl(reg); | ||
611 | if (PCI_MASTER_EMPTY & t) { | ||
612 | break; | ||
613 | } | ||
614 | } | ||
615 | if (!(PCI_MASTER_EMPTY & t)) { | ||
616 | printk(KERN_ERR DRV_NAME ": PCI master won't flush\n"); | ||
617 | rc = 1; | ||
618 | goto done; | ||
619 | } | ||
620 | |||
621 | /* set reset */ | ||
622 | i = 5; | ||
623 | do { | ||
624 | writel(t | GLOB_SFT_RST, reg); | ||
625 | t = readl(reg); | ||
626 | udelay(1); | ||
627 | } while (!(GLOB_SFT_RST & t) && (i-- > 0)); | ||
628 | |||
629 | if (!(GLOB_SFT_RST & t)) { | ||
630 | printk(KERN_ERR DRV_NAME ": can't set global reset\n"); | ||
631 | rc = 1; | ||
632 | goto done; | ||
633 | } | ||
634 | |||
635 | /* clear reset and *reenable the PCI master* (not mentioned in spec) */ | ||
636 | i = 5; | ||
637 | do { | ||
638 | writel(t & ~(GLOB_SFT_RST | STOP_PCI_MASTER), reg); | ||
639 | t = readl(reg); | ||
640 | udelay(1); | ||
641 | } while ((GLOB_SFT_RST & t) && (i-- > 0)); | ||
642 | |||
643 | if (GLOB_SFT_RST & t) { | ||
644 | printk(KERN_ERR DRV_NAME ": can't clear global reset\n"); | ||
645 | rc = 1; | ||
646 | } | ||
647 | done: | ||
648 | return rc; | ||
649 | } | ||
650 | |||
651 | /** | ||
652 | * mv_host_stop - Host specific cleanup/stop routine. | 742 | * mv_host_stop - Host specific cleanup/stop routine. |
653 | * @host_set: host data structure | 743 | * @host_set: host data structure |
654 | * | 744 | * |
@@ -701,7 +791,7 @@ static int mv_port_start(struct ata_port *ap) | |||
701 | goto err_out; | 791 | goto err_out; |
702 | memset(pp, 0, sizeof(*pp)); | 792 | memset(pp, 0, sizeof(*pp)); |
703 | 793 | ||
704 | mem = dma_alloc_coherent(dev, MV_PORT_PRIV_DMA_SZ, &mem_dma, | 794 | mem = dma_alloc_coherent(dev, MV_PORT_PRIV_DMA_SZ, &mem_dma, |
705 | GFP_KERNEL); | 795 | GFP_KERNEL); |
706 | if (!mem) | 796 | if (!mem) |
707 | goto err_out_pp; | 797 | goto err_out_pp; |
@@ -711,7 +801,7 @@ static int mv_port_start(struct ata_port *ap) | |||
711 | if (rc) | 801 | if (rc) |
712 | goto err_out_priv; | 802 | goto err_out_priv; |
713 | 803 | ||
714 | /* First item in chunk of DMA memory: | 804 | /* First item in chunk of DMA memory: |
715 | * 32-slot command request table (CRQB), 32 bytes each in size | 805 | * 32-slot command request table (CRQB), 32 bytes each in size |
716 | */ | 806 | */ |
717 | pp->crqb = mem; | 807 | pp->crqb = mem; |
@@ -719,7 +809,7 @@ static int mv_port_start(struct ata_port *ap) | |||
719 | mem += MV_CRQB_Q_SZ; | 809 | mem += MV_CRQB_Q_SZ; |
720 | mem_dma += MV_CRQB_Q_SZ; | 810 | mem_dma += MV_CRQB_Q_SZ; |
721 | 811 | ||
722 | /* Second item: | 812 | /* Second item: |
723 | * 32-slot command response table (CRPB), 8 bytes each in size | 813 | * 32-slot command response table (CRPB), 8 bytes each in size |
724 | */ | 814 | */ |
725 | pp->crpb = mem; | 815 | pp->crpb = mem; |
@@ -733,18 +823,18 @@ static int mv_port_start(struct ata_port *ap) | |||
733 | pp->sg_tbl = mem; | 823 | pp->sg_tbl = mem; |
734 | pp->sg_tbl_dma = mem_dma; | 824 | pp->sg_tbl_dma = mem_dma; |
735 | 825 | ||
736 | writelfl(EDMA_CFG_Q_DEPTH | EDMA_CFG_RD_BRST_EXT | | 826 | writelfl(EDMA_CFG_Q_DEPTH | EDMA_CFG_RD_BRST_EXT | |
737 | EDMA_CFG_WR_BUFF_LEN, port_mmio + EDMA_CFG_OFS); | 827 | EDMA_CFG_WR_BUFF_LEN, port_mmio + EDMA_CFG_OFS); |
738 | 828 | ||
739 | writel((pp->crqb_dma >> 16) >> 16, port_mmio + EDMA_REQ_Q_BASE_HI_OFS); | 829 | writel((pp->crqb_dma >> 16) >> 16, port_mmio + EDMA_REQ_Q_BASE_HI_OFS); |
740 | writelfl(pp->crqb_dma & EDMA_REQ_Q_BASE_LO_MASK, | 830 | writelfl(pp->crqb_dma & EDMA_REQ_Q_BASE_LO_MASK, |
741 | port_mmio + EDMA_REQ_Q_IN_PTR_OFS); | 831 | port_mmio + EDMA_REQ_Q_IN_PTR_OFS); |
742 | 832 | ||
743 | writelfl(0, port_mmio + EDMA_REQ_Q_OUT_PTR_OFS); | 833 | writelfl(0, port_mmio + EDMA_REQ_Q_OUT_PTR_OFS); |
744 | writelfl(0, port_mmio + EDMA_RSP_Q_IN_PTR_OFS); | 834 | writelfl(0, port_mmio + EDMA_RSP_Q_IN_PTR_OFS); |
745 | 835 | ||
746 | writel((pp->crpb_dma >> 16) >> 16, port_mmio + EDMA_RSP_Q_BASE_HI_OFS); | 836 | writel((pp->crpb_dma >> 16) >> 16, port_mmio + EDMA_RSP_Q_BASE_HI_OFS); |
747 | writelfl(pp->crpb_dma & EDMA_RSP_Q_BASE_LO_MASK, | 837 | writelfl(pp->crpb_dma & EDMA_RSP_Q_BASE_LO_MASK, |
748 | port_mmio + EDMA_RSP_Q_OUT_PTR_OFS); | 838 | port_mmio + EDMA_RSP_Q_OUT_PTR_OFS); |
749 | 839 | ||
750 | pp->req_producer = pp->rsp_consumer = 0; | 840 | pp->req_producer = pp->rsp_consumer = 0; |
@@ -805,20 +895,30 @@ static void mv_fill_sg(struct ata_queued_cmd *qc) | |||
805 | struct scatterlist *sg; | 895 | struct scatterlist *sg; |
806 | 896 | ||
807 | ata_for_each_sg(sg, qc) { | 897 | ata_for_each_sg(sg, qc) { |
808 | u32 sg_len; | ||
809 | dma_addr_t addr; | 898 | dma_addr_t addr; |
899 | u32 sg_len, len, offset; | ||
810 | 900 | ||
811 | addr = sg_dma_address(sg); | 901 | addr = sg_dma_address(sg); |
812 | sg_len = sg_dma_len(sg); | 902 | sg_len = sg_dma_len(sg); |
813 | 903 | ||
814 | pp->sg_tbl[i].addr = cpu_to_le32(addr & 0xffffffff); | 904 | while (sg_len) { |
815 | pp->sg_tbl[i].addr_hi = cpu_to_le32((addr >> 16) >> 16); | 905 | offset = addr & MV_DMA_BOUNDARY; |
816 | assert(0 == (sg_len & ~MV_DMA_BOUNDARY)); | 906 | len = sg_len; |
817 | pp->sg_tbl[i].flags_size = cpu_to_le32(sg_len); | 907 | if ((offset + sg_len) > 0x10000) |
818 | if (ata_sg_is_last(sg, qc)) | 908 | len = 0x10000 - offset; |
819 | pp->sg_tbl[i].flags_size |= cpu_to_le32(EPRD_FLAG_END_OF_TBL); | 909 | |
910 | pp->sg_tbl[i].addr = cpu_to_le32(addr & 0xffffffff); | ||
911 | pp->sg_tbl[i].addr_hi = cpu_to_le32((addr >> 16) >> 16); | ||
912 | pp->sg_tbl[i].flags_size = cpu_to_le32(len); | ||
913 | |||
914 | sg_len -= len; | ||
915 | addr += len; | ||
916 | |||
917 | if (!sg_len && ata_sg_is_last(sg, qc)) | ||
918 | pp->sg_tbl[i].flags_size |= cpu_to_le32(EPRD_FLAG_END_OF_TBL); | ||
820 | 919 | ||
821 | i++; | 920 | i++; |
921 | } | ||
822 | } | 922 | } |
823 | } | 923 | } |
824 | 924 | ||
@@ -859,7 +959,7 @@ static void mv_qc_prep(struct ata_queued_cmd *qc) | |||
859 | } | 959 | } |
860 | 960 | ||
861 | /* the req producer index should be the same as we remember it */ | 961 | /* the req producer index should be the same as we remember it */ |
862 | assert(((readl(mv_ap_base(qc->ap) + EDMA_REQ_Q_IN_PTR_OFS) >> | 962 | assert(((readl(mv_ap_base(qc->ap) + EDMA_REQ_Q_IN_PTR_OFS) >> |
863 | EDMA_REQ_Q_PTR_SHIFT) & MV_MAX_Q_DEPTH_MASK) == | 963 | EDMA_REQ_Q_PTR_SHIFT) & MV_MAX_Q_DEPTH_MASK) == |
864 | pp->req_producer); | 964 | pp->req_producer); |
865 | 965 | ||
@@ -871,9 +971,9 @@ static void mv_qc_prep(struct ata_queued_cmd *qc) | |||
871 | assert(MV_MAX_Q_DEPTH > qc->tag); | 971 | assert(MV_MAX_Q_DEPTH > qc->tag); |
872 | flags |= qc->tag << CRQB_TAG_SHIFT; | 972 | flags |= qc->tag << CRQB_TAG_SHIFT; |
873 | 973 | ||
874 | pp->crqb[pp->req_producer].sg_addr = | 974 | pp->crqb[pp->req_producer].sg_addr = |
875 | cpu_to_le32(pp->sg_tbl_dma & 0xffffffff); | 975 | cpu_to_le32(pp->sg_tbl_dma & 0xffffffff); |
876 | pp->crqb[pp->req_producer].sg_addr_hi = | 976 | pp->crqb[pp->req_producer].sg_addr_hi = |
877 | cpu_to_le32((pp->sg_tbl_dma >> 16) >> 16); | 977 | cpu_to_le32((pp->sg_tbl_dma >> 16) >> 16); |
878 | pp->crqb[pp->req_producer].ctrl_flags = cpu_to_le16(flags); | 978 | pp->crqb[pp->req_producer].ctrl_flags = cpu_to_le16(flags); |
879 | 979 | ||
@@ -896,7 +996,7 @@ static void mv_qc_prep(struct ata_queued_cmd *qc) | |||
896 | #ifdef LIBATA_NCQ /* FIXME: remove this line when NCQ added */ | 996 | #ifdef LIBATA_NCQ /* FIXME: remove this line when NCQ added */ |
897 | case ATA_CMD_FPDMA_READ: | 997 | case ATA_CMD_FPDMA_READ: |
898 | case ATA_CMD_FPDMA_WRITE: | 998 | case ATA_CMD_FPDMA_WRITE: |
899 | mv_crqb_pack_cmd(cw++, tf->hob_feature, ATA_REG_FEATURE, 0); | 999 | mv_crqb_pack_cmd(cw++, tf->hob_feature, ATA_REG_FEATURE, 0); |
900 | mv_crqb_pack_cmd(cw++, tf->feature, ATA_REG_FEATURE, 0); | 1000 | mv_crqb_pack_cmd(cw++, tf->feature, ATA_REG_FEATURE, 0); |
901 | break; | 1001 | break; |
902 | #endif /* FIXME: remove this line when NCQ added */ | 1002 | #endif /* FIXME: remove this line when NCQ added */ |
@@ -962,7 +1062,7 @@ static int mv_qc_issue(struct ata_queued_cmd *qc) | |||
962 | pp->req_producer); | 1062 | pp->req_producer); |
963 | /* until we do queuing, the queue should be empty at this point */ | 1063 | /* until we do queuing, the queue should be empty at this point */ |
964 | assert(((in_ptr >> EDMA_REQ_Q_PTR_SHIFT) & MV_MAX_Q_DEPTH_MASK) == | 1064 | assert(((in_ptr >> EDMA_REQ_Q_PTR_SHIFT) & MV_MAX_Q_DEPTH_MASK) == |
965 | ((readl(port_mmio + EDMA_REQ_Q_OUT_PTR_OFS) >> | 1065 | ((readl(port_mmio + EDMA_REQ_Q_OUT_PTR_OFS) >> |
966 | EDMA_REQ_Q_PTR_SHIFT) & MV_MAX_Q_DEPTH_MASK)); | 1066 | EDMA_REQ_Q_PTR_SHIFT) & MV_MAX_Q_DEPTH_MASK)); |
967 | 1067 | ||
968 | mv_inc_q_index(&pp->req_producer); /* now incr producer index */ | 1068 | mv_inc_q_index(&pp->req_producer); /* now incr producer index */ |
@@ -999,15 +1099,15 @@ static u8 mv_get_crpb_status(struct ata_port *ap) | |||
999 | out_ptr = readl(port_mmio + EDMA_RSP_Q_OUT_PTR_OFS); | 1099 | out_ptr = readl(port_mmio + EDMA_RSP_Q_OUT_PTR_OFS); |
1000 | 1100 | ||
1001 | /* the response consumer index should be the same as we remember it */ | 1101 | /* the response consumer index should be the same as we remember it */ |
1002 | assert(((out_ptr >> EDMA_RSP_Q_PTR_SHIFT) & MV_MAX_Q_DEPTH_MASK) == | 1102 | assert(((out_ptr >> EDMA_RSP_Q_PTR_SHIFT) & MV_MAX_Q_DEPTH_MASK) == |
1003 | pp->rsp_consumer); | 1103 | pp->rsp_consumer); |
1004 | 1104 | ||
1005 | /* increment our consumer index... */ | 1105 | /* increment our consumer index... */ |
1006 | pp->rsp_consumer = mv_inc_q_index(&pp->rsp_consumer); | 1106 | pp->rsp_consumer = mv_inc_q_index(&pp->rsp_consumer); |
1007 | 1107 | ||
1008 | /* and, until we do NCQ, there should only be 1 CRPB waiting */ | 1108 | /* and, until we do NCQ, there should only be 1 CRPB waiting */ |
1009 | assert(((readl(port_mmio + EDMA_RSP_Q_IN_PTR_OFS) >> | 1109 | assert(((readl(port_mmio + EDMA_RSP_Q_IN_PTR_OFS) >> |
1010 | EDMA_RSP_Q_PTR_SHIFT) & MV_MAX_Q_DEPTH_MASK) == | 1110 | EDMA_RSP_Q_PTR_SHIFT) & MV_MAX_Q_DEPTH_MASK) == |
1011 | pp->rsp_consumer); | 1111 | pp->rsp_consumer); |
1012 | 1112 | ||
1013 | /* write out our inc'd consumer index so EDMA knows we're caught up */ | 1113 | /* write out our inc'd consumer index so EDMA knows we're caught up */ |
@@ -1055,7 +1155,7 @@ static void mv_err_intr(struct ata_port *ap) | |||
1055 | 1155 | ||
1056 | /* check for fatal here and recover if needed */ | 1156 | /* check for fatal here and recover if needed */ |
1057 | if (EDMA_ERR_FATAL & edma_err_cause) { | 1157 | if (EDMA_ERR_FATAL & edma_err_cause) { |
1058 | mv_phy_reset(ap); | 1158 | mv_stop_and_reset(ap); |
1059 | } | 1159 | } |
1060 | } | 1160 | } |
1061 | 1161 | ||
@@ -1120,6 +1220,10 @@ static void mv_host_intr(struct ata_host_set *host_set, u32 relevant, | |||
1120 | handled++; | 1220 | handled++; |
1121 | } | 1221 | } |
1122 | 1222 | ||
1223 | if (ap && | ||
1224 | (ap->flags & (ATA_FLAG_PORT_DISABLED | ATA_FLAG_NOINTR))) | ||
1225 | continue; | ||
1226 | |||
1123 | err_mask = ac_err_mask(ata_status); | 1227 | err_mask = ac_err_mask(ata_status); |
1124 | 1228 | ||
1125 | shift = port << 1; /* (port * 2) */ | 1229 | shift = port << 1; /* (port * 2) */ |
@@ -1131,14 +1235,15 @@ static void mv_host_intr(struct ata_host_set *host_set, u32 relevant, | |||
1131 | err_mask |= AC_ERR_OTHER; | 1235 | err_mask |= AC_ERR_OTHER; |
1132 | handled++; | 1236 | handled++; |
1133 | } | 1237 | } |
1134 | 1238 | ||
1135 | if (handled && ap) { | 1239 | if (handled && ap) { |
1136 | qc = ata_qc_from_tag(ap, ap->active_tag); | 1240 | qc = ata_qc_from_tag(ap, ap->active_tag); |
1137 | if (NULL != qc) { | 1241 | if (NULL != qc) { |
1138 | VPRINTK("port %u IRQ found for qc, " | 1242 | VPRINTK("port %u IRQ found for qc, " |
1139 | "ata_status 0x%x\n", port,ata_status); | 1243 | "ata_status 0x%x\n", port,ata_status); |
1140 | /* mark qc status appropriately */ | 1244 | /* mark qc status appropriately */ |
1141 | ata_qc_complete(qc, err_mask); | 1245 | if (!(qc->tf.ctl & ATA_NIEN)) |
1246 | ata_qc_complete(qc, err_mask); | ||
1142 | } | 1247 | } |
1143 | } | 1248 | } |
1144 | } | 1249 | } |
@@ -1146,7 +1251,7 @@ static void mv_host_intr(struct ata_host_set *host_set, u32 relevant, | |||
1146 | } | 1251 | } |
1147 | 1252 | ||
1148 | /** | 1253 | /** |
1149 | * mv_interrupt - | 1254 | * mv_interrupt - |
1150 | * @irq: unused | 1255 | * @irq: unused |
1151 | * @dev_instance: private data; in this case the host structure | 1256 | * @dev_instance: private data; in this case the host structure |
1152 | * @regs: unused | 1257 | * @regs: unused |
@@ -1156,7 +1261,7 @@ static void mv_host_intr(struct ata_host_set *host_set, u32 relevant, | |||
1156 | * routine to handle. Also check for PCI errors which are only | 1261 | * routine to handle. Also check for PCI errors which are only |
1157 | * reported here. | 1262 | * reported here. |
1158 | * | 1263 | * |
1159 | * LOCKING: | 1264 | * LOCKING: |
1160 | * This routine holds the host_set lock while processing pending | 1265 | * This routine holds the host_set lock while processing pending |
1161 | * interrupts. | 1266 | * interrupts. |
1162 | */ | 1267 | */ |
@@ -1202,8 +1307,422 @@ static irqreturn_t mv_interrupt(int irq, void *dev_instance, | |||
1202 | return IRQ_RETVAL(handled); | 1307 | return IRQ_RETVAL(handled); |
1203 | } | 1308 | } |
1204 | 1309 | ||
1310 | static void __iomem *mv5_phy_base(void __iomem *mmio, unsigned int port) | ||
1311 | { | ||
1312 | void __iomem *hc_mmio = mv_hc_base_from_port(mmio, port); | ||
1313 | unsigned long ofs = (mv_hardport_from_port(port) + 1) * 0x100UL; | ||
1314 | |||
1315 | return hc_mmio + ofs; | ||
1316 | } | ||
1317 | |||
1318 | static unsigned int mv5_scr_offset(unsigned int sc_reg_in) | ||
1319 | { | ||
1320 | unsigned int ofs; | ||
1321 | |||
1322 | switch (sc_reg_in) { | ||
1323 | case SCR_STATUS: | ||
1324 | case SCR_ERROR: | ||
1325 | case SCR_CONTROL: | ||
1326 | ofs = sc_reg_in * sizeof(u32); | ||
1327 | break; | ||
1328 | default: | ||
1329 | ofs = 0xffffffffU; | ||
1330 | break; | ||
1331 | } | ||
1332 | return ofs; | ||
1333 | } | ||
1334 | |||
1335 | static u32 mv5_scr_read(struct ata_port *ap, unsigned int sc_reg_in) | ||
1336 | { | ||
1337 | void __iomem *mmio = mv5_phy_base(ap->host_set->mmio_base, ap->port_no); | ||
1338 | unsigned int ofs = mv5_scr_offset(sc_reg_in); | ||
1339 | |||
1340 | if (ofs != 0xffffffffU) | ||
1341 | return readl(mmio + ofs); | ||
1342 | else | ||
1343 | return (u32) ofs; | ||
1344 | } | ||
1345 | |||
1346 | static void mv5_scr_write(struct ata_port *ap, unsigned int sc_reg_in, u32 val) | ||
1347 | { | ||
1348 | void __iomem *mmio = mv5_phy_base(ap->host_set->mmio_base, ap->port_no); | ||
1349 | unsigned int ofs = mv5_scr_offset(sc_reg_in); | ||
1350 | |||
1351 | if (ofs != 0xffffffffU) | ||
1352 | writelfl(val, mmio + ofs); | ||
1353 | } | ||
1354 | |||
1355 | static void mv5_reset_bus(struct pci_dev *pdev, void __iomem *mmio) | ||
1356 | { | ||
1357 | u8 rev_id; | ||
1358 | int early_5080; | ||
1359 | |||
1360 | pci_read_config_byte(pdev, PCI_REVISION_ID, &rev_id); | ||
1361 | |||
1362 | early_5080 = (pdev->device == 0x5080) && (rev_id == 0); | ||
1363 | |||
1364 | if (!early_5080) { | ||
1365 | u32 tmp = readl(mmio + MV_PCI_EXP_ROM_BAR_CTL); | ||
1366 | tmp |= (1 << 0); | ||
1367 | writel(tmp, mmio + MV_PCI_EXP_ROM_BAR_CTL); | ||
1368 | } | ||
1369 | |||
1370 | mv_reset_pci_bus(pdev, mmio); | ||
1371 | } | ||
1372 | |||
1373 | static void mv5_reset_flash(struct mv_host_priv *hpriv, void __iomem *mmio) | ||
1374 | { | ||
1375 | writel(0x0fcfffff, mmio + MV_FLASH_CTL); | ||
1376 | } | ||
1377 | |||
1378 | static void mv5_read_preamp(struct mv_host_priv *hpriv, int idx, | ||
1379 | void __iomem *mmio) | ||
1380 | { | ||
1381 | void __iomem *phy_mmio = mv5_phy_base(mmio, idx); | ||
1382 | u32 tmp; | ||
1383 | |||
1384 | tmp = readl(phy_mmio + MV5_PHY_MODE); | ||
1385 | |||
1386 | hpriv->signal[idx].pre = tmp & 0x1800; /* bits 12:11 */ | ||
1387 | hpriv->signal[idx].amps = tmp & 0xe0; /* bits 7:5 */ | ||
1388 | } | ||
1389 | |||
1390 | static void mv5_enable_leds(struct mv_host_priv *hpriv, void __iomem *mmio) | ||
1391 | { | ||
1392 | u32 tmp; | ||
1393 | |||
1394 | writel(0, mmio + MV_GPIO_PORT_CTL); | ||
1395 | |||
1396 | /* FIXME: handle MV_HP_ERRATA_50XXB2 errata */ | ||
1397 | |||
1398 | tmp = readl(mmio + MV_PCI_EXP_ROM_BAR_CTL); | ||
1399 | tmp |= ~(1 << 0); | ||
1400 | writel(tmp, mmio + MV_PCI_EXP_ROM_BAR_CTL); | ||
1401 | } | ||
1402 | |||
1403 | static void mv5_phy_errata(struct mv_host_priv *hpriv, void __iomem *mmio, | ||
1404 | unsigned int port) | ||
1405 | { | ||
1406 | void __iomem *phy_mmio = mv5_phy_base(mmio, port); | ||
1407 | const u32 mask = (1<<12) | (1<<11) | (1<<7) | (1<<6) | (1<<5); | ||
1408 | u32 tmp; | ||
1409 | int fix_apm_sq = (hpriv->hp_flags & MV_HP_ERRATA_50XXB0); | ||
1410 | |||
1411 | if (fix_apm_sq) { | ||
1412 | tmp = readl(phy_mmio + MV5_LT_MODE); | ||
1413 | tmp |= (1 << 19); | ||
1414 | writel(tmp, phy_mmio + MV5_LT_MODE); | ||
1415 | |||
1416 | tmp = readl(phy_mmio + MV5_PHY_CTL); | ||
1417 | tmp &= ~0x3; | ||
1418 | tmp |= 0x1; | ||
1419 | writel(tmp, phy_mmio + MV5_PHY_CTL); | ||
1420 | } | ||
1421 | |||
1422 | tmp = readl(phy_mmio + MV5_PHY_MODE); | ||
1423 | tmp &= ~mask; | ||
1424 | tmp |= hpriv->signal[port].pre; | ||
1425 | tmp |= hpriv->signal[port].amps; | ||
1426 | writel(tmp, phy_mmio + MV5_PHY_MODE); | ||
1427 | } | ||
1428 | |||
1429 | |||
1430 | #undef ZERO | ||
1431 | #define ZERO(reg) writel(0, port_mmio + (reg)) | ||
1432 | static void mv5_reset_hc_port(struct mv_host_priv *hpriv, void __iomem *mmio, | ||
1433 | unsigned int port) | ||
1434 | { | ||
1435 | void __iomem *port_mmio = mv_port_base(mmio, port); | ||
1436 | |||
1437 | writelfl(EDMA_DS, port_mmio + EDMA_CMD_OFS); | ||
1438 | |||
1439 | mv_channel_reset(hpriv, mmio, port); | ||
1440 | |||
1441 | ZERO(0x028); /* command */ | ||
1442 | writel(0x11f, port_mmio + EDMA_CFG_OFS); | ||
1443 | ZERO(0x004); /* timer */ | ||
1444 | ZERO(0x008); /* irq err cause */ | ||
1445 | ZERO(0x00c); /* irq err mask */ | ||
1446 | ZERO(0x010); /* rq bah */ | ||
1447 | ZERO(0x014); /* rq inp */ | ||
1448 | ZERO(0x018); /* rq outp */ | ||
1449 | ZERO(0x01c); /* respq bah */ | ||
1450 | ZERO(0x024); /* respq outp */ | ||
1451 | ZERO(0x020); /* respq inp */ | ||
1452 | ZERO(0x02c); /* test control */ | ||
1453 | writel(0xbc, port_mmio + EDMA_IORDY_TMOUT); | ||
1454 | } | ||
1455 | #undef ZERO | ||
1456 | |||
1457 | #define ZERO(reg) writel(0, hc_mmio + (reg)) | ||
1458 | static void mv5_reset_one_hc(struct mv_host_priv *hpriv, void __iomem *mmio, | ||
1459 | unsigned int hc) | ||
1460 | { | ||
1461 | void __iomem *hc_mmio = mv_hc_base(mmio, hc); | ||
1462 | u32 tmp; | ||
1463 | |||
1464 | ZERO(0x00c); | ||
1465 | ZERO(0x010); | ||
1466 | ZERO(0x014); | ||
1467 | ZERO(0x018); | ||
1468 | |||
1469 | tmp = readl(hc_mmio + 0x20); | ||
1470 | tmp &= 0x1c1c1c1c; | ||
1471 | tmp |= 0x03030303; | ||
1472 | writel(tmp, hc_mmio + 0x20); | ||
1473 | } | ||
1474 | #undef ZERO | ||
1475 | |||
1476 | static int mv5_reset_hc(struct mv_host_priv *hpriv, void __iomem *mmio, | ||
1477 | unsigned int n_hc) | ||
1478 | { | ||
1479 | unsigned int hc, port; | ||
1480 | |||
1481 | for (hc = 0; hc < n_hc; hc++) { | ||
1482 | for (port = 0; port < MV_PORTS_PER_HC; port++) | ||
1483 | mv5_reset_hc_port(hpriv, mmio, | ||
1484 | (hc * MV_PORTS_PER_HC) + port); | ||
1485 | |||
1486 | mv5_reset_one_hc(hpriv, mmio, hc); | ||
1487 | } | ||
1488 | |||
1489 | return 0; | ||
1490 | } | ||
1491 | |||
1492 | #undef ZERO | ||
1493 | #define ZERO(reg) writel(0, mmio + (reg)) | ||
1494 | static void mv_reset_pci_bus(struct pci_dev *pdev, void __iomem *mmio) | ||
1495 | { | ||
1496 | u32 tmp; | ||
1497 | |||
1498 | tmp = readl(mmio + MV_PCI_MODE); | ||
1499 | tmp &= 0xff00ffff; | ||
1500 | writel(tmp, mmio + MV_PCI_MODE); | ||
1501 | |||
1502 | ZERO(MV_PCI_DISC_TIMER); | ||
1503 | ZERO(MV_PCI_MSI_TRIGGER); | ||
1504 | writel(0x000100ff, mmio + MV_PCI_XBAR_TMOUT); | ||
1505 | ZERO(HC_MAIN_IRQ_MASK_OFS); | ||
1506 | ZERO(MV_PCI_SERR_MASK); | ||
1507 | ZERO(PCI_IRQ_CAUSE_OFS); | ||
1508 | ZERO(PCI_IRQ_MASK_OFS); | ||
1509 | ZERO(MV_PCI_ERR_LOW_ADDRESS); | ||
1510 | ZERO(MV_PCI_ERR_HIGH_ADDRESS); | ||
1511 | ZERO(MV_PCI_ERR_ATTRIBUTE); | ||
1512 | ZERO(MV_PCI_ERR_COMMAND); | ||
1513 | } | ||
1514 | #undef ZERO | ||
1515 | |||
1516 | static void mv6_reset_flash(struct mv_host_priv *hpriv, void __iomem *mmio) | ||
1517 | { | ||
1518 | u32 tmp; | ||
1519 | |||
1520 | mv5_reset_flash(hpriv, mmio); | ||
1521 | |||
1522 | tmp = readl(mmio + MV_GPIO_PORT_CTL); | ||
1523 | tmp &= 0x3; | ||
1524 | tmp |= (1 << 5) | (1 << 6); | ||
1525 | writel(tmp, mmio + MV_GPIO_PORT_CTL); | ||
1526 | } | ||
1527 | |||
1528 | /** | ||
1529 | * mv6_reset_hc - Perform the 6xxx global soft reset | ||
1530 | * @mmio: base address of the HBA | ||
1531 | * | ||
1532 | * This routine only applies to 6xxx parts. | ||
1533 | * | ||
1534 | * LOCKING: | ||
1535 | * Inherited from caller. | ||
1536 | */ | ||
1537 | static int mv6_reset_hc(struct mv_host_priv *hpriv, void __iomem *mmio, | ||
1538 | unsigned int n_hc) | ||
1539 | { | ||
1540 | void __iomem *reg = mmio + PCI_MAIN_CMD_STS_OFS; | ||
1541 | int i, rc = 0; | ||
1542 | u32 t; | ||
1543 | |||
1544 | /* Following procedure defined in PCI "main command and status | ||
1545 | * register" table. | ||
1546 | */ | ||
1547 | t = readl(reg); | ||
1548 | writel(t | STOP_PCI_MASTER, reg); | ||
1549 | |||
1550 | for (i = 0; i < 1000; i++) { | ||
1551 | udelay(1); | ||
1552 | t = readl(reg); | ||
1553 | if (PCI_MASTER_EMPTY & t) { | ||
1554 | break; | ||
1555 | } | ||
1556 | } | ||
1557 | if (!(PCI_MASTER_EMPTY & t)) { | ||
1558 | printk(KERN_ERR DRV_NAME ": PCI master won't flush\n"); | ||
1559 | rc = 1; | ||
1560 | goto done; | ||
1561 | } | ||
1562 | |||
1563 | /* set reset */ | ||
1564 | i = 5; | ||
1565 | do { | ||
1566 | writel(t | GLOB_SFT_RST, reg); | ||
1567 | t = readl(reg); | ||
1568 | udelay(1); | ||
1569 | } while (!(GLOB_SFT_RST & t) && (i-- > 0)); | ||
1570 | |||
1571 | if (!(GLOB_SFT_RST & t)) { | ||
1572 | printk(KERN_ERR DRV_NAME ": can't set global reset\n"); | ||
1573 | rc = 1; | ||
1574 | goto done; | ||
1575 | } | ||
1576 | |||
1577 | /* clear reset and *reenable the PCI master* (not mentioned in spec) */ | ||
1578 | i = 5; | ||
1579 | do { | ||
1580 | writel(t & ~(GLOB_SFT_RST | STOP_PCI_MASTER), reg); | ||
1581 | t = readl(reg); | ||
1582 | udelay(1); | ||
1583 | } while ((GLOB_SFT_RST & t) && (i-- > 0)); | ||
1584 | |||
1585 | if (GLOB_SFT_RST & t) { | ||
1586 | printk(KERN_ERR DRV_NAME ": can't clear global reset\n"); | ||
1587 | rc = 1; | ||
1588 | } | ||
1589 | done: | ||
1590 | return rc; | ||
1591 | } | ||
1592 | |||
1593 | static void mv6_read_preamp(struct mv_host_priv *hpriv, int idx, | ||
1594 | void __iomem *mmio) | ||
1595 | { | ||
1596 | void __iomem *port_mmio; | ||
1597 | u32 tmp; | ||
1598 | |||
1599 | tmp = readl(mmio + MV_RESET_CFG); | ||
1600 | if ((tmp & (1 << 0)) == 0) { | ||
1601 | hpriv->signal[idx].amps = 0x7 << 8; | ||
1602 | hpriv->signal[idx].pre = 0x1 << 5; | ||
1603 | return; | ||
1604 | } | ||
1605 | |||
1606 | port_mmio = mv_port_base(mmio, idx); | ||
1607 | tmp = readl(port_mmio + PHY_MODE2); | ||
1608 | |||
1609 | hpriv->signal[idx].amps = tmp & 0x700; /* bits 10:8 */ | ||
1610 | hpriv->signal[idx].pre = tmp & 0xe0; /* bits 7:5 */ | ||
1611 | } | ||
1612 | |||
1613 | static void mv6_enable_leds(struct mv_host_priv *hpriv, void __iomem *mmio) | ||
1614 | { | ||
1615 | writel(0x00000060, mmio + MV_GPIO_PORT_CTL); | ||
1616 | } | ||
1617 | |||
1618 | static void mv6_phy_errata(struct mv_host_priv *hpriv, void __iomem *mmio, | ||
1619 | unsigned int port) | ||
1620 | { | ||
1621 | void __iomem *port_mmio = mv_port_base(mmio, port); | ||
1622 | |||
1623 | u32 hp_flags = hpriv->hp_flags; | ||
1624 | int fix_phy_mode2 = | ||
1625 | hp_flags & (MV_HP_ERRATA_60X1B2 | MV_HP_ERRATA_60X1C0); | ||
1626 | int fix_phy_mode4 = | ||
1627 | hp_flags & (MV_HP_ERRATA_60X1B2 | MV_HP_ERRATA_60X1C0); | ||
1628 | u32 m2, tmp; | ||
1629 | |||
1630 | if (fix_phy_mode2) { | ||
1631 | m2 = readl(port_mmio + PHY_MODE2); | ||
1632 | m2 &= ~(1 << 16); | ||
1633 | m2 |= (1 << 31); | ||
1634 | writel(m2, port_mmio + PHY_MODE2); | ||
1635 | |||
1636 | udelay(200); | ||
1637 | |||
1638 | m2 = readl(port_mmio + PHY_MODE2); | ||
1639 | m2 &= ~((1 << 16) | (1 << 31)); | ||
1640 | writel(m2, port_mmio + PHY_MODE2); | ||
1641 | |||
1642 | udelay(200); | ||
1643 | } | ||
1644 | |||
1645 | /* who knows what this magic does */ | ||
1646 | tmp = readl(port_mmio + PHY_MODE3); | ||
1647 | tmp &= ~0x7F800000; | ||
1648 | tmp |= 0x2A800000; | ||
1649 | writel(tmp, port_mmio + PHY_MODE3); | ||
1650 | |||
1651 | if (fix_phy_mode4) { | ||
1652 | u32 m4; | ||
1653 | |||
1654 | m4 = readl(port_mmio + PHY_MODE4); | ||
1655 | |||
1656 | if (hp_flags & MV_HP_ERRATA_60X1B2) | ||
1657 | tmp = readl(port_mmio + 0x310); | ||
1658 | |||
1659 | m4 = (m4 & ~(1 << 1)) | (1 << 0); | ||
1660 | |||
1661 | writel(m4, port_mmio + PHY_MODE4); | ||
1662 | |||
1663 | if (hp_flags & MV_HP_ERRATA_60X1B2) | ||
1664 | writel(tmp, port_mmio + 0x310); | ||
1665 | } | ||
1666 | |||
1667 | /* Revert values of pre-emphasis and signal amps to the saved ones */ | ||
1668 | m2 = readl(port_mmio + PHY_MODE2); | ||
1669 | |||
1670 | m2 &= ~MV_M2_PREAMP_MASK; | ||
1671 | m2 |= hpriv->signal[port].amps; | ||
1672 | m2 |= hpriv->signal[port].pre; | ||
1673 | m2 &= ~(1 << 16); | ||
1674 | |||
1675 | writel(m2, port_mmio + PHY_MODE2); | ||
1676 | } | ||
1677 | |||
1678 | static void mv_channel_reset(struct mv_host_priv *hpriv, void __iomem *mmio, | ||
1679 | unsigned int port_no) | ||
1680 | { | ||
1681 | void __iomem *port_mmio = mv_port_base(mmio, port_no); | ||
1682 | |||
1683 | writelfl(ATA_RST, port_mmio + EDMA_CMD_OFS); | ||
1684 | |||
1685 | if (IS_60XX(hpriv)) { | ||
1686 | u32 ifctl = readl(port_mmio + SATA_INTERFACE_CTL); | ||
1687 | ifctl |= (1 << 12) | (1 << 7); | ||
1688 | writelfl(ifctl, port_mmio + SATA_INTERFACE_CTL); | ||
1689 | } | ||
1690 | |||
1691 | udelay(25); /* allow reset propagation */ | ||
1692 | |||
1693 | /* Spec never mentions clearing the bit. Marvell's driver does | ||
1694 | * clear the bit, however. | ||
1695 | */ | ||
1696 | writelfl(0, port_mmio + EDMA_CMD_OFS); | ||
1697 | |||
1698 | hpriv->ops->phy_errata(hpriv, mmio, port_no); | ||
1699 | |||
1700 | if (IS_50XX(hpriv)) | ||
1701 | mdelay(1); | ||
1702 | } | ||
1703 | |||
1704 | static void mv_stop_and_reset(struct ata_port *ap) | ||
1705 | { | ||
1706 | struct mv_host_priv *hpriv = ap->host_set->private_data; | ||
1707 | void __iomem *mmio = ap->host_set->mmio_base; | ||
1708 | |||
1709 | mv_stop_dma(ap); | ||
1710 | |||
1711 | mv_channel_reset(hpriv, mmio, ap->port_no); | ||
1712 | |||
1713 | __mv_phy_reset(ap, 0); | ||
1714 | } | ||
1715 | |||
1716 | static inline void __msleep(unsigned int msec, int can_sleep) | ||
1717 | { | ||
1718 | if (can_sleep) | ||
1719 | msleep(msec); | ||
1720 | else | ||
1721 | mdelay(msec); | ||
1722 | } | ||
1723 | |||
1205 | /** | 1724 | /** |
1206 | * mv_phy_reset - Perform eDMA reset followed by COMRESET | 1725 | * __mv_phy_reset - Perform eDMA reset followed by COMRESET |
1207 | * @ap: ATA channel to manipulate | 1726 | * @ap: ATA channel to manipulate |
1208 | * | 1727 | * |
1209 | * Part of this is taken from __sata_phy_reset and modified to | 1728 | * Part of this is taken from __sata_phy_reset and modified to |
@@ -1213,41 +1732,47 @@ static irqreturn_t mv_interrupt(int irq, void *dev_instance, | |||
1213 | * Inherited from caller. This is coded to safe to call at | 1732 | * Inherited from caller. This is coded to safe to call at |
1214 | * interrupt level, i.e. it does not sleep. | 1733 | * interrupt level, i.e. it does not sleep. |
1215 | */ | 1734 | */ |
1216 | static void mv_phy_reset(struct ata_port *ap) | 1735 | static void __mv_phy_reset(struct ata_port *ap, int can_sleep) |
1217 | { | 1736 | { |
1737 | struct mv_port_priv *pp = ap->private_data; | ||
1738 | struct mv_host_priv *hpriv = ap->host_set->private_data; | ||
1218 | void __iomem *port_mmio = mv_ap_base(ap); | 1739 | void __iomem *port_mmio = mv_ap_base(ap); |
1219 | struct ata_taskfile tf; | 1740 | struct ata_taskfile tf; |
1220 | struct ata_device *dev = &ap->device[0]; | 1741 | struct ata_device *dev = &ap->device[0]; |
1221 | unsigned long timeout; | 1742 | unsigned long timeout; |
1743 | int retry = 5; | ||
1744 | u32 sstatus; | ||
1222 | 1745 | ||
1223 | VPRINTK("ENTER, port %u, mmio 0x%p\n", ap->port_no, port_mmio); | 1746 | VPRINTK("ENTER, port %u, mmio 0x%p\n", ap->port_no, port_mmio); |
1224 | 1747 | ||
1225 | mv_stop_dma(ap); | 1748 | DPRINTK("S-regs after ATA_RST: SStat 0x%08x SErr 0x%08x " |
1226 | |||
1227 | writelfl(ATA_RST, port_mmio + EDMA_CMD_OFS); | ||
1228 | udelay(25); /* allow reset propagation */ | ||
1229 | |||
1230 | /* Spec never mentions clearing the bit. Marvell's driver does | ||
1231 | * clear the bit, however. | ||
1232 | */ | ||
1233 | writelfl(0, port_mmio + EDMA_CMD_OFS); | ||
1234 | |||
1235 | VPRINTK("S-regs after ATA_RST: SStat 0x%08x SErr 0x%08x " | ||
1236 | "SCtrl 0x%08x\n", mv_scr_read(ap, SCR_STATUS), | 1749 | "SCtrl 0x%08x\n", mv_scr_read(ap, SCR_STATUS), |
1237 | mv_scr_read(ap, SCR_ERROR), mv_scr_read(ap, SCR_CONTROL)); | 1750 | mv_scr_read(ap, SCR_ERROR), mv_scr_read(ap, SCR_CONTROL)); |
1238 | 1751 | ||
1239 | /* proceed to init communications via the scr_control reg */ | 1752 | /* Issue COMRESET via SControl */ |
1753 | comreset_retry: | ||
1240 | scr_write_flush(ap, SCR_CONTROL, 0x301); | 1754 | scr_write_flush(ap, SCR_CONTROL, 0x301); |
1241 | mdelay(1); | 1755 | __msleep(1, can_sleep); |
1756 | |||
1242 | scr_write_flush(ap, SCR_CONTROL, 0x300); | 1757 | scr_write_flush(ap, SCR_CONTROL, 0x300); |
1243 | timeout = jiffies + (HZ * 1); | 1758 | __msleep(20, can_sleep); |
1759 | |||
1760 | timeout = jiffies + msecs_to_jiffies(200); | ||
1244 | do { | 1761 | do { |
1245 | mdelay(10); | 1762 | sstatus = scr_read(ap, SCR_STATUS) & 0x3; |
1246 | if ((scr_read(ap, SCR_STATUS) & 0xf) != 1) | 1763 | if ((sstatus == 3) || (sstatus == 0)) |
1247 | break; | 1764 | break; |
1765 | |||
1766 | __msleep(1, can_sleep); | ||
1248 | } while (time_before(jiffies, timeout)); | 1767 | } while (time_before(jiffies, timeout)); |
1249 | 1768 | ||
1250 | VPRINTK("S-regs after PHY wake: SStat 0x%08x SErr 0x%08x " | 1769 | /* work around errata */ |
1770 | if (IS_60XX(hpriv) && | ||
1771 | (sstatus != 0x0) && (sstatus != 0x113) && (sstatus != 0x123) && | ||
1772 | (retry-- > 0)) | ||
1773 | goto comreset_retry; | ||
1774 | |||
1775 | DPRINTK("S-regs after PHY wake: SStat 0x%08x SErr 0x%08x " | ||
1251 | "SCtrl 0x%08x\n", mv_scr_read(ap, SCR_STATUS), | 1776 | "SCtrl 0x%08x\n", mv_scr_read(ap, SCR_STATUS), |
1252 | mv_scr_read(ap, SCR_ERROR), mv_scr_read(ap, SCR_CONTROL)); | 1777 | mv_scr_read(ap, SCR_ERROR), mv_scr_read(ap, SCR_CONTROL)); |
1253 | 1778 | ||
@@ -1261,6 +1786,21 @@ static void mv_phy_reset(struct ata_port *ap) | |||
1261 | } | 1786 | } |
1262 | ap->cbl = ATA_CBL_SATA; | 1787 | ap->cbl = ATA_CBL_SATA; |
1263 | 1788 | ||
1789 | /* even after SStatus reflects that device is ready, | ||
1790 | * it seems to take a while for link to be fully | ||
1791 | * established (and thus Status no longer 0x80/0x7F), | ||
1792 | * so we poll a bit for that, here. | ||
1793 | */ | ||
1794 | retry = 20; | ||
1795 | while (1) { | ||
1796 | u8 drv_stat = ata_check_status(ap); | ||
1797 | if ((drv_stat != 0x80) && (drv_stat != 0x7f)) | ||
1798 | break; | ||
1799 | __msleep(500, can_sleep); | ||
1800 | if (retry-- <= 0) | ||
1801 | break; | ||
1802 | } | ||
1803 | |||
1264 | tf.lbah = readb((void __iomem *) ap->ioaddr.lbah_addr); | 1804 | tf.lbah = readb((void __iomem *) ap->ioaddr.lbah_addr); |
1265 | tf.lbam = readb((void __iomem *) ap->ioaddr.lbam_addr); | 1805 | tf.lbam = readb((void __iomem *) ap->ioaddr.lbam_addr); |
1266 | tf.lbal = readb((void __iomem *) ap->ioaddr.lbal_addr); | 1806 | tf.lbal = readb((void __iomem *) ap->ioaddr.lbal_addr); |
@@ -1271,9 +1811,19 @@ static void mv_phy_reset(struct ata_port *ap) | |||
1271 | VPRINTK("Port disabled post-sig: No device present.\n"); | 1811 | VPRINTK("Port disabled post-sig: No device present.\n"); |
1272 | ata_port_disable(ap); | 1812 | ata_port_disable(ap); |
1273 | } | 1813 | } |
1814 | |||
1815 | writelfl(0, port_mmio + EDMA_ERR_IRQ_CAUSE_OFS); | ||
1816 | |||
1817 | pp->pp_flags &= ~MV_PP_FLAG_EDMA_EN; | ||
1818 | |||
1274 | VPRINTK("EXIT\n"); | 1819 | VPRINTK("EXIT\n"); |
1275 | } | 1820 | } |
1276 | 1821 | ||
1822 | static void mv_phy_reset(struct ata_port *ap) | ||
1823 | { | ||
1824 | __mv_phy_reset(ap, 1); | ||
1825 | } | ||
1826 | |||
1277 | /** | 1827 | /** |
1278 | * mv_eng_timeout - Routine called by libata when SCSI times out I/O | 1828 | * mv_eng_timeout - Routine called by libata when SCSI times out I/O |
1279 | * @ap: ATA channel to manipulate | 1829 | * @ap: ATA channel to manipulate |
@@ -1291,16 +1841,16 @@ static void mv_eng_timeout(struct ata_port *ap) | |||
1291 | 1841 | ||
1292 | printk(KERN_ERR "ata%u: Entering mv_eng_timeout\n",ap->id); | 1842 | printk(KERN_ERR "ata%u: Entering mv_eng_timeout\n",ap->id); |
1293 | DPRINTK("All regs @ start of eng_timeout\n"); | 1843 | DPRINTK("All regs @ start of eng_timeout\n"); |
1294 | mv_dump_all_regs(ap->host_set->mmio_base, ap->port_no, | 1844 | mv_dump_all_regs(ap->host_set->mmio_base, ap->port_no, |
1295 | to_pci_dev(ap->host_set->dev)); | 1845 | to_pci_dev(ap->host_set->dev)); |
1296 | 1846 | ||
1297 | qc = ata_qc_from_tag(ap, ap->active_tag); | 1847 | qc = ata_qc_from_tag(ap, ap->active_tag); |
1298 | printk(KERN_ERR "mmio_base %p ap %p qc %p scsi_cmnd %p &cmnd %p\n", | 1848 | printk(KERN_ERR "mmio_base %p ap %p qc %p scsi_cmnd %p &cmnd %p\n", |
1299 | ap->host_set->mmio_base, ap, qc, qc->scsicmd, | 1849 | ap->host_set->mmio_base, ap, qc, qc->scsicmd, |
1300 | &qc->scsicmd->cmnd); | 1850 | &qc->scsicmd->cmnd); |
1301 | 1851 | ||
1302 | mv_err_intr(ap); | 1852 | mv_err_intr(ap); |
1303 | mv_phy_reset(ap); | 1853 | mv_stop_and_reset(ap); |
1304 | 1854 | ||
1305 | if (!qc) { | 1855 | if (!qc) { |
1306 | printk(KERN_ERR "ata%u: BUG: timeout without command\n", | 1856 | printk(KERN_ERR "ata%u: BUG: timeout without command\n", |
@@ -1336,17 +1886,17 @@ static void mv_port_init(struct ata_ioports *port, void __iomem *port_mmio) | |||
1336 | unsigned long shd_base = (unsigned long) port_mmio + SHD_BLK_OFS; | 1886 | unsigned long shd_base = (unsigned long) port_mmio + SHD_BLK_OFS; |
1337 | unsigned serr_ofs; | 1887 | unsigned serr_ofs; |
1338 | 1888 | ||
1339 | /* PIO related setup | 1889 | /* PIO related setup |
1340 | */ | 1890 | */ |
1341 | port->data_addr = shd_base + (sizeof(u32) * ATA_REG_DATA); | 1891 | port->data_addr = shd_base + (sizeof(u32) * ATA_REG_DATA); |
1342 | port->error_addr = | 1892 | port->error_addr = |
1343 | port->feature_addr = shd_base + (sizeof(u32) * ATA_REG_ERR); | 1893 | port->feature_addr = shd_base + (sizeof(u32) * ATA_REG_ERR); |
1344 | port->nsect_addr = shd_base + (sizeof(u32) * ATA_REG_NSECT); | 1894 | port->nsect_addr = shd_base + (sizeof(u32) * ATA_REG_NSECT); |
1345 | port->lbal_addr = shd_base + (sizeof(u32) * ATA_REG_LBAL); | 1895 | port->lbal_addr = shd_base + (sizeof(u32) * ATA_REG_LBAL); |
1346 | port->lbam_addr = shd_base + (sizeof(u32) * ATA_REG_LBAM); | 1896 | port->lbam_addr = shd_base + (sizeof(u32) * ATA_REG_LBAM); |
1347 | port->lbah_addr = shd_base + (sizeof(u32) * ATA_REG_LBAH); | 1897 | port->lbah_addr = shd_base + (sizeof(u32) * ATA_REG_LBAH); |
1348 | port->device_addr = shd_base + (sizeof(u32) * ATA_REG_DEVICE); | 1898 | port->device_addr = shd_base + (sizeof(u32) * ATA_REG_DEVICE); |
1349 | port->status_addr = | 1899 | port->status_addr = |
1350 | port->command_addr = shd_base + (sizeof(u32) * ATA_REG_STATUS); | 1900 | port->command_addr = shd_base + (sizeof(u32) * ATA_REG_STATUS); |
1351 | /* special case: control/altstatus doesn't have ATA_REG_ address */ | 1901 | /* special case: control/altstatus doesn't have ATA_REG_ address */ |
1352 | port->altstatus_addr = port->ctl_addr = shd_base + SHD_CTL_AST_OFS; | 1902 | port->altstatus_addr = port->ctl_addr = shd_base + SHD_CTL_AST_OFS; |
@@ -1362,14 +1912,92 @@ static void mv_port_init(struct ata_ioports *port, void __iomem *port_mmio) | |||
1362 | /* unmask all EDMA error interrupts */ | 1912 | /* unmask all EDMA error interrupts */ |
1363 | writelfl(~0, port_mmio + EDMA_ERR_IRQ_MASK_OFS); | 1913 | writelfl(~0, port_mmio + EDMA_ERR_IRQ_MASK_OFS); |
1364 | 1914 | ||
1365 | VPRINTK("EDMA cfg=0x%08x EDMA IRQ err cause/mask=0x%08x/0x%08x\n", | 1915 | VPRINTK("EDMA cfg=0x%08x EDMA IRQ err cause/mask=0x%08x/0x%08x\n", |
1366 | readl(port_mmio + EDMA_CFG_OFS), | 1916 | readl(port_mmio + EDMA_CFG_OFS), |
1367 | readl(port_mmio + EDMA_ERR_IRQ_CAUSE_OFS), | 1917 | readl(port_mmio + EDMA_ERR_IRQ_CAUSE_OFS), |
1368 | readl(port_mmio + EDMA_ERR_IRQ_MASK_OFS)); | 1918 | readl(port_mmio + EDMA_ERR_IRQ_MASK_OFS)); |
1369 | } | 1919 | } |
1370 | 1920 | ||
1921 | static int mv_chip_id(struct pci_dev *pdev, struct mv_host_priv *hpriv, | ||
1922 | unsigned int board_idx) | ||
1923 | { | ||
1924 | u8 rev_id; | ||
1925 | u32 hp_flags = hpriv->hp_flags; | ||
1926 | |||
1927 | pci_read_config_byte(pdev, PCI_REVISION_ID, &rev_id); | ||
1928 | |||
1929 | switch(board_idx) { | ||
1930 | case chip_5080: | ||
1931 | hpriv->ops = &mv5xxx_ops; | ||
1932 | hp_flags |= MV_HP_50XX; | ||
1933 | |||
1934 | switch (rev_id) { | ||
1935 | case 0x1: | ||
1936 | hp_flags |= MV_HP_ERRATA_50XXB0; | ||
1937 | break; | ||
1938 | case 0x3: | ||
1939 | hp_flags |= MV_HP_ERRATA_50XXB2; | ||
1940 | break; | ||
1941 | default: | ||
1942 | dev_printk(KERN_WARNING, &pdev->dev, | ||
1943 | "Applying 50XXB2 workarounds to unknown rev\n"); | ||
1944 | hp_flags |= MV_HP_ERRATA_50XXB2; | ||
1945 | break; | ||
1946 | } | ||
1947 | break; | ||
1948 | |||
1949 | case chip_504x: | ||
1950 | case chip_508x: | ||
1951 | hpriv->ops = &mv5xxx_ops; | ||
1952 | hp_flags |= MV_HP_50XX; | ||
1953 | |||
1954 | switch (rev_id) { | ||
1955 | case 0x0: | ||
1956 | hp_flags |= MV_HP_ERRATA_50XXB0; | ||
1957 | break; | ||
1958 | case 0x3: | ||
1959 | hp_flags |= MV_HP_ERRATA_50XXB2; | ||
1960 | break; | ||
1961 | default: | ||
1962 | dev_printk(KERN_WARNING, &pdev->dev, | ||
1963 | "Applying B2 workarounds to unknown rev\n"); | ||
1964 | hp_flags |= MV_HP_ERRATA_50XXB2; | ||
1965 | break; | ||
1966 | } | ||
1967 | break; | ||
1968 | |||
1969 | case chip_604x: | ||
1970 | case chip_608x: | ||
1971 | hpriv->ops = &mv6xxx_ops; | ||
1972 | |||
1973 | switch (rev_id) { | ||
1974 | case 0x7: | ||
1975 | hp_flags |= MV_HP_ERRATA_60X1B2; | ||
1976 | break; | ||
1977 | case 0x9: | ||
1978 | hp_flags |= MV_HP_ERRATA_60X1C0; | ||
1979 | break; | ||
1980 | default: | ||
1981 | dev_printk(KERN_WARNING, &pdev->dev, | ||
1982 | "Applying B2 workarounds to unknown rev\n"); | ||
1983 | hp_flags |= MV_HP_ERRATA_60X1B2; | ||
1984 | break; | ||
1985 | } | ||
1986 | break; | ||
1987 | |||
1988 | default: | ||
1989 | printk(KERN_ERR DRV_NAME ": BUG: invalid board index %u\n", board_idx); | ||
1990 | return 1; | ||
1991 | } | ||
1992 | |||
1993 | hpriv->hp_flags = hp_flags; | ||
1994 | |||
1995 | return 0; | ||
1996 | } | ||
1997 | |||
1371 | /** | 1998 | /** |
1372 | * mv_host_init - Perform some early initialization of the host. | 1999 | * mv_init_host - Perform some early initialization of the host. |
2000 | * @pdev: host PCI device | ||
1373 | * @probe_ent: early data struct representing the host | 2001 | * @probe_ent: early data struct representing the host |
1374 | * | 2002 | * |
1375 | * If possible, do an early global reset of the host. Then do | 2003 | * If possible, do an early global reset of the host. Then do |
@@ -1378,23 +2006,48 @@ static void mv_port_init(struct ata_ioports *port, void __iomem *port_mmio) | |||
1378 | * LOCKING: | 2006 | * LOCKING: |
1379 | * Inherited from caller. | 2007 | * Inherited from caller. |
1380 | */ | 2008 | */ |
1381 | static int mv_host_init(struct ata_probe_ent *probe_ent) | 2009 | static int mv_init_host(struct pci_dev *pdev, struct ata_probe_ent *probe_ent, |
2010 | unsigned int board_idx) | ||
1382 | { | 2011 | { |
1383 | int rc = 0, n_hc, port, hc; | 2012 | int rc = 0, n_hc, port, hc; |
1384 | void __iomem *mmio = probe_ent->mmio_base; | 2013 | void __iomem *mmio = probe_ent->mmio_base; |
1385 | void __iomem *port_mmio; | 2014 | struct mv_host_priv *hpriv = probe_ent->private_data; |
1386 | 2015 | ||
1387 | if ((MV_FLAG_GLBL_SFT_RST & probe_ent->host_flags) && | 2016 | /* global interrupt mask */ |
1388 | mv_global_soft_reset(probe_ent->mmio_base)) { | 2017 | writel(0, mmio + HC_MAIN_IRQ_MASK_OFS); |
1389 | rc = 1; | 2018 | |
2019 | rc = mv_chip_id(pdev, hpriv, board_idx); | ||
2020 | if (rc) | ||
1390 | goto done; | 2021 | goto done; |
1391 | } | ||
1392 | 2022 | ||
1393 | n_hc = mv_get_hc_count(probe_ent->host_flags); | 2023 | n_hc = mv_get_hc_count(probe_ent->host_flags); |
1394 | probe_ent->n_ports = MV_PORTS_PER_HC * n_hc; | 2024 | probe_ent->n_ports = MV_PORTS_PER_HC * n_hc; |
1395 | 2025 | ||
2026 | for (port = 0; port < probe_ent->n_ports; port++) | ||
2027 | hpriv->ops->read_preamp(hpriv, port, mmio); | ||
2028 | |||
2029 | rc = hpriv->ops->reset_hc(hpriv, mmio, n_hc); | ||
2030 | if (rc) | ||
2031 | goto done; | ||
2032 | |||
2033 | hpriv->ops->reset_flash(hpriv, mmio); | ||
2034 | hpriv->ops->reset_bus(pdev, mmio); | ||
2035 | hpriv->ops->enable_leds(hpriv, mmio); | ||
2036 | |||
1396 | for (port = 0; port < probe_ent->n_ports; port++) { | 2037 | for (port = 0; port < probe_ent->n_ports; port++) { |
1397 | port_mmio = mv_port_base(mmio, port); | 2038 | if (IS_60XX(hpriv)) { |
2039 | void __iomem *port_mmio = mv_port_base(mmio, port); | ||
2040 | |||
2041 | u32 ifctl = readl(port_mmio + SATA_INTERFACE_CTL); | ||
2042 | ifctl |= (1 << 12); | ||
2043 | writelfl(ifctl, port_mmio + SATA_INTERFACE_CTL); | ||
2044 | } | ||
2045 | |||
2046 | hpriv->ops->phy_errata(hpriv, mmio, port); | ||
2047 | } | ||
2048 | |||
2049 | for (port = 0; port < probe_ent->n_ports; port++) { | ||
2050 | void __iomem *port_mmio = mv_port_base(mmio, port); | ||
1398 | mv_port_init(&probe_ent->port[port], port_mmio); | 2051 | mv_port_init(&probe_ent->port[port], port_mmio); |
1399 | } | 2052 | } |
1400 | 2053 | ||
@@ -1418,11 +2071,12 @@ static int mv_host_init(struct ata_probe_ent *probe_ent) | |||
1418 | writelfl(~HC_MAIN_MASKED_IRQS, mmio + HC_MAIN_IRQ_MASK_OFS); | 2071 | writelfl(~HC_MAIN_MASKED_IRQS, mmio + HC_MAIN_IRQ_MASK_OFS); |
1419 | 2072 | ||
1420 | VPRINTK("HC MAIN IRQ cause/mask=0x%08x/0x%08x " | 2073 | VPRINTK("HC MAIN IRQ cause/mask=0x%08x/0x%08x " |
1421 | "PCI int cause/mask=0x%08x/0x%08x\n", | 2074 | "PCI int cause/mask=0x%08x/0x%08x\n", |
1422 | readl(mmio + HC_MAIN_IRQ_CAUSE_OFS), | 2075 | readl(mmio + HC_MAIN_IRQ_CAUSE_OFS), |
1423 | readl(mmio + HC_MAIN_IRQ_MASK_OFS), | 2076 | readl(mmio + HC_MAIN_IRQ_MASK_OFS), |
1424 | readl(mmio + PCI_IRQ_CAUSE_OFS), | 2077 | readl(mmio + PCI_IRQ_CAUSE_OFS), |
1425 | readl(mmio + PCI_IRQ_MASK_OFS)); | 2078 | readl(mmio + PCI_IRQ_MASK_OFS)); |
2079 | |||
1426 | done: | 2080 | done: |
1427 | return rc; | 2081 | return rc; |
1428 | } | 2082 | } |
@@ -1458,7 +2112,7 @@ static void mv_print_info(struct ata_probe_ent *probe_ent) | |||
1458 | 2112 | ||
1459 | dev_printk(KERN_INFO, &pdev->dev, | 2113 | dev_printk(KERN_INFO, &pdev->dev, |
1460 | "%u slots %u ports %s mode IRQ via %s\n", | 2114 | "%u slots %u ports %s mode IRQ via %s\n", |
1461 | (unsigned)MV_MAX_Q_DEPTH, probe_ent->n_ports, | 2115 | (unsigned)MV_MAX_Q_DEPTH, probe_ent->n_ports, |
1462 | scc_s, (MV_HP_FLAG_MSI & hpriv->hp_flags) ? "MSI" : "INTx"); | 2116 | scc_s, (MV_HP_FLAG_MSI & hpriv->hp_flags) ? "MSI" : "INTx"); |
1463 | } | 2117 | } |
1464 | 2118 | ||
@@ -1528,7 +2182,7 @@ static int mv_init_one(struct pci_dev *pdev, const struct pci_device_id *ent) | |||
1528 | probe_ent->private_data = hpriv; | 2182 | probe_ent->private_data = hpriv; |
1529 | 2183 | ||
1530 | /* initialize adapter */ | 2184 | /* initialize adapter */ |
1531 | rc = mv_host_init(probe_ent); | 2185 | rc = mv_init_host(pdev, probe_ent, board_idx); |
1532 | if (rc) { | 2186 | if (rc) { |
1533 | goto err_out_hpriv; | 2187 | goto err_out_hpriv; |
1534 | } | 2188 | } |
diff --git a/drivers/scsi/sata_promise.c b/drivers/scsi/sata_promise.c index 242d906987ad..8a8e3e3ef0ed 100644 --- a/drivers/scsi/sata_promise.c +++ b/drivers/scsi/sata_promise.c | |||
@@ -46,7 +46,7 @@ | |||
46 | #include "sata_promise.h" | 46 | #include "sata_promise.h" |
47 | 47 | ||
48 | #define DRV_NAME "sata_promise" | 48 | #define DRV_NAME "sata_promise" |
49 | #define DRV_VERSION "1.02" | 49 | #define DRV_VERSION "1.03" |
50 | 50 | ||
51 | 51 | ||
52 | enum { | 52 | enum { |
diff --git a/drivers/scsi/sata_qstor.c b/drivers/scsi/sata_qstor.c index 4a6d3067d23c..a8987f5ff5cc 100644 --- a/drivers/scsi/sata_qstor.c +++ b/drivers/scsi/sata_qstor.c | |||
@@ -41,7 +41,7 @@ | |||
41 | #include <linux/libata.h> | 41 | #include <linux/libata.h> |
42 | 42 | ||
43 | #define DRV_NAME "sata_qstor" | 43 | #define DRV_NAME "sata_qstor" |
44 | #define DRV_VERSION "0.04" | 44 | #define DRV_VERSION "0.05" |
45 | 45 | ||
46 | enum { | 46 | enum { |
47 | QS_PORTS = 4, | 47 | QS_PORTS = 4, |
diff --git a/drivers/scsi/sata_sil24.c b/drivers/scsi/sata_sil24.c index 55e744d6db88..e0d6f194f54f 100644 --- a/drivers/scsi/sata_sil24.c +++ b/drivers/scsi/sata_sil24.c | |||
@@ -5,17 +5,6 @@ | |||
5 | * | 5 | * |
6 | * Based on preview driver from Silicon Image. | 6 | * Based on preview driver from Silicon Image. |
7 | * | 7 | * |
8 | * NOTE: No NCQ/ATAPI support yet. The preview driver didn't support | ||
9 | * NCQ nor ATAPI, and, unfortunately, I couldn't find out how to make | ||
10 | * those work. Enabling those shouldn't be difficult. Basic | ||
11 | * structure is all there (in libata-dev tree). If you have any | ||
12 | * information about this hardware, please contact me or linux-ide. | ||
13 | * Info is needed on... | ||
14 | * | ||
15 | * - How to issue tagged commands and turn on sactive on issue accordingly. | ||
16 | * - Where to put an ATAPI command and how to tell the device to send it. | ||
17 | * - How to enable/use 64bit. | ||
18 | * | ||
19 | * This program is free software; you can redistribute it and/or modify it | 8 | * This program is free software; you can redistribute it and/or modify it |
20 | * under the terms of the GNU General Public License as published by the | 9 | * under the terms of the GNU General Public License as published by the |
21 | * Free Software Foundation; either version 2, or (at your option) any | 10 | * Free Software Foundation; either version 2, or (at your option) any |
@@ -42,7 +31,7 @@ | |||
42 | #include <asm/io.h> | 31 | #include <asm/io.h> |
43 | 32 | ||
44 | #define DRV_NAME "sata_sil24" | 33 | #define DRV_NAME "sata_sil24" |
45 | #define DRV_VERSION "0.22" /* Silicon Image's preview driver was 0.10 */ | 34 | #define DRV_VERSION "0.23" |
46 | 35 | ||
47 | /* | 36 | /* |
48 | * Port request block (PRB) 32 bytes | 37 | * Port request block (PRB) 32 bytes |
@@ -139,6 +128,7 @@ enum { | |||
139 | PORT_CS_DEV_RST = (1 << 1), /* device reset */ | 128 | PORT_CS_DEV_RST = (1 << 1), /* device reset */ |
140 | PORT_CS_INIT = (1 << 2), /* port initialize */ | 129 | PORT_CS_INIT = (1 << 2), /* port initialize */ |
141 | PORT_CS_IRQ_WOC = (1 << 3), /* interrupt write one to clear */ | 130 | PORT_CS_IRQ_WOC = (1 << 3), /* interrupt write one to clear */ |
131 | PORT_CS_CDB16 = (1 << 5), /* 0=12b cdb, 1=16b cdb */ | ||
142 | PORT_CS_RESUME = (1 << 6), /* port resume */ | 132 | PORT_CS_RESUME = (1 << 6), /* port resume */ |
143 | PORT_CS_32BIT_ACTV = (1 << 10), /* 32-bit activation */ | 133 | PORT_CS_32BIT_ACTV = (1 << 10), /* 32-bit activation */ |
144 | PORT_CS_PM_EN = (1 << 13), /* port multiplier enable */ | 134 | PORT_CS_PM_EN = (1 << 13), /* port multiplier enable */ |
@@ -188,11 +178,29 @@ enum { | |||
188 | PORT_CERR_XFR_PCIPERR = 35, /* PSD ecode 11 - PCI prity err during transfer */ | 178 | PORT_CERR_XFR_PCIPERR = 35, /* PSD ecode 11 - PCI prity err during transfer */ |
189 | PORT_CERR_SENDSERVICE = 36, /* FIS received while sending service */ | 179 | PORT_CERR_SENDSERVICE = 36, /* FIS received while sending service */ |
190 | 180 | ||
181 | /* bits of PRB control field */ | ||
182 | PRB_CTRL_PROTOCOL = (1 << 0), /* override def. ATA protocol */ | ||
183 | PRB_CTRL_PACKET_READ = (1 << 4), /* PACKET cmd read */ | ||
184 | PRB_CTRL_PACKET_WRITE = (1 << 5), /* PACKET cmd write */ | ||
185 | PRB_CTRL_NIEN = (1 << 6), /* Mask completion irq */ | ||
186 | PRB_CTRL_SRST = (1 << 7), /* Soft reset request (ign BSY?) */ | ||
187 | |||
188 | /* PRB protocol field */ | ||
189 | PRB_PROT_PACKET = (1 << 0), | ||
190 | PRB_PROT_TCQ = (1 << 1), | ||
191 | PRB_PROT_NCQ = (1 << 2), | ||
192 | PRB_PROT_READ = (1 << 3), | ||
193 | PRB_PROT_WRITE = (1 << 4), | ||
194 | PRB_PROT_TRANSPARENT = (1 << 5), | ||
195 | |||
191 | /* | 196 | /* |
192 | * Other constants | 197 | * Other constants |
193 | */ | 198 | */ |
194 | SGE_TRM = (1 << 31), /* Last SGE in chain */ | 199 | SGE_TRM = (1 << 31), /* Last SGE in chain */ |
195 | PRB_SOFT_RST = (1 << 7), /* Soft reset request (ign BSY?) */ | 200 | SGE_LNK = (1 << 30), /* linked list |
201 | Points to SGT, not SGE */ | ||
202 | SGE_DRD = (1 << 29), /* discard data read (/dev/null) | ||
203 | data address ignored */ | ||
196 | 204 | ||
197 | /* board id */ | 205 | /* board id */ |
198 | BID_SIL3124 = 0, | 206 | BID_SIL3124 = 0, |
@@ -202,11 +210,22 @@ enum { | |||
202 | IRQ_STAT_4PORTS = 0xf, | 210 | IRQ_STAT_4PORTS = 0xf, |
203 | }; | 211 | }; |
204 | 212 | ||
205 | struct sil24_cmd_block { | 213 | struct sil24_ata_block { |
206 | struct sil24_prb prb; | 214 | struct sil24_prb prb; |
207 | struct sil24_sge sge[LIBATA_MAX_PRD]; | 215 | struct sil24_sge sge[LIBATA_MAX_PRD]; |
208 | }; | 216 | }; |
209 | 217 | ||
218 | struct sil24_atapi_block { | ||
219 | struct sil24_prb prb; | ||
220 | u8 cdb[16]; | ||
221 | struct sil24_sge sge[LIBATA_MAX_PRD - 1]; | ||
222 | }; | ||
223 | |||
224 | union sil24_cmd_block { | ||
225 | struct sil24_ata_block ata; | ||
226 | struct sil24_atapi_block atapi; | ||
227 | }; | ||
228 | |||
210 | /* | 229 | /* |
211 | * ap->private_data | 230 | * ap->private_data |
212 | * | 231 | * |
@@ -214,7 +233,7 @@ struct sil24_cmd_block { | |||
214 | * here from the previous interrupt. | 233 | * here from the previous interrupt. |
215 | */ | 234 | */ |
216 | struct sil24_port_priv { | 235 | struct sil24_port_priv { |
217 | struct sil24_cmd_block *cmd_block; /* 32 cmd blocks */ | 236 | union sil24_cmd_block *cmd_block; /* 32 cmd blocks */ |
218 | dma_addr_t cmd_block_dma; /* DMA base addr for them */ | 237 | dma_addr_t cmd_block_dma; /* DMA base addr for them */ |
219 | struct ata_taskfile tf; /* Cached taskfile registers */ | 238 | struct ata_taskfile tf; /* Cached taskfile registers */ |
220 | }; | 239 | }; |
@@ -225,6 +244,7 @@ struct sil24_host_priv { | |||
225 | void __iomem *port_base; /* port registers (4 * 8192 bytes @BAR2) */ | 244 | void __iomem *port_base; /* port registers (4 * 8192 bytes @BAR2) */ |
226 | }; | 245 | }; |
227 | 246 | ||
247 | static void sil24_dev_config(struct ata_port *ap, struct ata_device *dev); | ||
228 | static u8 sil24_check_status(struct ata_port *ap); | 248 | static u8 sil24_check_status(struct ata_port *ap); |
229 | static u32 sil24_scr_read(struct ata_port *ap, unsigned sc_reg); | 249 | static u32 sil24_scr_read(struct ata_port *ap, unsigned sc_reg); |
230 | static void sil24_scr_write(struct ata_port *ap, unsigned sc_reg, u32 val); | 250 | static void sil24_scr_write(struct ata_port *ap, unsigned sc_reg, u32 val); |
@@ -278,6 +298,8 @@ static struct scsi_host_template sil24_sht = { | |||
278 | static const struct ata_port_operations sil24_ops = { | 298 | static const struct ata_port_operations sil24_ops = { |
279 | .port_disable = ata_port_disable, | 299 | .port_disable = ata_port_disable, |
280 | 300 | ||
301 | .dev_config = sil24_dev_config, | ||
302 | |||
281 | .check_status = sil24_check_status, | 303 | .check_status = sil24_check_status, |
282 | .check_altstatus = sil24_check_status, | 304 | .check_altstatus = sil24_check_status, |
283 | .dev_select = ata_noop_dev_select, | 305 | .dev_select = ata_noop_dev_select, |
@@ -314,7 +336,7 @@ static struct ata_port_info sil24_port_info[] = { | |||
314 | { | 336 | { |
315 | .sht = &sil24_sht, | 337 | .sht = &sil24_sht, |
316 | .host_flags = ATA_FLAG_SATA | ATA_FLAG_NO_LEGACY | | 338 | .host_flags = ATA_FLAG_SATA | ATA_FLAG_NO_LEGACY | |
317 | ATA_FLAG_SATA_RESET | ATA_FLAG_MMIO | | 339 | ATA_FLAG_SRST | ATA_FLAG_MMIO | |
318 | ATA_FLAG_PIO_DMA | SIL24_NPORTS2FLAG(4), | 340 | ATA_FLAG_PIO_DMA | SIL24_NPORTS2FLAG(4), |
319 | .pio_mask = 0x1f, /* pio0-4 */ | 341 | .pio_mask = 0x1f, /* pio0-4 */ |
320 | .mwdma_mask = 0x07, /* mwdma0-2 */ | 342 | .mwdma_mask = 0x07, /* mwdma0-2 */ |
@@ -325,7 +347,7 @@ static struct ata_port_info sil24_port_info[] = { | |||
325 | { | 347 | { |
326 | .sht = &sil24_sht, | 348 | .sht = &sil24_sht, |
327 | .host_flags = ATA_FLAG_SATA | ATA_FLAG_NO_LEGACY | | 349 | .host_flags = ATA_FLAG_SATA | ATA_FLAG_NO_LEGACY | |
328 | ATA_FLAG_SATA_RESET | ATA_FLAG_MMIO | | 350 | ATA_FLAG_SRST | ATA_FLAG_MMIO | |
329 | ATA_FLAG_PIO_DMA | SIL24_NPORTS2FLAG(2), | 351 | ATA_FLAG_PIO_DMA | SIL24_NPORTS2FLAG(2), |
330 | .pio_mask = 0x1f, /* pio0-4 */ | 352 | .pio_mask = 0x1f, /* pio0-4 */ |
331 | .mwdma_mask = 0x07, /* mwdma0-2 */ | 353 | .mwdma_mask = 0x07, /* mwdma0-2 */ |
@@ -336,7 +358,7 @@ static struct ata_port_info sil24_port_info[] = { | |||
336 | { | 358 | { |
337 | .sht = &sil24_sht, | 359 | .sht = &sil24_sht, |
338 | .host_flags = ATA_FLAG_SATA | ATA_FLAG_NO_LEGACY | | 360 | .host_flags = ATA_FLAG_SATA | ATA_FLAG_NO_LEGACY | |
339 | ATA_FLAG_SATA_RESET | ATA_FLAG_MMIO | | 361 | ATA_FLAG_SRST | ATA_FLAG_MMIO | |
340 | ATA_FLAG_PIO_DMA | SIL24_NPORTS2FLAG(1), | 362 | ATA_FLAG_PIO_DMA | SIL24_NPORTS2FLAG(1), |
341 | .pio_mask = 0x1f, /* pio0-4 */ | 363 | .pio_mask = 0x1f, /* pio0-4 */ |
342 | .mwdma_mask = 0x07, /* mwdma0-2 */ | 364 | .mwdma_mask = 0x07, /* mwdma0-2 */ |
@@ -345,6 +367,16 @@ static struct ata_port_info sil24_port_info[] = { | |||
345 | }, | 367 | }, |
346 | }; | 368 | }; |
347 | 369 | ||
370 | static void sil24_dev_config(struct ata_port *ap, struct ata_device *dev) | ||
371 | { | ||
372 | void __iomem *port = (void __iomem *)ap->ioaddr.cmd_addr; | ||
373 | |||
374 | if (ap->cdb_len == 16) | ||
375 | writel(PORT_CS_CDB16, port + PORT_CTRL_STAT); | ||
376 | else | ||
377 | writel(PORT_CS_CDB16, port + PORT_CTRL_CLR); | ||
378 | } | ||
379 | |||
348 | static inline void sil24_update_tf(struct ata_port *ap) | 380 | static inline void sil24_update_tf(struct ata_port *ap) |
349 | { | 381 | { |
350 | struct sil24_port_priv *pp = ap->private_data; | 382 | struct sil24_port_priv *pp = ap->private_data; |
@@ -396,22 +428,73 @@ static void sil24_tf_read(struct ata_port *ap, struct ata_taskfile *tf) | |||
396 | *tf = pp->tf; | 428 | *tf = pp->tf; |
397 | } | 429 | } |
398 | 430 | ||
399 | static void sil24_phy_reset(struct ata_port *ap) | 431 | static int sil24_issue_SRST(struct ata_port *ap) |
400 | { | 432 | { |
401 | __sata_phy_reset(ap); | 433 | void __iomem *port = (void __iomem *)ap->ioaddr.cmd_addr; |
434 | struct sil24_port_priv *pp = ap->private_data; | ||
435 | struct sil24_prb *prb = &pp->cmd_block[0].ata.prb; | ||
436 | dma_addr_t paddr = pp->cmd_block_dma; | ||
437 | u32 irq_enable, irq_stat; | ||
438 | int cnt; | ||
439 | |||
440 | /* temporarily turn off IRQs during SRST */ | ||
441 | irq_enable = readl(port + PORT_IRQ_ENABLE_SET); | ||
442 | writel(irq_enable, port + PORT_IRQ_ENABLE_CLR); | ||
443 | |||
402 | /* | 444 | /* |
403 | * No ATAPI yet. Just unconditionally indicate ATA device. | 445 | * XXX: Not sure whether the following sleep is needed or not. |
404 | * If ATAPI device is attached, it will fail ATA_CMD_ID_ATA | 446 | * The original driver had it. So.... |
405 | * and libata core will ignore the device. | ||
406 | */ | 447 | */ |
407 | if (!(ap->flags & ATA_FLAG_PORT_DISABLED)) | 448 | msleep(10); |
408 | ap->device[0].class = ATA_DEV_ATA; | 449 | |
450 | prb->ctrl = PRB_CTRL_SRST; | ||
451 | prb->fis[1] = 0; /* no PM yet */ | ||
452 | |||
453 | writel((u32)paddr, port + PORT_CMD_ACTIVATE); | ||
454 | |||
455 | for (cnt = 0; cnt < 100; cnt++) { | ||
456 | irq_stat = readl(port + PORT_IRQ_STAT); | ||
457 | writel(irq_stat, port + PORT_IRQ_STAT); /* clear irq */ | ||
458 | |||
459 | irq_stat >>= PORT_IRQ_RAW_SHIFT; | ||
460 | if (irq_stat & (PORT_IRQ_COMPLETE | PORT_IRQ_ERROR)) | ||
461 | break; | ||
462 | |||
463 | msleep(1); | ||
464 | } | ||
465 | |||
466 | /* restore IRQs */ | ||
467 | writel(irq_enable, port + PORT_IRQ_ENABLE_SET); | ||
468 | |||
469 | if (!(irq_stat & PORT_IRQ_COMPLETE)) | ||
470 | return -1; | ||
471 | |||
472 | /* update TF */ | ||
473 | sil24_update_tf(ap); | ||
474 | return 0; | ||
475 | } | ||
476 | |||
477 | static void sil24_phy_reset(struct ata_port *ap) | ||
478 | { | ||
479 | struct sil24_port_priv *pp = ap->private_data; | ||
480 | |||
481 | __sata_phy_reset(ap); | ||
482 | if (ap->flags & ATA_FLAG_PORT_DISABLED) | ||
483 | return; | ||
484 | |||
485 | if (sil24_issue_SRST(ap) < 0) { | ||
486 | printk(KERN_ERR DRV_NAME | ||
487 | " ata%u: SRST failed, disabling port\n", ap->id); | ||
488 | ap->ops->port_disable(ap); | ||
489 | return; | ||
490 | } | ||
491 | |||
492 | ap->device->class = ata_dev_classify(&pp->tf); | ||
409 | } | 493 | } |
410 | 494 | ||
411 | static inline void sil24_fill_sg(struct ata_queued_cmd *qc, | 495 | static inline void sil24_fill_sg(struct ata_queued_cmd *qc, |
412 | struct sil24_cmd_block *cb) | 496 | struct sil24_sge *sge) |
413 | { | 497 | { |
414 | struct sil24_sge *sge = cb->sge; | ||
415 | struct scatterlist *sg; | 498 | struct scatterlist *sg; |
416 | unsigned int idx = 0; | 499 | unsigned int idx = 0; |
417 | 500 | ||
@@ -432,23 +515,47 @@ static void sil24_qc_prep(struct ata_queued_cmd *qc) | |||
432 | { | 515 | { |
433 | struct ata_port *ap = qc->ap; | 516 | struct ata_port *ap = qc->ap; |
434 | struct sil24_port_priv *pp = ap->private_data; | 517 | struct sil24_port_priv *pp = ap->private_data; |
435 | struct sil24_cmd_block *cb = pp->cmd_block + qc->tag; | 518 | union sil24_cmd_block *cb = pp->cmd_block + qc->tag; |
436 | struct sil24_prb *prb = &cb->prb; | 519 | struct sil24_prb *prb; |
520 | struct sil24_sge *sge; | ||
437 | 521 | ||
438 | switch (qc->tf.protocol) { | 522 | switch (qc->tf.protocol) { |
439 | case ATA_PROT_PIO: | 523 | case ATA_PROT_PIO: |
440 | case ATA_PROT_DMA: | 524 | case ATA_PROT_DMA: |
441 | case ATA_PROT_NODATA: | 525 | case ATA_PROT_NODATA: |
526 | prb = &cb->ata.prb; | ||
527 | sge = cb->ata.sge; | ||
528 | prb->ctrl = 0; | ||
529 | break; | ||
530 | |||
531 | case ATA_PROT_ATAPI: | ||
532 | case ATA_PROT_ATAPI_DMA: | ||
533 | case ATA_PROT_ATAPI_NODATA: | ||
534 | prb = &cb->atapi.prb; | ||
535 | sge = cb->atapi.sge; | ||
536 | memset(cb->atapi.cdb, 0, 32); | ||
537 | memcpy(cb->atapi.cdb, qc->cdb, ap->cdb_len); | ||
538 | |||
539 | if (qc->tf.protocol != ATA_PROT_ATAPI_NODATA) { | ||
540 | if (qc->tf.flags & ATA_TFLAG_WRITE) | ||
541 | prb->ctrl = PRB_CTRL_PACKET_WRITE; | ||
542 | else | ||
543 | prb->ctrl = PRB_CTRL_PACKET_READ; | ||
544 | } else | ||
545 | prb->ctrl = 0; | ||
546 | |||
442 | break; | 547 | break; |
548 | |||
443 | default: | 549 | default: |
444 | /* ATAPI isn't supported yet */ | 550 | prb = NULL; /* shut up, gcc */ |
551 | sge = NULL; | ||
445 | BUG(); | 552 | BUG(); |
446 | } | 553 | } |
447 | 554 | ||
448 | ata_tf_to_fis(&qc->tf, prb->fis, 0); | 555 | ata_tf_to_fis(&qc->tf, prb->fis, 0); |
449 | 556 | ||
450 | if (qc->flags & ATA_QCFLAG_DMAMAP) | 557 | if (qc->flags & ATA_QCFLAG_DMAMAP) |
451 | sil24_fill_sg(qc, cb); | 558 | sil24_fill_sg(qc, sge); |
452 | } | 559 | } |
453 | 560 | ||
454 | static int sil24_qc_issue(struct ata_queued_cmd *qc) | 561 | static int sil24_qc_issue(struct ata_queued_cmd *qc) |
@@ -467,6 +574,31 @@ static void sil24_irq_clear(struct ata_port *ap) | |||
467 | /* unused */ | 574 | /* unused */ |
468 | } | 575 | } |
469 | 576 | ||
577 | static int __sil24_restart_controller(void __iomem *port) | ||
578 | { | ||
579 | u32 tmp; | ||
580 | int cnt; | ||
581 | |||
582 | writel(PORT_CS_INIT, port + PORT_CTRL_STAT); | ||
583 | |||
584 | /* Max ~10ms */ | ||
585 | for (cnt = 0; cnt < 10000; cnt++) { | ||
586 | tmp = readl(port + PORT_CTRL_STAT); | ||
587 | if (tmp & PORT_CS_RDY) | ||
588 | return 0; | ||
589 | udelay(1); | ||
590 | } | ||
591 | |||
592 | return -1; | ||
593 | } | ||
594 | |||
595 | static void sil24_restart_controller(struct ata_port *ap) | ||
596 | { | ||
597 | if (__sil24_restart_controller((void __iomem *)ap->ioaddr.cmd_addr)) | ||
598 | printk(KERN_ERR DRV_NAME | ||
599 | " ata%u: failed to restart controller\n", ap->id); | ||
600 | } | ||
601 | |||
470 | static int __sil24_reset_controller(void __iomem *port) | 602 | static int __sil24_reset_controller(void __iomem *port) |
471 | { | 603 | { |
472 | int cnt; | 604 | int cnt; |
@@ -486,7 +618,11 @@ static int __sil24_reset_controller(void __iomem *port) | |||
486 | 618 | ||
487 | if (tmp & PORT_CS_DEV_RST) | 619 | if (tmp & PORT_CS_DEV_RST) |
488 | return -1; | 620 | return -1; |
489 | return 0; | 621 | |
622 | if (tmp & PORT_CS_RDY) | ||
623 | return 0; | ||
624 | |||
625 | return __sil24_restart_controller(port); | ||
490 | } | 626 | } |
491 | 627 | ||
492 | static void sil24_reset_controller(struct ata_port *ap) | 628 | static void sil24_reset_controller(struct ata_port *ap) |
@@ -548,9 +684,15 @@ static void sil24_error_intr(struct ata_port *ap, u32 slot_stat) | |||
548 | if (serror) | 684 | if (serror) |
549 | writel(serror, port + PORT_SERROR); | 685 | writel(serror, port + PORT_SERROR); |
550 | 686 | ||
551 | printk(KERN_ERR DRV_NAME " ata%u: error interrupt on port%d\n" | 687 | /* |
552 | " stat=0x%x irq=0x%x cmd_err=%d sstatus=0x%x serror=0x%x\n", | 688 | * Don't log ATAPI device errors. They're supposed to happen |
553 | ap->id, ap->port_no, slot_stat, irq_stat, cmd_err, sstatus, serror); | 689 | * and any serious errors will be logged using sense data by |
690 | * the SCSI layer. | ||
691 | */ | ||
692 | if (ap->device[0].class != ATA_DEV_ATAPI || cmd_err > PORT_CERR_SDB) | ||
693 | printk("ata%u: error interrupt on port%d\n" | ||
694 | " stat=0x%x irq=0x%x cmd_err=%d sstatus=0x%x serror=0x%x\n", | ||
695 | ap->id, ap->port_no, slot_stat, irq_stat, cmd_err, sstatus, serror); | ||
554 | 696 | ||
555 | if (cmd_err == PORT_CERR_DEV || cmd_err == PORT_CERR_SDB) { | 697 | if (cmd_err == PORT_CERR_DEV || cmd_err == PORT_CERR_SDB) { |
556 | /* | 698 | /* |
@@ -558,6 +700,7 @@ static void sil24_error_intr(struct ata_port *ap, u32 slot_stat) | |||
558 | */ | 700 | */ |
559 | sil24_update_tf(ap); | 701 | sil24_update_tf(ap); |
560 | err_mask = ac_err_mask(pp->tf.command); | 702 | err_mask = ac_err_mask(pp->tf.command); |
703 | sil24_restart_controller(ap); | ||
561 | } else { | 704 | } else { |
562 | /* | 705 | /* |
563 | * Other errors. libata currently doesn't have any | 706 | * Other errors. libata currently doesn't have any |
@@ -565,12 +708,11 @@ static void sil24_error_intr(struct ata_port *ap, u32 slot_stat) | |||
565 | * ATA_ERR. | 708 | * ATA_ERR. |
566 | */ | 709 | */ |
567 | err_mask = AC_ERR_OTHER; | 710 | err_mask = AC_ERR_OTHER; |
711 | sil24_reset_controller(ap); | ||
568 | } | 712 | } |
569 | 713 | ||
570 | if (qc) | 714 | if (qc) |
571 | ata_qc_complete(qc, err_mask); | 715 | ata_qc_complete(qc, err_mask); |
572 | |||
573 | sil24_reset_controller(ap); | ||
574 | } | 716 | } |
575 | 717 | ||
576 | static inline void sil24_host_intr(struct ata_port *ap) | 718 | static inline void sil24_host_intr(struct ata_port *ap) |
@@ -646,7 +788,7 @@ static int sil24_port_start(struct ata_port *ap) | |||
646 | { | 788 | { |
647 | struct device *dev = ap->host_set->dev; | 789 | struct device *dev = ap->host_set->dev; |
648 | struct sil24_port_priv *pp; | 790 | struct sil24_port_priv *pp; |
649 | struct sil24_cmd_block *cb; | 791 | union sil24_cmd_block *cb; |
650 | size_t cb_size = sizeof(*cb); | 792 | size_t cb_size = sizeof(*cb); |
651 | dma_addr_t cb_dma; | 793 | dma_addr_t cb_dma; |
652 | int rc = -ENOMEM; | 794 | int rc = -ENOMEM; |
diff --git a/drivers/scsi/sata_svw.c b/drivers/scsi/sata_svw.c index 57e5a9d964c3..6e7f7c83a75a 100644 --- a/drivers/scsi/sata_svw.c +++ b/drivers/scsi/sata_svw.c | |||
@@ -54,7 +54,7 @@ | |||
54 | #endif /* CONFIG_PPC_OF */ | 54 | #endif /* CONFIG_PPC_OF */ |
55 | 55 | ||
56 | #define DRV_NAME "sata_svw" | 56 | #define DRV_NAME "sata_svw" |
57 | #define DRV_VERSION "1.06" | 57 | #define DRV_VERSION "1.07" |
58 | 58 | ||
59 | /* Taskfile registers offsets */ | 59 | /* Taskfile registers offsets */ |
60 | #define K2_SATA_TF_CMD_OFFSET 0x00 | 60 | #define K2_SATA_TF_CMD_OFFSET 0x00 |
diff --git a/drivers/scsi/sata_sx4.c b/drivers/scsi/sata_sx4.c index b4bbe48acab0..dcc3ad9a9d6e 100644 --- a/drivers/scsi/sata_sx4.c +++ b/drivers/scsi/sata_sx4.c | |||
@@ -46,7 +46,7 @@ | |||
46 | #include "sata_promise.h" | 46 | #include "sata_promise.h" |
47 | 47 | ||
48 | #define DRV_NAME "sata_sx4" | 48 | #define DRV_NAME "sata_sx4" |
49 | #define DRV_VERSION "0.7" | 49 | #define DRV_VERSION "0.8" |
50 | 50 | ||
51 | 51 | ||
52 | enum { | 52 | enum { |
diff --git a/drivers/scsi/sata_vsc.c b/drivers/scsi/sata_vsc.c index 77a6e4b9262d..fcfa486965b4 100644 --- a/drivers/scsi/sata_vsc.c +++ b/drivers/scsi/sata_vsc.c | |||
@@ -47,7 +47,7 @@ | |||
47 | #include <linux/libata.h> | 47 | #include <linux/libata.h> |
48 | 48 | ||
49 | #define DRV_NAME "sata_vsc" | 49 | #define DRV_NAME "sata_vsc" |
50 | #define DRV_VERSION "1.0" | 50 | #define DRV_VERSION "1.1" |
51 | 51 | ||
52 | /* Interrupt register offsets (from chip base address) */ | 52 | /* Interrupt register offsets (from chip base address) */ |
53 | #define VSC_SATA_INT_STAT_OFFSET 0x00 | 53 | #define VSC_SATA_INT_STAT_OFFSET 0x00 |
diff --git a/drivers/serial/Kconfig b/drivers/serial/Kconfig index ff36f0c9fdad..ad47c1b84c3f 100644 --- a/drivers/serial/Kconfig +++ b/drivers/serial/Kconfig | |||
@@ -507,7 +507,7 @@ config SERIAL_SUNSU_CONSOLE | |||
507 | 507 | ||
508 | config SERIAL_MUX | 508 | config SERIAL_MUX |
509 | tristate "Serial MUX support" | 509 | tristate "Serial MUX support" |
510 | depends on PARISC | 510 | depends on GSC |
511 | select SERIAL_CORE | 511 | select SERIAL_CORE |
512 | default y | 512 | default y |
513 | ---help--- | 513 | ---help--- |
diff --git a/drivers/serial/amba-pl011.c b/drivers/serial/amba-pl011.c index 938d185841c9..89d7bd3eaee3 100644 --- a/drivers/serial/amba-pl011.c +++ b/drivers/serial/amba-pl011.c | |||
@@ -49,7 +49,6 @@ | |||
49 | #include <linux/serial.h> | 49 | #include <linux/serial.h> |
50 | 50 | ||
51 | #include <asm/io.h> | 51 | #include <asm/io.h> |
52 | #include <asm/irq.h> | ||
53 | #include <asm/sizes.h> | 52 | #include <asm/sizes.h> |
54 | #include <asm/hardware/amba.h> | 53 | #include <asm/hardware/amba.h> |
55 | #include <asm/hardware/clock.h> | 54 | #include <asm/hardware/clock.h> |
@@ -63,7 +62,8 @@ | |||
63 | 62 | ||
64 | #define AMBA_ISR_PASS_LIMIT 256 | 63 | #define AMBA_ISR_PASS_LIMIT 256 |
65 | 64 | ||
66 | #define UART_DUMMY_RSR_RX 256 | 65 | #define UART_DR_ERROR (UART011_DR_OE|UART011_DR_BE|UART011_DR_PE|UART011_DR_FE) |
66 | #define UART_DUMMY_DR_RX (1 << 16) | ||
67 | 67 | ||
68 | /* | 68 | /* |
69 | * We wrap our port structure around the generic uart_port. | 69 | * We wrap our port structure around the generic uart_port. |
@@ -116,7 +116,7 @@ pl011_rx_chars(struct uart_amba_port *uap) | |||
116 | #endif | 116 | #endif |
117 | { | 117 | { |
118 | struct tty_struct *tty = uap->port.info->tty; | 118 | struct tty_struct *tty = uap->port.info->tty; |
119 | unsigned int status, ch, flag, rsr, max_count = 256; | 119 | unsigned int status, ch, flag, max_count = 256; |
120 | 120 | ||
121 | status = readw(uap->port.membase + UART01x_FR); | 121 | status = readw(uap->port.membase + UART01x_FR); |
122 | while ((status & UART01x_FR_RXFE) == 0 && max_count--) { | 122 | while ((status & UART01x_FR_RXFE) == 0 && max_count--) { |
@@ -129,7 +129,7 @@ pl011_rx_chars(struct uart_amba_port *uap) | |||
129 | */ | 129 | */ |
130 | } | 130 | } |
131 | 131 | ||
132 | ch = readw(uap->port.membase + UART01x_DR); | 132 | ch = readw(uap->port.membase + UART01x_DR) | UART_DUMMY_DR_RX; |
133 | flag = TTY_NORMAL; | 133 | flag = TTY_NORMAL; |
134 | uap->port.icount.rx++; | 134 | uap->port.icount.rx++; |
135 | 135 | ||
@@ -137,34 +137,33 @@ pl011_rx_chars(struct uart_amba_port *uap) | |||
137 | * Note that the error handling code is | 137 | * Note that the error handling code is |
138 | * out of the main execution path | 138 | * out of the main execution path |
139 | */ | 139 | */ |
140 | rsr = readw(uap->port.membase + UART01x_RSR) | UART_DUMMY_RSR_RX; | 140 | if (unlikely(ch & UART_DR_ERROR)) { |
141 | if (unlikely(rsr & UART01x_RSR_ANY)) { | 141 | if (ch & UART011_DR_BE) { |
142 | if (rsr & UART01x_RSR_BE) { | 142 | ch &= ~(UART011_DR_FE | UART011_DR_PE); |
143 | rsr &= ~(UART01x_RSR_FE | UART01x_RSR_PE); | ||
144 | uap->port.icount.brk++; | 143 | uap->port.icount.brk++; |
145 | if (uart_handle_break(&uap->port)) | 144 | if (uart_handle_break(&uap->port)) |
146 | goto ignore_char; | 145 | goto ignore_char; |
147 | } else if (rsr & UART01x_RSR_PE) | 146 | } else if (ch & UART011_DR_PE) |
148 | uap->port.icount.parity++; | 147 | uap->port.icount.parity++; |
149 | else if (rsr & UART01x_RSR_FE) | 148 | else if (ch & UART011_DR_FE) |
150 | uap->port.icount.frame++; | 149 | uap->port.icount.frame++; |
151 | if (rsr & UART01x_RSR_OE) | 150 | if (ch & UART011_DR_OE) |
152 | uap->port.icount.overrun++; | 151 | uap->port.icount.overrun++; |
153 | 152 | ||
154 | rsr &= uap->port.read_status_mask; | 153 | ch &= uap->port.read_status_mask; |
155 | 154 | ||
156 | if (rsr & UART01x_RSR_BE) | 155 | if (ch & UART011_DR_BE) |
157 | flag = TTY_BREAK; | 156 | flag = TTY_BREAK; |
158 | else if (rsr & UART01x_RSR_PE) | 157 | else if (ch & UART011_DR_PE) |
159 | flag = TTY_PARITY; | 158 | flag = TTY_PARITY; |
160 | else if (rsr & UART01x_RSR_FE) | 159 | else if (ch & UART011_DR_FE) |
161 | flag = TTY_FRAME; | 160 | flag = TTY_FRAME; |
162 | } | 161 | } |
163 | 162 | ||
164 | if (uart_handle_sysrq_char(&uap->port, ch, regs)) | 163 | if (uart_handle_sysrq_char(&uap->port, ch, regs)) |
165 | goto ignore_char; | 164 | goto ignore_char; |
166 | 165 | ||
167 | uart_insert_char(&uap->port, rsr, UART01x_RSR_OE, ch, flag); | 166 | uart_insert_char(&uap->port, ch, UART011_DR_OE, ch, flag); |
168 | 167 | ||
169 | ignore_char: | 168 | ignore_char: |
170 | status = readw(uap->port.membase + UART01x_FR); | 169 | status = readw(uap->port.membase + UART01x_FR); |
@@ -476,33 +475,33 @@ pl011_set_termios(struct uart_port *port, struct termios *termios, | |||
476 | */ | 475 | */ |
477 | uart_update_timeout(port, termios->c_cflag, baud); | 476 | uart_update_timeout(port, termios->c_cflag, baud); |
478 | 477 | ||
479 | port->read_status_mask = UART01x_RSR_OE; | 478 | port->read_status_mask = UART011_DR_OE | 255; |
480 | if (termios->c_iflag & INPCK) | 479 | if (termios->c_iflag & INPCK) |
481 | port->read_status_mask |= UART01x_RSR_FE | UART01x_RSR_PE; | 480 | port->read_status_mask |= UART011_DR_FE | UART011_DR_PE; |
482 | if (termios->c_iflag & (BRKINT | PARMRK)) | 481 | if (termios->c_iflag & (BRKINT | PARMRK)) |
483 | port->read_status_mask |= UART01x_RSR_BE; | 482 | port->read_status_mask |= UART011_DR_BE; |
484 | 483 | ||
485 | /* | 484 | /* |
486 | * Characters to ignore | 485 | * Characters to ignore |
487 | */ | 486 | */ |
488 | port->ignore_status_mask = 0; | 487 | port->ignore_status_mask = 0; |
489 | if (termios->c_iflag & IGNPAR) | 488 | if (termios->c_iflag & IGNPAR) |
490 | port->ignore_status_mask |= UART01x_RSR_FE | UART01x_RSR_PE; | 489 | port->ignore_status_mask |= UART011_DR_FE | UART011_DR_PE; |
491 | if (termios->c_iflag & IGNBRK) { | 490 | if (termios->c_iflag & IGNBRK) { |
492 | port->ignore_status_mask |= UART01x_RSR_BE; | 491 | port->ignore_status_mask |= UART011_DR_BE; |
493 | /* | 492 | /* |
494 | * If we're ignoring parity and break indicators, | 493 | * If we're ignoring parity and break indicators, |
495 | * ignore overruns too (for real raw support). | 494 | * ignore overruns too (for real raw support). |
496 | */ | 495 | */ |
497 | if (termios->c_iflag & IGNPAR) | 496 | if (termios->c_iflag & IGNPAR) |
498 | port->ignore_status_mask |= UART01x_RSR_OE; | 497 | port->ignore_status_mask |= UART011_DR_OE; |
499 | } | 498 | } |
500 | 499 | ||
501 | /* | 500 | /* |
502 | * Ignore all characters if CREAD is not set. | 501 | * Ignore all characters if CREAD is not set. |
503 | */ | 502 | */ |
504 | if ((termios->c_cflag & CREAD) == 0) | 503 | if ((termios->c_cflag & CREAD) == 0) |
505 | port->ignore_status_mask |= UART_DUMMY_RSR_RX; | 504 | port->ignore_status_mask |= UART_DUMMY_DR_RX; |
506 | 505 | ||
507 | if (UART_ENABLE_MS(port, termios->c_cflag)) | 506 | if (UART_ENABLE_MS(port, termios->c_cflag)) |
508 | pl011_enable_ms(port); | 507 | pl011_enable_ms(port); |
diff --git a/drivers/serial/mux.c b/drivers/serial/mux.c index 660bae5ba179..7633132a10aa 100644 --- a/drivers/serial/mux.c +++ b/drivers/serial/mux.c | |||
@@ -65,8 +65,8 @@ static struct uart_driver mux_driver = { | |||
65 | 65 | ||
66 | static struct timer_list mux_timer; | 66 | static struct timer_list mux_timer; |
67 | 67 | ||
68 | #define UART_PUT_CHAR(p, c) __raw_writel((c), (unsigned long)(p)->membase + IO_DATA_REG_OFFSET) | 68 | #define UART_PUT_CHAR(p, c) __raw_writel((c), (p)->membase + IO_DATA_REG_OFFSET) |
69 | #define UART_GET_FIFO_CNT(p) __raw_readl((unsigned long)(p)->membase + IO_DCOUNT_REG_OFFSET) | 69 | #define UART_GET_FIFO_CNT(p) __raw_readl((p)->membase + IO_DCOUNT_REG_OFFSET) |
70 | #define GET_MUX_PORTS(iodc_data) ((((iodc_data)[4] & 0xf0) >> 4) * 8) + 8 | 70 | #define GET_MUX_PORTS(iodc_data) ((((iodc_data)[4] & 0xf0) >> 4) * 8) + 8 |
71 | 71 | ||
72 | /** | 72 | /** |
@@ -79,10 +79,7 @@ static struct timer_list mux_timer; | |||
79 | */ | 79 | */ |
80 | static unsigned int mux_tx_empty(struct uart_port *port) | 80 | static unsigned int mux_tx_empty(struct uart_port *port) |
81 | { | 81 | { |
82 | unsigned int cnt = __raw_readl((unsigned long)port->membase | 82 | return UART_GET_FIFO_CNT(port) ? 0 : TIOCSER_TEMT; |
83 | + IO_DCOUNT_REG_OFFSET); | ||
84 | |||
85 | return cnt ? 0 : TIOCSER_TEMT; | ||
86 | } | 83 | } |
87 | 84 | ||
88 | /** | 85 | /** |
@@ -218,8 +215,7 @@ static void mux_read(struct uart_port *port) | |||
218 | __u32 start_count = port->icount.rx; | 215 | __u32 start_count = port->icount.rx; |
219 | 216 | ||
220 | while(1) { | 217 | while(1) { |
221 | data = __raw_readl((unsigned long)port->membase | 218 | data = __raw_readl(port->membase + IO_DATA_REG_OFFSET); |
222 | + IO_DATA_REG_OFFSET); | ||
223 | 219 | ||
224 | if (MUX_STATUS(data)) | 220 | if (MUX_STATUS(data)) |
225 | continue; | 221 | continue; |
@@ -481,6 +477,13 @@ static int __init mux_probe(struct parisc_device *dev) | |||
481 | port->ops = &mux_pops; | 477 | port->ops = &mux_pops; |
482 | port->flags = UPF_BOOT_AUTOCONF; | 478 | port->flags = UPF_BOOT_AUTOCONF; |
483 | port->line = port_cnt; | 479 | port->line = port_cnt; |
480 | |||
481 | /* The port->timeout needs to match what is present in | ||
482 | * uart_wait_until_sent in serial_core.c. Otherwise | ||
483 | * the time spent in msleep_interruptable will be very | ||
484 | * long, causing the appearance of a console hang. | ||
485 | */ | ||
486 | port->timeout = HZ / 50; | ||
484 | spin_lock_init(&port->lock); | 487 | spin_lock_init(&port->lock); |
485 | status = uart_add_one_port(&mux_driver, port); | 488 | status = uart_add_one_port(&mux_driver, port); |
486 | BUG_ON(status); | 489 | BUG_ON(status); |
diff --git a/drivers/serial/sa1100.c b/drivers/serial/sa1100.c index 0e3daf6d7b50..25a086458ab9 100644 --- a/drivers/serial/sa1100.c +++ b/drivers/serial/sa1100.c | |||
@@ -161,7 +161,6 @@ static void sa1100_stop_tx(struct uart_port *port) | |||
161 | static void sa1100_start_tx(struct uart_port *port) | 161 | static void sa1100_start_tx(struct uart_port *port) |
162 | { | 162 | { |
163 | struct sa1100_port *sport = (struct sa1100_port *)port; | 163 | struct sa1100_port *sport = (struct sa1100_port *)port; |
164 | unsigned long flags; | ||
165 | u32 utcr3; | 164 | u32 utcr3; |
166 | 165 | ||
167 | utcr3 = UART_GET_UTCR3(sport); | 166 | utcr3 = UART_GET_UTCR3(sport); |
diff --git a/drivers/tc/zs.c b/drivers/tc/zs.c index c52af73a251b..6756d0fab6fe 100644 --- a/drivers/tc/zs.c +++ b/drivers/tc/zs.c | |||
@@ -6,7 +6,7 @@ | |||
6 | * | 6 | * |
7 | * DECstation changes | 7 | * DECstation changes |
8 | * Copyright (C) 1998-2000 Harald Koerfgen | 8 | * Copyright (C) 1998-2000 Harald Koerfgen |
9 | * Copyright (C) 2000, 2001, 2002, 2003, 2004 Maciej W. Rozycki | 9 | * Copyright (C) 2000, 2001, 2002, 2003, 2004, 2005 Maciej W. Rozycki |
10 | * | 10 | * |
11 | * For the rest of the code the original Copyright applies: | 11 | * For the rest of the code the original Copyright applies: |
12 | * Copyright (C) 1996 Paul Mackerras (Paul.Mackerras@cs.anu.edu.au) | 12 | * Copyright (C) 1996 Paul Mackerras (Paul.Mackerras@cs.anu.edu.au) |
@@ -55,6 +55,7 @@ | |||
55 | #include <linux/delay.h> | 55 | #include <linux/delay.h> |
56 | #include <linux/init.h> | 56 | #include <linux/init.h> |
57 | #include <linux/ioport.h> | 57 | #include <linux/ioport.h> |
58 | #include <linux/spinlock.h> | ||
58 | #ifdef CONFIG_SERIAL_DEC_CONSOLE | 59 | #ifdef CONFIG_SERIAL_DEC_CONSOLE |
59 | #include <linux/console.h> | 60 | #include <linux/console.h> |
60 | #endif | 61 | #endif |
@@ -63,7 +64,6 @@ | |||
63 | #include <asm/pgtable.h> | 64 | #include <asm/pgtable.h> |
64 | #include <asm/irq.h> | 65 | #include <asm/irq.h> |
65 | #include <asm/system.h> | 66 | #include <asm/system.h> |
66 | #include <asm/uaccess.h> | ||
67 | #include <asm/bootinfo.h> | 67 | #include <asm/bootinfo.h> |
68 | 68 | ||
69 | #include <asm/dec/interrupts.h> | 69 | #include <asm/dec/interrupts.h> |
@@ -128,6 +128,8 @@ static struct zs_parms ds_parms = { | |||
128 | 128 | ||
129 | #define BUS_PRESENT (DS_BUS_PRESENT) | 129 | #define BUS_PRESENT (DS_BUS_PRESENT) |
130 | 130 | ||
131 | DEFINE_SPINLOCK(zs_lock); | ||
132 | |||
131 | struct dec_zschannel zs_channels[NUM_CHANNELS]; | 133 | struct dec_zschannel zs_channels[NUM_CHANNELS]; |
132 | struct dec_serial zs_soft[NUM_CHANNELS]; | 134 | struct dec_serial zs_soft[NUM_CHANNELS]; |
133 | int zs_channels_found; | 135 | int zs_channels_found; |
@@ -159,8 +161,6 @@ static unsigned char zs_init_regs[16] __initdata = { | |||
159 | 0 /* write 15 */ | 161 | 0 /* write 15 */ |
160 | }; | 162 | }; |
161 | 163 | ||
162 | DECLARE_TASK_QUEUE(tq_zs_serial); | ||
163 | |||
164 | static struct tty_driver *serial_driver; | 164 | static struct tty_driver *serial_driver; |
165 | 165 | ||
166 | /* serial subtype definitions */ | 166 | /* serial subtype definitions */ |
@@ -294,8 +294,7 @@ static inline void zs_rtsdtr(struct dec_serial *info, int which, int set) | |||
294 | { | 294 | { |
295 | unsigned long flags; | 295 | unsigned long flags; |
296 | 296 | ||
297 | 297 | spin_lock_irqsave(&zs_lock, flags); | |
298 | save_flags(flags); cli(); | ||
299 | if (info->zs_channel != info->zs_chan_a) { | 298 | if (info->zs_channel != info->zs_chan_a) { |
300 | if (set) { | 299 | if (set) { |
301 | info->zs_chan_a->curregs[5] |= (which & (RTS | DTR)); | 300 | info->zs_chan_a->curregs[5] |= (which & (RTS | DTR)); |
@@ -304,7 +303,7 @@ static inline void zs_rtsdtr(struct dec_serial *info, int which, int set) | |||
304 | } | 303 | } |
305 | write_zsreg(info->zs_chan_a, 5, info->zs_chan_a->curregs[5]); | 304 | write_zsreg(info->zs_chan_a, 5, info->zs_chan_a->curregs[5]); |
306 | } | 305 | } |
307 | restore_flags(flags); | 306 | spin_unlock_irqrestore(&zs_lock, flags); |
308 | } | 307 | } |
309 | 308 | ||
310 | /* Utility routines for the Zilog */ | 309 | /* Utility routines for the Zilog */ |
@@ -345,12 +344,10 @@ static inline void rs_recv_clear(struct dec_zschannel *zsc) | |||
345 | * This routine is used by the interrupt handler to schedule | 344 | * This routine is used by the interrupt handler to schedule |
346 | * processing in the software interrupt portion of the driver. | 345 | * processing in the software interrupt portion of the driver. |
347 | */ | 346 | */ |
348 | static _INLINE_ void rs_sched_event(struct dec_serial *info, | 347 | static _INLINE_ void rs_sched_event(struct dec_serial *info, int event) |
349 | int event) | ||
350 | { | 348 | { |
351 | info->event |= 1 << event; | 349 | info->event |= 1 << event; |
352 | queue_task(&info->tqueue, &tq_zs_serial); | 350 | tasklet_schedule(&info->tlet); |
353 | mark_bh(SERIAL_BH); | ||
354 | } | 351 | } |
355 | 352 | ||
356 | static _INLINE_ void receive_chars(struct dec_serial *info, | 353 | static _INLINE_ void receive_chars(struct dec_serial *info, |
@@ -497,9 +494,10 @@ static _INLINE_ void status_handle(struct dec_serial *info) | |||
497 | /* | 494 | /* |
498 | * This is the serial driver's generic interrupt routine | 495 | * This is the serial driver's generic interrupt routine |
499 | */ | 496 | */ |
500 | void rs_interrupt(int irq, void *dev_id, struct pt_regs * regs) | 497 | static irqreturn_t rs_interrupt(int irq, void *dev_id, struct pt_regs *regs) |
501 | { | 498 | { |
502 | struct dec_serial *info = (struct dec_serial *) dev_id; | 499 | struct dec_serial *info = (struct dec_serial *) dev_id; |
500 | irqreturn_t status = IRQ_NONE; | ||
503 | unsigned char zs_intreg; | 501 | unsigned char zs_intreg; |
504 | int shift; | 502 | int shift; |
505 | 503 | ||
@@ -521,6 +519,8 @@ void rs_interrupt(int irq, void *dev_id, struct pt_regs * regs) | |||
521 | if ((zs_intreg & CHAN_IRQMASK) == 0) | 519 | if ((zs_intreg & CHAN_IRQMASK) == 0) |
522 | break; | 520 | break; |
523 | 521 | ||
522 | status = IRQ_HANDLED; | ||
523 | |||
524 | if (zs_intreg & CHBRxIP) { | 524 | if (zs_intreg & CHBRxIP) { |
525 | receive_chars(info, regs); | 525 | receive_chars(info, regs); |
526 | } | 526 | } |
@@ -534,6 +534,8 @@ void rs_interrupt(int irq, void *dev_id, struct pt_regs * regs) | |||
534 | 534 | ||
535 | /* Why do we need this ? */ | 535 | /* Why do we need this ? */ |
536 | write_zsreg(info->zs_channel, 0, RES_H_IUS); | 536 | write_zsreg(info->zs_channel, 0, RES_H_IUS); |
537 | |||
538 | return status; | ||
537 | } | 539 | } |
538 | 540 | ||
539 | #ifdef ZS_DEBUG_REGS | 541 | #ifdef ZS_DEBUG_REGS |
@@ -578,12 +580,12 @@ static void rs_stop(struct tty_struct *tty) | |||
578 | return; | 580 | return; |
579 | 581 | ||
580 | #if 1 | 582 | #if 1 |
581 | save_flags(flags); cli(); | 583 | spin_lock_irqsave(&zs_lock, flags); |
582 | if (info->zs_channel->curregs[5] & TxENAB) { | 584 | if (info->zs_channel->curregs[5] & TxENAB) { |
583 | info->zs_channel->curregs[5] &= ~TxENAB; | 585 | info->zs_channel->curregs[5] &= ~TxENAB; |
584 | write_zsreg(info->zs_channel, 5, info->zs_channel->curregs[5]); | 586 | write_zsreg(info->zs_channel, 5, info->zs_channel->curregs[5]); |
585 | } | 587 | } |
586 | restore_flags(flags); | 588 | spin_unlock_irqrestore(&zs_lock, flags); |
587 | #endif | 589 | #endif |
588 | } | 590 | } |
589 | 591 | ||
@@ -595,7 +597,7 @@ static void rs_start(struct tty_struct *tty) | |||
595 | if (serial_paranoia_check(info, tty->name, "rs_start")) | 597 | if (serial_paranoia_check(info, tty->name, "rs_start")) |
596 | return; | 598 | return; |
597 | 599 | ||
598 | save_flags(flags); cli(); | 600 | spin_lock_irqsave(&zs_lock, flags); |
599 | #if 1 | 601 | #if 1 |
600 | if (info->xmit_cnt && info->xmit_buf && !(info->zs_channel->curregs[5] & TxENAB)) { | 602 | if (info->xmit_cnt && info->xmit_buf && !(info->zs_channel->curregs[5] & TxENAB)) { |
601 | info->zs_channel->curregs[5] |= TxENAB; | 603 | info->zs_channel->curregs[5] |= TxENAB; |
@@ -606,7 +608,7 @@ static void rs_start(struct tty_struct *tty) | |||
606 | transmit_chars(info); | 608 | transmit_chars(info); |
607 | } | 609 | } |
608 | #endif | 610 | #endif |
609 | restore_flags(flags); | 611 | spin_unlock_irqrestore(&zs_lock, flags); |
610 | } | 612 | } |
611 | 613 | ||
612 | /* | 614 | /* |
@@ -618,12 +620,8 @@ static void rs_start(struct tty_struct *tty) | |||
618 | * interrupt driver proper are done; the interrupt driver schedules | 620 | * interrupt driver proper are done; the interrupt driver schedules |
619 | * them using rs_sched_event(), and they get done here. | 621 | * them using rs_sched_event(), and they get done here. |
620 | */ | 622 | */ |
621 | static void do_serial_bh(void) | ||
622 | { | ||
623 | run_task_queue(&tq_zs_serial); | ||
624 | } | ||
625 | 623 | ||
626 | static void do_softint(void *private_) | 624 | static void do_softint(unsigned long private_) |
627 | { | 625 | { |
628 | struct dec_serial *info = (struct dec_serial *) private_; | 626 | struct dec_serial *info = (struct dec_serial *) private_; |
629 | struct tty_struct *tty; | 627 | struct tty_struct *tty; |
@@ -634,10 +632,11 @@ static void do_softint(void *private_) | |||
634 | 632 | ||
635 | if (test_and_clear_bit(RS_EVENT_WRITE_WAKEUP, &info->event)) { | 633 | if (test_and_clear_bit(RS_EVENT_WRITE_WAKEUP, &info->event)) { |
636 | tty_wakeup(tty); | 634 | tty_wakeup(tty); |
635 | wake_up_interruptible(&tty->write_wait); | ||
637 | } | 636 | } |
638 | } | 637 | } |
639 | 638 | ||
640 | int zs_startup(struct dec_serial * info) | 639 | static int zs_startup(struct dec_serial * info) |
641 | { | 640 | { |
642 | unsigned long flags; | 641 | unsigned long flags; |
643 | 642 | ||
@@ -650,7 +649,7 @@ int zs_startup(struct dec_serial * info) | |||
650 | return -ENOMEM; | 649 | return -ENOMEM; |
651 | } | 650 | } |
652 | 651 | ||
653 | save_flags(flags); cli(); | 652 | spin_lock_irqsave(&zs_lock, flags); |
654 | 653 | ||
655 | #ifdef SERIAL_DEBUG_OPEN | 654 | #ifdef SERIAL_DEBUG_OPEN |
656 | printk("starting up ttyS%d (irq %d)...", info->line, info->irq); | 655 | printk("starting up ttyS%d (irq %d)...", info->line, info->irq); |
@@ -706,7 +705,7 @@ int zs_startup(struct dec_serial * info) | |||
706 | info->xmit_cnt = info->xmit_head = info->xmit_tail = 0; | 705 | info->xmit_cnt = info->xmit_head = info->xmit_tail = 0; |
707 | 706 | ||
708 | info->flags |= ZILOG_INITIALIZED; | 707 | info->flags |= ZILOG_INITIALIZED; |
709 | restore_flags(flags); | 708 | spin_unlock_irqrestore(&zs_lock, flags); |
710 | return 0; | 709 | return 0; |
711 | } | 710 | } |
712 | 711 | ||
@@ -726,7 +725,7 @@ static void shutdown(struct dec_serial * info) | |||
726 | info->irq); | 725 | info->irq); |
727 | #endif | 726 | #endif |
728 | 727 | ||
729 | save_flags(flags); cli(); /* Disable interrupts */ | 728 | spin_lock_irqsave(&zs_lock, flags); |
730 | 729 | ||
731 | if (info->xmit_buf) { | 730 | if (info->xmit_buf) { |
732 | free_page((unsigned long) info->xmit_buf); | 731 | free_page((unsigned long) info->xmit_buf); |
@@ -749,7 +748,7 @@ static void shutdown(struct dec_serial * info) | |||
749 | set_bit(TTY_IO_ERROR, &info->tty->flags); | 748 | set_bit(TTY_IO_ERROR, &info->tty->flags); |
750 | 749 | ||
751 | info->flags &= ~ZILOG_INITIALIZED; | 750 | info->flags &= ~ZILOG_INITIALIZED; |
752 | restore_flags(flags); | 751 | spin_unlock_irqrestore(&zs_lock, flags); |
753 | } | 752 | } |
754 | 753 | ||
755 | /* | 754 | /* |
@@ -785,7 +784,7 @@ static void change_speed(struct dec_serial *info) | |||
785 | i += 15; | 784 | i += 15; |
786 | } | 785 | } |
787 | 786 | ||
788 | save_flags(flags); cli(); | 787 | spin_lock_irqsave(&zs_lock, flags); |
789 | info->zs_baud = baud_table[i]; | 788 | info->zs_baud = baud_table[i]; |
790 | if (info->zs_baud) { | 789 | if (info->zs_baud) { |
791 | brg = BPS_TO_BRG(info->zs_baud, zs_parms->clock/info->clk_divisor); | 790 | brg = BPS_TO_BRG(info->zs_baud, zs_parms->clock/info->clk_divisor); |
@@ -858,7 +857,7 @@ static void change_speed(struct dec_serial *info) | |||
858 | /* Load up the new values */ | 857 | /* Load up the new values */ |
859 | load_zsregs(info->zs_channel, info->zs_channel->curregs); | 858 | load_zsregs(info->zs_channel, info->zs_channel->curregs); |
860 | 859 | ||
861 | restore_flags(flags); | 860 | spin_unlock_irqrestore(&zs_lock, flags); |
862 | } | 861 | } |
863 | 862 | ||
864 | static void rs_flush_chars(struct tty_struct *tty) | 863 | static void rs_flush_chars(struct tty_struct *tty) |
@@ -874,9 +873,9 @@ static void rs_flush_chars(struct tty_struct *tty) | |||
874 | return; | 873 | return; |
875 | 874 | ||
876 | /* Enable transmitter */ | 875 | /* Enable transmitter */ |
877 | save_flags(flags); cli(); | 876 | spin_lock_irqsave(&zs_lock, flags); |
878 | transmit_chars(info); | 877 | transmit_chars(info); |
879 | restore_flags(flags); | 878 | spin_unlock_irqrestore(&zs_lock, flags); |
880 | } | 879 | } |
881 | 880 | ||
882 | static int rs_write(struct tty_struct * tty, | 881 | static int rs_write(struct tty_struct * tty, |
@@ -892,26 +891,17 @@ static int rs_write(struct tty_struct * tty, | |||
892 | if (!tty || !info->xmit_buf) | 891 | if (!tty || !info->xmit_buf) |
893 | return 0; | 892 | return 0; |
894 | 893 | ||
895 | save_flags(flags); | ||
896 | while (1) { | 894 | while (1) { |
897 | cli(); | 895 | spin_lock_irqsave(&zs_lock, flags); |
898 | c = min(count, min(SERIAL_XMIT_SIZE - info->xmit_cnt - 1, | 896 | c = min(count, min(SERIAL_XMIT_SIZE - info->xmit_cnt - 1, |
899 | SERIAL_XMIT_SIZE - info->xmit_head)); | 897 | SERIAL_XMIT_SIZE - info->xmit_head)); |
900 | if (c <= 0) | 898 | if (c <= 0) |
901 | break; | 899 | break; |
902 | 900 | ||
903 | if (from_user) { | 901 | memcpy(info->xmit_buf + info->xmit_head, buf, c); |
904 | down(&tmp_buf_sem); | ||
905 | copy_from_user(tmp_buf, buf, c); | ||
906 | c = min(c, min(SERIAL_XMIT_SIZE - info->xmit_cnt - 1, | ||
907 | SERIAL_XMIT_SIZE - info->xmit_head)); | ||
908 | memcpy(info->xmit_buf + info->xmit_head, tmp_buf, c); | ||
909 | up(&tmp_buf_sem); | ||
910 | } else | ||
911 | memcpy(info->xmit_buf + info->xmit_head, buf, c); | ||
912 | info->xmit_head = (info->xmit_head + c) & (SERIAL_XMIT_SIZE-1); | 902 | info->xmit_head = (info->xmit_head + c) & (SERIAL_XMIT_SIZE-1); |
913 | info->xmit_cnt += c; | 903 | info->xmit_cnt += c; |
914 | restore_flags(flags); | 904 | spin_unlock_irqrestore(&zs_lock, flags); |
915 | buf += c; | 905 | buf += c; |
916 | count -= c; | 906 | count -= c; |
917 | total += c; | 907 | total += c; |
@@ -920,7 +910,7 @@ static int rs_write(struct tty_struct * tty, | |||
920 | if (info->xmit_cnt && !tty->stopped && !info->tx_stopped | 910 | if (info->xmit_cnt && !tty->stopped && !info->tx_stopped |
921 | && !info->tx_active) | 911 | && !info->tx_active) |
922 | transmit_chars(info); | 912 | transmit_chars(info); |
923 | restore_flags(flags); | 913 | spin_unlock_irqrestore(&zs_lock, flags); |
924 | return total; | 914 | return total; |
925 | } | 915 | } |
926 | 916 | ||
@@ -952,9 +942,9 @@ static void rs_flush_buffer(struct tty_struct *tty) | |||
952 | 942 | ||
953 | if (serial_paranoia_check(info, tty->name, "rs_flush_buffer")) | 943 | if (serial_paranoia_check(info, tty->name, "rs_flush_buffer")) |
954 | return; | 944 | return; |
955 | cli(); | 945 | spin_lock_irq(&zs_lock); |
956 | info->xmit_cnt = info->xmit_head = info->xmit_tail = 0; | 946 | info->xmit_cnt = info->xmit_head = info->xmit_tail = 0; |
957 | sti(); | 947 | spin_unlock_irq(&zs_lock); |
958 | tty_wakeup(tty); | 948 | tty_wakeup(tty); |
959 | } | 949 | } |
960 | 950 | ||
@@ -982,11 +972,11 @@ static void rs_throttle(struct tty_struct * tty) | |||
982 | return; | 972 | return; |
983 | 973 | ||
984 | if (I_IXOFF(tty)) { | 974 | if (I_IXOFF(tty)) { |
985 | save_flags(flags); cli(); | 975 | spin_lock_irqsave(&zs_lock, flags); |
986 | info->x_char = STOP_CHAR(tty); | 976 | info->x_char = STOP_CHAR(tty); |
987 | if (!info->tx_active) | 977 | if (!info->tx_active) |
988 | transmit_chars(info); | 978 | transmit_chars(info); |
989 | restore_flags(flags); | 979 | spin_unlock_irqrestore(&zs_lock, flags); |
990 | } | 980 | } |
991 | 981 | ||
992 | if (C_CRTSCTS(tty)) { | 982 | if (C_CRTSCTS(tty)) { |
@@ -1010,7 +1000,7 @@ static void rs_unthrottle(struct tty_struct * tty) | |||
1010 | return; | 1000 | return; |
1011 | 1001 | ||
1012 | if (I_IXOFF(tty)) { | 1002 | if (I_IXOFF(tty)) { |
1013 | save_flags(flags); cli(); | 1003 | spin_lock_irqsave(&zs_lock, flags); |
1014 | if (info->x_char) | 1004 | if (info->x_char) |
1015 | info->x_char = 0; | 1005 | info->x_char = 0; |
1016 | else { | 1006 | else { |
@@ -1018,7 +1008,7 @@ static void rs_unthrottle(struct tty_struct * tty) | |||
1018 | if (!info->tx_active) | 1008 | if (!info->tx_active) |
1019 | transmit_chars(info); | 1009 | transmit_chars(info); |
1020 | } | 1010 | } |
1021 | restore_flags(flags); | 1011 | spin_unlock_irqrestore(&zs_lock, flags); |
1022 | } | 1012 | } |
1023 | 1013 | ||
1024 | if (C_CRTSCTS(tty)) { | 1014 | if (C_CRTSCTS(tty)) { |
@@ -1111,9 +1101,9 @@ static int get_lsr_info(struct dec_serial * info, unsigned int *value) | |||
1111 | { | 1101 | { |
1112 | unsigned char status; | 1102 | unsigned char status; |
1113 | 1103 | ||
1114 | cli(); | 1104 | spin_lock(&zs_lock); |
1115 | status = read_zsreg(info->zs_channel, 0); | 1105 | status = read_zsreg(info->zs_channel, 0); |
1116 | sti(); | 1106 | spin_unlock_irq(&zs_lock); |
1117 | put_user(status,value); | 1107 | put_user(status,value); |
1118 | return 0; | 1108 | return 0; |
1119 | } | 1109 | } |
@@ -1136,11 +1126,11 @@ static int rs_tiocmget(struct tty_struct *tty, struct file *file) | |||
1136 | if (info->zs_channel == info->zs_chan_a) | 1126 | if (info->zs_channel == info->zs_chan_a) |
1137 | result = 0; | 1127 | result = 0; |
1138 | else { | 1128 | else { |
1139 | cli(); | 1129 | spin_lock(&zs_lock); |
1140 | control = info->zs_chan_a->curregs[5]; | 1130 | control = info->zs_chan_a->curregs[5]; |
1141 | status_a = read_zsreg(info->zs_chan_a, 0); | 1131 | status_a = read_zsreg(info->zs_chan_a, 0); |
1142 | status_b = read_zsreg(info->zs_channel, 0); | 1132 | status_b = read_zsreg(info->zs_channel, 0); |
1143 | sti(); | 1133 | spin_unlock_irq(&zs_lock); |
1144 | result = ((control & RTS) ? TIOCM_RTS: 0) | 1134 | result = ((control & RTS) ? TIOCM_RTS: 0) |
1145 | | ((control & DTR) ? TIOCM_DTR: 0) | 1135 | | ((control & DTR) ? TIOCM_DTR: 0) |
1146 | | ((status_b & DCD) ? TIOCM_CAR: 0) | 1136 | | ((status_b & DCD) ? TIOCM_CAR: 0) |
@@ -1155,8 +1145,6 @@ static int rs_tiocmset(struct tty_struct *tty, struct file *file, | |||
1155 | unsigned int set, unsigned int clear) | 1145 | unsigned int set, unsigned int clear) |
1156 | { | 1146 | { |
1157 | struct dec_serial * info = (struct dec_serial *)tty->driver_data; | 1147 | struct dec_serial * info = (struct dec_serial *)tty->driver_data; |
1158 | int error; | ||
1159 | unsigned int arg, bits; | ||
1160 | 1148 | ||
1161 | if (info->hook) | 1149 | if (info->hook) |
1162 | return -ENODEV; | 1150 | return -ENODEV; |
@@ -1170,8 +1158,7 @@ static int rs_tiocmset(struct tty_struct *tty, struct file *file, | |||
1170 | if (info->zs_channel == info->zs_chan_a) | 1158 | if (info->zs_channel == info->zs_chan_a) |
1171 | return 0; | 1159 | return 0; |
1172 | 1160 | ||
1173 | get_user(arg, value); | 1161 | spin_lock(&zs_lock); |
1174 | cli(); | ||
1175 | if (set & TIOCM_RTS) | 1162 | if (set & TIOCM_RTS) |
1176 | info->zs_chan_a->curregs[5] |= RTS; | 1163 | info->zs_chan_a->curregs[5] |= RTS; |
1177 | if (set & TIOCM_DTR) | 1164 | if (set & TIOCM_DTR) |
@@ -1181,7 +1168,7 @@ static int rs_tiocmset(struct tty_struct *tty, struct file *file, | |||
1181 | if (clear & TIOCM_DTR) | 1168 | if (clear & TIOCM_DTR) |
1182 | info->zs_chan_a->curregs[5] &= ~DTR; | 1169 | info->zs_chan_a->curregs[5] &= ~DTR; |
1183 | write_zsreg(info->zs_chan_a, 5, info->zs_chan_a->curregs[5]); | 1170 | write_zsreg(info->zs_chan_a, 5, info->zs_chan_a->curregs[5]); |
1184 | sti(); | 1171 | spin_unlock_irq(&zs_lock); |
1185 | return 0; | 1172 | return 0; |
1186 | } | 1173 | } |
1187 | 1174 | ||
@@ -1198,19 +1185,18 @@ static void rs_break(struct tty_struct *tty, int break_state) | |||
1198 | if (!info->port) | 1185 | if (!info->port) |
1199 | return; | 1186 | return; |
1200 | 1187 | ||
1201 | save_flags(flags); cli(); | 1188 | spin_lock_irqsave(&zs_lock, flags); |
1202 | if (break_state == -1) | 1189 | if (break_state == -1) |
1203 | info->zs_channel->curregs[5] |= SND_BRK; | 1190 | info->zs_channel->curregs[5] |= SND_BRK; |
1204 | else | 1191 | else |
1205 | info->zs_channel->curregs[5] &= ~SND_BRK; | 1192 | info->zs_channel->curregs[5] &= ~SND_BRK; |
1206 | write_zsreg(info->zs_channel, 5, info->zs_channel->curregs[5]); | 1193 | write_zsreg(info->zs_channel, 5, info->zs_channel->curregs[5]); |
1207 | restore_flags(flags); | 1194 | spin_unlock_irqrestore(&zs_lock, flags); |
1208 | } | 1195 | } |
1209 | 1196 | ||
1210 | static int rs_ioctl(struct tty_struct *tty, struct file * file, | 1197 | static int rs_ioctl(struct tty_struct *tty, struct file * file, |
1211 | unsigned int cmd, unsigned long arg) | 1198 | unsigned int cmd, unsigned long arg) |
1212 | { | 1199 | { |
1213 | int error; | ||
1214 | struct dec_serial * info = (struct dec_serial *)tty->driver_data; | 1200 | struct dec_serial * info = (struct dec_serial *)tty->driver_data; |
1215 | 1201 | ||
1216 | if (info->hook) | 1202 | if (info->hook) |
@@ -1287,10 +1273,10 @@ static void rs_close(struct tty_struct *tty, struct file * filp) | |||
1287 | if (!info || serial_paranoia_check(info, tty->name, "rs_close")) | 1273 | if (!info || serial_paranoia_check(info, tty->name, "rs_close")) |
1288 | return; | 1274 | return; |
1289 | 1275 | ||
1290 | save_flags(flags); cli(); | 1276 | spin_lock_irqsave(&zs_lock, flags); |
1291 | 1277 | ||
1292 | if (tty_hung_up_p(filp)) { | 1278 | if (tty_hung_up_p(filp)) { |
1293 | restore_flags(flags); | 1279 | spin_unlock_irqrestore(&zs_lock, flags); |
1294 | return; | 1280 | return; |
1295 | } | 1281 | } |
1296 | 1282 | ||
@@ -1315,7 +1301,7 @@ static void rs_close(struct tty_struct *tty, struct file * filp) | |||
1315 | info->count = 0; | 1301 | info->count = 0; |
1316 | } | 1302 | } |
1317 | if (info->count) { | 1303 | if (info->count) { |
1318 | restore_flags(flags); | 1304 | spin_unlock_irqrestore(&zs_lock, flags); |
1319 | return; | 1305 | return; |
1320 | } | 1306 | } |
1321 | info->flags |= ZILOG_CLOSING; | 1307 | info->flags |= ZILOG_CLOSING; |
@@ -1358,7 +1344,7 @@ static void rs_close(struct tty_struct *tty, struct file * filp) | |||
1358 | } | 1344 | } |
1359 | info->flags &= ~(ZILOG_NORMAL_ACTIVE|ZILOG_CLOSING); | 1345 | info->flags &= ~(ZILOG_NORMAL_ACTIVE|ZILOG_CLOSING); |
1360 | wake_up_interruptible(&info->close_wait); | 1346 | wake_up_interruptible(&info->close_wait); |
1361 | restore_flags(flags); | 1347 | spin_unlock_irqrestore(&zs_lock, flags); |
1362 | } | 1348 | } |
1363 | 1349 | ||
1364 | /* | 1350 | /* |
@@ -1398,7 +1384,7 @@ static void rs_wait_until_sent(struct tty_struct *tty, int timeout) | |||
1398 | /* | 1384 | /* |
1399 | * rs_hangup() --- called by tty_hangup() when a hangup is signaled. | 1385 | * rs_hangup() --- called by tty_hangup() when a hangup is signaled. |
1400 | */ | 1386 | */ |
1401 | void rs_hangup(struct tty_struct *tty) | 1387 | static void rs_hangup(struct tty_struct *tty) |
1402 | { | 1388 | { |
1403 | struct dec_serial * info = (struct dec_serial *)tty->driver_data; | 1389 | struct dec_serial * info = (struct dec_serial *)tty->driver_data; |
1404 | 1390 | ||
@@ -1466,16 +1452,16 @@ static int block_til_ready(struct tty_struct *tty, struct file * filp, | |||
1466 | printk("block_til_ready before block: ttyS%d, count = %d\n", | 1452 | printk("block_til_ready before block: ttyS%d, count = %d\n", |
1467 | info->line, info->count); | 1453 | info->line, info->count); |
1468 | #endif | 1454 | #endif |
1469 | cli(); | 1455 | spin_lock(&zs_lock); |
1470 | if (!tty_hung_up_p(filp)) | 1456 | if (!tty_hung_up_p(filp)) |
1471 | info->count--; | 1457 | info->count--; |
1472 | sti(); | 1458 | spin_unlock_irq(&zs_lock); |
1473 | info->blocked_open++; | 1459 | info->blocked_open++; |
1474 | while (1) { | 1460 | while (1) { |
1475 | cli(); | 1461 | spin_lock(&zs_lock); |
1476 | if (tty->termios->c_cflag & CBAUD) | 1462 | if (tty->termios->c_cflag & CBAUD) |
1477 | zs_rtsdtr(info, RTS | DTR, 1); | 1463 | zs_rtsdtr(info, RTS | DTR, 1); |
1478 | sti(); | 1464 | spin_unlock_irq(&zs_lock); |
1479 | set_current_state(TASK_INTERRUPTIBLE); | 1465 | set_current_state(TASK_INTERRUPTIBLE); |
1480 | if (tty_hung_up_p(filp) || | 1466 | if (tty_hung_up_p(filp) || |
1481 | !(info->flags & ZILOG_INITIALIZED)) { | 1467 | !(info->flags & ZILOG_INITIALIZED)) { |
@@ -1523,7 +1509,7 @@ static int block_til_ready(struct tty_struct *tty, struct file * filp, | |||
1523 | * the IRQ chain. It also performs the serial-specific | 1509 | * the IRQ chain. It also performs the serial-specific |
1524 | * initialization for the tty structure. | 1510 | * initialization for the tty structure. |
1525 | */ | 1511 | */ |
1526 | int rs_open(struct tty_struct *tty, struct file * filp) | 1512 | static int rs_open(struct tty_struct *tty, struct file * filp) |
1527 | { | 1513 | { |
1528 | struct dec_serial *info; | 1514 | struct dec_serial *info; |
1529 | int retval, line; | 1515 | int retval, line; |
@@ -1706,7 +1692,7 @@ static void __init probe_sccs(void) | |||
1706 | } | 1692 | } |
1707 | } | 1693 | } |
1708 | 1694 | ||
1709 | save_and_cli(flags); | 1695 | spin_lock_irqsave(&zs_lock, flags); |
1710 | for (n = 0; n < zs_channels_found; n++) { | 1696 | for (n = 0; n < zs_channels_found; n++) { |
1711 | if (n % 2 == 0) { | 1697 | if (n % 2 == 0) { |
1712 | write_zsreg(zs_soft[n].zs_chan_a, R9, FHWRES); | 1698 | write_zsreg(zs_soft[n].zs_chan_a, R9, FHWRES); |
@@ -1716,7 +1702,7 @@ static void __init probe_sccs(void) | |||
1716 | load_zsregs(zs_soft[n].zs_channel, | 1702 | load_zsregs(zs_soft[n].zs_channel, |
1717 | zs_soft[n].zs_channel->curregs); | 1703 | zs_soft[n].zs_channel->curregs); |
1718 | } | 1704 | } |
1719 | restore_flags(flags); | 1705 | spin_unlock_irqrestore(&zs_lock, flags); |
1720 | } | 1706 | } |
1721 | 1707 | ||
1722 | static struct tty_operations serial_ops = { | 1708 | static struct tty_operations serial_ops = { |
@@ -1749,9 +1735,6 @@ int __init zs_init(void) | |||
1749 | if(!BUS_PRESENT) | 1735 | if(!BUS_PRESENT) |
1750 | return -ENODEV; | 1736 | return -ENODEV; |
1751 | 1737 | ||
1752 | /* Setup base handler, and timer table. */ | ||
1753 | init_bh(SERIAL_BH, do_serial_bh); | ||
1754 | |||
1755 | /* Find out how many Z8530 SCCs we have */ | 1738 | /* Find out how many Z8530 SCCs we have */ |
1756 | if (zs_chain == 0) | 1739 | if (zs_chain == 0) |
1757 | probe_sccs(); | 1740 | probe_sccs(); |
@@ -1800,8 +1783,7 @@ int __init zs_init(void) | |||
1800 | info->event = 0; | 1783 | info->event = 0; |
1801 | info->count = 0; | 1784 | info->count = 0; |
1802 | info->blocked_open = 0; | 1785 | info->blocked_open = 0; |
1803 | info->tqueue.routine = do_softint; | 1786 | tasklet_init(&info->tlet, do_softint, (unsigned long)info); |
1804 | info->tqueue.data = info; | ||
1805 | init_waitqueue_head(&info->open_wait); | 1787 | init_waitqueue_head(&info->open_wait); |
1806 | init_waitqueue_head(&info->close_wait); | 1788 | init_waitqueue_head(&info->close_wait); |
1807 | printk("ttyS%02d at 0x%08x (irq = %d) is a Z85C30 SCC\n", | 1789 | printk("ttyS%02d at 0x%08x (irq = %d) is a Z85C30 SCC\n", |
@@ -1833,8 +1815,7 @@ int __init zs_init(void) | |||
1833 | /* | 1815 | /* |
1834 | * polling I/O routines | 1816 | * polling I/O routines |
1835 | */ | 1817 | */ |
1836 | static int | 1818 | static int zs_poll_tx_char(void *handle, unsigned char ch) |
1837 | zs_poll_tx_char(void *handle, unsigned char ch) | ||
1838 | { | 1819 | { |
1839 | struct dec_serial *info = handle; | 1820 | struct dec_serial *info = handle; |
1840 | struct dec_zschannel *chan = info->zs_channel; | 1821 | struct dec_zschannel *chan = info->zs_channel; |
@@ -1857,8 +1838,7 @@ zs_poll_tx_char(void *handle, unsigned char ch) | |||
1857 | return -ENODEV; | 1838 | return -ENODEV; |
1858 | } | 1839 | } |
1859 | 1840 | ||
1860 | static int | 1841 | static int zs_poll_rx_char(void *handle) |
1861 | zs_poll_rx_char(void *handle) | ||
1862 | { | 1842 | { |
1863 | struct dec_serial *info = handle; | 1843 | struct dec_serial *info = handle; |
1864 | struct dec_zschannel *chan = info->zs_channel; | 1844 | struct dec_zschannel *chan = info->zs_channel; |
@@ -2037,7 +2017,7 @@ static int __init serial_console_setup(struct console *co, char *options) | |||
2037 | } | 2017 | } |
2038 | co->cflag = cflag; | 2018 | co->cflag = cflag; |
2039 | 2019 | ||
2040 | save_and_cli(flags); | 2020 | spin_lock_irqsave(&zs_lock, flags); |
2041 | 2021 | ||
2042 | /* | 2022 | /* |
2043 | * Set up the baud rate generator. | 2023 | * Set up the baud rate generator. |
@@ -2092,7 +2072,7 @@ static int __init serial_console_setup(struct console *co, char *options) | |||
2092 | zs_soft[co->index].clk_divisor = clk_divisor; | 2072 | zs_soft[co->index].clk_divisor = clk_divisor; |
2093 | zs_soft[co->index].zs_baud = get_zsbaud(&zs_soft[co->index]); | 2073 | zs_soft[co->index].zs_baud = get_zsbaud(&zs_soft[co->index]); |
2094 | 2074 | ||
2095 | restore_flags(flags); | 2075 | spin_unlock_irqrestore(&zs_lock, flags); |
2096 | 2076 | ||
2097 | return 0; | 2077 | return 0; |
2098 | } | 2078 | } |
@@ -2229,5 +2209,3 @@ void __init zs_kgdb_hook(int tty_num) | |||
2229 | set_debug_traps(); /* init stub */ | 2209 | set_debug_traps(); /* init stub */ |
2230 | } | 2210 | } |
2231 | #endif /* ifdef CONFIG_KGDB */ | 2211 | #endif /* ifdef CONFIG_KGDB */ |
2232 | |||
2233 | |||
diff --git a/drivers/tc/zs.h b/drivers/tc/zs.h index c52edffa6049..13512200ceba 100644 --- a/drivers/tc/zs.h +++ b/drivers/tc/zs.h | |||
@@ -6,14 +6,14 @@ | |||
6 | * | 6 | * |
7 | * Copyright (C) 1996 Paul Mackerras (Paul.Mackerras@cs.anu.edu.au) | 7 | * Copyright (C) 1996 Paul Mackerras (Paul.Mackerras@cs.anu.edu.au) |
8 | * Copyright (C) 1995 David S. Miller (davem@caip.rutgers.edu) | 8 | * Copyright (C) 1995 David S. Miller (davem@caip.rutgers.edu) |
9 | * Copyright (C) 2004 Maciej W. Rozycki | 9 | * Copyright (C) 2004, 2005 Maciej W. Rozycki |
10 | */ | 10 | */ |
11 | #ifndef _DECSERIAL_H | 11 | #ifndef _DECSERIAL_H |
12 | #define _DECSERIAL_H | 12 | #define _DECSERIAL_H |
13 | 13 | ||
14 | #include <asm/dec/serial.h> | 14 | #include <asm/dec/serial.h> |
15 | 15 | ||
16 | #define NUM_ZSREGS 16 | 16 | #define NUM_ZSREGS 16 |
17 | 17 | ||
18 | struct serial_struct { | 18 | struct serial_struct { |
19 | int type; | 19 | int type; |
@@ -139,8 +139,7 @@ struct dec_serial { | |||
139 | int xmit_head; | 139 | int xmit_head; |
140 | int xmit_tail; | 140 | int xmit_tail; |
141 | int xmit_cnt; | 141 | int xmit_cnt; |
142 | struct tq_struct tqueue; | 142 | struct tasklet_struct tlet; |
143 | struct tq_struct tqueue_hangup; | ||
144 | wait_queue_head_t open_wait; | 143 | wait_queue_head_t open_wait; |
145 | wait_queue_head_t close_wait; | 144 | wait_queue_head_t close_wait; |
146 | }; | 145 | }; |
@@ -282,7 +281,7 @@ struct dec_serial { | |||
282 | #define DLC 4 /* Disable Lower Chain */ | 281 | #define DLC 4 /* Disable Lower Chain */ |
283 | #define MIE 8 /* Master Interrupt Enable */ | 282 | #define MIE 8 /* Master Interrupt Enable */ |
284 | #define STATHI 0x10 /* Status high */ | 283 | #define STATHI 0x10 /* Status high */ |
285 | #define SOFTACK 0x20 /* Software Interrupt Acknowledge */ | 284 | #define SOFTACK 0x20 /* Software Interrupt Acknowledge */ |
286 | #define NORESET 0 /* No reset on write to R9 */ | 285 | #define NORESET 0 /* No reset on write to R9 */ |
287 | #define CHRB 0x40 /* Reset channel B */ | 286 | #define CHRB 0x40 /* Reset channel B */ |
288 | #define CHRA 0x80 /* Reset channel A */ | 287 | #define CHRA 0x80 /* Reset channel A */ |
@@ -395,8 +394,8 @@ struct dec_serial { | |||
395 | /* Read Register 15 (value of WR 15) */ | 394 | /* Read Register 15 (value of WR 15) */ |
396 | 395 | ||
397 | /* Misc macros */ | 396 | /* Misc macros */ |
398 | #define ZS_CLEARERR(channel) (write_zsreg(channel, 0, ERR_RES)) | 397 | #define ZS_CLEARERR(channel) (write_zsreg(channel, 0, ERR_RES)) |
399 | #define ZS_CLEARFIFO(channel) do { volatile unsigned char garbage; \ | 398 | #define ZS_CLEARFIFO(channel) do { volatile unsigned char garbage; \ |
400 | garbage = read_zsdata(channel); \ | 399 | garbage = read_zsdata(channel); \ |
401 | garbage = read_zsdata(channel); \ | 400 | garbage = read_zsdata(channel); \ |
402 | garbage = read_zsdata(channel); \ | 401 | garbage = read_zsdata(channel); \ |
diff --git a/drivers/usb/atm/Makefile b/drivers/usb/atm/Makefile index 751f297be2ef..85099718c683 100644 --- a/drivers/usb/atm/Makefile +++ b/drivers/usb/atm/Makefile | |||
@@ -6,3 +6,7 @@ obj-$(CONFIG_USB_CXACRU) += cxacru.o | |||
6 | obj-$(CONFIG_USB_SPEEDTOUCH) += speedtch.o | 6 | obj-$(CONFIG_USB_SPEEDTOUCH) += speedtch.o |
7 | obj-$(CONFIG_USB_ATM) += usbatm.o | 7 | obj-$(CONFIG_USB_ATM) += usbatm.o |
8 | obj-$(CONFIG_USB_XUSBATM) += xusbatm.o | 8 | obj-$(CONFIG_USB_XUSBATM) += xusbatm.o |
9 | |||
10 | ifeq ($(CONFIG_USB_DEBUG),y) | ||
11 | EXTRA_CFLAGS += -DDEBUG | ||
12 | endif | ||
diff --git a/drivers/usb/atm/usbatm.h b/drivers/usb/atm/usbatm.h index 936646457935..1adacd60d713 100644 --- a/drivers/usb/atm/usbatm.h +++ b/drivers/usb/atm/usbatm.h | |||
@@ -27,14 +27,9 @@ | |||
27 | #include <linux/config.h> | 27 | #include <linux/config.h> |
28 | 28 | ||
29 | /* | 29 | /* |
30 | #define DEBUG | ||
31 | #define VERBOSE_DEBUG | 30 | #define VERBOSE_DEBUG |
32 | */ | 31 | */ |
33 | 32 | ||
34 | #if !defined (DEBUG) && defined (CONFIG_USB_DEBUG) | ||
35 | # define DEBUG | ||
36 | #endif | ||
37 | |||
38 | #include <asm/semaphore.h> | 33 | #include <asm/semaphore.h> |
39 | #include <linux/atm.h> | 34 | #include <linux/atm.h> |
40 | #include <linux/atmdev.h> | 35 | #include <linux/atmdev.h> |
diff --git a/drivers/usb/core/Makefile b/drivers/usb/core/Makefile index dd1c4d2a0c31..86d5c380892d 100644 --- a/drivers/usb/core/Makefile +++ b/drivers/usb/core/Makefile | |||
@@ -14,3 +14,7 @@ ifeq ($(CONFIG_USB_DEVICEFS),y) | |||
14 | endif | 14 | endif |
15 | 15 | ||
16 | obj-$(CONFIG_USB) += usbcore.o | 16 | obj-$(CONFIG_USB) += usbcore.o |
17 | |||
18 | ifeq ($(CONFIG_USB_DEBUG),y) | ||
19 | EXTRA_CFLAGS += -DDEBUG | ||
20 | endif | ||
diff --git a/drivers/usb/core/buffer.c b/drivers/usb/core/buffer.c index 57e800ac3cee..419c9943a7cb 100644 --- a/drivers/usb/core/buffer.c +++ b/drivers/usb/core/buffer.c | |||
@@ -15,14 +15,6 @@ | |||
15 | #include <asm/scatterlist.h> | 15 | #include <asm/scatterlist.h> |
16 | #include <linux/dma-mapping.h> | 16 | #include <linux/dma-mapping.h> |
17 | #include <linux/dmapool.h> | 17 | #include <linux/dmapool.h> |
18 | |||
19 | |||
20 | #ifdef CONFIG_USB_DEBUG | ||
21 | #define DEBUG | ||
22 | #else | ||
23 | #undef DEBUG | ||
24 | #endif | ||
25 | |||
26 | #include <linux/usb.h> | 18 | #include <linux/usb.h> |
27 | #include "hcd.h" | 19 | #include "hcd.h" |
28 | 20 | ||
diff --git a/drivers/usb/core/config.c b/drivers/usb/core/config.c index 993019500cc3..a9d89c78cc20 100644 --- a/drivers/usb/core/config.c +++ b/drivers/usb/core/config.c | |||
@@ -1,9 +1,4 @@ | |||
1 | #include <linux/config.h> | 1 | #include <linux/config.h> |
2 | |||
3 | #ifdef CONFIG_USB_DEBUG | ||
4 | #define DEBUG | ||
5 | #endif | ||
6 | |||
7 | #include <linux/usb.h> | 2 | #include <linux/usb.h> |
8 | #include <linux/module.h> | 3 | #include <linux/module.h> |
9 | #include <linux/init.h> | 4 | #include <linux/init.h> |
diff --git a/drivers/usb/core/devio.c b/drivers/usb/core/devio.c index 942cd437dc48..b1d6e9af732d 100644 --- a/drivers/usb/core/devio.c +++ b/drivers/usb/core/devio.c | |||
@@ -1392,13 +1392,13 @@ static int proc_ioctl_default(struct dev_state *ps, void __user *arg) | |||
1392 | } | 1392 | } |
1393 | 1393 | ||
1394 | #ifdef CONFIG_COMPAT | 1394 | #ifdef CONFIG_COMPAT |
1395 | static int proc_ioctl_compat(struct dev_state *ps, void __user *arg) | 1395 | static int proc_ioctl_compat(struct dev_state *ps, compat_uptr_t arg) |
1396 | { | 1396 | { |
1397 | struct usbdevfs_ioctl32 __user *uioc; | 1397 | struct usbdevfs_ioctl32 __user *uioc; |
1398 | struct usbdevfs_ioctl ctrl; | 1398 | struct usbdevfs_ioctl ctrl; |
1399 | u32 udata; | 1399 | u32 udata; |
1400 | 1400 | ||
1401 | uioc = compat_ptr(arg); | 1401 | uioc = compat_ptr((long)arg); |
1402 | if (get_user(ctrl.ifno, &uioc->ifno) || | 1402 | if (get_user(ctrl.ifno, &uioc->ifno) || |
1403 | get_user(ctrl.ioctl_code, &uioc->ioctl_code) || | 1403 | get_user(ctrl.ioctl_code, &uioc->ioctl_code) || |
1404 | __get_user(udata, &uioc->data)) | 1404 | __get_user(udata, &uioc->data)) |
@@ -1511,7 +1511,7 @@ static int usbdev_ioctl(struct inode *inode, struct file *file, unsigned int cmd | |||
1511 | 1511 | ||
1512 | case USBDEVFS_IOCTL32: | 1512 | case USBDEVFS_IOCTL32: |
1513 | snoop(&dev->dev, "%s: IOCTL\n", __FUNCTION__); | 1513 | snoop(&dev->dev, "%s: IOCTL\n", __FUNCTION__); |
1514 | ret = proc_ioctl_compat(ps, p); | 1514 | ret = proc_ioctl_compat(ps, (compat_uptr_t)(long)p); |
1515 | break; | 1515 | break; |
1516 | #endif | 1516 | #endif |
1517 | 1517 | ||
diff --git a/drivers/usb/core/file.c b/drivers/usb/core/file.c index e695308095ae..37b13368c814 100644 --- a/drivers/usb/core/file.c +++ b/drivers/usb/core/file.c | |||
@@ -19,12 +19,6 @@ | |||
19 | #include <linux/module.h> | 19 | #include <linux/module.h> |
20 | #include <linux/spinlock.h> | 20 | #include <linux/spinlock.h> |
21 | #include <linux/errno.h> | 21 | #include <linux/errno.h> |
22 | |||
23 | #ifdef CONFIG_USB_DEBUG | ||
24 | #define DEBUG | ||
25 | #else | ||
26 | #undef DEBUG | ||
27 | #endif | ||
28 | #include <linux/usb.h> | 22 | #include <linux/usb.h> |
29 | 23 | ||
30 | #include "usb.h" | 24 | #include "usb.h" |
diff --git a/drivers/usb/core/hcd-pci.c b/drivers/usb/core/hcd-pci.c index 84d9e69329bb..7feb829362d6 100644 --- a/drivers/usb/core/hcd-pci.c +++ b/drivers/usb/core/hcd-pci.c | |||
@@ -17,13 +17,6 @@ | |||
17 | */ | 17 | */ |
18 | 18 | ||
19 | #include <linux/config.h> | 19 | #include <linux/config.h> |
20 | |||
21 | #ifdef CONFIG_USB_DEBUG | ||
22 | #define DEBUG | ||
23 | #else | ||
24 | #undef DEBUG | ||
25 | #endif | ||
26 | |||
27 | #include <linux/kernel.h> | 20 | #include <linux/kernel.h> |
28 | #include <linux/module.h> | 21 | #include <linux/module.h> |
29 | #include <linux/pci.h> | 22 | #include <linux/pci.h> |
diff --git a/drivers/usb/core/hcd.c b/drivers/usb/core/hcd.c index 6c7ca5b08cd6..5e5f65a475ab 100644 --- a/drivers/usb/core/hcd.c +++ b/drivers/usb/core/hcd.c | |||
@@ -23,11 +23,6 @@ | |||
23 | */ | 23 | */ |
24 | 24 | ||
25 | #include <linux/config.h> | 25 | #include <linux/config.h> |
26 | |||
27 | #ifdef CONFIG_USB_DEBUG | ||
28 | #define DEBUG | ||
29 | #endif | ||
30 | |||
31 | #include <linux/module.h> | 26 | #include <linux/module.h> |
32 | #include <linux/version.h> | 27 | #include <linux/version.h> |
33 | #include <linux/kernel.h> | 28 | #include <linux/kernel.h> |
diff --git a/drivers/usb/core/hub.c b/drivers/usb/core/hub.c index 256d9f698715..840727948d84 100644 --- a/drivers/usb/core/hub.c +++ b/drivers/usb/core/hub.c | |||
@@ -9,11 +9,6 @@ | |||
9 | */ | 9 | */ |
10 | 10 | ||
11 | #include <linux/config.h> | 11 | #include <linux/config.h> |
12 | #ifdef CONFIG_USB_DEBUG | ||
13 | #define DEBUG | ||
14 | #else | ||
15 | #undef DEBUG | ||
16 | #endif | ||
17 | #include <linux/kernel.h> | 12 | #include <linux/kernel.h> |
18 | #include <linux/errno.h> | 13 | #include <linux/errno.h> |
19 | #include <linux/module.h> | 14 | #include <linux/module.h> |
diff --git a/drivers/usb/core/inode.c b/drivers/usb/core/inode.c index 12f490fdee8f..c44bbedec817 100644 --- a/drivers/usb/core/inode.c +++ b/drivers/usb/core/inode.c | |||
@@ -46,7 +46,6 @@ | |||
46 | 46 | ||
47 | static struct super_operations usbfs_ops; | 47 | static struct super_operations usbfs_ops; |
48 | static struct file_operations default_file_operations; | 48 | static struct file_operations default_file_operations; |
49 | static struct inode_operations usbfs_dir_inode_operations; | ||
50 | static struct vfsmount *usbfs_mount; | 49 | static struct vfsmount *usbfs_mount; |
51 | static int usbfs_mount_count; /* = 0 */ | 50 | static int usbfs_mount_count; /* = 0 */ |
52 | static int ignore_mount = 0; | 51 | static int ignore_mount = 0; |
@@ -262,7 +261,7 @@ static struct inode *usbfs_get_inode (struct super_block *sb, int mode, dev_t de | |||
262 | inode->i_fop = &default_file_operations; | 261 | inode->i_fop = &default_file_operations; |
263 | break; | 262 | break; |
264 | case S_IFDIR: | 263 | case S_IFDIR: |
265 | inode->i_op = &usbfs_dir_inode_operations; | 264 | inode->i_op = &simple_dir_inode_operations; |
266 | inode->i_fop = &simple_dir_operations; | 265 | inode->i_fop = &simple_dir_operations; |
267 | 266 | ||
268 | /* directory inodes start off with i_nlink == 2 (for "." entry) */ | 267 | /* directory inodes start off with i_nlink == 2 (for "." entry) */ |
@@ -417,10 +416,6 @@ static struct file_operations default_file_operations = { | |||
417 | .llseek = default_file_lseek, | 416 | .llseek = default_file_lseek, |
418 | }; | 417 | }; |
419 | 418 | ||
420 | static struct inode_operations usbfs_dir_inode_operations = { | ||
421 | .lookup = simple_lookup, | ||
422 | }; | ||
423 | |||
424 | static struct super_operations usbfs_ops = { | 419 | static struct super_operations usbfs_ops = { |
425 | .statfs = simple_statfs, | 420 | .statfs = simple_statfs, |
426 | .drop_inode = generic_delete_inode, | 421 | .drop_inode = generic_delete_inode, |
diff --git a/drivers/usb/core/message.c b/drivers/usb/core/message.c index 644a3d4f12aa..fe74f99ca5f4 100644 --- a/drivers/usb/core/message.c +++ b/drivers/usb/core/message.c | |||
@@ -3,13 +3,6 @@ | |||
3 | */ | 3 | */ |
4 | 4 | ||
5 | #include <linux/config.h> | 5 | #include <linux/config.h> |
6 | |||
7 | #ifdef CONFIG_USB_DEBUG | ||
8 | #define DEBUG | ||
9 | #else | ||
10 | #undef DEBUG | ||
11 | #endif | ||
12 | |||
13 | #include <linux/pci.h> /* for scatterlist macros */ | 6 | #include <linux/pci.h> /* for scatterlist macros */ |
14 | #include <linux/usb.h> | 7 | #include <linux/usb.h> |
15 | #include <linux/module.h> | 8 | #include <linux/module.h> |
@@ -1457,12 +1450,11 @@ free_interfaces: | |||
1457 | */ | 1450 | */ |
1458 | for (i = 0; i < nintf; ++i) { | 1451 | for (i = 0; i < nintf; ++i) { |
1459 | struct usb_interface *intf = cp->interface[i]; | 1452 | struct usb_interface *intf = cp->interface[i]; |
1460 | struct usb_host_interface *alt = intf->cur_altsetting; | ||
1461 | 1453 | ||
1462 | dev_dbg (&dev->dev, | 1454 | dev_dbg (&dev->dev, |
1463 | "adding %s (config #%d, interface %d)\n", | 1455 | "adding %s (config #%d, interface %d)\n", |
1464 | intf->dev.bus_id, configuration, | 1456 | intf->dev.bus_id, configuration, |
1465 | alt->desc.bInterfaceNumber); | 1457 | intf->cur_altsetting->desc.bInterfaceNumber); |
1466 | ret = device_add (&intf->dev); | 1458 | ret = device_add (&intf->dev); |
1467 | if (ret != 0) { | 1459 | if (ret != 0) { |
1468 | dev_err(&dev->dev, | 1460 | dev_err(&dev->dev, |
diff --git a/drivers/usb/core/notify.c b/drivers/usb/core/notify.c index 37da059eced7..fbbebab52fbd 100644 --- a/drivers/usb/core/notify.c +++ b/drivers/usb/core/notify.c | |||
@@ -12,13 +12,7 @@ | |||
12 | #include <linux/config.h> | 12 | #include <linux/config.h> |
13 | #include <linux/kernel.h> | 13 | #include <linux/kernel.h> |
14 | #include <linux/notifier.h> | 14 | #include <linux/notifier.h> |
15 | #ifdef CONFIG_USB_DEBUG | ||
16 | #define DEBUG | ||
17 | #else | ||
18 | #undef DEBUG | ||
19 | #endif | ||
20 | #include <linux/usb.h> | 15 | #include <linux/usb.h> |
21 | |||
22 | #include "usb.h" | 16 | #include "usb.h" |
23 | 17 | ||
24 | 18 | ||
diff --git a/drivers/usb/core/sysfs.c b/drivers/usb/core/sysfs.c index edd83e014452..71d881327e88 100644 --- a/drivers/usb/core/sysfs.c +++ b/drivers/usb/core/sysfs.c | |||
@@ -12,14 +12,7 @@ | |||
12 | 12 | ||
13 | #include <linux/config.h> | 13 | #include <linux/config.h> |
14 | #include <linux/kernel.h> | 14 | #include <linux/kernel.h> |
15 | |||
16 | #ifdef CONFIG_USB_DEBUG | ||
17 | #define DEBUG | ||
18 | #else | ||
19 | #undef DEBUG | ||
20 | #endif | ||
21 | #include <linux/usb.h> | 15 | #include <linux/usb.h> |
22 | |||
23 | #include "usb.h" | 16 | #include "usb.h" |
24 | 17 | ||
25 | /* endpoint stuff */ | 18 | /* endpoint stuff */ |
diff --git a/drivers/usb/core/urb.c b/drivers/usb/core/urb.c index f2a1fed2a802..081796726b95 100644 --- a/drivers/usb/core/urb.c +++ b/drivers/usb/core/urb.c | |||
@@ -4,12 +4,6 @@ | |||
4 | #include <linux/bitops.h> | 4 | #include <linux/bitops.h> |
5 | #include <linux/slab.h> | 5 | #include <linux/slab.h> |
6 | #include <linux/init.h> | 6 | #include <linux/init.h> |
7 | |||
8 | #ifdef CONFIG_USB_DEBUG | ||
9 | #define DEBUG | ||
10 | #else | ||
11 | #undef DEBUG | ||
12 | #endif | ||
13 | #include <linux/usb.h> | 7 | #include <linux/usb.h> |
14 | #include "hcd.h" | 8 | #include "hcd.h" |
15 | 9 | ||
diff --git a/drivers/usb/core/usb.c b/drivers/usb/core/usb.c index 0eefff7bcb3c..e197ce9353de 100644 --- a/drivers/usb/core/usb.c +++ b/drivers/usb/core/usb.c | |||
@@ -22,13 +22,6 @@ | |||
22 | */ | 22 | */ |
23 | 23 | ||
24 | #include <linux/config.h> | 24 | #include <linux/config.h> |
25 | |||
26 | #ifdef CONFIG_USB_DEBUG | ||
27 | #define DEBUG | ||
28 | #else | ||
29 | #undef DEBUG | ||
30 | #endif | ||
31 | |||
32 | #include <linux/module.h> | 25 | #include <linux/module.h> |
33 | #include <linux/string.h> | 26 | #include <linux/string.h> |
34 | #include <linux/bitops.h> | 27 | #include <linux/bitops.h> |
diff --git a/drivers/usb/gadget/dummy_hcd.c b/drivers/usb/gadget/dummy_hcd.c index 1e407745c115..c655d46c8aed 100644 --- a/drivers/usb/gadget/dummy_hcd.c +++ b/drivers/usb/gadget/dummy_hcd.c | |||
@@ -944,7 +944,7 @@ static int dummy_udc_suspend (struct platform_device *dev, pm_message_t state) | |||
944 | set_link_state (dum); | 944 | set_link_state (dum); |
945 | spin_unlock_irq (&dum->lock); | 945 | spin_unlock_irq (&dum->lock); |
946 | 946 | ||
947 | dev->power.power_state = state; | 947 | dev->dev.power.power_state = state; |
948 | usb_hcd_poll_rh_status (dummy_to_hcd (dum)); | 948 | usb_hcd_poll_rh_status (dummy_to_hcd (dum)); |
949 | return 0; | 949 | return 0; |
950 | } | 950 | } |
@@ -1904,7 +1904,7 @@ static int dummy_hcd_probe (struct platform_device *dev) | |||
1904 | struct usb_hcd *hcd; | 1904 | struct usb_hcd *hcd; |
1905 | int retval; | 1905 | int retval; |
1906 | 1906 | ||
1907 | dev_info (dev, "%s, driver " DRIVER_VERSION "\n", driver_desc); | 1907 | dev_info(&dev->dev, "%s, driver " DRIVER_VERSION "\n", driver_desc); |
1908 | 1908 | ||
1909 | hcd = usb_create_hcd (&dummy_hcd, &dev->dev, dev->dev.bus_id); | 1909 | hcd = usb_create_hcd (&dummy_hcd, &dev->dev, dev->dev.bus_id); |
1910 | if (!hcd) | 1910 | if (!hcd) |
diff --git a/drivers/usb/host/ohci-lh7a404.c b/drivers/usb/host/ohci-lh7a404.c index 081ec3f5cff4..3959ccc88332 100644 --- a/drivers/usb/host/ohci-lh7a404.c +++ b/drivers/usb/host/ohci-lh7a404.c | |||
@@ -219,7 +219,7 @@ static int ohci_hcd_lh7a404_drv_probe(struct platform_device *pdev) | |||
219 | 219 | ||
220 | static int ohci_hcd_lh7a404_drv_remove(struct platform_device *pdev) | 220 | static int ohci_hcd_lh7a404_drv_remove(struct platform_device *pdev) |
221 | { | 221 | { |
222 | struct usb_hcd *hcd = platform_get_drvdata(dev); | 222 | struct usb_hcd *hcd = platform_get_drvdata(pdev); |
223 | 223 | ||
224 | usb_hcd_lh7a404_remove(hcd, pdev); | 224 | usb_hcd_lh7a404_remove(hcd, pdev); |
225 | return 0; | 225 | return 0; |
diff --git a/drivers/usb/host/ohci-ppc-soc.c b/drivers/usb/host/ohci-ppc-soc.c index 18755766e406..2ec6a78bd65e 100644 --- a/drivers/usb/host/ohci-ppc-soc.c +++ b/drivers/usb/host/ohci-ppc-soc.c | |||
@@ -185,7 +185,7 @@ static int ohci_hcd_ppc_soc_drv_probe(struct platform_device *pdev) | |||
185 | 185 | ||
186 | static int ohci_hcd_ppc_soc_drv_remove(struct platform_device *pdev) | 186 | static int ohci_hcd_ppc_soc_drv_remove(struct platform_device *pdev) |
187 | { | 187 | { |
188 | struct usb_hcd *hcd = platform_get_drvdata(dev); | 188 | struct usb_hcd *hcd = platform_get_drvdata(pdev); |
189 | 189 | ||
190 | usb_hcd_ppc_soc_remove(hcd, pdev); | 190 | usb_hcd_ppc_soc_remove(hcd, pdev); |
191 | return 0; | 191 | return 0; |
diff --git a/drivers/usb/image/microtek.c b/drivers/usb/image/microtek.c index 61a2604cce4f..950543aa5ac7 100644 --- a/drivers/usb/image/microtek.c +++ b/drivers/usb/image/microtek.c | |||
@@ -327,6 +327,18 @@ static inline void mts_urb_abort(struct mts_desc* desc) { | |||
327 | usb_kill_urb( desc->urb ); | 327 | usb_kill_urb( desc->urb ); |
328 | } | 328 | } |
329 | 329 | ||
330 | static int mts_slave_alloc (struct scsi_device *s) | ||
331 | { | ||
332 | s->inquiry_len = 0x24; | ||
333 | return 0; | ||
334 | } | ||
335 | |||
336 | static int mts_slave_configure (struct scsi_device *s) | ||
337 | { | ||
338 | blk_queue_dma_alignment(s->request_queue, (512 - 1)); | ||
339 | return 0; | ||
340 | } | ||
341 | |||
330 | static int mts_scsi_abort (Scsi_Cmnd *srb) | 342 | static int mts_scsi_abort (Scsi_Cmnd *srb) |
331 | { | 343 | { |
332 | struct mts_desc* desc = (struct mts_desc*)(srb->device->host->hostdata[0]); | 344 | struct mts_desc* desc = (struct mts_desc*)(srb->device->host->hostdata[0]); |
@@ -411,7 +423,7 @@ static void mts_transfer_done( struct urb *transfer, struct pt_regs *regs ) | |||
411 | MTS_INT_INIT(); | 423 | MTS_INT_INIT(); |
412 | 424 | ||
413 | context->srb->result &= MTS_SCSI_ERR_MASK; | 425 | context->srb->result &= MTS_SCSI_ERR_MASK; |
414 | context->srb->result |= (unsigned)context->status<<1; | 426 | context->srb->result |= (unsigned)(*context->scsi_status)<<1; |
415 | 427 | ||
416 | mts_transfer_cleanup(transfer); | 428 | mts_transfer_cleanup(transfer); |
417 | 429 | ||
@@ -427,7 +439,7 @@ static void mts_get_status( struct urb *transfer ) | |||
427 | mts_int_submit_urb(transfer, | 439 | mts_int_submit_urb(transfer, |
428 | usb_rcvbulkpipe(context->instance->usb_dev, | 440 | usb_rcvbulkpipe(context->instance->usb_dev, |
429 | context->instance->ep_response), | 441 | context->instance->ep_response), |
430 | &context->status, | 442 | context->scsi_status, |
431 | 1, | 443 | 1, |
432 | mts_transfer_done ); | 444 | mts_transfer_done ); |
433 | } | 445 | } |
@@ -481,7 +493,7 @@ static void mts_command_done( struct urb *transfer, struct pt_regs *regs ) | |||
481 | context->data_pipe, | 493 | context->data_pipe, |
482 | context->data, | 494 | context->data, |
483 | context->data_length, | 495 | context->data_length, |
484 | context->srb->use_sg ? mts_do_sg : mts_data_done); | 496 | context->srb->use_sg > 1 ? mts_do_sg : mts_data_done); |
485 | } else { | 497 | } else { |
486 | mts_get_status(transfer); | 498 | mts_get_status(transfer); |
487 | } | 499 | } |
@@ -627,7 +639,6 @@ int mts_scsi_queuecommand( Scsi_Cmnd *srb, mts_scsi_cmnd_callback callback ) | |||
627 | callback(srb); | 639 | callback(srb); |
628 | 640 | ||
629 | } | 641 | } |
630 | |||
631 | out: | 642 | out: |
632 | return err; | 643 | return err; |
633 | } | 644 | } |
@@ -645,6 +656,9 @@ static struct scsi_host_template mts_scsi_host_template = { | |||
645 | .cmd_per_lun = 1, | 656 | .cmd_per_lun = 1, |
646 | .use_clustering = 1, | 657 | .use_clustering = 1, |
647 | .emulated = 1, | 658 | .emulated = 1, |
659 | .slave_alloc = mts_slave_alloc, | ||
660 | .slave_configure = mts_slave_configure, | ||
661 | .max_sectors= 256, /* 128 K */ | ||
648 | }; | 662 | }; |
649 | 663 | ||
650 | struct vendor_product | 664 | struct vendor_product |
@@ -771,8 +785,8 @@ static int mts_usb_probe(struct usb_interface *intf, | |||
771 | MTS_WARNING( "couldn't find an output bulk endpoint. Bailing out.\n" ); | 785 | MTS_WARNING( "couldn't find an output bulk endpoint. Bailing out.\n" ); |
772 | return -ENODEV; | 786 | return -ENODEV; |
773 | } | 787 | } |
774 | 788 | ||
775 | 789 | ||
776 | new_desc = kzalloc(sizeof(struct mts_desc), GFP_KERNEL); | 790 | new_desc = kzalloc(sizeof(struct mts_desc), GFP_KERNEL); |
777 | if (!new_desc) | 791 | if (!new_desc) |
778 | goto out; | 792 | goto out; |
@@ -781,6 +795,10 @@ static int mts_usb_probe(struct usb_interface *intf, | |||
781 | if (!new_desc->urb) | 795 | if (!new_desc->urb) |
782 | goto out_kfree; | 796 | goto out_kfree; |
783 | 797 | ||
798 | new_desc->context.scsi_status = kmalloc(1, GFP_KERNEL); | ||
799 | if (!new_desc->context.scsi_status) | ||
800 | goto out_kfree2; | ||
801 | |||
784 | new_desc->usb_dev = dev; | 802 | new_desc->usb_dev = dev; |
785 | new_desc->usb_intf = intf; | 803 | new_desc->usb_intf = intf; |
786 | init_MUTEX(&new_desc->lock); | 804 | init_MUTEX(&new_desc->lock); |
@@ -817,6 +835,8 @@ static int mts_usb_probe(struct usb_interface *intf, | |||
817 | usb_set_intfdata(intf, new_desc); | 835 | usb_set_intfdata(intf, new_desc); |
818 | return 0; | 836 | return 0; |
819 | 837 | ||
838 | out_kfree2: | ||
839 | kfree(new_desc->context.scsi_status); | ||
820 | out_free_urb: | 840 | out_free_urb: |
821 | usb_free_urb(new_desc->urb); | 841 | usb_free_urb(new_desc->urb); |
822 | out_kfree: | 842 | out_kfree: |
@@ -836,6 +856,7 @@ static void mts_usb_disconnect (struct usb_interface *intf) | |||
836 | 856 | ||
837 | scsi_host_put(desc->host); | 857 | scsi_host_put(desc->host); |
838 | usb_free_urb(desc->urb); | 858 | usb_free_urb(desc->urb); |
859 | kfree(desc->context.scsi_status); | ||
839 | kfree(desc); | 860 | kfree(desc); |
840 | } | 861 | } |
841 | 862 | ||
@@ -856,5 +877,3 @@ module_exit(microtek_drv_exit); | |||
856 | MODULE_AUTHOR( DRIVER_AUTHOR ); | 877 | MODULE_AUTHOR( DRIVER_AUTHOR ); |
857 | MODULE_DESCRIPTION( DRIVER_DESC ); | 878 | MODULE_DESCRIPTION( DRIVER_DESC ); |
858 | MODULE_LICENSE("GPL"); | 879 | MODULE_LICENSE("GPL"); |
859 | |||
860 | |||
diff --git a/drivers/usb/image/microtek.h b/drivers/usb/image/microtek.h index 3271deb8c001..926d4bdc6746 100644 --- a/drivers/usb/image/microtek.h +++ b/drivers/usb/image/microtek.h | |||
@@ -22,7 +22,7 @@ struct mts_transfer_context | |||
22 | int data_pipe; | 22 | int data_pipe; |
23 | int fragment; | 23 | int fragment; |
24 | 24 | ||
25 | u8 status; /* status returned from ep_response after command completion */ | 25 | u8 *scsi_status; /* status returned from ep_response after command completion */ |
26 | }; | 26 | }; |
27 | 27 | ||
28 | 28 | ||
diff --git a/drivers/usb/input/Makefile b/drivers/usb/input/Makefile index 5e03b93f29f6..07cb17db42fc 100644 --- a/drivers/usb/input/Makefile +++ b/drivers/usb/input/Makefile | |||
@@ -42,3 +42,7 @@ obj-$(CONFIG_USB_ACECAD) += acecad.o | |||
42 | obj-$(CONFIG_USB_YEALINK) += yealink.o | 42 | obj-$(CONFIG_USB_YEALINK) += yealink.o |
43 | obj-$(CONFIG_USB_XPAD) += xpad.o | 43 | obj-$(CONFIG_USB_XPAD) += xpad.o |
44 | obj-$(CONFIG_USB_APPLETOUCH) += appletouch.o | 44 | obj-$(CONFIG_USB_APPLETOUCH) += appletouch.o |
45 | |||
46 | ifeq ($(CONFIG_USB_DEBUG),y) | ||
47 | EXTRA_CFLAGS += -DDEBUG | ||
48 | endif | ||
diff --git a/drivers/usb/input/hid-core.c b/drivers/usb/input/hid-core.c index 79ddce4555ab..45f3130fadea 100644 --- a/drivers/usb/input/hid-core.c +++ b/drivers/usb/input/hid-core.c | |||
@@ -1318,6 +1318,7 @@ void hid_init_reports(struct hid_device *hid) | |||
1318 | #define USB_DEVICE_ID_WACOM_PTU 0x0003 | 1318 | #define USB_DEVICE_ID_WACOM_PTU 0x0003 |
1319 | #define USB_DEVICE_ID_WACOM_INTUOS3 0x00B0 | 1319 | #define USB_DEVICE_ID_WACOM_INTUOS3 0x00B0 |
1320 | #define USB_DEVICE_ID_WACOM_CINTIQ 0x003F | 1320 | #define USB_DEVICE_ID_WACOM_CINTIQ 0x003F |
1321 | #define USB_DEVICE_ID_WACOM_DTF 0x00C0 | ||
1321 | 1322 | ||
1322 | #define USB_VENDOR_ID_ACECAD 0x0460 | 1323 | #define USB_VENDOR_ID_ACECAD 0x0460 |
1323 | #define USB_DEVICE_ID_ACECAD_FLAIR 0x0004 | 1324 | #define USB_DEVICE_ID_ACECAD_FLAIR 0x0004 |
@@ -1524,6 +1525,9 @@ static struct hid_blacklist { | |||
1524 | { USB_VENDOR_ID_WACOM, USB_DEVICE_ID_WACOM_PL + 3, HID_QUIRK_IGNORE }, | 1525 | { USB_VENDOR_ID_WACOM, USB_DEVICE_ID_WACOM_PL + 3, HID_QUIRK_IGNORE }, |
1525 | { USB_VENDOR_ID_WACOM, USB_DEVICE_ID_WACOM_PL + 4, HID_QUIRK_IGNORE }, | 1526 | { USB_VENDOR_ID_WACOM, USB_DEVICE_ID_WACOM_PL + 4, HID_QUIRK_IGNORE }, |
1526 | { USB_VENDOR_ID_WACOM, USB_DEVICE_ID_WACOM_PL + 5, HID_QUIRK_IGNORE }, | 1527 | { USB_VENDOR_ID_WACOM, USB_DEVICE_ID_WACOM_PL + 5, HID_QUIRK_IGNORE }, |
1528 | { USB_VENDOR_ID_WACOM, USB_DEVICE_ID_WACOM_PL + 7, HID_QUIRK_IGNORE }, | ||
1529 | { USB_VENDOR_ID_WACOM, USB_DEVICE_ID_WACOM_PL + 8, HID_QUIRK_IGNORE }, | ||
1530 | { USB_VENDOR_ID_WACOM, USB_DEVICE_ID_WACOM_PL + 9, HID_QUIRK_IGNORE }, | ||
1527 | { USB_VENDOR_ID_WACOM, USB_DEVICE_ID_WACOM_INTUOS2 + 1, HID_QUIRK_IGNORE }, | 1531 | { USB_VENDOR_ID_WACOM, USB_DEVICE_ID_WACOM_INTUOS2 + 1, HID_QUIRK_IGNORE }, |
1528 | { USB_VENDOR_ID_WACOM, USB_DEVICE_ID_WACOM_INTUOS2 + 2, HID_QUIRK_IGNORE }, | 1532 | { USB_VENDOR_ID_WACOM, USB_DEVICE_ID_WACOM_INTUOS2 + 2, HID_QUIRK_IGNORE }, |
1529 | { USB_VENDOR_ID_WACOM, USB_DEVICE_ID_WACOM_INTUOS2 + 3, HID_QUIRK_IGNORE }, | 1533 | { USB_VENDOR_ID_WACOM, USB_DEVICE_ID_WACOM_INTUOS2 + 3, HID_QUIRK_IGNORE }, |
@@ -1531,11 +1535,19 @@ static struct hid_blacklist { | |||
1531 | { USB_VENDOR_ID_WACOM, USB_DEVICE_ID_WACOM_INTUOS2 + 5, HID_QUIRK_IGNORE }, | 1535 | { USB_VENDOR_ID_WACOM, USB_DEVICE_ID_WACOM_INTUOS2 + 5, HID_QUIRK_IGNORE }, |
1532 | { USB_VENDOR_ID_WACOM, USB_DEVICE_ID_WACOM_INTUOS2 + 7, HID_QUIRK_IGNORE }, | 1536 | { USB_VENDOR_ID_WACOM, USB_DEVICE_ID_WACOM_INTUOS2 + 7, HID_QUIRK_IGNORE }, |
1533 | { USB_VENDOR_ID_WACOM, USB_DEVICE_ID_WACOM_VOLITO, HID_QUIRK_IGNORE }, | 1537 | { USB_VENDOR_ID_WACOM, USB_DEVICE_ID_WACOM_VOLITO, HID_QUIRK_IGNORE }, |
1538 | { USB_VENDOR_ID_WACOM, USB_DEVICE_ID_WACOM_VOLITO + 1, HID_QUIRK_IGNORE }, | ||
1539 | { USB_VENDOR_ID_WACOM, USB_DEVICE_ID_WACOM_VOLITO + 2, HID_QUIRK_IGNORE }, | ||
1540 | { USB_VENDOR_ID_WACOM, USB_DEVICE_ID_WACOM_VOLITO + 3, HID_QUIRK_IGNORE }, | ||
1541 | { USB_VENDOR_ID_WACOM, USB_DEVICE_ID_WACOM_VOLITO + 4, HID_QUIRK_IGNORE }, | ||
1542 | { USB_VENDOR_ID_WACOM, USB_DEVICE_ID_WACOM_GRAPHIRE + 5, HID_QUIRK_IGNORE }, | ||
1543 | { USB_VENDOR_ID_WACOM, USB_DEVICE_ID_WACOM_GRAPHIRE + 6, HID_QUIRK_IGNORE }, | ||
1534 | { USB_VENDOR_ID_WACOM, USB_DEVICE_ID_WACOM_PTU, HID_QUIRK_IGNORE }, | 1544 | { USB_VENDOR_ID_WACOM, USB_DEVICE_ID_WACOM_PTU, HID_QUIRK_IGNORE }, |
1535 | { USB_VENDOR_ID_WACOM, USB_DEVICE_ID_WACOM_INTUOS3, HID_QUIRK_IGNORE }, | 1545 | { USB_VENDOR_ID_WACOM, USB_DEVICE_ID_WACOM_INTUOS3, HID_QUIRK_IGNORE }, |
1536 | { USB_VENDOR_ID_WACOM, USB_DEVICE_ID_WACOM_INTUOS3 + 1, HID_QUIRK_IGNORE }, | 1546 | { USB_VENDOR_ID_WACOM, USB_DEVICE_ID_WACOM_INTUOS3 + 1, HID_QUIRK_IGNORE }, |
1537 | { USB_VENDOR_ID_WACOM, USB_DEVICE_ID_WACOM_INTUOS3 + 2, HID_QUIRK_IGNORE }, | 1547 | { USB_VENDOR_ID_WACOM, USB_DEVICE_ID_WACOM_INTUOS3 + 2, HID_QUIRK_IGNORE }, |
1548 | { USB_VENDOR_ID_WACOM, USB_DEVICE_ID_WACOM_INTUOS3 + 5, HID_QUIRK_IGNORE }, | ||
1538 | { USB_VENDOR_ID_WACOM, USB_DEVICE_ID_WACOM_CINTIQ, HID_QUIRK_IGNORE }, | 1549 | { USB_VENDOR_ID_WACOM, USB_DEVICE_ID_WACOM_CINTIQ, HID_QUIRK_IGNORE }, |
1550 | { USB_VENDOR_ID_WACOM, USB_DEVICE_ID_WACOM_DTF, HID_QUIRK_IGNORE }, | ||
1539 | { USB_VENDOR_ID_WISEGROUP, USB_DEVICE_ID_4_PHIDGETSERVO_20, HID_QUIRK_IGNORE }, | 1551 | { USB_VENDOR_ID_WISEGROUP, USB_DEVICE_ID_4_PHIDGETSERVO_20, HID_QUIRK_IGNORE }, |
1540 | { USB_VENDOR_ID_WISEGROUP, USB_DEVICE_ID_1_PHIDGETSERVO_20, HID_QUIRK_IGNORE }, | 1552 | { USB_VENDOR_ID_WISEGROUP, USB_DEVICE_ID_1_PHIDGETSERVO_20, HID_QUIRK_IGNORE }, |
1541 | 1553 | ||
diff --git a/drivers/usb/input/itmtouch.c b/drivers/usb/input/itmtouch.c index 3b581853cf10..4a50acb39d29 100644 --- a/drivers/usb/input/itmtouch.c +++ b/drivers/usb/input/itmtouch.c | |||
@@ -40,13 +40,6 @@ | |||
40 | *****************************************************************************/ | 40 | *****************************************************************************/ |
41 | 41 | ||
42 | #include <linux/config.h> | 42 | #include <linux/config.h> |
43 | |||
44 | #ifdef CONFIG_USB_DEBUG | ||
45 | #define DEBUG | ||
46 | #else | ||
47 | #undef DEBUG | ||
48 | #endif | ||
49 | |||
50 | #include <linux/kernel.h> | 43 | #include <linux/kernel.h> |
51 | #include <linux/slab.h> | 44 | #include <linux/slab.h> |
52 | #include <linux/input.h> | 45 | #include <linux/input.h> |
diff --git a/drivers/usb/input/keyspan_remote.c b/drivers/usb/input/keyspan_remote.c index 5b8d65f62abf..a32cfe51b77d 100644 --- a/drivers/usb/input/keyspan_remote.c +++ b/drivers/usb/input/keyspan_remote.c | |||
@@ -160,7 +160,8 @@ static int keyspan_load_tester(struct usb_keyspan* dev, int bits_needed) | |||
160 | * though so it's not too big a deal | 160 | * though so it's not too big a deal |
161 | */ | 161 | */ |
162 | if (dev->data.pos >= dev->data.len) { | 162 | if (dev->data.pos >= dev->data.len) { |
163 | dev_dbg(&dev->udev, "%s - Error ran out of data. pos: %d, len: %d\n", | 163 | dev_dbg(&dev->udev->dev, |
164 | "%s - Error ran out of data. pos: %d, len: %d\n", | ||
164 | __FUNCTION__, dev->data.pos, dev->data.len); | 165 | __FUNCTION__, dev->data.pos, dev->data.len); |
165 | return -1; | 166 | return -1; |
166 | } | 167 | } |
@@ -306,7 +307,7 @@ static void keyspan_check_data(struct usb_keyspan *remote, struct pt_regs *regs) | |||
306 | err("Bad message recieved, no stop bit found.\n"); | 307 | err("Bad message recieved, no stop bit found.\n"); |
307 | } | 308 | } |
308 | 309 | ||
309 | dev_dbg(&remote->udev, | 310 | dev_dbg(&remote->udev->dev, |
310 | "%s found valid message: system: %d, button: %d, toggle: %d\n", | 311 | "%s found valid message: system: %d, button: %d, toggle: %d\n", |
311 | __FUNCTION__, message.system, message.button, message.toggle); | 312 | __FUNCTION__, message.system, message.button, message.toggle); |
312 | 313 | ||
diff --git a/drivers/usb/input/mtouchusb.c b/drivers/usb/input/mtouchusb.c index 7fce526560ca..52cc18cd247d 100644 --- a/drivers/usb/input/mtouchusb.c +++ b/drivers/usb/input/mtouchusb.c | |||
@@ -40,13 +40,6 @@ | |||
40 | *****************************************************************************/ | 40 | *****************************************************************************/ |
41 | 41 | ||
42 | #include <linux/config.h> | 42 | #include <linux/config.h> |
43 | |||
44 | #ifdef CONFIG_USB_DEBUG | ||
45 | #define DEBUG | ||
46 | #else | ||
47 | #undef DEBUG | ||
48 | #endif | ||
49 | |||
50 | #include <linux/kernel.h> | 43 | #include <linux/kernel.h> |
51 | #include <linux/slab.h> | 44 | #include <linux/slab.h> |
52 | #include <linux/input.h> | 45 | #include <linux/input.h> |
diff --git a/drivers/usb/input/pid.c b/drivers/usb/input/pid.c index dca5ee93a4ef..19e015d171aa 100644 --- a/drivers/usb/input/pid.c +++ b/drivers/usb/input/pid.c | |||
@@ -37,8 +37,6 @@ | |||
37 | #include "hid.h" | 37 | #include "hid.h" |
38 | #include "pid.h" | 38 | #include "pid.h" |
39 | 39 | ||
40 | #define DEBUG | ||
41 | |||
42 | #define CHECK_OWNERSHIP(i, hid_pid) \ | 40 | #define CHECK_OWNERSHIP(i, hid_pid) \ |
43 | ((i) < FF_EFFECTS_MAX && i >= 0 && \ | 41 | ((i) < FF_EFFECTS_MAX && i >= 0 && \ |
44 | test_bit(FF_PID_FLAGS_USED, &hid_pid->effects[(i)].flags) && \ | 42 | test_bit(FF_PID_FLAGS_USED, &hid_pid->effects[(i)].flags) && \ |
diff --git a/drivers/usb/input/touchkitusb.c b/drivers/usb/input/touchkitusb.c index 0043e6ebcd1f..7420c6b84284 100644 --- a/drivers/usb/input/touchkitusb.c +++ b/drivers/usb/input/touchkitusb.c | |||
@@ -30,10 +30,6 @@ | |||
30 | #include <linux/input.h> | 30 | #include <linux/input.h> |
31 | #include <linux/module.h> | 31 | #include <linux/module.h> |
32 | #include <linux/init.h> | 32 | #include <linux/init.h> |
33 | |||
34 | #if !defined(DEBUG) && defined(CONFIG_USB_DEBUG) | ||
35 | #define DEBUG | ||
36 | #endif | ||
37 | #include <linux/usb.h> | 33 | #include <linux/usb.h> |
38 | #include <linux/usb_input.h> | 34 | #include <linux/usb_input.h> |
39 | 35 | ||
diff --git a/drivers/usb/input/wacom.c b/drivers/usb/input/wacom.c index ea0f75773ae1..aea1cfae34cc 100644 --- a/drivers/usb/input/wacom.c +++ b/drivers/usb/input/wacom.c | |||
@@ -52,8 +52,10 @@ | |||
52 | * v1.30.1 (pi) - Added Graphire3 support | 52 | * v1.30.1 (pi) - Added Graphire3 support |
53 | * v1.40 (pc) - Add support for several new devices, fix eraser reporting, ... | 53 | * v1.40 (pc) - Add support for several new devices, fix eraser reporting, ... |
54 | * v1.43 (pc) - Added support for Cintiq 21UX | 54 | * v1.43 (pc) - Added support for Cintiq 21UX |
55 | - Fixed a Graphire bug | 55 | * - Fixed a Graphire bug |
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. | ||
58 | * - Report Device IDs | ||
57 | */ | 59 | */ |
58 | 60 | ||
59 | /* | 61 | /* |
@@ -76,7 +78,7 @@ | |||
76 | /* | 78 | /* |
77 | * Version Information | 79 | * Version Information |
78 | */ | 80 | */ |
79 | #define DRIVER_VERSION "v1.43" | 81 | #define DRIVER_VERSION "v1.44" |
80 | #define DRIVER_AUTHOR "Vojtech Pavlik <vojtech@ucw.cz>" | 82 | #define DRIVER_AUTHOR "Vojtech Pavlik <vojtech@ucw.cz>" |
81 | #define DRIVER_DESC "USB Wacom Graphire and Wacom Intuos tablet driver" | 83 | #define DRIVER_DESC "USB Wacom Graphire and Wacom Intuos tablet driver" |
82 | #define DRIVER_LICENSE "GPL" | 84 | #define DRIVER_LICENSE "GPL" |
@@ -86,10 +88,14 @@ MODULE_DESCRIPTION(DRIVER_DESC); | |||
86 | MODULE_LICENSE(DRIVER_LICENSE); | 88 | MODULE_LICENSE(DRIVER_LICENSE); |
87 | 89 | ||
88 | #define USB_VENDOR_ID_WACOM 0x056a | 90 | #define USB_VENDOR_ID_WACOM 0x056a |
91 | #define STYLUS_DEVICE_ID 0x02 | ||
92 | #define CURSOR_DEVICE_ID 0x06 | ||
93 | #define ERASER_DEVICE_ID 0x0A | ||
89 | 94 | ||
90 | enum { | 95 | enum { |
91 | PENPARTNER = 0, | 96 | PENPARTNER = 0, |
92 | GRAPHIRE, | 97 | GRAPHIRE, |
98 | G4, | ||
93 | PL, | 99 | PL, |
94 | INTUOS, | 100 | INTUOS, |
95 | INTUOS3, | 101 | INTUOS3, |
@@ -116,6 +122,7 @@ struct wacom { | |||
116 | struct urb *irq; | 122 | struct urb *irq; |
117 | struct wacom_features *features; | 123 | struct wacom_features *features; |
118 | int tool[2]; | 124 | int tool[2]; |
125 | int id[2]; | ||
119 | __u32 serial[2]; | 126 | __u32 serial[2]; |
120 | char phys[32]; | 127 | char phys[32]; |
121 | }; | 128 | }; |
@@ -136,7 +143,7 @@ static void wacom_pl_irq(struct urb *urb, struct pt_regs *regs) | |||
136 | struct wacom *wacom = urb->context; | 143 | struct wacom *wacom = urb->context; |
137 | unsigned char *data = wacom->data; | 144 | unsigned char *data = wacom->data; |
138 | struct input_dev *dev = wacom->dev; | 145 | struct input_dev *dev = wacom->dev; |
139 | int prox, pressure; | 146 | int prox, pressure, id; |
140 | int retval; | 147 | int retval; |
141 | 148 | ||
142 | switch (urb->status) { | 149 | switch (urb->status) { |
@@ -163,6 +170,7 @@ static void wacom_pl_irq(struct urb *urb, struct pt_regs *regs) | |||
163 | 170 | ||
164 | input_regs(dev, regs); | 171 | input_regs(dev, regs); |
165 | 172 | ||
173 | id = ERASER_DEVICE_ID; | ||
166 | if (prox) { | 174 | if (prox) { |
167 | 175 | ||
168 | pressure = (signed char)((data[7] << 1) | ((data[4] >> 2) & 1)); | 176 | pressure = (signed char)((data[7] << 1) | ((data[4] >> 2) & 1)); |
@@ -177,11 +185,15 @@ static void wacom_pl_irq(struct urb *urb, struct pt_regs *regs) | |||
177 | * an out of proximity for previous tool then a in for new tool. | 185 | * an out of proximity for previous tool then a in for new tool. |
178 | */ | 186 | */ |
179 | if (!wacom->tool[0]) { | 187 | if (!wacom->tool[0]) { |
180 | /* Going into proximity select tool */ | 188 | /* Eraser bit set for DTF */ |
181 | wacom->tool[1] = (data[4] & 0x20)? BTN_TOOL_RUBBER : BTN_TOOL_PEN; | 189 | if (data[1] & 0x10) |
190 | wacom->tool[1] = BTN_TOOL_RUBBER; | ||
191 | else | ||
192 | /* Going into proximity select tool */ | ||
193 | wacom->tool[1] = (data[4] & 0x20) ? BTN_TOOL_RUBBER : BTN_TOOL_PEN; | ||
182 | } else { | 194 | } else { |
183 | /* was entered with stylus2 pressed */ | 195 | /* was entered with stylus2 pressed */ |
184 | if (wacom->tool[1] == BTN_TOOL_RUBBER && !(data[4] & 0x20) ) { | 196 | if (wacom->tool[1] == BTN_TOOL_RUBBER && !(data[4] & 0x20)) { |
185 | /* report out proximity for previous tool */ | 197 | /* report out proximity for previous tool */ |
186 | input_report_key(dev, wacom->tool[1], 0); | 198 | input_report_key(dev, wacom->tool[1], 0); |
187 | input_sync(dev); | 199 | input_sync(dev); |
@@ -192,8 +204,9 @@ static void wacom_pl_irq(struct urb *urb, struct pt_regs *regs) | |||
192 | if (wacom->tool[1] != BTN_TOOL_RUBBER) { | 204 | if (wacom->tool[1] != BTN_TOOL_RUBBER) { |
193 | /* Unknown tool selected default to pen tool */ | 205 | /* Unknown tool selected default to pen tool */ |
194 | wacom->tool[1] = BTN_TOOL_PEN; | 206 | wacom->tool[1] = BTN_TOOL_PEN; |
207 | id = STYLUS_DEVICE_ID; | ||
195 | } | 208 | } |
196 | input_report_key(dev, wacom->tool[1], prox); /* report in proximity for tool */ | 209 | input_report_key(dev, wacom->tool[1], id); /* report in proximity for tool */ |
197 | input_report_abs(dev, ABS_X, data[3] | (data[2] << 7) | ((data[1] & 0x03) << 14)); | 210 | input_report_abs(dev, ABS_X, data[3] | (data[2] << 7) | ((data[1] & 0x03) << 14)); |
198 | input_report_abs(dev, ABS_Y, data[6] | (data[5] << 7) | ((data[4] & 0x03) << 14)); | 211 | input_report_abs(dev, ABS_Y, data[6] | (data[5] << 7) | ((data[4] & 0x03) << 14)); |
199 | input_report_abs(dev, ABS_PRESSURE, pressure); | 212 | input_report_abs(dev, ABS_PRESSURE, pressure); |
@@ -250,10 +263,10 @@ static void wacom_ptu_irq(struct urb *urb, struct pt_regs *regs) | |||
250 | 263 | ||
251 | input_regs(dev, regs); | 264 | input_regs(dev, regs); |
252 | if (data[1] & 0x04) { | 265 | if (data[1] & 0x04) { |
253 | input_report_key(dev, BTN_TOOL_RUBBER, data[1] & 0x20); | 266 | input_report_key(dev, BTN_TOOL_RUBBER, (data[1] & 0x20) ? ERASER_DEVICE_ID : 0); |
254 | input_report_key(dev, BTN_TOUCH, data[1] & 0x08); | 267 | input_report_key(dev, BTN_TOUCH, data[1] & 0x08); |
255 | } else { | 268 | } else { |
256 | input_report_key(dev, BTN_TOOL_PEN, data[1] & 0x20); | 269 | input_report_key(dev, BTN_TOOL_PEN, (data[1] & 0x20) ? STYLUS_DEVICE_ID : 0); |
257 | input_report_key(dev, BTN_TOUCH, data[1] & 0x01); | 270 | input_report_key(dev, BTN_TOUCH, data[1] & 0x01); |
258 | } | 271 | } |
259 | input_report_abs(dev, ABS_X, le16_to_cpu(*(__le16 *) &data[2])); | 272 | input_report_abs(dev, ABS_X, le16_to_cpu(*(__le16 *) &data[2])); |
@@ -299,7 +312,7 @@ static void wacom_penpartner_irq(struct urb *urb, struct pt_regs *regs) | |||
299 | } | 312 | } |
300 | 313 | ||
301 | input_regs(dev, regs); | 314 | input_regs(dev, regs); |
302 | input_report_key(dev, BTN_TOOL_PEN, 1); | 315 | input_report_key(dev, BTN_TOOL_PEN, STYLUS_DEVICE_ID); |
303 | input_report_abs(dev, ABS_X, le16_to_cpu(*(__le16 *) &data[1])); | 316 | input_report_abs(dev, ABS_X, le16_to_cpu(*(__le16 *) &data[1])); |
304 | input_report_abs(dev, ABS_Y, le16_to_cpu(*(__le16 *) &data[3])); | 317 | input_report_abs(dev, ABS_Y, le16_to_cpu(*(__le16 *) &data[3])); |
305 | input_report_abs(dev, ABS_PRESSURE, (signed char)data[6] + 127); | 318 | input_report_abs(dev, ABS_PRESSURE, (signed char)data[6] + 127); |
@@ -319,7 +332,7 @@ static void wacom_graphire_irq(struct urb *urb, struct pt_regs *regs) | |||
319 | struct wacom *wacom = urb->context; | 332 | struct wacom *wacom = urb->context; |
320 | unsigned char *data = wacom->data; | 333 | unsigned char *data = wacom->data; |
321 | struct input_dev *dev = wacom->dev; | 334 | struct input_dev *dev = wacom->dev; |
322 | int x, y; | 335 | int x, y, id, rw; |
323 | int retval; | 336 | int retval; |
324 | 337 | ||
325 | switch (urb->status) { | 338 | switch (urb->status) { |
@@ -344,6 +357,7 @@ static void wacom_graphire_irq(struct urb *urb, struct pt_regs *regs) | |||
344 | 357 | ||
345 | input_regs(dev, regs); | 358 | input_regs(dev, regs); |
346 | 359 | ||
360 | id = STYLUS_DEVICE_ID; | ||
347 | if (data[1] & 0x10) { /* in prox */ | 361 | if (data[1] & 0x10) { /* in prox */ |
348 | 362 | ||
349 | switch ((data[1] >> 5) & 3) { | 363 | switch ((data[1] >> 5) & 3) { |
@@ -354,18 +368,27 @@ static void wacom_graphire_irq(struct urb *urb, struct pt_regs *regs) | |||
354 | 368 | ||
355 | case 1: /* Rubber */ | 369 | case 1: /* Rubber */ |
356 | wacom->tool[0] = BTN_TOOL_RUBBER; | 370 | wacom->tool[0] = BTN_TOOL_RUBBER; |
371 | id = ERASER_DEVICE_ID; | ||
357 | break; | 372 | break; |
358 | 373 | ||
359 | case 2: /* Mouse with wheel */ | 374 | case 2: /* Mouse with wheel */ |
360 | input_report_key(dev, BTN_MIDDLE, data[1] & 0x04); | 375 | input_report_key(dev, BTN_MIDDLE, data[1] & 0x04); |
361 | input_report_rel(dev, REL_WHEEL, (signed char) data[6]); | 376 | if (wacom->features->type == G4) { |
377 | rw = data[7] & 0x04 ? -(data[7] & 0x03) : (data[7] & 0x03); | ||
378 | input_report_rel(dev, REL_WHEEL, rw); | ||
379 | } else | ||
380 | input_report_rel(dev, REL_WHEEL, (signed char) data[6]); | ||
362 | /* fall through */ | 381 | /* fall through */ |
363 | 382 | ||
364 | case 3: /* Mouse without wheel */ | 383 | case 3: /* Mouse without wheel */ |
365 | wacom->tool[0] = BTN_TOOL_MOUSE; | 384 | wacom->tool[0] = BTN_TOOL_MOUSE; |
385 | id = CURSOR_DEVICE_ID; | ||
366 | input_report_key(dev, BTN_LEFT, data[1] & 0x01); | 386 | input_report_key(dev, BTN_LEFT, data[1] & 0x01); |
367 | input_report_key(dev, BTN_RIGHT, data[1] & 0x02); | 387 | input_report_key(dev, BTN_RIGHT, data[1] & 0x02); |
368 | input_report_abs(dev, ABS_DISTANCE, data[7]); | 388 | if (wacom->features->type == G4) |
389 | input_report_abs(dev, ABS_DISTANCE, data[6]); | ||
390 | else | ||
391 | input_report_abs(dev, ABS_DISTANCE, data[7]); | ||
369 | break; | 392 | break; |
370 | } | 393 | } |
371 | } | 394 | } |
@@ -376,16 +399,50 @@ static void wacom_graphire_irq(struct urb *urb, struct pt_regs *regs) | |||
376 | input_report_abs(dev, ABS_X, x); | 399 | input_report_abs(dev, ABS_X, x); |
377 | input_report_abs(dev, ABS_Y, y); | 400 | input_report_abs(dev, ABS_Y, y); |
378 | if (wacom->tool[0] != BTN_TOOL_MOUSE) { | 401 | if (wacom->tool[0] != BTN_TOOL_MOUSE) { |
379 | input_report_abs(dev, ABS_PRESSURE, le16_to_cpu(*(__le16 *) &data[6])); | 402 | input_report_abs(dev, ABS_PRESSURE, data[6] | ((data[7] & 0x01) << 8)); |
380 | input_report_key(dev, BTN_TOUCH, data[1] & 0x01); | 403 | input_report_key(dev, BTN_TOUCH, data[1] & 0x01); |
381 | input_report_key(dev, BTN_STYLUS, data[1] & 0x02); | 404 | input_report_key(dev, BTN_STYLUS, data[1] & 0x02); |
382 | input_report_key(dev, BTN_STYLUS2, data[1] & 0x04); | 405 | input_report_key(dev, BTN_STYLUS2, data[1] & 0x04); |
383 | } | 406 | } |
384 | } | 407 | } |
385 | 408 | ||
386 | input_report_key(dev, wacom->tool[0], data[1] & 0x10); | 409 | input_report_key(dev, wacom->tool[0], (data[1] & 0x10) ? id : 0); |
387 | input_sync(dev); | 410 | input_sync(dev); |
388 | 411 | ||
412 | /* send pad data */ | ||
413 | if (wacom->features->type == G4) { | ||
414 | /* fist time sending pad data */ | ||
415 | if (wacom->tool[1] != BTN_TOOL_FINGER) { | ||
416 | wacom->id[1] = 0; | ||
417 | wacom->serial[1] = (data[7] & 0x38) >> 2; | ||
418 | } | ||
419 | if (data[7] & 0xf8) { | ||
420 | input_report_key(dev, BTN_0, (data[7] & 0x40)); | ||
421 | input_report_key(dev, BTN_4, (data[7] & 0x80)); | ||
422 | if (((data[7] & 0x38) >> 2) == (wacom->serial[1] & 0x0e)) | ||
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); | ||
434 | wacom->tool[1] = BTN_TOOL_FINGER; | ||
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); | ||
438 | } else if (wacom->id[1]) { | ||
439 | wacom->id[1] = 0; | ||
440 | wacom->serial[1] = 0; | ||
441 | input_report_key(dev, wacom->tool[1], 0); | ||
442 | input_event(dev, EV_MSC, MSC_SERIAL, 0xf0); | ||
443 | } | ||
444 | input_sync(dev); | ||
445 | } | ||
389 | exit: | 446 | exit: |
390 | retval = usb_submit_urb (urb, GFP_ATOMIC); | 447 | retval = usb_submit_urb (urb, GFP_ATOMIC); |
391 | if (retval) | 448 | if (retval) |
@@ -410,7 +467,8 @@ static int wacom_intuos_inout(struct urb *urb) | |||
410 | (data[4] << 20) + (data[5] << 12) + | 467 | (data[4] << 20) + (data[5] << 12) + |
411 | (data[6] << 4) + (data[7] >> 4); | 468 | (data[6] << 4) + (data[7] >> 4); |
412 | 469 | ||
413 | switch ((data[2] << 4) | (data[3] >> 4)) { | 470 | wacom->id[idx] = (data[2] << 4) | (data[3] >> 4); |
471 | switch (wacom->id[idx]) { | ||
414 | case 0x812: /* Inking pen */ | 472 | case 0x812: /* Inking pen */ |
415 | case 0x801: /* Intuos3 Inking pen */ | 473 | case 0x801: /* Intuos3 Inking pen */ |
416 | case 0x012: | 474 | case 0x012: |
@@ -458,7 +516,7 @@ static int wacom_intuos_inout(struct urb *urb) | |||
458 | default: /* Unknown tool */ | 516 | default: /* Unknown tool */ |
459 | wacom->tool[idx] = BTN_TOOL_PEN; | 517 | wacom->tool[idx] = BTN_TOOL_PEN; |
460 | } | 518 | } |
461 | input_report_key(dev, wacom->tool[idx], 1); | 519 | input_report_key(dev, wacom->tool[idx], wacom->id[idx]); |
462 | input_event(dev, EV_MSC, MSC_SERIAL, wacom->serial[idx]); | 520 | input_event(dev, EV_MSC, MSC_SERIAL, wacom->serial[idx]); |
463 | input_sync(dev); | 521 | input_sync(dev); |
464 | return 1; | 522 | return 1; |
@@ -637,7 +695,7 @@ static void wacom_intuos_irq(struct urb *urb, struct pt_regs *regs) | |||
637 | } | 695 | } |
638 | } | 696 | } |
639 | 697 | ||
640 | input_report_key(dev, wacom->tool[idx], 1); | 698 | input_report_key(dev, wacom->tool[idx], wacom->id[idx]); |
641 | input_event(dev, EV_MSC, MSC_SERIAL, wacom->serial[idx]); | 699 | input_event(dev, EV_MSC, MSC_SERIAL, wacom->serial[idx]); |
642 | input_sync(dev); | 700 | input_sync(dev); |
643 | 701 | ||
@@ -655,6 +713,13 @@ static struct wacom_features wacom_features[] = { | |||
655 | { "Wacom Graphire2 5x7", 8, 13918, 10206, 511, 32, GRAPHIRE, wacom_graphire_irq }, | 713 | { "Wacom Graphire2 5x7", 8, 13918, 10206, 511, 32, GRAPHIRE, wacom_graphire_irq }, |
656 | { "Wacom Graphire3", 8, 10208, 7424, 511, 32, GRAPHIRE, wacom_graphire_irq }, | 714 | { "Wacom Graphire3", 8, 10208, 7424, 511, 32, GRAPHIRE, wacom_graphire_irq }, |
657 | { "Wacom Graphire3 6x8", 8, 16704, 12064, 511, 32, GRAPHIRE, wacom_graphire_irq }, | 715 | { "Wacom Graphire3 6x8", 8, 16704, 12064, 511, 32, GRAPHIRE, wacom_graphire_irq }, |
716 | { "Wacom Graphire4 4x5", 8, 10208, 7424, 511, 32, G4, wacom_graphire_irq }, | ||
717 | { "Wacom Graphire4 6x8", 8, 16704, 12064, 511, 32, G4, wacom_graphire_irq }, | ||
718 | { "Wacom Volito", 8, 5104, 3712, 511, 32, GRAPHIRE, wacom_graphire_irq }, | ||
719 | { "Wacom PenStation2", 8, 3250, 2320, 255, 32, GRAPHIRE, wacom_graphire_irq }, | ||
720 | { "Wacom Volito2 4x5", 8, 5104, 3712, 511, 32, GRAPHIRE, wacom_graphire_irq }, | ||
721 | { "Wacom Volito2 2x3", 8, 3248, 2320, 511, 32, GRAPHIRE, wacom_graphire_irq }, | ||
722 | { "Wacom PenPartner2", 8, 3250, 2320, 255, 32, GRAPHIRE, wacom_graphire_irq }, | ||
658 | { "Wacom Intuos 4x5", 10, 12700, 10600, 1023, 15, INTUOS, wacom_intuos_irq }, | 723 | { "Wacom Intuos 4x5", 10, 12700, 10600, 1023, 15, INTUOS, wacom_intuos_irq }, |
659 | { "Wacom Intuos 6x8", 10, 20320, 16240, 1023, 15, INTUOS, wacom_intuos_irq }, | 724 | { "Wacom Intuos 6x8", 10, 20320, 16240, 1023, 15, INTUOS, wacom_intuos_irq }, |
660 | { "Wacom Intuos 9x12", 10, 30480, 24060, 1023, 15, INTUOS, wacom_intuos_irq }, | 725 | { "Wacom Intuos 9x12", 10, 30480, 24060, 1023, 15, INTUOS, wacom_intuos_irq }, |
@@ -666,16 +731,20 @@ static struct wacom_features wacom_features[] = { | |||
666 | { "Wacom PL600SX", 8, 6260, 5016, 255, 32, PL, wacom_pl_irq }, | 731 | { "Wacom PL600SX", 8, 6260, 5016, 255, 32, PL, wacom_pl_irq }, |
667 | { "Wacom PL550", 8, 6144, 4608, 511, 32, PL, wacom_pl_irq }, | 732 | { "Wacom PL550", 8, 6144, 4608, 511, 32, PL, wacom_pl_irq }, |
668 | { "Wacom PL800", 8, 7220, 5780, 511, 32, PL, wacom_pl_irq }, | 733 | { "Wacom PL800", 8, 7220, 5780, 511, 32, PL, wacom_pl_irq }, |
734 | { "Wacom PL700", 8, 6758, 5406, 511, 32, PL, wacom_pl_irq }, | ||
735 | { "Wacom PL510", 8, 6282, 4762, 511, 32, PL, wacom_pl_irq }, | ||
736 | { "Wacom PL710", 8, 34080, 27660, 511, 32, PL, wacom_pl_irq }, | ||
737 | { "Wacom DTF720", 8, 6858, 5506, 511, 32, PL, wacom_pl_irq }, | ||
738 | { "Wacom Cintiq Partner",8, 20480, 15360, 511, 32, PL, wacom_ptu_irq }, | ||
669 | { "Wacom Intuos2 4x5", 10, 12700, 10600, 1023, 15, INTUOS, wacom_intuos_irq }, | 739 | { "Wacom Intuos2 4x5", 10, 12700, 10600, 1023, 15, INTUOS, wacom_intuos_irq }, |
670 | { "Wacom Intuos2 6x8", 10, 20320, 16240, 1023, 15, INTUOS, wacom_intuos_irq }, | 740 | { "Wacom Intuos2 6x8", 10, 20320, 16240, 1023, 15, INTUOS, wacom_intuos_irq }, |
671 | { "Wacom Intuos2 9x12", 10, 30480, 24060, 1023, 15, INTUOS, wacom_intuos_irq }, | 741 | { "Wacom Intuos2 9x12", 10, 30480, 24060, 1023, 15, INTUOS, wacom_intuos_irq }, |
672 | { "Wacom Intuos2 12x12", 10, 30480, 31680, 1023, 15, INTUOS, wacom_intuos_irq }, | 742 | { "Wacom Intuos2 12x12", 10, 30480, 31680, 1023, 15, INTUOS, wacom_intuos_irq }, |
673 | { "Wacom Intuos2 12x18", 10, 45720, 31680, 1023, 15, INTUOS, wacom_intuos_irq }, | 743 | { "Wacom Intuos2 12x18", 10, 45720, 31680, 1023, 15, INTUOS, wacom_intuos_irq }, |
674 | { "Wacom Volito", 8, 5104, 3712, 511, 32, GRAPHIRE, wacom_graphire_irq }, | ||
675 | { "Wacom Cintiq Partner",8, 20480, 15360, 511, 32, PL, wacom_ptu_irq }, | ||
676 | { "Wacom Intuos3 4x5", 10, 25400, 20320, 1023, 15, INTUOS3, wacom_intuos_irq }, | 744 | { "Wacom Intuos3 4x5", 10, 25400, 20320, 1023, 15, INTUOS3, wacom_intuos_irq }, |
677 | { "Wacom Intuos3 6x8", 10, 40640, 30480, 1023, 15, INTUOS3, wacom_intuos_irq }, | 745 | { "Wacom Intuos3 6x8", 10, 40640, 30480, 1023, 15, INTUOS3, wacom_intuos_irq }, |
678 | { "Wacom Intuos3 9x12", 10, 60960, 45720, 1023, 15, INTUOS3, wacom_intuos_irq }, | 746 | { "Wacom Intuos3 9x12", 10, 60960, 45720, 1023, 15, INTUOS3, wacom_intuos_irq }, |
747 | { "Wacom Intuos3 6x11", 10, 54204, 31750, 1023, 15, INTUOS3, wacom_intuos_irq }, | ||
679 | { "Wacom Cintiq 21UX", 10, 87200, 65600, 1023, 15, CINTIQ, wacom_intuos_irq }, | 748 | { "Wacom Cintiq 21UX", 10, 87200, 65600, 1023, 15, CINTIQ, wacom_intuos_irq }, |
680 | { "Wacom Intuos2 6x8", 10, 20320, 16240, 1023, 15, INTUOS, wacom_intuos_irq }, | 749 | { "Wacom Intuos2 6x8", 10, 20320, 16240, 1023, 15, INTUOS, wacom_intuos_irq }, |
681 | { } | 750 | { } |
@@ -688,6 +757,13 @@ static struct usb_device_id wacom_ids[] = { | |||
688 | { USB_DEVICE(USB_VENDOR_ID_WACOM, 0x12) }, | 757 | { USB_DEVICE(USB_VENDOR_ID_WACOM, 0x12) }, |
689 | { USB_DEVICE(USB_VENDOR_ID_WACOM, 0x13) }, | 758 | { USB_DEVICE(USB_VENDOR_ID_WACOM, 0x13) }, |
690 | { USB_DEVICE(USB_VENDOR_ID_WACOM, 0x14) }, | 759 | { USB_DEVICE(USB_VENDOR_ID_WACOM, 0x14) }, |
760 | { USB_DEVICE(USB_VENDOR_ID_WACOM, 0x15) }, | ||
761 | { USB_DEVICE(USB_VENDOR_ID_WACOM, 0x16) }, | ||
762 | { USB_DEVICE(USB_VENDOR_ID_WACOM, 0x60) }, | ||
763 | { USB_DEVICE(USB_VENDOR_ID_WACOM, 0x61) }, | ||
764 | { USB_DEVICE(USB_VENDOR_ID_WACOM, 0x62) }, | ||
765 | { USB_DEVICE(USB_VENDOR_ID_WACOM, 0x63) }, | ||
766 | { USB_DEVICE(USB_VENDOR_ID_WACOM, 0x64) }, | ||
691 | { USB_DEVICE(USB_VENDOR_ID_WACOM, 0x20) }, | 767 | { USB_DEVICE(USB_VENDOR_ID_WACOM, 0x20) }, |
692 | { USB_DEVICE(USB_VENDOR_ID_WACOM, 0x21) }, | 768 | { USB_DEVICE(USB_VENDOR_ID_WACOM, 0x21) }, |
693 | { USB_DEVICE(USB_VENDOR_ID_WACOM, 0x22) }, | 769 | { USB_DEVICE(USB_VENDOR_ID_WACOM, 0x22) }, |
@@ -699,16 +775,20 @@ static struct usb_device_id wacom_ids[] = { | |||
699 | { USB_DEVICE(USB_VENDOR_ID_WACOM, 0x33) }, | 775 | { USB_DEVICE(USB_VENDOR_ID_WACOM, 0x33) }, |
700 | { USB_DEVICE(USB_VENDOR_ID_WACOM, 0x34) }, | 776 | { USB_DEVICE(USB_VENDOR_ID_WACOM, 0x34) }, |
701 | { USB_DEVICE(USB_VENDOR_ID_WACOM, 0x35) }, | 777 | { USB_DEVICE(USB_VENDOR_ID_WACOM, 0x35) }, |
778 | { USB_DEVICE(USB_VENDOR_ID_WACOM, 0x37) }, | ||
779 | { USB_DEVICE(USB_VENDOR_ID_WACOM, 0x38) }, | ||
780 | { USB_DEVICE(USB_VENDOR_ID_WACOM, 0x39) }, | ||
781 | { USB_DEVICE(USB_VENDOR_ID_WACOM, 0xC0) }, | ||
782 | { USB_DEVICE(USB_VENDOR_ID_WACOM, 0x03) }, | ||
702 | { USB_DEVICE(USB_VENDOR_ID_WACOM, 0x41) }, | 783 | { USB_DEVICE(USB_VENDOR_ID_WACOM, 0x41) }, |
703 | { USB_DEVICE(USB_VENDOR_ID_WACOM, 0x42) }, | 784 | { USB_DEVICE(USB_VENDOR_ID_WACOM, 0x42) }, |
704 | { USB_DEVICE(USB_VENDOR_ID_WACOM, 0x43) }, | 785 | { USB_DEVICE(USB_VENDOR_ID_WACOM, 0x43) }, |
705 | { USB_DEVICE(USB_VENDOR_ID_WACOM, 0x44) }, | 786 | { USB_DEVICE(USB_VENDOR_ID_WACOM, 0x44) }, |
706 | { USB_DEVICE(USB_VENDOR_ID_WACOM, 0x45) }, | 787 | { USB_DEVICE(USB_VENDOR_ID_WACOM, 0x45) }, |
707 | { USB_DEVICE(USB_VENDOR_ID_WACOM, 0x60) }, | ||
708 | { USB_DEVICE(USB_VENDOR_ID_WACOM, 0x03) }, | ||
709 | { USB_DEVICE(USB_VENDOR_ID_WACOM, 0xB0) }, | 788 | { USB_DEVICE(USB_VENDOR_ID_WACOM, 0xB0) }, |
710 | { USB_DEVICE(USB_VENDOR_ID_WACOM, 0xB1) }, | 789 | { USB_DEVICE(USB_VENDOR_ID_WACOM, 0xB1) }, |
711 | { USB_DEVICE(USB_VENDOR_ID_WACOM, 0xB2) }, | 790 | { USB_DEVICE(USB_VENDOR_ID_WACOM, 0xB2) }, |
791 | { USB_DEVICE(USB_VENDOR_ID_WACOM, 0xB5) }, | ||
712 | { USB_DEVICE(USB_VENDOR_ID_WACOM, 0x3F) }, | 792 | { USB_DEVICE(USB_VENDOR_ID_WACOM, 0x3F) }, |
713 | { USB_DEVICE(USB_VENDOR_ID_WACOM, 0x47) }, | 793 | { USB_DEVICE(USB_VENDOR_ID_WACOM, 0x47) }, |
714 | { } | 794 | { } |
@@ -779,6 +859,13 @@ static int wacom_probe(struct usb_interface *intf, const struct usb_device_id *i | |||
779 | input_set_abs_params(input_dev, ABS_PRESSURE, 0, wacom->features->pressure_max, 0, 0); | 859 | input_set_abs_params(input_dev, ABS_PRESSURE, 0, wacom->features->pressure_max, 0, 0); |
780 | 860 | ||
781 | switch (wacom->features->type) { | 861 | switch (wacom->features->type) { |
862 | case G4: | ||
863 | input_dev->evbit[0] |= BIT(EV_MSC); | ||
864 | input_dev->mscbit[0] |= BIT(MSC_SERIAL); | ||
865 | input_dev->keybit[LONG(BTN_DIGI)] |= BIT(BTN_TOOL_FINGER); | ||
866 | 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); | ||
867 | /* fall through */ | ||
868 | |||
782 | case GRAPHIRE: | 869 | case GRAPHIRE: |
783 | input_dev->evbit[0] |= BIT(EV_REL); | 870 | input_dev->evbit[0] |= BIT(EV_REL); |
784 | input_dev->relbit[0] |= BIT(REL_WHEEL); | 871 | input_dev->relbit[0] |= BIT(REL_WHEEL); |
diff --git a/drivers/usb/misc/Makefile b/drivers/usb/misc/Makefile index 862e40a83689..6c693bc68e2e 100644 --- a/drivers/usb/misc/Makefile +++ b/drivers/usb/misc/Makefile | |||
@@ -18,4 +18,8 @@ obj-$(CONFIG_USB_RIO500) += rio500.o | |||
18 | obj-$(CONFIG_USB_TEST) += usbtest.o | 18 | obj-$(CONFIG_USB_TEST) += usbtest.o |
19 | obj-$(CONFIG_USB_USS720) += uss720.o | 19 | obj-$(CONFIG_USB_USS720) += uss720.o |
20 | 20 | ||
21 | obj-$(CONFIG_USB_SISUSBVGA) += sisusbvga/ \ No newline at end of file | 21 | obj-$(CONFIG_USB_SISUSBVGA) += sisusbvga/ |
22 | |||
23 | ifeq ($(CONFIG_USB_DEBUG),y) | ||
24 | EXTRA_CFLAGS += -DDEBUG | ||
25 | endif | ||
diff --git a/drivers/usb/misc/auerswald.c b/drivers/usb/misc/auerswald.c index 5f33f7c64885..2a28ceeaa66a 100644 --- a/drivers/usb/misc/auerswald.c +++ b/drivers/usb/misc/auerswald.c | |||
@@ -30,7 +30,6 @@ | |||
30 | #include <linux/module.h> | 30 | #include <linux/module.h> |
31 | #include <linux/init.h> | 31 | #include <linux/init.h> |
32 | #include <linux/wait.h> | 32 | #include <linux/wait.h> |
33 | #undef DEBUG /* include debug macros until it's done */ | ||
34 | #include <linux/usb.h> | 33 | #include <linux/usb.h> |
35 | 34 | ||
36 | /*-------------------------------------------------------------------*/ | 35 | /*-------------------------------------------------------------------*/ |
diff --git a/drivers/usb/misc/phidgetservo.c b/drivers/usb/misc/phidgetservo.c index b84eda631ab5..a30d4a6ee824 100644 --- a/drivers/usb/misc/phidgetservo.c +++ b/drivers/usb/misc/phidgetservo.c | |||
@@ -26,9 +26,6 @@ | |||
26 | */ | 26 | */ |
27 | 27 | ||
28 | #include <linux/config.h> | 28 | #include <linux/config.h> |
29 | #ifdef CONFIG_USB_DEBUG | ||
30 | #define DEBUG 1 | ||
31 | #endif | ||
32 | #include <linux/kernel.h> | 29 | #include <linux/kernel.h> |
33 | #include <linux/errno.h> | 30 | #include <linux/errno.h> |
34 | #include <linux/init.h> | 31 | #include <linux/init.h> |
diff --git a/drivers/usb/misc/rio500.c b/drivers/usb/misc/rio500.c index 7d02d8ec6b1a..9590dbac5d9a 100644 --- a/drivers/usb/misc/rio500.c +++ b/drivers/usb/misc/rio500.c | |||
@@ -393,7 +393,7 @@ read_rio(struct file *file, char __user *buffer, size_t count, loff_t * ppos) | |||
393 | ibuf, this_read, &partial, | 393 | ibuf, this_read, &partial, |
394 | 8000); | 394 | 8000); |
395 | 395 | ||
396 | dbg(KERN_DEBUG "read stats: result:%d this_read:%u partial:%u", | 396 | dbg("read stats: result:%d this_read:%u partial:%u", |
397 | result, this_read, partial); | 397 | result, this_read, partial); |
398 | 398 | ||
399 | if (partial) { | 399 | if (partial) { |
diff --git a/drivers/usb/misc/usbled.c b/drivers/usb/misc/usbled.c index f6ba4c788dbc..3c93921cb6b3 100644 --- a/drivers/usb/misc/usbled.c +++ b/drivers/usb/misc/usbled.c | |||
@@ -10,9 +10,6 @@ | |||
10 | */ | 10 | */ |
11 | 11 | ||
12 | #include <linux/config.h> | 12 | #include <linux/config.h> |
13 | #ifdef CONFIG_USB_DEBUG | ||
14 | #define DEBUG 1 | ||
15 | #endif | ||
16 | #include <linux/kernel.h> | 13 | #include <linux/kernel.h> |
17 | #include <linux/errno.h> | 14 | #include <linux/errno.h> |
18 | #include <linux/init.h> | 15 | #include <linux/init.h> |
diff --git a/drivers/usb/misc/usbtest.c b/drivers/usb/misc/usbtest.c index 2997f558159b..605a2afe34ed 100644 --- a/drivers/usb/misc/usbtest.c +++ b/drivers/usb/misc/usbtest.c | |||
@@ -1,7 +1,4 @@ | |||
1 | #include <linux/config.h> | 1 | #include <linux/config.h> |
2 | #if !defined (DEBUG) && defined (CONFIG_USB_DEBUG) | ||
3 | # define DEBUG | ||
4 | #endif | ||
5 | #include <linux/kernel.h> | 2 | #include <linux/kernel.h> |
6 | #include <linux/errno.h> | 3 | #include <linux/errno.h> |
7 | #include <linux/init.h> | 4 | #include <linux/init.h> |
diff --git a/drivers/usb/misc/uss720.c b/drivers/usb/misc/uss720.c index 0592cb5e6c4d..1cabe7ed91f5 100644 --- a/drivers/usb/misc/uss720.c +++ b/drivers/usb/misc/uss720.c | |||
@@ -41,8 +41,6 @@ | |||
41 | 41 | ||
42 | /*****************************************************************************/ | 42 | /*****************************************************************************/ |
43 | 43 | ||
44 | #define DEBUG | ||
45 | |||
46 | #include <linux/module.h> | 44 | #include <linux/module.h> |
47 | #include <linux/socket.h> | 45 | #include <linux/socket.h> |
48 | #include <linux/parport.h> | 46 | #include <linux/parport.h> |
diff --git a/drivers/usb/net/Makefile b/drivers/usb/net/Makefile index 222c0495f791..a21e6eaabaf6 100644 --- a/drivers/usb/net/Makefile +++ b/drivers/usb/net/Makefile | |||
@@ -16,3 +16,7 @@ obj-$(CONFIG_USB_NET_CDC_SUBSET) += cdc_subset.o | |||
16 | obj-$(CONFIG_USB_NET_ZAURUS) += zaurus.o | 16 | obj-$(CONFIG_USB_NET_ZAURUS) += zaurus.o |
17 | obj-$(CONFIG_USB_USBNET) += usbnet.o | 17 | obj-$(CONFIG_USB_USBNET) += usbnet.o |
18 | obj-$(CONFIG_USB_ZD1201) += zd1201.o | 18 | obj-$(CONFIG_USB_ZD1201) += zd1201.o |
19 | |||
20 | ifeq ($(CONFIG_USB_DEBUG),y) | ||
21 | EXTRA_CFLAGS += -DDEBUG | ||
22 | endif | ||
diff --git a/drivers/usb/net/asix.c b/drivers/usb/net/asix.c index 252a34fbb42c..542120ef1fd2 100644 --- a/drivers/usb/net/asix.c +++ b/drivers/usb/net/asix.c | |||
@@ -23,9 +23,6 @@ | |||
23 | // #define VERBOSE // more; success messages | 23 | // #define VERBOSE // more; success messages |
24 | 24 | ||
25 | #include <linux/config.h> | 25 | #include <linux/config.h> |
26 | #ifdef CONFIG_USB_DEBUG | ||
27 | # define DEBUG | ||
28 | #endif | ||
29 | #include <linux/module.h> | 26 | #include <linux/module.h> |
30 | #include <linux/kmod.h> | 27 | #include <linux/kmod.h> |
31 | #include <linux/sched.h> | 28 | #include <linux/sched.h> |
diff --git a/drivers/usb/net/cdc_ether.c b/drivers/usb/net/cdc_ether.c index 652b04bbf6af..c008c981862b 100644 --- a/drivers/usb/net/cdc_ether.c +++ b/drivers/usb/net/cdc_ether.c | |||
@@ -21,9 +21,6 @@ | |||
21 | // #define VERBOSE // more; success messages | 21 | // #define VERBOSE // more; success messages |
22 | 22 | ||
23 | #include <linux/config.h> | 23 | #include <linux/config.h> |
24 | #ifdef CONFIG_USB_DEBUG | ||
25 | # define DEBUG | ||
26 | #endif | ||
27 | #include <linux/module.h> | 24 | #include <linux/module.h> |
28 | #include <linux/sched.h> | 25 | #include <linux/sched.h> |
29 | #include <linux/init.h> | 26 | #include <linux/init.h> |
diff --git a/drivers/usb/net/cdc_subset.c b/drivers/usb/net/cdc_subset.c index f1730b685fd2..f05cfb83c82d 100644 --- a/drivers/usb/net/cdc_subset.c +++ b/drivers/usb/net/cdc_subset.c | |||
@@ -18,9 +18,6 @@ | |||
18 | */ | 18 | */ |
19 | 19 | ||
20 | #include <linux/config.h> | 20 | #include <linux/config.h> |
21 | #ifdef CONFIG_USB_DEBUG | ||
22 | # define DEBUG | ||
23 | #endif | ||
24 | #include <linux/module.h> | 21 | #include <linux/module.h> |
25 | #include <linux/kmod.h> | 22 | #include <linux/kmod.h> |
26 | #include <linux/sched.h> | 23 | #include <linux/sched.h> |
diff --git a/drivers/usb/net/gl620a.c b/drivers/usb/net/gl620a.c index c0f263b202a6..2455e9a85674 100644 --- a/drivers/usb/net/gl620a.c +++ b/drivers/usb/net/gl620a.c | |||
@@ -22,9 +22,6 @@ | |||
22 | // #define VERBOSE // more; success messages | 22 | // #define VERBOSE // more; success messages |
23 | 23 | ||
24 | #include <linux/config.h> | 24 | #include <linux/config.h> |
25 | #ifdef CONFIG_USB_DEBUG | ||
26 | # define DEBUG | ||
27 | #endif | ||
28 | #include <linux/module.h> | 25 | #include <linux/module.h> |
29 | #include <linux/sched.h> | 26 | #include <linux/sched.h> |
30 | #include <linux/init.h> | 27 | #include <linux/init.h> |
diff --git a/drivers/usb/net/kaweth.c b/drivers/usb/net/kaweth.c index 6bef1be6b36c..b5776518020f 100644 --- a/drivers/usb/net/kaweth.c +++ b/drivers/usb/net/kaweth.c | |||
@@ -219,7 +219,6 @@ struct kaweth_device | |||
219 | 219 | ||
220 | __u32 status; | 220 | __u32 status; |
221 | int end; | 221 | int end; |
222 | int removed; | ||
223 | int suspend_lowmem_rx; | 222 | int suspend_lowmem_rx; |
224 | int suspend_lowmem_ctrl; | 223 | int suspend_lowmem_ctrl; |
225 | int linkstate; | 224 | int linkstate; |
@@ -699,6 +698,7 @@ static int kaweth_close(struct net_device *net) | |||
699 | 698 | ||
700 | usb_kill_urb(kaweth->irq_urb); | 699 | usb_kill_urb(kaweth->irq_urb); |
701 | usb_kill_urb(kaweth->rx_urb); | 700 | usb_kill_urb(kaweth->rx_urb); |
701 | usb_kill_urb(kaweth->tx_urb); | ||
702 | 702 | ||
703 | flush_scheduled_work(); | 703 | flush_scheduled_work(); |
704 | 704 | ||
@@ -750,13 +750,6 @@ static int kaweth_start_xmit(struct sk_buff *skb, struct net_device *net) | |||
750 | 750 | ||
751 | spin_lock(&kaweth->device_lock); | 751 | spin_lock(&kaweth->device_lock); |
752 | 752 | ||
753 | if (kaweth->removed) { | ||
754 | /* our device is undergoing disconnection - we bail out */ | ||
755 | spin_unlock(&kaweth->device_lock); | ||
756 | dev_kfree_skb_irq(skb); | ||
757 | return 0; | ||
758 | } | ||
759 | |||
760 | kaweth_async_set_rx_mode(kaweth); | 753 | kaweth_async_set_rx_mode(kaweth); |
761 | netif_stop_queue(net); | 754 | netif_stop_queue(net); |
762 | 755 | ||
@@ -1136,10 +1129,6 @@ static void kaweth_disconnect(struct usb_interface *intf) | |||
1136 | return; | 1129 | return; |
1137 | } | 1130 | } |
1138 | netdev = kaweth->net; | 1131 | netdev = kaweth->net; |
1139 | kaweth->removed = 1; | ||
1140 | usb_kill_urb(kaweth->irq_urb); | ||
1141 | usb_kill_urb(kaweth->rx_urb); | ||
1142 | usb_kill_urb(kaweth->tx_urb); | ||
1143 | 1132 | ||
1144 | kaweth_dbg("Unregistering net device"); | 1133 | kaweth_dbg("Unregistering net device"); |
1145 | unregister_netdev(netdev); | 1134 | unregister_netdev(netdev); |
diff --git a/drivers/usb/net/net1080.c b/drivers/usb/net/net1080.c index cee55f8cf64f..b3799b1a2b0d 100644 --- a/drivers/usb/net/net1080.c +++ b/drivers/usb/net/net1080.c | |||
@@ -21,9 +21,6 @@ | |||
21 | // #define VERBOSE // more; success messages | 21 | // #define VERBOSE // more; success messages |
22 | 22 | ||
23 | #include <linux/config.h> | 23 | #include <linux/config.h> |
24 | #ifdef CONFIG_USB_DEBUG | ||
25 | # define DEBUG | ||
26 | #endif | ||
27 | #include <linux/module.h> | 24 | #include <linux/module.h> |
28 | #include <linux/sched.h> | 25 | #include <linux/sched.h> |
29 | #include <linux/init.h> | 26 | #include <linux/init.h> |
diff --git a/drivers/usb/net/pegasus.c b/drivers/usb/net/pegasus.c index 537eb181d985..683e3df5d607 100644 --- a/drivers/usb/net/pegasus.c +++ b/drivers/usb/net/pegasus.c | |||
@@ -28,8 +28,6 @@ | |||
28 | * is out of the interrupt routine. | 28 | * is out of the interrupt routine. |
29 | */ | 29 | */ |
30 | 30 | ||
31 | #undef DEBUG | ||
32 | |||
33 | #include <linux/sched.h> | 31 | #include <linux/sched.h> |
34 | #include <linux/slab.h> | 32 | #include <linux/slab.h> |
35 | #include <linux/init.h> | 33 | #include <linux/init.h> |
diff --git a/drivers/usb/net/plusb.c b/drivers/usb/net/plusb.c index 74c2b3581c76..89856aa0e3b8 100644 --- a/drivers/usb/net/plusb.c +++ b/drivers/usb/net/plusb.c | |||
@@ -21,9 +21,6 @@ | |||
21 | // #define VERBOSE // more; success messages | 21 | // #define VERBOSE // more; success messages |
22 | 22 | ||
23 | #include <linux/config.h> | 23 | #include <linux/config.h> |
24 | #ifdef CONFIG_USB_DEBUG | ||
25 | # define DEBUG | ||
26 | #endif | ||
27 | #include <linux/module.h> | 24 | #include <linux/module.h> |
28 | #include <linux/sched.h> | 25 | #include <linux/sched.h> |
29 | #include <linux/init.h> | 26 | #include <linux/init.h> |
diff --git a/drivers/usb/net/rndis_host.c b/drivers/usb/net/rndis_host.c index b5a925dc1beb..c0ecbab6f6ba 100644 --- a/drivers/usb/net/rndis_host.c +++ b/drivers/usb/net/rndis_host.c | |||
@@ -21,9 +21,6 @@ | |||
21 | // #define VERBOSE // more; success messages | 21 | // #define VERBOSE // more; success messages |
22 | 22 | ||
23 | #include <linux/config.h> | 23 | #include <linux/config.h> |
24 | #ifdef CONFIG_USB_DEBUG | ||
25 | # define DEBUG | ||
26 | #endif | ||
27 | #include <linux/module.h> | 24 | #include <linux/module.h> |
28 | #include <linux/sched.h> | 25 | #include <linux/sched.h> |
29 | #include <linux/init.h> | 26 | #include <linux/init.h> |
diff --git a/drivers/usb/net/usbnet.c b/drivers/usb/net/usbnet.c index 74f05c9c84d5..362d6907c9bb 100644 --- a/drivers/usb/net/usbnet.c +++ b/drivers/usb/net/usbnet.c | |||
@@ -34,9 +34,6 @@ | |||
34 | // #define VERBOSE // more; success messages | 34 | // #define VERBOSE // more; success messages |
35 | 35 | ||
36 | #include <linux/config.h> | 36 | #include <linux/config.h> |
37 | #ifdef CONFIG_USB_DEBUG | ||
38 | # define DEBUG | ||
39 | #endif | ||
40 | #include <linux/module.h> | 37 | #include <linux/module.h> |
41 | #include <linux/sched.h> | 38 | #include <linux/sched.h> |
42 | #include <linux/init.h> | 39 | #include <linux/init.h> |
diff --git a/drivers/usb/net/zaurus.c b/drivers/usb/net/zaurus.c index 5d4b7d55b097..680d13957af4 100644 --- a/drivers/usb/net/zaurus.c +++ b/drivers/usb/net/zaurus.c | |||
@@ -21,9 +21,6 @@ | |||
21 | // #define VERBOSE // more; success messages | 21 | // #define VERBOSE // more; success messages |
22 | 22 | ||
23 | #include <linux/config.h> | 23 | #include <linux/config.h> |
24 | #ifdef CONFIG_USB_DEBUG | ||
25 | # define DEBUG | ||
26 | #endif | ||
27 | #include <linux/module.h> | 24 | #include <linux/module.h> |
28 | #include <linux/sched.h> | 25 | #include <linux/sched.h> |
29 | #include <linux/init.h> | 26 | #include <linux/init.h> |
diff --git a/drivers/usb/serial/ChangeLog.old b/drivers/usb/serial/ChangeLog.history index c1b279939bbf..52c4f7bd7a80 100644 --- a/drivers/usb/serial/ChangeLog.old +++ b/drivers/usb/serial/ChangeLog.history | |||
@@ -400,7 +400,7 @@ visor.c Change Log comments: | |||
400 | 400 | ||
401 | (11/11/2001) gkh | 401 | (11/11/2001) gkh |
402 | Added support for the m125 devices, and added check to prevent oopses | 402 | Added support for the m125 devices, and added check to prevent oopses |
403 | for Clié devices that lie about the number of ports they have. | 403 | for Clié devices that lie about the number of ports they have. |
404 | 404 | ||
405 | (08/30/2001) gkh | 405 | (08/30/2001) gkh |
406 | Added support for the Clie devices, both the 3.5 and 4.0 os versions. | 406 | Added support for the Clie devices, both the 3.5 and 4.0 os versions. |
diff --git a/drivers/usb/serial/Kconfig b/drivers/usb/serial/Kconfig index 7b5e8e4ee2bb..14f55fd26a64 100644 --- a/drivers/usb/serial/Kconfig +++ b/drivers/usb/serial/Kconfig | |||
@@ -62,6 +62,15 @@ config USB_SERIAL_AIRPRIME | |||
62 | To compile this driver as a module, choose M here: the | 62 | To compile this driver as a module, choose M here: the |
63 | module will be called airprime. | 63 | module will be called airprime. |
64 | 64 | ||
65 | config USB_SERIAL_ANYDATA | ||
66 | tristate "USB AnyData CDMA Wireless Driver" | ||
67 | depends on USB_SERIAL | ||
68 | help | ||
69 | Say Y here if you want to use a AnyData CDMA device. | ||
70 | |||
71 | To compile this driver as a module, choose M here: the | ||
72 | module will be called anydata. | ||
73 | |||
65 | config USB_SERIAL_BELKIN | 74 | config USB_SERIAL_BELKIN |
66 | tristate "USB Belkin and Peracom Single Port Serial Driver" | 75 | tristate "USB Belkin and Peracom Single Port Serial Driver" |
67 | depends on USB_SERIAL | 76 | depends on USB_SERIAL |
@@ -394,15 +403,6 @@ config USB_SERIAL_MCT_U232 | |||
394 | To compile this driver as a module, choose M here: the | 403 | To compile this driver as a module, choose M here: the |
395 | module will be called mct_u232. | 404 | module will be called mct_u232. |
396 | 405 | ||
397 | config USB_SERIAL_NOKIA_DKU2 | ||
398 | tristate "USB Nokia DKU2 Driver" | ||
399 | depends on USB_SERIAL | ||
400 | help | ||
401 | Say Y here if you want to use a Nokia DKU2 device. | ||
402 | |||
403 | To compile this driver as a module, choose M here: the | ||
404 | module will be called nokia_dku2. | ||
405 | |||
406 | config USB_SERIAL_PL2303 | 406 | config USB_SERIAL_PL2303 |
407 | tristate "USB Prolific 2303 Single Port Serial Driver" | 407 | tristate "USB Prolific 2303 Single Port Serial Driver" |
408 | depends on USB_SERIAL | 408 | depends on USB_SERIAL |
diff --git a/drivers/usb/serial/Makefile b/drivers/usb/serial/Makefile index 55fd461793b7..f0b04420cea1 100644 --- a/drivers/usb/serial/Makefile +++ b/drivers/usb/serial/Makefile | |||
@@ -12,6 +12,7 @@ usbserial-obj-$(CONFIG_USB_EZUSB) += ezusb.o | |||
12 | usbserial-objs := usb-serial.o generic.o bus.o $(usbserial-obj-y) | 12 | 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_BELKIN) += belkin_sa.o | 16 | obj-$(CONFIG_USB_SERIAL_BELKIN) += belkin_sa.o |
16 | obj-$(CONFIG_USB_SERIAL_CP2101) += cp2101.o | 17 | obj-$(CONFIG_USB_SERIAL_CP2101) += cp2101.o |
17 | obj-$(CONFIG_USB_SERIAL_CYBERJACK) += cyberjack.o | 18 | obj-$(CONFIG_USB_SERIAL_CYBERJACK) += cyberjack.o |
@@ -31,7 +32,6 @@ obj-$(CONFIG_USB_SERIAL_KEYSPAN_PDA) += keyspan_pda.o | |||
31 | obj-$(CONFIG_USB_SERIAL_KLSI) += kl5kusb105.o | 32 | obj-$(CONFIG_USB_SERIAL_KLSI) += kl5kusb105.o |
32 | obj-$(CONFIG_USB_SERIAL_KOBIL_SCT) += kobil_sct.o | 33 | obj-$(CONFIG_USB_SERIAL_KOBIL_SCT) += kobil_sct.o |
33 | obj-$(CONFIG_USB_SERIAL_MCT_U232) += mct_u232.o | 34 | obj-$(CONFIG_USB_SERIAL_MCT_U232) += mct_u232.o |
34 | obj-$(CONFIG_USB_SERIAL_NOKIA_DKU2) += nokia_dku2.o | ||
35 | obj-$(CONFIG_USB_SERIAL_OMNINET) += omninet.o | 35 | obj-$(CONFIG_USB_SERIAL_OMNINET) += omninet.o |
36 | obj-$(CONFIG_USB_SERIAL_OPTION) += option.o | 36 | obj-$(CONFIG_USB_SERIAL_OPTION) += option.o |
37 | obj-$(CONFIG_USB_SERIAL_PL2303) += pl2303.o | 37 | obj-$(CONFIG_USB_SERIAL_PL2303) += pl2303.o |
diff --git a/drivers/usb/serial/anydata.c b/drivers/usb/serial/anydata.c new file mode 100644 index 000000000000..18022a74a3dc --- /dev/null +++ b/drivers/usb/serial/anydata.c | |||
@@ -0,0 +1,123 @@ | |||
1 | /* | ||
2 | * AnyData CDMA Serial USB driver | ||
3 | * | ||
4 | * Copyright (C) 2005 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(0x16d5, 0x6501) }, /* AirData CDMA device */ | ||
20 | { }, | ||
21 | }; | ||
22 | MODULE_DEVICE_TABLE(usb, id_table); | ||
23 | |||
24 | /* if overridden by the user, then use their value for the size of the | ||
25 | * read and write urbs */ | ||
26 | static int buffer_size; | ||
27 | static int debug; | ||
28 | |||
29 | static struct usb_driver anydata_driver = { | ||
30 | .owner = THIS_MODULE, | ||
31 | .name = "anydata", | ||
32 | .probe = usb_serial_probe, | ||
33 | .disconnect = usb_serial_disconnect, | ||
34 | .id_table = id_table, | ||
35 | }; | ||
36 | |||
37 | static int anydata_open(struct usb_serial_port *port, struct file *filp) | ||
38 | { | ||
39 | char *buffer; | ||
40 | int result = 0; | ||
41 | |||
42 | dbg("%s - port %d", __FUNCTION__, port->number); | ||
43 | |||
44 | if (buffer_size) { | ||
45 | /* override the default buffer sizes */ | ||
46 | buffer = kmalloc(buffer_size, GFP_KERNEL); | ||
47 | if (!buffer) { | ||
48 | dev_err(&port->dev, "%s - out of memory.\n", | ||
49 | __FUNCTION__); | ||
50 | return -ENOMEM; | ||
51 | } | ||
52 | kfree (port->read_urb->transfer_buffer); | ||
53 | port->read_urb->transfer_buffer = buffer; | ||
54 | port->read_urb->transfer_buffer_length = buffer_size; | ||
55 | |||
56 | buffer = kmalloc(buffer_size, GFP_KERNEL); | ||
57 | if (!buffer) { | ||
58 | dev_err(&port->dev, "%s - out of memory.\n", | ||
59 | __FUNCTION__); | ||
60 | return -ENOMEM; | ||
61 | } | ||
62 | kfree (port->write_urb->transfer_buffer); | ||
63 | port->write_urb->transfer_buffer = buffer; | ||
64 | port->write_urb->transfer_buffer_length = buffer_size; | ||
65 | port->bulk_out_size = buffer_size; | ||
66 | } | ||
67 | |||
68 | /* Start reading from the device */ | ||
69 | usb_fill_bulk_urb(port->read_urb, port->serial->dev, | ||
70 | usb_rcvbulkpipe(port->serial->dev, | ||
71 | port->bulk_in_endpointAddress), | ||
72 | port->read_urb->transfer_buffer, | ||
73 | port->read_urb->transfer_buffer_length, | ||
74 | usb_serial_generic_write_bulk_callback, port); | ||
75 | result = usb_submit_urb(port->read_urb, GFP_KERNEL); | ||
76 | if (result) | ||
77 | dev_err(&port->dev, | ||
78 | "%s - failed submitting read urb, error %d\n", | ||
79 | __FUNCTION__, result); | ||
80 | |||
81 | return result; | ||
82 | } | ||
83 | |||
84 | static struct usb_serial_driver anydata_device = { | ||
85 | .driver = { | ||
86 | .owner = THIS_MODULE, | ||
87 | .name = "anydata", | ||
88 | }, | ||
89 | .id_table = id_table, | ||
90 | .num_interrupt_in = NUM_DONT_CARE, | ||
91 | .num_bulk_in = NUM_DONT_CARE, | ||
92 | .num_bulk_out = NUM_DONT_CARE, | ||
93 | .num_ports = 1, | ||
94 | .open = anydata_open, | ||
95 | }; | ||
96 | |||
97 | static int __init anydata_init(void) | ||
98 | { | ||
99 | int retval; | ||
100 | |||
101 | retval = usb_serial_register(&anydata_device); | ||
102 | if (retval) | ||
103 | return retval; | ||
104 | retval = usb_register(&anydata_driver); | ||
105 | if (retval) | ||
106 | usb_serial_deregister(&anydata_device); | ||
107 | return retval; | ||
108 | } | ||
109 | |||
110 | static void __exit anydata_exit(void) | ||
111 | { | ||
112 | usb_deregister(&anydata_driver); | ||
113 | usb_serial_deregister(&anydata_device); | ||
114 | } | ||
115 | |||
116 | module_init(anydata_init); | ||
117 | module_exit(anydata_exit); | ||
118 | MODULE_LICENSE("GPL"); | ||
119 | |||
120 | module_param(debug, bool, S_IRUGO | S_IWUSR); | ||
121 | MODULE_PARM_DESC(debug, "Debug enabled or not"); | ||
122 | module_param(buffer_size, int, 0); | ||
123 | MODULE_PARM_DESC(buffer_size, "Size of the transfer buffers"); | ||
diff --git a/drivers/usb/serial/cp2101.c b/drivers/usb/serial/cp2101.c index c5334dd89b12..c9787001cf2a 100644 --- a/drivers/usb/serial/cp2101.c +++ b/drivers/usb/serial/cp2101.c | |||
@@ -60,6 +60,7 @@ static struct usb_device_id id_table [] = { | |||
60 | { USB_DEVICE(0x10C4, 0x80F6) }, /* Suunto sports instrument */ | 60 | { USB_DEVICE(0x10C4, 0x80F6) }, /* Suunto sports instrument */ |
61 | { USB_DEVICE(0x10A6, 0xAA26) }, /* Knock-off DCU-11 cable */ | 61 | { USB_DEVICE(0x10A6, 0xAA26) }, /* Knock-off DCU-11 cable */ |
62 | { USB_DEVICE(0x10AB, 0x10C5) }, /* Siemens MC60 Cable */ | 62 | { USB_DEVICE(0x10AB, 0x10C5) }, /* Siemens MC60 Cable */ |
63 | { USB_DEVICE(0x16D6, 0x0001) }, /* Jablotron serial interface */ | ||
63 | { } /* Terminating Entry */ | 64 | { } /* Terminating Entry */ |
64 | }; | 65 | }; |
65 | 66 | ||
diff --git a/drivers/usb/serial/generic.c b/drivers/usb/serial/generic.c index 8909208f506a..53a47c31cd0e 100644 --- a/drivers/usb/serial/generic.c +++ b/drivers/usb/serial/generic.c | |||
@@ -309,6 +309,7 @@ void usb_serial_generic_write_bulk_callback (struct urb *urb, struct pt_regs *re | |||
309 | 309 | ||
310 | schedule_work(&port->work); | 310 | schedule_work(&port->work); |
311 | } | 311 | } |
312 | EXPORT_SYMBOL_GPL(usb_serial_generic_write_bulk_callback); | ||
312 | 313 | ||
313 | void usb_serial_generic_shutdown (struct usb_serial *serial) | 314 | void usb_serial_generic_shutdown (struct usb_serial *serial) |
314 | { | 315 | { |
diff --git a/drivers/usb/serial/nokia_dku2.c b/drivers/usb/serial/nokia_dku2.c deleted file mode 100644 index fad01bef3a64..000000000000 --- a/drivers/usb/serial/nokia_dku2.c +++ /dev/null | |||
@@ -1,142 +0,0 @@ | |||
1 | /* | ||
2 | * Nokia DKU2 USB driver | ||
3 | * | ||
4 | * Copyright (C) 2004 | ||
5 | * Author: C Kemp | ||
6 | * | ||
7 | * This program is largely derived from work by the linux-usb group | ||
8 | * and associated source files. Please see the usb/serial files for | ||
9 | * individual credits and copyrights. | ||
10 | * | ||
11 | * This program is free software; you can redistribute it and/or modify | ||
12 | * it under the terms of the GNU General Public License as published by | ||
13 | * the Free Software Foundation; either version 2 of the License, or | ||
14 | * (at your option) any later version. | ||
15 | * | ||
16 | * 20.09.2005 - Matthias Blaesing <matthias.blaesing@rwth-aachen.de> | ||
17 | * Added short name to device structure to make driver load into kernel 2.6.13 | ||
18 | * | ||
19 | * 20.09.2005 - Matthias Blaesing <matthias.blaesing@rwth-aachen.de> | ||
20 | * Added usb_deregister to exit code - to allow remove and reinsert of module | ||
21 | */ | ||
22 | |||
23 | |||
24 | #include <linux/config.h> | ||
25 | #include <linux/kernel.h> | ||
26 | #include <linux/errno.h> | ||
27 | #include <linux/init.h> | ||
28 | #include <linux/slab.h> | ||
29 | #include <linux/tty.h> | ||
30 | #include <linux/tty_driver.h> | ||
31 | #include <linux/tty_flip.h> | ||
32 | #include <linux/module.h> | ||
33 | #include <linux/usb.h> | ||
34 | #include "usb-serial.h" | ||
35 | |||
36 | |||
37 | #define NOKIA_VENDOR_ID 0x0421 | ||
38 | #define NOKIA7600_PRODUCT_ID 0x0400 | ||
39 | #define NOKIA6230_PRODUCT_ID 0x040f | ||
40 | #define NOKIA6170_PRODUCT_ID 0x0416 | ||
41 | #define NOKIA6670_PRODUCT_ID 0x041d | ||
42 | #define NOKIA6680_PRODUCT_ID 0x041e | ||
43 | #define NOKIA6230i_PRODUCT_ID 0x0428 | ||
44 | |||
45 | #define NOKIA_AT_PORT 0x82 | ||
46 | #define NOKIA_FBUS_PORT 0x86 | ||
47 | |||
48 | /* | ||
49 | * Version Information | ||
50 | */ | ||
51 | #define DRIVER_VERSION "v0.2" | ||
52 | #define DRIVER_AUTHOR "C Kemp" | ||
53 | #define DRIVER_DESC "Nokia DKU2 Driver" | ||
54 | |||
55 | static struct usb_device_id id_table [] = { | ||
56 | { USB_DEVICE(NOKIA_VENDOR_ID, NOKIA7600_PRODUCT_ID) }, | ||
57 | { USB_DEVICE(NOKIA_VENDOR_ID, NOKIA6230_PRODUCT_ID) }, | ||
58 | { USB_DEVICE(NOKIA_VENDOR_ID, NOKIA6170_PRODUCT_ID) }, | ||
59 | { USB_DEVICE(NOKIA_VENDOR_ID, NOKIA6670_PRODUCT_ID) }, | ||
60 | { USB_DEVICE(NOKIA_VENDOR_ID, NOKIA6680_PRODUCT_ID) }, | ||
61 | { USB_DEVICE(NOKIA_VENDOR_ID, NOKIA6230i_PRODUCT_ID) }, | ||
62 | { } /* Terminating entry */ | ||
63 | }; | ||
64 | MODULE_DEVICE_TABLE(usb, id_table); | ||
65 | |||
66 | /* The only thing which makes this device different from a generic | ||
67 | * device is that we have to set an alternative configuration to make | ||
68 | * the relevant endpoints available. In 2.6 this is really easy... */ | ||
69 | static int nokia_probe(struct usb_serial *serial, | ||
70 | const struct usb_device_id *id) | ||
71 | { | ||
72 | int retval = -ENODEV; | ||
73 | |||
74 | if (serial->interface->altsetting[0].endpoint[0].desc.bEndpointAddress == NOKIA_AT_PORT) { | ||
75 | /* the AT port */ | ||
76 | dev_info(&serial->dev->dev, "Nokia AT Port:\n"); | ||
77 | retval = 0; | ||
78 | } else if (serial->interface->num_altsetting == 2 && | ||
79 | serial->interface->altsetting[1].endpoint[0].desc.bEndpointAddress == NOKIA_FBUS_PORT) { | ||
80 | /* the FBUS port */ | ||
81 | dev_info(&serial->dev->dev, "Nokia FBUS Port:\n"); | ||
82 | usb_set_interface(serial->dev, 10, 1); | ||
83 | retval = 0; | ||
84 | } | ||
85 | |||
86 | return retval; | ||
87 | } | ||
88 | |||
89 | static struct usb_driver nokia_driver = { | ||
90 | .owner = THIS_MODULE, | ||
91 | .name = "nokia_dku2", | ||
92 | .probe = usb_serial_probe, | ||
93 | .disconnect = usb_serial_disconnect, | ||
94 | .id_table = id_table, | ||
95 | }; | ||
96 | |||
97 | static struct usb_serial_driver nokia_serial_driver = { | ||
98 | .driver = { | ||
99 | .owner = THIS_MODULE, | ||
100 | .name = "nokia_dku2", | ||
101 | }, | ||
102 | .description = "Nokia 7600/6230(i)/6170/66x0 DKU2 driver", | ||
103 | .id_table = id_table, | ||
104 | .num_interrupt_in = 1, | ||
105 | .num_bulk_in = 1, | ||
106 | .num_bulk_out = 1, | ||
107 | .num_ports = 1, | ||
108 | .probe = nokia_probe, | ||
109 | }; | ||
110 | |||
111 | static int __init nokia_init(void) | ||
112 | { | ||
113 | int retval; | ||
114 | |||
115 | retval = usb_serial_register(&nokia_serial_driver); | ||
116 | if (retval) | ||
117 | return retval; | ||
118 | |||
119 | retval = usb_register(&nokia_driver); | ||
120 | if (retval) { | ||
121 | usb_serial_deregister(&nokia_serial_driver); | ||
122 | return retval; | ||
123 | } | ||
124 | |||
125 | info(DRIVER_VERSION " " DRIVER_AUTHOR); | ||
126 | info(DRIVER_DESC); | ||
127 | |||
128 | return retval; | ||
129 | } | ||
130 | |||
131 | static void __exit nokia_exit(void) | ||
132 | { | ||
133 | usb_deregister(&nokia_driver); | ||
134 | usb_serial_deregister(&nokia_serial_driver); | ||
135 | } | ||
136 | |||
137 | module_init(nokia_init); | ||
138 | module_exit(nokia_exit); | ||
139 | |||
140 | MODULE_AUTHOR(DRIVER_AUTHOR); | ||
141 | MODULE_DESCRIPTION(DRIVER_DESC); | ||
142 | MODULE_LICENSE("GPL"); | ||
diff --git a/drivers/usb/serial/pl2303.c b/drivers/usb/serial/pl2303.c index 165c119bf10e..41a45a5025b2 100644 --- a/drivers/usb/serial/pl2303.c +++ b/drivers/usb/serial/pl2303.c | |||
@@ -71,7 +71,9 @@ static struct usb_device_id id_table [] = { | |||
71 | { USB_DEVICE(SITECOM_VENDOR_ID, SITECOM_PRODUCT_ID) }, | 71 | { USB_DEVICE(SITECOM_VENDOR_ID, SITECOM_PRODUCT_ID) }, |
72 | { USB_DEVICE(ALCATEL_VENDOR_ID, ALCATEL_PRODUCT_ID) }, | 72 | { USB_DEVICE(ALCATEL_VENDOR_ID, ALCATEL_PRODUCT_ID) }, |
73 | { USB_DEVICE(SAMSUNG_VENDOR_ID, SAMSUNG_PRODUCT_ID) }, | 73 | { USB_DEVICE(SAMSUNG_VENDOR_ID, SAMSUNG_PRODUCT_ID) }, |
74 | { USB_DEVICE(SIEMENS_VENDOR_ID, SIEMENS_PRODUCT_ID_SX1) }, | ||
74 | { USB_DEVICE(SIEMENS_VENDOR_ID, SIEMENS_PRODUCT_ID_X65) }, | 75 | { USB_DEVICE(SIEMENS_VENDOR_ID, SIEMENS_PRODUCT_ID_X65) }, |
76 | { USB_DEVICE(SIEMENS_VENDOR_ID, SIEMENS_PRODUCT_ID_X75) }, | ||
75 | { USB_DEVICE(SYNTECH_VENDOR_ID, SYNTECH_PRODUCT_ID) }, | 77 | { USB_DEVICE(SYNTECH_VENDOR_ID, SYNTECH_PRODUCT_ID) }, |
76 | { USB_DEVICE( NOKIA_CA42_VENDOR_ID, NOKIA_CA42_PRODUCT_ID ) }, | 78 | { USB_DEVICE( NOKIA_CA42_VENDOR_ID, NOKIA_CA42_PRODUCT_ID ) }, |
77 | { } /* Terminating entry */ | 79 | { } /* Terminating entry */ |
@@ -811,7 +813,9 @@ static void pl2303_update_line_status(struct usb_serial_port *port, | |||
811 | u8 length = UART_STATE; | 813 | u8 length = UART_STATE; |
812 | 814 | ||
813 | if ((le16_to_cpu(port->serial->dev->descriptor.idVendor) == SIEMENS_VENDOR_ID) && | 815 | if ((le16_to_cpu(port->serial->dev->descriptor.idVendor) == SIEMENS_VENDOR_ID) && |
814 | (le16_to_cpu(port->serial->dev->descriptor.idProduct) == SIEMENS_PRODUCT_ID_X65)) { | 816 | (le16_to_cpu(port->serial->dev->descriptor.idProduct) == SIEMENS_PRODUCT_ID_X65 || |
817 | le16_to_cpu(port->serial->dev->descriptor.idProduct) == SIEMENS_PRODUCT_ID_SX1 || | ||
818 | le16_to_cpu(port->serial->dev->descriptor.idProduct) == SIEMENS_PRODUCT_ID_X75)) { | ||
815 | length = 1; | 819 | length = 1; |
816 | status_idx = 0; | 820 | status_idx = 0; |
817 | } | 821 | } |
diff --git a/drivers/usb/serial/pl2303.h b/drivers/usb/serial/pl2303.h index 7be9644f5a03..21d434d81813 100644 --- a/drivers/usb/serial/pl2303.h +++ b/drivers/usb/serial/pl2303.h | |||
@@ -54,7 +54,9 @@ | |||
54 | #define SAMSUNG_PRODUCT_ID 0x8001 | 54 | #define SAMSUNG_PRODUCT_ID 0x8001 |
55 | 55 | ||
56 | #define SIEMENS_VENDOR_ID 0x11f5 | 56 | #define SIEMENS_VENDOR_ID 0x11f5 |
57 | #define SIEMENS_PRODUCT_ID_SX1 0x0001 | ||
57 | #define SIEMENS_PRODUCT_ID_X65 0x0003 | 58 | #define SIEMENS_PRODUCT_ID_X65 0x0003 |
59 | #define SIEMENS_PRODUCT_ID_X75 0x0004 | ||
58 | 60 | ||
59 | #define SYNTECH_VENDOR_ID 0x0745 | 61 | #define SYNTECH_VENDOR_ID 0x0745 |
60 | #define SYNTECH_PRODUCT_ID 0x0001 | 62 | #define SYNTECH_PRODUCT_ID 0x0001 |
diff --git a/drivers/usb/storage/Kconfig b/drivers/usb/storage/Kconfig index 1a9679f76f5a..c41d64dbb0f0 100644 --- a/drivers/usb/storage/Kconfig +++ b/drivers/usb/storage/Kconfig | |||
@@ -115,7 +115,7 @@ config USB_STORAGE_JUMPSHOT | |||
115 | 115 | ||
116 | config USB_STORAGE_ONETOUCH | 116 | config USB_STORAGE_ONETOUCH |
117 | bool "Support OneTouch Button on Maxtor Hard Drives (EXPERIMENTAL)" | 117 | bool "Support OneTouch Button on Maxtor Hard Drives (EXPERIMENTAL)" |
118 | depends on USB_STORAGE && INPUT_EVDEV && EXPERIMENTAL | 118 | depends on USB_STORAGE && INPUT_EVDEV && EXPERIMENTAL && !PM |
119 | help | 119 | help |
120 | Say Y here to include additional code to support the Maxtor OneTouch | 120 | Say Y here to include additional code to support the Maxtor OneTouch |
121 | USB hard drive's onetouch button. | 121 | USB hard drive's onetouch button. |
diff --git a/drivers/usb/storage/shuttle_usbat.c b/drivers/usb/storage/shuttle_usbat.c index 33c55a6261bb..fea176d7e79a 100644 --- a/drivers/usb/storage/shuttle_usbat.c +++ b/drivers/usb/storage/shuttle_usbat.c | |||
@@ -853,7 +853,7 @@ static int usbat_identify_device(struct us_data *us, | |||
853 | rc = usbat_device_reset(us); | 853 | rc = usbat_device_reset(us); |
854 | if (rc != USB_STOR_TRANSPORT_GOOD) | 854 | if (rc != USB_STOR_TRANSPORT_GOOD) |
855 | return rc; | 855 | return rc; |
856 | msleep(25); | 856 | msleep(500); |
857 | 857 | ||
858 | /* | 858 | /* |
859 | * In attempt to distinguish between HP CDRW's and Flash readers, we now | 859 | * In attempt to distinguish between HP CDRW's and Flash readers, we now |
diff --git a/drivers/usb/storage/unusual_devs.h b/drivers/usb/storage/unusual_devs.h index 9e926a8f2116..0a9858f69a9b 100644 --- a/drivers/usb/storage/unusual_devs.h +++ b/drivers/usb/storage/unusual_devs.h | |||
@@ -710,11 +710,6 @@ UNUSUAL_DEV( 0x0686, 0x4017, 0x0001, 0x0001, | |||
710 | "DIMAGE E223", | 710 | "DIMAGE E223", |
711 | US_SC_SCSI, US_PR_DEVICE, NULL, 0 ), | 711 | US_SC_SCSI, US_PR_DEVICE, NULL, 0 ), |
712 | 712 | ||
713 | UNUSUAL_DEV( 0x0693, 0x0002, 0x0100, 0x0100, | ||
714 | "Hagiwara", | ||
715 | "FlashGate SmartMedia", | ||
716 | US_SC_SCSI, US_PR_BULK, NULL, 0 ), | ||
717 | |||
718 | UNUSUAL_DEV( 0x0693, 0x0005, 0x0100, 0x0100, | 713 | UNUSUAL_DEV( 0x0693, 0x0005, 0x0100, 0x0100, |
719 | "Hagiwara", | 714 | "Hagiwara", |
720 | "Flashgate", | 715 | "Flashgate", |
@@ -1008,6 +1003,11 @@ UNUSUAL_DEV( 0x0c0b, 0xa109, 0x0000, 0xffff, | |||
1008 | * | 1003 | * |
1009 | */ | 1004 | */ |
1010 | #ifdef CONFIG_USB_STORAGE_ONETOUCH | 1005 | #ifdef CONFIG_USB_STORAGE_ONETOUCH |
1006 | UNUSUAL_DEV( 0x0d49, 0x7000, 0x0000, 0x9999, | ||
1007 | "Maxtor", | ||
1008 | "OneTouch External Harddrive", | ||
1009 | US_SC_DEVICE, US_PR_DEVICE, onetouch_connect_input, | ||
1010 | 0), | ||
1011 | UNUSUAL_DEV( 0x0d49, 0x7010, 0x0000, 0x9999, | 1011 | UNUSUAL_DEV( 0x0d49, 0x7010, 0x0000, 0x9999, |
1012 | "Maxtor", | 1012 | "Maxtor", |
1013 | "OneTouch External Harddrive", | 1013 | "OneTouch External Harddrive", |
diff --git a/drivers/video/offb.c b/drivers/video/offb.c index 2c856838694e..00d87f5bb7be 100644 --- a/drivers/video/offb.c +++ b/drivers/video/offb.c | |||
@@ -26,6 +26,7 @@ | |||
26 | #include <linux/fb.h> | 26 | #include <linux/fb.h> |
27 | #include <linux/init.h> | 27 | #include <linux/init.h> |
28 | #include <linux/ioport.h> | 28 | #include <linux/ioport.h> |
29 | #include <linux/pci.h> | ||
29 | #include <asm/io.h> | 30 | #include <asm/io.h> |
30 | #include <asm/prom.h> | 31 | #include <asm/prom.h> |
31 | 32 | ||
@@ -325,8 +326,8 @@ static void __init offb_init_nodriver(struct device_node *dp) | |||
325 | int *pp, i; | 326 | int *pp, i; |
326 | unsigned int len; | 327 | unsigned int len; |
327 | int width = 640, height = 480, depth = 8, pitch; | 328 | int width = 640, height = 480, depth = 8, pitch; |
328 | unsigned *up; | 329 | unsigned int rsize, *up; |
329 | unsigned long address; | 330 | unsigned long address = 0; |
330 | 331 | ||
331 | if ((pp = (int *) get_property(dp, "depth", &len)) != NULL | 332 | if ((pp = (int *) get_property(dp, "depth", &len)) != NULL |
332 | && len == sizeof(int)) | 333 | && len == sizeof(int)) |
@@ -344,10 +345,40 @@ static void __init offb_init_nodriver(struct device_node *dp) | |||
344 | pitch = 0x1000; | 345 | pitch = 0x1000; |
345 | } else | 346 | } else |
346 | pitch = width; | 347 | pitch = width; |
347 | if ((up = (unsigned *) get_property(dp, "address", &len)) != NULL | 348 | |
348 | && len == sizeof(unsigned)) | 349 | rsize = (unsigned long)pitch * (unsigned long)height * |
350 | (unsigned long)(depth / 8); | ||
351 | |||
352 | /* Try to match device to a PCI device in order to get a properly | ||
353 | * translated address rather then trying to decode the open firmware | ||
354 | * stuff in various incorrect ways | ||
355 | */ | ||
356 | #ifdef CONFIG_PCI | ||
357 | /* First try to locate the PCI device if any */ | ||
358 | { | ||
359 | struct pci_dev *pdev = NULL; | ||
360 | |||
361 | for_each_pci_dev(pdev) { | ||
362 | if (dp == pci_device_to_OF_node(pdev)) | ||
363 | break; | ||
364 | } | ||
365 | if (pdev) { | ||
366 | for (i = 0; i < 6 && address == 0; i++) { | ||
367 | if ((pci_resource_flags(pdev, i) & | ||
368 | IORESOURCE_MEM) && | ||
369 | (pci_resource_len(pdev, i) >= rsize)) | ||
370 | address = pci_resource_start(pdev, i); | ||
371 | } | ||
372 | pci_dev_put(pdev); | ||
373 | } | ||
374 | } | ||
375 | #endif /* CONFIG_PCI */ | ||
376 | |||
377 | if (address == 0 && | ||
378 | (up = (unsigned *) get_property(dp, "address", &len)) != NULL && | ||
379 | len == sizeof(unsigned)) | ||
349 | address = (u_long) * up; | 380 | address = (u_long) * up; |
350 | else { | 381 | if (address == 0) { |
351 | for (i = 0; i < dp->n_addrs; ++i) | 382 | for (i = 0; i < dp->n_addrs; ++i) |
352 | if (dp->addrs[i].size >= | 383 | if (dp->addrs[i].size >= |
353 | pitch * height * depth / 8) | 384 | pitch * height * depth / 8) |