diff options
Diffstat (limited to 'drivers')
181 files changed, 3971 insertions, 2531 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 ba8f7f4dfa11..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. |
@@ -538,6 +539,15 @@ config PATA_RADISYS | |||
538 | 539 | ||
539 | If unsure, say N. | 540 | If unsure, say N. |
540 | 541 | ||
542 | config PATA_RB500 | ||
543 | tristate "RouterBoard 500 PATA CompactFlash support" | ||
544 | depends on MIKROTIK_RB500 | ||
545 | help | ||
546 | This option enables support for the RouterBoard 500 | ||
547 | PATA CompactFlash controller. | ||
548 | |||
549 | If unsure, say N. | ||
550 | |||
541 | config PATA_RZ1000 | 551 | config PATA_RZ1000 |
542 | tristate "PC Tech RZ1000 PATA support" | 552 | tristate "PC Tech RZ1000 PATA support" |
543 | depends on PCI | 553 | depends on PCI |
diff --git a/drivers/ata/Makefile b/drivers/ata/Makefile index 701651e37c89..0511e6f0bb58 100644 --- a/drivers/ata/Makefile +++ b/drivers/ata/Makefile | |||
@@ -55,6 +55,7 @@ obj-$(CONFIG_PATA_PDC2027X) += pata_pdc2027x.o | |||
55 | obj-$(CONFIG_PATA_PDC_OLD) += pata_pdc202xx_old.o | 55 | obj-$(CONFIG_PATA_PDC_OLD) += pata_pdc202xx_old.o |
56 | obj-$(CONFIG_PATA_QDI) += pata_qdi.o | 56 | obj-$(CONFIG_PATA_QDI) += pata_qdi.o |
57 | obj-$(CONFIG_PATA_RADISYS) += pata_radisys.o | 57 | obj-$(CONFIG_PATA_RADISYS) += pata_radisys.o |
58 | obj-$(CONFIG_PATA_RB500) += pata_rb500_cf.o | ||
58 | obj-$(CONFIG_PATA_RZ1000) += pata_rz1000.o | 59 | obj-$(CONFIG_PATA_RZ1000) += pata_rz1000.o |
59 | obj-$(CONFIG_PATA_SC1200) += pata_sc1200.o | 60 | obj-$(CONFIG_PATA_SC1200) += pata_sc1200.o |
60 | obj-$(CONFIG_PATA_SERVERWORKS) += pata_serverworks.o | 61 | obj-$(CONFIG_PATA_SERVERWORKS) += pata_serverworks.o |
diff --git a/drivers/ata/ahci.c b/drivers/ata/ahci.c index 8a49835bd0f8..17ee6ed985d9 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); |
@@ -567,6 +571,18 @@ static const struct pci_device_id ahci_pci_tbl[] = { | |||
567 | { PCI_VDEVICE(NVIDIA, 0x0abd), board_ahci }, /* MCP79 */ | 571 | { PCI_VDEVICE(NVIDIA, 0x0abd), board_ahci }, /* MCP79 */ |
568 | { PCI_VDEVICE(NVIDIA, 0x0abe), board_ahci }, /* MCP79 */ | 572 | { PCI_VDEVICE(NVIDIA, 0x0abe), board_ahci }, /* MCP79 */ |
569 | { PCI_VDEVICE(NVIDIA, 0x0abf), board_ahci }, /* MCP79 */ | 573 | { PCI_VDEVICE(NVIDIA, 0x0abf), board_ahci }, /* MCP79 */ |
574 | { PCI_VDEVICE(NVIDIA, 0x0bc8), board_ahci }, /* MCP7B */ | ||
575 | { PCI_VDEVICE(NVIDIA, 0x0bc9), board_ahci }, /* MCP7B */ | ||
576 | { PCI_VDEVICE(NVIDIA, 0x0bca), board_ahci }, /* MCP7B */ | ||
577 | { PCI_VDEVICE(NVIDIA, 0x0bcb), board_ahci }, /* MCP7B */ | ||
578 | { PCI_VDEVICE(NVIDIA, 0x0bcc), board_ahci }, /* MCP7B */ | ||
579 | { PCI_VDEVICE(NVIDIA, 0x0bcd), board_ahci }, /* MCP7B */ | ||
580 | { PCI_VDEVICE(NVIDIA, 0x0bce), board_ahci }, /* MCP7B */ | ||
581 | { PCI_VDEVICE(NVIDIA, 0x0bcf), board_ahci }, /* MCP7B */ | ||
582 | { PCI_VDEVICE(NVIDIA, 0x0bd0), board_ahci }, /* MCP7B */ | ||
583 | { PCI_VDEVICE(NVIDIA, 0x0bd1), board_ahci }, /* MCP7B */ | ||
584 | { PCI_VDEVICE(NVIDIA, 0x0bd2), board_ahci }, /* MCP7B */ | ||
585 | { PCI_VDEVICE(NVIDIA, 0x0bd3), board_ahci }, /* MCP7B */ | ||
570 | 586 | ||
571 | /* SiS */ | 587 | /* SiS */ |
572 | { PCI_VDEVICE(SI, 0x1184), board_ahci }, /* SiS 966 */ | 588 | { PCI_VDEVICE(SI, 0x1184), board_ahci }, /* SiS 966 */ |
@@ -575,6 +591,7 @@ static const struct pci_device_id ahci_pci_tbl[] = { | |||
575 | 591 | ||
576 | /* Marvell */ | 592 | /* Marvell */ |
577 | { PCI_VDEVICE(MARVELL, 0x6145), board_ahci_mv }, /* 6145 */ | 593 | { PCI_VDEVICE(MARVELL, 0x6145), board_ahci_mv }, /* 6145 */ |
594 | { PCI_VDEVICE(MARVELL, 0x6121), board_ahci_mv }, /* 6121 */ | ||
578 | 595 | ||
579 | /* Generic, PCI class code for AHCI */ | 596 | /* Generic, PCI class code for AHCI */ |
580 | { PCI_ANY_ID, PCI_ANY_ID, PCI_ANY_ID, PCI_ANY_ID, | 597 | { PCI_ANY_ID, PCI_ANY_ID, PCI_ANY_ID, PCI_ANY_ID, |
@@ -649,6 +666,7 @@ static void ahci_save_initial_config(struct pci_dev *pdev, | |||
649 | void __iomem *mmio = pcim_iomap_table(pdev)[AHCI_PCI_BAR]; | 666 | void __iomem *mmio = pcim_iomap_table(pdev)[AHCI_PCI_BAR]; |
650 | u32 cap, port_map; | 667 | u32 cap, port_map; |
651 | int i; | 668 | int i; |
669 | int mv; | ||
652 | 670 | ||
653 | /* make sure AHCI mode is enabled before accessing CAP */ | 671 | /* make sure AHCI mode is enabled before accessing CAP */ |
654 | ahci_enable_ahci(mmio); | 672 | ahci_enable_ahci(mmio); |
@@ -672,7 +690,7 @@ static void ahci_save_initial_config(struct pci_dev *pdev, | |||
672 | cap &= ~HOST_CAP_NCQ; | 690 | cap &= ~HOST_CAP_NCQ; |
673 | } | 691 | } |
674 | 692 | ||
675 | if ((cap && HOST_CAP_PMP) && (hpriv->flags & AHCI_HFLAG_NO_PMP)) { | 693 | if ((cap & HOST_CAP_PMP) && (hpriv->flags & AHCI_HFLAG_NO_PMP)) { |
676 | dev_printk(KERN_INFO, &pdev->dev, | 694 | dev_printk(KERN_INFO, &pdev->dev, |
677 | "controller can't do PMP, turning off CAP_PMP\n"); | 695 | "controller can't do PMP, turning off CAP_PMP\n"); |
678 | cap &= ~HOST_CAP_PMP; | 696 | cap &= ~HOST_CAP_PMP; |
@@ -684,12 +702,16 @@ static void ahci_save_initial_config(struct pci_dev *pdev, | |||
684 | * presence register, as bit 4 (counting from 0) | 702 | * presence register, as bit 4 (counting from 0) |
685 | */ | 703 | */ |
686 | if (hpriv->flags & AHCI_HFLAG_MV_PATA) { | 704 | if (hpriv->flags & AHCI_HFLAG_MV_PATA) { |
705 | if (pdev->device == 0x6121) | ||
706 | mv = 0x3; | ||
707 | else | ||
708 | mv = 0xf; | ||
687 | dev_printk(KERN_ERR, &pdev->dev, | 709 | dev_printk(KERN_ERR, &pdev->dev, |
688 | "MV_AHCI HACK: port_map %x -> %x\n", | 710 | "MV_AHCI HACK: port_map %x -> %x\n", |
689 | hpriv->port_map, | 711 | port_map, |
690 | hpriv->port_map & 0xf); | 712 | port_map & mv); |
691 | 713 | ||
692 | port_map &= 0xf; | 714 | port_map &= mv; |
693 | } | 715 | } |
694 | 716 | ||
695 | /* cross check port_map and cap.n_ports */ | 717 | /* cross check port_map and cap.n_ports */ |
@@ -1076,29 +1098,35 @@ static int ahci_reset_controller(struct ata_host *host) | |||
1076 | ahci_enable_ahci(mmio); | 1098 | ahci_enable_ahci(mmio); |
1077 | 1099 | ||
1078 | /* global controller reset */ | 1100 | /* global controller reset */ |
1079 | tmp = readl(mmio + HOST_CTL); | 1101 | if (!ahci_skip_host_reset) { |
1080 | if ((tmp & HOST_RESET) == 0) { | 1102 | tmp = readl(mmio + HOST_CTL); |
1081 | writel(tmp | HOST_RESET, mmio + HOST_CTL); | 1103 | if ((tmp & HOST_RESET) == 0) { |
1082 | readl(mmio + HOST_CTL); /* flush */ | 1104 | writel(tmp | HOST_RESET, mmio + HOST_CTL); |
1083 | } | 1105 | readl(mmio + HOST_CTL); /* flush */ |
1106 | } | ||
1084 | 1107 | ||
1085 | /* reset must complete within 1 second, or | 1108 | /* reset must complete within 1 second, or |
1086 | * the hardware should be considered fried. | 1109 | * the hardware should be considered fried. |
1087 | */ | 1110 | */ |
1088 | ssleep(1); | 1111 | ssleep(1); |
1089 | 1112 | ||
1090 | tmp = readl(mmio + HOST_CTL); | 1113 | tmp = readl(mmio + HOST_CTL); |
1091 | if (tmp & HOST_RESET) { | 1114 | if (tmp & HOST_RESET) { |
1092 | dev_printk(KERN_ERR, host->dev, | 1115 | dev_printk(KERN_ERR, host->dev, |
1093 | "controller reset failed (0x%x)\n", tmp); | 1116 | "controller reset failed (0x%x)\n", tmp); |
1094 | return -EIO; | 1117 | return -EIO; |
1095 | } | 1118 | } |
1096 | 1119 | ||
1097 | /* turn on AHCI mode */ | 1120 | /* turn on AHCI mode */ |
1098 | ahci_enable_ahci(mmio); | 1121 | ahci_enable_ahci(mmio); |
1099 | 1122 | ||
1100 | /* some registers might be cleared on reset. restore initial values */ | 1123 | /* Some registers might be cleared on reset. Restore |
1101 | ahci_restore_initial_config(host); | 1124 | * initial values. |
1125 | */ | ||
1126 | ahci_restore_initial_config(host); | ||
1127 | } else | ||
1128 | dev_printk(KERN_INFO, host->dev, | ||
1129 | "skipping global host reset\n"); | ||
1102 | 1130 | ||
1103 | if (pdev->vendor == PCI_VENDOR_ID_INTEL) { | 1131 | if (pdev->vendor == PCI_VENDOR_ID_INTEL) { |
1104 | u16 tmp16; | 1132 | u16 tmp16; |
@@ -1150,9 +1178,14 @@ static void ahci_init_controller(struct ata_host *host) | |||
1150 | int i; | 1178 | int i; |
1151 | void __iomem *port_mmio; | 1179 | void __iomem *port_mmio; |
1152 | u32 tmp; | 1180 | u32 tmp; |
1181 | int mv; | ||
1153 | 1182 | ||
1154 | if (hpriv->flags & AHCI_HFLAG_MV_PATA) { | 1183 | if (hpriv->flags & AHCI_HFLAG_MV_PATA) { |
1155 | port_mmio = __ahci_port_base(host, 4); | 1184 | if (pdev->device == 0x6121) |
1185 | mv = 2; | ||
1186 | else | ||
1187 | mv = 4; | ||
1188 | port_mmio = __ahci_port_base(host, mv); | ||
1156 | 1189 | ||
1157 | writel(0, port_mmio + PORT_IRQ_MASK); | 1190 | writel(0, port_mmio + PORT_IRQ_MASK); |
1158 | 1191 | ||
@@ -2229,7 +2262,10 @@ static int ahci_init_one(struct pci_dev *pdev, const struct pci_device_id *ent) | |||
2229 | if (rc) | 2262 | if (rc) |
2230 | return rc; | 2263 | return rc; |
2231 | 2264 | ||
2232 | rc = pcim_iomap_regions(pdev, 1 << AHCI_PCI_BAR, DRV_NAME); | 2265 | /* AHCI controllers often implement SFF compatible interface. |
2266 | * Grab all PCI BARs just in case. | ||
2267 | */ | ||
2268 | rc = pcim_iomap_regions_request_all(pdev, 1 << AHCI_PCI_BAR, DRV_NAME); | ||
2233 | if (rc == -EBUSY) | 2269 | if (rc == -EBUSY) |
2234 | pcim_pin_device(pdev); | 2270 | pcim_pin_device(pdev); |
2235 | if (rc) | 2271 | if (rc) |
diff --git a/drivers/ata/libata-acpi.c b/drivers/ata/libata-acpi.c index 9e8ec19260af..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 | } |
@@ -382,7 +424,7 @@ static int ata_dev_get_GTF(struct ata_device *dev, struct ata_acpi_gtf **gtf) | |||
382 | 424 | ||
383 | if (ata_msg_probe(ap)) | 425 | if (ata_msg_probe(ap)) |
384 | ata_dev_printk(dev, KERN_DEBUG, "%s: ENTER: port#: %d\n", | 426 | ata_dev_printk(dev, KERN_DEBUG, "%s: ENTER: port#: %d\n", |
385 | __FUNCTION__, ap->port_no); | 427 | __func__, ap->port_no); |
386 | 428 | ||
387 | /* _GTF has no input parameters */ | 429 | /* _GTF has no input parameters */ |
388 | status = acpi_evaluate_object(dev->acpi_handle, "_GTF", NULL, &output); | 430 | status = acpi_evaluate_object(dev->acpi_handle, "_GTF", NULL, &output); |
@@ -402,7 +444,7 @@ static int ata_dev_get_GTF(struct ata_device *dev, struct ata_acpi_gtf **gtf) | |||
402 | if (ata_msg_probe(ap)) | 444 | if (ata_msg_probe(ap)) |
403 | ata_dev_printk(dev, KERN_DEBUG, "%s: Run _GTF: " | 445 | ata_dev_printk(dev, KERN_DEBUG, "%s: Run _GTF: " |
404 | "length or ptr is NULL (0x%llx, 0x%p)\n", | 446 | "length or ptr is NULL (0x%llx, 0x%p)\n", |
405 | __FUNCTION__, | 447 | __func__, |
406 | (unsigned long long)output.length, | 448 | (unsigned long long)output.length, |
407 | output.pointer); | 449 | output.pointer); |
408 | rc = -EINVAL; | 450 | rc = -EINVAL; |
@@ -432,7 +474,7 @@ static int ata_dev_get_GTF(struct ata_device *dev, struct ata_acpi_gtf **gtf) | |||
432 | if (ata_msg_probe(ap)) | 474 | if (ata_msg_probe(ap)) |
433 | ata_dev_printk(dev, KERN_DEBUG, | 475 | ata_dev_printk(dev, KERN_DEBUG, |
434 | "%s: returning gtf=%p, gtf_count=%d\n", | 476 | "%s: returning gtf=%p, gtf_count=%d\n", |
435 | __FUNCTION__, *gtf, rc); | 477 | __func__, *gtf, rc); |
436 | } | 478 | } |
437 | return rc; | 479 | return rc; |
438 | 480 | ||
@@ -725,7 +767,7 @@ static int ata_acpi_push_id(struct ata_device *dev) | |||
725 | 767 | ||
726 | if (ata_msg_probe(ap)) | 768 | if (ata_msg_probe(ap)) |
727 | ata_dev_printk(dev, KERN_DEBUG, "%s: ix = %d, port#: %d\n", | 769 | ata_dev_printk(dev, KERN_DEBUG, "%s: ix = %d, port#: %d\n", |
728 | __FUNCTION__, dev->devno, ap->port_no); | 770 | __func__, dev->devno, ap->port_no); |
729 | 771 | ||
730 | /* Give the drive Identify data to the drive via the _SDD method */ | 772 | /* Give the drive Identify data to the drive via the _SDD method */ |
731 | /* _SDD: set up input parameters */ | 773 | /* _SDD: set up input parameters */ |
diff --git a/drivers/ata/libata-core.c b/drivers/ata/libata-core.c index 4fbcce758b04..4bbe31f98ef8 100644 --- a/drivers/ata/libata-core.c +++ b/drivers/ata/libata-core.c | |||
@@ -106,7 +106,8 @@ static struct ata_force_ent *ata_force_tbl; | |||
106 | static int ata_force_tbl_size; | 106 | static int ata_force_tbl_size; |
107 | 107 | ||
108 | static char ata_force_param_buf[PAGE_SIZE] __initdata; | 108 | static char ata_force_param_buf[PAGE_SIZE] __initdata; |
109 | module_param_string(force, ata_force_param_buf, sizeof(ata_force_param_buf), 0444); | 109 | /* param_buf is thrown away after initialization, disallow read */ |
110 | module_param_string(force, ata_force_param_buf, sizeof(ata_force_param_buf), 0); | ||
110 | MODULE_PARM_DESC(force, "Force ATA configurations including cable type, link speed and transfer mode (see Documentation/kernel-parameters.txt for details)"); | 111 | MODULE_PARM_DESC(force, "Force ATA configurations including cable type, link speed and transfer mode (see Documentation/kernel-parameters.txt for details)"); |
111 | 112 | ||
112 | int atapi_enabled = 1; | 113 | int atapi_enabled = 1; |
@@ -1719,7 +1720,7 @@ void ata_port_flush_task(struct ata_port *ap) | |||
1719 | cancel_rearming_delayed_work(&ap->port_task); | 1720 | cancel_rearming_delayed_work(&ap->port_task); |
1720 | 1721 | ||
1721 | if (ata_msg_ctl(ap)) | 1722 | if (ata_msg_ctl(ap)) |
1722 | ata_port_printk(ap, KERN_DEBUG, "%s: EXIT\n", __FUNCTION__); | 1723 | ata_port_printk(ap, KERN_DEBUG, "%s: EXIT\n", __func__); |
1723 | } | 1724 | } |
1724 | 1725 | ||
1725 | static void ata_qc_complete_internal(struct ata_queued_cmd *qc) | 1726 | static void ata_qc_complete_internal(struct ata_queued_cmd *qc) |
@@ -2056,7 +2057,7 @@ int ata_dev_read_id(struct ata_device *dev, unsigned int *p_class, | |||
2056 | int rc; | 2057 | int rc; |
2057 | 2058 | ||
2058 | if (ata_msg_ctl(ap)) | 2059 | if (ata_msg_ctl(ap)) |
2059 | ata_dev_printk(dev, KERN_DEBUG, "%s: ENTER\n", __FUNCTION__); | 2060 | ata_dev_printk(dev, KERN_DEBUG, "%s: ENTER\n", __func__); |
2060 | 2061 | ||
2061 | ata_dev_select(ap, dev->devno, 1, 1); /* select device 0/1 */ | 2062 | ata_dev_select(ap, dev->devno, 1, 1); /* select device 0/1 */ |
2062 | retry: | 2063 | retry: |
@@ -2253,12 +2254,12 @@ int ata_dev_configure(struct ata_device *dev) | |||
2253 | 2254 | ||
2254 | if (!ata_dev_enabled(dev) && ata_msg_info(ap)) { | 2255 | if (!ata_dev_enabled(dev) && ata_msg_info(ap)) { |
2255 | ata_dev_printk(dev, KERN_INFO, "%s: ENTER/EXIT -- nodev\n", | 2256 | ata_dev_printk(dev, KERN_INFO, "%s: ENTER/EXIT -- nodev\n", |
2256 | __FUNCTION__); | 2257 | __func__); |
2257 | return 0; | 2258 | return 0; |
2258 | } | 2259 | } |
2259 | 2260 | ||
2260 | if (ata_msg_probe(ap)) | 2261 | if (ata_msg_probe(ap)) |
2261 | ata_dev_printk(dev, KERN_DEBUG, "%s: ENTER\n", __FUNCTION__); | 2262 | ata_dev_printk(dev, KERN_DEBUG, "%s: ENTER\n", __func__); |
2262 | 2263 | ||
2263 | /* set horkage */ | 2264 | /* set horkage */ |
2264 | dev->horkage |= ata_dev_blacklisted(dev); | 2265 | dev->horkage |= ata_dev_blacklisted(dev); |
@@ -2279,7 +2280,7 @@ int ata_dev_configure(struct ata_device *dev) | |||
2279 | ata_dev_printk(dev, KERN_DEBUG, | 2280 | ata_dev_printk(dev, KERN_DEBUG, |
2280 | "%s: cfg 49:%04x 82:%04x 83:%04x 84:%04x " | 2281 | "%s: cfg 49:%04x 82:%04x 83:%04x 84:%04x " |
2281 | "85:%04x 86:%04x 87:%04x 88:%04x\n", | 2282 | "85:%04x 86:%04x 87:%04x 88:%04x\n", |
2282 | __FUNCTION__, | 2283 | __func__, |
2283 | id[49], id[82], id[83], id[84], | 2284 | id[49], id[82], id[83], id[84], |
2284 | id[85], id[86], id[87], id[88]); | 2285 | id[85], id[86], id[87], id[88]); |
2285 | 2286 | ||
@@ -2511,13 +2512,13 @@ int ata_dev_configure(struct ata_device *dev) | |||
2511 | 2512 | ||
2512 | if (ata_msg_probe(ap)) | 2513 | if (ata_msg_probe(ap)) |
2513 | ata_dev_printk(dev, KERN_DEBUG, "%s: EXIT, drv_stat = 0x%x\n", | 2514 | ata_dev_printk(dev, KERN_DEBUG, "%s: EXIT, drv_stat = 0x%x\n", |
2514 | __FUNCTION__, ata_chk_status(ap)); | 2515 | __func__, ata_chk_status(ap)); |
2515 | return 0; | 2516 | return 0; |
2516 | 2517 | ||
2517 | err_out_nosup: | 2518 | err_out_nosup: |
2518 | if (ata_msg_probe(ap)) | 2519 | if (ata_msg_probe(ap)) |
2519 | ata_dev_printk(dev, KERN_DEBUG, | 2520 | ata_dev_printk(dev, KERN_DEBUG, |
2520 | "%s: EXIT, err\n", __FUNCTION__); | 2521 | "%s: EXIT, err\n", __func__); |
2521 | return rc; | 2522 | return rc; |
2522 | } | 2523 | } |
2523 | 2524 | ||
diff --git a/drivers/ata/libata-eh.c b/drivers/ata/libata-eh.c index 698ce2cea52c..681252fd8143 100644 --- a/drivers/ata/libata-eh.c +++ b/drivers/ata/libata-eh.c | |||
@@ -2150,6 +2150,15 @@ int ata_eh_reset(struct ata_link *link, int classify, | |||
2150 | ap->ops->set_piomode(ap, dev); | 2150 | ap->ops->set_piomode(ap, dev); |
2151 | } | 2151 | } |
2152 | 2152 | ||
2153 | if (!softreset && !hardreset) { | ||
2154 | if (verbose) | ||
2155 | ata_link_printk(link, KERN_INFO, "no reset method " | ||
2156 | "available, skipping reset\n"); | ||
2157 | if (!(lflags & ATA_LFLAG_ASSUME_CLASS)) | ||
2158 | lflags |= ATA_LFLAG_ASSUME_ATA; | ||
2159 | goto done; | ||
2160 | } | ||
2161 | |||
2153 | /* Determine which reset to use and record in ehc->i.action. | 2162 | /* Determine which reset to use and record in ehc->i.action. |
2154 | * prereset() may examine and modify it. | 2163 | * prereset() may examine and modify it. |
2155 | */ | 2164 | */ |
@@ -2254,6 +2263,7 @@ int ata_eh_reset(struct ata_link *link, int classify, | |||
2254 | lflags |= ATA_LFLAG_ASSUME_ATA; | 2263 | lflags |= ATA_LFLAG_ASSUME_ATA; |
2255 | } | 2264 | } |
2256 | 2265 | ||
2266 | done: | ||
2257 | ata_link_for_each_dev(dev, link) { | 2267 | ata_link_for_each_dev(dev, link) { |
2258 | /* After the reset, the device state is PIO 0 and the | 2268 | /* After the reset, the device state is PIO 0 and the |
2259 | * controller state is undefined. Reset also wakes up | 2269 | * controller state is undefined. Reset also wakes up |
diff --git a/drivers/ata/libata-sff.c b/drivers/ata/libata-sff.c index 60cd4b179766..20dc572fb45a 100644 --- a/drivers/ata/libata-sff.c +++ b/drivers/ata/libata-sff.c | |||
@@ -56,7 +56,8 @@ u8 ata_irq_on(struct ata_port *ap) | |||
56 | ap->ctl &= ~ATA_NIEN; | 56 | ap->ctl &= ~ATA_NIEN; |
57 | ap->last_ctl = ap->ctl; | 57 | ap->last_ctl = ap->ctl; |
58 | 58 | ||
59 | iowrite8(ap->ctl, ioaddr->ctl_addr); | 59 | if (ioaddr->ctl_addr) |
60 | iowrite8(ap->ctl, ioaddr->ctl_addr); | ||
60 | tmp = ata_wait_idle(ap); | 61 | tmp = ata_wait_idle(ap); |
61 | 62 | ||
62 | ap->ops->irq_clear(ap); | 63 | ap->ops->irq_clear(ap); |
@@ -81,12 +82,14 @@ void ata_tf_load(struct ata_port *ap, const struct ata_taskfile *tf) | |||
81 | unsigned int is_addr = tf->flags & ATA_TFLAG_ISADDR; | 82 | unsigned int is_addr = tf->flags & ATA_TFLAG_ISADDR; |
82 | 83 | ||
83 | if (tf->ctl != ap->last_ctl) { | 84 | if (tf->ctl != ap->last_ctl) { |
84 | iowrite8(tf->ctl, ioaddr->ctl_addr); | 85 | if (ioaddr->ctl_addr) |
86 | iowrite8(tf->ctl, ioaddr->ctl_addr); | ||
85 | ap->last_ctl = tf->ctl; | 87 | ap->last_ctl = tf->ctl; |
86 | ata_wait_idle(ap); | 88 | ata_wait_idle(ap); |
87 | } | 89 | } |
88 | 90 | ||
89 | if (is_addr && (tf->flags & ATA_TFLAG_LBA48)) { | 91 | if (is_addr && (tf->flags & ATA_TFLAG_LBA48)) { |
92 | WARN_ON(!ioaddr->ctl_addr); | ||
90 | iowrite8(tf->hob_feature, ioaddr->feature_addr); | 93 | iowrite8(tf->hob_feature, ioaddr->feature_addr); |
91 | iowrite8(tf->hob_nsect, ioaddr->nsect_addr); | 94 | iowrite8(tf->hob_nsect, ioaddr->nsect_addr); |
92 | iowrite8(tf->hob_lbal, ioaddr->lbal_addr); | 95 | iowrite8(tf->hob_lbal, ioaddr->lbal_addr); |
@@ -167,14 +170,17 @@ void ata_tf_read(struct ata_port *ap, struct ata_taskfile *tf) | |||
167 | tf->device = ioread8(ioaddr->device_addr); | 170 | tf->device = ioread8(ioaddr->device_addr); |
168 | 171 | ||
169 | if (tf->flags & ATA_TFLAG_LBA48) { | 172 | if (tf->flags & ATA_TFLAG_LBA48) { |
170 | iowrite8(tf->ctl | ATA_HOB, ioaddr->ctl_addr); | 173 | if (likely(ioaddr->ctl_addr)) { |
171 | tf->hob_feature = ioread8(ioaddr->error_addr); | 174 | iowrite8(tf->ctl | ATA_HOB, ioaddr->ctl_addr); |
172 | tf->hob_nsect = ioread8(ioaddr->nsect_addr); | 175 | tf->hob_feature = ioread8(ioaddr->error_addr); |
173 | tf->hob_lbal = ioread8(ioaddr->lbal_addr); | 176 | tf->hob_nsect = ioread8(ioaddr->nsect_addr); |
174 | tf->hob_lbam = ioread8(ioaddr->lbam_addr); | 177 | tf->hob_lbal = ioread8(ioaddr->lbal_addr); |
175 | tf->hob_lbah = ioread8(ioaddr->lbah_addr); | 178 | tf->hob_lbam = ioread8(ioaddr->lbam_addr); |
176 | iowrite8(tf->ctl, ioaddr->ctl_addr); | 179 | tf->hob_lbah = ioread8(ioaddr->lbah_addr); |
177 | ap->last_ctl = tf->ctl; | 180 | iowrite8(tf->ctl, ioaddr->ctl_addr); |
181 | ap->last_ctl = tf->ctl; | ||
182 | } else | ||
183 | WARN_ON(1); | ||
178 | } | 184 | } |
179 | } | 185 | } |
180 | 186 | ||
@@ -352,7 +358,8 @@ void ata_bmdma_freeze(struct ata_port *ap) | |||
352 | ap->ctl |= ATA_NIEN; | 358 | ap->ctl |= ATA_NIEN; |
353 | ap->last_ctl = ap->ctl; | 359 | ap->last_ctl = ap->ctl; |
354 | 360 | ||
355 | iowrite8(ap->ctl, ioaddr->ctl_addr); | 361 | if (ioaddr->ctl_addr) |
362 | iowrite8(ap->ctl, ioaddr->ctl_addr); | ||
356 | 363 | ||
357 | /* Under certain circumstances, some controllers raise IRQ on | 364 | /* Under certain circumstances, some controllers raise IRQ on |
358 | * ATA_NIEN manipulation. Also, many controllers fail to mask | 365 | * ATA_NIEN manipulation. Also, many controllers fail to mask |
@@ -459,13 +466,14 @@ void ata_bmdma_drive_eh(struct ata_port *ap, ata_prereset_fn_t prereset, | |||
459 | */ | 466 | */ |
460 | void ata_bmdma_error_handler(struct ata_port *ap) | 467 | void ata_bmdma_error_handler(struct ata_port *ap) |
461 | { | 468 | { |
462 | ata_reset_fn_t hardreset; | 469 | ata_reset_fn_t softreset = NULL, hardreset = NULL; |
463 | 470 | ||
464 | hardreset = NULL; | 471 | if (ap->ioaddr.ctl_addr) |
472 | softreset = ata_std_softreset; | ||
465 | if (sata_scr_valid(&ap->link)) | 473 | if (sata_scr_valid(&ap->link)) |
466 | hardreset = sata_std_hardreset; | 474 | hardreset = sata_std_hardreset; |
467 | 475 | ||
468 | ata_bmdma_drive_eh(ap, ata_std_prereset, ata_std_softreset, hardreset, | 476 | ata_bmdma_drive_eh(ap, ata_std_prereset, softreset, hardreset, |
469 | ata_std_postreset); | 477 | ata_std_postreset); |
470 | } | 478 | } |
471 | 479 | ||
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_pdc2027x.c b/drivers/ata/pata_pdc2027x.c index 028af5dbeed6..511c89b9bae8 100644 --- a/drivers/ata/pata_pdc2027x.c +++ b/drivers/ata/pata_pdc2027x.c | |||
@@ -39,7 +39,7 @@ | |||
39 | #undef PDC_DEBUG | 39 | #undef PDC_DEBUG |
40 | 40 | ||
41 | #ifdef PDC_DEBUG | 41 | #ifdef PDC_DEBUG |
42 | #define PDPRINTK(fmt, args...) printk(KERN_ERR "%s: " fmt, __FUNCTION__, ## args) | 42 | #define PDPRINTK(fmt, args...) printk(KERN_ERR "%s: " fmt, __func__, ## args) |
43 | #else | 43 | #else |
44 | #define PDPRINTK(fmt, args...) | 44 | #define PDPRINTK(fmt, args...) |
45 | #endif | 45 | #endif |
diff --git a/drivers/ata/pata_rb500_cf.c b/drivers/ata/pata_rb500_cf.c new file mode 100644 index 000000000000..4ce9b03fe6c8 --- /dev/null +++ b/drivers/ata/pata_rb500_cf.c | |||
@@ -0,0 +1,314 @@ | |||
1 | /* | ||
2 | * A low-level PATA driver to handle a Compact Flash connected on the | ||
3 | * Mikrotik's RouterBoard 532 board. | ||
4 | * | ||
5 | * Copyright (C) 2007 Gabor Juhos <juhosg at openwrt.org> | ||
6 | * Copyright (C) 2008 Florian Fainelli <florian@openwrt.org> | ||
7 | * | ||
8 | * This file was based on: drivers/ata/pata_ixp4xx_cf.c | ||
9 | * Copyright (C) 2006-07 Tower Technologies | ||
10 | * Author: Alessandro Zummo <a.zummo@towertech.it> | ||
11 | * | ||
12 | * Also was based on the driver for Linux 2.4.xx published by Mikrotik for | ||
13 | * their RouterBoard 1xx and 5xx series devices. The original Mikrotik code | ||
14 | * seems not to have a license. | ||
15 | * | ||
16 | * This program is free software; you can redistribute it and/or modify | ||
17 | * it under the terms of the GNU General Public License version 2 as | ||
18 | * published by the Free Software Foundation. | ||
19 | * | ||
20 | */ | ||
21 | |||
22 | #include <linux/kernel.h> | ||
23 | #include <linux/module.h> | ||
24 | #include <linux/platform_device.h> | ||
25 | |||
26 | #include <linux/io.h> | ||
27 | #include <linux/interrupt.h> | ||
28 | #include <linux/irq.h> | ||
29 | |||
30 | #include <linux/libata.h> | ||
31 | #include <scsi/scsi_host.h> | ||
32 | |||
33 | #include <asm/gpio.h> | ||
34 | |||
35 | #define DRV_NAME "pata-rb500-cf" | ||
36 | #define DRV_VERSION "0.1.0" | ||
37 | #define DRV_DESC "PATA driver for RouterBOARD 532 Compact Flash" | ||
38 | |||
39 | #define RB500_CF_MAXPORTS 1 | ||
40 | #define RB500_CF_IO_DELAY 400 | ||
41 | |||
42 | #define RB500_CF_REG_CMD 0x0800 | ||
43 | #define RB500_CF_REG_CTRL 0x080E | ||
44 | #define RB500_CF_REG_DATA 0x0C00 | ||
45 | |||
46 | struct rb500_cf_info { | ||
47 | void __iomem *iobase; | ||
48 | unsigned int gpio_line; | ||
49 | int frozen; | ||
50 | unsigned int irq; | ||
51 | }; | ||
52 | |||
53 | /* ------------------------------------------------------------------------ */ | ||
54 | |||
55 | static inline void rb500_pata_finish_io(struct ata_port *ap) | ||
56 | { | ||
57 | struct ata_host *ah = ap->host; | ||
58 | struct rb500_cf_info *info = ah->private_data; | ||
59 | |||
60 | ata_altstatus(ap); | ||
61 | ndelay(RB500_CF_IO_DELAY); | ||
62 | |||
63 | set_irq_type(info->irq, IRQ_TYPE_LEVEL_HIGH); | ||
64 | } | ||
65 | |||
66 | static void rb500_pata_exec_command(struct ata_port *ap, | ||
67 | const struct ata_taskfile *tf) | ||
68 | { | ||
69 | writeb(tf->command, ap->ioaddr.command_addr); | ||
70 | rb500_pata_finish_io(ap); | ||
71 | } | ||
72 | |||
73 | static void rb500_pata_data_xfer(struct ata_device *adev, unsigned char *buf, | ||
74 | unsigned int buflen, int write_data) | ||
75 | { | ||
76 | struct ata_port *ap = adev->link->ap; | ||
77 | void __iomem *ioaddr = ap->ioaddr.data_addr; | ||
78 | |||
79 | if (write_data) { | ||
80 | for (; buflen > 0; buflen--, buf++) | ||
81 | writeb(*buf, ioaddr); | ||
82 | } else { | ||
83 | for (; buflen > 0; buflen--, buf++) | ||
84 | *buf = readb(ioaddr); | ||
85 | } | ||
86 | |||
87 | rb500_pata_finish_io(adev->link->ap); | ||
88 | } | ||
89 | |||
90 | static void rb500_pata_freeze(struct ata_port *ap) | ||
91 | { | ||
92 | struct rb500_cf_info *info = ap->host->private_data; | ||
93 | |||
94 | info->frozen = 1; | ||
95 | } | ||
96 | |||
97 | static void rb500_pata_thaw(struct ata_port *ap) | ||
98 | { | ||
99 | struct rb500_cf_info *info = ap->host->private_data; | ||
100 | |||
101 | info->frozen = 0; | ||
102 | } | ||
103 | |||
104 | static irqreturn_t rb500_pata_irq_handler(int irq, void *dev_instance) | ||
105 | { | ||
106 | struct ata_host *ah = dev_instance; | ||
107 | struct rb500_cf_info *info = ah->private_data; | ||
108 | |||
109 | if (gpio_get_value(info->gpio_line)) { | ||
110 | set_irq_type(info->irq, IRQ_TYPE_LEVEL_LOW); | ||
111 | if (!info->frozen) | ||
112 | ata_interrupt(info->irq, dev_instance); | ||
113 | } else { | ||
114 | set_irq_type(info->irq, IRQ_TYPE_LEVEL_HIGH); | ||
115 | } | ||
116 | |||
117 | return IRQ_HANDLED; | ||
118 | } | ||
119 | |||
120 | static void rb500_pata_irq_clear(struct ata_port *ap) | ||
121 | { | ||
122 | } | ||
123 | |||
124 | static int rb500_pata_port_start(struct ata_port *ap) | ||
125 | { | ||
126 | return 0; | ||
127 | } | ||
128 | |||
129 | static struct ata_port_operations rb500_pata_port_ops = { | ||
130 | .tf_load = ata_tf_load, | ||
131 | .tf_read = ata_tf_read, | ||
132 | |||
133 | .exec_command = rb500_pata_exec_command, | ||
134 | .check_status = ata_check_status, | ||
135 | .dev_select = ata_std_dev_select, | ||
136 | |||
137 | .data_xfer = rb500_pata_data_xfer, | ||
138 | |||
139 | .qc_prep = ata_qc_prep, | ||
140 | .qc_issue = ata_qc_issue_prot, | ||
141 | |||
142 | .freeze = rb500_pata_freeze, | ||
143 | .thaw = rb500_pata_thaw, | ||
144 | .error_handler = ata_bmdma_error_handler, | ||
145 | |||
146 | .irq_handler = rb500_pata_irq_handler, | ||
147 | .irq_clear = rb500_pata_irq_clear, | ||
148 | .irq_on = ata_irq_on, | ||
149 | |||
150 | .port_start = rb500_pata_port_start, | ||
151 | }; | ||
152 | |||
153 | /* ------------------------------------------------------------------------ */ | ||
154 | |||
155 | static struct scsi_host_template rb500_pata_sht = { | ||
156 | .module = THIS_MODULE, | ||
157 | .name = DRV_NAME, | ||
158 | .ioctl = ata_scsi_ioctl, | ||
159 | .queuecommand = ata_scsi_queuecmd, | ||
160 | .slave_configure = ata_scsi_slave_config, | ||
161 | .slave_destroy = ata_scsi_slave_destroy, | ||
162 | .bios_param = ata_std_bios_param, | ||
163 | .proc_name = DRV_NAME, | ||
164 | |||
165 | .can_queue = ATA_DEF_QUEUE, | ||
166 | .this_id = ATA_SHT_THIS_ID, | ||
167 | .sg_tablesize = LIBATA_MAX_PRD, | ||
168 | .dma_boundary = ATA_DMA_BOUNDARY, | ||
169 | .cmd_per_lun = ATA_SHT_CMD_PER_LUN, | ||
170 | .emulated = ATA_SHT_EMULATED, | ||
171 | .use_clustering = ATA_SHT_USE_CLUSTERING, | ||
172 | }; | ||
173 | |||
174 | /* ------------------------------------------------------------------------ */ | ||
175 | |||
176 | static void rb500_pata_setup_ports(struct ata_host *ah) | ||
177 | { | ||
178 | struct rb500_cf_info *info = ah->private_data; | ||
179 | struct ata_port *ap; | ||
180 | |||
181 | ap = ah->ports[0]; | ||
182 | |||
183 | ap->ops = &rb500_pata_port_ops; | ||
184 | ap->pio_mask = 0x1f; /* PIO4 */ | ||
185 | ap->flags = ATA_FLAG_NO_LEGACY | ATA_FLAG_MMIO; | ||
186 | |||
187 | ap->ioaddr.cmd_addr = info->iobase + RB500_CF_REG_CMD; | ||
188 | ap->ioaddr.ctl_addr = info->iobase + RB500_CF_REG_CTRL; | ||
189 | ap->ioaddr.altstatus_addr = info->iobase + RB500_CF_REG_CTRL; | ||
190 | |||
191 | ata_std_ports(&ap->ioaddr); | ||
192 | |||
193 | ap->ioaddr.data_addr = info->iobase + RB500_CF_REG_DATA; | ||
194 | } | ||
195 | |||
196 | static __devinit int rb500_pata_driver_probe(struct platform_device *pdev) | ||
197 | { | ||
198 | unsigned int irq; | ||
199 | int gpio; | ||
200 | struct resource *res; | ||
201 | struct ata_host *ah; | ||
202 | struct rb500_cf_info *info; | ||
203 | int ret; | ||
204 | |||
205 | res = platform_get_resource(pdev, IORESOURCE_MEM, 0); | ||
206 | if (!res) { | ||
207 | dev_err(&pdev->dev, "no IOMEM resource found\n"); | ||
208 | return -EINVAL; | ||
209 | } | ||
210 | |||
211 | irq = platform_get_irq(pdev, 0); | ||
212 | if (irq <= 0) { | ||
213 | dev_err(&pdev->dev, "no IRQ resource found\n"); | ||
214 | return -ENOENT; | ||
215 | } | ||
216 | |||
217 | gpio = irq_to_gpio(irq); | ||
218 | if (gpio < 0) { | ||
219 | dev_err(&pdev->dev, "no GPIO found for irq%d\n", irq); | ||
220 | return -ENOENT; | ||
221 | } | ||
222 | |||
223 | ret = gpio_request(gpio, DRV_NAME); | ||
224 | if (ret) { | ||
225 | dev_err(&pdev->dev, "GPIO request failed\n"); | ||
226 | return ret; | ||
227 | } | ||
228 | |||
229 | /* allocate host */ | ||
230 | ah = ata_host_alloc(&pdev->dev, RB500_CF_MAXPORTS); | ||
231 | if (!ah) | ||
232 | return -ENOMEM; | ||
233 | |||
234 | platform_set_drvdata(pdev, ah); | ||
235 | |||
236 | info = devm_kzalloc(&pdev->dev, sizeof(*info), GFP_KERNEL); | ||
237 | if (!info) | ||
238 | return -ENOMEM; | ||
239 | |||
240 | ah->private_data = info; | ||
241 | info->gpio_line = gpio; | ||
242 | info->irq = irq; | ||
243 | |||
244 | info->iobase = devm_ioremap_nocache(&pdev->dev, res->start, | ||
245 | res->end - res->start + 1); | ||
246 | if (!info->iobase) | ||
247 | return -ENOMEM; | ||
248 | |||
249 | ret = gpio_direction_input(gpio); | ||
250 | if (ret) { | ||
251 | dev_err(&pdev->dev, "unable to set GPIO direction, err=%d\n", | ||
252 | ret); | ||
253 | goto err_free_gpio; | ||
254 | } | ||
255 | |||
256 | rb500_pata_setup_ports(ah); | ||
257 | |||
258 | ret = ata_host_activate(ah, irq, rb500_pata_irq_handler, | ||
259 | IRQF_TRIGGER_LOW, &rb500_pata_sht); | ||
260 | if (ret) | ||
261 | goto err_free_gpio; | ||
262 | |||
263 | return 0; | ||
264 | |||
265 | err_free_gpio: | ||
266 | gpio_free(gpio); | ||
267 | |||
268 | return ret; | ||
269 | } | ||
270 | |||
271 | static __devexit int rb500_pata_driver_remove(struct platform_device *pdev) | ||
272 | { | ||
273 | struct ata_host *ah = platform_get_drvdata(pdev); | ||
274 | struct rb500_cf_info *info = ah->private_data; | ||
275 | |||
276 | ata_host_detach(ah); | ||
277 | gpio_free(info->gpio_line); | ||
278 | |||
279 | return 0; | ||
280 | } | ||
281 | |||
282 | static struct platform_driver rb500_pata_platform_driver = { | ||
283 | .probe = rb500_pata_driver_probe, | ||
284 | .remove = __devexit_p(rb500_pata_driver_remove), | ||
285 | .driver = { | ||
286 | .name = DRV_NAME, | ||
287 | .owner = THIS_MODULE, | ||
288 | }, | ||
289 | }; | ||
290 | |||
291 | /* ------------------------------------------------------------------------ */ | ||
292 | |||
293 | #define DRV_INFO DRV_DESC " version " DRV_VERSION | ||
294 | |||
295 | static int __init rb500_pata_module_init(void) | ||
296 | { | ||
297 | printk(KERN_INFO DRV_INFO "\n"); | ||
298 | |||
299 | return platform_driver_register(&rb500_pata_platform_driver); | ||
300 | } | ||
301 | |||
302 | static void __exit rb500_pata_module_exit(void) | ||
303 | { | ||
304 | platform_driver_unregister(&rb500_pata_platform_driver); | ||
305 | } | ||
306 | |||
307 | MODULE_AUTHOR("Gabor Juhos <juhosg at openwrt.org>"); | ||
308 | MODULE_AUTHOR("Florian Fainelli <florian@openwrt.org>"); | ||
309 | MODULE_DESCRIPTION(DRV_DESC); | ||
310 | MODULE_VERSION(DRV_VERSION); | ||
311 | MODULE_LICENSE("GPL"); | ||
312 | |||
313 | module_init(rb500_pata_module_init); | ||
314 | module_exit(rb500_pata_module_exit); | ||
diff --git a/drivers/atm/firestream.c b/drivers/atm/firestream.c index c662d686154a..47c57a4294b7 100644 --- a/drivers/atm/firestream.c +++ b/drivers/atm/firestream.c | |||
@@ -331,8 +331,8 @@ module_param(fs_keystream, int, 0); | |||
331 | #define FS_DEBUG_QSIZE 0x00001000 | 331 | #define FS_DEBUG_QSIZE 0x00001000 |
332 | 332 | ||
333 | 333 | ||
334 | #define func_enter() fs_dprintk (FS_DEBUG_FLOW, "fs: enter %s\n", __FUNCTION__) | 334 | #define func_enter() fs_dprintk(FS_DEBUG_FLOW, "fs: enter %s\n", __func__) |
335 | #define func_exit() fs_dprintk (FS_DEBUG_FLOW, "fs: exit %s\n", __FUNCTION__) | 335 | #define func_exit() fs_dprintk(FS_DEBUG_FLOW, "fs: exit %s\n", __func__) |
336 | 336 | ||
337 | 337 | ||
338 | static struct fs_dev *fs_boards = NULL; | 338 | static struct fs_dev *fs_boards = NULL; |
diff --git a/drivers/atm/fore200e.c b/drivers/atm/fore200e.c index f97e050338f0..9427a61f62b0 100644 --- a/drivers/atm/fore200e.c +++ b/drivers/atm/fore200e.c | |||
@@ -95,8 +95,8 @@ | |||
95 | #if 1 | 95 | #if 1 |
96 | #define ASSERT(expr) if (!(expr)) { \ | 96 | #define ASSERT(expr) if (!(expr)) { \ |
97 | printk(FORE200E "assertion failed! %s[%d]: %s\n", \ | 97 | printk(FORE200E "assertion failed! %s[%d]: %s\n", \ |
98 | __FUNCTION__, __LINE__, #expr); \ | 98 | __func__, __LINE__, #expr); \ |
99 | panic(FORE200E "%s", __FUNCTION__); \ | 99 | panic(FORE200E "%s", __func__); \ |
100 | } | 100 | } |
101 | #else | 101 | #else |
102 | #define ASSERT(expr) do {} while (0) | 102 | #define ASSERT(expr) do {} while (0) |
diff --git a/drivers/atm/idt77252.c b/drivers/atm/idt77252.c index eee54c0cde68..b967919fb7e2 100644 --- a/drivers/atm/idt77252.c +++ b/drivers/atm/idt77252.c | |||
@@ -555,7 +555,7 @@ idt77252_tx_dump(struct idt77252_dev *card) | |||
555 | struct vc_map *vc; | 555 | struct vc_map *vc; |
556 | int i; | 556 | int i; |
557 | 557 | ||
558 | printk("%s\n", __FUNCTION__); | 558 | printk("%s\n", __func__); |
559 | for (i = 0; i < card->tct_size; i++) { | 559 | for (i = 0; i < card->tct_size; i++) { |
560 | vc = card->vcs[i]; | 560 | vc = card->vcs[i]; |
561 | if (!vc) | 561 | if (!vc) |
@@ -1035,7 +1035,7 @@ dequeue_rx(struct idt77252_dev *card, struct rsq_entry *rsqe) | |||
1035 | skb = sb_pool_skb(card, le32_to_cpu(rsqe->word_2)); | 1035 | skb = sb_pool_skb(card, le32_to_cpu(rsqe->word_2)); |
1036 | if (skb == NULL) { | 1036 | if (skb == NULL) { |
1037 | printk("%s: NULL skb in %s, rsqe: %08x %08x %08x %08x\n", | 1037 | printk("%s: NULL skb in %s, rsqe: %08x %08x %08x %08x\n", |
1038 | card->name, __FUNCTION__, | 1038 | card->name, __func__, |
1039 | le32_to_cpu(rsqe->word_1), le32_to_cpu(rsqe->word_2), | 1039 | le32_to_cpu(rsqe->word_1), le32_to_cpu(rsqe->word_2), |
1040 | le32_to_cpu(rsqe->word_3), le32_to_cpu(rsqe->word_4)); | 1040 | le32_to_cpu(rsqe->word_3), le32_to_cpu(rsqe->word_4)); |
1041 | return; | 1041 | return; |
@@ -1873,7 +1873,7 @@ add_rx_skb(struct idt77252_dev *card, int queue, | |||
1873 | return; | 1873 | return; |
1874 | 1874 | ||
1875 | if (sb_pool_add(card, skb, queue)) { | 1875 | if (sb_pool_add(card, skb, queue)) { |
1876 | printk("%s: SB POOL full\n", __FUNCTION__); | 1876 | printk("%s: SB POOL full\n", __func__); |
1877 | goto outfree; | 1877 | goto outfree; |
1878 | } | 1878 | } |
1879 | 1879 | ||
@@ -1883,7 +1883,7 @@ add_rx_skb(struct idt77252_dev *card, int queue, | |||
1883 | IDT77252_PRV_PADDR(skb) = paddr; | 1883 | IDT77252_PRV_PADDR(skb) = paddr; |
1884 | 1884 | ||
1885 | if (push_rx_skb(card, skb, queue)) { | 1885 | if (push_rx_skb(card, skb, queue)) { |
1886 | printk("%s: FB QUEUE full\n", __FUNCTION__); | 1886 | printk("%s: FB QUEUE full\n", __func__); |
1887 | goto outunmap; | 1887 | goto outunmap; |
1888 | } | 1888 | } |
1889 | } | 1889 | } |
@@ -3821,12 +3821,12 @@ static int __init idt77252_init(void) | |||
3821 | { | 3821 | { |
3822 | struct sk_buff *skb; | 3822 | struct sk_buff *skb; |
3823 | 3823 | ||
3824 | printk("%s: at %p\n", __FUNCTION__, idt77252_init); | 3824 | printk("%s: at %p\n", __func__, idt77252_init); |
3825 | 3825 | ||
3826 | if (sizeof(skb->cb) < sizeof(struct atm_skb_data) + | 3826 | if (sizeof(skb->cb) < sizeof(struct atm_skb_data) + |
3827 | sizeof(struct idt77252_skb_prv)) { | 3827 | sizeof(struct idt77252_skb_prv)) { |
3828 | printk(KERN_ERR "%s: skb->cb is too small (%lu < %lu)\n", | 3828 | printk(KERN_ERR "%s: skb->cb is too small (%lu < %lu)\n", |
3829 | __FUNCTION__, (unsigned long) sizeof(skb->cb), | 3829 | __func__, (unsigned long) sizeof(skb->cb), |
3830 | (unsigned long) sizeof(struct atm_skb_data) + | 3830 | (unsigned long) sizeof(struct atm_skb_data) + |
3831 | sizeof(struct idt77252_skb_prv)); | 3831 | sizeof(struct idt77252_skb_prv)); |
3832 | return -EIO; | 3832 | return -EIO; |
diff --git a/drivers/base/platform.c b/drivers/base/platform.c index efaf282c438c..911ec600fe71 100644 --- a/drivers/base/platform.c +++ b/drivers/base/platform.c | |||
@@ -648,7 +648,7 @@ u64 dma_get_required_mask(struct device *dev) | |||
648 | high_totalram += high_totalram - 1; | 648 | high_totalram += high_totalram - 1; |
649 | mask = (((u64)high_totalram) << 32) + 0xffffffff; | 649 | mask = (((u64)high_totalram) << 32) + 0xffffffff; |
650 | } | 650 | } |
651 | return mask & *dev->dma_mask; | 651 | return mask; |
652 | } | 652 | } |
653 | EXPORT_SYMBOL_GPL(dma_get_required_mask); | 653 | EXPORT_SYMBOL_GPL(dma_get_required_mask); |
654 | #endif | 654 | #endif |
diff --git a/drivers/base/sys.c b/drivers/base/sys.c index 2f79c55acdcc..8e13fd942163 100644 --- a/drivers/base/sys.c +++ b/drivers/base/sys.c | |||
@@ -133,6 +133,7 @@ int sysdev_class_register(struct sysdev_class * cls) | |||
133 | pr_debug("Registering sysdev class '%s'\n", | 133 | pr_debug("Registering sysdev class '%s'\n", |
134 | kobject_name(&cls->kset.kobj)); | 134 | kobject_name(&cls->kset.kobj)); |
135 | INIT_LIST_HEAD(&cls->drivers); | 135 | INIT_LIST_HEAD(&cls->drivers); |
136 | memset(&cls->kset.kobj, 0x00, sizeof(struct kobject)); | ||
136 | cls->kset.kobj.parent = &system_kset->kobj; | 137 | cls->kset.kobj.parent = &system_kset->kobj; |
137 | cls->kset.kobj.ktype = &ktype_sysdev_class; | 138 | cls->kset.kobj.ktype = &ktype_sysdev_class; |
138 | cls->kset.kobj.kset = system_kset; | 139 | cls->kset.kobj.kset = system_kset; |
@@ -227,6 +228,9 @@ int sysdev_register(struct sys_device * sysdev) | |||
227 | 228 | ||
228 | pr_debug("Registering sys device '%s'\n", kobject_name(&sysdev->kobj)); | 229 | pr_debug("Registering sys device '%s'\n", kobject_name(&sysdev->kobj)); |
229 | 230 | ||
231 | /* initialize the kobject to 0, in case it had previously been used */ | ||
232 | memset(&sysdev->kobj, 0x00, sizeof(struct kobject)); | ||
233 | |||
230 | /* Make sure the kset is set */ | 234 | /* Make sure the kset is set */ |
231 | sysdev->kobj.kset = &cls->kset; | 235 | sysdev->kobj.kset = &cls->kset; |
232 | 236 | ||
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/viodasd.c b/drivers/block/viodasd.c index 9e61fca46117..41ca721d2523 100644 --- a/drivers/block/viodasd.c +++ b/drivers/block/viodasd.c | |||
@@ -528,8 +528,7 @@ static int block_event_to_scatterlist(const struct vioblocklpevent *bevent, | |||
528 | numsg = VIOMAXBLOCKDMA; | 528 | numsg = VIOMAXBLOCKDMA; |
529 | 529 | ||
530 | *total_len = 0; | 530 | *total_len = 0; |
531 | memset(sg, 0, sizeof(sg[0]) * VIOMAXBLOCKDMA); | 531 | sg_init_table(sg, VIOMAXBLOCKDMA); |
532 | |||
533 | for (i = 0; (i < numsg) && (rw_data->dma_info[i].len > 0); ++i) { | 532 | for (i = 0; (i < numsg) && (rw_data->dma_info[i].len > 0); ++i) { |
534 | sg_dma_address(&sg[i]) = rw_data->dma_info[i].token; | 533 | sg_dma_address(&sg[i]) = rw_data->dma_info[i].token; |
535 | sg_dma_len(&sg[i]) = rw_data->dma_info[i].len; | 534 | sg_dma_len(&sg[i]) = rw_data->dma_info[i].len; |
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/bluetooth/hci_usb.c b/drivers/bluetooth/hci_usb.c index f16c94cbf488..8b884f87d8b7 100644 --- a/drivers/bluetooth/hci_usb.c +++ b/drivers/bluetooth/hci_usb.c | |||
@@ -149,6 +149,9 @@ static struct usb_device_id blacklist_ids[] = { | |||
149 | { USB_DEVICE(0x0400, 0x0807), .driver_info = HCI_BROKEN_ISOC }, | 149 | { USB_DEVICE(0x0400, 0x0807), .driver_info = HCI_BROKEN_ISOC }, |
150 | { USB_DEVICE(0x0400, 0x080a), .driver_info = HCI_BROKEN_ISOC }, | 150 | { USB_DEVICE(0x0400, 0x080a), .driver_info = HCI_BROKEN_ISOC }, |
151 | 151 | ||
152 | /* CONWISE Technology based adapters with buggy SCO support */ | ||
153 | { USB_DEVICE(0x0e5e, 0x6622), .driver_info = HCI_BROKEN_ISOC }, | ||
154 | |||
152 | /* Belkin F8T012 and F8T013 devices */ | 155 | /* Belkin F8T012 and F8T013 devices */ |
153 | { USB_DEVICE(0x050d, 0x0012), .driver_info = HCI_RESET | HCI_WRONG_SCO_MTU }, | 156 | { USB_DEVICE(0x050d, 0x0012), .driver_info = HCI_RESET | HCI_WRONG_SCO_MTU }, |
154 | { USB_DEVICE(0x050d, 0x0013), .driver_info = HCI_RESET | HCI_WRONG_SCO_MTU }, | 157 | { USB_DEVICE(0x050d, 0x0013), .driver_info = HCI_RESET | HCI_WRONG_SCO_MTU }, |
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/nozomi.c b/drivers/char/nozomi.c index dfaab2322de3..6d0dc5f9b6bb 100644 --- a/drivers/char/nozomi.c +++ b/drivers/char/nozomi.c | |||
@@ -190,6 +190,14 @@ enum card_type { | |||
190 | F32_8 = 8192, /* 3072 bytes downl. + 1024 bytes uplink * 2 -> 8192 */ | 190 | F32_8 = 8192, /* 3072 bytes downl. + 1024 bytes uplink * 2 -> 8192 */ |
191 | }; | 191 | }; |
192 | 192 | ||
193 | /* Initialization states a card can be in */ | ||
194 | enum card_state { | ||
195 | NOZOMI_STATE_UKNOWN = 0, | ||
196 | NOZOMI_STATE_ENABLED = 1, /* pci device enabled */ | ||
197 | NOZOMI_STATE_ALLOCATED = 2, /* config setup done */ | ||
198 | NOZOMI_STATE_READY = 3, /* flowcontrols received */ | ||
199 | }; | ||
200 | |||
193 | /* Two different toggle channels exist */ | 201 | /* Two different toggle channels exist */ |
194 | enum channel_type { | 202 | enum channel_type { |
195 | CH_A = 0, | 203 | CH_A = 0, |
@@ -385,6 +393,7 @@ struct nozomi { | |||
385 | spinlock_t spin_mutex; /* secures access to registers and tty */ | 393 | spinlock_t spin_mutex; /* secures access to registers and tty */ |
386 | 394 | ||
387 | unsigned int index_start; | 395 | unsigned int index_start; |
396 | enum card_state state; | ||
388 | u32 open_ttys; | 397 | u32 open_ttys; |
389 | }; | 398 | }; |
390 | 399 | ||
@@ -686,6 +695,7 @@ static int nozomi_read_config_table(struct nozomi *dc) | |||
686 | dc->last_ier = dc->last_ier | CTRL_DL; | 695 | dc->last_ier = dc->last_ier | CTRL_DL; |
687 | writew(dc->last_ier, dc->reg_ier); | 696 | writew(dc->last_ier, dc->reg_ier); |
688 | 697 | ||
698 | dc->state = NOZOMI_STATE_ALLOCATED; | ||
689 | dev_info(&dc->pdev->dev, "Initialization OK!\n"); | 699 | dev_info(&dc->pdev->dev, "Initialization OK!\n"); |
690 | return 1; | 700 | return 1; |
691 | } | 701 | } |
@@ -944,6 +954,14 @@ static int receive_flow_control(struct nozomi *dc) | |||
944 | case CTRL_APP2: | 954 | case CTRL_APP2: |
945 | port = PORT_APP2; | 955 | port = PORT_APP2; |
946 | enable_ier = APP2_DL; | 956 | enable_ier = APP2_DL; |
957 | if (dc->state == NOZOMI_STATE_ALLOCATED) { | ||
958 | /* | ||
959 | * After card initialization the flow control | ||
960 | * received for APP2 is always the last | ||
961 | */ | ||
962 | dc->state = NOZOMI_STATE_READY; | ||
963 | dev_info(&dc->pdev->dev, "Device READY!\n"); | ||
964 | } | ||
947 | break; | 965 | break; |
948 | default: | 966 | default: |
949 | dev_err(&dc->pdev->dev, | 967 | dev_err(&dc->pdev->dev, |
@@ -1366,22 +1384,12 @@ static int __devinit nozomi_card_init(struct pci_dev *pdev, | |||
1366 | 1384 | ||
1367 | dc->pdev = pdev; | 1385 | dc->pdev = pdev; |
1368 | 1386 | ||
1369 | /* Find out what card type it is */ | ||
1370 | nozomi_get_card_type(dc); | ||
1371 | |||
1372 | ret = pci_enable_device(dc->pdev); | 1387 | ret = pci_enable_device(dc->pdev); |
1373 | if (ret) { | 1388 | if (ret) { |
1374 | dev_err(&pdev->dev, "Failed to enable PCI Device\n"); | 1389 | dev_err(&pdev->dev, "Failed to enable PCI Device\n"); |
1375 | goto err_free; | 1390 | goto err_free; |
1376 | } | 1391 | } |
1377 | 1392 | ||
1378 | start = pci_resource_start(dc->pdev, 0); | ||
1379 | if (start == 0) { | ||
1380 | dev_err(&pdev->dev, "No I/O address for card detected\n"); | ||
1381 | ret = -ENODEV; | ||
1382 | goto err_disable_device; | ||
1383 | } | ||
1384 | |||
1385 | ret = pci_request_regions(dc->pdev, NOZOMI_NAME); | 1393 | ret = pci_request_regions(dc->pdev, NOZOMI_NAME); |
1386 | if (ret) { | 1394 | if (ret) { |
1387 | dev_err(&pdev->dev, "I/O address 0x%04x already in use\n", | 1395 | dev_err(&pdev->dev, "I/O address 0x%04x already in use\n", |
@@ -1389,6 +1397,16 @@ static int __devinit nozomi_card_init(struct pci_dev *pdev, | |||
1389 | goto err_disable_device; | 1397 | goto err_disable_device; |
1390 | } | 1398 | } |
1391 | 1399 | ||
1400 | start = pci_resource_start(dc->pdev, 0); | ||
1401 | if (start == 0) { | ||
1402 | dev_err(&pdev->dev, "No I/O address for card detected\n"); | ||
1403 | ret = -ENODEV; | ||
1404 | goto err_rel_regs; | ||
1405 | } | ||
1406 | |||
1407 | /* Find out what card type it is */ | ||
1408 | nozomi_get_card_type(dc); | ||
1409 | |||
1392 | dc->base_addr = ioremap(start, dc->card_type); | 1410 | dc->base_addr = ioremap(start, dc->card_type); |
1393 | if (!dc->base_addr) { | 1411 | if (!dc->base_addr) { |
1394 | dev_err(&pdev->dev, "Unable to map card MMIO\n"); | 1412 | dev_err(&pdev->dev, "Unable to map card MMIO\n"); |
@@ -1425,6 +1443,14 @@ static int __devinit nozomi_card_init(struct pci_dev *pdev, | |||
1425 | dc->index_start = ndev_idx * MAX_PORT; | 1443 | dc->index_start = ndev_idx * MAX_PORT; |
1426 | ndevs[ndev_idx] = dc; | 1444 | ndevs[ndev_idx] = dc; |
1427 | 1445 | ||
1446 | pci_set_drvdata(pdev, dc); | ||
1447 | |||
1448 | /* Enable RESET interrupt */ | ||
1449 | dc->last_ier = RESET; | ||
1450 | iowrite16(dc->last_ier, dc->reg_ier); | ||
1451 | |||
1452 | dc->state = NOZOMI_STATE_ENABLED; | ||
1453 | |||
1428 | for (i = 0; i < MAX_PORT; i++) { | 1454 | for (i = 0; i < MAX_PORT; i++) { |
1429 | mutex_init(&dc->port[i].tty_sem); | 1455 | mutex_init(&dc->port[i].tty_sem); |
1430 | dc->port[i].tty_open_count = 0; | 1456 | dc->port[i].tty_open_count = 0; |
@@ -1433,12 +1459,6 @@ static int __devinit nozomi_card_init(struct pci_dev *pdev, | |||
1433 | &pdev->dev); | 1459 | &pdev->dev); |
1434 | } | 1460 | } |
1435 | 1461 | ||
1436 | /* Enable RESET interrupt. */ | ||
1437 | dc->last_ier = RESET; | ||
1438 | writew(dc->last_ier, dc->reg_ier); | ||
1439 | |||
1440 | pci_set_drvdata(pdev, dc); | ||
1441 | |||
1442 | return 0; | 1462 | return 0; |
1443 | 1463 | ||
1444 | err_free_sbuf: | 1464 | err_free_sbuf: |
@@ -1553,7 +1573,7 @@ static int ntty_open(struct tty_struct *tty, struct file *file) | |||
1553 | struct nozomi *dc = get_dc_by_tty(tty); | 1573 | struct nozomi *dc = get_dc_by_tty(tty); |
1554 | unsigned long flags; | 1574 | unsigned long flags; |
1555 | 1575 | ||
1556 | if (!port || !dc) | 1576 | if (!port || !dc || dc->state != NOZOMI_STATE_READY) |
1557 | return -ENODEV; | 1577 | return -ENODEV; |
1558 | 1578 | ||
1559 | if (mutex_lock_interruptible(&port->tty_sem)) | 1579 | if (mutex_lock_interruptible(&port->tty_sem)) |
@@ -1716,6 +1736,10 @@ static int ntty_tiocmget(struct tty_struct *tty, struct file *file) | |||
1716 | static int ntty_tiocmset(struct tty_struct *tty, struct file *file, | 1736 | static int ntty_tiocmset(struct tty_struct *tty, struct file *file, |
1717 | unsigned int set, unsigned int clear) | 1737 | unsigned int set, unsigned int clear) |
1718 | { | 1738 | { |
1739 | struct nozomi *dc = get_dc_by_tty(tty); | ||
1740 | unsigned long flags; | ||
1741 | |||
1742 | spin_lock_irqsave(&dc->spin_mutex, flags); | ||
1719 | if (set & TIOCM_RTS) | 1743 | if (set & TIOCM_RTS) |
1720 | set_rts(tty, 1); | 1744 | set_rts(tty, 1); |
1721 | else if (clear & TIOCM_RTS) | 1745 | else if (clear & TIOCM_RTS) |
@@ -1725,6 +1749,7 @@ static int ntty_tiocmset(struct tty_struct *tty, struct file *file, | |||
1725 | set_dtr(tty, 1); | 1749 | set_dtr(tty, 1); |
1726 | else if (clear & TIOCM_DTR) | 1750 | else if (clear & TIOCM_DTR) |
1727 | set_dtr(tty, 0); | 1751 | set_dtr(tty, 0); |
1752 | spin_unlock_irqrestore(&dc->spin_mutex, flags); | ||
1728 | 1753 | ||
1729 | return 0; | 1754 | return 0; |
1730 | } | 1755 | } |
@@ -1762,7 +1787,7 @@ static int ntty_ioctl_tiocgicount(struct port *port, void __user *argp) | |||
1762 | icount.brk = cnow.brk; | 1787 | icount.brk = cnow.brk; |
1763 | icount.buf_overrun = cnow.buf_overrun; | 1788 | icount.buf_overrun = cnow.buf_overrun; |
1764 | 1789 | ||
1765 | return copy_to_user(argp, &icount, sizeof(icount)); | 1790 | return copy_to_user(argp, &icount, sizeof(icount)) ? -EFAULT : 0; |
1766 | } | 1791 | } |
1767 | 1792 | ||
1768 | static int ntty_ioctl(struct tty_struct *tty, struct file *file, | 1793 | static int ntty_ioctl(struct tty_struct *tty, struct file *file, |
diff --git a/drivers/char/riscom8.c b/drivers/char/riscom8.c index 8fc4fe4e38f1..3f9d0a9ac36d 100644 --- a/drivers/char/riscom8.c +++ b/drivers/char/riscom8.c | |||
@@ -1620,14 +1620,8 @@ static int __init rc_init_drivers(void) | |||
1620 | 1620 | ||
1621 | static void rc_release_drivers(void) | 1621 | static void rc_release_drivers(void) |
1622 | { | 1622 | { |
1623 | unsigned long flags; | ||
1624 | |||
1625 | spin_lock_irqsave(&riscom_lock, flags); | ||
1626 | |||
1627 | tty_unregister_driver(riscom_driver); | 1623 | tty_unregister_driver(riscom_driver); |
1628 | put_tty_driver(riscom_driver); | 1624 | put_tty_driver(riscom_driver); |
1629 | |||
1630 | spin_unlock_irqrestore(&riscom_lock, flags); | ||
1631 | } | 1625 | } |
1632 | 1626 | ||
1633 | #ifndef MODULE | 1627 | #ifndef MODULE |
@@ -1715,7 +1709,7 @@ static int __init riscom8_init_module (void) | |||
1715 | 1709 | ||
1716 | if (iobase || iobase1 || iobase2 || iobase3) { | 1710 | if (iobase || iobase1 || iobase2 || iobase3) { |
1717 | for(i = 0; i < RC_NBOARD; i++) | 1711 | for(i = 0; i < RC_NBOARD; i++) |
1718 | rc_board[0].base = 0; | 1712 | rc_board[i].base = 0; |
1719 | } | 1713 | } |
1720 | 1714 | ||
1721 | if (iobase) | 1715 | if (iobase) |
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..99529e59a0b1 100644 --- a/drivers/firewire/fw-transaction.c +++ b/drivers/firewire/fw-transaction.c | |||
@@ -751,7 +751,7 @@ handle_topology_map(struct fw_card *card, struct fw_request *request, | |||
751 | void *payload, size_t length, void *callback_data) | 751 | void *payload, size_t length, void *callback_data) |
752 | { | 752 | { |
753 | int i, start, end; | 753 | int i, start, end; |
754 | u32 *map; | 754 | __be32 *map; |
755 | 755 | ||
756 | if (!TCODE_IS_READ_REQUEST(tcode)) { | 756 | if (!TCODE_IS_READ_REQUEST(tcode)) { |
757 | fw_send_response(card, request, RCODE_TYPE_ERROR); | 757 | 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/gpio/pca953x.c b/drivers/gpio/pca953x.c index 92583cd4bffd..6e72fd31184d 100644 --- a/drivers/gpio/pca953x.c +++ b/drivers/gpio/pca953x.c | |||
@@ -184,6 +184,7 @@ static void pca953x_setup_gpio(struct pca953x_chip *chip, int gpios) | |||
184 | gc->direction_output = pca953x_gpio_direction_output; | 184 | gc->direction_output = pca953x_gpio_direction_output; |
185 | gc->get = pca953x_gpio_get_value; | 185 | gc->get = pca953x_gpio_get_value; |
186 | gc->set = pca953x_gpio_set_value; | 186 | gc->set = pca953x_gpio_set_value; |
187 | gc->can_sleep = 1; | ||
187 | 188 | ||
188 | gc->base = chip->gpio_start; | 189 | gc->base = chip->gpio_start; |
189 | gc->ngpio = gpios; | 190 | gc->ngpio = gpios; |
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/i2c/busses/i2c-amd756.c b/drivers/i2c/busses/i2c-amd756.c index 573abe440842..2fa43183d375 100644 --- a/drivers/i2c/busses/i2c-amd756.c +++ b/drivers/i2c/busses/i2c-amd756.c | |||
@@ -335,7 +335,7 @@ static int __devinit amd756_probe(struct pci_dev *pdev, | |||
335 | u8 temp; | 335 | u8 temp; |
336 | 336 | ||
337 | /* driver_data might come from user-space, so check it */ | 337 | /* driver_data might come from user-space, so check it */ |
338 | if (id->driver_data > ARRAY_SIZE(chipname)) | 338 | if (id->driver_data >= ARRAY_SIZE(chipname)) |
339 | return -EINVAL; | 339 | return -EINVAL; |
340 | 340 | ||
341 | if (amd756_ioport) { | 341 | if (amd756_ioport) { |
diff --git a/drivers/i2c/chips/Makefile b/drivers/i2c/chips/Makefile index 501f00cea782..e47aca0ca5ae 100644 --- a/drivers/i2c/chips/Makefile +++ b/drivers/i2c/chips/Makefile | |||
@@ -1,6 +1,13 @@ | |||
1 | # | 1 | # |
2 | # Makefile for miscellaneous I2C chip drivers. | 2 | # Makefile for miscellaneous I2C chip drivers. |
3 | # | 3 | # |
4 | # Think twice before you add a new driver to this directory. | ||
5 | # Device drivers are better grouped according to the functionality they | ||
6 | # implement rather than to the bus they are connected to. In particular: | ||
7 | # * Hardware monitoring chip drivers go to drivers/hwmon | ||
8 | # * RTC chip drivers go to drivers/rtc | ||
9 | # * I/O expander drivers go to drivers/gpio | ||
10 | # | ||
4 | 11 | ||
5 | obj-$(CONFIG_DS1682) += ds1682.o | 12 | obj-$(CONFIG_DS1682) += ds1682.o |
6 | obj-$(CONFIG_SENSORS_EEPROM) += eeprom.o | 13 | obj-$(CONFIG_SENSORS_EEPROM) += eeprom.o |
diff --git a/drivers/i2c/i2c-core.c b/drivers/i2c/i2c-core.c index 96da22e9a5a4..fd84b2a36338 100644 --- a/drivers/i2c/i2c-core.c +++ b/drivers/i2c/i2c-core.c | |||
@@ -90,12 +90,16 @@ static int i2c_device_probe(struct device *dev) | |||
90 | { | 90 | { |
91 | struct i2c_client *client = to_i2c_client(dev); | 91 | struct i2c_client *client = to_i2c_client(dev); |
92 | struct i2c_driver *driver = to_i2c_driver(dev->driver); | 92 | struct i2c_driver *driver = to_i2c_driver(dev->driver); |
93 | int status; | ||
93 | 94 | ||
94 | if (!driver->probe) | 95 | if (!driver->probe) |
95 | return -ENODEV; | 96 | return -ENODEV; |
96 | client->driver = driver; | 97 | client->driver = driver; |
97 | dev_dbg(dev, "probe\n"); | 98 | dev_dbg(dev, "probe\n"); |
98 | return driver->probe(client); | 99 | status = driver->probe(client); |
100 | if (status) | ||
101 | client->driver = NULL; | ||
102 | return status; | ||
99 | } | 103 | } |
100 | 104 | ||
101 | static int i2c_device_remove(struct device *dev) | 105 | static int i2c_device_remove(struct device *dev) |
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/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/core/cm.c b/drivers/infiniband/core/cm.c index b10ade92efed..4df405157086 100644 --- a/drivers/infiniband/core/cm.c +++ b/drivers/infiniband/core/cm.c | |||
@@ -3759,6 +3759,7 @@ static void cm_remove_one(struct ib_device *device) | |||
3759 | port = cm_dev->port[i-1]; | 3759 | port = cm_dev->port[i-1]; |
3760 | ib_modify_port(device, port->port_num, 0, &port_modify); | 3760 | ib_modify_port(device, port->port_num, 0, &port_modify); |
3761 | ib_unregister_mad_agent(port->mad_agent); | 3761 | ib_unregister_mad_agent(port->mad_agent); |
3762 | flush_workqueue(cm.wq); | ||
3762 | cm_remove_port_fs(port); | 3763 | cm_remove_port_fs(port); |
3763 | } | 3764 | } |
3764 | kobject_put(&cm_dev->dev_obj); | 3765 | kobject_put(&cm_dev->dev_obj); |
@@ -3813,6 +3814,7 @@ static void __exit ib_cm_cleanup(void) | |||
3813 | cancel_delayed_work(&timewait_info->work.work); | 3814 | cancel_delayed_work(&timewait_info->work.work); |
3814 | spin_unlock_irq(&cm.lock); | 3815 | spin_unlock_irq(&cm.lock); |
3815 | 3816 | ||
3817 | ib_unregister_client(&cm_client); | ||
3816 | destroy_workqueue(cm.wq); | 3818 | destroy_workqueue(cm.wq); |
3817 | 3819 | ||
3818 | list_for_each_entry_safe(timewait_info, tmp, &cm.timewait_list, list) { | 3820 | list_for_each_entry_safe(timewait_info, tmp, &cm.timewait_list, list) { |
@@ -3820,7 +3822,6 @@ static void __exit ib_cm_cleanup(void) | |||
3820 | kfree(timewait_info); | 3822 | kfree(timewait_info); |
3821 | } | 3823 | } |
3822 | 3824 | ||
3823 | ib_unregister_client(&cm_client); | ||
3824 | class_unregister(&cm_class); | 3825 | class_unregister(&cm_class); |
3825 | idr_destroy(&cm.local_id_table); | 3826 | idr_destroy(&cm.local_id_table); |
3826 | } | 3827 | } |
diff --git a/drivers/infiniband/core/fmr_pool.c b/drivers/infiniband/core/fmr_pool.c index 7f00347364f7..06d502c06a4d 100644 --- a/drivers/infiniband/core/fmr_pool.c +++ b/drivers/infiniband/core/fmr_pool.c | |||
@@ -139,7 +139,7 @@ static inline struct ib_pool_fmr *ib_fmr_cache_lookup(struct ib_fmr_pool *pool, | |||
139 | static void ib_fmr_batch_release(struct ib_fmr_pool *pool) | 139 | static void ib_fmr_batch_release(struct ib_fmr_pool *pool) |
140 | { | 140 | { |
141 | int ret; | 141 | int ret; |
142 | struct ib_pool_fmr *fmr, *next; | 142 | struct ib_pool_fmr *fmr; |
143 | LIST_HEAD(unmap_list); | 143 | LIST_HEAD(unmap_list); |
144 | LIST_HEAD(fmr_list); | 144 | LIST_HEAD(fmr_list); |
145 | 145 | ||
@@ -158,20 +158,6 @@ static void ib_fmr_batch_release(struct ib_fmr_pool *pool) | |||
158 | #endif | 158 | #endif |
159 | } | 159 | } |
160 | 160 | ||
161 | /* | ||
162 | * The free_list may hold FMRs that have been put there | ||
163 | * because they haven't reached the max_remap count. | ||
164 | * Invalidate their mapping as well. | ||
165 | */ | ||
166 | list_for_each_entry_safe(fmr, next, &pool->free_list, list) { | ||
167 | if (fmr->remap_count == 0) | ||
168 | continue; | ||
169 | hlist_del_init(&fmr->cache_node); | ||
170 | fmr->remap_count = 0; | ||
171 | list_add_tail(&fmr->fmr->list, &fmr_list); | ||
172 | list_move(&fmr->list, &unmap_list); | ||
173 | } | ||
174 | |||
175 | list_splice(&pool->dirty_list, &unmap_list); | 161 | list_splice(&pool->dirty_list, &unmap_list); |
176 | INIT_LIST_HEAD(&pool->dirty_list); | 162 | INIT_LIST_HEAD(&pool->dirty_list); |
177 | pool->dirty_len = 0; | 163 | pool->dirty_len = 0; |
@@ -384,6 +370,11 @@ void ib_destroy_fmr_pool(struct ib_fmr_pool *pool) | |||
384 | 370 | ||
385 | i = 0; | 371 | i = 0; |
386 | list_for_each_entry_safe(fmr, tmp, &pool->free_list, list) { | 372 | list_for_each_entry_safe(fmr, tmp, &pool->free_list, list) { |
373 | if (fmr->remap_count) { | ||
374 | INIT_LIST_HEAD(&fmr_list); | ||
375 | list_add_tail(&fmr->fmr->list, &fmr_list); | ||
376 | ib_unmap_fmr(&fmr_list); | ||
377 | } | ||
387 | ib_dealloc_fmr(fmr->fmr); | 378 | ib_dealloc_fmr(fmr->fmr); |
388 | list_del(&fmr->list); | 379 | list_del(&fmr->list); |
389 | kfree(fmr); | 380 | kfree(fmr); |
@@ -407,8 +398,23 @@ EXPORT_SYMBOL(ib_destroy_fmr_pool); | |||
407 | */ | 398 | */ |
408 | int ib_flush_fmr_pool(struct ib_fmr_pool *pool) | 399 | int ib_flush_fmr_pool(struct ib_fmr_pool *pool) |
409 | { | 400 | { |
410 | int serial = atomic_inc_return(&pool->req_ser); | 401 | int serial; |
402 | struct ib_pool_fmr *fmr, *next; | ||
403 | |||
404 | /* | ||
405 | * The free_list holds FMRs that may have been used | ||
406 | * but have not been remapped enough times to be dirty. | ||
407 | * Put them on the dirty list now so that the cleanup | ||
408 | * thread will reap them too. | ||
409 | */ | ||
410 | spin_lock_irq(&pool->pool_lock); | ||
411 | list_for_each_entry_safe(fmr, next, &pool->free_list, list) { | ||
412 | if (fmr->remap_count > 0) | ||
413 | list_move(&fmr->list, &pool->dirty_list); | ||
414 | } | ||
415 | spin_unlock_irq(&pool->pool_lock); | ||
411 | 416 | ||
417 | serial = atomic_inc_return(&pool->req_ser); | ||
412 | wake_up_process(pool->thread); | 418 | wake_up_process(pool->thread); |
413 | 419 | ||
414 | if (wait_event_interruptible(pool->force_wait, | 420 | if (wait_event_interruptible(pool->force_wait, |
diff --git a/drivers/infiniband/core/iwcm.c b/drivers/infiniband/core/iwcm.c index 223b1aa7d92b..81c9195b512a 100644 --- a/drivers/infiniband/core/iwcm.c +++ b/drivers/infiniband/core/iwcm.c | |||
@@ -839,6 +839,7 @@ static void cm_work_handler(struct work_struct *_work) | |||
839 | unsigned long flags; | 839 | unsigned long flags; |
840 | int empty; | 840 | int empty; |
841 | int ret = 0; | 841 | int ret = 0; |
842 | int destroy_id; | ||
842 | 843 | ||
843 | spin_lock_irqsave(&cm_id_priv->lock, flags); | 844 | spin_lock_irqsave(&cm_id_priv->lock, flags); |
844 | empty = list_empty(&cm_id_priv->work_list); | 845 | empty = list_empty(&cm_id_priv->work_list); |
@@ -857,9 +858,9 @@ static void cm_work_handler(struct work_struct *_work) | |||
857 | destroy_cm_id(&cm_id_priv->id); | 858 | destroy_cm_id(&cm_id_priv->id); |
858 | } | 859 | } |
859 | BUG_ON(atomic_read(&cm_id_priv->refcount)==0); | 860 | BUG_ON(atomic_read(&cm_id_priv->refcount)==0); |
861 | destroy_id = test_bit(IWCM_F_CALLBACK_DESTROY, &cm_id_priv->flags); | ||
860 | if (iwcm_deref_id(cm_id_priv)) { | 862 | if (iwcm_deref_id(cm_id_priv)) { |
861 | if (test_bit(IWCM_F_CALLBACK_DESTROY, | 863 | if (destroy_id) { |
862 | &cm_id_priv->flags)) { | ||
863 | BUG_ON(!list_empty(&cm_id_priv->work_list)); | 864 | BUG_ON(!list_empty(&cm_id_priv->work_list)); |
864 | free_cm_id(cm_id_priv); | 865 | free_cm_id(cm_id_priv); |
865 | } | 866 | } |
diff --git a/drivers/infiniband/hw/cxgb3/iwch_provider.c b/drivers/infiniband/hw/cxgb3/iwch_provider.c index df1838f8f94d..b2ea9210467f 100644 --- a/drivers/infiniband/hw/cxgb3/iwch_provider.c +++ b/drivers/infiniband/hw/cxgb3/iwch_provider.c | |||
@@ -189,7 +189,7 @@ static struct ib_cq *iwch_create_cq(struct ib_device *ibdev, int entries, int ve | |||
189 | return ERR_PTR(-ENOMEM); | 189 | return ERR_PTR(-ENOMEM); |
190 | } | 190 | } |
191 | chp->rhp = rhp; | 191 | chp->rhp = rhp; |
192 | chp->ibcq.cqe = (1 << chp->cq.size_log2) - 1; | 192 | chp->ibcq.cqe = 1 << chp->cq.size_log2; |
193 | spin_lock_init(&chp->lock); | 193 | spin_lock_init(&chp->lock); |
194 | atomic_set(&chp->refcnt, 1); | 194 | atomic_set(&chp->refcnt, 1); |
195 | init_waitqueue_head(&chp->wait); | 195 | init_waitqueue_head(&chp->wait); |
@@ -819,8 +819,11 @@ static struct ib_qp *iwch_create_qp(struct ib_pd *pd, | |||
819 | kfree(qhp); | 819 | kfree(qhp); |
820 | return ERR_PTR(-ENOMEM); | 820 | return ERR_PTR(-ENOMEM); |
821 | } | 821 | } |
822 | |||
822 | attrs->cap.max_recv_wr = rqsize - 1; | 823 | attrs->cap.max_recv_wr = rqsize - 1; |
823 | attrs->cap.max_send_wr = sqsize; | 824 | attrs->cap.max_send_wr = sqsize; |
825 | attrs->cap.max_inline_data = T3_MAX_INLINE; | ||
826 | |||
824 | qhp->rhp = rhp; | 827 | qhp->rhp = rhp; |
825 | qhp->attr.pd = php->pdid; | 828 | qhp->attr.pd = php->pdid; |
826 | qhp->attr.scq = ((struct iwch_cq *) attrs->send_cq)->cq.cqid; | 829 | qhp->attr.scq = ((struct iwch_cq *) attrs->send_cq)->cq.cqid; |
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/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/infiniband/ulp/iser/iser_verbs.c b/drivers/infiniband/ulp/iser/iser_verbs.c index 714b8db02b29..993f0a8ff28f 100644 --- a/drivers/infiniband/ulp/iser/iser_verbs.c +++ b/drivers/infiniband/ulp/iser/iser_verbs.c | |||
@@ -237,36 +237,32 @@ static int iser_free_ib_conn_res(struct iser_conn *ib_conn) | |||
237 | static | 237 | static |
238 | struct iser_device *iser_device_find_by_ib_device(struct rdma_cm_id *cma_id) | 238 | struct iser_device *iser_device_find_by_ib_device(struct rdma_cm_id *cma_id) |
239 | { | 239 | { |
240 | struct list_head *p_list; | 240 | struct iser_device *device; |
241 | struct iser_device *device = NULL; | ||
242 | 241 | ||
243 | mutex_lock(&ig.device_list_mutex); | 242 | mutex_lock(&ig.device_list_mutex); |
244 | 243 | ||
245 | p_list = ig.device_list.next; | 244 | list_for_each_entry(device, &ig.device_list, ig_list) |
246 | while (p_list != &ig.device_list) { | ||
247 | device = list_entry(p_list, struct iser_device, ig_list); | ||
248 | /* find if there's a match using the node GUID */ | 245 | /* find if there's a match using the node GUID */ |
249 | if (device->ib_device->node_guid == cma_id->device->node_guid) | 246 | if (device->ib_device->node_guid == cma_id->device->node_guid) |
250 | break; | 247 | goto inc_refcnt; |
251 | } | ||
252 | 248 | ||
253 | if (device == NULL) { | 249 | device = kzalloc(sizeof *device, GFP_KERNEL); |
254 | device = kzalloc(sizeof *device, GFP_KERNEL); | 250 | if (device == NULL) |
255 | if (device == NULL) | 251 | goto out; |
256 | goto out; | 252 | |
257 | /* assign this device to the device */ | 253 | /* assign this device to the device */ |
258 | device->ib_device = cma_id->device; | 254 | device->ib_device = cma_id->device; |
259 | /* init the device and link it into ig device list */ | 255 | /* init the device and link it into ig device list */ |
260 | if (iser_create_device_ib_res(device)) { | 256 | if (iser_create_device_ib_res(device)) { |
261 | kfree(device); | 257 | kfree(device); |
262 | device = NULL; | 258 | device = NULL; |
263 | goto out; | 259 | goto out; |
264 | } | ||
265 | list_add(&device->ig_list, &ig.device_list); | ||
266 | } | 260 | } |
267 | out: | 261 | list_add(&device->ig_list, &ig.device_list); |
268 | BUG_ON(device == NULL); | 262 | |
263 | inc_refcnt: | ||
269 | device->refcount++; | 264 | device->refcount++; |
265 | out: | ||
270 | mutex_unlock(&ig.device_list_mutex); | 266 | mutex_unlock(&ig.device_list_mutex); |
271 | return device; | 267 | return device; |
272 | } | 268 | } |
@@ -372,6 +368,12 @@ static void iser_addr_handler(struct rdma_cm_id *cma_id) | |||
372 | int ret; | 368 | int ret; |
373 | 369 | ||
374 | device = iser_device_find_by_ib_device(cma_id); | 370 | device = iser_device_find_by_ib_device(cma_id); |
371 | if (!device) { | ||
372 | iser_err("device lookup/creation failed\n"); | ||
373 | iser_connect_error(cma_id); | ||
374 | return; | ||
375 | } | ||
376 | |||
375 | ib_conn = (struct iser_conn *)cma_id->context; | 377 | ib_conn = (struct iser_conn *)cma_id->context; |
376 | ib_conn->device = device; | 378 | ib_conn->device = device; |
377 | 379 | ||
@@ -380,7 +382,6 @@ static void iser_addr_handler(struct rdma_cm_id *cma_id) | |||
380 | iser_err("resolve route failed: %d\n", ret); | 382 | iser_err("resolve route failed: %d\n", ret); |
381 | iser_connect_error(cma_id); | 383 | iser_connect_error(cma_id); |
382 | } | 384 | } |
383 | return; | ||
384 | } | 385 | } |
385 | 386 | ||
386 | static void iser_route_handler(struct rdma_cm_id *cma_id) | 387 | static void iser_route_handler(struct rdma_cm_id *cma_id) |
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 dd22d91f8b39..cbc1beb66574 100644 --- a/drivers/input/serio/i8042.h +++ b/drivers/input/serio/i8042.h | |||
@@ -16,8 +16,10 @@ | |||
16 | 16 | ||
17 | #if defined(CONFIG_MACH_JAZZ) | 17 | #if defined(CONFIG_MACH_JAZZ) |
18 | #include "i8042-jazzio.h" | 18 | #include "i8042-jazzio.h" |
19 | #elif defined(CONFIG_SGI_IP22) | 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/isdn/i4l/isdn_common.c b/drivers/isdn/i4l/isdn_common.c index 9cef6fcf587b..d4ad6992f776 100644 --- a/drivers/isdn/i4l/isdn_common.c +++ b/drivers/isdn/i4l/isdn_common.c | |||
@@ -981,13 +981,13 @@ isdn_readbchan_tty(int di, int channel, struct tty_struct *tty, int cisco_hack) | |||
981 | } | 981 | } |
982 | 982 | ||
983 | 983 | ||
984 | static __inline int | 984 | static inline int |
985 | isdn_minor2drv(int minor) | 985 | isdn_minor2drv(int minor) |
986 | { | 986 | { |
987 | return (dev->drvmap[minor]); | 987 | return (dev->drvmap[minor]); |
988 | } | 988 | } |
989 | 989 | ||
990 | static __inline int | 990 | static inline int |
991 | isdn_minor2chan(int minor) | 991 | isdn_minor2chan(int minor) |
992 | { | 992 | { |
993 | return (dev->chanmap[minor]); | 993 | return (dev->chanmap[minor]); |
diff --git a/drivers/isdn/i4l/isdn_v110.c b/drivers/isdn/i4l/isdn_v110.c index 5484d3c38a57..c5d02b6aafab 100644 --- a/drivers/isdn/i4l/isdn_v110.c +++ b/drivers/isdn/i4l/isdn_v110.c | |||
@@ -62,7 +62,7 @@ static unsigned char V110_OffMatrix_38400[] = | |||
62 | * and to 67452301 when keylen = 2. This is necessary because ordering on | 62 | * and to 67452301 when keylen = 2. This is necessary because ordering on |
63 | * the isdn line is the other way. | 63 | * the isdn line is the other way. |
64 | */ | 64 | */ |
65 | static __inline unsigned char | 65 | static inline unsigned char |
66 | FlipBits(unsigned char c, int keylen) | 66 | FlipBits(unsigned char c, int keylen) |
67 | { | 67 | { |
68 | unsigned char b = c; | 68 | unsigned char b = c; |
diff --git a/drivers/lguest/core.c b/drivers/lguest/core.c index 7743d73768df..c632c08cbbdc 100644 --- a/drivers/lguest/core.c +++ b/drivers/lguest/core.c | |||
@@ -69,11 +69,22 @@ static __init int map_switcher(void) | |||
69 | switcher_page[i] = virt_to_page(addr); | 69 | switcher_page[i] = virt_to_page(addr); |
70 | } | 70 | } |
71 | 71 | ||
72 | /* First we check that the Switcher won't overlap the fixmap area at | ||
73 | * the top of memory. It's currently nowhere near, but it could have | ||
74 | * very strange effects if it ever happened. */ | ||
75 | if (SWITCHER_ADDR + (TOTAL_SWITCHER_PAGES+1)*PAGE_SIZE > FIXADDR_START){ | ||
76 | err = -ENOMEM; | ||
77 | printk("lguest: mapping switcher would thwack fixmap\n"); | ||
78 | goto free_pages; | ||
79 | } | ||
80 | |||
72 | /* Now we reserve the "virtual memory area" we want: 0xFFC00000 | 81 | /* Now we reserve the "virtual memory area" we want: 0xFFC00000 |
73 | * (SWITCHER_ADDR). We might not get it in theory, but in practice | 82 | * (SWITCHER_ADDR). We might not get it in theory, but in practice |
74 | * it's worked so far. */ | 83 | * it's worked so far. The end address needs +1 because __get_vm_area |
84 | * allocates an extra guard page, so we need space for that. */ | ||
75 | switcher_vma = __get_vm_area(TOTAL_SWITCHER_PAGES * PAGE_SIZE, | 85 | switcher_vma = __get_vm_area(TOTAL_SWITCHER_PAGES * PAGE_SIZE, |
76 | VM_ALLOC, SWITCHER_ADDR, VMALLOC_END); | 86 | VM_ALLOC, SWITCHER_ADDR, SWITCHER_ADDR |
87 | + (TOTAL_SWITCHER_PAGES+1) * PAGE_SIZE); | ||
77 | if (!switcher_vma) { | 88 | if (!switcher_vma) { |
78 | err = -ENOMEM; | 89 | err = -ENOMEM; |
79 | printk("lguest: could not map switcher pages high\n"); | 90 | printk("lguest: could not map switcher pages high\n"); |
diff --git a/drivers/lguest/lguest_user.c b/drivers/lguest/lguest_user.c index 85d42d3d01a9..2221485b0773 100644 --- a/drivers/lguest/lguest_user.c +++ b/drivers/lguest/lguest_user.c | |||
@@ -241,15 +241,16 @@ static ssize_t write(struct file *file, const char __user *in, | |||
241 | cpu = &lg->cpus[cpu_id]; | 241 | cpu = &lg->cpus[cpu_id]; |
242 | if (!cpu) | 242 | if (!cpu) |
243 | return -EINVAL; | 243 | return -EINVAL; |
244 | } | ||
245 | 244 | ||
246 | /* Once the Guest is dead, all you can do is read() why it died. */ | 245 | /* Once the Guest is dead, you can only read() why it died. */ |
247 | if (lg && lg->dead) | 246 | if (lg->dead) |
248 | return -ENOENT; | 247 | return -ENOENT; |
249 | 248 | ||
250 | /* If you're not the task which owns the Guest, you can only break */ | 249 | /* If you're not the task which owns the Guest, all you can do |
251 | if (lg && current != cpu->tsk && req != LHREQ_BREAK) | 250 | * is break the Launcher out of running the Guest. */ |
252 | return -EPERM; | 251 | if (current != cpu->tsk && req != LHREQ_BREAK) |
252 | return -EPERM; | ||
253 | } | ||
253 | 254 | ||
254 | switch (req) { | 255 | switch (req) { |
255 | case LHREQ_INITIALIZE: | 256 | case LHREQ_INITIALIZE: |
diff --git a/drivers/lguest/page_tables.c b/drivers/lguest/page_tables.c index 275f23c2deb4..a7f64a9d67e0 100644 --- a/drivers/lguest/page_tables.c +++ b/drivers/lguest/page_tables.c | |||
@@ -391,7 +391,7 @@ static unsigned int find_pgdir(struct lguest *lg, unsigned long pgtable) | |||
391 | { | 391 | { |
392 | unsigned int i; | 392 | unsigned int i; |
393 | for (i = 0; i < ARRAY_SIZE(lg->pgdirs); i++) | 393 | for (i = 0; i < ARRAY_SIZE(lg->pgdirs); i++) |
394 | if (lg->pgdirs[i].gpgdir == pgtable) | 394 | if (lg->pgdirs[i].pgdir && lg->pgdirs[i].gpgdir == pgtable) |
395 | break; | 395 | break; |
396 | return i; | 396 | return i; |
397 | } | 397 | } |
diff --git a/drivers/macintosh/via-pmu-backlight.c b/drivers/macintosh/via-pmu-backlight.c index 741a2e3f4fc6..a348bb0791d3 100644 --- a/drivers/macintosh/via-pmu-backlight.c +++ b/drivers/macintosh/via-pmu-backlight.c | |||
@@ -17,7 +17,7 @@ | |||
17 | 17 | ||
18 | static struct backlight_ops pmu_backlight_data; | 18 | static struct backlight_ops pmu_backlight_data; |
19 | static DEFINE_SPINLOCK(pmu_backlight_lock); | 19 | static DEFINE_SPINLOCK(pmu_backlight_lock); |
20 | static int sleeping; | 20 | static int sleeping, uses_pmu_bl; |
21 | static u8 bl_curve[FB_BACKLIGHT_LEVELS]; | 21 | static u8 bl_curve[FB_BACKLIGHT_LEVELS]; |
22 | 22 | ||
23 | static void pmu_backlight_init_curve(u8 off, u8 min, u8 max) | 23 | static void pmu_backlight_init_curve(u8 off, u8 min, u8 max) |
@@ -128,7 +128,7 @@ void pmu_backlight_set_sleep(int sleep) | |||
128 | 128 | ||
129 | spin_lock_irqsave(&pmu_backlight_lock, flags); | 129 | spin_lock_irqsave(&pmu_backlight_lock, flags); |
130 | sleeping = sleep; | 130 | sleeping = sleep; |
131 | if (pmac_backlight) { | 131 | if (pmac_backlight && uses_pmu_bl) { |
132 | if (sleep) { | 132 | if (sleep) { |
133 | struct adb_request req; | 133 | struct adb_request req; |
134 | 134 | ||
@@ -166,6 +166,7 @@ void __init pmu_backlight_init() | |||
166 | printk(KERN_ERR "PMU Backlight registration failed\n"); | 166 | printk(KERN_ERR "PMU Backlight registration failed\n"); |
167 | return; | 167 | return; |
168 | } | 168 | } |
169 | uses_pmu_bl = 1; | ||
169 | bd->props.max_brightness = FB_BACKLIGHT_LEVELS - 1; | 170 | bd->props.max_brightness = FB_BACKLIGHT_LEVELS - 1; |
170 | pmu_backlight_init_curve(0x7F, 0x46, 0x0E); | 171 | pmu_backlight_init_curve(0x7F, 0x46, 0x0E); |
171 | 172 | ||
diff --git a/drivers/macintosh/via-pmu.c b/drivers/macintosh/via-pmu.c index ebec663d5d37..d6365a9f0637 100644 --- a/drivers/macintosh/via-pmu.c +++ b/drivers/macintosh/via-pmu.c | |||
@@ -2528,7 +2528,7 @@ EXPORT_SYMBOL(pmu_wait_complete); | |||
2528 | EXPORT_SYMBOL(pmu_suspend); | 2528 | EXPORT_SYMBOL(pmu_suspend); |
2529 | EXPORT_SYMBOL(pmu_resume); | 2529 | EXPORT_SYMBOL(pmu_resume); |
2530 | EXPORT_SYMBOL(pmu_unlock); | 2530 | EXPORT_SYMBOL(pmu_unlock); |
2531 | #if defined(CONFIG_SUSPEND) && defined(CONFIG_PPC32) | 2531 | #if defined(CONFIG_PPC32) |
2532 | EXPORT_SYMBOL(pmu_enable_irled); | 2532 | EXPORT_SYMBOL(pmu_enable_irled); |
2533 | EXPORT_SYMBOL(pmu_battery_count); | 2533 | EXPORT_SYMBOL(pmu_battery_count); |
2534 | EXPORT_SYMBOL(pmu_batteries); | 2534 | EXPORT_SYMBOL(pmu_batteries); |
diff --git a/drivers/md/bitmap.c b/drivers/md/bitmap.c index 831aed9c56ff..c14dacdacfac 100644 --- a/drivers/md/bitmap.c +++ b/drivers/md/bitmap.c | |||
@@ -1045,7 +1045,8 @@ void bitmap_daemon_work(struct bitmap *bitmap) | |||
1045 | if (bitmap == NULL) | 1045 | if (bitmap == NULL) |
1046 | return; | 1046 | return; |
1047 | if (time_before(jiffies, bitmap->daemon_lastrun + bitmap->daemon_sleep*HZ)) | 1047 | if (time_before(jiffies, bitmap->daemon_lastrun + bitmap->daemon_sleep*HZ)) |
1048 | return; | 1048 | goto done; |
1049 | |||
1049 | bitmap->daemon_lastrun = jiffies; | 1050 | bitmap->daemon_lastrun = jiffies; |
1050 | if (bitmap->allclean) { | 1051 | if (bitmap->allclean) { |
1051 | bitmap->mddev->thread->timeout = MAX_SCHEDULE_TIMEOUT; | 1052 | bitmap->mddev->thread->timeout = MAX_SCHEDULE_TIMEOUT; |
@@ -1142,6 +1143,7 @@ void bitmap_daemon_work(struct bitmap *bitmap) | |||
1142 | } | 1143 | } |
1143 | } | 1144 | } |
1144 | 1145 | ||
1146 | done: | ||
1145 | if (bitmap->allclean == 0) | 1147 | if (bitmap->allclean == 0) |
1146 | bitmap->mddev->thread->timeout = bitmap->daemon_sleep * HZ; | 1148 | bitmap->mddev->thread->timeout = bitmap->daemon_sleep * HZ; |
1147 | } | 1149 | } |
diff --git a/drivers/md/md.c b/drivers/md/md.c index 827824a9f3e9..ccbbf63727cc 100644 --- a/drivers/md/md.c +++ b/drivers/md/md.c | |||
@@ -5149,7 +5149,7 @@ static int md_seq_show(struct seq_file *seq, void *v) | |||
5149 | if (mddev->ro==1) | 5149 | if (mddev->ro==1) |
5150 | seq_printf(seq, " (read-only)"); | 5150 | seq_printf(seq, " (read-only)"); |
5151 | if (mddev->ro==2) | 5151 | if (mddev->ro==2) |
5152 | seq_printf(seq, "(auto-read-only)"); | 5152 | seq_printf(seq, " (auto-read-only)"); |
5153 | seq_printf(seq, " %s", mddev->pers->name); | 5153 | seq_printf(seq, " %s", mddev->pers->name); |
5154 | } | 5154 | } |
5155 | 5155 | ||
diff --git a/drivers/memstick/Kconfig b/drivers/memstick/Kconfig index 1093fdb07297..f0ca41c20323 100644 --- a/drivers/memstick/Kconfig +++ b/drivers/memstick/Kconfig | |||
@@ -8,7 +8,7 @@ menuconfig MEMSTICK | |||
8 | Sony MemoryStick is a proprietary storage/extension card protocol. | 8 | Sony MemoryStick is a proprietary storage/extension card protocol. |
9 | 9 | ||
10 | If you want MemoryStick support, you should say Y here and also | 10 | If you want MemoryStick support, you should say Y here and also |
11 | to the specific driver for your MMC interface. | 11 | to the specific driver for your MemoryStick interface. |
12 | 12 | ||
13 | if MEMSTICK | 13 | if MEMSTICK |
14 | 14 | ||
diff --git a/drivers/memstick/core/memstick.c b/drivers/memstick/core/memstick.c index bba467fe4bce..de80dba12f9b 100644 --- a/drivers/memstick/core/memstick.c +++ b/drivers/memstick/core/memstick.c | |||
@@ -18,7 +18,6 @@ | |||
18 | #include <linux/delay.h> | 18 | #include <linux/delay.h> |
19 | 19 | ||
20 | #define DRIVER_NAME "memstick" | 20 | #define DRIVER_NAME "memstick" |
21 | #define DRIVER_VERSION "0.2" | ||
22 | 21 | ||
23 | static unsigned int cmd_retries = 3; | 22 | static unsigned int cmd_retries = 3; |
24 | module_param(cmd_retries, uint, 0644); | 23 | module_param(cmd_retries, uint, 0644); |
@@ -236,7 +235,7 @@ int memstick_next_req(struct memstick_host *host, struct memstick_request **mrq) | |||
236 | rc = host->card->next_request(host->card, mrq); | 235 | rc = host->card->next_request(host->card, mrq); |
237 | 236 | ||
238 | if (!rc) | 237 | if (!rc) |
239 | host->retries = cmd_retries; | 238 | host->retries = cmd_retries > 1 ? cmd_retries - 1 : 1; |
240 | else | 239 | else |
241 | *mrq = NULL; | 240 | *mrq = NULL; |
242 | 241 | ||
@@ -271,7 +270,7 @@ void memstick_init_req_sg(struct memstick_request *mrq, unsigned char tpc, | |||
271 | mrq->data_dir = READ; | 270 | mrq->data_dir = READ; |
272 | 271 | ||
273 | mrq->sg = *sg; | 272 | mrq->sg = *sg; |
274 | mrq->io_type = MEMSTICK_IO_SG; | 273 | mrq->long_data = 1; |
275 | 274 | ||
276 | if (tpc == MS_TPC_SET_CMD || tpc == MS_TPC_EX_SET_CMD) | 275 | if (tpc == MS_TPC_SET_CMD || tpc == MS_TPC_EX_SET_CMD) |
277 | mrq->need_card_int = 1; | 276 | mrq->need_card_int = 1; |
@@ -306,7 +305,7 @@ void memstick_init_req(struct memstick_request *mrq, unsigned char tpc, | |||
306 | if (mrq->data_dir == WRITE) | 305 | if (mrq->data_dir == WRITE) |
307 | memcpy(mrq->data, buf, mrq->data_len); | 306 | memcpy(mrq->data, buf, mrq->data_len); |
308 | 307 | ||
309 | mrq->io_type = MEMSTICK_IO_VAL; | 308 | mrq->long_data = 0; |
310 | 309 | ||
311 | if (tpc == MS_TPC_SET_CMD || tpc == MS_TPC_EX_SET_CMD) | 310 | if (tpc == MS_TPC_SET_CMD || tpc == MS_TPC_EX_SET_CMD) |
312 | mrq->need_card_int = 1; | 311 | mrq->need_card_int = 1; |
@@ -561,6 +560,31 @@ void memstick_free_host(struct memstick_host *host) | |||
561 | } | 560 | } |
562 | EXPORT_SYMBOL(memstick_free_host); | 561 | EXPORT_SYMBOL(memstick_free_host); |
563 | 562 | ||
563 | /** | ||
564 | * memstick_suspend_host - notify bus driver of host suspension | ||
565 | * @host - host to use | ||
566 | */ | ||
567 | void memstick_suspend_host(struct memstick_host *host) | ||
568 | { | ||
569 | mutex_lock(&host->lock); | ||
570 | host->set_param(host, MEMSTICK_POWER, MEMSTICK_POWER_OFF); | ||
571 | mutex_unlock(&host->lock); | ||
572 | } | ||
573 | EXPORT_SYMBOL(memstick_suspend_host); | ||
574 | |||
575 | /** | ||
576 | * memstick_resume_host - notify bus driver of host resumption | ||
577 | * @host - host to use | ||
578 | */ | ||
579 | void memstick_resume_host(struct memstick_host *host) | ||
580 | { | ||
581 | mutex_lock(&host->lock); | ||
582 | host->set_param(host, MEMSTICK_POWER, MEMSTICK_POWER_ON); | ||
583 | mutex_unlock(&host->lock); | ||
584 | memstick_detect_change(host); | ||
585 | } | ||
586 | EXPORT_SYMBOL(memstick_resume_host); | ||
587 | |||
564 | int memstick_register_driver(struct memstick_driver *drv) | 588 | int memstick_register_driver(struct memstick_driver *drv) |
565 | { | 589 | { |
566 | drv->driver.bus = &memstick_bus_type; | 590 | drv->driver.bus = &memstick_bus_type; |
@@ -611,4 +635,3 @@ module_exit(memstick_exit); | |||
611 | MODULE_AUTHOR("Alex Dubov"); | 635 | MODULE_AUTHOR("Alex Dubov"); |
612 | MODULE_LICENSE("GPL"); | 636 | MODULE_LICENSE("GPL"); |
613 | MODULE_DESCRIPTION("Sony MemoryStick core driver"); | 637 | MODULE_DESCRIPTION("Sony MemoryStick core driver"); |
614 | MODULE_VERSION(DRIVER_VERSION); | ||
diff --git a/drivers/memstick/core/mspro_block.c b/drivers/memstick/core/mspro_block.c index 423ad8cf4bb9..1d637e4561d3 100644 --- a/drivers/memstick/core/mspro_block.c +++ b/drivers/memstick/core/mspro_block.c | |||
@@ -16,10 +16,10 @@ | |||
16 | #include <linux/idr.h> | 16 | #include <linux/idr.h> |
17 | #include <linux/hdreg.h> | 17 | #include <linux/hdreg.h> |
18 | #include <linux/kthread.h> | 18 | #include <linux/kthread.h> |
19 | #include <linux/delay.h> | ||
19 | #include <linux/memstick.h> | 20 | #include <linux/memstick.h> |
20 | 21 | ||
21 | #define DRIVER_NAME "mspro_block" | 22 | #define DRIVER_NAME "mspro_block" |
22 | #define DRIVER_VERSION "0.2" | ||
23 | 23 | ||
24 | static int major; | 24 | static int major; |
25 | module_param(major, int, 0644); | 25 | module_param(major, int, 0644); |
@@ -110,6 +110,17 @@ struct mspro_mbr { | |||
110 | unsigned int sectors_per_partition; | 110 | unsigned int sectors_per_partition; |
111 | } __attribute__((packed)); | 111 | } __attribute__((packed)); |
112 | 112 | ||
113 | struct mspro_specfile { | ||
114 | char name[8]; | ||
115 | char ext[3]; | ||
116 | unsigned char attr; | ||
117 | unsigned char reserved[10]; | ||
118 | unsigned short time; | ||
119 | unsigned short date; | ||
120 | unsigned short cluster; | ||
121 | unsigned int size; | ||
122 | } __attribute__((packed)); | ||
123 | |||
113 | struct mspro_devinfo { | 124 | struct mspro_devinfo { |
114 | unsigned short cylinders; | 125 | unsigned short cylinders; |
115 | unsigned short heads; | 126 | unsigned short heads; |
@@ -293,6 +304,20 @@ static ssize_t mspro_block_attr_show_sysinfo(struct device *dev, | |||
293 | dev_attr); | 304 | dev_attr); |
294 | struct mspro_sys_info *x_sys = x_attr->data; | 305 | struct mspro_sys_info *x_sys = x_attr->data; |
295 | ssize_t rc = 0; | 306 | ssize_t rc = 0; |
307 | int date_tz = 0, date_tz_f = 0; | ||
308 | |||
309 | if (x_sys->assembly_date[0] > 0x80U) { | ||
310 | date_tz = (~x_sys->assembly_date[0]) + 1; | ||
311 | date_tz_f = date_tz & 3; | ||
312 | date_tz >>= 2; | ||
313 | date_tz = -date_tz; | ||
314 | date_tz_f *= 15; | ||
315 | } else if (x_sys->assembly_date[0] < 0x80U) { | ||
316 | date_tz = x_sys->assembly_date[0]; | ||
317 | date_tz_f = date_tz & 3; | ||
318 | date_tz >>= 2; | ||
319 | date_tz_f *= 15; | ||
320 | } | ||
296 | 321 | ||
297 | rc += scnprintf(buffer + rc, PAGE_SIZE - rc, "class: %x\n", | 322 | rc += scnprintf(buffer + rc, PAGE_SIZE - rc, "class: %x\n", |
298 | x_sys->class); | 323 | x_sys->class); |
@@ -305,8 +330,8 @@ static ssize_t mspro_block_attr_show_sysinfo(struct device *dev, | |||
305 | rc += scnprintf(buffer + rc, PAGE_SIZE - rc, "page size: %x\n", | 330 | rc += scnprintf(buffer + rc, PAGE_SIZE - rc, "page size: %x\n", |
306 | be16_to_cpu(x_sys->page_size)); | 331 | be16_to_cpu(x_sys->page_size)); |
307 | rc += scnprintf(buffer + rc, PAGE_SIZE - rc, "assembly date: " | 332 | rc += scnprintf(buffer + rc, PAGE_SIZE - rc, "assembly date: " |
308 | "%d %04u-%02u-%02u %02u:%02u:%02u\n", | 333 | "GMT%+d:%d %04u-%02u-%02u %02u:%02u:%02u\n", |
309 | x_sys->assembly_date[0], | 334 | date_tz, date_tz_f, |
310 | be16_to_cpu(*(unsigned short *) | 335 | be16_to_cpu(*(unsigned short *) |
311 | &x_sys->assembly_date[1]), | 336 | &x_sys->assembly_date[1]), |
312 | x_sys->assembly_date[3], x_sys->assembly_date[4], | 337 | x_sys->assembly_date[3], x_sys->assembly_date[4], |
@@ -398,6 +423,41 @@ static ssize_t mspro_block_attr_show_mbr(struct device *dev, | |||
398 | return rc; | 423 | return rc; |
399 | } | 424 | } |
400 | 425 | ||
426 | static ssize_t mspro_block_attr_show_specfile(struct device *dev, | ||
427 | struct device_attribute *attr, | ||
428 | char *buffer) | ||
429 | { | ||
430 | struct mspro_sys_attr *x_attr = container_of(attr, | ||
431 | struct mspro_sys_attr, | ||
432 | dev_attr); | ||
433 | struct mspro_specfile *x_spfile = x_attr->data; | ||
434 | char name[9], ext[4]; | ||
435 | ssize_t rc = 0; | ||
436 | |||
437 | memcpy(name, x_spfile->name, 8); | ||
438 | name[8] = 0; | ||
439 | memcpy(ext, x_spfile->ext, 3); | ||
440 | ext[3] = 0; | ||
441 | |||
442 | rc += scnprintf(buffer + rc, PAGE_SIZE - rc, "name: %s\n", name); | ||
443 | rc += scnprintf(buffer + rc, PAGE_SIZE - rc, "ext: %s\n", ext); | ||
444 | rc += scnprintf(buffer + rc, PAGE_SIZE - rc, "attribute: %x\n", | ||
445 | x_spfile->attr); | ||
446 | rc += scnprintf(buffer + rc, PAGE_SIZE - rc, "time: %d:%d:%d\n", | ||
447 | x_spfile->time >> 11, | ||
448 | (x_spfile->time >> 5) & 0x3f, | ||
449 | (x_spfile->time & 0x1f) * 2); | ||
450 | rc += scnprintf(buffer + rc, PAGE_SIZE - rc, "date: %d-%d-%d\n", | ||
451 | (x_spfile->date >> 9) + 1980, | ||
452 | (x_spfile->date >> 5) & 0xf, | ||
453 | x_spfile->date & 0x1f); | ||
454 | rc += scnprintf(buffer + rc, PAGE_SIZE - rc, "start cluster: %x\n", | ||
455 | x_spfile->cluster); | ||
456 | rc += scnprintf(buffer + rc, PAGE_SIZE - rc, "size: %x\n", | ||
457 | x_spfile->size); | ||
458 | return rc; | ||
459 | } | ||
460 | |||
401 | static ssize_t mspro_block_attr_show_devinfo(struct device *dev, | 461 | static ssize_t mspro_block_attr_show_devinfo(struct device *dev, |
402 | struct device_attribute *attr, | 462 | struct device_attribute *attr, |
403 | char *buffer) | 463 | char *buffer) |
@@ -430,6 +490,9 @@ static sysfs_show_t mspro_block_attr_show(unsigned char tag) | |||
430 | return mspro_block_attr_show_modelname; | 490 | return mspro_block_attr_show_modelname; |
431 | case MSPRO_BLOCK_ID_MBR: | 491 | case MSPRO_BLOCK_ID_MBR: |
432 | return mspro_block_attr_show_mbr; | 492 | return mspro_block_attr_show_mbr; |
493 | case MSPRO_BLOCK_ID_SPECFILEVALUES1: | ||
494 | case MSPRO_BLOCK_ID_SPECFILEVALUES2: | ||
495 | return mspro_block_attr_show_specfile; | ||
433 | case MSPRO_BLOCK_ID_DEVINFO: | 496 | case MSPRO_BLOCK_ID_DEVINFO: |
434 | return mspro_block_attr_show_devinfo; | 497 | return mspro_block_attr_show_devinfo; |
435 | default: | 498 | default: |
@@ -629,7 +692,7 @@ static void mspro_block_process_request(struct memstick_dev *card, | |||
629 | param.system = msb->system; | 692 | param.system = msb->system; |
630 | param.data_count = cpu_to_be16(page_count); | 693 | param.data_count = cpu_to_be16(page_count); |
631 | param.data_address = cpu_to_be32((uint32_t)t_sec); | 694 | param.data_address = cpu_to_be32((uint32_t)t_sec); |
632 | param.cmd_param = 0; | 695 | param.tpc_param = 0; |
633 | 696 | ||
634 | msb->data_dir = rq_data_dir(req); | 697 | msb->data_dir = rq_data_dir(req); |
635 | msb->transfer_cmd = msb->data_dir == READ | 698 | msb->transfer_cmd = msb->data_dir == READ |
@@ -758,10 +821,10 @@ static int mspro_block_switch_to_parallel(struct memstick_dev *card) | |||
758 | struct memstick_host *host = card->host; | 821 | struct memstick_host *host = card->host; |
759 | struct mspro_block_data *msb = memstick_get_drvdata(card); | 822 | struct mspro_block_data *msb = memstick_get_drvdata(card); |
760 | struct mspro_param_register param = { | 823 | struct mspro_param_register param = { |
761 | .system = 0, | 824 | .system = MEMSTICK_SYS_PAR4, |
762 | .data_count = 0, | 825 | .data_count = 0, |
763 | .data_address = 0, | 826 | .data_address = 0, |
764 | .cmd_param = 0 | 827 | .tpc_param = 0 |
765 | }; | 828 | }; |
766 | 829 | ||
767 | card->next_request = h_mspro_block_req_init; | 830 | card->next_request = h_mspro_block_req_init; |
@@ -773,8 +836,8 @@ static int mspro_block_switch_to_parallel(struct memstick_dev *card) | |||
773 | if (card->current_mrq.error) | 836 | if (card->current_mrq.error) |
774 | return card->current_mrq.error; | 837 | return card->current_mrq.error; |
775 | 838 | ||
776 | msb->system = 0; | 839 | msb->system = MEMSTICK_SYS_PAR4; |
777 | host->set_param(host, MEMSTICK_INTERFACE, MEMSTICK_PARALLEL); | 840 | host->set_param(host, MEMSTICK_INTERFACE, MEMSTICK_PAR4); |
778 | 841 | ||
779 | card->next_request = h_mspro_block_req_init; | 842 | card->next_request = h_mspro_block_req_init; |
780 | msb->mrq_handler = h_mspro_block_default; | 843 | msb->mrq_handler = h_mspro_block_default; |
@@ -783,8 +846,24 @@ static int mspro_block_switch_to_parallel(struct memstick_dev *card) | |||
783 | wait_for_completion(&card->mrq_complete); | 846 | wait_for_completion(&card->mrq_complete); |
784 | 847 | ||
785 | if (card->current_mrq.error) { | 848 | if (card->current_mrq.error) { |
786 | msb->system = 0x80; | 849 | msb->system = MEMSTICK_SYS_SERIAL; |
850 | host->set_param(host, MEMSTICK_POWER, MEMSTICK_POWER_OFF); | ||
851 | msleep(1000); | ||
852 | host->set_param(host, MEMSTICK_POWER, MEMSTICK_POWER_ON); | ||
787 | host->set_param(host, MEMSTICK_INTERFACE, MEMSTICK_SERIAL); | 853 | host->set_param(host, MEMSTICK_INTERFACE, MEMSTICK_SERIAL); |
854 | |||
855 | if (memstick_set_rw_addr(card)) | ||
856 | return card->current_mrq.error; | ||
857 | |||
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 | |||
788 | return -EFAULT; | 867 | return -EFAULT; |
789 | } | 868 | } |
790 | 869 | ||
@@ -802,7 +881,7 @@ static int mspro_block_read_attributes(struct memstick_dev *card) | |||
802 | .system = msb->system, | 881 | .system = msb->system, |
803 | .data_count = cpu_to_be16(1), | 882 | .data_count = cpu_to_be16(1), |
804 | .data_address = 0, | 883 | .data_address = 0, |
805 | .cmd_param = 0 | 884 | .tpc_param = 0 |
806 | }; | 885 | }; |
807 | struct mspro_attribute *attr = NULL; | 886 | struct mspro_attribute *attr = NULL; |
808 | struct mspro_sys_attr *s_attr = NULL; | 887 | struct mspro_sys_attr *s_attr = NULL; |
@@ -922,7 +1001,7 @@ static int mspro_block_read_attributes(struct memstick_dev *card) | |||
922 | param.system = msb->system; | 1001 | param.system = msb->system; |
923 | param.data_count = cpu_to_be16((rc / msb->page_size) + 1); | 1002 | param.data_count = cpu_to_be16((rc / msb->page_size) + 1); |
924 | param.data_address = cpu_to_be32(addr / msb->page_size); | 1003 | param.data_address = cpu_to_be32(addr / msb->page_size); |
925 | param.cmd_param = 0; | 1004 | param.tpc_param = 0; |
926 | 1005 | ||
927 | sg_init_one(&msb->req_sg[0], buffer, | 1006 | sg_init_one(&msb->req_sg[0], buffer, |
928 | be16_to_cpu(param.data_count) * msb->page_size); | 1007 | be16_to_cpu(param.data_count) * msb->page_size); |
@@ -964,7 +1043,7 @@ static int mspro_block_init_card(struct memstick_dev *card) | |||
964 | struct memstick_host *host = card->host; | 1043 | struct memstick_host *host = card->host; |
965 | int rc = 0; | 1044 | int rc = 0; |
966 | 1045 | ||
967 | msb->system = 0x80; | 1046 | msb->system = MEMSTICK_SYS_SERIAL; |
968 | card->reg_addr.r_offset = offsetof(struct mspro_register, status); | 1047 | card->reg_addr.r_offset = offsetof(struct mspro_register, status); |
969 | card->reg_addr.r_length = sizeof(struct ms_status_register); | 1048 | card->reg_addr.r_length = sizeof(struct ms_status_register); |
970 | card->reg_addr.w_offset = offsetof(struct mspro_register, param); | 1049 | card->reg_addr.w_offset = offsetof(struct mspro_register, param); |
@@ -973,7 +1052,7 @@ static int mspro_block_init_card(struct memstick_dev *card) | |||
973 | if (memstick_set_rw_addr(card)) | 1052 | if (memstick_set_rw_addr(card)) |
974 | return -EIO; | 1053 | return -EIO; |
975 | 1054 | ||
976 | if (host->caps & MEMSTICK_CAP_PARALLEL) { | 1055 | if (host->caps & MEMSTICK_CAP_PAR4) { |
977 | if (mspro_block_switch_to_parallel(card)) | 1056 | if (mspro_block_switch_to_parallel(card)) |
978 | printk(KERN_WARNING "%s: could not switch to " | 1057 | printk(KERN_WARNING "%s: could not switch to " |
979 | "parallel interface\n", card->dev.bus_id); | 1058 | "parallel interface\n", card->dev.bus_id); |
@@ -1348,4 +1427,3 @@ MODULE_LICENSE("GPL"); | |||
1348 | MODULE_AUTHOR("Alex Dubov"); | 1427 | MODULE_AUTHOR("Alex Dubov"); |
1349 | MODULE_DESCRIPTION("Sony MemoryStickPro block device driver"); | 1428 | MODULE_DESCRIPTION("Sony MemoryStickPro block device driver"); |
1350 | MODULE_DEVICE_TABLE(memstick, mspro_block_id_tbl); | 1429 | MODULE_DEVICE_TABLE(memstick, mspro_block_id_tbl); |
1351 | MODULE_VERSION(DRIVER_VERSION); | ||
diff --git a/drivers/memstick/host/Kconfig b/drivers/memstick/host/Kconfig index c002fcc3c879..4ce5c8dffb68 100644 --- a/drivers/memstick/host/Kconfig +++ b/drivers/memstick/host/Kconfig | |||
@@ -20,3 +20,13 @@ config MEMSTICK_TIFM_MS | |||
20 | To compile this driver as a module, choose M here: the | 20 | To compile this driver as a module, choose M here: the |
21 | module will be called tifm_ms. | 21 | module will be called tifm_ms. |
22 | 22 | ||
23 | config MEMSTICK_JMICRON_38X | ||
24 | tristate "JMicron JMB38X MemoryStick interface support (EXPERIMENTAL)" | ||
25 | depends on EXPERIMENTAL && PCI | ||
26 | |||
27 | help | ||
28 | Say Y here if you want to be able to access MemoryStick cards with | ||
29 | the JMicron(R) JMB38X MemoryStick card reader. | ||
30 | |||
31 | To compile this driver as a module, choose M here: the | ||
32 | module will be called jmb38x_ms. | ||
diff --git a/drivers/memstick/host/Makefile b/drivers/memstick/host/Makefile index ee666380efa1..12530e4311d3 100644 --- a/drivers/memstick/host/Makefile +++ b/drivers/memstick/host/Makefile | |||
@@ -3,8 +3,8 @@ | |||
3 | # | 3 | # |
4 | 4 | ||
5 | ifeq ($(CONFIG_MEMSTICK_DEBUG),y) | 5 | ifeq ($(CONFIG_MEMSTICK_DEBUG),y) |
6 | EXTRA_CFLAGS += -DDEBUG | 6 | EXTRA_CFLAGS += -DDEBUG |
7 | endif | 7 | endif |
8 | 8 | ||
9 | obj-$(CONFIG_MEMSTICK_TIFM_MS) += tifm_ms.o | 9 | obj-$(CONFIG_MEMSTICK_TIFM_MS) += tifm_ms.o |
10 | 10 | obj-$(CONFIG_MEMSTICK_JMICRON_38X) += jmb38x_ms.o | |
diff --git a/drivers/memstick/host/jmb38x_ms.c b/drivers/memstick/host/jmb38x_ms.c new file mode 100644 index 000000000000..03fe8783b1ee --- /dev/null +++ b/drivers/memstick/host/jmb38x_ms.c | |||
@@ -0,0 +1,945 @@ | |||
1 | /* | ||
2 | * jmb38x_ms.c - JMicron jmb38x MemoryStick card reader | ||
3 | * | ||
4 | * Copyright (C) 2008 Alex Dubov <oakad@yahoo.com> | ||
5 | * | ||
6 | * This program is free software; you can redistribute it and/or modify | ||
7 | * it under the terms of the GNU General Public License version 2 as | ||
8 | * published by the Free Software Foundation. | ||
9 | * | ||
10 | */ | ||
11 | |||
12 | #include <linux/spinlock.h> | ||
13 | #include <linux/interrupt.h> | ||
14 | #include <linux/pci.h> | ||
15 | #include <linux/delay.h> | ||
16 | #include <linux/highmem.h> | ||
17 | #include <linux/memstick.h> | ||
18 | |||
19 | #define DRIVER_NAME "jmb38x_ms" | ||
20 | |||
21 | static int no_dma; | ||
22 | module_param(no_dma, bool, 0644); | ||
23 | |||
24 | enum { | ||
25 | DMA_ADDRESS = 0x00, | ||
26 | BLOCK = 0x04, | ||
27 | DMA_CONTROL = 0x08, | ||
28 | TPC_P0 = 0x0c, | ||
29 | TPC_P1 = 0x10, | ||
30 | TPC = 0x14, | ||
31 | HOST_CONTROL = 0x18, | ||
32 | DATA = 0x1c, | ||
33 | STATUS = 0x20, | ||
34 | INT_STATUS = 0x24, | ||
35 | INT_STATUS_ENABLE = 0x28, | ||
36 | INT_SIGNAL_ENABLE = 0x2c, | ||
37 | TIMER = 0x30, | ||
38 | TIMER_CONTROL = 0x34, | ||
39 | PAD_OUTPUT_ENABLE = 0x38, | ||
40 | PAD_PU_PD = 0x3c, | ||
41 | CLOCK_DELAY = 0x40, | ||
42 | ADMA_ADDRESS = 0x44, | ||
43 | CLOCK_CONTROL = 0x48, | ||
44 | LED_CONTROL = 0x4c, | ||
45 | VERSION = 0x50 | ||
46 | }; | ||
47 | |||
48 | struct jmb38x_ms_host { | ||
49 | struct jmb38x_ms *chip; | ||
50 | void __iomem *addr; | ||
51 | spinlock_t lock; | ||
52 | int id; | ||
53 | char host_id[DEVICE_ID_SIZE]; | ||
54 | int irq; | ||
55 | unsigned int block_pos; | ||
56 | unsigned long timeout_jiffies; | ||
57 | struct timer_list timer; | ||
58 | struct memstick_request *req; | ||
59 | unsigned char eject:1, | ||
60 | use_dma:1; | ||
61 | unsigned char cmd_flags; | ||
62 | unsigned char io_pos; | ||
63 | unsigned int io_word[2]; | ||
64 | }; | ||
65 | |||
66 | struct jmb38x_ms { | ||
67 | struct pci_dev *pdev; | ||
68 | int host_cnt; | ||
69 | struct memstick_host *hosts[]; | ||
70 | }; | ||
71 | |||
72 | #define BLOCK_COUNT_MASK 0xffff0000 | ||
73 | #define BLOCK_SIZE_MASK 0x00000fff | ||
74 | |||
75 | #define DMA_CONTROL_ENABLE 0x00000001 | ||
76 | |||
77 | #define TPC_DATA_SEL 0x00008000 | ||
78 | #define TPC_DIR 0x00004000 | ||
79 | #define TPC_WAIT_INT 0x00002000 | ||
80 | #define TPC_GET_INT 0x00000800 | ||
81 | #define TPC_CODE_SZ_MASK 0x00000700 | ||
82 | #define TPC_DATA_SZ_MASK 0x00000007 | ||
83 | |||
84 | #define HOST_CONTROL_RESET_REQ 0x00008000 | ||
85 | #define HOST_CONTROL_REI 0x00004000 | ||
86 | #define HOST_CONTROL_LED 0x00000400 | ||
87 | #define HOST_CONTROL_FAST_CLK 0x00000200 | ||
88 | #define HOST_CONTROL_RESET 0x00000100 | ||
89 | #define HOST_CONTROL_POWER_EN 0x00000080 | ||
90 | #define HOST_CONTROL_CLOCK_EN 0x00000040 | ||
91 | #define HOST_CONTROL_IF_SHIFT 4 | ||
92 | |||
93 | #define HOST_CONTROL_IF_SERIAL 0x0 | ||
94 | #define HOST_CONTROL_IF_PAR4 0x1 | ||
95 | #define HOST_CONTROL_IF_PAR8 0x3 | ||
96 | |||
97 | #define STATUS_HAS_MEDIA 0x00000400 | ||
98 | #define STATUS_FIFO_EMPTY 0x00000200 | ||
99 | #define STATUS_FIFO_FULL 0x00000100 | ||
100 | |||
101 | #define INT_STATUS_TPC_ERR 0x00080000 | ||
102 | #define INT_STATUS_CRC_ERR 0x00040000 | ||
103 | #define INT_STATUS_TIMER_TO 0x00020000 | ||
104 | #define INT_STATUS_HSK_TO 0x00010000 | ||
105 | #define INT_STATUS_ANY_ERR 0x00008000 | ||
106 | #define INT_STATUS_FIFO_WRDY 0x00000080 | ||
107 | #define INT_STATUS_FIFO_RRDY 0x00000040 | ||
108 | #define INT_STATUS_MEDIA_OUT 0x00000010 | ||
109 | #define INT_STATUS_MEDIA_IN 0x00000008 | ||
110 | #define INT_STATUS_DMA_BOUNDARY 0x00000004 | ||
111 | #define INT_STATUS_EOTRAN 0x00000002 | ||
112 | #define INT_STATUS_EOTPC 0x00000001 | ||
113 | |||
114 | #define INT_STATUS_ALL 0x000f801f | ||
115 | |||
116 | #define PAD_OUTPUT_ENABLE_MS 0x0F3F | ||
117 | |||
118 | #define PAD_PU_PD_OFF 0x7FFF0000 | ||
119 | #define PAD_PU_PD_ON_MS_SOCK0 0x5f8f0000 | ||
120 | #define PAD_PU_PD_ON_MS_SOCK1 0x0f0f0000 | ||
121 | |||
122 | enum { | ||
123 | CMD_READY = 0x01, | ||
124 | FIFO_READY = 0x02, | ||
125 | REG_DATA = 0x04, | ||
126 | AUTO_GET_INT = 0x08 | ||
127 | }; | ||
128 | |||
129 | static unsigned int jmb38x_ms_read_data(struct jmb38x_ms_host *host, | ||
130 | unsigned char *buf, unsigned int length) | ||
131 | { | ||
132 | unsigned int off = 0; | ||
133 | |||
134 | while (host->io_pos && length) { | ||
135 | buf[off++] = host->io_word[0] & 0xff; | ||
136 | host->io_word[0] >>= 8; | ||
137 | length--; | ||
138 | host->io_pos--; | ||
139 | } | ||
140 | |||
141 | if (!length) | ||
142 | return off; | ||
143 | |||
144 | while (!(STATUS_FIFO_EMPTY & readl(host->addr + STATUS))) { | ||
145 | if (length < 4) | ||
146 | break; | ||
147 | *(unsigned int *)(buf + off) = __raw_readl(host->addr + DATA); | ||
148 | length -= 4; | ||
149 | off += 4; | ||
150 | } | ||
151 | |||
152 | if (length | ||
153 | && !(STATUS_FIFO_EMPTY & readl(host->addr + STATUS))) { | ||
154 | host->io_word[0] = readl(host->addr + DATA); | ||
155 | for (host->io_pos = 4; host->io_pos; --host->io_pos) { | ||
156 | buf[off++] = host->io_word[0] & 0xff; | ||
157 | host->io_word[0] >>= 8; | ||
158 | length--; | ||
159 | if (!length) | ||
160 | break; | ||
161 | } | ||
162 | } | ||
163 | |||
164 | return off; | ||
165 | } | ||
166 | |||
167 | static unsigned int jmb38x_ms_read_reg_data(struct jmb38x_ms_host *host, | ||
168 | unsigned char *buf, | ||
169 | unsigned int length) | ||
170 | { | ||
171 | unsigned int off = 0; | ||
172 | |||
173 | while (host->io_pos > 4 && length) { | ||
174 | buf[off++] = host->io_word[0] & 0xff; | ||
175 | host->io_word[0] >>= 8; | ||
176 | length--; | ||
177 | host->io_pos--; | ||
178 | } | ||
179 | |||
180 | if (!length) | ||
181 | return off; | ||
182 | |||
183 | while (host->io_pos && length) { | ||
184 | buf[off++] = host->io_word[1] & 0xff; | ||
185 | host->io_word[1] >>= 8; | ||
186 | length--; | ||
187 | host->io_pos--; | ||
188 | } | ||
189 | |||
190 | return off; | ||
191 | } | ||
192 | |||
193 | static unsigned int jmb38x_ms_write_data(struct jmb38x_ms_host *host, | ||
194 | unsigned char *buf, | ||
195 | unsigned int length) | ||
196 | { | ||
197 | unsigned int off = 0; | ||
198 | |||
199 | if (host->io_pos) { | ||
200 | while (host->io_pos < 4 && length) { | ||
201 | host->io_word[0] |= buf[off++] << (host->io_pos * 8); | ||
202 | host->io_pos++; | ||
203 | length--; | ||
204 | } | ||
205 | } | ||
206 | |||
207 | if (host->io_pos == 4 | ||
208 | && !(STATUS_FIFO_FULL & readl(host->addr + STATUS))) { | ||
209 | writel(host->io_word[0], host->addr + DATA); | ||
210 | host->io_pos = 0; | ||
211 | host->io_word[0] = 0; | ||
212 | } else if (host->io_pos) { | ||
213 | return off; | ||
214 | } | ||
215 | |||
216 | if (!length) | ||
217 | return off; | ||
218 | |||
219 | while (!(STATUS_FIFO_FULL & readl(host->addr + STATUS))) { | ||
220 | if (length < 4) | ||
221 | break; | ||
222 | |||
223 | __raw_writel(*(unsigned int *)(buf + off), | ||
224 | host->addr + DATA); | ||
225 | length -= 4; | ||
226 | off += 4; | ||
227 | } | ||
228 | |||
229 | switch (length) { | ||
230 | case 3: | ||
231 | host->io_word[0] |= buf[off + 2] << 16; | ||
232 | host->io_pos++; | ||
233 | case 2: | ||
234 | host->io_word[0] |= buf[off + 1] << 8; | ||
235 | host->io_pos++; | ||
236 | case 1: | ||
237 | host->io_word[0] |= buf[off]; | ||
238 | host->io_pos++; | ||
239 | } | ||
240 | |||
241 | off += host->io_pos; | ||
242 | |||
243 | return off; | ||
244 | } | ||
245 | |||
246 | static unsigned int jmb38x_ms_write_reg_data(struct jmb38x_ms_host *host, | ||
247 | unsigned char *buf, | ||
248 | unsigned int length) | ||
249 | { | ||
250 | unsigned int off = 0; | ||
251 | |||
252 | while (host->io_pos < 4 && length) { | ||
253 | host->io_word[0] &= ~(0xff << (host->io_pos * 8)); | ||
254 | host->io_word[0] |= buf[off++] << (host->io_pos * 8); | ||
255 | host->io_pos++; | ||
256 | length--; | ||
257 | } | ||
258 | |||
259 | if (!length) | ||
260 | return off; | ||
261 | |||
262 | while (host->io_pos < 8 && length) { | ||
263 | host->io_word[1] &= ~(0xff << (host->io_pos * 8)); | ||
264 | host->io_word[1] |= buf[off++] << (host->io_pos * 8); | ||
265 | host->io_pos++; | ||
266 | length--; | ||
267 | } | ||
268 | |||
269 | return off; | ||
270 | } | ||
271 | |||
272 | static int jmb38x_ms_transfer_data(struct jmb38x_ms_host *host) | ||
273 | { | ||
274 | unsigned int length; | ||
275 | unsigned int off; | ||
276 | unsigned int t_size, p_off, p_cnt; | ||
277 | unsigned char *buf; | ||
278 | struct page *pg; | ||
279 | unsigned long flags = 0; | ||
280 | |||
281 | if (host->req->long_data) { | ||
282 | length = host->req->sg.length - host->block_pos; | ||
283 | off = host->req->sg.offset + host->block_pos; | ||
284 | } else { | ||
285 | length = host->req->data_len - host->block_pos; | ||
286 | off = 0; | ||
287 | } | ||
288 | |||
289 | while (length) { | ||
290 | if (host->req->long_data) { | ||
291 | pg = nth_page(sg_page(&host->req->sg), | ||
292 | off >> PAGE_SHIFT); | ||
293 | p_off = offset_in_page(off); | ||
294 | p_cnt = PAGE_SIZE - p_off; | ||
295 | p_cnt = min(p_cnt, length); | ||
296 | |||
297 | local_irq_save(flags); | ||
298 | buf = kmap_atomic(pg, KM_BIO_SRC_IRQ) + p_off; | ||
299 | } else { | ||
300 | buf = host->req->data + host->block_pos; | ||
301 | p_cnt = host->req->data_len - host->block_pos; | ||
302 | } | ||
303 | |||
304 | if (host->req->data_dir == WRITE) | ||
305 | t_size = !(host->cmd_flags & REG_DATA) | ||
306 | ? jmb38x_ms_write_data(host, buf, p_cnt) | ||
307 | : jmb38x_ms_write_reg_data(host, buf, p_cnt); | ||
308 | else | ||
309 | t_size = !(host->cmd_flags & REG_DATA) | ||
310 | ? jmb38x_ms_read_data(host, buf, p_cnt) | ||
311 | : jmb38x_ms_read_reg_data(host, buf, p_cnt); | ||
312 | |||
313 | if (host->req->long_data) { | ||
314 | kunmap_atomic(buf - p_off, KM_BIO_SRC_IRQ); | ||
315 | local_irq_restore(flags); | ||
316 | } | ||
317 | |||
318 | if (!t_size) | ||
319 | break; | ||
320 | host->block_pos += t_size; | ||
321 | length -= t_size; | ||
322 | off += t_size; | ||
323 | } | ||
324 | |||
325 | if (!length && host->req->data_dir == WRITE) { | ||
326 | if (host->cmd_flags & REG_DATA) { | ||
327 | writel(host->io_word[0], host->addr + TPC_P0); | ||
328 | writel(host->io_word[1], host->addr + TPC_P1); | ||
329 | } else if (host->io_pos) { | ||
330 | writel(host->io_word[0], host->addr + DATA); | ||
331 | } | ||
332 | } | ||
333 | |||
334 | return length; | ||
335 | } | ||
336 | |||
337 | static int jmb38x_ms_issue_cmd(struct memstick_host *msh) | ||
338 | { | ||
339 | struct jmb38x_ms_host *host = memstick_priv(msh); | ||
340 | unsigned char *data; | ||
341 | unsigned int data_len, cmd, t_val; | ||
342 | |||
343 | if (!(STATUS_HAS_MEDIA & readl(host->addr + STATUS))) { | ||
344 | dev_dbg(msh->cdev.dev, "no media status\n"); | ||
345 | host->req->error = -ETIME; | ||
346 | return host->req->error; | ||
347 | } | ||
348 | |||
349 | dev_dbg(msh->cdev.dev, "control %08x\n", | ||
350 | readl(host->addr + HOST_CONTROL)); | ||
351 | dev_dbg(msh->cdev.dev, "status %08x\n", readl(host->addr + INT_STATUS)); | ||
352 | dev_dbg(msh->cdev.dev, "hstatus %08x\n", readl(host->addr + STATUS)); | ||
353 | |||
354 | host->cmd_flags = 0; | ||
355 | host->block_pos = 0; | ||
356 | host->io_pos = 0; | ||
357 | host->io_word[0] = 0; | ||
358 | host->io_word[1] = 0; | ||
359 | |||
360 | cmd = host->req->tpc << 16; | ||
361 | cmd |= TPC_DATA_SEL; | ||
362 | |||
363 | if (host->req->data_dir == READ) | ||
364 | cmd |= TPC_DIR; | ||
365 | if (host->req->need_card_int) | ||
366 | cmd |= TPC_WAIT_INT; | ||
367 | if (host->req->get_int_reg) | ||
368 | cmd |= TPC_GET_INT; | ||
369 | |||
370 | data = host->req->data; | ||
371 | |||
372 | host->use_dma = !no_dma; | ||
373 | |||
374 | if (host->req->long_data) { | ||
375 | data_len = host->req->sg.length; | ||
376 | } else { | ||
377 | data_len = host->req->data_len; | ||
378 | host->use_dma = 0; | ||
379 | } | ||
380 | |||
381 | if (data_len <= 8) { | ||
382 | cmd &= ~(TPC_DATA_SEL | 0xf); | ||
383 | host->cmd_flags |= REG_DATA; | ||
384 | cmd |= data_len & 0xf; | ||
385 | host->use_dma = 0; | ||
386 | } | ||
387 | |||
388 | if (host->use_dma) { | ||
389 | if (1 != pci_map_sg(host->chip->pdev, &host->req->sg, 1, | ||
390 | host->req->data_dir == READ | ||
391 | ? PCI_DMA_FROMDEVICE | ||
392 | : PCI_DMA_TODEVICE)) { | ||
393 | host->req->error = -ENOMEM; | ||
394 | return host->req->error; | ||
395 | } | ||
396 | data_len = sg_dma_len(&host->req->sg); | ||
397 | writel(sg_dma_address(&host->req->sg), | ||
398 | host->addr + DMA_ADDRESS); | ||
399 | writel(((1 << 16) & BLOCK_COUNT_MASK) | ||
400 | | (data_len & BLOCK_SIZE_MASK), | ||
401 | host->addr + BLOCK); | ||
402 | writel(DMA_CONTROL_ENABLE, host->addr + DMA_CONTROL); | ||
403 | } else if (!(host->cmd_flags & REG_DATA)) { | ||
404 | writel(((1 << 16) & BLOCK_COUNT_MASK) | ||
405 | | (data_len & BLOCK_SIZE_MASK), | ||
406 | host->addr + BLOCK); | ||
407 | t_val = readl(host->addr + INT_STATUS_ENABLE); | ||
408 | t_val |= host->req->data_dir == READ | ||
409 | ? INT_STATUS_FIFO_RRDY | ||
410 | : INT_STATUS_FIFO_WRDY; | ||
411 | |||
412 | writel(t_val, host->addr + INT_STATUS_ENABLE); | ||
413 | writel(t_val, host->addr + INT_SIGNAL_ENABLE); | ||
414 | } else { | ||
415 | cmd &= ~(TPC_DATA_SEL | 0xf); | ||
416 | host->cmd_flags |= REG_DATA; | ||
417 | cmd |= data_len & 0xf; | ||
418 | |||
419 | if (host->req->data_dir == WRITE) { | ||
420 | jmb38x_ms_transfer_data(host); | ||
421 | writel(host->io_word[0], host->addr + TPC_P0); | ||
422 | writel(host->io_word[1], host->addr + TPC_P1); | ||
423 | } | ||
424 | } | ||
425 | |||
426 | mod_timer(&host->timer, jiffies + host->timeout_jiffies); | ||
427 | writel(HOST_CONTROL_LED | readl(host->addr + HOST_CONTROL), | ||
428 | host->addr + HOST_CONTROL); | ||
429 | host->req->error = 0; | ||
430 | |||
431 | writel(cmd, host->addr + TPC); | ||
432 | dev_dbg(msh->cdev.dev, "executing TPC %08x, len %x\n", cmd, data_len); | ||
433 | |||
434 | return 0; | ||
435 | } | ||
436 | |||
437 | static void jmb38x_ms_complete_cmd(struct memstick_host *msh, int last) | ||
438 | { | ||
439 | struct jmb38x_ms_host *host = memstick_priv(msh); | ||
440 | unsigned int t_val = 0; | ||
441 | int rc; | ||
442 | |||
443 | del_timer(&host->timer); | ||
444 | |||
445 | dev_dbg(msh->cdev.dev, "c control %08x\n", | ||
446 | readl(host->addr + HOST_CONTROL)); | ||
447 | dev_dbg(msh->cdev.dev, "c status %08x\n", | ||
448 | readl(host->addr + INT_STATUS)); | ||
449 | dev_dbg(msh->cdev.dev, "c hstatus %08x\n", readl(host->addr + STATUS)); | ||
450 | |||
451 | if (host->req->get_int_reg) { | ||
452 | t_val = readl(host->addr + TPC_P0); | ||
453 | host->req->int_reg = (t_val & 0xff); | ||
454 | } | ||
455 | |||
456 | if (host->use_dma) { | ||
457 | writel(0, host->addr + DMA_CONTROL); | ||
458 | pci_unmap_sg(host->chip->pdev, &host->req->sg, 1, | ||
459 | host->req->data_dir == READ | ||
460 | ? PCI_DMA_FROMDEVICE : PCI_DMA_TODEVICE); | ||
461 | } else { | ||
462 | t_val = readl(host->addr + INT_STATUS_ENABLE); | ||
463 | if (host->req->data_dir == READ) | ||
464 | t_val &= ~INT_STATUS_FIFO_RRDY; | ||
465 | else | ||
466 | t_val &= ~INT_STATUS_FIFO_WRDY; | ||
467 | |||
468 | writel(t_val, host->addr + INT_STATUS_ENABLE); | ||
469 | writel(t_val, host->addr + INT_SIGNAL_ENABLE); | ||
470 | } | ||
471 | |||
472 | writel((~HOST_CONTROL_LED) & readl(host->addr + HOST_CONTROL), | ||
473 | host->addr + HOST_CONTROL); | ||
474 | |||
475 | if (!last) { | ||
476 | do { | ||
477 | rc = memstick_next_req(msh, &host->req); | ||
478 | } while (!rc && jmb38x_ms_issue_cmd(msh)); | ||
479 | } else { | ||
480 | do { | ||
481 | rc = memstick_next_req(msh, &host->req); | ||
482 | if (!rc) | ||
483 | host->req->error = -ETIME; | ||
484 | } while (!rc); | ||
485 | } | ||
486 | } | ||
487 | |||
488 | static irqreturn_t jmb38x_ms_isr(int irq, void *dev_id) | ||
489 | { | ||
490 | struct memstick_host *msh = dev_id; | ||
491 | struct jmb38x_ms_host *host = memstick_priv(msh); | ||
492 | unsigned int irq_status; | ||
493 | |||
494 | spin_lock(&host->lock); | ||
495 | irq_status = readl(host->addr + INT_STATUS); | ||
496 | dev_dbg(&host->chip->pdev->dev, "irq_status = %08x\n", irq_status); | ||
497 | if (irq_status == 0 || irq_status == (~0)) { | ||
498 | spin_unlock(&host->lock); | ||
499 | return IRQ_NONE; | ||
500 | } | ||
501 | |||
502 | if (host->req) { | ||
503 | if (irq_status & INT_STATUS_ANY_ERR) { | ||
504 | if (irq_status & INT_STATUS_CRC_ERR) | ||
505 | host->req->error = -EILSEQ; | ||
506 | else | ||
507 | host->req->error = -ETIME; | ||
508 | } else { | ||
509 | if (host->use_dma) { | ||
510 | if (irq_status & INT_STATUS_EOTRAN) | ||
511 | host->cmd_flags |= FIFO_READY; | ||
512 | } else { | ||
513 | if (irq_status & (INT_STATUS_FIFO_RRDY | ||
514 | | INT_STATUS_FIFO_WRDY)) | ||
515 | jmb38x_ms_transfer_data(host); | ||
516 | |||
517 | if (irq_status & INT_STATUS_EOTRAN) { | ||
518 | jmb38x_ms_transfer_data(host); | ||
519 | host->cmd_flags |= FIFO_READY; | ||
520 | } | ||
521 | } | ||
522 | |||
523 | if (irq_status & INT_STATUS_EOTPC) { | ||
524 | host->cmd_flags |= CMD_READY; | ||
525 | if (host->cmd_flags & REG_DATA) { | ||
526 | if (host->req->data_dir == READ) { | ||
527 | host->io_word[0] | ||
528 | = readl(host->addr | ||
529 | + TPC_P0); | ||
530 | host->io_word[1] | ||
531 | = readl(host->addr | ||
532 | + TPC_P1); | ||
533 | host->io_pos = 8; | ||
534 | |||
535 | jmb38x_ms_transfer_data(host); | ||
536 | } | ||
537 | host->cmd_flags |= FIFO_READY; | ||
538 | } | ||
539 | } | ||
540 | } | ||
541 | } | ||
542 | |||
543 | if (irq_status & (INT_STATUS_MEDIA_IN | INT_STATUS_MEDIA_OUT)) { | ||
544 | dev_dbg(&host->chip->pdev->dev, "media changed\n"); | ||
545 | memstick_detect_change(msh); | ||
546 | } | ||
547 | |||
548 | writel(irq_status, host->addr + INT_STATUS); | ||
549 | |||
550 | if (host->req | ||
551 | && (((host->cmd_flags & CMD_READY) | ||
552 | && (host->cmd_flags & FIFO_READY)) | ||
553 | || host->req->error)) | ||
554 | jmb38x_ms_complete_cmd(msh, 0); | ||
555 | |||
556 | spin_unlock(&host->lock); | ||
557 | return IRQ_HANDLED; | ||
558 | } | ||
559 | |||
560 | static void jmb38x_ms_abort(unsigned long data) | ||
561 | { | ||
562 | struct memstick_host *msh = (struct memstick_host *)data; | ||
563 | struct jmb38x_ms_host *host = memstick_priv(msh); | ||
564 | unsigned long flags; | ||
565 | |||
566 | dev_dbg(&host->chip->pdev->dev, "abort\n"); | ||
567 | spin_lock_irqsave(&host->lock, flags); | ||
568 | if (host->req) { | ||
569 | host->req->error = -ETIME; | ||
570 | jmb38x_ms_complete_cmd(msh, 0); | ||
571 | } | ||
572 | spin_unlock_irqrestore(&host->lock, flags); | ||
573 | } | ||
574 | |||
575 | static void jmb38x_ms_request(struct memstick_host *msh) | ||
576 | { | ||
577 | struct jmb38x_ms_host *host = memstick_priv(msh); | ||
578 | unsigned long flags; | ||
579 | int rc; | ||
580 | |||
581 | spin_lock_irqsave(&host->lock, flags); | ||
582 | if (host->req) { | ||
583 | spin_unlock_irqrestore(&host->lock, flags); | ||
584 | BUG(); | ||
585 | return; | ||
586 | } | ||
587 | |||
588 | do { | ||
589 | rc = memstick_next_req(msh, &host->req); | ||
590 | } while (!rc && jmb38x_ms_issue_cmd(msh)); | ||
591 | spin_unlock_irqrestore(&host->lock, flags); | ||
592 | } | ||
593 | |||
594 | static void jmb38x_ms_reset(struct jmb38x_ms_host *host) | ||
595 | { | ||
596 | unsigned int host_ctl = readl(host->addr + HOST_CONTROL); | ||
597 | |||
598 | writel(host_ctl | HOST_CONTROL_RESET_REQ | HOST_CONTROL_RESET, | ||
599 | host->addr + HOST_CONTROL); | ||
600 | |||
601 | while (HOST_CONTROL_RESET_REQ | ||
602 | & (host_ctl = readl(host->addr + HOST_CONTROL))) { | ||
603 | ndelay(100); | ||
604 | dev_dbg(&host->chip->pdev->dev, "reset\n"); | ||
605 | } | ||
606 | |||
607 | writel(INT_STATUS_ALL, host->addr + INT_STATUS_ENABLE); | ||
608 | writel(INT_STATUS_ALL, host->addr + INT_SIGNAL_ENABLE); | ||
609 | |||
610 | dev_dbg(&host->chip->pdev->dev, "reset\n"); | ||
611 | } | ||
612 | |||
613 | static void jmb38x_ms_set_param(struct memstick_host *msh, | ||
614 | enum memstick_param param, | ||
615 | int value) | ||
616 | { | ||
617 | struct jmb38x_ms_host *host = memstick_priv(msh); | ||
618 | unsigned int host_ctl; | ||
619 | unsigned long flags; | ||
620 | |||
621 | spin_lock_irqsave(&host->lock, flags); | ||
622 | |||
623 | switch (param) { | ||
624 | case MEMSTICK_POWER: | ||
625 | if (value == MEMSTICK_POWER_ON) { | ||
626 | jmb38x_ms_reset(host); | ||
627 | |||
628 | writel(host->id ? PAD_PU_PD_ON_MS_SOCK1 | ||
629 | : PAD_PU_PD_ON_MS_SOCK0, | ||
630 | host->addr + PAD_PU_PD); | ||
631 | |||
632 | writel(PAD_OUTPUT_ENABLE_MS, | ||
633 | host->addr + PAD_OUTPUT_ENABLE); | ||
634 | |||
635 | host_ctl = readl(host->addr + HOST_CONTROL); | ||
636 | host_ctl |= 7; | ||
637 | writel(host_ctl | (HOST_CONTROL_POWER_EN | ||
638 | | HOST_CONTROL_CLOCK_EN), | ||
639 | host->addr + HOST_CONTROL); | ||
640 | |||
641 | dev_dbg(&host->chip->pdev->dev, "power on\n"); | ||
642 | } else if (value == MEMSTICK_POWER_OFF) { | ||
643 | writel(readl(host->addr + HOST_CONTROL) | ||
644 | & ~(HOST_CONTROL_POWER_EN | ||
645 | | HOST_CONTROL_CLOCK_EN), | ||
646 | host->addr + HOST_CONTROL); | ||
647 | writel(0, host->addr + PAD_OUTPUT_ENABLE); | ||
648 | writel(PAD_PU_PD_OFF, host->addr + PAD_PU_PD); | ||
649 | dev_dbg(&host->chip->pdev->dev, "power off\n"); | ||
650 | } | ||
651 | break; | ||
652 | 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); | ||
657 | /* host_ctl |= 7; */ | ||
658 | |||
659 | if (value == MEMSTICK_SERIAL) { | ||
660 | host_ctl &= ~HOST_CONTROL_FAST_CLK; | ||
661 | host_ctl |= HOST_CONTROL_IF_SERIAL | ||
662 | << HOST_CONTROL_IF_SHIFT; | ||
663 | host_ctl |= HOST_CONTROL_REI; | ||
664 | writel(0, host->addr + CLOCK_DELAY); | ||
665 | } else if (value == MEMSTICK_PAR4) { | ||
666 | host_ctl |= HOST_CONTROL_FAST_CLK; | ||
667 | host_ctl |= HOST_CONTROL_IF_PAR4 | ||
668 | << HOST_CONTROL_IF_SHIFT; | ||
669 | host_ctl &= ~HOST_CONTROL_REI; | ||
670 | writel(4, host->addr + CLOCK_DELAY); | ||
671 | } else if (value == MEMSTICK_PAR8) { | ||
672 | host_ctl |= HOST_CONTROL_FAST_CLK; | ||
673 | host_ctl |= HOST_CONTROL_IF_PAR8 | ||
674 | << HOST_CONTROL_IF_SHIFT; | ||
675 | host_ctl &= ~HOST_CONTROL_REI; | ||
676 | writel(4, host->addr + CLOCK_DELAY); | ||
677 | } | ||
678 | writel(host_ctl, host->addr + HOST_CONTROL); | ||
679 | break; | ||
680 | }; | ||
681 | |||
682 | spin_unlock_irqrestore(&host->lock, flags); | ||
683 | } | ||
684 | |||
685 | #ifdef CONFIG_PM | ||
686 | |||
687 | static int jmb38x_ms_suspend(struct pci_dev *dev, pm_message_t state) | ||
688 | { | ||
689 | struct jmb38x_ms *jm = pci_get_drvdata(dev); | ||
690 | int cnt; | ||
691 | |||
692 | for (cnt = 0; cnt < jm->host_cnt; ++cnt) { | ||
693 | if (!jm->hosts[cnt]) | ||
694 | break; | ||
695 | memstick_suspend_host(jm->hosts[cnt]); | ||
696 | } | ||
697 | |||
698 | pci_save_state(dev); | ||
699 | pci_enable_wake(dev, pci_choose_state(dev, state), 0); | ||
700 | pci_disable_device(dev); | ||
701 | pci_set_power_state(dev, pci_choose_state(dev, state)); | ||
702 | return 0; | ||
703 | } | ||
704 | |||
705 | static int jmb38x_ms_resume(struct pci_dev *dev) | ||
706 | { | ||
707 | struct jmb38x_ms *jm = pci_get_drvdata(dev); | ||
708 | int rc; | ||
709 | |||
710 | pci_set_power_state(dev, PCI_D0); | ||
711 | pci_restore_state(dev); | ||
712 | rc = pci_enable_device(dev); | ||
713 | if (rc) | ||
714 | return rc; | ||
715 | pci_set_master(dev); | ||
716 | |||
717 | pci_read_config_dword(dev, 0xac, &rc); | ||
718 | pci_write_config_dword(dev, 0xac, rc | 0x00470000); | ||
719 | |||
720 | for (rc = 0; rc < jm->host_cnt; ++rc) { | ||
721 | if (!jm->hosts[rc]) | ||
722 | break; | ||
723 | memstick_resume_host(jm->hosts[rc]); | ||
724 | memstick_detect_change(jm->hosts[rc]); | ||
725 | } | ||
726 | |||
727 | return 0; | ||
728 | } | ||
729 | |||
730 | #else | ||
731 | |||
732 | #define jmb38x_ms_suspend NULL | ||
733 | #define jmb38x_ms_resume NULL | ||
734 | |||
735 | #endif /* CONFIG_PM */ | ||
736 | |||
737 | static int jmb38x_ms_count_slots(struct pci_dev *pdev) | ||
738 | { | ||
739 | int cnt, rc = 0; | ||
740 | |||
741 | for (cnt = 0; cnt < PCI_ROM_RESOURCE; ++cnt) { | ||
742 | if (!(IORESOURCE_MEM & pci_resource_flags(pdev, cnt))) | ||
743 | break; | ||
744 | |||
745 | if (256 != pci_resource_len(pdev, cnt)) | ||
746 | break; | ||
747 | |||
748 | ++rc; | ||
749 | } | ||
750 | return rc; | ||
751 | } | ||
752 | |||
753 | static struct memstick_host *jmb38x_ms_alloc_host(struct jmb38x_ms *jm, int cnt) | ||
754 | { | ||
755 | struct memstick_host *msh; | ||
756 | struct jmb38x_ms_host *host; | ||
757 | |||
758 | msh = memstick_alloc_host(sizeof(struct jmb38x_ms_host), | ||
759 | &jm->pdev->dev); | ||
760 | if (!msh) | ||
761 | return NULL; | ||
762 | |||
763 | host = memstick_priv(msh); | ||
764 | host->chip = jm; | ||
765 | host->addr = ioremap(pci_resource_start(jm->pdev, cnt), | ||
766 | pci_resource_len(jm->pdev, cnt)); | ||
767 | if (!host->addr) | ||
768 | goto err_out_free; | ||
769 | |||
770 | spin_lock_init(&host->lock); | ||
771 | host->id = cnt; | ||
772 | snprintf(host->host_id, DEVICE_ID_SIZE, DRIVER_NAME ":slot%d", | ||
773 | host->id); | ||
774 | host->irq = jm->pdev->irq; | ||
775 | host->timeout_jiffies = msecs_to_jiffies(4000); | ||
776 | msh->request = jmb38x_ms_request; | ||
777 | msh->set_param = jmb38x_ms_set_param; | ||
778 | /* | ||
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; | ||
783 | |||
784 | setup_timer(&host->timer, jmb38x_ms_abort, (unsigned long)msh); | ||
785 | |||
786 | if (!request_irq(host->irq, jmb38x_ms_isr, IRQF_SHARED, host->host_id, | ||
787 | msh)) | ||
788 | return msh; | ||
789 | |||
790 | iounmap(host->addr); | ||
791 | err_out_free: | ||
792 | kfree(msh); | ||
793 | return NULL; | ||
794 | } | ||
795 | |||
796 | static void jmb38x_ms_free_host(struct memstick_host *msh) | ||
797 | { | ||
798 | struct jmb38x_ms_host *host = memstick_priv(msh); | ||
799 | |||
800 | free_irq(host->irq, msh); | ||
801 | iounmap(host->addr); | ||
802 | memstick_free_host(msh); | ||
803 | } | ||
804 | |||
805 | static int jmb38x_ms_probe(struct pci_dev *pdev, | ||
806 | const struct pci_device_id *dev_id) | ||
807 | { | ||
808 | struct jmb38x_ms *jm; | ||
809 | int pci_dev_busy = 0; | ||
810 | int rc, cnt; | ||
811 | |||
812 | rc = pci_set_dma_mask(pdev, DMA_32BIT_MASK); | ||
813 | if (rc) | ||
814 | return rc; | ||
815 | |||
816 | rc = pci_enable_device(pdev); | ||
817 | if (rc) | ||
818 | return rc; | ||
819 | |||
820 | pci_set_master(pdev); | ||
821 | |||
822 | rc = pci_request_regions(pdev, DRIVER_NAME); | ||
823 | if (rc) { | ||
824 | pci_dev_busy = 1; | ||
825 | goto err_out; | ||
826 | } | ||
827 | |||
828 | pci_read_config_dword(pdev, 0xac, &rc); | ||
829 | pci_write_config_dword(pdev, 0xac, rc | 0x00470000); | ||
830 | |||
831 | cnt = jmb38x_ms_count_slots(pdev); | ||
832 | if (!cnt) { | ||
833 | rc = -ENODEV; | ||
834 | pci_dev_busy = 1; | ||
835 | goto err_out; | ||
836 | } | ||
837 | |||
838 | jm = kzalloc(sizeof(struct jmb38x_ms) | ||
839 | + cnt * sizeof(struct memstick_host *), GFP_KERNEL); | ||
840 | if (!jm) { | ||
841 | rc = -ENOMEM; | ||
842 | goto err_out_int; | ||
843 | } | ||
844 | |||
845 | jm->pdev = pdev; | ||
846 | jm->host_cnt = cnt; | ||
847 | pci_set_drvdata(pdev, jm); | ||
848 | |||
849 | for (cnt = 0; cnt < jm->host_cnt; ++cnt) { | ||
850 | jm->hosts[cnt] = jmb38x_ms_alloc_host(jm, cnt); | ||
851 | if (!jm->hosts[cnt]) | ||
852 | break; | ||
853 | |||
854 | rc = memstick_add_host(jm->hosts[cnt]); | ||
855 | |||
856 | if (rc) { | ||
857 | jmb38x_ms_free_host(jm->hosts[cnt]); | ||
858 | jm->hosts[cnt] = NULL; | ||
859 | break; | ||
860 | } | ||
861 | } | ||
862 | |||
863 | if (cnt) | ||
864 | return 0; | ||
865 | |||
866 | rc = -ENODEV; | ||
867 | |||
868 | pci_set_drvdata(pdev, NULL); | ||
869 | kfree(jm); | ||
870 | err_out_int: | ||
871 | pci_release_regions(pdev); | ||
872 | err_out: | ||
873 | if (!pci_dev_busy) | ||
874 | pci_disable_device(pdev); | ||
875 | return rc; | ||
876 | } | ||
877 | |||
878 | static void jmb38x_ms_remove(struct pci_dev *dev) | ||
879 | { | ||
880 | struct jmb38x_ms *jm = pci_get_drvdata(dev); | ||
881 | struct jmb38x_ms_host *host; | ||
882 | int cnt; | ||
883 | unsigned long flags; | ||
884 | |||
885 | for (cnt = 0; cnt < jm->host_cnt; ++cnt) { | ||
886 | if (!jm->hosts[cnt]) | ||
887 | break; | ||
888 | |||
889 | host = memstick_priv(jm->hosts[cnt]); | ||
890 | |||
891 | writel(0, host->addr + INT_SIGNAL_ENABLE); | ||
892 | writel(0, host->addr + INT_STATUS_ENABLE); | ||
893 | mmiowb(); | ||
894 | dev_dbg(&jm->pdev->dev, "interrupts off\n"); | ||
895 | spin_lock_irqsave(&host->lock, flags); | ||
896 | if (host->req) { | ||
897 | host->req->error = -ETIME; | ||
898 | jmb38x_ms_complete_cmd(jm->hosts[cnt], 1); | ||
899 | } | ||
900 | spin_unlock_irqrestore(&host->lock, flags); | ||
901 | |||
902 | memstick_remove_host(jm->hosts[cnt]); | ||
903 | dev_dbg(&jm->pdev->dev, "host removed\n"); | ||
904 | |||
905 | jmb38x_ms_free_host(jm->hosts[cnt]); | ||
906 | } | ||
907 | |||
908 | pci_set_drvdata(dev, NULL); | ||
909 | pci_release_regions(dev); | ||
910 | pci_disable_device(dev); | ||
911 | kfree(jm); | ||
912 | } | ||
913 | |||
914 | static struct pci_device_id jmb38x_ms_id_tbl [] = { | ||
915 | { PCI_VENDOR_ID_JMICRON, PCI_DEVICE_ID_JMICRON_JMB38X_MS, PCI_ANY_ID, | ||
916 | PCI_ANY_ID, 0, 0, 0 }, | ||
917 | { } | ||
918 | }; | ||
919 | |||
920 | static struct pci_driver jmb38x_ms_driver = { | ||
921 | .name = DRIVER_NAME, | ||
922 | .id_table = jmb38x_ms_id_tbl, | ||
923 | .probe = jmb38x_ms_probe, | ||
924 | .remove = jmb38x_ms_remove, | ||
925 | .suspend = jmb38x_ms_suspend, | ||
926 | .resume = jmb38x_ms_resume | ||
927 | }; | ||
928 | |||
929 | static int __init jmb38x_ms_init(void) | ||
930 | { | ||
931 | return pci_register_driver(&jmb38x_ms_driver); | ||
932 | } | ||
933 | |||
934 | static void __exit jmb38x_ms_exit(void) | ||
935 | { | ||
936 | pci_unregister_driver(&jmb38x_ms_driver); | ||
937 | } | ||
938 | |||
939 | MODULE_AUTHOR("Alex Dubov"); | ||
940 | MODULE_DESCRIPTION("JMicron jmb38x MemoryStick driver"); | ||
941 | MODULE_LICENSE("GPL"); | ||
942 | MODULE_DEVICE_TABLE(pci, jmb38x_ms_id_tbl); | ||
943 | |||
944 | module_init(jmb38x_ms_init); | ||
945 | module_exit(jmb38x_ms_exit); | ||
diff --git a/drivers/memstick/host/tifm_ms.c b/drivers/memstick/host/tifm_ms.c index 4fb24215bd95..2b5bf52a8302 100644 --- a/drivers/memstick/host/tifm_ms.c +++ b/drivers/memstick/host/tifm_ms.c | |||
@@ -20,293 +20,315 @@ | |||
20 | #include <asm/io.h> | 20 | #include <asm/io.h> |
21 | 21 | ||
22 | #define DRIVER_NAME "tifm_ms" | 22 | #define DRIVER_NAME "tifm_ms" |
23 | #define DRIVER_VERSION "0.1" | ||
24 | 23 | ||
25 | static int no_dma; | 24 | static int no_dma; |
26 | module_param(no_dma, bool, 0644); | 25 | module_param(no_dma, bool, 0644); |
27 | 26 | ||
28 | #define TIFM_MS_TIMEOUT 0x00100 | 27 | /* |
29 | #define TIFM_MS_BADCRC 0x00200 | 28 | * Some control bits of TIFM appear to conform to Sony's reference design, |
30 | #define TIFM_MS_EOTPC 0x01000 | 29 | * so I'm just assuming they all are. |
31 | #define TIFM_MS_INT 0x02000 | 30 | */ |
32 | |||
33 | /* The meaning of the bit majority in this constant is unknown. */ | ||
34 | #define TIFM_MS_SERIAL 0x04010 | ||
35 | 31 | ||
36 | #define TIFM_MS_SYS_LATCH 0x00100 | 32 | #define TIFM_MS_STAT_DRQ 0x04000 |
37 | #define TIFM_MS_SYS_NOT_RDY 0x00800 | 33 | #define TIFM_MS_STAT_MSINT 0x02000 |
38 | #define TIFM_MS_SYS_DATA 0x10000 | 34 | #define TIFM_MS_STAT_RDY 0x01000 |
35 | #define TIFM_MS_STAT_CRC 0x00200 | ||
36 | #define TIFM_MS_STAT_TOE 0x00100 | ||
37 | #define TIFM_MS_STAT_EMP 0x00020 | ||
38 | #define TIFM_MS_STAT_FUL 0x00010 | ||
39 | #define TIFM_MS_STAT_CED 0x00008 | ||
40 | #define TIFM_MS_STAT_ERR 0x00004 | ||
41 | #define TIFM_MS_STAT_BRQ 0x00002 | ||
42 | #define TIFM_MS_STAT_CNK 0x00001 | ||
43 | |||
44 | #define TIFM_MS_SYS_DMA 0x10000 | ||
45 | #define TIFM_MS_SYS_RESET 0x08000 | ||
46 | #define TIFM_MS_SYS_SRAC 0x04000 | ||
47 | #define TIFM_MS_SYS_INTEN 0x02000 | ||
48 | #define TIFM_MS_SYS_NOCRC 0x01000 | ||
49 | #define TIFM_MS_SYS_INTCLR 0x00800 | ||
50 | #define TIFM_MS_SYS_MSIEN 0x00400 | ||
51 | #define TIFM_MS_SYS_FCLR 0x00200 | ||
52 | #define TIFM_MS_SYS_FDIR 0x00100 | ||
53 | #define TIFM_MS_SYS_DAM 0x00080 | ||
54 | #define TIFM_MS_SYS_DRM 0x00040 | ||
55 | #define TIFM_MS_SYS_DRQSL 0x00020 | ||
56 | #define TIFM_MS_SYS_REI 0x00010 | ||
57 | #define TIFM_MS_SYS_REO 0x00008 | ||
58 | #define TIFM_MS_SYS_BSY_MASK 0x00007 | ||
59 | |||
60 | #define TIFM_MS_SYS_FIFO (TIFM_MS_SYS_INTEN | TIFM_MS_SYS_MSIEN \ | ||
61 | | TIFM_MS_SYS_FCLR | TIFM_MS_SYS_BSY_MASK) | ||
39 | 62 | ||
40 | /* Hardware flags */ | 63 | /* Hardware flags */ |
41 | enum { | 64 | enum { |
42 | CMD_READY = 0x0001, | 65 | CMD_READY = 0x01, |
43 | FIFO_READY = 0x0002, | 66 | FIFO_READY = 0x02, |
44 | CARD_READY = 0x0004, | 67 | CARD_INT = 0x04 |
45 | DATA_CARRY = 0x0008 | ||
46 | }; | 68 | }; |
47 | 69 | ||
48 | struct tifm_ms { | 70 | struct tifm_ms { |
49 | struct tifm_dev *dev; | 71 | struct tifm_dev *dev; |
50 | unsigned short eject:1, | 72 | struct timer_list timer; |
51 | no_dma:1; | 73 | struct memstick_request *req; |
52 | unsigned short cmd_flags; | ||
53 | unsigned int mode_mask; | 74 | unsigned int mode_mask; |
54 | unsigned int block_pos; | 75 | unsigned int block_pos; |
55 | unsigned long timeout_jiffies; | 76 | unsigned long timeout_jiffies; |
56 | 77 | unsigned char eject:1, | |
57 | struct timer_list timer; | 78 | use_dma:1; |
58 | struct memstick_request *req; | 79 | unsigned char cmd_flags; |
80 | unsigned char io_pos; | ||
59 | unsigned int io_word; | 81 | unsigned int io_word; |
60 | }; | 82 | }; |
61 | 83 | ||
62 | static void tifm_ms_read_fifo(struct tifm_ms *host, unsigned int fifo_offset, | 84 | static unsigned int tifm_ms_read_data(struct tifm_ms *host, |
63 | struct page *pg, unsigned int page_off, | 85 | unsigned char *buf, unsigned int length) |
64 | unsigned int length) | ||
65 | { | 86 | { |
66 | struct tifm_dev *sock = host->dev; | 87 | struct tifm_dev *sock = host->dev; |
67 | unsigned int cnt = 0, off = 0; | 88 | unsigned int off = 0; |
68 | unsigned char *buf = kmap_atomic(pg, KM_BIO_DST_IRQ) + page_off; | 89 | |
90 | while (host->io_pos && length) { | ||
91 | buf[off++] = host->io_word & 0xff; | ||
92 | host->io_word >>= 8; | ||
93 | length--; | ||
94 | host->io_pos--; | ||
95 | } | ||
69 | 96 | ||
70 | if (host->cmd_flags & DATA_CARRY) { | 97 | if (!length) |
71 | while ((fifo_offset & 3) && length) { | 98 | return off; |
99 | |||
100 | while (!(TIFM_MS_STAT_EMP & readl(sock->addr + SOCK_MS_STATUS))) { | ||
101 | if (length < 4) | ||
102 | break; | ||
103 | *(unsigned int *)(buf + off) = __raw_readl(sock->addr | ||
104 | + SOCK_MS_DATA); | ||
105 | length -= 4; | ||
106 | off += 4; | ||
107 | } | ||
108 | |||
109 | if (length | ||
110 | && !(TIFM_MS_STAT_EMP & readl(sock->addr + SOCK_MS_STATUS))) { | ||
111 | host->io_word = readl(sock->addr + SOCK_MS_DATA); | ||
112 | for (host->io_pos = 4; host->io_pos; --host->io_pos) { | ||
72 | buf[off++] = host->io_word & 0xff; | 113 | buf[off++] = host->io_word & 0xff; |
73 | host->io_word >>= 8; | 114 | host->io_word >>= 8; |
74 | length--; | 115 | length--; |
75 | fifo_offset++; | 116 | if (!length) |
117 | break; | ||
76 | } | 118 | } |
77 | if (!(fifo_offset & 3)) | ||
78 | host->cmd_flags &= ~DATA_CARRY; | ||
79 | if (!length) | ||
80 | return; | ||
81 | } | 119 | } |
82 | 120 | ||
83 | do { | 121 | return off; |
84 | host->io_word = readl(sock->addr + SOCK_FIFO_ACCESS | ||
85 | + fifo_offset); | ||
86 | cnt = 4; | ||
87 | while (length && cnt) { | ||
88 | buf[off++] = (host->io_word >> 8) & 0xff; | ||
89 | cnt--; | ||
90 | length--; | ||
91 | } | ||
92 | fifo_offset += 4 - cnt; | ||
93 | } while (length); | ||
94 | |||
95 | if (cnt) | ||
96 | host->cmd_flags |= DATA_CARRY; | ||
97 | |||
98 | kunmap_atomic(buf - page_off, KM_BIO_DST_IRQ); | ||
99 | } | 122 | } |
100 | 123 | ||
101 | static void tifm_ms_write_fifo(struct tifm_ms *host, unsigned int fifo_offset, | 124 | static unsigned int tifm_ms_write_data(struct tifm_ms *host, |
102 | struct page *pg, unsigned int page_off, | 125 | unsigned char *buf, unsigned int length) |
103 | unsigned int length) | ||
104 | { | 126 | { |
105 | struct tifm_dev *sock = host->dev; | 127 | struct tifm_dev *sock = host->dev; |
106 | unsigned int cnt = 0, off = 0; | 128 | unsigned int off = 0; |
107 | unsigned char *buf = kmap_atomic(pg, KM_BIO_SRC_IRQ) + page_off; | ||
108 | 129 | ||
109 | if (host->cmd_flags & DATA_CARRY) { | 130 | if (host->io_pos) { |
110 | while (fifo_offset & 3) { | 131 | while (host->io_pos < 4 && length) { |
111 | host->io_word |= buf[off++] << (8 * (fifo_offset & 3)); | 132 | host->io_word |= buf[off++] << (host->io_pos * 8); |
133 | host->io_pos++; | ||
112 | length--; | 134 | length--; |
113 | fifo_offset++; | ||
114 | } | 135 | } |
115 | if (!(fifo_offset & 3)) { | ||
116 | writel(host->io_word, sock->addr + SOCK_FIFO_ACCESS | ||
117 | + fifo_offset - 4); | ||
118 | |||
119 | host->cmd_flags &= ~DATA_CARRY; | ||
120 | } | ||
121 | if (!length) | ||
122 | return; | ||
123 | } | 136 | } |
124 | 137 | ||
125 | do { | 138 | if (host->io_pos == 4 |
126 | cnt = 4; | 139 | && !(TIFM_MS_STAT_FUL & readl(sock->addr + SOCK_MS_STATUS))) { |
140 | writel(TIFM_MS_SYS_FDIR | readl(sock->addr + SOCK_MS_SYSTEM), | ||
141 | sock->addr + SOCK_MS_SYSTEM); | ||
142 | writel(host->io_word, sock->addr + SOCK_MS_DATA); | ||
143 | host->io_pos = 0; | ||
127 | host->io_word = 0; | 144 | host->io_word = 0; |
128 | while (length && cnt) { | 145 | } else if (host->io_pos) { |
129 | host->io_word |= buf[off++] << (4 - cnt); | 146 | return off; |
130 | cnt--; | 147 | } |
131 | length--; | ||
132 | } | ||
133 | fifo_offset += 4 - cnt; | ||
134 | if (!cnt) | ||
135 | writel(host->io_word, sock->addr + SOCK_FIFO_ACCESS | ||
136 | + fifo_offset - 4); | ||
137 | |||
138 | } while (length); | ||
139 | |||
140 | if (cnt) | ||
141 | host->cmd_flags |= DATA_CARRY; | ||
142 | 148 | ||
143 | kunmap_atomic(buf - page_off, KM_BIO_SRC_IRQ); | 149 | if (!length) |
144 | } | 150 | return off; |
145 | 151 | ||
146 | static void tifm_ms_move_block(struct tifm_ms *host, unsigned int length) | 152 | while (!(TIFM_MS_STAT_FUL & readl(sock->addr + SOCK_MS_STATUS))) { |
147 | { | 153 | if (length < 4) |
148 | unsigned int t_size; | 154 | break; |
149 | unsigned int off = host->req->sg.offset + host->block_pos; | 155 | writel(TIFM_MS_SYS_FDIR | readl(sock->addr + SOCK_MS_SYSTEM), |
150 | unsigned int p_off, p_cnt; | 156 | sock->addr + SOCK_MS_SYSTEM); |
151 | struct page *pg; | 157 | __raw_writel(*(unsigned int *)(buf + off), |
152 | unsigned long flags; | 158 | sock->addr + SOCK_MS_DATA); |
159 | length -= 4; | ||
160 | off += 4; | ||
161 | } | ||
153 | 162 | ||
154 | dev_dbg(&host->dev->dev, "moving block\n"); | 163 | switch (length) { |
155 | local_irq_save(flags); | 164 | case 3: |
156 | t_size = length; | 165 | host->io_word |= buf[off + 2] << 16; |
157 | while (t_size) { | 166 | host->io_pos++; |
158 | pg = nth_page(sg_page(&host->req->sg), off >> PAGE_SHIFT); | 167 | case 2: |
159 | p_off = offset_in_page(off); | 168 | host->io_word |= buf[off + 1] << 8; |
160 | p_cnt = PAGE_SIZE - p_off; | 169 | host->io_pos++; |
161 | p_cnt = min(p_cnt, t_size); | 170 | case 1: |
171 | host->io_word |= buf[off]; | ||
172 | host->io_pos++; | ||
173 | } | ||
162 | 174 | ||
163 | if (host->req->data_dir == WRITE) | 175 | off += host->io_pos; |
164 | tifm_ms_write_fifo(host, length - t_size, | ||
165 | pg, p_off, p_cnt); | ||
166 | else | ||
167 | tifm_ms_read_fifo(host, length - t_size, | ||
168 | pg, p_off, p_cnt); | ||
169 | 176 | ||
170 | t_size -= p_cnt; | 177 | return off; |
171 | } | ||
172 | local_irq_restore(flags); | ||
173 | } | 178 | } |
174 | 179 | ||
175 | static int tifm_ms_transfer_data(struct tifm_ms *host, int skip) | 180 | static unsigned int tifm_ms_transfer_data(struct tifm_ms *host) |
176 | { | 181 | { |
177 | struct tifm_dev *sock = host->dev; | 182 | struct tifm_dev *sock = host->dev; |
178 | unsigned int length = host->req->sg.length - host->block_pos; | 183 | unsigned int length; |
184 | unsigned int off; | ||
185 | unsigned int t_size, p_off, p_cnt; | ||
186 | unsigned char *buf; | ||
187 | struct page *pg; | ||
188 | unsigned long flags = 0; | ||
189 | |||
190 | if (host->req->long_data) { | ||
191 | length = host->req->sg.length - host->block_pos; | ||
192 | off = host->req->sg.offset + host->block_pos; | ||
193 | } else { | ||
194 | length = host->req->data_len - host->block_pos; | ||
195 | off = 0; | ||
196 | } | ||
197 | dev_dbg(&sock->dev, "fifo data transfer, %d, %d\n", length, | ||
198 | host->block_pos); | ||
199 | |||
200 | while (length) { | ||
201 | if (host->req->long_data) { | ||
202 | pg = nth_page(sg_page(&host->req->sg), | ||
203 | off >> PAGE_SHIFT); | ||
204 | p_off = offset_in_page(off); | ||
205 | p_cnt = PAGE_SIZE - p_off; | ||
206 | p_cnt = min(p_cnt, length); | ||
207 | |||
208 | local_irq_save(flags); | ||
209 | buf = kmap_atomic(pg, KM_BIO_SRC_IRQ) + p_off; | ||
210 | } else { | ||
211 | buf = host->req->data + host->block_pos; | ||
212 | p_cnt = host->req->data_len - host->block_pos; | ||
213 | } | ||
179 | 214 | ||
180 | if (!length) | 215 | t_size = host->req->data_dir == WRITE |
181 | return 1; | 216 | ? tifm_ms_write_data(host, buf, p_cnt) |
217 | : tifm_ms_read_data(host, buf, p_cnt); | ||
182 | 218 | ||
183 | if (length > TIFM_FIFO_SIZE) | 219 | if (host->req->long_data) { |
184 | length = TIFM_FIFO_SIZE; | 220 | kunmap_atomic(buf - p_off, KM_BIO_SRC_IRQ); |
221 | local_irq_restore(flags); | ||
222 | } | ||
185 | 223 | ||
186 | if (!skip) { | 224 | if (!t_size) |
187 | tifm_ms_move_block(host, length); | 225 | break; |
188 | host->block_pos += length; | 226 | host->block_pos += t_size; |
227 | length -= t_size; | ||
228 | off += t_size; | ||
189 | } | 229 | } |
190 | 230 | ||
191 | if ((host->req->data_dir == READ) | 231 | dev_dbg(&sock->dev, "fifo data transfer, %d remaining\n", length); |
192 | && (host->block_pos == host->req->sg.length)) | 232 | if (!length && (host->req->data_dir == WRITE)) { |
193 | return 1; | 233 | if (host->io_pos) { |
194 | 234 | writel(TIFM_MS_SYS_FDIR | |
195 | writel(ilog2(length) - 2, sock->addr + SOCK_FIFO_PAGE_SIZE); | 235 | | readl(sock->addr + SOCK_MS_SYSTEM), |
196 | if (host->req->data_dir == WRITE) | 236 | sock->addr + SOCK_MS_SYSTEM); |
197 | writel((1 << 8) | TIFM_DMA_TX, sock->addr + SOCK_DMA_CONTROL); | 237 | writel(host->io_word, sock->addr + SOCK_MS_DATA); |
198 | else | 238 | } |
199 | writel((1 << 8), sock->addr + SOCK_DMA_CONTROL); | 239 | writel(TIFM_MS_SYS_FDIR |
240 | | readl(sock->addr + SOCK_MS_SYSTEM), | ||
241 | sock->addr + SOCK_MS_SYSTEM); | ||
242 | writel(0, sock->addr + SOCK_MS_DATA); | ||
243 | } else { | ||
244 | readl(sock->addr + SOCK_MS_DATA); | ||
245 | } | ||
200 | 246 | ||
201 | return 0; | 247 | return length; |
202 | } | 248 | } |
203 | 249 | ||
204 | static int tifm_ms_issue_cmd(struct tifm_ms *host) | 250 | static int tifm_ms_issue_cmd(struct tifm_ms *host) |
205 | { | 251 | { |
206 | struct tifm_dev *sock = host->dev; | 252 | struct tifm_dev *sock = host->dev; |
207 | unsigned char *data; | 253 | unsigned char *data; |
208 | unsigned int data_len = 0, cmd = 0, cmd_mask = 0, cnt, tval = 0; | 254 | unsigned int data_len, cmd, sys_param; |
209 | 255 | ||
210 | host->cmd_flags = 0; | 256 | host->cmd_flags = 0; |
257 | host->block_pos = 0; | ||
258 | host->io_pos = 0; | ||
259 | host->io_word = 0; | ||
260 | host->cmd_flags = 0; | ||
211 | 261 | ||
212 | if (host->req->io_type == MEMSTICK_IO_SG) { | 262 | data = host->req->data; |
213 | if (!host->no_dma) { | ||
214 | if (1 != tifm_map_sg(sock, &host->req->sg, 1, | ||
215 | host->req->data_dir == READ | ||
216 | ? PCI_DMA_FROMDEVICE | ||
217 | : PCI_DMA_TODEVICE)) { | ||
218 | host->req->error = -ENOMEM; | ||
219 | return host->req->error; | ||
220 | } | ||
221 | data_len = sg_dma_len(&host->req->sg); | ||
222 | } else | ||
223 | data_len = host->req->sg.length; | ||
224 | |||
225 | writel(TIFM_FIFO_INT_SETALL, | ||
226 | sock->addr + SOCK_DMA_FIFO_INT_ENABLE_CLEAR); | ||
227 | writel(TIFM_FIFO_ENABLE, | ||
228 | sock->addr + SOCK_FIFO_CONTROL); | ||
229 | writel(TIFM_FIFO_INTMASK, | ||
230 | sock->addr + SOCK_DMA_FIFO_INT_ENABLE_SET); | ||
231 | 263 | ||
232 | if (!host->no_dma) { | 264 | host->use_dma = !no_dma; |
233 | writel(ilog2(data_len) - 2, | ||
234 | sock->addr + SOCK_FIFO_PAGE_SIZE); | ||
235 | writel(sg_dma_address(&host->req->sg), | ||
236 | sock->addr + SOCK_DMA_ADDRESS); | ||
237 | if (host->req->data_dir == WRITE) | ||
238 | writel((1 << 8) | TIFM_DMA_TX | TIFM_DMA_EN, | ||
239 | sock->addr + SOCK_DMA_CONTROL); | ||
240 | else | ||
241 | writel((1 << 8) | TIFM_DMA_EN, | ||
242 | sock->addr + SOCK_DMA_CONTROL); | ||
243 | } else { | ||
244 | tifm_ms_transfer_data(host, | ||
245 | host->req->data_dir == READ); | ||
246 | } | ||
247 | 265 | ||
248 | cmd_mask = readl(sock->addr + SOCK_MS_SYSTEM); | 266 | if (host->req->long_data) { |
249 | cmd_mask |= TIFM_MS_SYS_DATA | TIFM_MS_SYS_NOT_RDY; | 267 | data_len = host->req->sg.length; |
250 | writel(cmd_mask, sock->addr + SOCK_MS_SYSTEM); | 268 | if (!is_power_of_2(data_len)) |
251 | } else if (host->req->io_type == MEMSTICK_IO_VAL) { | 269 | host->use_dma = 0; |
252 | data = host->req->data; | 270 | } else { |
253 | data_len = host->req->data_len; | 271 | data_len = host->req->data_len; |
272 | host->use_dma = 0; | ||
273 | } | ||
254 | 274 | ||
255 | cmd_mask = host->mode_mask | 0x2607; /* unknown constant */ | 275 | writel(TIFM_FIFO_INT_SETALL, |
256 | 276 | sock->addr + SOCK_DMA_FIFO_INT_ENABLE_CLEAR); | |
257 | if (host->req->data_dir == WRITE) { | 277 | writel(TIFM_FIFO_ENABLE, |
258 | cmd_mask |= TIFM_MS_SYS_LATCH; | 278 | sock->addr + SOCK_FIFO_CONTROL); |
259 | writel(cmd_mask, sock->addr + SOCK_MS_SYSTEM); | 279 | |
260 | for (cnt = 0; (data_len - cnt) >= 4; cnt += 4) { | 280 | if (host->use_dma) { |
261 | writel(TIFM_MS_SYS_LATCH | 281 | if (1 != tifm_map_sg(sock, &host->req->sg, 1, |
262 | | readl(sock->addr + SOCK_MS_SYSTEM), | 282 | host->req->data_dir == READ |
263 | sock->addr + SOCK_MS_SYSTEM); | 283 | ? PCI_DMA_FROMDEVICE |
264 | __raw_writel(*(unsigned int *)(data + cnt), | 284 | : PCI_DMA_TODEVICE)) { |
265 | sock->addr + SOCK_MS_DATA); | 285 | host->req->error = -ENOMEM; |
266 | dev_dbg(&sock->dev, "writing %x\n", | 286 | return host->req->error; |
267 | *(int *)(data + cnt)); | 287 | } |
268 | } | 288 | data_len = sg_dma_len(&host->req->sg); |
269 | switch (data_len - cnt) { | ||
270 | case 3: | ||
271 | tval |= data[cnt + 2] << 16; | ||
272 | case 2: | ||
273 | tval |= data[cnt + 1] << 8; | ||
274 | case 1: | ||
275 | tval |= data[cnt]; | ||
276 | writel(TIFM_MS_SYS_LATCH | ||
277 | | readl(sock->addr + SOCK_MS_SYSTEM), | ||
278 | sock->addr + SOCK_MS_SYSTEM); | ||
279 | writel(tval, sock->addr + SOCK_MS_DATA); | ||
280 | dev_dbg(&sock->dev, "writing %x\n", tval); | ||
281 | } | ||
282 | 289 | ||
283 | writel(TIFM_MS_SYS_LATCH | 290 | writel(ilog2(data_len) - 2, |
284 | | readl(sock->addr + SOCK_MS_SYSTEM), | 291 | sock->addr + SOCK_FIFO_PAGE_SIZE); |
285 | sock->addr + SOCK_MS_SYSTEM); | 292 | writel(TIFM_FIFO_INTMASK, |
286 | writel(0, sock->addr + SOCK_MS_DATA); | 293 | sock->addr + SOCK_DMA_FIFO_INT_ENABLE_SET); |
287 | dev_dbg(&sock->dev, "writing %x\n", 0); | 294 | sys_param = TIFM_DMA_EN | (1 << 8); |
295 | if (host->req->data_dir == WRITE) | ||
296 | sys_param |= TIFM_DMA_TX; | ||
297 | |||
298 | writel(TIFM_FIFO_INTMASK, | ||
299 | sock->addr + SOCK_DMA_FIFO_INT_ENABLE_SET); | ||
288 | 300 | ||
289 | } else | 301 | writel(sg_dma_address(&host->req->sg), |
290 | writel(cmd_mask, sock->addr + SOCK_MS_SYSTEM); | 302 | sock->addr + SOCK_DMA_ADDRESS); |
303 | writel(sys_param, sock->addr + SOCK_DMA_CONTROL); | ||
304 | } else { | ||
305 | writel(host->mode_mask | TIFM_MS_SYS_FIFO, | ||
306 | sock->addr + SOCK_MS_SYSTEM); | ||
291 | 307 | ||
292 | cmd_mask = readl(sock->addr + SOCK_MS_SYSTEM); | 308 | writel(TIFM_FIFO_MORE, |
293 | cmd_mask &= ~TIFM_MS_SYS_DATA; | 309 | sock->addr + SOCK_DMA_FIFO_INT_ENABLE_SET); |
294 | cmd_mask |= TIFM_MS_SYS_NOT_RDY; | 310 | } |
295 | dev_dbg(&sock->dev, "mask %x\n", cmd_mask); | ||
296 | writel(cmd_mask, sock->addr + SOCK_MS_SYSTEM); | ||
297 | } else | ||
298 | BUG(); | ||
299 | 311 | ||
300 | mod_timer(&host->timer, jiffies + host->timeout_jiffies); | 312 | mod_timer(&host->timer, jiffies + host->timeout_jiffies); |
301 | writel(TIFM_CTRL_LED | readl(sock->addr + SOCK_CONTROL), | 313 | writel(TIFM_CTRL_LED | readl(sock->addr + SOCK_CONTROL), |
302 | sock->addr + SOCK_CONTROL); | 314 | sock->addr + SOCK_CONTROL); |
303 | host->req->error = 0; | 315 | host->req->error = 0; |
304 | 316 | ||
317 | sys_param = readl(sock->addr + SOCK_MS_SYSTEM); | ||
318 | sys_param |= TIFM_MS_SYS_INTCLR; | ||
319 | |||
320 | if (host->use_dma) | ||
321 | sys_param |= TIFM_MS_SYS_DMA; | ||
322 | else | ||
323 | sys_param &= ~TIFM_MS_SYS_DMA; | ||
324 | |||
325 | writel(sys_param, sock->addr + SOCK_MS_SYSTEM); | ||
326 | |||
305 | cmd = (host->req->tpc & 0xf) << 12; | 327 | cmd = (host->req->tpc & 0xf) << 12; |
306 | cmd |= data_len; | 328 | cmd |= data_len; |
307 | writel(cmd, sock->addr + SOCK_MS_COMMAND); | 329 | writel(cmd, sock->addr + SOCK_MS_COMMAND); |
308 | 330 | ||
309 | dev_dbg(&sock->dev, "executing TPC %x, %x\n", cmd, cmd_mask); | 331 | dev_dbg(&sock->dev, "executing TPC %x, %x\n", cmd, sys_param); |
310 | return 0; | 332 | return 0; |
311 | } | 333 | } |
312 | 334 | ||
@@ -314,47 +336,20 @@ static void tifm_ms_complete_cmd(struct tifm_ms *host) | |||
314 | { | 336 | { |
315 | struct tifm_dev *sock = host->dev; | 337 | struct tifm_dev *sock = host->dev; |
316 | struct memstick_host *msh = tifm_get_drvdata(sock); | 338 | struct memstick_host *msh = tifm_get_drvdata(sock); |
317 | unsigned int tval = 0, data_len; | ||
318 | unsigned char *data; | ||
319 | int rc; | 339 | int rc; |
320 | 340 | ||
321 | del_timer(&host->timer); | 341 | del_timer(&host->timer); |
322 | if (host->req->io_type == MEMSTICK_IO_SG) { | ||
323 | if (!host->no_dma) | ||
324 | tifm_unmap_sg(sock, &host->req->sg, 1, | ||
325 | host->req->data_dir == READ | ||
326 | ? PCI_DMA_FROMDEVICE | ||
327 | : PCI_DMA_TODEVICE); | ||
328 | } else if (host->req->io_type == MEMSTICK_IO_VAL) { | ||
329 | writel(~TIFM_MS_SYS_DATA & readl(sock->addr + SOCK_MS_SYSTEM), | ||
330 | sock->addr + SOCK_MS_SYSTEM); | ||
331 | |||
332 | data = host->req->data; | ||
333 | data_len = host->req->data_len; | ||
334 | 342 | ||
335 | if (host->req->data_dir == READ) { | 343 | if (host->use_dma) |
336 | for (rc = 0; (data_len - rc) >= 4; rc += 4) | 344 | tifm_unmap_sg(sock, &host->req->sg, 1, |
337 | *(int *)(data + rc) | 345 | host->req->data_dir == READ |
338 | = __raw_readl(sock->addr | 346 | ? PCI_DMA_FROMDEVICE |
339 | + SOCK_MS_DATA); | 347 | : PCI_DMA_TODEVICE); |
340 | |||
341 | if (data_len - rc) | ||
342 | tval = readl(sock->addr + SOCK_MS_DATA); | ||
343 | switch (data_len - rc) { | ||
344 | case 3: | ||
345 | data[rc + 2] = (tval >> 16) & 0xff; | ||
346 | case 2: | ||
347 | data[rc + 1] = (tval >> 8) & 0xff; | ||
348 | case 1: | ||
349 | data[rc] = tval & 0xff; | ||
350 | } | ||
351 | readl(sock->addr + SOCK_MS_DATA); | ||
352 | } | ||
353 | } | ||
354 | 348 | ||
355 | writel((~TIFM_CTRL_LED) & readl(sock->addr + SOCK_CONTROL), | 349 | writel((~TIFM_CTRL_LED) & readl(sock->addr + SOCK_CONTROL), |
356 | sock->addr + SOCK_CONTROL); | 350 | sock->addr + SOCK_CONTROL); |
357 | 351 | ||
352 | dev_dbg(&sock->dev, "TPC complete\n"); | ||
358 | do { | 353 | do { |
359 | rc = memstick_next_req(msh, &host->req); | 354 | rc = memstick_next_req(msh, &host->req); |
360 | } while (!rc && tifm_ms_issue_cmd(host)); | 355 | } while (!rc && tifm_ms_issue_cmd(host)); |
@@ -365,11 +360,10 @@ static int tifm_ms_check_status(struct tifm_ms *host) | |||
365 | if (!host->req->error) { | 360 | if (!host->req->error) { |
366 | if (!(host->cmd_flags & CMD_READY)) | 361 | if (!(host->cmd_flags & CMD_READY)) |
367 | return 1; | 362 | return 1; |
368 | if ((host->req->io_type == MEMSTICK_IO_SG) | 363 | if (!(host->cmd_flags & FIFO_READY)) |
369 | && !(host->cmd_flags & FIFO_READY)) | ||
370 | return 1; | 364 | return 1; |
371 | if (host->req->need_card_int | 365 | if (host->req->need_card_int |
372 | && !(host->cmd_flags & CARD_READY)) | 366 | && !(host->cmd_flags & CARD_INT)) |
373 | return 1; | 367 | return 1; |
374 | } | 368 | } |
375 | return 0; | 369 | return 0; |
@@ -379,18 +373,24 @@ static int tifm_ms_check_status(struct tifm_ms *host) | |||
379 | static void tifm_ms_data_event(struct tifm_dev *sock) | 373 | static void tifm_ms_data_event(struct tifm_dev *sock) |
380 | { | 374 | { |
381 | struct tifm_ms *host; | 375 | struct tifm_ms *host; |
382 | unsigned int fifo_status = 0; | 376 | unsigned int fifo_status = 0, host_status = 0; |
383 | int rc = 1; | 377 | int rc = 1; |
384 | 378 | ||
385 | spin_lock(&sock->lock); | 379 | spin_lock(&sock->lock); |
386 | host = memstick_priv((struct memstick_host *)tifm_get_drvdata(sock)); | 380 | host = memstick_priv((struct memstick_host *)tifm_get_drvdata(sock)); |
387 | fifo_status = readl(sock->addr + SOCK_DMA_FIFO_STATUS); | 381 | fifo_status = readl(sock->addr + SOCK_DMA_FIFO_STATUS); |
388 | dev_dbg(&sock->dev, "data event: fifo_status %x, flags %x\n", | 382 | host_status = readl(sock->addr + SOCK_MS_STATUS); |
389 | fifo_status, host->cmd_flags); | 383 | dev_dbg(&sock->dev, |
384 | "data event: fifo_status %x, host_status %x, flags %x\n", | ||
385 | fifo_status, host_status, host->cmd_flags); | ||
390 | 386 | ||
391 | if (host->req) { | 387 | if (host->req) { |
392 | if (fifo_status & TIFM_FIFO_READY) { | 388 | if (host->use_dma && (fifo_status & 1)) { |
393 | if (!host->no_dma || tifm_ms_transfer_data(host, 0)) { | 389 | host->cmd_flags |= FIFO_READY; |
390 | rc = tifm_ms_check_status(host); | ||
391 | } | ||
392 | if (!host->use_dma && (fifo_status & TIFM_FIFO_MORE)) { | ||
393 | if (!tifm_ms_transfer_data(host)) { | ||
394 | host->cmd_flags |= FIFO_READY; | 394 | host->cmd_flags |= FIFO_READY; |
395 | rc = tifm_ms_check_status(host); | 395 | rc = tifm_ms_check_status(host); |
396 | } | 396 | } |
@@ -419,9 +419,9 @@ static void tifm_ms_card_event(struct tifm_dev *sock) | |||
419 | host_status, host->cmd_flags); | 419 | host_status, host->cmd_flags); |
420 | 420 | ||
421 | if (host->req) { | 421 | if (host->req) { |
422 | if (host_status & TIFM_MS_TIMEOUT) | 422 | if (host_status & TIFM_MS_STAT_TOE) |
423 | host->req->error = -ETIME; | 423 | host->req->error = -ETIME; |
424 | else if (host_status & TIFM_MS_BADCRC) | 424 | else if (host_status & TIFM_MS_STAT_CRC) |
425 | host->req->error = -EILSEQ; | 425 | host->req->error = -EILSEQ; |
426 | 426 | ||
427 | if (host->req->error) { | 427 | if (host->req->error) { |
@@ -430,18 +430,17 @@ static void tifm_ms_card_event(struct tifm_dev *sock) | |||
430 | writel(TIFM_DMA_RESET, sock->addr + SOCK_DMA_CONTROL); | 430 | writel(TIFM_DMA_RESET, sock->addr + SOCK_DMA_CONTROL); |
431 | } | 431 | } |
432 | 432 | ||
433 | if (host_status & TIFM_MS_EOTPC) | 433 | if (host_status & TIFM_MS_STAT_RDY) |
434 | host->cmd_flags |= CMD_READY; | 434 | host->cmd_flags |= CMD_READY; |
435 | if (host_status & TIFM_MS_INT) | 435 | |
436 | host->cmd_flags |= CARD_READY; | 436 | if (host_status & TIFM_MS_STAT_MSINT) |
437 | host->cmd_flags |= CARD_INT; | ||
437 | 438 | ||
438 | rc = tifm_ms_check_status(host); | 439 | rc = tifm_ms_check_status(host); |
439 | 440 | ||
440 | } | 441 | } |
441 | 442 | ||
442 | writel(TIFM_MS_SYS_NOT_RDY | readl(sock->addr + SOCK_MS_SYSTEM), | 443 | writel(TIFM_MS_SYS_INTCLR | readl(sock->addr + SOCK_MS_SYSTEM), |
443 | sock->addr + SOCK_MS_SYSTEM); | ||
444 | writel((~TIFM_MS_SYS_DATA) & readl(sock->addr + SOCK_MS_SYSTEM), | ||
445 | sock->addr + SOCK_MS_SYSTEM); | 444 | sock->addr + SOCK_MS_SYSTEM); |
446 | 445 | ||
447 | if (!rc) | 446 | if (!rc) |
@@ -497,15 +496,26 @@ static void tifm_ms_set_param(struct memstick_host *msh, | |||
497 | 496 | ||
498 | switch (param) { | 497 | switch (param) { |
499 | case MEMSTICK_POWER: | 498 | case MEMSTICK_POWER: |
500 | /* this is set by card detection mechanism */ | 499 | /* also affected by media detection mechanism */ |
500 | if (value == MEMSTICK_POWER_ON) { | ||
501 | host->mode_mask = TIFM_MS_SYS_SRAC | TIFM_MS_SYS_REI; | ||
502 | writel(TIFM_MS_SYS_RESET, sock->addr + SOCK_MS_SYSTEM); | ||
503 | writel(TIFM_MS_SYS_FCLR | TIFM_MS_SYS_INTCLR, | ||
504 | sock->addr + SOCK_MS_SYSTEM); | ||
505 | writel(0xffffffff, sock->addr + SOCK_MS_STATUS); | ||
506 | } else if (value == MEMSTICK_POWER_OFF) { | ||
507 | writel(TIFM_MS_SYS_FCLR | TIFM_MS_SYS_INTCLR, | ||
508 | sock->addr + SOCK_MS_SYSTEM); | ||
509 | writel(0xffffffff, sock->addr + SOCK_MS_STATUS); | ||
510 | } | ||
501 | break; | 511 | break; |
502 | case MEMSTICK_INTERFACE: | 512 | case MEMSTICK_INTERFACE: |
503 | if (value == MEMSTICK_SERIAL) { | 513 | if (value == MEMSTICK_SERIAL) { |
504 | host->mode_mask = TIFM_MS_SERIAL; | 514 | host->mode_mask = TIFM_MS_SYS_SRAC | TIFM_MS_SYS_REI; |
505 | writel((~TIFM_CTRL_FAST_CLK) | 515 | writel((~TIFM_CTRL_FAST_CLK) |
506 | & readl(sock->addr + SOCK_CONTROL), | 516 | & readl(sock->addr + SOCK_CONTROL), |
507 | sock->addr + SOCK_CONTROL); | 517 | sock->addr + SOCK_CONTROL); |
508 | } else if (value == MEMSTICK_PARALLEL) { | 518 | } else if (value == MEMSTICK_PAR4) { |
509 | host->mode_mask = 0; | 519 | host->mode_mask = 0; |
510 | writel(TIFM_CTRL_FAST_CLK | 520 | writel(TIFM_CTRL_FAST_CLK |
511 | | readl(sock->addr + SOCK_CONTROL), | 521 | | readl(sock->addr + SOCK_CONTROL), |
@@ -532,21 +542,6 @@ static void tifm_ms_abort(unsigned long data) | |||
532 | tifm_eject(host->dev); | 542 | tifm_eject(host->dev); |
533 | } | 543 | } |
534 | 544 | ||
535 | static int tifm_ms_initialize_host(struct tifm_ms *host) | ||
536 | { | ||
537 | struct tifm_dev *sock = host->dev; | ||
538 | struct memstick_host *msh = tifm_get_drvdata(sock); | ||
539 | |||
540 | host->mode_mask = TIFM_MS_SERIAL; | ||
541 | writel(0x8000, sock->addr + SOCK_MS_SYSTEM); | ||
542 | writel(0x0200 | TIFM_MS_SYS_NOT_RDY, sock->addr + SOCK_MS_SYSTEM); | ||
543 | writel(0xffffffff, sock->addr + SOCK_MS_STATUS); | ||
544 | if (tifm_has_ms_pif(sock)) | ||
545 | msh->caps |= MEMSTICK_CAP_PARALLEL; | ||
546 | |||
547 | return 0; | ||
548 | } | ||
549 | |||
550 | static int tifm_ms_probe(struct tifm_dev *sock) | 545 | static int tifm_ms_probe(struct tifm_dev *sock) |
551 | { | 546 | { |
552 | struct memstick_host *msh; | 547 | struct memstick_host *msh; |
@@ -568,7 +563,6 @@ static int tifm_ms_probe(struct tifm_dev *sock) | |||
568 | tifm_set_drvdata(sock, msh); | 563 | tifm_set_drvdata(sock, msh); |
569 | host->dev = sock; | 564 | host->dev = sock; |
570 | host->timeout_jiffies = msecs_to_jiffies(1000); | 565 | host->timeout_jiffies = msecs_to_jiffies(1000); |
571 | host->no_dma = no_dma; | ||
572 | 566 | ||
573 | setup_timer(&host->timer, tifm_ms_abort, (unsigned long)host); | 567 | setup_timer(&host->timer, tifm_ms_abort, (unsigned long)host); |
574 | 568 | ||
@@ -576,10 +570,10 @@ static int tifm_ms_probe(struct tifm_dev *sock) | |||
576 | msh->set_param = tifm_ms_set_param; | 570 | msh->set_param = tifm_ms_set_param; |
577 | sock->card_event = tifm_ms_card_event; | 571 | sock->card_event = tifm_ms_card_event; |
578 | sock->data_event = tifm_ms_data_event; | 572 | sock->data_event = tifm_ms_data_event; |
579 | rc = tifm_ms_initialize_host(host); | 573 | if (tifm_has_ms_pif(sock)) |
574 | msh->caps |= MEMSTICK_CAP_PAR4; | ||
580 | 575 | ||
581 | if (!rc) | 576 | rc = memstick_add_host(msh); |
582 | rc = memstick_add_host(msh); | ||
583 | if (!rc) | 577 | if (!rc) |
584 | return 0; | 578 | return 0; |
585 | 579 | ||
@@ -601,7 +595,7 @@ static void tifm_ms_remove(struct tifm_dev *sock) | |||
601 | writel(TIFM_FIFO_INT_SETALL, | 595 | writel(TIFM_FIFO_INT_SETALL, |
602 | sock->addr + SOCK_DMA_FIFO_INT_ENABLE_CLEAR); | 596 | sock->addr + SOCK_DMA_FIFO_INT_ENABLE_CLEAR); |
603 | writel(TIFM_DMA_RESET, sock->addr + SOCK_DMA_CONTROL); | 597 | writel(TIFM_DMA_RESET, sock->addr + SOCK_DMA_CONTROL); |
604 | if ((host->req->io_type == MEMSTICK_IO_SG) && !host->no_dma) | 598 | if (host->use_dma) |
605 | tifm_unmap_sg(sock, &host->req->sg, 1, | 599 | tifm_unmap_sg(sock, &host->req->sg, 1, |
606 | host->req->data_dir == READ | 600 | host->req->data_dir == READ |
607 | ? PCI_DMA_TODEVICE | 601 | ? PCI_DMA_TODEVICE |
@@ -617,10 +611,6 @@ static void tifm_ms_remove(struct tifm_dev *sock) | |||
617 | spin_unlock_irqrestore(&sock->lock, flags); | 611 | spin_unlock_irqrestore(&sock->lock, flags); |
618 | 612 | ||
619 | memstick_remove_host(msh); | 613 | memstick_remove_host(msh); |
620 | |||
621 | writel(0x0200 | TIFM_MS_SYS_NOT_RDY, sock->addr + SOCK_MS_SYSTEM); | ||
622 | writel(0xffffffff, sock->addr + SOCK_MS_STATUS); | ||
623 | |||
624 | memstick_free_host(msh); | 614 | memstick_free_host(msh); |
625 | } | 615 | } |
626 | 616 | ||
@@ -628,17 +618,17 @@ static void tifm_ms_remove(struct tifm_dev *sock) | |||
628 | 618 | ||
629 | static int tifm_ms_suspend(struct tifm_dev *sock, pm_message_t state) | 619 | static int tifm_ms_suspend(struct tifm_dev *sock, pm_message_t state) |
630 | { | 620 | { |
621 | struct memstick_host *msh = tifm_get_drvdata(sock); | ||
622 | |||
623 | memstick_suspend_host(msh); | ||
631 | return 0; | 624 | return 0; |
632 | } | 625 | } |
633 | 626 | ||
634 | static int tifm_ms_resume(struct tifm_dev *sock) | 627 | static int tifm_ms_resume(struct tifm_dev *sock) |
635 | { | 628 | { |
636 | struct memstick_host *msh = tifm_get_drvdata(sock); | 629 | struct memstick_host *msh = tifm_get_drvdata(sock); |
637 | struct tifm_ms *host = memstick_priv(msh); | ||
638 | |||
639 | tifm_ms_initialize_host(host); | ||
640 | memstick_detect_change(msh); | ||
641 | 630 | ||
631 | memstick_resume_host(msh); | ||
642 | return 0; | 632 | return 0; |
643 | } | 633 | } |
644 | 634 | ||
@@ -679,7 +669,6 @@ MODULE_AUTHOR("Alex Dubov"); | |||
679 | MODULE_DESCRIPTION("TI FlashMedia MemoryStick driver"); | 669 | MODULE_DESCRIPTION("TI FlashMedia MemoryStick driver"); |
680 | MODULE_LICENSE("GPL"); | 670 | MODULE_LICENSE("GPL"); |
681 | MODULE_DEVICE_TABLE(tifm, tifm_ms_id_tbl); | 671 | MODULE_DEVICE_TABLE(tifm, tifm_ms_id_tbl); |
682 | MODULE_VERSION(DRIVER_VERSION); | ||
683 | 672 | ||
684 | module_init(tifm_ms_init); | 673 | module_init(tifm_ms_init); |
685 | module_exit(tifm_ms_exit); | 674 | module_exit(tifm_ms_exit); |
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/misc/tifm_7xx1.c b/drivers/misc/tifm_7xx1.c index 63a089b29545..67503ea71d21 100644 --- a/drivers/misc/tifm_7xx1.c +++ b/drivers/misc/tifm_7xx1.c | |||
@@ -368,6 +368,8 @@ static int tifm_7xx1_probe(struct pci_dev *dev, | |||
368 | goto err_out_irq; | 368 | goto err_out_irq; |
369 | 369 | ||
370 | writel(TIFM_IRQ_ENABLE | TIFM_IRQ_SOCKMASK((1 << fm->num_sockets) - 1), | 370 | writel(TIFM_IRQ_ENABLE | TIFM_IRQ_SOCKMASK((1 << fm->num_sockets) - 1), |
371 | fm->addr + FM_CLEAR_INTERRUPT_ENABLE); | ||
372 | writel(TIFM_IRQ_ENABLE | TIFM_IRQ_SOCKMASK((1 << fm->num_sockets) - 1), | ||
371 | fm->addr + FM_SET_INTERRUPT_ENABLE); | 373 | fm->addr + FM_SET_INTERRUPT_ENABLE); |
372 | return 0; | 374 | return 0; |
373 | 375 | ||
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/net/Kconfig b/drivers/net/Kconfig index a0f0e605d630..fe7b5ec09708 100644 --- a/drivers/net/Kconfig +++ b/drivers/net/Kconfig | |||
@@ -2366,15 +2366,15 @@ config GELIC_NET | |||
2366 | module will be called ps3_gelic. | 2366 | module will be called ps3_gelic. |
2367 | 2367 | ||
2368 | config GELIC_WIRELESS | 2368 | config GELIC_WIRELESS |
2369 | bool "PS3 Wireless support" | 2369 | bool "PS3 Wireless support" |
2370 | depends on GELIC_NET | 2370 | depends on GELIC_NET |
2371 | select WIRELESS_EXT | 2371 | select WIRELESS_EXT |
2372 | help | 2372 | help |
2373 | This option adds the support for the wireless feature of PS3. | 2373 | This option adds the support for the wireless feature of PS3. |
2374 | If you have the wireless-less model of PS3 or have no plan to | 2374 | If you have the wireless-less model of PS3 or have no plan to |
2375 | use wireless feature, disabling this option saves memory. As | 2375 | use wireless feature, disabling this option saves memory. As |
2376 | the driver automatically distinguishes the models, you can | 2376 | the driver automatically distinguishes the models, you can |
2377 | safely enable this option even if you have a wireless-less model. | 2377 | safely enable this option even if you have a wireless-less model. |
2378 | 2378 | ||
2379 | config GIANFAR | 2379 | config GIANFAR |
2380 | tristate "Gianfar Ethernet" | 2380 | tristate "Gianfar Ethernet" |
@@ -2519,7 +2519,7 @@ config CHELSIO_T3 | |||
2519 | 2519 | ||
2520 | config EHEA | 2520 | config EHEA |
2521 | tristate "eHEA Ethernet support" | 2521 | tristate "eHEA Ethernet support" |
2522 | depends on IBMEBUS && INET | 2522 | depends on IBMEBUS && INET && SPARSEMEM |
2523 | select INET_LRO | 2523 | select INET_LRO |
2524 | ---help--- | 2524 | ---help--- |
2525 | This driver supports the IBM pSeries eHEA ethernet adapter. | 2525 | This driver supports the IBM pSeries eHEA ethernet adapter. |
diff --git a/drivers/net/ac3200.c b/drivers/net/ac3200.c index 5136d94923aa..b1448637107f 100644 --- a/drivers/net/ac3200.c +++ b/drivers/net/ac3200.c | |||
@@ -369,7 +369,7 @@ MODULE_PARM_DESC(mem, "Memory base address(es)"); | |||
369 | MODULE_DESCRIPTION("Ansel AC3200 EISA ethernet driver"); | 369 | MODULE_DESCRIPTION("Ansel AC3200 EISA ethernet driver"); |
370 | MODULE_LICENSE("GPL"); | 370 | MODULE_LICENSE("GPL"); |
371 | 371 | ||
372 | int __init init_module(void) | 372 | static int __init ac3200_module_init(void) |
373 | { | 373 | { |
374 | struct net_device *dev; | 374 | struct net_device *dev; |
375 | int this_dev, found = 0; | 375 | int this_dev, found = 0; |
@@ -404,8 +404,7 @@ static void cleanup_card(struct net_device *dev) | |||
404 | iounmap(ei_status.mem); | 404 | iounmap(ei_status.mem); |
405 | } | 405 | } |
406 | 406 | ||
407 | void __exit | 407 | static void __exit ac3200_module_exit(void) |
408 | cleanup_module(void) | ||
409 | { | 408 | { |
410 | int this_dev; | 409 | int this_dev; |
411 | 410 | ||
@@ -418,4 +417,6 @@ cleanup_module(void) | |||
418 | } | 417 | } |
419 | } | 418 | } |
420 | } | 419 | } |
420 | module_init(ac3200_module_init); | ||
421 | module_exit(ac3200_module_exit); | ||
421 | #endif /* MODULE */ | 422 | #endif /* MODULE */ |
diff --git a/drivers/net/apne.c b/drivers/net/apne.c index c12cbdf368b1..47a8275d3962 100644 --- a/drivers/net/apne.c +++ b/drivers/net/apne.c | |||
@@ -569,7 +569,7 @@ static irqreturn_t apne_interrupt(int irq, void *dev_id) | |||
569 | #ifdef MODULE | 569 | #ifdef MODULE |
570 | static struct net_device *apne_dev; | 570 | static struct net_device *apne_dev; |
571 | 571 | ||
572 | int __init init_module(void) | 572 | static int __init apne_module_init(void) |
573 | { | 573 | { |
574 | apne_dev = apne_probe(-1); | 574 | apne_dev = apne_probe(-1); |
575 | if (IS_ERR(apne_dev)) | 575 | if (IS_ERR(apne_dev)) |
@@ -577,7 +577,7 @@ int __init init_module(void) | |||
577 | return 0; | 577 | return 0; |
578 | } | 578 | } |
579 | 579 | ||
580 | void __exit cleanup_module(void) | 580 | static void __exit apne_module_exit(void) |
581 | { | 581 | { |
582 | unregister_netdev(apne_dev); | 582 | unregister_netdev(apne_dev); |
583 | 583 | ||
@@ -591,7 +591,8 @@ void __exit cleanup_module(void) | |||
591 | 591 | ||
592 | free_netdev(apne_dev); | 592 | free_netdev(apne_dev); |
593 | } | 593 | } |
594 | 594 | module_init(apne_module_init); | |
595 | module_exit(apne_module_exit); | ||
595 | #endif | 596 | #endif |
596 | 597 | ||
597 | static int init_pcmcia(void) | 598 | static int init_pcmcia(void) |
diff --git a/drivers/net/appletalk/ltpc.c b/drivers/net/appletalk/ltpc.c index 6ab2c2d4d673..fef5560bc7a2 100644 --- a/drivers/net/appletalk/ltpc.c +++ b/drivers/net/appletalk/ltpc.c | |||
@@ -1252,7 +1252,7 @@ module_param(irq, int, 0); | |||
1252 | module_param(dma, int, 0); | 1252 | module_param(dma, int, 0); |
1253 | 1253 | ||
1254 | 1254 | ||
1255 | int __init init_module(void) | 1255 | static int __init ltpc_module_init(void) |
1256 | { | 1256 | { |
1257 | if(io == 0) | 1257 | if(io == 0) |
1258 | printk(KERN_NOTICE | 1258 | printk(KERN_NOTICE |
@@ -1263,6 +1263,7 @@ int __init init_module(void) | |||
1263 | return PTR_ERR(dev_ltpc); | 1263 | return PTR_ERR(dev_ltpc); |
1264 | return 0; | 1264 | return 0; |
1265 | } | 1265 | } |
1266 | module_init(ltpc_module_init); | ||
1266 | #endif | 1267 | #endif |
1267 | 1268 | ||
1268 | static void __exit ltpc_cleanup(void) | 1269 | static void __exit ltpc_cleanup(void) |
diff --git a/drivers/net/arcnet/capmode.c b/drivers/net/arcnet/capmode.c index cc4610db6395..02cb8f1c1148 100644 --- a/drivers/net/arcnet/capmode.c +++ b/drivers/net/arcnet/capmode.c | |||
@@ -80,17 +80,19 @@ void arcnet_cap_init(void) | |||
80 | 80 | ||
81 | #ifdef MODULE | 81 | #ifdef MODULE |
82 | 82 | ||
83 | int __init init_module(void) | 83 | static int __init capmode_module_init(void) |
84 | { | 84 | { |
85 | printk(VERSION); | 85 | printk(VERSION); |
86 | arcnet_cap_init(); | 86 | arcnet_cap_init(); |
87 | return 0; | 87 | return 0; |
88 | } | 88 | } |
89 | 89 | ||
90 | void cleanup_module(void) | 90 | static void __exit capmode_module_exit(void) |
91 | { | 91 | { |
92 | arcnet_unregister_proto(&capmode_proto); | 92 | arcnet_unregister_proto(&capmode_proto); |
93 | } | 93 | } |
94 | module_init(capmode_module_init); | ||
95 | module_exit(capmode_module_exit); | ||
94 | 96 | ||
95 | MODULE_LICENSE("GPL"); | 97 | MODULE_LICENSE("GPL"); |
96 | #endif /* MODULE */ | 98 | #endif /* MODULE */ |
diff --git a/drivers/net/atarilance.c b/drivers/net/atarilance.c index b74dbeef8050..13c293b286de 100644 --- a/drivers/net/atarilance.c +++ b/drivers/net/atarilance.c | |||
@@ -336,8 +336,6 @@ struct lance_addr { | |||
336 | 336 | ||
337 | /***************************** Prototypes *****************************/ | 337 | /***************************** Prototypes *****************************/ |
338 | 338 | ||
339 | static int addr_accessible( volatile void *regp, int wordflag, int | ||
340 | writeflag ); | ||
341 | static unsigned long lance_probe1( struct net_device *dev, struct lance_addr | 339 | static unsigned long lance_probe1( struct net_device *dev, struct lance_addr |
342 | *init_rec ); | 340 | *init_rec ); |
343 | static int lance_open( struct net_device *dev ); | 341 | static int lance_open( struct net_device *dev ); |
@@ -406,7 +404,8 @@ struct net_device * __init atarilance_probe(int unit) | |||
406 | 404 | ||
407 | /* Derived from hwreg_present() in atari/config.c: */ | 405 | /* Derived from hwreg_present() in atari/config.c: */ |
408 | 406 | ||
409 | static int __init addr_accessible( volatile void *regp, int wordflag, int writeflag ) | 407 | static noinline int __init addr_accessible(volatile void *regp, int wordflag, |
408 | int writeflag) | ||
410 | { | 409 | { |
411 | int ret; | 410 | int ret; |
412 | long flags; | 411 | long flags; |
diff --git a/drivers/net/e100.c b/drivers/net/e100.c index 36ba6dc96acc..cdf3090a1885 100644 --- a/drivers/net/e100.c +++ b/drivers/net/e100.c | |||
@@ -2782,16 +2782,13 @@ static void __devexit e100_remove(struct pci_dev *pdev) | |||
2782 | } | 2782 | } |
2783 | } | 2783 | } |
2784 | 2784 | ||
2785 | #ifdef CONFIG_PM | ||
2786 | static int e100_suspend(struct pci_dev *pdev, pm_message_t state) | 2785 | static int e100_suspend(struct pci_dev *pdev, pm_message_t state) |
2787 | { | 2786 | { |
2788 | struct net_device *netdev = pci_get_drvdata(pdev); | 2787 | struct net_device *netdev = pci_get_drvdata(pdev); |
2789 | struct nic *nic = netdev_priv(netdev); | 2788 | struct nic *nic = netdev_priv(netdev); |
2790 | 2789 | ||
2791 | if (netif_running(netdev)) | 2790 | if (netif_running(netdev)) |
2792 | napi_disable(&nic->napi); | 2791 | e100_down(nic); |
2793 | del_timer_sync(&nic->watchdog); | ||
2794 | netif_carrier_off(nic->netdev); | ||
2795 | netif_device_detach(netdev); | 2792 | netif_device_detach(netdev); |
2796 | 2793 | ||
2797 | pci_save_state(pdev); | 2794 | pci_save_state(pdev); |
@@ -2804,14 +2801,13 @@ static int e100_suspend(struct pci_dev *pdev, pm_message_t state) | |||
2804 | pci_enable_wake(pdev, PCI_D3cold, 0); | 2801 | pci_enable_wake(pdev, PCI_D3cold, 0); |
2805 | } | 2802 | } |
2806 | 2803 | ||
2807 | free_irq(pdev->irq, netdev); | ||
2808 | |||
2809 | pci_disable_device(pdev); | 2804 | pci_disable_device(pdev); |
2810 | pci_set_power_state(pdev, PCI_D3hot); | 2805 | pci_set_power_state(pdev, PCI_D3hot); |
2811 | 2806 | ||
2812 | return 0; | 2807 | return 0; |
2813 | } | 2808 | } |
2814 | 2809 | ||
2810 | #ifdef CONFIG_PM | ||
2815 | static int e100_resume(struct pci_dev *pdev) | 2811 | static int e100_resume(struct pci_dev *pdev) |
2816 | { | 2812 | { |
2817 | struct net_device *netdev = pci_get_drvdata(pdev); | 2813 | struct net_device *netdev = pci_get_drvdata(pdev); |
@@ -2832,26 +2828,7 @@ static int e100_resume(struct pci_dev *pdev) | |||
2832 | 2828 | ||
2833 | static void e100_shutdown(struct pci_dev *pdev) | 2829 | static void e100_shutdown(struct pci_dev *pdev) |
2834 | { | 2830 | { |
2835 | struct net_device *netdev = pci_get_drvdata(pdev); | 2831 | e100_suspend(pdev, PMSG_SUSPEND); |
2836 | struct nic *nic = netdev_priv(netdev); | ||
2837 | |||
2838 | if (netif_running(netdev)) | ||
2839 | napi_disable(&nic->napi); | ||
2840 | del_timer_sync(&nic->watchdog); | ||
2841 | netif_carrier_off(nic->netdev); | ||
2842 | |||
2843 | if ((nic->flags & wol_magic) | e100_asf(nic)) { | ||
2844 | pci_enable_wake(pdev, PCI_D3hot, 1); | ||
2845 | pci_enable_wake(pdev, PCI_D3cold, 1); | ||
2846 | } else { | ||
2847 | pci_enable_wake(pdev, PCI_D3hot, 0); | ||
2848 | pci_enable_wake(pdev, PCI_D3cold, 0); | ||
2849 | } | ||
2850 | |||
2851 | free_irq(pdev->irq, netdev); | ||
2852 | |||
2853 | pci_disable_device(pdev); | ||
2854 | pci_set_power_state(pdev, PCI_D3hot); | ||
2855 | } | 2832 | } |
2856 | 2833 | ||
2857 | /* ------------------ PCI Error Recovery infrastructure -------------- */ | 2834 | /* ------------------ PCI Error Recovery infrastructure -------------- */ |
diff --git a/drivers/net/enc28j60.c b/drivers/net/enc28j60.c index 0809a6a5a286..46a90e9ec563 100644 --- a/drivers/net/enc28j60.c +++ b/drivers/net/enc28j60.c | |||
@@ -900,7 +900,7 @@ static void enc28j60_hw_rx(struct net_device *ndev) | |||
900 | if (RSV_GETBIT(rxstat, RSV_LENCHECKERR)) | 900 | if (RSV_GETBIT(rxstat, RSV_LENCHECKERR)) |
901 | ndev->stats.rx_frame_errors++; | 901 | ndev->stats.rx_frame_errors++; |
902 | } else { | 902 | } else { |
903 | skb = dev_alloc_skb(len); | 903 | skb = dev_alloc_skb(len + NET_IP_ALIGN); |
904 | if (!skb) { | 904 | if (!skb) { |
905 | if (netif_msg_rx_err(priv)) | 905 | if (netif_msg_rx_err(priv)) |
906 | dev_err(&ndev->dev, | 906 | dev_err(&ndev->dev, |
@@ -908,6 +908,7 @@ static void enc28j60_hw_rx(struct net_device *ndev) | |||
908 | ndev->stats.rx_dropped++; | 908 | ndev->stats.rx_dropped++; |
909 | } else { | 909 | } else { |
910 | skb->dev = ndev; | 910 | skb->dev = ndev; |
911 | skb_reserve(skb, NET_IP_ALIGN); | ||
911 | /* copy the packet from the receive buffer */ | 912 | /* copy the packet from the receive buffer */ |
912 | enc28j60_mem_read(priv, priv->next_pk_ptr + sizeof(rsv), | 913 | enc28j60_mem_read(priv, priv->next_pk_ptr + sizeof(rsv), |
913 | len, skb_put(skb, len)); | 914 | len, skb_put(skb, len)); |
diff --git a/drivers/net/ixgbe/ixgbe_main.c b/drivers/net/ixgbe/ixgbe_main.c index 23d0a4afe0e1..c2095ce531c9 100644 --- a/drivers/net/ixgbe/ixgbe_main.c +++ b/drivers/net/ixgbe/ixgbe_main.c | |||
@@ -2133,7 +2133,7 @@ static void ixgbe_watchdog(unsigned long data) | |||
2133 | (link_speed == IXGBE_LINK_SPEED_10GB_FULL ? | 2133 | (link_speed == IXGBE_LINK_SPEED_10GB_FULL ? |
2134 | "10 Gbps" : | 2134 | "10 Gbps" : |
2135 | (link_speed == IXGBE_LINK_SPEED_1GB_FULL ? | 2135 | (link_speed == IXGBE_LINK_SPEED_1GB_FULL ? |
2136 | "1 Gpbs" : "unknown speed")), | 2136 | "1 Gbps" : "unknown speed")), |
2137 | ((FLOW_RX && FLOW_TX) ? "RX/TX" : | 2137 | ((FLOW_RX && FLOW_TX) ? "RX/TX" : |
2138 | (FLOW_RX ? "RX" : | 2138 | (FLOW_RX ? "RX" : |
2139 | (FLOW_TX ? "TX" : "None")))); | 2139 | (FLOW_TX ? "TX" : "None")))); |
diff --git a/drivers/net/mv643xx_eth.c b/drivers/net/mv643xx_eth.c index b528ce77c406..771139e283af 100644 --- a/drivers/net/mv643xx_eth.c +++ b/drivers/net/mv643xx_eth.c | |||
@@ -2104,6 +2104,7 @@ MODULE_LICENSE("GPL"); | |||
2104 | MODULE_AUTHOR( "Rabeeh Khoury, Assaf Hoffman, Matthew Dharm, Manish Lachwani" | 2104 | MODULE_AUTHOR( "Rabeeh Khoury, Assaf Hoffman, Matthew Dharm, Manish Lachwani" |
2105 | " and Dale Farnsworth"); | 2105 | " and Dale Farnsworth"); |
2106 | MODULE_DESCRIPTION("Ethernet driver for Marvell MV643XX"); | 2106 | MODULE_DESCRIPTION("Ethernet driver for Marvell MV643XX"); |
2107 | MODULE_ALIAS("platform:mv643xx_eth"); | ||
2107 | 2108 | ||
2108 | /* | 2109 | /* |
2109 | * The second part is the low level driver of the gigE ethernet ports. | 2110 | * The second part is the low level driver of the gigE ethernet ports. |
diff --git a/drivers/net/pcmcia/axnet_cs.c b/drivers/net/pcmcia/axnet_cs.c index e8a63e483a2b..ce95c5d168fe 100644 --- a/drivers/net/pcmcia/axnet_cs.c +++ b/drivers/net/pcmcia/axnet_cs.c | |||
@@ -1268,7 +1268,7 @@ static irqreturn_t ax_interrupt(int irq, void *dev_id) | |||
1268 | } | 1268 | } |
1269 | } | 1269 | } |
1270 | 1270 | ||
1271 | if (interrupts && ei_debug) | 1271 | if (interrupts && ei_debug > 3) |
1272 | { | 1272 | { |
1273 | handled = 1; | 1273 | handled = 1; |
1274 | if (nr_serviced >= MAX_SERVICE) | 1274 | if (nr_serviced >= MAX_SERVICE) |
diff --git a/drivers/net/phy/Kconfig b/drivers/net/phy/Kconfig index f4ca0591231d..3ac8529bb92c 100644 --- a/drivers/net/phy/Kconfig +++ b/drivers/net/phy/Kconfig | |||
@@ -67,6 +67,7 @@ config REALTEK_PHY | |||
67 | 67 | ||
68 | config FIXED_PHY | 68 | config FIXED_PHY |
69 | bool "Driver for MDIO Bus/PHY emulation with fixed speed/link PHYs" | 69 | bool "Driver for MDIO Bus/PHY emulation with fixed speed/link PHYs" |
70 | depends on PHYLIB=y | ||
70 | ---help--- | 71 | ---help--- |
71 | Adds the platform "fixed" MDIO Bus to cover the boards that use | 72 | Adds the platform "fixed" MDIO Bus to cover the boards that use |
72 | PHYs that are not connected to the real MDIO bus. | 73 | PHYs that are not connected to the real MDIO bus. |
diff --git a/drivers/net/phy/davicom.c b/drivers/net/phy/davicom.c index 7ed632db00d7..d926168bc780 100644 --- a/drivers/net/phy/davicom.c +++ b/drivers/net/phy/davicom.c | |||
@@ -37,6 +37,7 @@ | |||
37 | 37 | ||
38 | #define MII_DM9161_SCR 0x10 | 38 | #define MII_DM9161_SCR 0x10 |
39 | #define MII_DM9161_SCR_INIT 0x0610 | 39 | #define MII_DM9161_SCR_INIT 0x0610 |
40 | #define MII_DM9161_SCR_RMII 0x0100 | ||
40 | 41 | ||
41 | /* DM9161 Interrupt Register */ | 42 | /* DM9161 Interrupt Register */ |
42 | #define MII_DM9161_INTR 0x15 | 43 | #define MII_DM9161_INTR 0x15 |
@@ -103,7 +104,7 @@ static int dm9161_config_aneg(struct phy_device *phydev) | |||
103 | 104 | ||
104 | static int dm9161_config_init(struct phy_device *phydev) | 105 | static int dm9161_config_init(struct phy_device *phydev) |
105 | { | 106 | { |
106 | int err; | 107 | int err, temp; |
107 | 108 | ||
108 | /* Isolate the PHY */ | 109 | /* Isolate the PHY */ |
109 | err = phy_write(phydev, MII_BMCR, BMCR_ISOLATE); | 110 | err = phy_write(phydev, MII_BMCR, BMCR_ISOLATE); |
@@ -111,9 +112,19 @@ static int dm9161_config_init(struct phy_device *phydev) | |||
111 | if (err < 0) | 112 | if (err < 0) |
112 | return err; | 113 | return err; |
113 | 114 | ||
114 | /* Do not bypass the scrambler/descrambler */ | 115 | switch (phydev->interface) { |
115 | err = phy_write(phydev, MII_DM9161_SCR, MII_DM9161_SCR_INIT); | 116 | case PHY_INTERFACE_MODE_MII: |
117 | temp = MII_DM9161_SCR_INIT; | ||
118 | break; | ||
119 | case PHY_INTERFACE_MODE_RMII: | ||
120 | temp = MII_DM9161_SCR_INIT | MII_DM9161_SCR_RMII; | ||
121 | break; | ||
122 | default: | ||
123 | return -EINVAL; | ||
124 | } | ||
116 | 125 | ||
126 | /* Do not bypass the scrambler/descrambler */ | ||
127 | err = phy_write(phydev, MII_DM9161_SCR, temp); | ||
117 | if (err < 0) | 128 | if (err < 0) |
118 | return err; | 129 | return err; |
119 | 130 | ||
diff --git a/drivers/net/pppol2tp.c b/drivers/net/pppol2tp.c index 86e5dba079fe..3d10ca050b79 100644 --- a/drivers/net/pppol2tp.c +++ b/drivers/net/pppol2tp.c | |||
@@ -302,14 +302,14 @@ pppol2tp_session_find(struct pppol2tp_tunnel *tunnel, u16 session_id) | |||
302 | struct pppol2tp_session *session; | 302 | struct pppol2tp_session *session; |
303 | struct hlist_node *walk; | 303 | struct hlist_node *walk; |
304 | 304 | ||
305 | read_lock(&tunnel->hlist_lock); | 305 | read_lock_bh(&tunnel->hlist_lock); |
306 | hlist_for_each_entry(session, walk, session_list, hlist) { | 306 | hlist_for_each_entry(session, walk, session_list, hlist) { |
307 | if (session->tunnel_addr.s_session == session_id) { | 307 | if (session->tunnel_addr.s_session == session_id) { |
308 | read_unlock(&tunnel->hlist_lock); | 308 | read_unlock_bh(&tunnel->hlist_lock); |
309 | return session; | 309 | return session; |
310 | } | 310 | } |
311 | } | 311 | } |
312 | read_unlock(&tunnel->hlist_lock); | 312 | read_unlock_bh(&tunnel->hlist_lock); |
313 | 313 | ||
314 | return NULL; | 314 | return NULL; |
315 | } | 315 | } |
@@ -320,14 +320,14 @@ static struct pppol2tp_tunnel *pppol2tp_tunnel_find(u16 tunnel_id) | |||
320 | { | 320 | { |
321 | struct pppol2tp_tunnel *tunnel = NULL; | 321 | struct pppol2tp_tunnel *tunnel = NULL; |
322 | 322 | ||
323 | read_lock(&pppol2tp_tunnel_list_lock); | 323 | read_lock_bh(&pppol2tp_tunnel_list_lock); |
324 | list_for_each_entry(tunnel, &pppol2tp_tunnel_list, list) { | 324 | list_for_each_entry(tunnel, &pppol2tp_tunnel_list, list) { |
325 | if (tunnel->stats.tunnel_id == tunnel_id) { | 325 | if (tunnel->stats.tunnel_id == tunnel_id) { |
326 | read_unlock(&pppol2tp_tunnel_list_lock); | 326 | read_unlock_bh(&pppol2tp_tunnel_list_lock); |
327 | return tunnel; | 327 | return tunnel; |
328 | } | 328 | } |
329 | } | 329 | } |
330 | read_unlock(&pppol2tp_tunnel_list_lock); | 330 | read_unlock_bh(&pppol2tp_tunnel_list_lock); |
331 | 331 | ||
332 | return NULL; | 332 | return NULL; |
333 | } | 333 | } |
@@ -342,10 +342,11 @@ static struct pppol2tp_tunnel *pppol2tp_tunnel_find(u16 tunnel_id) | |||
342 | static void pppol2tp_recv_queue_skb(struct pppol2tp_session *session, struct sk_buff *skb) | 342 | static void pppol2tp_recv_queue_skb(struct pppol2tp_session *session, struct sk_buff *skb) |
343 | { | 343 | { |
344 | struct sk_buff *skbp; | 344 | struct sk_buff *skbp; |
345 | struct sk_buff *tmp; | ||
345 | u16 ns = PPPOL2TP_SKB_CB(skb)->ns; | 346 | u16 ns = PPPOL2TP_SKB_CB(skb)->ns; |
346 | 347 | ||
347 | spin_lock(&session->reorder_q.lock); | 348 | spin_lock_bh(&session->reorder_q.lock); |
348 | skb_queue_walk(&session->reorder_q, skbp) { | 349 | skb_queue_walk_safe(&session->reorder_q, skbp, tmp) { |
349 | if (PPPOL2TP_SKB_CB(skbp)->ns > ns) { | 350 | if (PPPOL2TP_SKB_CB(skbp)->ns > ns) { |
350 | __skb_insert(skb, skbp->prev, skbp, &session->reorder_q); | 351 | __skb_insert(skb, skbp->prev, skbp, &session->reorder_q); |
351 | PRINTK(session->debug, PPPOL2TP_MSG_SEQ, KERN_DEBUG, | 352 | PRINTK(session->debug, PPPOL2TP_MSG_SEQ, KERN_DEBUG, |
@@ -360,7 +361,7 @@ static void pppol2tp_recv_queue_skb(struct pppol2tp_session *session, struct sk_ | |||
360 | __skb_queue_tail(&session->reorder_q, skb); | 361 | __skb_queue_tail(&session->reorder_q, skb); |
361 | 362 | ||
362 | out: | 363 | out: |
363 | spin_unlock(&session->reorder_q.lock); | 364 | spin_unlock_bh(&session->reorder_q.lock); |
364 | } | 365 | } |
365 | 366 | ||
366 | /* Dequeue a single skb. | 367 | /* Dequeue a single skb. |
@@ -371,10 +372,9 @@ static void pppol2tp_recv_dequeue_skb(struct pppol2tp_session *session, struct s | |||
371 | int length = PPPOL2TP_SKB_CB(skb)->length; | 372 | int length = PPPOL2TP_SKB_CB(skb)->length; |
372 | struct sock *session_sock = NULL; | 373 | struct sock *session_sock = NULL; |
373 | 374 | ||
374 | /* We're about to requeue the skb, so unlink it and return resources | 375 | /* We're about to requeue the skb, so return resources |
375 | * to its current owner (a socket receive buffer). | 376 | * to its current owner (a socket receive buffer). |
376 | */ | 377 | */ |
377 | skb_unlink(skb, &session->reorder_q); | ||
378 | skb_orphan(skb); | 378 | skb_orphan(skb); |
379 | 379 | ||
380 | tunnel->stats.rx_packets++; | 380 | tunnel->stats.rx_packets++; |
@@ -442,7 +442,7 @@ static void pppol2tp_recv_dequeue(struct pppol2tp_session *session) | |||
442 | * expect to send up next, dequeue it and any other | 442 | * expect to send up next, dequeue it and any other |
443 | * in-sequence packets behind it. | 443 | * in-sequence packets behind it. |
444 | */ | 444 | */ |
445 | spin_lock(&session->reorder_q.lock); | 445 | spin_lock_bh(&session->reorder_q.lock); |
446 | skb_queue_walk_safe(&session->reorder_q, skb, tmp) { | 446 | skb_queue_walk_safe(&session->reorder_q, skb, tmp) { |
447 | if (time_after(jiffies, PPPOL2TP_SKB_CB(skb)->expires)) { | 447 | if (time_after(jiffies, PPPOL2TP_SKB_CB(skb)->expires)) { |
448 | session->stats.rx_seq_discards++; | 448 | session->stats.rx_seq_discards++; |
@@ -470,13 +470,18 @@ static void pppol2tp_recv_dequeue(struct pppol2tp_session *session) | |||
470 | goto out; | 470 | goto out; |
471 | } | 471 | } |
472 | } | 472 | } |
473 | spin_unlock(&session->reorder_q.lock); | 473 | __skb_unlink(skb, &session->reorder_q); |
474 | |||
475 | /* Process the skb. We release the queue lock while we | ||
476 | * do so to let other contexts process the queue. | ||
477 | */ | ||
478 | spin_unlock_bh(&session->reorder_q.lock); | ||
474 | pppol2tp_recv_dequeue_skb(session, skb); | 479 | pppol2tp_recv_dequeue_skb(session, skb); |
475 | spin_lock(&session->reorder_q.lock); | 480 | spin_lock_bh(&session->reorder_q.lock); |
476 | } | 481 | } |
477 | 482 | ||
478 | out: | 483 | out: |
479 | spin_unlock(&session->reorder_q.lock); | 484 | spin_unlock_bh(&session->reorder_q.lock); |
480 | } | 485 | } |
481 | 486 | ||
482 | /* Internal receive frame. Do the real work of receiving an L2TP data frame | 487 | /* Internal receive frame. Do the real work of receiving an L2TP data frame |
@@ -1059,7 +1064,7 @@ static int pppol2tp_xmit(struct ppp_channel *chan, struct sk_buff *skb) | |||
1059 | 1064 | ||
1060 | /* Get routing info from the tunnel socket */ | 1065 | /* Get routing info from the tunnel socket */ |
1061 | dst_release(skb->dst); | 1066 | dst_release(skb->dst); |
1062 | skb->dst = sk_dst_get(sk_tun); | 1067 | skb->dst = dst_clone(__sk_dst_get(sk_tun)); |
1063 | skb_orphan(skb); | 1068 | skb_orphan(skb); |
1064 | skb->sk = sk_tun; | 1069 | skb->sk = sk_tun; |
1065 | 1070 | ||
@@ -1107,7 +1112,7 @@ static void pppol2tp_tunnel_closeall(struct pppol2tp_tunnel *tunnel) | |||
1107 | PRINTK(tunnel->debug, PPPOL2TP_MSG_CONTROL, KERN_INFO, | 1112 | PRINTK(tunnel->debug, PPPOL2TP_MSG_CONTROL, KERN_INFO, |
1108 | "%s: closing all sessions...\n", tunnel->name); | 1113 | "%s: closing all sessions...\n", tunnel->name); |
1109 | 1114 | ||
1110 | write_lock(&tunnel->hlist_lock); | 1115 | write_lock_bh(&tunnel->hlist_lock); |
1111 | for (hash = 0; hash < PPPOL2TP_HASH_SIZE; hash++) { | 1116 | for (hash = 0; hash < PPPOL2TP_HASH_SIZE; hash++) { |
1112 | again: | 1117 | again: |
1113 | hlist_for_each_safe(walk, tmp, &tunnel->session_hlist[hash]) { | 1118 | hlist_for_each_safe(walk, tmp, &tunnel->session_hlist[hash]) { |
@@ -1129,7 +1134,7 @@ again: | |||
1129 | * disappear as we're jumping between locks. | 1134 | * disappear as we're jumping between locks. |
1130 | */ | 1135 | */ |
1131 | sock_hold(sk); | 1136 | sock_hold(sk); |
1132 | write_unlock(&tunnel->hlist_lock); | 1137 | write_unlock_bh(&tunnel->hlist_lock); |
1133 | lock_sock(sk); | 1138 | lock_sock(sk); |
1134 | 1139 | ||
1135 | if (sk->sk_state & (PPPOX_CONNECTED | PPPOX_BOUND)) { | 1140 | if (sk->sk_state & (PPPOX_CONNECTED | PPPOX_BOUND)) { |
@@ -1154,11 +1159,11 @@ again: | |||
1154 | * list so we are guaranteed to make forward | 1159 | * list so we are guaranteed to make forward |
1155 | * progress. | 1160 | * progress. |
1156 | */ | 1161 | */ |
1157 | write_lock(&tunnel->hlist_lock); | 1162 | write_lock_bh(&tunnel->hlist_lock); |
1158 | goto again; | 1163 | goto again; |
1159 | } | 1164 | } |
1160 | } | 1165 | } |
1161 | write_unlock(&tunnel->hlist_lock); | 1166 | write_unlock_bh(&tunnel->hlist_lock); |
1162 | } | 1167 | } |
1163 | 1168 | ||
1164 | /* Really kill the tunnel. | 1169 | /* Really kill the tunnel. |
@@ -1167,9 +1172,9 @@ again: | |||
1167 | static void pppol2tp_tunnel_free(struct pppol2tp_tunnel *tunnel) | 1172 | static void pppol2tp_tunnel_free(struct pppol2tp_tunnel *tunnel) |
1168 | { | 1173 | { |
1169 | /* Remove from socket list */ | 1174 | /* Remove from socket list */ |
1170 | write_lock(&pppol2tp_tunnel_list_lock); | 1175 | write_lock_bh(&pppol2tp_tunnel_list_lock); |
1171 | list_del_init(&tunnel->list); | 1176 | list_del_init(&tunnel->list); |
1172 | write_unlock(&pppol2tp_tunnel_list_lock); | 1177 | write_unlock_bh(&pppol2tp_tunnel_list_lock); |
1173 | 1178 | ||
1174 | atomic_dec(&pppol2tp_tunnel_count); | 1179 | atomic_dec(&pppol2tp_tunnel_count); |
1175 | kfree(tunnel); | 1180 | kfree(tunnel); |
@@ -1245,9 +1250,9 @@ static void pppol2tp_session_destruct(struct sock *sk) | |||
1245 | /* Delete the session socket from the | 1250 | /* Delete the session socket from the |
1246 | * hash | 1251 | * hash |
1247 | */ | 1252 | */ |
1248 | write_lock(&tunnel->hlist_lock); | 1253 | write_lock_bh(&tunnel->hlist_lock); |
1249 | hlist_del_init(&session->hlist); | 1254 | hlist_del_init(&session->hlist); |
1250 | write_unlock(&tunnel->hlist_lock); | 1255 | write_unlock_bh(&tunnel->hlist_lock); |
1251 | 1256 | ||
1252 | atomic_dec(&pppol2tp_session_count); | 1257 | atomic_dec(&pppol2tp_session_count); |
1253 | } | 1258 | } |
@@ -1392,9 +1397,9 @@ static struct sock *pppol2tp_prepare_tunnel_socket(int fd, u16 tunnel_id, | |||
1392 | 1397 | ||
1393 | /* Add tunnel to our list */ | 1398 | /* Add tunnel to our list */ |
1394 | INIT_LIST_HEAD(&tunnel->list); | 1399 | INIT_LIST_HEAD(&tunnel->list); |
1395 | write_lock(&pppol2tp_tunnel_list_lock); | 1400 | write_lock_bh(&pppol2tp_tunnel_list_lock); |
1396 | list_add(&tunnel->list, &pppol2tp_tunnel_list); | 1401 | list_add(&tunnel->list, &pppol2tp_tunnel_list); |
1397 | write_unlock(&pppol2tp_tunnel_list_lock); | 1402 | write_unlock_bh(&pppol2tp_tunnel_list_lock); |
1398 | atomic_inc(&pppol2tp_tunnel_count); | 1403 | atomic_inc(&pppol2tp_tunnel_count); |
1399 | 1404 | ||
1400 | /* Bump the reference count. The tunnel context is deleted | 1405 | /* Bump the reference count. The tunnel context is deleted |
@@ -1599,11 +1604,11 @@ static int pppol2tp_connect(struct socket *sock, struct sockaddr *uservaddr, | |||
1599 | sk->sk_user_data = session; | 1604 | sk->sk_user_data = session; |
1600 | 1605 | ||
1601 | /* Add session to the tunnel's hash list */ | 1606 | /* Add session to the tunnel's hash list */ |
1602 | write_lock(&tunnel->hlist_lock); | 1607 | write_lock_bh(&tunnel->hlist_lock); |
1603 | hlist_add_head(&session->hlist, | 1608 | hlist_add_head(&session->hlist, |
1604 | pppol2tp_session_id_hash(tunnel, | 1609 | pppol2tp_session_id_hash(tunnel, |
1605 | session->tunnel_addr.s_session)); | 1610 | session->tunnel_addr.s_session)); |
1606 | write_unlock(&tunnel->hlist_lock); | 1611 | write_unlock_bh(&tunnel->hlist_lock); |
1607 | 1612 | ||
1608 | atomic_inc(&pppol2tp_session_count); | 1613 | atomic_inc(&pppol2tp_session_count); |
1609 | 1614 | ||
@@ -2205,7 +2210,7 @@ static struct pppol2tp_session *next_session(struct pppol2tp_tunnel *tunnel, str | |||
2205 | int next = 0; | 2210 | int next = 0; |
2206 | int i; | 2211 | int i; |
2207 | 2212 | ||
2208 | read_lock(&tunnel->hlist_lock); | 2213 | read_lock_bh(&tunnel->hlist_lock); |
2209 | for (i = 0; i < PPPOL2TP_HASH_SIZE; i++) { | 2214 | for (i = 0; i < PPPOL2TP_HASH_SIZE; i++) { |
2210 | hlist_for_each_entry(session, walk, &tunnel->session_hlist[i], hlist) { | 2215 | hlist_for_each_entry(session, walk, &tunnel->session_hlist[i], hlist) { |
2211 | if (curr == NULL) { | 2216 | if (curr == NULL) { |
@@ -2223,7 +2228,7 @@ static struct pppol2tp_session *next_session(struct pppol2tp_tunnel *tunnel, str | |||
2223 | } | 2228 | } |
2224 | } | 2229 | } |
2225 | out: | 2230 | out: |
2226 | read_unlock(&tunnel->hlist_lock); | 2231 | read_unlock_bh(&tunnel->hlist_lock); |
2227 | if (!found) | 2232 | if (!found) |
2228 | session = NULL; | 2233 | session = NULL; |
2229 | 2234 | ||
@@ -2234,13 +2239,13 @@ static struct pppol2tp_tunnel *next_tunnel(struct pppol2tp_tunnel *curr) | |||
2234 | { | 2239 | { |
2235 | struct pppol2tp_tunnel *tunnel = NULL; | 2240 | struct pppol2tp_tunnel *tunnel = NULL; |
2236 | 2241 | ||
2237 | read_lock(&pppol2tp_tunnel_list_lock); | 2242 | read_lock_bh(&pppol2tp_tunnel_list_lock); |
2238 | if (list_is_last(&curr->list, &pppol2tp_tunnel_list)) { | 2243 | if (list_is_last(&curr->list, &pppol2tp_tunnel_list)) { |
2239 | goto out; | 2244 | goto out; |
2240 | } | 2245 | } |
2241 | tunnel = list_entry(curr->list.next, struct pppol2tp_tunnel, list); | 2246 | tunnel = list_entry(curr->list.next, struct pppol2tp_tunnel, list); |
2242 | out: | 2247 | out: |
2243 | read_unlock(&pppol2tp_tunnel_list_lock); | 2248 | read_unlock_bh(&pppol2tp_tunnel_list_lock); |
2244 | 2249 | ||
2245 | return tunnel; | 2250 | return tunnel; |
2246 | } | 2251 | } |
diff --git a/drivers/net/s2io.c b/drivers/net/s2io.c index 6179a0a2032c..c72787adeba3 100644 --- a/drivers/net/s2io.c +++ b/drivers/net/s2io.c | |||
@@ -1088,7 +1088,7 @@ static int s2io_print_pci_mode(struct s2io_nic *nic) | |||
1088 | * '-1' on failure | 1088 | * '-1' on failure |
1089 | */ | 1089 | */ |
1090 | 1090 | ||
1091 | int init_tti(struct s2io_nic *nic, int link) | 1091 | static int init_tti(struct s2io_nic *nic, int link) |
1092 | { | 1092 | { |
1093 | struct XENA_dev_config __iomem *bar0 = nic->bar0; | 1093 | struct XENA_dev_config __iomem *bar0 = nic->bar0; |
1094 | register u64 val64 = 0; | 1094 | register u64 val64 = 0; |
diff --git a/drivers/net/tulip/de2104x.c b/drivers/net/tulip/de2104x.c index 77d9dd7ea34f..567c62757e9d 100644 --- a/drivers/net/tulip/de2104x.c +++ b/drivers/net/tulip/de2104x.c | |||
@@ -910,7 +910,8 @@ static void de_set_media (struct de_private *de) | |||
910 | unsigned media = de->media_type; | 910 | unsigned media = de->media_type; |
911 | u32 macmode = dr32(MacMode); | 911 | u32 macmode = dr32(MacMode); |
912 | 912 | ||
913 | BUG_ON(de_is_running(de)); | 913 | if (de_is_running(de)) |
914 | printk(KERN_WARNING "%s: chip is running while changing media!\n", de->dev->name); | ||
914 | 915 | ||
915 | if (de->de21040) | 916 | if (de->de21040) |
916 | dw32(CSR11, FULL_DUPLEX_MAGIC); | 917 | dw32(CSR11, FULL_DUPLEX_MAGIC); |
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/sbni.c b/drivers/net/wan/sbni.c index 15d5c58e57bc..e59255a155a9 100644 --- a/drivers/net/wan/sbni.c +++ b/drivers/net/wan/sbni.c | |||
@@ -751,7 +751,7 @@ upload_data( struct net_device *dev, unsigned framelen, unsigned frameno, | |||
751 | } | 751 | } |
752 | 752 | ||
753 | 753 | ||
754 | static __inline void | 754 | static inline void |
755 | send_complete( struct net_local *nl ) | 755 | send_complete( struct net_local *nl ) |
756 | { | 756 | { |
757 | #ifdef CONFIG_SBNI_MULTILINE | 757 | #ifdef CONFIG_SBNI_MULTILINE |
diff --git a/drivers/net/wireless/libertas/cmdresp.c b/drivers/net/wireless/libertas/cmdresp.c index bdc6a1cc2103..f0ef7081bdeb 100644 --- a/drivers/net/wireless/libertas/cmdresp.c +++ b/drivers/net/wireless/libertas/cmdresp.c | |||
@@ -578,7 +578,7 @@ int lbs_process_rx_command(struct lbs_private *priv) | |||
578 | goto done; | 578 | goto done; |
579 | } | 579 | } |
580 | if (respcmd != CMD_RET(curcmd) && | 580 | if (respcmd != CMD_RET(curcmd) && |
581 | respcmd != CMD_802_11_ASSOCIATE && curcmd != CMD_RET_802_11_ASSOCIATE) { | 581 | respcmd != CMD_RET_802_11_ASSOCIATE && curcmd != CMD_802_11_ASSOCIATE) { |
582 | lbs_pr_info("Invalid CMD_RESP %x to command %x!\n", respcmd, curcmd); | 582 | lbs_pr_info("Invalid CMD_RESP %x to command %x!\n", respcmd, curcmd); |
583 | spin_unlock_irqrestore(&priv->driver_lock, flags); | 583 | spin_unlock_irqrestore(&priv->driver_lock, flags); |
584 | ret = -1; | 584 | ret = -1; |
diff --git a/drivers/net/wireless/rt2x00/rt61pci.c b/drivers/net/wireless/rt2x00/rt61pci.c index e808db98f2f5..93ea212fedd5 100644 --- a/drivers/net/wireless/rt2x00/rt61pci.c +++ b/drivers/net/wireless/rt2x00/rt61pci.c | |||
@@ -2302,9 +2302,9 @@ static void rt61pci_configure_filter(struct ieee80211_hw *hw, | |||
2302 | * Apply some rules to the filters: | 2302 | * Apply some rules to the filters: |
2303 | * - Some filters imply different filters to be set. | 2303 | * - Some filters imply different filters to be set. |
2304 | * - Some things we can't filter out at all. | 2304 | * - Some things we can't filter out at all. |
2305 | * - Multicast filter seems to kill broadcast traffic so never use it. | ||
2305 | */ | 2306 | */ |
2306 | if (mc_count) | 2307 | *total_flags |= FIF_ALLMULTI; |
2307 | *total_flags |= FIF_ALLMULTI; | ||
2308 | if (*total_flags & FIF_OTHER_BSS || | 2308 | if (*total_flags & FIF_OTHER_BSS || |
2309 | *total_flags & FIF_PROMISC_IN_BSS) | 2309 | *total_flags & FIF_PROMISC_IN_BSS) |
2310 | *total_flags |= FIF_PROMISC_IN_BSS | FIF_OTHER_BSS; | 2310 | *total_flags |= FIF_PROMISC_IN_BSS | FIF_OTHER_BSS; |
diff --git a/drivers/net/wireless/rt2x00/rt73usb.c b/drivers/net/wireless/rt2x00/rt73usb.c index 4fac2d414d84..8103d41a1543 100644 --- a/drivers/net/wireless/rt2x00/rt73usb.c +++ b/drivers/net/wireless/rt2x00/rt73usb.c | |||
@@ -1869,9 +1869,9 @@ static void rt73usb_configure_filter(struct ieee80211_hw *hw, | |||
1869 | * Apply some rules to the filters: | 1869 | * Apply some rules to the filters: |
1870 | * - Some filters imply different filters to be set. | 1870 | * - Some filters imply different filters to be set. |
1871 | * - Some things we can't filter out at all. | 1871 | * - Some things we can't filter out at all. |
1872 | * - Multicast filter seems to kill broadcast traffic so never use it. | ||
1872 | */ | 1873 | */ |
1873 | if (mc_count) | 1874 | *total_flags |= FIF_ALLMULTI; |
1874 | *total_flags |= FIF_ALLMULTI; | ||
1875 | if (*total_flags & FIF_OTHER_BSS || | 1875 | if (*total_flags & FIF_OTHER_BSS || |
1876 | *total_flags & FIF_PROMISC_IN_BSS) | 1876 | *total_flags & FIF_PROMISC_IN_BSS) |
1877 | *total_flags |= FIF_PROMISC_IN_BSS | FIF_OTHER_BSS; | 1877 | *total_flags |= FIF_PROMISC_IN_BSS | FIF_OTHER_BSS; |
@@ -2098,6 +2098,7 @@ static struct usb_device_id rt73usb_device_table[] = { | |||
2098 | /* D-Link */ | 2098 | /* D-Link */ |
2099 | { USB_DEVICE(0x07d1, 0x3c03), USB_DEVICE_DATA(&rt73usb_ops) }, | 2099 | { USB_DEVICE(0x07d1, 0x3c03), USB_DEVICE_DATA(&rt73usb_ops) }, |
2100 | { USB_DEVICE(0x07d1, 0x3c04), USB_DEVICE_DATA(&rt73usb_ops) }, | 2100 | { USB_DEVICE(0x07d1, 0x3c04), USB_DEVICE_DATA(&rt73usb_ops) }, |
2101 | { USB_DEVICE(0x07d1, 0x3c07), USB_DEVICE_DATA(&rt73usb_ops) }, | ||
2101 | /* Gemtek */ | 2102 | /* Gemtek */ |
2102 | { USB_DEVICE(0x15a9, 0x0004), USB_DEVICE_DATA(&rt73usb_ops) }, | 2103 | { USB_DEVICE(0x15a9, 0x0004), USB_DEVICE_DATA(&rt73usb_ops) }, |
2103 | /* Gigabyte */ | 2104 | /* Gigabyte */ |
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/ibmphp_ebda.c b/drivers/pci/hotplug/ibmphp_ebda.c index 600ed7b67ae7..bbccde9f228f 100644 --- a/drivers/pci/hotplug/ibmphp_ebda.c +++ b/drivers/pci/hotplug/ibmphp_ebda.c | |||
@@ -963,6 +963,7 @@ static int __init ebda_rsrc_controller (void) | |||
963 | 963 | ||
964 | bus_info_ptr1 = ibmphp_find_same_bus_num (hpc_ptr->slots[index].slot_bus_num); | 964 | bus_info_ptr1 = ibmphp_find_same_bus_num (hpc_ptr->slots[index].slot_bus_num); |
965 | if (!bus_info_ptr1) { | 965 | if (!bus_info_ptr1) { |
966 | kfree(tmp_slot); | ||
966 | rc = -ENODEV; | 967 | rc = -ENODEV; |
967 | goto error; | 968 | goto error; |
968 | } | 969 | } |
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/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/pnp/quirks.c b/drivers/pnp/quirks.c index 4065139753b6..37993206ae5d 100644 --- a/drivers/pnp/quirks.c +++ b/drivers/pnp/quirks.c | |||
@@ -17,7 +17,6 @@ | |||
17 | #include <linux/slab.h> | 17 | #include <linux/slab.h> |
18 | #include <linux/pnp.h> | 18 | #include <linux/pnp.h> |
19 | #include <linux/io.h> | 19 | #include <linux/io.h> |
20 | #include <linux/dmi.h> | ||
21 | #include <linux/kallsyms.h> | 20 | #include <linux/kallsyms.h> |
22 | #include "base.h" | 21 | #include "base.h" |
23 | 22 | ||
@@ -109,42 +108,73 @@ static void quirk_sb16audio_resources(struct pnp_dev *dev) | |||
109 | "pnp: SB audio device quirk - increasing port range\n"); | 108 | "pnp: SB audio device quirk - increasing port range\n"); |
110 | } | 109 | } |
111 | 110 | ||
112 | static void quirk_supermicro_h8dce_system(struct pnp_dev *dev) | 111 | |
112 | #include <linux/pci.h> | ||
113 | |||
114 | static void quirk_system_pci_resources(struct pnp_dev *dev) | ||
113 | { | 115 | { |
114 | int i; | 116 | struct pci_dev *pdev = NULL; |
115 | static struct dmi_system_id supermicro_h8dce[] = { | 117 | resource_size_t pnp_start, pnp_end, pci_start, pci_end; |
116 | { | 118 | int i, j; |
117 | .ident = "Supermicro H8DCE", | ||
118 | .matches = { | ||
119 | DMI_MATCH(DMI_SYS_VENDOR, "Supermicro"), | ||
120 | DMI_MATCH(DMI_PRODUCT_NAME, "H8DCE"), | ||
121 | }, | ||
122 | }, | ||
123 | { } | ||
124 | }; | ||
125 | |||
126 | if (!dmi_check_system(supermicro_h8dce)) | ||
127 | return; | ||
128 | 119 | ||
129 | /* | 120 | /* |
130 | * On the Supermicro H8DCE, there's a system device with resources | 121 | * Some BIOSes have PNP motherboard devices with resources that |
131 | * that overlap BAR 6 of the built-in SATA PCI adapter. If the PNP | 122 | * partially overlap PCI BARs. The PNP system driver claims these |
132 | * system device claims them, the sata_nv driver won't be able to. | 123 | * motherboard resources, which prevents the normal PCI driver from |
133 | * More details at: | 124 | * requesting them later. |
134 | * https://bugzilla.redhat.com/show_bug.cgi?id=280641 | 125 | * |
135 | * https://bugzilla.redhat.com/show_bug.cgi?id=313491 | 126 | * This patch disables the PNP resources that conflict with PCI BARs |
136 | * http://lkml.org/lkml/2008/1/9/449 | 127 | * so they won't be claimed by the PNP system driver. |
137 | * http://thread.gmane.org/gmane.linux.acpi.devel/27312 | ||
138 | */ | 128 | */ |
139 | for (i = 0; i < PNP_MAX_MEM; i++) { | 129 | for_each_pci_dev(pdev) { |
140 | if (pnp_mem_valid(dev, i) && pnp_mem_len(dev, i) && | 130 | for (i = 0; i < DEVICE_COUNT_RESOURCE; i++) { |
141 | (pnp_mem_start(dev, i) & 0xdfef0000) == 0xdfef0000) { | 131 | if (!(pci_resource_flags(pdev, i) & IORESOURCE_MEM) || |
142 | dev_warn(&dev->dev, "disabling 0x%llx-0x%llx to prevent" | 132 | pci_resource_len(pdev, i) == 0) |
143 | " conflict with sata_nv PCI device\n", | 133 | continue; |
144 | (unsigned long long) pnp_mem_start(dev, i), | 134 | |
145 | (unsigned long long) (pnp_mem_start(dev, i) + | 135 | pci_start = pci_resource_start(pdev, i); |
146 | pnp_mem_len(dev, i) - 1)); | 136 | pci_end = pci_resource_end(pdev, i); |
147 | pnp_mem_flags(dev, i) = 0; | 137 | for (j = 0; j < PNP_MAX_MEM; j++) { |
138 | if (!pnp_mem_valid(dev, j) || | ||
139 | pnp_mem_len(dev, j) == 0) | ||
140 | continue; | ||
141 | |||
142 | pnp_start = pnp_mem_start(dev, j); | ||
143 | pnp_end = pnp_mem_end(dev, j); | ||
144 | |||
145 | /* | ||
146 | * If the PNP region doesn't overlap the PCI | ||
147 | * region at all, there's no problem. | ||
148 | */ | ||
149 | if (pnp_end < pci_start || pnp_start > pci_end) | ||
150 | continue; | ||
151 | |||
152 | /* | ||
153 | * If the PNP region completely encloses (or is | ||
154 | * at least as large as) the PCI region, that's | ||
155 | * also OK. For example, this happens when the | ||
156 | * PNP device describes a bridge with PCI | ||
157 | * behind it. | ||
158 | */ | ||
159 | if (pnp_start <= pci_start && | ||
160 | pnp_end >= pci_end) | ||
161 | continue; | ||
162 | |||
163 | /* | ||
164 | * Otherwise, the PNP region overlaps *part* of | ||
165 | * the PCI region, and that might prevent a PCI | ||
166 | * driver from requesting its resources. | ||
167 | */ | ||
168 | dev_warn(&dev->dev, "mem resource " | ||
169 | "(0x%llx-0x%llx) overlaps %s BAR %d " | ||
170 | "(0x%llx-0x%llx), disabling\n", | ||
171 | (unsigned long long) pnp_start, | ||
172 | (unsigned long long) pnp_end, | ||
173 | pci_name(pdev), i, | ||
174 | (unsigned long long) pci_start, | ||
175 | (unsigned long long) pci_end); | ||
176 | pnp_mem_flags(dev, j) = 0; | ||
177 | } | ||
148 | } | 178 | } |
149 | } | 179 | } |
150 | } | 180 | } |
@@ -169,8 +199,8 @@ static struct pnp_fixup pnp_fixups[] = { | |||
169 | {"CTL0043", quirk_sb16audio_resources}, | 199 | {"CTL0043", quirk_sb16audio_resources}, |
170 | {"CTL0044", quirk_sb16audio_resources}, | 200 | {"CTL0044", quirk_sb16audio_resources}, |
171 | {"CTL0045", quirk_sb16audio_resources}, | 201 | {"CTL0045", quirk_sb16audio_resources}, |
172 | {"PNP0c01", quirk_supermicro_h8dce_system}, | 202 | {"PNP0c01", quirk_system_pci_resources}, |
173 | {"PNP0c02", quirk_supermicro_h8dce_system}, | 203 | {"PNP0c02", quirk_system_pci_resources}, |
174 | {""} | 204 | {""} |
175 | }; | 205 | }; |
176 | 206 | ||
diff --git a/drivers/serial/of_serial.c b/drivers/serial/of_serial.c index a64d85821996..c0e50a461055 100644 --- a/drivers/serial/of_serial.c +++ b/drivers/serial/of_serial.c | |||
@@ -138,7 +138,7 @@ static struct of_device_id __devinitdata of_platform_serial_table[] = { | |||
138 | { /* end of list */ }, | 138 | { /* end of list */ }, |
139 | }; | 139 | }; |
140 | 140 | ||
141 | static struct of_platform_driver __devinitdata of_platform_serial_driver = { | 141 | static struct of_platform_driver of_platform_serial_driver = { |
142 | .owner = THIS_MODULE, | 142 | .owner = THIS_MODULE, |
143 | .name = "of_serial", | 143 | .name = "of_serial", |
144 | .probe = of_platform_serial_probe, | 144 | .probe = of_platform_serial_probe, |
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/usb/gadget/Kconfig b/drivers/usb/gadget/Kconfig index c13955164686..6f45dd669b33 100644 --- a/drivers/usb/gadget/Kconfig +++ b/drivers/usb/gadget/Kconfig | |||
@@ -131,7 +131,7 @@ config USB_ATMEL_USBA | |||
131 | 131 | ||
132 | config USB_GADGET_FSL_USB2 | 132 | config USB_GADGET_FSL_USB2 |
133 | boolean "Freescale Highspeed USB DR Peripheral Controller" | 133 | boolean "Freescale Highspeed USB DR Peripheral Controller" |
134 | depends on MPC834x || PPC_MPC831x | 134 | depends on FSL_SOC |
135 | select USB_GADGET_DUALSPEED | 135 | select USB_GADGET_DUALSPEED |
136 | help | 136 | help |
137 | Some of Freescale PowerPC processors have a High Speed | 137 | Some of Freescale PowerPC processors have a High Speed |
diff --git a/drivers/usb/host/ehci-hcd.c b/drivers/usb/host/ehci-hcd.c index b8ad55aff842..46ee7f4c0912 100644 --- a/drivers/usb/host/ehci-hcd.c +++ b/drivers/usb/host/ehci-hcd.c | |||
@@ -281,23 +281,44 @@ static void ehci_iaa_watchdog(unsigned long param) | |||
281 | { | 281 | { |
282 | struct ehci_hcd *ehci = (struct ehci_hcd *) param; | 282 | struct ehci_hcd *ehci = (struct ehci_hcd *) param; |
283 | unsigned long flags; | 283 | unsigned long flags; |
284 | u32 status, cmd; | ||
285 | 284 | ||
286 | spin_lock_irqsave (&ehci->lock, flags); | 285 | spin_lock_irqsave (&ehci->lock, flags); |
287 | WARN_ON(!ehci->reclaim); | ||
288 | 286 | ||
289 | status = ehci_readl(ehci, &ehci->regs->status); | 287 | /* Lost IAA irqs wedge things badly; seen first with a vt8235. |
290 | cmd = ehci_readl(ehci, &ehci->regs->command); | 288 | * So we need this watchdog, but must protect it against both |
291 | ehci_dbg(ehci, "IAA watchdog: status %x cmd %x\n", status, cmd); | 289 | * (a) SMP races against real IAA firing and retriggering, and |
292 | 290 | * (b) clean HC shutdown, when IAA watchdog was pending. | |
293 | /* lost IAA irqs wedge things badly; seen first with a vt8235 */ | 291 | */ |
294 | if (ehci->reclaim) { | 292 | if (ehci->reclaim |
295 | if (status & STS_IAA) { | 293 | && !timer_pending(&ehci->iaa_watchdog) |
296 | ehci_vdbg (ehci, "lost IAA\n"); | 294 | && HC_IS_RUNNING(ehci_to_hcd(ehci)->state)) { |
295 | u32 cmd, status; | ||
296 | |||
297 | /* If we get here, IAA is *REALLY* late. It's barely | ||
298 | * conceivable that the system is so busy that CMD_IAAD | ||
299 | * is still legitimately set, so let's be sure it's | ||
300 | * clear before we read STS_IAA. (The HC should clear | ||
301 | * CMD_IAAD when it sets STS_IAA.) | ||
302 | */ | ||
303 | cmd = ehci_readl(ehci, &ehci->regs->command); | ||
304 | if (cmd & CMD_IAAD) | ||
305 | ehci_writel(ehci, cmd & ~CMD_IAAD, | ||
306 | &ehci->regs->command); | ||
307 | |||
308 | /* If IAA is set here it either legitimately triggered | ||
309 | * before we cleared IAAD above (but _way_ late, so we'll | ||
310 | * still count it as lost) ... or a silicon erratum: | ||
311 | * - VIA seems to set IAA without triggering the IRQ; | ||
312 | * - IAAD potentially cleared without setting IAA. | ||
313 | */ | ||
314 | status = ehci_readl(ehci, &ehci->regs->status); | ||
315 | if ((status & STS_IAA) || !(cmd & CMD_IAAD)) { | ||
297 | COUNT (ehci->stats.lost_iaa); | 316 | COUNT (ehci->stats.lost_iaa); |
298 | ehci_writel(ehci, STS_IAA, &ehci->regs->status); | 317 | ehci_writel(ehci, STS_IAA, &ehci->regs->status); |
299 | } | 318 | } |
300 | ehci_writel(ehci, cmd & ~CMD_IAAD, &ehci->regs->command); | 319 | |
320 | ehci_vdbg(ehci, "IAA watchdog: status %x cmd %x\n", | ||
321 | status, cmd); | ||
301 | end_unlink_async(ehci); | 322 | end_unlink_async(ehci); |
302 | } | 323 | } |
303 | 324 | ||
@@ -631,7 +652,7 @@ static int ehci_run (struct usb_hcd *hcd) | |||
631 | static irqreturn_t ehci_irq (struct usb_hcd *hcd) | 652 | static irqreturn_t ehci_irq (struct usb_hcd *hcd) |
632 | { | 653 | { |
633 | struct ehci_hcd *ehci = hcd_to_ehci (hcd); | 654 | struct ehci_hcd *ehci = hcd_to_ehci (hcd); |
634 | u32 status, pcd_status = 0; | 655 | u32 status, pcd_status = 0, cmd; |
635 | int bh; | 656 | int bh; |
636 | 657 | ||
637 | spin_lock (&ehci->lock); | 658 | spin_lock (&ehci->lock); |
@@ -652,7 +673,7 @@ static irqreturn_t ehci_irq (struct usb_hcd *hcd) | |||
652 | 673 | ||
653 | /* clear (just) interrupts */ | 674 | /* clear (just) interrupts */ |
654 | ehci_writel(ehci, status, &ehci->regs->status); | 675 | ehci_writel(ehci, status, &ehci->regs->status); |
655 | ehci_readl(ehci, &ehci->regs->command); /* unblock posted write */ | 676 | cmd = ehci_readl(ehci, &ehci->regs->command); |
656 | bh = 0; | 677 | bh = 0; |
657 | 678 | ||
658 | #ifdef EHCI_VERBOSE_DEBUG | 679 | #ifdef EHCI_VERBOSE_DEBUG |
@@ -673,8 +694,17 @@ static irqreturn_t ehci_irq (struct usb_hcd *hcd) | |||
673 | 694 | ||
674 | /* complete the unlinking of some qh [4.15.2.3] */ | 695 | /* complete the unlinking of some qh [4.15.2.3] */ |
675 | if (status & STS_IAA) { | 696 | if (status & STS_IAA) { |
676 | COUNT (ehci->stats.reclaim); | 697 | /* guard against (alleged) silicon errata */ |
677 | end_unlink_async(ehci); | 698 | if (cmd & CMD_IAAD) { |
699 | ehci_writel(ehci, cmd & ~CMD_IAAD, | ||
700 | &ehci->regs->command); | ||
701 | ehci_dbg(ehci, "IAA with IAAD still set?\n"); | ||
702 | } | ||
703 | if (ehci->reclaim) { | ||
704 | COUNT(ehci->stats.reclaim); | ||
705 | end_unlink_async(ehci); | ||
706 | } else | ||
707 | ehci_dbg(ehci, "IAA with nothing to reclaim?\n"); | ||
678 | } | 708 | } |
679 | 709 | ||
680 | /* remote wakeup [4.3.1] */ | 710 | /* remote wakeup [4.3.1] */ |
@@ -781,7 +811,7 @@ static int ehci_urb_enqueue ( | |||
781 | static void unlink_async (struct ehci_hcd *ehci, struct ehci_qh *qh) | 811 | static void unlink_async (struct ehci_hcd *ehci, struct ehci_qh *qh) |
782 | { | 812 | { |
783 | /* failfast */ | 813 | /* failfast */ |
784 | if (!HC_IS_RUNNING(ehci_to_hcd(ehci)->state)) | 814 | if (!HC_IS_RUNNING(ehci_to_hcd(ehci)->state) && ehci->reclaim) |
785 | end_unlink_async(ehci); | 815 | end_unlink_async(ehci); |
786 | 816 | ||
787 | /* if it's not linked then there's nothing to do */ | 817 | /* if it's not linked then there's nothing to do */ |
diff --git a/drivers/usb/serial/cypress_m8.c b/drivers/usb/serial/cypress_m8.c index 08c65c1a3771..779d07851a4d 100644 --- a/drivers/usb/serial/cypress_m8.c +++ b/drivers/usb/serial/cypress_m8.c | |||
@@ -94,6 +94,7 @@ static struct usb_device_id id_table_earthmate [] = { | |||
94 | 94 | ||
95 | static struct usb_device_id id_table_cyphidcomrs232 [] = { | 95 | static struct usb_device_id id_table_cyphidcomrs232 [] = { |
96 | { USB_DEVICE(VENDOR_ID_CYPRESS, PRODUCT_ID_CYPHIDCOM) }, | 96 | { USB_DEVICE(VENDOR_ID_CYPRESS, PRODUCT_ID_CYPHIDCOM) }, |
97 | { USB_DEVICE(VENDOR_ID_POWERCOM, PRODUCT_ID_UPS) }, | ||
97 | { } /* Terminating entry */ | 98 | { } /* Terminating entry */ |
98 | }; | 99 | }; |
99 | 100 | ||
@@ -106,6 +107,7 @@ static struct usb_device_id id_table_combined [] = { | |||
106 | { USB_DEVICE(VENDOR_ID_DELORME, PRODUCT_ID_EARTHMATEUSB) }, | 107 | { USB_DEVICE(VENDOR_ID_DELORME, PRODUCT_ID_EARTHMATEUSB) }, |
107 | { USB_DEVICE(VENDOR_ID_DELORME, PRODUCT_ID_EARTHMATEUSB_LT20) }, | 108 | { USB_DEVICE(VENDOR_ID_DELORME, PRODUCT_ID_EARTHMATEUSB_LT20) }, |
108 | { USB_DEVICE(VENDOR_ID_CYPRESS, PRODUCT_ID_CYPHIDCOM) }, | 109 | { USB_DEVICE(VENDOR_ID_CYPRESS, PRODUCT_ID_CYPHIDCOM) }, |
110 | { USB_DEVICE(VENDOR_ID_POWERCOM, PRODUCT_ID_UPS) }, | ||
109 | { USB_DEVICE(VENDOR_ID_DAZZLE, PRODUCT_ID_CA42) }, | 111 | { USB_DEVICE(VENDOR_ID_DAZZLE, PRODUCT_ID_CA42) }, |
110 | { } /* Terminating entry */ | 112 | { } /* Terminating entry */ |
111 | }; | 113 | }; |
diff --git a/drivers/usb/serial/cypress_m8.h b/drivers/usb/serial/cypress_m8.h index e1c7c27e18b7..0388065bb794 100644 --- a/drivers/usb/serial/cypress_m8.h +++ b/drivers/usb/serial/cypress_m8.h | |||
@@ -19,6 +19,10 @@ | |||
19 | #define VENDOR_ID_CYPRESS 0x04b4 | 19 | #define VENDOR_ID_CYPRESS 0x04b4 |
20 | #define PRODUCT_ID_CYPHIDCOM 0x5500 | 20 | #define PRODUCT_ID_CYPHIDCOM 0x5500 |
21 | 21 | ||
22 | /* Powercom UPS, chip CY7C63723 */ | ||
23 | #define VENDOR_ID_POWERCOM 0x0d9f | ||
24 | #define PRODUCT_ID_UPS 0x0002 | ||
25 | |||
22 | /* Nokia CA-42 USB to serial cable */ | 26 | /* Nokia CA-42 USB to serial cable */ |
23 | #define VENDOR_ID_DAZZLE 0x07d0 | 27 | #define VENDOR_ID_DAZZLE 0x07d0 |
24 | #define PRODUCT_ID_CA42 0x4101 | 28 | #define PRODUCT_ID_CA42 0x4101 |
diff --git a/drivers/usb/serial/ftdi_sio.c b/drivers/usb/serial/ftdi_sio.c index 91dc433dbcf1..3abb3c863647 100644 --- a/drivers/usb/serial/ftdi_sio.c +++ b/drivers/usb/serial/ftdi_sio.c | |||
@@ -359,6 +359,7 @@ static struct usb_device_id id_table_combined [] = { | |||
359 | { USB_DEVICE(FTDI_VID, FTDI_MAXSTREAM_PID) }, | 359 | { USB_DEVICE(FTDI_VID, FTDI_MAXSTREAM_PID) }, |
360 | { USB_DEVICE(TML_VID, TML_USB_SERIAL_PID) }, | 360 | { USB_DEVICE(TML_VID, TML_USB_SERIAL_PID) }, |
361 | { USB_DEVICE(FTDI_VID, FTDI_ELSTER_UNICOM_PID) }, | 361 | { USB_DEVICE(FTDI_VID, FTDI_ELSTER_UNICOM_PID) }, |
362 | { USB_DEVICE(FTDI_VID, FTDI_PROPOX_JTAGCABLEII_PID) }, | ||
362 | { USB_DEVICE(OLIMEX_VID, OLIMEX_ARM_USB_OCD_PID), | 363 | { USB_DEVICE(OLIMEX_VID, OLIMEX_ARM_USB_OCD_PID), |
363 | .driver_info = (kernel_ulong_t)&ftdi_jtag_quirk }, | 364 | .driver_info = (kernel_ulong_t)&ftdi_jtag_quirk }, |
364 | { USB_DEVICE(FIC_VID, FIC_NEO1973_DEBUG_PID), | 365 | { USB_DEVICE(FIC_VID, FIC_NEO1973_DEBUG_PID), |
diff --git a/drivers/usb/serial/ftdi_sio.h b/drivers/usb/serial/ftdi_sio.h index e1eb742abcd5..6da539ede0ee 100644 --- a/drivers/usb/serial/ftdi_sio.h +++ b/drivers/usb/serial/ftdi_sio.h | |||
@@ -557,6 +557,9 @@ | |||
557 | #define TML_VID 0x1B91 /* Vendor ID */ | 557 | #define TML_VID 0x1B91 /* Vendor ID */ |
558 | #define TML_USB_SERIAL_PID 0x0064 /* USB - Serial Converter */ | 558 | #define TML_USB_SERIAL_PID 0x0064 /* USB - Serial Converter */ |
559 | 559 | ||
560 | /* Propox devices */ | ||
561 | #define FTDI_PROPOX_JTAGCABLEII_PID 0xD738 | ||
562 | |||
560 | /* Commands */ | 563 | /* Commands */ |
561 | #define FTDI_SIO_RESET 0 /* Reset the port */ | 564 | #define FTDI_SIO_RESET 0 /* Reset the port */ |
562 | #define FTDI_SIO_MODEM_CTRL 1 /* Set the modem control register */ | 565 | #define FTDI_SIO_MODEM_CTRL 1 /* Set the modem control register */ |
diff --git a/drivers/usb/serial/generic.c b/drivers/usb/serial/generic.c index 97fa3c428435..7cfce9dabb90 100644 --- a/drivers/usb/serial/generic.c +++ b/drivers/usb/serial/generic.c | |||
@@ -323,7 +323,7 @@ static void flush_and_resubmit_read_urb (struct usb_serial_port *port) | |||
323 | room = tty_buffer_request_room(tty, urb->actual_length); | 323 | room = tty_buffer_request_room(tty, urb->actual_length); |
324 | if (room) { | 324 | if (room) { |
325 | tty_insert_flip_string(tty, urb->transfer_buffer, room); | 325 | tty_insert_flip_string(tty, urb->transfer_buffer, room); |
326 | tty_flip_buffer_push(tty); /* is this allowed from an URB callback ? */ | 326 | tty_flip_buffer_push(tty); |
327 | } | 327 | } |
328 | } | 328 | } |
329 | 329 | ||
@@ -349,10 +349,12 @@ void usb_serial_generic_read_bulk_callback (struct urb *urb) | |||
349 | 349 | ||
350 | /* Throttle the device if requested by tty */ | 350 | /* Throttle the device if requested by tty */ |
351 | spin_lock_irqsave(&port->lock, flags); | 351 | spin_lock_irqsave(&port->lock, flags); |
352 | if (!(port->throttled = port->throttle_req)) | 352 | if (!(port->throttled = port->throttle_req)) { |
353 | /* Handle data and continue reading from device */ | 353 | spin_unlock_irqrestore(&port->lock, flags); |
354 | flush_and_resubmit_read_urb(port); | 354 | flush_and_resubmit_read_urb(port); |
355 | spin_unlock_irqrestore(&port->lock, flags); | 355 | } else { |
356 | spin_unlock_irqrestore(&port->lock, flags); | ||
357 | } | ||
356 | } | 358 | } |
357 | EXPORT_SYMBOL_GPL(usb_serial_generic_read_bulk_callback); | 359 | EXPORT_SYMBOL_GPL(usb_serial_generic_read_bulk_callback); |
358 | 360 | ||
diff --git a/drivers/usb/serial/option.c b/drivers/usb/serial/option.c index 828a4377ec6a..a396fbbdc9c2 100644 --- a/drivers/usb/serial/option.c +++ b/drivers/usb/serial/option.c | |||
@@ -111,6 +111,42 @@ static int option_send_setup(struct usb_serial_port *port); | |||
111 | #define HUAWEI_PRODUCT_E220BIS 0x1004 | 111 | #define HUAWEI_PRODUCT_E220BIS 0x1004 |
112 | 112 | ||
113 | #define NOVATELWIRELESS_VENDOR_ID 0x1410 | 113 | #define NOVATELWIRELESS_VENDOR_ID 0x1410 |
114 | |||
115 | /* MERLIN EVDO PRODUCTS */ | ||
116 | #define NOVATELWIRELESS_PRODUCT_V640 0x1100 | ||
117 | #define NOVATELWIRELESS_PRODUCT_V620 0x1110 | ||
118 | #define NOVATELWIRELESS_PRODUCT_V740 0x1120 | ||
119 | #define NOVATELWIRELESS_PRODUCT_V720 0x1130 | ||
120 | |||
121 | /* MERLIN HSDPA/HSPA PRODUCTS */ | ||
122 | #define NOVATELWIRELESS_PRODUCT_U730 0x1400 | ||
123 | #define NOVATELWIRELESS_PRODUCT_U740 0x1410 | ||
124 | #define NOVATELWIRELESS_PRODUCT_U870 0x1420 | ||
125 | #define NOVATELWIRELESS_PRODUCT_XU870 0x1430 | ||
126 | #define NOVATELWIRELESS_PRODUCT_X950D 0x1450 | ||
127 | |||
128 | /* EXPEDITE PRODUCTS */ | ||
129 | #define NOVATELWIRELESS_PRODUCT_EV620 0x2100 | ||
130 | #define NOVATELWIRELESS_PRODUCT_ES720 0x2110 | ||
131 | #define NOVATELWIRELESS_PRODUCT_E725 0x2120 | ||
132 | #define NOVATELWIRELESS_PRODUCT_EU730 0x2400 | ||
133 | #define NOVATELWIRELESS_PRODUCT_EU740 0x2410 | ||
134 | #define NOVATELWIRELESS_PRODUCT_EU870D 0x2420 | ||
135 | |||
136 | /* OVATION PRODUCTS */ | ||
137 | #define NOVATELWIRELESS_PRODUCT_MC727 0x4100 | ||
138 | #define NOVATELWIRELESS_PRODUCT_MC950D 0x4400 | ||
139 | |||
140 | /* FUTURE NOVATEL PRODUCTS */ | ||
141 | #define NOVATELWIRELESS_PRODUCT_EVDO_1 0x6000 | ||
142 | #define NOVATELWIRELESS_PRODUCT_HSPA_1 0x7000 | ||
143 | #define NOVATELWIRELESS_PRODUCT_EMBEDDED_1 0x8000 | ||
144 | #define NOVATELWIRELESS_PRODUCT_GLOBAL_1 0x9000 | ||
145 | #define NOVATELWIRELESS_PRODUCT_EVDO_2 0x6001 | ||
146 | #define NOVATELWIRELESS_PRODUCT_HSPA_2 0x7001 | ||
147 | #define NOVATELWIRELESS_PRODUCT_EMBEDDED_2 0x8001 | ||
148 | #define NOVATELWIRELESS_PRODUCT_GLOBAL_2 0x9001 | ||
149 | |||
114 | #define DELL_VENDOR_ID 0x413C | 150 | #define DELL_VENDOR_ID 0x413C |
115 | 151 | ||
116 | #define KYOCERA_VENDOR_ID 0x0c88 | 152 | #define KYOCERA_VENDOR_ID 0x0c88 |
@@ -168,21 +204,34 @@ static struct usb_device_id option_ids[] = { | |||
168 | { USB_DEVICE(HUAWEI_VENDOR_ID, HUAWEI_PRODUCT_E600) }, | 204 | { USB_DEVICE(HUAWEI_VENDOR_ID, HUAWEI_PRODUCT_E600) }, |
169 | { USB_DEVICE_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, HUAWEI_PRODUCT_E220, 0xff, 0xff, 0xff) }, | 205 | { USB_DEVICE_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, HUAWEI_PRODUCT_E220, 0xff, 0xff, 0xff) }, |
170 | { USB_DEVICE_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, HUAWEI_PRODUCT_E220BIS, 0xff, 0xff, 0xff) }, | 206 | { USB_DEVICE_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, HUAWEI_PRODUCT_E220BIS, 0xff, 0xff, 0xff) }, |
171 | { USB_DEVICE(NOVATELWIRELESS_VENDOR_ID, 0x1100) }, /* Novatel Merlin XS620/S640 */ | 207 | { USB_DEVICE(NOVATELWIRELESS_VENDOR_ID, NOVATELWIRELESS_PRODUCT_V640) }, /* Novatel Merlin V640/XV620 */ |
172 | { USB_DEVICE(NOVATELWIRELESS_VENDOR_ID, 0x1110) }, /* Novatel Merlin S620 */ | 208 | { USB_DEVICE(NOVATELWIRELESS_VENDOR_ID, NOVATELWIRELESS_PRODUCT_V620) }, /* Novatel Merlin V620/S620 */ |
173 | { USB_DEVICE(NOVATELWIRELESS_VENDOR_ID, 0x1120) }, /* Novatel Merlin EX720 */ | 209 | { USB_DEVICE(NOVATELWIRELESS_VENDOR_ID, NOVATELWIRELESS_PRODUCT_V740) }, /* Novatel Merlin EX720/V740/X720 */ |
174 | { USB_DEVICE(NOVATELWIRELESS_VENDOR_ID, 0x1130) }, /* Novatel Merlin S720 */ | 210 | { USB_DEVICE(NOVATELWIRELESS_VENDOR_ID, NOVATELWIRELESS_PRODUCT_V720) }, /* Novatel Merlin V720/S720/PC720 */ |
175 | { USB_DEVICE(NOVATELWIRELESS_VENDOR_ID, 0x1400) }, /* Novatel U730 */ | 211 | { USB_DEVICE(NOVATELWIRELESS_VENDOR_ID, NOVATELWIRELESS_PRODUCT_U730) }, /* Novatel U730/U740 (VF version) */ |
176 | { USB_DEVICE(NOVATELWIRELESS_VENDOR_ID, 0x1410) }, /* Novatel U740 */ | 212 | { USB_DEVICE(NOVATELWIRELESS_VENDOR_ID, NOVATELWIRELESS_PRODUCT_U740) }, /* Novatel U740 */ |
177 | { USB_DEVICE(NOVATELWIRELESS_VENDOR_ID, 0x1420) }, /* Novatel EU870 */ | 213 | { USB_DEVICE(NOVATELWIRELESS_VENDOR_ID, NOVATELWIRELESS_PRODUCT_U870) }, /* Novatel U870 */ |
178 | { USB_DEVICE(NOVATELWIRELESS_VENDOR_ID, 0x1430) }, /* Novatel Merlin XU870 HSDPA/3G */ | 214 | { USB_DEVICE(NOVATELWIRELESS_VENDOR_ID, NOVATELWIRELESS_PRODUCT_XU870) }, /* Novatel Merlin XU870 HSDPA/3G */ |
179 | { USB_DEVICE(NOVATELWIRELESS_VENDOR_ID, 0x2100) }, /* Novatel EV620 CDMA/EV-DO */ | 215 | { USB_DEVICE(NOVATELWIRELESS_VENDOR_ID, NOVATELWIRELESS_PRODUCT_X950D) }, /* Novatel X950D */ |
180 | { USB_DEVICE(NOVATELWIRELESS_VENDOR_ID, 0x2110) }, /* Novatel Merlin ES620 / Merlin ES720 / Ovation U720 */ | 216 | { USB_DEVICE(NOVATELWIRELESS_VENDOR_ID, NOVATELWIRELESS_PRODUCT_EV620) }, /* Novatel EV620/ES620 CDMA/EV-DO */ |
217 | { USB_DEVICE(NOVATELWIRELESS_VENDOR_ID, NOVATELWIRELESS_PRODUCT_ES720) }, /* Novatel ES620/ES720/U720/USB720 */ | ||
218 | { USB_DEVICE(NOVATELWIRELESS_VENDOR_ID, NOVATELWIRELESS_PRODUCT_E725) }, /* Novatel E725/E726 */ | ||
181 | { USB_DEVICE(NOVATELWIRELESS_VENDOR_ID, 0x2130) }, /* Novatel Merlin ES620 SM Bus */ | 219 | { USB_DEVICE(NOVATELWIRELESS_VENDOR_ID, 0x2130) }, /* Novatel Merlin ES620 SM Bus */ |
182 | { USB_DEVICE(NOVATELWIRELESS_VENDOR_ID, 0x2410) }, /* Novatel EU740 */ | 220 | { USB_DEVICE(NOVATELWIRELESS_VENDOR_ID, NOVATELWIRELESS_PRODUCT_EU730) }, /* Novatel EU730 and Vodafone EU740 */ |
183 | { USB_DEVICE(NOVATELWIRELESS_VENDOR_ID, 0x4100) }, /* Novatel U727 */ | 221 | { USB_DEVICE(NOVATELWIRELESS_VENDOR_ID, NOVATELWIRELESS_PRODUCT_EU740) }, /* Novatel non-Vodafone EU740 */ |
184 | { USB_DEVICE(NOVATELWIRELESS_VENDOR_ID, 0x4400) }, /* Novatel MC950 */ | 222 | { USB_DEVICE(NOVATELWIRELESS_VENDOR_ID, NOVATELWIRELESS_PRODUCT_EU870D) }, /* Novatel EU850D/EU860D/EU870D */ |
223 | { USB_DEVICE(NOVATELWIRELESS_VENDOR_ID, NOVATELWIRELESS_PRODUCT_MC950D) }, /* Novatel MC930D/MC950D */ | ||
224 | { USB_DEVICE(NOVATELWIRELESS_VENDOR_ID, NOVATELWIRELESS_PRODUCT_MC727) }, /* Novatel MC727/U727/USB727 */ | ||
185 | { USB_DEVICE(NOVATELWIRELESS_VENDOR_ID, 0x5010) }, /* Novatel U727 */ | 225 | { USB_DEVICE(NOVATELWIRELESS_VENDOR_ID, 0x5010) }, /* Novatel U727 */ |
226 | { USB_DEVICE(NOVATELWIRELESS_VENDOR_ID, NOVATELWIRELESS_PRODUCT_EVDO_1) }, /* Novatel EVDO product */ | ||
227 | { USB_DEVICE(NOVATELWIRELESS_VENDOR_ID, NOVATELWIRELESS_PRODUCT_HSPA_1) }, /* Novatel HSPA product */ | ||
228 | { USB_DEVICE(NOVATELWIRELESS_VENDOR_ID, NOVATELWIRELESS_PRODUCT_EMBEDDED_1) }, /* Novatel Embedded product */ | ||
229 | { USB_DEVICE(NOVATELWIRELESS_VENDOR_ID, NOVATELWIRELESS_PRODUCT_GLOBAL_1) }, /* Novatel Global product */ | ||
230 | { USB_DEVICE(NOVATELWIRELESS_VENDOR_ID, NOVATELWIRELESS_PRODUCT_EVDO_2) }, /* Novatel EVDO product */ | ||
231 | { USB_DEVICE(NOVATELWIRELESS_VENDOR_ID, NOVATELWIRELESS_PRODUCT_HSPA_2) }, /* Novatel HSPA product */ | ||
232 | { USB_DEVICE(NOVATELWIRELESS_VENDOR_ID, NOVATELWIRELESS_PRODUCT_EMBEDDED_2) }, /* Novatel Embedded product */ | ||
233 | { USB_DEVICE(NOVATELWIRELESS_VENDOR_ID, NOVATELWIRELESS_PRODUCT_GLOBAL_2) }, /* Novatel Global product */ | ||
234 | |||
186 | { USB_DEVICE(DELL_VENDOR_ID, 0x8114) }, /* Dell Wireless 5700 Mobile Broadband CDMA/EVDO Mini-Card == Novatel Expedite EV620 CDMA/EV-DO */ | 235 | { USB_DEVICE(DELL_VENDOR_ID, 0x8114) }, /* Dell Wireless 5700 Mobile Broadband CDMA/EVDO Mini-Card == Novatel Expedite EV620 CDMA/EV-DO */ |
187 | { USB_DEVICE(DELL_VENDOR_ID, 0x8115) }, /* Dell Wireless 5500 Mobile Broadband HSDPA Mini-Card == Novatel Expedite EU740 HSDPA/3G */ | 236 | { USB_DEVICE(DELL_VENDOR_ID, 0x8115) }, /* Dell Wireless 5500 Mobile Broadband HSDPA Mini-Card == Novatel Expedite EU740 HSDPA/3G */ |
188 | { USB_DEVICE(DELL_VENDOR_ID, 0x8116) }, /* Dell Wireless 5505 Mobile Broadband HSDPA Mini-Card == Novatel Expedite EU740 HSDPA/3G */ | 237 | { USB_DEVICE(DELL_VENDOR_ID, 0x8116) }, /* Dell Wireless 5505 Mobile Broadband HSDPA Mini-Card == Novatel Expedite EU740 HSDPA/3G */ |
diff --git a/drivers/usb/storage/sddr55.c b/drivers/usb/storage/sddr55.c index d43a3415e12f..6d14327c921d 100644 --- a/drivers/usb/storage/sddr55.c +++ b/drivers/usb/storage/sddr55.c | |||
@@ -522,8 +522,8 @@ int sddr55_reset(struct us_data *us) { | |||
522 | 522 | ||
523 | static unsigned long sddr55_get_capacity(struct us_data *us) { | 523 | static unsigned long sddr55_get_capacity(struct us_data *us) { |
524 | 524 | ||
525 | unsigned char manufacturerID; | 525 | unsigned char uninitialized_var(manufacturerID); |
526 | unsigned char deviceID; | 526 | unsigned char uninitialized_var(deviceID); |
527 | int result; | 527 | int result; |
528 | struct sddr55_card_info *info = (struct sddr55_card_info *)us->extra; | 528 | struct sddr55_card_info *info = (struct sddr55_card_info *)us->extra; |
529 | 529 | ||
diff --git a/drivers/video/Kconfig b/drivers/video/Kconfig index 758435f8a6f8..e0b0580705e4 100644 --- a/drivers/video/Kconfig +++ b/drivers/video/Kconfig | |||
@@ -553,6 +553,19 @@ config FB_BF54X_LQ043 | |||
553 | help | 553 | help |
554 | This is the framebuffer device driver for a SHARP LQ043T1DG01 TFT LCD | 554 | This is the framebuffer device driver for a SHARP LQ043T1DG01 TFT LCD |
555 | 555 | ||
556 | config FB_BFIN_T350MCQB | ||
557 | tristate "Varitronix COG-T350MCQB TFT LCD display (BF527 EZKIT)" | ||
558 | depends on FB && BLACKFIN | ||
559 | select BFIN_GPTIMERS | ||
560 | select FB_CFB_FILLRECT | ||
561 | select FB_CFB_COPYAREA | ||
562 | select FB_CFB_IMAGEBLIT | ||
563 | help | ||
564 | This is the framebuffer device driver for a Varitronix VL-PS-COG-T350MCQB-01 display TFT LCD | ||
565 | This display is a QVGA 320x240 24-bit RGB display interfaced by an 8-bit wide PPI | ||
566 | It uses PPI[0..7] PPI_FS1, PPI_FS2 and PPI_CLK. | ||
567 | |||
568 | |||
556 | config FB_STI | 569 | config FB_STI |
557 | tristate "HP STI frame buffer device support" | 570 | tristate "HP STI frame buffer device support" |
558 | depends on FB && PARISC | 571 | depends on FB && PARISC |
diff --git a/drivers/video/Makefile b/drivers/video/Makefile index 83e02b3429b6..03371c789039 100644 --- a/drivers/video/Makefile +++ b/drivers/video/Makefile | |||
@@ -122,6 +122,7 @@ obj-$(CONFIG_FB_EFI) += efifb.o | |||
122 | obj-$(CONFIG_FB_VGA16) += vga16fb.o | 122 | obj-$(CONFIG_FB_VGA16) += vga16fb.o |
123 | obj-$(CONFIG_FB_OF) += offb.o | 123 | obj-$(CONFIG_FB_OF) += offb.o |
124 | obj-$(CONFIG_FB_BF54X_LQ043) += bf54x-lq043fb.o | 124 | obj-$(CONFIG_FB_BF54X_LQ043) += bf54x-lq043fb.o |
125 | obj-$(CONFIG_FB_BFIN_T350MCQB) += bfin-t350mcqb-fb.o | ||
125 | 126 | ||
126 | # the test framebuffer is last | 127 | # the test framebuffer is last |
127 | obj-$(CONFIG_FB_VIRTUAL) += vfb.o | 128 | obj-$(CONFIG_FB_VIRTUAL) += vfb.o |
diff --git a/drivers/video/bf54x-lq043fb.c b/drivers/video/bf54x-lq043fb.c index 0ce791e6f79c..986a550c0439 100644 --- a/drivers/video/bf54x-lq043fb.c +++ b/drivers/video/bf54x-lq043fb.c | |||
@@ -8,7 +8,7 @@ | |||
8 | * | 8 | * |
9 | * | 9 | * |
10 | * Modified: | 10 | * Modified: |
11 | * Copyright 2004-2007 Analog Devices Inc. | 11 | * Copyright 2007-2008 Analog Devices Inc. |
12 | * | 12 | * |
13 | * Bugs: Enter bugs at http://blackfin.uclinux.org/ | 13 | * Bugs: Enter bugs at http://blackfin.uclinux.org/ |
14 | * | 14 | * |
@@ -241,7 +241,7 @@ static int request_ports(struct bfin_bf54xfb_info *fbi) | |||
241 | u16 eppi_req_18[] = EPPI0_18; | 241 | u16 eppi_req_18[] = EPPI0_18; |
242 | u16 disp = fbi->mach_info->disp; | 242 | u16 disp = fbi->mach_info->disp; |
243 | 243 | ||
244 | if (gpio_request(disp, NULL)) { | 244 | if (gpio_request(disp, DRIVER_NAME)) { |
245 | printk(KERN_ERR "Requesting GPIO %d faild\n", disp); | 245 | printk(KERN_ERR "Requesting GPIO %d faild\n", disp); |
246 | return -EFAULT; | 246 | return -EFAULT; |
247 | } | 247 | } |
@@ -672,7 +672,7 @@ static int __init bfin_bf54x_probe(struct platform_device *pdev) | |||
672 | &bfin_lq043fb_bl_ops); | 672 | &bfin_lq043fb_bl_ops); |
673 | bl_dev->props.max_brightness = 255; | 673 | bl_dev->props.max_brightness = 255; |
674 | 674 | ||
675 | lcd_dev = lcd_device_register(DRIVER_NAME, NULL, &bfin_lcd_ops); | 675 | lcd_dev = lcd_device_register(DRIVER_NAME, &pdev->dev, NULL, &bfin_lcd_ops); |
676 | lcd_dev->props.max_contrast = 255, printk(KERN_INFO "Done.\n"); | 676 | lcd_dev->props.max_contrast = 255, printk(KERN_INFO "Done.\n"); |
677 | #endif | 677 | #endif |
678 | 678 | ||
diff --git a/drivers/video/bfin-t350mcqb-fb.c b/drivers/video/bfin-t350mcqb-fb.c new file mode 100644 index 000000000000..a2bb2de9e020 --- /dev/null +++ b/drivers/video/bfin-t350mcqb-fb.c | |||
@@ -0,0 +1,685 @@ | |||
1 | /* | ||
2 | * File: drivers/video/bfin-t350mcqb-fb.c | ||
3 | * Based on: | ||
4 | * Author: Michael Hennerich <hennerich@blackfin.uclinux.org> | ||
5 | * | ||
6 | * Created: | ||
7 | * Description: Blackfin LCD Framebufer driver | ||
8 | * | ||
9 | * | ||
10 | * Modified: | ||
11 | * Copyright 2004-2007 Analog Devices Inc. | ||
12 | * | ||
13 | * Bugs: Enter bugs at http://blackfin.uclinux.org/ | ||
14 | * | ||
15 | * This program is free software; you can redistribute it and/or modify | ||
16 | * it under the terms of the GNU General Public License as published by | ||
17 | * the Free Software Foundation; either version 2 of the License, or | ||
18 | * (at your option) any later version. | ||
19 | * | ||
20 | * This program is distributed in the hope that it will be useful, | ||
21 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
22 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
23 | * GNU General Public License for more details. | ||
24 | * | ||
25 | * You should have received a copy of the GNU General Public License | ||
26 | * along with this program; if not, see the file COPYING, or write | ||
27 | * to the Free Software Foundation, Inc., | ||
28 | * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA | ||
29 | */ | ||
30 | |||
31 | #include <linux/module.h> | ||
32 | #include <linux/kernel.h> | ||
33 | #include <linux/errno.h> | ||
34 | #include <linux/string.h> | ||
35 | #include <linux/fb.h> | ||
36 | #include <linux/init.h> | ||
37 | #include <linux/types.h> | ||
38 | #include <linux/interrupt.h> | ||
39 | #include <linux/device.h> | ||
40 | #include <linux/backlight.h> | ||
41 | #include <linux/lcd.h> | ||
42 | #include <linux/dma-mapping.h> | ||
43 | #include <linux/platform_device.h> | ||
44 | |||
45 | #include <asm/blackfin.h> | ||
46 | #include <asm/irq.h> | ||
47 | #include <asm/dma-mapping.h> | ||
48 | #include <asm/dma.h> | ||
49 | #include <asm/portmux.h> | ||
50 | #include <asm/gptimers.h> | ||
51 | |||
52 | #define NO_BL_SUPPORT | ||
53 | |||
54 | #define LCD_X_RES 320 /* Horizontal Resolution */ | ||
55 | #define LCD_Y_RES 240 /* Vertical Resolution */ | ||
56 | #define LCD_BPP 24 /* Bit Per Pixel */ | ||
57 | |||
58 | #define DMA_BUS_SIZE 16 | ||
59 | #define LCD_CLK (12*1000*1000) /* 12MHz */ | ||
60 | |||
61 | #define CLOCKS_PER_PIX 3 | ||
62 | |||
63 | /* | ||
64 | * HS and VS timing parameters (all in number of PPI clk ticks) | ||
65 | */ | ||
66 | |||
67 | #define U_LINE 1 /* Blanking Lines */ | ||
68 | |||
69 | #define H_ACTPIX (LCD_X_RES * CLOCKS_PER_PIX) /* active horizontal pixel */ | ||
70 | #define H_PERIOD (408 * CLOCKS_PER_PIX) /* HS period */ | ||
71 | #define H_PULSE 90 /* HS pulse width */ | ||
72 | #define H_START 204 /* first valid pixel */ | ||
73 | |||
74 | #define V_LINES (LCD_Y_RES + U_LINE) /* total vertical lines */ | ||
75 | #define V_PULSE (3 * H_PERIOD) /* VS pulse width (1-5 H_PERIODs) */ | ||
76 | #define V_PERIOD (H_PERIOD * V_LINES) /* VS period */ | ||
77 | |||
78 | #define ACTIVE_VIDEO_MEM_OFFSET (U_LINE * H_ACTPIX) | ||
79 | |||
80 | #define BFIN_LCD_NBR_PALETTE_ENTRIES 256 | ||
81 | |||
82 | #define DRIVER_NAME "bfin-t350mcqb" | ||
83 | static char driver_name[] = DRIVER_NAME; | ||
84 | |||
85 | struct bfin_t350mcqbfb_info { | ||
86 | struct fb_info *fb; | ||
87 | struct device *dev; | ||
88 | unsigned char *fb_buffer; /* RGB Buffer */ | ||
89 | dma_addr_t dma_handle; | ||
90 | int lq043_mmap; | ||
91 | int lq043_open_cnt; | ||
92 | int irq; | ||
93 | spinlock_t lock; /* lock */ | ||
94 | }; | ||
95 | |||
96 | static int nocursor; | ||
97 | module_param(nocursor, int, 0644); | ||
98 | MODULE_PARM_DESC(nocursor, "cursor enable/disable"); | ||
99 | |||
100 | #define PPI_TX_MODE 0x2 | ||
101 | #define PPI_XFER_TYPE_11 0xC | ||
102 | #define PPI_PORT_CFG_01 0x10 | ||
103 | #define PPI_PACK_EN 0x80 | ||
104 | #define PPI_POLS_1 0x8000 | ||
105 | |||
106 | static void bfin_t350mcqb_config_ppi(struct bfin_t350mcqbfb_info *fbi) | ||
107 | { | ||
108 | bfin_write_PPI_DELAY(H_START); | ||
109 | bfin_write_PPI_COUNT(H_ACTPIX-1); | ||
110 | bfin_write_PPI_FRAME(V_LINES); | ||
111 | |||
112 | bfin_write_PPI_CONTROL(PPI_TX_MODE | /* output mode , PORT_DIR */ | ||
113 | PPI_XFER_TYPE_11 | /* sync mode XFR_TYPE */ | ||
114 | PPI_PORT_CFG_01 | /* two frame sync PORT_CFG */ | ||
115 | PPI_PACK_EN | /* packing enabled PACK_EN */ | ||
116 | PPI_POLS_1); /* faling edge syncs POLS */ | ||
117 | } | ||
118 | |||
119 | static inline void bfin_t350mcqb_disable_ppi(void) | ||
120 | { | ||
121 | bfin_write_PPI_CONTROL(bfin_read_PPI_CONTROL() & ~PORT_EN); | ||
122 | } | ||
123 | |||
124 | static inline void bfin_t350mcqb_enable_ppi(void) | ||
125 | { | ||
126 | bfin_write_PPI_CONTROL(bfin_read_PPI_CONTROL() | PORT_EN); | ||
127 | } | ||
128 | |||
129 | static void bfin_t350mcqb_start_timers(void) | ||
130 | { | ||
131 | unsigned long flags; | ||
132 | |||
133 | local_irq_save(flags); | ||
134 | enable_gptimers(TIMER1bit); | ||
135 | enable_gptimers(TIMER0bit); | ||
136 | local_irq_restore(flags); | ||
137 | } | ||
138 | |||
139 | static void bfin_t350mcqb_stop_timers(void) | ||
140 | { | ||
141 | disable_gptimers(TIMER0bit | TIMER1bit); | ||
142 | |||
143 | set_gptimer_status(0, TIMER_STATUS_TRUN0 | TIMER_STATUS_TRUN1 | | ||
144 | TIMER_STATUS_TIMIL0 | TIMER_STATUS_TIMIL1 | | ||
145 | TIMER_STATUS_TOVF0 | TIMER_STATUS_TOVF1); | ||
146 | |||
147 | } | ||
148 | |||
149 | static void bfin_t350mcqb_init_timers(void) | ||
150 | { | ||
151 | |||
152 | bfin_t350mcqb_stop_timers(); | ||
153 | |||
154 | set_gptimer_period(TIMER0_id, H_PERIOD); | ||
155 | set_gptimer_pwidth(TIMER0_id, H_PULSE); | ||
156 | set_gptimer_config(TIMER0_id, TIMER_MODE_PWM | TIMER_PERIOD_CNT | | ||
157 | TIMER_TIN_SEL | TIMER_CLK_SEL| | ||
158 | TIMER_EMU_RUN); | ||
159 | |||
160 | set_gptimer_period(TIMER1_id, V_PERIOD); | ||
161 | set_gptimer_pwidth(TIMER1_id, V_PULSE); | ||
162 | set_gptimer_config(TIMER1_id, TIMER_MODE_PWM | TIMER_PERIOD_CNT | | ||
163 | TIMER_TIN_SEL | TIMER_CLK_SEL | | ||
164 | TIMER_EMU_RUN); | ||
165 | |||
166 | } | ||
167 | |||
168 | static void bfin_t350mcqb_config_dma(struct bfin_t350mcqbfb_info *fbi) | ||
169 | { | ||
170 | |||
171 | set_dma_config(CH_PPI, | ||
172 | set_bfin_dma_config(DIR_READ, DMA_FLOW_AUTO, | ||
173 | INTR_DISABLE, DIMENSION_2D, | ||
174 | DATA_SIZE_16, | ||
175 | DMA_NOSYNC_KEEP_DMA_BUF)); | ||
176 | set_dma_x_count(CH_PPI, (LCD_X_RES * LCD_BPP) / DMA_BUS_SIZE); | ||
177 | set_dma_x_modify(CH_PPI, DMA_BUS_SIZE / 8); | ||
178 | set_dma_y_count(CH_PPI, V_LINES); | ||
179 | |||
180 | set_dma_y_modify(CH_PPI, DMA_BUS_SIZE / 8); | ||
181 | set_dma_start_addr(CH_PPI, (unsigned long)fbi->fb_buffer); | ||
182 | |||
183 | } | ||
184 | |||
185 | static int bfin_t350mcqb_request_ports(int action) | ||
186 | { | ||
187 | u16 ppi0_req_8[] = {P_PPI0_CLK, P_PPI0_FS1, P_PPI0_FS2, | ||
188 | P_PPI0_D0, P_PPI0_D1, P_PPI0_D2, | ||
189 | P_PPI0_D3, P_PPI0_D4, P_PPI0_D5, | ||
190 | P_PPI0_D6, P_PPI0_D7, 0}; | ||
191 | |||
192 | if (action) { | ||
193 | if (peripheral_request_list(ppi0_req_8, DRIVER_NAME)) { | ||
194 | printk(KERN_ERR "Requesting Peripherals faild\n"); | ||
195 | return -EFAULT; | ||
196 | } | ||
197 | } else | ||
198 | peripheral_free_list(ppi0_req_8); | ||
199 | |||
200 | return 0; | ||
201 | } | ||
202 | |||
203 | static int bfin_t350mcqb_fb_open(struct fb_info *info, int user) | ||
204 | { | ||
205 | struct bfin_t350mcqbfb_info *fbi = info->par; | ||
206 | |||
207 | spin_lock(&fbi->lock); | ||
208 | fbi->lq043_open_cnt++; | ||
209 | |||
210 | if (fbi->lq043_open_cnt <= 1) { | ||
211 | |||
212 | bfin_t350mcqb_disable_ppi(); | ||
213 | SSYNC(); | ||
214 | |||
215 | bfin_t350mcqb_config_dma(fbi); | ||
216 | bfin_t350mcqb_config_ppi(fbi); | ||
217 | bfin_t350mcqb_init_timers(); | ||
218 | |||
219 | /* start dma */ | ||
220 | enable_dma(CH_PPI); | ||
221 | bfin_t350mcqb_enable_ppi(); | ||
222 | bfin_t350mcqb_start_timers(); | ||
223 | } | ||
224 | |||
225 | spin_unlock(&fbi->lock); | ||
226 | |||
227 | return 0; | ||
228 | } | ||
229 | |||
230 | static int bfin_t350mcqb_fb_release(struct fb_info *info, int user) | ||
231 | { | ||
232 | struct bfin_t350mcqbfb_info *fbi = info->par; | ||
233 | |||
234 | spin_lock(&fbi->lock); | ||
235 | |||
236 | fbi->lq043_open_cnt--; | ||
237 | fbi->lq043_mmap = 0; | ||
238 | |||
239 | if (fbi->lq043_open_cnt <= 0) { | ||
240 | bfin_t350mcqb_disable_ppi(); | ||
241 | SSYNC(); | ||
242 | disable_dma(CH_PPI); | ||
243 | bfin_t350mcqb_stop_timers(); | ||
244 | memset(fbi->fb_buffer, 0, info->fix.smem_len); | ||
245 | } | ||
246 | |||
247 | spin_unlock(&fbi->lock); | ||
248 | |||
249 | return 0; | ||
250 | } | ||
251 | |||
252 | static int bfin_t350mcqb_fb_check_var(struct fb_var_screeninfo *var, | ||
253 | struct fb_info *info) | ||
254 | { | ||
255 | |||
256 | if (var->bits_per_pixel != LCD_BPP) { | ||
257 | pr_debug("%s: depth not supported: %u BPP\n", __FUNCTION__, | ||
258 | var->bits_per_pixel); | ||
259 | return -EINVAL; | ||
260 | } | ||
261 | |||
262 | if (info->var.xres != var->xres || info->var.yres != var->yres || | ||
263 | info->var.xres_virtual != var->xres_virtual || | ||
264 | info->var.yres_virtual != var->yres_virtual) { | ||
265 | pr_debug("%s: Resolution not supported: X%u x Y%u \n", | ||
266 | __FUNCTION__, var->xres, var->yres); | ||
267 | return -EINVAL; | ||
268 | } | ||
269 | |||
270 | /* | ||
271 | * Memory limit | ||
272 | */ | ||
273 | |||
274 | if ((info->fix.line_length * var->yres_virtual) > info->fix.smem_len) { | ||
275 | pr_debug("%s: Memory Limit requested yres_virtual = %u\n", | ||
276 | __FUNCTION__, var->yres_virtual); | ||
277 | return -ENOMEM; | ||
278 | } | ||
279 | |||
280 | return 0; | ||
281 | } | ||
282 | |||
283 | static int bfin_t350mcqb_fb_mmap(struct fb_info *info, struct vm_area_struct *vma) | ||
284 | { | ||
285 | struct bfin_t350mcqbfb_info *fbi = info->par; | ||
286 | |||
287 | if (fbi->lq043_mmap) | ||
288 | return -1; | ||
289 | |||
290 | spin_lock(&fbi->lock); | ||
291 | fbi->lq043_mmap = 1; | ||
292 | spin_unlock(&fbi->lock); | ||
293 | |||
294 | vma->vm_start = (unsigned long)(fbi->fb_buffer + ACTIVE_VIDEO_MEM_OFFSET); | ||
295 | |||
296 | vma->vm_end = vma->vm_start + info->fix.smem_len; | ||
297 | /* For those who don't understand how mmap works, go read | ||
298 | * Documentation/nommu-mmap.txt. | ||
299 | * For those that do, you will know that the VM_MAYSHARE flag | ||
300 | * must be set in the vma->vm_flags structure on noMMU | ||
301 | * Other flags can be set, and are documented in | ||
302 | * include/linux/mm.h | ||
303 | */ | ||
304 | vma->vm_flags |= VM_MAYSHARE; | ||
305 | |||
306 | return 0; | ||
307 | } | ||
308 | |||
309 | int bfin_t350mcqb_fb_cursor(struct fb_info *info, struct fb_cursor *cursor) | ||
310 | { | ||
311 | if (nocursor) | ||
312 | return 0; | ||
313 | else | ||
314 | return -EINVAL; /* just to force soft_cursor() call */ | ||
315 | } | ||
316 | |||
317 | static int bfin_t350mcqb_fb_setcolreg(u_int regno, u_int red, u_int green, | ||
318 | u_int blue, u_int transp, | ||
319 | struct fb_info *info) | ||
320 | { | ||
321 | if (regno >= BFIN_LCD_NBR_PALETTE_ENTRIES) | ||
322 | return -EINVAL; | ||
323 | |||
324 | if (info->var.grayscale) { | ||
325 | /* grayscale = 0.30*R + 0.59*G + 0.11*B */ | ||
326 | red = green = blue = (red * 77 + green * 151 + blue * 28) >> 8; | ||
327 | } | ||
328 | |||
329 | if (info->fix.visual == FB_VISUAL_TRUECOLOR) { | ||
330 | |||
331 | u32 value; | ||
332 | /* Place color in the pseudopalette */ | ||
333 | if (regno > 16) | ||
334 | return -EINVAL; | ||
335 | |||
336 | red >>= (16 - info->var.red.length); | ||
337 | green >>= (16 - info->var.green.length); | ||
338 | blue >>= (16 - info->var.blue.length); | ||
339 | |||
340 | value = (red << info->var.red.offset) | | ||
341 | (green << info->var.green.offset) | | ||
342 | (blue << info->var.blue.offset); | ||
343 | value &= 0xFFFFFF; | ||
344 | |||
345 | ((u32 *) (info->pseudo_palette))[regno] = value; | ||
346 | |||
347 | } | ||
348 | |||
349 | return 0; | ||
350 | } | ||
351 | |||
352 | static struct fb_ops bfin_t350mcqb_fb_ops = { | ||
353 | .owner = THIS_MODULE, | ||
354 | .fb_open = bfin_t350mcqb_fb_open, | ||
355 | .fb_release = bfin_t350mcqb_fb_release, | ||
356 | .fb_check_var = bfin_t350mcqb_fb_check_var, | ||
357 | .fb_fillrect = cfb_fillrect, | ||
358 | .fb_copyarea = cfb_copyarea, | ||
359 | .fb_imageblit = cfb_imageblit, | ||
360 | .fb_mmap = bfin_t350mcqb_fb_mmap, | ||
361 | .fb_cursor = bfin_t350mcqb_fb_cursor, | ||
362 | .fb_setcolreg = bfin_t350mcqb_fb_setcolreg, | ||
363 | }; | ||
364 | |||
365 | #ifndef NO_BL_SUPPORT | ||
366 | static int bl_get_brightness(struct backlight_device *bd) | ||
367 | { | ||
368 | return 0; | ||
369 | } | ||
370 | |||
371 | static struct backlight_ops bfin_lq043fb_bl_ops = { | ||
372 | .get_brightness = bl_get_brightness, | ||
373 | }; | ||
374 | |||
375 | static struct backlight_device *bl_dev; | ||
376 | |||
377 | static int bfin_lcd_get_power(struct lcd_device *dev) | ||
378 | { | ||
379 | return 0; | ||
380 | } | ||
381 | |||
382 | static int bfin_lcd_set_power(struct lcd_device *dev, int power) | ||
383 | { | ||
384 | return 0; | ||
385 | } | ||
386 | |||
387 | static int bfin_lcd_get_contrast(struct lcd_device *dev) | ||
388 | { | ||
389 | return 0; | ||
390 | } | ||
391 | |||
392 | static int bfin_lcd_set_contrast(struct lcd_device *dev, int contrast) | ||
393 | { | ||
394 | |||
395 | return 0; | ||
396 | } | ||
397 | |||
398 | static int bfin_lcd_check_fb(struct fb_info *fi) | ||
399 | { | ||
400 | if (!fi || (fi == &bfin_t350mcqb_fb)) | ||
401 | return 1; | ||
402 | return 0; | ||
403 | } | ||
404 | |||
405 | static struct lcd_ops bfin_lcd_ops = { | ||
406 | .get_power = bfin_lcd_get_power, | ||
407 | .set_power = bfin_lcd_set_power, | ||
408 | .get_contrast = bfin_lcd_get_contrast, | ||
409 | .set_contrast = bfin_lcd_set_contrast, | ||
410 | .check_fb = bfin_lcd_check_fb, | ||
411 | }; | ||
412 | |||
413 | static struct lcd_device *lcd_dev; | ||
414 | #endif | ||
415 | |||
416 | static irqreturn_t bfin_t350mcqb_irq_error(int irq, void *dev_id) | ||
417 | { | ||
418 | /*struct bfin_t350mcqbfb_info *info = (struct bfin_t350mcqbfb_info *)dev_id;*/ | ||
419 | |||
420 | u16 status = bfin_read_PPI_STATUS(); | ||
421 | bfin_write_PPI_STATUS(0xFFFF); | ||
422 | |||
423 | if (status) { | ||
424 | bfin_t350mcqb_disable_ppi(); | ||
425 | disable_dma(CH_PPI); | ||
426 | |||
427 | /* start dma */ | ||
428 | enable_dma(CH_PPI); | ||
429 | bfin_t350mcqb_enable_ppi(); | ||
430 | bfin_write_PPI_STATUS(0xFFFF); | ||
431 | } | ||
432 | |||
433 | return IRQ_HANDLED; | ||
434 | } | ||
435 | |||
436 | static int __init bfin_t350mcqb_probe(struct platform_device *pdev) | ||
437 | { | ||
438 | struct bfin_t350mcqbfb_info *info; | ||
439 | struct fb_info *fbinfo; | ||
440 | int ret; | ||
441 | |||
442 | printk(KERN_INFO DRIVER_NAME ": %dx%d %d-bit RGB FrameBuffer initializing...\n", | ||
443 | LCD_X_RES, LCD_Y_RES, LCD_BPP); | ||
444 | |||
445 | if (request_dma(CH_PPI, "CH_PPI") < 0) { | ||
446 | printk(KERN_ERR DRIVER_NAME | ||
447 | ": couldn't request CH_PPI DMA\n"); | ||
448 | ret = -EFAULT; | ||
449 | goto out1; | ||
450 | } | ||
451 | |||
452 | fbinfo = | ||
453 | framebuffer_alloc(sizeof(struct bfin_t350mcqbfb_info), &pdev->dev); | ||
454 | if (!fbinfo) { | ||
455 | ret = -ENOMEM; | ||
456 | goto out2; | ||
457 | } | ||
458 | |||
459 | info = fbinfo->par; | ||
460 | info->fb = fbinfo; | ||
461 | info->dev = &pdev->dev; | ||
462 | |||
463 | platform_set_drvdata(pdev, fbinfo); | ||
464 | |||
465 | strcpy(fbinfo->fix.id, driver_name); | ||
466 | |||
467 | fbinfo->fix.type = FB_TYPE_PACKED_PIXELS; | ||
468 | fbinfo->fix.type_aux = 0; | ||
469 | fbinfo->fix.xpanstep = 0; | ||
470 | fbinfo->fix.ypanstep = 0; | ||
471 | fbinfo->fix.ywrapstep = 0; | ||
472 | fbinfo->fix.accel = FB_ACCEL_NONE; | ||
473 | fbinfo->fix.visual = FB_VISUAL_TRUECOLOR; | ||
474 | |||
475 | fbinfo->var.nonstd = 0; | ||
476 | fbinfo->var.activate = FB_ACTIVATE_NOW; | ||
477 | fbinfo->var.height = -1; | ||
478 | fbinfo->var.width = -1; | ||
479 | fbinfo->var.accel_flags = 0; | ||
480 | fbinfo->var.vmode = FB_VMODE_NONINTERLACED; | ||
481 | |||
482 | fbinfo->var.xres = LCD_X_RES; | ||
483 | fbinfo->var.xres_virtual = LCD_X_RES; | ||
484 | fbinfo->var.yres = LCD_Y_RES; | ||
485 | fbinfo->var.yres_virtual = LCD_Y_RES; | ||
486 | fbinfo->var.bits_per_pixel = LCD_BPP; | ||
487 | |||
488 | fbinfo->var.red.offset = 0; | ||
489 | fbinfo->var.green.offset = 8; | ||
490 | fbinfo->var.blue.offset = 16; | ||
491 | fbinfo->var.transp.offset = 0; | ||
492 | fbinfo->var.red.length = 8; | ||
493 | fbinfo->var.green.length = 8; | ||
494 | fbinfo->var.blue.length = 8; | ||
495 | fbinfo->var.transp.length = 0; | ||
496 | fbinfo->fix.smem_len = LCD_X_RES * LCD_Y_RES * LCD_BPP / 8; | ||
497 | |||
498 | fbinfo->fix.line_length = fbinfo->var.xres_virtual * | ||
499 | fbinfo->var.bits_per_pixel / 8; | ||
500 | |||
501 | |||
502 | fbinfo->fbops = &bfin_t350mcqb_fb_ops; | ||
503 | fbinfo->flags = FBINFO_FLAG_DEFAULT; | ||
504 | |||
505 | info->fb_buffer = | ||
506 | dma_alloc_coherent(NULL, fbinfo->fix.smem_len, &info->dma_handle, | ||
507 | GFP_KERNEL); | ||
508 | |||
509 | if (NULL == info->fb_buffer) { | ||
510 | printk(KERN_ERR DRIVER_NAME | ||
511 | ": couldn't allocate dma buffer.\n"); | ||
512 | ret = -ENOMEM; | ||
513 | goto out3; | ||
514 | } | ||
515 | |||
516 | memset(info->fb_buffer, 0, fbinfo->fix.smem_len); | ||
517 | |||
518 | fbinfo->screen_base = (void *)info->fb_buffer + ACTIVE_VIDEO_MEM_OFFSET; | ||
519 | fbinfo->fix.smem_start = (int)info->fb_buffer + ACTIVE_VIDEO_MEM_OFFSET; | ||
520 | |||
521 | fbinfo->fbops = &bfin_t350mcqb_fb_ops; | ||
522 | |||
523 | fbinfo->pseudo_palette = kmalloc(sizeof(u32) * 16, GFP_KERNEL); | ||
524 | if (!fbinfo->pseudo_palette) { | ||
525 | printk(KERN_ERR DRIVER_NAME | ||
526 | "Fail to allocate pseudo_palette\n"); | ||
527 | |||
528 | ret = -ENOMEM; | ||
529 | goto out4; | ||
530 | } | ||
531 | |||
532 | memset(fbinfo->pseudo_palette, 0, sizeof(u32) * 16); | ||
533 | |||
534 | if (fb_alloc_cmap(&fbinfo->cmap, BFIN_LCD_NBR_PALETTE_ENTRIES, 0) | ||
535 | < 0) { | ||
536 | printk(KERN_ERR DRIVER_NAME | ||
537 | "Fail to allocate colormap (%d entries)\n", | ||
538 | BFIN_LCD_NBR_PALETTE_ENTRIES); | ||
539 | ret = -EFAULT; | ||
540 | goto out5; | ||
541 | } | ||
542 | |||
543 | if (bfin_t350mcqb_request_ports(1)) { | ||
544 | printk(KERN_ERR DRIVER_NAME ": couldn't request gpio port.\n"); | ||
545 | ret = -EFAULT; | ||
546 | goto out6; | ||
547 | } | ||
548 | |||
549 | info->irq = platform_get_irq(pdev, 0); | ||
550 | if (info->irq < 0) { | ||
551 | ret = -EINVAL; | ||
552 | goto out7; | ||
553 | } | ||
554 | |||
555 | if (request_irq(info->irq, (void *)bfin_t350mcqb_irq_error, IRQF_DISABLED, | ||
556 | "PPI ERROR", info) < 0) { | ||
557 | printk(KERN_ERR DRIVER_NAME | ||
558 | ": unable to request PPI ERROR IRQ\n"); | ||
559 | ret = -EFAULT; | ||
560 | goto out7; | ||
561 | } | ||
562 | |||
563 | if (register_framebuffer(fbinfo) < 0) { | ||
564 | printk(KERN_ERR DRIVER_NAME | ||
565 | ": unable to register framebuffer.\n"); | ||
566 | ret = -EINVAL; | ||
567 | goto out8; | ||
568 | } | ||
569 | #ifndef NO_BL_SUPPORT | ||
570 | bl_dev = | ||
571 | backlight_device_register("bf52x-bl", NULL, NULL, | ||
572 | &bfin_lq043fb_bl_ops); | ||
573 | bl_dev->props.max_brightness = 255; | ||
574 | |||
575 | lcd_dev = lcd_device_register(DRIVER_NAME, NULL, &bfin_lcd_ops); | ||
576 | lcd_dev->props.max_contrast = 255, printk(KERN_INFO "Done.\n"); | ||
577 | #endif | ||
578 | |||
579 | return 0; | ||
580 | |||
581 | out8: | ||
582 | free_irq(info->irq, info); | ||
583 | out7: | ||
584 | bfin_t350mcqb_request_ports(0); | ||
585 | out6: | ||
586 | fb_dealloc_cmap(&fbinfo->cmap); | ||
587 | out5: | ||
588 | kfree(fbinfo->pseudo_palette); | ||
589 | out4: | ||
590 | dma_free_coherent(NULL, fbinfo->fix.smem_len, info->fb_buffer, | ||
591 | info->dma_handle); | ||
592 | out3: | ||
593 | framebuffer_release(fbinfo); | ||
594 | out2: | ||
595 | free_dma(CH_PPI); | ||
596 | out1: | ||
597 | platform_set_drvdata(pdev, NULL); | ||
598 | |||
599 | return ret; | ||
600 | } | ||
601 | |||
602 | static int bfin_t350mcqb_remove(struct platform_device *pdev) | ||
603 | { | ||
604 | |||
605 | struct fb_info *fbinfo = platform_get_drvdata(pdev); | ||
606 | struct bfin_t350mcqbfb_info *info = fbinfo->par; | ||
607 | |||
608 | free_dma(CH_PPI); | ||
609 | free_irq(info->irq, info); | ||
610 | |||
611 | if (info->fb_buffer != NULL) | ||
612 | dma_free_coherent(NULL, fbinfo->fix.smem_len, info->fb_buffer, | ||
613 | info->dma_handle); | ||
614 | |||
615 | kfree(fbinfo->pseudo_palette); | ||
616 | fb_dealloc_cmap(&fbinfo->cmap); | ||
617 | |||
618 | #ifndef NO_BL_SUPPORT | ||
619 | lcd_device_unregister(lcd_dev); | ||
620 | backlight_device_unregister(bl_dev); | ||
621 | #endif | ||
622 | |||
623 | unregister_framebuffer(fbinfo); | ||
624 | |||
625 | bfin_t350mcqb_request_ports(0); | ||
626 | |||
627 | printk(KERN_INFO DRIVER_NAME ": Unregister LCD driver.\n"); | ||
628 | |||
629 | return 0; | ||
630 | } | ||
631 | |||
632 | #ifdef CONFIG_PM | ||
633 | static int bfin_t350mcqb_suspend(struct platform_device *pdev, pm_message_t state) | ||
634 | { | ||
635 | struct fb_info *fbinfo = platform_get_drvdata(pdev); | ||
636 | struct bfin_t350mcqbfb_info *info = fbinfo->par; | ||
637 | |||
638 | bfin_t350mcqb_disable_ppi(); | ||
639 | disable_dma(CH_PPI); | ||
640 | bfin_write_PPI_STATUS(0xFFFF); | ||
641 | |||
642 | return 0; | ||
643 | } | ||
644 | |||
645 | static int bfin_t350mcqb_resume(struct platform_device *pdev) | ||
646 | { | ||
647 | struct fb_info *fbinfo = platform_get_drvdata(pdev); | ||
648 | struct bfin_t350mcqbfb_info *info = fbinfo->par; | ||
649 | |||
650 | enable_dma(CH_PPI); | ||
651 | bfin_t350mcqb_enable_ppi(); | ||
652 | |||
653 | return 0; | ||
654 | } | ||
655 | #else | ||
656 | #define bfin_t350mcqb_suspend NULL | ||
657 | #define bfin_t350mcqb_resume NULL | ||
658 | #endif | ||
659 | |||
660 | static struct platform_driver bfin_t350mcqb_driver = { | ||
661 | .probe = bfin_t350mcqb_probe, | ||
662 | .remove = bfin_t350mcqb_remove, | ||
663 | .suspend = bfin_t350mcqb_suspend, | ||
664 | .resume = bfin_t350mcqb_resume, | ||
665 | .driver = { | ||
666 | .name = DRIVER_NAME, | ||
667 | .owner = THIS_MODULE, | ||
668 | }, | ||
669 | }; | ||
670 | |||
671 | static int __devinit bfin_t350mcqb_driver_init(void) | ||
672 | { | ||
673 | return platform_driver_register(&bfin_t350mcqb_driver); | ||
674 | } | ||
675 | |||
676 | static void __exit bfin_t350mcqb_driver_cleanup(void) | ||
677 | { | ||
678 | platform_driver_unregister(&bfin_t350mcqb_driver); | ||
679 | } | ||
680 | |||
681 | MODULE_DESCRIPTION("Blackfin TFT LCD Driver"); | ||
682 | MODULE_LICENSE("GPL"); | ||
683 | |||
684 | module_init(bfin_t350mcqb_driver_init); | ||
685 | module_exit(bfin_t350mcqb_driver_cleanup); | ||
diff --git a/drivers/video/mbx/mbxfb.c b/drivers/video/mbx/mbxfb.c index 80cd117ca65c..01f77bcc68f9 100644 --- a/drivers/video/mbx/mbxfb.c +++ b/drivers/video/mbx/mbxfb.c | |||
@@ -889,7 +889,7 @@ static int __devinit mbxfb_probe(struct platform_device *dev) | |||
889 | struct mbxfb_info *mfbi; | 889 | struct mbxfb_info *mfbi; |
890 | struct mbxfb_platform_data *pdata; | 890 | struct mbxfb_platform_data *pdata; |
891 | 891 | ||
892 | dev_dbg(dev, "mbxfb_probe\n"); | 892 | dev_dbg(&dev->dev, "mbxfb_probe\n"); |
893 | 893 | ||
894 | pdata = dev->dev.platform_data; | 894 | pdata = dev->dev.platform_data; |
895 | if (!pdata) { | 895 | if (!pdata) { |
diff --git a/drivers/video/stifb.c b/drivers/video/stifb.c index e7c8db2eb49b..f98be301140c 100644 --- a/drivers/video/stifb.c +++ b/drivers/video/stifb.c | |||
@@ -505,16 +505,24 @@ ngleSetupAttrPlanes(struct stifb_info *fb, int BufferNumber) | |||
505 | static void | 505 | static void |
506 | rattlerSetupPlanes(struct stifb_info *fb) | 506 | rattlerSetupPlanes(struct stifb_info *fb) |
507 | { | 507 | { |
508 | int saved_id, y; | ||
509 | |||
510 | /* Write RAMDAC pixel read mask register so all overlay | ||
511 | * planes are display-enabled. (CRX24 uses Bt462 pixel | ||
512 | * read mask register for overlay planes, not image planes). | ||
513 | */ | ||
508 | CRX24_SETUP_RAMDAC(fb); | 514 | CRX24_SETUP_RAMDAC(fb); |
509 | 515 | ||
510 | /* replacement for: SETUP_FB(fb, CRX24_OVERLAY_PLANES); */ | 516 | /* change fb->id temporarily to fool SETUP_FB() */ |
511 | WRITE_WORD(0x83000300, fb, REG_14); | 517 | saved_id = fb->id; |
512 | SETUP_HW(fb); | 518 | fb->id = CRX24_OVERLAY_PLANES; |
513 | WRITE_BYTE(1, fb, REG_16b1); | 519 | SETUP_FB(fb); |
520 | fb->id = saved_id; | ||
521 | |||
522 | for (y = 0; y < fb->info.var.yres; ++y) | ||
523 | memset(fb->info.screen_base + y * fb->info.fix.line_length, | ||
524 | 0xff, fb->info.var.xres * fb->info.var.bits_per_pixel/8); | ||
514 | 525 | ||
515 | fb_memset((void*)fb->info.fix.smem_start, 0xff, | ||
516 | fb->info.var.yres*fb->info.fix.line_length); | ||
517 | |||
518 | CRX24_SET_OVLY_MASK(fb); | 526 | CRX24_SET_OVLY_MASK(fb); |
519 | SETUP_FB(fb); | 527 | SETUP_FB(fb); |
520 | } | 528 | } |
diff --git a/drivers/video/tridentfb.c b/drivers/video/tridentfb.c index 919ce75db9e2..0a4e07d43d2d 100644 --- a/drivers/video/tridentfb.c +++ b/drivers/video/tridentfb.c | |||
@@ -566,44 +566,32 @@ static inline void write3CE(int reg, unsigned char val) | |||
566 | 566 | ||
567 | static void enable_mmio(void) | 567 | static void enable_mmio(void) |
568 | { | 568 | { |
569 | unsigned char tmp; | ||
570 | |||
571 | /* Goto New Mode */ | 569 | /* Goto New Mode */ |
572 | outb(0x0B, 0x3C4); | 570 | outb(0x0B, 0x3C4); |
573 | inb(0x3C5); | 571 | inb(0x3C5); |
574 | 572 | ||
575 | /* Unprotect registers */ | 573 | /* Unprotect registers */ |
576 | outb(NewMode1, 0x3C4); | 574 | outb(NewMode1, 0x3C4); |
577 | tmp = inb(0x3C5); | ||
578 | outb(0x80, 0x3C5); | 575 | outb(0x80, 0x3C5); |
579 | 576 | ||
580 | /* Enable MMIO */ | 577 | /* Enable MMIO */ |
581 | outb(PCIReg, 0x3D4); | 578 | outb(PCIReg, 0x3D4); |
582 | outb(inb(0x3D5) | 0x01, 0x3D5); | 579 | outb(inb(0x3D5) | 0x01, 0x3D5); |
583 | |||
584 | t_outb(NewMode1, 0x3C4); | ||
585 | t_outb(tmp, 0x3C5); | ||
586 | } | 580 | } |
587 | 581 | ||
588 | static void disable_mmio(void) | 582 | static void disable_mmio(void) |
589 | { | 583 | { |
590 | unsigned char tmp; | ||
591 | |||
592 | /* Goto New Mode */ | 584 | /* Goto New Mode */ |
593 | t_outb(0x0B, 0x3C4); | 585 | t_outb(0x0B, 0x3C4); |
594 | t_inb(0x3C5); | 586 | t_inb(0x3C5); |
595 | 587 | ||
596 | /* Unprotect registers */ | 588 | /* Unprotect registers */ |
597 | t_outb(NewMode1, 0x3C4); | 589 | t_outb(NewMode1, 0x3C4); |
598 | tmp = t_inb(0x3C5); | ||
599 | t_outb(0x80, 0x3C5); | 590 | t_outb(0x80, 0x3C5); |
600 | 591 | ||
601 | /* Disable MMIO */ | 592 | /* Disable MMIO */ |
602 | t_outb(PCIReg, 0x3D4); | 593 | t_outb(PCIReg, 0x3D4); |
603 | t_outb(t_inb(0x3D5) & ~0x01, 0x3D5); | 594 | t_outb(t_inb(0x3D5) & ~0x01, 0x3D5); |
604 | |||
605 | outb(NewMode1, 0x3C4); | ||
606 | outb(tmp, 0x3C5); | ||
607 | } | 595 | } |
608 | 596 | ||
609 | #define crtc_unlock() write3X4(CRTVSyncEnd, read3X4(CRTVSyncEnd) & 0x7F) | 597 | #define crtc_unlock() write3X4(CRTVSyncEnd, read3X4(CRTVSyncEnd) & 0x7F) |
@@ -757,7 +745,7 @@ static unsigned int __devinit get_memsize(void) | |||
757 | switch (tmp) { | 745 | switch (tmp) { |
758 | 746 | ||
759 | case 0x01: | 747 | case 0x01: |
760 | k = 512; | 748 | k = 512 * Kb; |
761 | break; | 749 | break; |
762 | case 0x02: | 750 | case 0x02: |
763 | k = 6 * Mb; /* XP */ | 751 | k = 6 * Mb; /* XP */ |
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 | } |
diff --git a/drivers/watchdog/cpu5wdt.c b/drivers/watchdog/cpu5wdt.c index 5941ca601a3a..df72f90123df 100644 --- a/drivers/watchdog/cpu5wdt.c +++ b/drivers/watchdog/cpu5wdt.c | |||
@@ -59,9 +59,9 @@ static int ticks = 10000; | |||
59 | 59 | ||
60 | static struct { | 60 | static struct { |
61 | struct completion stop; | 61 | struct completion stop; |
62 | volatile int running; | 62 | int running; |
63 | struct timer_list timer; | 63 | struct timer_list timer; |
64 | volatile int queue; | 64 | int queue; |
65 | int default_ticks; | 65 | int default_ticks; |
66 | unsigned long inuse; | 66 | unsigned long inuse; |
67 | } cpu5wdt_device; | 67 | } cpu5wdt_device; |
diff --git a/drivers/watchdog/hpwdt.c b/drivers/watchdog/hpwdt.c index a2e174b09fe7..6483d1066b95 100644 --- a/drivers/watchdog/hpwdt.c +++ b/drivers/watchdog/hpwdt.c | |||
@@ -58,41 +58,6 @@ struct bios32_service_dir { | |||
58 | u8 reserved[5]; | 58 | u8 reserved[5]; |
59 | }; | 59 | }; |
60 | 60 | ||
61 | /* | ||
62 | * smbios_entry_point - defines SMBIOS entry point structure | ||
63 | * | ||
64 | * anchor[4] - anchor string (_SM_) | ||
65 | * checksum - checksum of the entry point structure | ||
66 | * length - length of the entry point structure | ||
67 | * major_ver - major version (02h for revision 2.1) | ||
68 | * minor_ver - minor version (01h for revision 2.1) | ||
69 | * max_struct_size - size of the largest SMBIOS structure | ||
70 | * revision - entry point structure revision implemented | ||
71 | * formatted_area[5] - reserved | ||
72 | * intermediate_anchor[5] - intermediate anchor string (_DMI_) | ||
73 | * intermediate_checksum - intermediate checksum | ||
74 | * table_length - structure table length | ||
75 | * table_address - structure table address | ||
76 | * table_num_structs - number of SMBIOS structures present | ||
77 | * bcd_revision - BCD revision | ||
78 | */ | ||
79 | struct smbios_entry_point { | ||
80 | u8 anchor[4]; | ||
81 | u8 checksum; | ||
82 | u8 length; | ||
83 | u8 major_ver; | ||
84 | u8 minor_ver; | ||
85 | u16 max_struct_size; | ||
86 | u8 revision; | ||
87 | u8 formatted_area[5]; | ||
88 | u8 intermediate_anchor[5]; | ||
89 | u8 intermediate_checksum; | ||
90 | u16 table_length; | ||
91 | u64 table_address; | ||
92 | u16 table_num_structs; | ||
93 | u8 bcd_revision; | ||
94 | }; | ||
95 | |||
96 | /* type 212 */ | 61 | /* type 212 */ |
97 | struct smbios_cru64_info { | 62 | struct smbios_cru64_info { |
98 | u8 type; | 63 | u8 type; |
@@ -175,31 +140,13 @@ static struct pci_device_id hpwdt_devices[] = { | |||
175 | }; | 140 | }; |
176 | MODULE_DEVICE_TABLE(pci, hpwdt_devices); | 141 | MODULE_DEVICE_TABLE(pci, hpwdt_devices); |
177 | 142 | ||
178 | /* | ||
179 | * bios_checksum | ||
180 | */ | ||
181 | static int __devinit bios_checksum(const char __iomem *ptr, int len) | ||
182 | { | ||
183 | char sum = 0; | ||
184 | int i; | ||
185 | |||
186 | /* | ||
187 | * calculate checksum of size bytes. This should add up | ||
188 | * to zero if we have a valid header. | ||
189 | */ | ||
190 | for (i = 0; i < len; i++) | ||
191 | sum += ptr[i]; | ||
192 | |||
193 | return ((sum == 0) && (len > 0)); | ||
194 | } | ||
195 | |||
196 | #ifndef CONFIG_X86_64 | 143 | #ifndef CONFIG_X86_64 |
197 | /* --32 Bit Bios------------------------------------------------------------ */ | 144 | /* --32 Bit Bios------------------------------------------------------------ */ |
198 | 145 | ||
199 | #define HPWDT_ARCH 32 | 146 | #define HPWDT_ARCH 32 |
200 | 147 | ||
201 | asmlinkage void asminline_call(struct cmn_registers *pi86Regs, | 148 | static void asminline_call(struct cmn_registers *pi86Regs, |
202 | unsigned long *pRomEntry) | 149 | unsigned long *pRomEntry) |
203 | { | 150 | { |
204 | asm("pushl %ebp \n\t" | 151 | asm("pushl %ebp \n\t" |
205 | "movl %esp, %ebp \n\t" | 152 | "movl %esp, %ebp \n\t" |
@@ -303,6 +250,24 @@ static int __devinit cru_detect(unsigned long map_entry, | |||
303 | } | 250 | } |
304 | 251 | ||
305 | /* | 252 | /* |
253 | * bios_checksum | ||
254 | */ | ||
255 | static int __devinit bios_checksum(const char __iomem *ptr, int len) | ||
256 | { | ||
257 | char sum = 0; | ||
258 | int i; | ||
259 | |||
260 | /* | ||
261 | * calculate checksum of size bytes. This should add up | ||
262 | * to zero if we have a valid header. | ||
263 | */ | ||
264 | for (i = 0; i < len; i++) | ||
265 | sum += ptr[i]; | ||
266 | |||
267 | return ((sum == 0) && (len > 0)); | ||
268 | } | ||
269 | |||
270 | /* | ||
306 | * bios32_present | 271 | * bios32_present |
307 | * | 272 | * |
308 | * Routine Description: | 273 | * Routine Description: |
@@ -368,8 +333,8 @@ static int __devinit detect_cru_service(void) | |||
368 | 333 | ||
369 | #define HPWDT_ARCH 64 | 334 | #define HPWDT_ARCH 64 |
370 | 335 | ||
371 | asmlinkage void asminline_call(struct cmn_registers *pi86Regs, | 336 | static void asminline_call(struct cmn_registers *pi86Regs, |
372 | unsigned long *pRomEntry) | 337 | unsigned long *pRomEntry) |
373 | { | 338 | { |
374 | asm("pushq %rbp \n\t" | 339 | asm("pushq %rbp \n\t" |
375 | "movq %rsp, %rbp \n\t" | 340 | "movq %rsp, %rbp \n\t" |
@@ -410,12 +375,8 @@ asmlinkage void asminline_call(struct cmn_registers *pi86Regs, | |||
410 | * dmi_find_cru | 375 | * dmi_find_cru |
411 | * | 376 | * |
412 | * Routine Description: | 377 | * Routine Description: |
413 | * This function checks wether or not a SMBIOS/DMI record is | 378 | * This function checks whether or not a SMBIOS/DMI record is |
414 | * the 64bit CRU info or not | 379 | * the 64bit CRU info or not |
415 | * | ||
416 | * Return Value: | ||
417 | * 0 : SUCCESS - if record found | ||
418 | * <0 : FAILURE - if record not found | ||
419 | */ | 380 | */ |
420 | static void __devinit dmi_find_cru(const struct dmi_header *dm) | 381 | static void __devinit dmi_find_cru(const struct dmi_header *dm) |
421 | { | 382 | { |
@@ -434,138 +395,11 @@ static void __devinit dmi_find_cru(const struct dmi_header *dm) | |||
434 | } | 395 | } |
435 | } | 396 | } |
436 | 397 | ||
437 | /* | ||
438 | * dmi_table | ||
439 | * | ||
440 | * Routine Description: | ||
441 | * Decode the SMBIOS/DMI table and check if we have a 64bit CRU record | ||
442 | * or not. | ||
443 | * | ||
444 | * We have to be cautious here. We have seen BIOSes with DMI pointers | ||
445 | * pointing to completely the wrong place for example | ||
446 | */ | ||
447 | static void __devinit dmi_table(u8 *buf, int len, int num, | ||
448 | void (*decode)(const struct dmi_header *)) | ||
449 | { | ||
450 | u8 *data = buf; | ||
451 | int i = 0; | ||
452 | |||
453 | /* | ||
454 | * Stop when we see all the items the table claimed to have | ||
455 | * OR we run off the end of the table (also happens) | ||
456 | */ | ||
457 | while ((i < num) && (data - buf + sizeof(struct dmi_header)) <= len) { | ||
458 | const struct dmi_header *dm = (const struct dmi_header *)data; | ||
459 | |||
460 | /* | ||
461 | * We want to know the total length (formated area and strings) | ||
462 | * before decoding to make sure we won't run off the table in | ||
463 | * dmi_decode or dmi_string | ||
464 | */ | ||
465 | data += dm->length; | ||
466 | while ((data - buf < len - 1) && (data[0] || data[1])) | ||
467 | data++; | ||
468 | if (data - buf < len - 1) | ||
469 | decode(dm); | ||
470 | data += 2; | ||
471 | i++; | ||
472 | } | ||
473 | } | ||
474 | |||
475 | /* | ||
476 | * smbios_present | ||
477 | * | ||
478 | * Routine Description: | ||
479 | * This function parses the SMBIOS entry point table to retrieve | ||
480 | * the 64 bit CRU Service. | ||
481 | * | ||
482 | * Return Value: | ||
483 | * 0 : SUCCESS | ||
484 | * <0 : FAILURE | ||
485 | */ | ||
486 | static int __devinit smbios_present(const char __iomem *p) | ||
487 | { | ||
488 | struct smbios_entry_point *eps = | ||
489 | (struct smbios_entry_point *) p; | ||
490 | int length; | ||
491 | u8 *buf; | ||
492 | |||
493 | /* check if we have indeed the SMBIOS table entry point */ | ||
494 | if ((strncmp((char *)eps->anchor, "_SM_", | ||
495 | sizeof(eps->anchor))) == 0) { | ||
496 | length = eps->length; | ||
497 | |||
498 | /* SMBIOS v2.1 implementation might use 0x1e */ | ||
499 | if ((length == 0x1e) && | ||
500 | (eps->major_ver == 2) && | ||
501 | (eps->minor_ver == 1)) | ||
502 | length = 0x1f; | ||
503 | |||
504 | /* | ||
505 | * Now we will check: | ||
506 | * - SMBIOS checksum must be 0 | ||
507 | * - intermediate anchor should be _DMI_ | ||
508 | * - intermediate checksum should be 0 | ||
509 | */ | ||
510 | if ((bios_checksum(p, length)) && | ||
511 | (strncmp((char *)eps->intermediate_anchor, "_DMI_", | ||
512 | sizeof(eps->intermediate_anchor)) == 0) && | ||
513 | (bios_checksum(p+0x10, 15))) { | ||
514 | buf = ioremap(eps->table_address, eps->table_length); | ||
515 | if (buf == NULL) | ||
516 | return -ENODEV; | ||
517 | |||
518 | |||
519 | /* Scan the DMI table for the 64 bit CRU service */ | ||
520 | dmi_table(buf, eps->table_length, | ||
521 | eps->table_num_structs, dmi_find_cru); | ||
522 | |||
523 | iounmap(buf); | ||
524 | return 0; | ||
525 | } | ||
526 | } | ||
527 | |||
528 | return -ENODEV; | ||
529 | } | ||
530 | |||
531 | static int __devinit smbios_scan_machine(void) | ||
532 | { | ||
533 | char __iomem *p, *q; | ||
534 | int rc; | ||
535 | |||
536 | if (efi_enabled) { | ||
537 | if (efi.smbios == EFI_INVALID_TABLE_ADDR) | ||
538 | return -ENODEV; | ||
539 | |||
540 | p = ioremap(efi.smbios, 32); | ||
541 | if (p == NULL) | ||
542 | return -ENOMEM; | ||
543 | |||
544 | rc = smbios_present(p); | ||
545 | iounmap(p); | ||
546 | } else { | ||
547 | /* | ||
548 | * Search from 0x0f0000 through 0x0fffff, inclusive. | ||
549 | */ | ||
550 | p = ioremap(PCI_ROM_BASE1, ROM_SIZE); | ||
551 | if (p == NULL) | ||
552 | return -ENOMEM; | ||
553 | |||
554 | for (q = p; q < p + ROM_SIZE; q += 16) { | ||
555 | rc = smbios_present(q); | ||
556 | if (!rc) { | ||
557 | break; | ||
558 | } | ||
559 | } | ||
560 | iounmap(p); | ||
561 | } | ||
562 | } | ||
563 | |||
564 | static int __devinit detect_cru_service(void) | 398 | static int __devinit detect_cru_service(void) |
565 | { | 399 | { |
566 | cru_rom_addr = NULL; | 400 | cru_rom_addr = NULL; |
567 | 401 | ||
568 | smbios_scan_machine(); /* will become dmi_walk(dmi_find_cru); */ | 402 | dmi_walk(dmi_find_cru); |
569 | 403 | ||
570 | /* if cru_rom_addr has been set then we found a CRU service */ | 404 | /* if cru_rom_addr has been set then we found a CRU service */ |
571 | return ((cru_rom_addr != NULL)? 0: -ENODEV); | 405 | return ((cru_rom_addr != NULL)? 0: -ENODEV); |
diff --git a/drivers/watchdog/it8712f_wdt.c b/drivers/watchdog/it8712f_wdt.c index 1b6d7d1b715d..1efcad3b6fca 100644 --- a/drivers/watchdog/it8712f_wdt.c +++ b/drivers/watchdog/it8712f_wdt.c | |||
@@ -7,7 +7,8 @@ | |||
7 | * | 7 | * |
8 | * drivers/char/watchdog/scx200_wdt.c | 8 | * drivers/char/watchdog/scx200_wdt.c |
9 | * drivers/hwmon/it87.c | 9 | * drivers/hwmon/it87.c |
10 | * IT8712F EC-LPC I/O Preliminary Specification 0.9.2.pdf | 10 | * IT8712F EC-LPC I/O Preliminary Specification 0.8.2 |
11 | * IT8712F EC-LPC I/O Preliminary Specification 0.9.3 | ||
11 | * | 12 | * |
12 | * This program is free software; you can redistribute it and/or | 13 | * This program is free software; you can redistribute it and/or |
13 | * modify it under the terms of the GNU General Public License as | 14 | * modify it under the terms of the GNU General Public License as |
@@ -40,6 +41,7 @@ MODULE_DESCRIPTION("IT8712F Watchdog Driver"); | |||
40 | MODULE_LICENSE("GPL"); | 41 | MODULE_LICENSE("GPL"); |
41 | MODULE_ALIAS_MISCDEV(WATCHDOG_MINOR); | 42 | MODULE_ALIAS_MISCDEV(WATCHDOG_MINOR); |
42 | 43 | ||
44 | static int max_units = 255; | ||
43 | static int margin = 60; /* in seconds */ | 45 | static int margin = 60; /* in seconds */ |
44 | module_param(margin, int, 0); | 46 | module_param(margin, int, 0); |
45 | MODULE_PARM_DESC(margin, "Watchdog margin in seconds"); | 47 | MODULE_PARM_DESC(margin, "Watchdog margin in seconds"); |
@@ -51,6 +53,7 @@ MODULE_PARM_DESC(nowayout, "Disable watchdog shutdown on close"); | |||
51 | static struct semaphore it8712f_wdt_sem; | 53 | static struct semaphore it8712f_wdt_sem; |
52 | static unsigned expect_close; | 54 | static unsigned expect_close; |
53 | static spinlock_t io_lock; | 55 | static spinlock_t io_lock; |
56 | static unsigned char revision; | ||
54 | 57 | ||
55 | /* Dog Food address - We use the game port address */ | 58 | /* Dog Food address - We use the game port address */ |
56 | static unsigned short address; | 59 | static unsigned short address; |
@@ -108,6 +111,15 @@ superio_inw(int reg) | |||
108 | return val; | 111 | return val; |
109 | } | 112 | } |
110 | 113 | ||
114 | static void | ||
115 | superio_outw(int val, int reg) | ||
116 | { | ||
117 | outb(reg++, REG); | ||
118 | outb((val >> 8) & 0xff, VAL); | ||
119 | outb(reg, REG); | ||
120 | outb(val & 0xff, VAL); | ||
121 | } | ||
122 | |||
111 | static inline void | 123 | static inline void |
112 | superio_select(int ldn) | 124 | superio_select(int ldn) |
113 | { | 125 | { |
@@ -143,15 +155,33 @@ static void | |||
143 | it8712f_wdt_update_margin(void) | 155 | it8712f_wdt_update_margin(void) |
144 | { | 156 | { |
145 | int config = WDT_OUT_KRST | WDT_OUT_PWROK; | 157 | int config = WDT_OUT_KRST | WDT_OUT_PWROK; |
146 | 158 | int units = margin; | |
147 | printk(KERN_INFO NAME ": timer margin %d seconds\n", margin); | 159 | |
148 | 160 | /* Switch to minutes precision if the configured margin | |
149 | /* The timeout register only has 8bits wide */ | 161 | * value does not fit within the register width. |
150 | if (margin < 256) | 162 | */ |
151 | config |= WDT_UNIT_SEC; /* else UNIT are MINUTES */ | 163 | if (units <= max_units) { |
164 | config |= WDT_UNIT_SEC; /* else UNIT is MINUTES */ | ||
165 | printk(KERN_INFO NAME ": timer margin %d seconds\n", units); | ||
166 | } else { | ||
167 | units /= 60; | ||
168 | printk(KERN_INFO NAME ": timer margin %d minutes\n", units); | ||
169 | } | ||
152 | superio_outb(config, WDT_CONFIG); | 170 | superio_outb(config, WDT_CONFIG); |
153 | 171 | ||
154 | superio_outb((margin > 255) ? (margin / 60) : margin, WDT_TIMEOUT); | 172 | if (revision >= 0x08) |
173 | superio_outw(units, WDT_TIMEOUT); | ||
174 | else | ||
175 | superio_outb(units, WDT_TIMEOUT); | ||
176 | } | ||
177 | |||
178 | static int | ||
179 | it8712f_wdt_get_status(void) | ||
180 | { | ||
181 | if (superio_inb(WDT_CONTROL) & 0x01) | ||
182 | return WDIOF_CARDRESET; | ||
183 | else | ||
184 | return 0; | ||
155 | } | 185 | } |
156 | 186 | ||
157 | static void | 187 | static void |
@@ -234,7 +264,7 @@ it8712f_wdt_ioctl(struct inode *inode, struct file *file, | |||
234 | .firmware_version = 1, | 264 | .firmware_version = 1, |
235 | .options = WDIOF_SETTIMEOUT | WDIOF_KEEPALIVEPING, | 265 | .options = WDIOF_SETTIMEOUT | WDIOF_KEEPALIVEPING, |
236 | }; | 266 | }; |
237 | int new_margin; | 267 | int value; |
238 | 268 | ||
239 | switch (cmd) { | 269 | switch (cmd) { |
240 | default: | 270 | default: |
@@ -244,17 +274,27 @@ it8712f_wdt_ioctl(struct inode *inode, struct file *file, | |||
244 | return -EFAULT; | 274 | return -EFAULT; |
245 | return 0; | 275 | return 0; |
246 | case WDIOC_GETSTATUS: | 276 | case WDIOC_GETSTATUS: |
277 | superio_enter(); | ||
278 | superio_select(LDN_GPIO); | ||
279 | |||
280 | value = it8712f_wdt_get_status(); | ||
281 | |||
282 | superio_exit(); | ||
283 | |||
284 | return put_user(value, p); | ||
247 | case WDIOC_GETBOOTSTATUS: | 285 | case WDIOC_GETBOOTSTATUS: |
248 | return put_user(0, p); | 286 | return put_user(0, p); |
249 | case WDIOC_KEEPALIVE: | 287 | case WDIOC_KEEPALIVE: |
250 | it8712f_wdt_ping(); | 288 | it8712f_wdt_ping(); |
251 | return 0; | 289 | return 0; |
252 | case WDIOC_SETTIMEOUT: | 290 | case WDIOC_SETTIMEOUT: |
253 | if (get_user(new_margin, p)) | 291 | if (get_user(value, p)) |
254 | return -EFAULT; | 292 | return -EFAULT; |
255 | if (new_margin < 1) | 293 | if (value < 1) |
294 | return -EINVAL; | ||
295 | if (value > (max_units * 60)) | ||
256 | return -EINVAL; | 296 | return -EINVAL; |
257 | margin = new_margin; | 297 | margin = value; |
258 | superio_enter(); | 298 | superio_enter(); |
259 | superio_select(LDN_GPIO); | 299 | superio_select(LDN_GPIO); |
260 | 300 | ||
@@ -262,6 +302,7 @@ it8712f_wdt_ioctl(struct inode *inode, struct file *file, | |||
262 | 302 | ||
263 | superio_exit(); | 303 | superio_exit(); |
264 | it8712f_wdt_ping(); | 304 | it8712f_wdt_ping(); |
305 | /* Fall through */ | ||
265 | case WDIOC_GETTIMEOUT: | 306 | case WDIOC_GETTIMEOUT: |
266 | if (put_user(margin, p)) | 307 | if (put_user(margin, p)) |
267 | return -EFAULT; | 308 | return -EFAULT; |
@@ -336,9 +377,18 @@ it8712f_wdt_find(unsigned short *address) | |||
336 | } | 377 | } |
337 | 378 | ||
338 | err = 0; | 379 | err = 0; |
339 | printk(KERN_DEBUG NAME ": Found IT%04xF chip revision %d - " | 380 | revision = superio_inb(DEVREV) & 0x0f; |
381 | |||
382 | /* Later revisions have 16-bit values per datasheet 0.9.1 */ | ||
383 | if (revision >= 0x08) | ||
384 | max_units = 65535; | ||
385 | |||
386 | if (margin > (max_units * 60)) | ||
387 | margin = (max_units * 60); | ||
388 | |||
389 | printk(KERN_INFO NAME ": Found IT%04xF chip revision %d - " | ||
340 | "using DogFood address 0x%x\n", | 390 | "using DogFood address 0x%x\n", |
341 | chip_type, superio_inb(DEVREV) & 0x0f, *address); | 391 | chip_type, revision, *address); |
342 | 392 | ||
343 | exit: | 393 | exit: |
344 | superio_exit(); | 394 | superio_exit(); |
diff --git a/drivers/watchdog/machzwd.c b/drivers/watchdog/machzwd.c index e6e07b4575eb..6905135a776c 100644 --- a/drivers/watchdog/machzwd.c +++ b/drivers/watchdog/machzwd.c | |||
@@ -141,7 +141,7 @@ static unsigned long next_heartbeat = 0; | |||
141 | #ifndef ZF_DEBUG | 141 | #ifndef ZF_DEBUG |
142 | # define dprintk(format, args...) | 142 | # define dprintk(format, args...) |
143 | #else | 143 | #else |
144 | # define dprintk(format, args...) printk(KERN_DEBUG PFX ":%s:%d: " format, __FUNCTION__, __LINE__ , ## args) | 144 | # define dprintk(format, args...) printk(KERN_DEBUG PFX ":%s:%d: " format, __func__, __LINE__ , ## args) |
145 | #endif | 145 | #endif |
146 | 146 | ||
147 | 147 | ||
diff --git a/drivers/watchdog/mtx-1_wdt.c b/drivers/watchdog/mtx-1_wdt.c index 789831b3fa00..10b89f2703bd 100644 --- a/drivers/watchdog/mtx-1_wdt.c +++ b/drivers/watchdog/mtx-1_wdt.c | |||
@@ -59,9 +59,9 @@ static int ticks = 100 * HZ; | |||
59 | 59 | ||
60 | static struct { | 60 | static struct { |
61 | struct completion stop; | 61 | struct completion stop; |
62 | volatile int running; | 62 | int running; |
63 | struct timer_list timer; | 63 | struct timer_list timer; |
64 | volatile int queue; | 64 | int queue; |
65 | int default_ticks; | 65 | int default_ticks; |
66 | unsigned long inuse; | 66 | unsigned long inuse; |
67 | unsigned gpio; | 67 | unsigned gpio; |
diff --git a/drivers/watchdog/pcwd_usb.c b/drivers/watchdog/pcwd_usb.c index 0f3fd6c9c354..bf443d077a1e 100644 --- a/drivers/watchdog/pcwd_usb.c +++ b/drivers/watchdog/pcwd_usb.c | |||
@@ -179,11 +179,11 @@ static void usb_pcwd_intr_done(struct urb *urb) | |||
179 | case -ENOENT: | 179 | case -ENOENT: |
180 | case -ESHUTDOWN: | 180 | case -ESHUTDOWN: |
181 | /* this urb is terminated, clean up */ | 181 | /* this urb is terminated, clean up */ |
182 | dbg("%s - urb shutting down with status: %d", __FUNCTION__, urb->status); | 182 | dbg("%s - urb shutting down with status: %d", __func__, urb->status); |
183 | return; | 183 | return; |
184 | /* -EPIPE: should clear the halt */ | 184 | /* -EPIPE: should clear the halt */ |
185 | default: /* error */ | 185 | default: /* error */ |
186 | dbg("%s - nonzero urb status received: %d", __FUNCTION__, urb->status); | 186 | dbg("%s - nonzero urb status received: %d", __func__, urb->status); |
187 | goto resubmit; | 187 | goto resubmit; |
188 | } | 188 | } |
189 | 189 | ||
diff --git a/drivers/watchdog/s3c2410_wdt.c b/drivers/watchdog/s3c2410_wdt.c index 5d1c15f83d23..7645e8812156 100644 --- a/drivers/watchdog/s3c2410_wdt.c +++ b/drivers/watchdog/s3c2410_wdt.c | |||
@@ -144,7 +144,7 @@ static int s3c2410wdt_start(void) | |||
144 | } | 144 | } |
145 | 145 | ||
146 | DBG("%s: wdt_count=0x%08x, wtcon=%08lx\n", | 146 | DBG("%s: wdt_count=0x%08x, wtcon=%08lx\n", |
147 | __FUNCTION__, wdt_count, wtcon); | 147 | __func__, wdt_count, wtcon); |
148 | 148 | ||
149 | writel(wdt_count, wdt_base + S3C2410_WTDAT); | 149 | writel(wdt_count, wdt_base + S3C2410_WTDAT); |
150 | writel(wdt_count, wdt_base + S3C2410_WTCNT); | 150 | writel(wdt_count, wdt_base + S3C2410_WTCNT); |
@@ -167,7 +167,7 @@ static int s3c2410wdt_set_heartbeat(int timeout) | |||
167 | count = timeout * freq; | 167 | count = timeout * freq; |
168 | 168 | ||
169 | DBG("%s: count=%d, timeout=%d, freq=%d\n", | 169 | DBG("%s: count=%d, timeout=%d, freq=%d\n", |
170 | __FUNCTION__, count, timeout, freq); | 170 | __func__, count, timeout, freq); |
171 | 171 | ||
172 | /* if the count is bigger than the watchdog register, | 172 | /* if the count is bigger than the watchdog register, |
173 | then work out what we need to do (and if) we can | 173 | then work out what we need to do (and if) we can |
@@ -189,7 +189,7 @@ static int s3c2410wdt_set_heartbeat(int timeout) | |||
189 | tmr_margin = timeout; | 189 | tmr_margin = timeout; |
190 | 190 | ||
191 | DBG("%s: timeout=%d, divisor=%d, count=%d (%08x)\n", | 191 | DBG("%s: timeout=%d, divisor=%d, count=%d (%08x)\n", |
192 | __FUNCTION__, timeout, divisor, count, count/divisor); | 192 | __func__, timeout, divisor, count, count/divisor); |
193 | 193 | ||
194 | count /= divisor; | 194 | count /= divisor; |
195 | wdt_count = count; | 195 | wdt_count = count; |
@@ -355,7 +355,7 @@ static int s3c2410wdt_probe(struct platform_device *pdev) | |||
355 | int ret; | 355 | int ret; |
356 | int size; | 356 | int size; |
357 | 357 | ||
358 | DBG("%s: probe=%p\n", __FUNCTION__, pdev); | 358 | DBG("%s: probe=%p\n", __func__, pdev); |
359 | 359 | ||
360 | dev = &pdev->dev; | 360 | dev = &pdev->dev; |
361 | wdt_dev = &pdev->dev; | 361 | wdt_dev = &pdev->dev; |
diff --git a/drivers/watchdog/shwdt.c b/drivers/watchdog/shwdt.c index 61dde863bd40..1277f7e9cc54 100644 --- a/drivers/watchdog/shwdt.c +++ b/drivers/watchdog/shwdt.c | |||
@@ -298,7 +298,7 @@ static int sh_wdt_mmap(struct file *file, struct vm_area_struct *vma) | |||
298 | if (io_remap_pfn_range(vma, vma->vm_start, addr >> PAGE_SHIFT, | 298 | if (io_remap_pfn_range(vma, vma->vm_start, addr >> PAGE_SHIFT, |
299 | PAGE_SIZE, vma->vm_page_prot)) { | 299 | PAGE_SIZE, vma->vm_page_prot)) { |
300 | printk(KERN_ERR PFX "%s: io_remap_pfn_range failed\n", | 300 | printk(KERN_ERR PFX "%s: io_remap_pfn_range failed\n", |
301 | __FUNCTION__); | 301 | __func__); |
302 | return -EAGAIN; | 302 | return -EAGAIN; |
303 | } | 303 | } |
304 | 304 | ||