diff options
author | Steven Whitehouse <swhiteho@redhat.com> | 2006-07-17 09:25:26 -0400 |
---|---|---|
committer | Steven Whitehouse <swhiteho@redhat.com> | 2006-07-17 09:25:26 -0400 |
commit | 4bf311ddfbffe12d41ad1a3c311ab727db6f72cb (patch) | |
tree | 9d19a2774e83637d86dc876f3af22af1dacf0bec /drivers | |
parent | 597d0cae0f99f62501e229bed50e8149604015bb (diff) | |
parent | 82d6897fefca6206bca7153805b4c5359ce97fc4 (diff) |
Merge branch 'master'
Diffstat (limited to 'drivers')
391 files changed, 7954 insertions, 3268 deletions
diff --git a/drivers/acpi/Kconfig b/drivers/acpi/Kconfig index fef7bab12244..56c5ba874623 100644 --- a/drivers/acpi/Kconfig +++ b/drivers/acpi/Kconfig | |||
@@ -107,7 +107,6 @@ config ACPI_BUTTON | |||
107 | config ACPI_VIDEO | 107 | config ACPI_VIDEO |
108 | tristate "Video" | 108 | tristate "Video" |
109 | depends on X86 | 109 | depends on X86 |
110 | default y | ||
111 | help | 110 | help |
112 | This driver implement the ACPI Extensions For Display Adapters | 111 | This driver implement the ACPI Extensions For Display Adapters |
113 | for integrated graphics devices on motherboard, as specified in | 112 | for integrated graphics devices on motherboard, as specified in |
@@ -135,8 +134,7 @@ config ACPI_FAN | |||
135 | 134 | ||
136 | config ACPI_DOCK | 135 | config ACPI_DOCK |
137 | tristate "Dock" | 136 | tristate "Dock" |
138 | depends on !ACPI_IBM_DOCK | 137 | depends on EXPERIMENTAL |
139 | default y | ||
140 | help | 138 | help |
141 | This driver adds support for ACPI controlled docking stations | 139 | This driver adds support for ACPI controlled docking stations |
142 | 140 | ||
@@ -214,6 +212,7 @@ config ACPI_IBM | |||
214 | config ACPI_IBM_DOCK | 212 | config ACPI_IBM_DOCK |
215 | bool "Legacy Docking Station Support" | 213 | bool "Legacy Docking Station Support" |
216 | depends on ACPI_IBM | 214 | depends on ACPI_IBM |
215 | depends on ACPI_DOCK=n | ||
217 | default n | 216 | default n |
218 | ---help--- | 217 | ---help--- |
219 | Allows the ibm_acpi driver to handle docking station events. | 218 | Allows the ibm_acpi driver to handle docking station events. |
@@ -357,7 +356,6 @@ config ACPI_SBS | |||
357 | tristate "Smart Battery System (EXPERIMENTAL)" | 356 | tristate "Smart Battery System (EXPERIMENTAL)" |
358 | depends on X86 && I2C | 357 | depends on X86 && I2C |
359 | depends on EXPERIMENTAL | 358 | depends on EXPERIMENTAL |
360 | default y | ||
361 | help | 359 | help |
362 | This driver adds support for the Smart Battery System. | 360 | This driver adds support for the Smart Battery System. |
363 | Depends on I2C (Device Drivers ---> I2C support) | 361 | Depends on I2C (Device Drivers ---> I2C support) |
diff --git a/drivers/acpi/ac.c b/drivers/acpi/ac.c index 24ccf81d135f..96309b9660da 100644 --- a/drivers/acpi/ac.c +++ b/drivers/acpi/ac.c | |||
@@ -72,7 +72,7 @@ struct acpi_ac { | |||
72 | unsigned long state; | 72 | unsigned long state; |
73 | }; | 73 | }; |
74 | 74 | ||
75 | static struct file_operations acpi_ac_fops = { | 75 | static const struct file_operations acpi_ac_fops = { |
76 | .open = acpi_ac_open_fs, | 76 | .open = acpi_ac_open_fs, |
77 | .read = seq_read, | 77 | .read = seq_read, |
78 | .llseek = seq_lseek, | 78 | .llseek = seq_lseek, |
diff --git a/drivers/acpi/battery.c b/drivers/acpi/battery.c index 24bf4dca88cc..6e5221707d97 100644 --- a/drivers/acpi/battery.c +++ b/drivers/acpi/battery.c | |||
@@ -557,7 +557,7 @@ static int acpi_battery_alarm_open_fs(struct inode *inode, struct file *file) | |||
557 | return single_open(file, acpi_battery_read_alarm, PDE(inode)->data); | 557 | return single_open(file, acpi_battery_read_alarm, PDE(inode)->data); |
558 | } | 558 | } |
559 | 559 | ||
560 | static struct file_operations acpi_battery_info_ops = { | 560 | static const struct file_operations acpi_battery_info_ops = { |
561 | .open = acpi_battery_info_open_fs, | 561 | .open = acpi_battery_info_open_fs, |
562 | .read = seq_read, | 562 | .read = seq_read, |
563 | .llseek = seq_lseek, | 563 | .llseek = seq_lseek, |
@@ -565,7 +565,7 @@ static struct file_operations acpi_battery_info_ops = { | |||
565 | .owner = THIS_MODULE, | 565 | .owner = THIS_MODULE, |
566 | }; | 566 | }; |
567 | 567 | ||
568 | static struct file_operations acpi_battery_state_ops = { | 568 | static const struct file_operations acpi_battery_state_ops = { |
569 | .open = acpi_battery_state_open_fs, | 569 | .open = acpi_battery_state_open_fs, |
570 | .read = seq_read, | 570 | .read = seq_read, |
571 | .llseek = seq_lseek, | 571 | .llseek = seq_lseek, |
@@ -573,7 +573,7 @@ static struct file_operations acpi_battery_state_ops = { | |||
573 | .owner = THIS_MODULE, | 573 | .owner = THIS_MODULE, |
574 | }; | 574 | }; |
575 | 575 | ||
576 | static struct file_operations acpi_battery_alarm_ops = { | 576 | static const struct file_operations acpi_battery_alarm_ops = { |
577 | .open = acpi_battery_alarm_open_fs, | 577 | .open = acpi_battery_alarm_open_fs, |
578 | .read = seq_read, | 578 | .read = seq_read, |
579 | .write = acpi_battery_write_alarm, | 579 | .write = acpi_battery_write_alarm, |
diff --git a/drivers/acpi/bus.c b/drivers/acpi/bus.c index ea5a0496a4fd..b2977695e120 100644 --- a/drivers/acpi/bus.c +++ b/drivers/acpi/bus.c | |||
@@ -192,8 +192,8 @@ int acpi_bus_set_power(acpi_handle handle, int state) | |||
192 | /* Make sure this is a valid target state */ | 192 | /* Make sure this is a valid target state */ |
193 | 193 | ||
194 | if (!device->flags.power_manageable) { | 194 | if (!device->flags.power_manageable) { |
195 | printk(KERN_DEBUG "Device `[%s]' is not power manageable", | 195 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Device `[%s]' is not power manageable", |
196 | device->kobj.name); | 196 | device->kobj.name)); |
197 | return -ENODEV; | 197 | return -ENODEV; |
198 | } | 198 | } |
199 | /* | 199 | /* |
diff --git a/drivers/acpi/button.c b/drivers/acpi/button.c index fd1ba05eab68..5ef885e82c78 100644 --- a/drivers/acpi/button.c +++ b/drivers/acpi/button.c | |||
@@ -87,14 +87,14 @@ struct acpi_button { | |||
87 | unsigned long pushed; | 87 | unsigned long pushed; |
88 | }; | 88 | }; |
89 | 89 | ||
90 | static struct file_operations acpi_button_info_fops = { | 90 | static const struct file_operations acpi_button_info_fops = { |
91 | .open = acpi_button_info_open_fs, | 91 | .open = acpi_button_info_open_fs, |
92 | .read = seq_read, | 92 | .read = seq_read, |
93 | .llseek = seq_lseek, | 93 | .llseek = seq_lseek, |
94 | .release = single_release, | 94 | .release = single_release, |
95 | }; | 95 | }; |
96 | 96 | ||
97 | static struct file_operations acpi_button_state_fops = { | 97 | static const struct file_operations acpi_button_state_fops = { |
98 | .open = acpi_button_state_open_fs, | 98 | .open = acpi_button_state_open_fs, |
99 | .read = seq_read, | 99 | .read = seq_read, |
100 | .llseek = seq_lseek, | 100 | .llseek = seq_lseek, |
diff --git a/drivers/acpi/cm_sbs.c b/drivers/acpi/cm_sbs.c index 574a75a166c5..a01ce6700bfe 100644 --- a/drivers/acpi/cm_sbs.c +++ b/drivers/acpi/cm_sbs.c | |||
@@ -39,50 +39,43 @@ ACPI_MODULE_NAME("cm_sbs") | |||
39 | static struct proc_dir_entry *acpi_ac_dir; | 39 | static struct proc_dir_entry *acpi_ac_dir; |
40 | static struct proc_dir_entry *acpi_battery_dir; | 40 | static struct proc_dir_entry *acpi_battery_dir; |
41 | 41 | ||
42 | static struct semaphore cm_sbs_sem; | 42 | static DEFINE_MUTEX(cm_sbs_mutex); |
43 | 43 | ||
44 | static int lock_ac_dir_cnt = 0; | 44 | static int lock_ac_dir_cnt; |
45 | static int lock_battery_dir_cnt = 0; | 45 | static int lock_battery_dir_cnt; |
46 | 46 | ||
47 | struct proc_dir_entry *acpi_lock_ac_dir(void) | 47 | struct proc_dir_entry *acpi_lock_ac_dir(void) |
48 | { | 48 | { |
49 | 49 | mutex_lock(&cm_sbs_mutex); | |
50 | down(&cm_sbs_sem); | 50 | if (!acpi_ac_dir) |
51 | if (!acpi_ac_dir) { | ||
52 | acpi_ac_dir = proc_mkdir(ACPI_AC_CLASS, acpi_root_dir); | 51 | acpi_ac_dir = proc_mkdir(ACPI_AC_CLASS, acpi_root_dir); |
53 | } | ||
54 | if (acpi_ac_dir) { | 52 | if (acpi_ac_dir) { |
55 | lock_ac_dir_cnt++; | 53 | lock_ac_dir_cnt++; |
56 | } else { | 54 | } else { |
57 | ACPI_DEBUG_PRINT((ACPI_DB_ERROR, | 55 | ACPI_DEBUG_PRINT((ACPI_DB_ERROR, |
58 | "Cannot create %s\n", ACPI_AC_CLASS)); | 56 | "Cannot create %s\n", ACPI_AC_CLASS)); |
59 | } | 57 | } |
60 | up(&cm_sbs_sem); | 58 | mutex_unlock(&cm_sbs_mutex); |
61 | return acpi_ac_dir; | 59 | return acpi_ac_dir; |
62 | } | 60 | } |
63 | |||
64 | EXPORT_SYMBOL(acpi_lock_ac_dir); | 61 | EXPORT_SYMBOL(acpi_lock_ac_dir); |
65 | 62 | ||
66 | void acpi_unlock_ac_dir(struct proc_dir_entry *acpi_ac_dir_param) | 63 | void acpi_unlock_ac_dir(struct proc_dir_entry *acpi_ac_dir_param) |
67 | { | 64 | { |
68 | 65 | mutex_lock(&cm_sbs_mutex); | |
69 | down(&cm_sbs_sem); | 66 | if (acpi_ac_dir_param) |
70 | if (acpi_ac_dir_param) { | ||
71 | lock_ac_dir_cnt--; | 67 | lock_ac_dir_cnt--; |
72 | } | ||
73 | if (lock_ac_dir_cnt == 0 && acpi_ac_dir_param && acpi_ac_dir) { | 68 | if (lock_ac_dir_cnt == 0 && acpi_ac_dir_param && acpi_ac_dir) { |
74 | remove_proc_entry(ACPI_AC_CLASS, acpi_root_dir); | 69 | remove_proc_entry(ACPI_AC_CLASS, acpi_root_dir); |
75 | acpi_ac_dir = 0; | 70 | acpi_ac_dir = 0; |
76 | } | 71 | } |
77 | up(&cm_sbs_sem); | 72 | mutex_unlock(&cm_sbs_mutex); |
78 | } | 73 | } |
79 | |||
80 | EXPORT_SYMBOL(acpi_unlock_ac_dir); | 74 | EXPORT_SYMBOL(acpi_unlock_ac_dir); |
81 | 75 | ||
82 | struct proc_dir_entry *acpi_lock_battery_dir(void) | 76 | struct proc_dir_entry *acpi_lock_battery_dir(void) |
83 | { | 77 | { |
84 | 78 | mutex_lock(&cm_sbs_mutex); | |
85 | down(&cm_sbs_sem); | ||
86 | if (!acpi_battery_dir) { | 79 | if (!acpi_battery_dir) { |
87 | acpi_battery_dir = | 80 | acpi_battery_dir = |
88 | proc_mkdir(ACPI_BATTERY_CLASS, acpi_root_dir); | 81 | proc_mkdir(ACPI_BATTERY_CLASS, acpi_root_dir); |
@@ -93,39 +86,28 @@ struct proc_dir_entry *acpi_lock_battery_dir(void) | |||
93 | ACPI_DEBUG_PRINT((ACPI_DB_ERROR, | 86 | ACPI_DEBUG_PRINT((ACPI_DB_ERROR, |
94 | "Cannot create %s\n", ACPI_BATTERY_CLASS)); | 87 | "Cannot create %s\n", ACPI_BATTERY_CLASS)); |
95 | } | 88 | } |
96 | up(&cm_sbs_sem); | 89 | mutex_unlock(&cm_sbs_mutex); |
97 | return acpi_battery_dir; | 90 | return acpi_battery_dir; |
98 | } | 91 | } |
99 | |||
100 | EXPORT_SYMBOL(acpi_lock_battery_dir); | 92 | EXPORT_SYMBOL(acpi_lock_battery_dir); |
101 | 93 | ||
102 | void acpi_unlock_battery_dir(struct proc_dir_entry *acpi_battery_dir_param) | 94 | void acpi_unlock_battery_dir(struct proc_dir_entry *acpi_battery_dir_param) |
103 | { | 95 | { |
104 | 96 | mutex_lock(&cm_sbs_mutex); | |
105 | down(&cm_sbs_sem); | 97 | if (acpi_battery_dir_param) |
106 | if (acpi_battery_dir_param) { | ||
107 | lock_battery_dir_cnt--; | 98 | lock_battery_dir_cnt--; |
108 | } | ||
109 | if (lock_battery_dir_cnt == 0 && acpi_battery_dir_param | 99 | if (lock_battery_dir_cnt == 0 && acpi_battery_dir_param |
110 | && acpi_battery_dir) { | 100 | && acpi_battery_dir) { |
111 | remove_proc_entry(ACPI_BATTERY_CLASS, acpi_root_dir); | 101 | remove_proc_entry(ACPI_BATTERY_CLASS, acpi_root_dir); |
112 | acpi_battery_dir = 0; | 102 | acpi_battery_dir = 0; |
113 | } | 103 | } |
114 | up(&cm_sbs_sem); | 104 | mutex_unlock(&cm_sbs_mutex); |
115 | return; | 105 | return; |
116 | } | 106 | } |
117 | |||
118 | EXPORT_SYMBOL(acpi_unlock_battery_dir); | 107 | EXPORT_SYMBOL(acpi_unlock_battery_dir); |
119 | 108 | ||
120 | static int __init acpi_cm_sbs_init(void) | 109 | static int __init acpi_cm_sbs_init(void) |
121 | { | 110 | { |
122 | |||
123 | if (acpi_disabled) | ||
124 | return 0; | ||
125 | |||
126 | init_MUTEX(&cm_sbs_sem); | ||
127 | |||
128 | return 0; | 111 | return 0; |
129 | } | 112 | } |
130 | |||
131 | subsys_initcall(acpi_cm_sbs_init); | 113 | subsys_initcall(acpi_cm_sbs_init); |
diff --git a/drivers/acpi/dispatcher/dsinit.c b/drivers/acpi/dispatcher/dsinit.c index daf51b5b5875..1888c055d10f 100644 --- a/drivers/acpi/dispatcher/dsinit.c +++ b/drivers/acpi/dispatcher/dsinit.c | |||
@@ -116,16 +116,6 @@ acpi_ds_init_one_object(acpi_handle obj_handle, | |||
116 | 116 | ||
117 | case ACPI_TYPE_METHOD: | 117 | case ACPI_TYPE_METHOD: |
118 | 118 | ||
119 | /* | ||
120 | * Set the execution data width (32 or 64) based upon the | ||
121 | * revision number of the parent ACPI table. | ||
122 | * TBD: This is really for possible future support of integer width | ||
123 | * on a per-table basis. Currently, we just use a global for the width. | ||
124 | */ | ||
125 | if (info->table_desc->pointer->revision == 1) { | ||
126 | node->flags |= ANOBJ_DATA_WIDTH_32; | ||
127 | } | ||
128 | |||
129 | info->method_count++; | 119 | info->method_count++; |
130 | break; | 120 | break; |
131 | 121 | ||
diff --git a/drivers/acpi/dispatcher/dsmethod.c b/drivers/acpi/dispatcher/dsmethod.c index a39a33f4847a..cf888add3191 100644 --- a/drivers/acpi/dispatcher/dsmethod.c +++ b/drivers/acpi/dispatcher/dsmethod.c | |||
@@ -134,7 +134,7 @@ acpi_ds_create_method_mutex(union acpi_operand_object *method_desc) | |||
134 | union acpi_operand_object *mutex_desc; | 134 | union acpi_operand_object *mutex_desc; |
135 | acpi_status status; | 135 | acpi_status status; |
136 | 136 | ||
137 | ACPI_FUNCTION_NAME(ds_create_method_mutex); | 137 | ACPI_FUNCTION_TRACE(ds_create_method_mutex); |
138 | 138 | ||
139 | /* Create the new mutex object */ | 139 | /* Create the new mutex object */ |
140 | 140 | ||
@@ -493,7 +493,7 @@ acpi_ds_restart_control_method(struct acpi_walk_state *walk_state, | |||
493 | 493 | ||
494 | ACPI_DEBUG_PRINT((ACPI_DB_DISPATCH, | 494 | ACPI_DEBUG_PRINT((ACPI_DB_DISPATCH, |
495 | "****Restart [%4.4s] Op %p ReturnValueFromCallee %p\n", | 495 | "****Restart [%4.4s] Op %p ReturnValueFromCallee %p\n", |
496 | (char *)&walk_state->method_node->name, | 496 | acpi_ut_get_node_name(walk_state->method_node), |
497 | walk_state->method_call_op, return_desc)); | 497 | walk_state->method_call_op, return_desc)); |
498 | 498 | ||
499 | ACPI_DEBUG_PRINT((ACPI_DB_DISPATCH, | 499 | ACPI_DEBUG_PRINT((ACPI_DB_DISPATCH, |
@@ -610,6 +610,7 @@ acpi_ds_terminate_control_method(union acpi_operand_object *method_desc, | |||
610 | 610 | ||
611 | acpi_os_release_mutex(method_desc->method.mutex->mutex. | 611 | acpi_os_release_mutex(method_desc->method.mutex->mutex. |
612 | os_mutex); | 612 | os_mutex); |
613 | method_desc->method.mutex->mutex.owner_thread = NULL; | ||
613 | } | 614 | } |
614 | } | 615 | } |
615 | 616 | ||
@@ -620,27 +621,11 @@ acpi_ds_terminate_control_method(union acpi_operand_object *method_desc, | |||
620 | */ | 621 | */ |
621 | method_node = walk_state->method_node; | 622 | method_node = walk_state->method_node; |
622 | 623 | ||
623 | /* Lock namespace for possible update */ | ||
624 | |||
625 | status = acpi_ut_acquire_mutex(ACPI_MTX_NAMESPACE); | ||
626 | if (ACPI_FAILURE(status)) { | ||
627 | return_VOID; | ||
628 | } | ||
629 | |||
630 | /* | ||
631 | * Delete any namespace entries created immediately underneath | ||
632 | * the method | ||
633 | */ | ||
634 | if (method_node && method_node->child) { | ||
635 | acpi_ns_delete_namespace_subtree(method_node); | ||
636 | } | ||
637 | |||
638 | /* | 624 | /* |
639 | * Delete any namespace entries created anywhere else within | 625 | * Delete any namespace objects created anywhere within |
640 | * the namespace by the execution of this method | 626 | * the namespace by the execution of this method |
641 | */ | 627 | */ |
642 | acpi_ns_delete_namespace_by_owner(method_desc->method.owner_id); | 628 | acpi_ns_delete_namespace_by_owner(method_desc->method.owner_id); |
643 | status = acpi_ut_release_mutex(ACPI_MTX_NAMESPACE); | ||
644 | } | 629 | } |
645 | 630 | ||
646 | /* Decrement the thread count on the method */ | 631 | /* Decrement the thread count on the method */ |
diff --git a/drivers/acpi/dispatcher/dswexec.c b/drivers/acpi/dispatcher/dswexec.c index b1ded62d0df1..d7a616c3104e 100644 --- a/drivers/acpi/dispatcher/dswexec.c +++ b/drivers/acpi/dispatcher/dswexec.c | |||
@@ -313,10 +313,10 @@ acpi_ds_exec_begin_op(struct acpi_walk_state *walk_state, | |||
313 | case AML_CLASS_EXECUTE: | 313 | case AML_CLASS_EXECUTE: |
314 | case AML_CLASS_CREATE: | 314 | case AML_CLASS_CREATE: |
315 | /* | 315 | /* |
316 | * Most operators with arguments. | 316 | * Most operators with arguments (except create_xxx_field operators) |
317 | * Start a new result/operand state | 317 | * Start a new result/operand state |
318 | */ | 318 | */ |
319 | if (walk_state->opcode != AML_CREATE_FIELD_OP) { | 319 | if (walk_state->op_info->object_type != ACPI_TYPE_BUFFER_FIELD) { |
320 | status = acpi_ds_result_stack_push(walk_state); | 320 | status = acpi_ds_result_stack_push(walk_state); |
321 | } | 321 | } |
322 | break; | 322 | break; |
diff --git a/drivers/acpi/dock.c b/drivers/acpi/dock.c index 510a94524298..1c0a39d8b04e 100644 --- a/drivers/acpi/dock.c +++ b/drivers/acpi/dock.c | |||
@@ -627,6 +627,7 @@ static int dock_add(acpi_handle handle) | |||
627 | INIT_LIST_HEAD(&dock_station->hotplug_devices); | 627 | INIT_LIST_HEAD(&dock_station->hotplug_devices); |
628 | spin_lock_init(&dock_station->dd_lock); | 628 | spin_lock_init(&dock_station->dd_lock); |
629 | spin_lock_init(&dock_station->hp_lock); | 629 | spin_lock_init(&dock_station->hp_lock); |
630 | ATOMIC_INIT_NOTIFIER_HEAD(&dock_notifier_list); | ||
630 | 631 | ||
631 | /* Find dependent devices */ | 632 | /* Find dependent devices */ |
632 | acpi_walk_namespace(ACPI_TYPE_DEVICE, ACPI_ROOT_OBJECT, | 633 | acpi_walk_namespace(ACPI_TYPE_DEVICE, ACPI_ROOT_OBJECT, |
diff --git a/drivers/acpi/ec.c b/drivers/acpi/ec.c index 8c5d7df7d343..e5d796362854 100644 --- a/drivers/acpi/ec.c +++ b/drivers/acpi/ec.c | |||
@@ -929,7 +929,7 @@ static int acpi_ec_info_open_fs(struct inode *inode, struct file *file) | |||
929 | return single_open(file, acpi_ec_read_info, PDE(inode)->data); | 929 | return single_open(file, acpi_ec_read_info, PDE(inode)->data); |
930 | } | 930 | } |
931 | 931 | ||
932 | static struct file_operations acpi_ec_info_ops = { | 932 | static const struct file_operations acpi_ec_info_ops = { |
933 | .open = acpi_ec_info_open_fs, | 933 | .open = acpi_ec_info_open_fs, |
934 | .read = seq_read, | 934 | .read = seq_read, |
935 | .llseek = seq_lseek, | 935 | .llseek = seq_lseek, |
diff --git a/drivers/acpi/event.c b/drivers/acpi/event.c index a901b23e95e7..959a893c8d1f 100644 --- a/drivers/acpi/event.c +++ b/drivers/acpi/event.c | |||
@@ -99,7 +99,7 @@ static unsigned int acpi_system_poll_event(struct file *file, poll_table * wait) | |||
99 | return 0; | 99 | return 0; |
100 | } | 100 | } |
101 | 101 | ||
102 | static struct file_operations acpi_system_event_ops = { | 102 | static const struct file_operations acpi_system_event_ops = { |
103 | .open = acpi_system_open_event, | 103 | .open = acpi_system_open_event, |
104 | .read = acpi_system_read_event, | 104 | .read = acpi_system_read_event, |
105 | .release = acpi_system_close_event, | 105 | .release = acpi_system_close_event, |
diff --git a/drivers/acpi/events/evregion.c b/drivers/acpi/events/evregion.c index 094a17e4c86d..21caae04fe85 100644 --- a/drivers/acpi/events/evregion.c +++ b/drivers/acpi/events/evregion.c | |||
@@ -528,34 +528,40 @@ acpi_ev_detach_region(union acpi_operand_object *region_obj, | |||
528 | } | 528 | } |
529 | } | 529 | } |
530 | 530 | ||
531 | /* Call the setup handler with the deactivate notification */ | 531 | /* |
532 | * If the region has been activated, call the setup handler | ||
533 | * with the deactivate notification | ||
534 | */ | ||
535 | if (region_obj->region.flags & AOPOBJ_SETUP_COMPLETE) { | ||
536 | region_setup = handler_obj->address_space.setup; | ||
537 | status = | ||
538 | region_setup(region_obj, | ||
539 | ACPI_REGION_DEACTIVATE, | ||
540 | handler_obj->address_space. | ||
541 | context, region_context); | ||
532 | 542 | ||
533 | region_setup = handler_obj->address_space.setup; | 543 | /* Init routine may fail, Just ignore errors */ |
534 | status = | ||
535 | region_setup(region_obj, ACPI_REGION_DEACTIVATE, | ||
536 | handler_obj->address_space.context, | ||
537 | region_context); | ||
538 | 544 | ||
539 | /* Init routine may fail, Just ignore errors */ | 545 | if (ACPI_FAILURE(status)) { |
546 | ACPI_EXCEPTION((AE_INFO, status, | ||
547 | "from region handler - deactivate, [%s]", | ||
548 | acpi_ut_get_region_name | ||
549 | (region_obj->region. | ||
550 | space_id))); | ||
551 | } | ||
540 | 552 | ||
541 | if (ACPI_FAILURE(status)) { | 553 | region_obj->region.flags &= |
542 | ACPI_EXCEPTION((AE_INFO, status, | 554 | ~(AOPOBJ_SETUP_COMPLETE); |
543 | "from region init, [%s]", | ||
544 | acpi_ut_get_region_name | ||
545 | (region_obj->region.space_id))); | ||
546 | } | 555 | } |
547 | 556 | ||
548 | region_obj->region.flags &= ~(AOPOBJ_SETUP_COMPLETE); | ||
549 | |||
550 | /* | 557 | /* |
551 | * Remove handler reference in the region | 558 | * Remove handler reference in the region |
552 | * | 559 | * |
553 | * NOTE: this doesn't mean that the region goes away | 560 | * NOTE: this doesn't mean that the region goes away, the region |
554 | * The region is just inaccessible as indicated to | 561 | * is just inaccessible as indicated to the _REG method |
555 | * the _REG method | ||
556 | * | 562 | * |
557 | * If the region is on the handler's list | 563 | * If the region is on the handler's list, this must be the |
558 | * this better be the region's handler | 564 | * region's handler |
559 | */ | 565 | */ |
560 | region_obj->region.handler = NULL; | 566 | region_obj->region.handler = NULL; |
561 | acpi_ut_remove_reference(handler_obj); | 567 | acpi_ut_remove_reference(handler_obj); |
diff --git a/drivers/acpi/events/evxface.c b/drivers/acpi/events/evxface.c index 4f948df17ab9..923fd2b46955 100644 --- a/drivers/acpi/events/evxface.c +++ b/drivers/acpi/events/evxface.c | |||
@@ -428,7 +428,7 @@ acpi_remove_notify_handler(acpi_handle device, | |||
428 | node = acpi_ns_map_handle_to_node(device); | 428 | node = acpi_ns_map_handle_to_node(device); |
429 | if (!node) { | 429 | if (!node) { |
430 | status = AE_BAD_PARAMETER; | 430 | status = AE_BAD_PARAMETER; |
431 | goto unlock; | 431 | goto unlock_and_exit; |
432 | } | 432 | } |
433 | 433 | ||
434 | /* Root Object */ | 434 | /* Root Object */ |
@@ -442,7 +442,7 @@ acpi_remove_notify_handler(acpi_handle device, | |||
442 | ((handler_type & ACPI_DEVICE_NOTIFY) && | 442 | ((handler_type & ACPI_DEVICE_NOTIFY) && |
443 | !acpi_gbl_device_notify.handler)) { | 443 | !acpi_gbl_device_notify.handler)) { |
444 | status = AE_NOT_EXIST; | 444 | status = AE_NOT_EXIST; |
445 | goto unlock; | 445 | goto unlock_and_exit; |
446 | } | 446 | } |
447 | 447 | ||
448 | /* Make sure all deferred tasks are completed */ | 448 | /* Make sure all deferred tasks are completed */ |
@@ -474,7 +474,7 @@ acpi_remove_notify_handler(acpi_handle device, | |||
474 | 474 | ||
475 | if (!acpi_ev_is_notify_object(node)) { | 475 | if (!acpi_ev_is_notify_object(node)) { |
476 | status = AE_TYPE; | 476 | status = AE_TYPE; |
477 | goto unlock; | 477 | goto unlock_and_exit; |
478 | } | 478 | } |
479 | 479 | ||
480 | /* Check for an existing internal object */ | 480 | /* Check for an existing internal object */ |
@@ -482,17 +482,21 @@ acpi_remove_notify_handler(acpi_handle device, | |||
482 | obj_desc = acpi_ns_get_attached_object(node); | 482 | obj_desc = acpi_ns_get_attached_object(node); |
483 | if (!obj_desc) { | 483 | if (!obj_desc) { |
484 | status = AE_NOT_EXIST; | 484 | status = AE_NOT_EXIST; |
485 | goto unlock; | 485 | goto unlock_and_exit; |
486 | } | 486 | } |
487 | 487 | ||
488 | /* Object exists - make sure there's an existing handler */ | 488 | /* Object exists - make sure there's an existing handler */ |
489 | 489 | ||
490 | if (handler_type & ACPI_SYSTEM_NOTIFY) { | 490 | if (handler_type & ACPI_SYSTEM_NOTIFY) { |
491 | notify_obj = obj_desc->common_notify.system_notify; | 491 | notify_obj = obj_desc->common_notify.system_notify; |
492 | if ((!notify_obj) || | 492 | if (!notify_obj) { |
493 | (notify_obj->notify.handler != handler)) { | 493 | status = AE_NOT_EXIST; |
494 | goto unlock_and_exit; | ||
495 | } | ||
496 | |||
497 | if (notify_obj->notify.handler != handler) { | ||
494 | status = AE_BAD_PARAMETER; | 498 | status = AE_BAD_PARAMETER; |
495 | goto unlock; | 499 | goto unlock_and_exit; |
496 | } | 500 | } |
497 | /* Make sure all deferred tasks are completed */ | 501 | /* Make sure all deferred tasks are completed */ |
498 | 502 | ||
@@ -510,10 +514,14 @@ acpi_remove_notify_handler(acpi_handle device, | |||
510 | 514 | ||
511 | if (handler_type & ACPI_DEVICE_NOTIFY) { | 515 | if (handler_type & ACPI_DEVICE_NOTIFY) { |
512 | notify_obj = obj_desc->common_notify.device_notify; | 516 | notify_obj = obj_desc->common_notify.device_notify; |
513 | if ((!notify_obj) || | 517 | if (!notify_obj) { |
514 | (notify_obj->notify.handler != handler)) { | 518 | status = AE_NOT_EXIST; |
519 | goto unlock_and_exit; | ||
520 | } | ||
521 | |||
522 | if (notify_obj->notify.handler != handler) { | ||
515 | status = AE_BAD_PARAMETER; | 523 | status = AE_BAD_PARAMETER; |
516 | goto unlock; | 524 | goto unlock_and_exit; |
517 | } | 525 | } |
518 | /* Make sure all deferred tasks are completed */ | 526 | /* Make sure all deferred tasks are completed */ |
519 | 527 | ||
@@ -530,9 +538,9 @@ acpi_remove_notify_handler(acpi_handle device, | |||
530 | } | 538 | } |
531 | } | 539 | } |
532 | 540 | ||
533 | unlock: | 541 | unlock_and_exit: |
534 | (void)acpi_ut_release_mutex(ACPI_MTX_NAMESPACE); | 542 | (void)acpi_ut_release_mutex(ACPI_MTX_NAMESPACE); |
535 | exit: | 543 | exit: |
536 | if (ACPI_FAILURE(status)) | 544 | if (ACPI_FAILURE(status)) |
537 | ACPI_EXCEPTION((AE_INFO, status, "Removing notify handler")); | 545 | ACPI_EXCEPTION((AE_INFO, status, "Removing notify handler")); |
538 | return_ACPI_STATUS(status); | 546 | return_ACPI_STATUS(status); |
@@ -586,7 +594,7 @@ acpi_install_gpe_handler(acpi_handle gpe_device, | |||
586 | gpe_event_info = acpi_ev_get_gpe_event_info(gpe_device, gpe_number); | 594 | gpe_event_info = acpi_ev_get_gpe_event_info(gpe_device, gpe_number); |
587 | if (!gpe_event_info) { | 595 | if (!gpe_event_info) { |
588 | status = AE_BAD_PARAMETER; | 596 | status = AE_BAD_PARAMETER; |
589 | goto unlock; | 597 | goto unlock_and_exit; |
590 | } | 598 | } |
591 | 599 | ||
592 | /* Make sure that there isn't a handler there already */ | 600 | /* Make sure that there isn't a handler there already */ |
@@ -594,7 +602,7 @@ acpi_install_gpe_handler(acpi_handle gpe_device, | |||
594 | if ((gpe_event_info->flags & ACPI_GPE_DISPATCH_MASK) == | 602 | if ((gpe_event_info->flags & ACPI_GPE_DISPATCH_MASK) == |
595 | ACPI_GPE_DISPATCH_HANDLER) { | 603 | ACPI_GPE_DISPATCH_HANDLER) { |
596 | status = AE_ALREADY_EXISTS; | 604 | status = AE_ALREADY_EXISTS; |
597 | goto unlock; | 605 | goto unlock_and_exit; |
598 | } | 606 | } |
599 | 607 | ||
600 | /* Allocate and init handler object */ | 608 | /* Allocate and init handler object */ |
@@ -602,7 +610,7 @@ acpi_install_gpe_handler(acpi_handle gpe_device, | |||
602 | handler = ACPI_ALLOCATE_ZEROED(sizeof(struct acpi_handler_info)); | 610 | handler = ACPI_ALLOCATE_ZEROED(sizeof(struct acpi_handler_info)); |
603 | if (!handler) { | 611 | if (!handler) { |
604 | status = AE_NO_MEMORY; | 612 | status = AE_NO_MEMORY; |
605 | goto unlock; | 613 | goto unlock_and_exit; |
606 | } | 614 | } |
607 | 615 | ||
608 | handler->address = address; | 616 | handler->address = address; |
@@ -613,7 +621,7 @@ acpi_install_gpe_handler(acpi_handle gpe_device, | |||
613 | 621 | ||
614 | status = acpi_ev_disable_gpe(gpe_event_info); | 622 | status = acpi_ev_disable_gpe(gpe_event_info); |
615 | if (ACPI_FAILURE(status)) { | 623 | if (ACPI_FAILURE(status)) { |
616 | goto unlock; | 624 | goto unlock_and_exit; |
617 | } | 625 | } |
618 | 626 | ||
619 | /* Install the handler */ | 627 | /* Install the handler */ |
@@ -628,9 +636,9 @@ acpi_install_gpe_handler(acpi_handle gpe_device, | |||
628 | 636 | ||
629 | acpi_os_release_lock(acpi_gbl_gpe_lock, flags); | 637 | acpi_os_release_lock(acpi_gbl_gpe_lock, flags); |
630 | 638 | ||
631 | unlock: | 639 | unlock_and_exit: |
632 | (void)acpi_ut_release_mutex(ACPI_MTX_EVENTS); | 640 | (void)acpi_ut_release_mutex(ACPI_MTX_EVENTS); |
633 | exit: | 641 | exit: |
634 | if (ACPI_FAILURE(status)) | 642 | if (ACPI_FAILURE(status)) |
635 | ACPI_EXCEPTION((AE_INFO, status, | 643 | ACPI_EXCEPTION((AE_INFO, status, |
636 | "Installing notify handler failed")); | 644 | "Installing notify handler failed")); |
diff --git a/drivers/acpi/events/evxfregn.c b/drivers/acpi/events/evxfregn.c index e8b86a0baad0..83b12a9afa32 100644 --- a/drivers/acpi/events/evxfregn.c +++ b/drivers/acpi/events/evxfregn.c | |||
@@ -155,7 +155,11 @@ acpi_remove_address_space_handler(acpi_handle device, | |||
155 | /* Convert and validate the device handle */ | 155 | /* Convert and validate the device handle */ |
156 | 156 | ||
157 | node = acpi_ns_map_handle_to_node(device); | 157 | node = acpi_ns_map_handle_to_node(device); |
158 | if (!node) { | 158 | if (!node || |
159 | ((node->type != ACPI_TYPE_DEVICE) && | ||
160 | (node->type != ACPI_TYPE_PROCESSOR) && | ||
161 | (node->type != ACPI_TYPE_THERMAL) && | ||
162 | (node != acpi_gbl_root_node))) { | ||
159 | status = AE_BAD_PARAMETER; | 163 | status = AE_BAD_PARAMETER; |
160 | goto unlock_and_exit; | 164 | goto unlock_and_exit; |
161 | } | 165 | } |
@@ -178,6 +182,13 @@ acpi_remove_address_space_handler(acpi_handle device, | |||
178 | 182 | ||
179 | if (handler_obj->address_space.space_id == space_id) { | 183 | if (handler_obj->address_space.space_id == space_id) { |
180 | 184 | ||
185 | /* Handler must be the same as the installed handler */ | ||
186 | |||
187 | if (handler_obj->address_space.handler != handler) { | ||
188 | status = AE_BAD_PARAMETER; | ||
189 | goto unlock_and_exit; | ||
190 | } | ||
191 | |||
181 | /* Matched space_id, first dereference this in the Regions */ | 192 | /* Matched space_id, first dereference this in the Regions */ |
182 | 193 | ||
183 | ACPI_DEBUG_PRINT((ACPI_DB_OPREGION, | 194 | ACPI_DEBUG_PRINT((ACPI_DB_OPREGION, |
diff --git a/drivers/acpi/executer/exconfig.c b/drivers/acpi/executer/exconfig.c index 83fed079a276..c8341fa5fe01 100644 --- a/drivers/acpi/executer/exconfig.c +++ b/drivers/acpi/executer/exconfig.c | |||
@@ -502,7 +502,6 @@ acpi_status acpi_ex_unload_table(union acpi_operand_object *ddb_handle) | |||
502 | * (Offset contains the table_id) | 502 | * (Offset contains the table_id) |
503 | */ | 503 | */ |
504 | acpi_ns_delete_namespace_by_owner(table_info->owner_id); | 504 | acpi_ns_delete_namespace_by_owner(table_info->owner_id); |
505 | acpi_ut_release_owner_id(&table_info->owner_id); | ||
506 | 505 | ||
507 | /* Delete the table itself */ | 506 | /* Delete the table itself */ |
508 | 507 | ||
diff --git a/drivers/acpi/executer/exconvrt.c b/drivers/acpi/executer/exconvrt.c index b732e399b1ef..544e81a6a438 100644 --- a/drivers/acpi/executer/exconvrt.c +++ b/drivers/acpi/executer/exconvrt.c | |||
@@ -170,6 +170,9 @@ acpi_ex_convert_to_integer(union acpi_operand_object *obj_desc, | |||
170 | return_ACPI_STATUS(AE_NO_MEMORY); | 170 | return_ACPI_STATUS(AE_NO_MEMORY); |
171 | } | 171 | } |
172 | 172 | ||
173 | ACPI_DEBUG_PRINT((ACPI_DB_EXEC, "Converted value: %8.8X%8.8X\n", | ||
174 | ACPI_FORMAT_UINT64(result))); | ||
175 | |||
173 | /* Save the Result */ | 176 | /* Save the Result */ |
174 | 177 | ||
175 | return_desc->integer.value = result; | 178 | return_desc->integer.value = result; |
diff --git a/drivers/acpi/executer/exmutex.c b/drivers/acpi/executer/exmutex.c index d8ac2877cf05..3a39c2e8e104 100644 --- a/drivers/acpi/executer/exmutex.c +++ b/drivers/acpi/executer/exmutex.c | |||
@@ -267,9 +267,9 @@ acpi_ex_release_mutex(union acpi_operand_object *obj_desc, | |||
267 | && (obj_desc->mutex.os_mutex != ACPI_GLOBAL_LOCK)) { | 267 | && (obj_desc->mutex.os_mutex != ACPI_GLOBAL_LOCK)) { |
268 | ACPI_ERROR((AE_INFO, | 268 | ACPI_ERROR((AE_INFO, |
269 | "Thread %X cannot release Mutex [%4.4s] acquired by thread %X", | 269 | "Thread %X cannot release Mutex [%4.4s] acquired by thread %X", |
270 | walk_state->thread->thread_id, | 270 | (u32) walk_state->thread->thread_id, |
271 | acpi_ut_get_node_name(obj_desc->mutex.node), | 271 | acpi_ut_get_node_name(obj_desc->mutex.node), |
272 | obj_desc->mutex.owner_thread->thread_id)); | 272 | (u32) obj_desc->mutex.owner_thread->thread_id)); |
273 | return_ACPI_STATUS(AE_AML_NOT_OWNER); | 273 | return_ACPI_STATUS(AE_AML_NOT_OWNER); |
274 | } | 274 | } |
275 | 275 | ||
diff --git a/drivers/acpi/executer/exsystem.c b/drivers/acpi/executer/exsystem.c index 6b5d1e6ce94b..28aef3e69ecc 100644 --- a/drivers/acpi/executer/exsystem.c +++ b/drivers/acpi/executer/exsystem.c | |||
@@ -60,7 +60,7 @@ ACPI_MODULE_NAME("exsystem") | |||
60 | * | 60 | * |
61 | * DESCRIPTION: Implements a semaphore wait with a check to see if the | 61 | * DESCRIPTION: Implements a semaphore wait with a check to see if the |
62 | * semaphore is available immediately. If it is not, the | 62 | * semaphore is available immediately. If it is not, the |
63 | * interpreter is released. | 63 | * interpreter is released before waiting. |
64 | * | 64 | * |
65 | ******************************************************************************/ | 65 | ******************************************************************************/ |
66 | acpi_status acpi_ex_system_wait_semaphore(acpi_semaphore semaphore, u16 timeout) | 66 | acpi_status acpi_ex_system_wait_semaphore(acpi_semaphore semaphore, u16 timeout) |
@@ -110,9 +110,9 @@ acpi_status acpi_ex_system_wait_semaphore(acpi_semaphore semaphore, u16 timeout) | |||
110 | * | 110 | * |
111 | * RETURN: Status | 111 | * RETURN: Status |
112 | * | 112 | * |
113 | * DESCRIPTION: Implements a semaphore wait with a check to see if the | 113 | * DESCRIPTION: Implements a mutex wait with a check to see if the |
114 | * semaphore is available immediately. If it is not, the | 114 | * mutex is available immediately. If it is not, the |
115 | * interpreter is released. | 115 | * interpreter is released before waiting. |
116 | * | 116 | * |
117 | ******************************************************************************/ | 117 | ******************************************************************************/ |
118 | 118 | ||
diff --git a/drivers/acpi/fan.c b/drivers/acpi/fan.c index daed2460924d..045c89477e59 100644 --- a/drivers/acpi/fan.c +++ b/drivers/acpi/fan.c | |||
@@ -120,7 +120,7 @@ acpi_fan_write_state(struct file *file, const char __user * buffer, | |||
120 | return count; | 120 | return count; |
121 | } | 121 | } |
122 | 122 | ||
123 | static struct file_operations acpi_fan_state_ops = { | 123 | static const struct file_operations acpi_fan_state_ops = { |
124 | .open = acpi_fan_state_open_fs, | 124 | .open = acpi_fan_state_open_fs, |
125 | .read = seq_read, | 125 | .read = seq_read, |
126 | .write = acpi_fan_write_state, | 126 | .write = acpi_fan_write_state, |
diff --git a/drivers/acpi/hotkey.c b/drivers/acpi/hotkey.c index fd81a0f5222f..32c9d88fd196 100644 --- a/drivers/acpi/hotkey.c +++ b/drivers/acpi/hotkey.c | |||
@@ -184,7 +184,7 @@ static union acpi_hotkey *get_hotkey_by_event(struct | |||
184 | *hotkey_list, int event); | 184 | *hotkey_list, int event); |
185 | 185 | ||
186 | /* event based config */ | 186 | /* event based config */ |
187 | static struct file_operations hotkey_config_fops = { | 187 | static const struct file_operations hotkey_config_fops = { |
188 | .open = hotkey_open_config, | 188 | .open = hotkey_open_config, |
189 | .read = seq_read, | 189 | .read = seq_read, |
190 | .write = hotkey_write_config, | 190 | .write = hotkey_write_config, |
@@ -193,7 +193,7 @@ static struct file_operations hotkey_config_fops = { | |||
193 | }; | 193 | }; |
194 | 194 | ||
195 | /* polling based config */ | 195 | /* polling based config */ |
196 | static struct file_operations hotkey_poll_config_fops = { | 196 | static const struct file_operations hotkey_poll_config_fops = { |
197 | .open = hotkey_poll_open_config, | 197 | .open = hotkey_poll_open_config, |
198 | .read = seq_read, | 198 | .read = seq_read, |
199 | .write = hotkey_write_config, | 199 | .write = hotkey_write_config, |
@@ -202,7 +202,7 @@ static struct file_operations hotkey_poll_config_fops = { | |||
202 | }; | 202 | }; |
203 | 203 | ||
204 | /* hotkey driver info */ | 204 | /* hotkey driver info */ |
205 | static struct file_operations hotkey_info_fops = { | 205 | static const struct file_operations hotkey_info_fops = { |
206 | .open = hotkey_info_open_fs, | 206 | .open = hotkey_info_open_fs, |
207 | .read = seq_read, | 207 | .read = seq_read, |
208 | .llseek = seq_lseek, | 208 | .llseek = seq_lseek, |
@@ -210,7 +210,7 @@ static struct file_operations hotkey_info_fops = { | |||
210 | }; | 210 | }; |
211 | 211 | ||
212 | /* action */ | 212 | /* action */ |
213 | static struct file_operations hotkey_action_fops = { | 213 | static const struct file_operations hotkey_action_fops = { |
214 | .open = hotkey_action_open_fs, | 214 | .open = hotkey_action_open_fs, |
215 | .read = seq_read, | 215 | .read = seq_read, |
216 | .write = hotkey_execute_aml_method, | 216 | .write = hotkey_execute_aml_method, |
@@ -219,7 +219,7 @@ static struct file_operations hotkey_action_fops = { | |||
219 | }; | 219 | }; |
220 | 220 | ||
221 | /* polling results */ | 221 | /* polling results */ |
222 | static struct file_operations hotkey_polling_fops = { | 222 | static const struct file_operations hotkey_polling_fops = { |
223 | .open = hotkey_polling_open_fs, | 223 | .open = hotkey_polling_open_fs, |
224 | .read = seq_read, | 224 | .read = seq_read, |
225 | .llseek = seq_lseek, | 225 | .llseek = seq_lseek, |
diff --git a/drivers/acpi/namespace/nsalloc.c b/drivers/acpi/namespace/nsalloc.c index dc3f0739a46b..55b407aae266 100644 --- a/drivers/acpi/namespace/nsalloc.c +++ b/drivers/acpi/namespace/nsalloc.c | |||
@@ -386,14 +386,17 @@ void acpi_ns_delete_namespace_subtree(struct acpi_namespace_node *parent_node) | |||
386 | * specific ID. Used to delete entire ACPI tables. All | 386 | * specific ID. Used to delete entire ACPI tables. All |
387 | * reference counts are updated. | 387 | * reference counts are updated. |
388 | * | 388 | * |
389 | * MUTEX: Locks namespace during deletion walk. | ||
390 | * | ||
389 | ******************************************************************************/ | 391 | ******************************************************************************/ |
390 | 392 | ||
391 | void acpi_ns_delete_namespace_by_owner(acpi_owner_id owner_id) | 393 | void acpi_ns_delete_namespace_by_owner(acpi_owner_id owner_id) |
392 | { | 394 | { |
393 | struct acpi_namespace_node *child_node; | 395 | struct acpi_namespace_node *child_node; |
394 | struct acpi_namespace_node *deletion_node; | 396 | struct acpi_namespace_node *deletion_node; |
395 | u32 level; | ||
396 | struct acpi_namespace_node *parent_node; | 397 | struct acpi_namespace_node *parent_node; |
398 | u32 level; | ||
399 | acpi_status status; | ||
397 | 400 | ||
398 | ACPI_FUNCTION_TRACE_U32(ns_delete_namespace_by_owner, owner_id); | 401 | ACPI_FUNCTION_TRACE_U32(ns_delete_namespace_by_owner, owner_id); |
399 | 402 | ||
@@ -401,6 +404,13 @@ void acpi_ns_delete_namespace_by_owner(acpi_owner_id owner_id) | |||
401 | return_VOID; | 404 | return_VOID; |
402 | } | 405 | } |
403 | 406 | ||
407 | /* Lock namespace for possible update */ | ||
408 | |||
409 | status = acpi_ut_acquire_mutex(ACPI_MTX_NAMESPACE); | ||
410 | if (ACPI_FAILURE(status)) { | ||
411 | return_VOID; | ||
412 | } | ||
413 | |||
404 | deletion_node = NULL; | 414 | deletion_node = NULL; |
405 | parent_node = acpi_gbl_root_node; | 415 | parent_node = acpi_gbl_root_node; |
406 | child_node = NULL; | 416 | child_node = NULL; |
@@ -469,5 +479,6 @@ void acpi_ns_delete_namespace_by_owner(acpi_owner_id owner_id) | |||
469 | } | 479 | } |
470 | } | 480 | } |
471 | 481 | ||
482 | (void)acpi_ut_release_mutex(ACPI_MTX_NAMESPACE); | ||
472 | return_VOID; | 483 | return_VOID; |
473 | } | 484 | } |
diff --git a/drivers/acpi/osl.c b/drivers/acpi/osl.c index eedb05c6dc7b..b7d1514cd199 100644 --- a/drivers/acpi/osl.c +++ b/drivers/acpi/osl.c | |||
@@ -36,7 +36,6 @@ | |||
36 | #include <linux/delay.h> | 36 | #include <linux/delay.h> |
37 | #include <linux/workqueue.h> | 37 | #include <linux/workqueue.h> |
38 | #include <linux/nmi.h> | 38 | #include <linux/nmi.h> |
39 | #include <linux/kthread.h> | ||
40 | #include <acpi/acpi.h> | 39 | #include <acpi/acpi.h> |
41 | #include <asm/io.h> | 40 | #include <asm/io.h> |
42 | #include <acpi/acpi_bus.h> | 41 | #include <acpi/acpi_bus.h> |
@@ -136,16 +135,6 @@ void acpi_os_vprintf(const char *fmt, va_list args) | |||
136 | #endif | 135 | #endif |
137 | } | 136 | } |
138 | 137 | ||
139 | |||
140 | extern int acpi_in_resume; | ||
141 | void *acpi_os_allocate(acpi_size size) | ||
142 | { | ||
143 | if (acpi_in_resume) | ||
144 | return kmalloc(size, GFP_ATOMIC); | ||
145 | else | ||
146 | return kmalloc(size, GFP_KERNEL); | ||
147 | } | ||
148 | |||
149 | acpi_status acpi_os_get_root_pointer(u32 flags, struct acpi_pointer *addr) | 138 | acpi_status acpi_os_get_root_pointer(u32 flags, struct acpi_pointer *addr) |
150 | { | 139 | { |
151 | if (efi_enabled) { | 140 | if (efi_enabled) { |
@@ -593,16 +582,6 @@ static void acpi_os_execute_deferred(void *context) | |||
593 | return; | 582 | return; |
594 | } | 583 | } |
595 | 584 | ||
596 | static int acpi_os_execute_thread(void *context) | ||
597 | { | ||
598 | struct acpi_os_dpc *dpc = (struct acpi_os_dpc *)context; | ||
599 | if (dpc) { | ||
600 | dpc->function(dpc->context); | ||
601 | kfree(dpc); | ||
602 | } | ||
603 | do_exit(0); | ||
604 | } | ||
605 | |||
606 | /******************************************************************************* | 585 | /******************************************************************************* |
607 | * | 586 | * |
608 | * FUNCTION: acpi_os_execute | 587 | * FUNCTION: acpi_os_execute |
@@ -624,10 +603,16 @@ acpi_status acpi_os_execute(acpi_execute_type type, | |||
624 | acpi_status status = AE_OK; | 603 | acpi_status status = AE_OK; |
625 | struct acpi_os_dpc *dpc; | 604 | struct acpi_os_dpc *dpc; |
626 | struct work_struct *task; | 605 | struct work_struct *task; |
627 | struct task_struct *p; | 606 | |
607 | ACPI_FUNCTION_TRACE("os_queue_for_execution"); | ||
608 | |||
609 | ACPI_DEBUG_PRINT((ACPI_DB_EXEC, | ||
610 | "Scheduling function [%p(%p)] for deferred execution.\n", | ||
611 | function, context)); | ||
628 | 612 | ||
629 | if (!function) | 613 | if (!function) |
630 | return AE_BAD_PARAMETER; | 614 | return_ACPI_STATUS(AE_BAD_PARAMETER); |
615 | |||
631 | /* | 616 | /* |
632 | * Allocate/initialize DPC structure. Note that this memory will be | 617 | * Allocate/initialize DPC structure. Note that this memory will be |
633 | * freed by the callee. The kernel handles the tq_struct list in a | 618 | * freed by the callee. The kernel handles the tq_struct list in a |
@@ -638,34 +623,27 @@ acpi_status acpi_os_execute(acpi_execute_type type, | |||
638 | * We can save time and code by allocating the DPC and tq_structs | 623 | * We can save time and code by allocating the DPC and tq_structs |
639 | * from the same memory. | 624 | * from the same memory. |
640 | */ | 625 | */ |
641 | if (type == OSL_NOTIFY_HANDLER) { | 626 | |
642 | dpc = kmalloc(sizeof(struct acpi_os_dpc), GFP_KERNEL); | 627 | dpc = |
643 | } else { | 628 | kmalloc(sizeof(struct acpi_os_dpc) + sizeof(struct work_struct), |
644 | dpc = kmalloc(sizeof(struct acpi_os_dpc) + | 629 | GFP_ATOMIC); |
645 | sizeof(struct work_struct), GFP_ATOMIC); | ||
646 | } | ||
647 | if (!dpc) | 630 | if (!dpc) |
648 | return AE_NO_MEMORY; | 631 | return_ACPI_STATUS(AE_NO_MEMORY); |
632 | |||
649 | dpc->function = function; | 633 | dpc->function = function; |
650 | dpc->context = context; | 634 | dpc->context = context; |
651 | 635 | ||
652 | if (type == OSL_NOTIFY_HANDLER) { | 636 | task = (void *)(dpc + 1); |
653 | p = kthread_create(acpi_os_execute_thread, dpc, "kacpid_notify"); | 637 | INIT_WORK(task, acpi_os_execute_deferred, (void *)dpc); |
654 | if (!IS_ERR(p)) { | 638 | |
655 | wake_up_process(p); | 639 | if (!queue_work(kacpid_wq, task)) { |
656 | } else { | 640 | ACPI_DEBUG_PRINT((ACPI_DB_ERROR, |
657 | status = AE_NO_MEMORY; | 641 | "Call to queue_work() failed.\n")); |
658 | kfree(dpc); | 642 | kfree(dpc); |
659 | } | 643 | status = AE_ERROR; |
660 | } else { | ||
661 | task = (void *)(dpc + 1); | ||
662 | INIT_WORK(task, acpi_os_execute_deferred, (void *)dpc); | ||
663 | if (!queue_work(kacpid_wq, task)) { | ||
664 | status = AE_ERROR; | ||
665 | kfree(dpc); | ||
666 | } | ||
667 | } | 644 | } |
668 | return status; | 645 | |
646 | return_ACPI_STATUS(status); | ||
669 | } | 647 | } |
670 | 648 | ||
671 | EXPORT_SYMBOL(acpi_os_execute); | 649 | EXPORT_SYMBOL(acpi_os_execute); |
@@ -1115,26 +1093,6 @@ acpi_status acpi_os_release_object(acpi_cache_t * cache, void *object) | |||
1115 | return (AE_OK); | 1093 | return (AE_OK); |
1116 | } | 1094 | } |
1117 | 1095 | ||
1118 | /******************************************************************************* | ||
1119 | * | ||
1120 | * FUNCTION: acpi_os_acquire_object | ||
1121 | * | ||
1122 | * PARAMETERS: Cache - Handle to cache object | ||
1123 | * ReturnObject - Where the object is returned | ||
1124 | * | ||
1125 | * RETURN: Status | ||
1126 | * | ||
1127 | * DESCRIPTION: Return a zero-filled object. | ||
1128 | * | ||
1129 | ******************************************************************************/ | ||
1130 | |||
1131 | void *acpi_os_acquire_object(acpi_cache_t * cache) | ||
1132 | { | ||
1133 | void *object = kmem_cache_zalloc(cache, GFP_KERNEL); | ||
1134 | WARN_ON(!object); | ||
1135 | return object; | ||
1136 | } | ||
1137 | |||
1138 | /****************************************************************************** | 1096 | /****************************************************************************** |
1139 | * | 1097 | * |
1140 | * FUNCTION: acpi_os_validate_interface | 1098 | * FUNCTION: acpi_os_validate_interface |
diff --git a/drivers/acpi/parser/psutils.c b/drivers/acpi/parser/psutils.c index 182474ae8ce9..d405387b7414 100644 --- a/drivers/acpi/parser/psutils.c +++ b/drivers/acpi/parser/psutils.c | |||
@@ -139,12 +139,10 @@ union acpi_parse_object *acpi_ps_alloc_op(u16 opcode) | |||
139 | /* The generic op (default) is by far the most common (16 to 1) */ | 139 | /* The generic op (default) is by far the most common (16 to 1) */ |
140 | 140 | ||
141 | op = acpi_os_acquire_object(acpi_gbl_ps_node_cache); | 141 | op = acpi_os_acquire_object(acpi_gbl_ps_node_cache); |
142 | memset(op, 0, sizeof(struct acpi_parse_obj_common)); | ||
143 | } else { | 142 | } else { |
144 | /* Extended parseop */ | 143 | /* Extended parseop */ |
145 | 144 | ||
146 | op = acpi_os_acquire_object(acpi_gbl_ps_node_ext_cache); | 145 | op = acpi_os_acquire_object(acpi_gbl_ps_node_ext_cache); |
147 | memset(op, 0, sizeof(struct acpi_parse_obj_named)); | ||
148 | } | 146 | } |
149 | 147 | ||
150 | /* Initialize the Op */ | 148 | /* Initialize the Op */ |
diff --git a/drivers/acpi/pci_link.c b/drivers/acpi/pci_link.c index 8197c0e40769..7f3e7e77e794 100644 --- a/drivers/acpi/pci_link.c +++ b/drivers/acpi/pci_link.c | |||
@@ -780,11 +780,6 @@ static int acpi_pci_link_resume(struct acpi_pci_link *link) | |||
780 | return 0; | 780 | return 0; |
781 | } | 781 | } |
782 | 782 | ||
783 | /* | ||
784 | * FIXME: this is a workaround to avoid nasty warning. It will be removed | ||
785 | * after every device calls pci_disable_device in .resume. | ||
786 | */ | ||
787 | int acpi_in_resume; | ||
788 | static int irqrouter_resume(struct sys_device *dev) | 783 | static int irqrouter_resume(struct sys_device *dev) |
789 | { | 784 | { |
790 | struct list_head *node = NULL; | 785 | struct list_head *node = NULL; |
@@ -794,7 +789,6 @@ static int irqrouter_resume(struct sys_device *dev) | |||
794 | /* Make sure SCI is enabled again (Apple firmware bug?) */ | 789 | /* Make sure SCI is enabled again (Apple firmware bug?) */ |
795 | acpi_set_register(ACPI_BITREG_SCI_ENABLE, 1, ACPI_MTX_DO_NOT_LOCK); | 790 | acpi_set_register(ACPI_BITREG_SCI_ENABLE, 1, ACPI_MTX_DO_NOT_LOCK); |
796 | 791 | ||
797 | acpi_in_resume = 1; | ||
798 | list_for_each(node, &acpi_link.entries) { | 792 | list_for_each(node, &acpi_link.entries) { |
799 | link = list_entry(node, struct acpi_pci_link, node); | 793 | link = list_entry(node, struct acpi_pci_link, node); |
800 | if (!link) { | 794 | if (!link) { |
@@ -803,7 +797,6 @@ static int irqrouter_resume(struct sys_device *dev) | |||
803 | } | 797 | } |
804 | acpi_pci_link_resume(link); | 798 | acpi_pci_link_resume(link); |
805 | } | 799 | } |
806 | acpi_in_resume = 0; | ||
807 | return 0; | 800 | return 0; |
808 | } | 801 | } |
809 | 802 | ||
diff --git a/drivers/acpi/power.c b/drivers/acpi/power.c index 5d3447f4582c..fec225d1b6b7 100644 --- a/drivers/acpi/power.c +++ b/drivers/acpi/power.c | |||
@@ -80,7 +80,7 @@ struct acpi_power_resource { | |||
80 | 80 | ||
81 | static struct list_head acpi_power_resource_list; | 81 | static struct list_head acpi_power_resource_list; |
82 | 82 | ||
83 | static struct file_operations acpi_power_fops = { | 83 | static const struct file_operations acpi_power_fops = { |
84 | .open = acpi_power_open_fs, | 84 | .open = acpi_power_open_fs, |
85 | .read = seq_read, | 85 | .read = seq_read, |
86 | .llseek = seq_lseek, | 86 | .llseek = seq_lseek, |
diff --git a/drivers/acpi/processor_core.c b/drivers/acpi/processor_core.c index 52674323b14d..b13d64415b7a 100644 --- a/drivers/acpi/processor_core.c +++ b/drivers/acpi/processor_core.c | |||
@@ -102,7 +102,7 @@ static struct acpi_driver acpi_processor_driver = { | |||
102 | #define INSTALL_NOTIFY_HANDLER 1 | 102 | #define INSTALL_NOTIFY_HANDLER 1 |
103 | #define UNINSTALL_NOTIFY_HANDLER 2 | 103 | #define UNINSTALL_NOTIFY_HANDLER 2 |
104 | 104 | ||
105 | static struct file_operations acpi_processor_info_fops = { | 105 | static const struct file_operations acpi_processor_info_fops = { |
106 | .open = acpi_processor_info_open_fs, | 106 | .open = acpi_processor_info_open_fs, |
107 | .read = seq_read, | 107 | .read = seq_read, |
108 | .llseek = seq_lseek, | 108 | .llseek = seq_lseek, |
diff --git a/drivers/acpi/processor_idle.c b/drivers/acpi/processor_idle.c index 8e9c26aae8fe..71066066d626 100644 --- a/drivers/acpi/processor_idle.c +++ b/drivers/acpi/processor_idle.c | |||
@@ -1070,7 +1070,7 @@ static int acpi_processor_power_open_fs(struct inode *inode, struct file *file) | |||
1070 | PDE(inode)->data); | 1070 | PDE(inode)->data); |
1071 | } | 1071 | } |
1072 | 1072 | ||
1073 | static struct file_operations acpi_processor_power_fops = { | 1073 | static const struct file_operations acpi_processor_power_fops = { |
1074 | .open = acpi_processor_power_open_fs, | 1074 | .open = acpi_processor_power_open_fs, |
1075 | .read = seq_read, | 1075 | .read = seq_read, |
1076 | .llseek = seq_lseek, | 1076 | .llseek = seq_lseek, |
diff --git a/drivers/acpi/sleep/proc.c b/drivers/acpi/sleep/proc.c index 4696a85a98b9..34962578039d 100644 --- a/drivers/acpi/sleep/proc.c +++ b/drivers/acpi/sleep/proc.c | |||
@@ -434,7 +434,7 @@ acpi_system_wakeup_device_open_fs(struct inode *inode, struct file *file) | |||
434 | PDE(inode)->data); | 434 | PDE(inode)->data); |
435 | } | 435 | } |
436 | 436 | ||
437 | static struct file_operations acpi_system_wakeup_device_fops = { | 437 | static const struct file_operations acpi_system_wakeup_device_fops = { |
438 | .open = acpi_system_wakeup_device_open_fs, | 438 | .open = acpi_system_wakeup_device_open_fs, |
439 | .read = seq_read, | 439 | .read = seq_read, |
440 | .write = acpi_system_write_wakeup_device, | 440 | .write = acpi_system_write_wakeup_device, |
@@ -443,7 +443,7 @@ static struct file_operations acpi_system_wakeup_device_fops = { | |||
443 | }; | 443 | }; |
444 | 444 | ||
445 | #ifdef CONFIG_ACPI_SLEEP_PROC_SLEEP | 445 | #ifdef CONFIG_ACPI_SLEEP_PROC_SLEEP |
446 | static struct file_operations acpi_system_sleep_fops = { | 446 | static const struct file_operations acpi_system_sleep_fops = { |
447 | .open = acpi_system_sleep_open_fs, | 447 | .open = acpi_system_sleep_open_fs, |
448 | .read = seq_read, | 448 | .read = seq_read, |
449 | .write = acpi_system_write_sleep, | 449 | .write = acpi_system_write_sleep, |
@@ -452,7 +452,7 @@ static struct file_operations acpi_system_sleep_fops = { | |||
452 | }; | 452 | }; |
453 | #endif /* CONFIG_ACPI_SLEEP_PROC_SLEEP */ | 453 | #endif /* CONFIG_ACPI_SLEEP_PROC_SLEEP */ |
454 | 454 | ||
455 | static struct file_operations acpi_system_alarm_fops = { | 455 | static const struct file_operations acpi_system_alarm_fops = { |
456 | .open = acpi_system_alarm_open_fs, | 456 | .open = acpi_system_alarm_open_fs, |
457 | .read = seq_read, | 457 | .read = seq_read, |
458 | .write = acpi_system_write_alarm, | 458 | .write = acpi_system_write_alarm, |
diff --git a/drivers/acpi/system.c b/drivers/acpi/system.c index c3bb7faad75e..d86dcb3c2366 100644 --- a/drivers/acpi/system.c +++ b/drivers/acpi/system.c | |||
@@ -57,7 +57,7 @@ static int acpi_system_info_open_fs(struct inode *inode, struct file *file) | |||
57 | return single_open(file, acpi_system_read_info, PDE(inode)->data); | 57 | return single_open(file, acpi_system_read_info, PDE(inode)->data); |
58 | } | 58 | } |
59 | 59 | ||
60 | static struct file_operations acpi_system_info_ops = { | 60 | static const struct file_operations acpi_system_info_ops = { |
61 | .open = acpi_system_info_open_fs, | 61 | .open = acpi_system_info_open_fs, |
62 | .read = seq_read, | 62 | .read = seq_read, |
63 | .llseek = seq_lseek, | 63 | .llseek = seq_lseek, |
@@ -67,7 +67,7 @@ static struct file_operations acpi_system_info_ops = { | |||
67 | static ssize_t acpi_system_read_dsdt(struct file *, char __user *, size_t, | 67 | static ssize_t acpi_system_read_dsdt(struct file *, char __user *, size_t, |
68 | loff_t *); | 68 | loff_t *); |
69 | 69 | ||
70 | static struct file_operations acpi_system_dsdt_ops = { | 70 | static const struct file_operations acpi_system_dsdt_ops = { |
71 | .read = acpi_system_read_dsdt, | 71 | .read = acpi_system_read_dsdt, |
72 | }; | 72 | }; |
73 | 73 | ||
@@ -94,7 +94,7 @@ acpi_system_read_dsdt(struct file *file, | |||
94 | static ssize_t acpi_system_read_fadt(struct file *, char __user *, size_t, | 94 | static ssize_t acpi_system_read_fadt(struct file *, char __user *, size_t, |
95 | loff_t *); | 95 | loff_t *); |
96 | 96 | ||
97 | static struct file_operations acpi_system_fadt_ops = { | 97 | static const struct file_operations acpi_system_fadt_ops = { |
98 | .read = acpi_system_read_fadt, | 98 | .read = acpi_system_read_fadt, |
99 | }; | 99 | }; |
100 | 100 | ||
diff --git a/drivers/acpi/tables/tbget.c b/drivers/acpi/tables/tbget.c index 99eacceff563..7856db759af0 100644 --- a/drivers/acpi/tables/tbget.c +++ b/drivers/acpi/tables/tbget.c | |||
@@ -320,6 +320,16 @@ acpi_tb_get_this_table(struct acpi_pointer *address, | |||
320 | 320 | ||
321 | ACPI_FUNCTION_TRACE(tb_get_this_table); | 321 | ACPI_FUNCTION_TRACE(tb_get_this_table); |
322 | 322 | ||
323 | /* Validate minimum length */ | ||
324 | |||
325 | if (header->length < sizeof(struct acpi_table_header)) { | ||
326 | ACPI_ERROR((AE_INFO, | ||
327 | "Table length (%X) is smaller than minimum (%X)", | ||
328 | header->length, sizeof(struct acpi_table_header))); | ||
329 | |||
330 | return_ACPI_STATUS(AE_INVALID_TABLE_LENGTH); | ||
331 | } | ||
332 | |||
323 | /* | 333 | /* |
324 | * Flags contains the current processor mode (Virtual or Physical | 334 | * Flags contains the current processor mode (Virtual or Physical |
325 | * addressing) The pointer_type is either Logical or Physical | 335 | * addressing) The pointer_type is either Logical or Physical |
@@ -356,7 +366,7 @@ acpi_tb_get_this_table(struct acpi_pointer *address, | |||
356 | */ | 366 | */ |
357 | status = acpi_os_map_memory(address->pointer.physical, | 367 | status = acpi_os_map_memory(address->pointer.physical, |
358 | (acpi_size) header->length, | 368 | (acpi_size) header->length, |
359 | (void *)&full_table); | 369 | ACPI_CAST_PTR(void, &full_table)); |
360 | if (ACPI_FAILURE(status)) { | 370 | if (ACPI_FAILURE(status)) { |
361 | ACPI_ERROR((AE_INFO, | 371 | ACPI_ERROR((AE_INFO, |
362 | "Could not map memory for table [%4.4s] at %8.8X%8.8X for length %X", | 372 | "Could not map memory for table [%4.4s] at %8.8X%8.8X for length %X", |
diff --git a/drivers/acpi/tables/tbinstal.c b/drivers/acpi/tables/tbinstal.c index 7ca2df75bb11..1668a232fb67 100644 --- a/drivers/acpi/tables/tbinstal.c +++ b/drivers/acpi/tables/tbinstal.c | |||
@@ -256,7 +256,7 @@ acpi_tb_init_table_descriptor(acpi_table_type table_type, | |||
256 | 256 | ||
257 | status = acpi_ut_allocate_owner_id(&table_desc->owner_id); | 257 | status = acpi_ut_allocate_owner_id(&table_desc->owner_id); |
258 | if (ACPI_FAILURE(status)) { | 258 | if (ACPI_FAILURE(status)) { |
259 | return_ACPI_STATUS(status); | 259 | goto error_exit1; |
260 | } | 260 | } |
261 | 261 | ||
262 | /* Install the table into the global data structure */ | 262 | /* Install the table into the global data structure */ |
@@ -274,8 +274,8 @@ acpi_tb_init_table_descriptor(acpi_table_type table_type, | |||
274 | * at this location, so return an error. | 274 | * at this location, so return an error. |
275 | */ | 275 | */ |
276 | if (list_head->next) { | 276 | if (list_head->next) { |
277 | ACPI_FREE(table_desc); | 277 | status = AE_ALREADY_EXISTS; |
278 | return_ACPI_STATUS(AE_ALREADY_EXISTS); | 278 | goto error_exit2; |
279 | } | 279 | } |
280 | 280 | ||
281 | table_desc->next = list_head->next; | 281 | table_desc->next = list_head->next; |
@@ -335,6 +335,17 @@ acpi_tb_init_table_descriptor(acpi_table_type table_type, | |||
335 | table_info->owner_id = table_desc->owner_id; | 335 | table_info->owner_id = table_desc->owner_id; |
336 | table_info->installed_desc = table_desc; | 336 | table_info->installed_desc = table_desc; |
337 | return_ACPI_STATUS(AE_OK); | 337 | return_ACPI_STATUS(AE_OK); |
338 | |||
339 | /* Error exit with cleanup */ | ||
340 | |||
341 | error_exit2: | ||
342 | |||
343 | acpi_ut_release_owner_id(&table_desc->owner_id); | ||
344 | |||
345 | error_exit1: | ||
346 | |||
347 | ACPI_FREE(table_desc); | ||
348 | return_ACPI_STATUS(status); | ||
338 | } | 349 | } |
339 | 350 | ||
340 | /******************************************************************************* | 351 | /******************************************************************************* |
@@ -525,6 +536,10 @@ struct acpi_table_desc *acpi_tb_uninstall_table(struct acpi_table_desc | |||
525 | 536 | ||
526 | acpi_tb_delete_single_table(table_desc); | 537 | acpi_tb_delete_single_table(table_desc); |
527 | 538 | ||
539 | /* Free the owner ID associated with this table */ | ||
540 | |||
541 | acpi_ut_release_owner_id(&table_desc->owner_id); | ||
542 | |||
528 | /* Free the table descriptor */ | 543 | /* Free the table descriptor */ |
529 | 544 | ||
530 | next_desc = table_desc->next; | 545 | next_desc = table_desc->next; |
diff --git a/drivers/acpi/tables/tbrsdt.c b/drivers/acpi/tables/tbrsdt.c index abcb08c2592a..0ad3dbb9ebca 100644 --- a/drivers/acpi/tables/tbrsdt.c +++ b/drivers/acpi/tables/tbrsdt.c | |||
@@ -183,6 +183,17 @@ acpi_status acpi_tb_validate_rsdt(struct acpi_table_header *table_ptr) | |||
183 | 183 | ||
184 | ACPI_FUNCTION_ENTRY(); | 184 | ACPI_FUNCTION_ENTRY(); |
185 | 185 | ||
186 | /* Validate minimum length */ | ||
187 | |||
188 | if (table_ptr->length < sizeof(struct acpi_table_header)) { | ||
189 | ACPI_ERROR((AE_INFO, | ||
190 | "RSDT/XSDT length (%X) is smaller than minimum (%X)", | ||
191 | table_ptr->length, | ||
192 | sizeof(struct acpi_table_header))); | ||
193 | |||
194 | return (AE_INVALID_TABLE_LENGTH); | ||
195 | } | ||
196 | |||
186 | /* Search for appropriate signature, RSDT or XSDT */ | 197 | /* Search for appropriate signature, RSDT or XSDT */ |
187 | 198 | ||
188 | if (acpi_gbl_root_table_type == ACPI_TABLE_TYPE_RSDT) { | 199 | if (acpi_gbl_root_table_type == ACPI_TABLE_TYPE_RSDT) { |
@@ -210,7 +221,7 @@ acpi_status acpi_tb_validate_rsdt(struct acpi_table_header *table_ptr) | |||
210 | ACPI_ERROR((AE_INFO, "Looking for XSDT")); | 221 | ACPI_ERROR((AE_INFO, "Looking for XSDT")); |
211 | } | 222 | } |
212 | 223 | ||
213 | ACPI_DUMP_BUFFER((char *)table_ptr, 48); | 224 | ACPI_DUMP_BUFFER(ACPI_CAST_PTR(char, table_ptr), 48); |
214 | return (AE_BAD_SIGNATURE); | 225 | return (AE_BAD_SIGNATURE); |
215 | } | 226 | } |
216 | 227 | ||
@@ -258,7 +269,7 @@ acpi_status acpi_tb_get_table_rsdt(void) | |||
258 | 269 | ||
259 | status = acpi_tb_validate_rsdt(table_info.pointer); | 270 | status = acpi_tb_validate_rsdt(table_info.pointer); |
260 | if (ACPI_FAILURE(status)) { | 271 | if (ACPI_FAILURE(status)) { |
261 | return_ACPI_STATUS(status); | 272 | goto error_cleanup; |
262 | } | 273 | } |
263 | 274 | ||
264 | /* Get the number of tables defined in the RSDT or XSDT */ | 275 | /* Get the number of tables defined in the RSDT or XSDT */ |
@@ -270,14 +281,14 @@ acpi_status acpi_tb_get_table_rsdt(void) | |||
270 | 281 | ||
271 | status = acpi_tb_convert_to_xsdt(&table_info); | 282 | status = acpi_tb_convert_to_xsdt(&table_info); |
272 | if (ACPI_FAILURE(status)) { | 283 | if (ACPI_FAILURE(status)) { |
273 | return_ACPI_STATUS(status); | 284 | goto error_cleanup; |
274 | } | 285 | } |
275 | 286 | ||
276 | /* Save the table pointers and allocation info */ | 287 | /* Save the table pointers and allocation info */ |
277 | 288 | ||
278 | status = acpi_tb_init_table_descriptor(ACPI_TABLE_ID_XSDT, &table_info); | 289 | status = acpi_tb_init_table_descriptor(ACPI_TABLE_ID_XSDT, &table_info); |
279 | if (ACPI_FAILURE(status)) { | 290 | if (ACPI_FAILURE(status)) { |
280 | return_ACPI_STATUS(status); | 291 | goto error_cleanup; |
281 | } | 292 | } |
282 | 293 | ||
283 | acpi_gbl_XSDT = | 294 | acpi_gbl_XSDT = |
@@ -285,4 +296,12 @@ acpi_status acpi_tb_get_table_rsdt(void) | |||
285 | 296 | ||
286 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, "XSDT located at %p\n", acpi_gbl_XSDT)); | 297 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, "XSDT located at %p\n", acpi_gbl_XSDT)); |
287 | return_ACPI_STATUS(status); | 298 | return_ACPI_STATUS(status); |
299 | |||
300 | error_cleanup: | ||
301 | |||
302 | /* Free table allocated by acpi_tb_get_table */ | ||
303 | |||
304 | acpi_tb_delete_single_table(&table_info); | ||
305 | |||
306 | return_ACPI_STATUS(status); | ||
288 | } | 307 | } |
diff --git a/drivers/acpi/tables/tbxface.c b/drivers/acpi/tables/tbxface.c index 4e91f2984815..7767987be15a 100644 --- a/drivers/acpi/tables/tbxface.c +++ b/drivers/acpi/tables/tbxface.c | |||
@@ -134,8 +134,8 @@ ACPI_EXPORT_SYMBOL(acpi_load_tables) | |||
134 | * RETURN: Status | 134 | * RETURN: Status |
135 | * | 135 | * |
136 | * DESCRIPTION: This function is called to load a table from the caller's | 136 | * DESCRIPTION: This function is called to load a table from the caller's |
137 | * buffer. The buffer must contain an entire ACPI Table including | 137 | * buffer. The buffer must contain an entire ACPI Table including |
138 | * a valid header. The header fields will be verified, and if it | 138 | * a valid header. The header fields will be verified, and if it |
139 | * is determined that the table is invalid, the call will fail. | 139 | * is determined that the table is invalid, the call will fail. |
140 | * | 140 | * |
141 | ******************************************************************************/ | 141 | ******************************************************************************/ |
@@ -245,15 +245,18 @@ acpi_status acpi_unload_table(acpi_table_type table_type) | |||
245 | /* Find all tables of the requested type */ | 245 | /* Find all tables of the requested type */ |
246 | 246 | ||
247 | table_desc = acpi_gbl_table_lists[table_type].next; | 247 | table_desc = acpi_gbl_table_lists[table_type].next; |
248 | if (!table_desc) { | ||
249 | return_ACPI_STATUS(AE_NOT_EXIST); | ||
250 | } | ||
251 | |||
248 | while (table_desc) { | 252 | while (table_desc) { |
249 | /* | 253 | /* |
250 | * Delete all namespace entries owned by this table. Note that these | 254 | * Delete all namespace objects owned by this table. Note that these |
251 | * entries can appear anywhere in the namespace by virtue of the AML | 255 | * objects can appear anywhere in the namespace by virtue of the AML |
252 | * "Scope" operator. Thus, we need to track ownership by an ID, not | 256 | * "Scope" operator. Thus, we need to track ownership by an ID, not |
253 | * simply a position within the hierarchy | 257 | * simply a position within the hierarchy |
254 | */ | 258 | */ |
255 | acpi_ns_delete_namespace_by_owner(table_desc->owner_id); | 259 | acpi_ns_delete_namespace_by_owner(table_desc->owner_id); |
256 | acpi_ut_release_owner_id(&table_desc->owner_id); | ||
257 | table_desc = table_desc->next; | 260 | table_desc = table_desc->next; |
258 | } | 261 | } |
259 | 262 | ||
@@ -275,12 +278,12 @@ ACPI_EXPORT_SYMBOL(acpi_unload_table) | |||
275 | * see acpi_gbl_acpi_table_flag | 278 | * see acpi_gbl_acpi_table_flag |
276 | * out_table_header - pointer to the struct acpi_table_header if successful | 279 | * out_table_header - pointer to the struct acpi_table_header if successful |
277 | * | 280 | * |
278 | * DESCRIPTION: This function is called to get an ACPI table header. The caller | 281 | * DESCRIPTION: This function is called to get an ACPI table header. The caller |
279 | * supplies an pointer to a data area sufficient to contain an ACPI | 282 | * supplies an pointer to a data area sufficient to contain an ACPI |
280 | * struct acpi_table_header structure. | 283 | * struct acpi_table_header structure. |
281 | * | 284 | * |
282 | * The header contains a length field that can be used to determine | 285 | * The header contains a length field that can be used to determine |
283 | * the size of the buffer needed to contain the entire table. This | 286 | * the size of the buffer needed to contain the entire table. This |
284 | * function is not valid for the RSD PTR table since it does not | 287 | * function is not valid for the RSD PTR table since it does not |
285 | * have a standard header and is fixed length. | 288 | * have a standard header and is fixed length. |
286 | * | 289 | * |
@@ -322,7 +325,8 @@ acpi_get_table_header(acpi_table_type table_type, | |||
322 | 325 | ||
323 | /* Copy the header to the caller's buffer */ | 326 | /* Copy the header to the caller's buffer */ |
324 | 327 | ||
325 | ACPI_MEMCPY((void *)out_table_header, (void *)tbl_ptr, | 328 | ACPI_MEMCPY(ACPI_CAST_PTR(void, out_table_header), |
329 | ACPI_CAST_PTR(void, tbl_ptr), | ||
326 | sizeof(struct acpi_table_header)); | 330 | sizeof(struct acpi_table_header)); |
327 | 331 | ||
328 | return_ACPI_STATUS(status); | 332 | return_ACPI_STATUS(status); |
@@ -344,10 +348,10 @@ ACPI_EXPORT_SYMBOL(acpi_get_table_header) | |||
344 | * | 348 | * |
345 | * RETURN: Status | 349 | * RETURN: Status |
346 | * | 350 | * |
347 | * DESCRIPTION: This function is called to get an ACPI table. The caller | 351 | * DESCRIPTION: This function is called to get an ACPI table. The caller |
348 | * supplies an out_buffer large enough to contain the entire ACPI | 352 | * supplies an out_buffer large enough to contain the entire ACPI |
349 | * table. The caller should call the acpi_get_table_header function | 353 | * table. The caller should call the acpi_get_table_header function |
350 | * first to determine the buffer size needed. Upon completion | 354 | * first to determine the buffer size needed. Upon completion |
351 | * the out_buffer->Length field will indicate the number of bytes | 355 | * the out_buffer->Length field will indicate the number of bytes |
352 | * copied into the out_buffer->buf_ptr buffer. This table will be | 356 | * copied into the out_buffer->buf_ptr buffer. This table will be |
353 | * a complete table including the header. | 357 | * a complete table including the header. |
@@ -417,7 +421,9 @@ acpi_get_table(acpi_table_type table_type, | |||
417 | 421 | ||
418 | /* Copy the table to the buffer */ | 422 | /* Copy the table to the buffer */ |
419 | 423 | ||
420 | ACPI_MEMCPY((void *)ret_buffer->pointer, (void *)tbl_ptr, table_length); | 424 | ACPI_MEMCPY(ACPI_CAST_PTR(void, ret_buffer->pointer), |
425 | ACPI_CAST_PTR(void, tbl_ptr), table_length); | ||
426 | |||
421 | return_ACPI_STATUS(AE_OK); | 427 | return_ACPI_STATUS(AE_OK); |
422 | } | 428 | } |
423 | 429 | ||
diff --git a/drivers/acpi/thermal.c b/drivers/acpi/thermal.c index 503c0b99db12..5753d06b7860 100644 --- a/drivers/acpi/thermal.c +++ b/drivers/acpi/thermal.c | |||
@@ -176,21 +176,21 @@ struct acpi_thermal { | |||
176 | struct timer_list timer; | 176 | struct timer_list timer; |
177 | }; | 177 | }; |
178 | 178 | ||
179 | static struct file_operations acpi_thermal_state_fops = { | 179 | static const struct file_operations acpi_thermal_state_fops = { |
180 | .open = acpi_thermal_state_open_fs, | 180 | .open = acpi_thermal_state_open_fs, |
181 | .read = seq_read, | 181 | .read = seq_read, |
182 | .llseek = seq_lseek, | 182 | .llseek = seq_lseek, |
183 | .release = single_release, | 183 | .release = single_release, |
184 | }; | 184 | }; |
185 | 185 | ||
186 | static struct file_operations acpi_thermal_temp_fops = { | 186 | static const struct file_operations acpi_thermal_temp_fops = { |
187 | .open = acpi_thermal_temp_open_fs, | 187 | .open = acpi_thermal_temp_open_fs, |
188 | .read = seq_read, | 188 | .read = seq_read, |
189 | .llseek = seq_lseek, | 189 | .llseek = seq_lseek, |
190 | .release = single_release, | 190 | .release = single_release, |
191 | }; | 191 | }; |
192 | 192 | ||
193 | static struct file_operations acpi_thermal_trip_fops = { | 193 | static const struct file_operations acpi_thermal_trip_fops = { |
194 | .open = acpi_thermal_trip_open_fs, | 194 | .open = acpi_thermal_trip_open_fs, |
195 | .read = seq_read, | 195 | .read = seq_read, |
196 | .write = acpi_thermal_write_trip_points, | 196 | .write = acpi_thermal_write_trip_points, |
@@ -198,7 +198,7 @@ static struct file_operations acpi_thermal_trip_fops = { | |||
198 | .release = single_release, | 198 | .release = single_release, |
199 | }; | 199 | }; |
200 | 200 | ||
201 | static struct file_operations acpi_thermal_cooling_fops = { | 201 | static const struct file_operations acpi_thermal_cooling_fops = { |
202 | .open = acpi_thermal_cooling_open_fs, | 202 | .open = acpi_thermal_cooling_open_fs, |
203 | .read = seq_read, | 203 | .read = seq_read, |
204 | .write = acpi_thermal_write_cooling_mode, | 204 | .write = acpi_thermal_write_cooling_mode, |
@@ -206,7 +206,7 @@ static struct file_operations acpi_thermal_cooling_fops = { | |||
206 | .release = single_release, | 206 | .release = single_release, |
207 | }; | 207 | }; |
208 | 208 | ||
209 | static struct file_operations acpi_thermal_polling_fops = { | 209 | static const struct file_operations acpi_thermal_polling_fops = { |
210 | .open = acpi_thermal_polling_open_fs, | 210 | .open = acpi_thermal_polling_open_fs, |
211 | .read = seq_read, | 211 | .read = seq_read, |
212 | .write = acpi_thermal_write_polling, | 212 | .write = acpi_thermal_write_polling, |
@@ -1359,13 +1359,28 @@ static int acpi_thermal_remove(struct acpi_device *device, int type) | |||
1359 | static int acpi_thermal_resume(struct acpi_device *device, int state) | 1359 | static int acpi_thermal_resume(struct acpi_device *device, int state) |
1360 | { | 1360 | { |
1361 | struct acpi_thermal *tz = NULL; | 1361 | struct acpi_thermal *tz = NULL; |
1362 | int i; | ||
1362 | 1363 | ||
1363 | if (!device || !acpi_driver_data(device)) | 1364 | if (!device || !acpi_driver_data(device)) |
1364 | return -EINVAL; | 1365 | return -EINVAL; |
1365 | 1366 | ||
1366 | tz = (struct acpi_thermal *)acpi_driver_data(device); | 1367 | tz = (struct acpi_thermal *)acpi_driver_data(device); |
1367 | 1368 | ||
1368 | acpi_thermal_check(tz); | 1369 | acpi_thermal_get_temperature(tz); |
1370 | |||
1371 | for (i = 0; i < ACPI_THERMAL_MAX_ACTIVE; i++) { | ||
1372 | if (tz->trips.active[i].flags.valid) { | ||
1373 | tz->temperature = tz->trips.active[i].temperature; | ||
1374 | tz->trips.active[i].flags.enabled = 0; | ||
1375 | |||
1376 | acpi_thermal_active(tz); | ||
1377 | |||
1378 | tz->state.active |= tz->trips.active[i].flags.enabled; | ||
1379 | tz->state.active_index = i; | ||
1380 | } | ||
1381 | } | ||
1382 | |||
1383 | acpi_thermal_check(tz); | ||
1369 | 1384 | ||
1370 | return AE_OK; | 1385 | return AE_OK; |
1371 | } | 1386 | } |
diff --git a/drivers/acpi/utilities/utalloc.c b/drivers/acpi/utilities/utalloc.c index 5cff17dc78b3..f6cbc0b1bfd0 100644 --- a/drivers/acpi/utilities/utalloc.c +++ b/drivers/acpi/utilities/utalloc.c | |||
@@ -285,6 +285,7 @@ acpi_ut_initialize_buffer(struct acpi_buffer * buffer, | |||
285 | return (status); | 285 | return (status); |
286 | } | 286 | } |
287 | 287 | ||
288 | #ifdef NOT_USED_BY_LINUX | ||
288 | /******************************************************************************* | 289 | /******************************************************************************* |
289 | * | 290 | * |
290 | * FUNCTION: acpi_ut_allocate | 291 | * FUNCTION: acpi_ut_allocate |
@@ -360,3 +361,4 @@ void *acpi_ut_allocate_zeroed(acpi_size size, | |||
360 | 361 | ||
361 | return (allocation); | 362 | return (allocation); |
362 | } | 363 | } |
364 | #endif | ||
diff --git a/drivers/acpi/utilities/utdebug.c b/drivers/acpi/utilities/utdebug.c index 5ec1cfcc611d..bb1eaf9aa653 100644 --- a/drivers/acpi/utilities/utdebug.c +++ b/drivers/acpi/utilities/utdebug.c | |||
@@ -47,7 +47,7 @@ | |||
47 | ACPI_MODULE_NAME("utdebug") | 47 | ACPI_MODULE_NAME("utdebug") |
48 | 48 | ||
49 | #ifdef ACPI_DEBUG_OUTPUT | 49 | #ifdef ACPI_DEBUG_OUTPUT |
50 | static u32 acpi_gbl_prev_thread_id = 0xFFFFFFFF; | 50 | static acpi_thread_id acpi_gbl_prev_thread_id; |
51 | static char *acpi_gbl_fn_entry_str = "----Entry"; | 51 | static char *acpi_gbl_fn_entry_str = "----Entry"; |
52 | static char *acpi_gbl_fn_exit_str = "----Exit-"; | 52 | static char *acpi_gbl_fn_exit_str = "----Exit-"; |
53 | 53 | ||
@@ -181,7 +181,7 @@ acpi_ut_debug_print(u32 requested_debug_level, | |||
181 | if (ACPI_LV_THREADS & acpi_dbg_level) { | 181 | if (ACPI_LV_THREADS & acpi_dbg_level) { |
182 | acpi_os_printf | 182 | acpi_os_printf |
183 | ("\n**** Context Switch from TID %X to TID %X ****\n\n", | 183 | ("\n**** Context Switch from TID %X to TID %X ****\n\n", |
184 | acpi_gbl_prev_thread_id, thread_id); | 184 | (u32) acpi_gbl_prev_thread_id, (u32) thread_id); |
185 | } | 185 | } |
186 | 186 | ||
187 | acpi_gbl_prev_thread_id = thread_id; | 187 | acpi_gbl_prev_thread_id = thread_id; |
diff --git a/drivers/acpi/utilities/utdelete.c b/drivers/acpi/utilities/utdelete.c index 38ebe1c54330..9d3f1149ba21 100644 --- a/drivers/acpi/utilities/utdelete.c +++ b/drivers/acpi/utilities/utdelete.c | |||
@@ -447,11 +447,16 @@ acpi_ut_update_object_reference(union acpi_operand_object *object, u16 action) | |||
447 | */ | 447 | */ |
448 | switch (ACPI_GET_OBJECT_TYPE(object)) { | 448 | switch (ACPI_GET_OBJECT_TYPE(object)) { |
449 | case ACPI_TYPE_DEVICE: | 449 | case ACPI_TYPE_DEVICE: |
450 | case ACPI_TYPE_PROCESSOR: | ||
451 | case ACPI_TYPE_POWER: | ||
452 | case ACPI_TYPE_THERMAL: | ||
450 | 453 | ||
451 | acpi_ut_update_ref_count(object->device.system_notify, | 454 | /* Update the notify objects for these types (if present) */ |
452 | action); | 455 | |
453 | acpi_ut_update_ref_count(object->device.device_notify, | 456 | acpi_ut_update_ref_count(object->common_notify. |
454 | action); | 457 | system_notify, action); |
458 | acpi_ut_update_ref_count(object->common_notify. | ||
459 | device_notify, action); | ||
455 | break; | 460 | break; |
456 | 461 | ||
457 | case ACPI_TYPE_PACKAGE: | 462 | case ACPI_TYPE_PACKAGE: |
diff --git a/drivers/acpi/utilities/utmisc.c b/drivers/acpi/utilities/utmisc.c index 33268310c738..6d8a8211be90 100644 --- a/drivers/acpi/utilities/utmisc.c +++ b/drivers/acpi/utilities/utmisc.c | |||
@@ -65,7 +65,7 @@ ACPI_MODULE_NAME("utmisc") | |||
65 | u8 acpi_ut_is_aml_table(struct acpi_table_header *table) | 65 | u8 acpi_ut_is_aml_table(struct acpi_table_header *table) |
66 | { | 66 | { |
67 | 67 | ||
68 | /* Ignore tables that contain AML */ | 68 | /* These are the only tables that contain executable AML */ |
69 | 69 | ||
70 | if (ACPI_COMPARE_NAME(table->signature, DSDT_SIG) || | 70 | if (ACPI_COMPARE_NAME(table->signature, DSDT_SIG) || |
71 | ACPI_COMPARE_NAME(table->signature, PSDT_SIG) || | 71 | ACPI_COMPARE_NAME(table->signature, PSDT_SIG) || |
@@ -419,10 +419,15 @@ void acpi_ut_set_integer_width(u8 revision) | |||
419 | { | 419 | { |
420 | 420 | ||
421 | if (revision <= 1) { | 421 | if (revision <= 1) { |
422 | |||
423 | /* 32-bit case */ | ||
424 | |||
422 | acpi_gbl_integer_bit_width = 32; | 425 | acpi_gbl_integer_bit_width = 32; |
423 | acpi_gbl_integer_nybble_width = 8; | 426 | acpi_gbl_integer_nybble_width = 8; |
424 | acpi_gbl_integer_byte_width = 4; | 427 | acpi_gbl_integer_byte_width = 4; |
425 | } else { | 428 | } else { |
429 | /* 64-bit case (ACPI 2.0+) */ | ||
430 | |||
426 | acpi_gbl_integer_bit_width = 64; | 431 | acpi_gbl_integer_bit_width = 64; |
427 | acpi_gbl_integer_nybble_width = 16; | 432 | acpi_gbl_integer_nybble_width = 16; |
428 | acpi_gbl_integer_byte_width = 8; | 433 | acpi_gbl_integer_byte_width = 8; |
@@ -502,6 +507,7 @@ acpi_ut_display_init_pathname(u8 type, | |||
502 | * FUNCTION: acpi_ut_valid_acpi_char | 507 | * FUNCTION: acpi_ut_valid_acpi_char |
503 | * | 508 | * |
504 | * PARAMETERS: Char - The character to be examined | 509 | * PARAMETERS: Char - The character to be examined |
510 | * Position - Byte position (0-3) | ||
505 | * | 511 | * |
506 | * RETURN: TRUE if the character is valid, FALSE otherwise | 512 | * RETURN: TRUE if the character is valid, FALSE otherwise |
507 | * | 513 | * |
@@ -609,7 +615,9 @@ acpi_name acpi_ut_repair_name(acpi_name name) | |||
609 | * | 615 | * |
610 | * RETURN: Status and Converted value | 616 | * RETURN: Status and Converted value |
611 | * | 617 | * |
612 | * DESCRIPTION: Convert a string into an unsigned value. | 618 | * DESCRIPTION: Convert a string into an unsigned value. Performs either a |
619 | * 32-bit or 64-bit conversion, depending on the current mode | ||
620 | * of the interpreter. | ||
613 | * NOTE: Does not support Octal strings, not needed. | 621 | * NOTE: Does not support Octal strings, not needed. |
614 | * | 622 | * |
615 | ******************************************************************************/ | 623 | ******************************************************************************/ |
@@ -627,7 +635,7 @@ acpi_ut_strtoul64(char *string, u32 base, acpi_integer * ret_integer) | |||
627 | u8 sign_of0x = 0; | 635 | u8 sign_of0x = 0; |
628 | u8 term = 0; | 636 | u8 term = 0; |
629 | 637 | ||
630 | ACPI_FUNCTION_TRACE(ut_stroul64); | 638 | ACPI_FUNCTION_TRACE_STR(ut_stroul64, string); |
631 | 639 | ||
632 | switch (base) { | 640 | switch (base) { |
633 | case ACPI_ANY_BASE: | 641 | case ACPI_ANY_BASE: |
@@ -675,11 +683,13 @@ acpi_ut_strtoul64(char *string, u32 base, acpi_integer * ret_integer) | |||
675 | } | 683 | } |
676 | } | 684 | } |
677 | 685 | ||
686 | /* | ||
687 | * Perform a 32-bit or 64-bit conversion, depending upon the current | ||
688 | * execution mode of the interpreter | ||
689 | */ | ||
678 | dividend = (mode32) ? ACPI_UINT32_MAX : ACPI_UINT64_MAX; | 690 | dividend = (mode32) ? ACPI_UINT32_MAX : ACPI_UINT64_MAX; |
679 | 691 | ||
680 | /* At least one character in the string here */ | 692 | /* Main loop: convert the string to a 32- or 64-bit integer */ |
681 | |||
682 | /* Main loop: convert the string to a 64-bit integer */ | ||
683 | 693 | ||
684 | while (*string) { | 694 | while (*string) { |
685 | if (ACPI_IS_DIGIT(*string)) { | 695 | if (ACPI_IS_DIGIT(*string)) { |
@@ -754,6 +764,9 @@ acpi_ut_strtoul64(char *string, u32 base, acpi_integer * ret_integer) | |||
754 | 764 | ||
755 | all_done: | 765 | all_done: |
756 | 766 | ||
767 | ACPI_DEBUG_PRINT((ACPI_DB_EXEC, "Converted value: %8.8X%8.8X\n", | ||
768 | ACPI_FORMAT_UINT64(return_value))); | ||
769 | |||
757 | *ret_integer = return_value; | 770 | *ret_integer = return_value; |
758 | return_ACPI_STATUS(AE_OK); | 771 | return_ACPI_STATUS(AE_OK); |
759 | 772 | ||
diff --git a/drivers/acpi/utilities/utmutex.c b/drivers/acpi/utilities/utmutex.c index dfc8f30ca892..c39062a047cd 100644 --- a/drivers/acpi/utilities/utmutex.c +++ b/drivers/acpi/utilities/utmutex.c | |||
@@ -244,14 +244,14 @@ acpi_status acpi_ut_acquire_mutex(acpi_mutex_handle mutex_id) | |||
244 | 244 | ||
245 | ACPI_DEBUG_PRINT((ACPI_DB_MUTEX, | 245 | ACPI_DEBUG_PRINT((ACPI_DB_MUTEX, |
246 | "Thread %X attempting to acquire Mutex [%s]\n", | 246 | "Thread %X attempting to acquire Mutex [%s]\n", |
247 | this_thread_id, acpi_ut_get_mutex_name(mutex_id))); | 247 | (u32) this_thread_id, acpi_ut_get_mutex_name(mutex_id))); |
248 | 248 | ||
249 | status = acpi_os_acquire_mutex(acpi_gbl_mutex_info[mutex_id].mutex, | 249 | status = acpi_os_acquire_mutex(acpi_gbl_mutex_info[mutex_id].mutex, |
250 | ACPI_WAIT_FOREVER); | 250 | ACPI_WAIT_FOREVER); |
251 | if (ACPI_SUCCESS(status)) { | 251 | if (ACPI_SUCCESS(status)) { |
252 | ACPI_DEBUG_PRINT((ACPI_DB_MUTEX, | 252 | ACPI_DEBUG_PRINT((ACPI_DB_MUTEX, |
253 | "Thread %X acquired Mutex [%s]\n", | 253 | "Thread %X acquired Mutex [%s]\n", |
254 | this_thread_id, | 254 | (u32) this_thread_id, |
255 | acpi_ut_get_mutex_name(mutex_id))); | 255 | acpi_ut_get_mutex_name(mutex_id))); |
256 | 256 | ||
257 | acpi_gbl_mutex_info[mutex_id].use_count++; | 257 | acpi_gbl_mutex_info[mutex_id].use_count++; |
@@ -259,7 +259,7 @@ acpi_status acpi_ut_acquire_mutex(acpi_mutex_handle mutex_id) | |||
259 | } else { | 259 | } else { |
260 | ACPI_EXCEPTION((AE_INFO, status, | 260 | ACPI_EXCEPTION((AE_INFO, status, |
261 | "Thread %X could not acquire Mutex [%X]", | 261 | "Thread %X could not acquire Mutex [%X]", |
262 | this_thread_id, mutex_id)); | 262 | (u32) this_thread_id, mutex_id)); |
263 | } | 263 | } |
264 | 264 | ||
265 | return (status); | 265 | return (status); |
@@ -285,7 +285,7 @@ acpi_status acpi_ut_release_mutex(acpi_mutex_handle mutex_id) | |||
285 | 285 | ||
286 | this_thread_id = acpi_os_get_thread_id(); | 286 | this_thread_id = acpi_os_get_thread_id(); |
287 | ACPI_DEBUG_PRINT((ACPI_DB_MUTEX, | 287 | ACPI_DEBUG_PRINT((ACPI_DB_MUTEX, |
288 | "Thread %X releasing Mutex [%s]\n", this_thread_id, | 288 | "Thread %X releasing Mutex [%s]\n", (u32) this_thread_id, |
289 | acpi_ut_get_mutex_name(mutex_id))); | 289 | acpi_ut_get_mutex_name(mutex_id))); |
290 | 290 | ||
291 | if (mutex_id > ACPI_MAX_MUTEX) { | 291 | if (mutex_id > ACPI_MAX_MUTEX) { |
diff --git a/drivers/acpi/utilities/utstate.c b/drivers/acpi/utilities/utstate.c index 0f5c5bb5deff..eaa13d05c859 100644 --- a/drivers/acpi/utilities/utstate.c +++ b/drivers/acpi/utilities/utstate.c | |||
@@ -199,6 +199,13 @@ struct acpi_thread_state *acpi_ut_create_thread_state(void) | |||
199 | state->common.descriptor_type = ACPI_DESC_TYPE_STATE_THREAD; | 199 | state->common.descriptor_type = ACPI_DESC_TYPE_STATE_THREAD; |
200 | state->thread.thread_id = acpi_os_get_thread_id(); | 200 | state->thread.thread_id = acpi_os_get_thread_id(); |
201 | 201 | ||
202 | /* Check for invalid thread ID - zero is very bad, it will break things */ | ||
203 | |||
204 | if (!state->thread.thread_id) { | ||
205 | ACPI_ERROR((AE_INFO, "Invalid zero ID from AcpiOsGetThreadId")); | ||
206 | state->thread.thread_id = (acpi_thread_id) 1; | ||
207 | } | ||
208 | |||
202 | return_PTR((struct acpi_thread_state *)state); | 209 | return_PTR((struct acpi_thread_state *)state); |
203 | } | 210 | } |
204 | 211 | ||
diff --git a/drivers/atm/Kconfig b/drivers/atm/Kconfig index 01a9f1cb7743..cfa5af883e13 100644 --- a/drivers/atm/Kconfig +++ b/drivers/atm/Kconfig | |||
@@ -398,7 +398,7 @@ config ATM_FORE200E_USE_TASKLET | |||
398 | default n | 398 | default n |
399 | help | 399 | help |
400 | This defers work to be done by the interrupt handler to a | 400 | This defers work to be done by the interrupt handler to a |
401 | tasklet instead of hanlding everything at interrupt time. This | 401 | tasklet instead of handling everything at interrupt time. This |
402 | may improve the responsive of the host. | 402 | may improve the responsive of the host. |
403 | 403 | ||
404 | config ATM_FORE200E_TX_RETRY | 404 | config ATM_FORE200E_TX_RETRY |
diff --git a/drivers/base/Kconfig b/drivers/base/Kconfig index 80502dc6ed66..0b4e22436935 100644 --- a/drivers/base/Kconfig +++ b/drivers/base/Kconfig | |||
@@ -20,7 +20,7 @@ config PREVENT_FIRMWARE_BUILD | |||
20 | 20 | ||
21 | config FW_LOADER | 21 | config FW_LOADER |
22 | tristate "Userspace firmware loading support" | 22 | tristate "Userspace firmware loading support" |
23 | select HOTPLUG | 23 | depends on HOTPLUG |
24 | ---help--- | 24 | ---help--- |
25 | This option is provided for the case where no in-kernel-tree modules | 25 | This option is provided for the case where no in-kernel-tree modules |
26 | require userspace firmware loading support, but a module built outside | 26 | require userspace firmware loading support, but a module built outside |
diff --git a/drivers/base/bus.c b/drivers/base/bus.c index 83fa8b291a59..2e954d07175a 100644 --- a/drivers/base/bus.c +++ b/drivers/base/bus.c | |||
@@ -129,7 +129,7 @@ static struct kobj_type ktype_bus = { | |||
129 | 129 | ||
130 | }; | 130 | }; |
131 | 131 | ||
132 | decl_subsys(bus, &ktype_bus, NULL); | 132 | static decl_subsys(bus, &ktype_bus, NULL); |
133 | 133 | ||
134 | 134 | ||
135 | #ifdef CONFIG_HOTPLUG | 135 | #ifdef CONFIG_HOTPLUG |
@@ -598,12 +598,13 @@ void put_bus(struct bus_type * bus) | |||
598 | * | 598 | * |
599 | * Note that kset_find_obj increments bus' reference count. | 599 | * Note that kset_find_obj increments bus' reference count. |
600 | */ | 600 | */ |
601 | 601 | #if 0 | |
602 | struct bus_type * find_bus(char * name) | 602 | struct bus_type * find_bus(char * name) |
603 | { | 603 | { |
604 | struct kobject * k = kset_find_obj(&bus_subsys.kset, name); | 604 | struct kobject * k = kset_find_obj(&bus_subsys.kset, name); |
605 | return k ? to_bus(k) : NULL; | 605 | return k ? to_bus(k) : NULL; |
606 | } | 606 | } |
607 | #endif /* 0 */ | ||
607 | 608 | ||
608 | 609 | ||
609 | /** | 610 | /** |
diff --git a/drivers/base/core.c b/drivers/base/core.c index b21f864c9ce8..be6b5bc0677d 100644 --- a/drivers/base/core.c +++ b/drivers/base/core.c | |||
@@ -559,20 +559,20 @@ static void device_create_release(struct device *dev) | |||
559 | 559 | ||
560 | /** | 560 | /** |
561 | * device_create - creates a device and registers it with sysfs | 561 | * device_create - creates a device and registers it with sysfs |
562 | * @cs: pointer to the struct class that this device should be registered to. | 562 | * @class: pointer to the struct class that this device should be registered to |
563 | * @parent: pointer to the parent struct device of this new device, if any. | 563 | * @parent: pointer to the parent struct device of this new device, if any |
564 | * @dev: the dev_t for the char device to be added. | 564 | * @devt: the dev_t for the char device to be added |
565 | * @fmt: string for the class device's name | 565 | * @fmt: string for the device's name |
566 | * | ||
567 | * This function can be used by char device classes. A struct device | ||
568 | * will be created in sysfs, registered to the specified class. | ||
566 | * | 569 | * |
567 | * This function can be used by char device classes. A struct | ||
568 | * device will be created in sysfs, registered to the specified | ||
569 | * class. | ||
570 | * A "dev" file will be created, showing the dev_t for the device, if | 570 | * A "dev" file will be created, showing the dev_t for the device, if |
571 | * the dev_t is not 0,0. | 571 | * the dev_t is not 0,0. |
572 | * If a pointer to a parent struct device is passed in, the newly | 572 | * If a pointer to a parent struct device is passed in, the newly created |
573 | * created struct device will be a child of that device in sysfs. The | 573 | * struct device will be a child of that device in sysfs. |
574 | * pointer to the struct device will be returned from the call. Any | 574 | * The pointer to the struct device will be returned from the call. |
575 | * further sysfs files that might be required can be created using this | 575 | * Any further sysfs files that might be required can be created using this |
576 | * pointer. | 576 | * pointer. |
577 | * | 577 | * |
578 | * Note: the struct class passed to this function must have previously | 578 | * Note: the struct class passed to this function must have previously |
@@ -620,11 +620,11 @@ EXPORT_SYMBOL_GPL(device_create); | |||
620 | 620 | ||
621 | /** | 621 | /** |
622 | * device_destroy - removes a device that was created with device_create() | 622 | * device_destroy - removes a device that was created with device_create() |
623 | * @class: the pointer to the struct class that this device was registered * with. | 623 | * @class: pointer to the struct class that this device was registered with |
624 | * @dev: the dev_t of the device that was previously registered. | 624 | * @devt: the dev_t of the device that was previously registered |
625 | * | 625 | * |
626 | * This call unregisters and cleans up a class device that was created with a | 626 | * This call unregisters and cleans up a device that was created with a |
627 | * call to class_device_create() | 627 | * call to device_create(). |
628 | */ | 628 | */ |
629 | void device_destroy(struct class *class, dev_t devt) | 629 | void device_destroy(struct class *class, dev_t devt) |
630 | { | 630 | { |
diff --git a/drivers/block/Kconfig b/drivers/block/Kconfig index 93d94749310b..b5382cedf0c0 100644 --- a/drivers/block/Kconfig +++ b/drivers/block/Kconfig | |||
@@ -400,6 +400,16 @@ config BLK_DEV_RAM_SIZE | |||
400 | what are you doing. If you are using IBM S/390, then set this to | 400 | what are you doing. If you are using IBM S/390, then set this to |
401 | 8192. | 401 | 8192. |
402 | 402 | ||
403 | config BLK_DEV_RAM_BLOCKSIZE | ||
404 | int "Default RAM disk block size (bytes)" | ||
405 | depends on BLK_DEV_RAM | ||
406 | default "1024" | ||
407 | help | ||
408 | The default value is 1024 kilobytes. PAGE_SIZE is a much more | ||
409 | efficient choice however. The default is kept to ensure initrd | ||
410 | setups function - apparently needed by the rd_load_image routine | ||
411 | that supposes the filesystem in the image uses a 1024 blocksize. | ||
412 | |||
403 | config BLK_DEV_INITRD | 413 | config BLK_DEV_INITRD |
404 | bool "Initial RAM filesystem and RAM disk (initramfs/initrd) support" | 414 | bool "Initial RAM filesystem and RAM disk (initramfs/initrd) support" |
405 | depends on BROKEN || !FRV | 415 | depends on BROKEN || !FRV |
diff --git a/drivers/block/aoe/aoechr.c b/drivers/block/aoe/aoechr.c index 5327f553b4f5..1bc1cf9603f1 100644 --- a/drivers/block/aoe/aoechr.c +++ b/drivers/block/aoe/aoechr.c | |||
@@ -162,7 +162,7 @@ aoechr_open(struct inode *inode, struct file *filp) | |||
162 | { | 162 | { |
163 | int n, i; | 163 | int n, i; |
164 | 164 | ||
165 | n = MINOR(inode->i_rdev); | 165 | n = iminor(inode); |
166 | filp->private_data = (void *) (unsigned long) n; | 166 | filp->private_data = (void *) (unsigned long) n; |
167 | 167 | ||
168 | for (i = 0; i < ARRAY_SIZE(chardevs); ++i) | 168 | for (i = 0; i < ARRAY_SIZE(chardevs); ++i) |
diff --git a/drivers/block/cpqarray.c b/drivers/block/cpqarray.c index 757f42dd8e86..78082edc14b4 100644 --- a/drivers/block/cpqarray.c +++ b/drivers/block/cpqarray.c | |||
@@ -1739,8 +1739,6 @@ static void getgeometry(int ctlr) | |||
1739 | (log_index < id_ctlr_buf->nr_drvs) | 1739 | (log_index < id_ctlr_buf->nr_drvs) |
1740 | && (log_unit < NWD); | 1740 | && (log_unit < NWD); |
1741 | log_unit++) { | 1741 | log_unit++) { |
1742 | struct gendisk *disk = ida_gendisk[ctlr][log_unit]; | ||
1743 | |||
1744 | size = sizeof(sense_log_drv_stat_t); | 1742 | size = sizeof(sense_log_drv_stat_t); |
1745 | 1743 | ||
1746 | /* | 1744 | /* |
diff --git a/drivers/block/rd.c b/drivers/block/rd.c index 3cf246abb5ec..a3f64bfe6b58 100644 --- a/drivers/block/rd.c +++ b/drivers/block/rd.c | |||
@@ -84,7 +84,7 @@ int rd_size = CONFIG_BLK_DEV_RAM_SIZE; /* Size of the RAM disks */ | |||
84 | * behaviour. The default is still BLOCK_SIZE (needed by rd_load_image that | 84 | * behaviour. The default is still BLOCK_SIZE (needed by rd_load_image that |
85 | * supposes the filesystem in the image uses a BLOCK_SIZE blocksize). | 85 | * supposes the filesystem in the image uses a BLOCK_SIZE blocksize). |
86 | */ | 86 | */ |
87 | static int rd_blocksize = BLOCK_SIZE; /* blocksize of the RAM disks */ | 87 | static int rd_blocksize = CONFIG_BLK_DEV_RAM_BLOCKSIZE; |
88 | 88 | ||
89 | /* | 89 | /* |
90 | * Copyright (C) 2000 Linus Torvalds. | 90 | * Copyright (C) 2000 Linus Torvalds. |
diff --git a/drivers/bluetooth/bcm203x.c b/drivers/bluetooth/bcm203x.c index 6f67141f4de0..13ba729cdd57 100644 --- a/drivers/bluetooth/bcm203x.c +++ b/drivers/bluetooth/bcm203x.c | |||
@@ -234,6 +234,7 @@ static int bcm203x_probe(struct usb_interface *intf, const struct usb_device_id | |||
234 | data->fw_data = kmalloc(firmware->size, GFP_KERNEL); | 234 | data->fw_data = kmalloc(firmware->size, GFP_KERNEL); |
235 | if (!data->fw_data) { | 235 | if (!data->fw_data) { |
236 | BT_ERR("Can't allocate memory for firmware image"); | 236 | BT_ERR("Can't allocate memory for firmware image"); |
237 | release_firmware(firmware); | ||
237 | usb_free_urb(data->urb); | 238 | usb_free_urb(data->urb); |
238 | kfree(data->buffer); | 239 | kfree(data->buffer); |
239 | kfree(data); | 240 | kfree(data); |
diff --git a/drivers/bluetooth/hci_ldisc.c b/drivers/bluetooth/hci_ldisc.c index 1994270c16e1..93ba25b7ea32 100644 --- a/drivers/bluetooth/hci_ldisc.c +++ b/drivers/bluetooth/hci_ldisc.c | |||
@@ -191,7 +191,7 @@ static int hci_uart_flush(struct hci_dev *hdev) | |||
191 | 191 | ||
192 | /* Flush any pending characters in the driver and discipline. */ | 192 | /* Flush any pending characters in the driver and discipline. */ |
193 | tty_ldisc_flush(tty); | 193 | tty_ldisc_flush(tty); |
194 | if (tty->driver->flush_buffer) | 194 | if (tty->driver && tty->driver->flush_buffer) |
195 | tty->driver->flush_buffer(tty); | 195 | tty->driver->flush_buffer(tty); |
196 | 196 | ||
197 | if (test_bit(HCI_UART_PROTO_SET, &hu->flags)) | 197 | if (test_bit(HCI_UART_PROTO_SET, &hu->flags)) |
@@ -290,7 +290,7 @@ static int hci_uart_tty_open(struct tty_struct *tty) | |||
290 | if (tty->ldisc.flush_buffer) | 290 | if (tty->ldisc.flush_buffer) |
291 | tty->ldisc.flush_buffer(tty); | 291 | tty->ldisc.flush_buffer(tty); |
292 | 292 | ||
293 | if (tty->driver->flush_buffer) | 293 | if (tty->driver && tty->driver->flush_buffer) |
294 | tty->driver->flush_buffer(tty); | 294 | tty->driver->flush_buffer(tty); |
295 | 295 | ||
296 | return 0; | 296 | return 0; |
diff --git a/drivers/cdrom/cdrom.c b/drivers/cdrom/cdrom.c index ca27ee89240b..d239cf8b20bd 100644 --- a/drivers/cdrom/cdrom.c +++ b/drivers/cdrom/cdrom.c | |||
@@ -1837,7 +1837,7 @@ static int dvd_read_bca(struct cdrom_device_info *cdi, dvd_struct *s) | |||
1837 | init_cdrom_command(&cgc, buf, sizeof(buf), CGC_DATA_READ); | 1837 | init_cdrom_command(&cgc, buf, sizeof(buf), CGC_DATA_READ); |
1838 | cgc.cmd[0] = GPCMD_READ_DVD_STRUCTURE; | 1838 | cgc.cmd[0] = GPCMD_READ_DVD_STRUCTURE; |
1839 | cgc.cmd[7] = s->type; | 1839 | cgc.cmd[7] = s->type; |
1840 | cgc.cmd[9] = cgc.buflen = 0xff; | 1840 | cgc.cmd[9] = cgc.buflen & 0xff; |
1841 | 1841 | ||
1842 | if ((ret = cdo->generic_packet(cdi, &cgc))) | 1842 | if ((ret = cdo->generic_packet(cdi, &cgc))) |
1843 | return ret; | 1843 | return ret; |
diff --git a/drivers/char/hvsi.c b/drivers/char/hvsi.c index 56612a2dca6b..41db8060e8f7 100644 --- a/drivers/char/hvsi.c +++ b/drivers/char/hvsi.c | |||
@@ -1299,7 +1299,7 @@ static int __init hvsi_console_init(void) | |||
1299 | hp->inbuf_end = hp->inbuf; | 1299 | hp->inbuf_end = hp->inbuf; |
1300 | hp->state = HVSI_CLOSED; | 1300 | hp->state = HVSI_CLOSED; |
1301 | hp->vtermno = *vtermno; | 1301 | hp->vtermno = *vtermno; |
1302 | hp->virq = irq_create_mapping(NULL, irq[0], 0); | 1302 | hp->virq = irq_create_mapping(NULL, irq[0]); |
1303 | if (hp->virq == NO_IRQ) { | 1303 | if (hp->virq == NO_IRQ) { |
1304 | printk(KERN_ERR "%s: couldn't create irq mapping for 0x%x\n", | 1304 | printk(KERN_ERR "%s: couldn't create irq mapping for 0x%x\n", |
1305 | __FUNCTION__, irq[0]); | 1305 | __FUNCTION__, irq[0]); |
diff --git a/drivers/char/ip2/ip2main.c b/drivers/char/ip2/ip2main.c index 518ece7ac656..7907ae88c2f4 100644 --- a/drivers/char/ip2/ip2main.c +++ b/drivers/char/ip2/ip2main.c | |||
@@ -3186,3 +3186,10 @@ ip2trace (unsigned short pn, unsigned char cat, unsigned char label, unsigned lo | |||
3186 | 3186 | ||
3187 | 3187 | ||
3188 | MODULE_LICENSE("GPL"); | 3188 | MODULE_LICENSE("GPL"); |
3189 | |||
3190 | static struct pci_device_id ip2main_pci_tbl[] __devinitdata = { | ||
3191 | { PCI_DEVICE(PCI_VENDOR_ID_COMPUTONE, PCI_DEVICE_ID_COMPUTONE_IP2EX) }, | ||
3192 | { } | ||
3193 | }; | ||
3194 | |||
3195 | MODULE_DEVICE_TABLE(pci, ip2main_pci_tbl); | ||
diff --git a/drivers/char/mem.c b/drivers/char/mem.c index e97c32ceb796..917b20402664 100644 --- a/drivers/char/mem.c +++ b/drivers/char/mem.c | |||
@@ -95,7 +95,7 @@ static inline int valid_phys_addr_range(unsigned long addr, size_t count) | |||
95 | return 1; | 95 | return 1; |
96 | } | 96 | } |
97 | 97 | ||
98 | static inline int valid_mmap_phys_addr_range(unsigned long addr, size_t size) | 98 | static inline int valid_mmap_phys_addr_range(unsigned long pfn, size_t size) |
99 | { | 99 | { |
100 | return 1; | 100 | return 1; |
101 | } | 101 | } |
@@ -242,7 +242,7 @@ static int mmap_mem(struct file * file, struct vm_area_struct * vma) | |||
242 | { | 242 | { |
243 | size_t size = vma->vm_end - vma->vm_start; | 243 | size_t size = vma->vm_end - vma->vm_start; |
244 | 244 | ||
245 | if (!valid_mmap_phys_addr_range(vma->vm_pgoff << PAGE_SHIFT, size)) | 245 | if (!valid_mmap_phys_addr_range(vma->vm_pgoff, size)) |
246 | return -EINVAL; | 246 | return -EINVAL; |
247 | 247 | ||
248 | vma->vm_page_prot = phys_mem_access_prot(file, vma->vm_pgoff, | 248 | vma->vm_page_prot = phys_mem_access_prot(file, vma->vm_pgoff, |
diff --git a/drivers/char/nsc_gpio.c b/drivers/char/nsc_gpio.c index 5b91e4e25641..7719bd75810b 100644 --- a/drivers/char/nsc_gpio.c +++ b/drivers/char/nsc_gpio.c | |||
@@ -68,13 +68,11 @@ ssize_t nsc_gpio_write(struct file *file, const char __user *data, | |||
68 | amp->gpio_config(m, ~1, 0); | 68 | amp->gpio_config(m, ~1, 0); |
69 | break; | 69 | break; |
70 | case 'T': | 70 | case 'T': |
71 | dev_dbg(dev, "GPIO%d output is push pull\n", | 71 | dev_dbg(dev, "GPIO%d output is push pull\n", m); |
72 | m); | ||
73 | amp->gpio_config(m, ~2, 2); | 72 | amp->gpio_config(m, ~2, 2); |
74 | break; | 73 | break; |
75 | case 't': | 74 | case 't': |
76 | dev_dbg(dev, "GPIO%d output is open drain\n", | 75 | dev_dbg(dev, "GPIO%d output is open drain\n", m); |
77 | m); | ||
78 | amp->gpio_config(m, ~2, 0); | 76 | amp->gpio_config(m, ~2, 0); |
79 | break; | 77 | break; |
80 | case 'P': | 78 | case 'P': |
diff --git a/drivers/char/pc8736x_gpio.c b/drivers/char/pc8736x_gpio.c index 4005ee0aa11e..645eb81cb5a9 100644 --- a/drivers/char/pc8736x_gpio.c +++ b/drivers/char/pc8736x_gpio.c | |||
@@ -3,18 +3,18 @@ | |||
3 | National Semiconductor PC8736x GPIO driver. Allows a user space | 3 | National Semiconductor PC8736x GPIO driver. Allows a user space |
4 | process to play with the GPIO pins. | 4 | process to play with the GPIO pins. |
5 | 5 | ||
6 | Copyright (c) 2005 Jim Cromie <jim.cromie@gmail.com> | 6 | Copyright (c) 2005,2006 Jim Cromie <jim.cromie@gmail.com> |
7 | 7 | ||
8 | adapted from linux/drivers/char/scx200_gpio.c | 8 | adapted from linux/drivers/char/scx200_gpio.c |
9 | Copyright (c) 2001,2002 Christer Weinigel <wingel@nano-system.com>, | 9 | Copyright (c) 2001,2002 Christer Weinigel <wingel@nano-system.com>, |
10 | */ | 10 | */ |
11 | 11 | ||
12 | #include <linux/config.h> | ||
13 | #include <linux/fs.h> | 12 | #include <linux/fs.h> |
14 | #include <linux/module.h> | 13 | #include <linux/module.h> |
15 | #include <linux/errno.h> | 14 | #include <linux/errno.h> |
16 | #include <linux/kernel.h> | 15 | #include <linux/kernel.h> |
17 | #include <linux/init.h> | 16 | #include <linux/init.h> |
17 | #include <linux/cdev.h> | ||
18 | #include <linux/io.h> | 18 | #include <linux/io.h> |
19 | #include <linux/ioport.h> | 19 | #include <linux/ioport.h> |
20 | #include <linux/mutex.h> | 20 | #include <linux/mutex.h> |
@@ -25,7 +25,7 @@ | |||
25 | #define DEVNAME "pc8736x_gpio" | 25 | #define DEVNAME "pc8736x_gpio" |
26 | 26 | ||
27 | MODULE_AUTHOR("Jim Cromie <jim.cromie@gmail.com>"); | 27 | MODULE_AUTHOR("Jim Cromie <jim.cromie@gmail.com>"); |
28 | MODULE_DESCRIPTION("NatSemi PC-8736x GPIO Pin Driver"); | 28 | MODULE_DESCRIPTION("NatSemi/Winbond PC-8736x GPIO Pin Driver"); |
29 | MODULE_LICENSE("GPL"); | 29 | MODULE_LICENSE("GPL"); |
30 | 30 | ||
31 | static int major; /* default to dynamic major */ | 31 | static int major; /* default to dynamic major */ |
@@ -38,14 +38,14 @@ static u8 pc8736x_gpio_shadow[4]; | |||
38 | 38 | ||
39 | #define SIO_BASE1 0x2E /* 1st command-reg to check */ | 39 | #define SIO_BASE1 0x2E /* 1st command-reg to check */ |
40 | #define SIO_BASE2 0x4E /* alt command-reg to check */ | 40 | #define SIO_BASE2 0x4E /* alt command-reg to check */ |
41 | #define SIO_BASE_OFFSET 0x20 | ||
42 | 41 | ||
43 | #define SIO_SID 0x20 /* SuperI/O ID Register */ | 42 | #define SIO_SID 0x20 /* SuperI/O ID Register */ |
44 | #define SIO_SID_VALUE 0xe9 /* Expected value in SuperI/O ID Register */ | 43 | #define SIO_SID_VALUE 0xe9 /* Expected value in SuperI/O ID Register */ |
45 | 44 | ||
46 | #define SIO_CF1 0x21 /* chip config, bit0 is chip enable */ | 45 | #define SIO_CF1 0x21 /* chip config, bit0 is chip enable */ |
47 | 46 | ||
48 | #define PC8736X_GPIO_SIZE 16 | 47 | #define PC8736X_GPIO_RANGE 16 /* ioaddr range */ |
48 | #define PC8736X_GPIO_CT 32 /* minors matching 4 8 bit ports */ | ||
49 | 49 | ||
50 | #define SIO_UNIT_SEL 0x7 /* unit select reg */ | 50 | #define SIO_UNIT_SEL 0x7 /* unit select reg */ |
51 | #define SIO_UNIT_ACT 0x30 /* unit enable */ | 51 | #define SIO_UNIT_ACT 0x30 /* unit enable */ |
@@ -212,31 +212,30 @@ static void pc8736x_gpio_change(unsigned index) | |||
212 | pc8736x_gpio_set(index, !pc8736x_gpio_current(index)); | 212 | pc8736x_gpio_set(index, !pc8736x_gpio_current(index)); |
213 | } | 213 | } |
214 | 214 | ||
215 | static struct nsc_gpio_ops pc8736x_access = { | 215 | static struct nsc_gpio_ops pc8736x_gpio_ops = { |
216 | .owner = THIS_MODULE, | 216 | .owner = THIS_MODULE, |
217 | .gpio_config = pc8736x_gpio_configure, | 217 | .gpio_config = pc8736x_gpio_configure, |
218 | .gpio_dump = nsc_gpio_dump, | 218 | .gpio_dump = nsc_gpio_dump, |
219 | .gpio_get = pc8736x_gpio_get, | 219 | .gpio_get = pc8736x_gpio_get, |
220 | .gpio_set = pc8736x_gpio_set, | 220 | .gpio_set = pc8736x_gpio_set, |
221 | .gpio_set_high = pc8736x_gpio_set_high, | ||
222 | .gpio_set_low = pc8736x_gpio_set_low, | ||
223 | .gpio_change = pc8736x_gpio_change, | 221 | .gpio_change = pc8736x_gpio_change, |
224 | .gpio_current = pc8736x_gpio_current | 222 | .gpio_current = pc8736x_gpio_current |
225 | }; | 223 | }; |
224 | EXPORT_SYMBOL(pc8736x_gpio_ops); | ||
226 | 225 | ||
227 | static int pc8736x_gpio_open(struct inode *inode, struct file *file) | 226 | static int pc8736x_gpio_open(struct inode *inode, struct file *file) |
228 | { | 227 | { |
229 | unsigned m = iminor(inode); | 228 | unsigned m = iminor(inode); |
230 | file->private_data = &pc8736x_access; | 229 | file->private_data = &pc8736x_gpio_ops; |
231 | 230 | ||
232 | dev_dbg(&pdev->dev, "open %d\n", m); | 231 | dev_dbg(&pdev->dev, "open %d\n", m); |
233 | 232 | ||
234 | if (m > 63) | 233 | if (m >= PC8736X_GPIO_CT) |
235 | return -EINVAL; | 234 | return -EINVAL; |
236 | return nonseekable_open(inode, file); | 235 | return nonseekable_open(inode, file); |
237 | } | 236 | } |
238 | 237 | ||
239 | static const struct file_operations pc8736x_gpio_fops = { | 238 | static const struct file_operations pc8736x_gpio_fileops = { |
240 | .owner = THIS_MODULE, | 239 | .owner = THIS_MODULE, |
241 | .open = pc8736x_gpio_open, | 240 | .open = pc8736x_gpio_open, |
242 | .write = nsc_gpio_write, | 241 | .write = nsc_gpio_write, |
@@ -255,9 +254,12 @@ static void __init pc8736x_init_shadow(void) | |||
255 | 254 | ||
256 | } | 255 | } |
257 | 256 | ||
257 | static struct cdev pc8736x_gpio_cdev; | ||
258 | |||
258 | static int __init pc8736x_gpio_init(void) | 259 | static int __init pc8736x_gpio_init(void) |
259 | { | 260 | { |
260 | int rc = 0; | 261 | int rc; |
262 | dev_t devid; | ||
261 | 263 | ||
262 | pdev = platform_device_alloc(DEVNAME, 0); | 264 | pdev = platform_device_alloc(DEVNAME, 0); |
263 | if (!pdev) | 265 | if (!pdev) |
@@ -275,7 +277,7 @@ static int __init pc8736x_gpio_init(void) | |||
275 | dev_err(&pdev->dev, "no device found\n"); | 277 | dev_err(&pdev->dev, "no device found\n"); |
276 | goto undo_platform_dev_add; | 278 | goto undo_platform_dev_add; |
277 | } | 279 | } |
278 | pc8736x_access.dev = &pdev->dev; | 280 | pc8736x_gpio_ops.dev = &pdev->dev; |
279 | 281 | ||
280 | /* Verify that chip and it's GPIO unit are both enabled. | 282 | /* Verify that chip and it's GPIO unit are both enabled. |
281 | My BIOS does this, so I take minimum action here | 283 | My BIOS does this, so I take minimum action here |
@@ -297,7 +299,7 @@ static int __init pc8736x_gpio_init(void) | |||
297 | pc8736x_gpio_base = (superio_inb(SIO_BASE_HADDR) << 8 | 299 | pc8736x_gpio_base = (superio_inb(SIO_BASE_HADDR) << 8 |
298 | | superio_inb(SIO_BASE_LADDR)); | 300 | | superio_inb(SIO_BASE_LADDR)); |
299 | 301 | ||
300 | if (!request_region(pc8736x_gpio_base, 16, DEVNAME)) { | 302 | if (!request_region(pc8736x_gpio_base, PC8736X_GPIO_RANGE, DEVNAME)) { |
301 | rc = -ENODEV; | 303 | rc = -ENODEV; |
302 | dev_err(&pdev->dev, "GPIO ioport %x busy\n", | 304 | dev_err(&pdev->dev, "GPIO ioport %x busy\n", |
303 | pc8736x_gpio_base); | 305 | pc8736x_gpio_base); |
@@ -305,10 +307,17 @@ static int __init pc8736x_gpio_init(void) | |||
305 | } | 307 | } |
306 | dev_info(&pdev->dev, "GPIO ioport %x reserved\n", pc8736x_gpio_base); | 308 | dev_info(&pdev->dev, "GPIO ioport %x reserved\n", pc8736x_gpio_base); |
307 | 309 | ||
308 | rc = register_chrdev(major, DEVNAME, &pc8736x_gpio_fops); | 310 | if (major) { |
311 | devid = MKDEV(major, 0); | ||
312 | rc = register_chrdev_region(devid, PC8736X_GPIO_CT, DEVNAME); | ||
313 | } else { | ||
314 | rc = alloc_chrdev_region(&devid, 0, PC8736X_GPIO_CT, DEVNAME); | ||
315 | major = MAJOR(devid); | ||
316 | } | ||
317 | |||
309 | if (rc < 0) { | 318 | if (rc < 0) { |
310 | dev_err(&pdev->dev, "register-chrdev failed: %d\n", rc); | 319 | dev_err(&pdev->dev, "register-chrdev failed: %d\n", rc); |
311 | goto undo_platform_dev_add; | 320 | goto undo_request_region; |
312 | } | 321 | } |
313 | if (!major) { | 322 | if (!major) { |
314 | major = rc; | 323 | major = rc; |
@@ -316,8 +325,15 @@ static int __init pc8736x_gpio_init(void) | |||
316 | } | 325 | } |
317 | 326 | ||
318 | pc8736x_init_shadow(); | 327 | pc8736x_init_shadow(); |
328 | |||
329 | /* ignore minor errs, and succeed */ | ||
330 | cdev_init(&pc8736x_gpio_cdev, &pc8736x_gpio_fileops); | ||
331 | cdev_add(&pc8736x_gpio_cdev, devid, PC8736X_GPIO_CT); | ||
332 | |||
319 | return 0; | 333 | return 0; |
320 | 334 | ||
335 | undo_request_region: | ||
336 | release_region(pc8736x_gpio_base, PC8736X_GPIO_RANGE); | ||
321 | undo_platform_dev_add: | 337 | undo_platform_dev_add: |
322 | platform_device_del(pdev); | 338 | platform_device_del(pdev); |
323 | undo_platform_dev_alloc: | 339 | undo_platform_dev_alloc: |
@@ -328,14 +344,15 @@ undo_platform_dev_alloc: | |||
328 | 344 | ||
329 | static void __exit pc8736x_gpio_cleanup(void) | 345 | static void __exit pc8736x_gpio_cleanup(void) |
330 | { | 346 | { |
331 | dev_dbg(&pdev->dev, " cleanup\n"); | 347 | dev_dbg(&pdev->dev, "cleanup\n"); |
332 | 348 | ||
333 | release_region(pc8736x_gpio_base, 16); | 349 | cdev_del(&pc8736x_gpio_cdev); |
350 | unregister_chrdev_region(MKDEV(major,0), PC8736X_GPIO_CT); | ||
351 | release_region(pc8736x_gpio_base, PC8736X_GPIO_RANGE); | ||
334 | 352 | ||
335 | unregister_chrdev(major, DEVNAME); | 353 | platform_device_del(pdev); |
354 | platform_device_put(pdev); | ||
336 | } | 355 | } |
337 | 356 | ||
338 | EXPORT_SYMBOL(pc8736x_access); | ||
339 | |||
340 | module_init(pc8736x_gpio_init); | 357 | module_init(pc8736x_gpio_init); |
341 | module_exit(pc8736x_gpio_cleanup); | 358 | module_exit(pc8736x_gpio_cleanup); |
diff --git a/drivers/char/rtc.c b/drivers/char/rtc.c index cc7bd1a3095b..6e6a7c7a7eff 100644 --- a/drivers/char/rtc.c +++ b/drivers/char/rtc.c | |||
@@ -46,13 +46,12 @@ | |||
46 | * 1.11a Daniele Bellucci: Audit create_proc_read_entry in rtc_init | 46 | * 1.11a Daniele Bellucci: Audit create_proc_read_entry in rtc_init |
47 | * 1.12 Venkatesh Pallipadi: Hooks for emulating rtc on HPET base-timer | 47 | * 1.12 Venkatesh Pallipadi: Hooks for emulating rtc on HPET base-timer |
48 | * CONFIG_HPET_EMULATE_RTC | 48 | * CONFIG_HPET_EMULATE_RTC |
49 | * 1.12a Maciej W. Rozycki: Handle memory-mapped chips properly. | ||
49 | * 1.12ac Alan Cox: Allow read access to the day of week register | 50 | * 1.12ac Alan Cox: Allow read access to the day of week register |
50 | */ | 51 | */ |
51 | 52 | ||
52 | #define RTC_VERSION "1.12ac" | 53 | #define RTC_VERSION "1.12ac" |
53 | 54 | ||
54 | #define RTC_IO_EXTENT 0x8 | ||
55 | |||
56 | /* | 55 | /* |
57 | * Note that *all* calls to CMOS_READ and CMOS_WRITE are done with | 56 | * Note that *all* calls to CMOS_READ and CMOS_WRITE are done with |
58 | * interrupts disabled. Due to the index-port/data-port (0x70/0x71) | 57 | * interrupts disabled. Due to the index-port/data-port (0x70/0x71) |
@@ -337,7 +336,15 @@ static ssize_t rtc_read(struct file *file, char __user *buf, | |||
337 | if (rtc_has_irq == 0) | 336 | if (rtc_has_irq == 0) |
338 | return -EIO; | 337 | return -EIO; |
339 | 338 | ||
340 | if (count < sizeof(unsigned)) | 339 | /* |
340 | * Historically this function used to assume that sizeof(unsigned long) | ||
341 | * is the same in userspace and kernelspace. This lead to problems | ||
342 | * for configurations with multiple ABIs such a the MIPS o32 and 64 | ||
343 | * ABIs supported on the same kernel. So now we support read of both | ||
344 | * 4 and 8 bytes and assume that's the sizeof(unsigned long) in the | ||
345 | * userspace ABI. | ||
346 | */ | ||
347 | if (count != sizeof(unsigned int) && count != sizeof(unsigned long)) | ||
341 | return -EINVAL; | 348 | return -EINVAL; |
342 | 349 | ||
343 | add_wait_queue(&rtc_wait, &wait); | 350 | add_wait_queue(&rtc_wait, &wait); |
@@ -368,10 +375,12 @@ static ssize_t rtc_read(struct file *file, char __user *buf, | |||
368 | schedule(); | 375 | schedule(); |
369 | } while (1); | 376 | } while (1); |
370 | 377 | ||
371 | if (count < sizeof(unsigned long)) | 378 | if (count == sizeof(unsigned int)) |
372 | retval = put_user(data, (unsigned int __user *)buf) ?: sizeof(int); | 379 | retval = put_user(data, (unsigned int __user *)buf) ?: sizeof(int); |
373 | else | 380 | else |
374 | retval = put_user(data, (unsigned long __user *)buf) ?: sizeof(long); | 381 | retval = put_user(data, (unsigned long __user *)buf) ?: sizeof(long); |
382 | if (!retval) | ||
383 | retval = count; | ||
375 | out: | 384 | out: |
376 | current->state = TASK_RUNNING; | 385 | current->state = TASK_RUNNING; |
377 | remove_wait_queue(&rtc_wait, &wait); | 386 | remove_wait_queue(&rtc_wait, &wait); |
@@ -923,6 +932,9 @@ static int __init rtc_init(void) | |||
923 | struct sparc_isa_device *isa_dev; | 932 | struct sparc_isa_device *isa_dev; |
924 | #endif | 933 | #endif |
925 | #endif | 934 | #endif |
935 | #ifndef __sparc__ | ||
936 | void *r; | ||
937 | #endif | ||
926 | 938 | ||
927 | #ifdef __sparc__ | 939 | #ifdef __sparc__ |
928 | for_each_ebus(ebus) { | 940 | for_each_ebus(ebus) { |
@@ -964,8 +976,13 @@ found: | |||
964 | } | 976 | } |
965 | no_irq: | 977 | no_irq: |
966 | #else | 978 | #else |
967 | if (!request_region(RTC_PORT(0), RTC_IO_EXTENT, "rtc")) { | 979 | if (RTC_IOMAPPED) |
968 | printk(KERN_ERR "rtc: I/O port %d is not free.\n", RTC_PORT (0)); | 980 | r = request_region(RTC_PORT(0), RTC_IO_EXTENT, "rtc"); |
981 | else | ||
982 | r = request_mem_region(RTC_PORT(0), RTC_IO_EXTENT, "rtc"); | ||
983 | if (!r) { | ||
984 | printk(KERN_ERR "rtc: I/O resource %lx is not free.\n", | ||
985 | (long)(RTC_PORT(0))); | ||
969 | return -EIO; | 986 | return -EIO; |
970 | } | 987 | } |
971 | 988 | ||
@@ -979,7 +996,10 @@ no_irq: | |||
979 | if(request_irq(RTC_IRQ, rtc_int_handler_ptr, IRQF_DISABLED, "rtc", NULL)) { | 996 | if(request_irq(RTC_IRQ, rtc_int_handler_ptr, IRQF_DISABLED, "rtc", NULL)) { |
980 | /* Yeah right, seeing as irq 8 doesn't even hit the bus. */ | 997 | /* Yeah right, seeing as irq 8 doesn't even hit the bus. */ |
981 | printk(KERN_ERR "rtc: IRQ %d is not free.\n", RTC_IRQ); | 998 | printk(KERN_ERR "rtc: IRQ %d is not free.\n", RTC_IRQ); |
982 | release_region(RTC_PORT(0), RTC_IO_EXTENT); | 999 | if (RTC_IOMAPPED) |
1000 | release_region(RTC_PORT(0), RTC_IO_EXTENT); | ||
1001 | else | ||
1002 | release_mem_region(RTC_PORT(0), RTC_IO_EXTENT); | ||
983 | return -EIO; | 1003 | return -EIO; |
984 | } | 1004 | } |
985 | hpet_rtc_timer_init(); | 1005 | hpet_rtc_timer_init(); |
@@ -1079,7 +1099,10 @@ static void __exit rtc_exit (void) | |||
1079 | if (rtc_has_irq) | 1099 | if (rtc_has_irq) |
1080 | free_irq (rtc_irq, &rtc_port); | 1100 | free_irq (rtc_irq, &rtc_port); |
1081 | #else | 1101 | #else |
1082 | release_region (RTC_PORT (0), RTC_IO_EXTENT); | 1102 | if (RTC_IOMAPPED) |
1103 | release_region(RTC_PORT(0), RTC_IO_EXTENT); | ||
1104 | else | ||
1105 | release_mem_region(RTC_PORT(0), RTC_IO_EXTENT); | ||
1083 | #ifdef RTC_IRQ | 1106 | #ifdef RTC_IRQ |
1084 | if (rtc_has_irq) | 1107 | if (rtc_has_irq) |
1085 | free_irq (RTC_IRQ, NULL); | 1108 | free_irq (RTC_IRQ, NULL); |
@@ -1222,7 +1245,7 @@ static int rtc_proc_open(struct inode *inode, struct file *file) | |||
1222 | 1245 | ||
1223 | void rtc_get_rtc_time(struct rtc_time *rtc_tm) | 1246 | void rtc_get_rtc_time(struct rtc_time *rtc_tm) |
1224 | { | 1247 | { |
1225 | unsigned long uip_watchdog = jiffies; | 1248 | unsigned long uip_watchdog = jiffies, flags; |
1226 | unsigned char ctrl; | 1249 | unsigned char ctrl; |
1227 | #ifdef CONFIG_MACH_DECSTATION | 1250 | #ifdef CONFIG_MACH_DECSTATION |
1228 | unsigned int real_year; | 1251 | unsigned int real_year; |
@@ -1249,7 +1272,7 @@ void rtc_get_rtc_time(struct rtc_time *rtc_tm) | |||
1249 | * RTC has RTC_DAY_OF_WEEK, we should usually ignore it, as it is | 1272 | * RTC has RTC_DAY_OF_WEEK, we should usually ignore it, as it is |
1250 | * only updated by the RTC when initially set to a non-zero value. | 1273 | * only updated by the RTC when initially set to a non-zero value. |
1251 | */ | 1274 | */ |
1252 | spin_lock_irq(&rtc_lock); | 1275 | spin_lock_irqsave(&rtc_lock, flags); |
1253 | rtc_tm->tm_sec = CMOS_READ(RTC_SECONDS); | 1276 | rtc_tm->tm_sec = CMOS_READ(RTC_SECONDS); |
1254 | rtc_tm->tm_min = CMOS_READ(RTC_MINUTES); | 1277 | rtc_tm->tm_min = CMOS_READ(RTC_MINUTES); |
1255 | rtc_tm->tm_hour = CMOS_READ(RTC_HOURS); | 1278 | rtc_tm->tm_hour = CMOS_READ(RTC_HOURS); |
@@ -1263,7 +1286,7 @@ void rtc_get_rtc_time(struct rtc_time *rtc_tm) | |||
1263 | real_year = CMOS_READ(RTC_DEC_YEAR); | 1286 | real_year = CMOS_READ(RTC_DEC_YEAR); |
1264 | #endif | 1287 | #endif |
1265 | ctrl = CMOS_READ(RTC_CONTROL); | 1288 | ctrl = CMOS_READ(RTC_CONTROL); |
1266 | spin_unlock_irq(&rtc_lock); | 1289 | spin_unlock_irqrestore(&rtc_lock, flags); |
1267 | 1290 | ||
1268 | if (!(ctrl & RTC_DM_BINARY) || RTC_ALWAYS_BCD) | 1291 | if (!(ctrl & RTC_DM_BINARY) || RTC_ALWAYS_BCD) |
1269 | { | 1292 | { |
diff --git a/drivers/char/scx200_gpio.c b/drivers/char/scx200_gpio.c index 425c58719db6..b956c7babd18 100644 --- a/drivers/char/scx200_gpio.c +++ b/drivers/char/scx200_gpio.c | |||
@@ -5,7 +5,6 @@ | |||
5 | 5 | ||
6 | Copyright (c) 2001,2002 Christer Weinigel <wingel@nano-system.com> */ | 6 | Copyright (c) 2001,2002 Christer Weinigel <wingel@nano-system.com> */ |
7 | 7 | ||
8 | #include <linux/config.h> | ||
9 | #include <linux/device.h> | 8 | #include <linux/device.h> |
10 | #include <linux/fs.h> | 9 | #include <linux/fs.h> |
11 | #include <linux/module.h> | 10 | #include <linux/module.h> |
@@ -22,37 +21,37 @@ | |||
22 | #include <linux/scx200_gpio.h> | 21 | #include <linux/scx200_gpio.h> |
23 | #include <linux/nsc_gpio.h> | 22 | #include <linux/nsc_gpio.h> |
24 | 23 | ||
25 | #define NAME "scx200_gpio" | 24 | #define DRVNAME "scx200_gpio" |
26 | #define DEVNAME NAME | ||
27 | 25 | ||
28 | static struct platform_device *pdev; | 26 | static struct platform_device *pdev; |
29 | 27 | ||
30 | MODULE_AUTHOR("Christer Weinigel <wingel@nano-system.com>"); | 28 | MODULE_AUTHOR("Christer Weinigel <wingel@nano-system.com>"); |
31 | MODULE_DESCRIPTION("NatSemi SCx200 GPIO Pin Driver"); | 29 | MODULE_DESCRIPTION("NatSemi/AMD SCx200 GPIO Pin Driver"); |
32 | MODULE_LICENSE("GPL"); | 30 | MODULE_LICENSE("GPL"); |
33 | 31 | ||
34 | static int major = 0; /* default to dynamic major */ | 32 | static int major = 0; /* default to dynamic major */ |
35 | module_param(major, int, 0); | 33 | module_param(major, int, 0); |
36 | MODULE_PARM_DESC(major, "Major device number"); | 34 | MODULE_PARM_DESC(major, "Major device number"); |
37 | 35 | ||
38 | struct nsc_gpio_ops scx200_access = { | 36 | #define MAX_PINS 32 /* 64 later, when known ok */ |
37 | |||
38 | struct nsc_gpio_ops scx200_gpio_ops = { | ||
39 | .owner = THIS_MODULE, | 39 | .owner = THIS_MODULE, |
40 | .gpio_config = scx200_gpio_configure, | 40 | .gpio_config = scx200_gpio_configure, |
41 | .gpio_dump = nsc_gpio_dump, | 41 | .gpio_dump = nsc_gpio_dump, |
42 | .gpio_get = scx200_gpio_get, | 42 | .gpio_get = scx200_gpio_get, |
43 | .gpio_set = scx200_gpio_set, | 43 | .gpio_set = scx200_gpio_set, |
44 | .gpio_set_high = scx200_gpio_set_high, | ||
45 | .gpio_set_low = scx200_gpio_set_low, | ||
46 | .gpio_change = scx200_gpio_change, | 44 | .gpio_change = scx200_gpio_change, |
47 | .gpio_current = scx200_gpio_current | 45 | .gpio_current = scx200_gpio_current |
48 | }; | 46 | }; |
47 | EXPORT_SYMBOL(scx200_gpio_ops); | ||
49 | 48 | ||
50 | static int scx200_gpio_open(struct inode *inode, struct file *file) | 49 | static int scx200_gpio_open(struct inode *inode, struct file *file) |
51 | { | 50 | { |
52 | unsigned m = iminor(inode); | 51 | unsigned m = iminor(inode); |
53 | file->private_data = &scx200_access; | 52 | file->private_data = &scx200_gpio_ops; |
54 | 53 | ||
55 | if (m > 63) | 54 | if (m >= MAX_PINS) |
56 | return -EINVAL; | 55 | return -EINVAL; |
57 | return nonseekable_open(inode, file); | 56 | return nonseekable_open(inode, file); |
58 | } | 57 | } |
@@ -62,8 +61,7 @@ static int scx200_gpio_release(struct inode *inode, struct file *file) | |||
62 | return 0; | 61 | return 0; |
63 | } | 62 | } |
64 | 63 | ||
65 | 64 | static const struct file_operations scx200_gpio_fileops = { | |
66 | static const struct file_operations scx200_gpio_fops = { | ||
67 | .owner = THIS_MODULE, | 65 | .owner = THIS_MODULE, |
68 | .write = nsc_gpio_write, | 66 | .write = nsc_gpio_write, |
69 | .read = nsc_gpio_read, | 67 | .read = nsc_gpio_read, |
@@ -71,21 +69,20 @@ static const struct file_operations scx200_gpio_fops = { | |||
71 | .release = scx200_gpio_release, | 69 | .release = scx200_gpio_release, |
72 | }; | 70 | }; |
73 | 71 | ||
74 | struct cdev *scx200_devices; | 72 | struct cdev scx200_gpio_cdev; /* use 1 cdev for all pins */ |
75 | static int num_pins = 32; | ||
76 | 73 | ||
77 | static int __init scx200_gpio_init(void) | 74 | static int __init scx200_gpio_init(void) |
78 | { | 75 | { |
79 | int rc, i; | 76 | int rc; |
80 | dev_t dev = MKDEV(major, 0); | 77 | dev_t devid; |
81 | 78 | ||
82 | if (!scx200_gpio_present()) { | 79 | if (!scx200_gpio_present()) { |
83 | printk(KERN_ERR NAME ": no SCx200 gpio present\n"); | 80 | printk(KERN_ERR DRVNAME ": no SCx200 gpio present\n"); |
84 | return -ENODEV; | 81 | return -ENODEV; |
85 | } | 82 | } |
86 | 83 | ||
87 | /* support dev_dbg() with pdev->dev */ | 84 | /* support dev_dbg() with pdev->dev */ |
88 | pdev = platform_device_alloc(DEVNAME, 0); | 85 | pdev = platform_device_alloc(DRVNAME, 0); |
89 | if (!pdev) | 86 | if (!pdev) |
90 | return -ENOMEM; | 87 | return -ENOMEM; |
91 | 88 | ||
@@ -94,37 +91,25 @@ static int __init scx200_gpio_init(void) | |||
94 | goto undo_malloc; | 91 | goto undo_malloc; |
95 | 92 | ||
96 | /* nsc_gpio uses dev_dbg(), so needs this */ | 93 | /* nsc_gpio uses dev_dbg(), so needs this */ |
97 | scx200_access.dev = &pdev->dev; | 94 | scx200_gpio_ops.dev = &pdev->dev; |
98 | 95 | ||
99 | if (major) | 96 | if (major) { |
100 | rc = register_chrdev_region(dev, num_pins, "scx200_gpio"); | 97 | devid = MKDEV(major, 0); |
101 | else { | 98 | rc = register_chrdev_region(devid, MAX_PINS, "scx200_gpio"); |
102 | rc = alloc_chrdev_region(&dev, 0, num_pins, "scx200_gpio"); | 99 | } else { |
103 | major = MAJOR(dev); | 100 | rc = alloc_chrdev_region(&devid, 0, MAX_PINS, "scx200_gpio"); |
101 | major = MAJOR(devid); | ||
104 | } | 102 | } |
105 | if (rc < 0) { | 103 | if (rc < 0) { |
106 | dev_err(&pdev->dev, "SCx200 chrdev_region err: %d\n", rc); | 104 | dev_err(&pdev->dev, "SCx200 chrdev_region err: %d\n", rc); |
107 | goto undo_platform_device_add; | 105 | goto undo_platform_device_add; |
108 | } | 106 | } |
109 | scx200_devices = kzalloc(num_pins * sizeof(struct cdev), GFP_KERNEL); | 107 | |
110 | if (!scx200_devices) { | 108 | cdev_init(&scx200_gpio_cdev, &scx200_gpio_fileops); |
111 | rc = -ENOMEM; | 109 | cdev_add(&scx200_gpio_cdev, devid, MAX_PINS); |
112 | goto undo_chrdev_region; | ||
113 | } | ||
114 | for (i = 0; i < num_pins; i++) { | ||
115 | struct cdev *cdev = &scx200_devices[i]; | ||
116 | cdev_init(cdev, &scx200_gpio_fops); | ||
117 | cdev->owner = THIS_MODULE; | ||
118 | rc = cdev_add(cdev, MKDEV(major, i), 1); | ||
119 | /* tolerate 'minor' errors */ | ||
120 | if (rc) | ||
121 | dev_err(&pdev->dev, "Error %d on minor %d", rc, i); | ||
122 | } | ||
123 | 110 | ||
124 | return 0; /* succeed */ | 111 | return 0; /* succeed */ |
125 | 112 | ||
126 | undo_chrdev_region: | ||
127 | unregister_chrdev_region(dev, num_pins); | ||
128 | undo_platform_device_add: | 113 | undo_platform_device_add: |
129 | platform_device_del(pdev); | 114 | platform_device_del(pdev); |
130 | undo_malloc: | 115 | undo_malloc: |
@@ -135,10 +120,11 @@ undo_malloc: | |||
135 | 120 | ||
136 | static void __exit scx200_gpio_cleanup(void) | 121 | static void __exit scx200_gpio_cleanup(void) |
137 | { | 122 | { |
138 | kfree(scx200_devices); | 123 | cdev_del(&scx200_gpio_cdev); |
139 | unregister_chrdev_region(MKDEV(major, 0), num_pins); | 124 | /* cdev_put(&scx200_gpio_cdev); */ |
125 | |||
126 | unregister_chrdev_region(MKDEV(major, 0), MAX_PINS); | ||
140 | platform_device_unregister(pdev); | 127 | platform_device_unregister(pdev); |
141 | /* kfree(pdev); */ | ||
142 | } | 128 | } |
143 | 129 | ||
144 | module_init(scx200_gpio_init); | 130 | module_init(scx200_gpio_init); |
diff --git a/drivers/char/snsc_event.c b/drivers/char/snsc_event.c index 8b2210b633df..d12d4f629cec 100644 --- a/drivers/char/snsc_event.c +++ b/drivers/char/snsc_event.c | |||
@@ -220,20 +220,7 @@ scdrv_dispatch_event(char *event, int len) | |||
220 | " Sending SIGPWR to init...\n"); | 220 | " Sending SIGPWR to init...\n"); |
221 | 221 | ||
222 | /* give a SIGPWR signal to init proc */ | 222 | /* give a SIGPWR signal to init proc */ |
223 | 223 | kill_proc(1, SIGPWR, 0); | |
224 | /* first find init's task */ | ||
225 | read_lock(&tasklist_lock); | ||
226 | for_each_process(p) { | ||
227 | if (p->pid == 1) | ||
228 | break; | ||
229 | } | ||
230 | if (p) { | ||
231 | force_sig(SIGPWR, p); | ||
232 | } else { | ||
233 | printk(KERN_ERR "Failed to signal init!\n"); | ||
234 | snsc_shutting_down = 0; /* so can try again (?) */ | ||
235 | } | ||
236 | read_unlock(&tasklist_lock); | ||
237 | } else { | 224 | } else { |
238 | /* print to system log */ | 225 | /* print to system log */ |
239 | printk("%s|$(0x%x)%s\n", severity, esp_code, desc); | 226 | printk("%s|$(0x%x)%s\n", severity, esp_code, desc); |
diff --git a/drivers/char/specialix.c b/drivers/char/specialix.c index cb2859249d49..a1d303f9a33d 100644 --- a/drivers/char/specialix.c +++ b/drivers/char/specialix.c | |||
@@ -2584,6 +2584,12 @@ static void __exit specialix_exit_module(void) | |||
2584 | func_exit(); | 2584 | func_exit(); |
2585 | } | 2585 | } |
2586 | 2586 | ||
2587 | static struct pci_device_id specialx_pci_tbl[] __devinitdata = { | ||
2588 | { PCI_DEVICE(PCI_VENDOR_ID_SPECIALIX, PCI_DEVICE_ID_SPECIALIX_IO8) }, | ||
2589 | { } | ||
2590 | }; | ||
2591 | MODULE_DEVICE_TABLE(pci, specialx_pci_tbl); | ||
2592 | |||
2587 | module_init(specialix_init_module); | 2593 | module_init(specialix_init_module); |
2588 | module_exit(specialix_exit_module); | 2594 | module_exit(specialix_exit_module); |
2589 | 2595 | ||
diff --git a/drivers/char/tpm/tpm.c b/drivers/char/tpm/tpm.c index 6889e7db3aff..a082a2e34252 100644 --- a/drivers/char/tpm/tpm.c +++ b/drivers/char/tpm/tpm.c | |||
@@ -1141,6 +1141,7 @@ struct tpm_chip *tpm_register_hardware(struct device *dev, const struct tpm_vend | |||
1141 | put_device(dev); | 1141 | put_device(dev); |
1142 | clear_bit(chip->dev_num, dev_mask); | 1142 | clear_bit(chip->dev_num, dev_mask); |
1143 | kfree(chip); | 1143 | kfree(chip); |
1144 | kfree(devname); | ||
1144 | return NULL; | 1145 | return NULL; |
1145 | } | 1146 | } |
1146 | 1147 | ||
diff --git a/drivers/char/tpm/tpm_tis.c b/drivers/char/tpm/tpm_tis.c index 3232b1932597..ee7ac6f43c65 100644 --- a/drivers/char/tpm/tpm_tis.c +++ b/drivers/char/tpm/tpm_tis.c | |||
@@ -424,6 +424,7 @@ static irqreturn_t tis_int_handler(int irq, void *dev_id, struct pt_regs *regs) | |||
424 | iowrite32(interrupt, | 424 | iowrite32(interrupt, |
425 | chip->vendor.iobase + | 425 | chip->vendor.iobase + |
426 | TPM_INT_STATUS(chip->vendor.locality)); | 426 | TPM_INT_STATUS(chip->vendor.locality)); |
427 | ioread32(chip->vendor.iobase + TPM_INT_STATUS(chip->vendor.locality)); | ||
427 | return IRQ_HANDLED; | 428 | return IRQ_HANDLED; |
428 | } | 429 | } |
429 | 430 | ||
@@ -431,23 +432,19 @@ static int interrupts = 1; | |||
431 | module_param(interrupts, bool, 0444); | 432 | module_param(interrupts, bool, 0444); |
432 | MODULE_PARM_DESC(interrupts, "Enable interrupts"); | 433 | MODULE_PARM_DESC(interrupts, "Enable interrupts"); |
433 | 434 | ||
434 | static int __devinit tpm_tis_pnp_init(struct pnp_dev *pnp_dev, | 435 | static int tpm_tis_init(struct device *dev, resource_size_t start, |
435 | const struct pnp_device_id *pnp_id) | 436 | resource_size_t len) |
436 | { | 437 | { |
437 | u32 vendor, intfcaps, intmask; | 438 | u32 vendor, intfcaps, intmask; |
438 | int rc, i; | 439 | int rc, i; |
439 | unsigned long start, len; | ||
440 | struct tpm_chip *chip; | 440 | struct tpm_chip *chip; |
441 | 441 | ||
442 | start = pnp_mem_start(pnp_dev, 0); | ||
443 | len = pnp_mem_len(pnp_dev, 0); | ||
444 | |||
445 | if (!start) | 442 | if (!start) |
446 | start = TIS_MEM_BASE; | 443 | start = TIS_MEM_BASE; |
447 | if (!len) | 444 | if (!len) |
448 | len = TIS_MEM_LEN; | 445 | len = TIS_MEM_LEN; |
449 | 446 | ||
450 | if (!(chip = tpm_register_hardware(&pnp_dev->dev, &tpm_tis))) | 447 | if (!(chip = tpm_register_hardware(dev, &tpm_tis))) |
451 | return -ENODEV; | 448 | return -ENODEV; |
452 | 449 | ||
453 | chip->vendor.iobase = ioremap(start, len); | 450 | chip->vendor.iobase = ioremap(start, len); |
@@ -464,7 +461,7 @@ static int __devinit tpm_tis_pnp_init(struct pnp_dev *pnp_dev, | |||
464 | chip->vendor.timeout_c = msecs_to_jiffies(TIS_SHORT_TIMEOUT); | 461 | chip->vendor.timeout_c = msecs_to_jiffies(TIS_SHORT_TIMEOUT); |
465 | chip->vendor.timeout_d = msecs_to_jiffies(TIS_SHORT_TIMEOUT); | 462 | chip->vendor.timeout_d = msecs_to_jiffies(TIS_SHORT_TIMEOUT); |
466 | 463 | ||
467 | dev_info(&pnp_dev->dev, | 464 | dev_info(dev, |
468 | "1.2 TPM (device-id 0x%X, rev-id %d)\n", | 465 | "1.2 TPM (device-id 0x%X, rev-id %d)\n", |
469 | vendor >> 16, ioread8(chip->vendor.iobase + TPM_RID(0))); | 466 | vendor >> 16, ioread8(chip->vendor.iobase + TPM_RID(0))); |
470 | 467 | ||
@@ -472,26 +469,26 @@ static int __devinit tpm_tis_pnp_init(struct pnp_dev *pnp_dev, | |||
472 | intfcaps = | 469 | intfcaps = |
473 | ioread32(chip->vendor.iobase + | 470 | ioread32(chip->vendor.iobase + |
474 | TPM_INTF_CAPS(chip->vendor.locality)); | 471 | TPM_INTF_CAPS(chip->vendor.locality)); |
475 | dev_dbg(&pnp_dev->dev, "TPM interface capabilities (0x%x):\n", | 472 | dev_dbg(dev, "TPM interface capabilities (0x%x):\n", |
476 | intfcaps); | 473 | intfcaps); |
477 | if (intfcaps & TPM_INTF_BURST_COUNT_STATIC) | 474 | if (intfcaps & TPM_INTF_BURST_COUNT_STATIC) |
478 | dev_dbg(&pnp_dev->dev, "\tBurst Count Static\n"); | 475 | dev_dbg(dev, "\tBurst Count Static\n"); |
479 | if (intfcaps & TPM_INTF_CMD_READY_INT) | 476 | if (intfcaps & TPM_INTF_CMD_READY_INT) |
480 | dev_dbg(&pnp_dev->dev, "\tCommand Ready Int Support\n"); | 477 | dev_dbg(dev, "\tCommand Ready Int Support\n"); |
481 | if (intfcaps & TPM_INTF_INT_EDGE_FALLING) | 478 | if (intfcaps & TPM_INTF_INT_EDGE_FALLING) |
482 | dev_dbg(&pnp_dev->dev, "\tInterrupt Edge Falling\n"); | 479 | dev_dbg(dev, "\tInterrupt Edge Falling\n"); |
483 | if (intfcaps & TPM_INTF_INT_EDGE_RISING) | 480 | if (intfcaps & TPM_INTF_INT_EDGE_RISING) |
484 | dev_dbg(&pnp_dev->dev, "\tInterrupt Edge Rising\n"); | 481 | dev_dbg(dev, "\tInterrupt Edge Rising\n"); |
485 | if (intfcaps & TPM_INTF_INT_LEVEL_LOW) | 482 | if (intfcaps & TPM_INTF_INT_LEVEL_LOW) |
486 | dev_dbg(&pnp_dev->dev, "\tInterrupt Level Low\n"); | 483 | dev_dbg(dev, "\tInterrupt Level Low\n"); |
487 | if (intfcaps & TPM_INTF_INT_LEVEL_HIGH) | 484 | if (intfcaps & TPM_INTF_INT_LEVEL_HIGH) |
488 | dev_dbg(&pnp_dev->dev, "\tInterrupt Level High\n"); | 485 | dev_dbg(dev, "\tInterrupt Level High\n"); |
489 | if (intfcaps & TPM_INTF_LOCALITY_CHANGE_INT) | 486 | if (intfcaps & TPM_INTF_LOCALITY_CHANGE_INT) |
490 | dev_dbg(&pnp_dev->dev, "\tLocality Change Int Support\n"); | 487 | dev_dbg(dev, "\tLocality Change Int Support\n"); |
491 | if (intfcaps & TPM_INTF_STS_VALID_INT) | 488 | if (intfcaps & TPM_INTF_STS_VALID_INT) |
492 | dev_dbg(&pnp_dev->dev, "\tSts Valid Int Support\n"); | 489 | dev_dbg(dev, "\tSts Valid Int Support\n"); |
493 | if (intfcaps & TPM_INTF_DATA_AVAIL_INT) | 490 | if (intfcaps & TPM_INTF_DATA_AVAIL_INT) |
494 | dev_dbg(&pnp_dev->dev, "\tData Avail Int Support\n"); | 491 | dev_dbg(dev, "\tData Avail Int Support\n"); |
495 | 492 | ||
496 | if (request_locality(chip, 0) != 0) { | 493 | if (request_locality(chip, 0) != 0) { |
497 | rc = -ENODEV; | 494 | rc = -ENODEV; |
@@ -594,6 +591,16 @@ out_err: | |||
594 | return rc; | 591 | return rc; |
595 | } | 592 | } |
596 | 593 | ||
594 | static int __devinit tpm_tis_pnp_init(struct pnp_dev *pnp_dev, | ||
595 | const struct pnp_device_id *pnp_id) | ||
596 | { | ||
597 | resource_size_t start, len; | ||
598 | start = pnp_mem_start(pnp_dev, 0); | ||
599 | len = pnp_mem_len(pnp_dev, 0); | ||
600 | |||
601 | return tpm_tis_init(&pnp_dev->dev, start, len); | ||
602 | } | ||
603 | |||
597 | static int tpm_tis_pnp_suspend(struct pnp_dev *dev, pm_message_t msg) | 604 | static int tpm_tis_pnp_suspend(struct pnp_dev *dev, pm_message_t msg) |
598 | { | 605 | { |
599 | return tpm_pm_suspend(&dev->dev, msg); | 606 | return tpm_pm_suspend(&dev->dev, msg); |
@@ -628,8 +635,36 @@ module_param_string(hid, tpm_pnp_tbl[TIS_HID_USR_IDX].id, | |||
628 | sizeof(tpm_pnp_tbl[TIS_HID_USR_IDX].id), 0444); | 635 | sizeof(tpm_pnp_tbl[TIS_HID_USR_IDX].id), 0444); |
629 | MODULE_PARM_DESC(hid, "Set additional specific HID for this driver to probe"); | 636 | MODULE_PARM_DESC(hid, "Set additional specific HID for this driver to probe"); |
630 | 637 | ||
638 | static struct device_driver tis_drv = { | ||
639 | .name = "tpm_tis", | ||
640 | .bus = &platform_bus_type, | ||
641 | .owner = THIS_MODULE, | ||
642 | .suspend = tpm_pm_suspend, | ||
643 | .resume = tpm_pm_resume, | ||
644 | }; | ||
645 | |||
646 | static struct platform_device *pdev; | ||
647 | |||
648 | static int force; | ||
649 | module_param(force, bool, 0444); | ||
650 | MODULE_PARM_DESC(force, "Force device probe rather than using ACPI entry"); | ||
631 | static int __init init_tis(void) | 651 | static int __init init_tis(void) |
632 | { | 652 | { |
653 | int rc; | ||
654 | |||
655 | if (force) { | ||
656 | rc = driver_register(&tis_drv); | ||
657 | if (rc < 0) | ||
658 | return rc; | ||
659 | if (IS_ERR(pdev=platform_device_register_simple("tpm_tis", -1, NULL, 0))) | ||
660 | return PTR_ERR(pdev); | ||
661 | if((rc=tpm_tis_init(&pdev->dev, 0, 0)) != 0) { | ||
662 | platform_device_unregister(pdev); | ||
663 | driver_unregister(&tis_drv); | ||
664 | } | ||
665 | return rc; | ||
666 | } | ||
667 | |||
633 | return pnp_register_driver(&tis_pnp_driver); | 668 | return pnp_register_driver(&tis_pnp_driver); |
634 | } | 669 | } |
635 | 670 | ||
@@ -654,7 +689,11 @@ static void __exit cleanup_tis(void) | |||
654 | tpm_remove_hardware(chip->dev); | 689 | tpm_remove_hardware(chip->dev); |
655 | } | 690 | } |
656 | spin_unlock(&tis_lock); | 691 | spin_unlock(&tis_lock); |
657 | pnp_unregister_driver(&tis_pnp_driver); | 692 | if (force) { |
693 | platform_device_unregister(pdev); | ||
694 | driver_unregister(&tis_drv); | ||
695 | } else | ||
696 | pnp_unregister_driver(&tis_pnp_driver); | ||
658 | } | 697 | } |
659 | 698 | ||
660 | module_init(init_tis); | 699 | module_init(init_tis); |
diff --git a/drivers/char/vr41xx_giu.c b/drivers/char/vr41xx_giu.c index 1b9b1f1d4c49..8116a47b80f4 100644 --- a/drivers/char/vr41xx_giu.c +++ b/drivers/char/vr41xx_giu.c | |||
@@ -33,6 +33,7 @@ | |||
33 | #include <asm/cpu.h> | 33 | #include <asm/cpu.h> |
34 | #include <asm/io.h> | 34 | #include <asm/io.h> |
35 | #include <asm/vr41xx/giu.h> | 35 | #include <asm/vr41xx/giu.h> |
36 | #include <asm/vr41xx/irq.h> | ||
36 | #include <asm/vr41xx/vr41xx.h> | 37 | #include <asm/vr41xx/vr41xx.h> |
37 | 38 | ||
38 | MODULE_AUTHOR("Yoichi Yuasa <yoichi_yuasa@tripeaks.co.jp>"); | 39 | MODULE_AUTHOR("Yoichi Yuasa <yoichi_yuasa@tripeaks.co.jp>"); |
diff --git a/drivers/cpufreq/cpufreq.c b/drivers/cpufreq/cpufreq.c index 1ba4039777e8..8d328186f774 100644 --- a/drivers/cpufreq/cpufreq.c +++ b/drivers/cpufreq/cpufreq.c | |||
@@ -423,6 +423,8 @@ static ssize_t store_scaling_governor (struct cpufreq_policy * policy, | |||
423 | if (cpufreq_parse_governor(str_governor, &new_policy.policy, &new_policy.governor)) | 423 | if (cpufreq_parse_governor(str_governor, &new_policy.policy, &new_policy.governor)) |
424 | return -EINVAL; | 424 | return -EINVAL; |
425 | 425 | ||
426 | lock_cpu_hotplug(); | ||
427 | |||
426 | /* Do not use cpufreq_set_policy here or the user_policy.max | 428 | /* Do not use cpufreq_set_policy here or the user_policy.max |
427 | will be wrongly overridden */ | 429 | will be wrongly overridden */ |
428 | mutex_lock(&policy->lock); | 430 | mutex_lock(&policy->lock); |
@@ -432,6 +434,8 @@ static ssize_t store_scaling_governor (struct cpufreq_policy * policy, | |||
432 | policy->user_policy.governor = policy->governor; | 434 | policy->user_policy.governor = policy->governor; |
433 | mutex_unlock(&policy->lock); | 435 | mutex_unlock(&policy->lock); |
434 | 436 | ||
437 | unlock_cpu_hotplug(); | ||
438 | |||
435 | return ret ? ret : count; | 439 | return ret ? ret : count; |
436 | } | 440 | } |
437 | 441 | ||
diff --git a/drivers/crypto/padlock-aes.c b/drivers/crypto/padlock-aes.c index 17ee684144f9..b643d71298a9 100644 --- a/drivers/crypto/padlock-aes.c +++ b/drivers/crypto/padlock-aes.c | |||
@@ -59,6 +59,9 @@ | |||
59 | #define AES_EXTENDED_KEY_SIZE 64 /* in uint32_t units */ | 59 | #define AES_EXTENDED_KEY_SIZE 64 /* in uint32_t units */ |
60 | #define AES_EXTENDED_KEY_SIZE_B (AES_EXTENDED_KEY_SIZE * sizeof(uint32_t)) | 60 | #define AES_EXTENDED_KEY_SIZE_B (AES_EXTENDED_KEY_SIZE * sizeof(uint32_t)) |
61 | 61 | ||
62 | /* Whenever making any changes to the following | ||
63 | * structure *make sure* you keep E, d_data | ||
64 | * and cword aligned on 16 Bytes boundaries!!! */ | ||
62 | struct aes_ctx { | 65 | struct aes_ctx { |
63 | struct { | 66 | struct { |
64 | struct cword encrypt; | 67 | struct cword encrypt; |
@@ -66,8 +69,10 @@ struct aes_ctx { | |||
66 | } cword; | 69 | } cword; |
67 | u32 *D; | 70 | u32 *D; |
68 | int key_length; | 71 | int key_length; |
69 | u32 E[AES_EXTENDED_KEY_SIZE]; | 72 | u32 E[AES_EXTENDED_KEY_SIZE] |
70 | u32 d_data[AES_EXTENDED_KEY_SIZE]; | 73 | __attribute__ ((__aligned__(PADLOCK_ALIGNMENT))); |
74 | u32 d_data[AES_EXTENDED_KEY_SIZE] | ||
75 | __attribute__ ((__aligned__(PADLOCK_ALIGNMENT))); | ||
71 | }; | 76 | }; |
72 | 77 | ||
73 | /* ====== Key management routines ====== */ | 78 | /* ====== Key management routines ====== */ |
diff --git a/drivers/edac/edac_mc.c b/drivers/edac/edac_mc.c index 3a7cfe88b169..4bde30bb3be7 100644 --- a/drivers/edac/edac_mc.c +++ b/drivers/edac/edac_mc.c | |||
@@ -1,6 +1,6 @@ | |||
1 | /* | 1 | /* |
2 | * edac_mc kernel module | 2 | * edac_mc kernel module |
3 | * (C) 2005 Linux Networx (http://lnxi.com) | 3 | * (C) 2005, 2006 Linux Networx (http://lnxi.com) |
4 | * This file may be distributed under the terms of the | 4 | * This file may be distributed under the terms of the |
5 | * GNU General Public License. | 5 | * GNU General Public License. |
6 | * | 6 | * |
@@ -33,13 +33,8 @@ | |||
33 | #include <asm/edac.h> | 33 | #include <asm/edac.h> |
34 | #include "edac_mc.h" | 34 | #include "edac_mc.h" |
35 | 35 | ||
36 | #define EDAC_MC_VERSION "Ver: 2.0.0 " __DATE__ | 36 | #define EDAC_MC_VERSION "Ver: 2.0.1 " __DATE__ |
37 | 37 | ||
38 | /* For now, disable the EDAC sysfs code. The sysfs interface that EDAC | ||
39 | * presents to user space needs more thought, and is likely to change | ||
40 | * substantially. | ||
41 | */ | ||
42 | #define DISABLE_EDAC_SYSFS | ||
43 | 38 | ||
44 | #ifdef CONFIG_EDAC_DEBUG | 39 | #ifdef CONFIG_EDAC_DEBUG |
45 | /* Values of 0 to 4 will generate output */ | 40 | /* Values of 0 to 4 will generate output */ |
@@ -64,31 +59,12 @@ static int check_pci_parity = 0; /* default YES check PCI parity */ | |||
64 | static int panic_on_pci_parity; /* default no panic on PCI Parity */ | 59 | static int panic_on_pci_parity; /* default no panic on PCI Parity */ |
65 | static atomic_t pci_parity_count = ATOMIC_INIT(0); | 60 | static atomic_t pci_parity_count = ATOMIC_INIT(0); |
66 | 61 | ||
67 | /* Structure of the whitelist and blacklist arrays */ | ||
68 | struct edac_pci_device_list { | ||
69 | unsigned int vendor; /* Vendor ID */ | ||
70 | unsigned int device; /* Deviice ID */ | ||
71 | }; | ||
72 | |||
73 | #define MAX_LISTED_PCI_DEVICES 32 | ||
74 | |||
75 | /* List of PCI devices (vendor-id:device-id) that should be skipped */ | ||
76 | static struct edac_pci_device_list pci_blacklist[MAX_LISTED_PCI_DEVICES]; | ||
77 | static int pci_blacklist_count; | ||
78 | |||
79 | /* List of PCI devices (vendor-id:device-id) that should be scanned */ | ||
80 | static struct edac_pci_device_list pci_whitelist[MAX_LISTED_PCI_DEVICES]; | ||
81 | static int pci_whitelist_count ; | ||
82 | |||
83 | #ifndef DISABLE_EDAC_SYSFS | ||
84 | static struct kobject edac_pci_kobj; /* /sys/devices/system/edac/pci */ | 62 | static struct kobject edac_pci_kobj; /* /sys/devices/system/edac/pci */ |
85 | static struct completion edac_pci_kobj_complete; | 63 | static struct completion edac_pci_kobj_complete; |
86 | #endif /* DISABLE_EDAC_SYSFS */ | ||
87 | #endif /* CONFIG_PCI */ | 64 | #endif /* CONFIG_PCI */ |
88 | 65 | ||
89 | /* START sysfs data and methods */ | 66 | /* START sysfs data and methods */ |
90 | 67 | ||
91 | #ifndef DISABLE_EDAC_SYSFS | ||
92 | 68 | ||
93 | static const char *mem_types[] = { | 69 | static const char *mem_types[] = { |
94 | [MEM_EMPTY] = "Empty", | 70 | [MEM_EMPTY] = "Empty", |
@@ -147,18 +123,10 @@ static struct completion edac_memctrl_kobj_complete; | |||
147 | * /sys/devices/system/edac/mc; | 123 | * /sys/devices/system/edac/mc; |
148 | * data structures and methods | 124 | * data structures and methods |
149 | */ | 125 | */ |
150 | #if 0 | ||
151 | static ssize_t memctrl_string_show(void *ptr, char *buffer) | ||
152 | { | ||
153 | char *value = (char*) ptr; | ||
154 | return sprintf(buffer, "%s\n", value); | ||
155 | } | ||
156 | #endif | ||
157 | |||
158 | static ssize_t memctrl_int_show(void *ptr, char *buffer) | 126 | static ssize_t memctrl_int_show(void *ptr, char *buffer) |
159 | { | 127 | { |
160 | int *value = (int*) ptr; | 128 | int *value = (int*) ptr; |
161 | return sprintf(buffer, "%d\n", *value); | 129 | return sprintf(buffer, "%u\n", *value); |
162 | } | 130 | } |
163 | 131 | ||
164 | static ssize_t memctrl_int_store(void *ptr, const char *buffer, size_t count) | 132 | static ssize_t memctrl_int_store(void *ptr, const char *buffer, size_t count) |
@@ -224,11 +192,6 @@ struct memctrl_dev_attribute attr_##_name = { \ | |||
224 | .store = _store, \ | 192 | .store = _store, \ |
225 | }; | 193 | }; |
226 | 194 | ||
227 | /* cwrow<id> attribute f*/ | ||
228 | #if 0 | ||
229 | MEMCTRL_STRING_ATTR(mc_version,EDAC_MC_VERSION,S_IRUGO,memctrl_string_show,NULL); | ||
230 | #endif | ||
231 | |||
232 | /* csrow<id> control files */ | 195 | /* csrow<id> control files */ |
233 | MEMCTRL_ATTR(panic_on_ue,S_IRUGO|S_IWUSR,memctrl_int_show,memctrl_int_store); | 196 | MEMCTRL_ATTR(panic_on_ue,S_IRUGO|S_IWUSR,memctrl_int_show,memctrl_int_store); |
234 | MEMCTRL_ATTR(log_ue,S_IRUGO|S_IWUSR,memctrl_int_show,memctrl_int_store); | 197 | MEMCTRL_ATTR(log_ue,S_IRUGO|S_IWUSR,memctrl_int_show,memctrl_int_store); |
@@ -257,8 +220,6 @@ static struct kobj_type ktype_memctrl = { | |||
257 | .default_attrs = (struct attribute **) memctrl_attr, | 220 | .default_attrs = (struct attribute **) memctrl_attr, |
258 | }; | 221 | }; |
259 | 222 | ||
260 | #endif /* DISABLE_EDAC_SYSFS */ | ||
261 | |||
262 | /* Initialize the main sysfs entries for edac: | 223 | /* Initialize the main sysfs entries for edac: |
263 | * /sys/devices/system/edac | 224 | * /sys/devices/system/edac |
264 | * | 225 | * |
@@ -268,11 +229,6 @@ static struct kobj_type ktype_memctrl = { | |||
268 | * !0 FAILURE | 229 | * !0 FAILURE |
269 | */ | 230 | */ |
270 | static int edac_sysfs_memctrl_setup(void) | 231 | static int edac_sysfs_memctrl_setup(void) |
271 | #ifdef DISABLE_EDAC_SYSFS | ||
272 | { | ||
273 | return 0; | ||
274 | } | ||
275 | #else | ||
276 | { | 232 | { |
277 | int err=0; | 233 | int err=0; |
278 | 234 | ||
@@ -304,7 +260,6 @@ static int edac_sysfs_memctrl_setup(void) | |||
304 | 260 | ||
305 | return err; | 261 | return err; |
306 | } | 262 | } |
307 | #endif /* DISABLE_EDAC_SYSFS */ | ||
308 | 263 | ||
309 | /* | 264 | /* |
310 | * MC teardown: | 265 | * MC teardown: |
@@ -312,7 +267,6 @@ static int edac_sysfs_memctrl_setup(void) | |||
312 | */ | 267 | */ |
313 | static void edac_sysfs_memctrl_teardown(void) | 268 | static void edac_sysfs_memctrl_teardown(void) |
314 | { | 269 | { |
315 | #ifndef DISABLE_EDAC_SYSFS | ||
316 | debugf0("MC: " __FILE__ ": %s()\n", __func__); | 270 | debugf0("MC: " __FILE__ ": %s()\n", __func__); |
317 | 271 | ||
318 | /* Unregister the MC's kobject and wait for reference count to reach | 272 | /* Unregister the MC's kobject and wait for reference count to reach |
@@ -324,144 +278,9 @@ static void edac_sysfs_memctrl_teardown(void) | |||
324 | 278 | ||
325 | /* Unregister the 'edac' object */ | 279 | /* Unregister the 'edac' object */ |
326 | sysdev_class_unregister(&edac_class); | 280 | sysdev_class_unregister(&edac_class); |
327 | #endif /* DISABLE_EDAC_SYSFS */ | ||
328 | } | 281 | } |
329 | 282 | ||
330 | #ifdef CONFIG_PCI | 283 | #ifdef CONFIG_PCI |
331 | |||
332 | #ifndef DISABLE_EDAC_SYSFS | ||
333 | |||
334 | /* | ||
335 | * /sys/devices/system/edac/pci; | ||
336 | * data structures and methods | ||
337 | */ | ||
338 | |||
339 | struct list_control { | ||
340 | struct edac_pci_device_list *list; | ||
341 | int *count; | ||
342 | }; | ||
343 | |||
344 | #if 0 | ||
345 | /* Output the list as: vendor_id:device:id<,vendor_id:device_id> */ | ||
346 | static ssize_t edac_pci_list_string_show(void *ptr, char *buffer) | ||
347 | { | ||
348 | struct list_control *listctl; | ||
349 | struct edac_pci_device_list *list; | ||
350 | char *p = buffer; | ||
351 | int len=0; | ||
352 | int i; | ||
353 | |||
354 | listctl = ptr; | ||
355 | list = listctl->list; | ||
356 | |||
357 | for (i = 0; i < *(listctl->count); i++, list++ ) { | ||
358 | if (len > 0) | ||
359 | len += snprintf(p + len, (PAGE_SIZE-len), ","); | ||
360 | |||
361 | len += snprintf(p + len, | ||
362 | (PAGE_SIZE-len), | ||
363 | "%x:%x", | ||
364 | list->vendor,list->device); | ||
365 | } | ||
366 | |||
367 | len += snprintf(p + len,(PAGE_SIZE-len), "\n"); | ||
368 | return (ssize_t) len; | ||
369 | } | ||
370 | |||
371 | /** | ||
372 | * | ||
373 | * Scan string from **s to **e looking for one 'vendor:device' tuple | ||
374 | * where each field is a hex value | ||
375 | * | ||
376 | * return 0 if an entry is NOT found | ||
377 | * return 1 if an entry is found | ||
378 | * fill in *vendor_id and *device_id with values found | ||
379 | * | ||
380 | * In both cases, make sure *s has been moved forward toward *e | ||
381 | */ | ||
382 | static int parse_one_device(const char **s,const char **e, | ||
383 | unsigned int *vendor_id, unsigned int *device_id) | ||
384 | { | ||
385 | const char *runner, *p; | ||
386 | |||
387 | /* if null byte, we are done */ | ||
388 | if (!**s) { | ||
389 | (*s)++; /* keep *s moving */ | ||
390 | return 0; | ||
391 | } | ||
392 | |||
393 | /* skip over newlines & whitespace */ | ||
394 | if ((**s == '\n') || isspace(**s)) { | ||
395 | (*s)++; | ||
396 | return 0; | ||
397 | } | ||
398 | |||
399 | if (!isxdigit(**s)) { | ||
400 | (*s)++; | ||
401 | return 0; | ||
402 | } | ||
403 | |||
404 | /* parse vendor_id */ | ||
405 | runner = *s; | ||
406 | |||
407 | while (runner < *e) { | ||
408 | /* scan for vendor:device delimiter */ | ||
409 | if (*runner == ':') { | ||
410 | *vendor_id = simple_strtol((char*) *s, (char**) &p, 16); | ||
411 | runner = p + 1; | ||
412 | break; | ||
413 | } | ||
414 | |||
415 | runner++; | ||
416 | } | ||
417 | |||
418 | if (!isxdigit(*runner)) { | ||
419 | *s = ++runner; | ||
420 | return 0; | ||
421 | } | ||
422 | |||
423 | /* parse device_id */ | ||
424 | if (runner < *e) { | ||
425 | *device_id = simple_strtol((char*)runner, (char**)&p, 16); | ||
426 | runner = p; | ||
427 | } | ||
428 | |||
429 | *s = runner; | ||
430 | return 1; | ||
431 | } | ||
432 | |||
433 | static ssize_t edac_pci_list_string_store(void *ptr, const char *buffer, | ||
434 | size_t count) | ||
435 | { | ||
436 | struct list_control *listctl; | ||
437 | struct edac_pci_device_list *list; | ||
438 | unsigned int vendor_id, device_id; | ||
439 | const char *s, *e; | ||
440 | int *index; | ||
441 | |||
442 | s = (char*)buffer; | ||
443 | e = s + count; | ||
444 | listctl = ptr; | ||
445 | list = listctl->list; | ||
446 | index = listctl->count; | ||
447 | *index = 0; | ||
448 | |||
449 | while (*index < MAX_LISTED_PCI_DEVICES) { | ||
450 | if (parse_one_device(&s,&e,&vendor_id,&device_id)) { | ||
451 | list[ *index ].vendor = vendor_id; | ||
452 | list[ *index ].device = device_id; | ||
453 | (*index)++; | ||
454 | } | ||
455 | |||
456 | /* check for all data consume */ | ||
457 | if (s >= e) | ||
458 | break; | ||
459 | } | ||
460 | |||
461 | return count; | ||
462 | } | ||
463 | |||
464 | #endif | ||
465 | static ssize_t edac_pci_int_show(void *ptr, char *buffer) | 284 | static ssize_t edac_pci_int_show(void *ptr, char *buffer) |
466 | { | 285 | { |
467 | int *value = ptr; | 286 | int *value = ptr; |
@@ -529,31 +348,6 @@ struct edac_pci_dev_attribute edac_pci_attr_##_name = { \ | |||
529 | .store = _store, \ | 348 | .store = _store, \ |
530 | }; | 349 | }; |
531 | 350 | ||
532 | #if 0 | ||
533 | static struct list_control pci_whitelist_control = { | ||
534 | .list = pci_whitelist, | ||
535 | .count = &pci_whitelist_count | ||
536 | }; | ||
537 | |||
538 | static struct list_control pci_blacklist_control = { | ||
539 | .list = pci_blacklist, | ||
540 | .count = &pci_blacklist_count | ||
541 | }; | ||
542 | |||
543 | /* whitelist attribute */ | ||
544 | EDAC_PCI_STRING_ATTR(pci_parity_whitelist, | ||
545 | &pci_whitelist_control, | ||
546 | S_IRUGO|S_IWUSR, | ||
547 | edac_pci_list_string_show, | ||
548 | edac_pci_list_string_store); | ||
549 | |||
550 | EDAC_PCI_STRING_ATTR(pci_parity_blacklist, | ||
551 | &pci_blacklist_control, | ||
552 | S_IRUGO|S_IWUSR, | ||
553 | edac_pci_list_string_show, | ||
554 | edac_pci_list_string_store); | ||
555 | #endif | ||
556 | |||
557 | /* PCI Parity control files */ | 351 | /* PCI Parity control files */ |
558 | EDAC_PCI_ATTR(check_pci_parity, S_IRUGO|S_IWUSR, edac_pci_int_show, | 352 | EDAC_PCI_ATTR(check_pci_parity, S_IRUGO|S_IWUSR, edac_pci_int_show, |
559 | edac_pci_int_store); | 353 | edac_pci_int_store); |
@@ -582,18 +376,11 @@ static struct kobj_type ktype_edac_pci = { | |||
582 | .default_attrs = (struct attribute **) edac_pci_attr, | 376 | .default_attrs = (struct attribute **) edac_pci_attr, |
583 | }; | 377 | }; |
584 | 378 | ||
585 | #endif /* DISABLE_EDAC_SYSFS */ | ||
586 | |||
587 | /** | 379 | /** |
588 | * edac_sysfs_pci_setup() | 380 | * edac_sysfs_pci_setup() |
589 | * | 381 | * |
590 | */ | 382 | */ |
591 | static int edac_sysfs_pci_setup(void) | 383 | static int edac_sysfs_pci_setup(void) |
592 | #ifdef DISABLE_EDAC_SYSFS | ||
593 | { | ||
594 | return 0; | ||
595 | } | ||
596 | #else | ||
597 | { | 384 | { |
598 | int err; | 385 | int err; |
599 | 386 | ||
@@ -617,16 +404,13 @@ static int edac_sysfs_pci_setup(void) | |||
617 | 404 | ||
618 | return err; | 405 | return err; |
619 | } | 406 | } |
620 | #endif /* DISABLE_EDAC_SYSFS */ | ||
621 | 407 | ||
622 | static void edac_sysfs_pci_teardown(void) | 408 | static void edac_sysfs_pci_teardown(void) |
623 | { | 409 | { |
624 | #ifndef DISABLE_EDAC_SYSFS | ||
625 | debugf0("%s()\n", __func__); | 410 | debugf0("%s()\n", __func__); |
626 | init_completion(&edac_pci_kobj_complete); | 411 | init_completion(&edac_pci_kobj_complete); |
627 | kobject_unregister(&edac_pci_kobj); | 412 | kobject_unregister(&edac_pci_kobj); |
628 | wait_for_completion(&edac_pci_kobj_complete); | 413 | wait_for_completion(&edac_pci_kobj_complete); |
629 | #endif | ||
630 | } | 414 | } |
631 | 415 | ||
632 | 416 | ||
@@ -756,36 +540,6 @@ static void edac_pci_dev_parity_test(struct pci_dev *dev) | |||
756 | } | 540 | } |
757 | 541 | ||
758 | /* | 542 | /* |
759 | * check_dev_on_list: Scan for a PCI device on a white/black list | ||
760 | * @list: an EDAC &edac_pci_device_list white/black list pointer | ||
761 | * @free_index: index of next free entry on the list | ||
762 | * @pci_dev: PCI Device pointer | ||
763 | * | ||
764 | * see if list contains the device. | ||
765 | * | ||
766 | * Returns: 0 not found | ||
767 | * 1 found on list | ||
768 | */ | ||
769 | static int check_dev_on_list(struct edac_pci_device_list *list, | ||
770 | int free_index, struct pci_dev *dev) | ||
771 | { | ||
772 | int i; | ||
773 | int rc = 0; /* Assume not found */ | ||
774 | unsigned short vendor=dev->vendor; | ||
775 | unsigned short device=dev->device; | ||
776 | |||
777 | /* Scan the list, looking for a vendor/device match */ | ||
778 | for (i = 0; i < free_index; i++, list++ ) { | ||
779 | if ((list->vendor == vendor ) && (list->device == device )) { | ||
780 | rc = 1; | ||
781 | break; | ||
782 | } | ||
783 | } | ||
784 | |||
785 | return rc; | ||
786 | } | ||
787 | |||
788 | /* | ||
789 | * pci_dev parity list iterator | 543 | * pci_dev parity list iterator |
790 | * Scan the PCI device list for one iteration, looking for SERRORs | 544 | * Scan the PCI device list for one iteration, looking for SERRORs |
791 | * Master Parity ERRORS or Parity ERRORs on primary or secondary devices | 545 | * Master Parity ERRORS or Parity ERRORs on primary or secondary devices |
@@ -799,22 +553,7 @@ static inline void edac_pci_dev_parity_iterator(pci_parity_check_fn_t fn) | |||
799 | * bumped until we are done with it | 553 | * bumped until we are done with it |
800 | */ | 554 | */ |
801 | while((dev = pci_get_device(PCI_ANY_ID, PCI_ANY_ID, dev)) != NULL) { | 555 | while((dev = pci_get_device(PCI_ANY_ID, PCI_ANY_ID, dev)) != NULL) { |
802 | /* if whitelist exists then it has priority, so only scan | 556 | fn(dev); |
803 | * those devices on the whitelist | ||
804 | */ | ||
805 | if (pci_whitelist_count > 0 ) { | ||
806 | if (check_dev_on_list(pci_whitelist, | ||
807 | pci_whitelist_count, dev)) | ||
808 | fn(dev); | ||
809 | } else { | ||
810 | /* | ||
811 | * if no whitelist, then check if this devices is | ||
812 | * blacklisted | ||
813 | */ | ||
814 | if (!check_dev_on_list(pci_blacklist, | ||
815 | pci_blacklist_count, dev)) | ||
816 | fn(dev); | ||
817 | } | ||
818 | } | 557 | } |
819 | } | 558 | } |
820 | 559 | ||
@@ -855,154 +594,101 @@ static inline void clear_pci_parity_errors(void) | |||
855 | 594 | ||
856 | #else /* CONFIG_PCI */ | 595 | #else /* CONFIG_PCI */ |
857 | 596 | ||
858 | static inline void do_pci_parity_check(void) | 597 | /* pre-process these away */ |
859 | { | 598 | #define do_pci_parity_check() |
860 | /* no-op */ | 599 | #define clear_pci_parity_errors() |
861 | } | 600 | #define edac_sysfs_pci_teardown() |
862 | 601 | #define edac_sysfs_pci_setup() (0) | |
863 | static inline void clear_pci_parity_errors(void) | ||
864 | { | ||
865 | /* no-op */ | ||
866 | } | ||
867 | |||
868 | static void edac_sysfs_pci_teardown(void) | ||
869 | { | ||
870 | } | ||
871 | 602 | ||
872 | static int edac_sysfs_pci_setup(void) | ||
873 | { | ||
874 | return 0; | ||
875 | } | ||
876 | #endif /* CONFIG_PCI */ | 603 | #endif /* CONFIG_PCI */ |
877 | 604 | ||
878 | #ifndef DISABLE_EDAC_SYSFS | 605 | /* EDAC sysfs CSROW data structures and methods |
879 | 606 | */ | |
880 | /* EDAC sysfs CSROW data structures and methods */ | ||
881 | |||
882 | /* Set of more detailed csrow<id> attribute show/store functions */ | ||
883 | static ssize_t csrow_ch0_dimm_label_show(struct csrow_info *csrow, char *data) | ||
884 | { | ||
885 | ssize_t size = 0; | ||
886 | |||
887 | if (csrow->nr_channels > 0) { | ||
888 | size = snprintf(data, EDAC_MC_LABEL_LEN,"%s\n", | ||
889 | csrow->channels[0].label); | ||
890 | } | ||
891 | |||
892 | return size; | ||
893 | } | ||
894 | 607 | ||
895 | static ssize_t csrow_ch1_dimm_label_show(struct csrow_info *csrow, char *data) | 608 | /* Set of more default csrow<id> attribute show/store functions */ |
609 | static ssize_t csrow_ue_count_show(struct csrow_info *csrow, char *data, int private) | ||
896 | { | 610 | { |
897 | ssize_t size = 0; | 611 | return sprintf(data,"%u\n", csrow->ue_count); |
898 | |||
899 | if (csrow->nr_channels > 0) { | ||
900 | size = snprintf(data, EDAC_MC_LABEL_LEN, "%s\n", | ||
901 | csrow->channels[1].label); | ||
902 | } | ||
903 | |||
904 | return size; | ||
905 | } | 612 | } |
906 | 613 | ||
907 | static ssize_t csrow_ch0_dimm_label_store(struct csrow_info *csrow, | 614 | static ssize_t csrow_ce_count_show(struct csrow_info *csrow, char *data, int private) |
908 | const char *data, size_t size) | ||
909 | { | 615 | { |
910 | ssize_t max_size = 0; | 616 | return sprintf(data,"%u\n", csrow->ce_count); |
911 | |||
912 | if (csrow->nr_channels > 0) { | ||
913 | max_size = min((ssize_t)size,(ssize_t)EDAC_MC_LABEL_LEN-1); | ||
914 | strncpy(csrow->channels[0].label, data, max_size); | ||
915 | csrow->channels[0].label[max_size] = '\0'; | ||
916 | } | ||
917 | |||
918 | return size; | ||
919 | } | 617 | } |
920 | 618 | ||
921 | static ssize_t csrow_ch1_dimm_label_store(struct csrow_info *csrow, | 619 | static ssize_t csrow_size_show(struct csrow_info *csrow, char *data, int private) |
922 | const char *data, size_t size) | ||
923 | { | 620 | { |
924 | ssize_t max_size = 0; | 621 | return sprintf(data,"%u\n", PAGES_TO_MiB(csrow->nr_pages)); |
925 | |||
926 | if (csrow->nr_channels > 1) { | ||
927 | max_size = min((ssize_t)size,(ssize_t)EDAC_MC_LABEL_LEN-1); | ||
928 | strncpy(csrow->channels[1].label, data, max_size); | ||
929 | csrow->channels[1].label[max_size] = '\0'; | ||
930 | } | ||
931 | |||
932 | return max_size; | ||
933 | } | 622 | } |
934 | 623 | ||
935 | static ssize_t csrow_ue_count_show(struct csrow_info *csrow, char *data) | 624 | static ssize_t csrow_mem_type_show(struct csrow_info *csrow, char *data, int private) |
936 | { | 625 | { |
937 | return sprintf(data,"%u\n", csrow->ue_count); | 626 | return sprintf(data,"%s\n", mem_types[csrow->mtype]); |
938 | } | 627 | } |
939 | 628 | ||
940 | static ssize_t csrow_ce_count_show(struct csrow_info *csrow, char *data) | 629 | static ssize_t csrow_dev_type_show(struct csrow_info *csrow, char *data, int private) |
941 | { | 630 | { |
942 | return sprintf(data,"%u\n", csrow->ce_count); | 631 | return sprintf(data,"%s\n", dev_types[csrow->dtype]); |
943 | } | 632 | } |
944 | 633 | ||
945 | static ssize_t csrow_ch0_ce_count_show(struct csrow_info *csrow, char *data) | 634 | static ssize_t csrow_edac_mode_show(struct csrow_info *csrow, char *data, int private) |
946 | { | 635 | { |
947 | ssize_t size = 0; | 636 | return sprintf(data,"%s\n", edac_caps[csrow->edac_mode]); |
948 | |||
949 | if (csrow->nr_channels > 0) { | ||
950 | size = sprintf(data,"%u\n", csrow->channels[0].ce_count); | ||
951 | } | ||
952 | |||
953 | return size; | ||
954 | } | 637 | } |
955 | 638 | ||
956 | static ssize_t csrow_ch1_ce_count_show(struct csrow_info *csrow, char *data) | 639 | /* show/store functions for DIMM Label attributes */ |
640 | static ssize_t channel_dimm_label_show(struct csrow_info *csrow, | ||
641 | char *data, int channel) | ||
957 | { | 642 | { |
958 | ssize_t size = 0; | 643 | return snprintf(data, EDAC_MC_LABEL_LEN,"%s", |
959 | 644 | csrow->channels[channel].label); | |
960 | if (csrow->nr_channels > 1) { | ||
961 | size = sprintf(data,"%u\n", csrow->channels[1].ce_count); | ||
962 | } | ||
963 | |||
964 | return size; | ||
965 | } | 645 | } |
966 | 646 | ||
967 | static ssize_t csrow_size_show(struct csrow_info *csrow, char *data) | 647 | static ssize_t channel_dimm_label_store(struct csrow_info *csrow, |
648 | const char *data, | ||
649 | size_t count, | ||
650 | int channel) | ||
968 | { | 651 | { |
969 | return sprintf(data,"%u\n", PAGES_TO_MiB(csrow->nr_pages)); | 652 | ssize_t max_size = 0; |
970 | } | ||
971 | 653 | ||
972 | static ssize_t csrow_mem_type_show(struct csrow_info *csrow, char *data) | 654 | max_size = min((ssize_t)count,(ssize_t)EDAC_MC_LABEL_LEN-1); |
973 | { | 655 | strncpy(csrow->channels[channel].label, data, max_size); |
974 | return sprintf(data,"%s\n", mem_types[csrow->mtype]); | 656 | csrow->channels[channel].label[max_size] = '\0'; |
975 | } | ||
976 | 657 | ||
977 | static ssize_t csrow_dev_type_show(struct csrow_info *csrow, char *data) | 658 | return max_size; |
978 | { | ||
979 | return sprintf(data,"%s\n", dev_types[csrow->dtype]); | ||
980 | } | 659 | } |
981 | 660 | ||
982 | static ssize_t csrow_edac_mode_show(struct csrow_info *csrow, char *data) | 661 | /* show function for dynamic chX_ce_count attribute */ |
662 | static ssize_t channel_ce_count_show(struct csrow_info *csrow, | ||
663 | char *data, | ||
664 | int channel) | ||
983 | { | 665 | { |
984 | return sprintf(data,"%s\n", edac_caps[csrow->edac_mode]); | 666 | return sprintf(data, "%u\n", csrow->channels[channel].ce_count); |
985 | } | 667 | } |
986 | 668 | ||
669 | /* csrow specific attribute structure */ | ||
987 | struct csrowdev_attribute { | 670 | struct csrowdev_attribute { |
988 | struct attribute attr; | 671 | struct attribute attr; |
989 | ssize_t (*show)(struct csrow_info *,char *); | 672 | ssize_t (*show)(struct csrow_info *,char *,int); |
990 | ssize_t (*store)(struct csrow_info *, const char *,size_t); | 673 | ssize_t (*store)(struct csrow_info *, const char *,size_t,int); |
674 | int private; | ||
991 | }; | 675 | }; |
992 | 676 | ||
993 | #define to_csrow(k) container_of(k, struct csrow_info, kobj) | 677 | #define to_csrow(k) container_of(k, struct csrow_info, kobj) |
994 | #define to_csrowdev_attr(a) container_of(a, struct csrowdev_attribute, attr) | 678 | #define to_csrowdev_attr(a) container_of(a, struct csrowdev_attribute, attr) |
995 | 679 | ||
996 | /* Set of show/store higher level functions for csrow objects */ | 680 | /* Set of show/store higher level functions for default csrow attributes */ |
997 | static ssize_t csrowdev_show(struct kobject *kobj, struct attribute *attr, | 681 | static ssize_t csrowdev_show(struct kobject *kobj, |
998 | char *buffer) | 682 | struct attribute *attr, |
683 | char *buffer) | ||
999 | { | 684 | { |
1000 | struct csrow_info *csrow = to_csrow(kobj); | 685 | struct csrow_info *csrow = to_csrow(kobj); |
1001 | struct csrowdev_attribute *csrowdev_attr = to_csrowdev_attr(attr); | 686 | struct csrowdev_attribute *csrowdev_attr = to_csrowdev_attr(attr); |
1002 | 687 | ||
1003 | if (csrowdev_attr->show) | 688 | if (csrowdev_attr->show) |
1004 | return csrowdev_attr->show(csrow, buffer); | 689 | return csrowdev_attr->show(csrow, |
1005 | 690 | buffer, | |
691 | csrowdev_attr->private); | ||
1006 | return -EIO; | 692 | return -EIO; |
1007 | } | 693 | } |
1008 | 694 | ||
@@ -1013,8 +699,10 @@ static ssize_t csrowdev_store(struct kobject *kobj, struct attribute *attr, | |||
1013 | struct csrowdev_attribute * csrowdev_attr = to_csrowdev_attr(attr); | 699 | struct csrowdev_attribute * csrowdev_attr = to_csrowdev_attr(attr); |
1014 | 700 | ||
1015 | if (csrowdev_attr->store) | 701 | if (csrowdev_attr->store) |
1016 | return csrowdev_attr->store(csrow, buffer, count); | 702 | return csrowdev_attr->store(csrow, |
1017 | 703 | buffer, | |
704 | count, | ||
705 | csrowdev_attr->private); | ||
1018 | return -EIO; | 706 | return -EIO; |
1019 | } | 707 | } |
1020 | 708 | ||
@@ -1023,69 +711,157 @@ static struct sysfs_ops csrowfs_ops = { | |||
1023 | .store = csrowdev_store | 711 | .store = csrowdev_store |
1024 | }; | 712 | }; |
1025 | 713 | ||
1026 | #define CSROWDEV_ATTR(_name,_mode,_show,_store) \ | 714 | #define CSROWDEV_ATTR(_name,_mode,_show,_store,_private) \ |
1027 | struct csrowdev_attribute attr_##_name = { \ | 715 | struct csrowdev_attribute attr_##_name = { \ |
1028 | .attr = {.name = __stringify(_name), .mode = _mode }, \ | 716 | .attr = {.name = __stringify(_name), .mode = _mode }, \ |
1029 | .show = _show, \ | 717 | .show = _show, \ |
1030 | .store = _store, \ | 718 | .store = _store, \ |
719 | .private = _private, \ | ||
1031 | }; | 720 | }; |
1032 | 721 | ||
1033 | /* cwrow<id>/attribute files */ | 722 | /* default cwrow<id>/attribute files */ |
1034 | CSROWDEV_ATTR(size_mb,S_IRUGO,csrow_size_show,NULL); | 723 | CSROWDEV_ATTR(size_mb,S_IRUGO,csrow_size_show,NULL,0); |
1035 | CSROWDEV_ATTR(dev_type,S_IRUGO,csrow_dev_type_show,NULL); | 724 | CSROWDEV_ATTR(dev_type,S_IRUGO,csrow_dev_type_show,NULL,0); |
1036 | CSROWDEV_ATTR(mem_type,S_IRUGO,csrow_mem_type_show,NULL); | 725 | CSROWDEV_ATTR(mem_type,S_IRUGO,csrow_mem_type_show,NULL,0); |
1037 | CSROWDEV_ATTR(edac_mode,S_IRUGO,csrow_edac_mode_show,NULL); | 726 | CSROWDEV_ATTR(edac_mode,S_IRUGO,csrow_edac_mode_show,NULL,0); |
1038 | CSROWDEV_ATTR(ue_count,S_IRUGO,csrow_ue_count_show,NULL); | 727 | CSROWDEV_ATTR(ue_count,S_IRUGO,csrow_ue_count_show,NULL,0); |
1039 | CSROWDEV_ATTR(ce_count,S_IRUGO,csrow_ce_count_show,NULL); | 728 | CSROWDEV_ATTR(ce_count,S_IRUGO,csrow_ce_count_show,NULL,0); |
1040 | CSROWDEV_ATTR(ch0_ce_count,S_IRUGO,csrow_ch0_ce_count_show,NULL); | ||
1041 | CSROWDEV_ATTR(ch1_ce_count,S_IRUGO,csrow_ch1_ce_count_show,NULL); | ||
1042 | |||
1043 | /* control/attribute files */ | ||
1044 | CSROWDEV_ATTR(ch0_dimm_label,S_IRUGO|S_IWUSR, | ||
1045 | csrow_ch0_dimm_label_show, | ||
1046 | csrow_ch0_dimm_label_store); | ||
1047 | CSROWDEV_ATTR(ch1_dimm_label,S_IRUGO|S_IWUSR, | ||
1048 | csrow_ch1_dimm_label_show, | ||
1049 | csrow_ch1_dimm_label_store); | ||
1050 | 729 | ||
1051 | /* Attributes of the CSROW<id> object */ | 730 | /* default attributes of the CSROW<id> object */ |
1052 | static struct csrowdev_attribute *csrow_attr[] = { | 731 | static struct csrowdev_attribute *default_csrow_attr[] = { |
1053 | &attr_dev_type, | 732 | &attr_dev_type, |
1054 | &attr_mem_type, | 733 | &attr_mem_type, |
1055 | &attr_edac_mode, | 734 | &attr_edac_mode, |
1056 | &attr_size_mb, | 735 | &attr_size_mb, |
1057 | &attr_ue_count, | 736 | &attr_ue_count, |
1058 | &attr_ce_count, | 737 | &attr_ce_count, |
1059 | &attr_ch0_ce_count, | ||
1060 | &attr_ch1_ce_count, | ||
1061 | &attr_ch0_dimm_label, | ||
1062 | &attr_ch1_dimm_label, | ||
1063 | NULL, | 738 | NULL, |
1064 | }; | 739 | }; |
1065 | 740 | ||
1066 | /* No memory to release */ | 741 | |
742 | /* possible dynamic channel DIMM Label attribute files */ | ||
743 | CSROWDEV_ATTR(ch0_dimm_label,S_IRUGO|S_IWUSR, | ||
744 | channel_dimm_label_show, | ||
745 | channel_dimm_label_store, | ||
746 | 0 ); | ||
747 | CSROWDEV_ATTR(ch1_dimm_label,S_IRUGO|S_IWUSR, | ||
748 | channel_dimm_label_show, | ||
749 | channel_dimm_label_store, | ||
750 | 1 ); | ||
751 | CSROWDEV_ATTR(ch2_dimm_label,S_IRUGO|S_IWUSR, | ||
752 | channel_dimm_label_show, | ||
753 | channel_dimm_label_store, | ||
754 | 2 ); | ||
755 | CSROWDEV_ATTR(ch3_dimm_label,S_IRUGO|S_IWUSR, | ||
756 | channel_dimm_label_show, | ||
757 | channel_dimm_label_store, | ||
758 | 3 ); | ||
759 | CSROWDEV_ATTR(ch4_dimm_label,S_IRUGO|S_IWUSR, | ||
760 | channel_dimm_label_show, | ||
761 | channel_dimm_label_store, | ||
762 | 4 ); | ||
763 | CSROWDEV_ATTR(ch5_dimm_label,S_IRUGO|S_IWUSR, | ||
764 | channel_dimm_label_show, | ||
765 | channel_dimm_label_store, | ||
766 | 5 ); | ||
767 | |||
768 | /* Total possible dynamic DIMM Label attribute file table */ | ||
769 | static struct csrowdev_attribute *dynamic_csrow_dimm_attr[] = { | ||
770 | &attr_ch0_dimm_label, | ||
771 | &attr_ch1_dimm_label, | ||
772 | &attr_ch2_dimm_label, | ||
773 | &attr_ch3_dimm_label, | ||
774 | &attr_ch4_dimm_label, | ||
775 | &attr_ch5_dimm_label | ||
776 | }; | ||
777 | |||
778 | /* possible dynamic channel ce_count attribute files */ | ||
779 | CSROWDEV_ATTR(ch0_ce_count,S_IRUGO|S_IWUSR, | ||
780 | channel_ce_count_show, | ||
781 | NULL, | ||
782 | 0 ); | ||
783 | CSROWDEV_ATTR(ch1_ce_count,S_IRUGO|S_IWUSR, | ||
784 | channel_ce_count_show, | ||
785 | NULL, | ||
786 | 1 ); | ||
787 | CSROWDEV_ATTR(ch2_ce_count,S_IRUGO|S_IWUSR, | ||
788 | channel_ce_count_show, | ||
789 | NULL, | ||
790 | 2 ); | ||
791 | CSROWDEV_ATTR(ch3_ce_count,S_IRUGO|S_IWUSR, | ||
792 | channel_ce_count_show, | ||
793 | NULL, | ||
794 | 3 ); | ||
795 | CSROWDEV_ATTR(ch4_ce_count,S_IRUGO|S_IWUSR, | ||
796 | channel_ce_count_show, | ||
797 | NULL, | ||
798 | 4 ); | ||
799 | CSROWDEV_ATTR(ch5_ce_count,S_IRUGO|S_IWUSR, | ||
800 | channel_ce_count_show, | ||
801 | NULL, | ||
802 | 5 ); | ||
803 | |||
804 | /* Total possible dynamic ce_count attribute file table */ | ||
805 | static struct csrowdev_attribute *dynamic_csrow_ce_count_attr[] = { | ||
806 | &attr_ch0_ce_count, | ||
807 | &attr_ch1_ce_count, | ||
808 | &attr_ch2_ce_count, | ||
809 | &attr_ch3_ce_count, | ||
810 | &attr_ch4_ce_count, | ||
811 | &attr_ch5_ce_count | ||
812 | }; | ||
813 | |||
814 | |||
815 | #define EDAC_NR_CHANNELS 6 | ||
816 | |||
817 | /* Create dynamic CHANNEL files, indexed by 'chan', under specifed CSROW */ | ||
818 | static int edac_create_channel_files(struct kobject *kobj, int chan) | ||
819 | { | ||
820 | int err=-ENODEV; | ||
821 | |||
822 | if (chan >= EDAC_NR_CHANNELS) | ||
823 | return err; | ||
824 | |||
825 | /* create the DIMM label attribute file */ | ||
826 | err = sysfs_create_file(kobj, | ||
827 | (struct attribute *) dynamic_csrow_dimm_attr[chan]); | ||
828 | |||
829 | if (!err) { | ||
830 | /* create the CE Count attribute file */ | ||
831 | err = sysfs_create_file(kobj, | ||
832 | (struct attribute *) dynamic_csrow_ce_count_attr[chan]); | ||
833 | } else { | ||
834 | debugf1("%s() dimm labels and ce_count files created", __func__); | ||
835 | } | ||
836 | |||
837 | return err; | ||
838 | } | ||
839 | |||
840 | /* No memory to release for this kobj */ | ||
1067 | static void edac_csrow_instance_release(struct kobject *kobj) | 841 | static void edac_csrow_instance_release(struct kobject *kobj) |
1068 | { | 842 | { |
1069 | struct csrow_info *cs; | 843 | struct csrow_info *cs; |
1070 | 844 | ||
1071 | debugf1("%s()\n", __func__); | ||
1072 | cs = container_of(kobj, struct csrow_info, kobj); | 845 | cs = container_of(kobj, struct csrow_info, kobj); |
1073 | complete(&cs->kobj_complete); | 846 | complete(&cs->kobj_complete); |
1074 | } | 847 | } |
1075 | 848 | ||
849 | /* the kobj_type instance for a CSROW */ | ||
1076 | static struct kobj_type ktype_csrow = { | 850 | static struct kobj_type ktype_csrow = { |
1077 | .release = edac_csrow_instance_release, | 851 | .release = edac_csrow_instance_release, |
1078 | .sysfs_ops = &csrowfs_ops, | 852 | .sysfs_ops = &csrowfs_ops, |
1079 | .default_attrs = (struct attribute **) csrow_attr, | 853 | .default_attrs = (struct attribute **) default_csrow_attr, |
1080 | }; | 854 | }; |
1081 | 855 | ||
1082 | /* Create a CSROW object under specifed edac_mc_device */ | 856 | /* Create a CSROW object under specifed edac_mc_device */ |
1083 | static int edac_create_csrow_object(struct kobject *edac_mci_kobj, | 857 | static int edac_create_csrow_object( |
1084 | struct csrow_info *csrow, int index) | 858 | struct kobject *edac_mci_kobj, |
859 | struct csrow_info *csrow, | ||
860 | int index) | ||
1085 | { | 861 | { |
1086 | int err = 0; | 862 | int err = 0; |
863 | int chan; | ||
1087 | 864 | ||
1088 | debugf0("%s()\n", __func__); | ||
1089 | memset(&csrow->kobj, 0, sizeof(csrow->kobj)); | 865 | memset(&csrow->kobj, 0, sizeof(csrow->kobj)); |
1090 | 866 | ||
1091 | /* generate ..../edac/mc/mc<id>/csrow<index> */ | 867 | /* generate ..../edac/mc/mc<id>/csrow<index> */ |
@@ -1095,21 +871,27 @@ static int edac_create_csrow_object(struct kobject *edac_mci_kobj, | |||
1095 | 871 | ||
1096 | /* name this instance of csrow<id> */ | 872 | /* name this instance of csrow<id> */ |
1097 | err = kobject_set_name(&csrow->kobj,"csrow%d",index); | 873 | err = kobject_set_name(&csrow->kobj,"csrow%d",index); |
874 | if (err) | ||
875 | goto error_exit; | ||
1098 | 876 | ||
877 | /* Instanstiate the csrow object */ | ||
878 | err = kobject_register(&csrow->kobj); | ||
1099 | if (!err) { | 879 | if (!err) { |
1100 | /* Instanstiate the csrow object */ | 880 | /* Create the dyanmic attribute files on this csrow, |
1101 | err = kobject_register(&csrow->kobj); | 881 | * namely, the DIMM labels and the channel ce_count |
1102 | 882 | */ | |
1103 | if (err) | 883 | for (chan = 0; chan < csrow->nr_channels; chan++) { |
1104 | debugf0("Failed to register CSROW%d\n",index); | 884 | err = edac_create_channel_files(&csrow->kobj,chan); |
1105 | else | 885 | if (err) |
1106 | debugf0("Registered CSROW%d\n",index); | 886 | break; |
887 | } | ||
1107 | } | 888 | } |
1108 | 889 | ||
890 | error_exit: | ||
1109 | return err; | 891 | return err; |
1110 | } | 892 | } |
1111 | 893 | ||
1112 | /* sysfs data structures and methods for the MCI kobjects */ | 894 | /* default sysfs methods and data structures for the main MCI kobject */ |
1113 | 895 | ||
1114 | static ssize_t mci_reset_counters_store(struct mem_ctl_info *mci, | 896 | static ssize_t mci_reset_counters_store(struct mem_ctl_info *mci, |
1115 | const char *data, size_t count) | 897 | const char *data, size_t count) |
@@ -1135,6 +917,7 @@ static ssize_t mci_reset_counters_store(struct mem_ctl_info *mci, | |||
1135 | return count; | 917 | return count; |
1136 | } | 918 | } |
1137 | 919 | ||
920 | /* default attribute files for the MCI object */ | ||
1138 | static ssize_t mci_ue_count_show(struct mem_ctl_info *mci, char *data) | 921 | static ssize_t mci_ue_count_show(struct mem_ctl_info *mci, char *data) |
1139 | { | 922 | { |
1140 | return sprintf(data,"%d\n", mci->ue_count); | 923 | return sprintf(data,"%d\n", mci->ue_count); |
@@ -1160,71 +943,11 @@ static ssize_t mci_seconds_show(struct mem_ctl_info *mci, char *data) | |||
1160 | return sprintf(data,"%ld\n", (jiffies - mci->start_time) / HZ); | 943 | return sprintf(data,"%ld\n", (jiffies - mci->start_time) / HZ); |
1161 | } | 944 | } |
1162 | 945 | ||
1163 | static ssize_t mci_mod_name_show(struct mem_ctl_info *mci, char *data) | ||
1164 | { | ||
1165 | return sprintf(data,"%s %s\n", mci->mod_name, mci->mod_ver); | ||
1166 | } | ||
1167 | |||
1168 | static ssize_t mci_ctl_name_show(struct mem_ctl_info *mci, char *data) | 946 | static ssize_t mci_ctl_name_show(struct mem_ctl_info *mci, char *data) |
1169 | { | 947 | { |
1170 | return sprintf(data,"%s\n", mci->ctl_name); | 948 | return sprintf(data,"%s\n", mci->ctl_name); |
1171 | } | 949 | } |
1172 | 950 | ||
1173 | static int mci_output_edac_cap(char *buf, unsigned long edac_cap) | ||
1174 | { | ||
1175 | char *p = buf; | ||
1176 | int bit_idx; | ||
1177 | |||
1178 | for (bit_idx = 0; bit_idx < 8 * sizeof(edac_cap); bit_idx++) { | ||
1179 | if ((edac_cap >> bit_idx) & 0x1) | ||
1180 | p += sprintf(p, "%s ", edac_caps[bit_idx]); | ||
1181 | } | ||
1182 | |||
1183 | return p - buf; | ||
1184 | } | ||
1185 | |||
1186 | static ssize_t mci_edac_capability_show(struct mem_ctl_info *mci, char *data) | ||
1187 | { | ||
1188 | char *p = data; | ||
1189 | |||
1190 | p += mci_output_edac_cap(p,mci->edac_ctl_cap); | ||
1191 | p += sprintf(p, "\n"); | ||
1192 | return p - data; | ||
1193 | } | ||
1194 | |||
1195 | static ssize_t mci_edac_current_capability_show(struct mem_ctl_info *mci, | ||
1196 | char *data) | ||
1197 | { | ||
1198 | char *p = data; | ||
1199 | |||
1200 | p += mci_output_edac_cap(p,mci->edac_cap); | ||
1201 | p += sprintf(p, "\n"); | ||
1202 | return p - data; | ||
1203 | } | ||
1204 | |||
1205 | static int mci_output_mtype_cap(char *buf, unsigned long mtype_cap) | ||
1206 | { | ||
1207 | char *p = buf; | ||
1208 | int bit_idx; | ||
1209 | |||
1210 | for (bit_idx = 0; bit_idx < 8 * sizeof(mtype_cap); bit_idx++) { | ||
1211 | if ((mtype_cap >> bit_idx) & 0x1) | ||
1212 | p += sprintf(p, "%s ", mem_types[bit_idx]); | ||
1213 | } | ||
1214 | |||
1215 | return p - buf; | ||
1216 | } | ||
1217 | |||
1218 | static ssize_t mci_supported_mem_type_show(struct mem_ctl_info *mci, | ||
1219 | char *data) | ||
1220 | { | ||
1221 | char *p = data; | ||
1222 | |||
1223 | p += mci_output_mtype_cap(p,mci->mtype_cap); | ||
1224 | p += sprintf(p, "\n"); | ||
1225 | return p - data; | ||
1226 | } | ||
1227 | |||
1228 | static ssize_t mci_size_mb_show(struct mem_ctl_info *mci, char *data) | 951 | static ssize_t mci_size_mb_show(struct mem_ctl_info *mci, char *data) |
1229 | { | 952 | { |
1230 | int total_pages, csrow_idx; | 953 | int total_pages, csrow_idx; |
@@ -1251,6 +974,7 @@ struct mcidev_attribute { | |||
1251 | #define to_mci(k) container_of(k, struct mem_ctl_info, edac_mci_kobj) | 974 | #define to_mci(k) container_of(k, struct mem_ctl_info, edac_mci_kobj) |
1252 | #define to_mcidev_attr(a) container_of(a, struct mcidev_attribute, attr) | 975 | #define to_mcidev_attr(a) container_of(a, struct mcidev_attribute, attr) |
1253 | 976 | ||
977 | /* MCI show/store functions for top most object */ | ||
1254 | static ssize_t mcidev_show(struct kobject *kobj, struct attribute *attr, | 978 | static ssize_t mcidev_show(struct kobject *kobj, struct attribute *attr, |
1255 | char *buffer) | 979 | char *buffer) |
1256 | { | 980 | { |
@@ -1287,31 +1011,21 @@ struct mcidev_attribute mci_attr_##_name = { \ | |||
1287 | .store = _store, \ | 1011 | .store = _store, \ |
1288 | }; | 1012 | }; |
1289 | 1013 | ||
1290 | /* Control file */ | 1014 | /* default Control file */ |
1291 | MCIDEV_ATTR(reset_counters,S_IWUSR,NULL,mci_reset_counters_store); | 1015 | MCIDEV_ATTR(reset_counters,S_IWUSR,NULL,mci_reset_counters_store); |
1292 | 1016 | ||
1293 | /* Attribute files */ | 1017 | /* default Attribute files */ |
1294 | MCIDEV_ATTR(mc_name,S_IRUGO,mci_ctl_name_show,NULL); | 1018 | MCIDEV_ATTR(mc_name,S_IRUGO,mci_ctl_name_show,NULL); |
1295 | MCIDEV_ATTR(module_name,S_IRUGO,mci_mod_name_show,NULL); | ||
1296 | MCIDEV_ATTR(edac_capability,S_IRUGO,mci_edac_capability_show,NULL); | ||
1297 | MCIDEV_ATTR(size_mb,S_IRUGO,mci_size_mb_show,NULL); | 1019 | MCIDEV_ATTR(size_mb,S_IRUGO,mci_size_mb_show,NULL); |
1298 | MCIDEV_ATTR(seconds_since_reset,S_IRUGO,mci_seconds_show,NULL); | 1020 | MCIDEV_ATTR(seconds_since_reset,S_IRUGO,mci_seconds_show,NULL); |
1299 | MCIDEV_ATTR(ue_noinfo_count,S_IRUGO,mci_ue_noinfo_show,NULL); | 1021 | MCIDEV_ATTR(ue_noinfo_count,S_IRUGO,mci_ue_noinfo_show,NULL); |
1300 | MCIDEV_ATTR(ce_noinfo_count,S_IRUGO,mci_ce_noinfo_show,NULL); | 1022 | MCIDEV_ATTR(ce_noinfo_count,S_IRUGO,mci_ce_noinfo_show,NULL); |
1301 | MCIDEV_ATTR(ue_count,S_IRUGO,mci_ue_count_show,NULL); | 1023 | MCIDEV_ATTR(ue_count,S_IRUGO,mci_ue_count_show,NULL); |
1302 | MCIDEV_ATTR(ce_count,S_IRUGO,mci_ce_count_show,NULL); | 1024 | MCIDEV_ATTR(ce_count,S_IRUGO,mci_ce_count_show,NULL); |
1303 | MCIDEV_ATTR(edac_current_capability,S_IRUGO, | ||
1304 | mci_edac_current_capability_show,NULL); | ||
1305 | MCIDEV_ATTR(supported_mem_type,S_IRUGO, | ||
1306 | mci_supported_mem_type_show,NULL); | ||
1307 | 1025 | ||
1308 | static struct mcidev_attribute *mci_attr[] = { | 1026 | static struct mcidev_attribute *mci_attr[] = { |
1309 | &mci_attr_reset_counters, | 1027 | &mci_attr_reset_counters, |
1310 | &mci_attr_module_name, | ||
1311 | &mci_attr_mc_name, | 1028 | &mci_attr_mc_name, |
1312 | &mci_attr_edac_capability, | ||
1313 | &mci_attr_edac_current_capability, | ||
1314 | &mci_attr_supported_mem_type, | ||
1315 | &mci_attr_size_mb, | 1029 | &mci_attr_size_mb, |
1316 | &mci_attr_seconds_since_reset, | 1030 | &mci_attr_seconds_since_reset, |
1317 | &mci_attr_ue_noinfo_count, | 1031 | &mci_attr_ue_noinfo_count, |
@@ -1339,7 +1053,6 @@ static struct kobj_type ktype_mci = { | |||
1339 | .default_attrs = (struct attribute **) mci_attr, | 1053 | .default_attrs = (struct attribute **) mci_attr, |
1340 | }; | 1054 | }; |
1341 | 1055 | ||
1342 | #endif /* DISABLE_EDAC_SYSFS */ | ||
1343 | 1056 | ||
1344 | #define EDAC_DEVICE_SYMLINK "device" | 1057 | #define EDAC_DEVICE_SYMLINK "device" |
1345 | 1058 | ||
@@ -1352,11 +1065,6 @@ static struct kobj_type ktype_mci = { | |||
1352 | * !0 Failure | 1065 | * !0 Failure |
1353 | */ | 1066 | */ |
1354 | static int edac_create_sysfs_mci_device(struct mem_ctl_info *mci) | 1067 | static int edac_create_sysfs_mci_device(struct mem_ctl_info *mci) |
1355 | #ifdef DISABLE_EDAC_SYSFS | ||
1356 | { | ||
1357 | return 0; | ||
1358 | } | ||
1359 | #else | ||
1360 | { | 1068 | { |
1361 | int i; | 1069 | int i; |
1362 | int err; | 1070 | int err; |
@@ -1368,7 +1076,6 @@ static int edac_create_sysfs_mci_device(struct mem_ctl_info *mci) | |||
1368 | 1076 | ||
1369 | /* set the name of the mc<id> object */ | 1077 | /* set the name of the mc<id> object */ |
1370 | err = kobject_set_name(edac_mci_kobj,"mc%d",mci->mc_idx); | 1078 | err = kobject_set_name(edac_mci_kobj,"mc%d",mci->mc_idx); |
1371 | |||
1372 | if (err) | 1079 | if (err) |
1373 | return err; | 1080 | return err; |
1374 | 1081 | ||
@@ -1378,14 +1085,12 @@ static int edac_create_sysfs_mci_device(struct mem_ctl_info *mci) | |||
1378 | 1085 | ||
1379 | /* register the mc<id> kobject */ | 1086 | /* register the mc<id> kobject */ |
1380 | err = kobject_register(edac_mci_kobj); | 1087 | err = kobject_register(edac_mci_kobj); |
1381 | |||
1382 | if (err) | 1088 | if (err) |
1383 | return err; | 1089 | return err; |
1384 | 1090 | ||
1385 | /* create a symlink for the device */ | 1091 | /* create a symlink for the device */ |
1386 | err = sysfs_create_link(edac_mci_kobj, &mci->dev->kobj, | 1092 | err = sysfs_create_link(edac_mci_kobj, &mci->dev->kobj, |
1387 | EDAC_DEVICE_SYMLINK); | 1093 | EDAC_DEVICE_SYMLINK); |
1388 | |||
1389 | if (err) | 1094 | if (err) |
1390 | goto fail0; | 1095 | goto fail0; |
1391 | 1096 | ||
@@ -1398,7 +1103,6 @@ static int edac_create_sysfs_mci_device(struct mem_ctl_info *mci) | |||
1398 | /* Only expose populated CSROWs */ | 1103 | /* Only expose populated CSROWs */ |
1399 | if (csrow->nr_pages > 0) { | 1104 | if (csrow->nr_pages > 0) { |
1400 | err = edac_create_csrow_object(edac_mci_kobj,csrow,i); | 1105 | err = edac_create_csrow_object(edac_mci_kobj,csrow,i); |
1401 | |||
1402 | if (err) | 1106 | if (err) |
1403 | goto fail1; | 1107 | goto fail1; |
1404 | } | 1108 | } |
@@ -1422,14 +1126,12 @@ fail0: | |||
1422 | wait_for_completion(&mci->kobj_complete); | 1126 | wait_for_completion(&mci->kobj_complete); |
1423 | return err; | 1127 | return err; |
1424 | } | 1128 | } |
1425 | #endif /* DISABLE_EDAC_SYSFS */ | ||
1426 | 1129 | ||
1427 | /* | 1130 | /* |
1428 | * remove a Memory Controller instance | 1131 | * remove a Memory Controller instance |
1429 | */ | 1132 | */ |
1430 | static void edac_remove_sysfs_mci_device(struct mem_ctl_info *mci) | 1133 | static void edac_remove_sysfs_mci_device(struct mem_ctl_info *mci) |
1431 | { | 1134 | { |
1432 | #ifndef DISABLE_EDAC_SYSFS | ||
1433 | int i; | 1135 | int i; |
1434 | 1136 | ||
1435 | debugf0("%s()\n", __func__); | 1137 | debugf0("%s()\n", __func__); |
@@ -1447,7 +1149,6 @@ static void edac_remove_sysfs_mci_device(struct mem_ctl_info *mci) | |||
1447 | init_completion(&mci->kobj_complete); | 1149 | init_completion(&mci->kobj_complete); |
1448 | kobject_unregister(&mci->edac_mci_kobj); | 1150 | kobject_unregister(&mci->edac_mci_kobj); |
1449 | wait_for_completion(&mci->kobj_complete); | 1151 | wait_for_completion(&mci->kobj_complete); |
1450 | #endif /* DISABLE_EDAC_SYSFS */ | ||
1451 | } | 1152 | } |
1452 | 1153 | ||
1453 | /* END OF sysfs data and methods */ | 1154 | /* END OF sysfs data and methods */ |
diff --git a/drivers/hwmon/abituguru.c b/drivers/hwmon/abituguru.c index 59122cc0a50a..cc15c4f2e9ec 100644 --- a/drivers/hwmon/abituguru.c +++ b/drivers/hwmon/abituguru.c | |||
@@ -142,6 +142,14 @@ static const u8 abituguru_pwm_max[5] = { 0, 255, 255, 75, 75 }; | |||
142 | static int force; | 142 | static int force; |
143 | module_param(force, bool, 0); | 143 | module_param(force, bool, 0); |
144 | MODULE_PARM_DESC(force, "Set to one to force detection."); | 144 | MODULE_PARM_DESC(force, "Set to one to force detection."); |
145 | static int bank1_types[ABIT_UGURU_MAX_BANK1_SENSORS] = { -1, -1, -1, -1, -1, | ||
146 | -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 }; | ||
147 | module_param_array(bank1_types, int, NULL, 0); | ||
148 | MODULE_PARM_DESC(bank1_types, "Bank1 sensortype autodetection override:\n" | ||
149 | " -1 autodetect\n" | ||
150 | " 0 volt sensor\n" | ||
151 | " 1 temp sensor\n" | ||
152 | " 2 not connected"); | ||
145 | static int fan_sensors; | 153 | static int fan_sensors; |
146 | module_param(fan_sensors, int, 0); | 154 | module_param(fan_sensors, int, 0); |
147 | MODULE_PARM_DESC(fan_sensors, "Number of fan sensors on the uGuru " | 155 | MODULE_PARM_DESC(fan_sensors, "Number of fan sensors on the uGuru " |
@@ -397,6 +405,15 @@ abituguru_detect_bank1_sensor_type(struct abituguru_data *data, | |||
397 | u8 val, buf[3]; | 405 | u8 val, buf[3]; |
398 | int ret = ABIT_UGURU_NC; | 406 | int ret = ABIT_UGURU_NC; |
399 | 407 | ||
408 | /* If overriden by the user return the user selected type */ | ||
409 | if (bank1_types[sensor_addr] >= ABIT_UGURU_IN_SENSOR && | ||
410 | bank1_types[sensor_addr] <= ABIT_UGURU_NC) { | ||
411 | ABIT_UGURU_DEBUG(2, "assuming sensor type %d for bank1 sensor " | ||
412 | "%d because of \"bank1_types\" module param\n", | ||
413 | bank1_types[sensor_addr], (int)sensor_addr); | ||
414 | return bank1_types[sensor_addr]; | ||
415 | } | ||
416 | |||
400 | /* First read the sensor and the current settings */ | 417 | /* First read the sensor and the current settings */ |
401 | if (abituguru_read(data, ABIT_UGURU_SENSOR_BANK1, sensor_addr, &val, | 418 | if (abituguru_read(data, ABIT_UGURU_SENSOR_BANK1, sensor_addr, &val, |
402 | 1, ABIT_UGURU_MAX_RETRIES) != 1) | 419 | 1, ABIT_UGURU_MAX_RETRIES) != 1) |
@@ -514,7 +531,7 @@ abituguru_detect_no_bank2_sensors(struct abituguru_data *data) | |||
514 | { | 531 | { |
515 | int i; | 532 | int i; |
516 | 533 | ||
517 | if (fan_sensors) { | 534 | if (fan_sensors > 0 && fan_sensors <= ABIT_UGURU_MAX_BANK2_SENSORS) { |
518 | data->bank2_sensors = fan_sensors; | 535 | data->bank2_sensors = fan_sensors; |
519 | ABIT_UGURU_DEBUG(2, "assuming %d fan sensors because of " | 536 | ABIT_UGURU_DEBUG(2, "assuming %d fan sensors because of " |
520 | "\"fan_sensors\" module param\n", | 537 | "\"fan_sensors\" module param\n", |
@@ -568,7 +585,7 @@ abituguru_detect_no_pwms(struct abituguru_data *data) | |||
568 | { | 585 | { |
569 | int i, j; | 586 | int i, j; |
570 | 587 | ||
571 | if (pwms) { | 588 | if (pwms > 0 && pwms <= ABIT_UGURU_MAX_PWMS) { |
572 | data->pwms = pwms; | 589 | data->pwms = pwms; |
573 | ABIT_UGURU_DEBUG(2, "assuming %d PWM outputs because of " | 590 | ABIT_UGURU_DEBUG(2, "assuming %d PWM outputs because of " |
574 | "\"pwms\" module param\n", (int)data->pwms); | 591 | "\"pwms\" module param\n", (int)data->pwms); |
diff --git a/drivers/i2c/algos/i2c-algo-bit.c b/drivers/i2c/algos/i2c-algo-bit.c index df05df1a0ef6..ab230c033f99 100644 --- a/drivers/i2c/algos/i2c-algo-bit.c +++ b/drivers/i2c/algos/i2c-algo-bit.c | |||
@@ -372,7 +372,6 @@ static inline int readbytes(struct i2c_adapter *i2c_adap, struct i2c_msg *msg) | |||
372 | 372 | ||
373 | while (count > 0) { | 373 | while (count > 0) { |
374 | inval = i2c_inb(i2c_adap); | 374 | inval = i2c_inb(i2c_adap); |
375 | /*printk("%#02x ",inval); if ( ! (count % 16) ) printk("\n"); */ | ||
376 | if (inval>=0) { | 375 | if (inval>=0) { |
377 | *temp = inval; | 376 | *temp = inval; |
378 | rdcount++; | 377 | rdcount++; |
@@ -544,8 +543,7 @@ int i2c_bit_add_bus(struct i2c_adapter *adap) | |||
544 | adap->timeout = 100; /* default values, should */ | 543 | adap->timeout = 100; /* default values, should */ |
545 | adap->retries = 3; /* be replaced by defines */ | 544 | adap->retries = 3; /* be replaced by defines */ |
546 | 545 | ||
547 | i2c_add_adapter(adap); | 546 | return i2c_add_adapter(adap); |
548 | return 0; | ||
549 | } | 547 | } |
550 | 548 | ||
551 | 549 | ||
diff --git a/drivers/i2c/algos/i2c-algo-ite.c b/drivers/i2c/algos/i2c-algo-ite.c index 2db7bfc85225..70d8eefb5efc 100644 --- a/drivers/i2c/algos/i2c-algo-ite.c +++ b/drivers/i2c/algos/i2c-algo-ite.c | |||
@@ -742,10 +742,8 @@ int i2c_iic_add_bus(struct i2c_adapter *adap) | |||
742 | adap->retries = 3; /* be replaced by defines */ | 742 | adap->retries = 3; /* be replaced by defines */ |
743 | adap->flags = 0; | 743 | adap->flags = 0; |
744 | 744 | ||
745 | i2c_add_adapter(adap); | ||
746 | iic_init(iic_adap); | 745 | iic_init(iic_adap); |
747 | 746 | return i2c_add_adapter(adap); | |
748 | return 0; | ||
749 | } | 747 | } |
750 | 748 | ||
751 | 749 | ||
diff --git a/drivers/i2c/algos/i2c-algo-pca.c b/drivers/i2c/algos/i2c-algo-pca.c index 82946acab4c7..b88a6fcf7bd0 100644 --- a/drivers/i2c/algos/i2c-algo-pca.c +++ b/drivers/i2c/algos/i2c-algo-pca.c | |||
@@ -374,10 +374,10 @@ int i2c_pca_add_bus(struct i2c_adapter *adap) | |||
374 | adap->timeout = 100; /* default values, should */ | 374 | adap->timeout = 100; /* default values, should */ |
375 | adap->retries = 3; /* be replaced by defines */ | 375 | adap->retries = 3; /* be replaced by defines */ |
376 | 376 | ||
377 | rval = pca_init(pca_adap); | 377 | if ((rval = pca_init(pca_adap))) |
378 | return rval; | ||
378 | 379 | ||
379 | if (!rval) | 380 | rval = i2c_add_adapter(adap); |
380 | i2c_add_adapter(adap); | ||
381 | 381 | ||
382 | return rval; | 382 | return rval; |
383 | } | 383 | } |
diff --git a/drivers/i2c/algos/i2c-algo-pcf.c b/drivers/i2c/algos/i2c-algo-pcf.c index 6e498df1f717..5b24930adb5a 100644 --- a/drivers/i2c/algos/i2c-algo-pcf.c +++ b/drivers/i2c/algos/i2c-algo-pcf.c | |||
@@ -479,9 +479,11 @@ int i2c_pcf_add_bus(struct i2c_adapter *adap) | |||
479 | adap->timeout = 100; /* default values, should */ | 479 | adap->timeout = 100; /* default values, should */ |
480 | adap->retries = 3; /* be replaced by defines */ | 480 | adap->retries = 3; /* be replaced by defines */ |
481 | 481 | ||
482 | rval = pcf_init_8584(pcf_adap); | 482 | if ((rval = pcf_init_8584(pcf_adap))) |
483 | if (!rval) | 483 | return rval; |
484 | i2c_add_adapter(adap); | 484 | |
485 | rval = i2c_add_adapter(adap); | ||
486 | |||
485 | return rval; | 487 | return rval; |
486 | } | 488 | } |
487 | 489 | ||
diff --git a/drivers/i2c/algos/i2c-algo-sibyte.c b/drivers/i2c/algos/i2c-algo-sibyte.c index 3df3f09995c2..32d41c6fac0f 100644 --- a/drivers/i2c/algos/i2c-algo-sibyte.c +++ b/drivers/i2c/algos/i2c-algo-sibyte.c | |||
@@ -173,9 +173,7 @@ int i2c_sibyte_add_bus(struct i2c_adapter *i2c_adap, int speed) | |||
173 | printk("\n"); | 173 | printk("\n"); |
174 | } | 174 | } |
175 | 175 | ||
176 | i2c_add_adapter(i2c_adap); | 176 | return i2c_add_adapter(i2c_adap); |
177 | |||
178 | return 0; | ||
179 | } | 177 | } |
180 | 178 | ||
181 | 179 | ||
diff --git a/drivers/i2c/busses/i2c-iop3xx.c b/drivers/i2c/busses/i2c-iop3xx.c index aca7e1668605..48c56939c861 100644 --- a/drivers/i2c/busses/i2c-iop3xx.c +++ b/drivers/i2c/busses/i2c-iop3xx.c | |||
@@ -21,6 +21,9 @@ | |||
21 | * - Make it work with IXP46x chips | 21 | * - Make it work with IXP46x chips |
22 | * - Cleanup function names, coding style, etc | 22 | * - Cleanup function names, coding style, etc |
23 | * | 23 | * |
24 | * - writing to slave address causes latchup on iop331. | ||
25 | * fix: driver refuses to address self. | ||
26 | * | ||
24 | * This program is free software; you can redistribute it and/or modify | 27 | * This program is free software; you can redistribute it and/or modify |
25 | * it under the terms of the GNU General Public License as published by | 28 | * it under the terms of the GNU General Public License as published by |
26 | * the Free Software Foundation, version 2. | 29 | * the Free Software Foundation, version 2. |
@@ -73,12 +76,6 @@ iop3xx_i2c_reset(struct i2c_algo_iop3xx_data *iop3xx_adap) | |||
73 | } | 76 | } |
74 | 77 | ||
75 | static void | 78 | static void |
76 | iop3xx_i2c_set_slave_addr(struct i2c_algo_iop3xx_data *iop3xx_adap) | ||
77 | { | ||
78 | __raw_writel(MYSAR, iop3xx_adap->ioaddr + SAR_OFFSET); | ||
79 | } | ||
80 | |||
81 | static void | ||
82 | iop3xx_i2c_enable(struct i2c_algo_iop3xx_data *iop3xx_adap) | 79 | iop3xx_i2c_enable(struct i2c_algo_iop3xx_data *iop3xx_adap) |
83 | { | 80 | { |
84 | u32 cr = IOP3XX_ICR_GCD | IOP3XX_ICR_SCLEN | IOP3XX_ICR_UE; | 81 | u32 cr = IOP3XX_ICR_GCD | IOP3XX_ICR_SCLEN | IOP3XX_ICR_UE; |
@@ -248,6 +245,13 @@ iop3xx_i2c_send_target_addr(struct i2c_algo_iop3xx_data *iop3xx_adap, | |||
248 | int status; | 245 | int status; |
249 | int rc; | 246 | int rc; |
250 | 247 | ||
248 | /* avoid writing to my slave address (hangs on 80331), | ||
249 | * forbidden in Intel developer manual | ||
250 | */ | ||
251 | if (msg->addr == MYSAR) { | ||
252 | return -EBUSY; | ||
253 | } | ||
254 | |||
251 | __raw_writel(iic_cook_addr(msg), iop3xx_adap->ioaddr + DBR_OFFSET); | 255 | __raw_writel(iic_cook_addr(msg), iop3xx_adap->ioaddr + DBR_OFFSET); |
252 | 256 | ||
253 | cr &= ~(IOP3XX_ICR_MSTOP | IOP3XX_ICR_NACK); | 257 | cr &= ~(IOP3XX_ICR_MSTOP | IOP3XX_ICR_NACK); |
@@ -498,7 +502,6 @@ iop3xx_i2c_probe(struct platform_device *pdev) | |||
498 | spin_lock_init(&adapter_data->lock); | 502 | spin_lock_init(&adapter_data->lock); |
499 | 503 | ||
500 | iop3xx_i2c_reset(adapter_data); | 504 | iop3xx_i2c_reset(adapter_data); |
501 | iop3xx_i2c_set_slave_addr(adapter_data); | ||
502 | iop3xx_i2c_enable(adapter_data); | 505 | iop3xx_i2c_enable(adapter_data); |
503 | 506 | ||
504 | platform_set_drvdata(pdev, new_adapter); | 507 | platform_set_drvdata(pdev, new_adapter); |
diff --git a/drivers/i2c/busses/i2c-iop3xx.h b/drivers/i2c/busses/i2c-iop3xx.h index e46ebaea7b1e..8485861f6a36 100644 --- a/drivers/i2c/busses/i2c-iop3xx.h +++ b/drivers/i2c/busses/i2c-iop3xx.h | |||
@@ -80,7 +80,7 @@ | |||
80 | #define IOP3XX_GPOD_I2C0 0x00c0 /* clear these bits to enable ch0 */ | 80 | #define IOP3XX_GPOD_I2C0 0x00c0 /* clear these bits to enable ch0 */ |
81 | #define IOP3XX_GPOD_I2C1 0x0030 /* clear these bits to enable ch1 */ | 81 | #define IOP3XX_GPOD_I2C1 0x0030 /* clear these bits to enable ch1 */ |
82 | 82 | ||
83 | #define MYSAR 0x02 /* SWAG a suitable slave address */ | 83 | #define MYSAR 0 /* default slave address */ |
84 | 84 | ||
85 | #define I2C_ERR 321 | 85 | #define I2C_ERR 321 |
86 | #define I2C_ERR_BERR (I2C_ERR+0) | 86 | #define I2C_ERR_BERR (I2C_ERR+0) |
diff --git a/drivers/i2c/busses/i2c-powermac.c b/drivers/i2c/busses/i2c-powermac.c index 2a0b3be7cdd0..53bb43593863 100644 --- a/drivers/i2c/busses/i2c-powermac.c +++ b/drivers/i2c/busses/i2c-powermac.c | |||
@@ -148,8 +148,6 @@ static int i2c_powermac_master_xfer( struct i2c_adapter *adap, | |||
148 | int read; | 148 | int read; |
149 | int addrdir; | 149 | int addrdir; |
150 | 150 | ||
151 | if (num != 1) | ||
152 | return -EINVAL; | ||
153 | if (msgs->flags & I2C_M_TEN) | 151 | if (msgs->flags & I2C_M_TEN) |
154 | return -EINVAL; | 152 | return -EINVAL; |
155 | read = (msgs->flags & I2C_M_RD) != 0; | 153 | read = (msgs->flags & I2C_M_RD) != 0; |
@@ -166,7 +164,7 @@ static int i2c_powermac_master_xfer( struct i2c_adapter *adap, | |||
166 | rc = pmac_i2c_xfer(bus, addrdir, 0, 0, msgs->buf, msgs->len); | 164 | rc = pmac_i2c_xfer(bus, addrdir, 0, 0, msgs->buf, msgs->len); |
167 | bail: | 165 | bail: |
168 | pmac_i2c_close(bus); | 166 | pmac_i2c_close(bus); |
169 | return rc < 0 ? rc : msgs->len; | 167 | return rc < 0 ? rc : 1; |
170 | } | 168 | } |
171 | 169 | ||
172 | static u32 i2c_powermac_func(struct i2c_adapter * adapter) | 170 | static u32 i2c_powermac_func(struct i2c_adapter * adapter) |
diff --git a/drivers/i2c/busses/scx200_acb.c b/drivers/i2c/busses/scx200_acb.c index 22a3eda04166..ced309ff056f 100644 --- a/drivers/i2c/busses/scx200_acb.c +++ b/drivers/i2c/busses/scx200_acb.c | |||
@@ -184,21 +184,21 @@ static void scx200_acb_machine(struct scx200_acb_iface *iface, u8 status) | |||
184 | break; | 184 | break; |
185 | 185 | ||
186 | case state_read: | 186 | case state_read: |
187 | /* Set ACK if receiving the last byte */ | 187 | /* Set ACK if _next_ byte will be the last one */ |
188 | if (iface->len == 1) | 188 | if (iface->len == 2) |
189 | outb(inb(ACBCTL1) | ACBCTL1_ACK, ACBCTL1); | 189 | outb(inb(ACBCTL1) | ACBCTL1_ACK, ACBCTL1); |
190 | else | 190 | else |
191 | outb(inb(ACBCTL1) & ~ACBCTL1_ACK, ACBCTL1); | 191 | outb(inb(ACBCTL1) & ~ACBCTL1_ACK, ACBCTL1); |
192 | 192 | ||
193 | *iface->ptr++ = inb(ACBSDA); | 193 | if (iface->len == 1) { |
194 | --iface->len; | ||
195 | |||
196 | if (iface->len == 0) { | ||
197 | iface->result = 0; | 194 | iface->result = 0; |
198 | iface->state = state_idle; | 195 | iface->state = state_idle; |
199 | outb(inb(ACBCTL1) | ACBCTL1_STOP, ACBCTL1); | 196 | outb(inb(ACBCTL1) | ACBCTL1_STOP, ACBCTL1); |
200 | } | 197 | } |
201 | 198 | ||
199 | *iface->ptr++ = inb(ACBSDA); | ||
200 | --iface->len; | ||
201 | |||
202 | break; | 202 | break; |
203 | 203 | ||
204 | case state_write: | 204 | case state_write: |
@@ -307,8 +307,12 @@ static s32 scx200_acb_smbus_xfer(struct i2c_adapter *adapter, | |||
307 | buffer = (u8 *)&cur_word; | 307 | buffer = (u8 *)&cur_word; |
308 | break; | 308 | break; |
309 | 309 | ||
310 | case I2C_SMBUS_BLOCK_DATA: | 310 | case I2C_SMBUS_I2C_BLOCK_DATA: |
311 | if (rw == I2C_SMBUS_READ) | ||
312 | data->block[0] = I2C_SMBUS_BLOCK_MAX; /* For now */ | ||
311 | len = data->block[0]; | 313 | len = data->block[0]; |
314 | if (len == 0 || len > I2C_SMBUS_BLOCK_MAX) | ||
315 | return -EINVAL; | ||
312 | buffer = &data->block[1]; | 316 | buffer = &data->block[1]; |
313 | break; | 317 | break; |
314 | 318 | ||
@@ -372,7 +376,7 @@ static u32 scx200_acb_func(struct i2c_adapter *adapter) | |||
372 | { | 376 | { |
373 | return I2C_FUNC_SMBUS_QUICK | I2C_FUNC_SMBUS_BYTE | | 377 | return I2C_FUNC_SMBUS_QUICK | I2C_FUNC_SMBUS_BYTE | |
374 | I2C_FUNC_SMBUS_BYTE_DATA | I2C_FUNC_SMBUS_WORD_DATA | | 378 | I2C_FUNC_SMBUS_BYTE_DATA | I2C_FUNC_SMBUS_WORD_DATA | |
375 | I2C_FUNC_SMBUS_BLOCK_DATA; | 379 | I2C_FUNC_SMBUS_I2C_BLOCK; |
376 | } | 380 | } |
377 | 381 | ||
378 | /* For now, we only handle combined mode (smbus) */ | 382 | /* For now, we only handle combined mode (smbus) */ |
diff --git a/drivers/i2c/chips/pca9539.c b/drivers/i2c/chips/pca9539.c index 54b6e6a4beed..cb22280cdd27 100644 --- a/drivers/i2c/chips/pca9539.c +++ b/drivers/i2c/chips/pca9539.c | |||
@@ -134,11 +134,13 @@ static int pca9539_detect(struct i2c_adapter *adapter, int address, int kind) | |||
134 | new_client->driver = &pca9539_driver; | 134 | new_client->driver = &pca9539_driver; |
135 | new_client->flags = 0; | 135 | new_client->flags = 0; |
136 | 136 | ||
137 | /* Detection: the pca9539 only has 8 registers (0-7). | 137 | if (kind < 0) { |
138 | A read of 7 should succeed, but a read of 8 should fail. */ | 138 | /* Detection: the pca9539 only has 8 registers (0-7). |
139 | if ((i2c_smbus_read_byte_data(new_client, 7) < 0) || | 139 | A read of 7 should succeed, but a read of 8 should fail. */ |
140 | (i2c_smbus_read_byte_data(new_client, 8) >= 0)) | 140 | if ((i2c_smbus_read_byte_data(new_client, 7) < 0) || |
141 | goto exit_kfree; | 141 | (i2c_smbus_read_byte_data(new_client, 8) >= 0)) |
142 | goto exit_kfree; | ||
143 | } | ||
142 | 144 | ||
143 | strlcpy(new_client->name, "pca9539", I2C_NAME_SIZE); | 145 | strlcpy(new_client->name, "pca9539", I2C_NAME_SIZE); |
144 | 146 | ||
diff --git a/drivers/i2c/i2c-core.c b/drivers/i2c/i2c-core.c index a45155f799d4..9cb277d6aa48 100644 --- a/drivers/i2c/i2c-core.c +++ b/drivers/i2c/i2c-core.c | |||
@@ -756,9 +756,9 @@ int i2c_probe(struct i2c_adapter *adapter, | |||
756 | "parameter for adapter %d, " | 756 | "parameter for adapter %d, " |
757 | "addr 0x%02x\n", adap_id, | 757 | "addr 0x%02x\n", adap_id, |
758 | address_data->ignore[j + 1]); | 758 | address_data->ignore[j + 1]); |
759 | ignore = 1; | ||
760 | break; | ||
759 | } | 761 | } |
760 | ignore = 1; | ||
761 | break; | ||
762 | } | 762 | } |
763 | if (ignore) | 763 | if (ignore) |
764 | continue; | 764 | continue; |
diff --git a/drivers/ide/legacy/ide-cs.c b/drivers/ide/legacy/ide-cs.c index b7e459e4f284..602797a44208 100644 --- a/drivers/ide/legacy/ide-cs.c +++ b/drivers/ide/legacy/ide-cs.c | |||
@@ -146,16 +146,7 @@ static void ide_detach(struct pcmcia_device *link) | |||
146 | kfree(link->priv); | 146 | kfree(link->priv); |
147 | } /* ide_detach */ | 147 | } /* ide_detach */ |
148 | 148 | ||
149 | static void idecs_mmio_fixup(ide_hwif_t *hwif) | 149 | static int idecs_register(unsigned long io, unsigned long ctl, unsigned long irq, struct pcmcia_device *handle) |
150 | { | ||
151 | default_hwif_mmiops(hwif); | ||
152 | hwif->mmio = 2; | ||
153 | |||
154 | ide_undecoded_slave(hwif); | ||
155 | } | ||
156 | |||
157 | static int idecs_register(unsigned long io, unsigned long ctl, | ||
158 | unsigned long irq, struct pcmcia_device *handle, int is_mmio) | ||
159 | { | 150 | { |
160 | hw_regs_t hw; | 151 | hw_regs_t hw; |
161 | memset(&hw, 0, sizeof(hw)); | 152 | memset(&hw, 0, sizeof(hw)); |
@@ -163,19 +154,7 @@ static int idecs_register(unsigned long io, unsigned long ctl, | |||
163 | hw.irq = irq; | 154 | hw.irq = irq; |
164 | hw.chipset = ide_pci; | 155 | hw.chipset = ide_pci; |
165 | hw.dev = &handle->dev; | 156 | hw.dev = &handle->dev; |
166 | 157 | return ide_register_hw_with_fixup(&hw, NULL, ide_undecoded_slave); | |
167 | if(is_mmio) | ||
168 | return ide_register_hw_with_fixup(&hw, NULL, idecs_mmio_fixup); | ||
169 | else | ||
170 | return ide_register_hw_with_fixup(&hw, NULL, ide_undecoded_slave); | ||
171 | } | ||
172 | |||
173 | void outb_io(unsigned char value, unsigned long port) { | ||
174 | outb(value, port); | ||
175 | } | ||
176 | |||
177 | void outb_mem(unsigned char value, unsigned long port) { | ||
178 | writeb(value, (void __iomem *) port); | ||
179 | } | 158 | } |
180 | 159 | ||
181 | /*====================================================================== | 160 | /*====================================================================== |
@@ -201,8 +180,7 @@ static int ide_config(struct pcmcia_device *link) | |||
201 | } *stk = NULL; | 180 | } *stk = NULL; |
202 | cistpl_cftable_entry_t *cfg; | 181 | cistpl_cftable_entry_t *cfg; |
203 | int i, pass, last_ret = 0, last_fn = 0, hd, is_kme = 0; | 182 | int i, pass, last_ret = 0, last_fn = 0, hd, is_kme = 0; |
204 | unsigned long io_base, ctl_base, is_mmio, try_slave; | 183 | unsigned long io_base, ctl_base; |
205 | void (*my_outb)(unsigned char, unsigned long); | ||
206 | 184 | ||
207 | DEBUG(0, "ide_config(0x%p)\n", link); | 185 | DEBUG(0, "ide_config(0x%p)\n", link); |
208 | 186 | ||
@@ -232,7 +210,7 @@ static int ide_config(struct pcmcia_device *link) | |||
232 | /* Not sure if this is right... look up the current Vcc */ | 210 | /* Not sure if this is right... look up the current Vcc */ |
233 | CS_CHECK(GetConfigurationInfo, pcmcia_get_configuration_info(link, &stk->conf)); | 211 | CS_CHECK(GetConfigurationInfo, pcmcia_get_configuration_info(link, &stk->conf)); |
234 | 212 | ||
235 | pass = io_base = ctl_base = is_mmio = try_slave = 0; | 213 | pass = io_base = ctl_base = 0; |
236 | tuple.DesiredTuple = CISTPL_CFTABLE_ENTRY; | 214 | tuple.DesiredTuple = CISTPL_CFTABLE_ENTRY; |
237 | tuple.Attributes = 0; | 215 | tuple.Attributes = 0; |
238 | CS_CHECK(GetFirstTuple, pcmcia_get_first_tuple(link, &tuple)); | 216 | CS_CHECK(GetFirstTuple, pcmcia_get_first_tuple(link, &tuple)); |
@@ -280,45 +258,11 @@ static int ide_config(struct pcmcia_device *link) | |||
280 | goto next_entry; | 258 | goto next_entry; |
281 | io_base = link->io.BasePort1; | 259 | io_base = link->io.BasePort1; |
282 | ctl_base = link->io.BasePort1 + 0x0e; | 260 | ctl_base = link->io.BasePort1 + 0x0e; |
283 | |||
284 | if (io->win[0].len >= 0x20) | ||
285 | try_slave = 1; | ||
286 | |||
287 | } else goto next_entry; | 261 | } else goto next_entry; |
288 | /* If we've got this far, we're done */ | 262 | /* If we've got this far, we're done */ |
289 | break; | 263 | break; |
290 | } | 264 | } |
291 | 265 | ||
292 | if ((cfg->mem.nwin > 0) || (stk->dflt.mem.nwin > 0)) { | ||
293 | win_req_t req; | ||
294 | memreq_t map; | ||
295 | cistpl_mem_t *mem = (cfg->mem.nwin) ? &cfg->mem : &stk->dflt.mem; | ||
296 | |||
297 | if (mem->win[0].len < 16) | ||
298 | goto next_entry; | ||
299 | |||
300 | req.Attributes = WIN_DATA_WIDTH_16|WIN_MEMORY_TYPE_CM; | ||
301 | req.Attributes |= WIN_ENABLE; | ||
302 | req.Base = mem->win[0].host_addr; | ||
303 | req.Size = 0; | ||
304 | |||
305 | req.AccessSpeed = 0; | ||
306 | if (pcmcia_request_window(&link, &req, &link->win) != 0) | ||
307 | goto next_entry; | ||
308 | map.Page = 0; map.CardOffset = mem->win[0].card_addr; | ||
309 | if (pcmcia_map_mem_page(link->win, &map) != 0) | ||
310 | goto next_entry; | ||
311 | |||
312 | io_base = (unsigned long) ioremap(req.Base, req.Size); | ||
313 | ctl_base = io_base + 0x0e; | ||
314 | is_mmio = 1; | ||
315 | |||
316 | if (mem->win[0].len >= 0x20) | ||
317 | try_slave = 1; | ||
318 | |||
319 | break; | ||
320 | } | ||
321 | |||
322 | next_entry: | 266 | next_entry: |
323 | if (cfg->flags & CISTPL_CFTABLE_DEFAULT) | 267 | if (cfg->flags & CISTPL_CFTABLE_DEFAULT) |
324 | memcpy(&stk->dflt, cfg, sizeof(stk->dflt)); | 268 | memcpy(&stk->dflt, cfg, sizeof(stk->dflt)); |
@@ -334,26 +278,21 @@ static int ide_config(struct pcmcia_device *link) | |||
334 | CS_CHECK(RequestIRQ, pcmcia_request_irq(link, &link->irq)); | 278 | CS_CHECK(RequestIRQ, pcmcia_request_irq(link, &link->irq)); |
335 | CS_CHECK(RequestConfiguration, pcmcia_request_configuration(link, &link->conf)); | 279 | CS_CHECK(RequestConfiguration, pcmcia_request_configuration(link, &link->conf)); |
336 | 280 | ||
337 | if(is_mmio) | ||
338 | my_outb = outb_mem; | ||
339 | else | ||
340 | my_outb = outb_io; | ||
341 | |||
342 | /* disable drive interrupts during IDE probe */ | 281 | /* disable drive interrupts during IDE probe */ |
343 | my_outb(0x02, ctl_base); | 282 | outb(0x02, ctl_base); |
344 | 283 | ||
345 | /* special setup for KXLC005 card */ | 284 | /* special setup for KXLC005 card */ |
346 | if (is_kme) | 285 | if (is_kme) |
347 | my_outb(0x81, ctl_base+1); | 286 | outb(0x81, ctl_base+1); |
348 | 287 | ||
349 | /* retry registration in case device is still spinning up */ | 288 | /* retry registration in case device is still spinning up */ |
350 | for (hd = -1, i = 0; i < 10; i++) { | 289 | for (hd = -1, i = 0; i < 10; i++) { |
351 | hd = idecs_register(io_base, ctl_base, link->irq.AssignedIRQ, link, is_mmio); | 290 | hd = idecs_register(io_base, ctl_base, link->irq.AssignedIRQ, link); |
352 | if (hd >= 0) break; | 291 | if (hd >= 0) break; |
353 | if (try_slave) { | 292 | if (link->io.NumPorts1 == 0x20) { |
354 | my_outb(0x02, ctl_base + 0x10); | 293 | outb(0x02, ctl_base + 0x10); |
355 | hd = idecs_register(io_base + 0x10, ctl_base + 0x10, | 294 | hd = idecs_register(io_base + 0x10, ctl_base + 0x10, |
356 | link->irq.AssignedIRQ, link, is_mmio); | 295 | link->irq.AssignedIRQ, link); |
357 | if (hd >= 0) { | 296 | if (hd >= 0) { |
358 | io_base += 0x10; | 297 | io_base += 0x10; |
359 | ctl_base += 0x10; | 298 | ctl_base += 0x10; |
diff --git a/drivers/ide/pci/generic.c b/drivers/ide/pci/generic.c index f82e82109728..2f962cfa3f7f 100644 --- a/drivers/ide/pci/generic.c +++ b/drivers/ide/pci/generic.c | |||
@@ -212,6 +212,9 @@ static int __devinit generic_init_one(struct pci_dev *dev, const struct pci_devi | |||
212 | (!(PCI_FUNC(dev->devfn) & 1))) | 212 | (!(PCI_FUNC(dev->devfn) & 1))) |
213 | goto out; | 213 | goto out; |
214 | 214 | ||
215 | if (dev->vendor == PCI_VENDOR_ID_JMICRON && PCI_FUNC(dev->devfn) != 1) | ||
216 | goto out; | ||
217 | |||
215 | pci_read_config_word(dev, PCI_COMMAND, &command); | 218 | pci_read_config_word(dev, PCI_COMMAND, &command); |
216 | if (!(command & PCI_COMMAND_IO)) { | 219 | if (!(command & PCI_COMMAND_IO)) { |
217 | printk(KERN_INFO "Skipping disabled %s IDE controller.\n", d->name); | 220 | printk(KERN_INFO "Skipping disabled %s IDE controller.\n", d->name); |
@@ -239,6 +242,11 @@ static struct pci_device_id generic_pci_tbl[] = { | |||
239 | { PCI_VENDOR_ID_TOSHIBA,PCI_DEVICE_ID_TOSHIBA_PICCOLO_1, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 12}, | 242 | { PCI_VENDOR_ID_TOSHIBA,PCI_DEVICE_ID_TOSHIBA_PICCOLO_1, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 12}, |
240 | { PCI_VENDOR_ID_TOSHIBA,PCI_DEVICE_ID_TOSHIBA_PICCOLO_2, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 13}, | 243 | { PCI_VENDOR_ID_TOSHIBA,PCI_DEVICE_ID_TOSHIBA_PICCOLO_2, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 13}, |
241 | { PCI_VENDOR_ID_NETCELL,PCI_DEVICE_ID_REVOLUTION, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 14}, | 244 | { PCI_VENDOR_ID_NETCELL,PCI_DEVICE_ID_REVOLUTION, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 14}, |
245 | { PCI_VENDOR_ID_JMICRON, PCI_DEVICE_ID_JMICRON_JMB361, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 15}, | ||
246 | { PCI_VENDOR_ID_JMICRON, PCI_DEVICE_ID_JMICRON_JMB363, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 16}, | ||
247 | { PCI_VENDOR_ID_JMICRON, PCI_DEVICE_ID_JMICRON_JMB365, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 17}, | ||
248 | { PCI_VENDOR_ID_JMICRON, PCI_DEVICE_ID_JMICRON_JMB366, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 18}, | ||
249 | { PCI_VENDOR_ID_JMICRON, PCI_DEVICE_ID_JMICRON_JMB368, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 19}, | ||
242 | /* Must come last. If you add entries adjust this table appropriately and the init_one code */ | 250 | /* Must come last. If you add entries adjust this table appropriately and the init_one code */ |
243 | { PCI_ANY_ID, PCI_ANY_ID, PCI_ANY_ID, PCI_ANY_ID, PCI_CLASS_STORAGE_IDE << 8, 0xFFFFFF00UL, 0}, | 251 | { PCI_ANY_ID, PCI_ANY_ID, PCI_ANY_ID, PCI_ANY_ID, PCI_CLASS_STORAGE_IDE << 8, 0xFFFFFF00UL, 0}, |
244 | { 0, }, | 252 | { 0, }, |
diff --git a/drivers/infiniband/core/cm.c b/drivers/infiniband/core/cm.c index 3f6705f3083a..f85c97f7500a 100644 --- a/drivers/infiniband/core/cm.c +++ b/drivers/infiniband/core/cm.c | |||
@@ -701,7 +701,7 @@ static void cm_reset_to_idle(struct cm_id_private *cm_id_priv) | |||
701 | } | 701 | } |
702 | } | 702 | } |
703 | 703 | ||
704 | void ib_destroy_cm_id(struct ib_cm_id *cm_id) | 704 | static void cm_destroy_id(struct ib_cm_id *cm_id, int err) |
705 | { | 705 | { |
706 | struct cm_id_private *cm_id_priv; | 706 | struct cm_id_private *cm_id_priv; |
707 | struct cm_work *work; | 707 | struct cm_work *work; |
@@ -735,12 +735,22 @@ retest: | |||
735 | sizeof cm_id_priv->av.port->cm_dev->ca_guid, | 735 | sizeof cm_id_priv->av.port->cm_dev->ca_guid, |
736 | NULL, 0); | 736 | NULL, 0); |
737 | break; | 737 | break; |
738 | case IB_CM_REQ_RCVD: | ||
739 | if (err == -ENOMEM) { | ||
740 | /* Do not reject to allow future retries. */ | ||
741 | cm_reset_to_idle(cm_id_priv); | ||
742 | spin_unlock_irqrestore(&cm_id_priv->lock, flags); | ||
743 | } else { | ||
744 | spin_unlock_irqrestore(&cm_id_priv->lock, flags); | ||
745 | ib_send_cm_rej(cm_id, IB_CM_REJ_CONSUMER_DEFINED, | ||
746 | NULL, 0, NULL, 0); | ||
747 | } | ||
748 | break; | ||
738 | case IB_CM_MRA_REQ_RCVD: | 749 | case IB_CM_MRA_REQ_RCVD: |
739 | case IB_CM_REP_SENT: | 750 | case IB_CM_REP_SENT: |
740 | case IB_CM_MRA_REP_RCVD: | 751 | case IB_CM_MRA_REP_RCVD: |
741 | ib_cancel_mad(cm_id_priv->av.port->mad_agent, cm_id_priv->msg); | 752 | ib_cancel_mad(cm_id_priv->av.port->mad_agent, cm_id_priv->msg); |
742 | /* Fall through */ | 753 | /* Fall through */ |
743 | case IB_CM_REQ_RCVD: | ||
744 | case IB_CM_MRA_REQ_SENT: | 754 | case IB_CM_MRA_REQ_SENT: |
745 | case IB_CM_REP_RCVD: | 755 | case IB_CM_REP_RCVD: |
746 | case IB_CM_MRA_REP_SENT: | 756 | case IB_CM_MRA_REP_SENT: |
@@ -775,6 +785,11 @@ retest: | |||
775 | kfree(cm_id_priv->private_data); | 785 | kfree(cm_id_priv->private_data); |
776 | kfree(cm_id_priv); | 786 | kfree(cm_id_priv); |
777 | } | 787 | } |
788 | |||
789 | void ib_destroy_cm_id(struct ib_cm_id *cm_id) | ||
790 | { | ||
791 | cm_destroy_id(cm_id, 0); | ||
792 | } | ||
778 | EXPORT_SYMBOL(ib_destroy_cm_id); | 793 | EXPORT_SYMBOL(ib_destroy_cm_id); |
779 | 794 | ||
780 | int ib_cm_listen(struct ib_cm_id *cm_id, __be64 service_id, __be64 service_mask, | 795 | int ib_cm_listen(struct ib_cm_id *cm_id, __be64 service_id, __be64 service_mask, |
@@ -1163,7 +1178,7 @@ static void cm_process_work(struct cm_id_private *cm_id_priv, | |||
1163 | } | 1178 | } |
1164 | cm_deref_id(cm_id_priv); | 1179 | cm_deref_id(cm_id_priv); |
1165 | if (ret) | 1180 | if (ret) |
1166 | ib_destroy_cm_id(&cm_id_priv->id); | 1181 | cm_destroy_id(&cm_id_priv->id, ret); |
1167 | } | 1182 | } |
1168 | 1183 | ||
1169 | static void cm_format_mra(struct cm_mra_msg *mra_msg, | 1184 | static void cm_format_mra(struct cm_mra_msg *mra_msg, |
diff --git a/drivers/infiniband/core/cma.c b/drivers/infiniband/core/cma.c index 863f64befc7c..d6f99d5720fc 100644 --- a/drivers/infiniband/core/cma.c +++ b/drivers/infiniband/core/cma.c | |||
@@ -262,14 +262,14 @@ static void cma_detach_from_dev(struct rdma_id_private *id_priv) | |||
262 | static int cma_acquire_ib_dev(struct rdma_id_private *id_priv) | 262 | static int cma_acquire_ib_dev(struct rdma_id_private *id_priv) |
263 | { | 263 | { |
264 | struct cma_device *cma_dev; | 264 | struct cma_device *cma_dev; |
265 | union ib_gid *gid; | 265 | union ib_gid gid; |
266 | int ret = -ENODEV; | 266 | int ret = -ENODEV; |
267 | 267 | ||
268 | gid = ib_addr_get_sgid(&id_priv->id.route.addr.dev_addr); | 268 | ib_addr_get_sgid(&id_priv->id.route.addr.dev_addr, &gid), |
269 | 269 | ||
270 | mutex_lock(&lock); | 270 | mutex_lock(&lock); |
271 | list_for_each_entry(cma_dev, &dev_list, list) { | 271 | list_for_each_entry(cma_dev, &dev_list, list) { |
272 | ret = ib_find_cached_gid(cma_dev->device, gid, | 272 | ret = ib_find_cached_gid(cma_dev->device, &gid, |
273 | &id_priv->id.port_num, NULL); | 273 | &id_priv->id.port_num, NULL); |
274 | if (!ret) { | 274 | if (!ret) { |
275 | cma_attach_to_dev(id_priv, cma_dev); | 275 | cma_attach_to_dev(id_priv, cma_dev); |
@@ -812,6 +812,7 @@ static int cma_ib_handler(struct ib_cm_id *cm_id, struct ib_cm_event *ib_event) | |||
812 | cma_modify_qp_err(&id_priv->id); | 812 | cma_modify_qp_err(&id_priv->id); |
813 | status = ib_event->param.rej_rcvd.reason; | 813 | status = ib_event->param.rej_rcvd.reason; |
814 | event = RDMA_CM_EVENT_REJECTED; | 814 | event = RDMA_CM_EVENT_REJECTED; |
815 | private_data_len = IB_CM_REJ_PRIVATE_DATA_SIZE; | ||
815 | break; | 816 | break; |
816 | default: | 817 | default: |
817 | printk(KERN_ERR "RDMA CMA: unexpected IB CM event: %d", | 818 | printk(KERN_ERR "RDMA CMA: unexpected IB CM event: %d", |
@@ -1134,8 +1135,8 @@ static int cma_query_ib_route(struct rdma_id_private *id_priv, int timeout_ms, | |||
1134 | struct ib_sa_path_rec path_rec; | 1135 | struct ib_sa_path_rec path_rec; |
1135 | 1136 | ||
1136 | memset(&path_rec, 0, sizeof path_rec); | 1137 | memset(&path_rec, 0, sizeof path_rec); |
1137 | path_rec.sgid = *ib_addr_get_sgid(addr); | 1138 | ib_addr_get_sgid(addr, &path_rec.sgid); |
1138 | path_rec.dgid = *ib_addr_get_dgid(addr); | 1139 | ib_addr_get_dgid(addr, &path_rec.dgid); |
1139 | path_rec.pkey = cpu_to_be16(ib_addr_get_pkey(addr)); | 1140 | path_rec.pkey = cpu_to_be16(ib_addr_get_pkey(addr)); |
1140 | path_rec.numb_path = 1; | 1141 | path_rec.numb_path = 1; |
1141 | 1142 | ||
@@ -1263,7 +1264,7 @@ static int cma_bind_loopback(struct rdma_id_private *id_priv) | |||
1263 | { | 1264 | { |
1264 | struct cma_device *cma_dev; | 1265 | struct cma_device *cma_dev; |
1265 | struct ib_port_attr port_attr; | 1266 | struct ib_port_attr port_attr; |
1266 | union ib_gid *gid; | 1267 | union ib_gid gid; |
1267 | u16 pkey; | 1268 | u16 pkey; |
1268 | int ret; | 1269 | int ret; |
1269 | u8 p; | 1270 | u8 p; |
@@ -1284,8 +1285,7 @@ static int cma_bind_loopback(struct rdma_id_private *id_priv) | |||
1284 | } | 1285 | } |
1285 | 1286 | ||
1286 | port_found: | 1287 | port_found: |
1287 | gid = ib_addr_get_sgid(&id_priv->id.route.addr.dev_addr); | 1288 | ret = ib_get_cached_gid(cma_dev->device, p, 0, &gid); |
1288 | ret = ib_get_cached_gid(cma_dev->device, p, 0, gid); | ||
1289 | if (ret) | 1289 | if (ret) |
1290 | goto out; | 1290 | goto out; |
1291 | 1291 | ||
@@ -1293,6 +1293,7 @@ port_found: | |||
1293 | if (ret) | 1293 | if (ret) |
1294 | goto out; | 1294 | goto out; |
1295 | 1295 | ||
1296 | ib_addr_set_sgid(&id_priv->id.route.addr.dev_addr, &gid); | ||
1296 | ib_addr_set_pkey(&id_priv->id.route.addr.dev_addr, pkey); | 1297 | ib_addr_set_pkey(&id_priv->id.route.addr.dev_addr, pkey); |
1297 | id_priv->id.port_num = p; | 1298 | id_priv->id.port_num = p; |
1298 | cma_attach_to_dev(id_priv, cma_dev); | 1299 | cma_attach_to_dev(id_priv, cma_dev); |
@@ -1339,6 +1340,7 @@ static int cma_resolve_loopback(struct rdma_id_private *id_priv) | |||
1339 | { | 1340 | { |
1340 | struct cma_work *work; | 1341 | struct cma_work *work; |
1341 | struct sockaddr_in *src_in, *dst_in; | 1342 | struct sockaddr_in *src_in, *dst_in; |
1343 | union ib_gid gid; | ||
1342 | int ret; | 1344 | int ret; |
1343 | 1345 | ||
1344 | work = kzalloc(sizeof *work, GFP_KERNEL); | 1346 | work = kzalloc(sizeof *work, GFP_KERNEL); |
@@ -1351,8 +1353,8 @@ static int cma_resolve_loopback(struct rdma_id_private *id_priv) | |||
1351 | goto err; | 1353 | goto err; |
1352 | } | 1354 | } |
1353 | 1355 | ||
1354 | ib_addr_set_dgid(&id_priv->id.route.addr.dev_addr, | 1356 | ib_addr_get_sgid(&id_priv->id.route.addr.dev_addr, &gid); |
1355 | ib_addr_get_sgid(&id_priv->id.route.addr.dev_addr)); | 1357 | ib_addr_set_dgid(&id_priv->id.route.addr.dev_addr, &gid); |
1356 | 1358 | ||
1357 | if (cma_zero_addr(&id_priv->id.route.addr.src_addr)) { | 1359 | if (cma_zero_addr(&id_priv->id.route.addr.src_addr)) { |
1358 | src_in = (struct sockaddr_in *)&id_priv->id.route.addr.src_addr; | 1360 | src_in = (struct sockaddr_in *)&id_priv->id.route.addr.src_addr; |
diff --git a/drivers/infiniband/core/fmr_pool.c b/drivers/infiniband/core/fmr_pool.c index 615fe9cc6c56..86a3b2d401db 100644 --- a/drivers/infiniband/core/fmr_pool.c +++ b/drivers/infiniband/core/fmr_pool.c | |||
@@ -426,7 +426,7 @@ EXPORT_SYMBOL(ib_flush_fmr_pool); | |||
426 | struct ib_pool_fmr *ib_fmr_pool_map_phys(struct ib_fmr_pool *pool_handle, | 426 | struct ib_pool_fmr *ib_fmr_pool_map_phys(struct ib_fmr_pool *pool_handle, |
427 | u64 *page_list, | 427 | u64 *page_list, |
428 | int list_len, | 428 | int list_len, |
429 | u64 *io_virtual_address) | 429 | u64 io_virtual_address) |
430 | { | 430 | { |
431 | struct ib_fmr_pool *pool = pool_handle; | 431 | struct ib_fmr_pool *pool = pool_handle; |
432 | struct ib_pool_fmr *fmr; | 432 | struct ib_pool_fmr *fmr; |
@@ -440,7 +440,7 @@ struct ib_pool_fmr *ib_fmr_pool_map_phys(struct ib_fmr_pool *pool_handle, | |||
440 | fmr = ib_fmr_cache_lookup(pool, | 440 | fmr = ib_fmr_cache_lookup(pool, |
441 | page_list, | 441 | page_list, |
442 | list_len, | 442 | list_len, |
443 | *io_virtual_address); | 443 | io_virtual_address); |
444 | if (fmr) { | 444 | if (fmr) { |
445 | /* found in cache */ | 445 | /* found in cache */ |
446 | ++fmr->ref_count; | 446 | ++fmr->ref_count; |
@@ -464,7 +464,7 @@ struct ib_pool_fmr *ib_fmr_pool_map_phys(struct ib_fmr_pool *pool_handle, | |||
464 | spin_unlock_irqrestore(&pool->pool_lock, flags); | 464 | spin_unlock_irqrestore(&pool->pool_lock, flags); |
465 | 465 | ||
466 | result = ib_map_phys_fmr(fmr->fmr, page_list, list_len, | 466 | result = ib_map_phys_fmr(fmr->fmr, page_list, list_len, |
467 | *io_virtual_address); | 467 | io_virtual_address); |
468 | 468 | ||
469 | if (result) { | 469 | if (result) { |
470 | spin_lock_irqsave(&pool->pool_lock, flags); | 470 | spin_lock_irqsave(&pool->pool_lock, flags); |
@@ -481,7 +481,7 @@ struct ib_pool_fmr *ib_fmr_pool_map_phys(struct ib_fmr_pool *pool_handle, | |||
481 | fmr->ref_count = 1; | 481 | fmr->ref_count = 1; |
482 | 482 | ||
483 | if (pool->cache_bucket) { | 483 | if (pool->cache_bucket) { |
484 | fmr->io_virtual_address = *io_virtual_address; | 484 | fmr->io_virtual_address = io_virtual_address; |
485 | fmr->page_list_len = list_len; | 485 | fmr->page_list_len = list_len; |
486 | memcpy(fmr->page_list, page_list, list_len * sizeof(*page_list)); | 486 | memcpy(fmr->page_list, page_list, list_len * sizeof(*page_list)); |
487 | 487 | ||
diff --git a/drivers/infiniband/core/sa_query.c b/drivers/infiniband/core/sa_query.c index e911c99ff843..aeda484ffd82 100644 --- a/drivers/infiniband/core/sa_query.c +++ b/drivers/infiniband/core/sa_query.c | |||
@@ -488,13 +488,13 @@ static void init_mad(struct ib_sa_mad *mad, struct ib_mad_agent *agent) | |||
488 | spin_unlock_irqrestore(&tid_lock, flags); | 488 | spin_unlock_irqrestore(&tid_lock, flags); |
489 | } | 489 | } |
490 | 490 | ||
491 | static int send_mad(struct ib_sa_query *query, int timeout_ms) | 491 | static int send_mad(struct ib_sa_query *query, int timeout_ms, gfp_t gfp_mask) |
492 | { | 492 | { |
493 | unsigned long flags; | 493 | unsigned long flags; |
494 | int ret, id; | 494 | int ret, id; |
495 | 495 | ||
496 | retry: | 496 | retry: |
497 | if (!idr_pre_get(&query_idr, GFP_ATOMIC)) | 497 | if (!idr_pre_get(&query_idr, gfp_mask)) |
498 | return -ENOMEM; | 498 | return -ENOMEM; |
499 | spin_lock_irqsave(&idr_lock, flags); | 499 | spin_lock_irqsave(&idr_lock, flags); |
500 | ret = idr_get_new(&query_idr, query, &id); | 500 | ret = idr_get_new(&query_idr, query, &id); |
@@ -630,7 +630,7 @@ int ib_sa_path_rec_get(struct ib_device *device, u8 port_num, | |||
630 | 630 | ||
631 | *sa_query = &query->sa_query; | 631 | *sa_query = &query->sa_query; |
632 | 632 | ||
633 | ret = send_mad(&query->sa_query, timeout_ms); | 633 | ret = send_mad(&query->sa_query, timeout_ms, gfp_mask); |
634 | if (ret < 0) | 634 | if (ret < 0) |
635 | goto err2; | 635 | goto err2; |
636 | 636 | ||
@@ -752,7 +752,7 @@ int ib_sa_service_rec_query(struct ib_device *device, u8 port_num, u8 method, | |||
752 | 752 | ||
753 | *sa_query = &query->sa_query; | 753 | *sa_query = &query->sa_query; |
754 | 754 | ||
755 | ret = send_mad(&query->sa_query, timeout_ms); | 755 | ret = send_mad(&query->sa_query, timeout_ms, gfp_mask); |
756 | if (ret < 0) | 756 | if (ret < 0) |
757 | goto err2; | 757 | goto err2; |
758 | 758 | ||
@@ -844,7 +844,7 @@ int ib_sa_mcmember_rec_query(struct ib_device *device, u8 port_num, | |||
844 | 844 | ||
845 | *sa_query = &query->sa_query; | 845 | *sa_query = &query->sa_query; |
846 | 846 | ||
847 | ret = send_mad(&query->sa_query, timeout_ms); | 847 | ret = send_mad(&query->sa_query, timeout_ms, gfp_mask); |
848 | if (ret < 0) | 848 | if (ret < 0) |
849 | goto err2; | 849 | goto err2; |
850 | 850 | ||
diff --git a/drivers/infiniband/hw/mthca/mthca_av.c b/drivers/infiniband/hw/mthca/mthca_av.c index b12aa03be251..e215041b2db9 100644 --- a/drivers/infiniband/hw/mthca/mthca_av.c +++ b/drivers/infiniband/hw/mthca/mthca_av.c | |||
@@ -303,9 +303,10 @@ int mthca_ah_query(struct ib_ah *ibah, struct ib_ah_attr *attr) | |||
303 | memset(attr, 0, sizeof *attr); | 303 | memset(attr, 0, sizeof *attr); |
304 | attr->dlid = be16_to_cpu(ah->av->dlid); | 304 | attr->dlid = be16_to_cpu(ah->av->dlid); |
305 | attr->sl = be32_to_cpu(ah->av->sl_tclass_flowlabel) >> 28; | 305 | attr->sl = be32_to_cpu(ah->av->sl_tclass_flowlabel) >> 28; |
306 | attr->static_rate = ah->av->msg_sr & 0x7; | ||
307 | attr->src_path_bits = ah->av->g_slid & 0x7F; | ||
308 | attr->port_num = be32_to_cpu(ah->av->port_pd) >> 24; | 306 | attr->port_num = be32_to_cpu(ah->av->port_pd) >> 24; |
307 | attr->static_rate = mthca_rate_to_ib(dev, ah->av->msg_sr & 0x7, | ||
308 | attr->port_num); | ||
309 | attr->src_path_bits = ah->av->g_slid & 0x7F; | ||
309 | attr->ah_flags = mthca_ah_grh_present(ah) ? IB_AH_GRH : 0; | 310 | attr->ah_flags = mthca_ah_grh_present(ah) ? IB_AH_GRH : 0; |
310 | 311 | ||
311 | if (attr->ah_flags) { | 312 | if (attr->ah_flags) { |
diff --git a/drivers/infiniband/hw/mthca/mthca_qp.c b/drivers/infiniband/hw/mthca/mthca_qp.c index 490fc783bb0c..cd8b6721ac9c 100644 --- a/drivers/infiniband/hw/mthca/mthca_qp.c +++ b/drivers/infiniband/hw/mthca/mthca_qp.c | |||
@@ -222,9 +222,8 @@ static void *get_send_wqe(struct mthca_qp *qp, int n) | |||
222 | (PAGE_SIZE - 1)); | 222 | (PAGE_SIZE - 1)); |
223 | } | 223 | } |
224 | 224 | ||
225 | static void mthca_wq_init(struct mthca_wq *wq) | 225 | static void mthca_wq_reset(struct mthca_wq *wq) |
226 | { | 226 | { |
227 | /* mthca_alloc_qp_common() initializes the locks */ | ||
228 | wq->next_ind = 0; | 227 | wq->next_ind = 0; |
229 | wq->last_comp = wq->max - 1; | 228 | wq->last_comp = wq->max - 1; |
230 | wq->head = 0; | 229 | wq->head = 0; |
@@ -845,10 +844,10 @@ int mthca_modify_qp(struct ib_qp *ibqp, struct ib_qp_attr *attr, int attr_mask) | |||
845 | mthca_cq_clean(dev, to_mcq(qp->ibqp.recv_cq), qp->qpn, | 844 | mthca_cq_clean(dev, to_mcq(qp->ibqp.recv_cq), qp->qpn, |
846 | qp->ibqp.srq ? to_msrq(qp->ibqp.srq) : NULL); | 845 | qp->ibqp.srq ? to_msrq(qp->ibqp.srq) : NULL); |
847 | 846 | ||
848 | mthca_wq_init(&qp->sq); | 847 | mthca_wq_reset(&qp->sq); |
849 | qp->sq.last = get_send_wqe(qp, qp->sq.max - 1); | 848 | qp->sq.last = get_send_wqe(qp, qp->sq.max - 1); |
850 | 849 | ||
851 | mthca_wq_init(&qp->rq); | 850 | mthca_wq_reset(&qp->rq); |
852 | qp->rq.last = get_recv_wqe(qp, qp->rq.max - 1); | 851 | qp->rq.last = get_recv_wqe(qp, qp->rq.max - 1); |
853 | 852 | ||
854 | if (mthca_is_memfree(dev)) { | 853 | if (mthca_is_memfree(dev)) { |
@@ -1112,9 +1111,9 @@ static int mthca_alloc_qp_common(struct mthca_dev *dev, | |||
1112 | qp->atomic_rd_en = 0; | 1111 | qp->atomic_rd_en = 0; |
1113 | qp->resp_depth = 0; | 1112 | qp->resp_depth = 0; |
1114 | qp->sq_policy = send_policy; | 1113 | qp->sq_policy = send_policy; |
1115 | mthca_wq_init(&qp->sq); | 1114 | mthca_wq_reset(&qp->sq); |
1116 | mthca_wq_init(&qp->rq); | 1115 | mthca_wq_reset(&qp->rq); |
1117 | /* these are initialized separately so lockdep can tell them apart */ | 1116 | |
1118 | spin_lock_init(&qp->sq.lock); | 1117 | spin_lock_init(&qp->sq.lock); |
1119 | spin_lock_init(&qp->rq.lock); | 1118 | spin_lock_init(&qp->rq.lock); |
1120 | 1119 | ||
diff --git a/drivers/infiniband/ulp/iser/iser_verbs.c b/drivers/infiniband/ulp/iser/iser_verbs.c index ff117bbf81b4..72febf1f8ff8 100644 --- a/drivers/infiniband/ulp/iser/iser_verbs.c +++ b/drivers/infiniband/ulp/iser/iser_verbs.c | |||
@@ -594,7 +594,7 @@ int iser_reg_page_vec(struct iser_conn *ib_conn, | |||
594 | mem = ib_fmr_pool_map_phys(ib_conn->fmr_pool, | 594 | mem = ib_fmr_pool_map_phys(ib_conn->fmr_pool, |
595 | page_list, | 595 | page_list, |
596 | page_vec->length, | 596 | page_vec->length, |
597 | &io_addr); | 597 | io_addr); |
598 | 598 | ||
599 | if (IS_ERR(mem)) { | 599 | if (IS_ERR(mem)) { |
600 | status = (int)PTR_ERR(mem); | 600 | status = (int)PTR_ERR(mem); |
diff --git a/drivers/infiniband/ulp/srp/ib_srp.c b/drivers/infiniband/ulp/srp/ib_srp.c index 4e22afef7206..8f472e7113b4 100644 --- a/drivers/infiniband/ulp/srp/ib_srp.c +++ b/drivers/infiniband/ulp/srp/ib_srp.c | |||
@@ -615,9 +615,10 @@ static int srp_map_fmr(struct srp_device *dev, struct scatterlist *scat, | |||
615 | (sg_dma_address(&scat[i]) & dev->fmr_page_mask) + j; | 615 | (sg_dma_address(&scat[i]) & dev->fmr_page_mask) + j; |
616 | 616 | ||
617 | req->fmr = ib_fmr_pool_map_phys(dev->fmr_pool, | 617 | req->fmr = ib_fmr_pool_map_phys(dev->fmr_pool, |
618 | dma_pages, page_cnt, &io_addr); | 618 | dma_pages, page_cnt, io_addr); |
619 | if (IS_ERR(req->fmr)) { | 619 | if (IS_ERR(req->fmr)) { |
620 | ret = PTR_ERR(req->fmr); | 620 | ret = PTR_ERR(req->fmr); |
621 | req->fmr = NULL; | ||
621 | goto out; | 622 | goto out; |
622 | } | 623 | } |
623 | 624 | ||
diff --git a/drivers/isdn/hisax/asuscom.c b/drivers/isdn/hisax/asuscom.c index a98c5e38bbbc..93ff941c48f1 100644 --- a/drivers/isdn/hisax/asuscom.c +++ b/drivers/isdn/hisax/asuscom.c | |||
@@ -297,7 +297,7 @@ Asus_card_msg(struct IsdnCardState *cs, int mt, void *arg) | |||
297 | } | 297 | } |
298 | 298 | ||
299 | #ifdef __ISAPNP__ | 299 | #ifdef __ISAPNP__ |
300 | static struct isapnp_device_id asus_ids[] __initdata = { | 300 | static struct isapnp_device_id asus_ids[] __devinitdata = { |
301 | { ISAPNP_VENDOR('A', 'S', 'U'), ISAPNP_FUNCTION(0x1688), | 301 | { ISAPNP_VENDOR('A', 'S', 'U'), ISAPNP_FUNCTION(0x1688), |
302 | ISAPNP_VENDOR('A', 'S', 'U'), ISAPNP_FUNCTION(0x1688), | 302 | ISAPNP_VENDOR('A', 'S', 'U'), ISAPNP_FUNCTION(0x1688), |
303 | (unsigned long) "Asus1688 PnP" }, | 303 | (unsigned long) "Asus1688 PnP" }, |
@@ -313,11 +313,11 @@ static struct isapnp_device_id asus_ids[] __initdata = { | |||
313 | { 0, } | 313 | { 0, } |
314 | }; | 314 | }; |
315 | 315 | ||
316 | static struct isapnp_device_id *ipid __initdata = &asus_ids[0]; | 316 | static struct isapnp_device_id *ipid __devinitdata = &asus_ids[0]; |
317 | static struct pnp_card *pnp_c __devinitdata = NULL; | 317 | static struct pnp_card *pnp_c __devinitdata = NULL; |
318 | #endif | 318 | #endif |
319 | 319 | ||
320 | int __init | 320 | int __devinit |
321 | setup_asuscom(struct IsdnCard *card) | 321 | setup_asuscom(struct IsdnCard *card) |
322 | { | 322 | { |
323 | int bytecnt; | 323 | int bytecnt; |
diff --git a/drivers/isdn/hisax/avm_a1.c b/drivers/isdn/hisax/avm_a1.c index 9a8b02557ff9..729e906bdc61 100644 --- a/drivers/isdn/hisax/avm_a1.c +++ b/drivers/isdn/hisax/avm_a1.c | |||
@@ -178,7 +178,7 @@ AVM_card_msg(struct IsdnCardState *cs, int mt, void *arg) | |||
178 | return(0); | 178 | return(0); |
179 | } | 179 | } |
180 | 180 | ||
181 | int __init | 181 | int __devinit |
182 | setup_avm_a1(struct IsdnCard *card) | 182 | setup_avm_a1(struct IsdnCard *card) |
183 | { | 183 | { |
184 | u_char val; | 184 | u_char val; |
diff --git a/drivers/isdn/hisax/avm_pci.c b/drivers/isdn/hisax/avm_pci.c index 04f5917bf5a1..369afd3a3a4b 100644 --- a/drivers/isdn/hisax/avm_pci.c +++ b/drivers/isdn/hisax/avm_pci.c | |||
@@ -639,7 +639,7 @@ clear_pending_hdlc_ints(struct IsdnCardState *cs) | |||
639 | } | 639 | } |
640 | #endif /* 0 */ | 640 | #endif /* 0 */ |
641 | 641 | ||
642 | static void __init | 642 | static void |
643 | inithdlc(struct IsdnCardState *cs) | 643 | inithdlc(struct IsdnCardState *cs) |
644 | { | 644 | { |
645 | cs->bcs[0].BC_SetStack = setstack_hdlc; | 645 | cs->bcs[0].BC_SetStack = setstack_hdlc; |
@@ -727,13 +727,13 @@ AVM_card_msg(struct IsdnCardState *cs, int mt, void *arg) | |||
727 | } | 727 | } |
728 | 728 | ||
729 | #ifdef CONFIG_PCI | 729 | #ifdef CONFIG_PCI |
730 | static struct pci_dev *dev_avm __initdata = NULL; | 730 | static struct pci_dev *dev_avm __devinitdata = NULL; |
731 | #endif | 731 | #endif |
732 | #ifdef __ISAPNP__ | 732 | #ifdef __ISAPNP__ |
733 | static struct pnp_card *pnp_avm_c __initdata = NULL; | 733 | static struct pnp_card *pnp_avm_c __devinitdata = NULL; |
734 | #endif | 734 | #endif |
735 | 735 | ||
736 | int __init | 736 | int __devinit |
737 | setup_avm_pcipnp(struct IsdnCard *card) | 737 | setup_avm_pcipnp(struct IsdnCard *card) |
738 | { | 738 | { |
739 | u_int val, ver; | 739 | u_int val, ver; |
diff --git a/drivers/isdn/hisax/bkm_a4t.c b/drivers/isdn/hisax/bkm_a4t.c index 3cf1f2421789..87a630128a6c 100644 --- a/drivers/isdn/hisax/bkm_a4t.c +++ b/drivers/isdn/hisax/bkm_a4t.c | |||
@@ -255,9 +255,9 @@ BKM_card_msg(struct IsdnCardState *cs, int mt, void *arg) | |||
255 | return (0); | 255 | return (0); |
256 | } | 256 | } |
257 | 257 | ||
258 | static struct pci_dev *dev_a4t __initdata = NULL; | 258 | static struct pci_dev *dev_a4t __devinitdata = NULL; |
259 | 259 | ||
260 | int __init | 260 | int __devinit |
261 | setup_bkm_a4t(struct IsdnCard *card) | 261 | setup_bkm_a4t(struct IsdnCard *card) |
262 | { | 262 | { |
263 | struct IsdnCardState *cs = card->cs; | 263 | struct IsdnCardState *cs = card->cs; |
diff --git a/drivers/isdn/hisax/bkm_a8.c b/drivers/isdn/hisax/bkm_a8.c index 15681f3e73b8..dae090a9a489 100644 --- a/drivers/isdn/hisax/bkm_a8.c +++ b/drivers/isdn/hisax/bkm_a8.c | |||
@@ -260,7 +260,7 @@ BKM_card_msg(struct IsdnCardState *cs, int mt, void *arg) | |||
260 | return (0); | 260 | return (0); |
261 | } | 261 | } |
262 | 262 | ||
263 | static int __init | 263 | static int __devinit |
264 | sct_alloc_io(u_int adr, u_int len) | 264 | sct_alloc_io(u_int adr, u_int len) |
265 | { | 265 | { |
266 | if (!request_region(adr, len, "scitel")) { | 266 | if (!request_region(adr, len, "scitel")) { |
@@ -272,16 +272,16 @@ sct_alloc_io(u_int adr, u_int len) | |||
272 | return(0); | 272 | return(0); |
273 | } | 273 | } |
274 | 274 | ||
275 | static struct pci_dev *dev_a8 __initdata = NULL; | 275 | static struct pci_dev *dev_a8 __devinitdata = NULL; |
276 | static u16 sub_vendor_id __initdata = 0; | 276 | static u16 sub_vendor_id __devinitdata = 0; |
277 | static u16 sub_sys_id __initdata = 0; | 277 | static u16 sub_sys_id __devinitdata = 0; |
278 | static u_char pci_bus __initdata = 0; | 278 | static u_char pci_bus __devinitdata = 0; |
279 | static u_char pci_device_fn __initdata = 0; | 279 | static u_char pci_device_fn __devinitdata = 0; |
280 | static u_char pci_irq __initdata = 0; | 280 | static u_char pci_irq __devinitdata = 0; |
281 | 281 | ||
282 | #endif /* CONFIG_PCI */ | 282 | #endif /* CONFIG_PCI */ |
283 | 283 | ||
284 | int __init | 284 | int __devinit |
285 | setup_sct_quadro(struct IsdnCard *card) | 285 | setup_sct_quadro(struct IsdnCard *card) |
286 | { | 286 | { |
287 | #ifdef CONFIG_PCI | 287 | #ifdef CONFIG_PCI |
diff --git a/drivers/isdn/hisax/config.c b/drivers/isdn/hisax/config.c index 5333be5d2c47..e10350360f2f 100644 --- a/drivers/isdn/hisax/config.c +++ b/drivers/isdn/hisax/config.c | |||
@@ -1875,7 +1875,7 @@ static void EChannel_proc_rcv(struct hisax_d_if *d_if) | |||
1875 | #ifdef CONFIG_PCI | 1875 | #ifdef CONFIG_PCI |
1876 | #include <linux/pci.h> | 1876 | #include <linux/pci.h> |
1877 | 1877 | ||
1878 | static struct pci_device_id hisax_pci_tbl[] __initdata = { | 1878 | static struct pci_device_id hisax_pci_tbl[] __devinitdata = { |
1879 | #ifdef CONFIG_HISAX_FRITZPCI | 1879 | #ifdef CONFIG_HISAX_FRITZPCI |
1880 | {PCI_VENDOR_ID_AVM, PCI_DEVICE_ID_AVM_A1, PCI_ANY_ID, PCI_ANY_ID}, | 1880 | {PCI_VENDOR_ID_AVM, PCI_DEVICE_ID_AVM_A1, PCI_ANY_ID, PCI_ANY_ID}, |
1881 | #endif | 1881 | #endif |
diff --git a/drivers/isdn/hisax/diva.c b/drivers/isdn/hisax/diva.c index 323a02ef3844..e294fa3918f3 100644 --- a/drivers/isdn/hisax/diva.c +++ b/drivers/isdn/hisax/diva.c | |||
@@ -887,13 +887,13 @@ Diva_card_msg(struct IsdnCardState *cs, int mt, void *arg) | |||
887 | return(0); | 887 | return(0); |
888 | } | 888 | } |
889 | 889 | ||
890 | static struct pci_dev *dev_diva __initdata = NULL; | 890 | static struct pci_dev *dev_diva __devinitdata = NULL; |
891 | static struct pci_dev *dev_diva_u __initdata = NULL; | 891 | static struct pci_dev *dev_diva_u __devinitdata = NULL; |
892 | static struct pci_dev *dev_diva201 __initdata = NULL; | 892 | static struct pci_dev *dev_diva201 __devinitdata = NULL; |
893 | static struct pci_dev *dev_diva202 __initdata = NULL; | 893 | static struct pci_dev *dev_diva202 __devinitdata = NULL; |
894 | 894 | ||
895 | #ifdef __ISAPNP__ | 895 | #ifdef __ISAPNP__ |
896 | static struct isapnp_device_id diva_ids[] __initdata = { | 896 | static struct isapnp_device_id diva_ids[] __devinitdata = { |
897 | { ISAPNP_VENDOR('G', 'D', 'I'), ISAPNP_FUNCTION(0x51), | 897 | { ISAPNP_VENDOR('G', 'D', 'I'), ISAPNP_FUNCTION(0x51), |
898 | ISAPNP_VENDOR('G', 'D', 'I'), ISAPNP_FUNCTION(0x51), | 898 | ISAPNP_VENDOR('G', 'D', 'I'), ISAPNP_FUNCTION(0x51), |
899 | (unsigned long) "Diva picola" }, | 899 | (unsigned long) "Diva picola" }, |
@@ -915,12 +915,12 @@ static struct isapnp_device_id diva_ids[] __initdata = { | |||
915 | { 0, } | 915 | { 0, } |
916 | }; | 916 | }; |
917 | 917 | ||
918 | static struct isapnp_device_id *ipid __initdata = &diva_ids[0]; | 918 | static struct isapnp_device_id *ipid __devinitdata = &diva_ids[0]; |
919 | static struct pnp_card *pnp_c __devinitdata = NULL; | 919 | static struct pnp_card *pnp_c __devinitdata = NULL; |
920 | #endif | 920 | #endif |
921 | 921 | ||
922 | 922 | ||
923 | int __init | 923 | int __devinit |
924 | setup_diva(struct IsdnCard *card) | 924 | setup_diva(struct IsdnCard *card) |
925 | { | 925 | { |
926 | int bytecnt = 8; | 926 | int bytecnt = 8; |
diff --git a/drivers/isdn/hisax/enternow_pci.c b/drivers/isdn/hisax/enternow_pci.c index 8fcbe2e7d765..76c7d29d1b2f 100644 --- a/drivers/isdn/hisax/enternow_pci.c +++ b/drivers/isdn/hisax/enternow_pci.c | |||
@@ -301,10 +301,10 @@ enpci_interrupt(int intno, void *dev_id, struct pt_regs *regs) | |||
301 | } | 301 | } |
302 | 302 | ||
303 | 303 | ||
304 | static struct pci_dev *dev_netjet __initdata = NULL; | 304 | static struct pci_dev *dev_netjet __devinitdata = NULL; |
305 | 305 | ||
306 | /* called by config.c */ | 306 | /* called by config.c */ |
307 | int __init | 307 | int __devinit |
308 | setup_enternow_pci(struct IsdnCard *card) | 308 | setup_enternow_pci(struct IsdnCard *card) |
309 | { | 309 | { |
310 | int bytecnt; | 310 | int bytecnt; |
diff --git a/drivers/isdn/hisax/gazel.c b/drivers/isdn/hisax/gazel.c index 3e7d92303582..fe2937267777 100644 --- a/drivers/isdn/hisax/gazel.c +++ b/drivers/isdn/hisax/gazel.c | |||
@@ -484,7 +484,7 @@ reserve_regions(struct IsdnCard *card, struct IsdnCardState *cs) | |||
484 | return 1; | 484 | return 1; |
485 | } | 485 | } |
486 | 486 | ||
487 | static int __init | 487 | static int __devinit |
488 | setup_gazelisa(struct IsdnCard *card, struct IsdnCardState *cs) | 488 | setup_gazelisa(struct IsdnCard *card, struct IsdnCardState *cs) |
489 | { | 489 | { |
490 | printk(KERN_INFO "Gazel: ISA PnP card automatic recognition\n"); | 490 | printk(KERN_INFO "Gazel: ISA PnP card automatic recognition\n"); |
@@ -532,9 +532,9 @@ setup_gazelisa(struct IsdnCard *card, struct IsdnCardState *cs) | |||
532 | return (0); | 532 | return (0); |
533 | } | 533 | } |
534 | 534 | ||
535 | static struct pci_dev *dev_tel __initdata = NULL; | 535 | static struct pci_dev *dev_tel __devinitdata = NULL; |
536 | 536 | ||
537 | static int __init | 537 | static int __devinit |
538 | setup_gazelpci(struct IsdnCardState *cs) | 538 | setup_gazelpci(struct IsdnCardState *cs) |
539 | { | 539 | { |
540 | u_int pci_ioaddr0 = 0, pci_ioaddr1 = 0; | 540 | u_int pci_ioaddr0 = 0, pci_ioaddr1 = 0; |
@@ -621,7 +621,7 @@ setup_gazelpci(struct IsdnCardState *cs) | |||
621 | return (0); | 621 | return (0); |
622 | } | 622 | } |
623 | 623 | ||
624 | int __init | 624 | int __devinit |
625 | setup_gazel(struct IsdnCard *card) | 625 | setup_gazel(struct IsdnCard *card) |
626 | { | 626 | { |
627 | struct IsdnCardState *cs = card->cs; | 627 | struct IsdnCardState *cs = card->cs; |
diff --git a/drivers/isdn/hisax/hfc4s8s_l1.c b/drivers/isdn/hisax/hfc4s8s_l1.c index 0f967b3df79d..3a5ca8a68fc4 100644 --- a/drivers/isdn/hisax/hfc4s8s_l1.c +++ b/drivers/isdn/hisax/hfc4s8s_l1.c | |||
@@ -1703,7 +1703,7 @@ hfc4s8s_module_init(void) | |||
1703 | /* driver module exit : */ | 1703 | /* driver module exit : */ |
1704 | /* release the HFC-4s/8s hardware */ | 1704 | /* release the HFC-4s/8s hardware */ |
1705 | /*************************************/ | 1705 | /*************************************/ |
1706 | static void | 1706 | static void __exit |
1707 | hfc4s8s_module_exit(void) | 1707 | hfc4s8s_module_exit(void) |
1708 | { | 1708 | { |
1709 | pci_unregister_driver(&hfc4s8s_driver); | 1709 | pci_unregister_driver(&hfc4s8s_driver); |
diff --git a/drivers/isdn/hisax/hfc_2bds0.c b/drivers/isdn/hisax/hfc_2bds0.c index 637a261c9312..6360e8214720 100644 --- a/drivers/isdn/hisax/hfc_2bds0.c +++ b/drivers/isdn/hisax/hfc_2bds0.c | |||
@@ -1015,7 +1015,7 @@ hfc_dbusy_timer(struct IsdnCardState *cs) | |||
1015 | { | 1015 | { |
1016 | } | 1016 | } |
1017 | 1017 | ||
1018 | static unsigned int __init | 1018 | static unsigned int |
1019 | *init_send_hfcd(int cnt) | 1019 | *init_send_hfcd(int cnt) |
1020 | { | 1020 | { |
1021 | int i, *send; | 1021 | int i, *send; |
@@ -1030,7 +1030,7 @@ static unsigned int __init | |||
1030 | return(send); | 1030 | return(send); |
1031 | } | 1031 | } |
1032 | 1032 | ||
1033 | void __init | 1033 | void |
1034 | init2bds0(struct IsdnCardState *cs) | 1034 | init2bds0(struct IsdnCardState *cs) |
1035 | { | 1035 | { |
1036 | cs->setstack_d = setstack_hfcd; | 1036 | cs->setstack_d = setstack_hfcd; |
diff --git a/drivers/isdn/hisax/hfc_2bs0.c b/drivers/isdn/hisax/hfc_2bs0.c index c964539cc43e..d0520ad30677 100644 --- a/drivers/isdn/hisax/hfc_2bs0.c +++ b/drivers/isdn/hisax/hfc_2bs0.c | |||
@@ -551,7 +551,7 @@ setstack_hfc(struct PStack *st, struct BCState *bcs) | |||
551 | return (0); | 551 | return (0); |
552 | } | 552 | } |
553 | 553 | ||
554 | static void __init | 554 | static void |
555 | init_send(struct BCState *bcs) | 555 | init_send(struct BCState *bcs) |
556 | { | 556 | { |
557 | int i; | 557 | int i; |
@@ -565,7 +565,7 @@ init_send(struct BCState *bcs) | |||
565 | bcs->hw.hfc.send[i] = 0x1fff; | 565 | bcs->hw.hfc.send[i] = 0x1fff; |
566 | } | 566 | } |
567 | 567 | ||
568 | void __init | 568 | void |
569 | inithfc(struct IsdnCardState *cs) | 569 | inithfc(struct IsdnCardState *cs) |
570 | { | 570 | { |
571 | init_send(&cs->bcs[0]); | 571 | init_send(&cs->bcs[0]); |
diff --git a/drivers/isdn/hisax/hfc_pci.c b/drivers/isdn/hisax/hfc_pci.c index 7241e73879ba..1df60ca9481f 100644 --- a/drivers/isdn/hisax/hfc_pci.c +++ b/drivers/isdn/hisax/hfc_pci.c | |||
@@ -1581,7 +1581,7 @@ hfcpci_bh(struct IsdnCardState *cs) | |||
1581 | /********************************/ | 1581 | /********************************/ |
1582 | /* called for card init message */ | 1582 | /* called for card init message */ |
1583 | /********************************/ | 1583 | /********************************/ |
1584 | static void __init | 1584 | static void |
1585 | inithfcpci(struct IsdnCardState *cs) | 1585 | inithfcpci(struct IsdnCardState *cs) |
1586 | { | 1586 | { |
1587 | cs->bcs[0].BC_SetStack = setstack_2b; | 1587 | cs->bcs[0].BC_SetStack = setstack_2b; |
@@ -1638,11 +1638,11 @@ hfcpci_card_msg(struct IsdnCardState *cs, int mt, void *arg) | |||
1638 | 1638 | ||
1639 | 1639 | ||
1640 | /* this variable is used as card index when more than one cards are present */ | 1640 | /* this variable is used as card index when more than one cards are present */ |
1641 | static struct pci_dev *dev_hfcpci __initdata = NULL; | 1641 | static struct pci_dev *dev_hfcpci __devinitdata = NULL; |
1642 | 1642 | ||
1643 | #endif /* CONFIG_PCI */ | 1643 | #endif /* CONFIG_PCI */ |
1644 | 1644 | ||
1645 | int __init | 1645 | int __devinit |
1646 | setup_hfcpci(struct IsdnCard *card) | 1646 | setup_hfcpci(struct IsdnCard *card) |
1647 | { | 1647 | { |
1648 | u_long flags; | 1648 | u_long flags; |
diff --git a/drivers/isdn/hisax/hfcscard.c b/drivers/isdn/hisax/hfcscard.c index 86ab1c13f6b1..4e7f472877e9 100644 --- a/drivers/isdn/hisax/hfcscard.c +++ b/drivers/isdn/hisax/hfcscard.c | |||
@@ -139,7 +139,7 @@ hfcs_card_msg(struct IsdnCardState *cs, int mt, void *arg) | |||
139 | } | 139 | } |
140 | 140 | ||
141 | #ifdef __ISAPNP__ | 141 | #ifdef __ISAPNP__ |
142 | static struct isapnp_device_id hfc_ids[] __initdata = { | 142 | static struct isapnp_device_id hfc_ids[] __devinitdata = { |
143 | { ISAPNP_VENDOR('A', 'N', 'X'), ISAPNP_FUNCTION(0x1114), | 143 | { ISAPNP_VENDOR('A', 'N', 'X'), ISAPNP_FUNCTION(0x1114), |
144 | ISAPNP_VENDOR('A', 'N', 'X'), ISAPNP_FUNCTION(0x1114), | 144 | ISAPNP_VENDOR('A', 'N', 'X'), ISAPNP_FUNCTION(0x1114), |
145 | (unsigned long) "Acer P10" }, | 145 | (unsigned long) "Acer P10" }, |
@@ -164,11 +164,11 @@ static struct isapnp_device_id hfc_ids[] __initdata = { | |||
164 | { 0, } | 164 | { 0, } |
165 | }; | 165 | }; |
166 | 166 | ||
167 | static struct isapnp_device_id *ipid __initdata = &hfc_ids[0]; | 167 | static struct isapnp_device_id *ipid __devinitdata = &hfc_ids[0]; |
168 | static struct pnp_card *pnp_c __devinitdata = NULL; | 168 | static struct pnp_card *pnp_c __devinitdata = NULL; |
169 | #endif | 169 | #endif |
170 | 170 | ||
171 | int __init | 171 | int __devinit |
172 | setup_hfcs(struct IsdnCard *card) | 172 | setup_hfcs(struct IsdnCard *card) |
173 | { | 173 | { |
174 | struct IsdnCardState *cs = card->cs; | 174 | struct IsdnCardState *cs = card->cs; |
diff --git a/drivers/isdn/hisax/icc.c b/drivers/isdn/hisax/icc.c index c615752b96aa..2cf7b665609e 100644 --- a/drivers/isdn/hisax/icc.c +++ b/drivers/isdn/hisax/icc.c | |||
@@ -24,10 +24,10 @@ | |||
24 | #define DBUSY_TIMER_VALUE 80 | 24 | #define DBUSY_TIMER_VALUE 80 |
25 | #define ARCOFI_USE 0 | 25 | #define ARCOFI_USE 0 |
26 | 26 | ||
27 | static char *ICCVer[] __initdata = | 27 | static char *ICCVer[] = |
28 | {"2070 A1/A3", "2070 B1", "2070 B2/B3", "2070 V2.4"}; | 28 | {"2070 A1/A3", "2070 B1", "2070 B2/B3", "2070 V2.4"}; |
29 | 29 | ||
30 | void __init | 30 | void |
31 | ICCVersion(struct IsdnCardState *cs, char *s) | 31 | ICCVersion(struct IsdnCardState *cs, char *s) |
32 | { | 32 | { |
33 | int val; | 33 | int val; |
@@ -613,7 +613,7 @@ dbusy_timer_handler(struct IsdnCardState *cs) | |||
613 | } | 613 | } |
614 | } | 614 | } |
615 | 615 | ||
616 | void __init | 616 | void |
617 | initicc(struct IsdnCardState *cs) | 617 | initicc(struct IsdnCardState *cs) |
618 | { | 618 | { |
619 | cs->setstack_d = setstack_icc; | 619 | cs->setstack_d = setstack_icc; |
@@ -646,7 +646,7 @@ initicc(struct IsdnCardState *cs) | |||
646 | ph_command(cs, ICC_CMD_DI); | 646 | ph_command(cs, ICC_CMD_DI); |
647 | } | 647 | } |
648 | 648 | ||
649 | void __init | 649 | void |
650 | clear_pending_icc_ints(struct IsdnCardState *cs) | 650 | clear_pending_icc_ints(struct IsdnCardState *cs) |
651 | { | 651 | { |
652 | int val, eval; | 652 | int val, eval; |
diff --git a/drivers/isdn/hisax/icc.h b/drivers/isdn/hisax/icc.h index b3bb3d5de532..e7f593967e43 100644 --- a/drivers/isdn/hisax/icc.h +++ b/drivers/isdn/hisax/icc.h | |||
@@ -65,7 +65,7 @@ | |||
65 | #define ICC_IND_AIL 0xE | 65 | #define ICC_IND_AIL 0xE |
66 | #define ICC_IND_DC 0xF | 66 | #define ICC_IND_DC 0xF |
67 | 67 | ||
68 | extern void __init ICCVersion(struct IsdnCardState *cs, char *s); | 68 | extern void ICCVersion(struct IsdnCardState *cs, char *s); |
69 | extern void initicc(struct IsdnCardState *cs); | 69 | extern void initicc(struct IsdnCardState *cs); |
70 | extern void icc_interrupt(struct IsdnCardState *cs, u_char val); | 70 | extern void icc_interrupt(struct IsdnCardState *cs, u_char val); |
71 | extern void clear_pending_icc_ints(struct IsdnCardState *cs); | 71 | extern void clear_pending_icc_ints(struct IsdnCardState *cs); |
diff --git a/drivers/isdn/hisax/ipacx.c b/drivers/isdn/hisax/ipacx.c index df5fc92a89b2..00afd5538909 100644 --- a/drivers/isdn/hisax/ipacx.c +++ b/drivers/isdn/hisax/ipacx.c | |||
@@ -38,8 +38,8 @@ static void dbusy_timer_handler(struct IsdnCardState *cs); | |||
38 | static void dch_empty_fifo(struct IsdnCardState *cs, int count); | 38 | static void dch_empty_fifo(struct IsdnCardState *cs, int count); |
39 | static void dch_fill_fifo(struct IsdnCardState *cs); | 39 | static void dch_fill_fifo(struct IsdnCardState *cs); |
40 | static inline void dch_int(struct IsdnCardState *cs); | 40 | static inline void dch_int(struct IsdnCardState *cs); |
41 | static void __devinit dch_setstack(struct PStack *st, struct IsdnCardState *cs); | 41 | static void dch_setstack(struct PStack *st, struct IsdnCardState *cs); |
42 | static void __devinit dch_init(struct IsdnCardState *cs); | 42 | static void dch_init(struct IsdnCardState *cs); |
43 | static void bch_l2l1(struct PStack *st, int pr, void *arg); | 43 | static void bch_l2l1(struct PStack *st, int pr, void *arg); |
44 | static void bch_empty_fifo(struct BCState *bcs, int count); | 44 | static void bch_empty_fifo(struct BCState *bcs, int count); |
45 | static void bch_fill_fifo(struct BCState *bcs); | 45 | static void bch_fill_fifo(struct BCState *bcs); |
@@ -48,8 +48,8 @@ static void bch_mode(struct BCState *bcs, int mode, int bc); | |||
48 | static void bch_close_state(struct BCState *bcs); | 48 | static void bch_close_state(struct BCState *bcs); |
49 | static int bch_open_state(struct IsdnCardState *cs, struct BCState *bcs); | 49 | static int bch_open_state(struct IsdnCardState *cs, struct BCState *bcs); |
50 | static int bch_setstack(struct PStack *st, struct BCState *bcs); | 50 | static int bch_setstack(struct PStack *st, struct BCState *bcs); |
51 | static void __devinit bch_init(struct IsdnCardState *cs, int hscx); | 51 | static void bch_init(struct IsdnCardState *cs, int hscx); |
52 | static void __init clear_pending_ints(struct IsdnCardState *cs); | 52 | static void clear_pending_ints(struct IsdnCardState *cs); |
53 | 53 | ||
54 | //---------------------------------------------------------- | 54 | //---------------------------------------------------------- |
55 | // Issue Layer 1 command to chip | 55 | // Issue Layer 1 command to chip |
@@ -408,7 +408,7 @@ dch_int(struct IsdnCardState *cs) | |||
408 | 408 | ||
409 | //---------------------------------------------------------- | 409 | //---------------------------------------------------------- |
410 | //---------------------------------------------------------- | 410 | //---------------------------------------------------------- |
411 | static void __devinit | 411 | static void |
412 | dch_setstack(struct PStack *st, struct IsdnCardState *cs) | 412 | dch_setstack(struct PStack *st, struct IsdnCardState *cs) |
413 | { | 413 | { |
414 | st->l1.l1hw = dch_l2l1; | 414 | st->l1.l1hw = dch_l2l1; |
@@ -416,7 +416,7 @@ dch_setstack(struct PStack *st, struct IsdnCardState *cs) | |||
416 | 416 | ||
417 | //---------------------------------------------------------- | 417 | //---------------------------------------------------------- |
418 | //---------------------------------------------------------- | 418 | //---------------------------------------------------------- |
419 | static void __devinit | 419 | static void |
420 | dch_init(struct IsdnCardState *cs) | 420 | dch_init(struct IsdnCardState *cs) |
421 | { | 421 | { |
422 | printk(KERN_INFO "HiSax: IPACX ISDN driver v0.1.0\n"); | 422 | printk(KERN_INFO "HiSax: IPACX ISDN driver v0.1.0\n"); |
@@ -823,7 +823,7 @@ bch_setstack(struct PStack *st, struct BCState *bcs) | |||
823 | 823 | ||
824 | //---------------------------------------------------------- | 824 | //---------------------------------------------------------- |
825 | //---------------------------------------------------------- | 825 | //---------------------------------------------------------- |
826 | static void __devinit | 826 | static void |
827 | bch_init(struct IsdnCardState *cs, int hscx) | 827 | bch_init(struct IsdnCardState *cs, int hscx) |
828 | { | 828 | { |
829 | cs->bcs[hscx].BC_SetStack = bch_setstack; | 829 | cs->bcs[hscx].BC_SetStack = bch_setstack; |
@@ -861,7 +861,7 @@ interrupt_ipacx(struct IsdnCardState *cs) | |||
861 | //---------------------------------------------------------- | 861 | //---------------------------------------------------------- |
862 | // Clears chip interrupt status | 862 | // Clears chip interrupt status |
863 | //---------------------------------------------------------- | 863 | //---------------------------------------------------------- |
864 | static void __init | 864 | static void |
865 | clear_pending_ints(struct IsdnCardState *cs) | 865 | clear_pending_ints(struct IsdnCardState *cs) |
866 | { | 866 | { |
867 | int ista; | 867 | int ista; |
@@ -883,7 +883,7 @@ clear_pending_ints(struct IsdnCardState *cs) | |||
883 | // Does chip configuration work | 883 | // Does chip configuration work |
884 | // Work to do depends on bit mask in part | 884 | // Work to do depends on bit mask in part |
885 | //---------------------------------------------------------- | 885 | //---------------------------------------------------------- |
886 | void __init | 886 | void |
887 | init_ipacx(struct IsdnCardState *cs, int part) | 887 | init_ipacx(struct IsdnCardState *cs, int part) |
888 | { | 888 | { |
889 | if (part &1) { // initialise chip | 889 | if (part &1) { // initialise chip |
diff --git a/drivers/isdn/hisax/isurf.c b/drivers/isdn/hisax/isurf.c index 33747afc984d..715a1a8cd694 100644 --- a/drivers/isdn/hisax/isurf.c +++ b/drivers/isdn/hisax/isurf.c | |||
@@ -196,10 +196,10 @@ isurf_auxcmd(struct IsdnCardState *cs, isdn_ctrl *ic) { | |||
196 | } | 196 | } |
197 | 197 | ||
198 | #ifdef __ISAPNP__ | 198 | #ifdef __ISAPNP__ |
199 | static struct pnp_card *pnp_c __initdata = NULL; | 199 | static struct pnp_card *pnp_c __devinitdata = NULL; |
200 | #endif | 200 | #endif |
201 | 201 | ||
202 | int __init | 202 | int __devinit |
203 | setup_isurf(struct IsdnCard *card) | 203 | setup_isurf(struct IsdnCard *card) |
204 | { | 204 | { |
205 | int ver; | 205 | int ver; |
diff --git a/drivers/isdn/hisax/ix1_micro.c b/drivers/isdn/hisax/ix1_micro.c index 908a7e144421..39717506c678 100644 --- a/drivers/isdn/hisax/ix1_micro.c +++ b/drivers/isdn/hisax/ix1_micro.c | |||
@@ -210,7 +210,7 @@ ix1_card_msg(struct IsdnCardState *cs, int mt, void *arg) | |||
210 | } | 210 | } |
211 | 211 | ||
212 | #ifdef __ISAPNP__ | 212 | #ifdef __ISAPNP__ |
213 | static struct isapnp_device_id itk_ids[] __initdata = { | 213 | static struct isapnp_device_id itk_ids[] __devinitdata = { |
214 | { ISAPNP_VENDOR('I', 'T', 'K'), ISAPNP_FUNCTION(0x25), | 214 | { ISAPNP_VENDOR('I', 'T', 'K'), ISAPNP_FUNCTION(0x25), |
215 | ISAPNP_VENDOR('I', 'T', 'K'), ISAPNP_FUNCTION(0x25), | 215 | ISAPNP_VENDOR('I', 'T', 'K'), ISAPNP_FUNCTION(0x25), |
216 | (unsigned long) "ITK micro 2" }, | 216 | (unsigned long) "ITK micro 2" }, |
@@ -220,12 +220,12 @@ static struct isapnp_device_id itk_ids[] __initdata = { | |||
220 | { 0, } | 220 | { 0, } |
221 | }; | 221 | }; |
222 | 222 | ||
223 | static struct isapnp_device_id *ipid __initdata = &itk_ids[0]; | 223 | static struct isapnp_device_id *ipid __devinitdata = &itk_ids[0]; |
224 | static struct pnp_card *pnp_c __devinitdata = NULL; | 224 | static struct pnp_card *pnp_c __devinitdata = NULL; |
225 | #endif | 225 | #endif |
226 | 226 | ||
227 | 227 | ||
228 | int __init | 228 | int __devinit |
229 | setup_ix1micro(struct IsdnCard *card) | 229 | setup_ix1micro(struct IsdnCard *card) |
230 | { | 230 | { |
231 | struct IsdnCardState *cs = card->cs; | 231 | struct IsdnCardState *cs = card->cs; |
diff --git a/drivers/isdn/hisax/jade.c b/drivers/isdn/hisax/jade.c index 2659fecc2674..43d61d1bc5b6 100644 --- a/drivers/isdn/hisax/jade.c +++ b/drivers/isdn/hisax/jade.c | |||
@@ -19,7 +19,7 @@ | |||
19 | #include <linux/interrupt.h> | 19 | #include <linux/interrupt.h> |
20 | 20 | ||
21 | 21 | ||
22 | int __init | 22 | int |
23 | JadeVersion(struct IsdnCardState *cs, char *s) | 23 | JadeVersion(struct IsdnCardState *cs, char *s) |
24 | { | 24 | { |
25 | int ver,i; | 25 | int ver,i; |
@@ -253,7 +253,7 @@ setstack_jade(struct PStack *st, struct BCState *bcs) | |||
253 | return (0); | 253 | return (0); |
254 | } | 254 | } |
255 | 255 | ||
256 | void __init | 256 | void |
257 | clear_pending_jade_ints(struct IsdnCardState *cs) | 257 | clear_pending_jade_ints(struct IsdnCardState *cs) |
258 | { | 258 | { |
259 | int val; | 259 | int val; |
@@ -279,7 +279,7 @@ clear_pending_jade_ints(struct IsdnCardState *cs) | |||
279 | cs->BC_Write_Reg(cs, 1, jade_HDLC_IMR, 0xF8); | 279 | cs->BC_Write_Reg(cs, 1, jade_HDLC_IMR, 0xF8); |
280 | } | 280 | } |
281 | 281 | ||
282 | void __init | 282 | void |
283 | initjade(struct IsdnCardState *cs) | 283 | initjade(struct IsdnCardState *cs) |
284 | { | 284 | { |
285 | cs->bcs[0].BC_SetStack = setstack_jade; | 285 | cs->bcs[0].BC_SetStack = setstack_jade; |
diff --git a/drivers/isdn/hisax/mic.c b/drivers/isdn/hisax/mic.c index fe11f226b285..8c82519593a8 100644 --- a/drivers/isdn/hisax/mic.c +++ b/drivers/isdn/hisax/mic.c | |||
@@ -189,7 +189,7 @@ mic_card_msg(struct IsdnCardState *cs, int mt, void *arg) | |||
189 | return(0); | 189 | return(0); |
190 | } | 190 | } |
191 | 191 | ||
192 | int __init | 192 | int __devinit |
193 | setup_mic(struct IsdnCard *card) | 193 | setup_mic(struct IsdnCard *card) |
194 | { | 194 | { |
195 | int bytecnt; | 195 | int bytecnt; |
diff --git a/drivers/isdn/hisax/netjet.c b/drivers/isdn/hisax/netjet.c index 47a47ef0968b..38f648f9b0ed 100644 --- a/drivers/isdn/hisax/netjet.c +++ b/drivers/isdn/hisax/netjet.c | |||
@@ -909,7 +909,7 @@ setstack_tiger(struct PStack *st, struct BCState *bcs) | |||
909 | } | 909 | } |
910 | 910 | ||
911 | 911 | ||
912 | void __init | 912 | void |
913 | inittiger(struct IsdnCardState *cs) | 913 | inittiger(struct IsdnCardState *cs) |
914 | { | 914 | { |
915 | if (!(cs->bcs[0].hw.tiger.send = kmalloc(NETJET_DMA_TXSIZE * sizeof(unsigned int), | 915 | if (!(cs->bcs[0].hw.tiger.send = kmalloc(NETJET_DMA_TXSIZE * sizeof(unsigned int), |
diff --git a/drivers/isdn/hisax/niccy.c b/drivers/isdn/hisax/niccy.c index 79a97b1c3812..489022bdef7b 100644 --- a/drivers/isdn/hisax/niccy.c +++ b/drivers/isdn/hisax/niccy.c | |||
@@ -232,12 +232,12 @@ niccy_card_msg(struct IsdnCardState *cs, int mt, void *arg) | |||
232 | return(0); | 232 | return(0); |
233 | } | 233 | } |
234 | 234 | ||
235 | static struct pci_dev *niccy_dev __initdata = NULL; | 235 | static struct pci_dev *niccy_dev __devinitdata = NULL; |
236 | #ifdef __ISAPNP__ | 236 | #ifdef __ISAPNP__ |
237 | static struct pnp_card *pnp_c __devinitdata = NULL; | 237 | static struct pnp_card *pnp_c __devinitdata = NULL; |
238 | #endif | 238 | #endif |
239 | 239 | ||
240 | int __init | 240 | int __devinit |
241 | setup_niccy(struct IsdnCard *card) | 241 | setup_niccy(struct IsdnCard *card) |
242 | { | 242 | { |
243 | struct IsdnCardState *cs = card->cs; | 243 | struct IsdnCardState *cs = card->cs; |
diff --git a/drivers/isdn/hisax/nj_s.c b/drivers/isdn/hisax/nj_s.c index e5b900a6fa0b..80025fd890f4 100644 --- a/drivers/isdn/hisax/nj_s.c +++ b/drivers/isdn/hisax/nj_s.c | |||
@@ -148,9 +148,9 @@ NETjet_S_card_msg(struct IsdnCardState *cs, int mt, void *arg) | |||
148 | return(0); | 148 | return(0); |
149 | } | 149 | } |
150 | 150 | ||
151 | static struct pci_dev *dev_netjet __initdata = NULL; | 151 | static struct pci_dev *dev_netjet __devinitdata = NULL; |
152 | 152 | ||
153 | int __init | 153 | int __devinit |
154 | setup_netjet_s(struct IsdnCard *card) | 154 | setup_netjet_s(struct IsdnCard *card) |
155 | { | 155 | { |
156 | int bytecnt,cfg; | 156 | int bytecnt,cfg; |
diff --git a/drivers/isdn/hisax/nj_u.c b/drivers/isdn/hisax/nj_u.c index 7002b09936d4..37497162d539 100644 --- a/drivers/isdn/hisax/nj_u.c +++ b/drivers/isdn/hisax/nj_u.c | |||
@@ -128,9 +128,9 @@ NETjet_U_card_msg(struct IsdnCardState *cs, int mt, void *arg) | |||
128 | return(0); | 128 | return(0); |
129 | } | 129 | } |
130 | 130 | ||
131 | static struct pci_dev *dev_netjet __initdata = NULL; | 131 | static struct pci_dev *dev_netjet __devinitdata = NULL; |
132 | 132 | ||
133 | int __init | 133 | int __devinit |
134 | setup_netjet_u(struct IsdnCard *card) | 134 | setup_netjet_u(struct IsdnCard *card) |
135 | { | 135 | { |
136 | int bytecnt; | 136 | int bytecnt; |
diff --git a/drivers/isdn/hisax/s0box.c b/drivers/isdn/hisax/s0box.c index 7b63085ea6e5..e76042d323ea 100644 --- a/drivers/isdn/hisax/s0box.c +++ b/drivers/isdn/hisax/s0box.c | |||
@@ -211,7 +211,7 @@ S0Box_card_msg(struct IsdnCardState *cs, int mt, void *arg) | |||
211 | return(0); | 211 | return(0); |
212 | } | 212 | } |
213 | 213 | ||
214 | int __init | 214 | int __devinit |
215 | setup_s0box(struct IsdnCard *card) | 215 | setup_s0box(struct IsdnCard *card) |
216 | { | 216 | { |
217 | struct IsdnCardState *cs = card->cs; | 217 | struct IsdnCardState *cs = card->cs; |
diff --git a/drivers/isdn/hisax/saphir.c b/drivers/isdn/hisax/saphir.c index 821776e1561a..d943d365890b 100644 --- a/drivers/isdn/hisax/saphir.c +++ b/drivers/isdn/hisax/saphir.c | |||
@@ -241,7 +241,7 @@ saphir_card_msg(struct IsdnCardState *cs, int mt, void *arg) | |||
241 | } | 241 | } |
242 | 242 | ||
243 | 243 | ||
244 | int __init | 244 | int __devinit |
245 | setup_saphir(struct IsdnCard *card) | 245 | setup_saphir(struct IsdnCard *card) |
246 | { | 246 | { |
247 | struct IsdnCardState *cs = card->cs; | 247 | struct IsdnCardState *cs = card->cs; |
diff --git a/drivers/isdn/hisax/sportster.c b/drivers/isdn/hisax/sportster.c index cdf35dc564c4..a49b694eb730 100644 --- a/drivers/isdn/hisax/sportster.c +++ b/drivers/isdn/hisax/sportster.c | |||
@@ -184,7 +184,7 @@ Sportster_card_msg(struct IsdnCardState *cs, int mt, void *arg) | |||
184 | return(0); | 184 | return(0); |
185 | } | 185 | } |
186 | 186 | ||
187 | static int __init | 187 | static int __devinit |
188 | get_io_range(struct IsdnCardState *cs) | 188 | get_io_range(struct IsdnCardState *cs) |
189 | { | 189 | { |
190 | int i, j, adr; | 190 | int i, j, adr; |
@@ -209,7 +209,7 @@ get_io_range(struct IsdnCardState *cs) | |||
209 | } | 209 | } |
210 | } | 210 | } |
211 | 211 | ||
212 | int __init | 212 | int __devinit |
213 | setup_sportster(struct IsdnCard *card) | 213 | setup_sportster(struct IsdnCard *card) |
214 | { | 214 | { |
215 | struct IsdnCardState *cs = card->cs; | 215 | struct IsdnCardState *cs = card->cs; |
diff --git a/drivers/isdn/hisax/teleint.c b/drivers/isdn/hisax/teleint.c index a2b1816af37a..e94dc6f5bd62 100644 --- a/drivers/isdn/hisax/teleint.c +++ b/drivers/isdn/hisax/teleint.c | |||
@@ -261,7 +261,7 @@ TeleInt_card_msg(struct IsdnCardState *cs, int mt, void *arg) | |||
261 | return(0); | 261 | return(0); |
262 | } | 262 | } |
263 | 263 | ||
264 | int __init | 264 | int __devinit |
265 | setup_TeleInt(struct IsdnCard *card) | 265 | setup_TeleInt(struct IsdnCard *card) |
266 | { | 266 | { |
267 | struct IsdnCardState *cs = card->cs; | 267 | struct IsdnCardState *cs = card->cs; |
diff --git a/drivers/isdn/hisax/teles0.c b/drivers/isdn/hisax/teles0.c index 2b7df8f98233..f94af0930a17 100644 --- a/drivers/isdn/hisax/teles0.c +++ b/drivers/isdn/hisax/teles0.c | |||
@@ -265,7 +265,7 @@ Teles_card_msg(struct IsdnCardState *cs, int mt, void *arg) | |||
265 | return(0); | 265 | return(0); |
266 | } | 266 | } |
267 | 267 | ||
268 | int __init | 268 | int __devinit |
269 | setup_teles0(struct IsdnCard *card) | 269 | setup_teles0(struct IsdnCard *card) |
270 | { | 270 | { |
271 | u_char val; | 271 | u_char val; |
diff --git a/drivers/isdn/hisax/telespci.c b/drivers/isdn/hisax/telespci.c index 9382cdf04d8d..dca446865f24 100644 --- a/drivers/isdn/hisax/telespci.c +++ b/drivers/isdn/hisax/telespci.c | |||
@@ -284,9 +284,9 @@ TelesPCI_card_msg(struct IsdnCardState *cs, int mt, void *arg) | |||
284 | return(0); | 284 | return(0); |
285 | } | 285 | } |
286 | 286 | ||
287 | static struct pci_dev *dev_tel __initdata = NULL; | 287 | static struct pci_dev *dev_tel __devinitdata = NULL; |
288 | 288 | ||
289 | int __init | 289 | int __devinit |
290 | setup_telespci(struct IsdnCard *card) | 290 | setup_telespci(struct IsdnCard *card) |
291 | { | 291 | { |
292 | struct IsdnCardState *cs = card->cs; | 292 | struct IsdnCardState *cs = card->cs; |
diff --git a/drivers/isdn/hisax/w6692.c b/drivers/isdn/hisax/w6692.c index 6c68419c05ff..0595293b8659 100644 --- a/drivers/isdn/hisax/w6692.c +++ b/drivers/isdn/hisax/w6692.c | |||
@@ -44,11 +44,11 @@ static const char *w6692_revision = "$Revision: 1.18.2.4 $"; | |||
44 | 44 | ||
45 | #define DBUSY_TIMER_VALUE 80 | 45 | #define DBUSY_TIMER_VALUE 80 |
46 | 46 | ||
47 | static char *W6692Ver[] __initdata = | 47 | static char *W6692Ver[] = |
48 | {"W6692 V00", "W6692 V01", "W6692 V10", | 48 | {"W6692 V00", "W6692 V01", "W6692 V10", |
49 | "W6692 V11"}; | 49 | "W6692 V11"}; |
50 | 50 | ||
51 | static void __init | 51 | static void |
52 | W6692Version(struct IsdnCardState *cs, char *s) | 52 | W6692Version(struct IsdnCardState *cs, char *s) |
53 | { | 53 | { |
54 | int val; | 54 | int val; |
@@ -897,7 +897,7 @@ static void resetW6692(struct IsdnCardState *cs) | |||
897 | } | 897 | } |
898 | } | 898 | } |
899 | 899 | ||
900 | static void __init initW6692(struct IsdnCardState *cs, int part) | 900 | static void initW6692(struct IsdnCardState *cs, int part) |
901 | { | 901 | { |
902 | if (part & 1) { | 902 | if (part & 1) { |
903 | cs->setstack_d = setstack_W6692; | 903 | cs->setstack_d = setstack_W6692; |
@@ -992,9 +992,9 @@ w6692_card_msg(struct IsdnCardState *cs, int mt, void *arg) | |||
992 | 992 | ||
993 | static int id_idx ; | 993 | static int id_idx ; |
994 | 994 | ||
995 | static struct pci_dev *dev_w6692 __initdata = NULL; | 995 | static struct pci_dev *dev_w6692 __devinitdata = NULL; |
996 | 996 | ||
997 | int __init | 997 | int __devinit |
998 | setup_w6692(struct IsdnCard *card) | 998 | setup_w6692(struct IsdnCard *card) |
999 | { | 999 | { |
1000 | struct IsdnCardState *cs = card->cs; | 1000 | struct IsdnCardState *cs = card->cs; |
diff --git a/drivers/isdn/i4l/isdn_common.c b/drivers/isdn/i4l/isdn_common.c index 9f6c6375ff75..c3d79eef9e32 100644 --- a/drivers/isdn/i4l/isdn_common.c +++ b/drivers/isdn/i4l/isdn_common.c | |||
@@ -1059,7 +1059,7 @@ isdn_info_update(void) | |||
1059 | static ssize_t | 1059 | static ssize_t |
1060 | isdn_read(struct file *file, char __user *buf, size_t count, loff_t * off) | 1060 | isdn_read(struct file *file, char __user *buf, size_t count, loff_t * off) |
1061 | { | 1061 | { |
1062 | uint minor = MINOR(file->f_dentry->d_inode->i_rdev); | 1062 | uint minor = iminor(file->f_dentry->d_inode); |
1063 | int len = 0; | 1063 | int len = 0; |
1064 | int drvidx; | 1064 | int drvidx; |
1065 | int chidx; | 1065 | int chidx; |
@@ -1163,7 +1163,7 @@ isdn_read(struct file *file, char __user *buf, size_t count, loff_t * off) | |||
1163 | static ssize_t | 1163 | static ssize_t |
1164 | isdn_write(struct file *file, const char __user *buf, size_t count, loff_t * off) | 1164 | isdn_write(struct file *file, const char __user *buf, size_t count, loff_t * off) |
1165 | { | 1165 | { |
1166 | uint minor = MINOR(file->f_dentry->d_inode->i_rdev); | 1166 | uint minor = iminor(file->f_dentry->d_inode); |
1167 | int drvidx; | 1167 | int drvidx; |
1168 | int chidx; | 1168 | int chidx; |
1169 | int retval; | 1169 | int retval; |
@@ -1225,7 +1225,7 @@ static unsigned int | |||
1225 | isdn_poll(struct file *file, poll_table * wait) | 1225 | isdn_poll(struct file *file, poll_table * wait) |
1226 | { | 1226 | { |
1227 | unsigned int mask = 0; | 1227 | unsigned int mask = 0; |
1228 | unsigned int minor = MINOR(file->f_dentry->d_inode->i_rdev); | 1228 | unsigned int minor = iminor(file->f_dentry->d_inode); |
1229 | int drvidx = isdn_minor2drv(minor - ISDN_MINOR_CTRL); | 1229 | int drvidx = isdn_minor2drv(minor - ISDN_MINOR_CTRL); |
1230 | 1230 | ||
1231 | lock_kernel(); | 1231 | lock_kernel(); |
@@ -1266,7 +1266,7 @@ isdn_poll(struct file *file, poll_table * wait) | |||
1266 | static int | 1266 | static int |
1267 | isdn_ioctl(struct inode *inode, struct file *file, uint cmd, ulong arg) | 1267 | isdn_ioctl(struct inode *inode, struct file *file, uint cmd, ulong arg) |
1268 | { | 1268 | { |
1269 | uint minor = MINOR(inode->i_rdev); | 1269 | uint minor = iminor(inode); |
1270 | isdn_ctrl c; | 1270 | isdn_ctrl c; |
1271 | int drvidx; | 1271 | int drvidx; |
1272 | int chidx; | 1272 | int chidx; |
@@ -1717,7 +1717,7 @@ isdn_ioctl(struct inode *inode, struct file *file, uint cmd, ulong arg) | |||
1717 | static int | 1717 | static int |
1718 | isdn_open(struct inode *ino, struct file *filep) | 1718 | isdn_open(struct inode *ino, struct file *filep) |
1719 | { | 1719 | { |
1720 | uint minor = MINOR(ino->i_rdev); | 1720 | uint minor = iminor(ino); |
1721 | int drvidx; | 1721 | int drvidx; |
1722 | int chidx; | 1722 | int chidx; |
1723 | int retval = -ENODEV; | 1723 | int retval = -ENODEV; |
@@ -1779,7 +1779,7 @@ isdn_open(struct inode *ino, struct file *filep) | |||
1779 | static int | 1779 | static int |
1780 | isdn_close(struct inode *ino, struct file *filep) | 1780 | isdn_close(struct inode *ino, struct file *filep) |
1781 | { | 1781 | { |
1782 | uint minor = MINOR(ino->i_rdev); | 1782 | uint minor = iminor(ino); |
1783 | 1783 | ||
1784 | lock_kernel(); | 1784 | lock_kernel(); |
1785 | if (minor == ISDN_MINOR_STATUS) { | 1785 | if (minor == ISDN_MINOR_STATUS) { |
diff --git a/drivers/isdn/i4l/isdn_ppp.c b/drivers/isdn/i4l/isdn_ppp.c index 29e7667ec962..119412d6bd15 100644 --- a/drivers/isdn/i4l/isdn_ppp.c +++ b/drivers/isdn/i4l/isdn_ppp.c | |||
@@ -667,7 +667,7 @@ isdn_ppp_poll(struct file *file, poll_table * wait) | |||
667 | 667 | ||
668 | if (is->debug & 0x2) | 668 | if (is->debug & 0x2) |
669 | printk(KERN_DEBUG "isdn_ppp_poll: minor: %d\n", | 669 | printk(KERN_DEBUG "isdn_ppp_poll: minor: %d\n", |
670 | MINOR(file->f_dentry->d_inode->i_rdev)); | 670 | iminor(file->f_dentry->d_inode)); |
671 | 671 | ||
672 | /* just registers wait_queue hook. This doesn't really wait. */ | 672 | /* just registers wait_queue hook. This doesn't really wait. */ |
673 | poll_wait(file, &is->wq, wait); | 673 | poll_wait(file, &is->wq, wait); |
diff --git a/drivers/leds/Kconfig b/drivers/leds/Kconfig index 96509989e921..9c39b98d5a5b 100644 --- a/drivers/leds/Kconfig +++ b/drivers/leds/Kconfig | |||
@@ -69,6 +69,13 @@ config LEDS_AMS_DELTA | |||
69 | help | 69 | help |
70 | This option enables support for the LEDs on Amstrad Delta (E3). | 70 | This option enables support for the LEDs on Amstrad Delta (E3). |
71 | 71 | ||
72 | config LEDS_NET48XX | ||
73 | tristate "LED Support for Soekris net48xx series Error LED" | ||
74 | depends on LEDS_CLASS && SCx200_GPIO | ||
75 | help | ||
76 | This option enables support for the Soekris net4801 and net4826 error | ||
77 | LED. | ||
78 | |||
72 | comment "LED Triggers" | 79 | comment "LED Triggers" |
73 | 80 | ||
74 | config LEDS_TRIGGERS | 81 | config LEDS_TRIGGERS |
diff --git a/drivers/leds/Makefile b/drivers/leds/Makefile index 88d3b6eaa6a2..6aa2aed7539d 100644 --- a/drivers/leds/Makefile +++ b/drivers/leds/Makefile | |||
@@ -12,6 +12,7 @@ obj-$(CONFIG_LEDS_IXP4XX) += leds-ixp4xx-gpio.o | |||
12 | obj-$(CONFIG_LEDS_TOSA) += leds-tosa.o | 12 | obj-$(CONFIG_LEDS_TOSA) += leds-tosa.o |
13 | obj-$(CONFIG_LEDS_S3C24XX) += leds-s3c24xx.o | 13 | obj-$(CONFIG_LEDS_S3C24XX) += leds-s3c24xx.o |
14 | obj-$(CONFIG_LEDS_AMS_DELTA) += leds-ams-delta.o | 14 | obj-$(CONFIG_LEDS_AMS_DELTA) += leds-ams-delta.o |
15 | obj-$(CONFIG_LEDS_NET48XX) += leds-net48xx.o | ||
15 | 16 | ||
16 | # LED Triggers | 17 | # LED Triggers |
17 | obj-$(CONFIG_LEDS_TRIGGER_TIMER) += ledtrig-timer.o | 18 | obj-$(CONFIG_LEDS_TRIGGER_TIMER) += ledtrig-timer.o |
diff --git a/drivers/leds/leds-net48xx.c b/drivers/leds/leds-net48xx.c new file mode 100644 index 000000000000..713c4a8aa77d --- /dev/null +++ b/drivers/leds/leds-net48xx.c | |||
@@ -0,0 +1,116 @@ | |||
1 | /* | ||
2 | * LEDs driver for Soekris net48xx | ||
3 | * | ||
4 | * Copyright (C) 2006 Chris Boot <bootc@bootc.net> | ||
5 | * | ||
6 | * Based on leds-ams-delta.c | ||
7 | * | ||
8 | * This program is free software; you can redistribute it and/or modify | ||
9 | * it under the terms of the GNU General Public License version 2 as | ||
10 | * published by the Free Software Foundation. | ||
11 | */ | ||
12 | |||
13 | #include <linux/kernel.h> | ||
14 | #include <linux/init.h> | ||
15 | #include <linux/platform_device.h> | ||
16 | #include <linux/leds.h> | ||
17 | #include <linux/err.h> | ||
18 | #include <asm/io.h> | ||
19 | #include <linux/scx200_gpio.h> | ||
20 | |||
21 | #define DRVNAME "net48xx-led" | ||
22 | #define NET48XX_ERROR_LED_GPIO 20 | ||
23 | |||
24 | static struct platform_device *pdev; | ||
25 | |||
26 | static void net48xx_error_led_set(struct led_classdev *led_cdev, | ||
27 | enum led_brightness value) | ||
28 | { | ||
29 | if (value) | ||
30 | scx200_gpio_set_high(NET48XX_ERROR_LED_GPIO); | ||
31 | else | ||
32 | scx200_gpio_set_low(NET48XX_ERROR_LED_GPIO); | ||
33 | } | ||
34 | |||
35 | static struct led_classdev net48xx_error_led = { | ||
36 | .name = "net48xx:error", | ||
37 | .brightness_set = net48xx_error_led_set, | ||
38 | }; | ||
39 | |||
40 | #ifdef CONFIG_PM | ||
41 | static int net48xx_led_suspend(struct platform_device *dev, | ||
42 | pm_message_t state) | ||
43 | { | ||
44 | led_classdev_suspend(&net48xx_error_led); | ||
45 | return 0; | ||
46 | } | ||
47 | |||
48 | static int net48xx_led_resume(struct platform_device *dev) | ||
49 | { | ||
50 | led_classdev_resume(&net48xx_error_led); | ||
51 | return 0; | ||
52 | } | ||
53 | #else | ||
54 | #define net48xx_led_suspend NULL | ||
55 | #define net48xx_led_resume NULL | ||
56 | #endif | ||
57 | |||
58 | static int net48xx_led_probe(struct platform_device *pdev) | ||
59 | { | ||
60 | return led_classdev_register(&pdev->dev, &net48xx_error_led); | ||
61 | } | ||
62 | |||
63 | static int net48xx_led_remove(struct platform_device *pdev) | ||
64 | { | ||
65 | led_classdev_unregister(&net48xx_error_led); | ||
66 | return 0; | ||
67 | } | ||
68 | |||
69 | static struct platform_driver net48xx_led_driver = { | ||
70 | .probe = net48xx_led_probe, | ||
71 | .remove = net48xx_led_remove, | ||
72 | .suspend = net48xx_led_suspend, | ||
73 | .resume = net48xx_led_resume, | ||
74 | .driver = { | ||
75 | .name = DRVNAME, | ||
76 | .owner = THIS_MODULE, | ||
77 | }, | ||
78 | }; | ||
79 | |||
80 | static int __init net48xx_led_init(void) | ||
81 | { | ||
82 | int ret; | ||
83 | |||
84 | if (!scx200_gpio_present()) { | ||
85 | ret = -ENODEV; | ||
86 | goto out; | ||
87 | } | ||
88 | |||
89 | ret = platform_driver_register(&net48xx_led_driver); | ||
90 | if (ret < 0) | ||
91 | goto out; | ||
92 | |||
93 | pdev = platform_device_register_simple(DRVNAME, -1, NULL, 0); | ||
94 | if (IS_ERR(pdev)) { | ||
95 | ret = PTR_ERR(pdev); | ||
96 | platform_driver_unregister(&net48xx_led_driver); | ||
97 | goto out; | ||
98 | } | ||
99 | |||
100 | out: | ||
101 | return ret; | ||
102 | } | ||
103 | |||
104 | static void __exit net48xx_led_exit(void) | ||
105 | { | ||
106 | platform_device_unregister(pdev); | ||
107 | platform_driver_unregister(&net48xx_led_driver); | ||
108 | } | ||
109 | |||
110 | module_init(net48xx_led_init); | ||
111 | module_exit(net48xx_led_exit); | ||
112 | |||
113 | MODULE_AUTHOR("Chris Boot <bootc@bootc.net>"); | ||
114 | MODULE_DESCRIPTION("Soekris net48xx LED driver"); | ||
115 | MODULE_LICENSE("GPL"); | ||
116 | |||
diff --git a/drivers/macintosh/Kconfig b/drivers/macintosh/Kconfig index 54f3f6b94efc..f5fe7fb4b3ad 100644 --- a/drivers/macintosh/Kconfig +++ b/drivers/macintosh/Kconfig | |||
@@ -113,7 +113,10 @@ config PMAC_MEDIABAY | |||
113 | 113 | ||
114 | config PMAC_BACKLIGHT | 114 | config PMAC_BACKLIGHT |
115 | bool "Backlight control for LCD screens" | 115 | bool "Backlight control for LCD screens" |
116 | depends on ADB_PMU && (BROKEN || !PPC64) | 116 | depends on ADB_PMU && FB = y && (BROKEN || !PPC64) |
117 | select FB_BACKLIGHT | ||
118 | select BACKLIGHT_CLASS_DEVICE | ||
119 | select BACKLIGHT_LCD_SUPPORT | ||
117 | help | 120 | help |
118 | Say Y here to enable Macintosh specific extensions of the generic | 121 | Say Y here to enable Macintosh specific extensions of the generic |
119 | backlight code. With this enabled, the brightness keys on older | 122 | backlight code. With this enabled, the brightness keys on older |
diff --git a/drivers/macintosh/macio_asic.c b/drivers/macintosh/macio_asic.c index 80c0c665b5f6..82657bc86d19 100644 --- a/drivers/macintosh/macio_asic.c +++ b/drivers/macintosh/macio_asic.c | |||
@@ -330,7 +330,7 @@ static void macio_create_fixup_irq(struct macio_dev *dev, int index, | |||
330 | { | 330 | { |
331 | unsigned int irq; | 331 | unsigned int irq; |
332 | 332 | ||
333 | irq = irq_create_mapping(NULL, line, 0); | 333 | irq = irq_create_mapping(NULL, line); |
334 | if (irq != NO_IRQ) { | 334 | if (irq != NO_IRQ) { |
335 | dev->interrupt[index].start = irq; | 335 | dev->interrupt[index].start = irq; |
336 | dev->interrupt[index].flags = IORESOURCE_IRQ; | 336 | dev->interrupt[index].flags = IORESOURCE_IRQ; |
diff --git a/drivers/macintosh/smu.c b/drivers/macintosh/smu.c index f139a74696fe..00ef46898147 100644 --- a/drivers/macintosh/smu.c +++ b/drivers/macintosh/smu.c | |||
@@ -75,9 +75,11 @@ struct smu_device { | |||
75 | struct of_device *of_dev; | 75 | struct of_device *of_dev; |
76 | int doorbell; /* doorbell gpio */ | 76 | int doorbell; /* doorbell gpio */ |
77 | u32 __iomem *db_buf; /* doorbell buffer */ | 77 | u32 __iomem *db_buf; /* doorbell buffer */ |
78 | int db_irq; | 78 | struct device_node *db_node; |
79 | unsigned int db_irq; | ||
79 | int msg; | 80 | int msg; |
80 | int msg_irq; | 81 | struct device_node *msg_node; |
82 | unsigned int msg_irq; | ||
81 | struct smu_cmd_buf *cmd_buf; /* command buffer virtual */ | 83 | struct smu_cmd_buf *cmd_buf; /* command buffer virtual */ |
82 | u32 cmd_buf_abs; /* command buffer absolute */ | 84 | u32 cmd_buf_abs; /* command buffer absolute */ |
83 | struct list_head cmd_list; | 85 | struct list_head cmd_list; |
@@ -93,6 +95,7 @@ struct smu_device { | |||
93 | */ | 95 | */ |
94 | static struct smu_device *smu; | 96 | static struct smu_device *smu; |
95 | static DEFINE_MUTEX(smu_part_access); | 97 | static DEFINE_MUTEX(smu_part_access); |
98 | static int smu_irq_inited; | ||
96 | 99 | ||
97 | static void smu_i2c_retry(unsigned long data); | 100 | static void smu_i2c_retry(unsigned long data); |
98 | 101 | ||
@@ -257,6 +260,10 @@ int smu_queue_cmd(struct smu_cmd *cmd) | |||
257 | smu_start_cmd(); | 260 | smu_start_cmd(); |
258 | spin_unlock_irqrestore(&smu->lock, flags); | 261 | spin_unlock_irqrestore(&smu->lock, flags); |
259 | 262 | ||
263 | /* Workaround for early calls when irq isn't available */ | ||
264 | if (!smu_irq_inited || smu->db_irq == NO_IRQ) | ||
265 | smu_spinwait_cmd(cmd); | ||
266 | |||
260 | return 0; | 267 | return 0; |
261 | } | 268 | } |
262 | EXPORT_SYMBOL(smu_queue_cmd); | 269 | EXPORT_SYMBOL(smu_queue_cmd); |
@@ -478,14 +485,15 @@ int __init smu_init (void) | |||
478 | smu->cmd_buf_abs = (u32)smu_cmdbuf_abs; | 485 | smu->cmd_buf_abs = (u32)smu_cmdbuf_abs; |
479 | smu->cmd_buf = (struct smu_cmd_buf *)abs_to_virt(smu_cmdbuf_abs); | 486 | smu->cmd_buf = (struct smu_cmd_buf *)abs_to_virt(smu_cmdbuf_abs); |
480 | 487 | ||
481 | np = of_find_node_by_name(NULL, "smu-doorbell"); | 488 | smu->db_node = of_find_node_by_name(NULL, "smu-doorbell"); |
482 | if (np == NULL) { | 489 | if (smu->db_node == NULL) { |
483 | printk(KERN_ERR "SMU: Can't find doorbell GPIO !\n"); | 490 | printk(KERN_ERR "SMU: Can't find doorbell GPIO !\n"); |
484 | goto fail; | 491 | goto fail; |
485 | } | 492 | } |
486 | data = (u32 *)get_property(np, "reg", NULL); | 493 | data = (u32 *)get_property(smu->db_node, "reg", NULL); |
487 | if (data == NULL) { | 494 | if (data == NULL) { |
488 | of_node_put(np); | 495 | of_node_put(smu->db_node); |
496 | smu->db_node = NULL; | ||
489 | printk(KERN_ERR "SMU: Can't find doorbell GPIO address !\n"); | 497 | printk(KERN_ERR "SMU: Can't find doorbell GPIO address !\n"); |
490 | goto fail; | 498 | goto fail; |
491 | } | 499 | } |
@@ -497,25 +505,21 @@ int __init smu_init (void) | |||
497 | smu->doorbell = *data; | 505 | smu->doorbell = *data; |
498 | if (smu->doorbell < 0x50) | 506 | if (smu->doorbell < 0x50) |
499 | smu->doorbell += 0x50; | 507 | smu->doorbell += 0x50; |
500 | smu->db_irq = irq_of_parse_and_map(np, 0); | ||
501 | |||
502 | of_node_put(np); | ||
503 | 508 | ||
504 | /* Now look for the smu-interrupt GPIO */ | 509 | /* Now look for the smu-interrupt GPIO */ |
505 | do { | 510 | do { |
506 | np = of_find_node_by_name(NULL, "smu-interrupt"); | 511 | smu->msg_node = of_find_node_by_name(NULL, "smu-interrupt"); |
507 | if (np == NULL) | 512 | if (smu->msg_node == NULL) |
508 | break; | 513 | break; |
509 | data = (u32 *)get_property(np, "reg", NULL); | 514 | data = (u32 *)get_property(smu->msg_node, "reg", NULL); |
510 | if (data == NULL) { | 515 | if (data == NULL) { |
511 | of_node_put(np); | 516 | of_node_put(smu->msg_node); |
517 | smu->msg_node = NULL; | ||
512 | break; | 518 | break; |
513 | } | 519 | } |
514 | smu->msg = *data; | 520 | smu->msg = *data; |
515 | if (smu->msg < 0x50) | 521 | if (smu->msg < 0x50) |
516 | smu->msg += 0x50; | 522 | smu->msg += 0x50; |
517 | smu->msg_irq = irq_of_parse_and_map(np, 0); | ||
518 | of_node_put(np); | ||
519 | } while(0); | 523 | } while(0); |
520 | 524 | ||
521 | /* Doorbell buffer is currently hard-coded, I didn't find a proper | 525 | /* Doorbell buffer is currently hard-coded, I didn't find a proper |
@@ -547,6 +551,19 @@ static int smu_late_init(void) | |||
547 | smu->i2c_timer.function = smu_i2c_retry; | 551 | smu->i2c_timer.function = smu_i2c_retry; |
548 | smu->i2c_timer.data = (unsigned long)smu; | 552 | smu->i2c_timer.data = (unsigned long)smu; |
549 | 553 | ||
554 | if (smu->db_node) { | ||
555 | smu->db_irq = irq_of_parse_and_map(smu->db_node, 0); | ||
556 | if (smu->db_irq == NO_IRQ) | ||
557 | printk(KERN_ERR "smu: failed to map irq for node %s\n", | ||
558 | smu->db_node->full_name); | ||
559 | } | ||
560 | if (smu->msg_node) { | ||
561 | smu->msg_irq = irq_of_parse_and_map(smu->msg_node, 0); | ||
562 | if (smu->msg_irq == NO_IRQ) | ||
563 | printk(KERN_ERR "smu: failed to map irq for node %s\n", | ||
564 | smu->msg_node->full_name); | ||
565 | } | ||
566 | |||
550 | /* | 567 | /* |
551 | * Try to request the interrupts | 568 | * Try to request the interrupts |
552 | */ | 569 | */ |
@@ -571,6 +588,7 @@ static int smu_late_init(void) | |||
571 | } | 588 | } |
572 | } | 589 | } |
573 | 590 | ||
591 | smu_irq_inited = 1; | ||
574 | return 0; | 592 | return 0; |
575 | } | 593 | } |
576 | /* This has to be before arch_initcall as the low i2c stuff relies on the | 594 | /* This has to be before arch_initcall as the low i2c stuff relies on the |
@@ -742,6 +760,11 @@ static void smu_i2c_low_completion(struct smu_cmd *scmd, void *misc) | |||
742 | if (fail && --cmd->retries > 0) { | 760 | if (fail && --cmd->retries > 0) { |
743 | DPRINTK("SMU: i2c failure, starting timer...\n"); | 761 | DPRINTK("SMU: i2c failure, starting timer...\n"); |
744 | BUG_ON(cmd != smu->cmd_i2c_cur); | 762 | BUG_ON(cmd != smu->cmd_i2c_cur); |
763 | if (!smu_irq_inited) { | ||
764 | mdelay(5); | ||
765 | smu_i2c_retry(0); | ||
766 | return; | ||
767 | } | ||
745 | mod_timer(&smu->i2c_timer, jiffies + msecs_to_jiffies(5)); | 768 | mod_timer(&smu->i2c_timer, jiffies + msecs_to_jiffies(5)); |
746 | return; | 769 | return; |
747 | } | 770 | } |
diff --git a/drivers/md/md.c b/drivers/md/md.c index e4e161372a3e..b6d16022a53e 100644 --- a/drivers/md/md.c +++ b/drivers/md/md.c | |||
@@ -110,7 +110,7 @@ static ctl_table raid_table[] = { | |||
110 | .procname = "speed_limit_min", | 110 | .procname = "speed_limit_min", |
111 | .data = &sysctl_speed_limit_min, | 111 | .data = &sysctl_speed_limit_min, |
112 | .maxlen = sizeof(int), | 112 | .maxlen = sizeof(int), |
113 | .mode = 0644, | 113 | .mode = S_IRUGO|S_IWUSR, |
114 | .proc_handler = &proc_dointvec, | 114 | .proc_handler = &proc_dointvec, |
115 | }, | 115 | }, |
116 | { | 116 | { |
@@ -118,7 +118,7 @@ static ctl_table raid_table[] = { | |||
118 | .procname = "speed_limit_max", | 118 | .procname = "speed_limit_max", |
119 | .data = &sysctl_speed_limit_max, | 119 | .data = &sysctl_speed_limit_max, |
120 | .maxlen = sizeof(int), | 120 | .maxlen = sizeof(int), |
121 | .mode = 0644, | 121 | .mode = S_IRUGO|S_IWUSR, |
122 | .proc_handler = &proc_dointvec, | 122 | .proc_handler = &proc_dointvec, |
123 | }, | 123 | }, |
124 | { .ctl_name = 0 } | 124 | { .ctl_name = 0 } |
@@ -129,7 +129,7 @@ static ctl_table raid_dir_table[] = { | |||
129 | .ctl_name = DEV_RAID, | 129 | .ctl_name = DEV_RAID, |
130 | .procname = "raid", | 130 | .procname = "raid", |
131 | .maxlen = 0, | 131 | .maxlen = 0, |
132 | .mode = 0555, | 132 | .mode = S_IRUGO|S_IXUGO, |
133 | .child = raid_table, | 133 | .child = raid_table, |
134 | }, | 134 | }, |
135 | { .ctl_name = 0 } | 135 | { .ctl_name = 0 } |
@@ -1062,6 +1062,11 @@ static int super_1_load(mdk_rdev_t *rdev, mdk_rdev_t *refdev, int minor_version) | |||
1062 | if (rdev->sb_size & bmask) | 1062 | if (rdev->sb_size & bmask) |
1063 | rdev-> sb_size = (rdev->sb_size | bmask)+1; | 1063 | rdev-> sb_size = (rdev->sb_size | bmask)+1; |
1064 | 1064 | ||
1065 | if (sb->level == cpu_to_le32(LEVEL_MULTIPATH)) | ||
1066 | rdev->desc_nr = -1; | ||
1067 | else | ||
1068 | rdev->desc_nr = le32_to_cpu(sb->dev_number); | ||
1069 | |||
1065 | if (refdev == 0) | 1070 | if (refdev == 0) |
1066 | ret = 1; | 1071 | ret = 1; |
1067 | else { | 1072 | else { |
@@ -1171,7 +1176,6 @@ static int super_1_validate(mddev_t *mddev, mdk_rdev_t *rdev) | |||
1171 | } | 1176 | } |
1172 | if (mddev->level != LEVEL_MULTIPATH) { | 1177 | if (mddev->level != LEVEL_MULTIPATH) { |
1173 | int role; | 1178 | int role; |
1174 | rdev->desc_nr = le32_to_cpu(sb->dev_number); | ||
1175 | role = le16_to_cpu(sb->dev_roles[rdev->desc_nr]); | 1179 | role = le16_to_cpu(sb->dev_roles[rdev->desc_nr]); |
1176 | switch(role) { | 1180 | switch(role) { |
1177 | case 0xffff: /* spare */ | 1181 | case 0xffff: /* spare */ |
@@ -1779,8 +1783,8 @@ state_store(mdk_rdev_t *rdev, const char *buf, size_t len) | |||
1779 | } | 1783 | } |
1780 | return err ? err : len; | 1784 | return err ? err : len; |
1781 | } | 1785 | } |
1782 | static struct rdev_sysfs_entry | 1786 | static struct rdev_sysfs_entry rdev_state = |
1783 | rdev_state = __ATTR(state, 0644, state_show, state_store); | 1787 | __ATTR(state, S_IRUGO|S_IWUSR, state_show, state_store); |
1784 | 1788 | ||
1785 | static ssize_t | 1789 | static ssize_t |
1786 | super_show(mdk_rdev_t *rdev, char *page) | 1790 | super_show(mdk_rdev_t *rdev, char *page) |
@@ -1811,7 +1815,7 @@ errors_store(mdk_rdev_t *rdev, const char *buf, size_t len) | |||
1811 | return -EINVAL; | 1815 | return -EINVAL; |
1812 | } | 1816 | } |
1813 | static struct rdev_sysfs_entry rdev_errors = | 1817 | static struct rdev_sysfs_entry rdev_errors = |
1814 | __ATTR(errors, 0644, errors_show, errors_store); | 1818 | __ATTR(errors, S_IRUGO|S_IWUSR, errors_show, errors_store); |
1815 | 1819 | ||
1816 | static ssize_t | 1820 | static ssize_t |
1817 | slot_show(mdk_rdev_t *rdev, char *page) | 1821 | slot_show(mdk_rdev_t *rdev, char *page) |
@@ -1845,7 +1849,7 @@ slot_store(mdk_rdev_t *rdev, const char *buf, size_t len) | |||
1845 | 1849 | ||
1846 | 1850 | ||
1847 | static struct rdev_sysfs_entry rdev_slot = | 1851 | static struct rdev_sysfs_entry rdev_slot = |
1848 | __ATTR(slot, 0644, slot_show, slot_store); | 1852 | __ATTR(slot, S_IRUGO|S_IWUSR, slot_show, slot_store); |
1849 | 1853 | ||
1850 | static ssize_t | 1854 | static ssize_t |
1851 | offset_show(mdk_rdev_t *rdev, char *page) | 1855 | offset_show(mdk_rdev_t *rdev, char *page) |
@@ -1867,7 +1871,7 @@ offset_store(mdk_rdev_t *rdev, const char *buf, size_t len) | |||
1867 | } | 1871 | } |
1868 | 1872 | ||
1869 | static struct rdev_sysfs_entry rdev_offset = | 1873 | static struct rdev_sysfs_entry rdev_offset = |
1870 | __ATTR(offset, 0644, offset_show, offset_store); | 1874 | __ATTR(offset, S_IRUGO|S_IWUSR, offset_show, offset_store); |
1871 | 1875 | ||
1872 | static ssize_t | 1876 | static ssize_t |
1873 | rdev_size_show(mdk_rdev_t *rdev, char *page) | 1877 | rdev_size_show(mdk_rdev_t *rdev, char *page) |
@@ -1891,7 +1895,7 @@ rdev_size_store(mdk_rdev_t *rdev, const char *buf, size_t len) | |||
1891 | } | 1895 | } |
1892 | 1896 | ||
1893 | static struct rdev_sysfs_entry rdev_size = | 1897 | static struct rdev_sysfs_entry rdev_size = |
1894 | __ATTR(size, 0644, rdev_size_show, rdev_size_store); | 1898 | __ATTR(size, S_IRUGO|S_IWUSR, rdev_size_show, rdev_size_store); |
1895 | 1899 | ||
1896 | static struct attribute *rdev_default_attrs[] = { | 1900 | static struct attribute *rdev_default_attrs[] = { |
1897 | &rdev_state.attr, | 1901 | &rdev_state.attr, |
@@ -1922,6 +1926,8 @@ rdev_attr_store(struct kobject *kobj, struct attribute *attr, | |||
1922 | 1926 | ||
1923 | if (!entry->store) | 1927 | if (!entry->store) |
1924 | return -EIO; | 1928 | return -EIO; |
1929 | if (!capable(CAP_SYS_ADMIN)) | ||
1930 | return -EACCES; | ||
1925 | return entry->store(rdev, page, length); | 1931 | return entry->store(rdev, page, length); |
1926 | } | 1932 | } |
1927 | 1933 | ||
@@ -2128,7 +2134,7 @@ safe_delay_store(mddev_t *mddev, const char *cbuf, size_t len) | |||
2128 | return len; | 2134 | return len; |
2129 | } | 2135 | } |
2130 | static struct md_sysfs_entry md_safe_delay = | 2136 | static struct md_sysfs_entry md_safe_delay = |
2131 | __ATTR(safe_mode_delay, 0644,safe_delay_show, safe_delay_store); | 2137 | __ATTR(safe_mode_delay, S_IRUGO|S_IWUSR,safe_delay_show, safe_delay_store); |
2132 | 2138 | ||
2133 | static ssize_t | 2139 | static ssize_t |
2134 | level_show(mddev_t *mddev, char *page) | 2140 | level_show(mddev_t *mddev, char *page) |
@@ -2163,7 +2169,7 @@ level_store(mddev_t *mddev, const char *buf, size_t len) | |||
2163 | } | 2169 | } |
2164 | 2170 | ||
2165 | static struct md_sysfs_entry md_level = | 2171 | static struct md_sysfs_entry md_level = |
2166 | __ATTR(level, 0644, level_show, level_store); | 2172 | __ATTR(level, S_IRUGO|S_IWUSR, level_show, level_store); |
2167 | 2173 | ||
2168 | 2174 | ||
2169 | static ssize_t | 2175 | static ssize_t |
@@ -2188,7 +2194,7 @@ layout_store(mddev_t *mddev, const char *buf, size_t len) | |||
2188 | return len; | 2194 | return len; |
2189 | } | 2195 | } |
2190 | static struct md_sysfs_entry md_layout = | 2196 | static struct md_sysfs_entry md_layout = |
2191 | __ATTR(layout, 0655, layout_show, layout_store); | 2197 | __ATTR(layout, S_IRUGO|S_IWUSR, layout_show, layout_store); |
2192 | 2198 | ||
2193 | 2199 | ||
2194 | static ssize_t | 2200 | static ssize_t |
@@ -2219,7 +2225,7 @@ raid_disks_store(mddev_t *mddev, const char *buf, size_t len) | |||
2219 | return rv ? rv : len; | 2225 | return rv ? rv : len; |
2220 | } | 2226 | } |
2221 | static struct md_sysfs_entry md_raid_disks = | 2227 | static struct md_sysfs_entry md_raid_disks = |
2222 | __ATTR(raid_disks, 0644, raid_disks_show, raid_disks_store); | 2228 | __ATTR(raid_disks, S_IRUGO|S_IWUSR, raid_disks_show, raid_disks_store); |
2223 | 2229 | ||
2224 | static ssize_t | 2230 | static ssize_t |
2225 | chunk_size_show(mddev_t *mddev, char *page) | 2231 | chunk_size_show(mddev_t *mddev, char *page) |
@@ -2243,7 +2249,7 @@ chunk_size_store(mddev_t *mddev, const char *buf, size_t len) | |||
2243 | return len; | 2249 | return len; |
2244 | } | 2250 | } |
2245 | static struct md_sysfs_entry md_chunk_size = | 2251 | static struct md_sysfs_entry md_chunk_size = |
2246 | __ATTR(chunk_size, 0644, chunk_size_show, chunk_size_store); | 2252 | __ATTR(chunk_size, S_IRUGO|S_IWUSR, chunk_size_show, chunk_size_store); |
2247 | 2253 | ||
2248 | static ssize_t | 2254 | static ssize_t |
2249 | resync_start_show(mddev_t *mddev, char *page) | 2255 | resync_start_show(mddev_t *mddev, char *page) |
@@ -2267,7 +2273,7 @@ resync_start_store(mddev_t *mddev, const char *buf, size_t len) | |||
2267 | return len; | 2273 | return len; |
2268 | } | 2274 | } |
2269 | static struct md_sysfs_entry md_resync_start = | 2275 | static struct md_sysfs_entry md_resync_start = |
2270 | __ATTR(resync_start, 0644, resync_start_show, resync_start_store); | 2276 | __ATTR(resync_start, S_IRUGO|S_IWUSR, resync_start_show, resync_start_store); |
2271 | 2277 | ||
2272 | /* | 2278 | /* |
2273 | * The array state can be: | 2279 | * The array state can be: |
@@ -2437,7 +2443,8 @@ array_state_store(mddev_t *mddev, const char *buf, size_t len) | |||
2437 | else | 2443 | else |
2438 | return len; | 2444 | return len; |
2439 | } | 2445 | } |
2440 | static struct md_sysfs_entry md_array_state = __ATTR(array_state, 0644, array_state_show, array_state_store); | 2446 | static struct md_sysfs_entry md_array_state = |
2447 | __ATTR(array_state, S_IRUGO|S_IWUSR, array_state_show, array_state_store); | ||
2441 | 2448 | ||
2442 | static ssize_t | 2449 | static ssize_t |
2443 | null_show(mddev_t *mddev, char *page) | 2450 | null_show(mddev_t *mddev, char *page) |
@@ -2497,7 +2504,7 @@ new_dev_store(mddev_t *mddev, const char *buf, size_t len) | |||
2497 | } | 2504 | } |
2498 | 2505 | ||
2499 | static struct md_sysfs_entry md_new_device = | 2506 | static struct md_sysfs_entry md_new_device = |
2500 | __ATTR(new_dev, 0200, null_show, new_dev_store); | 2507 | __ATTR(new_dev, S_IWUSR, null_show, new_dev_store); |
2501 | 2508 | ||
2502 | static ssize_t | 2509 | static ssize_t |
2503 | size_show(mddev_t *mddev, char *page) | 2510 | size_show(mddev_t *mddev, char *page) |
@@ -2535,7 +2542,7 @@ size_store(mddev_t *mddev, const char *buf, size_t len) | |||
2535 | } | 2542 | } |
2536 | 2543 | ||
2537 | static struct md_sysfs_entry md_size = | 2544 | static struct md_sysfs_entry md_size = |
2538 | __ATTR(component_size, 0644, size_show, size_store); | 2545 | __ATTR(component_size, S_IRUGO|S_IWUSR, size_show, size_store); |
2539 | 2546 | ||
2540 | 2547 | ||
2541 | /* Metdata version. | 2548 | /* Metdata version. |
@@ -2583,7 +2590,7 @@ metadata_store(mddev_t *mddev, const char *buf, size_t len) | |||
2583 | } | 2590 | } |
2584 | 2591 | ||
2585 | static struct md_sysfs_entry md_metadata = | 2592 | static struct md_sysfs_entry md_metadata = |
2586 | __ATTR(metadata_version, 0644, metadata_show, metadata_store); | 2593 | __ATTR(metadata_version, S_IRUGO|S_IWUSR, metadata_show, metadata_store); |
2587 | 2594 | ||
2588 | static ssize_t | 2595 | static ssize_t |
2589 | action_show(mddev_t *mddev, char *page) | 2596 | action_show(mddev_t *mddev, char *page) |
@@ -2651,12 +2658,11 @@ mismatch_cnt_show(mddev_t *mddev, char *page) | |||
2651 | (unsigned long long) mddev->resync_mismatches); | 2658 | (unsigned long long) mddev->resync_mismatches); |
2652 | } | 2659 | } |
2653 | 2660 | ||
2654 | static struct md_sysfs_entry | 2661 | static struct md_sysfs_entry md_scan_mode = |
2655 | md_scan_mode = __ATTR(sync_action, S_IRUGO|S_IWUSR, action_show, action_store); | 2662 | __ATTR(sync_action, S_IRUGO|S_IWUSR, action_show, action_store); |
2656 | 2663 | ||
2657 | 2664 | ||
2658 | static struct md_sysfs_entry | 2665 | static struct md_sysfs_entry md_mismatches = __ATTR_RO(mismatch_cnt); |
2659 | md_mismatches = __ATTR_RO(mismatch_cnt); | ||
2660 | 2666 | ||
2661 | static ssize_t | 2667 | static ssize_t |
2662 | sync_min_show(mddev_t *mddev, char *page) | 2668 | sync_min_show(mddev_t *mddev, char *page) |
@@ -2715,15 +2721,14 @@ static ssize_t | |||
2715 | sync_speed_show(mddev_t *mddev, char *page) | 2721 | sync_speed_show(mddev_t *mddev, char *page) |
2716 | { | 2722 | { |
2717 | unsigned long resync, dt, db; | 2723 | unsigned long resync, dt, db; |
2718 | resync = (mddev->curr_resync - atomic_read(&mddev->recovery_active)); | 2724 | resync = (mddev->curr_mark_cnt - atomic_read(&mddev->recovery_active)); |
2719 | dt = ((jiffies - mddev->resync_mark) / HZ); | 2725 | dt = ((jiffies - mddev->resync_mark) / HZ); |
2720 | if (!dt) dt++; | 2726 | if (!dt) dt++; |
2721 | db = resync - (mddev->resync_mark_cnt); | 2727 | db = resync - (mddev->resync_mark_cnt); |
2722 | return sprintf(page, "%ld\n", db/dt/2); /* K/sec */ | 2728 | return sprintf(page, "%ld\n", db/dt/2); /* K/sec */ |
2723 | } | 2729 | } |
2724 | 2730 | ||
2725 | static struct md_sysfs_entry | 2731 | static struct md_sysfs_entry md_sync_speed = __ATTR_RO(sync_speed); |
2726 | md_sync_speed = __ATTR_RO(sync_speed); | ||
2727 | 2732 | ||
2728 | static ssize_t | 2733 | static ssize_t |
2729 | sync_completed_show(mddev_t *mddev, char *page) | 2734 | sync_completed_show(mddev_t *mddev, char *page) |
@@ -2739,8 +2744,7 @@ sync_completed_show(mddev_t *mddev, char *page) | |||
2739 | return sprintf(page, "%lu / %lu\n", resync, max_blocks); | 2744 | return sprintf(page, "%lu / %lu\n", resync, max_blocks); |
2740 | } | 2745 | } |
2741 | 2746 | ||
2742 | static struct md_sysfs_entry | 2747 | static struct md_sysfs_entry md_sync_completed = __ATTR_RO(sync_completed); |
2743 | md_sync_completed = __ATTR_RO(sync_completed); | ||
2744 | 2748 | ||
2745 | static ssize_t | 2749 | static ssize_t |
2746 | suspend_lo_show(mddev_t *mddev, char *page) | 2750 | suspend_lo_show(mddev_t *mddev, char *page) |
@@ -2857,6 +2861,8 @@ md_attr_store(struct kobject *kobj, struct attribute *attr, | |||
2857 | 2861 | ||
2858 | if (!entry->store) | 2862 | if (!entry->store) |
2859 | return -EIO; | 2863 | return -EIO; |
2864 | if (!capable(CAP_SYS_ADMIN)) | ||
2865 | return -EACCES; | ||
2860 | rv = mddev_lock(mddev); | 2866 | rv = mddev_lock(mddev); |
2861 | if (!rv) { | 2867 | if (!rv) { |
2862 | rv = entry->store(mddev, page, length); | 2868 | rv = entry->store(mddev, page, length); |
@@ -3091,7 +3097,6 @@ static int do_md_run(mddev_t * mddev) | |||
3091 | } | 3097 | } |
3092 | 3098 | ||
3093 | set_bit(MD_RECOVERY_NEEDED, &mddev->recovery); | 3099 | set_bit(MD_RECOVERY_NEEDED, &mddev->recovery); |
3094 | md_wakeup_thread(mddev->thread); | ||
3095 | 3100 | ||
3096 | if (mddev->sb_dirty) | 3101 | if (mddev->sb_dirty) |
3097 | md_update_sb(mddev); | 3102 | md_update_sb(mddev); |
@@ -3112,7 +3117,7 @@ static int do_md_run(mddev_t * mddev) | |||
3112 | * start recovery here. If we leave it to md_check_recovery, | 3117 | * start recovery here. If we leave it to md_check_recovery, |
3113 | * it will remove the drives and not do the right thing | 3118 | * it will remove the drives and not do the right thing |
3114 | */ | 3119 | */ |
3115 | if (mddev->degraded) { | 3120 | if (mddev->degraded && !mddev->sync_thread) { |
3116 | struct list_head *rtmp; | 3121 | struct list_head *rtmp; |
3117 | int spares = 0; | 3122 | int spares = 0; |
3118 | ITERATE_RDEV(mddev,rdev,rtmp) | 3123 | ITERATE_RDEV(mddev,rdev,rtmp) |
@@ -3133,10 +3138,11 @@ static int do_md_run(mddev_t * mddev) | |||
3133 | mdname(mddev)); | 3138 | mdname(mddev)); |
3134 | /* leave the spares where they are, it shouldn't hurt */ | 3139 | /* leave the spares where they are, it shouldn't hurt */ |
3135 | mddev->recovery = 0; | 3140 | mddev->recovery = 0; |
3136 | } else | 3141 | } |
3137 | md_wakeup_thread(mddev->sync_thread); | ||
3138 | } | 3142 | } |
3139 | } | 3143 | } |
3144 | md_wakeup_thread(mddev->thread); | ||
3145 | md_wakeup_thread(mddev->sync_thread); /* possibly kick off a reshape */ | ||
3140 | 3146 | ||
3141 | mddev->changed = 1; | 3147 | mddev->changed = 1; |
3142 | md_new_event(mddev); | 3148 | md_new_event(mddev); |
@@ -4586,6 +4592,8 @@ void md_error(mddev_t *mddev, mdk_rdev_t *rdev) | |||
4586 | __builtin_return_address(0),__builtin_return_address(1), | 4592 | __builtin_return_address(0),__builtin_return_address(1), |
4587 | __builtin_return_address(2),__builtin_return_address(3)); | 4593 | __builtin_return_address(2),__builtin_return_address(3)); |
4588 | */ | 4594 | */ |
4595 | if (!mddev->pers) | ||
4596 | return; | ||
4589 | if (!mddev->pers->error_handler) | 4597 | if (!mddev->pers->error_handler) |
4590 | return; | 4598 | return; |
4591 | mddev->pers->error_handler(mddev,rdev); | 4599 | mddev->pers->error_handler(mddev,rdev); |
@@ -4683,12 +4691,13 @@ static void status_resync(struct seq_file *seq, mddev_t * mddev) | |||
4683 | */ | 4691 | */ |
4684 | dt = ((jiffies - mddev->resync_mark) / HZ); | 4692 | dt = ((jiffies - mddev->resync_mark) / HZ); |
4685 | if (!dt) dt++; | 4693 | if (!dt) dt++; |
4686 | db = resync - (mddev->resync_mark_cnt/2); | 4694 | db = (mddev->curr_mark_cnt - atomic_read(&mddev->recovery_active)) |
4687 | rt = (dt * ((unsigned long)(max_blocks-resync) / (db/100+1)))/100; | 4695 | - mddev->resync_mark_cnt; |
4696 | rt = (dt * ((unsigned long)(max_blocks-resync) / (db/2/100+1)))/100; | ||
4688 | 4697 | ||
4689 | seq_printf(seq, " finish=%lu.%lumin", rt / 60, (rt % 60)/6); | 4698 | seq_printf(seq, " finish=%lu.%lumin", rt / 60, (rt % 60)/6); |
4690 | 4699 | ||
4691 | seq_printf(seq, " speed=%ldK/sec", db/dt); | 4700 | seq_printf(seq, " speed=%ldK/sec", db/2/dt); |
4692 | } | 4701 | } |
4693 | 4702 | ||
4694 | static void *md_seq_start(struct seq_file *seq, loff_t *pos) | 4703 | static void *md_seq_start(struct seq_file *seq, loff_t *pos) |
@@ -5199,6 +5208,7 @@ void md_do_sync(mddev_t *mddev) | |||
5199 | 5208 | ||
5200 | j += sectors; | 5209 | j += sectors; |
5201 | if (j>1) mddev->curr_resync = j; | 5210 | if (j>1) mddev->curr_resync = j; |
5211 | mddev->curr_mark_cnt = io_sectors; | ||
5202 | if (last_check == 0) | 5212 | if (last_check == 0) |
5203 | /* this is the earliers that rebuilt will be | 5213 | /* this is the earliers that rebuilt will be |
5204 | * visible in /proc/mdstat | 5214 | * visible in /proc/mdstat |
@@ -5645,8 +5655,8 @@ static int set_ro(const char *val, struct kernel_param *kp) | |||
5645 | return -EINVAL; | 5655 | return -EINVAL; |
5646 | } | 5656 | } |
5647 | 5657 | ||
5648 | module_param_call(start_ro, set_ro, get_ro, NULL, 0600); | 5658 | module_param_call(start_ro, set_ro, get_ro, NULL, S_IRUSR|S_IWUSR); |
5649 | module_param(start_dirty_degraded, int, 0644); | 5659 | module_param(start_dirty_degraded, int, S_IRUGO|S_IWUSR); |
5650 | 5660 | ||
5651 | 5661 | ||
5652 | EXPORT_SYMBOL(register_md_personality); | 5662 | EXPORT_SYMBOL(register_md_personality); |
diff --git a/drivers/md/raid1.c b/drivers/md/raid1.c index cead918578a7..1efe22a2d041 100644 --- a/drivers/md/raid1.c +++ b/drivers/md/raid1.c | |||
@@ -1145,7 +1145,7 @@ static int end_sync_write(struct bio *bio, unsigned int bytes_done, int error) | |||
1145 | long sectors_to_go = r1_bio->sectors; | 1145 | long sectors_to_go = r1_bio->sectors; |
1146 | /* make sure these bits doesn't get cleared. */ | 1146 | /* make sure these bits doesn't get cleared. */ |
1147 | do { | 1147 | do { |
1148 | bitmap_end_sync(mddev->bitmap, r1_bio->sector, | 1148 | bitmap_end_sync(mddev->bitmap, s, |
1149 | &sync_blocks, 1); | 1149 | &sync_blocks, 1); |
1150 | s += sync_blocks; | 1150 | s += sync_blocks; |
1151 | sectors_to_go -= sync_blocks; | 1151 | sectors_to_go -= sync_blocks; |
@@ -1509,6 +1509,9 @@ static void raid1d(mddev_t *mddev) | |||
1509 | s<<9, conf->tmppage, READ) == 0) | 1509 | s<<9, conf->tmppage, READ) == 0) |
1510 | /* Well, this device is dead */ | 1510 | /* Well, this device is dead */ |
1511 | md_error(mddev, rdev); | 1511 | md_error(mddev, rdev); |
1512 | else | ||
1513 | printk(KERN_INFO "raid1:%s: read error corrected (%d sectors at %llu on %s)\n", | ||
1514 | mdname(mddev), s, (unsigned long long)(sect + rdev->data_offset), bdevname(rdev->bdev, b)); | ||
1512 | } | 1515 | } |
1513 | } | 1516 | } |
1514 | } else { | 1517 | } else { |
diff --git a/drivers/md/raid10.c b/drivers/md/raid10.c index 7f636283a1ba..016ddb831c9b 100644 --- a/drivers/md/raid10.c +++ b/drivers/md/raid10.c | |||
@@ -1492,6 +1492,10 @@ static void raid10d(mddev_t *mddev) | |||
1492 | s<<9, conf->tmppage, READ) == 0) | 1492 | s<<9, conf->tmppage, READ) == 0) |
1493 | /* Well, this device is dead */ | 1493 | /* Well, this device is dead */ |
1494 | md_error(mddev, rdev); | 1494 | md_error(mddev, rdev); |
1495 | else | ||
1496 | printk(KERN_INFO "raid10:%s: read error corrected (%d sectors at %llu on %s)\n", | ||
1497 | mdname(mddev), s, (unsigned long long)(sect+rdev->data_offset), bdevname(rdev->bdev, b)); | ||
1498 | |||
1495 | rdev_dec_pending(rdev, mddev); | 1499 | rdev_dec_pending(rdev, mddev); |
1496 | rcu_read_lock(); | 1500 | rcu_read_lock(); |
1497 | } | 1501 | } |
diff --git a/drivers/md/raid5.c b/drivers/md/raid5.c index 7433871f4b3a..450066007160 100644 --- a/drivers/md/raid5.c +++ b/drivers/md/raid5.c | |||
@@ -18,6 +18,30 @@ | |||
18 | * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. | 18 | * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. |
19 | */ | 19 | */ |
20 | 20 | ||
21 | /* | ||
22 | * BITMAP UNPLUGGING: | ||
23 | * | ||
24 | * The sequencing for updating the bitmap reliably is a little | ||
25 | * subtle (and I got it wrong the first time) so it deserves some | ||
26 | * explanation. | ||
27 | * | ||
28 | * We group bitmap updates into batches. Each batch has a number. | ||
29 | * We may write out several batches at once, but that isn't very important. | ||
30 | * conf->bm_write is the number of the last batch successfully written. | ||
31 | * conf->bm_flush is the number of the last batch that was closed to | ||
32 | * new additions. | ||
33 | * When we discover that we will need to write to any block in a stripe | ||
34 | * (in add_stripe_bio) we update the in-memory bitmap and record in sh->bm_seq | ||
35 | * the number of the batch it will be in. This is bm_flush+1. | ||
36 | * When we are ready to do a write, if that batch hasn't been written yet, | ||
37 | * we plug the array and queue the stripe for later. | ||
38 | * When an unplug happens, we increment bm_flush, thus closing the current | ||
39 | * batch. | ||
40 | * When we notice that bm_flush > bm_write, we write out all pending updates | ||
41 | * to the bitmap, and advance bm_write to where bm_flush was. | ||
42 | * This may occasionally write a bit out twice, but is sure never to | ||
43 | * miss any bits. | ||
44 | */ | ||
21 | 45 | ||
22 | #include <linux/module.h> | 46 | #include <linux/module.h> |
23 | #include <linux/slab.h> | 47 | #include <linux/slab.h> |
@@ -88,12 +112,14 @@ static void __release_stripe(raid5_conf_t *conf, struct stripe_head *sh) | |||
88 | BUG_ON(!list_empty(&sh->lru)); | 112 | BUG_ON(!list_empty(&sh->lru)); |
89 | BUG_ON(atomic_read(&conf->active_stripes)==0); | 113 | BUG_ON(atomic_read(&conf->active_stripes)==0); |
90 | if (test_bit(STRIPE_HANDLE, &sh->state)) { | 114 | if (test_bit(STRIPE_HANDLE, &sh->state)) { |
91 | if (test_bit(STRIPE_DELAYED, &sh->state)) | 115 | if (test_bit(STRIPE_DELAYED, &sh->state)) { |
92 | list_add_tail(&sh->lru, &conf->delayed_list); | 116 | list_add_tail(&sh->lru, &conf->delayed_list); |
93 | else if (test_bit(STRIPE_BIT_DELAY, &sh->state) && | 117 | blk_plug_device(conf->mddev->queue); |
94 | conf->seq_write == sh->bm_seq) | 118 | } else if (test_bit(STRIPE_BIT_DELAY, &sh->state) && |
119 | sh->bm_seq - conf->seq_write > 0) { | ||
95 | list_add_tail(&sh->lru, &conf->bitmap_list); | 120 | list_add_tail(&sh->lru, &conf->bitmap_list); |
96 | else { | 121 | blk_plug_device(conf->mddev->queue); |
122 | } else { | ||
97 | clear_bit(STRIPE_BIT_DELAY, &sh->state); | 123 | clear_bit(STRIPE_BIT_DELAY, &sh->state); |
98 | list_add_tail(&sh->lru, &conf->handle_list); | 124 | list_add_tail(&sh->lru, &conf->handle_list); |
99 | } | 125 | } |
@@ -270,7 +296,7 @@ static struct stripe_head *get_active_stripe(raid5_conf_t *conf, sector_t sector | |||
270 | < (conf->max_nr_stripes *3/4) | 296 | < (conf->max_nr_stripes *3/4) |
271 | || !conf->inactive_blocked), | 297 | || !conf->inactive_blocked), |
272 | conf->device_lock, | 298 | conf->device_lock, |
273 | unplug_slaves(conf->mddev) | 299 | raid5_unplug_device(conf->mddev->queue) |
274 | ); | 300 | ); |
275 | conf->inactive_blocked = 0; | 301 | conf->inactive_blocked = 0; |
276 | } else | 302 | } else |
@@ -281,7 +307,8 @@ static struct stripe_head *get_active_stripe(raid5_conf_t *conf, sector_t sector | |||
281 | } else { | 307 | } else { |
282 | if (!test_bit(STRIPE_HANDLE, &sh->state)) | 308 | if (!test_bit(STRIPE_HANDLE, &sh->state)) |
283 | atomic_inc(&conf->active_stripes); | 309 | atomic_inc(&conf->active_stripes); |
284 | if (list_empty(&sh->lru)) | 310 | if (list_empty(&sh->lru) && |
311 | !test_bit(STRIPE_EXPANDING, &sh->state)) | ||
285 | BUG(); | 312 | BUG(); |
286 | list_del_init(&sh->lru); | 313 | list_del_init(&sh->lru); |
287 | } | 314 | } |
@@ -496,6 +523,8 @@ static int raid5_end_read_request(struct bio * bi, unsigned int bytes_done, | |||
496 | raid5_conf_t *conf = sh->raid_conf; | 523 | raid5_conf_t *conf = sh->raid_conf; |
497 | int disks = sh->disks, i; | 524 | int disks = sh->disks, i; |
498 | int uptodate = test_bit(BIO_UPTODATE, &bi->bi_flags); | 525 | int uptodate = test_bit(BIO_UPTODATE, &bi->bi_flags); |
526 | char b[BDEVNAME_SIZE]; | ||
527 | mdk_rdev_t *rdev; | ||
499 | 528 | ||
500 | if (bi->bi_size) | 529 | if (bi->bi_size) |
501 | return 1; | 530 | return 1; |
@@ -543,25 +572,39 @@ static int raid5_end_read_request(struct bio * bi, unsigned int bytes_done, | |||
543 | set_bit(R5_UPTODATE, &sh->dev[i].flags); | 572 | set_bit(R5_UPTODATE, &sh->dev[i].flags); |
544 | #endif | 573 | #endif |
545 | if (test_bit(R5_ReadError, &sh->dev[i].flags)) { | 574 | if (test_bit(R5_ReadError, &sh->dev[i].flags)) { |
546 | printk(KERN_INFO "raid5: read error corrected!!\n"); | 575 | rdev = conf->disks[i].rdev; |
576 | printk(KERN_INFO "raid5:%s: read error corrected (%lu sectors at %llu on %s)\n", | ||
577 | mdname(conf->mddev), STRIPE_SECTORS, | ||
578 | (unsigned long long)sh->sector + rdev->data_offset, | ||
579 | bdevname(rdev->bdev, b)); | ||
547 | clear_bit(R5_ReadError, &sh->dev[i].flags); | 580 | clear_bit(R5_ReadError, &sh->dev[i].flags); |
548 | clear_bit(R5_ReWrite, &sh->dev[i].flags); | 581 | clear_bit(R5_ReWrite, &sh->dev[i].flags); |
549 | } | 582 | } |
550 | if (atomic_read(&conf->disks[i].rdev->read_errors)) | 583 | if (atomic_read(&conf->disks[i].rdev->read_errors)) |
551 | atomic_set(&conf->disks[i].rdev->read_errors, 0); | 584 | atomic_set(&conf->disks[i].rdev->read_errors, 0); |
552 | } else { | 585 | } else { |
586 | const char *bdn = bdevname(conf->disks[i].rdev->bdev, b); | ||
553 | int retry = 0; | 587 | int retry = 0; |
588 | rdev = conf->disks[i].rdev; | ||
589 | |||
554 | clear_bit(R5_UPTODATE, &sh->dev[i].flags); | 590 | clear_bit(R5_UPTODATE, &sh->dev[i].flags); |
555 | atomic_inc(&conf->disks[i].rdev->read_errors); | 591 | atomic_inc(&rdev->read_errors); |
556 | if (conf->mddev->degraded) | 592 | if (conf->mddev->degraded) |
557 | printk(KERN_WARNING "raid5: read error not correctable.\n"); | 593 | printk(KERN_WARNING "raid5:%s: read error not correctable (sector %llu on %s).\n", |
594 | mdname(conf->mddev), | ||
595 | (unsigned long long)sh->sector + rdev->data_offset, | ||
596 | bdn); | ||
558 | else if (test_bit(R5_ReWrite, &sh->dev[i].flags)) | 597 | else if (test_bit(R5_ReWrite, &sh->dev[i].flags)) |
559 | /* Oh, no!!! */ | 598 | /* Oh, no!!! */ |
560 | printk(KERN_WARNING "raid5: read error NOT corrected!!\n"); | 599 | printk(KERN_WARNING "raid5:%s: read error NOT corrected!! (sector %llu on %s).\n", |
561 | else if (atomic_read(&conf->disks[i].rdev->read_errors) | 600 | mdname(conf->mddev), |
601 | (unsigned long long)sh->sector + rdev->data_offset, | ||
602 | bdn); | ||
603 | else if (atomic_read(&rdev->read_errors) | ||
562 | > conf->max_nr_stripes) | 604 | > conf->max_nr_stripes) |
563 | printk(KERN_WARNING | 605 | printk(KERN_WARNING |
564 | "raid5: Too many read errors, failing device.\n"); | 606 | "raid5:%s: Too many read errors, failing device %s.\n", |
607 | mdname(conf->mddev), bdn); | ||
565 | else | 608 | else |
566 | retry = 1; | 609 | retry = 1; |
567 | if (retry) | 610 | if (retry) |
@@ -569,7 +612,7 @@ static int raid5_end_read_request(struct bio * bi, unsigned int bytes_done, | |||
569 | else { | 612 | else { |
570 | clear_bit(R5_ReadError, &sh->dev[i].flags); | 613 | clear_bit(R5_ReadError, &sh->dev[i].flags); |
571 | clear_bit(R5_ReWrite, &sh->dev[i].flags); | 614 | clear_bit(R5_ReWrite, &sh->dev[i].flags); |
572 | md_error(conf->mddev, conf->disks[i].rdev); | 615 | md_error(conf->mddev, rdev); |
573 | } | 616 | } |
574 | } | 617 | } |
575 | rdev_dec_pending(conf->disks[i].rdev, conf->mddev); | 618 | rdev_dec_pending(conf->disks[i].rdev, conf->mddev); |
@@ -1270,9 +1313,9 @@ static int add_stripe_bio(struct stripe_head *sh, struct bio *bi, int dd_idx, in | |||
1270 | (unsigned long long)sh->sector, dd_idx); | 1313 | (unsigned long long)sh->sector, dd_idx); |
1271 | 1314 | ||
1272 | if (conf->mddev->bitmap && firstwrite) { | 1315 | if (conf->mddev->bitmap && firstwrite) { |
1273 | sh->bm_seq = conf->seq_write; | ||
1274 | bitmap_startwrite(conf->mddev->bitmap, sh->sector, | 1316 | bitmap_startwrite(conf->mddev->bitmap, sh->sector, |
1275 | STRIPE_SECTORS, 0); | 1317 | STRIPE_SECTORS, 0); |
1318 | sh->bm_seq = conf->seq_flush+1; | ||
1276 | set_bit(STRIPE_BIT_DELAY, &sh->state); | 1319 | set_bit(STRIPE_BIT_DELAY, &sh->state); |
1277 | } | 1320 | } |
1278 | 1321 | ||
@@ -2554,13 +2597,6 @@ static int raid5_issue_flush(request_queue_t *q, struct gendisk *disk, | |||
2554 | return ret; | 2597 | return ret; |
2555 | } | 2598 | } |
2556 | 2599 | ||
2557 | static inline void raid5_plug_device(raid5_conf_t *conf) | ||
2558 | { | ||
2559 | spin_lock_irq(&conf->device_lock); | ||
2560 | blk_plug_device(conf->mddev->queue); | ||
2561 | spin_unlock_irq(&conf->device_lock); | ||
2562 | } | ||
2563 | |||
2564 | static int make_request(request_queue_t *q, struct bio * bi) | 2600 | static int make_request(request_queue_t *q, struct bio * bi) |
2565 | { | 2601 | { |
2566 | mddev_t *mddev = q->queuedata; | 2602 | mddev_t *mddev = q->queuedata; |
@@ -2670,7 +2706,6 @@ static int make_request(request_queue_t *q, struct bio * bi) | |||
2670 | goto retry; | 2706 | goto retry; |
2671 | } | 2707 | } |
2672 | finish_wait(&conf->wait_for_overlap, &w); | 2708 | finish_wait(&conf->wait_for_overlap, &w); |
2673 | raid5_plug_device(conf); | ||
2674 | handle_stripe(sh, NULL); | 2709 | handle_stripe(sh, NULL); |
2675 | release_stripe(sh); | 2710 | release_stripe(sh); |
2676 | } else { | 2711 | } else { |
@@ -2923,7 +2958,7 @@ static void raid5d (mddev_t *mddev) | |||
2923 | while (1) { | 2958 | while (1) { |
2924 | struct list_head *first; | 2959 | struct list_head *first; |
2925 | 2960 | ||
2926 | if (conf->seq_flush - conf->seq_write > 0) { | 2961 | if (conf->seq_flush != conf->seq_write) { |
2927 | int seq = conf->seq_flush; | 2962 | int seq = conf->seq_flush; |
2928 | spin_unlock_irq(&conf->device_lock); | 2963 | spin_unlock_irq(&conf->device_lock); |
2929 | bitmap_unplug(mddev->bitmap); | 2964 | bitmap_unplug(mddev->bitmap); |
@@ -3246,9 +3281,6 @@ static int run(mddev_t *mddev) | |||
3246 | set_bit(MD_RECOVERY_RUNNING, &mddev->recovery); | 3281 | set_bit(MD_RECOVERY_RUNNING, &mddev->recovery); |
3247 | mddev->sync_thread = md_register_thread(md_do_sync, mddev, | 3282 | mddev->sync_thread = md_register_thread(md_do_sync, mddev, |
3248 | "%s_reshape"); | 3283 | "%s_reshape"); |
3249 | /* FIXME if md_register_thread fails?? */ | ||
3250 | md_wakeup_thread(mddev->sync_thread); | ||
3251 | |||
3252 | } | 3284 | } |
3253 | 3285 | ||
3254 | /* read-ahead size must cover two whole stripes, which is | 3286 | /* read-ahead size must cover two whole stripes, which is |
diff --git a/drivers/media/dvb/frontends/nxt200x.c b/drivers/media/dvb/frontends/nxt200x.c index 55671cb5255e..87c286ee6a00 100644 --- a/drivers/media/dvb/frontends/nxt200x.c +++ b/drivers/media/dvb/frontends/nxt200x.c | |||
@@ -896,9 +896,9 @@ static int nxt2002_init(struct dvb_frontend* fe) | |||
896 | } | 896 | } |
897 | 897 | ||
898 | ret = nxt2002_load_firmware(fe, fw); | 898 | ret = nxt2002_load_firmware(fe, fw); |
899 | release_firmware(fw); | ||
899 | if (ret) { | 900 | if (ret) { |
900 | printk("nxt2002: Writing firmware to device failed\n"); | 901 | printk("nxt2002: Writing firmware to device failed\n"); |
901 | release_firmware(fw); | ||
902 | return ret; | 902 | return ret; |
903 | } | 903 | } |
904 | printk("nxt2002: Firmware upload complete\n"); | 904 | printk("nxt2002: Firmware upload complete\n"); |
@@ -960,9 +960,9 @@ static int nxt2004_init(struct dvb_frontend* fe) | |||
960 | } | 960 | } |
961 | 961 | ||
962 | ret = nxt2004_load_firmware(fe, fw); | 962 | ret = nxt2004_load_firmware(fe, fw); |
963 | release_firmware(fw); | ||
963 | if (ret) { | 964 | if (ret) { |
964 | printk("nxt2004: Writing firmware to device failed\n"); | 965 | printk("nxt2004: Writing firmware to device failed\n"); |
965 | release_firmware(fw); | ||
966 | return ret; | 966 | return ret; |
967 | } | 967 | } |
968 | printk("nxt2004: Firmware upload complete\n"); | 968 | printk("nxt2004: Firmware upload complete\n"); |
diff --git a/drivers/media/dvb/frontends/or51211.c b/drivers/media/dvb/frontends/or51211.c index 26bed616fabe..2bf124b53689 100644 --- a/drivers/media/dvb/frontends/or51211.c +++ b/drivers/media/dvb/frontends/or51211.c | |||
@@ -437,10 +437,10 @@ static int or51211_init(struct dvb_frontend* fe) | |||
437 | } | 437 | } |
438 | 438 | ||
439 | ret = or51211_load_firmware(fe, fw); | 439 | ret = or51211_load_firmware(fe, fw); |
440 | release_firmware(fw); | ||
440 | if (ret) { | 441 | if (ret) { |
441 | printk(KERN_WARNING "or51211: Writing firmware to " | 442 | printk(KERN_WARNING "or51211: Writing firmware to " |
442 | "device failed!\n"); | 443 | "device failed!\n"); |
443 | release_firmware(fw); | ||
444 | return ret; | 444 | return ret; |
445 | } | 445 | } |
446 | printk(KERN_INFO "or51211: Firmware upload complete.\n"); | 446 | printk(KERN_INFO "or51211: Firmware upload complete.\n"); |
diff --git a/drivers/media/dvb/frontends/sp8870.c b/drivers/media/dvb/frontends/sp8870.c index 44ec5b9a4695..d98fd5c2e13e 100644 --- a/drivers/media/dvb/frontends/sp8870.c +++ b/drivers/media/dvb/frontends/sp8870.c | |||
@@ -318,7 +318,6 @@ static int sp8870_init (struct dvb_frontend* fe) | |||
318 | printk("sp8870: waiting for firmware upload (%s)...\n", SP8870_DEFAULT_FIRMWARE); | 318 | printk("sp8870: waiting for firmware upload (%s)...\n", SP8870_DEFAULT_FIRMWARE); |
319 | if (state->config->request_firmware(fe, &fw, SP8870_DEFAULT_FIRMWARE)) { | 319 | if (state->config->request_firmware(fe, &fw, SP8870_DEFAULT_FIRMWARE)) { |
320 | printk("sp8870: no firmware upload (timeout or file not found?)\n"); | 320 | printk("sp8870: no firmware upload (timeout or file not found?)\n"); |
321 | release_firmware(fw); | ||
322 | return -EIO; | 321 | return -EIO; |
323 | } | 322 | } |
324 | 323 | ||
@@ -327,6 +326,7 @@ static int sp8870_init (struct dvb_frontend* fe) | |||
327 | release_firmware(fw); | 326 | release_firmware(fw); |
328 | return -EIO; | 327 | return -EIO; |
329 | } | 328 | } |
329 | release_firmware(fw); | ||
330 | printk("sp8870: firmware upload complete\n"); | 330 | printk("sp8870: firmware upload complete\n"); |
331 | 331 | ||
332 | /* enable TS output and interface pins */ | 332 | /* enable TS output and interface pins */ |
diff --git a/drivers/media/dvb/frontends/sp887x.c b/drivers/media/dvb/frontends/sp887x.c index b0a2b02f6608..5c2f8f4e0ae5 100644 --- a/drivers/media/dvb/frontends/sp887x.c +++ b/drivers/media/dvb/frontends/sp887x.c | |||
@@ -520,9 +520,9 @@ static int sp887x_init(struct dvb_frontend* fe) | |||
520 | } | 520 | } |
521 | 521 | ||
522 | ret = sp887x_initial_setup(fe, fw); | 522 | ret = sp887x_initial_setup(fe, fw); |
523 | release_firmware(fw); | ||
523 | if (ret) { | 524 | if (ret) { |
524 | printk("sp887x: writing firmware to device failed\n"); | 525 | printk("sp887x: writing firmware to device failed\n"); |
525 | release_firmware(fw); | ||
526 | return ret; | 526 | return ret; |
527 | } | 527 | } |
528 | printk("sp887x: firmware upload complete\n"); | 528 | printk("sp887x: firmware upload complete\n"); |
diff --git a/drivers/media/video/cx88/cx88-blackbird.c b/drivers/media/video/cx88/cx88-blackbird.c index 349632b48e93..b60177f173c3 100644 --- a/drivers/media/video/cx88/cx88-blackbird.c +++ b/drivers/media/video/cx88/cx88-blackbird.c | |||
@@ -453,11 +453,13 @@ static int blackbird_load_firmware(struct cx8802_dev *dev) | |||
453 | if (firmware->size != BLACKBIRD_FIRM_IMAGE_SIZE) { | 453 | if (firmware->size != BLACKBIRD_FIRM_IMAGE_SIZE) { |
454 | dprintk(0, "ERROR: Firmware size mismatch (have %zd, expected %d)\n", | 454 | dprintk(0, "ERROR: Firmware size mismatch (have %zd, expected %d)\n", |
455 | firmware->size, BLACKBIRD_FIRM_IMAGE_SIZE); | 455 | firmware->size, BLACKBIRD_FIRM_IMAGE_SIZE); |
456 | release_firmware(firmware); | ||
456 | return -1; | 457 | return -1; |
457 | } | 458 | } |
458 | 459 | ||
459 | if (0 != memcmp(firmware->data, magic, 8)) { | 460 | if (0 != memcmp(firmware->data, magic, 8)) { |
460 | dprintk(0, "ERROR: Firmware magic mismatch, wrong file?\n"); | 461 | dprintk(0, "ERROR: Firmware magic mismatch, wrong file?\n"); |
462 | release_firmware(firmware); | ||
461 | return -1; | 463 | return -1; |
462 | } | 464 | } |
463 | 465 | ||
@@ -478,6 +480,7 @@ static int blackbird_load_firmware(struct cx8802_dev *dev) | |||
478 | } | 480 | } |
479 | if (checksum) { | 481 | if (checksum) { |
480 | dprintk(0, "ERROR: Firmware load failed (checksum mismatch).\n"); | 482 | dprintk(0, "ERROR: Firmware load failed (checksum mismatch).\n"); |
483 | release_firmware(firmware); | ||
481 | return -1; | 484 | return -1; |
482 | } | 485 | } |
483 | release_firmware(firmware); | 486 | release_firmware(firmware); |
diff --git a/drivers/message/i2o/core.h b/drivers/message/i2o/core.h index 184974cc734d..dc388a3ff5e0 100644 --- a/drivers/message/i2o/core.h +++ b/drivers/message/i2o/core.h | |||
@@ -38,6 +38,9 @@ extern struct device_attribute i2o_device_attrs[]; | |||
38 | extern void i2o_device_remove(struct i2o_device *); | 38 | extern void i2o_device_remove(struct i2o_device *); |
39 | extern int i2o_device_parse_lct(struct i2o_controller *); | 39 | extern int i2o_device_parse_lct(struct i2o_controller *); |
40 | 40 | ||
41 | int i2o_parm_issue(struct i2o_device *i2o_dev, int cmd, void *oplist, | ||
42 | int oplen, void *reslist, int reslen); | ||
43 | |||
41 | /* IOP */ | 44 | /* IOP */ |
42 | extern struct i2o_controller *i2o_iop_alloc(void); | 45 | extern struct i2o_controller *i2o_iop_alloc(void); |
43 | 46 | ||
diff --git a/drivers/message/i2o/i2o_config.c b/drivers/message/i2o/i2o_config.c index 89daf67b764d..7d23e082bf26 100644 --- a/drivers/message/i2o/i2o_config.c +++ b/drivers/message/i2o/i2o_config.c | |||
@@ -36,9 +36,9 @@ | |||
36 | 36 | ||
37 | #include <asm/uaccess.h> | 37 | #include <asm/uaccess.h> |
38 | 38 | ||
39 | #define SG_TABLESIZE 30 | 39 | #include "core.h" |
40 | 40 | ||
41 | extern int i2o_parm_issue(struct i2o_device *, int, void *, int, void *, int); | 41 | #define SG_TABLESIZE 30 |
42 | 42 | ||
43 | static int i2o_cfg_ioctl(struct inode *, struct file *, unsigned int, | 43 | static int i2o_cfg_ioctl(struct inode *, struct file *, unsigned int, |
44 | unsigned long); | 44 | unsigned long); |
diff --git a/drivers/mfd/ucb1x00-core.c b/drivers/mfd/ucb1x00-core.c index 632bc218c86a..2bf32721eb53 100644 --- a/drivers/mfd/ucb1x00-core.c +++ b/drivers/mfd/ucb1x00-core.c | |||
@@ -479,7 +479,7 @@ static int ucb1x00_probe(struct mcp *mcp) | |||
479 | mcp_enable(mcp); | 479 | mcp_enable(mcp); |
480 | id = mcp_reg_read(mcp, UCB_ID); | 480 | id = mcp_reg_read(mcp, UCB_ID); |
481 | 481 | ||
482 | if (id != UCB_ID_1200 && id != UCB_ID_1300) { | 482 | if (id != UCB_ID_1200 && id != UCB_ID_1300 && id != UCB_ID_TC35143) { |
483 | printk(KERN_WARNING "UCB1x00 ID not found: %04x\n", id); | 483 | printk(KERN_WARNING "UCB1x00 ID not found: %04x\n", id); |
484 | goto err_disable; | 484 | goto err_disable; |
485 | } | 485 | } |
diff --git a/drivers/mfd/ucb1x00.h b/drivers/mfd/ucb1x00.h index 9c9a647d8b7b..ca8df8072d43 100644 --- a/drivers/mfd/ucb1x00.h +++ b/drivers/mfd/ucb1x00.h | |||
@@ -94,6 +94,7 @@ | |||
94 | #define UCB_ID 0x0c | 94 | #define UCB_ID 0x0c |
95 | #define UCB_ID_1200 0x1004 | 95 | #define UCB_ID_1200 0x1004 |
96 | #define UCB_ID_1300 0x1005 | 96 | #define UCB_ID_1300 0x1005 |
97 | #define UCB_ID_TC35143 0x9712 | ||
97 | 98 | ||
98 | #define UCB_MODE 0x0d | 99 | #define UCB_MODE 0x0d |
99 | #define UCB_MODE_DYN_VFLAG_ENA (1 << 12) | 100 | #define UCB_MODE_DYN_VFLAG_ENA (1 << 12) |
diff --git a/drivers/mmc/sdhci.c b/drivers/mmc/sdhci.c index 893319108ba4..4e21b3b9d330 100644 --- a/drivers/mmc/sdhci.c +++ b/drivers/mmc/sdhci.c | |||
@@ -565,7 +565,7 @@ static void sdhci_send_command(struct sdhci_host *host, struct mmc_command *cmd) | |||
565 | if (cmd->data) | 565 | if (cmd->data) |
566 | flags |= SDHCI_CMD_DATA; | 566 | flags |= SDHCI_CMD_DATA; |
567 | 567 | ||
568 | writel(SDHCI_MAKE_CMD(cmd->opcode, flags), | 568 | writew(SDHCI_MAKE_CMD(cmd->opcode, flags), |
569 | host->ioaddr + SDHCI_COMMAND); | 569 | host->ioaddr + SDHCI_COMMAND); |
570 | } | 570 | } |
571 | 571 | ||
@@ -1193,10 +1193,8 @@ static int __devinit sdhci_probe_slot(struct pci_dev *pdev, int slot) | |||
1193 | version = (version & SDHCI_SPEC_VER_MASK) >> SDHCI_SPEC_VER_SHIFT; | 1193 | version = (version & SDHCI_SPEC_VER_MASK) >> SDHCI_SPEC_VER_SHIFT; |
1194 | if (version != 0) { | 1194 | if (version != 0) { |
1195 | printk(KERN_ERR "%s: Unknown controller version (%d). " | 1195 | printk(KERN_ERR "%s: Unknown controller version (%d). " |
1196 | "Cowardly refusing to continue.\n", host->slot_descr, | 1196 | "You may experience problems.\n", host->slot_descr, |
1197 | version); | 1197 | version); |
1198 | ret = -ENODEV; | ||
1199 | goto unmap; | ||
1200 | } | 1198 | } |
1201 | 1199 | ||
1202 | caps = readl(host->ioaddr + SDHCI_CAPABILITIES); | 1200 | caps = readl(host->ioaddr + SDHCI_CAPABILITIES); |
diff --git a/drivers/net/3c59x.c b/drivers/net/3c59x.c index 2819de79442c..80e8ca013e44 100644 --- a/drivers/net/3c59x.c +++ b/drivers/net/3c59x.c | |||
@@ -17,172 +17,6 @@ | |||
17 | 410 Severn Ave., Suite 210 | 17 | 410 Severn Ave., Suite 210 |
18 | Annapolis MD 21403 | 18 | Annapolis MD 21403 |
19 | 19 | ||
20 | Linux Kernel Additions: | ||
21 | |||
22 | 0.99H+lk0.9 - David S. Miller - softnet, PCI DMA updates | ||
23 | 0.99H+lk1.0 - Jeff Garzik <jgarzik@pobox.com> | ||
24 | Remove compatibility defines for kernel versions < 2.2.x. | ||
25 | Update for new 2.3.x module interface | ||
26 | LK1.1.2 (March 19, 2000) | ||
27 | * New PCI interface (jgarzik) | ||
28 | |||
29 | LK1.1.3 25 April 2000, Andrew Morton <andrewm@uow.edu.au> | ||
30 | - Merged with 3c575_cb.c | ||
31 | - Don't set RxComplete in boomerang interrupt enable reg | ||
32 | - spinlock in vortex_timer to protect mdio functions | ||
33 | - disable local interrupts around call to vortex_interrupt in | ||
34 | vortex_tx_timeout() (So vortex_interrupt can use spin_lock()) | ||
35 | - Select window 3 in vortex_timer()'s write to Wn3_MAC_Ctrl | ||
36 | - In vortex_start_xmit(), move the lock to _after_ we've altered | ||
37 | vp->cur_tx and vp->tx_full. This defeats the race between | ||
38 | vortex_start_xmit() and vortex_interrupt which was identified | ||
39 | by Bogdan Costescu. | ||
40 | - Merged back support for six new cards from various sources | ||
41 | - Set vortex_have_pci if pci_module_init returns zero (fixes cardbus | ||
42 | insertion oops) | ||
43 | - Tell it that 3c905C has NWAY for 100bT autoneg | ||
44 | - Fix handling of SetStatusEnd in 'Too much work..' code, as | ||
45 | per 2.3.99's 3c575_cb (Dave Hinds). | ||
46 | - Split ISR into two for vortex & boomerang | ||
47 | - Fix MOD_INC/DEC races | ||
48 | - Handle resource allocation failures. | ||
49 | - Fix 3CCFE575CT LED polarity | ||
50 | - Make tx_interrupt_mitigation the default | ||
51 | |||
52 | LK1.1.4 25 April 2000, Andrew Morton <andrewm@uow.edu.au> | ||
53 | - Add extra TxReset to vortex_up() to fix 575_cb hotplug initialisation probs. | ||
54 | - Put vortex_info_tbl into __devinitdata | ||
55 | - In the vortex_error StatsFull HACK, disable stats in vp->intr_enable as well | ||
56 | as in the hardware. | ||
57 | - Increased the loop counter in issue_and_wait from 2,000 to 4,000. | ||
58 | |||
59 | LK1.1.5 28 April 2000, andrewm | ||
60 | - Added powerpc defines (John Daniel <jdaniel@etresoft.com> said these work...) | ||
61 | - Some extra diagnostics | ||
62 | - In vortex_error(), reset the Tx on maxCollisions. Otherwise most | ||
63 | chips usually get a Tx timeout. | ||
64 | - Added extra_reset module parm | ||
65 | - Replaced some inline timer manip with mod_timer | ||
66 | (Franois romieu <Francois.Romieu@nic.fr>) | ||
67 | - In vortex_up(), don't make Wn3_config initialisation dependent upon has_nway | ||
68 | (this came across from 3c575_cb). | ||
69 | |||
70 | LK1.1.6 06 Jun 2000, andrewm | ||
71 | - Backed out the PPC defines. | ||
72 | - Use del_timer_sync(), mod_timer(). | ||
73 | - Fix wrapped ulong comparison in boomerang_rx() | ||
74 | - Add IS_TORNADO, use it to suppress 3c905C checksum error msg | ||
75 | (Donald Becker, I Lee Hetherington <ilh@sls.lcs.mit.edu>) | ||
76 | - Replace union wn3_config with BFINS/BFEXT manipulation for | ||
77 | sparc64 (Pete Zaitcev, Peter Jones) | ||
78 | - In vortex_error, do_tx_reset and vortex_tx_timeout(Vortex): | ||
79 | do a netif_wake_queue() to better recover from errors. (Anders Pedersen, | ||
80 | Donald Becker) | ||
81 | - Print a warning on out-of-memory (rate limited to 1 per 10 secs) | ||
82 | - Added two more Cardbus 575 NICs: 5b57 and 6564 (Paul Wagland) | ||
83 | |||
84 | LK1.1.7 2 Jul 2000 andrewm | ||
85 | - Better handling of shared IRQs | ||
86 | - Reset the transmitter on a Tx reclaim error | ||
87 | - Fixed crash under OOM during vortex_open() (Mark Hemment) | ||
88 | - Fix Rx cessation problem during OOM (help from Mark Hemment) | ||
89 | - The spinlocks around the mdio access were blocking interrupts for 300uS. | ||
90 | Fix all this to use spin_lock_bh() within mdio_read/write | ||
91 | - Only write to TxFreeThreshold if it's a boomerang - other NICs don't | ||
92 | have one. | ||
93 | - Added 802.3x MAC-layer flow control support | ||
94 | |||
95 | LK1.1.8 13 Aug 2000 andrewm | ||
96 | - Ignore request_region() return value - already reserved if Cardbus. | ||
97 | - Merged some additional Cardbus flags from Don's 0.99Qk | ||
98 | - Some fixes for 3c556 (Fred Maciel) | ||
99 | - Fix for EISA initialisation (Jan Rekorajski) | ||
100 | - Renamed MII_XCVR_PWR and EEPROM_230 to align with 3c575_cb and D. Becker's drivers | ||
101 | - Fixed MII_XCVR_PWR for 3CCFE575CT | ||
102 | - Added INVERT_LED_PWR, used it. | ||
103 | - Backed out the extra_reset stuff | ||
104 | |||
105 | LK1.1.9 12 Sep 2000 andrewm | ||
106 | - Backed out the tx_reset_resume flags. It was a no-op. | ||
107 | - In vortex_error, don't reset the Tx on txReclaim errors | ||
108 | - In vortex_error, don't reset the Tx on maxCollisions errors. | ||
109 | Hence backed out all the DownListPtr logic here. | ||
110 | - In vortex_error, give Tornado cards a partial TxReset on | ||
111 | maxCollisions (David Hinds). Defined MAX_COLLISION_RESET for this. | ||
112 | - Redid some driver flags and device names based on pcmcia_cs-3.1.20. | ||
113 | - Fixed a bug where, if vp->tx_full is set when the interface | ||
114 | is downed, it remains set when the interface is upped. Bad | ||
115 | things happen. | ||
116 | |||
117 | LK1.1.10 17 Sep 2000 andrewm | ||
118 | - Added EEPROM_8BIT for 3c555 (Fred Maciel) | ||
119 | - Added experimental support for the 3c556B Laptop Hurricane (Louis Gerbarg) | ||
120 | - Add HAS_NWAY to "3c900 Cyclone 10Mbps TPO" | ||
121 | |||
122 | LK1.1.11 13 Nov 2000 andrewm | ||
123 | - Dump MOD_INC/DEC_USE_COUNT, use SET_MODULE_OWNER | ||
124 | |||
125 | LK1.1.12 1 Jan 2001 andrewm (2.4.0-pre1) | ||
126 | - Call pci_enable_device before we request our IRQ (Tobias Ringstrom) | ||
127 | - Add 3c590 PCI latency timer hack to vortex_probe1 (from 0.99Ra) | ||
128 | - Added extended issue_and_wait for the 3c905CX. | ||
129 | - Look for an MII on PHY index 24 first (3c905CX oddity). | ||
130 | - Add HAS_NWAY to 3cSOHO100-TX (Brett Frankenberger) | ||
131 | - Don't free skbs we don't own on oom path in vortex_open(). | ||
132 | |||
133 | LK1.1.13 27 Jan 2001 | ||
134 | - Added explicit `medialock' flag so we can truly | ||
135 | lock the media type down with `options'. | ||
136 | - "check ioremap return and some tidbits" (Arnaldo Carvalho de Melo <acme@conectiva.com.br>) | ||
137 | - Added and used EEPROM_NORESET for 3c556B PM resumes. | ||
138 | - Fixed leakage of vp->rx_ring. | ||
139 | - Break out separate HAS_HWCKSM device capability flag. | ||
140 | - Kill vp->tx_full (ANK) | ||
141 | - Merge zerocopy fragment handling (ANK?) | ||
142 | |||
143 | LK1.1.14 15 Feb 2001 | ||
144 | - Enable WOL. Can be turned on with `enable_wol' module option. | ||
145 | - EISA and PCI initialisation fixes (jgarzik, Manfred Spraul) | ||
146 | - If a device's internalconfig register reports it has NWAY, | ||
147 | use it, even if autoselect is enabled. | ||
148 | |||
149 | LK1.1.15 6 June 2001 akpm | ||
150 | - Prevent double counting of received bytes (Lars Christensen) | ||
151 | - Add ethtool support (jgarzik) | ||
152 | - Add module parm descriptions (Andrzej M. Krzysztofowicz) | ||
153 | - Implemented alloc_etherdev() API | ||
154 | - Special-case the 'Tx error 82' message. | ||
155 | |||
156 | LK1.1.16 18 July 2001 akpm | ||
157 | - Make NETIF_F_SG dependent upon nr_free_highpages(), not on CONFIG_HIGHMEM | ||
158 | - Lessen verbosity of bootup messages | ||
159 | - Fix WOL - use new PM API functions. | ||
160 | - Use netif_running() instead of vp->open in suspend/resume. | ||
161 | - Don't reset the interface logic on open/close/rmmod. It upsets | ||
162 | autonegotiation, and hence DHCP (from 0.99T). | ||
163 | - Back out EEPROM_NORESET flag because of the above (we do it for all | ||
164 | NICs). | ||
165 | - Correct 3c982 identification string | ||
166 | - Rename wait_for_completion() to issue_and_wait() to avoid completion.h | ||
167 | clash. | ||
168 | |||
169 | LK1.1.17 18Dec01 akpm | ||
170 | - PCI ID 9805 is a Python-T, not a dual-port Cyclone. Apparently. | ||
171 | And it has NWAY. | ||
172 | - Mask our advertised modes (vp->advertising) with our capabilities | ||
173 | (MII reg5) when deciding which duplex mode to use. | ||
174 | - Add `global_options' as default for options[]. Ditto global_enable_wol, | ||
175 | global_full_duplex. | ||
176 | |||
177 | LK1.1.18 01Jul02 akpm | ||
178 | - Fix for undocumented transceiver power-up bit on some 3c566B's | ||
179 | (Donald Becker, Rahul Karnik) | ||
180 | |||
181 | - See http://www.zip.com.au/~akpm/linux/#3c59x-2.3 for more details. | ||
182 | - Also see Documentation/networking/vortex.txt | ||
183 | |||
184 | LK1.1.19 10Nov02 Marc Zyngier <maz@wild-wind.fr.eu.org> | ||
185 | - EISA sysfs integration. | ||
186 | */ | 20 | */ |
187 | 21 | ||
188 | /* | 22 | /* |
diff --git a/drivers/net/8139cp.c b/drivers/net/8139cp.c index d2150baa7e35..1428bb7715af 100644 --- a/drivers/net/8139cp.c +++ b/drivers/net/8139cp.c | |||
@@ -1916,7 +1916,7 @@ static int cp_init_one (struct pci_dev *pdev, const struct pci_device_id *ent) | |||
1916 | regs = ioremap(pciaddr, CP_REGS_SIZE); | 1916 | regs = ioremap(pciaddr, CP_REGS_SIZE); |
1917 | if (!regs) { | 1917 | if (!regs) { |
1918 | rc = -EIO; | 1918 | rc = -EIO; |
1919 | dev_err(&pdev->dev, "Cannot map PCI MMIO (%lx@%lx)\n", | 1919 | dev_err(&pdev->dev, "Cannot map PCI MMIO (%Lx@%Lx)\n", |
1920 | (unsigned long long)pci_resource_len(pdev, 1), | 1920 | (unsigned long long)pci_resource_len(pdev, 1), |
1921 | (unsigned long long)pciaddr); | 1921 | (unsigned long long)pciaddr); |
1922 | goto err_out_res; | 1922 | goto err_out_res; |
diff --git a/drivers/net/8139too.c b/drivers/net/8139too.c index cd9718512d1c..e4f4eaff7679 100644 --- a/drivers/net/8139too.c +++ b/drivers/net/8139too.c | |||
@@ -1709,6 +1709,7 @@ static int rtl8139_start_xmit (struct sk_buff *skb, struct net_device *dev) | |||
1709 | void __iomem *ioaddr = tp->mmio_addr; | 1709 | void __iomem *ioaddr = tp->mmio_addr; |
1710 | unsigned int entry; | 1710 | unsigned int entry; |
1711 | unsigned int len = skb->len; | 1711 | unsigned int len = skb->len; |
1712 | unsigned long flags; | ||
1712 | 1713 | ||
1713 | /* Calculate the next Tx descriptor entry. */ | 1714 | /* Calculate the next Tx descriptor entry. */ |
1714 | entry = tp->cur_tx % NUM_TX_DESC; | 1715 | entry = tp->cur_tx % NUM_TX_DESC; |
@@ -1725,7 +1726,7 @@ static int rtl8139_start_xmit (struct sk_buff *skb, struct net_device *dev) | |||
1725 | return 0; | 1726 | return 0; |
1726 | } | 1727 | } |
1727 | 1728 | ||
1728 | spin_lock_irq(&tp->lock); | 1729 | spin_lock_irqsave(&tp->lock, flags); |
1729 | RTL_W32_F (TxStatus0 + (entry * sizeof (u32)), | 1730 | RTL_W32_F (TxStatus0 + (entry * sizeof (u32)), |
1730 | tp->tx_flag | max(len, (unsigned int)ETH_ZLEN)); | 1731 | tp->tx_flag | max(len, (unsigned int)ETH_ZLEN)); |
1731 | 1732 | ||
@@ -1736,7 +1737,7 @@ static int rtl8139_start_xmit (struct sk_buff *skb, struct net_device *dev) | |||
1736 | 1737 | ||
1737 | if ((tp->cur_tx - NUM_TX_DESC) == tp->dirty_tx) | 1738 | if ((tp->cur_tx - NUM_TX_DESC) == tp->dirty_tx) |
1738 | netif_stop_queue (dev); | 1739 | netif_stop_queue (dev); |
1739 | spin_unlock_irq(&tp->lock); | 1740 | spin_unlock_irqrestore(&tp->lock, flags); |
1740 | 1741 | ||
1741 | if (netif_msg_tx_queued(tp)) | 1742 | if (netif_msg_tx_queued(tp)) |
1742 | printk (KERN_DEBUG "%s: Queued Tx packet size %u to slot %d.\n", | 1743 | printk (KERN_DEBUG "%s: Queued Tx packet size %u to slot %d.\n", |
diff --git a/drivers/net/bnx2.c b/drivers/net/bnx2.c index 64b6a72b4f6a..db73de0d2511 100644 --- a/drivers/net/bnx2.c +++ b/drivers/net/bnx2.c | |||
@@ -1639,7 +1639,7 @@ bnx2_tx_int(struct bnx2 *bp) | |||
1639 | skb = tx_buf->skb; | 1639 | skb = tx_buf->skb; |
1640 | #ifdef BCM_TSO | 1640 | #ifdef BCM_TSO |
1641 | /* partial BD completions possible with TSO packets */ | 1641 | /* partial BD completions possible with TSO packets */ |
1642 | if (skb_shinfo(skb)->gso_size) { | 1642 | if (skb_is_gso(skb)) { |
1643 | u16 last_idx, last_ring_idx; | 1643 | u16 last_idx, last_ring_idx; |
1644 | 1644 | ||
1645 | last_idx = sw_cons + | 1645 | last_idx = sw_cons + |
diff --git a/drivers/net/chelsio/sge.c b/drivers/net/chelsio/sge.c index 87f94d939ff8..61b3754f50ff 100644 --- a/drivers/net/chelsio/sge.c +++ b/drivers/net/chelsio/sge.c | |||
@@ -1417,7 +1417,7 @@ int t1_start_xmit(struct sk_buff *skb, struct net_device *dev) | |||
1417 | struct cpl_tx_pkt *cpl; | 1417 | struct cpl_tx_pkt *cpl; |
1418 | 1418 | ||
1419 | #ifdef NETIF_F_TSO | 1419 | #ifdef NETIF_F_TSO |
1420 | if (skb_shinfo(skb)->gso_size) { | 1420 | if (skb_is_gso(skb)) { |
1421 | int eth_type; | 1421 | int eth_type; |
1422 | struct cpl_tx_pkt_lso *hdr; | 1422 | struct cpl_tx_pkt_lso *hdr; |
1423 | 1423 | ||
diff --git a/drivers/net/e1000/e1000.h b/drivers/net/e1000/e1000.h index 3042d33e2d4d..f411bbb44f86 100644 --- a/drivers/net/e1000/e1000.h +++ b/drivers/net/e1000/e1000.h | |||
@@ -68,7 +68,6 @@ | |||
68 | #ifdef NETIF_F_TSO | 68 | #ifdef NETIF_F_TSO |
69 | #include <net/checksum.h> | 69 | #include <net/checksum.h> |
70 | #endif | 70 | #endif |
71 | #include <linux/workqueue.h> | ||
72 | #include <linux/mii.h> | 71 | #include <linux/mii.h> |
73 | #include <linux/ethtool.h> | 72 | #include <linux/ethtool.h> |
74 | #include <linux/if_vlan.h> | 73 | #include <linux/if_vlan.h> |
@@ -143,6 +142,7 @@ struct e1000_adapter; | |||
143 | 142 | ||
144 | #define AUTO_ALL_MODES 0 | 143 | #define AUTO_ALL_MODES 0 |
145 | #define E1000_EEPROM_82544_APM 0x0004 | 144 | #define E1000_EEPROM_82544_APM 0x0004 |
145 | #define E1000_EEPROM_ICH8_APME 0x0004 | ||
146 | #define E1000_EEPROM_APME 0x0400 | 146 | #define E1000_EEPROM_APME 0x0400 |
147 | 147 | ||
148 | #ifndef E1000_MASTER_SLAVE | 148 | #ifndef E1000_MASTER_SLAVE |
@@ -254,7 +254,6 @@ struct e1000_adapter { | |||
254 | spinlock_t tx_queue_lock; | 254 | spinlock_t tx_queue_lock; |
255 | #endif | 255 | #endif |
256 | atomic_t irq_sem; | 256 | atomic_t irq_sem; |
257 | struct work_struct watchdog_task; | ||
258 | struct work_struct reset_task; | 257 | struct work_struct reset_task; |
259 | uint8_t fc_autoneg; | 258 | uint8_t fc_autoneg; |
260 | 259 | ||
@@ -339,8 +338,14 @@ struct e1000_adapter { | |||
339 | #ifdef NETIF_F_TSO | 338 | #ifdef NETIF_F_TSO |
340 | boolean_t tso_force; | 339 | boolean_t tso_force; |
341 | #endif | 340 | #endif |
341 | boolean_t smart_power_down; /* phy smart power down */ | ||
342 | unsigned long flags; | ||
342 | }; | 343 | }; |
343 | 344 | ||
345 | enum e1000_state_t { | ||
346 | __E1000_DRIVER_TESTING, | ||
347 | __E1000_RESETTING, | ||
348 | }; | ||
344 | 349 | ||
345 | /* e1000_main.c */ | 350 | /* e1000_main.c */ |
346 | extern char e1000_driver_name[]; | 351 | extern char e1000_driver_name[]; |
@@ -348,6 +353,7 @@ extern char e1000_driver_version[]; | |||
348 | int e1000_up(struct e1000_adapter *adapter); | 353 | int e1000_up(struct e1000_adapter *adapter); |
349 | void e1000_down(struct e1000_adapter *adapter); | 354 | void e1000_down(struct e1000_adapter *adapter); |
350 | void e1000_reset(struct e1000_adapter *adapter); | 355 | void e1000_reset(struct e1000_adapter *adapter); |
356 | void e1000_reinit_locked(struct e1000_adapter *adapter); | ||
351 | int e1000_setup_all_tx_resources(struct e1000_adapter *adapter); | 357 | int e1000_setup_all_tx_resources(struct e1000_adapter *adapter); |
352 | void e1000_free_all_tx_resources(struct e1000_adapter *adapter); | 358 | void e1000_free_all_tx_resources(struct e1000_adapter *adapter); |
353 | int e1000_setup_all_rx_resources(struct e1000_adapter *adapter); | 359 | int e1000_setup_all_rx_resources(struct e1000_adapter *adapter); |
diff --git a/drivers/net/e1000/e1000_ethtool.c b/drivers/net/e1000/e1000_ethtool.c index d19664891768..88a82ba88f57 100644 --- a/drivers/net/e1000/e1000_ethtool.c +++ b/drivers/net/e1000/e1000_ethtool.c | |||
@@ -109,7 +109,8 @@ e1000_get_settings(struct net_device *netdev, struct ethtool_cmd *ecmd) | |||
109 | SUPPORTED_1000baseT_Full| | 109 | SUPPORTED_1000baseT_Full| |
110 | SUPPORTED_Autoneg | | 110 | SUPPORTED_Autoneg | |
111 | SUPPORTED_TP); | 111 | SUPPORTED_TP); |
112 | 112 | if (hw->phy_type == e1000_phy_ife) | |
113 | ecmd->supported &= ~SUPPORTED_1000baseT_Full; | ||
113 | ecmd->advertising = ADVERTISED_TP; | 114 | ecmd->advertising = ADVERTISED_TP; |
114 | 115 | ||
115 | if (hw->autoneg == 1) { | 116 | if (hw->autoneg == 1) { |
@@ -203,11 +204,9 @@ e1000_set_settings(struct net_device *netdev, struct ethtool_cmd *ecmd) | |||
203 | 204 | ||
204 | /* reset the link */ | 205 | /* reset the link */ |
205 | 206 | ||
206 | if (netif_running(adapter->netdev)) { | 207 | if (netif_running(adapter->netdev)) |
207 | e1000_down(adapter); | 208 | e1000_reinit_locked(adapter); |
208 | e1000_reset(adapter); | 209 | else |
209 | e1000_up(adapter); | ||
210 | } else | ||
211 | e1000_reset(adapter); | 210 | e1000_reset(adapter); |
212 | 211 | ||
213 | return 0; | 212 | return 0; |
@@ -254,10 +253,9 @@ e1000_set_pauseparam(struct net_device *netdev, | |||
254 | hw->original_fc = hw->fc; | 253 | hw->original_fc = hw->fc; |
255 | 254 | ||
256 | if (adapter->fc_autoneg == AUTONEG_ENABLE) { | 255 | if (adapter->fc_autoneg == AUTONEG_ENABLE) { |
257 | if (netif_running(adapter->netdev)) { | 256 | if (netif_running(adapter->netdev)) |
258 | e1000_down(adapter); | 257 | e1000_reinit_locked(adapter); |
259 | e1000_up(adapter); | 258 | else |
260 | } else | ||
261 | e1000_reset(adapter); | 259 | e1000_reset(adapter); |
262 | } else | 260 | } else |
263 | return ((hw->media_type == e1000_media_type_fiber) ? | 261 | return ((hw->media_type == e1000_media_type_fiber) ? |
@@ -279,10 +277,9 @@ e1000_set_rx_csum(struct net_device *netdev, uint32_t data) | |||
279 | struct e1000_adapter *adapter = netdev_priv(netdev); | 277 | struct e1000_adapter *adapter = netdev_priv(netdev); |
280 | adapter->rx_csum = data; | 278 | adapter->rx_csum = data; |
281 | 279 | ||
282 | if (netif_running(netdev)) { | 280 | if (netif_running(netdev)) |
283 | e1000_down(adapter); | 281 | e1000_reinit_locked(adapter); |
284 | e1000_up(adapter); | 282 | else |
285 | } else | ||
286 | e1000_reset(adapter); | 283 | e1000_reset(adapter); |
287 | return 0; | 284 | return 0; |
288 | } | 285 | } |
@@ -577,6 +574,7 @@ e1000_get_drvinfo(struct net_device *netdev, | |||
577 | case e1000_82572: | 574 | case e1000_82572: |
578 | case e1000_82573: | 575 | case e1000_82573: |
579 | case e1000_80003es2lan: | 576 | case e1000_80003es2lan: |
577 | case e1000_ich8lan: | ||
580 | sprintf(firmware_version, "%d.%d-%d", | 578 | sprintf(firmware_version, "%d.%d-%d", |
581 | (eeprom_data & 0xF000) >> 12, | 579 | (eeprom_data & 0xF000) >> 12, |
582 | (eeprom_data & 0x0FF0) >> 4, | 580 | (eeprom_data & 0x0FF0) >> 4, |
@@ -631,6 +629,9 @@ e1000_set_ringparam(struct net_device *netdev, | |||
631 | tx_ring_size = sizeof(struct e1000_tx_ring) * adapter->num_tx_queues; | 629 | tx_ring_size = sizeof(struct e1000_tx_ring) * adapter->num_tx_queues; |
632 | rx_ring_size = sizeof(struct e1000_rx_ring) * adapter->num_rx_queues; | 630 | rx_ring_size = sizeof(struct e1000_rx_ring) * adapter->num_rx_queues; |
633 | 631 | ||
632 | while (test_and_set_bit(__E1000_RESETTING, &adapter->flags)) | ||
633 | msleep(1); | ||
634 | |||
634 | if (netif_running(adapter->netdev)) | 635 | if (netif_running(adapter->netdev)) |
635 | e1000_down(adapter); | 636 | e1000_down(adapter); |
636 | 637 | ||
@@ -691,9 +692,11 @@ e1000_set_ringparam(struct net_device *netdev, | |||
691 | adapter->rx_ring = rx_new; | 692 | adapter->rx_ring = rx_new; |
692 | adapter->tx_ring = tx_new; | 693 | adapter->tx_ring = tx_new; |
693 | if ((err = e1000_up(adapter))) | 694 | if ((err = e1000_up(adapter))) |
694 | return err; | 695 | goto err_setup; |
695 | } | 696 | } |
696 | 697 | ||
698 | clear_bit(__E1000_RESETTING, &adapter->flags); | ||
699 | |||
697 | return 0; | 700 | return 0; |
698 | err_setup_tx: | 701 | err_setup_tx: |
699 | e1000_free_all_rx_resources(adapter); | 702 | e1000_free_all_rx_resources(adapter); |
@@ -701,6 +704,8 @@ err_setup_rx: | |||
701 | adapter->rx_ring = rx_old; | 704 | adapter->rx_ring = rx_old; |
702 | adapter->tx_ring = tx_old; | 705 | adapter->tx_ring = tx_old; |
703 | e1000_up(adapter); | 706 | e1000_up(adapter); |
707 | err_setup: | ||
708 | clear_bit(__E1000_RESETTING, &adapter->flags); | ||
704 | return err; | 709 | return err; |
705 | } | 710 | } |
706 | 711 | ||
@@ -754,6 +759,7 @@ e1000_reg_test(struct e1000_adapter *adapter, uint64_t *data) | |||
754 | toggle = 0x7FFFF3FF; | 759 | toggle = 0x7FFFF3FF; |
755 | break; | 760 | break; |
756 | case e1000_82573: | 761 | case e1000_82573: |
762 | case e1000_ich8lan: | ||
757 | toggle = 0x7FFFF033; | 763 | toggle = 0x7FFFF033; |
758 | break; | 764 | break; |
759 | default: | 765 | default: |
@@ -773,11 +779,12 @@ e1000_reg_test(struct e1000_adapter *adapter, uint64_t *data) | |||
773 | } | 779 | } |
774 | /* restore previous status */ | 780 | /* restore previous status */ |
775 | E1000_WRITE_REG(&adapter->hw, STATUS, before); | 781 | E1000_WRITE_REG(&adapter->hw, STATUS, before); |
776 | 782 | if (adapter->hw.mac_type != e1000_ich8lan) { | |
777 | REG_PATTERN_TEST(FCAL, 0xFFFFFFFF, 0xFFFFFFFF); | 783 | REG_PATTERN_TEST(FCAL, 0xFFFFFFFF, 0xFFFFFFFF); |
778 | REG_PATTERN_TEST(FCAH, 0x0000FFFF, 0xFFFFFFFF); | 784 | REG_PATTERN_TEST(FCAH, 0x0000FFFF, 0xFFFFFFFF); |
779 | REG_PATTERN_TEST(FCT, 0x0000FFFF, 0xFFFFFFFF); | 785 | REG_PATTERN_TEST(FCT, 0x0000FFFF, 0xFFFFFFFF); |
780 | REG_PATTERN_TEST(VET, 0x0000FFFF, 0xFFFFFFFF); | 786 | REG_PATTERN_TEST(VET, 0x0000FFFF, 0xFFFFFFFF); |
787 | } | ||
781 | REG_PATTERN_TEST(RDTR, 0x0000FFFF, 0xFFFFFFFF); | 788 | REG_PATTERN_TEST(RDTR, 0x0000FFFF, 0xFFFFFFFF); |
782 | REG_PATTERN_TEST(RDBAH, 0xFFFFFFFF, 0xFFFFFFFF); | 789 | REG_PATTERN_TEST(RDBAH, 0xFFFFFFFF, 0xFFFFFFFF); |
783 | REG_PATTERN_TEST(RDLEN, 0x000FFF80, 0x000FFFFF); | 790 | REG_PATTERN_TEST(RDLEN, 0x000FFF80, 0x000FFFFF); |
@@ -790,20 +797,22 @@ e1000_reg_test(struct e1000_adapter *adapter, uint64_t *data) | |||
790 | REG_PATTERN_TEST(TDLEN, 0x000FFF80, 0x000FFFFF); | 797 | REG_PATTERN_TEST(TDLEN, 0x000FFF80, 0x000FFFFF); |
791 | 798 | ||
792 | REG_SET_AND_CHECK(RCTL, 0xFFFFFFFF, 0x00000000); | 799 | REG_SET_AND_CHECK(RCTL, 0xFFFFFFFF, 0x00000000); |
793 | REG_SET_AND_CHECK(RCTL, 0x06DFB3FE, 0x003FFFFB); | 800 | before = (adapter->hw.mac_type == e1000_ich8lan ? |
801 | 0x06C3B33E : 0x06DFB3FE); | ||
802 | REG_SET_AND_CHECK(RCTL, before, 0x003FFFFB); | ||
794 | REG_SET_AND_CHECK(TCTL, 0xFFFFFFFF, 0x00000000); | 803 | REG_SET_AND_CHECK(TCTL, 0xFFFFFFFF, 0x00000000); |
795 | 804 | ||
796 | if (adapter->hw.mac_type >= e1000_82543) { | 805 | if (adapter->hw.mac_type >= e1000_82543) { |
797 | 806 | ||
798 | REG_SET_AND_CHECK(RCTL, 0x06DFB3FE, 0xFFFFFFFF); | 807 | REG_SET_AND_CHECK(RCTL, before, 0xFFFFFFFF); |
799 | REG_PATTERN_TEST(RDBAL, 0xFFFFFFF0, 0xFFFFFFFF); | 808 | REG_PATTERN_TEST(RDBAL, 0xFFFFFFF0, 0xFFFFFFFF); |
800 | REG_PATTERN_TEST(TXCW, 0xC000FFFF, 0x0000FFFF); | 809 | if (adapter->hw.mac_type != e1000_ich8lan) |
810 | REG_PATTERN_TEST(TXCW, 0xC000FFFF, 0x0000FFFF); | ||
801 | REG_PATTERN_TEST(TDBAL, 0xFFFFFFF0, 0xFFFFFFFF); | 811 | REG_PATTERN_TEST(TDBAL, 0xFFFFFFF0, 0xFFFFFFFF); |
802 | REG_PATTERN_TEST(TIDV, 0x0000FFFF, 0x0000FFFF); | 812 | REG_PATTERN_TEST(TIDV, 0x0000FFFF, 0x0000FFFF); |
803 | 813 | value = (adapter->hw.mac_type == e1000_ich8lan ? | |
804 | for (i = 0; i < E1000_RAR_ENTRIES; i++) { | 814 | E1000_RAR_ENTRIES_ICH8LAN : E1000_RAR_ENTRIES); |
805 | REG_PATTERN_TEST(RA + ((i << 1) << 2), 0xFFFFFFFF, | 815 | for (i = 0; i < value; i++) { |
806 | 0xFFFFFFFF); | ||
807 | REG_PATTERN_TEST(RA + (((i << 1) + 1) << 2), 0x8003FFFF, | 816 | REG_PATTERN_TEST(RA + (((i << 1) + 1) << 2), 0x8003FFFF, |
808 | 0xFFFFFFFF); | 817 | 0xFFFFFFFF); |
809 | } | 818 | } |
@@ -817,7 +826,9 @@ e1000_reg_test(struct e1000_adapter *adapter, uint64_t *data) | |||
817 | 826 | ||
818 | } | 827 | } |
819 | 828 | ||
820 | for (i = 0; i < E1000_MC_TBL_SIZE; i++) | 829 | value = (adapter->hw.mac_type == e1000_ich8lan ? |
830 | E1000_MC_TBL_SIZE_ICH8LAN : E1000_MC_TBL_SIZE); | ||
831 | for (i = 0; i < value; i++) | ||
821 | REG_PATTERN_TEST(MTA + (i << 2), 0xFFFFFFFF, 0xFFFFFFFF); | 832 | REG_PATTERN_TEST(MTA + (i << 2), 0xFFFFFFFF, 0xFFFFFFFF); |
822 | 833 | ||
823 | *data = 0; | 834 | *data = 0; |
@@ -889,6 +900,8 @@ e1000_intr_test(struct e1000_adapter *adapter, uint64_t *data) | |||
889 | /* Test each interrupt */ | 900 | /* Test each interrupt */ |
890 | for (; i < 10; i++) { | 901 | for (; i < 10; i++) { |
891 | 902 | ||
903 | if (adapter->hw.mac_type == e1000_ich8lan && i == 8) | ||
904 | continue; | ||
892 | /* Interrupt to test */ | 905 | /* Interrupt to test */ |
893 | mask = 1 << i; | 906 | mask = 1 << i; |
894 | 907 | ||
@@ -1246,18 +1259,33 @@ e1000_integrated_phy_loopback(struct e1000_adapter *adapter) | |||
1246 | } else if (adapter->hw.phy_type == e1000_phy_gg82563) { | 1259 | } else if (adapter->hw.phy_type == e1000_phy_gg82563) { |
1247 | e1000_write_phy_reg(&adapter->hw, | 1260 | e1000_write_phy_reg(&adapter->hw, |
1248 | GG82563_PHY_KMRN_MODE_CTRL, | 1261 | GG82563_PHY_KMRN_MODE_CTRL, |
1249 | 0x1CE); | 1262 | 0x1CC); |
1250 | } | 1263 | } |
1251 | /* force 1000, set loopback */ | ||
1252 | e1000_write_phy_reg(&adapter->hw, PHY_CTRL, 0x4140); | ||
1253 | 1264 | ||
1254 | /* Now set up the MAC to the same speed/duplex as the PHY. */ | ||
1255 | ctrl_reg = E1000_READ_REG(&adapter->hw, CTRL); | 1265 | ctrl_reg = E1000_READ_REG(&adapter->hw, CTRL); |
1256 | ctrl_reg &= ~E1000_CTRL_SPD_SEL; /* Clear the speed sel bits */ | 1266 | |
1257 | ctrl_reg |= (E1000_CTRL_FRCSPD | /* Set the Force Speed Bit */ | 1267 | if (adapter->hw.phy_type == e1000_phy_ife) { |
1258 | E1000_CTRL_FRCDPX | /* Set the Force Duplex Bit */ | 1268 | /* force 100, set loopback */ |
1259 | E1000_CTRL_SPD_1000 |/* Force Speed to 1000 */ | 1269 | e1000_write_phy_reg(&adapter->hw, PHY_CTRL, 0x6100); |
1260 | E1000_CTRL_FD); /* Force Duplex to FULL */ | 1270 | |
1271 | /* Now set up the MAC to the same speed/duplex as the PHY. */ | ||
1272 | ctrl_reg &= ~E1000_CTRL_SPD_SEL; /* Clear the speed sel bits */ | ||
1273 | ctrl_reg |= (E1000_CTRL_FRCSPD | /* Set the Force Speed Bit */ | ||
1274 | E1000_CTRL_FRCDPX | /* Set the Force Duplex Bit */ | ||
1275 | E1000_CTRL_SPD_100 |/* Force Speed to 100 */ | ||
1276 | E1000_CTRL_FD); /* Force Duplex to FULL */ | ||
1277 | } else { | ||
1278 | /* force 1000, set loopback */ | ||
1279 | e1000_write_phy_reg(&adapter->hw, PHY_CTRL, 0x4140); | ||
1280 | |||
1281 | /* Now set up the MAC to the same speed/duplex as the PHY. */ | ||
1282 | ctrl_reg = E1000_READ_REG(&adapter->hw, CTRL); | ||
1283 | ctrl_reg &= ~E1000_CTRL_SPD_SEL; /* Clear the speed sel bits */ | ||
1284 | ctrl_reg |= (E1000_CTRL_FRCSPD | /* Set the Force Speed Bit */ | ||
1285 | E1000_CTRL_FRCDPX | /* Set the Force Duplex Bit */ | ||
1286 | E1000_CTRL_SPD_1000 |/* Force Speed to 1000 */ | ||
1287 | E1000_CTRL_FD); /* Force Duplex to FULL */ | ||
1288 | } | ||
1261 | 1289 | ||
1262 | if (adapter->hw.media_type == e1000_media_type_copper && | 1290 | if (adapter->hw.media_type == e1000_media_type_copper && |
1263 | adapter->hw.phy_type == e1000_phy_m88) { | 1291 | adapter->hw.phy_type == e1000_phy_m88) { |
@@ -1317,6 +1345,7 @@ e1000_set_phy_loopback(struct e1000_adapter *adapter) | |||
1317 | case e1000_82572: | 1345 | case e1000_82572: |
1318 | case e1000_82573: | 1346 | case e1000_82573: |
1319 | case e1000_80003es2lan: | 1347 | case e1000_80003es2lan: |
1348 | case e1000_ich8lan: | ||
1320 | return e1000_integrated_phy_loopback(adapter); | 1349 | return e1000_integrated_phy_loopback(adapter); |
1321 | break; | 1350 | break; |
1322 | 1351 | ||
@@ -1568,6 +1597,7 @@ e1000_diag_test(struct net_device *netdev, | |||
1568 | struct e1000_adapter *adapter = netdev_priv(netdev); | 1597 | struct e1000_adapter *adapter = netdev_priv(netdev); |
1569 | boolean_t if_running = netif_running(netdev); | 1598 | boolean_t if_running = netif_running(netdev); |
1570 | 1599 | ||
1600 | set_bit(__E1000_DRIVER_TESTING, &adapter->flags); | ||
1571 | if (eth_test->flags == ETH_TEST_FL_OFFLINE) { | 1601 | if (eth_test->flags == ETH_TEST_FL_OFFLINE) { |
1572 | /* Offline tests */ | 1602 | /* Offline tests */ |
1573 | 1603 | ||
@@ -1582,7 +1612,8 @@ e1000_diag_test(struct net_device *netdev, | |||
1582 | eth_test->flags |= ETH_TEST_FL_FAILED; | 1612 | eth_test->flags |= ETH_TEST_FL_FAILED; |
1583 | 1613 | ||
1584 | if (if_running) | 1614 | if (if_running) |
1585 | e1000_down(adapter); | 1615 | /* indicate we're in test mode */ |
1616 | dev_close(netdev); | ||
1586 | else | 1617 | else |
1587 | e1000_reset(adapter); | 1618 | e1000_reset(adapter); |
1588 | 1619 | ||
@@ -1607,8 +1638,9 @@ e1000_diag_test(struct net_device *netdev, | |||
1607 | adapter->hw.autoneg = autoneg; | 1638 | adapter->hw.autoneg = autoneg; |
1608 | 1639 | ||
1609 | e1000_reset(adapter); | 1640 | e1000_reset(adapter); |
1641 | clear_bit(__E1000_DRIVER_TESTING, &adapter->flags); | ||
1610 | if (if_running) | 1642 | if (if_running) |
1611 | e1000_up(adapter); | 1643 | dev_open(netdev); |
1612 | } else { | 1644 | } else { |
1613 | /* Online tests */ | 1645 | /* Online tests */ |
1614 | if (e1000_link_test(adapter, &data[4])) | 1646 | if (e1000_link_test(adapter, &data[4])) |
@@ -1619,6 +1651,8 @@ e1000_diag_test(struct net_device *netdev, | |||
1619 | data[1] = 0; | 1651 | data[1] = 0; |
1620 | data[2] = 0; | 1652 | data[2] = 0; |
1621 | data[3] = 0; | 1653 | data[3] = 0; |
1654 | |||
1655 | clear_bit(__E1000_DRIVER_TESTING, &adapter->flags); | ||
1622 | } | 1656 | } |
1623 | msleep_interruptible(4 * 1000); | 1657 | msleep_interruptible(4 * 1000); |
1624 | } | 1658 | } |
@@ -1778,21 +1812,18 @@ e1000_phys_id(struct net_device *netdev, uint32_t data) | |||
1778 | mod_timer(&adapter->blink_timer, jiffies); | 1812 | mod_timer(&adapter->blink_timer, jiffies); |
1779 | msleep_interruptible(data * 1000); | 1813 | msleep_interruptible(data * 1000); |
1780 | del_timer_sync(&adapter->blink_timer); | 1814 | del_timer_sync(&adapter->blink_timer); |
1781 | } else if (adapter->hw.mac_type < e1000_82573) { | 1815 | } else if (adapter->hw.phy_type == e1000_phy_ife) { |
1782 | E1000_WRITE_REG(&adapter->hw, LEDCTL, | 1816 | if (!adapter->blink_timer.function) { |
1783 | (E1000_LEDCTL_LED2_BLINK_RATE | | 1817 | init_timer(&adapter->blink_timer); |
1784 | E1000_LEDCTL_LED0_BLINK | E1000_LEDCTL_LED2_BLINK | | 1818 | adapter->blink_timer.function = e1000_led_blink_callback; |
1785 | (E1000_LEDCTL_MODE_LED_ON << E1000_LEDCTL_LED2_MODE_SHIFT) | | 1819 | adapter->blink_timer.data = (unsigned long) adapter; |
1786 | (E1000_LEDCTL_MODE_LINK_ACTIVITY << E1000_LEDCTL_LED0_MODE_SHIFT) | | 1820 | } |
1787 | (E1000_LEDCTL_MODE_LED_OFF << E1000_LEDCTL_LED1_MODE_SHIFT))); | 1821 | mod_timer(&adapter->blink_timer, jiffies); |
1788 | msleep_interruptible(data * 1000); | 1822 | msleep_interruptible(data * 1000); |
1823 | del_timer_sync(&adapter->blink_timer); | ||
1824 | e1000_write_phy_reg(&(adapter->hw), IFE_PHY_SPECIAL_CONTROL_LED, 0); | ||
1789 | } else { | 1825 | } else { |
1790 | E1000_WRITE_REG(&adapter->hw, LEDCTL, | 1826 | e1000_blink_led_start(&adapter->hw); |
1791 | (E1000_LEDCTL_LED2_BLINK_RATE | | ||
1792 | E1000_LEDCTL_LED1_BLINK | E1000_LEDCTL_LED2_BLINK | | ||
1793 | (E1000_LEDCTL_MODE_LED_ON << E1000_LEDCTL_LED2_MODE_SHIFT) | | ||
1794 | (E1000_LEDCTL_MODE_LINK_ACTIVITY << E1000_LEDCTL_LED1_MODE_SHIFT) | | ||
1795 | (E1000_LEDCTL_MODE_LED_OFF << E1000_LEDCTL_LED0_MODE_SHIFT))); | ||
1796 | msleep_interruptible(data * 1000); | 1827 | msleep_interruptible(data * 1000); |
1797 | } | 1828 | } |
1798 | 1829 | ||
@@ -1807,10 +1838,8 @@ static int | |||
1807 | e1000_nway_reset(struct net_device *netdev) | 1838 | e1000_nway_reset(struct net_device *netdev) |
1808 | { | 1839 | { |
1809 | struct e1000_adapter *adapter = netdev_priv(netdev); | 1840 | struct e1000_adapter *adapter = netdev_priv(netdev); |
1810 | if (netif_running(netdev)) { | 1841 | if (netif_running(netdev)) |
1811 | e1000_down(adapter); | 1842 | e1000_reinit_locked(adapter); |
1812 | e1000_up(adapter); | ||
1813 | } | ||
1814 | return 0; | 1843 | return 0; |
1815 | } | 1844 | } |
1816 | 1845 | ||
diff --git a/drivers/net/e1000/e1000_hw.c b/drivers/net/e1000/e1000_hw.c index 3959039b16ec..583518ae49ce 100644 --- a/drivers/net/e1000/e1000_hw.c +++ b/drivers/net/e1000/e1000_hw.c | |||
@@ -101,7 +101,8 @@ static void e1000_write_reg_io(struct e1000_hw *hw, uint32_t offset, | |||
101 | 101 | ||
102 | #define E1000_WRITE_REG_IO(a, reg, val) \ | 102 | #define E1000_WRITE_REG_IO(a, reg, val) \ |
103 | e1000_write_reg_io((a), E1000_##reg, val) | 103 | e1000_write_reg_io((a), E1000_##reg, val) |
104 | static int32_t e1000_configure_kmrn_for_10_100(struct e1000_hw *hw); | 104 | static int32_t e1000_configure_kmrn_for_10_100(struct e1000_hw *hw, |
105 | uint16_t duplex); | ||
105 | static int32_t e1000_configure_kmrn_for_1000(struct e1000_hw *hw); | 106 | static int32_t e1000_configure_kmrn_for_1000(struct e1000_hw *hw); |
106 | 107 | ||
107 | /* IGP cable length table */ | 108 | /* IGP cable length table */ |
@@ -156,6 +157,14 @@ e1000_set_phy_type(struct e1000_hw *hw) | |||
156 | hw->phy_type = e1000_phy_igp; | 157 | hw->phy_type = e1000_phy_igp; |
157 | break; | 158 | break; |
158 | } | 159 | } |
160 | case IGP03E1000_E_PHY_ID: | ||
161 | hw->phy_type = e1000_phy_igp_3; | ||
162 | break; | ||
163 | case IFE_E_PHY_ID: | ||
164 | case IFE_PLUS_E_PHY_ID: | ||
165 | case IFE_C_E_PHY_ID: | ||
166 | hw->phy_type = e1000_phy_ife; | ||
167 | break; | ||
159 | case GG82563_E_PHY_ID: | 168 | case GG82563_E_PHY_ID: |
160 | if (hw->mac_type == e1000_80003es2lan) { | 169 | if (hw->mac_type == e1000_80003es2lan) { |
161 | hw->phy_type = e1000_phy_gg82563; | 170 | hw->phy_type = e1000_phy_gg82563; |
@@ -332,6 +341,7 @@ e1000_set_mac_type(struct e1000_hw *hw) | |||
332 | break; | 341 | break; |
333 | case E1000_DEV_ID_82541EI: | 342 | case E1000_DEV_ID_82541EI: |
334 | case E1000_DEV_ID_82541EI_MOBILE: | 343 | case E1000_DEV_ID_82541EI_MOBILE: |
344 | case E1000_DEV_ID_82541ER_LOM: | ||
335 | hw->mac_type = e1000_82541; | 345 | hw->mac_type = e1000_82541; |
336 | break; | 346 | break; |
337 | case E1000_DEV_ID_82541ER: | 347 | case E1000_DEV_ID_82541ER: |
@@ -341,6 +351,7 @@ e1000_set_mac_type(struct e1000_hw *hw) | |||
341 | hw->mac_type = e1000_82541_rev_2; | 351 | hw->mac_type = e1000_82541_rev_2; |
342 | break; | 352 | break; |
343 | case E1000_DEV_ID_82547EI: | 353 | case E1000_DEV_ID_82547EI: |
354 | case E1000_DEV_ID_82547EI_MOBILE: | ||
344 | hw->mac_type = e1000_82547; | 355 | hw->mac_type = e1000_82547; |
345 | break; | 356 | break; |
346 | case E1000_DEV_ID_82547GI: | 357 | case E1000_DEV_ID_82547GI: |
@@ -354,6 +365,7 @@ e1000_set_mac_type(struct e1000_hw *hw) | |||
354 | case E1000_DEV_ID_82572EI_COPPER: | 365 | case E1000_DEV_ID_82572EI_COPPER: |
355 | case E1000_DEV_ID_82572EI_FIBER: | 366 | case E1000_DEV_ID_82572EI_FIBER: |
356 | case E1000_DEV_ID_82572EI_SERDES: | 367 | case E1000_DEV_ID_82572EI_SERDES: |
368 | case E1000_DEV_ID_82572EI: | ||
357 | hw->mac_type = e1000_82572; | 369 | hw->mac_type = e1000_82572; |
358 | break; | 370 | break; |
359 | case E1000_DEV_ID_82573E: | 371 | case E1000_DEV_ID_82573E: |
@@ -361,16 +373,29 @@ e1000_set_mac_type(struct e1000_hw *hw) | |||
361 | case E1000_DEV_ID_82573L: | 373 | case E1000_DEV_ID_82573L: |
362 | hw->mac_type = e1000_82573; | 374 | hw->mac_type = e1000_82573; |
363 | break; | 375 | break; |
376 | case E1000_DEV_ID_80003ES2LAN_COPPER_SPT: | ||
377 | case E1000_DEV_ID_80003ES2LAN_SERDES_SPT: | ||
364 | case E1000_DEV_ID_80003ES2LAN_COPPER_DPT: | 378 | case E1000_DEV_ID_80003ES2LAN_COPPER_DPT: |
365 | case E1000_DEV_ID_80003ES2LAN_SERDES_DPT: | 379 | case E1000_DEV_ID_80003ES2LAN_SERDES_DPT: |
366 | hw->mac_type = e1000_80003es2lan; | 380 | hw->mac_type = e1000_80003es2lan; |
367 | break; | 381 | break; |
382 | case E1000_DEV_ID_ICH8_IGP_M_AMT: | ||
383 | case E1000_DEV_ID_ICH8_IGP_AMT: | ||
384 | case E1000_DEV_ID_ICH8_IGP_C: | ||
385 | case E1000_DEV_ID_ICH8_IFE: | ||
386 | case E1000_DEV_ID_ICH8_IGP_M: | ||
387 | hw->mac_type = e1000_ich8lan; | ||
388 | break; | ||
368 | default: | 389 | default: |
369 | /* Should never have loaded on this device */ | 390 | /* Should never have loaded on this device */ |
370 | return -E1000_ERR_MAC_TYPE; | 391 | return -E1000_ERR_MAC_TYPE; |
371 | } | 392 | } |
372 | 393 | ||
373 | switch(hw->mac_type) { | 394 | switch(hw->mac_type) { |
395 | case e1000_ich8lan: | ||
396 | hw->swfwhw_semaphore_present = TRUE; | ||
397 | hw->asf_firmware_present = TRUE; | ||
398 | break; | ||
374 | case e1000_80003es2lan: | 399 | case e1000_80003es2lan: |
375 | hw->swfw_sync_present = TRUE; | 400 | hw->swfw_sync_present = TRUE; |
376 | /* fall through */ | 401 | /* fall through */ |
@@ -423,6 +448,7 @@ e1000_set_media_type(struct e1000_hw *hw) | |||
423 | case e1000_82542_rev2_1: | 448 | case e1000_82542_rev2_1: |
424 | hw->media_type = e1000_media_type_fiber; | 449 | hw->media_type = e1000_media_type_fiber; |
425 | break; | 450 | break; |
451 | case e1000_ich8lan: | ||
426 | case e1000_82573: | 452 | case e1000_82573: |
427 | /* The STATUS_TBIMODE bit is reserved or reused for the this | 453 | /* The STATUS_TBIMODE bit is reserved or reused for the this |
428 | * device. | 454 | * device. |
@@ -527,6 +553,14 @@ e1000_reset_hw(struct e1000_hw *hw) | |||
527 | } while(timeout); | 553 | } while(timeout); |
528 | } | 554 | } |
529 | 555 | ||
556 | /* Workaround for ICH8 bit corruption issue in FIFO memory */ | ||
557 | if (hw->mac_type == e1000_ich8lan) { | ||
558 | /* Set Tx and Rx buffer allocation to 8k apiece. */ | ||
559 | E1000_WRITE_REG(hw, PBA, E1000_PBA_8K); | ||
560 | /* Set Packet Buffer Size to 16k. */ | ||
561 | E1000_WRITE_REG(hw, PBS, E1000_PBS_16K); | ||
562 | } | ||
563 | |||
530 | /* Issue a global reset to the MAC. This will reset the chip's | 564 | /* Issue a global reset to the MAC. This will reset the chip's |
531 | * transmit, receive, DMA, and link units. It will not effect | 565 | * transmit, receive, DMA, and link units. It will not effect |
532 | * the current PCI configuration. The global reset bit is self- | 566 | * the current PCI configuration. The global reset bit is self- |
@@ -550,6 +584,20 @@ e1000_reset_hw(struct e1000_hw *hw) | |||
550 | /* Reset is performed on a shadow of the control register */ | 584 | /* Reset is performed on a shadow of the control register */ |
551 | E1000_WRITE_REG(hw, CTRL_DUP, (ctrl | E1000_CTRL_RST)); | 585 | E1000_WRITE_REG(hw, CTRL_DUP, (ctrl | E1000_CTRL_RST)); |
552 | break; | 586 | break; |
587 | case e1000_ich8lan: | ||
588 | if (!hw->phy_reset_disable && | ||
589 | e1000_check_phy_reset_block(hw) == E1000_SUCCESS) { | ||
590 | /* e1000_ich8lan PHY HW reset requires MAC CORE reset | ||
591 | * at the same time to make sure the interface between | ||
592 | * MAC and the external PHY is reset. | ||
593 | */ | ||
594 | ctrl |= E1000_CTRL_PHY_RST; | ||
595 | } | ||
596 | |||
597 | e1000_get_software_flag(hw); | ||
598 | E1000_WRITE_REG(hw, CTRL, (ctrl | E1000_CTRL_RST)); | ||
599 | msec_delay(5); | ||
600 | break; | ||
553 | default: | 601 | default: |
554 | E1000_WRITE_REG(hw, CTRL, (ctrl | E1000_CTRL_RST)); | 602 | E1000_WRITE_REG(hw, CTRL, (ctrl | E1000_CTRL_RST)); |
555 | break; | 603 | break; |
@@ -591,6 +639,7 @@ e1000_reset_hw(struct e1000_hw *hw) | |||
591 | /* fall through */ | 639 | /* fall through */ |
592 | case e1000_82571: | 640 | case e1000_82571: |
593 | case e1000_82572: | 641 | case e1000_82572: |
642 | case e1000_ich8lan: | ||
594 | case e1000_80003es2lan: | 643 | case e1000_80003es2lan: |
595 | ret_val = e1000_get_auto_rd_done(hw); | 644 | ret_val = e1000_get_auto_rd_done(hw); |
596 | if(ret_val) | 645 | if(ret_val) |
@@ -633,6 +682,12 @@ e1000_reset_hw(struct e1000_hw *hw) | |||
633 | e1000_pci_set_mwi(hw); | 682 | e1000_pci_set_mwi(hw); |
634 | } | 683 | } |
635 | 684 | ||
685 | if (hw->mac_type == e1000_ich8lan) { | ||
686 | uint32_t kab = E1000_READ_REG(hw, KABGTXD); | ||
687 | kab |= E1000_KABGTXD_BGSQLBIAS; | ||
688 | E1000_WRITE_REG(hw, KABGTXD, kab); | ||
689 | } | ||
690 | |||
636 | return E1000_SUCCESS; | 691 | return E1000_SUCCESS; |
637 | } | 692 | } |
638 | 693 | ||
@@ -675,9 +730,12 @@ e1000_init_hw(struct e1000_hw *hw) | |||
675 | 730 | ||
676 | /* Disabling VLAN filtering. */ | 731 | /* Disabling VLAN filtering. */ |
677 | DEBUGOUT("Initializing the IEEE VLAN\n"); | 732 | DEBUGOUT("Initializing the IEEE VLAN\n"); |
678 | if (hw->mac_type < e1000_82545_rev_3) | 733 | /* VET hardcoded to standard value and VFTA removed in ICH8 LAN */ |
679 | E1000_WRITE_REG(hw, VET, 0); | 734 | if (hw->mac_type != e1000_ich8lan) { |
680 | e1000_clear_vfta(hw); | 735 | if (hw->mac_type < e1000_82545_rev_3) |
736 | E1000_WRITE_REG(hw, VET, 0); | ||
737 | e1000_clear_vfta(hw); | ||
738 | } | ||
681 | 739 | ||
682 | /* For 82542 (rev 2.0), disable MWI and put the receiver into reset */ | 740 | /* For 82542 (rev 2.0), disable MWI and put the receiver into reset */ |
683 | if(hw->mac_type == e1000_82542_rev2_0) { | 741 | if(hw->mac_type == e1000_82542_rev2_0) { |
@@ -705,8 +763,14 @@ e1000_init_hw(struct e1000_hw *hw) | |||
705 | /* Zero out the Multicast HASH table */ | 763 | /* Zero out the Multicast HASH table */ |
706 | DEBUGOUT("Zeroing the MTA\n"); | 764 | DEBUGOUT("Zeroing the MTA\n"); |
707 | mta_size = E1000_MC_TBL_SIZE; | 765 | mta_size = E1000_MC_TBL_SIZE; |
708 | for(i = 0; i < mta_size; i++) | 766 | if (hw->mac_type == e1000_ich8lan) |
767 | mta_size = E1000_MC_TBL_SIZE_ICH8LAN; | ||
768 | for(i = 0; i < mta_size; i++) { | ||
709 | E1000_WRITE_REG_ARRAY(hw, MTA, i, 0); | 769 | E1000_WRITE_REG_ARRAY(hw, MTA, i, 0); |
770 | /* use write flush to prevent Memory Write Block (MWB) from | ||
771 | * occuring when accessing our register space */ | ||
772 | E1000_WRITE_FLUSH(hw); | ||
773 | } | ||
710 | 774 | ||
711 | /* Set the PCI priority bit correctly in the CTRL register. This | 775 | /* Set the PCI priority bit correctly in the CTRL register. This |
712 | * determines if the adapter gives priority to receives, or if it | 776 | * determines if the adapter gives priority to receives, or if it |
@@ -744,6 +808,10 @@ e1000_init_hw(struct e1000_hw *hw) | |||
744 | break; | 808 | break; |
745 | } | 809 | } |
746 | 810 | ||
811 | /* More time needed for PHY to initialize */ | ||
812 | if (hw->mac_type == e1000_ich8lan) | ||
813 | msec_delay(15); | ||
814 | |||
747 | /* Call a subroutine to configure the link and setup flow control. */ | 815 | /* Call a subroutine to configure the link and setup flow control. */ |
748 | ret_val = e1000_setup_link(hw); | 816 | ret_val = e1000_setup_link(hw); |
749 | 817 | ||
@@ -757,6 +825,7 @@ e1000_init_hw(struct e1000_hw *hw) | |||
757 | case e1000_82571: | 825 | case e1000_82571: |
758 | case e1000_82572: | 826 | case e1000_82572: |
759 | case e1000_82573: | 827 | case e1000_82573: |
828 | case e1000_ich8lan: | ||
760 | case e1000_80003es2lan: | 829 | case e1000_80003es2lan: |
761 | ctrl |= E1000_TXDCTL_COUNT_DESC; | 830 | ctrl |= E1000_TXDCTL_COUNT_DESC; |
762 | break; | 831 | break; |
@@ -795,6 +864,7 @@ e1000_init_hw(struct e1000_hw *hw) | |||
795 | /* Fall through */ | 864 | /* Fall through */ |
796 | case e1000_82571: | 865 | case e1000_82571: |
797 | case e1000_82572: | 866 | case e1000_82572: |
867 | case e1000_ich8lan: | ||
798 | ctrl = E1000_READ_REG(hw, TXDCTL1); | 868 | ctrl = E1000_READ_REG(hw, TXDCTL1); |
799 | ctrl = (ctrl & ~E1000_TXDCTL_WTHRESH) | E1000_TXDCTL_FULL_TX_DESC_WB; | 869 | ctrl = (ctrl & ~E1000_TXDCTL_WTHRESH) | E1000_TXDCTL_FULL_TX_DESC_WB; |
800 | if(hw->mac_type >= e1000_82571) | 870 | if(hw->mac_type >= e1000_82571) |
@@ -818,6 +888,11 @@ e1000_init_hw(struct e1000_hw *hw) | |||
818 | */ | 888 | */ |
819 | e1000_clear_hw_cntrs(hw); | 889 | e1000_clear_hw_cntrs(hw); |
820 | 890 | ||
891 | /* ICH8 No-snoop bits are opposite polarity. | ||
892 | * Set to snoop by default after reset. */ | ||
893 | if (hw->mac_type == e1000_ich8lan) | ||
894 | e1000_set_pci_ex_no_snoop(hw, PCI_EX_82566_SNOOP_ALL); | ||
895 | |||
821 | if (hw->device_id == E1000_DEV_ID_82546GB_QUAD_COPPER || | 896 | if (hw->device_id == E1000_DEV_ID_82546GB_QUAD_COPPER || |
822 | hw->device_id == E1000_DEV_ID_82546GB_QUAD_COPPER_KSP3) { | 897 | hw->device_id == E1000_DEV_ID_82546GB_QUAD_COPPER_KSP3) { |
823 | ctrl_ext = E1000_READ_REG(hw, CTRL_EXT); | 898 | ctrl_ext = E1000_READ_REG(hw, CTRL_EXT); |
@@ -905,6 +980,7 @@ e1000_setup_link(struct e1000_hw *hw) | |||
905 | */ | 980 | */ |
906 | if (hw->fc == e1000_fc_default) { | 981 | if (hw->fc == e1000_fc_default) { |
907 | switch (hw->mac_type) { | 982 | switch (hw->mac_type) { |
983 | case e1000_ich8lan: | ||
908 | case e1000_82573: | 984 | case e1000_82573: |
909 | hw->fc = e1000_fc_full; | 985 | hw->fc = e1000_fc_full; |
910 | break; | 986 | break; |
@@ -971,9 +1047,12 @@ e1000_setup_link(struct e1000_hw *hw) | |||
971 | */ | 1047 | */ |
972 | DEBUGOUT("Initializing the Flow Control address, type and timer regs\n"); | 1048 | DEBUGOUT("Initializing the Flow Control address, type and timer regs\n"); |
973 | 1049 | ||
974 | E1000_WRITE_REG(hw, FCAL, FLOW_CONTROL_ADDRESS_LOW); | 1050 | /* FCAL/H and FCT are hardcoded to standard values in e1000_ich8lan. */ |
975 | E1000_WRITE_REG(hw, FCAH, FLOW_CONTROL_ADDRESS_HIGH); | 1051 | if (hw->mac_type != e1000_ich8lan) { |
976 | E1000_WRITE_REG(hw, FCT, FLOW_CONTROL_TYPE); | 1052 | E1000_WRITE_REG(hw, FCT, FLOW_CONTROL_TYPE); |
1053 | E1000_WRITE_REG(hw, FCAH, FLOW_CONTROL_ADDRESS_HIGH); | ||
1054 | E1000_WRITE_REG(hw, FCAL, FLOW_CONTROL_ADDRESS_LOW); | ||
1055 | } | ||
977 | 1056 | ||
978 | E1000_WRITE_REG(hw, FCTTV, hw->fc_pause_time); | 1057 | E1000_WRITE_REG(hw, FCTTV, hw->fc_pause_time); |
979 | 1058 | ||
@@ -1237,12 +1316,13 @@ e1000_copper_link_igp_setup(struct e1000_hw *hw) | |||
1237 | 1316 | ||
1238 | /* Wait 10ms for MAC to configure PHY from eeprom settings */ | 1317 | /* Wait 10ms for MAC to configure PHY from eeprom settings */ |
1239 | msec_delay(15); | 1318 | msec_delay(15); |
1240 | 1319 | if (hw->mac_type != e1000_ich8lan) { | |
1241 | /* Configure activity LED after PHY reset */ | 1320 | /* Configure activity LED after PHY reset */ |
1242 | led_ctrl = E1000_READ_REG(hw, LEDCTL); | 1321 | led_ctrl = E1000_READ_REG(hw, LEDCTL); |
1243 | led_ctrl &= IGP_ACTIVITY_LED_MASK; | 1322 | led_ctrl &= IGP_ACTIVITY_LED_MASK; |
1244 | led_ctrl |= (IGP_ACTIVITY_LED_ENABLE | IGP_LED3_MODE); | 1323 | led_ctrl |= (IGP_ACTIVITY_LED_ENABLE | IGP_LED3_MODE); |
1245 | E1000_WRITE_REG(hw, LEDCTL, led_ctrl); | 1324 | E1000_WRITE_REG(hw, LEDCTL, led_ctrl); |
1325 | } | ||
1246 | 1326 | ||
1247 | /* disable lplu d3 during driver init */ | 1327 | /* disable lplu d3 during driver init */ |
1248 | ret_val = e1000_set_d3_lplu_state(hw, FALSE); | 1328 | ret_val = e1000_set_d3_lplu_state(hw, FALSE); |
@@ -1478,8 +1558,7 @@ e1000_copper_link_ggp_setup(struct e1000_hw *hw) | |||
1478 | if (ret_val) | 1558 | if (ret_val) |
1479 | return ret_val; | 1559 | return ret_val; |
1480 | 1560 | ||
1481 | /* Enable Pass False Carrier on the PHY */ | 1561 | phy_data &= ~GG82563_KMCR_PASS_FALSE_CARRIER; |
1482 | phy_data |= GG82563_KMCR_PASS_FALSE_CARRIER; | ||
1483 | 1562 | ||
1484 | ret_val = e1000_write_phy_reg(hw, GG82563_PHY_KMRN_MODE_CTRL, | 1563 | ret_val = e1000_write_phy_reg(hw, GG82563_PHY_KMRN_MODE_CTRL, |
1485 | phy_data); | 1564 | phy_data); |
@@ -1561,28 +1640,40 @@ e1000_copper_link_mgp_setup(struct e1000_hw *hw) | |||
1561 | phy_data &= ~M88E1000_PSCR_POLARITY_REVERSAL; | 1640 | phy_data &= ~M88E1000_PSCR_POLARITY_REVERSAL; |
1562 | if(hw->disable_polarity_correction == 1) | 1641 | if(hw->disable_polarity_correction == 1) |
1563 | phy_data |= M88E1000_PSCR_POLARITY_REVERSAL; | 1642 | phy_data |= M88E1000_PSCR_POLARITY_REVERSAL; |
1564 | ret_val = e1000_write_phy_reg(hw, M88E1000_PHY_SPEC_CTRL, phy_data); | 1643 | ret_val = e1000_write_phy_reg(hw, M88E1000_PHY_SPEC_CTRL, phy_data); |
1565 | if(ret_val) | 1644 | if (ret_val) |
1566 | return ret_val; | ||
1567 | |||
1568 | /* Force TX_CLK in the Extended PHY Specific Control Register | ||
1569 | * to 25MHz clock. | ||
1570 | */ | ||
1571 | ret_val = e1000_read_phy_reg(hw, M88E1000_EXT_PHY_SPEC_CTRL, &phy_data); | ||
1572 | if(ret_val) | ||
1573 | return ret_val; | 1645 | return ret_val; |
1574 | 1646 | ||
1575 | phy_data |= M88E1000_EPSCR_TX_CLK_25; | ||
1576 | |||
1577 | if (hw->phy_revision < M88E1011_I_REV_4) { | 1647 | if (hw->phy_revision < M88E1011_I_REV_4) { |
1578 | /* Configure Master and Slave downshift values */ | 1648 | /* Force TX_CLK in the Extended PHY Specific Control Register |
1579 | phy_data &= ~(M88E1000_EPSCR_MASTER_DOWNSHIFT_MASK | | 1649 | * to 25MHz clock. |
1650 | */ | ||
1651 | ret_val = e1000_read_phy_reg(hw, M88E1000_EXT_PHY_SPEC_CTRL, &phy_data); | ||
1652 | if (ret_val) | ||
1653 | return ret_val; | ||
1654 | |||
1655 | phy_data |= M88E1000_EPSCR_TX_CLK_25; | ||
1656 | |||
1657 | if ((hw->phy_revision == E1000_REVISION_2) && | ||
1658 | (hw->phy_id == M88E1111_I_PHY_ID)) { | ||
1659 | /* Vidalia Phy, set the downshift counter to 5x */ | ||
1660 | phy_data &= ~(M88EC018_EPSCR_DOWNSHIFT_COUNTER_MASK); | ||
1661 | phy_data |= M88EC018_EPSCR_DOWNSHIFT_COUNTER_5X; | ||
1662 | ret_val = e1000_write_phy_reg(hw, | ||
1663 | M88E1000_EXT_PHY_SPEC_CTRL, phy_data); | ||
1664 | if (ret_val) | ||
1665 | return ret_val; | ||
1666 | } else { | ||
1667 | /* Configure Master and Slave downshift values */ | ||
1668 | phy_data &= ~(M88E1000_EPSCR_MASTER_DOWNSHIFT_MASK | | ||
1580 | M88E1000_EPSCR_SLAVE_DOWNSHIFT_MASK); | 1669 | M88E1000_EPSCR_SLAVE_DOWNSHIFT_MASK); |
1581 | phy_data |= (M88E1000_EPSCR_MASTER_DOWNSHIFT_1X | | 1670 | phy_data |= (M88E1000_EPSCR_MASTER_DOWNSHIFT_1X | |
1582 | M88E1000_EPSCR_SLAVE_DOWNSHIFT_1X); | 1671 | M88E1000_EPSCR_SLAVE_DOWNSHIFT_1X); |
1583 | ret_val = e1000_write_phy_reg(hw, M88E1000_EXT_PHY_SPEC_CTRL, phy_data); | 1672 | ret_val = e1000_write_phy_reg(hw, |
1584 | if(ret_val) | 1673 | M88E1000_EXT_PHY_SPEC_CTRL, phy_data); |
1585 | return ret_val; | 1674 | if (ret_val) |
1675 | return ret_val; | ||
1676 | } | ||
1586 | } | 1677 | } |
1587 | 1678 | ||
1588 | /* SW Reset the PHY so all changes take effect */ | 1679 | /* SW Reset the PHY so all changes take effect */ |
@@ -1620,6 +1711,10 @@ e1000_copper_link_autoneg(struct e1000_hw *hw) | |||
1620 | if(hw->autoneg_advertised == 0) | 1711 | if(hw->autoneg_advertised == 0) |
1621 | hw->autoneg_advertised = AUTONEG_ADVERTISE_SPEED_DEFAULT; | 1712 | hw->autoneg_advertised = AUTONEG_ADVERTISE_SPEED_DEFAULT; |
1622 | 1713 | ||
1714 | /* IFE phy only supports 10/100 */ | ||
1715 | if (hw->phy_type == e1000_phy_ife) | ||
1716 | hw->autoneg_advertised &= AUTONEG_ADVERTISE_10_100_ALL; | ||
1717 | |||
1623 | DEBUGOUT("Reconfiguring auto-neg advertisement params\n"); | 1718 | DEBUGOUT("Reconfiguring auto-neg advertisement params\n"); |
1624 | ret_val = e1000_phy_setup_autoneg(hw); | 1719 | ret_val = e1000_phy_setup_autoneg(hw); |
1625 | if(ret_val) { | 1720 | if(ret_val) { |
@@ -1717,6 +1812,26 @@ e1000_setup_copper_link(struct e1000_hw *hw) | |||
1717 | 1812 | ||
1718 | DEBUGFUNC("e1000_setup_copper_link"); | 1813 | DEBUGFUNC("e1000_setup_copper_link"); |
1719 | 1814 | ||
1815 | switch (hw->mac_type) { | ||
1816 | case e1000_80003es2lan: | ||
1817 | case e1000_ich8lan: | ||
1818 | /* Set the mac to wait the maximum time between each | ||
1819 | * iteration and increase the max iterations when | ||
1820 | * polling the phy; this fixes erroneous timeouts at 10Mbps. */ | ||
1821 | ret_val = e1000_write_kmrn_reg(hw, GG82563_REG(0x34, 4), 0xFFFF); | ||
1822 | if (ret_val) | ||
1823 | return ret_val; | ||
1824 | ret_val = e1000_read_kmrn_reg(hw, GG82563_REG(0x34, 9), ®_data); | ||
1825 | if (ret_val) | ||
1826 | return ret_val; | ||
1827 | reg_data |= 0x3F; | ||
1828 | ret_val = e1000_write_kmrn_reg(hw, GG82563_REG(0x34, 9), reg_data); | ||
1829 | if (ret_val) | ||
1830 | return ret_val; | ||
1831 | default: | ||
1832 | break; | ||
1833 | } | ||
1834 | |||
1720 | /* Check if it is a valid PHY and set PHY mode if necessary. */ | 1835 | /* Check if it is a valid PHY and set PHY mode if necessary. */ |
1721 | ret_val = e1000_copper_link_preconfig(hw); | 1836 | ret_val = e1000_copper_link_preconfig(hw); |
1722 | if(ret_val) | 1837 | if(ret_val) |
@@ -1724,10 +1839,8 @@ e1000_setup_copper_link(struct e1000_hw *hw) | |||
1724 | 1839 | ||
1725 | switch (hw->mac_type) { | 1840 | switch (hw->mac_type) { |
1726 | case e1000_80003es2lan: | 1841 | case e1000_80003es2lan: |
1727 | ret_val = e1000_read_kmrn_reg(hw, E1000_KUMCTRLSTA_OFFSET_INB_CTRL, | 1842 | /* Kumeran registers are written-only */ |
1728 | ®_data); | 1843 | reg_data = E1000_KUMCTRLSTA_INB_CTRL_LINK_STATUS_TX_TIMEOUT_DEFAULT; |
1729 | if (ret_val) | ||
1730 | return ret_val; | ||
1731 | reg_data |= E1000_KUMCTRLSTA_INB_CTRL_DIS_PADDING; | 1844 | reg_data |= E1000_KUMCTRLSTA_INB_CTRL_DIS_PADDING; |
1732 | ret_val = e1000_write_kmrn_reg(hw, E1000_KUMCTRLSTA_OFFSET_INB_CTRL, | 1845 | ret_val = e1000_write_kmrn_reg(hw, E1000_KUMCTRLSTA_OFFSET_INB_CTRL, |
1733 | reg_data); | 1846 | reg_data); |
@@ -1739,6 +1852,7 @@ e1000_setup_copper_link(struct e1000_hw *hw) | |||
1739 | } | 1852 | } |
1740 | 1853 | ||
1741 | if (hw->phy_type == e1000_phy_igp || | 1854 | if (hw->phy_type == e1000_phy_igp || |
1855 | hw->phy_type == e1000_phy_igp_3 || | ||
1742 | hw->phy_type == e1000_phy_igp_2) { | 1856 | hw->phy_type == e1000_phy_igp_2) { |
1743 | ret_val = e1000_copper_link_igp_setup(hw); | 1857 | ret_val = e1000_copper_link_igp_setup(hw); |
1744 | if(ret_val) | 1858 | if(ret_val) |
@@ -1803,7 +1917,7 @@ e1000_setup_copper_link(struct e1000_hw *hw) | |||
1803 | * hw - Struct containing variables accessed by shared code | 1917 | * hw - Struct containing variables accessed by shared code |
1804 | ******************************************************************************/ | 1918 | ******************************************************************************/ |
1805 | static int32_t | 1919 | static int32_t |
1806 | e1000_configure_kmrn_for_10_100(struct e1000_hw *hw) | 1920 | e1000_configure_kmrn_for_10_100(struct e1000_hw *hw, uint16_t duplex) |
1807 | { | 1921 | { |
1808 | int32_t ret_val = E1000_SUCCESS; | 1922 | int32_t ret_val = E1000_SUCCESS; |
1809 | uint32_t tipg; | 1923 | uint32_t tipg; |
@@ -1823,6 +1937,18 @@ e1000_configure_kmrn_for_10_100(struct e1000_hw *hw) | |||
1823 | tipg |= DEFAULT_80003ES2LAN_TIPG_IPGT_10_100; | 1937 | tipg |= DEFAULT_80003ES2LAN_TIPG_IPGT_10_100; |
1824 | E1000_WRITE_REG(hw, TIPG, tipg); | 1938 | E1000_WRITE_REG(hw, TIPG, tipg); |
1825 | 1939 | ||
1940 | ret_val = e1000_read_phy_reg(hw, GG82563_PHY_KMRN_MODE_CTRL, ®_data); | ||
1941 | |||
1942 | if (ret_val) | ||
1943 | return ret_val; | ||
1944 | |||
1945 | if (duplex == HALF_DUPLEX) | ||
1946 | reg_data |= GG82563_KMCR_PASS_FALSE_CARRIER; | ||
1947 | else | ||
1948 | reg_data &= ~GG82563_KMCR_PASS_FALSE_CARRIER; | ||
1949 | |||
1950 | ret_val = e1000_write_phy_reg(hw, GG82563_PHY_KMRN_MODE_CTRL, reg_data); | ||
1951 | |||
1826 | return ret_val; | 1952 | return ret_val; |
1827 | } | 1953 | } |
1828 | 1954 | ||
@@ -1847,6 +1973,14 @@ e1000_configure_kmrn_for_1000(struct e1000_hw *hw) | |||
1847 | tipg |= DEFAULT_80003ES2LAN_TIPG_IPGT_1000; | 1973 | tipg |= DEFAULT_80003ES2LAN_TIPG_IPGT_1000; |
1848 | E1000_WRITE_REG(hw, TIPG, tipg); | 1974 | E1000_WRITE_REG(hw, TIPG, tipg); |
1849 | 1975 | ||
1976 | ret_val = e1000_read_phy_reg(hw, GG82563_PHY_KMRN_MODE_CTRL, ®_data); | ||
1977 | |||
1978 | if (ret_val) | ||
1979 | return ret_val; | ||
1980 | |||
1981 | reg_data &= ~GG82563_KMCR_PASS_FALSE_CARRIER; | ||
1982 | ret_val = e1000_write_phy_reg(hw, GG82563_PHY_KMRN_MODE_CTRL, reg_data); | ||
1983 | |||
1850 | return ret_val; | 1984 | return ret_val; |
1851 | } | 1985 | } |
1852 | 1986 | ||
@@ -1869,10 +2003,13 @@ e1000_phy_setup_autoneg(struct e1000_hw *hw) | |||
1869 | if(ret_val) | 2003 | if(ret_val) |
1870 | return ret_val; | 2004 | return ret_val; |
1871 | 2005 | ||
1872 | /* Read the MII 1000Base-T Control Register (Address 9). */ | 2006 | if (hw->phy_type != e1000_phy_ife) { |
1873 | ret_val = e1000_read_phy_reg(hw, PHY_1000T_CTRL, &mii_1000t_ctrl_reg); | 2007 | /* Read the MII 1000Base-T Control Register (Address 9). */ |
1874 | if(ret_val) | 2008 | ret_val = e1000_read_phy_reg(hw, PHY_1000T_CTRL, &mii_1000t_ctrl_reg); |
1875 | return ret_val; | 2009 | if (ret_val) |
2010 | return ret_val; | ||
2011 | } else | ||
2012 | mii_1000t_ctrl_reg=0; | ||
1876 | 2013 | ||
1877 | /* Need to parse both autoneg_advertised and fc and set up | 2014 | /* Need to parse both autoneg_advertised and fc and set up |
1878 | * the appropriate PHY registers. First we will parse for | 2015 | * the appropriate PHY registers. First we will parse for |
@@ -1923,6 +2060,9 @@ e1000_phy_setup_autoneg(struct e1000_hw *hw) | |||
1923 | if(hw->autoneg_advertised & ADVERTISE_1000_FULL) { | 2060 | if(hw->autoneg_advertised & ADVERTISE_1000_FULL) { |
1924 | DEBUGOUT("Advertise 1000mb Full duplex\n"); | 2061 | DEBUGOUT("Advertise 1000mb Full duplex\n"); |
1925 | mii_1000t_ctrl_reg |= CR_1000T_FD_CAPS; | 2062 | mii_1000t_ctrl_reg |= CR_1000T_FD_CAPS; |
2063 | if (hw->phy_type == e1000_phy_ife) { | ||
2064 | DEBUGOUT("e1000_phy_ife is a 10/100 PHY. Gigabit speed is not supported.\n"); | ||
2065 | } | ||
1926 | } | 2066 | } |
1927 | 2067 | ||
1928 | /* Check for a software override of the flow control settings, and | 2068 | /* Check for a software override of the flow control settings, and |
@@ -1984,9 +2124,11 @@ e1000_phy_setup_autoneg(struct e1000_hw *hw) | |||
1984 | 2124 | ||
1985 | DEBUGOUT1("Auto-Neg Advertising %x\n", mii_autoneg_adv_reg); | 2125 | DEBUGOUT1("Auto-Neg Advertising %x\n", mii_autoneg_adv_reg); |
1986 | 2126 | ||
1987 | ret_val = e1000_write_phy_reg(hw, PHY_1000T_CTRL, mii_1000t_ctrl_reg); | 2127 | if (hw->phy_type != e1000_phy_ife) { |
1988 | if(ret_val) | 2128 | ret_val = e1000_write_phy_reg(hw, PHY_1000T_CTRL, mii_1000t_ctrl_reg); |
1989 | return ret_val; | 2129 | if (ret_val) |
2130 | return ret_val; | ||
2131 | } | ||
1990 | 2132 | ||
1991 | return E1000_SUCCESS; | 2133 | return E1000_SUCCESS; |
1992 | } | 2134 | } |
@@ -2089,6 +2231,18 @@ e1000_phy_force_speed_duplex(struct e1000_hw *hw) | |||
2089 | 2231 | ||
2090 | /* Need to reset the PHY or these changes will be ignored */ | 2232 | /* Need to reset the PHY or these changes will be ignored */ |
2091 | mii_ctrl_reg |= MII_CR_RESET; | 2233 | mii_ctrl_reg |= MII_CR_RESET; |
2234 | /* Disable MDI-X support for 10/100 */ | ||
2235 | } else if (hw->phy_type == e1000_phy_ife) { | ||
2236 | ret_val = e1000_read_phy_reg(hw, IFE_PHY_MDIX_CONTROL, &phy_data); | ||
2237 | if (ret_val) | ||
2238 | return ret_val; | ||
2239 | |||
2240 | phy_data &= ~IFE_PMC_AUTO_MDIX; | ||
2241 | phy_data &= ~IFE_PMC_FORCE_MDIX; | ||
2242 | |||
2243 | ret_val = e1000_write_phy_reg(hw, IFE_PHY_MDIX_CONTROL, phy_data); | ||
2244 | if (ret_val) | ||
2245 | return ret_val; | ||
2092 | } else { | 2246 | } else { |
2093 | /* Clear Auto-Crossover to force MDI manually. IGP requires MDI | 2247 | /* Clear Auto-Crossover to force MDI manually. IGP requires MDI |
2094 | * forced whenever speed or duplex are forced. | 2248 | * forced whenever speed or duplex are forced. |
@@ -2721,8 +2875,12 @@ e1000_check_for_link(struct e1000_hw *hw) | |||
2721 | */ | 2875 | */ |
2722 | if(hw->tbi_compatibility_en) { | 2876 | if(hw->tbi_compatibility_en) { |
2723 | uint16_t speed, duplex; | 2877 | uint16_t speed, duplex; |
2724 | e1000_get_speed_and_duplex(hw, &speed, &duplex); | 2878 | ret_val = e1000_get_speed_and_duplex(hw, &speed, &duplex); |
2725 | if(speed != SPEED_1000) { | 2879 | if (ret_val) { |
2880 | DEBUGOUT("Error getting link speed and duplex\n"); | ||
2881 | return ret_val; | ||
2882 | } | ||
2883 | if (speed != SPEED_1000) { | ||
2726 | /* If link speed is not set to gigabit speed, we do not need | 2884 | /* If link speed is not set to gigabit speed, we do not need |
2727 | * to enable TBI compatibility. | 2885 | * to enable TBI compatibility. |
2728 | */ | 2886 | */ |
@@ -2889,7 +3047,13 @@ e1000_get_speed_and_duplex(struct e1000_hw *hw, | |||
2889 | if (*speed == SPEED_1000) | 3047 | if (*speed == SPEED_1000) |
2890 | ret_val = e1000_configure_kmrn_for_1000(hw); | 3048 | ret_val = e1000_configure_kmrn_for_1000(hw); |
2891 | else | 3049 | else |
2892 | ret_val = e1000_configure_kmrn_for_10_100(hw); | 3050 | ret_val = e1000_configure_kmrn_for_10_100(hw, *duplex); |
3051 | if (ret_val) | ||
3052 | return ret_val; | ||
3053 | } | ||
3054 | |||
3055 | if ((hw->phy_type == e1000_phy_igp_3) && (*speed == SPEED_1000)) { | ||
3056 | ret_val = e1000_kumeran_lock_loss_workaround(hw); | ||
2893 | if (ret_val) | 3057 | if (ret_val) |
2894 | return ret_val; | 3058 | return ret_val; |
2895 | } | 3059 | } |
@@ -3079,6 +3243,9 @@ e1000_swfw_sync_acquire(struct e1000_hw *hw, uint16_t mask) | |||
3079 | 3243 | ||
3080 | DEBUGFUNC("e1000_swfw_sync_acquire"); | 3244 | DEBUGFUNC("e1000_swfw_sync_acquire"); |
3081 | 3245 | ||
3246 | if (hw->swfwhw_semaphore_present) | ||
3247 | return e1000_get_software_flag(hw); | ||
3248 | |||
3082 | if (!hw->swfw_sync_present) | 3249 | if (!hw->swfw_sync_present) |
3083 | return e1000_get_hw_eeprom_semaphore(hw); | 3250 | return e1000_get_hw_eeprom_semaphore(hw); |
3084 | 3251 | ||
@@ -3118,6 +3285,11 @@ e1000_swfw_sync_release(struct e1000_hw *hw, uint16_t mask) | |||
3118 | 3285 | ||
3119 | DEBUGFUNC("e1000_swfw_sync_release"); | 3286 | DEBUGFUNC("e1000_swfw_sync_release"); |
3120 | 3287 | ||
3288 | if (hw->swfwhw_semaphore_present) { | ||
3289 | e1000_release_software_flag(hw); | ||
3290 | return; | ||
3291 | } | ||
3292 | |||
3121 | if (!hw->swfw_sync_present) { | 3293 | if (!hw->swfw_sync_present) { |
3122 | e1000_put_hw_eeprom_semaphore(hw); | 3294 | e1000_put_hw_eeprom_semaphore(hw); |
3123 | return; | 3295 | return; |
@@ -3160,7 +3332,8 @@ e1000_read_phy_reg(struct e1000_hw *hw, | |||
3160 | if (e1000_swfw_sync_acquire(hw, swfw)) | 3332 | if (e1000_swfw_sync_acquire(hw, swfw)) |
3161 | return -E1000_ERR_SWFW_SYNC; | 3333 | return -E1000_ERR_SWFW_SYNC; |
3162 | 3334 | ||
3163 | if((hw->phy_type == e1000_phy_igp || | 3335 | if ((hw->phy_type == e1000_phy_igp || |
3336 | hw->phy_type == e1000_phy_igp_3 || | ||
3164 | hw->phy_type == e1000_phy_igp_2) && | 3337 | hw->phy_type == e1000_phy_igp_2) && |
3165 | (reg_addr > MAX_PHY_MULTI_PAGE_REG)) { | 3338 | (reg_addr > MAX_PHY_MULTI_PAGE_REG)) { |
3166 | ret_val = e1000_write_phy_reg_ex(hw, IGP01E1000_PHY_PAGE_SELECT, | 3339 | ret_val = e1000_write_phy_reg_ex(hw, IGP01E1000_PHY_PAGE_SELECT, |
@@ -3299,7 +3472,8 @@ e1000_write_phy_reg(struct e1000_hw *hw, | |||
3299 | if (e1000_swfw_sync_acquire(hw, swfw)) | 3472 | if (e1000_swfw_sync_acquire(hw, swfw)) |
3300 | return -E1000_ERR_SWFW_SYNC; | 3473 | return -E1000_ERR_SWFW_SYNC; |
3301 | 3474 | ||
3302 | if((hw->phy_type == e1000_phy_igp || | 3475 | if ((hw->phy_type == e1000_phy_igp || |
3476 | hw->phy_type == e1000_phy_igp_3 || | ||
3303 | hw->phy_type == e1000_phy_igp_2) && | 3477 | hw->phy_type == e1000_phy_igp_2) && |
3304 | (reg_addr > MAX_PHY_MULTI_PAGE_REG)) { | 3478 | (reg_addr > MAX_PHY_MULTI_PAGE_REG)) { |
3305 | ret_val = e1000_write_phy_reg_ex(hw, IGP01E1000_PHY_PAGE_SELECT, | 3479 | ret_val = e1000_write_phy_reg_ex(hw, IGP01E1000_PHY_PAGE_SELECT, |
@@ -3514,7 +3688,7 @@ e1000_phy_hw_reset(struct e1000_hw *hw) | |||
3514 | E1000_WRITE_FLUSH(hw); | 3688 | E1000_WRITE_FLUSH(hw); |
3515 | 3689 | ||
3516 | if (hw->mac_type >= e1000_82571) | 3690 | if (hw->mac_type >= e1000_82571) |
3517 | msec_delay(10); | 3691 | msec_delay_irq(10); |
3518 | e1000_swfw_sync_release(hw, swfw); | 3692 | e1000_swfw_sync_release(hw, swfw); |
3519 | } else { | 3693 | } else { |
3520 | /* Read the Extended Device Control Register, assert the PHY_RESET_DIR | 3694 | /* Read the Extended Device Control Register, assert the PHY_RESET_DIR |
@@ -3544,6 +3718,12 @@ e1000_phy_hw_reset(struct e1000_hw *hw) | |||
3544 | ret_val = e1000_get_phy_cfg_done(hw); | 3718 | ret_val = e1000_get_phy_cfg_done(hw); |
3545 | e1000_release_software_semaphore(hw); | 3719 | e1000_release_software_semaphore(hw); |
3546 | 3720 | ||
3721 | if ((hw->mac_type == e1000_ich8lan) && | ||
3722 | (hw->phy_type == e1000_phy_igp_3)) { | ||
3723 | ret_val = e1000_init_lcd_from_nvm(hw); | ||
3724 | if (ret_val) | ||
3725 | return ret_val; | ||
3726 | } | ||
3547 | return ret_val; | 3727 | return ret_val; |
3548 | } | 3728 | } |
3549 | 3729 | ||
@@ -3572,9 +3752,11 @@ e1000_phy_reset(struct e1000_hw *hw) | |||
3572 | case e1000_82541_rev_2: | 3752 | case e1000_82541_rev_2: |
3573 | case e1000_82571: | 3753 | case e1000_82571: |
3574 | case e1000_82572: | 3754 | case e1000_82572: |
3755 | case e1000_ich8lan: | ||
3575 | ret_val = e1000_phy_hw_reset(hw); | 3756 | ret_val = e1000_phy_hw_reset(hw); |
3576 | if(ret_val) | 3757 | if(ret_val) |
3577 | return ret_val; | 3758 | return ret_val; |
3759 | |||
3578 | break; | 3760 | break; |
3579 | default: | 3761 | default: |
3580 | ret_val = e1000_read_phy_reg(hw, PHY_CTRL, &phy_data); | 3762 | ret_val = e1000_read_phy_reg(hw, PHY_CTRL, &phy_data); |
@@ -3597,11 +3779,120 @@ e1000_phy_reset(struct e1000_hw *hw) | |||
3597 | } | 3779 | } |
3598 | 3780 | ||
3599 | /****************************************************************************** | 3781 | /****************************************************************************** |
3782 | * Work-around for 82566 power-down: on D3 entry- | ||
3783 | * 1) disable gigabit link | ||
3784 | * 2) write VR power-down enable | ||
3785 | * 3) read it back | ||
3786 | * if successful continue, else issue LCD reset and repeat | ||
3787 | * | ||
3788 | * hw - struct containing variables accessed by shared code | ||
3789 | ******************************************************************************/ | ||
3790 | void | ||
3791 | e1000_phy_powerdown_workaround(struct e1000_hw *hw) | ||
3792 | { | ||
3793 | int32_t reg; | ||
3794 | uint16_t phy_data; | ||
3795 | int32_t retry = 0; | ||
3796 | |||
3797 | DEBUGFUNC("e1000_phy_powerdown_workaround"); | ||
3798 | |||
3799 | if (hw->phy_type != e1000_phy_igp_3) | ||
3800 | return; | ||
3801 | |||
3802 | do { | ||
3803 | /* Disable link */ | ||
3804 | reg = E1000_READ_REG(hw, PHY_CTRL); | ||
3805 | E1000_WRITE_REG(hw, PHY_CTRL, reg | E1000_PHY_CTRL_GBE_DISABLE | | ||
3806 | E1000_PHY_CTRL_NOND0A_GBE_DISABLE); | ||
3807 | |||
3808 | /* Write VR power-down enable */ | ||
3809 | e1000_read_phy_reg(hw, IGP3_VR_CTRL, &phy_data); | ||
3810 | e1000_write_phy_reg(hw, IGP3_VR_CTRL, phy_data | | ||
3811 | IGP3_VR_CTRL_MODE_SHUT); | ||
3812 | |||
3813 | /* Read it back and test */ | ||
3814 | e1000_read_phy_reg(hw, IGP3_VR_CTRL, &phy_data); | ||
3815 | if ((phy_data & IGP3_VR_CTRL_MODE_SHUT) || retry) | ||
3816 | break; | ||
3817 | |||
3818 | /* Issue PHY reset and repeat at most one more time */ | ||
3819 | reg = E1000_READ_REG(hw, CTRL); | ||
3820 | E1000_WRITE_REG(hw, CTRL, reg | E1000_CTRL_PHY_RST); | ||
3821 | retry++; | ||
3822 | } while (retry); | ||
3823 | |||
3824 | return; | ||
3825 | |||
3826 | } | ||
3827 | |||
3828 | /****************************************************************************** | ||
3829 | * Work-around for 82566 Kumeran PCS lock loss: | ||
3830 | * On link status change (i.e. PCI reset, speed change) and link is up and | ||
3831 | * speed is gigabit- | ||
3832 | * 0) if workaround is optionally disabled do nothing | ||
3833 | * 1) wait 1ms for Kumeran link to come up | ||
3834 | * 2) check Kumeran Diagnostic register PCS lock loss bit | ||
3835 | * 3) if not set the link is locked (all is good), otherwise... | ||
3836 | * 4) reset the PHY | ||
3837 | * 5) repeat up to 10 times | ||
3838 | * Note: this is only called for IGP3 copper when speed is 1gb. | ||
3839 | * | ||
3840 | * hw - struct containing variables accessed by shared code | ||
3841 | ******************************************************************************/ | ||
3842 | int32_t | ||
3843 | e1000_kumeran_lock_loss_workaround(struct e1000_hw *hw) | ||
3844 | { | ||
3845 | int32_t ret_val; | ||
3846 | int32_t reg; | ||
3847 | int32_t cnt; | ||
3848 | uint16_t phy_data; | ||
3849 | |||
3850 | if (hw->kmrn_lock_loss_workaround_disabled) | ||
3851 | return E1000_SUCCESS; | ||
3852 | |||
3853 | /* Make sure link is up before proceeding. If not just return. | ||
3854 | * Attempting this while link is negotiating fouls up link | ||
3855 | * stability */ | ||
3856 | ret_val = e1000_read_phy_reg(hw, PHY_STATUS, &phy_data); | ||
3857 | ret_val = e1000_read_phy_reg(hw, PHY_STATUS, &phy_data); | ||
3858 | |||
3859 | if (phy_data & MII_SR_LINK_STATUS) { | ||
3860 | for (cnt = 0; cnt < 10; cnt++) { | ||
3861 | /* read once to clear */ | ||
3862 | ret_val = e1000_read_phy_reg(hw, IGP3_KMRN_DIAG, &phy_data); | ||
3863 | if (ret_val) | ||
3864 | return ret_val; | ||
3865 | /* and again to get new status */ | ||
3866 | ret_val = e1000_read_phy_reg(hw, IGP3_KMRN_DIAG, &phy_data); | ||
3867 | if (ret_val) | ||
3868 | return ret_val; | ||
3869 | |||
3870 | /* check for PCS lock */ | ||
3871 | if (!(phy_data & IGP3_KMRN_DIAG_PCS_LOCK_LOSS)) | ||
3872 | return E1000_SUCCESS; | ||
3873 | |||
3874 | /* Issue PHY reset */ | ||
3875 | e1000_phy_hw_reset(hw); | ||
3876 | msec_delay_irq(5); | ||
3877 | } | ||
3878 | /* Disable GigE link negotiation */ | ||
3879 | reg = E1000_READ_REG(hw, PHY_CTRL); | ||
3880 | E1000_WRITE_REG(hw, PHY_CTRL, reg | E1000_PHY_CTRL_GBE_DISABLE | | ||
3881 | E1000_PHY_CTRL_NOND0A_GBE_DISABLE); | ||
3882 | |||
3883 | /* unable to acquire PCS lock */ | ||
3884 | return E1000_ERR_PHY; | ||
3885 | } | ||
3886 | |||
3887 | return E1000_SUCCESS; | ||
3888 | } | ||
3889 | |||
3890 | /****************************************************************************** | ||
3600 | * Probes the expected PHY address for known PHY IDs | 3891 | * Probes the expected PHY address for known PHY IDs |
3601 | * | 3892 | * |
3602 | * hw - Struct containing variables accessed by shared code | 3893 | * hw - Struct containing variables accessed by shared code |
3603 | ******************************************************************************/ | 3894 | ******************************************************************************/ |
3604 | static int32_t | 3895 | int32_t |
3605 | e1000_detect_gig_phy(struct e1000_hw *hw) | 3896 | e1000_detect_gig_phy(struct e1000_hw *hw) |
3606 | { | 3897 | { |
3607 | int32_t phy_init_status, ret_val; | 3898 | int32_t phy_init_status, ret_val; |
@@ -3613,8 +3904,8 @@ e1000_detect_gig_phy(struct e1000_hw *hw) | |||
3613 | /* The 82571 firmware may still be configuring the PHY. In this | 3904 | /* The 82571 firmware may still be configuring the PHY. In this |
3614 | * case, we cannot access the PHY until the configuration is done. So | 3905 | * case, we cannot access the PHY until the configuration is done. So |
3615 | * we explicitly set the PHY values. */ | 3906 | * we explicitly set the PHY values. */ |
3616 | if(hw->mac_type == e1000_82571 || | 3907 | if (hw->mac_type == e1000_82571 || |
3617 | hw->mac_type == e1000_82572) { | 3908 | hw->mac_type == e1000_82572) { |
3618 | hw->phy_id = IGP01E1000_I_PHY_ID; | 3909 | hw->phy_id = IGP01E1000_I_PHY_ID; |
3619 | hw->phy_type = e1000_phy_igp_2; | 3910 | hw->phy_type = e1000_phy_igp_2; |
3620 | return E1000_SUCCESS; | 3911 | return E1000_SUCCESS; |
@@ -3631,7 +3922,7 @@ e1000_detect_gig_phy(struct e1000_hw *hw) | |||
3631 | 3922 | ||
3632 | /* Read the PHY ID Registers to identify which PHY is onboard. */ | 3923 | /* Read the PHY ID Registers to identify which PHY is onboard. */ |
3633 | ret_val = e1000_read_phy_reg(hw, PHY_ID1, &phy_id_high); | 3924 | ret_val = e1000_read_phy_reg(hw, PHY_ID1, &phy_id_high); |
3634 | if(ret_val) | 3925 | if (ret_val) |
3635 | return ret_val; | 3926 | return ret_val; |
3636 | 3927 | ||
3637 | hw->phy_id = (uint32_t) (phy_id_high << 16); | 3928 | hw->phy_id = (uint32_t) (phy_id_high << 16); |
@@ -3669,6 +3960,12 @@ e1000_detect_gig_phy(struct e1000_hw *hw) | |||
3669 | case e1000_80003es2lan: | 3960 | case e1000_80003es2lan: |
3670 | if (hw->phy_id == GG82563_E_PHY_ID) match = TRUE; | 3961 | if (hw->phy_id == GG82563_E_PHY_ID) match = TRUE; |
3671 | break; | 3962 | break; |
3963 | case e1000_ich8lan: | ||
3964 | if (hw->phy_id == IGP03E1000_E_PHY_ID) match = TRUE; | ||
3965 | if (hw->phy_id == IFE_E_PHY_ID) match = TRUE; | ||
3966 | if (hw->phy_id == IFE_PLUS_E_PHY_ID) match = TRUE; | ||
3967 | if (hw->phy_id == IFE_C_E_PHY_ID) match = TRUE; | ||
3968 | break; | ||
3672 | default: | 3969 | default: |
3673 | DEBUGOUT1("Invalid MAC type %d\n", hw->mac_type); | 3970 | DEBUGOUT1("Invalid MAC type %d\n", hw->mac_type); |
3674 | return -E1000_ERR_CONFIG; | 3971 | return -E1000_ERR_CONFIG; |
@@ -3784,6 +4081,53 @@ e1000_phy_igp_get_info(struct e1000_hw *hw, | |||
3784 | } | 4081 | } |
3785 | 4082 | ||
3786 | /****************************************************************************** | 4083 | /****************************************************************************** |
4084 | * Get PHY information from various PHY registers for ife PHY only. | ||
4085 | * | ||
4086 | * hw - Struct containing variables accessed by shared code | ||
4087 | * phy_info - PHY information structure | ||
4088 | ******************************************************************************/ | ||
4089 | int32_t | ||
4090 | e1000_phy_ife_get_info(struct e1000_hw *hw, | ||
4091 | struct e1000_phy_info *phy_info) | ||
4092 | { | ||
4093 | int32_t ret_val; | ||
4094 | uint16_t phy_data, polarity; | ||
4095 | |||
4096 | DEBUGFUNC("e1000_phy_ife_get_info"); | ||
4097 | |||
4098 | phy_info->downshift = (e1000_downshift)hw->speed_downgraded; | ||
4099 | phy_info->extended_10bt_distance = e1000_10bt_ext_dist_enable_normal; | ||
4100 | |||
4101 | ret_val = e1000_read_phy_reg(hw, IFE_PHY_SPECIAL_CONTROL, &phy_data); | ||
4102 | if (ret_val) | ||
4103 | return ret_val; | ||
4104 | phy_info->polarity_correction = | ||
4105 | (phy_data & IFE_PSC_AUTO_POLARITY_DISABLE) >> | ||
4106 | IFE_PSC_AUTO_POLARITY_DISABLE_SHIFT; | ||
4107 | |||
4108 | if (phy_info->polarity_correction == e1000_polarity_reversal_enabled) { | ||
4109 | ret_val = e1000_check_polarity(hw, &polarity); | ||
4110 | if (ret_val) | ||
4111 | return ret_val; | ||
4112 | } else { | ||
4113 | /* Polarity is forced. */ | ||
4114 | polarity = (phy_data & IFE_PSC_FORCE_POLARITY) >> | ||
4115 | IFE_PSC_FORCE_POLARITY_SHIFT; | ||
4116 | } | ||
4117 | phy_info->cable_polarity = polarity; | ||
4118 | |||
4119 | ret_val = e1000_read_phy_reg(hw, IFE_PHY_MDIX_CONTROL, &phy_data); | ||
4120 | if (ret_val) | ||
4121 | return ret_val; | ||
4122 | |||
4123 | phy_info->mdix_mode = | ||
4124 | (phy_data & (IFE_PMC_AUTO_MDIX | IFE_PMC_FORCE_MDIX)) >> | ||
4125 | IFE_PMC_MDIX_MODE_SHIFT; | ||
4126 | |||
4127 | return E1000_SUCCESS; | ||
4128 | } | ||
4129 | |||
4130 | /****************************************************************************** | ||
3787 | * Get PHY information from various PHY registers fot m88 PHY only. | 4131 | * Get PHY information from various PHY registers fot m88 PHY only. |
3788 | * | 4132 | * |
3789 | * hw - Struct containing variables accessed by shared code | 4133 | * hw - Struct containing variables accessed by shared code |
@@ -3898,9 +4242,12 @@ e1000_phy_get_info(struct e1000_hw *hw, | |||
3898 | return -E1000_ERR_CONFIG; | 4242 | return -E1000_ERR_CONFIG; |
3899 | } | 4243 | } |
3900 | 4244 | ||
3901 | if(hw->phy_type == e1000_phy_igp || | 4245 | if (hw->phy_type == e1000_phy_igp || |
4246 | hw->phy_type == e1000_phy_igp_3 || | ||
3902 | hw->phy_type == e1000_phy_igp_2) | 4247 | hw->phy_type == e1000_phy_igp_2) |
3903 | return e1000_phy_igp_get_info(hw, phy_info); | 4248 | return e1000_phy_igp_get_info(hw, phy_info); |
4249 | else if (hw->phy_type == e1000_phy_ife) | ||
4250 | return e1000_phy_ife_get_info(hw, phy_info); | ||
3904 | else | 4251 | else |
3905 | return e1000_phy_m88_get_info(hw, phy_info); | 4252 | return e1000_phy_m88_get_info(hw, phy_info); |
3906 | } | 4253 | } |
@@ -4049,6 +4396,35 @@ e1000_init_eeprom_params(struct e1000_hw *hw) | |||
4049 | eeprom->use_eerd = TRUE; | 4396 | eeprom->use_eerd = TRUE; |
4050 | eeprom->use_eewr = FALSE; | 4397 | eeprom->use_eewr = FALSE; |
4051 | break; | 4398 | break; |
4399 | case e1000_ich8lan: | ||
4400 | { | ||
4401 | int32_t i = 0; | ||
4402 | uint32_t flash_size = E1000_READ_ICH8_REG(hw, ICH8_FLASH_GFPREG); | ||
4403 | |||
4404 | eeprom->type = e1000_eeprom_ich8; | ||
4405 | eeprom->use_eerd = FALSE; | ||
4406 | eeprom->use_eewr = FALSE; | ||
4407 | eeprom->word_size = E1000_SHADOW_RAM_WORDS; | ||
4408 | |||
4409 | /* Zero the shadow RAM structure. But don't load it from NVM | ||
4410 | * so as to save time for driver init */ | ||
4411 | if (hw->eeprom_shadow_ram != NULL) { | ||
4412 | for (i = 0; i < E1000_SHADOW_RAM_WORDS; i++) { | ||
4413 | hw->eeprom_shadow_ram[i].modified = FALSE; | ||
4414 | hw->eeprom_shadow_ram[i].eeprom_word = 0xFFFF; | ||
4415 | } | ||
4416 | } | ||
4417 | |||
4418 | hw->flash_base_addr = (flash_size & ICH8_GFPREG_BASE_MASK) * | ||
4419 | ICH8_FLASH_SECTOR_SIZE; | ||
4420 | |||
4421 | hw->flash_bank_size = ((flash_size >> 16) & ICH8_GFPREG_BASE_MASK) + 1; | ||
4422 | hw->flash_bank_size -= (flash_size & ICH8_GFPREG_BASE_MASK); | ||
4423 | hw->flash_bank_size *= ICH8_FLASH_SECTOR_SIZE; | ||
4424 | hw->flash_bank_size /= 2 * sizeof(uint16_t); | ||
4425 | |||
4426 | break; | ||
4427 | } | ||
4052 | default: | 4428 | default: |
4053 | break; | 4429 | break; |
4054 | } | 4430 | } |
@@ -4469,7 +4845,10 @@ e1000_read_eeprom(struct e1000_hw *hw, | |||
4469 | return ret_val; | 4845 | return ret_val; |
4470 | } | 4846 | } |
4471 | 4847 | ||
4472 | if(eeprom->type == e1000_eeprom_spi) { | 4848 | if (eeprom->type == e1000_eeprom_ich8) |
4849 | return e1000_read_eeprom_ich8(hw, offset, words, data); | ||
4850 | |||
4851 | if (eeprom->type == e1000_eeprom_spi) { | ||
4473 | uint16_t word_in; | 4852 | uint16_t word_in; |
4474 | uint8_t read_opcode = EEPROM_READ_OPCODE_SPI; | 4853 | uint8_t read_opcode = EEPROM_READ_OPCODE_SPI; |
4475 | 4854 | ||
@@ -4636,7 +5015,10 @@ e1000_is_onboard_nvm_eeprom(struct e1000_hw *hw) | |||
4636 | 5015 | ||
4637 | DEBUGFUNC("e1000_is_onboard_nvm_eeprom"); | 5016 | DEBUGFUNC("e1000_is_onboard_nvm_eeprom"); |
4638 | 5017 | ||
4639 | if(hw->mac_type == e1000_82573) { | 5018 | if (hw->mac_type == e1000_ich8lan) |
5019 | return FALSE; | ||
5020 | |||
5021 | if (hw->mac_type == e1000_82573) { | ||
4640 | eecd = E1000_READ_REG(hw, EECD); | 5022 | eecd = E1000_READ_REG(hw, EECD); |
4641 | 5023 | ||
4642 | /* Isolate bits 15 & 16 */ | 5024 | /* Isolate bits 15 & 16 */ |
@@ -4686,8 +5068,22 @@ e1000_validate_eeprom_checksum(struct e1000_hw *hw) | |||
4686 | } | 5068 | } |
4687 | } | 5069 | } |
4688 | 5070 | ||
4689 | for(i = 0; i < (EEPROM_CHECKSUM_REG + 1); i++) { | 5071 | if (hw->mac_type == e1000_ich8lan) { |
4690 | if(e1000_read_eeprom(hw, i, 1, &eeprom_data) < 0) { | 5072 | /* Drivers must allocate the shadow ram structure for the |
5073 | * EEPROM checksum to be updated. Otherwise, this bit as well | ||
5074 | * as the checksum must both be set correctly for this | ||
5075 | * validation to pass. | ||
5076 | */ | ||
5077 | e1000_read_eeprom(hw, 0x19, 1, &eeprom_data); | ||
5078 | if ((eeprom_data & 0x40) == 0) { | ||
5079 | eeprom_data |= 0x40; | ||
5080 | e1000_write_eeprom(hw, 0x19, 1, &eeprom_data); | ||
5081 | e1000_update_eeprom_checksum(hw); | ||
5082 | } | ||
5083 | } | ||
5084 | |||
5085 | for (i = 0; i < (EEPROM_CHECKSUM_REG + 1); i++) { | ||
5086 | if (e1000_read_eeprom(hw, i, 1, &eeprom_data) < 0) { | ||
4691 | DEBUGOUT("EEPROM Read Error\n"); | 5087 | DEBUGOUT("EEPROM Read Error\n"); |
4692 | return -E1000_ERR_EEPROM; | 5088 | return -E1000_ERR_EEPROM; |
4693 | } | 5089 | } |
@@ -4713,6 +5109,7 @@ e1000_validate_eeprom_checksum(struct e1000_hw *hw) | |||
4713 | int32_t | 5109 | int32_t |
4714 | e1000_update_eeprom_checksum(struct e1000_hw *hw) | 5110 | e1000_update_eeprom_checksum(struct e1000_hw *hw) |
4715 | { | 5111 | { |
5112 | uint32_t ctrl_ext; | ||
4716 | uint16_t checksum = 0; | 5113 | uint16_t checksum = 0; |
4717 | uint16_t i, eeprom_data; | 5114 | uint16_t i, eeprom_data; |
4718 | 5115 | ||
@@ -4731,6 +5128,14 @@ e1000_update_eeprom_checksum(struct e1000_hw *hw) | |||
4731 | return -E1000_ERR_EEPROM; | 5128 | return -E1000_ERR_EEPROM; |
4732 | } else if (hw->eeprom.type == e1000_eeprom_flash) { | 5129 | } else if (hw->eeprom.type == e1000_eeprom_flash) { |
4733 | e1000_commit_shadow_ram(hw); | 5130 | e1000_commit_shadow_ram(hw); |
5131 | } else if (hw->eeprom.type == e1000_eeprom_ich8) { | ||
5132 | e1000_commit_shadow_ram(hw); | ||
5133 | /* Reload the EEPROM, or else modifications will not appear | ||
5134 | * until after next adapter reset. */ | ||
5135 | ctrl_ext = E1000_READ_REG(hw, CTRL_EXT); | ||
5136 | ctrl_ext |= E1000_CTRL_EXT_EE_RST; | ||
5137 | E1000_WRITE_REG(hw, CTRL_EXT, ctrl_ext); | ||
5138 | msec_delay(10); | ||
4734 | } | 5139 | } |
4735 | return E1000_SUCCESS; | 5140 | return E1000_SUCCESS; |
4736 | } | 5141 | } |
@@ -4770,6 +5175,9 @@ e1000_write_eeprom(struct e1000_hw *hw, | |||
4770 | if(eeprom->use_eewr == TRUE) | 5175 | if(eeprom->use_eewr == TRUE) |
4771 | return e1000_write_eeprom_eewr(hw, offset, words, data); | 5176 | return e1000_write_eeprom_eewr(hw, offset, words, data); |
4772 | 5177 | ||
5178 | if (eeprom->type == e1000_eeprom_ich8) | ||
5179 | return e1000_write_eeprom_ich8(hw, offset, words, data); | ||
5180 | |||
4773 | /* Prepare the EEPROM for writing */ | 5181 | /* Prepare the EEPROM for writing */ |
4774 | if (e1000_acquire_eeprom(hw) != E1000_SUCCESS) | 5182 | if (e1000_acquire_eeprom(hw) != E1000_SUCCESS) |
4775 | return -E1000_ERR_EEPROM; | 5183 | return -E1000_ERR_EEPROM; |
@@ -4957,11 +5365,17 @@ e1000_commit_shadow_ram(struct e1000_hw *hw) | |||
4957 | uint32_t flop = 0; | 5365 | uint32_t flop = 0; |
4958 | uint32_t i = 0; | 5366 | uint32_t i = 0; |
4959 | int32_t error = E1000_SUCCESS; | 5367 | int32_t error = E1000_SUCCESS; |
4960 | 5368 | uint32_t old_bank_offset = 0; | |
4961 | /* The flop register will be used to determine if flash type is STM */ | 5369 | uint32_t new_bank_offset = 0; |
4962 | flop = E1000_READ_REG(hw, FLOP); | 5370 | uint32_t sector_retries = 0; |
5371 | uint8_t low_byte = 0; | ||
5372 | uint8_t high_byte = 0; | ||
5373 | uint8_t temp_byte = 0; | ||
5374 | boolean_t sector_write_failed = FALSE; | ||
4963 | 5375 | ||
4964 | if (hw->mac_type == e1000_82573) { | 5376 | if (hw->mac_type == e1000_82573) { |
5377 | /* The flop register will be used to determine if flash type is STM */ | ||
5378 | flop = E1000_READ_REG(hw, FLOP); | ||
4965 | for (i=0; i < attempts; i++) { | 5379 | for (i=0; i < attempts; i++) { |
4966 | eecd = E1000_READ_REG(hw, EECD); | 5380 | eecd = E1000_READ_REG(hw, EECD); |
4967 | if ((eecd & E1000_EECD_FLUPD) == 0) { | 5381 | if ((eecd & E1000_EECD_FLUPD) == 0) { |
@@ -4995,6 +5409,106 @@ e1000_commit_shadow_ram(struct e1000_hw *hw) | |||
4995 | } | 5409 | } |
4996 | } | 5410 | } |
4997 | 5411 | ||
5412 | if (hw->mac_type == e1000_ich8lan && hw->eeprom_shadow_ram != NULL) { | ||
5413 | /* We're writing to the opposite bank so if we're on bank 1, | ||
5414 | * write to bank 0 etc. We also need to erase the segment that | ||
5415 | * is going to be written */ | ||
5416 | if (!(E1000_READ_REG(hw, EECD) & E1000_EECD_SEC1VAL)) { | ||
5417 | new_bank_offset = hw->flash_bank_size * 2; | ||
5418 | old_bank_offset = 0; | ||
5419 | e1000_erase_ich8_4k_segment(hw, 1); | ||
5420 | } else { | ||
5421 | old_bank_offset = hw->flash_bank_size * 2; | ||
5422 | new_bank_offset = 0; | ||
5423 | e1000_erase_ich8_4k_segment(hw, 0); | ||
5424 | } | ||
5425 | |||
5426 | do { | ||
5427 | sector_write_failed = FALSE; | ||
5428 | /* Loop for every byte in the shadow RAM, | ||
5429 | * which is in units of words. */ | ||
5430 | for (i = 0; i < E1000_SHADOW_RAM_WORDS; i++) { | ||
5431 | /* Determine whether to write the value stored | ||
5432 | * in the other NVM bank or a modified value stored | ||
5433 | * in the shadow RAM */ | ||
5434 | if (hw->eeprom_shadow_ram[i].modified == TRUE) { | ||
5435 | low_byte = (uint8_t)hw->eeprom_shadow_ram[i].eeprom_word; | ||
5436 | e1000_read_ich8_byte(hw, (i << 1) + old_bank_offset, | ||
5437 | &temp_byte); | ||
5438 | udelay(100); | ||
5439 | error = e1000_verify_write_ich8_byte(hw, | ||
5440 | (i << 1) + new_bank_offset, | ||
5441 | low_byte); | ||
5442 | if (error != E1000_SUCCESS) | ||
5443 | sector_write_failed = TRUE; | ||
5444 | high_byte = | ||
5445 | (uint8_t)(hw->eeprom_shadow_ram[i].eeprom_word >> 8); | ||
5446 | e1000_read_ich8_byte(hw, (i << 1) + old_bank_offset + 1, | ||
5447 | &temp_byte); | ||
5448 | udelay(100); | ||
5449 | } else { | ||
5450 | e1000_read_ich8_byte(hw, (i << 1) + old_bank_offset, | ||
5451 | &low_byte); | ||
5452 | udelay(100); | ||
5453 | error = e1000_verify_write_ich8_byte(hw, | ||
5454 | (i << 1) + new_bank_offset, low_byte); | ||
5455 | if (error != E1000_SUCCESS) | ||
5456 | sector_write_failed = TRUE; | ||
5457 | e1000_read_ich8_byte(hw, (i << 1) + old_bank_offset + 1, | ||
5458 | &high_byte); | ||
5459 | } | ||
5460 | |||
5461 | /* If the word is 0x13, then make sure the signature bits | ||
5462 | * (15:14) are 11b until the commit has completed. | ||
5463 | * This will allow us to write 10b which indicates the | ||
5464 | * signature is valid. We want to do this after the write | ||
5465 | * has completed so that we don't mark the segment valid | ||
5466 | * while the write is still in progress */ | ||
5467 | if (i == E1000_ICH8_NVM_SIG_WORD) | ||
5468 | high_byte = E1000_ICH8_NVM_SIG_MASK | high_byte; | ||
5469 | |||
5470 | error = e1000_verify_write_ich8_byte(hw, | ||
5471 | (i << 1) + new_bank_offset + 1, high_byte); | ||
5472 | if (error != E1000_SUCCESS) | ||
5473 | sector_write_failed = TRUE; | ||
5474 | |||
5475 | if (sector_write_failed == FALSE) { | ||
5476 | /* Clear the now not used entry in the cache */ | ||
5477 | hw->eeprom_shadow_ram[i].modified = FALSE; | ||
5478 | hw->eeprom_shadow_ram[i].eeprom_word = 0xFFFF; | ||
5479 | } | ||
5480 | } | ||
5481 | |||
5482 | /* Don't bother writing the segment valid bits if sector | ||
5483 | * programming failed. */ | ||
5484 | if (sector_write_failed == FALSE) { | ||
5485 | /* Finally validate the new segment by setting bit 15:14 | ||
5486 | * to 10b in word 0x13 , this can be done without an | ||
5487 | * erase as well since these bits are 11 to start with | ||
5488 | * and we need to change bit 14 to 0b */ | ||
5489 | e1000_read_ich8_byte(hw, | ||
5490 | E1000_ICH8_NVM_SIG_WORD * 2 + 1 + new_bank_offset, | ||
5491 | &high_byte); | ||
5492 | high_byte &= 0xBF; | ||
5493 | error = e1000_verify_write_ich8_byte(hw, | ||
5494 | E1000_ICH8_NVM_SIG_WORD * 2 + 1 + new_bank_offset, | ||
5495 | high_byte); | ||
5496 | if (error != E1000_SUCCESS) | ||
5497 | sector_write_failed = TRUE; | ||
5498 | |||
5499 | /* And invalidate the previously valid segment by setting | ||
5500 | * its signature word (0x13) high_byte to 0b. This can be | ||
5501 | * done without an erase because flash erase sets all bits | ||
5502 | * to 1's. We can write 1's to 0's without an erase */ | ||
5503 | error = e1000_verify_write_ich8_byte(hw, | ||
5504 | E1000_ICH8_NVM_SIG_WORD * 2 + 1 + old_bank_offset, | ||
5505 | 0); | ||
5506 | if (error != E1000_SUCCESS) | ||
5507 | sector_write_failed = TRUE; | ||
5508 | } | ||
5509 | } while (++sector_retries < 10 && sector_write_failed == TRUE); | ||
5510 | } | ||
5511 | |||
4998 | return error; | 5512 | return error; |
4999 | } | 5513 | } |
5000 | 5514 | ||
@@ -5102,15 +5616,19 @@ e1000_init_rx_addrs(struct e1000_hw *hw) | |||
5102 | * the other port. */ | 5616 | * the other port. */ |
5103 | if ((hw->mac_type == e1000_82571) && (hw->laa_is_present == TRUE)) | 5617 | if ((hw->mac_type == e1000_82571) && (hw->laa_is_present == TRUE)) |
5104 | rar_num -= 1; | 5618 | rar_num -= 1; |
5619 | if (hw->mac_type == e1000_ich8lan) | ||
5620 | rar_num = E1000_RAR_ENTRIES_ICH8LAN; | ||
5621 | |||
5105 | /* Zero out the other 15 receive addresses. */ | 5622 | /* Zero out the other 15 receive addresses. */ |
5106 | DEBUGOUT("Clearing RAR[1-15]\n"); | 5623 | DEBUGOUT("Clearing RAR[1-15]\n"); |
5107 | for(i = 1; i < rar_num; i++) { | 5624 | for(i = 1; i < rar_num; i++) { |
5108 | E1000_WRITE_REG_ARRAY(hw, RA, (i << 1), 0); | 5625 | E1000_WRITE_REG_ARRAY(hw, RA, (i << 1), 0); |
5626 | E1000_WRITE_FLUSH(hw); | ||
5109 | E1000_WRITE_REG_ARRAY(hw, RA, ((i << 1) + 1), 0); | 5627 | E1000_WRITE_REG_ARRAY(hw, RA, ((i << 1) + 1), 0); |
5628 | E1000_WRITE_FLUSH(hw); | ||
5110 | } | 5629 | } |
5111 | } | 5630 | } |
5112 | 5631 | ||
5113 | #if 0 | ||
5114 | /****************************************************************************** | 5632 | /****************************************************************************** |
5115 | * Updates the MAC's list of multicast addresses. | 5633 | * Updates the MAC's list of multicast addresses. |
5116 | * | 5634 | * |
@@ -5145,6 +5663,8 @@ e1000_mc_addr_list_update(struct e1000_hw *hw, | |||
5145 | /* Clear RAR[1-15] */ | 5663 | /* Clear RAR[1-15] */ |
5146 | DEBUGOUT(" Clearing RAR[1-15]\n"); | 5664 | DEBUGOUT(" Clearing RAR[1-15]\n"); |
5147 | num_rar_entry = E1000_RAR_ENTRIES; | 5665 | num_rar_entry = E1000_RAR_ENTRIES; |
5666 | if (hw->mac_type == e1000_ich8lan) | ||
5667 | num_rar_entry = E1000_RAR_ENTRIES_ICH8LAN; | ||
5148 | /* Reserve a spot for the Locally Administered Address to work around | 5668 | /* Reserve a spot for the Locally Administered Address to work around |
5149 | * an 82571 issue in which a reset on one port will reload the MAC on | 5669 | * an 82571 issue in which a reset on one port will reload the MAC on |
5150 | * the other port. */ | 5670 | * the other port. */ |
@@ -5153,14 +5673,19 @@ e1000_mc_addr_list_update(struct e1000_hw *hw, | |||
5153 | 5673 | ||
5154 | for(i = rar_used_count; i < num_rar_entry; i++) { | 5674 | for(i = rar_used_count; i < num_rar_entry; i++) { |
5155 | E1000_WRITE_REG_ARRAY(hw, RA, (i << 1), 0); | 5675 | E1000_WRITE_REG_ARRAY(hw, RA, (i << 1), 0); |
5676 | E1000_WRITE_FLUSH(hw); | ||
5156 | E1000_WRITE_REG_ARRAY(hw, RA, ((i << 1) + 1), 0); | 5677 | E1000_WRITE_REG_ARRAY(hw, RA, ((i << 1) + 1), 0); |
5678 | E1000_WRITE_FLUSH(hw); | ||
5157 | } | 5679 | } |
5158 | 5680 | ||
5159 | /* Clear the MTA */ | 5681 | /* Clear the MTA */ |
5160 | DEBUGOUT(" Clearing MTA\n"); | 5682 | DEBUGOUT(" Clearing MTA\n"); |
5161 | num_mta_entry = E1000_NUM_MTA_REGISTERS; | 5683 | num_mta_entry = E1000_NUM_MTA_REGISTERS; |
5684 | if (hw->mac_type == e1000_ich8lan) | ||
5685 | num_mta_entry = E1000_NUM_MTA_REGISTERS_ICH8LAN; | ||
5162 | for(i = 0; i < num_mta_entry; i++) { | 5686 | for(i = 0; i < num_mta_entry; i++) { |
5163 | E1000_WRITE_REG_ARRAY(hw, MTA, i, 0); | 5687 | E1000_WRITE_REG_ARRAY(hw, MTA, i, 0); |
5688 | E1000_WRITE_FLUSH(hw); | ||
5164 | } | 5689 | } |
5165 | 5690 | ||
5166 | /* Add the new addresses */ | 5691 | /* Add the new addresses */ |
@@ -5194,7 +5719,6 @@ e1000_mc_addr_list_update(struct e1000_hw *hw, | |||
5194 | } | 5719 | } |
5195 | DEBUGOUT("MC Update Complete\n"); | 5720 | DEBUGOUT("MC Update Complete\n"); |
5196 | } | 5721 | } |
5197 | #endif /* 0 */ | ||
5198 | 5722 | ||
5199 | /****************************************************************************** | 5723 | /****************************************************************************** |
5200 | * Hashes an address to determine its location in the multicast table | 5724 | * Hashes an address to determine its location in the multicast table |
@@ -5217,24 +5741,46 @@ e1000_hash_mc_addr(struct e1000_hw *hw, | |||
5217 | * LSB MSB | 5741 | * LSB MSB |
5218 | */ | 5742 | */ |
5219 | case 0: | 5743 | case 0: |
5220 | /* [47:36] i.e. 0x563 for above example address */ | 5744 | if (hw->mac_type == e1000_ich8lan) { |
5221 | hash_value = ((mc_addr[4] >> 4) | (((uint16_t) mc_addr[5]) << 4)); | 5745 | /* [47:38] i.e. 0x158 for above example address */ |
5746 | hash_value = ((mc_addr[4] >> 6) | (((uint16_t) mc_addr[5]) << 2)); | ||
5747 | } else { | ||
5748 | /* [47:36] i.e. 0x563 for above example address */ | ||
5749 | hash_value = ((mc_addr[4] >> 4) | (((uint16_t) mc_addr[5]) << 4)); | ||
5750 | } | ||
5222 | break; | 5751 | break; |
5223 | case 1: | 5752 | case 1: |
5224 | /* [46:35] i.e. 0xAC6 for above example address */ | 5753 | if (hw->mac_type == e1000_ich8lan) { |
5225 | hash_value = ((mc_addr[4] >> 3) | (((uint16_t) mc_addr[5]) << 5)); | 5754 | /* [46:37] i.e. 0x2B1 for above example address */ |
5755 | hash_value = ((mc_addr[4] >> 5) | (((uint16_t) mc_addr[5]) << 3)); | ||
5756 | } else { | ||
5757 | /* [46:35] i.e. 0xAC6 for above example address */ | ||
5758 | hash_value = ((mc_addr[4] >> 3) | (((uint16_t) mc_addr[5]) << 5)); | ||
5759 | } | ||
5226 | break; | 5760 | break; |
5227 | case 2: | 5761 | case 2: |
5228 | /* [45:34] i.e. 0x5D8 for above example address */ | 5762 | if (hw->mac_type == e1000_ich8lan) { |
5229 | hash_value = ((mc_addr[4] >> 2) | (((uint16_t) mc_addr[5]) << 6)); | 5763 | /*[45:36] i.e. 0x163 for above example address */ |
5764 | hash_value = ((mc_addr[4] >> 4) | (((uint16_t) mc_addr[5]) << 4)); | ||
5765 | } else { | ||
5766 | /* [45:34] i.e. 0x5D8 for above example address */ | ||
5767 | hash_value = ((mc_addr[4] >> 2) | (((uint16_t) mc_addr[5]) << 6)); | ||
5768 | } | ||
5230 | break; | 5769 | break; |
5231 | case 3: | 5770 | case 3: |
5232 | /* [43:32] i.e. 0x634 for above example address */ | 5771 | if (hw->mac_type == e1000_ich8lan) { |
5233 | hash_value = ((mc_addr[4]) | (((uint16_t) mc_addr[5]) << 8)); | 5772 | /* [43:34] i.e. 0x18D for above example address */ |
5773 | hash_value = ((mc_addr[4] >> 2) | (((uint16_t) mc_addr[5]) << 6)); | ||
5774 | } else { | ||
5775 | /* [43:32] i.e. 0x634 for above example address */ | ||
5776 | hash_value = ((mc_addr[4]) | (((uint16_t) mc_addr[5]) << 8)); | ||
5777 | } | ||
5234 | break; | 5778 | break; |
5235 | } | 5779 | } |
5236 | 5780 | ||
5237 | hash_value &= 0xFFF; | 5781 | hash_value &= 0xFFF; |
5782 | if (hw->mac_type == e1000_ich8lan) | ||
5783 | hash_value &= 0x3FF; | ||
5238 | 5784 | ||
5239 | return hash_value; | 5785 | return hash_value; |
5240 | } | 5786 | } |
@@ -5262,6 +5808,8 @@ e1000_mta_set(struct e1000_hw *hw, | |||
5262 | * register are determined by the lower 5 bits of the value. | 5808 | * register are determined by the lower 5 bits of the value. |
5263 | */ | 5809 | */ |
5264 | hash_reg = (hash_value >> 5) & 0x7F; | 5810 | hash_reg = (hash_value >> 5) & 0x7F; |
5811 | if (hw->mac_type == e1000_ich8lan) | ||
5812 | hash_reg &= 0x1F; | ||
5265 | hash_bit = hash_value & 0x1F; | 5813 | hash_bit = hash_value & 0x1F; |
5266 | 5814 | ||
5267 | mta = E1000_READ_REG_ARRAY(hw, MTA, hash_reg); | 5815 | mta = E1000_READ_REG_ARRAY(hw, MTA, hash_reg); |
@@ -5275,9 +5823,12 @@ e1000_mta_set(struct e1000_hw *hw, | |||
5275 | if((hw->mac_type == e1000_82544) && ((hash_reg & 0x1) == 1)) { | 5823 | if((hw->mac_type == e1000_82544) && ((hash_reg & 0x1) == 1)) { |
5276 | temp = E1000_READ_REG_ARRAY(hw, MTA, (hash_reg - 1)); | 5824 | temp = E1000_READ_REG_ARRAY(hw, MTA, (hash_reg - 1)); |
5277 | E1000_WRITE_REG_ARRAY(hw, MTA, hash_reg, mta); | 5825 | E1000_WRITE_REG_ARRAY(hw, MTA, hash_reg, mta); |
5826 | E1000_WRITE_FLUSH(hw); | ||
5278 | E1000_WRITE_REG_ARRAY(hw, MTA, (hash_reg - 1), temp); | 5827 | E1000_WRITE_REG_ARRAY(hw, MTA, (hash_reg - 1), temp); |
5828 | E1000_WRITE_FLUSH(hw); | ||
5279 | } else { | 5829 | } else { |
5280 | E1000_WRITE_REG_ARRAY(hw, MTA, hash_reg, mta); | 5830 | E1000_WRITE_REG_ARRAY(hw, MTA, hash_reg, mta); |
5831 | E1000_WRITE_FLUSH(hw); | ||
5281 | } | 5832 | } |
5282 | } | 5833 | } |
5283 | 5834 | ||
@@ -5334,7 +5885,9 @@ e1000_rar_set(struct e1000_hw *hw, | |||
5334 | } | 5885 | } |
5335 | 5886 | ||
5336 | E1000_WRITE_REG_ARRAY(hw, RA, (index << 1), rar_low); | 5887 | E1000_WRITE_REG_ARRAY(hw, RA, (index << 1), rar_low); |
5888 | E1000_WRITE_FLUSH(hw); | ||
5337 | E1000_WRITE_REG_ARRAY(hw, RA, ((index << 1) + 1), rar_high); | 5889 | E1000_WRITE_REG_ARRAY(hw, RA, ((index << 1) + 1), rar_high); |
5890 | E1000_WRITE_FLUSH(hw); | ||
5338 | } | 5891 | } |
5339 | 5892 | ||
5340 | /****************************************************************************** | 5893 | /****************************************************************************** |
@@ -5351,12 +5904,18 @@ e1000_write_vfta(struct e1000_hw *hw, | |||
5351 | { | 5904 | { |
5352 | uint32_t temp; | 5905 | uint32_t temp; |
5353 | 5906 | ||
5354 | if((hw->mac_type == e1000_82544) && ((offset & 0x1) == 1)) { | 5907 | if (hw->mac_type == e1000_ich8lan) |
5908 | return; | ||
5909 | |||
5910 | if ((hw->mac_type == e1000_82544) && ((offset & 0x1) == 1)) { | ||
5355 | temp = E1000_READ_REG_ARRAY(hw, VFTA, (offset - 1)); | 5911 | temp = E1000_READ_REG_ARRAY(hw, VFTA, (offset - 1)); |
5356 | E1000_WRITE_REG_ARRAY(hw, VFTA, offset, value); | 5912 | E1000_WRITE_REG_ARRAY(hw, VFTA, offset, value); |
5913 | E1000_WRITE_FLUSH(hw); | ||
5357 | E1000_WRITE_REG_ARRAY(hw, VFTA, (offset - 1), temp); | 5914 | E1000_WRITE_REG_ARRAY(hw, VFTA, (offset - 1), temp); |
5915 | E1000_WRITE_FLUSH(hw); | ||
5358 | } else { | 5916 | } else { |
5359 | E1000_WRITE_REG_ARRAY(hw, VFTA, offset, value); | 5917 | E1000_WRITE_REG_ARRAY(hw, VFTA, offset, value); |
5918 | E1000_WRITE_FLUSH(hw); | ||
5360 | } | 5919 | } |
5361 | } | 5920 | } |
5362 | 5921 | ||
@@ -5373,6 +5932,9 @@ e1000_clear_vfta(struct e1000_hw *hw) | |||
5373 | uint32_t vfta_offset = 0; | 5932 | uint32_t vfta_offset = 0; |
5374 | uint32_t vfta_bit_in_reg = 0; | 5933 | uint32_t vfta_bit_in_reg = 0; |
5375 | 5934 | ||
5935 | if (hw->mac_type == e1000_ich8lan) | ||
5936 | return; | ||
5937 | |||
5376 | if (hw->mac_type == e1000_82573) { | 5938 | if (hw->mac_type == e1000_82573) { |
5377 | if (hw->mng_cookie.vlan_id != 0) { | 5939 | if (hw->mng_cookie.vlan_id != 0) { |
5378 | /* The VFTA is a 4096b bit-field, each identifying a single VLAN | 5940 | /* The VFTA is a 4096b bit-field, each identifying a single VLAN |
@@ -5392,6 +5954,7 @@ e1000_clear_vfta(struct e1000_hw *hw) | |||
5392 | * manageability unit */ | 5954 | * manageability unit */ |
5393 | vfta_value = (offset == vfta_offset) ? vfta_bit_in_reg : 0; | 5955 | vfta_value = (offset == vfta_offset) ? vfta_bit_in_reg : 0; |
5394 | E1000_WRITE_REG_ARRAY(hw, VFTA, offset, vfta_value); | 5956 | E1000_WRITE_REG_ARRAY(hw, VFTA, offset, vfta_value); |
5957 | E1000_WRITE_FLUSH(hw); | ||
5395 | } | 5958 | } |
5396 | } | 5959 | } |
5397 | 5960 | ||
@@ -5421,9 +5984,18 @@ e1000_id_led_init(struct e1000_hw * hw) | |||
5421 | DEBUGOUT("EEPROM Read Error\n"); | 5984 | DEBUGOUT("EEPROM Read Error\n"); |
5422 | return -E1000_ERR_EEPROM; | 5985 | return -E1000_ERR_EEPROM; |
5423 | } | 5986 | } |
5424 | if((eeprom_data== ID_LED_RESERVED_0000) || | 5987 | |
5425 | (eeprom_data == ID_LED_RESERVED_FFFF)) eeprom_data = ID_LED_DEFAULT; | 5988 | if ((hw->mac_type == e1000_82573) && |
5426 | for(i = 0; i < 4; i++) { | 5989 | (eeprom_data == ID_LED_RESERVED_82573)) |
5990 | eeprom_data = ID_LED_DEFAULT_82573; | ||
5991 | else if ((eeprom_data == ID_LED_RESERVED_0000) || | ||
5992 | (eeprom_data == ID_LED_RESERVED_FFFF)) { | ||
5993 | if (hw->mac_type == e1000_ich8lan) | ||
5994 | eeprom_data = ID_LED_DEFAULT_ICH8LAN; | ||
5995 | else | ||
5996 | eeprom_data = ID_LED_DEFAULT; | ||
5997 | } | ||
5998 | for (i = 0; i < 4; i++) { | ||
5427 | temp = (eeprom_data >> (i << 2)) & led_mask; | 5999 | temp = (eeprom_data >> (i << 2)) & led_mask; |
5428 | switch(temp) { | 6000 | switch(temp) { |
5429 | case ID_LED_ON1_DEF2: | 6001 | case ID_LED_ON1_DEF2: |
@@ -5519,6 +6091,44 @@ e1000_setup_led(struct e1000_hw *hw) | |||
5519 | } | 6091 | } |
5520 | 6092 | ||
5521 | /****************************************************************************** | 6093 | /****************************************************************************** |
6094 | * Used on 82571 and later Si that has LED blink bits. | ||
6095 | * Callers must use their own timer and should have already called | ||
6096 | * e1000_id_led_init() | ||
6097 | * Call e1000_cleanup led() to stop blinking | ||
6098 | * | ||
6099 | * hw - Struct containing variables accessed by shared code | ||
6100 | *****************************************************************************/ | ||
6101 | int32_t | ||
6102 | e1000_blink_led_start(struct e1000_hw *hw) | ||
6103 | { | ||
6104 | int16_t i; | ||
6105 | uint32_t ledctl_blink = 0; | ||
6106 | |||
6107 | DEBUGFUNC("e1000_id_led_blink_on"); | ||
6108 | |||
6109 | if (hw->mac_type < e1000_82571) { | ||
6110 | /* Nothing to do */ | ||
6111 | return E1000_SUCCESS; | ||
6112 | } | ||
6113 | if (hw->media_type == e1000_media_type_fiber) { | ||
6114 | /* always blink LED0 for PCI-E fiber */ | ||
6115 | ledctl_blink = E1000_LEDCTL_LED0_BLINK | | ||
6116 | (E1000_LEDCTL_MODE_LED_ON << E1000_LEDCTL_LED0_MODE_SHIFT); | ||
6117 | } else { | ||
6118 | /* set the blink bit for each LED that's "on" (0x0E) in ledctl_mode2 */ | ||
6119 | ledctl_blink = hw->ledctl_mode2; | ||
6120 | for (i=0; i < 4; i++) | ||
6121 | if (((hw->ledctl_mode2 >> (i * 8)) & 0xFF) == | ||
6122 | E1000_LEDCTL_MODE_LED_ON) | ||
6123 | ledctl_blink |= (E1000_LEDCTL_LED0_BLINK << (i * 8)); | ||
6124 | } | ||
6125 | |||
6126 | E1000_WRITE_REG(hw, LEDCTL, ledctl_blink); | ||
6127 | |||
6128 | return E1000_SUCCESS; | ||
6129 | } | ||
6130 | |||
6131 | /****************************************************************************** | ||
5522 | * Restores the saved state of the SW controlable LED. | 6132 | * Restores the saved state of the SW controlable LED. |
5523 | * | 6133 | * |
5524 | * hw - Struct containing variables accessed by shared code | 6134 | * hw - Struct containing variables accessed by shared code |
@@ -5548,6 +6158,10 @@ e1000_cleanup_led(struct e1000_hw *hw) | |||
5548 | return ret_val; | 6158 | return ret_val; |
5549 | /* Fall Through */ | 6159 | /* Fall Through */ |
5550 | default: | 6160 | default: |
6161 | if (hw->phy_type == e1000_phy_ife) { | ||
6162 | e1000_write_phy_reg(hw, IFE_PHY_SPECIAL_CONTROL_LED, 0); | ||
6163 | break; | ||
6164 | } | ||
5551 | /* Restore LEDCTL settings */ | 6165 | /* Restore LEDCTL settings */ |
5552 | E1000_WRITE_REG(hw, LEDCTL, hw->ledctl_default); | 6166 | E1000_WRITE_REG(hw, LEDCTL, hw->ledctl_default); |
5553 | break; | 6167 | break; |
@@ -5592,7 +6206,10 @@ e1000_led_on(struct e1000_hw *hw) | |||
5592 | /* Clear SW Defineable Pin 0 to turn on the LED */ | 6206 | /* Clear SW Defineable Pin 0 to turn on the LED */ |
5593 | ctrl &= ~E1000_CTRL_SWDPIN0; | 6207 | ctrl &= ~E1000_CTRL_SWDPIN0; |
5594 | ctrl |= E1000_CTRL_SWDPIO0; | 6208 | ctrl |= E1000_CTRL_SWDPIO0; |
5595 | } else if(hw->media_type == e1000_media_type_copper) { | 6209 | } else if (hw->phy_type == e1000_phy_ife) { |
6210 | e1000_write_phy_reg(hw, IFE_PHY_SPECIAL_CONTROL_LED, | ||
6211 | (IFE_PSCL_PROBE_MODE | IFE_PSCL_PROBE_LEDS_ON)); | ||
6212 | } else if (hw->media_type == e1000_media_type_copper) { | ||
5596 | E1000_WRITE_REG(hw, LEDCTL, hw->ledctl_mode2); | 6213 | E1000_WRITE_REG(hw, LEDCTL, hw->ledctl_mode2); |
5597 | return E1000_SUCCESS; | 6214 | return E1000_SUCCESS; |
5598 | } | 6215 | } |
@@ -5640,7 +6257,10 @@ e1000_led_off(struct e1000_hw *hw) | |||
5640 | /* Set SW Defineable Pin 0 to turn off the LED */ | 6257 | /* Set SW Defineable Pin 0 to turn off the LED */ |
5641 | ctrl |= E1000_CTRL_SWDPIN0; | 6258 | ctrl |= E1000_CTRL_SWDPIN0; |
5642 | ctrl |= E1000_CTRL_SWDPIO0; | 6259 | ctrl |= E1000_CTRL_SWDPIO0; |
5643 | } else if(hw->media_type == e1000_media_type_copper) { | 6260 | } else if (hw->phy_type == e1000_phy_ife) { |
6261 | e1000_write_phy_reg(hw, IFE_PHY_SPECIAL_CONTROL_LED, | ||
6262 | (IFE_PSCL_PROBE_MODE | IFE_PSCL_PROBE_LEDS_OFF)); | ||
6263 | } else if (hw->media_type == e1000_media_type_copper) { | ||
5644 | E1000_WRITE_REG(hw, LEDCTL, hw->ledctl_mode1); | 6264 | E1000_WRITE_REG(hw, LEDCTL, hw->ledctl_mode1); |
5645 | return E1000_SUCCESS; | 6265 | return E1000_SUCCESS; |
5646 | } | 6266 | } |
@@ -5678,12 +6298,16 @@ e1000_clear_hw_cntrs(struct e1000_hw *hw) | |||
5678 | temp = E1000_READ_REG(hw, XOFFRXC); | 6298 | temp = E1000_READ_REG(hw, XOFFRXC); |
5679 | temp = E1000_READ_REG(hw, XOFFTXC); | 6299 | temp = E1000_READ_REG(hw, XOFFTXC); |
5680 | temp = E1000_READ_REG(hw, FCRUC); | 6300 | temp = E1000_READ_REG(hw, FCRUC); |
6301 | |||
6302 | if (hw->mac_type != e1000_ich8lan) { | ||
5681 | temp = E1000_READ_REG(hw, PRC64); | 6303 | temp = E1000_READ_REG(hw, PRC64); |
5682 | temp = E1000_READ_REG(hw, PRC127); | 6304 | temp = E1000_READ_REG(hw, PRC127); |
5683 | temp = E1000_READ_REG(hw, PRC255); | 6305 | temp = E1000_READ_REG(hw, PRC255); |
5684 | temp = E1000_READ_REG(hw, PRC511); | 6306 | temp = E1000_READ_REG(hw, PRC511); |
5685 | temp = E1000_READ_REG(hw, PRC1023); | 6307 | temp = E1000_READ_REG(hw, PRC1023); |
5686 | temp = E1000_READ_REG(hw, PRC1522); | 6308 | temp = E1000_READ_REG(hw, PRC1522); |
6309 | } | ||
6310 | |||
5687 | temp = E1000_READ_REG(hw, GPRC); | 6311 | temp = E1000_READ_REG(hw, GPRC); |
5688 | temp = E1000_READ_REG(hw, BPRC); | 6312 | temp = E1000_READ_REG(hw, BPRC); |
5689 | temp = E1000_READ_REG(hw, MPRC); | 6313 | temp = E1000_READ_REG(hw, MPRC); |
@@ -5703,12 +6327,16 @@ e1000_clear_hw_cntrs(struct e1000_hw *hw) | |||
5703 | temp = E1000_READ_REG(hw, TOTH); | 6327 | temp = E1000_READ_REG(hw, TOTH); |
5704 | temp = E1000_READ_REG(hw, TPR); | 6328 | temp = E1000_READ_REG(hw, TPR); |
5705 | temp = E1000_READ_REG(hw, TPT); | 6329 | temp = E1000_READ_REG(hw, TPT); |
6330 | |||
6331 | if (hw->mac_type != e1000_ich8lan) { | ||
5706 | temp = E1000_READ_REG(hw, PTC64); | 6332 | temp = E1000_READ_REG(hw, PTC64); |
5707 | temp = E1000_READ_REG(hw, PTC127); | 6333 | temp = E1000_READ_REG(hw, PTC127); |
5708 | temp = E1000_READ_REG(hw, PTC255); | 6334 | temp = E1000_READ_REG(hw, PTC255); |
5709 | temp = E1000_READ_REG(hw, PTC511); | 6335 | temp = E1000_READ_REG(hw, PTC511); |
5710 | temp = E1000_READ_REG(hw, PTC1023); | 6336 | temp = E1000_READ_REG(hw, PTC1023); |
5711 | temp = E1000_READ_REG(hw, PTC1522); | 6337 | temp = E1000_READ_REG(hw, PTC1522); |
6338 | } | ||
6339 | |||
5712 | temp = E1000_READ_REG(hw, MPTC); | 6340 | temp = E1000_READ_REG(hw, MPTC); |
5713 | temp = E1000_READ_REG(hw, BPTC); | 6341 | temp = E1000_READ_REG(hw, BPTC); |
5714 | 6342 | ||
@@ -5731,6 +6359,9 @@ e1000_clear_hw_cntrs(struct e1000_hw *hw) | |||
5731 | 6359 | ||
5732 | temp = E1000_READ_REG(hw, IAC); | 6360 | temp = E1000_READ_REG(hw, IAC); |
5733 | temp = E1000_READ_REG(hw, ICRXOC); | 6361 | temp = E1000_READ_REG(hw, ICRXOC); |
6362 | |||
6363 | if (hw->mac_type == e1000_ich8lan) return; | ||
6364 | |||
5734 | temp = E1000_READ_REG(hw, ICRXPTC); | 6365 | temp = E1000_READ_REG(hw, ICRXPTC); |
5735 | temp = E1000_READ_REG(hw, ICRXATC); | 6366 | temp = E1000_READ_REG(hw, ICRXATC); |
5736 | temp = E1000_READ_REG(hw, ICTXPTC); | 6367 | temp = E1000_READ_REG(hw, ICTXPTC); |
@@ -5911,6 +6542,7 @@ e1000_get_bus_info(struct e1000_hw *hw) | |||
5911 | hw->bus_width = e1000_bus_width_pciex_1; | 6542 | hw->bus_width = e1000_bus_width_pciex_1; |
5912 | break; | 6543 | break; |
5913 | case e1000_82571: | 6544 | case e1000_82571: |
6545 | case e1000_ich8lan: | ||
5914 | case e1000_80003es2lan: | 6546 | case e1000_80003es2lan: |
5915 | hw->bus_type = e1000_bus_type_pci_express; | 6547 | hw->bus_type = e1000_bus_type_pci_express; |
5916 | hw->bus_speed = e1000_bus_speed_2500; | 6548 | hw->bus_speed = e1000_bus_speed_2500; |
@@ -5948,8 +6580,6 @@ e1000_get_bus_info(struct e1000_hw *hw) | |||
5948 | break; | 6580 | break; |
5949 | } | 6581 | } |
5950 | } | 6582 | } |
5951 | |||
5952 | #if 0 | ||
5953 | /****************************************************************************** | 6583 | /****************************************************************************** |
5954 | * Reads a value from one of the devices registers using port I/O (as opposed | 6584 | * Reads a value from one of the devices registers using port I/O (as opposed |
5955 | * memory mapped I/O). Only 82544 and newer devices support port I/O. | 6585 | * memory mapped I/O). Only 82544 and newer devices support port I/O. |
@@ -5967,7 +6597,6 @@ e1000_read_reg_io(struct e1000_hw *hw, | |||
5967 | e1000_io_write(hw, io_addr, offset); | 6597 | e1000_io_write(hw, io_addr, offset); |
5968 | return e1000_io_read(hw, io_data); | 6598 | return e1000_io_read(hw, io_data); |
5969 | } | 6599 | } |
5970 | #endif /* 0 */ | ||
5971 | 6600 | ||
5972 | /****************************************************************************** | 6601 | /****************************************************************************** |
5973 | * Writes a value to one of the devices registers using port I/O (as opposed to | 6602 | * Writes a value to one of the devices registers using port I/O (as opposed to |
@@ -6012,8 +6641,6 @@ e1000_get_cable_length(struct e1000_hw *hw, | |||
6012 | { | 6641 | { |
6013 | int32_t ret_val; | 6642 | int32_t ret_val; |
6014 | uint16_t agc_value = 0; | 6643 | uint16_t agc_value = 0; |
6015 | uint16_t cur_agc, min_agc = IGP01E1000_AGC_LENGTH_TABLE_SIZE; | ||
6016 | uint16_t max_agc = 0; | ||
6017 | uint16_t i, phy_data; | 6644 | uint16_t i, phy_data; |
6018 | uint16_t cable_length; | 6645 | uint16_t cable_length; |
6019 | 6646 | ||
@@ -6086,6 +6713,8 @@ e1000_get_cable_length(struct e1000_hw *hw, | |||
6086 | break; | 6713 | break; |
6087 | } | 6714 | } |
6088 | } else if(hw->phy_type == e1000_phy_igp) { /* For IGP PHY */ | 6715 | } else if(hw->phy_type == e1000_phy_igp) { /* For IGP PHY */ |
6716 | uint16_t cur_agc_value; | ||
6717 | uint16_t min_agc_value = IGP01E1000_AGC_LENGTH_TABLE_SIZE; | ||
6089 | uint16_t agc_reg_array[IGP01E1000_PHY_CHANNEL_NUM] = | 6718 | uint16_t agc_reg_array[IGP01E1000_PHY_CHANNEL_NUM] = |
6090 | {IGP01E1000_PHY_AGC_A, | 6719 | {IGP01E1000_PHY_AGC_A, |
6091 | IGP01E1000_PHY_AGC_B, | 6720 | IGP01E1000_PHY_AGC_B, |
@@ -6098,23 +6727,23 @@ e1000_get_cable_length(struct e1000_hw *hw, | |||
6098 | if(ret_val) | 6727 | if(ret_val) |
6099 | return ret_val; | 6728 | return ret_val; |
6100 | 6729 | ||
6101 | cur_agc = phy_data >> IGP01E1000_AGC_LENGTH_SHIFT; | 6730 | cur_agc_value = phy_data >> IGP01E1000_AGC_LENGTH_SHIFT; |
6102 | 6731 | ||
6103 | /* Array bound check. */ | 6732 | /* Value bound check. */ |
6104 | if((cur_agc >= IGP01E1000_AGC_LENGTH_TABLE_SIZE - 1) || | 6733 | if ((cur_agc_value >= IGP01E1000_AGC_LENGTH_TABLE_SIZE - 1) || |
6105 | (cur_agc == 0)) | 6734 | (cur_agc_value == 0)) |
6106 | return -E1000_ERR_PHY; | 6735 | return -E1000_ERR_PHY; |
6107 | 6736 | ||
6108 | agc_value += cur_agc; | 6737 | agc_value += cur_agc_value; |
6109 | 6738 | ||
6110 | /* Update minimal AGC value. */ | 6739 | /* Update minimal AGC value. */ |
6111 | if(min_agc > cur_agc) | 6740 | if (min_agc_value > cur_agc_value) |
6112 | min_agc = cur_agc; | 6741 | min_agc_value = cur_agc_value; |
6113 | } | 6742 | } |
6114 | 6743 | ||
6115 | /* Remove the minimal AGC result for length < 50m */ | 6744 | /* Remove the minimal AGC result for length < 50m */ |
6116 | if(agc_value < IGP01E1000_PHY_CHANNEL_NUM * e1000_igp_cable_length_50) { | 6745 | if (agc_value < IGP01E1000_PHY_CHANNEL_NUM * e1000_igp_cable_length_50) { |
6117 | agc_value -= min_agc; | 6746 | agc_value -= min_agc_value; |
6118 | 6747 | ||
6119 | /* Get the average length of the remaining 3 channels */ | 6748 | /* Get the average length of the remaining 3 channels */ |
6120 | agc_value /= (IGP01E1000_PHY_CHANNEL_NUM - 1); | 6749 | agc_value /= (IGP01E1000_PHY_CHANNEL_NUM - 1); |
@@ -6130,7 +6759,10 @@ e1000_get_cable_length(struct e1000_hw *hw, | |||
6130 | IGP01E1000_AGC_RANGE) : 0; | 6759 | IGP01E1000_AGC_RANGE) : 0; |
6131 | *max_length = e1000_igp_cable_length_table[agc_value] + | 6760 | *max_length = e1000_igp_cable_length_table[agc_value] + |
6132 | IGP01E1000_AGC_RANGE; | 6761 | IGP01E1000_AGC_RANGE; |
6133 | } else if (hw->phy_type == e1000_phy_igp_2) { | 6762 | } else if (hw->phy_type == e1000_phy_igp_2 || |
6763 | hw->phy_type == e1000_phy_igp_3) { | ||
6764 | uint16_t cur_agc_index, max_agc_index = 0; | ||
6765 | uint16_t min_agc_index = IGP02E1000_AGC_LENGTH_TABLE_SIZE - 1; | ||
6134 | uint16_t agc_reg_array[IGP02E1000_PHY_CHANNEL_NUM] = | 6766 | uint16_t agc_reg_array[IGP02E1000_PHY_CHANNEL_NUM] = |
6135 | {IGP02E1000_PHY_AGC_A, | 6767 | {IGP02E1000_PHY_AGC_A, |
6136 | IGP02E1000_PHY_AGC_B, | 6768 | IGP02E1000_PHY_AGC_B, |
@@ -6145,19 +6777,27 @@ e1000_get_cable_length(struct e1000_hw *hw, | |||
6145 | /* Getting bits 15:9, which represent the combination of course and | 6777 | /* Getting bits 15:9, which represent the combination of course and |
6146 | * fine gain values. The result is a number that can be put into | 6778 | * fine gain values. The result is a number that can be put into |
6147 | * the lookup table to obtain the approximate cable length. */ | 6779 | * the lookup table to obtain the approximate cable length. */ |
6148 | cur_agc = (phy_data >> IGP02E1000_AGC_LENGTH_SHIFT) & | 6780 | cur_agc_index = (phy_data >> IGP02E1000_AGC_LENGTH_SHIFT) & |
6149 | IGP02E1000_AGC_LENGTH_MASK; | 6781 | IGP02E1000_AGC_LENGTH_MASK; |
6150 | 6782 | ||
6151 | /* Remove min & max AGC values from calculation. */ | 6783 | /* Array index bound check. */ |
6152 | if (e1000_igp_2_cable_length_table[min_agc] > e1000_igp_2_cable_length_table[cur_agc]) | 6784 | if ((cur_agc_index >= IGP02E1000_AGC_LENGTH_TABLE_SIZE) || |
6153 | min_agc = cur_agc; | 6785 | (cur_agc_index == 0)) |
6154 | if (e1000_igp_2_cable_length_table[max_agc] < e1000_igp_2_cable_length_table[cur_agc]) | 6786 | return -E1000_ERR_PHY; |
6155 | max_agc = cur_agc; | ||
6156 | 6787 | ||
6157 | agc_value += e1000_igp_2_cable_length_table[cur_agc]; | 6788 | /* Remove min & max AGC values from calculation. */ |
6789 | if (e1000_igp_2_cable_length_table[min_agc_index] > | ||
6790 | e1000_igp_2_cable_length_table[cur_agc_index]) | ||
6791 | min_agc_index = cur_agc_index; | ||
6792 | if (e1000_igp_2_cable_length_table[max_agc_index] < | ||
6793 | e1000_igp_2_cable_length_table[cur_agc_index]) | ||
6794 | max_agc_index = cur_agc_index; | ||
6795 | |||
6796 | agc_value += e1000_igp_2_cable_length_table[cur_agc_index]; | ||
6158 | } | 6797 | } |
6159 | 6798 | ||
6160 | agc_value -= (e1000_igp_2_cable_length_table[min_agc] + e1000_igp_2_cable_length_table[max_agc]); | 6799 | agc_value -= (e1000_igp_2_cable_length_table[min_agc_index] + |
6800 | e1000_igp_2_cable_length_table[max_agc_index]); | ||
6161 | agc_value /= (IGP02E1000_PHY_CHANNEL_NUM - 2); | 6801 | agc_value /= (IGP02E1000_PHY_CHANNEL_NUM - 2); |
6162 | 6802 | ||
6163 | /* Calculate cable length with the error range of +/- 10 meters. */ | 6803 | /* Calculate cable length with the error range of +/- 10 meters. */ |
@@ -6203,7 +6843,8 @@ e1000_check_polarity(struct e1000_hw *hw, | |||
6203 | return ret_val; | 6843 | return ret_val; |
6204 | *polarity = (phy_data & M88E1000_PSSR_REV_POLARITY) >> | 6844 | *polarity = (phy_data & M88E1000_PSSR_REV_POLARITY) >> |
6205 | M88E1000_PSSR_REV_POLARITY_SHIFT; | 6845 | M88E1000_PSSR_REV_POLARITY_SHIFT; |
6206 | } else if(hw->phy_type == e1000_phy_igp || | 6846 | } else if (hw->phy_type == e1000_phy_igp || |
6847 | hw->phy_type == e1000_phy_igp_3 || | ||
6207 | hw->phy_type == e1000_phy_igp_2) { | 6848 | hw->phy_type == e1000_phy_igp_2) { |
6208 | /* Read the Status register to check the speed */ | 6849 | /* Read the Status register to check the speed */ |
6209 | ret_val = e1000_read_phy_reg(hw, IGP01E1000_PHY_PORT_STATUS, | 6850 | ret_val = e1000_read_phy_reg(hw, IGP01E1000_PHY_PORT_STATUS, |
@@ -6229,6 +6870,13 @@ e1000_check_polarity(struct e1000_hw *hw, | |||
6229 | * 100 Mbps this bit is always 0) */ | 6870 | * 100 Mbps this bit is always 0) */ |
6230 | *polarity = phy_data & IGP01E1000_PSSR_POLARITY_REVERSED; | 6871 | *polarity = phy_data & IGP01E1000_PSSR_POLARITY_REVERSED; |
6231 | } | 6872 | } |
6873 | } else if (hw->phy_type == e1000_phy_ife) { | ||
6874 | ret_val = e1000_read_phy_reg(hw, IFE_PHY_EXTENDED_STATUS_CONTROL, | ||
6875 | &phy_data); | ||
6876 | if (ret_val) | ||
6877 | return ret_val; | ||
6878 | *polarity = (phy_data & IFE_PESC_POLARITY_REVERSED) >> | ||
6879 | IFE_PESC_POLARITY_REVERSED_SHIFT; | ||
6232 | } | 6880 | } |
6233 | return E1000_SUCCESS; | 6881 | return E1000_SUCCESS; |
6234 | } | 6882 | } |
@@ -6256,7 +6904,8 @@ e1000_check_downshift(struct e1000_hw *hw) | |||
6256 | 6904 | ||
6257 | DEBUGFUNC("e1000_check_downshift"); | 6905 | DEBUGFUNC("e1000_check_downshift"); |
6258 | 6906 | ||
6259 | if(hw->phy_type == e1000_phy_igp || | 6907 | if (hw->phy_type == e1000_phy_igp || |
6908 | hw->phy_type == e1000_phy_igp_3 || | ||
6260 | hw->phy_type == e1000_phy_igp_2) { | 6909 | hw->phy_type == e1000_phy_igp_2) { |
6261 | ret_val = e1000_read_phy_reg(hw, IGP01E1000_PHY_LINK_HEALTH, | 6910 | ret_val = e1000_read_phy_reg(hw, IGP01E1000_PHY_LINK_HEALTH, |
6262 | &phy_data); | 6911 | &phy_data); |
@@ -6273,6 +6922,9 @@ e1000_check_downshift(struct e1000_hw *hw) | |||
6273 | 6922 | ||
6274 | hw->speed_downgraded = (phy_data & M88E1000_PSSR_DOWNSHIFT) >> | 6923 | hw->speed_downgraded = (phy_data & M88E1000_PSSR_DOWNSHIFT) >> |
6275 | M88E1000_PSSR_DOWNSHIFT_SHIFT; | 6924 | M88E1000_PSSR_DOWNSHIFT_SHIFT; |
6925 | } else if (hw->phy_type == e1000_phy_ife) { | ||
6926 | /* e1000_phy_ife supports 10/100 speed only */ | ||
6927 | hw->speed_downgraded = FALSE; | ||
6276 | } | 6928 | } |
6277 | 6929 | ||
6278 | return E1000_SUCCESS; | 6930 | return E1000_SUCCESS; |
@@ -6317,7 +6969,9 @@ e1000_config_dsp_after_link_change(struct e1000_hw *hw, | |||
6317 | 6969 | ||
6318 | if(speed == SPEED_1000) { | 6970 | if(speed == SPEED_1000) { |
6319 | 6971 | ||
6320 | e1000_get_cable_length(hw, &min_length, &max_length); | 6972 | ret_val = e1000_get_cable_length(hw, &min_length, &max_length); |
6973 | if (ret_val) | ||
6974 | return ret_val; | ||
6321 | 6975 | ||
6322 | if((hw->dsp_config_state == e1000_dsp_config_enabled) && | 6976 | if((hw->dsp_config_state == e1000_dsp_config_enabled) && |
6323 | min_length >= e1000_igp_cable_length_50) { | 6977 | min_length >= e1000_igp_cable_length_50) { |
@@ -6525,20 +7179,27 @@ static int32_t | |||
6525 | e1000_set_d3_lplu_state(struct e1000_hw *hw, | 7179 | e1000_set_d3_lplu_state(struct e1000_hw *hw, |
6526 | boolean_t active) | 7180 | boolean_t active) |
6527 | { | 7181 | { |
7182 | uint32_t phy_ctrl = 0; | ||
6528 | int32_t ret_val; | 7183 | int32_t ret_val; |
6529 | uint16_t phy_data; | 7184 | uint16_t phy_data; |
6530 | DEBUGFUNC("e1000_set_d3_lplu_state"); | 7185 | DEBUGFUNC("e1000_set_d3_lplu_state"); |
6531 | 7186 | ||
6532 | if(hw->phy_type != e1000_phy_igp && hw->phy_type != e1000_phy_igp_2) | 7187 | if (hw->phy_type != e1000_phy_igp && hw->phy_type != e1000_phy_igp_2 |
7188 | && hw->phy_type != e1000_phy_igp_3) | ||
6533 | return E1000_SUCCESS; | 7189 | return E1000_SUCCESS; |
6534 | 7190 | ||
6535 | /* During driver activity LPLU should not be used or it will attain link | 7191 | /* During driver activity LPLU should not be used or it will attain link |
6536 | * from the lowest speeds starting from 10Mbps. The capability is used for | 7192 | * from the lowest speeds starting from 10Mbps. The capability is used for |
6537 | * Dx transitions and states */ | 7193 | * Dx transitions and states */ |
6538 | if(hw->mac_type == e1000_82541_rev_2 || hw->mac_type == e1000_82547_rev_2) { | 7194 | if (hw->mac_type == e1000_82541_rev_2 || hw->mac_type == e1000_82547_rev_2) { |
6539 | ret_val = e1000_read_phy_reg(hw, IGP01E1000_GMII_FIFO, &phy_data); | 7195 | ret_val = e1000_read_phy_reg(hw, IGP01E1000_GMII_FIFO, &phy_data); |
6540 | if(ret_val) | 7196 | if (ret_val) |
6541 | return ret_val; | 7197 | return ret_val; |
7198 | } else if (hw->mac_type == e1000_ich8lan) { | ||
7199 | /* MAC writes into PHY register based on the state transition | ||
7200 | * and start auto-negotiation. SW driver can overwrite the settings | ||
7201 | * in CSR PHY power control E1000_PHY_CTRL register. */ | ||
7202 | phy_ctrl = E1000_READ_REG(hw, PHY_CTRL); | ||
6542 | } else { | 7203 | } else { |
6543 | ret_val = e1000_read_phy_reg(hw, IGP02E1000_PHY_POWER_MGMT, &phy_data); | 7204 | ret_val = e1000_read_phy_reg(hw, IGP02E1000_PHY_POWER_MGMT, &phy_data); |
6544 | if(ret_val) | 7205 | if(ret_val) |
@@ -6553,11 +7214,16 @@ e1000_set_d3_lplu_state(struct e1000_hw *hw, | |||
6553 | if(ret_val) | 7214 | if(ret_val) |
6554 | return ret_val; | 7215 | return ret_val; |
6555 | } else { | 7216 | } else { |
7217 | if (hw->mac_type == e1000_ich8lan) { | ||
7218 | phy_ctrl &= ~E1000_PHY_CTRL_NOND0A_LPLU; | ||
7219 | E1000_WRITE_REG(hw, PHY_CTRL, phy_ctrl); | ||
7220 | } else { | ||
6556 | phy_data &= ~IGP02E1000_PM_D3_LPLU; | 7221 | phy_data &= ~IGP02E1000_PM_D3_LPLU; |
6557 | ret_val = e1000_write_phy_reg(hw, IGP02E1000_PHY_POWER_MGMT, | 7222 | ret_val = e1000_write_phy_reg(hw, IGP02E1000_PHY_POWER_MGMT, |
6558 | phy_data); | 7223 | phy_data); |
6559 | if (ret_val) | 7224 | if (ret_val) |
6560 | return ret_val; | 7225 | return ret_val; |
7226 | } | ||
6561 | } | 7227 | } |
6562 | 7228 | ||
6563 | /* LPLU and SmartSpeed are mutually exclusive. LPLU is used during | 7229 | /* LPLU and SmartSpeed are mutually exclusive. LPLU is used during |
@@ -6593,17 +7259,22 @@ e1000_set_d3_lplu_state(struct e1000_hw *hw, | |||
6593 | (hw->autoneg_advertised == AUTONEG_ADVERTISE_10_100_ALL)) { | 7259 | (hw->autoneg_advertised == AUTONEG_ADVERTISE_10_100_ALL)) { |
6594 | 7260 | ||
6595 | if(hw->mac_type == e1000_82541_rev_2 || | 7261 | if(hw->mac_type == e1000_82541_rev_2 || |
6596 | hw->mac_type == e1000_82547_rev_2) { | 7262 | hw->mac_type == e1000_82547_rev_2) { |
6597 | phy_data |= IGP01E1000_GMII_FLEX_SPD; | 7263 | phy_data |= IGP01E1000_GMII_FLEX_SPD; |
6598 | ret_val = e1000_write_phy_reg(hw, IGP01E1000_GMII_FIFO, phy_data); | 7264 | ret_val = e1000_write_phy_reg(hw, IGP01E1000_GMII_FIFO, phy_data); |
6599 | if(ret_val) | 7265 | if(ret_val) |
6600 | return ret_val; | 7266 | return ret_val; |
6601 | } else { | 7267 | } else { |
7268 | if (hw->mac_type == e1000_ich8lan) { | ||
7269 | phy_ctrl |= E1000_PHY_CTRL_NOND0A_LPLU; | ||
7270 | E1000_WRITE_REG(hw, PHY_CTRL, phy_ctrl); | ||
7271 | } else { | ||
6602 | phy_data |= IGP02E1000_PM_D3_LPLU; | 7272 | phy_data |= IGP02E1000_PM_D3_LPLU; |
6603 | ret_val = e1000_write_phy_reg(hw, IGP02E1000_PHY_POWER_MGMT, | 7273 | ret_val = e1000_write_phy_reg(hw, IGP02E1000_PHY_POWER_MGMT, |
6604 | phy_data); | 7274 | phy_data); |
6605 | if (ret_val) | 7275 | if (ret_val) |
6606 | return ret_val; | 7276 | return ret_val; |
7277 | } | ||
6607 | } | 7278 | } |
6608 | 7279 | ||
6609 | /* When LPLU is enabled we should disable SmartSpeed */ | 7280 | /* When LPLU is enabled we should disable SmartSpeed */ |
@@ -6638,6 +7309,7 @@ static int32_t | |||
6638 | e1000_set_d0_lplu_state(struct e1000_hw *hw, | 7309 | e1000_set_d0_lplu_state(struct e1000_hw *hw, |
6639 | boolean_t active) | 7310 | boolean_t active) |
6640 | { | 7311 | { |
7312 | uint32_t phy_ctrl = 0; | ||
6641 | int32_t ret_val; | 7313 | int32_t ret_val; |
6642 | uint16_t phy_data; | 7314 | uint16_t phy_data; |
6643 | DEBUGFUNC("e1000_set_d0_lplu_state"); | 7315 | DEBUGFUNC("e1000_set_d0_lplu_state"); |
@@ -6645,15 +7317,24 @@ e1000_set_d0_lplu_state(struct e1000_hw *hw, | |||
6645 | if(hw->mac_type <= e1000_82547_rev_2) | 7317 | if(hw->mac_type <= e1000_82547_rev_2) |
6646 | return E1000_SUCCESS; | 7318 | return E1000_SUCCESS; |
6647 | 7319 | ||
7320 | if (hw->mac_type == e1000_ich8lan) { | ||
7321 | phy_ctrl = E1000_READ_REG(hw, PHY_CTRL); | ||
7322 | } else { | ||
6648 | ret_val = e1000_read_phy_reg(hw, IGP02E1000_PHY_POWER_MGMT, &phy_data); | 7323 | ret_val = e1000_read_phy_reg(hw, IGP02E1000_PHY_POWER_MGMT, &phy_data); |
6649 | if(ret_val) | 7324 | if(ret_val) |
6650 | return ret_val; | 7325 | return ret_val; |
7326 | } | ||
6651 | 7327 | ||
6652 | if (!active) { | 7328 | if (!active) { |
7329 | if (hw->mac_type == e1000_ich8lan) { | ||
7330 | phy_ctrl &= ~E1000_PHY_CTRL_D0A_LPLU; | ||
7331 | E1000_WRITE_REG(hw, PHY_CTRL, phy_ctrl); | ||
7332 | } else { | ||
6653 | phy_data &= ~IGP02E1000_PM_D0_LPLU; | 7333 | phy_data &= ~IGP02E1000_PM_D0_LPLU; |
6654 | ret_val = e1000_write_phy_reg(hw, IGP02E1000_PHY_POWER_MGMT, phy_data); | 7334 | ret_val = e1000_write_phy_reg(hw, IGP02E1000_PHY_POWER_MGMT, phy_data); |
6655 | if (ret_val) | 7335 | if (ret_val) |
6656 | return ret_val; | 7336 | return ret_val; |
7337 | } | ||
6657 | 7338 | ||
6658 | /* LPLU and SmartSpeed are mutually exclusive. LPLU is used during | 7339 | /* LPLU and SmartSpeed are mutually exclusive. LPLU is used during |
6659 | * Dx states where the power conservation is most important. During | 7340 | * Dx states where the power conservation is most important. During |
@@ -6686,10 +7367,15 @@ e1000_set_d0_lplu_state(struct e1000_hw *hw, | |||
6686 | 7367 | ||
6687 | } else { | 7368 | } else { |
6688 | 7369 | ||
7370 | if (hw->mac_type == e1000_ich8lan) { | ||
7371 | phy_ctrl |= E1000_PHY_CTRL_D0A_LPLU; | ||
7372 | E1000_WRITE_REG(hw, PHY_CTRL, phy_ctrl); | ||
7373 | } else { | ||
6689 | phy_data |= IGP02E1000_PM_D0_LPLU; | 7374 | phy_data |= IGP02E1000_PM_D0_LPLU; |
6690 | ret_val = e1000_write_phy_reg(hw, IGP02E1000_PHY_POWER_MGMT, phy_data); | 7375 | ret_val = e1000_write_phy_reg(hw, IGP02E1000_PHY_POWER_MGMT, phy_data); |
6691 | if (ret_val) | 7376 | if (ret_val) |
6692 | return ret_val; | 7377 | return ret_val; |
7378 | } | ||
6693 | 7379 | ||
6694 | /* When LPLU is enabled we should disable SmartSpeed */ | 7380 | /* When LPLU is enabled we should disable SmartSpeed */ |
6695 | ret_val = e1000_read_phy_reg(hw, IGP01E1000_PHY_PORT_CONFIG, &phy_data); | 7381 | ret_val = e1000_read_phy_reg(hw, IGP01E1000_PHY_PORT_CONFIG, &phy_data); |
@@ -6928,8 +7614,10 @@ e1000_mng_write_cmd_header(struct e1000_hw * hw, | |||
6928 | 7614 | ||
6929 | length >>= 2; | 7615 | length >>= 2; |
6930 | /* The device driver writes the relevant command block into the ram area. */ | 7616 | /* The device driver writes the relevant command block into the ram area. */ |
6931 | for (i = 0; i < length; i++) | 7617 | for (i = 0; i < length; i++) { |
6932 | E1000_WRITE_REG_ARRAY_DWORD(hw, HOST_IF, i, *((uint32_t *) hdr + i)); | 7618 | E1000_WRITE_REG_ARRAY_DWORD(hw, HOST_IF, i, *((uint32_t *) hdr + i)); |
7619 | E1000_WRITE_FLUSH(hw); | ||
7620 | } | ||
6933 | 7621 | ||
6934 | return E1000_SUCCESS; | 7622 | return E1000_SUCCESS; |
6935 | } | 7623 | } |
@@ -6961,15 +7649,18 @@ e1000_mng_write_commit( | |||
6961 | * returns - TRUE when the mode is IAMT or FALSE. | 7649 | * returns - TRUE when the mode is IAMT or FALSE. |
6962 | ****************************************************************************/ | 7650 | ****************************************************************************/ |
6963 | boolean_t | 7651 | boolean_t |
6964 | e1000_check_mng_mode( | 7652 | e1000_check_mng_mode(struct e1000_hw *hw) |
6965 | struct e1000_hw *hw) | ||
6966 | { | 7653 | { |
6967 | uint32_t fwsm; | 7654 | uint32_t fwsm; |
6968 | 7655 | ||
6969 | fwsm = E1000_READ_REG(hw, FWSM); | 7656 | fwsm = E1000_READ_REG(hw, FWSM); |
6970 | 7657 | ||
6971 | if((fwsm & E1000_FWSM_MODE_MASK) == | 7658 | if (hw->mac_type == e1000_ich8lan) { |
6972 | (E1000_MNG_IAMT_MODE << E1000_FWSM_MODE_SHIFT)) | 7659 | if ((fwsm & E1000_FWSM_MODE_MASK) == |
7660 | (E1000_MNG_ICH_IAMT_MODE << E1000_FWSM_MODE_SHIFT)) | ||
7661 | return TRUE; | ||
7662 | } else if ((fwsm & E1000_FWSM_MODE_MASK) == | ||
7663 | (E1000_MNG_IAMT_MODE << E1000_FWSM_MODE_SHIFT)) | ||
6973 | return TRUE; | 7664 | return TRUE; |
6974 | 7665 | ||
6975 | return FALSE; | 7666 | return FALSE; |
@@ -7209,7 +7900,6 @@ e1000_set_pci_express_master_disable(struct e1000_hw *hw) | |||
7209 | E1000_WRITE_REG(hw, CTRL, ctrl); | 7900 | E1000_WRITE_REG(hw, CTRL, ctrl); |
7210 | } | 7901 | } |
7211 | 7902 | ||
7212 | #if 0 | ||
7213 | /*************************************************************************** | 7903 | /*************************************************************************** |
7214 | * | 7904 | * |
7215 | * Enables PCI-Express master access. | 7905 | * Enables PCI-Express master access. |
@@ -7233,7 +7923,6 @@ e1000_enable_pciex_master(struct e1000_hw *hw) | |||
7233 | ctrl &= ~E1000_CTRL_GIO_MASTER_DISABLE; | 7923 | ctrl &= ~E1000_CTRL_GIO_MASTER_DISABLE; |
7234 | E1000_WRITE_REG(hw, CTRL, ctrl); | 7924 | E1000_WRITE_REG(hw, CTRL, ctrl); |
7235 | } | 7925 | } |
7236 | #endif /* 0 */ | ||
7237 | 7926 | ||
7238 | /******************************************************************************* | 7927 | /******************************************************************************* |
7239 | * | 7928 | * |
@@ -7299,8 +7988,10 @@ e1000_get_auto_rd_done(struct e1000_hw *hw) | |||
7299 | case e1000_82572: | 7988 | case e1000_82572: |
7300 | case e1000_82573: | 7989 | case e1000_82573: |
7301 | case e1000_80003es2lan: | 7990 | case e1000_80003es2lan: |
7302 | while(timeout) { | 7991 | case e1000_ich8lan: |
7303 | if (E1000_READ_REG(hw, EECD) & E1000_EECD_AUTO_RD) break; | 7992 | while (timeout) { |
7993 | if (E1000_READ_REG(hw, EECD) & E1000_EECD_AUTO_RD) | ||
7994 | break; | ||
7304 | else msec_delay(1); | 7995 | else msec_delay(1); |
7305 | timeout--; | 7996 | timeout--; |
7306 | } | 7997 | } |
@@ -7340,7 +8031,7 @@ e1000_get_phy_cfg_done(struct e1000_hw *hw) | |||
7340 | 8031 | ||
7341 | switch (hw->mac_type) { | 8032 | switch (hw->mac_type) { |
7342 | default: | 8033 | default: |
7343 | msec_delay(10); | 8034 | msec_delay_irq(10); |
7344 | break; | 8035 | break; |
7345 | case e1000_80003es2lan: | 8036 | case e1000_80003es2lan: |
7346 | /* Separate *_CFG_DONE_* bit for each port */ | 8037 | /* Separate *_CFG_DONE_* bit for each port */ |
@@ -7523,6 +8214,13 @@ int32_t | |||
7523 | e1000_check_phy_reset_block(struct e1000_hw *hw) | 8214 | e1000_check_phy_reset_block(struct e1000_hw *hw) |
7524 | { | 8215 | { |
7525 | uint32_t manc = 0; | 8216 | uint32_t manc = 0; |
8217 | uint32_t fwsm = 0; | ||
8218 | |||
8219 | if (hw->mac_type == e1000_ich8lan) { | ||
8220 | fwsm = E1000_READ_REG(hw, FWSM); | ||
8221 | return (fwsm & E1000_FWSM_RSPCIPHY) ? E1000_SUCCESS | ||
8222 | : E1000_BLK_PHY_RESET; | ||
8223 | } | ||
7526 | 8224 | ||
7527 | if (hw->mac_type > e1000_82547_rev_2) | 8225 | if (hw->mac_type > e1000_82547_rev_2) |
7528 | manc = E1000_READ_REG(hw, MANC); | 8226 | manc = E1000_READ_REG(hw, MANC); |
@@ -7549,6 +8247,8 @@ e1000_arc_subsystem_valid(struct e1000_hw *hw) | |||
7549 | if((fwsm & E1000_FWSM_MODE_MASK) != 0) | 8247 | if((fwsm & E1000_FWSM_MODE_MASK) != 0) |
7550 | return TRUE; | 8248 | return TRUE; |
7551 | break; | 8249 | break; |
8250 | case e1000_ich8lan: | ||
8251 | return TRUE; | ||
7552 | default: | 8252 | default: |
7553 | break; | 8253 | break; |
7554 | } | 8254 | } |
@@ -7556,4 +8256,846 @@ e1000_arc_subsystem_valid(struct e1000_hw *hw) | |||
7556 | } | 8256 | } |
7557 | 8257 | ||
7558 | 8258 | ||
8259 | /****************************************************************************** | ||
8260 | * Configure PCI-Ex no-snoop | ||
8261 | * | ||
8262 | * hw - Struct containing variables accessed by shared code. | ||
8263 | * no_snoop - Bitmap of no-snoop events. | ||
8264 | * | ||
8265 | * returns: E1000_SUCCESS | ||
8266 | * | ||
8267 | *****************************************************************************/ | ||
8268 | int32_t | ||
8269 | e1000_set_pci_ex_no_snoop(struct e1000_hw *hw, uint32_t no_snoop) | ||
8270 | { | ||
8271 | uint32_t gcr_reg = 0; | ||
8272 | |||
8273 | DEBUGFUNC("e1000_set_pci_ex_no_snoop"); | ||
8274 | |||
8275 | if (hw->bus_type == e1000_bus_type_unknown) | ||
8276 | e1000_get_bus_info(hw); | ||
8277 | |||
8278 | if (hw->bus_type != e1000_bus_type_pci_express) | ||
8279 | return E1000_SUCCESS; | ||
8280 | |||
8281 | if (no_snoop) { | ||
8282 | gcr_reg = E1000_READ_REG(hw, GCR); | ||
8283 | gcr_reg &= ~(PCI_EX_NO_SNOOP_ALL); | ||
8284 | gcr_reg |= no_snoop; | ||
8285 | E1000_WRITE_REG(hw, GCR, gcr_reg); | ||
8286 | } | ||
8287 | if (hw->mac_type == e1000_ich8lan) { | ||
8288 | uint32_t ctrl_ext; | ||
8289 | |||
8290 | E1000_WRITE_REG(hw, GCR, PCI_EX_82566_SNOOP_ALL); | ||
8291 | |||
8292 | ctrl_ext = E1000_READ_REG(hw, CTRL_EXT); | ||
8293 | ctrl_ext |= E1000_CTRL_EXT_RO_DIS; | ||
8294 | E1000_WRITE_REG(hw, CTRL_EXT, ctrl_ext); | ||
8295 | } | ||
8296 | |||
8297 | return E1000_SUCCESS; | ||
8298 | } | ||
8299 | |||
8300 | /*************************************************************************** | ||
8301 | * | ||
8302 | * Get software semaphore FLAG bit (SWFLAG). | ||
8303 | * SWFLAG is used to synchronize the access to all shared resource between | ||
8304 | * SW, FW and HW. | ||
8305 | * | ||
8306 | * hw: Struct containing variables accessed by shared code | ||
8307 | * | ||
8308 | ***************************************************************************/ | ||
8309 | int32_t | ||
8310 | e1000_get_software_flag(struct e1000_hw *hw) | ||
8311 | { | ||
8312 | int32_t timeout = PHY_CFG_TIMEOUT; | ||
8313 | uint32_t extcnf_ctrl; | ||
8314 | |||
8315 | DEBUGFUNC("e1000_get_software_flag"); | ||
8316 | |||
8317 | if (hw->mac_type == e1000_ich8lan) { | ||
8318 | while (timeout) { | ||
8319 | extcnf_ctrl = E1000_READ_REG(hw, EXTCNF_CTRL); | ||
8320 | extcnf_ctrl |= E1000_EXTCNF_CTRL_SWFLAG; | ||
8321 | E1000_WRITE_REG(hw, EXTCNF_CTRL, extcnf_ctrl); | ||
8322 | |||
8323 | extcnf_ctrl = E1000_READ_REG(hw, EXTCNF_CTRL); | ||
8324 | if (extcnf_ctrl & E1000_EXTCNF_CTRL_SWFLAG) | ||
8325 | break; | ||
8326 | msec_delay_irq(1); | ||
8327 | timeout--; | ||
8328 | } | ||
8329 | |||
8330 | if (!timeout) { | ||
8331 | DEBUGOUT("FW or HW locks the resource too long.\n"); | ||
8332 | return -E1000_ERR_CONFIG; | ||
8333 | } | ||
8334 | } | ||
8335 | |||
8336 | return E1000_SUCCESS; | ||
8337 | } | ||
8338 | |||
8339 | /*************************************************************************** | ||
8340 | * | ||
8341 | * Release software semaphore FLAG bit (SWFLAG). | ||
8342 | * SWFLAG is used to synchronize the access to all shared resource between | ||
8343 | * SW, FW and HW. | ||
8344 | * | ||
8345 | * hw: Struct containing variables accessed by shared code | ||
8346 | * | ||
8347 | ***************************************************************************/ | ||
8348 | void | ||
8349 | e1000_release_software_flag(struct e1000_hw *hw) | ||
8350 | { | ||
8351 | uint32_t extcnf_ctrl; | ||
8352 | |||
8353 | DEBUGFUNC("e1000_release_software_flag"); | ||
8354 | |||
8355 | if (hw->mac_type == e1000_ich8lan) { | ||
8356 | extcnf_ctrl= E1000_READ_REG(hw, EXTCNF_CTRL); | ||
8357 | extcnf_ctrl &= ~E1000_EXTCNF_CTRL_SWFLAG; | ||
8358 | E1000_WRITE_REG(hw, EXTCNF_CTRL, extcnf_ctrl); | ||
8359 | } | ||
8360 | |||
8361 | return; | ||
8362 | } | ||
8363 | |||
8364 | /*************************************************************************** | ||
8365 | * | ||
8366 | * Disable dynamic power down mode in ife PHY. | ||
8367 | * It can be used to workaround band-gap problem. | ||
8368 | * | ||
8369 | * hw: Struct containing variables accessed by shared code | ||
8370 | * | ||
8371 | ***************************************************************************/ | ||
8372 | int32_t | ||
8373 | e1000_ife_disable_dynamic_power_down(struct e1000_hw *hw) | ||
8374 | { | ||
8375 | uint16_t phy_data; | ||
8376 | int32_t ret_val = E1000_SUCCESS; | ||
8377 | |||
8378 | DEBUGFUNC("e1000_ife_disable_dynamic_power_down"); | ||
8379 | |||
8380 | if (hw->phy_type == e1000_phy_ife) { | ||
8381 | ret_val = e1000_read_phy_reg(hw, IFE_PHY_SPECIAL_CONTROL, &phy_data); | ||
8382 | if (ret_val) | ||
8383 | return ret_val; | ||
8384 | |||
8385 | phy_data |= IFE_PSC_DISABLE_DYNAMIC_POWER_DOWN; | ||
8386 | ret_val = e1000_write_phy_reg(hw, IFE_PHY_SPECIAL_CONTROL, phy_data); | ||
8387 | } | ||
8388 | |||
8389 | return ret_val; | ||
8390 | } | ||
8391 | |||
8392 | /*************************************************************************** | ||
8393 | * | ||
8394 | * Enable dynamic power down mode in ife PHY. | ||
8395 | * It can be used to workaround band-gap problem. | ||
8396 | * | ||
8397 | * hw: Struct containing variables accessed by shared code | ||
8398 | * | ||
8399 | ***************************************************************************/ | ||
8400 | int32_t | ||
8401 | e1000_ife_enable_dynamic_power_down(struct e1000_hw *hw) | ||
8402 | { | ||
8403 | uint16_t phy_data; | ||
8404 | int32_t ret_val = E1000_SUCCESS; | ||
8405 | |||
8406 | DEBUGFUNC("e1000_ife_enable_dynamic_power_down"); | ||
8407 | |||
8408 | if (hw->phy_type == e1000_phy_ife) { | ||
8409 | ret_val = e1000_read_phy_reg(hw, IFE_PHY_SPECIAL_CONTROL, &phy_data); | ||
8410 | if (ret_val) | ||
8411 | return ret_val; | ||
8412 | |||
8413 | phy_data &= ~IFE_PSC_DISABLE_DYNAMIC_POWER_DOWN; | ||
8414 | ret_val = e1000_write_phy_reg(hw, IFE_PHY_SPECIAL_CONTROL, phy_data); | ||
8415 | } | ||
8416 | |||
8417 | return ret_val; | ||
8418 | } | ||
8419 | |||
8420 | /****************************************************************************** | ||
8421 | * Reads a 16 bit word or words from the EEPROM using the ICH8's flash access | ||
8422 | * register. | ||
8423 | * | ||
8424 | * hw - Struct containing variables accessed by shared code | ||
8425 | * offset - offset of word in the EEPROM to read | ||
8426 | * data - word read from the EEPROM | ||
8427 | * words - number of words to read | ||
8428 | *****************************************************************************/ | ||
8429 | int32_t | ||
8430 | e1000_read_eeprom_ich8(struct e1000_hw *hw, uint16_t offset, uint16_t words, | ||
8431 | uint16_t *data) | ||
8432 | { | ||
8433 | int32_t error = E1000_SUCCESS; | ||
8434 | uint32_t flash_bank = 0; | ||
8435 | uint32_t act_offset = 0; | ||
8436 | uint32_t bank_offset = 0; | ||
8437 | uint16_t word = 0; | ||
8438 | uint16_t i = 0; | ||
8439 | |||
8440 | /* We need to know which is the valid flash bank. In the event | ||
8441 | * that we didn't allocate eeprom_shadow_ram, we may not be | ||
8442 | * managing flash_bank. So it cannot be trusted and needs | ||
8443 | * to be updated with each read. | ||
8444 | */ | ||
8445 | /* Value of bit 22 corresponds to the flash bank we're on. */ | ||
8446 | flash_bank = (E1000_READ_REG(hw, EECD) & E1000_EECD_SEC1VAL) ? 1 : 0; | ||
8447 | |||
8448 | /* Adjust offset appropriately if we're on bank 1 - adjust for word size */ | ||
8449 | bank_offset = flash_bank * (hw->flash_bank_size * 2); | ||
8450 | |||
8451 | error = e1000_get_software_flag(hw); | ||
8452 | if (error != E1000_SUCCESS) | ||
8453 | return error; | ||
8454 | |||
8455 | for (i = 0; i < words; i++) { | ||
8456 | if (hw->eeprom_shadow_ram != NULL && | ||
8457 | hw->eeprom_shadow_ram[offset+i].modified == TRUE) { | ||
8458 | data[i] = hw->eeprom_shadow_ram[offset+i].eeprom_word; | ||
8459 | } else { | ||
8460 | /* The NVM part needs a byte offset, hence * 2 */ | ||
8461 | act_offset = bank_offset + ((offset + i) * 2); | ||
8462 | error = e1000_read_ich8_word(hw, act_offset, &word); | ||
8463 | if (error != E1000_SUCCESS) | ||
8464 | break; | ||
8465 | data[i] = word; | ||
8466 | } | ||
8467 | } | ||
8468 | |||
8469 | e1000_release_software_flag(hw); | ||
8470 | |||
8471 | return error; | ||
8472 | } | ||
8473 | |||
8474 | /****************************************************************************** | ||
8475 | * Writes a 16 bit word or words to the EEPROM using the ICH8's flash access | ||
8476 | * register. Actually, writes are written to the shadow ram cache in the hw | ||
8477 | * structure hw->e1000_shadow_ram. e1000_commit_shadow_ram flushes this to | ||
8478 | * the NVM, which occurs when the NVM checksum is updated. | ||
8479 | * | ||
8480 | * hw - Struct containing variables accessed by shared code | ||
8481 | * offset - offset of word in the EEPROM to write | ||
8482 | * words - number of words to write | ||
8483 | * data - words to write to the EEPROM | ||
8484 | *****************************************************************************/ | ||
8485 | int32_t | ||
8486 | e1000_write_eeprom_ich8(struct e1000_hw *hw, uint16_t offset, uint16_t words, | ||
8487 | uint16_t *data) | ||
8488 | { | ||
8489 | uint32_t i = 0; | ||
8490 | int32_t error = E1000_SUCCESS; | ||
8491 | |||
8492 | error = e1000_get_software_flag(hw); | ||
8493 | if (error != E1000_SUCCESS) | ||
8494 | return error; | ||
8495 | |||
8496 | /* A driver can write to the NVM only if it has eeprom_shadow_ram | ||
8497 | * allocated. Subsequent reads to the modified words are read from | ||
8498 | * this cached structure as well. Writes will only go into this | ||
8499 | * cached structure unless it's followed by a call to | ||
8500 | * e1000_update_eeprom_checksum() where it will commit the changes | ||
8501 | * and clear the "modified" field. | ||
8502 | */ | ||
8503 | if (hw->eeprom_shadow_ram != NULL) { | ||
8504 | for (i = 0; i < words; i++) { | ||
8505 | if ((offset + i) < E1000_SHADOW_RAM_WORDS) { | ||
8506 | hw->eeprom_shadow_ram[offset+i].modified = TRUE; | ||
8507 | hw->eeprom_shadow_ram[offset+i].eeprom_word = data[i]; | ||
8508 | } else { | ||
8509 | error = -E1000_ERR_EEPROM; | ||
8510 | break; | ||
8511 | } | ||
8512 | } | ||
8513 | } else { | ||
8514 | /* Drivers have the option to not allocate eeprom_shadow_ram as long | ||
8515 | * as they don't perform any NVM writes. An attempt in doing so | ||
8516 | * will result in this error. | ||
8517 | */ | ||
8518 | error = -E1000_ERR_EEPROM; | ||
8519 | } | ||
8520 | |||
8521 | e1000_release_software_flag(hw); | ||
8522 | |||
8523 | return error; | ||
8524 | } | ||
8525 | |||
8526 | /****************************************************************************** | ||
8527 | * This function does initial flash setup so that a new read/write/erase cycle | ||
8528 | * can be started. | ||
8529 | * | ||
8530 | * hw - The pointer to the hw structure | ||
8531 | ****************************************************************************/ | ||
8532 | int32_t | ||
8533 | e1000_ich8_cycle_init(struct e1000_hw *hw) | ||
8534 | { | ||
8535 | union ich8_hws_flash_status hsfsts; | ||
8536 | int32_t error = E1000_ERR_EEPROM; | ||
8537 | int32_t i = 0; | ||
8538 | |||
8539 | DEBUGFUNC("e1000_ich8_cycle_init"); | ||
8540 | |||
8541 | hsfsts.regval = E1000_READ_ICH8_REG16(hw, ICH8_FLASH_HSFSTS); | ||
8542 | |||
8543 | /* May be check the Flash Des Valid bit in Hw status */ | ||
8544 | if (hsfsts.hsf_status.fldesvalid == 0) { | ||
8545 | DEBUGOUT("Flash descriptor invalid. SW Sequencing must be used."); | ||
8546 | return error; | ||
8547 | } | ||
8548 | |||
8549 | /* Clear FCERR in Hw status by writing 1 */ | ||
8550 | /* Clear DAEL in Hw status by writing a 1 */ | ||
8551 | hsfsts.hsf_status.flcerr = 1; | ||
8552 | hsfsts.hsf_status.dael = 1; | ||
8553 | |||
8554 | E1000_WRITE_ICH8_REG16(hw, ICH8_FLASH_HSFSTS, hsfsts.regval); | ||
8555 | |||
8556 | /* Either we should have a hardware SPI cycle in progress bit to check | ||
8557 | * against, in order to start a new cycle or FDONE bit should be changed | ||
8558 | * in the hardware so that it is 1 after harware reset, which can then be | ||
8559 | * used as an indication whether a cycle is in progress or has been | ||
8560 | * completed .. we should also have some software semaphore mechanism to | ||
8561 | * guard FDONE or the cycle in progress bit so that two threads access to | ||
8562 | * those bits can be sequentiallized or a way so that 2 threads dont | ||
8563 | * start the cycle at the same time */ | ||
8564 | |||
8565 | if (hsfsts.hsf_status.flcinprog == 0) { | ||
8566 | /* There is no cycle running at present, so we can start a cycle */ | ||
8567 | /* Begin by setting Flash Cycle Done. */ | ||
8568 | hsfsts.hsf_status.flcdone = 1; | ||
8569 | E1000_WRITE_ICH8_REG16(hw, ICH8_FLASH_HSFSTS, hsfsts.regval); | ||
8570 | error = E1000_SUCCESS; | ||
8571 | } else { | ||
8572 | /* otherwise poll for sometime so the current cycle has a chance | ||
8573 | * to end before giving up. */ | ||
8574 | for (i = 0; i < ICH8_FLASH_COMMAND_TIMEOUT; i++) { | ||
8575 | hsfsts.regval = E1000_READ_ICH8_REG16(hw, ICH8_FLASH_HSFSTS); | ||
8576 | if (hsfsts.hsf_status.flcinprog == 0) { | ||
8577 | error = E1000_SUCCESS; | ||
8578 | break; | ||
8579 | } | ||
8580 | udelay(1); | ||
8581 | } | ||
8582 | if (error == E1000_SUCCESS) { | ||
8583 | /* Successful in waiting for previous cycle to timeout, | ||
8584 | * now set the Flash Cycle Done. */ | ||
8585 | hsfsts.hsf_status.flcdone = 1; | ||
8586 | E1000_WRITE_ICH8_REG16(hw, ICH8_FLASH_HSFSTS, hsfsts.regval); | ||
8587 | } else { | ||
8588 | DEBUGOUT("Flash controller busy, cannot get access"); | ||
8589 | } | ||
8590 | } | ||
8591 | return error; | ||
8592 | } | ||
8593 | |||
8594 | /****************************************************************************** | ||
8595 | * This function starts a flash cycle and waits for its completion | ||
8596 | * | ||
8597 | * hw - The pointer to the hw structure | ||
8598 | ****************************************************************************/ | ||
8599 | int32_t | ||
8600 | e1000_ich8_flash_cycle(struct e1000_hw *hw, uint32_t timeout) | ||
8601 | { | ||
8602 | union ich8_hws_flash_ctrl hsflctl; | ||
8603 | union ich8_hws_flash_status hsfsts; | ||
8604 | int32_t error = E1000_ERR_EEPROM; | ||
8605 | uint32_t i = 0; | ||
8606 | |||
8607 | /* Start a cycle by writing 1 in Flash Cycle Go in Hw Flash Control */ | ||
8608 | hsflctl.regval = E1000_READ_ICH8_REG16(hw, ICH8_FLASH_HSFCTL); | ||
8609 | hsflctl.hsf_ctrl.flcgo = 1; | ||
8610 | E1000_WRITE_ICH8_REG16(hw, ICH8_FLASH_HSFCTL, hsflctl.regval); | ||
8611 | |||
8612 | /* wait till FDONE bit is set to 1 */ | ||
8613 | do { | ||
8614 | hsfsts.regval = E1000_READ_ICH8_REG16(hw, ICH8_FLASH_HSFSTS); | ||
8615 | if (hsfsts.hsf_status.flcdone == 1) | ||
8616 | break; | ||
8617 | udelay(1); | ||
8618 | i++; | ||
8619 | } while (i < timeout); | ||
8620 | if (hsfsts.hsf_status.flcdone == 1 && hsfsts.hsf_status.flcerr == 0) { | ||
8621 | error = E1000_SUCCESS; | ||
8622 | } | ||
8623 | return error; | ||
8624 | } | ||
8625 | |||
8626 | /****************************************************************************** | ||
8627 | * Reads a byte or word from the NVM using the ICH8 flash access registers. | ||
8628 | * | ||
8629 | * hw - The pointer to the hw structure | ||
8630 | * index - The index of the byte or word to read. | ||
8631 | * size - Size of data to read, 1=byte 2=word | ||
8632 | * data - Pointer to the word to store the value read. | ||
8633 | *****************************************************************************/ | ||
8634 | int32_t | ||
8635 | e1000_read_ich8_data(struct e1000_hw *hw, uint32_t index, | ||
8636 | uint32_t size, uint16_t* data) | ||
8637 | { | ||
8638 | union ich8_hws_flash_status hsfsts; | ||
8639 | union ich8_hws_flash_ctrl hsflctl; | ||
8640 | uint32_t flash_linear_address; | ||
8641 | uint32_t flash_data = 0; | ||
8642 | int32_t error = -E1000_ERR_EEPROM; | ||
8643 | int32_t count = 0; | ||
8644 | |||
8645 | DEBUGFUNC("e1000_read_ich8_data"); | ||
8646 | |||
8647 | if (size < 1 || size > 2 || data == 0x0 || | ||
8648 | index > ICH8_FLASH_LINEAR_ADDR_MASK) | ||
8649 | return error; | ||
8650 | |||
8651 | flash_linear_address = (ICH8_FLASH_LINEAR_ADDR_MASK & index) + | ||
8652 | hw->flash_base_addr; | ||
8653 | |||
8654 | do { | ||
8655 | udelay(1); | ||
8656 | /* Steps */ | ||
8657 | error = e1000_ich8_cycle_init(hw); | ||
8658 | if (error != E1000_SUCCESS) | ||
8659 | break; | ||
8660 | |||
8661 | hsflctl.regval = E1000_READ_ICH8_REG16(hw, ICH8_FLASH_HSFCTL); | ||
8662 | /* 0b/1b corresponds to 1 or 2 byte size, respectively. */ | ||
8663 | hsflctl.hsf_ctrl.fldbcount = size - 1; | ||
8664 | hsflctl.hsf_ctrl.flcycle = ICH8_CYCLE_READ; | ||
8665 | E1000_WRITE_ICH8_REG16(hw, ICH8_FLASH_HSFCTL, hsflctl.regval); | ||
8666 | |||
8667 | /* Write the last 24 bits of index into Flash Linear address field in | ||
8668 | * Flash Address */ | ||
8669 | /* TODO: TBD maybe check the index against the size of flash */ | ||
8670 | |||
8671 | E1000_WRITE_ICH8_REG(hw, ICH8_FLASH_FADDR, flash_linear_address); | ||
8672 | |||
8673 | error = e1000_ich8_flash_cycle(hw, ICH8_FLASH_COMMAND_TIMEOUT); | ||
8674 | |||
8675 | /* Check if FCERR is set to 1, if set to 1, clear it and try the whole | ||
8676 | * sequence a few more times, else read in (shift in) the Flash Data0, | ||
8677 | * the order is least significant byte first msb to lsb */ | ||
8678 | if (error == E1000_SUCCESS) { | ||
8679 | flash_data = E1000_READ_ICH8_REG(hw, ICH8_FLASH_FDATA0); | ||
8680 | if (size == 1) { | ||
8681 | *data = (uint8_t)(flash_data & 0x000000FF); | ||
8682 | } else if (size == 2) { | ||
8683 | *data = (uint16_t)(flash_data & 0x0000FFFF); | ||
8684 | } | ||
8685 | break; | ||
8686 | } else { | ||
8687 | /* If we've gotten here, then things are probably completely hosed, | ||
8688 | * but if the error condition is detected, it won't hurt to give | ||
8689 | * it another try...ICH8_FLASH_CYCLE_REPEAT_COUNT times. | ||
8690 | */ | ||
8691 | hsfsts.regval = E1000_READ_ICH8_REG16(hw, ICH8_FLASH_HSFSTS); | ||
8692 | if (hsfsts.hsf_status.flcerr == 1) { | ||
8693 | /* Repeat for some time before giving up. */ | ||
8694 | continue; | ||
8695 | } else if (hsfsts.hsf_status.flcdone == 0) { | ||
8696 | DEBUGOUT("Timeout error - flash cycle did not complete."); | ||
8697 | break; | ||
8698 | } | ||
8699 | } | ||
8700 | } while (count++ < ICH8_FLASH_CYCLE_REPEAT_COUNT); | ||
8701 | |||
8702 | return error; | ||
8703 | } | ||
8704 | |||
8705 | /****************************************************************************** | ||
8706 | * Writes One /two bytes to the NVM using the ICH8 flash access registers. | ||
8707 | * | ||
8708 | * hw - The pointer to the hw structure | ||
8709 | * index - The index of the byte/word to read. | ||
8710 | * size - Size of data to read, 1=byte 2=word | ||
8711 | * data - The byte(s) to write to the NVM. | ||
8712 | *****************************************************************************/ | ||
8713 | int32_t | ||
8714 | e1000_write_ich8_data(struct e1000_hw *hw, uint32_t index, uint32_t size, | ||
8715 | uint16_t data) | ||
8716 | { | ||
8717 | union ich8_hws_flash_status hsfsts; | ||
8718 | union ich8_hws_flash_ctrl hsflctl; | ||
8719 | uint32_t flash_linear_address; | ||
8720 | uint32_t flash_data = 0; | ||
8721 | int32_t error = -E1000_ERR_EEPROM; | ||
8722 | int32_t count = 0; | ||
8723 | |||
8724 | DEBUGFUNC("e1000_write_ich8_data"); | ||
8725 | |||
8726 | if (size < 1 || size > 2 || data > size * 0xff || | ||
8727 | index > ICH8_FLASH_LINEAR_ADDR_MASK) | ||
8728 | return error; | ||
8729 | |||
8730 | flash_linear_address = (ICH8_FLASH_LINEAR_ADDR_MASK & index) + | ||
8731 | hw->flash_base_addr; | ||
8732 | |||
8733 | do { | ||
8734 | udelay(1); | ||
8735 | /* Steps */ | ||
8736 | error = e1000_ich8_cycle_init(hw); | ||
8737 | if (error != E1000_SUCCESS) | ||
8738 | break; | ||
8739 | |||
8740 | hsflctl.regval = E1000_READ_ICH8_REG16(hw, ICH8_FLASH_HSFCTL); | ||
8741 | /* 0b/1b corresponds to 1 or 2 byte size, respectively. */ | ||
8742 | hsflctl.hsf_ctrl.fldbcount = size -1; | ||
8743 | hsflctl.hsf_ctrl.flcycle = ICH8_CYCLE_WRITE; | ||
8744 | E1000_WRITE_ICH8_REG16(hw, ICH8_FLASH_HSFCTL, hsflctl.regval); | ||
8745 | |||
8746 | /* Write the last 24 bits of index into Flash Linear address field in | ||
8747 | * Flash Address */ | ||
8748 | E1000_WRITE_ICH8_REG(hw, ICH8_FLASH_FADDR, flash_linear_address); | ||
8749 | |||
8750 | if (size == 1) | ||
8751 | flash_data = (uint32_t)data & 0x00FF; | ||
8752 | else | ||
8753 | flash_data = (uint32_t)data; | ||
8754 | |||
8755 | E1000_WRITE_ICH8_REG(hw, ICH8_FLASH_FDATA0, flash_data); | ||
8756 | |||
8757 | /* check if FCERR is set to 1 , if set to 1, clear it and try the whole | ||
8758 | * sequence a few more times else done */ | ||
8759 | error = e1000_ich8_flash_cycle(hw, ICH8_FLASH_COMMAND_TIMEOUT); | ||
8760 | if (error == E1000_SUCCESS) { | ||
8761 | break; | ||
8762 | } else { | ||
8763 | /* If we're here, then things are most likely completely hosed, | ||
8764 | * but if the error condition is detected, it won't hurt to give | ||
8765 | * it another try...ICH8_FLASH_CYCLE_REPEAT_COUNT times. | ||
8766 | */ | ||
8767 | hsfsts.regval = E1000_READ_ICH8_REG16(hw, ICH8_FLASH_HSFSTS); | ||
8768 | if (hsfsts.hsf_status.flcerr == 1) { | ||
8769 | /* Repeat for some time before giving up. */ | ||
8770 | continue; | ||
8771 | } else if (hsfsts.hsf_status.flcdone == 0) { | ||
8772 | DEBUGOUT("Timeout error - flash cycle did not complete."); | ||
8773 | break; | ||
8774 | } | ||
8775 | } | ||
8776 | } while (count++ < ICH8_FLASH_CYCLE_REPEAT_COUNT); | ||
8777 | |||
8778 | return error; | ||
8779 | } | ||
8780 | |||
8781 | /****************************************************************************** | ||
8782 | * Reads a single byte from the NVM using the ICH8 flash access registers. | ||
8783 | * | ||
8784 | * hw - pointer to e1000_hw structure | ||
8785 | * index - The index of the byte to read. | ||
8786 | * data - Pointer to a byte to store the value read. | ||
8787 | *****************************************************************************/ | ||
8788 | int32_t | ||
8789 | e1000_read_ich8_byte(struct e1000_hw *hw, uint32_t index, uint8_t* data) | ||
8790 | { | ||
8791 | int32_t status = E1000_SUCCESS; | ||
8792 | uint16_t word = 0; | ||
8793 | |||
8794 | status = e1000_read_ich8_data(hw, index, 1, &word); | ||
8795 | if (status == E1000_SUCCESS) { | ||
8796 | *data = (uint8_t)word; | ||
8797 | } | ||
8798 | |||
8799 | return status; | ||
8800 | } | ||
8801 | |||
8802 | /****************************************************************************** | ||
8803 | * Writes a single byte to the NVM using the ICH8 flash access registers. | ||
8804 | * Performs verification by reading back the value and then going through | ||
8805 | * a retry algorithm before giving up. | ||
8806 | * | ||
8807 | * hw - pointer to e1000_hw structure | ||
8808 | * index - The index of the byte to write. | ||
8809 | * byte - The byte to write to the NVM. | ||
8810 | *****************************************************************************/ | ||
8811 | int32_t | ||
8812 | e1000_verify_write_ich8_byte(struct e1000_hw *hw, uint32_t index, uint8_t byte) | ||
8813 | { | ||
8814 | int32_t error = E1000_SUCCESS; | ||
8815 | int32_t program_retries; | ||
8816 | uint8_t temp_byte; | ||
8817 | |||
8818 | e1000_write_ich8_byte(hw, index, byte); | ||
8819 | udelay(100); | ||
8820 | |||
8821 | for (program_retries = 0; program_retries < 100; program_retries++) { | ||
8822 | e1000_read_ich8_byte(hw, index, &temp_byte); | ||
8823 | if (temp_byte == byte) | ||
8824 | break; | ||
8825 | udelay(10); | ||
8826 | e1000_write_ich8_byte(hw, index, byte); | ||
8827 | udelay(100); | ||
8828 | } | ||
8829 | if (program_retries == 100) | ||
8830 | error = E1000_ERR_EEPROM; | ||
8831 | |||
8832 | return error; | ||
8833 | } | ||
8834 | |||
8835 | /****************************************************************************** | ||
8836 | * Writes a single byte to the NVM using the ICH8 flash access registers. | ||
8837 | * | ||
8838 | * hw - pointer to e1000_hw structure | ||
8839 | * index - The index of the byte to read. | ||
8840 | * data - The byte to write to the NVM. | ||
8841 | *****************************************************************************/ | ||
8842 | int32_t | ||
8843 | e1000_write_ich8_byte(struct e1000_hw *hw, uint32_t index, uint8_t data) | ||
8844 | { | ||
8845 | int32_t status = E1000_SUCCESS; | ||
8846 | uint16_t word = (uint16_t)data; | ||
8847 | |||
8848 | status = e1000_write_ich8_data(hw, index, 1, word); | ||
8849 | |||
8850 | return status; | ||
8851 | } | ||
8852 | |||
8853 | /****************************************************************************** | ||
8854 | * Reads a word from the NVM using the ICH8 flash access registers. | ||
8855 | * | ||
8856 | * hw - pointer to e1000_hw structure | ||
8857 | * index - The starting byte index of the word to read. | ||
8858 | * data - Pointer to a word to store the value read. | ||
8859 | *****************************************************************************/ | ||
8860 | int32_t | ||
8861 | e1000_read_ich8_word(struct e1000_hw *hw, uint32_t index, uint16_t *data) | ||
8862 | { | ||
8863 | int32_t status = E1000_SUCCESS; | ||
8864 | status = e1000_read_ich8_data(hw, index, 2, data); | ||
8865 | return status; | ||
8866 | } | ||
8867 | |||
8868 | /****************************************************************************** | ||
8869 | * Writes a word to the NVM using the ICH8 flash access registers. | ||
8870 | * | ||
8871 | * hw - pointer to e1000_hw structure | ||
8872 | * index - The starting byte index of the word to read. | ||
8873 | * data - The word to write to the NVM. | ||
8874 | *****************************************************************************/ | ||
8875 | int32_t | ||
8876 | e1000_write_ich8_word(struct e1000_hw *hw, uint32_t index, uint16_t data) | ||
8877 | { | ||
8878 | int32_t status = E1000_SUCCESS; | ||
8879 | status = e1000_write_ich8_data(hw, index, 2, data); | ||
8880 | return status; | ||
8881 | } | ||
8882 | |||
8883 | /****************************************************************************** | ||
8884 | * Erases the bank specified. Each bank is a 4k block. Segments are 0 based. | ||
8885 | * segment N is 4096 * N + flash_reg_addr. | ||
8886 | * | ||
8887 | * hw - pointer to e1000_hw structure | ||
8888 | * segment - 0 for first segment, 1 for second segment, etc. | ||
8889 | *****************************************************************************/ | ||
8890 | int32_t | ||
8891 | e1000_erase_ich8_4k_segment(struct e1000_hw *hw, uint32_t segment) | ||
8892 | { | ||
8893 | union ich8_hws_flash_status hsfsts; | ||
8894 | union ich8_hws_flash_ctrl hsflctl; | ||
8895 | uint32_t flash_linear_address; | ||
8896 | int32_t count = 0; | ||
8897 | int32_t error = E1000_ERR_EEPROM; | ||
8898 | int32_t iteration, seg_size; | ||
8899 | int32_t sector_size; | ||
8900 | int32_t j = 0; | ||
8901 | int32_t error_flag = 0; | ||
8902 | |||
8903 | hsfsts.regval = E1000_READ_ICH8_REG16(hw, ICH8_FLASH_HSFSTS); | ||
8904 | |||
8905 | /* Determine HW Sector size: Read BERASE bits of Hw flash Status register */ | ||
8906 | /* 00: The Hw sector is 256 bytes, hence we need to erase 16 | ||
8907 | * consecutive sectors. The start index for the nth Hw sector can be | ||
8908 | * calculated as = segment * 4096 + n * 256 | ||
8909 | * 01: The Hw sector is 4K bytes, hence we need to erase 1 sector. | ||
8910 | * The start index for the nth Hw sector can be calculated | ||
8911 | * as = segment * 4096 | ||
8912 | * 10: Error condition | ||
8913 | * 11: The Hw sector size is much bigger than the size asked to | ||
8914 | * erase...error condition */ | ||
8915 | if (hsfsts.hsf_status.berasesz == 0x0) { | ||
8916 | /* Hw sector size 256 */ | ||
8917 | sector_size = seg_size = ICH8_FLASH_SEG_SIZE_256; | ||
8918 | iteration = ICH8_FLASH_SECTOR_SIZE / ICH8_FLASH_SEG_SIZE_256; | ||
8919 | } else if (hsfsts.hsf_status.berasesz == 0x1) { | ||
8920 | sector_size = seg_size = ICH8_FLASH_SEG_SIZE_4K; | ||
8921 | iteration = 1; | ||
8922 | } else if (hsfsts.hsf_status.berasesz == 0x3) { | ||
8923 | sector_size = seg_size = ICH8_FLASH_SEG_SIZE_64K; | ||
8924 | iteration = 1; | ||
8925 | } else { | ||
8926 | return error; | ||
8927 | } | ||
8928 | |||
8929 | for (j = 0; j < iteration ; j++) { | ||
8930 | do { | ||
8931 | count++; | ||
8932 | /* Steps */ | ||
8933 | error = e1000_ich8_cycle_init(hw); | ||
8934 | if (error != E1000_SUCCESS) { | ||
8935 | error_flag = 1; | ||
8936 | break; | ||
8937 | } | ||
8938 | |||
8939 | /* Write a value 11 (block Erase) in Flash Cycle field in Hw flash | ||
8940 | * Control */ | ||
8941 | hsflctl.regval = E1000_READ_ICH8_REG16(hw, ICH8_FLASH_HSFCTL); | ||
8942 | hsflctl.hsf_ctrl.flcycle = ICH8_CYCLE_ERASE; | ||
8943 | E1000_WRITE_ICH8_REG16(hw, ICH8_FLASH_HSFCTL, hsflctl.regval); | ||
8944 | |||
8945 | /* Write the last 24 bits of an index within the block into Flash | ||
8946 | * Linear address field in Flash Address. This probably needs to | ||
8947 | * be calculated here based off the on-chip segment size and the | ||
8948 | * software segment size assumed (4K) */ | ||
8949 | /* TBD */ | ||
8950 | flash_linear_address = segment * sector_size + j * seg_size; | ||
8951 | flash_linear_address &= ICH8_FLASH_LINEAR_ADDR_MASK; | ||
8952 | flash_linear_address += hw->flash_base_addr; | ||
8953 | |||
8954 | E1000_WRITE_ICH8_REG(hw, ICH8_FLASH_FADDR, flash_linear_address); | ||
8955 | |||
8956 | error = e1000_ich8_flash_cycle(hw, 1000000); | ||
8957 | /* Check if FCERR is set to 1. If 1, clear it and try the whole | ||
8958 | * sequence a few more times else Done */ | ||
8959 | if (error == E1000_SUCCESS) { | ||
8960 | break; | ||
8961 | } else { | ||
8962 | hsfsts.regval = E1000_READ_ICH8_REG16(hw, ICH8_FLASH_HSFSTS); | ||
8963 | if (hsfsts.hsf_status.flcerr == 1) { | ||
8964 | /* repeat for some time before giving up */ | ||
8965 | continue; | ||
8966 | } else if (hsfsts.hsf_status.flcdone == 0) { | ||
8967 | error_flag = 1; | ||
8968 | break; | ||
8969 | } | ||
8970 | } | ||
8971 | } while ((count < ICH8_FLASH_CYCLE_REPEAT_COUNT) && !error_flag); | ||
8972 | if (error_flag == 1) | ||
8973 | break; | ||
8974 | } | ||
8975 | if (error_flag != 1) | ||
8976 | error = E1000_SUCCESS; | ||
8977 | return error; | ||
8978 | } | ||
8979 | |||
8980 | /****************************************************************************** | ||
8981 | * | ||
8982 | * Reverse duplex setting without breaking the link. | ||
8983 | * | ||
8984 | * hw: Struct containing variables accessed by shared code | ||
8985 | * | ||
8986 | *****************************************************************************/ | ||
8987 | int32_t | ||
8988 | e1000_duplex_reversal(struct e1000_hw *hw) | ||
8989 | { | ||
8990 | int32_t ret_val; | ||
8991 | uint16_t phy_data; | ||
8992 | |||
8993 | if (hw->phy_type != e1000_phy_igp_3) | ||
8994 | return E1000_SUCCESS; | ||
8995 | |||
8996 | ret_val = e1000_read_phy_reg(hw, PHY_CTRL, &phy_data); | ||
8997 | if (ret_val) | ||
8998 | return ret_val; | ||
8999 | |||
9000 | phy_data ^= MII_CR_FULL_DUPLEX; | ||
9001 | |||
9002 | ret_val = e1000_write_phy_reg(hw, PHY_CTRL, phy_data); | ||
9003 | if (ret_val) | ||
9004 | return ret_val; | ||
9005 | |||
9006 | ret_val = e1000_read_phy_reg(hw, IGP3E1000_PHY_MISC_CTRL, &phy_data); | ||
9007 | if (ret_val) | ||
9008 | return ret_val; | ||
9009 | |||
9010 | phy_data |= IGP3_PHY_MISC_DUPLEX_MANUAL_SET; | ||
9011 | ret_val = e1000_write_phy_reg(hw, IGP3E1000_PHY_MISC_CTRL, phy_data); | ||
9012 | |||
9013 | return ret_val; | ||
9014 | } | ||
9015 | |||
9016 | int32_t | ||
9017 | e1000_init_lcd_from_nvm_config_region(struct e1000_hw *hw, | ||
9018 | uint32_t cnf_base_addr, uint32_t cnf_size) | ||
9019 | { | ||
9020 | uint32_t ret_val = E1000_SUCCESS; | ||
9021 | uint16_t word_addr, reg_data, reg_addr; | ||
9022 | uint16_t i; | ||
9023 | |||
9024 | /* cnf_base_addr is in DWORD */ | ||
9025 | word_addr = (uint16_t)(cnf_base_addr << 1); | ||
9026 | |||
9027 | /* cnf_size is returned in size of dwords */ | ||
9028 | for (i = 0; i < cnf_size; i++) { | ||
9029 | ret_val = e1000_read_eeprom(hw, (word_addr + i*2), 1, ®_data); | ||
9030 | if (ret_val) | ||
9031 | return ret_val; | ||
9032 | |||
9033 | ret_val = e1000_read_eeprom(hw, (word_addr + i*2 + 1), 1, ®_addr); | ||
9034 | if (ret_val) | ||
9035 | return ret_val; | ||
9036 | |||
9037 | ret_val = e1000_get_software_flag(hw); | ||
9038 | if (ret_val != E1000_SUCCESS) | ||
9039 | return ret_val; | ||
9040 | |||
9041 | ret_val = e1000_write_phy_reg_ex(hw, (uint32_t)reg_addr, reg_data); | ||
9042 | |||
9043 | e1000_release_software_flag(hw); | ||
9044 | } | ||
9045 | |||
9046 | return ret_val; | ||
9047 | } | ||
9048 | |||
9049 | |||
9050 | int32_t | ||
9051 | e1000_init_lcd_from_nvm(struct e1000_hw *hw) | ||
9052 | { | ||
9053 | uint32_t reg_data, cnf_base_addr, cnf_size, ret_val, loop; | ||
9054 | |||
9055 | if (hw->phy_type != e1000_phy_igp_3) | ||
9056 | return E1000_SUCCESS; | ||
9057 | |||
9058 | /* Check if SW needs configure the PHY */ | ||
9059 | reg_data = E1000_READ_REG(hw, FEXTNVM); | ||
9060 | if (!(reg_data & FEXTNVM_SW_CONFIG)) | ||
9061 | return E1000_SUCCESS; | ||
9062 | |||
9063 | /* Wait for basic configuration completes before proceeding*/ | ||
9064 | loop = 0; | ||
9065 | do { | ||
9066 | reg_data = E1000_READ_REG(hw, STATUS) & E1000_STATUS_LAN_INIT_DONE; | ||
9067 | udelay(100); | ||
9068 | loop++; | ||
9069 | } while ((!reg_data) && (loop < 50)); | ||
9070 | |||
9071 | /* Clear the Init Done bit for the next init event */ | ||
9072 | reg_data = E1000_READ_REG(hw, STATUS); | ||
9073 | reg_data &= ~E1000_STATUS_LAN_INIT_DONE; | ||
9074 | E1000_WRITE_REG(hw, STATUS, reg_data); | ||
9075 | |||
9076 | /* Make sure HW does not configure LCD from PHY extended configuration | ||
9077 | before SW configuration */ | ||
9078 | reg_data = E1000_READ_REG(hw, EXTCNF_CTRL); | ||
9079 | if ((reg_data & E1000_EXTCNF_CTRL_LCD_WRITE_ENABLE) == 0x0000) { | ||
9080 | reg_data = E1000_READ_REG(hw, EXTCNF_SIZE); | ||
9081 | cnf_size = reg_data & E1000_EXTCNF_SIZE_EXT_PCIE_LENGTH; | ||
9082 | cnf_size >>= 16; | ||
9083 | if (cnf_size) { | ||
9084 | reg_data = E1000_READ_REG(hw, EXTCNF_CTRL); | ||
9085 | cnf_base_addr = reg_data & E1000_EXTCNF_CTRL_EXT_CNF_POINTER; | ||
9086 | /* cnf_base_addr is in DWORD */ | ||
9087 | cnf_base_addr >>= 16; | ||
9088 | |||
9089 | /* Configure LCD from extended configuration region. */ | ||
9090 | ret_val = e1000_init_lcd_from_nvm_config_region(hw, cnf_base_addr, | ||
9091 | cnf_size); | ||
9092 | if (ret_val) | ||
9093 | return ret_val; | ||
9094 | } | ||
9095 | } | ||
9096 | |||
9097 | return E1000_SUCCESS; | ||
9098 | } | ||
9099 | |||
9100 | |||
7559 | 9101 | ||
diff --git a/drivers/net/e1000/e1000_hw.h b/drivers/net/e1000/e1000_hw.h index 467c9ed944f8..f9341e3276b3 100644 --- a/drivers/net/e1000/e1000_hw.h +++ b/drivers/net/e1000/e1000_hw.h | |||
@@ -62,6 +62,7 @@ typedef enum { | |||
62 | e1000_82572, | 62 | e1000_82572, |
63 | e1000_82573, | 63 | e1000_82573, |
64 | e1000_80003es2lan, | 64 | e1000_80003es2lan, |
65 | e1000_ich8lan, | ||
65 | e1000_num_macs | 66 | e1000_num_macs |
66 | } e1000_mac_type; | 67 | } e1000_mac_type; |
67 | 68 | ||
@@ -70,6 +71,7 @@ typedef enum { | |||
70 | e1000_eeprom_spi, | 71 | e1000_eeprom_spi, |
71 | e1000_eeprom_microwire, | 72 | e1000_eeprom_microwire, |
72 | e1000_eeprom_flash, | 73 | e1000_eeprom_flash, |
74 | e1000_eeprom_ich8, | ||
73 | e1000_eeprom_none, /* No NVM support */ | 75 | e1000_eeprom_none, /* No NVM support */ |
74 | e1000_num_eeprom_types | 76 | e1000_num_eeprom_types |
75 | } e1000_eeprom_type; | 77 | } e1000_eeprom_type; |
@@ -98,6 +100,11 @@ typedef enum { | |||
98 | e1000_fc_default = 0xFF | 100 | e1000_fc_default = 0xFF |
99 | } e1000_fc_type; | 101 | } e1000_fc_type; |
100 | 102 | ||
103 | struct e1000_shadow_ram { | ||
104 | uint16_t eeprom_word; | ||
105 | boolean_t modified; | ||
106 | }; | ||
107 | |||
101 | /* PCI bus types */ | 108 | /* PCI bus types */ |
102 | typedef enum { | 109 | typedef enum { |
103 | e1000_bus_type_unknown = 0, | 110 | e1000_bus_type_unknown = 0, |
@@ -218,6 +225,8 @@ typedef enum { | |||
218 | e1000_phy_igp, | 225 | e1000_phy_igp, |
219 | e1000_phy_igp_2, | 226 | e1000_phy_igp_2, |
220 | e1000_phy_gg82563, | 227 | e1000_phy_gg82563, |
228 | e1000_phy_igp_3, | ||
229 | e1000_phy_ife, | ||
221 | e1000_phy_undefined = 0xFF | 230 | e1000_phy_undefined = 0xFF |
222 | } e1000_phy_type; | 231 | } e1000_phy_type; |
223 | 232 | ||
@@ -313,6 +322,10 @@ int32_t e1000_read_phy_reg(struct e1000_hw *hw, uint32_t reg_addr, uint16_t *phy | |||
313 | int32_t e1000_write_phy_reg(struct e1000_hw *hw, uint32_t reg_addr, uint16_t data); | 322 | int32_t e1000_write_phy_reg(struct e1000_hw *hw, uint32_t reg_addr, uint16_t data); |
314 | int32_t e1000_phy_hw_reset(struct e1000_hw *hw); | 323 | int32_t e1000_phy_hw_reset(struct e1000_hw *hw); |
315 | int32_t e1000_phy_reset(struct e1000_hw *hw); | 324 | int32_t e1000_phy_reset(struct e1000_hw *hw); |
325 | void e1000_phy_powerdown_workaround(struct e1000_hw *hw); | ||
326 | int32_t e1000_kumeran_lock_loss_workaround(struct e1000_hw *hw); | ||
327 | int32_t e1000_init_lcd_from_nvm_config_region(struct e1000_hw *hw, uint32_t cnf_base_addr, uint32_t cnf_size); | ||
328 | int32_t e1000_init_lcd_from_nvm(struct e1000_hw *hw); | ||
316 | int32_t e1000_phy_get_info(struct e1000_hw *hw, struct e1000_phy_info *phy_info); | 329 | int32_t e1000_phy_get_info(struct e1000_hw *hw, struct e1000_phy_info *phy_info); |
317 | int32_t e1000_validate_mdi_setting(struct e1000_hw *hw); | 330 | int32_t e1000_validate_mdi_setting(struct e1000_hw *hw); |
318 | int32_t e1000_read_kmrn_reg(struct e1000_hw *hw, uint32_t reg_addr, uint16_t *data); | 331 | int32_t e1000_read_kmrn_reg(struct e1000_hw *hw, uint32_t reg_addr, uint16_t *data); |
@@ -331,6 +344,7 @@ uint32_t e1000_enable_mng_pass_thru(struct e1000_hw *hw); | |||
331 | #define E1000_MNG_DHCP_COOKIE_OFFSET 0x6F0 /* Cookie offset */ | 344 | #define E1000_MNG_DHCP_COOKIE_OFFSET 0x6F0 /* Cookie offset */ |
332 | #define E1000_MNG_DHCP_COOKIE_LENGTH 0x10 /* Cookie length */ | 345 | #define E1000_MNG_DHCP_COOKIE_LENGTH 0x10 /* Cookie length */ |
333 | #define E1000_MNG_IAMT_MODE 0x3 | 346 | #define E1000_MNG_IAMT_MODE 0x3 |
347 | #define E1000_MNG_ICH_IAMT_MODE 0x2 | ||
334 | #define E1000_IAMT_SIGNATURE 0x544D4149 /* Intel(R) Active Management Technology signature */ | 348 | #define E1000_IAMT_SIGNATURE 0x544D4149 /* Intel(R) Active Management Technology signature */ |
335 | 349 | ||
336 | #define E1000_MNG_DHCP_COOKIE_STATUS_PARSING_SUPPORT 0x1 /* DHCP parsing enabled */ | 350 | #define E1000_MNG_DHCP_COOKIE_STATUS_PARSING_SUPPORT 0x1 /* DHCP parsing enabled */ |
@@ -388,6 +402,8 @@ int32_t e1000_read_part_num(struct e1000_hw *hw, uint32_t * part_num); | |||
388 | int32_t e1000_read_mac_addr(struct e1000_hw * hw); | 402 | int32_t e1000_read_mac_addr(struct e1000_hw * hw); |
389 | int32_t e1000_swfw_sync_acquire(struct e1000_hw *hw, uint16_t mask); | 403 | int32_t e1000_swfw_sync_acquire(struct e1000_hw *hw, uint16_t mask); |
390 | void e1000_swfw_sync_release(struct e1000_hw *hw, uint16_t mask); | 404 | void e1000_swfw_sync_release(struct e1000_hw *hw, uint16_t mask); |
405 | void e1000_release_software_flag(struct e1000_hw *hw); | ||
406 | int32_t e1000_get_software_flag(struct e1000_hw *hw); | ||
391 | 407 | ||
392 | /* Filters (multicast, vlan, receive) */ | 408 | /* Filters (multicast, vlan, receive) */ |
393 | void e1000_mc_addr_list_update(struct e1000_hw *hw, uint8_t * mc_addr_list, uint32_t mc_addr_count, uint32_t pad, uint32_t rar_used_count); | 409 | void e1000_mc_addr_list_update(struct e1000_hw *hw, uint8_t * mc_addr_list, uint32_t mc_addr_count, uint32_t pad, uint32_t rar_used_count); |
@@ -401,6 +417,7 @@ int32_t e1000_setup_led(struct e1000_hw *hw); | |||
401 | int32_t e1000_cleanup_led(struct e1000_hw *hw); | 417 | int32_t e1000_cleanup_led(struct e1000_hw *hw); |
402 | int32_t e1000_led_on(struct e1000_hw *hw); | 418 | int32_t e1000_led_on(struct e1000_hw *hw); |
403 | int32_t e1000_led_off(struct e1000_hw *hw); | 419 | int32_t e1000_led_off(struct e1000_hw *hw); |
420 | int32_t e1000_blink_led_start(struct e1000_hw *hw); | ||
404 | 421 | ||
405 | /* Adaptive IFS Functions */ | 422 | /* Adaptive IFS Functions */ |
406 | 423 | ||
@@ -422,6 +439,29 @@ int32_t e1000_disable_pciex_master(struct e1000_hw *hw); | |||
422 | int32_t e1000_get_software_semaphore(struct e1000_hw *hw); | 439 | int32_t e1000_get_software_semaphore(struct e1000_hw *hw); |
423 | void e1000_release_software_semaphore(struct e1000_hw *hw); | 440 | void e1000_release_software_semaphore(struct e1000_hw *hw); |
424 | int32_t e1000_check_phy_reset_block(struct e1000_hw *hw); | 441 | int32_t e1000_check_phy_reset_block(struct e1000_hw *hw); |
442 | int32_t e1000_set_pci_ex_no_snoop(struct e1000_hw *hw, uint32_t no_snoop); | ||
443 | |||
444 | int32_t e1000_read_ich8_byte(struct e1000_hw *hw, uint32_t index, | ||
445 | uint8_t *data); | ||
446 | int32_t e1000_verify_write_ich8_byte(struct e1000_hw *hw, uint32_t index, | ||
447 | uint8_t byte); | ||
448 | int32_t e1000_write_ich8_byte(struct e1000_hw *hw, uint32_t index, | ||
449 | uint8_t byte); | ||
450 | int32_t e1000_read_ich8_word(struct e1000_hw *hw, uint32_t index, | ||
451 | uint16_t *data); | ||
452 | int32_t e1000_read_ich8_data(struct e1000_hw *hw, uint32_t index, | ||
453 | uint32_t size, uint16_t *data); | ||
454 | int32_t e1000_read_eeprom_ich8(struct e1000_hw *hw, uint16_t offset, | ||
455 | uint16_t words, uint16_t *data); | ||
456 | int32_t e1000_write_eeprom_ich8(struct e1000_hw *hw, uint16_t offset, | ||
457 | uint16_t words, uint16_t *data); | ||
458 | int32_t e1000_erase_ich8_4k_segment(struct e1000_hw *hw, uint32_t segment); | ||
459 | |||
460 | |||
461 | #define E1000_READ_REG_IO(a, reg) \ | ||
462 | e1000_read_reg_io((a), E1000_##reg) | ||
463 | #define E1000_WRITE_REG_IO(a, reg, val) \ | ||
464 | e1000_write_reg_io((a), E1000_##reg, val) | ||
425 | 465 | ||
426 | /* PCI Device IDs */ | 466 | /* PCI Device IDs */ |
427 | #define E1000_DEV_ID_82542 0x1000 | 467 | #define E1000_DEV_ID_82542 0x1000 |
@@ -446,6 +486,7 @@ int32_t e1000_check_phy_reset_block(struct e1000_hw *hw); | |||
446 | #define E1000_DEV_ID_82546EB_QUAD_COPPER 0x101D | 486 | #define E1000_DEV_ID_82546EB_QUAD_COPPER 0x101D |
447 | #define E1000_DEV_ID_82541EI 0x1013 | 487 | #define E1000_DEV_ID_82541EI 0x1013 |
448 | #define E1000_DEV_ID_82541EI_MOBILE 0x1018 | 488 | #define E1000_DEV_ID_82541EI_MOBILE 0x1018 |
489 | #define E1000_DEV_ID_82541ER_LOM 0x1014 | ||
449 | #define E1000_DEV_ID_82541ER 0x1078 | 490 | #define E1000_DEV_ID_82541ER 0x1078 |
450 | #define E1000_DEV_ID_82547GI 0x1075 | 491 | #define E1000_DEV_ID_82547GI 0x1075 |
451 | #define E1000_DEV_ID_82541GI 0x1076 | 492 | #define E1000_DEV_ID_82541GI 0x1076 |
@@ -457,18 +498,28 @@ int32_t e1000_check_phy_reset_block(struct e1000_hw *hw); | |||
457 | #define E1000_DEV_ID_82546GB_PCIE 0x108A | 498 | #define E1000_DEV_ID_82546GB_PCIE 0x108A |
458 | #define E1000_DEV_ID_82546GB_QUAD_COPPER 0x1099 | 499 | #define E1000_DEV_ID_82546GB_QUAD_COPPER 0x1099 |
459 | #define E1000_DEV_ID_82547EI 0x1019 | 500 | #define E1000_DEV_ID_82547EI 0x1019 |
501 | #define E1000_DEV_ID_82547EI_MOBILE 0x101A | ||
460 | #define E1000_DEV_ID_82571EB_COPPER 0x105E | 502 | #define E1000_DEV_ID_82571EB_COPPER 0x105E |
461 | #define E1000_DEV_ID_82571EB_FIBER 0x105F | 503 | #define E1000_DEV_ID_82571EB_FIBER 0x105F |
462 | #define E1000_DEV_ID_82571EB_SERDES 0x1060 | 504 | #define E1000_DEV_ID_82571EB_SERDES 0x1060 |
463 | #define E1000_DEV_ID_82572EI_COPPER 0x107D | 505 | #define E1000_DEV_ID_82572EI_COPPER 0x107D |
464 | #define E1000_DEV_ID_82572EI_FIBER 0x107E | 506 | #define E1000_DEV_ID_82572EI_FIBER 0x107E |
465 | #define E1000_DEV_ID_82572EI_SERDES 0x107F | 507 | #define E1000_DEV_ID_82572EI_SERDES 0x107F |
508 | #define E1000_DEV_ID_82572EI 0x10B9 | ||
466 | #define E1000_DEV_ID_82573E 0x108B | 509 | #define E1000_DEV_ID_82573E 0x108B |
467 | #define E1000_DEV_ID_82573E_IAMT 0x108C | 510 | #define E1000_DEV_ID_82573E_IAMT 0x108C |
468 | #define E1000_DEV_ID_82573L 0x109A | 511 | #define E1000_DEV_ID_82573L 0x109A |
469 | #define E1000_DEV_ID_82546GB_QUAD_COPPER_KSP3 0x10B5 | 512 | #define E1000_DEV_ID_82546GB_QUAD_COPPER_KSP3 0x10B5 |
470 | #define E1000_DEV_ID_80003ES2LAN_COPPER_DPT 0x1096 | 513 | #define E1000_DEV_ID_80003ES2LAN_COPPER_DPT 0x1096 |
471 | #define E1000_DEV_ID_80003ES2LAN_SERDES_DPT 0x1098 | 514 | #define E1000_DEV_ID_80003ES2LAN_SERDES_DPT 0x1098 |
515 | #define E1000_DEV_ID_80003ES2LAN_COPPER_SPT 0x10BA | ||
516 | #define E1000_DEV_ID_80003ES2LAN_SERDES_SPT 0x10BB | ||
517 | |||
518 | #define E1000_DEV_ID_ICH8_IGP_M_AMT 0x1049 | ||
519 | #define E1000_DEV_ID_ICH8_IGP_AMT 0x104A | ||
520 | #define E1000_DEV_ID_ICH8_IGP_C 0x104B | ||
521 | #define E1000_DEV_ID_ICH8_IFE 0x104C | ||
522 | #define E1000_DEV_ID_ICH8_IGP_M 0x104D | ||
472 | 523 | ||
473 | 524 | ||
474 | #define NODE_ADDRESS_SIZE 6 | 525 | #define NODE_ADDRESS_SIZE 6 |
@@ -539,6 +590,14 @@ int32_t e1000_check_phy_reset_block(struct e1000_hw *hw); | |||
539 | E1000_IMS_RXSEQ | \ | 590 | E1000_IMS_RXSEQ | \ |
540 | E1000_IMS_LSC) | 591 | E1000_IMS_LSC) |
541 | 592 | ||
593 | /* Additional interrupts need to be handled for e1000_ich8lan: | ||
594 | DSW = The FW changed the status of the DISSW bit in FWSM | ||
595 | PHYINT = The LAN connected device generates an interrupt | ||
596 | EPRST = Manageability reset event */ | ||
597 | #define IMS_ICH8LAN_ENABLE_MASK (\ | ||
598 | E1000_IMS_DSW | \ | ||
599 | E1000_IMS_PHYINT | \ | ||
600 | E1000_IMS_EPRST) | ||
542 | 601 | ||
543 | /* Number of high/low register pairs in the RAR. The RAR (Receive Address | 602 | /* Number of high/low register pairs in the RAR. The RAR (Receive Address |
544 | * Registers) holds the directed and multicast addresses that we monitor. We | 603 | * Registers) holds the directed and multicast addresses that we monitor. We |
@@ -546,6 +605,7 @@ int32_t e1000_check_phy_reset_block(struct e1000_hw *hw); | |||
546 | * E1000_RAR_ENTRIES - 1 multicast addresses. | 605 | * E1000_RAR_ENTRIES - 1 multicast addresses. |
547 | */ | 606 | */ |
548 | #define E1000_RAR_ENTRIES 15 | 607 | #define E1000_RAR_ENTRIES 15 |
608 | #define E1000_RAR_ENTRIES_ICH8LAN 7 | ||
549 | 609 | ||
550 | #define MIN_NUMBER_OF_DESCRIPTORS 8 | 610 | #define MIN_NUMBER_OF_DESCRIPTORS 8 |
551 | #define MAX_NUMBER_OF_DESCRIPTORS 0xFFF8 | 611 | #define MAX_NUMBER_OF_DESCRIPTORS 0xFFF8 |
@@ -767,6 +827,9 @@ struct e1000_data_desc { | |||
767 | #define E1000_MC_TBL_SIZE 128 /* Multicast Filter Table (4096 bits) */ | 827 | #define E1000_MC_TBL_SIZE 128 /* Multicast Filter Table (4096 bits) */ |
768 | #define E1000_VLAN_FILTER_TBL_SIZE 128 /* VLAN Filter Table (4096 bits) */ | 828 | #define E1000_VLAN_FILTER_TBL_SIZE 128 /* VLAN Filter Table (4096 bits) */ |
769 | 829 | ||
830 | #define E1000_NUM_UNICAST_ICH8LAN 7 | ||
831 | #define E1000_MC_TBL_SIZE_ICH8LAN 32 | ||
832 | |||
770 | 833 | ||
771 | /* Receive Address Register */ | 834 | /* Receive Address Register */ |
772 | struct e1000_rar { | 835 | struct e1000_rar { |
@@ -776,6 +839,7 @@ struct e1000_rar { | |||
776 | 839 | ||
777 | /* Number of entries in the Multicast Table Array (MTA). */ | 840 | /* Number of entries in the Multicast Table Array (MTA). */ |
778 | #define E1000_NUM_MTA_REGISTERS 128 | 841 | #define E1000_NUM_MTA_REGISTERS 128 |
842 | #define E1000_NUM_MTA_REGISTERS_ICH8LAN 32 | ||
779 | 843 | ||
780 | /* IPv4 Address Table Entry */ | 844 | /* IPv4 Address Table Entry */ |
781 | struct e1000_ipv4_at_entry { | 845 | struct e1000_ipv4_at_entry { |
@@ -786,6 +850,7 @@ struct e1000_ipv4_at_entry { | |||
786 | /* Four wakeup IP addresses are supported */ | 850 | /* Four wakeup IP addresses are supported */ |
787 | #define E1000_WAKEUP_IP_ADDRESS_COUNT_MAX 4 | 851 | #define E1000_WAKEUP_IP_ADDRESS_COUNT_MAX 4 |
788 | #define E1000_IP4AT_SIZE E1000_WAKEUP_IP_ADDRESS_COUNT_MAX | 852 | #define E1000_IP4AT_SIZE E1000_WAKEUP_IP_ADDRESS_COUNT_MAX |
853 | #define E1000_IP4AT_SIZE_ICH8LAN 3 | ||
789 | #define E1000_IP6AT_SIZE 1 | 854 | #define E1000_IP6AT_SIZE 1 |
790 | 855 | ||
791 | /* IPv6 Address Table Entry */ | 856 | /* IPv6 Address Table Entry */ |
@@ -844,6 +909,7 @@ struct e1000_ffvt_entry { | |||
844 | #define E1000_FLA 0x0001C /* Flash Access - RW */ | 909 | #define E1000_FLA 0x0001C /* Flash Access - RW */ |
845 | #define E1000_MDIC 0x00020 /* MDI Control - RW */ | 910 | #define E1000_MDIC 0x00020 /* MDI Control - RW */ |
846 | #define E1000_SCTL 0x00024 /* SerDes Control - RW */ | 911 | #define E1000_SCTL 0x00024 /* SerDes Control - RW */ |
912 | #define E1000_FEXTNVM 0x00028 /* Future Extended NVM register */ | ||
847 | #define E1000_FCAL 0x00028 /* Flow Control Address Low - RW */ | 913 | #define E1000_FCAL 0x00028 /* Flow Control Address Low - RW */ |
848 | #define E1000_FCAH 0x0002C /* Flow Control Address High -RW */ | 914 | #define E1000_FCAH 0x0002C /* Flow Control Address High -RW */ |
849 | #define E1000_FCT 0x00030 /* Flow Control Type - RW */ | 915 | #define E1000_FCT 0x00030 /* Flow Control Type - RW */ |
@@ -872,6 +938,8 @@ struct e1000_ffvt_entry { | |||
872 | #define E1000_LEDCTL 0x00E00 /* LED Control - RW */ | 938 | #define E1000_LEDCTL 0x00E00 /* LED Control - RW */ |
873 | #define E1000_EXTCNF_CTRL 0x00F00 /* Extended Configuration Control */ | 939 | #define E1000_EXTCNF_CTRL 0x00F00 /* Extended Configuration Control */ |
874 | #define E1000_EXTCNF_SIZE 0x00F08 /* Extended Configuration Size */ | 940 | #define E1000_EXTCNF_SIZE 0x00F08 /* Extended Configuration Size */ |
941 | #define E1000_PHY_CTRL 0x00F10 /* PHY Control Register in CSR */ | ||
942 | #define FEXTNVM_SW_CONFIG 0x0001 | ||
875 | #define E1000_PBA 0x01000 /* Packet Buffer Allocation - RW */ | 943 | #define E1000_PBA 0x01000 /* Packet Buffer Allocation - RW */ |
876 | #define E1000_PBS 0x01008 /* Packet Buffer Size */ | 944 | #define E1000_PBS 0x01008 /* Packet Buffer Size */ |
877 | #define E1000_EEMNGCTL 0x01010 /* MNG EEprom Control */ | 945 | #define E1000_EEMNGCTL 0x01010 /* MNG EEprom Control */ |
@@ -899,11 +967,13 @@ struct e1000_ffvt_entry { | |||
899 | #define E1000_RDH0 E1000_RDH /* RX Desc Head (0) - RW */ | 967 | #define E1000_RDH0 E1000_RDH /* RX Desc Head (0) - RW */ |
900 | #define E1000_RDT0 E1000_RDT /* RX Desc Tail (0) - RW */ | 968 | #define E1000_RDT0 E1000_RDT /* RX Desc Tail (0) - RW */ |
901 | #define E1000_RDTR0 E1000_RDTR /* RX Delay Timer (0) - RW */ | 969 | #define E1000_RDTR0 E1000_RDTR /* RX Delay Timer (0) - RW */ |
902 | #define E1000_RXDCTL 0x02828 /* RX Descriptor Control - RW */ | 970 | #define E1000_RXDCTL 0x02828 /* RX Descriptor Control queue 0 - RW */ |
971 | #define E1000_RXDCTL1 0x02928 /* RX Descriptor Control queue 1 - RW */ | ||
903 | #define E1000_RADV 0x0282C /* RX Interrupt Absolute Delay Timer - RW */ | 972 | #define E1000_RADV 0x0282C /* RX Interrupt Absolute Delay Timer - RW */ |
904 | #define E1000_RSRPD 0x02C00 /* RX Small Packet Detect - RW */ | 973 | #define E1000_RSRPD 0x02C00 /* RX Small Packet Detect - RW */ |
905 | #define E1000_RAID 0x02C08 /* Receive Ack Interrupt Delay - RW */ | 974 | #define E1000_RAID 0x02C08 /* Receive Ack Interrupt Delay - RW */ |
906 | #define E1000_TXDMAC 0x03000 /* TX DMA Control - RW */ | 975 | #define E1000_TXDMAC 0x03000 /* TX DMA Control - RW */ |
976 | #define E1000_KABGTXD 0x03004 /* AFE Band Gap Transmit Ref Data */ | ||
907 | #define E1000_TDFH 0x03410 /* TX Data FIFO Head - RW */ | 977 | #define E1000_TDFH 0x03410 /* TX Data FIFO Head - RW */ |
908 | #define E1000_TDFT 0x03418 /* TX Data FIFO Tail - RW */ | 978 | #define E1000_TDFT 0x03418 /* TX Data FIFO Tail - RW */ |
909 | #define E1000_TDFHS 0x03420 /* TX Data FIFO Head Saved - RW */ | 979 | #define E1000_TDFHS 0x03420 /* TX Data FIFO Head Saved - RW */ |
@@ -1050,6 +1120,7 @@ struct e1000_ffvt_entry { | |||
1050 | #define E1000_82542_FLA E1000_FLA | 1120 | #define E1000_82542_FLA E1000_FLA |
1051 | #define E1000_82542_MDIC E1000_MDIC | 1121 | #define E1000_82542_MDIC E1000_MDIC |
1052 | #define E1000_82542_SCTL E1000_SCTL | 1122 | #define E1000_82542_SCTL E1000_SCTL |
1123 | #define E1000_82542_FEXTNVM E1000_FEXTNVM | ||
1053 | #define E1000_82542_FCAL E1000_FCAL | 1124 | #define E1000_82542_FCAL E1000_FCAL |
1054 | #define E1000_82542_FCAH E1000_FCAH | 1125 | #define E1000_82542_FCAH E1000_FCAH |
1055 | #define E1000_82542_FCT E1000_FCT | 1126 | #define E1000_82542_FCT E1000_FCT |
@@ -1073,6 +1144,19 @@ struct e1000_ffvt_entry { | |||
1073 | #define E1000_82542_RDLEN0 E1000_82542_RDLEN | 1144 | #define E1000_82542_RDLEN0 E1000_82542_RDLEN |
1074 | #define E1000_82542_RDH0 E1000_82542_RDH | 1145 | #define E1000_82542_RDH0 E1000_82542_RDH |
1075 | #define E1000_82542_RDT0 E1000_82542_RDT | 1146 | #define E1000_82542_RDT0 E1000_82542_RDT |
1147 | #define E1000_82542_SRRCTL(_n) (0x280C + ((_n) << 8)) /* Split and Replication | ||
1148 | * RX Control - RW */ | ||
1149 | #define E1000_82542_DCA_RXCTRL(_n) (0x02814 + ((_n) << 8)) | ||
1150 | #define E1000_82542_RDBAH3 0x02B04 /* RX Desc Base High Queue 3 - RW */ | ||
1151 | #define E1000_82542_RDBAL3 0x02B00 /* RX Desc Low Queue 3 - RW */ | ||
1152 | #define E1000_82542_RDLEN3 0x02B08 /* RX Desc Length Queue 3 - RW */ | ||
1153 | #define E1000_82542_RDH3 0x02B10 /* RX Desc Head Queue 3 - RW */ | ||
1154 | #define E1000_82542_RDT3 0x02B18 /* RX Desc Tail Queue 3 - RW */ | ||
1155 | #define E1000_82542_RDBAL2 0x02A00 /* RX Desc Base Low Queue 2 - RW */ | ||
1156 | #define E1000_82542_RDBAH2 0x02A04 /* RX Desc Base High Queue 2 - RW */ | ||
1157 | #define E1000_82542_RDLEN2 0x02A08 /* RX Desc Length Queue 2 - RW */ | ||
1158 | #define E1000_82542_RDH2 0x02A10 /* RX Desc Head Queue 2 - RW */ | ||
1159 | #define E1000_82542_RDT2 0x02A18 /* RX Desc Tail Queue 2 - RW */ | ||
1076 | #define E1000_82542_RDTR1 0x00130 | 1160 | #define E1000_82542_RDTR1 0x00130 |
1077 | #define E1000_82542_RDBAL1 0x00138 | 1161 | #define E1000_82542_RDBAL1 0x00138 |
1078 | #define E1000_82542_RDBAH1 0x0013C | 1162 | #define E1000_82542_RDBAH1 0x0013C |
@@ -1110,11 +1194,14 @@ struct e1000_ffvt_entry { | |||
1110 | #define E1000_82542_FLOP E1000_FLOP | 1194 | #define E1000_82542_FLOP E1000_FLOP |
1111 | #define E1000_82542_EXTCNF_CTRL E1000_EXTCNF_CTRL | 1195 | #define E1000_82542_EXTCNF_CTRL E1000_EXTCNF_CTRL |
1112 | #define E1000_82542_EXTCNF_SIZE E1000_EXTCNF_SIZE | 1196 | #define E1000_82542_EXTCNF_SIZE E1000_EXTCNF_SIZE |
1197 | #define E1000_82542_PHY_CTRL E1000_PHY_CTRL | ||
1113 | #define E1000_82542_ERT E1000_ERT | 1198 | #define E1000_82542_ERT E1000_ERT |
1114 | #define E1000_82542_RXDCTL E1000_RXDCTL | 1199 | #define E1000_82542_RXDCTL E1000_RXDCTL |
1200 | #define E1000_82542_RXDCTL1 E1000_RXDCTL1 | ||
1115 | #define E1000_82542_RADV E1000_RADV | 1201 | #define E1000_82542_RADV E1000_RADV |
1116 | #define E1000_82542_RSRPD E1000_RSRPD | 1202 | #define E1000_82542_RSRPD E1000_RSRPD |
1117 | #define E1000_82542_TXDMAC E1000_TXDMAC | 1203 | #define E1000_82542_TXDMAC E1000_TXDMAC |
1204 | #define E1000_82542_KABGTXD E1000_KABGTXD | ||
1118 | #define E1000_82542_TDFHS E1000_TDFHS | 1205 | #define E1000_82542_TDFHS E1000_TDFHS |
1119 | #define E1000_82542_TDFTS E1000_TDFTS | 1206 | #define E1000_82542_TDFTS E1000_TDFTS |
1120 | #define E1000_82542_TDFPC E1000_TDFPC | 1207 | #define E1000_82542_TDFPC E1000_TDFPC |
@@ -1310,13 +1397,16 @@ struct e1000_hw_stats { | |||
1310 | 1397 | ||
1311 | /* Structure containing variables used by the shared code (e1000_hw.c) */ | 1398 | /* Structure containing variables used by the shared code (e1000_hw.c) */ |
1312 | struct e1000_hw { | 1399 | struct e1000_hw { |
1313 | uint8_t __iomem *hw_addr; | 1400 | uint8_t *hw_addr; |
1314 | uint8_t *flash_address; | 1401 | uint8_t *flash_address; |
1315 | e1000_mac_type mac_type; | 1402 | e1000_mac_type mac_type; |
1316 | e1000_phy_type phy_type; | 1403 | e1000_phy_type phy_type; |
1317 | uint32_t phy_init_script; | 1404 | uint32_t phy_init_script; |
1318 | e1000_media_type media_type; | 1405 | e1000_media_type media_type; |
1319 | void *back; | 1406 | void *back; |
1407 | struct e1000_shadow_ram *eeprom_shadow_ram; | ||
1408 | uint32_t flash_bank_size; | ||
1409 | uint32_t flash_base_addr; | ||
1320 | e1000_fc_type fc; | 1410 | e1000_fc_type fc; |
1321 | e1000_bus_speed bus_speed; | 1411 | e1000_bus_speed bus_speed; |
1322 | e1000_bus_width bus_width; | 1412 | e1000_bus_width bus_width; |
@@ -1328,6 +1418,7 @@ struct e1000_hw { | |||
1328 | uint32_t asf_firmware_present; | 1418 | uint32_t asf_firmware_present; |
1329 | uint32_t eeprom_semaphore_present; | 1419 | uint32_t eeprom_semaphore_present; |
1330 | uint32_t swfw_sync_present; | 1420 | uint32_t swfw_sync_present; |
1421 | uint32_t swfwhw_semaphore_present; | ||
1331 | unsigned long io_base; | 1422 | unsigned long io_base; |
1332 | uint32_t phy_id; | 1423 | uint32_t phy_id; |
1333 | uint32_t phy_revision; | 1424 | uint32_t phy_revision; |
@@ -1387,6 +1478,7 @@ struct e1000_hw { | |||
1387 | boolean_t in_ifs_mode; | 1478 | boolean_t in_ifs_mode; |
1388 | boolean_t mng_reg_access_disabled; | 1479 | boolean_t mng_reg_access_disabled; |
1389 | boolean_t leave_av_bit_off; | 1480 | boolean_t leave_av_bit_off; |
1481 | boolean_t kmrn_lock_loss_workaround_disabled; | ||
1390 | }; | 1482 | }; |
1391 | 1483 | ||
1392 | 1484 | ||
@@ -1435,6 +1527,7 @@ struct e1000_hw { | |||
1435 | #define E1000_CTRL_RTE 0x20000000 /* Routing tag enable */ | 1527 | #define E1000_CTRL_RTE 0x20000000 /* Routing tag enable */ |
1436 | #define E1000_CTRL_VME 0x40000000 /* IEEE VLAN mode enable */ | 1528 | #define E1000_CTRL_VME 0x40000000 /* IEEE VLAN mode enable */ |
1437 | #define E1000_CTRL_PHY_RST 0x80000000 /* PHY Reset */ | 1529 | #define E1000_CTRL_PHY_RST 0x80000000 /* PHY Reset */ |
1530 | #define E1000_CTRL_SW2FW_INT 0x02000000 /* Initiate an interrupt to manageability engine */ | ||
1438 | 1531 | ||
1439 | /* Device Status */ | 1532 | /* Device Status */ |
1440 | #define E1000_STATUS_FD 0x00000001 /* Full duplex.0=half,1=full */ | 1533 | #define E1000_STATUS_FD 0x00000001 /* Full duplex.0=half,1=full */ |
@@ -1449,6 +1542,8 @@ struct e1000_hw { | |||
1449 | #define E1000_STATUS_SPEED_10 0x00000000 /* Speed 10Mb/s */ | 1542 | #define E1000_STATUS_SPEED_10 0x00000000 /* Speed 10Mb/s */ |
1450 | #define E1000_STATUS_SPEED_100 0x00000040 /* Speed 100Mb/s */ | 1543 | #define E1000_STATUS_SPEED_100 0x00000040 /* Speed 100Mb/s */ |
1451 | #define E1000_STATUS_SPEED_1000 0x00000080 /* Speed 1000Mb/s */ | 1544 | #define E1000_STATUS_SPEED_1000 0x00000080 /* Speed 1000Mb/s */ |
1545 | #define E1000_STATUS_LAN_INIT_DONE 0x00000200 /* Lan Init Completion | ||
1546 | by EEPROM/Flash */ | ||
1452 | #define E1000_STATUS_ASDV 0x00000300 /* Auto speed detect value */ | 1547 | #define E1000_STATUS_ASDV 0x00000300 /* Auto speed detect value */ |
1453 | #define E1000_STATUS_DOCK_CI 0x00000800 /* Change in Dock/Undock state. Clear on write '0'. */ | 1548 | #define E1000_STATUS_DOCK_CI 0x00000800 /* Change in Dock/Undock state. Clear on write '0'. */ |
1454 | #define E1000_STATUS_GIO_MASTER_ENABLE 0x00080000 /* Status of Master requests. */ | 1549 | #define E1000_STATUS_GIO_MASTER_ENABLE 0x00080000 /* Status of Master requests. */ |
@@ -1506,6 +1601,10 @@ struct e1000_hw { | |||
1506 | #define E1000_STM_OPCODE 0xDB00 | 1601 | #define E1000_STM_OPCODE 0xDB00 |
1507 | #define E1000_HICR_FW_RESET 0xC0 | 1602 | #define E1000_HICR_FW_RESET 0xC0 |
1508 | 1603 | ||
1604 | #define E1000_SHADOW_RAM_WORDS 2048 | ||
1605 | #define E1000_ICH8_NVM_SIG_WORD 0x13 | ||
1606 | #define E1000_ICH8_NVM_SIG_MASK 0xC0 | ||
1607 | |||
1509 | /* EEPROM Read */ | 1608 | /* EEPROM Read */ |
1510 | #define E1000_EERD_START 0x00000001 /* Start Read */ | 1609 | #define E1000_EERD_START 0x00000001 /* Start Read */ |
1511 | #define E1000_EERD_DONE 0x00000010 /* Read Done */ | 1610 | #define E1000_EERD_DONE 0x00000010 /* Read Done */ |
@@ -1551,7 +1650,6 @@ struct e1000_hw { | |||
1551 | #define E1000_CTRL_EXT_WR_WMARK_320 0x01000000 | 1650 | #define E1000_CTRL_EXT_WR_WMARK_320 0x01000000 |
1552 | #define E1000_CTRL_EXT_WR_WMARK_384 0x02000000 | 1651 | #define E1000_CTRL_EXT_WR_WMARK_384 0x02000000 |
1553 | #define E1000_CTRL_EXT_WR_WMARK_448 0x03000000 | 1652 | #define E1000_CTRL_EXT_WR_WMARK_448 0x03000000 |
1554 | #define E1000_CTRL_EXT_CANC 0x04000000 /* Interrupt delay cancellation */ | ||
1555 | #define E1000_CTRL_EXT_DRV_LOAD 0x10000000 /* Driver loaded bit for FW */ | 1653 | #define E1000_CTRL_EXT_DRV_LOAD 0x10000000 /* Driver loaded bit for FW */ |
1556 | #define E1000_CTRL_EXT_IAME 0x08000000 /* Interrupt acknowledge Auto-mask */ | 1654 | #define E1000_CTRL_EXT_IAME 0x08000000 /* Interrupt acknowledge Auto-mask */ |
1557 | #define E1000_CTRL_EXT_INT_TIMER_CLR 0x20000000 /* Clear Interrupt timers after IMS clear */ | 1655 | #define E1000_CTRL_EXT_INT_TIMER_CLR 0x20000000 /* Clear Interrupt timers after IMS clear */ |
@@ -1591,12 +1689,31 @@ struct e1000_hw { | |||
1591 | #define E1000_KUMCTRLSTA_FIFO_CTRL_TX_BYPASS 0x00000800 | 1689 | #define E1000_KUMCTRLSTA_FIFO_CTRL_TX_BYPASS 0x00000800 |
1592 | 1690 | ||
1593 | /* In-Band Control */ | 1691 | /* In-Band Control */ |
1692 | #define E1000_KUMCTRLSTA_INB_CTRL_LINK_STATUS_TX_TIMEOUT_DEFAULT 0x00000500 | ||
1594 | #define E1000_KUMCTRLSTA_INB_CTRL_DIS_PADDING 0x00000010 | 1693 | #define E1000_KUMCTRLSTA_INB_CTRL_DIS_PADDING 0x00000010 |
1595 | 1694 | ||
1596 | /* Half-Duplex Control */ | 1695 | /* Half-Duplex Control */ |
1597 | #define E1000_KUMCTRLSTA_HD_CTRL_10_100_DEFAULT 0x00000004 | 1696 | #define E1000_KUMCTRLSTA_HD_CTRL_10_100_DEFAULT 0x00000004 |
1598 | #define E1000_KUMCTRLSTA_HD_CTRL_1000_DEFAULT 0x00000000 | 1697 | #define E1000_KUMCTRLSTA_HD_CTRL_1000_DEFAULT 0x00000000 |
1599 | 1698 | ||
1699 | #define E1000_KUMCTRLSTA_OFFSET_K0S_CTRL 0x0000001E | ||
1700 | |||
1701 | #define E1000_KUMCTRLSTA_DIAG_FELPBK 0x2000 | ||
1702 | #define E1000_KUMCTRLSTA_DIAG_NELPBK 0x1000 | ||
1703 | |||
1704 | #define E1000_KUMCTRLSTA_K0S_100_EN 0x2000 | ||
1705 | #define E1000_KUMCTRLSTA_K0S_GBE_EN 0x1000 | ||
1706 | #define E1000_KUMCTRLSTA_K0S_ENTRY_LATENCY_MASK 0x0003 | ||
1707 | |||
1708 | #define E1000_KABGTXD_BGSQLBIAS 0x00050000 | ||
1709 | |||
1710 | #define E1000_PHY_CTRL_SPD_EN 0x00000001 | ||
1711 | #define E1000_PHY_CTRL_D0A_LPLU 0x00000002 | ||
1712 | #define E1000_PHY_CTRL_NOND0A_LPLU 0x00000004 | ||
1713 | #define E1000_PHY_CTRL_NOND0A_GBE_DISABLE 0x00000008 | ||
1714 | #define E1000_PHY_CTRL_GBE_DISABLE 0x00000040 | ||
1715 | #define E1000_PHY_CTRL_B2B_EN 0x00000080 | ||
1716 | |||
1600 | /* LED Control */ | 1717 | /* LED Control */ |
1601 | #define E1000_LEDCTL_LED0_MODE_MASK 0x0000000F | 1718 | #define E1000_LEDCTL_LED0_MODE_MASK 0x0000000F |
1602 | #define E1000_LEDCTL_LED0_MODE_SHIFT 0 | 1719 | #define E1000_LEDCTL_LED0_MODE_SHIFT 0 |
@@ -1666,6 +1783,9 @@ struct e1000_hw { | |||
1666 | #define E1000_ICR_RXD_FIFO_PAR1 0x01000000 /* queue 1 Rx descriptor FIFO parity error */ | 1783 | #define E1000_ICR_RXD_FIFO_PAR1 0x01000000 /* queue 1 Rx descriptor FIFO parity error */ |
1667 | #define E1000_ICR_TXD_FIFO_PAR1 0x02000000 /* queue 1 Tx descriptor FIFO parity error */ | 1784 | #define E1000_ICR_TXD_FIFO_PAR1 0x02000000 /* queue 1 Tx descriptor FIFO parity error */ |
1668 | #define E1000_ICR_ALL_PARITY 0x03F00000 /* all parity error bits */ | 1785 | #define E1000_ICR_ALL_PARITY 0x03F00000 /* all parity error bits */ |
1786 | #define E1000_ICR_DSW 0x00000020 /* FW changed the status of DISSW bit in the FWSM */ | ||
1787 | #define E1000_ICR_PHYINT 0x00001000 /* LAN connected device generates an interrupt */ | ||
1788 | #define E1000_ICR_EPRST 0x00100000 /* ME handware reset occurs */ | ||
1669 | 1789 | ||
1670 | /* Interrupt Cause Set */ | 1790 | /* Interrupt Cause Set */ |
1671 | #define E1000_ICS_TXDW E1000_ICR_TXDW /* Transmit desc written back */ | 1791 | #define E1000_ICS_TXDW E1000_ICR_TXDW /* Transmit desc written back */ |
@@ -1692,6 +1812,9 @@ struct e1000_hw { | |||
1692 | #define E1000_ICS_PB_PAR E1000_ICR_PB_PAR /* packet buffer parity error */ | 1812 | #define E1000_ICS_PB_PAR E1000_ICR_PB_PAR /* packet buffer parity error */ |
1693 | #define E1000_ICS_RXD_FIFO_PAR1 E1000_ICR_RXD_FIFO_PAR1 /* queue 1 Rx descriptor FIFO parity error */ | 1813 | #define E1000_ICS_RXD_FIFO_PAR1 E1000_ICR_RXD_FIFO_PAR1 /* queue 1 Rx descriptor FIFO parity error */ |
1694 | #define E1000_ICS_TXD_FIFO_PAR1 E1000_ICR_TXD_FIFO_PAR1 /* queue 1 Tx descriptor FIFO parity error */ | 1814 | #define E1000_ICS_TXD_FIFO_PAR1 E1000_ICR_TXD_FIFO_PAR1 /* queue 1 Tx descriptor FIFO parity error */ |
1815 | #define E1000_ICS_DSW E1000_ICR_DSW | ||
1816 | #define E1000_ICS_PHYINT E1000_ICR_PHYINT | ||
1817 | #define E1000_ICS_EPRST E1000_ICR_EPRST | ||
1695 | 1818 | ||
1696 | /* Interrupt Mask Set */ | 1819 | /* Interrupt Mask Set */ |
1697 | #define E1000_IMS_TXDW E1000_ICR_TXDW /* Transmit desc written back */ | 1820 | #define E1000_IMS_TXDW E1000_ICR_TXDW /* Transmit desc written back */ |
@@ -1718,6 +1841,9 @@ struct e1000_hw { | |||
1718 | #define E1000_IMS_PB_PAR E1000_ICR_PB_PAR /* packet buffer parity error */ | 1841 | #define E1000_IMS_PB_PAR E1000_ICR_PB_PAR /* packet buffer parity error */ |
1719 | #define E1000_IMS_RXD_FIFO_PAR1 E1000_ICR_RXD_FIFO_PAR1 /* queue 1 Rx descriptor FIFO parity error */ | 1842 | #define E1000_IMS_RXD_FIFO_PAR1 E1000_ICR_RXD_FIFO_PAR1 /* queue 1 Rx descriptor FIFO parity error */ |
1720 | #define E1000_IMS_TXD_FIFO_PAR1 E1000_ICR_TXD_FIFO_PAR1 /* queue 1 Tx descriptor FIFO parity error */ | 1843 | #define E1000_IMS_TXD_FIFO_PAR1 E1000_ICR_TXD_FIFO_PAR1 /* queue 1 Tx descriptor FIFO parity error */ |
1844 | #define E1000_IMS_DSW E1000_ICR_DSW | ||
1845 | #define E1000_IMS_PHYINT E1000_ICR_PHYINT | ||
1846 | #define E1000_IMS_EPRST E1000_ICR_EPRST | ||
1721 | 1847 | ||
1722 | /* Interrupt Mask Clear */ | 1848 | /* Interrupt Mask Clear */ |
1723 | #define E1000_IMC_TXDW E1000_ICR_TXDW /* Transmit desc written back */ | 1849 | #define E1000_IMC_TXDW E1000_ICR_TXDW /* Transmit desc written back */ |
@@ -1744,6 +1870,9 @@ struct e1000_hw { | |||
1744 | #define E1000_IMC_PB_PAR E1000_ICR_PB_PAR /* packet buffer parity error */ | 1870 | #define E1000_IMC_PB_PAR E1000_ICR_PB_PAR /* packet buffer parity error */ |
1745 | #define E1000_IMC_RXD_FIFO_PAR1 E1000_ICR_RXD_FIFO_PAR1 /* queue 1 Rx descriptor FIFO parity error */ | 1871 | #define E1000_IMC_RXD_FIFO_PAR1 E1000_ICR_RXD_FIFO_PAR1 /* queue 1 Rx descriptor FIFO parity error */ |
1746 | #define E1000_IMC_TXD_FIFO_PAR1 E1000_ICR_TXD_FIFO_PAR1 /* queue 1 Tx descriptor FIFO parity error */ | 1872 | #define E1000_IMC_TXD_FIFO_PAR1 E1000_ICR_TXD_FIFO_PAR1 /* queue 1 Tx descriptor FIFO parity error */ |
1873 | #define E1000_IMC_DSW E1000_ICR_DSW | ||
1874 | #define E1000_IMC_PHYINT E1000_ICR_PHYINT | ||
1875 | #define E1000_IMC_EPRST E1000_ICR_EPRST | ||
1747 | 1876 | ||
1748 | /* Receive Control */ | 1877 | /* Receive Control */ |
1749 | #define E1000_RCTL_RST 0x00000001 /* Software reset */ | 1878 | #define E1000_RCTL_RST 0x00000001 /* Software reset */ |
@@ -1918,9 +2047,10 @@ struct e1000_hw { | |||
1918 | #define E1000_MRQC_RSS_FIELD_MASK 0xFFFF0000 | 2047 | #define E1000_MRQC_RSS_FIELD_MASK 0xFFFF0000 |
1919 | #define E1000_MRQC_RSS_FIELD_IPV4_TCP 0x00010000 | 2048 | #define E1000_MRQC_RSS_FIELD_IPV4_TCP 0x00010000 |
1920 | #define E1000_MRQC_RSS_FIELD_IPV4 0x00020000 | 2049 | #define E1000_MRQC_RSS_FIELD_IPV4 0x00020000 |
1921 | #define E1000_MRQC_RSS_FIELD_IPV6_TCP 0x00040000 | 2050 | #define E1000_MRQC_RSS_FIELD_IPV6_TCP_EX 0x00040000 |
1922 | #define E1000_MRQC_RSS_FIELD_IPV6_EX 0x00080000 | 2051 | #define E1000_MRQC_RSS_FIELD_IPV6_EX 0x00080000 |
1923 | #define E1000_MRQC_RSS_FIELD_IPV6 0x00100000 | 2052 | #define E1000_MRQC_RSS_FIELD_IPV6 0x00100000 |
2053 | #define E1000_MRQC_RSS_FIELD_IPV6_TCP 0x00200000 | ||
1924 | 2054 | ||
1925 | /* Definitions for power management and wakeup registers */ | 2055 | /* Definitions for power management and wakeup registers */ |
1926 | /* Wake Up Control */ | 2056 | /* Wake Up Control */ |
@@ -2010,6 +2140,15 @@ struct e1000_hw { | |||
2010 | #define E1000_FWSM_MODE_SHIFT 1 | 2140 | #define E1000_FWSM_MODE_SHIFT 1 |
2011 | #define E1000_FWSM_FW_VALID 0x00008000 /* FW established a valid mode */ | 2141 | #define E1000_FWSM_FW_VALID 0x00008000 /* FW established a valid mode */ |
2012 | 2142 | ||
2143 | #define E1000_FWSM_RSPCIPHY 0x00000040 /* Reset PHY on PCI reset */ | ||
2144 | #define E1000_FWSM_DISSW 0x10000000 /* FW disable SW Write Access */ | ||
2145 | #define E1000_FWSM_SKUSEL_MASK 0x60000000 /* LAN SKU select */ | ||
2146 | #define E1000_FWSM_SKUEL_SHIFT 29 | ||
2147 | #define E1000_FWSM_SKUSEL_EMB 0x0 /* Embedded SKU */ | ||
2148 | #define E1000_FWSM_SKUSEL_CONS 0x1 /* Consumer SKU */ | ||
2149 | #define E1000_FWSM_SKUSEL_PERF_100 0x2 /* Perf & Corp 10/100 SKU */ | ||
2150 | #define E1000_FWSM_SKUSEL_PERF_GBE 0x3 /* Perf & Copr GbE SKU */ | ||
2151 | |||
2013 | /* FFLT Debug Register */ | 2152 | /* FFLT Debug Register */ |
2014 | #define E1000_FFLT_DBG_INVC 0x00100000 /* Invalid /C/ code handling */ | 2153 | #define E1000_FFLT_DBG_INVC 0x00100000 /* Invalid /C/ code handling */ |
2015 | 2154 | ||
@@ -2082,6 +2221,8 @@ struct e1000_host_command_info { | |||
2082 | E1000_GCR_TXDSCW_NO_SNOOP | \ | 2221 | E1000_GCR_TXDSCW_NO_SNOOP | \ |
2083 | E1000_GCR_TXDSCR_NO_SNOOP) | 2222 | E1000_GCR_TXDSCR_NO_SNOOP) |
2084 | 2223 | ||
2224 | #define PCI_EX_82566_SNOOP_ALL PCI_EX_NO_SNOOP_ALL | ||
2225 | |||
2085 | #define E1000_GCR_L1_ACT_WITHOUT_L0S_RX 0x08000000 | 2226 | #define E1000_GCR_L1_ACT_WITHOUT_L0S_RX 0x08000000 |
2086 | /* Function Active and Power State to MNG */ | 2227 | /* Function Active and Power State to MNG */ |
2087 | #define E1000_FACTPS_FUNC0_POWER_STATE_MASK 0x00000003 | 2228 | #define E1000_FACTPS_FUNC0_POWER_STATE_MASK 0x00000003 |
@@ -2140,8 +2281,10 @@ struct e1000_host_command_info { | |||
2140 | #define EEPROM_PHY_CLASS_WORD 0x0007 | 2281 | #define EEPROM_PHY_CLASS_WORD 0x0007 |
2141 | #define EEPROM_INIT_CONTROL1_REG 0x000A | 2282 | #define EEPROM_INIT_CONTROL1_REG 0x000A |
2142 | #define EEPROM_INIT_CONTROL2_REG 0x000F | 2283 | #define EEPROM_INIT_CONTROL2_REG 0x000F |
2284 | #define EEPROM_SWDEF_PINS_CTRL_PORT_1 0x0010 | ||
2143 | #define EEPROM_INIT_CONTROL3_PORT_B 0x0014 | 2285 | #define EEPROM_INIT_CONTROL3_PORT_B 0x0014 |
2144 | #define EEPROM_INIT_3GIO_3 0x001A | 2286 | #define EEPROM_INIT_3GIO_3 0x001A |
2287 | #define EEPROM_SWDEF_PINS_CTRL_PORT_0 0x0020 | ||
2145 | #define EEPROM_INIT_CONTROL3_PORT_A 0x0024 | 2288 | #define EEPROM_INIT_CONTROL3_PORT_A 0x0024 |
2146 | #define EEPROM_CFG 0x0012 | 2289 | #define EEPROM_CFG 0x0012 |
2147 | #define EEPROM_FLASH_VERSION 0x0032 | 2290 | #define EEPROM_FLASH_VERSION 0x0032 |
@@ -2153,10 +2296,16 @@ struct e1000_host_command_info { | |||
2153 | /* Word definitions for ID LED Settings */ | 2296 | /* Word definitions for ID LED Settings */ |
2154 | #define ID_LED_RESERVED_0000 0x0000 | 2297 | #define ID_LED_RESERVED_0000 0x0000 |
2155 | #define ID_LED_RESERVED_FFFF 0xFFFF | 2298 | #define ID_LED_RESERVED_FFFF 0xFFFF |
2299 | #define ID_LED_RESERVED_82573 0xF746 | ||
2300 | #define ID_LED_DEFAULT_82573 0x1811 | ||
2156 | #define ID_LED_DEFAULT ((ID_LED_OFF1_ON2 << 12) | \ | 2301 | #define ID_LED_DEFAULT ((ID_LED_OFF1_ON2 << 12) | \ |
2157 | (ID_LED_OFF1_OFF2 << 8) | \ | 2302 | (ID_LED_OFF1_OFF2 << 8) | \ |
2158 | (ID_LED_DEF1_DEF2 << 4) | \ | 2303 | (ID_LED_DEF1_DEF2 << 4) | \ |
2159 | (ID_LED_DEF1_DEF2)) | 2304 | (ID_LED_DEF1_DEF2)) |
2305 | #define ID_LED_DEFAULT_ICH8LAN ((ID_LED_DEF1_DEF2 << 12) | \ | ||
2306 | (ID_LED_DEF1_OFF2 << 8) | \ | ||
2307 | (ID_LED_DEF1_ON2 << 4) | \ | ||
2308 | (ID_LED_DEF1_DEF2)) | ||
2160 | #define ID_LED_DEF1_DEF2 0x1 | 2309 | #define ID_LED_DEF1_DEF2 0x1 |
2161 | #define ID_LED_DEF1_ON2 0x2 | 2310 | #define ID_LED_DEF1_ON2 0x2 |
2162 | #define ID_LED_DEF1_OFF2 0x3 | 2311 | #define ID_LED_DEF1_OFF2 0x3 |
@@ -2191,6 +2340,11 @@ struct e1000_host_command_info { | |||
2191 | #define EEPROM_WORD0F_ASM_DIR 0x2000 | 2340 | #define EEPROM_WORD0F_ASM_DIR 0x2000 |
2192 | #define EEPROM_WORD0F_ANE 0x0800 | 2341 | #define EEPROM_WORD0F_ANE 0x0800 |
2193 | #define EEPROM_WORD0F_SWPDIO_EXT 0x00F0 | 2342 | #define EEPROM_WORD0F_SWPDIO_EXT 0x00F0 |
2343 | #define EEPROM_WORD0F_LPLU 0x0001 | ||
2344 | |||
2345 | /* Mask bits for fields in Word 0x10/0x20 of the EEPROM */ | ||
2346 | #define EEPROM_WORD1020_GIGA_DISABLE 0x0010 | ||
2347 | #define EEPROM_WORD1020_GIGA_DISABLE_NON_D0A 0x0008 | ||
2194 | 2348 | ||
2195 | /* Mask bits for fields in Word 0x1a of the EEPROM */ | 2349 | /* Mask bits for fields in Word 0x1a of the EEPROM */ |
2196 | #define EEPROM_WORD1A_ASPM_MASK 0x000C | 2350 | #define EEPROM_WORD1A_ASPM_MASK 0x000C |
@@ -2265,23 +2419,29 @@ struct e1000_host_command_info { | |||
2265 | #define E1000_EXTCNF_CTRL_D_UD_OWNER 0x00000010 | 2419 | #define E1000_EXTCNF_CTRL_D_UD_OWNER 0x00000010 |
2266 | #define E1000_EXTCNF_CTRL_MDIO_SW_OWNERSHIP 0x00000020 | 2420 | #define E1000_EXTCNF_CTRL_MDIO_SW_OWNERSHIP 0x00000020 |
2267 | #define E1000_EXTCNF_CTRL_MDIO_HW_OWNERSHIP 0x00000040 | 2421 | #define E1000_EXTCNF_CTRL_MDIO_HW_OWNERSHIP 0x00000040 |
2268 | #define E1000_EXTCNF_CTRL_EXT_CNF_POINTER 0x1FFF0000 | 2422 | #define E1000_EXTCNF_CTRL_EXT_CNF_POINTER 0x0FFF0000 |
2269 | 2423 | ||
2270 | #define E1000_EXTCNF_SIZE_EXT_PHY_LENGTH 0x000000FF | 2424 | #define E1000_EXTCNF_SIZE_EXT_PHY_LENGTH 0x000000FF |
2271 | #define E1000_EXTCNF_SIZE_EXT_DOCK_LENGTH 0x0000FF00 | 2425 | #define E1000_EXTCNF_SIZE_EXT_DOCK_LENGTH 0x0000FF00 |
2272 | #define E1000_EXTCNF_SIZE_EXT_PCIE_LENGTH 0x00FF0000 | 2426 | #define E1000_EXTCNF_SIZE_EXT_PCIE_LENGTH 0x00FF0000 |
2427 | #define E1000_EXTCNF_CTRL_LCD_WRITE_ENABLE 0x00000001 | ||
2428 | #define E1000_EXTCNF_CTRL_SWFLAG 0x00000020 | ||
2273 | 2429 | ||
2274 | /* PBA constants */ | 2430 | /* PBA constants */ |
2431 | #define E1000_PBA_8K 0x0008 /* 8KB, default Rx allocation */ | ||
2275 | #define E1000_PBA_12K 0x000C /* 12KB, default Rx allocation */ | 2432 | #define E1000_PBA_12K 0x000C /* 12KB, default Rx allocation */ |
2276 | #define E1000_PBA_16K 0x0010 /* 16KB, default TX allocation */ | 2433 | #define E1000_PBA_16K 0x0010 /* 16KB, default TX allocation */ |
2277 | #define E1000_PBA_22K 0x0016 | 2434 | #define E1000_PBA_22K 0x0016 |
2278 | #define E1000_PBA_24K 0x0018 | 2435 | #define E1000_PBA_24K 0x0018 |
2279 | #define E1000_PBA_30K 0x001E | 2436 | #define E1000_PBA_30K 0x001E |
2280 | #define E1000_PBA_32K 0x0020 | 2437 | #define E1000_PBA_32K 0x0020 |
2438 | #define E1000_PBA_34K 0x0022 | ||
2281 | #define E1000_PBA_38K 0x0026 | 2439 | #define E1000_PBA_38K 0x0026 |
2282 | #define E1000_PBA_40K 0x0028 | 2440 | #define E1000_PBA_40K 0x0028 |
2283 | #define E1000_PBA_48K 0x0030 /* 48KB, default RX allocation */ | 2441 | #define E1000_PBA_48K 0x0030 /* 48KB, default RX allocation */ |
2284 | 2442 | ||
2443 | #define E1000_PBS_16K E1000_PBA_16K | ||
2444 | |||
2285 | /* Flow Control Constants */ | 2445 | /* Flow Control Constants */ |
2286 | #define FLOW_CONTROL_ADDRESS_LOW 0x00C28001 | 2446 | #define FLOW_CONTROL_ADDRESS_LOW 0x00C28001 |
2287 | #define FLOW_CONTROL_ADDRESS_HIGH 0x00000100 | 2447 | #define FLOW_CONTROL_ADDRESS_HIGH 0x00000100 |
@@ -2336,7 +2496,7 @@ struct e1000_host_command_info { | |||
2336 | /* Number of milliseconds we wait for Eeprom auto read bit done after MAC reset */ | 2496 | /* Number of milliseconds we wait for Eeprom auto read bit done after MAC reset */ |
2337 | #define AUTO_READ_DONE_TIMEOUT 10 | 2497 | #define AUTO_READ_DONE_TIMEOUT 10 |
2338 | /* Number of milliseconds we wait for PHY configuration done after MAC reset */ | 2498 | /* Number of milliseconds we wait for PHY configuration done after MAC reset */ |
2339 | #define PHY_CFG_TIMEOUT 40 | 2499 | #define PHY_CFG_TIMEOUT 100 |
2340 | 2500 | ||
2341 | #define E1000_TX_BUFFER_SIZE ((uint32_t)1514) | 2501 | #define E1000_TX_BUFFER_SIZE ((uint32_t)1514) |
2342 | 2502 | ||
@@ -2764,6 +2924,17 @@ struct e1000_host_command_info { | |||
2764 | #define M88E1000_EPSCR_TX_CLK_25 0x0070 /* 25 MHz TX_CLK */ | 2924 | #define M88E1000_EPSCR_TX_CLK_25 0x0070 /* 25 MHz TX_CLK */ |
2765 | #define M88E1000_EPSCR_TX_CLK_0 0x0000 /* NO TX_CLK */ | 2925 | #define M88E1000_EPSCR_TX_CLK_0 0x0000 /* NO TX_CLK */ |
2766 | 2926 | ||
2927 | /* M88EC018 Rev 2 specific DownShift settings */ | ||
2928 | #define M88EC018_EPSCR_DOWNSHIFT_COUNTER_MASK 0x0E00 | ||
2929 | #define M88EC018_EPSCR_DOWNSHIFT_COUNTER_1X 0x0000 | ||
2930 | #define M88EC018_EPSCR_DOWNSHIFT_COUNTER_2X 0x0200 | ||
2931 | #define M88EC018_EPSCR_DOWNSHIFT_COUNTER_3X 0x0400 | ||
2932 | #define M88EC018_EPSCR_DOWNSHIFT_COUNTER_4X 0x0600 | ||
2933 | #define M88EC018_EPSCR_DOWNSHIFT_COUNTER_5X 0x0800 | ||
2934 | #define M88EC018_EPSCR_DOWNSHIFT_COUNTER_6X 0x0A00 | ||
2935 | #define M88EC018_EPSCR_DOWNSHIFT_COUNTER_7X 0x0C00 | ||
2936 | #define M88EC018_EPSCR_DOWNSHIFT_COUNTER_8X 0x0E00 | ||
2937 | |||
2767 | /* IGP01E1000 Specific Port Config Register - R/W */ | 2938 | /* IGP01E1000 Specific Port Config Register - R/W */ |
2768 | #define IGP01E1000_PSCFR_AUTO_MDIX_PAR_DETECT 0x0010 | 2939 | #define IGP01E1000_PSCFR_AUTO_MDIX_PAR_DETECT 0x0010 |
2769 | #define IGP01E1000_PSCFR_PRE_EN 0x0020 | 2940 | #define IGP01E1000_PSCFR_PRE_EN 0x0020 |
@@ -2990,6 +3161,221 @@ struct e1000_host_command_info { | |||
2990 | #define L1LXT971A_PHY_ID 0x001378E0 | 3161 | #define L1LXT971A_PHY_ID 0x001378E0 |
2991 | #define GG82563_E_PHY_ID 0x01410CA0 | 3162 | #define GG82563_E_PHY_ID 0x01410CA0 |
2992 | 3163 | ||
3164 | |||
3165 | /* Bits... | ||
3166 | * 15-5: page | ||
3167 | * 4-0: register offset | ||
3168 | */ | ||
3169 | #define PHY_PAGE_SHIFT 5 | ||
3170 | #define PHY_REG(page, reg) \ | ||
3171 | (((page) << PHY_PAGE_SHIFT) | ((reg) & MAX_PHY_REG_ADDRESS)) | ||
3172 | |||
3173 | #define IGP3_PHY_PORT_CTRL \ | ||
3174 | PHY_REG(769, 17) /* Port General Configuration */ | ||
3175 | #define IGP3_PHY_RATE_ADAPT_CTRL \ | ||
3176 | PHY_REG(769, 25) /* Rate Adapter Control Register */ | ||
3177 | |||
3178 | #define IGP3_KMRN_FIFO_CTRL_STATS \ | ||
3179 | PHY_REG(770, 16) /* KMRN FIFO's control/status register */ | ||
3180 | #define IGP3_KMRN_POWER_MNG_CTRL \ | ||
3181 | PHY_REG(770, 17) /* KMRN Power Management Control Register */ | ||
3182 | #define IGP3_KMRN_INBAND_CTRL \ | ||
3183 | PHY_REG(770, 18) /* KMRN Inband Control Register */ | ||
3184 | #define IGP3_KMRN_DIAG \ | ||
3185 | PHY_REG(770, 19) /* KMRN Diagnostic register */ | ||
3186 | #define IGP3_KMRN_DIAG_PCS_LOCK_LOSS 0x0002 /* RX PCS is not synced */ | ||
3187 | #define IGP3_KMRN_ACK_TIMEOUT \ | ||
3188 | PHY_REG(770, 20) /* KMRN Acknowledge Timeouts register */ | ||
3189 | |||
3190 | #define IGP3_VR_CTRL \ | ||
3191 | PHY_REG(776, 18) /* Voltage regulator control register */ | ||
3192 | #define IGP3_VR_CTRL_MODE_SHUT 0x0200 /* Enter powerdown, shutdown VRs */ | ||
3193 | |||
3194 | #define IGP3_CAPABILITY \ | ||
3195 | PHY_REG(776, 19) /* IGP3 Capability Register */ | ||
3196 | |||
3197 | /* Capabilities for SKU Control */ | ||
3198 | #define IGP3_CAP_INITIATE_TEAM 0x0001 /* Able to initiate a team */ | ||
3199 | #define IGP3_CAP_WFM 0x0002 /* Support WoL and PXE */ | ||
3200 | #define IGP3_CAP_ASF 0x0004 /* Support ASF */ | ||
3201 | #define IGP3_CAP_LPLU 0x0008 /* Support Low Power Link Up */ | ||
3202 | #define IGP3_CAP_DC_AUTO_SPEED 0x0010 /* Support AC/DC Auto Link Speed */ | ||
3203 | #define IGP3_CAP_SPD 0x0020 /* Support Smart Power Down */ | ||
3204 | #define IGP3_CAP_MULT_QUEUE 0x0040 /* Support 2 tx & 2 rx queues */ | ||
3205 | #define IGP3_CAP_RSS 0x0080 /* Support RSS */ | ||
3206 | #define IGP3_CAP_8021PQ 0x0100 /* Support 802.1Q & 802.1p */ | ||
3207 | #define IGP3_CAP_AMT_CB 0x0200 /* Support active manageability and circuit breaker */ | ||
3208 | |||
3209 | #define IGP3_PPC_JORDAN_EN 0x0001 | ||
3210 | #define IGP3_PPC_JORDAN_GIGA_SPEED 0x0002 | ||
3211 | |||
3212 | #define IGP3_KMRN_PMC_EE_IDLE_LINK_DIS 0x0001 | ||
3213 | #define IGP3_KMRN_PMC_K0S_ENTRY_LATENCY_MASK 0x001E | ||
3214 | #define IGP3_KMRN_PMC_K0S_MODE1_EN_GIGA 0x0020 | ||
3215 | #define IGP3_KMRN_PMC_K0S_MODE1_EN_100 0x0040 | ||
3216 | |||
3217 | #define IGP3E1000_PHY_MISC_CTRL 0x1B /* Misc. Ctrl register */ | ||
3218 | #define IGP3_PHY_MISC_DUPLEX_MANUAL_SET 0x1000 /* Duplex Manual Set */ | ||
3219 | |||
3220 | #define IGP3_KMRN_EXT_CTRL PHY_REG(770, 18) | ||
3221 | #define IGP3_KMRN_EC_DIS_INBAND 0x0080 | ||
3222 | |||
3223 | #define IGP03E1000_E_PHY_ID 0x02A80390 | ||
3224 | #define IFE_E_PHY_ID 0x02A80330 /* 10/100 PHY */ | ||
3225 | #define IFE_PLUS_E_PHY_ID 0x02A80320 | ||
3226 | #define IFE_C_E_PHY_ID 0x02A80310 | ||
3227 | |||
3228 | #define IFE_PHY_EXTENDED_STATUS_CONTROL 0x10 /* 100BaseTx Extended Status, Control and Address */ | ||
3229 | #define IFE_PHY_SPECIAL_CONTROL 0x11 /* 100BaseTx PHY special control register */ | ||
3230 | #define IFE_PHY_RCV_FALSE_CARRIER 0x13 /* 100BaseTx Receive False Carrier Counter */ | ||
3231 | #define IFE_PHY_RCV_DISCONNECT 0x14 /* 100BaseTx Receive Disconnet Counter */ | ||
3232 | #define IFE_PHY_RCV_ERROT_FRAME 0x15 /* 100BaseTx Receive Error Frame Counter */ | ||
3233 | #define IFE_PHY_RCV_SYMBOL_ERR 0x16 /* Receive Symbol Error Counter */ | ||
3234 | #define IFE_PHY_PREM_EOF_ERR 0x17 /* 100BaseTx Receive Premature End Of Frame Error Counter */ | ||
3235 | #define IFE_PHY_RCV_EOF_ERR 0x18 /* 10BaseT Receive End Of Frame Error Counter */ | ||
3236 | #define IFE_PHY_TX_JABBER_DETECT 0x19 /* 10BaseT Transmit Jabber Detect Counter */ | ||
3237 | #define IFE_PHY_EQUALIZER 0x1A /* PHY Equalizer Control and Status */ | ||
3238 | #define IFE_PHY_SPECIAL_CONTROL_LED 0x1B /* PHY special control and LED configuration */ | ||
3239 | #define IFE_PHY_MDIX_CONTROL 0x1C /* MDI/MDI-X Control register */ | ||
3240 | #define IFE_PHY_HWI_CONTROL 0x1D /* Hardware Integrity Control (HWI) */ | ||
3241 | |||
3242 | #define IFE_PESC_REDUCED_POWER_DOWN_DISABLE 0x2000 /* Defaut 1 = Disable auto reduced power down */ | ||
3243 | #define IFE_PESC_100BTX_POWER_DOWN 0x0400 /* Indicates the power state of 100BASE-TX */ | ||
3244 | #define IFE_PESC_10BTX_POWER_DOWN 0x0200 /* Indicates the power state of 10BASE-T */ | ||
3245 | #define IFE_PESC_POLARITY_REVERSED 0x0100 /* Indicates 10BASE-T polarity */ | ||
3246 | #define IFE_PESC_PHY_ADDR_MASK 0x007C /* Bit 6:2 for sampled PHY address */ | ||
3247 | #define IFE_PESC_SPEED 0x0002 /* Auto-negotiation speed result 1=100Mbs, 0=10Mbs */ | ||
3248 | #define IFE_PESC_DUPLEX 0x0001 /* Auto-negotiation duplex result 1=Full, 0=Half */ | ||
3249 | #define IFE_PESC_POLARITY_REVERSED_SHIFT 8 | ||
3250 | |||
3251 | #define IFE_PSC_DISABLE_DYNAMIC_POWER_DOWN 0x0100 /* 1 = Dyanmic Power Down disabled */ | ||
3252 | #define IFE_PSC_FORCE_POLARITY 0x0020 /* 1=Reversed Polarity, 0=Normal */ | ||
3253 | #define IFE_PSC_AUTO_POLARITY_DISABLE 0x0010 /* 1=Auto Polarity Disabled, 0=Enabled */ | ||
3254 | #define IFE_PSC_JABBER_FUNC_DISABLE 0x0001 /* 1=Jabber Disabled, 0=Normal Jabber Operation */ | ||
3255 | #define IFE_PSC_FORCE_POLARITY_SHIFT 5 | ||
3256 | #define IFE_PSC_AUTO_POLARITY_DISABLE_SHIFT 4 | ||
3257 | |||
3258 | #define IFE_PMC_AUTO_MDIX 0x0080 /* 1=enable MDI/MDI-X feature, default 0=disabled */ | ||
3259 | #define IFE_PMC_FORCE_MDIX 0x0040 /* 1=force MDIX-X, 0=force MDI */ | ||
3260 | #define IFE_PMC_MDIX_STATUS 0x0020 /* 1=MDI-X, 0=MDI */ | ||
3261 | #define IFE_PMC_AUTO_MDIX_COMPLETE 0x0010 /* Resolution algorthm is completed */ | ||
3262 | #define IFE_PMC_MDIX_MODE_SHIFT 6 | ||
3263 | #define IFE_PHC_MDIX_RESET_ALL_MASK 0x0000 /* Disable auto MDI-X */ | ||
3264 | |||
3265 | #define IFE_PHC_HWI_ENABLE 0x8000 /* Enable the HWI feature */ | ||
3266 | #define IFE_PHC_ABILITY_CHECK 0x4000 /* 1= Test Passed, 0=failed */ | ||
3267 | #define IFE_PHC_TEST_EXEC 0x2000 /* PHY launch test pulses on the wire */ | ||
3268 | #define IFE_PHC_HIGHZ 0x0200 /* 1 = Open Circuit */ | ||
3269 | #define IFE_PHC_LOWZ 0x0400 /* 1 = Short Circuit */ | ||
3270 | #define IFE_PHC_LOW_HIGH_Z_MASK 0x0600 /* Mask for indication type of problem on the line */ | ||
3271 | #define IFE_PHC_DISTANCE_MASK 0x01FF /* Mask for distance to the cable problem, in 80cm granularity */ | ||
3272 | #define IFE_PHC_RESET_ALL_MASK 0x0000 /* Disable HWI */ | ||
3273 | #define IFE_PSCL_PROBE_MODE 0x0020 /* LED Probe mode */ | ||
3274 | #define IFE_PSCL_PROBE_LEDS_OFF 0x0006 /* Force LEDs 0 and 2 off */ | ||
3275 | #define IFE_PSCL_PROBE_LEDS_ON 0x0007 /* Force LEDs 0 and 2 on */ | ||
3276 | |||
3277 | #define ICH8_FLASH_COMMAND_TIMEOUT 500 /* 500 ms , should be adjusted */ | ||
3278 | #define ICH8_FLASH_CYCLE_REPEAT_COUNT 10 /* 10 cycles , should be adjusted */ | ||
3279 | #define ICH8_FLASH_SEG_SIZE_256 256 | ||
3280 | #define ICH8_FLASH_SEG_SIZE_4K 4096 | ||
3281 | #define ICH8_FLASH_SEG_SIZE_64K 65536 | ||
3282 | |||
3283 | #define ICH8_CYCLE_READ 0x0 | ||
3284 | #define ICH8_CYCLE_RESERVED 0x1 | ||
3285 | #define ICH8_CYCLE_WRITE 0x2 | ||
3286 | #define ICH8_CYCLE_ERASE 0x3 | ||
3287 | |||
3288 | #define ICH8_FLASH_GFPREG 0x0000 | ||
3289 | #define ICH8_FLASH_HSFSTS 0x0004 | ||
3290 | #define ICH8_FLASH_HSFCTL 0x0006 | ||
3291 | #define ICH8_FLASH_FADDR 0x0008 | ||
3292 | #define ICH8_FLASH_FDATA0 0x0010 | ||
3293 | #define ICH8_FLASH_FRACC 0x0050 | ||
3294 | #define ICH8_FLASH_FREG0 0x0054 | ||
3295 | #define ICH8_FLASH_FREG1 0x0058 | ||
3296 | #define ICH8_FLASH_FREG2 0x005C | ||
3297 | #define ICH8_FLASH_FREG3 0x0060 | ||
3298 | #define ICH8_FLASH_FPR0 0x0074 | ||
3299 | #define ICH8_FLASH_FPR1 0x0078 | ||
3300 | #define ICH8_FLASH_SSFSTS 0x0090 | ||
3301 | #define ICH8_FLASH_SSFCTL 0x0092 | ||
3302 | #define ICH8_FLASH_PREOP 0x0094 | ||
3303 | #define ICH8_FLASH_OPTYPE 0x0096 | ||
3304 | #define ICH8_FLASH_OPMENU 0x0098 | ||
3305 | |||
3306 | #define ICH8_FLASH_REG_MAPSIZE 0x00A0 | ||
3307 | #define ICH8_FLASH_SECTOR_SIZE 4096 | ||
3308 | #define ICH8_GFPREG_BASE_MASK 0x1FFF | ||
3309 | #define ICH8_FLASH_LINEAR_ADDR_MASK 0x00FFFFFF | ||
3310 | |||
3311 | /* ICH8 GbE Flash Hardware Sequencing Flash Status Register bit breakdown */ | ||
3312 | /* Offset 04h HSFSTS */ | ||
3313 | union ich8_hws_flash_status { | ||
3314 | struct ich8_hsfsts { | ||
3315 | #ifdef E1000_BIG_ENDIAN | ||
3316 | uint16_t reserved2 :6; | ||
3317 | uint16_t fldesvalid :1; | ||
3318 | uint16_t flockdn :1; | ||
3319 | uint16_t flcdone :1; | ||
3320 | uint16_t flcerr :1; | ||
3321 | uint16_t dael :1; | ||
3322 | uint16_t berasesz :2; | ||
3323 | uint16_t flcinprog :1; | ||
3324 | uint16_t reserved1 :2; | ||
3325 | #else | ||
3326 | uint16_t flcdone :1; /* bit 0 Flash Cycle Done */ | ||
3327 | uint16_t flcerr :1; /* bit 1 Flash Cycle Error */ | ||
3328 | uint16_t dael :1; /* bit 2 Direct Access error Log */ | ||
3329 | uint16_t berasesz :2; /* bit 4:3 Block/Sector Erase Size */ | ||
3330 | uint16_t flcinprog :1; /* bit 5 flash SPI cycle in Progress */ | ||
3331 | uint16_t reserved1 :2; /* bit 13:6 Reserved */ | ||
3332 | uint16_t reserved2 :6; /* bit 13:6 Reserved */ | ||
3333 | uint16_t fldesvalid :1; /* bit 14 Flash Descriptor Valid */ | ||
3334 | uint16_t flockdn :1; /* bit 15 Flash Configuration Lock-Down */ | ||
3335 | #endif | ||
3336 | } hsf_status; | ||
3337 | uint16_t regval; | ||
3338 | }; | ||
3339 | |||
3340 | /* ICH8 GbE Flash Hardware Sequencing Flash control Register bit breakdown */ | ||
3341 | /* Offset 06h FLCTL */ | ||
3342 | union ich8_hws_flash_ctrl { | ||
3343 | struct ich8_hsflctl { | ||
3344 | #ifdef E1000_BIG_ENDIAN | ||
3345 | uint16_t fldbcount :2; | ||
3346 | uint16_t flockdn :6; | ||
3347 | uint16_t flcgo :1; | ||
3348 | uint16_t flcycle :2; | ||
3349 | uint16_t reserved :5; | ||
3350 | #else | ||
3351 | uint16_t flcgo :1; /* 0 Flash Cycle Go */ | ||
3352 | uint16_t flcycle :2; /* 2:1 Flash Cycle */ | ||
3353 | uint16_t reserved :5; /* 7:3 Reserved */ | ||
3354 | uint16_t fldbcount :2; /* 9:8 Flash Data Byte Count */ | ||
3355 | uint16_t flockdn :6; /* 15:10 Reserved */ | ||
3356 | #endif | ||
3357 | } hsf_ctrl; | ||
3358 | uint16_t regval; | ||
3359 | }; | ||
3360 | |||
3361 | /* ICH8 Flash Region Access Permissions */ | ||
3362 | union ich8_hws_flash_regacc { | ||
3363 | struct ich8_flracc { | ||
3364 | #ifdef E1000_BIG_ENDIAN | ||
3365 | uint32_t gmwag :8; | ||
3366 | uint32_t gmrag :8; | ||
3367 | uint32_t grwa :8; | ||
3368 | uint32_t grra :8; | ||
3369 | #else | ||
3370 | uint32_t grra :8; /* 0:7 GbE region Read Access */ | ||
3371 | uint32_t grwa :8; /* 8:15 GbE region Write Access */ | ||
3372 | uint32_t gmrag :8; /* 23:16 GbE Master Read Access Grant */ | ||
3373 | uint32_t gmwag :8; /* 31:24 GbE Master Write Access Grant */ | ||
3374 | #endif | ||
3375 | } hsf_flregacc; | ||
3376 | uint16_t regval; | ||
3377 | }; | ||
3378 | |||
2993 | /* Miscellaneous PHY bit definitions. */ | 3379 | /* Miscellaneous PHY bit definitions. */ |
2994 | #define PHY_PREAMBLE 0xFFFFFFFF | 3380 | #define PHY_PREAMBLE 0xFFFFFFFF |
2995 | #define PHY_SOF 0x01 | 3381 | #define PHY_SOF 0x01 |
diff --git a/drivers/net/e1000/e1000_main.c b/drivers/net/e1000/e1000_main.c index f77624f5f17b..6d3d41934503 100644 --- a/drivers/net/e1000/e1000_main.c +++ b/drivers/net/e1000/e1000_main.c | |||
@@ -36,7 +36,7 @@ static char e1000_driver_string[] = "Intel(R) PRO/1000 Network Driver"; | |||
36 | #else | 36 | #else |
37 | #define DRIVERNAPI "-NAPI" | 37 | #define DRIVERNAPI "-NAPI" |
38 | #endif | 38 | #endif |
39 | #define DRV_VERSION "7.0.38-k4"DRIVERNAPI | 39 | #define DRV_VERSION "7.1.9-k2"DRIVERNAPI |
40 | char e1000_driver_version[] = DRV_VERSION; | 40 | char e1000_driver_version[] = DRV_VERSION; |
41 | static char e1000_copyright[] = "Copyright (c) 1999-2006 Intel Corporation."; | 41 | static char e1000_copyright[] = "Copyright (c) 1999-2006 Intel Corporation."; |
42 | 42 | ||
@@ -73,6 +73,11 @@ static struct pci_device_id e1000_pci_tbl[] = { | |||
73 | INTEL_E1000_ETHERNET_DEVICE(0x1026), | 73 | INTEL_E1000_ETHERNET_DEVICE(0x1026), |
74 | INTEL_E1000_ETHERNET_DEVICE(0x1027), | 74 | INTEL_E1000_ETHERNET_DEVICE(0x1027), |
75 | INTEL_E1000_ETHERNET_DEVICE(0x1028), | 75 | INTEL_E1000_ETHERNET_DEVICE(0x1028), |
76 | INTEL_E1000_ETHERNET_DEVICE(0x1049), | ||
77 | INTEL_E1000_ETHERNET_DEVICE(0x104A), | ||
78 | INTEL_E1000_ETHERNET_DEVICE(0x104B), | ||
79 | INTEL_E1000_ETHERNET_DEVICE(0x104C), | ||
80 | INTEL_E1000_ETHERNET_DEVICE(0x104D), | ||
76 | INTEL_E1000_ETHERNET_DEVICE(0x105E), | 81 | INTEL_E1000_ETHERNET_DEVICE(0x105E), |
77 | INTEL_E1000_ETHERNET_DEVICE(0x105F), | 82 | INTEL_E1000_ETHERNET_DEVICE(0x105F), |
78 | INTEL_E1000_ETHERNET_DEVICE(0x1060), | 83 | INTEL_E1000_ETHERNET_DEVICE(0x1060), |
@@ -96,6 +101,8 @@ static struct pci_device_id e1000_pci_tbl[] = { | |||
96 | INTEL_E1000_ETHERNET_DEVICE(0x109A), | 101 | INTEL_E1000_ETHERNET_DEVICE(0x109A), |
97 | INTEL_E1000_ETHERNET_DEVICE(0x10B5), | 102 | INTEL_E1000_ETHERNET_DEVICE(0x10B5), |
98 | INTEL_E1000_ETHERNET_DEVICE(0x10B9), | 103 | INTEL_E1000_ETHERNET_DEVICE(0x10B9), |
104 | INTEL_E1000_ETHERNET_DEVICE(0x10BA), | ||
105 | INTEL_E1000_ETHERNET_DEVICE(0x10BB), | ||
99 | /* required last entry */ | 106 | /* required last entry */ |
100 | {0,} | 107 | {0,} |
101 | }; | 108 | }; |
@@ -133,7 +140,6 @@ static void e1000_clean_rx_ring(struct e1000_adapter *adapter, | |||
133 | static void e1000_set_multi(struct net_device *netdev); | 140 | static void e1000_set_multi(struct net_device *netdev); |
134 | static void e1000_update_phy_info(unsigned long data); | 141 | static void e1000_update_phy_info(unsigned long data); |
135 | static void e1000_watchdog(unsigned long data); | 142 | static void e1000_watchdog(unsigned long data); |
136 | static void e1000_watchdog_task(struct e1000_adapter *adapter); | ||
137 | static void e1000_82547_tx_fifo_stall(unsigned long data); | 143 | static void e1000_82547_tx_fifo_stall(unsigned long data); |
138 | static int e1000_xmit_frame(struct sk_buff *skb, struct net_device *netdev); | 144 | static int e1000_xmit_frame(struct sk_buff *skb, struct net_device *netdev); |
139 | static struct net_device_stats * e1000_get_stats(struct net_device *netdev); | 145 | static struct net_device_stats * e1000_get_stats(struct net_device *netdev); |
@@ -178,8 +184,8 @@ static void e1000_vlan_rx_add_vid(struct net_device *netdev, uint16_t vid); | |||
178 | static void e1000_vlan_rx_kill_vid(struct net_device *netdev, uint16_t vid); | 184 | static void e1000_vlan_rx_kill_vid(struct net_device *netdev, uint16_t vid); |
179 | static void e1000_restore_vlan(struct e1000_adapter *adapter); | 185 | static void e1000_restore_vlan(struct e1000_adapter *adapter); |
180 | 186 | ||
181 | #ifdef CONFIG_PM | ||
182 | static int e1000_suspend(struct pci_dev *pdev, pm_message_t state); | 187 | static int e1000_suspend(struct pci_dev *pdev, pm_message_t state); |
188 | #ifdef CONFIG_PM | ||
183 | static int e1000_resume(struct pci_dev *pdev); | 189 | static int e1000_resume(struct pci_dev *pdev); |
184 | #endif | 190 | #endif |
185 | static void e1000_shutdown(struct pci_dev *pdev); | 191 | static void e1000_shutdown(struct pci_dev *pdev); |
@@ -206,8 +212,8 @@ static struct pci_driver e1000_driver = { | |||
206 | .probe = e1000_probe, | 212 | .probe = e1000_probe, |
207 | .remove = __devexit_p(e1000_remove), | 213 | .remove = __devexit_p(e1000_remove), |
208 | /* Power Managment Hooks */ | 214 | /* Power Managment Hooks */ |
209 | #ifdef CONFIG_PM | ||
210 | .suspend = e1000_suspend, | 215 | .suspend = e1000_suspend, |
216 | #ifdef CONFIG_PM | ||
211 | .resume = e1000_resume, | 217 | .resume = e1000_resume, |
212 | #endif | 218 | #endif |
213 | .shutdown = e1000_shutdown, | 219 | .shutdown = e1000_shutdown, |
@@ -261,6 +267,44 @@ e1000_exit_module(void) | |||
261 | 267 | ||
262 | module_exit(e1000_exit_module); | 268 | module_exit(e1000_exit_module); |
263 | 269 | ||
270 | static int e1000_request_irq(struct e1000_adapter *adapter) | ||
271 | { | ||
272 | struct net_device *netdev = adapter->netdev; | ||
273 | int flags, err = 0; | ||
274 | |||
275 | flags = IRQF_SHARED; | ||
276 | #ifdef CONFIG_PCI_MSI | ||
277 | if (adapter->hw.mac_type > e1000_82547_rev_2) { | ||
278 | adapter->have_msi = TRUE; | ||
279 | if ((err = pci_enable_msi(adapter->pdev))) { | ||
280 | DPRINTK(PROBE, ERR, | ||
281 | "Unable to allocate MSI interrupt Error: %d\n", err); | ||
282 | adapter->have_msi = FALSE; | ||
283 | } | ||
284 | } | ||
285 | if (adapter->have_msi) | ||
286 | flags &= ~IRQF_SHARED; | ||
287 | #endif | ||
288 | if ((err = request_irq(adapter->pdev->irq, &e1000_intr, flags, | ||
289 | netdev->name, netdev))) | ||
290 | DPRINTK(PROBE, ERR, | ||
291 | "Unable to allocate interrupt Error: %d\n", err); | ||
292 | |||
293 | return err; | ||
294 | } | ||
295 | |||
296 | static void e1000_free_irq(struct e1000_adapter *adapter) | ||
297 | { | ||
298 | struct net_device *netdev = adapter->netdev; | ||
299 | |||
300 | free_irq(adapter->pdev->irq, netdev); | ||
301 | |||
302 | #ifdef CONFIG_PCI_MSI | ||
303 | if (adapter->have_msi) | ||
304 | pci_disable_msi(adapter->pdev); | ||
305 | #endif | ||
306 | } | ||
307 | |||
264 | /** | 308 | /** |
265 | * e1000_irq_disable - Mask off interrupt generation on the NIC | 309 | * e1000_irq_disable - Mask off interrupt generation on the NIC |
266 | * @adapter: board private structure | 310 | * @adapter: board private structure |
@@ -329,6 +373,7 @@ e1000_release_hw_control(struct e1000_adapter *adapter) | |||
329 | { | 373 | { |
330 | uint32_t ctrl_ext; | 374 | uint32_t ctrl_ext; |
331 | uint32_t swsm; | 375 | uint32_t swsm; |
376 | uint32_t extcnf; | ||
332 | 377 | ||
333 | /* Let firmware taken over control of h/w */ | 378 | /* Let firmware taken over control of h/w */ |
334 | switch (adapter->hw.mac_type) { | 379 | switch (adapter->hw.mac_type) { |
@@ -343,6 +388,11 @@ e1000_release_hw_control(struct e1000_adapter *adapter) | |||
343 | swsm = E1000_READ_REG(&adapter->hw, SWSM); | 388 | swsm = E1000_READ_REG(&adapter->hw, SWSM); |
344 | E1000_WRITE_REG(&adapter->hw, SWSM, | 389 | E1000_WRITE_REG(&adapter->hw, SWSM, |
345 | swsm & ~E1000_SWSM_DRV_LOAD); | 390 | swsm & ~E1000_SWSM_DRV_LOAD); |
391 | case e1000_ich8lan: | ||
392 | extcnf = E1000_READ_REG(&adapter->hw, CTRL_EXT); | ||
393 | E1000_WRITE_REG(&adapter->hw, CTRL_EXT, | ||
394 | extcnf & ~E1000_CTRL_EXT_DRV_LOAD); | ||
395 | break; | ||
346 | default: | 396 | default: |
347 | break; | 397 | break; |
348 | } | 398 | } |
@@ -364,6 +414,7 @@ e1000_get_hw_control(struct e1000_adapter *adapter) | |||
364 | { | 414 | { |
365 | uint32_t ctrl_ext; | 415 | uint32_t ctrl_ext; |
366 | uint32_t swsm; | 416 | uint32_t swsm; |
417 | uint32_t extcnf; | ||
367 | /* Let firmware know the driver has taken over */ | 418 | /* Let firmware know the driver has taken over */ |
368 | switch (adapter->hw.mac_type) { | 419 | switch (adapter->hw.mac_type) { |
369 | case e1000_82571: | 420 | case e1000_82571: |
@@ -378,6 +429,11 @@ e1000_get_hw_control(struct e1000_adapter *adapter) | |||
378 | E1000_WRITE_REG(&adapter->hw, SWSM, | 429 | E1000_WRITE_REG(&adapter->hw, SWSM, |
379 | swsm | E1000_SWSM_DRV_LOAD); | 430 | swsm | E1000_SWSM_DRV_LOAD); |
380 | break; | 431 | break; |
432 | case e1000_ich8lan: | ||
433 | extcnf = E1000_READ_REG(&adapter->hw, EXTCNF_CTRL); | ||
434 | E1000_WRITE_REG(&adapter->hw, EXTCNF_CTRL, | ||
435 | extcnf | E1000_EXTCNF_CTRL_SWFLAG); | ||
436 | break; | ||
381 | default: | 437 | default: |
382 | break; | 438 | break; |
383 | } | 439 | } |
@@ -387,18 +443,10 @@ int | |||
387 | e1000_up(struct e1000_adapter *adapter) | 443 | e1000_up(struct e1000_adapter *adapter) |
388 | { | 444 | { |
389 | struct net_device *netdev = adapter->netdev; | 445 | struct net_device *netdev = adapter->netdev; |
390 | int i, err; | 446 | int i; |
391 | 447 | ||
392 | /* hardware has been reset, we need to reload some things */ | 448 | /* hardware has been reset, we need to reload some things */ |
393 | 449 | ||
394 | /* Reset the PHY if it was previously powered down */ | ||
395 | if (adapter->hw.media_type == e1000_media_type_copper) { | ||
396 | uint16_t mii_reg; | ||
397 | e1000_read_phy_reg(&adapter->hw, PHY_CTRL, &mii_reg); | ||
398 | if (mii_reg & MII_CR_POWER_DOWN) | ||
399 | e1000_phy_hw_reset(&adapter->hw); | ||
400 | } | ||
401 | |||
402 | e1000_set_multi(netdev); | 450 | e1000_set_multi(netdev); |
403 | 451 | ||
404 | e1000_restore_vlan(adapter); | 452 | e1000_restore_vlan(adapter); |
@@ -415,24 +463,6 @@ e1000_up(struct e1000_adapter *adapter) | |||
415 | E1000_DESC_UNUSED(ring)); | 463 | E1000_DESC_UNUSED(ring)); |
416 | } | 464 | } |
417 | 465 | ||
418 | #ifdef CONFIG_PCI_MSI | ||
419 | if (adapter->hw.mac_type > e1000_82547_rev_2) { | ||
420 | adapter->have_msi = TRUE; | ||
421 | if ((err = pci_enable_msi(adapter->pdev))) { | ||
422 | DPRINTK(PROBE, ERR, | ||
423 | "Unable to allocate MSI interrupt Error: %d\n", err); | ||
424 | adapter->have_msi = FALSE; | ||
425 | } | ||
426 | } | ||
427 | #endif | ||
428 | if ((err = request_irq(adapter->pdev->irq, &e1000_intr, | ||
429 | IRQF_SHARED | IRQF_SAMPLE_RANDOM, | ||
430 | netdev->name, netdev))) { | ||
431 | DPRINTK(PROBE, ERR, | ||
432 | "Unable to allocate interrupt Error: %d\n", err); | ||
433 | return err; | ||
434 | } | ||
435 | |||
436 | adapter->tx_queue_len = netdev->tx_queue_len; | 466 | adapter->tx_queue_len = netdev->tx_queue_len; |
437 | 467 | ||
438 | mod_timer(&adapter->watchdog_timer, jiffies); | 468 | mod_timer(&adapter->watchdog_timer, jiffies); |
@@ -445,21 +475,60 @@ e1000_up(struct e1000_adapter *adapter) | |||
445 | return 0; | 475 | return 0; |
446 | } | 476 | } |
447 | 477 | ||
478 | /** | ||
479 | * e1000_power_up_phy - restore link in case the phy was powered down | ||
480 | * @adapter: address of board private structure | ||
481 | * | ||
482 | * The phy may be powered down to save power and turn off link when the | ||
483 | * driver is unloaded and wake on lan is not enabled (among others) | ||
484 | * *** this routine MUST be followed by a call to e1000_reset *** | ||
485 | * | ||
486 | **/ | ||
487 | |||
488 | static void e1000_power_up_phy(struct e1000_adapter *adapter) | ||
489 | { | ||
490 | uint16_t mii_reg = 0; | ||
491 | |||
492 | /* Just clear the power down bit to wake the phy back up */ | ||
493 | if (adapter->hw.media_type == e1000_media_type_copper) { | ||
494 | /* according to the manual, the phy will retain its | ||
495 | * settings across a power-down/up cycle */ | ||
496 | e1000_read_phy_reg(&adapter->hw, PHY_CTRL, &mii_reg); | ||
497 | mii_reg &= ~MII_CR_POWER_DOWN; | ||
498 | e1000_write_phy_reg(&adapter->hw, PHY_CTRL, mii_reg); | ||
499 | } | ||
500 | } | ||
501 | |||
502 | static void e1000_power_down_phy(struct e1000_adapter *adapter) | ||
503 | { | ||
504 | boolean_t mng_mode_enabled = (adapter->hw.mac_type >= e1000_82571) && | ||
505 | e1000_check_mng_mode(&adapter->hw); | ||
506 | /* Power down the PHY so no link is implied when interface is down | ||
507 | * The PHY cannot be powered down if any of the following is TRUE | ||
508 | * (a) WoL is enabled | ||
509 | * (b) AMT is active | ||
510 | * (c) SoL/IDER session is active */ | ||
511 | if (!adapter->wol && adapter->hw.mac_type >= e1000_82540 && | ||
512 | adapter->hw.mac_type != e1000_ich8lan && | ||
513 | adapter->hw.media_type == e1000_media_type_copper && | ||
514 | !(E1000_READ_REG(&adapter->hw, MANC) & E1000_MANC_SMBUS_EN) && | ||
515 | !mng_mode_enabled && | ||
516 | !e1000_check_phy_reset_block(&adapter->hw)) { | ||
517 | uint16_t mii_reg = 0; | ||
518 | e1000_read_phy_reg(&adapter->hw, PHY_CTRL, &mii_reg); | ||
519 | mii_reg |= MII_CR_POWER_DOWN; | ||
520 | e1000_write_phy_reg(&adapter->hw, PHY_CTRL, mii_reg); | ||
521 | mdelay(1); | ||
522 | } | ||
523 | } | ||
524 | |||
448 | void | 525 | void |
449 | e1000_down(struct e1000_adapter *adapter) | 526 | e1000_down(struct e1000_adapter *adapter) |
450 | { | 527 | { |
451 | struct net_device *netdev = adapter->netdev; | 528 | struct net_device *netdev = adapter->netdev; |
452 | boolean_t mng_mode_enabled = (adapter->hw.mac_type >= e1000_82571) && | ||
453 | e1000_check_mng_mode(&adapter->hw); | ||
454 | 529 | ||
455 | e1000_irq_disable(adapter); | 530 | e1000_irq_disable(adapter); |
456 | 531 | ||
457 | free_irq(adapter->pdev->irq, netdev); | ||
458 | #ifdef CONFIG_PCI_MSI | ||
459 | if (adapter->hw.mac_type > e1000_82547_rev_2 && | ||
460 | adapter->have_msi == TRUE) | ||
461 | pci_disable_msi(adapter->pdev); | ||
462 | #endif | ||
463 | del_timer_sync(&adapter->tx_fifo_stall_timer); | 532 | del_timer_sync(&adapter->tx_fifo_stall_timer); |
464 | del_timer_sync(&adapter->watchdog_timer); | 533 | del_timer_sync(&adapter->watchdog_timer); |
465 | del_timer_sync(&adapter->phy_info_timer); | 534 | del_timer_sync(&adapter->phy_info_timer); |
@@ -476,23 +545,17 @@ e1000_down(struct e1000_adapter *adapter) | |||
476 | e1000_reset(adapter); | 545 | e1000_reset(adapter); |
477 | e1000_clean_all_tx_rings(adapter); | 546 | e1000_clean_all_tx_rings(adapter); |
478 | e1000_clean_all_rx_rings(adapter); | 547 | e1000_clean_all_rx_rings(adapter); |
548 | } | ||
479 | 549 | ||
480 | /* Power down the PHY so no link is implied when interface is down * | 550 | void |
481 | * The PHY cannot be powered down if any of the following is TRUE * | 551 | e1000_reinit_locked(struct e1000_adapter *adapter) |
482 | * (a) WoL is enabled | 552 | { |
483 | * (b) AMT is active | 553 | WARN_ON(in_interrupt()); |
484 | * (c) SoL/IDER session is active */ | 554 | while (test_and_set_bit(__E1000_RESETTING, &adapter->flags)) |
485 | if (!adapter->wol && adapter->hw.mac_type >= e1000_82540 && | 555 | msleep(1); |
486 | adapter->hw.media_type == e1000_media_type_copper && | 556 | e1000_down(adapter); |
487 | !(E1000_READ_REG(&adapter->hw, MANC) & E1000_MANC_SMBUS_EN) && | 557 | e1000_up(adapter); |
488 | !mng_mode_enabled && | 558 | clear_bit(__E1000_RESETTING, &adapter->flags); |
489 | !e1000_check_phy_reset_block(&adapter->hw)) { | ||
490 | uint16_t mii_reg; | ||
491 | e1000_read_phy_reg(&adapter->hw, PHY_CTRL, &mii_reg); | ||
492 | mii_reg |= MII_CR_POWER_DOWN; | ||
493 | e1000_write_phy_reg(&adapter->hw, PHY_CTRL, mii_reg); | ||
494 | mdelay(1); | ||
495 | } | ||
496 | } | 559 | } |
497 | 560 | ||
498 | void | 561 | void |
@@ -518,6 +581,9 @@ e1000_reset(struct e1000_adapter *adapter) | |||
518 | case e1000_82573: | 581 | case e1000_82573: |
519 | pba = E1000_PBA_12K; | 582 | pba = E1000_PBA_12K; |
520 | break; | 583 | break; |
584 | case e1000_ich8lan: | ||
585 | pba = E1000_PBA_8K; | ||
586 | break; | ||
521 | default: | 587 | default: |
522 | pba = E1000_PBA_48K; | 588 | pba = E1000_PBA_48K; |
523 | break; | 589 | break; |
@@ -542,6 +608,12 @@ e1000_reset(struct e1000_adapter *adapter) | |||
542 | /* Set the FC high water mark to 90% of the FIFO size. | 608 | /* Set the FC high water mark to 90% of the FIFO size. |
543 | * Required to clear last 3 LSB */ | 609 | * Required to clear last 3 LSB */ |
544 | fc_high_water_mark = ((pba * 9216)/10) & 0xFFF8; | 610 | fc_high_water_mark = ((pba * 9216)/10) & 0xFFF8; |
611 | /* We can't use 90% on small FIFOs because the remainder | ||
612 | * would be less than 1 full frame. In this case, we size | ||
613 | * it to allow at least a full frame above the high water | ||
614 | * mark. */ | ||
615 | if (pba < E1000_PBA_16K) | ||
616 | fc_high_water_mark = (pba * 1024) - 1600; | ||
545 | 617 | ||
546 | adapter->hw.fc_high_water = fc_high_water_mark; | 618 | adapter->hw.fc_high_water = fc_high_water_mark; |
547 | adapter->hw.fc_low_water = fc_high_water_mark - 8; | 619 | adapter->hw.fc_low_water = fc_high_water_mark - 8; |
@@ -564,6 +636,23 @@ e1000_reset(struct e1000_adapter *adapter) | |||
564 | 636 | ||
565 | e1000_reset_adaptive(&adapter->hw); | 637 | e1000_reset_adaptive(&adapter->hw); |
566 | e1000_phy_get_info(&adapter->hw, &adapter->phy_info); | 638 | e1000_phy_get_info(&adapter->hw, &adapter->phy_info); |
639 | |||
640 | if (!adapter->smart_power_down && | ||
641 | (adapter->hw.mac_type == e1000_82571 || | ||
642 | adapter->hw.mac_type == e1000_82572)) { | ||
643 | uint16_t phy_data = 0; | ||
644 | /* speed up time to link by disabling smart power down, ignore | ||
645 | * the return value of this function because there is nothing | ||
646 | * different we would do if it failed */ | ||
647 | e1000_read_phy_reg(&adapter->hw, IGP02E1000_PHY_POWER_MGMT, | ||
648 | &phy_data); | ||
649 | phy_data &= ~IGP02E1000_PM_SPD; | ||
650 | e1000_write_phy_reg(&adapter->hw, IGP02E1000_PHY_POWER_MGMT, | ||
651 | phy_data); | ||
652 | } | ||
653 | |||
654 | if (adapter->hw.mac_type < e1000_ich8lan) | ||
655 | /* FIXME: this code is duplicate and wrong for PCI Express */ | ||
567 | if (adapter->en_mng_pt) { | 656 | if (adapter->en_mng_pt) { |
568 | manc = E1000_READ_REG(&adapter->hw, MANC); | 657 | manc = E1000_READ_REG(&adapter->hw, MANC); |
569 | manc |= (E1000_MANC_ARP_EN | E1000_MANC_EN_MNG2HOST); | 658 | manc |= (E1000_MANC_ARP_EN | E1000_MANC_EN_MNG2HOST); |
@@ -590,6 +679,7 @@ e1000_probe(struct pci_dev *pdev, | |||
590 | struct net_device *netdev; | 679 | struct net_device *netdev; |
591 | struct e1000_adapter *adapter; | 680 | struct e1000_adapter *adapter; |
592 | unsigned long mmio_start, mmio_len; | 681 | unsigned long mmio_start, mmio_len; |
682 | unsigned long flash_start, flash_len; | ||
593 | 683 | ||
594 | static int cards_found = 0; | 684 | static int cards_found = 0; |
595 | static int e1000_ksp3_port_a = 0; /* global ksp3 port a indication */ | 685 | static int e1000_ksp3_port_a = 0; /* global ksp3 port a indication */ |
@@ -599,10 +689,12 @@ e1000_probe(struct pci_dev *pdev, | |||
599 | if ((err = pci_enable_device(pdev))) | 689 | if ((err = pci_enable_device(pdev))) |
600 | return err; | 690 | return err; |
601 | 691 | ||
602 | if (!(err = pci_set_dma_mask(pdev, DMA_64BIT_MASK))) { | 692 | if (!(err = pci_set_dma_mask(pdev, DMA_64BIT_MASK)) && |
693 | !(err = pci_set_consistent_dma_mask(pdev, DMA_64BIT_MASK))) { | ||
603 | pci_using_dac = 1; | 694 | pci_using_dac = 1; |
604 | } else { | 695 | } else { |
605 | if ((err = pci_set_dma_mask(pdev, DMA_32BIT_MASK))) { | 696 | if ((err = pci_set_dma_mask(pdev, DMA_32BIT_MASK)) && |
697 | (err = pci_set_consistent_dma_mask(pdev, DMA_32BIT_MASK))) { | ||
606 | E1000_ERR("No usable DMA configuration, aborting\n"); | 698 | E1000_ERR("No usable DMA configuration, aborting\n"); |
607 | return err; | 699 | return err; |
608 | } | 700 | } |
@@ -682,6 +774,19 @@ e1000_probe(struct pci_dev *pdev, | |||
682 | if ((err = e1000_sw_init(adapter))) | 774 | if ((err = e1000_sw_init(adapter))) |
683 | goto err_sw_init; | 775 | goto err_sw_init; |
684 | 776 | ||
777 | /* Flash BAR mapping must happen after e1000_sw_init | ||
778 | * because it depends on mac_type */ | ||
779 | if ((adapter->hw.mac_type == e1000_ich8lan) && | ||
780 | (pci_resource_flags(pdev, 1) & IORESOURCE_MEM)) { | ||
781 | flash_start = pci_resource_start(pdev, 1); | ||
782 | flash_len = pci_resource_len(pdev, 1); | ||
783 | adapter->hw.flash_address = ioremap(flash_start, flash_len); | ||
784 | if (!adapter->hw.flash_address) { | ||
785 | err = -EIO; | ||
786 | goto err_flashmap; | ||
787 | } | ||
788 | } | ||
789 | |||
685 | if ((err = e1000_check_phy_reset_block(&adapter->hw))) | 790 | if ((err = e1000_check_phy_reset_block(&adapter->hw))) |
686 | DPRINTK(PROBE, INFO, "PHY reset is blocked due to SOL/IDER session.\n"); | 791 | DPRINTK(PROBE, INFO, "PHY reset is blocked due to SOL/IDER session.\n"); |
687 | 792 | ||
@@ -700,6 +805,8 @@ e1000_probe(struct pci_dev *pdev, | |||
700 | NETIF_F_HW_VLAN_TX | | 805 | NETIF_F_HW_VLAN_TX | |
701 | NETIF_F_HW_VLAN_RX | | 806 | NETIF_F_HW_VLAN_RX | |
702 | NETIF_F_HW_VLAN_FILTER; | 807 | NETIF_F_HW_VLAN_FILTER; |
808 | if (adapter->hw.mac_type == e1000_ich8lan) | ||
809 | netdev->features &= ~NETIF_F_HW_VLAN_FILTER; | ||
703 | } | 810 | } |
704 | 811 | ||
705 | #ifdef NETIF_F_TSO | 812 | #ifdef NETIF_F_TSO |
@@ -715,11 +822,17 @@ e1000_probe(struct pci_dev *pdev, | |||
715 | if (pci_using_dac) | 822 | if (pci_using_dac) |
716 | netdev->features |= NETIF_F_HIGHDMA; | 823 | netdev->features |= NETIF_F_HIGHDMA; |
717 | 824 | ||
718 | /* hard_start_xmit is safe against parallel locking */ | ||
719 | netdev->features |= NETIF_F_LLTX; | 825 | netdev->features |= NETIF_F_LLTX; |
720 | 826 | ||
721 | adapter->en_mng_pt = e1000_enable_mng_pass_thru(&adapter->hw); | 827 | adapter->en_mng_pt = e1000_enable_mng_pass_thru(&adapter->hw); |
722 | 828 | ||
829 | /* initialize eeprom parameters */ | ||
830 | |||
831 | if (e1000_init_eeprom_params(&adapter->hw)) { | ||
832 | E1000_ERR("EEPROM initialization failed\n"); | ||
833 | return -EIO; | ||
834 | } | ||
835 | |||
723 | /* before reading the EEPROM, reset the controller to | 836 | /* before reading the EEPROM, reset the controller to |
724 | * put the device in a known good starting state */ | 837 | * put the device in a known good starting state */ |
725 | 838 | ||
@@ -758,9 +871,6 @@ e1000_probe(struct pci_dev *pdev, | |||
758 | adapter->watchdog_timer.function = &e1000_watchdog; | 871 | adapter->watchdog_timer.function = &e1000_watchdog; |
759 | adapter->watchdog_timer.data = (unsigned long) adapter; | 872 | adapter->watchdog_timer.data = (unsigned long) adapter; |
760 | 873 | ||
761 | INIT_WORK(&adapter->watchdog_task, | ||
762 | (void (*)(void *))e1000_watchdog_task, adapter); | ||
763 | |||
764 | init_timer(&adapter->phy_info_timer); | 874 | init_timer(&adapter->phy_info_timer); |
765 | adapter->phy_info_timer.function = &e1000_update_phy_info; | 875 | adapter->phy_info_timer.function = &e1000_update_phy_info; |
766 | adapter->phy_info_timer.data = (unsigned long) adapter; | 876 | adapter->phy_info_timer.data = (unsigned long) adapter; |
@@ -790,6 +900,11 @@ e1000_probe(struct pci_dev *pdev, | |||
790 | EEPROM_INIT_CONTROL2_REG, 1, &eeprom_data); | 900 | EEPROM_INIT_CONTROL2_REG, 1, &eeprom_data); |
791 | eeprom_apme_mask = E1000_EEPROM_82544_APM; | 901 | eeprom_apme_mask = E1000_EEPROM_82544_APM; |
792 | break; | 902 | break; |
903 | case e1000_ich8lan: | ||
904 | e1000_read_eeprom(&adapter->hw, | ||
905 | EEPROM_INIT_CONTROL1_REG, 1, &eeprom_data); | ||
906 | eeprom_apme_mask = E1000_EEPROM_ICH8_APME; | ||
907 | break; | ||
793 | case e1000_82546: | 908 | case e1000_82546: |
794 | case e1000_82546_rev_3: | 909 | case e1000_82546_rev_3: |
795 | case e1000_82571: | 910 | case e1000_82571: |
@@ -849,6 +964,9 @@ e1000_probe(struct pci_dev *pdev, | |||
849 | return 0; | 964 | return 0; |
850 | 965 | ||
851 | err_register: | 966 | err_register: |
967 | if (adapter->hw.flash_address) | ||
968 | iounmap(adapter->hw.flash_address); | ||
969 | err_flashmap: | ||
852 | err_sw_init: | 970 | err_sw_init: |
853 | err_eeprom: | 971 | err_eeprom: |
854 | iounmap(adapter->hw.hw_addr); | 972 | iounmap(adapter->hw.hw_addr); |
@@ -882,6 +1000,7 @@ e1000_remove(struct pci_dev *pdev) | |||
882 | flush_scheduled_work(); | 1000 | flush_scheduled_work(); |
883 | 1001 | ||
884 | if (adapter->hw.mac_type >= e1000_82540 && | 1002 | if (adapter->hw.mac_type >= e1000_82540 && |
1003 | adapter->hw.mac_type != e1000_ich8lan && | ||
885 | adapter->hw.media_type == e1000_media_type_copper) { | 1004 | adapter->hw.media_type == e1000_media_type_copper) { |
886 | manc = E1000_READ_REG(&adapter->hw, MANC); | 1005 | manc = E1000_READ_REG(&adapter->hw, MANC); |
887 | if (manc & E1000_MANC_SMBUS_EN) { | 1006 | if (manc & E1000_MANC_SMBUS_EN) { |
@@ -910,6 +1029,8 @@ e1000_remove(struct pci_dev *pdev) | |||
910 | #endif | 1029 | #endif |
911 | 1030 | ||
912 | iounmap(adapter->hw.hw_addr); | 1031 | iounmap(adapter->hw.hw_addr); |
1032 | if (adapter->hw.flash_address) | ||
1033 | iounmap(adapter->hw.flash_address); | ||
913 | pci_release_regions(pdev); | 1034 | pci_release_regions(pdev); |
914 | 1035 | ||
915 | free_netdev(netdev); | 1036 | free_netdev(netdev); |
@@ -960,13 +1081,6 @@ e1000_sw_init(struct e1000_adapter *adapter) | |||
960 | return -EIO; | 1081 | return -EIO; |
961 | } | 1082 | } |
962 | 1083 | ||
963 | /* initialize eeprom parameters */ | ||
964 | |||
965 | if (e1000_init_eeprom_params(hw)) { | ||
966 | E1000_ERR("EEPROM initialization failed\n"); | ||
967 | return -EIO; | ||
968 | } | ||
969 | |||
970 | switch (hw->mac_type) { | 1084 | switch (hw->mac_type) { |
971 | default: | 1085 | default: |
972 | break; | 1086 | break; |
@@ -1078,6 +1192,10 @@ e1000_open(struct net_device *netdev) | |||
1078 | struct e1000_adapter *adapter = netdev_priv(netdev); | 1192 | struct e1000_adapter *adapter = netdev_priv(netdev); |
1079 | int err; | 1193 | int err; |
1080 | 1194 | ||
1195 | /* disallow open during test */ | ||
1196 | if (test_bit(__E1000_DRIVER_TESTING, &adapter->flags)) | ||
1197 | return -EBUSY; | ||
1198 | |||
1081 | /* allocate transmit descriptors */ | 1199 | /* allocate transmit descriptors */ |
1082 | 1200 | ||
1083 | if ((err = e1000_setup_all_tx_resources(adapter))) | 1201 | if ((err = e1000_setup_all_tx_resources(adapter))) |
@@ -1088,6 +1206,12 @@ e1000_open(struct net_device *netdev) | |||
1088 | if ((err = e1000_setup_all_rx_resources(adapter))) | 1206 | if ((err = e1000_setup_all_rx_resources(adapter))) |
1089 | goto err_setup_rx; | 1207 | goto err_setup_rx; |
1090 | 1208 | ||
1209 | err = e1000_request_irq(adapter); | ||
1210 | if (err) | ||
1211 | goto err_up; | ||
1212 | |||
1213 | e1000_power_up_phy(adapter); | ||
1214 | |||
1091 | if ((err = e1000_up(adapter))) | 1215 | if ((err = e1000_up(adapter))) |
1092 | goto err_up; | 1216 | goto err_up; |
1093 | adapter->mng_vlan_id = E1000_MNG_VLAN_NONE; | 1217 | adapter->mng_vlan_id = E1000_MNG_VLAN_NONE; |
@@ -1131,7 +1255,10 @@ e1000_close(struct net_device *netdev) | |||
1131 | { | 1255 | { |
1132 | struct e1000_adapter *adapter = netdev_priv(netdev); | 1256 | struct e1000_adapter *adapter = netdev_priv(netdev); |
1133 | 1257 | ||
1258 | WARN_ON(test_bit(__E1000_RESETTING, &adapter->flags)); | ||
1134 | e1000_down(adapter); | 1259 | e1000_down(adapter); |
1260 | e1000_power_down_phy(adapter); | ||
1261 | e1000_free_irq(adapter); | ||
1135 | 1262 | ||
1136 | e1000_free_all_tx_resources(adapter); | 1263 | e1000_free_all_tx_resources(adapter); |
1137 | e1000_free_all_rx_resources(adapter); | 1264 | e1000_free_all_rx_resources(adapter); |
@@ -1189,8 +1316,7 @@ e1000_setup_tx_resources(struct e1000_adapter *adapter, | |||
1189 | int size; | 1316 | int size; |
1190 | 1317 | ||
1191 | size = sizeof(struct e1000_buffer) * txdr->count; | 1318 | size = sizeof(struct e1000_buffer) * txdr->count; |
1192 | 1319 | txdr->buffer_info = vmalloc(size); | |
1193 | txdr->buffer_info = vmalloc_node(size, pcibus_to_node(pdev->bus)); | ||
1194 | if (!txdr->buffer_info) { | 1320 | if (!txdr->buffer_info) { |
1195 | DPRINTK(PROBE, ERR, | 1321 | DPRINTK(PROBE, ERR, |
1196 | "Unable to allocate memory for the transmit descriptor ring\n"); | 1322 | "Unable to allocate memory for the transmit descriptor ring\n"); |
@@ -1302,11 +1428,11 @@ e1000_configure_tx(struct e1000_adapter *adapter) | |||
1302 | tdba = adapter->tx_ring[0].dma; | 1428 | tdba = adapter->tx_ring[0].dma; |
1303 | tdlen = adapter->tx_ring[0].count * | 1429 | tdlen = adapter->tx_ring[0].count * |
1304 | sizeof(struct e1000_tx_desc); | 1430 | sizeof(struct e1000_tx_desc); |
1305 | E1000_WRITE_REG(hw, TDBAL, (tdba & 0x00000000ffffffffULL)); | ||
1306 | E1000_WRITE_REG(hw, TDBAH, (tdba >> 32)); | ||
1307 | E1000_WRITE_REG(hw, TDLEN, tdlen); | 1431 | E1000_WRITE_REG(hw, TDLEN, tdlen); |
1308 | E1000_WRITE_REG(hw, TDH, 0); | 1432 | E1000_WRITE_REG(hw, TDBAH, (tdba >> 32)); |
1433 | E1000_WRITE_REG(hw, TDBAL, (tdba & 0x00000000ffffffffULL)); | ||
1309 | E1000_WRITE_REG(hw, TDT, 0); | 1434 | E1000_WRITE_REG(hw, TDT, 0); |
1435 | E1000_WRITE_REG(hw, TDH, 0); | ||
1310 | adapter->tx_ring[0].tdh = E1000_TDH; | 1436 | adapter->tx_ring[0].tdh = E1000_TDH; |
1311 | adapter->tx_ring[0].tdt = E1000_TDT; | 1437 | adapter->tx_ring[0].tdt = E1000_TDT; |
1312 | break; | 1438 | break; |
@@ -1418,7 +1544,7 @@ e1000_setup_rx_resources(struct e1000_adapter *adapter, | |||
1418 | int size, desc_len; | 1544 | int size, desc_len; |
1419 | 1545 | ||
1420 | size = sizeof(struct e1000_buffer) * rxdr->count; | 1546 | size = sizeof(struct e1000_buffer) * rxdr->count; |
1421 | rxdr->buffer_info = vmalloc_node(size, pcibus_to_node(pdev->bus)); | 1547 | rxdr->buffer_info = vmalloc(size); |
1422 | if (!rxdr->buffer_info) { | 1548 | if (!rxdr->buffer_info) { |
1423 | DPRINTK(PROBE, ERR, | 1549 | DPRINTK(PROBE, ERR, |
1424 | "Unable to allocate memory for the receive descriptor ring\n"); | 1550 | "Unable to allocate memory for the receive descriptor ring\n"); |
@@ -1560,9 +1686,6 @@ e1000_setup_rctl(struct e1000_adapter *adapter) | |||
1560 | E1000_RCTL_LBM_NO | E1000_RCTL_RDMTS_HALF | | 1686 | E1000_RCTL_LBM_NO | E1000_RCTL_RDMTS_HALF | |
1561 | (adapter->hw.mc_filter_type << E1000_RCTL_MO_SHIFT); | 1687 | (adapter->hw.mc_filter_type << E1000_RCTL_MO_SHIFT); |
1562 | 1688 | ||
1563 | if (adapter->hw.mac_type > e1000_82543) | ||
1564 | rctl |= E1000_RCTL_SECRC; | ||
1565 | |||
1566 | if (adapter->hw.tbi_compatibility_on == 1) | 1689 | if (adapter->hw.tbi_compatibility_on == 1) |
1567 | rctl |= E1000_RCTL_SBP; | 1690 | rctl |= E1000_RCTL_SBP; |
1568 | else | 1691 | else |
@@ -1628,7 +1751,7 @@ e1000_setup_rctl(struct e1000_adapter *adapter) | |||
1628 | rfctl |= E1000_RFCTL_IPV6_DIS; | 1751 | rfctl |= E1000_RFCTL_IPV6_DIS; |
1629 | E1000_WRITE_REG(&adapter->hw, RFCTL, rfctl); | 1752 | E1000_WRITE_REG(&adapter->hw, RFCTL, rfctl); |
1630 | 1753 | ||
1631 | rctl |= E1000_RCTL_DTYP_PS | E1000_RCTL_SECRC; | 1754 | rctl |= E1000_RCTL_DTYP_PS; |
1632 | 1755 | ||
1633 | psrctl |= adapter->rx_ps_bsize0 >> | 1756 | psrctl |= adapter->rx_ps_bsize0 >> |
1634 | E1000_PSRCTL_BSIZE0_SHIFT; | 1757 | E1000_PSRCTL_BSIZE0_SHIFT; |
@@ -1712,11 +1835,11 @@ e1000_configure_rx(struct e1000_adapter *adapter) | |||
1712 | case 1: | 1835 | case 1: |
1713 | default: | 1836 | default: |
1714 | rdba = adapter->rx_ring[0].dma; | 1837 | rdba = adapter->rx_ring[0].dma; |
1715 | E1000_WRITE_REG(hw, RDBAL, (rdba & 0x00000000ffffffffULL)); | ||
1716 | E1000_WRITE_REG(hw, RDBAH, (rdba >> 32)); | ||
1717 | E1000_WRITE_REG(hw, RDLEN, rdlen); | 1838 | E1000_WRITE_REG(hw, RDLEN, rdlen); |
1718 | E1000_WRITE_REG(hw, RDH, 0); | 1839 | E1000_WRITE_REG(hw, RDBAH, (rdba >> 32)); |
1840 | E1000_WRITE_REG(hw, RDBAL, (rdba & 0x00000000ffffffffULL)); | ||
1719 | E1000_WRITE_REG(hw, RDT, 0); | 1841 | E1000_WRITE_REG(hw, RDT, 0); |
1842 | E1000_WRITE_REG(hw, RDH, 0); | ||
1720 | adapter->rx_ring[0].rdh = E1000_RDH; | 1843 | adapter->rx_ring[0].rdh = E1000_RDH; |
1721 | adapter->rx_ring[0].rdt = E1000_RDT; | 1844 | adapter->rx_ring[0].rdt = E1000_RDT; |
1722 | break; | 1845 | break; |
@@ -1741,9 +1864,6 @@ e1000_configure_rx(struct e1000_adapter *adapter) | |||
1741 | E1000_WRITE_REG(hw, RXCSUM, rxcsum); | 1864 | E1000_WRITE_REG(hw, RXCSUM, rxcsum); |
1742 | } | 1865 | } |
1743 | 1866 | ||
1744 | if (hw->mac_type == e1000_82573) | ||
1745 | E1000_WRITE_REG(hw, ERT, 0x0100); | ||
1746 | |||
1747 | /* Enable Receives */ | 1867 | /* Enable Receives */ |
1748 | E1000_WRITE_REG(hw, RCTL, rctl); | 1868 | E1000_WRITE_REG(hw, RCTL, rctl); |
1749 | } | 1869 | } |
@@ -2083,6 +2203,12 @@ e1000_set_multi(struct net_device *netdev) | |||
2083 | uint32_t rctl; | 2203 | uint32_t rctl; |
2084 | uint32_t hash_value; | 2204 | uint32_t hash_value; |
2085 | int i, rar_entries = E1000_RAR_ENTRIES; | 2205 | int i, rar_entries = E1000_RAR_ENTRIES; |
2206 | int mta_reg_count = (hw->mac_type == e1000_ich8lan) ? | ||
2207 | E1000_NUM_MTA_REGISTERS_ICH8LAN : | ||
2208 | E1000_NUM_MTA_REGISTERS; | ||
2209 | |||
2210 | if (adapter->hw.mac_type == e1000_ich8lan) | ||
2211 | rar_entries = E1000_RAR_ENTRIES_ICH8LAN; | ||
2086 | 2212 | ||
2087 | /* reserve RAR[14] for LAA over-write work-around */ | 2213 | /* reserve RAR[14] for LAA over-write work-around */ |
2088 | if (adapter->hw.mac_type == e1000_82571) | 2214 | if (adapter->hw.mac_type == e1000_82571) |
@@ -2121,14 +2247,18 @@ e1000_set_multi(struct net_device *netdev) | |||
2121 | mc_ptr = mc_ptr->next; | 2247 | mc_ptr = mc_ptr->next; |
2122 | } else { | 2248 | } else { |
2123 | E1000_WRITE_REG_ARRAY(hw, RA, i << 1, 0); | 2249 | E1000_WRITE_REG_ARRAY(hw, RA, i << 1, 0); |
2250 | E1000_WRITE_FLUSH(hw); | ||
2124 | E1000_WRITE_REG_ARRAY(hw, RA, (i << 1) + 1, 0); | 2251 | E1000_WRITE_REG_ARRAY(hw, RA, (i << 1) + 1, 0); |
2252 | E1000_WRITE_FLUSH(hw); | ||
2125 | } | 2253 | } |
2126 | } | 2254 | } |
2127 | 2255 | ||
2128 | /* clear the old settings from the multicast hash table */ | 2256 | /* clear the old settings from the multicast hash table */ |
2129 | 2257 | ||
2130 | for (i = 0; i < E1000_NUM_MTA_REGISTERS; i++) | 2258 | for (i = 0; i < mta_reg_count; i++) { |
2131 | E1000_WRITE_REG_ARRAY(hw, MTA, i, 0); | 2259 | E1000_WRITE_REG_ARRAY(hw, MTA, i, 0); |
2260 | E1000_WRITE_FLUSH(hw); | ||
2261 | } | ||
2132 | 2262 | ||
2133 | /* load any remaining addresses into the hash table */ | 2263 | /* load any remaining addresses into the hash table */ |
2134 | 2264 | ||
@@ -2201,19 +2331,19 @@ static void | |||
2201 | e1000_watchdog(unsigned long data) | 2331 | e1000_watchdog(unsigned long data) |
2202 | { | 2332 | { |
2203 | struct e1000_adapter *adapter = (struct e1000_adapter *) data; | 2333 | struct e1000_adapter *adapter = (struct e1000_adapter *) data; |
2204 | |||
2205 | /* Do the rest outside of interrupt context */ | ||
2206 | schedule_work(&adapter->watchdog_task); | ||
2207 | } | ||
2208 | |||
2209 | static void | ||
2210 | e1000_watchdog_task(struct e1000_adapter *adapter) | ||
2211 | { | ||
2212 | struct net_device *netdev = adapter->netdev; | 2334 | struct net_device *netdev = adapter->netdev; |
2213 | struct e1000_tx_ring *txdr = adapter->tx_ring; | 2335 | struct e1000_tx_ring *txdr = adapter->tx_ring; |
2214 | uint32_t link, tctl; | 2336 | uint32_t link, tctl; |
2215 | 2337 | int32_t ret_val; | |
2216 | e1000_check_for_link(&adapter->hw); | 2338 | |
2339 | ret_val = e1000_check_for_link(&adapter->hw); | ||
2340 | if ((ret_val == E1000_ERR_PHY) && | ||
2341 | (adapter->hw.phy_type == e1000_phy_igp_3) && | ||
2342 | (E1000_READ_REG(&adapter->hw, CTRL) & E1000_PHY_CTRL_GBE_DISABLE)) { | ||
2343 | /* See e1000_kumeran_lock_loss_workaround() */ | ||
2344 | DPRINTK(LINK, INFO, | ||
2345 | "Gigabit has been disabled, downgrading speed\n"); | ||
2346 | } | ||
2217 | if (adapter->hw.mac_type == e1000_82573) { | 2347 | if (adapter->hw.mac_type == e1000_82573) { |
2218 | e1000_enable_tx_pkt_filtering(&adapter->hw); | 2348 | e1000_enable_tx_pkt_filtering(&adapter->hw); |
2219 | if (adapter->mng_vlan_id != adapter->hw.mng_cookie.vlan_id) | 2349 | if (adapter->mng_vlan_id != adapter->hw.mng_cookie.vlan_id) |
@@ -2394,7 +2524,7 @@ e1000_tso(struct e1000_adapter *adapter, struct e1000_tx_ring *tx_ring, | |||
2394 | uint8_t ipcss, ipcso, tucss, tucso, hdr_len; | 2524 | uint8_t ipcss, ipcso, tucss, tucso, hdr_len; |
2395 | int err; | 2525 | int err; |
2396 | 2526 | ||
2397 | if (skb_shinfo(skb)->gso_size) { | 2527 | if (skb_is_gso(skb)) { |
2398 | if (skb_header_cloned(skb)) { | 2528 | if (skb_header_cloned(skb)) { |
2399 | err = pskb_expand_head(skb, 0, 0, GFP_ATOMIC); | 2529 | err = pskb_expand_head(skb, 0, 0, GFP_ATOMIC); |
2400 | if (err) | 2530 | if (err) |
@@ -2519,7 +2649,7 @@ e1000_tx_map(struct e1000_adapter *adapter, struct e1000_tx_ring *tx_ring, | |||
2519 | * tso gets written back prematurely before the data is fully | 2649 | * tso gets written back prematurely before the data is fully |
2520 | * DMA'd to the controller */ | 2650 | * DMA'd to the controller */ |
2521 | if (!skb->data_len && tx_ring->last_tx_tso && | 2651 | if (!skb->data_len && tx_ring->last_tx_tso && |
2522 | !skb_shinfo(skb)->gso_size) { | 2652 | !skb_is_gso(skb)) { |
2523 | tx_ring->last_tx_tso = 0; | 2653 | tx_ring->last_tx_tso = 0; |
2524 | size -= 4; | 2654 | size -= 4; |
2525 | } | 2655 | } |
@@ -2779,9 +2909,10 @@ e1000_xmit_frame(struct sk_buff *skb, struct net_device *netdev) | |||
2779 | case e1000_82571: | 2909 | case e1000_82571: |
2780 | case e1000_82572: | 2910 | case e1000_82572: |
2781 | case e1000_82573: | 2911 | case e1000_82573: |
2912 | case e1000_ich8lan: | ||
2782 | pull_size = min((unsigned int)4, skb->data_len); | 2913 | pull_size = min((unsigned int)4, skb->data_len); |
2783 | if (!__pskb_pull_tail(skb, pull_size)) { | 2914 | if (!__pskb_pull_tail(skb, pull_size)) { |
2784 | printk(KERN_ERR | 2915 | DPRINTK(DRV, ERR, |
2785 | "__pskb_pull_tail failed.\n"); | 2916 | "__pskb_pull_tail failed.\n"); |
2786 | dev_kfree_skb_any(skb); | 2917 | dev_kfree_skb_any(skb); |
2787 | return NETDEV_TX_OK; | 2918 | return NETDEV_TX_OK; |
@@ -2806,8 +2937,7 @@ e1000_xmit_frame(struct sk_buff *skb, struct net_device *netdev) | |||
2806 | 2937 | ||
2807 | #ifdef NETIF_F_TSO | 2938 | #ifdef NETIF_F_TSO |
2808 | /* Controller Erratum workaround */ | 2939 | /* Controller Erratum workaround */ |
2809 | if (!skb->data_len && tx_ring->last_tx_tso && | 2940 | if (!skb->data_len && tx_ring->last_tx_tso && !skb_is_gso(skb)) |
2810 | !skb_shinfo(skb)->gso_size) | ||
2811 | count++; | 2941 | count++; |
2812 | #endif | 2942 | #endif |
2813 | 2943 | ||
@@ -2919,8 +3049,7 @@ e1000_reset_task(struct net_device *netdev) | |||
2919 | { | 3049 | { |
2920 | struct e1000_adapter *adapter = netdev_priv(netdev); | 3050 | struct e1000_adapter *adapter = netdev_priv(netdev); |
2921 | 3051 | ||
2922 | e1000_down(adapter); | 3052 | e1000_reinit_locked(adapter); |
2923 | e1000_up(adapter); | ||
2924 | } | 3053 | } |
2925 | 3054 | ||
2926 | /** | 3055 | /** |
@@ -2964,6 +3093,7 @@ e1000_change_mtu(struct net_device *netdev, int new_mtu) | |||
2964 | /* Adapter-specific max frame size limits. */ | 3093 | /* Adapter-specific max frame size limits. */ |
2965 | switch (adapter->hw.mac_type) { | 3094 | switch (adapter->hw.mac_type) { |
2966 | case e1000_undefined ... e1000_82542_rev2_1: | 3095 | case e1000_undefined ... e1000_82542_rev2_1: |
3096 | case e1000_ich8lan: | ||
2967 | if (max_frame > MAXIMUM_ETHERNET_FRAME_SIZE) { | 3097 | if (max_frame > MAXIMUM_ETHERNET_FRAME_SIZE) { |
2968 | DPRINTK(PROBE, ERR, "Jumbo Frames not supported.\n"); | 3098 | DPRINTK(PROBE, ERR, "Jumbo Frames not supported.\n"); |
2969 | return -EINVAL; | 3099 | return -EINVAL; |
@@ -3026,10 +3156,8 @@ e1000_change_mtu(struct net_device *netdev, int new_mtu) | |||
3026 | 3156 | ||
3027 | netdev->mtu = new_mtu; | 3157 | netdev->mtu = new_mtu; |
3028 | 3158 | ||
3029 | if (netif_running(netdev)) { | 3159 | if (netif_running(netdev)) |
3030 | e1000_down(adapter); | 3160 | e1000_reinit_locked(adapter); |
3031 | e1000_up(adapter); | ||
3032 | } | ||
3033 | 3161 | ||
3034 | adapter->hw.max_frame_size = max_frame; | 3162 | adapter->hw.max_frame_size = max_frame; |
3035 | 3163 | ||
@@ -3074,12 +3202,15 @@ e1000_update_stats(struct e1000_adapter *adapter) | |||
3074 | adapter->stats.bprc += E1000_READ_REG(hw, BPRC); | 3202 | adapter->stats.bprc += E1000_READ_REG(hw, BPRC); |
3075 | adapter->stats.mprc += E1000_READ_REG(hw, MPRC); | 3203 | adapter->stats.mprc += E1000_READ_REG(hw, MPRC); |
3076 | adapter->stats.roc += E1000_READ_REG(hw, ROC); | 3204 | adapter->stats.roc += E1000_READ_REG(hw, ROC); |
3205 | |||
3206 | if (adapter->hw.mac_type != e1000_ich8lan) { | ||
3077 | adapter->stats.prc64 += E1000_READ_REG(hw, PRC64); | 3207 | adapter->stats.prc64 += E1000_READ_REG(hw, PRC64); |
3078 | adapter->stats.prc127 += E1000_READ_REG(hw, PRC127); | 3208 | adapter->stats.prc127 += E1000_READ_REG(hw, PRC127); |
3079 | adapter->stats.prc255 += E1000_READ_REG(hw, PRC255); | 3209 | adapter->stats.prc255 += E1000_READ_REG(hw, PRC255); |
3080 | adapter->stats.prc511 += E1000_READ_REG(hw, PRC511); | 3210 | adapter->stats.prc511 += E1000_READ_REG(hw, PRC511); |
3081 | adapter->stats.prc1023 += E1000_READ_REG(hw, PRC1023); | 3211 | adapter->stats.prc1023 += E1000_READ_REG(hw, PRC1023); |
3082 | adapter->stats.prc1522 += E1000_READ_REG(hw, PRC1522); | 3212 | adapter->stats.prc1522 += E1000_READ_REG(hw, PRC1522); |
3213 | } | ||
3083 | 3214 | ||
3084 | adapter->stats.symerrs += E1000_READ_REG(hw, SYMERRS); | 3215 | adapter->stats.symerrs += E1000_READ_REG(hw, SYMERRS); |
3085 | adapter->stats.mpc += E1000_READ_REG(hw, MPC); | 3216 | adapter->stats.mpc += E1000_READ_REG(hw, MPC); |
@@ -3107,12 +3238,16 @@ e1000_update_stats(struct e1000_adapter *adapter) | |||
3107 | adapter->stats.totl += E1000_READ_REG(hw, TOTL); | 3238 | adapter->stats.totl += E1000_READ_REG(hw, TOTL); |
3108 | adapter->stats.toth += E1000_READ_REG(hw, TOTH); | 3239 | adapter->stats.toth += E1000_READ_REG(hw, TOTH); |
3109 | adapter->stats.tpr += E1000_READ_REG(hw, TPR); | 3240 | adapter->stats.tpr += E1000_READ_REG(hw, TPR); |
3241 | |||
3242 | if (adapter->hw.mac_type != e1000_ich8lan) { | ||
3110 | adapter->stats.ptc64 += E1000_READ_REG(hw, PTC64); | 3243 | adapter->stats.ptc64 += E1000_READ_REG(hw, PTC64); |
3111 | adapter->stats.ptc127 += E1000_READ_REG(hw, PTC127); | 3244 | adapter->stats.ptc127 += E1000_READ_REG(hw, PTC127); |
3112 | adapter->stats.ptc255 += E1000_READ_REG(hw, PTC255); | 3245 | adapter->stats.ptc255 += E1000_READ_REG(hw, PTC255); |
3113 | adapter->stats.ptc511 += E1000_READ_REG(hw, PTC511); | 3246 | adapter->stats.ptc511 += E1000_READ_REG(hw, PTC511); |
3114 | adapter->stats.ptc1023 += E1000_READ_REG(hw, PTC1023); | 3247 | adapter->stats.ptc1023 += E1000_READ_REG(hw, PTC1023); |
3115 | adapter->stats.ptc1522 += E1000_READ_REG(hw, PTC1522); | 3248 | adapter->stats.ptc1522 += E1000_READ_REG(hw, PTC1522); |
3249 | } | ||
3250 | |||
3116 | adapter->stats.mptc += E1000_READ_REG(hw, MPTC); | 3251 | adapter->stats.mptc += E1000_READ_REG(hw, MPTC); |
3117 | adapter->stats.bptc += E1000_READ_REG(hw, BPTC); | 3252 | adapter->stats.bptc += E1000_READ_REG(hw, BPTC); |
3118 | 3253 | ||
@@ -3134,6 +3269,8 @@ e1000_update_stats(struct e1000_adapter *adapter) | |||
3134 | if (hw->mac_type > e1000_82547_rev_2) { | 3269 | if (hw->mac_type > e1000_82547_rev_2) { |
3135 | adapter->stats.iac += E1000_READ_REG(hw, IAC); | 3270 | adapter->stats.iac += E1000_READ_REG(hw, IAC); |
3136 | adapter->stats.icrxoc += E1000_READ_REG(hw, ICRXOC); | 3271 | adapter->stats.icrxoc += E1000_READ_REG(hw, ICRXOC); |
3272 | |||
3273 | if (adapter->hw.mac_type != e1000_ich8lan) { | ||
3137 | adapter->stats.icrxptc += E1000_READ_REG(hw, ICRXPTC); | 3274 | adapter->stats.icrxptc += E1000_READ_REG(hw, ICRXPTC); |
3138 | adapter->stats.icrxatc += E1000_READ_REG(hw, ICRXATC); | 3275 | adapter->stats.icrxatc += E1000_READ_REG(hw, ICRXATC); |
3139 | adapter->stats.ictxptc += E1000_READ_REG(hw, ICTXPTC); | 3276 | adapter->stats.ictxptc += E1000_READ_REG(hw, ICTXPTC); |
@@ -3141,6 +3278,7 @@ e1000_update_stats(struct e1000_adapter *adapter) | |||
3141 | adapter->stats.ictxqec += E1000_READ_REG(hw, ICTXQEC); | 3278 | adapter->stats.ictxqec += E1000_READ_REG(hw, ICTXQEC); |
3142 | adapter->stats.ictxqmtc += E1000_READ_REG(hw, ICTXQMTC); | 3279 | adapter->stats.ictxqmtc += E1000_READ_REG(hw, ICTXQMTC); |
3143 | adapter->stats.icrxdmtc += E1000_READ_REG(hw, ICRXDMTC); | 3280 | adapter->stats.icrxdmtc += E1000_READ_REG(hw, ICRXDMTC); |
3281 | } | ||
3144 | } | 3282 | } |
3145 | 3283 | ||
3146 | /* Fill out the OS statistics structure */ | 3284 | /* Fill out the OS statistics structure */ |
@@ -3547,7 +3685,8 @@ e1000_clean_rx_irq(struct e1000_adapter *adapter, | |||
3547 | /* All receives must fit into a single buffer */ | 3685 | /* All receives must fit into a single buffer */ |
3548 | E1000_DBG("%s: Receive packet consumed multiple" | 3686 | E1000_DBG("%s: Receive packet consumed multiple" |
3549 | " buffers\n", netdev->name); | 3687 | " buffers\n", netdev->name); |
3550 | dev_kfree_skb_irq(skb); | 3688 | /* recycle */ |
3689 | buffer_info-> skb = skb; | ||
3551 | goto next_desc; | 3690 | goto next_desc; |
3552 | } | 3691 | } |
3553 | 3692 | ||
@@ -3675,7 +3814,6 @@ e1000_clean_rx_irq_ps(struct e1000_adapter *adapter, | |||
3675 | buffer_info = &rx_ring->buffer_info[i]; | 3814 | buffer_info = &rx_ring->buffer_info[i]; |
3676 | 3815 | ||
3677 | while (staterr & E1000_RXD_STAT_DD) { | 3816 | while (staterr & E1000_RXD_STAT_DD) { |
3678 | buffer_info = &rx_ring->buffer_info[i]; | ||
3679 | ps_page = &rx_ring->ps_page[i]; | 3817 | ps_page = &rx_ring->ps_page[i]; |
3680 | ps_page_dma = &rx_ring->ps_page_dma[i]; | 3818 | ps_page_dma = &rx_ring->ps_page_dma[i]; |
3681 | #ifdef CONFIG_E1000_NAPI | 3819 | #ifdef CONFIG_E1000_NAPI |
@@ -4180,10 +4318,9 @@ e1000_mii_ioctl(struct net_device *netdev, struct ifreq *ifr, int cmd) | |||
4180 | return retval; | 4318 | return retval; |
4181 | } | 4319 | } |
4182 | } | 4320 | } |
4183 | if (netif_running(adapter->netdev)) { | 4321 | if (netif_running(adapter->netdev)) |
4184 | e1000_down(adapter); | 4322 | e1000_reinit_locked(adapter); |
4185 | e1000_up(adapter); | 4323 | else |
4186 | } else | ||
4187 | e1000_reset(adapter); | 4324 | e1000_reset(adapter); |
4188 | break; | 4325 | break; |
4189 | case M88E1000_PHY_SPEC_CTRL: | 4326 | case M88E1000_PHY_SPEC_CTRL: |
@@ -4200,10 +4337,9 @@ e1000_mii_ioctl(struct net_device *netdev, struct ifreq *ifr, int cmd) | |||
4200 | case PHY_CTRL: | 4337 | case PHY_CTRL: |
4201 | if (mii_reg & MII_CR_POWER_DOWN) | 4338 | if (mii_reg & MII_CR_POWER_DOWN) |
4202 | break; | 4339 | break; |
4203 | if (netif_running(adapter->netdev)) { | 4340 | if (netif_running(adapter->netdev)) |
4204 | e1000_down(adapter); | 4341 | e1000_reinit_locked(adapter); |
4205 | e1000_up(adapter); | 4342 | else |
4206 | } else | ||
4207 | e1000_reset(adapter); | 4343 | e1000_reset(adapter); |
4208 | break; | 4344 | break; |
4209 | } | 4345 | } |
@@ -4277,18 +4413,21 @@ e1000_vlan_rx_register(struct net_device *netdev, struct vlan_group *grp) | |||
4277 | ctrl |= E1000_CTRL_VME; | 4413 | ctrl |= E1000_CTRL_VME; |
4278 | E1000_WRITE_REG(&adapter->hw, CTRL, ctrl); | 4414 | E1000_WRITE_REG(&adapter->hw, CTRL, ctrl); |
4279 | 4415 | ||
4416 | if (adapter->hw.mac_type != e1000_ich8lan) { | ||
4280 | /* enable VLAN receive filtering */ | 4417 | /* enable VLAN receive filtering */ |
4281 | rctl = E1000_READ_REG(&adapter->hw, RCTL); | 4418 | rctl = E1000_READ_REG(&adapter->hw, RCTL); |
4282 | rctl |= E1000_RCTL_VFE; | 4419 | rctl |= E1000_RCTL_VFE; |
4283 | rctl &= ~E1000_RCTL_CFIEN; | 4420 | rctl &= ~E1000_RCTL_CFIEN; |
4284 | E1000_WRITE_REG(&adapter->hw, RCTL, rctl); | 4421 | E1000_WRITE_REG(&adapter->hw, RCTL, rctl); |
4285 | e1000_update_mng_vlan(adapter); | 4422 | e1000_update_mng_vlan(adapter); |
4423 | } | ||
4286 | } else { | 4424 | } else { |
4287 | /* disable VLAN tag insert/strip */ | 4425 | /* disable VLAN tag insert/strip */ |
4288 | ctrl = E1000_READ_REG(&adapter->hw, CTRL); | 4426 | ctrl = E1000_READ_REG(&adapter->hw, CTRL); |
4289 | ctrl &= ~E1000_CTRL_VME; | 4427 | ctrl &= ~E1000_CTRL_VME; |
4290 | E1000_WRITE_REG(&adapter->hw, CTRL, ctrl); | 4428 | E1000_WRITE_REG(&adapter->hw, CTRL, ctrl); |
4291 | 4429 | ||
4430 | if (adapter->hw.mac_type != e1000_ich8lan) { | ||
4292 | /* disable VLAN filtering */ | 4431 | /* disable VLAN filtering */ |
4293 | rctl = E1000_READ_REG(&adapter->hw, RCTL); | 4432 | rctl = E1000_READ_REG(&adapter->hw, RCTL); |
4294 | rctl &= ~E1000_RCTL_VFE; | 4433 | rctl &= ~E1000_RCTL_VFE; |
@@ -4297,6 +4436,7 @@ e1000_vlan_rx_register(struct net_device *netdev, struct vlan_group *grp) | |||
4297 | e1000_vlan_rx_kill_vid(netdev, adapter->mng_vlan_id); | 4436 | e1000_vlan_rx_kill_vid(netdev, adapter->mng_vlan_id); |
4298 | adapter->mng_vlan_id = E1000_MNG_VLAN_NONE; | 4437 | adapter->mng_vlan_id = E1000_MNG_VLAN_NONE; |
4299 | } | 4438 | } |
4439 | } | ||
4300 | } | 4440 | } |
4301 | 4441 | ||
4302 | e1000_irq_enable(adapter); | 4442 | e1000_irq_enable(adapter); |
@@ -4458,12 +4598,16 @@ e1000_suspend(struct pci_dev *pdev, pm_message_t state) | |||
4458 | struct e1000_adapter *adapter = netdev_priv(netdev); | 4598 | struct e1000_adapter *adapter = netdev_priv(netdev); |
4459 | uint32_t ctrl, ctrl_ext, rctl, manc, status; | 4599 | uint32_t ctrl, ctrl_ext, rctl, manc, status; |
4460 | uint32_t wufc = adapter->wol; | 4600 | uint32_t wufc = adapter->wol; |
4601 | #ifdef CONFIG_PM | ||
4461 | int retval = 0; | 4602 | int retval = 0; |
4603 | #endif | ||
4462 | 4604 | ||
4463 | netif_device_detach(netdev); | 4605 | netif_device_detach(netdev); |
4464 | 4606 | ||
4465 | if (netif_running(netdev)) | 4607 | if (netif_running(netdev)) { |
4608 | WARN_ON(test_bit(__E1000_RESETTING, &adapter->flags)); | ||
4466 | e1000_down(adapter); | 4609 | e1000_down(adapter); |
4610 | } | ||
4467 | 4611 | ||
4468 | #ifdef CONFIG_PM | 4612 | #ifdef CONFIG_PM |
4469 | /* Implement our own version of pci_save_state(pdev) because pci- | 4613 | /* Implement our own version of pci_save_state(pdev) because pci- |
@@ -4521,7 +4665,9 @@ e1000_suspend(struct pci_dev *pdev, pm_message_t state) | |||
4521 | pci_enable_wake(pdev, PCI_D3cold, 0); | 4665 | pci_enable_wake(pdev, PCI_D3cold, 0); |
4522 | } | 4666 | } |
4523 | 4667 | ||
4668 | /* FIXME: this code is incorrect for PCI Express */ | ||
4524 | if (adapter->hw.mac_type >= e1000_82540 && | 4669 | if (adapter->hw.mac_type >= e1000_82540 && |
4670 | adapter->hw.mac_type != e1000_ich8lan && | ||
4525 | adapter->hw.media_type == e1000_media_type_copper) { | 4671 | adapter->hw.media_type == e1000_media_type_copper) { |
4526 | manc = E1000_READ_REG(&adapter->hw, MANC); | 4672 | manc = E1000_READ_REG(&adapter->hw, MANC); |
4527 | if (manc & E1000_MANC_SMBUS_EN) { | 4673 | if (manc & E1000_MANC_SMBUS_EN) { |
@@ -4532,6 +4678,9 @@ e1000_suspend(struct pci_dev *pdev, pm_message_t state) | |||
4532 | } | 4678 | } |
4533 | } | 4679 | } |
4534 | 4680 | ||
4681 | if (adapter->hw.phy_type == e1000_phy_igp_3) | ||
4682 | e1000_phy_powerdown_workaround(&adapter->hw); | ||
4683 | |||
4535 | /* Release control of h/w to f/w. If f/w is AMT enabled, this | 4684 | /* Release control of h/w to f/w. If f/w is AMT enabled, this |
4536 | * would have already happened in close and is redundant. */ | 4685 | * would have already happened in close and is redundant. */ |
4537 | e1000_release_hw_control(adapter); | 4686 | e1000_release_hw_control(adapter); |
@@ -4567,7 +4716,9 @@ e1000_resume(struct pci_dev *pdev) | |||
4567 | 4716 | ||
4568 | netif_device_attach(netdev); | 4717 | netif_device_attach(netdev); |
4569 | 4718 | ||
4719 | /* FIXME: this code is incorrect for PCI Express */ | ||
4570 | if (adapter->hw.mac_type >= e1000_82540 && | 4720 | if (adapter->hw.mac_type >= e1000_82540 && |
4721 | adapter->hw.mac_type != e1000_ich8lan && | ||
4571 | adapter->hw.media_type == e1000_media_type_copper) { | 4722 | adapter->hw.media_type == e1000_media_type_copper) { |
4572 | manc = E1000_READ_REG(&adapter->hw, MANC); | 4723 | manc = E1000_READ_REG(&adapter->hw, MANC); |
4573 | manc &= ~(E1000_MANC_ARP_EN); | 4724 | manc &= ~(E1000_MANC_ARP_EN); |
diff --git a/drivers/net/e1000/e1000_osdep.h b/drivers/net/e1000/e1000_osdep.h index 048d052be29d..2d3e8b06cab0 100644 --- a/drivers/net/e1000/e1000_osdep.h +++ b/drivers/net/e1000/e1000_osdep.h | |||
@@ -127,4 +127,17 @@ typedef enum { | |||
127 | 127 | ||
128 | #define E1000_WRITE_FLUSH(a) E1000_READ_REG(a, STATUS) | 128 | #define E1000_WRITE_FLUSH(a) E1000_READ_REG(a, STATUS) |
129 | 129 | ||
130 | #define E1000_WRITE_ICH8_REG(a, reg, value) ( \ | ||
131 | writel((value), ((a)->flash_address + reg))) | ||
132 | |||
133 | #define E1000_READ_ICH8_REG(a, reg) ( \ | ||
134 | readl((a)->flash_address + reg)) | ||
135 | |||
136 | #define E1000_WRITE_ICH8_REG16(a, reg, value) ( \ | ||
137 | writew((value), ((a)->flash_address + reg))) | ||
138 | |||
139 | #define E1000_READ_ICH8_REG16(a, reg) ( \ | ||
140 | readw((a)->flash_address + reg)) | ||
141 | |||
142 | |||
130 | #endif /* _E1000_OSDEP_H_ */ | 143 | #endif /* _E1000_OSDEP_H_ */ |
diff --git a/drivers/net/e1000/e1000_param.c b/drivers/net/e1000/e1000_param.c index e55f8969a0fb..0ef413172c68 100644 --- a/drivers/net/e1000/e1000_param.c +++ b/drivers/net/e1000/e1000_param.c | |||
@@ -45,6 +45,16 @@ | |||
45 | */ | 45 | */ |
46 | 46 | ||
47 | #define E1000_PARAM_INIT { [0 ... E1000_MAX_NIC] = OPTION_UNSET } | 47 | #define E1000_PARAM_INIT { [0 ... E1000_MAX_NIC] = OPTION_UNSET } |
48 | /* Module Parameters are always initialized to -1, so that the driver | ||
49 | * can tell the difference between no user specified value or the | ||
50 | * user asking for the default value. | ||
51 | * The true default values are loaded in when e1000_check_options is called. | ||
52 | * | ||
53 | * This is a GCC extension to ANSI C. | ||
54 | * See the item "Labeled Elements in Initializers" in the section | ||
55 | * "Extensions to the C Language Family" of the GCC documentation. | ||
56 | */ | ||
57 | |||
48 | #define E1000_PARAM(X, desc) \ | 58 | #define E1000_PARAM(X, desc) \ |
49 | static int __devinitdata X[E1000_MAX_NIC+1] = E1000_PARAM_INIT; \ | 59 | static int __devinitdata X[E1000_MAX_NIC+1] = E1000_PARAM_INIT; \ |
50 | static int num_##X = 0; \ | 60 | static int num_##X = 0; \ |
@@ -183,6 +193,24 @@ E1000_PARAM(RxAbsIntDelay, "Receive Absolute Interrupt Delay"); | |||
183 | 193 | ||
184 | E1000_PARAM(InterruptThrottleRate, "Interrupt Throttling Rate"); | 194 | E1000_PARAM(InterruptThrottleRate, "Interrupt Throttling Rate"); |
185 | 195 | ||
196 | /* Enable Smart Power Down of the PHY | ||
197 | * | ||
198 | * Valid Range: 0, 1 | ||
199 | * | ||
200 | * Default Value: 0 (disabled) | ||
201 | */ | ||
202 | |||
203 | E1000_PARAM(SmartPowerDownEnable, "Enable PHY smart power down"); | ||
204 | |||
205 | /* Enable Kumeran Lock Loss workaround | ||
206 | * | ||
207 | * Valid Range: 0, 1 | ||
208 | * | ||
209 | * Default Value: 1 (enabled) | ||
210 | */ | ||
211 | |||
212 | E1000_PARAM(KumeranLockLoss, "Enable Kumeran lock loss workaround"); | ||
213 | |||
186 | #define AUTONEG_ADV_DEFAULT 0x2F | 214 | #define AUTONEG_ADV_DEFAULT 0x2F |
187 | #define AUTONEG_ADV_MASK 0x2F | 215 | #define AUTONEG_ADV_MASK 0x2F |
188 | #define FLOW_CONTROL_DEFAULT FLOW_CONTROL_FULL | 216 | #define FLOW_CONTROL_DEFAULT FLOW_CONTROL_FULL |
@@ -296,6 +324,7 @@ e1000_check_options(struct e1000_adapter *adapter) | |||
296 | DPRINTK(PROBE, NOTICE, | 324 | DPRINTK(PROBE, NOTICE, |
297 | "Warning: no configuration for board #%i\n", bd); | 325 | "Warning: no configuration for board #%i\n", bd); |
298 | DPRINTK(PROBE, NOTICE, "Using defaults for all values\n"); | 326 | DPRINTK(PROBE, NOTICE, "Using defaults for all values\n"); |
327 | bd = E1000_MAX_NIC; | ||
299 | } | 328 | } |
300 | 329 | ||
301 | { /* Transmit Descriptor Count */ | 330 | { /* Transmit Descriptor Count */ |
@@ -313,14 +342,9 @@ e1000_check_options(struct e1000_adapter *adapter) | |||
313 | opt.arg.r.max = mac_type < e1000_82544 ? | 342 | opt.arg.r.max = mac_type < e1000_82544 ? |
314 | E1000_MAX_TXD : E1000_MAX_82544_TXD; | 343 | E1000_MAX_TXD : E1000_MAX_82544_TXD; |
315 | 344 | ||
316 | if (num_TxDescriptors > bd) { | 345 | tx_ring->count = TxDescriptors[bd]; |
317 | tx_ring->count = TxDescriptors[bd]; | 346 | e1000_validate_option(&tx_ring->count, &opt, adapter); |
318 | e1000_validate_option(&tx_ring->count, &opt, adapter); | 347 | E1000_ROUNDUP(tx_ring->count, REQ_TX_DESCRIPTOR_MULTIPLE); |
319 | E1000_ROUNDUP(tx_ring->count, | ||
320 | REQ_TX_DESCRIPTOR_MULTIPLE); | ||
321 | } else { | ||
322 | tx_ring->count = opt.def; | ||
323 | } | ||
324 | for (i = 0; i < adapter->num_tx_queues; i++) | 348 | for (i = 0; i < adapter->num_tx_queues; i++) |
325 | tx_ring[i].count = tx_ring->count; | 349 | tx_ring[i].count = tx_ring->count; |
326 | } | 350 | } |
@@ -339,14 +363,9 @@ e1000_check_options(struct e1000_adapter *adapter) | |||
339 | opt.arg.r.max = mac_type < e1000_82544 ? E1000_MAX_RXD : | 363 | opt.arg.r.max = mac_type < e1000_82544 ? E1000_MAX_RXD : |
340 | E1000_MAX_82544_RXD; | 364 | E1000_MAX_82544_RXD; |
341 | 365 | ||
342 | if (num_RxDescriptors > bd) { | 366 | rx_ring->count = RxDescriptors[bd]; |
343 | rx_ring->count = RxDescriptors[bd]; | 367 | e1000_validate_option(&rx_ring->count, &opt, adapter); |
344 | e1000_validate_option(&rx_ring->count, &opt, adapter); | 368 | E1000_ROUNDUP(rx_ring->count, REQ_RX_DESCRIPTOR_MULTIPLE); |
345 | E1000_ROUNDUP(rx_ring->count, | ||
346 | REQ_RX_DESCRIPTOR_MULTIPLE); | ||
347 | } else { | ||
348 | rx_ring->count = opt.def; | ||
349 | } | ||
350 | for (i = 0; i < adapter->num_rx_queues; i++) | 369 | for (i = 0; i < adapter->num_rx_queues; i++) |
351 | rx_ring[i].count = rx_ring->count; | 370 | rx_ring[i].count = rx_ring->count; |
352 | } | 371 | } |
@@ -358,13 +377,9 @@ e1000_check_options(struct e1000_adapter *adapter) | |||
358 | .def = OPTION_ENABLED | 377 | .def = OPTION_ENABLED |
359 | }; | 378 | }; |
360 | 379 | ||
361 | if (num_XsumRX > bd) { | 380 | int rx_csum = XsumRX[bd]; |
362 | int rx_csum = XsumRX[bd]; | 381 | e1000_validate_option(&rx_csum, &opt, adapter); |
363 | e1000_validate_option(&rx_csum, &opt, adapter); | 382 | adapter->rx_csum = rx_csum; |
364 | adapter->rx_csum = rx_csum; | ||
365 | } else { | ||
366 | adapter->rx_csum = opt.def; | ||
367 | } | ||
368 | } | 383 | } |
369 | { /* Flow Control */ | 384 | { /* Flow Control */ |
370 | 385 | ||
@@ -384,13 +399,9 @@ e1000_check_options(struct e1000_adapter *adapter) | |||
384 | .p = fc_list }} | 399 | .p = fc_list }} |
385 | }; | 400 | }; |
386 | 401 | ||
387 | if (num_FlowControl > bd) { | 402 | int fc = FlowControl[bd]; |
388 | int fc = FlowControl[bd]; | 403 | e1000_validate_option(&fc, &opt, adapter); |
389 | e1000_validate_option(&fc, &opt, adapter); | 404 | adapter->hw.fc = adapter->hw.original_fc = fc; |
390 | adapter->hw.fc = adapter->hw.original_fc = fc; | ||
391 | } else { | ||
392 | adapter->hw.fc = adapter->hw.original_fc = opt.def; | ||
393 | } | ||
394 | } | 405 | } |
395 | { /* Transmit Interrupt Delay */ | 406 | { /* Transmit Interrupt Delay */ |
396 | struct e1000_option opt = { | 407 | struct e1000_option opt = { |
@@ -402,13 +413,8 @@ e1000_check_options(struct e1000_adapter *adapter) | |||
402 | .max = MAX_TXDELAY }} | 413 | .max = MAX_TXDELAY }} |
403 | }; | 414 | }; |
404 | 415 | ||
405 | if (num_TxIntDelay > bd) { | 416 | adapter->tx_int_delay = TxIntDelay[bd]; |
406 | adapter->tx_int_delay = TxIntDelay[bd]; | 417 | e1000_validate_option(&adapter->tx_int_delay, &opt, adapter); |
407 | e1000_validate_option(&adapter->tx_int_delay, &opt, | ||
408 | adapter); | ||
409 | } else { | ||
410 | adapter->tx_int_delay = opt.def; | ||
411 | } | ||
412 | } | 418 | } |
413 | { /* Transmit Absolute Interrupt Delay */ | 419 | { /* Transmit Absolute Interrupt Delay */ |
414 | struct e1000_option opt = { | 420 | struct e1000_option opt = { |
@@ -420,13 +426,9 @@ e1000_check_options(struct e1000_adapter *adapter) | |||
420 | .max = MAX_TXABSDELAY }} | 426 | .max = MAX_TXABSDELAY }} |
421 | }; | 427 | }; |
422 | 428 | ||
423 | if (num_TxAbsIntDelay > bd) { | 429 | adapter->tx_abs_int_delay = TxAbsIntDelay[bd]; |
424 | adapter->tx_abs_int_delay = TxAbsIntDelay[bd]; | 430 | e1000_validate_option(&adapter->tx_abs_int_delay, &opt, |
425 | e1000_validate_option(&adapter->tx_abs_int_delay, &opt, | 431 | adapter); |
426 | adapter); | ||
427 | } else { | ||
428 | adapter->tx_abs_int_delay = opt.def; | ||
429 | } | ||
430 | } | 432 | } |
431 | { /* Receive Interrupt Delay */ | 433 | { /* Receive Interrupt Delay */ |
432 | struct e1000_option opt = { | 434 | struct e1000_option opt = { |
@@ -438,13 +440,8 @@ e1000_check_options(struct e1000_adapter *adapter) | |||
438 | .max = MAX_RXDELAY }} | 440 | .max = MAX_RXDELAY }} |
439 | }; | 441 | }; |
440 | 442 | ||
441 | if (num_RxIntDelay > bd) { | 443 | adapter->rx_int_delay = RxIntDelay[bd]; |
442 | adapter->rx_int_delay = RxIntDelay[bd]; | 444 | e1000_validate_option(&adapter->rx_int_delay, &opt, adapter); |
443 | e1000_validate_option(&adapter->rx_int_delay, &opt, | ||
444 | adapter); | ||
445 | } else { | ||
446 | adapter->rx_int_delay = opt.def; | ||
447 | } | ||
448 | } | 445 | } |
449 | { /* Receive Absolute Interrupt Delay */ | 446 | { /* Receive Absolute Interrupt Delay */ |
450 | struct e1000_option opt = { | 447 | struct e1000_option opt = { |
@@ -456,13 +453,9 @@ e1000_check_options(struct e1000_adapter *adapter) | |||
456 | .max = MAX_RXABSDELAY }} | 453 | .max = MAX_RXABSDELAY }} |
457 | }; | 454 | }; |
458 | 455 | ||
459 | if (num_RxAbsIntDelay > bd) { | 456 | adapter->rx_abs_int_delay = RxAbsIntDelay[bd]; |
460 | adapter->rx_abs_int_delay = RxAbsIntDelay[bd]; | 457 | e1000_validate_option(&adapter->rx_abs_int_delay, &opt, |
461 | e1000_validate_option(&adapter->rx_abs_int_delay, &opt, | 458 | adapter); |
462 | adapter); | ||
463 | } else { | ||
464 | adapter->rx_abs_int_delay = opt.def; | ||
465 | } | ||
466 | } | 459 | } |
467 | { /* Interrupt Throttling Rate */ | 460 | { /* Interrupt Throttling Rate */ |
468 | struct e1000_option opt = { | 461 | struct e1000_option opt = { |
@@ -474,26 +467,44 @@ e1000_check_options(struct e1000_adapter *adapter) | |||
474 | .max = MAX_ITR }} | 467 | .max = MAX_ITR }} |
475 | }; | 468 | }; |
476 | 469 | ||
477 | if (num_InterruptThrottleRate > bd) { | 470 | adapter->itr = InterruptThrottleRate[bd]; |
478 | adapter->itr = InterruptThrottleRate[bd]; | 471 | switch (adapter->itr) { |
479 | switch (adapter->itr) { | 472 | case 0: |
480 | case 0: | 473 | DPRINTK(PROBE, INFO, "%s turned off\n", opt.name); |
481 | DPRINTK(PROBE, INFO, "%s turned off\n", | 474 | break; |
482 | opt.name); | 475 | case 1: |
483 | break; | 476 | DPRINTK(PROBE, INFO, "%s set to dynamic mode\n", |
484 | case 1: | 477 | opt.name); |
485 | DPRINTK(PROBE, INFO, "%s set to dynamic mode\n", | 478 | break; |
486 | opt.name); | 479 | default: |
487 | break; | 480 | e1000_validate_option(&adapter->itr, &opt, adapter); |
488 | default: | 481 | break; |
489 | e1000_validate_option(&adapter->itr, &opt, | ||
490 | adapter); | ||
491 | break; | ||
492 | } | ||
493 | } else { | ||
494 | adapter->itr = opt.def; | ||
495 | } | 482 | } |
496 | } | 483 | } |
484 | { /* Smart Power Down */ | ||
485 | struct e1000_option opt = { | ||
486 | .type = enable_option, | ||
487 | .name = "PHY Smart Power Down", | ||
488 | .err = "defaulting to Disabled", | ||
489 | .def = OPTION_DISABLED | ||
490 | }; | ||
491 | |||
492 | int spd = SmartPowerDownEnable[bd]; | ||
493 | e1000_validate_option(&spd, &opt, adapter); | ||
494 | adapter->smart_power_down = spd; | ||
495 | } | ||
496 | { /* Kumeran Lock Loss Workaround */ | ||
497 | struct e1000_option opt = { | ||
498 | .type = enable_option, | ||
499 | .name = "Kumeran Lock Loss Workaround", | ||
500 | .err = "defaulting to Enabled", | ||
501 | .def = OPTION_ENABLED | ||
502 | }; | ||
503 | |||
504 | int kmrn_lock_loss = KumeranLockLoss[bd]; | ||
505 | e1000_validate_option(&kmrn_lock_loss, &opt, adapter); | ||
506 | adapter->hw.kmrn_lock_loss_workaround_disabled = !kmrn_lock_loss; | ||
507 | } | ||
497 | 508 | ||
498 | switch (adapter->hw.media_type) { | 509 | switch (adapter->hw.media_type) { |
499 | case e1000_media_type_fiber: | 510 | case e1000_media_type_fiber: |
@@ -519,17 +530,18 @@ static void __devinit | |||
519 | e1000_check_fiber_options(struct e1000_adapter *adapter) | 530 | e1000_check_fiber_options(struct e1000_adapter *adapter) |
520 | { | 531 | { |
521 | int bd = adapter->bd_number; | 532 | int bd = adapter->bd_number; |
522 | if (num_Speed > bd) { | 533 | bd = bd > E1000_MAX_NIC ? E1000_MAX_NIC : bd; |
534 | if ((Speed[bd] != OPTION_UNSET)) { | ||
523 | DPRINTK(PROBE, INFO, "Speed not valid for fiber adapters, " | 535 | DPRINTK(PROBE, INFO, "Speed not valid for fiber adapters, " |
524 | "parameter ignored\n"); | 536 | "parameter ignored\n"); |
525 | } | 537 | } |
526 | 538 | ||
527 | if (num_Duplex > bd) { | 539 | if ((Duplex[bd] != OPTION_UNSET)) { |
528 | DPRINTK(PROBE, INFO, "Duplex not valid for fiber adapters, " | 540 | DPRINTK(PROBE, INFO, "Duplex not valid for fiber adapters, " |
529 | "parameter ignored\n"); | 541 | "parameter ignored\n"); |
530 | } | 542 | } |
531 | 543 | ||
532 | if ((num_AutoNeg > bd) && (AutoNeg[bd] != 0x20)) { | 544 | if ((AutoNeg[bd] != OPTION_UNSET) && (AutoNeg[bd] != 0x20)) { |
533 | DPRINTK(PROBE, INFO, "AutoNeg other than 1000/Full is " | 545 | DPRINTK(PROBE, INFO, "AutoNeg other than 1000/Full is " |
534 | "not valid for fiber adapters, " | 546 | "not valid for fiber adapters, " |
535 | "parameter ignored\n"); | 547 | "parameter ignored\n"); |
@@ -548,6 +560,7 @@ e1000_check_copper_options(struct e1000_adapter *adapter) | |||
548 | { | 560 | { |
549 | int speed, dplx, an; | 561 | int speed, dplx, an; |
550 | int bd = adapter->bd_number; | 562 | int bd = adapter->bd_number; |
563 | bd = bd > E1000_MAX_NIC ? E1000_MAX_NIC : bd; | ||
551 | 564 | ||
552 | { /* Speed */ | 565 | { /* Speed */ |
553 | struct e1000_opt_list speed_list[] = {{ 0, "" }, | 566 | struct e1000_opt_list speed_list[] = {{ 0, "" }, |
@@ -564,12 +577,8 @@ e1000_check_copper_options(struct e1000_adapter *adapter) | |||
564 | .p = speed_list }} | 577 | .p = speed_list }} |
565 | }; | 578 | }; |
566 | 579 | ||
567 | if (num_Speed > bd) { | 580 | speed = Speed[bd]; |
568 | speed = Speed[bd]; | 581 | e1000_validate_option(&speed, &opt, adapter); |
569 | e1000_validate_option(&speed, &opt, adapter); | ||
570 | } else { | ||
571 | speed = opt.def; | ||
572 | } | ||
573 | } | 582 | } |
574 | { /* Duplex */ | 583 | { /* Duplex */ |
575 | struct e1000_opt_list dplx_list[] = {{ 0, "" }, | 584 | struct e1000_opt_list dplx_list[] = {{ 0, "" }, |
@@ -591,15 +600,11 @@ e1000_check_copper_options(struct e1000_adapter *adapter) | |||
591 | "Speed/Duplex/AutoNeg parameter ignored.\n"); | 600 | "Speed/Duplex/AutoNeg parameter ignored.\n"); |
592 | return; | 601 | return; |
593 | } | 602 | } |
594 | if (num_Duplex > bd) { | 603 | dplx = Duplex[bd]; |
595 | dplx = Duplex[bd]; | 604 | e1000_validate_option(&dplx, &opt, adapter); |
596 | e1000_validate_option(&dplx, &opt, adapter); | ||
597 | } else { | ||
598 | dplx = opt.def; | ||
599 | } | ||
600 | } | 605 | } |
601 | 606 | ||
602 | if ((num_AutoNeg > bd) && (speed != 0 || dplx != 0)) { | 607 | if (AutoNeg[bd] != OPTION_UNSET && (speed != 0 || dplx != 0)) { |
603 | DPRINTK(PROBE, INFO, | 608 | DPRINTK(PROBE, INFO, |
604 | "AutoNeg specified along with Speed or Duplex, " | 609 | "AutoNeg specified along with Speed or Duplex, " |
605 | "parameter ignored\n"); | 610 | "parameter ignored\n"); |
@@ -648,19 +653,15 @@ e1000_check_copper_options(struct e1000_adapter *adapter) | |||
648 | .p = an_list }} | 653 | .p = an_list }} |
649 | }; | 654 | }; |
650 | 655 | ||
651 | if (num_AutoNeg > bd) { | 656 | an = AutoNeg[bd]; |
652 | an = AutoNeg[bd]; | 657 | e1000_validate_option(&an, &opt, adapter); |
653 | e1000_validate_option(&an, &opt, adapter); | ||
654 | } else { | ||
655 | an = opt.def; | ||
656 | } | ||
657 | adapter->hw.autoneg_advertised = an; | 658 | adapter->hw.autoneg_advertised = an; |
658 | } | 659 | } |
659 | 660 | ||
660 | switch (speed + dplx) { | 661 | switch (speed + dplx) { |
661 | case 0: | 662 | case 0: |
662 | adapter->hw.autoneg = adapter->fc_autoneg = 1; | 663 | adapter->hw.autoneg = adapter->fc_autoneg = 1; |
663 | if ((num_Speed > bd) && (speed != 0 || dplx != 0)) | 664 | if (Speed[bd] != OPTION_UNSET || Duplex[bd] != OPTION_UNSET) |
664 | DPRINTK(PROBE, INFO, | 665 | DPRINTK(PROBE, INFO, |
665 | "Speed and duplex autonegotiation enabled\n"); | 666 | "Speed and duplex autonegotiation enabled\n"); |
666 | break; | 667 | break; |
diff --git a/drivers/net/forcedeth.c b/drivers/net/forcedeth.c index 037d870712ff..11b8f1b43dd5 100644 --- a/drivers/net/forcedeth.c +++ b/drivers/net/forcedeth.c | |||
@@ -240,10 +240,12 @@ enum { | |||
240 | #define NVREG_RNDSEED_FORCE2 0x2d00 | 240 | #define NVREG_RNDSEED_FORCE2 0x2d00 |
241 | #define NVREG_RNDSEED_FORCE3 0x7400 | 241 | #define NVREG_RNDSEED_FORCE3 0x7400 |
242 | 242 | ||
243 | NvRegUnknownSetupReg1 = 0xA0, | 243 | NvRegTxDeferral = 0xA0, |
244 | #define NVREG_UNKSETUP1_VAL 0x16070f | 244 | #define NVREG_TX_DEFERRAL_DEFAULT 0x15050f |
245 | NvRegUnknownSetupReg2 = 0xA4, | 245 | #define NVREG_TX_DEFERRAL_RGMII_10_100 0x16070f |
246 | #define NVREG_UNKSETUP2_VAL 0x16 | 246 | #define NVREG_TX_DEFERRAL_RGMII_1000 0x14050f |
247 | NvRegRxDeferral = 0xA4, | ||
248 | #define NVREG_RX_DEFERRAL_DEFAULT 0x16 | ||
247 | NvRegMacAddrA = 0xA8, | 249 | NvRegMacAddrA = 0xA8, |
248 | NvRegMacAddrB = 0xAC, | 250 | NvRegMacAddrB = 0xAC, |
249 | NvRegMulticastAddrA = 0xB0, | 251 | NvRegMulticastAddrA = 0xB0, |
@@ -269,8 +271,10 @@ enum { | |||
269 | #define NVREG_LINKSPEED_MASK (0xFFF) | 271 | #define NVREG_LINKSPEED_MASK (0xFFF) |
270 | NvRegUnknownSetupReg5 = 0x130, | 272 | NvRegUnknownSetupReg5 = 0x130, |
271 | #define NVREG_UNKSETUP5_BIT31 (1<<31) | 273 | #define NVREG_UNKSETUP5_BIT31 (1<<31) |
272 | NvRegUnknownSetupReg3 = 0x13c, | 274 | NvRegTxWatermark = 0x13c, |
273 | #define NVREG_UNKSETUP3_VAL1 0x200010 | 275 | #define NVREG_TX_WM_DESC1_DEFAULT 0x0200010 |
276 | #define NVREG_TX_WM_DESC2_3_DEFAULT 0x1e08000 | ||
277 | #define NVREG_TX_WM_DESC2_3_1000 0xfe08000 | ||
274 | NvRegTxRxControl = 0x144, | 278 | NvRegTxRxControl = 0x144, |
275 | #define NVREG_TXRXCTL_KICK 0x0001 | 279 | #define NVREG_TXRXCTL_KICK 0x0001 |
276 | #define NVREG_TXRXCTL_BIT1 0x0002 | 280 | #define NVREG_TXRXCTL_BIT1 0x0002 |
@@ -658,7 +662,7 @@ static const struct register_test nv_registers_test[] = { | |||
658 | { NvRegMisc1, 0x03c }, | 662 | { NvRegMisc1, 0x03c }, |
659 | { NvRegOffloadConfig, 0x03ff }, | 663 | { NvRegOffloadConfig, 0x03ff }, |
660 | { NvRegMulticastAddrA, 0xffffffff }, | 664 | { NvRegMulticastAddrA, 0xffffffff }, |
661 | { NvRegUnknownSetupReg3, 0x0ff }, | 665 | { NvRegTxWatermark, 0x0ff }, |
662 | { NvRegWakeUpFlags, 0x07777 }, | 666 | { NvRegWakeUpFlags, 0x07777 }, |
663 | { 0,0 } | 667 | { 0,0 } |
664 | }; | 668 | }; |
@@ -1495,7 +1499,7 @@ static int nv_start_xmit(struct sk_buff *skb, struct net_device *dev) | |||
1495 | np->tx_skbuff[nr] = skb; | 1499 | np->tx_skbuff[nr] = skb; |
1496 | 1500 | ||
1497 | #ifdef NETIF_F_TSO | 1501 | #ifdef NETIF_F_TSO |
1498 | if (skb_shinfo(skb)->gso_size) | 1502 | if (skb_is_gso(skb)) |
1499 | tx_flags_extra = NV_TX2_TSO | (skb_shinfo(skb)->gso_size << NV_TX2_TSO_SHIFT); | 1503 | tx_flags_extra = NV_TX2_TSO | (skb_shinfo(skb)->gso_size << NV_TX2_TSO_SHIFT); |
1500 | else | 1504 | else |
1501 | #endif | 1505 | #endif |
@@ -2127,7 +2131,7 @@ static int nv_update_linkspeed(struct net_device *dev) | |||
2127 | int newdup = np->duplex; | 2131 | int newdup = np->duplex; |
2128 | int mii_status; | 2132 | int mii_status; |
2129 | int retval = 0; | 2133 | int retval = 0; |
2130 | u32 control_1000, status_1000, phyreg, pause_flags; | 2134 | u32 control_1000, status_1000, phyreg, pause_flags, txreg; |
2131 | 2135 | ||
2132 | /* BMSR_LSTATUS is latched, read it twice: | 2136 | /* BMSR_LSTATUS is latched, read it twice: |
2133 | * we want the current value. | 2137 | * we want the current value. |
@@ -2245,6 +2249,26 @@ set_speed: | |||
2245 | phyreg |= PHY_1000; | 2249 | phyreg |= PHY_1000; |
2246 | writel(phyreg, base + NvRegPhyInterface); | 2250 | writel(phyreg, base + NvRegPhyInterface); |
2247 | 2251 | ||
2252 | if (phyreg & PHY_RGMII) { | ||
2253 | if ((np->linkspeed & NVREG_LINKSPEED_MASK) == NVREG_LINKSPEED_1000) | ||
2254 | txreg = NVREG_TX_DEFERRAL_RGMII_1000; | ||
2255 | else | ||
2256 | txreg = NVREG_TX_DEFERRAL_RGMII_10_100; | ||
2257 | } else { | ||
2258 | txreg = NVREG_TX_DEFERRAL_DEFAULT; | ||
2259 | } | ||
2260 | writel(txreg, base + NvRegTxDeferral); | ||
2261 | |||
2262 | if (np->desc_ver == DESC_VER_1) { | ||
2263 | txreg = NVREG_TX_WM_DESC1_DEFAULT; | ||
2264 | } else { | ||
2265 | if ((np->linkspeed & NVREG_LINKSPEED_MASK) == NVREG_LINKSPEED_1000) | ||
2266 | txreg = NVREG_TX_WM_DESC2_3_1000; | ||
2267 | else | ||
2268 | txreg = NVREG_TX_WM_DESC2_3_DEFAULT; | ||
2269 | } | ||
2270 | writel(txreg, base + NvRegTxWatermark); | ||
2271 | |||
2248 | writel(NVREG_MISC1_FORCE | ( np->duplex ? 0 : NVREG_MISC1_HD), | 2272 | writel(NVREG_MISC1_FORCE | ( np->duplex ? 0 : NVREG_MISC1_HD), |
2249 | base + NvRegMisc1); | 2273 | base + NvRegMisc1); |
2250 | pci_push(base); | 2274 | pci_push(base); |
@@ -3910,7 +3934,10 @@ static int nv_open(struct net_device *dev) | |||
3910 | 3934 | ||
3911 | /* 5) continue setup */ | 3935 | /* 5) continue setup */ |
3912 | writel(np->linkspeed, base + NvRegLinkSpeed); | 3936 | writel(np->linkspeed, base + NvRegLinkSpeed); |
3913 | writel(NVREG_UNKSETUP3_VAL1, base + NvRegUnknownSetupReg3); | 3937 | if (np->desc_ver == DESC_VER_1) |
3938 | writel(NVREG_TX_WM_DESC1_DEFAULT, base + NvRegTxWatermark); | ||
3939 | else | ||
3940 | writel(NVREG_TX_WM_DESC2_3_DEFAULT, base + NvRegTxWatermark); | ||
3914 | writel(np->txrxctl_bits, base + NvRegTxRxControl); | 3941 | writel(np->txrxctl_bits, base + NvRegTxRxControl); |
3915 | writel(np->vlanctl_bits, base + NvRegVlanControl); | 3942 | writel(np->vlanctl_bits, base + NvRegVlanControl); |
3916 | pci_push(base); | 3943 | pci_push(base); |
@@ -3932,8 +3959,8 @@ static int nv_open(struct net_device *dev) | |||
3932 | writel(readl(base + NvRegReceiverStatus), base + NvRegReceiverStatus); | 3959 | writel(readl(base + NvRegReceiverStatus), base + NvRegReceiverStatus); |
3933 | get_random_bytes(&i, sizeof(i)); | 3960 | get_random_bytes(&i, sizeof(i)); |
3934 | writel(NVREG_RNDSEED_FORCE | (i&NVREG_RNDSEED_MASK), base + NvRegRandomSeed); | 3961 | writel(NVREG_RNDSEED_FORCE | (i&NVREG_RNDSEED_MASK), base + NvRegRandomSeed); |
3935 | writel(NVREG_UNKSETUP1_VAL, base + NvRegUnknownSetupReg1); | 3962 | writel(NVREG_TX_DEFERRAL_DEFAULT, base + NvRegTxDeferral); |
3936 | writel(NVREG_UNKSETUP2_VAL, base + NvRegUnknownSetupReg2); | 3963 | writel(NVREG_RX_DEFERRAL_DEFAULT, base + NvRegRxDeferral); |
3937 | if (poll_interval == -1) { | 3964 | if (poll_interval == -1) { |
3938 | if (optimization_mode == NV_OPTIMIZATION_MODE_THROUGHPUT) | 3965 | if (optimization_mode == NV_OPTIMIZATION_MODE_THROUGHPUT) |
3939 | writel(NVREG_POLL_DEFAULT_THROUGHPUT, base + NvRegPollingInterval); | 3966 | writel(NVREG_POLL_DEFAULT_THROUGHPUT, base + NvRegPollingInterval); |
diff --git a/drivers/net/hamradio/bpqether.c b/drivers/net/hamradio/bpqether.c index 0641f54fc638..889f338132fa 100644 --- a/drivers/net/hamradio/bpqether.c +++ b/drivers/net/hamradio/bpqether.c | |||
@@ -122,6 +122,12 @@ struct bpqdev { | |||
122 | 122 | ||
123 | static LIST_HEAD(bpq_devices); | 123 | static LIST_HEAD(bpq_devices); |
124 | 124 | ||
125 | /* | ||
126 | * bpqether network devices are paired with ethernet devices below them, so | ||
127 | * form a special "super class" of normal ethernet devices; split their locks | ||
128 | * off into a separate class since they always nest. | ||
129 | */ | ||
130 | static struct lock_class_key bpq_netdev_xmit_lock_key; | ||
125 | 131 | ||
126 | /* ------------------------------------------------------------------------ */ | 132 | /* ------------------------------------------------------------------------ */ |
127 | 133 | ||
@@ -528,6 +534,7 @@ static int bpq_new_device(struct net_device *edev) | |||
528 | err = register_netdevice(ndev); | 534 | err = register_netdevice(ndev); |
529 | if (err) | 535 | if (err) |
530 | goto error; | 536 | goto error; |
537 | lockdep_set_class(&ndev->_xmit_lock, &bpq_netdev_xmit_lock_key); | ||
531 | 538 | ||
532 | /* List protected by RTNL */ | 539 | /* List protected by RTNL */ |
533 | list_add_rcu(&bpq->bpq_list, &bpq_devices); | 540 | list_add_rcu(&bpq->bpq_list, &bpq_devices); |
diff --git a/drivers/net/irda/ali-ircc.c b/drivers/net/irda/ali-ircc.c index bf1fca5a3fa0..e3c8cd5eca67 100644 --- a/drivers/net/irda/ali-ircc.c +++ b/drivers/net/irda/ali-ircc.c | |||
@@ -146,7 +146,7 @@ static int __init ali_ircc_init(void) | |||
146 | { | 146 | { |
147 | ali_chip_t *chip; | 147 | ali_chip_t *chip; |
148 | chipio_t info; | 148 | chipio_t info; |
149 | int ret = -ENODEV; | 149 | int ret; |
150 | int cfg, cfg_base; | 150 | int cfg, cfg_base; |
151 | int reg, revision; | 151 | int reg, revision; |
152 | int i = 0; | 152 | int i = 0; |
@@ -160,6 +160,7 @@ static int __init ali_ircc_init(void) | |||
160 | return ret; | 160 | return ret; |
161 | } | 161 | } |
162 | 162 | ||
163 | ret = -ENODEV; | ||
163 | 164 | ||
164 | /* Probe for all the ALi chipsets we know about */ | 165 | /* Probe for all the ALi chipsets we know about */ |
165 | for (chip= chips; chip->name; chip++, i++) | 166 | for (chip= chips; chip->name; chip++, i++) |
diff --git a/drivers/net/irda/smsc-ircc2.c b/drivers/net/irda/smsc-ircc2.c index a4674044bd6f..2eff45bedc7c 100644 --- a/drivers/net/irda/smsc-ircc2.c +++ b/drivers/net/irda/smsc-ircc2.c | |||
@@ -2353,7 +2353,7 @@ static int __init smsc_superio_lpc(unsigned short cfg_base) | |||
2353 | #ifdef CONFIG_PCI | 2353 | #ifdef CONFIG_PCI |
2354 | #define PCIID_VENDOR_INTEL 0x8086 | 2354 | #define PCIID_VENDOR_INTEL 0x8086 |
2355 | #define PCIID_VENDOR_ALI 0x10b9 | 2355 | #define PCIID_VENDOR_ALI 0x10b9 |
2356 | static struct smsc_ircc_subsystem_configuration subsystem_configurations[] __devinitdata = { | 2356 | static struct smsc_ircc_subsystem_configuration subsystem_configurations[] __initdata = { |
2357 | { | 2357 | { |
2358 | .vendor = PCIID_VENDOR_INTEL, /* Intel 82801DBM LPC bridge */ | 2358 | .vendor = PCIID_VENDOR_INTEL, /* Intel 82801DBM LPC bridge */ |
2359 | .device = 0x24cc, | 2359 | .device = 0x24cc, |
diff --git a/drivers/net/ixgb/ixgb_main.c b/drivers/net/ixgb/ixgb_main.c index b91e082483f6..7bbd447289b5 100644 --- a/drivers/net/ixgb/ixgb_main.c +++ b/drivers/net/ixgb/ixgb_main.c | |||
@@ -1173,7 +1173,7 @@ ixgb_tso(struct ixgb_adapter *adapter, struct sk_buff *skb) | |||
1173 | uint16_t ipcse, tucse, mss; | 1173 | uint16_t ipcse, tucse, mss; |
1174 | int err; | 1174 | int err; |
1175 | 1175 | ||
1176 | if(likely(skb_shinfo(skb)->gso_size)) { | 1176 | if (likely(skb_is_gso(skb))) { |
1177 | if (skb_header_cloned(skb)) { | 1177 | if (skb_header_cloned(skb)) { |
1178 | err = pskb_expand_head(skb, 0, 0, GFP_ATOMIC); | 1178 | err = pskb_expand_head(skb, 0, 0, GFP_ATOMIC); |
1179 | if (err) | 1179 | if (err) |
@@ -1281,7 +1281,7 @@ ixgb_tx_map(struct ixgb_adapter *adapter, struct sk_buff *skb, | |||
1281 | 1281 | ||
1282 | while(len) { | 1282 | while(len) { |
1283 | buffer_info = &tx_ring->buffer_info[i]; | 1283 | buffer_info = &tx_ring->buffer_info[i]; |
1284 | size = min(len, IXGB_MAX_JUMBO_FRAME_SIZE); | 1284 | size = min(len, IXGB_MAX_DATA_PER_TXD); |
1285 | buffer_info->length = size; | 1285 | buffer_info->length = size; |
1286 | buffer_info->dma = | 1286 | buffer_info->dma = |
1287 | pci_map_single(adapter->pdev, | 1287 | pci_map_single(adapter->pdev, |
@@ -1306,7 +1306,7 @@ ixgb_tx_map(struct ixgb_adapter *adapter, struct sk_buff *skb, | |||
1306 | 1306 | ||
1307 | while(len) { | 1307 | while(len) { |
1308 | buffer_info = &tx_ring->buffer_info[i]; | 1308 | buffer_info = &tx_ring->buffer_info[i]; |
1309 | size = min(len, IXGB_MAX_JUMBO_FRAME_SIZE); | 1309 | size = min(len, IXGB_MAX_DATA_PER_TXD); |
1310 | buffer_info->length = size; | 1310 | buffer_info->length = size; |
1311 | buffer_info->dma = | 1311 | buffer_info->dma = |
1312 | pci_map_page(adapter->pdev, | 1312 | pci_map_page(adapter->pdev, |
diff --git a/drivers/net/loopback.c b/drivers/net/loopback.c index 43fef7de8cb9..997cbce9af6e 100644 --- a/drivers/net/loopback.c +++ b/drivers/net/loopback.c | |||
@@ -139,7 +139,7 @@ static int loopback_xmit(struct sk_buff *skb, struct net_device *dev) | |||
139 | #endif | 139 | #endif |
140 | 140 | ||
141 | #ifdef LOOPBACK_TSO | 141 | #ifdef LOOPBACK_TSO |
142 | if (skb_shinfo(skb)->gso_size) { | 142 | if (skb_is_gso(skb)) { |
143 | BUG_ON(skb->protocol != htons(ETH_P_IP)); | 143 | BUG_ON(skb->protocol != htons(ETH_P_IP)); |
144 | BUG_ON(skb->nh.iph->protocol != IPPROTO_TCP); | 144 | BUG_ON(skb->nh.iph->protocol != IPPROTO_TCP); |
145 | 145 | ||
diff --git a/drivers/net/myri10ge/myri10ge.c b/drivers/net/myri10ge/myri10ge.c index f4c8fd373b9b..07ca9480a6fe 100644 --- a/drivers/net/myri10ge/myri10ge.c +++ b/drivers/net/myri10ge/myri10ge.c | |||
@@ -2116,7 +2116,7 @@ abort_linearize: | |||
2116 | } | 2116 | } |
2117 | idx = (idx + 1) & tx->mask; | 2117 | idx = (idx + 1) & tx->mask; |
2118 | } while (idx != last_idx); | 2118 | } while (idx != last_idx); |
2119 | if (skb_shinfo(skb)->gso_size) { | 2119 | if (skb_is_gso(skb)) { |
2120 | printk(KERN_ERR | 2120 | printk(KERN_ERR |
2121 | "myri10ge: %s: TSO but wanted to linearize?!?!?\n", | 2121 | "myri10ge: %s: TSO but wanted to linearize?!?!?\n", |
2122 | mgp->dev->name); | 2122 | mgp->dev->name); |
@@ -2412,14 +2412,20 @@ static int myri10ge_resume(struct pci_dev *pdev) | |||
2412 | return -EIO; | 2412 | return -EIO; |
2413 | } | 2413 | } |
2414 | myri10ge_restore_state(mgp); | 2414 | myri10ge_restore_state(mgp); |
2415 | pci_enable_device(pdev); | 2415 | |
2416 | status = pci_enable_device(pdev); | ||
2417 | if (status < 0) { | ||
2418 | dev_err(&pdev->dev, "failed to enable device\n"); | ||
2419 | return -EIO; | ||
2420 | } | ||
2421 | |||
2416 | pci_set_master(pdev); | 2422 | pci_set_master(pdev); |
2417 | 2423 | ||
2418 | status = request_irq(pdev->irq, myri10ge_intr, IRQF_SHARED, | 2424 | status = request_irq(pdev->irq, myri10ge_intr, IRQF_SHARED, |
2419 | netdev->name, mgp); | 2425 | netdev->name, mgp); |
2420 | if (status != 0) { | 2426 | if (status != 0) { |
2421 | dev_err(&pdev->dev, "failed to allocate IRQ\n"); | 2427 | dev_err(&pdev->dev, "failed to allocate IRQ\n"); |
2422 | goto abort_with_msi; | 2428 | goto abort_with_enabled; |
2423 | } | 2429 | } |
2424 | 2430 | ||
2425 | myri10ge_reset(mgp); | 2431 | myri10ge_reset(mgp); |
@@ -2438,7 +2444,8 @@ static int myri10ge_resume(struct pci_dev *pdev) | |||
2438 | 2444 | ||
2439 | return 0; | 2445 | return 0; |
2440 | 2446 | ||
2441 | abort_with_msi: | 2447 | abort_with_enabled: |
2448 | pci_disable_device(pdev); | ||
2442 | return -EIO; | 2449 | return -EIO; |
2443 | 2450 | ||
2444 | } | 2451 | } |
diff --git a/drivers/net/s2io.c b/drivers/net/s2io.c index c6b77acb35ef..e1fe3a0a7b0b 100644 --- a/drivers/net/s2io.c +++ b/drivers/net/s2io.c | |||
@@ -1976,7 +1976,6 @@ static int start_nic(struct s2io_nic *nic) | |||
1976 | XENA_dev_config_t __iomem *bar0 = nic->bar0; | 1976 | XENA_dev_config_t __iomem *bar0 = nic->bar0; |
1977 | struct net_device *dev = nic->dev; | 1977 | struct net_device *dev = nic->dev; |
1978 | register u64 val64 = 0; | 1978 | register u64 val64 = 0; |
1979 | u16 interruptible; | ||
1980 | u16 subid, i; | 1979 | u16 subid, i; |
1981 | mac_info_t *mac_control; | 1980 | mac_info_t *mac_control; |
1982 | struct config_param *config; | 1981 | struct config_param *config; |
@@ -2047,16 +2046,6 @@ static int start_nic(struct s2io_nic *nic) | |||
2047 | return FAILURE; | 2046 | return FAILURE; |
2048 | } | 2047 | } |
2049 | 2048 | ||
2050 | /* Enable select interrupts */ | ||
2051 | if (nic->intr_type != INTA) | ||
2052 | en_dis_able_nic_intrs(nic, ENA_ALL_INTRS, DISABLE_INTRS); | ||
2053 | else { | ||
2054 | interruptible = TX_TRAFFIC_INTR | RX_TRAFFIC_INTR; | ||
2055 | interruptible |= TX_PIC_INTR | RX_PIC_INTR; | ||
2056 | interruptible |= TX_MAC_INTR | RX_MAC_INTR; | ||
2057 | en_dis_able_nic_intrs(nic, interruptible, ENABLE_INTRS); | ||
2058 | } | ||
2059 | |||
2060 | /* | 2049 | /* |
2061 | * With some switches, link might be already up at this point. | 2050 | * With some switches, link might be already up at this point. |
2062 | * Because of this weird behavior, when we enable laser, | 2051 | * Because of this weird behavior, when we enable laser, |
@@ -3749,101 +3738,19 @@ static int s2io_open(struct net_device *dev) | |||
3749 | if (err) { | 3738 | if (err) { |
3750 | DBG_PRINT(ERR_DBG, "%s: H/W initialization failed\n", | 3739 | DBG_PRINT(ERR_DBG, "%s: H/W initialization failed\n", |
3751 | dev->name); | 3740 | dev->name); |
3752 | if (err == -ENODEV) | 3741 | goto hw_init_failed; |
3753 | goto hw_init_failed; | ||
3754 | else | ||
3755 | goto hw_enable_failed; | ||
3756 | } | ||
3757 | |||
3758 | /* Store the values of the MSIX table in the nic_t structure */ | ||
3759 | store_xmsi_data(sp); | ||
3760 | |||
3761 | /* After proper initialization of H/W, register ISR */ | ||
3762 | if (sp->intr_type == MSI) { | ||
3763 | err = request_irq((int) sp->pdev->irq, s2io_msi_handle, | ||
3764 | IRQF_SHARED, sp->name, dev); | ||
3765 | if (err) { | ||
3766 | DBG_PRINT(ERR_DBG, "%s: MSI registration \ | ||
3767 | failed\n", dev->name); | ||
3768 | goto isr_registration_failed; | ||
3769 | } | ||
3770 | } | ||
3771 | if (sp->intr_type == MSI_X) { | ||
3772 | int i; | ||
3773 | |||
3774 | for (i=1; (sp->s2io_entries[i].in_use == MSIX_FLG); i++) { | ||
3775 | if (sp->s2io_entries[i].type == MSIX_FIFO_TYPE) { | ||
3776 | sprintf(sp->desc1, "%s:MSI-X-%d-TX", | ||
3777 | dev->name, i); | ||
3778 | err = request_irq(sp->entries[i].vector, | ||
3779 | s2io_msix_fifo_handle, 0, sp->desc1, | ||
3780 | sp->s2io_entries[i].arg); | ||
3781 | DBG_PRINT(ERR_DBG, "%s @ 0x%llx\n", sp->desc1, | ||
3782 | (unsigned long long)sp->msix_info[i].addr); | ||
3783 | } else { | ||
3784 | sprintf(sp->desc2, "%s:MSI-X-%d-RX", | ||
3785 | dev->name, i); | ||
3786 | err = request_irq(sp->entries[i].vector, | ||
3787 | s2io_msix_ring_handle, 0, sp->desc2, | ||
3788 | sp->s2io_entries[i].arg); | ||
3789 | DBG_PRINT(ERR_DBG, "%s @ 0x%llx\n", sp->desc2, | ||
3790 | (unsigned long long)sp->msix_info[i].addr); | ||
3791 | } | ||
3792 | if (err) { | ||
3793 | DBG_PRINT(ERR_DBG, "%s: MSI-X-%d registration \ | ||
3794 | failed\n", dev->name, i); | ||
3795 | DBG_PRINT(ERR_DBG, "Returned: %d\n", err); | ||
3796 | goto isr_registration_failed; | ||
3797 | } | ||
3798 | sp->s2io_entries[i].in_use = MSIX_REGISTERED_SUCCESS; | ||
3799 | } | ||
3800 | } | ||
3801 | if (sp->intr_type == INTA) { | ||
3802 | err = request_irq((int) sp->pdev->irq, s2io_isr, IRQF_SHARED, | ||
3803 | sp->name, dev); | ||
3804 | if (err) { | ||
3805 | DBG_PRINT(ERR_DBG, "%s: ISR registration failed\n", | ||
3806 | dev->name); | ||
3807 | goto isr_registration_failed; | ||
3808 | } | ||
3809 | } | 3742 | } |
3810 | 3743 | ||
3811 | if (s2io_set_mac_addr(dev, dev->dev_addr) == FAILURE) { | 3744 | if (s2io_set_mac_addr(dev, dev->dev_addr) == FAILURE) { |
3812 | DBG_PRINT(ERR_DBG, "Set Mac Address Failed\n"); | 3745 | DBG_PRINT(ERR_DBG, "Set Mac Address Failed\n"); |
3746 | s2io_card_down(sp); | ||
3813 | err = -ENODEV; | 3747 | err = -ENODEV; |
3814 | goto setting_mac_address_failed; | 3748 | goto hw_init_failed; |
3815 | } | 3749 | } |
3816 | 3750 | ||
3817 | netif_start_queue(dev); | 3751 | netif_start_queue(dev); |
3818 | return 0; | 3752 | return 0; |
3819 | 3753 | ||
3820 | setting_mac_address_failed: | ||
3821 | if (sp->intr_type != MSI_X) | ||
3822 | free_irq(sp->pdev->irq, dev); | ||
3823 | isr_registration_failed: | ||
3824 | del_timer_sync(&sp->alarm_timer); | ||
3825 | if (sp->intr_type == MSI_X) { | ||
3826 | int i; | ||
3827 | u16 msi_control; /* Temp variable */ | ||
3828 | |||
3829 | for (i=1; (sp->s2io_entries[i].in_use == | ||
3830 | MSIX_REGISTERED_SUCCESS); i++) { | ||
3831 | int vector = sp->entries[i].vector; | ||
3832 | void *arg = sp->s2io_entries[i].arg; | ||
3833 | |||
3834 | free_irq(vector, arg); | ||
3835 | } | ||
3836 | pci_disable_msix(sp->pdev); | ||
3837 | |||
3838 | /* Temp */ | ||
3839 | pci_read_config_word(sp->pdev, 0x42, &msi_control); | ||
3840 | msi_control &= 0xFFFE; /* Disable MSI */ | ||
3841 | pci_write_config_word(sp->pdev, 0x42, msi_control); | ||
3842 | } | ||
3843 | else if (sp->intr_type == MSI) | ||
3844 | pci_disable_msi(sp->pdev); | ||
3845 | hw_enable_failed: | ||
3846 | s2io_reset(sp); | ||
3847 | hw_init_failed: | 3754 | hw_init_failed: |
3848 | if (sp->intr_type == MSI_X) { | 3755 | if (sp->intr_type == MSI_X) { |
3849 | if (sp->entries) | 3756 | if (sp->entries) |
@@ -3874,7 +3781,7 @@ static int s2io_close(struct net_device *dev) | |||
3874 | flush_scheduled_work(); | 3781 | flush_scheduled_work(); |
3875 | netif_stop_queue(dev); | 3782 | netif_stop_queue(dev); |
3876 | /* Reset card, kill tasklet and free Tx and Rx buffers. */ | 3783 | /* Reset card, kill tasklet and free Tx and Rx buffers. */ |
3877 | s2io_card_down(sp, 1); | 3784 | s2io_card_down(sp); |
3878 | 3785 | ||
3879 | sp->device_close_flag = TRUE; /* Device is shut down. */ | 3786 | sp->device_close_flag = TRUE; /* Device is shut down. */ |
3880 | return 0; | 3787 | return 0; |
@@ -5919,7 +5826,7 @@ static int s2io_change_mtu(struct net_device *dev, int new_mtu) | |||
5919 | 5826 | ||
5920 | dev->mtu = new_mtu; | 5827 | dev->mtu = new_mtu; |
5921 | if (netif_running(dev)) { | 5828 | if (netif_running(dev)) { |
5922 | s2io_card_down(sp, 0); | 5829 | s2io_card_down(sp); |
5923 | netif_stop_queue(dev); | 5830 | netif_stop_queue(dev); |
5924 | if (s2io_card_up(sp)) { | 5831 | if (s2io_card_up(sp)) { |
5925 | DBG_PRINT(ERR_DBG, "%s: Device bring up failed\n", | 5832 | DBG_PRINT(ERR_DBG, "%s: Device bring up failed\n", |
@@ -6216,43 +6123,106 @@ static int rxd_owner_bit_reset(nic_t *sp) | |||
6216 | 6123 | ||
6217 | } | 6124 | } |
6218 | 6125 | ||
6219 | static void s2io_card_down(nic_t * sp, int flag) | 6126 | static int s2io_add_isr(nic_t * sp) |
6220 | { | 6127 | { |
6221 | int cnt = 0; | 6128 | int ret = 0; |
6222 | XENA_dev_config_t __iomem *bar0 = sp->bar0; | ||
6223 | unsigned long flags; | ||
6224 | register u64 val64 = 0; | ||
6225 | struct net_device *dev = sp->dev; | 6129 | struct net_device *dev = sp->dev; |
6130 | int err = 0; | ||
6226 | 6131 | ||
6227 | del_timer_sync(&sp->alarm_timer); | 6132 | if (sp->intr_type == MSI) |
6228 | /* If s2io_set_link task is executing, wait till it completes. */ | 6133 | ret = s2io_enable_msi(sp); |
6229 | while (test_and_set_bit(0, &(sp->link_state))) { | 6134 | else if (sp->intr_type == MSI_X) |
6230 | msleep(50); | 6135 | ret = s2io_enable_msi_x(sp); |
6136 | if (ret) { | ||
6137 | DBG_PRINT(ERR_DBG, "%s: Defaulting to INTA\n", dev->name); | ||
6138 | sp->intr_type = INTA; | ||
6231 | } | 6139 | } |
6232 | atomic_set(&sp->card_state, CARD_DOWN); | ||
6233 | 6140 | ||
6234 | /* disable Tx and Rx traffic on the NIC */ | 6141 | /* Store the values of the MSIX table in the nic_t structure */ |
6235 | stop_nic(sp); | 6142 | store_xmsi_data(sp); |
6236 | if (flag) { | ||
6237 | if (sp->intr_type == MSI_X) { | ||
6238 | int i; | ||
6239 | u16 msi_control; | ||
6240 | 6143 | ||
6241 | for (i=1; (sp->s2io_entries[i].in_use == | 6144 | /* After proper initialization of H/W, register ISR */ |
6242 | MSIX_REGISTERED_SUCCESS); i++) { | 6145 | if (sp->intr_type == MSI) { |
6243 | int vector = sp->entries[i].vector; | 6146 | err = request_irq((int) sp->pdev->irq, s2io_msi_handle, |
6244 | void *arg = sp->s2io_entries[i].arg; | 6147 | IRQF_SHARED, sp->name, dev); |
6148 | if (err) { | ||
6149 | pci_disable_msi(sp->pdev); | ||
6150 | DBG_PRINT(ERR_DBG, "%s: MSI registration failed\n", | ||
6151 | dev->name); | ||
6152 | return -1; | ||
6153 | } | ||
6154 | } | ||
6155 | if (sp->intr_type == MSI_X) { | ||
6156 | int i; | ||
6245 | 6157 | ||
6246 | free_irq(vector, arg); | 6158 | for (i=1; (sp->s2io_entries[i].in_use == MSIX_FLG); i++) { |
6159 | if (sp->s2io_entries[i].type == MSIX_FIFO_TYPE) { | ||
6160 | sprintf(sp->desc[i], "%s:MSI-X-%d-TX", | ||
6161 | dev->name, i); | ||
6162 | err = request_irq(sp->entries[i].vector, | ||
6163 | s2io_msix_fifo_handle, 0, sp->desc[i], | ||
6164 | sp->s2io_entries[i].arg); | ||
6165 | DBG_PRINT(ERR_DBG, "%s @ 0x%llx\n", sp->desc[i], | ||
6166 | (unsigned long long)sp->msix_info[i].addr); | ||
6167 | } else { | ||
6168 | sprintf(sp->desc[i], "%s:MSI-X-%d-RX", | ||
6169 | dev->name, i); | ||
6170 | err = request_irq(sp->entries[i].vector, | ||
6171 | s2io_msix_ring_handle, 0, sp->desc[i], | ||
6172 | sp->s2io_entries[i].arg); | ||
6173 | DBG_PRINT(ERR_DBG, "%s @ 0x%llx\n", sp->desc[i], | ||
6174 | (unsigned long long)sp->msix_info[i].addr); | ||
6247 | } | 6175 | } |
6248 | pci_read_config_word(sp->pdev, 0x42, &msi_control); | 6176 | if (err) { |
6249 | msi_control &= 0xFFFE; /* Disable MSI */ | 6177 | DBG_PRINT(ERR_DBG,"%s:MSI-X-%d registration " |
6250 | pci_write_config_word(sp->pdev, 0x42, msi_control); | 6178 | "failed\n", dev->name, i); |
6251 | pci_disable_msix(sp->pdev); | 6179 | DBG_PRINT(ERR_DBG, "Returned: %d\n", err); |
6252 | } else { | 6180 | return -1; |
6253 | free_irq(sp->pdev->irq, dev); | 6181 | } |
6254 | if (sp->intr_type == MSI) | 6182 | sp->s2io_entries[i].in_use = MSIX_REGISTERED_SUCCESS; |
6255 | pci_disable_msi(sp->pdev); | 6183 | } |
6184 | } | ||
6185 | if (sp->intr_type == INTA) { | ||
6186 | err = request_irq((int) sp->pdev->irq, s2io_isr, IRQF_SHARED, | ||
6187 | sp->name, dev); | ||
6188 | if (err) { | ||
6189 | DBG_PRINT(ERR_DBG, "%s: ISR registration failed\n", | ||
6190 | dev->name); | ||
6191 | return -1; | ||
6192 | } | ||
6193 | } | ||
6194 | return 0; | ||
6195 | } | ||
6196 | static void s2io_rem_isr(nic_t * sp) | ||
6197 | { | ||
6198 | int cnt = 0; | ||
6199 | struct net_device *dev = sp->dev; | ||
6200 | |||
6201 | if (sp->intr_type == MSI_X) { | ||
6202 | int i; | ||
6203 | u16 msi_control; | ||
6204 | |||
6205 | for (i=1; (sp->s2io_entries[i].in_use == | ||
6206 | MSIX_REGISTERED_SUCCESS); i++) { | ||
6207 | int vector = sp->entries[i].vector; | ||
6208 | void *arg = sp->s2io_entries[i].arg; | ||
6209 | |||
6210 | free_irq(vector, arg); | ||
6211 | } | ||
6212 | pci_read_config_word(sp->pdev, 0x42, &msi_control); | ||
6213 | msi_control &= 0xFFFE; /* Disable MSI */ | ||
6214 | pci_write_config_word(sp->pdev, 0x42, msi_control); | ||
6215 | |||
6216 | pci_disable_msix(sp->pdev); | ||
6217 | } else { | ||
6218 | free_irq(sp->pdev->irq, dev); | ||
6219 | if (sp->intr_type == MSI) { | ||
6220 | u16 val; | ||
6221 | |||
6222 | pci_disable_msi(sp->pdev); | ||
6223 | pci_read_config_word(sp->pdev, 0x4c, &val); | ||
6224 | val ^= 0x1; | ||
6225 | pci_write_config_word(sp->pdev, 0x4c, val); | ||
6256 | } | 6226 | } |
6257 | } | 6227 | } |
6258 | /* Waiting till all Interrupt handlers are complete */ | 6228 | /* Waiting till all Interrupt handlers are complete */ |
@@ -6263,6 +6233,26 @@ static void s2io_card_down(nic_t * sp, int flag) | |||
6263 | break; | 6233 | break; |
6264 | cnt++; | 6234 | cnt++; |
6265 | } while(cnt < 5); | 6235 | } while(cnt < 5); |
6236 | } | ||
6237 | |||
6238 | static void s2io_card_down(nic_t * sp) | ||
6239 | { | ||
6240 | int cnt = 0; | ||
6241 | XENA_dev_config_t __iomem *bar0 = sp->bar0; | ||
6242 | unsigned long flags; | ||
6243 | register u64 val64 = 0; | ||
6244 | |||
6245 | del_timer_sync(&sp->alarm_timer); | ||
6246 | /* If s2io_set_link task is executing, wait till it completes. */ | ||
6247 | while (test_and_set_bit(0, &(sp->link_state))) { | ||
6248 | msleep(50); | ||
6249 | } | ||
6250 | atomic_set(&sp->card_state, CARD_DOWN); | ||
6251 | |||
6252 | /* disable Tx and Rx traffic on the NIC */ | ||
6253 | stop_nic(sp); | ||
6254 | |||
6255 | s2io_rem_isr(sp); | ||
6266 | 6256 | ||
6267 | /* Kill tasklet. */ | 6257 | /* Kill tasklet. */ |
6268 | tasklet_kill(&sp->task); | 6258 | tasklet_kill(&sp->task); |
@@ -6314,23 +6304,16 @@ static int s2io_card_up(nic_t * sp) | |||
6314 | mac_info_t *mac_control; | 6304 | mac_info_t *mac_control; |
6315 | struct config_param *config; | 6305 | struct config_param *config; |
6316 | struct net_device *dev = (struct net_device *) sp->dev; | 6306 | struct net_device *dev = (struct net_device *) sp->dev; |
6307 | u16 interruptible; | ||
6317 | 6308 | ||
6318 | /* Initialize the H/W I/O registers */ | 6309 | /* Initialize the H/W I/O registers */ |
6319 | if (init_nic(sp) != 0) { | 6310 | if (init_nic(sp) != 0) { |
6320 | DBG_PRINT(ERR_DBG, "%s: H/W initialization failed\n", | 6311 | DBG_PRINT(ERR_DBG, "%s: H/W initialization failed\n", |
6321 | dev->name); | 6312 | dev->name); |
6313 | s2io_reset(sp); | ||
6322 | return -ENODEV; | 6314 | return -ENODEV; |
6323 | } | 6315 | } |
6324 | 6316 | ||
6325 | if (sp->intr_type == MSI) | ||
6326 | ret = s2io_enable_msi(sp); | ||
6327 | else if (sp->intr_type == MSI_X) | ||
6328 | ret = s2io_enable_msi_x(sp); | ||
6329 | if (ret) { | ||
6330 | DBG_PRINT(ERR_DBG, "%s: Defaulting to INTA\n", dev->name); | ||
6331 | sp->intr_type = INTA; | ||
6332 | } | ||
6333 | |||
6334 | /* | 6317 | /* |
6335 | * Initializing the Rx buffers. For now we are considering only 1 | 6318 | * Initializing the Rx buffers. For now we are considering only 1 |
6336 | * Rx ring and initializing buffers into 30 Rx blocks | 6319 | * Rx ring and initializing buffers into 30 Rx blocks |
@@ -6361,21 +6344,39 @@ static int s2io_card_up(nic_t * sp) | |||
6361 | sp->lro_max_aggr_per_sess = lro_max_pkts; | 6344 | sp->lro_max_aggr_per_sess = lro_max_pkts; |
6362 | } | 6345 | } |
6363 | 6346 | ||
6364 | /* Enable tasklet for the device */ | ||
6365 | tasklet_init(&sp->task, s2io_tasklet, (unsigned long) dev); | ||
6366 | |||
6367 | /* Enable Rx Traffic and interrupts on the NIC */ | 6347 | /* Enable Rx Traffic and interrupts on the NIC */ |
6368 | if (start_nic(sp)) { | 6348 | if (start_nic(sp)) { |
6369 | DBG_PRINT(ERR_DBG, "%s: Starting NIC failed\n", dev->name); | 6349 | DBG_PRINT(ERR_DBG, "%s: Starting NIC failed\n", dev->name); |
6370 | tasklet_kill(&sp->task); | ||
6371 | s2io_reset(sp); | 6350 | s2io_reset(sp); |
6372 | free_irq(dev->irq, dev); | 6351 | free_rx_buffers(sp); |
6352 | return -ENODEV; | ||
6353 | } | ||
6354 | |||
6355 | /* Add interrupt service routine */ | ||
6356 | if (s2io_add_isr(sp) != 0) { | ||
6357 | if (sp->intr_type == MSI_X) | ||
6358 | s2io_rem_isr(sp); | ||
6359 | s2io_reset(sp); | ||
6373 | free_rx_buffers(sp); | 6360 | free_rx_buffers(sp); |
6374 | return -ENODEV; | 6361 | return -ENODEV; |
6375 | } | 6362 | } |
6376 | 6363 | ||
6377 | S2IO_TIMER_CONF(sp->alarm_timer, s2io_alarm_handle, sp, (HZ/2)); | 6364 | S2IO_TIMER_CONF(sp->alarm_timer, s2io_alarm_handle, sp, (HZ/2)); |
6378 | 6365 | ||
6366 | /* Enable tasklet for the device */ | ||
6367 | tasklet_init(&sp->task, s2io_tasklet, (unsigned long) dev); | ||
6368 | |||
6369 | /* Enable select interrupts */ | ||
6370 | if (sp->intr_type != INTA) | ||
6371 | en_dis_able_nic_intrs(sp, ENA_ALL_INTRS, DISABLE_INTRS); | ||
6372 | else { | ||
6373 | interruptible = TX_TRAFFIC_INTR | RX_TRAFFIC_INTR; | ||
6374 | interruptible |= TX_PIC_INTR | RX_PIC_INTR; | ||
6375 | interruptible |= TX_MAC_INTR | RX_MAC_INTR; | ||
6376 | en_dis_able_nic_intrs(sp, interruptible, ENABLE_INTRS); | ||
6377 | } | ||
6378 | |||
6379 | |||
6379 | atomic_set(&sp->card_state, CARD_UP); | 6380 | atomic_set(&sp->card_state, CARD_UP); |
6380 | return 0; | 6381 | return 0; |
6381 | } | 6382 | } |
@@ -6395,7 +6396,7 @@ static void s2io_restart_nic(unsigned long data) | |||
6395 | struct net_device *dev = (struct net_device *) data; | 6396 | struct net_device *dev = (struct net_device *) data; |
6396 | nic_t *sp = dev->priv; | 6397 | nic_t *sp = dev->priv; |
6397 | 6398 | ||
6398 | s2io_card_down(sp, 0); | 6399 | s2io_card_down(sp); |
6399 | if (s2io_card_up(sp)) { | 6400 | if (s2io_card_up(sp)) { |
6400 | DBG_PRINT(ERR_DBG, "%s: Device bring up failed\n", | 6401 | DBG_PRINT(ERR_DBG, "%s: Device bring up failed\n", |
6401 | dev->name); | 6402 | dev->name); |
diff --git a/drivers/net/s2io.h b/drivers/net/s2io.h index c43f52179708..217097bc22f1 100644 --- a/drivers/net/s2io.h +++ b/drivers/net/s2io.h | |||
@@ -829,8 +829,7 @@ struct s2io_nic { | |||
829 | #define MSIX_FLG 0xA5 | 829 | #define MSIX_FLG 0xA5 |
830 | struct msix_entry *entries; | 830 | struct msix_entry *entries; |
831 | struct s2io_msix_entry *s2io_entries; | 831 | struct s2io_msix_entry *s2io_entries; |
832 | char desc1[35]; | 832 | char desc[MAX_REQUESTED_MSI_X][25]; |
833 | char desc2[35]; | ||
834 | 833 | ||
835 | int avail_msix_vectors; /* No. of MSI-X vectors granted by system */ | 834 | int avail_msix_vectors; /* No. of MSI-X vectors granted by system */ |
836 | 835 | ||
@@ -1002,7 +1001,7 @@ static int verify_xena_quiescence(nic_t *sp, u64 val64, int flag); | |||
1002 | static struct ethtool_ops netdev_ethtool_ops; | 1001 | static struct ethtool_ops netdev_ethtool_ops; |
1003 | static void s2io_set_link(unsigned long data); | 1002 | static void s2io_set_link(unsigned long data); |
1004 | static int s2io_set_swapper(nic_t * sp); | 1003 | static int s2io_set_swapper(nic_t * sp); |
1005 | static void s2io_card_down(nic_t *nic, int flag); | 1004 | static void s2io_card_down(nic_t *nic); |
1006 | static int s2io_card_up(nic_t *nic); | 1005 | static int s2io_card_up(nic_t *nic); |
1007 | static int get_xena_rev_id(struct pci_dev *pdev); | 1006 | static int get_xena_rev_id(struct pci_dev *pdev); |
1008 | static void restore_xmsi_data(nic_t *nic); | 1007 | static void restore_xmsi_data(nic_t *nic); |
diff --git a/drivers/net/sk98lin/h/xmac_ii.h b/drivers/net/sk98lin/h/xmac_ii.h index 2b19f8ad0318..7f8e6d0084c7 100644 --- a/drivers/net/sk98lin/h/xmac_ii.h +++ b/drivers/net/sk98lin/h/xmac_ii.h | |||
@@ -1473,7 +1473,7 @@ extern "C" { | |||
1473 | #define GM_TXCR_FORCE_JAM (1<<15) /* Bit 15: Force Jam / Flow-Control */ | 1473 | #define GM_TXCR_FORCE_JAM (1<<15) /* Bit 15: Force Jam / Flow-Control */ |
1474 | #define GM_TXCR_CRC_DIS (1<<14) /* Bit 14: Disable insertion of CRC */ | 1474 | #define GM_TXCR_CRC_DIS (1<<14) /* Bit 14: Disable insertion of CRC */ |
1475 | #define GM_TXCR_PAD_DIS (1<<13) /* Bit 13: Disable padding of packets */ | 1475 | #define GM_TXCR_PAD_DIS (1<<13) /* Bit 13: Disable padding of packets */ |
1476 | #define GM_TXCR_COL_THR_MSK (1<<10) /* Bit 12..10: Collision Threshold */ | 1476 | #define GM_TXCR_COL_THR_MSK (7<<10) /* Bit 12..10: Collision Threshold */ |
1477 | 1477 | ||
1478 | #define TX_COL_THR(x) (SHIFT10(x) & GM_TXCR_COL_THR_MSK) | 1478 | #define TX_COL_THR(x) (SHIFT10(x) & GM_TXCR_COL_THR_MSK) |
1479 | 1479 | ||
diff --git a/drivers/net/skge.h b/drivers/net/skge.h index ed19ff47ce11..593387b3c0dd 100644 --- a/drivers/net/skge.h +++ b/drivers/net/skge.h | |||
@@ -1734,11 +1734,11 @@ enum { | |||
1734 | GM_TXCR_FORCE_JAM = 1<<15, /* Bit 15: Force Jam / Flow-Control */ | 1734 | GM_TXCR_FORCE_JAM = 1<<15, /* Bit 15: Force Jam / Flow-Control */ |
1735 | GM_TXCR_CRC_DIS = 1<<14, /* Bit 14: Disable insertion of CRC */ | 1735 | GM_TXCR_CRC_DIS = 1<<14, /* Bit 14: Disable insertion of CRC */ |
1736 | GM_TXCR_PAD_DIS = 1<<13, /* Bit 13: Disable padding of packets */ | 1736 | GM_TXCR_PAD_DIS = 1<<13, /* Bit 13: Disable padding of packets */ |
1737 | GM_TXCR_COL_THR_MSK = 1<<10, /* Bit 12..10: Collision Threshold */ | 1737 | GM_TXCR_COL_THR_MSK = 7<<10, /* Bit 12..10: Collision Threshold */ |
1738 | }; | 1738 | }; |
1739 | 1739 | ||
1740 | #define TX_COL_THR(x) (((x)<<10) & GM_TXCR_COL_THR_MSK) | 1740 | #define TX_COL_THR(x) (((x)<<10) & GM_TXCR_COL_THR_MSK) |
1741 | #define TX_COL_DEF 0x04 | 1741 | #define TX_COL_DEF 0x04 /* late collision after 64 byte */ |
1742 | 1742 | ||
1743 | /* GM_RX_CTRL 16 bit r/w Receive Control Register */ | 1743 | /* GM_RX_CTRL 16 bit r/w Receive Control Register */ |
1744 | enum { | 1744 | enum { |
diff --git a/drivers/net/sky2.c b/drivers/net/sky2.c index 418f169a6a31..d98f28c34e5c 100644 --- a/drivers/net/sky2.c +++ b/drivers/net/sky2.c | |||
@@ -65,6 +65,7 @@ | |||
65 | #define RX_MAX_PENDING (RX_LE_SIZE/2 - 2) | 65 | #define RX_MAX_PENDING (RX_LE_SIZE/2 - 2) |
66 | #define RX_DEF_PENDING RX_MAX_PENDING | 66 | #define RX_DEF_PENDING RX_MAX_PENDING |
67 | #define RX_SKB_ALIGN 8 | 67 | #define RX_SKB_ALIGN 8 |
68 | #define RX_BUF_WRITE 16 | ||
68 | 69 | ||
69 | #define TX_RING_SIZE 512 | 70 | #define TX_RING_SIZE 512 |
70 | #define TX_DEF_PENDING (TX_RING_SIZE - 1) | 71 | #define TX_DEF_PENDING (TX_RING_SIZE - 1) |
@@ -234,7 +235,6 @@ static void sky2_set_power_state(struct sky2_hw *hw, pci_power_t state) | |||
234 | } | 235 | } |
235 | 236 | ||
236 | if (hw->chip_id == CHIP_ID_YUKON_EC_U) { | 237 | if (hw->chip_id == CHIP_ID_YUKON_EC_U) { |
237 | sky2_write16(hw, B0_CTST, Y2_HW_WOL_ON); | ||
238 | sky2_pci_write32(hw, PCI_DEV_REG3, 0); | 238 | sky2_pci_write32(hw, PCI_DEV_REG3, 0); |
239 | reg1 = sky2_pci_read32(hw, PCI_DEV_REG4); | 239 | reg1 = sky2_pci_read32(hw, PCI_DEV_REG4); |
240 | reg1 &= P_ASPM_CONTROL_MSK; | 240 | reg1 &= P_ASPM_CONTROL_MSK; |
@@ -243,6 +243,7 @@ static void sky2_set_power_state(struct sky2_hw *hw, pci_power_t state) | |||
243 | } | 243 | } |
244 | 244 | ||
245 | sky2_pci_write32(hw, PCI_DEV_REG1, reg1); | 245 | sky2_pci_write32(hw, PCI_DEV_REG1, reg1); |
246 | udelay(100); | ||
246 | 247 | ||
247 | break; | 248 | break; |
248 | 249 | ||
@@ -255,6 +256,7 @@ static void sky2_set_power_state(struct sky2_hw *hw, pci_power_t state) | |||
255 | else | 256 | else |
256 | reg1 |= (PCI_Y2_PHY1_POWD | PCI_Y2_PHY2_POWD); | 257 | reg1 |= (PCI_Y2_PHY1_POWD | PCI_Y2_PHY2_POWD); |
257 | sky2_pci_write32(hw, PCI_DEV_REG1, reg1); | 258 | sky2_pci_write32(hw, PCI_DEV_REG1, reg1); |
259 | udelay(100); | ||
258 | 260 | ||
259 | if (hw->chip_id == CHIP_ID_YUKON_XL && hw->chip_rev > 1) | 261 | if (hw->chip_id == CHIP_ID_YUKON_XL && hw->chip_rev > 1) |
260 | sky2_write8(hw, B2_Y2_CLK_GATE, 0); | 262 | sky2_write8(hw, B2_Y2_CLK_GATE, 0); |
@@ -1159,7 +1161,7 @@ static unsigned tx_le_req(const struct sk_buff *skb) | |||
1159 | count = sizeof(dma_addr_t) / sizeof(u32); | 1161 | count = sizeof(dma_addr_t) / sizeof(u32); |
1160 | count += skb_shinfo(skb)->nr_frags * count; | 1162 | count += skb_shinfo(skb)->nr_frags * count; |
1161 | 1163 | ||
1162 | if (skb_shinfo(skb)->gso_size) | 1164 | if (skb_is_gso(skb)) |
1163 | ++count; | 1165 | ++count; |
1164 | 1166 | ||
1165 | if (skb->ip_summed == CHECKSUM_HW) | 1167 | if (skb->ip_summed == CHECKSUM_HW) |
@@ -1389,7 +1391,7 @@ static void sky2_tx_complete(struct sky2_port *sky2, u16 done) | |||
1389 | } | 1391 | } |
1390 | 1392 | ||
1391 | sky2->tx_cons = put; | 1393 | sky2->tx_cons = put; |
1392 | if (tx_avail(sky2) > MAX_SKB_TX_LE) | 1394 | if (tx_avail(sky2) > MAX_SKB_TX_LE + 4) |
1393 | netif_wake_queue(dev); | 1395 | netif_wake_queue(dev); |
1394 | } | 1396 | } |
1395 | 1397 | ||
@@ -1888,9 +1890,6 @@ resubmit: | |||
1888 | re->skb->ip_summed = CHECKSUM_NONE; | 1890 | re->skb->ip_summed = CHECKSUM_NONE; |
1889 | sky2_rx_add(sky2, re->mapaddr); | 1891 | sky2_rx_add(sky2, re->mapaddr); |
1890 | 1892 | ||
1891 | /* Tell receiver about new buffers. */ | ||
1892 | sky2_put_idx(sky2->hw, rxqaddr[sky2->port], sky2->rx_put); | ||
1893 | |||
1894 | return skb; | 1893 | return skb; |
1895 | 1894 | ||
1896 | oversize: | 1895 | oversize: |
@@ -1937,7 +1936,9 @@ static inline int sky2_more_work(const struct sky2_hw *hw) | |||
1937 | /* Process status response ring */ | 1936 | /* Process status response ring */ |
1938 | static int sky2_status_intr(struct sky2_hw *hw, int to_do) | 1937 | static int sky2_status_intr(struct sky2_hw *hw, int to_do) |
1939 | { | 1938 | { |
1939 | struct sky2_port *sky2; | ||
1940 | int work_done = 0; | 1940 | int work_done = 0; |
1941 | unsigned buf_write[2] = { 0, 0 }; | ||
1941 | u16 hwidx = sky2_read16(hw, STAT_PUT_IDX); | 1942 | u16 hwidx = sky2_read16(hw, STAT_PUT_IDX); |
1942 | 1943 | ||
1943 | rmb(); | 1944 | rmb(); |
@@ -1945,7 +1946,6 @@ static int sky2_status_intr(struct sky2_hw *hw, int to_do) | |||
1945 | while (hw->st_idx != hwidx) { | 1946 | while (hw->st_idx != hwidx) { |
1946 | struct sky2_status_le *le = hw->st_le + hw->st_idx; | 1947 | struct sky2_status_le *le = hw->st_le + hw->st_idx; |
1947 | struct net_device *dev; | 1948 | struct net_device *dev; |
1948 | struct sky2_port *sky2; | ||
1949 | struct sk_buff *skb; | 1949 | struct sk_buff *skb; |
1950 | u32 status; | 1950 | u32 status; |
1951 | u16 length; | 1951 | u16 length; |
@@ -1978,6 +1978,14 @@ static int sky2_status_intr(struct sky2_hw *hw, int to_do) | |||
1978 | #endif | 1978 | #endif |
1979 | netif_receive_skb(skb); | 1979 | netif_receive_skb(skb); |
1980 | 1980 | ||
1981 | /* Update receiver after 16 frames */ | ||
1982 | if (++buf_write[le->link] == RX_BUF_WRITE) { | ||
1983 | sky2_put_idx(hw, rxqaddr[le->link], | ||
1984 | sky2->rx_put); | ||
1985 | buf_write[le->link] = 0; | ||
1986 | } | ||
1987 | |||
1988 | /* Stop after net poll weight */ | ||
1981 | if (++work_done >= to_do) | 1989 | if (++work_done >= to_do) |
1982 | goto exit_loop; | 1990 | goto exit_loop; |
1983 | break; | 1991 | break; |
@@ -2016,6 +2024,16 @@ static int sky2_status_intr(struct sky2_hw *hw, int to_do) | |||
2016 | } | 2024 | } |
2017 | 2025 | ||
2018 | exit_loop: | 2026 | exit_loop: |
2027 | if (buf_write[0]) { | ||
2028 | sky2 = netdev_priv(hw->dev[0]); | ||
2029 | sky2_put_idx(hw, Q_R1, sky2->rx_put); | ||
2030 | } | ||
2031 | |||
2032 | if (buf_write[1]) { | ||
2033 | sky2 = netdev_priv(hw->dev[1]); | ||
2034 | sky2_put_idx(hw, Q_R2, sky2->rx_put); | ||
2035 | } | ||
2036 | |||
2019 | return work_done; | 2037 | return work_done; |
2020 | } | 2038 | } |
2021 | 2039 | ||
@@ -2286,7 +2304,7 @@ static inline u32 sky2_clk2us(const struct sky2_hw *hw, u32 clk) | |||
2286 | } | 2304 | } |
2287 | 2305 | ||
2288 | 2306 | ||
2289 | static int __devinit sky2_reset(struct sky2_hw *hw) | 2307 | static int sky2_reset(struct sky2_hw *hw) |
2290 | { | 2308 | { |
2291 | u16 status; | 2309 | u16 status; |
2292 | u8 t8, pmd_type; | 2310 | u8 t8, pmd_type; |
@@ -3437,17 +3455,14 @@ static int sky2_suspend(struct pci_dev *pdev, pm_message_t state) | |||
3437 | return -EINVAL; | 3455 | return -EINVAL; |
3438 | 3456 | ||
3439 | del_timer_sync(&hw->idle_timer); | 3457 | del_timer_sync(&hw->idle_timer); |
3458 | netif_poll_disable(hw->dev[0]); | ||
3440 | 3459 | ||
3441 | for (i = 0; i < hw->ports; i++) { | 3460 | for (i = 0; i < hw->ports; i++) { |
3442 | struct net_device *dev = hw->dev[i]; | 3461 | struct net_device *dev = hw->dev[i]; |
3443 | 3462 | ||
3444 | if (dev) { | 3463 | if (netif_running(dev)) { |
3445 | if (!netif_running(dev)) | ||
3446 | continue; | ||
3447 | |||
3448 | sky2_down(dev); | 3464 | sky2_down(dev); |
3449 | netif_device_detach(dev); | 3465 | netif_device_detach(dev); |
3450 | netif_poll_disable(dev); | ||
3451 | } | 3466 | } |
3452 | } | 3467 | } |
3453 | 3468 | ||
@@ -3474,9 +3489,8 @@ static int sky2_resume(struct pci_dev *pdev) | |||
3474 | 3489 | ||
3475 | for (i = 0; i < hw->ports; i++) { | 3490 | for (i = 0; i < hw->ports; i++) { |
3476 | struct net_device *dev = hw->dev[i]; | 3491 | struct net_device *dev = hw->dev[i]; |
3477 | if (dev && netif_running(dev)) { | 3492 | if (netif_running(dev)) { |
3478 | netif_device_attach(dev); | 3493 | netif_device_attach(dev); |
3479 | netif_poll_enable(dev); | ||
3480 | 3494 | ||
3481 | err = sky2_up(dev); | 3495 | err = sky2_up(dev); |
3482 | if (err) { | 3496 | if (err) { |
@@ -3488,6 +3502,7 @@ static int sky2_resume(struct pci_dev *pdev) | |||
3488 | } | 3502 | } |
3489 | } | 3503 | } |
3490 | 3504 | ||
3505 | netif_poll_enable(hw->dev[0]); | ||
3491 | sky2_idle_start(hw); | 3506 | sky2_idle_start(hw); |
3492 | out: | 3507 | out: |
3493 | return err; | 3508 | return err; |
diff --git a/drivers/net/sky2.h b/drivers/net/sky2.h index 8a0bc5525f0a..2db8d19b22d1 100644 --- a/drivers/net/sky2.h +++ b/drivers/net/sky2.h | |||
@@ -1480,7 +1480,7 @@ enum { | |||
1480 | GM_TXCR_FORCE_JAM = 1<<15, /* Bit 15: Force Jam / Flow-Control */ | 1480 | GM_TXCR_FORCE_JAM = 1<<15, /* Bit 15: Force Jam / Flow-Control */ |
1481 | GM_TXCR_CRC_DIS = 1<<14, /* Bit 14: Disable insertion of CRC */ | 1481 | GM_TXCR_CRC_DIS = 1<<14, /* Bit 14: Disable insertion of CRC */ |
1482 | GM_TXCR_PAD_DIS = 1<<13, /* Bit 13: Disable padding of packets */ | 1482 | GM_TXCR_PAD_DIS = 1<<13, /* Bit 13: Disable padding of packets */ |
1483 | GM_TXCR_COL_THR_MSK = 1<<10, /* Bit 12..10: Collision Threshold */ | 1483 | GM_TXCR_COL_THR_MSK = 7<<10, /* Bit 12..10: Collision Threshold */ |
1484 | }; | 1484 | }; |
1485 | 1485 | ||
1486 | #define TX_COL_THR(x) (((x)<<10) & GM_TXCR_COL_THR_MSK) | 1486 | #define TX_COL_THR(x) (((x)<<10) & GM_TXCR_COL_THR_MSK) |
diff --git a/drivers/net/smc91x.h b/drivers/net/smc91x.h index b4028049ed76..4ec4b4d23ae5 100644 --- a/drivers/net/smc91x.h +++ b/drivers/net/smc91x.h | |||
@@ -354,6 +354,24 @@ static inline void LPD7_SMC_outsw (unsigned char* a, int r, | |||
354 | 354 | ||
355 | #define SMC_IRQ_FLAGS (0) | 355 | #define SMC_IRQ_FLAGS (0) |
356 | 356 | ||
357 | #elif defined(CONFIG_ARCH_VERSATILE) | ||
358 | |||
359 | #define SMC_CAN_USE_8BIT 1 | ||
360 | #define SMC_CAN_USE_16BIT 1 | ||
361 | #define SMC_CAN_USE_32BIT 1 | ||
362 | #define SMC_NOWAIT 1 | ||
363 | |||
364 | #define SMC_inb(a, r) readb((a) + (r)) | ||
365 | #define SMC_inw(a, r) readw((a) + (r)) | ||
366 | #define SMC_inl(a, r) readl((a) + (r)) | ||
367 | #define SMC_outb(v, a, r) writeb(v, (a) + (r)) | ||
368 | #define SMC_outw(v, a, r) writew(v, (a) + (r)) | ||
369 | #define SMC_outl(v, a, r) writel(v, (a) + (r)) | ||
370 | #define SMC_insl(a, r, p, l) readsl((a) + (r), p, l) | ||
371 | #define SMC_outsl(a, r, p, l) writesl((a) + (r), p, l) | ||
372 | |||
373 | #define SMC_IRQ_FLAGS (0) | ||
374 | |||
357 | #else | 375 | #else |
358 | 376 | ||
359 | #define SMC_CAN_USE_8BIT 1 | 377 | #define SMC_CAN_USE_8BIT 1 |
diff --git a/drivers/net/tg3.c b/drivers/net/tg3.c index f645921aff8b..ce6f3be86da0 100644 --- a/drivers/net/tg3.c +++ b/drivers/net/tg3.c | |||
@@ -10078,6 +10078,8 @@ static int __devinit tg3_get_invariants(struct tg3 *tp) | |||
10078 | static struct pci_device_id write_reorder_chipsets[] = { | 10078 | static struct pci_device_id write_reorder_chipsets[] = { |
10079 | { PCI_DEVICE(PCI_VENDOR_ID_AMD, | 10079 | { PCI_DEVICE(PCI_VENDOR_ID_AMD, |
10080 | PCI_DEVICE_ID_AMD_FE_GATE_700C) }, | 10080 | PCI_DEVICE_ID_AMD_FE_GATE_700C) }, |
10081 | { PCI_DEVICE(PCI_VENDOR_ID_AMD, | ||
10082 | PCI_DEVICE_ID_AMD_8131_BRIDGE) }, | ||
10081 | { PCI_DEVICE(PCI_VENDOR_ID_VIA, | 10083 | { PCI_DEVICE(PCI_VENDOR_ID_VIA, |
10082 | PCI_DEVICE_ID_VIA_8385_0) }, | 10084 | PCI_DEVICE_ID_VIA_8385_0) }, |
10083 | { }, | 10085 | { }, |
diff --git a/drivers/net/typhoon.c b/drivers/net/typhoon.c index 063816f2b11e..4103c37172f9 100644 --- a/drivers/net/typhoon.c +++ b/drivers/net/typhoon.c | |||
@@ -805,7 +805,7 @@ typhoon_start_tx(struct sk_buff *skb, struct net_device *dev) | |||
805 | * If problems develop with TSO, check this first. | 805 | * If problems develop with TSO, check this first. |
806 | */ | 806 | */ |
807 | numDesc = skb_shinfo(skb)->nr_frags + 1; | 807 | numDesc = skb_shinfo(skb)->nr_frags + 1; |
808 | if(skb_tso_size(skb)) | 808 | if (skb_is_gso(skb)) |
809 | numDesc++; | 809 | numDesc++; |
810 | 810 | ||
811 | /* When checking for free space in the ring, we need to also | 811 | /* When checking for free space in the ring, we need to also |
@@ -845,7 +845,7 @@ typhoon_start_tx(struct sk_buff *skb, struct net_device *dev) | |||
845 | TYPHOON_TX_PF_VLAN_TAG_SHIFT); | 845 | TYPHOON_TX_PF_VLAN_TAG_SHIFT); |
846 | } | 846 | } |
847 | 847 | ||
848 | if(skb_tso_size(skb)) { | 848 | if (skb_is_gso(skb)) { |
849 | first_txd->processFlags |= TYPHOON_TX_PF_TCP_SEGMENT; | 849 | first_txd->processFlags |= TYPHOON_TX_PF_TCP_SEGMENT; |
850 | first_txd->numDesc++; | 850 | first_txd->numDesc++; |
851 | 851 | ||
diff --git a/drivers/net/wan/c101.c b/drivers/net/wan/c101.c index c92ac9fde083..2c09ec908a3f 100644 --- a/drivers/net/wan/c101.c +++ b/drivers/net/wan/c101.c | |||
@@ -116,27 +116,33 @@ static inline void openwin(card_t *card, u8 page) | |||
116 | #include "hd6457x.c" | 116 | #include "hd6457x.c" |
117 | 117 | ||
118 | 118 | ||
119 | static inline void set_carrier(port_t *port) | ||
120 | { | ||
121 | if (!sca_in(MSCI1_OFFSET + ST3, port) & ST3_DCD) | ||
122 | netif_carrier_on(port_to_dev(port)); | ||
123 | else | ||
124 | netif_carrier_off(port_to_dev(port)); | ||
125 | } | ||
126 | |||
127 | |||
119 | static void sca_msci_intr(port_t *port) | 128 | static void sca_msci_intr(port_t *port) |
120 | { | 129 | { |
121 | struct net_device *dev = port_to_dev(port); | 130 | u8 stat = sca_in(MSCI1_OFFSET + ST1, port); /* read MSCI ST1 status */ |
122 | card_t* card = port_to_card(port); | ||
123 | u8 stat = sca_in(MSCI1_OFFSET + ST1, card); /* read MSCI ST1 status */ | ||
124 | 131 | ||
125 | /* Reset MSCI TX underrun status bit */ | 132 | /* Reset MSCI TX underrun status bit */ |
126 | sca_out(stat & ST1_UDRN, MSCI0_OFFSET + ST1, card); | 133 | sca_out(stat & ST1_UDRN, MSCI0_OFFSET + ST1, port); |
127 | 134 | ||
128 | if (stat & ST1_UDRN) { | 135 | if (stat & ST1_UDRN) { |
129 | struct net_device_stats *stats = hdlc_stats(dev); | 136 | struct net_device_stats *stats = hdlc_stats(port_to_dev(port)); |
130 | stats->tx_errors++; /* TX Underrun error detected */ | 137 | stats->tx_errors++; /* TX Underrun error detected */ |
131 | stats->tx_fifo_errors++; | 138 | stats->tx_fifo_errors++; |
132 | } | 139 | } |
133 | 140 | ||
134 | /* Reset MSCI CDCD status bit - uses ch#2 DCD input */ | 141 | /* Reset MSCI CDCD status bit - uses ch#2 DCD input */ |
135 | sca_out(stat & ST1_CDCD, MSCI1_OFFSET + ST1, card); | 142 | sca_out(stat & ST1_CDCD, MSCI1_OFFSET + ST1, port); |
136 | 143 | ||
137 | if (stat & ST1_CDCD) | 144 | if (stat & ST1_CDCD) |
138 | hdlc_set_carrier(!(sca_in(MSCI1_OFFSET + ST3, card) & ST3_DCD), | 145 | set_carrier(port); |
139 | dev); | ||
140 | } | 146 | } |
141 | 147 | ||
142 | 148 | ||
@@ -190,7 +196,7 @@ static int c101_open(struct net_device *dev) | |||
190 | sca_out(IE1_UDRN, MSCI0_OFFSET + IE1, port); | 196 | sca_out(IE1_UDRN, MSCI0_OFFSET + IE1, port); |
191 | sca_out(IE0_TXINT, MSCI0_OFFSET + IE0, port); | 197 | sca_out(IE0_TXINT, MSCI0_OFFSET + IE0, port); |
192 | 198 | ||
193 | hdlc_set_carrier(!(sca_in(MSCI1_OFFSET + ST3, port) & ST3_DCD), dev); | 199 | set_carrier(port); |
194 | printk(KERN_DEBUG "0x%X\n", sca_in(MSCI1_OFFSET + ST3, port)); | 200 | printk(KERN_DEBUG "0x%X\n", sca_in(MSCI1_OFFSET + ST3, port)); |
195 | 201 | ||
196 | /* enable MSCI1 CDCD interrupt */ | 202 | /* enable MSCI1 CDCD interrupt */ |
@@ -378,7 +384,7 @@ static int __init c101_run(unsigned long irq, unsigned long winbase) | |||
378 | } | 384 | } |
379 | 385 | ||
380 | sca_init_sync_port(card); /* Set up C101 memory */ | 386 | sca_init_sync_port(card); /* Set up C101 memory */ |
381 | hdlc_set_carrier(!(sca_in(MSCI1_OFFSET + ST3, card) & ST3_DCD), dev); | 387 | set_carrier(card); |
382 | 388 | ||
383 | printk(KERN_INFO "%s: Moxa C101 on IRQ%u," | 389 | printk(KERN_INFO "%s: Moxa C101 on IRQ%u," |
384 | " using %u TX + %u RX packets rings\n", | 390 | " using %u TX + %u RX packets rings\n", |
diff --git a/drivers/net/wan/hd6457x.c b/drivers/net/wan/hd6457x.c index d3743321a977..dce2bb317b82 100644 --- a/drivers/net/wan/hd6457x.c +++ b/drivers/net/wan/hd6457x.c | |||
@@ -168,6 +168,23 @@ static inline u32 buffer_offset(port_t *port, u16 desc, int transmit) | |||
168 | } | 168 | } |
169 | 169 | ||
170 | 170 | ||
171 | static inline void sca_set_carrier(port_t *port) | ||
172 | { | ||
173 | if (!(sca_in(get_msci(port) + ST3, port_to_card(port)) & ST3_DCD)) { | ||
174 | #ifdef DEBUG_LINK | ||
175 | printk(KERN_DEBUG "%s: sca_set_carrier on\n", | ||
176 | port_to_dev(port)->name); | ||
177 | #endif | ||
178 | netif_carrier_on(port_to_dev(port)); | ||
179 | } else { | ||
180 | #ifdef DEBUG_LINK | ||
181 | printk(KERN_DEBUG "%s: sca_set_carrier off\n", | ||
182 | port_to_dev(port)->name); | ||
183 | #endif | ||
184 | netif_carrier_off(port_to_dev(port)); | ||
185 | } | ||
186 | } | ||
187 | |||
171 | 188 | ||
172 | static void sca_init_sync_port(port_t *port) | 189 | static void sca_init_sync_port(port_t *port) |
173 | { | 190 | { |
@@ -237,9 +254,7 @@ static void sca_init_sync_port(port_t *port) | |||
237 | sca_out(DIR_BOFE, DIR_TX(phy_node(port)), card); | 254 | sca_out(DIR_BOFE, DIR_TX(phy_node(port)), card); |
238 | } | 255 | } |
239 | } | 256 | } |
240 | 257 | sca_set_carrier(port); | |
241 | hdlc_set_carrier(!(sca_in(get_msci(port) + ST3, card) & ST3_DCD), | ||
242 | port_to_dev(port)); | ||
243 | } | 258 | } |
244 | 259 | ||
245 | 260 | ||
@@ -262,8 +277,7 @@ static inline void sca_msci_intr(port_t *port) | |||
262 | } | 277 | } |
263 | 278 | ||
264 | if (stat & ST1_CDCD) | 279 | if (stat & ST1_CDCD) |
265 | hdlc_set_carrier(!(sca_in(msci + ST3, card) & ST3_DCD), | 280 | sca_set_carrier(port); |
266 | port_to_dev(port)); | ||
267 | } | 281 | } |
268 | #endif | 282 | #endif |
269 | 283 | ||
@@ -566,7 +580,7 @@ static void sca_open(struct net_device *dev) | |||
566 | - all DMA interrupts | 580 | - all DMA interrupts |
567 | */ | 581 | */ |
568 | 582 | ||
569 | hdlc_set_carrier(!(sca_in(msci + ST3, card) & ST3_DCD), dev); | 583 | sca_set_carrier(port); |
570 | 584 | ||
571 | #ifdef __HD64570_H | 585 | #ifdef __HD64570_H |
572 | /* MSCI TX INT and RX INT A IRQ enable */ | 586 | /* MSCI TX INT and RX INT A IRQ enable */ |
diff --git a/drivers/net/wan/hdlc_cisco.c b/drivers/net/wan/hdlc_cisco.c index 1fd04662c4fc..f289daba0c7b 100644 --- a/drivers/net/wan/hdlc_cisco.c +++ b/drivers/net/wan/hdlc_cisco.c | |||
@@ -192,9 +192,7 @@ static int cisco_rx(struct sk_buff *skb) | |||
192 | "uptime %ud%uh%um%us)\n", | 192 | "uptime %ud%uh%um%us)\n", |
193 | dev->name, days, hrs, | 193 | dev->name, days, hrs, |
194 | min, sec); | 194 | min, sec); |
195 | #if 0 | 195 | netif_dormant_off(dev); |
196 | netif_carrier_on(dev); | ||
197 | #endif | ||
198 | hdlc->state.cisco.up = 1; | 196 | hdlc->state.cisco.up = 1; |
199 | } | 197 | } |
200 | } | 198 | } |
@@ -227,9 +225,7 @@ static void cisco_timer(unsigned long arg) | |||
227 | hdlc->state.cisco.settings.timeout * HZ)) { | 225 | hdlc->state.cisco.settings.timeout * HZ)) { |
228 | hdlc->state.cisco.up = 0; | 226 | hdlc->state.cisco.up = 0; |
229 | printk(KERN_INFO "%s: Link down\n", dev->name); | 227 | printk(KERN_INFO "%s: Link down\n", dev->name); |
230 | #if 0 | 228 | netif_dormant_on(dev); |
231 | netif_carrier_off(dev); | ||
232 | #endif | ||
233 | } | 229 | } |
234 | 230 | ||
235 | cisco_keepalive_send(dev, CISCO_KEEPALIVE_REQ, | 231 | cisco_keepalive_send(dev, CISCO_KEEPALIVE_REQ, |
@@ -265,10 +261,7 @@ static void cisco_stop(struct net_device *dev) | |||
265 | { | 261 | { |
266 | hdlc_device *hdlc = dev_to_hdlc(dev); | 262 | hdlc_device *hdlc = dev_to_hdlc(dev); |
267 | del_timer_sync(&hdlc->state.cisco.timer); | 263 | del_timer_sync(&hdlc->state.cisco.timer); |
268 | #if 0 | 264 | netif_dormant_on(dev); |
269 | if (netif_carrier_ok(dev)) | ||
270 | netif_carrier_off(dev); | ||
271 | #endif | ||
272 | hdlc->state.cisco.up = 0; | 265 | hdlc->state.cisco.up = 0; |
273 | hdlc->state.cisco.request_sent = 0; | 266 | hdlc->state.cisco.request_sent = 0; |
274 | } | 267 | } |
@@ -328,6 +321,7 @@ int hdlc_cisco_ioctl(struct net_device *dev, struct ifreq *ifr) | |||
328 | dev->type = ARPHRD_CISCO; | 321 | dev->type = ARPHRD_CISCO; |
329 | dev->flags = IFF_POINTOPOINT | IFF_NOARP; | 322 | dev->flags = IFF_POINTOPOINT | IFF_NOARP; |
330 | dev->addr_len = 0; | 323 | dev->addr_len = 0; |
324 | netif_dormant_on(dev); | ||
331 | return 0; | 325 | return 0; |
332 | } | 326 | } |
333 | 327 | ||
diff --git a/drivers/net/wan/hdlc_fr.c b/drivers/net/wan/hdlc_fr.c index 523afe17564e..7bb737bbdeb9 100644 --- a/drivers/net/wan/hdlc_fr.c +++ b/drivers/net/wan/hdlc_fr.c | |||
@@ -301,7 +301,7 @@ static int pvc_open(struct net_device *dev) | |||
301 | if (pvc->open_count++ == 0) { | 301 | if (pvc->open_count++ == 0) { |
302 | hdlc_device *hdlc = dev_to_hdlc(pvc->master); | 302 | hdlc_device *hdlc = dev_to_hdlc(pvc->master); |
303 | if (hdlc->state.fr.settings.lmi == LMI_NONE) | 303 | if (hdlc->state.fr.settings.lmi == LMI_NONE) |
304 | pvc->state.active = hdlc->carrier; | 304 | pvc->state.active = netif_carrier_ok(pvc->master); |
305 | 305 | ||
306 | pvc_carrier(pvc->state.active, pvc); | 306 | pvc_carrier(pvc->state.active, pvc); |
307 | hdlc->state.fr.dce_changed = 1; | 307 | hdlc->state.fr.dce_changed = 1; |
@@ -545,11 +545,7 @@ static void fr_set_link_state(int reliable, struct net_device *dev) | |||
545 | 545 | ||
546 | hdlc->state.fr.reliable = reliable; | 546 | hdlc->state.fr.reliable = reliable; |
547 | if (reliable) { | 547 | if (reliable) { |
548 | #if 0 | 548 | netif_dormant_off(dev); |
549 | if (!netif_carrier_ok(dev)) | ||
550 | netif_carrier_on(dev); | ||
551 | #endif | ||
552 | |||
553 | hdlc->state.fr.n391cnt = 0; /* Request full status */ | 549 | hdlc->state.fr.n391cnt = 0; /* Request full status */ |
554 | hdlc->state.fr.dce_changed = 1; | 550 | hdlc->state.fr.dce_changed = 1; |
555 | 551 | ||
@@ -562,11 +558,7 @@ static void fr_set_link_state(int reliable, struct net_device *dev) | |||
562 | } | 558 | } |
563 | } | 559 | } |
564 | } else { | 560 | } else { |
565 | #if 0 | 561 | netif_dormant_on(dev); |
566 | if (netif_carrier_ok(dev)) | ||
567 | netif_carrier_off(dev); | ||
568 | #endif | ||
569 | |||
570 | while (pvc) { /* Deactivate all PVCs */ | 562 | while (pvc) { /* Deactivate all PVCs */ |
571 | pvc_carrier(0, pvc); | 563 | pvc_carrier(0, pvc); |
572 | pvc->state.exist = pvc->state.active = 0; | 564 | pvc->state.exist = pvc->state.active = 0; |
diff --git a/drivers/net/wan/hdlc_generic.c b/drivers/net/wan/hdlc_generic.c index b7da55140fbd..04ca1f7b6424 100644 --- a/drivers/net/wan/hdlc_generic.c +++ b/drivers/net/wan/hdlc_generic.c | |||
@@ -34,10 +34,11 @@ | |||
34 | #include <linux/inetdevice.h> | 34 | #include <linux/inetdevice.h> |
35 | #include <linux/lapb.h> | 35 | #include <linux/lapb.h> |
36 | #include <linux/rtnetlink.h> | 36 | #include <linux/rtnetlink.h> |
37 | #include <linux/notifier.h> | ||
37 | #include <linux/hdlc.h> | 38 | #include <linux/hdlc.h> |
38 | 39 | ||
39 | 40 | ||
40 | static const char* version = "HDLC support module revision 1.18"; | 41 | static const char* version = "HDLC support module revision 1.19"; |
41 | 42 | ||
42 | #undef DEBUG_LINK | 43 | #undef DEBUG_LINK |
43 | 44 | ||
@@ -73,57 +74,51 @@ static int hdlc_rcv(struct sk_buff *skb, struct net_device *dev, | |||
73 | 74 | ||
74 | 75 | ||
75 | 76 | ||
76 | static void __hdlc_set_carrier_on(struct net_device *dev) | 77 | static inline void hdlc_proto_start(struct net_device *dev) |
77 | { | 78 | { |
78 | hdlc_device *hdlc = dev_to_hdlc(dev); | 79 | hdlc_device *hdlc = dev_to_hdlc(dev); |
79 | if (hdlc->proto.start) | 80 | if (hdlc->proto.start) |
80 | return hdlc->proto.start(dev); | 81 | return hdlc->proto.start(dev); |
81 | #if 0 | ||
82 | #ifdef DEBUG_LINK | ||
83 | if (netif_carrier_ok(dev)) | ||
84 | printk(KERN_ERR "hdlc_set_carrier_on(): already on\n"); | ||
85 | #endif | ||
86 | netif_carrier_on(dev); | ||
87 | #endif | ||
88 | } | 82 | } |
89 | 83 | ||
90 | 84 | ||
91 | 85 | ||
92 | static void __hdlc_set_carrier_off(struct net_device *dev) | 86 | static inline void hdlc_proto_stop(struct net_device *dev) |
93 | { | 87 | { |
94 | hdlc_device *hdlc = dev_to_hdlc(dev); | 88 | hdlc_device *hdlc = dev_to_hdlc(dev); |
95 | if (hdlc->proto.stop) | 89 | if (hdlc->proto.stop) |
96 | return hdlc->proto.stop(dev); | 90 | return hdlc->proto.stop(dev); |
97 | |||
98 | #if 0 | ||
99 | #ifdef DEBUG_LINK | ||
100 | if (!netif_carrier_ok(dev)) | ||
101 | printk(KERN_ERR "hdlc_set_carrier_off(): already off\n"); | ||
102 | #endif | ||
103 | netif_carrier_off(dev); | ||
104 | #endif | ||
105 | } | 91 | } |
106 | 92 | ||
107 | 93 | ||
108 | 94 | ||
109 | void hdlc_set_carrier(int on, struct net_device *dev) | 95 | static int hdlc_device_event(struct notifier_block *this, unsigned long event, |
96 | void *ptr) | ||
110 | { | 97 | { |
111 | hdlc_device *hdlc = dev_to_hdlc(dev); | 98 | struct net_device *dev = ptr; |
99 | hdlc_device *hdlc; | ||
112 | unsigned long flags; | 100 | unsigned long flags; |
113 | on = on ? 1 : 0; | 101 | int on; |
102 | |||
103 | if (dev->get_stats != hdlc_get_stats) | ||
104 | return NOTIFY_DONE; /* not an HDLC device */ | ||
105 | |||
106 | if (event != NETDEV_CHANGE) | ||
107 | return NOTIFY_DONE; /* Only interrested in carrier changes */ | ||
108 | |||
109 | on = netif_carrier_ok(dev); | ||
114 | 110 | ||
115 | #ifdef DEBUG_LINK | 111 | #ifdef DEBUG_LINK |
116 | printk(KERN_DEBUG "hdlc_set_carrier %i\n", on); | 112 | printk(KERN_DEBUG "%s: hdlc_device_event NETDEV_CHANGE, carrier %i\n", |
113 | dev->name, on); | ||
117 | #endif | 114 | #endif |
118 | 115 | ||
116 | hdlc = dev_to_hdlc(dev); | ||
119 | spin_lock_irqsave(&hdlc->state_lock, flags); | 117 | spin_lock_irqsave(&hdlc->state_lock, flags); |
120 | 118 | ||
121 | if (hdlc->carrier == on) | 119 | if (hdlc->carrier == on) |
122 | goto carrier_exit; /* no change in DCD line level */ | 120 | goto carrier_exit; /* no change in DCD line level */ |
123 | 121 | ||
124 | #ifdef DEBUG_LINK | ||
125 | printk(KERN_INFO "%s: carrier %s\n", dev->name, on ? "ON" : "off"); | ||
126 | #endif | ||
127 | hdlc->carrier = on; | 122 | hdlc->carrier = on; |
128 | 123 | ||
129 | if (!hdlc->open) | 124 | if (!hdlc->open) |
@@ -131,14 +126,15 @@ void hdlc_set_carrier(int on, struct net_device *dev) | |||
131 | 126 | ||
132 | if (hdlc->carrier) { | 127 | if (hdlc->carrier) { |
133 | printk(KERN_INFO "%s: Carrier detected\n", dev->name); | 128 | printk(KERN_INFO "%s: Carrier detected\n", dev->name); |
134 | __hdlc_set_carrier_on(dev); | 129 | hdlc_proto_start(dev); |
135 | } else { | 130 | } else { |
136 | printk(KERN_INFO "%s: Carrier lost\n", dev->name); | 131 | printk(KERN_INFO "%s: Carrier lost\n", dev->name); |
137 | __hdlc_set_carrier_off(dev); | 132 | hdlc_proto_stop(dev); |
138 | } | 133 | } |
139 | 134 | ||
140 | carrier_exit: | 135 | carrier_exit: |
141 | spin_unlock_irqrestore(&hdlc->state_lock, flags); | 136 | spin_unlock_irqrestore(&hdlc->state_lock, flags); |
137 | return NOTIFY_DONE; | ||
142 | } | 138 | } |
143 | 139 | ||
144 | 140 | ||
@@ -165,7 +161,7 @@ int hdlc_open(struct net_device *dev) | |||
165 | 161 | ||
166 | if (hdlc->carrier) { | 162 | if (hdlc->carrier) { |
167 | printk(KERN_INFO "%s: Carrier detected\n", dev->name); | 163 | printk(KERN_INFO "%s: Carrier detected\n", dev->name); |
168 | __hdlc_set_carrier_on(dev); | 164 | hdlc_proto_start(dev); |
169 | } else | 165 | } else |
170 | printk(KERN_INFO "%s: No carrier\n", dev->name); | 166 | printk(KERN_INFO "%s: No carrier\n", dev->name); |
171 | 167 | ||
@@ -190,7 +186,7 @@ void hdlc_close(struct net_device *dev) | |||
190 | 186 | ||
191 | hdlc->open = 0; | 187 | hdlc->open = 0; |
192 | if (hdlc->carrier) | 188 | if (hdlc->carrier) |
193 | __hdlc_set_carrier_off(dev); | 189 | hdlc_proto_stop(dev); |
194 | 190 | ||
195 | spin_unlock_irq(&hdlc->state_lock); | 191 | spin_unlock_irq(&hdlc->state_lock); |
196 | 192 | ||
@@ -303,7 +299,6 @@ MODULE_LICENSE("GPL v2"); | |||
303 | 299 | ||
304 | EXPORT_SYMBOL(hdlc_open); | 300 | EXPORT_SYMBOL(hdlc_open); |
305 | EXPORT_SYMBOL(hdlc_close); | 301 | EXPORT_SYMBOL(hdlc_close); |
306 | EXPORT_SYMBOL(hdlc_set_carrier); | ||
307 | EXPORT_SYMBOL(hdlc_ioctl); | 302 | EXPORT_SYMBOL(hdlc_ioctl); |
308 | EXPORT_SYMBOL(hdlc_setup); | 303 | EXPORT_SYMBOL(hdlc_setup); |
309 | EXPORT_SYMBOL(alloc_hdlcdev); | 304 | EXPORT_SYMBOL(alloc_hdlcdev); |
@@ -315,9 +310,18 @@ static struct packet_type hdlc_packet_type = { | |||
315 | }; | 310 | }; |
316 | 311 | ||
317 | 312 | ||
313 | static struct notifier_block hdlc_notifier = { | ||
314 | .notifier_call = hdlc_device_event, | ||
315 | }; | ||
316 | |||
317 | |||
318 | static int __init hdlc_module_init(void) | 318 | static int __init hdlc_module_init(void) |
319 | { | 319 | { |
320 | int result; | ||
321 | |||
320 | printk(KERN_INFO "%s\n", version); | 322 | printk(KERN_INFO "%s\n", version); |
323 | if ((result = register_netdevice_notifier(&hdlc_notifier)) != 0) | ||
324 | return result; | ||
321 | dev_add_pack(&hdlc_packet_type); | 325 | dev_add_pack(&hdlc_packet_type); |
322 | return 0; | 326 | return 0; |
323 | } | 327 | } |
@@ -327,6 +331,7 @@ static int __init hdlc_module_init(void) | |||
327 | static void __exit hdlc_module_exit(void) | 331 | static void __exit hdlc_module_exit(void) |
328 | { | 332 | { |
329 | dev_remove_pack(&hdlc_packet_type); | 333 | dev_remove_pack(&hdlc_packet_type); |
334 | unregister_netdevice_notifier(&hdlc_notifier); | ||
330 | } | 335 | } |
331 | 336 | ||
332 | 337 | ||
diff --git a/drivers/net/wan/wanxl.c b/drivers/net/wan/wanxl.c index d564224cdca9..b2031dfc4bb1 100644 --- a/drivers/net/wan/wanxl.c +++ b/drivers/net/wan/wanxl.c | |||
@@ -149,7 +149,10 @@ static inline void wanxl_cable_intr(port_t *port) | |||
149 | printk(KERN_INFO "%s: %s%s module, %s cable%s%s\n", | 149 | printk(KERN_INFO "%s: %s%s module, %s cable%s%s\n", |
150 | port->dev->name, pm, dte, cable, dsr, dcd); | 150 | port->dev->name, pm, dte, cable, dsr, dcd); |
151 | 151 | ||
152 | hdlc_set_carrier(value & STATUS_CABLE_DCD, port->dev); | 152 | if (value & STATUS_CABLE_DCD) |
153 | netif_carrier_on(port->dev); | ||
154 | else | ||
155 | netif_carrier_off(port->dev); | ||
153 | } | 156 | } |
154 | 157 | ||
155 | 158 | ||
diff --git a/drivers/net/wireless/bcm43xx/bcm43xx_main.c b/drivers/net/wireless/bcm43xx/bcm43xx_main.c index e1c5a939bca4..3889f79e7128 100644 --- a/drivers/net/wireless/bcm43xx/bcm43xx_main.c +++ b/drivers/net/wireless/bcm43xx/bcm43xx_main.c | |||
@@ -1547,7 +1547,7 @@ static void handle_irq_noise(struct bcm43xx_private *bcm) | |||
1547 | goto generate_new; | 1547 | goto generate_new; |
1548 | 1548 | ||
1549 | /* Get the noise samples. */ | 1549 | /* Get the noise samples. */ |
1550 | assert(bcm->noisecalc.nr_samples <= 8); | 1550 | assert(bcm->noisecalc.nr_samples < 8); |
1551 | i = bcm->noisecalc.nr_samples; | 1551 | i = bcm->noisecalc.nr_samples; |
1552 | noise[0] = limit_value(noise[0], 0, ARRAY_SIZE(radio->nrssi_lt) - 1); | 1552 | noise[0] = limit_value(noise[0], 0, ARRAY_SIZE(radio->nrssi_lt) - 1); |
1553 | noise[1] = limit_value(noise[1], 0, ARRAY_SIZE(radio->nrssi_lt) - 1); | 1553 | noise[1] = limit_value(noise[1], 0, ARRAY_SIZE(radio->nrssi_lt) - 1); |
diff --git a/drivers/net/wireless/spectrum_cs.c b/drivers/net/wireless/spectrum_cs.c index 15465278c789..7f78b7801fb3 100644 --- a/drivers/net/wireless/spectrum_cs.c +++ b/drivers/net/wireless/spectrum_cs.c | |||
@@ -34,8 +34,6 @@ | |||
34 | 34 | ||
35 | #include "orinoco.h" | 35 | #include "orinoco.h" |
36 | 36 | ||
37 | static unsigned char *primsym; | ||
38 | static unsigned char *secsym; | ||
39 | static const char primary_fw_name[] = "symbol_sp24t_prim_fw"; | 37 | static const char primary_fw_name[] = "symbol_sp24t_prim_fw"; |
40 | static const char secondary_fw_name[] = "symbol_sp24t_sec_fw"; | 38 | static const char secondary_fw_name[] = "symbol_sp24t_sec_fw"; |
41 | 39 | ||
@@ -440,7 +438,7 @@ spectrum_load_blocks(hermes_t *hw, const struct dblock *first_block) | |||
440 | */ | 438 | */ |
441 | static int | 439 | static int |
442 | spectrum_dl_image(hermes_t *hw, struct pcmcia_device *link, | 440 | spectrum_dl_image(hermes_t *hw, struct pcmcia_device *link, |
443 | const unsigned char *image) | 441 | const unsigned char *image, int secondary) |
444 | { | 442 | { |
445 | int ret; | 443 | int ret; |
446 | const unsigned char *ptr; | 444 | const unsigned char *ptr; |
@@ -455,7 +453,7 @@ spectrum_dl_image(hermes_t *hw, struct pcmcia_device *link, | |||
455 | first_block = (const struct dblock *) ptr; | 453 | first_block = (const struct dblock *) ptr; |
456 | 454 | ||
457 | /* Read the PDA */ | 455 | /* Read the PDA */ |
458 | if (image != primsym) { | 456 | if (secondary) { |
459 | ret = spectrum_read_pda(hw, pda, sizeof(pda)); | 457 | ret = spectrum_read_pda(hw, pda, sizeof(pda)); |
460 | if (ret) | 458 | if (ret) |
461 | return ret; | 459 | return ret; |
@@ -472,7 +470,7 @@ spectrum_dl_image(hermes_t *hw, struct pcmcia_device *link, | |||
472 | return ret; | 470 | return ret; |
473 | 471 | ||
474 | /* Write the PDA to the adapter */ | 472 | /* Write the PDA to the adapter */ |
475 | if (image != primsym) { | 473 | if (secondary) { |
476 | ret = spectrum_apply_pda(hw, first_block, pda); | 474 | ret = spectrum_apply_pda(hw, first_block, pda); |
477 | if (ret) | 475 | if (ret) |
478 | return ret; | 476 | return ret; |
@@ -487,7 +485,7 @@ spectrum_dl_image(hermes_t *hw, struct pcmcia_device *link, | |||
487 | ret = hermes_init(hw); | 485 | ret = hermes_init(hw); |
488 | 486 | ||
489 | /* hermes_reset() should return 0 with the secondary firmware */ | 487 | /* hermes_reset() should return 0 with the secondary firmware */ |
490 | if (image != primsym && ret != 0) | 488 | if (secondary && ret != 0) |
491 | return -ENODEV; | 489 | return -ENODEV; |
492 | 490 | ||
493 | /* And this should work with any firmware */ | 491 | /* And this should work with any firmware */ |
@@ -509,33 +507,30 @@ spectrum_dl_firmware(hermes_t *hw, struct pcmcia_device *link) | |||
509 | const struct firmware *fw_entry; | 507 | const struct firmware *fw_entry; |
510 | 508 | ||
511 | if (request_firmware(&fw_entry, primary_fw_name, | 509 | if (request_firmware(&fw_entry, primary_fw_name, |
512 | &handle_to_dev(link)) == 0) { | 510 | &handle_to_dev(link)) != 0) { |
513 | primsym = fw_entry->data; | ||
514 | } else { | ||
515 | printk(KERN_ERR PFX "Cannot find firmware: %s\n", | 511 | printk(KERN_ERR PFX "Cannot find firmware: %s\n", |
516 | primary_fw_name); | 512 | primary_fw_name); |
517 | return -ENOENT; | 513 | return -ENOENT; |
518 | } | 514 | } |
519 | 515 | ||
520 | if (request_firmware(&fw_entry, secondary_fw_name, | ||
521 | &handle_to_dev(link)) == 0) { | ||
522 | secsym = fw_entry->data; | ||
523 | } else { | ||
524 | printk(KERN_ERR PFX "Cannot find firmware: %s\n", | ||
525 | secondary_fw_name); | ||
526 | return -ENOENT; | ||
527 | } | ||
528 | |||
529 | /* Load primary firmware */ | 516 | /* Load primary firmware */ |
530 | ret = spectrum_dl_image(hw, link, primsym); | 517 | ret = spectrum_dl_image(hw, link, fw_entry->data, 0); |
518 | release_firmware(fw_entry); | ||
531 | if (ret) { | 519 | if (ret) { |
532 | printk(KERN_ERR PFX "Primary firmware download failed\n"); | 520 | printk(KERN_ERR PFX "Primary firmware download failed\n"); |
533 | return ret; | 521 | return ret; |
534 | } | 522 | } |
535 | 523 | ||
536 | /* Load secondary firmware */ | 524 | if (request_firmware(&fw_entry, secondary_fw_name, |
537 | ret = spectrum_dl_image(hw, link, secsym); | 525 | &handle_to_dev(link)) != 0) { |
526 | printk(KERN_ERR PFX "Cannot find firmware: %s\n", | ||
527 | secondary_fw_name); | ||
528 | return -ENOENT; | ||
529 | } | ||
538 | 530 | ||
531 | /* Load secondary firmware */ | ||
532 | ret = spectrum_dl_image(hw, link, fw_entry->data, 1); | ||
533 | release_firmware(fw_entry); | ||
539 | if (ret) { | 534 | if (ret) { |
540 | printk(KERN_ERR PFX "Secondary firmware download failed\n"); | 535 | printk(KERN_ERR PFX "Secondary firmware download failed\n"); |
541 | } | 536 | } |
diff --git a/drivers/net/wireless/zd1211rw/zd_usb.c b/drivers/net/wireless/zd1211rw/zd_usb.c index ce1cb2c6aa8d..72f90525bf68 100644 --- a/drivers/net/wireless/zd1211rw/zd_usb.c +++ b/drivers/net/wireless/zd1211rw/zd_usb.c | |||
@@ -375,10 +375,8 @@ static void int_urb_complete(struct urb *urb, struct pt_regs *pt_regs) | |||
375 | case -ENODEV: | 375 | case -ENODEV: |
376 | case -ENOENT: | 376 | case -ENOENT: |
377 | case -ECONNRESET: | 377 | case -ECONNRESET: |
378 | goto kfree; | ||
379 | case -EPIPE: | 378 | case -EPIPE: |
380 | usb_clear_halt(urb->dev, EP_INT_IN); | 379 | goto kfree; |
381 | /* FALL-THROUGH */ | ||
382 | default: | 380 | default: |
383 | goto resubmit; | 381 | goto resubmit; |
384 | } | 382 | } |
@@ -580,10 +578,8 @@ static void rx_urb_complete(struct urb *urb, struct pt_regs *pt_regs) | |||
580 | case -ENODEV: | 578 | case -ENODEV: |
581 | case -ENOENT: | 579 | case -ENOENT: |
582 | case -ECONNRESET: | 580 | case -ECONNRESET: |
583 | return; | ||
584 | case -EPIPE: | 581 | case -EPIPE: |
585 | usb_clear_halt(urb->dev, EP_DATA_IN); | 582 | return; |
586 | /* FALL-THROUGH */ | ||
587 | default: | 583 | default: |
588 | dev_dbg_f(urb_dev(urb), "urb %p error %d\n", urb, urb->status); | 584 | dev_dbg_f(urb_dev(urb), "urb %p error %d\n", urb, urb->status); |
589 | goto resubmit; | 585 | goto resubmit; |
@@ -749,11 +745,9 @@ static void tx_urb_complete(struct urb *urb, struct pt_regs *pt_regs) | |||
749 | case -ENODEV: | 745 | case -ENODEV: |
750 | case -ENOENT: | 746 | case -ENOENT: |
751 | case -ECONNRESET: | 747 | case -ECONNRESET: |
748 | case -EPIPE: | ||
752 | dev_dbg_f(urb_dev(urb), "urb %p error %d\n", urb, urb->status); | 749 | dev_dbg_f(urb_dev(urb), "urb %p error %d\n", urb, urb->status); |
753 | break; | 750 | break; |
754 | case -EPIPE: | ||
755 | usb_clear_halt(urb->dev, EP_DATA_OUT); | ||
756 | /* FALL-THROUGH */ | ||
757 | default: | 751 | default: |
758 | dev_dbg_f(urb_dev(urb), "urb %p error %d\n", urb, urb->status); | 752 | dev_dbg_f(urb_dev(urb), "urb %p error %d\n", urb, urb->status); |
759 | goto resubmit; | 753 | goto resubmit; |
diff --git a/drivers/pci/hotplug/Kconfig b/drivers/pci/hotplug/Kconfig index 222a1cc4aa28..3fae77ffb2fa 100644 --- a/drivers/pci/hotplug/Kconfig +++ b/drivers/pci/hotplug/Kconfig | |||
@@ -6,8 +6,7 @@ menu "PCI Hotplug Support" | |||
6 | 6 | ||
7 | config HOTPLUG_PCI | 7 | config HOTPLUG_PCI |
8 | tristate "Support for PCI Hotplug (EXPERIMENTAL)" | 8 | tristate "Support for PCI Hotplug (EXPERIMENTAL)" |
9 | depends on PCI && EXPERIMENTAL | 9 | depends on PCI && EXPERIMENTAL && HOTPLUG |
10 | select HOTPLUG | ||
11 | ---help--- | 10 | ---help--- |
12 | Say Y here if you have a motherboard with a PCI Hotplug controller. | 11 | Say Y here if you have a motherboard with a PCI Hotplug controller. |
13 | This allows you to add and remove PCI cards while the machine is | 12 | This allows you to add and remove PCI cards while the machine is |
@@ -77,7 +76,7 @@ config HOTPLUG_PCI_IBM | |||
77 | 76 | ||
78 | config HOTPLUG_PCI_ACPI | 77 | config HOTPLUG_PCI_ACPI |
79 | tristate "ACPI PCI Hotplug driver" | 78 | tristate "ACPI PCI Hotplug driver" |
80 | depends on ACPI && HOTPLUG_PCI | 79 | depends on ACPI_DOCK && HOTPLUG_PCI |
81 | help | 80 | help |
82 | Say Y here if you have a system that supports PCI Hotplug using | 81 | Say Y here if you have a system that supports PCI Hotplug using |
83 | ACPI. | 82 | ACPI. |
diff --git a/drivers/pci/msi.c b/drivers/pci/msi.c index 36bc7c415af7..a83c1f5735d6 100644 --- a/drivers/pci/msi.c +++ b/drivers/pci/msi.c | |||
@@ -47,13 +47,13 @@ msi_register(struct msi_ops *ops) | |||
47 | 47 | ||
48 | static void msi_cache_ctor(void *p, kmem_cache_t *cache, unsigned long flags) | 48 | static void msi_cache_ctor(void *p, kmem_cache_t *cache, unsigned long flags) |
49 | { | 49 | { |
50 | memset(p, 0, NR_IRQS * sizeof(struct msi_desc)); | 50 | memset(p, 0, sizeof(struct msi_desc)); |
51 | } | 51 | } |
52 | 52 | ||
53 | static int msi_cache_init(void) | 53 | static int msi_cache_init(void) |
54 | { | 54 | { |
55 | msi_cachep = kmem_cache_create("msi_cache", | 55 | msi_cachep = kmem_cache_create("msi_cache", |
56 | NR_IRQS * sizeof(struct msi_desc), | 56 | sizeof(struct msi_desc), |
57 | 0, SLAB_HWCACHE_ALIGN, msi_cache_ctor, NULL); | 57 | 0, SLAB_HWCACHE_ALIGN, msi_cache_ctor, NULL); |
58 | if (!msi_cachep) | 58 | if (!msi_cachep) |
59 | return -ENOMEM; | 59 | return -ENOMEM; |
diff --git a/drivers/pci/pci.c b/drivers/pci/pci.c index cf57d7de3765..9f79dd6d51ab 100644 --- a/drivers/pci/pci.c +++ b/drivers/pci/pci.c | |||
@@ -19,6 +19,7 @@ | |||
19 | #include <asm/dma.h> /* isa_dma_bridge_buggy */ | 19 | #include <asm/dma.h> /* isa_dma_bridge_buggy */ |
20 | #include "pci.h" | 20 | #include "pci.h" |
21 | 21 | ||
22 | unsigned int pci_pm_d3_delay = 10; | ||
22 | 23 | ||
23 | /** | 24 | /** |
24 | * pci_bus_max_busnr - returns maximum PCI bus number of given bus' children | 25 | * pci_bus_max_busnr - returns maximum PCI bus number of given bus' children |
@@ -313,6 +314,14 @@ pci_set_power_state(struct pci_dev *dev, pci_power_t state) | |||
313 | } else if (dev->current_state == state) | 314 | } else if (dev->current_state == state) |
314 | return 0; /* we're already there */ | 315 | return 0; /* we're already there */ |
315 | 316 | ||
317 | /* | ||
318 | * If the device or the parent bridge can't support PCI PM, ignore | ||
319 | * the request if we're doing anything besides putting it into D0 | ||
320 | * (which would only happen on boot). | ||
321 | */ | ||
322 | if ((state == PCI_D1 || state == PCI_D2) && pci_no_d1d2(dev)) | ||
323 | return 0; | ||
324 | |||
316 | /* find PCI PM capability in list */ | 325 | /* find PCI PM capability in list */ |
317 | pm = pci_find_capability(dev, PCI_CAP_ID_PM); | 326 | pm = pci_find_capability(dev, PCI_CAP_ID_PM); |
318 | 327 | ||
@@ -363,7 +372,7 @@ pci_set_power_state(struct pci_dev *dev, pci_power_t state) | |||
363 | /* Mandatory power management transition delays */ | 372 | /* Mandatory power management transition delays */ |
364 | /* see PCI PM 1.1 5.6.1 table 18 */ | 373 | /* see PCI PM 1.1 5.6.1 table 18 */ |
365 | if (state == PCI_D3hot || dev->current_state == PCI_D3hot) | 374 | if (state == PCI_D3hot || dev->current_state == PCI_D3hot) |
366 | msleep(10); | 375 | msleep(pci_pm_d3_delay); |
367 | else if (state == PCI_D2 || dev->current_state == PCI_D2) | 376 | else if (state == PCI_D2 || dev->current_state == PCI_D2) |
368 | udelay(200); | 377 | udelay(200); |
369 | 378 | ||
diff --git a/drivers/pci/pci.h b/drivers/pci/pci.h index 9cc842b666eb..08d58fc78ee1 100644 --- a/drivers/pci/pci.h +++ b/drivers/pci/pci.h | |||
@@ -47,7 +47,7 @@ extern int pci_msi_quirk; | |||
47 | #else | 47 | #else |
48 | #define pci_msi_quirk 0 | 48 | #define pci_msi_quirk 0 |
49 | #endif | 49 | #endif |
50 | 50 | extern unsigned int pci_pm_d3_delay; | |
51 | #ifdef CONFIG_PCI_MSI | 51 | #ifdef CONFIG_PCI_MSI |
52 | void disable_msi_mode(struct pci_dev *dev, int pos, int type); | 52 | void disable_msi_mode(struct pci_dev *dev, int pos, int type); |
53 | void pci_no_msi(void); | 53 | void pci_no_msi(void); |
@@ -66,7 +66,15 @@ static inline int pci_save_msix_state(struct pci_dev *dev) { return 0; } | |||
66 | static inline void pci_restore_msi_state(struct pci_dev *dev) {} | 66 | static inline void pci_restore_msi_state(struct pci_dev *dev) {} |
67 | static inline void pci_restore_msix_state(struct pci_dev *dev) {} | 67 | static inline void pci_restore_msix_state(struct pci_dev *dev) {} |
68 | #endif | 68 | #endif |
69 | static inline int pci_no_d1d2(struct pci_dev *dev) | ||
70 | { | ||
71 | unsigned int parent_dstates = 0; | ||
69 | 72 | ||
73 | if (dev->bus->self) | ||
74 | parent_dstates = dev->bus->self->no_d1d2; | ||
75 | return (dev->no_d1d2 || parent_dstates); | ||
76 | |||
77 | } | ||
70 | extern int pcie_mch_quirk; | 78 | extern int pcie_mch_quirk; |
71 | extern struct device_attribute pci_dev_attrs[]; | 79 | extern struct device_attribute pci_dev_attrs[]; |
72 | extern struct class_device_attribute class_device_attr_cpuaffinity; | 80 | extern struct class_device_attribute class_device_attr_cpuaffinity; |
diff --git a/drivers/pci/probe.c b/drivers/pci/probe.c index f89dbc3738b7..c5a58d1c6c1c 100644 --- a/drivers/pci/probe.c +++ b/drivers/pci/probe.c | |||
@@ -815,6 +815,7 @@ pci_scan_device(struct pci_bus *bus, int devfn) | |||
815 | dev->vendor = l & 0xffff; | 815 | dev->vendor = l & 0xffff; |
816 | dev->device = (l >> 16) & 0xffff; | 816 | dev->device = (l >> 16) & 0xffff; |
817 | dev->cfg_size = pci_cfg_space_size(dev); | 817 | dev->cfg_size = pci_cfg_space_size(dev); |
818 | dev->error_state = pci_channel_io_normal; | ||
818 | 819 | ||
819 | /* Assume 32-bit PCI; let 64-bit PCI cards (which are far rarer) | 820 | /* Assume 32-bit PCI; let 64-bit PCI cards (which are far rarer) |
820 | set this higher, assuming the system even supports it. */ | 821 | set this higher, assuming the system even supports it. */ |
diff --git a/drivers/pci/quirks.c b/drivers/pci/quirks.c index d1d7333bb71b..e3c78c39b7e4 100644 --- a/drivers/pci/quirks.c +++ b/drivers/pci/quirks.c | |||
@@ -400,6 +400,7 @@ static void __devinit quirk_piix4_acpi(struct pci_dev *dev) | |||
400 | piix4_io_quirk(dev, "PIIX4 devres J", 0x7c, 1 << 20); | 400 | piix4_io_quirk(dev, "PIIX4 devres J", 0x7c, 1 << 20); |
401 | } | 401 | } |
402 | DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_82371AB_3, quirk_piix4_acpi ); | 402 | DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_82371AB_3, quirk_piix4_acpi ); |
403 | DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_82443MX_3, quirk_piix4_acpi ); | ||
403 | 404 | ||
404 | /* | 405 | /* |
405 | * ICH4, ICH4-M, ICH5, ICH5-M ACPI: Three IO regions pointed to by longwords at | 406 | * ICH4, ICH4-M, ICH5, ICH5-M ACPI: Three IO regions pointed to by longwords at |
@@ -682,6 +683,33 @@ static void __devinit quirk_vt82c598_id(struct pci_dev *dev) | |||
682 | } | 683 | } |
683 | DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_VIA, PCI_DEVICE_ID_VIA_82C597_0, quirk_vt82c598_id ); | 684 | DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_VIA, PCI_DEVICE_ID_VIA_82C597_0, quirk_vt82c598_id ); |
684 | 685 | ||
686 | #ifdef CONFIG_ACPI_SLEEP | ||
687 | |||
688 | /* | ||
689 | * Some VIA systems boot with the abnormal status flag set. This can cause | ||
690 | * the BIOS to re-POST the system on resume rather than passing control | ||
691 | * back to the OS. Clear the flag on boot | ||
692 | */ | ||
693 | static void __devinit quirk_via_abnormal_poweroff(struct pci_dev *dev) | ||
694 | { | ||
695 | u32 reg; | ||
696 | |||
697 | acpi_hw_register_read(ACPI_MTX_DO_NOT_LOCK, ACPI_REGISTER_PM1_STATUS, | ||
698 | ®); | ||
699 | |||
700 | if (reg & 0x800) { | ||
701 | printk("Clearing abnormal poweroff flag\n"); | ||
702 | acpi_hw_register_write(ACPI_MTX_DO_NOT_LOCK, | ||
703 | ACPI_REGISTER_PM1_STATUS, | ||
704 | (u16)0x800); | ||
705 | } | ||
706 | } | ||
707 | |||
708 | DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_VIA, PCI_DEVICE_ID_VIA_8235, quirk_via_abnormal_poweroff); | ||
709 | DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_VIA, PCI_DEVICE_ID_VIA_8237, quirk_via_abnormal_poweroff); | ||
710 | |||
711 | #endif | ||
712 | |||
685 | /* | 713 | /* |
686 | * CardBus controllers have a legacy base address that enables them | 714 | * CardBus controllers have a legacy base address that enables them |
687 | * to respond as i82365 pcmcia controllers. We don't want them to | 715 | * to respond as i82365 pcmcia controllers. We don't want them to |
@@ -1174,6 +1202,55 @@ DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_SI, PCI_DEVICE_ID_SI_962, quirk_sis_96x_ | |||
1174 | DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_SI, PCI_DEVICE_ID_SI_963, quirk_sis_96x_smbus ); | 1202 | DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_SI, PCI_DEVICE_ID_SI_963, quirk_sis_96x_smbus ); |
1175 | DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_SI, PCI_DEVICE_ID_SI_LPC, quirk_sis_96x_smbus ); | 1203 | DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_SI, PCI_DEVICE_ID_SI_LPC, quirk_sis_96x_smbus ); |
1176 | 1204 | ||
1205 | #if defined(CONFIG_SCSI_SATA) || defined(CONFIG_SCSI_SATA_MODULE) | ||
1206 | |||
1207 | /* | ||
1208 | * If we are using libata we can drive this chip properly but must | ||
1209 | * do this early on to make the additional device appear during | ||
1210 | * the PCI scanning. | ||
1211 | */ | ||
1212 | |||
1213 | static void __devinit quirk_jmicron_dualfn(struct pci_dev *pdev) | ||
1214 | { | ||
1215 | u32 conf; | ||
1216 | u8 hdr; | ||
1217 | |||
1218 | /* Only poke fn 0 */ | ||
1219 | if (PCI_FUNC(pdev->devfn)) | ||
1220 | return; | ||
1221 | |||
1222 | switch(pdev->device) { | ||
1223 | case PCI_DEVICE_ID_JMICRON_JMB365: | ||
1224 | case PCI_DEVICE_ID_JMICRON_JMB366: | ||
1225 | /* Redirect IDE second PATA port to the right spot */ | ||
1226 | pci_read_config_dword(pdev, 0x80, &conf); | ||
1227 | conf |= (1 << 24); | ||
1228 | /* Fall through */ | ||
1229 | pci_write_config_dword(pdev, 0x80, conf); | ||
1230 | case PCI_DEVICE_ID_JMICRON_JMB361: | ||
1231 | case PCI_DEVICE_ID_JMICRON_JMB363: | ||
1232 | pci_read_config_dword(pdev, 0x40, &conf); | ||
1233 | /* Enable dual function mode, AHCI on fn 0, IDE fn1 */ | ||
1234 | /* Set the class codes correctly and then direct IDE 0 */ | ||
1235 | conf &= ~0x000F0200; /* Clear bit 9 and 16-19 */ | ||
1236 | conf |= 0x00C20002; /* Set bit 1, 17, 22, 23 */ | ||
1237 | pci_write_config_dword(pdev, 0x40, conf); | ||
1238 | |||
1239 | /* Reconfigure so that the PCI scanner discovers the | ||
1240 | device is now multifunction */ | ||
1241 | |||
1242 | pci_read_config_byte(pdev, PCI_HEADER_TYPE, &hdr); | ||
1243 | pdev->hdr_type = hdr & 0x7f; | ||
1244 | pdev->multifunction = !!(hdr & 0x80); | ||
1245 | |||
1246 | break; | ||
1247 | } | ||
1248 | } | ||
1249 | |||
1250 | DECLARE_PCI_FIXUP_EARLY(PCI_VENDOR_ID_JMICRON, PCI_ANY_ID, quirk_jmicron_dualfn); | ||
1251 | |||
1252 | #endif | ||
1253 | |||
1177 | #ifdef CONFIG_X86_IO_APIC | 1254 | #ifdef CONFIG_X86_IO_APIC |
1178 | static void __init quirk_alder_ioapic(struct pci_dev *pdev) | 1255 | static void __init quirk_alder_ioapic(struct pci_dev *pdev) |
1179 | { | 1256 | { |
@@ -1341,6 +1418,37 @@ DECLARE_PCI_FIXUP_EARLY(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_PXH_0, quirk_pc | |||
1341 | DECLARE_PCI_FIXUP_EARLY(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_PXH_1, quirk_pcie_pxh); | 1418 | DECLARE_PCI_FIXUP_EARLY(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_PXH_1, quirk_pcie_pxh); |
1342 | DECLARE_PCI_FIXUP_EARLY(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_PXHV, quirk_pcie_pxh); | 1419 | DECLARE_PCI_FIXUP_EARLY(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_PXHV, quirk_pcie_pxh); |
1343 | 1420 | ||
1421 | /* | ||
1422 | * Some Intel PCI Express chipsets have trouble with downstream | ||
1423 | * device power management. | ||
1424 | */ | ||
1425 | static void quirk_intel_pcie_pm(struct pci_dev * dev) | ||
1426 | { | ||
1427 | pci_pm_d3_delay = 120; | ||
1428 | dev->no_d1d2 = 1; | ||
1429 | } | ||
1430 | |||
1431 | DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_INTEL, 0x25e2, quirk_intel_pcie_pm); | ||
1432 | DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_INTEL, 0x25e3, quirk_intel_pcie_pm); | ||
1433 | DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_INTEL, 0x25e4, quirk_intel_pcie_pm); | ||
1434 | DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_INTEL, 0x25e5, quirk_intel_pcie_pm); | ||
1435 | DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_INTEL, 0x25e6, quirk_intel_pcie_pm); | ||
1436 | DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_INTEL, 0x25e7, quirk_intel_pcie_pm); | ||
1437 | DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_INTEL, 0x25f7, quirk_intel_pcie_pm); | ||
1438 | DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_INTEL, 0x25f8, quirk_intel_pcie_pm); | ||
1439 | DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_INTEL, 0x25f9, quirk_intel_pcie_pm); | ||
1440 | DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_INTEL, 0x25fa, quirk_intel_pcie_pm); | ||
1441 | DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_INTEL, 0x2601, quirk_intel_pcie_pm); | ||
1442 | DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_INTEL, 0x2602, quirk_intel_pcie_pm); | ||
1443 | DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_INTEL, 0x2603, quirk_intel_pcie_pm); | ||
1444 | DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_INTEL, 0x2604, quirk_intel_pcie_pm); | ||
1445 | DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_INTEL, 0x2605, quirk_intel_pcie_pm); | ||
1446 | DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_INTEL, 0x2606, quirk_intel_pcie_pm); | ||
1447 | DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_INTEL, 0x2607, quirk_intel_pcie_pm); | ||
1448 | DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_INTEL, 0x2608, quirk_intel_pcie_pm); | ||
1449 | DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_INTEL, 0x2609, quirk_intel_pcie_pm); | ||
1450 | DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_INTEL, 0x260a, quirk_intel_pcie_pm); | ||
1451 | DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_INTEL, 0x260b, quirk_intel_pcie_pm); | ||
1344 | 1452 | ||
1345 | /* | 1453 | /* |
1346 | * Fixup the cardbus bridges on the IBM Dock II docking station | 1454 | * Fixup the cardbus bridges on the IBM Dock II docking station |
diff --git a/drivers/pcmcia/Kconfig b/drivers/pcmcia/Kconfig index 61cb4b29f55c..35f88649d3b7 100644 --- a/drivers/pcmcia/Kconfig +++ b/drivers/pcmcia/Kconfig | |||
@@ -6,7 +6,7 @@ menu "PCCARD (PCMCIA/CardBus) support" | |||
6 | 6 | ||
7 | config PCCARD | 7 | config PCCARD |
8 | tristate "PCCard (PCMCIA/CardBus) support" | 8 | tristate "PCCard (PCMCIA/CardBus) support" |
9 | select HOTPLUG | 9 | depends on HOTPLUG |
10 | ---help--- | 10 | ---help--- |
11 | Say Y here if you want to attach PCMCIA- or PC-cards to your Linux | 11 | Say Y here if you want to attach PCMCIA- or PC-cards to your Linux |
12 | computer. These are credit-card size devices such as network cards, | 12 | computer. These are credit-card size devices such as network cards, |
diff --git a/drivers/rtc/Kconfig b/drivers/rtc/Kconfig index f5b9f187a930..7ff1d88094b6 100644 --- a/drivers/rtc/Kconfig +++ b/drivers/rtc/Kconfig | |||
@@ -121,6 +121,16 @@ config RTC_DRV_DS1553 | |||
121 | This driver can also be built as a module. If so, the module | 121 | This driver can also be built as a module. If so, the module |
122 | will be called rtc-ds1553. | 122 | will be called rtc-ds1553. |
123 | 123 | ||
124 | config RTC_DRV_ISL1208 | ||
125 | tristate "Intersil 1208" | ||
126 | depends on RTC_CLASS && I2C | ||
127 | help | ||
128 | If you say yes here you get support for the | ||
129 | Intersil 1208 RTC chip. | ||
130 | |||
131 | This driver can also be built as a module. If so, the module | ||
132 | will be called rtc-isl1208. | ||
133 | |||
124 | config RTC_DRV_DS1672 | 134 | config RTC_DRV_DS1672 |
125 | tristate "Dallas/Maxim DS1672" | 135 | tristate "Dallas/Maxim DS1672" |
126 | depends on RTC_CLASS && I2C | 136 | depends on RTC_CLASS && I2C |
diff --git a/drivers/rtc/Makefile b/drivers/rtc/Makefile index 54220714ff49..bbcfb09d81d9 100644 --- a/drivers/rtc/Makefile +++ b/drivers/rtc/Makefile | |||
@@ -12,6 +12,7 @@ obj-$(CONFIG_RTC_INTF_PROC) += rtc-proc.o | |||
12 | obj-$(CONFIG_RTC_INTF_DEV) += rtc-dev.o | 12 | obj-$(CONFIG_RTC_INTF_DEV) += rtc-dev.o |
13 | 13 | ||
14 | obj-$(CONFIG_RTC_DRV_X1205) += rtc-x1205.o | 14 | obj-$(CONFIG_RTC_DRV_X1205) += rtc-x1205.o |
15 | obj-$(CONFIG_RTC_DRV_ISL1208) += rtc-isl1208.o | ||
15 | obj-$(CONFIG_RTC_DRV_TEST) += rtc-test.o | 16 | obj-$(CONFIG_RTC_DRV_TEST) += rtc-test.o |
16 | obj-$(CONFIG_RTC_DRV_DS1307) += rtc-ds1307.o | 17 | obj-$(CONFIG_RTC_DRV_DS1307) += rtc-ds1307.o |
17 | obj-$(CONFIG_RTC_DRV_DS1672) += rtc-ds1672.o | 18 | obj-$(CONFIG_RTC_DRV_DS1672) += rtc-ds1672.o |
diff --git a/drivers/rtc/rtc-isl1208.c b/drivers/rtc/rtc-isl1208.c new file mode 100644 index 000000000000..f324d0a635d4 --- /dev/null +++ b/drivers/rtc/rtc-isl1208.c | |||
@@ -0,0 +1,591 @@ | |||
1 | /* | ||
2 | * Intersil ISL1208 rtc class driver | ||
3 | * | ||
4 | * Copyright 2005,2006 Hebert Valerio Riedel <hvr@gnu.org> | ||
5 | * | ||
6 | * This program is free software; you can redistribute it and/or modify it | ||
7 | * under the terms of the GNU General Public License as published by the | ||
8 | * Free Software Foundation; either version 2 of the License, or (at your | ||
9 | * option) any later version. | ||
10 | * | ||
11 | */ | ||
12 | |||
13 | #include <linux/module.h> | ||
14 | #include <linux/i2c.h> | ||
15 | #include <linux/bcd.h> | ||
16 | #include <linux/rtc.h> | ||
17 | |||
18 | #define DRV_NAME "isl1208" | ||
19 | #define DRV_VERSION "0.2" | ||
20 | |||
21 | /* Register map */ | ||
22 | /* rtc section */ | ||
23 | #define ISL1208_REG_SC 0x00 | ||
24 | #define ISL1208_REG_MN 0x01 | ||
25 | #define ISL1208_REG_HR 0x02 | ||
26 | #define ISL1208_REG_HR_MIL (1<<7) /* 24h/12h mode */ | ||
27 | #define ISL1208_REG_HR_PM (1<<5) /* PM/AM bit in 12h mode */ | ||
28 | #define ISL1208_REG_DT 0x03 | ||
29 | #define ISL1208_REG_MO 0x04 | ||
30 | #define ISL1208_REG_YR 0x05 | ||
31 | #define ISL1208_REG_DW 0x06 | ||
32 | #define ISL1208_RTC_SECTION_LEN 7 | ||
33 | |||
34 | /* control/status section */ | ||
35 | #define ISL1208_REG_SR 0x07 | ||
36 | #define ISL1208_REG_SR_ARST (1<<7) /* auto reset */ | ||
37 | #define ISL1208_REG_SR_XTOSCB (1<<6) /* crystal oscillator */ | ||
38 | #define ISL1208_REG_SR_WRTC (1<<4) /* write rtc */ | ||
39 | #define ISL1208_REG_SR_ALM (1<<2) /* alarm */ | ||
40 | #define ISL1208_REG_SR_BAT (1<<1) /* battery */ | ||
41 | #define ISL1208_REG_SR_RTCF (1<<0) /* rtc fail */ | ||
42 | #define ISL1208_REG_INT 0x08 | ||
43 | #define ISL1208_REG_09 0x09 /* reserved */ | ||
44 | #define ISL1208_REG_ATR 0x0a | ||
45 | #define ISL1208_REG_DTR 0x0b | ||
46 | |||
47 | /* alarm section */ | ||
48 | #define ISL1208_REG_SCA 0x0c | ||
49 | #define ISL1208_REG_MNA 0x0d | ||
50 | #define ISL1208_REG_HRA 0x0e | ||
51 | #define ISL1208_REG_DTA 0x0f | ||
52 | #define ISL1208_REG_MOA 0x10 | ||
53 | #define ISL1208_REG_DWA 0x11 | ||
54 | #define ISL1208_ALARM_SECTION_LEN 6 | ||
55 | |||
56 | /* user section */ | ||
57 | #define ISL1208_REG_USR1 0x12 | ||
58 | #define ISL1208_REG_USR2 0x13 | ||
59 | #define ISL1208_USR_SECTION_LEN 2 | ||
60 | |||
61 | /* i2c configuration */ | ||
62 | #define ISL1208_I2C_ADDR 0xde | ||
63 | |||
64 | static unsigned short normal_i2c[] = { | ||
65 | ISL1208_I2C_ADDR>>1, I2C_CLIENT_END | ||
66 | }; | ||
67 | I2C_CLIENT_INSMOD; /* defines addr_data */ | ||
68 | |||
69 | static int isl1208_attach_adapter(struct i2c_adapter *adapter); | ||
70 | static int isl1208_detach_client(struct i2c_client *client); | ||
71 | |||
72 | static struct i2c_driver isl1208_driver = { | ||
73 | .driver = { | ||
74 | .name = DRV_NAME, | ||
75 | }, | ||
76 | .id = I2C_DRIVERID_ISL1208, | ||
77 | .attach_adapter = &isl1208_attach_adapter, | ||
78 | .detach_client = &isl1208_detach_client, | ||
79 | }; | ||
80 | |||
81 | /* block read */ | ||
82 | static int | ||
83 | isl1208_i2c_read_regs(struct i2c_client *client, u8 reg, u8 buf[], | ||
84 | unsigned len) | ||
85 | { | ||
86 | u8 reg_addr[1] = { reg }; | ||
87 | struct i2c_msg msgs[2] = { | ||
88 | { client->addr, client->flags, sizeof(reg_addr), reg_addr }, | ||
89 | { client->addr, client->flags | I2C_M_RD, len, buf } | ||
90 | }; | ||
91 | int ret; | ||
92 | |||
93 | BUG_ON(len == 0); | ||
94 | BUG_ON(reg > ISL1208_REG_USR2); | ||
95 | BUG_ON(reg + len > ISL1208_REG_USR2 + 1); | ||
96 | |||
97 | ret = i2c_transfer(client->adapter, msgs, 2); | ||
98 | if (ret > 0) | ||
99 | ret = 0; | ||
100 | return ret; | ||
101 | } | ||
102 | |||
103 | /* block write */ | ||
104 | static int | ||
105 | isl1208_i2c_set_regs(struct i2c_client *client, u8 reg, u8 const buf[], | ||
106 | unsigned len) | ||
107 | { | ||
108 | u8 i2c_buf[ISL1208_REG_USR2 + 2]; | ||
109 | struct i2c_msg msgs[1] = { | ||
110 | { client->addr, client->flags, len + 1, i2c_buf } | ||
111 | }; | ||
112 | int ret; | ||
113 | |||
114 | BUG_ON(len == 0); | ||
115 | BUG_ON(reg > ISL1208_REG_USR2); | ||
116 | BUG_ON(reg + len > ISL1208_REG_USR2 + 1); | ||
117 | |||
118 | i2c_buf[0] = reg; | ||
119 | memcpy(&i2c_buf[1], &buf[0], len); | ||
120 | |||
121 | ret = i2c_transfer(client->adapter, msgs, 1); | ||
122 | if (ret > 0) | ||
123 | ret = 0; | ||
124 | return ret; | ||
125 | } | ||
126 | |||
127 | /* simple check to see wether we have a isl1208 */ | ||
128 | static int isl1208_i2c_validate_client(struct i2c_client *client) | ||
129 | { | ||
130 | u8 regs[ISL1208_RTC_SECTION_LEN] = { 0, }; | ||
131 | u8 zero_mask[ISL1208_RTC_SECTION_LEN] = { | ||
132 | 0x80, 0x80, 0x40, 0xc0, 0xe0, 0x00, 0xf8 | ||
133 | }; | ||
134 | int i; | ||
135 | int ret; | ||
136 | |||
137 | ret = isl1208_i2c_read_regs(client, 0, regs, ISL1208_RTC_SECTION_LEN); | ||
138 | if (ret < 0) | ||
139 | return ret; | ||
140 | |||
141 | for (i = 0; i < ISL1208_RTC_SECTION_LEN; ++i) { | ||
142 | if (regs[i] & zero_mask[i]) /* check if bits are cleared */ | ||
143 | return -ENODEV; | ||
144 | } | ||
145 | |||
146 | return 0; | ||
147 | } | ||
148 | |||
149 | static int isl1208_i2c_get_sr(struct i2c_client *client) | ||
150 | { | ||
151 | return i2c_smbus_read_byte_data(client, ISL1208_REG_SR) == -1 ? -EIO:0; | ||
152 | } | ||
153 | |||
154 | static int isl1208_i2c_get_atr(struct i2c_client *client) | ||
155 | { | ||
156 | int atr = i2c_smbus_read_byte_data(client, ISL1208_REG_ATR); | ||
157 | |||
158 | if (atr < 0) | ||
159 | return -EIO; | ||
160 | |||
161 | /* The 6bit value in the ATR register controls the load | ||
162 | * capacitance C_load * in steps of 0.25pF | ||
163 | * | ||
164 | * bit (1<<5) of the ATR register is inverted | ||
165 | * | ||
166 | * C_load(ATR=0x20) = 4.50pF | ||
167 | * C_load(ATR=0x00) = 12.50pF | ||
168 | * C_load(ATR=0x1f) = 20.25pF | ||
169 | * | ||
170 | */ | ||
171 | |||
172 | atr &= 0x3f; /* mask out lsb */ | ||
173 | atr ^= 1<<5; /* invert 6th bit */ | ||
174 | atr += 2*9; /* add offset of 4.5pF; unit[atr] = 0.25pF */ | ||
175 | |||
176 | return atr; | ||
177 | } | ||
178 | |||
179 | static int isl1208_i2c_get_dtr(struct i2c_client *client) | ||
180 | { | ||
181 | int dtr = i2c_smbus_read_byte_data(client, ISL1208_REG_DTR); | ||
182 | |||
183 | if (dtr < 0) | ||
184 | return -EIO; | ||
185 | |||
186 | /* dtr encodes adjustments of {-60,-40,-20,0,20,40,60} ppm */ | ||
187 | dtr = ((dtr & 0x3) * 20) * (dtr & (1<<2) ? -1 : 1); | ||
188 | |||
189 | return dtr; | ||
190 | } | ||
191 | |||
192 | static int isl1208_i2c_get_usr(struct i2c_client *client) | ||
193 | { | ||
194 | u8 buf[ISL1208_USR_SECTION_LEN] = { 0, }; | ||
195 | int ret; | ||
196 | |||
197 | ret = isl1208_i2c_read_regs (client, ISL1208_REG_USR1, buf, | ||
198 | ISL1208_USR_SECTION_LEN); | ||
199 | if (ret < 0) | ||
200 | return ret; | ||
201 | |||
202 | return (buf[1] << 8) | buf[0]; | ||
203 | } | ||
204 | |||
205 | static int isl1208_i2c_set_usr(struct i2c_client *client, u16 usr) | ||
206 | { | ||
207 | u8 buf[ISL1208_USR_SECTION_LEN]; | ||
208 | |||
209 | buf[0] = usr & 0xff; | ||
210 | buf[1] = (usr >> 8) & 0xff; | ||
211 | |||
212 | return isl1208_i2c_set_regs (client, ISL1208_REG_USR1, buf, | ||
213 | ISL1208_USR_SECTION_LEN); | ||
214 | } | ||
215 | |||
216 | static int isl1208_rtc_proc(struct device *dev, struct seq_file *seq) | ||
217 | { | ||
218 | struct i2c_client *const client = to_i2c_client(dev); | ||
219 | int sr, dtr, atr, usr; | ||
220 | |||
221 | sr = isl1208_i2c_get_sr(client); | ||
222 | if (sr < 0) { | ||
223 | dev_err(&client->dev, "%s: reading SR failed\n", __func__); | ||
224 | return sr; | ||
225 | } | ||
226 | |||
227 | seq_printf(seq, "status_reg\t:%s%s%s%s%s%s (0x%.2x)\n", | ||
228 | (sr & ISL1208_REG_SR_RTCF) ? " RTCF" : "", | ||
229 | (sr & ISL1208_REG_SR_BAT) ? " BAT" : "", | ||
230 | (sr & ISL1208_REG_SR_ALM) ? " ALM" : "", | ||
231 | (sr & ISL1208_REG_SR_WRTC) ? " WRTC" : "", | ||
232 | (sr & ISL1208_REG_SR_XTOSCB) ? " XTOSCB" : "", | ||
233 | (sr & ISL1208_REG_SR_ARST) ? " ARST" : "", | ||
234 | sr); | ||
235 | |||
236 | seq_printf(seq, "batt_status\t: %s\n", | ||
237 | (sr & ISL1208_REG_SR_RTCF) ? "bad" : "okay"); | ||
238 | |||
239 | dtr = isl1208_i2c_get_dtr(client); | ||
240 | if (dtr >= 0 -1) | ||
241 | seq_printf(seq, "digital_trim\t: %d ppm\n", dtr); | ||
242 | |||
243 | atr = isl1208_i2c_get_atr(client); | ||
244 | if (atr >= 0) | ||
245 | seq_printf(seq, "analog_trim\t: %d.%.2d pF\n", | ||
246 | atr>>2, (atr&0x3)*25); | ||
247 | |||
248 | usr = isl1208_i2c_get_usr(client); | ||
249 | if (usr >= 0) | ||
250 | seq_printf(seq, "user_data\t: 0x%.4x\n", usr); | ||
251 | |||
252 | return 0; | ||
253 | } | ||
254 | |||
255 | |||
256 | static int isl1208_i2c_read_time(struct i2c_client *client, | ||
257 | struct rtc_time *tm) | ||
258 | { | ||
259 | int sr; | ||
260 | u8 regs[ISL1208_RTC_SECTION_LEN] = { 0, }; | ||
261 | |||
262 | sr = isl1208_i2c_get_sr(client); | ||
263 | if (sr < 0) { | ||
264 | dev_err(&client->dev, "%s: reading SR failed\n", __func__); | ||
265 | return -EIO; | ||
266 | } | ||
267 | |||
268 | sr = isl1208_i2c_read_regs(client, 0, regs, ISL1208_RTC_SECTION_LEN); | ||
269 | if (sr < 0) { | ||
270 | dev_err(&client->dev, "%s: reading RTC section failed\n", | ||
271 | __func__); | ||
272 | return sr; | ||
273 | } | ||
274 | |||
275 | tm->tm_sec = BCD2BIN(regs[ISL1208_REG_SC]); | ||
276 | tm->tm_min = BCD2BIN(regs[ISL1208_REG_MN]); | ||
277 | { /* HR field has a more complex interpretation */ | ||
278 | const u8 _hr = regs[ISL1208_REG_HR]; | ||
279 | if (_hr & ISL1208_REG_HR_MIL) /* 24h format */ | ||
280 | tm->tm_hour = BCD2BIN(_hr & 0x3f); | ||
281 | else { // 12h format | ||
282 | tm->tm_hour = BCD2BIN(_hr & 0x1f); | ||
283 | if (_hr & ISL1208_REG_HR_PM) /* PM flag set */ | ||
284 | tm->tm_hour += 12; | ||
285 | } | ||
286 | } | ||
287 | |||
288 | tm->tm_mday = BCD2BIN(regs[ISL1208_REG_DT]); | ||
289 | tm->tm_mon = BCD2BIN(regs[ISL1208_REG_MO]) - 1; /* rtc starts at 1 */ | ||
290 | tm->tm_year = BCD2BIN(regs[ISL1208_REG_YR]) + 100; | ||
291 | tm->tm_wday = BCD2BIN(regs[ISL1208_REG_DW]); | ||
292 | |||
293 | return 0; | ||
294 | } | ||
295 | |||
296 | static int isl1208_i2c_read_alarm(struct i2c_client *client, | ||
297 | struct rtc_wkalrm *alarm) | ||
298 | { | ||
299 | struct rtc_time *const tm = &alarm->time; | ||
300 | u8 regs[ISL1208_ALARM_SECTION_LEN] = { 0, }; | ||
301 | int sr; | ||
302 | |||
303 | sr = isl1208_i2c_get_sr(client); | ||
304 | if (sr < 0) { | ||
305 | dev_err(&client->dev, "%s: reading SR failed\n", __func__); | ||
306 | return sr; | ||
307 | } | ||
308 | |||
309 | sr = isl1208_i2c_read_regs(client, ISL1208_REG_SCA, regs, | ||
310 | ISL1208_ALARM_SECTION_LEN); | ||
311 | if (sr < 0) { | ||
312 | dev_err(&client->dev, "%s: reading alarm section failed\n", | ||
313 | __func__); | ||
314 | return sr; | ||
315 | } | ||
316 | |||
317 | /* MSB of each alarm register is an enable bit */ | ||
318 | tm->tm_sec = BCD2BIN(regs[ISL1208_REG_SCA-ISL1208_REG_SCA] & 0x7f); | ||
319 | tm->tm_min = BCD2BIN(regs[ISL1208_REG_MNA-ISL1208_REG_SCA] & 0x7f); | ||
320 | tm->tm_hour = BCD2BIN(regs[ISL1208_REG_HRA-ISL1208_REG_SCA] & 0x3f); | ||
321 | tm->tm_mday = BCD2BIN(regs[ISL1208_REG_DTA-ISL1208_REG_SCA] & 0x3f); | ||
322 | tm->tm_mon = BCD2BIN(regs[ISL1208_REG_MOA-ISL1208_REG_SCA] & 0x1f)-1; | ||
323 | tm->tm_wday = BCD2BIN(regs[ISL1208_REG_DWA-ISL1208_REG_SCA] & 0x03); | ||
324 | |||
325 | return 0; | ||
326 | } | ||
327 | |||
328 | static int isl1208_rtc_read_time(struct device *dev, struct rtc_time *tm) | ||
329 | { | ||
330 | return isl1208_i2c_read_time(to_i2c_client(dev), tm); | ||
331 | } | ||
332 | |||
333 | static int isl1208_i2c_set_time(struct i2c_client *client, | ||
334 | struct rtc_time const *tm) | ||
335 | { | ||
336 | int sr; | ||
337 | u8 regs[ISL1208_RTC_SECTION_LEN] = { 0, }; | ||
338 | |||
339 | regs[ISL1208_REG_SC] = BIN2BCD(tm->tm_sec); | ||
340 | regs[ISL1208_REG_MN] = BIN2BCD(tm->tm_min); | ||
341 | regs[ISL1208_REG_HR] = BIN2BCD(tm->tm_hour) | ISL1208_REG_HR_MIL; | ||
342 | |||
343 | regs[ISL1208_REG_DT] = BIN2BCD(tm->tm_mday); | ||
344 | regs[ISL1208_REG_MO] = BIN2BCD(tm->tm_mon + 1); | ||
345 | regs[ISL1208_REG_YR] = BIN2BCD(tm->tm_year - 100); | ||
346 | |||
347 | regs[ISL1208_REG_DW] = BIN2BCD(tm->tm_wday & 7); | ||
348 | |||
349 | sr = isl1208_i2c_get_sr(client); | ||
350 | if (sr < 0) { | ||
351 | dev_err(&client->dev, "%s: reading SR failed\n", __func__); | ||
352 | return sr; | ||
353 | } | ||
354 | |||
355 | /* set WRTC */ | ||
356 | sr = i2c_smbus_write_byte_data (client, ISL1208_REG_SR, | ||
357 | sr | ISL1208_REG_SR_WRTC); | ||
358 | if (sr < 0) { | ||
359 | dev_err(&client->dev, "%s: writing SR failed\n", __func__); | ||
360 | return sr; | ||
361 | } | ||
362 | |||
363 | /* write RTC registers */ | ||
364 | sr = isl1208_i2c_set_regs(client, 0, regs, ISL1208_RTC_SECTION_LEN); | ||
365 | if (sr < 0) { | ||
366 | dev_err(&client->dev, "%s: writing RTC section failed\n", | ||
367 | __func__); | ||
368 | return sr; | ||
369 | } | ||
370 | |||
371 | /* clear WRTC again */ | ||
372 | sr = i2c_smbus_write_byte_data (client, ISL1208_REG_SR, | ||
373 | sr & ~ISL1208_REG_SR_WRTC); | ||
374 | if (sr < 0) { | ||
375 | dev_err(&client->dev, "%s: writing SR failed\n", __func__); | ||
376 | return sr; | ||
377 | } | ||
378 | |||
379 | return 0; | ||
380 | } | ||
381 | |||
382 | |||
383 | static int isl1208_rtc_set_time(struct device *dev, struct rtc_time *tm) | ||
384 | { | ||
385 | return isl1208_i2c_set_time(to_i2c_client(dev), tm); | ||
386 | } | ||
387 | |||
388 | static int isl1208_rtc_read_alarm(struct device *dev, struct rtc_wkalrm *alarm) | ||
389 | { | ||
390 | return isl1208_i2c_read_alarm(to_i2c_client(dev), alarm); | ||
391 | } | ||
392 | |||
393 | static struct rtc_class_ops isl1208_rtc_ops = { | ||
394 | .proc = isl1208_rtc_proc, | ||
395 | .read_time = isl1208_rtc_read_time, | ||
396 | .set_time = isl1208_rtc_set_time, | ||
397 | .read_alarm = isl1208_rtc_read_alarm, | ||
398 | //.set_alarm = isl1208_rtc_set_alarm, | ||
399 | }; | ||
400 | |||
401 | /* sysfs interface */ | ||
402 | |||
403 | static ssize_t isl1208_sysfs_show_atrim(struct device *dev, | ||
404 | struct device_attribute *attr, | ||
405 | char *buf) | ||
406 | { | ||
407 | int atr; | ||
408 | |||
409 | atr = isl1208_i2c_get_atr(to_i2c_client(dev)); | ||
410 | if (atr < 0) | ||
411 | return atr; | ||
412 | |||
413 | return sprintf(buf, "%d.%.2d pF\n", atr>>2, (atr&0x3)*25); | ||
414 | } | ||
415 | static DEVICE_ATTR(atrim, S_IRUGO, isl1208_sysfs_show_atrim, NULL); | ||
416 | |||
417 | static ssize_t isl1208_sysfs_show_dtrim(struct device *dev, | ||
418 | struct device_attribute *attr, | ||
419 | char *buf) | ||
420 | { | ||
421 | int dtr; | ||
422 | |||
423 | dtr = isl1208_i2c_get_dtr(to_i2c_client(dev)); | ||
424 | if (dtr < 0) | ||
425 | return dtr; | ||
426 | |||
427 | return sprintf(buf, "%d ppm\n", dtr); | ||
428 | } | ||
429 | static DEVICE_ATTR(dtrim, S_IRUGO, isl1208_sysfs_show_dtrim, NULL); | ||
430 | |||
431 | static ssize_t isl1208_sysfs_show_usr(struct device *dev, | ||
432 | struct device_attribute *attr, | ||
433 | char *buf) | ||
434 | { | ||
435 | int usr; | ||
436 | |||
437 | usr = isl1208_i2c_get_usr(to_i2c_client(dev)); | ||
438 | if (usr < 0) | ||
439 | return usr; | ||
440 | |||
441 | return sprintf(buf, "0x%.4x\n", usr); | ||
442 | } | ||
443 | |||
444 | static ssize_t isl1208_sysfs_store_usr(struct device *dev, | ||
445 | struct device_attribute *attr, | ||
446 | const char *buf, size_t count) | ||
447 | { | ||
448 | int usr = -1; | ||
449 | |||
450 | if (buf[0] == '0' && (buf[1] == 'x' || buf[1] == 'X')) { | ||
451 | if (sscanf(buf, "%x", &usr) != 1) | ||
452 | return -EINVAL; | ||
453 | } else { | ||
454 | if (sscanf(buf, "%d", &usr) != 1) | ||
455 | return -EINVAL; | ||
456 | } | ||
457 | |||
458 | if (usr < 0 || usr > 0xffff) | ||
459 | return -EINVAL; | ||
460 | |||
461 | return isl1208_i2c_set_usr(to_i2c_client(dev), usr) ? -EIO : count; | ||
462 | } | ||
463 | static DEVICE_ATTR(usr, S_IRUGO | S_IWUSR, isl1208_sysfs_show_usr, | ||
464 | isl1208_sysfs_store_usr); | ||
465 | |||
466 | static int | ||
467 | isl1208_probe(struct i2c_adapter *adapter, int addr, int kind) | ||
468 | { | ||
469 | int rc = 0; | ||
470 | struct i2c_client *new_client = NULL; | ||
471 | struct rtc_device *rtc = NULL; | ||
472 | |||
473 | if (!i2c_check_functionality(adapter, I2C_FUNC_I2C)) { | ||
474 | rc = -ENODEV; | ||
475 | goto failout; | ||
476 | } | ||
477 | |||
478 | new_client = kzalloc(sizeof(struct i2c_client), GFP_KERNEL); | ||
479 | if (new_client == NULL) { | ||
480 | rc = -ENOMEM; | ||
481 | goto failout; | ||
482 | } | ||
483 | |||
484 | new_client->addr = addr; | ||
485 | new_client->adapter = adapter; | ||
486 | new_client->driver = &isl1208_driver; | ||
487 | new_client->flags = 0; | ||
488 | strcpy(new_client->name, DRV_NAME); | ||
489 | |||
490 | if (kind < 0) { | ||
491 | rc = isl1208_i2c_validate_client(new_client); | ||
492 | if (rc < 0) | ||
493 | goto failout; | ||
494 | } | ||
495 | |||
496 | rc = i2c_attach_client(new_client); | ||
497 | if (rc < 0) | ||
498 | goto failout; | ||
499 | |||
500 | dev_info(&new_client->dev, | ||
501 | "chip found, driver version " DRV_VERSION "\n"); | ||
502 | |||
503 | rtc = rtc_device_register(isl1208_driver.driver.name, | ||
504 | &new_client->dev, | ||
505 | &isl1208_rtc_ops, THIS_MODULE); | ||
506 | |||
507 | if (IS_ERR(rtc)) { | ||
508 | rc = PTR_ERR(rtc); | ||
509 | goto failout_detach; | ||
510 | } | ||
511 | |||
512 | i2c_set_clientdata(new_client, rtc); | ||
513 | |||
514 | rc = isl1208_i2c_get_sr(new_client); | ||
515 | if (rc < 0) { | ||
516 | dev_err(&new_client->dev, "reading status failed\n"); | ||
517 | goto failout_unregister; | ||
518 | } | ||
519 | |||
520 | if (rc & ISL1208_REG_SR_RTCF) | ||
521 | dev_warn(&new_client->dev, "rtc power failure detected, " | ||
522 | "please set clock.\n"); | ||
523 | |||
524 | rc = device_create_file(&new_client->dev, &dev_attr_atrim); | ||
525 | if (rc < 0) | ||
526 | goto failout_unregister; | ||
527 | rc = device_create_file(&new_client->dev, &dev_attr_dtrim); | ||
528 | if (rc < 0) | ||
529 | goto failout_atrim; | ||
530 | rc = device_create_file(&new_client->dev, &dev_attr_usr); | ||
531 | if (rc < 0) | ||
532 | goto failout_dtrim; | ||
533 | |||
534 | return 0; | ||
535 | |||
536 | failout_dtrim: | ||
537 | device_remove_file(&new_client->dev, &dev_attr_dtrim); | ||
538 | failout_atrim: | ||
539 | device_remove_file(&new_client->dev, &dev_attr_atrim); | ||
540 | failout_unregister: | ||
541 | rtc_device_unregister(rtc); | ||
542 | failout_detach: | ||
543 | i2c_detach_client(new_client); | ||
544 | failout: | ||
545 | kfree(new_client); | ||
546 | return rc; | ||
547 | } | ||
548 | |||
549 | static int | ||
550 | isl1208_attach_adapter (struct i2c_adapter *adapter) | ||
551 | { | ||
552 | return i2c_probe(adapter, &addr_data, isl1208_probe); | ||
553 | } | ||
554 | |||
555 | static int | ||
556 | isl1208_detach_client(struct i2c_client *client) | ||
557 | { | ||
558 | int rc; | ||
559 | struct rtc_device *const rtc = i2c_get_clientdata(client); | ||
560 | |||
561 | if (rtc) | ||
562 | rtc_device_unregister(rtc); /* do we need to kfree? */ | ||
563 | |||
564 | rc = i2c_detach_client(client); | ||
565 | if (rc) | ||
566 | return rc; | ||
567 | |||
568 | kfree(client); | ||
569 | |||
570 | return 0; | ||
571 | } | ||
572 | |||
573 | /* module management */ | ||
574 | |||
575 | static int __init isl1208_init(void) | ||
576 | { | ||
577 | return i2c_add_driver(&isl1208_driver); | ||
578 | } | ||
579 | |||
580 | static void __exit isl1208_exit(void) | ||
581 | { | ||
582 | i2c_del_driver(&isl1208_driver); | ||
583 | } | ||
584 | |||
585 | MODULE_AUTHOR("Herbert Valerio Riedel <hvr@gnu.org>"); | ||
586 | MODULE_DESCRIPTION("Intersil ISL1208 RTC driver"); | ||
587 | MODULE_LICENSE("GPL"); | ||
588 | MODULE_VERSION(DRV_VERSION); | ||
589 | |||
590 | module_init(isl1208_init); | ||
591 | module_exit(isl1208_exit); | ||
diff --git a/drivers/rtc/rtc-vr41xx.c b/drivers/rtc/rtc-vr41xx.c index bb6d5ff24fd0..596764fd29f5 100644 --- a/drivers/rtc/rtc-vr41xx.c +++ b/drivers/rtc/rtc-vr41xx.c | |||
@@ -30,7 +30,7 @@ | |||
30 | #include <asm/div64.h> | 30 | #include <asm/div64.h> |
31 | #include <asm/io.h> | 31 | #include <asm/io.h> |
32 | #include <asm/uaccess.h> | 32 | #include <asm/uaccess.h> |
33 | #include <asm/vr41xx/vr41xx.h> | 33 | #include <asm/vr41xx/irq.h> |
34 | 34 | ||
35 | MODULE_AUTHOR("Yoichi Yuasa <yoichi_yuasa@tripeaks.co.jp>"); | 35 | MODULE_AUTHOR("Yoichi Yuasa <yoichi_yuasa@tripeaks.co.jp>"); |
36 | MODULE_DESCRIPTION("NEC VR4100 series RTC driver"); | 36 | MODULE_DESCRIPTION("NEC VR4100 series RTC driver"); |
diff --git a/drivers/s390/block/dasd_devmap.c b/drivers/s390/block/dasd_devmap.c index d7295386821c..7f6fdac74706 100644 --- a/drivers/s390/block/dasd_devmap.c +++ b/drivers/s390/block/dasd_devmap.c | |||
@@ -394,7 +394,7 @@ dasd_add_busid(char *bus_id, int features) | |||
394 | if (!new) | 394 | if (!new) |
395 | return ERR_PTR(-ENOMEM); | 395 | return ERR_PTR(-ENOMEM); |
396 | spin_lock(&dasd_devmap_lock); | 396 | spin_lock(&dasd_devmap_lock); |
397 | devmap = 0; | 397 | devmap = NULL; |
398 | hash = dasd_hash_busid(bus_id); | 398 | hash = dasd_hash_busid(bus_id); |
399 | list_for_each_entry(tmp, &dasd_hashlists[hash], list) | 399 | list_for_each_entry(tmp, &dasd_hashlists[hash], list) |
400 | if (strncmp(tmp->bus_id, bus_id, BUS_ID_SIZE) == 0) { | 400 | if (strncmp(tmp->bus_id, bus_id, BUS_ID_SIZE) == 0) { |
@@ -406,10 +406,10 @@ dasd_add_busid(char *bus_id, int features) | |||
406 | new->devindex = dasd_max_devindex++; | 406 | new->devindex = dasd_max_devindex++; |
407 | strncpy(new->bus_id, bus_id, BUS_ID_SIZE); | 407 | strncpy(new->bus_id, bus_id, BUS_ID_SIZE); |
408 | new->features = features; | 408 | new->features = features; |
409 | new->device = 0; | 409 | new->device = NULL; |
410 | list_add(&new->list, &dasd_hashlists[hash]); | 410 | list_add(&new->list, &dasd_hashlists[hash]); |
411 | devmap = new; | 411 | devmap = new; |
412 | new = 0; | 412 | new = NULL; |
413 | } | 413 | } |
414 | spin_unlock(&dasd_devmap_lock); | 414 | spin_unlock(&dasd_devmap_lock); |
415 | kfree(new); | 415 | kfree(new); |
@@ -479,7 +479,7 @@ dasd_device_from_devindex(int devindex) | |||
479 | int i; | 479 | int i; |
480 | 480 | ||
481 | spin_lock(&dasd_devmap_lock); | 481 | spin_lock(&dasd_devmap_lock); |
482 | devmap = 0; | 482 | devmap = NULL; |
483 | for (i = 0; (i < 256) && !devmap; i++) | 483 | for (i = 0; (i < 256) && !devmap; i++) |
484 | list_for_each_entry(tmp, &dasd_hashlists[i], list) | 484 | list_for_each_entry(tmp, &dasd_hashlists[i], list) |
485 | if (tmp->devindex == devindex) { | 485 | if (tmp->devindex == devindex) { |
diff --git a/drivers/s390/block/dasd_eckd.c b/drivers/s390/block/dasd_eckd.c index 2e655f466743..39c2281371b5 100644 --- a/drivers/s390/block/dasd_eckd.c +++ b/drivers/s390/block/dasd_eckd.c | |||
@@ -65,16 +65,16 @@ struct dasd_eckd_private { | |||
65 | /* The ccw bus type uses this table to find devices that it sends to | 65 | /* The ccw bus type uses this table to find devices that it sends to |
66 | * dasd_eckd_probe */ | 66 | * dasd_eckd_probe */ |
67 | static struct ccw_device_id dasd_eckd_ids[] = { | 67 | static struct ccw_device_id dasd_eckd_ids[] = { |
68 | { CCW_DEVICE_DEVTYPE (0x3990, 0, 0x3390, 0), driver_info: 0x1}, | 68 | { CCW_DEVICE_DEVTYPE (0x3990, 0, 0x3390, 0), .driver_info = 0x1}, |
69 | { CCW_DEVICE_DEVTYPE (0x2105, 0, 0x3390, 0), driver_info: 0x2}, | 69 | { CCW_DEVICE_DEVTYPE (0x2105, 0, 0x3390, 0), .driver_info = 0x2}, |
70 | { CCW_DEVICE_DEVTYPE (0x3880, 0, 0x3390, 0), driver_info: 0x3}, | 70 | { CCW_DEVICE_DEVTYPE (0x3880, 0, 0x3390, 0), .driver_info = 0x3}, |
71 | { CCW_DEVICE_DEVTYPE (0x3990, 0, 0x3380, 0), driver_info: 0x4}, | 71 | { CCW_DEVICE_DEVTYPE (0x3990, 0, 0x3380, 0), .driver_info = 0x4}, |
72 | { CCW_DEVICE_DEVTYPE (0x2105, 0, 0x3380, 0), driver_info: 0x5}, | 72 | { CCW_DEVICE_DEVTYPE (0x2105, 0, 0x3380, 0), .driver_info = 0x5}, |
73 | { CCW_DEVICE_DEVTYPE (0x9343, 0, 0x9345, 0), driver_info: 0x6}, | 73 | { CCW_DEVICE_DEVTYPE (0x9343, 0, 0x9345, 0), .driver_info = 0x6}, |
74 | { CCW_DEVICE_DEVTYPE (0x2107, 0, 0x3390, 0), driver_info: 0x7}, | 74 | { CCW_DEVICE_DEVTYPE (0x2107, 0, 0x3390, 0), .driver_info = 0x7}, |
75 | { CCW_DEVICE_DEVTYPE (0x2107, 0, 0x3380, 0), driver_info: 0x8}, | 75 | { CCW_DEVICE_DEVTYPE (0x2107, 0, 0x3380, 0), .driver_info = 0x8}, |
76 | { CCW_DEVICE_DEVTYPE (0x1750, 0, 0x3390, 0), driver_info: 0x9}, | 76 | { CCW_DEVICE_DEVTYPE (0x1750, 0, 0x3390, 0), .driver_info = 0x9}, |
77 | { CCW_DEVICE_DEVTYPE (0x1750, 0, 0x3380, 0), driver_info: 0xa}, | 77 | { CCW_DEVICE_DEVTYPE (0x1750, 0, 0x3380, 0), .driver_info = 0xa}, |
78 | { /* end of list */ }, | 78 | { /* end of list */ }, |
79 | }; | 79 | }; |
80 | 80 | ||
diff --git a/drivers/s390/block/dasd_fba.c b/drivers/s390/block/dasd_fba.c index 808434d38526..e85015be109b 100644 --- a/drivers/s390/block/dasd_fba.c +++ b/drivers/s390/block/dasd_fba.c | |||
@@ -44,8 +44,8 @@ struct dasd_fba_private { | |||
44 | }; | 44 | }; |
45 | 45 | ||
46 | static struct ccw_device_id dasd_fba_ids[] = { | 46 | static struct ccw_device_id dasd_fba_ids[] = { |
47 | { CCW_DEVICE_DEVTYPE (0x6310, 0, 0x9336, 0), driver_info: 0x1}, | 47 | { CCW_DEVICE_DEVTYPE (0x6310, 0, 0x9336, 0), .driver_info = 0x1}, |
48 | { CCW_DEVICE_DEVTYPE (0x3880, 0, 0x3370, 0), driver_info: 0x2}, | 48 | { CCW_DEVICE_DEVTYPE (0x3880, 0, 0x3370, 0), .driver_info = 0x2}, |
49 | { /* end of list */ }, | 49 | { /* end of list */ }, |
50 | }; | 50 | }; |
51 | 51 | ||
diff --git a/drivers/s390/block/dasd_genhd.c b/drivers/s390/block/dasd_genhd.c index 12c7d296eaa8..4c272b70f41a 100644 --- a/drivers/s390/block/dasd_genhd.c +++ b/drivers/s390/block/dasd_genhd.c | |||
@@ -84,9 +84,9 @@ void | |||
84 | dasd_gendisk_free(struct dasd_device *device) | 84 | dasd_gendisk_free(struct dasd_device *device) |
85 | { | 85 | { |
86 | del_gendisk(device->gdp); | 86 | del_gendisk(device->gdp); |
87 | device->gdp->queue = 0; | 87 | device->gdp->queue = NULL; |
88 | put_disk(device->gdp); | 88 | put_disk(device->gdp); |
89 | device->gdp = 0; | 89 | device->gdp = NULL; |
90 | } | 90 | } |
91 | 91 | ||
92 | /* | 92 | /* |
@@ -136,7 +136,7 @@ dasd_destroy_partitions(struct dasd_device * device) | |||
136 | * device->bdev to lower the offline open_count limit again. | 136 | * device->bdev to lower the offline open_count limit again. |
137 | */ | 137 | */ |
138 | bdev = device->bdev; | 138 | bdev = device->bdev; |
139 | device->bdev = 0; | 139 | device->bdev = NULL; |
140 | 140 | ||
141 | /* | 141 | /* |
142 | * See fs/partition/check.c:delete_partition | 142 | * See fs/partition/check.c:delete_partition |
@@ -145,7 +145,7 @@ dasd_destroy_partitions(struct dasd_device * device) | |||
145 | */ | 145 | */ |
146 | memset(&bpart, 0, sizeof(struct blkpg_partition)); | 146 | memset(&bpart, 0, sizeof(struct blkpg_partition)); |
147 | memset(&barg, 0, sizeof(struct blkpg_ioctl_arg)); | 147 | memset(&barg, 0, sizeof(struct blkpg_ioctl_arg)); |
148 | barg.data = &bpart; | 148 | barg.data = (void __user *) &bpart; |
149 | barg.op = BLKPG_DEL_PARTITION; | 149 | barg.op = BLKPG_DEL_PARTITION; |
150 | for (bpart.pno = device->gdp->minors - 1; bpart.pno > 0; bpart.pno--) | 150 | for (bpart.pno = device->gdp->minors - 1; bpart.pno > 0; bpart.pno--) |
151 | ioctl_by_bdev(bdev, BLKPG, (unsigned long) &barg); | 151 | ioctl_by_bdev(bdev, BLKPG, (unsigned long) &barg); |
diff --git a/drivers/s390/block/dasd_ioctl.c b/drivers/s390/block/dasd_ioctl.c index e97f5316ad2d..8fed3603e9ea 100644 --- a/drivers/s390/block/dasd_ioctl.c +++ b/drivers/s390/block/dasd_ioctl.c | |||
@@ -345,7 +345,7 @@ dasd_ioctl_set_ro(struct block_device *bdev, void __user *argp) | |||
345 | if (bdev != bdev->bd_contains) | 345 | if (bdev != bdev->bd_contains) |
346 | // ro setting is not allowed for partitions | 346 | // ro setting is not allowed for partitions |
347 | return -EINVAL; | 347 | return -EINVAL; |
348 | if (get_user(intval, (int *)argp)) | 348 | if (get_user(intval, (int __user *)argp)) |
349 | return -EFAULT; | 349 | return -EFAULT; |
350 | 350 | ||
351 | set_disk_ro(bdev->bd_disk, intval); | 351 | set_disk_ro(bdev->bd_disk, intval); |
diff --git a/drivers/s390/block/xpram.c b/drivers/s390/block/xpram.c index 4c1e56b9b98d..4cd879cb9bdd 100644 --- a/drivers/s390/block/xpram.c +++ b/drivers/s390/block/xpram.c | |||
@@ -71,11 +71,11 @@ static int xpram_devs; | |||
71 | /* | 71 | /* |
72 | * Parameter parsing functions. | 72 | * Parameter parsing functions. |
73 | */ | 73 | */ |
74 | static int devs = XPRAM_DEVS; | 74 | static int __initdata devs = XPRAM_DEVS; |
75 | static unsigned int sizes[XPRAM_MAX_DEVS]; | 75 | static char __initdata *sizes[XPRAM_MAX_DEVS]; |
76 | 76 | ||
77 | module_param(devs, int, 0); | 77 | module_param(devs, int, 0); |
78 | module_param_array(sizes, int, NULL, 0); | 78 | module_param_array(sizes, charp, NULL, 0); |
79 | 79 | ||
80 | MODULE_PARM_DESC(devs, "number of devices (\"partitions\"), " \ | 80 | MODULE_PARM_DESC(devs, "number of devices (\"partitions\"), " \ |
81 | "the default is " __MODULE_STRING(XPRAM_DEVS) "\n"); | 81 | "the default is " __MODULE_STRING(XPRAM_DEVS) "\n"); |
@@ -86,59 +86,6 @@ MODULE_PARM_DESC(sizes, "list of device (partition) sizes " \ | |||
86 | "claimed by explicit sizes\n"); | 86 | "claimed by explicit sizes\n"); |
87 | MODULE_LICENSE("GPL"); | 87 | MODULE_LICENSE("GPL"); |
88 | 88 | ||
89 | #ifndef MODULE | ||
90 | /* | ||
91 | * Parses the kernel parameters given in the kernel parameter line. | ||
92 | * The expected format is | ||
93 | * <number_of_partitions>[","<partition_size>]* | ||
94 | * where | ||
95 | * devices is a positive integer that initializes xpram_devs | ||
96 | * each size is a non-negative integer possibly followed by a | ||
97 | * magnitude (k,K,m,M,g,G), the list of sizes initialises | ||
98 | * xpram_sizes | ||
99 | * | ||
100 | * Arguments | ||
101 | * str: substring of kernel parameter line that contains xprams | ||
102 | * kernel parameters. | ||
103 | * | ||
104 | * Result 0 on success, -EINVAL else -- only for Version > 2.3 | ||
105 | * | ||
106 | * Side effects | ||
107 | * the global variabls devs is set to the value of | ||
108 | * <number_of_partitions> and sizes[i] is set to the i-th | ||
109 | * partition size (if provided). A parsing error of a value | ||
110 | * results in this value being set to -EINVAL. | ||
111 | */ | ||
112 | static int __init xpram_setup (char *str) | ||
113 | { | ||
114 | char *cp; | ||
115 | int i; | ||
116 | |||
117 | devs = simple_strtoul(str, &cp, 10); | ||
118 | if (cp <= str || devs > XPRAM_MAX_DEVS) | ||
119 | return 0; | ||
120 | for (i = 0; (i < devs) && (*cp++ == ','); i++) { | ||
121 | sizes[i] = simple_strtoul(cp, &cp, 10); | ||
122 | if (*cp == 'g' || *cp == 'G') { | ||
123 | sizes[i] <<= 20; | ||
124 | cp++; | ||
125 | } else if (*cp == 'm' || *cp == 'M') { | ||
126 | sizes[i] <<= 10; | ||
127 | cp++; | ||
128 | } else if (*cp == 'k' || *cp == 'K') | ||
129 | cp++; | ||
130 | while (isspace(*cp)) cp++; | ||
131 | } | ||
132 | if (*cp == ',' && i >= devs) | ||
133 | PRINT_WARN("partition sizes list has too many entries.\n"); | ||
134 | else if (*cp != 0) | ||
135 | PRINT_WARN("ignored '%s' at end of parameter string.\n", cp); | ||
136 | return 1; | ||
137 | } | ||
138 | |||
139 | __setup("xpram_parts=", xpram_setup); | ||
140 | #endif | ||
141 | |||
142 | /* | 89 | /* |
143 | * Copy expanded memory page (4kB) into main memory | 90 | * Copy expanded memory page (4kB) into main memory |
144 | * Arguments | 91 | * Arguments |
@@ -374,7 +321,9 @@ static int __init xpram_setup_sizes(unsigned long pages) | |||
374 | mem_needed = 0; | 321 | mem_needed = 0; |
375 | mem_auto_no = 0; | 322 | mem_auto_no = 0; |
376 | for (i = 0; i < xpram_devs; i++) { | 323 | for (i = 0; i < xpram_devs; i++) { |
377 | xpram_sizes[i] = (sizes[i] + 3) & -4UL; | 324 | if (sizes[i]) |
325 | xpram_sizes[i] = | ||
326 | (memparse(sizes[i], &sizes[i]) + 3) & -4UL; | ||
378 | if (xpram_sizes[i]) | 327 | if (xpram_sizes[i]) |
379 | mem_needed += xpram_sizes[i]; | 328 | mem_needed += xpram_sizes[i]; |
380 | else | 329 | else |
diff --git a/drivers/s390/char/con3215.c b/drivers/s390/char/con3215.c index f25c6d116f6f..2fa566fa6da4 100644 --- a/drivers/s390/char/con3215.c +++ b/drivers/s390/char/con3215.c | |||
@@ -693,7 +693,7 @@ raw3215_probe (struct ccw_device *cdev) | |||
693 | GFP_KERNEL|GFP_DMA); | 693 | GFP_KERNEL|GFP_DMA); |
694 | if (raw->buffer == NULL) { | 694 | if (raw->buffer == NULL) { |
695 | spin_lock(&raw3215_device_lock); | 695 | spin_lock(&raw3215_device_lock); |
696 | raw3215[line] = 0; | 696 | raw3215[line] = NULL; |
697 | spin_unlock(&raw3215_device_lock); | 697 | spin_unlock(&raw3215_device_lock); |
698 | kfree(raw); | 698 | kfree(raw); |
699 | return -ENOMEM; | 699 | return -ENOMEM; |
diff --git a/drivers/s390/char/ctrlchar.c b/drivers/s390/char/ctrlchar.c index 0ea6f36a2527..d83eb6358bac 100644 --- a/drivers/s390/char/ctrlchar.c +++ b/drivers/s390/char/ctrlchar.c | |||
@@ -23,7 +23,7 @@ ctrlchar_handle_sysrq(void *tty) | |||
23 | handle_sysrq(ctrlchar_sysrq_key, NULL, (struct tty_struct *) tty); | 23 | handle_sysrq(ctrlchar_sysrq_key, NULL, (struct tty_struct *) tty); |
24 | } | 24 | } |
25 | 25 | ||
26 | static DECLARE_WORK(ctrlchar_work, ctrlchar_handle_sysrq, 0); | 26 | static DECLARE_WORK(ctrlchar_work, ctrlchar_handle_sysrq, NULL); |
27 | #endif | 27 | #endif |
28 | 28 | ||
29 | 29 | ||
diff --git a/drivers/s390/char/defkeymap.c b/drivers/s390/char/defkeymap.c index ca15adb140d1..17027d918cf7 100644 --- a/drivers/s390/char/defkeymap.c +++ b/drivers/s390/char/defkeymap.c | |||
@@ -83,8 +83,8 @@ static u_short shift_ctrl_map[NR_KEYS] = { | |||
83 | }; | 83 | }; |
84 | 84 | ||
85 | ushort *key_maps[MAX_NR_KEYMAPS] = { | 85 | ushort *key_maps[MAX_NR_KEYMAPS] = { |
86 | plain_map, shift_map, 0, 0, | 86 | plain_map, shift_map, NULL, NULL, |
87 | ctrl_map, shift_ctrl_map, 0 | 87 | ctrl_map, shift_ctrl_map, NULL, |
88 | }; | 88 | }; |
89 | 89 | ||
90 | unsigned int keymap_count = 4; | 90 | unsigned int keymap_count = 4; |
@@ -145,7 +145,7 @@ char *func_table[MAX_NR_FUNC] = { | |||
145 | func_buf + 97, | 145 | func_buf + 97, |
146 | func_buf + 103, | 146 | func_buf + 103, |
147 | func_buf + 109, | 147 | func_buf + 109, |
148 | 0, | 148 | NULL, |
149 | }; | 149 | }; |
150 | 150 | ||
151 | struct kbdiacr accent_table[MAX_DIACR] = { | 151 | struct kbdiacr accent_table[MAX_DIACR] = { |
diff --git a/drivers/s390/char/fs3270.c b/drivers/s390/char/fs3270.c index 6099c14de429..ef004d089712 100644 --- a/drivers/s390/char/fs3270.c +++ b/drivers/s390/char/fs3270.c | |||
@@ -236,7 +236,7 @@ fs3270_irq(struct fs3270 *fp, struct raw3270_request *rq, struct irb *irb) | |||
236 | * Process reads from fullscreen 3270. | 236 | * Process reads from fullscreen 3270. |
237 | */ | 237 | */ |
238 | static ssize_t | 238 | static ssize_t |
239 | fs3270_read(struct file *filp, char *data, size_t count, loff_t *off) | 239 | fs3270_read(struct file *filp, char __user *data, size_t count, loff_t *off) |
240 | { | 240 | { |
241 | struct fs3270 *fp; | 241 | struct fs3270 *fp; |
242 | struct raw3270_request *rq; | 242 | struct raw3270_request *rq; |
@@ -281,7 +281,7 @@ fs3270_read(struct file *filp, char *data, size_t count, loff_t *off) | |||
281 | * Process writes to fullscreen 3270. | 281 | * Process writes to fullscreen 3270. |
282 | */ | 282 | */ |
283 | static ssize_t | 283 | static ssize_t |
284 | fs3270_write(struct file *filp, const char *data, size_t count, loff_t *off) | 284 | fs3270_write(struct file *filp, const char __user *data, size_t count, loff_t *off) |
285 | { | 285 | { |
286 | struct fs3270 *fp; | 286 | struct fs3270 *fp; |
287 | struct raw3270_request *rq; | 287 | struct raw3270_request *rq; |
@@ -338,10 +338,10 @@ fs3270_ioctl(struct file *filp, unsigned int cmd, unsigned long arg) | |||
338 | fp->write_command = arg; | 338 | fp->write_command = arg; |
339 | break; | 339 | break; |
340 | case TUBGETI: | 340 | case TUBGETI: |
341 | rc = put_user(fp->read_command, (char *) arg); | 341 | rc = put_user(fp->read_command, (char __user *) arg); |
342 | break; | 342 | break; |
343 | case TUBGETO: | 343 | case TUBGETO: |
344 | rc = put_user(fp->write_command,(char *) arg); | 344 | rc = put_user(fp->write_command,(char __user *) arg); |
345 | break; | 345 | break; |
346 | case TUBGETMOD: | 346 | case TUBGETMOD: |
347 | iocb.model = fp->view.model; | 347 | iocb.model = fp->view.model; |
@@ -350,7 +350,7 @@ fs3270_ioctl(struct file *filp, unsigned int cmd, unsigned long arg) | |||
350 | iocb.pf_cnt = 24; | 350 | iocb.pf_cnt = 24; |
351 | iocb.re_cnt = 20; | 351 | iocb.re_cnt = 20; |
352 | iocb.map = 0; | 352 | iocb.map = 0; |
353 | if (copy_to_user((char *) arg, &iocb, | 353 | if (copy_to_user((char __user *) arg, &iocb, |
354 | sizeof(struct raw3270_iocb))) | 354 | sizeof(struct raw3270_iocb))) |
355 | rc = -EFAULT; | 355 | rc = -EFAULT; |
356 | break; | 356 | break; |
@@ -479,7 +479,7 @@ fs3270_close(struct inode *inode, struct file *filp) | |||
479 | struct fs3270 *fp; | 479 | struct fs3270 *fp; |
480 | 480 | ||
481 | fp = filp->private_data; | 481 | fp = filp->private_data; |
482 | filp->private_data = 0; | 482 | filp->private_data = NULL; |
483 | if (fp) { | 483 | if (fp) { |
484 | fp->fs_pid = 0; | 484 | fp->fs_pid = 0; |
485 | raw3270_reset(&fp->view); | 485 | raw3270_reset(&fp->view); |
diff --git a/drivers/s390/char/keyboard.c b/drivers/s390/char/keyboard.c index 547ef906ae2c..3be06569180d 100644 --- a/drivers/s390/char/keyboard.c +++ b/drivers/s390/char/keyboard.c | |||
@@ -103,7 +103,7 @@ out_maps: | |||
103 | out_kbd: | 103 | out_kbd: |
104 | kfree(kbd); | 104 | kfree(kbd); |
105 | out: | 105 | out: |
106 | return 0; | 106 | return NULL; |
107 | } | 107 | } |
108 | 108 | ||
109 | void | 109 | void |
@@ -304,7 +304,7 @@ kbd_keycode(struct kbd_data *kbd, unsigned int keycode) | |||
304 | if (kbd->sysrq) { | 304 | if (kbd->sysrq) { |
305 | if (kbd->sysrq == K(KT_LATIN, '-')) { | 305 | if (kbd->sysrq == K(KT_LATIN, '-')) { |
306 | kbd->sysrq = 0; | 306 | kbd->sysrq = 0; |
307 | handle_sysrq(value, 0, kbd->tty); | 307 | handle_sysrq(value, NULL, kbd->tty); |
308 | return; | 308 | return; |
309 | } | 309 | } |
310 | if (value == '-') { | 310 | if (value == '-') { |
@@ -363,7 +363,7 @@ do_kdsk_ioctl(struct kbd_data *kbd, struct kbentry __user *user_kbe, | |||
363 | /* disallocate map */ | 363 | /* disallocate map */ |
364 | key_map = kbd->key_maps[tmp.kb_table]; | 364 | key_map = kbd->key_maps[tmp.kb_table]; |
365 | if (key_map) { | 365 | if (key_map) { |
366 | kbd->key_maps[tmp.kb_table] = 0; | 366 | kbd->key_maps[tmp.kb_table] = NULL; |
367 | kfree(key_map); | 367 | kfree(key_map); |
368 | } | 368 | } |
369 | break; | 369 | break; |
diff --git a/drivers/s390/char/raw3270.c b/drivers/s390/char/raw3270.c index e95b56f810db..95e285b2e25c 100644 --- a/drivers/s390/char/raw3270.c +++ b/drivers/s390/char/raw3270.c | |||
@@ -555,7 +555,7 @@ raw3270_start_init(struct raw3270 *rp, struct raw3270_view *view, | |||
555 | #ifdef CONFIG_TN3270_CONSOLE | 555 | #ifdef CONFIG_TN3270_CONSOLE |
556 | if (raw3270_registered == 0) { | 556 | if (raw3270_registered == 0) { |
557 | spin_lock_irqsave(get_ccwdev_lock(view->dev->cdev), flags); | 557 | spin_lock_irqsave(get_ccwdev_lock(view->dev->cdev), flags); |
558 | rq->callback = 0; | 558 | rq->callback = NULL; |
559 | rc = __raw3270_start(rp, view, rq); | 559 | rc = __raw3270_start(rp, view, rq); |
560 | if (rc == 0) | 560 | if (rc == 0) |
561 | while (!raw3270_request_final(rq)) { | 561 | while (!raw3270_request_final(rq)) { |
@@ -719,8 +719,8 @@ raw3270_size_device(struct raw3270 *rp) | |||
719 | rc = __raw3270_size_device_vm(rp); | 719 | rc = __raw3270_size_device_vm(rp); |
720 | else | 720 | else |
721 | rc = __raw3270_size_device(rp); | 721 | rc = __raw3270_size_device(rp); |
722 | raw3270_init_view.dev = 0; | 722 | raw3270_init_view.dev = NULL; |
723 | rp->view = 0; | 723 | rp->view = NULL; |
724 | up(&raw3270_init_sem); | 724 | up(&raw3270_init_sem); |
725 | if (rc == 0) { /* Found something. */ | 725 | if (rc == 0) { /* Found something. */ |
726 | /* Try to find a model. */ | 726 | /* Try to find a model. */ |
@@ -761,8 +761,8 @@ raw3270_reset_device(struct raw3270 *rp) | |||
761 | rp->view = &raw3270_init_view; | 761 | rp->view = &raw3270_init_view; |
762 | raw3270_init_view.dev = rp; | 762 | raw3270_init_view.dev = rp; |
763 | rc = raw3270_start_init(rp, &raw3270_init_view, &rp->init_request); | 763 | rc = raw3270_start_init(rp, &raw3270_init_view, &rp->init_request); |
764 | raw3270_init_view.dev = 0; | 764 | raw3270_init_view.dev = NULL; |
765 | rp->view = 0; | 765 | rp->view = NULL; |
766 | up(&raw3270_init_sem); | 766 | up(&raw3270_init_sem); |
767 | return rc; | 767 | return rc; |
768 | } | 768 | } |
@@ -934,7 +934,7 @@ raw3270_activate_view(struct raw3270_view *view) | |||
934 | else if (!test_bit(RAW3270_FLAGS_READY, &rp->flags)) | 934 | else if (!test_bit(RAW3270_FLAGS_READY, &rp->flags)) |
935 | rc = -ENODEV; | 935 | rc = -ENODEV; |
936 | else { | 936 | else { |
937 | oldview = 0; | 937 | oldview = NULL; |
938 | if (rp->view) { | 938 | if (rp->view) { |
939 | oldview = rp->view; | 939 | oldview = rp->view; |
940 | oldview->fn->deactivate(oldview); | 940 | oldview->fn->deactivate(oldview); |
@@ -951,7 +951,7 @@ raw3270_activate_view(struct raw3270_view *view) | |||
951 | rp->view = nv; | 951 | rp->view = nv; |
952 | if (nv->fn->activate(nv) == 0) | 952 | if (nv->fn->activate(nv) == 0) |
953 | break; | 953 | break; |
954 | rp->view = 0; | 954 | rp->view = NULL; |
955 | } | 955 | } |
956 | } | 956 | } |
957 | } | 957 | } |
@@ -975,7 +975,7 @@ raw3270_deactivate_view(struct raw3270_view *view) | |||
975 | spin_lock_irqsave(get_ccwdev_lock(rp->cdev), flags); | 975 | spin_lock_irqsave(get_ccwdev_lock(rp->cdev), flags); |
976 | if (rp->view == view) { | 976 | if (rp->view == view) { |
977 | view->fn->deactivate(view); | 977 | view->fn->deactivate(view); |
978 | rp->view = 0; | 978 | rp->view = NULL; |
979 | /* Move deactivated view to end of list. */ | 979 | /* Move deactivated view to end of list. */ |
980 | list_del_init(&view->list); | 980 | list_del_init(&view->list); |
981 | list_add_tail(&view->list, &rp->view_list); | 981 | list_add_tail(&view->list, &rp->view_list); |
@@ -985,7 +985,7 @@ raw3270_deactivate_view(struct raw3270_view *view) | |||
985 | rp->view = view; | 985 | rp->view = view; |
986 | if (view->fn->activate(view) == 0) | 986 | if (view->fn->activate(view) == 0) |
987 | break; | 987 | break; |
988 | rp->view = 0; | 988 | rp->view = NULL; |
989 | } | 989 | } |
990 | } | 990 | } |
991 | } | 991 | } |
@@ -1076,7 +1076,7 @@ raw3270_del_view(struct raw3270_view *view) | |||
1076 | spin_lock_irqsave(get_ccwdev_lock(rp->cdev), flags); | 1076 | spin_lock_irqsave(get_ccwdev_lock(rp->cdev), flags); |
1077 | if (rp->view == view) { | 1077 | if (rp->view == view) { |
1078 | view->fn->deactivate(view); | 1078 | view->fn->deactivate(view); |
1079 | rp->view = 0; | 1079 | rp->view = NULL; |
1080 | } | 1080 | } |
1081 | list_del_init(&view->list); | 1081 | list_del_init(&view->list); |
1082 | if (!rp->view && test_bit(RAW3270_FLAGS_READY, &rp->flags)) { | 1082 | if (!rp->view && test_bit(RAW3270_FLAGS_READY, &rp->flags)) { |
@@ -1117,9 +1117,9 @@ raw3270_delete_device(struct raw3270 *rp) | |||
1117 | 1117 | ||
1118 | /* Disconnect from ccw_device. */ | 1118 | /* Disconnect from ccw_device. */ |
1119 | cdev = rp->cdev; | 1119 | cdev = rp->cdev; |
1120 | rp->cdev = 0; | 1120 | rp->cdev = NULL; |
1121 | cdev->dev.driver_data = 0; | 1121 | cdev->dev.driver_data = NULL; |
1122 | cdev->handler = 0; | 1122 | cdev->handler = NULL; |
1123 | 1123 | ||
1124 | /* Put ccw_device structure. */ | 1124 | /* Put ccw_device structure. */ |
1125 | put_device(&cdev->dev); | 1125 | put_device(&cdev->dev); |
@@ -1144,7 +1144,7 @@ raw3270_model_show(struct device *dev, struct device_attribute *attr, char *buf) | |||
1144 | return snprintf(buf, PAGE_SIZE, "%i\n", | 1144 | return snprintf(buf, PAGE_SIZE, "%i\n", |
1145 | ((struct raw3270 *) dev->driver_data)->model); | 1145 | ((struct raw3270 *) dev->driver_data)->model); |
1146 | } | 1146 | } |
1147 | static DEVICE_ATTR(model, 0444, raw3270_model_show, 0); | 1147 | static DEVICE_ATTR(model, 0444, raw3270_model_show, NULL); |
1148 | 1148 | ||
1149 | static ssize_t | 1149 | static ssize_t |
1150 | raw3270_rows_show(struct device *dev, struct device_attribute *attr, char *buf) | 1150 | raw3270_rows_show(struct device *dev, struct device_attribute *attr, char *buf) |
@@ -1152,7 +1152,7 @@ raw3270_rows_show(struct device *dev, struct device_attribute *attr, char *buf) | |||
1152 | return snprintf(buf, PAGE_SIZE, "%i\n", | 1152 | return snprintf(buf, PAGE_SIZE, "%i\n", |
1153 | ((struct raw3270 *) dev->driver_data)->rows); | 1153 | ((struct raw3270 *) dev->driver_data)->rows); |
1154 | } | 1154 | } |
1155 | static DEVICE_ATTR(rows, 0444, raw3270_rows_show, 0); | 1155 | static DEVICE_ATTR(rows, 0444, raw3270_rows_show, NULL); |
1156 | 1156 | ||
1157 | static ssize_t | 1157 | static ssize_t |
1158 | raw3270_columns_show(struct device *dev, struct device_attribute *attr, char *buf) | 1158 | raw3270_columns_show(struct device *dev, struct device_attribute *attr, char *buf) |
@@ -1160,7 +1160,7 @@ raw3270_columns_show(struct device *dev, struct device_attribute *attr, char *bu | |||
1160 | return snprintf(buf, PAGE_SIZE, "%i\n", | 1160 | return snprintf(buf, PAGE_SIZE, "%i\n", |
1161 | ((struct raw3270 *) dev->driver_data)->cols); | 1161 | ((struct raw3270 *) dev->driver_data)->cols); |
1162 | } | 1162 | } |
1163 | static DEVICE_ATTR(columns, 0444, raw3270_columns_show, 0); | 1163 | static DEVICE_ATTR(columns, 0444, raw3270_columns_show, NULL); |
1164 | 1164 | ||
1165 | static struct attribute * raw3270_attrs[] = { | 1165 | static struct attribute * raw3270_attrs[] = { |
1166 | &dev_attr_model.attr, | 1166 | &dev_attr_model.attr, |
@@ -1296,7 +1296,7 @@ raw3270_remove (struct ccw_device *cdev) | |||
1296 | spin_lock_irqsave(get_ccwdev_lock(cdev), flags); | 1296 | spin_lock_irqsave(get_ccwdev_lock(cdev), flags); |
1297 | if (rp->view) { | 1297 | if (rp->view) { |
1298 | rp->view->fn->deactivate(rp->view); | 1298 | rp->view->fn->deactivate(rp->view); |
1299 | rp->view = 0; | 1299 | rp->view = NULL; |
1300 | } | 1300 | } |
1301 | while (!list_empty(&rp->view_list)) { | 1301 | while (!list_empty(&rp->view_list)) { |
1302 | v = list_entry(rp->view_list.next, struct raw3270_view, list); | 1302 | v = list_entry(rp->view_list.next, struct raw3270_view, list); |
diff --git a/drivers/s390/char/raw3270.h b/drivers/s390/char/raw3270.h index b635bf8e7775..90beaa80a782 100644 --- a/drivers/s390/char/raw3270.h +++ b/drivers/s390/char/raw3270.h | |||
@@ -231,7 +231,7 @@ alloc_string(struct list_head *free_list, unsigned long len) | |||
231 | INIT_LIST_HEAD(&cs->update); | 231 | INIT_LIST_HEAD(&cs->update); |
232 | return cs; | 232 | return cs; |
233 | } | 233 | } |
234 | return 0; | 234 | return NULL; |
235 | } | 235 | } |
236 | 236 | ||
237 | static inline unsigned long | 237 | static inline unsigned long |
diff --git a/drivers/s390/char/tape_34xx.c b/drivers/s390/char/tape_34xx.c index 48b4d30a7256..7b95dab913d0 100644 --- a/drivers/s390/char/tape_34xx.c +++ b/drivers/s390/char/tape_34xx.c | |||
@@ -1309,9 +1309,9 @@ static struct tape_discipline tape_discipline_34xx = { | |||
1309 | }; | 1309 | }; |
1310 | 1310 | ||
1311 | static struct ccw_device_id tape_34xx_ids[] = { | 1311 | static struct ccw_device_id tape_34xx_ids[] = { |
1312 | { CCW_DEVICE_DEVTYPE(0x3480, 0, 0x3480, 0), driver_info: tape_3480}, | 1312 | { CCW_DEVICE_DEVTYPE(0x3480, 0, 0x3480, 0), .driver_info = tape_3480}, |
1313 | { CCW_DEVICE_DEVTYPE(0x3490, 0, 0x3490, 0), driver_info: tape_3490}, | 1313 | { CCW_DEVICE_DEVTYPE(0x3490, 0, 0x3490, 0), .driver_info = tape_3490}, |
1314 | { /* end of list */ } | 1314 | { /* end of list */ }, |
1315 | }; | 1315 | }; |
1316 | 1316 | ||
1317 | static int | 1317 | static int |
diff --git a/drivers/s390/char/tty3270.c b/drivers/s390/char/tty3270.c index f496f236b9c0..29718042c6c9 100644 --- a/drivers/s390/char/tty3270.c +++ b/drivers/s390/char/tty3270.c | |||
@@ -437,7 +437,7 @@ tty3270_rcl_add(struct tty3270 *tp, char *input, int len) | |||
437 | { | 437 | { |
438 | struct string *s; | 438 | struct string *s; |
439 | 439 | ||
440 | tp->rcl_walk = 0; | 440 | tp->rcl_walk = NULL; |
441 | if (len <= 0) | 441 | if (len <= 0) |
442 | return; | 442 | return; |
443 | if (tp->rcl_nr >= tp->rcl_max) { | 443 | if (tp->rcl_nr >= tp->rcl_max) { |
@@ -466,12 +466,12 @@ tty3270_rcl_backward(struct kbd_data *kbd) | |||
466 | else if (!list_empty(&tp->rcl_lines)) | 466 | else if (!list_empty(&tp->rcl_lines)) |
467 | tp->rcl_walk = tp->rcl_lines.prev; | 467 | tp->rcl_walk = tp->rcl_lines.prev; |
468 | s = tp->rcl_walk ? | 468 | s = tp->rcl_walk ? |
469 | list_entry(tp->rcl_walk, struct string, list) : 0; | 469 | list_entry(tp->rcl_walk, struct string, list) : NULL; |
470 | if (tp->rcl_walk) { | 470 | if (tp->rcl_walk) { |
471 | s = list_entry(tp->rcl_walk, struct string, list); | 471 | s = list_entry(tp->rcl_walk, struct string, list); |
472 | tty3270_update_prompt(tp, s->string, s->len); | 472 | tty3270_update_prompt(tp, s->string, s->len); |
473 | } else | 473 | } else |
474 | tty3270_update_prompt(tp, 0, 0); | 474 | tty3270_update_prompt(tp, NULL, 0); |
475 | tty3270_set_timer(tp, 1); | 475 | tty3270_set_timer(tp, 1); |
476 | } | 476 | } |
477 | spin_unlock_bh(&tp->view.lock); | 477 | spin_unlock_bh(&tp->view.lock); |
@@ -553,7 +553,7 @@ tty3270_read_tasklet(struct raw3270_request *rrq) | |||
553 | * has to be emitted to the tty and for 0x6d the screen | 553 | * has to be emitted to the tty and for 0x6d the screen |
554 | * needs to be redrawn. | 554 | * needs to be redrawn. |
555 | */ | 555 | */ |
556 | input = 0; | 556 | input = NULL; |
557 | len = 0; | 557 | len = 0; |
558 | if (tp->input->string[0] == 0x7d) { | 558 | if (tp->input->string[0] == 0x7d) { |
559 | /* Enter: write input to tty. */ | 559 | /* Enter: write input to tty. */ |
@@ -567,7 +567,7 @@ tty3270_read_tasklet(struct raw3270_request *rrq) | |||
567 | tty3270_update_status(tp); | 567 | tty3270_update_status(tp); |
568 | } | 568 | } |
569 | /* Clear input area. */ | 569 | /* Clear input area. */ |
570 | tty3270_update_prompt(tp, 0, 0); | 570 | tty3270_update_prompt(tp, NULL, 0); |
571 | tty3270_set_timer(tp, 1); | 571 | tty3270_set_timer(tp, 1); |
572 | } else if (tp->input->string[0] == 0x6d) { | 572 | } else if (tp->input->string[0] == 0x6d) { |
573 | /* Display has been cleared. Redraw. */ | 573 | /* Display has been cleared. Redraw. */ |
@@ -808,8 +808,8 @@ tty3270_release(struct raw3270_view *view) | |||
808 | tp = (struct tty3270 *) view; | 808 | tp = (struct tty3270 *) view; |
809 | tty = tp->tty; | 809 | tty = tp->tty; |
810 | if (tty) { | 810 | if (tty) { |
811 | tty->driver_data = 0; | 811 | tty->driver_data = NULL; |
812 | tp->tty = tp->kbd->tty = 0; | 812 | tp->tty = tp->kbd->tty = NULL; |
813 | tty_hangup(tty); | 813 | tty_hangup(tty); |
814 | raw3270_put_view(&tp->view); | 814 | raw3270_put_view(&tp->view); |
815 | } | 815 | } |
@@ -948,8 +948,8 @@ tty3270_close(struct tty_struct *tty, struct file * filp) | |||
948 | return; | 948 | return; |
949 | tp = (struct tty3270 *) tty->driver_data; | 949 | tp = (struct tty3270 *) tty->driver_data; |
950 | if (tp) { | 950 | if (tp) { |
951 | tty->driver_data = 0; | 951 | tty->driver_data = NULL; |
952 | tp->tty = tp->kbd->tty = 0; | 952 | tp->tty = tp->kbd->tty = NULL; |
953 | raw3270_put_view(&tp->view); | 953 | raw3270_put_view(&tp->view); |
954 | } | 954 | } |
955 | } | 955 | } |
@@ -1673,7 +1673,7 @@ tty3270_set_termios(struct tty_struct *tty, struct termios *old) | |||
1673 | new = L_ECHO(tty) ? TF_INPUT: TF_INPUTN; | 1673 | new = L_ECHO(tty) ? TF_INPUT: TF_INPUTN; |
1674 | if (new != tp->inattr) { | 1674 | if (new != tp->inattr) { |
1675 | tp->inattr = new; | 1675 | tp->inattr = new; |
1676 | tty3270_update_prompt(tp, 0, 0); | 1676 | tty3270_update_prompt(tp, NULL, 0); |
1677 | tty3270_set_timer(tp, 1); | 1677 | tty3270_set_timer(tp, 1); |
1678 | } | 1678 | } |
1679 | } | 1679 | } |
@@ -1759,7 +1759,7 @@ void | |||
1759 | tty3270_notifier(int index, int active) | 1759 | tty3270_notifier(int index, int active) |
1760 | { | 1760 | { |
1761 | if (active) | 1761 | if (active) |
1762 | tty_register_device(tty3270_driver, index, 0); | 1762 | tty_register_device(tty3270_driver, index, NULL); |
1763 | else | 1763 | else |
1764 | tty_unregister_device(tty3270_driver, index); | 1764 | tty_unregister_device(tty3270_driver, index); |
1765 | } | 1765 | } |
@@ -1818,7 +1818,7 @@ tty3270_exit(void) | |||
1818 | 1818 | ||
1819 | raw3270_unregister_notifier(tty3270_notifier); | 1819 | raw3270_unregister_notifier(tty3270_notifier); |
1820 | driver = tty3270_driver; | 1820 | driver = tty3270_driver; |
1821 | tty3270_driver = 0; | 1821 | tty3270_driver = NULL; |
1822 | tty_unregister_driver(driver); | 1822 | tty_unregister_driver(driver); |
1823 | tty3270_del_views(); | 1823 | tty3270_del_views(); |
1824 | } | 1824 | } |
diff --git a/drivers/s390/char/vmlogrdr.c b/drivers/s390/char/vmlogrdr.c index c625b69ebd19..6cb23040954b 100644 --- a/drivers/s390/char/vmlogrdr.c +++ b/drivers/s390/char/vmlogrdr.c | |||
@@ -86,8 +86,8 @@ struct vmlogrdr_priv_t { | |||
86 | */ | 86 | */ |
87 | static int vmlogrdr_open(struct inode *, struct file *); | 87 | static int vmlogrdr_open(struct inode *, struct file *); |
88 | static int vmlogrdr_release(struct inode *, struct file *); | 88 | static int vmlogrdr_release(struct inode *, struct file *); |
89 | static ssize_t vmlogrdr_read (struct file *filp, char *data, size_t count, | 89 | static ssize_t vmlogrdr_read (struct file *filp, char __user *data, |
90 | loff_t * ppos); | 90 | size_t count, loff_t * ppos); |
91 | 91 | ||
92 | static struct file_operations vmlogrdr_fops = { | 92 | static struct file_operations vmlogrdr_fops = { |
93 | .owner = THIS_MODULE, | 93 | .owner = THIS_MODULE, |
@@ -515,7 +515,7 @@ vmlogrdr_receive_data(struct vmlogrdr_priv_t *priv) { | |||
515 | 515 | ||
516 | 516 | ||
517 | static ssize_t | 517 | static ssize_t |
518 | vmlogrdr_read (struct file *filp, char *data, size_t count, loff_t * ppos) | 518 | vmlogrdr_read(struct file *filp, char __user *data, size_t count, loff_t * ppos) |
519 | { | 519 | { |
520 | int rc; | 520 | int rc; |
521 | struct vmlogrdr_priv_t * priv = filp->private_data; | 521 | struct vmlogrdr_priv_t * priv = filp->private_data; |
diff --git a/drivers/s390/char/vmwatchdog.c b/drivers/s390/char/vmwatchdog.c index 5acc0ace3d7d..807320a41fa4 100644 --- a/drivers/s390/char/vmwatchdog.c +++ b/drivers/s390/char/vmwatchdog.c | |||
@@ -193,7 +193,7 @@ static int vmwdt_ioctl(struct inode *i, struct file *f, | |||
193 | return 0; | 193 | return 0; |
194 | case WDIOC_GETSTATUS: | 194 | case WDIOC_GETSTATUS: |
195 | case WDIOC_GETBOOTSTATUS: | 195 | case WDIOC_GETBOOTSTATUS: |
196 | return put_user(0, (int *)arg); | 196 | return put_user(0, (int __user *)arg); |
197 | case WDIOC_GETTEMP: | 197 | case WDIOC_GETTEMP: |
198 | return -EINVAL; | 198 | return -EINVAL; |
199 | case WDIOC_SETOPTIONS: | 199 | case WDIOC_SETOPTIONS: |
diff --git a/drivers/s390/cio/ccwgroup.c b/drivers/s390/cio/ccwgroup.c index c7319a07ba35..f26a2ee3aad8 100644 --- a/drivers/s390/cio/ccwgroup.c +++ b/drivers/s390/cio/ccwgroup.c | |||
@@ -319,7 +319,7 @@ ccwgroup_online_store (struct device *dev, struct device_attribute *attr, const | |||
319 | if (!try_module_get(gdrv->owner)) | 319 | if (!try_module_get(gdrv->owner)) |
320 | return -EINVAL; | 320 | return -EINVAL; |
321 | 321 | ||
322 | value = simple_strtoul(buf, 0, 0); | 322 | value = simple_strtoul(buf, NULL, 0); |
323 | ret = count; | 323 | ret = count; |
324 | if (value == 1) | 324 | if (value == 1) |
325 | ccwgroup_set_online(gdev); | 325 | ccwgroup_set_online(gdev); |
diff --git a/drivers/s390/cio/chsc.c b/drivers/s390/cio/chsc.c index a01f3bba4a7b..61ce3f1d5228 100644 --- a/drivers/s390/cio/chsc.c +++ b/drivers/s390/cio/chsc.c | |||
@@ -1464,6 +1464,40 @@ chsc_get_chp_desc(struct subchannel *sch, int chp_no) | |||
1464 | return desc; | 1464 | return desc; |
1465 | } | 1465 | } |
1466 | 1466 | ||
1467 | static int reset_channel_path(struct channel_path *chp) | ||
1468 | { | ||
1469 | int cc; | ||
1470 | |||
1471 | cc = rchp(chp->id); | ||
1472 | switch (cc) { | ||
1473 | case 0: | ||
1474 | return 0; | ||
1475 | case 2: | ||
1476 | return -EBUSY; | ||
1477 | default: | ||
1478 | return -ENODEV; | ||
1479 | } | ||
1480 | } | ||
1481 | |||
1482 | static void reset_channel_paths_css(struct channel_subsystem *css) | ||
1483 | { | ||
1484 | int i; | ||
1485 | |||
1486 | for (i = 0; i <= __MAX_CHPID; i++) { | ||
1487 | if (css->chps[i]) | ||
1488 | reset_channel_path(css->chps[i]); | ||
1489 | } | ||
1490 | } | ||
1491 | |||
1492 | void cio_reset_channel_paths(void) | ||
1493 | { | ||
1494 | int i; | ||
1495 | |||
1496 | for (i = 0; i <= __MAX_CSSID; i++) { | ||
1497 | if (css[i] && css[i]->valid) | ||
1498 | reset_channel_paths_css(css[i]); | ||
1499 | } | ||
1500 | } | ||
1467 | 1501 | ||
1468 | static int __init | 1502 | static int __init |
1469 | chsc_alloc_sei_area(void) | 1503 | chsc_alloc_sei_area(void) |
diff --git a/drivers/s390/cio/cio.c b/drivers/s390/cio/cio.c index 6fec90eab00e..89320c1ad825 100644 --- a/drivers/s390/cio/cio.c +++ b/drivers/s390/cio/cio.c | |||
@@ -519,6 +519,7 @@ cio_validate_subchannel (struct subchannel *sch, struct subchannel_id schid) | |||
519 | memset(sch, 0, sizeof(struct subchannel)); | 519 | memset(sch, 0, sizeof(struct subchannel)); |
520 | 520 | ||
521 | spin_lock_init(&sch->lock); | 521 | spin_lock_init(&sch->lock); |
522 | mutex_init(&sch->reg_mutex); | ||
522 | 523 | ||
523 | /* Set a name for the subchannel */ | 524 | /* Set a name for the subchannel */ |
524 | snprintf (sch->dev.bus_id, BUS_ID_SIZE, "0.%x.%04x", schid.ssid, | 525 | snprintf (sch->dev.bus_id, BUS_ID_SIZE, "0.%x.%04x", schid.ssid, |
@@ -797,7 +798,7 @@ struct subchannel * | |||
797 | cio_get_console_subchannel(void) | 798 | cio_get_console_subchannel(void) |
798 | { | 799 | { |
799 | if (!console_subchannel_in_use) | 800 | if (!console_subchannel_in_use) |
800 | return 0; | 801 | return NULL; |
801 | return &console_subchannel; | 802 | return &console_subchannel; |
802 | } | 803 | } |
803 | 804 | ||
@@ -875,5 +876,6 @@ void | |||
875 | reipl(unsigned long devno) | 876 | reipl(unsigned long devno) |
876 | { | 877 | { |
877 | clear_all_subchannels(); | 878 | clear_all_subchannels(); |
879 | cio_reset_channel_paths(); | ||
878 | do_reipl(devno); | 880 | do_reipl(devno); |
879 | } | 881 | } |
diff --git a/drivers/s390/cio/cio.h b/drivers/s390/cio/cio.h index 0ca987344e07..4541c1af4b66 100644 --- a/drivers/s390/cio/cio.h +++ b/drivers/s390/cio/cio.h | |||
@@ -2,6 +2,7 @@ | |||
2 | #define S390_CIO_H | 2 | #define S390_CIO_H |
3 | 3 | ||
4 | #include "schid.h" | 4 | #include "schid.h" |
5 | #include <linux/mutex.h> | ||
5 | 6 | ||
6 | /* | 7 | /* |
7 | * where we put the ssd info | 8 | * where we put the ssd info |
@@ -87,7 +88,7 @@ struct orb { | |||
87 | struct subchannel { | 88 | struct subchannel { |
88 | struct subchannel_id schid; | 89 | struct subchannel_id schid; |
89 | spinlock_t lock; /* subchannel lock */ | 90 | spinlock_t lock; /* subchannel lock */ |
90 | 91 | struct mutex reg_mutex; | |
91 | enum { | 92 | enum { |
92 | SUBCHANNEL_TYPE_IO = 0, | 93 | SUBCHANNEL_TYPE_IO = 0, |
93 | SUBCHANNEL_TYPE_CHSC = 1, | 94 | SUBCHANNEL_TYPE_CHSC = 1, |
diff --git a/drivers/s390/cio/cmf.c b/drivers/s390/cio/cmf.c index 1c3e8e9012b0..0df3af1f08de 100644 --- a/drivers/s390/cio/cmf.c +++ b/drivers/s390/cio/cmf.c | |||
@@ -1140,7 +1140,7 @@ static struct attribute *cmf_attributes[] = { | |||
1140 | &dev_attr_avg_device_disconnect_time.attr, | 1140 | &dev_attr_avg_device_disconnect_time.attr, |
1141 | &dev_attr_avg_control_unit_queuing_time.attr, | 1141 | &dev_attr_avg_control_unit_queuing_time.attr, |
1142 | &dev_attr_avg_device_active_only_time.attr, | 1142 | &dev_attr_avg_device_active_only_time.attr, |
1143 | 0, | 1143 | NULL, |
1144 | }; | 1144 | }; |
1145 | 1145 | ||
1146 | static struct attribute_group cmf_attr_group = { | 1146 | static struct attribute_group cmf_attr_group = { |
@@ -1160,7 +1160,7 @@ static struct attribute *cmf_attributes_ext[] = { | |||
1160 | &dev_attr_avg_device_active_only_time.attr, | 1160 | &dev_attr_avg_device_active_only_time.attr, |
1161 | &dev_attr_avg_device_busy_time.attr, | 1161 | &dev_attr_avg_device_busy_time.attr, |
1162 | &dev_attr_avg_initial_command_response_time.attr, | 1162 | &dev_attr_avg_initial_command_response_time.attr, |
1163 | 0, | 1163 | NULL, |
1164 | }; | 1164 | }; |
1165 | 1165 | ||
1166 | static struct attribute_group cmf_attr_group_ext = { | 1166 | static struct attribute_group cmf_attr_group_ext = { |
diff --git a/drivers/s390/cio/css.c b/drivers/s390/cio/css.c index 1d3be80797f8..13eeea3d547f 100644 --- a/drivers/s390/cio/css.c +++ b/drivers/s390/cio/css.c | |||
@@ -108,6 +108,24 @@ css_subchannel_release(struct device *dev) | |||
108 | 108 | ||
109 | extern int css_get_ssd_info(struct subchannel *sch); | 109 | extern int css_get_ssd_info(struct subchannel *sch); |
110 | 110 | ||
111 | |||
112 | int css_sch_device_register(struct subchannel *sch) | ||
113 | { | ||
114 | int ret; | ||
115 | |||
116 | mutex_lock(&sch->reg_mutex); | ||
117 | ret = device_register(&sch->dev); | ||
118 | mutex_unlock(&sch->reg_mutex); | ||
119 | return ret; | ||
120 | } | ||
121 | |||
122 | void css_sch_device_unregister(struct subchannel *sch) | ||
123 | { | ||
124 | mutex_lock(&sch->reg_mutex); | ||
125 | device_unregister(&sch->dev); | ||
126 | mutex_unlock(&sch->reg_mutex); | ||
127 | } | ||
128 | |||
111 | static int | 129 | static int |
112 | css_register_subchannel(struct subchannel *sch) | 130 | css_register_subchannel(struct subchannel *sch) |
113 | { | 131 | { |
@@ -119,7 +137,7 @@ css_register_subchannel(struct subchannel *sch) | |||
119 | sch->dev.release = &css_subchannel_release; | 137 | sch->dev.release = &css_subchannel_release; |
120 | 138 | ||
121 | /* make it known to the system */ | 139 | /* make it known to the system */ |
122 | ret = device_register(&sch->dev); | 140 | ret = css_sch_device_register(sch); |
123 | if (ret) | 141 | if (ret) |
124 | printk (KERN_WARNING "%s: could not register %s\n", | 142 | printk (KERN_WARNING "%s: could not register %s\n", |
125 | __func__, sch->dev.bus_id); | 143 | __func__, sch->dev.bus_id); |
@@ -250,7 +268,7 @@ css_evaluate_subchannel(struct subchannel_id schid, int slow) | |||
250 | * The device will be killed automatically. | 268 | * The device will be killed automatically. |
251 | */ | 269 | */ |
252 | cio_disable_subchannel(sch); | 270 | cio_disable_subchannel(sch); |
253 | device_unregister(&sch->dev); | 271 | css_sch_device_unregister(sch); |
254 | /* Reset intparm to zeroes. */ | 272 | /* Reset intparm to zeroes. */ |
255 | sch->schib.pmcw.intparm = 0; | 273 | sch->schib.pmcw.intparm = 0; |
256 | cio_modify(sch); | 274 | cio_modify(sch); |
@@ -264,7 +282,7 @@ css_evaluate_subchannel(struct subchannel_id schid, int slow) | |||
264 | * away in any case. | 282 | * away in any case. |
265 | */ | 283 | */ |
266 | if (!disc) { | 284 | if (!disc) { |
267 | device_unregister(&sch->dev); | 285 | css_sch_device_unregister(sch); |
268 | /* Reset intparm to zeroes. */ | 286 | /* Reset intparm to zeroes. */ |
269 | sch->schib.pmcw.intparm = 0; | 287 | sch->schib.pmcw.intparm = 0; |
270 | cio_modify(sch); | 288 | cio_modify(sch); |
@@ -605,9 +623,13 @@ init_channel_subsystem (void) | |||
605 | ret = device_register(&css[i]->device); | 623 | ret = device_register(&css[i]->device); |
606 | if (ret) | 624 | if (ret) |
607 | goto out_free; | 625 | goto out_free; |
608 | if (css_characteristics_avail && css_chsc_characteristics.secm) | 626 | if (css_characteristics_avail && |
609 | device_create_file(&css[i]->device, | 627 | css_chsc_characteristics.secm) { |
610 | &dev_attr_cm_enable); | 628 | ret = device_create_file(&css[i]->device, |
629 | &dev_attr_cm_enable); | ||
630 | if (ret) | ||
631 | goto out_device; | ||
632 | } | ||
611 | } | 633 | } |
612 | css_init_done = 1; | 634 | css_init_done = 1; |
613 | 635 | ||
@@ -615,6 +637,8 @@ init_channel_subsystem (void) | |||
615 | 637 | ||
616 | for_each_subchannel(__init_channel_subsystem, NULL); | 638 | for_each_subchannel(__init_channel_subsystem, NULL); |
617 | return 0; | 639 | return 0; |
640 | out_device: | ||
641 | device_unregister(&css[i]->device); | ||
618 | out_free: | 642 | out_free: |
619 | kfree(css[i]); | 643 | kfree(css[i]); |
620 | out_unregister: | 644 | out_unregister: |
diff --git a/drivers/s390/cio/css.h b/drivers/s390/cio/css.h index e210f89a2449..8aabb4adeb5f 100644 --- a/drivers/s390/cio/css.h +++ b/drivers/s390/cio/css.h | |||
@@ -100,7 +100,7 @@ struct ccw_device_private { | |||
100 | struct qdio_irq *qdio_data; | 100 | struct qdio_irq *qdio_data; |
101 | struct irb irb; /* device status */ | 101 | struct irb irb; /* device status */ |
102 | struct senseid senseid; /* SenseID info */ | 102 | struct senseid senseid; /* SenseID info */ |
103 | struct pgid pgid; /* path group ID */ | 103 | struct pgid pgid[8]; /* path group IDs per chpid*/ |
104 | struct ccw1 iccws[2]; /* ccws for SNID/SID/SPGID commands */ | 104 | struct ccw1 iccws[2]; /* ccws for SNID/SID/SPGID commands */ |
105 | struct work_struct kick_work; | 105 | struct work_struct kick_work; |
106 | wait_queue_head_t wait_q; | 106 | wait_queue_head_t wait_q; |
@@ -136,6 +136,8 @@ extern struct bus_type css_bus_type; | |||
136 | extern struct css_driver io_subchannel_driver; | 136 | extern struct css_driver io_subchannel_driver; |
137 | 137 | ||
138 | extern int css_probe_device(struct subchannel_id); | 138 | extern int css_probe_device(struct subchannel_id); |
139 | extern int css_sch_device_register(struct subchannel *); | ||
140 | extern void css_sch_device_unregister(struct subchannel *); | ||
139 | extern struct subchannel * get_subchannel_by_schid(struct subchannel_id); | 141 | extern struct subchannel * get_subchannel_by_schid(struct subchannel_id); |
140 | extern int css_init_done; | 142 | extern int css_init_done; |
141 | extern int for_each_subchannel(int(*fn)(struct subchannel_id, void *), void *); | 143 | extern int for_each_subchannel(int(*fn)(struct subchannel_id, void *), void *); |
diff --git a/drivers/s390/cio/device.c b/drivers/s390/cio/device.c index 67f0de6aed33..585fa04233c3 100644 --- a/drivers/s390/cio/device.c +++ b/drivers/s390/cio/device.c | |||
@@ -100,7 +100,7 @@ ccw_uevent (struct device *dev, char **envp, int num_envp, | |||
100 | if ((buffer_size - length <= 0) || (i >= num_envp)) | 100 | if ((buffer_size - length <= 0) || (i >= num_envp)) |
101 | return -ENOMEM; | 101 | return -ENOMEM; |
102 | 102 | ||
103 | envp[i] = 0; | 103 | envp[i] = NULL; |
104 | 104 | ||
105 | return 0; | 105 | return 0; |
106 | } | 106 | } |
@@ -280,7 +280,7 @@ ccw_device_remove_disconnected(struct ccw_device *cdev) | |||
280 | * 'throw away device'. | 280 | * 'throw away device'. |
281 | */ | 281 | */ |
282 | sch = to_subchannel(cdev->dev.parent); | 282 | sch = to_subchannel(cdev->dev.parent); |
283 | device_unregister(&sch->dev); | 283 | css_sch_device_unregister(sch); |
284 | /* Reset intparm to zeroes. */ | 284 | /* Reset intparm to zeroes. */ |
285 | sch->schib.pmcw.intparm = 0; | 285 | sch->schib.pmcw.intparm = 0; |
286 | cio_modify(sch); | 286 | cio_modify(sch); |
@@ -625,7 +625,7 @@ ccw_device_do_unreg_rereg(void *data) | |||
625 | other_sch->schib.pmcw.intparm = 0; | 625 | other_sch->schib.pmcw.intparm = 0; |
626 | cio_modify(other_sch); | 626 | cio_modify(other_sch); |
627 | } | 627 | } |
628 | device_unregister(&other_sch->dev); | 628 | css_sch_device_unregister(other_sch); |
629 | } | 629 | } |
630 | } | 630 | } |
631 | /* Update ssd info here. */ | 631 | /* Update ssd info here. */ |
@@ -709,7 +709,7 @@ ccw_device_call_sch_unregister(void *data) | |||
709 | struct subchannel *sch; | 709 | struct subchannel *sch; |
710 | 710 | ||
711 | sch = to_subchannel(cdev->dev.parent); | 711 | sch = to_subchannel(cdev->dev.parent); |
712 | device_unregister(&sch->dev); | 712 | css_sch_device_unregister(sch); |
713 | /* Reset intparm to zeroes. */ | 713 | /* Reset intparm to zeroes. */ |
714 | sch->schib.pmcw.intparm = 0; | 714 | sch->schib.pmcw.intparm = 0; |
715 | cio_modify(sch); | 715 | cio_modify(sch); |
@@ -1057,7 +1057,7 @@ get_ccwdev_by_busid(struct ccw_driver *cdrv, const char *bus_id) | |||
1057 | __ccwdev_check_busid); | 1057 | __ccwdev_check_busid); |
1058 | put_driver(drv); | 1058 | put_driver(drv); |
1059 | 1059 | ||
1060 | return dev ? to_ccwdev(dev) : 0; | 1060 | return dev ? to_ccwdev(dev) : NULL; |
1061 | } | 1061 | } |
1062 | 1062 | ||
1063 | /************************** device driver handling ************************/ | 1063 | /************************** device driver handling ************************/ |
@@ -1082,7 +1082,7 @@ ccw_device_probe (struct device *dev) | |||
1082 | ret = cdrv->probe ? cdrv->probe(cdev) : -ENODEV; | 1082 | ret = cdrv->probe ? cdrv->probe(cdev) : -ENODEV; |
1083 | 1083 | ||
1084 | if (ret) { | 1084 | if (ret) { |
1085 | cdev->drv = 0; | 1085 | cdev->drv = NULL; |
1086 | return ret; | 1086 | return ret; |
1087 | } | 1087 | } |
1088 | 1088 | ||
@@ -1113,7 +1113,7 @@ ccw_device_remove (struct device *dev) | |||
1113 | ret, cdev->dev.bus_id); | 1113 | ret, cdev->dev.bus_id); |
1114 | } | 1114 | } |
1115 | ccw_device_set_timeout(cdev, 0); | 1115 | ccw_device_set_timeout(cdev, 0); |
1116 | cdev->drv = 0; | 1116 | cdev->drv = NULL; |
1117 | return 0; | 1117 | return 0; |
1118 | } | 1118 | } |
1119 | 1119 | ||
diff --git a/drivers/s390/cio/device_fsm.c b/drivers/s390/cio/device_fsm.c index cb1af0b6f033..ac6e0c7e43d9 100644 --- a/drivers/s390/cio/device_fsm.c +++ b/drivers/s390/cio/device_fsm.c | |||
@@ -378,6 +378,56 @@ ccw_device_done(struct ccw_device *cdev, int state) | |||
378 | put_device (&cdev->dev); | 378 | put_device (&cdev->dev); |
379 | } | 379 | } |
380 | 380 | ||
381 | static inline int cmp_pgid(struct pgid *p1, struct pgid *p2) | ||
382 | { | ||
383 | char *c1; | ||
384 | char *c2; | ||
385 | |||
386 | c1 = (char *)p1; | ||
387 | c2 = (char *)p2; | ||
388 | |||
389 | return memcmp(c1 + 1, c2 + 1, sizeof(struct pgid) - 1); | ||
390 | } | ||
391 | |||
392 | static void __ccw_device_get_common_pgid(struct ccw_device *cdev) | ||
393 | { | ||
394 | int i; | ||
395 | int last; | ||
396 | |||
397 | last = 0; | ||
398 | for (i = 0; i < 8; i++) { | ||
399 | if (cdev->private->pgid[i].inf.ps.state1 == SNID_STATE1_RESET) | ||
400 | /* No PGID yet */ | ||
401 | continue; | ||
402 | if (cdev->private->pgid[last].inf.ps.state1 == | ||
403 | SNID_STATE1_RESET) { | ||
404 | /* First non-zero PGID */ | ||
405 | last = i; | ||
406 | continue; | ||
407 | } | ||
408 | if (cmp_pgid(&cdev->private->pgid[i], | ||
409 | &cdev->private->pgid[last]) == 0) | ||
410 | /* Non-conflicting PGIDs */ | ||
411 | continue; | ||
412 | |||
413 | /* PGID mismatch, can't pathgroup. */ | ||
414 | CIO_MSG_EVENT(0, "SNID - pgid mismatch for device " | ||
415 | "0.%x.%04x, can't pathgroup\n", | ||
416 | cdev->private->ssid, cdev->private->devno); | ||
417 | cdev->private->options.pgroup = 0; | ||
418 | return; | ||
419 | } | ||
420 | if (cdev->private->pgid[last].inf.ps.state1 == | ||
421 | SNID_STATE1_RESET) | ||
422 | /* No previous pgid found */ | ||
423 | memcpy(&cdev->private->pgid[0], &css[0]->global_pgid, | ||
424 | sizeof(struct pgid)); | ||
425 | else | ||
426 | /* Use existing pgid */ | ||
427 | memcpy(&cdev->private->pgid[0], &cdev->private->pgid[last], | ||
428 | sizeof(struct pgid)); | ||
429 | } | ||
430 | |||
381 | /* | 431 | /* |
382 | * Function called from device_pgid.c after sense path ground has completed. | 432 | * Function called from device_pgid.c after sense path ground has completed. |
383 | */ | 433 | */ |
@@ -388,24 +438,26 @@ ccw_device_sense_pgid_done(struct ccw_device *cdev, int err) | |||
388 | 438 | ||
389 | sch = to_subchannel(cdev->dev.parent); | 439 | sch = to_subchannel(cdev->dev.parent); |
390 | switch (err) { | 440 | switch (err) { |
391 | case 0: | 441 | case -EOPNOTSUPP: /* path grouping not supported, use nop instead. */ |
392 | /* Start Path Group verification. */ | 442 | cdev->private->options.pgroup = 0; |
393 | sch->vpm = 0; /* Start with no path groups set. */ | 443 | break; |
394 | cdev->private->state = DEV_STATE_VERIFY; | 444 | case 0: /* success */ |
395 | ccw_device_verify_start(cdev); | 445 | case -EACCES: /* partial success, some paths not operational */ |
446 | /* Check if all pgids are equal or 0. */ | ||
447 | __ccw_device_get_common_pgid(cdev); | ||
396 | break; | 448 | break; |
397 | case -ETIME: /* Sense path group id stopped by timeout. */ | 449 | case -ETIME: /* Sense path group id stopped by timeout. */ |
398 | case -EUSERS: /* device is reserved for someone else. */ | 450 | case -EUSERS: /* device is reserved for someone else. */ |
399 | ccw_device_done(cdev, DEV_STATE_BOXED); | 451 | ccw_device_done(cdev, DEV_STATE_BOXED); |
400 | break; | 452 | return; |
401 | case -EOPNOTSUPP: /* path grouping not supported, just set online. */ | ||
402 | cdev->private->options.pgroup = 0; | ||
403 | ccw_device_done(cdev, DEV_STATE_ONLINE); | ||
404 | break; | ||
405 | default: | 453 | default: |
406 | ccw_device_done(cdev, DEV_STATE_NOT_OPER); | 454 | ccw_device_done(cdev, DEV_STATE_NOT_OPER); |
407 | break; | 455 | return; |
408 | } | 456 | } |
457 | /* Start Path Group verification. */ | ||
458 | sch->vpm = 0; /* Start with no path groups set. */ | ||
459 | cdev->private->state = DEV_STATE_VERIFY; | ||
460 | ccw_device_verify_start(cdev); | ||
409 | } | 461 | } |
410 | 462 | ||
411 | /* | 463 | /* |
@@ -562,8 +614,9 @@ ccw_device_online(struct ccw_device *cdev) | |||
562 | } | 614 | } |
563 | /* Do we want to do path grouping? */ | 615 | /* Do we want to do path grouping? */ |
564 | if (!cdev->private->options.pgroup) { | 616 | if (!cdev->private->options.pgroup) { |
565 | /* No, set state online immediately. */ | 617 | /* Start initial path verification. */ |
566 | ccw_device_done(cdev, DEV_STATE_ONLINE); | 618 | cdev->private->state = DEV_STATE_VERIFY; |
619 | ccw_device_verify_start(cdev); | ||
567 | return 0; | 620 | return 0; |
568 | } | 621 | } |
569 | /* Do a SensePGID first. */ | 622 | /* Do a SensePGID first. */ |
@@ -609,6 +662,7 @@ ccw_device_offline(struct ccw_device *cdev) | |||
609 | /* Are we doing path grouping? */ | 662 | /* Are we doing path grouping? */ |
610 | if (!cdev->private->options.pgroup) { | 663 | if (!cdev->private->options.pgroup) { |
611 | /* No, set state offline immediately. */ | 664 | /* No, set state offline immediately. */ |
665 | sch->vpm = 0; | ||
612 | ccw_device_done(cdev, DEV_STATE_OFFLINE); | 666 | ccw_device_done(cdev, DEV_STATE_OFFLINE); |
613 | return 0; | 667 | return 0; |
614 | } | 668 | } |
@@ -705,8 +759,6 @@ ccw_device_online_verify(struct ccw_device *cdev, enum dev_event dev_event) | |||
705 | { | 759 | { |
706 | struct subchannel *sch; | 760 | struct subchannel *sch; |
707 | 761 | ||
708 | if (!cdev->private->options.pgroup) | ||
709 | return; | ||
710 | if (cdev->private->state == DEV_STATE_W4SENSE) { | 762 | if (cdev->private->state == DEV_STATE_W4SENSE) { |
711 | cdev->private->flags.doverify = 1; | 763 | cdev->private->flags.doverify = 1; |
712 | return; | 764 | return; |
@@ -995,8 +1047,7 @@ static void | |||
995 | ccw_device_wait4io_verify(struct ccw_device *cdev, enum dev_event dev_event) | 1047 | ccw_device_wait4io_verify(struct ccw_device *cdev, enum dev_event dev_event) |
996 | { | 1048 | { |
997 | /* When the I/O has terminated, we have to start verification. */ | 1049 | /* When the I/O has terminated, we have to start verification. */ |
998 | if (cdev->private->options.pgroup) | 1050 | cdev->private->flags.doverify = 1; |
999 | cdev->private->flags.doverify = 1; | ||
1000 | } | 1051 | } |
1001 | 1052 | ||
1002 | static void | 1053 | static void |
diff --git a/drivers/s390/cio/device_pgid.c b/drivers/s390/cio/device_pgid.c index 54cb64ed0786..32610fd8868e 100644 --- a/drivers/s390/cio/device_pgid.c +++ b/drivers/s390/cio/device_pgid.c | |||
@@ -33,12 +33,17 @@ __ccw_device_sense_pgid_start(struct ccw_device *cdev) | |||
33 | struct subchannel *sch; | 33 | struct subchannel *sch; |
34 | struct ccw1 *ccw; | 34 | struct ccw1 *ccw; |
35 | int ret; | 35 | int ret; |
36 | int i; | ||
36 | 37 | ||
37 | sch = to_subchannel(cdev->dev.parent); | 38 | sch = to_subchannel(cdev->dev.parent); |
39 | /* Return if we already checked on all paths. */ | ||
40 | if (cdev->private->imask == 0) | ||
41 | return (sch->lpm == 0) ? -ENODEV : -EACCES; | ||
42 | i = 8 - ffs(cdev->private->imask); | ||
43 | |||
38 | /* Setup sense path group id channel program. */ | 44 | /* Setup sense path group id channel program. */ |
39 | ccw = cdev->private->iccws; | 45 | ccw = cdev->private->iccws; |
40 | ccw->cmd_code = CCW_CMD_SENSE_PGID; | 46 | ccw->cmd_code = CCW_CMD_SENSE_PGID; |
41 | ccw->cda = (__u32) __pa (&cdev->private->pgid); | ||
42 | ccw->count = sizeof (struct pgid); | 47 | ccw->count = sizeof (struct pgid); |
43 | ccw->flags = CCW_FLAG_SLI; | 48 | ccw->flags = CCW_FLAG_SLI; |
44 | 49 | ||
@@ -48,6 +53,7 @@ __ccw_device_sense_pgid_start(struct ccw_device *cdev) | |||
48 | ret = -ENODEV; | 53 | ret = -ENODEV; |
49 | while (cdev->private->imask != 0) { | 54 | while (cdev->private->imask != 0) { |
50 | /* Try every path multiple times. */ | 55 | /* Try every path multiple times. */ |
56 | ccw->cda = (__u32) __pa (&cdev->private->pgid[i]); | ||
51 | if (cdev->private->iretry > 0) { | 57 | if (cdev->private->iretry > 0) { |
52 | cdev->private->iretry--; | 58 | cdev->private->iretry--; |
53 | ret = cio_start (sch, cdev->private->iccws, | 59 | ret = cio_start (sch, cdev->private->iccws, |
@@ -64,7 +70,9 @@ __ccw_device_sense_pgid_start(struct ccw_device *cdev) | |||
64 | } | 70 | } |
65 | cdev->private->imask >>= 1; | 71 | cdev->private->imask >>= 1; |
66 | cdev->private->iretry = 5; | 72 | cdev->private->iretry = 5; |
73 | i++; | ||
67 | } | 74 | } |
75 | |||
68 | return ret; | 76 | return ret; |
69 | } | 77 | } |
70 | 78 | ||
@@ -76,7 +84,7 @@ ccw_device_sense_pgid_start(struct ccw_device *cdev) | |||
76 | cdev->private->state = DEV_STATE_SENSE_PGID; | 84 | cdev->private->state = DEV_STATE_SENSE_PGID; |
77 | cdev->private->imask = 0x80; | 85 | cdev->private->imask = 0x80; |
78 | cdev->private->iretry = 5; | 86 | cdev->private->iretry = 5; |
79 | memset (&cdev->private->pgid, 0, sizeof (struct pgid)); | 87 | memset (&cdev->private->pgid, 0, sizeof (cdev->private->pgid)); |
80 | ret = __ccw_device_sense_pgid_start(cdev); | 88 | ret = __ccw_device_sense_pgid_start(cdev); |
81 | if (ret && ret != -EBUSY) | 89 | if (ret && ret != -EBUSY) |
82 | ccw_device_sense_pgid_done(cdev, ret); | 90 | ccw_device_sense_pgid_done(cdev, ret); |
@@ -91,6 +99,7 @@ __ccw_device_check_sense_pgid(struct ccw_device *cdev) | |||
91 | { | 99 | { |
92 | struct subchannel *sch; | 100 | struct subchannel *sch; |
93 | struct irb *irb; | 101 | struct irb *irb; |
102 | int i; | ||
94 | 103 | ||
95 | sch = to_subchannel(cdev->dev.parent); | 104 | sch = to_subchannel(cdev->dev.parent); |
96 | irb = &cdev->private->irb; | 105 | irb = &cdev->private->irb; |
@@ -124,7 +133,8 @@ __ccw_device_check_sense_pgid(struct ccw_device *cdev) | |||
124 | sch->schid.sch_no, sch->orb.lpm); | 133 | sch->schid.sch_no, sch->orb.lpm); |
125 | return -EACCES; | 134 | return -EACCES; |
126 | } | 135 | } |
127 | if (cdev->private->pgid.inf.ps.state2 == SNID_STATE2_RESVD_ELSE) { | 136 | i = 8 - ffs(cdev->private->imask); |
137 | if (cdev->private->pgid[i].inf.ps.state2 == SNID_STATE2_RESVD_ELSE) { | ||
128 | CIO_MSG_EVENT(2, "SNID - Device %04x on Subchannel 0.%x.%04x " | 138 | CIO_MSG_EVENT(2, "SNID - Device %04x on Subchannel 0.%x.%04x " |
129 | "is reserved by someone else\n", | 139 | "is reserved by someone else\n", |
130 | cdev->private->devno, sch->schid.ssid, | 140 | cdev->private->devno, sch->schid.ssid, |
@@ -162,12 +172,6 @@ ccw_device_sense_pgid_irq(struct ccw_device *cdev, enum dev_event dev_event) | |||
162 | memset(&cdev->private->irb, 0, sizeof(struct irb)); | 172 | memset(&cdev->private->irb, 0, sizeof(struct irb)); |
163 | switch (ret) { | 173 | switch (ret) { |
164 | /* 0, -ETIME, -EOPNOTSUPP, -EAGAIN, -EACCES or -EUSERS */ | 174 | /* 0, -ETIME, -EOPNOTSUPP, -EAGAIN, -EACCES or -EUSERS */ |
165 | case 0: /* Sense Path Group ID successful. */ | ||
166 | if (cdev->private->pgid.inf.ps.state1 == SNID_STATE1_RESET) | ||
167 | memcpy(&cdev->private->pgid, &css[0]->global_pgid, | ||
168 | sizeof(struct pgid)); | ||
169 | ccw_device_sense_pgid_done(cdev, 0); | ||
170 | break; | ||
171 | case -EOPNOTSUPP: /* Sense Path Group ID not supported */ | 175 | case -EOPNOTSUPP: /* Sense Path Group ID not supported */ |
172 | ccw_device_sense_pgid_done(cdev, -EOPNOTSUPP); | 176 | ccw_device_sense_pgid_done(cdev, -EOPNOTSUPP); |
173 | break; | 177 | break; |
@@ -176,13 +180,15 @@ ccw_device_sense_pgid_irq(struct ccw_device *cdev, enum dev_event dev_event) | |||
176 | break; | 180 | break; |
177 | case -EACCES: /* channel is not operational. */ | 181 | case -EACCES: /* channel is not operational. */ |
178 | sch->lpm &= ~cdev->private->imask; | 182 | sch->lpm &= ~cdev->private->imask; |
183 | /* Fall through. */ | ||
184 | case 0: /* Sense Path Group ID successful. */ | ||
179 | cdev->private->imask >>= 1; | 185 | cdev->private->imask >>= 1; |
180 | cdev->private->iretry = 5; | 186 | cdev->private->iretry = 5; |
181 | /* Fall through. */ | 187 | /* Fall through. */ |
182 | case -EAGAIN: /* Try again. */ | 188 | case -EAGAIN: /* Try again. */ |
183 | ret = __ccw_device_sense_pgid_start(cdev); | 189 | ret = __ccw_device_sense_pgid_start(cdev); |
184 | if (ret != 0 && ret != -EBUSY) | 190 | if (ret != 0 && ret != -EBUSY) |
185 | ccw_device_sense_pgid_done(cdev, -ENODEV); | 191 | ccw_device_sense_pgid_done(cdev, ret); |
186 | break; | 192 | break; |
187 | case -EUSERS: /* device is reserved for someone else. */ | 193 | case -EUSERS: /* device is reserved for someone else. */ |
188 | ccw_device_sense_pgid_done(cdev, -EUSERS); | 194 | ccw_device_sense_pgid_done(cdev, -EUSERS); |
@@ -203,20 +209,20 @@ __ccw_device_do_pgid(struct ccw_device *cdev, __u8 func) | |||
203 | sch = to_subchannel(cdev->dev.parent); | 209 | sch = to_subchannel(cdev->dev.parent); |
204 | 210 | ||
205 | /* Setup sense path group id channel program. */ | 211 | /* Setup sense path group id channel program. */ |
206 | cdev->private->pgid.inf.fc = func; | 212 | cdev->private->pgid[0].inf.fc = func; |
207 | ccw = cdev->private->iccws; | 213 | ccw = cdev->private->iccws; |
208 | if (!cdev->private->flags.pgid_single) { | 214 | if (!cdev->private->flags.pgid_single) { |
209 | cdev->private->pgid.inf.fc |= SPID_FUNC_MULTI_PATH; | 215 | cdev->private->pgid[0].inf.fc |= SPID_FUNC_MULTI_PATH; |
210 | ccw->cmd_code = CCW_CMD_SUSPEND_RECONN; | 216 | ccw->cmd_code = CCW_CMD_SUSPEND_RECONN; |
211 | ccw->cda = 0; | 217 | ccw->cda = 0; |
212 | ccw->count = 0; | 218 | ccw->count = 0; |
213 | ccw->flags = CCW_FLAG_SLI | CCW_FLAG_CC; | 219 | ccw->flags = CCW_FLAG_SLI | CCW_FLAG_CC; |
214 | ccw++; | 220 | ccw++; |
215 | } else | 221 | } else |
216 | cdev->private->pgid.inf.fc |= SPID_FUNC_SINGLE_PATH; | 222 | cdev->private->pgid[0].inf.fc |= SPID_FUNC_SINGLE_PATH; |
217 | 223 | ||
218 | ccw->cmd_code = CCW_CMD_SET_PGID; | 224 | ccw->cmd_code = CCW_CMD_SET_PGID; |
219 | ccw->cda = (__u32) __pa (&cdev->private->pgid); | 225 | ccw->cda = (__u32) __pa (&cdev->private->pgid[0]); |
220 | ccw->count = sizeof (struct pgid); | 226 | ccw->count = sizeof (struct pgid); |
221 | ccw->flags = CCW_FLAG_SLI; | 227 | ccw->flags = CCW_FLAG_SLI; |
222 | 228 | ||
@@ -244,6 +250,48 @@ __ccw_device_do_pgid(struct ccw_device *cdev, __u8 func) | |||
244 | } | 250 | } |
245 | 251 | ||
246 | /* | 252 | /* |
253 | * Helper function to send a nop ccw down a path. | ||
254 | */ | ||
255 | static int __ccw_device_do_nop(struct ccw_device *cdev) | ||
256 | { | ||
257 | struct subchannel *sch; | ||
258 | struct ccw1 *ccw; | ||
259 | int ret; | ||
260 | |||
261 | sch = to_subchannel(cdev->dev.parent); | ||
262 | |||
263 | /* Setup nop channel program. */ | ||
264 | ccw = cdev->private->iccws; | ||
265 | ccw->cmd_code = CCW_CMD_NOOP; | ||
266 | ccw->cda = 0; | ||
267 | ccw->count = 0; | ||
268 | ccw->flags = CCW_FLAG_SLI; | ||
269 | |||
270 | /* Reset device status. */ | ||
271 | memset(&cdev->private->irb, 0, sizeof(struct irb)); | ||
272 | |||
273 | /* Try multiple times. */ | ||
274 | ret = -ENODEV; | ||
275 | if (cdev->private->iretry > 0) { | ||
276 | cdev->private->iretry--; | ||
277 | ret = cio_start (sch, cdev->private->iccws, | ||
278 | cdev->private->imask); | ||
279 | /* ret is 0, -EBUSY, -EACCES or -ENODEV */ | ||
280 | if ((ret != -EACCES) && (ret != -ENODEV)) | ||
281 | return ret; | ||
282 | } | ||
283 | /* nop command failed on this path. Switch it off. */ | ||
284 | sch->lpm &= ~cdev->private->imask; | ||
285 | sch->vpm &= ~cdev->private->imask; | ||
286 | CIO_MSG_EVENT(2, "NOP - Device %04x on Subchannel " | ||
287 | "0.%x.%04x, lpm %02X, became 'not operational'\n", | ||
288 | cdev->private->devno, sch->schid.ssid, | ||
289 | sch->schid.sch_no, cdev->private->imask); | ||
290 | return ret; | ||
291 | } | ||
292 | |||
293 | |||
294 | /* | ||
247 | * Called from interrupt context to check if a valid answer | 295 | * Called from interrupt context to check if a valid answer |
248 | * to Set Path Group ID was received. | 296 | * to Set Path Group ID was received. |
249 | */ | 297 | */ |
@@ -282,6 +330,29 @@ __ccw_device_check_pgid(struct ccw_device *cdev) | |||
282 | return 0; | 330 | return 0; |
283 | } | 331 | } |
284 | 332 | ||
333 | /* | ||
334 | * Called from interrupt context to check the path status after a nop has | ||
335 | * been send. | ||
336 | */ | ||
337 | static int __ccw_device_check_nop(struct ccw_device *cdev) | ||
338 | { | ||
339 | struct subchannel *sch; | ||
340 | struct irb *irb; | ||
341 | |||
342 | sch = to_subchannel(cdev->dev.parent); | ||
343 | irb = &cdev->private->irb; | ||
344 | if (irb->scsw.fctl & (SCSW_FCTL_HALT_FUNC | SCSW_FCTL_CLEAR_FUNC)) | ||
345 | return -ETIME; | ||
346 | if (irb->scsw.cc == 3) { | ||
347 | CIO_MSG_EVENT(2, "NOP - Device %04x on Subchannel 0.%x.%04x," | ||
348 | " lpm %02X, became 'not operational'\n", | ||
349 | cdev->private->devno, sch->schid.ssid, | ||
350 | sch->schid.sch_no, cdev->private->imask); | ||
351 | return -EACCES; | ||
352 | } | ||
353 | return 0; | ||
354 | } | ||
355 | |||
285 | static void | 356 | static void |
286 | __ccw_device_verify_start(struct ccw_device *cdev) | 357 | __ccw_device_verify_start(struct ccw_device *cdev) |
287 | { | 358 | { |
@@ -296,9 +367,12 @@ __ccw_device_verify_start(struct ccw_device *cdev) | |||
296 | if ((sch->vpm & imask) != (sch->lpm & imask)) | 367 | if ((sch->vpm & imask) != (sch->lpm & imask)) |
297 | break; | 368 | break; |
298 | cdev->private->imask = imask; | 369 | cdev->private->imask = imask; |
299 | func = (sch->vpm & imask) ? | 370 | if (cdev->private->options.pgroup) { |
300 | SPID_FUNC_RESIGN : SPID_FUNC_ESTABLISH; | 371 | func = (sch->vpm & imask) ? |
301 | ret = __ccw_device_do_pgid(cdev, func); | 372 | SPID_FUNC_RESIGN : SPID_FUNC_ESTABLISH; |
373 | ret = __ccw_device_do_pgid(cdev, func); | ||
374 | } else | ||
375 | ret = __ccw_device_do_nop(cdev); | ||
302 | if (ret == 0 || ret == -EBUSY) | 376 | if (ret == 0 || ret == -EBUSY) |
303 | return; | 377 | return; |
304 | cdev->private->iretry = 5; | 378 | cdev->private->iretry = 5; |
@@ -327,7 +401,10 @@ ccw_device_verify_irq(struct ccw_device *cdev, enum dev_event dev_event) | |||
327 | if (ccw_device_accumulate_and_sense(cdev, irb) != 0) | 401 | if (ccw_device_accumulate_and_sense(cdev, irb) != 0) |
328 | return; | 402 | return; |
329 | sch = to_subchannel(cdev->dev.parent); | 403 | sch = to_subchannel(cdev->dev.parent); |
330 | ret = __ccw_device_check_pgid(cdev); | 404 | if (cdev->private->options.pgroup) |
405 | ret = __ccw_device_check_pgid(cdev); | ||
406 | else | ||
407 | ret = __ccw_device_check_nop(cdev); | ||
331 | memset(&cdev->private->irb, 0, sizeof(struct irb)); | 408 | memset(&cdev->private->irb, 0, sizeof(struct irb)); |
332 | switch (ret) { | 409 | switch (ret) { |
333 | /* 0, -ETIME, -EAGAIN, -EOPNOTSUPP or -EACCES */ | 410 | /* 0, -ETIME, -EAGAIN, -EOPNOTSUPP or -EACCES */ |
@@ -345,11 +422,10 @@ ccw_device_verify_irq(struct ccw_device *cdev, enum dev_event dev_event) | |||
345 | * One of those strange devices which claim to be able | 422 | * One of those strange devices which claim to be able |
346 | * to do multipathing but not for Set Path Group ID. | 423 | * to do multipathing but not for Set Path Group ID. |
347 | */ | 424 | */ |
348 | if (cdev->private->flags.pgid_single) { | 425 | if (cdev->private->flags.pgid_single) |
349 | ccw_device_verify_done(cdev, -EOPNOTSUPP); | 426 | cdev->private->options.pgroup = 0; |
350 | break; | 427 | else |
351 | } | 428 | cdev->private->flags.pgid_single = 1; |
352 | cdev->private->flags.pgid_single = 1; | ||
353 | /* fall through. */ | 429 | /* fall through. */ |
354 | case -EAGAIN: /* Try again. */ | 430 | case -EAGAIN: /* Try again. */ |
355 | __ccw_device_verify_start(cdev); | 431 | __ccw_device_verify_start(cdev); |
diff --git a/drivers/s390/cio/device_status.c b/drivers/s390/cio/device_status.c index 14bef2c179bf..caf148d5caad 100644 --- a/drivers/s390/cio/device_status.c +++ b/drivers/s390/cio/device_status.c | |||
@@ -67,8 +67,7 @@ ccw_device_path_notoper(struct ccw_device *cdev) | |||
67 | sch->schib.pmcw.pnom); | 67 | sch->schib.pmcw.pnom); |
68 | 68 | ||
69 | sch->lpm &= ~sch->schib.pmcw.pnom; | 69 | sch->lpm &= ~sch->schib.pmcw.pnom; |
70 | if (cdev->private->options.pgroup) | 70 | cdev->private->flags.doverify = 1; |
71 | cdev->private->flags.doverify = 1; | ||
72 | } | 71 | } |
73 | 72 | ||
74 | /* | 73 | /* |
@@ -180,7 +179,7 @@ ccw_device_accumulate_esw(struct ccw_device *cdev, struct irb *irb) | |||
180 | cdev_irb->esw.esw0.erw.auth = irb->esw.esw0.erw.auth; | 179 | cdev_irb->esw.esw0.erw.auth = irb->esw.esw0.erw.auth; |
181 | /* Copy path verification required flag. */ | 180 | /* Copy path verification required flag. */ |
182 | cdev_irb->esw.esw0.erw.pvrf = irb->esw.esw0.erw.pvrf; | 181 | cdev_irb->esw.esw0.erw.pvrf = irb->esw.esw0.erw.pvrf; |
183 | if (irb->esw.esw0.erw.pvrf && cdev->private->options.pgroup) | 182 | if (irb->esw.esw0.erw.pvrf) |
184 | cdev->private->flags.doverify = 1; | 183 | cdev->private->flags.doverify = 1; |
185 | /* Copy concurrent sense bit. */ | 184 | /* Copy concurrent sense bit. */ |
186 | cdev_irb->esw.esw0.erw.cons = irb->esw.esw0.erw.cons; | 185 | cdev_irb->esw.esw0.erw.cons = irb->esw.esw0.erw.cons; |
@@ -354,7 +353,7 @@ ccw_device_accumulate_basic_sense(struct ccw_device *cdev, struct irb *irb) | |||
354 | } | 353 | } |
355 | /* Check if path verification is required. */ | 354 | /* Check if path verification is required. */ |
356 | if (ccw_device_accumulate_esw_valid(irb) && | 355 | if (ccw_device_accumulate_esw_valid(irb) && |
357 | irb->esw.esw0.erw.pvrf && cdev->private->options.pgroup) | 356 | irb->esw.esw0.erw.pvrf) |
358 | cdev->private->flags.doverify = 1; | 357 | cdev->private->flags.doverify = 1; |
359 | } | 358 | } |
360 | 359 | ||
diff --git a/drivers/s390/cio/qdio.c b/drivers/s390/cio/qdio.c index b70039af70d6..7c93a8798d23 100644 --- a/drivers/s390/cio/qdio.c +++ b/drivers/s390/cio/qdio.c | |||
@@ -2735,7 +2735,7 @@ qdio_free(struct ccw_device *cdev) | |||
2735 | QDIO_DBF_TEXT1(0,trace,dbf_text); | 2735 | QDIO_DBF_TEXT1(0,trace,dbf_text); |
2736 | QDIO_DBF_TEXT0(0,setup,dbf_text); | 2736 | QDIO_DBF_TEXT0(0,setup,dbf_text); |
2737 | 2737 | ||
2738 | cdev->private->qdio_data = 0; | 2738 | cdev->private->qdio_data = NULL; |
2739 | 2739 | ||
2740 | up(&irq_ptr->setting_up_sema); | 2740 | up(&irq_ptr->setting_up_sema); |
2741 | 2741 | ||
diff --git a/drivers/s390/net/claw.c b/drivers/s390/net/claw.c index 23d53bf9daf1..95f4e105cb96 100644 --- a/drivers/s390/net/claw.c +++ b/drivers/s390/net/claw.c | |||
@@ -529,7 +529,7 @@ claw_open(struct net_device *dev) | |||
529 | printk(KERN_INFO "%s:%s Enter \n",dev->name,__FUNCTION__); | 529 | printk(KERN_INFO "%s:%s Enter \n",dev->name,__FUNCTION__); |
530 | #endif | 530 | #endif |
531 | CLAW_DBF_TEXT(4,trace,"open"); | 531 | CLAW_DBF_TEXT(4,trace,"open"); |
532 | if (!dev | (dev->name[0] == 0x00)) { | 532 | if (!dev || (dev->name[0] == 0x00)) { |
533 | CLAW_DBF_TEXT(2,trace,"BadDev"); | 533 | CLAW_DBF_TEXT(2,trace,"BadDev"); |
534 | printk(KERN_WARNING "claw: Bad device at open failing \n"); | 534 | printk(KERN_WARNING "claw: Bad device at open failing \n"); |
535 | return -ENODEV; | 535 | return -ENODEV; |
diff --git a/drivers/s390/net/iucv.c b/drivers/s390/net/iucv.c index 189a49275433..0e863df4027a 100644 --- a/drivers/s390/net/iucv.c +++ b/drivers/s390/net/iucv.c | |||
@@ -692,7 +692,7 @@ iucv_retrieve_buffer (void) | |||
692 | iucv_debug(1, "entering"); | 692 | iucv_debug(1, "entering"); |
693 | if (iucv_cpuid != -1) { | 693 | if (iucv_cpuid != -1) { |
694 | smp_call_function_on(iucv_retrieve_buffer_cpuid, | 694 | smp_call_function_on(iucv_retrieve_buffer_cpuid, |
695 | 0, 0, 1, iucv_cpuid); | 695 | NULL, 0, 1, iucv_cpuid); |
696 | /* Release the cpu reserved by iucv_declare_buffer. */ | 696 | /* Release the cpu reserved by iucv_declare_buffer. */ |
697 | smp_put_cpu(iucv_cpuid); | 697 | smp_put_cpu(iucv_cpuid); |
698 | iucv_cpuid = -1; | 698 | iucv_cpuid = -1; |
diff --git a/drivers/s390/net/netiucv.c b/drivers/s390/net/netiucv.c index b452cc1afd55..5d6e6cbfa360 100644 --- a/drivers/s390/net/netiucv.c +++ b/drivers/s390/net/netiucv.c | |||
@@ -2029,7 +2029,7 @@ remove_write (struct device_driver *drv, const char *buf, size_t count) | |||
2029 | count = IFNAMSIZ-1; | 2029 | count = IFNAMSIZ-1; |
2030 | 2030 | ||
2031 | for (i=0, p=(char *)buf; i<count && *p; i++, p++) { | 2031 | for (i=0, p=(char *)buf; i<count && *p; i++, p++) { |
2032 | if ((*p == '\n') | (*p == ' ')) { | 2032 | if ((*p == '\n') || (*p == ' ')) { |
2033 | /* trailing lf, grr */ | 2033 | /* trailing lf, grr */ |
2034 | break; | 2034 | break; |
2035 | } else { | 2035 | } else { |
diff --git a/drivers/s390/net/qeth_main.c b/drivers/s390/net/qeth_main.c index 8e8963f15731..103c41470bd2 100644 --- a/drivers/s390/net/qeth_main.c +++ b/drivers/s390/net/qeth_main.c | |||
@@ -4420,8 +4420,10 @@ qeth_send_packet(struct qeth_card *card, struct sk_buff *skb) | |||
4420 | enum qeth_large_send_types large_send = QETH_LARGE_SEND_NO; | 4420 | enum qeth_large_send_types large_send = QETH_LARGE_SEND_NO; |
4421 | struct qeth_eddp_context *ctx = NULL; | 4421 | struct qeth_eddp_context *ctx = NULL; |
4422 | int tx_bytes = skb->len; | 4422 | int tx_bytes = skb->len; |
4423 | #ifdef CONFIG_QETH_PERF_STATS | ||
4423 | unsigned short nr_frags = skb_shinfo(skb)->nr_frags; | 4424 | unsigned short nr_frags = skb_shinfo(skb)->nr_frags; |
4424 | unsigned short tso_size = skb_shinfo(skb)->gso_size; | 4425 | unsigned short tso_size = skb_shinfo(skb)->gso_size; |
4426 | #endif | ||
4425 | int rc; | 4427 | int rc; |
4426 | 4428 | ||
4427 | QETH_DBF_TEXT(trace, 6, "sendpkt"); | 4429 | QETH_DBF_TEXT(trace, 6, "sendpkt"); |
@@ -4457,7 +4459,7 @@ qeth_send_packet(struct qeth_card *card, struct sk_buff *skb) | |||
4457 | queue = card->qdio.out_qs | 4459 | queue = card->qdio.out_qs |
4458 | [qeth_get_priority_queue(card, skb, ipv, cast_type)]; | 4460 | [qeth_get_priority_queue(card, skb, ipv, cast_type)]; |
4459 | 4461 | ||
4460 | if (skb_shinfo(skb)->gso_size) | 4462 | if (skb_is_gso(skb)) |
4461 | large_send = card->options.large_send; | 4463 | large_send = card->options.large_send; |
4462 | 4464 | ||
4463 | /*are we able to do TSO ? If so ,prepare and send it from here */ | 4465 | /*are we able to do TSO ? If so ,prepare and send it from here */ |
@@ -4802,7 +4804,7 @@ static struct qeth_cmd_buffer * | |||
4802 | qeth_get_setassparms_cmd(struct qeth_card *, enum qeth_ipa_funcs, | 4804 | qeth_get_setassparms_cmd(struct qeth_card *, enum qeth_ipa_funcs, |
4803 | __u16, __u16, enum qeth_prot_versions); | 4805 | __u16, __u16, enum qeth_prot_versions); |
4804 | static int | 4806 | static int |
4805 | qeth_arp_query(struct qeth_card *card, char *udata) | 4807 | qeth_arp_query(struct qeth_card *card, char __user *udata) |
4806 | { | 4808 | { |
4807 | struct qeth_cmd_buffer *iob; | 4809 | struct qeth_cmd_buffer *iob; |
4808 | struct qeth_arp_query_info qinfo = {0, }; | 4810 | struct qeth_arp_query_info qinfo = {0, }; |
@@ -4935,7 +4937,7 @@ qeth_get_adapter_cmd(struct qeth_card *card, __u32 command, __u32 cmdlen) | |||
4935 | * function to send SNMP commands to OSA-E card | 4937 | * function to send SNMP commands to OSA-E card |
4936 | */ | 4938 | */ |
4937 | static int | 4939 | static int |
4938 | qeth_snmp_command(struct qeth_card *card, char *udata) | 4940 | qeth_snmp_command(struct qeth_card *card, char __user *udata) |
4939 | { | 4941 | { |
4940 | struct qeth_cmd_buffer *iob; | 4942 | struct qeth_cmd_buffer *iob; |
4941 | struct qeth_ipa_cmd *cmd; | 4943 | struct qeth_ipa_cmd *cmd; |
@@ -7907,9 +7909,9 @@ qeth_set_online(struct ccwgroup_device *gdev) | |||
7907 | } | 7909 | } |
7908 | 7910 | ||
7909 | static struct ccw_device_id qeth_ids[] = { | 7911 | static struct ccw_device_id qeth_ids[] = { |
7910 | {CCW_DEVICE(0x1731, 0x01), driver_info:QETH_CARD_TYPE_OSAE}, | 7912 | {CCW_DEVICE(0x1731, 0x01), .driver_info = QETH_CARD_TYPE_OSAE}, |
7911 | {CCW_DEVICE(0x1731, 0x05), driver_info:QETH_CARD_TYPE_IQD}, | 7913 | {CCW_DEVICE(0x1731, 0x05), .driver_info = QETH_CARD_TYPE_IQD}, |
7912 | {CCW_DEVICE(0x1731, 0x06), driver_info:QETH_CARD_TYPE_OSN}, | 7914 | {CCW_DEVICE(0x1731, 0x06), .driver_info = QETH_CARD_TYPE_OSN}, |
7913 | {}, | 7915 | {}, |
7914 | }; | 7916 | }; |
7915 | MODULE_DEVICE_TABLE(ccw, qeth_ids); | 7917 | MODULE_DEVICE_TABLE(ccw, qeth_ids); |
@@ -8378,7 +8380,7 @@ out: | |||
8378 | 8380 | ||
8379 | static struct notifier_block qeth_ip_notifier = { | 8381 | static struct notifier_block qeth_ip_notifier = { |
8380 | qeth_ip_event, | 8382 | qeth_ip_event, |
8381 | 0 | 8383 | NULL, |
8382 | }; | 8384 | }; |
8383 | 8385 | ||
8384 | #ifdef CONFIG_QETH_IPV6 | 8386 | #ifdef CONFIG_QETH_IPV6 |
@@ -8431,7 +8433,7 @@ out: | |||
8431 | 8433 | ||
8432 | static struct notifier_block qeth_ip6_notifier = { | 8434 | static struct notifier_block qeth_ip6_notifier = { |
8433 | qeth_ip6_event, | 8435 | qeth_ip6_event, |
8434 | 0 | 8436 | NULL, |
8435 | }; | 8437 | }; |
8436 | #endif | 8438 | #endif |
8437 | 8439 | ||
@@ -8458,7 +8460,7 @@ qeth_reboot_event(struct notifier_block *this, unsigned long event, void *ptr) | |||
8458 | 8460 | ||
8459 | static struct notifier_block qeth_reboot_notifier = { | 8461 | static struct notifier_block qeth_reboot_notifier = { |
8460 | qeth_reboot_event, | 8462 | qeth_reboot_event, |
8461 | 0 | 8463 | NULL, |
8462 | }; | 8464 | }; |
8463 | 8465 | ||
8464 | static int | 8466 | static int |
diff --git a/drivers/s390/net/qeth_sys.c b/drivers/s390/net/qeth_sys.c index 185a9cfbcbdc..001497bbea16 100644 --- a/drivers/s390/net/qeth_sys.c +++ b/drivers/s390/net/qeth_sys.c | |||
@@ -1755,7 +1755,7 @@ qeth_driver_group_store(struct device_driver *ddrv, const char *buf, | |||
1755 | } | 1755 | } |
1756 | 1756 | ||
1757 | 1757 | ||
1758 | static DRIVER_ATTR(group, 0200, 0, qeth_driver_group_store); | 1758 | static DRIVER_ATTR(group, 0200, NULL, qeth_driver_group_store); |
1759 | 1759 | ||
1760 | static ssize_t | 1760 | static ssize_t |
1761 | qeth_driver_notifier_register_store(struct device_driver *ddrv, const char *buf, | 1761 | qeth_driver_notifier_register_store(struct device_driver *ddrv, const char *buf, |
@@ -1783,7 +1783,7 @@ qeth_driver_notifier_register_store(struct device_driver *ddrv, const char *buf, | |||
1783 | return count; | 1783 | return count; |
1784 | } | 1784 | } |
1785 | 1785 | ||
1786 | static DRIVER_ATTR(notifier_register, 0200, 0, | 1786 | static DRIVER_ATTR(notifier_register, 0200, NULL, |
1787 | qeth_driver_notifier_register_store); | 1787 | qeth_driver_notifier_register_store); |
1788 | 1788 | ||
1789 | int | 1789 | int |
diff --git a/drivers/s390/net/smsgiucv.c b/drivers/s390/net/smsgiucv.c index 72118ee68954..b8179c27ceb6 100644 --- a/drivers/s390/net/smsgiucv.c +++ b/drivers/s390/net/smsgiucv.c | |||
@@ -66,7 +66,7 @@ smsg_message_pending(iucv_MessagePending *eib, void *pgm_data) | |||
66 | return; | 66 | return; |
67 | } | 67 | } |
68 | rc = iucv_receive(eib->ippathid, eib->ipmsgid, eib->iptrgcls, | 68 | rc = iucv_receive(eib->ippathid, eib->ipmsgid, eib->iptrgcls, |
69 | msg, len, 0, 0, 0); | 69 | msg, len, NULL, NULL, NULL); |
70 | if (rc == 0) { | 70 | if (rc == 0) { |
71 | msg[len] = 0; | 71 | msg[len] = 0; |
72 | EBCASC(msg, len); | 72 | EBCASC(msg, len); |
@@ -122,7 +122,7 @@ smsg_unregister_callback(char *prefix, void (*callback)(char *from, char *str)) | |||
122 | struct smsg_callback *cb, *tmp; | 122 | struct smsg_callback *cb, *tmp; |
123 | 123 | ||
124 | spin_lock(&smsg_list_lock); | 124 | spin_lock(&smsg_list_lock); |
125 | cb = 0; | 125 | cb = NULL; |
126 | list_for_each_entry(tmp, &smsg_list, list) | 126 | list_for_each_entry(tmp, &smsg_list, list) |
127 | if (tmp->callback == callback && | 127 | if (tmp->callback == callback && |
128 | strcmp(tmp->prefix, prefix) == 0) { | 128 | strcmp(tmp->prefix, prefix) == 0) { |
@@ -139,7 +139,7 @@ smsg_exit(void) | |||
139 | { | 139 | { |
140 | if (smsg_handle > 0) { | 140 | if (smsg_handle > 0) { |
141 | cpcmd("SET SMSG OFF", NULL, 0, NULL); | 141 | cpcmd("SET SMSG OFF", NULL, 0, NULL); |
142 | iucv_sever(smsg_pathid, 0); | 142 | iucv_sever(smsg_pathid, NULL); |
143 | iucv_unregister_program(smsg_handle); | 143 | iucv_unregister_program(smsg_handle); |
144 | driver_unregister(&smsg_driver); | 144 | driver_unregister(&smsg_driver); |
145 | } | 145 | } |
@@ -162,19 +162,19 @@ smsg_init(void) | |||
162 | return rc; | 162 | return rc; |
163 | } | 163 | } |
164 | smsg_handle = iucv_register_program("SMSGIUCV ", "*MSG ", | 164 | smsg_handle = iucv_register_program("SMSGIUCV ", "*MSG ", |
165 | pgmmask, &smsg_ops, 0); | 165 | pgmmask, &smsg_ops, NULL); |
166 | if (!smsg_handle) { | 166 | if (!smsg_handle) { |
167 | printk(KERN_ERR "SMSGIUCV: failed to register to iucv"); | 167 | printk(KERN_ERR "SMSGIUCV: failed to register to iucv"); |
168 | driver_unregister(&smsg_driver); | 168 | driver_unregister(&smsg_driver); |
169 | return -EIO; /* better errno ? */ | 169 | return -EIO; /* better errno ? */ |
170 | } | 170 | } |
171 | rc = iucv_connect (&smsg_pathid, 255, 0, "*MSG ", 0, 0, 0, 0, | 171 | rc = iucv_connect (&smsg_pathid, 255, NULL, "*MSG ", NULL, 0, |
172 | smsg_handle, 0); | 172 | NULL, NULL, smsg_handle, NULL); |
173 | if (rc) { | 173 | if (rc) { |
174 | printk(KERN_ERR "SMSGIUCV: failed to connect to *MSG"); | 174 | printk(KERN_ERR "SMSGIUCV: failed to connect to *MSG"); |
175 | iucv_unregister_program(smsg_handle); | 175 | iucv_unregister_program(smsg_handle); |
176 | driver_unregister(&smsg_driver); | 176 | driver_unregister(&smsg_driver); |
177 | smsg_handle = 0; | 177 | smsg_handle = NULL; |
178 | return -EIO; | 178 | return -EIO; |
179 | } | 179 | } |
180 | cpcmd("SET SMSG IUCV", NULL, 0, NULL); | 180 | cpcmd("SET SMSG IUCV", NULL, 0, NULL); |
diff --git a/drivers/s390/s390mach.c b/drivers/s390/s390mach.c index ffb3677e354f..5399c5d99b81 100644 --- a/drivers/s390/s390mach.c +++ b/drivers/s390/s390mach.c | |||
@@ -111,6 +111,16 @@ repeat: | |||
111 | break; | 111 | break; |
112 | case CRW_RSC_CPATH: | 112 | case CRW_RSC_CPATH: |
113 | pr_debug("source is channel path %02X\n", crw[0].rsid); | 113 | pr_debug("source is channel path %02X\n", crw[0].rsid); |
114 | /* | ||
115 | * Check for solicited machine checks. These are | ||
116 | * created by reset channel path and need not be | ||
117 | * reported to the common I/O layer. | ||
118 | */ | ||
119 | if (crw[chain].slct) { | ||
120 | DBG(KERN_INFO"solicited machine check for " | ||
121 | "channel path %02X\n", crw[0].rsid); | ||
122 | break; | ||
123 | } | ||
114 | switch (crw[0].erc) { | 124 | switch (crw[0].erc) { |
115 | case CRW_ERC_IPARM: /* Path has come. */ | 125 | case CRW_ERC_IPARM: /* Path has come. */ |
116 | ret = chp_process_crw(crw[0].rsid, 1); | 126 | ret = chp_process_crw(crw[0].rsid, 1); |
diff --git a/drivers/s390/scsi/zfcp_fsf.c b/drivers/s390/scsi/zfcp_fsf.c index 6335f9229184..31db2b06faba 100644 --- a/drivers/s390/scsi/zfcp_fsf.c +++ b/drivers/s390/scsi/zfcp_fsf.c | |||
@@ -2227,7 +2227,7 @@ zfcp_fsf_exchange_port_data(struct zfcp_erp_action *erp_action, | |||
2227 | /* setup new FSF request */ | 2227 | /* setup new FSF request */ |
2228 | retval = zfcp_fsf_req_create(adapter, FSF_QTCB_EXCHANGE_PORT_DATA, | 2228 | retval = zfcp_fsf_req_create(adapter, FSF_QTCB_EXCHANGE_PORT_DATA, |
2229 | erp_action ? ZFCP_REQ_AUTO_CLEANUP : 0, | 2229 | erp_action ? ZFCP_REQ_AUTO_CLEANUP : 0, |
2230 | 0, &lock_flags, &fsf_req); | 2230 | NULL, &lock_flags, &fsf_req); |
2231 | if (retval < 0) { | 2231 | if (retval < 0) { |
2232 | ZFCP_LOG_INFO("error: Out of resources. Could not create an " | 2232 | ZFCP_LOG_INFO("error: Out of resources. Could not create an " |
2233 | "exchange port data request for" | 2233 | "exchange port data request for" |
diff --git a/drivers/s390/scsi/zfcp_scsi.c b/drivers/s390/scsi/zfcp_scsi.c index 46e14f22ec18..671f4a6a5d18 100644 --- a/drivers/s390/scsi/zfcp_scsi.c +++ b/drivers/s390/scsi/zfcp_scsi.c | |||
@@ -44,30 +44,29 @@ struct scsi_transport_template *zfcp_transport_template; | |||
44 | 44 | ||
45 | struct zfcp_data zfcp_data = { | 45 | struct zfcp_data zfcp_data = { |
46 | .scsi_host_template = { | 46 | .scsi_host_template = { |
47 | name: ZFCP_NAME, | 47 | .name = ZFCP_NAME, |
48 | proc_name: "zfcp", | 48 | .proc_name = "zfcp", |
49 | proc_info: NULL, | 49 | .proc_info = NULL, |
50 | detect: NULL, | 50 | .detect = NULL, |
51 | slave_alloc: zfcp_scsi_slave_alloc, | 51 | .slave_alloc = zfcp_scsi_slave_alloc, |
52 | slave_configure: zfcp_scsi_slave_configure, | 52 | .slave_configure = zfcp_scsi_slave_configure, |
53 | slave_destroy: zfcp_scsi_slave_destroy, | 53 | .slave_destroy = zfcp_scsi_slave_destroy, |
54 | queuecommand: zfcp_scsi_queuecommand, | 54 | .queuecommand = zfcp_scsi_queuecommand, |
55 | eh_abort_handler: zfcp_scsi_eh_abort_handler, | 55 | .eh_abort_handler = zfcp_scsi_eh_abort_handler, |
56 | eh_device_reset_handler: zfcp_scsi_eh_device_reset_handler, | 56 | .eh_device_reset_handler = zfcp_scsi_eh_device_reset_handler, |
57 | eh_bus_reset_handler: zfcp_scsi_eh_bus_reset_handler, | 57 | .eh_bus_reset_handler = zfcp_scsi_eh_bus_reset_handler, |
58 | eh_host_reset_handler: zfcp_scsi_eh_host_reset_handler, | 58 | .eh_host_reset_handler = zfcp_scsi_eh_host_reset_handler, |
59 | /* FIXME(openfcp): Tune */ | 59 | .can_queue = 4096, |
60 | can_queue: 4096, | 60 | .this_id = -1, |
61 | this_id: -1, | 61 | /* |
62 | /* | 62 | * FIXME: |
63 | * FIXME: | 63 | * one less? can zfcp_create_sbale cope with it? |
64 | * one less? can zfcp_create_sbale cope with it? | 64 | */ |
65 | */ | 65 | .sg_tablesize = ZFCP_MAX_SBALES_PER_REQ, |
66 | sg_tablesize: ZFCP_MAX_SBALES_PER_REQ, | 66 | .cmd_per_lun = 1, |
67 | cmd_per_lun: 1, | 67 | .unchecked_isa_dma = 0, |
68 | unchecked_isa_dma: 0, | 68 | .use_clustering = 1, |
69 | use_clustering: 1, | 69 | .sdev_attrs = zfcp_sysfs_sdev_attrs, |
70 | sdev_attrs: zfcp_sysfs_sdev_attrs, | ||
71 | }, | 70 | }, |
72 | .driver_version = ZFCP_VERSION, | 71 | .driver_version = ZFCP_VERSION, |
73 | /* rest initialised with zeros */ | 72 | /* rest initialised with zeros */ |
diff --git a/drivers/scsi/aic7xxx/aic79xx_osm.h b/drivers/scsi/aic7xxx/aic79xx_osm.h index 9e871de23835..601340d84410 100644 --- a/drivers/scsi/aic7xxx/aic79xx_osm.h +++ b/drivers/scsi/aic7xxx/aic79xx_osm.h | |||
@@ -93,7 +93,6 @@ | |||
93 | #endif | 93 | #endif |
94 | 94 | ||
95 | /********************************** Misc Macros *******************************/ | 95 | /********************************** Misc Macros *******************************/ |
96 | #define roundup(x, y) ((((x)+((y)-1))/(y))*(y)) | ||
97 | #define powerof2(x) ((((x)-1)&(x))==0) | 96 | #define powerof2(x) ((((x)-1)&(x))==0) |
98 | 97 | ||
99 | /************************* Forward Declarations *******************************/ | 98 | /************************* Forward Declarations *******************************/ |
diff --git a/drivers/serial/8250.c b/drivers/serial/8250.c index 0995430e4cf1..0ae9ced00ed4 100644 --- a/drivers/serial/8250.c +++ b/drivers/serial/8250.c | |||
@@ -299,6 +299,7 @@ static inline int map_8250_out_reg(struct uart_8250_port *up, int offset) | |||
299 | 299 | ||
300 | static unsigned int serial_in(struct uart_8250_port *up, int offset) | 300 | static unsigned int serial_in(struct uart_8250_port *up, int offset) |
301 | { | 301 | { |
302 | unsigned int tmp; | ||
302 | offset = map_8250_in_reg(up, offset) << up->port.regshift; | 303 | offset = map_8250_in_reg(up, offset) << up->port.regshift; |
303 | 304 | ||
304 | switch (up->port.iotype) { | 305 | switch (up->port.iotype) { |
@@ -317,6 +318,13 @@ static unsigned int serial_in(struct uart_8250_port *up, int offset) | |||
317 | return __raw_readl(up->port.membase + offset); | 318 | return __raw_readl(up->port.membase + offset); |
318 | #endif | 319 | #endif |
319 | 320 | ||
321 | case UPIO_TSI: | ||
322 | if (offset == UART_IIR) { | ||
323 | tmp = readl((u32 *)(up->port.membase + UART_RX)); | ||
324 | return (cpu_to_le32(tmp) >> 8) & 0xff; | ||
325 | } else | ||
326 | return readb(up->port.membase + offset); | ||
327 | |||
320 | default: | 328 | default: |
321 | return inb(up->port.iobase + offset); | 329 | return inb(up->port.iobase + offset); |
322 | } | 330 | } |
@@ -346,6 +354,10 @@ serial_out(struct uart_8250_port *up, int offset, int value) | |||
346 | __raw_writel(value, up->port.membase + offset); | 354 | __raw_writel(value, up->port.membase + offset); |
347 | break; | 355 | break; |
348 | #endif | 356 | #endif |
357 | case UPIO_TSI: | ||
358 | if (!((offset == UART_IER) && (value & UART_IER_UUE))) | ||
359 | writeb(value, up->port.membase + offset); | ||
360 | break; | ||
349 | 361 | ||
350 | default: | 362 | default: |
351 | outb(value, up->port.iobase + offset); | 363 | outb(value, up->port.iobase + offset); |
@@ -2240,10 +2252,14 @@ serial8250_console_write(struct console *co, const char *s, unsigned int count) | |||
2240 | 2252 | ||
2241 | touch_nmi_watchdog(); | 2253 | touch_nmi_watchdog(); |
2242 | 2254 | ||
2243 | if (oops_in_progress) { | 2255 | local_irq_save(flags); |
2244 | locked = spin_trylock_irqsave(&up->port.lock, flags); | 2256 | if (up->port.sysrq) { |
2257 | /* serial8250_handle_port() already took the lock */ | ||
2258 | locked = 0; | ||
2259 | } else if (oops_in_progress) { | ||
2260 | locked = spin_trylock(&up->port.lock); | ||
2245 | } else | 2261 | } else |
2246 | spin_lock_irqsave(&up->port.lock, flags); | 2262 | spin_lock(&up->port.lock); |
2247 | 2263 | ||
2248 | /* | 2264 | /* |
2249 | * First save the IER then disable the interrupts | 2265 | * First save the IER then disable the interrupts |
@@ -2265,7 +2281,8 @@ serial8250_console_write(struct console *co, const char *s, unsigned int count) | |||
2265 | serial_out(up, UART_IER, ier); | 2281 | serial_out(up, UART_IER, ier); |
2266 | 2282 | ||
2267 | if (locked) | 2283 | if (locked) |
2268 | spin_unlock_irqrestore(&up->port.lock, flags); | 2284 | spin_unlock(&up->port.lock); |
2285 | local_irq_restore(flags); | ||
2269 | } | 2286 | } |
2270 | 2287 | ||
2271 | static int serial8250_console_setup(struct console *co, char *options) | 2288 | static int serial8250_console_setup(struct console *co, char *options) |
diff --git a/drivers/serial/dz.c b/drivers/serial/dz.c index d119c8296a78..8a98aae80e22 100644 --- a/drivers/serial/dz.c +++ b/drivers/serial/dz.c | |||
@@ -673,7 +673,7 @@ static void dz_reset(struct dz_port *dport) | |||
673 | } | 673 | } |
674 | 674 | ||
675 | #ifdef CONFIG_SERIAL_DZ_CONSOLE | 675 | #ifdef CONFIG_SERIAL_DZ_CONSOLE |
676 | static void dz_console_putchar(struct uart_port *port, int ch) | 676 | static void dz_console_putchar(struct uart_port *uport, int ch) |
677 | { | 677 | { |
678 | struct dz_port *dport = (struct dz_port *)uport; | 678 | struct dz_port *dport = (struct dz_port *)uport; |
679 | unsigned long flags; | 679 | unsigned long flags; |
diff --git a/drivers/serial/ip22zilog.c b/drivers/serial/ip22zilog.c index 342042889f6e..5ff269fb604c 100644 --- a/drivers/serial/ip22zilog.c +++ b/drivers/serial/ip22zilog.c | |||
@@ -1143,9 +1143,8 @@ static void __init ip22zilog_prepare(void) | |||
1143 | up[(chip * 2) + 1].port.fifosize = 1; | 1143 | up[(chip * 2) + 1].port.fifosize = 1; |
1144 | up[(chip * 2) + 1].port.ops = &ip22zilog_pops; | 1144 | up[(chip * 2) + 1].port.ops = &ip22zilog_pops; |
1145 | up[(chip * 2) + 1].port.type = PORT_IP22ZILOG; | 1145 | up[(chip * 2) + 1].port.type = PORT_IP22ZILOG; |
1146 | up[(chip * 2) + 1].port.flags |= IP22ZILOG_FLAG_IS_CHANNEL_A; | ||
1147 | up[(chip * 2) + 1].port.line = (chip * 2) + 1; | 1146 | up[(chip * 2) + 1].port.line = (chip * 2) + 1; |
1148 | up[(chip * 2) + 1].flags = 0; | 1147 | up[(chip * 2) + 1].flags |= IP22ZILOG_FLAG_IS_CHANNEL_A; |
1149 | } | 1148 | } |
1150 | } | 1149 | } |
1151 | 1150 | ||
diff --git a/drivers/serial/serial_core.c b/drivers/serial/serial_core.c index d5f636fbf29a..80ef7d482756 100644 --- a/drivers/serial/serial_core.c +++ b/drivers/serial/serial_core.c | |||
@@ -2036,6 +2036,7 @@ uart_report_port(struct uart_driver *drv, struct uart_port *port) | |||
2036 | case UPIO_MEM: | 2036 | case UPIO_MEM: |
2037 | case UPIO_MEM32: | 2037 | case UPIO_MEM32: |
2038 | case UPIO_AU: | 2038 | case UPIO_AU: |
2039 | case UPIO_TSI: | ||
2039 | snprintf(address, sizeof(address), | 2040 | snprintf(address, sizeof(address), |
2040 | "MMIO 0x%lx", port->mapbase); | 2041 | "MMIO 0x%lx", port->mapbase); |
2041 | break; | 2042 | break; |
diff --git a/drivers/serial/sunsab.c b/drivers/serial/sunsab.c index 0dbd4df44c05..979497f108c8 100644 --- a/drivers/serial/sunsab.c +++ b/drivers/serial/sunsab.c | |||
@@ -1052,7 +1052,7 @@ static int __devinit sab_probe(struct of_device *op, const struct of_device_id * | |||
1052 | if (err) | 1052 | if (err) |
1053 | return err; | 1053 | return err; |
1054 | 1054 | ||
1055 | err = sunsab_init_one(&up[0], op, 0, | 1055 | err = sunsab_init_one(&up[1], op, 0, |
1056 | (inst * 2) + 1); | 1056 | (inst * 2) + 1); |
1057 | if (err) { | 1057 | if (err) { |
1058 | of_iounmap(up[0].port.membase, | 1058 | of_iounmap(up[0].port.membase, |
diff --git a/drivers/serial/sunsu.c b/drivers/serial/sunsu.c index f9013baba05b..d3a5aeee73a3 100644 --- a/drivers/serial/sunsu.c +++ b/drivers/serial/sunsu.c | |||
@@ -1200,6 +1200,11 @@ static int __init sunsu_kbd_ms_init(struct uart_sunsu_port *up) | |||
1200 | if (up->port.type == PORT_UNKNOWN) | 1200 | if (up->port.type == PORT_UNKNOWN) |
1201 | return -ENODEV; | 1201 | return -ENODEV; |
1202 | 1202 | ||
1203 | printk("%s: %s port at %lx, irq %u\n", | ||
1204 | to_of_device(up->port.dev)->node->full_name, | ||
1205 | (up->su_type == SU_PORT_KBD) ? "Keyboard" : "Mouse", | ||
1206 | up->port.mapbase, up->port.irq); | ||
1207 | |||
1203 | #ifdef CONFIG_SERIO | 1208 | #ifdef CONFIG_SERIO |
1204 | serio = &up->serio; | 1209 | serio = &up->serio; |
1205 | serio->port_data = up; | 1210 | serio->port_data = up; |
@@ -1406,25 +1411,35 @@ static int __devinit su_probe(struct of_device *op, const struct of_device_id *m | |||
1406 | struct device_node *dp = op->node; | 1411 | struct device_node *dp = op->node; |
1407 | struct uart_sunsu_port *up; | 1412 | struct uart_sunsu_port *up; |
1408 | struct resource *rp; | 1413 | struct resource *rp; |
1414 | enum su_type type; | ||
1409 | int err; | 1415 | int err; |
1410 | 1416 | ||
1411 | if (inst >= UART_NR) | 1417 | type = su_get_type(dp); |
1412 | return -EINVAL; | 1418 | if (type == SU_PORT_PORT) { |
1419 | if (inst >= UART_NR) | ||
1420 | return -EINVAL; | ||
1421 | up = &sunsu_ports[inst]; | ||
1422 | } else { | ||
1423 | up = kzalloc(sizeof(*up), GFP_KERNEL); | ||
1424 | if (!up) | ||
1425 | return -ENOMEM; | ||
1426 | } | ||
1413 | 1427 | ||
1414 | up = &sunsu_ports[inst]; | ||
1415 | up->port.line = inst; | 1428 | up->port.line = inst; |
1416 | 1429 | ||
1417 | spin_lock_init(&up->port.lock); | 1430 | spin_lock_init(&up->port.lock); |
1418 | 1431 | ||
1419 | up->su_type = su_get_type(dp); | 1432 | up->su_type = type; |
1420 | 1433 | ||
1421 | rp = &op->resource[0]; | 1434 | rp = &op->resource[0]; |
1422 | up->port.mapbase = op->resource[0].start; | 1435 | up->port.mapbase = rp->start; |
1423 | |||
1424 | up->reg_size = (rp->end - rp->start) + 1; | 1436 | up->reg_size = (rp->end - rp->start) + 1; |
1425 | up->port.membase = of_ioremap(rp, 0, up->reg_size, "su"); | 1437 | up->port.membase = of_ioremap(rp, 0, up->reg_size, "su"); |
1426 | if (!up->port.membase) | 1438 | if (!up->port.membase) { |
1439 | if (type != SU_PORT_PORT) | ||
1440 | kfree(up); | ||
1427 | return -ENOMEM; | 1441 | return -ENOMEM; |
1442 | } | ||
1428 | 1443 | ||
1429 | up->port.irq = op->irqs[0]; | 1444 | up->port.irq = op->irqs[0]; |
1430 | 1445 | ||
@@ -1436,8 +1451,11 @@ static int __devinit su_probe(struct of_device *op, const struct of_device_id *m | |||
1436 | err = 0; | 1451 | err = 0; |
1437 | if (up->su_type == SU_PORT_KBD || up->su_type == SU_PORT_MS) { | 1452 | if (up->su_type == SU_PORT_KBD || up->su_type == SU_PORT_MS) { |
1438 | err = sunsu_kbd_ms_init(up); | 1453 | err = sunsu_kbd_ms_init(up); |
1439 | if (err) | 1454 | if (err) { |
1455 | kfree(up); | ||
1440 | goto out_unmap; | 1456 | goto out_unmap; |
1457 | } | ||
1458 | dev_set_drvdata(&op->dev, up); | ||
1441 | 1459 | ||
1442 | return 0; | 1460 | return 0; |
1443 | } | 1461 | } |
@@ -1476,8 +1494,12 @@ static int __devexit su_remove(struct of_device *dev) | |||
1476 | #ifdef CONFIG_SERIO | 1494 | #ifdef CONFIG_SERIO |
1477 | serio_unregister_port(&up->serio); | 1495 | serio_unregister_port(&up->serio); |
1478 | #endif | 1496 | #endif |
1479 | } else if (up->port.type != PORT_UNKNOWN) | 1497 | kfree(up); |
1498 | } else if (up->port.type != PORT_UNKNOWN) { | ||
1480 | uart_remove_one_port(&sunsu_reg, &up->port); | 1499 | uart_remove_one_port(&sunsu_reg, &up->port); |
1500 | } | ||
1501 | |||
1502 | dev_set_drvdata(&dev->dev, NULL); | ||
1481 | 1503 | ||
1482 | return 0; | 1504 | return 0; |
1483 | } | 1505 | } |
diff --git a/drivers/serial/vr41xx_siu.c b/drivers/serial/vr41xx_siu.c index e93d0edc2e08..6c8b0ea83c3c 100644 --- a/drivers/serial/vr41xx_siu.c +++ b/drivers/serial/vr41xx_siu.c | |||
@@ -38,6 +38,7 @@ | |||
38 | #include <linux/tty_flip.h> | 38 | #include <linux/tty_flip.h> |
39 | 39 | ||
40 | #include <asm/io.h> | 40 | #include <asm/io.h> |
41 | #include <asm/vr41xx/irq.h> | ||
41 | #include <asm/vr41xx/siu.h> | 42 | #include <asm/vr41xx/siu.h> |
42 | #include <asm/vr41xx/vr41xx.h> | 43 | #include <asm/vr41xx/vr41xx.h> |
43 | 44 | ||
diff --git a/drivers/usb/Kconfig b/drivers/usb/Kconfig index 7fdbc5dad5fd..2ee742d40c43 100644 --- a/drivers/usb/Kconfig +++ b/drivers/usb/Kconfig | |||
@@ -23,6 +23,7 @@ config USB_ARCH_HAS_OHCI | |||
23 | default y if ARCH_LH7A404 | 23 | default y if ARCH_LH7A404 |
24 | default y if ARCH_S3C2410 | 24 | default y if ARCH_S3C2410 |
25 | default y if PXA27x | 25 | default y if PXA27x |
26 | default y if ARCH_EP93XX | ||
26 | default y if ARCH_AT91RM9200 | 27 | default y if ARCH_AT91RM9200 |
27 | # PPC: | 28 | # PPC: |
28 | default y if STB03xxx | 29 | default y if STB03xxx |
diff --git a/drivers/usb/Makefile b/drivers/usb/Makefile index c7123bf71c58..4710eb02ed64 100644 --- a/drivers/usb/Makefile +++ b/drivers/usb/Makefile | |||
@@ -48,7 +48,7 @@ obj-$(CONFIG_USB_MICROTEK) += image/ | |||
48 | obj-$(CONFIG_USB_SERIAL) += serial/ | 48 | obj-$(CONFIG_USB_SERIAL) += serial/ |
49 | 49 | ||
50 | obj-$(CONFIG_USB_AUERSWALD) += misc/ | 50 | obj-$(CONFIG_USB_AUERSWALD) += misc/ |
51 | obj-$(CONFIG_USB_CY7C63) += misc/ | 51 | obj-$(CONFIG_USB_CYPRESS_CY7C63)+= misc/ |
52 | obj-$(CONFIG_USB_CYTHERM) += misc/ | 52 | obj-$(CONFIG_USB_CYTHERM) += misc/ |
53 | obj-$(CONFIG_USB_EMI26) += misc/ | 53 | obj-$(CONFIG_USB_EMI26) += misc/ |
54 | obj-$(CONFIG_USB_EMI62) += misc/ | 54 | obj-$(CONFIG_USB_EMI62) += misc/ |
diff --git a/drivers/usb/class/cdc-acm.c b/drivers/usb/class/cdc-acm.c index 3670d77e912c..ca90326f2f5c 100644 --- a/drivers/usb/class/cdc-acm.c +++ b/drivers/usb/class/cdc-acm.c | |||
@@ -291,13 +291,13 @@ static void acm_read_bulk(struct urb *urb, struct pt_regs *regs) | |||
291 | struct acm_ru *rcv = urb->context; | 291 | struct acm_ru *rcv = urb->context; |
292 | struct acm *acm = rcv->instance; | 292 | struct acm *acm = rcv->instance; |
293 | int status = urb->status; | 293 | int status = urb->status; |
294 | dbg("Entering acm_read_bulk with status %d\n", urb->status); | 294 | dbg("Entering acm_read_bulk with status %d", urb->status); |
295 | 295 | ||
296 | if (!ACM_READY(acm)) | 296 | if (!ACM_READY(acm)) |
297 | return; | 297 | return; |
298 | 298 | ||
299 | if (status) | 299 | if (status) |
300 | dev_dbg(&acm->data->dev, "bulk rx status %d\n", status); | 300 | dev_dbg(&acm->data->dev, "bulk rx status %d", status); |
301 | 301 | ||
302 | buf = rcv->buffer; | 302 | buf = rcv->buffer; |
303 | buf->size = urb->actual_length; | 303 | buf->size = urb->actual_length; |
@@ -343,7 +343,7 @@ next_buffer: | |||
343 | list_del(&buf->list); | 343 | list_del(&buf->list); |
344 | spin_unlock(&acm->read_lock); | 344 | spin_unlock(&acm->read_lock); |
345 | 345 | ||
346 | dbg("acm_rx_tasklet: procesing buf 0x%p, size = %d\n", buf, buf->size); | 346 | dbg("acm_rx_tasklet: procesing buf 0x%p, size = %d", buf, buf->size); |
347 | 347 | ||
348 | tty_buffer_request_room(tty, buf->size); | 348 | tty_buffer_request_room(tty, buf->size); |
349 | if (!acm->throttle) | 349 | if (!acm->throttle) |
@@ -394,7 +394,7 @@ urbs: | |||
394 | rcv->urb->transfer_dma = buf->dma; | 394 | rcv->urb->transfer_dma = buf->dma; |
395 | rcv->urb->transfer_flags |= URB_NO_TRANSFER_DMA_MAP; | 395 | rcv->urb->transfer_flags |= URB_NO_TRANSFER_DMA_MAP; |
396 | 396 | ||
397 | dbg("acm_rx_tasklet: sending urb 0x%p, rcv 0x%p, buf 0x%p\n", rcv->urb, rcv, buf); | 397 | dbg("acm_rx_tasklet: sending urb 0x%p, rcv 0x%p, buf 0x%p", rcv->urb, rcv, buf); |
398 | 398 | ||
399 | /* This shouldn't kill the driver as unsuccessful URBs are returned to the | 399 | /* This shouldn't kill the driver as unsuccessful URBs are returned to the |
400 | free-urbs-pool and resubmited ASAP */ | 400 | free-urbs-pool and resubmited ASAP */ |
@@ -413,7 +413,7 @@ static void acm_write_bulk(struct urb *urb, struct pt_regs *regs) | |||
413 | { | 413 | { |
414 | struct acm *acm = (struct acm *)urb->context; | 414 | struct acm *acm = (struct acm *)urb->context; |
415 | 415 | ||
416 | dbg("Entering acm_write_bulk with status %d\n", urb->status); | 416 | dbg("Entering acm_write_bulk with status %d", urb->status); |
417 | 417 | ||
418 | acm_write_done(acm); | 418 | acm_write_done(acm); |
419 | acm_write_start(acm); | 419 | acm_write_start(acm); |
@@ -424,7 +424,7 @@ static void acm_write_bulk(struct urb *urb, struct pt_regs *regs) | |||
424 | static void acm_softint(void *private) | 424 | static void acm_softint(void *private) |
425 | { | 425 | { |
426 | struct acm *acm = private; | 426 | struct acm *acm = private; |
427 | dbg("Entering acm_softint.\n"); | 427 | dbg("Entering acm_softint."); |
428 | 428 | ||
429 | if (!ACM_READY(acm)) | 429 | if (!ACM_READY(acm)) |
430 | return; | 430 | return; |
@@ -440,7 +440,7 @@ static int acm_tty_open(struct tty_struct *tty, struct file *filp) | |||
440 | struct acm *acm; | 440 | struct acm *acm; |
441 | int rv = -EINVAL; | 441 | int rv = -EINVAL; |
442 | int i; | 442 | int i; |
443 | dbg("Entering acm_tty_open.\n"); | 443 | dbg("Entering acm_tty_open."); |
444 | 444 | ||
445 | mutex_lock(&open_mutex); | 445 | mutex_lock(&open_mutex); |
446 | 446 | ||
@@ -541,7 +541,7 @@ static int acm_tty_write(struct tty_struct *tty, const unsigned char *buf, int c | |||
541 | int wbn; | 541 | int wbn; |
542 | struct acm_wb *wb; | 542 | struct acm_wb *wb; |
543 | 543 | ||
544 | dbg("Entering acm_tty_write to write %d bytes,\n", count); | 544 | dbg("Entering acm_tty_write to write %d bytes,", count); |
545 | 545 | ||
546 | if (!ACM_READY(acm)) | 546 | if (!ACM_READY(acm)) |
547 | return -EINVAL; | 547 | return -EINVAL; |
@@ -793,7 +793,7 @@ static int acm_probe (struct usb_interface *intf, | |||
793 | 793 | ||
794 | if (!buflen) { | 794 | if (!buflen) { |
795 | if (intf->cur_altsetting->endpoint->extralen && intf->cur_altsetting->endpoint->extra) { | 795 | if (intf->cur_altsetting->endpoint->extralen && intf->cur_altsetting->endpoint->extra) { |
796 | dev_dbg(&intf->dev,"Seeking extra descriptors on endpoint\n"); | 796 | dev_dbg(&intf->dev,"Seeking extra descriptors on endpoint"); |
797 | buflen = intf->cur_altsetting->endpoint->extralen; | 797 | buflen = intf->cur_altsetting->endpoint->extralen; |
798 | buffer = intf->cur_altsetting->endpoint->extra; | 798 | buffer = intf->cur_altsetting->endpoint->extra; |
799 | } else { | 799 | } else { |
@@ -842,24 +842,24 @@ next_desc: | |||
842 | 842 | ||
843 | if (!union_header) { | 843 | if (!union_header) { |
844 | if (call_interface_num > 0) { | 844 | if (call_interface_num > 0) { |
845 | dev_dbg(&intf->dev,"No union descriptor, using call management descriptor\n"); | 845 | dev_dbg(&intf->dev,"No union descriptor, using call management descriptor"); |
846 | data_interface = usb_ifnum_to_if(usb_dev, (data_interface_num = call_interface_num)); | 846 | data_interface = usb_ifnum_to_if(usb_dev, (data_interface_num = call_interface_num)); |
847 | control_interface = intf; | 847 | control_interface = intf; |
848 | } else { | 848 | } else { |
849 | dev_dbg(&intf->dev,"No union descriptor, giving up\n"); | 849 | dev_dbg(&intf->dev,"No union descriptor, giving up"); |
850 | return -ENODEV; | 850 | return -ENODEV; |
851 | } | 851 | } |
852 | } else { | 852 | } else { |
853 | control_interface = usb_ifnum_to_if(usb_dev, union_header->bMasterInterface0); | 853 | control_interface = usb_ifnum_to_if(usb_dev, union_header->bMasterInterface0); |
854 | data_interface = usb_ifnum_to_if(usb_dev, (data_interface_num = union_header->bSlaveInterface0)); | 854 | data_interface = usb_ifnum_to_if(usb_dev, (data_interface_num = union_header->bSlaveInterface0)); |
855 | if (!control_interface || !data_interface) { | 855 | if (!control_interface || !data_interface) { |
856 | dev_dbg(&intf->dev,"no interfaces\n"); | 856 | dev_dbg(&intf->dev,"no interfaces"); |
857 | return -ENODEV; | 857 | return -ENODEV; |
858 | } | 858 | } |
859 | } | 859 | } |
860 | 860 | ||
861 | if (data_interface_num != call_interface_num) | 861 | if (data_interface_num != call_interface_num) |
862 | dev_dbg(&intf->dev,"Seperate call control interface. That is not fully supported.\n"); | 862 | dev_dbg(&intf->dev,"Seperate call control interface. That is not fully supported."); |
863 | 863 | ||
864 | skip_normal_probe: | 864 | skip_normal_probe: |
865 | 865 | ||
@@ -867,7 +867,7 @@ skip_normal_probe: | |||
867 | if (data_interface->cur_altsetting->desc.bInterfaceClass != CDC_DATA_INTERFACE_TYPE) { | 867 | if (data_interface->cur_altsetting->desc.bInterfaceClass != CDC_DATA_INTERFACE_TYPE) { |
868 | if (control_interface->cur_altsetting->desc.bInterfaceClass == CDC_DATA_INTERFACE_TYPE) { | 868 | if (control_interface->cur_altsetting->desc.bInterfaceClass == CDC_DATA_INTERFACE_TYPE) { |
869 | struct usb_interface *t; | 869 | struct usb_interface *t; |
870 | dev_dbg(&intf->dev,"Your device has switched interfaces.\n"); | 870 | dev_dbg(&intf->dev,"Your device has switched interfaces."); |
871 | 871 | ||
872 | t = control_interface; | 872 | t = control_interface; |
873 | control_interface = data_interface; | 873 | control_interface = data_interface; |
@@ -878,7 +878,7 @@ skip_normal_probe: | |||
878 | } | 878 | } |
879 | 879 | ||
880 | if (usb_interface_claimed(data_interface)) { /* valid in this context */ | 880 | if (usb_interface_claimed(data_interface)) { /* valid in this context */ |
881 | dev_dbg(&intf->dev,"The data interface isn't available\n"); | 881 | dev_dbg(&intf->dev,"The data interface isn't available"); |
882 | return -EBUSY; | 882 | return -EBUSY; |
883 | } | 883 | } |
884 | 884 | ||
@@ -895,7 +895,7 @@ skip_normal_probe: | |||
895 | if ((epread->bEndpointAddress & USB_DIR_IN) != USB_DIR_IN) { | 895 | if ((epread->bEndpointAddress & USB_DIR_IN) != USB_DIR_IN) { |
896 | /* descriptors are swapped */ | 896 | /* descriptors are swapped */ |
897 | struct usb_endpoint_descriptor *t; | 897 | struct usb_endpoint_descriptor *t; |
898 | dev_dbg(&intf->dev,"The data interface has switched endpoints\n"); | 898 | dev_dbg(&intf->dev,"The data interface has switched endpoints"); |
899 | 899 | ||
900 | t = epread; | 900 | t = epread; |
901 | epread = epwrite; | 901 | epread = epwrite; |
@@ -910,7 +910,7 @@ skip_normal_probe: | |||
910 | } | 910 | } |
911 | 911 | ||
912 | if (!(acm = kzalloc(sizeof(struct acm), GFP_KERNEL))) { | 912 | if (!(acm = kzalloc(sizeof(struct acm), GFP_KERNEL))) { |
913 | dev_dbg(&intf->dev, "out of memory (acm kzalloc)\n"); | 913 | dev_dbg(&intf->dev, "out of memory (acm kzalloc)"); |
914 | goto alloc_fail; | 914 | goto alloc_fail; |
915 | } | 915 | } |
916 | 916 | ||
@@ -936,26 +936,26 @@ skip_normal_probe: | |||
936 | 936 | ||
937 | buf = usb_buffer_alloc(usb_dev, ctrlsize, GFP_KERNEL, &acm->ctrl_dma); | 937 | buf = usb_buffer_alloc(usb_dev, ctrlsize, GFP_KERNEL, &acm->ctrl_dma); |
938 | if (!buf) { | 938 | if (!buf) { |
939 | dev_dbg(&intf->dev, "out of memory (ctrl buffer alloc)\n"); | 939 | dev_dbg(&intf->dev, "out of memory (ctrl buffer alloc)"); |
940 | goto alloc_fail2; | 940 | goto alloc_fail2; |
941 | } | 941 | } |
942 | acm->ctrl_buffer = buf; | 942 | acm->ctrl_buffer = buf; |
943 | 943 | ||
944 | if (acm_write_buffers_alloc(acm) < 0) { | 944 | if (acm_write_buffers_alloc(acm) < 0) { |
945 | dev_dbg(&intf->dev, "out of memory (write buffer alloc)\n"); | 945 | dev_dbg(&intf->dev, "out of memory (write buffer alloc)"); |
946 | goto alloc_fail4; | 946 | goto alloc_fail4; |
947 | } | 947 | } |
948 | 948 | ||
949 | acm->ctrlurb = usb_alloc_urb(0, GFP_KERNEL); | 949 | acm->ctrlurb = usb_alloc_urb(0, GFP_KERNEL); |
950 | if (!acm->ctrlurb) { | 950 | if (!acm->ctrlurb) { |
951 | dev_dbg(&intf->dev, "out of memory (ctrlurb kmalloc)\n"); | 951 | dev_dbg(&intf->dev, "out of memory (ctrlurb kmalloc)"); |
952 | goto alloc_fail5; | 952 | goto alloc_fail5; |
953 | } | 953 | } |
954 | for (i = 0; i < num_rx_buf; i++) { | 954 | for (i = 0; i < num_rx_buf; i++) { |
955 | struct acm_ru *rcv = &(acm->ru[i]); | 955 | struct acm_ru *rcv = &(acm->ru[i]); |
956 | 956 | ||
957 | if (!(rcv->urb = usb_alloc_urb(0, GFP_KERNEL))) { | 957 | if (!(rcv->urb = usb_alloc_urb(0, GFP_KERNEL))) { |
958 | dev_dbg(&intf->dev, "out of memory (read urbs usb_alloc_urb)\n"); | 958 | dev_dbg(&intf->dev, "out of memory (read urbs usb_alloc_urb)"); |
959 | goto alloc_fail7; | 959 | goto alloc_fail7; |
960 | } | 960 | } |
961 | 961 | ||
@@ -966,13 +966,13 @@ skip_normal_probe: | |||
966 | struct acm_rb *buf = &(acm->rb[i]); | 966 | struct acm_rb *buf = &(acm->rb[i]); |
967 | 967 | ||
968 | if (!(buf->base = usb_buffer_alloc(acm->dev, readsize, GFP_KERNEL, &buf->dma))) { | 968 | if (!(buf->base = usb_buffer_alloc(acm->dev, readsize, GFP_KERNEL, &buf->dma))) { |
969 | dev_dbg(&intf->dev, "out of memory (read bufs usb_buffer_alloc)\n"); | 969 | dev_dbg(&intf->dev, "out of memory (read bufs usb_buffer_alloc)"); |
970 | goto alloc_fail7; | 970 | goto alloc_fail7; |
971 | } | 971 | } |
972 | } | 972 | } |
973 | acm->writeurb = usb_alloc_urb(0, GFP_KERNEL); | 973 | acm->writeurb = usb_alloc_urb(0, GFP_KERNEL); |
974 | if (!acm->writeurb) { | 974 | if (!acm->writeurb) { |
975 | dev_dbg(&intf->dev, "out of memory (writeurb kmalloc)\n"); | 975 | dev_dbg(&intf->dev, "out of memory (writeurb kmalloc)"); |
976 | goto alloc_fail7; | 976 | goto alloc_fail7; |
977 | } | 977 | } |
978 | 978 | ||
@@ -1086,6 +1086,9 @@ static struct usb_device_id acm_ids[] = { | |||
1086 | { USB_DEVICE(0x0ace, 0x1608), /* ZyDAS 56K USB MODEM */ | 1086 | { USB_DEVICE(0x0ace, 0x1608), /* ZyDAS 56K USB MODEM */ |
1087 | .driver_info = SINGLE_RX_URB, /* firmware bug */ | 1087 | .driver_info = SINGLE_RX_URB, /* firmware bug */ |
1088 | }, | 1088 | }, |
1089 | { USB_DEVICE(0x0ace, 0x1611), /* ZyDAS 56K USB MODEM - new version */ | ||
1090 | .driver_info = SINGLE_RX_URB, /* firmware bug */ | ||
1091 | }, | ||
1089 | /* control interfaces with various AT-command sets */ | 1092 | /* control interfaces with various AT-command sets */ |
1090 | { USB_INTERFACE_INFO(USB_CLASS_COMM, USB_CDC_SUBCLASS_ACM, | 1093 | { USB_INTERFACE_INFO(USB_CLASS_COMM, USB_CDC_SUBCLASS_ACM, |
1091 | USB_CDC_ACM_PROTO_AT_V25TER) }, | 1094 | USB_CDC_ACM_PROTO_AT_V25TER) }, |
diff --git a/drivers/usb/core/Kconfig b/drivers/usb/core/Kconfig index a08787e253aa..6e3b5358a760 100644 --- a/drivers/usb/core/Kconfig +++ b/drivers/usb/core/Kconfig | |||
@@ -31,9 +31,6 @@ config USB_DEVICEFS | |||
31 | For the format of the various /proc/bus/usb/ files, please read | 31 | For the format of the various /proc/bus/usb/ files, please read |
32 | <file:Documentation/usb/proc_usb_info.txt>. | 32 | <file:Documentation/usb/proc_usb_info.txt>. |
33 | 33 | ||
34 | Please note that this code is completely unrelated to devfs, the | ||
35 | "/dev file system support". | ||
36 | |||
37 | Most users want to say Y here. | 34 | Most users want to say Y here. |
38 | 35 | ||
39 | config USB_BANDWIDTH | 36 | config USB_BANDWIDTH |
diff --git a/drivers/usb/core/hub.c b/drivers/usb/core/hub.c index 875596e98e42..26c8cb5f3e67 100644 --- a/drivers/usb/core/hub.c +++ b/drivers/usb/core/hub.c | |||
@@ -1790,7 +1790,10 @@ static int finish_device_resume(struct usb_device *udev) | |||
1790 | * and device drivers will know about any resume quirks. | 1790 | * and device drivers will know about any resume quirks. |
1791 | */ | 1791 | */ |
1792 | status = usb_get_status(udev, USB_RECIP_DEVICE, 0, &devstatus); | 1792 | status = usb_get_status(udev, USB_RECIP_DEVICE, 0, &devstatus); |
1793 | if (status < 2) | 1793 | if (status >= 0) |
1794 | status = (status == 2 ? 0 : -ENODEV); | ||
1795 | |||
1796 | if (status) | ||
1794 | dev_dbg(&udev->dev, | 1797 | dev_dbg(&udev->dev, |
1795 | "gone after usb resume? status %d\n", | 1798 | "gone after usb resume? status %d\n", |
1796 | status); | 1799 | status); |
@@ -1879,7 +1882,12 @@ hub_port_resume(struct usb_hub *hub, int port1, struct usb_device *udev) | |||
1879 | dev_dbg(hub->intfdev, | 1882 | dev_dbg(hub->intfdev, |
1880 | "port %d status %04x.%04x after resume, %d\n", | 1883 | "port %d status %04x.%04x after resume, %d\n", |
1881 | port1, portchange, devstatus, status); | 1884 | port1, portchange, devstatus, status); |
1885 | if (status >= 0) | ||
1886 | status = -ENODEV; | ||
1882 | } else { | 1887 | } else { |
1888 | if (portchange & USB_PORT_STAT_C_SUSPEND) | ||
1889 | clear_port_feature(hub->hdev, port1, | ||
1890 | USB_PORT_FEAT_C_SUSPEND); | ||
1883 | /* TRSMRCY = 10 msec */ | 1891 | /* TRSMRCY = 10 msec */ |
1884 | msleep(10); | 1892 | msleep(10); |
1885 | if (udev) | 1893 | if (udev) |
diff --git a/drivers/usb/core/inode.c b/drivers/usb/core/inode.c index f48c3dbc367a..3182c2224ba2 100644 --- a/drivers/usb/core/inode.c +++ b/drivers/usb/core/inode.c | |||
@@ -695,7 +695,7 @@ static void usbfs_remove_device(struct usb_device *dev) | |||
695 | wake_up_all(&ds->wait); | 695 | wake_up_all(&ds->wait); |
696 | list_del_init(&ds->list); | 696 | list_del_init(&ds->list); |
697 | if (ds->discsignr) { | 697 | if (ds->discsignr) { |
698 | sinfo.si_signo = SIGPIPE; | 698 | sinfo.si_signo = ds->discsignr; |
699 | sinfo.si_errno = EPIPE; | 699 | sinfo.si_errno = EPIPE; |
700 | sinfo.si_code = SI_ASYNCIO; | 700 | sinfo.si_code = SI_ASYNCIO; |
701 | sinfo.si_addr = ds->disccontext; | 701 | sinfo.si_addr = ds->disccontext; |
diff --git a/drivers/usb/gadget/epautoconf.c b/drivers/usb/gadget/epautoconf.c index f7c6d758e1b0..53d584589c26 100644 --- a/drivers/usb/gadget/epautoconf.c +++ b/drivers/usb/gadget/epautoconf.c | |||
@@ -34,12 +34,12 @@ | |||
34 | 34 | ||
35 | 35 | ||
36 | /* we must assign addresses for configurable endpoints (like net2280) */ | 36 | /* we must assign addresses for configurable endpoints (like net2280) */ |
37 | static __initdata unsigned epnum; | 37 | static __devinitdata unsigned epnum; |
38 | 38 | ||
39 | // #define MANY_ENDPOINTS | 39 | // #define MANY_ENDPOINTS |
40 | #ifdef MANY_ENDPOINTS | 40 | #ifdef MANY_ENDPOINTS |
41 | /* more than 15 configurable endpoints */ | 41 | /* more than 15 configurable endpoints */ |
42 | static __initdata unsigned in_epnum; | 42 | static __devinitdata unsigned in_epnum; |
43 | #endif | 43 | #endif |
44 | 44 | ||
45 | 45 | ||
@@ -59,7 +59,7 @@ static __initdata unsigned in_epnum; | |||
59 | * NOTE: each endpoint is unidirectional, as specified by its USB | 59 | * NOTE: each endpoint is unidirectional, as specified by its USB |
60 | * descriptor; and isn't specific to a configuration or altsetting. | 60 | * descriptor; and isn't specific to a configuration or altsetting. |
61 | */ | 61 | */ |
62 | static int __init | 62 | static int __devinit |
63 | ep_matches ( | 63 | ep_matches ( |
64 | struct usb_gadget *gadget, | 64 | struct usb_gadget *gadget, |
65 | struct usb_ep *ep, | 65 | struct usb_ep *ep, |
@@ -73,7 +73,7 @@ ep_matches ( | |||
73 | /* endpoint already claimed? */ | 73 | /* endpoint already claimed? */ |
74 | if (0 != ep->driver_data) | 74 | if (0 != ep->driver_data) |
75 | return 0; | 75 | return 0; |
76 | 76 | ||
77 | /* only support ep0 for portable CONTROL traffic */ | 77 | /* only support ep0 for portable CONTROL traffic */ |
78 | type = desc->bmAttributes & USB_ENDPOINT_XFERTYPE_MASK; | 78 | type = desc->bmAttributes & USB_ENDPOINT_XFERTYPE_MASK; |
79 | if (USB_ENDPOINT_XFER_CONTROL == type) | 79 | if (USB_ENDPOINT_XFER_CONTROL == type) |
@@ -186,7 +186,7 @@ ep_matches ( | |||
186 | return 1; | 186 | return 1; |
187 | } | 187 | } |
188 | 188 | ||
189 | static struct usb_ep * __init | 189 | static struct usb_ep * __devinit |
190 | find_ep (struct usb_gadget *gadget, const char *name) | 190 | find_ep (struct usb_gadget *gadget, const char *name) |
191 | { | 191 | { |
192 | struct usb_ep *ep; | 192 | struct usb_ep *ep; |
@@ -228,7 +228,7 @@ find_ep (struct usb_gadget *gadget, const char *name) | |||
228 | * | 228 | * |
229 | * On failure, this returns a null endpoint descriptor. | 229 | * On failure, this returns a null endpoint descriptor. |
230 | */ | 230 | */ |
231 | struct usb_ep * __init usb_ep_autoconfig ( | 231 | struct usb_ep * __devinit usb_ep_autoconfig ( |
232 | struct usb_gadget *gadget, | 232 | struct usb_gadget *gadget, |
233 | struct usb_endpoint_descriptor *desc | 233 | struct usb_endpoint_descriptor *desc |
234 | ) | 234 | ) |
@@ -276,7 +276,7 @@ struct usb_ep * __init usb_ep_autoconfig ( | |||
276 | return ep; | 276 | return ep; |
277 | } | 277 | } |
278 | 278 | ||
279 | /* Second, look at endpoints until an unclaimed one looks usable */ | 279 | /* Second, look at endpoints until an unclaimed one looks usable */ |
280 | list_for_each_entry (ep, &gadget->ep_list, ep_list) { | 280 | list_for_each_entry (ep, &gadget->ep_list, ep_list) { |
281 | if (ep_matches (gadget, ep, desc)) | 281 | if (ep_matches (gadget, ep, desc)) |
282 | return ep; | 282 | return ep; |
@@ -295,7 +295,7 @@ struct usb_ep * __init usb_ep_autoconfig ( | |||
295 | * state such as ep->driver_data and the record of assigned endpoints | 295 | * state such as ep->driver_data and the record of assigned endpoints |
296 | * used by usb_ep_autoconfig(). | 296 | * used by usb_ep_autoconfig(). |
297 | */ | 297 | */ |
298 | void __init usb_ep_autoconfig_reset (struct usb_gadget *gadget) | 298 | void __devinit usb_ep_autoconfig_reset (struct usb_gadget *gadget) |
299 | { | 299 | { |
300 | struct usb_ep *ep; | 300 | struct usb_ep *ep; |
301 | 301 | ||
diff --git a/drivers/usb/gadget/ether.c b/drivers/usb/gadget/ether.c index 8320fcef0425..4fe1bec1c255 100644 --- a/drivers/usb/gadget/ether.c +++ b/drivers/usb/gadget/ether.c | |||
@@ -2131,7 +2131,7 @@ eth_req_free (struct usb_ep *ep, struct usb_request *req) | |||
2131 | } | 2131 | } |
2132 | 2132 | ||
2133 | 2133 | ||
2134 | static void __exit | 2134 | static void /* __init_or_exit */ |
2135 | eth_unbind (struct usb_gadget *gadget) | 2135 | eth_unbind (struct usb_gadget *gadget) |
2136 | { | 2136 | { |
2137 | struct eth_dev *dev = get_gadget_data (gadget); | 2137 | struct eth_dev *dev = get_gadget_data (gadget); |
@@ -2158,7 +2158,7 @@ eth_unbind (struct usb_gadget *gadget) | |||
2158 | set_gadget_data (gadget, NULL); | 2158 | set_gadget_data (gadget, NULL); |
2159 | } | 2159 | } |
2160 | 2160 | ||
2161 | static u8 __init nibble (unsigned char c) | 2161 | static u8 __devinit nibble (unsigned char c) |
2162 | { | 2162 | { |
2163 | if (likely (isdigit (c))) | 2163 | if (likely (isdigit (c))) |
2164 | return c - '0'; | 2164 | return c - '0'; |
@@ -2168,7 +2168,7 @@ static u8 __init nibble (unsigned char c) | |||
2168 | return 0; | 2168 | return 0; |
2169 | } | 2169 | } |
2170 | 2170 | ||
2171 | static int __init get_ether_addr(const char *str, u8 *dev_addr) | 2171 | static int __devinit get_ether_addr(const char *str, u8 *dev_addr) |
2172 | { | 2172 | { |
2173 | if (str) { | 2173 | if (str) { |
2174 | unsigned i; | 2174 | unsigned i; |
@@ -2189,7 +2189,7 @@ static int __init get_ether_addr(const char *str, u8 *dev_addr) | |||
2189 | return 1; | 2189 | return 1; |
2190 | } | 2190 | } |
2191 | 2191 | ||
2192 | static int __init | 2192 | static int __devinit |
2193 | eth_bind (struct usb_gadget *gadget) | 2193 | eth_bind (struct usb_gadget *gadget) |
2194 | { | 2194 | { |
2195 | struct eth_dev *dev; | 2195 | struct eth_dev *dev; |
diff --git a/drivers/usb/gadget/file_storage.c b/drivers/usb/gadget/file_storage.c index b1a9cf06f3e6..8d7f1e84cd7b 100644 --- a/drivers/usb/gadget/file_storage.c +++ b/drivers/usb/gadget/file_storage.c | |||
@@ -3691,7 +3691,7 @@ static void lun_release(struct device *dev) | |||
3691 | kref_put(&fsg->ref, fsg_release); | 3691 | kref_put(&fsg->ref, fsg_release); |
3692 | } | 3692 | } |
3693 | 3693 | ||
3694 | static void __exit fsg_unbind(struct usb_gadget *gadget) | 3694 | static void /* __init_or_exit */ fsg_unbind(struct usb_gadget *gadget) |
3695 | { | 3695 | { |
3696 | struct fsg_dev *fsg = get_gadget_data(gadget); | 3696 | struct fsg_dev *fsg = get_gadget_data(gadget); |
3697 | int i; | 3697 | int i; |
diff --git a/drivers/usb/gadget/rndis.c b/drivers/usb/gadget/rndis.c index 354670d12308..408c3380d602 100644 --- a/drivers/usb/gadget/rndis.c +++ b/drivers/usb/gadget/rndis.c | |||
@@ -1398,7 +1398,7 @@ static struct proc_dir_entry *rndis_connect_state [RNDIS_MAX_CONFIGS]; | |||
1398 | #endif /* CONFIG_USB_GADGET_DEBUG_FILES */ | 1398 | #endif /* CONFIG_USB_GADGET_DEBUG_FILES */ |
1399 | 1399 | ||
1400 | 1400 | ||
1401 | int __init rndis_init (void) | 1401 | int __devinit rndis_init (void) |
1402 | { | 1402 | { |
1403 | u8 i; | 1403 | u8 i; |
1404 | 1404 | ||
diff --git a/drivers/usb/gadget/rndis.h b/drivers/usb/gadget/rndis.h index 2956608be751..4c3c7259f019 100644 --- a/drivers/usb/gadget/rndis.h +++ b/drivers/usb/gadget/rndis.h | |||
@@ -264,7 +264,7 @@ int rndis_signal_disconnect (int configNr); | |||
264 | int rndis_state (int configNr); | 264 | int rndis_state (int configNr); |
265 | extern void rndis_set_host_mac (int configNr, const u8 *addr); | 265 | extern void rndis_set_host_mac (int configNr, const u8 *addr); |
266 | 266 | ||
267 | int __init rndis_init (void); | 267 | int __devinit rndis_init (void); |
268 | void rndis_exit (void); | 268 | void rndis_exit (void); |
269 | 269 | ||
270 | #endif /* _LINUX_RNDIS_H */ | 270 | #endif /* _LINUX_RNDIS_H */ |
diff --git a/drivers/usb/gadget/serial.c b/drivers/usb/gadget/serial.c index 30d7664d449d..e762aa19ab0a 100644 --- a/drivers/usb/gadget/serial.c +++ b/drivers/usb/gadget/serial.c | |||
@@ -1473,7 +1473,7 @@ autoconf_fail: | |||
1473 | * Called on module unload. Frees the control request and device | 1473 | * Called on module unload. Frees the control request and device |
1474 | * structure. | 1474 | * structure. |
1475 | */ | 1475 | */ |
1476 | static void __exit gs_unbind(struct usb_gadget *gadget) | 1476 | static void /* __init_or_exit */ gs_unbind(struct usb_gadget *gadget) |
1477 | { | 1477 | { |
1478 | struct gs_dev *dev = get_gadget_data(gadget); | 1478 | struct gs_dev *dev = get_gadget_data(gadget); |
1479 | 1479 | ||
diff --git a/drivers/usb/gadget/zero.c b/drivers/usb/gadget/zero.c index 3a08a7ab4ce0..b7018ee487ea 100644 --- a/drivers/usb/gadget/zero.c +++ b/drivers/usb/gadget/zero.c | |||
@@ -1121,7 +1121,7 @@ zero_autoresume (unsigned long _dev) | |||
1121 | 1121 | ||
1122 | /*-------------------------------------------------------------------------*/ | 1122 | /*-------------------------------------------------------------------------*/ |
1123 | 1123 | ||
1124 | static void __exit | 1124 | static void /* __init_or_exit */ |
1125 | zero_unbind (struct usb_gadget *gadget) | 1125 | zero_unbind (struct usb_gadget *gadget) |
1126 | { | 1126 | { |
1127 | struct zero_dev *dev = get_gadget_data (gadget); | 1127 | struct zero_dev *dev = get_gadget_data (gadget); |
diff --git a/drivers/usb/host/ehci-au1xxx.c b/drivers/usb/host/ehci-au1xxx.c index d66867aa527e..26ed757d22a6 100644 --- a/drivers/usb/host/ehci-au1xxx.c +++ b/drivers/usb/host/ehci-au1xxx.c | |||
@@ -41,8 +41,6 @@ | |||
41 | #endif | 41 | #endif |
42 | #define USBH_DISABLE (USB_MCFG_EBMEN | USB_MCFG_EMEMEN) | 42 | #define USBH_DISABLE (USB_MCFG_EBMEN | USB_MCFG_EMEMEN) |
43 | 43 | ||
44 | #endif /* Au1200 */ | ||
45 | |||
46 | extern int usb_disabled(void); | 44 | extern int usb_disabled(void); |
47 | 45 | ||
48 | /*-------------------------------------------------------------------------*/ | 46 | /*-------------------------------------------------------------------------*/ |
@@ -107,9 +105,9 @@ int usb_ehci_au1xxx_probe(const struct hc_driver *driver, | |||
107 | 105 | ||
108 | /* Au1200 AB USB does not support coherent memory */ | 106 | /* Au1200 AB USB does not support coherent memory */ |
109 | if (!(read_c0_prid() & 0xff)) { | 107 | if (!(read_c0_prid() & 0xff)) { |
110 | pr_info("%s: this is chip revision AB!\n", dev->dev.name); | 108 | pr_info("%s: this is chip revision AB!\n", dev->name); |
111 | pr_info("%s: update your board or re-configure the kernel\n", | 109 | pr_info("%s: update your board or re-configure the kernel\n", |
112 | dev->dev.name); | 110 | dev->name); |
113 | return -ENODEV; | 111 | return -ENODEV; |
114 | } | 112 | } |
115 | #endif | 113 | #endif |
@@ -228,9 +226,8 @@ static const struct hc_driver ehci_au1xxx_hc_driver = { | |||
228 | 226 | ||
229 | /*-------------------------------------------------------------------------*/ | 227 | /*-------------------------------------------------------------------------*/ |
230 | 228 | ||
231 | static int ehci_hcd_au1xxx_drv_probe(struct device *dev) | 229 | static int ehci_hcd_au1xxx_drv_probe(struct platform_device *pdev) |
232 | { | 230 | { |
233 | struct platform_device *pdev = to_platform_device(dev); | ||
234 | struct usb_hcd *hcd = NULL; | 231 | struct usb_hcd *hcd = NULL; |
235 | int ret; | 232 | int ret; |
236 | 233 | ||
@@ -243,10 +240,9 @@ static int ehci_hcd_au1xxx_drv_probe(struct device *dev) | |||
243 | return ret; | 240 | return ret; |
244 | } | 241 | } |
245 | 242 | ||
246 | static int ehci_hcd_au1xxx_drv_remove(struct device *dev) | 243 | static int ehci_hcd_au1xxx_drv_remove(struct platform_device *pdev) |
247 | { | 244 | { |
248 | struct platform_device *pdev = to_platform_device(dev); | 245 | struct usb_hcd *hcd = platform_get_drvdata(pdev); |
249 | struct usb_hcd *hcd = dev_get_drvdata(dev); | ||
250 | 246 | ||
251 | usb_ehci_au1xxx_remove(hcd, pdev); | 247 | usb_ehci_au1xxx_remove(hcd, pdev); |
252 | return 0; | 248 | return 0; |
@@ -269,12 +265,13 @@ static int ehci_hcd_au1xxx_drv_resume(struct device *dev) | |||
269 | } | 265 | } |
270 | */ | 266 | */ |
271 | MODULE_ALIAS("au1xxx-ehci"); | 267 | MODULE_ALIAS("au1xxx-ehci"); |
272 | /* FIXME use "struct platform_driver" */ | 268 | static struct platform_driver ehci_hcd_au1xxx_driver = { |
273 | static struct device_driver ehci_hcd_au1xxx_driver = { | ||
274 | .name = "au1xxx-ehci", | ||
275 | .bus = &platform_bus_type, | ||
276 | .probe = ehci_hcd_au1xxx_drv_probe, | 269 | .probe = ehci_hcd_au1xxx_drv_probe, |
277 | .remove = ehci_hcd_au1xxx_drv_remove, | 270 | .remove = ehci_hcd_au1xxx_drv_remove, |
278 | /*.suspend = ehci_hcd_au1xxx_drv_suspend, */ | 271 | /*.suspend = ehci_hcd_au1xxx_drv_suspend, */ |
279 | /*.resume = ehci_hcd_au1xxx_drv_resume, */ | 272 | /*.resume = ehci_hcd_au1xxx_drv_resume, */ |
273 | .driver = { | ||
274 | .name = "au1xxx-ehci", | ||
275 | .bus = &platform_bus_type | ||
276 | } | ||
280 | }; | 277 | }; |
diff --git a/drivers/usb/host/ehci-hcd.c b/drivers/usb/host/ehci-hcd.c index cee6f538de0a..85b0b4ad4c16 100644 --- a/drivers/usb/host/ehci-hcd.c +++ b/drivers/usb/host/ehci-hcd.c | |||
@@ -625,10 +625,11 @@ static irqreturn_t ehci_irq (struct usb_hcd *hcd, struct pt_regs *regs) | |||
625 | writel (status | CMD_RUN, &ehci->regs->command); | 625 | writel (status | CMD_RUN, &ehci->regs->command); |
626 | 626 | ||
627 | while (i--) { | 627 | while (i--) { |
628 | status = readl (&ehci->regs->port_status [i]); | 628 | int pstatus = readl (&ehci->regs->port_status [i]); |
629 | if (status & PORT_OWNER) | 629 | |
630 | if (pstatus & PORT_OWNER) | ||
630 | continue; | 631 | continue; |
631 | if (!(status & PORT_RESUME) | 632 | if (!(pstatus & PORT_RESUME) |
632 | || ehci->reset_done [i] != 0) | 633 | || ehci->reset_done [i] != 0) |
633 | continue; | 634 | continue; |
634 | 635 | ||
diff --git a/drivers/usb/host/ohci-au1xxx.c b/drivers/usb/host/ohci-au1xxx.c index 689261e44018..822914e2f43b 100644 --- a/drivers/usb/host/ohci-au1xxx.c +++ b/drivers/usb/host/ohci-au1xxx.c | |||
@@ -101,13 +101,16 @@ static void au1xxx_start_ohc(struct platform_device *dev) | |||
101 | 101 | ||
102 | #endif /* Au1200 */ | 102 | #endif /* Au1200 */ |
103 | 103 | ||
104 | #ifndef CONFIG_SOC_AU1200 | ||
104 | /* wait for reset complete (read register twice; see au1500 errata) */ | 105 | /* wait for reset complete (read register twice; see au1500 errata) */ |
105 | while (au_readl(USB_HOST_CONFIG), | 106 | while (au_readl(USB_HOST_CONFIG), |
106 | !(au_readl(USB_HOST_CONFIG) & USBH_ENABLE_RD)) | 107 | !(au_readl(USB_HOST_CONFIG) & USBH_ENABLE_RD)) |
108 | #endif | ||
107 | udelay(1000); | 109 | udelay(1000); |
108 | 110 | ||
109 | printk(KERN_DEBUG __FILE__ | 111 | printk(KERN_DEBUG __FILE__ |
110 | ": Clock to USB host has been enabled \n"); | 112 | ": Clock to USB host has been enabled \n"); |
113 | #endif | ||
111 | } | 114 | } |
112 | 115 | ||
113 | static void au1xxx_stop_ohc(struct platform_device *dev) | 116 | static void au1xxx_stop_ohc(struct platform_device *dev) |
@@ -157,9 +160,9 @@ static int usb_ohci_au1xxx_probe(const struct hc_driver *driver, | |||
157 | /* Au1200 AB USB does not support coherent memory */ | 160 | /* Au1200 AB USB does not support coherent memory */ |
158 | if (!(read_c0_prid() & 0xff)) { | 161 | if (!(read_c0_prid() & 0xff)) { |
159 | pr_info("%s: this is chip revision AB !!\n", | 162 | pr_info("%s: this is chip revision AB !!\n", |
160 | dev->dev.name); | 163 | dev->name); |
161 | pr_info("%s: update your board or re-configure the kernel\n", | 164 | pr_info("%s: update your board or re-configure the kernel\n", |
162 | dev->dev.name); | 165 | dev->name); |
163 | return -ENODEV; | 166 | return -ENODEV; |
164 | } | 167 | } |
165 | #endif | 168 | #endif |
diff --git a/drivers/usb/host/ohci-ep93xx.c b/drivers/usb/host/ohci-ep93xx.c new file mode 100644 index 000000000000..6531c4d26527 --- /dev/null +++ b/drivers/usb/host/ohci-ep93xx.c | |||
@@ -0,0 +1,225 @@ | |||
1 | /* | ||
2 | * OHCI HCD (Host Controller Driver) for USB. | ||
3 | * | ||
4 | * (C) Copyright 1999 Roman Weissgaerber <weissg@vienna.at> | ||
5 | * (C) Copyright 2000-2002 David Brownell <dbrownell@users.sourceforge.net> | ||
6 | * (C) Copyright 2002 Hewlett-Packard Company | ||
7 | * | ||
8 | * Bus Glue for ep93xx. | ||
9 | * | ||
10 | * Written by Christopher Hoover <ch@hpl.hp.com> | ||
11 | * Based on fragments of previous driver by Russell King et al. | ||
12 | * | ||
13 | * Modified for LH7A404 from ohci-sa1111.c | ||
14 | * by Durgesh Pattamatta <pattamattad@sharpsec.com> | ||
15 | * | ||
16 | * Modified for pxa27x from ohci-lh7a404.c | ||
17 | * by Nick Bane <nick@cecomputing.co.uk> 26-8-2004 | ||
18 | * | ||
19 | * Modified for ep93xx from ohci-pxa27x.c | ||
20 | * by Lennert Buytenhek <buytenh@wantstofly.org> 28-2-2006 | ||
21 | * Based on an earlier driver by Ray Lehtiniemi | ||
22 | * | ||
23 | * This file is licenced under the GPL. | ||
24 | */ | ||
25 | |||
26 | #include <linux/clk.h> | ||
27 | #include <linux/device.h> | ||
28 | #include <linux/signal.h> | ||
29 | #include <linux/platform_device.h> | ||
30 | |||
31 | #include <asm/mach-types.h> | ||
32 | #include <asm/hardware.h> | ||
33 | |||
34 | static struct clk *usb_host_clock; | ||
35 | |||
36 | static void ep93xx_start_hc(struct device *dev) | ||
37 | { | ||
38 | clk_enable(usb_host_clock); | ||
39 | } | ||
40 | |||
41 | static void ep93xx_stop_hc(struct device *dev) | ||
42 | { | ||
43 | clk_disable(usb_host_clock); | ||
44 | } | ||
45 | |||
46 | static int usb_hcd_ep93xx_probe(const struct hc_driver *driver, | ||
47 | struct platform_device *pdev) | ||
48 | { | ||
49 | int retval; | ||
50 | struct usb_hcd *hcd; | ||
51 | |||
52 | if (pdev->resource[1].flags != IORESOURCE_IRQ) { | ||
53 | pr_debug("resource[1] is not IORESOURCE_IRQ"); | ||
54 | return -ENOMEM; | ||
55 | } | ||
56 | |||
57 | hcd = usb_create_hcd(driver, &pdev->dev, "ep93xx"); | ||
58 | if (hcd == NULL) | ||
59 | return -ENOMEM; | ||
60 | |||
61 | hcd->rsrc_start = pdev->resource[0].start; | ||
62 | hcd->rsrc_len = pdev->resource[0].end - pdev->resource[0].start + 1; | ||
63 | if (!request_mem_region(hcd->rsrc_start, hcd->rsrc_len, hcd_name)) { | ||
64 | usb_put_hcd(hcd); | ||
65 | retval = -EBUSY; | ||
66 | goto err1; | ||
67 | } | ||
68 | |||
69 | hcd->regs = ioremap(hcd->rsrc_start, hcd->rsrc_len); | ||
70 | if (hcd->regs == NULL) { | ||
71 | pr_debug("ioremap failed"); | ||
72 | retval = -ENOMEM; | ||
73 | goto err2; | ||
74 | } | ||
75 | |||
76 | usb_host_clock = clk_get(&pdev->dev, "usb_host"); | ||
77 | ep93xx_start_hc(&pdev->dev); | ||
78 | |||
79 | ohci_hcd_init(hcd_to_ohci(hcd)); | ||
80 | |||
81 | retval = usb_add_hcd(hcd, pdev->resource[1].start, SA_INTERRUPT); | ||
82 | if (retval == 0) | ||
83 | return retval; | ||
84 | |||
85 | ep93xx_stop_hc(&pdev->dev); | ||
86 | iounmap(hcd->regs); | ||
87 | err2: | ||
88 | release_mem_region(hcd->rsrc_start, hcd->rsrc_len); | ||
89 | err1: | ||
90 | usb_put_hcd(hcd); | ||
91 | |||
92 | return retval; | ||
93 | } | ||
94 | |||
95 | static void usb_hcd_ep93xx_remove(struct usb_hcd *hcd, | ||
96 | struct platform_device *pdev) | ||
97 | { | ||
98 | usb_remove_hcd(hcd); | ||
99 | ep93xx_stop_hc(&pdev->dev); | ||
100 | clk_put(usb_host_clock); | ||
101 | iounmap(hcd->regs); | ||
102 | release_mem_region(hcd->rsrc_start, hcd->rsrc_len); | ||
103 | usb_put_hcd(hcd); | ||
104 | } | ||
105 | |||
106 | static int __devinit ohci_ep93xx_start(struct usb_hcd *hcd) | ||
107 | { | ||
108 | struct ohci_hcd *ohci = hcd_to_ohci(hcd); | ||
109 | int ret; | ||
110 | |||
111 | if ((ret = ohci_init(ohci)) < 0) | ||
112 | return ret; | ||
113 | |||
114 | if ((ret = ohci_run(ohci)) < 0) { | ||
115 | err("can't start %s", hcd->self.bus_name); | ||
116 | ohci_stop(hcd); | ||
117 | return ret; | ||
118 | } | ||
119 | |||
120 | return 0; | ||
121 | } | ||
122 | |||
123 | static struct hc_driver ohci_ep93xx_hc_driver = { | ||
124 | .description = hcd_name, | ||
125 | .product_desc = "EP93xx OHCI", | ||
126 | .hcd_priv_size = sizeof(struct ohci_hcd), | ||
127 | .irq = ohci_irq, | ||
128 | .flags = HCD_USB11 | HCD_MEMORY, | ||
129 | .start = ohci_ep93xx_start, | ||
130 | .stop = ohci_stop, | ||
131 | .urb_enqueue = ohci_urb_enqueue, | ||
132 | .urb_dequeue = ohci_urb_dequeue, | ||
133 | .endpoint_disable = ohci_endpoint_disable, | ||
134 | .get_frame_number = ohci_get_frame, | ||
135 | .hub_status_data = ohci_hub_status_data, | ||
136 | .hub_control = ohci_hub_control, | ||
137 | #ifdef CONFIG_PM | ||
138 | .bus_suspend = ohci_bus_suspend, | ||
139 | .bus_resume = ohci_bus_resume, | ||
140 | #endif | ||
141 | .start_port_reset = ohci_start_port_reset, | ||
142 | }; | ||
143 | |||
144 | extern int usb_disabled(void); | ||
145 | |||
146 | static int ohci_hcd_ep93xx_drv_probe(struct platform_device *pdev) | ||
147 | { | ||
148 | int ret; | ||
149 | |||
150 | ret = -ENODEV; | ||
151 | if (!usb_disabled()) | ||
152 | ret = usb_hcd_ep93xx_probe(&ohci_ep93xx_hc_driver, pdev); | ||
153 | |||
154 | return ret; | ||
155 | } | ||
156 | |||
157 | static int ohci_hcd_ep93xx_drv_remove(struct platform_device *pdev) | ||
158 | { | ||
159 | struct usb_hcd *hcd = platform_get_drvdata(pdev); | ||
160 | |||
161 | usb_hcd_ep93xx_remove(hcd, pdev); | ||
162 | |||
163 | return 0; | ||
164 | } | ||
165 | |||
166 | #ifdef CONFIG_PM | ||
167 | static int ohci_hcd_ep93xx_drv_suspend(struct platform_device *pdev, pm_message_t state) | ||
168 | { | ||
169 | struct usb_hcd *hcd = platform_get_drvdata(pdev); | ||
170 | struct ochi_hcd *ohci = hcd_to_ohci(hcd); | ||
171 | |||
172 | if (time_before(jiffies, ohci->next_statechange)) | ||
173 | msleep(5); | ||
174 | ohci->next_statechange = jiffies; | ||
175 | |||
176 | ep93xx_stop_hc(&pdev->dev); | ||
177 | hcd->state = HC_STATE_SUSPENDED; | ||
178 | pdev->dev.power.power_state = PMSG_SUSPEND; | ||
179 | |||
180 | return 0; | ||
181 | } | ||
182 | |||
183 | static int ohci_hcd_ep93xx_drv_resume(struct platform_device *pdev) | ||
184 | { | ||
185 | struct usb_hcd *hcd = platform_get_drvdata(pdev); | ||
186 | struct ohci_hcd *ohci = hcd_to_ohci(hcd); | ||
187 | int status; | ||
188 | |||
189 | if (time_before(jiffies, ohci->next_statechange)) | ||
190 | msleep(5); | ||
191 | ohci->next_statechange = jiffies; | ||
192 | |||
193 | ep93xx_start_hc(&pdev->dev); | ||
194 | pdev->dev.power.power_state = PMSG_ON; | ||
195 | usb_hcd_resume_root_hub(hcd); | ||
196 | |||
197 | return 0; | ||
198 | } | ||
199 | #endif | ||
200 | |||
201 | |||
202 | static struct platform_driver ohci_hcd_ep93xx_driver = { | ||
203 | .probe = ohci_hcd_ep93xx_drv_probe, | ||
204 | .remove = ohci_hcd_ep93xx_drv_remove, | ||
205 | #ifdef CONFIG_PM | ||
206 | .suspend = ohci_hcd_ep93xx_drv_suspend, | ||
207 | .resume = ohci_hcd_ep93xx_drv_resume, | ||
208 | #endif | ||
209 | .driver = { | ||
210 | .name = "ep93xx-ohci", | ||
211 | }, | ||
212 | }; | ||
213 | |||
214 | static int __init ohci_hcd_ep93xx_init(void) | ||
215 | { | ||
216 | return platform_driver_register(&ohci_hcd_ep93xx_driver); | ||
217 | } | ||
218 | |||
219 | static void __exit ohci_hcd_ep93xx_cleanup(void) | ||
220 | { | ||
221 | platform_driver_unregister(&ohci_hcd_ep93xx_driver); | ||
222 | } | ||
223 | |||
224 | module_init(ohci_hcd_ep93xx_init); | ||
225 | module_exit(ohci_hcd_ep93xx_cleanup); | ||
diff --git a/drivers/usb/host/ohci-hcd.c b/drivers/usb/host/ohci-hcd.c index 8fb842ed5f6e..afef5ac35b4a 100644 --- a/drivers/usb/host/ohci-hcd.c +++ b/drivers/usb/host/ohci-hcd.c | |||
@@ -901,6 +901,10 @@ MODULE_LICENSE ("GPL"); | |||
901 | #include "ohci-pxa27x.c" | 901 | #include "ohci-pxa27x.c" |
902 | #endif | 902 | #endif |
903 | 903 | ||
904 | #ifdef CONFIG_ARCH_EP93XX | ||
905 | #include "ohci-ep93xx.c" | ||
906 | #endif | ||
907 | |||
904 | #ifdef CONFIG_SOC_AU1X00 | 908 | #ifdef CONFIG_SOC_AU1X00 |
905 | #include "ohci-au1xxx.c" | 909 | #include "ohci-au1xxx.c" |
906 | #endif | 910 | #endif |
@@ -919,6 +923,7 @@ MODULE_LICENSE ("GPL"); | |||
919 | || defined(CONFIG_ARCH_OMAP) \ | 923 | || defined(CONFIG_ARCH_OMAP) \ |
920 | || defined (CONFIG_ARCH_LH7A404) \ | 924 | || defined (CONFIG_ARCH_LH7A404) \ |
921 | || defined (CONFIG_PXA27x) \ | 925 | || defined (CONFIG_PXA27x) \ |
926 | || defined (CONFIG_ARCH_EP93XX) \ | ||
922 | || defined (CONFIG_SOC_AU1X00) \ | 927 | || defined (CONFIG_SOC_AU1X00) \ |
923 | || defined (CONFIG_USB_OHCI_HCD_PPC_SOC) \ | 928 | || defined (CONFIG_USB_OHCI_HCD_PPC_SOC) \ |
924 | || defined (CONFIG_ARCH_AT91RM9200) \ | 929 | || defined (CONFIG_ARCH_AT91RM9200) \ |
diff --git a/drivers/usb/host/ohci-hub.c b/drivers/usb/host/ohci-hub.c index 0bb972b58336..5b0a23fd798b 100644 --- a/drivers/usb/host/ohci-hub.c +++ b/drivers/usb/host/ohci-hub.c | |||
@@ -581,14 +581,14 @@ static int ohci_hub_control ( | |||
581 | break; | 581 | break; |
582 | case GetHubStatus: | 582 | case GetHubStatus: |
583 | temp = roothub_status (ohci) & ~(RH_HS_CRWE | RH_HS_DRWE); | 583 | temp = roothub_status (ohci) & ~(RH_HS_CRWE | RH_HS_DRWE); |
584 | *(__le32 *) buf = cpu_to_le32 (temp); | 584 | put_unaligned(cpu_to_le32 (temp), (__le32 *) buf); |
585 | break; | 585 | break; |
586 | case GetPortStatus: | 586 | case GetPortStatus: |
587 | if (!wIndex || wIndex > ports) | 587 | if (!wIndex || wIndex > ports) |
588 | goto error; | 588 | goto error; |
589 | wIndex--; | 589 | wIndex--; |
590 | temp = roothub_portstatus (ohci, wIndex); | 590 | temp = roothub_portstatus (ohci, wIndex); |
591 | *(__le32 *) buf = cpu_to_le32 (temp); | 591 | put_unaligned(cpu_to_le32 (temp), (__le32 *) buf); |
592 | 592 | ||
593 | #ifndef OHCI_VERBOSE_DEBUG | 593 | #ifndef OHCI_VERBOSE_DEBUG |
594 | if (*(u16*)(buf+2)) /* only if wPortChange is interesting */ | 594 | if (*(u16*)(buf+2)) /* only if wPortChange is interesting */ |
diff --git a/drivers/usb/host/pci-quirks.c b/drivers/usb/host/pci-quirks.c index dff60568b4a1..20861650905e 100644 --- a/drivers/usb/host/pci-quirks.c +++ b/drivers/usb/host/pci-quirks.c | |||
@@ -167,8 +167,6 @@ static int __devinit mmio_resource_enabled(struct pci_dev *pdev, int idx) | |||
167 | static void __devinit quirk_usb_handoff_ohci(struct pci_dev *pdev) | 167 | static void __devinit quirk_usb_handoff_ohci(struct pci_dev *pdev) |
168 | { | 168 | { |
169 | void __iomem *base; | 169 | void __iomem *base; |
170 | int wait_time; | ||
171 | u32 control; | ||
172 | 170 | ||
173 | if (!mmio_resource_enabled(pdev, 0)) | 171 | if (!mmio_resource_enabled(pdev, 0)) |
174 | return; | 172 | return; |
@@ -179,9 +177,10 @@ static void __devinit quirk_usb_handoff_ohci(struct pci_dev *pdev) | |||
179 | 177 | ||
180 | /* On PA-RISC, PDC can leave IR set incorrectly; ignore it there. */ | 178 | /* On PA-RISC, PDC can leave IR set incorrectly; ignore it there. */ |
181 | #ifndef __hppa__ | 179 | #ifndef __hppa__ |
182 | control = readl(base + OHCI_CONTROL); | 180 | { |
181 | u32 control = readl(base + OHCI_CONTROL); | ||
183 | if (control & OHCI_CTRL_IR) { | 182 | if (control & OHCI_CTRL_IR) { |
184 | wait_time = 500; /* arbitrary; 5 seconds */ | 183 | int wait_time = 500; /* arbitrary; 5 seconds */ |
185 | writel(OHCI_INTR_OC, base + OHCI_INTRENABLE); | 184 | writel(OHCI_INTR_OC, base + OHCI_INTRENABLE); |
186 | writel(OHCI_OCR, base + OHCI_CMDSTATUS); | 185 | writel(OHCI_OCR, base + OHCI_CMDSTATUS); |
187 | while (wait_time > 0 && | 186 | while (wait_time > 0 && |
@@ -198,6 +197,7 @@ static void __devinit quirk_usb_handoff_ohci(struct pci_dev *pdev) | |||
198 | /* reset controller, preserving RWC */ | 197 | /* reset controller, preserving RWC */ |
199 | writel(control & OHCI_CTRL_RWC, base + OHCI_CONTROL); | 198 | writel(control & OHCI_CTRL_RWC, base + OHCI_CONTROL); |
200 | } | 199 | } |
200 | } | ||
201 | #endif | 201 | #endif |
202 | 202 | ||
203 | /* | 203 | /* |
diff --git a/drivers/usb/input/hid-core.c b/drivers/usb/input/hid-core.c index b9fb9687f926..8ea9c915fbf9 100644 --- a/drivers/usb/input/hid-core.c +++ b/drivers/usb/input/hid-core.c | |||
@@ -1507,6 +1507,9 @@ void hid_init_reports(struct hid_device *hid) | |||
1507 | #define USB_DEVICE_ID_4_PHIDGETSERVO_20 0x8104 | 1507 | #define USB_DEVICE_ID_4_PHIDGETSERVO_20 0x8104 |
1508 | #define USB_DEVICE_ID_DUAL_USB_JOYPAD 0x8866 | 1508 | #define USB_DEVICE_ID_DUAL_USB_JOYPAD 0x8866 |
1509 | 1509 | ||
1510 | #define USB_VENDOR_ID_WISEGROUP_LTD 0x6677 | ||
1511 | #define USB_DEVICE_ID_SMARTJOY_DUAL_PLUS 0x8802 | ||
1512 | |||
1510 | #define USB_VENDOR_ID_CODEMERCS 0x07c0 | 1513 | #define USB_VENDOR_ID_CODEMERCS 0x07c0 |
1511 | #define USB_DEVICE_ID_CODEMERCS_IOW40 0x1500 | 1514 | #define USB_DEVICE_ID_CODEMERCS_IOW40 0x1500 |
1512 | #define USB_DEVICE_ID_CODEMERCS_IOW24 0x1501 | 1515 | #define USB_DEVICE_ID_CODEMERCS_IOW24 0x1501 |
@@ -1670,6 +1673,7 @@ static const struct hid_blacklist { | |||
1670 | { USB_VENDOR_ID_ATEN, USB_DEVICE_ID_ATEN_4PORTKVM, HID_QUIRK_NOGET }, | 1673 | { USB_VENDOR_ID_ATEN, USB_DEVICE_ID_ATEN_4PORTKVM, HID_QUIRK_NOGET }, |
1671 | { USB_VENDOR_ID_ATEN, USB_DEVICE_ID_ATEN_4PORTKVMC, HID_QUIRK_NOGET }, | 1674 | { USB_VENDOR_ID_ATEN, USB_DEVICE_ID_ATEN_4PORTKVMC, HID_QUIRK_NOGET }, |
1672 | { USB_VENDOR_ID_WISEGROUP, USB_DEVICE_ID_DUAL_USB_JOYPAD, HID_QUIRK_NOGET | HID_QUIRK_MULTI_INPUT }, | 1675 | { USB_VENDOR_ID_WISEGROUP, USB_DEVICE_ID_DUAL_USB_JOYPAD, HID_QUIRK_NOGET | HID_QUIRK_MULTI_INPUT }, |
1676 | { USB_VENDOR_ID_WISEGROUP_LTD, USB_DEVICE_ID_SMARTJOY_DUAL_PLUS, HID_QUIRK_NOGET | HID_QUIRK_MULTI_INPUT }, | ||
1673 | 1677 | ||
1674 | { USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_MIGHTYMOUSE, HID_QUIRK_MIGHTYMOUSE | HID_QUIRK_INVERT_HWHEEL }, | 1678 | { USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_MIGHTYMOUSE, HID_QUIRK_MIGHTYMOUSE | HID_QUIRK_INVERT_HWHEEL }, |
1675 | { USB_VENDOR_ID_A4TECH, USB_DEVICE_ID_A4TECH_WCP32PU, HID_QUIRK_2WHEEL_MOUSE_HACK_7 }, | 1679 | { USB_VENDOR_ID_A4TECH, USB_DEVICE_ID_A4TECH_WCP32PU, HID_QUIRK_2WHEEL_MOUSE_HACK_7 }, |
diff --git a/drivers/usb/misc/Kconfig b/drivers/usb/misc/Kconfig index daa486dde8cf..88928a4be805 100644 --- a/drivers/usb/misc/Kconfig +++ b/drivers/usb/misc/Kconfig | |||
@@ -88,19 +88,19 @@ config USB_LED | |||
88 | To compile this driver as a module, choose M here: the | 88 | To compile this driver as a module, choose M here: the |
89 | module will be called usbled. | 89 | module will be called usbled. |
90 | 90 | ||
91 | config USB_CY7C63 | 91 | config USB_CYPRESS_CY7C63 |
92 | tristate "Cypress CY7C63xxx USB driver support" | 92 | tristate "Cypress CY7C63xxx USB driver support" |
93 | depends on USB | 93 | depends on USB |
94 | help | 94 | help |
95 | Say Y here if you want to connect a Cypress CY7C63xxx | 95 | Say Y here if you want to connect a Cypress CY7C63xxx |
96 | micro controller to your computer's USB port. This driver | 96 | micro controller to your computer's USB port. Currently this |
97 | supports the pre-programmed devices (incl. firmware) by | 97 | driver supports the pre-programmed devices (incl. firmware) |
98 | AK Modul-Bus Computer GmbH. | 98 | by AK Modul-Bus Computer GmbH. |
99 | 99 | ||
100 | Please see: http://www.ak-modul-bus.de/stat/mikrocontroller.html | 100 | Please see: http://www.ak-modul-bus.de/stat/mikrocontroller.html |
101 | 101 | ||
102 | To compile this driver as a module, choose M here: the | 102 | To compile this driver as a module, choose M here: the |
103 | module will be called cy7c63. | 103 | module will be called cypress_cy7c63. |
104 | 104 | ||
105 | config USB_CYTHERM | 105 | config USB_CYTHERM |
106 | tristate "Cypress USB thermometer driver support" | 106 | tristate "Cypress USB thermometer driver support" |
diff --git a/drivers/usb/misc/Makefile b/drivers/usb/misc/Makefile index f25a97227297..2927260c5812 100644 --- a/drivers/usb/misc/Makefile +++ b/drivers/usb/misc/Makefile | |||
@@ -4,7 +4,7 @@ | |||
4 | # | 4 | # |
5 | 5 | ||
6 | obj-$(CONFIG_USB_AUERSWALD) += auerswald.o | 6 | obj-$(CONFIG_USB_AUERSWALD) += auerswald.o |
7 | obj-$(CONFIG_USB_CY7C63) += cy7c63.o | 7 | obj-$(CONFIG_USB_CYPRESS_CY7C63)+= cypress_cy7c63.o |
8 | obj-$(CONFIG_USB_CYTHERM) += cytherm.o | 8 | obj-$(CONFIG_USB_CYTHERM) += cytherm.o |
9 | obj-$(CONFIG_USB_EMI26) += emi26.o | 9 | obj-$(CONFIG_USB_EMI26) += emi26.o |
10 | obj-$(CONFIG_USB_EMI62) += emi62.o | 10 | obj-$(CONFIG_USB_EMI62) += emi62.o |
diff --git a/drivers/usb/misc/cy7c63.c b/drivers/usb/misc/cy7c63.c deleted file mode 100644 index 8a1c10b89b76..000000000000 --- a/drivers/usb/misc/cy7c63.c +++ /dev/null | |||
@@ -1,244 +0,0 @@ | |||
1 | /* | ||
2 | * cy7c63.c | ||
3 | * | ||
4 | * Copyright (c) 2006 Oliver Bock (bock@fh-wolfenbuettel.de) | ||
5 | * | ||
6 | * This driver is based on the Cypress Thermometer USB Driver by | ||
7 | * Marcus Maul and the 2.0 version of Greg Kroah-Hartman's | ||
8 | * USB Skeleton driver. | ||
9 | * | ||
10 | * Is is a generic driver for the Cypress CY7C63000 family. | ||
11 | * For the time being it enables you to toggle the single I/O ports | ||
12 | * of the device. | ||
13 | * | ||
14 | * Supported vendors: AK Modul-Bus Computer GmbH | ||
15 | * Supported devices: CY7C63001A-PC (to be continued...) | ||
16 | * Supported functions: Read/Write Ports (to be continued...) | ||
17 | * | ||
18 | * Chipsets families: CY7C63000, CY7C63001, CY7C63100, CY7C63101 | ||
19 | * | ||
20 | * | ||
21 | * This program is free software; you can redistribute it and/or | ||
22 | * modify it under the terms of the GNU General Public License as | ||
23 | * published by the Free Software Foundation, version 2. | ||
24 | */ | ||
25 | |||
26 | #include <linux/init.h> | ||
27 | #include <linux/module.h> | ||
28 | #include <linux/kernel.h> | ||
29 | #include <linux/usb.h> | ||
30 | |||
31 | #define DRIVER_AUTHOR "Oliver Bock (bock@fh-wolfenbuettel.de)" | ||
32 | #define DRIVER_DESC "Cypress CY7C63xxx USB driver" | ||
33 | |||
34 | #define CY7C63_VENDOR_ID 0xa2c | ||
35 | #define CY7C63_PRODUCT_ID 0x8 | ||
36 | |||
37 | #define CY7C63_READ_PORT 0x4 | ||
38 | #define CY7C63_WRITE_PORT 0x5 | ||
39 | #define CY7C63_READ_RAM 0x2 | ||
40 | #define CY7C63_WRITE_RAM 0x3 | ||
41 | #define CY7C63_READ_ROM 0x1 | ||
42 | |||
43 | #define CY7C63_READ_PORT_ID0 0 | ||
44 | #define CY7C63_WRITE_PORT_ID0 0 | ||
45 | #define CY7C63_READ_PORT_ID1 0x2 | ||
46 | #define CY7C63_WRITE_PORT_ID1 1 | ||
47 | |||
48 | #define CY7C63_MAX_REQSIZE 8 | ||
49 | |||
50 | |||
51 | /* table of devices that work with this driver */ | ||
52 | static struct usb_device_id cy7c63_table [] = { | ||
53 | { USB_DEVICE(CY7C63_VENDOR_ID, CY7C63_PRODUCT_ID) }, | ||
54 | { } | ||
55 | }; | ||
56 | MODULE_DEVICE_TABLE(usb, cy7c63_table); | ||
57 | |||
58 | /* structure to hold all of our device specific stuff */ | ||
59 | struct cy7c63 { | ||
60 | struct usb_device * udev; | ||
61 | char port0; | ||
62 | char port1; | ||
63 | }; | ||
64 | |||
65 | /* used to send usb control messages to device */ | ||
66 | int vendor_command(struct cy7c63 *dev, unsigned char request, | ||
67 | unsigned char address, unsigned char data) { | ||
68 | |||
69 | int retval = 0; | ||
70 | unsigned int pipe; | ||
71 | unsigned char *iobuf; | ||
72 | |||
73 | /* allocate some memory for the i/o buffer*/ | ||
74 | iobuf = kzalloc(CY7C63_MAX_REQSIZE, GFP_KERNEL); | ||
75 | if (!iobuf) { | ||
76 | dev_err(&dev->udev->dev, "Out of memory!\n"); | ||
77 | retval = -ENOMEM; | ||
78 | goto error; | ||
79 | } | ||
80 | |||
81 | dev_dbg(&dev->udev->dev, "Sending usb_control_msg (data: %d)\n", data); | ||
82 | |||
83 | /* prepare usb control message and send it upstream */ | ||
84 | pipe = usb_rcvctrlpipe(dev->udev, 0); | ||
85 | retval = usb_control_msg(dev->udev, pipe, request, | ||
86 | USB_DIR_IN | USB_TYPE_VENDOR | USB_RECIP_OTHER, | ||
87 | address, data, iobuf, CY7C63_MAX_REQSIZE, | ||
88 | USB_CTRL_GET_TIMEOUT); | ||
89 | |||
90 | /* store returned data (more READs to be added!) */ | ||
91 | switch (request) { | ||
92 | case CY7C63_READ_PORT: | ||
93 | if (address == CY7C63_READ_PORT_ID0) { | ||
94 | dev->port0 = iobuf[1]; | ||
95 | dev_dbg(&dev->udev->dev, | ||
96 | "READ_PORT0 returned: %d\n",dev->port0); | ||
97 | } | ||
98 | else if (address == CY7C63_READ_PORT_ID1) { | ||
99 | dev->port1 = iobuf[1]; | ||
100 | dev_dbg(&dev->udev->dev, | ||
101 | "READ_PORT1 returned: %d\n",dev->port1); | ||
102 | } | ||
103 | break; | ||
104 | } | ||
105 | |||
106 | kfree(iobuf); | ||
107 | error: | ||
108 | return retval; | ||
109 | } | ||
110 | |||
111 | #define get_set_port(num,read_id,write_id) \ | ||
112 | static ssize_t set_port##num(struct device *dev, struct device_attribute *attr, \ | ||
113 | const char *buf, size_t count) { \ | ||
114 | \ | ||
115 | int value; \ | ||
116 | int result = 0; \ | ||
117 | \ | ||
118 | struct usb_interface *intf = to_usb_interface(dev); \ | ||
119 | struct cy7c63 *cyp = usb_get_intfdata(intf); \ | ||
120 | \ | ||
121 | dev_dbg(&cyp->udev->dev, "WRITE_PORT%d called\n", num); \ | ||
122 | \ | ||
123 | /* validate input data */ \ | ||
124 | if (sscanf(buf, "%d", &value) < 1) { \ | ||
125 | result = -EINVAL; \ | ||
126 | goto error; \ | ||
127 | } \ | ||
128 | if (value>255 || value<0) { \ | ||
129 | result = -EINVAL; \ | ||
130 | goto error; \ | ||
131 | } \ | ||
132 | \ | ||
133 | result = vendor_command(cyp, CY7C63_WRITE_PORT, write_id, \ | ||
134 | (unsigned char)value); \ | ||
135 | \ | ||
136 | dev_dbg(&cyp->udev->dev, "Result of vendor_command: %d\n\n",result); \ | ||
137 | error: \ | ||
138 | return result < 0 ? result : count; \ | ||
139 | } \ | ||
140 | \ | ||
141 | static ssize_t get_port##num(struct device *dev, \ | ||
142 | struct device_attribute *attr, char *buf) { \ | ||
143 | \ | ||
144 | int result = 0; \ | ||
145 | \ | ||
146 | struct usb_interface *intf = to_usb_interface(dev); \ | ||
147 | struct cy7c63 *cyp = usb_get_intfdata(intf); \ | ||
148 | \ | ||
149 | dev_dbg(&cyp->udev->dev, "READ_PORT%d called\n", num); \ | ||
150 | \ | ||
151 | result = vendor_command(cyp, CY7C63_READ_PORT, read_id, 0); \ | ||
152 | \ | ||
153 | dev_dbg(&cyp->udev->dev, "Result of vendor_command: %d\n\n", result); \ | ||
154 | \ | ||
155 | return sprintf(buf, "%d", cyp->port##num); \ | ||
156 | } \ | ||
157 | static DEVICE_ATTR(port##num, S_IWUGO | S_IRUGO, get_port##num, set_port##num); | ||
158 | |||
159 | get_set_port(0, CY7C63_READ_PORT_ID0, CY7C63_WRITE_PORT_ID0); | ||
160 | get_set_port(1, CY7C63_READ_PORT_ID1, CY7C63_WRITE_PORT_ID1); | ||
161 | |||
162 | static int cy7c63_probe(struct usb_interface *interface, | ||
163 | const struct usb_device_id *id) { | ||
164 | |||
165 | struct cy7c63 *dev = NULL; | ||
166 | int retval = -ENOMEM; | ||
167 | |||
168 | /* allocate memory for our device state and initialize it */ | ||
169 | dev = kzalloc(sizeof(*dev), GFP_KERNEL); | ||
170 | if (dev == NULL) { | ||
171 | dev_err(&dev->udev->dev, "Out of memory!\n"); | ||
172 | goto error; | ||
173 | } | ||
174 | |||
175 | dev->udev = usb_get_dev(interface_to_usbdev(interface)); | ||
176 | |||
177 | /* save our data pointer in this interface device */ | ||
178 | usb_set_intfdata(interface, dev); | ||
179 | |||
180 | /* create device attribute files */ | ||
181 | device_create_file(&interface->dev, &dev_attr_port0); | ||
182 | device_create_file(&interface->dev, &dev_attr_port1); | ||
183 | |||
184 | /* let the user know what node this device is now attached to */ | ||
185 | dev_info(&interface->dev, | ||
186 | "Cypress CY7C63xxx device now attached\n"); | ||
187 | |||
188 | retval = 0; | ||
189 | error: | ||
190 | return retval; | ||
191 | } | ||
192 | |||
193 | static void cy7c63_disconnect(struct usb_interface *interface) { | ||
194 | |||
195 | struct cy7c63 *dev; | ||
196 | |||
197 | dev = usb_get_intfdata(interface); | ||
198 | usb_set_intfdata(interface, NULL); | ||
199 | |||
200 | /* remove device attribute files */ | ||
201 | device_remove_file(&interface->dev, &dev_attr_port0); | ||
202 | device_remove_file(&interface->dev, &dev_attr_port1); | ||
203 | |||
204 | usb_put_dev(dev->udev); | ||
205 | |||
206 | dev_info(&interface->dev, | ||
207 | "Cypress CY7C63xxx device now disconnected\n"); | ||
208 | |||
209 | kfree(dev); | ||
210 | } | ||
211 | |||
212 | static struct usb_driver cy7c63_driver = { | ||
213 | .name = "cy7c63", | ||
214 | .probe = cy7c63_probe, | ||
215 | .disconnect = cy7c63_disconnect, | ||
216 | .id_table = cy7c63_table, | ||
217 | }; | ||
218 | |||
219 | static int __init cy7c63_init(void) { | ||
220 | |||
221 | int result; | ||
222 | |||
223 | /* register this driver with the USB subsystem */ | ||
224 | result = usb_register(&cy7c63_driver); | ||
225 | if (result) { | ||
226 | err("Function usb_register failed! Error number: %d\n", result); | ||
227 | } | ||
228 | |||
229 | return result; | ||
230 | } | ||
231 | |||
232 | static void __exit cy7c63_exit(void) { | ||
233 | |||
234 | /* deregister this driver with the USB subsystem */ | ||
235 | usb_deregister(&cy7c63_driver); | ||
236 | } | ||
237 | |||
238 | module_init(cy7c63_init); | ||
239 | module_exit(cy7c63_exit); | ||
240 | |||
241 | MODULE_AUTHOR(DRIVER_AUTHOR); | ||
242 | MODULE_DESCRIPTION(DRIVER_DESC); | ||
243 | |||
244 | MODULE_LICENSE("GPL"); | ||
diff --git a/drivers/usb/misc/cypress_cy7c63.c b/drivers/usb/misc/cypress_cy7c63.c new file mode 100644 index 000000000000..e091d327bd9e --- /dev/null +++ b/drivers/usb/misc/cypress_cy7c63.c | |||
@@ -0,0 +1,279 @@ | |||
1 | /* | ||
2 | * cypress_cy7c63.c | ||
3 | * | ||
4 | * Copyright (c) 2006 Oliver Bock (o.bock@fh-wolfenbuettel.de) | ||
5 | * | ||
6 | * This driver is based on the Cypress USB Driver by Marcus Maul | ||
7 | * (cyport) and the 2.0 version of Greg Kroah-Hartman's | ||
8 | * USB Skeleton driver. | ||
9 | * | ||
10 | * This is a generic driver for the Cypress CY7C63xxx family. | ||
11 | * For the time being it enables you to read from and write to | ||
12 | * the single I/O ports of the device. | ||
13 | * | ||
14 | * Supported vendors: AK Modul-Bus Computer GmbH | ||
15 | * Supported devices: CY7C63001A-PC (to be continued...) | ||
16 | * Supported functions: Read/Write Ports (to be continued...) | ||
17 | * | ||
18 | * | ||
19 | * This program is free software; you can redistribute it and/or | ||
20 | * modify it under the terms of the GNU General Public License as | ||
21 | * published by the Free Software Foundation, version 2. | ||
22 | */ | ||
23 | |||
24 | #include <linux/init.h> | ||
25 | #include <linux/module.h> | ||
26 | #include <linux/kernel.h> | ||
27 | #include <linux/usb.h> | ||
28 | |||
29 | #define DRIVER_AUTHOR "Oliver Bock (o.bock@fh-wolfenbuettel.de)" | ||
30 | #define DRIVER_DESC "Cypress CY7C63xxx USB driver" | ||
31 | |||
32 | #define CYPRESS_VENDOR_ID 0xa2c | ||
33 | #define CYPRESS_PRODUCT_ID 0x8 | ||
34 | |||
35 | #define CYPRESS_READ_PORT 0x4 | ||
36 | #define CYPRESS_WRITE_PORT 0x5 | ||
37 | |||
38 | #define CYPRESS_READ_RAM 0x2 | ||
39 | #define CYPRESS_WRITE_RAM 0x3 | ||
40 | #define CYPRESS_READ_ROM 0x1 | ||
41 | |||
42 | #define CYPRESS_READ_PORT_ID0 0 | ||
43 | #define CYPRESS_WRITE_PORT_ID0 0 | ||
44 | #define CYPRESS_READ_PORT_ID1 0x2 | ||
45 | #define CYPRESS_WRITE_PORT_ID1 1 | ||
46 | |||
47 | #define CYPRESS_MAX_REQSIZE 8 | ||
48 | |||
49 | |||
50 | /* table of devices that work with this driver */ | ||
51 | static struct usb_device_id cypress_table [] = { | ||
52 | { USB_DEVICE(CYPRESS_VENDOR_ID, CYPRESS_PRODUCT_ID) }, | ||
53 | { } | ||
54 | }; | ||
55 | MODULE_DEVICE_TABLE(usb, cypress_table); | ||
56 | |||
57 | /* structure to hold all of our device specific stuff */ | ||
58 | struct cypress { | ||
59 | struct usb_device * udev; | ||
60 | unsigned char port[2]; | ||
61 | }; | ||
62 | |||
63 | /* used to send usb control messages to device */ | ||
64 | static int vendor_command(struct cypress *dev, unsigned char request, | ||
65 | unsigned char address, unsigned char data) | ||
66 | { | ||
67 | int retval = 0; | ||
68 | unsigned int pipe; | ||
69 | unsigned char *iobuf; | ||
70 | |||
71 | /* allocate some memory for the i/o buffer*/ | ||
72 | iobuf = kzalloc(CYPRESS_MAX_REQSIZE, GFP_KERNEL); | ||
73 | if (!iobuf) { | ||
74 | dev_err(&dev->udev->dev, "Out of memory!\n"); | ||
75 | retval = -ENOMEM; | ||
76 | goto error; | ||
77 | } | ||
78 | |||
79 | dev_dbg(&dev->udev->dev, "Sending usb_control_msg (data: %d)\n", data); | ||
80 | |||
81 | /* prepare usb control message and send it upstream */ | ||
82 | pipe = usb_rcvctrlpipe(dev->udev, 0); | ||
83 | retval = usb_control_msg(dev->udev, pipe, request, | ||
84 | USB_DIR_IN | USB_TYPE_VENDOR | USB_RECIP_OTHER, | ||
85 | address, data, iobuf, CYPRESS_MAX_REQSIZE, | ||
86 | USB_CTRL_GET_TIMEOUT); | ||
87 | |||
88 | /* store returned data (more READs to be added) */ | ||
89 | switch (request) { | ||
90 | case CYPRESS_READ_PORT: | ||
91 | if (address == CYPRESS_READ_PORT_ID0) { | ||
92 | dev->port[0] = iobuf[1]; | ||
93 | dev_dbg(&dev->udev->dev, | ||
94 | "READ_PORT0 returned: %d\n", | ||
95 | dev->port[0]); | ||
96 | } | ||
97 | else if (address == CYPRESS_READ_PORT_ID1) { | ||
98 | dev->port[1] = iobuf[1]; | ||
99 | dev_dbg(&dev->udev->dev, | ||
100 | "READ_PORT1 returned: %d\n", | ||
101 | dev->port[1]); | ||
102 | } | ||
103 | break; | ||
104 | } | ||
105 | |||
106 | kfree(iobuf); | ||
107 | error: | ||
108 | return retval; | ||
109 | } | ||
110 | |||
111 | /* write port value */ | ||
112 | static ssize_t write_port(struct device *dev, struct device_attribute *attr, | ||
113 | const char *buf, size_t count, | ||
114 | int port_num, int write_id) | ||
115 | { | ||
116 | int value = -1; | ||
117 | int result = 0; | ||
118 | |||
119 | struct usb_interface *intf = to_usb_interface(dev); | ||
120 | struct cypress *cyp = usb_get_intfdata(intf); | ||
121 | |||
122 | dev_dbg(&cyp->udev->dev, "WRITE_PORT%d called\n", port_num); | ||
123 | |||
124 | /* validate input data */ | ||
125 | if (sscanf(buf, "%d", &value) < 1) { | ||
126 | result = -EINVAL; | ||
127 | goto error; | ||
128 | } | ||
129 | if (value < 0 || value > 255) { | ||
130 | result = -EINVAL; | ||
131 | goto error; | ||
132 | } | ||
133 | |||
134 | result = vendor_command(cyp, CYPRESS_WRITE_PORT, write_id, | ||
135 | (unsigned char)value); | ||
136 | |||
137 | dev_dbg(&cyp->udev->dev, "Result of vendor_command: %d\n\n", result); | ||
138 | error: | ||
139 | return result < 0 ? result : count; | ||
140 | } | ||
141 | |||
142 | /* attribute callback handler (write) */ | ||
143 | static ssize_t set_port0_handler(struct device *dev, | ||
144 | struct device_attribute *attr, | ||
145 | const char *buf, size_t count) | ||
146 | { | ||
147 | return write_port(dev, attr, buf, count, 0, CYPRESS_WRITE_PORT_ID0); | ||
148 | } | ||
149 | |||
150 | /* attribute callback handler (write) */ | ||
151 | static ssize_t set_port1_handler(struct device *dev, | ||
152 | struct device_attribute *attr, | ||
153 | const char *buf, size_t count) | ||
154 | { | ||
155 | return write_port(dev, attr, buf, count, 1, CYPRESS_WRITE_PORT_ID1); | ||
156 | } | ||
157 | |||
158 | /* read port value */ | ||
159 | static ssize_t read_port(struct device *dev, struct device_attribute *attr, | ||
160 | char *buf, int port_num, int read_id) | ||
161 | { | ||
162 | int result = 0; | ||
163 | |||
164 | struct usb_interface *intf = to_usb_interface(dev); | ||
165 | struct cypress *cyp = usb_get_intfdata(intf); | ||
166 | |||
167 | dev_dbg(&cyp->udev->dev, "READ_PORT%d called\n", port_num); | ||
168 | |||
169 | result = vendor_command(cyp, CYPRESS_READ_PORT, read_id, 0); | ||
170 | |||
171 | dev_dbg(&cyp->udev->dev, "Result of vendor_command: %d\n\n", result); | ||
172 | |||
173 | return sprintf(buf, "%d", cyp->port[port_num]); | ||
174 | } | ||
175 | |||
176 | /* attribute callback handler (read) */ | ||
177 | static ssize_t get_port0_handler(struct device *dev, | ||
178 | struct device_attribute *attr, char *buf) | ||
179 | { | ||
180 | return read_port(dev, attr, buf, 0, CYPRESS_READ_PORT_ID0); | ||
181 | } | ||
182 | |||
183 | /* attribute callback handler (read) */ | ||
184 | static ssize_t get_port1_handler(struct device *dev, | ||
185 | struct device_attribute *attr, char *buf) | ||
186 | { | ||
187 | return read_port(dev, attr, buf, 1, CYPRESS_READ_PORT_ID1); | ||
188 | } | ||
189 | |||
190 | static DEVICE_ATTR(port0, S_IWUGO | S_IRUGO, | ||
191 | get_port0_handler, set_port0_handler); | ||
192 | |||
193 | static DEVICE_ATTR(port1, S_IWUGO | S_IRUGO, | ||
194 | get_port1_handler, set_port1_handler); | ||
195 | |||
196 | |||
197 | static int cypress_probe(struct usb_interface *interface, | ||
198 | const struct usb_device_id *id) | ||
199 | { | ||
200 | struct cypress *dev = NULL; | ||
201 | int retval = -ENOMEM; | ||
202 | |||
203 | /* allocate memory for our device state and initialize it */ | ||
204 | dev = kzalloc(sizeof(*dev), GFP_KERNEL); | ||
205 | if (dev == NULL) { | ||
206 | dev_err(&dev->udev->dev, "Out of memory!\n"); | ||
207 | goto error; | ||
208 | } | ||
209 | |||
210 | dev->udev = usb_get_dev(interface_to_usbdev(interface)); | ||
211 | |||
212 | /* save our data pointer in this interface device */ | ||
213 | usb_set_intfdata(interface, dev); | ||
214 | |||
215 | /* create device attribute files */ | ||
216 | device_create_file(&interface->dev, &dev_attr_port0); | ||
217 | device_create_file(&interface->dev, &dev_attr_port1); | ||
218 | |||
219 | /* let the user know that the device is now attached */ | ||
220 | dev_info(&interface->dev, | ||
221 | "Cypress CY7C63xxx device now attached\n"); | ||
222 | |||
223 | retval = 0; | ||
224 | error: | ||
225 | return retval; | ||
226 | } | ||
227 | |||
228 | static void cypress_disconnect(struct usb_interface *interface) | ||
229 | { | ||
230 | struct cypress *dev; | ||
231 | |||
232 | dev = usb_get_intfdata(interface); | ||
233 | usb_set_intfdata(interface, NULL); | ||
234 | |||
235 | /* remove device attribute files */ | ||
236 | device_remove_file(&interface->dev, &dev_attr_port0); | ||
237 | device_remove_file(&interface->dev, &dev_attr_port1); | ||
238 | |||
239 | usb_put_dev(dev->udev); | ||
240 | |||
241 | dev_info(&interface->dev, | ||
242 | "Cypress CY7C63xxx device now disconnected\n"); | ||
243 | |||
244 | kfree(dev); | ||
245 | } | ||
246 | |||
247 | static struct usb_driver cypress_driver = { | ||
248 | .name = "cypress_cy7c63", | ||
249 | .probe = cypress_probe, | ||
250 | .disconnect = cypress_disconnect, | ||
251 | .id_table = cypress_table, | ||
252 | }; | ||
253 | |||
254 | static int __init cypress_init(void) | ||
255 | { | ||
256 | int result; | ||
257 | |||
258 | /* register this driver with the USB subsystem */ | ||
259 | result = usb_register(&cypress_driver); | ||
260 | if (result) { | ||
261 | err("Function usb_register failed! Error number: %d\n", result); | ||
262 | } | ||
263 | |||
264 | return result; | ||
265 | } | ||
266 | |||
267 | static void __exit cypress_exit(void) | ||
268 | { | ||
269 | /* deregister this driver with the USB subsystem */ | ||
270 | usb_deregister(&cypress_driver); | ||
271 | } | ||
272 | |||
273 | module_init(cypress_init); | ||
274 | module_exit(cypress_exit); | ||
275 | |||
276 | MODULE_AUTHOR(DRIVER_AUTHOR); | ||
277 | MODULE_DESCRIPTION(DRIVER_DESC); | ||
278 | |||
279 | MODULE_LICENSE("GPL"); | ||
diff --git a/drivers/usb/misc/usblcd.c b/drivers/usb/misc/usblcd.c index c82c402285a0..e095772dd8e9 100644 --- a/drivers/usb/misc/usblcd.c +++ b/drivers/usb/misc/usblcd.c | |||
@@ -200,10 +200,8 @@ static ssize_t lcd_write(struct file *file, const char __user * user_buffer, siz | |||
200 | 200 | ||
201 | /* create a urb, and a buffer for it, and copy the data to the urb */ | 201 | /* create a urb, and a buffer for it, and copy the data to the urb */ |
202 | urb = usb_alloc_urb(0, GFP_KERNEL); | 202 | urb = usb_alloc_urb(0, GFP_KERNEL); |
203 | if (!urb) { | 203 | if (!urb) |
204 | retval = -ENOMEM; | 204 | return -ENOMEM; |
205 | goto error; | ||
206 | } | ||
207 | 205 | ||
208 | buf = usb_buffer_alloc(dev->udev, count, GFP_KERNEL, &urb->transfer_dma); | 206 | buf = usb_buffer_alloc(dev->udev, count, GFP_KERNEL, &urb->transfer_dma); |
209 | if (!buf) { | 207 | if (!buf) { |
diff --git a/drivers/usb/mon/mon_text.c b/drivers/usb/mon/mon_text.c index e02c1a30c4cd..f961a770cee2 100644 --- a/drivers/usb/mon/mon_text.c +++ b/drivers/usb/mon/mon_text.c | |||
@@ -64,7 +64,6 @@ struct mon_reader_text { | |||
64 | }; | 64 | }; |
65 | 65 | ||
66 | static void mon_text_ctor(void *, kmem_cache_t *, unsigned long); | 66 | static void mon_text_ctor(void *, kmem_cache_t *, unsigned long); |
67 | static void mon_text_dtor(void *, kmem_cache_t *, unsigned long); | ||
68 | 67 | ||
69 | /* | 68 | /* |
70 | * mon_text_submit | 69 | * mon_text_submit |
@@ -268,7 +267,7 @@ static int mon_text_open(struct inode *inode, struct file *file) | |||
268 | (long)rp); | 267 | (long)rp); |
269 | rp->e_slab = kmem_cache_create(rp->slab_name, | 268 | rp->e_slab = kmem_cache_create(rp->slab_name, |
270 | sizeof(struct mon_event_text), sizeof(long), 0, | 269 | sizeof(struct mon_event_text), sizeof(long), 0, |
271 | mon_text_ctor, mon_text_dtor); | 270 | mon_text_ctor, NULL); |
272 | if (rp->e_slab == NULL) { | 271 | if (rp->e_slab == NULL) { |
273 | rc = -ENOMEM; | 272 | rc = -ENOMEM; |
274 | goto err_slab; | 273 | goto err_slab; |
@@ -459,7 +458,3 @@ static void mon_text_ctor(void *mem, kmem_cache_t *slab, unsigned long sflags) | |||
459 | memset(mem, 0xe5, sizeof(struct mon_event_text)); | 458 | memset(mem, 0xe5, sizeof(struct mon_event_text)); |
460 | } | 459 | } |
461 | 460 | ||
462 | static void mon_text_dtor(void *mem, kmem_cache_t *slab, unsigned long sflags) | ||
463 | { | ||
464 | ; | ||
465 | } | ||
diff --git a/drivers/usb/net/rtl8150.c b/drivers/usb/net/rtl8150.c index 718f8e2b552b..e5e6e4f3ef87 100644 --- a/drivers/usb/net/rtl8150.c +++ b/drivers/usb/net/rtl8150.c | |||
@@ -128,11 +128,13 @@ | |||
128 | #define VENDOR_ID_MELCO 0x0411 | 128 | #define VENDOR_ID_MELCO 0x0411 |
129 | #define VENDOR_ID_MICRONET 0x3980 | 129 | #define VENDOR_ID_MICRONET 0x3980 |
130 | #define VENDOR_ID_LONGSHINE 0x07b8 | 130 | #define VENDOR_ID_LONGSHINE 0x07b8 |
131 | #define VENDOR_ID_ZYXEL 0x0586 | ||
131 | 132 | ||
132 | #define PRODUCT_ID_RTL8150 0x8150 | 133 | #define PRODUCT_ID_RTL8150 0x8150 |
133 | #define PRODUCT_ID_LUAKTX 0x0012 | 134 | #define PRODUCT_ID_LUAKTX 0x0012 |
134 | #define PRODUCT_ID_LCS8138TX 0x401a | 135 | #define PRODUCT_ID_LCS8138TX 0x401a |
135 | #define PRODUCT_ID_SP128AR 0x0003 | 136 | #define PRODUCT_ID_SP128AR 0x0003 |
137 | #define PRODUCT_ID_PRESTIGE 0x401a | ||
136 | 138 | ||
137 | #undef EEPROM_WRITE | 139 | #undef EEPROM_WRITE |
138 | 140 | ||
@@ -142,6 +144,7 @@ static struct usb_device_id rtl8150_table[] = { | |||
142 | {USB_DEVICE(VENDOR_ID_MELCO, PRODUCT_ID_LUAKTX)}, | 144 | {USB_DEVICE(VENDOR_ID_MELCO, PRODUCT_ID_LUAKTX)}, |
143 | {USB_DEVICE(VENDOR_ID_MICRONET, PRODUCT_ID_SP128AR)}, | 145 | {USB_DEVICE(VENDOR_ID_MICRONET, PRODUCT_ID_SP128AR)}, |
144 | {USB_DEVICE(VENDOR_ID_LONGSHINE, PRODUCT_ID_LCS8138TX)}, | 146 | {USB_DEVICE(VENDOR_ID_LONGSHINE, PRODUCT_ID_LCS8138TX)}, |
147 | {USB_DEVICE(VENDOR_ID_ZYXEL, PRODUCT_ID_PRESTIGE)}, | ||
145 | {} | 148 | {} |
146 | }; | 149 | }; |
147 | 150 | ||
diff --git a/drivers/usb/serial/Kconfig b/drivers/usb/serial/Kconfig index 8bd44fda5eaf..ac33bd47cfce 100644 --- a/drivers/usb/serial/Kconfig +++ b/drivers/usb/serial/Kconfig | |||
@@ -456,6 +456,17 @@ config USB_SERIAL_SAFE_PADDED | |||
456 | bool "USB Secure Encapsulated Driver - Padded" | 456 | bool "USB Secure Encapsulated Driver - Padded" |
457 | depends on USB_SERIAL_SAFE | 457 | depends on USB_SERIAL_SAFE |
458 | 458 | ||
459 | config USB_SERIAL_SIERRAWIRELESS | ||
460 | tristate "USB Sierra Wireless Driver" | ||
461 | depends on USB_SERIAL | ||
462 | help | ||
463 | Say M here if you want to use a Sierra Wireless device (if | ||
464 | using an PC 5220 or AC580 please use the Airprime driver | ||
465 | instead). | ||
466 | |||
467 | To compile this driver as a module, choose M here: the | ||
468 | module will be called sierra. | ||
469 | |||
459 | config USB_SERIAL_TI | 470 | config USB_SERIAL_TI |
460 | tristate "USB TI 3410/5052 Serial Driver" | 471 | tristate "USB TI 3410/5052 Serial Driver" |
461 | depends on USB_SERIAL | 472 | depends on USB_SERIAL |
diff --git a/drivers/usb/serial/Makefile b/drivers/usb/serial/Makefile index 5a0960fc9d3e..35d4acc7f1d3 100644 --- a/drivers/usb/serial/Makefile +++ b/drivers/usb/serial/Makefile | |||
@@ -39,6 +39,7 @@ obj-$(CONFIG_USB_SERIAL_OMNINET) += omninet.o | |||
39 | obj-$(CONFIG_USB_SERIAL_OPTION) += option.o | 39 | obj-$(CONFIG_USB_SERIAL_OPTION) += option.o |
40 | obj-$(CONFIG_USB_SERIAL_PL2303) += pl2303.o | 40 | obj-$(CONFIG_USB_SERIAL_PL2303) += pl2303.o |
41 | obj-$(CONFIG_USB_SERIAL_SAFE) += safe_serial.o | 41 | obj-$(CONFIG_USB_SERIAL_SAFE) += safe_serial.o |
42 | obj-$(CONFIG_USB_SERIAL_SIERRAWIRELESS) += sierra.o | ||
42 | obj-$(CONFIG_USB_SERIAL_TI) += ti_usb_3410_5052.o | 43 | obj-$(CONFIG_USB_SERIAL_TI) += ti_usb_3410_5052.o |
43 | obj-$(CONFIG_USB_SERIAL_VISOR) += visor.o | 44 | obj-$(CONFIG_USB_SERIAL_VISOR) += visor.o |
44 | obj-$(CONFIG_USB_SERIAL_WHITEHEAT) += whiteheat.o | 45 | obj-$(CONFIG_USB_SERIAL_WHITEHEAT) += whiteheat.o |
diff --git a/drivers/usb/serial/airprime.c b/drivers/usb/serial/airprime.c index 94b9ba0ff875..62082532a8b3 100644 --- a/drivers/usb/serial/airprime.c +++ b/drivers/usb/serial/airprime.c | |||
@@ -13,7 +13,7 @@ | |||
13 | #include <linux/tty.h> | 13 | #include <linux/tty.h> |
14 | #include <linux/module.h> | 14 | #include <linux/module.h> |
15 | #include <linux/usb.h> | 15 | #include <linux/usb.h> |
16 | #include "usb-serial.h" | 16 | #include <linux/usb/serial.h> |
17 | 17 | ||
18 | static struct usb_device_id id_table [] = { | 18 | static struct usb_device_id id_table [] = { |
19 | { USB_DEVICE(0x0c88, 0x17da) }, /* Kyocera Wireless KPC650/Passport */ | 19 | { USB_DEVICE(0x0c88, 0x17da) }, /* Kyocera Wireless KPC650/Passport */ |
diff --git a/drivers/usb/serial/anydata.c b/drivers/usb/serial/anydata.c index 343f6f228220..01843ef8c11e 100644 --- a/drivers/usb/serial/anydata.c +++ b/drivers/usb/serial/anydata.c | |||
@@ -13,7 +13,7 @@ | |||
13 | #include <linux/tty.h> | 13 | #include <linux/tty.h> |
14 | #include <linux/module.h> | 14 | #include <linux/module.h> |
15 | #include <linux/usb.h> | 15 | #include <linux/usb.h> |
16 | #include "usb-serial.h" | 16 | #include <linux/usb/serial.h> |
17 | 17 | ||
18 | static struct usb_device_id id_table [] = { | 18 | static struct usb_device_id id_table [] = { |
19 | { USB_DEVICE(0x16d5, 0x6501) }, /* AirData CDMA device */ | 19 | { USB_DEVICE(0x16d5, 0x6501) }, /* AirData CDMA device */ |
@@ -71,7 +71,7 @@ static int anydata_open(struct usb_serial_port *port, struct file *filp) | |||
71 | port->bulk_in_endpointAddress), | 71 | port->bulk_in_endpointAddress), |
72 | port->read_urb->transfer_buffer, | 72 | port->read_urb->transfer_buffer, |
73 | port->read_urb->transfer_buffer_length, | 73 | port->read_urb->transfer_buffer_length, |
74 | usb_serial_generic_write_bulk_callback, port); | 74 | usb_serial_generic_read_bulk_callback, port); |
75 | result = usb_submit_urb(port->read_urb, GFP_KERNEL); | 75 | result = usb_submit_urb(port->read_urb, GFP_KERNEL); |
76 | if (result) | 76 | if (result) |
77 | dev_err(&port->dev, | 77 | dev_err(&port->dev, |
diff --git a/drivers/usb/serial/ark3116.c b/drivers/usb/serial/ark3116.c index 8dec796222a0..970d9ef0a7a5 100644 --- a/drivers/usb/serial/ark3116.c +++ b/drivers/usb/serial/ark3116.c | |||
@@ -21,7 +21,7 @@ | |||
21 | #include <linux/tty.h> | 21 | #include <linux/tty.h> |
22 | #include <linux/module.h> | 22 | #include <linux/module.h> |
23 | #include <linux/usb.h> | 23 | #include <linux/usb.h> |
24 | #include "usb-serial.h" | 24 | #include <linux/usb/serial.h> |
25 | 25 | ||
26 | 26 | ||
27 | static int debug; | 27 | static int debug; |
diff --git a/drivers/usb/serial/belkin_sa.c b/drivers/usb/serial/belkin_sa.c index 3faa7aa0111a..70ece9e01ce4 100644 --- a/drivers/usb/serial/belkin_sa.c +++ b/drivers/usb/serial/belkin_sa.c | |||
@@ -74,7 +74,7 @@ | |||
74 | #include <linux/spinlock.h> | 74 | #include <linux/spinlock.h> |
75 | #include <asm/uaccess.h> | 75 | #include <asm/uaccess.h> |
76 | #include <linux/usb.h> | 76 | #include <linux/usb.h> |
77 | #include "usb-serial.h" | 77 | #include <linux/usb/serial.h> |
78 | #include "belkin_sa.h" | 78 | #include "belkin_sa.h" |
79 | 79 | ||
80 | static int debug; | 80 | static int debug; |
diff --git a/drivers/usb/serial/bus.c b/drivers/usb/serial/bus.c index f2d993b70c18..6542f220468f 100644 --- a/drivers/usb/serial/bus.c +++ b/drivers/usb/serial/bus.c | |||
@@ -13,7 +13,7 @@ | |||
13 | #include <linux/tty.h> | 13 | #include <linux/tty.h> |
14 | #include <linux/module.h> | 14 | #include <linux/module.h> |
15 | #include <linux/usb.h> | 15 | #include <linux/usb.h> |
16 | #include "usb-serial.h" | 16 | #include <linux/usb/serial.h> |
17 | 17 | ||
18 | static int usb_serial_device_match (struct device *dev, struct device_driver *drv) | 18 | static int usb_serial_device_match (struct device *dev, struct device_driver *drv) |
19 | { | 19 | { |
diff --git a/drivers/usb/serial/console.c b/drivers/usb/serial/console.c index 3d456b32c316..3a9073dbfe6a 100644 --- a/drivers/usb/serial/console.c +++ b/drivers/usb/serial/console.c | |||
@@ -17,11 +17,10 @@ | |||
17 | #include <linux/tty.h> | 17 | #include <linux/tty.h> |
18 | #include <linux/console.h> | 18 | #include <linux/console.h> |
19 | #include <linux/usb.h> | 19 | #include <linux/usb.h> |
20 | #include <linux/usb/serial.h> | ||
20 | 21 | ||
21 | static int debug; | 22 | static int debug; |
22 | 23 | ||
23 | #include "usb-serial.h" | ||
24 | |||
25 | struct usbcons_info { | 24 | struct usbcons_info { |
26 | int magic; | 25 | int magic; |
27 | int break_flag; | 26 | int break_flag; |
diff --git a/drivers/usb/serial/cp2101.c b/drivers/usb/serial/cp2101.c index df0a4f98b4ae..486c7411b9a7 100644 --- a/drivers/usb/serial/cp2101.c +++ b/drivers/usb/serial/cp2101.c | |||
@@ -26,7 +26,7 @@ | |||
26 | #include <linux/moduleparam.h> | 26 | #include <linux/moduleparam.h> |
27 | #include <linux/usb.h> | 27 | #include <linux/usb.h> |
28 | #include <asm/uaccess.h> | 28 | #include <asm/uaccess.h> |
29 | #include "usb-serial.h" | 29 | #include <linux/usb/serial.h> |
30 | 30 | ||
31 | /* | 31 | /* |
32 | * Version Information | 32 | * Version Information |
diff --git a/drivers/usb/serial/cyberjack.c b/drivers/usb/serial/cyberjack.c index 49b51ab0d4cb..6286aba86fae 100644 --- a/drivers/usb/serial/cyberjack.c +++ b/drivers/usb/serial/cyberjack.c | |||
@@ -39,7 +39,7 @@ | |||
39 | #include <linux/spinlock.h> | 39 | #include <linux/spinlock.h> |
40 | #include <asm/uaccess.h> | 40 | #include <asm/uaccess.h> |
41 | #include <linux/usb.h> | 41 | #include <linux/usb.h> |
42 | #include "usb-serial.h" | 42 | #include <linux/usb/serial.h> |
43 | 43 | ||
44 | #define CYBERJACK_LOCAL_BUF_SIZE 32 | 44 | #define CYBERJACK_LOCAL_BUF_SIZE 32 |
45 | 45 | ||
diff --git a/drivers/usb/serial/cypress_m8.c b/drivers/usb/serial/cypress_m8.c index 4ff2dfb299bd..ee70fddcab60 100644 --- a/drivers/usb/serial/cypress_m8.c +++ b/drivers/usb/serial/cypress_m8.c | |||
@@ -59,11 +59,11 @@ | |||
59 | #include <linux/moduleparam.h> | 59 | #include <linux/moduleparam.h> |
60 | #include <linux/spinlock.h> | 60 | #include <linux/spinlock.h> |
61 | #include <linux/usb.h> | 61 | #include <linux/usb.h> |
62 | #include <linux/usb/serial.h> | ||
62 | #include <linux/serial.h> | 63 | #include <linux/serial.h> |
63 | #include <linux/delay.h> | 64 | #include <linux/delay.h> |
64 | #include <asm/uaccess.h> | 65 | #include <asm/uaccess.h> |
65 | 66 | ||
66 | #include "usb-serial.h" | ||
67 | #include "cypress_m8.h" | 67 | #include "cypress_m8.h" |
68 | 68 | ||
69 | 69 | ||
diff --git a/drivers/usb/serial/digi_acceleport.c b/drivers/usb/serial/digi_acceleport.c index 6953d3ef5738..9b225183fc7a 100644 --- a/drivers/usb/serial/digi_acceleport.c +++ b/drivers/usb/serial/digi_acceleport.c | |||
@@ -246,7 +246,7 @@ | |||
246 | #include <asm/uaccess.h> | 246 | #include <asm/uaccess.h> |
247 | #include <linux/usb.h> | 247 | #include <linux/usb.h> |
248 | #include <linux/wait.h> | 248 | #include <linux/wait.h> |
249 | #include "usb-serial.h" | 249 | #include <linux/usb/serial.h> |
250 | 250 | ||
251 | /* Defines */ | 251 | /* Defines */ |
252 | 252 | ||
diff --git a/drivers/usb/serial/empeg.c b/drivers/usb/serial/empeg.c index 1e2b31eeb497..daafe405d86d 100644 --- a/drivers/usb/serial/empeg.c +++ b/drivers/usb/serial/empeg.c | |||
@@ -62,7 +62,7 @@ | |||
62 | #include <linux/spinlock.h> | 62 | #include <linux/spinlock.h> |
63 | #include <asm/uaccess.h> | 63 | #include <asm/uaccess.h> |
64 | #include <linux/usb.h> | 64 | #include <linux/usb.h> |
65 | #include "usb-serial.h" | 65 | #include <linux/usb/serial.h> |
66 | 66 | ||
67 | static int debug; | 67 | static int debug; |
68 | 68 | ||
diff --git a/drivers/usb/serial/ezusb.c b/drivers/usb/serial/ezusb.c index debc3b0f9662..5169c2d154ab 100644 --- a/drivers/usb/serial/ezusb.c +++ b/drivers/usb/serial/ezusb.c | |||
@@ -15,7 +15,7 @@ | |||
15 | #include <linux/tty.h> | 15 | #include <linux/tty.h> |
16 | #include <linux/module.h> | 16 | #include <linux/module.h> |
17 | #include <linux/usb.h> | 17 | #include <linux/usb.h> |
18 | #include "usb-serial.h" | 18 | #include <linux/usb/serial.h> |
19 | 19 | ||
20 | /* EZ-USB Control and Status Register. Bit 0 controls 8051 reset */ | 20 | /* EZ-USB Control and Status Register. Bit 0 controls 8051 reset */ |
21 | #define CPUCS_REG 0x7F92 | 21 | #define CPUCS_REG 0x7F92 |
diff --git a/drivers/usb/serial/ftdi_sio.c b/drivers/usb/serial/ftdi_sio.c index 8a74b19f1283..b458aedc5fb6 100644 --- a/drivers/usb/serial/ftdi_sio.c +++ b/drivers/usb/serial/ftdi_sio.c | |||
@@ -257,7 +257,7 @@ | |||
257 | #include <asm/uaccess.h> | 257 | #include <asm/uaccess.h> |
258 | #include <linux/usb.h> | 258 | #include <linux/usb.h> |
259 | #include <linux/serial.h> | 259 | #include <linux/serial.h> |
260 | #include "usb-serial.h" | 260 | #include <linux/usb/serial.h> |
261 | #include "ftdi_sio.h" | 261 | #include "ftdi_sio.h" |
262 | 262 | ||
263 | /* | 263 | /* |
@@ -313,6 +313,7 @@ static struct usb_device_id id_table_combined [] = { | |||
313 | { USB_DEVICE(FTDI_VID, FTDI_8U232AM_PID) }, | 313 | { USB_DEVICE(FTDI_VID, FTDI_8U232AM_PID) }, |
314 | { USB_DEVICE(FTDI_VID, FTDI_8U232AM_ALT_PID) }, | 314 | { USB_DEVICE(FTDI_VID, FTDI_8U232AM_ALT_PID) }, |
315 | { USB_DEVICE(FTDI_VID, FTDI_8U2232C_PID) }, | 315 | { USB_DEVICE(FTDI_VID, FTDI_8U2232C_PID) }, |
316 | { USB_DEVICE(FTDI_VID, FTDI_MICRO_CHAMELEON_PID) }, | ||
316 | { USB_DEVICE(FTDI_VID, FTDI_RELAIS_PID) }, | 317 | { USB_DEVICE(FTDI_VID, FTDI_RELAIS_PID) }, |
317 | { USB_DEVICE(INTERBIOMETRICS_VID, INTERBIOMETRICS_IOBOARD_PID) }, | 318 | { USB_DEVICE(INTERBIOMETRICS_VID, INTERBIOMETRICS_IOBOARD_PID) }, |
318 | { USB_DEVICE(INTERBIOMETRICS_VID, INTERBIOMETRICS_MINI_IOBOARD_PID) }, | 319 | { USB_DEVICE(INTERBIOMETRICS_VID, INTERBIOMETRICS_MINI_IOBOARD_PID) }, |
@@ -500,6 +501,8 @@ static struct usb_device_id id_table_combined [] = { | |||
500 | { USB_DEVICE(PAPOUCH_VID, PAPOUCH_TMU_PID) }, | 501 | { USB_DEVICE(PAPOUCH_VID, PAPOUCH_TMU_PID) }, |
501 | { USB_DEVICE(FTDI_VID, FTDI_ACG_HFDUAL_PID) }, | 502 | { USB_DEVICE(FTDI_VID, FTDI_ACG_HFDUAL_PID) }, |
502 | { USB_DEVICE(FTDI_VID, FTDI_YEI_SERVOCENTER31_PID) }, | 503 | { USB_DEVICE(FTDI_VID, FTDI_YEI_SERVOCENTER31_PID) }, |
504 | { USB_DEVICE(FTDI_VID, FTDI_THORLABS_PID) }, | ||
505 | { USB_DEVICE(TESTO_VID, TESTO_USB_INTERFACE_PID) }, | ||
503 | { }, /* Optional parameter entry */ | 506 | { }, /* Optional parameter entry */ |
504 | { } /* Terminating entry */ | 507 | { } /* Terminating entry */ |
505 | }; | 508 | }; |
@@ -548,11 +551,17 @@ struct ftdi_private { | |||
548 | spinlock_t rx_lock; /* spinlock for receive state */ | 551 | spinlock_t rx_lock; /* spinlock for receive state */ |
549 | struct work_struct rx_work; | 552 | struct work_struct rx_work; |
550 | int rx_processed; | 553 | int rx_processed; |
554 | unsigned long rx_bytes; | ||
551 | 555 | ||
552 | __u16 interface; /* FT2232C port interface (0 for FT232/245) */ | 556 | __u16 interface; /* FT2232C port interface (0 for FT232/245) */ |
553 | 557 | ||
554 | int force_baud; /* if non-zero, force the baud rate to this value */ | 558 | int force_baud; /* if non-zero, force the baud rate to this value */ |
555 | int force_rtscts; /* if non-zero, force RTS-CTS to always be enabled */ | 559 | int force_rtscts; /* if non-zero, force RTS-CTS to always be enabled */ |
560 | |||
561 | spinlock_t tx_lock; /* spinlock for transmit state */ | ||
562 | unsigned long tx_bytes; | ||
563 | unsigned long tx_outstanding_bytes; | ||
564 | unsigned long tx_outstanding_urbs; | ||
556 | }; | 565 | }; |
557 | 566 | ||
558 | /* Used for TIOCMIWAIT */ | 567 | /* Used for TIOCMIWAIT */ |
@@ -626,6 +635,9 @@ static struct usb_serial_driver ftdi_sio_device = { | |||
626 | #define HIGH 1 | 635 | #define HIGH 1 |
627 | #define LOW 0 | 636 | #define LOW 0 |
628 | 637 | ||
638 | /* number of outstanding urbs to prevent userspace DoS from happening */ | ||
639 | #define URB_UPPER_LIMIT 42 | ||
640 | |||
629 | /* | 641 | /* |
630 | * *************************************************************************** | 642 | * *************************************************************************** |
631 | * Utlity functions | 643 | * Utlity functions |
@@ -1156,6 +1168,7 @@ static int ftdi_sio_attach (struct usb_serial *serial) | |||
1156 | } | 1168 | } |
1157 | 1169 | ||
1158 | spin_lock_init(&priv->rx_lock); | 1170 | spin_lock_init(&priv->rx_lock); |
1171 | spin_lock_init(&priv->tx_lock); | ||
1159 | init_waitqueue_head(&priv->delta_msr_wait); | 1172 | init_waitqueue_head(&priv->delta_msr_wait); |
1160 | /* This will push the characters through immediately rather | 1173 | /* This will push the characters through immediately rather |
1161 | than queue a task to deliver them */ | 1174 | than queue a task to deliver them */ |
@@ -1270,6 +1283,13 @@ static int ftdi_open (struct usb_serial_port *port, struct file *filp) | |||
1270 | 1283 | ||
1271 | dbg("%s", __FUNCTION__); | 1284 | dbg("%s", __FUNCTION__); |
1272 | 1285 | ||
1286 | spin_lock_irqsave(&priv->tx_lock, flags); | ||
1287 | priv->tx_bytes = 0; | ||
1288 | spin_unlock_irqrestore(&priv->tx_lock, flags); | ||
1289 | spin_lock_irqsave(&priv->rx_lock, flags); | ||
1290 | priv->rx_bytes = 0; | ||
1291 | spin_unlock_irqrestore(&priv->rx_lock, flags); | ||
1292 | |||
1273 | if (port->tty) | 1293 | if (port->tty) |
1274 | port->tty->low_latency = (priv->flags & ASYNC_LOW_LATENCY) ? 1 : 0; | 1294 | port->tty->low_latency = (priv->flags & ASYNC_LOW_LATENCY) ? 1 : 0; |
1275 | 1295 | ||
@@ -1372,6 +1392,7 @@ static int ftdi_write (struct usb_serial_port *port, | |||
1372 | int data_offset ; /* will be 1 for the SIO and 0 otherwise */ | 1392 | int data_offset ; /* will be 1 for the SIO and 0 otherwise */ |
1373 | int status; | 1393 | int status; |
1374 | int transfer_size; | 1394 | int transfer_size; |
1395 | unsigned long flags; | ||
1375 | 1396 | ||
1376 | dbg("%s port %d, %d bytes", __FUNCTION__, port->number, count); | 1397 | dbg("%s port %d, %d bytes", __FUNCTION__, port->number, count); |
1377 | 1398 | ||
@@ -1379,6 +1400,13 @@ static int ftdi_write (struct usb_serial_port *port, | |||
1379 | dbg("write request of 0 bytes"); | 1400 | dbg("write request of 0 bytes"); |
1380 | return 0; | 1401 | return 0; |
1381 | } | 1402 | } |
1403 | spin_lock_irqsave(&priv->tx_lock, flags); | ||
1404 | if (priv->tx_outstanding_urbs > URB_UPPER_LIMIT) { | ||
1405 | spin_unlock_irqrestore(&priv->tx_lock, flags); | ||
1406 | dbg("%s - write limit hit\n", __FUNCTION__); | ||
1407 | return 0; | ||
1408 | } | ||
1409 | spin_unlock_irqrestore(&priv->tx_lock, flags); | ||
1382 | 1410 | ||
1383 | data_offset = priv->write_offset; | 1411 | data_offset = priv->write_offset; |
1384 | dbg("data_offset set to %d",data_offset); | 1412 | dbg("data_offset set to %d",data_offset); |
@@ -1445,6 +1473,12 @@ static int ftdi_write (struct usb_serial_port *port, | |||
1445 | err("%s - failed submitting write urb, error %d", __FUNCTION__, status); | 1473 | err("%s - failed submitting write urb, error %d", __FUNCTION__, status); |
1446 | count = status; | 1474 | count = status; |
1447 | kfree (buffer); | 1475 | kfree (buffer); |
1476 | } else { | ||
1477 | spin_lock_irqsave(&priv->tx_lock, flags); | ||
1478 | ++priv->tx_outstanding_urbs; | ||
1479 | priv->tx_outstanding_bytes += count; | ||
1480 | priv->tx_bytes += count; | ||
1481 | spin_unlock_irqrestore(&priv->tx_lock, flags); | ||
1448 | } | 1482 | } |
1449 | 1483 | ||
1450 | /* we are done with this urb, so let the host driver | 1484 | /* we are done with this urb, so let the host driver |
@@ -1460,7 +1494,11 @@ static int ftdi_write (struct usb_serial_port *port, | |||
1460 | 1494 | ||
1461 | static void ftdi_write_bulk_callback (struct urb *urb, struct pt_regs *regs) | 1495 | static void ftdi_write_bulk_callback (struct urb *urb, struct pt_regs *regs) |
1462 | { | 1496 | { |
1497 | unsigned long flags; | ||
1463 | struct usb_serial_port *port = (struct usb_serial_port *)urb->context; | 1498 | struct usb_serial_port *port = (struct usb_serial_port *)urb->context; |
1499 | struct ftdi_private *priv; | ||
1500 | int data_offset; /* will be 1 for the SIO and 0 otherwise */ | ||
1501 | unsigned long countback; | ||
1464 | 1502 | ||
1465 | /* free up the transfer buffer, as usb_free_urb() does not do this */ | 1503 | /* free up the transfer buffer, as usb_free_urb() does not do this */ |
1466 | kfree (urb->transfer_buffer); | 1504 | kfree (urb->transfer_buffer); |
@@ -1472,34 +1510,67 @@ static void ftdi_write_bulk_callback (struct urb *urb, struct pt_regs *regs) | |||
1472 | return; | 1510 | return; |
1473 | } | 1511 | } |
1474 | 1512 | ||
1513 | priv = usb_get_serial_port_data(port); | ||
1514 | if (!priv) { | ||
1515 | dbg("%s - bad port private data pointer - exiting", __FUNCTION__); | ||
1516 | return; | ||
1517 | } | ||
1518 | /* account for transferred data */ | ||
1519 | countback = urb->actual_length; | ||
1520 | data_offset = priv->write_offset; | ||
1521 | if (data_offset > 0) { | ||
1522 | /* Subtract the control bytes */ | ||
1523 | countback -= (data_offset * ((countback + (PKTSZ - 1)) / PKTSZ)); | ||
1524 | } | ||
1525 | spin_lock_irqsave(&priv->tx_lock, flags); | ||
1526 | --priv->tx_outstanding_urbs; | ||
1527 | priv->tx_outstanding_bytes -= countback; | ||
1528 | spin_unlock_irqrestore(&priv->tx_lock, flags); | ||
1529 | |||
1475 | usb_serial_port_softint(port); | 1530 | usb_serial_port_softint(port); |
1476 | } /* ftdi_write_bulk_callback */ | 1531 | } /* ftdi_write_bulk_callback */ |
1477 | 1532 | ||
1478 | 1533 | ||
1479 | static int ftdi_write_room( struct usb_serial_port *port ) | 1534 | static int ftdi_write_room( struct usb_serial_port *port ) |
1480 | { | 1535 | { |
1536 | struct ftdi_private *priv = usb_get_serial_port_data(port); | ||
1537 | int room; | ||
1538 | unsigned long flags; | ||
1539 | |||
1481 | dbg("%s - port %d", __FUNCTION__, port->number); | 1540 | dbg("%s - port %d", __FUNCTION__, port->number); |
1482 | 1541 | ||
1483 | /* | 1542 | spin_lock_irqsave(&priv->tx_lock, flags); |
1484 | * We really can take anything the user throws at us | 1543 | if (priv->tx_outstanding_urbs < URB_UPPER_LIMIT) { |
1485 | * but let's pick a nice big number to tell the tty | 1544 | /* |
1486 | * layer that we have lots of free space | 1545 | * We really can take anything the user throws at us |
1487 | */ | 1546 | * but let's pick a nice big number to tell the tty |
1488 | return 2048; | 1547 | * layer that we have lots of free space |
1548 | */ | ||
1549 | room = 2048; | ||
1550 | } else { | ||
1551 | room = 0; | ||
1552 | } | ||
1553 | spin_unlock_irqrestore(&priv->tx_lock, flags); | ||
1554 | return room; | ||
1489 | } /* ftdi_write_room */ | 1555 | } /* ftdi_write_room */ |
1490 | 1556 | ||
1491 | 1557 | ||
1492 | static int ftdi_chars_in_buffer (struct usb_serial_port *port) | 1558 | static int ftdi_chars_in_buffer (struct usb_serial_port *port) |
1493 | { /* ftdi_chars_in_buffer */ | 1559 | { /* ftdi_chars_in_buffer */ |
1560 | struct ftdi_private *priv = usb_get_serial_port_data(port); | ||
1561 | int buffered; | ||
1562 | unsigned long flags; | ||
1563 | |||
1494 | dbg("%s - port %d", __FUNCTION__, port->number); | 1564 | dbg("%s - port %d", __FUNCTION__, port->number); |
1495 | 1565 | ||
1496 | /* | 1566 | spin_lock_irqsave(&priv->tx_lock, flags); |
1497 | * We can't really account for how much data we | 1567 | buffered = (int)priv->tx_outstanding_bytes; |
1498 | * have sent out, but hasn't made it through to the | 1568 | spin_unlock_irqrestore(&priv->tx_lock, flags); |
1499 | * device, so just tell the tty layer that everything | 1569 | if (buffered < 0) { |
1500 | * is flushed. | 1570 | err("%s outstanding tx bytes is negative!", __FUNCTION__); |
1501 | */ | 1571 | buffered = 0; |
1502 | return 0; | 1572 | } |
1573 | return buffered; | ||
1503 | } /* ftdi_chars_in_buffer */ | 1574 | } /* ftdi_chars_in_buffer */ |
1504 | 1575 | ||
1505 | 1576 | ||
@@ -1509,6 +1580,8 @@ static void ftdi_read_bulk_callback (struct urb *urb, struct pt_regs *regs) | |||
1509 | struct usb_serial_port *port = (struct usb_serial_port *)urb->context; | 1580 | struct usb_serial_port *port = (struct usb_serial_port *)urb->context; |
1510 | struct tty_struct *tty; | 1581 | struct tty_struct *tty; |
1511 | struct ftdi_private *priv; | 1582 | struct ftdi_private *priv; |
1583 | unsigned long countread; | ||
1584 | unsigned long flags; | ||
1512 | 1585 | ||
1513 | if (urb->number_of_packets > 0) { | 1586 | if (urb->number_of_packets > 0) { |
1514 | err("%s transfer_buffer_length %d actual_length %d number of packets %d",__FUNCTION__, | 1587 | err("%s transfer_buffer_length %d actual_length %d number of packets %d",__FUNCTION__, |
@@ -1543,6 +1616,13 @@ static void ftdi_read_bulk_callback (struct urb *urb, struct pt_regs *regs) | |||
1543 | return; | 1616 | return; |
1544 | } | 1617 | } |
1545 | 1618 | ||
1619 | /* count data bytes, but not status bytes */ | ||
1620 | countread = urb->actual_length; | ||
1621 | countread -= 2 * ((countread + (PKTSZ - 1)) / PKTSZ); | ||
1622 | spin_lock_irqsave(&priv->rx_lock, flags); | ||
1623 | priv->rx_bytes += countread; | ||
1624 | spin_unlock_irqrestore(&priv->rx_lock, flags); | ||
1625 | |||
1546 | ftdi_process_read(port); | 1626 | ftdi_process_read(port); |
1547 | 1627 | ||
1548 | } /* ftdi_read_bulk_callback */ | 1628 | } /* ftdi_read_bulk_callback */ |
diff --git a/drivers/usb/serial/ftdi_sio.h b/drivers/usb/serial/ftdi_sio.h index 6ab2ac845bd7..04ef90fcb876 100644 --- a/drivers/usb/serial/ftdi_sio.h +++ b/drivers/usb/serial/ftdi_sio.h | |||
@@ -36,6 +36,9 @@ | |||
36 | #define FTDI_ACTZWAVE_PID 0xF2D0 | 36 | #define FTDI_ACTZWAVE_PID 0xF2D0 |
37 | 37 | ||
38 | 38 | ||
39 | /* www.starting-point-systems.com µChameleon device */ | ||
40 | #define FTDI_MICRO_CHAMELEON_PID 0xCAA0 /* Product Id */ | ||
41 | |||
39 | /* www.irtrans.de device */ | 42 | /* www.irtrans.de device */ |
40 | #define FTDI_IRTRANS_PID 0xFC60 /* Product Id */ | 43 | #define FTDI_IRTRANS_PID 0xFC60 /* Product Id */ |
41 | 44 | ||
@@ -442,6 +445,18 @@ | |||
442 | */ | 445 | */ |
443 | #define FTDI_YEI_SERVOCENTER31_PID 0xE050 /* YEI ServoCenter3.1 USB */ | 446 | #define FTDI_YEI_SERVOCENTER31_PID 0xE050 /* YEI ServoCenter3.1 USB */ |
444 | 447 | ||
448 | /* | ||
449 | * ThorLabs USB motor drivers | ||
450 | */ | ||
451 | #define FTDI_THORLABS_PID 0xfaf0 /* ThorLabs USB motor drivers */ | ||
452 | |||
453 | /* | ||
454 | * Testo products (http://www.testo.com/) | ||
455 | * Submitted by Colin Leroy | ||
456 | */ | ||
457 | #define TESTO_VID 0x128D | ||
458 | #define TESTO_USB_INTERFACE_PID 0x0001 | ||
459 | |||
445 | /* Commands */ | 460 | /* Commands */ |
446 | #define FTDI_SIO_RESET 0 /* Reset the port */ | 461 | #define FTDI_SIO_RESET 0 /* Reset the port */ |
447 | #define FTDI_SIO_MODEM_CTRL 1 /* Set the modem control register */ | 462 | #define FTDI_SIO_MODEM_CTRL 1 /* Set the modem control register */ |
diff --git a/drivers/usb/serial/funsoft.c b/drivers/usb/serial/funsoft.c index 803721b97e2e..77b977206a8c 100644 --- a/drivers/usb/serial/funsoft.c +++ b/drivers/usb/serial/funsoft.c | |||
@@ -13,7 +13,7 @@ | |||
13 | #include <linux/tty.h> | 13 | #include <linux/tty.h> |
14 | #include <linux/module.h> | 14 | #include <linux/module.h> |
15 | #include <linux/usb.h> | 15 | #include <linux/usb.h> |
16 | #include "usb-serial.h" | 16 | #include <linux/usb/serial.h> |
17 | 17 | ||
18 | static struct usb_device_id id_table [] = { | 18 | static struct usb_device_id id_table [] = { |
19 | { USB_DEVICE(0x1404, 0xcddc) }, | 19 | { USB_DEVICE(0x1404, 0xcddc) }, |
diff --git a/drivers/usb/serial/garmin_gps.c b/drivers/usb/serial/garmin_gps.c index 1f5d1620baa1..727852634be9 100644 --- a/drivers/usb/serial/garmin_gps.c +++ b/drivers/usb/serial/garmin_gps.c | |||
@@ -35,6 +35,7 @@ | |||
35 | #include <linux/spinlock.h> | 35 | #include <linux/spinlock.h> |
36 | #include <asm/uaccess.h> | 36 | #include <asm/uaccess.h> |
37 | #include <linux/usb.h> | 37 | #include <linux/usb.h> |
38 | #include <linux/usb/serial.h> | ||
38 | 39 | ||
39 | /* the mode to be set when the port ist opened */ | 40 | /* the mode to be set when the port ist opened */ |
40 | static int initial_mode = 1; | 41 | static int initial_mode = 1; |
@@ -42,8 +43,6 @@ static int initial_mode = 1; | |||
42 | /* debug flag */ | 43 | /* debug flag */ |
43 | static int debug = 0; | 44 | static int debug = 0; |
44 | 45 | ||
45 | #include "usb-serial.h" | ||
46 | |||
47 | #define GARMIN_VENDOR_ID 0x091E | 46 | #define GARMIN_VENDOR_ID 0x091E |
48 | 47 | ||
49 | /* | 48 | /* |
diff --git a/drivers/usb/serial/generic.c b/drivers/usb/serial/generic.c index 945b8bb38c92..172713556393 100644 --- a/drivers/usb/serial/generic.c +++ b/drivers/usb/serial/generic.c | |||
@@ -17,8 +17,8 @@ | |||
17 | #include <linux/module.h> | 17 | #include <linux/module.h> |
18 | #include <linux/moduleparam.h> | 18 | #include <linux/moduleparam.h> |
19 | #include <linux/usb.h> | 19 | #include <linux/usb.h> |
20 | #include <linux/usb/serial.h> | ||
20 | #include <asm/uaccess.h> | 21 | #include <asm/uaccess.h> |
21 | #include "usb-serial.h" | ||
22 | 22 | ||
23 | static int debug; | 23 | static int debug; |
24 | 24 | ||
@@ -285,6 +285,7 @@ void usb_serial_generic_read_bulk_callback (struct urb *urb, struct pt_regs *reg | |||
285 | if (result) | 285 | if (result) |
286 | dev_err(&port->dev, "%s - failed resubmitting read urb, error %d\n", __FUNCTION__, result); | 286 | dev_err(&port->dev, "%s - failed resubmitting read urb, error %d\n", __FUNCTION__, result); |
287 | } | 287 | } |
288 | EXPORT_SYMBOL_GPL(usb_serial_generic_read_bulk_callback); | ||
288 | 289 | ||
289 | void usb_serial_generic_write_bulk_callback (struct urb *urb, struct pt_regs *regs) | 290 | void usb_serial_generic_write_bulk_callback (struct urb *urb, struct pt_regs *regs) |
290 | { | 291 | { |
diff --git a/drivers/usb/serial/hp4x.c b/drivers/usb/serial/hp4x.c index 7e06358b0310..ebcac701b069 100644 --- a/drivers/usb/serial/hp4x.c +++ b/drivers/usb/serial/hp4x.c | |||
@@ -17,7 +17,7 @@ | |||
17 | #include <linux/tty.h> | 17 | #include <linux/tty.h> |
18 | #include <linux/module.h> | 18 | #include <linux/module.h> |
19 | #include <linux/usb.h> | 19 | #include <linux/usb.h> |
20 | #include "usb-serial.h" | 20 | #include <linux/usb/serial.h> |
21 | 21 | ||
22 | /* | 22 | /* |
23 | * Version Information | 23 | * Version Information |
diff --git a/drivers/usb/serial/io_edgeport.c b/drivers/usb/serial/io_edgeport.c index bd2c05dac2a9..c49976c3ad52 100644 --- a/drivers/usb/serial/io_edgeport.c +++ b/drivers/usb/serial/io_edgeport.c | |||
@@ -44,7 +44,7 @@ | |||
44 | #include <linux/wait.h> | 44 | #include <linux/wait.h> |
45 | #include <asm/uaccess.h> | 45 | #include <asm/uaccess.h> |
46 | #include <linux/usb.h> | 46 | #include <linux/usb.h> |
47 | #include "usb-serial.h" | 47 | #include <linux/usb/serial.h> |
48 | #include "io_edgeport.h" | 48 | #include "io_edgeport.h" |
49 | #include "io_ionsp.h" /* info for the iosp messages */ | 49 | #include "io_ionsp.h" /* info for the iosp messages */ |
50 | #include "io_16654.h" /* 16654 UART defines */ | 50 | #include "io_16654.h" /* 16654 UART defines */ |
diff --git a/drivers/usb/serial/io_ti.c b/drivers/usb/serial/io_ti.c index 723a12ae87b5..17c5b1d2311a 100644 --- a/drivers/usb/serial/io_ti.c +++ b/drivers/usb/serial/io_ti.c | |||
@@ -39,8 +39,8 @@ | |||
39 | #include <asm/uaccess.h> | 39 | #include <asm/uaccess.h> |
40 | #include <asm/semaphore.h> | 40 | #include <asm/semaphore.h> |
41 | #include <linux/usb.h> | 41 | #include <linux/usb.h> |
42 | #include <linux/usb/serial.h> | ||
42 | 43 | ||
43 | #include "usb-serial.h" | ||
44 | #include "io_16654.h" | 44 | #include "io_16654.h" |
45 | #include "io_usbvend.h" | 45 | #include "io_usbvend.h" |
46 | #include "io_ti.h" | 46 | #include "io_ti.h" |
diff --git a/drivers/usb/serial/ipaq.c b/drivers/usb/serial/ipaq.c index dbcfe172a5cc..59c5d999009a 100644 --- a/drivers/usb/serial/ipaq.c +++ b/drivers/usb/serial/ipaq.c | |||
@@ -55,7 +55,7 @@ | |||
55 | #include <linux/spinlock.h> | 55 | #include <linux/spinlock.h> |
56 | #include <asm/uaccess.h> | 56 | #include <asm/uaccess.h> |
57 | #include <linux/usb.h> | 57 | #include <linux/usb.h> |
58 | #include "usb-serial.h" | 58 | #include <linux/usb/serial.h> |
59 | #include "ipaq.h" | 59 | #include "ipaq.h" |
60 | 60 | ||
61 | #define KP_RETRIES 100 | 61 | #define KP_RETRIES 100 |
@@ -70,6 +70,8 @@ | |||
70 | 70 | ||
71 | static __u16 product, vendor; | 71 | static __u16 product, vendor; |
72 | static int debug; | 72 | static int debug; |
73 | static int connect_retries = KP_RETRIES; | ||
74 | static int initial_wait; | ||
73 | 75 | ||
74 | /* Function prototypes for an ipaq */ | 76 | /* Function prototypes for an ipaq */ |
75 | static int ipaq_open (struct usb_serial_port *port, struct file *filp); | 77 | static int ipaq_open (struct usb_serial_port *port, struct file *filp); |
@@ -582,7 +584,7 @@ static int ipaq_open(struct usb_serial_port *port, struct file *filp) | |||
582 | struct ipaq_private *priv; | 584 | struct ipaq_private *priv; |
583 | struct ipaq_packet *pkt; | 585 | struct ipaq_packet *pkt; |
584 | int i, result = 0; | 586 | int i, result = 0; |
585 | int retries = KP_RETRIES; | 587 | int retries = connect_retries; |
586 | 588 | ||
587 | dbg("%s - port %d", __FUNCTION__, port->number); | 589 | dbg("%s - port %d", __FUNCTION__, port->number); |
588 | 590 | ||
@@ -646,16 +648,12 @@ static int ipaq_open(struct usb_serial_port *port, struct file *filp) | |||
646 | port->read_urb->transfer_buffer_length = URBDATA_SIZE; | 648 | port->read_urb->transfer_buffer_length = URBDATA_SIZE; |
647 | port->bulk_out_size = port->write_urb->transfer_buffer_length = URBDATA_SIZE; | 649 | port->bulk_out_size = port->write_urb->transfer_buffer_length = URBDATA_SIZE; |
648 | 650 | ||
651 | msleep(1000*initial_wait); | ||
649 | /* Start reading from the device */ | 652 | /* Start reading from the device */ |
650 | usb_fill_bulk_urb(port->read_urb, serial->dev, | 653 | usb_fill_bulk_urb(port->read_urb, serial->dev, |
651 | usb_rcvbulkpipe(serial->dev, port->bulk_in_endpointAddress), | 654 | usb_rcvbulkpipe(serial->dev, port->bulk_in_endpointAddress), |
652 | port->read_urb->transfer_buffer, port->read_urb->transfer_buffer_length, | 655 | port->read_urb->transfer_buffer, port->read_urb->transfer_buffer_length, |
653 | ipaq_read_bulk_callback, port); | 656 | ipaq_read_bulk_callback, port); |
654 | result = usb_submit_urb(port->read_urb, GFP_KERNEL); | ||
655 | if (result) { | ||
656 | err("%s - failed submitting read urb, error %d", __FUNCTION__, result); | ||
657 | goto error; | ||
658 | } | ||
659 | 657 | ||
660 | /* | 658 | /* |
661 | * Send out control message observed in win98 sniffs. Not sure what | 659 | * Send out control message observed in win98 sniffs. Not sure what |
@@ -670,8 +668,14 @@ static int ipaq_open(struct usb_serial_port *port, struct file *filp) | |||
670 | usb_sndctrlpipe(serial->dev, 0), 0x22, 0x21, | 668 | usb_sndctrlpipe(serial->dev, 0), 0x22, 0x21, |
671 | 0x1, 0, NULL, 0, 100); | 669 | 0x1, 0, NULL, 0, 100); |
672 | if (result == 0) { | 670 | if (result == 0) { |
671 | result = usb_submit_urb(port->read_urb, GFP_KERNEL); | ||
672 | if (result) { | ||
673 | err("%s - failed submitting read urb, error %d", __FUNCTION__, result); | ||
674 | goto error; | ||
675 | } | ||
673 | return 0; | 676 | return 0; |
674 | } | 677 | } |
678 | msleep(1000); | ||
675 | } | 679 | } |
676 | err("%s - failed doing control urb, error %d", __FUNCTION__, result); | 680 | err("%s - failed doing control urb, error %d", __FUNCTION__, result); |
677 | goto error; | 681 | goto error; |
@@ -854,6 +858,7 @@ static void ipaq_write_bulk_callback(struct urb *urb, struct pt_regs *regs) | |||
854 | 858 | ||
855 | if (urb->status) { | 859 | if (urb->status) { |
856 | dbg("%s - nonzero write bulk status received: %d", __FUNCTION__, urb->status); | 860 | dbg("%s - nonzero write bulk status received: %d", __FUNCTION__, urb->status); |
861 | return; | ||
857 | } | 862 | } |
858 | 863 | ||
859 | spin_lock_irqsave(&write_list_lock, flags); | 864 | spin_lock_irqsave(&write_list_lock, flags); |
@@ -966,3 +971,9 @@ MODULE_PARM_DESC(vendor, "User specified USB idVendor"); | |||
966 | 971 | ||
967 | module_param(product, ushort, 0); | 972 | module_param(product, ushort, 0); |
968 | MODULE_PARM_DESC(product, "User specified USB idProduct"); | 973 | MODULE_PARM_DESC(product, "User specified USB idProduct"); |
974 | |||
975 | module_param(connect_retries, int, S_IRUGO|S_IWUSR); | ||
976 | MODULE_PARM_DESC(connect_retries, "Maximum number of connect retries (one second each)"); | ||
977 | |||
978 | module_param(initial_wait, int, S_IRUGO|S_IWUSR); | ||
979 | MODULE_PARM_DESC(initial_wait, "Time to wait before attempting a connection (in seconds)"); | ||
diff --git a/drivers/usb/serial/ipw.c b/drivers/usb/serial/ipw.c index a4a0bfeaab00..87306cb6f9f5 100644 --- a/drivers/usb/serial/ipw.c +++ b/drivers/usb/serial/ipw.c | |||
@@ -46,8 +46,8 @@ | |||
46 | #include <linux/module.h> | 46 | #include <linux/module.h> |
47 | #include <linux/spinlock.h> | 47 | #include <linux/spinlock.h> |
48 | #include <linux/usb.h> | 48 | #include <linux/usb.h> |
49 | #include <linux/usb/serial.h> | ||
49 | #include <asm/uaccess.h> | 50 | #include <asm/uaccess.h> |
50 | #include "usb-serial.h" | ||
51 | 51 | ||
52 | /* | 52 | /* |
53 | * Version Information | 53 | * Version Information |
@@ -373,6 +373,8 @@ static void ipw_write_bulk_callback(struct urb *urb, struct pt_regs *regs) | |||
373 | 373 | ||
374 | dbg("%s", __FUNCTION__); | 374 | dbg("%s", __FUNCTION__); |
375 | 375 | ||
376 | port->write_urb_busy = 0; | ||
377 | |||
376 | if (urb->status) | 378 | if (urb->status) |
377 | dbg("%s - nonzero write bulk status received: %d", __FUNCTION__, urb->status); | 379 | dbg("%s - nonzero write bulk status received: %d", __FUNCTION__, urb->status); |
378 | 380 | ||
diff --git a/drivers/usb/serial/ir-usb.c b/drivers/usb/serial/ir-usb.c index 2cf1fed3de43..1738b0b6a376 100644 --- a/drivers/usb/serial/ir-usb.c +++ b/drivers/usb/serial/ir-usb.c | |||
@@ -57,7 +57,7 @@ | |||
57 | #include <linux/spinlock.h> | 57 | #include <linux/spinlock.h> |
58 | #include <asm/uaccess.h> | 58 | #include <asm/uaccess.h> |
59 | #include <linux/usb.h> | 59 | #include <linux/usb.h> |
60 | #include "usb-serial.h" | 60 | #include <linux/usb/serial.h> |
61 | 61 | ||
62 | /* | 62 | /* |
63 | * Version Information | 63 | * Version Information |
diff --git a/drivers/usb/serial/keyspan.c b/drivers/usb/serial/keyspan.c index d7c58f1bc960..015ad6cc1bbb 100644 --- a/drivers/usb/serial/keyspan.c +++ b/drivers/usb/serial/keyspan.c | |||
@@ -107,7 +107,7 @@ | |||
107 | #include <linux/spinlock.h> | 107 | #include <linux/spinlock.h> |
108 | #include <asm/uaccess.h> | 108 | #include <asm/uaccess.h> |
109 | #include <linux/usb.h> | 109 | #include <linux/usb.h> |
110 | #include "usb-serial.h" | 110 | #include <linux/usb/serial.h> |
111 | #include "keyspan.h" | 111 | #include "keyspan.h" |
112 | 112 | ||
113 | static int debug; | 113 | static int debug; |
diff --git a/drivers/usb/serial/keyspan_pda.c b/drivers/usb/serial/keyspan_pda.c index 03ab3c0f3cce..49b8dc039d1f 100644 --- a/drivers/usb/serial/keyspan_pda.c +++ b/drivers/usb/serial/keyspan_pda.c | |||
@@ -78,6 +78,7 @@ | |||
78 | #include <linux/workqueue.h> | 78 | #include <linux/workqueue.h> |
79 | #include <asm/uaccess.h> | 79 | #include <asm/uaccess.h> |
80 | #include <linux/usb.h> | 80 | #include <linux/usb.h> |
81 | #include <linux/usb/serial.h> | ||
81 | 82 | ||
82 | static int debug; | 83 | static int debug; |
83 | 84 | ||
@@ -107,8 +108,6 @@ struct ezusb_hex_record { | |||
107 | #include "xircom_pgs_fw.h" | 108 | #include "xircom_pgs_fw.h" |
108 | #endif | 109 | #endif |
109 | 110 | ||
110 | #include "usb-serial.h" | ||
111 | |||
112 | /* | 111 | /* |
113 | * Version Information | 112 | * Version Information |
114 | */ | 113 | */ |
diff --git a/drivers/usb/serial/kl5kusb105.c b/drivers/usb/serial/kl5kusb105.c index b45ff3e7ab40..2a2f3e2da055 100644 --- a/drivers/usb/serial/kl5kusb105.c +++ b/drivers/usb/serial/kl5kusb105.c | |||
@@ -55,7 +55,7 @@ | |||
55 | #include <linux/module.h> | 55 | #include <linux/module.h> |
56 | #include <asm/uaccess.h> | 56 | #include <asm/uaccess.h> |
57 | #include <linux/usb.h> | 57 | #include <linux/usb.h> |
58 | #include "usb-serial.h" | 58 | #include <linux/usb/serial.h> |
59 | #include "kl5kusb105.h" | 59 | #include "kl5kusb105.h" |
60 | 60 | ||
61 | static int debug; | 61 | static int debug; |
diff --git a/drivers/usb/serial/kobil_sct.c b/drivers/usb/serial/kobil_sct.c index 457733374772..d50dce034958 100644 --- a/drivers/usb/serial/kobil_sct.c +++ b/drivers/usb/serial/kobil_sct.c | |||
@@ -46,8 +46,8 @@ | |||
46 | #include <linux/spinlock.h> | 46 | #include <linux/spinlock.h> |
47 | #include <asm/uaccess.h> | 47 | #include <asm/uaccess.h> |
48 | #include <linux/usb.h> | 48 | #include <linux/usb.h> |
49 | #include <linux/usb/serial.h> | ||
49 | #include <linux/ioctl.h> | 50 | #include <linux/ioctl.h> |
50 | #include "usb-serial.h" | ||
51 | #include "kobil_sct.h" | 51 | #include "kobil_sct.h" |
52 | 52 | ||
53 | static int debug; | 53 | static int debug; |
diff --git a/drivers/usb/serial/mct_u232.c b/drivers/usb/serial/mct_u232.c index ca05d3275f3e..f4d4305c2c02 100644 --- a/drivers/usb/serial/mct_u232.c +++ b/drivers/usb/serial/mct_u232.c | |||
@@ -75,7 +75,7 @@ | |||
75 | #include <linux/spinlock.h> | 75 | #include <linux/spinlock.h> |
76 | #include <asm/uaccess.h> | 76 | #include <asm/uaccess.h> |
77 | #include <linux/usb.h> | 77 | #include <linux/usb.h> |
78 | #include "usb-serial.h" | 78 | #include <linux/usb/serial.h> |
79 | #include "mct_u232.h" | 79 | #include "mct_u232.h" |
80 | 80 | ||
81 | /* | 81 | /* |
diff --git a/drivers/usb/serial/navman.c b/drivers/usb/serial/navman.c index 7f544081032e..ac3f8b5d2c49 100644 --- a/drivers/usb/serial/navman.c +++ b/drivers/usb/serial/navman.c | |||
@@ -14,7 +14,7 @@ | |||
14 | #include <linux/tty_flip.h> | 14 | #include <linux/tty_flip.h> |
15 | #include <linux/module.h> | 15 | #include <linux/module.h> |
16 | #include <linux/usb.h> | 16 | #include <linux/usb.h> |
17 | #include "usb-serial.h" | 17 | #include <linux/usb/serial.h> |
18 | 18 | ||
19 | static int debug; | 19 | static int debug; |
20 | 20 | ||
diff --git a/drivers/usb/serial/omninet.c b/drivers/usb/serial/omninet.c index cfb711a21a45..e49f40913c27 100644 --- a/drivers/usb/serial/omninet.c +++ b/drivers/usb/serial/omninet.c | |||
@@ -46,7 +46,7 @@ | |||
46 | #include <linux/spinlock.h> | 46 | #include <linux/spinlock.h> |
47 | #include <asm/uaccess.h> | 47 | #include <asm/uaccess.h> |
48 | #include <linux/usb.h> | 48 | #include <linux/usb.h> |
49 | #include "usb-serial.h" | 49 | #include <linux/usb/serial.h> |
50 | 50 | ||
51 | static int debug; | 51 | static int debug; |
52 | 52 | ||
diff --git a/drivers/usb/serial/option.c b/drivers/usb/serial/option.c index 78ad4b3126a6..f0530c1d7b7a 100644 --- a/drivers/usb/serial/option.c +++ b/drivers/usb/serial/option.c | |||
@@ -35,6 +35,7 @@ | |||
35 | 2006-06-01 v0.6.2 add backwards-compatibility stuff | 35 | 2006-06-01 v0.6.2 add backwards-compatibility stuff |
36 | 2006-06-01 v0.6.3 add Novatel Wireless | 36 | 2006-06-01 v0.6.3 add Novatel Wireless |
37 | 2006-06-01 v0.7 Option => GSM | 37 | 2006-06-01 v0.7 Option => GSM |
38 | 2006-06-01 v0.7.1 add COBRA2 | ||
38 | 39 | ||
39 | Work sponsored by: Sigos GmbH, Germany <info@sigos.de> | 40 | Work sponsored by: Sigos GmbH, Germany <info@sigos.de> |
40 | 41 | ||
@@ -53,7 +54,7 @@ | |||
53 | device features. | 54 | device features. |
54 | */ | 55 | */ |
55 | 56 | ||
56 | #define DRIVER_VERSION "v0.7.0" | 57 | #define DRIVER_VERSION "v0.7.1" |
57 | #define DRIVER_AUTHOR "Matthias Urlichs <smurf@smurf.noris.de>" | 58 | #define DRIVER_AUTHOR "Matthias Urlichs <smurf@smurf.noris.de>" |
58 | #define DRIVER_DESC "USB Driver for GSM modems" | 59 | #define DRIVER_DESC "USB Driver for GSM modems" |
59 | 60 | ||
@@ -64,7 +65,7 @@ | |||
64 | #include <linux/tty_flip.h> | 65 | #include <linux/tty_flip.h> |
65 | #include <linux/module.h> | 66 | #include <linux/module.h> |
66 | #include <linux/usb.h> | 67 | #include <linux/usb.h> |
67 | #include "usb-serial.h" | 68 | #include <linux/usb/serial.h> |
68 | 69 | ||
69 | /* Function prototypes */ | 70 | /* Function prototypes */ |
70 | static int option_open(struct usb_serial_port *port, struct file *filp); | 71 | static int option_open(struct usb_serial_port *port, struct file *filp); |
@@ -102,6 +103,7 @@ static int option_send_setup(struct usb_serial_port *port); | |||
102 | #define OPTION_PRODUCT_FUSION 0x6000 | 103 | #define OPTION_PRODUCT_FUSION 0x6000 |
103 | #define OPTION_PRODUCT_FUSION2 0x6300 | 104 | #define OPTION_PRODUCT_FUSION2 0x6300 |
104 | #define OPTION_PRODUCT_COBRA 0x6500 | 105 | #define OPTION_PRODUCT_COBRA 0x6500 |
106 | #define OPTION_PRODUCT_COBRA2 0x6600 | ||
105 | #define HUAWEI_PRODUCT_E600 0x1001 | 107 | #define HUAWEI_PRODUCT_E600 0x1001 |
106 | #define AUDIOVOX_PRODUCT_AIRCARD 0x0112 | 108 | #define AUDIOVOX_PRODUCT_AIRCARD 0x0112 |
107 | #define SIERRAWIRELESS_PRODUCT_MC8755 0x6802 | 109 | #define SIERRAWIRELESS_PRODUCT_MC8755 0x6802 |
@@ -112,6 +114,7 @@ static struct usb_device_id option_ids[] = { | |||
112 | { USB_DEVICE(OPTION_VENDOR_ID, OPTION_PRODUCT_FUSION) }, | 114 | { USB_DEVICE(OPTION_VENDOR_ID, OPTION_PRODUCT_FUSION) }, |
113 | { USB_DEVICE(OPTION_VENDOR_ID, OPTION_PRODUCT_FUSION2) }, | 115 | { USB_DEVICE(OPTION_VENDOR_ID, OPTION_PRODUCT_FUSION2) }, |
114 | { USB_DEVICE(OPTION_VENDOR_ID, OPTION_PRODUCT_COBRA) }, | 116 | { USB_DEVICE(OPTION_VENDOR_ID, OPTION_PRODUCT_COBRA) }, |
117 | { USB_DEVICE(OPTION_VENDOR_ID, OPTION_PRODUCT_COBRA2) }, | ||
115 | { USB_DEVICE(HUAWEI_VENDOR_ID, HUAWEI_PRODUCT_E600) }, | 118 | { USB_DEVICE(HUAWEI_VENDOR_ID, HUAWEI_PRODUCT_E600) }, |
116 | { USB_DEVICE(AUDIOVOX_VENDOR_ID, AUDIOVOX_PRODUCT_AIRCARD) }, | 119 | { USB_DEVICE(AUDIOVOX_VENDOR_ID, AUDIOVOX_PRODUCT_AIRCARD) }, |
117 | { USB_DEVICE(SIERRAWIRELESS_VENDOR_ID, SIERRAWIRELESS_PRODUCT_MC8755) }, | 120 | { USB_DEVICE(SIERRAWIRELESS_VENDOR_ID, SIERRAWIRELESS_PRODUCT_MC8755) }, |
@@ -124,6 +127,7 @@ static struct usb_device_id option_ids1[] = { | |||
124 | { USB_DEVICE(OPTION_VENDOR_ID, OPTION_PRODUCT_FUSION) }, | 127 | { USB_DEVICE(OPTION_VENDOR_ID, OPTION_PRODUCT_FUSION) }, |
125 | { USB_DEVICE(OPTION_VENDOR_ID, OPTION_PRODUCT_FUSION2) }, | 128 | { USB_DEVICE(OPTION_VENDOR_ID, OPTION_PRODUCT_FUSION2) }, |
126 | { USB_DEVICE(OPTION_VENDOR_ID, OPTION_PRODUCT_COBRA) }, | 129 | { USB_DEVICE(OPTION_VENDOR_ID, OPTION_PRODUCT_COBRA) }, |
130 | { USB_DEVICE(OPTION_VENDOR_ID, OPTION_PRODUCT_COBRA2) }, | ||
127 | { USB_DEVICE(HUAWEI_VENDOR_ID, HUAWEI_PRODUCT_E600) }, | 131 | { USB_DEVICE(HUAWEI_VENDOR_ID, HUAWEI_PRODUCT_E600) }, |
128 | { USB_DEVICE(AUDIOVOX_VENDOR_ID, AUDIOVOX_PRODUCT_AIRCARD) }, | 132 | { USB_DEVICE(AUDIOVOX_VENDOR_ID, AUDIOVOX_PRODUCT_AIRCARD) }, |
129 | { USB_DEVICE(NOVATELWIRELESS_VENDOR_ID,NOVATELWIRELESS_PRODUCT_U740) }, | 133 | { USB_DEVICE(NOVATELWIRELESS_VENDOR_ID,NOVATELWIRELESS_PRODUCT_U740) }, |
diff --git a/drivers/usb/serial/pl2303.c b/drivers/usb/serial/pl2303.c index de93a2b909e7..259db31b65c1 100644 --- a/drivers/usb/serial/pl2303.c +++ b/drivers/usb/serial/pl2303.c | |||
@@ -27,7 +27,7 @@ | |||
27 | #include <linux/spinlock.h> | 27 | #include <linux/spinlock.h> |
28 | #include <asm/uaccess.h> | 28 | #include <asm/uaccess.h> |
29 | #include <linux/usb.h> | 29 | #include <linux/usb.h> |
30 | #include "usb-serial.h" | 30 | #include <linux/usb/serial.h> |
31 | #include "pl2303.h" | 31 | #include "pl2303.h" |
32 | 32 | ||
33 | /* | 33 | /* |
@@ -52,6 +52,7 @@ struct pl2303_buf { | |||
52 | static struct usb_device_id id_table [] = { | 52 | static struct usb_device_id id_table [] = { |
53 | { USB_DEVICE(PL2303_VENDOR_ID, PL2303_PRODUCT_ID) }, | 53 | { USB_DEVICE(PL2303_VENDOR_ID, PL2303_PRODUCT_ID) }, |
54 | { USB_DEVICE(PL2303_VENDOR_ID, PL2303_PRODUCT_ID_RSAQ2) }, | 54 | { USB_DEVICE(PL2303_VENDOR_ID, PL2303_PRODUCT_ID_RSAQ2) }, |
55 | { USB_DEVICE(PL2303_VENDOR_ID, PL2303_PRODUCT_ID_DCU11) }, | ||
55 | { USB_DEVICE(PL2303_VENDOR_ID, PL2303_PRODUCT_ID_RSAQ3) }, | 56 | { USB_DEVICE(PL2303_VENDOR_ID, PL2303_PRODUCT_ID_RSAQ3) }, |
56 | { USB_DEVICE(PL2303_VENDOR_ID, PL2303_PRODUCT_ID_PHAROS) }, | 57 | { USB_DEVICE(PL2303_VENDOR_ID, PL2303_PRODUCT_ID_PHAROS) }, |
57 | { USB_DEVICE(IODATA_VENDOR_ID, IODATA_PRODUCT_ID) }, | 58 | { USB_DEVICE(IODATA_VENDOR_ID, IODATA_PRODUCT_ID) }, |
@@ -79,6 +80,7 @@ static struct usb_device_id id_table [] = { | |||
79 | { USB_DEVICE(LEADTEK_VENDOR_ID, LEADTEK_9531_PRODUCT_ID) }, | 80 | { USB_DEVICE(LEADTEK_VENDOR_ID, LEADTEK_9531_PRODUCT_ID) }, |
80 | { USB_DEVICE(SPEEDDRAGON_VENDOR_ID, SPEEDDRAGON_PRODUCT_ID) }, | 81 | { USB_DEVICE(SPEEDDRAGON_VENDOR_ID, SPEEDDRAGON_PRODUCT_ID) }, |
81 | { USB_DEVICE(OTI_VENDOR_ID, OTI_PRODUCT_ID) }, | 82 | { USB_DEVICE(OTI_VENDOR_ID, OTI_PRODUCT_ID) }, |
83 | { USB_DEVICE(DATAPILOT_U2_VENDOR_ID, DATAPILOT_U2_PRODUCT_ID) }, | ||
82 | { } /* Terminating entry */ | 84 | { } /* Terminating entry */ |
83 | }; | 85 | }; |
84 | 86 | ||
diff --git a/drivers/usb/serial/pl2303.h b/drivers/usb/serial/pl2303.h index 7f29e81d3e35..d9c1e6e0b4b3 100644 --- a/drivers/usb/serial/pl2303.h +++ b/drivers/usb/serial/pl2303.h | |||
@@ -10,6 +10,7 @@ | |||
10 | #define PL2303_VENDOR_ID 0x067b | 10 | #define PL2303_VENDOR_ID 0x067b |
11 | #define PL2303_PRODUCT_ID 0x2303 | 11 | #define PL2303_PRODUCT_ID 0x2303 |
12 | #define PL2303_PRODUCT_ID_RSAQ2 0x04bb | 12 | #define PL2303_PRODUCT_ID_RSAQ2 0x04bb |
13 | #define PL2303_PRODUCT_ID_DCU11 0x1234 | ||
13 | #define PL2303_PRODUCT_ID_PHAROS 0xaaa0 | 14 | #define PL2303_PRODUCT_ID_PHAROS 0xaaa0 |
14 | #define PL2303_PRODUCT_ID_RSAQ3 0xaaa2 | 15 | #define PL2303_PRODUCT_ID_RSAQ3 0xaaa2 |
15 | 16 | ||
@@ -84,3 +85,7 @@ | |||
84 | /* Ours Technology Inc DKU-5 clone, chipset: Prolific Technology Inc */ | 85 | /* Ours Technology Inc DKU-5 clone, chipset: Prolific Technology Inc */ |
85 | #define OTI_VENDOR_ID 0x0ea0 | 86 | #define OTI_VENDOR_ID 0x0ea0 |
86 | #define OTI_PRODUCT_ID 0x6858 | 87 | #define OTI_PRODUCT_ID 0x6858 |
88 | |||
89 | /* DATAPILOT Universal-2 Phone Cable */ | ||
90 | #define DATAPILOT_U2_VENDOR_ID 0x0731 | ||
91 | #define DATAPILOT_U2_PRODUCT_ID 0x2003 | ||
diff --git a/drivers/usb/serial/safe_serial.c b/drivers/usb/serial/safe_serial.c index 897d8447252b..789771ecdb11 100644 --- a/drivers/usb/serial/safe_serial.c +++ b/drivers/usb/serial/safe_serial.c | |||
@@ -71,7 +71,7 @@ | |||
71 | #include <linux/spinlock.h> | 71 | #include <linux/spinlock.h> |
72 | #include <asm/uaccess.h> | 72 | #include <asm/uaccess.h> |
73 | #include <linux/usb.h> | 73 | #include <linux/usb.h> |
74 | #include "usb-serial.h" | 74 | #include <linux/usb/serial.h> |
75 | 75 | ||
76 | 76 | ||
77 | #ifndef CONFIG_USB_SAFE_PADDED | 77 | #ifndef CONFIG_USB_SAFE_PADDED |
diff --git a/drivers/usb/serial/sierra.c b/drivers/usb/serial/sierra.c new file mode 100644 index 000000000000..d29638daa987 --- /dev/null +++ b/drivers/usb/serial/sierra.c | |||
@@ -0,0 +1,75 @@ | |||
1 | /* | ||
2 | * Sierra Wireless CDMA Wireless Serial USB driver | ||
3 | * | ||
4 | * Current Copy modified by: Kevin Lloyd <linux@sierrawireless.com> | ||
5 | * Original Copyright (C) 2005-2006 Greg Kroah-Hartman <gregkh@suse.de> | ||
6 | * | ||
7 | * This program is free software; you can redistribute it and/or | ||
8 | * modify it under the terms of the GNU General Public License version | ||
9 | * 2 as published by the Free Software Foundation. | ||
10 | */ | ||
11 | |||
12 | #include <linux/kernel.h> | ||
13 | #include <linux/init.h> | ||
14 | #include <linux/tty.h> | ||
15 | #include <linux/module.h> | ||
16 | #include <linux/usb.h> | ||
17 | #include <linux/usb/serial.h> | ||
18 | |||
19 | static struct usb_device_id id_table [] = { | ||
20 | { USB_DEVICE(0x1199, 0x0018) }, /* Sierra Wireless MC5720 */ | ||
21 | { USB_DEVICE(0x1199, 0x0020) }, /* Sierra Wireless MC5725 */ | ||
22 | { USB_DEVICE(0x1199, 0x0017) }, /* Sierra Wireless EM5625 */ | ||
23 | { USB_DEVICE(0x1199, 0x0019) }, /* Sierra Wireless AirCard 595 */ | ||
24 | { USB_DEVICE(0x1199, 0x6802) }, /* Sierra Wireless MC8755 */ | ||
25 | { USB_DEVICE(0x1199, 0x6803) }, /* Sierra Wireless MC8765 */ | ||
26 | { USB_DEVICE(0x1199, 0x6812) }, /* Sierra Wireless MC8775 */ | ||
27 | { USB_DEVICE(0x1199, 0x6820) }, /* Sierra Wireless AirCard 875 */ | ||
28 | /* Following devices are supported in the airprime.c driver */ | ||
29 | /* { USB_DEVICE(0x1199, 0x0112) }, */ /* Sierra Wireless AirCard 580 */ | ||
30 | /* { USB_DEVICE(0x0F3D, 0x0112) }, */ /* AirPrime/Sierra PC 5220 */ | ||
31 | { } | ||
32 | }; | ||
33 | MODULE_DEVICE_TABLE(usb, id_table); | ||
34 | |||
35 | static struct usb_driver sierra_driver = { | ||
36 | .name = "sierra_wireless", | ||
37 | .probe = usb_serial_probe, | ||
38 | .disconnect = usb_serial_disconnect, | ||
39 | .id_table = id_table, | ||
40 | }; | ||
41 | |||
42 | static struct usb_serial_driver sierra_device = { | ||
43 | .driver = { | ||
44 | .owner = THIS_MODULE, | ||
45 | .name = "Sierra_Wireless", | ||
46 | }, | ||
47 | .id_table = id_table, | ||
48 | .num_interrupt_in = NUM_DONT_CARE, | ||
49 | .num_bulk_in = NUM_DONT_CARE, | ||
50 | .num_bulk_out = NUM_DONT_CARE, | ||
51 | .num_ports = 3, | ||
52 | }; | ||
53 | |||
54 | static int __init sierra_init(void) | ||
55 | { | ||
56 | int retval; | ||
57 | |||
58 | retval = usb_serial_register(&sierra_device); | ||
59 | if (retval) | ||
60 | return retval; | ||
61 | retval = usb_register(&sierra_driver); | ||
62 | if (retval) | ||
63 | usb_serial_deregister(&sierra_device); | ||
64 | return retval; | ||
65 | } | ||
66 | |||
67 | static void __exit sierra_exit(void) | ||
68 | { | ||
69 | usb_deregister(&sierra_driver); | ||
70 | usb_serial_deregister(&sierra_device); | ||
71 | } | ||
72 | |||
73 | module_init(sierra_init); | ||
74 | module_exit(sierra_exit); | ||
75 | MODULE_LICENSE("GPL"); | ||
diff --git a/drivers/usb/serial/ti_usb_3410_5052.c b/drivers/usb/serial/ti_usb_3410_5052.c index a9afff31a921..ac9b8ee52d44 100644 --- a/drivers/usb/serial/ti_usb_3410_5052.c +++ b/drivers/usb/serial/ti_usb_3410_5052.c | |||
@@ -83,8 +83,8 @@ | |||
83 | #include <asm/uaccess.h> | 83 | #include <asm/uaccess.h> |
84 | #include <asm/semaphore.h> | 84 | #include <asm/semaphore.h> |
85 | #include <linux/usb.h> | 85 | #include <linux/usb.h> |
86 | #include <linux/usb/serial.h> | ||
86 | 87 | ||
87 | #include "usb-serial.h" | ||
88 | #include "ti_usb_3410_5052.h" | 88 | #include "ti_usb_3410_5052.h" |
89 | #include "ti_fw_3410.h" /* firmware image for 3410 */ | 89 | #include "ti_fw_3410.h" /* firmware image for 3410 */ |
90 | #include "ti_fw_5052.h" /* firmware image for 5052 */ | 90 | #include "ti_fw_5052.h" /* firmware image for 5052 */ |
diff --git a/drivers/usb/serial/usb-serial.c b/drivers/usb/serial/usb-serial.c index b59a0536ea5c..12c1694d322e 100644 --- a/drivers/usb/serial/usb-serial.c +++ b/drivers/usb/serial/usb-serial.c | |||
@@ -31,7 +31,7 @@ | |||
31 | #include <linux/smp_lock.h> | 31 | #include <linux/smp_lock.h> |
32 | #include <asm/uaccess.h> | 32 | #include <asm/uaccess.h> |
33 | #include <linux/usb.h> | 33 | #include <linux/usb.h> |
34 | #include "usb-serial.h" | 34 | #include <linux/usb/serial.h> |
35 | #include "pl2303.h" | 35 | #include "pl2303.h" |
36 | 36 | ||
37 | /* | 37 | /* |
@@ -40,6 +40,8 @@ | |||
40 | #define DRIVER_AUTHOR "Greg Kroah-Hartman, greg@kroah.com, http://www.kroah.com/linux/" | 40 | #define DRIVER_AUTHOR "Greg Kroah-Hartman, greg@kroah.com, http://www.kroah.com/linux/" |
41 | #define DRIVER_DESC "USB Serial Driver core" | 41 | #define DRIVER_DESC "USB Serial Driver core" |
42 | 42 | ||
43 | static void port_free(struct usb_serial_port *port); | ||
44 | |||
43 | /* Driver structure we register with the USB core */ | 45 | /* Driver structure we register with the USB core */ |
44 | static struct usb_driver usb_serial_driver = { | 46 | static struct usb_driver usb_serial_driver = { |
45 | .name = "usbserial", | 47 | .name = "usbserial", |
@@ -146,23 +148,10 @@ static void destroy_serial(struct kref *kref) | |||
146 | port = serial->port[i]; | 148 | port = serial->port[i]; |
147 | if (!port) | 149 | if (!port) |
148 | continue; | 150 | continue; |
149 | usb_kill_urb(port->read_urb); | 151 | port_free(port); |
150 | usb_free_urb(port->read_urb); | ||
151 | usb_kill_urb(port->write_urb); | ||
152 | usb_free_urb(port->write_urb); | ||
153 | usb_kill_urb(port->interrupt_in_urb); | ||
154 | usb_free_urb(port->interrupt_in_urb); | ||
155 | usb_kill_urb(port->interrupt_out_urb); | ||
156 | usb_free_urb(port->interrupt_out_urb); | ||
157 | kfree(port->bulk_in_buffer); | ||
158 | kfree(port->bulk_out_buffer); | ||
159 | kfree(port->interrupt_in_buffer); | ||
160 | kfree(port->interrupt_out_buffer); | ||
161 | } | 152 | } |
162 | } | 153 | } |
163 | 154 | ||
164 | flush_scheduled_work(); /* port->work */ | ||
165 | |||
166 | usb_put_dev(serial->dev); | 155 | usb_put_dev(serial->dev); |
167 | 156 | ||
168 | /* free up any memory that we allocated */ | 157 | /* free up any memory that we allocated */ |
@@ -564,6 +553,11 @@ static void port_release(struct device *dev) | |||
564 | struct usb_serial_port *port = to_usb_serial_port(dev); | 553 | struct usb_serial_port *port = to_usb_serial_port(dev); |
565 | 554 | ||
566 | dbg ("%s - %s", __FUNCTION__, dev->bus_id); | 555 | dbg ("%s - %s", __FUNCTION__, dev->bus_id); |
556 | port_free(port); | ||
557 | } | ||
558 | |||
559 | static void port_free(struct usb_serial_port *port) | ||
560 | { | ||
567 | usb_kill_urb(port->read_urb); | 561 | usb_kill_urb(port->read_urb); |
568 | usb_free_urb(port->read_urb); | 562 | usb_free_urb(port->read_urb); |
569 | usb_kill_urb(port->write_urb); | 563 | usb_kill_urb(port->write_urb); |
@@ -576,6 +570,7 @@ static void port_release(struct device *dev) | |||
576 | kfree(port->bulk_out_buffer); | 570 | kfree(port->bulk_out_buffer); |
577 | kfree(port->interrupt_in_buffer); | 571 | kfree(port->interrupt_in_buffer); |
578 | kfree(port->interrupt_out_buffer); | 572 | kfree(port->interrupt_out_buffer); |
573 | flush_scheduled_work(); /* port->work */ | ||
579 | kfree(port); | 574 | kfree(port); |
580 | } | 575 | } |
581 | 576 | ||
diff --git a/drivers/usb/serial/usb-serial.h b/drivers/usb/serial/usb-serial.h deleted file mode 100644 index 0f2802a60194..000000000000 --- a/drivers/usb/serial/usb-serial.h +++ /dev/null | |||
@@ -1,300 +0,0 @@ | |||
1 | /* | ||
2 | * USB Serial Converter driver | ||
3 | * | ||
4 | * Copyright (C) 1999 - 2005 | ||
5 | * Greg Kroah-Hartman (greg@kroah.com) | ||
6 | * | ||
7 | * This program is free software; you can redistribute it and/or modify | ||
8 | * it under the terms of the GNU General Public License as published by | ||
9 | * the Free Software Foundation; either version 2 of the License. | ||
10 | * | ||
11 | */ | ||
12 | |||
13 | |||
14 | #ifndef __LINUX_USB_SERIAL_H | ||
15 | #define __LINUX_USB_SERIAL_H | ||
16 | |||
17 | #include <linux/kref.h> | ||
18 | #include <linux/mutex.h> | ||
19 | |||
20 | #define SERIAL_TTY_MAJOR 188 /* Nice legal number now */ | ||
21 | #define SERIAL_TTY_MINORS 255 /* loads of devices :) */ | ||
22 | |||
23 | #define MAX_NUM_PORTS 8 /* The maximum number of ports one device can grab at once */ | ||
24 | |||
25 | /* parity check flag */ | ||
26 | #define RELEVANT_IFLAG(iflag) (iflag & (IGNBRK|BRKINT|IGNPAR|PARMRK|INPCK)) | ||
27 | |||
28 | /** | ||
29 | * usb_serial_port: structure for the specific ports of a device. | ||
30 | * @serial: pointer back to the struct usb_serial owner of this port. | ||
31 | * @tty: pointer to the corresponding tty for this port. | ||
32 | * @lock: spinlock to grab when updating portions of this structure. | ||
33 | * @mutex: mutex used to synchronize serial_open() and serial_close() | ||
34 | * access for this port. | ||
35 | * @number: the number of the port (the minor number). | ||
36 | * @interrupt_in_buffer: pointer to the interrupt in buffer for this port. | ||
37 | * @interrupt_in_urb: pointer to the interrupt in struct urb for this port. | ||
38 | * @interrupt_in_endpointAddress: endpoint address for the interrupt in pipe | ||
39 | * for this port. | ||
40 | * @interrupt_out_buffer: pointer to the interrupt out buffer for this port. | ||
41 | * @interrupt_out_size: the size of the interrupt_out_buffer, in bytes. | ||
42 | * @interrupt_out_urb: pointer to the interrupt out struct urb for this port. | ||
43 | * @interrupt_out_endpointAddress: endpoint address for the interrupt out pipe | ||
44 | * for this port. | ||
45 | * @bulk_in_buffer: pointer to the bulk in buffer for this port. | ||
46 | * @read_urb: pointer to the bulk in struct urb for this port. | ||
47 | * @bulk_in_endpointAddress: endpoint address for the bulk in pipe for this | ||
48 | * port. | ||
49 | * @bulk_out_buffer: pointer to the bulk out buffer for this port. | ||
50 | * @bulk_out_size: the size of the bulk_out_buffer, in bytes. | ||
51 | * @write_urb: pointer to the bulk out struct urb for this port. | ||
52 | * @bulk_out_endpointAddress: endpoint address for the bulk out pipe for this | ||
53 | * port. | ||
54 | * @write_wait: a wait_queue_head_t used by the port. | ||
55 | * @work: work queue entry for the line discipline waking up. | ||
56 | * @open_count: number of times this port has been opened. | ||
57 | * | ||
58 | * This structure is used by the usb-serial core and drivers for the specific | ||
59 | * ports of a device. | ||
60 | */ | ||
61 | struct usb_serial_port { | ||
62 | struct usb_serial * serial; | ||
63 | struct tty_struct * tty; | ||
64 | spinlock_t lock; | ||
65 | struct mutex mutex; | ||
66 | unsigned char number; | ||
67 | |||
68 | unsigned char * interrupt_in_buffer; | ||
69 | struct urb * interrupt_in_urb; | ||
70 | __u8 interrupt_in_endpointAddress; | ||
71 | |||
72 | unsigned char * interrupt_out_buffer; | ||
73 | int interrupt_out_size; | ||
74 | struct urb * interrupt_out_urb; | ||
75 | __u8 interrupt_out_endpointAddress; | ||
76 | |||
77 | unsigned char * bulk_in_buffer; | ||
78 | int bulk_in_size; | ||
79 | struct urb * read_urb; | ||
80 | __u8 bulk_in_endpointAddress; | ||
81 | |||
82 | unsigned char * bulk_out_buffer; | ||
83 | int bulk_out_size; | ||
84 | struct urb * write_urb; | ||
85 | int write_urb_busy; | ||
86 | __u8 bulk_out_endpointAddress; | ||
87 | |||
88 | wait_queue_head_t write_wait; | ||
89 | struct work_struct work; | ||
90 | int open_count; | ||
91 | struct device dev; | ||
92 | }; | ||
93 | #define to_usb_serial_port(d) container_of(d, struct usb_serial_port, dev) | ||
94 | |||
95 | /* get and set the port private data pointer helper functions */ | ||
96 | static inline void *usb_get_serial_port_data (struct usb_serial_port *port) | ||
97 | { | ||
98 | return dev_get_drvdata(&port->dev); | ||
99 | } | ||
100 | |||
101 | static inline void usb_set_serial_port_data (struct usb_serial_port *port, void *data) | ||
102 | { | ||
103 | dev_set_drvdata(&port->dev, data); | ||
104 | } | ||
105 | |||
106 | /** | ||
107 | * usb_serial - structure used by the usb-serial core for a device | ||
108 | * @dev: pointer to the struct usb_device for this device | ||
109 | * @type: pointer to the struct usb_serial_driver for this device | ||
110 | * @interface: pointer to the struct usb_interface for this device | ||
111 | * @minor: the starting minor number for this device | ||
112 | * @num_ports: the number of ports this device has | ||
113 | * @num_interrupt_in: number of interrupt in endpoints we have | ||
114 | * @num_interrupt_out: number of interrupt out endpoints we have | ||
115 | * @num_bulk_in: number of bulk in endpoints we have | ||
116 | * @num_bulk_out: number of bulk out endpoints we have | ||
117 | * @port: array of struct usb_serial_port structures for the different ports. | ||
118 | * @private: place to put any driver specific information that is needed. The | ||
119 | * usb-serial driver is required to manage this data, the usb-serial core | ||
120 | * will not touch this. Use usb_get_serial_data() and | ||
121 | * usb_set_serial_data() to access this. | ||
122 | */ | ||
123 | struct usb_serial { | ||
124 | struct usb_device * dev; | ||
125 | struct usb_serial_driver * type; | ||
126 | struct usb_interface * interface; | ||
127 | unsigned char minor; | ||
128 | unsigned char num_ports; | ||
129 | unsigned char num_port_pointers; | ||
130 | char num_interrupt_in; | ||
131 | char num_interrupt_out; | ||
132 | char num_bulk_in; | ||
133 | char num_bulk_out; | ||
134 | struct usb_serial_port * port[MAX_NUM_PORTS]; | ||
135 | struct kref kref; | ||
136 | void * private; | ||
137 | }; | ||
138 | #define to_usb_serial(d) container_of(d, struct usb_serial, kref) | ||
139 | |||
140 | #define NUM_DONT_CARE (-1) | ||
141 | |||
142 | /* get and set the serial private data pointer helper functions */ | ||
143 | static inline void *usb_get_serial_data (struct usb_serial *serial) | ||
144 | { | ||
145 | return serial->private; | ||
146 | } | ||
147 | |||
148 | static inline void usb_set_serial_data (struct usb_serial *serial, void *data) | ||
149 | { | ||
150 | serial->private = data; | ||
151 | } | ||
152 | |||
153 | /** | ||
154 | * usb_serial_driver - describes a usb serial driver | ||
155 | * @description: pointer to a string that describes this driver. This string used | ||
156 | * in the syslog messages when a device is inserted or removed. | ||
157 | * @id_table: pointer to a list of usb_device_id structures that define all | ||
158 | * of the devices this structure can support. | ||
159 | * @num_interrupt_in: the number of interrupt in endpoints this device will | ||
160 | * have. | ||
161 | * @num_interrupt_out: the number of interrupt out endpoints this device will | ||
162 | * have. | ||
163 | * @num_bulk_in: the number of bulk in endpoints this device will have. | ||
164 | * @num_bulk_out: the number of bulk out endpoints this device will have. | ||
165 | * @num_ports: the number of different ports this device will have. | ||
166 | * @calc_num_ports: pointer to a function to determine how many ports this | ||
167 | * device has dynamically. It will be called after the probe() | ||
168 | * callback is called, but before attach() | ||
169 | * @probe: pointer to the driver's probe function. | ||
170 | * This will be called when the device is inserted into the system, | ||
171 | * but before the device has been fully initialized by the usb_serial | ||
172 | * subsystem. Use this function to download any firmware to the device, | ||
173 | * or any other early initialization that might be needed. | ||
174 | * Return 0 to continue on with the initialization sequence. Anything | ||
175 | * else will abort it. | ||
176 | * @attach: pointer to the driver's attach function. | ||
177 | * This will be called when the struct usb_serial structure is fully set | ||
178 | * set up. Do any local initialization of the device, or any private | ||
179 | * memory structure allocation at this point in time. | ||
180 | * @shutdown: pointer to the driver's shutdown function. This will be | ||
181 | * called when the device is removed from the system. | ||
182 | * | ||
183 | * This structure is defines a USB Serial driver. It provides all of | ||
184 | * the information that the USB serial core code needs. If the function | ||
185 | * pointers are defined, then the USB serial core code will call them when | ||
186 | * the corresponding tty port functions are called. If they are not | ||
187 | * called, the generic serial function will be used instead. | ||
188 | * | ||
189 | * The driver.owner field should be set to the module owner of this driver. | ||
190 | * The driver.name field should be set to the name of this driver (remember | ||
191 | * it will show up in sysfs, so it needs to be short and to the point. | ||
192 | * Useing the module name is a good idea.) | ||
193 | */ | ||
194 | struct usb_serial_driver { | ||
195 | const char *description; | ||
196 | const struct usb_device_id *id_table; | ||
197 | char num_interrupt_in; | ||
198 | char num_interrupt_out; | ||
199 | char num_bulk_in; | ||
200 | char num_bulk_out; | ||
201 | char num_ports; | ||
202 | |||
203 | struct list_head driver_list; | ||
204 | struct device_driver driver; | ||
205 | |||
206 | int (*probe) (struct usb_serial *serial, const struct usb_device_id *id); | ||
207 | int (*attach) (struct usb_serial *serial); | ||
208 | int (*calc_num_ports) (struct usb_serial *serial); | ||
209 | |||
210 | void (*shutdown) (struct usb_serial *serial); | ||
211 | |||
212 | int (*port_probe) (struct usb_serial_port *port); | ||
213 | int (*port_remove) (struct usb_serial_port *port); | ||
214 | |||
215 | /* serial function calls */ | ||
216 | int (*open) (struct usb_serial_port *port, struct file * filp); | ||
217 | void (*close) (struct usb_serial_port *port, struct file * filp); | ||
218 | int (*write) (struct usb_serial_port *port, const unsigned char *buf, int count); | ||
219 | int (*write_room) (struct usb_serial_port *port); | ||
220 | int (*ioctl) (struct usb_serial_port *port, struct file * file, unsigned int cmd, unsigned long arg); | ||
221 | void (*set_termios) (struct usb_serial_port *port, struct termios * old); | ||
222 | void (*break_ctl) (struct usb_serial_port *port, int break_state); | ||
223 | int (*chars_in_buffer) (struct usb_serial_port *port); | ||
224 | void (*throttle) (struct usb_serial_port *port); | ||
225 | void (*unthrottle) (struct usb_serial_port *port); | ||
226 | int (*tiocmget) (struct usb_serial_port *port, struct file *file); | ||
227 | int (*tiocmset) (struct usb_serial_port *port, struct file *file, unsigned int set, unsigned int clear); | ||
228 | |||
229 | void (*read_int_callback)(struct urb *urb, struct pt_regs *regs); | ||
230 | void (*write_int_callback)(struct urb *urb, struct pt_regs *regs); | ||
231 | void (*read_bulk_callback)(struct urb *urb, struct pt_regs *regs); | ||
232 | void (*write_bulk_callback)(struct urb *urb, struct pt_regs *regs); | ||
233 | }; | ||
234 | #define to_usb_serial_driver(d) container_of(d, struct usb_serial_driver, driver) | ||
235 | |||
236 | extern int usb_serial_register(struct usb_serial_driver *driver); | ||
237 | extern void usb_serial_deregister(struct usb_serial_driver *driver); | ||
238 | extern void usb_serial_port_softint(struct usb_serial_port *port); | ||
239 | |||
240 | extern int usb_serial_probe(struct usb_interface *iface, const struct usb_device_id *id); | ||
241 | extern void usb_serial_disconnect(struct usb_interface *iface); | ||
242 | |||
243 | extern int ezusb_writememory (struct usb_serial *serial, int address, unsigned char *data, int length, __u8 bRequest); | ||
244 | extern int ezusb_set_reset (struct usb_serial *serial, unsigned char reset_bit); | ||
245 | |||
246 | /* USB Serial console functions */ | ||
247 | #ifdef CONFIG_USB_SERIAL_CONSOLE | ||
248 | extern void usb_serial_console_init (int debug, int minor); | ||
249 | extern void usb_serial_console_exit (void); | ||
250 | extern void usb_serial_console_disconnect(struct usb_serial *serial); | ||
251 | #else | ||
252 | static inline void usb_serial_console_init (int debug, int minor) { } | ||
253 | static inline void usb_serial_console_exit (void) { } | ||
254 | static inline void usb_serial_console_disconnect(struct usb_serial *serial) {} | ||
255 | #endif | ||
256 | |||
257 | /* Functions needed by other parts of the usbserial core */ | ||
258 | extern struct usb_serial *usb_serial_get_by_index (unsigned int minor); | ||
259 | extern void usb_serial_put(struct usb_serial *serial); | ||
260 | extern int usb_serial_generic_open (struct usb_serial_port *port, struct file *filp); | ||
261 | extern int usb_serial_generic_write (struct usb_serial_port *port, const unsigned char *buf, int count); | ||
262 | extern void usb_serial_generic_close (struct usb_serial_port *port, struct file *filp); | ||
263 | extern int usb_serial_generic_write_room (struct usb_serial_port *port); | ||
264 | extern int usb_serial_generic_chars_in_buffer (struct usb_serial_port *port); | ||
265 | extern void usb_serial_generic_read_bulk_callback (struct urb *urb, struct pt_regs *regs); | ||
266 | extern void usb_serial_generic_write_bulk_callback (struct urb *urb, struct pt_regs *regs); | ||
267 | extern void usb_serial_generic_shutdown (struct usb_serial *serial); | ||
268 | extern int usb_serial_generic_register (int debug); | ||
269 | extern void usb_serial_generic_deregister (void); | ||
270 | |||
271 | extern int usb_serial_bus_register (struct usb_serial_driver *device); | ||
272 | extern void usb_serial_bus_deregister (struct usb_serial_driver *device); | ||
273 | |||
274 | extern struct usb_serial_driver usb_serial_generic_device; | ||
275 | extern struct bus_type usb_serial_bus_type; | ||
276 | extern struct tty_driver *usb_serial_tty_driver; | ||
277 | |||
278 | static inline void usb_serial_debug_data(int debug, | ||
279 | struct device *dev, | ||
280 | const char *function, int size, | ||
281 | const unsigned char *data) | ||
282 | { | ||
283 | int i; | ||
284 | |||
285 | if (debug) { | ||
286 | dev_printk(KERN_DEBUG, dev, "%s - length = %d, data = ", function, size); | ||
287 | for (i = 0; i < size; ++i) | ||
288 | printk ("%.2x ", data[i]); | ||
289 | printk ("\n"); | ||
290 | } | ||
291 | } | ||
292 | |||
293 | /* Use our own dbg macro */ | ||
294 | #undef dbg | ||
295 | #define dbg(format, arg...) do { if (debug) printk(KERN_DEBUG "%s: " format "\n" , __FILE__ , ## arg); } while (0) | ||
296 | |||
297 | |||
298 | |||
299 | #endif /* ifdef __LINUX_USB_SERIAL_H */ | ||
300 | |||
diff --git a/drivers/usb/serial/visor.c b/drivers/usb/serial/visor.c index 95a2936e902e..88949f7884ca 100644 --- a/drivers/usb/serial/visor.c +++ b/drivers/usb/serial/visor.c | |||
@@ -25,7 +25,7 @@ | |||
25 | #include <linux/spinlock.h> | 25 | #include <linux/spinlock.h> |
26 | #include <asm/uaccess.h> | 26 | #include <asm/uaccess.h> |
27 | #include <linux/usb.h> | 27 | #include <linux/usb.h> |
28 | #include "usb-serial.h" | 28 | #include <linux/usb/serial.h> |
29 | #include "visor.h" | 29 | #include "visor.h" |
30 | 30 | ||
31 | /* | 31 | /* |
@@ -302,7 +302,6 @@ static int visor_open (struct usb_serial_port *port, struct file *filp) | |||
302 | spin_lock_irqsave(&priv->lock, flags); | 302 | spin_lock_irqsave(&priv->lock, flags); |
303 | priv->bytes_in = 0; | 303 | priv->bytes_in = 0; |
304 | priv->bytes_out = 0; | 304 | priv->bytes_out = 0; |
305 | priv->outstanding_urbs = 0; | ||
306 | priv->throttled = 0; | 305 | priv->throttled = 0; |
307 | spin_unlock_irqrestore(&priv->lock, flags); | 306 | spin_unlock_irqrestore(&priv->lock, flags); |
308 | 307 | ||
@@ -435,13 +434,25 @@ static int visor_write (struct usb_serial_port *port, const unsigned char *buf, | |||
435 | 434 | ||
436 | static int visor_write_room (struct usb_serial_port *port) | 435 | static int visor_write_room (struct usb_serial_port *port) |
437 | { | 436 | { |
437 | struct visor_private *priv = usb_get_serial_port_data(port); | ||
438 | unsigned long flags; | ||
439 | |||
438 | dbg("%s - port %d", __FUNCTION__, port->number); | 440 | dbg("%s - port %d", __FUNCTION__, port->number); |
439 | 441 | ||
440 | /* | 442 | /* |
441 | * We really can take anything the user throws at us | 443 | * We really can take anything the user throws at us |
442 | * but let's pick a nice big number to tell the tty | 444 | * but let's pick a nice big number to tell the tty |
443 | * layer that we have lots of free space | 445 | * layer that we have lots of free space, unless we don't. |
444 | */ | 446 | */ |
447 | |||
448 | spin_lock_irqsave(&priv->lock, flags); | ||
449 | if (priv->outstanding_urbs > URB_UPPER_LIMIT * 2 / 3) { | ||
450 | spin_unlock_irqrestore(&priv->lock, flags); | ||
451 | dbg("%s - write limit hit\n", __FUNCTION__); | ||
452 | return 0; | ||
453 | } | ||
454 | spin_unlock_irqrestore(&priv->lock, flags); | ||
455 | |||
445 | return 2048; | 456 | return 2048; |
446 | } | 457 | } |
447 | 458 | ||
@@ -758,15 +769,22 @@ static int visor_calc_num_ports (struct usb_serial *serial) | |||
758 | 769 | ||
759 | static int generic_startup(struct usb_serial *serial) | 770 | static int generic_startup(struct usb_serial *serial) |
760 | { | 771 | { |
772 | struct usb_serial_port **ports = serial->port; | ||
761 | struct visor_private *priv; | 773 | struct visor_private *priv; |
762 | int i; | 774 | int i; |
763 | 775 | ||
764 | for (i = 0; i < serial->num_ports; ++i) { | 776 | for (i = 0; i < serial->num_ports; ++i) { |
765 | priv = kzalloc (sizeof(*priv), GFP_KERNEL); | 777 | priv = kzalloc (sizeof(*priv), GFP_KERNEL); |
766 | if (!priv) | 778 | if (!priv) { |
779 | while (i-- != 0) { | ||
780 | priv = usb_get_serial_port_data(ports[i]); | ||
781 | usb_set_serial_port_data(ports[i], NULL); | ||
782 | kfree(priv); | ||
783 | } | ||
767 | return -ENOMEM; | 784 | return -ENOMEM; |
785 | } | ||
768 | spin_lock_init(&priv->lock); | 786 | spin_lock_init(&priv->lock); |
769 | usb_set_serial_port_data(serial->port[i], priv); | 787 | usb_set_serial_port_data(ports[i], priv); |
770 | } | 788 | } |
771 | return 0; | 789 | return 0; |
772 | } | 790 | } |
@@ -876,7 +894,18 @@ static int clie_5_attach (struct usb_serial *serial) | |||
876 | 894 | ||
877 | static void visor_shutdown (struct usb_serial *serial) | 895 | static void visor_shutdown (struct usb_serial *serial) |
878 | { | 896 | { |
897 | struct visor_private *priv; | ||
898 | int i; | ||
899 | |||
879 | dbg("%s", __FUNCTION__); | 900 | dbg("%s", __FUNCTION__); |
901 | |||
902 | for (i = 0; i < serial->num_ports; i++) { | ||
903 | priv = usb_get_serial_port_data(serial->port[i]); | ||
904 | if (priv) { | ||
905 | usb_set_serial_port_data(serial->port[i], NULL); | ||
906 | kfree(priv); | ||
907 | } | ||
908 | } | ||
880 | } | 909 | } |
881 | 910 | ||
882 | static int visor_ioctl (struct usb_serial_port *port, struct file * file, unsigned int cmd, unsigned long arg) | 911 | static int visor_ioctl (struct usb_serial_port *port, struct file * file, unsigned int cmd, unsigned long arg) |
diff --git a/drivers/usb/serial/whiteheat.c b/drivers/usb/serial/whiteheat.c index 540438c3f381..6e6c7934be32 100644 --- a/drivers/usb/serial/whiteheat.c +++ b/drivers/usb/serial/whiteheat.c | |||
@@ -79,7 +79,7 @@ | |||
79 | #include <linux/usb.h> | 79 | #include <linux/usb.h> |
80 | #include <linux/serial_reg.h> | 80 | #include <linux/serial_reg.h> |
81 | #include <linux/serial.h> | 81 | #include <linux/serial.h> |
82 | #include "usb-serial.h" | 82 | #include <linux/usb/serial.h> |
83 | #include "whiteheat_fw.h" /* firmware for the ConnectTech WhiteHEAT device */ | 83 | #include "whiteheat_fw.h" /* firmware for the ConnectTech WhiteHEAT device */ |
84 | #include "whiteheat.h" /* WhiteHEAT specific commands */ | 84 | #include "whiteheat.h" /* WhiteHEAT specific commands */ |
85 | 85 | ||
diff --git a/drivers/usb/storage/scsiglue.c b/drivers/usb/storage/scsiglue.c index 5715291ba540..a4b7df9ff8c1 100644 --- a/drivers/usb/storage/scsiglue.c +++ b/drivers/usb/storage/scsiglue.c | |||
@@ -112,13 +112,11 @@ static int slave_configure(struct scsi_device *sdev) | |||
112 | if (sdev->scsi_level < SCSI_2) | 112 | if (sdev->scsi_level < SCSI_2) |
113 | sdev->scsi_level = sdev->sdev_target->scsi_level = SCSI_2; | 113 | sdev->scsi_level = sdev->sdev_target->scsi_level = SCSI_2; |
114 | 114 | ||
115 | /* According to the technical support people at Genesys Logic, | 115 | /* Many devices have trouble transfering more than 32KB at a time, |
116 | * devices using their chips have problems transferring more than | 116 | * while others have trouble with more than 64K. At this time we |
117 | * 32 KB at a time. In practice people have found that 64 KB | 117 | * are limiting both to 32K (64 sectores). |
118 | * works okay and that's what Windows does. But we'll be | 118 | */ |
119 | * conservative; people can always use the sysfs interface to | 119 | if ((us->flags & US_FL_MAX_SECTORS_64) && |
120 | * increase max_sectors. */ | ||
121 | if (le16_to_cpu(us->pusb_dev->descriptor.idVendor) == USB_VENDOR_ID_GENESYS && | ||
122 | sdev->request_queue->max_sectors > 64) | 120 | sdev->request_queue->max_sectors > 64) |
123 | blk_queue_max_sectors(sdev->request_queue, 64); | 121 | blk_queue_max_sectors(sdev->request_queue, 64); |
124 | 122 | ||
diff --git a/drivers/usb/storage/transport.c b/drivers/usb/storage/transport.c index eb7188b3565c..d6acc92a4ae3 100644 --- a/drivers/usb/storage/transport.c +++ b/drivers/usb/storage/transport.c | |||
@@ -180,7 +180,7 @@ static int usb_stor_msg_common(struct us_data *us, int timeout) | |||
180 | if (timeleft <= 0) { | 180 | if (timeleft <= 0) { |
181 | US_DEBUGP("%s -- cancelling URB\n", | 181 | US_DEBUGP("%s -- cancelling URB\n", |
182 | timeleft == 0 ? "Timeout" : "Signal"); | 182 | timeleft == 0 ? "Timeout" : "Signal"); |
183 | usb_unlink_urb(us->current_urb); | 183 | usb_kill_urb(us->current_urb); |
184 | } | 184 | } |
185 | 185 | ||
186 | /* return the URB status */ | 186 | /* return the URB status */ |
diff --git a/drivers/usb/storage/unusual_devs.h b/drivers/usb/storage/unusual_devs.h index c7e84e653df9..a5ca449f6e64 100644 --- a/drivers/usb/storage/unusual_devs.h +++ b/drivers/usb/storage/unusual_devs.h | |||
@@ -112,6 +112,19 @@ UNUSUAL_DEV( 0x0411, 0x001c, 0x0113, 0x0113, | |||
112 | US_SC_DEVICE, US_PR_DEVICE, NULL, | 112 | US_SC_DEVICE, US_PR_DEVICE, NULL, |
113 | US_FL_FIX_INQUIRY ), | 113 | US_FL_FIX_INQUIRY ), |
114 | 114 | ||
115 | /* Submitted by Ernestas Vaiciukevicius <ernisv@gmail.com> */ | ||
116 | UNUSUAL_DEV( 0x0419, 0x0100, 0x0100, 0x0100, | ||
117 | "Samsung Info. Systems America, Inc.", | ||
118 | "MP3 Player", | ||
119 | US_SC_DEVICE, US_PR_DEVICE, NULL, | ||
120 | US_FL_IGNORE_RESIDUE ), | ||
121 | |||
122 | /* Reported by Orgad Shaneh <orgads@gmail.com> */ | ||
123 | UNUSUAL_DEV( 0x0419, 0xaace, 0x0100, 0x0100, | ||
124 | "Samsung", "MP3 Player", | ||
125 | US_SC_DEVICE, US_PR_DEVICE, NULL, | ||
126 | US_FL_IGNORE_RESIDUE ), | ||
127 | |||
115 | /* Reported by Christian Leber <christian@leber.de> */ | 128 | /* Reported by Christian Leber <christian@leber.de> */ |
116 | UNUSUAL_DEV( 0x0419, 0xaaf5, 0x0100, 0x0100, | 129 | UNUSUAL_DEV( 0x0419, 0xaaf5, 0x0100, 0x0100, |
117 | "TrekStor", | 130 | "TrekStor", |
@@ -132,6 +145,14 @@ UNUSUAL_DEV( 0x0420, 0x0001, 0x0100, 0x0100, | |||
132 | US_SC_DEVICE, US_PR_DEVICE, NULL, | 145 | US_SC_DEVICE, US_PR_DEVICE, NULL, |
133 | US_FL_IGNORE_RESIDUE ), | 146 | US_FL_IGNORE_RESIDUE ), |
134 | 147 | ||
148 | /* Reported by Sumedha Swamy <sumedhaswamy@gmail.com> and | ||
149 | * Einar Th. Einarsson <einarthered@gmail.com> */ | ||
150 | UNUSUAL_DEV( 0x0421, 0x0444, 0x0100, 0x0100, | ||
151 | "Nokia", | ||
152 | "N91", | ||
153 | US_SC_DEVICE, US_PR_DEVICE, NULL, | ||
154 | US_FL_IGNORE_RESIDUE | US_FL_FIX_CAPACITY ), | ||
155 | |||
135 | /* Reported by Jiri Slaby <jirislaby@gmail.com> and | 156 | /* Reported by Jiri Slaby <jirislaby@gmail.com> and |
136 | * Rene C. Castberg <Rene@Castberg.org> */ | 157 | * Rene C. Castberg <Rene@Castberg.org> */ |
137 | UNUSUAL_DEV( 0x0421, 0x0446, 0x0100, 0x0100, | 158 | UNUSUAL_DEV( 0x0421, 0x0446, 0x0100, 0x0100, |
@@ -140,6 +161,13 @@ UNUSUAL_DEV( 0x0421, 0x0446, 0x0100, 0x0100, | |||
140 | US_SC_DEVICE, US_PR_DEVICE, NULL, | 161 | US_SC_DEVICE, US_PR_DEVICE, NULL, |
141 | US_FL_IGNORE_RESIDUE | US_FL_FIX_CAPACITY ), | 162 | US_FL_IGNORE_RESIDUE | US_FL_FIX_CAPACITY ), |
142 | 163 | ||
164 | /* Reported by Matthew Bloch <matthew@bytemark.co.uk> */ | ||
165 | UNUSUAL_DEV( 0x0421, 0x044e, 0x0100, 0x0100, | ||
166 | "Nokia", | ||
167 | "E61", | ||
168 | US_SC_DEVICE, US_PR_DEVICE, NULL, | ||
169 | US_FL_IGNORE_RESIDUE | US_FL_FIX_CAPACITY ), | ||
170 | |||
143 | /* Reported by Olaf Hering <olh@suse.de> from novell bug #105878 */ | 171 | /* Reported by Olaf Hering <olh@suse.de> from novell bug #105878 */ |
144 | UNUSUAL_DEV( 0x0424, 0x0fdc, 0x0210, 0x0210, | 172 | UNUSUAL_DEV( 0x0424, 0x0fdc, 0x0210, 0x0210, |
145 | "SMSC", | 173 | "SMSC", |
@@ -473,10 +501,11 @@ UNUSUAL_DEV( 0x054c, 0x0010, 0x0106, 0x0450, | |||
473 | US_SC_SCSI, US_PR_DEVICE, NULL, | 501 | US_SC_SCSI, US_PR_DEVICE, NULL, |
474 | US_FL_SINGLE_LUN | US_FL_NOT_LOCKABLE | US_FL_NO_WP_DETECT ), | 502 | US_FL_SINGLE_LUN | US_FL_NOT_LOCKABLE | US_FL_NO_WP_DETECT ), |
475 | 503 | ||
476 | /* This entry is needed because the device reports Sub=ff */ | 504 | /* Submitted by Lars Jacob <jacob.lars@googlemail.com> |
477 | UNUSUAL_DEV( 0x054c, 0x0010, 0x0500, 0x0600, | 505 | * This entry is needed because the device reports Sub=ff */ |
506 | UNUSUAL_DEV( 0x054c, 0x0010, 0x0500, 0x0610, | ||
478 | "Sony", | 507 | "Sony", |
479 | "DSC-T1/T5", | 508 | "DSC-T1/T5/H5", |
480 | US_SC_8070, US_PR_DEVICE, NULL, | 509 | US_SC_8070, US_PR_DEVICE, NULL, |
481 | US_FL_SINGLE_LUN ), | 510 | US_FL_SINGLE_LUN ), |
482 | 511 | ||
@@ -708,18 +737,22 @@ UNUSUAL_DEV( 0x05dc, 0xb002, 0x0000, 0x0113, | |||
708 | * They were originally reported by Alexander Oltu | 737 | * They were originally reported by Alexander Oltu |
709 | * <alexander@all-2.com> and Peter Marks <peter.marks@turner.com> | 738 | * <alexander@all-2.com> and Peter Marks <peter.marks@turner.com> |
710 | * respectively. | 739 | * respectively. |
740 | * | ||
741 | * US_FL_GO_SLOW and US_FL_MAX_SECTORS_64 added by Phil Dibowitz | ||
742 | * <phil@ipom.com> as these flags were made and hard-coded | ||
743 | * special-cases were pulled from scsiglue.c. | ||
711 | */ | 744 | */ |
712 | UNUSUAL_DEV( 0x05e3, 0x0701, 0x0000, 0xffff, | 745 | UNUSUAL_DEV( 0x05e3, 0x0701, 0x0000, 0xffff, |
713 | "Genesys Logic", | 746 | "Genesys Logic", |
714 | "USB to IDE Optical", | 747 | "USB to IDE Optical", |
715 | US_SC_DEVICE, US_PR_DEVICE, NULL, | 748 | US_SC_DEVICE, US_PR_DEVICE, NULL, |
716 | US_FL_GO_SLOW ), | 749 | US_FL_GO_SLOW | US_FL_MAX_SECTORS_64 ), |
717 | 750 | ||
718 | UNUSUAL_DEV( 0x05e3, 0x0702, 0x0000, 0xffff, | 751 | UNUSUAL_DEV( 0x05e3, 0x0702, 0x0000, 0xffff, |
719 | "Genesys Logic", | 752 | "Genesys Logic", |
720 | "USB to IDE Disk", | 753 | "USB to IDE Disk", |
721 | US_SC_DEVICE, US_PR_DEVICE, NULL, | 754 | US_SC_DEVICE, US_PR_DEVICE, NULL, |
722 | US_FL_GO_SLOW ), | 755 | US_FL_GO_SLOW | US_FL_MAX_SECTORS_64 ), |
723 | 756 | ||
724 | /* Reported by Hanno Boeck <hanno@gmx.de> | 757 | /* Reported by Hanno Boeck <hanno@gmx.de> |
725 | * Taken from the Lycoris Kernel */ | 758 | * Taken from the Lycoris Kernel */ |
@@ -1196,6 +1229,14 @@ UNUSUAL_DEV( 0x0ea0, 0x6828, 0x0110, 0x0110, | |||
1196 | US_SC_DEVICE, US_PR_DEVICE, NULL, | 1229 | US_SC_DEVICE, US_PR_DEVICE, NULL, |
1197 | US_FL_IGNORE_RESIDUE ), | 1230 | US_FL_IGNORE_RESIDUE ), |
1198 | 1231 | ||
1232 | /* Reported by Benjamin Schiller <sbenni@gmx.de> | ||
1233 | * It is also sold by Easylite as DJ 20 */ | ||
1234 | UNUSUAL_DEV( 0x0ed1, 0x7636, 0x0103, 0x0103, | ||
1235 | "Typhoon", | ||
1236 | "My DJ 1820", | ||
1237 | US_SC_DEVICE, US_PR_DEVICE, NULL, | ||
1238 | US_FL_IGNORE_RESIDUE | US_FL_GO_SLOW | US_FL_MAX_SECTORS_64), | ||
1239 | |||
1199 | /* Reported by Michael Stattmann <michael@stattmann.com> */ | 1240 | /* Reported by Michael Stattmann <michael@stattmann.com> */ |
1200 | UNUSUAL_DEV( 0x0fce, 0xd008, 0x0000, 0x0000, | 1241 | UNUSUAL_DEV( 0x0fce, 0xd008, 0x0000, 0x0000, |
1201 | "Sony Ericsson", | 1242 | "Sony Ericsson", |
@@ -1227,6 +1268,15 @@ UNUSUAL_DEV( 0x1370, 0x6828, 0x0110, 0x0110, | |||
1227 | US_SC_DEVICE, US_PR_DEVICE, NULL, | 1268 | US_SC_DEVICE, US_PR_DEVICE, NULL, |
1228 | US_FL_IGNORE_RESIDUE ), | 1269 | US_FL_IGNORE_RESIDUE ), |
1229 | 1270 | ||
1271 | /* patch submitted by Davide Perini <perini.davide@dpsoftware.org> | ||
1272 | * and Renato Perini <rperini@email.it> | ||
1273 | */ | ||
1274 | UNUSUAL_DEV( 0x22b8, 0x3010, 0x0001, 0x0001, | ||
1275 | "Motorola", | ||
1276 | "RAZR V3x", | ||
1277 | US_SC_DEVICE, US_PR_DEVICE, NULL, | ||
1278 | US_FL_FIX_CAPACITY | US_FL_IGNORE_RESIDUE ), | ||
1279 | |||
1230 | /* Reported by Radovan Garabik <garabik@kassiopeia.juls.savba.sk> */ | 1280 | /* Reported by Radovan Garabik <garabik@kassiopeia.juls.savba.sk> */ |
1231 | UNUSUAL_DEV( 0x2735, 0x100b, 0x0000, 0x9999, | 1281 | UNUSUAL_DEV( 0x2735, 0x100b, 0x0000, 0x9999, |
1232 | "MPIO", | 1282 | "MPIO", |
diff --git a/drivers/usb/storage/usb.c b/drivers/usb/storage/usb.c index 1185acac4b21..5ee19be52f65 100644 --- a/drivers/usb/storage/usb.c +++ b/drivers/usb/storage/usb.c | |||
@@ -55,6 +55,7 @@ | |||
55 | #include <linux/slab.h> | 55 | #include <linux/slab.h> |
56 | #include <linux/kthread.h> | 56 | #include <linux/kthread.h> |
57 | #include <linux/mutex.h> | 57 | #include <linux/mutex.h> |
58 | #include <linux/utsrelease.h> | ||
58 | 59 | ||
59 | #include <scsi/scsi.h> | 60 | #include <scsi/scsi.h> |
60 | #include <scsi/scsi_cmnd.h> | 61 | #include <scsi/scsi_cmnd.h> |
@@ -373,8 +374,12 @@ static int usb_stor_control_thread(void * __us) | |||
373 | /* lock access to the state */ | 374 | /* lock access to the state */ |
374 | scsi_lock(host); | 375 | scsi_lock(host); |
375 | 376 | ||
377 | /* did the command already complete because of a disconnect? */ | ||
378 | if (!us->srb) | ||
379 | ; /* nothing to do */ | ||
380 | |||
376 | /* indicate that the command is done */ | 381 | /* indicate that the command is done */ |
377 | if (us->srb->result != DID_ABORT << 16) { | 382 | else if (us->srb->result != DID_ABORT << 16) { |
378 | US_DEBUGP("scsi cmd done, result=0x%x\n", | 383 | US_DEBUGP("scsi cmd done, result=0x%x\n", |
379 | us->srb->result); | 384 | us->srb->result); |
380 | us->srb->scsi_done(us->srb); | 385 | us->srb->scsi_done(us->srb); |
@@ -524,7 +529,8 @@ static void get_device_info(struct us_data *us, const struct usb_device_id *id) | |||
524 | if (msg >= 0 && !(us->flags & US_FL_NEED_OVERRIDE)) | 529 | if (msg >= 0 && !(us->flags & US_FL_NEED_OVERRIDE)) |
525 | printk(KERN_NOTICE USB_STORAGE "This device " | 530 | printk(KERN_NOTICE USB_STORAGE "This device " |
526 | "(%04x,%04x,%04x S %02x P %02x)" | 531 | "(%04x,%04x,%04x S %02x P %02x)" |
527 | " has %s in unusual_devs.h\n" | 532 | " has %s in unusual_devs.h (kernel" |
533 | " %s)\n" | ||
528 | " Please send a copy of this message to " | 534 | " Please send a copy of this message to " |
529 | "<linux-usb-devel@lists.sourceforge.net>\n", | 535 | "<linux-usb-devel@lists.sourceforge.net>\n", |
530 | le16_to_cpu(ddesc->idVendor), | 536 | le16_to_cpu(ddesc->idVendor), |
@@ -532,7 +538,8 @@ static void get_device_info(struct us_data *us, const struct usb_device_id *id) | |||
532 | le16_to_cpu(ddesc->bcdDevice), | 538 | le16_to_cpu(ddesc->bcdDevice), |
533 | idesc->bInterfaceSubClass, | 539 | idesc->bInterfaceSubClass, |
534 | idesc->bInterfaceProtocol, | 540 | idesc->bInterfaceProtocol, |
535 | msgs[msg]); | 541 | msgs[msg], |
542 | UTS_RELEASE); | ||
536 | } | 543 | } |
537 | } | 544 | } |
538 | 545 | ||
@@ -836,32 +843,34 @@ static void dissociate_dev(struct us_data *us) | |||
836 | * the host */ | 843 | * the host */ |
837 | static void quiesce_and_remove_host(struct us_data *us) | 844 | static void quiesce_and_remove_host(struct us_data *us) |
838 | { | 845 | { |
846 | struct Scsi_Host *host = us_to_host(us); | ||
847 | |||
839 | /* Prevent new USB transfers, stop the current command, and | 848 | /* Prevent new USB transfers, stop the current command, and |
840 | * interrupt a SCSI-scan or device-reset delay */ | 849 | * interrupt a SCSI-scan or device-reset delay */ |
850 | scsi_lock(host); | ||
841 | set_bit(US_FLIDX_DISCONNECTING, &us->flags); | 851 | set_bit(US_FLIDX_DISCONNECTING, &us->flags); |
852 | scsi_unlock(host); | ||
842 | usb_stor_stop_transport(us); | 853 | usb_stor_stop_transport(us); |
843 | wake_up(&us->delay_wait); | 854 | wake_up(&us->delay_wait); |
844 | 855 | ||
845 | /* It doesn't matter if the SCSI-scanning thread is still running. | 856 | /* It doesn't matter if the SCSI-scanning thread is still running. |
846 | * The thread will exit when it sees the DISCONNECTING flag. */ | 857 | * The thread will exit when it sees the DISCONNECTING flag. */ |
847 | 858 | ||
848 | /* Wait for the current command to finish, then remove the host */ | ||
849 | mutex_lock(&us->dev_mutex); | ||
850 | mutex_unlock(&us->dev_mutex); | ||
851 | |||
852 | /* queuecommand won't accept any new commands and the control | 859 | /* queuecommand won't accept any new commands and the control |
853 | * thread won't execute a previously-queued command. If there | 860 | * thread won't execute a previously-queued command. If there |
854 | * is such a command pending, complete it with an error. */ | 861 | * is such a command pending, complete it with an error. */ |
862 | mutex_lock(&us->dev_mutex); | ||
855 | if (us->srb) { | 863 | if (us->srb) { |
856 | us->srb->result = DID_NO_CONNECT << 16; | 864 | us->srb->result = DID_NO_CONNECT << 16; |
857 | scsi_lock(us_to_host(us)); | 865 | scsi_lock(host); |
858 | us->srb->scsi_done(us->srb); | 866 | us->srb->scsi_done(us->srb); |
859 | us->srb = NULL; | 867 | us->srb = NULL; |
860 | scsi_unlock(us_to_host(us)); | 868 | scsi_unlock(host); |
861 | } | 869 | } |
870 | mutex_unlock(&us->dev_mutex); | ||
862 | 871 | ||
863 | /* Now we own no commands so it's safe to remove the SCSI host */ | 872 | /* Now we own no commands so it's safe to remove the SCSI host */ |
864 | scsi_remove_host(us_to_host(us)); | 873 | scsi_remove_host(host); |
865 | } | 874 | } |
866 | 875 | ||
867 | /* Second stage of disconnect processing: deallocate all resources */ | 876 | /* Second stage of disconnect processing: deallocate all resources */ |
diff --git a/drivers/usb/storage/usb.h b/drivers/usb/storage/usb.h index 5284abe1b5eb..21f3ddbc9080 100644 --- a/drivers/usb/storage/usb.h +++ b/drivers/usb/storage/usb.h | |||
@@ -176,8 +176,4 @@ extern void fill_inquiry_response(struct us_data *us, | |||
176 | #define scsi_unlock(host) spin_unlock_irq(host->host_lock) | 176 | #define scsi_unlock(host) spin_unlock_irq(host->host_lock) |
177 | #define scsi_lock(host) spin_lock_irq(host->host_lock) | 177 | #define scsi_lock(host) spin_lock_irq(host->host_lock) |
178 | 178 | ||
179 | |||
180 | /* Vendor ID list for devices that require special handling */ | ||
181 | #define USB_VENDOR_ID_GENESYS 0x05e3 /* Genesys Logic */ | ||
182 | |||
183 | #endif | 179 | #endif |
diff --git a/drivers/video/68328fb.c b/drivers/video/68328fb.c index 78488bb41aeb..0dda73da8628 100644 --- a/drivers/video/68328fb.c +++ b/drivers/video/68328fb.c | |||
@@ -32,7 +32,6 @@ | |||
32 | #include <linux/errno.h> | 32 | #include <linux/errno.h> |
33 | #include <linux/string.h> | 33 | #include <linux/string.h> |
34 | #include <linux/mm.h> | 34 | #include <linux/mm.h> |
35 | #include <linux/tty.h> | ||
36 | #include <linux/slab.h> | 35 | #include <linux/slab.h> |
37 | #include <linux/vmalloc.h> | 36 | #include <linux/vmalloc.h> |
38 | #include <linux/delay.h> | 37 | #include <linux/delay.h> |
diff --git a/drivers/video/Kconfig b/drivers/video/Kconfig index 3badb48d662b..6533b0f39231 100644 --- a/drivers/video/Kconfig +++ b/drivers/video/Kconfig | |||
@@ -1518,6 +1518,26 @@ config FB_PXA_PARAMETERS | |||
1518 | 1518 | ||
1519 | <file:Documentation/fb/pxafb.txt> describes the available parameters. | 1519 | <file:Documentation/fb/pxafb.txt> describes the available parameters. |
1520 | 1520 | ||
1521 | config FB_MBX | ||
1522 | tristate "2700G LCD framebuffer support" | ||
1523 | depends on FB && ARCH_PXA | ||
1524 | select FB_CFB_FILLRECT | ||
1525 | select FB_CFB_COPYAREA | ||
1526 | select FB_CFB_IMAGEBLIT | ||
1527 | ---help--- | ||
1528 | Framebuffer driver for the Intel 2700G (Marathon) Graphics | ||
1529 | Accelerator | ||
1530 | |||
1531 | config FB_MBX_DEBUG | ||
1532 | bool "Enable debugging info via debugfs" | ||
1533 | depends on FB_MBX && DEBUG_FS | ||
1534 | default n | ||
1535 | ---help--- | ||
1536 | Enable this if you want debugging information using the debug | ||
1537 | filesystem (debugfs) | ||
1538 | |||
1539 | If unsure, say N. | ||
1540 | |||
1521 | config FB_W100 | 1541 | config FB_W100 |
1522 | tristate "W100 frame buffer support" | 1542 | tristate "W100 frame buffer support" |
1523 | depends on FB && PXA_SHARPSL | 1543 | depends on FB && PXA_SHARPSL |
diff --git a/drivers/video/Makefile b/drivers/video/Makefile index 6283d015f8f5..95563c9c6b9c 100644 --- a/drivers/video/Makefile +++ b/drivers/video/Makefile | |||
@@ -38,6 +38,7 @@ obj-$(CONFIG_FB_SIS) += sis/ | |||
38 | obj-$(CONFIG_FB_KYRO) += kyro/ | 38 | obj-$(CONFIG_FB_KYRO) += kyro/ |
39 | obj-$(CONFIG_FB_SAVAGE) += savage/ | 39 | obj-$(CONFIG_FB_SAVAGE) += savage/ |
40 | obj-$(CONFIG_FB_GEODE) += geode/ | 40 | obj-$(CONFIG_FB_GEODE) += geode/ |
41 | obj-$(CONFIG_FB_MBX) += mbx/ | ||
41 | obj-$(CONFIG_FB_I810) += vgastate.o | 42 | obj-$(CONFIG_FB_I810) += vgastate.o |
42 | obj-$(CONFIG_FB_NEOMAGIC) += neofb.o vgastate.o | 43 | obj-$(CONFIG_FB_NEOMAGIC) += neofb.o vgastate.o |
43 | obj-$(CONFIG_FB_VIRGE) += virgefb.o | 44 | obj-$(CONFIG_FB_VIRGE) += virgefb.o |
diff --git a/drivers/video/S3triofb.c b/drivers/video/S3triofb.c index e714e8449c1d..afd146f5f683 100644 --- a/drivers/video/S3triofb.c +++ b/drivers/video/S3triofb.c | |||
@@ -28,7 +28,6 @@ | |||
28 | #include <linux/errno.h> | 28 | #include <linux/errno.h> |
29 | #include <linux/string.h> | 29 | #include <linux/string.h> |
30 | #include <linux/mm.h> | 30 | #include <linux/mm.h> |
31 | #include <linux/tty.h> | ||
32 | #include <linux/slab.h> | 31 | #include <linux/slab.h> |
33 | #include <linux/vmalloc.h> | 32 | #include <linux/vmalloc.h> |
34 | #include <linux/delay.h> | 33 | #include <linux/delay.h> |
diff --git a/drivers/video/amifb.c b/drivers/video/amifb.c index f9bc9f777e75..f1ba54f4fc39 100644 --- a/drivers/video/amifb.c +++ b/drivers/video/amifb.c | |||
@@ -45,7 +45,6 @@ | |||
45 | #include <linux/errno.h> | 45 | #include <linux/errno.h> |
46 | #include <linux/string.h> | 46 | #include <linux/string.h> |
47 | #include <linux/mm.h> | 47 | #include <linux/mm.h> |
48 | #include <linux/tty.h> | ||
49 | #include <linux/slab.h> | 48 | #include <linux/slab.h> |
50 | #include <linux/delay.h> | 49 | #include <linux/delay.h> |
51 | #include <linux/interrupt.h> | 50 | #include <linux/interrupt.h> |
diff --git a/drivers/video/arcfb.c b/drivers/video/arcfb.c index fd95c2dbd4f7..70dd8115a4d8 100644 --- a/drivers/video/arcfb.c +++ b/drivers/video/arcfb.c | |||
@@ -39,7 +39,6 @@ | |||
39 | #include <linux/errno.h> | 39 | #include <linux/errno.h> |
40 | #include <linux/string.h> | 40 | #include <linux/string.h> |
41 | #include <linux/mm.h> | 41 | #include <linux/mm.h> |
42 | #include <linux/tty.h> | ||
43 | #include <linux/slab.h> | 42 | #include <linux/slab.h> |
44 | #include <linux/vmalloc.h> | 43 | #include <linux/vmalloc.h> |
45 | #include <linux/delay.h> | 44 | #include <linux/delay.h> |
diff --git a/drivers/video/asiliantfb.c b/drivers/video/asiliantfb.c index eaeaf4d1a094..1fd22f460b0f 100644 --- a/drivers/video/asiliantfb.c +++ b/drivers/video/asiliantfb.c | |||
@@ -34,7 +34,6 @@ | |||
34 | #include <linux/errno.h> | 34 | #include <linux/errno.h> |
35 | #include <linux/string.h> | 35 | #include <linux/string.h> |
36 | #include <linux/mm.h> | 36 | #include <linux/mm.h> |
37 | #include <linux/tty.h> | ||
38 | #include <linux/slab.h> | 37 | #include <linux/slab.h> |
39 | #include <linux/vmalloc.h> | 38 | #include <linux/vmalloc.h> |
40 | #include <linux/delay.h> | 39 | #include <linux/delay.h> |
diff --git a/drivers/video/atafb.c b/drivers/video/atafb.c index e69ab65f7843..5831893bf7a0 100644 --- a/drivers/video/atafb.c +++ b/drivers/video/atafb.c | |||
@@ -53,7 +53,6 @@ | |||
53 | #include <linux/errno.h> | 53 | #include <linux/errno.h> |
54 | #include <linux/string.h> | 54 | #include <linux/string.h> |
55 | #include <linux/mm.h> | 55 | #include <linux/mm.h> |
56 | #include <linux/tty.h> | ||
57 | #include <linux/slab.h> | 56 | #include <linux/slab.h> |
58 | #include <linux/delay.h> | 57 | #include <linux/delay.h> |
59 | #include <linux/init.h> | 58 | #include <linux/init.h> |
diff --git a/drivers/video/aty/aty128fb.c b/drivers/video/aty/aty128fb.c index 72c589109471..c64a717e2d4b 100644 --- a/drivers/video/aty/aty128fb.c +++ b/drivers/video/aty/aty128fb.c | |||
@@ -52,7 +52,6 @@ | |||
52 | #include <linux/errno.h> | 52 | #include <linux/errno.h> |
53 | #include <linux/string.h> | 53 | #include <linux/string.h> |
54 | #include <linux/mm.h> | 54 | #include <linux/mm.h> |
55 | #include <linux/tty.h> | ||
56 | #include <linux/slab.h> | 55 | #include <linux/slab.h> |
57 | #include <linux/vmalloc.h> | 56 | #include <linux/vmalloc.h> |
58 | #include <linux/delay.h> | 57 | #include <linux/delay.h> |
@@ -456,6 +455,7 @@ static void do_wait_for_fifo(u16 entries, struct aty128fb_par *par); | |||
456 | static void wait_for_fifo(u16 entries, struct aty128fb_par *par); | 455 | static void wait_for_fifo(u16 entries, struct aty128fb_par *par); |
457 | static void wait_for_idle(struct aty128fb_par *par); | 456 | static void wait_for_idle(struct aty128fb_par *par); |
458 | static u32 depth_to_dst(u32 depth); | 457 | static u32 depth_to_dst(u32 depth); |
458 | static void aty128_bl_set_power(struct fb_info *info, int power); | ||
459 | 459 | ||
460 | #define BIOS_IN8(v) (readb(bios + (v))) | 460 | #define BIOS_IN8(v) (readb(bios + (v))) |
461 | #define BIOS_IN16(v) (readb(bios + (v)) | \ | 461 | #define BIOS_IN16(v) (readb(bios + (v)) | \ |
@@ -1258,25 +1258,11 @@ static void aty128_set_lcd_enable(struct aty128fb_par *par, int on) | |||
1258 | reg &= ~LVDS_DISPLAY_DIS; | 1258 | reg &= ~LVDS_DISPLAY_DIS; |
1259 | aty_st_le32(LVDS_GEN_CNTL, reg); | 1259 | aty_st_le32(LVDS_GEN_CNTL, reg); |
1260 | #ifdef CONFIG_FB_ATY128_BACKLIGHT | 1260 | #ifdef CONFIG_FB_ATY128_BACKLIGHT |
1261 | mutex_lock(&info->bl_mutex); | 1261 | aty128_bl_set_power(info, FB_BLANK_UNBLANK); |
1262 | if (info->bl_dev) { | ||
1263 | down(&info->bl_dev->sem); | ||
1264 | info->bl_dev->props->update_status(info->bl_dev); | ||
1265 | up(&info->bl_dev->sem); | ||
1266 | } | ||
1267 | mutex_unlock(&info->bl_mutex); | ||
1268 | #endif | 1262 | #endif |
1269 | } else { | 1263 | } else { |
1270 | #ifdef CONFIG_FB_ATY128_BACKLIGHT | 1264 | #ifdef CONFIG_FB_ATY128_BACKLIGHT |
1271 | mutex_lock(&info->bl_mutex); | 1265 | aty128_bl_set_power(info, FB_BLANK_POWERDOWN); |
1272 | if (info->bl_dev) { | ||
1273 | down(&info->bl_dev->sem); | ||
1274 | info->bl_dev->props->brightness = 0; | ||
1275 | info->bl_dev->props->power = FB_BLANK_POWERDOWN; | ||
1276 | info->bl_dev->props->update_status(info->bl_dev); | ||
1277 | up(&info->bl_dev->sem); | ||
1278 | } | ||
1279 | mutex_unlock(&info->bl_mutex); | ||
1280 | #endif | 1266 | #endif |
1281 | reg = aty_ld_le32(LVDS_GEN_CNTL); | 1267 | reg = aty_ld_le32(LVDS_GEN_CNTL); |
1282 | reg |= LVDS_DISPLAY_DIS; | 1268 | reg |= LVDS_DISPLAY_DIS; |
@@ -1703,6 +1689,7 @@ static int __devinit aty128fb_setup(char *options) | |||
1703 | 1689 | ||
1704 | static struct backlight_properties aty128_bl_data; | 1690 | static struct backlight_properties aty128_bl_data; |
1705 | 1691 | ||
1692 | /* Call with fb_info->bl_mutex held */ | ||
1706 | static int aty128_bl_get_level_brightness(struct aty128fb_par *par, | 1693 | static int aty128_bl_get_level_brightness(struct aty128fb_par *par, |
1707 | int level) | 1694 | int level) |
1708 | { | 1695 | { |
@@ -1710,10 +1697,8 @@ static int aty128_bl_get_level_brightness(struct aty128fb_par *par, | |||
1710 | int atylevel; | 1697 | int atylevel; |
1711 | 1698 | ||
1712 | /* Get and convert the value */ | 1699 | /* Get and convert the value */ |
1713 | mutex_lock(&info->bl_mutex); | ||
1714 | atylevel = MAX_LEVEL - | 1700 | atylevel = MAX_LEVEL - |
1715 | (info->bl_curve[level] * FB_BACKLIGHT_MAX / MAX_LEVEL); | 1701 | (info->bl_curve[level] * FB_BACKLIGHT_MAX / MAX_LEVEL); |
1716 | mutex_unlock(&info->bl_mutex); | ||
1717 | 1702 | ||
1718 | if (atylevel < 0) | 1703 | if (atylevel < 0) |
1719 | atylevel = 0; | 1704 | atylevel = 0; |
@@ -1731,7 +1716,8 @@ static int aty128_bl_get_level_brightness(struct aty128fb_par *par, | |||
1731 | /* That one prevents proper CRT output with LCD off */ | 1716 | /* That one prevents proper CRT output with LCD off */ |
1732 | #undef BACKLIGHT_DAC_OFF | 1717 | #undef BACKLIGHT_DAC_OFF |
1733 | 1718 | ||
1734 | static int aty128_bl_update_status(struct backlight_device *bd) | 1719 | /* Call with fb_info->bl_mutex held */ |
1720 | static int __aty128_bl_update_status(struct backlight_device *bd) | ||
1735 | { | 1721 | { |
1736 | struct aty128fb_par *par = class_get_devdata(&bd->class_dev); | 1722 | struct aty128fb_par *par = class_get_devdata(&bd->class_dev); |
1737 | unsigned int reg = aty_ld_le32(LVDS_GEN_CNTL); | 1723 | unsigned int reg = aty_ld_le32(LVDS_GEN_CNTL); |
@@ -1784,6 +1770,19 @@ static int aty128_bl_update_status(struct backlight_device *bd) | |||
1784 | return 0; | 1770 | return 0; |
1785 | } | 1771 | } |
1786 | 1772 | ||
1773 | static int aty128_bl_update_status(struct backlight_device *bd) | ||
1774 | { | ||
1775 | struct aty128fb_par *par = class_get_devdata(&bd->class_dev); | ||
1776 | struct fb_info *info = pci_get_drvdata(par->pdev); | ||
1777 | int ret; | ||
1778 | |||
1779 | mutex_lock(&info->bl_mutex); | ||
1780 | ret = __aty128_bl_update_status(bd); | ||
1781 | mutex_unlock(&info->bl_mutex); | ||
1782 | |||
1783 | return ret; | ||
1784 | } | ||
1785 | |||
1787 | static int aty128_bl_get_brightness(struct backlight_device *bd) | 1786 | static int aty128_bl_get_brightness(struct backlight_device *bd) |
1788 | { | 1787 | { |
1789 | return bd->props->brightness; | 1788 | return bd->props->brightness; |
@@ -1796,6 +1795,16 @@ static struct backlight_properties aty128_bl_data = { | |||
1796 | .max_brightness = (FB_BACKLIGHT_LEVELS - 1), | 1795 | .max_brightness = (FB_BACKLIGHT_LEVELS - 1), |
1797 | }; | 1796 | }; |
1798 | 1797 | ||
1798 | static void aty128_bl_set_power(struct fb_info *info, int power) | ||
1799 | { | ||
1800 | mutex_lock(&info->bl_mutex); | ||
1801 | up(&info->bl_dev->sem); | ||
1802 | info->bl_dev->props->power = power; | ||
1803 | __aty128_bl_update_status(info->bl_dev); | ||
1804 | down(&info->bl_dev->sem); | ||
1805 | mutex_unlock(&info->bl_mutex); | ||
1806 | } | ||
1807 | |||
1799 | static void aty128_bl_init(struct aty128fb_par *par) | 1808 | static void aty128_bl_init(struct aty128fb_par *par) |
1800 | { | 1809 | { |
1801 | struct fb_info *info = pci_get_drvdata(par->pdev); | 1810 | struct fb_info *info = pci_get_drvdata(par->pdev); |
@@ -2198,12 +2207,8 @@ static int aty128fb_blank(int blank, struct fb_info *fb) | |||
2198 | return 0; | 2207 | return 0; |
2199 | 2208 | ||
2200 | #ifdef CONFIG_FB_ATY128_BACKLIGHT | 2209 | #ifdef CONFIG_FB_ATY128_BACKLIGHT |
2201 | if (machine_is(powermac) && blank) { | 2210 | if (machine_is(powermac) && blank) |
2202 | down(&fb->bl_dev->sem); | 2211 | aty128_bl_set_power(fb, FB_BLANK_POWERDOWN); |
2203 | fb->bl_dev->props->power = FB_BLANK_POWERDOWN; | ||
2204 | fb->bl_dev->props->update_status(fb->bl_dev); | ||
2205 | up(&fb->bl_dev->sem); | ||
2206 | } | ||
2207 | #endif | 2212 | #endif |
2208 | 2213 | ||
2209 | if (blank & FB_BLANK_VSYNC_SUSPEND) | 2214 | if (blank & FB_BLANK_VSYNC_SUSPEND) |
@@ -2219,14 +2224,12 @@ static int aty128fb_blank(int blank, struct fb_info *fb) | |||
2219 | aty128_set_crt_enable(par, par->crt_on && !blank); | 2224 | aty128_set_crt_enable(par, par->crt_on && !blank); |
2220 | aty128_set_lcd_enable(par, par->lcd_on && !blank); | 2225 | aty128_set_lcd_enable(par, par->lcd_on && !blank); |
2221 | } | 2226 | } |
2227 | |||
2222 | #ifdef CONFIG_FB_ATY128_BACKLIGHT | 2228 | #ifdef CONFIG_FB_ATY128_BACKLIGHT |
2223 | if (machine_is(powermac) && !blank) { | 2229 | if (machine_is(powermac) && !blank) |
2224 | down(&fb->bl_dev->sem); | 2230 | aty128_bl_set_power(fb, FB_BLANK_UNBLANK); |
2225 | fb->bl_dev->props->power = FB_BLANK_UNBLANK; | ||
2226 | fb->bl_dev->props->update_status(fb->bl_dev); | ||
2227 | up(&fb->bl_dev->sem); | ||
2228 | } | ||
2229 | #endif | 2231 | #endif |
2232 | |||
2230 | return 0; | 2233 | return 0; |
2231 | } | 2234 | } |
2232 | 2235 | ||
diff --git a/drivers/video/aty/atyfb_base.c b/drivers/video/aty/atyfb_base.c index 0c9706746d79..1507d19f481f 100644 --- a/drivers/video/aty/atyfb_base.c +++ b/drivers/video/aty/atyfb_base.c | |||
@@ -2129,15 +2129,14 @@ static int atyfb_pci_resume(struct pci_dev *pdev) | |||
2129 | 2129 | ||
2130 | static struct backlight_properties aty_bl_data; | 2130 | static struct backlight_properties aty_bl_data; |
2131 | 2131 | ||
2132 | /* Call with fb_info->bl_mutex held */ | ||
2132 | static int aty_bl_get_level_brightness(struct atyfb_par *par, int level) | 2133 | static int aty_bl_get_level_brightness(struct atyfb_par *par, int level) |
2133 | { | 2134 | { |
2134 | struct fb_info *info = pci_get_drvdata(par->pdev); | 2135 | struct fb_info *info = pci_get_drvdata(par->pdev); |
2135 | int atylevel; | 2136 | int atylevel; |
2136 | 2137 | ||
2137 | /* Get and convert the value */ | 2138 | /* Get and convert the value */ |
2138 | mutex_lock(&info->bl_mutex); | ||
2139 | atylevel = info->bl_curve[level] * FB_BACKLIGHT_MAX / MAX_LEVEL; | 2139 | atylevel = info->bl_curve[level] * FB_BACKLIGHT_MAX / MAX_LEVEL; |
2140 | mutex_unlock(&info->bl_mutex); | ||
2141 | 2140 | ||
2142 | if (atylevel < 0) | 2141 | if (atylevel < 0) |
2143 | atylevel = 0; | 2142 | atylevel = 0; |
@@ -2147,7 +2146,8 @@ static int aty_bl_get_level_brightness(struct atyfb_par *par, int level) | |||
2147 | return atylevel; | 2146 | return atylevel; |
2148 | } | 2147 | } |
2149 | 2148 | ||
2150 | static int aty_bl_update_status(struct backlight_device *bd) | 2149 | /* Call with fb_info->bl_mutex held */ |
2150 | static int __aty_bl_update_status(struct backlight_device *bd) | ||
2151 | { | 2151 | { |
2152 | struct atyfb_par *par = class_get_devdata(&bd->class_dev); | 2152 | struct atyfb_par *par = class_get_devdata(&bd->class_dev); |
2153 | unsigned int reg = aty_ld_lcd(LCD_MISC_CNTL, par); | 2153 | unsigned int reg = aty_ld_lcd(LCD_MISC_CNTL, par); |
@@ -2172,6 +2172,19 @@ static int aty_bl_update_status(struct backlight_device *bd) | |||
2172 | return 0; | 2172 | return 0; |
2173 | } | 2173 | } |
2174 | 2174 | ||
2175 | static int aty_bl_update_status(struct backlight_device *bd) | ||
2176 | { | ||
2177 | struct atyfb_par *par = class_get_devdata(&bd->class_dev); | ||
2178 | struct fb_info *info = pci_get_drvdata(par->pdev); | ||
2179 | int ret; | ||
2180 | |||
2181 | mutex_lock(&info->bl_mutex); | ||
2182 | ret = __aty_bl_update_status(bd); | ||
2183 | mutex_unlock(&info->bl_mutex); | ||
2184 | |||
2185 | return ret; | ||
2186 | } | ||
2187 | |||
2175 | static int aty_bl_get_brightness(struct backlight_device *bd) | 2188 | static int aty_bl_get_brightness(struct backlight_device *bd) |
2176 | { | 2189 | { |
2177 | return bd->props->brightness; | 2190 | return bd->props->brightness; |
@@ -2184,6 +2197,16 @@ static struct backlight_properties aty_bl_data = { | |||
2184 | .max_brightness = (FB_BACKLIGHT_LEVELS - 1), | 2197 | .max_brightness = (FB_BACKLIGHT_LEVELS - 1), |
2185 | }; | 2198 | }; |
2186 | 2199 | ||
2200 | static void aty_bl_set_power(struct fb_info *info, int power) | ||
2201 | { | ||
2202 | mutex_lock(&info->bl_mutex); | ||
2203 | up(&info->bl_dev->sem); | ||
2204 | info->bl_dev->props->power = power; | ||
2205 | __aty_bl_update_status(info->bl_dev); | ||
2206 | down(&info->bl_dev->sem); | ||
2207 | mutex_unlock(&info->bl_mutex); | ||
2208 | } | ||
2209 | |||
2187 | static void aty_bl_init(struct atyfb_par *par) | 2210 | static void aty_bl_init(struct atyfb_par *par) |
2188 | { | 2211 | { |
2189 | struct fb_info *info = pci_get_drvdata(par->pdev); | 2212 | struct fb_info *info = pci_get_drvdata(par->pdev); |
@@ -2790,16 +2813,8 @@ static int atyfb_blank(int blank, struct fb_info *info) | |||
2790 | return 0; | 2813 | return 0; |
2791 | 2814 | ||
2792 | #ifdef CONFIG_PMAC_BACKLIGHT | 2815 | #ifdef CONFIG_PMAC_BACKLIGHT |
2793 | if (machine_is(powermac) && blank > FB_BLANK_NORMAL) { | 2816 | if (machine_is(powermac) && blank > FB_BLANK_NORMAL) |
2794 | mutex_lock(&info->bl_mutex); | 2817 | aty_bl_set_power(info, FB_BLANK_POWERDOWN); |
2795 | if (info->bl_dev) { | ||
2796 | down(&info->bl_dev->sem); | ||
2797 | info->bl_dev->props->power = FB_BLANK_POWERDOWN; | ||
2798 | info->bl_dev->props->update_status(info->bl_dev); | ||
2799 | up(&info->bl_dev->sem); | ||
2800 | } | ||
2801 | mutex_unlock(&info->bl_mutex); | ||
2802 | } | ||
2803 | #elif defined(CONFIG_FB_ATY_GENERIC_LCD) | 2818 | #elif defined(CONFIG_FB_ATY_GENERIC_LCD) |
2804 | if (par->lcd_table && blank > FB_BLANK_NORMAL && | 2819 | if (par->lcd_table && blank > FB_BLANK_NORMAL && |
2805 | (aty_ld_lcd(LCD_GEN_CNTL, par) & LCD_ON)) { | 2820 | (aty_ld_lcd(LCD_GEN_CNTL, par) & LCD_ON)) { |
@@ -2830,16 +2845,8 @@ static int atyfb_blank(int blank, struct fb_info *info) | |||
2830 | aty_st_le32(CRTC_GEN_CNTL, gen_cntl, par); | 2845 | aty_st_le32(CRTC_GEN_CNTL, gen_cntl, par); |
2831 | 2846 | ||
2832 | #ifdef CONFIG_PMAC_BACKLIGHT | 2847 | #ifdef CONFIG_PMAC_BACKLIGHT |
2833 | if (machine_is(powermac) && blank <= FB_BLANK_NORMAL) { | 2848 | if (machine_is(powermac) && blank <= FB_BLANK_NORMAL) |
2834 | mutex_lock(&info->bl_mutex); | 2849 | aty_bl_set_power(info, FB_BLANK_UNBLANK); |
2835 | if (info->bl_dev) { | ||
2836 | down(&info->bl_dev->sem); | ||
2837 | info->bl_dev->props->power = FB_BLANK_UNBLANK; | ||
2838 | info->bl_dev->props->update_status(info->bl_dev); | ||
2839 | up(&info->bl_dev->sem); | ||
2840 | } | ||
2841 | mutex_unlock(&info->bl_mutex); | ||
2842 | } | ||
2843 | #elif defined(CONFIG_FB_ATY_GENERIC_LCD) | 2850 | #elif defined(CONFIG_FB_ATY_GENERIC_LCD) |
2844 | if (par->lcd_table && blank <= FB_BLANK_NORMAL && | 2851 | if (par->lcd_table && blank <= FB_BLANK_NORMAL && |
2845 | (aty_ld_lcd(LCD_GEN_CNTL, par) & LCD_ON)) { | 2852 | (aty_ld_lcd(LCD_GEN_CNTL, par) & LCD_ON)) { |
diff --git a/drivers/video/aty/radeon_base.c b/drivers/video/aty/radeon_base.c index 51b78f8de949..8d85fc58142e 100644 --- a/drivers/video/aty/radeon_base.c +++ b/drivers/video/aty/radeon_base.c | |||
@@ -58,7 +58,6 @@ | |||
58 | #include <linux/errno.h> | 58 | #include <linux/errno.h> |
59 | #include <linux/string.h> | 59 | #include <linux/string.h> |
60 | #include <linux/mm.h> | 60 | #include <linux/mm.h> |
61 | #include <linux/tty.h> | ||
62 | #include <linux/slab.h> | 61 | #include <linux/slab.h> |
63 | #include <linux/delay.h> | 62 | #include <linux/delay.h> |
64 | #include <linux/time.h> | 63 | #include <linux/time.h> |
diff --git a/drivers/video/chipsfb.c b/drivers/video/chipsfb.c index 0e465c80ef24..73cb426bf2d7 100644 --- a/drivers/video/chipsfb.c +++ b/drivers/video/chipsfb.c | |||
@@ -19,7 +19,6 @@ | |||
19 | #include <linux/errno.h> | 19 | #include <linux/errno.h> |
20 | #include <linux/string.h> | 20 | #include <linux/string.h> |
21 | #include <linux/mm.h> | 21 | #include <linux/mm.h> |
22 | #include <linux/tty.h> | ||
23 | #include <linux/slab.h> | 22 | #include <linux/slab.h> |
24 | #include <linux/vmalloc.h> | 23 | #include <linux/vmalloc.h> |
25 | #include <linux/delay.h> | 24 | #include <linux/delay.h> |
@@ -150,12 +149,11 @@ static int chipsfb_blank(int blank, struct fb_info *info) | |||
150 | mutex_lock(&pmac_backlight_mutex); | 149 | mutex_lock(&pmac_backlight_mutex); |
151 | 150 | ||
152 | if (pmac_backlight) { | 151 | if (pmac_backlight) { |
153 | down(&pmac_backlight->sem); | ||
154 | |||
155 | /* used to disable backlight only for blank > 1, but it seems | 152 | /* used to disable backlight only for blank > 1, but it seems |
156 | * useful at blank = 1 too (saves battery, extends backlight | 153 | * useful at blank = 1 too (saves battery, extends backlight |
157 | * life) | 154 | * life) |
158 | */ | 155 | */ |
156 | down(&pmac_backlight->sem); | ||
159 | if (blank) | 157 | if (blank) |
160 | pmac_backlight->props->power = FB_BLANK_POWERDOWN; | 158 | pmac_backlight->props->power = FB_BLANK_POWERDOWN; |
161 | else | 159 | else |
diff --git a/drivers/video/cirrusfb.c b/drivers/video/cirrusfb.c index 7355da09c721..daf43f535a0b 100644 --- a/drivers/video/cirrusfb.c +++ b/drivers/video/cirrusfb.c | |||
@@ -41,7 +41,6 @@ | |||
41 | #include <linux/errno.h> | 41 | #include <linux/errno.h> |
42 | #include <linux/string.h> | 42 | #include <linux/string.h> |
43 | #include <linux/mm.h> | 43 | #include <linux/mm.h> |
44 | #include <linux/tty.h> | ||
45 | #include <linux/slab.h> | 44 | #include <linux/slab.h> |
46 | #include <linux/delay.h> | 45 | #include <linux/delay.h> |
47 | #include <linux/fb.h> | 46 | #include <linux/fb.h> |
diff --git a/drivers/video/console/dummycon.c b/drivers/video/console/dummycon.c index 878707a04398..d9315d99445f 100644 --- a/drivers/video/console/dummycon.c +++ b/drivers/video/console/dummycon.c | |||
@@ -7,9 +7,9 @@ | |||
7 | 7 | ||
8 | #include <linux/types.h> | 8 | #include <linux/types.h> |
9 | #include <linux/kdev_t.h> | 9 | #include <linux/kdev_t.h> |
10 | #include <linux/tty.h> | ||
11 | #include <linux/console.h> | 10 | #include <linux/console.h> |
12 | #include <linux/vt_kern.h> | 11 | #include <linux/vt_kern.h> |
12 | #include <linux/screen_info.h> | ||
13 | #include <linux/init.h> | 13 | #include <linux/init.h> |
14 | #include <linux/module.h> | 14 | #include <linux/module.h> |
15 | 15 | ||
diff --git a/drivers/video/console/fbcon.c b/drivers/video/console/fbcon.c index 94e9f7069bef..390439b3d899 100644 --- a/drivers/video/console/fbcon.c +++ b/drivers/video/console/fbcon.c | |||
@@ -64,7 +64,6 @@ | |||
64 | #include <linux/fs.h> | 64 | #include <linux/fs.h> |
65 | #include <linux/kernel.h> | 65 | #include <linux/kernel.h> |
66 | #include <linux/delay.h> /* MSch: for IRQ probe */ | 66 | #include <linux/delay.h> /* MSch: for IRQ probe */ |
67 | #include <linux/tty.h> | ||
68 | #include <linux/console.h> | 67 | #include <linux/console.h> |
69 | #include <linux/string.h> | 68 | #include <linux/string.h> |
70 | #include <linux/kd.h> | 69 | #include <linux/kd.h> |
diff --git a/drivers/video/console/mdacon.c b/drivers/video/console/mdacon.c index c89f90edf8ac..52ed12b12acc 100644 --- a/drivers/video/console/mdacon.c +++ b/drivers/video/console/mdacon.c | |||
@@ -31,7 +31,6 @@ | |||
31 | #include <linux/fs.h> | 31 | #include <linux/fs.h> |
32 | #include <linux/kernel.h> | 32 | #include <linux/kernel.h> |
33 | #include <linux/module.h> | 33 | #include <linux/module.h> |
34 | #include <linux/tty.h> | ||
35 | #include <linux/console.h> | 34 | #include <linux/console.h> |
36 | #include <linux/string.h> | 35 | #include <linux/string.h> |
37 | #include <linux/kd.h> | 36 | #include <linux/kd.h> |
diff --git a/drivers/video/console/newport_con.c b/drivers/video/console/newport_con.c index 03041311711b..7fa1afeae8dc 100644 --- a/drivers/video/console/newport_con.c +++ b/drivers/video/console/newport_con.c | |||
@@ -12,7 +12,6 @@ | |||
12 | #include <linux/init.h> | 12 | #include <linux/init.h> |
13 | #include <linux/kernel.h> | 13 | #include <linux/kernel.h> |
14 | #include <linux/errno.h> | 14 | #include <linux/errno.h> |
15 | #include <linux/tty.h> | ||
16 | #include <linux/kd.h> | 15 | #include <linux/kd.h> |
17 | #include <linux/selection.h> | 16 | #include <linux/selection.h> |
18 | #include <linux/console.h> | 17 | #include <linux/console.h> |
diff --git a/drivers/video/console/promcon.c b/drivers/video/console/promcon.c index 5cd5e114d1e6..b78eac63459f 100644 --- a/drivers/video/console/promcon.c +++ b/drivers/video/console/promcon.c | |||
@@ -10,7 +10,6 @@ | |||
10 | #include <linux/errno.h> | 10 | #include <linux/errno.h> |
11 | #include <linux/string.h> | 11 | #include <linux/string.h> |
12 | #include <linux/mm.h> | 12 | #include <linux/mm.h> |
13 | #include <linux/tty.h> | ||
14 | #include <linux/slab.h> | 13 | #include <linux/slab.h> |
15 | #include <linux/delay.h> | 14 | #include <linux/delay.h> |
16 | #include <linux/console.h> | 15 | #include <linux/console.h> |
diff --git a/drivers/video/console/softcursor.c b/drivers/video/console/softcursor.c index 3957fc7523e2..557c563e4aed 100644 --- a/drivers/video/console/softcursor.c +++ b/drivers/video/console/softcursor.c | |||
@@ -10,7 +10,6 @@ | |||
10 | 10 | ||
11 | #include <linux/module.h> | 11 | #include <linux/module.h> |
12 | #include <linux/string.h> | 12 | #include <linux/string.h> |
13 | #include <linux/tty.h> | ||
14 | #include <linux/fb.h> | 13 | #include <linux/fb.h> |
15 | #include <linux/slab.h> | 14 | #include <linux/slab.h> |
16 | 15 | ||
diff --git a/drivers/video/console/sticon.c b/drivers/video/console/sticon.c index 45c4f227e56e..45586aaabd1e 100644 --- a/drivers/video/console/sticon.c +++ b/drivers/video/console/sticon.c | |||
@@ -37,7 +37,6 @@ | |||
37 | 37 | ||
38 | #include <linux/init.h> | 38 | #include <linux/init.h> |
39 | #include <linux/kernel.h> | 39 | #include <linux/kernel.h> |
40 | #include <linux/tty.h> | ||
41 | #include <linux/console.h> | 40 | #include <linux/console.h> |
42 | #include <linux/errno.h> | 41 | #include <linux/errno.h> |
43 | #include <linux/vt_kern.h> | 42 | #include <linux/vt_kern.h> |
diff --git a/drivers/video/console/vgacon.c b/drivers/video/console/vgacon.c index 05735ff4e9c5..0a2c10a1abf8 100644 --- a/drivers/video/console/vgacon.c +++ b/drivers/video/console/vgacon.c | |||
@@ -38,7 +38,6 @@ | |||
38 | #include <linux/sched.h> | 38 | #include <linux/sched.h> |
39 | #include <linux/fs.h> | 39 | #include <linux/fs.h> |
40 | #include <linux/kernel.h> | 40 | #include <linux/kernel.h> |
41 | #include <linux/tty.h> | ||
42 | #include <linux/console.h> | 41 | #include <linux/console.h> |
43 | #include <linux/string.h> | 42 | #include <linux/string.h> |
44 | #include <linux/kd.h> | 43 | #include <linux/kd.h> |
@@ -48,6 +47,7 @@ | |||
48 | #include <linux/spinlock.h> | 47 | #include <linux/spinlock.h> |
49 | #include <linux/ioport.h> | 48 | #include <linux/ioport.h> |
50 | #include <linux/init.h> | 49 | #include <linux/init.h> |
50 | #include <linux/screen_info.h> | ||
51 | #include <linux/smp_lock.h> | 51 | #include <linux/smp_lock.h> |
52 | #include <video/vga.h> | 52 | #include <video/vga.h> |
53 | #include <asm/io.h> | 53 | #include <asm/io.h> |
diff --git a/drivers/video/controlfb.c b/drivers/video/controlfb.c index acdd6a103dbb..8cc6c0e2d27a 100644 --- a/drivers/video/controlfb.c +++ b/drivers/video/controlfb.c | |||
@@ -36,7 +36,6 @@ | |||
36 | #include <linux/errno.h> | 36 | #include <linux/errno.h> |
37 | #include <linux/string.h> | 37 | #include <linux/string.h> |
38 | #include <linux/mm.h> | 38 | #include <linux/mm.h> |
39 | #include <linux/tty.h> | ||
40 | #include <linux/slab.h> | 39 | #include <linux/slab.h> |
41 | #include <linux/vmalloc.h> | 40 | #include <linux/vmalloc.h> |
42 | #include <linux/delay.h> | 41 | #include <linux/delay.h> |
diff --git a/drivers/video/cyber2000fb.c b/drivers/video/cyber2000fb.c index 2e2924957d8f..aae6d9c26e88 100644 --- a/drivers/video/cyber2000fb.c +++ b/drivers/video/cyber2000fb.c | |||
@@ -41,7 +41,6 @@ | |||
41 | #include <linux/errno.h> | 41 | #include <linux/errno.h> |
42 | #include <linux/string.h> | 42 | #include <linux/string.h> |
43 | #include <linux/mm.h> | 43 | #include <linux/mm.h> |
44 | #include <linux/tty.h> | ||
45 | #include <linux/slab.h> | 44 | #include <linux/slab.h> |
46 | #include <linux/delay.h> | 45 | #include <linux/delay.h> |
47 | #include <linux/fb.h> | 46 | #include <linux/fb.h> |
diff --git a/drivers/video/cyberfb.c b/drivers/video/cyberfb.c index a3e189f90a7d..c40e72dafb0e 100644 --- a/drivers/video/cyberfb.c +++ b/drivers/video/cyberfb.c | |||
@@ -81,7 +81,6 @@ | |||
81 | #include <linux/errno.h> | 81 | #include <linux/errno.h> |
82 | #include <linux/string.h> | 82 | #include <linux/string.h> |
83 | #include <linux/mm.h> | 83 | #include <linux/mm.h> |
84 | #include <linux/tty.h> | ||
85 | #include <linux/slab.h> | 84 | #include <linux/slab.h> |
86 | #include <linux/delay.h> | 85 | #include <linux/delay.h> |
87 | #include <linux/zorro.h> | 86 | #include <linux/zorro.h> |
diff --git a/drivers/video/dnfb.c b/drivers/video/dnfb.c index 5abd3cb00671..b083ea7e9c69 100644 --- a/drivers/video/dnfb.c +++ b/drivers/video/dnfb.c | |||
@@ -2,7 +2,6 @@ | |||
2 | #include <linux/errno.h> | 2 | #include <linux/errno.h> |
3 | #include <linux/string.h> | 3 | #include <linux/string.h> |
4 | #include <linux/mm.h> | 4 | #include <linux/mm.h> |
5 | #include <linux/tty.h> | ||
6 | #include <linux/slab.h> | 5 | #include <linux/slab.h> |
7 | #include <linux/delay.h> | 6 | #include <linux/delay.h> |
8 | #include <linux/interrupt.h> | 7 | #include <linux/interrupt.h> |
diff --git a/drivers/video/epson1355fb.c b/drivers/video/epson1355fb.c index f0a621ecc288..737257d278f0 100644 --- a/drivers/video/epson1355fb.c +++ b/drivers/video/epson1355fb.c | |||
@@ -48,7 +48,6 @@ | |||
48 | #include <linux/errno.h> | 48 | #include <linux/errno.h> |
49 | #include <linux/string.h> | 49 | #include <linux/string.h> |
50 | #include <linux/mm.h> | 50 | #include <linux/mm.h> |
51 | #include <linux/tty.h> | ||
52 | #include <linux/slab.h> | 51 | #include <linux/slab.h> |
53 | #include <linux/delay.h> | 52 | #include <linux/delay.h> |
54 | #include <linux/fb.h> | 53 | #include <linux/fb.h> |
diff --git a/drivers/video/fbcmap.c b/drivers/video/fbcmap.c index 1f98392a43b3..e8b135f3d80d 100644 --- a/drivers/video/fbcmap.c +++ b/drivers/video/fbcmap.c | |||
@@ -13,7 +13,6 @@ | |||
13 | 13 | ||
14 | #include <linux/string.h> | 14 | #include <linux/string.h> |
15 | #include <linux/module.h> | 15 | #include <linux/module.h> |
16 | #include <linux/tty.h> | ||
17 | #include <linux/fb.h> | 16 | #include <linux/fb.h> |
18 | #include <linux/slab.h> | 17 | #include <linux/slab.h> |
19 | 18 | ||
diff --git a/drivers/video/fbmem.c b/drivers/video/fbmem.c index 33034f81114d..4fc9df426c1a 100644 --- a/drivers/video/fbmem.c +++ b/drivers/video/fbmem.c | |||
@@ -23,7 +23,7 @@ | |||
23 | #include <linux/slab.h> | 23 | #include <linux/slab.h> |
24 | #include <linux/mm.h> | 24 | #include <linux/mm.h> |
25 | #include <linux/mman.h> | 25 | #include <linux/mman.h> |
26 | #include <linux/tty.h> | 26 | #include <linux/vt.h> |
27 | #include <linux/init.h> | 27 | #include <linux/init.h> |
28 | #include <linux/linux_logo.h> | 28 | #include <linux/linux_logo.h> |
29 | #include <linux/proc_fs.h> | 29 | #include <linux/proc_fs.h> |
diff --git a/drivers/video/fbmon.c b/drivers/video/fbmon.c index 3ccfff715a51..de93139ccbb5 100644 --- a/drivers/video/fbmon.c +++ b/drivers/video/fbmon.c | |||
@@ -26,7 +26,6 @@ | |||
26 | * for more details. | 26 | * for more details. |
27 | * | 27 | * |
28 | */ | 28 | */ |
29 | #include <linux/tty.h> | ||
30 | #include <linux/fb.h> | 29 | #include <linux/fb.h> |
31 | #include <linux/module.h> | 30 | #include <linux/module.h> |
32 | #include <linux/pci.h> | 31 | #include <linux/pci.h> |
diff --git a/drivers/video/g364fb.c b/drivers/video/g364fb.c index 605d1a132020..1b981b635675 100644 --- a/drivers/video/g364fb.c +++ b/drivers/video/g364fb.c | |||
@@ -21,7 +21,6 @@ | |||
21 | #include <linux/errno.h> | 21 | #include <linux/errno.h> |
22 | #include <linux/string.h> | 22 | #include <linux/string.h> |
23 | #include <linux/mm.h> | 23 | #include <linux/mm.h> |
24 | #include <linux/tty.h> | ||
25 | #include <linux/slab.h> | 24 | #include <linux/slab.h> |
26 | #include <linux/vmalloc.h> | 25 | #include <linux/vmalloc.h> |
27 | #include <linux/delay.h> | 26 | #include <linux/delay.h> |
diff --git a/drivers/video/geode/gx1fb_core.c b/drivers/video/geode/gx1fb_core.c index 4d3a8871d3d1..bcf9cea54d8b 100644 --- a/drivers/video/geode/gx1fb_core.c +++ b/drivers/video/geode/gx1fb_core.c | |||
@@ -15,7 +15,6 @@ | |||
15 | #include <linux/errno.h> | 15 | #include <linux/errno.h> |
16 | #include <linux/string.h> | 16 | #include <linux/string.h> |
17 | #include <linux/mm.h> | 17 | #include <linux/mm.h> |
18 | #include <linux/tty.h> | ||
19 | #include <linux/slab.h> | 18 | #include <linux/slab.h> |
20 | #include <linux/delay.h> | 19 | #include <linux/delay.h> |
21 | #include <linux/fb.h> | 20 | #include <linux/fb.h> |
diff --git a/drivers/video/geode/gxfb_core.c b/drivers/video/geode/gxfb_core.c index 5ef12a3dfa50..0d3643fc6293 100644 --- a/drivers/video/geode/gxfb_core.c +++ b/drivers/video/geode/gxfb_core.c | |||
@@ -25,7 +25,6 @@ | |||
25 | #include <linux/errno.h> | 25 | #include <linux/errno.h> |
26 | #include <linux/string.h> | 26 | #include <linux/string.h> |
27 | #include <linux/mm.h> | 27 | #include <linux/mm.h> |
28 | #include <linux/tty.h> | ||
29 | #include <linux/slab.h> | 28 | #include <linux/slab.h> |
30 | #include <linux/delay.h> | 29 | #include <linux/delay.h> |
31 | #include <linux/fb.h> | 30 | #include <linux/fb.h> |
diff --git a/drivers/video/hgafb.c b/drivers/video/hgafb.c index 4e39035cf335..fb9e67228543 100644 --- a/drivers/video/hgafb.c +++ b/drivers/video/hgafb.c | |||
@@ -36,7 +36,6 @@ | |||
36 | #include <linux/spinlock.h> | 36 | #include <linux/spinlock.h> |
37 | #include <linux/string.h> | 37 | #include <linux/string.h> |
38 | #include <linux/mm.h> | 38 | #include <linux/mm.h> |
39 | #include <linux/tty.h> | ||
40 | #include <linux/slab.h> | 39 | #include <linux/slab.h> |
41 | #include <linux/delay.h> | 40 | #include <linux/delay.h> |
42 | #include <linux/fb.h> | 41 | #include <linux/fb.h> |
diff --git a/drivers/video/hitfb.c b/drivers/video/hitfb.c index 01864767450d..4cc6b454265e 100644 --- a/drivers/video/hitfb.c +++ b/drivers/video/hitfb.c | |||
@@ -17,7 +17,6 @@ | |||
17 | #include <linux/errno.h> | 17 | #include <linux/errno.h> |
18 | #include <linux/string.h> | 18 | #include <linux/string.h> |
19 | #include <linux/mm.h> | 19 | #include <linux/mm.h> |
20 | #include <linux/tty.h> | ||
21 | #include <linux/slab.h> | 20 | #include <linux/slab.h> |
22 | #include <linux/delay.h> | 21 | #include <linux/delay.h> |
23 | #include <linux/init.h> | 22 | #include <linux/init.h> |
diff --git a/drivers/video/hpfb.c b/drivers/video/hpfb.c index abd920a663a0..91cf3b577d15 100644 --- a/drivers/video/hpfb.c +++ b/drivers/video/hpfb.c | |||
@@ -11,7 +11,6 @@ | |||
11 | #include <linux/errno.h> | 11 | #include <linux/errno.h> |
12 | #include <linux/string.h> | 12 | #include <linux/string.h> |
13 | #include <linux/mm.h> | 13 | #include <linux/mm.h> |
14 | #include <linux/tty.h> | ||
15 | #include <linux/slab.h> | 14 | #include <linux/slab.h> |
16 | #include <linux/delay.h> | 15 | #include <linux/delay.h> |
17 | #include <linux/init.h> | 16 | #include <linux/init.h> |
diff --git a/drivers/video/i810/i810_main.c b/drivers/video/i810/i810_main.c index fbe8a2c4b04c..a6ca02f2156a 100644 --- a/drivers/video/i810/i810_main.c +++ b/drivers/video/i810/i810_main.c | |||
@@ -33,7 +33,6 @@ | |||
33 | #include <linux/errno.h> | 33 | #include <linux/errno.h> |
34 | #include <linux/string.h> | 34 | #include <linux/string.h> |
35 | #include <linux/mm.h> | 35 | #include <linux/mm.h> |
36 | #include <linux/tty.h> | ||
37 | #include <linux/slab.h> | 36 | #include <linux/slab.h> |
38 | #include <linux/fb.h> | 37 | #include <linux/fb.h> |
39 | #include <linux/init.h> | 38 | #include <linux/init.h> |
diff --git a/drivers/video/igafb.c b/drivers/video/igafb.c index 8a0c2d3d3805..67f384f86758 100644 --- a/drivers/video/igafb.c +++ b/drivers/video/igafb.c | |||
@@ -33,7 +33,6 @@ | |||
33 | #include <linux/errno.h> | 33 | #include <linux/errno.h> |
34 | #include <linux/string.h> | 34 | #include <linux/string.h> |
35 | #include <linux/mm.h> | 35 | #include <linux/mm.h> |
36 | #include <linux/tty.h> | ||
37 | #include <linux/slab.h> | 36 | #include <linux/slab.h> |
38 | #include <linux/vmalloc.h> | 37 | #include <linux/vmalloc.h> |
39 | #include <linux/delay.h> | 38 | #include <linux/delay.h> |
diff --git a/drivers/video/imacfb.c b/drivers/video/imacfb.c index cdbae173d69a..ff233b84dec4 100644 --- a/drivers/video/imacfb.c +++ b/drivers/video/imacfb.c | |||
@@ -15,9 +15,9 @@ | |||
15 | #include <linux/mm.h> | 15 | #include <linux/mm.h> |
16 | #include <linux/module.h> | 16 | #include <linux/module.h> |
17 | #include <linux/platform_device.h> | 17 | #include <linux/platform_device.h> |
18 | #include <linux/screen_info.h> | ||
18 | #include <linux/slab.h> | 19 | #include <linux/slab.h> |
19 | #include <linux/string.h> | 20 | #include <linux/string.h> |
20 | #include <linux/tty.h> | ||
21 | 21 | ||
22 | #include <asm/io.h> | 22 | #include <asm/io.h> |
23 | 23 | ||
diff --git a/drivers/video/imsttfb.c b/drivers/video/imsttfb.c index 5f393d985b11..5715b8ad0ddc 100644 --- a/drivers/video/imsttfb.c +++ b/drivers/video/imsttfb.c | |||
@@ -21,7 +21,6 @@ | |||
21 | #include <linux/errno.h> | 21 | #include <linux/errno.h> |
22 | #include <linux/string.h> | 22 | #include <linux/string.h> |
23 | #include <linux/mm.h> | 23 | #include <linux/mm.h> |
24 | #include <linux/tty.h> | ||
25 | #include <linux/slab.h> | 24 | #include <linux/slab.h> |
26 | #include <linux/vmalloc.h> | 25 | #include <linux/vmalloc.h> |
27 | #include <linux/delay.h> | 26 | #include <linux/delay.h> |
diff --git a/drivers/video/intelfb/intelfbdrv.c b/drivers/video/intelfb/intelfbdrv.c index 3f39d84015f1..06af89d44a0d 100644 --- a/drivers/video/intelfb/intelfbdrv.c +++ b/drivers/video/intelfb/intelfbdrv.c | |||
@@ -113,7 +113,6 @@ | |||
113 | #include <linux/errno.h> | 113 | #include <linux/errno.h> |
114 | #include <linux/string.h> | 114 | #include <linux/string.h> |
115 | #include <linux/mm.h> | 115 | #include <linux/mm.h> |
116 | #include <linux/tty.h> | ||
117 | #include <linux/slab.h> | 116 | #include <linux/slab.h> |
118 | #include <linux/delay.h> | 117 | #include <linux/delay.h> |
119 | #include <linux/fb.h> | 118 | #include <linux/fb.h> |
@@ -122,6 +121,7 @@ | |||
122 | #include <linux/pci.h> | 121 | #include <linux/pci.h> |
123 | #include <linux/vmalloc.h> | 122 | #include <linux/vmalloc.h> |
124 | #include <linux/pagemap.h> | 123 | #include <linux/pagemap.h> |
124 | #include <linux/screen_info.h> | ||
125 | 125 | ||
126 | #include <asm/io.h> | 126 | #include <asm/io.h> |
127 | 127 | ||
diff --git a/drivers/video/intelfb/intelfbhw.c b/drivers/video/intelfb/intelfbhw.c index 3b78a57924f0..2a9322f9cfdc 100644 --- a/drivers/video/intelfb/intelfbhw.c +++ b/drivers/video/intelfb/intelfbhw.c | |||
@@ -24,7 +24,6 @@ | |||
24 | #include <linux/errno.h> | 24 | #include <linux/errno.h> |
25 | #include <linux/string.h> | 25 | #include <linux/string.h> |
26 | #include <linux/mm.h> | 26 | #include <linux/mm.h> |
27 | #include <linux/tty.h> | ||
28 | #include <linux/slab.h> | 27 | #include <linux/slab.h> |
29 | #include <linux/delay.h> | 28 | #include <linux/delay.h> |
30 | #include <linux/fb.h> | 29 | #include <linux/fb.h> |
diff --git a/drivers/video/kyro/fbdev.c b/drivers/video/kyro/fbdev.c index 2fdbe9b2b04b..f0d614a80f1f 100644 --- a/drivers/video/kyro/fbdev.c +++ b/drivers/video/kyro/fbdev.c | |||
@@ -16,7 +16,6 @@ | |||
16 | #include <linux/mm.h> | 16 | #include <linux/mm.h> |
17 | #include <linux/errno.h> | 17 | #include <linux/errno.h> |
18 | #include <linux/string.h> | 18 | #include <linux/string.h> |
19 | #include <linux/tty.h> | ||
20 | #include <linux/delay.h> | 19 | #include <linux/delay.h> |
21 | #include <linux/fb.h> | 20 | #include <linux/fb.h> |
22 | #include <linux/ioctl.h> | 21 | #include <linux/ioctl.h> |
diff --git a/drivers/video/macfb.c b/drivers/video/macfb.c index e6cbd9de944a..80a043807161 100644 --- a/drivers/video/macfb.c +++ b/drivers/video/macfb.c | |||
@@ -24,7 +24,6 @@ | |||
24 | #include <linux/errno.h> | 24 | #include <linux/errno.h> |
25 | #include <linux/string.h> | 25 | #include <linux/string.h> |
26 | #include <linux/mm.h> | 26 | #include <linux/mm.h> |
27 | #include <linux/tty.h> | ||
28 | #include <linux/slab.h> | 27 | #include <linux/slab.h> |
29 | #include <linux/delay.h> | 28 | #include <linux/delay.h> |
30 | #include <linux/nubus.h> | 29 | #include <linux/nubus.h> |
diff --git a/drivers/video/matrox/matroxfb_base.h b/drivers/video/matrox/matroxfb_base.h index b95779b57c06..9c25c2f7966b 100644 --- a/drivers/video/matrox/matroxfb_base.h +++ b/drivers/video/matrox/matroxfb_base.h | |||
@@ -30,7 +30,6 @@ | |||
30 | #include <linux/errno.h> | 30 | #include <linux/errno.h> |
31 | #include <linux/string.h> | 31 | #include <linux/string.h> |
32 | #include <linux/mm.h> | 32 | #include <linux/mm.h> |
33 | #include <linux/tty.h> | ||
34 | #include <linux/slab.h> | 33 | #include <linux/slab.h> |
35 | #include <linux/delay.h> | 34 | #include <linux/delay.h> |
36 | #include <linux/fb.h> | 35 | #include <linux/fb.h> |
diff --git a/drivers/video/maxinefb.c b/drivers/video/maxinefb.c index f85421bf7cb5..38c8d38de4fd 100644 --- a/drivers/video/maxinefb.c +++ b/drivers/video/maxinefb.c | |||
@@ -29,7 +29,6 @@ | |||
29 | #include <linux/errno.h> | 29 | #include <linux/errno.h> |
30 | #include <linux/string.h> | 30 | #include <linux/string.h> |
31 | #include <linux/mm.h> | 31 | #include <linux/mm.h> |
32 | #include <linux/tty.h> | ||
33 | #include <linux/slab.h> | 32 | #include <linux/slab.h> |
34 | #include <linux/delay.h> | 33 | #include <linux/delay.h> |
35 | #include <linux/init.h> | 34 | #include <linux/init.h> |
diff --git a/drivers/video/mbx/Makefile b/drivers/video/mbx/Makefile new file mode 100644 index 000000000000..16c1165cf9c7 --- /dev/null +++ b/drivers/video/mbx/Makefile | |||
@@ -0,0 +1,4 @@ | |||
1 | # Makefile for the 2700G controller driver. | ||
2 | |||
3 | obj-$(CONFIG_FB_MBX) += mbxfb.o | ||
4 | obj-$(CONFIG_FB_MBX_DEBUG) += mbxfbdebugfs.o | ||
diff --git a/drivers/video/mbx/mbxdebugfs.c b/drivers/video/mbx/mbxdebugfs.c new file mode 100644 index 000000000000..84aab3ad024e --- /dev/null +++ b/drivers/video/mbx/mbxdebugfs.c | |||
@@ -0,0 +1,188 @@ | |||
1 | #include <linux/debugfs.h> | ||
2 | |||
3 | #define BIG_BUFFER_SIZE (1024) | ||
4 | |||
5 | static char big_buffer[BIG_BUFFER_SIZE]; | ||
6 | |||
7 | struct mbxfb_debugfs_data { | ||
8 | struct dentry *dir; | ||
9 | struct dentry *sysconf; | ||
10 | struct dentry *clock; | ||
11 | struct dentry *display; | ||
12 | struct dentry *gsctl; | ||
13 | }; | ||
14 | |||
15 | static int open_file_generic(struct inode *inode, struct file *file) | ||
16 | { | ||
17 | file->private_data = inode->u.generic_ip; | ||
18 | return 0; | ||
19 | } | ||
20 | |||
21 | static ssize_t write_file_dummy(struct file *file, const char __user *buf, | ||
22 | size_t count, loff_t *ppos) | ||
23 | { | ||
24 | return count; | ||
25 | } | ||
26 | |||
27 | static ssize_t sysconf_read_file(struct file *file, char __user *userbuf, | ||
28 | size_t count, loff_t *ppos) | ||
29 | { | ||
30 | char * s = big_buffer; | ||
31 | |||
32 | s += sprintf(s, "SYSCFG = %08lx\n", SYSCFG); | ||
33 | s += sprintf(s, "PFBASE = %08lx\n", PFBASE); | ||
34 | s += sprintf(s, "PFCEIL = %08lx\n", PFCEIL); | ||
35 | s += sprintf(s, "POLLFLAG = %08lx\n", POLLFLAG); | ||
36 | s += sprintf(s, "SYSRST = %08lx\n", SYSRST); | ||
37 | |||
38 | return simple_read_from_buffer(userbuf, count, ppos, | ||
39 | big_buffer, s-big_buffer); | ||
40 | } | ||
41 | |||
42 | |||
43 | static ssize_t gsctl_read_file(struct file *file, char __user *userbuf, | ||
44 | size_t count, loff_t *ppos) | ||
45 | { | ||
46 | char * s = big_buffer; | ||
47 | |||
48 | s += sprintf(s, "GSCTRL = %08lx\n", GSCTRL); | ||
49 | s += sprintf(s, "VSCTRL = %08lx\n", VSCTRL); | ||
50 | s += sprintf(s, "GBBASE = %08lx\n", GBBASE); | ||
51 | s += sprintf(s, "VBBASE = %08lx\n", VBBASE); | ||
52 | s += sprintf(s, "GDRCTRL = %08lx\n", GDRCTRL); | ||
53 | s += sprintf(s, "VCMSK = %08lx\n", VCMSK); | ||
54 | s += sprintf(s, "GSCADR = %08lx\n", GSCADR); | ||
55 | s += sprintf(s, "VSCADR = %08lx\n", VSCADR); | ||
56 | s += sprintf(s, "VUBASE = %08lx\n", VUBASE); | ||
57 | s += sprintf(s, "VVBASE = %08lx\n", VVBASE); | ||
58 | s += sprintf(s, "GSADR = %08lx\n", GSADR); | ||
59 | s += sprintf(s, "VSADR = %08lx\n", VSADR); | ||
60 | s += sprintf(s, "HCCTRL = %08lx\n", HCCTRL); | ||
61 | s += sprintf(s, "HCSIZE = %08lx\n", HCSIZE); | ||
62 | s += sprintf(s, "HCPOS = %08lx\n", HCPOS); | ||
63 | s += sprintf(s, "HCBADR = %08lx\n", HCBADR); | ||
64 | s += sprintf(s, "HCCKMSK = %08lx\n", HCCKMSK); | ||
65 | s += sprintf(s, "GPLUT = %08lx\n", GPLUT); | ||
66 | |||
67 | return simple_read_from_buffer(userbuf, count, ppos, | ||
68 | big_buffer, s-big_buffer); | ||
69 | } | ||
70 | |||
71 | static ssize_t display_read_file(struct file *file, char __user *userbuf, | ||
72 | size_t count, loff_t *ppos) | ||
73 | { | ||
74 | char * s = big_buffer; | ||
75 | |||
76 | s += sprintf(s, "DSCTRL = %08lx\n", DSCTRL); | ||
77 | s += sprintf(s, "DHT01 = %08lx\n", DHT01); | ||
78 | s += sprintf(s, "DHT02 = %08lx\n", DHT02); | ||
79 | s += sprintf(s, "DHT03 = %08lx\n", DHT03); | ||
80 | s += sprintf(s, "DVT01 = %08lx\n", DVT01); | ||
81 | s += sprintf(s, "DVT02 = %08lx\n", DVT02); | ||
82 | s += sprintf(s, "DVT03 = %08lx\n", DVT03); | ||
83 | s += sprintf(s, "DBCOL = %08lx\n", DBCOL); | ||
84 | s += sprintf(s, "BGCOLOR = %08lx\n", BGCOLOR); | ||
85 | s += sprintf(s, "DINTRS = %08lx\n", DINTRS); | ||
86 | s += sprintf(s, "DINTRE = %08lx\n", DINTRE); | ||
87 | s += sprintf(s, "DINTRCNT = %08lx\n", DINTRCNT); | ||
88 | s += sprintf(s, "DSIG = %08lx\n", DSIG); | ||
89 | s += sprintf(s, "DMCTRL = %08lx\n", DMCTRL); | ||
90 | s += sprintf(s, "CLIPCTRL = %08lx\n", CLIPCTRL); | ||
91 | s += sprintf(s, "SPOCTRL = %08lx\n", SPOCTRL); | ||
92 | s += sprintf(s, "SVCTRL = %08lx\n", SVCTRL); | ||
93 | s += sprintf(s, "DLSTS = %08lx\n", DLSTS); | ||
94 | s += sprintf(s, "DLLCTRL = %08lx\n", DLLCTRL); | ||
95 | s += sprintf(s, "DVLNUM = %08lx\n", DVLNUM); | ||
96 | s += sprintf(s, "DUCTRL = %08lx\n", DUCTRL); | ||
97 | s += sprintf(s, "DVECTRL = %08lx\n", DVECTRL); | ||
98 | s += sprintf(s, "DHDET = %08lx\n", DHDET); | ||
99 | s += sprintf(s, "DVDET = %08lx\n", DVDET); | ||
100 | s += sprintf(s, "DODMSK = %08lx\n", DODMSK); | ||
101 | s += sprintf(s, "CSC01 = %08lx\n", CSC01); | ||
102 | s += sprintf(s, "CSC02 = %08lx\n", CSC02); | ||
103 | s += sprintf(s, "CSC03 = %08lx\n", CSC03); | ||
104 | s += sprintf(s, "CSC04 = %08lx\n", CSC04); | ||
105 | s += sprintf(s, "CSC05 = %08lx\n", CSC05); | ||
106 | |||
107 | return simple_read_from_buffer(userbuf, count, ppos, | ||
108 | big_buffer, s-big_buffer); | ||
109 | } | ||
110 | |||
111 | static ssize_t clock_read_file(struct file *file, char __user *userbuf, | ||
112 | size_t count, loff_t *ppos) | ||
113 | { | ||
114 | char * s = big_buffer; | ||
115 | |||
116 | s += sprintf(s, "SYSCLKSRC = %08lx\n", SYSCLKSRC); | ||
117 | s += sprintf(s, "PIXCLKSRC = %08lx\n", PIXCLKSRC); | ||
118 | s += sprintf(s, "CLKSLEEP = %08lx\n", CLKSLEEP); | ||
119 | s += sprintf(s, "COREPLL = %08lx\n", COREPLL); | ||
120 | s += sprintf(s, "DISPPLL = %08lx\n", DISPPLL); | ||
121 | s += sprintf(s, "PLLSTAT = %08lx\n", PLLSTAT); | ||
122 | s += sprintf(s, "VOVRCLK = %08lx\n", VOVRCLK); | ||
123 | s += sprintf(s, "PIXCLK = %08lx\n", PIXCLK); | ||
124 | s += sprintf(s, "MEMCLK = %08lx\n", MEMCLK); | ||
125 | s += sprintf(s, "M24CLK = %08lx\n", M24CLK); | ||
126 | s += sprintf(s, "MBXCLK = %08lx\n", MBXCLK); | ||
127 | s += sprintf(s, "SDCLK = %08lx\n", SDCLK); | ||
128 | s += sprintf(s, "PIXCLKDIV = %08lx\n", PIXCLKDIV); | ||
129 | |||
130 | return simple_read_from_buffer(userbuf, count, ppos, | ||
131 | big_buffer, s-big_buffer); | ||
132 | } | ||
133 | |||
134 | static struct file_operations sysconf_fops = { | ||
135 | .read = sysconf_read_file, | ||
136 | .write = write_file_dummy, | ||
137 | .open = open_file_generic, | ||
138 | }; | ||
139 | |||
140 | static struct file_operations clock_fops = { | ||
141 | .read = clock_read_file, | ||
142 | .write = write_file_dummy, | ||
143 | .open = open_file_generic, | ||
144 | }; | ||
145 | |||
146 | static struct file_operations display_fops = { | ||
147 | .read = display_read_file, | ||
148 | .write = write_file_dummy, | ||
149 | .open = open_file_generic, | ||
150 | }; | ||
151 | |||
152 | static struct file_operations gsctl_fops = { | ||
153 | .read = gsctl_read_file, | ||
154 | .write = write_file_dummy, | ||
155 | .open = open_file_generic, | ||
156 | }; | ||
157 | |||
158 | |||
159 | static void __devinit mbxfb_debugfs_init(struct fb_info *fbi) | ||
160 | { | ||
161 | struct mbxfb_info *mfbi = fbi->par; | ||
162 | struct mbxfb_debugfs_data *dbg; | ||
163 | |||
164 | dbg = kzalloc(sizeof(struct mbxfb_debugfs_data), GFP_KERNEL); | ||
165 | mfbi->debugfs_data = dbg; | ||
166 | |||
167 | dbg->dir = debugfs_create_dir("mbxfb", NULL); | ||
168 | dbg->sysconf = debugfs_create_file("sysconf", 0444, dbg->dir, | ||
169 | fbi, &sysconf_fops); | ||
170 | dbg->clock = debugfs_create_file("clock", 0444, dbg->dir, | ||
171 | fbi, &clock_fops); | ||
172 | dbg->display = debugfs_create_file("display", 0444, dbg->dir, | ||
173 | fbi, &display_fops); | ||
174 | dbg->gsctl = debugfs_create_file("gsctl", 0444, dbg->dir, | ||
175 | fbi, &gsctl_fops); | ||
176 | } | ||
177 | |||
178 | static void __devexit mbxfb_debugfs_remove(struct fb_info *fbi) | ||
179 | { | ||
180 | struct mbxfb_info *mfbi = fbi->par; | ||
181 | struct mbxfb_debugfs_data *dbg = mfbi->debugfs_data; | ||
182 | |||
183 | debugfs_remove(dbg->gsctl); | ||
184 | debugfs_remove(dbg->display); | ||
185 | debugfs_remove(dbg->clock); | ||
186 | debugfs_remove(dbg->sysconf); | ||
187 | debugfs_remove(dbg->dir); | ||
188 | } | ||
diff --git a/drivers/video/mbx/mbxfb.c b/drivers/video/mbx/mbxfb.c new file mode 100644 index 000000000000..6849ab75d403 --- /dev/null +++ b/drivers/video/mbx/mbxfb.c | |||
@@ -0,0 +1,683 @@ | |||
1 | /* | ||
2 | * linux/drivers/video/mbx/mbxfb.c | ||
3 | * | ||
4 | * Copyright (C) 2006 Compulab, Ltd. | ||
5 | * Mike Rapoport <mike@compulab.co.il> | ||
6 | * | ||
7 | * Based on pxafb.c | ||
8 | * | ||
9 | * This file is subject to the terms and conditions of the GNU General Public | ||
10 | * License. See the file COPYING in the main directory of this archive for | ||
11 | * more details. | ||
12 | * | ||
13 | * Intel 2700G (Marathon) Graphics Accelerator Frame Buffer Driver | ||
14 | * | ||
15 | */ | ||
16 | |||
17 | #include <linux/delay.h> | ||
18 | #include <linux/fb.h> | ||
19 | #include <linux/init.h> | ||
20 | #include <linux/module.h> | ||
21 | #include <linux/platform_device.h> | ||
22 | |||
23 | #include <asm/io.h> | ||
24 | |||
25 | #include <video/mbxfb.h> | ||
26 | |||
27 | #include "regs.h" | ||
28 | #include "reg_bits.h" | ||
29 | |||
30 | static unsigned long virt_base_2700; | ||
31 | |||
32 | #define MIN_XRES 16 | ||
33 | #define MIN_YRES 16 | ||
34 | #define MAX_XRES 2048 | ||
35 | #define MAX_YRES 2048 | ||
36 | |||
37 | #define MAX_PALETTES 16 | ||
38 | |||
39 | /* FIXME: take care of different chip revisions with different sizes | ||
40 | of ODFB */ | ||
41 | #define MEMORY_OFFSET 0x60000 | ||
42 | |||
43 | struct mbxfb_info { | ||
44 | struct device *dev; | ||
45 | |||
46 | struct resource *fb_res; | ||
47 | struct resource *fb_req; | ||
48 | |||
49 | struct resource *reg_res; | ||
50 | struct resource *reg_req; | ||
51 | |||
52 | void __iomem *fb_virt_addr; | ||
53 | unsigned long fb_phys_addr; | ||
54 | |||
55 | void __iomem *reg_virt_addr; | ||
56 | unsigned long reg_phys_addr; | ||
57 | |||
58 | int (*platform_probe) (struct fb_info * fb); | ||
59 | int (*platform_remove) (struct fb_info * fb); | ||
60 | |||
61 | u32 pseudo_palette[MAX_PALETTES]; | ||
62 | #ifdef CONFIG_FB_MBX_DEBUG | ||
63 | void *debugfs_data; | ||
64 | #endif | ||
65 | |||
66 | }; | ||
67 | |||
68 | static struct fb_var_screeninfo mbxfb_default __devinitdata = { | ||
69 | .xres = 640, | ||
70 | .yres = 480, | ||
71 | .xres_virtual = 640, | ||
72 | .yres_virtual = 480, | ||
73 | .bits_per_pixel = 16, | ||
74 | .red = {11, 5, 0}, | ||
75 | .green = {5, 6, 0}, | ||
76 | .blue = {0, 5, 0}, | ||
77 | .activate = FB_ACTIVATE_TEST, | ||
78 | .height = -1, | ||
79 | .width = -1, | ||
80 | .pixclock = 40000, | ||
81 | .left_margin = 48, | ||
82 | .right_margin = 16, | ||
83 | .upper_margin = 33, | ||
84 | .lower_margin = 10, | ||
85 | .hsync_len = 96, | ||
86 | .vsync_len = 2, | ||
87 | .vmode = FB_VMODE_NONINTERLACED, | ||
88 | .sync = FB_SYNC_HOR_HIGH_ACT | FB_SYNC_VERT_HIGH_ACT, | ||
89 | }; | ||
90 | |||
91 | static struct fb_fix_screeninfo mbxfb_fix __devinitdata = { | ||
92 | .id = "MBX", | ||
93 | .type = FB_TYPE_PACKED_PIXELS, | ||
94 | .visual = FB_VISUAL_TRUECOLOR, | ||
95 | .xpanstep = 0, | ||
96 | .ypanstep = 0, | ||
97 | .ywrapstep = 0, | ||
98 | .accel = FB_ACCEL_NONE, | ||
99 | }; | ||
100 | |||
101 | struct pixclock_div { | ||
102 | u8 m; | ||
103 | u8 n; | ||
104 | u8 p; | ||
105 | }; | ||
106 | |||
107 | static unsigned int mbxfb_get_pixclock(unsigned int pixclock_ps, | ||
108 | struct pixclock_div *div) | ||
109 | { | ||
110 | u8 m, n, p; | ||
111 | unsigned int err = 0; | ||
112 | unsigned int min_err = ~0x0; | ||
113 | unsigned int clk; | ||
114 | unsigned int best_clk = 0; | ||
115 | unsigned int ref_clk = 13000; /* FIXME: take from platform data */ | ||
116 | unsigned int pixclock; | ||
117 | |||
118 | /* convert pixclock to KHz */ | ||
119 | pixclock = PICOS2KHZ(pixclock_ps); | ||
120 | |||
121 | for (m = 1; m < 64; m++) { | ||
122 | for (n = 1; n < 8; n++) { | ||
123 | for (p = 0; p < 8; p++) { | ||
124 | clk = (ref_clk * m) / (n * (1 << p)); | ||
125 | err = (clk > pixclock) ? (clk - pixclock) : | ||
126 | (pixclock - clk); | ||
127 | if (err < min_err) { | ||
128 | min_err = err; | ||
129 | best_clk = clk; | ||
130 | div->m = m; | ||
131 | div->n = n; | ||
132 | div->p = p; | ||
133 | } | ||
134 | } | ||
135 | } | ||
136 | } | ||
137 | return KHZ2PICOS(best_clk); | ||
138 | } | ||
139 | |||
140 | static int mbxfb_setcolreg(u_int regno, u_int red, u_int green, u_int blue, | ||
141 | u_int trans, struct fb_info *info) | ||
142 | { | ||
143 | u32 val, ret = 1; | ||
144 | |||
145 | if (regno < MAX_PALETTES) { | ||
146 | u32 *pal = info->pseudo_palette; | ||
147 | |||
148 | val = (red & 0xf800) | ((green & 0xfc00) >> 5) | | ||
149 | ((blue & 0xf800) >> 11); | ||
150 | pal[regno] = val; | ||
151 | ret = 0; | ||
152 | } | ||
153 | |||
154 | return ret; | ||
155 | } | ||
156 | |||
157 | static int mbxfb_check_var(struct fb_var_screeninfo *var, struct fb_info *info) | ||
158 | { | ||
159 | struct pixclock_div div; | ||
160 | |||
161 | var->pixclock = mbxfb_get_pixclock(var->pixclock, &div); | ||
162 | |||
163 | if (var->xres < MIN_XRES) | ||
164 | var->xres = MIN_XRES; | ||
165 | if (var->yres < MIN_YRES) | ||
166 | var->yres = MIN_YRES; | ||
167 | if (var->xres > MAX_XRES) | ||
168 | return -EINVAL; | ||
169 | if (var->yres > MAX_YRES) | ||
170 | return -EINVAL; | ||
171 | var->xres_virtual = max(var->xres_virtual, var->xres); | ||
172 | var->yres_virtual = max(var->yres_virtual, var->yres); | ||
173 | |||
174 | switch (var->bits_per_pixel) { | ||
175 | /* 8 bits-per-pixel is not supported yet */ | ||
176 | case 8: | ||
177 | return -EINVAL; | ||
178 | case 16: | ||
179 | var->green.length = (var->green.length == 5) ? 5 : 6; | ||
180 | var->red.length = 5; | ||
181 | var->blue.length = 5; | ||
182 | var->transp.length = 6 - var->green.length; | ||
183 | var->blue.offset = 0; | ||
184 | var->green.offset = 5; | ||
185 | var->red.offset = 5 + var->green.length; | ||
186 | var->transp.offset = (5 + var->red.offset) & 15; | ||
187 | break; | ||
188 | case 24: /* RGB 888 */ | ||
189 | case 32: /* RGBA 8888 */ | ||
190 | var->red.offset = 16; | ||
191 | var->red.length = 8; | ||
192 | var->green.offset = 8; | ||
193 | var->green.length = 8; | ||
194 | var->blue.offset = 0; | ||
195 | var->blue.length = 8; | ||
196 | var->transp.length = var->bits_per_pixel - 24; | ||
197 | var->transp.offset = (var->transp.length) ? 24 : 0; | ||
198 | break; | ||
199 | } | ||
200 | var->red.msb_right = 0; | ||
201 | var->green.msb_right = 0; | ||
202 | var->blue.msb_right = 0; | ||
203 | var->transp.msb_right = 0; | ||
204 | |||
205 | return 0; | ||
206 | } | ||
207 | |||
208 | static int mbxfb_set_par(struct fb_info *info) | ||
209 | { | ||
210 | struct fb_var_screeninfo *var = &info->var; | ||
211 | struct pixclock_div div; | ||
212 | ushort hbps, ht, hfps, has; | ||
213 | ushort vbps, vt, vfps, vas; | ||
214 | u32 gsctrl = readl(GSCTRL); | ||
215 | u32 gsadr = readl(GSADR); | ||
216 | |||
217 | info->fix.line_length = var->xres_virtual * var->bits_per_pixel / 8; | ||
218 | |||
219 | /* setup color mode */ | ||
220 | gsctrl &= ~(FMsk(GSCTRL_GPIXFMT)); | ||
221 | /* FIXME: add *WORKING* support for 8-bits per color */ | ||
222 | if (info->var.bits_per_pixel == 8) { | ||
223 | return -EINVAL; | ||
224 | } else { | ||
225 | fb_dealloc_cmap(&info->cmap); | ||
226 | gsctrl &= ~GSCTRL_LUT_EN; | ||
227 | |||
228 | info->fix.visual = FB_VISUAL_TRUECOLOR; | ||
229 | switch (info->var.bits_per_pixel) { | ||
230 | case 16: | ||
231 | if (info->var.green.length == 5) | ||
232 | gsctrl |= GSCTRL_GPIXFMT_ARGB1555; | ||
233 | else | ||
234 | gsctrl |= GSCTRL_GPIXFMT_RGB565; | ||
235 | break; | ||
236 | case 24: | ||
237 | gsctrl |= GSCTRL_GPIXFMT_RGB888; | ||
238 | break; | ||
239 | case 32: | ||
240 | gsctrl |= GSCTRL_GPIXFMT_ARGB8888; | ||
241 | break; | ||
242 | } | ||
243 | } | ||
244 | |||
245 | /* setup resolution */ | ||
246 | gsctrl &= ~(FMsk(GSCTRL_GSWIDTH) | FMsk(GSCTRL_GSHEIGHT)); | ||
247 | gsctrl |= Gsctrl_Width(info->var.xres - 1) | | ||
248 | Gsctrl_Height(info->var.yres - 1); | ||
249 | writel(gsctrl, GSCTRL); | ||
250 | udelay(1000); | ||
251 | |||
252 | gsadr &= ~(FMsk(GSADR_SRCSTRIDE)); | ||
253 | gsadr |= Gsadr_Srcstride(info->var.xres * info->var.bits_per_pixel / | ||
254 | (8 * 16) - 1); | ||
255 | writel(gsadr, GSADR); | ||
256 | udelay(1000); | ||
257 | |||
258 | /* setup timings */ | ||
259 | var->pixclock = mbxfb_get_pixclock(info->var.pixclock, &div); | ||
260 | |||
261 | writel((Disp_Pll_M(div.m) | Disp_Pll_N(div.n) | | ||
262 | Disp_Pll_P(div.p) | DISP_PLL_EN), DISPPLL); | ||
263 | |||
264 | hbps = var->hsync_len; | ||
265 | has = hbps + var->left_margin; | ||
266 | hfps = has + var->xres; | ||
267 | ht = hfps + var->right_margin; | ||
268 | |||
269 | vbps = var->vsync_len; | ||
270 | vas = vbps + var->upper_margin; | ||
271 | vfps = vas + var->yres; | ||
272 | vt = vfps + var->lower_margin; | ||
273 | |||
274 | writel((Dht01_Hbps(hbps) | Dht01_Ht(ht)), DHT01); | ||
275 | writel((Dht02_Hlbs(has) | Dht02_Has(has)), DHT02); | ||
276 | writel((Dht03_Hfps(hfps) | Dht03_Hrbs(hfps)), DHT03); | ||
277 | writel((Dhdet_Hdes(has) | Dhdet_Hdef(hfps)), DHDET); | ||
278 | |||
279 | writel((Dvt01_Vbps(vbps) | Dvt01_Vt(vt)), DVT01); | ||
280 | writel((Dvt02_Vtbs(vas) | Dvt02_Vas(vas)), DVT02); | ||
281 | writel((Dvt03_Vfps(vfps) | Dvt03_Vbbs(vfps)), DVT03); | ||
282 | writel((Dvdet_Vdes(vas) | Dvdet_Vdef(vfps)), DVDET); | ||
283 | writel((Dvectrl_Vevent(vfps) | Dvectrl_Vfetch(vbps)), DVECTRL); | ||
284 | |||
285 | writel((readl(DSCTRL) | DSCTRL_SYNCGEN_EN), DSCTRL); | ||
286 | |||
287 | return 0; | ||
288 | } | ||
289 | |||
290 | static int mbxfb_blank(int blank, struct fb_info *info) | ||
291 | { | ||
292 | switch (blank) { | ||
293 | case FB_BLANK_POWERDOWN: | ||
294 | case FB_BLANK_VSYNC_SUSPEND: | ||
295 | case FB_BLANK_HSYNC_SUSPEND: | ||
296 | case FB_BLANK_NORMAL: | ||
297 | writel((readl(DSCTRL) & ~DSCTRL_SYNCGEN_EN), DSCTRL); | ||
298 | udelay(1000); | ||
299 | writel((readl(PIXCLK) & ~PIXCLK_EN), PIXCLK); | ||
300 | udelay(1000); | ||
301 | writel((readl(VOVRCLK) & ~VOVRCLK_EN), VOVRCLK); | ||
302 | udelay(1000); | ||
303 | break; | ||
304 | case FB_BLANK_UNBLANK: | ||
305 | writel((readl(DSCTRL) | DSCTRL_SYNCGEN_EN), DSCTRL); | ||
306 | udelay(1000); | ||
307 | writel((readl(PIXCLK) | PIXCLK_EN), PIXCLK); | ||
308 | udelay(1000); | ||
309 | break; | ||
310 | } | ||
311 | return 0; | ||
312 | } | ||
313 | |||
314 | static struct fb_ops mbxfb_ops = { | ||
315 | .owner = THIS_MODULE, | ||
316 | .fb_check_var = mbxfb_check_var, | ||
317 | .fb_set_par = mbxfb_set_par, | ||
318 | .fb_setcolreg = mbxfb_setcolreg, | ||
319 | .fb_fillrect = cfb_fillrect, | ||
320 | .fb_copyarea = cfb_copyarea, | ||
321 | .fb_imageblit = cfb_imageblit, | ||
322 | .fb_blank = mbxfb_blank, | ||
323 | }; | ||
324 | |||
325 | /* | ||
326 | Enable external SDRAM controller. Assume that all clocks are active | ||
327 | by now. | ||
328 | */ | ||
329 | static void __devinit setup_memc(struct fb_info *fbi) | ||
330 | { | ||
331 | struct mbxfb_info *mfbi = fbi->par; | ||
332 | unsigned long tmp; | ||
333 | int i; | ||
334 | |||
335 | /* FIXME: use platfrom specific parameters */ | ||
336 | /* setup SDRAM controller */ | ||
337 | writel((LMCFG_LMC_DS | LMCFG_LMC_TS | LMCFG_LMD_TS | | ||
338 | LMCFG_LMA_TS), | ||
339 | LMCFG); | ||
340 | udelay(1000); | ||
341 | |||
342 | writel(LMPWR_MC_PWR_ACT, LMPWR); | ||
343 | udelay(1000); | ||
344 | |||
345 | /* setup SDRAM timings */ | ||
346 | writel((Lmtim_Tras(7) | Lmtim_Trp(3) | Lmtim_Trcd(3) | | ||
347 | Lmtim_Trc(9) | Lmtim_Tdpl(2)), | ||
348 | LMTIM); | ||
349 | udelay(1000); | ||
350 | /* setup SDRAM refresh rate */ | ||
351 | writel(0xc2b, LMREFRESH); | ||
352 | udelay(1000); | ||
353 | /* setup SDRAM type parameters */ | ||
354 | writel((LMTYPE_CASLAT_3 | LMTYPE_BKSZ_2 | LMTYPE_ROWSZ_11 | | ||
355 | LMTYPE_COLSZ_8), | ||
356 | LMTYPE); | ||
357 | udelay(1000); | ||
358 | /* enable memory controller */ | ||
359 | writel(LMPWR_MC_PWR_ACT, LMPWR); | ||
360 | udelay(1000); | ||
361 | |||
362 | /* perform dummy reads */ | ||
363 | for ( i = 0; i < 16; i++ ) { | ||
364 | tmp = readl(fbi->screen_base); | ||
365 | } | ||
366 | } | ||
367 | |||
368 | static void enable_clocks(struct fb_info *fbi) | ||
369 | { | ||
370 | /* enable clocks */ | ||
371 | writel(SYSCLKSRC_PLL_2, SYSCLKSRC); | ||
372 | udelay(1000); | ||
373 | writel(PIXCLKSRC_PLL_1, PIXCLKSRC); | ||
374 | udelay(1000); | ||
375 | writel(0x00000000, CLKSLEEP); | ||
376 | udelay(1000); | ||
377 | writel((Core_Pll_M(0x17) | Core_Pll_N(0x3) | Core_Pll_P(0x0) | | ||
378 | CORE_PLL_EN), | ||
379 | COREPLL); | ||
380 | udelay(1000); | ||
381 | writel((Disp_Pll_M(0x1b) | Disp_Pll_N(0x7) | Disp_Pll_P(0x1) | | ||
382 | DISP_PLL_EN), | ||
383 | DISPPLL); | ||
384 | |||
385 | writel(0x00000000, VOVRCLK); | ||
386 | udelay(1000); | ||
387 | writel(PIXCLK_EN, PIXCLK); | ||
388 | udelay(1000); | ||
389 | writel(MEMCLK_EN, MEMCLK); | ||
390 | udelay(1000); | ||
391 | writel(0x00000006, M24CLK); | ||
392 | udelay(1000); | ||
393 | writel(0x00000006, MBXCLK); | ||
394 | udelay(1000); | ||
395 | writel(SDCLK_EN, SDCLK); | ||
396 | udelay(1000); | ||
397 | writel(0x00000001, PIXCLKDIV); | ||
398 | udelay(1000); | ||
399 | } | ||
400 | |||
401 | static void __devinit setup_graphics(struct fb_info *fbi) | ||
402 | { | ||
403 | unsigned long gsctrl; | ||
404 | |||
405 | gsctrl = GSCTRL_GAMMA_EN | Gsctrl_Width(fbi->var.xres - 1) | | ||
406 | Gsctrl_Height(fbi->var.yres - 1); | ||
407 | switch (fbi->var.bits_per_pixel) { | ||
408 | case 16: | ||
409 | if (fbi->var.green.length == 5) | ||
410 | gsctrl |= GSCTRL_GPIXFMT_ARGB1555; | ||
411 | else | ||
412 | gsctrl |= GSCTRL_GPIXFMT_RGB565; | ||
413 | break; | ||
414 | case 24: | ||
415 | gsctrl |= GSCTRL_GPIXFMT_RGB888; | ||
416 | break; | ||
417 | case 32: | ||
418 | gsctrl |= GSCTRL_GPIXFMT_ARGB8888; | ||
419 | break; | ||
420 | } | ||
421 | |||
422 | writel(gsctrl, GSCTRL); | ||
423 | udelay(1000); | ||
424 | writel(0x00000000, GBBASE); | ||
425 | udelay(1000); | ||
426 | writel(0x00ffffff, GDRCTRL); | ||
427 | udelay(1000); | ||
428 | writel((GSCADR_STR_EN | Gscadr_Gbase_Adr(0x6000)), GSCADR); | ||
429 | udelay(1000); | ||
430 | writel(0x00000000, GPLUT); | ||
431 | udelay(1000); | ||
432 | } | ||
433 | |||
434 | static void __devinit setup_display(struct fb_info *fbi) | ||
435 | { | ||
436 | unsigned long dsctrl = 0; | ||
437 | |||
438 | dsctrl = DSCTRL_BLNK_POL; | ||
439 | if (fbi->var.sync & FB_SYNC_HOR_HIGH_ACT) | ||
440 | dsctrl |= DSCTRL_HS_POL; | ||
441 | if (fbi->var.sync & FB_SYNC_VERT_HIGH_ACT) | ||
442 | dsctrl |= DSCTRL_VS_POL; | ||
443 | writel(dsctrl, DSCTRL); | ||
444 | udelay(1000); | ||
445 | writel(0xd0303010, DMCTRL); | ||
446 | udelay(1000); | ||
447 | writel((readl(DSCTRL) | DSCTRL_SYNCGEN_EN), DSCTRL); | ||
448 | } | ||
449 | |||
450 | static void __devinit enable_controller(struct fb_info *fbi) | ||
451 | { | ||
452 | writel(SYSRST_RST, SYSRST); | ||
453 | udelay(1000); | ||
454 | |||
455 | |||
456 | enable_clocks(fbi); | ||
457 | setup_memc(fbi); | ||
458 | setup_graphics(fbi); | ||
459 | setup_display(fbi); | ||
460 | } | ||
461 | |||
462 | #ifdef CONFIG_PM | ||
463 | /* | ||
464 | * Power management hooks. Note that we won't be called from IRQ context, | ||
465 | * unlike the blank functions above, so we may sleep. | ||
466 | */ | ||
467 | static int mbxfb_suspend(struct platform_device *dev, pm_message_t state) | ||
468 | { | ||
469 | /* make frame buffer memory enter self-refresh mode */ | ||
470 | writel(LMPWR_MC_PWR_SRM, LMPWR); | ||
471 | while (LMPWRSTAT != LMPWRSTAT_MC_PWR_SRM) | ||
472 | ; /* empty statement */ | ||
473 | |||
474 | /* reset the device, since it's initial state is 'mostly sleeping' */ | ||
475 | writel(SYSRST_RST, SYSRST); | ||
476 | return 0; | ||
477 | } | ||
478 | |||
479 | static int mbxfb_resume(struct platform_device *dev) | ||
480 | { | ||
481 | struct fb_info *fbi = platform_get_drvdata(dev); | ||
482 | |||
483 | enable_clocks(fbi); | ||
484 | /* setup_graphics(fbi); */ | ||
485 | /* setup_display(fbi); */ | ||
486 | |||
487 | writel((readl(DSCTRL) | DSCTRL_SYNCGEN_EN), DSCTRL); | ||
488 | return 0; | ||
489 | } | ||
490 | #else | ||
491 | #define mbxfb_suspend NULL | ||
492 | #define mbxfb_resume NULL | ||
493 | #endif | ||
494 | |||
495 | /* debugfs entries */ | ||
496 | #ifndef CONFIG_FB_MBX_DEBUG | ||
497 | #define mbxfb_debugfs_init(x) do {} while(0) | ||
498 | #define mbxfb_debugfs_remove(x) do {} while(0) | ||
499 | #endif | ||
500 | |||
501 | #define res_size(_r) (((_r)->end - (_r)->start) + 1) | ||
502 | |||
503 | static int __devinit mbxfb_probe(struct platform_device *dev) | ||
504 | { | ||
505 | int ret; | ||
506 | struct fb_info *fbi; | ||
507 | struct mbxfb_info *mfbi; | ||
508 | struct mbxfb_platform_data *pdata; | ||
509 | |||
510 | dev_dbg(dev, "mbxfb_probe\n"); | ||
511 | |||
512 | fbi = framebuffer_alloc(sizeof(struct mbxfb_info), &dev->dev); | ||
513 | if (fbi == NULL) { | ||
514 | dev_err(&dev->dev, "framebuffer_alloc failed\n"); | ||
515 | return -ENOMEM; | ||
516 | } | ||
517 | |||
518 | mfbi = fbi->par; | ||
519 | fbi->pseudo_palette = mfbi->pseudo_palette; | ||
520 | pdata = dev->dev.platform_data; | ||
521 | if (pdata->probe) | ||
522 | mfbi->platform_probe = pdata->probe; | ||
523 | if (pdata->remove) | ||
524 | mfbi->platform_remove = pdata->remove; | ||
525 | |||
526 | mfbi->fb_res = platform_get_resource(dev, IORESOURCE_MEM, 0); | ||
527 | mfbi->reg_res = platform_get_resource(dev, IORESOURCE_MEM, 1); | ||
528 | |||
529 | if (!mfbi->fb_res || !mfbi->reg_res) { | ||
530 | dev_err(&dev->dev, "no resources found\n"); | ||
531 | ret = -ENODEV; | ||
532 | goto err1; | ||
533 | } | ||
534 | |||
535 | mfbi->fb_req = request_mem_region(mfbi->fb_res->start, | ||
536 | res_size(mfbi->fb_res), dev->name); | ||
537 | if (mfbi->fb_req == NULL) { | ||
538 | dev_err(&dev->dev, "failed to claim framebuffer memory\n"); | ||
539 | ret = -EINVAL; | ||
540 | goto err1; | ||
541 | } | ||
542 | mfbi->fb_phys_addr = mfbi->fb_res->start; | ||
543 | |||
544 | mfbi->reg_req = request_mem_region(mfbi->reg_res->start, | ||
545 | res_size(mfbi->reg_res), dev->name); | ||
546 | if (mfbi->reg_req == NULL) { | ||
547 | dev_err(&dev->dev, "failed to claim Marathon registers\n"); | ||
548 | ret = -EINVAL; | ||
549 | goto err2; | ||
550 | } | ||
551 | mfbi->reg_phys_addr = mfbi->reg_res->start; | ||
552 | |||
553 | mfbi->reg_virt_addr = ioremap_nocache(mfbi->reg_phys_addr, | ||
554 | res_size(mfbi->reg_req)); | ||
555 | if (!mfbi->reg_virt_addr) { | ||
556 | dev_err(&dev->dev, "failed to ioremap Marathon registers\n"); | ||
557 | ret = -EINVAL; | ||
558 | goto err3; | ||
559 | } | ||
560 | virt_base_2700 = (unsigned long)mfbi->reg_virt_addr; | ||
561 | |||
562 | mfbi->fb_virt_addr = ioremap_nocache(mfbi->fb_phys_addr, | ||
563 | res_size(mfbi->fb_req)); | ||
564 | if (!mfbi->reg_virt_addr) { | ||
565 | dev_err(&dev->dev, "failed to ioremap frame buffer\n"); | ||
566 | ret = -EINVAL; | ||
567 | goto err4; | ||
568 | } | ||
569 | |||
570 | /* FIXME: get from platform */ | ||
571 | fbi->screen_base = (char __iomem *)(mfbi->fb_virt_addr + 0x60000); | ||
572 | fbi->screen_size = 8 * 1024 * 1024; /* 8 Megs */ | ||
573 | fbi->fbops = &mbxfb_ops; | ||
574 | |||
575 | fbi->var = mbxfb_default; | ||
576 | fbi->fix = mbxfb_fix; | ||
577 | fbi->fix.smem_start = mfbi->fb_phys_addr + 0x60000; | ||
578 | fbi->fix.smem_len = 8 * 1024 * 1024; | ||
579 | fbi->fix.line_length = 640 * 2; | ||
580 | |||
581 | ret = fb_alloc_cmap(&fbi->cmap, 256, 0); | ||
582 | if (ret < 0) { | ||
583 | dev_err(&dev->dev, "fb_alloc_cmap failed\n"); | ||
584 | ret = -EINVAL; | ||
585 | goto err5; | ||
586 | } | ||
587 | |||
588 | platform_set_drvdata(dev, fbi); | ||
589 | |||
590 | printk(KERN_INFO "fb%d: mbx frame buffer device\n", fbi->node); | ||
591 | |||
592 | if (mfbi->platform_probe) | ||
593 | mfbi->platform_probe(fbi); | ||
594 | |||
595 | enable_controller(fbi); | ||
596 | |||
597 | mbxfb_debugfs_init(fbi); | ||
598 | |||
599 | ret = register_framebuffer(fbi); | ||
600 | if (ret < 0) { | ||
601 | dev_err(&dev->dev, "register_framebuffer failed\n"); | ||
602 | ret = -EINVAL; | ||
603 | goto err6; | ||
604 | } | ||
605 | |||
606 | return 0; | ||
607 | |||
608 | err6: | ||
609 | fb_dealloc_cmap(&fbi->cmap); | ||
610 | err5: | ||
611 | iounmap(mfbi->fb_virt_addr); | ||
612 | err4: | ||
613 | iounmap(mfbi->reg_virt_addr); | ||
614 | err3: | ||
615 | release_mem_region(mfbi->reg_res->start, res_size(mfbi->reg_res)); | ||
616 | err2: | ||
617 | release_mem_region(mfbi->fb_res->start, res_size(mfbi->fb_res)); | ||
618 | err1: | ||
619 | framebuffer_release(fbi); | ||
620 | |||
621 | return ret; | ||
622 | } | ||
623 | |||
624 | static int __devexit mbxfb_remove(struct platform_device *dev) | ||
625 | { | ||
626 | struct fb_info *fbi = platform_get_drvdata(dev); | ||
627 | |||
628 | writel(SYSRST_RST, SYSRST); | ||
629 | udelay(1000); | ||
630 | |||
631 | mbxfb_debugfs_remove(fbi); | ||
632 | |||
633 | if (fbi) { | ||
634 | struct mbxfb_info *mfbi = fbi->par; | ||
635 | |||
636 | unregister_framebuffer(fbi); | ||
637 | if (mfbi) { | ||
638 | if (mfbi->platform_remove) | ||
639 | mfbi->platform_remove(fbi); | ||
640 | |||
641 | if (mfbi->fb_virt_addr) | ||
642 | iounmap(mfbi->fb_virt_addr); | ||
643 | if (mfbi->reg_virt_addr) | ||
644 | iounmap(mfbi->reg_virt_addr); | ||
645 | if (mfbi->reg_req) | ||
646 | release_mem_region(mfbi->reg_req->start, | ||
647 | res_size(mfbi->reg_req)); | ||
648 | if (mfbi->fb_req) | ||
649 | release_mem_region(mfbi->fb_req->start, | ||
650 | res_size(mfbi->fb_req)); | ||
651 | } | ||
652 | framebuffer_release(fbi); | ||
653 | } | ||
654 | |||
655 | return 0; | ||
656 | } | ||
657 | |||
658 | static struct platform_driver mbxfb_driver = { | ||
659 | .probe = mbxfb_probe, | ||
660 | .remove = mbxfb_remove, | ||
661 | .suspend = mbxfb_suspend, | ||
662 | .resume = mbxfb_resume, | ||
663 | .driver = { | ||
664 | .name = "mbx-fb", | ||
665 | }, | ||
666 | }; | ||
667 | |||
668 | int __devinit mbxfb_init(void) | ||
669 | { | ||
670 | return platform_driver_register(&mbxfb_driver); | ||
671 | } | ||
672 | |||
673 | static void __devexit mbxfb_exit(void) | ||
674 | { | ||
675 | platform_driver_unregister(&mbxfb_driver); | ||
676 | } | ||
677 | |||
678 | module_init(mbxfb_init); | ||
679 | module_exit(mbxfb_exit); | ||
680 | |||
681 | MODULE_DESCRIPTION("loadable framebuffer driver for Marathon device"); | ||
682 | MODULE_AUTHOR("Mike Rapoport, Compulab"); | ||
683 | MODULE_LICENSE("GPL"); | ||
diff --git a/drivers/video/mbx/reg_bits.h b/drivers/video/mbx/reg_bits.h new file mode 100644 index 000000000000..c226a8e45312 --- /dev/null +++ b/drivers/video/mbx/reg_bits.h | |||
@@ -0,0 +1,418 @@ | |||
1 | #ifndef __REG_BITS_2700G_ | ||
2 | #define __REG_BITS_2700G_ | ||
3 | |||
4 | /* use defines from asm-arm/arch-pxa/bitfields.h for bit fields access */ | ||
5 | #define UData(Data) ((unsigned long) (Data)) | ||
6 | #define Fld(Size, Shft) (((Size) << 16) + (Shft)) | ||
7 | #define FSize(Field) ((Field) >> 16) | ||
8 | #define FShft(Field) ((Field) & 0x0000FFFF) | ||
9 | #define FMsk(Field) (((UData (1) << FSize (Field)) - 1) << FShft (Field)) | ||
10 | #define FAlnMsk(Field) ((UData (1) << FSize (Field)) - 1) | ||
11 | #define F1stBit(Field) (UData (1) << FShft (Field)) | ||
12 | |||
13 | #define SYSRST_RST (1 << 0) | ||
14 | |||
15 | /* SYSCLKSRC - SYSCLK Source Control Register */ | ||
16 | #define SYSCLKSRC_SEL Fld(2,0) | ||
17 | #define SYSCLKSRC_REF ((0x0) << FShft(SYSCLKSRC_SEL)) | ||
18 | #define SYSCLKSRC_PLL_1 ((0x1) << FShft(SYSCLKSRC_SEL)) | ||
19 | #define SYSCLKSRC_PLL_2 ((0x2) << FShft(SYSCLKSRC_SEL)) | ||
20 | |||
21 | /* PIXCLKSRC - PIXCLK Source Control Register */ | ||
22 | #define PIXCLKSRC_SEL Fld(2,0) | ||
23 | #define PIXCLKSRC_REF ((0x0) << FShft(PIXCLKSRC_SEL)) | ||
24 | #define PIXCLKSRC_PLL_1 ((0x1) << FShft(PIXCLKSRC_SEL)) | ||
25 | #define PIXCLKSRC_PLL_2 ((0x2) << FShft(PIXCLKSRC_SEL)) | ||
26 | |||
27 | /* Clock Disable Register */ | ||
28 | #define CLKSLEEP_SLP (1 << 0) | ||
29 | |||
30 | /* Core PLL Control Register */ | ||
31 | #define CORE_PLL_M Fld(6,7) | ||
32 | #define Core_Pll_M(x) ((x) << FShft(CORE_PLL_M)) | ||
33 | #define CORE_PLL_N Fld(3,4) | ||
34 | #define Core_Pll_N(x) ((x) << FShft(CORE_PLL_N)) | ||
35 | #define CORE_PLL_P Fld(3,1) | ||
36 | #define Core_Pll_P(x) ((x) << FShft(CORE_PLL_P)) | ||
37 | #define CORE_PLL_EN (1 << 0) | ||
38 | |||
39 | /* Display PLL Control Register */ | ||
40 | #define DISP_PLL_M Fld(6,7) | ||
41 | #define Disp_Pll_M(x) ((x) << FShft(DISP_PLL_M)) | ||
42 | #define DISP_PLL_N Fld(3,4) | ||
43 | #define Disp_Pll_N(x) ((x) << FShft(DISP_PLL_N)) | ||
44 | #define DISP_PLL_P Fld(3,1) | ||
45 | #define Disp_Pll_P(x) ((x) << FShft(DISP_PLL_P)) | ||
46 | #define DISP_PLL_EN (1 << 0) | ||
47 | |||
48 | /* PLL status register */ | ||
49 | #define PLLSTAT_CORE_PLL_LOST_L (1 << 3) | ||
50 | #define PLLSTAT_CORE_PLL_LSTS (1 << 2) | ||
51 | #define PLLSTAT_DISP_PLL_LOST_L (1 << 1) | ||
52 | #define PLLSTAT_DISP_PLL_LSTS (1 << 0) | ||
53 | |||
54 | /* Video and scale clock control register */ | ||
55 | #define VOVRCLK_EN (1 << 0) | ||
56 | |||
57 | /* Pixel clock control register */ | ||
58 | #define PIXCLK_EN (1 << 0) | ||
59 | |||
60 | /* Memory clock control register */ | ||
61 | #define MEMCLK_EN (1 << 0) | ||
62 | |||
63 | /* MBX clock control register */ | ||
64 | #define MBXCLK_DIV Fld(2,2) | ||
65 | #define MBXCLK_DIV_1 ((0x0) << FShft(MBXCLK_DIV)) | ||
66 | #define MBXCLK_DIV_2 ((0x1) << FShft(MBXCLK_DIV)) | ||
67 | #define MBXCLK_DIV_3 ((0x2) << FShft(MBXCLK_DIV)) | ||
68 | #define MBXCLK_DIV_4 ((0x3) << FShft(MBXCLK_DIV)) | ||
69 | #define MBXCLK_EN Fld(2,0) | ||
70 | #define MBXCLK_EN_NONE ((0x0) << FShft(MBXCLK_EN)) | ||
71 | #define MBXCLK_EN_2D ((0x1) << FShft(MBXCLK_EN)) | ||
72 | #define MBXCLK_EN_BOTH ((0x2) << FShft(MBXCLK_EN)) | ||
73 | |||
74 | /* M24 clock control register */ | ||
75 | #define M24CLK_DIV Fld(2,1) | ||
76 | #define M24CLK_DIV_1 ((0x0) << FShft(M24CLK_DIV)) | ||
77 | #define M24CLK_DIV_2 ((0x1) << FShft(M24CLK_DIV)) | ||
78 | #define M24CLK_DIV_3 ((0x2) << FShft(M24CLK_DIV)) | ||
79 | #define M24CLK_DIV_4 ((0x3) << FShft(M24CLK_DIV)) | ||
80 | #define M24CLK_EN (1 << 0) | ||
81 | |||
82 | /* SDRAM clock control register */ | ||
83 | #define SDCLK_EN (1 << 0) | ||
84 | |||
85 | /* PixClk Divisor Register */ | ||
86 | #define PIXCLKDIV_PD Fld(9,0) | ||
87 | #define Pixclkdiv_Pd(x) ((x) << FShft(PIXCLKDIV_PD)) | ||
88 | |||
89 | /* LCD Config control register */ | ||
90 | #define LCDCFG_IN_FMT Fld(3,28) | ||
91 | #define Lcdcfg_In_Fmt(x) ((x) << FShft(LCDCFG_IN_FMT)) | ||
92 | #define LCDCFG_LCD1DEN_POL (1 << 27) | ||
93 | #define LCDCFG_LCD1FCLK_POL (1 << 26) | ||
94 | #define LCDCFG_LCD1LCLK_POL (1 << 25) | ||
95 | #define LCDCFG_LCD1D_POL (1 << 24) | ||
96 | #define LCDCFG_LCD2DEN_POL (1 << 23) | ||
97 | #define LCDCFG_LCD2FCLK_POL (1 << 22) | ||
98 | #define LCDCFG_LCD2LCLK_POL (1 << 21) | ||
99 | #define LCDCFG_LCD2D_POL (1 << 20) | ||
100 | #define LCDCFG_LCD1_TS (1 << 19) | ||
101 | #define LCDCFG_LCD1D_DS (1 << 18) | ||
102 | #define LCDCFG_LCD1C_DS (1 << 17) | ||
103 | #define LCDCFG_LCD1_IS_IN (1 << 16) | ||
104 | #define LCDCFG_LCD2_TS (1 << 3) | ||
105 | #define LCDCFG_LCD2D_DS (1 << 2) | ||
106 | #define LCDCFG_LCD2C_DS (1 << 1) | ||
107 | #define LCDCFG_LCD2_IS_IN (1 << 0) | ||
108 | |||
109 | /* On-Die Frame Buffer Power Control Register */ | ||
110 | #define ODFBPWR_SLOW (1 << 2) | ||
111 | #define ODFBPWR_MODE Fld(2,0) | ||
112 | #define ODFBPWR_MODE_ACT ((0x0) << FShft(ODFBPWR_MODE)) | ||
113 | #define ODFBPWR_MODE_ACT_LP ((0x1) << FShft(ODFBPWR_MODE)) | ||
114 | #define ODFBPWR_MODE_SLEEP ((0x2) << FShft(ODFBPWR_MODE)) | ||
115 | #define ODFBPWR_MODE_SHUTD ((0x3) << FShft(ODFBPWR_MODE)) | ||
116 | |||
117 | /* On-Die Frame Buffer Power State Status Register */ | ||
118 | #define ODFBSTAT_ACT (1 << 2) | ||
119 | #define ODFBSTAT_SLP (1 << 1) | ||
120 | #define ODFBSTAT_SDN (1 << 0) | ||
121 | |||
122 | /* LMRST - Local Memory (SDRAM) Reset */ | ||
123 | #define LMRST_MC_RST (1 << 0) | ||
124 | |||
125 | /* LMCFG - Local Memory (SDRAM) Configuration Register */ | ||
126 | #define LMCFG_LMC_DS (1 << 5) | ||
127 | #define LMCFG_LMD_DS (1 << 4) | ||
128 | #define LMCFG_LMA_DS (1 << 3) | ||
129 | #define LMCFG_LMC_TS (1 << 2) | ||
130 | #define LMCFG_LMD_TS (1 << 1) | ||
131 | #define LMCFG_LMA_TS (1 << 0) | ||
132 | |||
133 | /* LMPWR - Local Memory (SDRAM) Power Control Register */ | ||
134 | #define LMPWR_MC_PWR_CNT Fld(2,0) | ||
135 | #define LMPWR_MC_PWR_ACT ((0x0) << FShft(LMPWR_MC_PWR_CNT)) /* Active */ | ||
136 | #define LMPWR_MC_PWR_SRM ((0x1) << FShft(LMPWR_MC_PWR_CNT)) /* Self-refresh */ | ||
137 | #define LMPWR_MC_PWR_DPD ((0x3) << FShft(LMPWR_MC_PWR_CNT)) /* deep power down */ | ||
138 | |||
139 | /* LMPWRSTAT - Local Memory (SDRAM) Power Status Register */ | ||
140 | #define LMPWRSTAT_MC_PWR_CNT Fld(2,0) | ||
141 | #define LMPWRSTAT_MC_PWR_ACT ((0x0) << FShft(LMPWRSTAT_MC_PWR_CNT)) /* Active */ | ||
142 | #define LMPWRSTAT_MC_PWR_SRM ((0x1) << FShft(LMPWRSTAT_MC_PWR_CNT)) /* Self-refresh */ | ||
143 | #define LMPWRSTAT_MC_PWR_DPD ((0x3) << FShft(LMPWRSTAT_MC_PWR_CNT)) /* deep power down */ | ||
144 | |||
145 | /* LMTYPE - Local Memory (SDRAM) Type Register */ | ||
146 | #define LMTYPE_CASLAT Fld(3,10) | ||
147 | #define LMTYPE_CASLAT_1 ((0x1) << FShft(LMTYPE_CASLAT)) | ||
148 | #define LMTYPE_CASLAT_2 ((0x2) << FShft(LMTYPE_CASLAT)) | ||
149 | #define LMTYPE_CASLAT_3 ((0x3) << FShft(LMTYPE_CASLAT)) | ||
150 | #define LMTYPE_BKSZ Fld(2,8) | ||
151 | #define LMTYPE_BKSZ_1 ((0x1) << FShft(LMTYPE_BKSZ)) | ||
152 | #define LMTYPE_BKSZ_2 ((0x2) << FShft(LMTYPE_BKSZ)) | ||
153 | #define LMTYPE_ROWSZ Fld(4,4) | ||
154 | #define LMTYPE_ROWSZ_11 ((0xb) << FShft(LMTYPE_ROWSZ)) | ||
155 | #define LMTYPE_ROWSZ_12 ((0xc) << FShft(LMTYPE_ROWSZ)) | ||
156 | #define LMTYPE_ROWSZ_13 ((0xd) << FShft(LMTYPE_ROWSZ)) | ||
157 | #define LMTYPE_COLSZ Fld(4,0) | ||
158 | #define LMTYPE_COLSZ_7 ((0x7) << FShft(LMTYPE_COLSZ)) | ||
159 | #define LMTYPE_COLSZ_8 ((0x8) << FShft(LMTYPE_COLSZ)) | ||
160 | #define LMTYPE_COLSZ_9 ((0x9) << FShft(LMTYPE_COLSZ)) | ||
161 | #define LMTYPE_COLSZ_10 ((0xa) << FShft(LMTYPE_COLSZ)) | ||
162 | #define LMTYPE_COLSZ_11 ((0xb) << FShft(LMTYPE_COLSZ)) | ||
163 | #define LMTYPE_COLSZ_12 ((0xc) << FShft(LMTYPE_COLSZ)) | ||
164 | |||
165 | /* LMTIM - Local Memory (SDRAM) Timing Register */ | ||
166 | #define LMTIM_TRAS Fld(4,16) | ||
167 | #define Lmtim_Tras(x) ((x) << FShft(LMTIM_TRAS)) | ||
168 | #define LMTIM_TRP Fld(4,12) | ||
169 | #define Lmtim_Trp(x) ((x) << FShft(LMTIM_TRP)) | ||
170 | #define LMTIM_TRCD Fld(4,8) | ||
171 | #define Lmtim_Trcd(x) ((x) << FShft(LMTIM_TRCD)) | ||
172 | #define LMTIM_TRC Fld(4,4) | ||
173 | #define Lmtim_Trc(x) ((x) << FShft(LMTIM_TRC)) | ||
174 | #define LMTIM_TDPL Fld(4,0) | ||
175 | #define Lmtim_Tdpl(x) ((x) << FShft(LMTIM_TDPL)) | ||
176 | |||
177 | /* LMREFRESH - Local Memory (SDRAM) tREF Control Register */ | ||
178 | #define LMREFRESH_TREF Fld(2,0) | ||
179 | #define Lmrefresh_Tref(x) ((x) << FShft(LMREFRESH_TREF)) | ||
180 | |||
181 | /* GSCTRL - Graphics surface control register */ | ||
182 | #define GSCTRL_LUT_EN (1 << 31) | ||
183 | #define GSCTRL_GPIXFMT Fld(4,27) | ||
184 | #define GSCTRL_GPIXFMT_INDEXED ((0x0) << FShft(GSCTRL_GPIXFMT)) | ||
185 | #define GSCTRL_GPIXFMT_ARGB4444 ((0x4) << FShft(GSCTRL_GPIXFMT)) | ||
186 | #define GSCTRL_GPIXFMT_ARGB1555 ((0x5) << FShft(GSCTRL_GPIXFMT)) | ||
187 | #define GSCTRL_GPIXFMT_RGB888 ((0x6) << FShft(GSCTRL_GPIXFMT)) | ||
188 | #define GSCTRL_GPIXFMT_RGB565 ((0x7) << FShft(GSCTRL_GPIXFMT)) | ||
189 | #define GSCTRL_GPIXFMT_ARGB8888 ((0x8) << FShft(GSCTRL_GPIXFMT)) | ||
190 | #define GSCTRL_GAMMA_EN (1 << 26) | ||
191 | |||
192 | #define GSCTRL_GSWIDTH Fld(11,11) | ||
193 | #define Gsctrl_Width(Pixel) /* Display Width [1..2048 pix.] */ \ | ||
194 | (((Pixel) - 1) << FShft(GSCTRL_GSWIDTH)) | ||
195 | |||
196 | #define GSCTRL_GSHEIGHT Fld(11,0) | ||
197 | #define Gsctrl_Height(Pixel) /* Display Height [1..2048 pix.] */ \ | ||
198 | (((Pixel) - 1) << FShft(GSCTRL_GSHEIGHT)) | ||
199 | |||
200 | /* GBBASE fileds */ | ||
201 | #define GBBASE_GLALPHA Fld(8,24) | ||
202 | #define Gbbase_Glalpha(x) ((x) << FShft(GBBASE_GLALPHA)) | ||
203 | |||
204 | #define GBBASE_COLKEY Fld(24,0) | ||
205 | #define Gbbase_Colkey(x) ((x) << FShft(GBBASE_COLKEY)) | ||
206 | |||
207 | /* GDRCTRL fields */ | ||
208 | #define GDRCTRL_PIXDBL (1 << 31) | ||
209 | #define GDRCTRL_PIXHLV (1 << 30) | ||
210 | #define GDRCTRL_LNDBL (1 << 29) | ||
211 | #define GDRCTRL_LNHLV (1 << 28) | ||
212 | #define GDRCTRL_COLKEYM Fld(24,0) | ||
213 | #define Gdrctrl_Colkeym(x) ((x) << FShft(GDRCTRL_COLKEYM)) | ||
214 | |||
215 | /* GSCADR graphics stream control address register fields */ | ||
216 | #define GSCADR_STR_EN (1 << 31) | ||
217 | #define GSCADR_COLKEY_EN (1 << 30) | ||
218 | #define GSCADR_COLKEYSCR (1 << 29) | ||
219 | #define GSCADR_BLEND_M Fld(2,27) | ||
220 | #define GSCADR_BLEND_NONE ((0x0) << FShft(GSCADR_BLEND_M)) | ||
221 | #define GSCADR_BLEND_INV ((0x1) << FShft(GSCADR_BLEND_M)) | ||
222 | #define GSCADR_BLEND_GLOB ((0x2) << FShft(GSCADR_BLEND_M)) | ||
223 | #define GSCADR_BLEND_PIX ((0x3) << FShft(GSCADR_BLEND_M)) | ||
224 | #define GSCADR_BLEND_POS Fld(2,24) | ||
225 | #define GSCADR_BLEND_GFX ((0x0) << FShft(GSCADR_BLEND_POS)) | ||
226 | #define GSCADR_BLEND_VID ((0x1) << FShft(GSCADR_BLEND_POS)) | ||
227 | #define GSCADR_BLEND_CUR ((0x2) << FShft(GSCADR_BLEND_POS)) | ||
228 | #define GSCADR_GBASE_ADR Fld(23,0) | ||
229 | #define Gscadr_Gbase_Adr(x) ((x) << FShft(GSCADR_GBASE_ADR)) | ||
230 | |||
231 | /* GSADR graphics stride address register fields */ | ||
232 | #define GSADR_SRCSTRIDE Fld(10,22) | ||
233 | #define Gsadr_Srcstride(x) ((x) << FShft(GSADR_SRCSTRIDE)) | ||
234 | #define GSADR_XSTART Fld(11,11) | ||
235 | #define Gsadr_Xstart(x) ((x) << FShft(GSADR_XSTART)) | ||
236 | #define GSADR_YSTART Fld(11,0) | ||
237 | #define Gsadr_Ystart(y) ((y) << FShft(GSADR_YSTART)) | ||
238 | |||
239 | /* GPLUT graphics palette register fields */ | ||
240 | #define GPLUT_LUTADR Fld(8,24) | ||
241 | #define Gplut_Lutadr(x) ((x) << FShft(GPLUT_LUTADR)) | ||
242 | #define GPLUT_LUTDATA Fld(24,0) | ||
243 | #define Gplut_Lutdata(x) ((x) << FShft(GPLUT_LUTDATA)) | ||
244 | |||
245 | /* HCCTRL - Hardware Cursor Register fields */ | ||
246 | #define HCCTRL_CUR_EN (1 << 31) | ||
247 | #define HCCTRL_COLKEY_EN (1 << 29) | ||
248 | #define HCCTRL_COLKEYSRC (1 << 28) | ||
249 | #define HCCTRL_BLEND_M Fld(2,26) | ||
250 | #define HCCTRL_BLEND_NONE ((0x0) << FShft(HCCTRL_BLEND_M)) | ||
251 | #define HCCTRL_BLEND_INV ((0x1) << FShft(HCCTRL_BLEND_M)) | ||
252 | #define HCCTRL_BLEND_GLOB ((0x2) << FShft(HCCTRL_BLEND_M)) | ||
253 | #define HCCTRL_BLEND_PIX ((0x3) << FShft(HCCTRL_BLEND_M)) | ||
254 | #define HCCTRL_CPIXFMT Fld(3,23) | ||
255 | #define HCCTRL_CPIXFMT_RGB332 ((0x3) << FShft(HCCTRL_CPIXFMT)) | ||
256 | #define HCCTRL_CPIXFMT_ARGB4444 ((0x4) << FShft(HCCTRL_CPIXFMT)) | ||
257 | #define HCCTRL_CPIXFMT_ARGB1555 ((0x5) << FShft(HCCTRL_CPIXFMT)) | ||
258 | #define HCCTRL_CBASE_ADR Fld(23,0) | ||
259 | #define Hcctrl_Cbase_Adr(x) ((x) << FShft(HCCTRL_CBASE_ADR)) | ||
260 | |||
261 | /* HCSIZE Hardware Cursor Size Register fields */ | ||
262 | #define HCSIZE_BLEND_POS Fld(2,29) | ||
263 | #define HCSIZE_BLEND_GFX ((0x0) << FShft(HCSIZE_BLEND_POS)) | ||
264 | #define HCSIZE_BLEND_VID ((0x1) << FShft(HCSIZE_BLEND_POS)) | ||
265 | #define HCSIZE_BLEND_CUR ((0x2) << FShft(HCSIZE_BLEND_POS)) | ||
266 | #define HCSIZE_CWIDTH Fld(3,16) | ||
267 | #define Hcsize_Cwidth(x) ((x) << FShft(HCSIZE_CWIDTH)) | ||
268 | #define HCSIZE_CHEIGHT Fld(3,0) | ||
269 | #define Hcsize_Cheight(x) ((x) << FShft(HCSIZE_CHEIGHT)) | ||
270 | |||
271 | /* HCPOS Hardware Cursor Position Register fields */ | ||
272 | #define HCPOS_SWITCHSRC (1 << 30) | ||
273 | #define HCPOS_CURBLINK Fld(6,24) | ||
274 | #define Hcpos_Curblink(x) ((x) << FShft(HCPOS_CURBLINK)) | ||
275 | #define HCPOS_XSTART Fld(12,12) | ||
276 | #define Hcpos_Xstart(x) ((x) << FShft(HCPOS_XSTART)) | ||
277 | #define HCPOS_YSTART Fld(12,0) | ||
278 | #define Hcpos_Ystart(y) ((y) << FShft(HCPOS_YSTART)) | ||
279 | |||
280 | /* HCBADR Hardware Cursor Blend Address Register */ | ||
281 | #define HCBADR_GLALPHA Fld(8,24) | ||
282 | #define Hcbadr_Glalpha(x) ((x) << FShft(HCBADR_GLALPHA)) | ||
283 | #define HCBADR_COLKEY Fld(24,0) | ||
284 | #define Hcbadr_Colkey(x) ((x) << FShft(HCBADR_COLKEY)) | ||
285 | |||
286 | /* HCCKMSK - Hardware Cursor Color Key Mask Register */ | ||
287 | #define HCCKMSK_COLKEY_M Fld(24,0) | ||
288 | #define Hcckmsk_Colkey_M(x) ((x) << FShft(HCCKMSK_COLKEY_M)) | ||
289 | |||
290 | /* DSCTRL - Display sync control register */ | ||
291 | #define DSCTRL_SYNCGEN_EN (1 << 31) | ||
292 | #define DSCTRL_DPL_RST (1 << 29) | ||
293 | #define DSCTRL_PWRDN_M (1 << 28) | ||
294 | #define DSCTRL_UPDSYNCCNT (1 << 26) | ||
295 | #define DSCTRL_UPDINTCNT (1 << 25) | ||
296 | #define DSCTRL_UPDCNT (1 << 24) | ||
297 | #define DSCTRL_UPDWAIT Fld(4,16) | ||
298 | #define Dsctrl_Updwait(x) ((x) << FShft(DSCTRL_UPDWAIT)) | ||
299 | #define DSCTRL_CLKPOL (1 << 11) | ||
300 | #define DSCTRL_CSYNC_EN (1 << 10) | ||
301 | #define DSCTRL_VS_SLAVE (1 << 7) | ||
302 | #define DSCTRL_HS_SLAVE (1 << 6) | ||
303 | #define DSCTRL_BLNK_POL (1 << 5) | ||
304 | #define DSCTRL_BLNK_DIS (1 << 4) | ||
305 | #define DSCTRL_VS_POL (1 << 3) | ||
306 | #define DSCTRL_VS_DIS (1 << 2) | ||
307 | #define DSCTRL_HS_POL (1 << 1) | ||
308 | #define DSCTRL_HS_DIS (1 << 0) | ||
309 | |||
310 | /* DHT01 - Display horizontal timing register 01 */ | ||
311 | #define DHT01_HBPS Fld(12,16) | ||
312 | #define Dht01_Hbps(x) ((x) << FShft(DHT01_HBPS)) | ||
313 | #define DHT01_HT Fld(12,0) | ||
314 | #define Dht01_Ht(x) ((x) << FShft(DHT01_HT)) | ||
315 | |||
316 | /* DHT02 - Display horizontal timing register 02 */ | ||
317 | #define DHT02_HAS Fld(12,16) | ||
318 | #define Dht02_Has(x) ((x) << FShft(DHT02_HAS)) | ||
319 | #define DHT02_HLBS Fld(12,0) | ||
320 | #define Dht02_Hlbs(x) ((x) << FShft(DHT02_HLBS)) | ||
321 | |||
322 | /* DHT03 - Display horizontal timing register 03 */ | ||
323 | #define DHT03_HFPS Fld(12,16) | ||
324 | #define Dht03_Hfps(x) ((x) << FShft(DHT03_HFPS)) | ||
325 | #define DHT03_HRBS Fld(12,0) | ||
326 | #define Dht03_Hrbs(x) ((x) << FShft(DHT03_HRBS)) | ||
327 | |||
328 | /* DVT01 - Display vertical timing register 01 */ | ||
329 | #define DVT01_VBPS Fld(12,16) | ||
330 | #define Dvt01_Vbps(x) ((x) << FShft(DVT01_VBPS)) | ||
331 | #define DVT01_VT Fld(12,0) | ||
332 | #define Dvt01_Vt(x) ((x) << FShft(DVT01_VT)) | ||
333 | |||
334 | /* DVT02 - Display vertical timing register 02 */ | ||
335 | #define DVT02_VAS Fld(12,16) | ||
336 | #define Dvt02_Vas(x) ((x) << FShft(DVT02_VAS)) | ||
337 | #define DVT02_VTBS Fld(12,0) | ||
338 | #define Dvt02_Vtbs(x) ((x) << FShft(DVT02_VTBS)) | ||
339 | |||
340 | /* DVT03 - Display vertical timing register 03 */ | ||
341 | #define DVT03_VFPS Fld(12,16) | ||
342 | #define Dvt03_Vfps(x) ((x) << FShft(DVT03_VFPS)) | ||
343 | #define DVT03_VBBS Fld(12,0) | ||
344 | #define Dvt03_Vbbs(x) ((x) << FShft(DVT03_VBBS)) | ||
345 | |||
346 | /* DVECTRL - display vertical event control register */ | ||
347 | #define DVECTRL_VEVENT Fld(12,16) | ||
348 | #define Dvectrl_Vevent(x) ((x) << FShft(DVECTRL_VEVENT)) | ||
349 | #define DVECTRL_VFETCH Fld(12,0) | ||
350 | #define Dvectrl_Vfetch(x) ((x) << FShft(DVECTRL_VFETCH)) | ||
351 | |||
352 | /* DHDET - display horizontal DE timing register */ | ||
353 | #define DHDET_HDES Fld(12,16) | ||
354 | #define Dhdet_Hdes(x) ((x) << FShft(DHDET_HDES)) | ||
355 | #define DHDET_HDEF Fld(12,0) | ||
356 | #define Dhdet_Hdef(x) ((x) << FShft(DHDET_HDEF)) | ||
357 | |||
358 | /* DVDET - display vertical DE timing register */ | ||
359 | #define DVDET_VDES Fld(12,16) | ||
360 | #define Dvdet_Vdes(x) ((x) << FShft(DVDET_VDES)) | ||
361 | #define DVDET_VDEF Fld(12,0) | ||
362 | #define Dvdet_Vdef(x) ((x) << FShft(DVDET_VDEF)) | ||
363 | |||
364 | /* DODMSK - display output data mask register */ | ||
365 | #define DODMSK_MASK_LVL (1 << 31) | ||
366 | #define DODMSK_BLNK_LVL (1 << 30) | ||
367 | #define DODMSK_MASK_B Fld(8,16) | ||
368 | #define Dodmsk_Mask_B(x) ((x) << FShft(DODMSK_MASK_B)) | ||
369 | #define DODMSK_MASK_G Fld(8,8) | ||
370 | #define Dodmsk_Mask_G(x) ((x) << FShft(DODMSK_MASK_G)) | ||
371 | #define DODMSK_MASK_R Fld(8,0) | ||
372 | #define Dodmsk_Mask_R(x) ((x) << FShft(DODMSK_MASK_R)) | ||
373 | |||
374 | /* DBCOL - display border color control register */ | ||
375 | #define DBCOL_BORDCOL Fld(24,0) | ||
376 | #define Dbcol_Bordcol(x) ((x) << FShft(DBCOL_BORDCOL)) | ||
377 | |||
378 | /* DVLNUM - display vertical line number register */ | ||
379 | #define DVLNUM_VLINE Fld(12,0) | ||
380 | #define Dvlnum_Vline(x) ((x) << FShft(DVLNUM_VLINE)) | ||
381 | |||
382 | /* DMCTRL - Display Memory Control Register */ | ||
383 | #define DMCTRL_MEM_REF Fld(2,30) | ||
384 | #define DMCTRL_MEM_REF_ACT ((0x0) << FShft(DMCTRL_MEM_REF)) | ||
385 | #define DMCTRL_MEM_REF_HB ((0x1) << FShft(DMCTRL_MEM_REF)) | ||
386 | #define DMCTRL_MEM_REF_VB ((0x2) << FShft(DMCTRL_MEM_REF)) | ||
387 | #define DMCTRL_MEM_REF_BOTH ((0x3) << FShft(DMCTRL_MEM_REF)) | ||
388 | #define DMCTRL_UV_THRHLD Fld(6,24) | ||
389 | #define Dmctrl_Uv_Thrhld(x) ((x) << FShft(DMCTRL_UV_THRHLD)) | ||
390 | #define DMCTRL_V_THRHLD Fld(7,16) | ||
391 | #define Dmctrl_V_Thrhld(x) ((x) << FShft(DMCTRL_V_THRHLD)) | ||
392 | #define DMCTRL_D_THRHLD Fld(7,8) | ||
393 | #define Dmctrl_D_Thrhld(x) ((x) << FShft(DMCTRL_D_THRHLD)) | ||
394 | #define DMCTRL_BURSTLEN Fld(6,0) | ||
395 | #define Dmctrl_Burstlen(x) ((x) << FShft(DMCTRL_BURSTLEN)) | ||
396 | |||
397 | |||
398 | /* DLSTS - display load status register */ | ||
399 | #define DLSTS_RLD_ADONE (1 << 23) | ||
400 | /* #define DLSTS_RLD_ADOUT Fld(23,0) */ | ||
401 | |||
402 | /* DLLCTRL - display list load control register */ | ||
403 | #define DLLCTRL_RLD_ADRLN Fld(8,24) | ||
404 | #define Dllctrl_Rld_Adrln(x) ((x) << FShft(DLLCTRL_RLD_ADRLN)) | ||
405 | |||
406 | /* SPOCTRL - Scale Pitch/Order Control Register */ | ||
407 | #define SPOCTRL_H_SC_BP (1 << 31) | ||
408 | #define SPOCTRL_V_SC_BP (1 << 30) | ||
409 | #define SPOCTRL_HV_SC_OR (1 << 29) | ||
410 | #define SPOCTRL_VS_UR_C (1 << 27) | ||
411 | #define SPOCTRL_VORDER Fld(2,16) | ||
412 | #define SPOCTRL_VORDER_1TAP ((0x0) << FShft(SPOCTRL_VORDER)) | ||
413 | #define SPOCTRL_VORDER_2TAP ((0x1) << FShft(SPOCTRL_VORDER)) | ||
414 | #define SPOCTRL_VORDER_4TAP ((0x3) << FShft(SPOCTRL_VORDER)) | ||
415 | #define SPOCTRL_VPITCH Fld(16,0) | ||
416 | #define Spoctrl_Vpitch(x) ((x) << FShft(SPOCTRL_VPITCH)) | ||
417 | |||
418 | #endif /* __REG_BITS_2700G_ */ | ||
diff --git a/drivers/video/mbx/regs.h b/drivers/video/mbx/regs.h new file mode 100644 index 000000000000..ad20be07666b --- /dev/null +++ b/drivers/video/mbx/regs.h | |||
@@ -0,0 +1,195 @@ | |||
1 | #ifndef __REGS_2700G_ | ||
2 | #define __REGS_2700G_ | ||
3 | |||
4 | /* extern unsigned long virt_base_2700; */ | ||
5 | /* #define __REG_2700G(x) (*(volatile unsigned long*)((x)+virt_base_2700)) */ | ||
6 | #define __REG_2700G(x) ((x)+virt_base_2700) | ||
7 | |||
8 | /* System Configuration Registers (0x0000_0000 0x0000_0010) */ | ||
9 | #define SYSCFG __REG_2700G(0x00000000) | ||
10 | #define PFBASE __REG_2700G(0x00000004) | ||
11 | #define PFCEIL __REG_2700G(0x00000008) | ||
12 | #define POLLFLAG __REG_2700G(0x0000000c) | ||
13 | #define SYSRST __REG_2700G(0x00000010) | ||
14 | |||
15 | /* Interrupt Control Registers (0x0000_0014 0x0000_002F) */ | ||
16 | #define NINTPW __REG_2700G(0x00000014) | ||
17 | #define MINTENABLE __REG_2700G(0x00000018) | ||
18 | #define MINTSTAT __REG_2700G(0x0000001c) | ||
19 | #define SINTENABLE __REG_2700G(0x00000020) | ||
20 | #define SINTSTAT __REG_2700G(0x00000024) | ||
21 | #define SINTCLR __REG_2700G(0x00000028) | ||
22 | |||
23 | /* Clock Control Registers (0x0000_002C 0x0000_005F) */ | ||
24 | #define SYSCLKSRC __REG_2700G(0x0000002c) | ||
25 | #define PIXCLKSRC __REG_2700G(0x00000030) | ||
26 | #define CLKSLEEP __REG_2700G(0x00000034) | ||
27 | #define COREPLL __REG_2700G(0x00000038) | ||
28 | #define DISPPLL __REG_2700G(0x0000003c) | ||
29 | #define PLLSTAT __REG_2700G(0x00000040) | ||
30 | #define VOVRCLK __REG_2700G(0x00000044) | ||
31 | #define PIXCLK __REG_2700G(0x00000048) | ||
32 | #define MEMCLK __REG_2700G(0x0000004c) | ||
33 | #define M24CLK __REG_2700G(0x00000054) | ||
34 | #define MBXCLK __REG_2700G(0x00000054) | ||
35 | #define SDCLK __REG_2700G(0x00000058) | ||
36 | #define PIXCLKDIV __REG_2700G(0x0000005c) | ||
37 | |||
38 | /* LCD Port Control Register (0x0000_0060 0x0000_006F) */ | ||
39 | #define LCD_CONFIG __REG_2700G(0x00000060) | ||
40 | |||
41 | /* On-Die Frame Buffer Registers (0x0000_0064 0x0000_006B) */ | ||
42 | #define ODFBPWR __REG_2700G(0x00000064) | ||
43 | #define ODFBSTAT __REG_2700G(0x00000068) | ||
44 | |||
45 | /* GPIO Registers (0x0000_006C 0x0000_007F) */ | ||
46 | #define GPIOCGF __REG_2700G(0x0000006c) | ||
47 | #define GPIOHI __REG_2700G(0x00000070) | ||
48 | #define GPIOLO __REG_2700G(0x00000074) | ||
49 | #define GPIOSTAT __REG_2700G(0x00000078) | ||
50 | |||
51 | /* Pulse Width Modulator (PWM) Registers (0x0000_0200 0x0000_02FF) */ | ||
52 | #define PWMRST __REG_2700G(0x00000200) | ||
53 | #define PWMCFG __REG_2700G(0x00000204) | ||
54 | #define PWM0DIV __REG_2700G(0x00000210) | ||
55 | #define PWM0DUTY __REG_2700G(0x00000214) | ||
56 | #define PWM0PER __REG_2700G(0x00000218) | ||
57 | #define PWM1DIV __REG_2700G(0x00000220) | ||
58 | #define PWM1DUTY __REG_2700G(0x00000224) | ||
59 | #define PWM1PER __REG_2700G(0x00000228) | ||
60 | |||
61 | /* Identification (ID) Registers (0x0000_0300 0x0000_0FFF) */ | ||
62 | #define ID __REG_2700G(0x00000FF0) | ||
63 | |||
64 | /* Local Memory (SDRAM) Interface Registers (0x0000_1000 0x0000_1FFF) */ | ||
65 | #define LMRST __REG_2700G(0x00001000) | ||
66 | #define LMCFG __REG_2700G(0x00001004) | ||
67 | #define LMPWR __REG_2700G(0x00001008) | ||
68 | #define LMPWRSTAT __REG_2700G(0x0000100c) | ||
69 | #define LMCEMR __REG_2700G(0x00001010) | ||
70 | #define LMTYPE __REG_2700G(0x00001014) | ||
71 | #define LMTIM __REG_2700G(0x00001018) | ||
72 | #define LMREFRESH __REG_2700G(0x0000101c) | ||
73 | #define LMPROTMIN __REG_2700G(0x00001020) | ||
74 | #define LMPROTMAX __REG_2700G(0x00001024) | ||
75 | #define LMPROTCFG __REG_2700G(0x00001028) | ||
76 | #define LMPROTERR __REG_2700G(0x0000102c) | ||
77 | |||
78 | /* Plane Controller Registers (0x0000_2000 0x0000_2FFF) */ | ||
79 | #define GSCTRL __REG_2700G(0x00002000) | ||
80 | #define VSCTRL __REG_2700G(0x00002004) | ||
81 | #define GBBASE __REG_2700G(0x00002020) | ||
82 | #define VBBASE __REG_2700G(0x00002024) | ||
83 | #define GDRCTRL __REG_2700G(0x00002040) | ||
84 | #define VCMSK __REG_2700G(0x00002044) | ||
85 | #define GSCADR __REG_2700G(0x00002060) | ||
86 | #define VSCADR __REG_2700G(0x00002064) | ||
87 | #define VUBASE __REG_2700G(0x00002084) | ||
88 | #define VVBASE __REG_2700G(0x000020a4) | ||
89 | #define GSADR __REG_2700G(0x000020c0) | ||
90 | #define VSADR __REG_2700G(0x000020c4) | ||
91 | #define HCCTRL __REG_2700G(0x00002100) | ||
92 | #define HCSIZE __REG_2700G(0x00002110) | ||
93 | #define HCPOS __REG_2700G(0x00002120) | ||
94 | #define HCBADR __REG_2700G(0x00002130) | ||
95 | #define HCCKMSK __REG_2700G(0x00002140) | ||
96 | #define GPLUT __REG_2700G(0x00002150) | ||
97 | #define DSCTRL __REG_2700G(0x00002154) | ||
98 | #define DHT01 __REG_2700G(0x00002158) | ||
99 | #define DHT02 __REG_2700G(0x0000215c) | ||
100 | #define DHT03 __REG_2700G(0x00002160) | ||
101 | #define DVT01 __REG_2700G(0x00002164) | ||
102 | #define DVT02 __REG_2700G(0x00002168) | ||
103 | #define DVT03 __REG_2700G(0x0000216c) | ||
104 | #define DBCOL __REG_2700G(0x00002170) | ||
105 | #define BGCOLOR __REG_2700G(0x00002174) | ||
106 | #define DINTRS __REG_2700G(0x00002178) | ||
107 | #define DINTRE __REG_2700G(0x0000217c) | ||
108 | #define DINTRCNT __REG_2700G(0x00002180) | ||
109 | #define DSIG __REG_2700G(0x00002184) | ||
110 | #define DMCTRL __REG_2700G(0x00002188) | ||
111 | #define CLIPCTRL __REG_2700G(0x0000218c) | ||
112 | #define SPOCTRL __REG_2700G(0x00002190) | ||
113 | #define SVCTRL __REG_2700G(0x00002194) | ||
114 | |||
115 | /* 0x0000_2198 */ | ||
116 | /* 0x0000_21A8 VSCOEFF[0:4] Video Scalar Vertical Coefficient [0:4] 4.14.5 */ | ||
117 | #define VSCOEFF0 __REG_2700G(0x00002198) | ||
118 | #define VSCOEFF1 __REG_2700G(0x0000219c) | ||
119 | #define VSCOEFF2 __REG_2700G(0x000021a0) | ||
120 | #define VSCOEFF3 __REG_2700G(0x000021a4) | ||
121 | #define VSCOEFF4 __REG_2700G(0x000021a8) | ||
122 | |||
123 | #define SHCTRL __REG_2700G(0x000021b0) | ||
124 | |||
125 | /* 0x0000_21B4 */ | ||
126 | /* 0x0000_21D4 HSCOEFF[0:8] Video Scalar Horizontal Coefficient [0:8] 4.14.7 */ | ||
127 | #define HSCOEFF0 __REG_2700G(0x000021b4) | ||
128 | #define HSCOEFF1 __REG_2700G(0x000021b8) | ||
129 | #define HSCOEFF2 __REG_2700G(0x000021bc) | ||
130 | #define HSCOEFF3 __REG_2700G(0x000021b0) | ||
131 | #define HSCOEFF4 __REG_2700G(0x000021c4) | ||
132 | #define HSCOEFF5 __REG_2700G(0x000021c8) | ||
133 | #define HSCOEFF6 __REG_2700G(0x000021cc) | ||
134 | #define HSCOEFF7 __REG_2700G(0x000021d0) | ||
135 | #define HSCOEFF8 __REG_2700G(0x000021d4) | ||
136 | |||
137 | #define SSSIZE __REG_2700G(0x000021D8) | ||
138 | |||
139 | /* 0x0000_2200 */ | ||
140 | /* 0x0000_2240 VIDGAM[0:16] Video Gamma LUT Index [0:16] 4.15.2 */ | ||
141 | #define VIDGAM0 __REG_2700G(0x00002200) | ||
142 | #define VIDGAM1 __REG_2700G(0x00002204) | ||
143 | #define VIDGAM2 __REG_2700G(0x00002208) | ||
144 | #define VIDGAM3 __REG_2700G(0x0000220c) | ||
145 | #define VIDGAM4 __REG_2700G(0x00002210) | ||
146 | #define VIDGAM5 __REG_2700G(0x00002214) | ||
147 | #define VIDGAM6 __REG_2700G(0x00002218) | ||
148 | #define VIDGAM7 __REG_2700G(0x0000221c) | ||
149 | #define VIDGAM8 __REG_2700G(0x00002220) | ||
150 | #define VIDGAM9 __REG_2700G(0x00002224) | ||
151 | #define VIDGAM10 __REG_2700G(0x00002228) | ||
152 | #define VIDGAM11 __REG_2700G(0x0000222c) | ||
153 | #define VIDGAM12 __REG_2700G(0x00002230) | ||
154 | #define VIDGAM13 __REG_2700G(0x00002234) | ||
155 | #define VIDGAM14 __REG_2700G(0x00002238) | ||
156 | #define VIDGAM15 __REG_2700G(0x0000223c) | ||
157 | #define VIDGAM16 __REG_2700G(0x00002240) | ||
158 | |||
159 | /* 0x0000_2250 */ | ||
160 | /* 0x0000_2290 GFXGAM[0:16] Graphics Gamma LUT Index [0:16] 4.15.3 */ | ||
161 | #define GFXGAM0 __REG_2700G(0x00002250) | ||
162 | #define GFXGAM1 __REG_2700G(0x00002254) | ||
163 | #define GFXGAM2 __REG_2700G(0x00002258) | ||
164 | #define GFXGAM3 __REG_2700G(0x0000225c) | ||
165 | #define GFXGAM4 __REG_2700G(0x00002260) | ||
166 | #define GFXGAM5 __REG_2700G(0x00002264) | ||
167 | #define GFXGAM6 __REG_2700G(0x00002268) | ||
168 | #define GFXGAM7 __REG_2700G(0x0000226c) | ||
169 | #define GFXGAM8 __REG_2700G(0x00002270) | ||
170 | #define GFXGAM9 __REG_2700G(0x00002274) | ||
171 | #define GFXGAM10 __REG_2700G(0x00002278) | ||
172 | #define GFXGAM11 __REG_2700G(0x0000227c) | ||
173 | #define GFXGAM12 __REG_2700G(0x00002280) | ||
174 | #define GFXGAM13 __REG_2700G(0x00002284) | ||
175 | #define GFXGAM14 __REG_2700G(0x00002288) | ||
176 | #define GFXGAM15 __REG_2700G(0x0000228c) | ||
177 | #define GFXGAM16 __REG_2700G(0x00002290) | ||
178 | |||
179 | #define DLSTS __REG_2700G(0x00002300) | ||
180 | #define DLLCTRL __REG_2700G(0x00002304) | ||
181 | #define DVLNUM __REG_2700G(0x00002308) | ||
182 | #define DUCTRL __REG_2700G(0x0000230c) | ||
183 | #define DVECTRL __REG_2700G(0x00002310) | ||
184 | #define DHDET __REG_2700G(0x00002314) | ||
185 | #define DVDET __REG_2700G(0x00002318) | ||
186 | #define DODMSK __REG_2700G(0x0000231c) | ||
187 | #define CSC01 __REG_2700G(0x00002330) | ||
188 | #define CSC02 __REG_2700G(0x00002334) | ||
189 | #define CSC03 __REG_2700G(0x00002338) | ||
190 | #define CSC04 __REG_2700G(0x0000233c) | ||
191 | #define CSC05 __REG_2700G(0x00002340) | ||
192 | |||
193 | #define FB_MEMORY_START __REG_2700G(0x00060000) | ||
194 | |||
195 | #endif /* __REGS_2700G_ */ | ||
diff --git a/drivers/video/modedb.c b/drivers/video/modedb.c index ff5454601e22..d1267904c280 100644 --- a/drivers/video/modedb.c +++ b/drivers/video/modedb.c | |||
@@ -12,7 +12,6 @@ | |||
12 | */ | 12 | */ |
13 | 13 | ||
14 | #include <linux/module.h> | 14 | #include <linux/module.h> |
15 | #include <linux/tty.h> | ||
16 | #include <linux/fb.h> | 15 | #include <linux/fb.h> |
17 | #include <linux/sched.h> | 16 | #include <linux/sched.h> |
18 | 17 | ||
diff --git a/drivers/video/neofb.c b/drivers/video/neofb.c index 773855a311e8..59a6f5fa5ae6 100644 --- a/drivers/video/neofb.c +++ b/drivers/video/neofb.c | |||
@@ -59,7 +59,6 @@ | |||
59 | #include <linux/errno.h> | 59 | #include <linux/errno.h> |
60 | #include <linux/string.h> | 60 | #include <linux/string.h> |
61 | #include <linux/mm.h> | 61 | #include <linux/mm.h> |
62 | #include <linux/tty.h> | ||
63 | #include <linux/slab.h> | 62 | #include <linux/slab.h> |
64 | #include <linux/delay.h> | 63 | #include <linux/delay.h> |
65 | #include <linux/fb.h> | 64 | #include <linux/fb.h> |
diff --git a/drivers/video/nvidia/nv_backlight.c b/drivers/video/nvidia/nv_backlight.c index 1c1c10c699c5..b45f577094ac 100644 --- a/drivers/video/nvidia/nv_backlight.c +++ b/drivers/video/nvidia/nv_backlight.c | |||
@@ -26,9 +26,11 @@ | |||
26 | */ | 26 | */ |
27 | #define MIN_LEVEL 0x158 | 27 | #define MIN_LEVEL 0x158 |
28 | #define MAX_LEVEL 0x534 | 28 | #define MAX_LEVEL 0x534 |
29 | #define LEVEL_STEP ((MAX_LEVEL - MIN_LEVEL) / FB_BACKLIGHT_MAX) | ||
29 | 30 | ||
30 | static struct backlight_properties nvidia_bl_data; | 31 | static struct backlight_properties nvidia_bl_data; |
31 | 32 | ||
33 | /* Call with fb_info->bl_mutex held */ | ||
32 | static int nvidia_bl_get_level_brightness(struct nvidia_par *par, | 34 | static int nvidia_bl_get_level_brightness(struct nvidia_par *par, |
33 | int level) | 35 | int level) |
34 | { | 36 | { |
@@ -36,9 +38,7 @@ static int nvidia_bl_get_level_brightness(struct nvidia_par *par, | |||
36 | int nlevel; | 38 | int nlevel; |
37 | 39 | ||
38 | /* Get and convert the value */ | 40 | /* Get and convert the value */ |
39 | mutex_lock(&info->bl_mutex); | 41 | nlevel = MIN_LEVEL + info->bl_curve[level] * LEVEL_STEP; |
40 | nlevel = info->bl_curve[level] * FB_BACKLIGHT_MAX / MAX_LEVEL; | ||
41 | mutex_unlock(&info->bl_mutex); | ||
42 | 42 | ||
43 | if (nlevel < 0) | 43 | if (nlevel < 0) |
44 | nlevel = 0; | 44 | nlevel = 0; |
@@ -50,7 +50,8 @@ static int nvidia_bl_get_level_brightness(struct nvidia_par *par, | |||
50 | return nlevel; | 50 | return nlevel; |
51 | } | 51 | } |
52 | 52 | ||
53 | static int nvidia_bl_update_status(struct backlight_device *bd) | 53 | /* Call with fb_info->bl_mutex held */ |
54 | static int __nvidia_bl_update_status(struct backlight_device *bd) | ||
54 | { | 55 | { |
55 | struct nvidia_par *par = class_get_devdata(&bd->class_dev); | 56 | struct nvidia_par *par = class_get_devdata(&bd->class_dev); |
56 | u32 tmp_pcrt, tmp_pmc, fpcontrol; | 57 | u32 tmp_pcrt, tmp_pmc, fpcontrol; |
@@ -84,6 +85,19 @@ static int nvidia_bl_update_status(struct backlight_device *bd) | |||
84 | return 0; | 85 | return 0; |
85 | } | 86 | } |
86 | 87 | ||
88 | static int nvidia_bl_update_status(struct backlight_device *bd) | ||
89 | { | ||
90 | struct nvidia_par *par = class_get_devdata(&bd->class_dev); | ||
91 | struct fb_info *info = pci_get_drvdata(par->pci_dev); | ||
92 | int ret; | ||
93 | |||
94 | mutex_lock(&info->bl_mutex); | ||
95 | ret = __nvidia_bl_update_status(bd); | ||
96 | mutex_unlock(&info->bl_mutex); | ||
97 | |||
98 | return ret; | ||
99 | } | ||
100 | |||
87 | static int nvidia_bl_get_brightness(struct backlight_device *bd) | 101 | static int nvidia_bl_get_brightness(struct backlight_device *bd) |
88 | { | 102 | { |
89 | return bd->props->brightness; | 103 | return bd->props->brightness; |
@@ -96,6 +110,16 @@ static struct backlight_properties nvidia_bl_data = { | |||
96 | .max_brightness = (FB_BACKLIGHT_LEVELS - 1), | 110 | .max_brightness = (FB_BACKLIGHT_LEVELS - 1), |
97 | }; | 111 | }; |
98 | 112 | ||
113 | void nvidia_bl_set_power(struct fb_info *info, int power) | ||
114 | { | ||
115 | mutex_lock(&info->bl_mutex); | ||
116 | up(&info->bl_dev->sem); | ||
117 | info->bl_dev->props->power = power; | ||
118 | __nvidia_bl_update_status(info->bl_dev); | ||
119 | down(&info->bl_dev->sem); | ||
120 | mutex_unlock(&info->bl_mutex); | ||
121 | } | ||
122 | |||
99 | void nvidia_bl_init(struct nvidia_par *par) | 123 | void nvidia_bl_init(struct nvidia_par *par) |
100 | { | 124 | { |
101 | struct fb_info *info = pci_get_drvdata(par->pci_dev); | 125 | struct fb_info *info = pci_get_drvdata(par->pci_dev); |
diff --git a/drivers/video/nvidia/nv_proto.h b/drivers/video/nvidia/nv_proto.h index 6fba656cd56b..861271017655 100644 --- a/drivers/video/nvidia/nv_proto.h +++ b/drivers/video/nvidia/nv_proto.h | |||
@@ -68,9 +68,11 @@ extern u8 byte_rev[256]; | |||
68 | #ifdef CONFIG_FB_NVIDIA_BACKLIGHT | 68 | #ifdef CONFIG_FB_NVIDIA_BACKLIGHT |
69 | extern void nvidia_bl_init(struct nvidia_par *par); | 69 | extern void nvidia_bl_init(struct nvidia_par *par); |
70 | extern void nvidia_bl_exit(struct nvidia_par *par); | 70 | extern void nvidia_bl_exit(struct nvidia_par *par); |
71 | extern void nvidia_bl_set_power(struct fb_info *info, int power); | ||
71 | #else | 72 | #else |
72 | static inline void nvidia_bl_init(struct nvidia_par *par) {} | 73 | static inline void nvidia_bl_init(struct nvidia_par *par) {} |
73 | static inline void nvidia_bl_exit(struct nvidia_par *par) {} | 74 | static inline void nvidia_bl_exit(struct nvidia_par *par) {} |
75 | static inline void nvidia_bl_set_power(struct fb_info *info, int power) {} | ||
74 | #endif | 76 | #endif |
75 | 77 | ||
76 | #endif /* __NV_PROTO_H__ */ | 78 | #endif /* __NV_PROTO_H__ */ |
diff --git a/drivers/video/nvidia/nvidia.c b/drivers/video/nvidia/nvidia.c index b02d6033cc0c..9f2066f0745a 100644 --- a/drivers/video/nvidia/nvidia.c +++ b/drivers/video/nvidia/nvidia.c | |||
@@ -14,7 +14,6 @@ | |||
14 | #include <linux/errno.h> | 14 | #include <linux/errno.h> |
15 | #include <linux/string.h> | 15 | #include <linux/string.h> |
16 | #include <linux/mm.h> | 16 | #include <linux/mm.h> |
17 | #include <linux/tty.h> | ||
18 | #include <linux/slab.h> | 17 | #include <linux/slab.h> |
19 | #include <linux/delay.h> | 18 | #include <linux/delay.h> |
20 | #include <linux/fb.h> | 19 | #include <linux/fb.h> |
@@ -933,16 +932,7 @@ static int nvidiafb_blank(int blank, struct fb_info *info) | |||
933 | NVWriteSeq(par, 0x01, tmp); | 932 | NVWriteSeq(par, 0x01, tmp); |
934 | NVWriteCrtc(par, 0x1a, vesa); | 933 | NVWriteCrtc(par, 0x1a, vesa); |
935 | 934 | ||
936 | #ifdef CONFIG_FB_NVIDIA_BACKLIGHT | 935 | nvidia_bl_set_power(info, blank); |
937 | mutex_lock(&info->bl_mutex); | ||
938 | if (info->bl_dev) { | ||
939 | down(&info->bl_dev->sem); | ||
940 | info->bl_dev->props->power = blank; | ||
941 | info->bl_dev->props->update_status(info->bl_dev); | ||
942 | up(&info->bl_dev->sem); | ||
943 | } | ||
944 | mutex_unlock(&info->bl_mutex); | ||
945 | #endif | ||
946 | 936 | ||
947 | NVTRACE_LEAVE(); | 937 | NVTRACE_LEAVE(); |
948 | 938 | ||
diff --git a/drivers/video/offb.c b/drivers/video/offb.c index 71ce1fa45cf4..ce5f3031b99b 100644 --- a/drivers/video/offb.c +++ b/drivers/video/offb.c | |||
@@ -17,7 +17,6 @@ | |||
17 | #include <linux/errno.h> | 17 | #include <linux/errno.h> |
18 | #include <linux/string.h> | 18 | #include <linux/string.h> |
19 | #include <linux/mm.h> | 19 | #include <linux/mm.h> |
20 | #include <linux/tty.h> | ||
21 | #include <linux/slab.h> | 20 | #include <linux/slab.h> |
22 | #include <linux/vmalloc.h> | 21 | #include <linux/vmalloc.h> |
23 | #include <linux/delay.h> | 22 | #include <linux/delay.h> |
diff --git a/drivers/video/platinumfb.c b/drivers/video/platinumfb.c index 450e802e0aa8..983be3ec2345 100644 --- a/drivers/video/platinumfb.c +++ b/drivers/video/platinumfb.c | |||
@@ -22,7 +22,6 @@ | |||
22 | #include <linux/errno.h> | 22 | #include <linux/errno.h> |
23 | #include <linux/string.h> | 23 | #include <linux/string.h> |
24 | #include <linux/mm.h> | 24 | #include <linux/mm.h> |
25 | #include <linux/tty.h> | ||
26 | #include <linux/slab.h> | 25 | #include <linux/slab.h> |
27 | #include <linux/vmalloc.h> | 26 | #include <linux/vmalloc.h> |
28 | #include <linux/delay.h> | 27 | #include <linux/delay.h> |
diff --git a/drivers/video/pm2fb.c b/drivers/video/pm2fb.c index 49a203e1591c..a560a2223825 100644 --- a/drivers/video/pm2fb.c +++ b/drivers/video/pm2fb.c | |||
@@ -33,7 +33,6 @@ | |||
33 | #include <linux/errno.h> | 33 | #include <linux/errno.h> |
34 | #include <linux/string.h> | 34 | #include <linux/string.h> |
35 | #include <linux/mm.h> | 35 | #include <linux/mm.h> |
36 | #include <linux/tty.h> | ||
37 | #include <linux/slab.h> | 36 | #include <linux/slab.h> |
38 | #include <linux/delay.h> | 37 | #include <linux/delay.h> |
39 | #include <linux/fb.h> | 38 | #include <linux/fb.h> |
diff --git a/drivers/video/pm3fb.c b/drivers/video/pm3fb.c index 0e0f977b05ee..1d81ef47efd3 100644 --- a/drivers/video/pm3fb.c +++ b/drivers/video/pm3fb.c | |||
@@ -57,7 +57,6 @@ | |||
57 | #include <linux/errno.h> | 57 | #include <linux/errno.h> |
58 | #include <linux/string.h> | 58 | #include <linux/string.h> |
59 | #include <linux/mm.h> | 59 | #include <linux/mm.h> |
60 | #include <linux/tty.h> | ||
61 | #include <linux/slab.h> | 60 | #include <linux/slab.h> |
62 | #include <linux/vmalloc.h> | 61 | #include <linux/vmalloc.h> |
63 | #include <linux/delay.h> | 62 | #include <linux/delay.h> |
diff --git a/drivers/video/pmag-aa-fb.c b/drivers/video/pmag-aa-fb.c index d92f352211ef..68ca3cc40770 100644 --- a/drivers/video/pmag-aa-fb.c +++ b/drivers/video/pmag-aa-fb.c | |||
@@ -29,7 +29,6 @@ | |||
29 | #include <linux/string.h> | 29 | #include <linux/string.h> |
30 | #include <linux/timer.h> | 30 | #include <linux/timer.h> |
31 | #include <linux/mm.h> | 31 | #include <linux/mm.h> |
32 | #include <linux/tty.h> | ||
33 | #include <linux/slab.h> | 32 | #include <linux/slab.h> |
34 | #include <linux/delay.h> | 33 | #include <linux/delay.h> |
35 | #include <linux/init.h> | 34 | #include <linux/init.h> |
diff --git a/drivers/video/pvr2fb.c b/drivers/video/pvr2fb.c index 4a1e0e856920..940ba2be55e9 100644 --- a/drivers/video/pvr2fb.c +++ b/drivers/video/pvr2fb.c | |||
@@ -53,7 +53,6 @@ | |||
53 | #include <linux/errno.h> | 53 | #include <linux/errno.h> |
54 | #include <linux/string.h> | 54 | #include <linux/string.h> |
55 | #include <linux/mm.h> | 55 | #include <linux/mm.h> |
56 | #include <linux/tty.h> | ||
57 | #include <linux/slab.h> | 56 | #include <linux/slab.h> |
58 | #include <linux/delay.h> | 57 | #include <linux/delay.h> |
59 | #include <linux/interrupt.h> | 58 | #include <linux/interrupt.h> |
diff --git a/drivers/video/q40fb.c b/drivers/video/q40fb.c index fc91dbf896d2..48536c3e58a4 100644 --- a/drivers/video/q40fb.c +++ b/drivers/video/q40fb.c | |||
@@ -14,7 +14,6 @@ | |||
14 | #include <linux/errno.h> | 14 | #include <linux/errno.h> |
15 | #include <linux/string.h> | 15 | #include <linux/string.h> |
16 | #include <linux/mm.h> | 16 | #include <linux/mm.h> |
17 | #include <linux/tty.h> | ||
18 | #include <linux/slab.h> | 17 | #include <linux/slab.h> |
19 | #include <linux/delay.h> | 18 | #include <linux/delay.h> |
20 | #include <linux/interrupt.h> | 19 | #include <linux/interrupt.h> |
diff --git a/drivers/video/retz3fb.c b/drivers/video/retz3fb.c index 5e2c64f622cb..cf41ff177644 100644 --- a/drivers/video/retz3fb.c +++ b/drivers/video/retz3fb.c | |||
@@ -25,7 +25,6 @@ | |||
25 | #include <linux/errno.h> | 25 | #include <linux/errno.h> |
26 | #include <linux/string.h> | 26 | #include <linux/string.h> |
27 | #include <linux/mm.h> | 27 | #include <linux/mm.h> |
28 | #include <linux/tty.h> | ||
29 | #include <linux/slab.h> | 28 | #include <linux/slab.h> |
30 | #include <linux/delay.h> | 29 | #include <linux/delay.h> |
31 | #include <linux/fb.h> | 30 | #include <linux/fb.h> |
diff --git a/drivers/video/riva/fbdev.c b/drivers/video/riva/fbdev.c index 2788655e6e7d..33dddbae5420 100644 --- a/drivers/video/riva/fbdev.c +++ b/drivers/video/riva/fbdev.c | |||
@@ -34,7 +34,6 @@ | |||
34 | #include <linux/errno.h> | 34 | #include <linux/errno.h> |
35 | #include <linux/string.h> | 35 | #include <linux/string.h> |
36 | #include <linux/mm.h> | 36 | #include <linux/mm.h> |
37 | #include <linux/tty.h> | ||
38 | #include <linux/slab.h> | 37 | #include <linux/slab.h> |
39 | #include <linux/delay.h> | 38 | #include <linux/delay.h> |
40 | #include <linux/fb.h> | 39 | #include <linux/fb.h> |
@@ -278,9 +277,11 @@ static const struct riva_regs reg_template = { | |||
278 | */ | 277 | */ |
279 | #define MIN_LEVEL 0x158 | 278 | #define MIN_LEVEL 0x158 |
280 | #define MAX_LEVEL 0x534 | 279 | #define MAX_LEVEL 0x534 |
280 | #define LEVEL_STEP ((MAX_LEVEL - MIN_LEVEL) / FB_BACKLIGHT_MAX) | ||
281 | 281 | ||
282 | static struct backlight_properties riva_bl_data; | 282 | static struct backlight_properties riva_bl_data; |
283 | 283 | ||
284 | /* Call with fb_info->bl_mutex held */ | ||
284 | static int riva_bl_get_level_brightness(struct riva_par *par, | 285 | static int riva_bl_get_level_brightness(struct riva_par *par, |
285 | int level) | 286 | int level) |
286 | { | 287 | { |
@@ -288,9 +289,7 @@ static int riva_bl_get_level_brightness(struct riva_par *par, | |||
288 | int nlevel; | 289 | int nlevel; |
289 | 290 | ||
290 | /* Get and convert the value */ | 291 | /* Get and convert the value */ |
291 | mutex_lock(&info->bl_mutex); | 292 | nlevel = MIN_LEVEL + info->bl_curve[level] * LEVEL_STEP; |
292 | nlevel = info->bl_curve[level] * FB_BACKLIGHT_MAX / MAX_LEVEL; | ||
293 | mutex_unlock(&info->bl_mutex); | ||
294 | 293 | ||
295 | if (nlevel < 0) | 294 | if (nlevel < 0) |
296 | nlevel = 0; | 295 | nlevel = 0; |
@@ -302,7 +301,8 @@ static int riva_bl_get_level_brightness(struct riva_par *par, | |||
302 | return nlevel; | 301 | return nlevel; |
303 | } | 302 | } |
304 | 303 | ||
305 | static int riva_bl_update_status(struct backlight_device *bd) | 304 | /* Call with fb_info->bl_mutex held */ |
305 | static int __riva_bl_update_status(struct backlight_device *bd) | ||
306 | { | 306 | { |
307 | struct riva_par *par = class_get_devdata(&bd->class_dev); | 307 | struct riva_par *par = class_get_devdata(&bd->class_dev); |
308 | U032 tmp_pcrt, tmp_pmc; | 308 | U032 tmp_pcrt, tmp_pmc; |
@@ -327,6 +327,19 @@ static int riva_bl_update_status(struct backlight_device *bd) | |||
327 | return 0; | 327 | return 0; |
328 | } | 328 | } |
329 | 329 | ||
330 | static int riva_bl_update_status(struct backlight_device *bd) | ||
331 | { | ||
332 | struct riva_par *par = class_get_devdata(&bd->class_dev); | ||
333 | struct fb_info *info = pci_get_drvdata(par->pdev); | ||
334 | int ret; | ||
335 | |||
336 | mutex_lock(&info->bl_mutex); | ||
337 | ret = __riva_bl_update_status(bd); | ||
338 | mutex_unlock(&info->bl_mutex); | ||
339 | |||
340 | return ret; | ||
341 | } | ||
342 | |||
330 | static int riva_bl_get_brightness(struct backlight_device *bd) | 343 | static int riva_bl_get_brightness(struct backlight_device *bd) |
331 | { | 344 | { |
332 | return bd->props->brightness; | 345 | return bd->props->brightness; |
@@ -339,6 +352,16 @@ static struct backlight_properties riva_bl_data = { | |||
339 | .max_brightness = (FB_BACKLIGHT_LEVELS - 1), | 352 | .max_brightness = (FB_BACKLIGHT_LEVELS - 1), |
340 | }; | 353 | }; |
341 | 354 | ||
355 | static void riva_bl_set_power(struct fb_info *info, int power) | ||
356 | { | ||
357 | mutex_lock(&info->bl_mutex); | ||
358 | up(&info->bl_dev->sem); | ||
359 | info->bl_dev->props->power = power; | ||
360 | __riva_bl_update_status(info->bl_dev); | ||
361 | down(&info->bl_dev->sem); | ||
362 | mutex_unlock(&info->bl_mutex); | ||
363 | } | ||
364 | |||
342 | static void riva_bl_init(struct riva_par *par) | 365 | static void riva_bl_init(struct riva_par *par) |
343 | { | 366 | { |
344 | struct fb_info *info = pci_get_drvdata(par->pdev); | 367 | struct fb_info *info = pci_get_drvdata(par->pdev); |
@@ -419,6 +442,7 @@ static void riva_bl_exit(struct riva_par *par) | |||
419 | #else | 442 | #else |
420 | static inline void riva_bl_init(struct riva_par *par) {} | 443 | static inline void riva_bl_init(struct riva_par *par) {} |
421 | static inline void riva_bl_exit(struct riva_par *par) {} | 444 | static inline void riva_bl_exit(struct riva_par *par) {} |
445 | static inline void riva_bl_set_power(struct fb_info *info, int power) {} | ||
422 | #endif /* CONFIG_FB_RIVA_BACKLIGHT */ | 446 | #endif /* CONFIG_FB_RIVA_BACKLIGHT */ |
423 | 447 | ||
424 | /* ------------------------------------------------------------------------- * | 448 | /* ------------------------------------------------------------------------- * |
@@ -1337,16 +1361,7 @@ static int rivafb_blank(int blank, struct fb_info *info) | |||
1337 | SEQout(par, 0x01, tmp); | 1361 | SEQout(par, 0x01, tmp); |
1338 | CRTCout(par, 0x1a, vesa); | 1362 | CRTCout(par, 0x1a, vesa); |
1339 | 1363 | ||
1340 | #ifdef CONFIG_FB_RIVA_BACKLIGHT | 1364 | riva_bl_set_power(info, blank); |
1341 | mutex_lock(&info->bl_mutex); | ||
1342 | if (info->bl_dev) { | ||
1343 | down(&info->bl_dev->sem); | ||
1344 | info->bl_dev->props->power = blank; | ||
1345 | info->bl_dev->props->update_status(info->bl_dev); | ||
1346 | up(&info->bl_dev->sem); | ||
1347 | } | ||
1348 | mutex_unlock(&info->bl_mutex); | ||
1349 | #endif | ||
1350 | 1365 | ||
1351 | NVTRACE_LEAVE(); | 1366 | NVTRACE_LEAVE(); |
1352 | 1367 | ||
diff --git a/drivers/video/s3c2410fb.c b/drivers/video/s3c2410fb.c index f461eb10cc79..ad3bdd6f1ac1 100644 --- a/drivers/video/s3c2410fb.c +++ b/drivers/video/s3c2410fb.c | |||
@@ -76,7 +76,6 @@ | |||
76 | #include <linux/errno.h> | 76 | #include <linux/errno.h> |
77 | #include <linux/string.h> | 77 | #include <linux/string.h> |
78 | #include <linux/mm.h> | 78 | #include <linux/mm.h> |
79 | #include <linux/tty.h> | ||
80 | #include <linux/slab.h> | 79 | #include <linux/slab.h> |
81 | #include <linux/delay.h> | 80 | #include <linux/delay.h> |
82 | #include <linux/fb.h> | 81 | #include <linux/fb.h> |
diff --git a/drivers/video/savage/savagefb_driver.c b/drivers/video/savage/savagefb_driver.c index 4729af477fbf..461e094e7b45 100644 --- a/drivers/video/savage/savagefb_driver.c +++ b/drivers/video/savage/savagefb_driver.c | |||
@@ -46,7 +46,6 @@ | |||
46 | #include <linux/errno.h> | 46 | #include <linux/errno.h> |
47 | #include <linux/string.h> | 47 | #include <linux/string.h> |
48 | #include <linux/mm.h> | 48 | #include <linux/mm.h> |
49 | #include <linux/tty.h> | ||
50 | #include <linux/slab.h> | 49 | #include <linux/slab.h> |
51 | #include <linux/delay.h> | 50 | #include <linux/delay.h> |
52 | #include <linux/fb.h> | 51 | #include <linux/fb.h> |
diff --git a/drivers/video/sis/sis_main.c b/drivers/video/sis/sis_main.c index b848ca7db7f9..895ebda7d9e3 100644 --- a/drivers/video/sis/sis_main.c +++ b/drivers/video/sis/sis_main.c | |||
@@ -44,7 +44,13 @@ | |||
44 | #include <linux/errno.h> | 44 | #include <linux/errno.h> |
45 | #include <linux/string.h> | 45 | #include <linux/string.h> |
46 | #include <linux/mm.h> | 46 | #include <linux/mm.h> |
47 | |||
48 | #if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,17) | ||
47 | #include <linux/tty.h> | 49 | #include <linux/tty.h> |
50 | #else | ||
51 | #include <linux/screen_info.h> | ||
52 | #endif | ||
53 | |||
48 | #include <linux/slab.h> | 54 | #include <linux/slab.h> |
49 | #include <linux/fb.h> | 55 | #include <linux/fb.h> |
50 | #include <linux/selection.h> | 56 | #include <linux/selection.h> |
diff --git a/drivers/video/skeletonfb.c b/drivers/video/skeletonfb.c index 67f429e93189..bb96cb65fdaa 100644 --- a/drivers/video/skeletonfb.c +++ b/drivers/video/skeletonfb.c | |||
@@ -47,7 +47,6 @@ | |||
47 | #include <linux/errno.h> | 47 | #include <linux/errno.h> |
48 | #include <linux/string.h> | 48 | #include <linux/string.h> |
49 | #include <linux/mm.h> | 49 | #include <linux/mm.h> |
50 | #include <linux/tty.h> | ||
51 | #include <linux/slab.h> | 50 | #include <linux/slab.h> |
52 | #include <linux/delay.h> | 51 | #include <linux/delay.h> |
53 | #include <linux/fb.h> | 52 | #include <linux/fb.h> |
diff --git a/drivers/video/sun3fb.c b/drivers/video/sun3fb.c index e046e20f02b9..f80356dfa8e8 100644 --- a/drivers/video/sun3fb.c +++ b/drivers/video/sun3fb.c | |||
@@ -30,7 +30,6 @@ | |||
30 | #include <linux/errno.h> | 30 | #include <linux/errno.h> |
31 | #include <linux/string.h> | 31 | #include <linux/string.h> |
32 | #include <linux/mm.h> | 32 | #include <linux/mm.h> |
33 | #include <linux/tty.h> | ||
34 | #include <linux/slab.h> | 33 | #include <linux/slab.h> |
35 | #include <linux/vmalloc.h> | 34 | #include <linux/vmalloc.h> |
36 | #include <linux/delay.h> | 35 | #include <linux/delay.h> |
diff --git a/drivers/video/tdfxfb.c b/drivers/video/tdfxfb.c index 239b1496874b..689ce0270b81 100644 --- a/drivers/video/tdfxfb.c +++ b/drivers/video/tdfxfb.c | |||
@@ -63,7 +63,6 @@ | |||
63 | #include <linux/errno.h> | 63 | #include <linux/errno.h> |
64 | #include <linux/string.h> | 64 | #include <linux/string.h> |
65 | #include <linux/mm.h> | 65 | #include <linux/mm.h> |
66 | #include <linux/tty.h> | ||
67 | #include <linux/slab.h> | 66 | #include <linux/slab.h> |
68 | #include <linux/delay.h> | 67 | #include <linux/delay.h> |
69 | #include <linux/interrupt.h> | 68 | #include <linux/interrupt.h> |
diff --git a/drivers/video/tgafb.c b/drivers/video/tgafb.c index 6c2c78ab9827..94fde625a6c0 100644 --- a/drivers/video/tgafb.c +++ b/drivers/video/tgafb.c | |||
@@ -17,7 +17,6 @@ | |||
17 | #include <linux/errno.h> | 17 | #include <linux/errno.h> |
18 | #include <linux/string.h> | 18 | #include <linux/string.h> |
19 | #include <linux/mm.h> | 19 | #include <linux/mm.h> |
20 | #include <linux/tty.h> | ||
21 | #include <linux/slab.h> | 20 | #include <linux/slab.h> |
22 | #include <linux/delay.h> | 21 | #include <linux/delay.h> |
23 | #include <linux/init.h> | 22 | #include <linux/init.h> |
diff --git a/drivers/video/tx3912fb.c b/drivers/video/tx3912fb.c index d904da44e1aa..07389ba01eff 100644 --- a/drivers/video/tx3912fb.c +++ b/drivers/video/tx3912fb.c | |||
@@ -14,7 +14,6 @@ | |||
14 | #include <linux/kernel.h> | 14 | #include <linux/kernel.h> |
15 | #include <linux/errno.h> | 15 | #include <linux/errno.h> |
16 | #include <linux/string.h> | 16 | #include <linux/string.h> |
17 | #include <linux/tty.h> | ||
18 | #include <linux/delay.h> | 17 | #include <linux/delay.h> |
19 | #include <linux/interrupt.h> | 18 | #include <linux/interrupt.h> |
20 | #include <linux/init.h> | 19 | #include <linux/init.h> |
diff --git a/drivers/video/valkyriefb.c b/drivers/video/valkyriefb.c index 1d76c035050e..47f27924a7d7 100644 --- a/drivers/video/valkyriefb.c +++ b/drivers/video/valkyriefb.c | |||
@@ -44,7 +44,6 @@ | |||
44 | #include <linux/errno.h> | 44 | #include <linux/errno.h> |
45 | #include <linux/string.h> | 45 | #include <linux/string.h> |
46 | #include <linux/mm.h> | 46 | #include <linux/mm.h> |
47 | #include <linux/tty.h> | ||
48 | #include <linux/slab.h> | 47 | #include <linux/slab.h> |
49 | #include <linux/vmalloc.h> | 48 | #include <linux/vmalloc.h> |
50 | #include <linux/delay.h> | 49 | #include <linux/delay.h> |
diff --git a/drivers/video/vesafb.c b/drivers/video/vesafb.c index 5718924b677f..2196448396ec 100644 --- a/drivers/video/vesafb.c +++ b/drivers/video/vesafb.c | |||
@@ -13,13 +13,13 @@ | |||
13 | #include <linux/errno.h> | 13 | #include <linux/errno.h> |
14 | #include <linux/string.h> | 14 | #include <linux/string.h> |
15 | #include <linux/mm.h> | 15 | #include <linux/mm.h> |
16 | #include <linux/tty.h> | ||
17 | #include <linux/slab.h> | 16 | #include <linux/slab.h> |
18 | #include <linux/delay.h> | 17 | #include <linux/delay.h> |
19 | #include <linux/fb.h> | 18 | #include <linux/fb.h> |
20 | #include <linux/ioport.h> | 19 | #include <linux/ioport.h> |
21 | #include <linux/init.h> | 20 | #include <linux/init.h> |
22 | #include <linux/platform_device.h> | 21 | #include <linux/platform_device.h> |
22 | #include <linux/screen_info.h> | ||
23 | 23 | ||
24 | #include <video/vga.h> | 24 | #include <video/vga.h> |
25 | #include <asm/io.h> | 25 | #include <asm/io.h> |
diff --git a/drivers/video/vfb.c b/drivers/video/vfb.c index d073ffb6e1f9..a9b99b01bd8e 100644 --- a/drivers/video/vfb.c +++ b/drivers/video/vfb.c | |||
@@ -15,7 +15,6 @@ | |||
15 | #include <linux/errno.h> | 15 | #include <linux/errno.h> |
16 | #include <linux/string.h> | 16 | #include <linux/string.h> |
17 | #include <linux/mm.h> | 17 | #include <linux/mm.h> |
18 | #include <linux/tty.h> | ||
19 | #include <linux/slab.h> | 18 | #include <linux/slab.h> |
20 | #include <linux/vmalloc.h> | 19 | #include <linux/vmalloc.h> |
21 | #include <linux/delay.h> | 20 | #include <linux/delay.h> |
diff --git a/drivers/video/vga16fb.c b/drivers/video/vga16fb.c index 3c404c9bd36c..43d5a6d9c4a6 100644 --- a/drivers/video/vga16fb.c +++ b/drivers/video/vga16fb.c | |||
@@ -15,13 +15,13 @@ | |||
15 | #include <linux/errno.h> | 15 | #include <linux/errno.h> |
16 | #include <linux/string.h> | 16 | #include <linux/string.h> |
17 | #include <linux/mm.h> | 17 | #include <linux/mm.h> |
18 | #include <linux/tty.h> | ||
19 | #include <linux/slab.h> | 18 | #include <linux/slab.h> |
20 | #include <linux/delay.h> | 19 | #include <linux/delay.h> |
21 | #include <linux/fb.h> | 20 | #include <linux/fb.h> |
22 | #include <linux/ioport.h> | 21 | #include <linux/ioport.h> |
23 | #include <linux/init.h> | 22 | #include <linux/init.h> |
24 | #include <linux/platform_device.h> | 23 | #include <linux/platform_device.h> |
24 | #include <linux/screen_info.h> | ||
25 | 25 | ||
26 | #include <asm/io.h> | 26 | #include <asm/io.h> |
27 | #include <video/vga.h> | 27 | #include <video/vga.h> |
diff --git a/drivers/video/virgefb.c b/drivers/video/virgefb.c index 5ea2345dab99..64378959dd7b 100644 --- a/drivers/video/virgefb.c +++ b/drivers/video/virgefb.c | |||
@@ -39,7 +39,6 @@ | |||
39 | #include <linux/errno.h> | 39 | #include <linux/errno.h> |
40 | #include <linux/string.h> | 40 | #include <linux/string.h> |
41 | #include <linux/mm.h> | 41 | #include <linux/mm.h> |
42 | #include <linux/tty.h> | ||
43 | #include <linux/slab.h> | 42 | #include <linux/slab.h> |
44 | #include <linux/delay.h> | 43 | #include <linux/delay.h> |
45 | #include <linux/zorro.h> | 44 | #include <linux/zorro.h> |
diff --git a/drivers/w1/masters/ds2482.c b/drivers/w1/masters/ds2482.c index af492cc48db2..d93eb626b2f0 100644 --- a/drivers/w1/masters/ds2482.c +++ b/drivers/w1/masters/ds2482.c | |||
@@ -218,7 +218,7 @@ static int ds2482_wait_1wire_idle(struct ds2482_data *pdev) | |||
218 | do { | 218 | do { |
219 | temp = i2c_smbus_read_byte(&pdev->client); | 219 | temp = i2c_smbus_read_byte(&pdev->client); |
220 | } while ((temp >= 0) && (temp & DS2482_REG_STS_1WB) && | 220 | } while ((temp >= 0) && (temp & DS2482_REG_STS_1WB) && |
221 | (++retries > DS2482_WAIT_IDLE_TIMEOUT)); | 221 | (++retries < DS2482_WAIT_IDLE_TIMEOUT)); |
222 | } | 222 | } |
223 | 223 | ||
224 | if (retries > DS2482_WAIT_IDLE_TIMEOUT) | 224 | if (retries > DS2482_WAIT_IDLE_TIMEOUT) |
diff --git a/drivers/w1/w1_io.h b/drivers/w1/w1_io.h deleted file mode 100644 index 9a76d2ad69c5..000000000000 --- a/drivers/w1/w1_io.h +++ /dev/null | |||
@@ -1,36 +0,0 @@ | |||
1 | /* | ||
2 | * w1_io.h | ||
3 | * | ||
4 | * Copyright (c) 2004 Evgeniy Polyakov <johnpol@2ka.mipt.ru> | ||
5 | * | ||
6 | * | ||
7 | * This program is free software; you can redistribute it and/or modify | ||
8 | * it under the terms of the GNU General Public License as published by | ||
9 | * the Free Software Foundation; either version 2 of the License, or | ||
10 | * (at your option) any later version. | ||
11 | * | ||
12 | * This program is distributed in the hope that it will be useful, | ||
13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
15 | * GNU General Public License for more details. | ||
16 | * | ||
17 | * You should have received a copy of the GNU General Public License | ||
18 | * along with this program; if not, write to the Free Software | ||
19 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | ||
20 | */ | ||
21 | |||
22 | #ifndef __W1_IO_H | ||
23 | #define __W1_IO_H | ||
24 | |||
25 | #include "w1.h" | ||
26 | |||
27 | u8 w1_triplet(struct w1_master *dev, int bdir); | ||
28 | void w1_write_8(struct w1_master *, u8); | ||
29 | int w1_reset_bus(struct w1_master *); | ||
30 | u8 w1_calc_crc8(u8 *, int); | ||
31 | void w1_write_block(struct w1_master *, const u8 *, int); | ||
32 | u8 w1_read_block(struct w1_master *, u8 *, int); | ||
33 | void w1_search_devices(struct w1_master *dev, w1_slave_found_callback cb); | ||
34 | int w1_reset_select_slave(struct w1_slave *sl); | ||
35 | |||
36 | #endif /* __W1_IO_H */ | ||