diff options
author | Paul Mackerras <paulus@samba.org> | 2008-03-25 17:44:18 -0400 |
---|---|---|
committer | Paul Mackerras <paulus@samba.org> | 2008-03-25 17:44:18 -0400 |
commit | 54f53f2b94feb72622bec7a8563fc487d9f97720 (patch) | |
tree | ab0c4e1dcadd25a00fa7a4febf41bc43b864cf73 /drivers | |
parent | f61fb8a52cdf8b9b6a6badde84aefe58cb35d315 (diff) | |
parent | a4083c9271e0a697278e089f2c0b9a95363ada0a (diff) |
Merge branch 'linux-2.6'
Diffstat (limited to 'drivers')
204 files changed, 3326 insertions, 2690 deletions
diff --git a/drivers/acpi/Kconfig b/drivers/acpi/Kconfig index f688c214be0c..b4f5e8542829 100644 --- a/drivers/acpi/Kconfig +++ b/drivers/acpi/Kconfig | |||
@@ -283,34 +283,22 @@ config ACPI_TOSHIBA | |||
283 | If you have a legacy free Toshiba laptop (such as the Libretto L1 | 283 | If you have a legacy free Toshiba laptop (such as the Libretto L1 |
284 | series), say Y. | 284 | series), say Y. |
285 | 285 | ||
286 | config ACPI_CUSTOM_DSDT | 286 | config ACPI_CUSTOM_DSDT_FILE |
287 | bool "Include Custom DSDT" | 287 | string "Custom DSDT Table file to include" |
288 | default "" | ||
288 | depends on !STANDALONE | 289 | depends on !STANDALONE |
289 | default n | ||
290 | help | 290 | help |
291 | This option supports a custom DSDT by linking it into the kernel. | 291 | This option supports a custom DSDT by linking it into the kernel. |
292 | See Documentation/acpi/dsdt-override.txt | 292 | See Documentation/acpi/dsdt-override.txt |
293 | 293 | ||
294 | If unsure, say N. | ||
295 | |||
296 | config ACPI_CUSTOM_DSDT_FILE | ||
297 | string "Custom DSDT Table file to include" | ||
298 | depends on ACPI_CUSTOM_DSDT | ||
299 | default "" | ||
300 | help | ||
301 | Enter the full path name to the file which includes the AmlCode | 294 | Enter the full path name to the file which includes the AmlCode |
302 | declaration. | 295 | declaration. |
303 | 296 | ||
304 | config ACPI_CUSTOM_DSDT_INITRD | 297 | If unsure, don't enter a file name. |
305 | bool "Read Custom DSDT from initramfs" | ||
306 | depends on BLK_DEV_INITRD | ||
307 | default n | ||
308 | help | ||
309 | This option supports a custom DSDT by optionally loading it from initrd. | ||
310 | See Documentation/acpi/dsdt-override.txt | ||
311 | 298 | ||
312 | If you are not using this feature now, but may use it later, | 299 | config ACPI_CUSTOM_DSDT |
313 | it is safe to say Y here. | 300 | bool |
301 | default ACPI_CUSTOM_DSDT_FILE != "" | ||
314 | 302 | ||
315 | config ACPI_BLACKLIST_YEAR | 303 | config ACPI_BLACKLIST_YEAR |
316 | int "Disable ACPI for systems before Jan 1st this year" if X86_32 | 304 | int "Disable ACPI for systems before Jan 1st this year" if X86_32 |
diff --git a/drivers/acpi/asus_acpi.c b/drivers/acpi/asus_acpi.c index d25ef961415c..44ad90c03c2e 100644 --- a/drivers/acpi/asus_acpi.c +++ b/drivers/acpi/asus_acpi.c | |||
@@ -610,7 +610,7 @@ write_led(const char __user * buffer, unsigned long count, | |||
610 | (led_out) ? (hotk->status | ledmask) : (hotk->status & ~ledmask); | 610 | (led_out) ? (hotk->status | ledmask) : (hotk->status & ~ledmask); |
611 | 611 | ||
612 | if (invert) /* invert target value */ | 612 | if (invert) /* invert target value */ |
613 | led_out = !led_out & 0x1; | 613 | led_out = !led_out; |
614 | 614 | ||
615 | if (!write_acpi_int(hotk->handle, ledname, led_out, NULL)) | 615 | if (!write_acpi_int(hotk->handle, ledname, led_out, NULL)) |
616 | printk(KERN_WARNING "Asus ACPI: LED (%s) write failed\n", | 616 | printk(KERN_WARNING "Asus ACPI: LED (%s) write failed\n", |
diff --git a/drivers/acpi/battery.c b/drivers/acpi/battery.c index f6215e809808..d5729d5dc190 100644 --- a/drivers/acpi/battery.c +++ b/drivers/acpi/battery.c | |||
@@ -293,13 +293,12 @@ static int extract_package(struct acpi_battery *battery, | |||
293 | strncpy(ptr, (u8 *)&element->integer.value, | 293 | strncpy(ptr, (u8 *)&element->integer.value, |
294 | sizeof(acpi_integer)); | 294 | sizeof(acpi_integer)); |
295 | ptr[sizeof(acpi_integer)] = 0; | 295 | ptr[sizeof(acpi_integer)] = 0; |
296 | } else return -EFAULT; | 296 | } else |
297 | *ptr = 0; /* don't have value */ | ||
297 | } else { | 298 | } else { |
298 | if (element->type == ACPI_TYPE_INTEGER) { | 299 | int *x = (int *)((u8 *)battery + offsets[i].offset); |
299 | int *x = (int *)((u8 *)battery + | 300 | *x = (element->type == ACPI_TYPE_INTEGER) ? |
300 | offsets[i].offset); | 301 | element->integer.value : -1; |
301 | *x = element->integer.value; | ||
302 | } else return -EFAULT; | ||
303 | } | 302 | } |
304 | } | 303 | } |
305 | return 0; | 304 | return 0; |
diff --git a/drivers/acpi/bus.c b/drivers/acpi/bus.c index ce3c0a2cbac4..5b6760e0f957 100644 --- a/drivers/acpi/bus.c +++ b/drivers/acpi/bus.c | |||
@@ -776,7 +776,7 @@ static int __init acpi_init(void) | |||
776 | 776 | ||
777 | acpi_kobj = kobject_create_and_add("acpi", firmware_kobj); | 777 | acpi_kobj = kobject_create_and_add("acpi", firmware_kobj); |
778 | if (!acpi_kobj) { | 778 | if (!acpi_kobj) { |
779 | printk(KERN_WARNING "%s: kset create error\n", __FUNCTION__); | 779 | printk(KERN_WARNING "%s: kset create error\n", __func__); |
780 | acpi_kobj = NULL; | 780 | acpi_kobj = NULL; |
781 | } | 781 | } |
782 | 782 | ||
diff --git a/drivers/acpi/button.c b/drivers/acpi/button.c index 24a7865a57cb..6c5da83cdb68 100644 --- a/drivers/acpi/button.c +++ b/drivers/acpi/button.c | |||
@@ -449,6 +449,7 @@ static int acpi_button_add(struct acpi_device *device) | |||
449 | input->phys = button->phys; | 449 | input->phys = button->phys; |
450 | input->id.bustype = BUS_HOST; | 450 | input->id.bustype = BUS_HOST; |
451 | input->id.product = button->type; | 451 | input->id.product = button->type; |
452 | input->dev.parent = &device->dev; | ||
452 | 453 | ||
453 | switch (button->type) { | 454 | switch (button->type) { |
454 | case ACPI_BUTTON_TYPE_POWER: | 455 | case ACPI_BUTTON_TYPE_POWER: |
diff --git a/drivers/acpi/dock.c b/drivers/acpi/dock.c index 307cef65c247..fa44fb96fc34 100644 --- a/drivers/acpi/dock.c +++ b/drivers/acpi/dock.c | |||
@@ -710,6 +710,7 @@ static ssize_t write_undock(struct device *dev, struct device_attribute *attr, | |||
710 | if (!count) | 710 | if (!count) |
711 | return -EINVAL; | 711 | return -EINVAL; |
712 | 712 | ||
713 | begin_undock(dock_station); | ||
713 | ret = handle_eject_request(dock_station, ACPI_NOTIFY_EJECT_REQUEST); | 714 | ret = handle_eject_request(dock_station, ACPI_NOTIFY_EJECT_REQUEST); |
714 | return ret ? ret: count; | 715 | return ret ? ret: count; |
715 | } | 716 | } |
diff --git a/drivers/acpi/ec.c b/drivers/acpi/ec.c index caf873c14bfb..7222a18a0319 100644 --- a/drivers/acpi/ec.c +++ b/drivers/acpi/ec.c | |||
@@ -943,11 +943,7 @@ int __init acpi_ec_ecdt_probe(void) | |||
943 | boot_ec->command_addr = ecdt_ptr->control.address; | 943 | boot_ec->command_addr = ecdt_ptr->control.address; |
944 | boot_ec->data_addr = ecdt_ptr->data.address; | 944 | boot_ec->data_addr = ecdt_ptr->data.address; |
945 | boot_ec->gpe = ecdt_ptr->gpe; | 945 | boot_ec->gpe = ecdt_ptr->gpe; |
946 | if (ACPI_FAILURE(acpi_get_handle(NULL, ecdt_ptr->id, | 946 | boot_ec->handle = ACPI_ROOT_OBJECT; |
947 | &boot_ec->handle))) { | ||
948 | pr_info("Failed to locate handle for boot EC\n"); | ||
949 | boot_ec->handle = ACPI_ROOT_OBJECT; | ||
950 | } | ||
951 | } else { | 947 | } else { |
952 | /* This workaround is needed only on some broken machines, | 948 | /* This workaround is needed only on some broken machines, |
953 | * which require early EC, but fail to provide ECDT */ | 949 | * which require early EC, but fail to provide ECDT */ |
diff --git a/drivers/acpi/osl.c b/drivers/acpi/osl.c index 8edba7b678eb..a697fb6cf050 100644 --- a/drivers/acpi/osl.c +++ b/drivers/acpi/osl.c | |||
@@ -91,10 +91,6 @@ static DEFINE_SPINLOCK(acpi_res_lock); | |||
91 | #define OSI_STRING_LENGTH_MAX 64 /* arbitrary */ | 91 | #define OSI_STRING_LENGTH_MAX 64 /* arbitrary */ |
92 | static char osi_additional_string[OSI_STRING_LENGTH_MAX]; | 92 | static char osi_additional_string[OSI_STRING_LENGTH_MAX]; |
93 | 93 | ||
94 | #ifdef CONFIG_ACPI_CUSTOM_DSDT_INITRD | ||
95 | static int acpi_no_initrd_override; | ||
96 | #endif | ||
97 | |||
98 | /* | 94 | /* |
99 | * "Ode to _OSI(Linux)" | 95 | * "Ode to _OSI(Linux)" |
100 | * | 96 | * |
@@ -324,67 +320,6 @@ acpi_os_predefined_override(const struct acpi_predefined_names *init_val, | |||
324 | return AE_OK; | 320 | return AE_OK; |
325 | } | 321 | } |
326 | 322 | ||
327 | #ifdef CONFIG_ACPI_CUSTOM_DSDT_INITRD | ||
328 | static struct acpi_table_header *acpi_find_dsdt_initrd(void) | ||
329 | { | ||
330 | struct file *firmware_file; | ||
331 | mm_segment_t oldfs; | ||
332 | unsigned long len, len2; | ||
333 | struct acpi_table_header *dsdt_buffer, *ret = NULL; | ||
334 | struct kstat stat; | ||
335 | char *ramfs_dsdt_name = "/DSDT.aml"; | ||
336 | |||
337 | printk(KERN_INFO PREFIX "Checking initramfs for custom DSDT\n"); | ||
338 | |||
339 | /* | ||
340 | * Never do this at home, only the user-space is allowed to open a file. | ||
341 | * The clean way would be to use the firmware loader. | ||
342 | * But this code must be run before there is any userspace available. | ||
343 | * A static/init firmware infrastructure doesn't exist yet... | ||
344 | */ | ||
345 | if (vfs_stat(ramfs_dsdt_name, &stat) < 0) | ||
346 | return ret; | ||
347 | |||
348 | len = stat.size; | ||
349 | /* check especially against empty files */ | ||
350 | if (len <= 4) { | ||
351 | printk(KERN_ERR PREFIX "Failed: DSDT only %lu bytes.\n", len); | ||
352 | return ret; | ||
353 | } | ||
354 | |||
355 | firmware_file = filp_open(ramfs_dsdt_name, O_RDONLY, 0); | ||
356 | if (IS_ERR(firmware_file)) { | ||
357 | printk(KERN_ERR PREFIX "Failed to open %s.\n", ramfs_dsdt_name); | ||
358 | return ret; | ||
359 | } | ||
360 | |||
361 | dsdt_buffer = kmalloc(len, GFP_ATOMIC); | ||
362 | if (!dsdt_buffer) { | ||
363 | printk(KERN_ERR PREFIX "Failed to allocate %lu bytes.\n", len); | ||
364 | goto err; | ||
365 | } | ||
366 | |||
367 | oldfs = get_fs(); | ||
368 | set_fs(KERNEL_DS); | ||
369 | len2 = vfs_read(firmware_file, (char __user *)dsdt_buffer, len, | ||
370 | &firmware_file->f_pos); | ||
371 | set_fs(oldfs); | ||
372 | if (len2 < len) { | ||
373 | printk(KERN_ERR PREFIX "Failed to read %lu bytes from %s.\n", | ||
374 | len, ramfs_dsdt_name); | ||
375 | ACPI_FREE(dsdt_buffer); | ||
376 | goto err; | ||
377 | } | ||
378 | |||
379 | printk(KERN_INFO PREFIX "Found %lu byte DSDT in %s.\n", | ||
380 | len, ramfs_dsdt_name); | ||
381 | ret = dsdt_buffer; | ||
382 | err: | ||
383 | filp_close(firmware_file, NULL); | ||
384 | return ret; | ||
385 | } | ||
386 | #endif | ||
387 | |||
388 | acpi_status | 323 | acpi_status |
389 | acpi_os_table_override(struct acpi_table_header * existing_table, | 324 | acpi_os_table_override(struct acpi_table_header * existing_table, |
390 | struct acpi_table_header ** new_table) | 325 | struct acpi_table_header ** new_table) |
@@ -398,16 +333,6 @@ acpi_os_table_override(struct acpi_table_header * existing_table, | |||
398 | if (strncmp(existing_table->signature, "DSDT", 4) == 0) | 333 | if (strncmp(existing_table->signature, "DSDT", 4) == 0) |
399 | *new_table = (struct acpi_table_header *)AmlCode; | 334 | *new_table = (struct acpi_table_header *)AmlCode; |
400 | #endif | 335 | #endif |
401 | #ifdef CONFIG_ACPI_CUSTOM_DSDT_INITRD | ||
402 | if ((strncmp(existing_table->signature, "DSDT", 4) == 0) && | ||
403 | !acpi_no_initrd_override) { | ||
404 | struct acpi_table_header *initrd_table; | ||
405 | |||
406 | initrd_table = acpi_find_dsdt_initrd(); | ||
407 | if (initrd_table) | ||
408 | *new_table = initrd_table; | ||
409 | } | ||
410 | #endif | ||
411 | if (*new_table != NULL) { | 336 | if (*new_table != NULL) { |
412 | printk(KERN_WARNING PREFIX "Override [%4.4s-%8.8s], " | 337 | printk(KERN_WARNING PREFIX "Override [%4.4s-%8.8s], " |
413 | "this is unsafe: tainting kernel\n", | 338 | "this is unsafe: tainting kernel\n", |
@@ -418,15 +343,6 @@ acpi_os_table_override(struct acpi_table_header * existing_table, | |||
418 | return AE_OK; | 343 | return AE_OK; |
419 | } | 344 | } |
420 | 345 | ||
421 | #ifdef CONFIG_ACPI_CUSTOM_DSDT_INITRD | ||
422 | static int __init acpi_no_initrd_override_setup(char *s) | ||
423 | { | ||
424 | acpi_no_initrd_override = 1; | ||
425 | return 1; | ||
426 | } | ||
427 | __setup("acpi_no_initrd_override", acpi_no_initrd_override_setup); | ||
428 | #endif | ||
429 | |||
430 | static irqreturn_t acpi_irq(int irq, void *dev_id) | 346 | static irqreturn_t acpi_irq(int irq, void *dev_id) |
431 | { | 347 | { |
432 | u32 handled; | 348 | u32 handled; |
@@ -1237,7 +1153,7 @@ int acpi_check_resource_conflict(struct resource *res) | |||
1237 | 1153 | ||
1238 | if (clash) { | 1154 | if (clash) { |
1239 | if (acpi_enforce_resources != ENFORCE_RESOURCES_NO) { | 1155 | if (acpi_enforce_resources != ENFORCE_RESOURCES_NO) { |
1240 | printk(KERN_INFO "%sACPI: %s resource %s [0x%llx-0x%llx]" | 1156 | printk("%sACPI: %s resource %s [0x%llx-0x%llx]" |
1241 | " conflicts with ACPI region %s" | 1157 | " conflicts with ACPI region %s" |
1242 | " [0x%llx-0x%llx]\n", | 1158 | " [0x%llx-0x%llx]\n", |
1243 | acpi_enforce_resources == ENFORCE_RESOURCES_LAX | 1159 | acpi_enforce_resources == ENFORCE_RESOURCES_LAX |
diff --git a/drivers/acpi/pci_irq.c b/drivers/acpi/pci_irq.c index 7f19859580c7..7af414a3c63e 100644 --- a/drivers/acpi/pci_irq.c +++ b/drivers/acpi/pci_irq.c | |||
@@ -25,6 +25,7 @@ | |||
25 | */ | 25 | */ |
26 | 26 | ||
27 | 27 | ||
28 | #include <linux/dmi.h> | ||
28 | #include <linux/kernel.h> | 29 | #include <linux/kernel.h> |
29 | #include <linux/module.h> | 30 | #include <linux/module.h> |
30 | #include <linux/init.h> | 31 | #include <linux/init.h> |
@@ -76,6 +77,101 @@ static struct acpi_prt_entry *acpi_pci_irq_find_prt_entry(int segment, | |||
76 | return NULL; | 77 | return NULL; |
77 | } | 78 | } |
78 | 79 | ||
80 | /* http://bugzilla.kernel.org/show_bug.cgi?id=4773 */ | ||
81 | static struct dmi_system_id medion_md9580[] = { | ||
82 | { | ||
83 | .ident = "Medion MD9580-F laptop", | ||
84 | .matches = { | ||
85 | DMI_MATCH(DMI_SYS_VENDOR, "MEDIONNB"), | ||
86 | DMI_MATCH(DMI_PRODUCT_NAME, "A555"), | ||
87 | }, | ||
88 | }, | ||
89 | { } | ||
90 | }; | ||
91 | |||
92 | /* http://bugzilla.kernel.org/show_bug.cgi?id=5044 */ | ||
93 | static struct dmi_system_id dell_optiplex[] = { | ||
94 | { | ||
95 | .ident = "Dell Optiplex GX1", | ||
96 | .matches = { | ||
97 | DMI_MATCH(DMI_SYS_VENDOR, "Dell Computer Corporation"), | ||
98 | DMI_MATCH(DMI_PRODUCT_NAME, "OptiPlex GX1 600S+"), | ||
99 | }, | ||
100 | }, | ||
101 | { } | ||
102 | }; | ||
103 | |||
104 | /* http://bugzilla.kernel.org/show_bug.cgi?id=10138 */ | ||
105 | static struct dmi_system_id hp_t5710[] = { | ||
106 | { | ||
107 | .ident = "HP t5710", | ||
108 | .matches = { | ||
109 | DMI_MATCH(DMI_SYS_VENDOR, "Hewlett-Packard"), | ||
110 | DMI_MATCH(DMI_PRODUCT_NAME, "hp t5000 series"), | ||
111 | DMI_MATCH(DMI_BOARD_NAME, "098Ch"), | ||
112 | }, | ||
113 | }, | ||
114 | { } | ||
115 | }; | ||
116 | |||
117 | struct prt_quirk { | ||
118 | struct dmi_system_id *system; | ||
119 | unsigned int segment; | ||
120 | unsigned int bus; | ||
121 | unsigned int device; | ||
122 | unsigned char pin; | ||
123 | char *source; /* according to BIOS */ | ||
124 | char *actual_source; | ||
125 | }; | ||
126 | |||
127 | /* | ||
128 | * These systems have incorrect _PRT entries. The BIOS claims the PCI | ||
129 | * interrupt at the listed segment/bus/device/pin is connected to the first | ||
130 | * link device, but it is actually connected to the second. | ||
131 | */ | ||
132 | static struct prt_quirk prt_quirks[] = { | ||
133 | { medion_md9580, 0, 0, 9, 'A', | ||
134 | "\\_SB_.PCI0.ISA.LNKA", | ||
135 | "\\_SB_.PCI0.ISA.LNKB"}, | ||
136 | { dell_optiplex, 0, 0, 0xd, 'A', | ||
137 | "\\_SB_.LNKB", | ||
138 | "\\_SB_.LNKA"}, | ||
139 | { hp_t5710, 0, 0, 1, 'A', | ||
140 | "\\_SB_.PCI0.LNK1", | ||
141 | "\\_SB_.PCI0.LNK3"}, | ||
142 | }; | ||
143 | |||
144 | static void | ||
145 | do_prt_fixups(struct acpi_prt_entry *entry, struct acpi_pci_routing_table *prt) | ||
146 | { | ||
147 | int i; | ||
148 | struct prt_quirk *quirk; | ||
149 | |||
150 | for (i = 0; i < ARRAY_SIZE(prt_quirks); i++) { | ||
151 | quirk = &prt_quirks[i]; | ||
152 | |||
153 | /* All current quirks involve link devices, not GSIs */ | ||
154 | if (!prt->source) | ||
155 | continue; | ||
156 | |||
157 | if (dmi_check_system(quirk->system) && | ||
158 | entry->id.segment == quirk->segment && | ||
159 | entry->id.bus == quirk->bus && | ||
160 | entry->id.device == quirk->device && | ||
161 | entry->pin + 'A' == quirk->pin && | ||
162 | !strcmp(prt->source, quirk->source) && | ||
163 | strlen(prt->source) >= strlen(quirk->actual_source)) { | ||
164 | printk(KERN_WARNING PREFIX "firmware reports " | ||
165 | "%04x:%02x:%02x[%c] connected to %s; " | ||
166 | "changing to %s\n", | ||
167 | entry->id.segment, entry->id.bus, | ||
168 | entry->id.device, 'A' + entry->pin, | ||
169 | prt->source, quirk->actual_source); | ||
170 | strcpy(prt->source, quirk->actual_source); | ||
171 | } | ||
172 | } | ||
173 | } | ||
174 | |||
79 | static int | 175 | static int |
80 | acpi_pci_irq_add_entry(acpi_handle handle, | 176 | acpi_pci_irq_add_entry(acpi_handle handle, |
81 | int segment, int bus, struct acpi_pci_routing_table *prt) | 177 | int segment, int bus, struct acpi_pci_routing_table *prt) |
@@ -96,6 +192,8 @@ acpi_pci_irq_add_entry(acpi_handle handle, | |||
96 | entry->id.function = prt->address & 0xFFFF; | 192 | entry->id.function = prt->address & 0xFFFF; |
97 | entry->pin = prt->pin; | 193 | entry->pin = prt->pin; |
98 | 194 | ||
195 | do_prt_fixups(entry, prt); | ||
196 | |||
99 | /* | 197 | /* |
100 | * Type 1: Dynamic | 198 | * Type 1: Dynamic |
101 | * --------------- | 199 | * --------------- |
diff --git a/drivers/acpi/pci_root.c b/drivers/acpi/pci_root.c index f14ff1ffab29..c3fed31166b5 100644 --- a/drivers/acpi/pci_root.c +++ b/drivers/acpi/pci_root.c | |||
@@ -184,7 +184,7 @@ static void acpi_pci_bridge_scan(struct acpi_device *device) | |||
184 | } | 184 | } |
185 | } | 185 | } |
186 | 186 | ||
187 | static int acpi_pci_root_add(struct acpi_device *device) | 187 | static int __devinit acpi_pci_root_add(struct acpi_device *device) |
188 | { | 188 | { |
189 | int result = 0; | 189 | int result = 0; |
190 | struct acpi_pci_root *root = NULL; | 190 | struct acpi_pci_root *root = NULL; |
diff --git a/drivers/acpi/processor_core.c b/drivers/acpi/processor_core.c index a3cc8a98255c..36a68fa114e3 100644 --- a/drivers/acpi/processor_core.c +++ b/drivers/acpi/processor_core.c | |||
@@ -840,17 +840,19 @@ static int is_processor_present(acpi_handle handle) | |||
840 | 840 | ||
841 | 841 | ||
842 | status = acpi_evaluate_integer(handle, "_STA", NULL, &sta); | 842 | status = acpi_evaluate_integer(handle, "_STA", NULL, &sta); |
843 | /* | ||
844 | * if a processor object does not have an _STA object, | ||
845 | * OSPM assumes that the processor is present. | ||
846 | */ | ||
847 | if (status == AE_NOT_FOUND) | ||
848 | return 1; | ||
849 | 843 | ||
850 | if (ACPI_SUCCESS(status) && (sta & ACPI_STA_DEVICE_PRESENT)) | 844 | if (ACPI_SUCCESS(status) && (sta & ACPI_STA_DEVICE_PRESENT)) |
851 | return 1; | 845 | return 1; |
852 | 846 | ||
853 | ACPI_EXCEPTION((AE_INFO, status, "Processor Device is not present")); | 847 | /* |
848 | * _STA is mandatory for a processor that supports hot plug | ||
849 | */ | ||
850 | if (status == AE_NOT_FOUND) | ||
851 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, | ||
852 | "Processor does not support hot plug\n")); | ||
853 | else | ||
854 | ACPI_EXCEPTION((AE_INFO, status, | ||
855 | "Processor Device is not present")); | ||
854 | return 0; | 856 | return 0; |
855 | } | 857 | } |
856 | 858 | ||
@@ -886,8 +888,8 @@ int acpi_processor_device_add(acpi_handle handle, struct acpi_device **device) | |||
886 | return 0; | 888 | return 0; |
887 | } | 889 | } |
888 | 890 | ||
889 | static void | 891 | static void __ref acpi_processor_hotplug_notify(acpi_handle handle, |
890 | acpi_processor_hotplug_notify(acpi_handle handle, u32 event, void *data) | 892 | u32 event, void *data) |
891 | { | 893 | { |
892 | struct acpi_processor *pr; | 894 | struct acpi_processor *pr; |
893 | struct acpi_device *device = NULL; | 895 | struct acpi_device *device = NULL; |
@@ -897,9 +899,10 @@ acpi_processor_hotplug_notify(acpi_handle handle, u32 event, void *data) | |||
897 | switch (event) { | 899 | switch (event) { |
898 | case ACPI_NOTIFY_BUS_CHECK: | 900 | case ACPI_NOTIFY_BUS_CHECK: |
899 | case ACPI_NOTIFY_DEVICE_CHECK: | 901 | case ACPI_NOTIFY_DEVICE_CHECK: |
900 | printk("Processor driver received %s event\n", | 902 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, |
903 | "Processor driver received %s event\n", | ||
901 | (event == ACPI_NOTIFY_BUS_CHECK) ? | 904 | (event == ACPI_NOTIFY_BUS_CHECK) ? |
902 | "ACPI_NOTIFY_BUS_CHECK" : "ACPI_NOTIFY_DEVICE_CHECK"); | 905 | "ACPI_NOTIFY_BUS_CHECK" : "ACPI_NOTIFY_DEVICE_CHECK")); |
903 | 906 | ||
904 | if (!is_processor_present(handle)) | 907 | if (!is_processor_present(handle)) |
905 | break; | 908 | break; |
diff --git a/drivers/acpi/processor_idle.c b/drivers/acpi/processor_idle.c index 6f3b217699e9..e8e2d8869236 100644 --- a/drivers/acpi/processor_idle.c +++ b/drivers/acpi/processor_idle.c | |||
@@ -216,8 +216,10 @@ static void acpi_safe_halt(void) | |||
216 | * test NEED_RESCHED: | 216 | * test NEED_RESCHED: |
217 | */ | 217 | */ |
218 | smp_mb(); | 218 | smp_mb(); |
219 | if (!need_resched()) | 219 | if (!need_resched()) { |
220 | safe_halt(); | 220 | safe_halt(); |
221 | local_irq_disable(); | ||
222 | } | ||
221 | current_thread_info()->status |= TS_POLLING; | 223 | current_thread_info()->status |= TS_POLLING; |
222 | } | 224 | } |
223 | 225 | ||
@@ -421,7 +423,9 @@ static void acpi_processor_idle(void) | |||
421 | else | 423 | else |
422 | acpi_safe_halt(); | 424 | acpi_safe_halt(); |
423 | 425 | ||
424 | local_irq_enable(); | 426 | if (irqs_disabled()) |
427 | local_irq_enable(); | ||
428 | |||
425 | return; | 429 | return; |
426 | } | 430 | } |
427 | 431 | ||
@@ -530,7 +534,9 @@ static void acpi_processor_idle(void) | |||
530 | * skew otherwise. | 534 | * skew otherwise. |
531 | */ | 535 | */ |
532 | sleep_ticks = 0xFFFFFFFF; | 536 | sleep_ticks = 0xFFFFFFFF; |
533 | local_irq_enable(); | 537 | if (irqs_disabled()) |
538 | local_irq_enable(); | ||
539 | |||
534 | break; | 540 | break; |
535 | 541 | ||
536 | case ACPI_STATE_C2: | 542 | case ACPI_STATE_C2: |
diff --git a/drivers/acpi/scan.c b/drivers/acpi/scan.c index 3fac011f9cf9..57570ac47803 100644 --- a/drivers/acpi/scan.c +++ b/drivers/acpi/scan.c | |||
@@ -609,7 +609,8 @@ acpi_bus_get_ejd(acpi_handle handle, acpi_handle *ejd) | |||
609 | status = acpi_evaluate_object(handle, "_EJD", NULL, &buffer); | 609 | status = acpi_evaluate_object(handle, "_EJD", NULL, &buffer); |
610 | if (ACPI_SUCCESS(status)) { | 610 | if (ACPI_SUCCESS(status)) { |
611 | obj = buffer.pointer; | 611 | obj = buffer.pointer; |
612 | status = acpi_get_handle(NULL, obj->string.pointer, ejd); | 612 | status = acpi_get_handle(ACPI_ROOT_OBJECT, obj->string.pointer, |
613 | ejd); | ||
613 | kfree(buffer.pointer); | 614 | kfree(buffer.pointer); |
614 | } | 615 | } |
615 | return status; | 616 | return status; |
@@ -966,7 +967,7 @@ static void acpi_device_set_id(struct acpi_device *device, | |||
966 | case ACPI_BUS_TYPE_DEVICE: | 967 | case ACPI_BUS_TYPE_DEVICE: |
967 | status = acpi_get_object_info(handle, &buffer); | 968 | status = acpi_get_object_info(handle, &buffer); |
968 | if (ACPI_FAILURE(status)) { | 969 | if (ACPI_FAILURE(status)) { |
969 | printk(KERN_ERR PREFIX "%s: Error reading device info\n", __FUNCTION__); | 970 | printk(KERN_ERR PREFIX "%s: Error reading device info\n", __func__); |
970 | return; | 971 | return; |
971 | } | 972 | } |
972 | 973 | ||
diff --git a/drivers/acpi/sleep/main.c b/drivers/acpi/sleep/main.c index 293a1cbb47c0..d2f71a54726c 100644 --- a/drivers/acpi/sleep/main.c +++ b/drivers/acpi/sleep/main.c | |||
@@ -504,7 +504,7 @@ static void acpi_power_off_prepare(void) | |||
504 | static void acpi_power_off(void) | 504 | static void acpi_power_off(void) |
505 | { | 505 | { |
506 | /* acpi_sleep_prepare(ACPI_STATE_S5) should have already been called */ | 506 | /* acpi_sleep_prepare(ACPI_STATE_S5) should have already been called */ |
507 | printk("%s called\n", __FUNCTION__); | 507 | printk("%s called\n", __func__); |
508 | local_irq_disable(); | 508 | local_irq_disable(); |
509 | acpi_enable_wakeup_device(ACPI_STATE_S5); | 509 | acpi_enable_wakeup_device(ACPI_STATE_S5); |
510 | acpi_enter_sleep_state(ACPI_STATE_S5); | 510 | acpi_enter_sleep_state(ACPI_STATE_S5); |
diff --git a/drivers/acpi/system.c b/drivers/acpi/system.c index 55cf4c05bb74..4749f379a915 100644 --- a/drivers/acpi/system.c +++ b/drivers/acpi/system.c | |||
@@ -319,7 +319,7 @@ void acpi_irq_stats_init(void) | |||
319 | goto fail; | 319 | goto fail; |
320 | 320 | ||
321 | for (i = 0; i < num_counters; ++i) { | 321 | for (i = 0; i < num_counters; ++i) { |
322 | char buffer[10]; | 322 | char buffer[12]; |
323 | char *name; | 323 | char *name; |
324 | 324 | ||
325 | if (i < num_gpes) | 325 | if (i < num_gpes) |
diff --git a/drivers/acpi/thermal.c b/drivers/acpi/thermal.c index 8d4b79b4f933..c4e00ac8ea85 100644 --- a/drivers/acpi/thermal.c +++ b/drivers/acpi/thermal.c | |||
@@ -879,6 +879,8 @@ static void acpi_thermal_check(void *data) | |||
879 | } | 879 | } |
880 | 880 | ||
881 | /* sys I/F for generic thermal sysfs support */ | 881 | /* sys I/F for generic thermal sysfs support */ |
882 | #define KELVIN_TO_MILLICELSIUS(t) (t * 100 - 273200) | ||
883 | |||
882 | static int thermal_get_temp(struct thermal_zone_device *thermal, char *buf) | 884 | static int thermal_get_temp(struct thermal_zone_device *thermal, char *buf) |
883 | { | 885 | { |
884 | struct acpi_thermal *tz = thermal->devdata; | 886 | struct acpi_thermal *tz = thermal->devdata; |
@@ -886,7 +888,7 @@ static int thermal_get_temp(struct thermal_zone_device *thermal, char *buf) | |||
886 | if (!tz) | 888 | if (!tz) |
887 | return -EINVAL; | 889 | return -EINVAL; |
888 | 890 | ||
889 | return sprintf(buf, "%ld\n", KELVIN_TO_CELSIUS(tz->temperature)); | 891 | return sprintf(buf, "%ld\n", KELVIN_TO_MILLICELSIUS(tz->temperature)); |
890 | } | 892 | } |
891 | 893 | ||
892 | static const char enabled[] = "kernel"; | 894 | static const char enabled[] = "kernel"; |
@@ -980,21 +982,21 @@ static int thermal_get_trip_temp(struct thermal_zone_device *thermal, | |||
980 | 982 | ||
981 | if (tz->trips.critical.flags.valid) { | 983 | if (tz->trips.critical.flags.valid) { |
982 | if (!trip) | 984 | if (!trip) |
983 | return sprintf(buf, "%ld\n", KELVIN_TO_CELSIUS( | 985 | return sprintf(buf, "%ld\n", KELVIN_TO_MILLICELSIUS( |
984 | tz->trips.critical.temperature)); | 986 | tz->trips.critical.temperature)); |
985 | trip--; | 987 | trip--; |
986 | } | 988 | } |
987 | 989 | ||
988 | if (tz->trips.hot.flags.valid) { | 990 | if (tz->trips.hot.flags.valid) { |
989 | if (!trip) | 991 | if (!trip) |
990 | return sprintf(buf, "%ld\n", KELVIN_TO_CELSIUS( | 992 | return sprintf(buf, "%ld\n", KELVIN_TO_MILLICELSIUS( |
991 | tz->trips.hot.temperature)); | 993 | tz->trips.hot.temperature)); |
992 | trip--; | 994 | trip--; |
993 | } | 995 | } |
994 | 996 | ||
995 | if (tz->trips.passive.flags.valid) { | 997 | if (tz->trips.passive.flags.valid) { |
996 | if (!trip) | 998 | if (!trip) |
997 | return sprintf(buf, "%ld\n", KELVIN_TO_CELSIUS( | 999 | return sprintf(buf, "%ld\n", KELVIN_TO_MILLICELSIUS( |
998 | tz->trips.passive.temperature)); | 1000 | tz->trips.passive.temperature)); |
999 | trip--; | 1001 | trip--; |
1000 | } | 1002 | } |
@@ -1002,7 +1004,7 @@ static int thermal_get_trip_temp(struct thermal_zone_device *thermal, | |||
1002 | for (i = 0; i < ACPI_THERMAL_MAX_ACTIVE && | 1004 | for (i = 0; i < ACPI_THERMAL_MAX_ACTIVE && |
1003 | tz->trips.active[i].flags.valid; i++) { | 1005 | tz->trips.active[i].flags.valid; i++) { |
1004 | if (!trip) | 1006 | if (!trip) |
1005 | return sprintf(buf, "%ld\n", KELVIN_TO_CELSIUS( | 1007 | return sprintf(buf, "%ld\n", KELVIN_TO_MILLICELSIUS( |
1006 | tz->trips.active[i].temperature)); | 1008 | tz->trips.active[i].temperature)); |
1007 | trip--; | 1009 | trip--; |
1008 | } | 1010 | } |
diff --git a/drivers/acpi/toshiba_acpi.c b/drivers/acpi/toshiba_acpi.c index 9e8c20c6a0b7..0a43c8e0eff3 100644 --- a/drivers/acpi/toshiba_acpi.c +++ b/drivers/acpi/toshiba_acpi.c | |||
@@ -99,6 +99,13 @@ MODULE_LICENSE("GPL"); | |||
99 | #define HCI_VIDEO_OUT_CRT 0x2 | 99 | #define HCI_VIDEO_OUT_CRT 0x2 |
100 | #define HCI_VIDEO_OUT_TV 0x4 | 100 | #define HCI_VIDEO_OUT_TV 0x4 |
101 | 101 | ||
102 | static const struct acpi_device_id toshiba_device_ids[] = { | ||
103 | {"TOS6200", 0}, | ||
104 | {"TOS1900", 0}, | ||
105 | {"", 0}, | ||
106 | }; | ||
107 | MODULE_DEVICE_TABLE(acpi, toshiba_device_ids); | ||
108 | |||
102 | /* utility | 109 | /* utility |
103 | */ | 110 | */ |
104 | 111 | ||
diff --git a/drivers/acpi/utilities/utdebug.c b/drivers/acpi/utilities/utdebug.c index c7e128e5369b..7361204b1eef 100644 --- a/drivers/acpi/utilities/utdebug.c +++ b/drivers/acpi/utilities/utdebug.c | |||
@@ -109,7 +109,7 @@ void acpi_ut_track_stack_ptr(void) | |||
109 | * RETURN: Updated pointer to the function name | 109 | * RETURN: Updated pointer to the function name |
110 | * | 110 | * |
111 | * DESCRIPTION: Remove the "Acpi" prefix from the function name, if present. | 111 | * DESCRIPTION: Remove the "Acpi" prefix from the function name, if present. |
112 | * This allows compiler macros such as __FUNCTION__ to be used | 112 | * This allows compiler macros such as __func__ to be used |
113 | * with no change to the debug output. | 113 | * with no change to the debug output. |
114 | * | 114 | * |
115 | ******************************************************************************/ | 115 | ******************************************************************************/ |
diff --git a/drivers/acpi/utilities/utobject.c b/drivers/acpi/utilities/utobject.c index 76ee766c84f9..e08b3fa6639f 100644 --- a/drivers/acpi/utilities/utobject.c +++ b/drivers/acpi/utilities/utobject.c | |||
@@ -432,7 +432,7 @@ acpi_ut_get_simple_object_size(union acpi_operand_object *internal_object, | |||
432 | * element -- which is legal) | 432 | * element -- which is legal) |
433 | */ | 433 | */ |
434 | if (!internal_object) { | 434 | if (!internal_object) { |
435 | *obj_length = 0; | 435 | *obj_length = sizeof(union acpi_object); |
436 | return_ACPI_STATUS(AE_OK); | 436 | return_ACPI_STATUS(AE_OK); |
437 | } | 437 | } |
438 | 438 | ||
diff --git a/drivers/acpi/utils.c b/drivers/acpi/utils.c index eba55b7d6c95..44ea60cf21c0 100644 --- a/drivers/acpi/utils.c +++ b/drivers/acpi/utils.c | |||
@@ -407,6 +407,12 @@ acpi_evaluate_reference(acpi_handle handle, | |||
407 | break; | 407 | break; |
408 | } | 408 | } |
409 | 409 | ||
410 | if (!element->reference.handle) { | ||
411 | printk(KERN_WARNING PREFIX "Invalid reference in" | ||
412 | " package %s\n", pathname); | ||
413 | status = AE_NULL_ENTRY; | ||
414 | break; | ||
415 | } | ||
410 | /* Get the acpi_handle. */ | 416 | /* Get the acpi_handle. */ |
411 | 417 | ||
412 | list->handles[i] = element->reference.handle; | 418 | list->handles[i] = element->reference.handle; |
diff --git a/drivers/acpi/video.c b/drivers/acpi/video.c index 12cce69b5441..12fb44f16766 100644 --- a/drivers/acpi/video.c +++ b/drivers/acpi/video.c | |||
@@ -713,7 +713,7 @@ static void acpi_video_device_find_cap(struct acpi_video_device *device) | |||
713 | 713 | ||
714 | kfree(obj); | 714 | kfree(obj); |
715 | 715 | ||
716 | if (device->cap._BCL && device->cap._BCM && device->cap._BQC && max_level > 0){ | 716 | if (device->cap._BCL && device->cap._BCM && max_level > 0) { |
717 | int result; | 717 | int result; |
718 | static int count = 0; | 718 | static int count = 0; |
719 | char *name; | 719 | char *name; |
@@ -807,40 +807,11 @@ static void acpi_video_bus_find_cap(struct acpi_video_bus *video) | |||
807 | static int acpi_video_bus_check(struct acpi_video_bus *video) | 807 | static int acpi_video_bus_check(struct acpi_video_bus *video) |
808 | { | 808 | { |
809 | acpi_status status = -ENOENT; | 809 | acpi_status status = -ENOENT; |
810 | long device_id; | 810 | |
811 | struct device *dev; | ||
812 | struct acpi_device *device; | ||
813 | 811 | ||
814 | if (!video) | 812 | if (!video) |
815 | return -EINVAL; | 813 | return -EINVAL; |
816 | 814 | ||
817 | device = video->device; | ||
818 | |||
819 | status = | ||
820 | acpi_evaluate_integer(device->handle, "_ADR", NULL, &device_id); | ||
821 | |||
822 | if (!ACPI_SUCCESS(status)) | ||
823 | return -ENODEV; | ||
824 | |||
825 | /* We need to attempt to determine whether the _ADR refers to a | ||
826 | PCI device or not. There's no terribly good way to do this, | ||
827 | so the best we can hope for is to assume that there'll never | ||
828 | be a video device in the host bridge */ | ||
829 | if (device_id >= 0x10000) { | ||
830 | /* It looks like a PCI device. Does it exist? */ | ||
831 | dev = acpi_get_physical_device(device->handle); | ||
832 | } else { | ||
833 | /* It doesn't look like a PCI device. Does its parent | ||
834 | exist? */ | ||
835 | acpi_handle phandle; | ||
836 | if (acpi_get_parent(device->handle, &phandle)) | ||
837 | return -ENODEV; | ||
838 | dev = acpi_get_physical_device(phandle); | ||
839 | } | ||
840 | if (!dev) | ||
841 | return -ENODEV; | ||
842 | put_device(dev); | ||
843 | |||
844 | /* Since there is no HID, CID and so on for VGA driver, we have | 815 | /* Since there is no HID, CID and so on for VGA driver, we have |
845 | * to check well known required nodes. | 816 | * to check well known required nodes. |
846 | */ | 817 | */ |
@@ -1201,7 +1172,7 @@ static int acpi_video_bus_ROM_seq_show(struct seq_file *seq, void *offset) | |||
1201 | if (!video) | 1172 | if (!video) |
1202 | goto end; | 1173 | goto end; |
1203 | 1174 | ||
1204 | printk(KERN_INFO PREFIX "Please implement %s\n", __FUNCTION__); | 1175 | printk(KERN_INFO PREFIX "Please implement %s\n", __func__); |
1205 | seq_printf(seq, "<TODO>\n"); | 1176 | seq_printf(seq, "<TODO>\n"); |
1206 | 1177 | ||
1207 | end: | 1178 | end: |
@@ -1366,37 +1337,8 @@ acpi_video_bus_write_DOS(struct file *file, | |||
1366 | 1337 | ||
1367 | static int acpi_video_bus_add_fs(struct acpi_device *device) | 1338 | static int acpi_video_bus_add_fs(struct acpi_device *device) |
1368 | { | 1339 | { |
1369 | long device_id; | ||
1370 | int status; | ||
1371 | struct proc_dir_entry *entry = NULL; | 1340 | struct proc_dir_entry *entry = NULL; |
1372 | struct acpi_video_bus *video; | 1341 | struct acpi_video_bus *video; |
1373 | struct device *dev; | ||
1374 | |||
1375 | status = | ||
1376 | acpi_evaluate_integer(device->handle, "_ADR", NULL, &device_id); | ||
1377 | |||
1378 | if (!ACPI_SUCCESS(status)) | ||
1379 | return -ENODEV; | ||
1380 | |||
1381 | /* We need to attempt to determine whether the _ADR refers to a | ||
1382 | PCI device or not. There's no terribly good way to do this, | ||
1383 | so the best we can hope for is to assume that there'll never | ||
1384 | be a video device in the host bridge */ | ||
1385 | if (device_id >= 0x10000) { | ||
1386 | /* It looks like a PCI device. Does it exist? */ | ||
1387 | dev = acpi_get_physical_device(device->handle); | ||
1388 | } else { | ||
1389 | /* It doesn't look like a PCI device. Does its parent | ||
1390 | exist? */ | ||
1391 | acpi_handle phandle; | ||
1392 | if (acpi_get_parent(device->handle, &phandle)) | ||
1393 | return -ENODEV; | ||
1394 | dev = acpi_get_physical_device(phandle); | ||
1395 | } | ||
1396 | if (!dev) | ||
1397 | return -ENODEV; | ||
1398 | put_device(dev); | ||
1399 | |||
1400 | 1342 | ||
1401 | 1343 | ||
1402 | video = acpi_driver_data(device); | 1344 | video = acpi_driver_data(device); |
diff --git a/drivers/acpi/wmi.c b/drivers/acpi/wmi.c index efacc9f8bfe3..c33b1c6e93b1 100644 --- a/drivers/acpi/wmi.c +++ b/drivers/acpi/wmi.c | |||
@@ -293,7 +293,7 @@ struct acpi_buffer *out) | |||
293 | { | 293 | { |
294 | struct guid_block *block = NULL; | 294 | struct guid_block *block = NULL; |
295 | struct wmi_block *wblock = NULL; | 295 | struct wmi_block *wblock = NULL; |
296 | acpi_handle handle; | 296 | acpi_handle handle, wc_handle; |
297 | acpi_status status, wc_status = AE_ERROR; | 297 | acpi_status status, wc_status = AE_ERROR; |
298 | struct acpi_object_list input, wc_input; | 298 | struct acpi_object_list input, wc_input; |
299 | union acpi_object wc_params[1], wq_params[1]; | 299 | union acpi_object wc_params[1], wq_params[1]; |
@@ -338,8 +338,10 @@ struct acpi_buffer *out) | |||
338 | * expensive, but have no corresponding WCxx method. So we | 338 | * expensive, but have no corresponding WCxx method. So we |
339 | * should not fail if this happens. | 339 | * should not fail if this happens. |
340 | */ | 340 | */ |
341 | wc_status = acpi_evaluate_object(handle, wc_method, | 341 | wc_status = acpi_get_handle(handle, wc_method, &wc_handle); |
342 | &wc_input, NULL); | 342 | if (ACPI_SUCCESS(wc_status)) |
343 | wc_status = acpi_evaluate_object(handle, wc_method, | ||
344 | &wc_input, NULL); | ||
343 | } | 345 | } |
344 | 346 | ||
345 | strcpy(method, "WQ"); | 347 | strcpy(method, "WQ"); |
@@ -351,7 +353,7 @@ struct acpi_buffer *out) | |||
351 | * If ACPI_WMI_EXPENSIVE, call the relevant WCxx method, even if | 353 | * If ACPI_WMI_EXPENSIVE, call the relevant WCxx method, even if |
352 | * the WQxx method failed - we should disable collection anyway. | 354 | * the WQxx method failed - we should disable collection anyway. |
353 | */ | 355 | */ |
354 | if ((block->flags & ACPI_WMI_EXPENSIVE) && wc_status) { | 356 | if ((block->flags & ACPI_WMI_EXPENSIVE) && ACPI_SUCCESS(wc_status)) { |
355 | wc_params[0].integer.value = 0; | 357 | wc_params[0].integer.value = 0; |
356 | status = acpi_evaluate_object(handle, | 358 | status = acpi_evaluate_object(handle, |
357 | wc_method, &wc_input, NULL); | 359 | wc_method, &wc_input, NULL); |
diff --git a/drivers/ata/Kconfig b/drivers/ata/Kconfig index e469647330de..25aba69b59b4 100644 --- a/drivers/ata/Kconfig +++ b/drivers/ata/Kconfig | |||
@@ -30,6 +30,7 @@ config ATA_NONSTANDARD | |||
30 | config ATA_ACPI | 30 | config ATA_ACPI |
31 | bool | 31 | bool |
32 | depends on ACPI && PCI | 32 | depends on ACPI && PCI |
33 | select ACPI_DOCK | ||
33 | default y | 34 | default y |
34 | help | 35 | help |
35 | This option adds support for ATA-related ACPI objects. | 36 | This option adds support for ATA-related ACPI objects. |
diff --git a/drivers/ata/ahci.c b/drivers/ata/ahci.c index 6978469eb16d..b1eb4e24c86a 100644 --- a/drivers/ata/ahci.c +++ b/drivers/ata/ahci.c | |||
@@ -49,6 +49,10 @@ | |||
49 | #define DRV_NAME "ahci" | 49 | #define DRV_NAME "ahci" |
50 | #define DRV_VERSION "3.0" | 50 | #define DRV_VERSION "3.0" |
51 | 51 | ||
52 | static int ahci_skip_host_reset; | ||
53 | module_param_named(skip_host_reset, ahci_skip_host_reset, int, 0444); | ||
54 | MODULE_PARM_DESC(skip_host_reset, "skip global host reset (0=don't skip, 1=skip)"); | ||
55 | |||
52 | static int ahci_enable_alpm(struct ata_port *ap, | 56 | static int ahci_enable_alpm(struct ata_port *ap, |
53 | enum link_pm policy); | 57 | enum link_pm policy); |
54 | static void ahci_disable_alpm(struct ata_port *ap); | 58 | static void ahci_disable_alpm(struct ata_port *ap); |
@@ -429,6 +433,7 @@ static const struct ata_port_info ahci_port_info[] = { | |||
429 | /* board_ahci_sb600 */ | 433 | /* board_ahci_sb600 */ |
430 | { | 434 | { |
431 | AHCI_HFLAGS (AHCI_HFLAG_IGN_SERR_INTERNAL | | 435 | AHCI_HFLAGS (AHCI_HFLAG_IGN_SERR_INTERNAL | |
436 | AHCI_HFLAG_32BIT_ONLY | | ||
432 | AHCI_HFLAG_SECT255 | AHCI_HFLAG_NO_PMP), | 437 | AHCI_HFLAG_SECT255 | AHCI_HFLAG_NO_PMP), |
433 | .flags = AHCI_FLAG_COMMON, | 438 | .flags = AHCI_FLAG_COMMON, |
434 | .link_flags = AHCI_LFLAG_COMMON, | 439 | .link_flags = AHCI_LFLAG_COMMON, |
@@ -587,6 +592,7 @@ static const struct pci_device_id ahci_pci_tbl[] = { | |||
587 | 592 | ||
588 | /* Marvell */ | 593 | /* Marvell */ |
589 | { PCI_VDEVICE(MARVELL, 0x6145), board_ahci_mv }, /* 6145 */ | 594 | { PCI_VDEVICE(MARVELL, 0x6145), board_ahci_mv }, /* 6145 */ |
595 | { PCI_VDEVICE(MARVELL, 0x6121), board_ahci_mv }, /* 6121 */ | ||
590 | 596 | ||
591 | /* Generic, PCI class code for AHCI */ | 597 | /* Generic, PCI class code for AHCI */ |
592 | { PCI_ANY_ID, PCI_ANY_ID, PCI_ANY_ID, PCI_ANY_ID, | 598 | { PCI_ANY_ID, PCI_ANY_ID, PCI_ANY_ID, PCI_ANY_ID, |
@@ -661,6 +667,7 @@ static void ahci_save_initial_config(struct pci_dev *pdev, | |||
661 | void __iomem *mmio = pcim_iomap_table(pdev)[AHCI_PCI_BAR]; | 667 | void __iomem *mmio = pcim_iomap_table(pdev)[AHCI_PCI_BAR]; |
662 | u32 cap, port_map; | 668 | u32 cap, port_map; |
663 | int i; | 669 | int i; |
670 | int mv; | ||
664 | 671 | ||
665 | /* make sure AHCI mode is enabled before accessing CAP */ | 672 | /* make sure AHCI mode is enabled before accessing CAP */ |
666 | ahci_enable_ahci(mmio); | 673 | ahci_enable_ahci(mmio); |
@@ -696,12 +703,16 @@ static void ahci_save_initial_config(struct pci_dev *pdev, | |||
696 | * presence register, as bit 4 (counting from 0) | 703 | * presence register, as bit 4 (counting from 0) |
697 | */ | 704 | */ |
698 | if (hpriv->flags & AHCI_HFLAG_MV_PATA) { | 705 | if (hpriv->flags & AHCI_HFLAG_MV_PATA) { |
706 | if (pdev->device == 0x6121) | ||
707 | mv = 0x3; | ||
708 | else | ||
709 | mv = 0xf; | ||
699 | dev_printk(KERN_ERR, &pdev->dev, | 710 | dev_printk(KERN_ERR, &pdev->dev, |
700 | "MV_AHCI HACK: port_map %x -> %x\n", | 711 | "MV_AHCI HACK: port_map %x -> %x\n", |
701 | hpriv->port_map, | 712 | port_map, |
702 | hpriv->port_map & 0xf); | 713 | port_map & mv); |
703 | 714 | ||
704 | port_map &= 0xf; | 715 | port_map &= mv; |
705 | } | 716 | } |
706 | 717 | ||
707 | /* cross check port_map and cap.n_ports */ | 718 | /* cross check port_map and cap.n_ports */ |
@@ -1088,29 +1099,35 @@ static int ahci_reset_controller(struct ata_host *host) | |||
1088 | ahci_enable_ahci(mmio); | 1099 | ahci_enable_ahci(mmio); |
1089 | 1100 | ||
1090 | /* global controller reset */ | 1101 | /* global controller reset */ |
1091 | tmp = readl(mmio + HOST_CTL); | 1102 | if (!ahci_skip_host_reset) { |
1092 | if ((tmp & HOST_RESET) == 0) { | 1103 | tmp = readl(mmio + HOST_CTL); |
1093 | writel(tmp | HOST_RESET, mmio + HOST_CTL); | 1104 | if ((tmp & HOST_RESET) == 0) { |
1094 | readl(mmio + HOST_CTL); /* flush */ | 1105 | writel(tmp | HOST_RESET, mmio + HOST_CTL); |
1095 | } | 1106 | readl(mmio + HOST_CTL); /* flush */ |
1107 | } | ||
1096 | 1108 | ||
1097 | /* reset must complete within 1 second, or | 1109 | /* reset must complete within 1 second, or |
1098 | * the hardware should be considered fried. | 1110 | * the hardware should be considered fried. |
1099 | */ | 1111 | */ |
1100 | ssleep(1); | 1112 | ssleep(1); |
1101 | 1113 | ||
1102 | tmp = readl(mmio + HOST_CTL); | 1114 | tmp = readl(mmio + HOST_CTL); |
1103 | if (tmp & HOST_RESET) { | 1115 | if (tmp & HOST_RESET) { |
1104 | dev_printk(KERN_ERR, host->dev, | 1116 | dev_printk(KERN_ERR, host->dev, |
1105 | "controller reset failed (0x%x)\n", tmp); | 1117 | "controller reset failed (0x%x)\n", tmp); |
1106 | return -EIO; | 1118 | return -EIO; |
1107 | } | 1119 | } |
1108 | 1120 | ||
1109 | /* turn on AHCI mode */ | 1121 | /* turn on AHCI mode */ |
1110 | ahci_enable_ahci(mmio); | 1122 | ahci_enable_ahci(mmio); |
1111 | 1123 | ||
1112 | /* some registers might be cleared on reset. restore initial values */ | 1124 | /* Some registers might be cleared on reset. Restore |
1113 | ahci_restore_initial_config(host); | 1125 | * initial values. |
1126 | */ | ||
1127 | ahci_restore_initial_config(host); | ||
1128 | } else | ||
1129 | dev_printk(KERN_INFO, host->dev, | ||
1130 | "skipping global host reset\n"); | ||
1114 | 1131 | ||
1115 | if (pdev->vendor == PCI_VENDOR_ID_INTEL) { | 1132 | if (pdev->vendor == PCI_VENDOR_ID_INTEL) { |
1116 | u16 tmp16; | 1133 | u16 tmp16; |
@@ -1162,9 +1179,14 @@ static void ahci_init_controller(struct ata_host *host) | |||
1162 | int i; | 1179 | int i; |
1163 | void __iomem *port_mmio; | 1180 | void __iomem *port_mmio; |
1164 | u32 tmp; | 1181 | u32 tmp; |
1182 | int mv; | ||
1165 | 1183 | ||
1166 | if (hpriv->flags & AHCI_HFLAG_MV_PATA) { | 1184 | if (hpriv->flags & AHCI_HFLAG_MV_PATA) { |
1167 | port_mmio = __ahci_port_base(host, 4); | 1185 | if (pdev->device == 0x6121) |
1186 | mv = 2; | ||
1187 | else | ||
1188 | mv = 4; | ||
1189 | port_mmio = __ahci_port_base(host, mv); | ||
1168 | 1190 | ||
1169 | writel(0, port_mmio + PORT_IRQ_MASK); | 1191 | writel(0, port_mmio + PORT_IRQ_MASK); |
1170 | 1192 | ||
@@ -1196,8 +1218,11 @@ static void ahci_dev_config(struct ata_device *dev) | |||
1196 | { | 1218 | { |
1197 | struct ahci_host_priv *hpriv = dev->link->ap->host->private_data; | 1219 | struct ahci_host_priv *hpriv = dev->link->ap->host->private_data; |
1198 | 1220 | ||
1199 | if (hpriv->flags & AHCI_HFLAG_SECT255) | 1221 | if (hpriv->flags & AHCI_HFLAG_SECT255) { |
1200 | dev->max_sectors = 255; | 1222 | dev->max_sectors = 255; |
1223 | ata_dev_printk(dev, KERN_INFO, | ||
1224 | "SB600 AHCI: limiting to 255 sectors per cmd\n"); | ||
1225 | } | ||
1201 | } | 1226 | } |
1202 | 1227 | ||
1203 | static unsigned int ahci_dev_classify(struct ata_port *ap) | 1228 | static unsigned int ahci_dev_classify(struct ata_port *ap) |
@@ -2241,7 +2266,10 @@ static int ahci_init_one(struct pci_dev *pdev, const struct pci_device_id *ent) | |||
2241 | if (rc) | 2266 | if (rc) |
2242 | return rc; | 2267 | return rc; |
2243 | 2268 | ||
2244 | rc = pcim_iomap_regions(pdev, 1 << AHCI_PCI_BAR, DRV_NAME); | 2269 | /* AHCI controllers often implement SFF compatible interface. |
2270 | * Grab all PCI BARs just in case. | ||
2271 | */ | ||
2272 | rc = pcim_iomap_regions_request_all(pdev, 1 << AHCI_PCI_BAR, DRV_NAME); | ||
2245 | if (rc == -EBUSY) | 2273 | if (rc == -EBUSY) |
2246 | pcim_pin_device(pdev); | 2274 | pcim_pin_device(pdev); |
2247 | if (rc) | 2275 | if (rc) |
diff --git a/drivers/ata/libata-acpi.c b/drivers/ata/libata-acpi.c index 0770cb7391a4..bf98a566adac 100644 --- a/drivers/ata/libata-acpi.c +++ b/drivers/ata/libata-acpi.c | |||
@@ -118,45 +118,77 @@ static void ata_acpi_associate_ide_port(struct ata_port *ap) | |||
118 | ap->pflags |= ATA_PFLAG_INIT_GTM_VALID; | 118 | ap->pflags |= ATA_PFLAG_INIT_GTM_VALID; |
119 | } | 119 | } |
120 | 120 | ||
121 | static void ata_acpi_handle_hotplug(struct ata_port *ap, struct kobject *kobj, | 121 | static void ata_acpi_handle_hotplug(struct ata_port *ap, struct ata_device *dev, |
122 | u32 event) | 122 | u32 event) |
123 | { | 123 | { |
124 | char event_string[12]; | 124 | char event_string[12]; |
125 | char *envp[] = { event_string, NULL }; | 125 | char *envp[] = { event_string, NULL }; |
126 | struct ata_eh_info *ehi = &ap->link.eh_info; | 126 | struct ata_eh_info *ehi; |
127 | 127 | struct kobject *kobj = NULL; | |
128 | if (event == 0 || event == 1) { | 128 | int wait = 0; |
129 | unsigned long flags; | 129 | unsigned long flags; |
130 | spin_lock_irqsave(ap->lock, flags); | 130 | |
131 | ata_ehi_clear_desc(ehi); | 131 | if (!ap) |
132 | ata_ehi_push_desc(ehi, "ACPI event"); | 132 | ap = dev->link->ap; |
133 | ata_ehi_hotplugged(ehi); | 133 | ehi = &ap->link.eh_info; |
134 | ata_port_freeze(ap); | 134 | |
135 | spin_unlock_irqrestore(ap->lock, flags); | 135 | spin_lock_irqsave(ap->lock, flags); |
136 | |||
137 | switch (event) { | ||
138 | case ACPI_NOTIFY_BUS_CHECK: | ||
139 | case ACPI_NOTIFY_DEVICE_CHECK: | ||
140 | ata_ehi_push_desc(ehi, "ACPI event"); | ||
141 | ata_ehi_hotplugged(ehi); | ||
142 | ata_port_freeze(ap); | ||
143 | break; | ||
144 | |||
145 | case ACPI_NOTIFY_EJECT_REQUEST: | ||
146 | ata_ehi_push_desc(ehi, "ACPI event"); | ||
147 | if (dev) | ||
148 | dev->flags |= ATA_DFLAG_DETACH; | ||
149 | else { | ||
150 | struct ata_link *tlink; | ||
151 | struct ata_device *tdev; | ||
152 | |||
153 | ata_port_for_each_link(tlink, ap) | ||
154 | ata_link_for_each_dev(tdev, tlink) | ||
155 | tdev->flags |= ATA_DFLAG_DETACH; | ||
156 | } | ||
157 | |||
158 | ata_port_schedule_eh(ap); | ||
159 | wait = 1; | ||
160 | break; | ||
136 | } | 161 | } |
137 | 162 | ||
163 | if (dev) { | ||
164 | if (dev->sdev) | ||
165 | kobj = &dev->sdev->sdev_gendev.kobj; | ||
166 | } else | ||
167 | kobj = &ap->dev->kobj; | ||
168 | |||
138 | if (kobj) { | 169 | if (kobj) { |
139 | sprintf(event_string, "BAY_EVENT=%d", event); | 170 | sprintf(event_string, "BAY_EVENT=%d", event); |
140 | kobject_uevent_env(kobj, KOBJ_CHANGE, envp); | 171 | kobject_uevent_env(kobj, KOBJ_CHANGE, envp); |
141 | } | 172 | } |
173 | |||
174 | spin_unlock_irqrestore(ap->lock, flags); | ||
175 | |||
176 | if (wait) | ||
177 | ata_port_wait_eh(ap); | ||
142 | } | 178 | } |
143 | 179 | ||
144 | static void ata_acpi_dev_notify(acpi_handle handle, u32 event, void *data) | 180 | static void ata_acpi_dev_notify(acpi_handle handle, u32 event, void *data) |
145 | { | 181 | { |
146 | struct ata_device *dev = data; | 182 | struct ata_device *dev = data; |
147 | struct kobject *kobj = NULL; | ||
148 | 183 | ||
149 | if (dev->sdev) | 184 | ata_acpi_handle_hotplug(NULL, dev, event); |
150 | kobj = &dev->sdev->sdev_gendev.kobj; | ||
151 | |||
152 | ata_acpi_handle_hotplug(dev->link->ap, kobj, event); | ||
153 | } | 185 | } |
154 | 186 | ||
155 | static void ata_acpi_ap_notify(acpi_handle handle, u32 event, void *data) | 187 | static void ata_acpi_ap_notify(acpi_handle handle, u32 event, void *data) |
156 | { | 188 | { |
157 | struct ata_port *ap = data; | 189 | struct ata_port *ap = data; |
158 | 190 | ||
159 | ata_acpi_handle_hotplug(ap, &ap->dev->kobj, event); | 191 | ata_acpi_handle_hotplug(ap, NULL, event); |
160 | } | 192 | } |
161 | 193 | ||
162 | /** | 194 | /** |
@@ -191,20 +223,30 @@ void ata_acpi_associate(struct ata_host *host) | |||
191 | else | 223 | else |
192 | ata_acpi_associate_ide_port(ap); | 224 | ata_acpi_associate_ide_port(ap); |
193 | 225 | ||
194 | if (ap->acpi_handle) | 226 | if (ap->acpi_handle) { |
195 | acpi_install_notify_handler (ap->acpi_handle, | 227 | acpi_install_notify_handler(ap->acpi_handle, |
196 | ACPI_SYSTEM_NOTIFY, | 228 | ACPI_SYSTEM_NOTIFY, |
197 | ata_acpi_ap_notify, | 229 | ata_acpi_ap_notify, ap); |
198 | ap); | 230 | #if defined(CONFIG_ACPI_DOCK) || defined(CONFIG_ACPI_DOCK_MODULE) |
231 | /* we might be on a docking station */ | ||
232 | register_hotplug_dock_device(ap->acpi_handle, | ||
233 | ata_acpi_ap_notify, ap); | ||
234 | #endif | ||
235 | } | ||
199 | 236 | ||
200 | for (j = 0; j < ata_link_max_devices(&ap->link); j++) { | 237 | for (j = 0; j < ata_link_max_devices(&ap->link); j++) { |
201 | struct ata_device *dev = &ap->link.device[j]; | 238 | struct ata_device *dev = &ap->link.device[j]; |
202 | 239 | ||
203 | if (dev->acpi_handle) | 240 | if (dev->acpi_handle) { |
204 | acpi_install_notify_handler (dev->acpi_handle, | 241 | acpi_install_notify_handler(dev->acpi_handle, |
205 | ACPI_SYSTEM_NOTIFY, | 242 | ACPI_SYSTEM_NOTIFY, |
206 | ata_acpi_dev_notify, | 243 | ata_acpi_dev_notify, dev); |
207 | dev); | 244 | #if defined(CONFIG_ACPI_DOCK) || defined(CONFIG_ACPI_DOCK_MODULE) |
245 | /* we might be on a docking station */ | ||
246 | register_hotplug_dock_device(dev->acpi_handle, | ||
247 | ata_acpi_dev_notify, dev); | ||
248 | #endif | ||
249 | } | ||
208 | } | 250 | } |
209 | } | 251 | } |
210 | } | 252 | } |
diff --git a/drivers/ata/libata-core.c b/drivers/ata/libata-core.c index 4bbe31f98ef8..c4248b37ff64 100644 --- a/drivers/ata/libata-core.c +++ b/drivers/ata/libata-core.c | |||
@@ -1416,12 +1416,12 @@ static int ata_hpa_resize(struct ata_device *dev) | |||
1416 | /* read native max address */ | 1416 | /* read native max address */ |
1417 | rc = ata_read_native_max_address(dev, &native_sectors); | 1417 | rc = ata_read_native_max_address(dev, &native_sectors); |
1418 | if (rc) { | 1418 | if (rc) { |
1419 | /* If HPA isn't going to be unlocked, skip HPA | 1419 | /* If device aborted the command or HPA isn't going to |
1420 | * resizing from the next try. | 1420 | * be unlocked, skip HPA resizing. |
1421 | */ | 1421 | */ |
1422 | if (!ata_ignore_hpa) { | 1422 | if (rc == -EACCES || !ata_ignore_hpa) { |
1423 | ata_dev_printk(dev, KERN_WARNING, "HPA support seems " | 1423 | ata_dev_printk(dev, KERN_WARNING, "HPA support seems " |
1424 | "broken, will skip HPA handling\n"); | 1424 | "broken, skipping HPA handling\n"); |
1425 | dev->horkage |= ATA_HORKAGE_BROKEN_HPA; | 1425 | dev->horkage |= ATA_HORKAGE_BROKEN_HPA; |
1426 | 1426 | ||
1427 | /* we can continue if device aborted the command */ | 1427 | /* we can continue if device aborted the command */ |
@@ -2092,24 +2092,34 @@ int ata_dev_read_id(struct ata_device *dev, unsigned int *p_class, | |||
2092 | id, sizeof(id[0]) * ATA_ID_WORDS, 0); | 2092 | id, sizeof(id[0]) * ATA_ID_WORDS, 0); |
2093 | if (err_mask) { | 2093 | if (err_mask) { |
2094 | if (err_mask & AC_ERR_NODEV_HINT) { | 2094 | if (err_mask & AC_ERR_NODEV_HINT) { |
2095 | DPRINTK("ata%u.%d: NODEV after polling detection\n", | 2095 | ata_dev_printk(dev, KERN_DEBUG, |
2096 | ap->print_id, dev->devno); | 2096 | "NODEV after polling detection\n"); |
2097 | return -ENOENT; | 2097 | return -ENOENT; |
2098 | } | 2098 | } |
2099 | 2099 | ||
2100 | /* Device or controller might have reported the wrong | 2100 | if ((err_mask == AC_ERR_DEV) && (tf.feature & ATA_ABORTED)) { |
2101 | * device class. Give a shot at the other IDENTIFY if | 2101 | /* Device or controller might have reported |
2102 | * the current one is aborted by the device. | 2102 | * the wrong device class. Give a shot at the |
2103 | */ | 2103 | * other IDENTIFY if the current one is |
2104 | if (may_fallback && | 2104 | * aborted by the device. |
2105 | (err_mask == AC_ERR_DEV) && (tf.feature & ATA_ABORTED)) { | 2105 | */ |
2106 | may_fallback = 0; | 2106 | if (may_fallback) { |
2107 | may_fallback = 0; | ||
2107 | 2108 | ||
2108 | if (class == ATA_DEV_ATA) | 2109 | if (class == ATA_DEV_ATA) |
2109 | class = ATA_DEV_ATAPI; | 2110 | class = ATA_DEV_ATAPI; |
2110 | else | 2111 | else |
2111 | class = ATA_DEV_ATA; | 2112 | class = ATA_DEV_ATA; |
2112 | goto retry; | 2113 | goto retry; |
2114 | } | ||
2115 | |||
2116 | /* Control reaches here iff the device aborted | ||
2117 | * both flavors of IDENTIFYs which happens | ||
2118 | * sometimes with phantom devices. | ||
2119 | */ | ||
2120 | ata_dev_printk(dev, KERN_DEBUG, | ||
2121 | "both IDENTIFYs aborted, assuming NODEV\n"); | ||
2122 | return -ENOENT; | ||
2113 | } | 2123 | } |
2114 | 2124 | ||
2115 | rc = -EIO; | 2125 | rc = -EIO; |
diff --git a/drivers/ata/libata-scsi.c b/drivers/ata/libata-scsi.c index 8f0e8f2bc628..15795394b0a8 100644 --- a/drivers/ata/libata-scsi.c +++ b/drivers/ata/libata-scsi.c | |||
@@ -527,6 +527,14 @@ static struct ata_queued_cmd *ata_scsi_qc_new(struct ata_device *dev, | |||
527 | return qc; | 527 | return qc; |
528 | } | 528 | } |
529 | 529 | ||
530 | static void ata_qc_set_pc_nbytes(struct ata_queued_cmd *qc) | ||
531 | { | ||
532 | struct scsi_cmnd *scmd = qc->scsicmd; | ||
533 | |||
534 | qc->extrabytes = scmd->request->extra_len; | ||
535 | qc->nbytes = scsi_bufflen(scmd) + qc->extrabytes; | ||
536 | } | ||
537 | |||
530 | /** | 538 | /** |
531 | * ata_dump_status - user friendly display of error info | 539 | * ata_dump_status - user friendly display of error info |
532 | * @id: id of the port in question | 540 | * @id: id of the port in question |
@@ -2539,7 +2547,7 @@ static unsigned int atapi_xlat(struct ata_queued_cmd *qc) | |||
2539 | } | 2547 | } |
2540 | 2548 | ||
2541 | qc->tf.command = ATA_CMD_PACKET; | 2549 | qc->tf.command = ATA_CMD_PACKET; |
2542 | qc->nbytes = scsi_bufflen(scmd) + scmd->request->extra_len; | 2550 | ata_qc_set_pc_nbytes(qc); |
2543 | 2551 | ||
2544 | /* check whether ATAPI DMA is safe */ | 2552 | /* check whether ATAPI DMA is safe */ |
2545 | if (!using_pio && ata_check_atapi_dma(qc)) | 2553 | if (!using_pio && ata_check_atapi_dma(qc)) |
@@ -2550,7 +2558,7 @@ static unsigned int atapi_xlat(struct ata_queued_cmd *qc) | |||
2550 | * want to set it properly, and for DMA where it is | 2558 | * want to set it properly, and for DMA where it is |
2551 | * effectively meaningless. | 2559 | * effectively meaningless. |
2552 | */ | 2560 | */ |
2553 | nbytes = min(scmd->request->data_len, (unsigned int)63 * 1024); | 2561 | nbytes = min(ata_qc_raw_nbytes(qc), (unsigned int)63 * 1024); |
2554 | 2562 | ||
2555 | /* Most ATAPI devices which honor transfer chunk size don't | 2563 | /* Most ATAPI devices which honor transfer chunk size don't |
2556 | * behave according to the spec when odd chunk size which | 2564 | * behave according to the spec when odd chunk size which |
@@ -2876,7 +2884,7 @@ static unsigned int ata_scsi_pass_thru(struct ata_queued_cmd *qc) | |||
2876 | * TODO: find out if we need to do more here to | 2884 | * TODO: find out if we need to do more here to |
2877 | * cover scatter/gather case. | 2885 | * cover scatter/gather case. |
2878 | */ | 2886 | */ |
2879 | qc->nbytes = scsi_bufflen(scmd) + scmd->request->extra_len; | 2887 | ata_qc_set_pc_nbytes(qc); |
2880 | 2888 | ||
2881 | /* request result TF and be quiet about device error */ | 2889 | /* request result TF and be quiet about device error */ |
2882 | qc->flags |= ATA_QCFLAG_RESULT_TF | ATA_QCFLAG_QUIET; | 2890 | qc->flags |= ATA_QCFLAG_RESULT_TF | ATA_QCFLAG_QUIET; |
diff --git a/drivers/ata/pata_ali.c b/drivers/ata/pata_ali.c index 7e68edf3c0f3..8786455c901d 100644 --- a/drivers/ata/pata_ali.c +++ b/drivers/ata/pata_ali.c | |||
@@ -295,7 +295,7 @@ static void ali_lock_sectors(struct ata_device *adev) | |||
295 | static int ali_check_atapi_dma(struct ata_queued_cmd *qc) | 295 | static int ali_check_atapi_dma(struct ata_queued_cmd *qc) |
296 | { | 296 | { |
297 | /* If its not a media command, its not worth it */ | 297 | /* If its not a media command, its not worth it */ |
298 | if (qc->nbytes < 2048) | 298 | if (atapi_cmd_type(qc->cdb[0]) == ATAPI_MISC) |
299 | return -EOPNOTSUPP; | 299 | return -EOPNOTSUPP; |
300 | return 0; | 300 | return 0; |
301 | } | 301 | } |
diff --git a/drivers/ata/pata_it821x.c b/drivers/ata/pata_it821x.c index 109ddd42c266..257951d03dbb 100644 --- a/drivers/ata/pata_it821x.c +++ b/drivers/ata/pata_it821x.c | |||
@@ -564,7 +564,7 @@ static int it821x_check_atapi_dma(struct ata_queued_cmd *qc) | |||
564 | struct it821x_dev *itdev = ap->private_data; | 564 | struct it821x_dev *itdev = ap->private_data; |
565 | 565 | ||
566 | /* Only use dma for transfers to/from the media. */ | 566 | /* Only use dma for transfers to/from the media. */ |
567 | if (qc->nbytes < 2048) | 567 | if (ata_qc_raw_nbytes(qc) < 2048) |
568 | return -EOPNOTSUPP; | 568 | return -EOPNOTSUPP; |
569 | 569 | ||
570 | /* No ATAPI DMA in smart mode */ | 570 | /* No ATAPI DMA in smart mode */ |
diff --git a/drivers/ata/sata_promise.c b/drivers/ata/sata_promise.c index f251a5f569d5..11c1afea2db2 100644 --- a/drivers/ata/sata_promise.c +++ b/drivers/ata/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 "2.11" | 49 | #define DRV_VERSION "2.12" |
50 | 50 | ||
51 | enum { | 51 | enum { |
52 | PDC_MAX_PORTS = 4, | 52 | PDC_MAX_PORTS = 4, |
@@ -145,7 +145,9 @@ static int pdc_old_sata_check_atapi_dma(struct ata_queued_cmd *qc); | |||
145 | static void pdc_irq_clear(struct ata_port *ap); | 145 | static void pdc_irq_clear(struct ata_port *ap); |
146 | static unsigned int pdc_qc_issue_prot(struct ata_queued_cmd *qc); | 146 | static unsigned int pdc_qc_issue_prot(struct ata_queued_cmd *qc); |
147 | static void pdc_freeze(struct ata_port *ap); | 147 | static void pdc_freeze(struct ata_port *ap); |
148 | static void pdc_sata_freeze(struct ata_port *ap); | ||
148 | static void pdc_thaw(struct ata_port *ap); | 149 | static void pdc_thaw(struct ata_port *ap); |
150 | static void pdc_sata_thaw(struct ata_port *ap); | ||
149 | static void pdc_pata_error_handler(struct ata_port *ap); | 151 | static void pdc_pata_error_handler(struct ata_port *ap); |
150 | static void pdc_sata_error_handler(struct ata_port *ap); | 152 | static void pdc_sata_error_handler(struct ata_port *ap); |
151 | static void pdc_post_internal_cmd(struct ata_queued_cmd *qc); | 153 | static void pdc_post_internal_cmd(struct ata_queued_cmd *qc); |
@@ -180,8 +182,8 @@ static const struct ata_port_operations pdc_sata_ops = { | |||
180 | 182 | ||
181 | .qc_prep = pdc_qc_prep, | 183 | .qc_prep = pdc_qc_prep, |
182 | .qc_issue = pdc_qc_issue_prot, | 184 | .qc_issue = pdc_qc_issue_prot, |
183 | .freeze = pdc_freeze, | 185 | .freeze = pdc_sata_freeze, |
184 | .thaw = pdc_thaw, | 186 | .thaw = pdc_sata_thaw, |
185 | .error_handler = pdc_sata_error_handler, | 187 | .error_handler = pdc_sata_error_handler, |
186 | .post_internal_cmd = pdc_post_internal_cmd, | 188 | .post_internal_cmd = pdc_post_internal_cmd, |
187 | .cable_detect = pdc_sata_cable_detect, | 189 | .cable_detect = pdc_sata_cable_detect, |
@@ -205,8 +207,8 @@ static const struct ata_port_operations pdc_old_sata_ops = { | |||
205 | 207 | ||
206 | .qc_prep = pdc_qc_prep, | 208 | .qc_prep = pdc_qc_prep, |
207 | .qc_issue = pdc_qc_issue_prot, | 209 | .qc_issue = pdc_qc_issue_prot, |
208 | .freeze = pdc_freeze, | 210 | .freeze = pdc_sata_freeze, |
209 | .thaw = pdc_thaw, | 211 | .thaw = pdc_sata_thaw, |
210 | .error_handler = pdc_sata_error_handler, | 212 | .error_handler = pdc_sata_error_handler, |
211 | .post_internal_cmd = pdc_post_internal_cmd, | 213 | .post_internal_cmd = pdc_post_internal_cmd, |
212 | .cable_detect = pdc_sata_cable_detect, | 214 | .cable_detect = pdc_sata_cable_detect, |
@@ -631,6 +633,41 @@ static void pdc_qc_prep(struct ata_queued_cmd *qc) | |||
631 | } | 633 | } |
632 | } | 634 | } |
633 | 635 | ||
636 | static int pdc_is_sataii_tx4(unsigned long flags) | ||
637 | { | ||
638 | const unsigned long mask = PDC_FLAG_GEN_II | PDC_FLAG_4_PORTS; | ||
639 | return (flags & mask) == mask; | ||
640 | } | ||
641 | |||
642 | static unsigned int pdc_port_no_to_ata_no(unsigned int port_no, | ||
643 | int is_sataii_tx4) | ||
644 | { | ||
645 | static const unsigned char sataii_tx4_port_remap[4] = { 3, 1, 0, 2}; | ||
646 | return is_sataii_tx4 ? sataii_tx4_port_remap[port_no] : port_no; | ||
647 | } | ||
648 | |||
649 | static unsigned int pdc_sata_nr_ports(const struct ata_port *ap) | ||
650 | { | ||
651 | return (ap->flags & PDC_FLAG_4_PORTS) ? 4 : 2; | ||
652 | } | ||
653 | |||
654 | static unsigned int pdc_sata_ata_port_to_ata_no(const struct ata_port *ap) | ||
655 | { | ||
656 | const struct ata_host *host = ap->host; | ||
657 | unsigned int nr_ports = pdc_sata_nr_ports(ap); | ||
658 | unsigned int i; | ||
659 | |||
660 | for(i = 0; i < nr_ports && host->ports[i] != ap; ++i) | ||
661 | ; | ||
662 | BUG_ON(i >= nr_ports); | ||
663 | return pdc_port_no_to_ata_no(i, pdc_is_sataii_tx4(ap->flags)); | ||
664 | } | ||
665 | |||
666 | static unsigned int pdc_sata_hotplug_offset(const struct ata_port *ap) | ||
667 | { | ||
668 | return (ap->flags & PDC_FLAG_GEN_II) ? PDC2_SATA_PLUG_CSR : PDC_SATA_PLUG_CSR; | ||
669 | } | ||
670 | |||
634 | static void pdc_freeze(struct ata_port *ap) | 671 | static void pdc_freeze(struct ata_port *ap) |
635 | { | 672 | { |
636 | void __iomem *mmio = ap->ioaddr.cmd_addr; | 673 | void __iomem *mmio = ap->ioaddr.cmd_addr; |
@@ -643,6 +680,29 @@ static void pdc_freeze(struct ata_port *ap) | |||
643 | readl(mmio + PDC_CTLSTAT); /* flush */ | 680 | readl(mmio + PDC_CTLSTAT); /* flush */ |
644 | } | 681 | } |
645 | 682 | ||
683 | static void pdc_sata_freeze(struct ata_port *ap) | ||
684 | { | ||
685 | struct ata_host *host = ap->host; | ||
686 | void __iomem *host_mmio = host->iomap[PDC_MMIO_BAR]; | ||
687 | unsigned int hotplug_offset = pdc_sata_hotplug_offset(ap); | ||
688 | unsigned int ata_no = pdc_sata_ata_port_to_ata_no(ap); | ||
689 | u32 hotplug_status; | ||
690 | |||
691 | /* Disable hotplug events on this port. | ||
692 | * | ||
693 | * Locking: | ||
694 | * 1) hotplug register accesses must be serialised via host->lock | ||
695 | * 2) ap->lock == &ap->host->lock | ||
696 | * 3) ->freeze() and ->thaw() are called with ap->lock held | ||
697 | */ | ||
698 | hotplug_status = readl(host_mmio + hotplug_offset); | ||
699 | hotplug_status |= 0x11 << (ata_no + 16); | ||
700 | writel(hotplug_status, host_mmio + hotplug_offset); | ||
701 | readl(host_mmio + hotplug_offset); /* flush */ | ||
702 | |||
703 | pdc_freeze(ap); | ||
704 | } | ||
705 | |||
646 | static void pdc_thaw(struct ata_port *ap) | 706 | static void pdc_thaw(struct ata_port *ap) |
647 | { | 707 | { |
648 | void __iomem *mmio = ap->ioaddr.cmd_addr; | 708 | void __iomem *mmio = ap->ioaddr.cmd_addr; |
@@ -658,6 +718,26 @@ static void pdc_thaw(struct ata_port *ap) | |||
658 | readl(mmio + PDC_CTLSTAT); /* flush */ | 718 | readl(mmio + PDC_CTLSTAT); /* flush */ |
659 | } | 719 | } |
660 | 720 | ||
721 | static void pdc_sata_thaw(struct ata_port *ap) | ||
722 | { | ||
723 | struct ata_host *host = ap->host; | ||
724 | void __iomem *host_mmio = host->iomap[PDC_MMIO_BAR]; | ||
725 | unsigned int hotplug_offset = pdc_sata_hotplug_offset(ap); | ||
726 | unsigned int ata_no = pdc_sata_ata_port_to_ata_no(ap); | ||
727 | u32 hotplug_status; | ||
728 | |||
729 | pdc_thaw(ap); | ||
730 | |||
731 | /* Enable hotplug events on this port. | ||
732 | * Locking: see pdc_sata_freeze(). | ||
733 | */ | ||
734 | hotplug_status = readl(host_mmio + hotplug_offset); | ||
735 | hotplug_status |= 0x11 << ata_no; | ||
736 | hotplug_status &= ~(0x11 << (ata_no + 16)); | ||
737 | writel(hotplug_status, host_mmio + hotplug_offset); | ||
738 | readl(host_mmio + hotplug_offset); /* flush */ | ||
739 | } | ||
740 | |||
661 | static void pdc_common_error_handler(struct ata_port *ap, ata_reset_fn_t hardreset) | 741 | static void pdc_common_error_handler(struct ata_port *ap, ata_reset_fn_t hardreset) |
662 | { | 742 | { |
663 | if (!(ap->pflags & ATA_PFLAG_FROZEN)) | 743 | if (!(ap->pflags & ATA_PFLAG_FROZEN)) |
@@ -765,19 +845,6 @@ static void pdc_irq_clear(struct ata_port *ap) | |||
765 | readl(mmio + PDC_INT_SEQMASK); | 845 | readl(mmio + PDC_INT_SEQMASK); |
766 | } | 846 | } |
767 | 847 | ||
768 | static int pdc_is_sataii_tx4(unsigned long flags) | ||
769 | { | ||
770 | const unsigned long mask = PDC_FLAG_GEN_II | PDC_FLAG_4_PORTS; | ||
771 | return (flags & mask) == mask; | ||
772 | } | ||
773 | |||
774 | static unsigned int pdc_port_no_to_ata_no(unsigned int port_no, | ||
775 | int is_sataii_tx4) | ||
776 | { | ||
777 | static const unsigned char sataii_tx4_port_remap[4] = { 3, 1, 0, 2}; | ||
778 | return is_sataii_tx4 ? sataii_tx4_port_remap[port_no] : port_no; | ||
779 | } | ||
780 | |||
781 | static irqreturn_t pdc_interrupt(int irq, void *dev_instance) | 848 | static irqreturn_t pdc_interrupt(int irq, void *dev_instance) |
782 | { | 849 | { |
783 | struct ata_host *host = dev_instance; | 850 | struct ata_host *host = dev_instance; |
@@ -799,6 +866,8 @@ static irqreturn_t pdc_interrupt(int irq, void *dev_instance) | |||
799 | 866 | ||
800 | mmio_base = host->iomap[PDC_MMIO_BAR]; | 867 | mmio_base = host->iomap[PDC_MMIO_BAR]; |
801 | 868 | ||
869 | spin_lock(&host->lock); | ||
870 | |||
802 | /* read and clear hotplug flags for all ports */ | 871 | /* read and clear hotplug flags for all ports */ |
803 | if (host->ports[0]->flags & PDC_FLAG_GEN_II) | 872 | if (host->ports[0]->flags & PDC_FLAG_GEN_II) |
804 | hotplug_offset = PDC2_SATA_PLUG_CSR; | 873 | hotplug_offset = PDC2_SATA_PLUG_CSR; |
@@ -814,11 +883,9 @@ static irqreturn_t pdc_interrupt(int irq, void *dev_instance) | |||
814 | 883 | ||
815 | if (mask == 0xffffffff && hotplug_status == 0) { | 884 | if (mask == 0xffffffff && hotplug_status == 0) { |
816 | VPRINTK("QUICK EXIT 2\n"); | 885 | VPRINTK("QUICK EXIT 2\n"); |
817 | return IRQ_NONE; | 886 | goto done_irq; |
818 | } | 887 | } |
819 | 888 | ||
820 | spin_lock(&host->lock); | ||
821 | |||
822 | mask &= 0xffff; /* only 16 tags possible */ | 889 | mask &= 0xffff; /* only 16 tags possible */ |
823 | if (mask == 0 && hotplug_status == 0) { | 890 | if (mask == 0 && hotplug_status == 0) { |
824 | VPRINTK("QUICK EXIT 3\n"); | 891 | VPRINTK("QUICK EXIT 3\n"); |
diff --git a/drivers/atm/fore200e.c b/drivers/atm/fore200e.c index 9427a61f62b0..432181ed7bb5 100644 --- a/drivers/atm/fore200e.c +++ b/drivers/atm/fore200e.c | |||
@@ -1988,19 +1988,19 @@ fore200e_fetch_stats(struct fore200e* fore200e, struct sonet_stats __user *arg) | |||
1988 | if (fore200e_getstats(fore200e) < 0) | 1988 | if (fore200e_getstats(fore200e) < 0) |
1989 | return -EIO; | 1989 | return -EIO; |
1990 | 1990 | ||
1991 | tmp.section_bip = cpu_to_be32(fore200e->stats->oc3.section_bip8_errors); | 1991 | tmp.section_bip = be32_to_cpu(fore200e->stats->oc3.section_bip8_errors); |
1992 | tmp.line_bip = cpu_to_be32(fore200e->stats->oc3.line_bip24_errors); | 1992 | tmp.line_bip = be32_to_cpu(fore200e->stats->oc3.line_bip24_errors); |
1993 | tmp.path_bip = cpu_to_be32(fore200e->stats->oc3.path_bip8_errors); | 1993 | tmp.path_bip = be32_to_cpu(fore200e->stats->oc3.path_bip8_errors); |
1994 | tmp.line_febe = cpu_to_be32(fore200e->stats->oc3.line_febe_errors); | 1994 | tmp.line_febe = be32_to_cpu(fore200e->stats->oc3.line_febe_errors); |
1995 | tmp.path_febe = cpu_to_be32(fore200e->stats->oc3.path_febe_errors); | 1995 | tmp.path_febe = be32_to_cpu(fore200e->stats->oc3.path_febe_errors); |
1996 | tmp.corr_hcs = cpu_to_be32(fore200e->stats->oc3.corr_hcs_errors); | 1996 | tmp.corr_hcs = be32_to_cpu(fore200e->stats->oc3.corr_hcs_errors); |
1997 | tmp.uncorr_hcs = cpu_to_be32(fore200e->stats->oc3.ucorr_hcs_errors); | 1997 | tmp.uncorr_hcs = be32_to_cpu(fore200e->stats->oc3.ucorr_hcs_errors); |
1998 | tmp.tx_cells = cpu_to_be32(fore200e->stats->aal0.cells_transmitted) + | 1998 | tmp.tx_cells = be32_to_cpu(fore200e->stats->aal0.cells_transmitted) + |
1999 | cpu_to_be32(fore200e->stats->aal34.cells_transmitted) + | 1999 | be32_to_cpu(fore200e->stats->aal34.cells_transmitted) + |
2000 | cpu_to_be32(fore200e->stats->aal5.cells_transmitted); | 2000 | be32_to_cpu(fore200e->stats->aal5.cells_transmitted); |
2001 | tmp.rx_cells = cpu_to_be32(fore200e->stats->aal0.cells_received) + | 2001 | tmp.rx_cells = be32_to_cpu(fore200e->stats->aal0.cells_received) + |
2002 | cpu_to_be32(fore200e->stats->aal34.cells_received) + | 2002 | be32_to_cpu(fore200e->stats->aal34.cells_received) + |
2003 | cpu_to_be32(fore200e->stats->aal5.cells_received); | 2003 | be32_to_cpu(fore200e->stats->aal5.cells_received); |
2004 | 2004 | ||
2005 | if (arg) | 2005 | if (arg) |
2006 | return copy_to_user(arg, &tmp, sizeof(struct sonet_stats)) ? -EFAULT : 0; | 2006 | return copy_to_user(arg, &tmp, sizeof(struct sonet_stats)) ? -EFAULT : 0; |
@@ -2587,7 +2587,7 @@ fore200e_start_fw(struct fore200e* fore200e) | |||
2587 | static int __devinit | 2587 | static int __devinit |
2588 | fore200e_load_fw(struct fore200e* fore200e) | 2588 | fore200e_load_fw(struct fore200e* fore200e) |
2589 | { | 2589 | { |
2590 | u32* fw_data = (u32*) fore200e->bus->fw_data; | 2590 | __le32* fw_data = (__le32*) fore200e->bus->fw_data; |
2591 | u32 fw_size = (u32) *fore200e->bus->fw_size / sizeof(u32); | 2591 | u32 fw_size = (u32) *fore200e->bus->fw_size / sizeof(u32); |
2592 | 2592 | ||
2593 | struct fw_header* fw_header = (struct fw_header*) fw_data; | 2593 | struct fw_header* fw_header = (struct fw_header*) fw_data; |
@@ -2965,8 +2965,8 @@ fore200e_proc_read(struct atm_dev *dev, loff_t* pos, char* page) | |||
2965 | " 4b5b:\n" | 2965 | " 4b5b:\n" |
2966 | " crc_header_errors:\t\t%10u\n" | 2966 | " crc_header_errors:\t\t%10u\n" |
2967 | " framing_errors:\t\t%10u\n", | 2967 | " framing_errors:\t\t%10u\n", |
2968 | cpu_to_be32(fore200e->stats->phy.crc_header_errors), | 2968 | be32_to_cpu(fore200e->stats->phy.crc_header_errors), |
2969 | cpu_to_be32(fore200e->stats->phy.framing_errors)); | 2969 | be32_to_cpu(fore200e->stats->phy.framing_errors)); |
2970 | 2970 | ||
2971 | if (!left--) | 2971 | if (!left--) |
2972 | return sprintf(page, "\n" | 2972 | return sprintf(page, "\n" |
@@ -2978,13 +2978,13 @@ fore200e_proc_read(struct atm_dev *dev, loff_t* pos, char* page) | |||
2978 | " path_febe_errors:\t\t%10u\n" | 2978 | " path_febe_errors:\t\t%10u\n" |
2979 | " corr_hcs_errors:\t\t%10u\n" | 2979 | " corr_hcs_errors:\t\t%10u\n" |
2980 | " ucorr_hcs_errors:\t\t%10u\n", | 2980 | " ucorr_hcs_errors:\t\t%10u\n", |
2981 | cpu_to_be32(fore200e->stats->oc3.section_bip8_errors), | 2981 | be32_to_cpu(fore200e->stats->oc3.section_bip8_errors), |
2982 | cpu_to_be32(fore200e->stats->oc3.path_bip8_errors), | 2982 | be32_to_cpu(fore200e->stats->oc3.path_bip8_errors), |
2983 | cpu_to_be32(fore200e->stats->oc3.line_bip24_errors), | 2983 | be32_to_cpu(fore200e->stats->oc3.line_bip24_errors), |
2984 | cpu_to_be32(fore200e->stats->oc3.line_febe_errors), | 2984 | be32_to_cpu(fore200e->stats->oc3.line_febe_errors), |
2985 | cpu_to_be32(fore200e->stats->oc3.path_febe_errors), | 2985 | be32_to_cpu(fore200e->stats->oc3.path_febe_errors), |
2986 | cpu_to_be32(fore200e->stats->oc3.corr_hcs_errors), | 2986 | be32_to_cpu(fore200e->stats->oc3.corr_hcs_errors), |
2987 | cpu_to_be32(fore200e->stats->oc3.ucorr_hcs_errors)); | 2987 | be32_to_cpu(fore200e->stats->oc3.ucorr_hcs_errors)); |
2988 | 2988 | ||
2989 | if (!left--) | 2989 | if (!left--) |
2990 | return sprintf(page,"\n" | 2990 | return sprintf(page,"\n" |
@@ -2995,12 +2995,12 @@ fore200e_proc_read(struct atm_dev *dev, loff_t* pos, char* page) | |||
2995 | " vpi no conn:\t\t%10u\n" | 2995 | " vpi no conn:\t\t%10u\n" |
2996 | " vci out of range:\t\t%10u\n" | 2996 | " vci out of range:\t\t%10u\n" |
2997 | " vci no conn:\t\t%10u\n", | 2997 | " vci no conn:\t\t%10u\n", |
2998 | cpu_to_be32(fore200e->stats->atm.cells_transmitted), | 2998 | be32_to_cpu(fore200e->stats->atm.cells_transmitted), |
2999 | cpu_to_be32(fore200e->stats->atm.cells_received), | 2999 | be32_to_cpu(fore200e->stats->atm.cells_received), |
3000 | cpu_to_be32(fore200e->stats->atm.vpi_bad_range), | 3000 | be32_to_cpu(fore200e->stats->atm.vpi_bad_range), |
3001 | cpu_to_be32(fore200e->stats->atm.vpi_no_conn), | 3001 | be32_to_cpu(fore200e->stats->atm.vpi_no_conn), |
3002 | cpu_to_be32(fore200e->stats->atm.vci_bad_range), | 3002 | be32_to_cpu(fore200e->stats->atm.vci_bad_range), |
3003 | cpu_to_be32(fore200e->stats->atm.vci_no_conn)); | 3003 | be32_to_cpu(fore200e->stats->atm.vci_no_conn)); |
3004 | 3004 | ||
3005 | if (!left--) | 3005 | if (!left--) |
3006 | return sprintf(page,"\n" | 3006 | return sprintf(page,"\n" |
@@ -3008,9 +3008,9 @@ fore200e_proc_read(struct atm_dev *dev, loff_t* pos, char* page) | |||
3008 | " TX:\t\t\t%10u\n" | 3008 | " TX:\t\t\t%10u\n" |
3009 | " RX:\t\t\t%10u\n" | 3009 | " RX:\t\t\t%10u\n" |
3010 | " dropped:\t\t\t%10u\n", | 3010 | " dropped:\t\t\t%10u\n", |
3011 | cpu_to_be32(fore200e->stats->aal0.cells_transmitted), | 3011 | be32_to_cpu(fore200e->stats->aal0.cells_transmitted), |
3012 | cpu_to_be32(fore200e->stats->aal0.cells_received), | 3012 | be32_to_cpu(fore200e->stats->aal0.cells_received), |
3013 | cpu_to_be32(fore200e->stats->aal0.cells_dropped)); | 3013 | be32_to_cpu(fore200e->stats->aal0.cells_dropped)); |
3014 | 3014 | ||
3015 | if (!left--) | 3015 | if (!left--) |
3016 | return sprintf(page,"\n" | 3016 | return sprintf(page,"\n" |
@@ -3026,15 +3026,15 @@ fore200e_proc_read(struct atm_dev *dev, loff_t* pos, char* page) | |||
3026 | " RX:\t\t\t%10u\n" | 3026 | " RX:\t\t\t%10u\n" |
3027 | " dropped:\t\t\t%10u\n" | 3027 | " dropped:\t\t\t%10u\n" |
3028 | " protocol errors:\t\t%10u\n", | 3028 | " protocol errors:\t\t%10u\n", |
3029 | cpu_to_be32(fore200e->stats->aal34.cells_transmitted), | 3029 | be32_to_cpu(fore200e->stats->aal34.cells_transmitted), |
3030 | cpu_to_be32(fore200e->stats->aal34.cells_received), | 3030 | be32_to_cpu(fore200e->stats->aal34.cells_received), |
3031 | cpu_to_be32(fore200e->stats->aal34.cells_dropped), | 3031 | be32_to_cpu(fore200e->stats->aal34.cells_dropped), |
3032 | cpu_to_be32(fore200e->stats->aal34.cells_crc_errors), | 3032 | be32_to_cpu(fore200e->stats->aal34.cells_crc_errors), |
3033 | cpu_to_be32(fore200e->stats->aal34.cells_protocol_errors), | 3033 | be32_to_cpu(fore200e->stats->aal34.cells_protocol_errors), |
3034 | cpu_to_be32(fore200e->stats->aal34.cspdus_transmitted), | 3034 | be32_to_cpu(fore200e->stats->aal34.cspdus_transmitted), |
3035 | cpu_to_be32(fore200e->stats->aal34.cspdus_received), | 3035 | be32_to_cpu(fore200e->stats->aal34.cspdus_received), |
3036 | cpu_to_be32(fore200e->stats->aal34.cspdus_dropped), | 3036 | be32_to_cpu(fore200e->stats->aal34.cspdus_dropped), |
3037 | cpu_to_be32(fore200e->stats->aal34.cspdus_protocol_errors)); | 3037 | be32_to_cpu(fore200e->stats->aal34.cspdus_protocol_errors)); |
3038 | 3038 | ||
3039 | if (!left--) | 3039 | if (!left--) |
3040 | return sprintf(page,"\n" | 3040 | return sprintf(page,"\n" |
@@ -3050,15 +3050,15 @@ fore200e_proc_read(struct atm_dev *dev, loff_t* pos, char* page) | |||
3050 | " dropped:\t\t\t%10u\n" | 3050 | " dropped:\t\t\t%10u\n" |
3051 | " CRC errors:\t\t%10u\n" | 3051 | " CRC errors:\t\t%10u\n" |
3052 | " protocol errors:\t\t%10u\n", | 3052 | " protocol errors:\t\t%10u\n", |
3053 | cpu_to_be32(fore200e->stats->aal5.cells_transmitted), | 3053 | be32_to_cpu(fore200e->stats->aal5.cells_transmitted), |
3054 | cpu_to_be32(fore200e->stats->aal5.cells_received), | 3054 | be32_to_cpu(fore200e->stats->aal5.cells_received), |
3055 | cpu_to_be32(fore200e->stats->aal5.cells_dropped), | 3055 | be32_to_cpu(fore200e->stats->aal5.cells_dropped), |
3056 | cpu_to_be32(fore200e->stats->aal5.congestion_experienced), | 3056 | be32_to_cpu(fore200e->stats->aal5.congestion_experienced), |
3057 | cpu_to_be32(fore200e->stats->aal5.cspdus_transmitted), | 3057 | be32_to_cpu(fore200e->stats->aal5.cspdus_transmitted), |
3058 | cpu_to_be32(fore200e->stats->aal5.cspdus_received), | 3058 | be32_to_cpu(fore200e->stats->aal5.cspdus_received), |
3059 | cpu_to_be32(fore200e->stats->aal5.cspdus_dropped), | 3059 | be32_to_cpu(fore200e->stats->aal5.cspdus_dropped), |
3060 | cpu_to_be32(fore200e->stats->aal5.cspdus_crc_errors), | 3060 | be32_to_cpu(fore200e->stats->aal5.cspdus_crc_errors), |
3061 | cpu_to_be32(fore200e->stats->aal5.cspdus_protocol_errors)); | 3061 | be32_to_cpu(fore200e->stats->aal5.cspdus_protocol_errors)); |
3062 | 3062 | ||
3063 | if (!left--) | 3063 | if (!left--) |
3064 | return sprintf(page,"\n" | 3064 | return sprintf(page,"\n" |
@@ -3069,11 +3069,11 @@ fore200e_proc_read(struct atm_dev *dev, loff_t* pos, char* page) | |||
3069 | " large b2:\t\t\t%10u\n" | 3069 | " large b2:\t\t\t%10u\n" |
3070 | " RX PDUs:\t\t\t%10u\n" | 3070 | " RX PDUs:\t\t\t%10u\n" |
3071 | " TX PDUs:\t\t\t%10lu\n", | 3071 | " TX PDUs:\t\t\t%10lu\n", |
3072 | cpu_to_be32(fore200e->stats->aux.small_b1_failed), | 3072 | be32_to_cpu(fore200e->stats->aux.small_b1_failed), |
3073 | cpu_to_be32(fore200e->stats->aux.large_b1_failed), | 3073 | be32_to_cpu(fore200e->stats->aux.large_b1_failed), |
3074 | cpu_to_be32(fore200e->stats->aux.small_b2_failed), | 3074 | be32_to_cpu(fore200e->stats->aux.small_b2_failed), |
3075 | cpu_to_be32(fore200e->stats->aux.large_b2_failed), | 3075 | be32_to_cpu(fore200e->stats->aux.large_b2_failed), |
3076 | cpu_to_be32(fore200e->stats->aux.rpd_alloc_failed), | 3076 | be32_to_cpu(fore200e->stats->aux.rpd_alloc_failed), |
3077 | fore200e->tx_sat); | 3077 | fore200e->tx_sat); |
3078 | 3078 | ||
3079 | if (!left--) | 3079 | if (!left--) |
diff --git a/drivers/atm/fore200e.h b/drivers/atm/fore200e.h index b85a54613dea..183841cc8fdf 100644 --- a/drivers/atm/fore200e.h +++ b/drivers/atm/fore200e.h | |||
@@ -349,90 +349,90 @@ typedef struct oc3_block { | |||
349 | /* physical encoding statistics */ | 349 | /* physical encoding statistics */ |
350 | 350 | ||
351 | typedef struct stats_phy { | 351 | typedef struct stats_phy { |
352 | u32 crc_header_errors; /* cells received with bad header CRC */ | 352 | __be32 crc_header_errors; /* cells received with bad header CRC */ |
353 | u32 framing_errors; /* cells received with bad framing */ | 353 | __be32 framing_errors; /* cells received with bad framing */ |
354 | u32 pad[ 2 ]; /* i960 padding */ | 354 | __be32 pad[ 2 ]; /* i960 padding */ |
355 | } stats_phy_t; | 355 | } stats_phy_t; |
356 | 356 | ||
357 | 357 | ||
358 | /* OC-3 statistics */ | 358 | /* OC-3 statistics */ |
359 | 359 | ||
360 | typedef struct stats_oc3 { | 360 | typedef struct stats_oc3 { |
361 | u32 section_bip8_errors; /* section 8 bit interleaved parity */ | 361 | __be32 section_bip8_errors; /* section 8 bit interleaved parity */ |
362 | u32 path_bip8_errors; /* path 8 bit interleaved parity */ | 362 | __be32 path_bip8_errors; /* path 8 bit interleaved parity */ |
363 | u32 line_bip24_errors; /* line 24 bit interleaved parity */ | 363 | __be32 line_bip24_errors; /* line 24 bit interleaved parity */ |
364 | u32 line_febe_errors; /* line far end block errors */ | 364 | __be32 line_febe_errors; /* line far end block errors */ |
365 | u32 path_febe_errors; /* path far end block errors */ | 365 | __be32 path_febe_errors; /* path far end block errors */ |
366 | u32 corr_hcs_errors; /* correctable header check sequence */ | 366 | __be32 corr_hcs_errors; /* correctable header check sequence */ |
367 | u32 ucorr_hcs_errors; /* uncorrectable header check sequence */ | 367 | __be32 ucorr_hcs_errors; /* uncorrectable header check sequence */ |
368 | u32 pad[ 1 ]; /* i960 padding */ | 368 | __be32 pad[ 1 ]; /* i960 padding */ |
369 | } stats_oc3_t; | 369 | } stats_oc3_t; |
370 | 370 | ||
371 | 371 | ||
372 | /* ATM statistics */ | 372 | /* ATM statistics */ |
373 | 373 | ||
374 | typedef struct stats_atm { | 374 | typedef struct stats_atm { |
375 | u32 cells_transmitted; /* cells transmitted */ | 375 | __be32 cells_transmitted; /* cells transmitted */ |
376 | u32 cells_received; /* cells received */ | 376 | __be32 cells_received; /* cells received */ |
377 | u32 vpi_bad_range; /* cell drops: VPI out of range */ | 377 | __be32 vpi_bad_range; /* cell drops: VPI out of range */ |
378 | u32 vpi_no_conn; /* cell drops: no connection for VPI */ | 378 | __be32 vpi_no_conn; /* cell drops: no connection for VPI */ |
379 | u32 vci_bad_range; /* cell drops: VCI out of range */ | 379 | __be32 vci_bad_range; /* cell drops: VCI out of range */ |
380 | u32 vci_no_conn; /* cell drops: no connection for VCI */ | 380 | __be32 vci_no_conn; /* cell drops: no connection for VCI */ |
381 | u32 pad[ 2 ]; /* i960 padding */ | 381 | __be32 pad[ 2 ]; /* i960 padding */ |
382 | } stats_atm_t; | 382 | } stats_atm_t; |
383 | 383 | ||
384 | /* AAL0 statistics */ | 384 | /* AAL0 statistics */ |
385 | 385 | ||
386 | typedef struct stats_aal0 { | 386 | typedef struct stats_aal0 { |
387 | u32 cells_transmitted; /* cells transmitted */ | 387 | __be32 cells_transmitted; /* cells transmitted */ |
388 | u32 cells_received; /* cells received */ | 388 | __be32 cells_received; /* cells received */ |
389 | u32 cells_dropped; /* cells dropped */ | 389 | __be32 cells_dropped; /* cells dropped */ |
390 | u32 pad[ 1 ]; /* i960 padding */ | 390 | __be32 pad[ 1 ]; /* i960 padding */ |
391 | } stats_aal0_t; | 391 | } stats_aal0_t; |
392 | 392 | ||
393 | 393 | ||
394 | /* AAL3/4 statistics */ | 394 | /* AAL3/4 statistics */ |
395 | 395 | ||
396 | typedef struct stats_aal34 { | 396 | typedef struct stats_aal34 { |
397 | u32 cells_transmitted; /* cells transmitted from segmented PDUs */ | 397 | __be32 cells_transmitted; /* cells transmitted from segmented PDUs */ |
398 | u32 cells_received; /* cells reassembled into PDUs */ | 398 | __be32 cells_received; /* cells reassembled into PDUs */ |
399 | u32 cells_crc_errors; /* payload CRC error count */ | 399 | __be32 cells_crc_errors; /* payload CRC error count */ |
400 | u32 cells_protocol_errors; /* SAR or CS layer protocol errors */ | 400 | __be32 cells_protocol_errors; /* SAR or CS layer protocol errors */ |
401 | u32 cells_dropped; /* cells dropped: partial reassembly */ | 401 | __be32 cells_dropped; /* cells dropped: partial reassembly */ |
402 | u32 cspdus_transmitted; /* CS PDUs transmitted */ | 402 | __be32 cspdus_transmitted; /* CS PDUs transmitted */ |
403 | u32 cspdus_received; /* CS PDUs received */ | 403 | __be32 cspdus_received; /* CS PDUs received */ |
404 | u32 cspdus_protocol_errors; /* CS layer protocol errors */ | 404 | __be32 cspdus_protocol_errors; /* CS layer protocol errors */ |
405 | u32 cspdus_dropped; /* reassembled PDUs drop'd (in cells) */ | 405 | __be32 cspdus_dropped; /* reassembled PDUs drop'd (in cells) */ |
406 | u32 pad[ 3 ]; /* i960 padding */ | 406 | __be32 pad[ 3 ]; /* i960 padding */ |
407 | } stats_aal34_t; | 407 | } stats_aal34_t; |
408 | 408 | ||
409 | 409 | ||
410 | /* AAL5 statistics */ | 410 | /* AAL5 statistics */ |
411 | 411 | ||
412 | typedef struct stats_aal5 { | 412 | typedef struct stats_aal5 { |
413 | u32 cells_transmitted; /* cells transmitted from segmented SDUs */ | 413 | __be32 cells_transmitted; /* cells transmitted from segmented SDUs */ |
414 | u32 cells_received; /* cells reassembled into SDUs */ | 414 | __be32 cells_received; /* cells reassembled into SDUs */ |
415 | u32 cells_dropped; /* reassembled PDUs dropped (in cells) */ | 415 | __be32 cells_dropped; /* reassembled PDUs dropped (in cells) */ |
416 | u32 congestion_experienced; /* CRC error and length wrong */ | 416 | __be32 congestion_experienced; /* CRC error and length wrong */ |
417 | u32 cspdus_transmitted; /* CS PDUs transmitted */ | 417 | __be32 cspdus_transmitted; /* CS PDUs transmitted */ |
418 | u32 cspdus_received; /* CS PDUs received */ | 418 | __be32 cspdus_received; /* CS PDUs received */ |
419 | u32 cspdus_crc_errors; /* CS PDUs CRC errors */ | 419 | __be32 cspdus_crc_errors; /* CS PDUs CRC errors */ |
420 | u32 cspdus_protocol_errors; /* CS layer protocol errors */ | 420 | __be32 cspdus_protocol_errors; /* CS layer protocol errors */ |
421 | u32 cspdus_dropped; /* reassembled PDUs dropped */ | 421 | __be32 cspdus_dropped; /* reassembled PDUs dropped */ |
422 | u32 pad[ 3 ]; /* i960 padding */ | 422 | __be32 pad[ 3 ]; /* i960 padding */ |
423 | } stats_aal5_t; | 423 | } stats_aal5_t; |
424 | 424 | ||
425 | 425 | ||
426 | /* auxiliary statistics */ | 426 | /* auxiliary statistics */ |
427 | 427 | ||
428 | typedef struct stats_aux { | 428 | typedef struct stats_aux { |
429 | u32 small_b1_failed; /* receive BD allocation failures */ | 429 | __be32 small_b1_failed; /* receive BD allocation failures */ |
430 | u32 large_b1_failed; /* receive BD allocation failures */ | 430 | __be32 large_b1_failed; /* receive BD allocation failures */ |
431 | u32 small_b2_failed; /* receive BD allocation failures */ | 431 | __be32 small_b2_failed; /* receive BD allocation failures */ |
432 | u32 large_b2_failed; /* receive BD allocation failures */ | 432 | __be32 large_b2_failed; /* receive BD allocation failures */ |
433 | u32 rpd_alloc_failed; /* receive PDU allocation failures */ | 433 | __be32 rpd_alloc_failed; /* receive PDU allocation failures */ |
434 | u32 receive_carrier; /* no carrier = 0, carrier = 1 */ | 434 | __be32 receive_carrier; /* no carrier = 0, carrier = 1 */ |
435 | u32 pad[ 2 ]; /* i960 padding */ | 435 | __be32 pad[ 2 ]; /* i960 padding */ |
436 | } stats_aux_t; | 436 | } stats_aux_t; |
437 | 437 | ||
438 | 438 | ||
@@ -643,10 +643,10 @@ typedef struct host_bsq { | |||
643 | /* header of the firmware image */ | 643 | /* header of the firmware image */ |
644 | 644 | ||
645 | typedef struct fw_header { | 645 | typedef struct fw_header { |
646 | u32 magic; /* magic number */ | 646 | __le32 magic; /* magic number */ |
647 | u32 version; /* firmware version id */ | 647 | __le32 version; /* firmware version id */ |
648 | u32 load_offset; /* fw load offset in board memory */ | 648 | __le32 load_offset; /* fw load offset in board memory */ |
649 | u32 start_offset; /* fw execution start address in board memory */ | 649 | __le32 start_offset; /* fw execution start address in board memory */ |
650 | } fw_header_t; | 650 | } fw_header_t; |
651 | 651 | ||
652 | #define FW_HEADER_MAGIC 0x65726f66 /* 'fore' */ | 652 | #define FW_HEADER_MAGIC 0x65726f66 /* 'fore' */ |
diff --git a/drivers/base/core.c b/drivers/base/core.c index 7de543d1d0b4..24198ad01976 100644 --- a/drivers/base/core.c +++ b/drivers/base/core.c | |||
@@ -19,6 +19,7 @@ | |||
19 | #include <linux/kdev_t.h> | 19 | #include <linux/kdev_t.h> |
20 | #include <linux/notifier.h> | 20 | #include <linux/notifier.h> |
21 | #include <linux/genhd.h> | 21 | #include <linux/genhd.h> |
22 | #include <linux/kallsyms.h> | ||
22 | #include <asm/semaphore.h> | 23 | #include <asm/semaphore.h> |
23 | 24 | ||
24 | #include "base.h" | 25 | #include "base.h" |
@@ -68,6 +69,10 @@ static ssize_t dev_attr_show(struct kobject *kobj, struct attribute *attr, | |||
68 | 69 | ||
69 | if (dev_attr->show) | 70 | if (dev_attr->show) |
70 | ret = dev_attr->show(dev, dev_attr, buf); | 71 | ret = dev_attr->show(dev, dev_attr, buf); |
72 | if (ret >= (ssize_t)PAGE_SIZE) { | ||
73 | print_symbol("dev_attr_show: %s returned bad count\n", | ||
74 | (unsigned long)dev_attr->show); | ||
75 | } | ||
71 | return ret; | 76 | return ret; |
72 | } | 77 | } |
73 | 78 | ||
diff --git a/drivers/block/Kconfig b/drivers/block/Kconfig index b6d230b3209f..0d1d2133d9bc 100644 --- a/drivers/block/Kconfig +++ b/drivers/block/Kconfig | |||
@@ -44,16 +44,6 @@ config MAC_FLOPPY | |||
44 | If you have a SWIM-3 (Super Woz Integrated Machine 3; from Apple) | 44 | If you have a SWIM-3 (Super Woz Integrated Machine 3; from Apple) |
45 | floppy controller, say Y here. Most commonly found in PowerMacs. | 45 | floppy controller, say Y here. Most commonly found in PowerMacs. |
46 | 46 | ||
47 | config BLK_DEV_PS2 | ||
48 | tristate "PS/2 ESDI hard disk support" | ||
49 | depends on MCA && MCA_LEGACY && BROKEN | ||
50 | help | ||
51 | Say Y here if you have a PS/2 machine with a MCA bus and an ESDI | ||
52 | hard disk. | ||
53 | |||
54 | To compile this driver as a module, choose M here: the | ||
55 | module will be called ps2esdi. | ||
56 | |||
57 | config AMIGA_Z2RAM | 47 | config AMIGA_Z2RAM |
58 | tristate "Amiga Zorro II ramdisk support" | 48 | tristate "Amiga Zorro II ramdisk support" |
59 | depends on ZORRO | 49 | depends on ZORRO |
diff --git a/drivers/block/Makefile b/drivers/block/Makefile index 01c972415cb2..5e584306be99 100644 --- a/drivers/block/Makefile +++ b/drivers/block/Makefile | |||
@@ -13,7 +13,6 @@ obj-$(CONFIG_ATARI_FLOPPY) += ataflop.o | |||
13 | obj-$(CONFIG_AMIGA_Z2RAM) += z2ram.o | 13 | obj-$(CONFIG_AMIGA_Z2RAM) += z2ram.o |
14 | obj-$(CONFIG_BLK_DEV_RAM) += brd.o | 14 | obj-$(CONFIG_BLK_DEV_RAM) += brd.o |
15 | obj-$(CONFIG_BLK_DEV_LOOP) += loop.o | 15 | obj-$(CONFIG_BLK_DEV_LOOP) += loop.o |
16 | obj-$(CONFIG_BLK_DEV_PS2) += ps2esdi.o | ||
17 | obj-$(CONFIG_BLK_DEV_XD) += xd.o | 16 | obj-$(CONFIG_BLK_DEV_XD) += xd.o |
18 | obj-$(CONFIG_BLK_CPQ_DA) += cpqarray.o | 17 | obj-$(CONFIG_BLK_CPQ_DA) += cpqarray.o |
19 | obj-$(CONFIG_BLK_CPQ_CISS_DA) += cciss.o | 18 | obj-$(CONFIG_BLK_CPQ_CISS_DA) += cciss.o |
diff --git a/drivers/block/floppy.c b/drivers/block/floppy.c index 32c79a55511b..7652e87d60c5 100644 --- a/drivers/block/floppy.c +++ b/drivers/block/floppy.c | |||
@@ -217,7 +217,6 @@ static int use_virtual_dma; | |||
217 | */ | 217 | */ |
218 | 218 | ||
219 | static DEFINE_SPINLOCK(floppy_lock); | 219 | static DEFINE_SPINLOCK(floppy_lock); |
220 | static struct completion device_release; | ||
221 | 220 | ||
222 | static unsigned short virtual_dma_port = 0x3f0; | 221 | static unsigned short virtual_dma_port = 0x3f0; |
223 | irqreturn_t floppy_interrupt(int irq, void *dev_id); | 222 | irqreturn_t floppy_interrupt(int irq, void *dev_id); |
@@ -4144,7 +4143,6 @@ DEVICE_ATTR(cmos,S_IRUGO,floppy_cmos_show,NULL); | |||
4144 | 4143 | ||
4145 | static void floppy_device_release(struct device *dev) | 4144 | static void floppy_device_release(struct device *dev) |
4146 | { | 4145 | { |
4147 | complete(&device_release); | ||
4148 | } | 4146 | } |
4149 | 4147 | ||
4150 | static struct platform_device floppy_device[N_DRIVE]; | 4148 | static struct platform_device floppy_device[N_DRIVE]; |
@@ -4539,7 +4537,6 @@ void cleanup_module(void) | |||
4539 | { | 4537 | { |
4540 | int drive; | 4538 | int drive; |
4541 | 4539 | ||
4542 | init_completion(&device_release); | ||
4543 | blk_unregister_region(MKDEV(FLOPPY_MAJOR, 0), 256); | 4540 | blk_unregister_region(MKDEV(FLOPPY_MAJOR, 0), 256); |
4544 | unregister_blkdev(FLOPPY_MAJOR, "fd"); | 4541 | unregister_blkdev(FLOPPY_MAJOR, "fd"); |
4545 | 4542 | ||
@@ -4564,8 +4561,6 @@ void cleanup_module(void) | |||
4564 | 4561 | ||
4565 | /* eject disk, if any */ | 4562 | /* eject disk, if any */ |
4566 | fd_eject(0); | 4563 | fd_eject(0); |
4567 | |||
4568 | wait_for_completion(&device_release); | ||
4569 | } | 4564 | } |
4570 | 4565 | ||
4571 | module_param(floppy, charp, 0); | 4566 | module_param(floppy, charp, 0); |
diff --git a/drivers/block/ps2esdi.c b/drivers/block/ps2esdi.c deleted file mode 100644 index 3c796e236253..000000000000 --- a/drivers/block/ps2esdi.c +++ /dev/null | |||
@@ -1,1079 +0,0 @@ | |||
1 | /* ps2esdi driver based on assembler code by Arindam Banerji, | ||
2 | written by Peter De Schrijver */ | ||
3 | /* Reassuring note to IBM : This driver was NOT developed by vice-versa | ||
4 | engineering the PS/2's BIOS */ | ||
5 | /* Dedicated to Wannes, Tofke, Ykke, Godot, Killroy and all those | ||
6 | other lovely fish out there... */ | ||
7 | /* This code was written during the long and boring WINA | ||
8 | elections 1994 */ | ||
9 | /* Thanks to Arindam Banerij for giving me the source of his driver */ | ||
10 | /* This code may be freely distributed and modified in any way, | ||
11 | as long as these notes remain intact */ | ||
12 | |||
13 | /* Revised: 05/07/94 by Arindam Banerji (axb@cse.nd.edu) */ | ||
14 | /* Revised: 09/08/94 by Peter De Schrijver (stud11@cc4.kuleuven.ac.be) | ||
15 | Thanks to Arindam Banerij for sending me the docs of the adapter */ | ||
16 | |||
17 | /* BA Modified for ThinkPad 720 by Boris Ashkinazi */ | ||
18 | /* (bash@vnet.ibm.com) 08/08/95 */ | ||
19 | |||
20 | /* Modified further for ThinkPad-720C by Uri Blumenthal */ | ||
21 | /* (uri@watson.ibm.com) Sep 11, 1995 */ | ||
22 | |||
23 | /* TODO : | ||
24 | + Timeouts | ||
25 | + Get disk parameters | ||
26 | + DMA above 16MB | ||
27 | + reset after read/write error | ||
28 | */ | ||
29 | |||
30 | #define DEVICE_NAME "PS/2 ESDI" | ||
31 | |||
32 | #include <linux/major.h> | ||
33 | #include <linux/errno.h> | ||
34 | #include <linux/wait.h> | ||
35 | #include <linux/interrupt.h> | ||
36 | #include <linux/fs.h> | ||
37 | #include <linux/kernel.h> | ||
38 | #include <linux/genhd.h> | ||
39 | #include <linux/ps2esdi.h> | ||
40 | #include <linux/blkdev.h> | ||
41 | #include <linux/mca-legacy.h> | ||
42 | #include <linux/init.h> | ||
43 | #include <linux/ioport.h> | ||
44 | #include <linux/module.h> | ||
45 | #include <linux/hdreg.h> | ||
46 | |||
47 | #include <asm/system.h> | ||
48 | #include <asm/io.h> | ||
49 | #include <asm/dma.h> | ||
50 | #include <asm/mca_dma.h> | ||
51 | #include <asm/uaccess.h> | ||
52 | |||
53 | #define PS2ESDI_IRQ 14 | ||
54 | #define MAX_HD 2 | ||
55 | #define MAX_RETRIES 5 | ||
56 | #define MAX_16BIT 65536 | ||
57 | #define ESDI_TIMEOUT 0xf000 | ||
58 | #define ESDI_STAT_TIMEOUT 4 | ||
59 | |||
60 | #define TYPE_0_CMD_BLK_LENGTH 2 | ||
61 | #define TYPE_1_CMD_BLK_LENGTH 4 | ||
62 | |||
63 | static void reset_ctrl(void); | ||
64 | |||
65 | static int ps2esdi_geninit(void); | ||
66 | |||
67 | static void do_ps2esdi_request(struct request_queue * q); | ||
68 | |||
69 | static void ps2esdi_readwrite(int cmd, struct request *req); | ||
70 | |||
71 | static void ps2esdi_fill_cmd_block(u_short * cmd_blk, u_short cmd, | ||
72 | u_short cyl, u_short head, u_short sector, u_short length, u_char drive); | ||
73 | |||
74 | static int ps2esdi_out_cmd_blk(u_short * cmd_blk); | ||
75 | |||
76 | static void ps2esdi_prep_dma(char *buffer, u_short length, u_char dma_xmode); | ||
77 | |||
78 | static irqreturn_t ps2esdi_interrupt_handler(int irq, void *dev_id); | ||
79 | static void (*current_int_handler) (u_int) = NULL; | ||
80 | static void ps2esdi_normal_interrupt_handler(u_int); | ||
81 | static void ps2esdi_initial_reset_int_handler(u_int); | ||
82 | static void ps2esdi_geometry_int_handler(u_int); | ||
83 | static int ps2esdi_getgeo(struct block_device *bdev, struct hd_geometry *geo); | ||
84 | |||
85 | static int ps2esdi_read_status_words(int num_words, int max_words, u_short * buffer); | ||
86 | |||
87 | static void dump_cmd_complete_status(u_int int_ret_code); | ||
88 | |||
89 | static void ps2esdi_get_device_cfg(void); | ||
90 | |||
91 | static void ps2esdi_reset_timer(unsigned long unused); | ||
92 | |||
93 | static u_int dma_arb_level; /* DMA arbitration level */ | ||
94 | |||
95 | static DECLARE_WAIT_QUEUE_HEAD(ps2esdi_int); | ||
96 | |||
97 | static int no_int_yet; | ||
98 | static int ps2esdi_drives; | ||
99 | static u_short io_base; | ||
100 | static DEFINE_TIMER(esdi_timer, ps2esdi_reset_timer, 0, 0); | ||
101 | static int reset_status; | ||
102 | static int ps2esdi_slot = -1; | ||
103 | static int tp720esdi = 0; /* Is it Integrated ESDI of ThinkPad-720? */ | ||
104 | static int intg_esdi = 0; /* If integrated adapter */ | ||
105 | struct ps2esdi_i_struct { | ||
106 | unsigned int head, sect, cyl, wpcom, lzone, ctl; | ||
107 | }; | ||
108 | static DEFINE_SPINLOCK(ps2esdi_lock); | ||
109 | static struct request_queue *ps2esdi_queue; | ||
110 | static struct request *current_req; | ||
111 | |||
112 | #if 0 | ||
113 | #if 0 /* try both - I don't know which one is better... UB */ | ||
114 | static struct ps2esdi_i_struct ps2esdi_info[MAX_HD] = | ||
115 | { | ||
116 | {4, 48, 1553, 0, 0, 0}, | ||
117 | {0, 0, 0, 0, 0, 0}}; | ||
118 | #else | ||
119 | static struct ps2esdi_i_struct ps2esdi_info[MAX_HD] = | ||
120 | { | ||
121 | {64, 32, 161, 0, 0, 0}, | ||
122 | {0, 0, 0, 0, 0, 0}}; | ||
123 | #endif | ||
124 | #endif | ||
125 | static struct ps2esdi_i_struct ps2esdi_info[MAX_HD] = | ||
126 | { | ||
127 | {0, 0, 0, 0, 0, 0}, | ||
128 | {0, 0, 0, 0, 0, 0}}; | ||
129 | |||
130 | static struct block_device_operations ps2esdi_fops = | ||
131 | { | ||
132 | .owner = THIS_MODULE, | ||
133 | .getgeo = ps2esdi_getgeo, | ||
134 | }; | ||
135 | |||
136 | static struct gendisk *ps2esdi_gendisk[2]; | ||
137 | |||
138 | /* initialization routine called by ll_rw_blk.c */ | ||
139 | static int __init ps2esdi_init(void) | ||
140 | { | ||
141 | |||
142 | int error = 0; | ||
143 | |||
144 | /* register the device - pass the name and major number */ | ||
145 | if (register_blkdev(PS2ESDI_MAJOR, "ed")) | ||
146 | return -EBUSY; | ||
147 | |||
148 | /* set up some global information - indicating device specific info */ | ||
149 | ps2esdi_queue = blk_init_queue(do_ps2esdi_request, &ps2esdi_lock); | ||
150 | if (!ps2esdi_queue) { | ||
151 | unregister_blkdev(PS2ESDI_MAJOR, "ed"); | ||
152 | return -ENOMEM; | ||
153 | } | ||
154 | |||
155 | /* some minor housekeeping - setup the global gendisk structure */ | ||
156 | error = ps2esdi_geninit(); | ||
157 | if (error) { | ||
158 | printk(KERN_WARNING "PS2ESDI: error initialising" | ||
159 | " device, releasing resources\n"); | ||
160 | unregister_blkdev(PS2ESDI_MAJOR, "ed"); | ||
161 | blk_cleanup_queue(ps2esdi_queue); | ||
162 | return error; | ||
163 | } | ||
164 | return 0; | ||
165 | } /* ps2esdi_init */ | ||
166 | |||
167 | #ifndef MODULE | ||
168 | |||
169 | module_init(ps2esdi_init); | ||
170 | |||
171 | #else | ||
172 | |||
173 | static int cyl[MAX_HD] = {-1,-1}; | ||
174 | static int head[MAX_HD] = {-1, -1}; | ||
175 | static int sect[MAX_HD] = {-1, -1}; | ||
176 | |||
177 | module_param(tp720esdi, bool, 0); | ||
178 | module_param_array(cyl, int, NULL, 0); | ||
179 | module_param_array(head, int, NULL, 0); | ||
180 | module_param_array(sect, int, NULL, 0); | ||
181 | MODULE_LICENSE("GPL"); | ||
182 | |||
183 | int init_module(void) { | ||
184 | int drive; | ||
185 | |||
186 | for(drive = 0; drive < MAX_HD; drive++) { | ||
187 | struct ps2esdi_i_struct *info = &ps2esdi_info[drive]; | ||
188 | |||
189 | if (cyl[drive] != -1) { | ||
190 | info->cyl = info->lzone = cyl[drive]; | ||
191 | info->wpcom = 0; | ||
192 | } | ||
193 | if (head[drive] != -1) { | ||
194 | info->head = head[drive]; | ||
195 | info->ctl = (head[drive] > 8 ? 8 : 0); | ||
196 | } | ||
197 | if (sect[drive] != -1) info->sect = sect[drive]; | ||
198 | } | ||
199 | return ps2esdi_init(); | ||
200 | } | ||
201 | |||
202 | void | ||
203 | cleanup_module(void) { | ||
204 | int i; | ||
205 | if(ps2esdi_slot) { | ||
206 | mca_mark_as_unused(ps2esdi_slot); | ||
207 | mca_set_adapter_procfn(ps2esdi_slot, NULL, NULL); | ||
208 | } | ||
209 | release_region(io_base, 4); | ||
210 | free_dma(dma_arb_level); | ||
211 | free_irq(PS2ESDI_IRQ, &ps2esdi_gendisk); | ||
212 | unregister_blkdev(PS2ESDI_MAJOR, "ed"); | ||
213 | blk_cleanup_queue(ps2esdi_queue); | ||
214 | for (i = 0; i < ps2esdi_drives; i++) { | ||
215 | del_gendisk(ps2esdi_gendisk[i]); | ||
216 | put_disk(ps2esdi_gendisk[i]); | ||
217 | } | ||
218 | } | ||
219 | #endif /* MODULE */ | ||
220 | |||
221 | /* handles boot time command line parameters */ | ||
222 | void __init tp720_setup(char *str, int *ints) | ||
223 | { | ||
224 | /* no params, just sets the tp720esdi flag if it exists */ | ||
225 | |||
226 | printk("%s: TP 720 ESDI flag set\n", DEVICE_NAME); | ||
227 | tp720esdi = 1; | ||
228 | } | ||
229 | |||
230 | void __init ed_setup(char *str, int *ints) | ||
231 | { | ||
232 | int hdind = 0; | ||
233 | |||
234 | /* handles 3 parameters only - corresponding to | ||
235 | 1. Number of cylinders | ||
236 | 2. Number of heads | ||
237 | 3. Sectors/track | ||
238 | */ | ||
239 | |||
240 | if (ints[0] != 3) | ||
241 | return; | ||
242 | |||
243 | /* print out the information - seen at boot time */ | ||
244 | printk("%s: ints[0]=%d ints[1]=%d ints[2]=%d ints[3]=%d\n", | ||
245 | DEVICE_NAME, ints[0], ints[1], ints[2], ints[3]); | ||
246 | |||
247 | /* set the index into device specific information table */ | ||
248 | if (ps2esdi_info[0].head != 0) | ||
249 | hdind = 1; | ||
250 | |||
251 | /* set up all the device information */ | ||
252 | ps2esdi_info[hdind].head = ints[2]; | ||
253 | ps2esdi_info[hdind].sect = ints[3]; | ||
254 | ps2esdi_info[hdind].cyl = ints[1]; | ||
255 | ps2esdi_info[hdind].wpcom = 0; | ||
256 | ps2esdi_info[hdind].lzone = ints[1]; | ||
257 | ps2esdi_info[hdind].ctl = (ints[2] > 8 ? 8 : 0); | ||
258 | #if 0 /* this may be needed for PS2/Mod.80, but it hurts ThinkPad! */ | ||
259 | ps2esdi_drives = hdind + 1; /* increment index for the next time */ | ||
260 | #endif | ||
261 | } /* ed_setup */ | ||
262 | |||
263 | static int ps2esdi_getinfo(char *buf, int slot, void *d) | ||
264 | { | ||
265 | int len = 0; | ||
266 | |||
267 | len += sprintf(buf + len, "DMA Arbitration Level: %d\n", | ||
268 | dma_arb_level); | ||
269 | len += sprintf(buf + len, "IO Port: %x\n", io_base); | ||
270 | len += sprintf(buf + len, "IRQ: 14\n"); | ||
271 | len += sprintf(buf + len, "Drives: %d\n", ps2esdi_drives); | ||
272 | |||
273 | return len; | ||
274 | } | ||
275 | |||
276 | /* ps2 esdi specific initialization - called thru the gendisk chain */ | ||
277 | static int __init ps2esdi_geninit(void) | ||
278 | { | ||
279 | /* | ||
280 | The first part contains the initialization code | ||
281 | for the ESDI disk subsystem. All we really do | ||
282 | is search for the POS registers of the controller | ||
283 | to do some simple setup operations. First, we | ||
284 | must ensure that the controller is installed, | ||
285 | enabled, and configured as PRIMARY. Then we must | ||
286 | determine the DMA arbitration level being used by | ||
287 | the controller so we can handle data transfer | ||
288 | operations properly. If all of this works, then | ||
289 | we will set the INIT_FLAG to a non-zero value. | ||
290 | */ | ||
291 | |||
292 | int slot = 0, i, reset_start, reset_end; | ||
293 | u_char status; | ||
294 | unsigned short adapterID; | ||
295 | int error = 0; | ||
296 | |||
297 | if ((slot = mca_find_adapter(INTG_ESDI_ID, 0)) != MCA_NOTFOUND) { | ||
298 | adapterID = INTG_ESDI_ID; | ||
299 | printk("%s: integrated ESDI adapter found in slot %d\n", | ||
300 | DEVICE_NAME, slot+1); | ||
301 | #ifndef MODULE | ||
302 | mca_set_adapter_name(slot, "PS/2 Integrated ESDI"); | ||
303 | #endif | ||
304 | } else if ((slot = mca_find_adapter(NRML_ESDI_ID, 0)) != -1) { | ||
305 | adapterID = NRML_ESDI_ID; | ||
306 | printk("%s: normal ESDI adapter found in slot %d\n", | ||
307 | DEVICE_NAME, slot+1); | ||
308 | mca_set_adapter_name(slot, "PS/2 ESDI"); | ||
309 | } else { | ||
310 | return -ENODEV; | ||
311 | } | ||
312 | |||
313 | ps2esdi_slot = slot; | ||
314 | mca_mark_as_used(slot); | ||
315 | mca_set_adapter_procfn(slot, (MCA_ProcFn) ps2esdi_getinfo, NULL); | ||
316 | |||
317 | /* Found the slot - read the POS register 2 to get the necessary | ||
318 | configuration and status information. POS register 2 has the | ||
319 | following information : | ||
320 | Bit Function | ||
321 | 7 reserved = 0 | ||
322 | 6 arbitration method | ||
323 | 0 - fairness enabled | ||
324 | 1 - fairness disabled, linear priority assignment | ||
325 | 5-2 arbitration level | ||
326 | 1 alternate address | ||
327 | 1 alternate address | ||
328 | 0 - use addresses 0x3510 - 0x3517 | ||
329 | 0 adapter enable | ||
330 | */ | ||
331 | |||
332 | status = mca_read_stored_pos(slot, 2); | ||
333 | /* is it enabled ? */ | ||
334 | if (!(status & STATUS_ENABLED)) { | ||
335 | printk("%s: ESDI adapter disabled\n", DEVICE_NAME); | ||
336 | error = -ENODEV; | ||
337 | goto err_out1; | ||
338 | } | ||
339 | /* try to grab IRQ, and try to grab a slow IRQ if it fails, so we can | ||
340 | share with the SCSI driver */ | ||
341 | if (request_irq(PS2ESDI_IRQ, ps2esdi_interrupt_handler, | ||
342 | IRQF_DISABLED | IRQF_SHARED, "PS/2 ESDI", &ps2esdi_gendisk) | ||
343 | && request_irq(PS2ESDI_IRQ, ps2esdi_interrupt_handler, | ||
344 | IRQF_SHARED, "PS/2 ESDI", &ps2esdi_gendisk) | ||
345 | ) { | ||
346 | printk("%s: Unable to get IRQ %d\n", DEVICE_NAME, PS2ESDI_IRQ); | ||
347 | error = -EBUSY; | ||
348 | goto err_out1; | ||
349 | } | ||
350 | if (status & STATUS_ALTERNATE) | ||
351 | io_base = ALT_IO_BASE; | ||
352 | else | ||
353 | io_base = PRIMARY_IO_BASE; | ||
354 | |||
355 | if (!request_region(io_base, 4, "ed")) { | ||
356 | printk(KERN_WARNING"Unable to request region 0x%x\n", io_base); | ||
357 | error = -EBUSY; | ||
358 | goto err_out2; | ||
359 | } | ||
360 | /* get the dma arbitration level */ | ||
361 | dma_arb_level = (status >> 2) & 0xf; | ||
362 | |||
363 | /* BA */ | ||
364 | printk("%s: DMA arbitration level : %d\n", | ||
365 | DEVICE_NAME, dma_arb_level); | ||
366 | |||
367 | LITE_ON; | ||
368 | current_int_handler = ps2esdi_initial_reset_int_handler; | ||
369 | reset_ctrl(); | ||
370 | reset_status = 0; | ||
371 | reset_start = jiffies; | ||
372 | while (!reset_status) { | ||
373 | init_timer(&esdi_timer); | ||
374 | esdi_timer.expires = jiffies + HZ; | ||
375 | esdi_timer.data = 0; | ||
376 | add_timer(&esdi_timer); | ||
377 | sleep_on(&ps2esdi_int); | ||
378 | } | ||
379 | reset_end = jiffies; | ||
380 | LITE_OFF; | ||
381 | printk("%s: reset interrupt after %d jiffies, %u.%02u secs\n", | ||
382 | DEVICE_NAME, reset_end - reset_start, (reset_end - reset_start) / HZ, | ||
383 | (reset_end - reset_start) % HZ); | ||
384 | |||
385 | |||
386 | /* Integrated ESDI Disk and Controller has only one drive! */ | ||
387 | if (adapterID == INTG_ESDI_ID) {/* if not "normal" PS2 ESDI adapter */ | ||
388 | ps2esdi_drives = 1; /* then we have only one physical disk! */ intg_esdi = 1; | ||
389 | } | ||
390 | |||
391 | |||
392 | |||
393 | /* finally this part sets up some global data structures etc. */ | ||
394 | |||
395 | ps2esdi_get_device_cfg(); | ||
396 | |||
397 | /* some annoyance in the above routine returns TWO drives? | ||
398 | Is something else happining in the background? | ||
399 | Regaurdless we fix the # of drives again. AJK */ | ||
400 | /* Integrated ESDI Disk and Controller has only one drive! */ | ||
401 | if (adapterID == INTG_ESDI_ID) /* if not "normal" PS2 ESDI adapter */ | ||
402 | ps2esdi_drives = 1; /* Not three or two, ONE DAMNIT! */ | ||
403 | |||
404 | current_int_handler = ps2esdi_normal_interrupt_handler; | ||
405 | |||
406 | if (request_dma(dma_arb_level, "ed") !=0) { | ||
407 | printk(KERN_WARNING "PS2ESDI: Can't request dma-channel %d\n" | ||
408 | ,(int) dma_arb_level); | ||
409 | error = -EBUSY; | ||
410 | goto err_out3; | ||
411 | } | ||
412 | blk_queue_max_sectors(ps2esdi_queue, 128); | ||
413 | |||
414 | error = -ENOMEM; | ||
415 | for (i = 0; i < ps2esdi_drives; i++) { | ||
416 | struct gendisk *disk = alloc_disk(64); | ||
417 | if (!disk) | ||
418 | goto err_out4; | ||
419 | disk->major = PS2ESDI_MAJOR; | ||
420 | disk->first_minor = i<<6; | ||
421 | sprintf(disk->disk_name, "ed%c", 'a'+i); | ||
422 | disk->fops = &ps2esdi_fops; | ||
423 | ps2esdi_gendisk[i] = disk; | ||
424 | } | ||
425 | |||
426 | for (i = 0; i < ps2esdi_drives; i++) { | ||
427 | struct gendisk *disk = ps2esdi_gendisk[i]; | ||
428 | set_capacity(disk, ps2esdi_info[i].head * ps2esdi_info[i].sect * | ||
429 | ps2esdi_info[i].cyl); | ||
430 | disk->queue = ps2esdi_queue; | ||
431 | disk->private_data = &ps2esdi_info[i]; | ||
432 | add_disk(disk); | ||
433 | } | ||
434 | return 0; | ||
435 | err_out4: | ||
436 | while (i--) | ||
437 | put_disk(ps2esdi_gendisk[i]); | ||
438 | err_out3: | ||
439 | release_region(io_base, 4); | ||
440 | err_out2: | ||
441 | free_irq(PS2ESDI_IRQ, &ps2esdi_gendisk); | ||
442 | err_out1: | ||
443 | if(ps2esdi_slot) { | ||
444 | mca_mark_as_unused(ps2esdi_slot); | ||
445 | mca_set_adapter_procfn(ps2esdi_slot, NULL, NULL); | ||
446 | } | ||
447 | return error; | ||
448 | } | ||
449 | |||
450 | static void __init ps2esdi_get_device_cfg(void) | ||
451 | { | ||
452 | u_short cmd_blk[TYPE_0_CMD_BLK_LENGTH]; | ||
453 | |||
454 | /*BA */ printk("%s: Drive 0\n", DEVICE_NAME); | ||
455 | current_int_handler = ps2esdi_geometry_int_handler; | ||
456 | cmd_blk[0] = CMD_GET_DEV_CONFIG | 0x600; | ||
457 | cmd_blk[1] = 0; | ||
458 | no_int_yet = TRUE; | ||
459 | ps2esdi_out_cmd_blk(cmd_blk); | ||
460 | if (no_int_yet) | ||
461 | sleep_on(&ps2esdi_int); | ||
462 | |||
463 | if (ps2esdi_drives > 1) { | ||
464 | printk("%s: Drive 1\n", DEVICE_NAME); /*BA */ | ||
465 | cmd_blk[0] = CMD_GET_DEV_CONFIG | (1 << 5) | 0x600; | ||
466 | cmd_blk[1] = 0; | ||
467 | no_int_yet = TRUE; | ||
468 | ps2esdi_out_cmd_blk(cmd_blk); | ||
469 | if (no_int_yet) | ||
470 | sleep_on(&ps2esdi_int); | ||
471 | } /* if second physical drive is present */ | ||
472 | return; | ||
473 | } | ||
474 | |||
475 | /* strategy routine that handles most of the IO requests */ | ||
476 | static void do_ps2esdi_request(struct request_queue * q) | ||
477 | { | ||
478 | struct request *req; | ||
479 | /* since, this routine is called with interrupts cleared - they | ||
480 | must be before it finishes */ | ||
481 | |||
482 | req = elv_next_request(q); | ||
483 | if (!req) | ||
484 | return; | ||
485 | |||
486 | #if 0 | ||
487 | printk("%s:got request. device : %s command : %d sector : %ld count : %ld, buffer: %p\n", | ||
488 | DEVICE_NAME, | ||
489 | req->rq_disk->disk_name, | ||
490 | req->cmd, req->sector, | ||
491 | req->current_nr_sectors, req->buffer); | ||
492 | #endif | ||
493 | |||
494 | /* check for above 16Mb dmas */ | ||
495 | if (isa_virt_to_bus(req->buffer + req->current_nr_sectors * 512) > 16 * MB) { | ||
496 | printk("%s: DMA above 16MB not supported\n", DEVICE_NAME); | ||
497 | end_request(req, FAIL); | ||
498 | return; | ||
499 | } | ||
500 | |||
501 | if (req->sector+req->current_nr_sectors > get_capacity(req->rq_disk)) { | ||
502 | printk("Grrr. error. ps2esdi_drives: %d, %llu %llu\n", | ||
503 | ps2esdi_drives, req->sector, | ||
504 | (unsigned long long)get_capacity(req->rq_disk)); | ||
505 | end_request(req, FAIL); | ||
506 | return; | ||
507 | } | ||
508 | |||
509 | switch (rq_data_dir(req)) { | ||
510 | case READ: | ||
511 | ps2esdi_readwrite(READ, req); | ||
512 | break; | ||
513 | case WRITE: | ||
514 | ps2esdi_readwrite(WRITE, req); | ||
515 | break; | ||
516 | default: | ||
517 | printk("%s: Unknown command\n", req->rq_disk->disk_name); | ||
518 | end_request(req, FAIL); | ||
519 | break; | ||
520 | } /* handle different commands */ | ||
521 | } /* main strategy routine */ | ||
522 | |||
523 | /* resets the ESDI adapter */ | ||
524 | static void reset_ctrl(void) | ||
525 | { | ||
526 | |||
527 | u_long expire; | ||
528 | u_short status; | ||
529 | |||
530 | /* enable interrupts on the controller */ | ||
531 | status = inb(ESDI_INTRPT); | ||
532 | outb((status & 0xe0) | ATT_EOI, ESDI_ATTN); /* to be sure we don't have | ||
533 | any interrupt pending... */ | ||
534 | outb_p(CTRL_ENABLE_INTR, ESDI_CONTROL); | ||
535 | |||
536 | /* read the ESDI status port - if the controller is not busy, | ||
537 | simply do a soft reset (fast) - otherwise we'll have to do a | ||
538 | hard (slow) reset. */ | ||
539 | if (!(inb_p(ESDI_STATUS) & STATUS_BUSY)) { | ||
540 | /*BA */ printk("%s: soft reset...\n", DEVICE_NAME); | ||
541 | outb_p(CTRL_SOFT_RESET, ESDI_ATTN); | ||
542 | } | ||
543 | /* soft reset */ | ||
544 | else { | ||
545 | /*BA */ | ||
546 | printk("%s: hard reset...\n", DEVICE_NAME); | ||
547 | outb_p(CTRL_HARD_RESET, ESDI_CONTROL); | ||
548 | expire = jiffies + 2*HZ; | ||
549 | while (time_before(jiffies, expire)); | ||
550 | outb_p(1, ESDI_CONTROL); | ||
551 | } /* hard reset */ | ||
552 | |||
553 | |||
554 | } /* reset the controller */ | ||
555 | |||
556 | /* called by the strategy routine to handle read and write requests */ | ||
557 | static void ps2esdi_readwrite(int cmd, struct request *req) | ||
558 | { | ||
559 | struct ps2esdi_i_struct *p = req->rq_disk->private_data; | ||
560 | unsigned block = req->sector; | ||
561 | unsigned count = req->current_nr_sectors; | ||
562 | int drive = p - ps2esdi_info; | ||
563 | u_short track, head, cylinder, sector; | ||
564 | u_short cmd_blk[TYPE_1_CMD_BLK_LENGTH]; | ||
565 | |||
566 | /* do some relevant arithmatic */ | ||
567 | track = block / p->sect; | ||
568 | head = track % p->head; | ||
569 | cylinder = track / p->head; | ||
570 | sector = block % p->sect; | ||
571 | |||
572 | #if 0 | ||
573 | printk("%s: cyl=%d head=%d sect=%d\n", DEVICE_NAME, cylinder, head, sector); | ||
574 | #endif | ||
575 | /* call the routine that actually fills out a command block */ | ||
576 | ps2esdi_fill_cmd_block | ||
577 | (cmd_blk, | ||
578 | (cmd == READ) ? CMD_READ : CMD_WRITE, | ||
579 | cylinder, head, sector, count, drive); | ||
580 | |||
581 | /* send the command block to the controller */ | ||
582 | current_req = req; | ||
583 | spin_unlock_irq(&ps2esdi_lock); | ||
584 | if (ps2esdi_out_cmd_blk(cmd_blk)) { | ||
585 | spin_lock_irq(&ps2esdi_lock); | ||
586 | printk("%s: Controller failed\n", DEVICE_NAME); | ||
587 | if ((++req->errors) >= MAX_RETRIES) | ||
588 | end_request(req, FAIL); | ||
589 | } | ||
590 | /* check for failure to put out the command block */ | ||
591 | else { | ||
592 | spin_lock_irq(&ps2esdi_lock); | ||
593 | #if 0 | ||
594 | printk("%s: waiting for xfer\n", DEVICE_NAME); | ||
595 | #endif | ||
596 | /* turn disk lights on */ | ||
597 | LITE_ON; | ||
598 | } | ||
599 | |||
600 | } /* ps2esdi_readwrite */ | ||
601 | |||
602 | /* fill out the command block */ | ||
603 | static void ps2esdi_fill_cmd_block(u_short * cmd_blk, u_short cmd, | ||
604 | u_short cyl, u_short head, u_short sector, u_short length, u_char drive) | ||
605 | { | ||
606 | |||
607 | cmd_blk[0] = (drive << 5) | cmd; | ||
608 | cmd_blk[1] = length; | ||
609 | cmd_blk[2] = ((cyl & 0x1f) << 11) | (head << 5) | sector; | ||
610 | cmd_blk[3] = (cyl & 0x3E0) >> 5; | ||
611 | |||
612 | } /* fill out the command block */ | ||
613 | |||
614 | /* write a command block to the controller */ | ||
615 | static int ps2esdi_out_cmd_blk(u_short * cmd_blk) | ||
616 | { | ||
617 | |||
618 | int i; | ||
619 | unsigned long jif; | ||
620 | u_char status; | ||
621 | |||
622 | /* enable interrupts */ | ||
623 | outb(CTRL_ENABLE_INTR, ESDI_CONTROL); | ||
624 | |||
625 | /* do not write to the controller, if it is busy */ | ||
626 | for (jif = jiffies + ESDI_STAT_TIMEOUT; | ||
627 | time_after(jif, jiffies) && | ||
628 | (inb(ESDI_STATUS) & STATUS_BUSY); ) | ||
629 | ; | ||
630 | |||
631 | #if 0 | ||
632 | printk("%s: i(1)=%ld\n", DEVICE_NAME, jif); | ||
633 | #endif | ||
634 | |||
635 | /* if device is still busy - then just time out */ | ||
636 | if (inb(ESDI_STATUS) & STATUS_BUSY) { | ||
637 | printk("%s: ps2esdi_out_cmd timed out (1)\n", DEVICE_NAME); | ||
638 | return ERROR; | ||
639 | } /* timeout ??? */ | ||
640 | /* Set up the attention register in the controller */ | ||
641 | outb(((*cmd_blk) & 0xE0) | 1, ESDI_ATTN); | ||
642 | |||
643 | #if 0 | ||
644 | printk("%s: sending %d words to controller\n", DEVICE_NAME, (((*cmd_blk) >> 14) + 1) << 1); | ||
645 | #endif | ||
646 | |||
647 | /* one by one send each word out */ | ||
648 | for (i = (((*cmd_blk) >> 14) + 1) << 1; i; i--) { | ||
649 | status = inb(ESDI_STATUS); | ||
650 | for (jif = jiffies + ESDI_STAT_TIMEOUT; | ||
651 | time_after(jif, jiffies) && (status & STATUS_BUSY) && | ||
652 | (status & STATUS_CMD_INF); status = inb(ESDI_STATUS)); | ||
653 | if ((status & (STATUS_BUSY | STATUS_CMD_INF)) == STATUS_BUSY) { | ||
654 | #if 0 | ||
655 | printk("%s: sending %04X\n", DEVICE_NAME, *cmd_blk); | ||
656 | #endif | ||
657 | outw(*cmd_blk++, ESDI_CMD_INT); | ||
658 | } else { | ||
659 | printk("%s: ps2esdi_out_cmd timed out while sending command (status=%02X)\n", | ||
660 | DEVICE_NAME, status); | ||
661 | return ERROR; | ||
662 | } | ||
663 | } /* send all words out */ | ||
664 | return OK; | ||
665 | } /* send out the commands */ | ||
666 | |||
667 | |||
668 | /* prepare for dma - do all the necessary setup */ | ||
669 | static void ps2esdi_prep_dma(char *buffer, u_short length, u_char dma_xmode) | ||
670 | { | ||
671 | unsigned long flags = claim_dma_lock(); | ||
672 | |||
673 | mca_disable_dma(dma_arb_level); | ||
674 | |||
675 | mca_set_dma_addr(dma_arb_level, isa_virt_to_bus(buffer)); | ||
676 | |||
677 | mca_set_dma_count(dma_arb_level, length * 512 / 2); | ||
678 | |||
679 | mca_set_dma_mode(dma_arb_level, dma_xmode); | ||
680 | |||
681 | mca_enable_dma(dma_arb_level); | ||
682 | |||
683 | release_dma_lock(flags); | ||
684 | |||
685 | } /* prepare for dma */ | ||
686 | |||
687 | |||
688 | |||
689 | static irqreturn_t ps2esdi_interrupt_handler(int irq, void *dev_id) | ||
690 | { | ||
691 | u_int int_ret_code; | ||
692 | |||
693 | if (inb(ESDI_STATUS) & STATUS_INTR) { | ||
694 | int_ret_code = inb(ESDI_INTRPT); | ||
695 | if (current_int_handler) { | ||
696 | /* Disable adapter interrupts till processing is finished */ | ||
697 | outb(CTRL_DISABLE_INTR, ESDI_CONTROL); | ||
698 | current_int_handler(int_ret_code); | ||
699 | } else | ||
700 | printk("%s: help ! No interrupt handler.\n", DEVICE_NAME); | ||
701 | } else { | ||
702 | return IRQ_NONE; | ||
703 | } | ||
704 | return IRQ_HANDLED; | ||
705 | } | ||
706 | |||
707 | static void ps2esdi_initial_reset_int_handler(u_int int_ret_code) | ||
708 | { | ||
709 | |||
710 | switch (int_ret_code & 0xf) { | ||
711 | case INT_RESET: | ||
712 | /*BA */ | ||
713 | printk("%s: initial reset completed.\n", DEVICE_NAME); | ||
714 | outb((int_ret_code & 0xe0) | ATT_EOI, ESDI_ATTN); | ||
715 | wake_up(&ps2esdi_int); | ||
716 | break; | ||
717 | case INT_ATTN_ERROR: | ||
718 | printk("%s: Attention error. interrupt status : %02X\n", DEVICE_NAME, | ||
719 | int_ret_code); | ||
720 | printk("%s: status: %02x\n", DEVICE_NAME, inb(ESDI_STATUS)); | ||
721 | break; | ||
722 | default: | ||
723 | printk("%s: initial reset handler received interrupt: %02X\n", | ||
724 | DEVICE_NAME, int_ret_code); | ||
725 | outb((int_ret_code & 0xe0) | ATT_EOI, ESDI_ATTN); | ||
726 | break; | ||
727 | } | ||
728 | outb(CTRL_ENABLE_INTR, ESDI_CONTROL); | ||
729 | } | ||
730 | |||
731 | |||
732 | static void ps2esdi_geometry_int_handler(u_int int_ret_code) | ||
733 | { | ||
734 | u_int status, drive_num; | ||
735 | unsigned long rba; | ||
736 | int i; | ||
737 | |||
738 | drive_num = int_ret_code >> 5; | ||
739 | switch (int_ret_code & 0xf) { | ||
740 | case INT_CMD_COMPLETE: | ||
741 | for (i = ESDI_TIMEOUT; i && !(inb(ESDI_STATUS) & STATUS_STAT_AVAIL); i--); | ||
742 | if (!(inb(ESDI_STATUS) & STATUS_STAT_AVAIL)) { | ||
743 | printk("%s: timeout reading status word\n", DEVICE_NAME); | ||
744 | outb((int_ret_code & 0xe0) | ATT_EOI, ESDI_ATTN); | ||
745 | break; | ||
746 | } | ||
747 | status = inw(ESDI_STT_INT); | ||
748 | if ((status & 0x1F) == CMD_GET_DEV_CONFIG) { | ||
749 | #define REPLY_WORDS 5 /* we already read word 0 */ | ||
750 | u_short reply[REPLY_WORDS]; | ||
751 | |||
752 | if (ps2esdi_read_status_words((status >> 8) - 1, REPLY_WORDS, reply)) { | ||
753 | /*BA */ | ||
754 | printk("%s: Device Configuration Status for drive %u\n", | ||
755 | DEVICE_NAME, drive_num); | ||
756 | |||
757 | printk("%s: Spares/cyls: %u", DEVICE_NAME, reply[0] >> 8); | ||
758 | |||
759 | printk | ||
760 | ("Config bits: %s%s%s%s%s\n", | ||
761 | (reply[0] & CONFIG_IS) ? "Invalid Secondary, " : "", | ||
762 | ((reply[0] & CONFIG_ZD) && !(reply[0] & CONFIG_IS)) | ||
763 | ? "Zero Defect, " : "Defects Present, ", | ||
764 | (reply[0] & CONFIG_SF) ? "Skewed Format, " : "", | ||
765 | (reply[0] & CONFIG_FR) ? "Removable, " : "Non-Removable, ", | ||
766 | (reply[0] & CONFIG_RT) ? "No Retries" : "Retries"); | ||
767 | |||
768 | rba = reply[1] | ((unsigned long) reply[2] << 16); | ||
769 | printk("%s: Number of RBA's: %lu\n", DEVICE_NAME, rba); | ||
770 | |||
771 | printk("%s: Physical number of cylinders: %u, Sectors/Track: %u, Heads: %u\n", | ||
772 | DEVICE_NAME, reply[3], reply[4] >> 8, reply[4] & 0xff); | ||
773 | |||
774 | if (!ps2esdi_info[drive_num].head) { | ||
775 | ps2esdi_info[drive_num].head = 64; | ||
776 | ps2esdi_info[drive_num].sect = 32; | ||
777 | ps2esdi_info[drive_num].cyl = rba / (64 * 32); | ||
778 | ps2esdi_info[drive_num].wpcom = 0; | ||
779 | ps2esdi_info[drive_num].lzone = ps2esdi_info[drive_num].cyl; | ||
780 | ps2esdi_info[drive_num].ctl = 8; | ||
781 | if (tp720esdi) { /* store the retrieved parameters */ | ||
782 | ps2esdi_info[0].head = reply[4] & 0Xff; | ||
783 | ps2esdi_info[0].sect = reply[4] >> 8; | ||
784 | ps2esdi_info[0].cyl = reply[3]; | ||
785 | ps2esdi_info[0].wpcom = 0; | ||
786 | ps2esdi_info[0].lzone = reply[3]; | ||
787 | } else { | ||
788 | if (!intg_esdi) | ||
789 | ps2esdi_drives++; | ||
790 | } | ||
791 | } | ||
792 | #ifdef OBSOLETE | ||
793 | if (!ps2esdi_info[drive_num].head) { | ||
794 | ps2esdi_info[drive_num].head = reply[4] & 0Xff; | ||
795 | ps2esdi_info[drive_num].sect = reply[4] >> 8; | ||
796 | ps2esdi_info[drive_num].cyl = reply[3]; | ||
797 | ps2esdi_info[drive_num].wpcom = 0; | ||
798 | ps2esdi_info[drive_num].lzone = reply[3]; | ||
799 | if (tp720esdi) { /* store the retrieved parameters */ | ||
800 | ps2esdi_info[0].head = reply[4] & 0Xff; | ||
801 | ps2esdi_info[0].sect = reply[4] >> 8; | ||
802 | ps2esdi_info[0].cyl = reply[3]; | ||
803 | ps2esdi_info[0].wpcom = 0; | ||
804 | ps2esdi_info[0].lzone = reply[3]; | ||
805 | } else { | ||
806 | ps2esdi_drives++; | ||
807 | } | ||
808 | } | ||
809 | #endif | ||
810 | |||
811 | } else | ||
812 | printk("%s: failed while getting device config\n", DEVICE_NAME); | ||
813 | #undef REPLY_WORDS | ||
814 | } else | ||
815 | printk("%s: command %02X unknown by geometry handler\n", | ||
816 | DEVICE_NAME, status & 0x1f); | ||
817 | |||
818 | outb((int_ret_code & 0xe0) | ATT_EOI, ESDI_ATTN); | ||
819 | break; | ||
820 | |||
821 | case INT_ATTN_ERROR: | ||
822 | printk("%s: Attention error. interrupt status : %02X\n", DEVICE_NAME, | ||
823 | int_ret_code); | ||
824 | printk("%s: Device not available\n", DEVICE_NAME); | ||
825 | break; | ||
826 | case INT_CMD_ECC: | ||
827 | case INT_CMD_RETRY: | ||
828 | case INT_CMD_ECC_RETRY: | ||
829 | case INT_CMD_WARNING: | ||
830 | case INT_CMD_ABORT: | ||
831 | case INT_CMD_FAILED: | ||
832 | case INT_DMA_ERR: | ||
833 | case INT_CMD_BLK_ERR: | ||
834 | /*BA */ printk("%s: Whaa. Error occurred...\n", DEVICE_NAME); | ||
835 | dump_cmd_complete_status(int_ret_code); | ||
836 | outb((int_ret_code & 0xe0) | ATT_EOI, ESDI_ATTN); | ||
837 | break; | ||
838 | default: | ||
839 | printk("%s: Unknown interrupt reason: %02X\n", | ||
840 | DEVICE_NAME, int_ret_code & 0xf); | ||
841 | outb((int_ret_code & 0xe0) | ATT_EOI, ESDI_ATTN); | ||
842 | break; | ||
843 | } | ||
844 | |||
845 | wake_up(&ps2esdi_int); | ||
846 | no_int_yet = FALSE; | ||
847 | outb(CTRL_ENABLE_INTR, ESDI_CONTROL); | ||
848 | |||
849 | } | ||
850 | |||
851 | static void ps2esdi_normal_interrupt_handler(u_int int_ret_code) | ||
852 | { | ||
853 | unsigned long flags; | ||
854 | u_int status; | ||
855 | u_int ending; | ||
856 | int i; | ||
857 | |||
858 | switch (int_ret_code & 0x0f) { | ||
859 | case INT_TRANSFER_REQ: | ||
860 | ps2esdi_prep_dma(current_req->buffer, | ||
861 | current_req->current_nr_sectors, | ||
862 | (rq_data_dir(current_req) == READ) | ||
863 | ? MCA_DMA_MODE_16 | MCA_DMA_MODE_WRITE | MCA_DMA_MODE_XFER | ||
864 | : MCA_DMA_MODE_16 | MCA_DMA_MODE_READ); | ||
865 | outb(CTRL_ENABLE_DMA | CTRL_ENABLE_INTR, ESDI_CONTROL); | ||
866 | ending = -1; | ||
867 | break; | ||
868 | |||
869 | case INT_ATTN_ERROR: | ||
870 | printk("%s: Attention error. interrupt status : %02X\n", DEVICE_NAME, | ||
871 | int_ret_code); | ||
872 | outb(CTRL_ENABLE_INTR, ESDI_CONTROL); | ||
873 | ending = FAIL; | ||
874 | break; | ||
875 | |||
876 | case INT_CMD_COMPLETE: | ||
877 | for (i = ESDI_TIMEOUT; i && !(inb(ESDI_STATUS) & STATUS_STAT_AVAIL); i--); | ||
878 | if (!(inb(ESDI_STATUS) & STATUS_STAT_AVAIL)) { | ||
879 | printk("%s: timeout reading status word\n", DEVICE_NAME); | ||
880 | outb((int_ret_code & 0xe0) | ATT_EOI, ESDI_ATTN); | ||
881 | outb(CTRL_ENABLE_INTR, ESDI_CONTROL); | ||
882 | if ((++current_req->errors) >= MAX_RETRIES) | ||
883 | ending = FAIL; | ||
884 | else | ||
885 | ending = -1; | ||
886 | break; | ||
887 | } | ||
888 | status = inw(ESDI_STT_INT); | ||
889 | switch (status & 0x1F) { | ||
890 | case (CMD_READ & 0xff): | ||
891 | case (CMD_WRITE & 0xff): | ||
892 | LITE_OFF; | ||
893 | outb((int_ret_code & 0xe0) | ATT_EOI, ESDI_ATTN); | ||
894 | outb(CTRL_ENABLE_INTR, ESDI_CONTROL); | ||
895 | ending = SUCCES; | ||
896 | break; | ||
897 | default: | ||
898 | printk("%s: interrupt for unknown command %02X\n", | ||
899 | DEVICE_NAME, status & 0x1f); | ||
900 | outb((int_ret_code & 0xe0) | ATT_EOI, ESDI_ATTN); | ||
901 | outb(CTRL_ENABLE_INTR, ESDI_CONTROL); | ||
902 | ending = -1; | ||
903 | break; | ||
904 | } | ||
905 | break; | ||
906 | case INT_CMD_ECC: | ||
907 | case INT_CMD_RETRY: | ||
908 | case INT_CMD_ECC_RETRY: | ||
909 | LITE_OFF; | ||
910 | dump_cmd_complete_status(int_ret_code); | ||
911 | outb((int_ret_code & 0xe0) | ATT_EOI, ESDI_ATTN); | ||
912 | outb(CTRL_ENABLE_INTR, ESDI_CONTROL); | ||
913 | ending = SUCCES; | ||
914 | break; | ||
915 | case INT_CMD_WARNING: | ||
916 | case INT_CMD_ABORT: | ||
917 | case INT_CMD_FAILED: | ||
918 | case INT_DMA_ERR: | ||
919 | LITE_OFF; | ||
920 | dump_cmd_complete_status(int_ret_code); | ||
921 | outb((int_ret_code & 0xe0) | ATT_EOI, ESDI_ATTN); | ||
922 | outb(CTRL_ENABLE_INTR, ESDI_CONTROL); | ||
923 | if ((++current_req->errors) >= MAX_RETRIES) | ||
924 | ending = FAIL; | ||
925 | else | ||
926 | ending = -1; | ||
927 | break; | ||
928 | |||
929 | case INT_CMD_BLK_ERR: | ||
930 | dump_cmd_complete_status(int_ret_code); | ||
931 | outb((int_ret_code & 0xe0) | ATT_EOI, ESDI_ATTN); | ||
932 | outb(CTRL_ENABLE_INTR, ESDI_CONTROL); | ||
933 | ending = FAIL; | ||
934 | break; | ||
935 | |||
936 | case INT_CMD_FORMAT: | ||
937 | printk("%s: huh ? Who issued this format command ?\n" | ||
938 | ,DEVICE_NAME); | ||
939 | outb((int_ret_code & 0xe0) | ATT_EOI, ESDI_ATTN); | ||
940 | outb(CTRL_ENABLE_INTR, ESDI_CONTROL); | ||
941 | ending = -1; | ||
942 | break; | ||
943 | |||
944 | case INT_RESET: | ||
945 | /* BA printk("%s: reset completed.\n", DEVICE_NAME) */ ; | ||
946 | outb((int_ret_code & 0xe0) | ATT_EOI, ESDI_ATTN); | ||
947 | outb(CTRL_ENABLE_INTR, ESDI_CONTROL); | ||
948 | ending = -1; | ||
949 | break; | ||
950 | |||
951 | default: | ||
952 | printk("%s: Unknown interrupt reason: %02X\n", | ||
953 | DEVICE_NAME, int_ret_code & 0xf); | ||
954 | outb((int_ret_code & 0xe0) | ATT_EOI, ESDI_ATTN); | ||
955 | outb(CTRL_ENABLE_INTR, ESDI_CONTROL); | ||
956 | ending = -1; | ||
957 | break; | ||
958 | } | ||
959 | if(ending != -1) { | ||
960 | spin_lock_irqsave(&ps2esdi_lock, flags); | ||
961 | end_request(current_req, ending); | ||
962 | current_req = NULL; | ||
963 | do_ps2esdi_request(ps2esdi_queue); | ||
964 | spin_unlock_irqrestore(&ps2esdi_lock, flags); | ||
965 | } | ||
966 | } /* handle interrupts */ | ||
967 | |||
968 | |||
969 | |||
970 | static int ps2esdi_read_status_words(int num_words, | ||
971 | int max_words, | ||
972 | u_short * buffer) | ||
973 | { | ||
974 | int i; | ||
975 | |||
976 | for (; max_words && num_words; max_words--, num_words--, buffer++) { | ||
977 | for (i = ESDI_TIMEOUT; i && !(inb(ESDI_STATUS) & STATUS_STAT_AVAIL); i--); | ||
978 | if (!(inb(ESDI_STATUS) & STATUS_STAT_AVAIL)) { | ||
979 | printk("%s: timeout reading status word\n", DEVICE_NAME); | ||
980 | return FAIL; | ||
981 | } | ||
982 | *buffer = inw(ESDI_STT_INT); | ||
983 | } | ||
984 | return SUCCES; | ||
985 | } | ||
986 | |||
987 | |||
988 | |||
989 | |||
990 | static void dump_cmd_complete_status(u_int int_ret_code) | ||
991 | { | ||
992 | #define WAIT_FOR_STATUS \ | ||
993 | for(i=ESDI_TIMEOUT;i && !(inb(ESDI_STATUS) & STATUS_STAT_AVAIL);i--); \ | ||
994 | if(!(inb(ESDI_STATUS) & STATUS_STAT_AVAIL)) { \ | ||
995 | printk("%s: timeout reading status word\n",DEVICE_NAME); \ | ||
996 | return; \ | ||
997 | } | ||
998 | |||
999 | int i, word_count; | ||
1000 | u_short stat_word; | ||
1001 | u_long rba; | ||
1002 | |||
1003 | printk("%s: Device: %u, interrupt ID: %02X\n", | ||
1004 | DEVICE_NAME, int_ret_code >> 5, | ||
1005 | int_ret_code & 0xf); | ||
1006 | |||
1007 | WAIT_FOR_STATUS; | ||
1008 | stat_word = inw(ESDI_STT_INT); | ||
1009 | word_count = (stat_word >> 8) - 1; | ||
1010 | printk("%s: %u status words, command: %02X\n", DEVICE_NAME, word_count, | ||
1011 | stat_word & 0xff); | ||
1012 | |||
1013 | if (word_count--) { | ||
1014 | WAIT_FOR_STATUS; | ||
1015 | stat_word = inw(ESDI_STT_INT); | ||
1016 | printk("%s: command status code: %02X, command error code: %02X\n", | ||
1017 | DEVICE_NAME, stat_word >> 8, stat_word & 0xff); | ||
1018 | } | ||
1019 | if (word_count--) { | ||
1020 | WAIT_FOR_STATUS; | ||
1021 | stat_word = inw(ESDI_STT_INT); | ||
1022 | printk("%s: device error code: %s%s%s%s%s,%02X\n", DEVICE_NAME, | ||
1023 | (stat_word & 0x1000) ? "Ready, " : "Not Ready, ", | ||
1024 | (stat_word & 0x0800) ? "Selected, " : "Not Selected, ", | ||
1025 | (stat_word & 0x0400) ? "Write Fault, " : "", | ||
1026 | (stat_word & 0x0200) ? "Track 0, " : "", | ||
1027 | (stat_word & 0x0100) ? "Seek or command complete, " : "", | ||
1028 | stat_word >> 8); | ||
1029 | } | ||
1030 | if (word_count--) { | ||
1031 | WAIT_FOR_STATUS; | ||
1032 | stat_word = inw(ESDI_STT_INT); | ||
1033 | printk("%s: Blocks to do: %u", DEVICE_NAME, stat_word); | ||
1034 | } | ||
1035 | if (word_count -= 2) { | ||
1036 | WAIT_FOR_STATUS; | ||
1037 | rba = inw(ESDI_STT_INT); | ||
1038 | WAIT_FOR_STATUS; | ||
1039 | rba |= inw(ESDI_STT_INT) << 16; | ||
1040 | printk(", Last Cyl: %u Head: %u Sector: %u\n", | ||
1041 | (u_short) ((rba & 0x1ff80000) >> 11), | ||
1042 | (u_short) ((rba & 0x7E0) >> 5), (u_short) (rba & 0x1f)); | ||
1043 | } else | ||
1044 | printk("\n"); | ||
1045 | |||
1046 | if (word_count--) { | ||
1047 | WAIT_FOR_STATUS; | ||
1048 | stat_word = inw(ESDI_STT_INT); | ||
1049 | printk("%s: Blocks required ECC: %u", DEVICE_NAME, stat_word); | ||
1050 | } | ||
1051 | printk("\n"); | ||
1052 | |||
1053 | #undef WAIT_FOR_STATUS | ||
1054 | |||
1055 | } | ||
1056 | |||
1057 | static int ps2esdi_getgeo(struct block_device *bdev, struct hd_geometry *geo) | ||
1058 | { | ||
1059 | struct ps2esdi_i_struct *p = bdev->bd_disk->private_data; | ||
1060 | |||
1061 | geo->heads = p->head; | ||
1062 | geo->sectors = p->sect; | ||
1063 | geo->cylinders = p->cyl; | ||
1064 | return 0; | ||
1065 | } | ||
1066 | |||
1067 | static void ps2esdi_reset_timer(unsigned long unused) | ||
1068 | { | ||
1069 | |||
1070 | int status; | ||
1071 | |||
1072 | status = inb(ESDI_INTRPT); | ||
1073 | if ((status & 0xf) == INT_RESET) { | ||
1074 | outb((status & 0xe0) | ATT_EOI, ESDI_ATTN); | ||
1075 | outb(CTRL_ENABLE_INTR, ESDI_CONTROL); | ||
1076 | reset_status = 1; | ||
1077 | } | ||
1078 | wake_up(&ps2esdi_int); | ||
1079 | } | ||
diff --git a/drivers/block/virtio_blk.c b/drivers/block/virtio_blk.c index 3b1a68d6eddb..0cfbe8c594a5 100644 --- a/drivers/block/virtio_blk.c +++ b/drivers/block/virtio_blk.c | |||
@@ -238,6 +238,7 @@ static int virtblk_probe(struct virtio_device *vdev) | |||
238 | vblk->disk->first_minor = index_to_minor(index); | 238 | vblk->disk->first_minor = index_to_minor(index); |
239 | vblk->disk->private_data = vblk; | 239 | vblk->disk->private_data = vblk; |
240 | vblk->disk->fops = &virtblk_fops; | 240 | vblk->disk->fops = &virtblk_fops; |
241 | vblk->disk->driverfs_dev = &vdev->dev; | ||
241 | index++; | 242 | index++; |
242 | 243 | ||
243 | /* If barriers are supported, tell block layer that queue is ordered */ | 244 | /* If barriers are supported, tell block layer that queue is ordered */ |
diff --git a/drivers/char/drm/ati_pcigart.c b/drivers/char/drm/ati_pcigart.c index d352dbb4ccf7..e5a0e97cfdda 100644 --- a/drivers/char/drm/ati_pcigart.c +++ b/drivers/char/drm/ati_pcigart.c | |||
@@ -35,42 +35,23 @@ | |||
35 | 35 | ||
36 | # define ATI_PCIGART_PAGE_SIZE 4096 /**< PCI GART page size */ | 36 | # define ATI_PCIGART_PAGE_SIZE 4096 /**< PCI GART page size */ |
37 | 37 | ||
38 | static void *drm_ati_alloc_pcigart_table(int order) | 38 | static int drm_ati_alloc_pcigart_table(struct drm_device *dev, |
39 | struct drm_ati_pcigart_info *gart_info) | ||
39 | { | 40 | { |
40 | unsigned long address; | 41 | gart_info->table_handle = drm_pci_alloc(dev, gart_info->table_size, |
41 | struct page *page; | 42 | PAGE_SIZE, |
42 | int i; | 43 | gart_info->table_mask); |
43 | 44 | if (gart_info->table_handle == NULL) | |
44 | DRM_DEBUG("%d order\n", order); | 45 | return -ENOMEM; |
45 | |||
46 | address = __get_free_pages(GFP_KERNEL | __GFP_COMP, | ||
47 | order); | ||
48 | if (address == 0UL) { | ||
49 | return NULL; | ||
50 | } | ||
51 | |||
52 | page = virt_to_page(address); | ||
53 | 46 | ||
54 | for (i = 0; i < order; i++, page++) | 47 | return 0; |
55 | SetPageReserved(page); | ||
56 | |||
57 | DRM_DEBUG("returning 0x%08lx\n", address); | ||
58 | return (void *)address; | ||
59 | } | 48 | } |
60 | 49 | ||
61 | static void drm_ati_free_pcigart_table(void *address, int order) | 50 | static void drm_ati_free_pcigart_table(struct drm_device *dev, |
51 | struct drm_ati_pcigart_info *gart_info) | ||
62 | { | 52 | { |
63 | struct page *page; | 53 | drm_pci_free(dev, gart_info->table_handle); |
64 | int i; | 54 | gart_info->table_handle = NULL; |
65 | int num_pages = 1 << order; | ||
66 | DRM_DEBUG("\n"); | ||
67 | |||
68 | page = virt_to_page((unsigned long)address); | ||
69 | |||
70 | for (i = 0; i < num_pages; i++, page++) | ||
71 | ClearPageReserved(page); | ||
72 | |||
73 | free_pages((unsigned long)address, order); | ||
74 | } | 55 | } |
75 | 56 | ||
76 | int drm_ati_pcigart_cleanup(struct drm_device *dev, struct drm_ati_pcigart_info *gart_info) | 57 | int drm_ati_pcigart_cleanup(struct drm_device *dev, struct drm_ati_pcigart_info *gart_info) |
@@ -78,8 +59,7 @@ int drm_ati_pcigart_cleanup(struct drm_device *dev, struct drm_ati_pcigart_info | |||
78 | struct drm_sg_mem *entry = dev->sg; | 59 | struct drm_sg_mem *entry = dev->sg; |
79 | unsigned long pages; | 60 | unsigned long pages; |
80 | int i; | 61 | int i; |
81 | int order; | 62 | int max_pages; |
82 | int num_pages, max_pages; | ||
83 | 63 | ||
84 | /* we need to support large memory configurations */ | 64 | /* we need to support large memory configurations */ |
85 | if (!entry) { | 65 | if (!entry) { |
@@ -87,15 +67,7 @@ int drm_ati_pcigart_cleanup(struct drm_device *dev, struct drm_ati_pcigart_info | |||
87 | return 0; | 67 | return 0; |
88 | } | 68 | } |
89 | 69 | ||
90 | order = drm_order((gart_info->table_size + (PAGE_SIZE-1)) / PAGE_SIZE); | ||
91 | num_pages = 1 << order; | ||
92 | |||
93 | if (gart_info->bus_addr) { | 70 | if (gart_info->bus_addr) { |
94 | if (gart_info->gart_table_location == DRM_ATI_GART_MAIN) { | ||
95 | pci_unmap_single(dev->pdev, gart_info->bus_addr, | ||
96 | num_pages * PAGE_SIZE, | ||
97 | PCI_DMA_TODEVICE); | ||
98 | } | ||
99 | 71 | ||
100 | max_pages = (gart_info->table_size / sizeof(u32)); | 72 | max_pages = (gart_info->table_size / sizeof(u32)); |
101 | pages = (entry->pages <= max_pages) | 73 | pages = (entry->pages <= max_pages) |
@@ -112,10 +84,9 @@ int drm_ati_pcigart_cleanup(struct drm_device *dev, struct drm_ati_pcigart_info | |||
112 | gart_info->bus_addr = 0; | 84 | gart_info->bus_addr = 0; |
113 | } | 85 | } |
114 | 86 | ||
115 | if (gart_info->gart_table_location == DRM_ATI_GART_MAIN | 87 | if (gart_info->gart_table_location == DRM_ATI_GART_MAIN && |
116 | && gart_info->addr) { | 88 | gart_info->table_handle) { |
117 | drm_ati_free_pcigart_table(gart_info->addr, order); | 89 | drm_ati_free_pcigart_table(dev, gart_info); |
118 | gart_info->addr = NULL; | ||
119 | } | 90 | } |
120 | 91 | ||
121 | return 1; | 92 | return 1; |
@@ -127,11 +98,10 @@ int drm_ati_pcigart_init(struct drm_device *dev, struct drm_ati_pcigart_info *ga | |||
127 | struct drm_sg_mem *entry = dev->sg; | 98 | struct drm_sg_mem *entry = dev->sg; |
128 | void *address = NULL; | 99 | void *address = NULL; |
129 | unsigned long pages; | 100 | unsigned long pages; |
130 | u32 *pci_gart, page_base, bus_address = 0; | 101 | u32 *pci_gart, page_base; |
102 | dma_addr_t bus_address = 0; | ||
131 | int i, j, ret = 0; | 103 | int i, j, ret = 0; |
132 | int order; | ||
133 | int max_pages; | 104 | int max_pages; |
134 | int num_pages; | ||
135 | 105 | ||
136 | if (!entry) { | 106 | if (!entry) { |
137 | DRM_ERROR("no scatter/gather memory!\n"); | 107 | DRM_ERROR("no scatter/gather memory!\n"); |
@@ -141,31 +111,14 @@ int drm_ati_pcigart_init(struct drm_device *dev, struct drm_ati_pcigart_info *ga | |||
141 | if (gart_info->gart_table_location == DRM_ATI_GART_MAIN) { | 111 | if (gart_info->gart_table_location == DRM_ATI_GART_MAIN) { |
142 | DRM_DEBUG("PCI: no table in VRAM: using normal RAM\n"); | 112 | DRM_DEBUG("PCI: no table in VRAM: using normal RAM\n"); |
143 | 113 | ||
144 | order = drm_order((gart_info->table_size + | 114 | ret = drm_ati_alloc_pcigart_table(dev, gart_info); |
145 | (PAGE_SIZE-1)) / PAGE_SIZE); | 115 | if (ret) { |
146 | num_pages = 1 << order; | ||
147 | address = drm_ati_alloc_pcigart_table(order); | ||
148 | if (!address) { | ||
149 | DRM_ERROR("cannot allocate PCI GART page!\n"); | 116 | DRM_ERROR("cannot allocate PCI GART page!\n"); |
150 | goto done; | 117 | goto done; |
151 | } | 118 | } |
152 | 119 | ||
153 | if (!dev->pdev) { | 120 | address = gart_info->table_handle->vaddr; |
154 | DRM_ERROR("PCI device unknown!\n"); | 121 | bus_address = gart_info->table_handle->busaddr; |
155 | goto done; | ||
156 | } | ||
157 | |||
158 | bus_address = pci_map_single(dev->pdev, address, | ||
159 | num_pages * PAGE_SIZE, | ||
160 | PCI_DMA_TODEVICE); | ||
161 | if (bus_address == 0) { | ||
162 | DRM_ERROR("unable to map PCIGART pages!\n"); | ||
163 | order = drm_order((gart_info->table_size + | ||
164 | (PAGE_SIZE-1)) / PAGE_SIZE); | ||
165 | drm_ati_free_pcigart_table(address, order); | ||
166 | address = NULL; | ||
167 | goto done; | ||
168 | } | ||
169 | } else { | 122 | } else { |
170 | address = gart_info->addr; | 123 | address = gart_info->addr; |
171 | bus_address = gart_info->bus_addr; | 124 | bus_address = gart_info->bus_addr; |
diff --git a/drivers/char/drm/drmP.h b/drivers/char/drm/drmP.h index a6789f25009b..8ea9dd1717a9 100644 --- a/drivers/char/drm/drmP.h +++ b/drivers/char/drm/drmP.h | |||
@@ -54,6 +54,7 @@ | |||
54 | #include <linux/pci.h> | 54 | #include <linux/pci.h> |
55 | #include <linux/jiffies.h> | 55 | #include <linux/jiffies.h> |
56 | #include <linux/smp_lock.h> /* For (un)lock_kernel */ | 56 | #include <linux/smp_lock.h> /* For (un)lock_kernel */ |
57 | #include <linux/dma-mapping.h> | ||
57 | #include <linux/mm.h> | 58 | #include <linux/mm.h> |
58 | #include <linux/cdev.h> | 59 | #include <linux/cdev.h> |
59 | #include <linux/mutex.h> | 60 | #include <linux/mutex.h> |
@@ -551,6 +552,8 @@ struct drm_ati_pcigart_info { | |||
551 | int gart_reg_if; | 552 | int gart_reg_if; |
552 | void *addr; | 553 | void *addr; |
553 | dma_addr_t bus_addr; | 554 | dma_addr_t bus_addr; |
555 | dma_addr_t table_mask; | ||
556 | struct drm_dma_handle *table_handle; | ||
554 | drm_local_map_t mapping; | 557 | drm_local_map_t mapping; |
555 | int table_size; | 558 | int table_size; |
556 | }; | 559 | }; |
diff --git a/drivers/char/drm/drm_fops.c b/drivers/char/drm/drm_fops.c index 3992f73299cc..f09d4b5002b0 100644 --- a/drivers/char/drm/drm_fops.c +++ b/drivers/char/drm/drm_fops.c | |||
@@ -326,6 +326,7 @@ int drm_release(struct inode *inode, struct file *filp) | |||
326 | struct drm_file *file_priv = filp->private_data; | 326 | struct drm_file *file_priv = filp->private_data; |
327 | struct drm_device *dev = file_priv->head->dev; | 327 | struct drm_device *dev = file_priv->head->dev; |
328 | int retcode = 0; | 328 | int retcode = 0; |
329 | unsigned long irqflags; | ||
329 | 330 | ||
330 | lock_kernel(); | 331 | lock_kernel(); |
331 | 332 | ||
@@ -357,9 +358,11 @@ int drm_release(struct inode *inode, struct file *filp) | |||
357 | */ | 358 | */ |
358 | 359 | ||
359 | do{ | 360 | do{ |
360 | spin_lock(&dev->lock.spinlock); | 361 | spin_lock_irqsave(&dev->lock.spinlock, |
362 | irqflags); | ||
361 | locked = dev->lock.idle_has_lock; | 363 | locked = dev->lock.idle_has_lock; |
362 | spin_unlock(&dev->lock.spinlock); | 364 | spin_unlock_irqrestore(&dev->lock.spinlock, |
365 | irqflags); | ||
363 | if (locked) | 366 | if (locked) |
364 | break; | 367 | break; |
365 | schedule(); | 368 | schedule(); |
diff --git a/drivers/char/drm/drm_lock.c b/drivers/char/drm/drm_lock.c index bea2a7d5b2b2..12dcdd1832f0 100644 --- a/drivers/char/drm/drm_lock.c +++ b/drivers/char/drm/drm_lock.c | |||
@@ -53,6 +53,7 @@ int drm_lock(struct drm_device *dev, void *data, struct drm_file *file_priv) | |||
53 | DECLARE_WAITQUEUE(entry, current); | 53 | DECLARE_WAITQUEUE(entry, current); |
54 | struct drm_lock *lock = data; | 54 | struct drm_lock *lock = data; |
55 | int ret = 0; | 55 | int ret = 0; |
56 | unsigned long irqflags; | ||
56 | 57 | ||
57 | ++file_priv->lock_count; | 58 | ++file_priv->lock_count; |
58 | 59 | ||
@@ -71,9 +72,9 @@ int drm_lock(struct drm_device *dev, void *data, struct drm_file *file_priv) | |||
71 | return -EINVAL; | 72 | return -EINVAL; |
72 | 73 | ||
73 | add_wait_queue(&dev->lock.lock_queue, &entry); | 74 | add_wait_queue(&dev->lock.lock_queue, &entry); |
74 | spin_lock(&dev->lock.spinlock); | 75 | spin_lock_irqsave(&dev->lock.spinlock, irqflags); |
75 | dev->lock.user_waiters++; | 76 | dev->lock.user_waiters++; |
76 | spin_unlock(&dev->lock.spinlock); | 77 | spin_unlock_irqrestore(&dev->lock.spinlock, irqflags); |
77 | for (;;) { | 78 | for (;;) { |
78 | __set_current_state(TASK_INTERRUPTIBLE); | 79 | __set_current_state(TASK_INTERRUPTIBLE); |
79 | if (!dev->lock.hw_lock) { | 80 | if (!dev->lock.hw_lock) { |
@@ -95,9 +96,9 @@ int drm_lock(struct drm_device *dev, void *data, struct drm_file *file_priv) | |||
95 | break; | 96 | break; |
96 | } | 97 | } |
97 | } | 98 | } |
98 | spin_lock(&dev->lock.spinlock); | 99 | spin_lock_irqsave(&dev->lock.spinlock, irqflags); |
99 | dev->lock.user_waiters--; | 100 | dev->lock.user_waiters--; |
100 | spin_unlock(&dev->lock.spinlock); | 101 | spin_unlock_irqrestore(&dev->lock.spinlock, irqflags); |
101 | __set_current_state(TASK_RUNNING); | 102 | __set_current_state(TASK_RUNNING); |
102 | remove_wait_queue(&dev->lock.lock_queue, &entry); | 103 | remove_wait_queue(&dev->lock.lock_queue, &entry); |
103 | 104 | ||
@@ -198,8 +199,9 @@ int drm_lock_take(struct drm_lock_data *lock_data, | |||
198 | { | 199 | { |
199 | unsigned int old, new, prev; | 200 | unsigned int old, new, prev; |
200 | volatile unsigned int *lock = &lock_data->hw_lock->lock; | 201 | volatile unsigned int *lock = &lock_data->hw_lock->lock; |
202 | unsigned long irqflags; | ||
201 | 203 | ||
202 | spin_lock(&lock_data->spinlock); | 204 | spin_lock_irqsave(&lock_data->spinlock, irqflags); |
203 | do { | 205 | do { |
204 | old = *lock; | 206 | old = *lock; |
205 | if (old & _DRM_LOCK_HELD) | 207 | if (old & _DRM_LOCK_HELD) |
@@ -211,7 +213,7 @@ int drm_lock_take(struct drm_lock_data *lock_data, | |||
211 | } | 213 | } |
212 | prev = cmpxchg(lock, old, new); | 214 | prev = cmpxchg(lock, old, new); |
213 | } while (prev != old); | 215 | } while (prev != old); |
214 | spin_unlock(&lock_data->spinlock); | 216 | spin_unlock_irqrestore(&lock_data->spinlock, irqflags); |
215 | 217 | ||
216 | if (_DRM_LOCKING_CONTEXT(old) == context) { | 218 | if (_DRM_LOCKING_CONTEXT(old) == context) { |
217 | if (old & _DRM_LOCK_HELD) { | 219 | if (old & _DRM_LOCK_HELD) { |
@@ -272,15 +274,16 @@ int drm_lock_free(struct drm_lock_data *lock_data, unsigned int context) | |||
272 | { | 274 | { |
273 | unsigned int old, new, prev; | 275 | unsigned int old, new, prev; |
274 | volatile unsigned int *lock = &lock_data->hw_lock->lock; | 276 | volatile unsigned int *lock = &lock_data->hw_lock->lock; |
277 | unsigned long irqflags; | ||
275 | 278 | ||
276 | spin_lock(&lock_data->spinlock); | 279 | spin_lock_irqsave(&lock_data->spinlock, irqflags); |
277 | if (lock_data->kernel_waiters != 0) { | 280 | if (lock_data->kernel_waiters != 0) { |
278 | drm_lock_transfer(lock_data, 0); | 281 | drm_lock_transfer(lock_data, 0); |
279 | lock_data->idle_has_lock = 1; | 282 | lock_data->idle_has_lock = 1; |
280 | spin_unlock(&lock_data->spinlock); | 283 | spin_unlock_irqrestore(&lock_data->spinlock, irqflags); |
281 | return 1; | 284 | return 1; |
282 | } | 285 | } |
283 | spin_unlock(&lock_data->spinlock); | 286 | spin_unlock_irqrestore(&lock_data->spinlock, irqflags); |
284 | 287 | ||
285 | do { | 288 | do { |
286 | old = *lock; | 289 | old = *lock; |
@@ -344,19 +347,20 @@ static int drm_notifier(void *priv) | |||
344 | void drm_idlelock_take(struct drm_lock_data *lock_data) | 347 | void drm_idlelock_take(struct drm_lock_data *lock_data) |
345 | { | 348 | { |
346 | int ret = 0; | 349 | int ret = 0; |
350 | unsigned long irqflags; | ||
347 | 351 | ||
348 | spin_lock(&lock_data->spinlock); | 352 | spin_lock_irqsave(&lock_data->spinlock, irqflags); |
349 | lock_data->kernel_waiters++; | 353 | lock_data->kernel_waiters++; |
350 | if (!lock_data->idle_has_lock) { | 354 | if (!lock_data->idle_has_lock) { |
351 | 355 | ||
352 | spin_unlock(&lock_data->spinlock); | 356 | spin_unlock_irqrestore(&lock_data->spinlock, irqflags); |
353 | ret = drm_lock_take(lock_data, DRM_KERNEL_CONTEXT); | 357 | ret = drm_lock_take(lock_data, DRM_KERNEL_CONTEXT); |
354 | spin_lock(&lock_data->spinlock); | 358 | spin_lock_irqsave(&lock_data->spinlock, irqflags); |
355 | 359 | ||
356 | if (ret == 1) | 360 | if (ret == 1) |
357 | lock_data->idle_has_lock = 1; | 361 | lock_data->idle_has_lock = 1; |
358 | } | 362 | } |
359 | spin_unlock(&lock_data->spinlock); | 363 | spin_unlock_irqrestore(&lock_data->spinlock, irqflags); |
360 | } | 364 | } |
361 | EXPORT_SYMBOL(drm_idlelock_take); | 365 | EXPORT_SYMBOL(drm_idlelock_take); |
362 | 366 | ||
@@ -364,8 +368,9 @@ void drm_idlelock_release(struct drm_lock_data *lock_data) | |||
364 | { | 368 | { |
365 | unsigned int old, prev; | 369 | unsigned int old, prev; |
366 | volatile unsigned int *lock = &lock_data->hw_lock->lock; | 370 | volatile unsigned int *lock = &lock_data->hw_lock->lock; |
371 | unsigned long irqflags; | ||
367 | 372 | ||
368 | spin_lock(&lock_data->spinlock); | 373 | spin_lock_irqsave(&lock_data->spinlock, irqflags); |
369 | if (--lock_data->kernel_waiters == 0) { | 374 | if (--lock_data->kernel_waiters == 0) { |
370 | if (lock_data->idle_has_lock) { | 375 | if (lock_data->idle_has_lock) { |
371 | do { | 376 | do { |
@@ -376,7 +381,7 @@ void drm_idlelock_release(struct drm_lock_data *lock_data) | |||
376 | lock_data->idle_has_lock = 0; | 381 | lock_data->idle_has_lock = 0; |
377 | } | 382 | } |
378 | } | 383 | } |
379 | spin_unlock(&lock_data->spinlock); | 384 | spin_unlock_irqrestore(&lock_data->spinlock, irqflags); |
380 | } | 385 | } |
381 | EXPORT_SYMBOL(drm_idlelock_release); | 386 | EXPORT_SYMBOL(drm_idlelock_release); |
382 | 387 | ||
diff --git a/drivers/char/drm/drm_pciids.h b/drivers/char/drm/drm_pciids.h index 715b361f0c2b..a6a499f97e22 100644 --- a/drivers/char/drm/drm_pciids.h +++ b/drivers/char/drm/drm_pciids.h | |||
@@ -205,9 +205,9 @@ | |||
205 | {0x1002, 0x71D6, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV530|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \ | 205 | {0x1002, 0x71D6, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV530|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \ |
206 | {0x1002, 0x71DA, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV530|RADEON_NEW_MEMMAP}, \ | 206 | {0x1002, 0x71DA, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV530|RADEON_NEW_MEMMAP}, \ |
207 | {0x1002, 0x71DE, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV530|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \ | 207 | {0x1002, 0x71DE, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV530|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \ |
208 | {0x1002, 0x7200, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV530|RADEON_NEW_MEMMAP}, \ | 208 | {0x1002, 0x7200, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV515|RADEON_NEW_MEMMAP}, \ |
209 | {0x1002, 0x7210, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV530|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \ | 209 | {0x1002, 0x7210, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV515|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \ |
210 | {0x1002, 0x7211, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV530|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \ | 210 | {0x1002, 0x7211, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV515|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \ |
211 | {0x1002, 0x7240, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_R580|RADEON_NEW_MEMMAP}, \ | 211 | {0x1002, 0x7240, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_R580|RADEON_NEW_MEMMAP}, \ |
212 | {0x1002, 0x7243, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_R580|RADEON_NEW_MEMMAP}, \ | 212 | {0x1002, 0x7243, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_R580|RADEON_NEW_MEMMAP}, \ |
213 | {0x1002, 0x7244, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_R580|RADEON_NEW_MEMMAP}, \ | 213 | {0x1002, 0x7244, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_R580|RADEON_NEW_MEMMAP}, \ |
@@ -238,6 +238,7 @@ | |||
238 | {0x1002, 0x7834, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RS300|RADEON_IS_IGP|RADEON_NEW_MEMMAP}, \ | 238 | {0x1002, 0x7834, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RS300|RADEON_IS_IGP|RADEON_NEW_MEMMAP}, \ |
239 | {0x1002, 0x7835, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RS300|RADEON_IS_IGP|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \ | 239 | {0x1002, 0x7835, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RS300|RADEON_IS_IGP|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \ |
240 | {0x1002, 0x791e, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RS690|RADEON_IS_IGP|RADEON_NEW_MEMMAP|RADEON_IS_IGPGART}, \ | 240 | {0x1002, 0x791e, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RS690|RADEON_IS_IGP|RADEON_NEW_MEMMAP|RADEON_IS_IGPGART}, \ |
241 | {0x1002, 0x791f, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RS690|RADEON_IS_IGP|RADEON_NEW_MEMMAP|RADEON_IS_IGPGART}, \ | ||
241 | {0, 0, 0} | 242 | {0, 0, 0} |
242 | 243 | ||
243 | #define r128_PCI_IDS \ | 244 | #define r128_PCI_IDS \ |
diff --git a/drivers/char/drm/r128_cce.c b/drivers/char/drm/r128_cce.c index 892e0a589846..f36adbd3aaf5 100644 --- a/drivers/char/drm/r128_cce.c +++ b/drivers/char/drm/r128_cce.c | |||
@@ -558,6 +558,7 @@ static int r128_do_init_cce(struct drm_device * dev, drm_r128_init_t * init) | |||
558 | #if __OS_HAS_AGP | 558 | #if __OS_HAS_AGP |
559 | if (dev_priv->is_pci) { | 559 | if (dev_priv->is_pci) { |
560 | #endif | 560 | #endif |
561 | dev_priv->gart_info.table_mask = DMA_BIT_MASK(32); | ||
561 | dev_priv->gart_info.gart_table_location = DRM_ATI_GART_MAIN; | 562 | dev_priv->gart_info.gart_table_location = DRM_ATI_GART_MAIN; |
562 | dev_priv->gart_info.table_size = R128_PCIGART_TABLE_SIZE; | 563 | dev_priv->gart_info.table_size = R128_PCIGART_TABLE_SIZE; |
563 | dev_priv->gart_info.addr = NULL; | 564 | dev_priv->gart_info.addr = NULL; |
diff --git a/drivers/char/drm/radeon_cp.c b/drivers/char/drm/radeon_cp.c index 833abc7e55fb..9072e4a1894e 100644 --- a/drivers/char/drm/radeon_cp.c +++ b/drivers/char/drm/radeon_cp.c | |||
@@ -1807,6 +1807,7 @@ static int radeon_do_init_cp(struct drm_device * dev, drm_radeon_init_t * init) | |||
1807 | } else | 1807 | } else |
1808 | #endif | 1808 | #endif |
1809 | { | 1809 | { |
1810 | dev_priv->gart_info.table_mask = DMA_BIT_MASK(32); | ||
1810 | /* if we have an offset set from userspace */ | 1811 | /* if we have an offset set from userspace */ |
1811 | if (dev_priv->pcigart_offset_set) { | 1812 | if (dev_priv->pcigart_offset_set) { |
1812 | dev_priv->gart_info.bus_addr = | 1813 | dev_priv->gart_info.bus_addr = |
diff --git a/drivers/char/drm/via_dma.c b/drivers/char/drm/via_dma.c index 94baec692b57..7a339dba6a69 100644 --- a/drivers/char/drm/via_dma.c +++ b/drivers/char/drm/via_dma.c | |||
@@ -126,6 +126,8 @@ via_cmdbuf_wait(drm_via_private_t * dev_priv, unsigned int size) | |||
126 | hw_addr, cur_addr, next_addr); | 126 | hw_addr, cur_addr, next_addr); |
127 | return -1; | 127 | return -1; |
128 | } | 128 | } |
129 | if ((cur_addr < hw_addr) && (next_addr >= hw_addr)) | ||
130 | msleep(1); | ||
129 | } while ((cur_addr < hw_addr) && (next_addr >= hw_addr)); | 131 | } while ((cur_addr < hw_addr) && (next_addr >= hw_addr)); |
130 | return 0; | 132 | return 0; |
131 | } | 133 | } |
@@ -416,27 +418,50 @@ static int via_hook_segment(drm_via_private_t * dev_priv, | |||
416 | int paused, count; | 418 | int paused, count; |
417 | volatile uint32_t *paused_at = dev_priv->last_pause_ptr; | 419 | volatile uint32_t *paused_at = dev_priv->last_pause_ptr; |
418 | uint32_t reader,ptr; | 420 | uint32_t reader,ptr; |
421 | uint32_t diff; | ||
419 | 422 | ||
420 | paused = 0; | 423 | paused = 0; |
421 | via_flush_write_combine(); | 424 | via_flush_write_combine(); |
422 | (void) *(volatile uint32_t *)(via_get_dma(dev_priv) -1); | 425 | (void) *(volatile uint32_t *)(via_get_dma(dev_priv) -1); |
426 | |||
423 | *paused_at = pause_addr_lo; | 427 | *paused_at = pause_addr_lo; |
424 | via_flush_write_combine(); | 428 | via_flush_write_combine(); |
425 | (void) *paused_at; | 429 | (void) *paused_at; |
430 | |||
426 | reader = *(dev_priv->hw_addr_ptr); | 431 | reader = *(dev_priv->hw_addr_ptr); |
427 | ptr = ((volatile char *)paused_at - dev_priv->dma_ptr) + | 432 | ptr = ((volatile char *)paused_at - dev_priv->dma_ptr) + |
428 | dev_priv->dma_offset + (uint32_t) dev_priv->agpAddr + 4; | 433 | dev_priv->dma_offset + (uint32_t) dev_priv->agpAddr + 4; |
434 | |||
429 | dev_priv->last_pause_ptr = via_get_dma(dev_priv) - 1; | 435 | dev_priv->last_pause_ptr = via_get_dma(dev_priv) - 1; |
430 | 436 | ||
431 | if ((ptr - reader) <= dev_priv->dma_diff ) { | 437 | /* |
432 | count = 10000000; | 438 | * If there is a possibility that the command reader will |
433 | while (!(paused = (VIA_READ(0x41c) & 0x80000000)) && count--); | 439 | * miss the new pause address and pause on the old one, |
440 | * In that case we need to program the new start address | ||
441 | * using PCI. | ||
442 | */ | ||
443 | |||
444 | diff = (uint32_t) (ptr - reader) - dev_priv->dma_diff; | ||
445 | count = 10000000; | ||
446 | while(diff == 0 && count--) { | ||
447 | paused = (VIA_READ(0x41c) & 0x80000000); | ||
448 | if (paused) | ||
449 | break; | ||
450 | reader = *(dev_priv->hw_addr_ptr); | ||
451 | diff = (uint32_t) (ptr - reader) - dev_priv->dma_diff; | ||
434 | } | 452 | } |
435 | 453 | ||
454 | paused = VIA_READ(0x41c) & 0x80000000; | ||
455 | |||
436 | if (paused && !no_pci_fire) { | 456 | if (paused && !no_pci_fire) { |
437 | reader = *(dev_priv->hw_addr_ptr); | 457 | reader = *(dev_priv->hw_addr_ptr); |
438 | if ((ptr - reader) == dev_priv->dma_diff) { | 458 | diff = (uint32_t) (ptr - reader) - dev_priv->dma_diff; |
439 | 459 | diff &= (dev_priv->dma_high - 1); | |
460 | if (diff != 0 && diff < (dev_priv->dma_high >> 1)) { | ||
461 | DRM_ERROR("Paused at incorrect address. " | ||
462 | "0x%08x, 0x%08x 0x%08x\n", | ||
463 | ptr, reader, dev_priv->dma_diff); | ||
464 | } else if (diff == 0) { | ||
440 | /* | 465 | /* |
441 | * There is a concern that these writes may stall the PCI bus | 466 | * There is a concern that these writes may stall the PCI bus |
442 | * if the GPU is not idle. However, idling the GPU first | 467 | * if the GPU is not idle. However, idling the GPU first |
@@ -577,6 +602,7 @@ static void via_cmdbuf_jump(drm_via_private_t * dev_priv) | |||
577 | uint32_t pause_addr_lo, pause_addr_hi; | 602 | uint32_t pause_addr_lo, pause_addr_hi; |
578 | uint32_t jump_addr_lo, jump_addr_hi; | 603 | uint32_t jump_addr_lo, jump_addr_hi; |
579 | volatile uint32_t *last_pause_ptr; | 604 | volatile uint32_t *last_pause_ptr; |
605 | uint32_t dma_low_save1, dma_low_save2; | ||
580 | 606 | ||
581 | agp_base = dev_priv->dma_offset + (uint32_t) dev_priv->agpAddr; | 607 | agp_base = dev_priv->dma_offset + (uint32_t) dev_priv->agpAddr; |
582 | via_align_cmd(dev_priv, HC_HAGPBpID_JUMP, 0, &jump_addr_hi, | 608 | via_align_cmd(dev_priv, HC_HAGPBpID_JUMP, 0, &jump_addr_hi, |
@@ -603,8 +629,29 @@ static void via_cmdbuf_jump(drm_via_private_t * dev_priv) | |||
603 | &pause_addr_lo, 0); | 629 | &pause_addr_lo, 0); |
604 | 630 | ||
605 | *last_pause_ptr = pause_addr_lo; | 631 | *last_pause_ptr = pause_addr_lo; |
632 | dma_low_save1 = dev_priv->dma_low; | ||
606 | 633 | ||
607 | via_hook_segment( dev_priv, jump_addr_hi, jump_addr_lo, 0); | 634 | /* |
635 | * Now, set a trap that will pause the regulator if it tries to rerun the old | ||
636 | * command buffer. (Which may happen if via_hook_segment detecs a command regulator pause | ||
637 | * and reissues the jump command over PCI, while the regulator has already taken the jump | ||
638 | * and actually paused at the current buffer end). | ||
639 | * There appears to be no other way to detect this condition, since the hw_addr_pointer | ||
640 | * does not seem to get updated immediately when a jump occurs. | ||
641 | */ | ||
642 | |||
643 | last_pause_ptr = | ||
644 | via_align_cmd(dev_priv, HC_HAGPBpID_PAUSE, 0, &pause_addr_hi, | ||
645 | &pause_addr_lo, 0) - 1; | ||
646 | via_align_cmd(dev_priv, HC_HAGPBpID_PAUSE, 0, &pause_addr_hi, | ||
647 | &pause_addr_lo, 0); | ||
648 | *last_pause_ptr = pause_addr_lo; | ||
649 | |||
650 | dma_low_save2 = dev_priv->dma_low; | ||
651 | dev_priv->dma_low = dma_low_save1; | ||
652 | via_hook_segment(dev_priv, jump_addr_hi, jump_addr_lo, 0); | ||
653 | dev_priv->dma_low = dma_low_save2; | ||
654 | via_hook_segment(dev_priv, pause_addr_hi, pause_addr_lo, 0); | ||
608 | } | 655 | } |
609 | 656 | ||
610 | 657 | ||
diff --git a/drivers/char/drm/via_dmablit.c b/drivers/char/drm/via_dmablit.c index 33c5197b73c4..409e00afdd07 100644 --- a/drivers/char/drm/via_dmablit.c +++ b/drivers/char/drm/via_dmablit.c | |||
@@ -603,7 +603,7 @@ via_build_sg_info(struct drm_device *dev, drm_via_sg_info_t *vsg, drm_via_dmabli | |||
603 | * (Not a big limitation anyway.) | 603 | * (Not a big limitation anyway.) |
604 | */ | 604 | */ |
605 | 605 | ||
606 | if ((xfer->mem_stride - xfer->line_length) >= PAGE_SIZE) { | 606 | if ((xfer->mem_stride - xfer->line_length) > 2*PAGE_SIZE) { |
607 | DRM_ERROR("Too large system memory stride. Stride: %d, " | 607 | DRM_ERROR("Too large system memory stride. Stride: %d, " |
608 | "Length: %d\n", xfer->mem_stride, xfer->line_length); | 608 | "Length: %d\n", xfer->mem_stride, xfer->line_length); |
609 | return -EINVAL; | 609 | return -EINVAL; |
diff --git a/drivers/char/hw_random/Kconfig b/drivers/char/hw_random/Kconfig index 6bbd4fa50f3b..8d6c2089d2a8 100644 --- a/drivers/char/hw_random/Kconfig +++ b/drivers/char/hw_random/Kconfig | |||
@@ -9,7 +9,14 @@ config HW_RANDOM | |||
9 | Hardware Random Number Generator Core infrastructure. | 9 | Hardware Random Number Generator Core infrastructure. |
10 | 10 | ||
11 | To compile this driver as a module, choose M here: the | 11 | To compile this driver as a module, choose M here: the |
12 | module will be called rng-core. | 12 | module will be called rng-core. This provides a device |
13 | that's usually called /dev/hw_random, and which exposes one | ||
14 | of possibly several hardware random number generators. | ||
15 | |||
16 | These hardware random number generators do not feed directly | ||
17 | into the kernel's random number generator. That is usually | ||
18 | handled by the "rngd" daemon. Documentation/hw_random.txt | ||
19 | has more information. | ||
13 | 20 | ||
14 | If unsure, say Y. | 21 | If unsure, say Y. |
15 | 22 | ||
diff --git a/drivers/char/riscom8.c b/drivers/char/riscom8.c index 589ac6f65b9a..3f9d0a9ac36d 100644 --- a/drivers/char/riscom8.c +++ b/drivers/char/riscom8.c | |||
@@ -1709,7 +1709,7 @@ static int __init riscom8_init_module (void) | |||
1709 | 1709 | ||
1710 | if (iobase || iobase1 || iobase2 || iobase3) { | 1710 | if (iobase || iobase1 || iobase2 || iobase3) { |
1711 | for(i = 0; i < RC_NBOARD; i++) | 1711 | for(i = 0; i < RC_NBOARD; i++) |
1712 | rc_board[0].base = 0; | 1712 | rc_board[i].base = 0; |
1713 | } | 1713 | } |
1714 | 1714 | ||
1715 | if (iobase) | 1715 | if (iobase) |
diff --git a/drivers/char/rocket.c b/drivers/char/rocket.c index 72f289279d8f..f585bc8579e9 100644 --- a/drivers/char/rocket.c +++ b/drivers/char/rocket.c | |||
@@ -83,6 +83,7 @@ | |||
83 | #include <linux/pci.h> | 83 | #include <linux/pci.h> |
84 | #include <asm/uaccess.h> | 84 | #include <asm/uaccess.h> |
85 | #include <asm/atomic.h> | 85 | #include <asm/atomic.h> |
86 | #include <asm/unaligned.h> | ||
86 | #include <linux/bitops.h> | 87 | #include <linux/bitops.h> |
87 | #include <linux/spinlock.h> | 88 | #include <linux/spinlock.h> |
88 | #include <linux/init.h> | 89 | #include <linux/init.h> |
@@ -1312,7 +1313,7 @@ static int rp_tiocmset(struct tty_struct *tty, struct file *file, | |||
1312 | if (clear & TIOCM_DTR) | 1313 | if (clear & TIOCM_DTR) |
1313 | info->channel.TxControl[3] &= ~SET_DTR; | 1314 | info->channel.TxControl[3] &= ~SET_DTR; |
1314 | 1315 | ||
1315 | sOutDW(info->channel.IndexAddr, *(DWord_t *) & (info->channel.TxControl[0])); | 1316 | out32(info->channel.IndexAddr, info->channel.TxControl); |
1316 | return 0; | 1317 | return 0; |
1317 | } | 1318 | } |
1318 | 1319 | ||
@@ -1748,7 +1749,7 @@ static int rp_write(struct tty_struct *tty, | |||
1748 | 1749 | ||
1749 | /* Write remaining data into the port's xmit_buf */ | 1750 | /* Write remaining data into the port's xmit_buf */ |
1750 | while (1) { | 1751 | while (1) { |
1751 | if (info->tty == 0) /* Seemingly obligatory check... */ | 1752 | if (!info->tty) /* Seemingly obligatory check... */ |
1752 | goto end; | 1753 | goto end; |
1753 | 1754 | ||
1754 | c = min(count, min(XMIT_BUF_SIZE - info->xmit_cnt - 1, XMIT_BUF_SIZE - info->xmit_head)); | 1755 | c = min(count, min(XMIT_BUF_SIZE - info->xmit_cnt - 1, XMIT_BUF_SIZE - info->xmit_head)); |
@@ -2798,7 +2799,7 @@ static int sReadAiopNumChan(WordIO_t io) | |||
2798 | static Byte_t R[4] = { 0x00, 0x00, 0x34, 0x12 }; | 2799 | static Byte_t R[4] = { 0x00, 0x00, 0x34, 0x12 }; |
2799 | 2800 | ||
2800 | /* write to chan 0 SRAM */ | 2801 | /* write to chan 0 SRAM */ |
2801 | sOutDW((DWordIO_t) io + _INDX_ADDR, *((DWord_t *) & R[0])); | 2802 | out32((DWordIO_t) io + _INDX_ADDR, R); |
2802 | sOutW(io + _INDX_ADDR, 0); /* read from SRAM, chan 0 */ | 2803 | sOutW(io + _INDX_ADDR, 0); /* read from SRAM, chan 0 */ |
2803 | x = sInW(io + _INDX_DATA); | 2804 | x = sInW(io + _INDX_DATA); |
2804 | sOutW(io + _INDX_ADDR, 0x4000); /* read from SRAM, chan 4 */ | 2805 | sOutW(io + _INDX_ADDR, 0x4000); /* read from SRAM, chan 4 */ |
@@ -2864,7 +2865,7 @@ static int sInitChan(CONTROLLER_T * CtlP, CHANNEL_T * ChP, int AiopNum, | |||
2864 | R[1] = RData[i + 1] + 0x10 * ChanNum; | 2865 | R[1] = RData[i + 1] + 0x10 * ChanNum; |
2865 | R[2] = RData[i + 2]; | 2866 | R[2] = RData[i + 2]; |
2866 | R[3] = RData[i + 3]; | 2867 | R[3] = RData[i + 3]; |
2867 | sOutDW(ChP->IndexAddr, *((DWord_t *) & R[0])); | 2868 | out32(ChP->IndexAddr, R); |
2868 | } | 2869 | } |
2869 | 2870 | ||
2870 | ChR = ChP->R; | 2871 | ChR = ChP->R; |
@@ -2887,43 +2888,43 @@ static int sInitChan(CONTROLLER_T * CtlP, CHANNEL_T * ChP, int AiopNum, | |||
2887 | ChP->BaudDiv[1] = (Byte_t) ((ChOff + _BAUD) >> 8); | 2888 | ChP->BaudDiv[1] = (Byte_t) ((ChOff + _BAUD) >> 8); |
2888 | ChP->BaudDiv[2] = (Byte_t) brd9600; | 2889 | ChP->BaudDiv[2] = (Byte_t) brd9600; |
2889 | ChP->BaudDiv[3] = (Byte_t) (brd9600 >> 8); | 2890 | ChP->BaudDiv[3] = (Byte_t) (brd9600 >> 8); |
2890 | sOutDW(ChP->IndexAddr, *(DWord_t *) & ChP->BaudDiv[0]); | 2891 | out32(ChP->IndexAddr, ChP->BaudDiv); |
2891 | 2892 | ||
2892 | ChP->TxControl[0] = (Byte_t) (ChOff + _TX_CTRL); | 2893 | ChP->TxControl[0] = (Byte_t) (ChOff + _TX_CTRL); |
2893 | ChP->TxControl[1] = (Byte_t) ((ChOff + _TX_CTRL) >> 8); | 2894 | ChP->TxControl[1] = (Byte_t) ((ChOff + _TX_CTRL) >> 8); |
2894 | ChP->TxControl[2] = 0; | 2895 | ChP->TxControl[2] = 0; |
2895 | ChP->TxControl[3] = 0; | 2896 | ChP->TxControl[3] = 0; |
2896 | sOutDW(ChP->IndexAddr, *(DWord_t *) & ChP->TxControl[0]); | 2897 | out32(ChP->IndexAddr, ChP->TxControl); |
2897 | 2898 | ||
2898 | ChP->RxControl[0] = (Byte_t) (ChOff + _RX_CTRL); | 2899 | ChP->RxControl[0] = (Byte_t) (ChOff + _RX_CTRL); |
2899 | ChP->RxControl[1] = (Byte_t) ((ChOff + _RX_CTRL) >> 8); | 2900 | ChP->RxControl[1] = (Byte_t) ((ChOff + _RX_CTRL) >> 8); |
2900 | ChP->RxControl[2] = 0; | 2901 | ChP->RxControl[2] = 0; |
2901 | ChP->RxControl[3] = 0; | 2902 | ChP->RxControl[3] = 0; |
2902 | sOutDW(ChP->IndexAddr, *(DWord_t *) & ChP->RxControl[0]); | 2903 | out32(ChP->IndexAddr, ChP->RxControl); |
2903 | 2904 | ||
2904 | ChP->TxEnables[0] = (Byte_t) (ChOff + _TX_ENBLS); | 2905 | ChP->TxEnables[0] = (Byte_t) (ChOff + _TX_ENBLS); |
2905 | ChP->TxEnables[1] = (Byte_t) ((ChOff + _TX_ENBLS) >> 8); | 2906 | ChP->TxEnables[1] = (Byte_t) ((ChOff + _TX_ENBLS) >> 8); |
2906 | ChP->TxEnables[2] = 0; | 2907 | ChP->TxEnables[2] = 0; |
2907 | ChP->TxEnables[3] = 0; | 2908 | ChP->TxEnables[3] = 0; |
2908 | sOutDW(ChP->IndexAddr, *(DWord_t *) & ChP->TxEnables[0]); | 2909 | out32(ChP->IndexAddr, ChP->TxEnables); |
2909 | 2910 | ||
2910 | ChP->TxCompare[0] = (Byte_t) (ChOff + _TXCMP1); | 2911 | ChP->TxCompare[0] = (Byte_t) (ChOff + _TXCMP1); |
2911 | ChP->TxCompare[1] = (Byte_t) ((ChOff + _TXCMP1) >> 8); | 2912 | ChP->TxCompare[1] = (Byte_t) ((ChOff + _TXCMP1) >> 8); |
2912 | ChP->TxCompare[2] = 0; | 2913 | ChP->TxCompare[2] = 0; |
2913 | ChP->TxCompare[3] = 0; | 2914 | ChP->TxCompare[3] = 0; |
2914 | sOutDW(ChP->IndexAddr, *(DWord_t *) & ChP->TxCompare[0]); | 2915 | out32(ChP->IndexAddr, ChP->TxCompare); |
2915 | 2916 | ||
2916 | ChP->TxReplace1[0] = (Byte_t) (ChOff + _TXREP1B1); | 2917 | ChP->TxReplace1[0] = (Byte_t) (ChOff + _TXREP1B1); |
2917 | ChP->TxReplace1[1] = (Byte_t) ((ChOff + _TXREP1B1) >> 8); | 2918 | ChP->TxReplace1[1] = (Byte_t) ((ChOff + _TXREP1B1) >> 8); |
2918 | ChP->TxReplace1[2] = 0; | 2919 | ChP->TxReplace1[2] = 0; |
2919 | ChP->TxReplace1[3] = 0; | 2920 | ChP->TxReplace1[3] = 0; |
2920 | sOutDW(ChP->IndexAddr, *(DWord_t *) & ChP->TxReplace1[0]); | 2921 | out32(ChP->IndexAddr, ChP->TxReplace1); |
2921 | 2922 | ||
2922 | ChP->TxReplace2[0] = (Byte_t) (ChOff + _TXREP2); | 2923 | ChP->TxReplace2[0] = (Byte_t) (ChOff + _TXREP2); |
2923 | ChP->TxReplace2[1] = (Byte_t) ((ChOff + _TXREP2) >> 8); | 2924 | ChP->TxReplace2[1] = (Byte_t) ((ChOff + _TXREP2) >> 8); |
2924 | ChP->TxReplace2[2] = 0; | 2925 | ChP->TxReplace2[2] = 0; |
2925 | ChP->TxReplace2[3] = 0; | 2926 | ChP->TxReplace2[3] = 0; |
2926 | sOutDW(ChP->IndexAddr, *(DWord_t *) & ChP->TxReplace2[0]); | 2927 | out32(ChP->IndexAddr, ChP->TxReplace2); |
2927 | 2928 | ||
2928 | ChP->TxFIFOPtrs = ChOff + _TXF_OUTP; | 2929 | ChP->TxFIFOPtrs = ChOff + _TXF_OUTP; |
2929 | ChP->TxFIFO = ChOff + _TX_FIFO; | 2930 | ChP->TxFIFO = ChOff + _TX_FIFO; |
@@ -2979,7 +2980,7 @@ static void sStopRxProcessor(CHANNEL_T * ChP) | |||
2979 | R[1] = ChP->R[1]; | 2980 | R[1] = ChP->R[1]; |
2980 | R[2] = 0x0a; | 2981 | R[2] = 0x0a; |
2981 | R[3] = ChP->R[3]; | 2982 | R[3] = ChP->R[3]; |
2982 | sOutDW(ChP->IndexAddr, *(DWord_t *) & R[0]); | 2983 | out32(ChP->IndexAddr, R); |
2983 | } | 2984 | } |
2984 | 2985 | ||
2985 | /*************************************************************************** | 2986 | /*************************************************************************** |
@@ -3094,13 +3095,13 @@ static int sWriteTxPrioByte(CHANNEL_T * ChP, Byte_t Data) | |||
3094 | *WordPtr = ChP->TxPrioBuf; /* data byte address */ | 3095 | *WordPtr = ChP->TxPrioBuf; /* data byte address */ |
3095 | 3096 | ||
3096 | DWBuf[2] = Data; /* data byte value */ | 3097 | DWBuf[2] = Data; /* data byte value */ |
3097 | sOutDW(IndexAddr, *((DWord_t *) (&DWBuf[0]))); /* write it out */ | 3098 | out32(IndexAddr, DWBuf); /* write it out */ |
3098 | 3099 | ||
3099 | *WordPtr = ChP->TxPrioCnt; /* Tx priority count address */ | 3100 | *WordPtr = ChP->TxPrioCnt; /* Tx priority count address */ |
3100 | 3101 | ||
3101 | DWBuf[2] = PRI_PEND + 1; /* indicate 1 byte pending */ | 3102 | DWBuf[2] = PRI_PEND + 1; /* indicate 1 byte pending */ |
3102 | DWBuf[3] = 0; /* priority buffer pointer */ | 3103 | DWBuf[3] = 0; /* priority buffer pointer */ |
3103 | sOutDW(IndexAddr, *((DWord_t *) (&DWBuf[0]))); /* write it out */ | 3104 | out32(IndexAddr, DWBuf); /* write it out */ |
3104 | } else { /* write it to Tx FIFO */ | 3105 | } else { /* write it to Tx FIFO */ |
3105 | 3106 | ||
3106 | sWriteTxByte(sGetTxRxDataIO(ChP), Data); | 3107 | sWriteTxByte(sGetTxRxDataIO(ChP), Data); |
@@ -3147,11 +3148,11 @@ static void sEnInterrupts(CHANNEL_T * ChP, Word_t Flags) | |||
3147 | ChP->RxControl[2] |= | 3148 | ChP->RxControl[2] |= |
3148 | ((Byte_t) Flags & (RXINT_EN | SRCINT_EN | MCINT_EN)); | 3149 | ((Byte_t) Flags & (RXINT_EN | SRCINT_EN | MCINT_EN)); |
3149 | 3150 | ||
3150 | sOutDW(ChP->IndexAddr, *(DWord_t *) & ChP->RxControl[0]); | 3151 | out32(ChP->IndexAddr, ChP->RxControl); |
3151 | 3152 | ||
3152 | ChP->TxControl[2] |= ((Byte_t) Flags & TXINT_EN); | 3153 | ChP->TxControl[2] |= ((Byte_t) Flags & TXINT_EN); |
3153 | 3154 | ||
3154 | sOutDW(ChP->IndexAddr, *(DWord_t *) & ChP->TxControl[0]); | 3155 | out32(ChP->IndexAddr, ChP->TxControl); |
3155 | 3156 | ||
3156 | if (Flags & CHANINT_EN) { | 3157 | if (Flags & CHANINT_EN) { |
3157 | Mask = sInB(ChP->IntMask) | sBitMapSetTbl[ChP->ChanNum]; | 3158 | Mask = sInB(ChP->IntMask) | sBitMapSetTbl[ChP->ChanNum]; |
@@ -3190,9 +3191,9 @@ static void sDisInterrupts(CHANNEL_T * ChP, Word_t Flags) | |||
3190 | 3191 | ||
3191 | ChP->RxControl[2] &= | 3192 | ChP->RxControl[2] &= |
3192 | ~((Byte_t) Flags & (RXINT_EN | SRCINT_EN | MCINT_EN)); | 3193 | ~((Byte_t) Flags & (RXINT_EN | SRCINT_EN | MCINT_EN)); |
3193 | sOutDW(ChP->IndexAddr, *(DWord_t *) & ChP->RxControl[0]); | 3194 | out32(ChP->IndexAddr, ChP->RxControl); |
3194 | ChP->TxControl[2] &= ~((Byte_t) Flags & TXINT_EN); | 3195 | ChP->TxControl[2] &= ~((Byte_t) Flags & TXINT_EN); |
3195 | sOutDW(ChP->IndexAddr, *(DWord_t *) & ChP->TxControl[0]); | 3196 | out32(ChP->IndexAddr, ChP->TxControl); |
3196 | 3197 | ||
3197 | if (Flags & CHANINT_EN) { | 3198 | if (Flags & CHANINT_EN) { |
3198 | Mask = sInB(ChP->IntMask) & sBitMapClrTbl[ChP->ChanNum]; | 3199 | Mask = sInB(ChP->IntMask) & sBitMapClrTbl[ChP->ChanNum]; |
diff --git a/drivers/char/rocket_int.h b/drivers/char/rocket_int.h index f3a75791b811..b01d38125a8f 100644 --- a/drivers/char/rocket_int.h +++ b/drivers/char/rocket_int.h | |||
@@ -26,7 +26,6 @@ typedef unsigned int ByteIO_t; | |||
26 | typedef unsigned int Word_t; | 26 | typedef unsigned int Word_t; |
27 | typedef unsigned int WordIO_t; | 27 | typedef unsigned int WordIO_t; |
28 | 28 | ||
29 | typedef unsigned long DWord_t; | ||
30 | typedef unsigned int DWordIO_t; | 29 | typedef unsigned int DWordIO_t; |
31 | 30 | ||
32 | /* | 31 | /* |
@@ -38,7 +37,6 @@ typedef unsigned int DWordIO_t; | |||
38 | * instruction. | 37 | * instruction. |
39 | */ | 38 | */ |
40 | 39 | ||
41 | #ifdef ROCKET_DEBUG_IO | ||
42 | static inline void sOutB(unsigned short port, unsigned char value) | 40 | static inline void sOutB(unsigned short port, unsigned char value) |
43 | { | 41 | { |
44 | #ifdef ROCKET_DEBUG_IO | 42 | #ifdef ROCKET_DEBUG_IO |
@@ -55,12 +53,13 @@ static inline void sOutW(unsigned short port, unsigned short value) | |||
55 | outw_p(value, port); | 53 | outw_p(value, port); |
56 | } | 54 | } |
57 | 55 | ||
58 | static inline void sOutDW(unsigned short port, unsigned long value) | 56 | static inline void out32(unsigned short port, Byte_t *p) |
59 | { | 57 | { |
58 | u32 value = le32_to_cpu(get_unaligned((__le32 *)p)); | ||
60 | #ifdef ROCKET_DEBUG_IO | 59 | #ifdef ROCKET_DEBUG_IO |
61 | printk(KERN_DEBUG "sOutDW(%x, %lx)...\n", port, value); | 60 | printk(KERN_DEBUG "out32(%x, %lx)...\n", port, value); |
62 | #endif | 61 | #endif |
63 | outl_p(cpu_to_le32(value), port); | 62 | outl_p(value, port); |
64 | } | 63 | } |
65 | 64 | ||
66 | static inline unsigned char sInB(unsigned short port) | 65 | static inline unsigned char sInB(unsigned short port) |
@@ -73,14 +72,6 @@ static inline unsigned short sInW(unsigned short port) | |||
73 | return inw_p(port); | 72 | return inw_p(port); |
74 | } | 73 | } |
75 | 74 | ||
76 | #else /* !ROCKET_DEBUG_IO */ | ||
77 | #define sOutB(a, b) outb_p(b, a) | ||
78 | #define sOutW(a, b) outw_p(b, a) | ||
79 | #define sOutDW(port, value) outl_p(cpu_to_le32(value), port) | ||
80 | #define sInB(a) (inb_p(a)) | ||
81 | #define sInW(a) (inw_p(a)) | ||
82 | #endif /* ROCKET_DEBUG_IO */ | ||
83 | |||
84 | /* This is used to move arrays of bytes so byte swapping isn't appropriate. */ | 75 | /* This is used to move arrays of bytes so byte swapping isn't appropriate. */ |
85 | #define sOutStrW(port, addr, count) if (count) outsw(port, addr, count) | 76 | #define sOutStrW(port, addr, count) if (count) outsw(port, addr, count) |
86 | #define sInStrW(port, addr, count) if (count) insw(port, addr, count) | 77 | #define sInStrW(port, addr, count) if (count) insw(port, addr, count) |
@@ -390,7 +381,7 @@ Call: sClrBreak(ChP) | |||
390 | #define sClrBreak(ChP) \ | 381 | #define sClrBreak(ChP) \ |
391 | do { \ | 382 | do { \ |
392 | (ChP)->TxControl[3] &= ~SETBREAK; \ | 383 | (ChP)->TxControl[3] &= ~SETBREAK; \ |
393 | sOutDW((ChP)->IndexAddr,*(DWord_t *)&(ChP)->TxControl[0]); \ | 384 | out32((ChP)->IndexAddr,(ChP)->TxControl); \ |
394 | } while (0) | 385 | } while (0) |
395 | 386 | ||
396 | /*************************************************************************** | 387 | /*************************************************************************** |
@@ -402,7 +393,7 @@ Call: sClrDTR(ChP) | |||
402 | #define sClrDTR(ChP) \ | 393 | #define sClrDTR(ChP) \ |
403 | do { \ | 394 | do { \ |
404 | (ChP)->TxControl[3] &= ~SET_DTR; \ | 395 | (ChP)->TxControl[3] &= ~SET_DTR; \ |
405 | sOutDW((ChP)->IndexAddr,*(DWord_t *)&(ChP)->TxControl[0]); \ | 396 | out32((ChP)->IndexAddr,(ChP)->TxControl); \ |
406 | } while (0) | 397 | } while (0) |
407 | 398 | ||
408 | /*************************************************************************** | 399 | /*************************************************************************** |
@@ -415,7 +406,7 @@ Call: sClrRTS(ChP) | |||
415 | do { \ | 406 | do { \ |
416 | if ((ChP)->rtsToggle) break; \ | 407 | if ((ChP)->rtsToggle) break; \ |
417 | (ChP)->TxControl[3] &= ~SET_RTS; \ | 408 | (ChP)->TxControl[3] &= ~SET_RTS; \ |
418 | sOutDW((ChP)->IndexAddr,*(DWord_t *)&(ChP)->TxControl[0]); \ | 409 | out32((ChP)->IndexAddr,(ChP)->TxControl); \ |
419 | } while (0) | 410 | } while (0) |
420 | 411 | ||
421 | /*************************************************************************** | 412 | /*************************************************************************** |
@@ -489,7 +480,7 @@ Call: sDisCTSFlowCtl(ChP) | |||
489 | #define sDisCTSFlowCtl(ChP) \ | 480 | #define sDisCTSFlowCtl(ChP) \ |
490 | do { \ | 481 | do { \ |
491 | (ChP)->TxControl[2] &= ~CTSFC_EN; \ | 482 | (ChP)->TxControl[2] &= ~CTSFC_EN; \ |
492 | sOutDW((ChP)->IndexAddr,*(DWord_t *)&(ChP)->TxControl[0]); \ | 483 | out32((ChP)->IndexAddr,(ChP)->TxControl); \ |
493 | } while (0) | 484 | } while (0) |
494 | 485 | ||
495 | /*************************************************************************** | 486 | /*************************************************************************** |
@@ -501,7 +492,7 @@ Call: sDisIXANY(ChP) | |||
501 | #define sDisIXANY(ChP) \ | 492 | #define sDisIXANY(ChP) \ |
502 | do { \ | 493 | do { \ |
503 | (ChP)->R[0x0e] = 0x86; \ | 494 | (ChP)->R[0x0e] = 0x86; \ |
504 | sOutDW((ChP)->IndexAddr,*(DWord_t *)&(ChP)->R[0x0c]); \ | 495 | out32((ChP)->IndexAddr,&(ChP)->R[0x0c]); \ |
505 | } while (0) | 496 | } while (0) |
506 | 497 | ||
507 | /*************************************************************************** | 498 | /*************************************************************************** |
@@ -515,7 +506,7 @@ Comments: Function sSetParity() can be used in place of functions sEnParity(), | |||
515 | #define sDisParity(ChP) \ | 506 | #define sDisParity(ChP) \ |
516 | do { \ | 507 | do { \ |
517 | (ChP)->TxControl[2] &= ~PARITY_EN; \ | 508 | (ChP)->TxControl[2] &= ~PARITY_EN; \ |
518 | sOutDW((ChP)->IndexAddr,*(DWord_t *)&(ChP)->TxControl[0]); \ | 509 | out32((ChP)->IndexAddr,(ChP)->TxControl); \ |
519 | } while (0) | 510 | } while (0) |
520 | 511 | ||
521 | /*************************************************************************** | 512 | /*************************************************************************** |
@@ -527,7 +518,7 @@ Call: sDisRTSToggle(ChP) | |||
527 | #define sDisRTSToggle(ChP) \ | 518 | #define sDisRTSToggle(ChP) \ |
528 | do { \ | 519 | do { \ |
529 | (ChP)->TxControl[2] &= ~RTSTOG_EN; \ | 520 | (ChP)->TxControl[2] &= ~RTSTOG_EN; \ |
530 | sOutDW((ChP)->IndexAddr,*(DWord_t *)&(ChP)->TxControl[0]); \ | 521 | out32((ChP)->IndexAddr,(ChP)->TxControl); \ |
531 | (ChP)->rtsToggle = 0; \ | 522 | (ChP)->rtsToggle = 0; \ |
532 | } while (0) | 523 | } while (0) |
533 | 524 | ||
@@ -540,7 +531,7 @@ Call: sDisRxFIFO(ChP) | |||
540 | #define sDisRxFIFO(ChP) \ | 531 | #define sDisRxFIFO(ChP) \ |
541 | do { \ | 532 | do { \ |
542 | (ChP)->R[0x32] = 0x0a; \ | 533 | (ChP)->R[0x32] = 0x0a; \ |
543 | sOutDW((ChP)->IndexAddr,*(DWord_t *)&(ChP)->R[0x30]); \ | 534 | out32((ChP)->IndexAddr,&(ChP)->R[0x30]); \ |
544 | } while (0) | 535 | } while (0) |
545 | 536 | ||
546 | /*************************************************************************** | 537 | /*************************************************************************** |
@@ -567,7 +558,7 @@ Call: sDisTransmit(ChP) | |||
567 | #define sDisTransmit(ChP) \ | 558 | #define sDisTransmit(ChP) \ |
568 | do { \ | 559 | do { \ |
569 | (ChP)->TxControl[3] &= ~TX_ENABLE; \ | 560 | (ChP)->TxControl[3] &= ~TX_ENABLE; \ |
570 | sOutDW((ChP)->IndexAddr,*(DWord_t *)&(ChP)->TxControl[0]); \ | 561 | out32((ChP)->IndexAddr,(ChP)->TxControl); \ |
571 | } while (0) | 562 | } while (0) |
572 | 563 | ||
573 | /*************************************************************************** | 564 | /*************************************************************************** |
@@ -579,7 +570,7 @@ Call: sDisTxSoftFlowCtl(ChP) | |||
579 | #define sDisTxSoftFlowCtl(ChP) \ | 570 | #define sDisTxSoftFlowCtl(ChP) \ |
580 | do { \ | 571 | do { \ |
581 | (ChP)->R[0x06] = 0x8a; \ | 572 | (ChP)->R[0x06] = 0x8a; \ |
582 | sOutDW((ChP)->IndexAddr,*(DWord_t *)&(ChP)->R[0x04]); \ | 573 | out32((ChP)->IndexAddr,&(ChP)->R[0x04]); \ |
583 | } while (0) | 574 | } while (0) |
584 | 575 | ||
585 | /*************************************************************************** | 576 | /*************************************************************************** |
@@ -604,7 +595,7 @@ Call: sEnCTSFlowCtl(ChP) | |||
604 | #define sEnCTSFlowCtl(ChP) \ | 595 | #define sEnCTSFlowCtl(ChP) \ |
605 | do { \ | 596 | do { \ |
606 | (ChP)->TxControl[2] |= CTSFC_EN; \ | 597 | (ChP)->TxControl[2] |= CTSFC_EN; \ |
607 | sOutDW((ChP)->IndexAddr,*(DWord_t *)&(ChP)->TxControl[0]); \ | 598 | out32((ChP)->IndexAddr,(ChP)->TxControl); \ |
608 | } while (0) | 599 | } while (0) |
609 | 600 | ||
610 | /*************************************************************************** | 601 | /*************************************************************************** |
@@ -616,7 +607,7 @@ Call: sEnIXANY(ChP) | |||
616 | #define sEnIXANY(ChP) \ | 607 | #define sEnIXANY(ChP) \ |
617 | do { \ | 608 | do { \ |
618 | (ChP)->R[0x0e] = 0x21; \ | 609 | (ChP)->R[0x0e] = 0x21; \ |
619 | sOutDW((ChP)->IndexAddr,*(DWord_t *)&(ChP)->R[0x0c]); \ | 610 | out32((ChP)->IndexAddr,&(ChP)->R[0x0c]); \ |
620 | } while (0) | 611 | } while (0) |
621 | 612 | ||
622 | /*************************************************************************** | 613 | /*************************************************************************** |
@@ -633,7 +624,7 @@ Warnings: Before enabling parity odd or even parity should be chosen using | |||
633 | #define sEnParity(ChP) \ | 624 | #define sEnParity(ChP) \ |
634 | do { \ | 625 | do { \ |
635 | (ChP)->TxControl[2] |= PARITY_EN; \ | 626 | (ChP)->TxControl[2] |= PARITY_EN; \ |
636 | sOutDW((ChP)->IndexAddr,*(DWord_t *)&(ChP)->TxControl[0]); \ | 627 | out32((ChP)->IndexAddr,(ChP)->TxControl); \ |
637 | } while (0) | 628 | } while (0) |
638 | 629 | ||
639 | /*************************************************************************** | 630 | /*************************************************************************** |
@@ -647,10 +638,10 @@ Comments: This function will disable RTS flow control and clear the RTS | |||
647 | #define sEnRTSToggle(ChP) \ | 638 | #define sEnRTSToggle(ChP) \ |
648 | do { \ | 639 | do { \ |
649 | (ChP)->RxControl[2] &= ~RTSFC_EN; \ | 640 | (ChP)->RxControl[2] &= ~RTSFC_EN; \ |
650 | sOutDW((ChP)->IndexAddr,*(DWord_t *)&(ChP)->RxControl[0]); \ | 641 | out32((ChP)->IndexAddr,(ChP)->RxControl); \ |
651 | (ChP)->TxControl[2] |= RTSTOG_EN; \ | 642 | (ChP)->TxControl[2] |= RTSTOG_EN; \ |
652 | (ChP)->TxControl[3] &= ~SET_RTS; \ | 643 | (ChP)->TxControl[3] &= ~SET_RTS; \ |
653 | sOutDW((ChP)->IndexAddr,*(DWord_t *)&(ChP)->TxControl[0]); \ | 644 | out32((ChP)->IndexAddr,(ChP)->TxControl); \ |
654 | (ChP)->rtsToggle = 1; \ | 645 | (ChP)->rtsToggle = 1; \ |
655 | } while (0) | 646 | } while (0) |
656 | 647 | ||
@@ -663,7 +654,7 @@ Call: sEnRxFIFO(ChP) | |||
663 | #define sEnRxFIFO(ChP) \ | 654 | #define sEnRxFIFO(ChP) \ |
664 | do { \ | 655 | do { \ |
665 | (ChP)->R[0x32] = 0x08; \ | 656 | (ChP)->R[0x32] = 0x08; \ |
666 | sOutDW((ChP)->IndexAddr,*(DWord_t *)&(ChP)->R[0x30]); \ | 657 | out32((ChP)->IndexAddr,&(ChP)->R[0x30]); \ |
667 | } while (0) | 658 | } while (0) |
668 | 659 | ||
669 | /*************************************************************************** | 660 | /*************************************************************************** |
@@ -684,7 +675,7 @@ Warnings: This function must be called after valid microcode has been | |||
684 | #define sEnRxProcessor(ChP) \ | 675 | #define sEnRxProcessor(ChP) \ |
685 | do { \ | 676 | do { \ |
686 | (ChP)->RxControl[2] |= RXPROC_EN; \ | 677 | (ChP)->RxControl[2] |= RXPROC_EN; \ |
687 | sOutDW((ChP)->IndexAddr,*(DWord_t *)&(ChP)->RxControl[0]); \ | 678 | out32((ChP)->IndexAddr,(ChP)->RxControl); \ |
688 | } while (0) | 679 | } while (0) |
689 | 680 | ||
690 | /*************************************************************************** | 681 | /*************************************************************************** |
@@ -708,7 +699,7 @@ Call: sEnTransmit(ChP) | |||
708 | #define sEnTransmit(ChP) \ | 699 | #define sEnTransmit(ChP) \ |
709 | do { \ | 700 | do { \ |
710 | (ChP)->TxControl[3] |= TX_ENABLE; \ | 701 | (ChP)->TxControl[3] |= TX_ENABLE; \ |
711 | sOutDW((ChP)->IndexAddr,*(DWord_t *)&(ChP)->TxControl[0]); \ | 702 | out32((ChP)->IndexAddr,(ChP)->TxControl); \ |
712 | } while (0) | 703 | } while (0) |
713 | 704 | ||
714 | /*************************************************************************** | 705 | /*************************************************************************** |
@@ -720,7 +711,7 @@ Call: sEnTxSoftFlowCtl(ChP) | |||
720 | #define sEnTxSoftFlowCtl(ChP) \ | 711 | #define sEnTxSoftFlowCtl(ChP) \ |
721 | do { \ | 712 | do { \ |
722 | (ChP)->R[0x06] = 0xc5; \ | 713 | (ChP)->R[0x06] = 0xc5; \ |
723 | sOutDW((ChP)->IndexAddr,*(DWord_t *)&(ChP)->R[0x04]); \ | 714 | out32((ChP)->IndexAddr,&(ChP)->R[0x04]); \ |
724 | } while (0) | 715 | } while (0) |
725 | 716 | ||
726 | /*************************************************************************** | 717 | /*************************************************************************** |
@@ -927,7 +918,7 @@ Call: sSendBreak(ChP) | |||
927 | #define sSendBreak(ChP) \ | 918 | #define sSendBreak(ChP) \ |
928 | do { \ | 919 | do { \ |
929 | (ChP)->TxControl[3] |= SETBREAK; \ | 920 | (ChP)->TxControl[3] |= SETBREAK; \ |
930 | sOutDW((ChP)->IndexAddr,*(DWord_t *)&(ChP)->TxControl[0]); \ | 921 | out32((ChP)->IndexAddr,(ChP)->TxControl); \ |
931 | } while (0) | 922 | } while (0) |
932 | 923 | ||
933 | /*************************************************************************** | 924 | /*************************************************************************** |
@@ -941,7 +932,7 @@ Call: sSetBaud(ChP,Divisor) | |||
941 | do { \ | 932 | do { \ |
942 | (ChP)->BaudDiv[2] = (Byte_t)(DIVISOR); \ | 933 | (ChP)->BaudDiv[2] = (Byte_t)(DIVISOR); \ |
943 | (ChP)->BaudDiv[3] = (Byte_t)((DIVISOR) >> 8); \ | 934 | (ChP)->BaudDiv[3] = (Byte_t)((DIVISOR) >> 8); \ |
944 | sOutDW((ChP)->IndexAddr,*(DWord_t *)&(ChP)->BaudDiv[0]); \ | 935 | out32((ChP)->IndexAddr,(ChP)->BaudDiv); \ |
945 | } while (0) | 936 | } while (0) |
946 | 937 | ||
947 | /*************************************************************************** | 938 | /*************************************************************************** |
@@ -953,7 +944,7 @@ Call: sSetData7(ChP) | |||
953 | #define sSetData7(ChP) \ | 944 | #define sSetData7(ChP) \ |
954 | do { \ | 945 | do { \ |
955 | (ChP)->TxControl[2] &= ~DATA8BIT; \ | 946 | (ChP)->TxControl[2] &= ~DATA8BIT; \ |
956 | sOutDW((ChP)->IndexAddr,*(DWord_t *)&(ChP)->TxControl[0]); \ | 947 | out32((ChP)->IndexAddr,(ChP)->TxControl); \ |
957 | } while (0) | 948 | } while (0) |
958 | 949 | ||
959 | /*************************************************************************** | 950 | /*************************************************************************** |
@@ -965,7 +956,7 @@ Call: sSetData8(ChP) | |||
965 | #define sSetData8(ChP) \ | 956 | #define sSetData8(ChP) \ |
966 | do { \ | 957 | do { \ |
967 | (ChP)->TxControl[2] |= DATA8BIT; \ | 958 | (ChP)->TxControl[2] |= DATA8BIT; \ |
968 | sOutDW((ChP)->IndexAddr,*(DWord_t *)&(ChP)->TxControl[0]); \ | 959 | out32((ChP)->IndexAddr,(ChP)->TxControl); \ |
969 | } while (0) | 960 | } while (0) |
970 | 961 | ||
971 | /*************************************************************************** | 962 | /*************************************************************************** |
@@ -977,7 +968,7 @@ Call: sSetDTR(ChP) | |||
977 | #define sSetDTR(ChP) \ | 968 | #define sSetDTR(ChP) \ |
978 | do { \ | 969 | do { \ |
979 | (ChP)->TxControl[3] |= SET_DTR; \ | 970 | (ChP)->TxControl[3] |= SET_DTR; \ |
980 | sOutDW((ChP)->IndexAddr,*(DWord_t *)&(ChP)->TxControl[0]); \ | 971 | out32((ChP)->IndexAddr,(ChP)->TxControl); \ |
981 | } while (0) | 972 | } while (0) |
982 | 973 | ||
983 | /*************************************************************************** | 974 | /*************************************************************************** |
@@ -994,7 +985,7 @@ Warnings: This function has no effect unless parity is enabled with function | |||
994 | #define sSetEvenParity(ChP) \ | 985 | #define sSetEvenParity(ChP) \ |
995 | do { \ | 986 | do { \ |
996 | (ChP)->TxControl[2] |= EVEN_PAR; \ | 987 | (ChP)->TxControl[2] |= EVEN_PAR; \ |
997 | sOutDW((ChP)->IndexAddr,*(DWord_t *)&(ChP)->TxControl[0]); \ | 988 | out32((ChP)->IndexAddr,(ChP)->TxControl); \ |
998 | } while (0) | 989 | } while (0) |
999 | 990 | ||
1000 | /*************************************************************************** | 991 | /*************************************************************************** |
@@ -1011,7 +1002,7 @@ Warnings: This function has no effect unless parity is enabled with function | |||
1011 | #define sSetOddParity(ChP) \ | 1002 | #define sSetOddParity(ChP) \ |
1012 | do { \ | 1003 | do { \ |
1013 | (ChP)->TxControl[2] &= ~EVEN_PAR; \ | 1004 | (ChP)->TxControl[2] &= ~EVEN_PAR; \ |
1014 | sOutDW((ChP)->IndexAddr,*(DWord_t *)&(ChP)->TxControl[0]); \ | 1005 | out32((ChP)->IndexAddr,(ChP)->TxControl); \ |
1015 | } while (0) | 1006 | } while (0) |
1016 | 1007 | ||
1017 | /*************************************************************************** | 1008 | /*************************************************************************** |
@@ -1024,7 +1015,7 @@ Call: sSetRTS(ChP) | |||
1024 | do { \ | 1015 | do { \ |
1025 | if ((ChP)->rtsToggle) break; \ | 1016 | if ((ChP)->rtsToggle) break; \ |
1026 | (ChP)->TxControl[3] |= SET_RTS; \ | 1017 | (ChP)->TxControl[3] |= SET_RTS; \ |
1027 | sOutDW((ChP)->IndexAddr,*(DWord_t *)&(ChP)->TxControl[0]); \ | 1018 | out32((ChP)->IndexAddr,(ChP)->TxControl); \ |
1028 | } while (0) | 1019 | } while (0) |
1029 | 1020 | ||
1030 | /*************************************************************************** | 1021 | /*************************************************************************** |
@@ -1050,7 +1041,7 @@ Comments: An interrupt will be generated when the trigger level is reached | |||
1050 | do { \ | 1041 | do { \ |
1051 | (ChP)->RxControl[2] &= ~TRIG_MASK; \ | 1042 | (ChP)->RxControl[2] &= ~TRIG_MASK; \ |
1052 | (ChP)->RxControl[2] |= LEVEL; \ | 1043 | (ChP)->RxControl[2] |= LEVEL; \ |
1053 | sOutDW((ChP)->IndexAddr,*(DWord_t *)&(ChP)->RxControl[0]); \ | 1044 | out32((ChP)->IndexAddr,(ChP)->RxControl); \ |
1054 | } while (0) | 1045 | } while (0) |
1055 | 1046 | ||
1056 | /*************************************************************************** | 1047 | /*************************************************************************** |
@@ -1062,7 +1053,7 @@ Call: sSetStop1(ChP) | |||
1062 | #define sSetStop1(ChP) \ | 1053 | #define sSetStop1(ChP) \ |
1063 | do { \ | 1054 | do { \ |
1064 | (ChP)->TxControl[2] &= ~STOP2; \ | 1055 | (ChP)->TxControl[2] &= ~STOP2; \ |
1065 | sOutDW((ChP)->IndexAddr,*(DWord_t *)&(ChP)->TxControl[0]); \ | 1056 | out32((ChP)->IndexAddr,(ChP)->TxControl); \ |
1066 | } while (0) | 1057 | } while (0) |
1067 | 1058 | ||
1068 | /*************************************************************************** | 1059 | /*************************************************************************** |
@@ -1074,7 +1065,7 @@ Call: sSetStop2(ChP) | |||
1074 | #define sSetStop2(ChP) \ | 1065 | #define sSetStop2(ChP) \ |
1075 | do { \ | 1066 | do { \ |
1076 | (ChP)->TxControl[2] |= STOP2; \ | 1067 | (ChP)->TxControl[2] |= STOP2; \ |
1077 | sOutDW((ChP)->IndexAddr,*(DWord_t *)&(ChP)->TxControl[0]); \ | 1068 | out32((ChP)->IndexAddr,(ChP)->TxControl); \ |
1078 | } while (0) | 1069 | } while (0) |
1079 | 1070 | ||
1080 | /*************************************************************************** | 1071 | /*************************************************************************** |
@@ -1087,7 +1078,7 @@ Call: sSetTxXOFFChar(ChP,Ch) | |||
1087 | #define sSetTxXOFFChar(ChP,CH) \ | 1078 | #define sSetTxXOFFChar(ChP,CH) \ |
1088 | do { \ | 1079 | do { \ |
1089 | (ChP)->R[0x07] = (CH); \ | 1080 | (ChP)->R[0x07] = (CH); \ |
1090 | sOutDW((ChP)->IndexAddr,*(DWord_t *)&(ChP)->R[0x04]); \ | 1081 | out32((ChP)->IndexAddr,&(ChP)->R[0x04]); \ |
1091 | } while (0) | 1082 | } while (0) |
1092 | 1083 | ||
1093 | /*************************************************************************** | 1084 | /*************************************************************************** |
@@ -1100,7 +1091,7 @@ Call: sSetTxXONChar(ChP,Ch) | |||
1100 | #define sSetTxXONChar(ChP,CH) \ | 1091 | #define sSetTxXONChar(ChP,CH) \ |
1101 | do { \ | 1092 | do { \ |
1102 | (ChP)->R[0x0b] = (CH); \ | 1093 | (ChP)->R[0x0b] = (CH); \ |
1103 | sOutDW((ChP)->IndexAddr,*(DWord_t *)&(ChP)->R[0x08]); \ | 1094 | out32((ChP)->IndexAddr,&(ChP)->R[0x08]); \ |
1104 | } while (0) | 1095 | } while (0) |
1105 | 1096 | ||
1106 | /*************************************************************************** | 1097 | /*************************************************************************** |
@@ -1113,7 +1104,7 @@ Comments: This function is used to start a Rx processor after it was | |||
1113 | will restart both the Rx processor and software input flow control. | 1104 | will restart both the Rx processor and software input flow control. |
1114 | 1105 | ||
1115 | */ | 1106 | */ |
1116 | #define sStartRxProcessor(ChP) sOutDW((ChP)->IndexAddr,*(DWord_t *)&(ChP)->R[0]) | 1107 | #define sStartRxProcessor(ChP) out32((ChP)->IndexAddr,&(ChP)->R[0]) |
1117 | 1108 | ||
1118 | /*************************************************************************** | 1109 | /*************************************************************************** |
1119 | Function: sWriteTxByte | 1110 | Function: sWriteTxByte |
diff --git a/drivers/connector/cn_queue.c b/drivers/connector/cn_queue.c index 5732ca3259f9..b6fe7e7a2c2f 100644 --- a/drivers/connector/cn_queue.c +++ b/drivers/connector/cn_queue.c | |||
@@ -146,7 +146,7 @@ struct cn_queue_dev *cn_queue_alloc_dev(char *name, struct sock *nls) | |||
146 | 146 | ||
147 | dev->nls = nls; | 147 | dev->nls = nls; |
148 | 148 | ||
149 | dev->cn_queue = create_workqueue(dev->name); | 149 | dev->cn_queue = create_singlethread_workqueue(dev->name); |
150 | if (!dev->cn_queue) { | 150 | if (!dev->cn_queue) { |
151 | kfree(dev); | 151 | kfree(dev); |
152 | return NULL; | 152 | return NULL; |
diff --git a/drivers/dma/dmaengine.c b/drivers/dma/dmaengine.c index 29965231b912..8db0e7f9d3f4 100644 --- a/drivers/dma/dmaengine.c +++ b/drivers/dma/dmaengine.c | |||
@@ -357,7 +357,7 @@ int dma_async_device_register(struct dma_device *device) | |||
357 | !device->device_prep_dma_zero_sum); | 357 | !device->device_prep_dma_zero_sum); |
358 | BUG_ON(dma_has_cap(DMA_MEMSET, device->cap_mask) && | 358 | BUG_ON(dma_has_cap(DMA_MEMSET, device->cap_mask) && |
359 | !device->device_prep_dma_memset); | 359 | !device->device_prep_dma_memset); |
360 | BUG_ON(dma_has_cap(DMA_ZERO_SUM, device->cap_mask) && | 360 | BUG_ON(dma_has_cap(DMA_INTERRUPT, device->cap_mask) && |
361 | !device->device_prep_dma_interrupt); | 361 | !device->device_prep_dma_interrupt); |
362 | 362 | ||
363 | BUG_ON(!device->device_alloc_chan_resources); | 363 | BUG_ON(!device->device_alloc_chan_resources); |
diff --git a/drivers/dma/fsldma.c b/drivers/dma/fsldma.c index cc9a68158d99..72692309398a 100644 --- a/drivers/dma/fsldma.c +++ b/drivers/dma/fsldma.c | |||
@@ -57,12 +57,12 @@ static void dma_init(struct fsl_dma_chan *fsl_chan) | |||
57 | 57 | ||
58 | } | 58 | } |
59 | 59 | ||
60 | static void set_sr(struct fsl_dma_chan *fsl_chan, dma_addr_t val) | 60 | static void set_sr(struct fsl_dma_chan *fsl_chan, u32 val) |
61 | { | 61 | { |
62 | DMA_OUT(fsl_chan, &fsl_chan->reg_base->sr, val, 32); | 62 | DMA_OUT(fsl_chan, &fsl_chan->reg_base->sr, val, 32); |
63 | } | 63 | } |
64 | 64 | ||
65 | static dma_addr_t get_sr(struct fsl_dma_chan *fsl_chan) | 65 | static u32 get_sr(struct fsl_dma_chan *fsl_chan) |
66 | { | 66 | { |
67 | return DMA_IN(fsl_chan, &fsl_chan->reg_base->sr, 32); | 67 | return DMA_IN(fsl_chan, &fsl_chan->reg_base->sr, 32); |
68 | } | 68 | } |
@@ -123,6 +123,11 @@ static dma_addr_t get_ndar(struct fsl_dma_chan *fsl_chan) | |||
123 | return DMA_IN(fsl_chan, &fsl_chan->reg_base->ndar, 64); | 123 | return DMA_IN(fsl_chan, &fsl_chan->reg_base->ndar, 64); |
124 | } | 124 | } |
125 | 125 | ||
126 | static u32 get_bcr(struct fsl_dma_chan *fsl_chan) | ||
127 | { | ||
128 | return DMA_IN(fsl_chan, &fsl_chan->reg_base->bcr, 32); | ||
129 | } | ||
130 | |||
126 | static int dma_is_idle(struct fsl_dma_chan *fsl_chan) | 131 | static int dma_is_idle(struct fsl_dma_chan *fsl_chan) |
127 | { | 132 | { |
128 | u32 sr = get_sr(fsl_chan); | 133 | u32 sr = get_sr(fsl_chan); |
@@ -406,6 +411,35 @@ static void fsl_dma_free_chan_resources(struct dma_chan *chan) | |||
406 | dma_pool_destroy(fsl_chan->desc_pool); | 411 | dma_pool_destroy(fsl_chan->desc_pool); |
407 | } | 412 | } |
408 | 413 | ||
414 | static struct dma_async_tx_descriptor * | ||
415 | fsl_dma_prep_interrupt(struct dma_chan *chan) | ||
416 | { | ||
417 | struct fsl_dma_chan *fsl_chan; | ||
418 | struct fsl_desc_sw *new; | ||
419 | |||
420 | if (!chan) | ||
421 | return NULL; | ||
422 | |||
423 | fsl_chan = to_fsl_chan(chan); | ||
424 | |||
425 | new = fsl_dma_alloc_descriptor(fsl_chan); | ||
426 | if (!new) { | ||
427 | dev_err(fsl_chan->dev, "No free memory for link descriptor\n"); | ||
428 | return NULL; | ||
429 | } | ||
430 | |||
431 | new->async_tx.cookie = -EBUSY; | ||
432 | new->async_tx.ack = 0; | ||
433 | |||
434 | /* Insert the link descriptor to the LD ring */ | ||
435 | list_add_tail(&new->node, &new->async_tx.tx_list); | ||
436 | |||
437 | /* Set End-of-link to the last link descriptor of new list*/ | ||
438 | set_ld_eol(fsl_chan, new); | ||
439 | |||
440 | return &new->async_tx; | ||
441 | } | ||
442 | |||
409 | static struct dma_async_tx_descriptor *fsl_dma_prep_memcpy( | 443 | static struct dma_async_tx_descriptor *fsl_dma_prep_memcpy( |
410 | struct dma_chan *chan, dma_addr_t dma_dest, dma_addr_t dma_src, | 444 | struct dma_chan *chan, dma_addr_t dma_dest, dma_addr_t dma_src, |
411 | size_t len, unsigned long flags) | 445 | size_t len, unsigned long flags) |
@@ -436,7 +470,7 @@ static struct dma_async_tx_descriptor *fsl_dma_prep_memcpy( | |||
436 | dev_dbg(fsl_chan->dev, "new link desc alloc %p\n", new); | 470 | dev_dbg(fsl_chan->dev, "new link desc alloc %p\n", new); |
437 | #endif | 471 | #endif |
438 | 472 | ||
439 | copy = min(len, FSL_DMA_BCR_MAX_CNT); | 473 | copy = min(len, (size_t)FSL_DMA_BCR_MAX_CNT); |
440 | 474 | ||
441 | set_desc_cnt(fsl_chan, &new->hw, copy); | 475 | set_desc_cnt(fsl_chan, &new->hw, copy); |
442 | set_desc_src(fsl_chan, &new->hw, dma_src); | 476 | set_desc_src(fsl_chan, &new->hw, dma_src); |
@@ -513,7 +547,6 @@ static void fsl_chan_ld_cleanup(struct fsl_dma_chan *fsl_chan) | |||
513 | 547 | ||
514 | spin_lock_irqsave(&fsl_chan->desc_lock, flags); | 548 | spin_lock_irqsave(&fsl_chan->desc_lock, flags); |
515 | 549 | ||
516 | fsl_dma_update_completed_cookie(fsl_chan); | ||
517 | dev_dbg(fsl_chan->dev, "chan completed_cookie = %d\n", | 550 | dev_dbg(fsl_chan->dev, "chan completed_cookie = %d\n", |
518 | fsl_chan->completed_cookie); | 551 | fsl_chan->completed_cookie); |
519 | list_for_each_entry_safe(desc, _desc, &fsl_chan->ld_queue, node) { | 552 | list_for_each_entry_safe(desc, _desc, &fsl_chan->ld_queue, node) { |
@@ -581,8 +614,8 @@ static void fsl_chan_xfer_ld_queue(struct fsl_dma_chan *fsl_chan) | |||
581 | if (ld_node != &fsl_chan->ld_queue) { | 614 | if (ld_node != &fsl_chan->ld_queue) { |
582 | /* Get the ld start address from ld_queue */ | 615 | /* Get the ld start address from ld_queue */ |
583 | next_dest_addr = to_fsl_desc(ld_node)->async_tx.phys; | 616 | next_dest_addr = to_fsl_desc(ld_node)->async_tx.phys; |
584 | dev_dbg(fsl_chan->dev, "xfer LDs staring from 0x%016llx\n", | 617 | dev_dbg(fsl_chan->dev, "xfer LDs staring from %p\n", |
585 | (u64)next_dest_addr); | 618 | (void *)next_dest_addr); |
586 | set_cdar(fsl_chan, next_dest_addr); | 619 | set_cdar(fsl_chan, next_dest_addr); |
587 | dma_start(fsl_chan); | 620 | dma_start(fsl_chan); |
588 | } else { | 621 | } else { |
@@ -662,7 +695,7 @@ static enum dma_status fsl_dma_is_complete(struct dma_chan *chan, | |||
662 | static irqreturn_t fsl_dma_chan_do_interrupt(int irq, void *data) | 695 | static irqreturn_t fsl_dma_chan_do_interrupt(int irq, void *data) |
663 | { | 696 | { |
664 | struct fsl_dma_chan *fsl_chan = (struct fsl_dma_chan *)data; | 697 | struct fsl_dma_chan *fsl_chan = (struct fsl_dma_chan *)data; |
665 | dma_addr_t stat; | 698 | u32 stat; |
666 | 699 | ||
667 | stat = get_sr(fsl_chan); | 700 | stat = get_sr(fsl_chan); |
668 | dev_dbg(fsl_chan->dev, "event: channel %d, stat = 0x%x\n", | 701 | dev_dbg(fsl_chan->dev, "event: channel %d, stat = 0x%x\n", |
@@ -676,15 +709,32 @@ static irqreturn_t fsl_dma_chan_do_interrupt(int irq, void *data) | |||
676 | if (stat & FSL_DMA_SR_TE) | 709 | if (stat & FSL_DMA_SR_TE) |
677 | dev_err(fsl_chan->dev, "Transfer Error!\n"); | 710 | dev_err(fsl_chan->dev, "Transfer Error!\n"); |
678 | 711 | ||
712 | /* Programming Error | ||
713 | * The DMA_INTERRUPT async_tx is a NULL transfer, which will | ||
714 | * triger a PE interrupt. | ||
715 | */ | ||
716 | if (stat & FSL_DMA_SR_PE) { | ||
717 | dev_dbg(fsl_chan->dev, "event: Programming Error INT\n"); | ||
718 | if (get_bcr(fsl_chan) == 0) { | ||
719 | /* BCR register is 0, this is a DMA_INTERRUPT async_tx. | ||
720 | * Now, update the completed cookie, and continue the | ||
721 | * next uncompleted transfer. | ||
722 | */ | ||
723 | fsl_dma_update_completed_cookie(fsl_chan); | ||
724 | fsl_chan_xfer_ld_queue(fsl_chan); | ||
725 | } | ||
726 | stat &= ~FSL_DMA_SR_PE; | ||
727 | } | ||
728 | |||
679 | /* If the link descriptor segment transfer finishes, | 729 | /* If the link descriptor segment transfer finishes, |
680 | * we will recycle the used descriptor. | 730 | * we will recycle the used descriptor. |
681 | */ | 731 | */ |
682 | if (stat & FSL_DMA_SR_EOSI) { | 732 | if (stat & FSL_DMA_SR_EOSI) { |
683 | dev_dbg(fsl_chan->dev, "event: End-of-segments INT\n"); | 733 | dev_dbg(fsl_chan->dev, "event: End-of-segments INT\n"); |
684 | dev_dbg(fsl_chan->dev, "event: clndar 0x%016llx, " | 734 | dev_dbg(fsl_chan->dev, "event: clndar %p, nlndar %p\n", |
685 | "nlndar 0x%016llx\n", (u64)get_cdar(fsl_chan), | 735 | (void *)get_cdar(fsl_chan), (void *)get_ndar(fsl_chan)); |
686 | (u64)get_ndar(fsl_chan)); | ||
687 | stat &= ~FSL_DMA_SR_EOSI; | 736 | stat &= ~FSL_DMA_SR_EOSI; |
737 | fsl_dma_update_completed_cookie(fsl_chan); | ||
688 | } | 738 | } |
689 | 739 | ||
690 | /* If it current transfer is the end-of-transfer, | 740 | /* If it current transfer is the end-of-transfer, |
@@ -726,12 +776,15 @@ static void dma_do_tasklet(unsigned long data) | |||
726 | fsl_chan_ld_cleanup(fsl_chan); | 776 | fsl_chan_ld_cleanup(fsl_chan); |
727 | } | 777 | } |
728 | 778 | ||
779 | #ifdef FSL_DMA_CALLBACKTEST | ||
729 | static void fsl_dma_callback_test(struct fsl_dma_chan *fsl_chan) | 780 | static void fsl_dma_callback_test(struct fsl_dma_chan *fsl_chan) |
730 | { | 781 | { |
731 | if (fsl_chan) | 782 | if (fsl_chan) |
732 | dev_info(fsl_chan->dev, "selftest: callback is ok!\n"); | 783 | dev_info(fsl_chan->dev, "selftest: callback is ok!\n"); |
733 | } | 784 | } |
785 | #endif | ||
734 | 786 | ||
787 | #ifdef CONFIG_FSL_DMA_SELFTEST | ||
735 | static int fsl_dma_self_test(struct fsl_dma_chan *fsl_chan) | 788 | static int fsl_dma_self_test(struct fsl_dma_chan *fsl_chan) |
736 | { | 789 | { |
737 | struct dma_chan *chan; | 790 | struct dma_chan *chan; |
@@ -813,6 +866,11 @@ static int fsl_dma_self_test(struct fsl_dma_chan *fsl_chan) | |||
813 | tx3 = fsl_dma_prep_memcpy(chan, dma_dest, dma_src, test_size / 4, 0); | 866 | tx3 = fsl_dma_prep_memcpy(chan, dma_dest, dma_src, test_size / 4, 0); |
814 | async_tx_ack(tx3); | 867 | async_tx_ack(tx3); |
815 | 868 | ||
869 | /* Interrupt tx test */ | ||
870 | tx1 = fsl_dma_prep_interrupt(chan); | ||
871 | async_tx_ack(tx1); | ||
872 | cookie = fsl_dma_tx_submit(tx1); | ||
873 | |||
816 | /* Test exchanging the prepared tx sort */ | 874 | /* Test exchanging the prepared tx sort */ |
817 | cookie = fsl_dma_tx_submit(tx3); | 875 | cookie = fsl_dma_tx_submit(tx3); |
818 | cookie = fsl_dma_tx_submit(tx2); | 876 | cookie = fsl_dma_tx_submit(tx2); |
@@ -837,9 +895,9 @@ static int fsl_dma_self_test(struct fsl_dma_chan *fsl_chan) | |||
837 | if (err) { | 895 | if (err) { |
838 | for (i = 0; (*(src + i) == *(dest + i)) && (i < test_size); | 896 | for (i = 0; (*(src + i) == *(dest + i)) && (i < test_size); |
839 | i++); | 897 | i++); |
840 | dev_err(fsl_chan->dev, "selftest: Test failed, data %d/%d is " | 898 | dev_err(fsl_chan->dev, "selftest: Test failed, data %d/%ld is " |
841 | "error! src 0x%x, dest 0x%x\n", | 899 | "error! src 0x%x, dest 0x%x\n", |
842 | i, test_size, *(src + i), *(dest + i)); | 900 | i, (long)test_size, *(src + i), *(dest + i)); |
843 | } | 901 | } |
844 | 902 | ||
845 | free_resources: | 903 | free_resources: |
@@ -848,6 +906,7 @@ out: | |||
848 | kfree(src); | 906 | kfree(src); |
849 | return err; | 907 | return err; |
850 | } | 908 | } |
909 | #endif | ||
851 | 910 | ||
852 | static int __devinit of_fsl_dma_chan_probe(struct of_device *dev, | 911 | static int __devinit of_fsl_dma_chan_probe(struct of_device *dev, |
853 | const struct of_device_id *match) | 912 | const struct of_device_id *match) |
@@ -1008,8 +1067,8 @@ static int __devinit of_fsl_dma_probe(struct of_device *dev, | |||
1008 | } | 1067 | } |
1009 | 1068 | ||
1010 | dev_info(&dev->dev, "Probe the Freescale DMA driver for %s " | 1069 | dev_info(&dev->dev, "Probe the Freescale DMA driver for %s " |
1011 | "controller at 0x%08x...\n", | 1070 | "controller at %p...\n", |
1012 | match->compatible, fdev->reg.start); | 1071 | match->compatible, (void *)fdev->reg.start); |
1013 | fdev->reg_base = ioremap(fdev->reg.start, fdev->reg.end | 1072 | fdev->reg_base = ioremap(fdev->reg.start, fdev->reg.end |
1014 | - fdev->reg.start + 1); | 1073 | - fdev->reg.start + 1); |
1015 | 1074 | ||
@@ -1017,6 +1076,7 @@ static int __devinit of_fsl_dma_probe(struct of_device *dev, | |||
1017 | dma_cap_set(DMA_INTERRUPT, fdev->common.cap_mask); | 1076 | dma_cap_set(DMA_INTERRUPT, fdev->common.cap_mask); |
1018 | fdev->common.device_alloc_chan_resources = fsl_dma_alloc_chan_resources; | 1077 | fdev->common.device_alloc_chan_resources = fsl_dma_alloc_chan_resources; |
1019 | fdev->common.device_free_chan_resources = fsl_dma_free_chan_resources; | 1078 | fdev->common.device_free_chan_resources = fsl_dma_free_chan_resources; |
1079 | fdev->common.device_prep_dma_interrupt = fsl_dma_prep_interrupt; | ||
1020 | fdev->common.device_prep_dma_memcpy = fsl_dma_prep_memcpy; | 1080 | fdev->common.device_prep_dma_memcpy = fsl_dma_prep_memcpy; |
1021 | fdev->common.device_is_tx_complete = fsl_dma_is_complete; | 1081 | fdev->common.device_is_tx_complete = fsl_dma_is_complete; |
1022 | fdev->common.device_issue_pending = fsl_dma_memcpy_issue_pending; | 1082 | fdev->common.device_issue_pending = fsl_dma_memcpy_issue_pending; |
diff --git a/drivers/dma/fsldma.h b/drivers/dma/fsldma.h index ba78c42121ba..fddd6aee2a63 100644 --- a/drivers/dma/fsldma.h +++ b/drivers/dma/fsldma.h | |||
@@ -40,6 +40,7 @@ | |||
40 | #define FSL_DMA_MR_EOTIE 0x00000080 | 40 | #define FSL_DMA_MR_EOTIE 0x00000080 |
41 | 41 | ||
42 | #define FSL_DMA_SR_CH 0x00000020 | 42 | #define FSL_DMA_SR_CH 0x00000020 |
43 | #define FSL_DMA_SR_PE 0x00000010 | ||
43 | #define FSL_DMA_SR_CB 0x00000004 | 44 | #define FSL_DMA_SR_CB 0x00000004 |
44 | #define FSL_DMA_SR_TE 0x00000080 | 45 | #define FSL_DMA_SR_TE 0x00000080 |
45 | #define FSL_DMA_SR_EOSI 0x00000002 | 46 | #define FSL_DMA_SR_EOSI 0x00000002 |
diff --git a/drivers/dma/iop-adma.c b/drivers/dma/iop-adma.c index 3986d54492bd..f82b0906d466 100644 --- a/drivers/dma/iop-adma.c +++ b/drivers/dma/iop-adma.c | |||
@@ -140,7 +140,7 @@ static void __iop_adma_slot_cleanup(struct iop_adma_chan *iop_chan) | |||
140 | int busy = iop_chan_is_busy(iop_chan); | 140 | int busy = iop_chan_is_busy(iop_chan); |
141 | int seen_current = 0, slot_cnt = 0, slots_per_op = 0; | 141 | int seen_current = 0, slot_cnt = 0, slots_per_op = 0; |
142 | 142 | ||
143 | dev_dbg(iop_chan->device->common.dev, "%s\n", __FUNCTION__); | 143 | dev_dbg(iop_chan->device->common.dev, "%s\n", __func__); |
144 | /* free completed slots from the chain starting with | 144 | /* free completed slots from the chain starting with |
145 | * the oldest descriptor | 145 | * the oldest descriptor |
146 | */ | 146 | */ |
@@ -438,7 +438,7 @@ iop_adma_tx_submit(struct dma_async_tx_descriptor *tx) | |||
438 | spin_unlock_bh(&iop_chan->lock); | 438 | spin_unlock_bh(&iop_chan->lock); |
439 | 439 | ||
440 | dev_dbg(iop_chan->device->common.dev, "%s cookie: %d slot: %d\n", | 440 | dev_dbg(iop_chan->device->common.dev, "%s cookie: %d slot: %d\n", |
441 | __FUNCTION__, sw_desc->async_tx.cookie, sw_desc->idx); | 441 | __func__, sw_desc->async_tx.cookie, sw_desc->idx); |
442 | 442 | ||
443 | return cookie; | 443 | return cookie; |
444 | } | 444 | } |
@@ -520,7 +520,7 @@ iop_adma_prep_dma_interrupt(struct dma_chan *chan) | |||
520 | struct iop_adma_desc_slot *sw_desc, *grp_start; | 520 | struct iop_adma_desc_slot *sw_desc, *grp_start; |
521 | int slot_cnt, slots_per_op; | 521 | int slot_cnt, slots_per_op; |
522 | 522 | ||
523 | dev_dbg(iop_chan->device->common.dev, "%s\n", __FUNCTION__); | 523 | dev_dbg(iop_chan->device->common.dev, "%s\n", __func__); |
524 | 524 | ||
525 | spin_lock_bh(&iop_chan->lock); | 525 | spin_lock_bh(&iop_chan->lock); |
526 | slot_cnt = iop_chan_interrupt_slot_count(&slots_per_op, iop_chan); | 526 | slot_cnt = iop_chan_interrupt_slot_count(&slots_per_op, iop_chan); |
@@ -548,7 +548,7 @@ iop_adma_prep_dma_memcpy(struct dma_chan *chan, dma_addr_t dma_dest, | |||
548 | BUG_ON(unlikely(len > IOP_ADMA_MAX_BYTE_COUNT)); | 548 | BUG_ON(unlikely(len > IOP_ADMA_MAX_BYTE_COUNT)); |
549 | 549 | ||
550 | dev_dbg(iop_chan->device->common.dev, "%s len: %u\n", | 550 | dev_dbg(iop_chan->device->common.dev, "%s len: %u\n", |
551 | __FUNCTION__, len); | 551 | __func__, len); |
552 | 552 | ||
553 | spin_lock_bh(&iop_chan->lock); | 553 | spin_lock_bh(&iop_chan->lock); |
554 | slot_cnt = iop_chan_memcpy_slot_count(len, &slots_per_op); | 554 | slot_cnt = iop_chan_memcpy_slot_count(len, &slots_per_op); |
@@ -580,7 +580,7 @@ iop_adma_prep_dma_memset(struct dma_chan *chan, dma_addr_t dma_dest, | |||
580 | BUG_ON(unlikely(len > IOP_ADMA_MAX_BYTE_COUNT)); | 580 | BUG_ON(unlikely(len > IOP_ADMA_MAX_BYTE_COUNT)); |
581 | 581 | ||
582 | dev_dbg(iop_chan->device->common.dev, "%s len: %u\n", | 582 | dev_dbg(iop_chan->device->common.dev, "%s len: %u\n", |
583 | __FUNCTION__, len); | 583 | __func__, len); |
584 | 584 | ||
585 | spin_lock_bh(&iop_chan->lock); | 585 | spin_lock_bh(&iop_chan->lock); |
586 | slot_cnt = iop_chan_memset_slot_count(len, &slots_per_op); | 586 | slot_cnt = iop_chan_memset_slot_count(len, &slots_per_op); |
@@ -614,7 +614,7 @@ iop_adma_prep_dma_xor(struct dma_chan *chan, dma_addr_t dma_dest, | |||
614 | 614 | ||
615 | dev_dbg(iop_chan->device->common.dev, | 615 | dev_dbg(iop_chan->device->common.dev, |
616 | "%s src_cnt: %d len: %u flags: %lx\n", | 616 | "%s src_cnt: %d len: %u flags: %lx\n", |
617 | __FUNCTION__, src_cnt, len, flags); | 617 | __func__, src_cnt, len, flags); |
618 | 618 | ||
619 | spin_lock_bh(&iop_chan->lock); | 619 | spin_lock_bh(&iop_chan->lock); |
620 | slot_cnt = iop_chan_xor_slot_count(len, src_cnt, &slots_per_op); | 620 | slot_cnt = iop_chan_xor_slot_count(len, src_cnt, &slots_per_op); |
@@ -648,7 +648,7 @@ iop_adma_prep_dma_zero_sum(struct dma_chan *chan, dma_addr_t *dma_src, | |||
648 | return NULL; | 648 | return NULL; |
649 | 649 | ||
650 | dev_dbg(iop_chan->device->common.dev, "%s src_cnt: %d len: %u\n", | 650 | dev_dbg(iop_chan->device->common.dev, "%s src_cnt: %d len: %u\n", |
651 | __FUNCTION__, src_cnt, len); | 651 | __func__, src_cnt, len); |
652 | 652 | ||
653 | spin_lock_bh(&iop_chan->lock); | 653 | spin_lock_bh(&iop_chan->lock); |
654 | slot_cnt = iop_chan_zero_sum_slot_count(len, src_cnt, &slots_per_op); | 654 | slot_cnt = iop_chan_zero_sum_slot_count(len, src_cnt, &slots_per_op); |
@@ -659,7 +659,7 @@ iop_adma_prep_dma_zero_sum(struct dma_chan *chan, dma_addr_t *dma_src, | |||
659 | iop_desc_set_zero_sum_byte_count(grp_start, len); | 659 | iop_desc_set_zero_sum_byte_count(grp_start, len); |
660 | grp_start->xor_check_result = result; | 660 | grp_start->xor_check_result = result; |
661 | pr_debug("\t%s: grp_start->xor_check_result: %p\n", | 661 | pr_debug("\t%s: grp_start->xor_check_result: %p\n", |
662 | __FUNCTION__, grp_start->xor_check_result); | 662 | __func__, grp_start->xor_check_result); |
663 | sw_desc->unmap_src_cnt = src_cnt; | 663 | sw_desc->unmap_src_cnt = src_cnt; |
664 | sw_desc->unmap_len = len; | 664 | sw_desc->unmap_len = len; |
665 | while (src_cnt--) | 665 | while (src_cnt--) |
@@ -700,7 +700,7 @@ static void iop_adma_free_chan_resources(struct dma_chan *chan) | |||
700 | iop_chan->last_used = NULL; | 700 | iop_chan->last_used = NULL; |
701 | 701 | ||
702 | dev_dbg(iop_chan->device->common.dev, "%s slots_allocated %d\n", | 702 | dev_dbg(iop_chan->device->common.dev, "%s slots_allocated %d\n", |
703 | __FUNCTION__, iop_chan->slots_allocated); | 703 | __func__, iop_chan->slots_allocated); |
704 | spin_unlock_bh(&iop_chan->lock); | 704 | spin_unlock_bh(&iop_chan->lock); |
705 | 705 | ||
706 | /* one is ok since we left it on there on purpose */ | 706 | /* one is ok since we left it on there on purpose */ |
@@ -753,7 +753,7 @@ static irqreturn_t iop_adma_eot_handler(int irq, void *data) | |||
753 | { | 753 | { |
754 | struct iop_adma_chan *chan = data; | 754 | struct iop_adma_chan *chan = data; |
755 | 755 | ||
756 | dev_dbg(chan->device->common.dev, "%s\n", __FUNCTION__); | 756 | dev_dbg(chan->device->common.dev, "%s\n", __func__); |
757 | 757 | ||
758 | tasklet_schedule(&chan->irq_tasklet); | 758 | tasklet_schedule(&chan->irq_tasklet); |
759 | 759 | ||
@@ -766,7 +766,7 @@ static irqreturn_t iop_adma_eoc_handler(int irq, void *data) | |||
766 | { | 766 | { |
767 | struct iop_adma_chan *chan = data; | 767 | struct iop_adma_chan *chan = data; |
768 | 768 | ||
769 | dev_dbg(chan->device->common.dev, "%s\n", __FUNCTION__); | 769 | dev_dbg(chan->device->common.dev, "%s\n", __func__); |
770 | 770 | ||
771 | tasklet_schedule(&chan->irq_tasklet); | 771 | tasklet_schedule(&chan->irq_tasklet); |
772 | 772 | ||
@@ -823,7 +823,7 @@ static int __devinit iop_adma_memcpy_self_test(struct iop_adma_device *device) | |||
823 | int err = 0; | 823 | int err = 0; |
824 | struct iop_adma_chan *iop_chan; | 824 | struct iop_adma_chan *iop_chan; |
825 | 825 | ||
826 | dev_dbg(device->common.dev, "%s\n", __FUNCTION__); | 826 | dev_dbg(device->common.dev, "%s\n", __func__); |
827 | 827 | ||
828 | src = kzalloc(sizeof(u8) * IOP_ADMA_TEST_SIZE, GFP_KERNEL); | 828 | src = kzalloc(sizeof(u8) * IOP_ADMA_TEST_SIZE, GFP_KERNEL); |
829 | if (!src) | 829 | if (!src) |
@@ -906,7 +906,7 @@ iop_adma_xor_zero_sum_self_test(struct iop_adma_device *device) | |||
906 | int err = 0; | 906 | int err = 0; |
907 | struct iop_adma_chan *iop_chan; | 907 | struct iop_adma_chan *iop_chan; |
908 | 908 | ||
909 | dev_dbg(device->common.dev, "%s\n", __FUNCTION__); | 909 | dev_dbg(device->common.dev, "%s\n", __func__); |
910 | 910 | ||
911 | for (src_idx = 0; src_idx < IOP_ADMA_NUM_SRC_TEST; src_idx++) { | 911 | for (src_idx = 0; src_idx < IOP_ADMA_NUM_SRC_TEST; src_idx++) { |
912 | xor_srcs[src_idx] = alloc_page(GFP_KERNEL); | 912 | xor_srcs[src_idx] = alloc_page(GFP_KERNEL); |
@@ -1159,7 +1159,7 @@ static int __devinit iop_adma_probe(struct platform_device *pdev) | |||
1159 | } | 1159 | } |
1160 | 1160 | ||
1161 | dev_dbg(&pdev->dev, "%s: allocted descriptor pool virt %p phys %p\n", | 1161 | dev_dbg(&pdev->dev, "%s: allocted descriptor pool virt %p phys %p\n", |
1162 | __FUNCTION__, adev->dma_desc_pool_virt, | 1162 | __func__, adev->dma_desc_pool_virt, |
1163 | (void *) adev->dma_desc_pool); | 1163 | (void *) adev->dma_desc_pool); |
1164 | 1164 | ||
1165 | adev->id = plat_data->hw_id; | 1165 | adev->id = plat_data->hw_id; |
@@ -1289,7 +1289,7 @@ static void iop_chan_start_null_memcpy(struct iop_adma_chan *iop_chan) | |||
1289 | dma_cookie_t cookie; | 1289 | dma_cookie_t cookie; |
1290 | int slot_cnt, slots_per_op; | 1290 | int slot_cnt, slots_per_op; |
1291 | 1291 | ||
1292 | dev_dbg(iop_chan->device->common.dev, "%s\n", __FUNCTION__); | 1292 | dev_dbg(iop_chan->device->common.dev, "%s\n", __func__); |
1293 | 1293 | ||
1294 | spin_lock_bh(&iop_chan->lock); | 1294 | spin_lock_bh(&iop_chan->lock); |
1295 | slot_cnt = iop_chan_memcpy_slot_count(0, &slots_per_op); | 1295 | slot_cnt = iop_chan_memcpy_slot_count(0, &slots_per_op); |
@@ -1346,7 +1346,7 @@ static void iop_chan_start_null_xor(struct iop_adma_chan *iop_chan) | |||
1346 | dma_cookie_t cookie; | 1346 | dma_cookie_t cookie; |
1347 | int slot_cnt, slots_per_op; | 1347 | int slot_cnt, slots_per_op; |
1348 | 1348 | ||
1349 | dev_dbg(iop_chan->device->common.dev, "%s\n", __FUNCTION__); | 1349 | dev_dbg(iop_chan->device->common.dev, "%s\n", __func__); |
1350 | 1350 | ||
1351 | spin_lock_bh(&iop_chan->lock); | 1351 | spin_lock_bh(&iop_chan->lock); |
1352 | slot_cnt = iop_chan_xor_slot_count(0, 2, &slots_per_op); | 1352 | slot_cnt = iop_chan_xor_slot_count(0, 2, &slots_per_op); |
diff --git a/drivers/firewire/Kconfig b/drivers/firewire/Kconfig index fe9e768cfbc4..25bdc2dd9ce1 100644 --- a/drivers/firewire/Kconfig +++ b/drivers/firewire/Kconfig | |||
@@ -1,5 +1,3 @@ | |||
1 | # -*- shell-script -*- | ||
2 | |||
3 | comment "An alternative FireWire stack is available with EXPERIMENTAL=y" | 1 | comment "An alternative FireWire stack is available with EXPERIMENTAL=y" |
4 | depends on EXPERIMENTAL=n | 2 | depends on EXPERIMENTAL=n |
5 | 3 | ||
@@ -21,27 +19,7 @@ config FIREWIRE | |||
21 | NOTE: | 19 | NOTE: |
22 | 20 | ||
23 | You should only build ONE of the stacks, unless you REALLY know what | 21 | You should only build ONE of the stacks, unless you REALLY know what |
24 | you are doing. If you install both, you should configure them only as | 22 | you are doing. |
25 | modules rather than link them statically, and you should blacklist one | ||
26 | of the concurrent low-level drivers in /etc/modprobe.conf. Add either | ||
27 | |||
28 | blacklist firewire-ohci | ||
29 | or | ||
30 | blacklist ohci1394 | ||
31 | |||
32 | there depending on which driver you DON'T want to have auto-loaded. | ||
33 | You can optionally do the same with the other IEEE 1394/ FireWire | ||
34 | drivers. | ||
35 | |||
36 | If you have an old modprobe which doesn't implement the blacklist | ||
37 | directive, use either | ||
38 | |||
39 | install firewire-ohci /bin/true | ||
40 | or | ||
41 | install ohci1394 /bin/true | ||
42 | |||
43 | and so on, depending on which modules you DON't want to have | ||
44 | auto-loaded. | ||
45 | 23 | ||
46 | config FIREWIRE_OHCI | 24 | config FIREWIRE_OHCI |
47 | tristate "Support for OHCI FireWire host controllers" | 25 | tristate "Support for OHCI FireWire host controllers" |
@@ -57,8 +35,24 @@ config FIREWIRE_OHCI | |||
57 | 35 | ||
58 | NOTE: | 36 | NOTE: |
59 | 37 | ||
60 | If you also build ohci1394 of the classic stack, blacklist either | 38 | You should only build ohci1394 or firewire-ohci, but not both. |
61 | ohci1394 or firewire-ohci to let hotplug load only the desired driver. | 39 | If you nevertheless want to install both, you should configure them |
40 | only as modules and blacklist the driver(s) which you don't want to | ||
41 | have auto-loaded. Add either | ||
42 | |||
43 | blacklist firewire-ohci | ||
44 | or | ||
45 | blacklist ohci1394 | ||
46 | blacklist video1394 | ||
47 | blacklist dv1394 | ||
48 | |||
49 | to /etc/modprobe.conf or /etc/modprobe.d/* and update modprobe.conf | ||
50 | depending on your distribution. The latter two modules should be | ||
51 | blacklisted together with ohci1394 because they depend on ohci1394. | ||
52 | |||
53 | If you have an old modprobe which doesn't implement the blacklist | ||
54 | directive, use "install modulename /bin/true" for the modules to be | ||
55 | blacklisted. | ||
62 | 56 | ||
63 | config FIREWIRE_SBP2 | 57 | config FIREWIRE_SBP2 |
64 | tristate "Support for storage devices (SBP-2 protocol driver)" | 58 | tristate "Support for storage devices (SBP-2 protocol driver)" |
@@ -75,9 +69,3 @@ config FIREWIRE_SBP2 | |||
75 | 69 | ||
76 | You should also enable support for disks, CD-ROMs, etc. in the SCSI | 70 | You should also enable support for disks, CD-ROMs, etc. in the SCSI |
77 | configuration section. | 71 | configuration section. |
78 | |||
79 | NOTE: | ||
80 | |||
81 | If you also build sbp2 of the classic stack, blacklist either sbp2 | ||
82 | or firewire-sbp2 to let hotplug load only the desired driver. | ||
83 | |||
diff --git a/drivers/firewire/fw-ohci.c b/drivers/firewire/fw-ohci.c index 7ebad3c14cb8..996d61f0d460 100644 --- a/drivers/firewire/fw-ohci.c +++ b/drivers/firewire/fw-ohci.c | |||
@@ -33,6 +33,10 @@ | |||
33 | #include <asm/page.h> | 33 | #include <asm/page.h> |
34 | #include <asm/system.h> | 34 | #include <asm/system.h> |
35 | 35 | ||
36 | #ifdef CONFIG_PPC_PMAC | ||
37 | #include <asm/pmac_feature.h> | ||
38 | #endif | ||
39 | |||
36 | #include "fw-ohci.h" | 40 | #include "fw-ohci.h" |
37 | #include "fw-transaction.h" | 41 | #include "fw-transaction.h" |
38 | 42 | ||
@@ -175,6 +179,7 @@ struct fw_ohci { | |||
175 | int generation; | 179 | int generation; |
176 | int request_generation; | 180 | int request_generation; |
177 | u32 bus_seconds; | 181 | u32 bus_seconds; |
182 | bool old_uninorth; | ||
178 | 183 | ||
179 | /* | 184 | /* |
180 | * Spinlock for accessing fw_ohci data. Never call out of | 185 | * Spinlock for accessing fw_ohci data. Never call out of |
@@ -276,19 +281,13 @@ static int ar_context_add_page(struct ar_context *ctx) | |||
276 | { | 281 | { |
277 | struct device *dev = ctx->ohci->card.device; | 282 | struct device *dev = ctx->ohci->card.device; |
278 | struct ar_buffer *ab; | 283 | struct ar_buffer *ab; |
279 | dma_addr_t ab_bus; | 284 | dma_addr_t uninitialized_var(ab_bus); |
280 | size_t offset; | 285 | size_t offset; |
281 | 286 | ||
282 | ab = (struct ar_buffer *) __get_free_page(GFP_ATOMIC); | 287 | ab = dma_alloc_coherent(dev, PAGE_SIZE, &ab_bus, GFP_ATOMIC); |
283 | if (ab == NULL) | 288 | if (ab == NULL) |
284 | return -ENOMEM; | 289 | return -ENOMEM; |
285 | 290 | ||
286 | ab_bus = dma_map_single(dev, ab, PAGE_SIZE, DMA_BIDIRECTIONAL); | ||
287 | if (dma_mapping_error(ab_bus)) { | ||
288 | free_page((unsigned long) ab); | ||
289 | return -ENOMEM; | ||
290 | } | ||
291 | |||
292 | memset(&ab->descriptor, 0, sizeof(ab->descriptor)); | 291 | memset(&ab->descriptor, 0, sizeof(ab->descriptor)); |
293 | ab->descriptor.control = cpu_to_le16(DESCRIPTOR_INPUT_MORE | | 292 | ab->descriptor.control = cpu_to_le16(DESCRIPTOR_INPUT_MORE | |
294 | DESCRIPTOR_STATUS | | 293 | DESCRIPTOR_STATUS | |
@@ -299,8 +298,6 @@ static int ar_context_add_page(struct ar_context *ctx) | |||
299 | ab->descriptor.res_count = cpu_to_le16(PAGE_SIZE - offset); | 298 | ab->descriptor.res_count = cpu_to_le16(PAGE_SIZE - offset); |
300 | ab->descriptor.branch_address = 0; | 299 | ab->descriptor.branch_address = 0; |
301 | 300 | ||
302 | dma_sync_single_for_device(dev, ab_bus, PAGE_SIZE, DMA_BIDIRECTIONAL); | ||
303 | |||
304 | ctx->last_buffer->descriptor.branch_address = cpu_to_le32(ab_bus | 1); | 301 | ctx->last_buffer->descriptor.branch_address = cpu_to_le32(ab_bus | 1); |
305 | ctx->last_buffer->next = ab; | 302 | ctx->last_buffer->next = ab; |
306 | ctx->last_buffer = ab; | 303 | ctx->last_buffer = ab; |
@@ -311,15 +308,22 @@ static int ar_context_add_page(struct ar_context *ctx) | |||
311 | return 0; | 308 | return 0; |
312 | } | 309 | } |
313 | 310 | ||
311 | #if defined(CONFIG_PPC_PMAC) && defined(CONFIG_PPC32) | ||
312 | #define cond_le32_to_cpu(v) \ | ||
313 | (ohci->old_uninorth ? (__force __u32)(v) : le32_to_cpu(v)) | ||
314 | #else | ||
315 | #define cond_le32_to_cpu(v) le32_to_cpu(v) | ||
316 | #endif | ||
317 | |||
314 | static __le32 *handle_ar_packet(struct ar_context *ctx, __le32 *buffer) | 318 | static __le32 *handle_ar_packet(struct ar_context *ctx, __le32 *buffer) |
315 | { | 319 | { |
316 | struct fw_ohci *ohci = ctx->ohci; | 320 | struct fw_ohci *ohci = ctx->ohci; |
317 | struct fw_packet p; | 321 | struct fw_packet p; |
318 | u32 status, length, tcode; | 322 | u32 status, length, tcode; |
319 | 323 | ||
320 | p.header[0] = le32_to_cpu(buffer[0]); | 324 | p.header[0] = cond_le32_to_cpu(buffer[0]); |
321 | p.header[1] = le32_to_cpu(buffer[1]); | 325 | p.header[1] = cond_le32_to_cpu(buffer[1]); |
322 | p.header[2] = le32_to_cpu(buffer[2]); | 326 | p.header[2] = cond_le32_to_cpu(buffer[2]); |
323 | 327 | ||
324 | tcode = (p.header[0] >> 4) & 0x0f; | 328 | tcode = (p.header[0] >> 4) & 0x0f; |
325 | switch (tcode) { | 329 | switch (tcode) { |
@@ -331,7 +335,7 @@ static __le32 *handle_ar_packet(struct ar_context *ctx, __le32 *buffer) | |||
331 | break; | 335 | break; |
332 | 336 | ||
333 | case TCODE_READ_BLOCK_REQUEST : | 337 | case TCODE_READ_BLOCK_REQUEST : |
334 | p.header[3] = le32_to_cpu(buffer[3]); | 338 | p.header[3] = cond_le32_to_cpu(buffer[3]); |
335 | p.header_length = 16; | 339 | p.header_length = 16; |
336 | p.payload_length = 0; | 340 | p.payload_length = 0; |
337 | break; | 341 | break; |
@@ -340,7 +344,7 @@ static __le32 *handle_ar_packet(struct ar_context *ctx, __le32 *buffer) | |||
340 | case TCODE_READ_BLOCK_RESPONSE: | 344 | case TCODE_READ_BLOCK_RESPONSE: |
341 | case TCODE_LOCK_REQUEST: | 345 | case TCODE_LOCK_REQUEST: |
342 | case TCODE_LOCK_RESPONSE: | 346 | case TCODE_LOCK_RESPONSE: |
343 | p.header[3] = le32_to_cpu(buffer[3]); | 347 | p.header[3] = cond_le32_to_cpu(buffer[3]); |
344 | p.header_length = 16; | 348 | p.header_length = 16; |
345 | p.payload_length = p.header[3] >> 16; | 349 | p.payload_length = p.header[3] >> 16; |
346 | break; | 350 | break; |
@@ -357,7 +361,7 @@ static __le32 *handle_ar_packet(struct ar_context *ctx, __le32 *buffer) | |||
357 | 361 | ||
358 | /* FIXME: What to do about evt_* errors? */ | 362 | /* FIXME: What to do about evt_* errors? */ |
359 | length = (p.header_length + p.payload_length + 3) / 4; | 363 | length = (p.header_length + p.payload_length + 3) / 4; |
360 | status = le32_to_cpu(buffer[length]); | 364 | status = cond_le32_to_cpu(buffer[length]); |
361 | 365 | ||
362 | p.ack = ((status >> 16) & 0x1f) - 16; | 366 | p.ack = ((status >> 16) & 0x1f) - 16; |
363 | p.speed = (status >> 21) & 0x7; | 367 | p.speed = (status >> 21) & 0x7; |
@@ -375,7 +379,7 @@ static __le32 *handle_ar_packet(struct ar_context *ctx, __le32 *buffer) | |||
375 | */ | 379 | */ |
376 | 380 | ||
377 | if (p.ack + 16 == 0x09) | 381 | if (p.ack + 16 == 0x09) |
378 | ohci->request_generation = (buffer[2] >> 16) & 0xff; | 382 | ohci->request_generation = (p.header[2] >> 16) & 0xff; |
379 | else if (ctx == &ohci->ar_request_ctx) | 383 | else if (ctx == &ohci->ar_request_ctx) |
380 | fw_core_handle_request(&ohci->card, &p); | 384 | fw_core_handle_request(&ohci->card, &p); |
381 | else | 385 | else |
@@ -397,6 +401,7 @@ static void ar_context_tasklet(unsigned long data) | |||
397 | 401 | ||
398 | if (d->res_count == 0) { | 402 | if (d->res_count == 0) { |
399 | size_t size, rest, offset; | 403 | size_t size, rest, offset; |
404 | dma_addr_t buffer_bus; | ||
400 | 405 | ||
401 | /* | 406 | /* |
402 | * This descriptor is finished and we may have a | 407 | * This descriptor is finished and we may have a |
@@ -405,9 +410,7 @@ static void ar_context_tasklet(unsigned long data) | |||
405 | */ | 410 | */ |
406 | 411 | ||
407 | offset = offsetof(struct ar_buffer, data); | 412 | offset = offsetof(struct ar_buffer, data); |
408 | dma_unmap_single(ohci->card.device, | 413 | buffer_bus = le32_to_cpu(ab->descriptor.data_address) - offset; |
409 | le32_to_cpu(ab->descriptor.data_address) - offset, | ||
410 | PAGE_SIZE, DMA_BIDIRECTIONAL); | ||
411 | 414 | ||
412 | buffer = ab; | 415 | buffer = ab; |
413 | ab = ab->next; | 416 | ab = ab->next; |
@@ -423,7 +426,8 @@ static void ar_context_tasklet(unsigned long data) | |||
423 | while (buffer < end) | 426 | while (buffer < end) |
424 | buffer = handle_ar_packet(ctx, buffer); | 427 | buffer = handle_ar_packet(ctx, buffer); |
425 | 428 | ||
426 | free_page((unsigned long)buffer); | 429 | dma_free_coherent(ohci->card.device, PAGE_SIZE, |
430 | buffer, buffer_bus); | ||
427 | ar_context_add_page(ctx); | 431 | ar_context_add_page(ctx); |
428 | } else { | 432 | } else { |
429 | buffer = ctx->pointer; | 433 | buffer = ctx->pointer; |
@@ -532,7 +536,7 @@ static int | |||
532 | context_add_buffer(struct context *ctx) | 536 | context_add_buffer(struct context *ctx) |
533 | { | 537 | { |
534 | struct descriptor_buffer *desc; | 538 | struct descriptor_buffer *desc; |
535 | dma_addr_t bus_addr; | 539 | dma_addr_t uninitialized_var(bus_addr); |
536 | int offset; | 540 | int offset; |
537 | 541 | ||
538 | /* | 542 | /* |
@@ -1022,13 +1026,14 @@ static void bus_reset_tasklet(unsigned long data) | |||
1022 | */ | 1026 | */ |
1023 | 1027 | ||
1024 | self_id_count = (reg_read(ohci, OHCI1394_SelfIDCount) >> 3) & 0x3ff; | 1028 | self_id_count = (reg_read(ohci, OHCI1394_SelfIDCount) >> 3) & 0x3ff; |
1025 | generation = (le32_to_cpu(ohci->self_id_cpu[0]) >> 16) & 0xff; | 1029 | generation = (cond_le32_to_cpu(ohci->self_id_cpu[0]) >> 16) & 0xff; |
1026 | rmb(); | 1030 | rmb(); |
1027 | 1031 | ||
1028 | for (i = 1, j = 0; j < self_id_count; i += 2, j++) { | 1032 | for (i = 1, j = 0; j < self_id_count; i += 2, j++) { |
1029 | if (ohci->self_id_cpu[i] != ~ohci->self_id_cpu[i + 1]) | 1033 | if (ohci->self_id_cpu[i] != ~ohci->self_id_cpu[i + 1]) |
1030 | fw_error("inconsistent self IDs\n"); | 1034 | fw_error("inconsistent self IDs\n"); |
1031 | ohci->self_id_buffer[j] = le32_to_cpu(ohci->self_id_cpu[i]); | 1035 | ohci->self_id_buffer[j] = |
1036 | cond_le32_to_cpu(ohci->self_id_cpu[i]); | ||
1032 | } | 1037 | } |
1033 | rmb(); | 1038 | rmb(); |
1034 | 1039 | ||
@@ -1316,7 +1321,7 @@ ohci_set_config_rom(struct fw_card *card, u32 *config_rom, size_t length) | |||
1316 | unsigned long flags; | 1321 | unsigned long flags; |
1317 | int retval = -EBUSY; | 1322 | int retval = -EBUSY; |
1318 | __be32 *next_config_rom; | 1323 | __be32 *next_config_rom; |
1319 | dma_addr_t next_config_rom_bus; | 1324 | dma_addr_t uninitialized_var(next_config_rom_bus); |
1320 | 1325 | ||
1321 | ohci = fw_ohci(card); | 1326 | ohci = fw_ohci(card); |
1322 | 1327 | ||
@@ -1487,7 +1492,7 @@ static int handle_ir_dualbuffer_packet(struct context *context, | |||
1487 | void *p, *end; | 1492 | void *p, *end; |
1488 | int i; | 1493 | int i; |
1489 | 1494 | ||
1490 | if (db->first_res_count > 0 && db->second_res_count > 0) { | 1495 | if (db->first_res_count != 0 && db->second_res_count != 0) { |
1491 | if (ctx->excess_bytes <= le16_to_cpu(db->second_req_count)) { | 1496 | if (ctx->excess_bytes <= le16_to_cpu(db->second_req_count)) { |
1492 | /* This descriptor isn't done yet, stop iteration. */ | 1497 | /* This descriptor isn't done yet, stop iteration. */ |
1493 | return 0; | 1498 | return 0; |
@@ -1513,7 +1518,7 @@ static int handle_ir_dualbuffer_packet(struct context *context, | |||
1513 | memcpy(ctx->header + i + 4, p + 8, ctx->base.header_size - 4); | 1518 | memcpy(ctx->header + i + 4, p + 8, ctx->base.header_size - 4); |
1514 | i += ctx->base.header_size; | 1519 | i += ctx->base.header_size; |
1515 | ctx->excess_bytes += | 1520 | ctx->excess_bytes += |
1516 | (le32_to_cpu(*(u32 *)(p + 4)) >> 16) & 0xffff; | 1521 | (le32_to_cpu(*(__le32 *)(p + 4)) >> 16) & 0xffff; |
1517 | p += ctx->base.header_size + 4; | 1522 | p += ctx->base.header_size + 4; |
1518 | } | 1523 | } |
1519 | ctx->header_length = i; | 1524 | ctx->header_length = i; |
@@ -2048,6 +2053,18 @@ pci_probe(struct pci_dev *dev, const struct pci_device_id *ent) | |||
2048 | int err; | 2053 | int err; |
2049 | size_t size; | 2054 | size_t size; |
2050 | 2055 | ||
2056 | #ifdef CONFIG_PPC_PMAC | ||
2057 | /* Necessary on some machines if fw-ohci was loaded/ unloaded before */ | ||
2058 | if (machine_is(powermac)) { | ||
2059 | struct device_node *ofn = pci_device_to_OF_node(dev); | ||
2060 | |||
2061 | if (ofn) { | ||
2062 | pmac_call_feature(PMAC_FTR_1394_CABLE_POWER, ofn, 0, 1); | ||
2063 | pmac_call_feature(PMAC_FTR_1394_ENABLE, ofn, 0, 1); | ||
2064 | } | ||
2065 | } | ||
2066 | #endif /* CONFIG_PPC_PMAC */ | ||
2067 | |||
2051 | ohci = kzalloc(sizeof(*ohci), GFP_KERNEL); | 2068 | ohci = kzalloc(sizeof(*ohci), GFP_KERNEL); |
2052 | if (ohci == NULL) { | 2069 | if (ohci == NULL) { |
2053 | fw_error("Could not malloc fw_ohci data.\n"); | 2070 | fw_error("Could not malloc fw_ohci data.\n"); |
@@ -2066,6 +2083,10 @@ pci_probe(struct pci_dev *dev, const struct pci_device_id *ent) | |||
2066 | pci_write_config_dword(dev, OHCI1394_PCI_HCI_Control, 0); | 2083 | pci_write_config_dword(dev, OHCI1394_PCI_HCI_Control, 0); |
2067 | pci_set_drvdata(dev, ohci); | 2084 | pci_set_drvdata(dev, ohci); |
2068 | 2085 | ||
2086 | #if defined(CONFIG_PPC_PMAC) && defined(CONFIG_PPC32) | ||
2087 | ohci->old_uninorth = dev->vendor == PCI_VENDOR_ID_APPLE && | ||
2088 | dev->device == PCI_DEVICE_ID_APPLE_UNI_N_FW; | ||
2089 | #endif | ||
2069 | spin_lock_init(&ohci->lock); | 2090 | spin_lock_init(&ohci->lock); |
2070 | 2091 | ||
2071 | tasklet_init(&ohci->bus_reset_tasklet, | 2092 | tasklet_init(&ohci->bus_reset_tasklet, |
@@ -2182,6 +2203,19 @@ static void pci_remove(struct pci_dev *dev) | |||
2182 | pci_disable_device(dev); | 2203 | pci_disable_device(dev); |
2183 | fw_card_put(&ohci->card); | 2204 | fw_card_put(&ohci->card); |
2184 | 2205 | ||
2206 | #ifdef CONFIG_PPC_PMAC | ||
2207 | /* On UniNorth, power down the cable and turn off the chip clock | ||
2208 | * to save power on laptops */ | ||
2209 | if (machine_is(powermac)) { | ||
2210 | struct device_node *ofn = pci_device_to_OF_node(dev); | ||
2211 | |||
2212 | if (ofn) { | ||
2213 | pmac_call_feature(PMAC_FTR_1394_ENABLE, ofn, 0, 0); | ||
2214 | pmac_call_feature(PMAC_FTR_1394_CABLE_POWER, ofn, 0, 0); | ||
2215 | } | ||
2216 | } | ||
2217 | #endif /* CONFIG_PPC_PMAC */ | ||
2218 | |||
2185 | fw_notify("Removed fw-ohci device.\n"); | 2219 | fw_notify("Removed fw-ohci device.\n"); |
2186 | } | 2220 | } |
2187 | 2221 | ||
@@ -2202,6 +2236,16 @@ static int pci_suspend(struct pci_dev *pdev, pm_message_t state) | |||
2202 | if (err) | 2236 | if (err) |
2203 | fw_error("pci_set_power_state failed with %d\n", err); | 2237 | fw_error("pci_set_power_state failed with %d\n", err); |
2204 | 2238 | ||
2239 | /* PowerMac suspend code comes last */ | ||
2240 | #ifdef CONFIG_PPC_PMAC | ||
2241 | if (machine_is(powermac)) { | ||
2242 | struct device_node *ofn = pci_device_to_OF_node(pdev); | ||
2243 | |||
2244 | if (ofn) | ||
2245 | pmac_call_feature(PMAC_FTR_1394_ENABLE, ofn, 0, 0); | ||
2246 | } | ||
2247 | #endif /* CONFIG_PPC_PMAC */ | ||
2248 | |||
2205 | return 0; | 2249 | return 0; |
2206 | } | 2250 | } |
2207 | 2251 | ||
@@ -2210,6 +2254,16 @@ static int pci_resume(struct pci_dev *pdev) | |||
2210 | struct fw_ohci *ohci = pci_get_drvdata(pdev); | 2254 | struct fw_ohci *ohci = pci_get_drvdata(pdev); |
2211 | int err; | 2255 | int err; |
2212 | 2256 | ||
2257 | /* PowerMac resume code comes first */ | ||
2258 | #ifdef CONFIG_PPC_PMAC | ||
2259 | if (machine_is(powermac)) { | ||
2260 | struct device_node *ofn = pci_device_to_OF_node(pdev); | ||
2261 | |||
2262 | if (ofn) | ||
2263 | pmac_call_feature(PMAC_FTR_1394_ENABLE, ofn, 0, 1); | ||
2264 | } | ||
2265 | #endif /* CONFIG_PPC_PMAC */ | ||
2266 | |||
2213 | pci_set_power_state(pdev, PCI_D0); | 2267 | pci_set_power_state(pdev, PCI_D0); |
2214 | pci_restore_state(pdev); | 2268 | pci_restore_state(pdev); |
2215 | err = pci_enable_device(pdev); | 2269 | err = pci_enable_device(pdev); |
diff --git a/drivers/firewire/fw-sbp2.c b/drivers/firewire/fw-sbp2.c index 03069a454c07..62b4e47d0cc0 100644 --- a/drivers/firewire/fw-sbp2.c +++ b/drivers/firewire/fw-sbp2.c | |||
@@ -173,6 +173,7 @@ struct sbp2_target { | |||
173 | #define SBP2_ORB_TIMEOUT 2000U /* Timeout in ms */ | 173 | #define SBP2_ORB_TIMEOUT 2000U /* Timeout in ms */ |
174 | #define SBP2_ORB_NULL 0x80000000 | 174 | #define SBP2_ORB_NULL 0x80000000 |
175 | #define SBP2_MAX_SG_ELEMENT_LENGTH 0xf000 | 175 | #define SBP2_MAX_SG_ELEMENT_LENGTH 0xf000 |
176 | #define SBP2_RETRY_LIMIT 0xf /* 15 retries */ | ||
176 | 177 | ||
177 | #define SBP2_DIRECTION_TO_MEDIA 0x0 | 178 | #define SBP2_DIRECTION_TO_MEDIA 0x0 |
178 | #define SBP2_DIRECTION_FROM_MEDIA 0x1 | 179 | #define SBP2_DIRECTION_FROM_MEDIA 0x1 |
@@ -330,6 +331,11 @@ static const struct { | |||
330 | .model = ~0, | 331 | .model = ~0, |
331 | .workarounds = SBP2_WORKAROUND_128K_MAX_TRANS, | 332 | .workarounds = SBP2_WORKAROUND_128K_MAX_TRANS, |
332 | }, | 333 | }, |
334 | /* Datafab MD2-FW2 with Symbios/LSILogic SYM13FW500 bridge */ { | ||
335 | .firmware_revision = 0x002600, | ||
336 | .model = ~0, | ||
337 | .workarounds = SBP2_WORKAROUND_128K_MAX_TRANS, | ||
338 | }, | ||
333 | 339 | ||
334 | /* | 340 | /* |
335 | * There are iPods (2nd gen, 3rd gen) with model_id == 0, but | 341 | * There are iPods (2nd gen, 3rd gen) with model_id == 0, but |
@@ -812,6 +818,30 @@ static void sbp2_target_put(struct sbp2_target *tgt) | |||
812 | kref_put(&tgt->kref, sbp2_release_target); | 818 | kref_put(&tgt->kref, sbp2_release_target); |
813 | } | 819 | } |
814 | 820 | ||
821 | static void | ||
822 | complete_set_busy_timeout(struct fw_card *card, int rcode, | ||
823 | void *payload, size_t length, void *done) | ||
824 | { | ||
825 | complete(done); | ||
826 | } | ||
827 | |||
828 | static void sbp2_set_busy_timeout(struct sbp2_logical_unit *lu) | ||
829 | { | ||
830 | struct fw_device *device = fw_device(lu->tgt->unit->device.parent); | ||
831 | DECLARE_COMPLETION_ONSTACK(done); | ||
832 | struct fw_transaction t; | ||
833 | static __be32 busy_timeout; | ||
834 | |||
835 | /* FIXME: we should try to set dual-phase cycle_limit too */ | ||
836 | busy_timeout = cpu_to_be32(SBP2_RETRY_LIMIT); | ||
837 | |||
838 | fw_send_request(device->card, &t, TCODE_WRITE_QUADLET_REQUEST, | ||
839 | lu->tgt->node_id, lu->generation, device->max_speed, | ||
840 | CSR_REGISTER_BASE + CSR_BUSY_TIMEOUT, &busy_timeout, | ||
841 | sizeof(busy_timeout), complete_set_busy_timeout, &done); | ||
842 | wait_for_completion(&done); | ||
843 | } | ||
844 | |||
815 | static void sbp2_reconnect(struct work_struct *work); | 845 | static void sbp2_reconnect(struct work_struct *work); |
816 | 846 | ||
817 | static void sbp2_login(struct work_struct *work) | 847 | static void sbp2_login(struct work_struct *work) |
@@ -864,10 +894,8 @@ static void sbp2_login(struct work_struct *work) | |||
864 | fw_notify("%s: logged in to LUN %04x (%d retries)\n", | 894 | fw_notify("%s: logged in to LUN %04x (%d retries)\n", |
865 | tgt->bus_id, lu->lun, lu->retries); | 895 | tgt->bus_id, lu->lun, lu->retries); |
866 | 896 | ||
867 | #if 0 | 897 | /* set appropriate retry limit(s) in BUSY_TIMEOUT register */ |
868 | /* FIXME: The linux1394 sbp2 does this last step. */ | 898 | sbp2_set_busy_timeout(lu); |
869 | sbp2_set_busy_timeout(scsi_id); | ||
870 | #endif | ||
871 | 899 | ||
872 | PREPARE_DELAYED_WORK(&lu->work, sbp2_reconnect); | 900 | PREPARE_DELAYED_WORK(&lu->work, sbp2_reconnect); |
873 | sbp2_agent_reset(lu); | 901 | sbp2_agent_reset(lu); |
diff --git a/drivers/firewire/fw-topology.c b/drivers/firewire/fw-topology.c index e47bb040197a..d2c7a3d7e1cb 100644 --- a/drivers/firewire/fw-topology.c +++ b/drivers/firewire/fw-topology.c | |||
@@ -21,6 +21,7 @@ | |||
21 | #include <linux/module.h> | 21 | #include <linux/module.h> |
22 | #include <linux/wait.h> | 22 | #include <linux/wait.h> |
23 | #include <linux/errno.h> | 23 | #include <linux/errno.h> |
24 | #include <asm/bug.h> | ||
24 | #include <asm/system.h> | 25 | #include <asm/system.h> |
25 | #include "fw-transaction.h" | 26 | #include "fw-transaction.h" |
26 | #include "fw-topology.h" | 27 | #include "fw-topology.h" |
@@ -424,8 +425,8 @@ update_tree(struct fw_card *card, struct fw_node *root) | |||
424 | node1 = fw_node(list1.next); | 425 | node1 = fw_node(list1.next); |
425 | 426 | ||
426 | while (&node0->link != &list0) { | 427 | while (&node0->link != &list0) { |
428 | WARN_ON(node0->port_count != node1->port_count); | ||
427 | 429 | ||
428 | /* assert(node0->port_count == node1->port_count); */ | ||
429 | if (node0->link_on && !node1->link_on) | 430 | if (node0->link_on && !node1->link_on) |
430 | event = FW_NODE_LINK_OFF; | 431 | event = FW_NODE_LINK_OFF; |
431 | else if (!node0->link_on && node1->link_on) | 432 | else if (!node0->link_on && node1->link_on) |
diff --git a/drivers/firewire/fw-transaction.c b/drivers/firewire/fw-transaction.c index 7fcc59dedf08..e6f1bda38940 100644 --- a/drivers/firewire/fw-transaction.c +++ b/drivers/firewire/fw-transaction.c | |||
@@ -736,6 +736,12 @@ fw_core_handle_response(struct fw_card *card, struct fw_packet *p) | |||
736 | break; | 736 | break; |
737 | } | 737 | } |
738 | 738 | ||
739 | /* | ||
740 | * The response handler may be executed while the request handler | ||
741 | * is still pending. Cancel the request handler. | ||
742 | */ | ||
743 | card->driver->cancel_packet(card, &t->packet); | ||
744 | |||
739 | t->callback(card, rcode, data, data_length, t->callback_data); | 745 | t->callback(card, rcode, data, data_length, t->callback_data); |
740 | } | 746 | } |
741 | EXPORT_SYMBOL(fw_core_handle_response); | 747 | EXPORT_SYMBOL(fw_core_handle_response); |
@@ -751,7 +757,7 @@ handle_topology_map(struct fw_card *card, struct fw_request *request, | |||
751 | void *payload, size_t length, void *callback_data) | 757 | void *payload, size_t length, void *callback_data) |
752 | { | 758 | { |
753 | int i, start, end; | 759 | int i, start, end; |
754 | u32 *map; | 760 | __be32 *map; |
755 | 761 | ||
756 | if (!TCODE_IS_READ_REQUEST(tcode)) { | 762 | if (!TCODE_IS_READ_REQUEST(tcode)) { |
757 | fw_send_response(card, request, RCODE_TYPE_ERROR); | 763 | fw_send_response(card, request, RCODE_TYPE_ERROR); |
diff --git a/drivers/firewire/fw-transaction.h b/drivers/firewire/fw-transaction.h index 09cb72870454..a43bb22912f9 100644 --- a/drivers/firewire/fw-transaction.h +++ b/drivers/firewire/fw-transaction.h | |||
@@ -86,12 +86,12 @@ | |||
86 | static inline void | 86 | static inline void |
87 | fw_memcpy_from_be32(void *_dst, void *_src, size_t size) | 87 | fw_memcpy_from_be32(void *_dst, void *_src, size_t size) |
88 | { | 88 | { |
89 | u32 *dst = _dst; | 89 | u32 *dst = _dst; |
90 | u32 *src = _src; | 90 | __be32 *src = _src; |
91 | int i; | 91 | int i; |
92 | 92 | ||
93 | for (i = 0; i < size / 4; i++) | 93 | for (i = 0; i < size / 4; i++) |
94 | dst[i] = cpu_to_be32(src[i]); | 94 | dst[i] = be32_to_cpu(src[i]); |
95 | } | 95 | } |
96 | 96 | ||
97 | static inline void | 97 | static inline void |
diff --git a/drivers/hid/hid-core.c b/drivers/hid/hid-core.c index d73a768e176e..f0b00ec1e47e 100644 --- a/drivers/hid/hid-core.c +++ b/drivers/hid/hid-core.c | |||
@@ -968,7 +968,7 @@ int hid_input_report(struct hid_device *hid, int type, u8 *data, int size, int i | |||
968 | size--; | 968 | size--; |
969 | } | 969 | } |
970 | 970 | ||
971 | /* dump the report descriptor */ | 971 | /* dump the report */ |
972 | dbg_hid("report %d (size %u) = ", n, size); | 972 | dbg_hid("report %d (size %u) = ", n, size); |
973 | for (i = 0; i < size; i++) | 973 | for (i = 0; i < size; i++) |
974 | dbg_hid_line(" %02x", data[i]); | 974 | dbg_hid_line(" %02x", data[i]); |
diff --git a/drivers/hid/hid-input.c b/drivers/hid/hid-input.c index 5a38fb27d69f..c3eb3f13e2ca 100644 --- a/drivers/hid/hid-input.c +++ b/drivers/hid/hid-input.c | |||
@@ -98,18 +98,16 @@ struct hidinput_key_translation { | |||
98 | 98 | ||
99 | static struct hidinput_key_translation apple_fn_keys[] = { | 99 | static struct hidinput_key_translation apple_fn_keys[] = { |
100 | { KEY_BACKSPACE, KEY_DELETE }, | 100 | { KEY_BACKSPACE, KEY_DELETE }, |
101 | { KEY_F1, KEY_BRIGHTNESSDOWN, APPLE_FLAG_FKEY }, | 101 | { KEY_F1, KEY_BRIGHTNESSDOWN, APPLE_FLAG_FKEY }, |
102 | { KEY_F2, KEY_BRIGHTNESSUP, APPLE_FLAG_FKEY }, | 102 | { KEY_F2, KEY_BRIGHTNESSUP, APPLE_FLAG_FKEY }, |
103 | { KEY_F3, KEY_CYCLEWINDOWS, APPLE_FLAG_FKEY }, /* Exposé */ | 103 | { KEY_F3, KEY_FN_F5, APPLE_FLAG_FKEY }, /* Exposé */ |
104 | { KEY_F4, KEY_FN_F4, APPLE_FLAG_FKEY }, /* Dashboard */ | 104 | { KEY_F4, KEY_FN_F4, APPLE_FLAG_FKEY }, /* Dashboard */ |
105 | { KEY_F5, KEY_FN_F5 }, | 105 | { KEY_F7, KEY_PREVIOUSSONG, APPLE_FLAG_FKEY }, |
106 | { KEY_F6, KEY_FN_F6 }, | 106 | { KEY_F8, KEY_PLAYPAUSE, APPLE_FLAG_FKEY }, |
107 | { KEY_F7, KEY_BACK, APPLE_FLAG_FKEY }, | 107 | { KEY_F9, KEY_NEXTSONG, APPLE_FLAG_FKEY }, |
108 | { KEY_F8, KEY_PLAYPAUSE, APPLE_FLAG_FKEY }, | 108 | { KEY_F10, KEY_MUTE, APPLE_FLAG_FKEY }, |
109 | { KEY_F9, KEY_FORWARD, APPLE_FLAG_FKEY }, | 109 | { KEY_F11, KEY_VOLUMEDOWN, APPLE_FLAG_FKEY }, |
110 | { KEY_F10, KEY_MUTE, APPLE_FLAG_FKEY }, | 110 | { KEY_F12, KEY_VOLUMEUP, APPLE_FLAG_FKEY }, |
111 | { KEY_F11, KEY_VOLUMEDOWN, APPLE_FLAG_FKEY }, | ||
112 | { KEY_F12, KEY_VOLUMEUP, APPLE_FLAG_FKEY }, | ||
113 | { KEY_UP, KEY_PAGEUP }, | 111 | { KEY_UP, KEY_PAGEUP }, |
114 | { KEY_DOWN, KEY_PAGEDOWN }, | 112 | { KEY_DOWN, KEY_PAGEDOWN }, |
115 | { KEY_LEFT, KEY_HOME }, | 113 | { KEY_LEFT, KEY_HOME }, |
diff --git a/drivers/hid/usbhid/hid-core.c b/drivers/hid/usbhid/hid-core.c index b38e559b7a46..d95979f0e028 100644 --- a/drivers/hid/usbhid/hid-core.c +++ b/drivers/hid/usbhid/hid-core.c | |||
@@ -278,7 +278,7 @@ static int hid_submit_ctrl(struct hid_device *hid) | |||
278 | usbhid->urbctrl->pipe = usb_rcvctrlpipe(hid_to_usb_dev(hid), 0); | 278 | usbhid->urbctrl->pipe = usb_rcvctrlpipe(hid_to_usb_dev(hid), 0); |
279 | maxpacket = usb_maxpacket(hid_to_usb_dev(hid), usbhid->urbctrl->pipe, 0); | 279 | maxpacket = usb_maxpacket(hid_to_usb_dev(hid), usbhid->urbctrl->pipe, 0); |
280 | if (maxpacket > 0) { | 280 | if (maxpacket > 0) { |
281 | padlen = (len + maxpacket - 1) / maxpacket; | 281 | padlen = DIV_ROUND_UP(len, maxpacket); |
282 | padlen *= maxpacket; | 282 | padlen *= maxpacket; |
283 | if (padlen > usbhid->bufsize) | 283 | if (padlen > usbhid->bufsize) |
284 | padlen = usbhid->bufsize; | 284 | padlen = usbhid->bufsize; |
diff --git a/drivers/hid/usbhid/hid-quirks.c b/drivers/hid/usbhid/hid-quirks.c index e6d05f6b1c1c..e29a057cbea2 100644 --- a/drivers/hid/usbhid/hid-quirks.c +++ b/drivers/hid/usbhid/hid-quirks.c | |||
@@ -345,6 +345,9 @@ | |||
345 | #define USB_VENDOR_ID_NATIONAL_SEMICONDUCTOR 0x0400 | 345 | #define USB_VENDOR_ID_NATIONAL_SEMICONDUCTOR 0x0400 |
346 | #define USB_DEVICE_ID_N_S_HARMONY 0xc359 | 346 | #define USB_DEVICE_ID_N_S_HARMONY 0xc359 |
347 | 347 | ||
348 | #define USB_VENDOR_ID_NATSU 0x08b7 | ||
349 | #define USB_DEVICE_ID_NATSU_GAMEPAD 0x0001 | ||
350 | |||
348 | #define USB_VENDOR_ID_NEC 0x073e | 351 | #define USB_VENDOR_ID_NEC 0x073e |
349 | #define USB_DEVICE_ID_NEC_USB_GAME_PAD 0x0301 | 352 | #define USB_DEVICE_ID_NEC_USB_GAME_PAD 0x0301 |
350 | 353 | ||
@@ -426,6 +429,7 @@ static const struct hid_blacklist { | |||
426 | { USB_VENDOR_ID_HAPP, USB_DEVICE_ID_UGCI_DRIVING, HID_QUIRK_BADPAD | HID_QUIRK_MULTI_INPUT }, | 429 | { USB_VENDOR_ID_HAPP, USB_DEVICE_ID_UGCI_DRIVING, HID_QUIRK_BADPAD | HID_QUIRK_MULTI_INPUT }, |
427 | { USB_VENDOR_ID_HAPP, USB_DEVICE_ID_UGCI_FLYING, HID_QUIRK_BADPAD | HID_QUIRK_MULTI_INPUT }, | 430 | { USB_VENDOR_ID_HAPP, USB_DEVICE_ID_UGCI_FLYING, HID_QUIRK_BADPAD | HID_QUIRK_MULTI_INPUT }, |
428 | { USB_VENDOR_ID_HAPP, USB_DEVICE_ID_UGCI_FIGHTING, HID_QUIRK_BADPAD | HID_QUIRK_MULTI_INPUT }, | 431 | { USB_VENDOR_ID_HAPP, USB_DEVICE_ID_UGCI_FIGHTING, HID_QUIRK_BADPAD | HID_QUIRK_MULTI_INPUT }, |
432 | { USB_VENDOR_ID_NATSU, USB_DEVICE_ID_NATSU_GAMEPAD, HID_QUIRK_BADPAD }, | ||
429 | { USB_VENDOR_ID_NEC, USB_DEVICE_ID_NEC_USB_GAME_PAD, HID_QUIRK_BADPAD }, | 433 | { USB_VENDOR_ID_NEC, USB_DEVICE_ID_NEC_USB_GAME_PAD, HID_QUIRK_BADPAD }, |
430 | { USB_VENDOR_ID_SAITEK, USB_DEVICE_ID_SAITEK_RUMBLEPAD, HID_QUIRK_BADPAD }, | 434 | { USB_VENDOR_ID_SAITEK, USB_DEVICE_ID_SAITEK_RUMBLEPAD, HID_QUIRK_BADPAD }, |
431 | { USB_VENDOR_ID_TOPMAX, USB_DEVICE_ID_TOPMAX_COBRAPAD, HID_QUIRK_BADPAD }, | 435 | { USB_VENDOR_ID_TOPMAX, USB_DEVICE_ID_TOPMAX_COBRAPAD, HID_QUIRK_BADPAD }, |
@@ -624,7 +628,7 @@ static const struct hid_blacklist { | |||
624 | { USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_ALU_ISO, HID_QUIRK_APPLE_HAS_FN | HID_QUIRK_APPLE_ISO_KEYBOARD }, | 628 | { USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_ALU_ISO, HID_QUIRK_APPLE_HAS_FN | HID_QUIRK_APPLE_ISO_KEYBOARD }, |
625 | { USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_ALU_JIS, HID_QUIRK_APPLE_HAS_FN }, | 629 | { USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_ALU_JIS, HID_QUIRK_APPLE_HAS_FN }, |
626 | { USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_GEYSER4_HF_ANSI, HID_QUIRK_APPLE_HAS_FN | HID_QUIRK_IGNORE_MOUSE }, | 630 | { USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_GEYSER4_HF_ANSI, HID_QUIRK_APPLE_HAS_FN | HID_QUIRK_IGNORE_MOUSE }, |
627 | { USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_GEYSER4_HF_ISO, HID_QUIRK_APPLE_HAS_FN | HID_QUIRK_IGNORE_MOUSE | HID_QUIRK_APPLE_ISO_KEYBOARD }, | 631 | { USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_GEYSER4_HF_ISO, HID_QUIRK_APPLE_HAS_FN | HID_QUIRK_IGNORE_MOUSE }, |
628 | { USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_GEYSER4_HF_JIS, HID_QUIRK_APPLE_HAS_FN | HID_QUIRK_IGNORE_MOUSE }, | 632 | { USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_GEYSER4_HF_JIS, HID_QUIRK_APPLE_HAS_FN | HID_QUIRK_IGNORE_MOUSE }, |
629 | { USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_ALU_WIRELESS_ANSI, HID_QUIRK_APPLE_HAS_FN }, | 633 | { USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_ALU_WIRELESS_ANSI, HID_QUIRK_APPLE_HAS_FN }, |
630 | { USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_ALU_WIRELESS_ISO, HID_QUIRK_APPLE_HAS_FN | HID_QUIRK_APPLE_ISO_KEYBOARD }, | 634 | { USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_ALU_WIRELESS_ISO, HID_QUIRK_APPLE_HAS_FN | HID_QUIRK_APPLE_ISO_KEYBOARD }, |
diff --git a/drivers/hwmon/Kconfig b/drivers/hwmon/Kconfig index 368879ff5d8c..4dc76bc45c9d 100644 --- a/drivers/hwmon/Kconfig +++ b/drivers/hwmon/Kconfig | |||
@@ -337,8 +337,9 @@ config SENSORS_IBMPEX | |||
337 | help | 337 | help |
338 | If you say yes here you get support for the temperature and | 338 | If you say yes here you get support for the temperature and |
339 | power sensors in various IBM System X servers that support | 339 | power sensors in various IBM System X servers that support |
340 | PowerExecutive. So far this includes the x3550, x3650, x3655, | 340 | PowerExecutive. So far this includes the x3350, x3550, x3650, |
341 | x3755, and certain HS20 blades. | 341 | x3655, and x3755; the x3800, x3850, and x3950 models that have |
342 | PCI Express; and some of the HS2x, LS2x, and QS2x blades. | ||
342 | 343 | ||
343 | This driver can also be built as a module. If so, the module | 344 | This driver can also be built as a module. If so, the module |
344 | will be called ibmpex. | 345 | will be called ibmpex. |
diff --git a/drivers/hwmon/ibmpex.c b/drivers/hwmon/ibmpex.c index 9c9cdb0685e4..4e9b19c6732f 100644 --- a/drivers/hwmon/ibmpex.c +++ b/drivers/hwmon/ibmpex.c | |||
@@ -327,10 +327,14 @@ static int is_temp_sensor(const char *sensor_id, int len) | |||
327 | return 0; | 327 | return 0; |
328 | } | 328 | } |
329 | 329 | ||
330 | static int power_sensor_multiplier(const char *sensor_id, int len) | 330 | static int power_sensor_multiplier(struct ibmpex_bmc_data *data, |
331 | const char *sensor_id, int len) | ||
331 | { | 332 | { |
332 | int i; | 333 | int i; |
333 | 334 | ||
335 | if (data->sensor_major == 2) | ||
336 | return 1000000; | ||
337 | |||
334 | for (i = PEX_SENSOR_TYPE_LEN; i < len - 1; i++) | 338 | for (i = PEX_SENSOR_TYPE_LEN; i < len - 1; i++) |
335 | if (!memcmp(&sensor_id[i], watt_sensor_sig, PEX_MULT_LEN)) | 339 | if (!memcmp(&sensor_id[i], watt_sensor_sig, PEX_MULT_LEN)) |
336 | return 1000000; | 340 | return 1000000; |
@@ -398,14 +402,15 @@ static int ibmpex_find_sensors(struct ibmpex_bmc_data *data) | |||
398 | num_power++; | 402 | num_power++; |
399 | sensor_counter = num_power; | 403 | sensor_counter = num_power; |
400 | data->sensors[i].multiplier = | 404 | data->sensors[i].multiplier = |
401 | power_sensor_multiplier(data->rx_msg_data, | 405 | power_sensor_multiplier(data, |
402 | data->rx_msg_len); | 406 | data->rx_msg_data, |
407 | data->rx_msg_len); | ||
403 | } else if (is_temp_sensor(data->rx_msg_data, | 408 | } else if (is_temp_sensor(data->rx_msg_data, |
404 | data->rx_msg_len)) { | 409 | data->rx_msg_len)) { |
405 | sensor_type = TEMP_SENSOR; | 410 | sensor_type = TEMP_SENSOR; |
406 | num_temp++; | 411 | num_temp++; |
407 | sensor_counter = num_temp; | 412 | sensor_counter = num_temp; |
408 | data->sensors[i].multiplier = 1; | 413 | data->sensors[i].multiplier = 1000; |
409 | } else | 414 | } else |
410 | continue; | 415 | continue; |
411 | 416 | ||
diff --git a/drivers/ide/ide-lib.c b/drivers/ide/ide-lib.c index 29e2c9719c30..7031a8dcf692 100644 --- a/drivers/ide/ide-lib.c +++ b/drivers/ide/ide-lib.c | |||
@@ -122,7 +122,6 @@ static struct ide_pio_info { | |||
122 | const char *name; | 122 | const char *name; |
123 | int pio; | 123 | int pio; |
124 | } ide_pio_blacklist [] = { | 124 | } ide_pio_blacklist [] = { |
125 | /* { "Conner Peripherals 1275MB - CFS1275A", 4 }, */ | ||
126 | { "Conner Peripherals 540MB - CFS540A", 3 }, | 125 | { "Conner Peripherals 540MB - CFS540A", 3 }, |
127 | 126 | ||
128 | { "WDC AC2700", 3 }, | 127 | { "WDC AC2700", 3 }, |
@@ -138,10 +137,8 @@ static struct ide_pio_info { | |||
138 | { "WDC AC1170", 1 }, | 137 | { "WDC AC1170", 1 }, |
139 | { "WDC AC1210", 1 }, | 138 | { "WDC AC1210", 1 }, |
140 | { "WDC AC280", 0 }, | 139 | { "WDC AC280", 0 }, |
141 | /* { "WDC AC21000", 4 }, */ | ||
142 | { "WDC AC31000", 3 }, | 140 | { "WDC AC31000", 3 }, |
143 | { "WDC AC31200", 3 }, | 141 | { "WDC AC31200", 3 }, |
144 | /* { "WDC AC31600", 4 }, */ | ||
145 | 142 | ||
146 | { "Maxtor 7131 AT", 1 }, | 143 | { "Maxtor 7131 AT", 1 }, |
147 | { "Maxtor 7171 AT", 1 }, | 144 | { "Maxtor 7171 AT", 1 }, |
@@ -155,13 +152,6 @@ static struct ide_pio_info { | |||
155 | { "SAMSUNG SHD-3122A", 1 }, | 152 | { "SAMSUNG SHD-3122A", 1 }, |
156 | { "SAMSUNG SHD-3172A", 1 }, | 153 | { "SAMSUNG SHD-3172A", 1 }, |
157 | 154 | ||
158 | /* { "ST51080A", 4 }, | ||
159 | * { "ST51270A", 4 }, | ||
160 | * { "ST31220A", 4 }, | ||
161 | * { "ST31640A", 4 }, | ||
162 | * { "ST32140A", 4 }, | ||
163 | * { "ST3780A", 4 }, | ||
164 | */ | ||
165 | { "ST5660A", 3 }, | 155 | { "ST5660A", 3 }, |
166 | { "ST3660A", 3 }, | 156 | { "ST3660A", 3 }, |
167 | { "ST3630A", 3 }, | 157 | { "ST3630A", 3 }, |
diff --git a/drivers/ide/ide-tape.c b/drivers/ide/ide-tape.c index 43e0e0557776..0598ecfd5f37 100644 --- a/drivers/ide/ide-tape.c +++ b/drivers/ide/ide-tape.c | |||
@@ -3765,11 +3765,6 @@ static int ide_tape_probe(ide_drive_t *drive) | |||
3765 | g->fops = &idetape_block_ops; | 3765 | g->fops = &idetape_block_ops; |
3766 | ide_register_region(g); | 3766 | ide_register_region(g); |
3767 | 3767 | ||
3768 | printk(KERN_WARNING "It is possible that this driver does not have any" | ||
3769 | " users anymore and, as a result, it will be REMOVED soon." | ||
3770 | " Please notify Bart <bzolnier@gmail.com> or Boris" | ||
3771 | " <petkovbb@gmail.com> in case you still need it.\n"); | ||
3772 | |||
3773 | return 0; | 3768 | return 0; |
3774 | 3769 | ||
3775 | out_free_tape: | 3770 | out_free_tape: |
diff --git a/drivers/ide/ide-taskfile.c b/drivers/ide/ide-taskfile.c index 0518a2e948cf..4c86a8d84b4c 100644 --- a/drivers/ide/ide-taskfile.c +++ b/drivers/ide/ide-taskfile.c | |||
@@ -423,6 +423,25 @@ void task_end_request(ide_drive_t *drive, struct request *rq, u8 stat) | |||
423 | } | 423 | } |
424 | 424 | ||
425 | /* | 425 | /* |
426 | * We got an interrupt on a task_in case, but no errors and no DRQ. | ||
427 | * | ||
428 | * It might be a spurious irq (shared irq), but it might be a | ||
429 | * command that had no output. | ||
430 | */ | ||
431 | static ide_startstop_t task_in_unexpected(ide_drive_t *drive, struct request *rq, u8 stat) | ||
432 | { | ||
433 | /* Command all done? */ | ||
434 | if (OK_STAT(stat, READY_STAT, BUSY_STAT)) { | ||
435 | task_end_request(drive, rq, stat); | ||
436 | return ide_stopped; | ||
437 | } | ||
438 | |||
439 | /* Assume it was a spurious irq */ | ||
440 | ide_set_handler(drive, &task_in_intr, WAIT_WORSTCASE, NULL); | ||
441 | return ide_started; | ||
442 | } | ||
443 | |||
444 | /* | ||
426 | * Handler for command with PIO data-in phase (Read/Read Multiple). | 445 | * Handler for command with PIO data-in phase (Read/Read Multiple). |
427 | */ | 446 | */ |
428 | static ide_startstop_t task_in_intr(ide_drive_t *drive) | 447 | static ide_startstop_t task_in_intr(ide_drive_t *drive) |
@@ -431,18 +450,17 @@ static ide_startstop_t task_in_intr(ide_drive_t *drive) | |||
431 | struct request *rq = HWGROUP(drive)->rq; | 450 | struct request *rq = HWGROUP(drive)->rq; |
432 | u8 stat = ide_read_status(drive); | 451 | u8 stat = ide_read_status(drive); |
433 | 452 | ||
434 | /* new way for dealing with premature shared PCI interrupts */ | 453 | /* Error? */ |
435 | if (!OK_STAT(stat, DRQ_STAT, BAD_R_STAT)) { | 454 | if (stat & ERR_STAT) |
436 | if (stat & (ERR_STAT | DRQ_STAT)) | 455 | return task_error(drive, rq, __FUNCTION__, stat); |
437 | return task_error(drive, rq, __FUNCTION__, stat); | 456 | |
438 | /* No data yet, so wait for another IRQ. */ | 457 | /* Didn't want any data? Odd. */ |
439 | ide_set_handler(drive, &task_in_intr, WAIT_WORSTCASE, NULL); | 458 | if (!(stat & DRQ_STAT)) |
440 | return ide_started; | 459 | return task_in_unexpected(drive, rq, stat); |
441 | } | ||
442 | 460 | ||
443 | ide_pio_datablock(drive, rq, 0); | 461 | ide_pio_datablock(drive, rq, 0); |
444 | 462 | ||
445 | /* If it was the last datablock check status and finish transfer. */ | 463 | /* Are we done? Check status and finish transfer. */ |
446 | if (!hwif->nleft) { | 464 | if (!hwif->nleft) { |
447 | stat = wait_drive_not_busy(drive); | 465 | stat = wait_drive_not_busy(drive); |
448 | if (!OK_STAT(stat, 0, BAD_STAT)) | 466 | if (!OK_STAT(stat, 0, BAD_STAT)) |
diff --git a/drivers/ide/ide.c b/drivers/ide/ide.c index 9976f9d627d4..fc69fe2e3ec0 100644 --- a/drivers/ide/ide.c +++ b/drivers/ide/ide.c | |||
@@ -1258,7 +1258,7 @@ static int __init ide_setup(char *s) | |||
1258 | drive = &hwif->drives[unit]; | 1258 | drive = &hwif->drives[unit]; |
1259 | if (strncmp(s + 4, "ide-", 4) == 0) { | 1259 | if (strncmp(s + 4, "ide-", 4) == 0) { |
1260 | strlcpy(drive->driver_req, s + 4, sizeof(drive->driver_req)); | 1260 | strlcpy(drive->driver_req, s + 4, sizeof(drive->driver_req)); |
1261 | goto done; | 1261 | goto obsolete_option; |
1262 | } | 1262 | } |
1263 | switch (match_parm(&s[3], hd_words, vals, 3)) { | 1263 | switch (match_parm(&s[3], hd_words, vals, 3)) { |
1264 | case -1: /* "none" */ | 1264 | case -1: /* "none" */ |
@@ -1290,13 +1290,13 @@ static int __init ide_setup(char *s) | |||
1290 | goto done; | 1290 | goto done; |
1291 | case -12: /* "remap" */ | 1291 | case -12: /* "remap" */ |
1292 | drive->remap_0_to_1 = 1; | 1292 | drive->remap_0_to_1 = 1; |
1293 | goto done; | 1293 | goto obsolete_option; |
1294 | case -13: /* "remap63" */ | 1294 | case -13: /* "remap63" */ |
1295 | drive->sect0 = 63; | 1295 | drive->sect0 = 63; |
1296 | goto done; | 1296 | goto obsolete_option; |
1297 | case -14: /* "scsi" */ | 1297 | case -14: /* "scsi" */ |
1298 | drive->scsi = 1; | 1298 | drive->scsi = 1; |
1299 | goto done; | 1299 | goto obsolete_option; |
1300 | case 3: /* cyl,head,sect */ | 1300 | case 3: /* cyl,head,sect */ |
1301 | drive->media = ide_disk; | 1301 | drive->media = ide_disk; |
1302 | drive->ready_stat = READY_STAT; | 1302 | drive->ready_stat = READY_STAT; |
@@ -1370,32 +1370,32 @@ static int __init ide_setup(char *s) | |||
1370 | #ifdef CONFIG_BLK_DEV_ALI14XX | 1370 | #ifdef CONFIG_BLK_DEV_ALI14XX |
1371 | case -17: /* "ali14xx" */ | 1371 | case -17: /* "ali14xx" */ |
1372 | probe_ali14xx = 1; | 1372 | probe_ali14xx = 1; |
1373 | goto done; | 1373 | goto obsolete_option; |
1374 | #endif | 1374 | #endif |
1375 | #ifdef CONFIG_BLK_DEV_UMC8672 | 1375 | #ifdef CONFIG_BLK_DEV_UMC8672 |
1376 | case -16: /* "umc8672" */ | 1376 | case -16: /* "umc8672" */ |
1377 | probe_umc8672 = 1; | 1377 | probe_umc8672 = 1; |
1378 | goto done; | 1378 | goto obsolete_option; |
1379 | #endif | 1379 | #endif |
1380 | #ifdef CONFIG_BLK_DEV_DTC2278 | 1380 | #ifdef CONFIG_BLK_DEV_DTC2278 |
1381 | case -15: /* "dtc2278" */ | 1381 | case -15: /* "dtc2278" */ |
1382 | probe_dtc2278 = 1; | 1382 | probe_dtc2278 = 1; |
1383 | goto done; | 1383 | goto obsolete_option; |
1384 | #endif | 1384 | #endif |
1385 | #ifdef CONFIG_BLK_DEV_CMD640 | 1385 | #ifdef CONFIG_BLK_DEV_CMD640 |
1386 | case -14: /* "cmd640_vlb" */ | 1386 | case -14: /* "cmd640_vlb" */ |
1387 | cmd640_vlb = 1; | 1387 | cmd640_vlb = 1; |
1388 | goto done; | 1388 | goto obsolete_option; |
1389 | #endif | 1389 | #endif |
1390 | #ifdef CONFIG_BLK_DEV_HT6560B | 1390 | #ifdef CONFIG_BLK_DEV_HT6560B |
1391 | case -13: /* "ht6560b" */ | 1391 | case -13: /* "ht6560b" */ |
1392 | probe_ht6560b = 1; | 1392 | probe_ht6560b = 1; |
1393 | goto done; | 1393 | goto obsolete_option; |
1394 | #endif | 1394 | #endif |
1395 | #ifdef CONFIG_BLK_DEV_QD65XX | 1395 | #ifdef CONFIG_BLK_DEV_QD65XX |
1396 | case -12: /* "qd65xx" */ | 1396 | case -12: /* "qd65xx" */ |
1397 | probe_qd65xx = 1; | 1397 | probe_qd65xx = 1; |
1398 | goto done; | 1398 | goto obsolete_option; |
1399 | #endif | 1399 | #endif |
1400 | #ifdef CONFIG_BLK_DEV_4DRIVES | 1400 | #ifdef CONFIG_BLK_DEV_4DRIVES |
1401 | case -11: /* "four" drives on one set of ports */ | 1401 | case -11: /* "four" drives on one set of ports */ |
diff --git a/drivers/ieee1394/sbp2.c b/drivers/ieee1394/sbp2.c index 9e2b1964d71a..f53f72daae34 100644 --- a/drivers/ieee1394/sbp2.c +++ b/drivers/ieee1394/sbp2.c | |||
@@ -376,6 +376,11 @@ static const struct { | |||
376 | .model_id = SBP2_ROM_VALUE_WILDCARD, | 376 | .model_id = SBP2_ROM_VALUE_WILDCARD, |
377 | .workarounds = SBP2_WORKAROUND_128K_MAX_TRANS, | 377 | .workarounds = SBP2_WORKAROUND_128K_MAX_TRANS, |
378 | }, | 378 | }, |
379 | /* Datafab MD2-FW2 with Symbios/LSILogic SYM13FW500 bridge */ { | ||
380 | .firmware_revision = 0x002600, | ||
381 | .model_id = SBP2_ROM_VALUE_WILDCARD, | ||
382 | .workarounds = SBP2_WORKAROUND_128K_MAX_TRANS, | ||
383 | }, | ||
379 | /* iPod 4th generation */ { | 384 | /* iPod 4th generation */ { |
380 | .firmware_revision = 0x0a2700, | 385 | .firmware_revision = 0x0a2700, |
381 | .model_id = 0x000021, | 386 | .model_id = 0x000021, |
diff --git a/drivers/infiniband/hw/ipath/ipath_common.h b/drivers/infiniband/hw/ipath/ipath_common.h index 414621095540..591901aab6b7 100644 --- a/drivers/infiniband/hw/ipath/ipath_common.h +++ b/drivers/infiniband/hw/ipath/ipath_common.h | |||
@@ -75,7 +75,7 @@ | |||
75 | #define IPATH_IB_LINKDOWN 0 | 75 | #define IPATH_IB_LINKDOWN 0 |
76 | #define IPATH_IB_LINKARM 1 | 76 | #define IPATH_IB_LINKARM 1 |
77 | #define IPATH_IB_LINKACTIVE 2 | 77 | #define IPATH_IB_LINKACTIVE 2 |
78 | #define IPATH_IB_LINKINIT 3 | 78 | #define IPATH_IB_LINKDOWN_ONLY 3 |
79 | #define IPATH_IB_LINKDOWN_SLEEP 4 | 79 | #define IPATH_IB_LINKDOWN_SLEEP 4 |
80 | #define IPATH_IB_LINKDOWN_DISABLE 5 | 80 | #define IPATH_IB_LINKDOWN_DISABLE 5 |
81 | #define IPATH_IB_LINK_LOOPBACK 6 /* enable local loopback */ | 81 | #define IPATH_IB_LINK_LOOPBACK 6 /* enable local loopback */ |
diff --git a/drivers/infiniband/hw/ipath/ipath_driver.c b/drivers/infiniband/hw/ipath/ipath_driver.c index d5ff6ca2db30..ca4d0acc6786 100644 --- a/drivers/infiniband/hw/ipath/ipath_driver.c +++ b/drivers/infiniband/hw/ipath/ipath_driver.c | |||
@@ -851,8 +851,7 @@ void ipath_disarm_piobufs(struct ipath_devdata *dd, unsigned first, | |||
851 | * -ETIMEDOUT state can have multiple states set, for any of several | 851 | * -ETIMEDOUT state can have multiple states set, for any of several |
852 | * transitions. | 852 | * transitions. |
853 | */ | 853 | */ |
854 | static int ipath_wait_linkstate(struct ipath_devdata *dd, u32 state, | 854 | int ipath_wait_linkstate(struct ipath_devdata *dd, u32 state, int msecs) |
855 | int msecs) | ||
856 | { | 855 | { |
857 | dd->ipath_state_wanted = state; | 856 | dd->ipath_state_wanted = state; |
858 | wait_event_interruptible_timeout(ipath_state_wait, | 857 | wait_event_interruptible_timeout(ipath_state_wait, |
@@ -1656,8 +1655,8 @@ void ipath_cancel_sends(struct ipath_devdata *dd, int restore_sendctrl) | |||
1656 | static void ipath_set_ib_lstate(struct ipath_devdata *dd, int which) | 1655 | static void ipath_set_ib_lstate(struct ipath_devdata *dd, int which) |
1657 | { | 1656 | { |
1658 | static const char *what[4] = { | 1657 | static const char *what[4] = { |
1659 | [0] = "DOWN", | 1658 | [0] = "NOP", |
1660 | [INFINIPATH_IBCC_LINKCMD_INIT] = "INIT", | 1659 | [INFINIPATH_IBCC_LINKCMD_DOWN] = "DOWN", |
1661 | [INFINIPATH_IBCC_LINKCMD_ARMED] = "ARMED", | 1660 | [INFINIPATH_IBCC_LINKCMD_ARMED] = "ARMED", |
1662 | [INFINIPATH_IBCC_LINKCMD_ACTIVE] = "ACTIVE" | 1661 | [INFINIPATH_IBCC_LINKCMD_ACTIVE] = "ACTIVE" |
1663 | }; | 1662 | }; |
@@ -1672,9 +1671,9 @@ static void ipath_set_ib_lstate(struct ipath_devdata *dd, int which) | |||
1672 | (dd, dd->ipath_kregs->kr_ibcstatus) >> | 1671 | (dd, dd->ipath_kregs->kr_ibcstatus) >> |
1673 | INFINIPATH_IBCS_LINKTRAININGSTATE_SHIFT) & | 1672 | INFINIPATH_IBCS_LINKTRAININGSTATE_SHIFT) & |
1674 | INFINIPATH_IBCS_LINKTRAININGSTATE_MASK]); | 1673 | INFINIPATH_IBCS_LINKTRAININGSTATE_MASK]); |
1675 | /* flush all queued sends when going to DOWN or INIT, to be sure that | 1674 | /* flush all queued sends when going to DOWN to be sure that |
1676 | * they don't block MAD packets */ | 1675 | * they don't block MAD packets */ |
1677 | if (!linkcmd || linkcmd == INFINIPATH_IBCC_LINKCMD_INIT) | 1676 | if (linkcmd == INFINIPATH_IBCC_LINKCMD_DOWN) |
1678 | ipath_cancel_sends(dd, 1); | 1677 | ipath_cancel_sends(dd, 1); |
1679 | 1678 | ||
1680 | ipath_write_kreg(dd, dd->ipath_kregs->kr_ibcctrl, | 1679 | ipath_write_kreg(dd, dd->ipath_kregs->kr_ibcctrl, |
@@ -1687,6 +1686,13 @@ int ipath_set_linkstate(struct ipath_devdata *dd, u8 newstate) | |||
1687 | int ret; | 1686 | int ret; |
1688 | 1687 | ||
1689 | switch (newstate) { | 1688 | switch (newstate) { |
1689 | case IPATH_IB_LINKDOWN_ONLY: | ||
1690 | ipath_set_ib_lstate(dd, INFINIPATH_IBCC_LINKCMD_DOWN << | ||
1691 | INFINIPATH_IBCC_LINKCMD_SHIFT); | ||
1692 | /* don't wait */ | ||
1693 | ret = 0; | ||
1694 | goto bail; | ||
1695 | |||
1690 | case IPATH_IB_LINKDOWN: | 1696 | case IPATH_IB_LINKDOWN: |
1691 | ipath_set_ib_lstate(dd, INFINIPATH_IBCC_LINKINITCMD_POLL << | 1697 | ipath_set_ib_lstate(dd, INFINIPATH_IBCC_LINKINITCMD_POLL << |
1692 | INFINIPATH_IBCC_LINKINITCMD_SHIFT); | 1698 | INFINIPATH_IBCC_LINKINITCMD_SHIFT); |
@@ -1709,16 +1715,6 @@ int ipath_set_linkstate(struct ipath_devdata *dd, u8 newstate) | |||
1709 | ret = 0; | 1715 | ret = 0; |
1710 | goto bail; | 1716 | goto bail; |
1711 | 1717 | ||
1712 | case IPATH_IB_LINKINIT: | ||
1713 | if (dd->ipath_flags & IPATH_LINKINIT) { | ||
1714 | ret = 0; | ||
1715 | goto bail; | ||
1716 | } | ||
1717 | ipath_set_ib_lstate(dd, INFINIPATH_IBCC_LINKCMD_INIT << | ||
1718 | INFINIPATH_IBCC_LINKCMD_SHIFT); | ||
1719 | lstate = IPATH_LINKINIT; | ||
1720 | break; | ||
1721 | |||
1722 | case IPATH_IB_LINKARM: | 1718 | case IPATH_IB_LINKARM: |
1723 | if (dd->ipath_flags & IPATH_LINKARMED) { | 1719 | if (dd->ipath_flags & IPATH_LINKARMED) { |
1724 | ret = 0; | 1720 | ret = 0; |
diff --git a/drivers/infiniband/hw/ipath/ipath_kernel.h b/drivers/infiniband/hw/ipath/ipath_kernel.h index 4cc0f95ea877..ecf3f7ff7717 100644 --- a/drivers/infiniband/hw/ipath/ipath_kernel.h +++ b/drivers/infiniband/hw/ipath/ipath_kernel.h | |||
@@ -767,6 +767,7 @@ void ipath_kreceive(struct ipath_portdata *); | |||
767 | int ipath_setrcvhdrsize(struct ipath_devdata *, unsigned); | 767 | int ipath_setrcvhdrsize(struct ipath_devdata *, unsigned); |
768 | int ipath_reset_device(int); | 768 | int ipath_reset_device(int); |
769 | void ipath_get_faststats(unsigned long); | 769 | void ipath_get_faststats(unsigned long); |
770 | int ipath_wait_linkstate(struct ipath_devdata *, u32, int); | ||
770 | int ipath_set_linkstate(struct ipath_devdata *, u8); | 771 | int ipath_set_linkstate(struct ipath_devdata *, u8); |
771 | int ipath_set_mtu(struct ipath_devdata *, u16); | 772 | int ipath_set_mtu(struct ipath_devdata *, u16); |
772 | int ipath_set_lid(struct ipath_devdata *, u32, u8); | 773 | int ipath_set_lid(struct ipath_devdata *, u32, u8); |
diff --git a/drivers/infiniband/hw/ipath/ipath_mad.c b/drivers/infiniband/hw/ipath/ipath_mad.c index d98d5f103700..b34b91d3723a 100644 --- a/drivers/infiniband/hw/ipath/ipath_mad.c +++ b/drivers/infiniband/hw/ipath/ipath_mad.c | |||
@@ -555,10 +555,7 @@ static int recv_subn_set_portinfo(struct ib_smp *smp, | |||
555 | /* FALLTHROUGH */ | 555 | /* FALLTHROUGH */ |
556 | case IB_PORT_DOWN: | 556 | case IB_PORT_DOWN: |
557 | if (lstate == 0) | 557 | if (lstate == 0) |
558 | if (get_linkdowndefaultstate(dd)) | 558 | lstate = IPATH_IB_LINKDOWN_ONLY; |
559 | lstate = IPATH_IB_LINKDOWN_SLEEP; | ||
560 | else | ||
561 | lstate = IPATH_IB_LINKDOWN; | ||
562 | else if (lstate == 1) | 559 | else if (lstate == 1) |
563 | lstate = IPATH_IB_LINKDOWN_SLEEP; | 560 | lstate = IPATH_IB_LINKDOWN_SLEEP; |
564 | else if (lstate == 2) | 561 | else if (lstate == 2) |
@@ -568,6 +565,8 @@ static int recv_subn_set_portinfo(struct ib_smp *smp, | |||
568 | else | 565 | else |
569 | goto err; | 566 | goto err; |
570 | ipath_set_linkstate(dd, lstate); | 567 | ipath_set_linkstate(dd, lstate); |
568 | ipath_wait_linkstate(dd, IPATH_LINKINIT | IPATH_LINKARMED | | ||
569 | IPATH_LINKACTIVE, 1000); | ||
571 | break; | 570 | break; |
572 | case IB_PORT_ARMED: | 571 | case IB_PORT_ARMED: |
573 | ipath_set_linkstate(dd, IPATH_IB_LINKARM); | 572 | ipath_set_linkstate(dd, IPATH_IB_LINKARM); |
diff --git a/drivers/infiniband/hw/ipath/ipath_qp.c b/drivers/infiniband/hw/ipath/ipath_qp.c index 80dc623cee40..087ed3166479 100644 --- a/drivers/infiniband/hw/ipath/ipath_qp.c +++ b/drivers/infiniband/hw/ipath/ipath_qp.c | |||
@@ -329,8 +329,9 @@ struct ipath_qp *ipath_lookup_qpn(struct ipath_qp_table *qpt, u32 qpn) | |||
329 | /** | 329 | /** |
330 | * ipath_reset_qp - initialize the QP state to the reset state | 330 | * ipath_reset_qp - initialize the QP state to the reset state |
331 | * @qp: the QP to reset | 331 | * @qp: the QP to reset |
332 | * @type: the QP type | ||
332 | */ | 333 | */ |
333 | static void ipath_reset_qp(struct ipath_qp *qp) | 334 | static void ipath_reset_qp(struct ipath_qp *qp, enum ib_qp_type type) |
334 | { | 335 | { |
335 | qp->remote_qpn = 0; | 336 | qp->remote_qpn = 0; |
336 | qp->qkey = 0; | 337 | qp->qkey = 0; |
@@ -342,7 +343,7 @@ static void ipath_reset_qp(struct ipath_qp *qp) | |||
342 | qp->s_psn = 0; | 343 | qp->s_psn = 0; |
343 | qp->r_psn = 0; | 344 | qp->r_psn = 0; |
344 | qp->r_msn = 0; | 345 | qp->r_msn = 0; |
345 | if (qp->ibqp.qp_type == IB_QPT_RC) { | 346 | if (type == IB_QPT_RC) { |
346 | qp->s_state = IB_OPCODE_RC_SEND_LAST; | 347 | qp->s_state = IB_OPCODE_RC_SEND_LAST; |
347 | qp->r_state = IB_OPCODE_RC_SEND_LAST; | 348 | qp->r_state = IB_OPCODE_RC_SEND_LAST; |
348 | } else { | 349 | } else { |
@@ -414,7 +415,7 @@ int ipath_error_qp(struct ipath_qp *qp, enum ib_wc_status err) | |||
414 | wc.wr_id = qp->r_wr_id; | 415 | wc.wr_id = qp->r_wr_id; |
415 | wc.opcode = IB_WC_RECV; | 416 | wc.opcode = IB_WC_RECV; |
416 | wc.status = err; | 417 | wc.status = err; |
417 | ipath_cq_enter(to_icq(qp->ibqp.send_cq), &wc, 1); | 418 | ipath_cq_enter(to_icq(qp->ibqp.recv_cq), &wc, 1); |
418 | } | 419 | } |
419 | wc.status = IB_WC_WR_FLUSH_ERR; | 420 | wc.status = IB_WC_WR_FLUSH_ERR; |
420 | 421 | ||
@@ -534,7 +535,7 @@ int ipath_modify_qp(struct ib_qp *ibqp, struct ib_qp_attr *attr, | |||
534 | 535 | ||
535 | switch (new_state) { | 536 | switch (new_state) { |
536 | case IB_QPS_RESET: | 537 | case IB_QPS_RESET: |
537 | ipath_reset_qp(qp); | 538 | ipath_reset_qp(qp, ibqp->qp_type); |
538 | break; | 539 | break; |
539 | 540 | ||
540 | case IB_QPS_ERR: | 541 | case IB_QPS_ERR: |
@@ -647,7 +648,7 @@ int ipath_query_qp(struct ib_qp *ibqp, struct ib_qp_attr *attr, | |||
647 | attr->port_num = 1; | 648 | attr->port_num = 1; |
648 | attr->timeout = qp->timeout; | 649 | attr->timeout = qp->timeout; |
649 | attr->retry_cnt = qp->s_retry_cnt; | 650 | attr->retry_cnt = qp->s_retry_cnt; |
650 | attr->rnr_retry = qp->s_rnr_retry; | 651 | attr->rnr_retry = qp->s_rnr_retry_cnt; |
651 | attr->alt_port_num = 0; | 652 | attr->alt_port_num = 0; |
652 | attr->alt_timeout = 0; | 653 | attr->alt_timeout = 0; |
653 | 654 | ||
@@ -839,7 +840,7 @@ struct ib_qp *ipath_create_qp(struct ib_pd *ibpd, | |||
839 | goto bail_qp; | 840 | goto bail_qp; |
840 | } | 841 | } |
841 | qp->ip = NULL; | 842 | qp->ip = NULL; |
842 | ipath_reset_qp(qp); | 843 | ipath_reset_qp(qp, init_attr->qp_type); |
843 | break; | 844 | break; |
844 | 845 | ||
845 | default: | 846 | default: |
diff --git a/drivers/infiniband/hw/ipath/ipath_rc.c b/drivers/infiniband/hw/ipath/ipath_rc.c index 459e46e2c016..40f3e37d7adc 100644 --- a/drivers/infiniband/hw/ipath/ipath_rc.c +++ b/drivers/infiniband/hw/ipath/ipath_rc.c | |||
@@ -1196,6 +1196,10 @@ static inline void ipath_rc_rcv_resp(struct ipath_ibdev *dev, | |||
1196 | list_move_tail(&qp->timerwait, | 1196 | list_move_tail(&qp->timerwait, |
1197 | &dev->pending[dev->pending_index]); | 1197 | &dev->pending[dev->pending_index]); |
1198 | spin_unlock(&dev->pending_lock); | 1198 | spin_unlock(&dev->pending_lock); |
1199 | |||
1200 | if (opcode == OP(RDMA_READ_RESPONSE_MIDDLE)) | ||
1201 | qp->s_retry = qp->s_retry_cnt; | ||
1202 | |||
1199 | /* | 1203 | /* |
1200 | * Update the RDMA receive state but do the copy w/o | 1204 | * Update the RDMA receive state but do the copy w/o |
1201 | * holding the locks and blocking interrupts. | 1205 | * holding the locks and blocking interrupts. |
diff --git a/drivers/infiniband/hw/ipath/ipath_registers.h b/drivers/infiniband/hw/ipath/ipath_registers.h index 6d2a17f9c1da..92ad73a7fff0 100644 --- a/drivers/infiniband/hw/ipath/ipath_registers.h +++ b/drivers/infiniband/hw/ipath/ipath_registers.h | |||
@@ -185,7 +185,7 @@ | |||
185 | #define INFINIPATH_IBCC_LINKINITCMD_SLEEP 3 | 185 | #define INFINIPATH_IBCC_LINKINITCMD_SLEEP 3 |
186 | #define INFINIPATH_IBCC_LINKINITCMD_SHIFT 16 | 186 | #define INFINIPATH_IBCC_LINKINITCMD_SHIFT 16 |
187 | #define INFINIPATH_IBCC_LINKCMD_MASK 0x3ULL | 187 | #define INFINIPATH_IBCC_LINKCMD_MASK 0x3ULL |
188 | #define INFINIPATH_IBCC_LINKCMD_INIT 1 /* move to 0x11 */ | 188 | #define INFINIPATH_IBCC_LINKCMD_DOWN 1 /* move to 0x11 */ |
189 | #define INFINIPATH_IBCC_LINKCMD_ARMED 2 /* move to 0x21 */ | 189 | #define INFINIPATH_IBCC_LINKCMD_ARMED 2 /* move to 0x21 */ |
190 | #define INFINIPATH_IBCC_LINKCMD_ACTIVE 3 /* move to 0x31 */ | 190 | #define INFINIPATH_IBCC_LINKCMD_ACTIVE 3 /* move to 0x31 */ |
191 | #define INFINIPATH_IBCC_LINKCMD_SHIFT 18 | 191 | #define INFINIPATH_IBCC_LINKCMD_SHIFT 18 |
diff --git a/drivers/infiniband/hw/nes/nes_cm.c b/drivers/infiniband/hw/nes/nes_cm.c index 39adb267fb15..0bef878e0f65 100644 --- a/drivers/infiniband/hw/nes/nes_cm.c +++ b/drivers/infiniband/hw/nes/nes_cm.c | |||
@@ -40,6 +40,7 @@ | |||
40 | #include <linux/tcp.h> | 40 | #include <linux/tcp.h> |
41 | #include <linux/init.h> | 41 | #include <linux/init.h> |
42 | #include <linux/if_arp.h> | 42 | #include <linux/if_arp.h> |
43 | #include <linux/if_vlan.h> | ||
43 | #include <linux/notifier.h> | 44 | #include <linux/notifier.h> |
44 | #include <linux/net.h> | 45 | #include <linux/net.h> |
45 | #include <linux/types.h> | 46 | #include <linux/types.h> |
@@ -1072,7 +1073,7 @@ static struct nes_cm_node *make_cm_node(struct nes_cm_core *cm_core, | |||
1072 | ts = current_kernel_time(); | 1073 | ts = current_kernel_time(); |
1073 | cm_node->tcp_cntxt.loc_seq_num = htonl(ts.tv_nsec); | 1074 | cm_node->tcp_cntxt.loc_seq_num = htonl(ts.tv_nsec); |
1074 | cm_node->tcp_cntxt.mss = nesvnic->max_frame_size - sizeof(struct iphdr) - | 1075 | cm_node->tcp_cntxt.mss = nesvnic->max_frame_size - sizeof(struct iphdr) - |
1075 | sizeof(struct tcphdr) - ETH_HLEN; | 1076 | sizeof(struct tcphdr) - ETH_HLEN - VLAN_HLEN; |
1076 | cm_node->tcp_cntxt.rcv_nxt = 0; | 1077 | cm_node->tcp_cntxt.rcv_nxt = 0; |
1077 | /* get a unique session ID , add thread_id to an upcounter to handle race */ | 1078 | /* get a unique session ID , add thread_id to an upcounter to handle race */ |
1078 | atomic_inc(&cm_core->node_cnt); | 1079 | atomic_inc(&cm_core->node_cnt); |
diff --git a/drivers/infiniband/ulp/ipoib/ipoib_cm.c b/drivers/infiniband/ulp/ipoib/ipoib_cm.c index 52b1bebfa744..2490b2d79dbb 100644 --- a/drivers/infiniband/ulp/ipoib/ipoib_cm.c +++ b/drivers/infiniband/ulp/ipoib/ipoib_cm.c | |||
@@ -38,6 +38,7 @@ | |||
38 | #include <net/icmp.h> | 38 | #include <net/icmp.h> |
39 | #include <linux/icmpv6.h> | 39 | #include <linux/icmpv6.h> |
40 | #include <linux/delay.h> | 40 | #include <linux/delay.h> |
41 | #include <linux/vmalloc.h> | ||
41 | 42 | ||
42 | #include "ipoib.h" | 43 | #include "ipoib.h" |
43 | 44 | ||
@@ -637,6 +638,7 @@ static inline int post_send(struct ipoib_dev_priv *priv, | |||
637 | priv->tx_sge[0].addr = addr; | 638 | priv->tx_sge[0].addr = addr; |
638 | priv->tx_sge[0].length = len; | 639 | priv->tx_sge[0].length = len; |
639 | 640 | ||
641 | priv->tx_wr.num_sge = 1; | ||
640 | priv->tx_wr.wr_id = wr_id | IPOIB_OP_CM; | 642 | priv->tx_wr.wr_id = wr_id | IPOIB_OP_CM; |
641 | 643 | ||
642 | return ib_post_send(tx->qp, &priv->tx_wr, &bad_wr); | 644 | return ib_post_send(tx->qp, &priv->tx_wr, &bad_wr); |
@@ -1030,13 +1032,13 @@ static int ipoib_cm_tx_init(struct ipoib_cm_tx *p, u32 qpn, | |||
1030 | struct ipoib_dev_priv *priv = netdev_priv(p->dev); | 1032 | struct ipoib_dev_priv *priv = netdev_priv(p->dev); |
1031 | int ret; | 1033 | int ret; |
1032 | 1034 | ||
1033 | p->tx_ring = kzalloc(ipoib_sendq_size * sizeof *p->tx_ring, | 1035 | p->tx_ring = vmalloc(ipoib_sendq_size * sizeof *p->tx_ring); |
1034 | GFP_KERNEL); | ||
1035 | if (!p->tx_ring) { | 1036 | if (!p->tx_ring) { |
1036 | ipoib_warn(priv, "failed to allocate tx ring\n"); | 1037 | ipoib_warn(priv, "failed to allocate tx ring\n"); |
1037 | ret = -ENOMEM; | 1038 | ret = -ENOMEM; |
1038 | goto err_tx; | 1039 | goto err_tx; |
1039 | } | 1040 | } |
1041 | memset(p->tx_ring, 0, ipoib_sendq_size * sizeof *p->tx_ring); | ||
1040 | 1042 | ||
1041 | p->qp = ipoib_cm_create_tx_qp(p->dev, p); | 1043 | p->qp = ipoib_cm_create_tx_qp(p->dev, p); |
1042 | if (IS_ERR(p->qp)) { | 1044 | if (IS_ERR(p->qp)) { |
@@ -1077,6 +1079,7 @@ err_id: | |||
1077 | ib_destroy_qp(p->qp); | 1079 | ib_destroy_qp(p->qp); |
1078 | err_qp: | 1080 | err_qp: |
1079 | p->qp = NULL; | 1081 | p->qp = NULL; |
1082 | vfree(p->tx_ring); | ||
1080 | err_tx: | 1083 | err_tx: |
1081 | return ret; | 1084 | return ret; |
1082 | } | 1085 | } |
@@ -1127,7 +1130,7 @@ timeout: | |||
1127 | if (p->qp) | 1130 | if (p->qp) |
1128 | ib_destroy_qp(p->qp); | 1131 | ib_destroy_qp(p->qp); |
1129 | 1132 | ||
1130 | kfree(p->tx_ring); | 1133 | vfree(p->tx_ring); |
1131 | kfree(p); | 1134 | kfree(p); |
1132 | } | 1135 | } |
1133 | 1136 | ||
diff --git a/drivers/infiniband/ulp/ipoib/ipoib_main.c b/drivers/infiniband/ulp/ipoib/ipoib_main.c index f96477a8ca5a..57282048865c 100644 --- a/drivers/infiniband/ulp/ipoib/ipoib_main.c +++ b/drivers/infiniband/ulp/ipoib/ipoib_main.c | |||
@@ -41,6 +41,7 @@ | |||
41 | #include <linux/init.h> | 41 | #include <linux/init.h> |
42 | #include <linux/slab.h> | 42 | #include <linux/slab.h> |
43 | #include <linux/kernel.h> | 43 | #include <linux/kernel.h> |
44 | #include <linux/vmalloc.h> | ||
44 | 45 | ||
45 | #include <linux/if_arp.h> /* For ARPHRD_xxx */ | 46 | #include <linux/if_arp.h> /* For ARPHRD_xxx */ |
46 | 47 | ||
@@ -887,13 +888,13 @@ int ipoib_dev_init(struct net_device *dev, struct ib_device *ca, int port) | |||
887 | goto out; | 888 | goto out; |
888 | } | 889 | } |
889 | 890 | ||
890 | priv->tx_ring = kzalloc(ipoib_sendq_size * sizeof *priv->tx_ring, | 891 | priv->tx_ring = vmalloc(ipoib_sendq_size * sizeof *priv->tx_ring); |
891 | GFP_KERNEL); | ||
892 | if (!priv->tx_ring) { | 892 | if (!priv->tx_ring) { |
893 | printk(KERN_WARNING "%s: failed to allocate TX ring (%d entries)\n", | 893 | printk(KERN_WARNING "%s: failed to allocate TX ring (%d entries)\n", |
894 | ca->name, ipoib_sendq_size); | 894 | ca->name, ipoib_sendq_size); |
895 | goto out_rx_ring_cleanup; | 895 | goto out_rx_ring_cleanup; |
896 | } | 896 | } |
897 | memset(priv->tx_ring, 0, ipoib_sendq_size * sizeof *priv->tx_ring); | ||
897 | 898 | ||
898 | /* priv->tx_head, tx_tail & tx_outstanding are already 0 */ | 899 | /* priv->tx_head, tx_tail & tx_outstanding are already 0 */ |
899 | 900 | ||
@@ -903,7 +904,7 @@ int ipoib_dev_init(struct net_device *dev, struct ib_device *ca, int port) | |||
903 | return 0; | 904 | return 0; |
904 | 905 | ||
905 | out_tx_ring_cleanup: | 906 | out_tx_ring_cleanup: |
906 | kfree(priv->tx_ring); | 907 | vfree(priv->tx_ring); |
907 | 908 | ||
908 | out_rx_ring_cleanup: | 909 | out_rx_ring_cleanup: |
909 | kfree(priv->rx_ring); | 910 | kfree(priv->rx_ring); |
@@ -928,7 +929,7 @@ void ipoib_dev_cleanup(struct net_device *dev) | |||
928 | ipoib_ib_dev_cleanup(dev); | 929 | ipoib_ib_dev_cleanup(dev); |
929 | 930 | ||
930 | kfree(priv->rx_ring); | 931 | kfree(priv->rx_ring); |
931 | kfree(priv->tx_ring); | 932 | vfree(priv->tx_ring); |
932 | 933 | ||
933 | priv->rx_ring = NULL; | 934 | priv->rx_ring = NULL; |
934 | priv->tx_ring = NULL; | 935 | priv->tx_ring = NULL; |
diff --git a/drivers/infiniband/ulp/ipoib/ipoib_multicast.c b/drivers/infiniband/ulp/ipoib/ipoib_multicast.c index 2628339e3a99..31a53c5bcb13 100644 --- a/drivers/infiniband/ulp/ipoib/ipoib_multicast.c +++ b/drivers/infiniband/ulp/ipoib/ipoib_multicast.c | |||
@@ -650,7 +650,7 @@ void ipoib_mcast_send(struct net_device *dev, void *mgid, struct sk_buff *skb) | |||
650 | */ | 650 | */ |
651 | spin_lock(&priv->lock); | 651 | spin_lock(&priv->lock); |
652 | 652 | ||
653 | if (!test_bit(IPOIB_MCAST_STARTED, &priv->flags) || | 653 | if (!test_bit(IPOIB_FLAG_OPER_UP, &priv->flags) || |
654 | !priv->broadcast || | 654 | !priv->broadcast || |
655 | !test_bit(IPOIB_MCAST_FLAG_ATTACHED, &priv->broadcast->flags)) { | 655 | !test_bit(IPOIB_MCAST_FLAG_ATTACHED, &priv->broadcast->flags)) { |
656 | ++dev->stats.tx_dropped; | 656 | ++dev->stats.tx_dropped; |
diff --git a/drivers/input/misc/cobalt_btns.c b/drivers/input/misc/cobalt_btns.c index 4833b1a82623..5511ef006a66 100644 --- a/drivers/input/misc/cobalt_btns.c +++ b/drivers/input/misc/cobalt_btns.c | |||
@@ -1,7 +1,7 @@ | |||
1 | /* | 1 | /* |
2 | * Cobalt button interface driver. | 2 | * Cobalt button interface driver. |
3 | * | 3 | * |
4 | * Copyright (C) 2007 Yoichi Yuasa <yoichi_yuasa@tripeaks.co.jp> | 4 | * Copyright (C) 2007-2008 Yoichi Yuasa <yoichi_yuasa@tripeaks.co.jp> |
5 | * | 5 | * |
6 | * This program is free software; you can redistribute it and/or modify | 6 | * This program is free software; you can redistribute it and/or modify |
7 | * it under the terms of the GNU General Public License as published by | 7 | * it under the terms of the GNU General Public License as published by |
@@ -15,7 +15,7 @@ | |||
15 | * | 15 | * |
16 | * You should have received a copy of the GNU General Public License | 16 | * You should have received a copy of the GNU General Public License |
17 | * along with this program; if not, write to the Free Software | 17 | * along with this program; if not, write to the Free Software |
18 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA | 18 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA |
19 | */ | 19 | */ |
20 | #include <linux/init.h> | 20 | #include <linux/init.h> |
21 | #include <linux/input-polldev.h> | 21 | #include <linux/input-polldev.h> |
@@ -55,7 +55,7 @@ static void handle_buttons(struct input_polled_dev *dev) | |||
55 | status = ~readl(bdev->reg) >> 24; | 55 | status = ~readl(bdev->reg) >> 24; |
56 | 56 | ||
57 | for (i = 0; i < ARRAY_SIZE(bdev->keymap); i++) { | 57 | for (i = 0; i < ARRAY_SIZE(bdev->keymap); i++) { |
58 | if (status & (1UL << i)) { | 58 | if (status & (1U << i)) { |
59 | if (++bdev->count[i] == BUTTONS_COUNT_THRESHOLD) { | 59 | if (++bdev->count[i] == BUTTONS_COUNT_THRESHOLD) { |
60 | input_event(input, EV_MSC, MSC_SCAN, i); | 60 | input_event(input, EV_MSC, MSC_SCAN, i); |
61 | input_report_key(input, bdev->keymap[i], 1); | 61 | input_report_key(input, bdev->keymap[i], 1); |
@@ -97,16 +97,16 @@ static int __devinit cobalt_buttons_probe(struct platform_device *pdev) | |||
97 | input->name = "Cobalt buttons"; | 97 | input->name = "Cobalt buttons"; |
98 | input->phys = "cobalt/input0"; | 98 | input->phys = "cobalt/input0"; |
99 | input->id.bustype = BUS_HOST; | 99 | input->id.bustype = BUS_HOST; |
100 | input->cdev.dev = &pdev->dev; | 100 | input->dev.parent = &pdev->dev; |
101 | 101 | ||
102 | input->keycode = pdev->keymap; | 102 | input->keycode = bdev->keymap; |
103 | input->keycodemax = ARRAY_SIZE(pdev->keymap); | 103 | input->keycodemax = ARRAY_SIZE(bdev->keymap); |
104 | input->keycodesize = sizeof(unsigned short); | 104 | input->keycodesize = sizeof(unsigned short); |
105 | 105 | ||
106 | input_set_capability(input, EV_MSC, MSC_SCAN); | 106 | input_set_capability(input, EV_MSC, MSC_SCAN); |
107 | __set_bit(EV_KEY, input->evbit); | 107 | __set_bit(EV_KEY, input->evbit); |
108 | for (i = 0; i < ARRAY_SIZE(buttons_map); i++) | 108 | for (i = 0; i < ARRAY_SIZE(cobalt_map); i++) |
109 | __set_bit(input->keycode[i], input->keybit); | 109 | __set_bit(bdev->keymap[i], input->keybit); |
110 | __clear_bit(KEY_RESERVED, input->keybit); | 110 | __clear_bit(KEY_RESERVED, input->keybit); |
111 | 111 | ||
112 | res = platform_get_resource(pdev, IORESOURCE_MEM, 0); | 112 | res = platform_get_resource(pdev, IORESOURCE_MEM, 0); |
diff --git a/drivers/input/mouse/alps.c b/drivers/input/mouse/alps.c index b346a3b418ea..385e32bcf6a6 100644 --- a/drivers/input/mouse/alps.c +++ b/drivers/input/mouse/alps.c | |||
@@ -116,8 +116,8 @@ static void alps_process_packet(struct psmouse *psmouse) | |||
116 | } | 116 | } |
117 | 117 | ||
118 | if (priv->i->flags & ALPS_FW_BK_1) { | 118 | if (priv->i->flags & ALPS_FW_BK_1) { |
119 | back = packet[2] & 4; | 119 | back = packet[0] & 0x10; |
120 | forward = packet[0] & 0x10; | 120 | forward = packet[2] & 4; |
121 | } | 121 | } |
122 | 122 | ||
123 | if (priv->i->flags & ALPS_FW_BK_2) { | 123 | if (priv->i->flags & ALPS_FW_BK_2) { |
@@ -483,6 +483,7 @@ int alps_init(struct psmouse *psmouse) | |||
483 | dev2->id.vendor = 0x0002; | 483 | dev2->id.vendor = 0x0002; |
484 | dev2->id.product = PSMOUSE_ALPS; | 484 | dev2->id.product = PSMOUSE_ALPS; |
485 | dev2->id.version = 0x0000; | 485 | dev2->id.version = 0x0000; |
486 | dev2->dev.parent = &psmouse->ps2dev.serio->dev; | ||
486 | 487 | ||
487 | dev2->evbit[0] = BIT_MASK(EV_KEY) | BIT_MASK(EV_REL); | 488 | dev2->evbit[0] = BIT_MASK(EV_KEY) | BIT_MASK(EV_REL); |
488 | dev2->relbit[BIT_WORD(REL_X)] |= BIT_MASK(REL_X) | BIT_MASK(REL_Y); | 489 | dev2->relbit[BIT_WORD(REL_X)] |= BIT_MASK(REL_X) | BIT_MASK(REL_Y); |
diff --git a/drivers/input/serio/i8042-snirm.h b/drivers/input/serio/i8042-snirm.h new file mode 100644 index 000000000000..409a9341143d --- /dev/null +++ b/drivers/input/serio/i8042-snirm.h | |||
@@ -0,0 +1,75 @@ | |||
1 | #ifndef _I8042_SNIRM_H | ||
2 | #define _I8042_SNIRM_H | ||
3 | |||
4 | #include <asm/sni.h> | ||
5 | |||
6 | /* | ||
7 | * This program is free software; you can redistribute it and/or modify it | ||
8 | * under the terms of the GNU General Public License version 2 as published by | ||
9 | * the Free Software Foundation. | ||
10 | */ | ||
11 | |||
12 | /* | ||
13 | * Names. | ||
14 | */ | ||
15 | |||
16 | #define I8042_KBD_PHYS_DESC "onboard/serio0" | ||
17 | #define I8042_AUX_PHYS_DESC "onboard/serio1" | ||
18 | #define I8042_MUX_PHYS_DESC "onboard/serio%d" | ||
19 | |||
20 | /* | ||
21 | * IRQs. | ||
22 | */ | ||
23 | static int i8042_kbd_irq; | ||
24 | static int i8042_aux_irq; | ||
25 | #define I8042_KBD_IRQ i8042_kbd_irq | ||
26 | #define I8042_AUX_IRQ i8042_aux_irq | ||
27 | |||
28 | static void __iomem *kbd_iobase; | ||
29 | |||
30 | #define I8042_COMMAND_REG (kbd_iobase + 0x64UL) | ||
31 | #define I8042_DATA_REG (kbd_iobase + 0x60UL) | ||
32 | |||
33 | static inline int i8042_read_data(void) | ||
34 | { | ||
35 | return readb(kbd_iobase + 0x60UL); | ||
36 | } | ||
37 | |||
38 | static inline int i8042_read_status(void) | ||
39 | { | ||
40 | return readb(kbd_iobase + 0x64UL); | ||
41 | } | ||
42 | |||
43 | static inline void i8042_write_data(int val) | ||
44 | { | ||
45 | writeb(val, kbd_iobase + 0x60UL); | ||
46 | } | ||
47 | |||
48 | static inline void i8042_write_command(int val) | ||
49 | { | ||
50 | writeb(val, kbd_iobase + 0x64UL); | ||
51 | } | ||
52 | static inline int i8042_platform_init(void) | ||
53 | { | ||
54 | /* RM200 is strange ... */ | ||
55 | if (sni_brd_type == SNI_BRD_RM200) { | ||
56 | kbd_iobase = ioremap(0x16000000, 4); | ||
57 | i8042_kbd_irq = 33; | ||
58 | i8042_aux_irq = 44; | ||
59 | } else { | ||
60 | kbd_iobase = ioremap(0x14000000, 4); | ||
61 | i8042_kbd_irq = 1; | ||
62 | i8042_aux_irq = 12; | ||
63 | } | ||
64 | if (!kbd_iobase) | ||
65 | return -ENOMEM; | ||
66 | |||
67 | return 0; | ||
68 | } | ||
69 | |||
70 | static inline void i8042_platform_exit(void) | ||
71 | { | ||
72 | |||
73 | } | ||
74 | |||
75 | #endif /* _I8042_SNIRM_H */ | ||
diff --git a/drivers/input/serio/i8042-x86ia64io.h b/drivers/input/serio/i8042-x86ia64io.h index 662e84482c26..60931aceb828 100644 --- a/drivers/input/serio/i8042-x86ia64io.h +++ b/drivers/input/serio/i8042-x86ia64io.h | |||
@@ -277,6 +277,13 @@ static struct dmi_system_id __initdata i8042_dmi_nomux_table[] = { | |||
277 | DMI_MATCH(DMI_PRODUCT_NAME, "M636/A737 platform"), | 277 | DMI_MATCH(DMI_PRODUCT_NAME, "M636/A737 platform"), |
278 | }, | 278 | }, |
279 | }, | 279 | }, |
280 | { | ||
281 | .ident = "Lenovo 3000 n100", | ||
282 | .matches = { | ||
283 | DMI_MATCH(DMI_SYS_VENDOR, "LENOVO"), | ||
284 | DMI_MATCH(DMI_PRODUCT_VERSION, "3000 N100"), | ||
285 | }, | ||
286 | }, | ||
280 | { } | 287 | { } |
281 | }; | 288 | }; |
282 | 289 | ||
diff --git a/drivers/input/serio/i8042.c b/drivers/input/serio/i8042.c index 2763394869d2..65a74cfc187b 100644 --- a/drivers/input/serio/i8042.c +++ b/drivers/input/serio/i8042.c | |||
@@ -1151,7 +1151,6 @@ static int __devinit i8042_setup_kbd(void) | |||
1151 | static int __devinit i8042_probe(struct platform_device *dev) | 1151 | static int __devinit i8042_probe(struct platform_device *dev) |
1152 | { | 1152 | { |
1153 | int error; | 1153 | int error; |
1154 | char param; | ||
1155 | 1154 | ||
1156 | error = i8042_controller_selftest(); | 1155 | error = i8042_controller_selftest(); |
1157 | if (error) | 1156 | if (error) |
@@ -1174,7 +1173,7 @@ static int __devinit i8042_probe(struct platform_device *dev) | |||
1174 | } | 1173 | } |
1175 | #ifdef CONFIG_X86 | 1174 | #ifdef CONFIG_X86 |
1176 | if (i8042_dritek) { | 1175 | if (i8042_dritek) { |
1177 | param = 0x90; | 1176 | char param = 0x90; |
1178 | error = i8042_command(¶m, 0x1059); | 1177 | error = i8042_command(¶m, 0x1059); |
1179 | if (error) | 1178 | if (error) |
1180 | goto out_fail; | 1179 | goto out_fail; |
diff --git a/drivers/input/serio/i8042.h b/drivers/input/serio/i8042.h index c972e5d03a3f..cbc1beb66574 100644 --- a/drivers/input/serio/i8042.h +++ b/drivers/input/serio/i8042.h | |||
@@ -18,6 +18,8 @@ | |||
18 | #include "i8042-jazzio.h" | 18 | #include "i8042-jazzio.h" |
19 | #elif defined(CONFIG_SGI_HAS_I8042) | 19 | #elif defined(CONFIG_SGI_HAS_I8042) |
20 | #include "i8042-ip22io.h" | 20 | #include "i8042-ip22io.h" |
21 | #elif defined(CONFIG_SNI_RM) | ||
22 | #include "i8042-snirm.h" | ||
21 | #elif defined(CONFIG_PPC) | 23 | #elif defined(CONFIG_PPC) |
22 | #include "i8042-ppcio.h" | 24 | #include "i8042-ppcio.h" |
23 | #elif defined(CONFIG_SPARC) | 25 | #elif defined(CONFIG_SPARC) |
diff --git a/drivers/input/tablet/wacom.h b/drivers/input/tablet/wacom.h index 6542edb6f76e..acf9830698cb 100644 --- a/drivers/input/tablet/wacom.h +++ b/drivers/input/tablet/wacom.h | |||
@@ -11,7 +11,7 @@ | |||
11 | * Copyright (c) 2000 Daniel Egger <egger@suse.de> | 11 | * Copyright (c) 2000 Daniel Egger <egger@suse.de> |
12 | * Copyright (c) 2001 Frederic Lepied <flepied@mandrakesoft.com> | 12 | * Copyright (c) 2001 Frederic Lepied <flepied@mandrakesoft.com> |
13 | * Copyright (c) 2004 Panagiotis Issaris <panagiotis.issaris@mech.kuleuven.ac.be> | 13 | * Copyright (c) 2004 Panagiotis Issaris <panagiotis.issaris@mech.kuleuven.ac.be> |
14 | * Copyright (c) 2002-2007 Ping Cheng <pingc@wacom.com> | 14 | * Copyright (c) 2002-2008 Ping Cheng <pingc@wacom.com> |
15 | * | 15 | * |
16 | * ChangeLog: | 16 | * ChangeLog: |
17 | * v0.1 (vp) - Initial release | 17 | * v0.1 (vp) - Initial release |
@@ -65,6 +65,7 @@ | |||
65 | * - and wacom_wac.c deals with Wacom specific code | 65 | * - and wacom_wac.c deals with Wacom specific code |
66 | * - Support Intuos3 4x6 | 66 | * - Support Intuos3 4x6 |
67 | * v1.47 (pc) - Added support for Bamboo | 67 | * v1.47 (pc) - Added support for Bamboo |
68 | * v1.48 (pc) - Added support for Bamboo1, BambooFun, and Cintiq 12WX | ||
68 | */ | 69 | */ |
69 | 70 | ||
70 | /* | 71 | /* |
@@ -85,7 +86,7 @@ | |||
85 | /* | 86 | /* |
86 | * Version Information | 87 | * Version Information |
87 | */ | 88 | */ |
88 | #define DRIVER_VERSION "v1.47" | 89 | #define DRIVER_VERSION "v1.48" |
89 | #define DRIVER_AUTHOR "Vojtech Pavlik <vojtech@ucw.cz>" | 90 | #define DRIVER_AUTHOR "Vojtech Pavlik <vojtech@ucw.cz>" |
90 | #define DRIVER_DESC "USB Wacom Graphire and Wacom Intuos tablet driver" | 91 | #define DRIVER_DESC "USB Wacom Graphire and Wacom Intuos tablet driver" |
91 | #define DRIVER_LICENSE "GPL" | 92 | #define DRIVER_LICENSE "GPL" |
@@ -125,6 +126,7 @@ extern void input_dev_i(struct input_dev *input_dev, struct wacom_wac *wacom_wac | |||
125 | extern void input_dev_pl(struct input_dev *input_dev, struct wacom_wac *wacom_wac); | 126 | extern void input_dev_pl(struct input_dev *input_dev, struct wacom_wac *wacom_wac); |
126 | extern void input_dev_pt(struct input_dev *input_dev, struct wacom_wac *wacom_wac); | 127 | extern void input_dev_pt(struct input_dev *input_dev, struct wacom_wac *wacom_wac); |
127 | extern void input_dev_mo(struct input_dev *input_dev, struct wacom_wac *wacom_wac); | 128 | extern void input_dev_mo(struct input_dev *input_dev, struct wacom_wac *wacom_wac); |
129 | extern void input_dev_bee(struct input_dev *input_dev, struct wacom_wac *wacom_wac); | ||
128 | extern __u16 wacom_le16_to_cpu(unsigned char *data); | 130 | extern __u16 wacom_le16_to_cpu(unsigned char *data); |
129 | extern __u16 wacom_be16_to_cpu(unsigned char *data); | 131 | extern __u16 wacom_be16_to_cpu(unsigned char *data); |
130 | extern struct wacom_features * get_wacom_feature(const struct usb_device_id *id); | 132 | extern struct wacom_features * get_wacom_feature(const struct usb_device_id *id); |
diff --git a/drivers/input/tablet/wacom_sys.c b/drivers/input/tablet/wacom_sys.c index d64b1ea136b3..41caaef8e2d7 100644 --- a/drivers/input/tablet/wacom_sys.c +++ b/drivers/input/tablet/wacom_sys.c | |||
@@ -171,6 +171,7 @@ void input_dev_i3s(struct input_dev *input_dev, struct wacom_wac *wacom_wac) | |||
171 | input_dev->keybit[BIT_WORD(BTN_LEFT)] |= BIT_MASK(BTN_0) | | 171 | input_dev->keybit[BIT_WORD(BTN_LEFT)] |= BIT_MASK(BTN_0) | |
172 | BIT_MASK(BTN_1) | BIT_MASK(BTN_2) | BIT_MASK(BTN_3); | 172 | BIT_MASK(BTN_1) | BIT_MASK(BTN_2) | BIT_MASK(BTN_3); |
173 | input_set_abs_params(input_dev, ABS_RX, 0, 4096, 0, 0); | 173 | input_set_abs_params(input_dev, ABS_RX, 0, 4096, 0, 0); |
174 | input_set_abs_params(input_dev, ABS_Z, -900, 899, 0, 0); | ||
174 | } | 175 | } |
175 | 176 | ||
176 | void input_dev_i3(struct input_dev *input_dev, struct wacom_wac *wacom_wac) | 177 | void input_dev_i3(struct input_dev *input_dev, struct wacom_wac *wacom_wac) |
@@ -180,6 +181,11 @@ void input_dev_i3(struct input_dev *input_dev, struct wacom_wac *wacom_wac) | |||
180 | input_set_abs_params(input_dev, ABS_RY, 0, 4096, 0, 0); | 181 | input_set_abs_params(input_dev, ABS_RY, 0, 4096, 0, 0); |
181 | } | 182 | } |
182 | 183 | ||
184 | void input_dev_bee(struct input_dev *input_dev, struct wacom_wac *wacom_wac) | ||
185 | { | ||
186 | input_dev->keybit[BIT_WORD(BTN_LEFT)] |= BIT_MASK(BTN_8) | BIT_MASK(BTN_9); | ||
187 | } | ||
188 | |||
183 | void input_dev_i(struct input_dev *input_dev, struct wacom_wac *wacom_wac) | 189 | void input_dev_i(struct input_dev *input_dev, struct wacom_wac *wacom_wac) |
184 | { | 190 | { |
185 | input_dev->evbit[0] |= BIT_MASK(EV_MSC) | BIT_MASK(EV_REL); | 191 | input_dev->evbit[0] |= BIT_MASK(EV_MSC) | BIT_MASK(EV_REL); |
diff --git a/drivers/input/tablet/wacom_wac.c b/drivers/input/tablet/wacom_wac.c index fc03ba256f4c..ffe33842143f 100644 --- a/drivers/input/tablet/wacom_wac.c +++ b/drivers/input/tablet/wacom_wac.c | |||
@@ -163,7 +163,9 @@ static int wacom_graphire_irq(struct wacom_wac *wacom, void *wcombo) | |||
163 | } | 163 | } |
164 | 164 | ||
165 | id = STYLUS_DEVICE_ID; | 165 | id = STYLUS_DEVICE_ID; |
166 | if (data[1] & 0x80) { /* in prox */ | 166 | if ((data[1] & 0x80) && ((data[1] & 0x07) || data[2] || data[3] || data[4] |
167 | || data[5] || data[6] || (data[7] & 0x07))) { | ||
168 | /* in prox and not a pad data */ | ||
167 | 169 | ||
168 | switch ((data[1] >> 5) & 3) { | 170 | switch ((data[1] >> 5) & 3) { |
169 | 171 | ||
@@ -233,7 +235,6 @@ static int wacom_graphire_irq(struct wacom_wac *wacom, void *wcombo) | |||
233 | if (data[7] & 0xf8) { | 235 | if (data[7] & 0xf8) { |
234 | wacom_input_sync(wcombo); /* sync last event */ | 236 | wacom_input_sync(wcombo); /* sync last event */ |
235 | wacom->id[1] = 1; | 237 | wacom->id[1] = 1; |
236 | wacom->serial[1] = (data[7] & 0xf8); | ||
237 | wacom_report_key(wcombo, BTN_0, (data[7] & 0x40)); | 238 | wacom_report_key(wcombo, BTN_0, (data[7] & 0x40)); |
238 | wacom_report_key(wcombo, BTN_4, (data[7] & 0x80)); | 239 | wacom_report_key(wcombo, BTN_4, (data[7] & 0x80)); |
239 | rw = ((data[7] & 0x18) >> 3) - ((data[7] & 0x20) >> 3); | 240 | rw = ((data[7] & 0x18) >> 3) - ((data[7] & 0x20) >> 3); |
@@ -252,10 +253,9 @@ static int wacom_graphire_irq(struct wacom_wac *wacom, void *wcombo) | |||
252 | } | 253 | } |
253 | break; | 254 | break; |
254 | case WACOM_MO: | 255 | case WACOM_MO: |
255 | if ((data[7] & 0xf8) || (data[8] & 0x80)) { | 256 | if ((data[7] & 0xf8) || (data[8] & 0xff)) { |
256 | wacom_input_sync(wcombo); /* sync last event */ | 257 | wacom_input_sync(wcombo); /* sync last event */ |
257 | wacom->id[1] = 1; | 258 | wacom->id[1] = 1; |
258 | wacom->serial[1] = (data[7] & 0xf8); | ||
259 | wacom_report_key(wcombo, BTN_0, (data[7] & 0x08)); | 259 | wacom_report_key(wcombo, BTN_0, (data[7] & 0x08)); |
260 | wacom_report_key(wcombo, BTN_1, (data[7] & 0x20)); | 260 | wacom_report_key(wcombo, BTN_1, (data[7] & 0x20)); |
261 | wacom_report_key(wcombo, BTN_4, (data[7] & 0x10)); | 261 | wacom_report_key(wcombo, BTN_4, (data[7] & 0x10)); |
@@ -434,10 +434,12 @@ static int wacom_intuos_irq(struct wacom_wac *wacom, void *wcombo) | |||
434 | wacom_report_key(wcombo, BTN_5, (data[6] & 0x02)); | 434 | wacom_report_key(wcombo, BTN_5, (data[6] & 0x02)); |
435 | wacom_report_key(wcombo, BTN_6, (data[6] & 0x04)); | 435 | wacom_report_key(wcombo, BTN_6, (data[6] & 0x04)); |
436 | wacom_report_key(wcombo, BTN_7, (data[6] & 0x08)); | 436 | wacom_report_key(wcombo, BTN_7, (data[6] & 0x08)); |
437 | wacom_report_key(wcombo, BTN_8, (data[5] & 0x10)); | ||
438 | wacom_report_key(wcombo, BTN_9, (data[6] & 0x10)); | ||
437 | wacom_report_abs(wcombo, ABS_RX, ((data[1] & 0x1f) << 8) | data[2]); | 439 | wacom_report_abs(wcombo, ABS_RX, ((data[1] & 0x1f) << 8) | data[2]); |
438 | wacom_report_abs(wcombo, ABS_RY, ((data[3] & 0x1f) << 8) | data[4]); | 440 | wacom_report_abs(wcombo, ABS_RY, ((data[3] & 0x1f) << 8) | data[4]); |
439 | 441 | ||
440 | if((data[5] & 0x0f) | (data[6] & 0x0f) | (data[1] & 0x1f) | | 442 | if ((data[5] & 0x1f) | (data[6] & 0x1f) | (data[1] & 0x1f) | |
441 | data[2] | (data[3] & 0x1f) | data[4]) | 443 | data[2] | (data[3] & 0x1f) | data[4]) |
442 | wacom_report_key(wcombo, wacom->tool[1], 1); | 444 | wacom_report_key(wcombo, wacom->tool[1], 1); |
443 | else | 445 | else |
@@ -481,13 +483,11 @@ static int wacom_intuos_irq(struct wacom_wac *wacom, void *wcombo) | |||
481 | if (data[1] & 0x02) { | 483 | if (data[1] & 0x02) { |
482 | /* Rotation packet */ | 484 | /* Rotation packet */ |
483 | if (wacom->features->type >= INTUOS3S) { | 485 | if (wacom->features->type >= INTUOS3S) { |
484 | /* I3 marker pen rotation reported as wheel | 486 | /* I3 marker pen rotation */ |
485 | * due to valuator limitation | ||
486 | */ | ||
487 | t = (data[6] << 3) | ((data[7] >> 5) & 7); | 487 | t = (data[6] << 3) | ((data[7] >> 5) & 7); |
488 | t = (data[7] & 0x20) ? ((t > 900) ? ((t-1) / 2 - 1350) : | 488 | t = (data[7] & 0x20) ? ((t > 900) ? ((t-1) / 2 - 1350) : |
489 | ((t-1) / 2 + 450)) : (450 - t / 2) ; | 489 | ((t-1) / 2 + 450)) : (450 - t / 2) ; |
490 | wacom_report_abs(wcombo, ABS_WHEEL, t); | 490 | wacom_report_abs(wcombo, ABS_Z, t); |
491 | } else { | 491 | } else { |
492 | /* 4D mouse rotation packet */ | 492 | /* 4D mouse rotation packet */ |
493 | t = (data[6] << 3) | ((data[7] >> 5) & 7); | 493 | t = (data[6] << 3) | ((data[7] >> 5) & 7); |
@@ -558,6 +558,7 @@ int wacom_wac_irq(struct wacom_wac *wacom_wac, void *wcombo) | |||
558 | case INTUOS3: | 558 | case INTUOS3: |
559 | case INTUOS3L: | 559 | case INTUOS3L: |
560 | case CINTIQ: | 560 | case CINTIQ: |
561 | case WACOM_BEE: | ||
561 | return (wacom_intuos_irq(wacom_wac, wcombo)); | 562 | return (wacom_intuos_irq(wacom_wac, wcombo)); |
562 | break; | 563 | break; |
563 | default: | 564 | default: |
@@ -577,6 +578,8 @@ void wacom_init_input_dev(struct input_dev *input_dev, struct wacom_wac *wacom_w | |||
577 | case GRAPHIRE: | 578 | case GRAPHIRE: |
578 | input_dev_g(input_dev, wacom_wac); | 579 | input_dev_g(input_dev, wacom_wac); |
579 | break; | 580 | break; |
581 | case WACOM_BEE: | ||
582 | input_dev_bee(input_dev, wacom_wac); | ||
580 | case INTUOS3: | 583 | case INTUOS3: |
581 | case INTUOS3L: | 584 | case INTUOS3L: |
582 | case CINTIQ: | 585 | case CINTIQ: |
@@ -607,12 +610,15 @@ static struct wacom_features wacom_features[] = { | |||
607 | { "Wacom Graphire3 6x8", 8, 16704, 12064, 511, 63, GRAPHIRE }, | 610 | { "Wacom Graphire3 6x8", 8, 16704, 12064, 511, 63, GRAPHIRE }, |
608 | { "Wacom Graphire4 4x5", 8, 10208, 7424, 511, 63, WACOM_G4 }, | 611 | { "Wacom Graphire4 4x5", 8, 10208, 7424, 511, 63, WACOM_G4 }, |
609 | { "Wacom Graphire4 6x8", 8, 16704, 12064, 511, 63, WACOM_G4 }, | 612 | { "Wacom Graphire4 6x8", 8, 16704, 12064, 511, 63, WACOM_G4 }, |
613 | { "Wacom BambooFun 4x5", 9, 14760, 9225, 511, 63, WACOM_MO }, | ||
614 | { "Wacom BambooFun 6x8", 9, 21648, 13530, 511, 63, WACOM_MO }, | ||
610 | { "Wacom Volito", 8, 5104, 3712, 511, 63, GRAPHIRE }, | 615 | { "Wacom Volito", 8, 5104, 3712, 511, 63, GRAPHIRE }, |
611 | { "Wacom PenStation2", 8, 3250, 2320, 255, 63, GRAPHIRE }, | 616 | { "Wacom PenStation2", 8, 3250, 2320, 255, 63, GRAPHIRE }, |
612 | { "Wacom Volito2 4x5", 8, 5104, 3712, 511, 63, GRAPHIRE }, | 617 | { "Wacom Volito2 4x5", 8, 5104, 3712, 511, 63, GRAPHIRE }, |
613 | { "Wacom Volito2 2x3", 8, 3248, 2320, 511, 63, GRAPHIRE }, | 618 | { "Wacom Volito2 2x3", 8, 3248, 2320, 511, 63, GRAPHIRE }, |
614 | { "Wacom PenPartner2", 8, 3250, 2320, 255, 63, GRAPHIRE }, | 619 | { "Wacom PenPartner2", 8, 3250, 2320, 511, 63, GRAPHIRE }, |
615 | { "Wacom Bamboo", 9, 14760, 9225, 511, 63, WACOM_MO }, | 620 | { "Wacom Bamboo", 9, 14760, 9225, 511, 63, WACOM_MO }, |
621 | { "Wacom Bamboo1", 8, 5104, 3712, 511, 63, GRAPHIRE }, | ||
616 | { "Wacom Intuos 4x5", 10, 12700, 10600, 1023, 31, INTUOS }, | 622 | { "Wacom Intuos 4x5", 10, 12700, 10600, 1023, 31, INTUOS }, |
617 | { "Wacom Intuos 6x8", 10, 20320, 16240, 1023, 31, INTUOS }, | 623 | { "Wacom Intuos 6x8", 10, 20320, 16240, 1023, 31, INTUOS }, |
618 | { "Wacom Intuos 9x12", 10, 30480, 24060, 1023, 31, INTUOS }, | 624 | { "Wacom Intuos 9x12", 10, 30480, 24060, 1023, 31, INTUOS }, |
@@ -643,6 +649,7 @@ static struct wacom_features wacom_features[] = { | |||
643 | { "Wacom Intuos3 6x11", 10, 54204, 31750, 1023, 63, INTUOS3 }, | 649 | { "Wacom Intuos3 6x11", 10, 54204, 31750, 1023, 63, INTUOS3 }, |
644 | { "Wacom Intuos3 4x6", 10, 31496, 19685, 1023, 63, INTUOS3S }, | 650 | { "Wacom Intuos3 4x6", 10, 31496, 19685, 1023, 63, INTUOS3S }, |
645 | { "Wacom Cintiq 21UX", 10, 87200, 65600, 1023, 63, CINTIQ }, | 651 | { "Wacom Cintiq 21UX", 10, 87200, 65600, 1023, 63, CINTIQ }, |
652 | { "Wacom Cintiq 12WX", 10, 53020, 33440, 1023, 63, WACOM_BEE }, | ||
646 | { "Wacom Intuos2 6x8", 10, 20320, 16240, 1023, 31, INTUOS }, | 653 | { "Wacom Intuos2 6x8", 10, 20320, 16240, 1023, 31, INTUOS }, |
647 | { } | 654 | { } |
648 | }; | 655 | }; |
@@ -656,12 +663,15 @@ static struct usb_device_id wacom_ids[] = { | |||
656 | { USB_DEVICE(USB_VENDOR_ID_WACOM, 0x14) }, | 663 | { USB_DEVICE(USB_VENDOR_ID_WACOM, 0x14) }, |
657 | { USB_DEVICE(USB_VENDOR_ID_WACOM, 0x15) }, | 664 | { USB_DEVICE(USB_VENDOR_ID_WACOM, 0x15) }, |
658 | { USB_DEVICE(USB_VENDOR_ID_WACOM, 0x16) }, | 665 | { USB_DEVICE(USB_VENDOR_ID_WACOM, 0x16) }, |
666 | { USB_DEVICE(USB_VENDOR_ID_WACOM, 0x17) }, | ||
667 | { USB_DEVICE(USB_VENDOR_ID_WACOM, 0x18) }, | ||
659 | { USB_DEVICE(USB_VENDOR_ID_WACOM, 0x60) }, | 668 | { USB_DEVICE(USB_VENDOR_ID_WACOM, 0x60) }, |
660 | { USB_DEVICE(USB_VENDOR_ID_WACOM, 0x61) }, | 669 | { USB_DEVICE(USB_VENDOR_ID_WACOM, 0x61) }, |
661 | { USB_DEVICE(USB_VENDOR_ID_WACOM, 0x62) }, | 670 | { USB_DEVICE(USB_VENDOR_ID_WACOM, 0x62) }, |
662 | { USB_DEVICE(USB_VENDOR_ID_WACOM, 0x63) }, | 671 | { USB_DEVICE(USB_VENDOR_ID_WACOM, 0x63) }, |
663 | { USB_DEVICE(USB_VENDOR_ID_WACOM, 0x64) }, | 672 | { USB_DEVICE(USB_VENDOR_ID_WACOM, 0x64) }, |
664 | { USB_DEVICE(USB_VENDOR_ID_WACOM, 0x65) }, | 673 | { USB_DEVICE(USB_VENDOR_ID_WACOM, 0x65) }, |
674 | { USB_DEVICE(USB_VENDOR_ID_WACOM, 0x69) }, | ||
665 | { USB_DEVICE(USB_VENDOR_ID_WACOM, 0x20) }, | 675 | { USB_DEVICE(USB_VENDOR_ID_WACOM, 0x20) }, |
666 | { USB_DEVICE(USB_VENDOR_ID_WACOM, 0x21) }, | 676 | { USB_DEVICE(USB_VENDOR_ID_WACOM, 0x21) }, |
667 | { USB_DEVICE(USB_VENDOR_ID_WACOM, 0x22) }, | 677 | { USB_DEVICE(USB_VENDOR_ID_WACOM, 0x22) }, |
@@ -692,6 +702,7 @@ static struct usb_device_id wacom_ids[] = { | |||
692 | { USB_DEVICE(USB_VENDOR_ID_WACOM, 0xB5) }, | 702 | { USB_DEVICE(USB_VENDOR_ID_WACOM, 0xB5) }, |
693 | { USB_DEVICE(USB_VENDOR_ID_WACOM, 0xB7) }, | 703 | { USB_DEVICE(USB_VENDOR_ID_WACOM, 0xB7) }, |
694 | { USB_DEVICE(USB_VENDOR_ID_WACOM, 0x3F) }, | 704 | { USB_DEVICE(USB_VENDOR_ID_WACOM, 0x3F) }, |
705 | { USB_DEVICE(USB_VENDOR_ID_WACOM, 0xC6) }, | ||
695 | { USB_DEVICE(USB_VENDOR_ID_WACOM, 0x47) }, | 706 | { USB_DEVICE(USB_VENDOR_ID_WACOM, 0x47) }, |
696 | { } | 707 | { } |
697 | }; | 708 | }; |
diff --git a/drivers/input/tablet/wacom_wac.h b/drivers/input/tablet/wacom_wac.h index a302e229bb8a..3342bc05847d 100644 --- a/drivers/input/tablet/wacom_wac.h +++ b/drivers/input/tablet/wacom_wac.h | |||
@@ -25,6 +25,7 @@ enum { | |||
25 | INTUOS3, | 25 | INTUOS3, |
26 | INTUOS3L, | 26 | INTUOS3L, |
27 | CINTIQ, | 27 | CINTIQ, |
28 | WACOM_BEE, | ||
28 | WACOM_MO, | 29 | WACOM_MO, |
29 | MAX_TYPE | 30 | MAX_TYPE |
30 | }; | 31 | }; |
diff --git a/drivers/input/touchscreen/ads7846.c b/drivers/input/touchscreen/ads7846.c index 58934a40f5ce..57a1c28bf122 100644 --- a/drivers/input/touchscreen/ads7846.c +++ b/drivers/input/touchscreen/ads7846.c | |||
@@ -213,7 +213,7 @@ static int ads7846_read12_ser(struct device *dev, unsigned command) | |||
213 | struct ads7846 *ts = dev_get_drvdata(dev); | 213 | struct ads7846 *ts = dev_get_drvdata(dev); |
214 | struct ser_req *req = kzalloc(sizeof *req, GFP_KERNEL); | 214 | struct ser_req *req = kzalloc(sizeof *req, GFP_KERNEL); |
215 | int status; | 215 | int status; |
216 | int sample; | 216 | int uninitialized_var(sample); |
217 | int use_internal; | 217 | int use_internal; |
218 | 218 | ||
219 | if (!req) | 219 | if (!req) |
diff --git a/drivers/md/md.c b/drivers/md/md.c index ccbbf63727cc..61ccbd2683fa 100644 --- a/drivers/md/md.c +++ b/drivers/md/md.c | |||
@@ -1864,17 +1864,6 @@ static struct rdev_sysfs_entry rdev_state = | |||
1864 | __ATTR(state, S_IRUGO|S_IWUSR, state_show, state_store); | 1864 | __ATTR(state, S_IRUGO|S_IWUSR, state_show, state_store); |
1865 | 1865 | ||
1866 | static ssize_t | 1866 | static ssize_t |
1867 | super_show(mdk_rdev_t *rdev, char *page) | ||
1868 | { | ||
1869 | if (rdev->sb_loaded && rdev->sb_size) { | ||
1870 | memcpy(page, page_address(rdev->sb_page), rdev->sb_size); | ||
1871 | return rdev->sb_size; | ||
1872 | } else | ||
1873 | return 0; | ||
1874 | } | ||
1875 | static struct rdev_sysfs_entry rdev_super = __ATTR_RO(super); | ||
1876 | |||
1877 | static ssize_t | ||
1878 | errors_show(mdk_rdev_t *rdev, char *page) | 1867 | errors_show(mdk_rdev_t *rdev, char *page) |
1879 | { | 1868 | { |
1880 | return sprintf(page, "%d\n", atomic_read(&rdev->corrected_errors)); | 1869 | return sprintf(page, "%d\n", atomic_read(&rdev->corrected_errors)); |
@@ -2060,7 +2049,6 @@ __ATTR(size, S_IRUGO|S_IWUSR, rdev_size_show, rdev_size_store); | |||
2060 | 2049 | ||
2061 | static struct attribute *rdev_default_attrs[] = { | 2050 | static struct attribute *rdev_default_attrs[] = { |
2062 | &rdev_state.attr, | 2051 | &rdev_state.attr, |
2063 | &rdev_super.attr, | ||
2064 | &rdev_errors.attr, | 2052 | &rdev_errors.attr, |
2065 | &rdev_slot.attr, | 2053 | &rdev_slot.attr, |
2066 | &rdev_offset.attr, | 2054 | &rdev_offset.attr, |
diff --git a/drivers/md/raid5.c b/drivers/md/raid5.c index 2d6f1a51359c..c574cf5efb5c 100644 --- a/drivers/md/raid5.c +++ b/drivers/md/raid5.c | |||
@@ -1143,7 +1143,7 @@ static void raid5_end_read_request(struct bio * bi, int error) | |||
1143 | rdev = conf->disks[i].rdev; | 1143 | rdev = conf->disks[i].rdev; |
1144 | printk(KERN_INFO "raid5:%s: read error corrected (%lu sectors at %llu on %s)\n", | 1144 | printk(KERN_INFO "raid5:%s: read error corrected (%lu sectors at %llu on %s)\n", |
1145 | mdname(conf->mddev), STRIPE_SECTORS, | 1145 | mdname(conf->mddev), STRIPE_SECTORS, |
1146 | (unsigned long long)sh->sector + rdev->data_offset, | 1146 | (unsigned long long)(sh->sector + rdev->data_offset), |
1147 | bdevname(rdev->bdev, b)); | 1147 | bdevname(rdev->bdev, b)); |
1148 | clear_bit(R5_ReadError, &sh->dev[i].flags); | 1148 | clear_bit(R5_ReadError, &sh->dev[i].flags); |
1149 | clear_bit(R5_ReWrite, &sh->dev[i].flags); | 1149 | clear_bit(R5_ReWrite, &sh->dev[i].flags); |
@@ -1160,13 +1160,13 @@ static void raid5_end_read_request(struct bio * bi, int error) | |||
1160 | if (conf->mddev->degraded) | 1160 | if (conf->mddev->degraded) |
1161 | printk(KERN_WARNING "raid5:%s: read error not correctable (sector %llu on %s).\n", | 1161 | printk(KERN_WARNING "raid5:%s: read error not correctable (sector %llu on %s).\n", |
1162 | mdname(conf->mddev), | 1162 | mdname(conf->mddev), |
1163 | (unsigned long long)sh->sector + rdev->data_offset, | 1163 | (unsigned long long)(sh->sector + rdev->data_offset), |
1164 | bdn); | 1164 | bdn); |
1165 | else if (test_bit(R5_ReWrite, &sh->dev[i].flags)) | 1165 | else if (test_bit(R5_ReWrite, &sh->dev[i].flags)) |
1166 | /* Oh, no!!! */ | 1166 | /* Oh, no!!! */ |
1167 | printk(KERN_WARNING "raid5:%s: read error NOT corrected!! (sector %llu on %s).\n", | 1167 | printk(KERN_WARNING "raid5:%s: read error NOT corrected!! (sector %llu on %s).\n", |
1168 | mdname(conf->mddev), | 1168 | mdname(conf->mddev), |
1169 | (unsigned long long)sh->sector + rdev->data_offset, | 1169 | (unsigned long long)(sh->sector + rdev->data_offset), |
1170 | bdn); | 1170 | bdn); |
1171 | else if (atomic_read(&rdev->read_errors) | 1171 | else if (atomic_read(&rdev->read_errors) |
1172 | > conf->max_nr_stripes) | 1172 | > conf->max_nr_stripes) |
diff --git a/drivers/media/dvb/dvb-usb/opera1.c b/drivers/media/dvb/dvb-usb/opera1.c index 21935bf7059e..302cc67407c3 100644 --- a/drivers/media/dvb/dvb-usb/opera1.c +++ b/drivers/media/dvb/dvb-usb/opera1.c | |||
@@ -478,9 +478,9 @@ static int opera1_xilinx_load_firmware(struct usb_device *dev, | |||
478 | err("could not restart the USB controller CPU."); | 478 | err("could not restart the USB controller CPU."); |
479 | ret = -EINVAL; | 479 | ret = -EINVAL; |
480 | } | 480 | } |
481 | kfree(p); | ||
482 | } | 481 | } |
483 | } | 482 | } |
483 | kfree(p); | ||
484 | if (fw) { | 484 | if (fw) { |
485 | release_firmware(fw); | 485 | release_firmware(fw); |
486 | } | 486 | } |
diff --git a/drivers/media/video/Kconfig b/drivers/media/video/Kconfig index 37072a21d8c9..1832966f53f3 100644 --- a/drivers/media/video/Kconfig +++ b/drivers/media/video/Kconfig | |||
@@ -305,7 +305,7 @@ comment "MPEG video encoders" | |||
305 | 305 | ||
306 | config VIDEO_CX2341X | 306 | config VIDEO_CX2341X |
307 | tristate "Conexant CX2341x MPEG encoders" | 307 | tristate "Conexant CX2341x MPEG encoders" |
308 | depends on VIDEO_V4L2 && EXPERIMENTAL | 308 | depends on VIDEO_V4L2 && EXPERIMENTAL && VIDEO_V4L2_COMMON |
309 | ---help--- | 309 | ---help--- |
310 | Support for the Conexant CX23416 MPEG encoders | 310 | Support for the Conexant CX23416 MPEG encoders |
311 | and CX23415 MPEG encoder/decoders. | 311 | and CX23415 MPEG encoder/decoders. |
@@ -382,7 +382,7 @@ endmenu # encoder / decoder chips | |||
382 | 382 | ||
383 | config VIDEO_VIVI | 383 | config VIDEO_VIVI |
384 | tristate "Virtual Video Driver" | 384 | tristate "Virtual Video Driver" |
385 | depends on VIDEO_V4L2 && !SPARC32 && !SPARC64 | 385 | depends on VIDEO_DEV && VIDEO_V4L2 && !SPARC32 && !SPARC64 |
386 | select VIDEOBUF_VMALLOC | 386 | select VIDEOBUF_VMALLOC |
387 | default n | 387 | default n |
388 | ---help--- | 388 | ---help--- |
diff --git a/drivers/media/video/bt8xx/bttv-driver.c b/drivers/media/video/bt8xx/bttv-driver.c index 5404fcc5276d..a080c149cc6c 100644 --- a/drivers/media/video/bt8xx/bttv-driver.c +++ b/drivers/media/video/bt8xx/bttv-driver.c | |||
@@ -3389,7 +3389,6 @@ static struct video_device bttv_video_template = | |||
3389 | .vidiocgmbuf = vidiocgmbuf, | 3389 | .vidiocgmbuf = vidiocgmbuf, |
3390 | #endif | 3390 | #endif |
3391 | .vidioc_g_crop = bttv_g_crop, | 3391 | .vidioc_g_crop = bttv_g_crop, |
3392 | .vidioc_g_crop = bttv_g_crop, | ||
3393 | .vidioc_s_crop = bttv_s_crop, | 3392 | .vidioc_s_crop = bttv_s_crop, |
3394 | .vidioc_g_fbuf = bttv_g_fbuf, | 3393 | .vidioc_g_fbuf = bttv_g_fbuf, |
3395 | .vidioc_s_fbuf = bttv_s_fbuf, | 3394 | .vidioc_s_fbuf = bttv_s_fbuf, |
diff --git a/drivers/media/video/cx88/cx88-cards.c b/drivers/media/video/cx88/cx88-cards.c index e6b7f518c56e..8c9a8adf52de 100644 --- a/drivers/media/video/cx88/cx88-cards.c +++ b/drivers/media/video/cx88/cx88-cards.c | |||
@@ -2196,6 +2196,11 @@ struct cx88_core *cx88_core_create(struct pci_dev *pci, int nr) | |||
2196 | cx88_reset(core); | 2196 | cx88_reset(core); |
2197 | cx88_card_setup_pre_i2c(core); | 2197 | cx88_card_setup_pre_i2c(core); |
2198 | cx88_i2c_init(core, pci); | 2198 | cx88_i2c_init(core, pci); |
2199 | |||
2200 | /* load tuner module, if needed */ | ||
2201 | if (TUNER_ABSENT != core->board.tuner_type) | ||
2202 | request_module("tuner"); | ||
2203 | |||
2199 | cx88_call_i2c_clients (core, TUNER_SET_STANDBY, NULL); | 2204 | cx88_call_i2c_clients (core, TUNER_SET_STANDBY, NULL); |
2200 | cx88_card_setup(core); | 2205 | cx88_card_setup(core); |
2201 | cx88_ir_init(core, pci); | 2206 | cx88_ir_init(core, pci); |
diff --git a/drivers/media/video/cx88/cx88-video.c b/drivers/media/video/cx88/cx88-video.c index 7f1931aed207..227179620d13 100644 --- a/drivers/media/video/cx88/cx88-video.c +++ b/drivers/media/video/cx88/cx88-video.c | |||
@@ -1826,8 +1826,6 @@ static int __devinit cx8800_initdev(struct pci_dev *pci_dev, | |||
1826 | cx_set(MO_PCI_INTMSK, core->pci_irqmask); | 1826 | cx_set(MO_PCI_INTMSK, core->pci_irqmask); |
1827 | 1827 | ||
1828 | /* load and configure helper modules */ | 1828 | /* load and configure helper modules */ |
1829 | if (TUNER_ABSENT != core->board.tuner_type) | ||
1830 | request_module("tuner"); | ||
1831 | 1829 | ||
1832 | if (core->board.audio_chip == AUDIO_CHIP_WM8775) | 1830 | if (core->board.audio_chip == AUDIO_CHIP_WM8775) |
1833 | request_module("wm8775"); | 1831 | request_module("wm8775"); |
diff --git a/drivers/media/video/em28xx/em28xx-core.c b/drivers/media/video/em28xx/em28xx-core.c index 7d1537cab867..c1caaa855b99 100644 --- a/drivers/media/video/em28xx/em28xx-core.c +++ b/drivers/media/video/em28xx/em28xx-core.c | |||
@@ -267,7 +267,7 @@ static int em28xx_write_ac97(struct em28xx *dev, u8 reg, u8 *val) | |||
267 | for (i = 0; i < 10; i++) { | 267 | for (i = 0; i < 10; i++) { |
268 | if ((ret = em28xx_read_reg(dev, AC97BUSY_REG)) < 0) | 268 | if ((ret = em28xx_read_reg(dev, AC97BUSY_REG)) < 0) |
269 | return ret; | 269 | return ret; |
270 | if (!((u8) ret) & 0x01) | 270 | if (!(ret & 0x01)) |
271 | return 0; | 271 | return 0; |
272 | msleep(5); | 272 | msleep(5); |
273 | } | 273 | } |
diff --git a/drivers/media/video/ivtv/ivtv-driver.c b/drivers/media/video/ivtv/ivtv-driver.c index d42f120354e5..948ca35e7ee8 100644 --- a/drivers/media/video/ivtv/ivtv-driver.c +++ b/drivers/media/video/ivtv/ivtv-driver.c | |||
@@ -54,7 +54,6 @@ | |||
54 | #include "ivtv-vbi.h" | 54 | #include "ivtv-vbi.h" |
55 | #include "ivtv-routing.h" | 55 | #include "ivtv-routing.h" |
56 | #include "ivtv-gpio.h" | 56 | #include "ivtv-gpio.h" |
57 | #include "ivtv-yuv.h" | ||
58 | 57 | ||
59 | #include <media/tveeprom.h> | 58 | #include <media/tveeprom.h> |
60 | #include <media/saa7115.h> | 59 | #include <media/saa7115.h> |
@@ -700,6 +699,9 @@ static int __devinit ivtv_init_struct1(struct ivtv *itv) | |||
700 | itv->vbi.in.type = V4L2_BUF_TYPE_SLICED_VBI_CAPTURE; | 699 | itv->vbi.in.type = V4L2_BUF_TYPE_SLICED_VBI_CAPTURE; |
701 | itv->vbi.sliced_in = &itv->vbi.in.fmt.sliced; | 700 | itv->vbi.sliced_in = &itv->vbi.in.fmt.sliced; |
702 | 701 | ||
702 | /* Init the sg table for osd/yuv output */ | ||
703 | sg_init_table(itv->udma.SGlist, IVTV_DMA_SG_OSD_ENT); | ||
704 | |||
703 | /* OSD */ | 705 | /* OSD */ |
704 | itv->osd_global_alpha_state = 1; | 706 | itv->osd_global_alpha_state = 1; |
705 | itv->osd_global_alpha = 255; | 707 | itv->osd_global_alpha = 255; |
@@ -1053,9 +1055,6 @@ static int __devinit ivtv_probe(struct pci_dev *dev, | |||
1053 | goto free_io; | 1055 | goto free_io; |
1054 | } | 1056 | } |
1055 | 1057 | ||
1056 | /* Check yuv output filter table */ | ||
1057 | if (itv->has_cx23415) ivtv_yuv_filter_check(itv); | ||
1058 | |||
1059 | ivtv_gpio_init(itv); | 1058 | ivtv_gpio_init(itv); |
1060 | 1059 | ||
1061 | /* active i2c */ | 1060 | /* active i2c */ |
diff --git a/drivers/media/video/ivtv/ivtv-firmware.c b/drivers/media/video/ivtv/ivtv-firmware.c index 425eb1063904..6dba55b7e25a 100644 --- a/drivers/media/video/ivtv/ivtv-firmware.c +++ b/drivers/media/video/ivtv/ivtv-firmware.c | |||
@@ -22,6 +22,7 @@ | |||
22 | #include "ivtv-driver.h" | 22 | #include "ivtv-driver.h" |
23 | #include "ivtv-mailbox.h" | 23 | #include "ivtv-mailbox.h" |
24 | #include "ivtv-firmware.h" | 24 | #include "ivtv-firmware.h" |
25 | #include "ivtv-yuv.h" | ||
25 | #include <linux/firmware.h> | 26 | #include <linux/firmware.h> |
26 | 27 | ||
27 | #define IVTV_MASK_SPU_ENABLE 0xFFFFFFFE | 28 | #define IVTV_MASK_SPU_ENABLE 0xFFFFFFFE |
@@ -225,11 +226,14 @@ int ivtv_firmware_init(struct ivtv *itv) | |||
225 | return 0; | 226 | return 0; |
226 | 227 | ||
227 | itv->dec_mbox.mbox = ivtv_search_mailbox(itv->dec_mem, IVTV_DECODER_SIZE); | 228 | itv->dec_mbox.mbox = ivtv_search_mailbox(itv->dec_mem, IVTV_DECODER_SIZE); |
228 | if (itv->dec_mbox.mbox == NULL) | 229 | if (itv->dec_mbox.mbox == NULL) { |
229 | IVTV_ERR("Decoder mailbox not found\n"); | 230 | IVTV_ERR("Decoder mailbox not found\n"); |
230 | else if (itv->has_cx23415 && ivtv_vapi(itv, CX2341X_DEC_PING_FW, 0)) { | 231 | } else if (itv->has_cx23415 && ivtv_vapi(itv, CX2341X_DEC_PING_FW, 0)) { |
231 | IVTV_ERR("Decoder firmware dead!\n"); | 232 | IVTV_ERR("Decoder firmware dead!\n"); |
232 | itv->dec_mbox.mbox = NULL; | 233 | itv->dec_mbox.mbox = NULL; |
234 | } else { | ||
235 | /* Firmware okay, so check yuv output filter table */ | ||
236 | ivtv_yuv_filter_check(itv); | ||
233 | } | 237 | } |
234 | return itv->dec_mbox.mbox ? 0 : -ENODEV; | 238 | return itv->dec_mbox.mbox ? 0 : -ENODEV; |
235 | } | 239 | } |
diff --git a/drivers/media/video/saa7134/saa7134-cards.c b/drivers/media/video/saa7134/saa7134-cards.c index 262830da08c8..6f5744286e8c 100644 --- a/drivers/media/video/saa7134/saa7134-cards.c +++ b/drivers/media/video/saa7134/saa7134-cards.c | |||
@@ -2484,27 +2484,28 @@ struct saa7134_board saa7134_boards[] = { | |||
2484 | .tuner_addr = ADDR_UNSET, | 2484 | .tuner_addr = ADDR_UNSET, |
2485 | .radio_addr = ADDR_UNSET, | 2485 | .radio_addr = ADDR_UNSET, |
2486 | .gpiomask = 0x080200000, | 2486 | .gpiomask = 0x080200000, |
2487 | .inputs = {{ | 2487 | .inputs = { { |
2488 | .name = name_tv, | 2488 | .name = name_tv, |
2489 | .vmux = 4, | 2489 | .vmux = 4, |
2490 | .amux = TV, | 2490 | .amux = TV, |
2491 | .tv = 1, | 2491 | .tv = 1, |
2492 | },{ | 2492 | }, { |
2493 | .name = name_comp1, | 2493 | .name = name_comp1, |
2494 | .vmux = 1, | 2494 | .vmux = 1, |
2495 | .amux = LINE2, | 2495 | .amux = LINE2, |
2496 | },{ | 2496 | }, { |
2497 | .name = name_comp2, | 2497 | .name = name_comp2, |
2498 | .vmux = 0, | 2498 | .vmux = 0, |
2499 | .amux = LINE2, | 2499 | .amux = LINE2, |
2500 | },{ | 2500 | }, { |
2501 | .name = name_svideo, | 2501 | .name = name_svideo, |
2502 | .vmux = 8, | 2502 | .vmux = 8, |
2503 | .amux = LINE2, | 2503 | .amux = LINE2, |
2504 | }}, | 2504 | } }, |
2505 | .radio = { | 2505 | .radio = { |
2506 | .name = name_radio, | 2506 | .name = name_radio, |
2507 | .amux = LINE1, | 2507 | .amux = TV, |
2508 | .gpio = 0x0200000, | ||
2508 | }, | 2509 | }, |
2509 | }, | 2510 | }, |
2510 | [SAA7134_BOARD_ASUSTeK_P7131_DUAL] = { | 2511 | [SAA7134_BOARD_ASUSTeK_P7131_DUAL] = { |
diff --git a/drivers/media/video/saa7134/saa7134-core.c b/drivers/media/video/saa7134/saa7134-core.c index 52baa4f7f7dd..58ab163fdbd7 100644 --- a/drivers/media/video/saa7134/saa7134-core.c +++ b/drivers/media/video/saa7134/saa7134-core.c | |||
@@ -1022,12 +1022,13 @@ static int __devinit saa7134_initdev(struct pci_dev *pci_dev, | |||
1022 | saa7134_i2c_register(dev); | 1022 | saa7134_i2c_register(dev); |
1023 | 1023 | ||
1024 | /* initialize hardware #2 */ | 1024 | /* initialize hardware #2 */ |
1025 | if (TUNER_ABSENT != dev->tuner_type) | ||
1026 | request_module("tuner"); | ||
1025 | saa7134_board_init2(dev); | 1027 | saa7134_board_init2(dev); |
1028 | |||
1026 | saa7134_hwinit2(dev); | 1029 | saa7134_hwinit2(dev); |
1027 | 1030 | ||
1028 | /* load i2c helpers */ | 1031 | /* load i2c helpers */ |
1029 | if (TUNER_ABSENT != dev->tuner_type) | ||
1030 | request_module("tuner"); | ||
1031 | if (card_is_empress(dev)) { | 1032 | if (card_is_empress(dev)) { |
1032 | request_module("saa6752hs"); | 1033 | request_module("saa6752hs"); |
1033 | } | 1034 | } |
diff --git a/drivers/media/video/tvp5150.c b/drivers/media/video/tvp5150.c index 445eba4174d7..d28318cb2b8d 100644 --- a/drivers/media/video/tvp5150.c +++ b/drivers/media/video/tvp5150.c | |||
@@ -672,7 +672,7 @@ static int tvp5150_set_vbi(struct i2c_client *c, | |||
672 | if (std == V4L2_STD_ALL) { | 672 | if (std == V4L2_STD_ALL) { |
673 | tvp5150_err("VBI can't be configured without knowing number of lines\n"); | 673 | tvp5150_err("VBI can't be configured without knowing number of lines\n"); |
674 | return 0; | 674 | return 0; |
675 | } else if (std && V4L2_STD_625_50) { | 675 | } else if (std & V4L2_STD_625_50) { |
676 | /* Don't follow NTSC Line number convension */ | 676 | /* Don't follow NTSC Line number convension */ |
677 | line += 3; | 677 | line += 3; |
678 | } | 678 | } |
@@ -719,7 +719,7 @@ static int tvp5150_get_vbi(struct i2c_client *c, | |||
719 | if (std == V4L2_STD_ALL) { | 719 | if (std == V4L2_STD_ALL) { |
720 | tvp5150_err("VBI can't be configured without knowing number of lines\n"); | 720 | tvp5150_err("VBI can't be configured without knowing number of lines\n"); |
721 | return 0; | 721 | return 0; |
722 | } else if (std && V4L2_STD_625_50) { | 722 | } else if (std & V4L2_STD_625_50) { |
723 | /* Don't follow NTSC Line number convension */ | 723 | /* Don't follow NTSC Line number convension */ |
724 | line += 3; | 724 | line += 3; |
725 | } | 725 | } |
diff --git a/drivers/media/video/usbvideo/usbvideo.c b/drivers/media/video/usbvideo/usbvideo.c index fb434b5602a3..5d363be7bc73 100644 --- a/drivers/media/video/usbvideo/usbvideo.c +++ b/drivers/media/video/usbvideo/usbvideo.c | |||
@@ -1034,6 +1034,11 @@ int usbvideo_RegisterVideoDevice(struct uvd *uvd) | |||
1034 | info("%s: iface=%d. endpoint=$%02x paletteBits=$%08lx", | 1034 | info("%s: iface=%d. endpoint=$%02x paletteBits=$%08lx", |
1035 | __FUNCTION__, uvd->iface, uvd->video_endp, uvd->paletteBits); | 1035 | __FUNCTION__, uvd->iface, uvd->video_endp, uvd->paletteBits); |
1036 | } | 1036 | } |
1037 | if (uvd->dev == NULL) { | ||
1038 | err("%s: uvd->dev == NULL", __FUNCTION__); | ||
1039 | return -EINVAL; | ||
1040 | } | ||
1041 | uvd->vdev.dev=&(uvd->dev->dev); | ||
1037 | if (video_register_device(&uvd->vdev, VFL_TYPE_GRABBER, video_nr) == -1) { | 1042 | if (video_register_device(&uvd->vdev, VFL_TYPE_GRABBER, video_nr) == -1) { |
1038 | err("%s: video_register_device failed", __FUNCTION__); | 1043 | err("%s: video_register_device failed", __FUNCTION__); |
1039 | return -EPIPE; | 1044 | return -EPIPE; |
@@ -1041,10 +1046,6 @@ int usbvideo_RegisterVideoDevice(struct uvd *uvd) | |||
1041 | if (uvd->debug > 1) { | 1046 | if (uvd->debug > 1) { |
1042 | info("%s: video_register_device() successful", __FUNCTION__); | 1047 | info("%s: video_register_device() successful", __FUNCTION__); |
1043 | } | 1048 | } |
1044 | if (uvd->dev == NULL) { | ||
1045 | err("%s: uvd->dev == NULL", __FUNCTION__); | ||
1046 | return -EINVAL; | ||
1047 | } | ||
1048 | 1049 | ||
1049 | info("%s on /dev/video%d: canvas=%s videosize=%s", | 1050 | info("%s on /dev/video%d: canvas=%s videosize=%s", |
1050 | (uvd->handle != NULL) ? uvd->handle->drvName : "???", | 1051 | (uvd->handle != NULL) ? uvd->handle->drvName : "???", |
diff --git a/drivers/media/video/v4l1-compat.c b/drivers/media/video/v4l1-compat.c index dcf22a3b672a..50e1ff9f2be5 100644 --- a/drivers/media/video/v4l1-compat.c +++ b/drivers/media/video/v4l1-compat.c | |||
@@ -303,7 +303,11 @@ v4l_compat_translate_ioctl(struct inode *inode, | |||
303 | { | 303 | { |
304 | struct video_capability *cap = arg; | 304 | struct video_capability *cap = arg; |
305 | 305 | ||
306 | cap2 = kzalloc(sizeof(*cap2),GFP_KERNEL); | 306 | cap2 = kzalloc(sizeof(*cap2), GFP_KERNEL); |
307 | if (!cap2) { | ||
308 | err = -ENOMEM; | ||
309 | break; | ||
310 | } | ||
307 | memset(cap, 0, sizeof(*cap)); | 311 | memset(cap, 0, sizeof(*cap)); |
308 | memset(&fbuf2, 0, sizeof(fbuf2)); | 312 | memset(&fbuf2, 0, sizeof(fbuf2)); |
309 | 313 | ||
@@ -426,7 +430,11 @@ v4l_compat_translate_ioctl(struct inode *inode, | |||
426 | { | 430 | { |
427 | struct video_window *win = arg; | 431 | struct video_window *win = arg; |
428 | 432 | ||
429 | fmt2 = kzalloc(sizeof(*fmt2),GFP_KERNEL); | 433 | fmt2 = kzalloc(sizeof(*fmt2), GFP_KERNEL); |
434 | if (!fmt2) { | ||
435 | err = -ENOMEM; | ||
436 | break; | ||
437 | } | ||
430 | memset(win,0,sizeof(*win)); | 438 | memset(win,0,sizeof(*win)); |
431 | 439 | ||
432 | fmt2->type = V4L2_BUF_TYPE_VIDEO_OVERLAY; | 440 | fmt2->type = V4L2_BUF_TYPE_VIDEO_OVERLAY; |
@@ -464,7 +472,11 @@ v4l_compat_translate_ioctl(struct inode *inode, | |||
464 | struct video_window *win = arg; | 472 | struct video_window *win = arg; |
465 | int err1,err2; | 473 | int err1,err2; |
466 | 474 | ||
467 | fmt2 = kzalloc(sizeof(*fmt2),GFP_KERNEL); | 475 | fmt2 = kzalloc(sizeof(*fmt2), GFP_KERNEL); |
476 | if (!fmt2) { | ||
477 | err = -ENOMEM; | ||
478 | break; | ||
479 | } | ||
468 | fmt2->type = V4L2_BUF_TYPE_VIDEO_CAPTURE; | 480 | fmt2->type = V4L2_BUF_TYPE_VIDEO_CAPTURE; |
469 | drv(inode, file, VIDIOC_STREAMOFF, &fmt2->type); | 481 | drv(inode, file, VIDIOC_STREAMOFF, &fmt2->type); |
470 | err1 = drv(inode, file, VIDIOC_G_FMT, fmt2); | 482 | err1 = drv(inode, file, VIDIOC_G_FMT, fmt2); |
@@ -586,6 +598,12 @@ v4l_compat_translate_ioctl(struct inode *inode, | |||
586 | { | 598 | { |
587 | struct video_picture *pict = arg; | 599 | struct video_picture *pict = arg; |
588 | 600 | ||
601 | fmt2 = kzalloc(sizeof(*fmt2), GFP_KERNEL); | ||
602 | if (!fmt2) { | ||
603 | err = -ENOMEM; | ||
604 | break; | ||
605 | } | ||
606 | |||
589 | pict->brightness = get_v4l_control(inode, file, | 607 | pict->brightness = get_v4l_control(inode, file, |
590 | V4L2_CID_BRIGHTNESS,drv); | 608 | V4L2_CID_BRIGHTNESS,drv); |
591 | pict->hue = get_v4l_control(inode, file, | 609 | pict->hue = get_v4l_control(inode, file, |
@@ -597,7 +615,6 @@ v4l_compat_translate_ioctl(struct inode *inode, | |||
597 | pict->whiteness = get_v4l_control(inode, file, | 615 | pict->whiteness = get_v4l_control(inode, file, |
598 | V4L2_CID_WHITENESS, drv); | 616 | V4L2_CID_WHITENESS, drv); |
599 | 617 | ||
600 | fmt2 = kzalloc(sizeof(*fmt2),GFP_KERNEL); | ||
601 | fmt2->type = V4L2_BUF_TYPE_VIDEO_CAPTURE; | 618 | fmt2->type = V4L2_BUF_TYPE_VIDEO_CAPTURE; |
602 | err = drv(inode, file, VIDIOC_G_FMT, fmt2); | 619 | err = drv(inode, file, VIDIOC_G_FMT, fmt2); |
603 | if (err < 0) { | 620 | if (err < 0) { |
@@ -617,6 +634,11 @@ v4l_compat_translate_ioctl(struct inode *inode, | |||
617 | struct video_picture *pict = arg; | 634 | struct video_picture *pict = arg; |
618 | int mem_err = 0, ovl_err = 0; | 635 | int mem_err = 0, ovl_err = 0; |
619 | 636 | ||
637 | fmt2 = kzalloc(sizeof(*fmt2), GFP_KERNEL); | ||
638 | if (!fmt2) { | ||
639 | err = -ENOMEM; | ||
640 | break; | ||
641 | } | ||
620 | memset(&fbuf2, 0, sizeof(fbuf2)); | 642 | memset(&fbuf2, 0, sizeof(fbuf2)); |
621 | 643 | ||
622 | set_v4l_control(inode, file, | 644 | set_v4l_control(inode, file, |
@@ -636,7 +658,6 @@ v4l_compat_translate_ioctl(struct inode *inode, | |||
636 | * different pixel formats for memory vs overlay. | 658 | * different pixel formats for memory vs overlay. |
637 | */ | 659 | */ |
638 | 660 | ||
639 | fmt2 = kzalloc(sizeof(*fmt2),GFP_KERNEL); | ||
640 | fmt2->type = V4L2_BUF_TYPE_VIDEO_CAPTURE; | 661 | fmt2->type = V4L2_BUF_TYPE_VIDEO_CAPTURE; |
641 | err = drv(inode, file, VIDIOC_G_FMT, fmt2); | 662 | err = drv(inode, file, VIDIOC_G_FMT, fmt2); |
642 | /* If VIDIOC_G_FMT failed, then the driver likely doesn't | 663 | /* If VIDIOC_G_FMT failed, then the driver likely doesn't |
@@ -890,7 +911,11 @@ v4l_compat_translate_ioctl(struct inode *inode, | |||
890 | { | 911 | { |
891 | struct video_mmap *mm = arg; | 912 | struct video_mmap *mm = arg; |
892 | 913 | ||
893 | fmt2 = kzalloc(sizeof(*fmt2),GFP_KERNEL); | 914 | fmt2 = kzalloc(sizeof(*fmt2), GFP_KERNEL); |
915 | if (!fmt2) { | ||
916 | err = -ENOMEM; | ||
917 | break; | ||
918 | } | ||
894 | memset(&buf2,0,sizeof(buf2)); | 919 | memset(&buf2,0,sizeof(buf2)); |
895 | 920 | ||
896 | fmt2->type = V4L2_BUF_TYPE_VIDEO_CAPTURE; | 921 | fmt2->type = V4L2_BUF_TYPE_VIDEO_CAPTURE; |
@@ -986,7 +1011,11 @@ v4l_compat_translate_ioctl(struct inode *inode, | |||
986 | { | 1011 | { |
987 | struct vbi_format *fmt = arg; | 1012 | struct vbi_format *fmt = arg; |
988 | 1013 | ||
989 | fmt2 = kzalloc(sizeof(*fmt2),GFP_KERNEL); | 1014 | fmt2 = kzalloc(sizeof(*fmt2), GFP_KERNEL); |
1015 | if (!fmt2) { | ||
1016 | err = -ENOMEM; | ||
1017 | break; | ||
1018 | } | ||
990 | fmt2->type = V4L2_BUF_TYPE_VBI_CAPTURE; | 1019 | fmt2->type = V4L2_BUF_TYPE_VBI_CAPTURE; |
991 | 1020 | ||
992 | err = drv(inode, file, VIDIOC_G_FMT, fmt2); | 1021 | err = drv(inode, file, VIDIOC_G_FMT, fmt2); |
@@ -1018,8 +1047,11 @@ v4l_compat_translate_ioctl(struct inode *inode, | |||
1018 | break; | 1047 | break; |
1019 | } | 1048 | } |
1020 | 1049 | ||
1021 | fmt2 = kzalloc(sizeof(*fmt2),GFP_KERNEL); | 1050 | fmt2 = kzalloc(sizeof(*fmt2), GFP_KERNEL); |
1022 | 1051 | if (!fmt2) { | |
1052 | err = -ENOMEM; | ||
1053 | break; | ||
1054 | } | ||
1023 | fmt2->type = V4L2_BUF_TYPE_VBI_CAPTURE; | 1055 | fmt2->type = V4L2_BUF_TYPE_VBI_CAPTURE; |
1024 | fmt2->fmt.vbi.samples_per_line = fmt->samples_per_line; | 1056 | fmt2->fmt.vbi.samples_per_line = fmt->samples_per_line; |
1025 | fmt2->fmt.vbi.sampling_rate = fmt->sampling_rate; | 1057 | fmt2->fmt.vbi.sampling_rate = fmt->sampling_rate; |
diff --git a/drivers/memstick/core/memstick.c b/drivers/memstick/core/memstick.c index de80dba12f9b..946e3d3506ac 100644 --- a/drivers/memstick/core/memstick.c +++ b/drivers/memstick/core/memstick.c | |||
@@ -276,8 +276,6 @@ void memstick_init_req_sg(struct memstick_request *mrq, unsigned char tpc, | |||
276 | mrq->need_card_int = 1; | 276 | mrq->need_card_int = 1; |
277 | else | 277 | else |
278 | mrq->need_card_int = 0; | 278 | mrq->need_card_int = 0; |
279 | |||
280 | mrq->get_int_reg = 0; | ||
281 | } | 279 | } |
282 | EXPORT_SYMBOL(memstick_init_req_sg); | 280 | EXPORT_SYMBOL(memstick_init_req_sg); |
283 | 281 | ||
@@ -311,8 +309,6 @@ void memstick_init_req(struct memstick_request *mrq, unsigned char tpc, | |||
311 | mrq->need_card_int = 1; | 309 | mrq->need_card_int = 1; |
312 | else | 310 | else |
313 | mrq->need_card_int = 0; | 311 | mrq->need_card_int = 0; |
314 | |||
315 | mrq->get_int_reg = 0; | ||
316 | } | 312 | } |
317 | EXPORT_SYMBOL(memstick_init_req); | 313 | EXPORT_SYMBOL(memstick_init_req); |
318 | 314 | ||
@@ -342,6 +338,7 @@ static int h_memstick_read_dev_id(struct memstick_dev *card, | |||
342 | card->id.class = id_reg.class; | 338 | card->id.class = id_reg.class; |
343 | } | 339 | } |
344 | complete(&card->mrq_complete); | 340 | complete(&card->mrq_complete); |
341 | dev_dbg(&card->dev, "if_mode = %02x\n", id_reg.if_mode); | ||
345 | return -EAGAIN; | 342 | return -EAGAIN; |
346 | } | 343 | } |
347 | } | 344 | } |
@@ -422,7 +419,6 @@ static void memstick_power_on(struct memstick_host *host) | |||
422 | { | 419 | { |
423 | host->set_param(host, MEMSTICK_POWER, MEMSTICK_POWER_ON); | 420 | host->set_param(host, MEMSTICK_POWER, MEMSTICK_POWER_ON); |
424 | host->set_param(host, MEMSTICK_INTERFACE, MEMSTICK_SERIAL); | 421 | host->set_param(host, MEMSTICK_INTERFACE, MEMSTICK_SERIAL); |
425 | msleep(1); | ||
426 | } | 422 | } |
427 | 423 | ||
428 | static void memstick_check(struct work_struct *work) | 424 | static void memstick_check(struct work_struct *work) |
@@ -579,7 +575,8 @@ EXPORT_SYMBOL(memstick_suspend_host); | |||
579 | void memstick_resume_host(struct memstick_host *host) | 575 | void memstick_resume_host(struct memstick_host *host) |
580 | { | 576 | { |
581 | mutex_lock(&host->lock); | 577 | mutex_lock(&host->lock); |
582 | host->set_param(host, MEMSTICK_POWER, MEMSTICK_POWER_ON); | 578 | if (host->card) |
579 | memstick_power_on(host); | ||
583 | mutex_unlock(&host->lock); | 580 | mutex_unlock(&host->lock); |
584 | memstick_detect_change(host); | 581 | memstick_detect_change(host); |
585 | } | 582 | } |
diff --git a/drivers/memstick/core/mspro_block.c b/drivers/memstick/core/mspro_block.c index 1d637e4561d3..557dbbba5cb2 100644 --- a/drivers/memstick/core/mspro_block.c +++ b/drivers/memstick/core/mspro_block.c | |||
@@ -133,6 +133,7 @@ struct mspro_devinfo { | |||
133 | struct mspro_block_data { | 133 | struct mspro_block_data { |
134 | struct memstick_dev *card; | 134 | struct memstick_dev *card; |
135 | unsigned int usage_count; | 135 | unsigned int usage_count; |
136 | unsigned int caps; | ||
136 | struct gendisk *disk; | 137 | struct gendisk *disk; |
137 | struct request_queue *queue; | 138 | struct request_queue *queue; |
138 | spinlock_t q_lock; | 139 | spinlock_t q_lock; |
@@ -577,7 +578,6 @@ static int h_mspro_block_wait_for_ced(struct memstick_dev *card, | |||
577 | static int h_mspro_block_transfer_data(struct memstick_dev *card, | 578 | static int h_mspro_block_transfer_data(struct memstick_dev *card, |
578 | struct memstick_request **mrq) | 579 | struct memstick_request **mrq) |
579 | { | 580 | { |
580 | struct memstick_host *host = card->host; | ||
581 | struct mspro_block_data *msb = memstick_get_drvdata(card); | 581 | struct mspro_block_data *msb = memstick_get_drvdata(card); |
582 | unsigned char t_val = 0; | 582 | unsigned char t_val = 0; |
583 | struct scatterlist t_sg = { 0 }; | 583 | struct scatterlist t_sg = { 0 }; |
@@ -591,12 +591,12 @@ static int h_mspro_block_transfer_data(struct memstick_dev *card, | |||
591 | switch ((*mrq)->tpc) { | 591 | switch ((*mrq)->tpc) { |
592 | case MS_TPC_WRITE_REG: | 592 | case MS_TPC_WRITE_REG: |
593 | memstick_init_req(*mrq, MS_TPC_SET_CMD, &msb->transfer_cmd, 1); | 593 | memstick_init_req(*mrq, MS_TPC_SET_CMD, &msb->transfer_cmd, 1); |
594 | (*mrq)->get_int_reg = 1; | 594 | (*mrq)->need_card_int = 1; |
595 | return 0; | 595 | return 0; |
596 | case MS_TPC_SET_CMD: | 596 | case MS_TPC_SET_CMD: |
597 | t_val = (*mrq)->int_reg; | 597 | t_val = (*mrq)->int_reg; |
598 | memstick_init_req(*mrq, MS_TPC_GET_INT, NULL, 1); | 598 | memstick_init_req(*mrq, MS_TPC_GET_INT, NULL, 1); |
599 | if (host->caps & MEMSTICK_CAP_AUTO_GET_INT) | 599 | if (msb->caps & MEMSTICK_CAP_AUTO_GET_INT) |
600 | goto has_int_reg; | 600 | goto has_int_reg; |
601 | return 0; | 601 | return 0; |
602 | case MS_TPC_GET_INT: | 602 | case MS_TPC_GET_INT: |
@@ -646,12 +646,12 @@ has_int_reg: | |||
646 | ? MS_TPC_READ_LONG_DATA | 646 | ? MS_TPC_READ_LONG_DATA |
647 | : MS_TPC_WRITE_LONG_DATA, | 647 | : MS_TPC_WRITE_LONG_DATA, |
648 | &t_sg); | 648 | &t_sg); |
649 | (*mrq)->get_int_reg = 1; | 649 | (*mrq)->need_card_int = 1; |
650 | return 0; | 650 | return 0; |
651 | case MS_TPC_READ_LONG_DATA: | 651 | case MS_TPC_READ_LONG_DATA: |
652 | case MS_TPC_WRITE_LONG_DATA: | 652 | case MS_TPC_WRITE_LONG_DATA: |
653 | msb->current_page++; | 653 | msb->current_page++; |
654 | if (host->caps & MEMSTICK_CAP_AUTO_GET_INT) { | 654 | if (msb->caps & MEMSTICK_CAP_AUTO_GET_INT) { |
655 | t_val = (*mrq)->int_reg; | 655 | t_val = (*mrq)->int_reg; |
656 | goto has_int_reg; | 656 | goto has_int_reg; |
657 | } else { | 657 | } else { |
@@ -816,12 +816,13 @@ static int mspro_block_wait_for_ced(struct memstick_dev *card) | |||
816 | return card->current_mrq.error; | 816 | return card->current_mrq.error; |
817 | } | 817 | } |
818 | 818 | ||
819 | static int mspro_block_switch_to_parallel(struct memstick_dev *card) | 819 | static int mspro_block_set_interface(struct memstick_dev *card, |
820 | unsigned char sys_reg) | ||
820 | { | 821 | { |
821 | struct memstick_host *host = card->host; | 822 | struct memstick_host *host = card->host; |
822 | struct mspro_block_data *msb = memstick_get_drvdata(card); | 823 | struct mspro_block_data *msb = memstick_get_drvdata(card); |
823 | struct mspro_param_register param = { | 824 | struct mspro_param_register param = { |
824 | .system = MEMSTICK_SYS_PAR4, | 825 | .system = sys_reg, |
825 | .data_count = 0, | 826 | .data_count = 0, |
826 | .data_address = 0, | 827 | .data_address = 0, |
827 | .tpc_param = 0 | 828 | .tpc_param = 0 |
@@ -833,41 +834,70 @@ static int mspro_block_switch_to_parallel(struct memstick_dev *card) | |||
833 | sizeof(param)); | 834 | sizeof(param)); |
834 | memstick_new_req(host); | 835 | memstick_new_req(host); |
835 | wait_for_completion(&card->mrq_complete); | 836 | wait_for_completion(&card->mrq_complete); |
836 | if (card->current_mrq.error) | 837 | return card->current_mrq.error; |
837 | return card->current_mrq.error; | 838 | } |
839 | |||
840 | static int mspro_block_switch_interface(struct memstick_dev *card) | ||
841 | { | ||
842 | struct memstick_host *host = card->host; | ||
843 | struct mspro_block_data *msb = memstick_get_drvdata(card); | ||
844 | int rc = 0; | ||
845 | |||
846 | if (msb->caps & MEMSTICK_CAP_PAR4) | ||
847 | rc = mspro_block_set_interface(card, MEMSTICK_SYS_PAR4); | ||
848 | else | ||
849 | return 0; | ||
850 | |||
851 | if (rc) { | ||
852 | printk(KERN_WARNING | ||
853 | "%s: could not switch to 4-bit mode, error %d\n", | ||
854 | card->dev.bus_id, rc); | ||
855 | return 0; | ||
856 | } | ||
838 | 857 | ||
839 | msb->system = MEMSTICK_SYS_PAR4; | 858 | msb->system = MEMSTICK_SYS_PAR4; |
840 | host->set_param(host, MEMSTICK_INTERFACE, MEMSTICK_PAR4); | 859 | host->set_param(host, MEMSTICK_INTERFACE, MEMSTICK_PAR4); |
860 | printk(KERN_INFO "%s: switching to 4-bit parallel mode\n", | ||
861 | card->dev.bus_id); | ||
862 | |||
863 | if (msb->caps & MEMSTICK_CAP_PAR8) { | ||
864 | rc = mspro_block_set_interface(card, MEMSTICK_SYS_PAR8); | ||
865 | |||
866 | if (!rc) { | ||
867 | msb->system = MEMSTICK_SYS_PAR8; | ||
868 | host->set_param(host, MEMSTICK_INTERFACE, | ||
869 | MEMSTICK_PAR8); | ||
870 | printk(KERN_INFO | ||
871 | "%s: switching to 8-bit parallel mode\n", | ||
872 | card->dev.bus_id); | ||
873 | } else | ||
874 | printk(KERN_WARNING | ||
875 | "%s: could not switch to 8-bit mode, error %d\n", | ||
876 | card->dev.bus_id, rc); | ||
877 | } | ||
841 | 878 | ||
842 | card->next_request = h_mspro_block_req_init; | 879 | card->next_request = h_mspro_block_req_init; |
843 | msb->mrq_handler = h_mspro_block_default; | 880 | msb->mrq_handler = h_mspro_block_default; |
844 | memstick_init_req(&card->current_mrq, MS_TPC_GET_INT, NULL, 1); | 881 | memstick_init_req(&card->current_mrq, MS_TPC_GET_INT, NULL, 1); |
845 | memstick_new_req(card->host); | 882 | memstick_new_req(card->host); |
846 | wait_for_completion(&card->mrq_complete); | 883 | wait_for_completion(&card->mrq_complete); |
884 | rc = card->current_mrq.error; | ||
847 | 885 | ||
848 | if (card->current_mrq.error) { | 886 | if (rc) { |
887 | printk(KERN_WARNING | ||
888 | "%s: interface error, trying to fall back to serial\n", | ||
889 | card->dev.bus_id); | ||
849 | msb->system = MEMSTICK_SYS_SERIAL; | 890 | msb->system = MEMSTICK_SYS_SERIAL; |
850 | host->set_param(host, MEMSTICK_POWER, MEMSTICK_POWER_OFF); | 891 | host->set_param(host, MEMSTICK_POWER, MEMSTICK_POWER_OFF); |
851 | msleep(1000); | 892 | msleep(10); |
852 | host->set_param(host, MEMSTICK_POWER, MEMSTICK_POWER_ON); | 893 | host->set_param(host, MEMSTICK_POWER, MEMSTICK_POWER_ON); |
853 | host->set_param(host, MEMSTICK_INTERFACE, MEMSTICK_SERIAL); | 894 | host->set_param(host, MEMSTICK_INTERFACE, MEMSTICK_SERIAL); |
854 | 895 | ||
855 | if (memstick_set_rw_addr(card)) | 896 | rc = memstick_set_rw_addr(card); |
856 | return card->current_mrq.error; | 897 | if (!rc) |
857 | 898 | rc = mspro_block_set_interface(card, msb->system); | |
858 | param.system = msb->system; | ||
859 | |||
860 | card->next_request = h_mspro_block_req_init; | ||
861 | msb->mrq_handler = h_mspro_block_default; | ||
862 | memstick_init_req(&card->current_mrq, MS_TPC_WRITE_REG, ¶m, | ||
863 | sizeof(param)); | ||
864 | memstick_new_req(host); | ||
865 | wait_for_completion(&card->mrq_complete); | ||
866 | |||
867 | return -EFAULT; | ||
868 | } | 899 | } |
869 | 900 | return rc; | |
870 | return 0; | ||
871 | } | 901 | } |
872 | 902 | ||
873 | /* Memory allocated for attributes by this function should be freed by | 903 | /* Memory allocated for attributes by this function should be freed by |
@@ -1052,16 +1082,18 @@ static int mspro_block_init_card(struct memstick_dev *card) | |||
1052 | if (memstick_set_rw_addr(card)) | 1082 | if (memstick_set_rw_addr(card)) |
1053 | return -EIO; | 1083 | return -EIO; |
1054 | 1084 | ||
1055 | if (host->caps & MEMSTICK_CAP_PAR4) { | 1085 | msb->caps = host->caps; |
1056 | if (mspro_block_switch_to_parallel(card)) | 1086 | rc = mspro_block_switch_interface(card); |
1057 | printk(KERN_WARNING "%s: could not switch to " | 1087 | if (rc) |
1058 | "parallel interface\n", card->dev.bus_id); | 1088 | return rc; |
1059 | } | ||
1060 | 1089 | ||
1090 | msleep(200); | ||
1061 | rc = mspro_block_wait_for_ced(card); | 1091 | rc = mspro_block_wait_for_ced(card); |
1062 | if (rc) | 1092 | if (rc) |
1063 | return rc; | 1093 | return rc; |
1064 | dev_dbg(&card->dev, "card activated\n"); | 1094 | dev_dbg(&card->dev, "card activated\n"); |
1095 | if (msb->system != MEMSTICK_SYS_SERIAL) | ||
1096 | msb->caps |= MEMSTICK_CAP_AUTO_GET_INT; | ||
1065 | 1097 | ||
1066 | card->next_request = h_mspro_block_req_init; | 1098 | card->next_request = h_mspro_block_req_init; |
1067 | msb->mrq_handler = h_mspro_block_get_ro; | 1099 | msb->mrq_handler = h_mspro_block_get_ro; |
diff --git a/drivers/memstick/host/jmb38x_ms.c b/drivers/memstick/host/jmb38x_ms.c index 03fe8783b1ee..8770a5fac3b6 100644 --- a/drivers/memstick/host/jmb38x_ms.c +++ b/drivers/memstick/host/jmb38x_ms.c | |||
@@ -12,6 +12,7 @@ | |||
12 | #include <linux/spinlock.h> | 12 | #include <linux/spinlock.h> |
13 | #include <linux/interrupt.h> | 13 | #include <linux/interrupt.h> |
14 | #include <linux/pci.h> | 14 | #include <linux/pci.h> |
15 | #include <linux/dma-mapping.h> | ||
15 | #include <linux/delay.h> | 16 | #include <linux/delay.h> |
16 | #include <linux/highmem.h> | 17 | #include <linux/highmem.h> |
17 | #include <linux/memstick.h> | 18 | #include <linux/memstick.h> |
@@ -56,8 +57,6 @@ struct jmb38x_ms_host { | |||
56 | unsigned long timeout_jiffies; | 57 | unsigned long timeout_jiffies; |
57 | struct timer_list timer; | 58 | struct timer_list timer; |
58 | struct memstick_request *req; | 59 | struct memstick_request *req; |
59 | unsigned char eject:1, | ||
60 | use_dma:1; | ||
61 | unsigned char cmd_flags; | 60 | unsigned char cmd_flags; |
62 | unsigned char io_pos; | 61 | unsigned char io_pos; |
63 | unsigned int io_word[2]; | 62 | unsigned int io_word[2]; |
@@ -94,9 +93,22 @@ struct jmb38x_ms { | |||
94 | #define HOST_CONTROL_IF_PAR4 0x1 | 93 | #define HOST_CONTROL_IF_PAR4 0x1 |
95 | #define HOST_CONTROL_IF_PAR8 0x3 | 94 | #define HOST_CONTROL_IF_PAR8 0x3 |
96 | 95 | ||
96 | #define STATUS_BUSY 0x00080000 | ||
97 | #define STATUS_MS_DAT7 0x00040000 | ||
98 | #define STATUS_MS_DAT6 0x00020000 | ||
99 | #define STATUS_MS_DAT5 0x00010000 | ||
100 | #define STATUS_MS_DAT4 0x00008000 | ||
101 | #define STATUS_MS_DAT3 0x00004000 | ||
102 | #define STATUS_MS_DAT2 0x00002000 | ||
103 | #define STATUS_MS_DAT1 0x00001000 | ||
104 | #define STATUS_MS_DAT0 0x00000800 | ||
97 | #define STATUS_HAS_MEDIA 0x00000400 | 105 | #define STATUS_HAS_MEDIA 0x00000400 |
98 | #define STATUS_FIFO_EMPTY 0x00000200 | 106 | #define STATUS_FIFO_EMPTY 0x00000200 |
99 | #define STATUS_FIFO_FULL 0x00000100 | 107 | #define STATUS_FIFO_FULL 0x00000100 |
108 | #define STATUS_MS_CED 0x00000080 | ||
109 | #define STATUS_MS_ERR 0x00000040 | ||
110 | #define STATUS_MS_BRQ 0x00000020 | ||
111 | #define STATUS_MS_CNK 0x00000001 | ||
100 | 112 | ||
101 | #define INT_STATUS_TPC_ERR 0x00080000 | 113 | #define INT_STATUS_TPC_ERR 0x00080000 |
102 | #define INT_STATUS_CRC_ERR 0x00040000 | 114 | #define INT_STATUS_CRC_ERR 0x00040000 |
@@ -119,11 +131,17 @@ struct jmb38x_ms { | |||
119 | #define PAD_PU_PD_ON_MS_SOCK0 0x5f8f0000 | 131 | #define PAD_PU_PD_ON_MS_SOCK0 0x5f8f0000 |
120 | #define PAD_PU_PD_ON_MS_SOCK1 0x0f0f0000 | 132 | #define PAD_PU_PD_ON_MS_SOCK1 0x0f0f0000 |
121 | 133 | ||
134 | #define CLOCK_CONTROL_40MHZ 0x00000001 | ||
135 | #define CLOCK_CONTROL_50MHZ 0x00000002 | ||
136 | #define CLOCK_CONTROL_60MHZ 0x00000008 | ||
137 | #define CLOCK_CONTROL_62_5MHZ 0x0000000c | ||
138 | #define CLOCK_CONTROL_OFF 0x00000000 | ||
139 | |||
122 | enum { | 140 | enum { |
123 | CMD_READY = 0x01, | 141 | CMD_READY = 0x01, |
124 | FIFO_READY = 0x02, | 142 | FIFO_READY = 0x02, |
125 | REG_DATA = 0x04, | 143 | REG_DATA = 0x04, |
126 | AUTO_GET_INT = 0x08 | 144 | DMA_DATA = 0x08 |
127 | }; | 145 | }; |
128 | 146 | ||
129 | static unsigned int jmb38x_ms_read_data(struct jmb38x_ms_host *host, | 147 | static unsigned int jmb38x_ms_read_data(struct jmb38x_ms_host *host, |
@@ -273,7 +291,7 @@ static int jmb38x_ms_transfer_data(struct jmb38x_ms_host *host) | |||
273 | { | 291 | { |
274 | unsigned int length; | 292 | unsigned int length; |
275 | unsigned int off; | 293 | unsigned int off; |
276 | unsigned int t_size, p_off, p_cnt; | 294 | unsigned int t_size, p_cnt; |
277 | unsigned char *buf; | 295 | unsigned char *buf; |
278 | struct page *pg; | 296 | struct page *pg; |
279 | unsigned long flags = 0; | 297 | unsigned long flags = 0; |
@@ -287,6 +305,8 @@ static int jmb38x_ms_transfer_data(struct jmb38x_ms_host *host) | |||
287 | } | 305 | } |
288 | 306 | ||
289 | while (length) { | 307 | while (length) { |
308 | unsigned int uninitialized_var(p_off); | ||
309 | |||
290 | if (host->req->long_data) { | 310 | if (host->req->long_data) { |
291 | pg = nth_page(sg_page(&host->req->sg), | 311 | pg = nth_page(sg_page(&host->req->sg), |
292 | off >> PAGE_SHIFT); | 312 | off >> PAGE_SHIFT); |
@@ -364,28 +384,27 @@ static int jmb38x_ms_issue_cmd(struct memstick_host *msh) | |||
364 | cmd |= TPC_DIR; | 384 | cmd |= TPC_DIR; |
365 | if (host->req->need_card_int) | 385 | if (host->req->need_card_int) |
366 | cmd |= TPC_WAIT_INT; | 386 | cmd |= TPC_WAIT_INT; |
367 | if (host->req->get_int_reg) | ||
368 | cmd |= TPC_GET_INT; | ||
369 | 387 | ||
370 | data = host->req->data; | 388 | data = host->req->data; |
371 | 389 | ||
372 | host->use_dma = !no_dma; | 390 | if (!no_dma) |
391 | host->cmd_flags |= DMA_DATA; | ||
373 | 392 | ||
374 | if (host->req->long_data) { | 393 | if (host->req->long_data) { |
375 | data_len = host->req->sg.length; | 394 | data_len = host->req->sg.length; |
376 | } else { | 395 | } else { |
377 | data_len = host->req->data_len; | 396 | data_len = host->req->data_len; |
378 | host->use_dma = 0; | 397 | host->cmd_flags &= ~DMA_DATA; |
379 | } | 398 | } |
380 | 399 | ||
381 | if (data_len <= 8) { | 400 | if (data_len <= 8) { |
382 | cmd &= ~(TPC_DATA_SEL | 0xf); | 401 | cmd &= ~(TPC_DATA_SEL | 0xf); |
383 | host->cmd_flags |= REG_DATA; | 402 | host->cmd_flags |= REG_DATA; |
384 | cmd |= data_len & 0xf; | 403 | cmd |= data_len & 0xf; |
385 | host->use_dma = 0; | 404 | host->cmd_flags &= ~DMA_DATA; |
386 | } | 405 | } |
387 | 406 | ||
388 | if (host->use_dma) { | 407 | if (host->cmd_flags & DMA_DATA) { |
389 | if (1 != pci_map_sg(host->chip->pdev, &host->req->sg, 1, | 408 | if (1 != pci_map_sg(host->chip->pdev, &host->req->sg, 1, |
390 | host->req->data_dir == READ | 409 | host->req->data_dir == READ |
391 | ? PCI_DMA_FROMDEVICE | 410 | ? PCI_DMA_FROMDEVICE |
@@ -448,13 +467,12 @@ static void jmb38x_ms_complete_cmd(struct memstick_host *msh, int last) | |||
448 | readl(host->addr + INT_STATUS)); | 467 | readl(host->addr + INT_STATUS)); |
449 | dev_dbg(msh->cdev.dev, "c hstatus %08x\n", readl(host->addr + STATUS)); | 468 | dev_dbg(msh->cdev.dev, "c hstatus %08x\n", readl(host->addr + STATUS)); |
450 | 469 | ||
451 | if (host->req->get_int_reg) { | 470 | host->req->int_reg = readl(host->addr + STATUS) & 0xff; |
452 | t_val = readl(host->addr + TPC_P0); | 471 | |
453 | host->req->int_reg = (t_val & 0xff); | 472 | writel(0, host->addr + BLOCK); |
454 | } | 473 | writel(0, host->addr + DMA_CONTROL); |
455 | 474 | ||
456 | if (host->use_dma) { | 475 | if (host->cmd_flags & DMA_DATA) { |
457 | writel(0, host->addr + DMA_CONTROL); | ||
458 | pci_unmap_sg(host->chip->pdev, &host->req->sg, 1, | 476 | pci_unmap_sg(host->chip->pdev, &host->req->sg, 1, |
459 | host->req->data_dir == READ | 477 | host->req->data_dir == READ |
460 | ? PCI_DMA_FROMDEVICE : PCI_DMA_TODEVICE); | 478 | ? PCI_DMA_FROMDEVICE : PCI_DMA_TODEVICE); |
@@ -506,7 +524,7 @@ static irqreturn_t jmb38x_ms_isr(int irq, void *dev_id) | |||
506 | else | 524 | else |
507 | host->req->error = -ETIME; | 525 | host->req->error = -ETIME; |
508 | } else { | 526 | } else { |
509 | if (host->use_dma) { | 527 | if (host->cmd_flags & DMA_DATA) { |
510 | if (irq_status & INT_STATUS_EOTRAN) | 528 | if (irq_status & INT_STATUS_EOTRAN) |
511 | host->cmd_flags |= FIFO_READY; | 529 | host->cmd_flags |= FIFO_READY; |
512 | } else { | 530 | } else { |
@@ -595,19 +613,18 @@ static void jmb38x_ms_reset(struct jmb38x_ms_host *host) | |||
595 | { | 613 | { |
596 | unsigned int host_ctl = readl(host->addr + HOST_CONTROL); | 614 | unsigned int host_ctl = readl(host->addr + HOST_CONTROL); |
597 | 615 | ||
598 | writel(host_ctl | HOST_CONTROL_RESET_REQ | HOST_CONTROL_RESET, | 616 | writel(HOST_CONTROL_RESET_REQ, host->addr + HOST_CONTROL); |
599 | host->addr + HOST_CONTROL); | ||
600 | 617 | ||
601 | while (HOST_CONTROL_RESET_REQ | 618 | while (HOST_CONTROL_RESET_REQ |
602 | & (host_ctl = readl(host->addr + HOST_CONTROL))) { | 619 | & (host_ctl = readl(host->addr + HOST_CONTROL))) { |
603 | ndelay(100); | 620 | ndelay(20); |
604 | dev_dbg(&host->chip->pdev->dev, "reset\n"); | 621 | dev_dbg(&host->chip->pdev->dev, "reset %08x\n", host_ctl); |
605 | } | 622 | } |
606 | 623 | ||
607 | writel(INT_STATUS_ALL, host->addr + INT_STATUS_ENABLE); | 624 | writel(HOST_CONTROL_RESET, host->addr + HOST_CONTROL); |
625 | mmiowb(); | ||
608 | writel(INT_STATUS_ALL, host->addr + INT_SIGNAL_ENABLE); | 626 | writel(INT_STATUS_ALL, host->addr + INT_SIGNAL_ENABLE); |
609 | 627 | writel(INT_STATUS_ALL, host->addr + INT_STATUS_ENABLE); | |
610 | dev_dbg(&host->chip->pdev->dev, "reset\n"); | ||
611 | } | 628 | } |
612 | 629 | ||
613 | static void jmb38x_ms_set_param(struct memstick_host *msh, | 630 | static void jmb38x_ms_set_param(struct memstick_host *msh, |
@@ -615,10 +632,8 @@ static void jmb38x_ms_set_param(struct memstick_host *msh, | |||
615 | int value) | 632 | int value) |
616 | { | 633 | { |
617 | struct jmb38x_ms_host *host = memstick_priv(msh); | 634 | struct jmb38x_ms_host *host = memstick_priv(msh); |
618 | unsigned int host_ctl; | 635 | unsigned int host_ctl = readl(host->addr + HOST_CONTROL); |
619 | unsigned long flags; | 636 | unsigned int clock_ctl = CLOCK_CONTROL_40MHZ, clock_delay = 0; |
620 | |||
621 | spin_lock_irqsave(&host->lock, flags); | ||
622 | 637 | ||
623 | switch (param) { | 638 | switch (param) { |
624 | case MEMSTICK_POWER: | 639 | case MEMSTICK_POWER: |
@@ -626,60 +641,57 @@ static void jmb38x_ms_set_param(struct memstick_host *msh, | |||
626 | jmb38x_ms_reset(host); | 641 | jmb38x_ms_reset(host); |
627 | 642 | ||
628 | writel(host->id ? PAD_PU_PD_ON_MS_SOCK1 | 643 | writel(host->id ? PAD_PU_PD_ON_MS_SOCK1 |
629 | : PAD_PU_PD_ON_MS_SOCK0, | 644 | : PAD_PU_PD_ON_MS_SOCK0, |
630 | host->addr + PAD_PU_PD); | 645 | host->addr + PAD_PU_PD); |
631 | 646 | ||
632 | writel(PAD_OUTPUT_ENABLE_MS, | 647 | writel(PAD_OUTPUT_ENABLE_MS, |
633 | host->addr + PAD_OUTPUT_ENABLE); | 648 | host->addr + PAD_OUTPUT_ENABLE); |
634 | 649 | ||
635 | host_ctl = readl(host->addr + HOST_CONTROL); | 650 | host_ctl = 7; |
636 | host_ctl |= 7; | 651 | host_ctl |= HOST_CONTROL_POWER_EN |
637 | writel(host_ctl | (HOST_CONTROL_POWER_EN | 652 | | HOST_CONTROL_CLOCK_EN; |
638 | | HOST_CONTROL_CLOCK_EN), | 653 | writel(host_ctl, host->addr + HOST_CONTROL); |
639 | host->addr + HOST_CONTROL); | ||
640 | 654 | ||
641 | dev_dbg(&host->chip->pdev->dev, "power on\n"); | 655 | dev_dbg(&host->chip->pdev->dev, "power on\n"); |
642 | } else if (value == MEMSTICK_POWER_OFF) { | 656 | } else if (value == MEMSTICK_POWER_OFF) { |
643 | writel(readl(host->addr + HOST_CONTROL) | 657 | host_ctl &= ~(HOST_CONTROL_POWER_EN |
644 | & ~(HOST_CONTROL_POWER_EN | 658 | | HOST_CONTROL_CLOCK_EN); |
645 | | HOST_CONTROL_CLOCK_EN), | 659 | writel(host_ctl, host->addr + HOST_CONTROL); |
646 | host->addr + HOST_CONTROL); | ||
647 | writel(0, host->addr + PAD_OUTPUT_ENABLE); | 660 | writel(0, host->addr + PAD_OUTPUT_ENABLE); |
648 | writel(PAD_PU_PD_OFF, host->addr + PAD_PU_PD); | 661 | writel(PAD_PU_PD_OFF, host->addr + PAD_PU_PD); |
649 | dev_dbg(&host->chip->pdev->dev, "power off\n"); | 662 | dev_dbg(&host->chip->pdev->dev, "power off\n"); |
650 | } | 663 | } |
651 | break; | 664 | break; |
652 | case MEMSTICK_INTERFACE: | 665 | case MEMSTICK_INTERFACE: |
653 | /* jmb38x_ms_reset(host); */ | ||
654 | |||
655 | host_ctl = readl(host->addr + HOST_CONTROL); | ||
656 | host_ctl &= ~(3 << HOST_CONTROL_IF_SHIFT); | 666 | host_ctl &= ~(3 << HOST_CONTROL_IF_SHIFT); |
657 | /* host_ctl |= 7; */ | ||
658 | 667 | ||
659 | if (value == MEMSTICK_SERIAL) { | 668 | if (value == MEMSTICK_SERIAL) { |
660 | host_ctl &= ~HOST_CONTROL_FAST_CLK; | 669 | host_ctl &= ~HOST_CONTROL_FAST_CLK; |
661 | host_ctl |= HOST_CONTROL_IF_SERIAL | 670 | host_ctl |= HOST_CONTROL_IF_SERIAL |
662 | << HOST_CONTROL_IF_SHIFT; | 671 | << HOST_CONTROL_IF_SHIFT; |
663 | host_ctl |= HOST_CONTROL_REI; | 672 | host_ctl |= HOST_CONTROL_REI; |
664 | writel(0, host->addr + CLOCK_DELAY); | 673 | clock_ctl = CLOCK_CONTROL_40MHZ; |
674 | clock_delay = 0; | ||
665 | } else if (value == MEMSTICK_PAR4) { | 675 | } else if (value == MEMSTICK_PAR4) { |
666 | host_ctl |= HOST_CONTROL_FAST_CLK; | 676 | host_ctl |= HOST_CONTROL_FAST_CLK; |
667 | host_ctl |= HOST_CONTROL_IF_PAR4 | 677 | host_ctl |= HOST_CONTROL_IF_PAR4 |
668 | << HOST_CONTROL_IF_SHIFT; | 678 | << HOST_CONTROL_IF_SHIFT; |
669 | host_ctl &= ~HOST_CONTROL_REI; | 679 | host_ctl &= ~HOST_CONTROL_REI; |
670 | writel(4, host->addr + CLOCK_DELAY); | 680 | clock_ctl = CLOCK_CONTROL_40MHZ; |
681 | clock_delay = 4; | ||
671 | } else if (value == MEMSTICK_PAR8) { | 682 | } else if (value == MEMSTICK_PAR8) { |
672 | host_ctl |= HOST_CONTROL_FAST_CLK; | 683 | host_ctl |= HOST_CONTROL_FAST_CLK; |
673 | host_ctl |= HOST_CONTROL_IF_PAR8 | 684 | host_ctl |= HOST_CONTROL_IF_PAR8 |
674 | << HOST_CONTROL_IF_SHIFT; | 685 | << HOST_CONTROL_IF_SHIFT; |
675 | host_ctl &= ~HOST_CONTROL_REI; | 686 | host_ctl &= ~HOST_CONTROL_REI; |
676 | writel(4, host->addr + CLOCK_DELAY); | 687 | clock_ctl = CLOCK_CONTROL_60MHZ; |
688 | clock_delay = 0; | ||
677 | } | 689 | } |
678 | writel(host_ctl, host->addr + HOST_CONTROL); | 690 | writel(host_ctl, host->addr + HOST_CONTROL); |
691 | writel(clock_ctl, host->addr + CLOCK_CONTROL); | ||
692 | writel(clock_delay, host->addr + CLOCK_DELAY); | ||
679 | break; | 693 | break; |
680 | }; | 694 | }; |
681 | |||
682 | spin_unlock_irqrestore(&host->lock, flags); | ||
683 | } | 695 | } |
684 | 696 | ||
685 | #ifdef CONFIG_PM | 697 | #ifdef CONFIG_PM |
@@ -772,13 +784,10 @@ static struct memstick_host *jmb38x_ms_alloc_host(struct jmb38x_ms *jm, int cnt) | |||
772 | snprintf(host->host_id, DEVICE_ID_SIZE, DRIVER_NAME ":slot%d", | 784 | snprintf(host->host_id, DEVICE_ID_SIZE, DRIVER_NAME ":slot%d", |
773 | host->id); | 785 | host->id); |
774 | host->irq = jm->pdev->irq; | 786 | host->irq = jm->pdev->irq; |
775 | host->timeout_jiffies = msecs_to_jiffies(4000); | 787 | host->timeout_jiffies = msecs_to_jiffies(1000); |
776 | msh->request = jmb38x_ms_request; | 788 | msh->request = jmb38x_ms_request; |
777 | msh->set_param = jmb38x_ms_set_param; | 789 | msh->set_param = jmb38x_ms_set_param; |
778 | /* | 790 | |
779 | msh->caps = MEMSTICK_CAP_AUTO_GET_INT | MEMSTICK_CAP_PAR4 | ||
780 | | MEMSTICK_CAP_PAR8; | ||
781 | */ | ||
782 | msh->caps = MEMSTICK_CAP_PAR4 | MEMSTICK_CAP_PAR8; | 791 | msh->caps = MEMSTICK_CAP_PAR4 | MEMSTICK_CAP_PAR8; |
783 | 792 | ||
784 | setup_timer(&host->timer, jmb38x_ms_abort, (unsigned long)msh); | 793 | setup_timer(&host->timer, jmb38x_ms_abort, (unsigned long)msh); |
diff --git a/drivers/memstick/host/tifm_ms.c b/drivers/memstick/host/tifm_ms.c index 2b5bf52a8302..eb150dfb637f 100644 --- a/drivers/memstick/host/tifm_ms.c +++ b/drivers/memstick/host/tifm_ms.c | |||
@@ -340,11 +340,20 @@ static void tifm_ms_complete_cmd(struct tifm_ms *host) | |||
340 | 340 | ||
341 | del_timer(&host->timer); | 341 | del_timer(&host->timer); |
342 | 342 | ||
343 | if (host->use_dma) | 343 | host->req->int_reg = readl(sock->addr + SOCK_MS_STATUS) & 0xff; |
344 | host->req->int_reg = (host->req->int_reg & 1) | ||
345 | | ((host->req->int_reg << 4) & 0xe0); | ||
346 | |||
347 | writel(TIFM_FIFO_INT_SETALL, | ||
348 | sock->addr + SOCK_DMA_FIFO_INT_ENABLE_CLEAR); | ||
349 | writel(TIFM_DMA_RESET, sock->addr + SOCK_DMA_CONTROL); | ||
350 | |||
351 | if (host->use_dma) { | ||
344 | tifm_unmap_sg(sock, &host->req->sg, 1, | 352 | tifm_unmap_sg(sock, &host->req->sg, 1, |
345 | host->req->data_dir == READ | 353 | host->req->data_dir == READ |
346 | ? PCI_DMA_FROMDEVICE | 354 | ? PCI_DMA_FROMDEVICE |
347 | : PCI_DMA_TODEVICE); | 355 | : PCI_DMA_TODEVICE); |
356 | } | ||
348 | 357 | ||
349 | writel((~TIFM_CTRL_LED) & readl(sock->addr + SOCK_CONTROL), | 358 | writel((~TIFM_CTRL_LED) & readl(sock->addr + SOCK_CONTROL), |
350 | sock->addr + SOCK_CONTROL); | 359 | sock->addr + SOCK_CONTROL); |
@@ -424,12 +433,6 @@ static void tifm_ms_card_event(struct tifm_dev *sock) | |||
424 | else if (host_status & TIFM_MS_STAT_CRC) | 433 | else if (host_status & TIFM_MS_STAT_CRC) |
425 | host->req->error = -EILSEQ; | 434 | host->req->error = -EILSEQ; |
426 | 435 | ||
427 | if (host->req->error) { | ||
428 | writel(TIFM_FIFO_INT_SETALL, | ||
429 | sock->addr + SOCK_DMA_FIFO_INT_ENABLE_CLEAR); | ||
430 | writel(TIFM_DMA_RESET, sock->addr + SOCK_DMA_CONTROL); | ||
431 | } | ||
432 | |||
433 | if (host_status & TIFM_MS_STAT_RDY) | 436 | if (host_status & TIFM_MS_STAT_RDY) |
434 | host->cmd_flags |= CMD_READY; | 437 | host->cmd_flags |= CMD_READY; |
435 | 438 | ||
diff --git a/drivers/message/fusion/mptbase.c b/drivers/message/fusion/mptbase.c index 6b6df8679585..c6be6eba7dc3 100644 --- a/drivers/message/fusion/mptbase.c +++ b/drivers/message/fusion/mptbase.c | |||
@@ -1430,6 +1430,98 @@ mpt_get_product_name(u16 vendor, u16 device, u8 revision, char *prod_name) | |||
1430 | sprintf(prod_name, "%s", product_str); | 1430 | sprintf(prod_name, "%s", product_str); |
1431 | } | 1431 | } |
1432 | 1432 | ||
1433 | /** | ||
1434 | * mpt_mapresources - map in memory mapped io | ||
1435 | * @ioc: Pointer to pointer to IOC adapter | ||
1436 | * | ||
1437 | **/ | ||
1438 | static int | ||
1439 | mpt_mapresources(MPT_ADAPTER *ioc) | ||
1440 | { | ||
1441 | u8 __iomem *mem; | ||
1442 | int ii; | ||
1443 | unsigned long mem_phys; | ||
1444 | unsigned long port; | ||
1445 | u32 msize; | ||
1446 | u32 psize; | ||
1447 | u8 revision; | ||
1448 | int r = -ENODEV; | ||
1449 | struct pci_dev *pdev; | ||
1450 | |||
1451 | pdev = ioc->pcidev; | ||
1452 | ioc->bars = pci_select_bars(pdev, IORESOURCE_MEM); | ||
1453 | if (pci_enable_device_mem(pdev)) { | ||
1454 | printk(MYIOC_s_ERR_FMT "pci_enable_device_mem() " | ||
1455 | "failed\n", ioc->name); | ||
1456 | return r; | ||
1457 | } | ||
1458 | if (pci_request_selected_regions(pdev, ioc->bars, "mpt")) { | ||
1459 | printk(MYIOC_s_ERR_FMT "pci_request_selected_regions() with " | ||
1460 | "MEM failed\n", ioc->name); | ||
1461 | return r; | ||
1462 | } | ||
1463 | |||
1464 | pci_read_config_byte(pdev, PCI_CLASS_REVISION, &revision); | ||
1465 | |||
1466 | if (!pci_set_dma_mask(pdev, DMA_64BIT_MASK) | ||
1467 | && !pci_set_consistent_dma_mask(pdev, DMA_64BIT_MASK)) { | ||
1468 | dinitprintk(ioc, printk(MYIOC_s_INFO_FMT | ||
1469 | ": 64 BIT PCI BUS DMA ADDRESSING SUPPORTED\n", | ||
1470 | ioc->name)); | ||
1471 | } else if (!pci_set_dma_mask(pdev, DMA_32BIT_MASK) | ||
1472 | && !pci_set_consistent_dma_mask(pdev, DMA_32BIT_MASK)) { | ||
1473 | dinitprintk(ioc, printk(MYIOC_s_INFO_FMT | ||
1474 | ": 32 BIT PCI BUS DMA ADDRESSING SUPPORTED\n", | ||
1475 | ioc->name)); | ||
1476 | } else { | ||
1477 | printk(MYIOC_s_WARN_FMT "no suitable DMA mask for %s\n", | ||
1478 | ioc->name, pci_name(pdev)); | ||
1479 | pci_release_selected_regions(pdev, ioc->bars); | ||
1480 | return r; | ||
1481 | } | ||
1482 | |||
1483 | mem_phys = msize = 0; | ||
1484 | port = psize = 0; | ||
1485 | for (ii = 0; ii < DEVICE_COUNT_RESOURCE; ii++) { | ||
1486 | if (pci_resource_flags(pdev, ii) & PCI_BASE_ADDRESS_SPACE_IO) { | ||
1487 | if (psize) | ||
1488 | continue; | ||
1489 | /* Get I/O space! */ | ||
1490 | port = pci_resource_start(pdev, ii); | ||
1491 | psize = pci_resource_len(pdev, ii); | ||
1492 | } else { | ||
1493 | if (msize) | ||
1494 | continue; | ||
1495 | /* Get memmap */ | ||
1496 | mem_phys = pci_resource_start(pdev, ii); | ||
1497 | msize = pci_resource_len(pdev, ii); | ||
1498 | } | ||
1499 | } | ||
1500 | ioc->mem_size = msize; | ||
1501 | |||
1502 | mem = NULL; | ||
1503 | /* Get logical ptr for PciMem0 space */ | ||
1504 | /*mem = ioremap(mem_phys, msize);*/ | ||
1505 | mem = ioremap(mem_phys, msize); | ||
1506 | if (mem == NULL) { | ||
1507 | printk(MYIOC_s_ERR_FMT ": ERROR - Unable to map adapter" | ||
1508 | " memory!\n", ioc->name); | ||
1509 | return -EINVAL; | ||
1510 | } | ||
1511 | ioc->memmap = mem; | ||
1512 | dinitprintk(ioc, printk(MYIOC_s_INFO_FMT "mem = %p, mem_phys = %lx\n", | ||
1513 | ioc->name, mem, mem_phys)); | ||
1514 | |||
1515 | ioc->mem_phys = mem_phys; | ||
1516 | ioc->chip = (SYSIF_REGS __iomem *)mem; | ||
1517 | |||
1518 | /* Save Port IO values in case we need to do downloadboot */ | ||
1519 | ioc->pio_mem_phys = port; | ||
1520 | ioc->pio_chip = (SYSIF_REGS __iomem *)port; | ||
1521 | |||
1522 | return 0; | ||
1523 | } | ||
1524 | |||
1433 | /*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/ | 1525 | /*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/ |
1434 | /** | 1526 | /** |
1435 | * mpt_attach - Install a PCI intelligent MPT adapter. | 1527 | * mpt_attach - Install a PCI intelligent MPT adapter. |
@@ -1452,13 +1544,6 @@ int | |||
1452 | mpt_attach(struct pci_dev *pdev, const struct pci_device_id *id) | 1544 | mpt_attach(struct pci_dev *pdev, const struct pci_device_id *id) |
1453 | { | 1545 | { |
1454 | MPT_ADAPTER *ioc; | 1546 | MPT_ADAPTER *ioc; |
1455 | u8 __iomem *mem; | ||
1456 | u8 __iomem *pmem; | ||
1457 | unsigned long mem_phys; | ||
1458 | unsigned long port; | ||
1459 | u32 msize; | ||
1460 | u32 psize; | ||
1461 | int ii; | ||
1462 | u8 cb_idx; | 1547 | u8 cb_idx; |
1463 | int r = -ENODEV; | 1548 | int r = -ENODEV; |
1464 | u8 revision; | 1549 | u8 revision; |
@@ -1468,52 +1553,32 @@ mpt_attach(struct pci_dev *pdev, const struct pci_device_id *id) | |||
1468 | struct proc_dir_entry *dent, *ent; | 1553 | struct proc_dir_entry *dent, *ent; |
1469 | #endif | 1554 | #endif |
1470 | 1555 | ||
1471 | if (mpt_debug_level) | ||
1472 | printk(KERN_INFO MYNAM ": mpt_debug_level=%xh\n", mpt_debug_level); | ||
1473 | |||
1474 | ioc = kzalloc(sizeof(MPT_ADAPTER), GFP_ATOMIC); | 1556 | ioc = kzalloc(sizeof(MPT_ADAPTER), GFP_ATOMIC); |
1475 | if (ioc == NULL) { | 1557 | if (ioc == NULL) { |
1476 | printk(KERN_ERR MYNAM ": ERROR - Insufficient memory to add adapter!\n"); | 1558 | printk(KERN_ERR MYNAM ": ERROR - Insufficient memory to add adapter!\n"); |
1477 | return -ENOMEM; | 1559 | return -ENOMEM; |
1478 | } | 1560 | } |
1479 | ioc->debug_level = mpt_debug_level; | 1561 | |
1480 | ioc->id = mpt_ids++; | 1562 | ioc->id = mpt_ids++; |
1481 | sprintf(ioc->name, "ioc%d", ioc->id); | 1563 | sprintf(ioc->name, "ioc%d", ioc->id); |
1482 | 1564 | ||
1483 | ioc->bars = pci_select_bars(pdev, IORESOURCE_MEM); | 1565 | /* |
1484 | if (pci_enable_device_mem(pdev)) { | 1566 | * set initial debug level |
1485 | printk(MYIOC_s_ERR_FMT "pci_enable_device_mem() " | 1567 | * (refer to mptdebug.h) |
1486 | "failed\n", ioc->name); | 1568 | * |
1487 | kfree(ioc); | 1569 | */ |
1488 | return r; | 1570 | ioc->debug_level = mpt_debug_level; |
1489 | } | 1571 | if (mpt_debug_level) |
1490 | if (pci_request_selected_regions(pdev, ioc->bars, "mpt")) { | 1572 | printk(KERN_INFO "mpt_debug_level=%xh\n", mpt_debug_level); |
1491 | printk(MYIOC_s_ERR_FMT "pci_request_selected_regions() with " | ||
1492 | "MEM failed\n", ioc->name); | ||
1493 | kfree(ioc); | ||
1494 | return r; | ||
1495 | } | ||
1496 | 1573 | ||
1497 | dinitprintk(ioc, printk(MYIOC_s_INFO_FMT ": mpt_adapter_install\n", ioc->name)); | 1574 | dinitprintk(ioc, printk(MYIOC_s_INFO_FMT ": mpt_adapter_install\n", ioc->name)); |
1498 | 1575 | ||
1499 | if (!pci_set_dma_mask(pdev, DMA_64BIT_MASK)) { | 1576 | ioc->pcidev = pdev; |
1500 | dprintk(ioc, printk(MYIOC_s_INFO_FMT | 1577 | if (mpt_mapresources(ioc)) { |
1501 | ": 64 BIT PCI BUS DMA ADDRESSING SUPPORTED\n", ioc->name)); | ||
1502 | } else if (pci_set_dma_mask(pdev, DMA_32BIT_MASK)) { | ||
1503 | printk(MYIOC_s_WARN_FMT ": 32 BIT PCI BUS DMA ADDRESSING NOT SUPPORTED\n", | ||
1504 | ioc->name); | ||
1505 | kfree(ioc); | 1578 | kfree(ioc); |
1506 | return r; | 1579 | return r; |
1507 | } | 1580 | } |
1508 | 1581 | ||
1509 | if (!pci_set_consistent_dma_mask(pdev, DMA_64BIT_MASK)) { | ||
1510 | dprintk(ioc, printk(MYIOC_s_INFO_FMT | ||
1511 | ": Using 64 bit consistent mask\n", ioc->name)); | ||
1512 | } else { | ||
1513 | dprintk(ioc, printk(MYIOC_s_INFO_FMT | ||
1514 | ": Not using 64 bit consistent mask\n", ioc->name)); | ||
1515 | } | ||
1516 | |||
1517 | ioc->alloc_total = sizeof(MPT_ADAPTER); | 1582 | ioc->alloc_total = sizeof(MPT_ADAPTER); |
1518 | ioc->req_sz = MPT_DEFAULT_FRAME_SIZE; /* avoid div by zero! */ | 1583 | ioc->req_sz = MPT_DEFAULT_FRAME_SIZE; /* avoid div by zero! */ |
1519 | ioc->reply_sz = MPT_REPLY_FRAME_SIZE; | 1584 | ioc->reply_sz = MPT_REPLY_FRAME_SIZE; |
@@ -1551,48 +1616,9 @@ mpt_attach(struct pci_dev *pdev, const struct pci_device_id *id) | |||
1551 | /* Find lookup slot. */ | 1616 | /* Find lookup slot. */ |
1552 | INIT_LIST_HEAD(&ioc->list); | 1617 | INIT_LIST_HEAD(&ioc->list); |
1553 | 1618 | ||
1554 | mem_phys = msize = 0; | ||
1555 | port = psize = 0; | ||
1556 | for (ii=0; ii < DEVICE_COUNT_RESOURCE; ii++) { | ||
1557 | if (pci_resource_flags(pdev, ii) & PCI_BASE_ADDRESS_SPACE_IO) { | ||
1558 | if (psize) | ||
1559 | continue; | ||
1560 | /* Get I/O space! */ | ||
1561 | port = pci_resource_start(pdev, ii); | ||
1562 | psize = pci_resource_len(pdev,ii); | ||
1563 | } else { | ||
1564 | if (msize) | ||
1565 | continue; | ||
1566 | /* Get memmap */ | ||
1567 | mem_phys = pci_resource_start(pdev, ii); | ||
1568 | msize = pci_resource_len(pdev,ii); | ||
1569 | } | ||
1570 | } | ||
1571 | ioc->mem_size = msize; | ||
1572 | |||
1573 | mem = NULL; | ||
1574 | /* Get logical ptr for PciMem0 space */ | ||
1575 | /*mem = ioremap(mem_phys, msize);*/ | ||
1576 | mem = ioremap(mem_phys, msize); | ||
1577 | if (mem == NULL) { | ||
1578 | printk(MYIOC_s_ERR_FMT "Unable to map adapter memory!\n", ioc->name); | ||
1579 | kfree(ioc); | ||
1580 | return -EINVAL; | ||
1581 | } | ||
1582 | ioc->memmap = mem; | ||
1583 | dinitprintk(ioc, printk(MYIOC_s_INFO_FMT "mem = %p, mem_phys = %lx\n", ioc->name, mem, mem_phys)); | ||
1584 | |||
1585 | dinitprintk(ioc, printk(MYIOC_s_INFO_FMT "facts @ %p, pfacts[0] @ %p\n", | 1619 | dinitprintk(ioc, printk(MYIOC_s_INFO_FMT "facts @ %p, pfacts[0] @ %p\n", |
1586 | ioc->name, &ioc->facts, &ioc->pfacts[0])); | 1620 | ioc->name, &ioc->facts, &ioc->pfacts[0])); |
1587 | 1621 | ||
1588 | ioc->mem_phys = mem_phys; | ||
1589 | ioc->chip = (SYSIF_REGS __iomem *)mem; | ||
1590 | |||
1591 | /* Save Port IO values in case we need to do downloadboot */ | ||
1592 | ioc->pio_mem_phys = port; | ||
1593 | pmem = (u8 __iomem *)port; | ||
1594 | ioc->pio_chip = (SYSIF_REGS __iomem *)pmem; | ||
1595 | |||
1596 | pci_read_config_byte(pdev, PCI_CLASS_REVISION, &revision); | 1622 | pci_read_config_byte(pdev, PCI_CLASS_REVISION, &revision); |
1597 | mpt_get_product_name(pdev->vendor, pdev->device, revision, ioc->prod_name); | 1623 | mpt_get_product_name(pdev->vendor, pdev->device, revision, ioc->prod_name); |
1598 | 1624 | ||
@@ -1688,7 +1714,9 @@ mpt_attach(struct pci_dev *pdev, const struct pci_device_id *id) | |||
1688 | list_del(&ioc->list); | 1714 | list_del(&ioc->list); |
1689 | if (ioc->alt_ioc) | 1715 | if (ioc->alt_ioc) |
1690 | ioc->alt_ioc->alt_ioc = NULL; | 1716 | ioc->alt_ioc->alt_ioc = NULL; |
1691 | iounmap(mem); | 1717 | iounmap(ioc->memmap); |
1718 | if (r != -5) | ||
1719 | pci_release_selected_regions(pdev, ioc->bars); | ||
1692 | kfree(ioc); | 1720 | kfree(ioc); |
1693 | pci_set_drvdata(pdev, NULL); | 1721 | pci_set_drvdata(pdev, NULL); |
1694 | return r; | 1722 | return r; |
@@ -1784,13 +1812,10 @@ mpt_suspend(struct pci_dev *pdev, pm_message_t state) | |||
1784 | u32 device_state; | 1812 | u32 device_state; |
1785 | MPT_ADAPTER *ioc = pci_get_drvdata(pdev); | 1813 | MPT_ADAPTER *ioc = pci_get_drvdata(pdev); |
1786 | 1814 | ||
1787 | device_state=pci_choose_state(pdev, state); | 1815 | device_state = pci_choose_state(pdev, state); |
1788 | 1816 | printk(MYIOC_s_INFO_FMT "pci-suspend: pdev=0x%p, slot=%s, Entering " | |
1789 | printk(MYIOC_s_INFO_FMT | 1817 | "operating state [D%d]\n", ioc->name, pdev, pci_name(pdev), |
1790 | "pci-suspend: pdev=0x%p, slot=%s, Entering operating state [D%d]\n", | 1818 | device_state); |
1791 | ioc->name, pdev, pci_name(pdev), device_state); | ||
1792 | |||
1793 | pci_save_state(pdev); | ||
1794 | 1819 | ||
1795 | /* put ioc into READY_STATE */ | 1820 | /* put ioc into READY_STATE */ |
1796 | if(SendIocReset(ioc, MPI_FUNCTION_IOC_MESSAGE_UNIT_RESET, CAN_SLEEP)) { | 1821 | if(SendIocReset(ioc, MPI_FUNCTION_IOC_MESSAGE_UNIT_RESET, CAN_SLEEP)) { |
@@ -1805,10 +1830,14 @@ mpt_suspend(struct pci_dev *pdev, pm_message_t state) | |||
1805 | /* Clear any lingering interrupt */ | 1830 | /* Clear any lingering interrupt */ |
1806 | CHIPREG_WRITE32(&ioc->chip->IntStatus, 0); | 1831 | CHIPREG_WRITE32(&ioc->chip->IntStatus, 0); |
1807 | 1832 | ||
1833 | free_irq(ioc->pci_irq, ioc); | ||
1834 | if (mpt_msi_enable) | ||
1835 | pci_disable_msi(ioc->pcidev); | ||
1836 | ioc->pci_irq = -1; | ||
1837 | pci_save_state(pdev); | ||
1808 | pci_disable_device(pdev); | 1838 | pci_disable_device(pdev); |
1809 | pci_release_selected_regions(pdev, ioc->bars); | 1839 | pci_release_selected_regions(pdev, ioc->bars); |
1810 | pci_set_power_state(pdev, device_state); | 1840 | pci_set_power_state(pdev, device_state); |
1811 | |||
1812 | return 0; | 1841 | return 0; |
1813 | } | 1842 | } |
1814 | 1843 | ||
@@ -1823,48 +1852,54 @@ mpt_resume(struct pci_dev *pdev) | |||
1823 | MPT_ADAPTER *ioc = pci_get_drvdata(pdev); | 1852 | MPT_ADAPTER *ioc = pci_get_drvdata(pdev); |
1824 | u32 device_state = pdev->current_state; | 1853 | u32 device_state = pdev->current_state; |
1825 | int recovery_state; | 1854 | int recovery_state; |
1855 | int err; | ||
1826 | 1856 | ||
1827 | printk(MYIOC_s_INFO_FMT | 1857 | printk(MYIOC_s_INFO_FMT "pci-resume: pdev=0x%p, slot=%s, Previous " |
1828 | "pci-resume: pdev=0x%p, slot=%s, Previous operating state [D%d]\n", | 1858 | "operating state [D%d]\n", ioc->name, pdev, pci_name(pdev), |
1829 | ioc->name, pdev, pci_name(pdev), device_state); | 1859 | device_state); |
1830 | 1860 | ||
1831 | pci_set_power_state(pdev, 0); | 1861 | pci_set_power_state(pdev, PCI_D0); |
1862 | pci_enable_wake(pdev, PCI_D0, 0); | ||
1832 | pci_restore_state(pdev); | 1863 | pci_restore_state(pdev); |
1833 | if (ioc->facts.Flags & MPI_IOCFACTS_FLAGS_FW_DOWNLOAD_BOOT) { | 1864 | ioc->pcidev = pdev; |
1834 | ioc->bars = pci_select_bars(ioc->pcidev, IORESOURCE_MEM | | 1865 | err = mpt_mapresources(ioc); |
1835 | IORESOURCE_IO); | 1866 | if (err) |
1836 | if (pci_enable_device(pdev)) | 1867 | return err; |
1837 | return 0; | ||
1838 | } else { | ||
1839 | ioc->bars = pci_select_bars(pdev, IORESOURCE_MEM); | ||
1840 | if (pci_enable_device_mem(pdev)) | ||
1841 | return 0; | ||
1842 | } | ||
1843 | if (pci_request_selected_regions(pdev, ioc->bars, "mpt")) | ||
1844 | return 0; | ||
1845 | 1868 | ||
1846 | /* enable interrupts */ | 1869 | printk(MYIOC_s_INFO_FMT "pci-resume: ioc-state=0x%x,doorbell=0x%x\n", |
1847 | CHIPREG_WRITE32(&ioc->chip->IntMask, MPI_HIM_DIM); | 1870 | ioc->name, (mpt_GetIocState(ioc, 1) >> MPI_IOC_STATE_SHIFT), |
1848 | ioc->active = 1; | 1871 | CHIPREG_READ32(&ioc->chip->Doorbell)); |
1849 | 1872 | ||
1850 | printk(MYIOC_s_INFO_FMT | 1873 | /* |
1851 | "pci-resume: ioc-state=0x%x,doorbell=0x%x\n", | 1874 | * Errata workaround for SAS pci express: |
1852 | ioc->name, | 1875 | * Upon returning to the D0 state, the contents of the doorbell will be |
1853 | (mpt_GetIocState(ioc, 1) >> MPI_IOC_STATE_SHIFT), | 1876 | * stale data, and this will incorrectly signal to the host driver that |
1854 | CHIPREG_READ32(&ioc->chip->Doorbell)); | 1877 | * the firmware is ready to process mpt commands. The workaround is |
1878 | * to issue a diagnostic reset. | ||
1879 | */ | ||
1880 | if (ioc->bus_type == SAS && (pdev->device == | ||
1881 | MPI_MANUFACTPAGE_DEVID_SAS1068E || pdev->device == | ||
1882 | MPI_MANUFACTPAGE_DEVID_SAS1064E)) { | ||
1883 | if (KickStart(ioc, 1, CAN_SLEEP) < 0) { | ||
1884 | printk(MYIOC_s_WARN_FMT "pci-resume: Cannot recover\n", | ||
1885 | ioc->name); | ||
1886 | goto out; | ||
1887 | } | ||
1888 | } | ||
1855 | 1889 | ||
1856 | /* bring ioc to operational state */ | 1890 | /* bring ioc to operational state */ |
1857 | if ((recovery_state = mpt_do_ioc_recovery(ioc, | 1891 | printk(MYIOC_s_INFO_FMT "Sending mpt_do_ioc_recovery\n", ioc->name); |
1858 | MPT_HOSTEVENT_IOC_RECOVER, CAN_SLEEP)) != 0) { | 1892 | recovery_state = mpt_do_ioc_recovery(ioc, MPT_HOSTEVENT_IOC_BRINGUP, |
1859 | printk(MYIOC_s_INFO_FMT | 1893 | CAN_SLEEP); |
1860 | "pci-resume: Cannot recover, error:[%x]\n", | 1894 | if (recovery_state != 0) |
1861 | ioc->name, recovery_state); | 1895 | printk(MYIOC_s_WARN_FMT "pci-resume: Cannot recover, " |
1862 | } else { | 1896 | "error:[%x]\n", ioc->name, recovery_state); |
1897 | else | ||
1863 | printk(MYIOC_s_INFO_FMT | 1898 | printk(MYIOC_s_INFO_FMT |
1864 | "pci-resume: success\n", ioc->name); | 1899 | "pci-resume: success\n", ioc->name); |
1865 | } | 1900 | out: |
1866 | |||
1867 | return 0; | 1901 | return 0; |
1902 | |||
1868 | } | 1903 | } |
1869 | #endif | 1904 | #endif |
1870 | 1905 | ||
@@ -1903,6 +1938,7 @@ mpt_signal_reset(u8 index, MPT_ADAPTER *ioc, int reset_phase) | |||
1903 | * -3 if READY but PrimeIOCFifos Failed | 1938 | * -3 if READY but PrimeIOCFifos Failed |
1904 | * -4 if READY but IOCInit Failed | 1939 | * -4 if READY but IOCInit Failed |
1905 | * -5 if failed to enable_device and/or request_selected_regions | 1940 | * -5 if failed to enable_device and/or request_selected_regions |
1941 | * -6 if failed to upload firmware | ||
1906 | */ | 1942 | */ |
1907 | static int | 1943 | static int |
1908 | mpt_do_ioc_recovery(MPT_ADAPTER *ioc, u32 reason, int sleepFlag) | 1944 | mpt_do_ioc_recovery(MPT_ADAPTER *ioc, u32 reason, int sleepFlag) |
@@ -2097,7 +2133,7 @@ mpt_do_ioc_recovery(MPT_ADAPTER *ioc, u32 reason, int sleepFlag) | |||
2097 | } else { | 2133 | } else { |
2098 | printk(MYIOC_s_WARN_FMT | 2134 | printk(MYIOC_s_WARN_FMT |
2099 | "firmware upload failure!\n", ioc->name); | 2135 | "firmware upload failure!\n", ioc->name); |
2100 | ret = -5; | 2136 | ret = -6; |
2101 | } | 2137 | } |
2102 | } | 2138 | } |
2103 | } | 2139 | } |
diff --git a/drivers/message/fusion/mptscsih.c b/drivers/message/fusion/mptscsih.c index 0c252f60c4c1..c207bda6723b 100644 --- a/drivers/message/fusion/mptscsih.c +++ b/drivers/message/fusion/mptscsih.c | |||
@@ -1170,6 +1170,10 @@ mptscsih_shutdown(struct pci_dev *pdev) | |||
1170 | int | 1170 | int |
1171 | mptscsih_suspend(struct pci_dev *pdev, pm_message_t state) | 1171 | mptscsih_suspend(struct pci_dev *pdev, pm_message_t state) |
1172 | { | 1172 | { |
1173 | MPT_ADAPTER *ioc = pci_get_drvdata(pdev); | ||
1174 | |||
1175 | scsi_block_requests(ioc->sh); | ||
1176 | flush_scheduled_work(); | ||
1173 | mptscsih_shutdown(pdev); | 1177 | mptscsih_shutdown(pdev); |
1174 | return mpt_suspend(pdev,state); | 1178 | return mpt_suspend(pdev,state); |
1175 | } | 1179 | } |
@@ -1183,7 +1187,12 @@ mptscsih_suspend(struct pci_dev *pdev, pm_message_t state) | |||
1183 | int | 1187 | int |
1184 | mptscsih_resume(struct pci_dev *pdev) | 1188 | mptscsih_resume(struct pci_dev *pdev) |
1185 | { | 1189 | { |
1186 | return mpt_resume(pdev); | 1190 | MPT_ADAPTER *ioc = pci_get_drvdata(pdev); |
1191 | int rc; | ||
1192 | |||
1193 | rc = mpt_resume(pdev); | ||
1194 | scsi_unblock_requests(ioc->sh); | ||
1195 | return rc; | ||
1187 | } | 1196 | } |
1188 | 1197 | ||
1189 | #endif | 1198 | #endif |
diff --git a/drivers/misc/Kconfig b/drivers/misc/Kconfig index 982e27b86d10..962817e49fba 100644 --- a/drivers/misc/Kconfig +++ b/drivers/misc/Kconfig | |||
@@ -108,6 +108,7 @@ config ACER_WMI | |||
108 | depends on ACPI | 108 | depends on ACPI |
109 | depends on LEDS_CLASS | 109 | depends on LEDS_CLASS |
110 | depends on BACKLIGHT_CLASS_DEVICE | 110 | depends on BACKLIGHT_CLASS_DEVICE |
111 | depends on SERIO_I8042 | ||
111 | select ACPI_WMI | 112 | select ACPI_WMI |
112 | ---help--- | 113 | ---help--- |
113 | This is a driver for newer Acer (and Wistron) laptops. It adds | 114 | This is a driver for newer Acer (and Wistron) laptops. It adds |
diff --git a/drivers/misc/acer-wmi.c b/drivers/misc/acer-wmi.c index 74d12b4a3abd..dd13a3749927 100644 --- a/drivers/misc/acer-wmi.c +++ b/drivers/misc/acer-wmi.c | |||
@@ -219,6 +219,15 @@ static struct dmi_system_id acer_quirks[] = { | |||
219 | }, | 219 | }, |
220 | { | 220 | { |
221 | .callback = dmi_matched, | 221 | .callback = dmi_matched, |
222 | .ident = "Acer Aspire 3610", | ||
223 | .matches = { | ||
224 | DMI_MATCH(DMI_SYS_VENDOR, "Acer"), | ||
225 | DMI_MATCH(DMI_PRODUCT_NAME, "Aspire 3610"), | ||
226 | }, | ||
227 | .driver_data = &quirk_acer_travelmate_2490, | ||
228 | }, | ||
229 | { | ||
230 | .callback = dmi_matched, | ||
222 | .ident = "Acer Aspire 5100", | 231 | .ident = "Acer Aspire 5100", |
223 | .matches = { | 232 | .matches = { |
224 | DMI_MATCH(DMI_SYS_VENDOR, "Acer"), | 233 | DMI_MATCH(DMI_SYS_VENDOR, "Acer"), |
@@ -228,6 +237,15 @@ static struct dmi_system_id acer_quirks[] = { | |||
228 | }, | 237 | }, |
229 | { | 238 | { |
230 | .callback = dmi_matched, | 239 | .callback = dmi_matched, |
240 | .ident = "Acer Aspire 5610", | ||
241 | .matches = { | ||
242 | DMI_MATCH(DMI_SYS_VENDOR, "Acer"), | ||
243 | DMI_MATCH(DMI_PRODUCT_NAME, "Aspire 5610"), | ||
244 | }, | ||
245 | .driver_data = &quirk_acer_travelmate_2490, | ||
246 | }, | ||
247 | { | ||
248 | .callback = dmi_matched, | ||
231 | .ident = "Acer Aspire 5630", | 249 | .ident = "Acer Aspire 5630", |
232 | .matches = { | 250 | .matches = { |
233 | DMI_MATCH(DMI_SYS_VENDOR, "Acer"), | 251 | DMI_MATCH(DMI_SYS_VENDOR, "Acer"), |
@@ -761,11 +779,11 @@ enum led_brightness value) | |||
761 | } | 779 | } |
762 | 780 | ||
763 | static struct led_classdev mail_led = { | 781 | static struct led_classdev mail_led = { |
764 | .name = "acer-mail:green", | 782 | .name = "acer-wmi::mail", |
765 | .brightness_set = mail_led_set, | 783 | .brightness_set = mail_led_set, |
766 | }; | 784 | }; |
767 | 785 | ||
768 | static int __init acer_led_init(struct device *dev) | 786 | static int __devinit acer_led_init(struct device *dev) |
769 | { | 787 | { |
770 | return led_classdev_register(dev, &mail_led); | 788 | return led_classdev_register(dev, &mail_led); |
771 | } | 789 | } |
@@ -798,7 +816,7 @@ static struct backlight_ops acer_bl_ops = { | |||
798 | .update_status = update_bl_status, | 816 | .update_status = update_bl_status, |
799 | }; | 817 | }; |
800 | 818 | ||
801 | static int __init acer_backlight_init(struct device *dev) | 819 | static int __devinit acer_backlight_init(struct device *dev) |
802 | { | 820 | { |
803 | struct backlight_device *bd; | 821 | struct backlight_device *bd; |
804 | 822 | ||
@@ -817,7 +835,7 @@ static int __init acer_backlight_init(struct device *dev) | |||
817 | return 0; | 835 | return 0; |
818 | } | 836 | } |
819 | 837 | ||
820 | static void __exit acer_backlight_exit(void) | 838 | static void acer_backlight_exit(void) |
821 | { | 839 | { |
822 | backlight_device_unregister(acer_backlight_device); | 840 | backlight_device_unregister(acer_backlight_device); |
823 | } | 841 | } |
@@ -1052,11 +1070,12 @@ static int __init acer_wmi_init(void) | |||
1052 | 1070 | ||
1053 | if (wmi_has_guid(WMID_GUID2) && interface) { | 1071 | if (wmi_has_guid(WMID_GUID2) && interface) { |
1054 | if (ACPI_FAILURE(WMID_set_capabilities())) { | 1072 | if (ACPI_FAILURE(WMID_set_capabilities())) { |
1055 | printk(ACER_ERR "Unable to detect available devices\n"); | 1073 | printk(ACER_ERR "Unable to detect available WMID " |
1074 | "devices\n"); | ||
1056 | return -ENODEV; | 1075 | return -ENODEV; |
1057 | } | 1076 | } |
1058 | } else if (!wmi_has_guid(WMID_GUID2) && interface) { | 1077 | } else if (!wmi_has_guid(WMID_GUID2) && interface) { |
1059 | printk(ACER_ERR "Unable to detect available devices\n"); | 1078 | printk(ACER_ERR "No WMID device detection method found\n"); |
1060 | return -ENODEV; | 1079 | return -ENODEV; |
1061 | } | 1080 | } |
1062 | 1081 | ||
@@ -1064,21 +1083,20 @@ static int __init acer_wmi_init(void) | |||
1064 | interface = &AMW0_interface; | 1083 | interface = &AMW0_interface; |
1065 | 1084 | ||
1066 | if (ACPI_FAILURE(AMW0_set_capabilities())) { | 1085 | if (ACPI_FAILURE(AMW0_set_capabilities())) { |
1067 | printk(ACER_ERR "Unable to detect available devices\n"); | 1086 | printk(ACER_ERR "Unable to detect available AMW0 " |
1087 | "devices\n"); | ||
1068 | return -ENODEV; | 1088 | return -ENODEV; |
1069 | } | 1089 | } |
1070 | } | 1090 | } |
1071 | 1091 | ||
1072 | if (wmi_has_guid(AMW0_GUID1)) { | 1092 | if (wmi_has_guid(AMW0_GUID1)) |
1073 | if (ACPI_FAILURE(AMW0_find_mailled())) | 1093 | AMW0_find_mailled(); |
1074 | printk(ACER_ERR "Unable to detect mail LED\n"); | ||
1075 | } | ||
1076 | 1094 | ||
1077 | find_quirks(); | 1095 | find_quirks(); |
1078 | 1096 | ||
1079 | if (!interface) { | 1097 | if (!interface) { |
1080 | printk(ACER_ERR "No or unsupported WMI interface, unable to "); | 1098 | printk(ACER_ERR "No or unsupported WMI interface, unable to " |
1081 | printk(KERN_CONT "load.\n"); | 1099 | "load\n"); |
1082 | return -ENODEV; | 1100 | return -ENODEV; |
1083 | } | 1101 | } |
1084 | 1102 | ||
diff --git a/drivers/misc/sony-laptop.c b/drivers/misc/sony-laptop.c index 899e3f75f288..02ff3d19b1cc 100644 --- a/drivers/misc/sony-laptop.c +++ b/drivers/misc/sony-laptop.c | |||
@@ -315,7 +315,7 @@ static void sony_laptop_report_input_event(u8 event) | |||
315 | break; | 315 | break; |
316 | 316 | ||
317 | default: | 317 | default: |
318 | if (event > ARRAY_SIZE(sony_laptop_input_index)) { | 318 | if (event >= ARRAY_SIZE(sony_laptop_input_index)) { |
319 | dprintk("sony_laptop_report_input_event, event not known: %d\n", event); | 319 | dprintk("sony_laptop_report_input_event, event not known: %d\n", event); |
320 | break; | 320 | break; |
321 | } | 321 | } |
diff --git a/drivers/mmc/core/Makefile b/drivers/mmc/core/Makefile index 4985807257a8..19a1a254a0c5 100644 --- a/drivers/mmc/core/Makefile +++ b/drivers/mmc/core/Makefile | |||
@@ -7,7 +7,7 @@ ifeq ($(CONFIG_MMC_DEBUG),y) | |||
7 | endif | 7 | endif |
8 | 8 | ||
9 | obj-$(CONFIG_MMC) += mmc_core.o | 9 | obj-$(CONFIG_MMC) += mmc_core.o |
10 | mmc_core-y := core.o sysfs.o bus.o host.o \ | 10 | mmc_core-y := core.o bus.o host.o \ |
11 | mmc.o mmc_ops.o sd.o sd_ops.o \ | 11 | mmc.o mmc_ops.o sd.o sd_ops.o \ |
12 | sdio.o sdio_ops.o sdio_bus.o \ | 12 | sdio.o sdio_ops.o sdio_bus.o \ |
13 | sdio_cis.o sdio_io.o sdio_irq.o | 13 | sdio_cis.o sdio_io.o sdio_irq.o |
diff --git a/drivers/mmc/core/bus.c b/drivers/mmc/core/bus.c index b0c22cad9423..fd95b18e988b 100644 --- a/drivers/mmc/core/bus.c +++ b/drivers/mmc/core/bus.c | |||
@@ -17,7 +17,6 @@ | |||
17 | #include <linux/mmc/card.h> | 17 | #include <linux/mmc/card.h> |
18 | #include <linux/mmc/host.h> | 18 | #include <linux/mmc/host.h> |
19 | 19 | ||
20 | #include "sysfs.h" | ||
21 | #include "core.h" | 20 | #include "core.h" |
22 | #include "sdio_cis.h" | 21 | #include "sdio_cis.h" |
23 | #include "bus.h" | 22 | #include "bus.h" |
@@ -43,7 +42,7 @@ static ssize_t mmc_type_show(struct device *dev, | |||
43 | } | 42 | } |
44 | 43 | ||
45 | static struct device_attribute mmc_dev_attrs[] = { | 44 | static struct device_attribute mmc_dev_attrs[] = { |
46 | MMC_ATTR_RO(type), | 45 | __ATTR(type, S_IRUGO, mmc_type_show, NULL), |
47 | __ATTR_NULL, | 46 | __ATTR_NULL, |
48 | }; | 47 | }; |
49 | 48 | ||
@@ -189,7 +188,7 @@ static void mmc_release_card(struct device *dev) | |||
189 | /* | 188 | /* |
190 | * Allocate and initialise a new MMC card structure. | 189 | * Allocate and initialise a new MMC card structure. |
191 | */ | 190 | */ |
192 | struct mmc_card *mmc_alloc_card(struct mmc_host *host) | 191 | struct mmc_card *mmc_alloc_card(struct mmc_host *host, struct device_type *type) |
193 | { | 192 | { |
194 | struct mmc_card *card; | 193 | struct mmc_card *card; |
195 | 194 | ||
@@ -204,6 +203,7 @@ struct mmc_card *mmc_alloc_card(struct mmc_host *host) | |||
204 | card->dev.parent = mmc_classdev(host); | 203 | card->dev.parent = mmc_classdev(host); |
205 | card->dev.bus = &mmc_bus_type; | 204 | card->dev.bus = &mmc_bus_type; |
206 | card->dev.release = mmc_release_card; | 205 | card->dev.release = mmc_release_card; |
206 | card->dev.type = type; | ||
207 | 207 | ||
208 | return card; | 208 | return card; |
209 | } | 209 | } |
@@ -248,24 +248,10 @@ int mmc_add_card(struct mmc_card *card) | |||
248 | type, card->rca); | 248 | type, card->rca); |
249 | } | 249 | } |
250 | 250 | ||
251 | card->dev.uevent_suppress = 1; | ||
252 | |||
253 | ret = device_add(&card->dev); | 251 | ret = device_add(&card->dev); |
254 | if (ret) | 252 | if (ret) |
255 | return ret; | 253 | return ret; |
256 | 254 | ||
257 | if (card->host->bus_ops->sysfs_add) { | ||
258 | ret = card->host->bus_ops->sysfs_add(card->host, card); | ||
259 | if (ret) { | ||
260 | device_del(&card->dev); | ||
261 | return ret; | ||
262 | } | ||
263 | } | ||
264 | |||
265 | card->dev.uevent_suppress = 0; | ||
266 | |||
267 | kobject_uevent(&card->dev.kobj, KOBJ_ADD); | ||
268 | |||
269 | mmc_card_set_present(card); | 255 | mmc_card_set_present(card); |
270 | 256 | ||
271 | return 0; | 257 | return 0; |
@@ -285,9 +271,6 @@ void mmc_remove_card(struct mmc_card *card) | |||
285 | printk(KERN_INFO "%s: card %04x removed\n", | 271 | printk(KERN_INFO "%s: card %04x removed\n", |
286 | mmc_hostname(card->host), card->rca); | 272 | mmc_hostname(card->host), card->rca); |
287 | } | 273 | } |
288 | |||
289 | if (card->host->bus_ops->sysfs_remove) | ||
290 | card->host->bus_ops->sysfs_remove(card->host, card); | ||
291 | device_del(&card->dev); | 274 | device_del(&card->dev); |
292 | } | 275 | } |
293 | 276 | ||
diff --git a/drivers/mmc/core/bus.h b/drivers/mmc/core/bus.h index 4f35431116a8..18178766ab46 100644 --- a/drivers/mmc/core/bus.h +++ b/drivers/mmc/core/bus.h | |||
@@ -11,7 +11,16 @@ | |||
11 | #ifndef _MMC_CORE_BUS_H | 11 | #ifndef _MMC_CORE_BUS_H |
12 | #define _MMC_CORE_BUS_H | 12 | #define _MMC_CORE_BUS_H |
13 | 13 | ||
14 | struct mmc_card *mmc_alloc_card(struct mmc_host *host); | 14 | #define MMC_DEV_ATTR(name, fmt, args...) \ |
15 | static ssize_t mmc_##name##_show (struct device *dev, struct device_attribute *attr, char *buf) \ | ||
16 | { \ | ||
17 | struct mmc_card *card = container_of(dev, struct mmc_card, dev); \ | ||
18 | return sprintf(buf, fmt, args); \ | ||
19 | } \ | ||
20 | static DEVICE_ATTR(name, S_IRUGO, mmc_##name##_show, NULL) | ||
21 | |||
22 | struct mmc_card *mmc_alloc_card(struct mmc_host *host, | ||
23 | struct device_type *type); | ||
15 | int mmc_add_card(struct mmc_card *card); | 24 | int mmc_add_card(struct mmc_card *card); |
16 | void mmc_remove_card(struct mmc_card *card); | 25 | void mmc_remove_card(struct mmc_card *card); |
17 | 26 | ||
diff --git a/drivers/mmc/core/core.h b/drivers/mmc/core/core.h index 39daf2fb5dc4..cfa8e15b5923 100644 --- a/drivers/mmc/core/core.h +++ b/drivers/mmc/core/core.h | |||
@@ -18,8 +18,6 @@ | |||
18 | struct mmc_bus_ops { | 18 | struct mmc_bus_ops { |
19 | void (*remove)(struct mmc_host *); | 19 | void (*remove)(struct mmc_host *); |
20 | void (*detect)(struct mmc_host *); | 20 | void (*detect)(struct mmc_host *); |
21 | int (*sysfs_add)(struct mmc_host *, struct mmc_card *card); | ||
22 | void (*sysfs_remove)(struct mmc_host *, struct mmc_card *card); | ||
23 | void (*suspend)(struct mmc_host *); | 21 | void (*suspend)(struct mmc_host *); |
24 | void (*resume)(struct mmc_host *); | 22 | void (*resume)(struct mmc_host *); |
25 | }; | 23 | }; |
diff --git a/drivers/mmc/core/mmc.c b/drivers/mmc/core/mmc.c index 68c0e3b2f0e8..3da29eef8f7d 100644 --- a/drivers/mmc/core/mmc.c +++ b/drivers/mmc/core/mmc.c | |||
@@ -17,7 +17,6 @@ | |||
17 | #include <linux/mmc/mmc.h> | 17 | #include <linux/mmc/mmc.h> |
18 | 18 | ||
19 | #include "core.h" | 19 | #include "core.h" |
20 | #include "sysfs.h" | ||
21 | #include "bus.h" | 20 | #include "bus.h" |
22 | #include "mmc_ops.h" | 21 | #include "mmc_ops.h" |
23 | 22 | ||
@@ -248,6 +247,44 @@ out: | |||
248 | return err; | 247 | return err; |
249 | } | 248 | } |
250 | 249 | ||
250 | MMC_DEV_ATTR(cid, "%08x%08x%08x%08x\n", card->raw_cid[0], card->raw_cid[1], | ||
251 | card->raw_cid[2], card->raw_cid[3]); | ||
252 | MMC_DEV_ATTR(csd, "%08x%08x%08x%08x\n", card->raw_csd[0], card->raw_csd[1], | ||
253 | card->raw_csd[2], card->raw_csd[3]); | ||
254 | MMC_DEV_ATTR(date, "%02d/%04d\n", card->cid.month, card->cid.year); | ||
255 | MMC_DEV_ATTR(fwrev, "0x%x\n", card->cid.fwrev); | ||
256 | MMC_DEV_ATTR(hwrev, "0x%x\n", card->cid.hwrev); | ||
257 | MMC_DEV_ATTR(manfid, "0x%06x\n", card->cid.manfid); | ||
258 | MMC_DEV_ATTR(name, "%s\n", card->cid.prod_name); | ||
259 | MMC_DEV_ATTR(oemid, "0x%04x\n", card->cid.oemid); | ||
260 | MMC_DEV_ATTR(serial, "0x%08x\n", card->cid.serial); | ||
261 | |||
262 | static struct attribute *mmc_std_attrs[] = { | ||
263 | &dev_attr_cid.attr, | ||
264 | &dev_attr_csd.attr, | ||
265 | &dev_attr_date.attr, | ||
266 | &dev_attr_fwrev.attr, | ||
267 | &dev_attr_hwrev.attr, | ||
268 | &dev_attr_manfid.attr, | ||
269 | &dev_attr_name.attr, | ||
270 | &dev_attr_oemid.attr, | ||
271 | &dev_attr_serial.attr, | ||
272 | NULL, | ||
273 | }; | ||
274 | |||
275 | static struct attribute_group mmc_std_attr_group = { | ||
276 | .attrs = mmc_std_attrs, | ||
277 | }; | ||
278 | |||
279 | static struct attribute_group *mmc_attr_groups[] = { | ||
280 | &mmc_std_attr_group, | ||
281 | NULL, | ||
282 | }; | ||
283 | |||
284 | static struct device_type mmc_type = { | ||
285 | .groups = mmc_attr_groups, | ||
286 | }; | ||
287 | |||
251 | /* | 288 | /* |
252 | * Handle the detection and initialisation of a card. | 289 | * Handle the detection and initialisation of a card. |
253 | * | 290 | * |
@@ -308,7 +345,7 @@ static int mmc_init_card(struct mmc_host *host, u32 ocr, | |||
308 | /* | 345 | /* |
309 | * Allocate card structure. | 346 | * Allocate card structure. |
310 | */ | 347 | */ |
311 | card = mmc_alloc_card(host); | 348 | card = mmc_alloc_card(host, &mmc_type); |
312 | if (IS_ERR(card)) { | 349 | if (IS_ERR(card)) { |
313 | err = PTR_ERR(card); | 350 | err = PTR_ERR(card); |
314 | goto err; | 351 | goto err; |
@@ -459,53 +496,6 @@ static void mmc_detect(struct mmc_host *host) | |||
459 | } | 496 | } |
460 | } | 497 | } |
461 | 498 | ||
462 | MMC_ATTR_FN(cid, "%08x%08x%08x%08x\n", card->raw_cid[0], card->raw_cid[1], | ||
463 | card->raw_cid[2], card->raw_cid[3]); | ||
464 | MMC_ATTR_FN(csd, "%08x%08x%08x%08x\n", card->raw_csd[0], card->raw_csd[1], | ||
465 | card->raw_csd[2], card->raw_csd[3]); | ||
466 | MMC_ATTR_FN(date, "%02d/%04d\n", card->cid.month, card->cid.year); | ||
467 | MMC_ATTR_FN(fwrev, "0x%x\n", card->cid.fwrev); | ||
468 | MMC_ATTR_FN(hwrev, "0x%x\n", card->cid.hwrev); | ||
469 | MMC_ATTR_FN(manfid, "0x%06x\n", card->cid.manfid); | ||
470 | MMC_ATTR_FN(name, "%s\n", card->cid.prod_name); | ||
471 | MMC_ATTR_FN(oemid, "0x%04x\n", card->cid.oemid); | ||
472 | MMC_ATTR_FN(serial, "0x%08x\n", card->cid.serial); | ||
473 | |||
474 | static struct device_attribute mmc_dev_attrs[] = { | ||
475 | MMC_ATTR_RO(cid), | ||
476 | MMC_ATTR_RO(csd), | ||
477 | MMC_ATTR_RO(date), | ||
478 | MMC_ATTR_RO(fwrev), | ||
479 | MMC_ATTR_RO(hwrev), | ||
480 | MMC_ATTR_RO(manfid), | ||
481 | MMC_ATTR_RO(name), | ||
482 | MMC_ATTR_RO(oemid), | ||
483 | MMC_ATTR_RO(serial), | ||
484 | __ATTR_NULL, | ||
485 | }; | ||
486 | |||
487 | /* | ||
488 | * Adds sysfs entries as relevant. | ||
489 | */ | ||
490 | static int mmc_sysfs_add(struct mmc_host *host, struct mmc_card *card) | ||
491 | { | ||
492 | int ret; | ||
493 | |||
494 | ret = mmc_add_attrs(card, mmc_dev_attrs); | ||
495 | if (ret < 0) | ||
496 | return ret; | ||
497 | |||
498 | return 0; | ||
499 | } | ||
500 | |||
501 | /* | ||
502 | * Removes the sysfs entries added by mmc_sysfs_add(). | ||
503 | */ | ||
504 | static void mmc_sysfs_remove(struct mmc_host *host, struct mmc_card *card) | ||
505 | { | ||
506 | mmc_remove_attrs(card, mmc_dev_attrs); | ||
507 | } | ||
508 | |||
509 | #ifdef CONFIG_MMC_UNSAFE_RESUME | 499 | #ifdef CONFIG_MMC_UNSAFE_RESUME |
510 | 500 | ||
511 | /* | 501 | /* |
@@ -560,8 +550,6 @@ static void mmc_resume(struct mmc_host *host) | |||
560 | static const struct mmc_bus_ops mmc_ops = { | 550 | static const struct mmc_bus_ops mmc_ops = { |
561 | .remove = mmc_remove, | 551 | .remove = mmc_remove, |
562 | .detect = mmc_detect, | 552 | .detect = mmc_detect, |
563 | .sysfs_add = mmc_sysfs_add, | ||
564 | .sysfs_remove = mmc_sysfs_remove, | ||
565 | .suspend = mmc_suspend, | 553 | .suspend = mmc_suspend, |
566 | .resume = mmc_resume, | 554 | .resume = mmc_resume, |
567 | }; | 555 | }; |
diff --git a/drivers/mmc/core/sd.c b/drivers/mmc/core/sd.c index d1c1e0f592f1..7ef3b15c5e3d 100644 --- a/drivers/mmc/core/sd.c +++ b/drivers/mmc/core/sd.c | |||
@@ -18,7 +18,6 @@ | |||
18 | #include <linux/mmc/sd.h> | 18 | #include <linux/mmc/sd.h> |
19 | 19 | ||
20 | #include "core.h" | 20 | #include "core.h" |
21 | #include "sysfs.h" | ||
22 | #include "bus.h" | 21 | #include "bus.h" |
23 | #include "mmc_ops.h" | 22 | #include "mmc_ops.h" |
24 | #include "sd_ops.h" | 23 | #include "sd_ops.h" |
@@ -283,6 +282,47 @@ out: | |||
283 | return err; | 282 | return err; |
284 | } | 283 | } |
285 | 284 | ||
285 | MMC_DEV_ATTR(cid, "%08x%08x%08x%08x\n", card->raw_cid[0], card->raw_cid[1], | ||
286 | card->raw_cid[2], card->raw_cid[3]); | ||
287 | MMC_DEV_ATTR(csd, "%08x%08x%08x%08x\n", card->raw_csd[0], card->raw_csd[1], | ||
288 | card->raw_csd[2], card->raw_csd[3]); | ||
289 | MMC_DEV_ATTR(scr, "%08x%08x\n", card->raw_scr[0], card->raw_scr[1]); | ||
290 | MMC_DEV_ATTR(date, "%02d/%04d\n", card->cid.month, card->cid.year); | ||
291 | MMC_DEV_ATTR(fwrev, "0x%x\n", card->cid.fwrev); | ||
292 | MMC_DEV_ATTR(hwrev, "0x%x\n", card->cid.hwrev); | ||
293 | MMC_DEV_ATTR(manfid, "0x%06x\n", card->cid.manfid); | ||
294 | MMC_DEV_ATTR(name, "%s\n", card->cid.prod_name); | ||
295 | MMC_DEV_ATTR(oemid, "0x%04x\n", card->cid.oemid); | ||
296 | MMC_DEV_ATTR(serial, "0x%08x\n", card->cid.serial); | ||
297 | |||
298 | |||
299 | static struct attribute *sd_std_attrs[] = { | ||
300 | &dev_attr_cid.attr, | ||
301 | &dev_attr_csd.attr, | ||
302 | &dev_attr_scr.attr, | ||
303 | &dev_attr_date.attr, | ||
304 | &dev_attr_fwrev.attr, | ||
305 | &dev_attr_hwrev.attr, | ||
306 | &dev_attr_manfid.attr, | ||
307 | &dev_attr_name.attr, | ||
308 | &dev_attr_oemid.attr, | ||
309 | &dev_attr_serial.attr, | ||
310 | NULL, | ||
311 | }; | ||
312 | |||
313 | static struct attribute_group sd_std_attr_group = { | ||
314 | .attrs = sd_std_attrs, | ||
315 | }; | ||
316 | |||
317 | static struct attribute_group *sd_attr_groups[] = { | ||
318 | &sd_std_attr_group, | ||
319 | NULL, | ||
320 | }; | ||
321 | |||
322 | static struct device_type sd_type = { | ||
323 | .groups = sd_attr_groups, | ||
324 | }; | ||
325 | |||
286 | /* | 326 | /* |
287 | * Handle the detection and initialisation of a card. | 327 | * Handle the detection and initialisation of a card. |
288 | * | 328 | * |
@@ -352,7 +392,7 @@ static int mmc_sd_init_card(struct mmc_host *host, u32 ocr, | |||
352 | /* | 392 | /* |
353 | * Allocate card structure. | 393 | * Allocate card structure. |
354 | */ | 394 | */ |
355 | card = mmc_alloc_card(host); | 395 | card = mmc_alloc_card(host, &sd_type); |
356 | if (IS_ERR(card)) { | 396 | if (IS_ERR(card)) { |
357 | err = PTR_ERR(card); | 397 | err = PTR_ERR(card); |
358 | goto err; | 398 | goto err; |
@@ -518,55 +558,6 @@ static void mmc_sd_detect(struct mmc_host *host) | |||
518 | } | 558 | } |
519 | } | 559 | } |
520 | 560 | ||
521 | MMC_ATTR_FN(cid, "%08x%08x%08x%08x\n", card->raw_cid[0], card->raw_cid[1], | ||
522 | card->raw_cid[2], card->raw_cid[3]); | ||
523 | MMC_ATTR_FN(csd, "%08x%08x%08x%08x\n", card->raw_csd[0], card->raw_csd[1], | ||
524 | card->raw_csd[2], card->raw_csd[3]); | ||
525 | MMC_ATTR_FN(scr, "%08x%08x\n", card->raw_scr[0], card->raw_scr[1]); | ||
526 | MMC_ATTR_FN(date, "%02d/%04d\n", card->cid.month, card->cid.year); | ||
527 | MMC_ATTR_FN(fwrev, "0x%x\n", card->cid.fwrev); | ||
528 | MMC_ATTR_FN(hwrev, "0x%x\n", card->cid.hwrev); | ||
529 | MMC_ATTR_FN(manfid, "0x%06x\n", card->cid.manfid); | ||
530 | MMC_ATTR_FN(name, "%s\n", card->cid.prod_name); | ||
531 | MMC_ATTR_FN(oemid, "0x%04x\n", card->cid.oemid); | ||
532 | MMC_ATTR_FN(serial, "0x%08x\n", card->cid.serial); | ||
533 | |||
534 | static struct device_attribute mmc_sd_dev_attrs[] = { | ||
535 | MMC_ATTR_RO(cid), | ||
536 | MMC_ATTR_RO(csd), | ||
537 | MMC_ATTR_RO(scr), | ||
538 | MMC_ATTR_RO(date), | ||
539 | MMC_ATTR_RO(fwrev), | ||
540 | MMC_ATTR_RO(hwrev), | ||
541 | MMC_ATTR_RO(manfid), | ||
542 | MMC_ATTR_RO(name), | ||
543 | MMC_ATTR_RO(oemid), | ||
544 | MMC_ATTR_RO(serial), | ||
545 | __ATTR_NULL, | ||
546 | }; | ||
547 | |||
548 | /* | ||
549 | * Adds sysfs entries as relevant. | ||
550 | */ | ||
551 | static int mmc_sd_sysfs_add(struct mmc_host *host, struct mmc_card *card) | ||
552 | { | ||
553 | int ret; | ||
554 | |||
555 | ret = mmc_add_attrs(card, mmc_sd_dev_attrs); | ||
556 | if (ret < 0) | ||
557 | return ret; | ||
558 | |||
559 | return 0; | ||
560 | } | ||
561 | |||
562 | /* | ||
563 | * Removes the sysfs entries added by mmc_sysfs_add(). | ||
564 | */ | ||
565 | static void mmc_sd_sysfs_remove(struct mmc_host *host, struct mmc_card *card) | ||
566 | { | ||
567 | mmc_remove_attrs(card, mmc_sd_dev_attrs); | ||
568 | } | ||
569 | |||
570 | #ifdef CONFIG_MMC_UNSAFE_RESUME | 561 | #ifdef CONFIG_MMC_UNSAFE_RESUME |
571 | 562 | ||
572 | /* | 563 | /* |
@@ -621,8 +612,6 @@ static void mmc_sd_resume(struct mmc_host *host) | |||
621 | static const struct mmc_bus_ops mmc_sd_ops = { | 612 | static const struct mmc_bus_ops mmc_sd_ops = { |
622 | .remove = mmc_sd_remove, | 613 | .remove = mmc_sd_remove, |
623 | .detect = mmc_sd_detect, | 614 | .detect = mmc_sd_detect, |
624 | .sysfs_add = mmc_sd_sysfs_add, | ||
625 | .sysfs_remove = mmc_sd_sysfs_remove, | ||
626 | .suspend = mmc_sd_suspend, | 615 | .suspend = mmc_sd_suspend, |
627 | .resume = mmc_sd_resume, | 616 | .resume = mmc_sd_resume, |
628 | }; | 617 | }; |
diff --git a/drivers/mmc/core/sdio.c b/drivers/mmc/core/sdio.c index 87a50f456efc..4eab79e09ccc 100644 --- a/drivers/mmc/core/sdio.c +++ b/drivers/mmc/core/sdio.c | |||
@@ -287,7 +287,7 @@ int mmc_attach_sdio(struct mmc_host *host, u32 ocr) | |||
287 | /* | 287 | /* |
288 | * Allocate card structure. | 288 | * Allocate card structure. |
289 | */ | 289 | */ |
290 | card = mmc_alloc_card(host); | 290 | card = mmc_alloc_card(host, NULL); |
291 | if (IS_ERR(card)) { | 291 | if (IS_ERR(card)) { |
292 | err = PTR_ERR(card); | 292 | err = PTR_ERR(card); |
293 | goto err; | 293 | goto err; |
diff --git a/drivers/mmc/core/sysfs.c b/drivers/mmc/core/sysfs.c deleted file mode 100644 index 00a97e70f914..000000000000 --- a/drivers/mmc/core/sysfs.c +++ /dev/null | |||
@@ -1,43 +0,0 @@ | |||
1 | /* | ||
2 | * linux/drivers/mmc/core/sysfs.c | ||
3 | * | ||
4 | * Copyright (C) 2003 Russell King, All Rights Reserved. | ||
5 | * Copyright 2007 Pierre Ossman | ||
6 | * | ||
7 | * This program is free software; you can redistribute it and/or modify | ||
8 | * it under the terms of the GNU General Public License version 2 as | ||
9 | * published by the Free Software Foundation. | ||
10 | * | ||
11 | * MMC sysfs/driver model support. | ||
12 | */ | ||
13 | #include <linux/device.h> | ||
14 | |||
15 | #include <linux/mmc/card.h> | ||
16 | |||
17 | #include "sysfs.h" | ||
18 | |||
19 | int mmc_add_attrs(struct mmc_card *card, struct device_attribute *attrs) | ||
20 | { | ||
21 | int error = 0; | ||
22 | int i; | ||
23 | |||
24 | for (i = 0; attr_name(attrs[i]); i++) { | ||
25 | error = device_create_file(&card->dev, &attrs[i]); | ||
26 | if (error) { | ||
27 | while (--i >= 0) | ||
28 | device_remove_file(&card->dev, &attrs[i]); | ||
29 | break; | ||
30 | } | ||
31 | } | ||
32 | |||
33 | return error; | ||
34 | } | ||
35 | |||
36 | void mmc_remove_attrs(struct mmc_card *card, struct device_attribute *attrs) | ||
37 | { | ||
38 | int i; | ||
39 | |||
40 | for (i = 0; attr_name(attrs[i]); i++) | ||
41 | device_remove_file(&card->dev, &attrs[i]); | ||
42 | } | ||
43 | |||
diff --git a/drivers/mmc/core/sysfs.h b/drivers/mmc/core/sysfs.h deleted file mode 100644 index 4b8f670bd10f..000000000000 --- a/drivers/mmc/core/sysfs.h +++ /dev/null | |||
@@ -1,26 +0,0 @@ | |||
1 | /* | ||
2 | * linux/drivers/mmc/core/sysfs.h | ||
3 | * | ||
4 | * Copyright (C) 2003 Russell King, All Rights Reserved. | ||
5 | * Copyright 2007 Pierre Ossman | ||
6 | * | ||
7 | * This program is free software; you can redistribute it and/or modify | ||
8 | * it under the terms of the GNU General Public License version 2 as | ||
9 | * published by the Free Software Foundation. | ||
10 | */ | ||
11 | #ifndef _MMC_CORE_SYSFS_H | ||
12 | #define _MMC_CORE_SYSFS_H | ||
13 | |||
14 | #define MMC_ATTR_FN(name, fmt, args...) \ | ||
15 | static ssize_t mmc_##name##_show (struct device *dev, struct device_attribute *attr, char *buf) \ | ||
16 | { \ | ||
17 | struct mmc_card *card = container_of(dev, struct mmc_card, dev);\ | ||
18 | return sprintf(buf, fmt, args); \ | ||
19 | } | ||
20 | |||
21 | #define MMC_ATTR_RO(name) __ATTR(name, S_IRUGO, mmc_##name##_show, NULL) | ||
22 | |||
23 | int mmc_add_attrs(struct mmc_card *card, struct device_attribute *attrs); | ||
24 | void mmc_remove_attrs(struct mmc_card *card, struct device_attribute *attrs); | ||
25 | |||
26 | #endif | ||
diff --git a/drivers/mmc/host/tifm_sd.c b/drivers/mmc/host/tifm_sd.c index 20d5c7bd940a..1c14a186f000 100644 --- a/drivers/mmc/host/tifm_sd.c +++ b/drivers/mmc/host/tifm_sd.c | |||
@@ -180,7 +180,7 @@ static void tifm_sd_transfer_data(struct tifm_sd *host) | |||
180 | host->sg_pos++; | 180 | host->sg_pos++; |
181 | if (host->sg_pos == host->sg_len) { | 181 | if (host->sg_pos == host->sg_len) { |
182 | if ((r_data->flags & MMC_DATA_WRITE) | 182 | if ((r_data->flags & MMC_DATA_WRITE) |
183 | && DATA_CARRY) | 183 | && (host->cmd_flags & DATA_CARRY)) |
184 | writel(host->bounce_buf_data[0], | 184 | writel(host->bounce_buf_data[0], |
185 | host->dev->addr | 185 | host->dev->addr |
186 | + SOCK_MMCSD_DATA); | 186 | + SOCK_MMCSD_DATA); |
diff --git a/drivers/mtd/devices/block2mtd.c b/drivers/mtd/devices/block2mtd.c index eeaaa9dce6ef..ad1880c67518 100644 --- a/drivers/mtd/devices/block2mtd.c +++ b/drivers/mtd/devices/block2mtd.c | |||
@@ -408,7 +408,6 @@ static int block2mtd_setup2(const char *val) | |||
408 | if (token[1]) { | 408 | if (token[1]) { |
409 | ret = parse_num(&erase_size, token[1]); | 409 | ret = parse_num(&erase_size, token[1]); |
410 | if (ret) { | 410 | if (ret) { |
411 | kfree(name); | ||
412 | parse_err("illegal erase size"); | 411 | parse_err("illegal erase size"); |
413 | } | 412 | } |
414 | } | 413 | } |
diff --git a/drivers/net/3c501.c b/drivers/net/3c501.c index 7d253686ed0d..5ba4bab6d43e 100644 --- a/drivers/net/3c501.c +++ b/drivers/net/3c501.c | |||
@@ -485,9 +485,7 @@ static int el_start_xmit(struct sk_buff *skb, struct net_device *dev) | |||
485 | printk(KERN_DEBUG "%s: burped during tx load.\n", | 485 | printk(KERN_DEBUG "%s: burped during tx load.\n", |
486 | dev->name); | 486 | dev->name); |
487 | spin_lock_irqsave(&lp->lock, flags); | 487 | spin_lock_irqsave(&lp->lock, flags); |
488 | } | 488 | } while (1); |
489 | while (1); | ||
490 | |||
491 | } | 489 | } |
492 | 490 | ||
493 | /** | 491 | /** |
@@ -612,7 +610,8 @@ static irqreturn_t el_interrupt(int irq, void *dev_id) | |||
612 | dev->stats.tx_packets++; | 610 | dev->stats.tx_packets++; |
613 | if (el_debug > 6) | 611 | if (el_debug > 6) |
614 | printk(KERN_DEBUG " Tx succeeded %s\n", | 612 | printk(KERN_DEBUG " Tx succeeded %s\n", |
615 | (txsr & TX_RDY) ? "." : "but tx is busy!"); | 613 | (txsr & TX_RDY) ? "." : |
614 | "but tx is busy!"); | ||
616 | /* | 615 | /* |
617 | * This is safe the interrupt is atomic WRT itself. | 616 | * This is safe the interrupt is atomic WRT itself. |
618 | */ | 617 | */ |
@@ -693,7 +692,8 @@ static void el_receive(struct net_device *dev) | |||
693 | 692 | ||
694 | if (pkt_len < 60 || pkt_len > 1536) { | 693 | if (pkt_len < 60 || pkt_len > 1536) { |
695 | if (el_debug) | 694 | if (el_debug) |
696 | printk(KERN_DEBUG "%s: bogus packet, length=%d\n", dev->name, pkt_len); | 695 | printk(KERN_DEBUG "%s: bogus packet, length=%d\n", |
696 | dev->name, pkt_len); | ||
697 | dev->stats.rx_over_errors++; | 697 | dev->stats.rx_over_errors++; |
698 | return; | 698 | return; |
699 | } | 699 | } |
@@ -711,7 +711,8 @@ static void el_receive(struct net_device *dev) | |||
711 | 711 | ||
712 | outw(0x00, GP_LOW); | 712 | outw(0x00, GP_LOW); |
713 | if (skb == NULL) { | 713 | if (skb == NULL) { |
714 | printk(KERN_INFO "%s: Memory squeeze, dropping packet.\n", dev->name); | 714 | printk(KERN_INFO "%s: Memory squeeze, dropping packet.\n", |
715 | dev->name); | ||
715 | dev->stats.rx_dropped++; | 716 | dev->stats.rx_dropped++; |
716 | return; | 717 | return; |
717 | } else { | 718 | } else { |
@@ -748,7 +749,8 @@ static void el_reset(struct net_device *dev) | |||
748 | if (el_debug > 2) | 749 | if (el_debug > 2) |
749 | printk(KERN_INFO "3c501 reset..."); | 750 | printk(KERN_INFO "3c501 reset..."); |
750 | outb(AX_RESET, AX_CMD); /* Reset the chip */ | 751 | outb(AX_RESET, AX_CMD); /* Reset the chip */ |
751 | outb(AX_LOOP, AX_CMD); /* Aux control, irq and loopback enabled */ | 752 | /* Aux control, irq and loopback enabled */ |
753 | outb(AX_LOOP, AX_CMD); | ||
752 | { | 754 | { |
753 | int i; | 755 | int i; |
754 | for (i = 0; i < 6; i++) /* Set the station address. */ | 756 | for (i = 0; i < 6; i++) /* Set the station address. */ |
diff --git a/drivers/net/atl1/atl1_main.c b/drivers/net/atl1/atl1_main.c index 9200ee59d854..129b8b3aa773 100644 --- a/drivers/net/atl1/atl1_main.c +++ b/drivers/net/atl1/atl1_main.c | |||
@@ -1765,15 +1765,12 @@ static irqreturn_t atl1_intr(int irq, void *data) | |||
1765 | { | 1765 | { |
1766 | struct atl1_adapter *adapter = netdev_priv(data); | 1766 | struct atl1_adapter *adapter = netdev_priv(data); |
1767 | u32 status; | 1767 | u32 status; |
1768 | u8 update_rx; | ||
1769 | int max_ints = 10; | 1768 | int max_ints = 10; |
1770 | 1769 | ||
1771 | status = adapter->cmb.cmb->int_stats; | 1770 | status = adapter->cmb.cmb->int_stats; |
1772 | if (!status) | 1771 | if (!status) |
1773 | return IRQ_NONE; | 1772 | return IRQ_NONE; |
1774 | 1773 | ||
1775 | update_rx = 0; | ||
1776 | |||
1777 | do { | 1774 | do { |
1778 | /* clear CMB interrupt status at once */ | 1775 | /* clear CMB interrupt status at once */ |
1779 | adapter->cmb.cmb->int_stats = 0; | 1776 | adapter->cmb.cmb->int_stats = 0; |
diff --git a/drivers/net/bnx2x.c b/drivers/net/bnx2x.c index 8af142ccf373..de32b3fba322 100644 --- a/drivers/net/bnx2x.c +++ b/drivers/net/bnx2x.c | |||
@@ -63,8 +63,8 @@ | |||
63 | #include "bnx2x.h" | 63 | #include "bnx2x.h" |
64 | #include "bnx2x_init.h" | 64 | #include "bnx2x_init.h" |
65 | 65 | ||
66 | #define DRV_MODULE_VERSION "1.40.22" | 66 | #define DRV_MODULE_VERSION "1.42.3" |
67 | #define DRV_MODULE_RELDATE "2007/11/27" | 67 | #define DRV_MODULE_RELDATE "2008/3/9" |
68 | #define BNX2X_BC_VER 0x040200 | 68 | #define BNX2X_BC_VER 0x040200 |
69 | 69 | ||
70 | /* Time in jiffies before concluding the transmitter is hung. */ | 70 | /* Time in jiffies before concluding the transmitter is hung. */ |
@@ -8008,38 +8008,6 @@ static int bnx2x_set_settings(struct net_device *dev, struct ethtool_cmd *cmd) | |||
8008 | cmd->duplex, cmd->port, cmd->phy_address, cmd->transceiver, | 8008 | cmd->duplex, cmd->port, cmd->phy_address, cmd->transceiver, |
8009 | cmd->autoneg, cmd->maxtxpkt, cmd->maxrxpkt); | 8009 | cmd->autoneg, cmd->maxtxpkt, cmd->maxrxpkt); |
8010 | 8010 | ||
8011 | switch (cmd->port) { | ||
8012 | case PORT_TP: | ||
8013 | if (!(bp->supported & SUPPORTED_TP)) { | ||
8014 | DP(NETIF_MSG_LINK, "TP not supported\n"); | ||
8015 | return -EINVAL; | ||
8016 | } | ||
8017 | |||
8018 | if (bp->phy_flags & PHY_XGXS_FLAG) { | ||
8019 | bnx2x_link_reset(bp); | ||
8020 | bnx2x_link_settings_supported(bp, SWITCH_CFG_1G); | ||
8021 | bnx2x_phy_deassert(bp); | ||
8022 | } | ||
8023 | break; | ||
8024 | |||
8025 | case PORT_FIBRE: | ||
8026 | if (!(bp->supported & SUPPORTED_FIBRE)) { | ||
8027 | DP(NETIF_MSG_LINK, "FIBRE not supported\n"); | ||
8028 | return -EINVAL; | ||
8029 | } | ||
8030 | |||
8031 | if (!(bp->phy_flags & PHY_XGXS_FLAG)) { | ||
8032 | bnx2x_link_reset(bp); | ||
8033 | bnx2x_link_settings_supported(bp, SWITCH_CFG_10G); | ||
8034 | bnx2x_phy_deassert(bp); | ||
8035 | } | ||
8036 | break; | ||
8037 | |||
8038 | default: | ||
8039 | DP(NETIF_MSG_LINK, "Unknown port type\n"); | ||
8040 | return -EINVAL; | ||
8041 | } | ||
8042 | |||
8043 | if (cmd->autoneg == AUTONEG_ENABLE) { | 8011 | if (cmd->autoneg == AUTONEG_ENABLE) { |
8044 | if (!(bp->supported & SUPPORTED_Autoneg)) { | 8012 | if (!(bp->supported & SUPPORTED_Autoneg)) { |
8045 | DP(NETIF_MSG_LINK, "Aotoneg not supported\n"); | 8013 | DP(NETIF_MSG_LINK, "Aotoneg not supported\n"); |
diff --git a/drivers/net/cxgb3/sge.c b/drivers/net/cxgb3/sge.c index 979f3fc5e765..db586870c5f4 100644 --- a/drivers/net/cxgb3/sge.c +++ b/drivers/net/cxgb3/sge.c | |||
@@ -1107,9 +1107,15 @@ int t3_eth_xmit(struct sk_buff *skb, struct net_device *dev) | |||
1107 | } | 1107 | } |
1108 | 1108 | ||
1109 | q->in_use += ndesc; | 1109 | q->in_use += ndesc; |
1110 | if (unlikely(credits - ndesc < q->stop_thres)) | 1110 | if (unlikely(credits - ndesc < q->stop_thres)) { |
1111 | if (USE_GTS || !should_restart_tx(q)) | 1111 | t3_stop_queue(dev, qs, q); |
1112 | t3_stop_queue(dev, qs, q); | 1112 | |
1113 | if (should_restart_tx(q) && | ||
1114 | test_and_clear_bit(TXQ_ETH, &qs->txq_stopped)) { | ||
1115 | q->restarts++; | ||
1116 | netif_wake_queue(dev); | ||
1117 | } | ||
1118 | } | ||
1113 | 1119 | ||
1114 | gen = q->gen; | 1120 | gen = q->gen; |
1115 | q->unacked += ndesc; | 1121 | q->unacked += ndesc; |
diff --git a/drivers/net/epic100.c b/drivers/net/epic100.c index 0b365b8d947b..76118ddd1042 100644 --- a/drivers/net/epic100.c +++ b/drivers/net/epic100.c | |||
@@ -131,8 +131,8 @@ IIIa. Ring buffers | |||
131 | 131 | ||
132 | IVb. References | 132 | IVb. References |
133 | 133 | ||
134 | http://www.smsc.com/main/datasheets/83c171.pdf | 134 | http://www.smsc.com/main/tools/discontinued/83c171.pdf |
135 | http://www.smsc.com/main/datasheets/83c175.pdf | 135 | http://www.smsc.com/main/tools/discontinued/83c175.pdf |
136 | http://scyld.com/expert/NWay.html | 136 | http://scyld.com/expert/NWay.html |
137 | http://www.national.com/pf/DP/DP83840A.html | 137 | http://www.national.com/pf/DP/DP83840A.html |
138 | 138 | ||
@@ -227,7 +227,12 @@ static const u16 media2miictl[16] = { | |||
227 | 0, 0x0C00, 0x0C00, 0x2000, 0x0100, 0x2100, 0, 0, | 227 | 0, 0x0C00, 0x0C00, 0x2000, 0x0100, 0x2100, 0, 0, |
228 | 0, 0, 0, 0, 0, 0, 0, 0 }; | 228 | 0, 0, 0, 0, 0, 0, 0, 0 }; |
229 | 229 | ||
230 | /* The EPIC100 Rx and Tx buffer descriptors. */ | 230 | /* |
231 | * The EPIC100 Rx and Tx buffer descriptors. Note that these | ||
232 | * really ARE host-endian; it's not a misannotation. We tell | ||
233 | * the card to byteswap them internally on big-endian hosts - | ||
234 | * look for #ifdef CONFIG_BIG_ENDIAN in epic_open(). | ||
235 | */ | ||
231 | 236 | ||
232 | struct epic_tx_desc { | 237 | struct epic_tx_desc { |
233 | u32 txstatus; | 238 | u32 txstatus; |
@@ -418,7 +423,7 @@ static int __devinit epic_init_one (struct pci_dev *pdev, | |||
418 | 423 | ||
419 | /* Note: the '175 does not have a serial EEPROM. */ | 424 | /* Note: the '175 does not have a serial EEPROM. */ |
420 | for (i = 0; i < 3; i++) | 425 | for (i = 0; i < 3; i++) |
421 | ((u16 *)dev->dev_addr)[i] = le16_to_cpu(inw(ioaddr + LAN0 + i*4)); | 426 | ((__le16 *)dev->dev_addr)[i] = cpu_to_le16(inw(ioaddr + LAN0 + i*4)); |
422 | 427 | ||
423 | if (debug > 2) { | 428 | if (debug > 2) { |
424 | dev_printk(KERN_DEBUG, &pdev->dev, "EEPROM contents:\n"); | 429 | dev_printk(KERN_DEBUG, &pdev->dev, "EEPROM contents:\n"); |
@@ -682,7 +687,8 @@ static int epic_open(struct net_device *dev) | |||
682 | if (ep->chip_flags & MII_PWRDWN) | 687 | if (ep->chip_flags & MII_PWRDWN) |
683 | outl((inl(ioaddr + NVCTL) & ~0x003C) | 0x4800, ioaddr + NVCTL); | 688 | outl((inl(ioaddr + NVCTL) & ~0x003C) | 0x4800, ioaddr + NVCTL); |
684 | 689 | ||
685 | #if defined(__powerpc__) || defined(__sparc__) /* Big endian */ | 690 | /* Tell the chip to byteswap descriptors on big-endian hosts */ |
691 | #ifdef CONFIG_BIG_ENDIAN | ||
686 | outl(0x4432 | (RX_FIFO_THRESH<<8), ioaddr + GENCTL); | 692 | outl(0x4432 | (RX_FIFO_THRESH<<8), ioaddr + GENCTL); |
687 | inl(ioaddr + GENCTL); | 693 | inl(ioaddr + GENCTL); |
688 | outl(0x0432 | (RX_FIFO_THRESH<<8), ioaddr + GENCTL); | 694 | outl(0x0432 | (RX_FIFO_THRESH<<8), ioaddr + GENCTL); |
@@ -695,7 +701,7 @@ static int epic_open(struct net_device *dev) | |||
695 | udelay(20); /* Looks like EPII needs that if you want reliable RX init. FIXME: pci posting bug? */ | 701 | udelay(20); /* Looks like EPII needs that if you want reliable RX init. FIXME: pci posting bug? */ |
696 | 702 | ||
697 | for (i = 0; i < 3; i++) | 703 | for (i = 0; i < 3; i++) |
698 | outl(cpu_to_le16(((u16*)dev->dev_addr)[i]), ioaddr + LAN0 + i*4); | 704 | outl(le16_to_cpu(((__le16*)dev->dev_addr)[i]), ioaddr + LAN0 + i*4); |
699 | 705 | ||
700 | ep->tx_threshold = TX_FIFO_THRESH; | 706 | ep->tx_threshold = TX_FIFO_THRESH; |
701 | outl(ep->tx_threshold, ioaddr + TxThresh); | 707 | outl(ep->tx_threshold, ioaddr + TxThresh); |
@@ -798,7 +804,7 @@ static void epic_restart(struct net_device *dev) | |||
798 | for (i = 16; i > 0; i--) | 804 | for (i = 16; i > 0; i--) |
799 | outl(0x0008, ioaddr + TEST1); | 805 | outl(0x0008, ioaddr + TEST1); |
800 | 806 | ||
801 | #if defined(__powerpc__) || defined(__sparc__) /* Big endian */ | 807 | #ifdef CONFIG_BIG_ENDIAN |
802 | outl(0x0432 | (RX_FIFO_THRESH<<8), ioaddr + GENCTL); | 808 | outl(0x0432 | (RX_FIFO_THRESH<<8), ioaddr + GENCTL); |
803 | #else | 809 | #else |
804 | outl(0x0412 | (RX_FIFO_THRESH<<8), ioaddr + GENCTL); | 810 | outl(0x0412 | (RX_FIFO_THRESH<<8), ioaddr + GENCTL); |
@@ -808,7 +814,7 @@ static void epic_restart(struct net_device *dev) | |||
808 | outl((inl(ioaddr + NVCTL) & ~0x003C) | 0x4800, ioaddr + NVCTL); | 814 | outl((inl(ioaddr + NVCTL) & ~0x003C) | 0x4800, ioaddr + NVCTL); |
809 | 815 | ||
810 | for (i = 0; i < 3; i++) | 816 | for (i = 0; i < 3; i++) |
811 | outl(cpu_to_le16(((u16*)dev->dev_addr)[i]), ioaddr + LAN0 + i*4); | 817 | outl(le16_to_cpu(((__le16*)dev->dev_addr)[i]), ioaddr + LAN0 + i*4); |
812 | 818 | ||
813 | ep->tx_threshold = TX_FIFO_THRESH; | 819 | ep->tx_threshold = TX_FIFO_THRESH; |
814 | outl(ep->tx_threshold, ioaddr + TxThresh); | 820 | outl(ep->tx_threshold, ioaddr + TxThresh); |
@@ -919,7 +925,7 @@ static void epic_init_ring(struct net_device *dev) | |||
919 | /* Initialize all Rx descriptors. */ | 925 | /* Initialize all Rx descriptors. */ |
920 | for (i = 0; i < RX_RING_SIZE; i++) { | 926 | for (i = 0; i < RX_RING_SIZE; i++) { |
921 | ep->rx_ring[i].rxstatus = 0; | 927 | ep->rx_ring[i].rxstatus = 0; |
922 | ep->rx_ring[i].buflength = cpu_to_le32(ep->rx_buf_sz); | 928 | ep->rx_ring[i].buflength = ep->rx_buf_sz; |
923 | ep->rx_ring[i].next = ep->rx_ring_dma + | 929 | ep->rx_ring[i].next = ep->rx_ring_dma + |
924 | (i+1)*sizeof(struct epic_rx_desc); | 930 | (i+1)*sizeof(struct epic_rx_desc); |
925 | ep->rx_skbuff[i] = NULL; | 931 | ep->rx_skbuff[i] = NULL; |
@@ -936,7 +942,7 @@ static void epic_init_ring(struct net_device *dev) | |||
936 | skb_reserve(skb, 2); /* 16 byte align the IP header. */ | 942 | skb_reserve(skb, 2); /* 16 byte align the IP header. */ |
937 | ep->rx_ring[i].bufaddr = pci_map_single(ep->pci_dev, | 943 | ep->rx_ring[i].bufaddr = pci_map_single(ep->pci_dev, |
938 | skb->data, ep->rx_buf_sz, PCI_DMA_FROMDEVICE); | 944 | skb->data, ep->rx_buf_sz, PCI_DMA_FROMDEVICE); |
939 | ep->rx_ring[i].rxstatus = cpu_to_le32(DescOwn); | 945 | ep->rx_ring[i].rxstatus = DescOwn; |
940 | } | 946 | } |
941 | ep->dirty_rx = (unsigned int)(i - RX_RING_SIZE); | 947 | ep->dirty_rx = (unsigned int)(i - RX_RING_SIZE); |
942 | 948 | ||
@@ -974,20 +980,20 @@ static int epic_start_xmit(struct sk_buff *skb, struct net_device *dev) | |||
974 | ep->tx_ring[entry].bufaddr = pci_map_single(ep->pci_dev, skb->data, | 980 | ep->tx_ring[entry].bufaddr = pci_map_single(ep->pci_dev, skb->data, |
975 | skb->len, PCI_DMA_TODEVICE); | 981 | skb->len, PCI_DMA_TODEVICE); |
976 | if (free_count < TX_QUEUE_LEN/2) {/* Typical path */ | 982 | if (free_count < TX_QUEUE_LEN/2) {/* Typical path */ |
977 | ctrl_word = cpu_to_le32(0x100000); /* No interrupt */ | 983 | ctrl_word = 0x100000; /* No interrupt */ |
978 | } else if (free_count == TX_QUEUE_LEN/2) { | 984 | } else if (free_count == TX_QUEUE_LEN/2) { |
979 | ctrl_word = cpu_to_le32(0x140000); /* Tx-done intr. */ | 985 | ctrl_word = 0x140000; /* Tx-done intr. */ |
980 | } else if (free_count < TX_QUEUE_LEN - 1) { | 986 | } else if (free_count < TX_QUEUE_LEN - 1) { |
981 | ctrl_word = cpu_to_le32(0x100000); /* No Tx-done intr. */ | 987 | ctrl_word = 0x100000; /* No Tx-done intr. */ |
982 | } else { | 988 | } else { |
983 | /* Leave room for an additional entry. */ | 989 | /* Leave room for an additional entry. */ |
984 | ctrl_word = cpu_to_le32(0x140000); /* Tx-done intr. */ | 990 | ctrl_word = 0x140000; /* Tx-done intr. */ |
985 | ep->tx_full = 1; | 991 | ep->tx_full = 1; |
986 | } | 992 | } |
987 | ep->tx_ring[entry].buflength = ctrl_word | cpu_to_le32(skb->len); | 993 | ep->tx_ring[entry].buflength = ctrl_word | skb->len; |
988 | ep->tx_ring[entry].txstatus = | 994 | ep->tx_ring[entry].txstatus = |
989 | ((skb->len >= ETH_ZLEN ? skb->len : ETH_ZLEN) << 16) | 995 | ((skb->len >= ETH_ZLEN ? skb->len : ETH_ZLEN) << 16) |
990 | | cpu_to_le32(DescOwn); | 996 | | DescOwn; |
991 | 997 | ||
992 | ep->cur_tx++; | 998 | ep->cur_tx++; |
993 | if (ep->tx_full) | 999 | if (ep->tx_full) |
@@ -1041,7 +1047,7 @@ static void epic_tx(struct net_device *dev, struct epic_private *ep) | |||
1041 | for (dirty_tx = ep->dirty_tx; cur_tx - dirty_tx > 0; dirty_tx++) { | 1047 | for (dirty_tx = ep->dirty_tx; cur_tx - dirty_tx > 0; dirty_tx++) { |
1042 | struct sk_buff *skb; | 1048 | struct sk_buff *skb; |
1043 | int entry = dirty_tx % TX_RING_SIZE; | 1049 | int entry = dirty_tx % TX_RING_SIZE; |
1044 | int txstatus = le32_to_cpu(ep->tx_ring[entry].txstatus); | 1050 | int txstatus = ep->tx_ring[entry].txstatus; |
1045 | 1051 | ||
1046 | if (txstatus & DescOwn) | 1052 | if (txstatus & DescOwn) |
1047 | break; /* It still hasn't been Txed */ | 1053 | break; /* It still hasn't been Txed */ |
@@ -1163,8 +1169,8 @@ static int epic_rx(struct net_device *dev, int budget) | |||
1163 | rx_work_limit = budget; | 1169 | rx_work_limit = budget; |
1164 | 1170 | ||
1165 | /* If we own the next entry, it's a new packet. Send it up. */ | 1171 | /* If we own the next entry, it's a new packet. Send it up. */ |
1166 | while ((ep->rx_ring[entry].rxstatus & cpu_to_le32(DescOwn)) == 0) { | 1172 | while ((ep->rx_ring[entry].rxstatus & DescOwn) == 0) { |
1167 | int status = le32_to_cpu(ep->rx_ring[entry].rxstatus); | 1173 | int status = ep->rx_ring[entry].rxstatus; |
1168 | 1174 | ||
1169 | if (debug > 4) | 1175 | if (debug > 4) |
1170 | printk(KERN_DEBUG " epic_rx() status was %8.8x.\n", status); | 1176 | printk(KERN_DEBUG " epic_rx() status was %8.8x.\n", status); |
@@ -1238,7 +1244,8 @@ static int epic_rx(struct net_device *dev, int budget) | |||
1238 | skb->data, ep->rx_buf_sz, PCI_DMA_FROMDEVICE); | 1244 | skb->data, ep->rx_buf_sz, PCI_DMA_FROMDEVICE); |
1239 | work_done++; | 1245 | work_done++; |
1240 | } | 1246 | } |
1241 | ep->rx_ring[entry].rxstatus = cpu_to_le32(DescOwn); | 1247 | /* AV: shouldn't we add a barrier here? */ |
1248 | ep->rx_ring[entry].rxstatus = DescOwn; | ||
1242 | } | 1249 | } |
1243 | return work_done; | 1250 | return work_done; |
1244 | } | 1251 | } |
diff --git a/drivers/net/fec_mpc52xx_phy.c b/drivers/net/fec_mpc52xx_phy.c index 1837584c4504..6a3ac4ea97e9 100644 --- a/drivers/net/fec_mpc52xx_phy.c +++ b/drivers/net/fec_mpc52xx_phy.c | |||
@@ -109,7 +109,8 @@ static int mpc52xx_fec_mdio_probe(struct of_device *of, const struct of_device_i | |||
109 | int irq = irq_of_parse_and_map(child, 0); | 109 | int irq = irq_of_parse_and_map(child, 0); |
110 | if (irq != NO_IRQ) { | 110 | if (irq != NO_IRQ) { |
111 | const u32 *id = of_get_property(child, "reg", NULL); | 111 | const u32 *id = of_get_property(child, "reg", NULL); |
112 | bus->irq[*id] = irq; | 112 | if (id) |
113 | bus->irq[*id] = irq; | ||
113 | } | 114 | } |
114 | } | 115 | } |
115 | 116 | ||
diff --git a/drivers/net/forcedeth.c b/drivers/net/forcedeth.c index 801b4d9cd972..6f7e3fde9e7c 100644 --- a/drivers/net/forcedeth.c +++ b/drivers/net/forcedeth.c | |||
@@ -184,6 +184,7 @@ | |||
184 | #define DEV_HAS_PAUSEFRAME_TX_V1 0x08000 /* device supports tx pause frames version 1 */ | 184 | #define DEV_HAS_PAUSEFRAME_TX_V1 0x08000 /* device supports tx pause frames version 1 */ |
185 | #define DEV_HAS_PAUSEFRAME_TX_V2 0x10000 /* device supports tx pause frames version 2 */ | 185 | #define DEV_HAS_PAUSEFRAME_TX_V2 0x10000 /* device supports tx pause frames version 2 */ |
186 | #define DEV_HAS_PAUSEFRAME_TX_V3 0x20000 /* device supports tx pause frames version 3 */ | 186 | #define DEV_HAS_PAUSEFRAME_TX_V3 0x20000 /* device supports tx pause frames version 3 */ |
187 | #define DEV_NEED_TX_LIMIT 0x40000 /* device needs to limit tx */ | ||
187 | 188 | ||
188 | enum { | 189 | enum { |
189 | NvRegIrqStatus = 0x000, | 190 | NvRegIrqStatus = 0x000, |
@@ -635,6 +636,8 @@ union ring_type { | |||
635 | #define NV_RESTART_TX 0x1 | 636 | #define NV_RESTART_TX 0x1 |
636 | #define NV_RESTART_RX 0x2 | 637 | #define NV_RESTART_RX 0x2 |
637 | 638 | ||
639 | #define NV_TX_LIMIT_COUNT 16 | ||
640 | |||
638 | /* statistics */ | 641 | /* statistics */ |
639 | struct nv_ethtool_str { | 642 | struct nv_ethtool_str { |
640 | char name[ETH_GSTRING_LEN]; | 643 | char name[ETH_GSTRING_LEN]; |
@@ -743,6 +746,8 @@ struct nv_skb_map { | |||
743 | struct sk_buff *skb; | 746 | struct sk_buff *skb; |
744 | dma_addr_t dma; | 747 | dma_addr_t dma; |
745 | unsigned int dma_len; | 748 | unsigned int dma_len; |
749 | struct ring_desc_ex *first_tx_desc; | ||
750 | struct nv_skb_map *next_tx_ctx; | ||
746 | }; | 751 | }; |
747 | 752 | ||
748 | /* | 753 | /* |
@@ -827,6 +832,10 @@ struct fe_priv { | |||
827 | union ring_type tx_ring; | 832 | union ring_type tx_ring; |
828 | u32 tx_flags; | 833 | u32 tx_flags; |
829 | int tx_ring_size; | 834 | int tx_ring_size; |
835 | int tx_limit; | ||
836 | u32 tx_pkts_in_progress; | ||
837 | struct nv_skb_map *tx_change_owner; | ||
838 | struct nv_skb_map *tx_end_flip; | ||
830 | int tx_stop; | 839 | int tx_stop; |
831 | 840 | ||
832 | /* vlan fields */ | 841 | /* vlan fields */ |
@@ -1707,6 +1716,9 @@ static void nv_init_tx(struct net_device *dev) | |||
1707 | np->last_tx.ex = &np->tx_ring.ex[np->tx_ring_size-1]; | 1716 | np->last_tx.ex = &np->tx_ring.ex[np->tx_ring_size-1]; |
1708 | np->get_tx_ctx = np->put_tx_ctx = np->first_tx_ctx = np->tx_skb; | 1717 | np->get_tx_ctx = np->put_tx_ctx = np->first_tx_ctx = np->tx_skb; |
1709 | np->last_tx_ctx = &np->tx_skb[np->tx_ring_size-1]; | 1718 | np->last_tx_ctx = &np->tx_skb[np->tx_ring_size-1]; |
1719 | np->tx_pkts_in_progress = 0; | ||
1720 | np->tx_change_owner = NULL; | ||
1721 | np->tx_end_flip = NULL; | ||
1710 | 1722 | ||
1711 | for (i = 0; i < np->tx_ring_size; i++) { | 1723 | for (i = 0; i < np->tx_ring_size; i++) { |
1712 | if (np->desc_ver == DESC_VER_1 || np->desc_ver == DESC_VER_2) { | 1724 | if (np->desc_ver == DESC_VER_1 || np->desc_ver == DESC_VER_2) { |
@@ -1720,6 +1732,9 @@ static void nv_init_tx(struct net_device *dev) | |||
1720 | } | 1732 | } |
1721 | np->tx_skb[i].skb = NULL; | 1733 | np->tx_skb[i].skb = NULL; |
1722 | np->tx_skb[i].dma = 0; | 1734 | np->tx_skb[i].dma = 0; |
1735 | np->tx_skb[i].dma_len = 0; | ||
1736 | np->tx_skb[i].first_tx_desc = NULL; | ||
1737 | np->tx_skb[i].next_tx_ctx = NULL; | ||
1723 | } | 1738 | } |
1724 | } | 1739 | } |
1725 | 1740 | ||
@@ -1771,7 +1786,14 @@ static void nv_drain_tx(struct net_device *dev) | |||
1771 | } | 1786 | } |
1772 | if (nv_release_txskb(dev, &np->tx_skb[i])) | 1787 | if (nv_release_txskb(dev, &np->tx_skb[i])) |
1773 | dev->stats.tx_dropped++; | 1788 | dev->stats.tx_dropped++; |
1789 | np->tx_skb[i].dma = 0; | ||
1790 | np->tx_skb[i].dma_len = 0; | ||
1791 | np->tx_skb[i].first_tx_desc = NULL; | ||
1792 | np->tx_skb[i].next_tx_ctx = NULL; | ||
1774 | } | 1793 | } |
1794 | np->tx_pkts_in_progress = 0; | ||
1795 | np->tx_change_owner = NULL; | ||
1796 | np->tx_end_flip = NULL; | ||
1775 | } | 1797 | } |
1776 | 1798 | ||
1777 | static void nv_drain_rx(struct net_device *dev) | 1799 | static void nv_drain_rx(struct net_device *dev) |
@@ -1948,6 +1970,7 @@ static int nv_start_xmit_optimized(struct sk_buff *skb, struct net_device *dev) | |||
1948 | struct ring_desc_ex* start_tx; | 1970 | struct ring_desc_ex* start_tx; |
1949 | struct ring_desc_ex* prev_tx; | 1971 | struct ring_desc_ex* prev_tx; |
1950 | struct nv_skb_map* prev_tx_ctx; | 1972 | struct nv_skb_map* prev_tx_ctx; |
1973 | struct nv_skb_map* start_tx_ctx; | ||
1951 | 1974 | ||
1952 | /* add fragments to entries count */ | 1975 | /* add fragments to entries count */ |
1953 | for (i = 0; i < fragments; i++) { | 1976 | for (i = 0; i < fragments; i++) { |
@@ -1965,6 +1988,7 @@ static int nv_start_xmit_optimized(struct sk_buff *skb, struct net_device *dev) | |||
1965 | } | 1988 | } |
1966 | 1989 | ||
1967 | start_tx = put_tx = np->put_tx.ex; | 1990 | start_tx = put_tx = np->put_tx.ex; |
1991 | start_tx_ctx = np->put_tx_ctx; | ||
1968 | 1992 | ||
1969 | /* setup the header buffer */ | 1993 | /* setup the header buffer */ |
1970 | do { | 1994 | do { |
@@ -2037,6 +2061,26 @@ static int nv_start_xmit_optimized(struct sk_buff *skb, struct net_device *dev) | |||
2037 | 2061 | ||
2038 | spin_lock_irq(&np->lock); | 2062 | spin_lock_irq(&np->lock); |
2039 | 2063 | ||
2064 | if (np->tx_limit) { | ||
2065 | /* Limit the number of outstanding tx. Setup all fragments, but | ||
2066 | * do not set the VALID bit on the first descriptor. Save a pointer | ||
2067 | * to that descriptor and also for next skb_map element. | ||
2068 | */ | ||
2069 | |||
2070 | if (np->tx_pkts_in_progress == NV_TX_LIMIT_COUNT) { | ||
2071 | if (!np->tx_change_owner) | ||
2072 | np->tx_change_owner = start_tx_ctx; | ||
2073 | |||
2074 | /* remove VALID bit */ | ||
2075 | tx_flags &= ~NV_TX2_VALID; | ||
2076 | start_tx_ctx->first_tx_desc = start_tx; | ||
2077 | start_tx_ctx->next_tx_ctx = np->put_tx_ctx; | ||
2078 | np->tx_end_flip = np->put_tx_ctx; | ||
2079 | } else { | ||
2080 | np->tx_pkts_in_progress++; | ||
2081 | } | ||
2082 | } | ||
2083 | |||
2040 | /* set tx flags */ | 2084 | /* set tx flags */ |
2041 | start_tx->flaglen |= cpu_to_le32(tx_flags | tx_flags_extra); | 2085 | start_tx->flaglen |= cpu_to_le32(tx_flags | tx_flags_extra); |
2042 | np->put_tx.ex = put_tx; | 2086 | np->put_tx.ex = put_tx; |
@@ -2060,6 +2104,25 @@ static int nv_start_xmit_optimized(struct sk_buff *skb, struct net_device *dev) | |||
2060 | return NETDEV_TX_OK; | 2104 | return NETDEV_TX_OK; |
2061 | } | 2105 | } |
2062 | 2106 | ||
2107 | static inline void nv_tx_flip_ownership(struct net_device *dev) | ||
2108 | { | ||
2109 | struct fe_priv *np = netdev_priv(dev); | ||
2110 | |||
2111 | np->tx_pkts_in_progress--; | ||
2112 | if (np->tx_change_owner) { | ||
2113 | __le32 flaglen = le32_to_cpu(np->tx_change_owner->first_tx_desc->flaglen); | ||
2114 | flaglen |= NV_TX2_VALID; | ||
2115 | np->tx_change_owner->first_tx_desc->flaglen = cpu_to_le32(flaglen); | ||
2116 | np->tx_pkts_in_progress++; | ||
2117 | |||
2118 | np->tx_change_owner = np->tx_change_owner->next_tx_ctx; | ||
2119 | if (np->tx_change_owner == np->tx_end_flip) | ||
2120 | np->tx_change_owner = NULL; | ||
2121 | |||
2122 | writel(NVREG_TXRXCTL_KICK|np->txrxctl_bits, get_hwbase(dev) + NvRegTxRxControl); | ||
2123 | } | ||
2124 | } | ||
2125 | |||
2063 | /* | 2126 | /* |
2064 | * nv_tx_done: check for completed packets, release the skbs. | 2127 | * nv_tx_done: check for completed packets, release the skbs. |
2065 | * | 2128 | * |
@@ -2147,6 +2210,10 @@ static void nv_tx_done_optimized(struct net_device *dev, int limit) | |||
2147 | dev->stats.tx_packets++; | 2210 | dev->stats.tx_packets++; |
2148 | dev_kfree_skb_any(np->get_tx_ctx->skb); | 2211 | dev_kfree_skb_any(np->get_tx_ctx->skb); |
2149 | np->get_tx_ctx->skb = NULL; | 2212 | np->get_tx_ctx->skb = NULL; |
2213 | |||
2214 | if (np->tx_limit) { | ||
2215 | nv_tx_flip_ownership(dev); | ||
2216 | } | ||
2150 | } | 2217 | } |
2151 | if (unlikely(np->get_tx.ex++ == np->last_tx.ex)) | 2218 | if (unlikely(np->get_tx.ex++ == np->last_tx.ex)) |
2152 | np->get_tx.ex = np->first_tx.ex; | 2219 | np->get_tx.ex = np->first_tx.ex; |
@@ -5333,6 +5400,21 @@ static int __devinit nv_probe(struct pci_dev *pci_dev, const struct pci_device_i | |||
5333 | np->need_linktimer = 0; | 5400 | np->need_linktimer = 0; |
5334 | } | 5401 | } |
5335 | 5402 | ||
5403 | /* Limit the number of tx's outstanding for hw bug */ | ||
5404 | if (id->driver_data & DEV_NEED_TX_LIMIT) { | ||
5405 | np->tx_limit = 1; | ||
5406 | if ((id->device == PCI_DEVICE_ID_NVIDIA_NVENET_32 || | ||
5407 | id->device == PCI_DEVICE_ID_NVIDIA_NVENET_33 || | ||
5408 | id->device == PCI_DEVICE_ID_NVIDIA_NVENET_34 || | ||
5409 | id->device == PCI_DEVICE_ID_NVIDIA_NVENET_35 || | ||
5410 | id->device == PCI_DEVICE_ID_NVIDIA_NVENET_36 || | ||
5411 | id->device == PCI_DEVICE_ID_NVIDIA_NVENET_37 || | ||
5412 | id->device == PCI_DEVICE_ID_NVIDIA_NVENET_38 || | ||
5413 | id->device == PCI_DEVICE_ID_NVIDIA_NVENET_39) && | ||
5414 | pci_dev->revision >= 0xA2) | ||
5415 | np->tx_limit = 0; | ||
5416 | } | ||
5417 | |||
5336 | /* clear phy state and temporarily halt phy interrupts */ | 5418 | /* clear phy state and temporarily halt phy interrupts */ |
5337 | writel(0, base + NvRegMIIMask); | 5419 | writel(0, base + NvRegMIIMask); |
5338 | phystate = readl(base + NvRegAdapterControl); | 5420 | phystate = readl(base + NvRegAdapterControl); |
@@ -5563,19 +5645,19 @@ static struct pci_device_id pci_tbl[] = { | |||
5563 | }, | 5645 | }, |
5564 | { /* CK804 Ethernet Controller */ | 5646 | { /* CK804 Ethernet Controller */ |
5565 | PCI_DEVICE(PCI_VENDOR_ID_NVIDIA, PCI_DEVICE_ID_NVIDIA_NVENET_8), | 5647 | PCI_DEVICE(PCI_VENDOR_ID_NVIDIA, PCI_DEVICE_ID_NVIDIA_NVENET_8), |
5566 | .driver_data = DEV_NEED_TIMERIRQ|DEV_NEED_LINKTIMER|DEV_HAS_LARGEDESC|DEV_HAS_CHECKSUM|DEV_HAS_HIGH_DMA|DEV_HAS_STATISTICS_V1, | 5648 | .driver_data = DEV_NEED_TIMERIRQ|DEV_NEED_LINKTIMER|DEV_HAS_LARGEDESC|DEV_HAS_CHECKSUM|DEV_HAS_HIGH_DMA|DEV_HAS_STATISTICS_V1|DEV_NEED_TX_LIMIT, |
5567 | }, | 5649 | }, |
5568 | { /* CK804 Ethernet Controller */ | 5650 | { /* CK804 Ethernet Controller */ |
5569 | PCI_DEVICE(PCI_VENDOR_ID_NVIDIA, PCI_DEVICE_ID_NVIDIA_NVENET_9), | 5651 | PCI_DEVICE(PCI_VENDOR_ID_NVIDIA, PCI_DEVICE_ID_NVIDIA_NVENET_9), |
5570 | .driver_data = DEV_NEED_TIMERIRQ|DEV_NEED_LINKTIMER|DEV_HAS_LARGEDESC|DEV_HAS_CHECKSUM|DEV_HAS_HIGH_DMA|DEV_HAS_STATISTICS_V1, | 5652 | .driver_data = DEV_NEED_TIMERIRQ|DEV_NEED_LINKTIMER|DEV_HAS_LARGEDESC|DEV_HAS_CHECKSUM|DEV_HAS_HIGH_DMA|DEV_HAS_STATISTICS_V1|DEV_NEED_TX_LIMIT, |
5571 | }, | 5653 | }, |
5572 | { /* MCP04 Ethernet Controller */ | 5654 | { /* MCP04 Ethernet Controller */ |
5573 | PCI_DEVICE(PCI_VENDOR_ID_NVIDIA, PCI_DEVICE_ID_NVIDIA_NVENET_10), | 5655 | PCI_DEVICE(PCI_VENDOR_ID_NVIDIA, PCI_DEVICE_ID_NVIDIA_NVENET_10), |
5574 | .driver_data = DEV_NEED_TIMERIRQ|DEV_NEED_LINKTIMER|DEV_HAS_LARGEDESC|DEV_HAS_CHECKSUM|DEV_HAS_HIGH_DMA|DEV_HAS_STATISTICS_V1, | 5656 | .driver_data = DEV_NEED_TIMERIRQ|DEV_NEED_LINKTIMER|DEV_HAS_LARGEDESC|DEV_HAS_CHECKSUM|DEV_HAS_HIGH_DMA|DEV_HAS_STATISTICS_V1|DEV_NEED_TX_LIMIT, |
5575 | }, | 5657 | }, |
5576 | { /* MCP04 Ethernet Controller */ | 5658 | { /* MCP04 Ethernet Controller */ |
5577 | PCI_DEVICE(PCI_VENDOR_ID_NVIDIA, PCI_DEVICE_ID_NVIDIA_NVENET_11), | 5659 | PCI_DEVICE(PCI_VENDOR_ID_NVIDIA, PCI_DEVICE_ID_NVIDIA_NVENET_11), |
5578 | .driver_data = DEV_NEED_TIMERIRQ|DEV_NEED_LINKTIMER|DEV_HAS_LARGEDESC|DEV_HAS_CHECKSUM|DEV_HAS_HIGH_DMA|DEV_HAS_STATISTICS_V1, | 5660 | .driver_data = DEV_NEED_TIMERIRQ|DEV_NEED_LINKTIMER|DEV_HAS_LARGEDESC|DEV_HAS_CHECKSUM|DEV_HAS_HIGH_DMA|DEV_HAS_STATISTICS_V1|DEV_NEED_TX_LIMIT, |
5579 | }, | 5661 | }, |
5580 | { /* MCP51 Ethernet Controller */ | 5662 | { /* MCP51 Ethernet Controller */ |
5581 | PCI_DEVICE(PCI_VENDOR_ID_NVIDIA, PCI_DEVICE_ID_NVIDIA_NVENET_12), | 5663 | PCI_DEVICE(PCI_VENDOR_ID_NVIDIA, PCI_DEVICE_ID_NVIDIA_NVENET_12), |
@@ -5587,11 +5669,11 @@ static struct pci_device_id pci_tbl[] = { | |||
5587 | }, | 5669 | }, |
5588 | { /* MCP55 Ethernet Controller */ | 5670 | { /* MCP55 Ethernet Controller */ |
5589 | PCI_DEVICE(PCI_VENDOR_ID_NVIDIA, PCI_DEVICE_ID_NVIDIA_NVENET_14), | 5671 | PCI_DEVICE(PCI_VENDOR_ID_NVIDIA, PCI_DEVICE_ID_NVIDIA_NVENET_14), |
5590 | .driver_data = DEV_NEED_TIMERIRQ|DEV_NEED_LINKTIMER|DEV_HAS_LARGEDESC|DEV_HAS_CHECKSUM|DEV_HAS_HIGH_DMA|DEV_HAS_VLAN|DEV_HAS_MSI|DEV_HAS_MSI_X|DEV_HAS_POWER_CNTRL|DEV_HAS_PAUSEFRAME_TX_V1|DEV_HAS_STATISTICS_V2|DEV_HAS_TEST_EXTENDED|DEV_HAS_MGMT_UNIT, | 5672 | .driver_data = DEV_NEED_TIMERIRQ|DEV_NEED_LINKTIMER|DEV_HAS_LARGEDESC|DEV_HAS_CHECKSUM|DEV_HAS_HIGH_DMA|DEV_HAS_VLAN|DEV_HAS_MSI|DEV_HAS_MSI_X|DEV_HAS_POWER_CNTRL|DEV_HAS_PAUSEFRAME_TX_V1|DEV_HAS_STATISTICS_V2|DEV_HAS_TEST_EXTENDED|DEV_HAS_MGMT_UNIT|DEV_NEED_TX_LIMIT, |
5591 | }, | 5673 | }, |
5592 | { /* MCP55 Ethernet Controller */ | 5674 | { /* MCP55 Ethernet Controller */ |
5593 | PCI_DEVICE(PCI_VENDOR_ID_NVIDIA, PCI_DEVICE_ID_NVIDIA_NVENET_15), | 5675 | PCI_DEVICE(PCI_VENDOR_ID_NVIDIA, PCI_DEVICE_ID_NVIDIA_NVENET_15), |
5594 | .driver_data = DEV_NEED_TIMERIRQ|DEV_NEED_LINKTIMER|DEV_HAS_LARGEDESC|DEV_HAS_CHECKSUM|DEV_HAS_HIGH_DMA|DEV_HAS_VLAN|DEV_HAS_MSI|DEV_HAS_MSI_X|DEV_HAS_POWER_CNTRL|DEV_HAS_PAUSEFRAME_TX_V1|DEV_HAS_STATISTICS_V2|DEV_HAS_TEST_EXTENDED|DEV_HAS_MGMT_UNIT, | 5676 | .driver_data = DEV_NEED_TIMERIRQ|DEV_NEED_LINKTIMER|DEV_HAS_LARGEDESC|DEV_HAS_CHECKSUM|DEV_HAS_HIGH_DMA|DEV_HAS_VLAN|DEV_HAS_MSI|DEV_HAS_MSI_X|DEV_HAS_POWER_CNTRL|DEV_HAS_PAUSEFRAME_TX_V1|DEV_HAS_STATISTICS_V2|DEV_HAS_TEST_EXTENDED|DEV_HAS_MGMT_UNIT|DEV_NEED_TX_LIMIT, |
5595 | }, | 5677 | }, |
5596 | { /* MCP61 Ethernet Controller */ | 5678 | { /* MCP61 Ethernet Controller */ |
5597 | PCI_DEVICE(PCI_VENDOR_ID_NVIDIA, PCI_DEVICE_ID_NVIDIA_NVENET_16), | 5679 | PCI_DEVICE(PCI_VENDOR_ID_NVIDIA, PCI_DEVICE_ID_NVIDIA_NVENET_16), |
@@ -5611,19 +5693,19 @@ static struct pci_device_id pci_tbl[] = { | |||
5611 | }, | 5693 | }, |
5612 | { /* MCP65 Ethernet Controller */ | 5694 | { /* MCP65 Ethernet Controller */ |
5613 | PCI_DEVICE(PCI_VENDOR_ID_NVIDIA, PCI_DEVICE_ID_NVIDIA_NVENET_20), | 5695 | PCI_DEVICE(PCI_VENDOR_ID_NVIDIA, PCI_DEVICE_ID_NVIDIA_NVENET_20), |
5614 | .driver_data = DEV_NEED_TIMERIRQ|DEV_NEED_LINKTIMER|DEV_HAS_LARGEDESC|DEV_HAS_HIGH_DMA|DEV_HAS_POWER_CNTRL|DEV_HAS_MSI|DEV_HAS_PAUSEFRAME_TX_V1|DEV_HAS_STATISTICS_V2|DEV_HAS_TEST_EXTENDED|DEV_HAS_MGMT_UNIT|DEV_HAS_CORRECT_MACADDR, | 5696 | .driver_data = DEV_NEED_TIMERIRQ|DEV_NEED_LINKTIMER|DEV_HAS_LARGEDESC|DEV_HAS_HIGH_DMA|DEV_HAS_POWER_CNTRL|DEV_HAS_MSI|DEV_HAS_PAUSEFRAME_TX_V1|DEV_HAS_STATISTICS_V2|DEV_HAS_TEST_EXTENDED|DEV_HAS_MGMT_UNIT|DEV_HAS_CORRECT_MACADDR|DEV_NEED_TX_LIMIT|DEV_NEED_TX_LIMIT, |
5615 | }, | 5697 | }, |
5616 | { /* MCP65 Ethernet Controller */ | 5698 | { /* MCP65 Ethernet Controller */ |
5617 | PCI_DEVICE(PCI_VENDOR_ID_NVIDIA, PCI_DEVICE_ID_NVIDIA_NVENET_21), | 5699 | PCI_DEVICE(PCI_VENDOR_ID_NVIDIA, PCI_DEVICE_ID_NVIDIA_NVENET_21), |
5618 | .driver_data = DEV_NEED_TIMERIRQ|DEV_NEED_LINKTIMER|DEV_HAS_LARGEDESC|DEV_HAS_HIGH_DMA|DEV_HAS_POWER_CNTRL|DEV_HAS_MSI|DEV_HAS_PAUSEFRAME_TX_V1|DEV_HAS_STATISTICS_V2|DEV_HAS_TEST_EXTENDED|DEV_HAS_MGMT_UNIT|DEV_HAS_CORRECT_MACADDR, | 5700 | .driver_data = DEV_NEED_TIMERIRQ|DEV_NEED_LINKTIMER|DEV_HAS_LARGEDESC|DEV_HAS_HIGH_DMA|DEV_HAS_POWER_CNTRL|DEV_HAS_MSI|DEV_HAS_PAUSEFRAME_TX_V1|DEV_HAS_STATISTICS_V2|DEV_HAS_TEST_EXTENDED|DEV_HAS_MGMT_UNIT|DEV_HAS_CORRECT_MACADDR|DEV_NEED_TX_LIMIT, |
5619 | }, | 5701 | }, |
5620 | { /* MCP65 Ethernet Controller */ | 5702 | { /* MCP65 Ethernet Controller */ |
5621 | PCI_DEVICE(PCI_VENDOR_ID_NVIDIA, PCI_DEVICE_ID_NVIDIA_NVENET_22), | 5703 | PCI_DEVICE(PCI_VENDOR_ID_NVIDIA, PCI_DEVICE_ID_NVIDIA_NVENET_22), |
5622 | .driver_data = DEV_NEED_TIMERIRQ|DEV_NEED_LINKTIMER|DEV_HAS_LARGEDESC|DEV_HAS_HIGH_DMA|DEV_HAS_POWER_CNTRL|DEV_HAS_MSI|DEV_HAS_PAUSEFRAME_TX_V1|DEV_HAS_STATISTICS_V2|DEV_HAS_TEST_EXTENDED|DEV_HAS_MGMT_UNIT|DEV_HAS_CORRECT_MACADDR, | 5704 | .driver_data = DEV_NEED_TIMERIRQ|DEV_NEED_LINKTIMER|DEV_HAS_LARGEDESC|DEV_HAS_HIGH_DMA|DEV_HAS_POWER_CNTRL|DEV_HAS_MSI|DEV_HAS_PAUSEFRAME_TX_V1|DEV_HAS_STATISTICS_V2|DEV_HAS_TEST_EXTENDED|DEV_HAS_MGMT_UNIT|DEV_HAS_CORRECT_MACADDR|DEV_NEED_TX_LIMIT, |
5623 | }, | 5705 | }, |
5624 | { /* MCP65 Ethernet Controller */ | 5706 | { /* MCP65 Ethernet Controller */ |
5625 | PCI_DEVICE(PCI_VENDOR_ID_NVIDIA, PCI_DEVICE_ID_NVIDIA_NVENET_23), | 5707 | PCI_DEVICE(PCI_VENDOR_ID_NVIDIA, PCI_DEVICE_ID_NVIDIA_NVENET_23), |
5626 | .driver_data = DEV_NEED_TIMERIRQ|DEV_NEED_LINKTIMER|DEV_HAS_LARGEDESC|DEV_HAS_HIGH_DMA|DEV_HAS_POWER_CNTRL|DEV_HAS_MSI|DEV_HAS_PAUSEFRAME_TX_V1|DEV_HAS_STATISTICS_V2|DEV_HAS_TEST_EXTENDED|DEV_HAS_MGMT_UNIT|DEV_HAS_CORRECT_MACADDR, | 5708 | .driver_data = DEV_NEED_TIMERIRQ|DEV_NEED_LINKTIMER|DEV_HAS_LARGEDESC|DEV_HAS_HIGH_DMA|DEV_HAS_POWER_CNTRL|DEV_HAS_MSI|DEV_HAS_PAUSEFRAME_TX_V1|DEV_HAS_STATISTICS_V2|DEV_HAS_TEST_EXTENDED|DEV_HAS_MGMT_UNIT|DEV_HAS_CORRECT_MACADDR|DEV_NEED_TX_LIMIT, |
5627 | }, | 5709 | }, |
5628 | { /* MCP67 Ethernet Controller */ | 5710 | { /* MCP67 Ethernet Controller */ |
5629 | PCI_DEVICE(PCI_VENDOR_ID_NVIDIA, PCI_DEVICE_ID_NVIDIA_NVENET_24), | 5711 | PCI_DEVICE(PCI_VENDOR_ID_NVIDIA, PCI_DEVICE_ID_NVIDIA_NVENET_24), |
@@ -5659,35 +5741,35 @@ static struct pci_device_id pci_tbl[] = { | |||
5659 | }, | 5741 | }, |
5660 | { /* MCP77 Ethernet Controller */ | 5742 | { /* MCP77 Ethernet Controller */ |
5661 | PCI_DEVICE(PCI_VENDOR_ID_NVIDIA, PCI_DEVICE_ID_NVIDIA_NVENET_32), | 5743 | PCI_DEVICE(PCI_VENDOR_ID_NVIDIA, PCI_DEVICE_ID_NVIDIA_NVENET_32), |
5662 | .driver_data = DEV_NEED_TIMERIRQ|DEV_NEED_LINKTIMER|DEV_HAS_CHECKSUM|DEV_HAS_HIGH_DMA|DEV_HAS_MSI|DEV_HAS_POWER_CNTRL|DEV_HAS_PAUSEFRAME_TX_V2|DEV_HAS_STATISTICS_V2|DEV_HAS_TEST_EXTENDED|DEV_HAS_MGMT_UNIT|DEV_HAS_CORRECT_MACADDR|DEV_HAS_COLLISION_FIX, | 5744 | .driver_data = DEV_NEED_TIMERIRQ|DEV_NEED_LINKTIMER|DEV_HAS_CHECKSUM|DEV_HAS_HIGH_DMA|DEV_HAS_MSI|DEV_HAS_POWER_CNTRL|DEV_HAS_PAUSEFRAME_TX_V2|DEV_HAS_STATISTICS_V2|DEV_HAS_TEST_EXTENDED|DEV_HAS_MGMT_UNIT|DEV_HAS_CORRECT_MACADDR|DEV_HAS_COLLISION_FIX|DEV_NEED_TX_LIMIT, |
5663 | }, | 5745 | }, |
5664 | { /* MCP77 Ethernet Controller */ | 5746 | { /* MCP77 Ethernet Controller */ |
5665 | PCI_DEVICE(PCI_VENDOR_ID_NVIDIA, PCI_DEVICE_ID_NVIDIA_NVENET_33), | 5747 | PCI_DEVICE(PCI_VENDOR_ID_NVIDIA, PCI_DEVICE_ID_NVIDIA_NVENET_33), |
5666 | .driver_data = DEV_NEED_TIMERIRQ|DEV_NEED_LINKTIMER|DEV_HAS_CHECKSUM|DEV_HAS_HIGH_DMA|DEV_HAS_MSI|DEV_HAS_POWER_CNTRL|DEV_HAS_PAUSEFRAME_TX_V2|DEV_HAS_STATISTICS_V2|DEV_HAS_TEST_EXTENDED|DEV_HAS_MGMT_UNIT|DEV_HAS_CORRECT_MACADDR|DEV_HAS_COLLISION_FIX, | 5748 | .driver_data = DEV_NEED_TIMERIRQ|DEV_NEED_LINKTIMER|DEV_HAS_CHECKSUM|DEV_HAS_HIGH_DMA|DEV_HAS_MSI|DEV_HAS_POWER_CNTRL|DEV_HAS_PAUSEFRAME_TX_V2|DEV_HAS_STATISTICS_V2|DEV_HAS_TEST_EXTENDED|DEV_HAS_MGMT_UNIT|DEV_HAS_CORRECT_MACADDR|DEV_HAS_COLLISION_FIX|DEV_NEED_TX_LIMIT, |
5667 | }, | 5749 | }, |
5668 | { /* MCP77 Ethernet Controller */ | 5750 | { /* MCP77 Ethernet Controller */ |
5669 | PCI_DEVICE(PCI_VENDOR_ID_NVIDIA, PCI_DEVICE_ID_NVIDIA_NVENET_34), | 5751 | PCI_DEVICE(PCI_VENDOR_ID_NVIDIA, PCI_DEVICE_ID_NVIDIA_NVENET_34), |
5670 | .driver_data = DEV_NEED_TIMERIRQ|DEV_NEED_LINKTIMER|DEV_HAS_CHECKSUM|DEV_HAS_HIGH_DMA|DEV_HAS_MSI|DEV_HAS_POWER_CNTRL|DEV_HAS_PAUSEFRAME_TX_V2|DEV_HAS_STATISTICS_V2|DEV_HAS_TEST_EXTENDED|DEV_HAS_MGMT_UNIT|DEV_HAS_CORRECT_MACADDR|DEV_HAS_COLLISION_FIX, | 5752 | .driver_data = DEV_NEED_TIMERIRQ|DEV_NEED_LINKTIMER|DEV_HAS_CHECKSUM|DEV_HAS_HIGH_DMA|DEV_HAS_MSI|DEV_HAS_POWER_CNTRL|DEV_HAS_PAUSEFRAME_TX_V2|DEV_HAS_STATISTICS_V2|DEV_HAS_TEST_EXTENDED|DEV_HAS_MGMT_UNIT|DEV_HAS_CORRECT_MACADDR|DEV_HAS_COLLISION_FIX|DEV_NEED_TX_LIMIT, |
5671 | }, | 5753 | }, |
5672 | { /* MCP77 Ethernet Controller */ | 5754 | { /* MCP77 Ethernet Controller */ |
5673 | PCI_DEVICE(PCI_VENDOR_ID_NVIDIA, PCI_DEVICE_ID_NVIDIA_NVENET_35), | 5755 | PCI_DEVICE(PCI_VENDOR_ID_NVIDIA, PCI_DEVICE_ID_NVIDIA_NVENET_35), |
5674 | .driver_data = DEV_NEED_TIMERIRQ|DEV_NEED_LINKTIMER|DEV_HAS_CHECKSUM|DEV_HAS_HIGH_DMA|DEV_HAS_MSI|DEV_HAS_POWER_CNTRL|DEV_HAS_PAUSEFRAME_TX_V2|DEV_HAS_STATISTICS_V2|DEV_HAS_TEST_EXTENDED|DEV_HAS_MGMT_UNIT|DEV_HAS_CORRECT_MACADDR|DEV_HAS_COLLISION_FIX, | 5756 | .driver_data = DEV_NEED_TIMERIRQ|DEV_NEED_LINKTIMER|DEV_HAS_CHECKSUM|DEV_HAS_HIGH_DMA|DEV_HAS_MSI|DEV_HAS_POWER_CNTRL|DEV_HAS_PAUSEFRAME_TX_V2|DEV_HAS_STATISTICS_V2|DEV_HAS_TEST_EXTENDED|DEV_HAS_MGMT_UNIT|DEV_HAS_CORRECT_MACADDR|DEV_HAS_COLLISION_FIX|DEV_NEED_TX_LIMIT, |
5675 | }, | 5757 | }, |
5676 | { /* MCP79 Ethernet Controller */ | 5758 | { /* MCP79 Ethernet Controller */ |
5677 | PCI_DEVICE(PCI_VENDOR_ID_NVIDIA, PCI_DEVICE_ID_NVIDIA_NVENET_36), | 5759 | PCI_DEVICE(PCI_VENDOR_ID_NVIDIA, PCI_DEVICE_ID_NVIDIA_NVENET_36), |
5678 | .driver_data = DEV_NEED_TIMERIRQ|DEV_NEED_LINKTIMER|DEV_HAS_CHECKSUM|DEV_HAS_HIGH_DMA|DEV_HAS_MSI|DEV_HAS_POWER_CNTRL|DEV_HAS_PAUSEFRAME_TX_V3|DEV_HAS_STATISTICS_V2|DEV_HAS_TEST_EXTENDED|DEV_HAS_MGMT_UNIT|DEV_HAS_CORRECT_MACADDR|DEV_HAS_COLLISION_FIX, | 5760 | .driver_data = DEV_NEED_TIMERIRQ|DEV_NEED_LINKTIMER|DEV_HAS_CHECKSUM|DEV_HAS_HIGH_DMA|DEV_HAS_MSI|DEV_HAS_POWER_CNTRL|DEV_HAS_PAUSEFRAME_TX_V3|DEV_HAS_STATISTICS_V2|DEV_HAS_TEST_EXTENDED|DEV_HAS_MGMT_UNIT|DEV_HAS_CORRECT_MACADDR|DEV_HAS_COLLISION_FIX|DEV_NEED_TX_LIMIT, |
5679 | }, | 5761 | }, |
5680 | { /* MCP79 Ethernet Controller */ | 5762 | { /* MCP79 Ethernet Controller */ |
5681 | PCI_DEVICE(PCI_VENDOR_ID_NVIDIA, PCI_DEVICE_ID_NVIDIA_NVENET_37), | 5763 | PCI_DEVICE(PCI_VENDOR_ID_NVIDIA, PCI_DEVICE_ID_NVIDIA_NVENET_37), |
5682 | .driver_data = DEV_NEED_TIMERIRQ|DEV_NEED_LINKTIMER|DEV_HAS_CHECKSUM|DEV_HAS_HIGH_DMA|DEV_HAS_MSI|DEV_HAS_POWER_CNTRL|DEV_HAS_PAUSEFRAME_TX_V3|DEV_HAS_STATISTICS_V2|DEV_HAS_TEST_EXTENDED|DEV_HAS_MGMT_UNIT|DEV_HAS_CORRECT_MACADDR|DEV_HAS_COLLISION_FIX, | 5764 | .driver_data = DEV_NEED_TIMERIRQ|DEV_NEED_LINKTIMER|DEV_HAS_CHECKSUM|DEV_HAS_HIGH_DMA|DEV_HAS_MSI|DEV_HAS_POWER_CNTRL|DEV_HAS_PAUSEFRAME_TX_V3|DEV_HAS_STATISTICS_V2|DEV_HAS_TEST_EXTENDED|DEV_HAS_MGMT_UNIT|DEV_HAS_CORRECT_MACADDR|DEV_HAS_COLLISION_FIX|DEV_NEED_TX_LIMIT, |
5683 | }, | 5765 | }, |
5684 | { /* MCP79 Ethernet Controller */ | 5766 | { /* MCP79 Ethernet Controller */ |
5685 | PCI_DEVICE(PCI_VENDOR_ID_NVIDIA, PCI_DEVICE_ID_NVIDIA_NVENET_38), | 5767 | PCI_DEVICE(PCI_VENDOR_ID_NVIDIA, PCI_DEVICE_ID_NVIDIA_NVENET_38), |
5686 | .driver_data = DEV_NEED_TIMERIRQ|DEV_NEED_LINKTIMER|DEV_HAS_CHECKSUM|DEV_HAS_HIGH_DMA|DEV_HAS_MSI|DEV_HAS_POWER_CNTRL|DEV_HAS_PAUSEFRAME_TX_V3|DEV_HAS_STATISTICS_V2|DEV_HAS_TEST_EXTENDED|DEV_HAS_MGMT_UNIT|DEV_HAS_CORRECT_MACADDR|DEV_HAS_COLLISION_FIX, | 5768 | .driver_data = DEV_NEED_TIMERIRQ|DEV_NEED_LINKTIMER|DEV_HAS_CHECKSUM|DEV_HAS_HIGH_DMA|DEV_HAS_MSI|DEV_HAS_POWER_CNTRL|DEV_HAS_PAUSEFRAME_TX_V3|DEV_HAS_STATISTICS_V2|DEV_HAS_TEST_EXTENDED|DEV_HAS_MGMT_UNIT|DEV_HAS_CORRECT_MACADDR|DEV_HAS_COLLISION_FIX|DEV_NEED_TX_LIMIT, |
5687 | }, | 5769 | }, |
5688 | { /* MCP79 Ethernet Controller */ | 5770 | { /* MCP79 Ethernet Controller */ |
5689 | PCI_DEVICE(PCI_VENDOR_ID_NVIDIA, PCI_DEVICE_ID_NVIDIA_NVENET_39), | 5771 | PCI_DEVICE(PCI_VENDOR_ID_NVIDIA, PCI_DEVICE_ID_NVIDIA_NVENET_39), |
5690 | .driver_data = DEV_NEED_TIMERIRQ|DEV_NEED_LINKTIMER|DEV_HAS_CHECKSUM|DEV_HAS_HIGH_DMA|DEV_HAS_MSI|DEV_HAS_POWER_CNTRL|DEV_HAS_PAUSEFRAME_TX_V3|DEV_HAS_STATISTICS_V2|DEV_HAS_TEST_EXTENDED|DEV_HAS_MGMT_UNIT|DEV_HAS_CORRECT_MACADDR|DEV_HAS_COLLISION_FIX, | 5772 | .driver_data = DEV_NEED_TIMERIRQ|DEV_NEED_LINKTIMER|DEV_HAS_CHECKSUM|DEV_HAS_HIGH_DMA|DEV_HAS_MSI|DEV_HAS_POWER_CNTRL|DEV_HAS_PAUSEFRAME_TX_V3|DEV_HAS_STATISTICS_V2|DEV_HAS_TEST_EXTENDED|DEV_HAS_MGMT_UNIT|DEV_HAS_CORRECT_MACADDR|DEV_HAS_COLLISION_FIX|DEV_NEED_TX_LIMIT, |
5691 | }, | 5773 | }, |
5692 | {0,}, | 5774 | {0,}, |
5693 | }; | 5775 | }; |
diff --git a/drivers/net/ibm_newemac/core.c b/drivers/net/ibm_newemac/core.c index e6c69f77259b..0789802d59ed 100644 --- a/drivers/net/ibm_newemac/core.c +++ b/drivers/net/ibm_newemac/core.c | |||
@@ -143,6 +143,10 @@ static inline void emac_report_timeout_error(struct emac_instance *dev, | |||
143 | #define STOP_TIMEOUT_1000 13 | 143 | #define STOP_TIMEOUT_1000 13 |
144 | #define STOP_TIMEOUT_1000_JUMBO 73 | 144 | #define STOP_TIMEOUT_1000_JUMBO 73 |
145 | 145 | ||
146 | static unsigned char default_mcast_addr[] = { | ||
147 | 0x01, 0x80, 0xC2, 0x00, 0x00, 0x01 | ||
148 | }; | ||
149 | |||
146 | /* Please, keep in sync with struct ibm_emac_stats/ibm_emac_error_stats */ | 150 | /* Please, keep in sync with struct ibm_emac_stats/ibm_emac_error_stats */ |
147 | static const char emac_stats_keys[EMAC_ETHTOOL_STATS_COUNT][ETH_GSTRING_LEN] = { | 151 | static const char emac_stats_keys[EMAC_ETHTOOL_STATS_COUNT][ETH_GSTRING_LEN] = { |
148 | "rx_packets", "rx_bytes", "tx_packets", "tx_bytes", "rx_packets_csum", | 152 | "rx_packets", "rx_bytes", "tx_packets", "tx_bytes", "rx_packets_csum", |
@@ -618,6 +622,9 @@ static int emac_configure(struct emac_instance *dev) | |||
618 | if (emac_phy_gpcs(dev->phy.mode)) | 622 | if (emac_phy_gpcs(dev->phy.mode)) |
619 | emac_mii_reset_phy(&dev->phy); | 623 | emac_mii_reset_phy(&dev->phy); |
620 | 624 | ||
625 | /* Required for Pause packet support in EMAC */ | ||
626 | dev_mc_add(ndev, default_mcast_addr, sizeof(default_mcast_addr), 1); | ||
627 | |||
621 | return 0; | 628 | return 0; |
622 | } | 629 | } |
623 | 630 | ||
diff --git a/drivers/net/ibm_newemac/tah.c b/drivers/net/ibm_newemac/tah.c index 96417adec326..b023d10d7e1c 100644 --- a/drivers/net/ibm_newemac/tah.c +++ b/drivers/net/ibm_newemac/tah.c | |||
@@ -155,6 +155,10 @@ static int __devexit tah_remove(struct of_device *ofdev) | |||
155 | static struct of_device_id tah_match[] = | 155 | static struct of_device_id tah_match[] = |
156 | { | 156 | { |
157 | { | 157 | { |
158 | .compatible = "ibm,tah", | ||
159 | }, | ||
160 | /* For backward compat with old DT */ | ||
161 | { | ||
158 | .type = "tah", | 162 | .type = "tah", |
159 | }, | 163 | }, |
160 | {}, | 164 | {}, |
diff --git a/drivers/net/ifb.c b/drivers/net/ifb.c index 15949d3df17e..af233b591534 100644 --- a/drivers/net/ifb.c +++ b/drivers/net/ifb.c | |||
@@ -35,6 +35,7 @@ | |||
35 | #include <linux/moduleparam.h> | 35 | #include <linux/moduleparam.h> |
36 | #include <net/pkt_sched.h> | 36 | #include <net/pkt_sched.h> |
37 | #include <net/net_namespace.h> | 37 | #include <net/net_namespace.h> |
38 | #include <linux/lockdep.h> | ||
38 | 39 | ||
39 | #define TX_TIMEOUT (2*HZ) | 40 | #define TX_TIMEOUT (2*HZ) |
40 | 41 | ||
@@ -227,6 +228,16 @@ static struct rtnl_link_ops ifb_link_ops __read_mostly = { | |||
227 | module_param(numifbs, int, 0); | 228 | module_param(numifbs, int, 0); |
228 | MODULE_PARM_DESC(numifbs, "Number of ifb devices"); | 229 | MODULE_PARM_DESC(numifbs, "Number of ifb devices"); |
229 | 230 | ||
231 | /* | ||
232 | * dev_ifb->queue_lock is usually taken after dev->ingress_lock, | ||
233 | * reversely to e.g. qdisc_lock_tree(). It should be safe until | ||
234 | * ifb doesn't take dev->queue_lock with dev_ifb->ingress_lock. | ||
235 | * But lockdep should know that ifb has different locks from dev. | ||
236 | */ | ||
237 | static struct lock_class_key ifb_queue_lock_key; | ||
238 | static struct lock_class_key ifb_ingress_lock_key; | ||
239 | |||
240 | |||
230 | static int __init ifb_init_one(int index) | 241 | static int __init ifb_init_one(int index) |
231 | { | 242 | { |
232 | struct net_device *dev_ifb; | 243 | struct net_device *dev_ifb; |
@@ -246,6 +257,10 @@ static int __init ifb_init_one(int index) | |||
246 | err = register_netdevice(dev_ifb); | 257 | err = register_netdevice(dev_ifb); |
247 | if (err < 0) | 258 | if (err < 0) |
248 | goto err; | 259 | goto err; |
260 | |||
261 | lockdep_set_class(&dev_ifb->queue_lock, &ifb_queue_lock_key); | ||
262 | lockdep_set_class(&dev_ifb->ingress_lock, &ifb_ingress_lock_key); | ||
263 | |||
249 | return 0; | 264 | return 0; |
250 | 265 | ||
251 | err: | 266 | err: |
diff --git a/drivers/net/igb/igb_main.c b/drivers/net/igb/igb_main.c index 6a1f23092099..928ce8287e69 100644 --- a/drivers/net/igb/igb_main.c +++ b/drivers/net/igb/igb_main.c | |||
@@ -31,7 +31,6 @@ | |||
31 | #include <linux/vmalloc.h> | 31 | #include <linux/vmalloc.h> |
32 | #include <linux/pagemap.h> | 32 | #include <linux/pagemap.h> |
33 | #include <linux/netdevice.h> | 33 | #include <linux/netdevice.h> |
34 | #include <linux/tcp.h> | ||
35 | #include <linux/ipv6.h> | 34 | #include <linux/ipv6.h> |
36 | #include <net/checksum.h> | 35 | #include <net/checksum.h> |
37 | #include <net/ip6_checksum.h> | 36 | #include <net/ip6_checksum.h> |
@@ -2484,10 +2483,24 @@ static inline bool igb_tx_csum_adv(struct igb_adapter *adapter, | |||
2484 | tu_cmd |= (E1000_TXD_CMD_DEXT | E1000_ADVTXD_DTYP_CTXT); | 2483 | tu_cmd |= (E1000_TXD_CMD_DEXT | E1000_ADVTXD_DTYP_CTXT); |
2485 | 2484 | ||
2486 | if (skb->ip_summed == CHECKSUM_PARTIAL) { | 2485 | if (skb->ip_summed == CHECKSUM_PARTIAL) { |
2487 | if (skb->protocol == htons(ETH_P_IP)) | 2486 | switch (skb->protocol) { |
2487 | case __constant_htons(ETH_P_IP): | ||
2488 | tu_cmd |= E1000_ADVTXD_TUCMD_IPV4; | 2488 | tu_cmd |= E1000_ADVTXD_TUCMD_IPV4; |
2489 | if (skb->sk && (skb->sk->sk_protocol == IPPROTO_TCP)) | 2489 | if (ip_hdr(skb)->protocol == IPPROTO_TCP) |
2490 | tu_cmd |= E1000_ADVTXD_TUCMD_L4T_TCP; | 2490 | tu_cmd |= E1000_ADVTXD_TUCMD_L4T_TCP; |
2491 | break; | ||
2492 | case __constant_htons(ETH_P_IPV6): | ||
2493 | /* XXX what about other V6 headers?? */ | ||
2494 | if (ipv6_hdr(skb)->nexthdr == IPPROTO_TCP) | ||
2495 | tu_cmd |= E1000_ADVTXD_TUCMD_L4T_TCP; | ||
2496 | break; | ||
2497 | default: | ||
2498 | if (unlikely(net_ratelimit())) | ||
2499 | dev_warn(&adapter->pdev->dev, | ||
2500 | "partial checksum but proto=%x!\n", | ||
2501 | skb->protocol); | ||
2502 | break; | ||
2503 | } | ||
2491 | } | 2504 | } |
2492 | 2505 | ||
2493 | context_desc->type_tucmd_mlhl = cpu_to_le32(tu_cmd); | 2506 | context_desc->type_tucmd_mlhl = cpu_to_le32(tu_cmd); |
diff --git a/drivers/net/ioc3-eth.c b/drivers/net/ioc3-eth.c index 373f72cdbe8e..1f25263dc7eb 100644 --- a/drivers/net/ioc3-eth.c +++ b/drivers/net/ioc3-eth.c | |||
@@ -1221,7 +1221,8 @@ static void __devinit ioc3_serial_probe(struct pci_dev *pdev, struct ioc3 *ioc3) | |||
1221 | } | 1221 | } |
1222 | #endif | 1222 | #endif |
1223 | 1223 | ||
1224 | static int ioc3_probe(struct pci_dev *pdev, const struct pci_device_id *ent) | 1224 | static int __devinit ioc3_probe(struct pci_dev *pdev, |
1225 | const struct pci_device_id *ent) | ||
1225 | { | 1226 | { |
1226 | unsigned int sw_physid1, sw_physid2; | 1227 | unsigned int sw_physid1, sw_physid2; |
1227 | struct net_device *dev = NULL; | 1228 | struct net_device *dev = NULL; |
diff --git a/drivers/net/ipg.c b/drivers/net/ipg.c index 5e5d9b527ed1..9b358f61ed7f 100644 --- a/drivers/net/ipg.c +++ b/drivers/net/ipg.c | |||
@@ -472,7 +472,6 @@ static int ipg_config_autoneg(struct net_device *dev) | |||
472 | unsigned int txflowcontrol; | 472 | unsigned int txflowcontrol; |
473 | unsigned int rxflowcontrol; | 473 | unsigned int rxflowcontrol; |
474 | unsigned int fullduplex; | 474 | unsigned int fullduplex; |
475 | unsigned int gig; | ||
476 | u32 mac_ctrl_val; | 475 | u32 mac_ctrl_val; |
477 | u32 asicctrl; | 476 | u32 asicctrl; |
478 | u8 phyctrl; | 477 | u8 phyctrl; |
@@ -489,7 +488,6 @@ static int ipg_config_autoneg(struct net_device *dev) | |||
489 | fullduplex = 0; | 488 | fullduplex = 0; |
490 | txflowcontrol = 0; | 489 | txflowcontrol = 0; |
491 | rxflowcontrol = 0; | 490 | rxflowcontrol = 0; |
492 | gig = 0; | ||
493 | 491 | ||
494 | /* To accomodate a problem in 10Mbps operation, | 492 | /* To accomodate a problem in 10Mbps operation, |
495 | * set a global flag if PHY running in 10Mbps mode. | 493 | * set a global flag if PHY running in 10Mbps mode. |
@@ -511,7 +509,6 @@ static int ipg_config_autoneg(struct net_device *dev) | |||
511 | break; | 509 | break; |
512 | case IPG_PC_LINK_SPEED_1000MBPS: | 510 | case IPG_PC_LINK_SPEED_1000MBPS: |
513 | printk("1000Mbps.\n"); | 511 | printk("1000Mbps.\n"); |
514 | gig = 1; | ||
515 | break; | 512 | break; |
516 | default: | 513 | default: |
517 | printk("undefined!\n"); | 514 | printk("undefined!\n"); |
@@ -1900,8 +1897,13 @@ static int ipg_nic_hard_start_xmit(struct sk_buff *skb, struct net_device *dev) | |||
1900 | 1897 | ||
1901 | /* Specify the TFC field within the TFD. */ | 1898 | /* Specify the TFC field within the TFD. */ |
1902 | txfd->tfc |= cpu_to_le64(IPG_TFC_WORDALIGNDISABLED | | 1899 | txfd->tfc |= cpu_to_le64(IPG_TFC_WORDALIGNDISABLED | |
1903 | (IPG_TFC_FRAMEID & cpu_to_le64(sp->tx_current)) | | 1900 | (IPG_TFC_FRAMEID & sp->tx_current) | |
1904 | (IPG_TFC_FRAGCOUNT & (1 << 24))); | 1901 | (IPG_TFC_FRAGCOUNT & (1 << 24))); |
1902 | /* | ||
1903 | * 16--17 (WordAlign) <- 3 (disable), | ||
1904 | * 0--15 (FrameId) <- sp->tx_current, | ||
1905 | * 24--27 (FragCount) <- 1 | ||
1906 | */ | ||
1905 | 1907 | ||
1906 | /* Request TxComplete interrupts at an interval defined | 1908 | /* Request TxComplete interrupts at an interval defined |
1907 | * by the constant IPG_FRAMESBETWEENTXCOMPLETES. | 1909 | * by the constant IPG_FRAMESBETWEENTXCOMPLETES. |
diff --git a/drivers/net/ne2k-pci.c b/drivers/net/ne2k-pci.c index b569c90da4ba..de0de744a8fa 100644 --- a/drivers/net/ne2k-pci.c +++ b/drivers/net/ne2k-pci.c | |||
@@ -535,9 +535,9 @@ static void ne2k_pci_block_input(struct net_device *dev, int count, | |||
535 | if (count & 3) { | 535 | if (count & 3) { |
536 | buf += count & ~3; | 536 | buf += count & ~3; |
537 | if (count & 2) { | 537 | if (count & 2) { |
538 | u16 *b = (u16 *)buf; | 538 | __le16 *b = (__le16 *)buf; |
539 | 539 | ||
540 | *b++ = le16_to_cpu(inw(NE_BASE + NE_DATAPORT)); | 540 | *b++ = cpu_to_le16(inw(NE_BASE + NE_DATAPORT)); |
541 | buf = (char *)b; | 541 | buf = (char *)b; |
542 | } | 542 | } |
543 | if (count & 1) | 543 | if (count & 1) |
@@ -600,9 +600,9 @@ static void ne2k_pci_block_output(struct net_device *dev, int count, | |||
600 | if (count & 3) { | 600 | if (count & 3) { |
601 | buf += count & ~3; | 601 | buf += count & ~3; |
602 | if (count & 2) { | 602 | if (count & 2) { |
603 | u16 *b = (u16 *)buf; | 603 | __le16 *b = (__le16 *)buf; |
604 | 604 | ||
605 | outw(cpu_to_le16(*b++), NE_BASE + NE_DATAPORT); | 605 | outw(le16_to_cpu(*b++), NE_BASE + NE_DATAPORT); |
606 | buf = (char *)b; | 606 | buf = (char *)b; |
607 | } | 607 | } |
608 | } | 608 | } |
diff --git a/drivers/net/ps3_gelic_wireless.c b/drivers/net/ps3_gelic_wireless.c index daf5abab9534..ddbc6e475e28 100644 --- a/drivers/net/ps3_gelic_wireless.c +++ b/drivers/net/ps3_gelic_wireless.c | |||
@@ -1644,13 +1644,24 @@ static void gelic_wl_scan_complete_event(struct gelic_wl_info *wl) | |||
1644 | } | 1644 | } |
1645 | 1645 | ||
1646 | /* put them in the newtork_list */ | 1646 | /* put them in the newtork_list */ |
1647 | scan_info = wl->buf; | 1647 | for (i = 0, scan_info_size = 0, scan_info = wl->buf; |
1648 | scan_info_size = 0; | 1648 | scan_info_size < data_len; |
1649 | i = 0; | 1649 | i++, scan_info_size += be16_to_cpu(scan_info->size), |
1650 | while (scan_info_size < data_len) { | 1650 | scan_info = (void *)scan_info + be16_to_cpu(scan_info->size)) { |
1651 | pr_debug("%s:size=%d bssid=%s scan_info=%p\n", __func__, | 1651 | pr_debug("%s:size=%d bssid=%s scan_info=%p\n", __func__, |
1652 | be16_to_cpu(scan_info->size), | 1652 | be16_to_cpu(scan_info->size), |
1653 | print_mac(mac, &scan_info->bssid[2]), scan_info); | 1653 | print_mac(mac, &scan_info->bssid[2]), scan_info); |
1654 | |||
1655 | /* | ||
1656 | * The wireless firmware may return invalid channel 0 and/or | ||
1657 | * invalid rate if the AP emits zero length SSID ie. As this | ||
1658 | * scan information is useless, ignore it | ||
1659 | */ | ||
1660 | if (!be16_to_cpu(scan_info->channel) || !scan_info->rate[0]) { | ||
1661 | pr_debug("%s: invalid scan info\n", __func__); | ||
1662 | continue; | ||
1663 | } | ||
1664 | |||
1654 | found = 0; | 1665 | found = 0; |
1655 | oldest = NULL; | 1666 | oldest = NULL; |
1656 | list_for_each_entry(target, &wl->network_list, list) { | 1667 | list_for_each_entry(target, &wl->network_list, list) { |
@@ -1687,10 +1698,6 @@ static void gelic_wl_scan_complete_event(struct gelic_wl_info *wl) | |||
1687 | GFP_KERNEL); | 1698 | GFP_KERNEL); |
1688 | if (!target->hwinfo) { | 1699 | if (!target->hwinfo) { |
1689 | pr_info("%s: kzalloc failed\n", __func__); | 1700 | pr_info("%s: kzalloc failed\n", __func__); |
1690 | i++; | ||
1691 | scan_info_size += be16_to_cpu(scan_info->size); | ||
1692 | scan_info = (void *)scan_info + | ||
1693 | be16_to_cpu(scan_info->size); | ||
1694 | continue; | 1701 | continue; |
1695 | } | 1702 | } |
1696 | /* copy hw scan info */ | 1703 | /* copy hw scan info */ |
@@ -1709,10 +1716,6 @@ static void gelic_wl_scan_complete_event(struct gelic_wl_info *wl) | |||
1709 | if (scan_info->ext_rate[r]) | 1716 | if (scan_info->ext_rate[r]) |
1710 | target->rate_ext_len++; | 1717 | target->rate_ext_len++; |
1711 | list_move_tail(&target->list, &wl->network_list); | 1718 | list_move_tail(&target->list, &wl->network_list); |
1712 | /* bump pointer */ | ||
1713 | i++; | ||
1714 | scan_info_size += be16_to_cpu(scan_info->size); | ||
1715 | scan_info = (void *)scan_info + be16_to_cpu(scan_info->size); | ||
1716 | } | 1719 | } |
1717 | memset(&data, 0, sizeof(data)); | 1720 | memset(&data, 0, sizeof(data)); |
1718 | wireless_send_event(port_to_netdev(wl_port(wl)), SIOCGIWSCAN, &data, | 1721 | wireless_send_event(port_to_netdev(wl_port(wl)), SIOCGIWSCAN, &data, |
@@ -2389,6 +2392,8 @@ static struct net_device *gelic_wl_alloc(struct gelic_card *card) | |||
2389 | if (!netdev) | 2392 | if (!netdev) |
2390 | return NULL; | 2393 | return NULL; |
2391 | 2394 | ||
2395 | strcpy(netdev->name, "wlan%d"); | ||
2396 | |||
2392 | port = netdev_priv(netdev); | 2397 | port = netdev_priv(netdev); |
2393 | port->netdev = netdev; | 2398 | port->netdev = netdev; |
2394 | port->card = card; | 2399 | port->card = card; |
diff --git a/drivers/net/r6040.c b/drivers/net/r6040.c index 19184e486ae9..169edc154928 100644 --- a/drivers/net/r6040.c +++ b/drivers/net/r6040.c | |||
@@ -239,7 +239,8 @@ static void r6040_free_txbufs(struct net_device *dev) | |||
239 | 239 | ||
240 | for (i = 0; i < TX_DCNT; i++) { | 240 | for (i = 0; i < TX_DCNT; i++) { |
241 | if (lp->tx_insert_ptr->skb_ptr) { | 241 | if (lp->tx_insert_ptr->skb_ptr) { |
242 | pci_unmap_single(lp->pdev, lp->tx_insert_ptr->buf, | 242 | pci_unmap_single(lp->pdev, |
243 | le32_to_cpu(lp->tx_insert_ptr->buf), | ||
243 | MAX_BUF_SIZE, PCI_DMA_TODEVICE); | 244 | MAX_BUF_SIZE, PCI_DMA_TODEVICE); |
244 | dev_kfree_skb(lp->tx_insert_ptr->skb_ptr); | 245 | dev_kfree_skb(lp->tx_insert_ptr->skb_ptr); |
245 | lp->rx_insert_ptr->skb_ptr = NULL; | 246 | lp->rx_insert_ptr->skb_ptr = NULL; |
@@ -255,7 +256,8 @@ static void r6040_free_rxbufs(struct net_device *dev) | |||
255 | 256 | ||
256 | for (i = 0; i < RX_DCNT; i++) { | 257 | for (i = 0; i < RX_DCNT; i++) { |
257 | if (lp->rx_insert_ptr->skb_ptr) { | 258 | if (lp->rx_insert_ptr->skb_ptr) { |
258 | pci_unmap_single(lp->pdev, lp->rx_insert_ptr->buf, | 259 | pci_unmap_single(lp->pdev, |
260 | le32_to_cpu(lp->rx_insert_ptr->buf), | ||
259 | MAX_BUF_SIZE, PCI_DMA_FROMDEVICE); | 261 | MAX_BUF_SIZE, PCI_DMA_FROMDEVICE); |
260 | dev_kfree_skb(lp->rx_insert_ptr->skb_ptr); | 262 | dev_kfree_skb(lp->rx_insert_ptr->skb_ptr); |
261 | lp->rx_insert_ptr->skb_ptr = NULL; | 263 | lp->rx_insert_ptr->skb_ptr = NULL; |
@@ -542,7 +544,7 @@ static int r6040_rx(struct net_device *dev, int limit) | |||
542 | skb_ptr->dev = priv->dev; | 544 | skb_ptr->dev = priv->dev; |
543 | /* Do not count the CRC */ | 545 | /* Do not count the CRC */ |
544 | skb_put(skb_ptr, descptr->len - 4); | 546 | skb_put(skb_ptr, descptr->len - 4); |
545 | pci_unmap_single(priv->pdev, descptr->buf, | 547 | pci_unmap_single(priv->pdev, le32_to_cpu(descptr->buf), |
546 | MAX_BUF_SIZE, PCI_DMA_FROMDEVICE); | 548 | MAX_BUF_SIZE, PCI_DMA_FROMDEVICE); |
547 | skb_ptr->protocol = eth_type_trans(skb_ptr, priv->dev); | 549 | skb_ptr->protocol = eth_type_trans(skb_ptr, priv->dev); |
548 | /* Send to upper layer */ | 550 | /* Send to upper layer */ |
@@ -585,7 +587,7 @@ static void r6040_tx(struct net_device *dev) | |||
585 | if (descptr->status & 0x8000) | 587 | if (descptr->status & 0x8000) |
586 | break; /* Not complete */ | 588 | break; /* Not complete */ |
587 | skb_ptr = descptr->skb_ptr; | 589 | skb_ptr = descptr->skb_ptr; |
588 | pci_unmap_single(priv->pdev, descptr->buf, | 590 | pci_unmap_single(priv->pdev, le32_to_cpu(descptr->buf), |
589 | skb_ptr->len, PCI_DMA_TODEVICE); | 591 | skb_ptr->len, PCI_DMA_TODEVICE); |
590 | /* Free buffer */ | 592 | /* Free buffer */ |
591 | dev_kfree_skb_irq(skb_ptr); | 593 | dev_kfree_skb_irq(skb_ptr); |
diff --git a/drivers/net/sungem.c b/drivers/net/sungem.c index 97212799c513..4291458955ef 100644 --- a/drivers/net/sungem.c +++ b/drivers/net/sungem.c | |||
@@ -912,7 +912,7 @@ static int gem_poll(struct napi_struct *napi, int budget) | |||
912 | * rx ring - must call napi_disable(), which | 912 | * rx ring - must call napi_disable(), which |
913 | * schedule_timeout()'s if polling is already disabled. | 913 | * schedule_timeout()'s if polling is already disabled. |
914 | */ | 914 | */ |
915 | work_done += gem_rx(gp, budget); | 915 | work_done += gem_rx(gp, budget - work_done); |
916 | 916 | ||
917 | if (work_done >= budget) | 917 | if (work_done >= budget) |
918 | return work_done; | 918 | return work_done; |
diff --git a/drivers/net/tg3.c b/drivers/net/tg3.c index 26ffb67f1da2..f9ef8bd8b11e 100644 --- a/drivers/net/tg3.c +++ b/drivers/net/tg3.c | |||
@@ -64,8 +64,8 @@ | |||
64 | 64 | ||
65 | #define DRV_MODULE_NAME "tg3" | 65 | #define DRV_MODULE_NAME "tg3" |
66 | #define PFX DRV_MODULE_NAME ": " | 66 | #define PFX DRV_MODULE_NAME ": " |
67 | #define DRV_MODULE_VERSION "3.87" | 67 | #define DRV_MODULE_VERSION "3.88" |
68 | #define DRV_MODULE_RELDATE "December 20, 2007" | 68 | #define DRV_MODULE_RELDATE "March 20, 2008" |
69 | 69 | ||
70 | #define TG3_DEF_MAC_MODE 0 | 70 | #define TG3_DEF_MAC_MODE 0 |
71 | #define TG3_DEF_RX_MODE 0 | 71 | #define TG3_DEF_RX_MODE 0 |
@@ -11841,7 +11841,7 @@ static int __devinit tg3_get_device_address(struct tg3 *tp) | |||
11841 | } | 11841 | } |
11842 | 11842 | ||
11843 | if (!is_valid_ether_addr(&dev->dev_addr[0])) { | 11843 | if (!is_valid_ether_addr(&dev->dev_addr[0])) { |
11844 | #ifdef CONFIG_SPARC64 | 11844 | #ifdef CONFIG_SPARC |
11845 | if (!tg3_get_default_macaddr_sparc(tp)) | 11845 | if (!tg3_get_default_macaddr_sparc(tp)) |
11846 | return 0; | 11846 | return 0; |
11847 | #endif | 11847 | #endif |
diff --git a/drivers/net/tulip/de2104x.c b/drivers/net/tulip/de2104x.c index 567c62757e9d..1b5edd646a8c 100644 --- a/drivers/net/tulip/de2104x.c +++ b/drivers/net/tulip/de2104x.c | |||
@@ -842,7 +842,7 @@ static inline int de_is_running (struct de_private *de) | |||
842 | static void de_stop_rxtx (struct de_private *de) | 842 | static void de_stop_rxtx (struct de_private *de) |
843 | { | 843 | { |
844 | u32 macmode; | 844 | u32 macmode; |
845 | unsigned int work = 1000; | 845 | unsigned int i = 1300/100; |
846 | 846 | ||
847 | macmode = dr32(MacMode); | 847 | macmode = dr32(MacMode); |
848 | if (macmode & RxTx) { | 848 | if (macmode & RxTx) { |
@@ -850,10 +850,14 @@ static void de_stop_rxtx (struct de_private *de) | |||
850 | dr32(MacMode); | 850 | dr32(MacMode); |
851 | } | 851 | } |
852 | 852 | ||
853 | while (--work > 0) { | 853 | /* wait until in-flight frame completes. |
854 | * Max time @ 10BT: 1500*8b/10Mbps == 1200us (+ 100us margin) | ||
855 | * Typically expect this loop to end in < 50 us on 100BT. | ||
856 | */ | ||
857 | while (--i) { | ||
854 | if (!de_is_running(de)) | 858 | if (!de_is_running(de)) |
855 | return; | 859 | return; |
856 | cpu_relax(); | 860 | udelay(100); |
857 | } | 861 | } |
858 | 862 | ||
859 | printk(KERN_WARNING "%s: timeout expired stopping DMA\n", de->dev->name); | 863 | printk(KERN_WARNING "%s: timeout expired stopping DMA\n", de->dev->name); |
diff --git a/drivers/net/ucc_geth.c b/drivers/net/ucc_geth.c index fba0811d2608..8cc316653a39 100644 --- a/drivers/net/ucc_geth.c +++ b/drivers/net/ucc_geth.c | |||
@@ -154,8 +154,8 @@ static struct ucc_geth_info ugeth_primary_info = { | |||
154 | .rxQoSMode = UCC_GETH_QOS_MODE_DEFAULT, | 154 | .rxQoSMode = UCC_GETH_QOS_MODE_DEFAULT, |
155 | .aufc = UPSMR_AUTOMATIC_FLOW_CONTROL_MODE_NONE, | 155 | .aufc = UPSMR_AUTOMATIC_FLOW_CONTROL_MODE_NONE, |
156 | .padAndCrc = MACCFG2_PAD_AND_CRC_MODE_PAD_AND_CRC, | 156 | .padAndCrc = MACCFG2_PAD_AND_CRC_MODE_PAD_AND_CRC, |
157 | .numThreadsTx = UCC_GETH_NUM_OF_THREADS_4, | 157 | .numThreadsTx = UCC_GETH_NUM_OF_THREADS_1, |
158 | .numThreadsRx = UCC_GETH_NUM_OF_THREADS_4, | 158 | .numThreadsRx = UCC_GETH_NUM_OF_THREADS_1, |
159 | .riscTx = QE_RISC_ALLOCATION_RISC1_AND_RISC2, | 159 | .riscTx = QE_RISC_ALLOCATION_RISC1_AND_RISC2, |
160 | .riscRx = QE_RISC_ALLOCATION_RISC1_AND_RISC2, | 160 | .riscRx = QE_RISC_ALLOCATION_RISC1_AND_RISC2, |
161 | }; | 161 | }; |
@@ -3975,6 +3975,8 @@ static int ucc_geth_probe(struct of_device* ofdev, const struct of_device_id *ma | |||
3975 | ug_info->uf_info.utfs = UCC_GETH_UTFS_GIGA_INIT; | 3975 | ug_info->uf_info.utfs = UCC_GETH_UTFS_GIGA_INIT; |
3976 | ug_info->uf_info.utfet = UCC_GETH_UTFET_GIGA_INIT; | 3976 | ug_info->uf_info.utfet = UCC_GETH_UTFET_GIGA_INIT; |
3977 | ug_info->uf_info.utftt = UCC_GETH_UTFTT_GIGA_INIT; | 3977 | ug_info->uf_info.utftt = UCC_GETH_UTFTT_GIGA_INIT; |
3978 | ug_info->numThreadsTx = UCC_GETH_NUM_OF_THREADS_4; | ||
3979 | ug_info->numThreadsRx = UCC_GETH_NUM_OF_THREADS_4; | ||
3978 | } | 3980 | } |
3979 | 3981 | ||
3980 | /* Set the bus id */ | 3982 | /* Set the bus id */ |
diff --git a/drivers/net/usb/rndis_host.c b/drivers/net/usb/rndis_host.c index a61324757b17..727547a28992 100644 --- a/drivers/net/usb/rndis_host.c +++ b/drivers/net/usb/rndis_host.c | |||
@@ -16,10 +16,6 @@ | |||
16 | * along with this program; if not, write to the Free Software | 16 | * along with this program; if not, write to the Free Software |
17 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | 17 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
18 | */ | 18 | */ |
19 | |||
20 | // #define DEBUG // error path messages, extra info | ||
21 | // #define VERBOSE // more; success messages | ||
22 | |||
23 | #include <linux/module.h> | 19 | #include <linux/module.h> |
24 | #include <linux/init.h> | 20 | #include <linux/init.h> |
25 | #include <linux/netdevice.h> | 21 | #include <linux/netdevice.h> |
@@ -318,6 +314,14 @@ generic_rndis_bind(struct usbnet *dev, struct usb_interface *intf, int flags) | |||
318 | net->hard_header_len += sizeof (struct rndis_data_hdr); | 314 | net->hard_header_len += sizeof (struct rndis_data_hdr); |
319 | dev->hard_mtu = net->mtu + net->hard_header_len; | 315 | dev->hard_mtu = net->mtu + net->hard_header_len; |
320 | 316 | ||
317 | dev->maxpacket = usb_maxpacket(dev->udev, dev->out, 1); | ||
318 | if (dev->maxpacket == 0) { | ||
319 | if (netif_msg_probe(dev)) | ||
320 | dev_dbg(&intf->dev, "dev->maxpacket can't be 0\n"); | ||
321 | retval = -EINVAL; | ||
322 | goto fail_and_release; | ||
323 | } | ||
324 | |||
321 | dev->rx_urb_size = dev->hard_mtu + (dev->maxpacket + 1); | 325 | dev->rx_urb_size = dev->hard_mtu + (dev->maxpacket + 1); |
322 | dev->rx_urb_size &= ~(dev->maxpacket - 1); | 326 | dev->rx_urb_size &= ~(dev->maxpacket - 1); |
323 | u.init->max_transfer_size = cpu_to_le32(dev->rx_urb_size); | 327 | u.init->max_transfer_size = cpu_to_le32(dev->rx_urb_size); |
diff --git a/drivers/net/usb/rtl8150.c b/drivers/net/usb/rtl8150.c index 7e1f00131f91..df56a518691c 100644 --- a/drivers/net/usb/rtl8150.c +++ b/drivers/net/usb/rtl8150.c | |||
@@ -376,7 +376,7 @@ static int alloc_all_urbs(rtl8150_t * dev) | |||
376 | return 0; | 376 | return 0; |
377 | } | 377 | } |
378 | dev->ctrl_urb = usb_alloc_urb(0, GFP_KERNEL); | 378 | dev->ctrl_urb = usb_alloc_urb(0, GFP_KERNEL); |
379 | if (!dev->intr_urb) { | 379 | if (!dev->ctrl_urb) { |
380 | usb_free_urb(dev->rx_urb); | 380 | usb_free_urb(dev->rx_urb); |
381 | usb_free_urb(dev->tx_urb); | 381 | usb_free_urb(dev->tx_urb); |
382 | usb_free_urb(dev->intr_urb); | 382 | usb_free_urb(dev->intr_urb); |
diff --git a/drivers/net/virtio_net.c b/drivers/net/virtio_net.c index 19fd4cb0ddf8..b58472cf76f8 100644 --- a/drivers/net/virtio_net.c +++ b/drivers/net/virtio_net.c | |||
@@ -203,8 +203,11 @@ again: | |||
203 | if (received < budget) { | 203 | if (received < budget) { |
204 | netif_rx_complete(vi->dev, napi); | 204 | netif_rx_complete(vi->dev, napi); |
205 | if (unlikely(!vi->rvq->vq_ops->enable_cb(vi->rvq)) | 205 | if (unlikely(!vi->rvq->vq_ops->enable_cb(vi->rvq)) |
206 | && netif_rx_reschedule(vi->dev, napi)) | 206 | && napi_schedule_prep(napi)) { |
207 | vi->rvq->vq_ops->disable_cb(vi->rvq); | ||
208 | __netif_rx_schedule(vi->dev, napi); | ||
207 | goto again; | 209 | goto again; |
210 | } | ||
208 | } | 211 | } |
209 | 212 | ||
210 | return received; | 213 | return received; |
@@ -278,10 +281,11 @@ again: | |||
278 | pr_debug("%s: virtio not prepared to send\n", dev->name); | 281 | pr_debug("%s: virtio not prepared to send\n", dev->name); |
279 | netif_stop_queue(dev); | 282 | netif_stop_queue(dev); |
280 | 283 | ||
281 | /* Activate callback for using skbs: if this fails it | 284 | /* Activate callback for using skbs: if this returns false it |
282 | * means some were used in the meantime. */ | 285 | * means some were used in the meantime. */ |
283 | if (unlikely(!vi->svq->vq_ops->enable_cb(vi->svq))) { | 286 | if (unlikely(!vi->svq->vq_ops->enable_cb(vi->svq))) { |
284 | printk("Unlikely: restart svq failed\n"); | 287 | printk("Unlikely: restart svq race\n"); |
288 | vi->svq->vq_ops->disable_cb(vi->svq); | ||
285 | netif_start_queue(dev); | 289 | netif_start_queue(dev); |
286 | goto again; | 290 | goto again; |
287 | } | 291 | } |
@@ -294,6 +298,15 @@ again: | |||
294 | return 0; | 298 | return 0; |
295 | } | 299 | } |
296 | 300 | ||
301 | #ifdef CONFIG_NET_POLL_CONTROLLER | ||
302 | static void virtnet_netpoll(struct net_device *dev) | ||
303 | { | ||
304 | struct virtnet_info *vi = netdev_priv(dev); | ||
305 | |||
306 | napi_schedule(&vi->napi); | ||
307 | } | ||
308 | #endif | ||
309 | |||
297 | static int virtnet_open(struct net_device *dev) | 310 | static int virtnet_open(struct net_device *dev) |
298 | { | 311 | { |
299 | struct virtnet_info *vi = netdev_priv(dev); | 312 | struct virtnet_info *vi = netdev_priv(dev); |
@@ -336,6 +349,9 @@ static int virtnet_probe(struct virtio_device *vdev) | |||
336 | dev->stop = virtnet_close; | 349 | dev->stop = virtnet_close; |
337 | dev->hard_start_xmit = start_xmit; | 350 | dev->hard_start_xmit = start_xmit; |
338 | dev->features = NETIF_F_HIGHDMA; | 351 | dev->features = NETIF_F_HIGHDMA; |
352 | #ifdef CONFIG_NET_POLL_CONTROLLER | ||
353 | dev->poll_controller = virtnet_netpoll; | ||
354 | #endif | ||
339 | SET_NETDEV_DEV(dev, &vdev->dev); | 355 | SET_NETDEV_DEV(dev, &vdev->dev); |
340 | 356 | ||
341 | /* Do we support "hardware" checksums? */ | 357 | /* Do we support "hardware" checksums? */ |
diff --git a/drivers/net/wan/farsync.c b/drivers/net/wan/farsync.c index cf27bf40d36e..547368e9633d 100644 --- a/drivers/net/wan/farsync.c +++ b/drivers/net/wan/farsync.c | |||
@@ -2024,6 +2024,7 @@ fst_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd) | |||
2024 | struct fstioc_write wrthdr; | 2024 | struct fstioc_write wrthdr; |
2025 | struct fstioc_info info; | 2025 | struct fstioc_info info; |
2026 | unsigned long flags; | 2026 | unsigned long flags; |
2027 | void *buf; | ||
2027 | 2028 | ||
2028 | dbg(DBG_IOCTL, "ioctl: %x, %p\n", cmd, ifr->ifr_data); | 2029 | dbg(DBG_IOCTL, "ioctl: %x, %p\n", cmd, ifr->ifr_data); |
2029 | 2030 | ||
@@ -2065,16 +2066,22 @@ fst_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd) | |||
2065 | return -ENXIO; | 2066 | return -ENXIO; |
2066 | } | 2067 | } |
2067 | 2068 | ||
2068 | /* Now copy the data to the card. | 2069 | /* Now copy the data to the card. */ |
2069 | * This will probably break on some architectures. | 2070 | |
2070 | * I'll fix it when I have something to test on. | 2071 | buf = kmalloc(wrthdr.size, GFP_KERNEL); |
2071 | */ | 2072 | if (!buf) |
2072 | if (copy_from_user(card->mem + wrthdr.offset, | 2073 | return -ENOMEM; |
2074 | |||
2075 | if (copy_from_user(buf, | ||
2073 | ifr->ifr_data + sizeof (struct fstioc_write), | 2076 | ifr->ifr_data + sizeof (struct fstioc_write), |
2074 | wrthdr.size)) { | 2077 | wrthdr.size)) { |
2078 | kfree(buf); | ||
2075 | return -EFAULT; | 2079 | return -EFAULT; |
2076 | } | 2080 | } |
2077 | 2081 | ||
2082 | memcpy_toio(card->mem + wrthdr.offset, buf, wrthdr.size); | ||
2083 | kfree(buf); | ||
2084 | |||
2078 | /* Writes to the memory of a card in the reset state constitute | 2085 | /* Writes to the memory of a card in the reset state constitute |
2079 | * a download | 2086 | * a download |
2080 | */ | 2087 | */ |
diff --git a/drivers/net/wireless/ath5k/hw.c b/drivers/net/wireless/ath5k/hw.c index c2de2d958e8e..01757436353d 100644 --- a/drivers/net/wireless/ath5k/hw.c +++ b/drivers/net/wireless/ath5k/hw.c | |||
@@ -427,6 +427,8 @@ void ath5k_hw_detach(struct ath5k_hw *ah) | |||
427 | { | 427 | { |
428 | ATH5K_TRACE(ah->ah_sc); | 428 | ATH5K_TRACE(ah->ah_sc); |
429 | 429 | ||
430 | __set_bit(ATH_STAT_INVALID, ah->ah_sc->status); | ||
431 | |||
430 | if (ah->ah_rf_banks != NULL) | 432 | if (ah->ah_rf_banks != NULL) |
431 | kfree(ah->ah_rf_banks); | 433 | kfree(ah->ah_rf_banks); |
432 | 434 | ||
diff --git a/drivers/net/wireless/b43/phy.c b/drivers/net/wireless/b43/phy.c index 71507b260b6d..575c5436ebdf 100644 --- a/drivers/net/wireless/b43/phy.c +++ b/drivers/net/wireless/b43/phy.c | |||
@@ -860,7 +860,7 @@ static void b43_phy_ww(struct b43_wldev *dev) | |||
860 | b43_phy_write(dev, B43_PHY_OFDM(0xBB), | 860 | b43_phy_write(dev, B43_PHY_OFDM(0xBB), |
861 | (b43_phy_read(dev, B43_PHY_OFDM(0xBB)) & 0xF000) | 0x0053); | 861 | (b43_phy_read(dev, B43_PHY_OFDM(0xBB)) & 0xF000) | 0x0053); |
862 | b43_phy_write(dev, B43_PHY_OFDM61, | 862 | b43_phy_write(dev, B43_PHY_OFDM61, |
863 | (b43_phy_read(dev, B43_PHY_OFDM61 & 0xFE1F)) | 0x0120); | 863 | (b43_phy_read(dev, B43_PHY_OFDM61) & 0xFE1F) | 0x0120); |
864 | b43_phy_write(dev, B43_PHY_OFDM(0x13), | 864 | b43_phy_write(dev, B43_PHY_OFDM(0x13), |
865 | (b43_phy_read(dev, B43_PHY_OFDM(0x13)) & 0x0FFF) | 0x3000); | 865 | (b43_phy_read(dev, B43_PHY_OFDM(0x13)) & 0x0FFF) | 0x3000); |
866 | b43_phy_write(dev, B43_PHY_OFDM(0x14), | 866 | b43_phy_write(dev, B43_PHY_OFDM(0x14), |
diff --git a/drivers/net/wireless/p54usb.c b/drivers/net/wireless/p54usb.c index e7d4aee8799e..98ddbb3b3273 100644 --- a/drivers/net/wireless/p54usb.c +++ b/drivers/net/wireless/p54usb.c | |||
@@ -63,6 +63,7 @@ static struct usb_device_id p54u_table[] __devinitdata = { | |||
63 | {USB_DEVICE(0x0cde, 0x0008)}, /* Sagem XG703A */ | 63 | {USB_DEVICE(0x0cde, 0x0008)}, /* Sagem XG703A */ |
64 | {USB_DEVICE(0x0d8e, 0x3762)}, /* DLink DWL-G120 Cohiba */ | 64 | {USB_DEVICE(0x0d8e, 0x3762)}, /* DLink DWL-G120 Cohiba */ |
65 | {USB_DEVICE(0x09aa, 0x1000)}, /* Spinnaker Proto board */ | 65 | {USB_DEVICE(0x09aa, 0x1000)}, /* Spinnaker Proto board */ |
66 | {USB_DEVICE(0x124a, 0x4025)}, /* IOGear GWU513 (GW3887IK chip) */ | ||
66 | {USB_DEVICE(0x13b1, 0x000a)}, /* Linksys WUSB54G ver 2 */ | 67 | {USB_DEVICE(0x13b1, 0x000a)}, /* Linksys WUSB54G ver 2 */ |
67 | {USB_DEVICE(0x13B1, 0x000C)}, /* Linksys WUSB54AG */ | 68 | {USB_DEVICE(0x13B1, 0x000C)}, /* Linksys WUSB54AG */ |
68 | {USB_DEVICE(0x1435, 0x0427)}, /* Inventel UR054G */ | 69 | {USB_DEVICE(0x1435, 0x0427)}, /* Inventel UR054G */ |
diff --git a/drivers/net/wireless/rt2x00/rt2x00.h b/drivers/net/wireless/rt2x00/rt2x00.h index 05927b908f80..6c725422af5a 100644 --- a/drivers/net/wireless/rt2x00/rt2x00.h +++ b/drivers/net/wireless/rt2x00/rt2x00.h | |||
@@ -620,6 +620,9 @@ struct rt2x00_dev { | |||
620 | * This will only be compiled in when required. | 620 | * This will only be compiled in when required. |
621 | */ | 621 | */ |
622 | #ifdef CONFIG_RT2X00_LIB_RFKILL | 622 | #ifdef CONFIG_RT2X00_LIB_RFKILL |
623 | unsigned long rfkill_state; | ||
624 | #define RFKILL_STATE_ALLOCATED 1 | ||
625 | #define RFKILL_STATE_REGISTERED 2 | ||
623 | struct rfkill *rfkill; | 626 | struct rfkill *rfkill; |
624 | struct input_polled_dev *poll_dev; | 627 | struct input_polled_dev *poll_dev; |
625 | #endif /* CONFIG_RT2X00_LIB_RFKILL */ | 628 | #endif /* CONFIG_RT2X00_LIB_RFKILL */ |
diff --git a/drivers/net/wireless/rt2x00/rt2x00dev.c b/drivers/net/wireless/rt2x00/rt2x00dev.c index 0d51f478bcdf..bd305f7f3efd 100644 --- a/drivers/net/wireless/rt2x00/rt2x00dev.c +++ b/drivers/net/wireless/rt2x00/rt2x00dev.c | |||
@@ -1098,7 +1098,7 @@ static void rt2x00lib_uninitialize(struct rt2x00_dev *rt2x00dev) | |||
1098 | return; | 1098 | return; |
1099 | 1099 | ||
1100 | /* | 1100 | /* |
1101 | * Unregister rfkill. | 1101 | * Unregister extra components. |
1102 | */ | 1102 | */ |
1103 | rt2x00rfkill_unregister(rt2x00dev); | 1103 | rt2x00rfkill_unregister(rt2x00dev); |
1104 | 1104 | ||
@@ -1139,17 +1139,12 @@ static int rt2x00lib_initialize(struct rt2x00_dev *rt2x00dev) | |||
1139 | __set_bit(DEVICE_INITIALIZED, &rt2x00dev->flags); | 1139 | __set_bit(DEVICE_INITIALIZED, &rt2x00dev->flags); |
1140 | 1140 | ||
1141 | /* | 1141 | /* |
1142 | * Register the rfkill handler. | 1142 | * Register the extra components. |
1143 | */ | 1143 | */ |
1144 | status = rt2x00rfkill_register(rt2x00dev); | 1144 | rt2x00rfkill_register(rt2x00dev); |
1145 | if (status) | ||
1146 | goto exit_unitialize; | ||
1147 | 1145 | ||
1148 | return 0; | 1146 | return 0; |
1149 | 1147 | ||
1150 | exit_unitialize: | ||
1151 | rt2x00lib_uninitialize(rt2x00dev); | ||
1152 | |||
1153 | exit: | 1148 | exit: |
1154 | rt2x00lib_free_ring_entries(rt2x00dev); | 1149 | rt2x00lib_free_ring_entries(rt2x00dev); |
1155 | 1150 | ||
@@ -1313,15 +1308,9 @@ int rt2x00lib_probe_dev(struct rt2x00_dev *rt2x00dev) | |||
1313 | } | 1308 | } |
1314 | 1309 | ||
1315 | /* | 1310 | /* |
1316 | * Allocatie rfkill. | 1311 | * Register extra components. |
1317 | */ | ||
1318 | retval = rt2x00rfkill_allocate(rt2x00dev); | ||
1319 | if (retval) | ||
1320 | goto exit; | ||
1321 | |||
1322 | /* | ||
1323 | * Open the debugfs entry. | ||
1324 | */ | 1312 | */ |
1313 | rt2x00rfkill_allocate(rt2x00dev); | ||
1325 | rt2x00debug_register(rt2x00dev); | 1314 | rt2x00debug_register(rt2x00dev); |
1326 | 1315 | ||
1327 | __set_bit(DEVICE_PRESENT, &rt2x00dev->flags); | 1316 | __set_bit(DEVICE_PRESENT, &rt2x00dev->flags); |
@@ -1350,13 +1339,9 @@ void rt2x00lib_remove_dev(struct rt2x00_dev *rt2x00dev) | |||
1350 | rt2x00lib_uninitialize(rt2x00dev); | 1339 | rt2x00lib_uninitialize(rt2x00dev); |
1351 | 1340 | ||
1352 | /* | 1341 | /* |
1353 | * Close debugfs entry. | 1342 | * Free extra components |
1354 | */ | 1343 | */ |
1355 | rt2x00debug_deregister(rt2x00dev); | 1344 | rt2x00debug_deregister(rt2x00dev); |
1356 | |||
1357 | /* | ||
1358 | * Free rfkill | ||
1359 | */ | ||
1360 | rt2x00rfkill_free(rt2x00dev); | 1345 | rt2x00rfkill_free(rt2x00dev); |
1361 | 1346 | ||
1362 | /* | 1347 | /* |
@@ -1395,11 +1380,15 @@ int rt2x00lib_suspend(struct rt2x00_dev *rt2x00dev, pm_message_t state) | |||
1395 | __set_bit(DEVICE_STARTED_SUSPEND, &rt2x00dev->flags); | 1380 | __set_bit(DEVICE_STARTED_SUSPEND, &rt2x00dev->flags); |
1396 | 1381 | ||
1397 | /* | 1382 | /* |
1398 | * Disable radio and unitialize all items | 1383 | * Disable radio. |
1399 | * that must be recreated on resume. | ||
1400 | */ | 1384 | */ |
1401 | rt2x00lib_stop(rt2x00dev); | 1385 | rt2x00lib_stop(rt2x00dev); |
1402 | rt2x00lib_uninitialize(rt2x00dev); | 1386 | rt2x00lib_uninitialize(rt2x00dev); |
1387 | |||
1388 | /* | ||
1389 | * Suspend/disable extra components. | ||
1390 | */ | ||
1391 | rt2x00rfkill_suspend(rt2x00dev); | ||
1403 | rt2x00debug_deregister(rt2x00dev); | 1392 | rt2x00debug_deregister(rt2x00dev); |
1404 | 1393 | ||
1405 | exit: | 1394 | exit: |
@@ -1422,9 +1411,10 @@ int rt2x00lib_resume(struct rt2x00_dev *rt2x00dev) | |||
1422 | NOTICE(rt2x00dev, "Waking up.\n"); | 1411 | NOTICE(rt2x00dev, "Waking up.\n"); |
1423 | 1412 | ||
1424 | /* | 1413 | /* |
1425 | * Open the debugfs entry. | 1414 | * Restore/enable extra components. |
1426 | */ | 1415 | */ |
1427 | rt2x00debug_register(rt2x00dev); | 1416 | rt2x00debug_register(rt2x00dev); |
1417 | rt2x00rfkill_resume(rt2x00dev); | ||
1428 | 1418 | ||
1429 | /* | 1419 | /* |
1430 | * Only continue if mac80211 had open interfaces. | 1420 | * Only continue if mac80211 had open interfaces. |
diff --git a/drivers/net/wireless/rt2x00/rt2x00lib.h b/drivers/net/wireless/rt2x00/rt2x00lib.h index 1adbd28e0973..ce58c654ade1 100644 --- a/drivers/net/wireless/rt2x00/rt2x00lib.h +++ b/drivers/net/wireless/rt2x00/rt2x00lib.h | |||
@@ -100,28 +100,36 @@ static inline void rt2x00debug_dump_frame(struct rt2x00_dev *rt2x00dev, | |||
100 | * RFkill handlers. | 100 | * RFkill handlers. |
101 | */ | 101 | */ |
102 | #ifdef CONFIG_RT2X00_LIB_RFKILL | 102 | #ifdef CONFIG_RT2X00_LIB_RFKILL |
103 | int rt2x00rfkill_register(struct rt2x00_dev *rt2x00dev); | 103 | void rt2x00rfkill_register(struct rt2x00_dev *rt2x00dev); |
104 | void rt2x00rfkill_unregister(struct rt2x00_dev *rt2x00dev); | 104 | void rt2x00rfkill_unregister(struct rt2x00_dev *rt2x00dev); |
105 | int rt2x00rfkill_allocate(struct rt2x00_dev *rt2x00dev); | 105 | void rt2x00rfkill_allocate(struct rt2x00_dev *rt2x00dev); |
106 | void rt2x00rfkill_free(struct rt2x00_dev *rt2x00dev); | 106 | void rt2x00rfkill_free(struct rt2x00_dev *rt2x00dev); |
107 | void rt2x00rfkill_suspend(struct rt2x00_dev *rt2x00dev); | ||
108 | void rt2x00rfkill_resume(struct rt2x00_dev *rt2x00dev); | ||
107 | #else | 109 | #else |
108 | static inline int rt2x00rfkill_register(struct rt2x00_dev *rt2x00dev) | 110 | static inline void rt2x00rfkill_register(struct rt2x00_dev *rt2x00dev) |
109 | { | 111 | { |
110 | return 0; | ||
111 | } | 112 | } |
112 | 113 | ||
113 | static inline void rt2x00rfkill_unregister(struct rt2x00_dev *rt2x00dev) | 114 | static inline void rt2x00rfkill_unregister(struct rt2x00_dev *rt2x00dev) |
114 | { | 115 | { |
115 | } | 116 | } |
116 | 117 | ||
117 | static inline int rt2x00rfkill_allocate(struct rt2x00_dev *rt2x00dev) | 118 | static inline void rt2x00rfkill_allocate(struct rt2x00_dev *rt2x00dev) |
118 | { | 119 | { |
119 | return 0; | ||
120 | } | 120 | } |
121 | 121 | ||
122 | static inline void rt2x00rfkill_free(struct rt2x00_dev *rt2x00dev) | 122 | static inline void rt2x00rfkill_free(struct rt2x00_dev *rt2x00dev) |
123 | { | 123 | { |
124 | } | 124 | } |
125 | |||
126 | static inline void rt2x00rfkill_suspend(struct rt2x00_dev *rt2x00dev) | ||
127 | { | ||
128 | } | ||
129 | |||
130 | static inline void rt2x00rfkill_resume(struct rt2x00_dev *rt2x00dev) | ||
131 | { | ||
132 | } | ||
125 | #endif /* CONFIG_RT2X00_LIB_RFKILL */ | 133 | #endif /* CONFIG_RT2X00_LIB_RFKILL */ |
126 | 134 | ||
127 | #endif /* RT2X00LIB_H */ | 135 | #endif /* RT2X00LIB_H */ |
diff --git a/drivers/net/wireless/rt2x00/rt2x00rfkill.c b/drivers/net/wireless/rt2x00/rt2x00rfkill.c index 34a96d44e306..f95577596206 100644 --- a/drivers/net/wireless/rt2x00/rt2x00rfkill.c +++ b/drivers/net/wireless/rt2x00/rt2x00rfkill.c | |||
@@ -69,56 +69,81 @@ static void rt2x00rfkill_poll(struct input_polled_dev *poll_dev) | |||
69 | } | 69 | } |
70 | } | 70 | } |
71 | 71 | ||
72 | int rt2x00rfkill_register(struct rt2x00_dev *rt2x00dev) | 72 | void rt2x00rfkill_register(struct rt2x00_dev *rt2x00dev) |
73 | { | 73 | { |
74 | int retval; | 74 | if (!test_bit(CONFIG_SUPPORT_HW_BUTTON, &rt2x00dev->flags) || |
75 | 75 | !test_bit(RFKILL_STATE_ALLOCATED, &rt2x00dev->rfkill_state)) | |
76 | if (!test_bit(CONFIG_SUPPORT_HW_BUTTON, &rt2x00dev->flags)) | 76 | return; |
77 | return 0; | ||
78 | 77 | ||
79 | retval = rfkill_register(rt2x00dev->rfkill); | 78 | if (rfkill_register(rt2x00dev->rfkill)) { |
80 | if (retval) { | ||
81 | ERROR(rt2x00dev, "Failed to register rfkill handler.\n"); | 79 | ERROR(rt2x00dev, "Failed to register rfkill handler.\n"); |
82 | return retval; | 80 | return; |
83 | } | 81 | } |
84 | 82 | ||
85 | retval = input_register_polled_device(rt2x00dev->poll_dev); | 83 | if (input_register_polled_device(rt2x00dev->poll_dev)) { |
86 | if (retval) { | ||
87 | ERROR(rt2x00dev, "Failed to register polled device.\n"); | 84 | ERROR(rt2x00dev, "Failed to register polled device.\n"); |
88 | rfkill_unregister(rt2x00dev->rfkill); | 85 | rfkill_unregister(rt2x00dev->rfkill); |
89 | return retval; | 86 | return; |
90 | } | 87 | } |
91 | 88 | ||
89 | __set_bit(RFKILL_STATE_REGISTERED, &rt2x00dev->rfkill_state); | ||
90 | |||
92 | /* | 91 | /* |
93 | * Force initial poll which will detect the initial device state, | 92 | * Force initial poll which will detect the initial device state, |
94 | * and correctly sends the signal to the rfkill layer about this | 93 | * and correctly sends the signal to the rfkill layer about this |
95 | * state. | 94 | * state. |
96 | */ | 95 | */ |
97 | rt2x00rfkill_poll(rt2x00dev->poll_dev); | 96 | rt2x00rfkill_poll(rt2x00dev->poll_dev); |
98 | |||
99 | return 0; | ||
100 | } | 97 | } |
101 | 98 | ||
102 | void rt2x00rfkill_unregister(struct rt2x00_dev *rt2x00dev) | 99 | void rt2x00rfkill_unregister(struct rt2x00_dev *rt2x00dev) |
103 | { | 100 | { |
104 | if (!test_bit(CONFIG_SUPPORT_HW_BUTTON, &rt2x00dev->flags)) | 101 | if (!test_bit(CONFIG_SUPPORT_HW_BUTTON, &rt2x00dev->flags) || |
102 | !test_bit(RFKILL_STATE_REGISTERED, &rt2x00dev->rfkill_state)) | ||
105 | return; | 103 | return; |
106 | 104 | ||
107 | input_unregister_polled_device(rt2x00dev->poll_dev); | 105 | input_unregister_polled_device(rt2x00dev->poll_dev); |
108 | rfkill_unregister(rt2x00dev->rfkill); | 106 | rfkill_unregister(rt2x00dev->rfkill); |
107 | |||
108 | __clear_bit(RFKILL_STATE_REGISTERED, &rt2x00dev->rfkill_state); | ||
109 | } | 109 | } |
110 | 110 | ||
111 | int rt2x00rfkill_allocate(struct rt2x00_dev *rt2x00dev) | 111 | static struct input_polled_dev * |
112 | rt2x00rfkill_allocate_polldev(struct rt2x00_dev *rt2x00dev) | ||
112 | { | 113 | { |
113 | struct device *device = wiphy_dev(rt2x00dev->hw->wiphy); | 114 | struct input_polled_dev *poll_dev; |
115 | |||
116 | poll_dev = input_allocate_polled_device(); | ||
117 | if (!poll_dev) | ||
118 | return NULL; | ||
119 | |||
120 | poll_dev->private = rt2x00dev; | ||
121 | poll_dev->poll = rt2x00rfkill_poll; | ||
122 | poll_dev->poll_interval = RFKILL_POLL_INTERVAL; | ||
123 | |||
124 | poll_dev->input->name = rt2x00dev->ops->name; | ||
125 | poll_dev->input->phys = wiphy_name(rt2x00dev->hw->wiphy); | ||
126 | poll_dev->input->id.bustype = BUS_HOST; | ||
127 | poll_dev->input->id.vendor = 0x1814; | ||
128 | poll_dev->input->id.product = rt2x00dev->chip.rt; | ||
129 | poll_dev->input->id.version = rt2x00dev->chip.rev; | ||
130 | poll_dev->input->dev.parent = wiphy_dev(rt2x00dev->hw->wiphy); | ||
131 | poll_dev->input->evbit[0] = BIT(EV_KEY); | ||
132 | set_bit(KEY_WLAN, poll_dev->input->keybit); | ||
133 | |||
134 | return poll_dev; | ||
135 | } | ||
114 | 136 | ||
137 | void rt2x00rfkill_allocate(struct rt2x00_dev *rt2x00dev) | ||
138 | { | ||
115 | if (!test_bit(CONFIG_SUPPORT_HW_BUTTON, &rt2x00dev->flags)) | 139 | if (!test_bit(CONFIG_SUPPORT_HW_BUTTON, &rt2x00dev->flags)) |
116 | return 0; | 140 | return; |
117 | 141 | ||
118 | rt2x00dev->rfkill = rfkill_allocate(device, RFKILL_TYPE_WLAN); | 142 | rt2x00dev->rfkill = |
143 | rfkill_allocate(wiphy_dev(rt2x00dev->hw->wiphy), RFKILL_TYPE_WLAN); | ||
119 | if (!rt2x00dev->rfkill) { | 144 | if (!rt2x00dev->rfkill) { |
120 | ERROR(rt2x00dev, "Failed to allocate rfkill handler.\n"); | 145 | ERROR(rt2x00dev, "Failed to allocate rfkill handler.\n"); |
121 | goto exit; | 146 | return; |
122 | } | 147 | } |
123 | 148 | ||
124 | rt2x00dev->rfkill->name = rt2x00dev->ops->name; | 149 | rt2x00dev->rfkill->name = rt2x00dev->ops->name; |
@@ -126,40 +151,49 @@ int rt2x00rfkill_allocate(struct rt2x00_dev *rt2x00dev) | |||
126 | rt2x00dev->rfkill->state = -1; | 151 | rt2x00dev->rfkill->state = -1; |
127 | rt2x00dev->rfkill->toggle_radio = rt2x00rfkill_toggle_radio; | 152 | rt2x00dev->rfkill->toggle_radio = rt2x00rfkill_toggle_radio; |
128 | 153 | ||
129 | rt2x00dev->poll_dev = input_allocate_polled_device(); | 154 | rt2x00dev->poll_dev = rt2x00rfkill_allocate_polldev(rt2x00dev); |
130 | if (!rt2x00dev->poll_dev) { | 155 | if (!rt2x00dev->poll_dev) { |
131 | ERROR(rt2x00dev, "Failed to allocate polled device.\n"); | 156 | ERROR(rt2x00dev, "Failed to allocate polled device.\n"); |
132 | goto exit_free_rfkill; | 157 | rfkill_free(rt2x00dev->rfkill); |
158 | rt2x00dev->rfkill = NULL; | ||
159 | return; | ||
133 | } | 160 | } |
134 | 161 | ||
135 | rt2x00dev->poll_dev->private = rt2x00dev; | 162 | return; |
136 | rt2x00dev->poll_dev->poll = rt2x00rfkill_poll; | 163 | } |
137 | rt2x00dev->poll_dev->poll_interval = RFKILL_POLL_INTERVAL; | ||
138 | 164 | ||
139 | rt2x00dev->poll_dev->input->name = rt2x00dev->ops->name; | 165 | void rt2x00rfkill_free(struct rt2x00_dev *rt2x00dev) |
140 | rt2x00dev->poll_dev->input->phys = wiphy_name(rt2x00dev->hw->wiphy); | 166 | { |
141 | rt2x00dev->poll_dev->input->id.bustype = BUS_HOST; | 167 | if (!test_bit(CONFIG_SUPPORT_HW_BUTTON, &rt2x00dev->flags) || |
142 | rt2x00dev->poll_dev->input->id.vendor = 0x1814; | 168 | !test_bit(RFKILL_STATE_ALLOCATED, &rt2x00dev->rfkill_state)) |
143 | rt2x00dev->poll_dev->input->id.product = rt2x00dev->chip.rt; | 169 | return; |
144 | rt2x00dev->poll_dev->input->id.version = rt2x00dev->chip.rev; | ||
145 | rt2x00dev->poll_dev->input->dev.parent = device; | ||
146 | rt2x00dev->poll_dev->input->evbit[0] = BIT(EV_KEY); | ||
147 | set_bit(KEY_WLAN, rt2x00dev->poll_dev->input->keybit); | ||
148 | 170 | ||
149 | return 0; | 171 | input_free_polled_device(rt2x00dev->poll_dev); |
172 | rt2x00dev->poll_dev = NULL; | ||
150 | 173 | ||
151 | exit_free_rfkill: | ||
152 | rfkill_free(rt2x00dev->rfkill); | 174 | rfkill_free(rt2x00dev->rfkill); |
153 | 175 | rt2x00dev->rfkill = NULL; | |
154 | exit: | ||
155 | return -ENOMEM; | ||
156 | } | 176 | } |
157 | 177 | ||
158 | void rt2x00rfkill_free(struct rt2x00_dev *rt2x00dev) | 178 | void rt2x00rfkill_suspend(struct rt2x00_dev *rt2x00dev) |
159 | { | 179 | { |
160 | if (!test_bit(CONFIG_SUPPORT_HW_BUTTON, &rt2x00dev->flags)) | 180 | if (!test_bit(CONFIG_SUPPORT_HW_BUTTON, &rt2x00dev->flags) || |
181 | !test_bit(RFKILL_STATE_ALLOCATED, &rt2x00dev->rfkill_state)) | ||
161 | return; | 182 | return; |
162 | 183 | ||
163 | input_free_polled_device(rt2x00dev->poll_dev); | 184 | input_free_polled_device(rt2x00dev->poll_dev); |
164 | rfkill_free(rt2x00dev->rfkill); | 185 | rt2x00dev->poll_dev = NULL; |
186 | } | ||
187 | |||
188 | void rt2x00rfkill_resume(struct rt2x00_dev *rt2x00dev) | ||
189 | { | ||
190 | if (!test_bit(CONFIG_SUPPORT_HW_BUTTON, &rt2x00dev->flags) || | ||
191 | !test_bit(RFKILL_STATE_ALLOCATED, &rt2x00dev->rfkill_state)) | ||
192 | return; | ||
193 | |||
194 | rt2x00dev->poll_dev = rt2x00rfkill_allocate_polldev(rt2x00dev); | ||
195 | if (!rt2x00dev->poll_dev) { | ||
196 | ERROR(rt2x00dev, "Failed to allocate polled device.\n"); | ||
197 | return; | ||
198 | } | ||
165 | } | 199 | } |
diff --git a/drivers/parisc/pdc_stable.c b/drivers/parisc/pdc_stable.c index de34aa9d3136..f9f9a5f1bbd0 100644 --- a/drivers/parisc/pdc_stable.c +++ b/drivers/parisc/pdc_stable.c | |||
@@ -829,7 +829,7 @@ static ssize_t pdcs_autoboot_write(struct kobject *kobj, | |||
829 | struct kobj_attribute *attr, | 829 | struct kobj_attribute *attr, |
830 | const char *buf, size_t count) | 830 | const char *buf, size_t count) |
831 | { | 831 | { |
832 | return pdcs_auto_write(kset, attr, buf, count, PF_AUTOBOOT); | 832 | return pdcs_auto_write(kobj, attr, buf, count, PF_AUTOBOOT); |
833 | } | 833 | } |
834 | 834 | ||
835 | /** | 835 | /** |
@@ -845,7 +845,7 @@ static ssize_t pdcs_autosearch_write(struct kobject *kobj, | |||
845 | struct kobj_attribute *attr, | 845 | struct kobj_attribute *attr, |
846 | const char *buf, size_t count) | 846 | const char *buf, size_t count) |
847 | { | 847 | { |
848 | return pdcs_auto_write(kset, attr, buf, count, PF_AUTOSEARCH); | 848 | return pdcs_auto_write(kobj, attr, buf, count, PF_AUTOSEARCH); |
849 | } | 849 | } |
850 | 850 | ||
851 | /** | 851 | /** |
@@ -1066,7 +1066,7 @@ pdc_stable_init(void) | |||
1066 | } | 1066 | } |
1067 | 1067 | ||
1068 | /* Don't forget the root entries */ | 1068 | /* Don't forget the root entries */ |
1069 | error = sysfs_create_group(stable_kobj, pdcs_attr_group); | 1069 | error = sysfs_create_group(stable_kobj, &pdcs_attr_group); |
1070 | 1070 | ||
1071 | /* register the paths kset as a child of the stable kset */ | 1071 | /* register the paths kset as a child of the stable kset */ |
1072 | paths_kset = kset_create_and_add("paths", NULL, stable_kobj); | 1072 | paths_kset = kset_create_and_add("paths", NULL, stable_kobj); |
diff --git a/drivers/parisc/sba_iommu.c b/drivers/parisc/sba_iommu.c index bdbe780e21c5..8c4d2c13d5f2 100644 --- a/drivers/parisc/sba_iommu.c +++ b/drivers/parisc/sba_iommu.c | |||
@@ -314,8 +314,8 @@ sba_dump_sg( struct ioc *ioc, struct scatterlist *startsg, int nents) | |||
314 | #define RESMAP_MASK(n) (~0UL << (BITS_PER_LONG - (n))) | 314 | #define RESMAP_MASK(n) (~0UL << (BITS_PER_LONG - (n))) |
315 | #define RESMAP_IDX_MASK (sizeof(unsigned long) - 1) | 315 | #define RESMAP_IDX_MASK (sizeof(unsigned long) - 1) |
316 | 316 | ||
317 | unsigned long ptr_to_pide(struct ioc *ioc, unsigned long *res_ptr, | 317 | static unsigned long ptr_to_pide(struct ioc *ioc, unsigned long *res_ptr, |
318 | unsigned int bitshiftcnt) | 318 | unsigned int bitshiftcnt) |
319 | { | 319 | { |
320 | return (((unsigned long)res_ptr - (unsigned long)ioc->res_map) << 3) | 320 | return (((unsigned long)res_ptr - (unsigned long)ioc->res_map) << 3) |
321 | + bitshiftcnt; | 321 | + bitshiftcnt; |
diff --git a/drivers/pci/bus.c b/drivers/pci/bus.c index 6a9403d79e0c..d708358326e5 100644 --- a/drivers/pci/bus.c +++ b/drivers/pci/bus.c | |||
@@ -143,14 +143,18 @@ void pci_bus_add_devices(struct pci_bus *bus) | |||
143 | /* register the bus with sysfs as the parent is now | 143 | /* register the bus with sysfs as the parent is now |
144 | * properly registered. */ | 144 | * properly registered. */ |
145 | child_bus = dev->subordinate; | 145 | child_bus = dev->subordinate; |
146 | if (child_bus->is_added) | ||
147 | continue; | ||
146 | child_bus->dev.parent = child_bus->bridge; | 148 | child_bus->dev.parent = child_bus->bridge; |
147 | retval = device_register(&child_bus->dev); | 149 | retval = device_register(&child_bus->dev); |
148 | if (retval) | 150 | if (retval) |
149 | dev_err(&dev->dev, "Error registering pci_bus," | 151 | dev_err(&dev->dev, "Error registering pci_bus," |
150 | " continuing...\n"); | 152 | " continuing...\n"); |
151 | else | 153 | else { |
154 | child_bus->is_added = 1; | ||
152 | retval = device_create_file(&child_bus->dev, | 155 | retval = device_create_file(&child_bus->dev, |
153 | &dev_attr_cpuaffinity); | 156 | &dev_attr_cpuaffinity); |
157 | } | ||
154 | if (retval) | 158 | if (retval) |
155 | dev_err(&dev->dev, "Error creating cpuaffinity" | 159 | dev_err(&dev->dev, "Error creating cpuaffinity" |
156 | " file, continuing...\n"); | 160 | " file, continuing...\n"); |
diff --git a/drivers/pci/hotplug/pciehp_core.c b/drivers/pci/hotplug/pciehp_core.c index 7f4836b8e71e..5fa4ba0d9934 100644 --- a/drivers/pci/hotplug/pciehp_core.c +++ b/drivers/pci/hotplug/pciehp_core.c | |||
@@ -467,7 +467,7 @@ static int pciehp_probe(struct pcie_device *dev, const struct pcie_port_service_ | |||
467 | t_slot = pciehp_find_slot(ctrl, ctrl->slot_device_offset); | 467 | t_slot = pciehp_find_slot(ctrl, ctrl->slot_device_offset); |
468 | 468 | ||
469 | t_slot->hpc_ops->get_adapter_status(t_slot, &value); /* Check if slot is occupied */ | 469 | t_slot->hpc_ops->get_adapter_status(t_slot, &value); /* Check if slot is occupied */ |
470 | if (value) { | 470 | if (value && pciehp_force) { |
471 | rc = pciehp_enable_slot(t_slot); | 471 | rc = pciehp_enable_slot(t_slot); |
472 | if (rc) /* -ENODEV: shouldn't happen, but deal with it */ | 472 | if (rc) /* -ENODEV: shouldn't happen, but deal with it */ |
473 | value = 0; | 473 | value = 0; |
diff --git a/drivers/pci/intel-iommu.c b/drivers/pci/intel-iommu.c index 977d29b32295..4cb949f0ebd9 100644 --- a/drivers/pci/intel-iommu.c +++ b/drivers/pci/intel-iommu.c | |||
@@ -1097,6 +1097,8 @@ static void iommu_free_domain(struct dmar_domain *domain) | |||
1097 | } | 1097 | } |
1098 | 1098 | ||
1099 | static struct iova_domain reserved_iova_list; | 1099 | static struct iova_domain reserved_iova_list; |
1100 | static struct lock_class_key reserved_alloc_key; | ||
1101 | static struct lock_class_key reserved_rbtree_key; | ||
1100 | 1102 | ||
1101 | static void dmar_init_reserved_ranges(void) | 1103 | static void dmar_init_reserved_ranges(void) |
1102 | { | 1104 | { |
@@ -1107,6 +1109,11 @@ static void dmar_init_reserved_ranges(void) | |||
1107 | 1109 | ||
1108 | init_iova_domain(&reserved_iova_list, DMA_32BIT_PFN); | 1110 | init_iova_domain(&reserved_iova_list, DMA_32BIT_PFN); |
1109 | 1111 | ||
1112 | lockdep_set_class(&reserved_iova_list.iova_alloc_lock, | ||
1113 | &reserved_alloc_key); | ||
1114 | lockdep_set_class(&reserved_iova_list.iova_rbtree_lock, | ||
1115 | &reserved_rbtree_key); | ||
1116 | |||
1110 | /* IOAPIC ranges shouldn't be accessed by DMA */ | 1117 | /* IOAPIC ranges shouldn't be accessed by DMA */ |
1111 | iova = reserve_iova(&reserved_iova_list, IOVA_PFN(IOAPIC_RANGE_START), | 1118 | iova = reserve_iova(&reserved_iova_list, IOVA_PFN(IOAPIC_RANGE_START), |
1112 | IOVA_PFN(IOAPIC_RANGE_END)); | 1119 | IOVA_PFN(IOAPIC_RANGE_END)); |
diff --git a/drivers/pci/pci-acpi.c b/drivers/pci/pci-acpi.c index 4a23654184fc..72f7476930c8 100644 --- a/drivers/pci/pci-acpi.c +++ b/drivers/pci/pci-acpi.c | |||
@@ -272,21 +272,29 @@ static int acpi_pci_set_power_state(struct pci_dev *dev, pci_power_t state) | |||
272 | { | 272 | { |
273 | acpi_handle handle = DEVICE_ACPI_HANDLE(&dev->dev); | 273 | acpi_handle handle = DEVICE_ACPI_HANDLE(&dev->dev); |
274 | acpi_handle tmp; | 274 | acpi_handle tmp; |
275 | static int state_conv[] = { | 275 | static const u8 state_conv[] = { |
276 | [0] = 0, | 276 | [PCI_D0] = ACPI_STATE_D0, |
277 | [1] = 1, | 277 | [PCI_D1] = ACPI_STATE_D1, |
278 | [2] = 2, | 278 | [PCI_D2] = ACPI_STATE_D2, |
279 | [3] = 3, | 279 | [PCI_D3hot] = ACPI_STATE_D3, |
280 | [4] = 3 | 280 | [PCI_D3cold] = ACPI_STATE_D3 |
281 | }; | 281 | }; |
282 | int acpi_state = state_conv[(int __force) state]; | ||
283 | 282 | ||
284 | if (!handle) | 283 | if (!handle) |
285 | return -ENODEV; | 284 | return -ENODEV; |
286 | /* If the ACPI device has _EJ0, ignore the device */ | 285 | /* If the ACPI device has _EJ0, ignore the device */ |
287 | if (ACPI_SUCCESS(acpi_get_handle(handle, "_EJ0", &tmp))) | 286 | if (ACPI_SUCCESS(acpi_get_handle(handle, "_EJ0", &tmp))) |
288 | return 0; | 287 | return 0; |
289 | return acpi_bus_set_power(handle, acpi_state); | 288 | |
289 | switch (state) { | ||
290 | case PCI_D0: | ||
291 | case PCI_D1: | ||
292 | case PCI_D2: | ||
293 | case PCI_D3hot: | ||
294 | case PCI_D3cold: | ||
295 | return acpi_bus_set_power(handle, state_conv[state]); | ||
296 | } | ||
297 | return -EINVAL; | ||
290 | } | 298 | } |
291 | 299 | ||
292 | 300 | ||
diff --git a/drivers/pci/pci.c b/drivers/pci/pci.c index 183fddaa38b7..a4445b7210bf 100644 --- a/drivers/pci/pci.c +++ b/drivers/pci/pci.c | |||
@@ -314,24 +314,6 @@ int pci_find_ht_capability(struct pci_dev *dev, int ht_cap) | |||
314 | } | 314 | } |
315 | EXPORT_SYMBOL_GPL(pci_find_ht_capability); | 315 | EXPORT_SYMBOL_GPL(pci_find_ht_capability); |
316 | 316 | ||
317 | void pcie_wait_pending_transaction(struct pci_dev *dev) | ||
318 | { | ||
319 | int pos; | ||
320 | u16 reg16; | ||
321 | |||
322 | pos = pci_find_capability(dev, PCI_CAP_ID_EXP); | ||
323 | if (!pos) | ||
324 | return; | ||
325 | while (1) { | ||
326 | pci_read_config_word(dev, pos + PCI_EXP_DEVSTA, ®16); | ||
327 | if (!(reg16 & PCI_EXP_DEVSTA_TRPND)) | ||
328 | break; | ||
329 | cpu_relax(); | ||
330 | } | ||
331 | |||
332 | } | ||
333 | EXPORT_SYMBOL_GPL(pcie_wait_pending_transaction); | ||
334 | |||
335 | /** | 317 | /** |
336 | * pci_find_parent_resource - return resource region of parent bus of given region | 318 | * pci_find_parent_resource - return resource region of parent bus of given region |
337 | * @dev: PCI device structure contains resources to be searched | 319 | * @dev: PCI device structure contains resources to be searched |
@@ -936,9 +918,6 @@ pci_disable_device(struct pci_dev *dev) | |||
936 | if (atomic_sub_return(1, &dev->enable_cnt) != 0) | 918 | if (atomic_sub_return(1, &dev->enable_cnt) != 0) |
937 | return; | 919 | return; |
938 | 920 | ||
939 | /* Wait for all transactions are finished before disabling the device */ | ||
940 | pcie_wait_pending_transaction(dev); | ||
941 | |||
942 | pci_read_config_word(dev, PCI_COMMAND, &pci_command); | 921 | pci_read_config_word(dev, PCI_COMMAND, &pci_command); |
943 | if (pci_command & PCI_COMMAND_MASTER) { | 922 | if (pci_command & PCI_COMMAND_MASTER) { |
944 | pci_command &= ~PCI_COMMAND_MASTER; | 923 | pci_command &= ~PCI_COMMAND_MASTER; |
diff --git a/drivers/pnp/isapnp/core.c b/drivers/pnp/isapnp/core.c index 2c925b7cd93e..257f5d827d83 100644 --- a/drivers/pnp/isapnp/core.c +++ b/drivers/pnp/isapnp/core.c | |||
@@ -88,6 +88,15 @@ MODULE_LICENSE("GPL"); | |||
88 | #define _LTAG_MEM32RANGE 0x85 | 88 | #define _LTAG_MEM32RANGE 0x85 |
89 | #define _LTAG_FIXEDMEM32RANGE 0x86 | 89 | #define _LTAG_FIXEDMEM32RANGE 0x86 |
90 | 90 | ||
91 | /* | ||
92 | * Sizes of ISAPNP logical device configuration register sets. | ||
93 | * See PNP-ISA-v1.0a.pdf, Appendix A. | ||
94 | */ | ||
95 | #define ISAPNP_MAX_MEM 4 | ||
96 | #define ISAPNP_MAX_PORT 8 | ||
97 | #define ISAPNP_MAX_IRQ 2 | ||
98 | #define ISAPNP_MAX_DMA 2 | ||
99 | |||
91 | static unsigned char isapnp_checksum_value; | 100 | static unsigned char isapnp_checksum_value; |
92 | static DEFINE_MUTEX(isapnp_cfg_mutex); | 101 | static DEFINE_MUTEX(isapnp_cfg_mutex); |
93 | static int isapnp_csn_count; | 102 | static int isapnp_csn_count; |
@@ -945,14 +954,14 @@ static int isapnp_read_resources(struct pnp_dev *dev, | |||
945 | 954 | ||
946 | dev->active = isapnp_read_byte(ISAPNP_CFG_ACTIVATE); | 955 | dev->active = isapnp_read_byte(ISAPNP_CFG_ACTIVATE); |
947 | if (dev->active) { | 956 | if (dev->active) { |
948 | for (tmp = 0; tmp < PNP_MAX_PORT; tmp++) { | 957 | for (tmp = 0; tmp < ISAPNP_MAX_PORT; tmp++) { |
949 | ret = isapnp_read_word(ISAPNP_CFG_PORT + (tmp << 1)); | 958 | ret = isapnp_read_word(ISAPNP_CFG_PORT + (tmp << 1)); |
950 | if (!ret) | 959 | if (!ret) |
951 | continue; | 960 | continue; |
952 | res->port_resource[tmp].start = ret; | 961 | res->port_resource[tmp].start = ret; |
953 | res->port_resource[tmp].flags = IORESOURCE_IO; | 962 | res->port_resource[tmp].flags = IORESOURCE_IO; |
954 | } | 963 | } |
955 | for (tmp = 0; tmp < PNP_MAX_MEM; tmp++) { | 964 | for (tmp = 0; tmp < ISAPNP_MAX_MEM; tmp++) { |
956 | ret = | 965 | ret = |
957 | isapnp_read_word(ISAPNP_CFG_MEM + (tmp << 3)) << 8; | 966 | isapnp_read_word(ISAPNP_CFG_MEM + (tmp << 3)) << 8; |
958 | if (!ret) | 967 | if (!ret) |
@@ -960,7 +969,7 @@ static int isapnp_read_resources(struct pnp_dev *dev, | |||
960 | res->mem_resource[tmp].start = ret; | 969 | res->mem_resource[tmp].start = ret; |
961 | res->mem_resource[tmp].flags = IORESOURCE_MEM; | 970 | res->mem_resource[tmp].flags = IORESOURCE_MEM; |
962 | } | 971 | } |
963 | for (tmp = 0; tmp < PNP_MAX_IRQ; tmp++) { | 972 | for (tmp = 0; tmp < ISAPNP_MAX_IRQ; tmp++) { |
964 | ret = | 973 | ret = |
965 | (isapnp_read_word(ISAPNP_CFG_IRQ + (tmp << 1)) >> | 974 | (isapnp_read_word(ISAPNP_CFG_IRQ + (tmp << 1)) >> |
966 | 8); | 975 | 8); |
@@ -970,7 +979,7 @@ static int isapnp_read_resources(struct pnp_dev *dev, | |||
970 | res->irq_resource[tmp].end = ret; | 979 | res->irq_resource[tmp].end = ret; |
971 | res->irq_resource[tmp].flags = IORESOURCE_IRQ; | 980 | res->irq_resource[tmp].flags = IORESOURCE_IRQ; |
972 | } | 981 | } |
973 | for (tmp = 0; tmp < PNP_MAX_DMA; tmp++) { | 982 | for (tmp = 0; tmp < ISAPNP_MAX_DMA; tmp++) { |
974 | ret = isapnp_read_byte(ISAPNP_CFG_DMA + tmp); | 983 | ret = isapnp_read_byte(ISAPNP_CFG_DMA + tmp); |
975 | if (ret == 4) | 984 | if (ret == 4) |
976 | continue; | 985 | continue; |
@@ -1002,14 +1011,14 @@ static int isapnp_set_resources(struct pnp_dev *dev, | |||
1002 | isapnp_cfg_begin(dev->card->number, dev->number); | 1011 | isapnp_cfg_begin(dev->card->number, dev->number); |
1003 | dev->active = 1; | 1012 | dev->active = 1; |
1004 | for (tmp = 0; | 1013 | for (tmp = 0; |
1005 | tmp < PNP_MAX_PORT | 1014 | tmp < ISAPNP_MAX_PORT |
1006 | && (res->port_resource[tmp]. | 1015 | && (res->port_resource[tmp]. |
1007 | flags & (IORESOURCE_IO | IORESOURCE_UNSET)) == IORESOURCE_IO; | 1016 | flags & (IORESOURCE_IO | IORESOURCE_UNSET)) == IORESOURCE_IO; |
1008 | tmp++) | 1017 | tmp++) |
1009 | isapnp_write_word(ISAPNP_CFG_PORT + (tmp << 1), | 1018 | isapnp_write_word(ISAPNP_CFG_PORT + (tmp << 1), |
1010 | res->port_resource[tmp].start); | 1019 | res->port_resource[tmp].start); |
1011 | for (tmp = 0; | 1020 | for (tmp = 0; |
1012 | tmp < PNP_MAX_IRQ | 1021 | tmp < ISAPNP_MAX_IRQ |
1013 | && (res->irq_resource[tmp]. | 1022 | && (res->irq_resource[tmp]. |
1014 | flags & (IORESOURCE_IRQ | IORESOURCE_UNSET)) == IORESOURCE_IRQ; | 1023 | flags & (IORESOURCE_IRQ | IORESOURCE_UNSET)) == IORESOURCE_IRQ; |
1015 | tmp++) { | 1024 | tmp++) { |
@@ -1019,14 +1028,14 @@ static int isapnp_set_resources(struct pnp_dev *dev, | |||
1019 | isapnp_write_byte(ISAPNP_CFG_IRQ + (tmp << 1), irq); | 1028 | isapnp_write_byte(ISAPNP_CFG_IRQ + (tmp << 1), irq); |
1020 | } | 1029 | } |
1021 | for (tmp = 0; | 1030 | for (tmp = 0; |
1022 | tmp < PNP_MAX_DMA | 1031 | tmp < ISAPNP_MAX_DMA |
1023 | && (res->dma_resource[tmp]. | 1032 | && (res->dma_resource[tmp]. |
1024 | flags & (IORESOURCE_DMA | IORESOURCE_UNSET)) == IORESOURCE_DMA; | 1033 | flags & (IORESOURCE_DMA | IORESOURCE_UNSET)) == IORESOURCE_DMA; |
1025 | tmp++) | 1034 | tmp++) |
1026 | isapnp_write_byte(ISAPNP_CFG_DMA + tmp, | 1035 | isapnp_write_byte(ISAPNP_CFG_DMA + tmp, |
1027 | res->dma_resource[tmp].start); | 1036 | res->dma_resource[tmp].start); |
1028 | for (tmp = 0; | 1037 | for (tmp = 0; |
1029 | tmp < PNP_MAX_MEM | 1038 | tmp < ISAPNP_MAX_MEM |
1030 | && (res->mem_resource[tmp]. | 1039 | && (res->mem_resource[tmp]. |
1031 | flags & (IORESOURCE_MEM | IORESOURCE_UNSET)) == IORESOURCE_MEM; | 1040 | flags & (IORESOURCE_MEM | IORESOURCE_UNSET)) == IORESOURCE_MEM; |
1032 | tmp++) | 1041 | tmp++) |
diff --git a/drivers/rtc/Kconfig b/drivers/rtc/Kconfig index 82f5ad9c3af4..9e7de63b26ef 100644 --- a/drivers/rtc/Kconfig +++ b/drivers/rtc/Kconfig | |||
@@ -16,7 +16,7 @@ menuconfig RTC_CLASS | |||
16 | probably want to enable one or more of the interfaces below. | 16 | probably want to enable one or more of the interfaces below. |
17 | 17 | ||
18 | This driver can also be built as a module. If so, the module | 18 | This driver can also be built as a module. If so, the module |
19 | will be called rtc-class. | 19 | will be called rtc-core. |
20 | 20 | ||
21 | if RTC_CLASS | 21 | if RTC_CLASS |
22 | 22 | ||
diff --git a/drivers/rtc/rtc-at91sam9.c b/drivers/rtc/rtc-at91sam9.c index bbf10ecf416c..56728a2a3385 100644 --- a/drivers/rtc/rtc-at91sam9.c +++ b/drivers/rtc/rtc-at91sam9.c | |||
@@ -274,7 +274,7 @@ static irqreturn_t at91_rtc_interrupt(int irq, void *_rtc) | |||
274 | * SR clears it, so we must only read it in this irq handler! | 274 | * SR clears it, so we must only read it in this irq handler! |
275 | */ | 275 | */ |
276 | mr = rtt_readl(rtc, MR) & (AT91_RTT_ALMIEN | AT91_RTT_RTTINCIEN); | 276 | mr = rtt_readl(rtc, MR) & (AT91_RTT_ALMIEN | AT91_RTT_RTTINCIEN); |
277 | sr = rtt_readl(rtc, SR) & mr; | 277 | sr = rtt_readl(rtc, SR) & (mr >> 16); |
278 | if (!sr) | 278 | if (!sr) |
279 | return IRQ_NONE; | 279 | return IRQ_NONE; |
280 | 280 | ||
@@ -321,6 +321,10 @@ static int __init at91_rtc_probe(struct platform_device *pdev) | |||
321 | if (!rtc) | 321 | if (!rtc) |
322 | return -ENOMEM; | 322 | return -ENOMEM; |
323 | 323 | ||
324 | /* platform setup code should have handled this; sigh */ | ||
325 | if (!device_can_wakeup(&pdev->dev)) | ||
326 | device_init_wakeup(&pdev->dev, 1); | ||
327 | |||
324 | platform_set_drvdata(pdev, rtc); | 328 | platform_set_drvdata(pdev, rtc); |
325 | rtc->rtt = (void __force __iomem *) (AT91_VA_BASE_SYS - AT91_BASE_SYS); | 329 | rtc->rtt = (void __force __iomem *) (AT91_VA_BASE_SYS - AT91_BASE_SYS); |
326 | rtc->rtt += r->start; | 330 | rtc->rtt += r->start; |
diff --git a/drivers/scsi/Kconfig b/drivers/scsi/Kconfig index c46666a24809..b9d374082b65 100644 --- a/drivers/scsi/Kconfig +++ b/drivers/scsi/Kconfig | |||
@@ -325,7 +325,7 @@ menuconfig SCSI_LOWLEVEL | |||
325 | depends on SCSI!=n | 325 | depends on SCSI!=n |
326 | default y | 326 | default y |
327 | 327 | ||
328 | if SCSI_LOWLEVEL | 328 | if SCSI_LOWLEVEL && SCSI |
329 | 329 | ||
330 | config ISCSI_TCP | 330 | config ISCSI_TCP |
331 | tristate "iSCSI Initiator over TCP/IP" | 331 | tristate "iSCSI Initiator over TCP/IP" |
diff --git a/drivers/scsi/a100u2w.c b/drivers/scsi/a100u2w.c index f608d4a1d6da..792b2e807bf3 100644 --- a/drivers/scsi/a100u2w.c +++ b/drivers/scsi/a100u2w.c | |||
@@ -674,12 +674,13 @@ static struct orc_scb *__orc_alloc_scb(struct orc_host * host) | |||
674 | for (index = 0; index < 32; index++) { | 674 | for (index = 0; index < 32; index++) { |
675 | if ((host->allocation_map[channel][i] >> index) & 0x01) { | 675 | if ((host->allocation_map[channel][i] >> index) & 0x01) { |
676 | host->allocation_map[channel][i] &= ~(1 << index); | 676 | host->allocation_map[channel][i] &= ~(1 << index); |
677 | break; | 677 | idx = index + 32 * i; |
678 | /* | ||
679 | * Translate the index to a structure instance | ||
680 | */ | ||
681 | return host->scb_virt + idx; | ||
678 | } | 682 | } |
679 | } | 683 | } |
680 | idx = index + 32 * i; | ||
681 | /* Translate the index to a structure instance */ | ||
682 | return (struct orc_scb *) ((unsigned long) host->scb_virt + (idx * sizeof(struct orc_scb))); | ||
683 | } | 684 | } |
684 | return NULL; | 685 | return NULL; |
685 | } | 686 | } |
diff --git a/drivers/scsi/advansys.c b/drivers/scsi/advansys.c index 3c2d6888bb8c..8591585e5cc5 100644 --- a/drivers/scsi/advansys.c +++ b/drivers/scsi/advansys.c | |||
@@ -6439,7 +6439,7 @@ static int AdvLoadMicrocode(AdvPortAddr iop_base, unsigned char *buf, int size, | |||
6439 | i += 2; | 6439 | i += 2; |
6440 | len += 2; | 6440 | len += 2; |
6441 | } else { | 6441 | } else { |
6442 | unsigned char off = buf[i] * 2; | 6442 | unsigned int off = buf[i] * 2; |
6443 | unsigned short word = (buf[off + 1] << 8) | buf[off]; | 6443 | unsigned short word = (buf[off + 1] << 8) | buf[off]; |
6444 | AdvWriteWordAutoIncLram(iop_base, word); | 6444 | AdvWriteWordAutoIncLram(iop_base, word); |
6445 | len += 2; | 6445 | len += 2; |
diff --git a/drivers/scsi/arcmsr/arcmsr.h b/drivers/scsi/arcmsr/arcmsr.h index 0393707bdfce..3288be2e49f8 100644 --- a/drivers/scsi/arcmsr/arcmsr.h +++ b/drivers/scsi/arcmsr/arcmsr.h | |||
@@ -341,13 +341,13 @@ struct MessageUnit_B | |||
341 | uint32_t done_qbuffer[ARCMSR_MAX_HBB_POSTQUEUE]; | 341 | uint32_t done_qbuffer[ARCMSR_MAX_HBB_POSTQUEUE]; |
342 | uint32_t postq_index; | 342 | uint32_t postq_index; |
343 | uint32_t doneq_index; | 343 | uint32_t doneq_index; |
344 | uint32_t __iomem *drv2iop_doorbell_reg; | 344 | void __iomem *drv2iop_doorbell_reg; |
345 | uint32_t __iomem *drv2iop_doorbell_mask_reg; | 345 | void __iomem *drv2iop_doorbell_mask_reg; |
346 | uint32_t __iomem *iop2drv_doorbell_reg; | 346 | void __iomem *iop2drv_doorbell_reg; |
347 | uint32_t __iomem *iop2drv_doorbell_mask_reg; | 347 | void __iomem *iop2drv_doorbell_mask_reg; |
348 | uint32_t __iomem *msgcode_rwbuffer_reg; | 348 | void __iomem *msgcode_rwbuffer_reg; |
349 | uint32_t __iomem *ioctl_wbuffer_reg; | 349 | void __iomem *ioctl_wbuffer_reg; |
350 | uint32_t __iomem *ioctl_rbuffer_reg; | 350 | void __iomem *ioctl_rbuffer_reg; |
351 | }; | 351 | }; |
352 | 352 | ||
353 | /* | 353 | /* |
diff --git a/drivers/scsi/gdth.c b/drivers/scsi/gdth.c index 27ebd336409b..0b2080d33575 100644 --- a/drivers/scsi/gdth.c +++ b/drivers/scsi/gdth.c | |||
@@ -493,6 +493,12 @@ int __gdth_execute(struct scsi_device *sdev, gdth_cmd_str *gdtcmd, char *cmnd, | |||
493 | if (!scp) | 493 | if (!scp) |
494 | return -ENOMEM; | 494 | return -ENOMEM; |
495 | 495 | ||
496 | scp->sense_buffer = kzalloc(SCSI_SENSE_BUFFERSIZE, GFP_KERNEL); | ||
497 | if (!scp->sense_buffer) { | ||
498 | kfree(scp); | ||
499 | return -ENOMEM; | ||
500 | } | ||
501 | |||
496 | scp->device = sdev; | 502 | scp->device = sdev; |
497 | memset(&cmndinfo, 0, sizeof(cmndinfo)); | 503 | memset(&cmndinfo, 0, sizeof(cmndinfo)); |
498 | 504 | ||
@@ -513,6 +519,7 @@ int __gdth_execute(struct scsi_device *sdev, gdth_cmd_str *gdtcmd, char *cmnd, | |||
513 | rval = cmndinfo.status; | 519 | rval = cmndinfo.status; |
514 | if (info) | 520 | if (info) |
515 | *info = cmndinfo.info; | 521 | *info = cmndinfo.info; |
522 | kfree(scp->sense_buffer); | ||
516 | kfree(scp); | 523 | kfree(scp); |
517 | return rval; | 524 | return rval; |
518 | } | 525 | } |
diff --git a/drivers/scsi/scsi_lib.c b/drivers/scsi/scsi_lib.c index ba21d97d1855..f40898dc2d14 100644 --- a/drivers/scsi/scsi_lib.c +++ b/drivers/scsi/scsi_lib.c | |||
@@ -2162,10 +2162,15 @@ void sdev_evt_send(struct scsi_device *sdev, struct scsi_event *evt) | |||
2162 | { | 2162 | { |
2163 | unsigned long flags; | 2163 | unsigned long flags; |
2164 | 2164 | ||
2165 | #if 0 | ||
2166 | /* FIXME: currently this check eliminates all media change events | ||
2167 | * for polled devices. Need to update to discriminate between AN | ||
2168 | * and polled events */ | ||
2165 | if (!test_bit(evt->evt_type, sdev->supported_events)) { | 2169 | if (!test_bit(evt->evt_type, sdev->supported_events)) { |
2166 | kfree(evt); | 2170 | kfree(evt); |
2167 | return; | 2171 | return; |
2168 | } | 2172 | } |
2173 | #endif | ||
2169 | 2174 | ||
2170 | spin_lock_irqsave(&sdev->list_lock, flags); | 2175 | spin_lock_irqsave(&sdev->list_lock, flags); |
2171 | list_add_tail(&evt->node, &sdev->event_list); | 2176 | list_add_tail(&evt->node, &sdev->event_list); |
diff --git a/drivers/scsi/scsi_sysfs.c b/drivers/scsi/scsi_sysfs.c index ed83cdb6e67d..b9b09a704584 100644 --- a/drivers/scsi/scsi_sysfs.c +++ b/drivers/scsi/scsi_sysfs.c | |||
@@ -294,6 +294,7 @@ static void scsi_device_dev_release_usercontext(struct work_struct *work) | |||
294 | } | 294 | } |
295 | 295 | ||
296 | if (sdev->request_queue) { | 296 | if (sdev->request_queue) { |
297 | bsg_unregister_queue(sdev->request_queue); | ||
297 | sdev->request_queue->queuedata = NULL; | 298 | sdev->request_queue->queuedata = NULL; |
298 | /* user context needed to free queue */ | 299 | /* user context needed to free queue */ |
299 | scsi_free_queue(sdev->request_queue); | 300 | scsi_free_queue(sdev->request_queue); |
@@ -857,7 +858,6 @@ void __scsi_remove_device(struct scsi_device *sdev) | |||
857 | if (scsi_device_set_state(sdev, SDEV_CANCEL) != 0) | 858 | if (scsi_device_set_state(sdev, SDEV_CANCEL) != 0) |
858 | return; | 859 | return; |
859 | 860 | ||
860 | bsg_unregister_queue(sdev->request_queue); | ||
861 | class_device_unregister(&sdev->sdev_classdev); | 861 | class_device_unregister(&sdev->sdev_classdev); |
862 | transport_remove_device(dev); | 862 | transport_remove_device(dev); |
863 | device_del(dev); | 863 | device_del(dev); |
diff --git a/drivers/scsi/sd.c b/drivers/scsi/sd.c index 7aee64dbfbeb..5fe7aaed904c 100644 --- a/drivers/scsi/sd.c +++ b/drivers/scsi/sd.c | |||
@@ -1654,6 +1654,7 @@ static int sd_probe(struct device *dev) | |||
1654 | sdkp->disk = gd; | 1654 | sdkp->disk = gd; |
1655 | sdkp->index = index; | 1655 | sdkp->index = index; |
1656 | sdkp->openers = 0; | 1656 | sdkp->openers = 0; |
1657 | sdkp->previous_state = 1; | ||
1657 | 1658 | ||
1658 | if (!sdp->timeout) { | 1659 | if (!sdp->timeout) { |
1659 | if (sdp->type != TYPE_MOD) | 1660 | if (sdp->type != TYPE_MOD) |
diff --git a/drivers/scsi/sr.c b/drivers/scsi/sr.c index 208565bdbe8e..7ee86d4a7618 100644 --- a/drivers/scsi/sr.c +++ b/drivers/scsi/sr.c | |||
@@ -623,6 +623,7 @@ static int sr_probe(struct device *dev) | |||
623 | cd->disk = disk; | 623 | cd->disk = disk; |
624 | cd->capacity = 0x1fffff; | 624 | cd->capacity = 0x1fffff; |
625 | cd->device->changed = 1; /* force recheck CD type */ | 625 | cd->device->changed = 1; /* force recheck CD type */ |
626 | cd->previous_state = 1; | ||
626 | cd->use = 1; | 627 | cd->use = 1; |
627 | cd->readcd_known = 0; | 628 | cd->readcd_known = 0; |
628 | cd->readcd_cdda = 0; | 629 | cd->readcd_cdda = 0; |
diff --git a/drivers/serial/sh-sci.c b/drivers/serial/sh-sci.c index a8c116b80bff..9d244d1644e1 100644 --- a/drivers/serial/sh-sci.c +++ b/drivers/serial/sh-sci.c | |||
@@ -414,12 +414,12 @@ static void sci_init_pins_scif(struct uart_port *port, unsigned int cflag) | |||
414 | defined(CONFIG_CPU_SUBTYPE_SH7785) | 414 | defined(CONFIG_CPU_SUBTYPE_SH7785) |
415 | static inline int scif_txroom(struct uart_port *port) | 415 | static inline int scif_txroom(struct uart_port *port) |
416 | { | 416 | { |
417 | return SCIF_TXROOM_MAX - (sci_in(port, SCTFDR) & 0x7f); | 417 | return SCIF_TXROOM_MAX - (sci_in(port, SCTFDR) & 0xff); |
418 | } | 418 | } |
419 | 419 | ||
420 | static inline int scif_rxroom(struct uart_port *port) | 420 | static inline int scif_rxroom(struct uart_port *port) |
421 | { | 421 | { |
422 | return sci_in(port, SCRFDR) & 0x7f; | 422 | return sci_in(port, SCRFDR) & 0xff; |
423 | } | 423 | } |
424 | #else | 424 | #else |
425 | static inline int scif_txroom(struct uart_port *port) | 425 | static inline int scif_txroom(struct uart_port *port) |
diff --git a/drivers/sn/ioc3.c b/drivers/sn/ioc3.c index 29fcd6d0301d..a0aa33dde0a4 100644 --- a/drivers/sn/ioc3.c +++ b/drivers/sn/ioc3.c | |||
@@ -561,7 +561,7 @@ void ioc3_unregister_submodule(struct ioc3_submodule *is) | |||
561 | printk(KERN_WARNING | 561 | printk(KERN_WARNING |
562 | "%s: IOC3 submodule %s remove failed " | 562 | "%s: IOC3 submodule %s remove failed " |
563 | "for pci_dev %s.\n", | 563 | "for pci_dev %s.\n", |
564 | __FUNCTION__, module_name(is->owner), | 564 | __func__, module_name(is->owner), |
565 | pci_name(idd->pdev)); | 565 | pci_name(idd->pdev)); |
566 | idd->active[is->id] = 0; | 566 | idd->active[is->id] = 0; |
567 | if(is->irq_mask) | 567 | if(is->irq_mask) |
@@ -611,7 +611,7 @@ static int ioc3_probe(struct pci_dev *pdev, const struct pci_device_id *pci_id) | |||
611 | if ((ret = pci_enable_device(pdev))) { | 611 | if ((ret = pci_enable_device(pdev))) { |
612 | printk(KERN_WARNING | 612 | printk(KERN_WARNING |
613 | "%s: Failed to enable IOC3 device for pci_dev %s.\n", | 613 | "%s: Failed to enable IOC3 device for pci_dev %s.\n", |
614 | __FUNCTION__, pci_name(pdev)); | 614 | __func__, pci_name(pdev)); |
615 | goto out; | 615 | goto out; |
616 | } | 616 | } |
617 | pci_set_master(pdev); | 617 | pci_set_master(pdev); |
@@ -623,7 +623,7 @@ static int ioc3_probe(struct pci_dev *pdev, const struct pci_device_id *pci_id) | |||
623 | if (ret < 0) { | 623 | if (ret < 0) { |
624 | printk(KERN_WARNING "%s: Unable to obtain 64 bit DMA " | 624 | printk(KERN_WARNING "%s: Unable to obtain 64 bit DMA " |
625 | "for consistent allocations\n", | 625 | "for consistent allocations\n", |
626 | __FUNCTION__); | 626 | __func__); |
627 | } | 627 | } |
628 | } | 628 | } |
629 | #endif | 629 | #endif |
@@ -633,7 +633,7 @@ static int ioc3_probe(struct pci_dev *pdev, const struct pci_device_id *pci_id) | |||
633 | if (!idd) { | 633 | if (!idd) { |
634 | printk(KERN_WARNING | 634 | printk(KERN_WARNING |
635 | "%s: Failed to allocate IOC3 data for pci_dev %s.\n", | 635 | "%s: Failed to allocate IOC3 data for pci_dev %s.\n", |
636 | __FUNCTION__, pci_name(pdev)); | 636 | __func__, pci_name(pdev)); |
637 | ret = -ENODEV; | 637 | ret = -ENODEV; |
638 | goto out_idd; | 638 | goto out_idd; |
639 | } | 639 | } |
@@ -649,7 +649,7 @@ static int ioc3_probe(struct pci_dev *pdev, const struct pci_device_id *pci_id) | |||
649 | printk(KERN_WARNING | 649 | printk(KERN_WARNING |
650 | "%s: Unable to find IOC3 resource " | 650 | "%s: Unable to find IOC3 resource " |
651 | "for pci_dev %s.\n", | 651 | "for pci_dev %s.\n", |
652 | __FUNCTION__, pci_name(pdev)); | 652 | __func__, pci_name(pdev)); |
653 | ret = -ENODEV; | 653 | ret = -ENODEV; |
654 | goto out_pci; | 654 | goto out_pci; |
655 | } | 655 | } |
@@ -657,7 +657,7 @@ static int ioc3_probe(struct pci_dev *pdev, const struct pci_device_id *pci_id) | |||
657 | printk(KERN_WARNING | 657 | printk(KERN_WARNING |
658 | "%s: Unable to request IOC3 region " | 658 | "%s: Unable to request IOC3 region " |
659 | "for pci_dev %s.\n", | 659 | "for pci_dev %s.\n", |
660 | __FUNCTION__, pci_name(pdev)); | 660 | __func__, pci_name(pdev)); |
661 | ret = -ENODEV; | 661 | ret = -ENODEV; |
662 | goto out_pci; | 662 | goto out_pci; |
663 | } | 663 | } |
@@ -666,7 +666,7 @@ static int ioc3_probe(struct pci_dev *pdev, const struct pci_device_id *pci_id) | |||
666 | printk(KERN_WARNING | 666 | printk(KERN_WARNING |
667 | "%s: Unable to remap IOC3 region " | 667 | "%s: Unable to remap IOC3 region " |
668 | "for pci_dev %s.\n", | 668 | "for pci_dev %s.\n", |
669 | __FUNCTION__, pci_name(pdev)); | 669 | __func__, pci_name(pdev)); |
670 | ret = -ENODEV; | 670 | ret = -ENODEV; |
671 | goto out_misc_region; | 671 | goto out_misc_region; |
672 | } | 672 | } |
@@ -709,7 +709,7 @@ static int ioc3_probe(struct pci_dev *pdev, const struct pci_device_id *pci_id) | |||
709 | } else { | 709 | } else { |
710 | printk(KERN_WARNING | 710 | printk(KERN_WARNING |
711 | "%s : request_irq fails for IRQ 0x%x\n ", | 711 | "%s : request_irq fails for IRQ 0x%x\n ", |
712 | __FUNCTION__, pdev->irq); | 712 | __func__, pdev->irq); |
713 | } | 713 | } |
714 | if (!request_irq(pdev->irq+2, ioc3_intr_io, IRQF_SHARED, | 714 | if (!request_irq(pdev->irq+2, ioc3_intr_io, IRQF_SHARED, |
715 | "ioc3-io", (void *)idd)) { | 715 | "ioc3-io", (void *)idd)) { |
@@ -717,7 +717,7 @@ static int ioc3_probe(struct pci_dev *pdev, const struct pci_device_id *pci_id) | |||
717 | } else { | 717 | } else { |
718 | printk(KERN_WARNING | 718 | printk(KERN_WARNING |
719 | "%s : request_irq fails for IRQ 0x%x\n ", | 719 | "%s : request_irq fails for IRQ 0x%x\n ", |
720 | __FUNCTION__, pdev->irq+2); | 720 | __func__, pdev->irq+2); |
721 | } | 721 | } |
722 | } else { | 722 | } else { |
723 | if (!request_irq(pdev->irq, ioc3_intr_io, IRQF_SHARED, | 723 | if (!request_irq(pdev->irq, ioc3_intr_io, IRQF_SHARED, |
@@ -726,7 +726,7 @@ static int ioc3_probe(struct pci_dev *pdev, const struct pci_device_id *pci_id) | |||
726 | } else { | 726 | } else { |
727 | printk(KERN_WARNING | 727 | printk(KERN_WARNING |
728 | "%s : request_irq fails for IRQ 0x%x\n ", | 728 | "%s : request_irq fails for IRQ 0x%x\n ", |
729 | __FUNCTION__, pdev->irq); | 729 | __func__, pdev->irq); |
730 | } | 730 | } |
731 | } | 731 | } |
732 | 732 | ||
@@ -769,7 +769,7 @@ static void ioc3_remove(struct pci_dev *pdev) | |||
769 | printk(KERN_WARNING | 769 | printk(KERN_WARNING |
770 | "%s: IOC3 submodule 0x%s remove failed " | 770 | "%s: IOC3 submodule 0x%s remove failed " |
771 | "for pci_dev %s.\n", | 771 | "for pci_dev %s.\n", |
772 | __FUNCTION__, | 772 | __func__, |
773 | module_name(ioc3_submodules[id]->owner), | 773 | module_name(ioc3_submodules[id]->owner), |
774 | pci_name(pdev)); | 774 | pci_name(pdev)); |
775 | idd->active[id] = 0; | 775 | idd->active[id] = 0; |
diff --git a/drivers/spi/au1550_spi.c b/drivers/spi/au1550_spi.c index c47a650183a1..41a3d00c4515 100644 --- a/drivers/spi/au1550_spi.c +++ b/drivers/spi/au1550_spi.c | |||
@@ -99,7 +99,7 @@ static dbdev_tab_t au1550_spi_mem_dbdev = | |||
99 | static void au1550_spi_bits_handlers_set(struct au1550_spi *hw, int bpw); | 99 | static void au1550_spi_bits_handlers_set(struct au1550_spi *hw, int bpw); |
100 | 100 | ||
101 | 101 | ||
102 | /** | 102 | /* |
103 | * compute BRG and DIV bits to setup spi clock based on main input clock rate | 103 | * compute BRG and DIV bits to setup spi clock based on main input clock rate |
104 | * that was specified in platform data structure | 104 | * that was specified in platform data structure |
105 | * according to au1550 datasheet: | 105 | * according to au1550 datasheet: |
@@ -650,7 +650,7 @@ static int au1550_spi_txrx_bufs(struct spi_device *spi, struct spi_transfer *t) | |||
650 | return hw->txrx_bufs(spi, t); | 650 | return hw->txrx_bufs(spi, t); |
651 | } | 651 | } |
652 | 652 | ||
653 | static irqreturn_t au1550_spi_irq(int irq, void *dev, struct pt_regs *regs) | 653 | static irqreturn_t au1550_spi_irq(int irq, void *dev) |
654 | { | 654 | { |
655 | struct au1550_spi *hw = dev; | 655 | struct au1550_spi *hw = dev; |
656 | return hw->irq_callback(hw); | 656 | return hw->irq_callback(hw); |
diff --git a/drivers/spi/spi_bitbang.c b/drivers/spi/spi_bitbang.c index f7f8580edad8..71e881419cdd 100644 --- a/drivers/spi/spi_bitbang.c +++ b/drivers/spi/spi_bitbang.c | |||
@@ -344,12 +344,14 @@ static void bitbang_work(struct work_struct *work) | |||
344 | t->rx_dma = t->tx_dma = 0; | 344 | t->rx_dma = t->tx_dma = 0; |
345 | status = bitbang->txrx_bufs(spi, t); | 345 | status = bitbang->txrx_bufs(spi, t); |
346 | } | 346 | } |
347 | if (status > 0) | ||
348 | m->actual_length += status; | ||
347 | if (status != t->len) { | 349 | if (status != t->len) { |
348 | if (status > 0) | 350 | /* always report some kind of error */ |
349 | status = -EMSGSIZE; | 351 | if (status >= 0) |
352 | status = -EREMOTEIO; | ||
350 | break; | 353 | break; |
351 | } | 354 | } |
352 | m->actual_length += status; | ||
353 | status = 0; | 355 | status = 0; |
354 | 356 | ||
355 | /* protocol tweaks before next transfer */ | 357 | /* protocol tweaks before next transfer */ |
diff --git a/drivers/thermal/Kconfig b/drivers/thermal/Kconfig index 69f19f224875..17e71d56f31e 100644 --- a/drivers/thermal/Kconfig +++ b/drivers/thermal/Kconfig | |||
@@ -4,7 +4,6 @@ | |||
4 | 4 | ||
5 | menuconfig THERMAL | 5 | menuconfig THERMAL |
6 | bool "Generic Thermal sysfs driver" | 6 | bool "Generic Thermal sysfs driver" |
7 | default y | ||
8 | help | 7 | help |
9 | Generic Thermal Sysfs driver offers a generic mechanism for | 8 | Generic Thermal Sysfs driver offers a generic mechanism for |
10 | thermal management. Usually it's made up of one or more thermal | 9 | thermal management. Usually it's made up of one or more thermal |
diff --git a/drivers/uio/uio.c b/drivers/uio/uio.c index e8a01f264540..11759080ca54 100644 --- a/drivers/uio/uio.c +++ b/drivers/uio/uio.c | |||
@@ -470,6 +470,8 @@ static int uio_mmap_physical(struct vm_area_struct *vma) | |||
470 | 470 | ||
471 | vma->vm_flags |= VM_IO | VM_RESERVED; | 471 | vma->vm_flags |= VM_IO | VM_RESERVED; |
472 | 472 | ||
473 | vma->vm_page_prot = pgprot_noncached(vma->vm_page_prot); | ||
474 | |||
473 | return remap_pfn_range(vma, | 475 | return remap_pfn_range(vma, |
474 | vma->vm_start, | 476 | vma->vm_start, |
475 | idev->info->mem[mi].addr >> PAGE_SHIFT, | 477 | idev->info->mem[mi].addr >> PAGE_SHIFT, |
diff --git a/drivers/usb/core/message.c b/drivers/usb/core/message.c index fefb92296e8f..c311f67b7f08 100644 --- a/drivers/usb/core/message.c +++ b/drivers/usb/core/message.c | |||
@@ -1206,7 +1206,10 @@ int usb_set_interface(struct usb_device *dev, int interface, int alternate) | |||
1206 | return -EINVAL; | 1206 | return -EINVAL; |
1207 | } | 1207 | } |
1208 | 1208 | ||
1209 | ret = usb_control_msg(dev, usb_sndctrlpipe(dev, 0), | 1209 | if (dev->quirks & USB_QUIRK_NO_SET_INTF) |
1210 | ret = -EPIPE; | ||
1211 | else | ||
1212 | ret = usb_control_msg(dev, usb_sndctrlpipe(dev, 0), | ||
1210 | USB_REQ_SET_INTERFACE, USB_RECIP_INTERFACE, | 1213 | USB_REQ_SET_INTERFACE, USB_RECIP_INTERFACE, |
1211 | alternate, interface, NULL, 0, 5000); | 1214 | alternate, interface, NULL, 0, 5000); |
1212 | 1215 | ||
diff --git a/drivers/usb/core/quirks.c b/drivers/usb/core/quirks.c index d9d1eb19f2a1..dfc5418ea10c 100644 --- a/drivers/usb/core/quirks.c +++ b/drivers/usb/core/quirks.c | |||
@@ -50,6 +50,9 @@ static const struct usb_device_id usb_quirk_list[] = { | |||
50 | /* M-Systems Flash Disk Pioneers */ | 50 | /* M-Systems Flash Disk Pioneers */ |
51 | { USB_DEVICE(0x08ec, 0x1000), .driver_info = USB_QUIRK_RESET_RESUME }, | 51 | { USB_DEVICE(0x08ec, 0x1000), .driver_info = USB_QUIRK_RESET_RESUME }, |
52 | 52 | ||
53 | /* X-Rite/Gretag-Macbeth Eye-One Pro display colorimeter */ | ||
54 | { USB_DEVICE(0x0971, 0x2000), .driver_info = USB_QUIRK_NO_SET_INTF }, | ||
55 | |||
53 | /* Action Semiconductor flash disk */ | 56 | /* Action Semiconductor flash disk */ |
54 | { USB_DEVICE(0x10d6, 0x2200), .driver_info = | 57 | { USB_DEVICE(0x10d6, 0x2200), .driver_info = |
55 | USB_QUIRK_STRING_FETCH_255 }, | 58 | USB_QUIRK_STRING_FETCH_255 }, |
diff --git a/drivers/usb/gadget/inode.c b/drivers/usb/gadget/inode.c index 805602a687cb..0a6feafc8d28 100644 --- a/drivers/usb/gadget/inode.c +++ b/drivers/usb/gadget/inode.c | |||
@@ -1458,7 +1458,7 @@ gadgetfs_setup (struct usb_gadget *gadget, const struct usb_ctrlrequest *ctrl) | |||
1458 | /* currently one config, two speeds */ | 1458 | /* currently one config, two speeds */ |
1459 | case USB_REQ_SET_CONFIGURATION: | 1459 | case USB_REQ_SET_CONFIGURATION: |
1460 | if (ctrl->bRequestType != 0) | 1460 | if (ctrl->bRequestType != 0) |
1461 | break; | 1461 | goto unrecognized; |
1462 | if (0 == (u8) w_value) { | 1462 | if (0 == (u8) w_value) { |
1463 | value = 0; | 1463 | value = 0; |
1464 | dev->current_config = 0; | 1464 | dev->current_config = 0; |
@@ -1505,7 +1505,7 @@ gadgetfs_setup (struct usb_gadget *gadget, const struct usb_ctrlrequest *ctrl) | |||
1505 | /* PXA automagically handles this request too */ | 1505 | /* PXA automagically handles this request too */ |
1506 | case USB_REQ_GET_CONFIGURATION: | 1506 | case USB_REQ_GET_CONFIGURATION: |
1507 | if (ctrl->bRequestType != 0x80) | 1507 | if (ctrl->bRequestType != 0x80) |
1508 | break; | 1508 | goto unrecognized; |
1509 | *(u8 *)req->buf = dev->current_config; | 1509 | *(u8 *)req->buf = dev->current_config; |
1510 | value = min (w_length, (u16) 1); | 1510 | value = min (w_length, (u16) 1); |
1511 | break; | 1511 | break; |
diff --git a/drivers/usb/host/ehci-pci.c b/drivers/usb/host/ehci-pci.c index 3ba01664f821..72ccd56e36dd 100644 --- a/drivers/usb/host/ehci-pci.c +++ b/drivers/usb/host/ehci-pci.c | |||
@@ -152,6 +152,20 @@ static int ehci_pci_setup(struct usb_hcd *hcd) | |||
152 | break; | 152 | break; |
153 | } | 153 | } |
154 | break; | 154 | break; |
155 | case PCI_VENDOR_ID_VIA: | ||
156 | if (pdev->device == 0x3104 && (pdev->revision & 0xf0) == 0x60) { | ||
157 | u8 tmp; | ||
158 | |||
159 | /* The VT6212 defaults to a 1 usec EHCI sleep time which | ||
160 | * hogs the PCI bus *badly*. Setting bit 5 of 0x4B makes | ||
161 | * that sleep time use the conventional 10 usec. | ||
162 | */ | ||
163 | pci_read_config_byte(pdev, 0x4b, &tmp); | ||
164 | if (tmp & 0x20) | ||
165 | break; | ||
166 | pci_write_config_byte(pdev, 0x4b, tmp | 0x20); | ||
167 | } | ||
168 | break; | ||
155 | } | 169 | } |
156 | 170 | ||
157 | ehci_reset(ehci); | 171 | ehci_reset(ehci); |
diff --git a/drivers/usb/serial/pl2303.c b/drivers/usb/serial/pl2303.c index ae3ec1a64008..2af778555bdc 100644 --- a/drivers/usb/serial/pl2303.c +++ b/drivers/usb/serial/pl2303.c | |||
@@ -55,6 +55,7 @@ static struct usb_device_id id_table [] = { | |||
55 | { USB_DEVICE(PL2303_VENDOR_ID, PL2303_PRODUCT_ID_DCU11) }, | 55 | { USB_DEVICE(PL2303_VENDOR_ID, PL2303_PRODUCT_ID_DCU11) }, |
56 | { USB_DEVICE(PL2303_VENDOR_ID, PL2303_PRODUCT_ID_RSAQ3) }, | 56 | { USB_DEVICE(PL2303_VENDOR_ID, PL2303_PRODUCT_ID_RSAQ3) }, |
57 | { USB_DEVICE(PL2303_VENDOR_ID, PL2303_PRODUCT_ID_PHAROS) }, | 57 | { USB_DEVICE(PL2303_VENDOR_ID, PL2303_PRODUCT_ID_PHAROS) }, |
58 | { USB_DEVICE(PL2303_VENDOR_ID, PL2303_PRODUCT_ID_ALDIGA) }, | ||
58 | { USB_DEVICE(IODATA_VENDOR_ID, IODATA_PRODUCT_ID) }, | 59 | { USB_DEVICE(IODATA_VENDOR_ID, IODATA_PRODUCT_ID) }, |
59 | { USB_DEVICE(IODATA_VENDOR_ID, IODATA_PRODUCT_ID_RSAQ5) }, | 60 | { USB_DEVICE(IODATA_VENDOR_ID, IODATA_PRODUCT_ID_RSAQ5) }, |
60 | { USB_DEVICE(ATEN_VENDOR_ID, ATEN_PRODUCT_ID) }, | 61 | { USB_DEVICE(ATEN_VENDOR_ID, ATEN_PRODUCT_ID) }, |
diff --git a/drivers/usb/serial/pl2303.h b/drivers/usb/serial/pl2303.h index 237a41f6638a..10cf872e5ecb 100644 --- a/drivers/usb/serial/pl2303.h +++ b/drivers/usb/serial/pl2303.h | |||
@@ -13,6 +13,7 @@ | |||
13 | #define PL2303_PRODUCT_ID_DCU11 0x1234 | 13 | #define PL2303_PRODUCT_ID_DCU11 0x1234 |
14 | #define PL2303_PRODUCT_ID_PHAROS 0xaaa0 | 14 | #define PL2303_PRODUCT_ID_PHAROS 0xaaa0 |
15 | #define PL2303_PRODUCT_ID_RSAQ3 0xaaa2 | 15 | #define PL2303_PRODUCT_ID_RSAQ3 0xaaa2 |
16 | #define PL2303_PRODUCT_ID_ALDIGA 0x0611 | ||
16 | 17 | ||
17 | #define ATEN_VENDOR_ID 0x0557 | 18 | #define ATEN_VENDOR_ID 0x0557 |
18 | #define ATEN_VENDOR_ID2 0x0547 | 19 | #define ATEN_VENDOR_ID2 0x0547 |
diff --git a/drivers/usb/serial/sierra.c b/drivers/usb/serial/sierra.c index e3d44ae8d448..ed678811e6a6 100644 --- a/drivers/usb/serial/sierra.c +++ b/drivers/usb/serial/sierra.c | |||
@@ -14,7 +14,7 @@ | |||
14 | Whom based his on the Keyspan driver by Hugh Blemings <hugh@blemings.org> | 14 | Whom based his on the Keyspan driver by Hugh Blemings <hugh@blemings.org> |
15 | */ | 15 | */ |
16 | 16 | ||
17 | #define DRIVER_VERSION "v.1.2.7" | 17 | #define DRIVER_VERSION "v.1.2.8" |
18 | #define DRIVER_AUTHOR "Kevin Lloyd <linux@sierrawireless.com>" | 18 | #define DRIVER_AUTHOR "Kevin Lloyd <linux@sierrawireless.com>" |
19 | #define DRIVER_DESC "USB Driver for Sierra Wireless USB modems" | 19 | #define DRIVER_DESC "USB Driver for Sierra Wireless USB modems" |
20 | 20 | ||
@@ -163,6 +163,7 @@ static struct usb_device_id id_table [] = { | |||
163 | { USB_DEVICE(0x1199, 0x6803) }, /* Sierra Wireless MC8765 */ | 163 | { USB_DEVICE(0x1199, 0x6803) }, /* Sierra Wireless MC8765 */ |
164 | { USB_DEVICE(0x1199, 0x6812) }, /* Sierra Wireless MC8775 & AC 875U */ | 164 | { USB_DEVICE(0x1199, 0x6812) }, /* Sierra Wireless MC8775 & AC 875U */ |
165 | { USB_DEVICE(0x1199, 0x6813) }, /* Sierra Wireless MC8775 (Thinkpad internal) */ | 165 | { USB_DEVICE(0x1199, 0x6813) }, /* Sierra Wireless MC8775 (Thinkpad internal) */ |
166 | { USB_DEVICE(0x1199, 0x6815) }, /* Sierra Wireless MC8775 */ | ||
166 | { USB_DEVICE(0x1199, 0x6820) }, /* Sierra Wireless AirCard 875 */ | 167 | { USB_DEVICE(0x1199, 0x6820) }, /* Sierra Wireless AirCard 875 */ |
167 | { USB_DEVICE(0x1199, 0x6832) }, /* Sierra Wireless MC8780*/ | 168 | { USB_DEVICE(0x1199, 0x6832) }, /* Sierra Wireless MC8780*/ |
168 | { USB_DEVICE(0x1199, 0x6833) }, /* Sierra Wireless MC8781*/ | 169 | { USB_DEVICE(0x1199, 0x6833) }, /* Sierra Wireless MC8781*/ |
@@ -196,9 +197,9 @@ struct sierra_port_private { | |||
196 | spinlock_t lock; /* lock the structure */ | 197 | spinlock_t lock; /* lock the structure */ |
197 | int outstanding_urbs; /* number of out urbs in flight */ | 198 | int outstanding_urbs; /* number of out urbs in flight */ |
198 | 199 | ||
199 | /* Input endpoints and buffer for this port */ | 200 | /* Input endpoints and buffers for this port */ |
200 | struct urb *in_urbs[N_IN_URB]; | 201 | struct urb *in_urbs[N_IN_URB]; |
201 | char in_buffer[N_IN_URB][IN_BUFLEN]; | 202 | char *in_buffer[N_IN_URB]; |
202 | 203 | ||
203 | /* Settings for the port */ | 204 | /* Settings for the port */ |
204 | int rts_state; /* Handshaking pins (outputs) */ | 205 | int rts_state; /* Handshaking pins (outputs) */ |
@@ -638,6 +639,15 @@ static int sierra_startup(struct usb_serial *serial) | |||
638 | return -ENOMEM; | 639 | return -ENOMEM; |
639 | } | 640 | } |
640 | spin_lock_init(&portdata->lock); | 641 | spin_lock_init(&portdata->lock); |
642 | for (j = 0; j < N_IN_URB; j++) { | ||
643 | portdata->in_buffer[j] = kmalloc(IN_BUFLEN, GFP_KERNEL); | ||
644 | if (!portdata->in_buffer[j]) { | ||
645 | for (--j; j >= 0; j--) | ||
646 | kfree(portdata->in_buffer[j]); | ||
647 | kfree(portdata); | ||
648 | return -ENOMEM; | ||
649 | } | ||
650 | } | ||
641 | 651 | ||
642 | usb_set_serial_port_data(port, portdata); | 652 | usb_set_serial_port_data(port, portdata); |
643 | 653 | ||
@@ -681,7 +691,7 @@ static void sierra_shutdown(struct usb_serial *serial) | |||
681 | for (j = 0; j < N_IN_URB; j++) { | 691 | for (j = 0; j < N_IN_URB; j++) { |
682 | usb_kill_urb(portdata->in_urbs[j]); | 692 | usb_kill_urb(portdata->in_urbs[j]); |
683 | usb_free_urb(portdata->in_urbs[j]); | 693 | usb_free_urb(portdata->in_urbs[j]); |
684 | portdata->in_urbs[j] = NULL; | 694 | kfree(portdata->in_buffer[j]); |
685 | } | 695 | } |
686 | kfree(portdata); | 696 | kfree(portdata); |
687 | usb_set_serial_port_data(port, NULL); | 697 | usb_set_serial_port_data(port, NULL); |
diff --git a/drivers/usb/storage/isd200.c b/drivers/usb/storage/isd200.c index 2ae1e8673b19..971d13dd5e65 100644 --- a/drivers/usb/storage/isd200.c +++ b/drivers/usb/storage/isd200.c | |||
@@ -1230,6 +1230,7 @@ static int isd200_get_inquiry_data( struct us_data *us ) | |||
1230 | 1230 | ||
1231 | /* Free driver structure */ | 1231 | /* Free driver structure */ |
1232 | us->extra_destructor(info); | 1232 | us->extra_destructor(info); |
1233 | kfree(info); | ||
1233 | us->extra = NULL; | 1234 | us->extra = NULL; |
1234 | us->extra_destructor = NULL; | 1235 | us->extra_destructor = NULL; |
1235 | } | 1236 | } |
@@ -1469,6 +1470,7 @@ static void isd200_free_info_ptrs(void *info_) | |||
1469 | if (info) { | 1470 | if (info) { |
1470 | kfree(info->id); | 1471 | kfree(info->id); |
1471 | kfree(info->RegsBuf); | 1472 | kfree(info->RegsBuf); |
1473 | kfree(info->srb.sense_buffer); | ||
1472 | } | 1474 | } |
1473 | } | 1475 | } |
1474 | 1476 | ||
@@ -1494,7 +1496,9 @@ static int isd200_init_info(struct us_data *us) | |||
1494 | kzalloc(sizeof(struct hd_driveid), GFP_KERNEL); | 1496 | kzalloc(sizeof(struct hd_driveid), GFP_KERNEL); |
1495 | info->RegsBuf = (unsigned char *) | 1497 | info->RegsBuf = (unsigned char *) |
1496 | kmalloc(sizeof(info->ATARegs), GFP_KERNEL); | 1498 | kmalloc(sizeof(info->ATARegs), GFP_KERNEL); |
1497 | if (!info->id || !info->RegsBuf) { | 1499 | info->srb.sense_buffer = |
1500 | kmalloc(SCSI_SENSE_BUFFERSIZE, GFP_KERNEL); | ||
1501 | if (!info->id || !info->RegsBuf || !info->srb.sense_buffer) { | ||
1498 | isd200_free_info_ptrs(info); | 1502 | isd200_free_info_ptrs(info); |
1499 | kfree(info); | 1503 | kfree(info); |
1500 | retStatus = ISD200_ERROR; | 1504 | retStatus = ISD200_ERROR; |
diff --git a/drivers/usb/storage/transport.c b/drivers/usb/storage/transport.c index 5780ed15f1ad..bdd4334bed5a 100644 --- a/drivers/usb/storage/transport.c +++ b/drivers/usb/storage/transport.c | |||
@@ -1009,7 +1009,8 @@ int usb_stor_Bulk_transport(struct scsi_cmnd *srb, struct us_data *us) | |||
1009 | US_DEBUGP("Bulk Status S 0x%x T 0x%x R %u Stat 0x%x\n", | 1009 | US_DEBUGP("Bulk Status S 0x%x T 0x%x R %u Stat 0x%x\n", |
1010 | le32_to_cpu(bcs->Signature), bcs->Tag, | 1010 | le32_to_cpu(bcs->Signature), bcs->Tag, |
1011 | residue, bcs->Status); | 1011 | residue, bcs->Status); |
1012 | if (bcs->Tag != us->tag || bcs->Status > US_BULK_STAT_PHASE) { | 1012 | if (!(bcs->Tag == us->tag || (us->flags & US_FL_BULK_IGNORE_TAG)) || |
1013 | bcs->Status > US_BULK_STAT_PHASE) { | ||
1013 | US_DEBUGP("Bulk logical error\n"); | 1014 | US_DEBUGP("Bulk logical error\n"); |
1014 | return USB_STOR_TRANSPORT_ERROR; | 1015 | return USB_STOR_TRANSPORT_ERROR; |
1015 | } | 1016 | } |
diff --git a/drivers/usb/storage/unusual_devs.h b/drivers/usb/storage/unusual_devs.h index 99679a8cfa02..e5219a56947c 100644 --- a/drivers/usb/storage/unusual_devs.h +++ b/drivers/usb/storage/unusual_devs.h | |||
@@ -1589,6 +1589,17 @@ UNUSUAL_DEV( 0x22b8, 0x4810, 0x0001, 0x0001, | |||
1589 | US_SC_DEVICE, US_PR_DEVICE, NULL, | 1589 | US_SC_DEVICE, US_PR_DEVICE, NULL, |
1590 | US_FL_FIX_CAPACITY), | 1590 | US_FL_FIX_CAPACITY), |
1591 | 1591 | ||
1592 | /* | ||
1593 | * Patch by Constantin Baranov <const@tltsu.ru> | ||
1594 | * Report by Andreas Koenecke. | ||
1595 | * Motorola ROKR Z6. | ||
1596 | */ | ||
1597 | UNUSUAL_DEV( 0x22b8, 0x6426, 0x0101, 0x0101, | ||
1598 | "Motorola", | ||
1599 | "MSnc.", | ||
1600 | US_SC_DEVICE, US_PR_DEVICE, NULL, | ||
1601 | US_FL_FIX_INQUIRY | US_FL_FIX_CAPACITY | US_FL_BULK_IGNORE_TAG), | ||
1602 | |||
1592 | /* Reported by Radovan Garabik <garabik@kassiopeia.juls.savba.sk> */ | 1603 | /* Reported by Radovan Garabik <garabik@kassiopeia.juls.savba.sk> */ |
1593 | UNUSUAL_DEV( 0x2735, 0x100b, 0x0000, 0x9999, | 1604 | UNUSUAL_DEV( 0x2735, 0x100b, 0x0000, 0x9999, |
1594 | "MPIO", | 1605 | "MPIO", |
diff --git a/drivers/video/Kconfig b/drivers/video/Kconfig index e0b0580705e4..1bd5fb30237d 100644 --- a/drivers/video/Kconfig +++ b/drivers/video/Kconfig | |||
@@ -1893,6 +1893,20 @@ config FB_XILINX | |||
1893 | framebuffer. ML300 carries a 640*480 LCD display on the board, | 1893 | framebuffer. ML300 carries a 640*480 LCD display on the board, |
1894 | ML403 uses a standard DB15 VGA connector. | 1894 | ML403 uses a standard DB15 VGA connector. |
1895 | 1895 | ||
1896 | config FB_METRONOME | ||
1897 | tristate "Metronome display controller support" | ||
1898 | depends on FB && ARCH_PXA && MMU | ||
1899 | select FB_SYS_FILLRECT | ||
1900 | select FB_SYS_COPYAREA | ||
1901 | select FB_SYS_IMAGEBLIT | ||
1902 | select FB_SYS_FOPS | ||
1903 | select FB_DEFERRED_IO | ||
1904 | help | ||
1905 | This enables support for the Metronome display controller. Tested | ||
1906 | with an E-Ink 800x600 display and Gumstix Connex through an AMLCD | ||
1907 | interface. Please read <file:Documentation/fb/metronomefb.txt> | ||
1908 | for more information. | ||
1909 | |||
1896 | config FB_VIRTUAL | 1910 | config FB_VIRTUAL |
1897 | tristate "Virtual Frame Buffer support (ONLY FOR TESTING!)" | 1911 | tristate "Virtual Frame Buffer support (ONLY FOR TESTING!)" |
1898 | depends on FB | 1912 | depends on FB |
diff --git a/drivers/video/Makefile b/drivers/video/Makefile index 03371c789039..11c0e5e05f21 100644 --- a/drivers/video/Makefile +++ b/drivers/video/Makefile | |||
@@ -103,6 +103,7 @@ obj-$(CONFIG_FB_PMAG_AA) += pmag-aa-fb.o | |||
103 | obj-$(CONFIG_FB_PMAG_BA) += pmag-ba-fb.o | 103 | obj-$(CONFIG_FB_PMAG_BA) += pmag-ba-fb.o |
104 | obj-$(CONFIG_FB_PMAGB_B) += pmagb-b-fb.o | 104 | obj-$(CONFIG_FB_PMAGB_B) += pmagb-b-fb.o |
105 | obj-$(CONFIG_FB_MAXINE) += maxinefb.o | 105 | obj-$(CONFIG_FB_MAXINE) += maxinefb.o |
106 | obj-$(CONFIG_FB_METRONOME) += metronomefb.o | ||
106 | obj-$(CONFIG_FB_S1D13XXX) += s1d13xxxfb.o | 107 | obj-$(CONFIG_FB_S1D13XXX) += s1d13xxxfb.o |
107 | obj-$(CONFIG_FB_IMX) += imxfb.o | 108 | obj-$(CONFIG_FB_IMX) += imxfb.o |
108 | obj-$(CONFIG_FB_S3C2410) += s3c2410fb.o | 109 | obj-$(CONFIG_FB_S3C2410) += s3c2410fb.o |
diff --git a/drivers/video/fb_defio.c b/drivers/video/fb_defio.c index 0f8cfb988c90..24843fdd5395 100644 --- a/drivers/video/fb_defio.c +++ b/drivers/video/fb_defio.c | |||
@@ -4,7 +4,7 @@ | |||
4 | * Copyright (C) 2006 Jaya Kumar | 4 | * Copyright (C) 2006 Jaya Kumar |
5 | * | 5 | * |
6 | * This file is subject to the terms and conditions of the GNU General Public | 6 | * This file is subject to the terms and conditions of the GNU General Public |
7 | * License. See the file COPYING in the main directory of this archive | 7 | * License. See the file COPYING in the main directory of this archive |
8 | * for more details. | 8 | * for more details. |
9 | */ | 9 | */ |
10 | 10 | ||
@@ -31,7 +31,7 @@ static int fb_deferred_io_fault(struct vm_area_struct *vma, | |||
31 | unsigned long offset; | 31 | unsigned long offset; |
32 | struct page *page; | 32 | struct page *page; |
33 | struct fb_info *info = vma->vm_private_data; | 33 | struct fb_info *info = vma->vm_private_data; |
34 | /* info->screen_base is in System RAM */ | 34 | /* info->screen_base is virtual memory */ |
35 | void *screen_base = (void __force *) info->screen_base; | 35 | void *screen_base = (void __force *) info->screen_base; |
36 | 36 | ||
37 | offset = vmf->pgoff << PAGE_SHIFT; | 37 | offset = vmf->pgoff << PAGE_SHIFT; |
@@ -43,6 +43,15 @@ static int fb_deferred_io_fault(struct vm_area_struct *vma, | |||
43 | return VM_FAULT_SIGBUS; | 43 | return VM_FAULT_SIGBUS; |
44 | 44 | ||
45 | get_page(page); | 45 | get_page(page); |
46 | |||
47 | if (vma->vm_file) | ||
48 | page->mapping = vma->vm_file->f_mapping; | ||
49 | else | ||
50 | printk(KERN_ERR "no mapping available\n"); | ||
51 | |||
52 | BUG_ON(!page->mapping); | ||
53 | page->index = vmf->pgoff; | ||
54 | |||
46 | vmf->page = page; | 55 | vmf->page = page; |
47 | return 0; | 56 | return 0; |
48 | } | 57 | } |
@@ -138,11 +147,20 @@ EXPORT_SYMBOL_GPL(fb_deferred_io_init); | |||
138 | 147 | ||
139 | void fb_deferred_io_cleanup(struct fb_info *info) | 148 | void fb_deferred_io_cleanup(struct fb_info *info) |
140 | { | 149 | { |
150 | void *screen_base = (void __force *) info->screen_base; | ||
141 | struct fb_deferred_io *fbdefio = info->fbdefio; | 151 | struct fb_deferred_io *fbdefio = info->fbdefio; |
152 | struct page *page; | ||
153 | int i; | ||
142 | 154 | ||
143 | BUG_ON(!fbdefio); | 155 | BUG_ON(!fbdefio); |
144 | cancel_delayed_work(&info->deferred_work); | 156 | cancel_delayed_work(&info->deferred_work); |
145 | flush_scheduled_work(); | 157 | flush_scheduled_work(); |
158 | |||
159 | /* clear out the mapping that we setup */ | ||
160 | for (i = 0 ; i < info->fix.smem_len; i += PAGE_SIZE) { | ||
161 | page = vmalloc_to_page(screen_base + i); | ||
162 | page->mapping = NULL; | ||
163 | } | ||
146 | } | 164 | } |
147 | EXPORT_SYMBOL_GPL(fb_deferred_io_cleanup); | 165 | EXPORT_SYMBOL_GPL(fb_deferred_io_cleanup); |
148 | 166 | ||
diff --git a/drivers/video/i810/i810_main.c b/drivers/video/i810/i810_main.c index 1d13dd099af8..a24e680d2b9c 100644 --- a/drivers/video/i810/i810_main.c +++ b/drivers/video/i810/i810_main.c | |||
@@ -1476,7 +1476,7 @@ static int i810fb_cursor(struct fb_info *info, struct fb_cursor *cursor) | |||
1476 | struct i810fb_par *par = info->par; | 1476 | struct i810fb_par *par = info->par; |
1477 | u8 __iomem *mmio = par->mmio_start_virtual; | 1477 | u8 __iomem *mmio = par->mmio_start_virtual; |
1478 | 1478 | ||
1479 | if (!(par->dev_flags & LOCKUP)) | 1479 | if (par->dev_flags & LOCKUP) |
1480 | return -ENXIO; | 1480 | return -ENXIO; |
1481 | 1481 | ||
1482 | if (cursor->image.width > 64 || cursor->image.height > 64) | 1482 | if (cursor->image.width > 64 || cursor->image.height > 64) |
diff --git a/drivers/video/metronomefb.c b/drivers/video/metronomefb.c new file mode 100644 index 000000000000..e9a89fd82757 --- /dev/null +++ b/drivers/video/metronomefb.c | |||
@@ -0,0 +1,999 @@ | |||
1 | /* | ||
2 | * linux/drivers/video/metronomefb.c -- FB driver for Metronome controller | ||
3 | * | ||
4 | * Copyright (C) 2008, Jaya Kumar | ||
5 | * | ||
6 | * This file is subject to the terms and conditions of the GNU General Public | ||
7 | * License. See the file COPYING in the main directory of this archive for | ||
8 | * more details. | ||
9 | * | ||
10 | * Layout is based on skeletonfb.c by James Simmons and Geert Uytterhoeven. | ||
11 | * | ||
12 | * This work was made possible by help and equipment support from E-Ink | ||
13 | * Corporation. http://support.eink.com/community | ||
14 | * | ||
15 | * This driver is written to be used with the Metronome display controller. | ||
16 | * It was tested with an E-Ink 800x600 Vizplex EPD on a Gumstix Connex board | ||
17 | * using the Lyre interface board. | ||
18 | * | ||
19 | * General notes: | ||
20 | * - User must set metronomefb_enable=1 to enable it. | ||
21 | * - See Documentation/fb/metronomefb.txt for how metronome works. | ||
22 | */ | ||
23 | #include <linux/module.h> | ||
24 | #include <linux/kernel.h> | ||
25 | #include <linux/errno.h> | ||
26 | #include <linux/string.h> | ||
27 | #include <linux/mm.h> | ||
28 | #include <linux/slab.h> | ||
29 | #include <linux/vmalloc.h> | ||
30 | #include <linux/delay.h> | ||
31 | #include <linux/interrupt.h> | ||
32 | #include <linux/fb.h> | ||
33 | #include <linux/init.h> | ||
34 | #include <linux/platform_device.h> | ||
35 | #include <linux/list.h> | ||
36 | #include <linux/firmware.h> | ||
37 | #include <linux/dma-mapping.h> | ||
38 | #include <linux/uaccess.h> | ||
39 | #include <linux/irq.h> | ||
40 | |||
41 | #include <asm/arch/pxa-regs.h> | ||
42 | #include <asm/unaligned.h> | ||
43 | |||
44 | #define DEBUG 1 | ||
45 | #ifdef DEBUG | ||
46 | #define DPRINTK(f, a...) printk(KERN_DEBUG "%s: " f, __func__ , ## a) | ||
47 | #else | ||
48 | #define DPRINTK(f, a...) | ||
49 | #endif | ||
50 | |||
51 | |||
52 | /* Display specific information */ | ||
53 | #define DPY_W 832 | ||
54 | #define DPY_H 622 | ||
55 | |||
56 | struct metromem_desc { | ||
57 | u32 mFDADR0; | ||
58 | u32 mFSADR0; | ||
59 | u32 mFIDR0; | ||
60 | u32 mLDCMD0; | ||
61 | }; | ||
62 | |||
63 | struct metromem_cmd { | ||
64 | u16 opcode; | ||
65 | u16 args[((64-2)/2)]; | ||
66 | u16 csum; | ||
67 | }; | ||
68 | |||
69 | struct metronomefb_par { | ||
70 | unsigned char *metromem; | ||
71 | struct metromem_desc *metromem_desc; | ||
72 | struct metromem_cmd *metromem_cmd; | ||
73 | unsigned char *metromem_wfm; | ||
74 | unsigned char *metromem_img; | ||
75 | u16 *metromem_img_csum; | ||
76 | u16 *csum_table; | ||
77 | int metromemsize; | ||
78 | dma_addr_t metromem_dma; | ||
79 | dma_addr_t metromem_desc_dma; | ||
80 | struct fb_info *info; | ||
81 | wait_queue_head_t waitq; | ||
82 | u8 frame_count; | ||
83 | }; | ||
84 | |||
85 | /* frame differs from image. frame includes non-visible pixels */ | ||
86 | struct epd_frame { | ||
87 | int fw; /* frame width */ | ||
88 | int fh; /* frame height */ | ||
89 | }; | ||
90 | |||
91 | static struct epd_frame epd_frame_table[] = { | ||
92 | { | ||
93 | .fw = 832, | ||
94 | .fh = 622 | ||
95 | }, | ||
96 | }; | ||
97 | |||
98 | static struct fb_fix_screeninfo metronomefb_fix __devinitdata = { | ||
99 | .id = "metronomefb", | ||
100 | .type = FB_TYPE_PACKED_PIXELS, | ||
101 | .visual = FB_VISUAL_STATIC_PSEUDOCOLOR, | ||
102 | .xpanstep = 0, | ||
103 | .ypanstep = 0, | ||
104 | .ywrapstep = 0, | ||
105 | .line_length = DPY_W, | ||
106 | .accel = FB_ACCEL_NONE, | ||
107 | }; | ||
108 | |||
109 | static struct fb_var_screeninfo metronomefb_var __devinitdata = { | ||
110 | .xres = DPY_W, | ||
111 | .yres = DPY_H, | ||
112 | .xres_virtual = DPY_W, | ||
113 | .yres_virtual = DPY_H, | ||
114 | .bits_per_pixel = 8, | ||
115 | .grayscale = 1, | ||
116 | .nonstd = 1, | ||
117 | .red = { 4, 3, 0 }, | ||
118 | .green = { 0, 0, 0 }, | ||
119 | .blue = { 0, 0, 0 }, | ||
120 | .transp = { 0, 0, 0 }, | ||
121 | }; | ||
122 | |||
123 | static unsigned int metronomefb_enable; | ||
124 | |||
125 | struct waveform_hdr { | ||
126 | u8 stuff[32]; | ||
127 | |||
128 | u8 wmta[3]; | ||
129 | u8 fvsn; | ||
130 | |||
131 | u8 luts; | ||
132 | u8 mc; | ||
133 | u8 trc; | ||
134 | u8 stuff3; | ||
135 | |||
136 | u8 endb; | ||
137 | u8 swtb; | ||
138 | u8 stuff2a[2]; | ||
139 | |||
140 | u8 stuff2b[3]; | ||
141 | u8 wfm_cs; | ||
142 | } __attribute__ ((packed)); | ||
143 | |||
144 | /* main metronomefb functions */ | ||
145 | static u8 calc_cksum(int start, int end, u8 *mem) | ||
146 | { | ||
147 | u8 tmp = 0; | ||
148 | int i; | ||
149 | |||
150 | for (i = start; i < end; i++) | ||
151 | tmp += mem[i]; | ||
152 | |||
153 | return tmp; | ||
154 | } | ||
155 | |||
156 | static u16 calc_img_cksum(u16 *start, int length) | ||
157 | { | ||
158 | u16 tmp = 0; | ||
159 | |||
160 | while (length--) | ||
161 | tmp += *start++; | ||
162 | |||
163 | return tmp; | ||
164 | } | ||
165 | |||
166 | /* here we decode the incoming waveform file and populate metromem */ | ||
167 | #define EXP_WFORM_SIZE 47001 | ||
168 | static int load_waveform(u8 *mem, size_t size, u8 *metromem, int m, int t, | ||
169 | u8 *frame_count) | ||
170 | { | ||
171 | int tta; | ||
172 | int wmta; | ||
173 | int trn = 0; | ||
174 | int i; | ||
175 | unsigned char v; | ||
176 | u8 cksum; | ||
177 | int cksum_idx; | ||
178 | int wfm_idx, owfm_idx; | ||
179 | int mem_idx = 0; | ||
180 | struct waveform_hdr *wfm_hdr; | ||
181 | |||
182 | if (size != EXP_WFORM_SIZE) { | ||
183 | printk(KERN_ERR "Error: unexpected size %d != %d\n", size, | ||
184 | EXP_WFORM_SIZE); | ||
185 | return -EINVAL; | ||
186 | } | ||
187 | |||
188 | wfm_hdr = (struct waveform_hdr *) mem; | ||
189 | |||
190 | if (wfm_hdr->fvsn != 1) { | ||
191 | printk(KERN_ERR "Error: bad fvsn %x\n", wfm_hdr->fvsn); | ||
192 | return -EINVAL; | ||
193 | } | ||
194 | if (wfm_hdr->luts != 0) { | ||
195 | printk(KERN_ERR "Error: bad luts %x\n", wfm_hdr->luts); | ||
196 | return -EINVAL; | ||
197 | } | ||
198 | cksum = calc_cksum(32, 47, mem); | ||
199 | if (cksum != wfm_hdr->wfm_cs) { | ||
200 | printk(KERN_ERR "Error: bad cksum %x != %x\n", cksum, | ||
201 | wfm_hdr->wfm_cs); | ||
202 | return -EINVAL; | ||
203 | } | ||
204 | wfm_hdr->mc += 1; | ||
205 | wfm_hdr->trc += 1; | ||
206 | for (i = 0; i < 5; i++) { | ||
207 | if (*(wfm_hdr->stuff2a + i) != 0) { | ||
208 | printk(KERN_ERR "Error: unexpected value in padding\n"); | ||
209 | return -EINVAL; | ||
210 | } | ||
211 | } | ||
212 | |||
213 | /* calculating trn. trn is something used to index into | ||
214 | the waveform. presumably selecting the right one for the | ||
215 | desired temperature. it works out the offset of the first | ||
216 | v that exceeds the specified temperature */ | ||
217 | if ((sizeof(*wfm_hdr) + wfm_hdr->trc) > size) | ||
218 | return -EINVAL; | ||
219 | |||
220 | for (i = sizeof(*wfm_hdr); i <= sizeof(*wfm_hdr) + wfm_hdr->trc; i++) { | ||
221 | if (mem[i] > t) { | ||
222 | trn = i - sizeof(*wfm_hdr) - 1; | ||
223 | break; | ||
224 | } | ||
225 | } | ||
226 | |||
227 | /* check temperature range table checksum */ | ||
228 | cksum_idx = sizeof(*wfm_hdr) + wfm_hdr->trc + 1; | ||
229 | if (cksum_idx > size) | ||
230 | return -EINVAL; | ||
231 | cksum = calc_cksum(sizeof(*wfm_hdr), cksum_idx, mem); | ||
232 | if (cksum != mem[cksum_idx]) { | ||
233 | printk(KERN_ERR "Error: bad temperature range table cksum" | ||
234 | " %x != %x\n", cksum, mem[cksum_idx]); | ||
235 | return -EINVAL; | ||
236 | } | ||
237 | |||
238 | /* check waveform mode table address checksum */ | ||
239 | wmta = le32_to_cpu(get_unaligned((__le32 *) wfm_hdr->wmta)); | ||
240 | wmta &= 0x00FFFFFF; | ||
241 | cksum_idx = wmta + m*4 + 3; | ||
242 | if (cksum_idx > size) | ||
243 | return -EINVAL; | ||
244 | cksum = calc_cksum(cksum_idx - 3, cksum_idx, mem); | ||
245 | if (cksum != mem[cksum_idx]) { | ||
246 | printk(KERN_ERR "Error: bad mode table address cksum" | ||
247 | " %x != %x\n", cksum, mem[cksum_idx]); | ||
248 | return -EINVAL; | ||
249 | } | ||
250 | |||
251 | /* check waveform temperature table address checksum */ | ||
252 | tta = le32_to_cpu(get_unaligned((int *) (mem + wmta + m*4))); | ||
253 | tta &= 0x00FFFFFF; | ||
254 | cksum_idx = tta + trn*4 + 3; | ||
255 | if (cksum_idx > size) | ||
256 | return -EINVAL; | ||
257 | cksum = calc_cksum(cksum_idx - 3, cksum_idx, mem); | ||
258 | if (cksum != mem[cksum_idx]) { | ||
259 | printk(KERN_ERR "Error: bad temperature table address cksum" | ||
260 | " %x != %x\n", cksum, mem[cksum_idx]); | ||
261 | return -EINVAL; | ||
262 | } | ||
263 | |||
264 | /* here we do the real work of putting the waveform into the | ||
265 | metromem buffer. this does runlength decoding of the waveform */ | ||
266 | wfm_idx = le32_to_cpu(get_unaligned((__le32 *) (mem + tta + trn*4))); | ||
267 | wfm_idx &= 0x00FFFFFF; | ||
268 | owfm_idx = wfm_idx; | ||
269 | if (wfm_idx > size) | ||
270 | return -EINVAL; | ||
271 | while (wfm_idx < size) { | ||
272 | unsigned char rl; | ||
273 | v = mem[wfm_idx++]; | ||
274 | if (v == wfm_hdr->swtb) { | ||
275 | while (((v = mem[wfm_idx++]) != wfm_hdr->swtb) && | ||
276 | wfm_idx < size) | ||
277 | metromem[mem_idx++] = v; | ||
278 | |||
279 | continue; | ||
280 | } | ||
281 | |||
282 | if (v == wfm_hdr->endb) | ||
283 | break; | ||
284 | |||
285 | rl = mem[wfm_idx++]; | ||
286 | for (i = 0; i <= rl; i++) | ||
287 | metromem[mem_idx++] = v; | ||
288 | } | ||
289 | |||
290 | cksum_idx = wfm_idx; | ||
291 | if (cksum_idx > size) | ||
292 | return -EINVAL; | ||
293 | cksum = calc_cksum(owfm_idx, cksum_idx, mem); | ||
294 | if (cksum != mem[cksum_idx]) { | ||
295 | printk(KERN_ERR "Error: bad waveform data cksum" | ||
296 | " %x != %x\n", cksum, mem[cksum_idx]); | ||
297 | return -EINVAL; | ||
298 | } | ||
299 | *frame_count = (mem_idx/64); | ||
300 | |||
301 | return 0; | ||
302 | } | ||
303 | |||
304 | /* register offsets for gpio control */ | ||
305 | #define LED_GPIO_PIN 51 | ||
306 | #define STDBY_GPIO_PIN 48 | ||
307 | #define RST_GPIO_PIN 49 | ||
308 | #define RDY_GPIO_PIN 32 | ||
309 | #define ERR_GPIO_PIN 17 | ||
310 | #define PCBPWR_GPIO_PIN 16 | ||
311 | |||
312 | #define AF_SEL_GPIO_N 0x3 | ||
313 | #define GAFR0_U_OFFSET(pin) ((pin - 16) * 2) | ||
314 | #define GAFR1_L_OFFSET(pin) ((pin - 32) * 2) | ||
315 | #define GAFR1_U_OFFSET(pin) ((pin - 48) * 2) | ||
316 | #define GPDR1_OFFSET(pin) (pin - 32) | ||
317 | #define GPCR1_OFFSET(pin) (pin - 32) | ||
318 | #define GPSR1_OFFSET(pin) (pin - 32) | ||
319 | #define GPCR0_OFFSET(pin) (pin) | ||
320 | #define GPSR0_OFFSET(pin) (pin) | ||
321 | |||
322 | static void metronome_set_gpio_output(int pin, int val) | ||
323 | { | ||
324 | u8 index; | ||
325 | |||
326 | index = pin >> 4; | ||
327 | |||
328 | switch (index) { | ||
329 | case 1: | ||
330 | if (val) | ||
331 | GPSR0 |= (1 << GPSR0_OFFSET(pin)); | ||
332 | else | ||
333 | GPCR0 |= (1 << GPCR0_OFFSET(pin)); | ||
334 | break; | ||
335 | case 2: | ||
336 | break; | ||
337 | case 3: | ||
338 | if (val) | ||
339 | GPSR1 |= (1 << GPSR1_OFFSET(pin)); | ||
340 | else | ||
341 | GPCR1 |= (1 << GPCR1_OFFSET(pin)); | ||
342 | break; | ||
343 | default: | ||
344 | printk(KERN_ERR "unimplemented\n"); | ||
345 | } | ||
346 | } | ||
347 | |||
348 | static void __devinit metronome_init_gpio_pin(int pin, int dir) | ||
349 | { | ||
350 | u8 index; | ||
351 | /* dir 0 is output, 1 is input | ||
352 | - do 2 things here: | ||
353 | - set gpio alternate function to standard gpio | ||
354 | - set gpio direction to input or output */ | ||
355 | |||
356 | index = pin >> 4; | ||
357 | switch (index) { | ||
358 | case 1: | ||
359 | GAFR0_U &= ~(AF_SEL_GPIO_N << GAFR0_U_OFFSET(pin)); | ||
360 | |||
361 | if (dir) | ||
362 | GPDR0 &= ~(1 << pin); | ||
363 | else | ||
364 | GPDR0 |= (1 << pin); | ||
365 | break; | ||
366 | case 2: | ||
367 | GAFR1_L &= ~(AF_SEL_GPIO_N << GAFR1_L_OFFSET(pin)); | ||
368 | |||
369 | if (dir) | ||
370 | GPDR1 &= ~(1 << GPDR1_OFFSET(pin)); | ||
371 | else | ||
372 | GPDR1 |= (1 << GPDR1_OFFSET(pin)); | ||
373 | break; | ||
374 | case 3: | ||
375 | GAFR1_U &= ~(AF_SEL_GPIO_N << GAFR1_U_OFFSET(pin)); | ||
376 | |||
377 | if (dir) | ||
378 | GPDR1 &= ~(1 << GPDR1_OFFSET(pin)); | ||
379 | else | ||
380 | GPDR1 |= (1 << GPDR1_OFFSET(pin)); | ||
381 | break; | ||
382 | default: | ||
383 | printk(KERN_ERR "unimplemented\n"); | ||
384 | } | ||
385 | } | ||
386 | |||
387 | static void __devinit metronome_init_gpio_regs(void) | ||
388 | { | ||
389 | metronome_init_gpio_pin(LED_GPIO_PIN, 0); | ||
390 | metronome_set_gpio_output(LED_GPIO_PIN, 0); | ||
391 | |||
392 | metronome_init_gpio_pin(STDBY_GPIO_PIN, 0); | ||
393 | metronome_set_gpio_output(STDBY_GPIO_PIN, 0); | ||
394 | |||
395 | metronome_init_gpio_pin(RST_GPIO_PIN, 0); | ||
396 | metronome_set_gpio_output(RST_GPIO_PIN, 0); | ||
397 | |||
398 | metronome_init_gpio_pin(RDY_GPIO_PIN, 1); | ||
399 | |||
400 | metronome_init_gpio_pin(ERR_GPIO_PIN, 1); | ||
401 | |||
402 | metronome_init_gpio_pin(PCBPWR_GPIO_PIN, 0); | ||
403 | metronome_set_gpio_output(PCBPWR_GPIO_PIN, 0); | ||
404 | } | ||
405 | |||
406 | static void metronome_disable_lcd_controller(struct metronomefb_par *par) | ||
407 | { | ||
408 | LCSR = 0xffffffff; /* Clear LCD Status Register */ | ||
409 | LCCR0 |= LCCR0_DIS; /* Disable LCD Controller */ | ||
410 | |||
411 | /* we reset and just wait for things to settle */ | ||
412 | msleep(200); | ||
413 | } | ||
414 | |||
415 | static void metronome_enable_lcd_controller(struct metronomefb_par *par) | ||
416 | { | ||
417 | LCSR = 0xffffffff; | ||
418 | FDADR0 = par->metromem_desc_dma; | ||
419 | LCCR0 |= LCCR0_ENB; | ||
420 | } | ||
421 | |||
422 | static void __devinit metronome_init_lcdc_regs(struct metronomefb_par *par) | ||
423 | { | ||
424 | /* here we do: | ||
425 | - disable the lcd controller | ||
426 | - setup lcd control registers | ||
427 | - setup dma descriptor | ||
428 | - reenable lcd controller | ||
429 | */ | ||
430 | |||
431 | /* disable the lcd controller */ | ||
432 | metronome_disable_lcd_controller(par); | ||
433 | |||
434 | /* setup lcd control registers */ | ||
435 | LCCR0 = LCCR0_LDM | LCCR0_SFM | LCCR0_IUM | LCCR0_EFM | LCCR0_PAS | ||
436 | | LCCR0_QDM | LCCR0_BM | LCCR0_OUM; | ||
437 | |||
438 | LCCR1 = (epd_frame_table[0].fw/2 - 1) /* pixels per line */ | ||
439 | | (27 << 10) /* hsync pulse width - 1 */ | ||
440 | | (33 << 16) /* eol pixel count */ | ||
441 | | (33 << 24); /* bol pixel count */ | ||
442 | |||
443 | LCCR2 = (epd_frame_table[0].fh - 1) /* lines per panel */ | ||
444 | | (24 << 10) /* vsync pulse width - 1 */ | ||
445 | | (2 << 16) /* eof pixel count */ | ||
446 | | (0 << 24); /* bof pixel count */ | ||
447 | |||
448 | LCCR3 = 2 /* pixel clock divisor */ | ||
449 | | (24 << 8) /* AC Bias pin freq */ | ||
450 | | LCCR3_16BPP /* BPP */ | ||
451 | | LCCR3_PCP; /* PCP falling edge */ | ||
452 | |||
453 | /* setup dma descriptor */ | ||
454 | par->metromem_desc->mFDADR0 = par->metromem_desc_dma; | ||
455 | par->metromem_desc->mFSADR0 = par->metromem_dma; | ||
456 | par->metromem_desc->mFIDR0 = 0; | ||
457 | par->metromem_desc->mLDCMD0 = epd_frame_table[0].fw | ||
458 | * epd_frame_table[0].fh; | ||
459 | /* reenable lcd controller */ | ||
460 | metronome_enable_lcd_controller(par); | ||
461 | } | ||
462 | |||
463 | static int metronome_display_cmd(struct metronomefb_par *par) | ||
464 | { | ||
465 | int i; | ||
466 | u16 cs; | ||
467 | u16 opcode; | ||
468 | static u8 borderval; | ||
469 | u8 *ptr; | ||
470 | |||
471 | /* setup display command | ||
472 | we can't immediately set the opcode since the controller | ||
473 | will try parse the command before we've set it all up | ||
474 | so we just set cs here and set the opcode at the end */ | ||
475 | |||
476 | ptr = par->metromem; | ||
477 | |||
478 | if (par->metromem_cmd->opcode == 0xCC40) | ||
479 | opcode = cs = 0xCC41; | ||
480 | else | ||
481 | opcode = cs = 0xCC40; | ||
482 | |||
483 | /* set the args ( 2 bytes ) for display */ | ||
484 | i = 0; | ||
485 | par->metromem_cmd->args[i] = 1 << 3 /* border update */ | ||
486 | | ((borderval++ % 4) & 0x0F) << 4 | ||
487 | | (par->frame_count - 1) << 8; | ||
488 | cs += par->metromem_cmd->args[i++]; | ||
489 | |||
490 | /* the rest are 0 */ | ||
491 | memset((u8 *) (par->metromem_cmd->args + i), 0, (32-i)*2); | ||
492 | |||
493 | par->metromem_cmd->csum = cs; | ||
494 | par->metromem_cmd->opcode = opcode; /* display cmd */ | ||
495 | |||
496 | i = wait_event_interruptible_timeout(par->waitq, (GPLR1 & 0x01), HZ); | ||
497 | return i; | ||
498 | } | ||
499 | |||
500 | static int __devinit metronome_powerup_cmd(struct metronomefb_par *par) | ||
501 | { | ||
502 | int i; | ||
503 | u16 cs; | ||
504 | |||
505 | /* setup power up command */ | ||
506 | par->metromem_cmd->opcode = 0x1234; /* pwr up pseudo cmd */ | ||
507 | cs = par->metromem_cmd->opcode; | ||
508 | |||
509 | /* set pwr1,2,3 to 1024 */ | ||
510 | for (i = 0; i < 3; i++) { | ||
511 | par->metromem_cmd->args[i] = 1024; | ||
512 | cs += par->metromem_cmd->args[i]; | ||
513 | } | ||
514 | |||
515 | /* the rest are 0 */ | ||
516 | memset((u8 *) (par->metromem_cmd->args + i), 0, (32-i)*2); | ||
517 | |||
518 | par->metromem_cmd->csum = cs; | ||
519 | |||
520 | msleep(1); | ||
521 | metronome_set_gpio_output(RST_GPIO_PIN, 1); | ||
522 | |||
523 | msleep(1); | ||
524 | metronome_set_gpio_output(STDBY_GPIO_PIN, 1); | ||
525 | |||
526 | i = wait_event_timeout(par->waitq, (GPLR1 & 0x01), HZ); | ||
527 | return i; | ||
528 | } | ||
529 | |||
530 | static int __devinit metronome_config_cmd(struct metronomefb_par *par) | ||
531 | { | ||
532 | int i; | ||
533 | u16 cs; | ||
534 | |||
535 | /* setup config command | ||
536 | we can't immediately set the opcode since the controller | ||
537 | will try parse the command before we've set it all up | ||
538 | so we just set cs here and set the opcode at the end */ | ||
539 | |||
540 | cs = 0xCC10; | ||
541 | |||
542 | /* set the 12 args ( 8 bytes ) for config. see spec for meanings */ | ||
543 | i = 0; | ||
544 | par->metromem_cmd->args[i] = 15 /* sdlew */ | ||
545 | | 2 << 8 /* sdosz */ | ||
546 | | 0 << 11 /* sdor */ | ||
547 | | 0 << 12 /* sdces */ | ||
548 | | 0 << 15; /* sdcer */ | ||
549 | cs += par->metromem_cmd->args[i++]; | ||
550 | |||
551 | par->metromem_cmd->args[i] = 42 /* gdspl */ | ||
552 | | 1 << 8 /* gdr1 */ | ||
553 | | 1 << 9 /* sdshr */ | ||
554 | | 0 << 15; /* gdspp */ | ||
555 | cs += par->metromem_cmd->args[i++]; | ||
556 | |||
557 | par->metromem_cmd->args[i] = 18 /* gdspw */ | ||
558 | | 0 << 15; /* dispc */ | ||
559 | cs += par->metromem_cmd->args[i++]; | ||
560 | |||
561 | par->metromem_cmd->args[i] = 599 /* vdlc */ | ||
562 | | 0 << 11 /* dsi */ | ||
563 | | 0 << 12; /* dsic */ | ||
564 | cs += par->metromem_cmd->args[i++]; | ||
565 | |||
566 | /* the rest are 0 */ | ||
567 | memset((u8 *) (par->metromem_cmd->args + i), 0, (32-i)*2); | ||
568 | |||
569 | par->metromem_cmd->csum = cs; | ||
570 | par->metromem_cmd->opcode = 0xCC10; /* config cmd */ | ||
571 | |||
572 | i = wait_event_timeout(par->waitq, (GPLR1 & 0x01), HZ); | ||
573 | return i; | ||
574 | } | ||
575 | |||
576 | static int __devinit metronome_init_cmd(struct metronomefb_par *par) | ||
577 | { | ||
578 | int i; | ||
579 | u16 cs; | ||
580 | |||
581 | /* setup init command | ||
582 | we can't immediately set the opcode since the controller | ||
583 | will try parse the command before we've set it all up | ||
584 | so we just set cs here and set the opcode at the end */ | ||
585 | |||
586 | cs = 0xCC20; | ||
587 | |||
588 | /* set the args ( 2 bytes ) for init */ | ||
589 | i = 0; | ||
590 | par->metromem_cmd->args[i] = 0; | ||
591 | cs += par->metromem_cmd->args[i++]; | ||
592 | |||
593 | /* the rest are 0 */ | ||
594 | memset((u8 *) (par->metromem_cmd->args + i), 0, (32-i)*2); | ||
595 | |||
596 | par->metromem_cmd->csum = cs; | ||
597 | par->metromem_cmd->opcode = 0xCC20; /* init cmd */ | ||
598 | |||
599 | i = wait_event_timeout(par->waitq, (GPLR1 & 0x01), HZ); | ||
600 | return i; | ||
601 | } | ||
602 | |||
603 | static int __devinit metronome_init_regs(struct metronomefb_par *par) | ||
604 | { | ||
605 | int res; | ||
606 | |||
607 | metronome_init_gpio_regs(); | ||
608 | metronome_init_lcdc_regs(par); | ||
609 | |||
610 | res = metronome_powerup_cmd(par); | ||
611 | if (res) | ||
612 | return res; | ||
613 | |||
614 | res = metronome_config_cmd(par); | ||
615 | if (res) | ||
616 | return res; | ||
617 | |||
618 | res = metronome_init_cmd(par); | ||
619 | if (res) | ||
620 | return res; | ||
621 | |||
622 | return res; | ||
623 | } | ||
624 | |||
625 | static void metronomefb_dpy_update(struct metronomefb_par *par) | ||
626 | { | ||
627 | u16 cksum; | ||
628 | unsigned char *buf = (unsigned char __force *)par->info->screen_base; | ||
629 | |||
630 | /* copy from vm to metromem */ | ||
631 | memcpy(par->metromem_img, buf, DPY_W*DPY_H); | ||
632 | |||
633 | cksum = calc_img_cksum((u16 *) par->metromem_img, | ||
634 | (epd_frame_table[0].fw * DPY_H)/2); | ||
635 | *((u16 *) (par->metromem_img) + | ||
636 | (epd_frame_table[0].fw * DPY_H)/2) = cksum; | ||
637 | metronome_display_cmd(par); | ||
638 | } | ||
639 | |||
640 | static u16 metronomefb_dpy_update_page(struct metronomefb_par *par, int index) | ||
641 | { | ||
642 | int i; | ||
643 | u16 csum = 0; | ||
644 | u16 *buf = (u16 __force *) (par->info->screen_base + index); | ||
645 | u16 *img = (u16 *) (par->metromem_img + index); | ||
646 | |||
647 | /* swizzle from vm to metromem and recalc cksum at the same time*/ | ||
648 | for (i = 0; i < PAGE_SIZE/2; i++) { | ||
649 | *(img + i) = (buf[i] << 5) & 0xE0E0; | ||
650 | csum += *(img + i); | ||
651 | } | ||
652 | return csum; | ||
653 | } | ||
654 | |||
655 | /* this is called back from the deferred io workqueue */ | ||
656 | static void metronomefb_dpy_deferred_io(struct fb_info *info, | ||
657 | struct list_head *pagelist) | ||
658 | { | ||
659 | u16 cksum; | ||
660 | struct page *cur; | ||
661 | struct fb_deferred_io *fbdefio = info->fbdefio; | ||
662 | struct metronomefb_par *par = info->par; | ||
663 | |||
664 | /* walk the written page list and swizzle the data */ | ||
665 | list_for_each_entry(cur, &fbdefio->pagelist, lru) { | ||
666 | cksum = metronomefb_dpy_update_page(par, | ||
667 | (cur->index << PAGE_SHIFT)); | ||
668 | par->metromem_img_csum -= par->csum_table[cur->index]; | ||
669 | par->csum_table[cur->index] = cksum; | ||
670 | par->metromem_img_csum += cksum; | ||
671 | } | ||
672 | |||
673 | metronome_display_cmd(par); | ||
674 | } | ||
675 | |||
676 | static void metronomefb_fillrect(struct fb_info *info, | ||
677 | const struct fb_fillrect *rect) | ||
678 | { | ||
679 | struct metronomefb_par *par = info->par; | ||
680 | |||
681 | cfb_fillrect(info, rect); | ||
682 | metronomefb_dpy_update(par); | ||
683 | } | ||
684 | |||
685 | static void metronomefb_copyarea(struct fb_info *info, | ||
686 | const struct fb_copyarea *area) | ||
687 | { | ||
688 | struct metronomefb_par *par = info->par; | ||
689 | |||
690 | cfb_copyarea(info, area); | ||
691 | metronomefb_dpy_update(par); | ||
692 | } | ||
693 | |||
694 | static void metronomefb_imageblit(struct fb_info *info, | ||
695 | const struct fb_image *image) | ||
696 | { | ||
697 | struct metronomefb_par *par = info->par; | ||
698 | |||
699 | cfb_imageblit(info, image); | ||
700 | metronomefb_dpy_update(par); | ||
701 | } | ||
702 | |||
703 | /* | ||
704 | * this is the slow path from userspace. they can seek and write to | ||
705 | * the fb. it is based on fb_sys_write | ||
706 | */ | ||
707 | static ssize_t metronomefb_write(struct fb_info *info, const char __user *buf, | ||
708 | size_t count, loff_t *ppos) | ||
709 | { | ||
710 | struct metronomefb_par *par = info->par; | ||
711 | unsigned long p = *ppos; | ||
712 | void *dst; | ||
713 | int err = 0; | ||
714 | unsigned long total_size; | ||
715 | |||
716 | if (info->state != FBINFO_STATE_RUNNING) | ||
717 | return -EPERM; | ||
718 | |||
719 | total_size = info->fix.smem_len; | ||
720 | |||
721 | if (p > total_size) | ||
722 | return -EFBIG; | ||
723 | |||
724 | if (count > total_size) { | ||
725 | err = -EFBIG; | ||
726 | count = total_size; | ||
727 | } | ||
728 | |||
729 | if (count + p > total_size) { | ||
730 | if (!err) | ||
731 | err = -ENOSPC; | ||
732 | |||
733 | count = total_size - p; | ||
734 | } | ||
735 | |||
736 | dst = (void __force *) (info->screen_base + p); | ||
737 | |||
738 | if (copy_from_user(dst, buf, count)) | ||
739 | err = -EFAULT; | ||
740 | |||
741 | if (!err) | ||
742 | *ppos += count; | ||
743 | |||
744 | metronomefb_dpy_update(par); | ||
745 | |||
746 | return (err) ? err : count; | ||
747 | } | ||
748 | |||
749 | static struct fb_ops metronomefb_ops = { | ||
750 | .owner = THIS_MODULE, | ||
751 | .fb_write = metronomefb_write, | ||
752 | .fb_fillrect = metronomefb_fillrect, | ||
753 | .fb_copyarea = metronomefb_copyarea, | ||
754 | .fb_imageblit = metronomefb_imageblit, | ||
755 | }; | ||
756 | |||
757 | static struct fb_deferred_io metronomefb_defio = { | ||
758 | .delay = HZ, | ||
759 | .deferred_io = metronomefb_dpy_deferred_io, | ||
760 | }; | ||
761 | |||
762 | static irqreturn_t metronome_handle_irq(int irq, void *dev_id) | ||
763 | { | ||
764 | struct fb_info *info = dev_id; | ||
765 | struct metronomefb_par *par = info->par; | ||
766 | |||
767 | wake_up_interruptible(&par->waitq); | ||
768 | return IRQ_HANDLED; | ||
769 | } | ||
770 | |||
771 | static int __devinit metronomefb_probe(struct platform_device *dev) | ||
772 | { | ||
773 | struct fb_info *info; | ||
774 | int retval = -ENOMEM; | ||
775 | int videomemorysize; | ||
776 | unsigned char *videomemory; | ||
777 | struct metronomefb_par *par; | ||
778 | const struct firmware *fw_entry; | ||
779 | int cmd_size, wfm_size, img_size, padding_size, totalsize; | ||
780 | int i; | ||
781 | |||
782 | /* we have two blocks of memory. | ||
783 | info->screen_base which is vm, and is the fb used by apps. | ||
784 | par->metromem which is physically contiguous memory and | ||
785 | contains the display controller commands, waveform, | ||
786 | processed image data and padding. this is the data pulled | ||
787 | by the pxa255's LCD controller and pushed to Metronome */ | ||
788 | |||
789 | videomemorysize = (DPY_W*DPY_H); | ||
790 | videomemory = vmalloc(videomemorysize); | ||
791 | if (!videomemory) | ||
792 | return retval; | ||
793 | |||
794 | memset(videomemory, 0, videomemorysize); | ||
795 | |||
796 | info = framebuffer_alloc(sizeof(struct metronomefb_par), &dev->dev); | ||
797 | if (!info) | ||
798 | goto err_vfree; | ||
799 | |||
800 | info->screen_base = (char __iomem *) videomemory; | ||
801 | info->fbops = &metronomefb_ops; | ||
802 | |||
803 | info->var = metronomefb_var; | ||
804 | info->fix = metronomefb_fix; | ||
805 | info->fix.smem_len = videomemorysize; | ||
806 | par = info->par; | ||
807 | par->info = info; | ||
808 | init_waitqueue_head(&par->waitq); | ||
809 | |||
810 | /* this table caches per page csum values. */ | ||
811 | par->csum_table = vmalloc(videomemorysize/PAGE_SIZE); | ||
812 | if (!par->csum_table) | ||
813 | goto err_csum_table; | ||
814 | |||
815 | /* the metromem buffer is divided as follows: | ||
816 | command | CRC | padding | ||
817 | 16kb waveform data | CRC | padding | ||
818 | image data | CRC | ||
819 | and an extra 256 bytes for dma descriptors | ||
820 | eg: IW=832 IH=622 WS=128 | ||
821 | */ | ||
822 | |||
823 | cmd_size = 1 * epd_frame_table[0].fw; | ||
824 | wfm_size = ((16*1024 + 2 + epd_frame_table[0].fw - 1) | ||
825 | / epd_frame_table[0].fw) * epd_frame_table[0].fw; | ||
826 | img_size = epd_frame_table[0].fh * epd_frame_table[0].fw; | ||
827 | padding_size = 4 * epd_frame_table[0].fw; | ||
828 | totalsize = cmd_size + wfm_size + img_size + padding_size; | ||
829 | par->metromemsize = PAGE_ALIGN(totalsize + 256); | ||
830 | DPRINTK("desired memory size = %d\n", par->metromemsize); | ||
831 | dev->dev.coherent_dma_mask = 0xffffffffull; | ||
832 | par->metromem = dma_alloc_writecombine(&dev->dev, par->metromemsize, | ||
833 | &par->metromem_dma, GFP_KERNEL); | ||
834 | if (!par->metromem) { | ||
835 | printk(KERN_ERR | ||
836 | "metronomefb: unable to allocate dma buffer\n"); | ||
837 | goto err_vfree; | ||
838 | } | ||
839 | |||
840 | info->fix.smem_start = par->metromem_dma; | ||
841 | par->metromem_cmd = (struct metromem_cmd *) par->metromem; | ||
842 | par->metromem_wfm = par->metromem + cmd_size; | ||
843 | par->metromem_img = par->metromem + cmd_size + wfm_size; | ||
844 | par->metromem_img_csum = (u16 *) (par->metromem_img + | ||
845 | (epd_frame_table[0].fw * DPY_H)); | ||
846 | DPRINTK("img offset=0x%x\n", cmd_size + wfm_size); | ||
847 | par->metromem_desc = (struct metromem_desc *) (par->metromem + cmd_size | ||
848 | + wfm_size + img_size + padding_size); | ||
849 | par->metromem_desc_dma = par->metromem_dma + cmd_size + wfm_size | ||
850 | + img_size + padding_size; | ||
851 | |||
852 | /* load the waveform in. assume mode 3, temp 31 for now */ | ||
853 | /* a) request the waveform file from userspace | ||
854 | b) process waveform and decode into metromem */ | ||
855 | |||
856 | retval = request_firmware(&fw_entry, "waveform.wbf", &dev->dev); | ||
857 | if (retval < 0) { | ||
858 | printk(KERN_ERR "metronomefb: couldn't get waveform\n"); | ||
859 | goto err_dma_free; | ||
860 | } | ||
861 | |||
862 | retval = load_waveform((u8 *) fw_entry->data, fw_entry->size, | ||
863 | par->metromem_wfm, 3, 31, &par->frame_count); | ||
864 | if (retval < 0) { | ||
865 | printk(KERN_ERR "metronomefb: couldn't process waveform\n"); | ||
866 | goto err_ld_wfm; | ||
867 | } | ||
868 | release_firmware(fw_entry); | ||
869 | |||
870 | retval = request_irq(IRQ_GPIO(RDY_GPIO_PIN), metronome_handle_irq, | ||
871 | IRQF_DISABLED, "Metronome", info); | ||
872 | if (retval) { | ||
873 | dev_err(&dev->dev, "request_irq failed: %d\n", retval); | ||
874 | goto err_ld_wfm; | ||
875 | } | ||
876 | set_irq_type(IRQ_GPIO(RDY_GPIO_PIN), IRQT_FALLING); | ||
877 | |||
878 | retval = metronome_init_regs(par); | ||
879 | if (retval < 0) | ||
880 | goto err_free_irq; | ||
881 | |||
882 | info->flags = FBINFO_FLAG_DEFAULT; | ||
883 | |||
884 | info->fbdefio = &metronomefb_defio; | ||
885 | fb_deferred_io_init(info); | ||
886 | |||
887 | retval = fb_alloc_cmap(&info->cmap, 8, 0); | ||
888 | if (retval < 0) { | ||
889 | printk(KERN_ERR "Failed to allocate colormap\n"); | ||
890 | goto err_fb_rel; | ||
891 | } | ||
892 | |||
893 | /* set cmap */ | ||
894 | for (i = 0; i < 8; i++) | ||
895 | info->cmap.red[i] = (((2*i)+1)*(0xFFFF))/16; | ||
896 | memcpy(info->cmap.green, info->cmap.red, sizeof(u16)*8); | ||
897 | memcpy(info->cmap.blue, info->cmap.red, sizeof(u16)*8); | ||
898 | |||
899 | retval = register_framebuffer(info); | ||
900 | if (retval < 0) | ||
901 | goto err_cmap; | ||
902 | |||
903 | platform_set_drvdata(dev, info); | ||
904 | |||
905 | printk(KERN_INFO | ||
906 | "fb%d: Metronome frame buffer device, using %dK of video" | ||
907 | " memory\n", info->node, videomemorysize >> 10); | ||
908 | |||
909 | return 0; | ||
910 | |||
911 | err_cmap: | ||
912 | fb_dealloc_cmap(&info->cmap); | ||
913 | err_fb_rel: | ||
914 | framebuffer_release(info); | ||
915 | err_free_irq: | ||
916 | free_irq(IRQ_GPIO(RDY_GPIO_PIN), info); | ||
917 | err_ld_wfm: | ||
918 | release_firmware(fw_entry); | ||
919 | err_dma_free: | ||
920 | dma_free_writecombine(&dev->dev, par->metromemsize, par->metromem, | ||
921 | par->metromem_dma); | ||
922 | err_csum_table: | ||
923 | vfree(par->csum_table); | ||
924 | err_vfree: | ||
925 | vfree(videomemory); | ||
926 | return retval; | ||
927 | } | ||
928 | |||
929 | static int __devexit metronomefb_remove(struct platform_device *dev) | ||
930 | { | ||
931 | struct fb_info *info = platform_get_drvdata(dev); | ||
932 | |||
933 | if (info) { | ||
934 | struct metronomefb_par *par = info->par; | ||
935 | fb_deferred_io_cleanup(info); | ||
936 | dma_free_writecombine(&dev->dev, par->metromemsize, | ||
937 | par->metromem, par->metromem_dma); | ||
938 | fb_dealloc_cmap(&info->cmap); | ||
939 | vfree(par->csum_table); | ||
940 | unregister_framebuffer(info); | ||
941 | vfree((void __force *)info->screen_base); | ||
942 | free_irq(IRQ_GPIO(RDY_GPIO_PIN), info); | ||
943 | framebuffer_release(info); | ||
944 | } | ||
945 | return 0; | ||
946 | } | ||
947 | |||
948 | static struct platform_driver metronomefb_driver = { | ||
949 | .probe = metronomefb_probe, | ||
950 | .remove = metronomefb_remove, | ||
951 | .driver = { | ||
952 | .name = "metronomefb", | ||
953 | }, | ||
954 | }; | ||
955 | |||
956 | static struct platform_device *metronomefb_device; | ||
957 | |||
958 | static int __init metronomefb_init(void) | ||
959 | { | ||
960 | int ret; | ||
961 | |||
962 | if (!metronomefb_enable) { | ||
963 | printk(KERN_ERR | ||
964 | "Use metronomefb_enable to enable the device\n"); | ||
965 | return -ENXIO; | ||
966 | } | ||
967 | |||
968 | ret = platform_driver_register(&metronomefb_driver); | ||
969 | if (!ret) { | ||
970 | metronomefb_device = platform_device_alloc("metronomefb", 0); | ||
971 | if (metronomefb_device) | ||
972 | ret = platform_device_add(metronomefb_device); | ||
973 | else | ||
974 | ret = -ENOMEM; | ||
975 | |||
976 | if (ret) { | ||
977 | platform_device_put(metronomefb_device); | ||
978 | platform_driver_unregister(&metronomefb_driver); | ||
979 | } | ||
980 | } | ||
981 | return ret; | ||
982 | |||
983 | } | ||
984 | |||
985 | static void __exit metronomefb_exit(void) | ||
986 | { | ||
987 | platform_device_unregister(metronomefb_device); | ||
988 | platform_driver_unregister(&metronomefb_driver); | ||
989 | } | ||
990 | |||
991 | module_param(metronomefb_enable, uint, 0); | ||
992 | MODULE_PARM_DESC(metronomefb_enable, "Enable communication with Metronome"); | ||
993 | |||
994 | module_init(metronomefb_init); | ||
995 | module_exit(metronomefb_exit); | ||
996 | |||
997 | MODULE_DESCRIPTION("fbdev driver for Metronome controller"); | ||
998 | MODULE_AUTHOR("Jaya Kumar"); | ||
999 | MODULE_LICENSE("GPL"); | ||
diff --git a/drivers/virtio/virtio_balloon.c b/drivers/virtio/virtio_balloon.c index c8a4332d1132..0b3efc31ee6d 100644 --- a/drivers/virtio/virtio_balloon.c +++ b/drivers/virtio/virtio_balloon.c | |||
@@ -152,7 +152,7 @@ static void virtballoon_changed(struct virtio_device *vdev) | |||
152 | wake_up(&vb->config_change); | 152 | wake_up(&vb->config_change); |
153 | } | 153 | } |
154 | 154 | ||
155 | static inline int towards_target(struct virtio_balloon *vb) | 155 | static inline s64 towards_target(struct virtio_balloon *vb) |
156 | { | 156 | { |
157 | u32 v; | 157 | u32 v; |
158 | __virtio_config_val(vb->vdev, | 158 | __virtio_config_val(vb->vdev, |
@@ -176,7 +176,7 @@ static int balloon(void *_vballoon) | |||
176 | 176 | ||
177 | set_freezable(); | 177 | set_freezable(); |
178 | while (!kthread_should_stop()) { | 178 | while (!kthread_should_stop()) { |
179 | int diff; | 179 | s64 diff; |
180 | 180 | ||
181 | try_to_freeze(); | 181 | try_to_freeze(); |
182 | wait_event_interruptible(vb->config_change, | 182 | wait_event_interruptible(vb->config_change, |
diff --git a/drivers/virtio/virtio_pci.c b/drivers/virtio/virtio_pci.c index 26f787ddd5ff..59a8f73dec73 100644 --- a/drivers/virtio/virtio_pci.c +++ b/drivers/virtio/virtio_pci.c | |||
@@ -177,6 +177,7 @@ static irqreturn_t vp_interrupt(int irq, void *opaque) | |||
177 | struct virtio_pci_device *vp_dev = opaque; | 177 | struct virtio_pci_device *vp_dev = opaque; |
178 | struct virtio_pci_vq_info *info; | 178 | struct virtio_pci_vq_info *info; |
179 | irqreturn_t ret = IRQ_NONE; | 179 | irqreturn_t ret = IRQ_NONE; |
180 | unsigned long flags; | ||
180 | u8 isr; | 181 | u8 isr; |
181 | 182 | ||
182 | /* reading the ISR has the effect of also clearing it so it's very | 183 | /* reading the ISR has the effect of also clearing it so it's very |
@@ -197,12 +198,12 @@ static irqreturn_t vp_interrupt(int irq, void *opaque) | |||
197 | drv->config_changed(&vp_dev->vdev); | 198 | drv->config_changed(&vp_dev->vdev); |
198 | } | 199 | } |
199 | 200 | ||
200 | spin_lock(&vp_dev->lock); | 201 | spin_lock_irqsave(&vp_dev->lock, flags); |
201 | list_for_each_entry(info, &vp_dev->virtqueues, node) { | 202 | list_for_each_entry(info, &vp_dev->virtqueues, node) { |
202 | if (vring_interrupt(irq, info->vq) == IRQ_HANDLED) | 203 | if (vring_interrupt(irq, info->vq) == IRQ_HANDLED) |
203 | ret = IRQ_HANDLED; | 204 | ret = IRQ_HANDLED; |
204 | } | 205 | } |
205 | spin_unlock(&vp_dev->lock); | 206 | spin_unlock_irqrestore(&vp_dev->lock, flags); |
206 | 207 | ||
207 | return ret; | 208 | return ret; |
208 | } | 209 | } |
@@ -214,6 +215,7 @@ static struct virtqueue *vp_find_vq(struct virtio_device *vdev, unsigned index, | |||
214 | struct virtio_pci_device *vp_dev = to_vp_device(vdev); | 215 | struct virtio_pci_device *vp_dev = to_vp_device(vdev); |
215 | struct virtio_pci_vq_info *info; | 216 | struct virtio_pci_vq_info *info; |
216 | struct virtqueue *vq; | 217 | struct virtqueue *vq; |
218 | unsigned long flags; | ||
217 | u16 num; | 219 | u16 num; |
218 | int err; | 220 | int err; |
219 | 221 | ||
@@ -255,9 +257,9 @@ static struct virtqueue *vp_find_vq(struct virtio_device *vdev, unsigned index, | |||
255 | vq->priv = info; | 257 | vq->priv = info; |
256 | info->vq = vq; | 258 | info->vq = vq; |
257 | 259 | ||
258 | spin_lock(&vp_dev->lock); | 260 | spin_lock_irqsave(&vp_dev->lock, flags); |
259 | list_add(&info->node, &vp_dev->virtqueues); | 261 | list_add(&info->node, &vp_dev->virtqueues); |
260 | spin_unlock(&vp_dev->lock); | 262 | spin_unlock_irqrestore(&vp_dev->lock, flags); |
261 | 263 | ||
262 | return vq; | 264 | return vq; |
263 | 265 | ||
@@ -274,10 +276,11 @@ static void vp_del_vq(struct virtqueue *vq) | |||
274 | { | 276 | { |
275 | struct virtio_pci_device *vp_dev = to_vp_device(vq->vdev); | 277 | struct virtio_pci_device *vp_dev = to_vp_device(vq->vdev); |
276 | struct virtio_pci_vq_info *info = vq->priv; | 278 | struct virtio_pci_vq_info *info = vq->priv; |
279 | unsigned long flags; | ||
277 | 280 | ||
278 | spin_lock(&vp_dev->lock); | 281 | spin_lock_irqsave(&vp_dev->lock, flags); |
279 | list_del(&info->node); | 282 | list_del(&info->node); |
280 | spin_unlock(&vp_dev->lock); | 283 | spin_unlock_irqrestore(&vp_dev->lock, flags); |
281 | 284 | ||
282 | vring_del_virtqueue(vq); | 285 | vring_del_virtqueue(vq); |
283 | 286 | ||
diff --git a/drivers/virtio/virtio_ring.c b/drivers/virtio/virtio_ring.c index 3a28c1382131..aa714028641e 100644 --- a/drivers/virtio/virtio_ring.c +++ b/drivers/virtio/virtio_ring.c | |||
@@ -232,7 +232,6 @@ static bool vring_enable_cb(struct virtqueue *_vq) | |||
232 | vq->vring.avail->flags &= ~VRING_AVAIL_F_NO_INTERRUPT; | 232 | vq->vring.avail->flags &= ~VRING_AVAIL_F_NO_INTERRUPT; |
233 | mb(); | 233 | mb(); |
234 | if (unlikely(more_used(vq))) { | 234 | if (unlikely(more_used(vq))) { |
235 | vq->vring.avail->flags |= VRING_AVAIL_F_NO_INTERRUPT; | ||
236 | END_USE(vq); | 235 | END_USE(vq); |
237 | return false; | 236 | return false; |
238 | } | 237 | } |