diff options
Diffstat (limited to 'drivers')
409 files changed, 5551 insertions, 2454 deletions
diff --git a/drivers/acpi/ac.c b/drivers/acpi/ac.c index c67f6f5ad611..36b0e61f9c09 100644 --- a/drivers/acpi/ac.c +++ b/drivers/acpi/ac.c | |||
@@ -30,6 +30,10 @@ | |||
30 | #include <linux/types.h> | 30 | #include <linux/types.h> |
31 | #include <linux/dmi.h> | 31 | #include <linux/dmi.h> |
32 | #include <linux/delay.h> | 32 | #include <linux/delay.h> |
33 | #ifdef CONFIG_ACPI_PROCFS_POWER | ||
34 | #include <linux/proc_fs.h> | ||
35 | #include <linux/seq_file.h> | ||
36 | #endif | ||
33 | #include <linux/platform_device.h> | 37 | #include <linux/platform_device.h> |
34 | #include <linux/power_supply.h> | 38 | #include <linux/power_supply.h> |
35 | #include <linux/acpi.h> | 39 | #include <linux/acpi.h> |
@@ -52,6 +56,7 @@ MODULE_AUTHOR("Paul Diefenbaugh"); | |||
52 | MODULE_DESCRIPTION("ACPI AC Adapter Driver"); | 56 | MODULE_DESCRIPTION("ACPI AC Adapter Driver"); |
53 | MODULE_LICENSE("GPL"); | 57 | MODULE_LICENSE("GPL"); |
54 | 58 | ||
59 | |||
55 | static int acpi_ac_add(struct acpi_device *device); | 60 | static int acpi_ac_add(struct acpi_device *device); |
56 | static int acpi_ac_remove(struct acpi_device *device); | 61 | static int acpi_ac_remove(struct acpi_device *device); |
57 | static void acpi_ac_notify(struct acpi_device *device, u32 event); | 62 | static void acpi_ac_notify(struct acpi_device *device, u32 event); |
@@ -67,6 +72,13 @@ static int acpi_ac_resume(struct device *dev); | |||
67 | #endif | 72 | #endif |
68 | static SIMPLE_DEV_PM_OPS(acpi_ac_pm, NULL, acpi_ac_resume); | 73 | static SIMPLE_DEV_PM_OPS(acpi_ac_pm, NULL, acpi_ac_resume); |
69 | 74 | ||
75 | #ifdef CONFIG_ACPI_PROCFS_POWER | ||
76 | extern struct proc_dir_entry *acpi_lock_ac_dir(void); | ||
77 | extern void *acpi_unlock_ac_dir(struct proc_dir_entry *acpi_ac_dir); | ||
78 | static int acpi_ac_open_fs(struct inode *inode, struct file *file); | ||
79 | #endif | ||
80 | |||
81 | |||
70 | static int ac_sleep_before_get_state_ms; | 82 | static int ac_sleep_before_get_state_ms; |
71 | 83 | ||
72 | static struct acpi_driver acpi_ac_driver = { | 84 | static struct acpi_driver acpi_ac_driver = { |
@@ -91,6 +103,16 @@ struct acpi_ac { | |||
91 | 103 | ||
92 | #define to_acpi_ac(x) container_of(x, struct acpi_ac, charger) | 104 | #define to_acpi_ac(x) container_of(x, struct acpi_ac, charger) |
93 | 105 | ||
106 | #ifdef CONFIG_ACPI_PROCFS_POWER | ||
107 | static const struct file_operations acpi_ac_fops = { | ||
108 | .owner = THIS_MODULE, | ||
109 | .open = acpi_ac_open_fs, | ||
110 | .read = seq_read, | ||
111 | .llseek = seq_lseek, | ||
112 | .release = single_release, | ||
113 | }; | ||
114 | #endif | ||
115 | |||
94 | /* -------------------------------------------------------------------------- | 116 | /* -------------------------------------------------------------------------- |
95 | AC Adapter Management | 117 | AC Adapter Management |
96 | -------------------------------------------------------------------------- */ | 118 | -------------------------------------------------------------------------- */ |
@@ -143,6 +165,83 @@ static enum power_supply_property ac_props[] = { | |||
143 | POWER_SUPPLY_PROP_ONLINE, | 165 | POWER_SUPPLY_PROP_ONLINE, |
144 | }; | 166 | }; |
145 | 167 | ||
168 | #ifdef CONFIG_ACPI_PROCFS_POWER | ||
169 | /* -------------------------------------------------------------------------- | ||
170 | FS Interface (/proc) | ||
171 | -------------------------------------------------------------------------- */ | ||
172 | |||
173 | static struct proc_dir_entry *acpi_ac_dir; | ||
174 | |||
175 | static int acpi_ac_seq_show(struct seq_file *seq, void *offset) | ||
176 | { | ||
177 | struct acpi_ac *ac = seq->private; | ||
178 | |||
179 | |||
180 | if (!ac) | ||
181 | return 0; | ||
182 | |||
183 | if (acpi_ac_get_state(ac)) { | ||
184 | seq_puts(seq, "ERROR: Unable to read AC Adapter state\n"); | ||
185 | return 0; | ||
186 | } | ||
187 | |||
188 | seq_puts(seq, "state: "); | ||
189 | switch (ac->state) { | ||
190 | case ACPI_AC_STATUS_OFFLINE: | ||
191 | seq_puts(seq, "off-line\n"); | ||
192 | break; | ||
193 | case ACPI_AC_STATUS_ONLINE: | ||
194 | seq_puts(seq, "on-line\n"); | ||
195 | break; | ||
196 | default: | ||
197 | seq_puts(seq, "unknown\n"); | ||
198 | break; | ||
199 | } | ||
200 | |||
201 | return 0; | ||
202 | } | ||
203 | |||
204 | static int acpi_ac_open_fs(struct inode *inode, struct file *file) | ||
205 | { | ||
206 | return single_open(file, acpi_ac_seq_show, PDE_DATA(inode)); | ||
207 | } | ||
208 | |||
209 | static int acpi_ac_add_fs(struct acpi_ac *ac) | ||
210 | { | ||
211 | struct proc_dir_entry *entry = NULL; | ||
212 | |||
213 | printk(KERN_WARNING PREFIX "Deprecated procfs I/F for AC is loaded," | ||
214 | " please retry with CONFIG_ACPI_PROCFS_POWER cleared\n"); | ||
215 | if (!acpi_device_dir(ac->device)) { | ||
216 | acpi_device_dir(ac->device) = | ||
217 | proc_mkdir(acpi_device_bid(ac->device), acpi_ac_dir); | ||
218 | if (!acpi_device_dir(ac->device)) | ||
219 | return -ENODEV; | ||
220 | } | ||
221 | |||
222 | /* 'state' [R] */ | ||
223 | entry = proc_create_data(ACPI_AC_FILE_STATE, | ||
224 | S_IRUGO, acpi_device_dir(ac->device), | ||
225 | &acpi_ac_fops, ac); | ||
226 | if (!entry) | ||
227 | return -ENODEV; | ||
228 | return 0; | ||
229 | } | ||
230 | |||
231 | static int acpi_ac_remove_fs(struct acpi_ac *ac) | ||
232 | { | ||
233 | |||
234 | if (acpi_device_dir(ac->device)) { | ||
235 | remove_proc_entry(ACPI_AC_FILE_STATE, | ||
236 | acpi_device_dir(ac->device)); | ||
237 | remove_proc_entry(acpi_device_bid(ac->device), acpi_ac_dir); | ||
238 | acpi_device_dir(ac->device) = NULL; | ||
239 | } | ||
240 | |||
241 | return 0; | ||
242 | } | ||
243 | #endif | ||
244 | |||
146 | /* -------------------------------------------------------------------------- | 245 | /* -------------------------------------------------------------------------- |
147 | Driver Model | 246 | Driver Model |
148 | -------------------------------------------------------------------------- */ | 247 | -------------------------------------------------------------------------- */ |
@@ -243,6 +342,11 @@ static int acpi_ac_add(struct acpi_device *device) | |||
243 | goto end; | 342 | goto end; |
244 | 343 | ||
245 | ac->charger.name = acpi_device_bid(device); | 344 | ac->charger.name = acpi_device_bid(device); |
345 | #ifdef CONFIG_ACPI_PROCFS_POWER | ||
346 | result = acpi_ac_add_fs(ac); | ||
347 | if (result) | ||
348 | goto end; | ||
349 | #endif | ||
246 | ac->charger.type = POWER_SUPPLY_TYPE_MAINS; | 350 | ac->charger.type = POWER_SUPPLY_TYPE_MAINS; |
247 | ac->charger.properties = ac_props; | 351 | ac->charger.properties = ac_props; |
248 | ac->charger.num_properties = ARRAY_SIZE(ac_props); | 352 | ac->charger.num_properties = ARRAY_SIZE(ac_props); |
@@ -258,8 +362,12 @@ static int acpi_ac_add(struct acpi_device *device) | |||
258 | ac->battery_nb.notifier_call = acpi_ac_battery_notify; | 362 | ac->battery_nb.notifier_call = acpi_ac_battery_notify; |
259 | register_acpi_notifier(&ac->battery_nb); | 363 | register_acpi_notifier(&ac->battery_nb); |
260 | end: | 364 | end: |
261 | if (result) | 365 | if (result) { |
366 | #ifdef CONFIG_ACPI_PROCFS_POWER | ||
367 | acpi_ac_remove_fs(ac); | ||
368 | #endif | ||
262 | kfree(ac); | 369 | kfree(ac); |
370 | } | ||
263 | 371 | ||
264 | dmi_check_system(ac_dmi_table); | 372 | dmi_check_system(ac_dmi_table); |
265 | return result; | 373 | return result; |
@@ -303,6 +411,10 @@ static int acpi_ac_remove(struct acpi_device *device) | |||
303 | power_supply_unregister(&ac->charger); | 411 | power_supply_unregister(&ac->charger); |
304 | unregister_acpi_notifier(&ac->battery_nb); | 412 | unregister_acpi_notifier(&ac->battery_nb); |
305 | 413 | ||
414 | #ifdef CONFIG_ACPI_PROCFS_POWER | ||
415 | acpi_ac_remove_fs(ac); | ||
416 | #endif | ||
417 | |||
306 | kfree(ac); | 418 | kfree(ac); |
307 | 419 | ||
308 | return 0; | 420 | return 0; |
@@ -315,9 +427,20 @@ static int __init acpi_ac_init(void) | |||
315 | if (acpi_disabled) | 427 | if (acpi_disabled) |
316 | return -ENODEV; | 428 | return -ENODEV; |
317 | 429 | ||
430 | #ifdef CONFIG_ACPI_PROCFS_POWER | ||
431 | acpi_ac_dir = acpi_lock_ac_dir(); | ||
432 | if (!acpi_ac_dir) | ||
433 | return -ENODEV; | ||
434 | #endif | ||
435 | |||
436 | |||
318 | result = acpi_bus_register_driver(&acpi_ac_driver); | 437 | result = acpi_bus_register_driver(&acpi_ac_driver); |
319 | if (result < 0) | 438 | if (result < 0) { |
439 | #ifdef CONFIG_ACPI_PROCFS_POWER | ||
440 | acpi_unlock_ac_dir(acpi_ac_dir); | ||
441 | #endif | ||
320 | return -ENODEV; | 442 | return -ENODEV; |
443 | } | ||
321 | 444 | ||
322 | return 0; | 445 | return 0; |
323 | } | 446 | } |
@@ -325,6 +448,9 @@ static int __init acpi_ac_init(void) | |||
325 | static void __exit acpi_ac_exit(void) | 448 | static void __exit acpi_ac_exit(void) |
326 | { | 449 | { |
327 | acpi_bus_unregister_driver(&acpi_ac_driver); | 450 | acpi_bus_unregister_driver(&acpi_ac_driver); |
451 | #ifdef CONFIG_ACPI_PROCFS_POWER | ||
452 | acpi_unlock_ac_dir(acpi_ac_dir); | ||
453 | #endif | ||
328 | } | 454 | } |
329 | module_init(acpi_ac_init); | 455 | module_init(acpi_ac_init); |
330 | module_exit(acpi_ac_exit); | 456 | module_exit(acpi_ac_exit); |
diff --git a/drivers/acpi/acpi_lpss.c b/drivers/acpi/acpi_lpss.c index 63407d264885..9cb65b0e7597 100644 --- a/drivers/acpi/acpi_lpss.c +++ b/drivers/acpi/acpi_lpss.c | |||
@@ -34,6 +34,9 @@ ACPI_MODULE_NAME("acpi_lpss"); | |||
34 | 34 | ||
35 | /* Offsets relative to LPSS_PRIVATE_OFFSET */ | 35 | /* Offsets relative to LPSS_PRIVATE_OFFSET */ |
36 | #define LPSS_CLK_DIVIDER_DEF_MASK (BIT(1) | BIT(16)) | 36 | #define LPSS_CLK_DIVIDER_DEF_MASK (BIT(1) | BIT(16)) |
37 | #define LPSS_RESETS 0x04 | ||
38 | #define LPSS_RESETS_RESET_FUNC BIT(0) | ||
39 | #define LPSS_RESETS_RESET_APB BIT(1) | ||
37 | #define LPSS_GENERAL 0x08 | 40 | #define LPSS_GENERAL 0x08 |
38 | #define LPSS_GENERAL_LTR_MODE_SW BIT(2) | 41 | #define LPSS_GENERAL_LTR_MODE_SW BIT(2) |
39 | #define LPSS_GENERAL_UART_RTS_OVRD BIT(3) | 42 | #define LPSS_GENERAL_UART_RTS_OVRD BIT(3) |
@@ -99,6 +102,17 @@ static void lpss_uart_setup(struct lpss_private_data *pdata) | |||
99 | writel(reg | LPSS_GENERAL_UART_RTS_OVRD, pdata->mmio_base + offset); | 102 | writel(reg | LPSS_GENERAL_UART_RTS_OVRD, pdata->mmio_base + offset); |
100 | } | 103 | } |
101 | 104 | ||
105 | static void lpss_i2c_setup(struct lpss_private_data *pdata) | ||
106 | { | ||
107 | unsigned int offset; | ||
108 | u32 val; | ||
109 | |||
110 | offset = pdata->dev_desc->prv_offset + LPSS_RESETS; | ||
111 | val = readl(pdata->mmio_base + offset); | ||
112 | val |= LPSS_RESETS_RESET_APB | LPSS_RESETS_RESET_FUNC; | ||
113 | writel(val, pdata->mmio_base + offset); | ||
114 | } | ||
115 | |||
102 | static struct lpss_device_desc lpt_dev_desc = { | 116 | static struct lpss_device_desc lpt_dev_desc = { |
103 | .clk_required = true, | 117 | .clk_required = true, |
104 | .prv_offset = 0x800, | 118 | .prv_offset = 0x800, |
@@ -171,6 +185,7 @@ static struct lpss_device_desc byt_i2c_dev_desc = { | |||
171 | .prv_offset = 0x800, | 185 | .prv_offset = 0x800, |
172 | .save_ctx = true, | 186 | .save_ctx = true, |
173 | .shared_clock = &i2c_clock, | 187 | .shared_clock = &i2c_clock, |
188 | .setup = lpss_i2c_setup, | ||
174 | }; | 189 | }; |
175 | 190 | ||
176 | #else | 191 | #else |
diff --git a/drivers/acpi/acpi_pnp.c b/drivers/acpi/acpi_pnp.c index 6703c1fd993a..4ddb0dca56f6 100644 --- a/drivers/acpi/acpi_pnp.c +++ b/drivers/acpi/acpi_pnp.c | |||
@@ -14,6 +14,8 @@ | |||
14 | #include <linux/module.h> | 14 | #include <linux/module.h> |
15 | 15 | ||
16 | static const struct acpi_device_id acpi_pnp_device_ids[] = { | 16 | static const struct acpi_device_id acpi_pnp_device_ids[] = { |
17 | /* soc_button_array */ | ||
18 | {"PNP0C40"}, | ||
17 | /* pata_isapnp */ | 19 | /* pata_isapnp */ |
18 | {"PNP0600"}, /* Generic ESDI/IDE/ATA compatible hard disk controller */ | 20 | {"PNP0600"}, /* Generic ESDI/IDE/ATA compatible hard disk controller */ |
19 | /* floppy */ | 21 | /* floppy */ |
diff --git a/drivers/acpi/battery.c b/drivers/acpi/battery.c index e48fc98e71c4..130f513e08c9 100644 --- a/drivers/acpi/battery.c +++ b/drivers/acpi/battery.c | |||
@@ -32,8 +32,10 @@ | |||
32 | #include <linux/jiffies.h> | 32 | #include <linux/jiffies.h> |
33 | #include <linux/async.h> | 33 | #include <linux/async.h> |
34 | #include <linux/dmi.h> | 34 | #include <linux/dmi.h> |
35 | #include <linux/delay.h> | ||
35 | #include <linux/slab.h> | 36 | #include <linux/slab.h> |
36 | #include <linux/suspend.h> | 37 | #include <linux/suspend.h> |
38 | #include <linux/delay.h> | ||
37 | #include <asm/unaligned.h> | 39 | #include <asm/unaligned.h> |
38 | 40 | ||
39 | #ifdef CONFIG_ACPI_PROCFS_POWER | 41 | #ifdef CONFIG_ACPI_PROCFS_POWER |
@@ -70,6 +72,7 @@ MODULE_DESCRIPTION("ACPI Battery Driver"); | |||
70 | MODULE_LICENSE("GPL"); | 72 | MODULE_LICENSE("GPL"); |
71 | 73 | ||
72 | static int battery_bix_broken_package; | 74 | static int battery_bix_broken_package; |
75 | static int battery_notification_delay_ms; | ||
73 | static unsigned int cache_time = 1000; | 76 | static unsigned int cache_time = 1000; |
74 | module_param(cache_time, uint, 0644); | 77 | module_param(cache_time, uint, 0644); |
75 | MODULE_PARM_DESC(cache_time, "cache time in milliseconds"); | 78 | MODULE_PARM_DESC(cache_time, "cache time in milliseconds"); |
@@ -532,6 +535,20 @@ static int acpi_battery_get_state(struct acpi_battery *battery) | |||
532 | " invalid.\n"); | 535 | " invalid.\n"); |
533 | } | 536 | } |
534 | 537 | ||
538 | /* | ||
539 | * When fully charged, some batteries wrongly report | ||
540 | * capacity_now = design_capacity instead of = full_charge_capacity | ||
541 | */ | ||
542 | if (battery->capacity_now > battery->full_charge_capacity | ||
543 | && battery->full_charge_capacity != ACPI_BATTERY_VALUE_UNKNOWN) { | ||
544 | battery->capacity_now = battery->full_charge_capacity; | ||
545 | if (battery->capacity_now != battery->design_capacity) | ||
546 | printk_once(KERN_WARNING FW_BUG | ||
547 | "battery: reported current charge level (%d) " | ||
548 | "is higher than reported maximum charge level (%d).\n", | ||
549 | battery->capacity_now, battery->full_charge_capacity); | ||
550 | } | ||
551 | |||
535 | if (test_bit(ACPI_BATTERY_QUIRK_PERCENTAGE_CAPACITY, &battery->flags) | 552 | if (test_bit(ACPI_BATTERY_QUIRK_PERCENTAGE_CAPACITY, &battery->flags) |
536 | && battery->capacity_now >= 0 && battery->capacity_now <= 100) | 553 | && battery->capacity_now >= 0 && battery->capacity_now <= 100) |
537 | battery->capacity_now = (battery->capacity_now * | 554 | battery->capacity_now = (battery->capacity_now * |
@@ -930,7 +947,10 @@ static ssize_t acpi_battery_write_alarm(struct file *file, | |||
930 | goto end; | 947 | goto end; |
931 | } | 948 | } |
932 | alarm_string[count] = '\0'; | 949 | alarm_string[count] = '\0'; |
933 | battery->alarm = simple_strtol(alarm_string, NULL, 0); | 950 | if (kstrtoint(alarm_string, 0, &battery->alarm)) { |
951 | result = -EINVAL; | ||
952 | goto end; | ||
953 | } | ||
934 | result = acpi_battery_set_alarm(battery); | 954 | result = acpi_battery_set_alarm(battery); |
935 | end: | 955 | end: |
936 | if (!result) | 956 | if (!result) |
@@ -1062,6 +1082,14 @@ static void acpi_battery_notify(struct acpi_device *device, u32 event) | |||
1062 | if (!battery) | 1082 | if (!battery) |
1063 | return; | 1083 | return; |
1064 | old = battery->bat.dev; | 1084 | old = battery->bat.dev; |
1085 | /* | ||
1086 | * On Acer Aspire V5-573G notifications are sometimes triggered too | ||
1087 | * early. For example, when AC is unplugged and notification is | ||
1088 | * triggered, battery state is still reported as "Full", and changes to | ||
1089 | * "Discharging" only after short delay, without any notification. | ||
1090 | */ | ||
1091 | if (battery_notification_delay_ms > 0) | ||
1092 | msleep(battery_notification_delay_ms); | ||
1065 | if (event == ACPI_BATTERY_NOTIFY_INFO) | 1093 | if (event == ACPI_BATTERY_NOTIFY_INFO) |
1066 | acpi_battery_refresh(battery); | 1094 | acpi_battery_refresh(battery); |
1067 | acpi_battery_update(battery, false); | 1095 | acpi_battery_update(battery, false); |
@@ -1106,17 +1134,60 @@ static int battery_notify(struct notifier_block *nb, | |||
1106 | return 0; | 1134 | return 0; |
1107 | } | 1135 | } |
1108 | 1136 | ||
1137 | static int battery_bix_broken_package_quirk(const struct dmi_system_id *d) | ||
1138 | { | ||
1139 | battery_bix_broken_package = 1; | ||
1140 | return 0; | ||
1141 | } | ||
1142 | |||
1143 | static int battery_notification_delay_quirk(const struct dmi_system_id *d) | ||
1144 | { | ||
1145 | battery_notification_delay_ms = 1000; | ||
1146 | return 0; | ||
1147 | } | ||
1148 | |||
1109 | static struct dmi_system_id bat_dmi_table[] = { | 1149 | static struct dmi_system_id bat_dmi_table[] = { |
1110 | { | 1150 | { |
1151 | .callback = battery_bix_broken_package_quirk, | ||
1111 | .ident = "NEC LZ750/LS", | 1152 | .ident = "NEC LZ750/LS", |
1112 | .matches = { | 1153 | .matches = { |
1113 | DMI_MATCH(DMI_SYS_VENDOR, "NEC"), | 1154 | DMI_MATCH(DMI_SYS_VENDOR, "NEC"), |
1114 | DMI_MATCH(DMI_PRODUCT_NAME, "PC-LZ750LS"), | 1155 | DMI_MATCH(DMI_PRODUCT_NAME, "PC-LZ750LS"), |
1115 | }, | 1156 | }, |
1116 | }, | 1157 | }, |
1158 | { | ||
1159 | .callback = battery_notification_delay_quirk, | ||
1160 | .ident = "Acer Aspire V5-573G", | ||
1161 | .matches = { | ||
1162 | DMI_MATCH(DMI_SYS_VENDOR, "Acer"), | ||
1163 | DMI_MATCH(DMI_PRODUCT_NAME, "Aspire V5-573G"), | ||
1164 | }, | ||
1165 | }, | ||
1117 | {}, | 1166 | {}, |
1118 | }; | 1167 | }; |
1119 | 1168 | ||
1169 | /* | ||
1170 | * Some machines'(E,G Lenovo Z480) ECs are not stable | ||
1171 | * during boot up and this causes battery driver fails to be | ||
1172 | * probed due to failure of getting battery information | ||
1173 | * from EC sometimes. After several retries, the operation | ||
1174 | * may work. So add retry code here and 20ms sleep between | ||
1175 | * every retries. | ||
1176 | */ | ||
1177 | static int acpi_battery_update_retry(struct acpi_battery *battery) | ||
1178 | { | ||
1179 | int retry, ret; | ||
1180 | |||
1181 | for (retry = 5; retry; retry--) { | ||
1182 | ret = acpi_battery_update(battery, false); | ||
1183 | if (!ret) | ||
1184 | break; | ||
1185 | |||
1186 | msleep(20); | ||
1187 | } | ||
1188 | return ret; | ||
1189 | } | ||
1190 | |||
1120 | static int acpi_battery_add(struct acpi_device *device) | 1191 | static int acpi_battery_add(struct acpi_device *device) |
1121 | { | 1192 | { |
1122 | int result = 0; | 1193 | int result = 0; |
@@ -1135,9 +1206,11 @@ static int acpi_battery_add(struct acpi_device *device) | |||
1135 | mutex_init(&battery->sysfs_lock); | 1206 | mutex_init(&battery->sysfs_lock); |
1136 | if (acpi_has_method(battery->device->handle, "_BIX")) | 1207 | if (acpi_has_method(battery->device->handle, "_BIX")) |
1137 | set_bit(ACPI_BATTERY_XINFO_PRESENT, &battery->flags); | 1208 | set_bit(ACPI_BATTERY_XINFO_PRESENT, &battery->flags); |
1138 | result = acpi_battery_update(battery, false); | 1209 | |
1210 | result = acpi_battery_update_retry(battery); | ||
1139 | if (result) | 1211 | if (result) |
1140 | goto fail; | 1212 | goto fail; |
1213 | |||
1141 | #ifdef CONFIG_ACPI_PROCFS_POWER | 1214 | #ifdef CONFIG_ACPI_PROCFS_POWER |
1142 | result = acpi_battery_add_fs(device); | 1215 | result = acpi_battery_add_fs(device); |
1143 | #endif | 1216 | #endif |
@@ -1227,8 +1300,7 @@ static void __init acpi_battery_init_async(void *unused, async_cookie_t cookie) | |||
1227 | if (acpi_disabled) | 1300 | if (acpi_disabled) |
1228 | return; | 1301 | return; |
1229 | 1302 | ||
1230 | if (dmi_check_system(bat_dmi_table)) | 1303 | dmi_check_system(bat_dmi_table); |
1231 | battery_bix_broken_package = 1; | ||
1232 | 1304 | ||
1233 | #ifdef CONFIG_ACPI_PROCFS_POWER | 1305 | #ifdef CONFIG_ACPI_PROCFS_POWER |
1234 | acpi_battery_dir = acpi_lock_battery_dir(); | 1306 | acpi_battery_dir = acpi_lock_battery_dir(); |
diff --git a/drivers/acpi/ec.c b/drivers/acpi/ec.c index ad11ba4a412d..a66ab658abbc 100644 --- a/drivers/acpi/ec.c +++ b/drivers/acpi/ec.c | |||
@@ -1,11 +1,14 @@ | |||
1 | /* | 1 | /* |
2 | * ec.c - ACPI Embedded Controller Driver (v2.1) | 2 | * ec.c - ACPI Embedded Controller Driver (v2.2) |
3 | * | 3 | * |
4 | * Copyright (C) 2006-2008 Alexey Starikovskiy <astarikovskiy@suse.de> | 4 | * Copyright (C) 2001-2014 Intel Corporation |
5 | * Copyright (C) 2006 Denis Sadykov <denis.m.sadykov@intel.com> | 5 | * Author: 2014 Lv Zheng <lv.zheng@intel.com> |
6 | * Copyright (C) 2004 Luming Yu <luming.yu@intel.com> | 6 | * 2006, 2007 Alexey Starikovskiy <alexey.y.starikovskiy@intel.com> |
7 | * Copyright (C) 2001, 2002 Andy Grover <andrew.grover@intel.com> | 7 | * 2006 Denis Sadykov <denis.m.sadykov@intel.com> |
8 | * Copyright (C) 2001, 2002 Paul Diefenbaugh <paul.s.diefenbaugh@intel.com> | 8 | * 2004 Luming Yu <luming.yu@intel.com> |
9 | * 2001, 2002 Andy Grover <andrew.grover@intel.com> | ||
10 | * 2001, 2002 Paul Diefenbaugh <paul.s.diefenbaugh@intel.com> | ||
11 | * Copyright (C) 2008 Alexey Starikovskiy <astarikovskiy@suse.de> | ||
9 | * | 12 | * |
10 | * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | 13 | * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
11 | * | 14 | * |
@@ -52,6 +55,7 @@ | |||
52 | /* EC status register */ | 55 | /* EC status register */ |
53 | #define ACPI_EC_FLAG_OBF 0x01 /* Output buffer full */ | 56 | #define ACPI_EC_FLAG_OBF 0x01 /* Output buffer full */ |
54 | #define ACPI_EC_FLAG_IBF 0x02 /* Input buffer full */ | 57 | #define ACPI_EC_FLAG_IBF 0x02 /* Input buffer full */ |
58 | #define ACPI_EC_FLAG_CMD 0x08 /* Input buffer contains a command */ | ||
55 | #define ACPI_EC_FLAG_BURST 0x10 /* burst mode */ | 59 | #define ACPI_EC_FLAG_BURST 0x10 /* burst mode */ |
56 | #define ACPI_EC_FLAG_SCI 0x20 /* EC-SCI occurred */ | 60 | #define ACPI_EC_FLAG_SCI 0x20 /* EC-SCI occurred */ |
57 | 61 | ||
@@ -78,6 +82,9 @@ enum { | |||
78 | EC_FLAGS_BLOCKED, /* Transactions are blocked */ | 82 | EC_FLAGS_BLOCKED, /* Transactions are blocked */ |
79 | }; | 83 | }; |
80 | 84 | ||
85 | #define ACPI_EC_COMMAND_POLL 0x01 /* Available for command byte */ | ||
86 | #define ACPI_EC_COMMAND_COMPLETE 0x02 /* Completed last byte */ | ||
87 | |||
81 | /* ec.c is compiled in acpi namespace so this shows up as acpi.ec_delay param */ | 88 | /* ec.c is compiled in acpi namespace so this shows up as acpi.ec_delay param */ |
82 | static unsigned int ec_delay __read_mostly = ACPI_EC_DELAY; | 89 | static unsigned int ec_delay __read_mostly = ACPI_EC_DELAY; |
83 | module_param(ec_delay, uint, 0644); | 90 | module_param(ec_delay, uint, 0644); |
@@ -109,7 +116,7 @@ struct transaction { | |||
109 | u8 ri; | 116 | u8 ri; |
110 | u8 wlen; | 117 | u8 wlen; |
111 | u8 rlen; | 118 | u8 rlen; |
112 | bool done; | 119 | u8 flags; |
113 | }; | 120 | }; |
114 | 121 | ||
115 | struct acpi_ec *boot_ec, *first_ec; | 122 | struct acpi_ec *boot_ec, *first_ec; |
@@ -127,83 +134,104 @@ static int EC_FLAGS_CLEAR_ON_RESUME; /* Needs acpi_ec_clear() on boot/resume */ | |||
127 | static inline u8 acpi_ec_read_status(struct acpi_ec *ec) | 134 | static inline u8 acpi_ec_read_status(struct acpi_ec *ec) |
128 | { | 135 | { |
129 | u8 x = inb(ec->command_addr); | 136 | u8 x = inb(ec->command_addr); |
130 | pr_debug("---> status = 0x%2.2x\n", x); | 137 | pr_debug("EC_SC(R) = 0x%2.2x " |
138 | "SCI_EVT=%d BURST=%d CMD=%d IBF=%d OBF=%d\n", | ||
139 | x, | ||
140 | !!(x & ACPI_EC_FLAG_SCI), | ||
141 | !!(x & ACPI_EC_FLAG_BURST), | ||
142 | !!(x & ACPI_EC_FLAG_CMD), | ||
143 | !!(x & ACPI_EC_FLAG_IBF), | ||
144 | !!(x & ACPI_EC_FLAG_OBF)); | ||
131 | return x; | 145 | return x; |
132 | } | 146 | } |
133 | 147 | ||
134 | static inline u8 acpi_ec_read_data(struct acpi_ec *ec) | 148 | static inline u8 acpi_ec_read_data(struct acpi_ec *ec) |
135 | { | 149 | { |
136 | u8 x = inb(ec->data_addr); | 150 | u8 x = inb(ec->data_addr); |
137 | pr_debug("---> data = 0x%2.2x\n", x); | 151 | pr_debug("EC_DATA(R) = 0x%2.2x\n", x); |
138 | return x; | 152 | return x; |
139 | } | 153 | } |
140 | 154 | ||
141 | static inline void acpi_ec_write_cmd(struct acpi_ec *ec, u8 command) | 155 | static inline void acpi_ec_write_cmd(struct acpi_ec *ec, u8 command) |
142 | { | 156 | { |
143 | pr_debug("<--- command = 0x%2.2x\n", command); | 157 | pr_debug("EC_SC(W) = 0x%2.2x\n", command); |
144 | outb(command, ec->command_addr); | 158 | outb(command, ec->command_addr); |
145 | } | 159 | } |
146 | 160 | ||
147 | static inline void acpi_ec_write_data(struct acpi_ec *ec, u8 data) | 161 | static inline void acpi_ec_write_data(struct acpi_ec *ec, u8 data) |
148 | { | 162 | { |
149 | pr_debug("<--- data = 0x%2.2x\n", data); | 163 | pr_debug("EC_DATA(W) = 0x%2.2x\n", data); |
150 | outb(data, ec->data_addr); | 164 | outb(data, ec->data_addr); |
151 | } | 165 | } |
152 | 166 | ||
153 | static int ec_transaction_done(struct acpi_ec *ec) | 167 | static int ec_transaction_completed(struct acpi_ec *ec) |
154 | { | 168 | { |
155 | unsigned long flags; | 169 | unsigned long flags; |
156 | int ret = 0; | 170 | int ret = 0; |
157 | spin_lock_irqsave(&ec->lock, flags); | 171 | spin_lock_irqsave(&ec->lock, flags); |
158 | if (!ec->curr || ec->curr->done) | 172 | if (ec->curr && (ec->curr->flags & ACPI_EC_COMMAND_COMPLETE)) |
159 | ret = 1; | 173 | ret = 1; |
160 | spin_unlock_irqrestore(&ec->lock, flags); | 174 | spin_unlock_irqrestore(&ec->lock, flags); |
161 | return ret; | 175 | return ret; |
162 | } | 176 | } |
163 | 177 | ||
164 | static void start_transaction(struct acpi_ec *ec) | 178 | static bool advance_transaction(struct acpi_ec *ec) |
165 | { | 179 | { |
166 | ec->curr->irq_count = ec->curr->wi = ec->curr->ri = 0; | ||
167 | ec->curr->done = false; | ||
168 | acpi_ec_write_cmd(ec, ec->curr->command); | ||
169 | } | ||
170 | |||
171 | static void advance_transaction(struct acpi_ec *ec, u8 status) | ||
172 | { | ||
173 | unsigned long flags; | ||
174 | struct transaction *t; | 180 | struct transaction *t; |
181 | u8 status; | ||
182 | bool wakeup = false; | ||
175 | 183 | ||
176 | spin_lock_irqsave(&ec->lock, flags); | 184 | pr_debug("===== %s =====\n", in_interrupt() ? "IRQ" : "TASK"); |
185 | status = acpi_ec_read_status(ec); | ||
177 | t = ec->curr; | 186 | t = ec->curr; |
178 | if (!t) | 187 | if (!t) |
179 | goto unlock; | 188 | goto err; |
180 | if (t->wlen > t->wi) { | 189 | if (t->flags & ACPI_EC_COMMAND_POLL) { |
181 | if ((status & ACPI_EC_FLAG_IBF) == 0) | 190 | if (t->wlen > t->wi) { |
182 | acpi_ec_write_data(ec, | 191 | if ((status & ACPI_EC_FLAG_IBF) == 0) |
183 | t->wdata[t->wi++]); | 192 | acpi_ec_write_data(ec, t->wdata[t->wi++]); |
184 | else | 193 | else |
185 | goto err; | 194 | goto err; |
186 | } else if (t->rlen > t->ri) { | 195 | } else if (t->rlen > t->ri) { |
187 | if ((status & ACPI_EC_FLAG_OBF) == 1) { | 196 | if ((status & ACPI_EC_FLAG_OBF) == 1) { |
188 | t->rdata[t->ri++] = acpi_ec_read_data(ec); | 197 | t->rdata[t->ri++] = acpi_ec_read_data(ec); |
189 | if (t->rlen == t->ri) | 198 | if (t->rlen == t->ri) { |
190 | t->done = true; | 199 | t->flags |= ACPI_EC_COMMAND_COMPLETE; |
200 | wakeup = true; | ||
201 | } | ||
202 | } else | ||
203 | goto err; | ||
204 | } else if (t->wlen == t->wi && | ||
205 | (status & ACPI_EC_FLAG_IBF) == 0) { | ||
206 | t->flags |= ACPI_EC_COMMAND_COMPLETE; | ||
207 | wakeup = true; | ||
208 | } | ||
209 | return wakeup; | ||
210 | } else { | ||
211 | if ((status & ACPI_EC_FLAG_IBF) == 0) { | ||
212 | acpi_ec_write_cmd(ec, t->command); | ||
213 | t->flags |= ACPI_EC_COMMAND_POLL; | ||
191 | } else | 214 | } else |
192 | goto err; | 215 | goto err; |
193 | } else if (t->wlen == t->wi && | 216 | return wakeup; |
194 | (status & ACPI_EC_FLAG_IBF) == 0) | 217 | } |
195 | t->done = true; | ||
196 | goto unlock; | ||
197 | err: | 218 | err: |
198 | /* | 219 | /* |
199 | * If SCI bit is set, then don't think it's a false IRQ | 220 | * If SCI bit is set, then don't think it's a false IRQ |
200 | * otherwise will take a not handled IRQ as a false one. | 221 | * otherwise will take a not handled IRQ as a false one. |
201 | */ | 222 | */ |
202 | if (in_interrupt() && !(status & ACPI_EC_FLAG_SCI)) | 223 | if (!(status & ACPI_EC_FLAG_SCI)) { |
203 | ++t->irq_count; | 224 | if (in_interrupt() && t) |
225 | ++t->irq_count; | ||
226 | } | ||
227 | return wakeup; | ||
228 | } | ||
204 | 229 | ||
205 | unlock: | 230 | static void start_transaction(struct acpi_ec *ec) |
206 | spin_unlock_irqrestore(&ec->lock, flags); | 231 | { |
232 | ec->curr->irq_count = ec->curr->wi = ec->curr->ri = 0; | ||
233 | ec->curr->flags = 0; | ||
234 | (void)advance_transaction(ec); | ||
207 | } | 235 | } |
208 | 236 | ||
209 | static int acpi_ec_sync_query(struct acpi_ec *ec, u8 *data); | 237 | static int acpi_ec_sync_query(struct acpi_ec *ec, u8 *data); |
@@ -228,15 +256,17 @@ static int ec_poll(struct acpi_ec *ec) | |||
228 | /* don't sleep with disabled interrupts */ | 256 | /* don't sleep with disabled interrupts */ |
229 | if (EC_FLAGS_MSI || irqs_disabled()) { | 257 | if (EC_FLAGS_MSI || irqs_disabled()) { |
230 | udelay(ACPI_EC_MSI_UDELAY); | 258 | udelay(ACPI_EC_MSI_UDELAY); |
231 | if (ec_transaction_done(ec)) | 259 | if (ec_transaction_completed(ec)) |
232 | return 0; | 260 | return 0; |
233 | } else { | 261 | } else { |
234 | if (wait_event_timeout(ec->wait, | 262 | if (wait_event_timeout(ec->wait, |
235 | ec_transaction_done(ec), | 263 | ec_transaction_completed(ec), |
236 | msecs_to_jiffies(1))) | 264 | msecs_to_jiffies(1))) |
237 | return 0; | 265 | return 0; |
238 | } | 266 | } |
239 | advance_transaction(ec, acpi_ec_read_status(ec)); | 267 | spin_lock_irqsave(&ec->lock, flags); |
268 | (void)advance_transaction(ec); | ||
269 | spin_unlock_irqrestore(&ec->lock, flags); | ||
240 | } while (time_before(jiffies, delay)); | 270 | } while (time_before(jiffies, delay)); |
241 | pr_debug("controller reset, restart transaction\n"); | 271 | pr_debug("controller reset, restart transaction\n"); |
242 | spin_lock_irqsave(&ec->lock, flags); | 272 | spin_lock_irqsave(&ec->lock, flags); |
@@ -268,23 +298,6 @@ static int acpi_ec_transaction_unlocked(struct acpi_ec *ec, | |||
268 | return ret; | 298 | return ret; |
269 | } | 299 | } |
270 | 300 | ||
271 | static int ec_check_ibf0(struct acpi_ec *ec) | ||
272 | { | ||
273 | u8 status = acpi_ec_read_status(ec); | ||
274 | return (status & ACPI_EC_FLAG_IBF) == 0; | ||
275 | } | ||
276 | |||
277 | static int ec_wait_ibf0(struct acpi_ec *ec) | ||
278 | { | ||
279 | unsigned long delay = jiffies + msecs_to_jiffies(ec_delay); | ||
280 | /* interrupt wait manually if GPE mode is not active */ | ||
281 | while (time_before(jiffies, delay)) | ||
282 | if (wait_event_timeout(ec->wait, ec_check_ibf0(ec), | ||
283 | msecs_to_jiffies(1))) | ||
284 | return 0; | ||
285 | return -ETIME; | ||
286 | } | ||
287 | |||
288 | static int acpi_ec_transaction(struct acpi_ec *ec, struct transaction *t) | 301 | static int acpi_ec_transaction(struct acpi_ec *ec, struct transaction *t) |
289 | { | 302 | { |
290 | int status; | 303 | int status; |
@@ -305,12 +318,6 @@ static int acpi_ec_transaction(struct acpi_ec *ec, struct transaction *t) | |||
305 | goto unlock; | 318 | goto unlock; |
306 | } | 319 | } |
307 | } | 320 | } |
308 | if (ec_wait_ibf0(ec)) { | ||
309 | pr_err("input buffer is not empty, " | ||
310 | "aborting transaction\n"); | ||
311 | status = -ETIME; | ||
312 | goto end; | ||
313 | } | ||
314 | pr_debug("transaction start (cmd=0x%02x, addr=0x%02x)\n", | 321 | pr_debug("transaction start (cmd=0x%02x, addr=0x%02x)\n", |
315 | t->command, t->wdata ? t->wdata[0] : 0); | 322 | t->command, t->wdata ? t->wdata[0] : 0); |
316 | /* disable GPE during transaction if storm is detected */ | 323 | /* disable GPE during transaction if storm is detected */ |
@@ -334,7 +341,6 @@ static int acpi_ec_transaction(struct acpi_ec *ec, struct transaction *t) | |||
334 | set_bit(EC_FLAGS_GPE_STORM, &ec->flags); | 341 | set_bit(EC_FLAGS_GPE_STORM, &ec->flags); |
335 | } | 342 | } |
336 | pr_debug("transaction end\n"); | 343 | pr_debug("transaction end\n"); |
337 | end: | ||
338 | if (ec->global_lock) | 344 | if (ec->global_lock) |
339 | acpi_release_global_lock(glk); | 345 | acpi_release_global_lock(glk); |
340 | unlock: | 346 | unlock: |
@@ -634,17 +640,14 @@ static int ec_check_sci(struct acpi_ec *ec, u8 state) | |||
634 | static u32 acpi_ec_gpe_handler(acpi_handle gpe_device, | 640 | static u32 acpi_ec_gpe_handler(acpi_handle gpe_device, |
635 | u32 gpe_number, void *data) | 641 | u32 gpe_number, void *data) |
636 | { | 642 | { |
643 | unsigned long flags; | ||
637 | struct acpi_ec *ec = data; | 644 | struct acpi_ec *ec = data; |
638 | u8 status = acpi_ec_read_status(ec); | ||
639 | 645 | ||
640 | pr_debug("~~~> interrupt, status:0x%02x\n", status); | 646 | spin_lock_irqsave(&ec->lock, flags); |
641 | 647 | if (advance_transaction(ec)) | |
642 | advance_transaction(ec, status); | ||
643 | if (ec_transaction_done(ec) && | ||
644 | (acpi_ec_read_status(ec) & ACPI_EC_FLAG_IBF) == 0) { | ||
645 | wake_up(&ec->wait); | 648 | wake_up(&ec->wait); |
646 | ec_check_sci(ec, acpi_ec_read_status(ec)); | 649 | spin_unlock_irqrestore(&ec->lock, flags); |
647 | } | 650 | ec_check_sci(ec, acpi_ec_read_status(ec)); |
648 | return ACPI_INTERRUPT_HANDLED | ACPI_REENABLE_GPE; | 651 | return ACPI_INTERRUPT_HANDLED | ACPI_REENABLE_GPE; |
649 | } | 652 | } |
650 | 653 | ||
@@ -1066,8 +1069,10 @@ int __init acpi_ec_ecdt_probe(void) | |||
1066 | /* fall through */ | 1069 | /* fall through */ |
1067 | } | 1070 | } |
1068 | 1071 | ||
1069 | if (EC_FLAGS_SKIP_DSDT_SCAN) | 1072 | if (EC_FLAGS_SKIP_DSDT_SCAN) { |
1073 | kfree(saved_ec); | ||
1070 | return -ENODEV; | 1074 | return -ENODEV; |
1075 | } | ||
1071 | 1076 | ||
1072 | /* This workaround is needed only on some broken machines, | 1077 | /* This workaround is needed only on some broken machines, |
1073 | * which require early EC, but fail to provide ECDT */ | 1078 | * which require early EC, but fail to provide ECDT */ |
@@ -1105,6 +1110,7 @@ install: | |||
1105 | } | 1110 | } |
1106 | error: | 1111 | error: |
1107 | kfree(boot_ec); | 1112 | kfree(boot_ec); |
1113 | kfree(saved_ec); | ||
1108 | boot_ec = NULL; | 1114 | boot_ec = NULL; |
1109 | return -ENODEV; | 1115 | return -ENODEV; |
1110 | } | 1116 | } |
diff --git a/drivers/acpi/osl.c b/drivers/acpi/osl.c index 3f2bdc812d23..bad25b070fe0 100644 --- a/drivers/acpi/osl.c +++ b/drivers/acpi/osl.c | |||
@@ -235,7 +235,8 @@ void acpi_os_vprintf(const char *fmt, va_list args) | |||
235 | static unsigned long acpi_rsdp; | 235 | static unsigned long acpi_rsdp; |
236 | static int __init setup_acpi_rsdp(char *arg) | 236 | static int __init setup_acpi_rsdp(char *arg) |
237 | { | 237 | { |
238 | acpi_rsdp = simple_strtoul(arg, NULL, 16); | 238 | if (kstrtoul(arg, 16, &acpi_rsdp)) |
239 | return -EINVAL; | ||
239 | return 0; | 240 | return 0; |
240 | } | 241 | } |
241 | early_param("acpi_rsdp", setup_acpi_rsdp); | 242 | early_param("acpi_rsdp", setup_acpi_rsdp); |
diff --git a/drivers/acpi/resource.c b/drivers/acpi/resource.c index 0bdacc5e26a3..2ba8f02ced36 100644 --- a/drivers/acpi/resource.c +++ b/drivers/acpi/resource.c | |||
@@ -77,7 +77,7 @@ bool acpi_dev_resource_memory(struct acpi_resource *ares, struct resource *res) | |||
77 | switch (ares->type) { | 77 | switch (ares->type) { |
78 | case ACPI_RESOURCE_TYPE_MEMORY24: | 78 | case ACPI_RESOURCE_TYPE_MEMORY24: |
79 | memory24 = &ares->data.memory24; | 79 | memory24 = &ares->data.memory24; |
80 | if (!memory24->address_length) | 80 | if (!memory24->minimum && !memory24->address_length) |
81 | return false; | 81 | return false; |
82 | acpi_dev_get_memresource(res, memory24->minimum, | 82 | acpi_dev_get_memresource(res, memory24->minimum, |
83 | memory24->address_length, | 83 | memory24->address_length, |
@@ -85,7 +85,7 @@ bool acpi_dev_resource_memory(struct acpi_resource *ares, struct resource *res) | |||
85 | break; | 85 | break; |
86 | case ACPI_RESOURCE_TYPE_MEMORY32: | 86 | case ACPI_RESOURCE_TYPE_MEMORY32: |
87 | memory32 = &ares->data.memory32; | 87 | memory32 = &ares->data.memory32; |
88 | if (!memory32->address_length) | 88 | if (!memory32->minimum && !memory32->address_length) |
89 | return false; | 89 | return false; |
90 | acpi_dev_get_memresource(res, memory32->minimum, | 90 | acpi_dev_get_memresource(res, memory32->minimum, |
91 | memory32->address_length, | 91 | memory32->address_length, |
@@ -93,7 +93,7 @@ bool acpi_dev_resource_memory(struct acpi_resource *ares, struct resource *res) | |||
93 | break; | 93 | break; |
94 | case ACPI_RESOURCE_TYPE_FIXED_MEMORY32: | 94 | case ACPI_RESOURCE_TYPE_FIXED_MEMORY32: |
95 | fixed_memory32 = &ares->data.fixed_memory32; | 95 | fixed_memory32 = &ares->data.fixed_memory32; |
96 | if (!fixed_memory32->address_length) | 96 | if (!fixed_memory32->address && !fixed_memory32->address_length) |
97 | return false; | 97 | return false; |
98 | acpi_dev_get_memresource(res, fixed_memory32->address, | 98 | acpi_dev_get_memresource(res, fixed_memory32->address, |
99 | fixed_memory32->address_length, | 99 | fixed_memory32->address_length, |
@@ -150,7 +150,7 @@ bool acpi_dev_resource_io(struct acpi_resource *ares, struct resource *res) | |||
150 | switch (ares->type) { | 150 | switch (ares->type) { |
151 | case ACPI_RESOURCE_TYPE_IO: | 151 | case ACPI_RESOURCE_TYPE_IO: |
152 | io = &ares->data.io; | 152 | io = &ares->data.io; |
153 | if (!io->address_length) | 153 | if (!io->minimum && !io->address_length) |
154 | return false; | 154 | return false; |
155 | acpi_dev_get_ioresource(res, io->minimum, | 155 | acpi_dev_get_ioresource(res, io->minimum, |
156 | io->address_length, | 156 | io->address_length, |
@@ -158,7 +158,7 @@ bool acpi_dev_resource_io(struct acpi_resource *ares, struct resource *res) | |||
158 | break; | 158 | break; |
159 | case ACPI_RESOURCE_TYPE_FIXED_IO: | 159 | case ACPI_RESOURCE_TYPE_FIXED_IO: |
160 | fixed_io = &ares->data.fixed_io; | 160 | fixed_io = &ares->data.fixed_io; |
161 | if (!fixed_io->address_length) | 161 | if (!fixed_io->address && !fixed_io->address_length) |
162 | return false; | 162 | return false; |
163 | acpi_dev_get_ioresource(res, fixed_io->address, | 163 | acpi_dev_get_ioresource(res, fixed_io->address, |
164 | fixed_io->address_length, | 164 | fixed_io->address_length, |
diff --git a/drivers/acpi/tables.c b/drivers/acpi/tables.c index 05550ba44d32..6d5a6cda0734 100644 --- a/drivers/acpi/tables.c +++ b/drivers/acpi/tables.c | |||
@@ -360,7 +360,8 @@ static int __init acpi_parse_apic_instance(char *str) | |||
360 | if (!str) | 360 | if (!str) |
361 | return -EINVAL; | 361 | return -EINVAL; |
362 | 362 | ||
363 | acpi_apic_instance = simple_strtoul(str, NULL, 0); | 363 | if (kstrtoint(str, 0, &acpi_apic_instance)) |
364 | return -EINVAL; | ||
364 | 365 | ||
365 | pr_notice("Shall use APIC/MADT table %d\n", acpi_apic_instance); | 366 | pr_notice("Shall use APIC/MADT table %d\n", acpi_apic_instance); |
366 | 367 | ||
diff --git a/drivers/acpi/video.c b/drivers/acpi/video.c index fb9ffe9adc64..071c1dfb93f3 100644 --- a/drivers/acpi/video.c +++ b/drivers/acpi/video.c | |||
@@ -241,13 +241,14 @@ static bool acpi_video_use_native_backlight(void) | |||
241 | return use_native_backlight_dmi; | 241 | return use_native_backlight_dmi; |
242 | } | 242 | } |
243 | 243 | ||
244 | static bool acpi_video_verify_backlight_support(void) | 244 | bool acpi_video_verify_backlight_support(void) |
245 | { | 245 | { |
246 | if (acpi_osi_is_win8() && acpi_video_use_native_backlight() && | 246 | if (acpi_osi_is_win8() && acpi_video_use_native_backlight() && |
247 | backlight_device_registered(BACKLIGHT_RAW)) | 247 | backlight_device_registered(BACKLIGHT_RAW)) |
248 | return false; | 248 | return false; |
249 | return acpi_video_backlight_support(); | 249 | return acpi_video_backlight_support(); |
250 | } | 250 | } |
251 | EXPORT_SYMBOL_GPL(acpi_video_verify_backlight_support); | ||
251 | 252 | ||
252 | /* backlight device sysfs support */ | 253 | /* backlight device sysfs support */ |
253 | static int acpi_video_get_brightness(struct backlight_device *bd) | 254 | static int acpi_video_get_brightness(struct backlight_device *bd) |
@@ -563,6 +564,14 @@ static struct dmi_system_id video_dmi_table[] __initdata = { | |||
563 | }, | 564 | }, |
564 | }, | 565 | }, |
565 | { | 566 | { |
567 | .callback = video_set_use_native_backlight, | ||
568 | .ident = "Acer TravelMate B113", | ||
569 | .matches = { | ||
570 | DMI_MATCH(DMI_SYS_VENDOR, "Acer"), | ||
571 | DMI_MATCH(DMI_PRODUCT_NAME, "TravelMate B113"), | ||
572 | }, | ||
573 | }, | ||
574 | { | ||
566 | .callback = video_set_use_native_backlight, | 575 | .callback = video_set_use_native_backlight, |
567 | .ident = "HP ProBook 4340s", | 576 | .ident = "HP ProBook 4340s", |
568 | .matches = { | 577 | .matches = { |
diff --git a/drivers/acpi/video_detect.c b/drivers/acpi/video_detect.c index 33e3db548a29..c42feb2bacd0 100644 --- a/drivers/acpi/video_detect.c +++ b/drivers/acpi/video_detect.c | |||
@@ -166,6 +166,14 @@ static struct dmi_system_id video_detect_dmi_table[] = { | |||
166 | DMI_MATCH(DMI_PRODUCT_NAME, "UL30A"), | 166 | DMI_MATCH(DMI_PRODUCT_NAME, "UL30A"), |
167 | }, | 167 | }, |
168 | }, | 168 | }, |
169 | { | ||
170 | .callback = video_detect_force_vendor, | ||
171 | .ident = "Dell Inspiron 5737", | ||
172 | .matches = { | ||
173 | DMI_MATCH(DMI_SYS_VENDOR, "Dell Inc."), | ||
174 | DMI_MATCH(DMI_PRODUCT_NAME, "Inspiron 5737"), | ||
175 | }, | ||
176 | }, | ||
169 | { }, | 177 | { }, |
170 | }; | 178 | }; |
171 | 179 | ||
diff --git a/drivers/ata/ahci.h b/drivers/ata/ahci.h index 05882e4445a6..5513296e5e2e 100644 --- a/drivers/ata/ahci.h +++ b/drivers/ata/ahci.h | |||
@@ -371,7 +371,9 @@ int ahci_do_softreset(struct ata_link *link, unsigned int *class, | |||
371 | int pmp, unsigned long deadline, | 371 | int pmp, unsigned long deadline, |
372 | int (*check_ready)(struct ata_link *link)); | 372 | int (*check_ready)(struct ata_link *link)); |
373 | 373 | ||
374 | unsigned int ahci_qc_issue(struct ata_queued_cmd *qc); | ||
374 | int ahci_stop_engine(struct ata_port *ap); | 375 | int ahci_stop_engine(struct ata_port *ap); |
376 | void ahci_start_fis_rx(struct ata_port *ap); | ||
375 | void ahci_start_engine(struct ata_port *ap); | 377 | void ahci_start_engine(struct ata_port *ap); |
376 | int ahci_check_ready(struct ata_link *link); | 378 | int ahci_check_ready(struct ata_link *link); |
377 | int ahci_kick_engine(struct ata_port *ap); | 379 | int ahci_kick_engine(struct ata_port *ap); |
diff --git a/drivers/ata/ahci_imx.c b/drivers/ata/ahci_imx.c index 3a901520c62b..cac4360f272a 100644 --- a/drivers/ata/ahci_imx.c +++ b/drivers/ata/ahci_imx.c | |||
@@ -58,6 +58,8 @@ enum ahci_imx_type { | |||
58 | struct imx_ahci_priv { | 58 | struct imx_ahci_priv { |
59 | struct platform_device *ahci_pdev; | 59 | struct platform_device *ahci_pdev; |
60 | enum ahci_imx_type type; | 60 | enum ahci_imx_type type; |
61 | struct clk *sata_clk; | ||
62 | struct clk *sata_ref_clk; | ||
61 | struct clk *ahb_clk; | 63 | struct clk *ahb_clk; |
62 | struct regmap *gpr; | 64 | struct regmap *gpr; |
63 | bool no_device; | 65 | bool no_device; |
@@ -224,7 +226,7 @@ static int imx_sata_enable(struct ahci_host_priv *hpriv) | |||
224 | return ret; | 226 | return ret; |
225 | } | 227 | } |
226 | 228 | ||
227 | ret = ahci_platform_enable_clks(hpriv); | 229 | ret = clk_prepare_enable(imxpriv->sata_ref_clk); |
228 | if (ret < 0) | 230 | if (ret < 0) |
229 | goto disable_regulator; | 231 | goto disable_regulator; |
230 | 232 | ||
@@ -291,7 +293,7 @@ static void imx_sata_disable(struct ahci_host_priv *hpriv) | |||
291 | !IMX6Q_GPR13_SATA_MPLL_CLK_EN); | 293 | !IMX6Q_GPR13_SATA_MPLL_CLK_EN); |
292 | } | 294 | } |
293 | 295 | ||
294 | ahci_platform_disable_clks(hpriv); | 296 | clk_disable_unprepare(imxpriv->sata_ref_clk); |
295 | 297 | ||
296 | if (hpriv->target_pwr) | 298 | if (hpriv->target_pwr) |
297 | regulator_disable(hpriv->target_pwr); | 299 | regulator_disable(hpriv->target_pwr); |
@@ -324,6 +326,9 @@ static void ahci_imx_error_handler(struct ata_port *ap) | |||
324 | writel(reg_val | IMX_P0PHYCR_TEST_PDDQ, mmio + IMX_P0PHYCR); | 326 | writel(reg_val | IMX_P0PHYCR_TEST_PDDQ, mmio + IMX_P0PHYCR); |
325 | imx_sata_disable(hpriv); | 327 | imx_sata_disable(hpriv); |
326 | imxpriv->no_device = true; | 328 | imxpriv->no_device = true; |
329 | |||
330 | dev_info(ap->dev, "no device found, disabling link.\n"); | ||
331 | dev_info(ap->dev, "pass " MODULE_PARAM_PREFIX ".hotplug=1 to enable hotplug\n"); | ||
327 | } | 332 | } |
328 | 333 | ||
329 | static int ahci_imx_softreset(struct ata_link *link, unsigned int *class, | 334 | static int ahci_imx_softreset(struct ata_link *link, unsigned int *class, |
@@ -385,6 +390,19 @@ static int imx_ahci_probe(struct platform_device *pdev) | |||
385 | imxpriv->no_device = false; | 390 | imxpriv->no_device = false; |
386 | imxpriv->first_time = true; | 391 | imxpriv->first_time = true; |
387 | imxpriv->type = (enum ahci_imx_type)of_id->data; | 392 | imxpriv->type = (enum ahci_imx_type)of_id->data; |
393 | |||
394 | imxpriv->sata_clk = devm_clk_get(dev, "sata"); | ||
395 | if (IS_ERR(imxpriv->sata_clk)) { | ||
396 | dev_err(dev, "can't get sata clock.\n"); | ||
397 | return PTR_ERR(imxpriv->sata_clk); | ||
398 | } | ||
399 | |||
400 | imxpriv->sata_ref_clk = devm_clk_get(dev, "sata_ref"); | ||
401 | if (IS_ERR(imxpriv->sata_ref_clk)) { | ||
402 | dev_err(dev, "can't get sata_ref clock.\n"); | ||
403 | return PTR_ERR(imxpriv->sata_ref_clk); | ||
404 | } | ||
405 | |||
388 | imxpriv->ahb_clk = devm_clk_get(dev, "ahb"); | 406 | imxpriv->ahb_clk = devm_clk_get(dev, "ahb"); |
389 | if (IS_ERR(imxpriv->ahb_clk)) { | 407 | if (IS_ERR(imxpriv->ahb_clk)) { |
390 | dev_err(dev, "can't get ahb clock.\n"); | 408 | dev_err(dev, "can't get ahb clock.\n"); |
@@ -407,10 +425,14 @@ static int imx_ahci_probe(struct platform_device *pdev) | |||
407 | 425 | ||
408 | hpriv->plat_data = imxpriv; | 426 | hpriv->plat_data = imxpriv; |
409 | 427 | ||
410 | ret = imx_sata_enable(hpriv); | 428 | ret = clk_prepare_enable(imxpriv->sata_clk); |
411 | if (ret) | 429 | if (ret) |
412 | return ret; | 430 | return ret; |
413 | 431 | ||
432 | ret = imx_sata_enable(hpriv); | ||
433 | if (ret) | ||
434 | goto disable_clk; | ||
435 | |||
414 | /* | 436 | /* |
415 | * Configure the HWINIT bits of the HOST_CAP and HOST_PORTS_IMPL, | 437 | * Configure the HWINIT bits of the HOST_CAP and HOST_PORTS_IMPL, |
416 | * and IP vendor specific register IMX_TIMER1MS. | 438 | * and IP vendor specific register IMX_TIMER1MS. |
@@ -435,16 +457,24 @@ static int imx_ahci_probe(struct platform_device *pdev) | |||
435 | ret = ahci_platform_init_host(pdev, hpriv, &ahci_imx_port_info, | 457 | ret = ahci_platform_init_host(pdev, hpriv, &ahci_imx_port_info, |
436 | 0, 0, 0); | 458 | 0, 0, 0); |
437 | if (ret) | 459 | if (ret) |
438 | imx_sata_disable(hpriv); | 460 | goto disable_sata; |
439 | 461 | ||
462 | return 0; | ||
463 | |||
464 | disable_sata: | ||
465 | imx_sata_disable(hpriv); | ||
466 | disable_clk: | ||
467 | clk_disable_unprepare(imxpriv->sata_clk); | ||
440 | return ret; | 468 | return ret; |
441 | } | 469 | } |
442 | 470 | ||
443 | static void ahci_imx_host_stop(struct ata_host *host) | 471 | static void ahci_imx_host_stop(struct ata_host *host) |
444 | { | 472 | { |
445 | struct ahci_host_priv *hpriv = host->private_data; | 473 | struct ahci_host_priv *hpriv = host->private_data; |
474 | struct imx_ahci_priv *imxpriv = hpriv->plat_data; | ||
446 | 475 | ||
447 | imx_sata_disable(hpriv); | 476 | imx_sata_disable(hpriv); |
477 | clk_disable_unprepare(imxpriv->sata_clk); | ||
448 | } | 478 | } |
449 | 479 | ||
450 | #ifdef CONFIG_PM_SLEEP | 480 | #ifdef CONFIG_PM_SLEEP |
diff --git a/drivers/ata/ahci_platform.c b/drivers/ata/ahci_platform.c index ebe505c17763..b10d81ddb528 100644 --- a/drivers/ata/ahci_platform.c +++ b/drivers/ata/ahci_platform.c | |||
@@ -58,7 +58,7 @@ static int ahci_probe(struct platform_device *pdev) | |||
58 | } | 58 | } |
59 | 59 | ||
60 | if (of_device_is_compatible(dev->of_node, "hisilicon,hisi-ahci")) | 60 | if (of_device_is_compatible(dev->of_node, "hisilicon,hisi-ahci")) |
61 | hflags |= AHCI_HFLAG_NO_FBS; | 61 | hflags |= AHCI_HFLAG_NO_FBS | AHCI_HFLAG_NO_NCQ; |
62 | 62 | ||
63 | rc = ahci_platform_init_host(pdev, hpriv, &ahci_port_info, | 63 | rc = ahci_platform_init_host(pdev, hpriv, &ahci_port_info, |
64 | hflags, 0, 0); | 64 | hflags, 0, 0); |
diff --git a/drivers/ata/ahci_xgene.c b/drivers/ata/ahci_xgene.c index 042a9bb45c86..ee3a3659bd9e 100644 --- a/drivers/ata/ahci_xgene.c +++ b/drivers/ata/ahci_xgene.c | |||
@@ -78,6 +78,7 @@ | |||
78 | struct xgene_ahci_context { | 78 | struct xgene_ahci_context { |
79 | struct ahci_host_priv *hpriv; | 79 | struct ahci_host_priv *hpriv; |
80 | struct device *dev; | 80 | struct device *dev; |
81 | u8 last_cmd[MAX_AHCI_CHN_PERCTR]; /* tracking the last command issued*/ | ||
81 | void __iomem *csr_core; /* Core CSR address of IP */ | 82 | void __iomem *csr_core; /* Core CSR address of IP */ |
82 | void __iomem *csr_diag; /* Diag CSR address of IP */ | 83 | void __iomem *csr_diag; /* Diag CSR address of IP */ |
83 | void __iomem *csr_axi; /* AXI CSR address of IP */ | 84 | void __iomem *csr_axi; /* AXI CSR address of IP */ |
@@ -98,20 +99,62 @@ static int xgene_ahci_init_memram(struct xgene_ahci_context *ctx) | |||
98 | } | 99 | } |
99 | 100 | ||
100 | /** | 101 | /** |
102 | * xgene_ahci_restart_engine - Restart the dma engine. | ||
103 | * @ap : ATA port of interest | ||
104 | * | ||
105 | * Restarts the dma engine inside the controller. | ||
106 | */ | ||
107 | static int xgene_ahci_restart_engine(struct ata_port *ap) | ||
108 | { | ||
109 | struct ahci_host_priv *hpriv = ap->host->private_data; | ||
110 | |||
111 | ahci_stop_engine(ap); | ||
112 | ahci_start_fis_rx(ap); | ||
113 | hpriv->start_engine(ap); | ||
114 | |||
115 | return 0; | ||
116 | } | ||
117 | |||
118 | /** | ||
119 | * xgene_ahci_qc_issue - Issue commands to the device | ||
120 | * @qc: Command to issue | ||
121 | * | ||
122 | * Due to Hardware errata for IDENTIFY DEVICE command, the controller cannot | ||
123 | * clear the BSY bit after receiving the PIO setup FIS. This results in the dma | ||
124 | * state machine goes into the CMFatalErrorUpdate state and locks up. By | ||
125 | * restarting the dma engine, it removes the controller out of lock up state. | ||
126 | */ | ||
127 | static unsigned int xgene_ahci_qc_issue(struct ata_queued_cmd *qc) | ||
128 | { | ||
129 | struct ata_port *ap = qc->ap; | ||
130 | struct ahci_host_priv *hpriv = ap->host->private_data; | ||
131 | struct xgene_ahci_context *ctx = hpriv->plat_data; | ||
132 | int rc = 0; | ||
133 | |||
134 | if (unlikely(ctx->last_cmd[ap->port_no] == ATA_CMD_ID_ATA)) | ||
135 | xgene_ahci_restart_engine(ap); | ||
136 | |||
137 | rc = ahci_qc_issue(qc); | ||
138 | |||
139 | /* Save the last command issued */ | ||
140 | ctx->last_cmd[ap->port_no] = qc->tf.command; | ||
141 | |||
142 | return rc; | ||
143 | } | ||
144 | |||
145 | /** | ||
101 | * xgene_ahci_read_id - Read ID data from the specified device | 146 | * xgene_ahci_read_id - Read ID data from the specified device |
102 | * @dev: device | 147 | * @dev: device |
103 | * @tf: proposed taskfile | 148 | * @tf: proposed taskfile |
104 | * @id: data buffer | 149 | * @id: data buffer |
105 | * | 150 | * |
106 | * This custom read ID function is required due to the fact that the HW | 151 | * This custom read ID function is required due to the fact that the HW |
107 | * does not support DEVSLP and the controller state machine may get stuck | 152 | * does not support DEVSLP. |
108 | * after processing the ID query command. | ||
109 | */ | 153 | */ |
110 | static unsigned int xgene_ahci_read_id(struct ata_device *dev, | 154 | static unsigned int xgene_ahci_read_id(struct ata_device *dev, |
111 | struct ata_taskfile *tf, u16 *id) | 155 | struct ata_taskfile *tf, u16 *id) |
112 | { | 156 | { |
113 | u32 err_mask; | 157 | u32 err_mask; |
114 | void __iomem *port_mmio = ahci_port_base(dev->link->ap); | ||
115 | 158 | ||
116 | err_mask = ata_do_dev_read_id(dev, tf, id); | 159 | err_mask = ata_do_dev_read_id(dev, tf, id); |
117 | if (err_mask) | 160 | if (err_mask) |
@@ -133,16 +176,6 @@ static unsigned int xgene_ahci_read_id(struct ata_device *dev, | |||
133 | */ | 176 | */ |
134 | id[ATA_ID_FEATURE_SUPP] &= ~(1 << 8); | 177 | id[ATA_ID_FEATURE_SUPP] &= ~(1 << 8); |
135 | 178 | ||
136 | /* | ||
137 | * Due to HW errata, restart the port if no other command active. | ||
138 | * Otherwise the controller may get stuck. | ||
139 | */ | ||
140 | if (!readl(port_mmio + PORT_CMD_ISSUE)) { | ||
141 | writel(PORT_CMD_FIS_RX, port_mmio + PORT_CMD); | ||
142 | readl(port_mmio + PORT_CMD); /* Force a barrier */ | ||
143 | writel(PORT_CMD_FIS_RX | PORT_CMD_START, port_mmio + PORT_CMD); | ||
144 | readl(port_mmio + PORT_CMD); /* Force a barrier */ | ||
145 | } | ||
146 | return 0; | 179 | return 0; |
147 | } | 180 | } |
148 | 181 | ||
@@ -300,6 +333,7 @@ static struct ata_port_operations xgene_ahci_ops = { | |||
300 | .host_stop = xgene_ahci_host_stop, | 333 | .host_stop = xgene_ahci_host_stop, |
301 | .hardreset = xgene_ahci_hardreset, | 334 | .hardreset = xgene_ahci_hardreset, |
302 | .read_id = xgene_ahci_read_id, | 335 | .read_id = xgene_ahci_read_id, |
336 | .qc_issue = xgene_ahci_qc_issue, | ||
303 | }; | 337 | }; |
304 | 338 | ||
305 | static const struct ata_port_info xgene_ahci_port_info = { | 339 | static const struct ata_port_info xgene_ahci_port_info = { |
diff --git a/drivers/ata/libahci.c b/drivers/ata/libahci.c index 40ea583d3610..d72ce0470309 100644 --- a/drivers/ata/libahci.c +++ b/drivers/ata/libahci.c | |||
@@ -68,7 +68,6 @@ static ssize_t ahci_transmit_led_message(struct ata_port *ap, u32 state, | |||
68 | 68 | ||
69 | static int ahci_scr_read(struct ata_link *link, unsigned int sc_reg, u32 *val); | 69 | static int ahci_scr_read(struct ata_link *link, unsigned int sc_reg, u32 *val); |
70 | static int ahci_scr_write(struct ata_link *link, unsigned int sc_reg, u32 val); | 70 | static int ahci_scr_write(struct ata_link *link, unsigned int sc_reg, u32 val); |
71 | static unsigned int ahci_qc_issue(struct ata_queued_cmd *qc); | ||
72 | static bool ahci_qc_fill_rtf(struct ata_queued_cmd *qc); | 71 | static bool ahci_qc_fill_rtf(struct ata_queued_cmd *qc); |
73 | static int ahci_port_start(struct ata_port *ap); | 72 | static int ahci_port_start(struct ata_port *ap); |
74 | static void ahci_port_stop(struct ata_port *ap); | 73 | static void ahci_port_stop(struct ata_port *ap); |
@@ -620,7 +619,7 @@ int ahci_stop_engine(struct ata_port *ap) | |||
620 | } | 619 | } |
621 | EXPORT_SYMBOL_GPL(ahci_stop_engine); | 620 | EXPORT_SYMBOL_GPL(ahci_stop_engine); |
622 | 621 | ||
623 | static void ahci_start_fis_rx(struct ata_port *ap) | 622 | void ahci_start_fis_rx(struct ata_port *ap) |
624 | { | 623 | { |
625 | void __iomem *port_mmio = ahci_port_base(ap); | 624 | void __iomem *port_mmio = ahci_port_base(ap); |
626 | struct ahci_host_priv *hpriv = ap->host->private_data; | 625 | struct ahci_host_priv *hpriv = ap->host->private_data; |
@@ -646,6 +645,7 @@ static void ahci_start_fis_rx(struct ata_port *ap) | |||
646 | /* flush */ | 645 | /* flush */ |
647 | readl(port_mmio + PORT_CMD); | 646 | readl(port_mmio + PORT_CMD); |
648 | } | 647 | } |
648 | EXPORT_SYMBOL_GPL(ahci_start_fis_rx); | ||
649 | 649 | ||
650 | static int ahci_stop_fis_rx(struct ata_port *ap) | 650 | static int ahci_stop_fis_rx(struct ata_port *ap) |
651 | { | 651 | { |
@@ -1945,7 +1945,7 @@ irqreturn_t ahci_interrupt(int irq, void *dev_instance) | |||
1945 | } | 1945 | } |
1946 | EXPORT_SYMBOL_GPL(ahci_interrupt); | 1946 | EXPORT_SYMBOL_GPL(ahci_interrupt); |
1947 | 1947 | ||
1948 | static unsigned int ahci_qc_issue(struct ata_queued_cmd *qc) | 1948 | unsigned int ahci_qc_issue(struct ata_queued_cmd *qc) |
1949 | { | 1949 | { |
1950 | struct ata_port *ap = qc->ap; | 1950 | struct ata_port *ap = qc->ap; |
1951 | void __iomem *port_mmio = ahci_port_base(ap); | 1951 | void __iomem *port_mmio = ahci_port_base(ap); |
@@ -1974,6 +1974,7 @@ static unsigned int ahci_qc_issue(struct ata_queued_cmd *qc) | |||
1974 | 1974 | ||
1975 | return 0; | 1975 | return 0; |
1976 | } | 1976 | } |
1977 | EXPORT_SYMBOL_GPL(ahci_qc_issue); | ||
1977 | 1978 | ||
1978 | static bool ahci_qc_fill_rtf(struct ata_queued_cmd *qc) | 1979 | static bool ahci_qc_fill_rtf(struct ata_queued_cmd *qc) |
1979 | { | 1980 | { |
diff --git a/drivers/ata/libahci_platform.c b/drivers/ata/libahci_platform.c index 3a5b4ed25a4f..b0077589f065 100644 --- a/drivers/ata/libahci_platform.c +++ b/drivers/ata/libahci_platform.c | |||
@@ -250,8 +250,13 @@ struct ahci_host_priv *ahci_platform_get_resources(struct platform_device *pdev) | |||
250 | if (IS_ERR(hpriv->phy)) { | 250 | if (IS_ERR(hpriv->phy)) { |
251 | rc = PTR_ERR(hpriv->phy); | 251 | rc = PTR_ERR(hpriv->phy); |
252 | switch (rc) { | 252 | switch (rc) { |
253 | case -ENODEV: | ||
254 | case -ENOSYS: | 253 | case -ENOSYS: |
254 | /* No PHY support. Check if PHY is required. */ | ||
255 | if (of_find_property(dev->of_node, "phys", NULL)) { | ||
256 | dev_err(dev, "couldn't get sata-phy: ENOSYS\n"); | ||
257 | goto err_out; | ||
258 | } | ||
259 | case -ENODEV: | ||
255 | /* continue normally */ | 260 | /* continue normally */ |
256 | hpriv->phy = NULL; | 261 | hpriv->phy = NULL; |
257 | break; | 262 | break; |
diff --git a/drivers/base/dma-contiguous.c b/drivers/base/dma-contiguous.c index 83969f8c5727..6467c919c509 100644 --- a/drivers/base/dma-contiguous.c +++ b/drivers/base/dma-contiguous.c | |||
@@ -176,14 +176,24 @@ static int __init cma_activate_area(struct cma *cma) | |||
176 | base_pfn = pfn; | 176 | base_pfn = pfn; |
177 | for (j = pageblock_nr_pages; j; --j, pfn++) { | 177 | for (j = pageblock_nr_pages; j; --j, pfn++) { |
178 | WARN_ON_ONCE(!pfn_valid(pfn)); | 178 | WARN_ON_ONCE(!pfn_valid(pfn)); |
179 | /* | ||
180 | * alloc_contig_range requires the pfn range | ||
181 | * specified to be in the same zone. Make this | ||
182 | * simple by forcing the entire CMA resv range | ||
183 | * to be in the same zone. | ||
184 | */ | ||
179 | if (page_zone(pfn_to_page(pfn)) != zone) | 185 | if (page_zone(pfn_to_page(pfn)) != zone) |
180 | return -EINVAL; | 186 | goto err; |
181 | } | 187 | } |
182 | init_cma_reserved_pageblock(pfn_to_page(base_pfn)); | 188 | init_cma_reserved_pageblock(pfn_to_page(base_pfn)); |
183 | } while (--i); | 189 | } while (--i); |
184 | 190 | ||
185 | mutex_init(&cma->lock); | 191 | mutex_init(&cma->lock); |
186 | return 0; | 192 | return 0; |
193 | |||
194 | err: | ||
195 | kfree(cma->bitmap); | ||
196 | return -EINVAL; | ||
187 | } | 197 | } |
188 | 198 | ||
189 | static struct cma cma_areas[MAX_CMA_AREAS]; | 199 | static struct cma cma_areas[MAX_CMA_AREAS]; |
diff --git a/drivers/block/drbd/drbd_receiver.c b/drivers/block/drbd/drbd_receiver.c index b6c8aaf4931b..5b17ec88ea05 100644 --- a/drivers/block/drbd/drbd_receiver.c +++ b/drivers/block/drbd/drbd_receiver.c | |||
@@ -1337,8 +1337,11 @@ int drbd_submit_peer_request(struct drbd_device *device, | |||
1337 | return 0; | 1337 | return 0; |
1338 | } | 1338 | } |
1339 | 1339 | ||
1340 | /* Discards don't have any payload. | ||
1341 | * But the scsi layer still expects a bio_vec it can use internally, | ||
1342 | * see sd_setup_discard_cmnd() and blk_add_request_payload(). */ | ||
1340 | if (peer_req->flags & EE_IS_TRIM) | 1343 | if (peer_req->flags & EE_IS_TRIM) |
1341 | nr_pages = 0; /* discards don't have any payload. */ | 1344 | nr_pages = 1; |
1342 | 1345 | ||
1343 | /* In most cases, we will only need one bio. But in case the lower | 1346 | /* In most cases, we will only need one bio. But in case the lower |
1344 | * level restrictions happen to be different at this offset on this | 1347 | * level restrictions happen to be different at this offset on this |
diff --git a/drivers/block/floppy.c b/drivers/block/floppy.c index 677db049f55a..56d46ffb08e1 100644 --- a/drivers/block/floppy.c +++ b/drivers/block/floppy.c | |||
@@ -3777,7 +3777,7 @@ static void floppy_rb0_cb(struct bio *bio, int err) | |||
3777 | int drive = cbdata->drive; | 3777 | int drive = cbdata->drive; |
3778 | 3778 | ||
3779 | if (err) { | 3779 | if (err) { |
3780 | pr_info("floppy: error %d while reading block 0", err); | 3780 | pr_info("floppy: error %d while reading block 0\n", err); |
3781 | set_bit(FD_OPEN_SHOULD_FAIL_BIT, &UDRS->flags); | 3781 | set_bit(FD_OPEN_SHOULD_FAIL_BIT, &UDRS->flags); |
3782 | } | 3782 | } |
3783 | complete(&cbdata->complete); | 3783 | complete(&cbdata->complete); |
diff --git a/drivers/block/null_blk.c b/drivers/block/null_blk.c index 77087a29b127..a3b042c4d448 100644 --- a/drivers/block/null_blk.c +++ b/drivers/block/null_blk.c | |||
@@ -79,7 +79,7 @@ MODULE_PARM_DESC(home_node, "Home node for the device"); | |||
79 | 79 | ||
80 | static int queue_mode = NULL_Q_MQ; | 80 | static int queue_mode = NULL_Q_MQ; |
81 | module_param(queue_mode, int, S_IRUGO); | 81 | module_param(queue_mode, int, S_IRUGO); |
82 | MODULE_PARM_DESC(use_mq, "Use blk-mq interface (0=bio,1=rq,2=multiqueue)"); | 82 | MODULE_PARM_DESC(queue_mode, "Block interface to use (0=bio,1=rq,2=multiqueue)"); |
83 | 83 | ||
84 | static int gb = 250; | 84 | static int gb = 250; |
85 | module_param(gb, int, S_IRUGO); | 85 | module_param(gb, int, S_IRUGO); |
@@ -227,7 +227,10 @@ static void null_cmd_end_timer(struct nullb_cmd *cmd) | |||
227 | 227 | ||
228 | static void null_softirq_done_fn(struct request *rq) | 228 | static void null_softirq_done_fn(struct request *rq) |
229 | { | 229 | { |
230 | end_cmd(blk_mq_rq_to_pdu(rq)); | 230 | if (queue_mode == NULL_Q_MQ) |
231 | end_cmd(blk_mq_rq_to_pdu(rq)); | ||
232 | else | ||
233 | end_cmd(rq->special); | ||
231 | } | 234 | } |
232 | 235 | ||
233 | static inline void null_handle_cmd(struct nullb_cmd *cmd) | 236 | static inline void null_handle_cmd(struct nullb_cmd *cmd) |
diff --git a/drivers/block/rbd.c b/drivers/block/rbd.c index bbeb404b3a07..b2c98c1bc037 100644 --- a/drivers/block/rbd.c +++ b/drivers/block/rbd.c | |||
@@ -1431,6 +1431,14 @@ static bool obj_request_exists_test(struct rbd_obj_request *obj_request) | |||
1431 | return test_bit(OBJ_REQ_EXISTS, &obj_request->flags) != 0; | 1431 | return test_bit(OBJ_REQ_EXISTS, &obj_request->flags) != 0; |
1432 | } | 1432 | } |
1433 | 1433 | ||
1434 | static bool obj_request_overlaps_parent(struct rbd_obj_request *obj_request) | ||
1435 | { | ||
1436 | struct rbd_device *rbd_dev = obj_request->img_request->rbd_dev; | ||
1437 | |||
1438 | return obj_request->img_offset < | ||
1439 | round_up(rbd_dev->parent_overlap, rbd_obj_bytes(&rbd_dev->header)); | ||
1440 | } | ||
1441 | |||
1434 | static void rbd_obj_request_get(struct rbd_obj_request *obj_request) | 1442 | static void rbd_obj_request_get(struct rbd_obj_request *obj_request) |
1435 | { | 1443 | { |
1436 | dout("%s: obj %p (was %d)\n", __func__, obj_request, | 1444 | dout("%s: obj %p (was %d)\n", __func__, obj_request, |
@@ -2748,7 +2756,7 @@ static int rbd_img_obj_request_submit(struct rbd_obj_request *obj_request) | |||
2748 | */ | 2756 | */ |
2749 | if (!img_request_write_test(img_request) || | 2757 | if (!img_request_write_test(img_request) || |
2750 | !img_request_layered_test(img_request) || | 2758 | !img_request_layered_test(img_request) || |
2751 | rbd_dev->parent_overlap <= obj_request->img_offset || | 2759 | !obj_request_overlaps_parent(obj_request) || |
2752 | ((known = obj_request_known_test(obj_request)) && | 2760 | ((known = obj_request_known_test(obj_request)) && |
2753 | obj_request_exists_test(obj_request))) { | 2761 | obj_request_exists_test(obj_request))) { |
2754 | 2762 | ||
diff --git a/drivers/block/zram/zram_drv.c b/drivers/block/zram/zram_drv.c index 48eccb350180..089e72cd37be 100644 --- a/drivers/block/zram/zram_drv.c +++ b/drivers/block/zram/zram_drv.c | |||
@@ -622,8 +622,10 @@ static void zram_reset_device(struct zram *zram, bool reset_capacity) | |||
622 | memset(&zram->stats, 0, sizeof(zram->stats)); | 622 | memset(&zram->stats, 0, sizeof(zram->stats)); |
623 | 623 | ||
624 | zram->disksize = 0; | 624 | zram->disksize = 0; |
625 | if (reset_capacity) | 625 | if (reset_capacity) { |
626 | set_capacity(zram->disk, 0); | 626 | set_capacity(zram->disk, 0); |
627 | revalidate_disk(zram->disk); | ||
628 | } | ||
627 | up_write(&zram->init_lock); | 629 | up_write(&zram->init_lock); |
628 | } | 630 | } |
629 | 631 | ||
@@ -664,6 +666,7 @@ static ssize_t disksize_store(struct device *dev, | |||
664 | zram->comp = comp; | 666 | zram->comp = comp; |
665 | zram->disksize = disksize; | 667 | zram->disksize = disksize; |
666 | set_capacity(zram->disk, zram->disksize >> SECTOR_SHIFT); | 668 | set_capacity(zram->disk, zram->disksize >> SECTOR_SHIFT); |
669 | revalidate_disk(zram->disk); | ||
667 | up_write(&zram->init_lock); | 670 | up_write(&zram->init_lock); |
668 | return len; | 671 | return len; |
669 | 672 | ||
diff --git a/drivers/bus/Kconfig b/drivers/bus/Kconfig index a118ec1650fa..1f37d9870e7a 100644 --- a/drivers/bus/Kconfig +++ b/drivers/bus/Kconfig | |||
@@ -45,7 +45,7 @@ config OMAP_INTERCONNECT | |||
45 | 45 | ||
46 | config ARM_CCI | 46 | config ARM_CCI |
47 | bool "ARM CCI driver support" | 47 | bool "ARM CCI driver support" |
48 | depends on ARM | 48 | depends on ARM && OF && CPU_V7 |
49 | help | 49 | help |
50 | Driver supporting the CCI cache coherent interconnect for ARM | 50 | Driver supporting the CCI cache coherent interconnect for ARM |
51 | platforms. | 51 | platforms. |
diff --git a/drivers/char/i8k.c b/drivers/char/i8k.c index d915707d2ba1..93dcad0c1cbe 100644 --- a/drivers/char/i8k.c +++ b/drivers/char/i8k.c | |||
@@ -138,7 +138,9 @@ static int i8k_smm(struct smm_regs *regs) | |||
138 | if (!alloc_cpumask_var(&old_mask, GFP_KERNEL)) | 138 | if (!alloc_cpumask_var(&old_mask, GFP_KERNEL)) |
139 | return -ENOMEM; | 139 | return -ENOMEM; |
140 | cpumask_copy(old_mask, ¤t->cpus_allowed); | 140 | cpumask_copy(old_mask, ¤t->cpus_allowed); |
141 | set_cpus_allowed_ptr(current, cpumask_of(0)); | 141 | rc = set_cpus_allowed_ptr(current, cpumask_of(0)); |
142 | if (rc) | ||
143 | goto out; | ||
142 | if (smp_processor_id() != 0) { | 144 | if (smp_processor_id() != 0) { |
143 | rc = -EBUSY; | 145 | rc = -EBUSY; |
144 | goto out; | 146 | goto out; |
diff --git a/drivers/char/random.c b/drivers/char/random.c index 4ad71ef2cd59..0a7ac0a7b252 100644 --- a/drivers/char/random.c +++ b/drivers/char/random.c | |||
@@ -980,7 +980,6 @@ static void push_to_pool(struct work_struct *work) | |||
980 | static size_t account(struct entropy_store *r, size_t nbytes, int min, | 980 | static size_t account(struct entropy_store *r, size_t nbytes, int min, |
981 | int reserved) | 981 | int reserved) |
982 | { | 982 | { |
983 | int have_bytes; | ||
984 | int entropy_count, orig; | 983 | int entropy_count, orig; |
985 | size_t ibytes; | 984 | size_t ibytes; |
986 | 985 | ||
@@ -989,17 +988,19 @@ static size_t account(struct entropy_store *r, size_t nbytes, int min, | |||
989 | /* Can we pull enough? */ | 988 | /* Can we pull enough? */ |
990 | retry: | 989 | retry: |
991 | entropy_count = orig = ACCESS_ONCE(r->entropy_count); | 990 | entropy_count = orig = ACCESS_ONCE(r->entropy_count); |
992 | have_bytes = entropy_count >> (ENTROPY_SHIFT + 3); | ||
993 | ibytes = nbytes; | 991 | ibytes = nbytes; |
994 | /* If limited, never pull more than available */ | 992 | /* If limited, never pull more than available */ |
995 | if (r->limit) | 993 | if (r->limit) { |
996 | ibytes = min_t(size_t, ibytes, have_bytes - reserved); | 994 | int have_bytes = entropy_count >> (ENTROPY_SHIFT + 3); |
995 | |||
996 | if ((have_bytes -= reserved) < 0) | ||
997 | have_bytes = 0; | ||
998 | ibytes = min_t(size_t, ibytes, have_bytes); | ||
999 | } | ||
997 | if (ibytes < min) | 1000 | if (ibytes < min) |
998 | ibytes = 0; | 1001 | ibytes = 0; |
999 | if (have_bytes >= ibytes + reserved) | 1002 | if ((entropy_count -= ibytes << (ENTROPY_SHIFT + 3)) < 0) |
1000 | entropy_count -= ibytes << (ENTROPY_SHIFT + 3); | 1003 | entropy_count = 0; |
1001 | else | ||
1002 | entropy_count = reserved << (ENTROPY_SHIFT + 3); | ||
1003 | 1004 | ||
1004 | if (cmpxchg(&r->entropy_count, orig, entropy_count) != orig) | 1005 | if (cmpxchg(&r->entropy_count, orig, entropy_count) != orig) |
1005 | goto retry; | 1006 | goto retry; |
diff --git a/drivers/clk/clk-s2mps11.c b/drivers/clk/clk-s2mps11.c index 9b7b5859a420..3757e9e72d37 100644 --- a/drivers/clk/clk-s2mps11.c +++ b/drivers/clk/clk-s2mps11.c | |||
@@ -230,16 +230,13 @@ static int s2mps11_clk_probe(struct platform_device *pdev) | |||
230 | goto err_reg; | 230 | goto err_reg; |
231 | } | 231 | } |
232 | 232 | ||
233 | s2mps11_clk->lookup = devm_kzalloc(&pdev->dev, | 233 | s2mps11_clk->lookup = clkdev_alloc(s2mps11_clk->clk, |
234 | sizeof(struct clk_lookup), GFP_KERNEL); | 234 | s2mps11_name(s2mps11_clk), NULL); |
235 | if (!s2mps11_clk->lookup) { | 235 | if (!s2mps11_clk->lookup) { |
236 | ret = -ENOMEM; | 236 | ret = -ENOMEM; |
237 | goto err_lup; | 237 | goto err_lup; |
238 | } | 238 | } |
239 | 239 | ||
240 | s2mps11_clk->lookup->con_id = s2mps11_name(s2mps11_clk); | ||
241 | s2mps11_clk->lookup->clk = s2mps11_clk->clk; | ||
242 | |||
243 | clkdev_add(s2mps11_clk->lookup); | 240 | clkdev_add(s2mps11_clk->lookup); |
244 | } | 241 | } |
245 | 242 | ||
diff --git a/drivers/clk/qcom/mmcc-msm8960.c b/drivers/clk/qcom/mmcc-msm8960.c index 12f3c0b64fcd..4c449b3170f6 100644 --- a/drivers/clk/qcom/mmcc-msm8960.c +++ b/drivers/clk/qcom/mmcc-msm8960.c | |||
@@ -1209,7 +1209,7 @@ static struct clk_branch rot_clk = { | |||
1209 | 1209 | ||
1210 | static u8 mmcc_pxo_hdmi_map[] = { | 1210 | static u8 mmcc_pxo_hdmi_map[] = { |
1211 | [P_PXO] = 0, | 1211 | [P_PXO] = 0, |
1212 | [P_HDMI_PLL] = 2, | 1212 | [P_HDMI_PLL] = 3, |
1213 | }; | 1213 | }; |
1214 | 1214 | ||
1215 | static const char *mmcc_pxo_hdmi[] = { | 1215 | static const char *mmcc_pxo_hdmi[] = { |
diff --git a/drivers/clk/samsung/clk-exynos4.c b/drivers/clk/samsung/clk-exynos4.c index 4f150c9dd38c..7f4a473a7ad7 100644 --- a/drivers/clk/samsung/clk-exynos4.c +++ b/drivers/clk/samsung/clk-exynos4.c | |||
@@ -925,21 +925,13 @@ static struct samsung_gate_clock exynos4x12_gate_clks[] __initdata = { | |||
925 | GATE(CLK_RTC, "rtc", "aclk100", E4X12_GATE_IP_PERIR, 15, | 925 | GATE(CLK_RTC, "rtc", "aclk100", E4X12_GATE_IP_PERIR, 15, |
926 | 0, 0), | 926 | 0, 0), |
927 | GATE(CLK_KEYIF, "keyif", "aclk100", E4X12_GATE_IP_PERIR, 16, 0, 0), | 927 | GATE(CLK_KEYIF, "keyif", "aclk100", E4X12_GATE_IP_PERIR, 16, 0, 0), |
928 | GATE(CLK_SCLK_PWM_ISP, "sclk_pwm_isp", "div_pwm_isp", | 928 | GATE(CLK_PWM_ISP_SCLK, "pwm_isp_sclk", "div_pwm_isp", |
929 | E4X12_SRC_MASK_ISP, 0, CLK_SET_RATE_PARENT, 0), | ||
930 | GATE(CLK_SCLK_SPI0_ISP, "sclk_spi0_isp", "div_spi0_isp_pre", | ||
931 | E4X12_SRC_MASK_ISP, 4, CLK_SET_RATE_PARENT, 0), | ||
932 | GATE(CLK_SCLK_SPI1_ISP, "sclk_spi1_isp", "div_spi1_isp_pre", | ||
933 | E4X12_SRC_MASK_ISP, 8, CLK_SET_RATE_PARENT, 0), | ||
934 | GATE(CLK_SCLK_UART_ISP, "sclk_uart_isp", "div_uart_isp", | ||
935 | E4X12_SRC_MASK_ISP, 12, CLK_SET_RATE_PARENT, 0), | ||
936 | GATE(CLK_PWM_ISP_SCLK, "pwm_isp_sclk", "sclk_pwm_isp", | ||
937 | E4X12_GATE_IP_ISP, 0, 0, 0), | 929 | E4X12_GATE_IP_ISP, 0, 0, 0), |
938 | GATE(CLK_SPI0_ISP_SCLK, "spi0_isp_sclk", "sclk_spi0_isp", | 930 | GATE(CLK_SPI0_ISP_SCLK, "spi0_isp_sclk", "div_spi0_isp_pre", |
939 | E4X12_GATE_IP_ISP, 1, 0, 0), | 931 | E4X12_GATE_IP_ISP, 1, 0, 0), |
940 | GATE(CLK_SPI1_ISP_SCLK, "spi1_isp_sclk", "sclk_spi1_isp", | 932 | GATE(CLK_SPI1_ISP_SCLK, "spi1_isp_sclk", "div_spi1_isp_pre", |
941 | E4X12_GATE_IP_ISP, 2, 0, 0), | 933 | E4X12_GATE_IP_ISP, 2, 0, 0), |
942 | GATE(CLK_UART_ISP_SCLK, "uart_isp_sclk", "sclk_uart_isp", | 934 | GATE(CLK_UART_ISP_SCLK, "uart_isp_sclk", "div_uart_isp", |
943 | E4X12_GATE_IP_ISP, 3, 0, 0), | 935 | E4X12_GATE_IP_ISP, 3, 0, 0), |
944 | GATE(CLK_WDT, "watchdog", "aclk100", E4X12_GATE_IP_PERIR, 14, 0, 0), | 936 | GATE(CLK_WDT, "watchdog", "aclk100", E4X12_GATE_IP_PERIR, 14, 0, 0), |
945 | GATE(CLK_PCM0, "pcm0", "aclk100", E4X12_GATE_IP_MAUDIO, 2, | 937 | GATE(CLK_PCM0, "pcm0", "aclk100", E4X12_GATE_IP_MAUDIO, 2, |
diff --git a/drivers/clk/samsung/clk-exynos5250.c b/drivers/clk/samsung/clk-exynos5250.c index 1fad4c5e3f5d..184f64293b26 100644 --- a/drivers/clk/samsung/clk-exynos5250.c +++ b/drivers/clk/samsung/clk-exynos5250.c | |||
@@ -661,7 +661,7 @@ static struct samsung_gate_clock exynos5250_gate_clks[] __initdata = { | |||
661 | GATE(CLK_RTC, "rtc", "div_aclk66", GATE_IP_PERIS, 20, 0, 0), | 661 | GATE(CLK_RTC, "rtc", "div_aclk66", GATE_IP_PERIS, 20, 0, 0), |
662 | GATE(CLK_TMU, "tmu", "div_aclk66", GATE_IP_PERIS, 21, 0, 0), | 662 | GATE(CLK_TMU, "tmu", "div_aclk66", GATE_IP_PERIS, 21, 0, 0), |
663 | GATE(CLK_SMMU_TV, "smmu_tv", "mout_aclk200_disp1_sub", | 663 | GATE(CLK_SMMU_TV, "smmu_tv", "mout_aclk200_disp1_sub", |
664 | GATE_IP_DISP1, 2, 0, 0), | 664 | GATE_IP_DISP1, 9, 0, 0), |
665 | GATE(CLK_SMMU_FIMD1, "smmu_fimd1", "mout_aclk200_disp1_sub", | 665 | GATE(CLK_SMMU_FIMD1, "smmu_fimd1", "mout_aclk200_disp1_sub", |
666 | GATE_IP_DISP1, 8, 0, 0), | 666 | GATE_IP_DISP1, 8, 0, 0), |
667 | GATE(CLK_SMMU_2D, "smmu_2d", "div_aclk200", GATE_IP_ACP, 7, 0, 0), | 667 | GATE(CLK_SMMU_2D, "smmu_2d", "div_aclk200", GATE_IP_ACP, 7, 0, 0), |
diff --git a/drivers/clk/samsung/clk-exynos5420.c b/drivers/clk/samsung/clk-exynos5420.c index 9d7d7eed03fd..a4e6cc782e5c 100644 --- a/drivers/clk/samsung/clk-exynos5420.c +++ b/drivers/clk/samsung/clk-exynos5420.c | |||
@@ -631,7 +631,8 @@ static struct samsung_mux_clock exynos5x_mux_clks[] __initdata = { | |||
631 | SRC_TOP4, 16, 1), | 631 | SRC_TOP4, 16, 1), |
632 | MUX(0, "mout_user_aclk266", mout_user_aclk266_p, SRC_TOP4, 20, 1), | 632 | MUX(0, "mout_user_aclk266", mout_user_aclk266_p, SRC_TOP4, 20, 1), |
633 | MUX(0, "mout_user_aclk166", mout_user_aclk166_p, SRC_TOP4, 24, 1), | 633 | MUX(0, "mout_user_aclk166", mout_user_aclk166_p, SRC_TOP4, 24, 1), |
634 | MUX(0, "mout_user_aclk333", mout_user_aclk333_p, SRC_TOP4, 28, 1), | 634 | MUX(CLK_MOUT_USER_ACLK333, "mout_user_aclk333", mout_user_aclk333_p, |
635 | SRC_TOP4, 28, 1), | ||
635 | 636 | ||
636 | MUX(0, "mout_user_aclk400_disp1", mout_user_aclk400_disp1_p, | 637 | MUX(0, "mout_user_aclk400_disp1", mout_user_aclk400_disp1_p, |
637 | SRC_TOP5, 0, 1), | 638 | SRC_TOP5, 0, 1), |
@@ -684,7 +685,8 @@ static struct samsung_mux_clock exynos5x_mux_clks[] __initdata = { | |||
684 | SRC_TOP11, 12, 1), | 685 | SRC_TOP11, 12, 1), |
685 | MUX(0, "mout_sw_aclk266", mout_sw_aclk266_p, SRC_TOP11, 20, 1), | 686 | MUX(0, "mout_sw_aclk266", mout_sw_aclk266_p, SRC_TOP11, 20, 1), |
686 | MUX(0, "mout_sw_aclk166", mout_sw_aclk166_p, SRC_TOP11, 24, 1), | 687 | MUX(0, "mout_sw_aclk166", mout_sw_aclk166_p, SRC_TOP11, 24, 1), |
687 | MUX(0, "mout_sw_aclk333", mout_sw_aclk333_p, SRC_TOP11, 28, 1), | 688 | MUX(CLK_MOUT_SW_ACLK333, "mout_sw_aclk333", mout_sw_aclk333_p, |
689 | SRC_TOP11, 28, 1), | ||
688 | 690 | ||
689 | MUX(0, "mout_sw_aclk400_disp1", mout_sw_aclk400_disp1_p, | 691 | MUX(0, "mout_sw_aclk400_disp1", mout_sw_aclk400_disp1_p, |
690 | SRC_TOP12, 4, 1), | 692 | SRC_TOP12, 4, 1), |
@@ -890,8 +892,6 @@ static struct samsung_gate_clock exynos5x_gate_clks[] __initdata = { | |||
890 | GATE_BUS_TOP, 9, CLK_IGNORE_UNUSED, 0), | 892 | GATE_BUS_TOP, 9, CLK_IGNORE_UNUSED, 0), |
891 | GATE(0, "aclk66_psgen", "mout_user_aclk66_psgen", | 893 | GATE(0, "aclk66_psgen", "mout_user_aclk66_psgen", |
892 | GATE_BUS_TOP, 10, CLK_IGNORE_UNUSED, 0), | 894 | GATE_BUS_TOP, 10, CLK_IGNORE_UNUSED, 0), |
893 | GATE(CLK_ACLK66_PERIC, "aclk66_peric", "mout_user_aclk66_peric", | ||
894 | GATE_BUS_TOP, 11, CLK_IGNORE_UNUSED, 0), | ||
895 | GATE(0, "aclk266_isp", "mout_user_aclk266_isp", | 895 | GATE(0, "aclk266_isp", "mout_user_aclk266_isp", |
896 | GATE_BUS_TOP, 13, 0, 0), | 896 | GATE_BUS_TOP, 13, 0, 0), |
897 | GATE(0, "aclk166", "mout_user_aclk166", | 897 | GATE(0, "aclk166", "mout_user_aclk166", |
@@ -994,34 +994,61 @@ static struct samsung_gate_clock exynos5x_gate_clks[] __initdata = { | |||
994 | SRC_MASK_FSYS, 24, CLK_SET_RATE_PARENT, 0), | 994 | SRC_MASK_FSYS, 24, CLK_SET_RATE_PARENT, 0), |
995 | 995 | ||
996 | /* PERIC Block */ | 996 | /* PERIC Block */ |
997 | GATE(CLK_UART0, "uart0", "aclk66_peric", GATE_IP_PERIC, 0, 0, 0), | 997 | GATE(CLK_UART0, "uart0", "mout_user_aclk66_peric", |
998 | GATE(CLK_UART1, "uart1", "aclk66_peric", GATE_IP_PERIC, 1, 0, 0), | 998 | GATE_IP_PERIC, 0, 0, 0), |
999 | GATE(CLK_UART2, "uart2", "aclk66_peric", GATE_IP_PERIC, 2, 0, 0), | 999 | GATE(CLK_UART1, "uart1", "mout_user_aclk66_peric", |
1000 | GATE(CLK_UART3, "uart3", "aclk66_peric", GATE_IP_PERIC, 3, 0, 0), | 1000 | GATE_IP_PERIC, 1, 0, 0), |
1001 | GATE(CLK_I2C0, "i2c0", "aclk66_peric", GATE_IP_PERIC, 6, 0, 0), | 1001 | GATE(CLK_UART2, "uart2", "mout_user_aclk66_peric", |
1002 | GATE(CLK_I2C1, "i2c1", "aclk66_peric", GATE_IP_PERIC, 7, 0, 0), | 1002 | GATE_IP_PERIC, 2, 0, 0), |
1003 | GATE(CLK_I2C2, "i2c2", "aclk66_peric", GATE_IP_PERIC, 8, 0, 0), | 1003 | GATE(CLK_UART3, "uart3", "mout_user_aclk66_peric", |
1004 | GATE(CLK_I2C3, "i2c3", "aclk66_peric", GATE_IP_PERIC, 9, 0, 0), | 1004 | GATE_IP_PERIC, 3, 0, 0), |
1005 | GATE(CLK_USI0, "usi0", "aclk66_peric", GATE_IP_PERIC, 10, 0, 0), | 1005 | GATE(CLK_I2C0, "i2c0", "mout_user_aclk66_peric", |
1006 | GATE(CLK_USI1, "usi1", "aclk66_peric", GATE_IP_PERIC, 11, 0, 0), | 1006 | GATE_IP_PERIC, 6, 0, 0), |
1007 | GATE(CLK_USI2, "usi2", "aclk66_peric", GATE_IP_PERIC, 12, 0, 0), | 1007 | GATE(CLK_I2C1, "i2c1", "mout_user_aclk66_peric", |
1008 | GATE(CLK_USI3, "usi3", "aclk66_peric", GATE_IP_PERIC, 13, 0, 0), | 1008 | GATE_IP_PERIC, 7, 0, 0), |
1009 | GATE(CLK_I2C_HDMI, "i2c_hdmi", "aclk66_peric", GATE_IP_PERIC, 14, 0, 0), | 1009 | GATE(CLK_I2C2, "i2c2", "mout_user_aclk66_peric", |
1010 | GATE(CLK_TSADC, "tsadc", "aclk66_peric", GATE_IP_PERIC, 15, 0, 0), | 1010 | GATE_IP_PERIC, 8, 0, 0), |
1011 | GATE(CLK_SPI0, "spi0", "aclk66_peric", GATE_IP_PERIC, 16, 0, 0), | 1011 | GATE(CLK_I2C3, "i2c3", "mout_user_aclk66_peric", |
1012 | GATE(CLK_SPI1, "spi1", "aclk66_peric", GATE_IP_PERIC, 17, 0, 0), | 1012 | GATE_IP_PERIC, 9, 0, 0), |
1013 | GATE(CLK_SPI2, "spi2", "aclk66_peric", GATE_IP_PERIC, 18, 0, 0), | 1013 | GATE(CLK_USI0, "usi0", "mout_user_aclk66_peric", |
1014 | GATE(CLK_I2S1, "i2s1", "aclk66_peric", GATE_IP_PERIC, 20, 0, 0), | 1014 | GATE_IP_PERIC, 10, 0, 0), |
1015 | GATE(CLK_I2S2, "i2s2", "aclk66_peric", GATE_IP_PERIC, 21, 0, 0), | 1015 | GATE(CLK_USI1, "usi1", "mout_user_aclk66_peric", |
1016 | GATE(CLK_PCM1, "pcm1", "aclk66_peric", GATE_IP_PERIC, 22, 0, 0), | 1016 | GATE_IP_PERIC, 11, 0, 0), |
1017 | GATE(CLK_PCM2, "pcm2", "aclk66_peric", GATE_IP_PERIC, 23, 0, 0), | 1017 | GATE(CLK_USI2, "usi2", "mout_user_aclk66_peric", |
1018 | GATE(CLK_PWM, "pwm", "aclk66_peric", GATE_IP_PERIC, 24, 0, 0), | 1018 | GATE_IP_PERIC, 12, 0, 0), |
1019 | GATE(CLK_SPDIF, "spdif", "aclk66_peric", GATE_IP_PERIC, 26, 0, 0), | 1019 | GATE(CLK_USI3, "usi3", "mout_user_aclk66_peric", |
1020 | GATE(CLK_USI4, "usi4", "aclk66_peric", GATE_IP_PERIC, 28, 0, 0), | 1020 | GATE_IP_PERIC, 13, 0, 0), |
1021 | GATE(CLK_USI5, "usi5", "aclk66_peric", GATE_IP_PERIC, 30, 0, 0), | 1021 | GATE(CLK_I2C_HDMI, "i2c_hdmi", "mout_user_aclk66_peric", |
1022 | GATE(CLK_USI6, "usi6", "aclk66_peric", GATE_IP_PERIC, 31, 0, 0), | 1022 | GATE_IP_PERIC, 14, 0, 0), |
1023 | 1023 | GATE(CLK_TSADC, "tsadc", "mout_user_aclk66_peric", | |
1024 | GATE(CLK_KEYIF, "keyif", "aclk66_peric", GATE_BUS_PERIC, 22, 0, 0), | 1024 | GATE_IP_PERIC, 15, 0, 0), |
1025 | GATE(CLK_SPI0, "spi0", "mout_user_aclk66_peric", | ||
1026 | GATE_IP_PERIC, 16, 0, 0), | ||
1027 | GATE(CLK_SPI1, "spi1", "mout_user_aclk66_peric", | ||
1028 | GATE_IP_PERIC, 17, 0, 0), | ||
1029 | GATE(CLK_SPI2, "spi2", "mout_user_aclk66_peric", | ||
1030 | GATE_IP_PERIC, 18, 0, 0), | ||
1031 | GATE(CLK_I2S1, "i2s1", "mout_user_aclk66_peric", | ||
1032 | GATE_IP_PERIC, 20, 0, 0), | ||
1033 | GATE(CLK_I2S2, "i2s2", "mout_user_aclk66_peric", | ||
1034 | GATE_IP_PERIC, 21, 0, 0), | ||
1035 | GATE(CLK_PCM1, "pcm1", "mout_user_aclk66_peric", | ||
1036 | GATE_IP_PERIC, 22, 0, 0), | ||
1037 | GATE(CLK_PCM2, "pcm2", "mout_user_aclk66_peric", | ||
1038 | GATE_IP_PERIC, 23, 0, 0), | ||
1039 | GATE(CLK_PWM, "pwm", "mout_user_aclk66_peric", | ||
1040 | GATE_IP_PERIC, 24, 0, 0), | ||
1041 | GATE(CLK_SPDIF, "spdif", "mout_user_aclk66_peric", | ||
1042 | GATE_IP_PERIC, 26, 0, 0), | ||
1043 | GATE(CLK_USI4, "usi4", "mout_user_aclk66_peric", | ||
1044 | GATE_IP_PERIC, 28, 0, 0), | ||
1045 | GATE(CLK_USI5, "usi5", "mout_user_aclk66_peric", | ||
1046 | GATE_IP_PERIC, 30, 0, 0), | ||
1047 | GATE(CLK_USI6, "usi6", "mout_user_aclk66_peric", | ||
1048 | GATE_IP_PERIC, 31, 0, 0), | ||
1049 | |||
1050 | GATE(CLK_KEYIF, "keyif", "mout_user_aclk66_peric", | ||
1051 | GATE_BUS_PERIC, 22, 0, 0), | ||
1025 | 1052 | ||
1026 | /* PERIS Block */ | 1053 | /* PERIS Block */ |
1027 | GATE(CLK_CHIPID, "chipid", "aclk66_psgen", | 1054 | GATE(CLK_CHIPID, "chipid", "aclk66_psgen", |
diff --git a/drivers/clk/samsung/clk-s3c2410.c b/drivers/clk/samsung/clk-s3c2410.c index ba0716801db2..140f4733c02e 100644 --- a/drivers/clk/samsung/clk-s3c2410.c +++ b/drivers/clk/samsung/clk-s3c2410.c | |||
@@ -152,6 +152,11 @@ struct samsung_clock_alias s3c2410_common_aliases[] __initdata = { | |||
152 | ALIAS(HCLK, NULL, "hclk"), | 152 | ALIAS(HCLK, NULL, "hclk"), |
153 | ALIAS(MPLL, NULL, "mpll"), | 153 | ALIAS(MPLL, NULL, "mpll"), |
154 | ALIAS(FCLK, NULL, "fclk"), | 154 | ALIAS(FCLK, NULL, "fclk"), |
155 | ALIAS(PCLK, NULL, "watchdog"), | ||
156 | ALIAS(PCLK_SDI, NULL, "sdi"), | ||
157 | ALIAS(HCLK_NAND, NULL, "nand"), | ||
158 | ALIAS(PCLK_I2S, NULL, "iis"), | ||
159 | ALIAS(PCLK_I2C, NULL, "i2c"), | ||
155 | }; | 160 | }; |
156 | 161 | ||
157 | /* S3C2410 specific clocks */ | 162 | /* S3C2410 specific clocks */ |
@@ -378,7 +383,7 @@ void __init s3c2410_common_clk_init(struct device_node *np, unsigned long xti_f, | |||
378 | if (!np) | 383 | if (!np) |
379 | s3c2410_common_clk_register_fixed_ext(ctx, xti_f); | 384 | s3c2410_common_clk_register_fixed_ext(ctx, xti_f); |
380 | 385 | ||
381 | if (current_soc == 2410) { | 386 | if (current_soc == S3C2410) { |
382 | if (_get_rate("xti") == 12 * MHZ) { | 387 | if (_get_rate("xti") == 12 * MHZ) { |
383 | s3c2410_plls[mpll].rate_table = pll_s3c2410_12mhz_tbl; | 388 | s3c2410_plls[mpll].rate_table = pll_s3c2410_12mhz_tbl; |
384 | s3c2410_plls[upll].rate_table = pll_s3c2410_12mhz_tbl; | 389 | s3c2410_plls[upll].rate_table = pll_s3c2410_12mhz_tbl; |
@@ -432,7 +437,7 @@ void __init s3c2410_common_clk_init(struct device_node *np, unsigned long xti_f, | |||
432 | samsung_clk_register_fixed_factor(ctx, s3c2410_ffactor, | 437 | samsung_clk_register_fixed_factor(ctx, s3c2410_ffactor, |
433 | ARRAY_SIZE(s3c2410_ffactor)); | 438 | ARRAY_SIZE(s3c2410_ffactor)); |
434 | samsung_clk_register_alias(ctx, s3c2410_aliases, | 439 | samsung_clk_register_alias(ctx, s3c2410_aliases, |
435 | ARRAY_SIZE(s3c2410_common_aliases)); | 440 | ARRAY_SIZE(s3c2410_aliases)); |
436 | break; | 441 | break; |
437 | case S3C2440: | 442 | case S3C2440: |
438 | samsung_clk_register_mux(ctx, s3c2440_muxes, | 443 | samsung_clk_register_mux(ctx, s3c2440_muxes, |
diff --git a/drivers/clk/samsung/clk-s3c64xx.c b/drivers/clk/samsung/clk-s3c64xx.c index efa16ee592c8..8889ff1c10fc 100644 --- a/drivers/clk/samsung/clk-s3c64xx.c +++ b/drivers/clk/samsung/clk-s3c64xx.c | |||
@@ -418,8 +418,10 @@ static struct samsung_clock_alias s3c64xx_clock_aliases[] = { | |||
418 | ALIAS(SCLK_MMC2, "s3c-sdhci.2", "mmc_busclk.2"), | 418 | ALIAS(SCLK_MMC2, "s3c-sdhci.2", "mmc_busclk.2"), |
419 | ALIAS(SCLK_MMC1, "s3c-sdhci.1", "mmc_busclk.2"), | 419 | ALIAS(SCLK_MMC1, "s3c-sdhci.1", "mmc_busclk.2"), |
420 | ALIAS(SCLK_MMC0, "s3c-sdhci.0", "mmc_busclk.2"), | 420 | ALIAS(SCLK_MMC0, "s3c-sdhci.0", "mmc_busclk.2"), |
421 | ALIAS(SCLK_SPI1, "s3c6410-spi.1", "spi-bus"), | 421 | ALIAS(PCLK_SPI1, "s3c6410-spi.1", "spi_busclk0"), |
422 | ALIAS(SCLK_SPI0, "s3c6410-spi.0", "spi-bus"), | 422 | ALIAS(SCLK_SPI1, "s3c6410-spi.1", "spi_busclk2"), |
423 | ALIAS(PCLK_SPI0, "s3c6410-spi.0", "spi_busclk0"), | ||
424 | ALIAS(SCLK_SPI0, "s3c6410-spi.0", "spi_busclk2"), | ||
423 | ALIAS(SCLK_AUDIO1, "samsung-pcm.1", "audio-bus"), | 425 | ALIAS(SCLK_AUDIO1, "samsung-pcm.1", "audio-bus"), |
424 | ALIAS(SCLK_AUDIO1, "samsung-i2s.1", "audio-bus"), | 426 | ALIAS(SCLK_AUDIO1, "samsung-i2s.1", "audio-bus"), |
425 | ALIAS(SCLK_AUDIO0, "samsung-pcm.0", "audio-bus"), | 427 | ALIAS(SCLK_AUDIO0, "samsung-pcm.0", "audio-bus"), |
diff --git a/drivers/clk/spear/spear3xx_clock.c b/drivers/clk/spear/spear3xx_clock.c index c2d204315546..bb5f387774e2 100644 --- a/drivers/clk/spear/spear3xx_clock.c +++ b/drivers/clk/spear/spear3xx_clock.c | |||
@@ -211,7 +211,7 @@ static inline void spear310_clk_init(void) { } | |||
211 | /* array of all spear 320 clock lookups */ | 211 | /* array of all spear 320 clock lookups */ |
212 | #ifdef CONFIG_MACH_SPEAR320 | 212 | #ifdef CONFIG_MACH_SPEAR320 |
213 | 213 | ||
214 | #define SPEAR320_CONTROL_REG (soc_config_base + 0x0000) | 214 | #define SPEAR320_CONTROL_REG (soc_config_base + 0x0010) |
215 | #define SPEAR320_EXT_CTRL_REG (soc_config_base + 0x0018) | 215 | #define SPEAR320_EXT_CTRL_REG (soc_config_base + 0x0018) |
216 | 216 | ||
217 | #define SPEAR320_UARTX_PCLK_MASK 0x1 | 217 | #define SPEAR320_UARTX_PCLK_MASK 0x1 |
@@ -245,7 +245,8 @@ static const char *smii0_parents[] = { "smii_125m_pad", "ras_pll2_clk", | |||
245 | "ras_syn0_gclk", }; | 245 | "ras_syn0_gclk", }; |
246 | static const char *uartx_parents[] = { "ras_syn1_gclk", "ras_apb_clk", }; | 246 | static const char *uartx_parents[] = { "ras_syn1_gclk", "ras_apb_clk", }; |
247 | 247 | ||
248 | static void __init spear320_clk_init(void __iomem *soc_config_base) | 248 | static void __init spear320_clk_init(void __iomem *soc_config_base, |
249 | struct clk *ras_apb_clk) | ||
249 | { | 250 | { |
250 | struct clk *clk; | 251 | struct clk *clk; |
251 | 252 | ||
@@ -342,6 +343,8 @@ static void __init spear320_clk_init(void __iomem *soc_config_base) | |||
342 | SPEAR320_CONTROL_REG, UART1_PCLK_SHIFT, UART1_PCLK_MASK, | 343 | SPEAR320_CONTROL_REG, UART1_PCLK_SHIFT, UART1_PCLK_MASK, |
343 | 0, &_lock); | 344 | 0, &_lock); |
344 | clk_register_clkdev(clk, NULL, "a3000000.serial"); | 345 | clk_register_clkdev(clk, NULL, "a3000000.serial"); |
346 | /* Enforce ras_apb_clk */ | ||
347 | clk_set_parent(clk, ras_apb_clk); | ||
345 | 348 | ||
346 | clk = clk_register_mux(NULL, "uart2_clk", uartx_parents, | 349 | clk = clk_register_mux(NULL, "uart2_clk", uartx_parents, |
347 | ARRAY_SIZE(uartx_parents), | 350 | ARRAY_SIZE(uartx_parents), |
@@ -349,6 +352,8 @@ static void __init spear320_clk_init(void __iomem *soc_config_base) | |||
349 | SPEAR320_EXT_CTRL_REG, SPEAR320_UART2_PCLK_SHIFT, | 352 | SPEAR320_EXT_CTRL_REG, SPEAR320_UART2_PCLK_SHIFT, |
350 | SPEAR320_UARTX_PCLK_MASK, 0, &_lock); | 353 | SPEAR320_UARTX_PCLK_MASK, 0, &_lock); |
351 | clk_register_clkdev(clk, NULL, "a4000000.serial"); | 354 | clk_register_clkdev(clk, NULL, "a4000000.serial"); |
355 | /* Enforce ras_apb_clk */ | ||
356 | clk_set_parent(clk, ras_apb_clk); | ||
352 | 357 | ||
353 | clk = clk_register_mux(NULL, "uart3_clk", uartx_parents, | 358 | clk = clk_register_mux(NULL, "uart3_clk", uartx_parents, |
354 | ARRAY_SIZE(uartx_parents), | 359 | ARRAY_SIZE(uartx_parents), |
@@ -379,12 +384,12 @@ static void __init spear320_clk_init(void __iomem *soc_config_base) | |||
379 | clk_register_clkdev(clk, NULL, "60100000.serial"); | 384 | clk_register_clkdev(clk, NULL, "60100000.serial"); |
380 | } | 385 | } |
381 | #else | 386 | #else |
382 | static inline void spear320_clk_init(void __iomem *soc_config_base) { } | 387 | static inline void spear320_clk_init(void __iomem *sb, struct clk *rc) { } |
383 | #endif | 388 | #endif |
384 | 389 | ||
385 | void __init spear3xx_clk_init(void __iomem *misc_base, void __iomem *soc_config_base) | 390 | void __init spear3xx_clk_init(void __iomem *misc_base, void __iomem *soc_config_base) |
386 | { | 391 | { |
387 | struct clk *clk, *clk1; | 392 | struct clk *clk, *clk1, *ras_apb_clk; |
388 | 393 | ||
389 | clk = clk_register_fixed_rate(NULL, "osc_32k_clk", NULL, CLK_IS_ROOT, | 394 | clk = clk_register_fixed_rate(NULL, "osc_32k_clk", NULL, CLK_IS_ROOT, |
390 | 32000); | 395 | 32000); |
@@ -613,6 +618,7 @@ void __init spear3xx_clk_init(void __iomem *misc_base, void __iomem *soc_config_ | |||
613 | clk = clk_register_gate(NULL, "ras_apb_clk", "apb_clk", 0, RAS_CLK_ENB, | 618 | clk = clk_register_gate(NULL, "ras_apb_clk", "apb_clk", 0, RAS_CLK_ENB, |
614 | RAS_APB_CLK_ENB, 0, &_lock); | 619 | RAS_APB_CLK_ENB, 0, &_lock); |
615 | clk_register_clkdev(clk, "ras_apb_clk", NULL); | 620 | clk_register_clkdev(clk, "ras_apb_clk", NULL); |
621 | ras_apb_clk = clk; | ||
616 | 622 | ||
617 | clk = clk_register_gate(NULL, "ras_32k_clk", "osc_32k_clk", 0, | 623 | clk = clk_register_gate(NULL, "ras_32k_clk", "osc_32k_clk", 0, |
618 | RAS_CLK_ENB, RAS_32K_CLK_ENB, 0, &_lock); | 624 | RAS_CLK_ENB, RAS_32K_CLK_ENB, 0, &_lock); |
@@ -659,5 +665,5 @@ void __init spear3xx_clk_init(void __iomem *misc_base, void __iomem *soc_config_ | |||
659 | else if (of_machine_is_compatible("st,spear310")) | 665 | else if (of_machine_is_compatible("st,spear310")) |
660 | spear310_clk_init(); | 666 | spear310_clk_init(); |
661 | else if (of_machine_is_compatible("st,spear320")) | 667 | else if (of_machine_is_compatible("st,spear320")) |
662 | spear320_clk_init(soc_config_base); | 668 | spear320_clk_init(soc_config_base, ras_apb_clk); |
663 | } | 669 | } |
diff --git a/drivers/clk/sunxi/clk-sun6i-apb0-gates.c b/drivers/clk/sunxi/clk-sun6i-apb0-gates.c index 44cd27c5c401..670f90d629d7 100644 --- a/drivers/clk/sunxi/clk-sun6i-apb0-gates.c +++ b/drivers/clk/sunxi/clk-sun6i-apb0-gates.c | |||
@@ -29,7 +29,7 @@ static int sun6i_a31_apb0_gates_clk_probe(struct platform_device *pdev) | |||
29 | 29 | ||
30 | r = platform_get_resource(pdev, IORESOURCE_MEM, 0); | 30 | r = platform_get_resource(pdev, IORESOURCE_MEM, 0); |
31 | reg = devm_ioremap_resource(&pdev->dev, r); | 31 | reg = devm_ioremap_resource(&pdev->dev, r); |
32 | if (!reg) | 32 | if (IS_ERR(reg)) |
33 | return PTR_ERR(reg); | 33 | return PTR_ERR(reg); |
34 | 34 | ||
35 | clk_parent = of_clk_get_parent_name(np, 0); | 35 | clk_parent = of_clk_get_parent_name(np, 0); |
diff --git a/drivers/clk/ti/apll.c b/drivers/clk/ti/apll.c index 5428c9c547cd..72d97279eae1 100644 --- a/drivers/clk/ti/apll.c +++ b/drivers/clk/ti/apll.c | |||
@@ -77,13 +77,11 @@ static int dra7_apll_enable(struct clk_hw *hw) | |||
77 | if (i == MAX_APLL_WAIT_TRIES) { | 77 | if (i == MAX_APLL_WAIT_TRIES) { |
78 | pr_warn("clock: %s failed transition to '%s'\n", | 78 | pr_warn("clock: %s failed transition to '%s'\n", |
79 | clk_name, (state) ? "locked" : "bypassed"); | 79 | clk_name, (state) ? "locked" : "bypassed"); |
80 | } else { | 80 | r = -EBUSY; |
81 | } else | ||
81 | pr_debug("clock: %s transition to '%s' in %d loops\n", | 82 | pr_debug("clock: %s transition to '%s' in %d loops\n", |
82 | clk_name, (state) ? "locked" : "bypassed", i); | 83 | clk_name, (state) ? "locked" : "bypassed", i); |
83 | 84 | ||
84 | r = 0; | ||
85 | } | ||
86 | |||
87 | return r; | 85 | return r; |
88 | } | 86 | } |
89 | 87 | ||
@@ -338,7 +336,7 @@ static void __init of_omap2_apll_setup(struct device_node *node) | |||
338 | const char *parent_name; | 336 | const char *parent_name; |
339 | u32 val; | 337 | u32 val; |
340 | 338 | ||
341 | ad = kzalloc(sizeof(*clk_hw), GFP_KERNEL); | 339 | ad = kzalloc(sizeof(*ad), GFP_KERNEL); |
342 | clk_hw = kzalloc(sizeof(*clk_hw), GFP_KERNEL); | 340 | clk_hw = kzalloc(sizeof(*clk_hw), GFP_KERNEL); |
343 | init = kzalloc(sizeof(*init), GFP_KERNEL); | 341 | init = kzalloc(sizeof(*init), GFP_KERNEL); |
344 | 342 | ||
diff --git a/drivers/clk/ti/dpll.c b/drivers/clk/ti/dpll.c index abd956d5f838..79791e1bf282 100644 --- a/drivers/clk/ti/dpll.c +++ b/drivers/clk/ti/dpll.c | |||
@@ -161,7 +161,8 @@ cleanup: | |||
161 | } | 161 | } |
162 | 162 | ||
163 | #if defined(CONFIG_ARCH_OMAP4) || defined(CONFIG_SOC_OMAP5) || \ | 163 | #if defined(CONFIG_ARCH_OMAP4) || defined(CONFIG_SOC_OMAP5) || \ |
164 | defined(CONFIG_SOC_DRA7XX) || defined(CONFIG_SOC_AM33XX) | 164 | defined(CONFIG_SOC_DRA7XX) || defined(CONFIG_SOC_AM33XX) || \ |
165 | defined(CONFIG_SOC_AM43XX) | ||
165 | /** | 166 | /** |
166 | * ti_clk_register_dpll_x2 - Registers a DPLLx2 clock | 167 | * ti_clk_register_dpll_x2 - Registers a DPLLx2 clock |
167 | * @node: device node for this clock | 168 | * @node: device node for this clock |
@@ -322,7 +323,7 @@ CLK_OF_DECLARE(ti_omap4_dpll_x2_clock, "ti,omap4-dpll-x2-clock", | |||
322 | of_ti_omap4_dpll_x2_setup); | 323 | of_ti_omap4_dpll_x2_setup); |
323 | #endif | 324 | #endif |
324 | 325 | ||
325 | #ifdef CONFIG_SOC_AM33XX | 326 | #if defined(CONFIG_SOC_AM33XX) || defined(CONFIG_SOC_AM43XX) |
326 | static void __init of_ti_am3_dpll_x2_setup(struct device_node *node) | 327 | static void __init of_ti_am3_dpll_x2_setup(struct device_node *node) |
327 | { | 328 | { |
328 | ti_clk_register_dpll_x2(node, &dpll_x2_ck_ops, NULL); | 329 | ti_clk_register_dpll_x2(node, &dpll_x2_ck_ops, NULL); |
diff --git a/drivers/clk/ti/mux.c b/drivers/clk/ti/mux.c index 0197a478720c..e9d650e51287 100644 --- a/drivers/clk/ti/mux.c +++ b/drivers/clk/ti/mux.c | |||
@@ -160,7 +160,7 @@ static void of_mux_clk_setup(struct device_node *node) | |||
160 | u8 clk_mux_flags = 0; | 160 | u8 clk_mux_flags = 0; |
161 | u32 mask = 0; | 161 | u32 mask = 0; |
162 | u32 shift = 0; | 162 | u32 shift = 0; |
163 | u32 flags = 0; | 163 | u32 flags = CLK_SET_RATE_NO_REPARENT; |
164 | 164 | ||
165 | num_parents = of_clk_get_parent_count(node); | 165 | num_parents = of_clk_get_parent_count(node); |
166 | if (num_parents < 2) { | 166 | if (num_parents < 2) { |
diff --git a/drivers/clocksource/exynos_mct.c b/drivers/clocksource/exynos_mct.c index 8d6420013a04..ab51bf20a3ed 100644 --- a/drivers/clocksource/exynos_mct.c +++ b/drivers/clocksource/exynos_mct.c | |||
@@ -153,19 +153,16 @@ static void exynos4_mct_write(unsigned int value, unsigned long offset) | |||
153 | } | 153 | } |
154 | 154 | ||
155 | /* Clocksource handling */ | 155 | /* Clocksource handling */ |
156 | static void exynos4_mct_frc_start(u32 hi, u32 lo) | 156 | static void exynos4_mct_frc_start(void) |
157 | { | 157 | { |
158 | u32 reg; | 158 | u32 reg; |
159 | 159 | ||
160 | exynos4_mct_write(lo, EXYNOS4_MCT_G_CNT_L); | ||
161 | exynos4_mct_write(hi, EXYNOS4_MCT_G_CNT_U); | ||
162 | |||
163 | reg = __raw_readl(reg_base + EXYNOS4_MCT_G_TCON); | 160 | reg = __raw_readl(reg_base + EXYNOS4_MCT_G_TCON); |
164 | reg |= MCT_G_TCON_START; | 161 | reg |= MCT_G_TCON_START; |
165 | exynos4_mct_write(reg, EXYNOS4_MCT_G_TCON); | 162 | exynos4_mct_write(reg, EXYNOS4_MCT_G_TCON); |
166 | } | 163 | } |
167 | 164 | ||
168 | static cycle_t exynos4_frc_read(struct clocksource *cs) | 165 | static cycle_t notrace _exynos4_frc_read(void) |
169 | { | 166 | { |
170 | unsigned int lo, hi; | 167 | unsigned int lo, hi; |
171 | u32 hi2 = __raw_readl(reg_base + EXYNOS4_MCT_G_CNT_U); | 168 | u32 hi2 = __raw_readl(reg_base + EXYNOS4_MCT_G_CNT_U); |
@@ -179,9 +176,14 @@ static cycle_t exynos4_frc_read(struct clocksource *cs) | |||
179 | return ((cycle_t)hi << 32) | lo; | 176 | return ((cycle_t)hi << 32) | lo; |
180 | } | 177 | } |
181 | 178 | ||
179 | static cycle_t exynos4_frc_read(struct clocksource *cs) | ||
180 | { | ||
181 | return _exynos4_frc_read(); | ||
182 | } | ||
183 | |||
182 | static void exynos4_frc_resume(struct clocksource *cs) | 184 | static void exynos4_frc_resume(struct clocksource *cs) |
183 | { | 185 | { |
184 | exynos4_mct_frc_start(0, 0); | 186 | exynos4_mct_frc_start(); |
185 | } | 187 | } |
186 | 188 | ||
187 | struct clocksource mct_frc = { | 189 | struct clocksource mct_frc = { |
@@ -195,12 +197,23 @@ struct clocksource mct_frc = { | |||
195 | 197 | ||
196 | static u64 notrace exynos4_read_sched_clock(void) | 198 | static u64 notrace exynos4_read_sched_clock(void) |
197 | { | 199 | { |
198 | return exynos4_frc_read(&mct_frc); | 200 | return _exynos4_frc_read(); |
201 | } | ||
202 | |||
203 | static struct delay_timer exynos4_delay_timer; | ||
204 | |||
205 | static cycles_t exynos4_read_current_timer(void) | ||
206 | { | ||
207 | return _exynos4_frc_read(); | ||
199 | } | 208 | } |
200 | 209 | ||
201 | static void __init exynos4_clocksource_init(void) | 210 | static void __init exynos4_clocksource_init(void) |
202 | { | 211 | { |
203 | exynos4_mct_frc_start(0, 0); | 212 | exynos4_mct_frc_start(); |
213 | |||
214 | exynos4_delay_timer.read_current_timer = &exynos4_read_current_timer; | ||
215 | exynos4_delay_timer.freq = clk_rate; | ||
216 | register_current_timer_delay(&exynos4_delay_timer); | ||
204 | 217 | ||
205 | if (clocksource_register_hz(&mct_frc, clk_rate)) | 218 | if (clocksource_register_hz(&mct_frc, clk_rate)) |
206 | panic("%s: can't register clocksource\n", mct_frc.name); | 219 | panic("%s: can't register clocksource\n", mct_frc.name); |
diff --git a/drivers/cpufreq/Kconfig b/drivers/cpufreq/Kconfig index e473d6555f96..ffe350f86bca 100644 --- a/drivers/cpufreq/Kconfig +++ b/drivers/cpufreq/Kconfig | |||
@@ -186,6 +186,8 @@ config CPU_FREQ_GOV_CONSERVATIVE | |||
186 | config GENERIC_CPUFREQ_CPU0 | 186 | config GENERIC_CPUFREQ_CPU0 |
187 | tristate "Generic CPU0 cpufreq driver" | 187 | tristate "Generic CPU0 cpufreq driver" |
188 | depends on HAVE_CLK && OF | 188 | depends on HAVE_CLK && OF |
189 | # if CPU_THERMAL is on and THERMAL=m, CPU0 cannot be =y: | ||
190 | depends on !CPU_THERMAL || THERMAL | ||
189 | select PM_OPP | 191 | select PM_OPP |
190 | help | 192 | help |
191 | This adds a generic cpufreq driver for CPU0 frequency management. | 193 | This adds a generic cpufreq driver for CPU0 frequency management. |
diff --git a/drivers/cpufreq/Makefile b/drivers/cpufreq/Makefile index 738c8b7b17dc..db6d9a2fea4d 100644 --- a/drivers/cpufreq/Makefile +++ b/drivers/cpufreq/Makefile | |||
@@ -49,7 +49,7 @@ obj-$(CONFIG_ARM_BIG_LITTLE_CPUFREQ) += arm_big_little.o | |||
49 | # LITTLE drivers, so that it is probed last. | 49 | # LITTLE drivers, so that it is probed last. |
50 | obj-$(CONFIG_ARM_DT_BL_CPUFREQ) += arm_big_little_dt.o | 50 | obj-$(CONFIG_ARM_DT_BL_CPUFREQ) += arm_big_little_dt.o |
51 | 51 | ||
52 | obj-$(CONFIG_ARCH_DAVINCI_DA850) += davinci-cpufreq.o | 52 | obj-$(CONFIG_ARCH_DAVINCI) += davinci-cpufreq.o |
53 | obj-$(CONFIG_UX500_SOC_DB8500) += dbx500-cpufreq.o | 53 | obj-$(CONFIG_UX500_SOC_DB8500) += dbx500-cpufreq.o |
54 | obj-$(CONFIG_ARM_EXYNOS_CPUFREQ) += exynos-cpufreq.o | 54 | obj-$(CONFIG_ARM_EXYNOS_CPUFREQ) += exynos-cpufreq.o |
55 | obj-$(CONFIG_ARM_EXYNOS4210_CPUFREQ) += exynos4210-cpufreq.o | 55 | obj-$(CONFIG_ARM_EXYNOS4210_CPUFREQ) += exynos4210-cpufreq.o |
diff --git a/drivers/cpufreq/cpufreq.c b/drivers/cpufreq/cpufreq.c index aed2b0cb83dc..62259d27f03e 100644 --- a/drivers/cpufreq/cpufreq.c +++ b/drivers/cpufreq/cpufreq.c | |||
@@ -2242,10 +2242,8 @@ int cpufreq_update_policy(unsigned int cpu) | |||
2242 | struct cpufreq_policy new_policy; | 2242 | struct cpufreq_policy new_policy; |
2243 | int ret; | 2243 | int ret; |
2244 | 2244 | ||
2245 | if (!policy) { | 2245 | if (!policy) |
2246 | ret = -ENODEV; | 2246 | return -ENODEV; |
2247 | goto no_policy; | ||
2248 | } | ||
2249 | 2247 | ||
2250 | down_write(&policy->rwsem); | 2248 | down_write(&policy->rwsem); |
2251 | 2249 | ||
@@ -2264,7 +2262,7 @@ int cpufreq_update_policy(unsigned int cpu) | |||
2264 | new_policy.cur = cpufreq_driver->get(cpu); | 2262 | new_policy.cur = cpufreq_driver->get(cpu); |
2265 | if (WARN_ON(!new_policy.cur)) { | 2263 | if (WARN_ON(!new_policy.cur)) { |
2266 | ret = -EIO; | 2264 | ret = -EIO; |
2267 | goto no_policy; | 2265 | goto unlock; |
2268 | } | 2266 | } |
2269 | 2267 | ||
2270 | if (!policy->cur) { | 2268 | if (!policy->cur) { |
@@ -2279,10 +2277,10 @@ int cpufreq_update_policy(unsigned int cpu) | |||
2279 | 2277 | ||
2280 | ret = cpufreq_set_policy(policy, &new_policy); | 2278 | ret = cpufreq_set_policy(policy, &new_policy); |
2281 | 2279 | ||
2280 | unlock: | ||
2282 | up_write(&policy->rwsem); | 2281 | up_write(&policy->rwsem); |
2283 | 2282 | ||
2284 | cpufreq_cpu_put(policy); | 2283 | cpufreq_cpu_put(policy); |
2285 | no_policy: | ||
2286 | return ret; | 2284 | return ret; |
2287 | } | 2285 | } |
2288 | EXPORT_SYMBOL(cpufreq_update_policy); | 2286 | EXPORT_SYMBOL(cpufreq_update_policy); |
diff --git a/drivers/cpufreq/intel_pstate.c b/drivers/cpufreq/intel_pstate.c index 4e7f492ad583..86631cb6f7de 100644 --- a/drivers/cpufreq/intel_pstate.c +++ b/drivers/cpufreq/intel_pstate.c | |||
@@ -128,6 +128,7 @@ static struct pstate_funcs pstate_funcs; | |||
128 | 128 | ||
129 | struct perf_limits { | 129 | struct perf_limits { |
130 | int no_turbo; | 130 | int no_turbo; |
131 | int turbo_disabled; | ||
131 | int max_perf_pct; | 132 | int max_perf_pct; |
132 | int min_perf_pct; | 133 | int min_perf_pct; |
133 | int32_t max_perf; | 134 | int32_t max_perf; |
@@ -196,10 +197,7 @@ static signed int pid_calc(struct _pid *pid, int32_t busy) | |||
196 | pid->last_err = fp_error; | 197 | pid->last_err = fp_error; |
197 | 198 | ||
198 | result = pterm + mul_fp(pid->integral, pid->i_gain) + dterm; | 199 | result = pterm + mul_fp(pid->integral, pid->i_gain) + dterm; |
199 | if (result >= 0) | 200 | result = result + (1 << (FRAC_BITS-1)); |
200 | result = result + (1 << (FRAC_BITS-1)); | ||
201 | else | ||
202 | result = result - (1 << (FRAC_BITS-1)); | ||
203 | return (signed int)fp_toint(result); | 201 | return (signed int)fp_toint(result); |
204 | } | 202 | } |
205 | 203 | ||
@@ -290,7 +288,10 @@ static ssize_t store_no_turbo(struct kobject *a, struct attribute *b, | |||
290 | if (ret != 1) | 288 | if (ret != 1) |
291 | return -EINVAL; | 289 | return -EINVAL; |
292 | limits.no_turbo = clamp_t(int, input, 0 , 1); | 290 | limits.no_turbo = clamp_t(int, input, 0 , 1); |
293 | 291 | if (limits.turbo_disabled) { | |
292 | pr_warn("Turbo disabled by BIOS or unavailable on processor\n"); | ||
293 | limits.no_turbo = limits.turbo_disabled; | ||
294 | } | ||
294 | return count; | 295 | return count; |
295 | } | 296 | } |
296 | 297 | ||
@@ -360,21 +361,21 @@ static int byt_get_min_pstate(void) | |||
360 | { | 361 | { |
361 | u64 value; | 362 | u64 value; |
362 | rdmsrl(BYT_RATIOS, value); | 363 | rdmsrl(BYT_RATIOS, value); |
363 | return (value >> 8) & 0x3F; | 364 | return (value >> 8) & 0x7F; |
364 | } | 365 | } |
365 | 366 | ||
366 | static int byt_get_max_pstate(void) | 367 | static int byt_get_max_pstate(void) |
367 | { | 368 | { |
368 | u64 value; | 369 | u64 value; |
369 | rdmsrl(BYT_RATIOS, value); | 370 | rdmsrl(BYT_RATIOS, value); |
370 | return (value >> 16) & 0x3F; | 371 | return (value >> 16) & 0x7F; |
371 | } | 372 | } |
372 | 373 | ||
373 | static int byt_get_turbo_pstate(void) | 374 | static int byt_get_turbo_pstate(void) |
374 | { | 375 | { |
375 | u64 value; | 376 | u64 value; |
376 | rdmsrl(BYT_TURBO_RATIOS, value); | 377 | rdmsrl(BYT_TURBO_RATIOS, value); |
377 | return value & 0x3F; | 378 | return value & 0x7F; |
378 | } | 379 | } |
379 | 380 | ||
380 | static void byt_set_pstate(struct cpudata *cpudata, int pstate) | 381 | static void byt_set_pstate(struct cpudata *cpudata, int pstate) |
@@ -384,7 +385,7 @@ static void byt_set_pstate(struct cpudata *cpudata, int pstate) | |||
384 | u32 vid; | 385 | u32 vid; |
385 | 386 | ||
386 | val = pstate << 8; | 387 | val = pstate << 8; |
387 | if (limits.no_turbo) | 388 | if (limits.no_turbo && !limits.turbo_disabled) |
388 | val |= (u64)1 << 32; | 389 | val |= (u64)1 << 32; |
389 | 390 | ||
390 | vid_fp = cpudata->vid.min + mul_fp( | 391 | vid_fp = cpudata->vid.min + mul_fp( |
@@ -408,8 +409,8 @@ static void byt_get_vid(struct cpudata *cpudata) | |||
408 | 409 | ||
409 | 410 | ||
410 | rdmsrl(BYT_VIDS, value); | 411 | rdmsrl(BYT_VIDS, value); |
411 | cpudata->vid.min = int_tofp((value >> 8) & 0x3f); | 412 | cpudata->vid.min = int_tofp((value >> 8) & 0x7f); |
412 | cpudata->vid.max = int_tofp((value >> 16) & 0x3f); | 413 | cpudata->vid.max = int_tofp((value >> 16) & 0x7f); |
413 | cpudata->vid.ratio = div_fp( | 414 | cpudata->vid.ratio = div_fp( |
414 | cpudata->vid.max - cpudata->vid.min, | 415 | cpudata->vid.max - cpudata->vid.min, |
415 | int_tofp(cpudata->pstate.max_pstate - | 416 | int_tofp(cpudata->pstate.max_pstate - |
@@ -451,7 +452,7 @@ static void core_set_pstate(struct cpudata *cpudata, int pstate) | |||
451 | u64 val; | 452 | u64 val; |
452 | 453 | ||
453 | val = pstate << 8; | 454 | val = pstate << 8; |
454 | if (limits.no_turbo) | 455 | if (limits.no_turbo && !limits.turbo_disabled) |
455 | val |= (u64)1 << 32; | 456 | val |= (u64)1 << 32; |
456 | 457 | ||
457 | wrmsrl_on_cpu(cpudata->cpu, MSR_IA32_PERF_CTL, val); | 458 | wrmsrl_on_cpu(cpudata->cpu, MSR_IA32_PERF_CTL, val); |
@@ -699,9 +700,8 @@ static int intel_pstate_init_cpu(unsigned int cpunum) | |||
699 | 700 | ||
700 | cpu = all_cpu_data[cpunum]; | 701 | cpu = all_cpu_data[cpunum]; |
701 | 702 | ||
702 | intel_pstate_get_cpu_pstates(cpu); | ||
703 | |||
704 | cpu->cpu = cpunum; | 703 | cpu->cpu = cpunum; |
704 | intel_pstate_get_cpu_pstates(cpu); | ||
705 | 705 | ||
706 | init_timer_deferrable(&cpu->timer); | 706 | init_timer_deferrable(&cpu->timer); |
707 | cpu->timer.function = intel_pstate_timer_func; | 707 | cpu->timer.function = intel_pstate_timer_func; |
@@ -744,7 +744,7 @@ static int intel_pstate_set_policy(struct cpufreq_policy *policy) | |||
744 | limits.min_perf = int_tofp(1); | 744 | limits.min_perf = int_tofp(1); |
745 | limits.max_perf_pct = 100; | 745 | limits.max_perf_pct = 100; |
746 | limits.max_perf = int_tofp(1); | 746 | limits.max_perf = int_tofp(1); |
747 | limits.no_turbo = 0; | 747 | limits.no_turbo = limits.turbo_disabled; |
748 | return 0; | 748 | return 0; |
749 | } | 749 | } |
750 | limits.min_perf_pct = (policy->min * 100) / policy->cpuinfo.max_freq; | 750 | limits.min_perf_pct = (policy->min * 100) / policy->cpuinfo.max_freq; |
@@ -787,6 +787,7 @@ static int intel_pstate_cpu_init(struct cpufreq_policy *policy) | |||
787 | { | 787 | { |
788 | struct cpudata *cpu; | 788 | struct cpudata *cpu; |
789 | int rc; | 789 | int rc; |
790 | u64 misc_en; | ||
790 | 791 | ||
791 | rc = intel_pstate_init_cpu(policy->cpu); | 792 | rc = intel_pstate_init_cpu(policy->cpu); |
792 | if (rc) | 793 | if (rc) |
@@ -794,8 +795,13 @@ static int intel_pstate_cpu_init(struct cpufreq_policy *policy) | |||
794 | 795 | ||
795 | cpu = all_cpu_data[policy->cpu]; | 796 | cpu = all_cpu_data[policy->cpu]; |
796 | 797 | ||
797 | if (!limits.no_turbo && | 798 | rdmsrl(MSR_IA32_MISC_ENABLE, misc_en); |
798 | limits.min_perf_pct == 100 && limits.max_perf_pct == 100) | 799 | if (misc_en & MSR_IA32_MISC_ENABLE_TURBO_DISABLE || |
800 | cpu->pstate.max_pstate == cpu->pstate.turbo_pstate) { | ||
801 | limits.turbo_disabled = 1; | ||
802 | limits.no_turbo = 1; | ||
803 | } | ||
804 | if (limits.min_perf_pct == 100 && limits.max_perf_pct == 100) | ||
799 | policy->policy = CPUFREQ_POLICY_PERFORMANCE; | 805 | policy->policy = CPUFREQ_POLICY_PERFORMANCE; |
800 | else | 806 | else |
801 | policy->policy = CPUFREQ_POLICY_POWERSAVE; | 807 | policy->policy = CPUFREQ_POLICY_POWERSAVE; |
diff --git a/drivers/cpuidle/cpuidle-armada-370-xp.c b/drivers/cpuidle/cpuidle-armada-370-xp.c index 28587d0f3947..a5fba0287bfb 100644 --- a/drivers/cpuidle/cpuidle-armada-370-xp.c +++ b/drivers/cpuidle/cpuidle-armada-370-xp.c | |||
@@ -55,7 +55,7 @@ static struct cpuidle_driver armada_370_xp_idle_driver = { | |||
55 | .power_usage = 50, | 55 | .power_usage = 50, |
56 | .target_residency = 100, | 56 | .target_residency = 100, |
57 | .flags = CPUIDLE_FLAG_TIME_VALID, | 57 | .flags = CPUIDLE_FLAG_TIME_VALID, |
58 | .name = "MV CPU IDLE", | 58 | .name = "Idle", |
59 | .desc = "CPU power down", | 59 | .desc = "CPU power down", |
60 | }, | 60 | }, |
61 | .states[2] = { | 61 | .states[2] = { |
@@ -65,7 +65,7 @@ static struct cpuidle_driver armada_370_xp_idle_driver = { | |||
65 | .target_residency = 1000, | 65 | .target_residency = 1000, |
66 | .flags = CPUIDLE_FLAG_TIME_VALID | | 66 | .flags = CPUIDLE_FLAG_TIME_VALID | |
67 | ARMADA_370_XP_FLAG_DEEP_IDLE, | 67 | ARMADA_370_XP_FLAG_DEEP_IDLE, |
68 | .name = "MV CPU DEEP IDLE", | 68 | .name = "Deep idle", |
69 | .desc = "CPU and L2 Fabric power down", | 69 | .desc = "CPU and L2 Fabric power down", |
70 | }, | 70 | }, |
71 | .state_count = ARMADA_370_XP_MAX_STATES, | 71 | .state_count = ARMADA_370_XP_MAX_STATES, |
diff --git a/drivers/crypto/caam/jr.c b/drivers/crypto/caam/jr.c index 1d80bd3636c5..b512a4ba7569 100644 --- a/drivers/crypto/caam/jr.c +++ b/drivers/crypto/caam/jr.c | |||
@@ -453,8 +453,8 @@ static int caam_jr_probe(struct platform_device *pdev) | |||
453 | int error; | 453 | int error; |
454 | 454 | ||
455 | jrdev = &pdev->dev; | 455 | jrdev = &pdev->dev; |
456 | jrpriv = kmalloc(sizeof(struct caam_drv_private_jr), | 456 | jrpriv = devm_kmalloc(jrdev, sizeof(struct caam_drv_private_jr), |
457 | GFP_KERNEL); | 457 | GFP_KERNEL); |
458 | if (!jrpriv) | 458 | if (!jrpriv) |
459 | return -ENOMEM; | 459 | return -ENOMEM; |
460 | 460 | ||
@@ -487,10 +487,8 @@ static int caam_jr_probe(struct platform_device *pdev) | |||
487 | 487 | ||
488 | /* Now do the platform independent part */ | 488 | /* Now do the platform independent part */ |
489 | error = caam_jr_init(jrdev); /* now turn on hardware */ | 489 | error = caam_jr_init(jrdev); /* now turn on hardware */ |
490 | if (error) { | 490 | if (error) |
491 | kfree(jrpriv); | ||
492 | return error; | 491 | return error; |
493 | } | ||
494 | 492 | ||
495 | jrpriv->dev = jrdev; | 493 | jrpriv->dev = jrdev; |
496 | spin_lock(&driver_data.jr_alloc_lock); | 494 | spin_lock(&driver_data.jr_alloc_lock); |
diff --git a/drivers/dma/cppi41.c b/drivers/dma/cppi41.c index d028f36ae655..8f8b0b608875 100644 --- a/drivers/dma/cppi41.c +++ b/drivers/dma/cppi41.c | |||
@@ -86,6 +86,9 @@ | |||
86 | 86 | ||
87 | #define USBSS_IRQ_PD_COMP (1 << 2) | 87 | #define USBSS_IRQ_PD_COMP (1 << 2) |
88 | 88 | ||
89 | /* Packet Descriptor */ | ||
90 | #define PD2_ZERO_LENGTH (1 << 19) | ||
91 | |||
89 | struct cppi41_channel { | 92 | struct cppi41_channel { |
90 | struct dma_chan chan; | 93 | struct dma_chan chan; |
91 | struct dma_async_tx_descriptor txd; | 94 | struct dma_async_tx_descriptor txd; |
@@ -307,7 +310,7 @@ static irqreturn_t cppi41_irq(int irq, void *data) | |||
307 | __iormb(); | 310 | __iormb(); |
308 | 311 | ||
309 | while (val) { | 312 | while (val) { |
310 | u32 desc; | 313 | u32 desc, len; |
311 | 314 | ||
312 | q_num = __fls(val); | 315 | q_num = __fls(val); |
313 | val &= ~(1 << q_num); | 316 | val &= ~(1 << q_num); |
@@ -319,9 +322,13 @@ static irqreturn_t cppi41_irq(int irq, void *data) | |||
319 | q_num, desc); | 322 | q_num, desc); |
320 | continue; | 323 | continue; |
321 | } | 324 | } |
322 | c->residue = pd_trans_len(c->desc->pd6) - | ||
323 | pd_trans_len(c->desc->pd0); | ||
324 | 325 | ||
326 | if (c->desc->pd2 & PD2_ZERO_LENGTH) | ||
327 | len = 0; | ||
328 | else | ||
329 | len = pd_trans_len(c->desc->pd0); | ||
330 | |||
331 | c->residue = pd_trans_len(c->desc->pd6) - len; | ||
325 | dma_cookie_complete(&c->txd); | 332 | dma_cookie_complete(&c->txd); |
326 | c->txd.callback(c->txd.callback_param); | 333 | c->txd.callback(c->txd.callback_param); |
327 | } | 334 | } |
diff --git a/drivers/dma/imx-sdma.c b/drivers/dma/imx-sdma.c index 128714622bf5..14867e3ac8ff 100644 --- a/drivers/dma/imx-sdma.c +++ b/drivers/dma/imx-sdma.c | |||
@@ -255,6 +255,7 @@ struct sdma_channel { | |||
255 | enum dma_slave_buswidth word_size; | 255 | enum dma_slave_buswidth word_size; |
256 | unsigned int buf_tail; | 256 | unsigned int buf_tail; |
257 | unsigned int num_bd; | 257 | unsigned int num_bd; |
258 | unsigned int period_len; | ||
258 | struct sdma_buffer_descriptor *bd; | 259 | struct sdma_buffer_descriptor *bd; |
259 | dma_addr_t bd_phys; | 260 | dma_addr_t bd_phys; |
260 | unsigned int pc_from_device, pc_to_device; | 261 | unsigned int pc_from_device, pc_to_device; |
@@ -593,6 +594,12 @@ static void sdma_event_disable(struct sdma_channel *sdmac, unsigned int event) | |||
593 | 594 | ||
594 | static void sdma_handle_channel_loop(struct sdma_channel *sdmac) | 595 | static void sdma_handle_channel_loop(struct sdma_channel *sdmac) |
595 | { | 596 | { |
597 | if (sdmac->desc.callback) | ||
598 | sdmac->desc.callback(sdmac->desc.callback_param); | ||
599 | } | ||
600 | |||
601 | static void sdma_update_channel_loop(struct sdma_channel *sdmac) | ||
602 | { | ||
596 | struct sdma_buffer_descriptor *bd; | 603 | struct sdma_buffer_descriptor *bd; |
597 | 604 | ||
598 | /* | 605 | /* |
@@ -611,9 +618,6 @@ static void sdma_handle_channel_loop(struct sdma_channel *sdmac) | |||
611 | bd->mode.status |= BD_DONE; | 618 | bd->mode.status |= BD_DONE; |
612 | sdmac->buf_tail++; | 619 | sdmac->buf_tail++; |
613 | sdmac->buf_tail %= sdmac->num_bd; | 620 | sdmac->buf_tail %= sdmac->num_bd; |
614 | |||
615 | if (sdmac->desc.callback) | ||
616 | sdmac->desc.callback(sdmac->desc.callback_param); | ||
617 | } | 621 | } |
618 | } | 622 | } |
619 | 623 | ||
@@ -669,6 +673,9 @@ static irqreturn_t sdma_int_handler(int irq, void *dev_id) | |||
669 | int channel = fls(stat) - 1; | 673 | int channel = fls(stat) - 1; |
670 | struct sdma_channel *sdmac = &sdma->channel[channel]; | 674 | struct sdma_channel *sdmac = &sdma->channel[channel]; |
671 | 675 | ||
676 | if (sdmac->flags & IMX_DMA_SG_LOOP) | ||
677 | sdma_update_channel_loop(sdmac); | ||
678 | |||
672 | tasklet_schedule(&sdmac->tasklet); | 679 | tasklet_schedule(&sdmac->tasklet); |
673 | 680 | ||
674 | __clear_bit(channel, &stat); | 681 | __clear_bit(channel, &stat); |
@@ -1129,6 +1136,7 @@ static struct dma_async_tx_descriptor *sdma_prep_dma_cyclic( | |||
1129 | sdmac->status = DMA_IN_PROGRESS; | 1136 | sdmac->status = DMA_IN_PROGRESS; |
1130 | 1137 | ||
1131 | sdmac->buf_tail = 0; | 1138 | sdmac->buf_tail = 0; |
1139 | sdmac->period_len = period_len; | ||
1132 | 1140 | ||
1133 | sdmac->flags |= IMX_DMA_SG_LOOP; | 1141 | sdmac->flags |= IMX_DMA_SG_LOOP; |
1134 | sdmac->direction = direction; | 1142 | sdmac->direction = direction; |
@@ -1225,9 +1233,15 @@ static enum dma_status sdma_tx_status(struct dma_chan *chan, | |||
1225 | struct dma_tx_state *txstate) | 1233 | struct dma_tx_state *txstate) |
1226 | { | 1234 | { |
1227 | struct sdma_channel *sdmac = to_sdma_chan(chan); | 1235 | struct sdma_channel *sdmac = to_sdma_chan(chan); |
1236 | u32 residue; | ||
1237 | |||
1238 | if (sdmac->flags & IMX_DMA_SG_LOOP) | ||
1239 | residue = (sdmac->num_bd - sdmac->buf_tail) * sdmac->period_len; | ||
1240 | else | ||
1241 | residue = sdmac->chn_count - sdmac->chn_real_count; | ||
1228 | 1242 | ||
1229 | dma_set_tx_state(txstate, chan->completed_cookie, chan->cookie, | 1243 | dma_set_tx_state(txstate, chan->completed_cookie, chan->cookie, |
1230 | sdmac->chn_count - sdmac->chn_real_count); | 1244 | residue); |
1231 | 1245 | ||
1232 | return sdmac->status; | 1246 | return sdmac->status; |
1233 | } | 1247 | } |
diff --git a/drivers/firmware/efi/efi-pstore.c b/drivers/firmware/efi/efi-pstore.c index 4b9dc836dcf9..e992abc5ef26 100644 --- a/drivers/firmware/efi/efi-pstore.c +++ b/drivers/firmware/efi/efi-pstore.c | |||
@@ -40,7 +40,7 @@ struct pstore_read_data { | |||
40 | static inline u64 generic_id(unsigned long timestamp, | 40 | static inline u64 generic_id(unsigned long timestamp, |
41 | unsigned int part, int count) | 41 | unsigned int part, int count) |
42 | { | 42 | { |
43 | return (timestamp * 100 + part) * 1000 + count; | 43 | return ((u64) timestamp * 100 + part) * 1000 + count; |
44 | } | 44 | } |
45 | 45 | ||
46 | static int efi_pstore_read_func(struct efivar_entry *entry, void *data) | 46 | static int efi_pstore_read_func(struct efivar_entry *entry, void *data) |
diff --git a/drivers/firmware/efi/efi.c b/drivers/firmware/efi/efi.c index cd36deb619fa..eff1a2f22f09 100644 --- a/drivers/firmware/efi/efi.c +++ b/drivers/firmware/efi/efi.c | |||
@@ -353,10 +353,10 @@ static int __init fdt_find_uefi_params(unsigned long node, const char *uname, | |||
353 | int depth, void *data) | 353 | int depth, void *data) |
354 | { | 354 | { |
355 | struct param_info *info = data; | 355 | struct param_info *info = data; |
356 | void *prop, *dest; | 356 | const void *prop; |
357 | unsigned long len; | 357 | void *dest; |
358 | u64 val; | 358 | u64 val; |
359 | int i; | 359 | int i, len; |
360 | 360 | ||
361 | if (depth != 1 || | 361 | if (depth != 1 || |
362 | (strcmp(uname, "chosen") != 0 && strcmp(uname, "chosen@0") != 0)) | 362 | (strcmp(uname, "chosen") != 0 && strcmp(uname, "chosen@0") != 0)) |
diff --git a/drivers/firmware/efi/fdt.c b/drivers/firmware/efi/fdt.c index 5c6a8e8a9580..82d774161cc9 100644 --- a/drivers/firmware/efi/fdt.c +++ b/drivers/firmware/efi/fdt.c | |||
@@ -63,7 +63,7 @@ static efi_status_t update_fdt(efi_system_table_t *sys_table, void *orig_fdt, | |||
63 | */ | 63 | */ |
64 | prev = 0; | 64 | prev = 0; |
65 | for (;;) { | 65 | for (;;) { |
66 | const char *type, *name; | 66 | const char *type; |
67 | int len; | 67 | int len; |
68 | 68 | ||
69 | node = fdt_next_node(fdt, prev, NULL); | 69 | node = fdt_next_node(fdt, prev, NULL); |
diff --git a/drivers/gpu/drm/drm_drv.c b/drivers/gpu/drm/drm_drv.c index 03711d00aaae..8218078b6133 100644 --- a/drivers/gpu/drm/drm_drv.c +++ b/drivers/gpu/drm/drm_drv.c | |||
@@ -419,8 +419,9 @@ long drm_ioctl(struct file *filp, | |||
419 | retcode = -EFAULT; | 419 | retcode = -EFAULT; |
420 | goto err_i1; | 420 | goto err_i1; |
421 | } | 421 | } |
422 | } else | 422 | } else if (cmd & IOC_OUT) { |
423 | memset(kdata, 0, usize); | 423 | memset(kdata, 0, usize); |
424 | } | ||
424 | 425 | ||
425 | if (ioctl->flags & DRM_UNLOCKED) | 426 | if (ioctl->flags & DRM_UNLOCKED) |
426 | retcode = func(dev, kdata, file_priv); | 427 | retcode = func(dev, kdata, file_priv); |
diff --git a/drivers/gpu/drm/drm_modeset_lock.c b/drivers/gpu/drm/drm_modeset_lock.c index 7c2497dea1e9..0dc57d5ecd10 100644 --- a/drivers/gpu/drm/drm_modeset_lock.c +++ b/drivers/gpu/drm/drm_modeset_lock.c | |||
@@ -64,6 +64,7 @@ | |||
64 | void drm_modeset_acquire_init(struct drm_modeset_acquire_ctx *ctx, | 64 | void drm_modeset_acquire_init(struct drm_modeset_acquire_ctx *ctx, |
65 | uint32_t flags) | 65 | uint32_t flags) |
66 | { | 66 | { |
67 | memset(ctx, 0, sizeof(*ctx)); | ||
67 | ww_acquire_init(&ctx->ww_ctx, &crtc_ww_class); | 68 | ww_acquire_init(&ctx->ww_ctx, &crtc_ww_class); |
68 | INIT_LIST_HEAD(&ctx->locked); | 69 | INIT_LIST_HEAD(&ctx->locked); |
69 | } | 70 | } |
diff --git a/drivers/gpu/drm/exynos/exynos_drm_dpi.c b/drivers/gpu/drm/exynos/exynos_drm_dpi.c index 482127f633c5..9e530f205ad2 100644 --- a/drivers/gpu/drm/exynos/exynos_drm_dpi.c +++ b/drivers/gpu/drm/exynos/exynos_drm_dpi.c | |||
@@ -40,7 +40,7 @@ exynos_dpi_detect(struct drm_connector *connector, bool force) | |||
40 | { | 40 | { |
41 | struct exynos_dpi *ctx = connector_to_dpi(connector); | 41 | struct exynos_dpi *ctx = connector_to_dpi(connector); |
42 | 42 | ||
43 | if (!ctx->panel->connector) | 43 | if (ctx->panel && !ctx->panel->connector) |
44 | drm_panel_attach(ctx->panel, &ctx->connector); | 44 | drm_panel_attach(ctx->panel, &ctx->connector); |
45 | 45 | ||
46 | return connector_status_connected; | 46 | return connector_status_connected; |
diff --git a/drivers/gpu/drm/exynos/exynos_drm_drv.c b/drivers/gpu/drm/exynos/exynos_drm_drv.c index d91f27777537..ab7d182063c3 100644 --- a/drivers/gpu/drm/exynos/exynos_drm_drv.c +++ b/drivers/gpu/drm/exynos/exynos_drm_drv.c | |||
@@ -765,24 +765,24 @@ static int exynos_drm_init(void) | |||
765 | 765 | ||
766 | return 0; | 766 | return 0; |
767 | 767 | ||
768 | err_unregister_pd: | ||
769 | platform_device_unregister(exynos_drm_pdev); | ||
770 | |||
771 | err_remove_vidi: | 768 | err_remove_vidi: |
772 | #ifdef CONFIG_DRM_EXYNOS_VIDI | 769 | #ifdef CONFIG_DRM_EXYNOS_VIDI |
773 | exynos_drm_remove_vidi(); | 770 | exynos_drm_remove_vidi(); |
771 | |||
772 | err_unregister_pd: | ||
774 | #endif | 773 | #endif |
774 | platform_device_unregister(exynos_drm_pdev); | ||
775 | 775 | ||
776 | return ret; | 776 | return ret; |
777 | } | 777 | } |
778 | 778 | ||
779 | static void exynos_drm_exit(void) | 779 | static void exynos_drm_exit(void) |
780 | { | 780 | { |
781 | platform_driver_unregister(&exynos_drm_platform_driver); | ||
781 | #ifdef CONFIG_DRM_EXYNOS_VIDI | 782 | #ifdef CONFIG_DRM_EXYNOS_VIDI |
782 | exynos_drm_remove_vidi(); | 783 | exynos_drm_remove_vidi(); |
783 | #endif | 784 | #endif |
784 | platform_device_unregister(exynos_drm_pdev); | 785 | platform_device_unregister(exynos_drm_pdev); |
785 | platform_driver_unregister(&exynos_drm_platform_driver); | ||
786 | } | 786 | } |
787 | 787 | ||
788 | module_init(exynos_drm_init); | 788 | module_init(exynos_drm_init); |
diff --git a/drivers/gpu/drm/exynos/exynos_drm_drv.h b/drivers/gpu/drm/exynos/exynos_drm_drv.h index 36535f398848..06cde4506278 100644 --- a/drivers/gpu/drm/exynos/exynos_drm_drv.h +++ b/drivers/gpu/drm/exynos/exynos_drm_drv.h | |||
@@ -343,7 +343,7 @@ struct exynos_drm_display * exynos_dpi_probe(struct device *dev); | |||
343 | int exynos_dpi_remove(struct device *dev); | 343 | int exynos_dpi_remove(struct device *dev); |
344 | #else | 344 | #else |
345 | static inline struct exynos_drm_display * | 345 | static inline struct exynos_drm_display * |
346 | exynos_dpi_probe(struct device *dev) { return 0; } | 346 | exynos_dpi_probe(struct device *dev) { return NULL; } |
347 | static inline int exynos_dpi_remove(struct device *dev) { return 0; } | 347 | static inline int exynos_dpi_remove(struct device *dev) { return 0; } |
348 | #endif | 348 | #endif |
349 | 349 | ||
diff --git a/drivers/gpu/drm/exynos/exynos_drm_fimd.c b/drivers/gpu/drm/exynos/exynos_drm_fimd.c index bb45ab2e7384..33161ad38201 100644 --- a/drivers/gpu/drm/exynos/exynos_drm_fimd.c +++ b/drivers/gpu/drm/exynos/exynos_drm_fimd.c | |||
@@ -741,6 +741,8 @@ static void fimd_apply(struct exynos_drm_manager *mgr) | |||
741 | win_data = &ctx->win_data[i]; | 741 | win_data = &ctx->win_data[i]; |
742 | if (win_data->enabled) | 742 | if (win_data->enabled) |
743 | fimd_win_commit(mgr, i); | 743 | fimd_win_commit(mgr, i); |
744 | else | ||
745 | fimd_win_disable(mgr, i); | ||
744 | } | 746 | } |
745 | 747 | ||
746 | fimd_commit(mgr); | 748 | fimd_commit(mgr); |
diff --git a/drivers/gpu/drm/exynos/exynos_hdmi.c b/drivers/gpu/drm/exynos/exynos_hdmi.c index c104d0c9b385..aa259b0a873a 100644 --- a/drivers/gpu/drm/exynos/exynos_hdmi.c +++ b/drivers/gpu/drm/exynos/exynos_hdmi.c | |||
@@ -2090,6 +2090,11 @@ out: | |||
2090 | 2090 | ||
2091 | static void hdmi_dpms(struct exynos_drm_display *display, int mode) | 2091 | static void hdmi_dpms(struct exynos_drm_display *display, int mode) |
2092 | { | 2092 | { |
2093 | struct hdmi_context *hdata = display->ctx; | ||
2094 | struct drm_encoder *encoder = hdata->encoder; | ||
2095 | struct drm_crtc *crtc = encoder->crtc; | ||
2096 | struct drm_crtc_helper_funcs *funcs = NULL; | ||
2097 | |||
2093 | DRM_DEBUG_KMS("mode %d\n", mode); | 2098 | DRM_DEBUG_KMS("mode %d\n", mode); |
2094 | 2099 | ||
2095 | switch (mode) { | 2100 | switch (mode) { |
@@ -2099,6 +2104,20 @@ static void hdmi_dpms(struct exynos_drm_display *display, int mode) | |||
2099 | case DRM_MODE_DPMS_STANDBY: | 2104 | case DRM_MODE_DPMS_STANDBY: |
2100 | case DRM_MODE_DPMS_SUSPEND: | 2105 | case DRM_MODE_DPMS_SUSPEND: |
2101 | case DRM_MODE_DPMS_OFF: | 2106 | case DRM_MODE_DPMS_OFF: |
2107 | /* | ||
2108 | * The SFRs of VP and Mixer are updated by Vertical Sync of | ||
2109 | * Timing generator which is a part of HDMI so the sequence | ||
2110 | * to disable TV Subsystem should be as following, | ||
2111 | * VP -> Mixer -> HDMI | ||
2112 | * | ||
2113 | * Below codes will try to disable Mixer and VP(if used) | ||
2114 | * prior to disabling HDMI. | ||
2115 | */ | ||
2116 | if (crtc) | ||
2117 | funcs = crtc->helper_private; | ||
2118 | if (funcs && funcs->dpms) | ||
2119 | (*funcs->dpms)(crtc, mode); | ||
2120 | |||
2102 | hdmi_poweroff(display); | 2121 | hdmi_poweroff(display); |
2103 | break; | 2122 | break; |
2104 | default: | 2123 | default: |
diff --git a/drivers/gpu/drm/exynos/exynos_mixer.c b/drivers/gpu/drm/exynos/exynos_mixer.c index 4c5aed7e54c8..7529946d0a74 100644 --- a/drivers/gpu/drm/exynos/exynos_mixer.c +++ b/drivers/gpu/drm/exynos/exynos_mixer.c | |||
@@ -377,6 +377,20 @@ static void mixer_run(struct mixer_context *ctx) | |||
377 | mixer_regs_dump(ctx); | 377 | mixer_regs_dump(ctx); |
378 | } | 378 | } |
379 | 379 | ||
380 | static void mixer_stop(struct mixer_context *ctx) | ||
381 | { | ||
382 | struct mixer_resources *res = &ctx->mixer_res; | ||
383 | int timeout = 20; | ||
384 | |||
385 | mixer_reg_writemask(res, MXR_STATUS, 0, MXR_STATUS_REG_RUN); | ||
386 | |||
387 | while (!(mixer_reg_read(res, MXR_STATUS) & MXR_STATUS_REG_IDLE) && | ||
388 | --timeout) | ||
389 | usleep_range(10000, 12000); | ||
390 | |||
391 | mixer_regs_dump(ctx); | ||
392 | } | ||
393 | |||
380 | static void vp_video_buffer(struct mixer_context *ctx, int win) | 394 | static void vp_video_buffer(struct mixer_context *ctx, int win) |
381 | { | 395 | { |
382 | struct mixer_resources *res = &ctx->mixer_res; | 396 | struct mixer_resources *res = &ctx->mixer_res; |
@@ -497,13 +511,8 @@ static void vp_video_buffer(struct mixer_context *ctx, int win) | |||
497 | static void mixer_layer_update(struct mixer_context *ctx) | 511 | static void mixer_layer_update(struct mixer_context *ctx) |
498 | { | 512 | { |
499 | struct mixer_resources *res = &ctx->mixer_res; | 513 | struct mixer_resources *res = &ctx->mixer_res; |
500 | u32 val; | ||
501 | |||
502 | val = mixer_reg_read(res, MXR_CFG); | ||
503 | 514 | ||
504 | /* allow one update per vsync only */ | 515 | mixer_reg_writemask(res, MXR_CFG, ~0, MXR_CFG_LAYER_UPDATE); |
505 | if (!(val & MXR_CFG_LAYER_UPDATE_COUNT_MASK)) | ||
506 | mixer_reg_writemask(res, MXR_CFG, ~0, MXR_CFG_LAYER_UPDATE); | ||
507 | } | 516 | } |
508 | 517 | ||
509 | static void mixer_graph_buffer(struct mixer_context *ctx, int win) | 518 | static void mixer_graph_buffer(struct mixer_context *ctx, int win) |
@@ -1010,6 +1019,8 @@ static void mixer_wait_for_vblank(struct exynos_drm_manager *mgr) | |||
1010 | } | 1019 | } |
1011 | mutex_unlock(&mixer_ctx->mixer_mutex); | 1020 | mutex_unlock(&mixer_ctx->mixer_mutex); |
1012 | 1021 | ||
1022 | drm_vblank_get(mgr->crtc->dev, mixer_ctx->pipe); | ||
1023 | |||
1013 | atomic_set(&mixer_ctx->wait_vsync_event, 1); | 1024 | atomic_set(&mixer_ctx->wait_vsync_event, 1); |
1014 | 1025 | ||
1015 | /* | 1026 | /* |
@@ -1020,6 +1031,8 @@ static void mixer_wait_for_vblank(struct exynos_drm_manager *mgr) | |||
1020 | !atomic_read(&mixer_ctx->wait_vsync_event), | 1031 | !atomic_read(&mixer_ctx->wait_vsync_event), |
1021 | HZ/20)) | 1032 | HZ/20)) |
1022 | DRM_DEBUG_KMS("vblank wait timed out.\n"); | 1033 | DRM_DEBUG_KMS("vblank wait timed out.\n"); |
1034 | |||
1035 | drm_vblank_put(mgr->crtc->dev, mixer_ctx->pipe); | ||
1023 | } | 1036 | } |
1024 | 1037 | ||
1025 | static void mixer_window_suspend(struct exynos_drm_manager *mgr) | 1038 | static void mixer_window_suspend(struct exynos_drm_manager *mgr) |
@@ -1061,7 +1074,7 @@ static void mixer_poweron(struct exynos_drm_manager *mgr) | |||
1061 | mutex_unlock(&ctx->mixer_mutex); | 1074 | mutex_unlock(&ctx->mixer_mutex); |
1062 | return; | 1075 | return; |
1063 | } | 1076 | } |
1064 | ctx->powered = true; | 1077 | |
1065 | mutex_unlock(&ctx->mixer_mutex); | 1078 | mutex_unlock(&ctx->mixer_mutex); |
1066 | 1079 | ||
1067 | pm_runtime_get_sync(ctx->dev); | 1080 | pm_runtime_get_sync(ctx->dev); |
@@ -1072,6 +1085,12 @@ static void mixer_poweron(struct exynos_drm_manager *mgr) | |||
1072 | clk_prepare_enable(res->sclk_mixer); | 1085 | clk_prepare_enable(res->sclk_mixer); |
1073 | } | 1086 | } |
1074 | 1087 | ||
1088 | mutex_lock(&ctx->mixer_mutex); | ||
1089 | ctx->powered = true; | ||
1090 | mutex_unlock(&ctx->mixer_mutex); | ||
1091 | |||
1092 | mixer_reg_writemask(res, MXR_STATUS, ~0, MXR_STATUS_SOFT_RESET); | ||
1093 | |||
1075 | mixer_reg_write(res, MXR_INT_EN, ctx->int_en); | 1094 | mixer_reg_write(res, MXR_INT_EN, ctx->int_en); |
1076 | mixer_win_reset(ctx); | 1095 | mixer_win_reset(ctx); |
1077 | 1096 | ||
@@ -1084,14 +1103,21 @@ static void mixer_poweroff(struct exynos_drm_manager *mgr) | |||
1084 | struct mixer_resources *res = &ctx->mixer_res; | 1103 | struct mixer_resources *res = &ctx->mixer_res; |
1085 | 1104 | ||
1086 | mutex_lock(&ctx->mixer_mutex); | 1105 | mutex_lock(&ctx->mixer_mutex); |
1087 | if (!ctx->powered) | 1106 | if (!ctx->powered) { |
1088 | goto out; | 1107 | mutex_unlock(&ctx->mixer_mutex); |
1108 | return; | ||
1109 | } | ||
1089 | mutex_unlock(&ctx->mixer_mutex); | 1110 | mutex_unlock(&ctx->mixer_mutex); |
1090 | 1111 | ||
1112 | mixer_stop(ctx); | ||
1091 | mixer_window_suspend(mgr); | 1113 | mixer_window_suspend(mgr); |
1092 | 1114 | ||
1093 | ctx->int_en = mixer_reg_read(res, MXR_INT_EN); | 1115 | ctx->int_en = mixer_reg_read(res, MXR_INT_EN); |
1094 | 1116 | ||
1117 | mutex_lock(&ctx->mixer_mutex); | ||
1118 | ctx->powered = false; | ||
1119 | mutex_unlock(&ctx->mixer_mutex); | ||
1120 | |||
1095 | clk_disable_unprepare(res->mixer); | 1121 | clk_disable_unprepare(res->mixer); |
1096 | if (ctx->vp_enabled) { | 1122 | if (ctx->vp_enabled) { |
1097 | clk_disable_unprepare(res->vp); | 1123 | clk_disable_unprepare(res->vp); |
@@ -1099,12 +1125,6 @@ static void mixer_poweroff(struct exynos_drm_manager *mgr) | |||
1099 | } | 1125 | } |
1100 | 1126 | ||
1101 | pm_runtime_put_sync(ctx->dev); | 1127 | pm_runtime_put_sync(ctx->dev); |
1102 | |||
1103 | mutex_lock(&ctx->mixer_mutex); | ||
1104 | ctx->powered = false; | ||
1105 | |||
1106 | out: | ||
1107 | mutex_unlock(&ctx->mixer_mutex); | ||
1108 | } | 1128 | } |
1109 | 1129 | ||
1110 | static void mixer_dpms(struct exynos_drm_manager *mgr, int mode) | 1130 | static void mixer_dpms(struct exynos_drm_manager *mgr, int mode) |
diff --git a/drivers/gpu/drm/exynos/regs-mixer.h b/drivers/gpu/drm/exynos/regs-mixer.h index 4537026bc385..5f32e1a29411 100644 --- a/drivers/gpu/drm/exynos/regs-mixer.h +++ b/drivers/gpu/drm/exynos/regs-mixer.h | |||
@@ -78,6 +78,7 @@ | |||
78 | #define MXR_STATUS_BIG_ENDIAN (1 << 3) | 78 | #define MXR_STATUS_BIG_ENDIAN (1 << 3) |
79 | #define MXR_STATUS_ENDIAN_MASK (1 << 3) | 79 | #define MXR_STATUS_ENDIAN_MASK (1 << 3) |
80 | #define MXR_STATUS_SYNC_ENABLE (1 << 2) | 80 | #define MXR_STATUS_SYNC_ENABLE (1 << 2) |
81 | #define MXR_STATUS_REG_IDLE (1 << 1) | ||
81 | #define MXR_STATUS_REG_RUN (1 << 0) | 82 | #define MXR_STATUS_REG_RUN (1 << 0) |
82 | 83 | ||
83 | /* bits for MXR_CFG */ | 84 | /* bits for MXR_CFG */ |
diff --git a/drivers/gpu/drm/i2c/tda998x_drv.c b/drivers/gpu/drm/i2c/tda998x_drv.c index 240c331405b9..ac357b02bd35 100644 --- a/drivers/gpu/drm/i2c/tda998x_drv.c +++ b/drivers/gpu/drm/i2c/tda998x_drv.c | |||
@@ -810,6 +810,12 @@ static int | |||
810 | tda998x_encoder_mode_valid(struct drm_encoder *encoder, | 810 | tda998x_encoder_mode_valid(struct drm_encoder *encoder, |
811 | struct drm_display_mode *mode) | 811 | struct drm_display_mode *mode) |
812 | { | 812 | { |
813 | if (mode->clock > 150000) | ||
814 | return MODE_CLOCK_HIGH; | ||
815 | if (mode->htotal >= BIT(13)) | ||
816 | return MODE_BAD_HVALUE; | ||
817 | if (mode->vtotal >= BIT(11)) | ||
818 | return MODE_BAD_VVALUE; | ||
813 | return MODE_OK; | 819 | return MODE_OK; |
814 | } | 820 | } |
815 | 821 | ||
@@ -1048,8 +1054,8 @@ read_edid_block(struct drm_encoder *encoder, uint8_t *buf, int blk) | |||
1048 | return i; | 1054 | return i; |
1049 | } | 1055 | } |
1050 | } else { | 1056 | } else { |
1051 | for (i = 10; i > 0; i--) { | 1057 | for (i = 100; i > 0; i--) { |
1052 | msleep(10); | 1058 | msleep(1); |
1053 | ret = reg_read(priv, REG_INT_FLAGS_2); | 1059 | ret = reg_read(priv, REG_INT_FLAGS_2); |
1054 | if (ret < 0) | 1060 | if (ret < 0) |
1055 | return ret; | 1061 | return ret; |
@@ -1183,7 +1189,6 @@ static void | |||
1183 | tda998x_encoder_destroy(struct drm_encoder *encoder) | 1189 | tda998x_encoder_destroy(struct drm_encoder *encoder) |
1184 | { | 1190 | { |
1185 | struct tda998x_priv *priv = to_tda998x_priv(encoder); | 1191 | struct tda998x_priv *priv = to_tda998x_priv(encoder); |
1186 | drm_i2c_encoder_destroy(encoder); | ||
1187 | 1192 | ||
1188 | /* disable all IRQs and free the IRQ handler */ | 1193 | /* disable all IRQs and free the IRQ handler */ |
1189 | cec_write(priv, REG_CEC_RXSHPDINTENA, 0); | 1194 | cec_write(priv, REG_CEC_RXSHPDINTENA, 0); |
@@ -1193,6 +1198,7 @@ tda998x_encoder_destroy(struct drm_encoder *encoder) | |||
1193 | 1198 | ||
1194 | if (priv->cec) | 1199 | if (priv->cec) |
1195 | i2c_unregister_device(priv->cec); | 1200 | i2c_unregister_device(priv->cec); |
1201 | drm_i2c_encoder_destroy(encoder); | ||
1196 | kfree(priv); | 1202 | kfree(priv); |
1197 | } | 1203 | } |
1198 | 1204 | ||
diff --git a/drivers/gpu/drm/i915/i915_debugfs.c b/drivers/gpu/drm/i915/i915_debugfs.c index 601caa88c092..b8c689202c40 100644 --- a/drivers/gpu/drm/i915/i915_debugfs.c +++ b/drivers/gpu/drm/i915/i915_debugfs.c | |||
@@ -446,7 +446,9 @@ static int i915_gem_object_info(struct seq_file *m, void* data) | |||
446 | 446 | ||
447 | memset(&stats, 0, sizeof(stats)); | 447 | memset(&stats, 0, sizeof(stats)); |
448 | stats.file_priv = file->driver_priv; | 448 | stats.file_priv = file->driver_priv; |
449 | spin_lock(&file->table_lock); | ||
449 | idr_for_each(&file->object_idr, per_file_stats, &stats); | 450 | idr_for_each(&file->object_idr, per_file_stats, &stats); |
451 | spin_unlock(&file->table_lock); | ||
450 | /* | 452 | /* |
451 | * Although we have a valid reference on file->pid, that does | 453 | * Although we have a valid reference on file->pid, that does |
452 | * not guarantee that the task_struct who called get_pid() is | 454 | * not guarantee that the task_struct who called get_pid() is |
diff --git a/drivers/gpu/drm/i915/i915_dma.c b/drivers/gpu/drm/i915/i915_dma.c index 4c22a5b7f4c5..d44344140627 100644 --- a/drivers/gpu/drm/i915/i915_dma.c +++ b/drivers/gpu/drm/i915/i915_dma.c | |||
@@ -36,6 +36,8 @@ | |||
36 | #include "i915_drv.h" | 36 | #include "i915_drv.h" |
37 | #include "i915_trace.h" | 37 | #include "i915_trace.h" |
38 | #include <linux/pci.h> | 38 | #include <linux/pci.h> |
39 | #include <linux/console.h> | ||
40 | #include <linux/vt.h> | ||
39 | #include <linux/vgaarb.h> | 41 | #include <linux/vgaarb.h> |
40 | #include <linux/acpi.h> | 42 | #include <linux/acpi.h> |
41 | #include <linux/pnp.h> | 43 | #include <linux/pnp.h> |
@@ -1386,7 +1388,6 @@ cleanup_gem: | |||
1386 | i915_gem_context_fini(dev); | 1388 | i915_gem_context_fini(dev); |
1387 | mutex_unlock(&dev->struct_mutex); | 1389 | mutex_unlock(&dev->struct_mutex); |
1388 | WARN_ON(dev_priv->mm.aliasing_ppgtt); | 1390 | WARN_ON(dev_priv->mm.aliasing_ppgtt); |
1389 | drm_mm_takedown(&dev_priv->gtt.base.mm); | ||
1390 | cleanup_irq: | 1391 | cleanup_irq: |
1391 | drm_irq_uninstall(dev); | 1392 | drm_irq_uninstall(dev); |
1392 | cleanup_gem_stolen: | 1393 | cleanup_gem_stolen: |
@@ -1450,6 +1451,39 @@ static void i915_kick_out_firmware_fb(struct drm_i915_private *dev_priv) | |||
1450 | } | 1451 | } |
1451 | #endif | 1452 | #endif |
1452 | 1453 | ||
1454 | #if !defined(CONFIG_VGA_CONSOLE) | ||
1455 | static int i915_kick_out_vgacon(struct drm_i915_private *dev_priv) | ||
1456 | { | ||
1457 | return 0; | ||
1458 | } | ||
1459 | #elif !defined(CONFIG_DUMMY_CONSOLE) | ||
1460 | static int i915_kick_out_vgacon(struct drm_i915_private *dev_priv) | ||
1461 | { | ||
1462 | return -ENODEV; | ||
1463 | } | ||
1464 | #else | ||
1465 | static int i915_kick_out_vgacon(struct drm_i915_private *dev_priv) | ||
1466 | { | ||
1467 | int ret = 0; | ||
1468 | |||
1469 | DRM_INFO("Replacing VGA console driver\n"); | ||
1470 | |||
1471 | console_lock(); | ||
1472 | if (con_is_bound(&vga_con)) | ||
1473 | ret = do_take_over_console(&dummy_con, 0, MAX_NR_CONSOLES - 1, 1); | ||
1474 | if (ret == 0) { | ||
1475 | ret = do_unregister_con_driver(&vga_con); | ||
1476 | |||
1477 | /* Ignore "already unregistered". */ | ||
1478 | if (ret == -ENODEV) | ||
1479 | ret = 0; | ||
1480 | } | ||
1481 | console_unlock(); | ||
1482 | |||
1483 | return ret; | ||
1484 | } | ||
1485 | #endif | ||
1486 | |||
1453 | static void i915_dump_device_info(struct drm_i915_private *dev_priv) | 1487 | static void i915_dump_device_info(struct drm_i915_private *dev_priv) |
1454 | { | 1488 | { |
1455 | const struct intel_device_info *info = &dev_priv->info; | 1489 | const struct intel_device_info *info = &dev_priv->info; |
@@ -1623,8 +1657,15 @@ int i915_driver_load(struct drm_device *dev, unsigned long flags) | |||
1623 | if (ret) | 1657 | if (ret) |
1624 | goto out_regs; | 1658 | goto out_regs; |
1625 | 1659 | ||
1626 | if (drm_core_check_feature(dev, DRIVER_MODESET)) | 1660 | if (drm_core_check_feature(dev, DRIVER_MODESET)) { |
1661 | ret = i915_kick_out_vgacon(dev_priv); | ||
1662 | if (ret) { | ||
1663 | DRM_ERROR("failed to remove conflicting VGA console\n"); | ||
1664 | goto out_gtt; | ||
1665 | } | ||
1666 | |||
1627 | i915_kick_out_firmware_fb(dev_priv); | 1667 | i915_kick_out_firmware_fb(dev_priv); |
1668 | } | ||
1628 | 1669 | ||
1629 | pci_set_master(dev->pdev); | 1670 | pci_set_master(dev->pdev); |
1630 | 1671 | ||
@@ -1756,8 +1797,6 @@ out_mtrrfree: | |||
1756 | arch_phys_wc_del(dev_priv->gtt.mtrr); | 1797 | arch_phys_wc_del(dev_priv->gtt.mtrr); |
1757 | io_mapping_free(dev_priv->gtt.mappable); | 1798 | io_mapping_free(dev_priv->gtt.mappable); |
1758 | out_gtt: | 1799 | out_gtt: |
1759 | list_del(&dev_priv->gtt.base.global_link); | ||
1760 | drm_mm_takedown(&dev_priv->gtt.base.mm); | ||
1761 | dev_priv->gtt.base.cleanup(&dev_priv->gtt.base); | 1800 | dev_priv->gtt.base.cleanup(&dev_priv->gtt.base); |
1762 | out_regs: | 1801 | out_regs: |
1763 | intel_uncore_fini(dev); | 1802 | intel_uncore_fini(dev); |
@@ -1846,7 +1885,6 @@ int i915_driver_unload(struct drm_device *dev) | |||
1846 | i915_free_hws(dev); | 1885 | i915_free_hws(dev); |
1847 | } | 1886 | } |
1848 | 1887 | ||
1849 | list_del(&dev_priv->gtt.base.global_link); | ||
1850 | WARN_ON(!list_empty(&dev_priv->vm_list)); | 1888 | WARN_ON(!list_empty(&dev_priv->vm_list)); |
1851 | 1889 | ||
1852 | drm_vblank_cleanup(dev); | 1890 | drm_vblank_cleanup(dev); |
diff --git a/drivers/gpu/drm/i915/i915_drv.h b/drivers/gpu/drm/i915/i915_drv.h index 49414d30e8d4..374f964323ad 100644 --- a/drivers/gpu/drm/i915/i915_drv.h +++ b/drivers/gpu/drm/i915/i915_drv.h | |||
@@ -656,6 +656,7 @@ enum intel_sbi_destination { | |||
656 | #define QUIRK_PIPEA_FORCE (1<<0) | 656 | #define QUIRK_PIPEA_FORCE (1<<0) |
657 | #define QUIRK_LVDS_SSC_DISABLE (1<<1) | 657 | #define QUIRK_LVDS_SSC_DISABLE (1<<1) |
658 | #define QUIRK_INVERT_BRIGHTNESS (1<<2) | 658 | #define QUIRK_INVERT_BRIGHTNESS (1<<2) |
659 | #define QUIRK_BACKLIGHT_PRESENT (1<<3) | ||
659 | 660 | ||
660 | struct intel_fbdev; | 661 | struct intel_fbdev; |
661 | struct intel_fbc_work; | 662 | struct intel_fbc_work; |
@@ -977,6 +978,8 @@ struct i915_power_well { | |||
977 | bool always_on; | 978 | bool always_on; |
978 | /* power well enable/disable usage count */ | 979 | /* power well enable/disable usage count */ |
979 | int count; | 980 | int count; |
981 | /* cached hw enabled state */ | ||
982 | bool hw_enabled; | ||
980 | unsigned long domains; | 983 | unsigned long domains; |
981 | unsigned long data; | 984 | unsigned long data; |
982 | const struct i915_power_well_ops *ops; | 985 | const struct i915_power_well_ops *ops; |
diff --git a/drivers/gpu/drm/i915/i915_gem_context.c b/drivers/gpu/drm/i915/i915_gem_context.c index 3ffe308d5893..a5ddf3bce9c3 100644 --- a/drivers/gpu/drm/i915/i915_gem_context.c +++ b/drivers/gpu/drm/i915/i915_gem_context.c | |||
@@ -598,6 +598,7 @@ static int do_switch(struct intel_engine_cs *ring, | |||
598 | struct intel_context *from = ring->last_context; | 598 | struct intel_context *from = ring->last_context; |
599 | struct i915_hw_ppgtt *ppgtt = ctx_to_ppgtt(to); | 599 | struct i915_hw_ppgtt *ppgtt = ctx_to_ppgtt(to); |
600 | u32 hw_flags = 0; | 600 | u32 hw_flags = 0; |
601 | bool uninitialized = false; | ||
601 | int ret, i; | 602 | int ret, i; |
602 | 603 | ||
603 | if (from != NULL && ring == &dev_priv->ring[RCS]) { | 604 | if (from != NULL && ring == &dev_priv->ring[RCS]) { |
@@ -696,19 +697,20 @@ static int do_switch(struct intel_engine_cs *ring, | |||
696 | i915_gem_context_unreference(from); | 697 | i915_gem_context_unreference(from); |
697 | } | 698 | } |
698 | 699 | ||
700 | uninitialized = !to->is_initialized && from == NULL; | ||
701 | to->is_initialized = true; | ||
702 | |||
699 | done: | 703 | done: |
700 | i915_gem_context_reference(to); | 704 | i915_gem_context_reference(to); |
701 | ring->last_context = to; | 705 | ring->last_context = to; |
702 | to->last_ring = ring; | 706 | to->last_ring = ring; |
703 | 707 | ||
704 | if (ring->id == RCS && !to->is_initialized && from == NULL) { | 708 | if (uninitialized) { |
705 | ret = i915_gem_render_state_init(ring); | 709 | ret = i915_gem_render_state_init(ring); |
706 | if (ret) | 710 | if (ret) |
707 | DRM_ERROR("init render state: %d\n", ret); | 711 | DRM_ERROR("init render state: %d\n", ret); |
708 | } | 712 | } |
709 | 713 | ||
710 | to->is_initialized = true; | ||
711 | |||
712 | return 0; | 714 | return 0; |
713 | 715 | ||
714 | unpin_out: | 716 | unpin_out: |
diff --git a/drivers/gpu/drm/i915/i915_gem_gtt.c b/drivers/gpu/drm/i915/i915_gem_gtt.c index eec820aec022..8b3cde703364 100644 --- a/drivers/gpu/drm/i915/i915_gem_gtt.c +++ b/drivers/gpu/drm/i915/i915_gem_gtt.c | |||
@@ -1992,7 +1992,10 @@ static void gen6_gmch_remove(struct i915_address_space *vm) | |||
1992 | 1992 | ||
1993 | struct i915_gtt *gtt = container_of(vm, struct i915_gtt, base); | 1993 | struct i915_gtt *gtt = container_of(vm, struct i915_gtt, base); |
1994 | 1994 | ||
1995 | drm_mm_takedown(&vm->mm); | 1995 | if (drm_mm_initialized(&vm->mm)) { |
1996 | drm_mm_takedown(&vm->mm); | ||
1997 | list_del(&vm->global_link); | ||
1998 | } | ||
1996 | iounmap(gtt->gsm); | 1999 | iounmap(gtt->gsm); |
1997 | teardown_scratch_page(vm->dev); | 2000 | teardown_scratch_page(vm->dev); |
1998 | } | 2001 | } |
@@ -2025,6 +2028,10 @@ static int i915_gmch_probe(struct drm_device *dev, | |||
2025 | 2028 | ||
2026 | static void i915_gmch_remove(struct i915_address_space *vm) | 2029 | static void i915_gmch_remove(struct i915_address_space *vm) |
2027 | { | 2030 | { |
2031 | if (drm_mm_initialized(&vm->mm)) { | ||
2032 | drm_mm_takedown(&vm->mm); | ||
2033 | list_del(&vm->global_link); | ||
2034 | } | ||
2028 | intel_gmch_remove(); | 2035 | intel_gmch_remove(); |
2029 | } | 2036 | } |
2030 | 2037 | ||
diff --git a/drivers/gpu/drm/i915/i915_gem_stolen.c b/drivers/gpu/drm/i915/i915_gem_stolen.c index 62ef55ba061c..7465ab0fd396 100644 --- a/drivers/gpu/drm/i915/i915_gem_stolen.c +++ b/drivers/gpu/drm/i915/i915_gem_stolen.c | |||
@@ -74,6 +74,50 @@ static unsigned long i915_stolen_to_physical(struct drm_device *dev) | |||
74 | if (base == 0) | 74 | if (base == 0) |
75 | return 0; | 75 | return 0; |
76 | 76 | ||
77 | /* make sure we don't clobber the GTT if it's within stolen memory */ | ||
78 | if (INTEL_INFO(dev)->gen <= 4 && !IS_G33(dev) && !IS_G4X(dev)) { | ||
79 | struct { | ||
80 | u32 start, end; | ||
81 | } stolen[2] = { | ||
82 | { .start = base, .end = base + dev_priv->gtt.stolen_size, }, | ||
83 | { .start = base, .end = base + dev_priv->gtt.stolen_size, }, | ||
84 | }; | ||
85 | u64 gtt_start, gtt_end; | ||
86 | |||
87 | gtt_start = I915_READ(PGTBL_CTL); | ||
88 | if (IS_GEN4(dev)) | ||
89 | gtt_start = (gtt_start & PGTBL_ADDRESS_LO_MASK) | | ||
90 | (gtt_start & PGTBL_ADDRESS_HI_MASK) << 28; | ||
91 | else | ||
92 | gtt_start &= PGTBL_ADDRESS_LO_MASK; | ||
93 | gtt_end = gtt_start + gtt_total_entries(dev_priv->gtt) * 4; | ||
94 | |||
95 | if (gtt_start >= stolen[0].start && gtt_start < stolen[0].end) | ||
96 | stolen[0].end = gtt_start; | ||
97 | if (gtt_end > stolen[1].start && gtt_end <= stolen[1].end) | ||
98 | stolen[1].start = gtt_end; | ||
99 | |||
100 | /* pick the larger of the two chunks */ | ||
101 | if (stolen[0].end - stolen[0].start > | ||
102 | stolen[1].end - stolen[1].start) { | ||
103 | base = stolen[0].start; | ||
104 | dev_priv->gtt.stolen_size = stolen[0].end - stolen[0].start; | ||
105 | } else { | ||
106 | base = stolen[1].start; | ||
107 | dev_priv->gtt.stolen_size = stolen[1].end - stolen[1].start; | ||
108 | } | ||
109 | |||
110 | if (stolen[0].start != stolen[1].start || | ||
111 | stolen[0].end != stolen[1].end) { | ||
112 | DRM_DEBUG_KMS("GTT within stolen memory at 0x%llx-0x%llx\n", | ||
113 | (unsigned long long) gtt_start, | ||
114 | (unsigned long long) gtt_end - 1); | ||
115 | DRM_DEBUG_KMS("Stolen memory adjusted to 0x%x-0x%x\n", | ||
116 | base, base + (u32) dev_priv->gtt.stolen_size - 1); | ||
117 | } | ||
118 | } | ||
119 | |||
120 | |||
77 | /* Verify that nothing else uses this physical address. Stolen | 121 | /* Verify that nothing else uses this physical address. Stolen |
78 | * memory should be reserved by the BIOS and hidden from the | 122 | * memory should be reserved by the BIOS and hidden from the |
79 | * kernel. So if the region is already marked as busy, something | 123 | * kernel. So if the region is already marked as busy, something |
diff --git a/drivers/gpu/drm/i915/i915_gpu_error.c b/drivers/gpu/drm/i915/i915_gpu_error.c index 87ec60e181a7..66cf41765bf9 100644 --- a/drivers/gpu/drm/i915/i915_gpu_error.c +++ b/drivers/gpu/drm/i915/i915_gpu_error.c | |||
@@ -888,6 +888,8 @@ static void i915_gem_record_rings(struct drm_device *dev, | |||
888 | for (i = 0; i < I915_NUM_RINGS; i++) { | 888 | for (i = 0; i < I915_NUM_RINGS; i++) { |
889 | struct intel_engine_cs *ring = &dev_priv->ring[i]; | 889 | struct intel_engine_cs *ring = &dev_priv->ring[i]; |
890 | 890 | ||
891 | error->ring[i].pid = -1; | ||
892 | |||
891 | if (ring->dev == NULL) | 893 | if (ring->dev == NULL) |
892 | continue; | 894 | continue; |
893 | 895 | ||
@@ -895,7 +897,6 @@ static void i915_gem_record_rings(struct drm_device *dev, | |||
895 | 897 | ||
896 | i915_record_ring_state(dev, ring, &error->ring[i]); | 898 | i915_record_ring_state(dev, ring, &error->ring[i]); |
897 | 899 | ||
898 | error->ring[i].pid = -1; | ||
899 | request = i915_gem_find_active_request(ring); | 900 | request = i915_gem_find_active_request(ring); |
900 | if (request) { | 901 | if (request) { |
901 | /* We need to copy these to an anonymous buffer | 902 | /* We need to copy these to an anonymous buffer |
diff --git a/drivers/gpu/drm/i915/i915_irq.c b/drivers/gpu/drm/i915/i915_irq.c index 6f8017a7e937..267f069765ad 100644 --- a/drivers/gpu/drm/i915/i915_irq.c +++ b/drivers/gpu/drm/i915/i915_irq.c | |||
@@ -2847,10 +2847,14 @@ static int semaphore_passed(struct intel_engine_cs *ring) | |||
2847 | struct intel_engine_cs *signaller; | 2847 | struct intel_engine_cs *signaller; |
2848 | u32 seqno, ctl; | 2848 | u32 seqno, ctl; |
2849 | 2849 | ||
2850 | ring->hangcheck.deadlock = true; | 2850 | ring->hangcheck.deadlock++; |
2851 | 2851 | ||
2852 | signaller = semaphore_waits_for(ring, &seqno); | 2852 | signaller = semaphore_waits_for(ring, &seqno); |
2853 | if (signaller == NULL || signaller->hangcheck.deadlock) | 2853 | if (signaller == NULL) |
2854 | return -1; | ||
2855 | |||
2856 | /* Prevent pathological recursion due to driver bugs */ | ||
2857 | if (signaller->hangcheck.deadlock >= I915_NUM_RINGS) | ||
2854 | return -1; | 2858 | return -1; |
2855 | 2859 | ||
2856 | /* cursory check for an unkickable deadlock */ | 2860 | /* cursory check for an unkickable deadlock */ |
@@ -2858,7 +2862,13 @@ static int semaphore_passed(struct intel_engine_cs *ring) | |||
2858 | if (ctl & RING_WAIT_SEMAPHORE && semaphore_passed(signaller) < 0) | 2862 | if (ctl & RING_WAIT_SEMAPHORE && semaphore_passed(signaller) < 0) |
2859 | return -1; | 2863 | return -1; |
2860 | 2864 | ||
2861 | return i915_seqno_passed(signaller->get_seqno(signaller, false), seqno); | 2865 | if (i915_seqno_passed(signaller->get_seqno(signaller, false), seqno)) |
2866 | return 1; | ||
2867 | |||
2868 | if (signaller->hangcheck.deadlock) | ||
2869 | return -1; | ||
2870 | |||
2871 | return 0; | ||
2862 | } | 2872 | } |
2863 | 2873 | ||
2864 | static void semaphore_clear_deadlocks(struct drm_i915_private *dev_priv) | 2874 | static void semaphore_clear_deadlocks(struct drm_i915_private *dev_priv) |
@@ -2867,7 +2877,7 @@ static void semaphore_clear_deadlocks(struct drm_i915_private *dev_priv) | |||
2867 | int i; | 2877 | int i; |
2868 | 2878 | ||
2869 | for_each_ring(ring, dev_priv, i) | 2879 | for_each_ring(ring, dev_priv, i) |
2870 | ring->hangcheck.deadlock = false; | 2880 | ring->hangcheck.deadlock = 0; |
2871 | } | 2881 | } |
2872 | 2882 | ||
2873 | static enum intel_ring_hangcheck_action | 2883 | static enum intel_ring_hangcheck_action |
diff --git a/drivers/gpu/drm/i915/i915_reg.h b/drivers/gpu/drm/i915/i915_reg.h index e691b30b2817..a5bab61bfc00 100644 --- a/drivers/gpu/drm/i915/i915_reg.h +++ b/drivers/gpu/drm/i915/i915_reg.h | |||
@@ -942,6 +942,9 @@ enum punit_power_well { | |||
942 | /* | 942 | /* |
943 | * Instruction and interrupt control regs | 943 | * Instruction and interrupt control regs |
944 | */ | 944 | */ |
945 | #define PGTBL_CTL 0x02020 | ||
946 | #define PGTBL_ADDRESS_LO_MASK 0xfffff000 /* bits [31:12] */ | ||
947 | #define PGTBL_ADDRESS_HI_MASK 0x000000f0 /* bits [35:32] (gen4) */ | ||
945 | #define PGTBL_ER 0x02024 | 948 | #define PGTBL_ER 0x02024 |
946 | #define RENDER_RING_BASE 0x02000 | 949 | #define RENDER_RING_BASE 0x02000 |
947 | #define BSD_RING_BASE 0x04000 | 950 | #define BSD_RING_BASE 0x04000 |
diff --git a/drivers/gpu/drm/i915/intel_bios.c b/drivers/gpu/drm/i915/intel_bios.c index 1ee98f121a00..827498e081df 100644 --- a/drivers/gpu/drm/i915/intel_bios.c +++ b/drivers/gpu/drm/i915/intel_bios.c | |||
@@ -315,9 +315,6 @@ parse_lfp_backlight(struct drm_i915_private *dev_priv, struct bdb_header *bdb) | |||
315 | const struct bdb_lfp_backlight_data *backlight_data; | 315 | const struct bdb_lfp_backlight_data *backlight_data; |
316 | const struct bdb_lfp_backlight_data_entry *entry; | 316 | const struct bdb_lfp_backlight_data_entry *entry; |
317 | 317 | ||
318 | /* Err to enabling backlight if no backlight block. */ | ||
319 | dev_priv->vbt.backlight.present = true; | ||
320 | |||
321 | backlight_data = find_section(bdb, BDB_LVDS_BACKLIGHT); | 318 | backlight_data = find_section(bdb, BDB_LVDS_BACKLIGHT); |
322 | if (!backlight_data) | 319 | if (!backlight_data) |
323 | return; | 320 | return; |
@@ -1088,6 +1085,9 @@ init_vbt_defaults(struct drm_i915_private *dev_priv) | |||
1088 | 1085 | ||
1089 | dev_priv->vbt.crt_ddc_pin = GMBUS_PORT_VGADDC; | 1086 | dev_priv->vbt.crt_ddc_pin = GMBUS_PORT_VGADDC; |
1090 | 1087 | ||
1088 | /* Default to having backlight */ | ||
1089 | dev_priv->vbt.backlight.present = true; | ||
1090 | |||
1091 | /* LFP panel data */ | 1091 | /* LFP panel data */ |
1092 | dev_priv->vbt.lvds_dither = 1; | 1092 | dev_priv->vbt.lvds_dither = 1; |
1093 | dev_priv->vbt.lvds_vbt = 0; | 1093 | dev_priv->vbt.lvds_vbt = 0; |
diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c index efd3cf50cb0f..e27e7804c0b9 100644 --- a/drivers/gpu/drm/i915/intel_display.c +++ b/drivers/gpu/drm/i915/intel_display.c | |||
@@ -2087,6 +2087,7 @@ void intel_flush_primary_plane(struct drm_i915_private *dev_priv, | |||
2087 | static void intel_enable_primary_hw_plane(struct drm_i915_private *dev_priv, | 2087 | static void intel_enable_primary_hw_plane(struct drm_i915_private *dev_priv, |
2088 | enum plane plane, enum pipe pipe) | 2088 | enum plane plane, enum pipe pipe) |
2089 | { | 2089 | { |
2090 | struct drm_device *dev = dev_priv->dev; | ||
2090 | struct intel_crtc *intel_crtc = | 2091 | struct intel_crtc *intel_crtc = |
2091 | to_intel_crtc(dev_priv->pipe_to_crtc_mapping[pipe]); | 2092 | to_intel_crtc(dev_priv->pipe_to_crtc_mapping[pipe]); |
2092 | int reg; | 2093 | int reg; |
@@ -2106,6 +2107,14 @@ static void intel_enable_primary_hw_plane(struct drm_i915_private *dev_priv, | |||
2106 | 2107 | ||
2107 | I915_WRITE(reg, val | DISPLAY_PLANE_ENABLE); | 2108 | I915_WRITE(reg, val | DISPLAY_PLANE_ENABLE); |
2108 | intel_flush_primary_plane(dev_priv, plane); | 2109 | intel_flush_primary_plane(dev_priv, plane); |
2110 | |||
2111 | /* | ||
2112 | * BDW signals flip done immediately if the plane | ||
2113 | * is disabled, even if the plane enable is already | ||
2114 | * armed to occur at the next vblank :( | ||
2115 | */ | ||
2116 | if (IS_BROADWELL(dev)) | ||
2117 | intel_wait_for_vblank(dev, intel_crtc->pipe); | ||
2109 | } | 2118 | } |
2110 | 2119 | ||
2111 | /** | 2120 | /** |
@@ -4564,7 +4573,10 @@ static void valleyview_crtc_enable(struct drm_crtc *crtc) | |||
4564 | if (intel_crtc->active) | 4573 | if (intel_crtc->active) |
4565 | return; | 4574 | return; |
4566 | 4575 | ||
4567 | vlv_prepare_pll(intel_crtc); | 4576 | is_dsi = intel_pipe_has_type(crtc, INTEL_OUTPUT_DSI); |
4577 | |||
4578 | if (!is_dsi && !IS_CHERRYVIEW(dev)) | ||
4579 | vlv_prepare_pll(intel_crtc); | ||
4568 | 4580 | ||
4569 | /* Set up the display plane register */ | 4581 | /* Set up the display plane register */ |
4570 | dspcntr = DISPPLANE_GAMMA_ENABLE; | 4582 | dspcntr = DISPPLANE_GAMMA_ENABLE; |
@@ -4598,8 +4610,6 @@ static void valleyview_crtc_enable(struct drm_crtc *crtc) | |||
4598 | if (encoder->pre_pll_enable) | 4610 | if (encoder->pre_pll_enable) |
4599 | encoder->pre_pll_enable(encoder); | 4611 | encoder->pre_pll_enable(encoder); |
4600 | 4612 | ||
4601 | is_dsi = intel_pipe_has_type(crtc, INTEL_OUTPUT_DSI); | ||
4602 | |||
4603 | if (!is_dsi) { | 4613 | if (!is_dsi) { |
4604 | if (IS_CHERRYVIEW(dev)) | 4614 | if (IS_CHERRYVIEW(dev)) |
4605 | chv_enable_pll(intel_crtc); | 4615 | chv_enable_pll(intel_crtc); |
@@ -11087,6 +11097,22 @@ const char *intel_output_name(int output) | |||
11087 | return names[output]; | 11097 | return names[output]; |
11088 | } | 11098 | } |
11089 | 11099 | ||
11100 | static bool intel_crt_present(struct drm_device *dev) | ||
11101 | { | ||
11102 | struct drm_i915_private *dev_priv = dev->dev_private; | ||
11103 | |||
11104 | if (IS_ULT(dev)) | ||
11105 | return false; | ||
11106 | |||
11107 | if (IS_CHERRYVIEW(dev)) | ||
11108 | return false; | ||
11109 | |||
11110 | if (IS_VALLEYVIEW(dev) && !dev_priv->vbt.int_crt_support) | ||
11111 | return false; | ||
11112 | |||
11113 | return true; | ||
11114 | } | ||
11115 | |||
11090 | static void intel_setup_outputs(struct drm_device *dev) | 11116 | static void intel_setup_outputs(struct drm_device *dev) |
11091 | { | 11117 | { |
11092 | struct drm_i915_private *dev_priv = dev->dev_private; | 11118 | struct drm_i915_private *dev_priv = dev->dev_private; |
@@ -11095,7 +11121,7 @@ static void intel_setup_outputs(struct drm_device *dev) | |||
11095 | 11121 | ||
11096 | intel_lvds_init(dev); | 11122 | intel_lvds_init(dev); |
11097 | 11123 | ||
11098 | if (!IS_ULT(dev) && !IS_CHERRYVIEW(dev) && dev_priv->vbt.int_crt_support) | 11124 | if (intel_crt_present(dev)) |
11099 | intel_crt_init(dev); | 11125 | intel_crt_init(dev); |
11100 | 11126 | ||
11101 | if (HAS_DDI(dev)) { | 11127 | if (HAS_DDI(dev)) { |
@@ -11565,6 +11591,14 @@ static void quirk_invert_brightness(struct drm_device *dev) | |||
11565 | DRM_INFO("applying inverted panel brightness quirk\n"); | 11591 | DRM_INFO("applying inverted panel brightness quirk\n"); |
11566 | } | 11592 | } |
11567 | 11593 | ||
11594 | /* Some VBT's incorrectly indicate no backlight is present */ | ||
11595 | static void quirk_backlight_present(struct drm_device *dev) | ||
11596 | { | ||
11597 | struct drm_i915_private *dev_priv = dev->dev_private; | ||
11598 | dev_priv->quirks |= QUIRK_BACKLIGHT_PRESENT; | ||
11599 | DRM_INFO("applying backlight present quirk\n"); | ||
11600 | } | ||
11601 | |||
11568 | struct intel_quirk { | 11602 | struct intel_quirk { |
11569 | int device; | 11603 | int device; |
11570 | int subsystem_vendor; | 11604 | int subsystem_vendor; |
@@ -11633,6 +11667,12 @@ static struct intel_quirk intel_quirks[] = { | |||
11633 | 11667 | ||
11634 | /* Acer Aspire 5336 */ | 11668 | /* Acer Aspire 5336 */ |
11635 | { 0x2a42, 0x1025, 0x048a, quirk_invert_brightness }, | 11669 | { 0x2a42, 0x1025, 0x048a, quirk_invert_brightness }, |
11670 | |||
11671 | /* Acer C720 and C720P Chromebooks (Celeron 2955U) have backlights */ | ||
11672 | { 0x0a06, 0x1025, 0x0a11, quirk_backlight_present }, | ||
11673 | |||
11674 | /* Toshiba CB35 Chromebook (Celeron 2955U) */ | ||
11675 | { 0x0a06, 0x1179, 0x0a88, quirk_backlight_present }, | ||
11636 | }; | 11676 | }; |
11637 | 11677 | ||
11638 | static void intel_init_quirks(struct drm_device *dev) | 11678 | static void intel_init_quirks(struct drm_device *dev) |
@@ -12411,8 +12451,8 @@ intel_display_capture_error_state(struct drm_device *dev) | |||
12411 | 12451 | ||
12412 | for_each_pipe(i) { | 12452 | for_each_pipe(i) { |
12413 | error->pipe[i].power_domain_on = | 12453 | error->pipe[i].power_domain_on = |
12414 | intel_display_power_enabled_sw(dev_priv, | 12454 | intel_display_power_enabled_unlocked(dev_priv, |
12415 | POWER_DOMAIN_PIPE(i)); | 12455 | POWER_DOMAIN_PIPE(i)); |
12416 | if (!error->pipe[i].power_domain_on) | 12456 | if (!error->pipe[i].power_domain_on) |
12417 | continue; | 12457 | continue; |
12418 | 12458 | ||
@@ -12447,7 +12487,7 @@ intel_display_capture_error_state(struct drm_device *dev) | |||
12447 | enum transcoder cpu_transcoder = transcoders[i]; | 12487 | enum transcoder cpu_transcoder = transcoders[i]; |
12448 | 12488 | ||
12449 | error->transcoder[i].power_domain_on = | 12489 | error->transcoder[i].power_domain_on = |
12450 | intel_display_power_enabled_sw(dev_priv, | 12490 | intel_display_power_enabled_unlocked(dev_priv, |
12451 | POWER_DOMAIN_TRANSCODER(cpu_transcoder)); | 12491 | POWER_DOMAIN_TRANSCODER(cpu_transcoder)); |
12452 | if (!error->transcoder[i].power_domain_on) | 12492 | if (!error->transcoder[i].power_domain_on) |
12453 | continue; | 12493 | continue; |
diff --git a/drivers/gpu/drm/i915/intel_dp.c b/drivers/gpu/drm/i915/intel_dp.c index 52fda950fd2a..075170d1844f 100644 --- a/drivers/gpu/drm/i915/intel_dp.c +++ b/drivers/gpu/drm/i915/intel_dp.c | |||
@@ -28,6 +28,8 @@ | |||
28 | #include <linux/i2c.h> | 28 | #include <linux/i2c.h> |
29 | #include <linux/slab.h> | 29 | #include <linux/slab.h> |
30 | #include <linux/export.h> | 30 | #include <linux/export.h> |
31 | #include <linux/notifier.h> | ||
32 | #include <linux/reboot.h> | ||
31 | #include <drm/drmP.h> | 33 | #include <drm/drmP.h> |
32 | #include <drm/drm_crtc.h> | 34 | #include <drm/drm_crtc.h> |
33 | #include <drm/drm_crtc_helper.h> | 35 | #include <drm/drm_crtc_helper.h> |
@@ -336,6 +338,37 @@ static u32 _pp_stat_reg(struct intel_dp *intel_dp) | |||
336 | return VLV_PIPE_PP_STATUS(vlv_power_sequencer_pipe(intel_dp)); | 338 | return VLV_PIPE_PP_STATUS(vlv_power_sequencer_pipe(intel_dp)); |
337 | } | 339 | } |
338 | 340 | ||
341 | /* Reboot notifier handler to shutdown panel power to guarantee T12 timing | ||
342 | This function only applicable when panel PM state is not to be tracked */ | ||
343 | static int edp_notify_handler(struct notifier_block *this, unsigned long code, | ||
344 | void *unused) | ||
345 | { | ||
346 | struct intel_dp *intel_dp = container_of(this, typeof(* intel_dp), | ||
347 | edp_notifier); | ||
348 | struct drm_device *dev = intel_dp_to_dev(intel_dp); | ||
349 | struct drm_i915_private *dev_priv = dev->dev_private; | ||
350 | u32 pp_div; | ||
351 | u32 pp_ctrl_reg, pp_div_reg; | ||
352 | enum pipe pipe = vlv_power_sequencer_pipe(intel_dp); | ||
353 | |||
354 | if (!is_edp(intel_dp) || code != SYS_RESTART) | ||
355 | return 0; | ||
356 | |||
357 | if (IS_VALLEYVIEW(dev)) { | ||
358 | pp_ctrl_reg = VLV_PIPE_PP_CONTROL(pipe); | ||
359 | pp_div_reg = VLV_PIPE_PP_DIVISOR(pipe); | ||
360 | pp_div = I915_READ(pp_div_reg); | ||
361 | pp_div &= PP_REFERENCE_DIVIDER_MASK; | ||
362 | |||
363 | /* 0x1F write to PP_DIV_REG sets max cycle delay */ | ||
364 | I915_WRITE(pp_div_reg, pp_div | 0x1F); | ||
365 | I915_WRITE(pp_ctrl_reg, PANEL_UNLOCK_REGS | PANEL_POWER_OFF); | ||
366 | msleep(intel_dp->panel_power_cycle_delay); | ||
367 | } | ||
368 | |||
369 | return 0; | ||
370 | } | ||
371 | |||
339 | static bool edp_have_panel_power(struct intel_dp *intel_dp) | 372 | static bool edp_have_panel_power(struct intel_dp *intel_dp) |
340 | { | 373 | { |
341 | struct drm_device *dev = intel_dp_to_dev(intel_dp); | 374 | struct drm_device *dev = intel_dp_to_dev(intel_dp); |
@@ -3707,6 +3740,10 @@ void intel_dp_encoder_destroy(struct drm_encoder *encoder) | |||
3707 | drm_modeset_lock(&dev->mode_config.connection_mutex, NULL); | 3740 | drm_modeset_lock(&dev->mode_config.connection_mutex, NULL); |
3708 | edp_panel_vdd_off_sync(intel_dp); | 3741 | edp_panel_vdd_off_sync(intel_dp); |
3709 | drm_modeset_unlock(&dev->mode_config.connection_mutex); | 3742 | drm_modeset_unlock(&dev->mode_config.connection_mutex); |
3743 | if (intel_dp->edp_notifier.notifier_call) { | ||
3744 | unregister_reboot_notifier(&intel_dp->edp_notifier); | ||
3745 | intel_dp->edp_notifier.notifier_call = NULL; | ||
3746 | } | ||
3710 | } | 3747 | } |
3711 | kfree(intel_dig_port); | 3748 | kfree(intel_dig_port); |
3712 | } | 3749 | } |
@@ -4184,6 +4221,11 @@ static bool intel_edp_init_connector(struct intel_dp *intel_dp, | |||
4184 | } | 4221 | } |
4185 | mutex_unlock(&dev->mode_config.mutex); | 4222 | mutex_unlock(&dev->mode_config.mutex); |
4186 | 4223 | ||
4224 | if (IS_VALLEYVIEW(dev)) { | ||
4225 | intel_dp->edp_notifier.notifier_call = edp_notify_handler; | ||
4226 | register_reboot_notifier(&intel_dp->edp_notifier); | ||
4227 | } | ||
4228 | |||
4187 | intel_panel_init(&intel_connector->panel, fixed_mode, downclock_mode); | 4229 | intel_panel_init(&intel_connector->panel, fixed_mode, downclock_mode); |
4188 | intel_panel_setup_backlight(connector); | 4230 | intel_panel_setup_backlight(connector); |
4189 | 4231 | ||
diff --git a/drivers/gpu/drm/i915/intel_drv.h b/drivers/gpu/drm/i915/intel_drv.h index bda0ae3d80cc..f67340ed2c12 100644 --- a/drivers/gpu/drm/i915/intel_drv.h +++ b/drivers/gpu/drm/i915/intel_drv.h | |||
@@ -538,6 +538,8 @@ struct intel_dp { | |||
538 | unsigned long last_power_on; | 538 | unsigned long last_power_on; |
539 | unsigned long last_backlight_off; | 539 | unsigned long last_backlight_off; |
540 | bool psr_setup_done; | 540 | bool psr_setup_done; |
541 | struct notifier_block edp_notifier; | ||
542 | |||
541 | bool use_tps3; | 543 | bool use_tps3; |
542 | struct intel_connector *attached_connector; | 544 | struct intel_connector *attached_connector; |
543 | 545 | ||
@@ -950,8 +952,8 @@ int intel_power_domains_init(struct drm_i915_private *); | |||
950 | void intel_power_domains_remove(struct drm_i915_private *); | 952 | void intel_power_domains_remove(struct drm_i915_private *); |
951 | bool intel_display_power_enabled(struct drm_i915_private *dev_priv, | 953 | bool intel_display_power_enabled(struct drm_i915_private *dev_priv, |
952 | enum intel_display_power_domain domain); | 954 | enum intel_display_power_domain domain); |
953 | bool intel_display_power_enabled_sw(struct drm_i915_private *dev_priv, | 955 | bool intel_display_power_enabled_unlocked(struct drm_i915_private *dev_priv, |
954 | enum intel_display_power_domain domain); | 956 | enum intel_display_power_domain domain); |
955 | void intel_display_power_get(struct drm_i915_private *dev_priv, | 957 | void intel_display_power_get(struct drm_i915_private *dev_priv, |
956 | enum intel_display_power_domain domain); | 958 | enum intel_display_power_domain domain); |
957 | void intel_display_power_put(struct drm_i915_private *dev_priv, | 959 | void intel_display_power_put(struct drm_i915_private *dev_priv, |
diff --git a/drivers/gpu/drm/i915/intel_dsi.c b/drivers/gpu/drm/i915/intel_dsi.c index 02f99d768d49..3fd082933c87 100644 --- a/drivers/gpu/drm/i915/intel_dsi.c +++ b/drivers/gpu/drm/i915/intel_dsi.c | |||
@@ -117,17 +117,18 @@ static void intel_dsi_device_ready(struct intel_encoder *encoder) | |||
117 | /* bandgap reset is needed after everytime we do power gate */ | 117 | /* bandgap reset is needed after everytime we do power gate */ |
118 | band_gap_reset(dev_priv); | 118 | band_gap_reset(dev_priv); |
119 | 119 | ||
120 | I915_WRITE(MIPI_DEVICE_READY(pipe), ULPS_STATE_ENTER); | ||
121 | usleep_range(2500, 3000); | ||
122 | |||
120 | val = I915_READ(MIPI_PORT_CTRL(pipe)); | 123 | val = I915_READ(MIPI_PORT_CTRL(pipe)); |
121 | I915_WRITE(MIPI_PORT_CTRL(pipe), val | LP_OUTPUT_HOLD); | 124 | I915_WRITE(MIPI_PORT_CTRL(pipe), val | LP_OUTPUT_HOLD); |
122 | usleep_range(1000, 1500); | 125 | usleep_range(1000, 1500); |
123 | I915_WRITE(MIPI_DEVICE_READY(pipe), DEVICE_READY | ULPS_STATE_EXIT); | 126 | |
124 | usleep_range(2000, 2500); | 127 | I915_WRITE(MIPI_DEVICE_READY(pipe), ULPS_STATE_EXIT); |
125 | I915_WRITE(MIPI_DEVICE_READY(pipe), DEVICE_READY); | 128 | usleep_range(2500, 3000); |
126 | usleep_range(2000, 2500); | 129 | |
127 | I915_WRITE(MIPI_DEVICE_READY(pipe), 0x00); | ||
128 | usleep_range(2000, 2500); | ||
129 | I915_WRITE(MIPI_DEVICE_READY(pipe), DEVICE_READY); | 130 | I915_WRITE(MIPI_DEVICE_READY(pipe), DEVICE_READY); |
130 | usleep_range(2000, 2500); | 131 | usleep_range(2500, 3000); |
131 | } | 132 | } |
132 | 133 | ||
133 | static void intel_dsi_enable(struct intel_encoder *encoder) | 134 | static void intel_dsi_enable(struct intel_encoder *encoder) |
@@ -271,23 +272,23 @@ static void intel_dsi_clear_device_ready(struct intel_encoder *encoder) | |||
271 | 272 | ||
272 | DRM_DEBUG_KMS("\n"); | 273 | DRM_DEBUG_KMS("\n"); |
273 | 274 | ||
274 | I915_WRITE(MIPI_DEVICE_READY(pipe), ULPS_STATE_ENTER); | 275 | I915_WRITE(MIPI_DEVICE_READY(pipe), DEVICE_READY | ULPS_STATE_ENTER); |
275 | usleep_range(2000, 2500); | 276 | usleep_range(2000, 2500); |
276 | 277 | ||
277 | I915_WRITE(MIPI_DEVICE_READY(pipe), ULPS_STATE_EXIT); | 278 | I915_WRITE(MIPI_DEVICE_READY(pipe), DEVICE_READY | ULPS_STATE_EXIT); |
278 | usleep_range(2000, 2500); | 279 | usleep_range(2000, 2500); |
279 | 280 | ||
280 | I915_WRITE(MIPI_DEVICE_READY(pipe), ULPS_STATE_ENTER); | 281 | I915_WRITE(MIPI_DEVICE_READY(pipe), DEVICE_READY | ULPS_STATE_ENTER); |
281 | usleep_range(2000, 2500); | 282 | usleep_range(2000, 2500); |
282 | 283 | ||
283 | val = I915_READ(MIPI_PORT_CTRL(pipe)); | ||
284 | I915_WRITE(MIPI_PORT_CTRL(pipe), val & ~LP_OUTPUT_HOLD); | ||
285 | usleep_range(1000, 1500); | ||
286 | |||
287 | if (wait_for(((I915_READ(MIPI_PORT_CTRL(pipe)) & AFE_LATCHOUT) | 284 | if (wait_for(((I915_READ(MIPI_PORT_CTRL(pipe)) & AFE_LATCHOUT) |
288 | == 0x00000), 30)) | 285 | == 0x00000), 30)) |
289 | DRM_ERROR("DSI LP not going Low\n"); | 286 | DRM_ERROR("DSI LP not going Low\n"); |
290 | 287 | ||
288 | val = I915_READ(MIPI_PORT_CTRL(pipe)); | ||
289 | I915_WRITE(MIPI_PORT_CTRL(pipe), val & ~LP_OUTPUT_HOLD); | ||
290 | usleep_range(1000, 1500); | ||
291 | |||
291 | I915_WRITE(MIPI_DEVICE_READY(pipe), 0x00); | 292 | I915_WRITE(MIPI_DEVICE_READY(pipe), 0x00); |
292 | usleep_range(2000, 2500); | 293 | usleep_range(2000, 2500); |
293 | 294 | ||
diff --git a/drivers/gpu/drm/i915/intel_dsi_cmd.c b/drivers/gpu/drm/i915/intel_dsi_cmd.c index 3eeb21b9fddf..933c86305237 100644 --- a/drivers/gpu/drm/i915/intel_dsi_cmd.c +++ b/drivers/gpu/drm/i915/intel_dsi_cmd.c | |||
@@ -404,12 +404,6 @@ int dpi_send_cmd(struct intel_dsi *intel_dsi, u32 cmd, bool hs) | |||
404 | else | 404 | else |
405 | cmd |= DPI_LP_MODE; | 405 | cmd |= DPI_LP_MODE; |
406 | 406 | ||
407 | /* DPI virtual channel?! */ | ||
408 | |||
409 | mask = DPI_FIFO_EMPTY; | ||
410 | if (wait_for((I915_READ(MIPI_GEN_FIFO_STAT(pipe)) & mask) == mask, 50)) | ||
411 | DRM_ERROR("Timeout waiting for DPI FIFO empty.\n"); | ||
412 | |||
413 | /* clear bit */ | 407 | /* clear bit */ |
414 | I915_WRITE(MIPI_INTR_STAT(pipe), SPL_PKT_SENT_INTERRUPT); | 408 | I915_WRITE(MIPI_INTR_STAT(pipe), SPL_PKT_SENT_INTERRUPT); |
415 | 409 | ||
diff --git a/drivers/gpu/drm/i915/intel_opregion.c b/drivers/gpu/drm/i915/intel_opregion.c index 2e2c71fcc9ed..4f6b53998d79 100644 --- a/drivers/gpu/drm/i915/intel_opregion.c +++ b/drivers/gpu/drm/i915/intel_opregion.c | |||
@@ -403,6 +403,15 @@ static u32 asle_set_backlight(struct drm_device *dev, u32 bclp) | |||
403 | 403 | ||
404 | DRM_DEBUG_DRIVER("bclp = 0x%08x\n", bclp); | 404 | DRM_DEBUG_DRIVER("bclp = 0x%08x\n", bclp); |
405 | 405 | ||
406 | /* | ||
407 | * If the acpi_video interface is not supposed to be used, don't | ||
408 | * bother processing backlight level change requests from firmware. | ||
409 | */ | ||
410 | if (!acpi_video_verify_backlight_support()) { | ||
411 | DRM_DEBUG_KMS("opregion backlight request ignored\n"); | ||
412 | return 0; | ||
413 | } | ||
414 | |||
406 | if (!(bclp & ASLE_BCLP_VALID)) | 415 | if (!(bclp & ASLE_BCLP_VALID)) |
407 | return ASLC_BACKLIGHT_FAILED; | 416 | return ASLC_BACKLIGHT_FAILED; |
408 | 417 | ||
diff --git a/drivers/gpu/drm/i915/intel_panel.c b/drivers/gpu/drm/i915/intel_panel.c index 5e6c888b4928..628cd8938274 100644 --- a/drivers/gpu/drm/i915/intel_panel.c +++ b/drivers/gpu/drm/i915/intel_panel.c | |||
@@ -798,9 +798,6 @@ static void i965_enable_backlight(struct intel_connector *connector) | |||
798 | ctl = freq << 16; | 798 | ctl = freq << 16; |
799 | I915_WRITE(BLC_PWM_CTL, ctl); | 799 | I915_WRITE(BLC_PWM_CTL, ctl); |
800 | 800 | ||
801 | /* XXX: combine this into above write? */ | ||
802 | intel_panel_actually_set_backlight(connector, panel->backlight.level); | ||
803 | |||
804 | ctl2 = BLM_PIPE(pipe); | 801 | ctl2 = BLM_PIPE(pipe); |
805 | if (panel->backlight.combination_mode) | 802 | if (panel->backlight.combination_mode) |
806 | ctl2 |= BLM_COMBINATION_MODE; | 803 | ctl2 |= BLM_COMBINATION_MODE; |
@@ -809,6 +806,8 @@ static void i965_enable_backlight(struct intel_connector *connector) | |||
809 | I915_WRITE(BLC_PWM_CTL2, ctl2); | 806 | I915_WRITE(BLC_PWM_CTL2, ctl2); |
810 | POSTING_READ(BLC_PWM_CTL2); | 807 | POSTING_READ(BLC_PWM_CTL2); |
811 | I915_WRITE(BLC_PWM_CTL2, ctl2 | BLM_PWM_ENABLE); | 808 | I915_WRITE(BLC_PWM_CTL2, ctl2 | BLM_PWM_ENABLE); |
809 | |||
810 | intel_panel_actually_set_backlight(connector, panel->backlight.level); | ||
812 | } | 811 | } |
813 | 812 | ||
814 | static void vlv_enable_backlight(struct intel_connector *connector) | 813 | static void vlv_enable_backlight(struct intel_connector *connector) |
@@ -1119,8 +1118,12 @@ int intel_panel_setup_backlight(struct drm_connector *connector) | |||
1119 | int ret; | 1118 | int ret; |
1120 | 1119 | ||
1121 | if (!dev_priv->vbt.backlight.present) { | 1120 | if (!dev_priv->vbt.backlight.present) { |
1122 | DRM_DEBUG_KMS("native backlight control not available per VBT\n"); | 1121 | if (dev_priv->quirks & QUIRK_BACKLIGHT_PRESENT) { |
1123 | return 0; | 1122 | DRM_DEBUG_KMS("no backlight present per VBT, but present per quirk\n"); |
1123 | } else { | ||
1124 | DRM_DEBUG_KMS("no backlight present per VBT\n"); | ||
1125 | return 0; | ||
1126 | } | ||
1124 | } | 1127 | } |
1125 | 1128 | ||
1126 | /* set level and max in panel struct */ | 1129 | /* set level and max in panel struct */ |
diff --git a/drivers/gpu/drm/i915/intel_pm.c b/drivers/gpu/drm/i915/intel_pm.c index d1e53abec1b5..ee72807069e4 100644 --- a/drivers/gpu/drm/i915/intel_pm.c +++ b/drivers/gpu/drm/i915/intel_pm.c | |||
@@ -511,8 +511,7 @@ void intel_update_fbc(struct drm_device *dev) | |||
511 | obj = intel_fb->obj; | 511 | obj = intel_fb->obj; |
512 | adjusted_mode = &intel_crtc->config.adjusted_mode; | 512 | adjusted_mode = &intel_crtc->config.adjusted_mode; |
513 | 513 | ||
514 | if (i915.enable_fbc < 0 && | 514 | if (i915.enable_fbc < 0) { |
515 | INTEL_INFO(dev)->gen <= 7 && !IS_HASWELL(dev)) { | ||
516 | if (set_no_fbc_reason(dev_priv, FBC_CHIP_DEFAULT)) | 515 | if (set_no_fbc_reason(dev_priv, FBC_CHIP_DEFAULT)) |
517 | DRM_DEBUG_KMS("disabled per chip default\n"); | 516 | DRM_DEBUG_KMS("disabled per chip default\n"); |
518 | goto out_disable; | 517 | goto out_disable; |
@@ -3210,6 +3209,14 @@ void gen6_set_rps(struct drm_device *dev, u8 val) | |||
3210 | */ | 3209 | */ |
3211 | static void vlv_set_rps_idle(struct drm_i915_private *dev_priv) | 3210 | static void vlv_set_rps_idle(struct drm_i915_private *dev_priv) |
3212 | { | 3211 | { |
3212 | struct drm_device *dev = dev_priv->dev; | ||
3213 | |||
3214 | /* Latest VLV doesn't need to force the gfx clock */ | ||
3215 | if (dev->pdev->revision >= 0xd) { | ||
3216 | valleyview_set_rps(dev_priv->dev, dev_priv->rps.min_freq_softlimit); | ||
3217 | return; | ||
3218 | } | ||
3219 | |||
3213 | /* | 3220 | /* |
3214 | * When we are idle. Drop to min voltage state. | 3221 | * When we are idle. Drop to min voltage state. |
3215 | */ | 3222 | */ |
@@ -3506,15 +3513,11 @@ static void gen8_enable_rps(struct drm_device *dev) | |||
3506 | 3513 | ||
3507 | I915_WRITE(GEN6_RP_IDLE_HYSTERSIS, 10); | 3514 | I915_WRITE(GEN6_RP_IDLE_HYSTERSIS, 10); |
3508 | 3515 | ||
3509 | /* WaDisablePwrmtrEvent:chv (pre-production hw) */ | ||
3510 | I915_WRITE(0xA80C, I915_READ(0xA80C) & 0x00ffffff); | ||
3511 | I915_WRITE(0xA810, I915_READ(0xA810) & 0xffffff00); | ||
3512 | |||
3513 | /* 5: Enable RPS */ | 3516 | /* 5: Enable RPS */ |
3514 | I915_WRITE(GEN6_RP_CONTROL, | 3517 | I915_WRITE(GEN6_RP_CONTROL, |
3515 | GEN6_RP_MEDIA_TURBO | | 3518 | GEN6_RP_MEDIA_TURBO | |
3516 | GEN6_RP_MEDIA_HW_NORMAL_MODE | | 3519 | GEN6_RP_MEDIA_HW_NORMAL_MODE | |
3517 | GEN6_RP_MEDIA_IS_GFX | /* WaSetMaskForGfxBusyness:chv (pre-production hw ?) */ | 3520 | GEN6_RP_MEDIA_IS_GFX | |
3518 | GEN6_RP_ENABLE | | 3521 | GEN6_RP_ENABLE | |
3519 | GEN6_RP_UP_BUSY_AVG | | 3522 | GEN6_RP_UP_BUSY_AVG | |
3520 | GEN6_RP_DOWN_IDLE_AVG); | 3523 | GEN6_RP_DOWN_IDLE_AVG); |
@@ -5608,8 +5611,8 @@ static bool hsw_power_well_enabled(struct drm_i915_private *dev_priv, | |||
5608 | (HSW_PWR_WELL_ENABLE_REQUEST | HSW_PWR_WELL_STATE_ENABLED); | 5611 | (HSW_PWR_WELL_ENABLE_REQUEST | HSW_PWR_WELL_STATE_ENABLED); |
5609 | } | 5612 | } |
5610 | 5613 | ||
5611 | bool intel_display_power_enabled_sw(struct drm_i915_private *dev_priv, | 5614 | bool intel_display_power_enabled_unlocked(struct drm_i915_private *dev_priv, |
5612 | enum intel_display_power_domain domain) | 5615 | enum intel_display_power_domain domain) |
5613 | { | 5616 | { |
5614 | struct i915_power_domains *power_domains; | 5617 | struct i915_power_domains *power_domains; |
5615 | struct i915_power_well *power_well; | 5618 | struct i915_power_well *power_well; |
@@ -5620,16 +5623,19 @@ bool intel_display_power_enabled_sw(struct drm_i915_private *dev_priv, | |||
5620 | return false; | 5623 | return false; |
5621 | 5624 | ||
5622 | power_domains = &dev_priv->power_domains; | 5625 | power_domains = &dev_priv->power_domains; |
5626 | |||
5623 | is_enabled = true; | 5627 | is_enabled = true; |
5628 | |||
5624 | for_each_power_well_rev(i, power_well, BIT(domain), power_domains) { | 5629 | for_each_power_well_rev(i, power_well, BIT(domain), power_domains) { |
5625 | if (power_well->always_on) | 5630 | if (power_well->always_on) |
5626 | continue; | 5631 | continue; |
5627 | 5632 | ||
5628 | if (!power_well->count) { | 5633 | if (!power_well->hw_enabled) { |
5629 | is_enabled = false; | 5634 | is_enabled = false; |
5630 | break; | 5635 | break; |
5631 | } | 5636 | } |
5632 | } | 5637 | } |
5638 | |||
5633 | return is_enabled; | 5639 | return is_enabled; |
5634 | } | 5640 | } |
5635 | 5641 | ||
@@ -5637,30 +5643,15 @@ bool intel_display_power_enabled(struct drm_i915_private *dev_priv, | |||
5637 | enum intel_display_power_domain domain) | 5643 | enum intel_display_power_domain domain) |
5638 | { | 5644 | { |
5639 | struct i915_power_domains *power_domains; | 5645 | struct i915_power_domains *power_domains; |
5640 | struct i915_power_well *power_well; | 5646 | bool ret; |
5641 | bool is_enabled; | ||
5642 | int i; | ||
5643 | |||
5644 | if (dev_priv->pm.suspended) | ||
5645 | return false; | ||
5646 | 5647 | ||
5647 | power_domains = &dev_priv->power_domains; | 5648 | power_domains = &dev_priv->power_domains; |
5648 | 5649 | ||
5649 | is_enabled = true; | ||
5650 | |||
5651 | mutex_lock(&power_domains->lock); | 5650 | mutex_lock(&power_domains->lock); |
5652 | for_each_power_well_rev(i, power_well, BIT(domain), power_domains) { | 5651 | ret = intel_display_power_enabled_unlocked(dev_priv, domain); |
5653 | if (power_well->always_on) | ||
5654 | continue; | ||
5655 | |||
5656 | if (!power_well->ops->is_enabled(dev_priv, power_well)) { | ||
5657 | is_enabled = false; | ||
5658 | break; | ||
5659 | } | ||
5660 | } | ||
5661 | mutex_unlock(&power_domains->lock); | 5652 | mutex_unlock(&power_domains->lock); |
5662 | 5653 | ||
5663 | return is_enabled; | 5654 | return ret; |
5664 | } | 5655 | } |
5665 | 5656 | ||
5666 | /* | 5657 | /* |
@@ -5981,6 +5972,7 @@ void intel_display_power_get(struct drm_i915_private *dev_priv, | |||
5981 | if (!power_well->count++) { | 5972 | if (!power_well->count++) { |
5982 | DRM_DEBUG_KMS("enabling %s\n", power_well->name); | 5973 | DRM_DEBUG_KMS("enabling %s\n", power_well->name); |
5983 | power_well->ops->enable(dev_priv, power_well); | 5974 | power_well->ops->enable(dev_priv, power_well); |
5975 | power_well->hw_enabled = true; | ||
5984 | } | 5976 | } |
5985 | 5977 | ||
5986 | check_power_well_state(dev_priv, power_well); | 5978 | check_power_well_state(dev_priv, power_well); |
@@ -6010,6 +6002,7 @@ void intel_display_power_put(struct drm_i915_private *dev_priv, | |||
6010 | 6002 | ||
6011 | if (!--power_well->count && i915.disable_power_well) { | 6003 | if (!--power_well->count && i915.disable_power_well) { |
6012 | DRM_DEBUG_KMS("disabling %s\n", power_well->name); | 6004 | DRM_DEBUG_KMS("disabling %s\n", power_well->name); |
6005 | power_well->hw_enabled = false; | ||
6013 | power_well->ops->disable(dev_priv, power_well); | 6006 | power_well->ops->disable(dev_priv, power_well); |
6014 | } | 6007 | } |
6015 | 6008 | ||
@@ -6024,33 +6017,56 @@ void intel_display_power_put(struct drm_i915_private *dev_priv, | |||
6024 | static struct i915_power_domains *hsw_pwr; | 6017 | static struct i915_power_domains *hsw_pwr; |
6025 | 6018 | ||
6026 | /* Display audio driver power well request */ | 6019 | /* Display audio driver power well request */ |
6027 | void i915_request_power_well(void) | 6020 | int i915_request_power_well(void) |
6028 | { | 6021 | { |
6029 | struct drm_i915_private *dev_priv; | 6022 | struct drm_i915_private *dev_priv; |
6030 | 6023 | ||
6031 | if (WARN_ON(!hsw_pwr)) | 6024 | if (!hsw_pwr) |
6032 | return; | 6025 | return -ENODEV; |
6033 | 6026 | ||
6034 | dev_priv = container_of(hsw_pwr, struct drm_i915_private, | 6027 | dev_priv = container_of(hsw_pwr, struct drm_i915_private, |
6035 | power_domains); | 6028 | power_domains); |
6036 | intel_display_power_get(dev_priv, POWER_DOMAIN_AUDIO); | 6029 | intel_display_power_get(dev_priv, POWER_DOMAIN_AUDIO); |
6030 | return 0; | ||
6037 | } | 6031 | } |
6038 | EXPORT_SYMBOL_GPL(i915_request_power_well); | 6032 | EXPORT_SYMBOL_GPL(i915_request_power_well); |
6039 | 6033 | ||
6040 | /* Display audio driver power well release */ | 6034 | /* Display audio driver power well release */ |
6041 | void i915_release_power_well(void) | 6035 | int i915_release_power_well(void) |
6042 | { | 6036 | { |
6043 | struct drm_i915_private *dev_priv; | 6037 | struct drm_i915_private *dev_priv; |
6044 | 6038 | ||
6045 | if (WARN_ON(!hsw_pwr)) | 6039 | if (!hsw_pwr) |
6046 | return; | 6040 | return -ENODEV; |
6047 | 6041 | ||
6048 | dev_priv = container_of(hsw_pwr, struct drm_i915_private, | 6042 | dev_priv = container_of(hsw_pwr, struct drm_i915_private, |
6049 | power_domains); | 6043 | power_domains); |
6050 | intel_display_power_put(dev_priv, POWER_DOMAIN_AUDIO); | 6044 | intel_display_power_put(dev_priv, POWER_DOMAIN_AUDIO); |
6045 | return 0; | ||
6051 | } | 6046 | } |
6052 | EXPORT_SYMBOL_GPL(i915_release_power_well); | 6047 | EXPORT_SYMBOL_GPL(i915_release_power_well); |
6053 | 6048 | ||
6049 | /* | ||
6050 | * Private interface for the audio driver to get CDCLK in kHz. | ||
6051 | * | ||
6052 | * Caller must request power well using i915_request_power_well() prior to | ||
6053 | * making the call. | ||
6054 | */ | ||
6055 | int i915_get_cdclk_freq(void) | ||
6056 | { | ||
6057 | struct drm_i915_private *dev_priv; | ||
6058 | |||
6059 | if (!hsw_pwr) | ||
6060 | return -ENODEV; | ||
6061 | |||
6062 | dev_priv = container_of(hsw_pwr, struct drm_i915_private, | ||
6063 | power_domains); | ||
6064 | |||
6065 | return intel_ddi_get_cdclk_freq(dev_priv); | ||
6066 | } | ||
6067 | EXPORT_SYMBOL_GPL(i915_get_cdclk_freq); | ||
6068 | |||
6069 | |||
6054 | #define POWER_DOMAIN_MASK (BIT(POWER_DOMAIN_NUM) - 1) | 6070 | #define POWER_DOMAIN_MASK (BIT(POWER_DOMAIN_NUM) - 1) |
6055 | 6071 | ||
6056 | #define HSW_ALWAYS_ON_POWER_DOMAINS ( \ | 6072 | #define HSW_ALWAYS_ON_POWER_DOMAINS ( \ |
@@ -6270,8 +6286,11 @@ static void intel_power_domains_resume(struct drm_i915_private *dev_priv) | |||
6270 | int i; | 6286 | int i; |
6271 | 6287 | ||
6272 | mutex_lock(&power_domains->lock); | 6288 | mutex_lock(&power_domains->lock); |
6273 | for_each_power_well(i, power_well, POWER_DOMAIN_MASK, power_domains) | 6289 | for_each_power_well(i, power_well, POWER_DOMAIN_MASK, power_domains) { |
6274 | power_well->ops->sync_hw(dev_priv, power_well); | 6290 | power_well->ops->sync_hw(dev_priv, power_well); |
6291 | power_well->hw_enabled = power_well->ops->is_enabled(dev_priv, | ||
6292 | power_well); | ||
6293 | } | ||
6275 | mutex_unlock(&power_domains->lock); | 6294 | mutex_unlock(&power_domains->lock); |
6276 | } | 6295 | } |
6277 | 6296 | ||
diff --git a/drivers/gpu/drm/i915/intel_ringbuffer.h b/drivers/gpu/drm/i915/intel_ringbuffer.h index 910c83cf7d44..e72017bdcd7f 100644 --- a/drivers/gpu/drm/i915/intel_ringbuffer.h +++ b/drivers/gpu/drm/i915/intel_ringbuffer.h | |||
@@ -55,7 +55,7 @@ struct intel_ring_hangcheck { | |||
55 | u32 seqno; | 55 | u32 seqno; |
56 | int score; | 56 | int score; |
57 | enum intel_ring_hangcheck_action action; | 57 | enum intel_ring_hangcheck_action action; |
58 | bool deadlock; | 58 | int deadlock; |
59 | }; | 59 | }; |
60 | 60 | ||
61 | struct intel_ringbuffer { | 61 | struct intel_ringbuffer { |
diff --git a/drivers/gpu/drm/i915/intel_sdvo.c b/drivers/gpu/drm/i915/intel_sdvo.c index 6a4d5bc17697..20375cc7f82d 100644 --- a/drivers/gpu/drm/i915/intel_sdvo.c +++ b/drivers/gpu/drm/i915/intel_sdvo.c | |||
@@ -1385,7 +1385,9 @@ static void intel_sdvo_get_config(struct intel_encoder *encoder, | |||
1385 | >> SDVO_PORT_MULTIPLY_SHIFT) + 1; | 1385 | >> SDVO_PORT_MULTIPLY_SHIFT) + 1; |
1386 | } | 1386 | } |
1387 | 1387 | ||
1388 | dotclock = pipe_config->port_clock / pipe_config->pixel_multiplier; | 1388 | dotclock = pipe_config->port_clock; |
1389 | if (pipe_config->pixel_multiplier) | ||
1390 | dotclock /= pipe_config->pixel_multiplier; | ||
1389 | 1391 | ||
1390 | if (HAS_PCH_SPLIT(dev)) | 1392 | if (HAS_PCH_SPLIT(dev)) |
1391 | ironlake_check_encoder_dotclock(pipe_config, dotclock); | 1393 | ironlake_check_encoder_dotclock(pipe_config, dotclock); |
diff --git a/drivers/gpu/drm/i915/intel_sprite.c b/drivers/gpu/drm/i915/intel_sprite.c index 1b66ddcdfb33..9a17b4e92ef4 100644 --- a/drivers/gpu/drm/i915/intel_sprite.c +++ b/drivers/gpu/drm/i915/intel_sprite.c | |||
@@ -691,6 +691,14 @@ intel_post_enable_primary(struct drm_crtc *crtc) | |||
691 | struct intel_crtc *intel_crtc = to_intel_crtc(crtc); | 691 | struct intel_crtc *intel_crtc = to_intel_crtc(crtc); |
692 | 692 | ||
693 | /* | 693 | /* |
694 | * BDW signals flip done immediately if the plane | ||
695 | * is disabled, even if the plane enable is already | ||
696 | * armed to occur at the next vblank :( | ||
697 | */ | ||
698 | if (IS_BROADWELL(dev)) | ||
699 | intel_wait_for_vblank(dev, intel_crtc->pipe); | ||
700 | |||
701 | /* | ||
694 | * FIXME IPS should be fine as long as one plane is | 702 | * FIXME IPS should be fine as long as one plane is |
695 | * enabled, but in practice it seems to have problems | 703 | * enabled, but in practice it seems to have problems |
696 | * when going from primary only to sprite only and vice | 704 | * when going from primary only to sprite only and vice |
diff --git a/drivers/gpu/drm/i915/intel_uncore.c b/drivers/gpu/drm/i915/intel_uncore.c index 79cba593df0d..4f6fef7ac069 100644 --- a/drivers/gpu/drm/i915/intel_uncore.c +++ b/drivers/gpu/drm/i915/intel_uncore.c | |||
@@ -320,7 +320,8 @@ static void intel_uncore_forcewake_reset(struct drm_device *dev, bool restore) | |||
320 | struct drm_i915_private *dev_priv = dev->dev_private; | 320 | struct drm_i915_private *dev_priv = dev->dev_private; |
321 | unsigned long irqflags; | 321 | unsigned long irqflags; |
322 | 322 | ||
323 | del_timer_sync(&dev_priv->uncore.force_wake_timer); | 323 | if (del_timer_sync(&dev_priv->uncore.force_wake_timer)) |
324 | gen6_force_wake_timer((unsigned long)dev_priv); | ||
324 | 325 | ||
325 | /* Hold uncore.lock across reset to prevent any register access | 326 | /* Hold uncore.lock across reset to prevent any register access |
326 | * with forcewake not set correctly | 327 | * with forcewake not set correctly |
diff --git a/drivers/gpu/drm/msm/hdmi/hdmi.c b/drivers/gpu/drm/msm/hdmi/hdmi.c index ae750f6928c1..7f7aadef8a82 100644 --- a/drivers/gpu/drm/msm/hdmi/hdmi.c +++ b/drivers/gpu/drm/msm/hdmi/hdmi.c | |||
@@ -277,6 +277,7 @@ static int hdmi_bind(struct device *dev, struct device *master, void *data) | |||
277 | static const char *hpd_reg_names[] = {"hpd-gdsc", "hpd-5v"}; | 277 | static const char *hpd_reg_names[] = {"hpd-gdsc", "hpd-5v"}; |
278 | static const char *pwr_reg_names[] = {"core-vdda", "core-vcc"}; | 278 | static const char *pwr_reg_names[] = {"core-vdda", "core-vcc"}; |
279 | static const char *hpd_clk_names[] = {"iface_clk", "core_clk", "mdp_core_clk"}; | 279 | static const char *hpd_clk_names[] = {"iface_clk", "core_clk", "mdp_core_clk"}; |
280 | static unsigned long hpd_clk_freq[] = {0, 19200000, 0}; | ||
280 | static const char *pwr_clk_names[] = {"extp_clk", "alt_iface_clk"}; | 281 | static const char *pwr_clk_names[] = {"extp_clk", "alt_iface_clk"}; |
281 | 282 | ||
282 | config.phy_init = hdmi_phy_8x74_init; | 283 | config.phy_init = hdmi_phy_8x74_init; |
@@ -286,6 +287,7 @@ static int hdmi_bind(struct device *dev, struct device *master, void *data) | |||
286 | config.pwr_reg_names = pwr_reg_names; | 287 | config.pwr_reg_names = pwr_reg_names; |
287 | config.pwr_reg_cnt = ARRAY_SIZE(pwr_reg_names); | 288 | config.pwr_reg_cnt = ARRAY_SIZE(pwr_reg_names); |
288 | config.hpd_clk_names = hpd_clk_names; | 289 | config.hpd_clk_names = hpd_clk_names; |
290 | config.hpd_freq = hpd_clk_freq; | ||
289 | config.hpd_clk_cnt = ARRAY_SIZE(hpd_clk_names); | 291 | config.hpd_clk_cnt = ARRAY_SIZE(hpd_clk_names); |
290 | config.pwr_clk_names = pwr_clk_names; | 292 | config.pwr_clk_names = pwr_clk_names; |
291 | config.pwr_clk_cnt = ARRAY_SIZE(pwr_clk_names); | 293 | config.pwr_clk_cnt = ARRAY_SIZE(pwr_clk_names); |
diff --git a/drivers/gpu/drm/msm/hdmi/hdmi.h b/drivers/gpu/drm/msm/hdmi/hdmi.h index 9fafee6a3e43..9d7723c6528a 100644 --- a/drivers/gpu/drm/msm/hdmi/hdmi.h +++ b/drivers/gpu/drm/msm/hdmi/hdmi.h | |||
@@ -87,6 +87,7 @@ struct hdmi_platform_config { | |||
87 | 87 | ||
88 | /* clks that need to be on for hpd: */ | 88 | /* clks that need to be on for hpd: */ |
89 | const char **hpd_clk_names; | 89 | const char **hpd_clk_names; |
90 | const long unsigned *hpd_freq; | ||
90 | int hpd_clk_cnt; | 91 | int hpd_clk_cnt; |
91 | 92 | ||
92 | /* clks that need to be on for screen pwr (ie pixel clk): */ | 93 | /* clks that need to be on for screen pwr (ie pixel clk): */ |
diff --git a/drivers/gpu/drm/msm/hdmi/hdmi_connector.c b/drivers/gpu/drm/msm/hdmi/hdmi_connector.c index e56a6196867c..28f7e3ec6c28 100644 --- a/drivers/gpu/drm/msm/hdmi/hdmi_connector.c +++ b/drivers/gpu/drm/msm/hdmi/hdmi_connector.c | |||
@@ -127,6 +127,14 @@ static int hpd_enable(struct hdmi_connector *hdmi_connector) | |||
127 | } | 127 | } |
128 | 128 | ||
129 | for (i = 0; i < config->hpd_clk_cnt; i++) { | 129 | for (i = 0; i < config->hpd_clk_cnt; i++) { |
130 | if (config->hpd_freq && config->hpd_freq[i]) { | ||
131 | ret = clk_set_rate(hdmi->hpd_clks[i], | ||
132 | config->hpd_freq[i]); | ||
133 | if (ret) | ||
134 | dev_warn(dev->dev, "failed to set clk %s (%d)\n", | ||
135 | config->hpd_clk_names[i], ret); | ||
136 | } | ||
137 | |||
130 | ret = clk_prepare_enable(hdmi->hpd_clks[i]); | 138 | ret = clk_prepare_enable(hdmi->hpd_clks[i]); |
131 | if (ret) { | 139 | if (ret) { |
132 | dev_err(dev->dev, "failed to enable hpd clk: %s (%d)\n", | 140 | dev_err(dev->dev, "failed to enable hpd clk: %s (%d)\n", |
diff --git a/drivers/gpu/drm/msm/mdp/mdp5/mdp5_kms.c b/drivers/gpu/drm/msm/mdp/mdp5/mdp5_kms.c index 42caf7fcb0b9..71510ee26e96 100644 --- a/drivers/gpu/drm/msm/mdp/mdp5/mdp5_kms.c +++ b/drivers/gpu/drm/msm/mdp/mdp5/mdp5_kms.c | |||
@@ -20,6 +20,10 @@ | |||
20 | #include "msm_mmu.h" | 20 | #include "msm_mmu.h" |
21 | #include "mdp5_kms.h" | 21 | #include "mdp5_kms.h" |
22 | 22 | ||
23 | static const char *iommu_ports[] = { | ||
24 | "mdp_0", | ||
25 | }; | ||
26 | |||
23 | static struct mdp5_platform_config *mdp5_get_config(struct platform_device *dev); | 27 | static struct mdp5_platform_config *mdp5_get_config(struct platform_device *dev); |
24 | 28 | ||
25 | static int mdp5_hw_init(struct msm_kms *kms) | 29 | static int mdp5_hw_init(struct msm_kms *kms) |
@@ -104,6 +108,12 @@ static void mdp5_preclose(struct msm_kms *kms, struct drm_file *file) | |||
104 | static void mdp5_destroy(struct msm_kms *kms) | 108 | static void mdp5_destroy(struct msm_kms *kms) |
105 | { | 109 | { |
106 | struct mdp5_kms *mdp5_kms = to_mdp5_kms(to_mdp_kms(kms)); | 110 | struct mdp5_kms *mdp5_kms = to_mdp5_kms(to_mdp_kms(kms)); |
111 | struct msm_mmu *mmu = mdp5_kms->mmu; | ||
112 | |||
113 | if (mmu) { | ||
114 | mmu->funcs->detach(mmu, iommu_ports, ARRAY_SIZE(iommu_ports)); | ||
115 | mmu->funcs->destroy(mmu); | ||
116 | } | ||
107 | kfree(mdp5_kms); | 117 | kfree(mdp5_kms); |
108 | } | 118 | } |
109 | 119 | ||
@@ -216,10 +226,6 @@ fail: | |||
216 | return ret; | 226 | return ret; |
217 | } | 227 | } |
218 | 228 | ||
219 | static const char *iommu_ports[] = { | ||
220 | "mdp_0", | ||
221 | }; | ||
222 | |||
223 | static int get_clk(struct platform_device *pdev, struct clk **clkp, | 229 | static int get_clk(struct platform_device *pdev, struct clk **clkp, |
224 | const char *name) | 230 | const char *name) |
225 | { | 231 | { |
@@ -317,17 +323,23 @@ struct msm_kms *mdp5_kms_init(struct drm_device *dev) | |||
317 | mmu = msm_iommu_new(dev, config->iommu); | 323 | mmu = msm_iommu_new(dev, config->iommu); |
318 | if (IS_ERR(mmu)) { | 324 | if (IS_ERR(mmu)) { |
319 | ret = PTR_ERR(mmu); | 325 | ret = PTR_ERR(mmu); |
326 | dev_err(dev->dev, "failed to init iommu: %d\n", ret); | ||
320 | goto fail; | 327 | goto fail; |
321 | } | 328 | } |
329 | |||
322 | ret = mmu->funcs->attach(mmu, iommu_ports, | 330 | ret = mmu->funcs->attach(mmu, iommu_ports, |
323 | ARRAY_SIZE(iommu_ports)); | 331 | ARRAY_SIZE(iommu_ports)); |
324 | if (ret) | 332 | if (ret) { |
333 | dev_err(dev->dev, "failed to attach iommu: %d\n", ret); | ||
334 | mmu->funcs->destroy(mmu); | ||
325 | goto fail; | 335 | goto fail; |
336 | } | ||
326 | } else { | 337 | } else { |
327 | dev_info(dev->dev, "no iommu, fallback to phys " | 338 | dev_info(dev->dev, "no iommu, fallback to phys " |
328 | "contig buffers for scanout\n"); | 339 | "contig buffers for scanout\n"); |
329 | mmu = NULL; | 340 | mmu = NULL; |
330 | } | 341 | } |
342 | mdp5_kms->mmu = mmu; | ||
331 | 343 | ||
332 | mdp5_kms->id = msm_register_mmu(dev, mmu); | 344 | mdp5_kms->id = msm_register_mmu(dev, mmu); |
333 | if (mdp5_kms->id < 0) { | 345 | if (mdp5_kms->id < 0) { |
diff --git a/drivers/gpu/drm/msm/mdp/mdp5/mdp5_kms.h b/drivers/gpu/drm/msm/mdp/mdp5/mdp5_kms.h index c8b1a2522c25..6e981b692d1d 100644 --- a/drivers/gpu/drm/msm/mdp/mdp5/mdp5_kms.h +++ b/drivers/gpu/drm/msm/mdp/mdp5/mdp5_kms.h | |||
@@ -33,6 +33,7 @@ struct mdp5_kms { | |||
33 | 33 | ||
34 | /* mapper-id used to request GEM buffer mapped for scanout: */ | 34 | /* mapper-id used to request GEM buffer mapped for scanout: */ |
35 | int id; | 35 | int id; |
36 | struct msm_mmu *mmu; | ||
36 | 37 | ||
37 | /* for tracking smp allocation amongst pipes: */ | 38 | /* for tracking smp allocation amongst pipes: */ |
38 | mdp5_smp_state_t smp_state; | 39 | mdp5_smp_state_t smp_state; |
diff --git a/drivers/gpu/drm/msm/msm_drv.c b/drivers/gpu/drm/msm/msm_drv.c index 0d2562fb681e..9a5d87db5c23 100644 --- a/drivers/gpu/drm/msm/msm_drv.c +++ b/drivers/gpu/drm/msm/msm_drv.c | |||
@@ -159,7 +159,7 @@ static int msm_unload(struct drm_device *dev) | |||
159 | static int get_mdp_ver(struct platform_device *pdev) | 159 | static int get_mdp_ver(struct platform_device *pdev) |
160 | { | 160 | { |
161 | #ifdef CONFIG_OF | 161 | #ifdef CONFIG_OF |
162 | const static struct of_device_id match_types[] = { { | 162 | static const struct of_device_id match_types[] = { { |
163 | .compatible = "qcom,mdss_mdp", | 163 | .compatible = "qcom,mdss_mdp", |
164 | .data = (void *)5, | 164 | .data = (void *)5, |
165 | }, { | 165 | }, { |
diff --git a/drivers/gpu/drm/msm/msm_fbdev.c b/drivers/gpu/drm/msm/msm_fbdev.c index a752ab83b810..5107fc4826bc 100644 --- a/drivers/gpu/drm/msm/msm_fbdev.c +++ b/drivers/gpu/drm/msm/msm_fbdev.c | |||
@@ -59,7 +59,7 @@ static int msm_fbdev_create(struct drm_fb_helper *helper, | |||
59 | struct drm_framebuffer *fb = NULL; | 59 | struct drm_framebuffer *fb = NULL; |
60 | struct fb_info *fbi = NULL; | 60 | struct fb_info *fbi = NULL; |
61 | struct drm_mode_fb_cmd2 mode_cmd = {0}; | 61 | struct drm_mode_fb_cmd2 mode_cmd = {0}; |
62 | dma_addr_t paddr; | 62 | uint32_t paddr; |
63 | int ret, size; | 63 | int ret, size; |
64 | 64 | ||
65 | sizes->surface_bpp = 32; | 65 | sizes->surface_bpp = 32; |
diff --git a/drivers/gpu/drm/msm/msm_gem.c b/drivers/gpu/drm/msm/msm_gem.c index bb8026daebc9..690d7e7b6d1e 100644 --- a/drivers/gpu/drm/msm/msm_gem.c +++ b/drivers/gpu/drm/msm/msm_gem.c | |||
@@ -278,6 +278,7 @@ int msm_gem_get_iova_locked(struct drm_gem_object *obj, int id, | |||
278 | uint32_t *iova) | 278 | uint32_t *iova) |
279 | { | 279 | { |
280 | struct msm_gem_object *msm_obj = to_msm_bo(obj); | 280 | struct msm_gem_object *msm_obj = to_msm_bo(obj); |
281 | struct drm_device *dev = obj->dev; | ||
281 | int ret = 0; | 282 | int ret = 0; |
282 | 283 | ||
283 | if (!msm_obj->domain[id].iova) { | 284 | if (!msm_obj->domain[id].iova) { |
@@ -285,6 +286,11 @@ int msm_gem_get_iova_locked(struct drm_gem_object *obj, int id, | |||
285 | struct msm_mmu *mmu = priv->mmus[id]; | 286 | struct msm_mmu *mmu = priv->mmus[id]; |
286 | struct page **pages = get_pages(obj); | 287 | struct page **pages = get_pages(obj); |
287 | 288 | ||
289 | if (!mmu) { | ||
290 | dev_err(dev->dev, "null MMU pointer\n"); | ||
291 | return -EINVAL; | ||
292 | } | ||
293 | |||
288 | if (IS_ERR(pages)) | 294 | if (IS_ERR(pages)) |
289 | return PTR_ERR(pages); | 295 | return PTR_ERR(pages); |
290 | 296 | ||
diff --git a/drivers/gpu/drm/msm/msm_iommu.c b/drivers/gpu/drm/msm/msm_iommu.c index 92b745986231..4b2ad9181edf 100644 --- a/drivers/gpu/drm/msm/msm_iommu.c +++ b/drivers/gpu/drm/msm/msm_iommu.c | |||
@@ -28,7 +28,7 @@ static int msm_fault_handler(struct iommu_domain *iommu, struct device *dev, | |||
28 | unsigned long iova, int flags, void *arg) | 28 | unsigned long iova, int flags, void *arg) |
29 | { | 29 | { |
30 | DBG("*** fault: iova=%08lx, flags=%d", iova, flags); | 30 | DBG("*** fault: iova=%08lx, flags=%d", iova, flags); |
31 | return 0; | 31 | return -ENOSYS; |
32 | } | 32 | } |
33 | 33 | ||
34 | static int msm_iommu_attach(struct msm_mmu *mmu, const char **names, int cnt) | 34 | static int msm_iommu_attach(struct msm_mmu *mmu, const char **names, int cnt) |
@@ -40,8 +40,10 @@ static int msm_iommu_attach(struct msm_mmu *mmu, const char **names, int cnt) | |||
40 | for (i = 0; i < cnt; i++) { | 40 | for (i = 0; i < cnt; i++) { |
41 | struct device *msm_iommu_get_ctx(const char *ctx_name); | 41 | struct device *msm_iommu_get_ctx(const char *ctx_name); |
42 | struct device *ctx = msm_iommu_get_ctx(names[i]); | 42 | struct device *ctx = msm_iommu_get_ctx(names[i]); |
43 | if (IS_ERR_OR_NULL(ctx)) | 43 | if (IS_ERR_OR_NULL(ctx)) { |
44 | dev_warn(dev->dev, "couldn't get %s context", names[i]); | ||
44 | continue; | 45 | continue; |
46 | } | ||
45 | ret = iommu_attach_device(iommu->domain, ctx); | 47 | ret = iommu_attach_device(iommu->domain, ctx); |
46 | if (ret) { | 48 | if (ret) { |
47 | dev_warn(dev->dev, "could not attach iommu to %s", names[i]); | 49 | dev_warn(dev->dev, "could not attach iommu to %s", names[i]); |
@@ -52,6 +54,20 @@ static int msm_iommu_attach(struct msm_mmu *mmu, const char **names, int cnt) | |||
52 | return 0; | 54 | return 0; |
53 | } | 55 | } |
54 | 56 | ||
57 | static void msm_iommu_detach(struct msm_mmu *mmu, const char **names, int cnt) | ||
58 | { | ||
59 | struct msm_iommu *iommu = to_msm_iommu(mmu); | ||
60 | int i; | ||
61 | |||
62 | for (i = 0; i < cnt; i++) { | ||
63 | struct device *msm_iommu_get_ctx(const char *ctx_name); | ||
64 | struct device *ctx = msm_iommu_get_ctx(names[i]); | ||
65 | if (IS_ERR_OR_NULL(ctx)) | ||
66 | continue; | ||
67 | iommu_detach_device(iommu->domain, ctx); | ||
68 | } | ||
69 | } | ||
70 | |||
55 | static int msm_iommu_map(struct msm_mmu *mmu, uint32_t iova, | 71 | static int msm_iommu_map(struct msm_mmu *mmu, uint32_t iova, |
56 | struct sg_table *sgt, unsigned len, int prot) | 72 | struct sg_table *sgt, unsigned len, int prot) |
57 | { | 73 | { |
@@ -110,7 +126,7 @@ static int msm_iommu_unmap(struct msm_mmu *mmu, uint32_t iova, | |||
110 | 126 | ||
111 | VERB("unmap[%d]: %08x(%x)", i, iova, bytes); | 127 | VERB("unmap[%d]: %08x(%x)", i, iova, bytes); |
112 | 128 | ||
113 | BUG_ON(!IS_ALIGNED(bytes, PAGE_SIZE)); | 129 | BUG_ON(!PAGE_ALIGNED(bytes)); |
114 | 130 | ||
115 | da += bytes; | 131 | da += bytes; |
116 | } | 132 | } |
@@ -127,6 +143,7 @@ static void msm_iommu_destroy(struct msm_mmu *mmu) | |||
127 | 143 | ||
128 | static const struct msm_mmu_funcs funcs = { | 144 | static const struct msm_mmu_funcs funcs = { |
129 | .attach = msm_iommu_attach, | 145 | .attach = msm_iommu_attach, |
146 | .detach = msm_iommu_detach, | ||
130 | .map = msm_iommu_map, | 147 | .map = msm_iommu_map, |
131 | .unmap = msm_iommu_unmap, | 148 | .unmap = msm_iommu_unmap, |
132 | .destroy = msm_iommu_destroy, | 149 | .destroy = msm_iommu_destroy, |
diff --git a/drivers/gpu/drm/msm/msm_mmu.h b/drivers/gpu/drm/msm/msm_mmu.h index 030324482b4a..21da6d154f71 100644 --- a/drivers/gpu/drm/msm/msm_mmu.h +++ b/drivers/gpu/drm/msm/msm_mmu.h | |||
@@ -22,6 +22,7 @@ | |||
22 | 22 | ||
23 | struct msm_mmu_funcs { | 23 | struct msm_mmu_funcs { |
24 | int (*attach)(struct msm_mmu *mmu, const char **names, int cnt); | 24 | int (*attach)(struct msm_mmu *mmu, const char **names, int cnt); |
25 | void (*detach)(struct msm_mmu *mmu, const char **names, int cnt); | ||
25 | int (*map)(struct msm_mmu *mmu, uint32_t iova, struct sg_table *sgt, | 26 | int (*map)(struct msm_mmu *mmu, uint32_t iova, struct sg_table *sgt, |
26 | unsigned len, int prot); | 27 | unsigned len, int prot); |
27 | int (*unmap)(struct msm_mmu *mmu, uint32_t iova, struct sg_table *sgt, | 28 | int (*unmap)(struct msm_mmu *mmu, uint32_t iova, struct sg_table *sgt, |
diff --git a/drivers/gpu/drm/nouveau/Makefile b/drivers/gpu/drm/nouveau/Makefile index 2b6156d0e4b5..8b307e143632 100644 --- a/drivers/gpu/drm/nouveau/Makefile +++ b/drivers/gpu/drm/nouveau/Makefile | |||
@@ -140,6 +140,7 @@ nouveau-y += core/subdev/i2c/nv4e.o | |||
140 | nouveau-y += core/subdev/i2c/nv50.o | 140 | nouveau-y += core/subdev/i2c/nv50.o |
141 | nouveau-y += core/subdev/i2c/nv94.o | 141 | nouveau-y += core/subdev/i2c/nv94.o |
142 | nouveau-y += core/subdev/i2c/nvd0.o | 142 | nouveau-y += core/subdev/i2c/nvd0.o |
143 | nouveau-y += core/subdev/i2c/gf117.o | ||
143 | nouveau-y += core/subdev/i2c/nve0.o | 144 | nouveau-y += core/subdev/i2c/nve0.o |
144 | nouveau-y += core/subdev/ibus/nvc0.o | 145 | nouveau-y += core/subdev/ibus/nvc0.o |
145 | nouveau-y += core/subdev/ibus/nve0.o | 146 | nouveau-y += core/subdev/ibus/nve0.o |
diff --git a/drivers/gpu/drm/nouveau/core/engine/device/nvc0.c b/drivers/gpu/drm/nouveau/core/engine/device/nvc0.c index f199957995fa..8d55ed633b19 100644 --- a/drivers/gpu/drm/nouveau/core/engine/device/nvc0.c +++ b/drivers/gpu/drm/nouveau/core/engine/device/nvc0.c | |||
@@ -314,7 +314,7 @@ nvc0_identify(struct nouveau_device *device) | |||
314 | device->cname = "GF117"; | 314 | device->cname = "GF117"; |
315 | device->oclass[NVDEV_SUBDEV_VBIOS ] = &nouveau_bios_oclass; | 315 | device->oclass[NVDEV_SUBDEV_VBIOS ] = &nouveau_bios_oclass; |
316 | device->oclass[NVDEV_SUBDEV_GPIO ] = nvd0_gpio_oclass; | 316 | device->oclass[NVDEV_SUBDEV_GPIO ] = nvd0_gpio_oclass; |
317 | device->oclass[NVDEV_SUBDEV_I2C ] = nvd0_i2c_oclass; | 317 | device->oclass[NVDEV_SUBDEV_I2C ] = gf117_i2c_oclass; |
318 | device->oclass[NVDEV_SUBDEV_CLOCK ] = &nvc0_clock_oclass; | 318 | device->oclass[NVDEV_SUBDEV_CLOCK ] = &nvc0_clock_oclass; |
319 | device->oclass[NVDEV_SUBDEV_THERM ] = &nvd0_therm_oclass; | 319 | device->oclass[NVDEV_SUBDEV_THERM ] = &nvd0_therm_oclass; |
320 | device->oclass[NVDEV_SUBDEV_MXM ] = &nv50_mxm_oclass; | 320 | device->oclass[NVDEV_SUBDEV_MXM ] = &nv50_mxm_oclass; |
diff --git a/drivers/gpu/drm/nouveau/core/engine/disp/base.c b/drivers/gpu/drm/nouveau/core/engine/disp/base.c index c41f656abe64..9c38c5e40500 100644 --- a/drivers/gpu/drm/nouveau/core/engine/disp/base.c +++ b/drivers/gpu/drm/nouveau/core/engine/disp/base.c | |||
@@ -99,8 +99,10 @@ _nouveau_disp_dtor(struct nouveau_object *object) | |||
99 | 99 | ||
100 | nouveau_event_destroy(&disp->vblank); | 100 | nouveau_event_destroy(&disp->vblank); |
101 | 101 | ||
102 | list_for_each_entry_safe(outp, outt, &disp->outp, head) { | 102 | if (disp->outp.next) { |
103 | nouveau_object_ref(NULL, (struct nouveau_object **)&outp); | 103 | list_for_each_entry_safe(outp, outt, &disp->outp, head) { |
104 | nouveau_object_ref(NULL, (struct nouveau_object **)&outp); | ||
105 | } | ||
104 | } | 106 | } |
105 | 107 | ||
106 | nouveau_engine_destroy(&disp->base); | 108 | nouveau_engine_destroy(&disp->base); |
diff --git a/drivers/gpu/drm/nouveau/core/engine/disp/dport.c b/drivers/gpu/drm/nouveau/core/engine/disp/dport.c index 39562d48101d..5a5b59b21130 100644 --- a/drivers/gpu/drm/nouveau/core/engine/disp/dport.c +++ b/drivers/gpu/drm/nouveau/core/engine/disp/dport.c | |||
@@ -241,7 +241,9 @@ dp_link_train_eq(struct dp_state *dp) | |||
241 | dp_set_training_pattern(dp, 2); | 241 | dp_set_training_pattern(dp, 2); |
242 | 242 | ||
243 | do { | 243 | do { |
244 | if (dp_link_train_update(dp, dp->pc2, 400)) | 244 | if ((tries && |
245 | dp_link_train_commit(dp, dp->pc2)) || | ||
246 | dp_link_train_update(dp, dp->pc2, 400)) | ||
245 | break; | 247 | break; |
246 | 248 | ||
247 | eq_done = !!(dp->stat[2] & DPCD_LS04_INTERLANE_ALIGN_DONE); | 249 | eq_done = !!(dp->stat[2] & DPCD_LS04_INTERLANE_ALIGN_DONE); |
@@ -253,9 +255,6 @@ dp_link_train_eq(struct dp_state *dp) | |||
253 | !(lane & DPCD_LS02_LANE0_SYMBOL_LOCKED)) | 255 | !(lane & DPCD_LS02_LANE0_SYMBOL_LOCKED)) |
254 | eq_done = false; | 256 | eq_done = false; |
255 | } | 257 | } |
256 | |||
257 | if (dp_link_train_commit(dp, dp->pc2)) | ||
258 | break; | ||
259 | } while (!eq_done && cr_done && ++tries <= 5); | 258 | } while (!eq_done && cr_done && ++tries <= 5); |
260 | 259 | ||
261 | return eq_done ? 0 : -1; | 260 | return eq_done ? 0 : -1; |
diff --git a/drivers/gpu/drm/nouveau/core/engine/disp/nv50.c b/drivers/gpu/drm/nouveau/core/engine/disp/nv50.c index 1e85f36c705f..2283c442a10d 100644 --- a/drivers/gpu/drm/nouveau/core/engine/disp/nv50.c +++ b/drivers/gpu/drm/nouveau/core/engine/disp/nv50.c | |||
@@ -1270,7 +1270,7 @@ exec_clkcmp(struct nv50_disp_priv *priv, int head, int id, u32 pclk, u32 *conf) | |||
1270 | i--; | 1270 | i--; |
1271 | 1271 | ||
1272 | outp = exec_lookup(priv, head, i, ctrl, &data, &ver, &hdr, &cnt, &len, &info1); | 1272 | outp = exec_lookup(priv, head, i, ctrl, &data, &ver, &hdr, &cnt, &len, &info1); |
1273 | if (!data) | 1273 | if (!outp) |
1274 | return NULL; | 1274 | return NULL; |
1275 | 1275 | ||
1276 | if (outp->info.location == 0) { | 1276 | if (outp->info.location == 0) { |
@@ -1516,11 +1516,11 @@ nv50_disp_intr_unk20_2(struct nv50_disp_priv *priv, int head) | |||
1516 | } | 1516 | } |
1517 | 1517 | ||
1518 | switch ((ctrl & 0x000f0000) >> 16) { | 1518 | switch ((ctrl & 0x000f0000) >> 16) { |
1519 | case 6: datarate = pclk * 30 / 8; break; | 1519 | case 6: datarate = pclk * 30; break; |
1520 | case 5: datarate = pclk * 24 / 8; break; | 1520 | case 5: datarate = pclk * 24; break; |
1521 | case 2: | 1521 | case 2: |
1522 | default: | 1522 | default: |
1523 | datarate = pclk * 18 / 8; | 1523 | datarate = pclk * 18; |
1524 | break; | 1524 | break; |
1525 | } | 1525 | } |
1526 | 1526 | ||
diff --git a/drivers/gpu/drm/nouveau/core/engine/disp/nvd0.c b/drivers/gpu/drm/nouveau/core/engine/disp/nvd0.c index 48aa38a87e3f..fa30d8196f35 100644 --- a/drivers/gpu/drm/nouveau/core/engine/disp/nvd0.c +++ b/drivers/gpu/drm/nouveau/core/engine/disp/nvd0.c | |||
@@ -1159,11 +1159,11 @@ nvd0_disp_intr_unk2_2(struct nv50_disp_priv *priv, int head) | |||
1159 | if (outp->info.type == DCB_OUTPUT_DP) { | 1159 | if (outp->info.type == DCB_OUTPUT_DP) { |
1160 | u32 sync = nv_rd32(priv, 0x660404 + (head * 0x300)); | 1160 | u32 sync = nv_rd32(priv, 0x660404 + (head * 0x300)); |
1161 | switch ((sync & 0x000003c0) >> 6) { | 1161 | switch ((sync & 0x000003c0) >> 6) { |
1162 | case 6: pclk = pclk * 30 / 8; break; | 1162 | case 6: pclk = pclk * 30; break; |
1163 | case 5: pclk = pclk * 24 / 8; break; | 1163 | case 5: pclk = pclk * 24; break; |
1164 | case 2: | 1164 | case 2: |
1165 | default: | 1165 | default: |
1166 | pclk = pclk * 18 / 8; | 1166 | pclk = pclk * 18; |
1167 | break; | 1167 | break; |
1168 | } | 1168 | } |
1169 | 1169 | ||
diff --git a/drivers/gpu/drm/nouveau/core/engine/disp/outpdp.c b/drivers/gpu/drm/nouveau/core/engine/disp/outpdp.c index 52c299c3d300..eb2d7789555d 100644 --- a/drivers/gpu/drm/nouveau/core/engine/disp/outpdp.c +++ b/drivers/gpu/drm/nouveau/core/engine/disp/outpdp.c | |||
@@ -34,7 +34,7 @@ nvkm_output_dp_train(struct nvkm_output *base, u32 datarate, bool wait) | |||
34 | struct nvkm_output_dp *outp = (void *)base; | 34 | struct nvkm_output_dp *outp = (void *)base; |
35 | bool retrain = true; | 35 | bool retrain = true; |
36 | u8 link[2], stat[3]; | 36 | u8 link[2], stat[3]; |
37 | u32 rate; | 37 | u32 linkrate; |
38 | int ret, i; | 38 | int ret, i; |
39 | 39 | ||
40 | /* check that the link is trained at a high enough rate */ | 40 | /* check that the link is trained at a high enough rate */ |
@@ -44,8 +44,10 @@ nvkm_output_dp_train(struct nvkm_output *base, u32 datarate, bool wait) | |||
44 | goto done; | 44 | goto done; |
45 | } | 45 | } |
46 | 46 | ||
47 | rate = link[0] * 27000 * (link[1] & DPCD_LC01_LANE_COUNT_SET); | 47 | linkrate = link[0] * 27000 * (link[1] & DPCD_LC01_LANE_COUNT_SET); |
48 | if (rate < ((datarate / 8) * 10)) { | 48 | linkrate = (linkrate * 8) / 10; /* 8B/10B coding overhead */ |
49 | datarate = (datarate + 9) / 10; /* -> decakilobits */ | ||
50 | if (linkrate < datarate) { | ||
49 | DBG("link not trained at sufficient rate\n"); | 51 | DBG("link not trained at sufficient rate\n"); |
50 | goto done; | 52 | goto done; |
51 | } | 53 | } |
diff --git a/drivers/gpu/drm/nouveau/core/engine/disp/sornv50.c b/drivers/gpu/drm/nouveau/core/engine/disp/sornv50.c index e1832778e8b6..7a1ebdfa9e1b 100644 --- a/drivers/gpu/drm/nouveau/core/engine/disp/sornv50.c +++ b/drivers/gpu/drm/nouveau/core/engine/disp/sornv50.c | |||
@@ -87,6 +87,7 @@ nv50_sor_mthd(struct nouveau_object *object, u32 mthd, void *args, u32 size) | |||
87 | struct nvkm_output_dp *outpdp = (void *)outp; | 87 | struct nvkm_output_dp *outpdp = (void *)outp; |
88 | switch (data) { | 88 | switch (data) { |
89 | case NV94_DISP_SOR_DP_PWR_STATE_OFF: | 89 | case NV94_DISP_SOR_DP_PWR_STATE_OFF: |
90 | nouveau_event_put(outpdp->irq); | ||
90 | ((struct nvkm_output_dp_impl *)nv_oclass(outp)) | 91 | ((struct nvkm_output_dp_impl *)nv_oclass(outp)) |
91 | ->lnk_pwr(outpdp, 0); | 92 | ->lnk_pwr(outpdp, 0); |
92 | atomic_set(&outpdp->lt.done, 0); | 93 | atomic_set(&outpdp->lt.done, 0); |
diff --git a/drivers/gpu/drm/nouveau/core/engine/graph/fuc/gpc.fuc b/drivers/gpu/drm/nouveau/core/engine/graph/fuc/gpc.fuc index 2f7345f7fe07..7445f12b1d9e 100644 --- a/drivers/gpu/drm/nouveau/core/engine/graph/fuc/gpc.fuc +++ b/drivers/gpu/drm/nouveau/core/engine/graph/fuc/gpc.fuc | |||
@@ -54,7 +54,7 @@ mmio_list_base: | |||
54 | #ifdef INCLUDE_CODE | 54 | #ifdef INCLUDE_CODE |
55 | // reports an exception to the host | 55 | // reports an exception to the host |
56 | // | 56 | // |
57 | // In: $r15 error code (see nvc0.fuc) | 57 | // In: $r15 error code (see os.h) |
58 | // | 58 | // |
59 | error: | 59 | error: |
60 | push $r14 | 60 | push $r14 |
diff --git a/drivers/gpu/drm/nouveau/core/engine/graph/fuc/hub.fuc b/drivers/gpu/drm/nouveau/core/engine/graph/fuc/hub.fuc index c8ddb8d71b91..b4ad18bf5a26 100644 --- a/drivers/gpu/drm/nouveau/core/engine/graph/fuc/hub.fuc +++ b/drivers/gpu/drm/nouveau/core/engine/graph/fuc/hub.fuc | |||
@@ -49,7 +49,7 @@ hub_mmio_list_next: | |||
49 | #ifdef INCLUDE_CODE | 49 | #ifdef INCLUDE_CODE |
50 | // reports an exception to the host | 50 | // reports an exception to the host |
51 | // | 51 | // |
52 | // In: $r15 error code (see nvc0.fuc) | 52 | // In: $r15 error code (see os.h) |
53 | // | 53 | // |
54 | error: | 54 | error: |
55 | nv_iowr(NV_PGRAPH_FECS_CC_SCRATCH_VAL(5), 0, $r15) | 55 | nv_iowr(NV_PGRAPH_FECS_CC_SCRATCH_VAL(5), 0, $r15) |
@@ -343,13 +343,25 @@ ih: | |||
343 | ih_no_ctxsw: | 343 | ih_no_ctxsw: |
344 | and $r11 $r10 NV_PGRAPH_FECS_INTR_FWMTHD | 344 | and $r11 $r10 NV_PGRAPH_FECS_INTR_FWMTHD |
345 | bra e #ih_no_fwmthd | 345 | bra e #ih_no_fwmthd |
346 | // none we handle, ack, and fall-through to unhandled | 346 | // none we handle; report to host and ack |
347 | nv_rd32($r15, NV_PGRAPH_TRAPPED_DATA_LO) | ||
348 | nv_iowr(NV_PGRAPH_FECS_CC_SCRATCH_VAL(4), 0, $r15) | ||
349 | nv_rd32($r15, NV_PGRAPH_TRAPPED_ADDR) | ||
350 | nv_iowr(NV_PGRAPH_FECS_CC_SCRATCH_VAL(3), 0, $r15) | ||
351 | extr $r14 $r15 16:18 | ||
352 | shl b32 $r14 $r14 2 | ||
353 | imm32($r15, NV_PGRAPH_FE_OBJECT_TABLE(0)) | ||
354 | add b32 $r14 $r15 | ||
355 | call(nv_rd32) | ||
356 | nv_iowr(NV_PGRAPH_FECS_CC_SCRATCH_VAL(2), 0, $r15) | ||
357 | mov $r15 E_BAD_FWMTHD | ||
358 | call(error) | ||
347 | mov $r11 0x100 | 359 | mov $r11 0x100 |
348 | nv_wr32(0x400144, $r11) | 360 | nv_wr32(0x400144, $r11) |
349 | 361 | ||
350 | // anything we didn't handle, bring it to the host's attention | 362 | // anything we didn't handle, bring it to the host's attention |
351 | ih_no_fwmthd: | 363 | ih_no_fwmthd: |
352 | mov $r11 0x104 // FIFO | CHSW | 364 | mov $r11 0x504 // FIFO | CHSW | FWMTHD |
353 | not b32 $r11 | 365 | not b32 $r11 |
354 | and $r11 $r10 $r11 | 366 | and $r11 $r10 $r11 |
355 | bra e #ih_no_other | 367 | bra e #ih_no_other |
diff --git a/drivers/gpu/drm/nouveau/core/engine/graph/fuc/hubgm107.fuc5.h b/drivers/gpu/drm/nouveau/core/engine/graph/fuc/hubgm107.fuc5.h index 214dd16ec566..5f953c5c20b7 100644 --- a/drivers/gpu/drm/nouveau/core/engine/graph/fuc/hubgm107.fuc5.h +++ b/drivers/gpu/drm/nouveau/core/engine/graph/fuc/hubgm107.fuc5.h | |||
@@ -478,10 +478,10 @@ uint32_t gm107_grhub_code[] = { | |||
478 | 0x01040080, | 478 | 0x01040080, |
479 | 0xbd0001f6, | 479 | 0xbd0001f6, |
480 | 0x01004104, | 480 | 0x01004104, |
481 | 0x627e020f, | 481 | 0xa87e020f, |
482 | 0x717e0006, | 482 | 0xb77e0006, |
483 | 0x100f0006, | 483 | 0x100f0006, |
484 | 0x0006b37e, | 484 | 0x0006f97e, |
485 | 0x98000e98, | 485 | 0x98000e98, |
486 | 0x207e010f, | 486 | 0x207e010f, |
487 | 0x14950001, | 487 | 0x14950001, |
@@ -523,8 +523,8 @@ uint32_t gm107_grhub_code[] = { | |||
523 | 0x800040b7, | 523 | 0x800040b7, |
524 | 0xf40132b6, | 524 | 0xf40132b6, |
525 | 0x000fb41b, | 525 | 0x000fb41b, |
526 | 0x0006b37e, | 526 | 0x0006f97e, |
527 | 0x627e000f, | 527 | 0xa87e000f, |
528 | 0x00800006, | 528 | 0x00800006, |
529 | 0x01f60201, | 529 | 0x01f60201, |
530 | 0xbd04bd00, | 530 | 0xbd04bd00, |
@@ -554,7 +554,7 @@ uint32_t gm107_grhub_code[] = { | |||
554 | 0x0009f602, | 554 | 0x0009f602, |
555 | 0x32f404bd, | 555 | 0x32f404bd, |
556 | 0x0231f401, | 556 | 0x0231f401, |
557 | 0x0008367e, | 557 | 0x00087c7e, |
558 | 0x99f094bd, | 558 | 0x99f094bd, |
559 | 0x17008007, | 559 | 0x17008007, |
560 | 0x0009f602, | 560 | 0x0009f602, |
@@ -563,7 +563,7 @@ uint32_t gm107_grhub_code[] = { | |||
563 | 0x37008006, | 563 | 0x37008006, |
564 | 0x0009f602, | 564 | 0x0009f602, |
565 | 0x31f404bd, | 565 | 0x31f404bd, |
566 | 0x08367e01, | 566 | 0x087c7e01, |
567 | 0xf094bd00, | 567 | 0xf094bd00, |
568 | 0x00800699, | 568 | 0x00800699, |
569 | 0x09f60217, | 569 | 0x09f60217, |
@@ -572,7 +572,7 @@ uint32_t gm107_grhub_code[] = { | |||
572 | 0x20f92f0e, | 572 | 0x20f92f0e, |
573 | 0x32f412b2, | 573 | 0x32f412b2, |
574 | 0x0232f401, | 574 | 0x0232f401, |
575 | 0x0008367e, | 575 | 0x00087c7e, |
576 | 0x008020fc, | 576 | 0x008020fc, |
577 | 0x02f602c0, | 577 | 0x02f602c0, |
578 | 0xf404bd00, | 578 | 0xf404bd00, |
@@ -580,7 +580,7 @@ uint32_t gm107_grhub_code[] = { | |||
580 | 0x23c8130e, | 580 | 0x23c8130e, |
581 | 0x0d0bf41f, | 581 | 0x0d0bf41f, |
582 | 0xf40131f4, | 582 | 0xf40131f4, |
583 | 0x367e0232, | 583 | 0x7c7e0232, |
584 | /* 0x054e: chsw_done */ | 584 | /* 0x054e: chsw_done */ |
585 | 0x01020008, | 585 | 0x01020008, |
586 | 0x02c30080, | 586 | 0x02c30080, |
@@ -593,7 +593,7 @@ uint32_t gm107_grhub_code[] = { | |||
593 | 0xb0ff2a0e, | 593 | 0xb0ff2a0e, |
594 | 0x1bf401e4, | 594 | 0x1bf401e4, |
595 | 0x7ef2b20c, | 595 | 0x7ef2b20c, |
596 | 0xf40007d6, | 596 | 0xf400081c, |
597 | /* 0x057a: main_not_ctx_chan */ | 597 | /* 0x057a: main_not_ctx_chan */ |
598 | 0xe4b0400e, | 598 | 0xe4b0400e, |
599 | 0x2c1bf402, | 599 | 0x2c1bf402, |
@@ -602,7 +602,7 @@ uint32_t gm107_grhub_code[] = { | |||
602 | 0x0009f602, | 602 | 0x0009f602, |
603 | 0x32f404bd, | 603 | 0x32f404bd, |
604 | 0x0232f401, | 604 | 0x0232f401, |
605 | 0x0008367e, | 605 | 0x00087c7e, |
606 | 0x99f094bd, | 606 | 0x99f094bd, |
607 | 0x17008007, | 607 | 0x17008007, |
608 | 0x0009f602, | 608 | 0x0009f602, |
@@ -642,238 +642,238 @@ uint32_t gm107_grhub_code[] = { | |||
642 | /* 0x061a: ih_no_ctxsw */ | 642 | /* 0x061a: ih_no_ctxsw */ |
643 | 0xabe40000, | 643 | 0xabe40000, |
644 | 0x0bf40400, | 644 | 0x0bf40400, |
645 | 0x01004b10, | 645 | 0x07088e56, |
646 | 0x448ebfb2, | ||
647 | 0x8f7e4001, | ||
648 | /* 0x062e: ih_no_fwmthd */ | ||
649 | 0x044b0000, | ||
650 | 0xffb0bd01, | ||
651 | 0x0bf4b4ab, | ||
652 | 0x0700800c, | ||
653 | 0x000bf603, | ||
654 | /* 0x0642: ih_no_other */ | ||
655 | 0x004004bd, | ||
656 | 0x000af601, | ||
657 | 0xf0fc04bd, | ||
658 | 0xd0fce0fc, | ||
659 | 0xa0fcb0fc, | ||
660 | 0x80fc90fc, | ||
661 | 0xfc0088fe, | ||
662 | 0x0032f480, | ||
663 | /* 0x0662: ctx_4170s */ | ||
664 | 0xf5f001f8, | ||
665 | 0x8effb210, | ||
666 | 0x7e404170, | ||
667 | 0xf800008f, | ||
668 | /* 0x0671: ctx_4170w */ | ||
669 | 0x41708e00, | ||
670 | 0x00657e40, | 646 | 0x00657e40, |
671 | 0xf0ffb200, | 647 | 0x80ffb200, |
672 | 0x1bf410f4, | 648 | 0xf6020400, |
673 | /* 0x0683: ctx_redswitch */ | ||
674 | 0x4e00f8f3, | ||
675 | 0xe5f00200, | ||
676 | 0x20e5f040, | ||
677 | 0x8010e5f0, | ||
678 | 0xf6018500, | ||
679 | 0x04bd000e, | ||
680 | /* 0x069a: ctx_redswitch_delay */ | ||
681 | 0xf2b6080f, | ||
682 | 0xfd1bf401, | ||
683 | 0x0400e5f1, | ||
684 | 0x0100e5f1, | ||
685 | 0x01850080, | ||
686 | 0xbd000ef6, | ||
687 | /* 0x06b3: ctx_86c */ | ||
688 | 0x8000f804, | ||
689 | 0xf6022300, | ||
690 | 0x04bd000f, | 649 | 0x04bd000f, |
691 | 0x148effb2, | 650 | 0x4007048e, |
692 | 0x8f7e408a, | 651 | 0x0000657e, |
693 | 0xffb20000, | 652 | 0x0080ffb2, |
694 | 0x41a88c8e, | 653 | 0x0ff60203, |
654 | 0xc704bd00, | ||
655 | 0xee9450fe, | ||
656 | 0x07008f02, | ||
657 | 0x00efbb40, | ||
658 | 0x0000657e, | ||
659 | 0x02020080, | ||
660 | 0xbd000ff6, | ||
661 | 0x7e030f04, | ||
662 | 0x4b0002f8, | ||
663 | 0xbfb20100, | ||
664 | 0x4001448e, | ||
695 | 0x00008f7e, | 665 | 0x00008f7e, |
696 | /* 0x06d2: ctx_mem */ | 666 | /* 0x0674: ih_no_fwmthd */ |
697 | 0x008000f8, | 667 | 0xbd05044b, |
698 | 0x0ff60284, | 668 | 0xb4abffb0, |
699 | /* 0x06db: ctx_mem_wait */ | 669 | 0x800c0bf4, |
700 | 0x8f04bd00, | 670 | 0xf6030700, |
701 | 0xcf028400, | 671 | 0x04bd000b, |
702 | 0xfffd00ff, | 672 | /* 0x0688: ih_no_other */ |
703 | 0xf61bf405, | 673 | 0xf6010040, |
704 | /* 0x06ea: ctx_load */ | 674 | 0x04bd000a, |
705 | 0x94bd00f8, | 675 | 0xe0fcf0fc, |
706 | 0x800599f0, | 676 | 0xb0fcd0fc, |
707 | 0xf6023700, | 677 | 0x90fca0fc, |
708 | 0x04bd0009, | 678 | 0x88fe80fc, |
709 | 0xb87e0c0a, | 679 | 0xf480fc00, |
710 | 0xf4bd0000, | 680 | 0x01f80032, |
711 | 0x02890080, | 681 | /* 0x06a8: ctx_4170s */ |
682 | 0xb210f5f0, | ||
683 | 0x41708eff, | ||
684 | 0x008f7e40, | ||
685 | /* 0x06b7: ctx_4170w */ | ||
686 | 0x8e00f800, | ||
687 | 0x7e404170, | ||
688 | 0xb2000065, | ||
689 | 0x10f4f0ff, | ||
690 | 0xf8f31bf4, | ||
691 | /* 0x06c9: ctx_redswitch */ | ||
692 | 0x02004e00, | ||
693 | 0xf040e5f0, | ||
694 | 0xe5f020e5, | ||
695 | 0x85008010, | ||
696 | 0x000ef601, | ||
697 | 0x080f04bd, | ||
698 | /* 0x06e0: ctx_redswitch_delay */ | ||
699 | 0xf401f2b6, | ||
700 | 0xe5f1fd1b, | ||
701 | 0xe5f10400, | ||
702 | 0x00800100, | ||
703 | 0x0ef60185, | ||
704 | 0xf804bd00, | ||
705 | /* 0x06f9: ctx_86c */ | ||
706 | 0x23008000, | ||
707 | 0x000ff602, | ||
708 | 0xffb204bd, | ||
709 | 0x408a148e, | ||
710 | 0x00008f7e, | ||
711 | 0x8c8effb2, | ||
712 | 0x8f7e41a8, | ||
713 | 0x00f80000, | ||
714 | /* 0x0718: ctx_mem */ | ||
715 | 0x02840080, | ||
712 | 0xbd000ff6, | 716 | 0xbd000ff6, |
713 | 0xc1008004, | 717 | /* 0x0721: ctx_mem_wait */ |
714 | 0x0002f602, | 718 | 0x84008f04, |
715 | 0x008004bd, | 719 | 0x00ffcf02, |
716 | 0x02f60283, | 720 | 0xf405fffd, |
717 | 0x0f04bd00, | 721 | 0x00f8f61b, |
718 | 0x06d27e07, | 722 | /* 0x0730: ctx_load */ |
719 | 0xc0008000, | 723 | 0x99f094bd, |
720 | 0x0002f602, | 724 | 0x37008005, |
721 | 0x0bfe04bd, | 725 | 0x0009f602, |
722 | 0x1f2af000, | 726 | 0x0c0a04bd, |
723 | 0xb60424b6, | 727 | 0x0000b87e, |
724 | 0x94bd0220, | 728 | 0x0080f4bd, |
725 | 0x800899f0, | 729 | 0x0ff60289, |
726 | 0xf6023700, | 730 | 0x8004bd00, |
727 | 0x04bd0009, | 731 | 0xf602c100, |
728 | 0x02810080, | 732 | 0x04bd0002, |
729 | 0xbd0002f6, | 733 | 0x02830080, |
730 | 0x0000d204, | ||
731 | 0x25f08000, | ||
732 | 0x88008002, | ||
733 | 0x0002f602, | ||
734 | 0x100104bd, | ||
735 | 0xf0020042, | ||
736 | 0x12fa0223, | ||
737 | 0xbd03f805, | ||
738 | 0x0899f094, | ||
739 | 0x02170080, | ||
740 | 0xbd0009f6, | ||
741 | 0x81019804, | ||
742 | 0x981814b6, | ||
743 | 0x25b68002, | ||
744 | 0x0512fd08, | ||
745 | 0xbd1601b5, | ||
746 | 0x0999f094, | ||
747 | 0x02370080, | ||
748 | 0xbd0009f6, | ||
749 | 0x81008004, | ||
750 | 0x0001f602, | ||
751 | 0x010204bd, | ||
752 | 0x02880080, | ||
753 | 0xbd0002f6, | 734 | 0xbd0002f6, |
754 | 0x01004104, | 735 | 0x7e070f04, |
755 | 0xfa0613f0, | 736 | 0x80000718, |
756 | 0x03f80501, | 737 | 0xf602c000, |
738 | 0x04bd0002, | ||
739 | 0xf0000bfe, | ||
740 | 0x24b61f2a, | ||
741 | 0x0220b604, | ||
757 | 0x99f094bd, | 742 | 0x99f094bd, |
758 | 0x17008009, | 743 | 0x37008008, |
759 | 0x0009f602, | 744 | 0x0009f602, |
760 | 0x94bd04bd, | 745 | 0x008004bd, |
761 | 0x800599f0, | 746 | 0x02f60281, |
747 | 0xd204bd00, | ||
748 | 0x80000000, | ||
749 | 0x800225f0, | ||
750 | 0xf6028800, | ||
751 | 0x04bd0002, | ||
752 | 0x00421001, | ||
753 | 0x0223f002, | ||
754 | 0xf80512fa, | ||
755 | 0xf094bd03, | ||
756 | 0x00800899, | ||
757 | 0x09f60217, | ||
758 | 0x9804bd00, | ||
759 | 0x14b68101, | ||
760 | 0x80029818, | ||
761 | 0xfd0825b6, | ||
762 | 0x01b50512, | ||
763 | 0xf094bd16, | ||
764 | 0x00800999, | ||
765 | 0x09f60237, | ||
766 | 0x8004bd00, | ||
767 | 0xf6028100, | ||
768 | 0x04bd0001, | ||
769 | 0x00800102, | ||
770 | 0x02f60288, | ||
771 | 0x4104bd00, | ||
772 | 0x13f00100, | ||
773 | 0x0501fa06, | ||
774 | 0x94bd03f8, | ||
775 | 0x800999f0, | ||
762 | 0xf6021700, | 776 | 0xf6021700, |
763 | 0x04bd0009, | 777 | 0x04bd0009, |
764 | /* 0x07d6: ctx_chan */ | 778 | 0x99f094bd, |
765 | 0xea7e00f8, | 779 | 0x17008005, |
766 | 0x0c0a0006, | 780 | 0x0009f602, |
767 | 0x0000b87e, | 781 | 0x00f804bd, |
768 | 0xd27e050f, | 782 | /* 0x081c: ctx_chan */ |
769 | 0x00f80006, | 783 | 0x0007307e, |
770 | /* 0x07e8: ctx_mmio_exec */ | 784 | 0xb87e0c0a, |
771 | 0x80410398, | 785 | 0x050f0000, |
786 | 0x0007187e, | ||
787 | /* 0x082e: ctx_mmio_exec */ | ||
788 | 0x039800f8, | ||
789 | 0x81008041, | ||
790 | 0x0003f602, | ||
791 | 0x34bd04bd, | ||
792 | /* 0x083c: ctx_mmio_loop */ | ||
793 | 0xf4ff34c4, | ||
794 | 0x00450e1b, | ||
795 | 0x0653f002, | ||
796 | 0xf80535fa, | ||
797 | /* 0x084d: ctx_mmio_pull */ | ||
798 | 0x804e9803, | ||
799 | 0x7e814f98, | ||
800 | 0xb600008f, | ||
801 | 0x12b60830, | ||
802 | 0xdf1bf401, | ||
803 | /* 0x0860: ctx_mmio_done */ | ||
804 | 0x80160398, | ||
772 | 0xf6028100, | 805 | 0xf6028100, |
773 | 0x04bd0003, | 806 | 0x04bd0003, |
774 | /* 0x07f6: ctx_mmio_loop */ | 807 | 0x414000b5, |
775 | 0x34c434bd, | 808 | 0x13f00100, |
776 | 0x0e1bf4ff, | 809 | 0x0601fa06, |
777 | 0xf0020045, | 810 | 0x00f803f8, |
778 | 0x35fa0653, | 811 | /* 0x087c: ctx_xfer */ |
779 | /* 0x0807: ctx_mmio_pull */ | 812 | 0x0080040e, |
780 | 0x9803f805, | 813 | 0x0ef60302, |
781 | 0x4f98804e, | 814 | /* 0x0887: ctx_xfer_idle */ |
782 | 0x008f7e81, | 815 | 0x8e04bd00, |
783 | 0x0830b600, | 816 | 0xcf030000, |
784 | 0xf40112b6, | 817 | 0xe4f100ee, |
785 | /* 0x081a: ctx_mmio_done */ | 818 | 0x1bf42000, |
786 | 0x0398df1b, | 819 | 0x0611f4f5, |
787 | 0x81008016, | 820 | /* 0x089b: ctx_xfer_pre */ |
788 | 0x0003f602, | 821 | 0x0f0c02f4, |
789 | 0x00b504bd, | 822 | 0x06f97e10, |
790 | 0x01004140, | 823 | 0x1b11f400, |
791 | 0xfa0613f0, | 824 | /* 0x08a4: ctx_xfer_pre_load */ |
792 | 0x03f80601, | 825 | 0xa87e020f, |
793 | /* 0x0836: ctx_xfer */ | 826 | 0xb77e0006, |
794 | 0x040e00f8, | 827 | 0xc97e0006, |
795 | 0x03020080, | 828 | 0xf4bd0006, |
796 | 0xbd000ef6, | 829 | 0x0006a87e, |
797 | /* 0x0841: ctx_xfer_idle */ | 830 | 0x0007307e, |
798 | 0x00008e04, | 831 | /* 0x08bc: ctx_xfer_exec */ |
799 | 0x00eecf03, | 832 | 0xbd160198, |
800 | 0x2000e4f1, | 833 | 0x05008024, |
801 | 0xf4f51bf4, | 834 | 0x0002f601, |
802 | 0x02f40611, | 835 | 0x1fb204bd, |
803 | /* 0x0855: ctx_xfer_pre */ | 836 | 0x41a5008e, |
804 | 0x7e100f0c, | ||
805 | 0xf40006b3, | ||
806 | /* 0x085e: ctx_xfer_pre_load */ | ||
807 | 0x020f1b11, | ||
808 | 0x0006627e, | ||
809 | 0x0006717e, | ||
810 | 0x0006837e, | ||
811 | 0x627ef4bd, | ||
812 | 0xea7e0006, | ||
813 | /* 0x0876: ctx_xfer_exec */ | ||
814 | 0x01980006, | ||
815 | 0x8024bd16, | ||
816 | 0xf6010500, | ||
817 | 0x04bd0002, | ||
818 | 0x008e1fb2, | ||
819 | 0x8f7e41a5, | ||
820 | 0xfcf00000, | ||
821 | 0x022cf001, | ||
822 | 0xfd0124b6, | ||
823 | 0xffb205f2, | ||
824 | 0x41a5048e, | ||
825 | 0x00008f7e, | 837 | 0x00008f7e, |
826 | 0x0002167e, | 838 | 0xf001fcf0, |
827 | 0xfc8024bd, | 839 | 0x24b6022c, |
828 | 0x02f60247, | 840 | 0x05f2fd01, |
829 | 0xf004bd00, | 841 | 0x048effb2, |
830 | 0x20b6012c, | 842 | 0x8f7e41a5, |
831 | 0x4afc8003, | 843 | 0x167e0000, |
832 | 0x0002f602, | 844 | 0x24bd0002, |
833 | 0xacf004bd, | 845 | 0x0247fc80, |
834 | 0x06a5f001, | 846 | 0xbd0002f6, |
835 | 0x0c98000b, | 847 | 0x012cf004, |
836 | 0x010d9800, | 848 | 0x800320b6, |
837 | 0x3d7e000e, | 849 | 0xf6024afc, |
838 | 0x080a0001, | 850 | 0x04bd0002, |
839 | 0x0000ec7e, | 851 | 0xf001acf0, |
840 | 0x00020a7e, | 852 | 0x000b06a5, |
841 | 0x0a1201f4, | 853 | 0x98000c98, |
842 | 0x00b87e0c, | 854 | 0x000e010d, |
843 | 0x7e050f00, | 855 | 0x00013d7e, |
844 | 0xf40006d2, | 856 | 0xec7e080a, |
845 | /* 0x08f2: ctx_xfer_post */ | 857 | 0x0a7e0000, |
846 | 0x020f2d02, | 858 | 0x01f40002, |
847 | 0x0006627e, | 859 | 0x7e0c0a12, |
848 | 0xb37ef4bd, | 860 | 0x0f0000b8, |
849 | 0x277e0006, | 861 | 0x07187e05, |
850 | 0x717e0002, | 862 | 0x2d02f400, |
863 | /* 0x0938: ctx_xfer_post */ | ||
864 | 0xa87e020f, | ||
851 | 0xf4bd0006, | 865 | 0xf4bd0006, |
852 | 0x0006627e, | 866 | 0x0006f97e, |
853 | 0x981011f4, | 867 | 0x0002277e, |
854 | 0x11fd4001, | 868 | 0x0006b77e, |
855 | 0x070bf405, | 869 | 0xa87ef4bd, |
856 | 0x0007e87e, | 870 | 0x11f40006, |
857 | /* 0x091c: ctx_xfer_no_post_mmio */ | 871 | 0x40019810, |
858 | /* 0x091c: ctx_xfer_done */ | 872 | 0xf40511fd, |
859 | 0x000000f8, | 873 | 0x2e7e070b, |
860 | 0x00000000, | 874 | /* 0x0962: ctx_xfer_no_post_mmio */ |
861 | 0x00000000, | 875 | /* 0x0962: ctx_xfer_done */ |
862 | 0x00000000, | 876 | 0x00f80008, |
863 | 0x00000000, | ||
864 | 0x00000000, | ||
865 | 0x00000000, | ||
866 | 0x00000000, | ||
867 | 0x00000000, | ||
868 | 0x00000000, | ||
869 | 0x00000000, | ||
870 | 0x00000000, | ||
871 | 0x00000000, | ||
872 | 0x00000000, | ||
873 | 0x00000000, | ||
874 | 0x00000000, | ||
875 | 0x00000000, | ||
876 | 0x00000000, | ||
877 | 0x00000000, | 877 | 0x00000000, |
878 | 0x00000000, | 878 | 0x00000000, |
879 | 0x00000000, | 879 | 0x00000000, |
diff --git a/drivers/gpu/drm/nouveau/core/engine/graph/fuc/hubnv108.fuc5.h b/drivers/gpu/drm/nouveau/core/engine/graph/fuc/hubnv108.fuc5.h index 64dfd75192bf..e49b5a877ae4 100644 --- a/drivers/gpu/drm/nouveau/core/engine/graph/fuc/hubnv108.fuc5.h +++ b/drivers/gpu/drm/nouveau/core/engine/graph/fuc/hubnv108.fuc5.h | |||
@@ -478,10 +478,10 @@ uint32_t nv108_grhub_code[] = { | |||
478 | 0x01040080, | 478 | 0x01040080, |
479 | 0xbd0001f6, | 479 | 0xbd0001f6, |
480 | 0x01004104, | 480 | 0x01004104, |
481 | 0x627e020f, | 481 | 0xa87e020f, |
482 | 0x717e0006, | 482 | 0xb77e0006, |
483 | 0x100f0006, | 483 | 0x100f0006, |
484 | 0x0006b37e, | 484 | 0x0006f97e, |
485 | 0x98000e98, | 485 | 0x98000e98, |
486 | 0x207e010f, | 486 | 0x207e010f, |
487 | 0x14950001, | 487 | 0x14950001, |
@@ -523,8 +523,8 @@ uint32_t nv108_grhub_code[] = { | |||
523 | 0x800040b7, | 523 | 0x800040b7, |
524 | 0xf40132b6, | 524 | 0xf40132b6, |
525 | 0x000fb41b, | 525 | 0x000fb41b, |
526 | 0x0006b37e, | 526 | 0x0006f97e, |
527 | 0x627e000f, | 527 | 0xa87e000f, |
528 | 0x00800006, | 528 | 0x00800006, |
529 | 0x01f60201, | 529 | 0x01f60201, |
530 | 0xbd04bd00, | 530 | 0xbd04bd00, |
@@ -554,7 +554,7 @@ uint32_t nv108_grhub_code[] = { | |||
554 | 0x0009f602, | 554 | 0x0009f602, |
555 | 0x32f404bd, | 555 | 0x32f404bd, |
556 | 0x0231f401, | 556 | 0x0231f401, |
557 | 0x0008367e, | 557 | 0x00087c7e, |
558 | 0x99f094bd, | 558 | 0x99f094bd, |
559 | 0x17008007, | 559 | 0x17008007, |
560 | 0x0009f602, | 560 | 0x0009f602, |
@@ -563,7 +563,7 @@ uint32_t nv108_grhub_code[] = { | |||
563 | 0x37008006, | 563 | 0x37008006, |
564 | 0x0009f602, | 564 | 0x0009f602, |
565 | 0x31f404bd, | 565 | 0x31f404bd, |
566 | 0x08367e01, | 566 | 0x087c7e01, |
567 | 0xf094bd00, | 567 | 0xf094bd00, |
568 | 0x00800699, | 568 | 0x00800699, |
569 | 0x09f60217, | 569 | 0x09f60217, |
@@ -572,7 +572,7 @@ uint32_t nv108_grhub_code[] = { | |||
572 | 0x20f92f0e, | 572 | 0x20f92f0e, |
573 | 0x32f412b2, | 573 | 0x32f412b2, |
574 | 0x0232f401, | 574 | 0x0232f401, |
575 | 0x0008367e, | 575 | 0x00087c7e, |
576 | 0x008020fc, | 576 | 0x008020fc, |
577 | 0x02f602c0, | 577 | 0x02f602c0, |
578 | 0xf404bd00, | 578 | 0xf404bd00, |
@@ -580,7 +580,7 @@ uint32_t nv108_grhub_code[] = { | |||
580 | 0x23c8130e, | 580 | 0x23c8130e, |
581 | 0x0d0bf41f, | 581 | 0x0d0bf41f, |
582 | 0xf40131f4, | 582 | 0xf40131f4, |
583 | 0x367e0232, | 583 | 0x7c7e0232, |
584 | /* 0x054e: chsw_done */ | 584 | /* 0x054e: chsw_done */ |
585 | 0x01020008, | 585 | 0x01020008, |
586 | 0x02c30080, | 586 | 0x02c30080, |
@@ -593,7 +593,7 @@ uint32_t nv108_grhub_code[] = { | |||
593 | 0xb0ff2a0e, | 593 | 0xb0ff2a0e, |
594 | 0x1bf401e4, | 594 | 0x1bf401e4, |
595 | 0x7ef2b20c, | 595 | 0x7ef2b20c, |
596 | 0xf40007d6, | 596 | 0xf400081c, |
597 | /* 0x057a: main_not_ctx_chan */ | 597 | /* 0x057a: main_not_ctx_chan */ |
598 | 0xe4b0400e, | 598 | 0xe4b0400e, |
599 | 0x2c1bf402, | 599 | 0x2c1bf402, |
@@ -602,7 +602,7 @@ uint32_t nv108_grhub_code[] = { | |||
602 | 0x0009f602, | 602 | 0x0009f602, |
603 | 0x32f404bd, | 603 | 0x32f404bd, |
604 | 0x0232f401, | 604 | 0x0232f401, |
605 | 0x0008367e, | 605 | 0x00087c7e, |
606 | 0x99f094bd, | 606 | 0x99f094bd, |
607 | 0x17008007, | 607 | 0x17008007, |
608 | 0x0009f602, | 608 | 0x0009f602, |
@@ -642,238 +642,238 @@ uint32_t nv108_grhub_code[] = { | |||
642 | /* 0x061a: ih_no_ctxsw */ | 642 | /* 0x061a: ih_no_ctxsw */ |
643 | 0xabe40000, | 643 | 0xabe40000, |
644 | 0x0bf40400, | 644 | 0x0bf40400, |
645 | 0x01004b10, | 645 | 0x07088e56, |
646 | 0x448ebfb2, | ||
647 | 0x8f7e4001, | ||
648 | /* 0x062e: ih_no_fwmthd */ | ||
649 | 0x044b0000, | ||
650 | 0xffb0bd01, | ||
651 | 0x0bf4b4ab, | ||
652 | 0x0700800c, | ||
653 | 0x000bf603, | ||
654 | /* 0x0642: ih_no_other */ | ||
655 | 0x004004bd, | ||
656 | 0x000af601, | ||
657 | 0xf0fc04bd, | ||
658 | 0xd0fce0fc, | ||
659 | 0xa0fcb0fc, | ||
660 | 0x80fc90fc, | ||
661 | 0xfc0088fe, | ||
662 | 0x0032f480, | ||
663 | /* 0x0662: ctx_4170s */ | ||
664 | 0xf5f001f8, | ||
665 | 0x8effb210, | ||
666 | 0x7e404170, | ||
667 | 0xf800008f, | ||
668 | /* 0x0671: ctx_4170w */ | ||
669 | 0x41708e00, | ||
670 | 0x00657e40, | 646 | 0x00657e40, |
671 | 0xf0ffb200, | 647 | 0x80ffb200, |
672 | 0x1bf410f4, | 648 | 0xf6020400, |
673 | /* 0x0683: ctx_redswitch */ | ||
674 | 0x4e00f8f3, | ||
675 | 0xe5f00200, | ||
676 | 0x20e5f040, | ||
677 | 0x8010e5f0, | ||
678 | 0xf6018500, | ||
679 | 0x04bd000e, | ||
680 | /* 0x069a: ctx_redswitch_delay */ | ||
681 | 0xf2b6080f, | ||
682 | 0xfd1bf401, | ||
683 | 0x0400e5f1, | ||
684 | 0x0100e5f1, | ||
685 | 0x01850080, | ||
686 | 0xbd000ef6, | ||
687 | /* 0x06b3: ctx_86c */ | ||
688 | 0x8000f804, | ||
689 | 0xf6022300, | ||
690 | 0x04bd000f, | 649 | 0x04bd000f, |
691 | 0x148effb2, | 650 | 0x4007048e, |
692 | 0x8f7e408a, | 651 | 0x0000657e, |
693 | 0xffb20000, | 652 | 0x0080ffb2, |
694 | 0x41a88c8e, | 653 | 0x0ff60203, |
654 | 0xc704bd00, | ||
655 | 0xee9450fe, | ||
656 | 0x07008f02, | ||
657 | 0x00efbb40, | ||
658 | 0x0000657e, | ||
659 | 0x02020080, | ||
660 | 0xbd000ff6, | ||
661 | 0x7e030f04, | ||
662 | 0x4b0002f8, | ||
663 | 0xbfb20100, | ||
664 | 0x4001448e, | ||
695 | 0x00008f7e, | 665 | 0x00008f7e, |
696 | /* 0x06d2: ctx_mem */ | 666 | /* 0x0674: ih_no_fwmthd */ |
697 | 0x008000f8, | 667 | 0xbd05044b, |
698 | 0x0ff60284, | 668 | 0xb4abffb0, |
699 | /* 0x06db: ctx_mem_wait */ | 669 | 0x800c0bf4, |
700 | 0x8f04bd00, | 670 | 0xf6030700, |
701 | 0xcf028400, | 671 | 0x04bd000b, |
702 | 0xfffd00ff, | 672 | /* 0x0688: ih_no_other */ |
703 | 0xf61bf405, | 673 | 0xf6010040, |
704 | /* 0x06ea: ctx_load */ | 674 | 0x04bd000a, |
705 | 0x94bd00f8, | 675 | 0xe0fcf0fc, |
706 | 0x800599f0, | 676 | 0xb0fcd0fc, |
707 | 0xf6023700, | 677 | 0x90fca0fc, |
708 | 0x04bd0009, | 678 | 0x88fe80fc, |
709 | 0xb87e0c0a, | 679 | 0xf480fc00, |
710 | 0xf4bd0000, | 680 | 0x01f80032, |
711 | 0x02890080, | 681 | /* 0x06a8: ctx_4170s */ |
682 | 0xb210f5f0, | ||
683 | 0x41708eff, | ||
684 | 0x008f7e40, | ||
685 | /* 0x06b7: ctx_4170w */ | ||
686 | 0x8e00f800, | ||
687 | 0x7e404170, | ||
688 | 0xb2000065, | ||
689 | 0x10f4f0ff, | ||
690 | 0xf8f31bf4, | ||
691 | /* 0x06c9: ctx_redswitch */ | ||
692 | 0x02004e00, | ||
693 | 0xf040e5f0, | ||
694 | 0xe5f020e5, | ||
695 | 0x85008010, | ||
696 | 0x000ef601, | ||
697 | 0x080f04bd, | ||
698 | /* 0x06e0: ctx_redswitch_delay */ | ||
699 | 0xf401f2b6, | ||
700 | 0xe5f1fd1b, | ||
701 | 0xe5f10400, | ||
702 | 0x00800100, | ||
703 | 0x0ef60185, | ||
704 | 0xf804bd00, | ||
705 | /* 0x06f9: ctx_86c */ | ||
706 | 0x23008000, | ||
707 | 0x000ff602, | ||
708 | 0xffb204bd, | ||
709 | 0x408a148e, | ||
710 | 0x00008f7e, | ||
711 | 0x8c8effb2, | ||
712 | 0x8f7e41a8, | ||
713 | 0x00f80000, | ||
714 | /* 0x0718: ctx_mem */ | ||
715 | 0x02840080, | ||
712 | 0xbd000ff6, | 716 | 0xbd000ff6, |
713 | 0xc1008004, | 717 | /* 0x0721: ctx_mem_wait */ |
714 | 0x0002f602, | 718 | 0x84008f04, |
715 | 0x008004bd, | 719 | 0x00ffcf02, |
716 | 0x02f60283, | 720 | 0xf405fffd, |
717 | 0x0f04bd00, | 721 | 0x00f8f61b, |
718 | 0x06d27e07, | 722 | /* 0x0730: ctx_load */ |
719 | 0xc0008000, | 723 | 0x99f094bd, |
720 | 0x0002f602, | 724 | 0x37008005, |
721 | 0x0bfe04bd, | 725 | 0x0009f602, |
722 | 0x1f2af000, | 726 | 0x0c0a04bd, |
723 | 0xb60424b6, | 727 | 0x0000b87e, |
724 | 0x94bd0220, | 728 | 0x0080f4bd, |
725 | 0x800899f0, | 729 | 0x0ff60289, |
726 | 0xf6023700, | 730 | 0x8004bd00, |
727 | 0x04bd0009, | 731 | 0xf602c100, |
728 | 0x02810080, | 732 | 0x04bd0002, |
729 | 0xbd0002f6, | 733 | 0x02830080, |
730 | 0x0000d204, | ||
731 | 0x25f08000, | ||
732 | 0x88008002, | ||
733 | 0x0002f602, | ||
734 | 0x100104bd, | ||
735 | 0xf0020042, | ||
736 | 0x12fa0223, | ||
737 | 0xbd03f805, | ||
738 | 0x0899f094, | ||
739 | 0x02170080, | ||
740 | 0xbd0009f6, | ||
741 | 0x81019804, | ||
742 | 0x981814b6, | ||
743 | 0x25b68002, | ||
744 | 0x0512fd08, | ||
745 | 0xbd1601b5, | ||
746 | 0x0999f094, | ||
747 | 0x02370080, | ||
748 | 0xbd0009f6, | ||
749 | 0x81008004, | ||
750 | 0x0001f602, | ||
751 | 0x010204bd, | ||
752 | 0x02880080, | ||
753 | 0xbd0002f6, | 734 | 0xbd0002f6, |
754 | 0x01004104, | 735 | 0x7e070f04, |
755 | 0xfa0613f0, | 736 | 0x80000718, |
756 | 0x03f80501, | 737 | 0xf602c000, |
738 | 0x04bd0002, | ||
739 | 0xf0000bfe, | ||
740 | 0x24b61f2a, | ||
741 | 0x0220b604, | ||
757 | 0x99f094bd, | 742 | 0x99f094bd, |
758 | 0x17008009, | 743 | 0x37008008, |
759 | 0x0009f602, | 744 | 0x0009f602, |
760 | 0x94bd04bd, | 745 | 0x008004bd, |
761 | 0x800599f0, | 746 | 0x02f60281, |
747 | 0xd204bd00, | ||
748 | 0x80000000, | ||
749 | 0x800225f0, | ||
750 | 0xf6028800, | ||
751 | 0x04bd0002, | ||
752 | 0x00421001, | ||
753 | 0x0223f002, | ||
754 | 0xf80512fa, | ||
755 | 0xf094bd03, | ||
756 | 0x00800899, | ||
757 | 0x09f60217, | ||
758 | 0x9804bd00, | ||
759 | 0x14b68101, | ||
760 | 0x80029818, | ||
761 | 0xfd0825b6, | ||
762 | 0x01b50512, | ||
763 | 0xf094bd16, | ||
764 | 0x00800999, | ||
765 | 0x09f60237, | ||
766 | 0x8004bd00, | ||
767 | 0xf6028100, | ||
768 | 0x04bd0001, | ||
769 | 0x00800102, | ||
770 | 0x02f60288, | ||
771 | 0x4104bd00, | ||
772 | 0x13f00100, | ||
773 | 0x0501fa06, | ||
774 | 0x94bd03f8, | ||
775 | 0x800999f0, | ||
762 | 0xf6021700, | 776 | 0xf6021700, |
763 | 0x04bd0009, | 777 | 0x04bd0009, |
764 | /* 0x07d6: ctx_chan */ | 778 | 0x99f094bd, |
765 | 0xea7e00f8, | 779 | 0x17008005, |
766 | 0x0c0a0006, | 780 | 0x0009f602, |
767 | 0x0000b87e, | 781 | 0x00f804bd, |
768 | 0xd27e050f, | 782 | /* 0x081c: ctx_chan */ |
769 | 0x00f80006, | 783 | 0x0007307e, |
770 | /* 0x07e8: ctx_mmio_exec */ | 784 | 0xb87e0c0a, |
771 | 0x80410398, | 785 | 0x050f0000, |
786 | 0x0007187e, | ||
787 | /* 0x082e: ctx_mmio_exec */ | ||
788 | 0x039800f8, | ||
789 | 0x81008041, | ||
790 | 0x0003f602, | ||
791 | 0x34bd04bd, | ||
792 | /* 0x083c: ctx_mmio_loop */ | ||
793 | 0xf4ff34c4, | ||
794 | 0x00450e1b, | ||
795 | 0x0653f002, | ||
796 | 0xf80535fa, | ||
797 | /* 0x084d: ctx_mmio_pull */ | ||
798 | 0x804e9803, | ||
799 | 0x7e814f98, | ||
800 | 0xb600008f, | ||
801 | 0x12b60830, | ||
802 | 0xdf1bf401, | ||
803 | /* 0x0860: ctx_mmio_done */ | ||
804 | 0x80160398, | ||
772 | 0xf6028100, | 805 | 0xf6028100, |
773 | 0x04bd0003, | 806 | 0x04bd0003, |
774 | /* 0x07f6: ctx_mmio_loop */ | 807 | 0x414000b5, |
775 | 0x34c434bd, | 808 | 0x13f00100, |
776 | 0x0e1bf4ff, | 809 | 0x0601fa06, |
777 | 0xf0020045, | 810 | 0x00f803f8, |
778 | 0x35fa0653, | 811 | /* 0x087c: ctx_xfer */ |
779 | /* 0x0807: ctx_mmio_pull */ | 812 | 0x0080040e, |
780 | 0x9803f805, | 813 | 0x0ef60302, |
781 | 0x4f98804e, | 814 | /* 0x0887: ctx_xfer_idle */ |
782 | 0x008f7e81, | 815 | 0x8e04bd00, |
783 | 0x0830b600, | 816 | 0xcf030000, |
784 | 0xf40112b6, | 817 | 0xe4f100ee, |
785 | /* 0x081a: ctx_mmio_done */ | 818 | 0x1bf42000, |
786 | 0x0398df1b, | 819 | 0x0611f4f5, |
787 | 0x81008016, | 820 | /* 0x089b: ctx_xfer_pre */ |
788 | 0x0003f602, | 821 | 0x0f0c02f4, |
789 | 0x00b504bd, | 822 | 0x06f97e10, |
790 | 0x01004140, | 823 | 0x1b11f400, |
791 | 0xfa0613f0, | 824 | /* 0x08a4: ctx_xfer_pre_load */ |
792 | 0x03f80601, | 825 | 0xa87e020f, |
793 | /* 0x0836: ctx_xfer */ | 826 | 0xb77e0006, |
794 | 0x040e00f8, | 827 | 0xc97e0006, |
795 | 0x03020080, | 828 | 0xf4bd0006, |
796 | 0xbd000ef6, | 829 | 0x0006a87e, |
797 | /* 0x0841: ctx_xfer_idle */ | 830 | 0x0007307e, |
798 | 0x00008e04, | 831 | /* 0x08bc: ctx_xfer_exec */ |
799 | 0x00eecf03, | 832 | 0xbd160198, |
800 | 0x2000e4f1, | 833 | 0x05008024, |
801 | 0xf4f51bf4, | 834 | 0x0002f601, |
802 | 0x02f40611, | 835 | 0x1fb204bd, |
803 | /* 0x0855: ctx_xfer_pre */ | 836 | 0x41a5008e, |
804 | 0x7e100f0c, | ||
805 | 0xf40006b3, | ||
806 | /* 0x085e: ctx_xfer_pre_load */ | ||
807 | 0x020f1b11, | ||
808 | 0x0006627e, | ||
809 | 0x0006717e, | ||
810 | 0x0006837e, | ||
811 | 0x627ef4bd, | ||
812 | 0xea7e0006, | ||
813 | /* 0x0876: ctx_xfer_exec */ | ||
814 | 0x01980006, | ||
815 | 0x8024bd16, | ||
816 | 0xf6010500, | ||
817 | 0x04bd0002, | ||
818 | 0x008e1fb2, | ||
819 | 0x8f7e41a5, | ||
820 | 0xfcf00000, | ||
821 | 0x022cf001, | ||
822 | 0xfd0124b6, | ||
823 | 0xffb205f2, | ||
824 | 0x41a5048e, | ||
825 | 0x00008f7e, | 837 | 0x00008f7e, |
826 | 0x0002167e, | 838 | 0xf001fcf0, |
827 | 0xfc8024bd, | 839 | 0x24b6022c, |
828 | 0x02f60247, | 840 | 0x05f2fd01, |
829 | 0xf004bd00, | 841 | 0x048effb2, |
830 | 0x20b6012c, | 842 | 0x8f7e41a5, |
831 | 0x4afc8003, | 843 | 0x167e0000, |
832 | 0x0002f602, | 844 | 0x24bd0002, |
833 | 0xacf004bd, | 845 | 0x0247fc80, |
834 | 0x06a5f001, | 846 | 0xbd0002f6, |
835 | 0x0c98000b, | 847 | 0x012cf004, |
836 | 0x010d9800, | 848 | 0x800320b6, |
837 | 0x3d7e000e, | 849 | 0xf6024afc, |
838 | 0x080a0001, | 850 | 0x04bd0002, |
839 | 0x0000ec7e, | 851 | 0xf001acf0, |
840 | 0x00020a7e, | 852 | 0x000b06a5, |
841 | 0x0a1201f4, | 853 | 0x98000c98, |
842 | 0x00b87e0c, | 854 | 0x000e010d, |
843 | 0x7e050f00, | 855 | 0x00013d7e, |
844 | 0xf40006d2, | 856 | 0xec7e080a, |
845 | /* 0x08f2: ctx_xfer_post */ | 857 | 0x0a7e0000, |
846 | 0x020f2d02, | 858 | 0x01f40002, |
847 | 0x0006627e, | 859 | 0x7e0c0a12, |
848 | 0xb37ef4bd, | 860 | 0x0f0000b8, |
849 | 0x277e0006, | 861 | 0x07187e05, |
850 | 0x717e0002, | 862 | 0x2d02f400, |
863 | /* 0x0938: ctx_xfer_post */ | ||
864 | 0xa87e020f, | ||
851 | 0xf4bd0006, | 865 | 0xf4bd0006, |
852 | 0x0006627e, | 866 | 0x0006f97e, |
853 | 0x981011f4, | 867 | 0x0002277e, |
854 | 0x11fd4001, | 868 | 0x0006b77e, |
855 | 0x070bf405, | 869 | 0xa87ef4bd, |
856 | 0x0007e87e, | 870 | 0x11f40006, |
857 | /* 0x091c: ctx_xfer_no_post_mmio */ | 871 | 0x40019810, |
858 | /* 0x091c: ctx_xfer_done */ | 872 | 0xf40511fd, |
859 | 0x000000f8, | 873 | 0x2e7e070b, |
860 | 0x00000000, | 874 | /* 0x0962: ctx_xfer_no_post_mmio */ |
861 | 0x00000000, | 875 | /* 0x0962: ctx_xfer_done */ |
862 | 0x00000000, | 876 | 0x00f80008, |
863 | 0x00000000, | ||
864 | 0x00000000, | ||
865 | 0x00000000, | ||
866 | 0x00000000, | ||
867 | 0x00000000, | ||
868 | 0x00000000, | ||
869 | 0x00000000, | ||
870 | 0x00000000, | ||
871 | 0x00000000, | ||
872 | 0x00000000, | ||
873 | 0x00000000, | ||
874 | 0x00000000, | ||
875 | 0x00000000, | ||
876 | 0x00000000, | ||
877 | 0x00000000, | 877 | 0x00000000, |
878 | 0x00000000, | 878 | 0x00000000, |
879 | 0x00000000, | 879 | 0x00000000, |
diff --git a/drivers/gpu/drm/nouveau/core/engine/graph/fuc/hubnvc0.fuc.h b/drivers/gpu/drm/nouveau/core/engine/graph/fuc/hubnvc0.fuc.h index f8f7b278a13f..92dfe6a4ac87 100644 --- a/drivers/gpu/drm/nouveau/core/engine/graph/fuc/hubnvc0.fuc.h +++ b/drivers/gpu/drm/nouveau/core/engine/graph/fuc/hubnvc0.fuc.h | |||
@@ -528,10 +528,10 @@ uint32_t nvc0_grhub_code[] = { | |||
528 | 0x0001d001, | 528 | 0x0001d001, |
529 | 0x17f104bd, | 529 | 0x17f104bd, |
530 | 0xf7f00100, | 530 | 0xf7f00100, |
531 | 0xb521f502, | 531 | 0x0d21f502, |
532 | 0xc721f507, | 532 | 0x1f21f508, |
533 | 0x10f7f007, | 533 | 0x10f7f008, |
534 | 0x081421f5, | 534 | 0x086c21f5, |
535 | 0x98000e98, | 535 | 0x98000e98, |
536 | 0x21f5010f, | 536 | 0x21f5010f, |
537 | 0x14950150, | 537 | 0x14950150, |
@@ -574,9 +574,9 @@ uint32_t nvc0_grhub_code[] = { | |||
574 | 0xb6800040, | 574 | 0xb6800040, |
575 | 0x1bf40132, | 575 | 0x1bf40132, |
576 | 0x00f7f0be, | 576 | 0x00f7f0be, |
577 | 0x081421f5, | 577 | 0x086c21f5, |
578 | 0xf500f7f0, | 578 | 0xf500f7f0, |
579 | 0xf107b521, | 579 | 0xf1080d21, |
580 | 0xf0010007, | 580 | 0xf0010007, |
581 | 0x01d00203, | 581 | 0x01d00203, |
582 | 0xbd04bd00, | 582 | 0xbd04bd00, |
@@ -610,8 +610,8 @@ uint32_t nvc0_grhub_code[] = { | |||
610 | 0x09d00203, | 610 | 0x09d00203, |
611 | 0xf404bd00, | 611 | 0xf404bd00, |
612 | 0x31f40132, | 612 | 0x31f40132, |
613 | 0xe821f502, | 613 | 0x4021f502, |
614 | 0xf094bd09, | 614 | 0xf094bd0a, |
615 | 0x07f10799, | 615 | 0x07f10799, |
616 | 0x03f01700, | 616 | 0x03f01700, |
617 | 0x0009d002, | 617 | 0x0009d002, |
@@ -621,7 +621,7 @@ uint32_t nvc0_grhub_code[] = { | |||
621 | 0x0203f00f, | 621 | 0x0203f00f, |
622 | 0xbd0009d0, | 622 | 0xbd0009d0, |
623 | 0x0131f404, | 623 | 0x0131f404, |
624 | 0x09e821f5, | 624 | 0x0a4021f5, |
625 | 0x99f094bd, | 625 | 0x99f094bd, |
626 | 0x0007f106, | 626 | 0x0007f106, |
627 | 0x0203f017, | 627 | 0x0203f017, |
@@ -631,7 +631,7 @@ uint32_t nvc0_grhub_code[] = { | |||
631 | 0x12b920f9, | 631 | 0x12b920f9, |
632 | 0x0132f402, | 632 | 0x0132f402, |
633 | 0xf50232f4, | 633 | 0xf50232f4, |
634 | 0xfc09e821, | 634 | 0xfc0a4021, |
635 | 0x0007f120, | 635 | 0x0007f120, |
636 | 0x0203f0c0, | 636 | 0x0203f0c0, |
637 | 0xbd0002d0, | 637 | 0xbd0002d0, |
@@ -640,7 +640,7 @@ uint32_t nvc0_grhub_code[] = { | |||
640 | 0xf41f23c8, | 640 | 0xf41f23c8, |
641 | 0x31f40d0b, | 641 | 0x31f40d0b, |
642 | 0x0232f401, | 642 | 0x0232f401, |
643 | 0x09e821f5, | 643 | 0x0a4021f5, |
644 | /* 0x063c: chsw_done */ | 644 | /* 0x063c: chsw_done */ |
645 | 0xf10127f0, | 645 | 0xf10127f0, |
646 | 0xf0c30007, | 646 | 0xf0c30007, |
@@ -654,7 +654,7 @@ uint32_t nvc0_grhub_code[] = { | |||
654 | /* 0x0660: main_not_ctx_switch */ | 654 | /* 0x0660: main_not_ctx_switch */ |
655 | 0xf401e4b0, | 655 | 0xf401e4b0, |
656 | 0xf2b90d1b, | 656 | 0xf2b90d1b, |
657 | 0x7821f502, | 657 | 0xd021f502, |
658 | 0x460ef409, | 658 | 0x460ef409, |
659 | /* 0x0670: main_not_ctx_chan */ | 659 | /* 0x0670: main_not_ctx_chan */ |
660 | 0xf402e4b0, | 660 | 0xf402e4b0, |
@@ -664,8 +664,8 @@ uint32_t nvc0_grhub_code[] = { | |||
664 | 0x09d00203, | 664 | 0x09d00203, |
665 | 0xf404bd00, | 665 | 0xf404bd00, |
666 | 0x32f40132, | 666 | 0x32f40132, |
667 | 0xe821f502, | 667 | 0x4021f502, |
668 | 0xf094bd09, | 668 | 0xf094bd0a, |
669 | 0x07f10799, | 669 | 0x07f10799, |
670 | 0x03f01700, | 670 | 0x03f01700, |
671 | 0x0009d002, | 671 | 0x0009d002, |
@@ -710,18 +710,40 @@ uint32_t nvc0_grhub_code[] = { | |||
710 | /* 0x072b: ih_no_ctxsw */ | 710 | /* 0x072b: ih_no_ctxsw */ |
711 | 0xe40421f4, | 711 | 0xe40421f4, |
712 | 0xf40400ab, | 712 | 0xf40400ab, |
713 | 0xb7f1140b, | 713 | 0xe7f16c0b, |
714 | 0xe3f00708, | ||
715 | 0x6821f440, | ||
716 | 0xf102ffb9, | ||
717 | 0xf0040007, | ||
718 | 0x0fd00203, | ||
719 | 0xf104bd00, | ||
720 | 0xf00704e7, | ||
721 | 0x21f440e3, | ||
722 | 0x02ffb968, | ||
723 | 0x030007f1, | ||
724 | 0xd00203f0, | ||
725 | 0x04bd000f, | ||
726 | 0x9450fec7, | ||
727 | 0xf7f102ee, | ||
728 | 0xf3f00700, | ||
729 | 0x00efbb40, | ||
730 | 0xf16821f4, | ||
731 | 0xf0020007, | ||
732 | 0x0fd00203, | ||
733 | 0xf004bd00, | ||
734 | 0x21f503f7, | ||
735 | 0xb7f1037e, | ||
714 | 0xbfb90100, | 736 | 0xbfb90100, |
715 | 0x44e7f102, | 737 | 0x44e7f102, |
716 | 0x40e3f001, | 738 | 0x40e3f001, |
717 | /* 0x0743: ih_no_fwmthd */ | 739 | /* 0x079b: ih_no_fwmthd */ |
718 | 0xf19d21f4, | 740 | 0xf19d21f4, |
719 | 0xbd0104b7, | 741 | 0xbd0504b7, |
720 | 0xb4abffb0, | 742 | 0xb4abffb0, |
721 | 0xf10f0bf4, | 743 | 0xf10f0bf4, |
722 | 0xf0070007, | 744 | 0xf0070007, |
723 | 0x0bd00303, | 745 | 0x0bd00303, |
724 | /* 0x075b: ih_no_other */ | 746 | /* 0x07b3: ih_no_other */ |
725 | 0xf104bd00, | 747 | 0xf104bd00, |
726 | 0xf0010007, | 748 | 0xf0010007, |
727 | 0x0ad00003, | 749 | 0x0ad00003, |
@@ -731,36 +753,36 @@ uint32_t nvc0_grhub_code[] = { | |||
731 | 0xfc90fca0, | 753 | 0xfc90fca0, |
732 | 0x0088fe80, | 754 | 0x0088fe80, |
733 | 0x32f480fc, | 755 | 0x32f480fc, |
734 | /* 0x077f: ctx_4160s */ | 756 | /* 0x07d7: ctx_4160s */ |
735 | 0xf001f800, | 757 | 0xf001f800, |
736 | 0xffb901f7, | 758 | 0xffb901f7, |
737 | 0x60e7f102, | 759 | 0x60e7f102, |
738 | 0x40e3f041, | 760 | 0x40e3f041, |
739 | /* 0x078f: ctx_4160s_wait */ | 761 | /* 0x07e7: ctx_4160s_wait */ |
740 | 0xf19d21f4, | 762 | 0xf19d21f4, |
741 | 0xf04160e7, | 763 | 0xf04160e7, |
742 | 0x21f440e3, | 764 | 0x21f440e3, |
743 | 0x02ffb968, | 765 | 0x02ffb968, |
744 | 0xf404ffc8, | 766 | 0xf404ffc8, |
745 | 0x00f8f00b, | 767 | 0x00f8f00b, |
746 | /* 0x07a4: ctx_4160c */ | 768 | /* 0x07fc: ctx_4160c */ |
747 | 0xffb9f4bd, | 769 | 0xffb9f4bd, |
748 | 0x60e7f102, | 770 | 0x60e7f102, |
749 | 0x40e3f041, | 771 | 0x40e3f041, |
750 | 0xf89d21f4, | 772 | 0xf89d21f4, |
751 | /* 0x07b5: ctx_4170s */ | 773 | /* 0x080d: ctx_4170s */ |
752 | 0x10f5f000, | 774 | 0x10f5f000, |
753 | 0xf102ffb9, | 775 | 0xf102ffb9, |
754 | 0xf04170e7, | 776 | 0xf04170e7, |
755 | 0x21f440e3, | 777 | 0x21f440e3, |
756 | /* 0x07c7: ctx_4170w */ | 778 | /* 0x081f: ctx_4170w */ |
757 | 0xf100f89d, | 779 | 0xf100f89d, |
758 | 0xf04170e7, | 780 | 0xf04170e7, |
759 | 0x21f440e3, | 781 | 0x21f440e3, |
760 | 0x02ffb968, | 782 | 0x02ffb968, |
761 | 0xf410f4f0, | 783 | 0xf410f4f0, |
762 | 0x00f8f01b, | 784 | 0x00f8f01b, |
763 | /* 0x07dc: ctx_redswitch */ | 785 | /* 0x0834: ctx_redswitch */ |
764 | 0x0200e7f1, | 786 | 0x0200e7f1, |
765 | 0xf040e5f0, | 787 | 0xf040e5f0, |
766 | 0xe5f020e5, | 788 | 0xe5f020e5, |
@@ -768,7 +790,7 @@ uint32_t nvc0_grhub_code[] = { | |||
768 | 0x0103f085, | 790 | 0x0103f085, |
769 | 0xbd000ed0, | 791 | 0xbd000ed0, |
770 | 0x08f7f004, | 792 | 0x08f7f004, |
771 | /* 0x07f8: ctx_redswitch_delay */ | 793 | /* 0x0850: ctx_redswitch_delay */ |
772 | 0xf401f2b6, | 794 | 0xf401f2b6, |
773 | 0xe5f1fd1b, | 795 | 0xe5f1fd1b, |
774 | 0xe5f10400, | 796 | 0xe5f10400, |
@@ -776,7 +798,7 @@ uint32_t nvc0_grhub_code[] = { | |||
776 | 0x03f08500, | 798 | 0x03f08500, |
777 | 0x000ed001, | 799 | 0x000ed001, |
778 | 0x00f804bd, | 800 | 0x00f804bd, |
779 | /* 0x0814: ctx_86c */ | 801 | /* 0x086c: ctx_86c */ |
780 | 0x1b0007f1, | 802 | 0x1b0007f1, |
781 | 0xd00203f0, | 803 | 0xd00203f0, |
782 | 0x04bd000f, | 804 | 0x04bd000f, |
@@ -787,16 +809,16 @@ uint32_t nvc0_grhub_code[] = { | |||
787 | 0xa86ce7f1, | 809 | 0xa86ce7f1, |
788 | 0xf441e3f0, | 810 | 0xf441e3f0, |
789 | 0x00f89d21, | 811 | 0x00f89d21, |
790 | /* 0x083c: ctx_mem */ | 812 | /* 0x0894: ctx_mem */ |
791 | 0x840007f1, | 813 | 0x840007f1, |
792 | 0xd00203f0, | 814 | 0xd00203f0, |
793 | 0x04bd000f, | 815 | 0x04bd000f, |
794 | /* 0x0848: ctx_mem_wait */ | 816 | /* 0x08a0: ctx_mem_wait */ |
795 | 0x8400f7f1, | 817 | 0x8400f7f1, |
796 | 0xcf02f3f0, | 818 | 0xcf02f3f0, |
797 | 0xfffd00ff, | 819 | 0xfffd00ff, |
798 | 0xf31bf405, | 820 | 0xf31bf405, |
799 | /* 0x085a: ctx_load */ | 821 | /* 0x08b2: ctx_load */ |
800 | 0x94bd00f8, | 822 | 0x94bd00f8, |
801 | 0xf10599f0, | 823 | 0xf10599f0, |
802 | 0xf00f0007, | 824 | 0xf00f0007, |
@@ -814,7 +836,7 @@ uint32_t nvc0_grhub_code[] = { | |||
814 | 0x02d00203, | 836 | 0x02d00203, |
815 | 0xf004bd00, | 837 | 0xf004bd00, |
816 | 0x21f507f7, | 838 | 0x21f507f7, |
817 | 0x07f1083c, | 839 | 0x07f10894, |
818 | 0x03f0c000, | 840 | 0x03f0c000, |
819 | 0x0002d002, | 841 | 0x0002d002, |
820 | 0x0bfe04bd, | 842 | 0x0bfe04bd, |
@@ -869,31 +891,31 @@ uint32_t nvc0_grhub_code[] = { | |||
869 | 0x03f01700, | 891 | 0x03f01700, |
870 | 0x0009d002, | 892 | 0x0009d002, |
871 | 0x00f804bd, | 893 | 0x00f804bd, |
872 | /* 0x0978: ctx_chan */ | 894 | /* 0x09d0: ctx_chan */ |
873 | 0x077f21f5, | 895 | 0x07d721f5, |
874 | 0x085a21f5, | 896 | 0x08b221f5, |
875 | 0xf40ca7f0, | 897 | 0xf40ca7f0, |
876 | 0xf7f0d021, | 898 | 0xf7f0d021, |
877 | 0x3c21f505, | 899 | 0x9421f505, |
878 | 0xa421f508, | 900 | 0xfc21f508, |
879 | /* 0x0993: ctx_mmio_exec */ | 901 | /* 0x09eb: ctx_mmio_exec */ |
880 | 0x9800f807, | 902 | 0x9800f807, |
881 | 0x07f14103, | 903 | 0x07f14103, |
882 | 0x03f08100, | 904 | 0x03f08100, |
883 | 0x0003d002, | 905 | 0x0003d002, |
884 | 0x34bd04bd, | 906 | 0x34bd04bd, |
885 | /* 0x09a4: ctx_mmio_loop */ | 907 | /* 0x09fc: ctx_mmio_loop */ |
886 | 0xf4ff34c4, | 908 | 0xf4ff34c4, |
887 | 0x57f10f1b, | 909 | 0x57f10f1b, |
888 | 0x53f00200, | 910 | 0x53f00200, |
889 | 0x0535fa06, | 911 | 0x0535fa06, |
890 | /* 0x09b6: ctx_mmio_pull */ | 912 | /* 0x0a0e: ctx_mmio_pull */ |
891 | 0x4e9803f8, | 913 | 0x4e9803f8, |
892 | 0x814f9880, | 914 | 0x814f9880, |
893 | 0xb69d21f4, | 915 | 0xb69d21f4, |
894 | 0x12b60830, | 916 | 0x12b60830, |
895 | 0xdf1bf401, | 917 | 0xdf1bf401, |
896 | /* 0x09c8: ctx_mmio_done */ | 918 | /* 0x0a20: ctx_mmio_done */ |
897 | 0xf1160398, | 919 | 0xf1160398, |
898 | 0xf0810007, | 920 | 0xf0810007, |
899 | 0x03d00203, | 921 | 0x03d00203, |
@@ -902,30 +924,30 @@ uint32_t nvc0_grhub_code[] = { | |||
902 | 0x13f00100, | 924 | 0x13f00100, |
903 | 0x0601fa06, | 925 | 0x0601fa06, |
904 | 0x00f803f8, | 926 | 0x00f803f8, |
905 | /* 0x09e8: ctx_xfer */ | 927 | /* 0x0a40: ctx_xfer */ |
906 | 0xf104e7f0, | 928 | 0xf104e7f0, |
907 | 0xf0020007, | 929 | 0xf0020007, |
908 | 0x0ed00303, | 930 | 0x0ed00303, |
909 | /* 0x09f7: ctx_xfer_idle */ | 931 | /* 0x0a4f: ctx_xfer_idle */ |
910 | 0xf104bd00, | 932 | 0xf104bd00, |
911 | 0xf00000e7, | 933 | 0xf00000e7, |
912 | 0xeecf03e3, | 934 | 0xeecf03e3, |
913 | 0x00e4f100, | 935 | 0x00e4f100, |
914 | 0xf21bf420, | 936 | 0xf21bf420, |
915 | 0xf40611f4, | 937 | 0xf40611f4, |
916 | /* 0x0a0e: ctx_xfer_pre */ | 938 | /* 0x0a66: ctx_xfer_pre */ |
917 | 0xf7f01102, | 939 | 0xf7f01102, |
918 | 0x1421f510, | 940 | 0x6c21f510, |
919 | 0x7f21f508, | 941 | 0xd721f508, |
920 | 0x1c11f407, | 942 | 0x1c11f407, |
921 | /* 0x0a1c: ctx_xfer_pre_load */ | 943 | /* 0x0a74: ctx_xfer_pre_load */ |
922 | 0xf502f7f0, | 944 | 0xf502f7f0, |
923 | 0xf507b521, | 945 | 0xf5080d21, |
924 | 0xf507c721, | 946 | 0xf5081f21, |
925 | 0xbd07dc21, | 947 | 0xbd083421, |
926 | 0xb521f5f4, | 948 | 0x0d21f5f4, |
927 | 0x5a21f507, | 949 | 0xb221f508, |
928 | /* 0x0a35: ctx_xfer_exec */ | 950 | /* 0x0a8d: ctx_xfer_exec */ |
929 | 0x16019808, | 951 | 0x16019808, |
930 | 0x07f124bd, | 952 | 0x07f124bd, |
931 | 0x03f00500, | 953 | 0x03f00500, |
@@ -960,23 +982,65 @@ uint32_t nvc0_grhub_code[] = { | |||
960 | 0x1301f402, | 982 | 0x1301f402, |
961 | 0xf40ca7f0, | 983 | 0xf40ca7f0, |
962 | 0xf7f0d021, | 984 | 0xf7f0d021, |
963 | 0x3c21f505, | 985 | 0x9421f505, |
964 | 0x3202f408, | 986 | 0x3202f408, |
965 | /* 0x0ac4: ctx_xfer_post */ | 987 | /* 0x0b1c: ctx_xfer_post */ |
966 | 0xf502f7f0, | 988 | 0xf502f7f0, |
967 | 0xbd07b521, | 989 | 0xbd080d21, |
968 | 0x1421f5f4, | 990 | 0x6c21f5f4, |
969 | 0x7f21f508, | 991 | 0x7f21f508, |
970 | 0xc721f502, | 992 | 0x1f21f502, |
971 | 0xf5f4bd07, | 993 | 0xf5f4bd08, |
972 | 0xf407b521, | 994 | 0xf4080d21, |
973 | 0x01981011, | 995 | 0x01981011, |
974 | 0x0511fd40, | 996 | 0x0511fd40, |
975 | 0xf5070bf4, | 997 | 0xf5070bf4, |
976 | /* 0x0aef: ctx_xfer_no_post_mmio */ | 998 | /* 0x0b47: ctx_xfer_no_post_mmio */ |
977 | 0xf5099321, | 999 | 0xf509eb21, |
978 | /* 0x0af3: ctx_xfer_done */ | 1000 | /* 0x0b4b: ctx_xfer_done */ |
979 | 0xf807a421, | 1001 | 0xf807fc21, |
1002 | 0x00000000, | ||
1003 | 0x00000000, | ||
1004 | 0x00000000, | ||
1005 | 0x00000000, | ||
1006 | 0x00000000, | ||
1007 | 0x00000000, | ||
1008 | 0x00000000, | ||
1009 | 0x00000000, | ||
1010 | 0x00000000, | ||
1011 | 0x00000000, | ||
1012 | 0x00000000, | ||
1013 | 0x00000000, | ||
1014 | 0x00000000, | ||
1015 | 0x00000000, | ||
1016 | 0x00000000, | ||
1017 | 0x00000000, | ||
1018 | 0x00000000, | ||
1019 | 0x00000000, | ||
1020 | 0x00000000, | ||
1021 | 0x00000000, | ||
1022 | 0x00000000, | ||
1023 | 0x00000000, | ||
1024 | 0x00000000, | ||
1025 | 0x00000000, | ||
1026 | 0x00000000, | ||
1027 | 0x00000000, | ||
1028 | 0x00000000, | ||
1029 | 0x00000000, | ||
1030 | 0x00000000, | ||
1031 | 0x00000000, | ||
1032 | 0x00000000, | ||
1033 | 0x00000000, | ||
1034 | 0x00000000, | ||
1035 | 0x00000000, | ||
1036 | 0x00000000, | ||
1037 | 0x00000000, | ||
1038 | 0x00000000, | ||
1039 | 0x00000000, | ||
1040 | 0x00000000, | ||
1041 | 0x00000000, | ||
1042 | 0x00000000, | ||
1043 | 0x00000000, | ||
980 | 0x00000000, | 1044 | 0x00000000, |
981 | 0x00000000, | 1045 | 0x00000000, |
982 | 0x00000000, | 1046 | 0x00000000, |
diff --git a/drivers/gpu/drm/nouveau/core/engine/graph/fuc/hubnvd7.fuc.h b/drivers/gpu/drm/nouveau/core/engine/graph/fuc/hubnvd7.fuc.h index 624215a005b0..62b0c7601d8b 100644 --- a/drivers/gpu/drm/nouveau/core/engine/graph/fuc/hubnvd7.fuc.h +++ b/drivers/gpu/drm/nouveau/core/engine/graph/fuc/hubnvd7.fuc.h | |||
@@ -528,10 +528,10 @@ uint32_t nvd7_grhub_code[] = { | |||
528 | 0x0001d001, | 528 | 0x0001d001, |
529 | 0x17f104bd, | 529 | 0x17f104bd, |
530 | 0xf7f00100, | 530 | 0xf7f00100, |
531 | 0xb521f502, | 531 | 0x0d21f502, |
532 | 0xc721f507, | 532 | 0x1f21f508, |
533 | 0x10f7f007, | 533 | 0x10f7f008, |
534 | 0x081421f5, | 534 | 0x086c21f5, |
535 | 0x98000e98, | 535 | 0x98000e98, |
536 | 0x21f5010f, | 536 | 0x21f5010f, |
537 | 0x14950150, | 537 | 0x14950150, |
@@ -574,9 +574,9 @@ uint32_t nvd7_grhub_code[] = { | |||
574 | 0xb6800040, | 574 | 0xb6800040, |
575 | 0x1bf40132, | 575 | 0x1bf40132, |
576 | 0x00f7f0be, | 576 | 0x00f7f0be, |
577 | 0x081421f5, | 577 | 0x086c21f5, |
578 | 0xf500f7f0, | 578 | 0xf500f7f0, |
579 | 0xf107b521, | 579 | 0xf1080d21, |
580 | 0xf0010007, | 580 | 0xf0010007, |
581 | 0x01d00203, | 581 | 0x01d00203, |
582 | 0xbd04bd00, | 582 | 0xbd04bd00, |
@@ -610,8 +610,8 @@ uint32_t nvd7_grhub_code[] = { | |||
610 | 0x09d00203, | 610 | 0x09d00203, |
611 | 0xf404bd00, | 611 | 0xf404bd00, |
612 | 0x31f40132, | 612 | 0x31f40132, |
613 | 0xe821f502, | 613 | 0x4021f502, |
614 | 0xf094bd09, | 614 | 0xf094bd0a, |
615 | 0x07f10799, | 615 | 0x07f10799, |
616 | 0x03f01700, | 616 | 0x03f01700, |
617 | 0x0009d002, | 617 | 0x0009d002, |
@@ -621,7 +621,7 @@ uint32_t nvd7_grhub_code[] = { | |||
621 | 0x0203f00f, | 621 | 0x0203f00f, |
622 | 0xbd0009d0, | 622 | 0xbd0009d0, |
623 | 0x0131f404, | 623 | 0x0131f404, |
624 | 0x09e821f5, | 624 | 0x0a4021f5, |
625 | 0x99f094bd, | 625 | 0x99f094bd, |
626 | 0x0007f106, | 626 | 0x0007f106, |
627 | 0x0203f017, | 627 | 0x0203f017, |
@@ -631,7 +631,7 @@ uint32_t nvd7_grhub_code[] = { | |||
631 | 0x12b920f9, | 631 | 0x12b920f9, |
632 | 0x0132f402, | 632 | 0x0132f402, |
633 | 0xf50232f4, | 633 | 0xf50232f4, |
634 | 0xfc09e821, | 634 | 0xfc0a4021, |
635 | 0x0007f120, | 635 | 0x0007f120, |
636 | 0x0203f0c0, | 636 | 0x0203f0c0, |
637 | 0xbd0002d0, | 637 | 0xbd0002d0, |
@@ -640,7 +640,7 @@ uint32_t nvd7_grhub_code[] = { | |||
640 | 0xf41f23c8, | 640 | 0xf41f23c8, |
641 | 0x31f40d0b, | 641 | 0x31f40d0b, |
642 | 0x0232f401, | 642 | 0x0232f401, |
643 | 0x09e821f5, | 643 | 0x0a4021f5, |
644 | /* 0x063c: chsw_done */ | 644 | /* 0x063c: chsw_done */ |
645 | 0xf10127f0, | 645 | 0xf10127f0, |
646 | 0xf0c30007, | 646 | 0xf0c30007, |
@@ -654,7 +654,7 @@ uint32_t nvd7_grhub_code[] = { | |||
654 | /* 0x0660: main_not_ctx_switch */ | 654 | /* 0x0660: main_not_ctx_switch */ |
655 | 0xf401e4b0, | 655 | 0xf401e4b0, |
656 | 0xf2b90d1b, | 656 | 0xf2b90d1b, |
657 | 0x7821f502, | 657 | 0xd021f502, |
658 | 0x460ef409, | 658 | 0x460ef409, |
659 | /* 0x0670: main_not_ctx_chan */ | 659 | /* 0x0670: main_not_ctx_chan */ |
660 | 0xf402e4b0, | 660 | 0xf402e4b0, |
@@ -664,8 +664,8 @@ uint32_t nvd7_grhub_code[] = { | |||
664 | 0x09d00203, | 664 | 0x09d00203, |
665 | 0xf404bd00, | 665 | 0xf404bd00, |
666 | 0x32f40132, | 666 | 0x32f40132, |
667 | 0xe821f502, | 667 | 0x4021f502, |
668 | 0xf094bd09, | 668 | 0xf094bd0a, |
669 | 0x07f10799, | 669 | 0x07f10799, |
670 | 0x03f01700, | 670 | 0x03f01700, |
671 | 0x0009d002, | 671 | 0x0009d002, |
@@ -710,18 +710,40 @@ uint32_t nvd7_grhub_code[] = { | |||
710 | /* 0x072b: ih_no_ctxsw */ | 710 | /* 0x072b: ih_no_ctxsw */ |
711 | 0xe40421f4, | 711 | 0xe40421f4, |
712 | 0xf40400ab, | 712 | 0xf40400ab, |
713 | 0xb7f1140b, | 713 | 0xe7f16c0b, |
714 | 0xe3f00708, | ||
715 | 0x6821f440, | ||
716 | 0xf102ffb9, | ||
717 | 0xf0040007, | ||
718 | 0x0fd00203, | ||
719 | 0xf104bd00, | ||
720 | 0xf00704e7, | ||
721 | 0x21f440e3, | ||
722 | 0x02ffb968, | ||
723 | 0x030007f1, | ||
724 | 0xd00203f0, | ||
725 | 0x04bd000f, | ||
726 | 0x9450fec7, | ||
727 | 0xf7f102ee, | ||
728 | 0xf3f00700, | ||
729 | 0x00efbb40, | ||
730 | 0xf16821f4, | ||
731 | 0xf0020007, | ||
732 | 0x0fd00203, | ||
733 | 0xf004bd00, | ||
734 | 0x21f503f7, | ||
735 | 0xb7f1037e, | ||
714 | 0xbfb90100, | 736 | 0xbfb90100, |
715 | 0x44e7f102, | 737 | 0x44e7f102, |
716 | 0x40e3f001, | 738 | 0x40e3f001, |
717 | /* 0x0743: ih_no_fwmthd */ | 739 | /* 0x079b: ih_no_fwmthd */ |
718 | 0xf19d21f4, | 740 | 0xf19d21f4, |
719 | 0xbd0104b7, | 741 | 0xbd0504b7, |
720 | 0xb4abffb0, | 742 | 0xb4abffb0, |
721 | 0xf10f0bf4, | 743 | 0xf10f0bf4, |
722 | 0xf0070007, | 744 | 0xf0070007, |
723 | 0x0bd00303, | 745 | 0x0bd00303, |
724 | /* 0x075b: ih_no_other */ | 746 | /* 0x07b3: ih_no_other */ |
725 | 0xf104bd00, | 747 | 0xf104bd00, |
726 | 0xf0010007, | 748 | 0xf0010007, |
727 | 0x0ad00003, | 749 | 0x0ad00003, |
@@ -731,36 +753,36 @@ uint32_t nvd7_grhub_code[] = { | |||
731 | 0xfc90fca0, | 753 | 0xfc90fca0, |
732 | 0x0088fe80, | 754 | 0x0088fe80, |
733 | 0x32f480fc, | 755 | 0x32f480fc, |
734 | /* 0x077f: ctx_4160s */ | 756 | /* 0x07d7: ctx_4160s */ |
735 | 0xf001f800, | 757 | 0xf001f800, |
736 | 0xffb901f7, | 758 | 0xffb901f7, |
737 | 0x60e7f102, | 759 | 0x60e7f102, |
738 | 0x40e3f041, | 760 | 0x40e3f041, |
739 | /* 0x078f: ctx_4160s_wait */ | 761 | /* 0x07e7: ctx_4160s_wait */ |
740 | 0xf19d21f4, | 762 | 0xf19d21f4, |
741 | 0xf04160e7, | 763 | 0xf04160e7, |
742 | 0x21f440e3, | 764 | 0x21f440e3, |
743 | 0x02ffb968, | 765 | 0x02ffb968, |
744 | 0xf404ffc8, | 766 | 0xf404ffc8, |
745 | 0x00f8f00b, | 767 | 0x00f8f00b, |
746 | /* 0x07a4: ctx_4160c */ | 768 | /* 0x07fc: ctx_4160c */ |
747 | 0xffb9f4bd, | 769 | 0xffb9f4bd, |
748 | 0x60e7f102, | 770 | 0x60e7f102, |
749 | 0x40e3f041, | 771 | 0x40e3f041, |
750 | 0xf89d21f4, | 772 | 0xf89d21f4, |
751 | /* 0x07b5: ctx_4170s */ | 773 | /* 0x080d: ctx_4170s */ |
752 | 0x10f5f000, | 774 | 0x10f5f000, |
753 | 0xf102ffb9, | 775 | 0xf102ffb9, |
754 | 0xf04170e7, | 776 | 0xf04170e7, |
755 | 0x21f440e3, | 777 | 0x21f440e3, |
756 | /* 0x07c7: ctx_4170w */ | 778 | /* 0x081f: ctx_4170w */ |
757 | 0xf100f89d, | 779 | 0xf100f89d, |
758 | 0xf04170e7, | 780 | 0xf04170e7, |
759 | 0x21f440e3, | 781 | 0x21f440e3, |
760 | 0x02ffb968, | 782 | 0x02ffb968, |
761 | 0xf410f4f0, | 783 | 0xf410f4f0, |
762 | 0x00f8f01b, | 784 | 0x00f8f01b, |
763 | /* 0x07dc: ctx_redswitch */ | 785 | /* 0x0834: ctx_redswitch */ |
764 | 0x0200e7f1, | 786 | 0x0200e7f1, |
765 | 0xf040e5f0, | 787 | 0xf040e5f0, |
766 | 0xe5f020e5, | 788 | 0xe5f020e5, |
@@ -768,7 +790,7 @@ uint32_t nvd7_grhub_code[] = { | |||
768 | 0x0103f085, | 790 | 0x0103f085, |
769 | 0xbd000ed0, | 791 | 0xbd000ed0, |
770 | 0x08f7f004, | 792 | 0x08f7f004, |
771 | /* 0x07f8: ctx_redswitch_delay */ | 793 | /* 0x0850: ctx_redswitch_delay */ |
772 | 0xf401f2b6, | 794 | 0xf401f2b6, |
773 | 0xe5f1fd1b, | 795 | 0xe5f1fd1b, |
774 | 0xe5f10400, | 796 | 0xe5f10400, |
@@ -776,7 +798,7 @@ uint32_t nvd7_grhub_code[] = { | |||
776 | 0x03f08500, | 798 | 0x03f08500, |
777 | 0x000ed001, | 799 | 0x000ed001, |
778 | 0x00f804bd, | 800 | 0x00f804bd, |
779 | /* 0x0814: ctx_86c */ | 801 | /* 0x086c: ctx_86c */ |
780 | 0x1b0007f1, | 802 | 0x1b0007f1, |
781 | 0xd00203f0, | 803 | 0xd00203f0, |
782 | 0x04bd000f, | 804 | 0x04bd000f, |
@@ -787,16 +809,16 @@ uint32_t nvd7_grhub_code[] = { | |||
787 | 0xa86ce7f1, | 809 | 0xa86ce7f1, |
788 | 0xf441e3f0, | 810 | 0xf441e3f0, |
789 | 0x00f89d21, | 811 | 0x00f89d21, |
790 | /* 0x083c: ctx_mem */ | 812 | /* 0x0894: ctx_mem */ |
791 | 0x840007f1, | 813 | 0x840007f1, |
792 | 0xd00203f0, | 814 | 0xd00203f0, |
793 | 0x04bd000f, | 815 | 0x04bd000f, |
794 | /* 0x0848: ctx_mem_wait */ | 816 | /* 0x08a0: ctx_mem_wait */ |
795 | 0x8400f7f1, | 817 | 0x8400f7f1, |
796 | 0xcf02f3f0, | 818 | 0xcf02f3f0, |
797 | 0xfffd00ff, | 819 | 0xfffd00ff, |
798 | 0xf31bf405, | 820 | 0xf31bf405, |
799 | /* 0x085a: ctx_load */ | 821 | /* 0x08b2: ctx_load */ |
800 | 0x94bd00f8, | 822 | 0x94bd00f8, |
801 | 0xf10599f0, | 823 | 0xf10599f0, |
802 | 0xf00f0007, | 824 | 0xf00f0007, |
@@ -814,7 +836,7 @@ uint32_t nvd7_grhub_code[] = { | |||
814 | 0x02d00203, | 836 | 0x02d00203, |
815 | 0xf004bd00, | 837 | 0xf004bd00, |
816 | 0x21f507f7, | 838 | 0x21f507f7, |
817 | 0x07f1083c, | 839 | 0x07f10894, |
818 | 0x03f0c000, | 840 | 0x03f0c000, |
819 | 0x0002d002, | 841 | 0x0002d002, |
820 | 0x0bfe04bd, | 842 | 0x0bfe04bd, |
@@ -869,31 +891,31 @@ uint32_t nvd7_grhub_code[] = { | |||
869 | 0x03f01700, | 891 | 0x03f01700, |
870 | 0x0009d002, | 892 | 0x0009d002, |
871 | 0x00f804bd, | 893 | 0x00f804bd, |
872 | /* 0x0978: ctx_chan */ | 894 | /* 0x09d0: ctx_chan */ |
873 | 0x077f21f5, | 895 | 0x07d721f5, |
874 | 0x085a21f5, | 896 | 0x08b221f5, |
875 | 0xf40ca7f0, | 897 | 0xf40ca7f0, |
876 | 0xf7f0d021, | 898 | 0xf7f0d021, |
877 | 0x3c21f505, | 899 | 0x9421f505, |
878 | 0xa421f508, | 900 | 0xfc21f508, |
879 | /* 0x0993: ctx_mmio_exec */ | 901 | /* 0x09eb: ctx_mmio_exec */ |
880 | 0x9800f807, | 902 | 0x9800f807, |
881 | 0x07f14103, | 903 | 0x07f14103, |
882 | 0x03f08100, | 904 | 0x03f08100, |
883 | 0x0003d002, | 905 | 0x0003d002, |
884 | 0x34bd04bd, | 906 | 0x34bd04bd, |
885 | /* 0x09a4: ctx_mmio_loop */ | 907 | /* 0x09fc: ctx_mmio_loop */ |
886 | 0xf4ff34c4, | 908 | 0xf4ff34c4, |
887 | 0x57f10f1b, | 909 | 0x57f10f1b, |
888 | 0x53f00200, | 910 | 0x53f00200, |
889 | 0x0535fa06, | 911 | 0x0535fa06, |
890 | /* 0x09b6: ctx_mmio_pull */ | 912 | /* 0x0a0e: ctx_mmio_pull */ |
891 | 0x4e9803f8, | 913 | 0x4e9803f8, |
892 | 0x814f9880, | 914 | 0x814f9880, |
893 | 0xb69d21f4, | 915 | 0xb69d21f4, |
894 | 0x12b60830, | 916 | 0x12b60830, |
895 | 0xdf1bf401, | 917 | 0xdf1bf401, |
896 | /* 0x09c8: ctx_mmio_done */ | 918 | /* 0x0a20: ctx_mmio_done */ |
897 | 0xf1160398, | 919 | 0xf1160398, |
898 | 0xf0810007, | 920 | 0xf0810007, |
899 | 0x03d00203, | 921 | 0x03d00203, |
@@ -902,30 +924,30 @@ uint32_t nvd7_grhub_code[] = { | |||
902 | 0x13f00100, | 924 | 0x13f00100, |
903 | 0x0601fa06, | 925 | 0x0601fa06, |
904 | 0x00f803f8, | 926 | 0x00f803f8, |
905 | /* 0x09e8: ctx_xfer */ | 927 | /* 0x0a40: ctx_xfer */ |
906 | 0xf104e7f0, | 928 | 0xf104e7f0, |
907 | 0xf0020007, | 929 | 0xf0020007, |
908 | 0x0ed00303, | 930 | 0x0ed00303, |
909 | /* 0x09f7: ctx_xfer_idle */ | 931 | /* 0x0a4f: ctx_xfer_idle */ |
910 | 0xf104bd00, | 932 | 0xf104bd00, |
911 | 0xf00000e7, | 933 | 0xf00000e7, |
912 | 0xeecf03e3, | 934 | 0xeecf03e3, |
913 | 0x00e4f100, | 935 | 0x00e4f100, |
914 | 0xf21bf420, | 936 | 0xf21bf420, |
915 | 0xf40611f4, | 937 | 0xf40611f4, |
916 | /* 0x0a0e: ctx_xfer_pre */ | 938 | /* 0x0a66: ctx_xfer_pre */ |
917 | 0xf7f01102, | 939 | 0xf7f01102, |
918 | 0x1421f510, | 940 | 0x6c21f510, |
919 | 0x7f21f508, | 941 | 0xd721f508, |
920 | 0x1c11f407, | 942 | 0x1c11f407, |
921 | /* 0x0a1c: ctx_xfer_pre_load */ | 943 | /* 0x0a74: ctx_xfer_pre_load */ |
922 | 0xf502f7f0, | 944 | 0xf502f7f0, |
923 | 0xf507b521, | 945 | 0xf5080d21, |
924 | 0xf507c721, | 946 | 0xf5081f21, |
925 | 0xbd07dc21, | 947 | 0xbd083421, |
926 | 0xb521f5f4, | 948 | 0x0d21f5f4, |
927 | 0x5a21f507, | 949 | 0xb221f508, |
928 | /* 0x0a35: ctx_xfer_exec */ | 950 | /* 0x0a8d: ctx_xfer_exec */ |
929 | 0x16019808, | 951 | 0x16019808, |
930 | 0x07f124bd, | 952 | 0x07f124bd, |
931 | 0x03f00500, | 953 | 0x03f00500, |
@@ -960,23 +982,65 @@ uint32_t nvd7_grhub_code[] = { | |||
960 | 0x1301f402, | 982 | 0x1301f402, |
961 | 0xf40ca7f0, | 983 | 0xf40ca7f0, |
962 | 0xf7f0d021, | 984 | 0xf7f0d021, |
963 | 0x3c21f505, | 985 | 0x9421f505, |
964 | 0x3202f408, | 986 | 0x3202f408, |
965 | /* 0x0ac4: ctx_xfer_post */ | 987 | /* 0x0b1c: ctx_xfer_post */ |
966 | 0xf502f7f0, | 988 | 0xf502f7f0, |
967 | 0xbd07b521, | 989 | 0xbd080d21, |
968 | 0x1421f5f4, | 990 | 0x6c21f5f4, |
969 | 0x7f21f508, | 991 | 0x7f21f508, |
970 | 0xc721f502, | 992 | 0x1f21f502, |
971 | 0xf5f4bd07, | 993 | 0xf5f4bd08, |
972 | 0xf407b521, | 994 | 0xf4080d21, |
973 | 0x01981011, | 995 | 0x01981011, |
974 | 0x0511fd40, | 996 | 0x0511fd40, |
975 | 0xf5070bf4, | 997 | 0xf5070bf4, |
976 | /* 0x0aef: ctx_xfer_no_post_mmio */ | 998 | /* 0x0b47: ctx_xfer_no_post_mmio */ |
977 | 0xf5099321, | 999 | 0xf509eb21, |
978 | /* 0x0af3: ctx_xfer_done */ | 1000 | /* 0x0b4b: ctx_xfer_done */ |
979 | 0xf807a421, | 1001 | 0xf807fc21, |
1002 | 0x00000000, | ||
1003 | 0x00000000, | ||
1004 | 0x00000000, | ||
1005 | 0x00000000, | ||
1006 | 0x00000000, | ||
1007 | 0x00000000, | ||
1008 | 0x00000000, | ||
1009 | 0x00000000, | ||
1010 | 0x00000000, | ||
1011 | 0x00000000, | ||
1012 | 0x00000000, | ||
1013 | 0x00000000, | ||
1014 | 0x00000000, | ||
1015 | 0x00000000, | ||
1016 | 0x00000000, | ||
1017 | 0x00000000, | ||
1018 | 0x00000000, | ||
1019 | 0x00000000, | ||
1020 | 0x00000000, | ||
1021 | 0x00000000, | ||
1022 | 0x00000000, | ||
1023 | 0x00000000, | ||
1024 | 0x00000000, | ||
1025 | 0x00000000, | ||
1026 | 0x00000000, | ||
1027 | 0x00000000, | ||
1028 | 0x00000000, | ||
1029 | 0x00000000, | ||
1030 | 0x00000000, | ||
1031 | 0x00000000, | ||
1032 | 0x00000000, | ||
1033 | 0x00000000, | ||
1034 | 0x00000000, | ||
1035 | 0x00000000, | ||
1036 | 0x00000000, | ||
1037 | 0x00000000, | ||
1038 | 0x00000000, | ||
1039 | 0x00000000, | ||
1040 | 0x00000000, | ||
1041 | 0x00000000, | ||
1042 | 0x00000000, | ||
1043 | 0x00000000, | ||
980 | 0x00000000, | 1044 | 0x00000000, |
981 | 0x00000000, | 1045 | 0x00000000, |
982 | 0x00000000, | 1046 | 0x00000000, |
diff --git a/drivers/gpu/drm/nouveau/core/engine/graph/fuc/hubnve0.fuc.h b/drivers/gpu/drm/nouveau/core/engine/graph/fuc/hubnve0.fuc.h index 6547b3dfc7ed..51c3797d8537 100644 --- a/drivers/gpu/drm/nouveau/core/engine/graph/fuc/hubnve0.fuc.h +++ b/drivers/gpu/drm/nouveau/core/engine/graph/fuc/hubnve0.fuc.h | |||
@@ -528,10 +528,10 @@ uint32_t nve0_grhub_code[] = { | |||
528 | 0x0001d001, | 528 | 0x0001d001, |
529 | 0x17f104bd, | 529 | 0x17f104bd, |
530 | 0xf7f00100, | 530 | 0xf7f00100, |
531 | 0x7f21f502, | 531 | 0xd721f502, |
532 | 0x9121f507, | 532 | 0xe921f507, |
533 | 0x10f7f007, | 533 | 0x10f7f007, |
534 | 0x07de21f5, | 534 | 0x083621f5, |
535 | 0x98000e98, | 535 | 0x98000e98, |
536 | 0x21f5010f, | 536 | 0x21f5010f, |
537 | 0x14950150, | 537 | 0x14950150, |
@@ -574,9 +574,9 @@ uint32_t nve0_grhub_code[] = { | |||
574 | 0xb6800040, | 574 | 0xb6800040, |
575 | 0x1bf40132, | 575 | 0x1bf40132, |
576 | 0x00f7f0be, | 576 | 0x00f7f0be, |
577 | 0x07de21f5, | 577 | 0x083621f5, |
578 | 0xf500f7f0, | 578 | 0xf500f7f0, |
579 | 0xf1077f21, | 579 | 0xf107d721, |
580 | 0xf0010007, | 580 | 0xf0010007, |
581 | 0x01d00203, | 581 | 0x01d00203, |
582 | 0xbd04bd00, | 582 | 0xbd04bd00, |
@@ -610,8 +610,8 @@ uint32_t nve0_grhub_code[] = { | |||
610 | 0x09d00203, | 610 | 0x09d00203, |
611 | 0xf404bd00, | 611 | 0xf404bd00, |
612 | 0x31f40132, | 612 | 0x31f40132, |
613 | 0xaa21f502, | 613 | 0x0221f502, |
614 | 0xf094bd09, | 614 | 0xf094bd0a, |
615 | 0x07f10799, | 615 | 0x07f10799, |
616 | 0x03f01700, | 616 | 0x03f01700, |
617 | 0x0009d002, | 617 | 0x0009d002, |
@@ -621,7 +621,7 @@ uint32_t nve0_grhub_code[] = { | |||
621 | 0x0203f00f, | 621 | 0x0203f00f, |
622 | 0xbd0009d0, | 622 | 0xbd0009d0, |
623 | 0x0131f404, | 623 | 0x0131f404, |
624 | 0x09aa21f5, | 624 | 0x0a0221f5, |
625 | 0x99f094bd, | 625 | 0x99f094bd, |
626 | 0x0007f106, | 626 | 0x0007f106, |
627 | 0x0203f017, | 627 | 0x0203f017, |
@@ -631,7 +631,7 @@ uint32_t nve0_grhub_code[] = { | |||
631 | 0x12b920f9, | 631 | 0x12b920f9, |
632 | 0x0132f402, | 632 | 0x0132f402, |
633 | 0xf50232f4, | 633 | 0xf50232f4, |
634 | 0xfc09aa21, | 634 | 0xfc0a0221, |
635 | 0x0007f120, | 635 | 0x0007f120, |
636 | 0x0203f0c0, | 636 | 0x0203f0c0, |
637 | 0xbd0002d0, | 637 | 0xbd0002d0, |
@@ -640,7 +640,7 @@ uint32_t nve0_grhub_code[] = { | |||
640 | 0xf41f23c8, | 640 | 0xf41f23c8, |
641 | 0x31f40d0b, | 641 | 0x31f40d0b, |
642 | 0x0232f401, | 642 | 0x0232f401, |
643 | 0x09aa21f5, | 643 | 0x0a0221f5, |
644 | /* 0x063c: chsw_done */ | 644 | /* 0x063c: chsw_done */ |
645 | 0xf10127f0, | 645 | 0xf10127f0, |
646 | 0xf0c30007, | 646 | 0xf0c30007, |
@@ -654,7 +654,7 @@ uint32_t nve0_grhub_code[] = { | |||
654 | /* 0x0660: main_not_ctx_switch */ | 654 | /* 0x0660: main_not_ctx_switch */ |
655 | 0xf401e4b0, | 655 | 0xf401e4b0, |
656 | 0xf2b90d1b, | 656 | 0xf2b90d1b, |
657 | 0x4221f502, | 657 | 0x9a21f502, |
658 | 0x460ef409, | 658 | 0x460ef409, |
659 | /* 0x0670: main_not_ctx_chan */ | 659 | /* 0x0670: main_not_ctx_chan */ |
660 | 0xf402e4b0, | 660 | 0xf402e4b0, |
@@ -664,8 +664,8 @@ uint32_t nve0_grhub_code[] = { | |||
664 | 0x09d00203, | 664 | 0x09d00203, |
665 | 0xf404bd00, | 665 | 0xf404bd00, |
666 | 0x32f40132, | 666 | 0x32f40132, |
667 | 0xaa21f502, | 667 | 0x0221f502, |
668 | 0xf094bd09, | 668 | 0xf094bd0a, |
669 | 0x07f10799, | 669 | 0x07f10799, |
670 | 0x03f01700, | 670 | 0x03f01700, |
671 | 0x0009d002, | 671 | 0x0009d002, |
@@ -710,18 +710,40 @@ uint32_t nve0_grhub_code[] = { | |||
710 | /* 0x072b: ih_no_ctxsw */ | 710 | /* 0x072b: ih_no_ctxsw */ |
711 | 0xe40421f4, | 711 | 0xe40421f4, |
712 | 0xf40400ab, | 712 | 0xf40400ab, |
713 | 0xb7f1140b, | 713 | 0xe7f16c0b, |
714 | 0xe3f00708, | ||
715 | 0x6821f440, | ||
716 | 0xf102ffb9, | ||
717 | 0xf0040007, | ||
718 | 0x0fd00203, | ||
719 | 0xf104bd00, | ||
720 | 0xf00704e7, | ||
721 | 0x21f440e3, | ||
722 | 0x02ffb968, | ||
723 | 0x030007f1, | ||
724 | 0xd00203f0, | ||
725 | 0x04bd000f, | ||
726 | 0x9450fec7, | ||
727 | 0xf7f102ee, | ||
728 | 0xf3f00700, | ||
729 | 0x00efbb40, | ||
730 | 0xf16821f4, | ||
731 | 0xf0020007, | ||
732 | 0x0fd00203, | ||
733 | 0xf004bd00, | ||
734 | 0x21f503f7, | ||
735 | 0xb7f1037e, | ||
714 | 0xbfb90100, | 736 | 0xbfb90100, |
715 | 0x44e7f102, | 737 | 0x44e7f102, |
716 | 0x40e3f001, | 738 | 0x40e3f001, |
717 | /* 0x0743: ih_no_fwmthd */ | 739 | /* 0x079b: ih_no_fwmthd */ |
718 | 0xf19d21f4, | 740 | 0xf19d21f4, |
719 | 0xbd0104b7, | 741 | 0xbd0504b7, |
720 | 0xb4abffb0, | 742 | 0xb4abffb0, |
721 | 0xf10f0bf4, | 743 | 0xf10f0bf4, |
722 | 0xf0070007, | 744 | 0xf0070007, |
723 | 0x0bd00303, | 745 | 0x0bd00303, |
724 | /* 0x075b: ih_no_other */ | 746 | /* 0x07b3: ih_no_other */ |
725 | 0xf104bd00, | 747 | 0xf104bd00, |
726 | 0xf0010007, | 748 | 0xf0010007, |
727 | 0x0ad00003, | 749 | 0x0ad00003, |
@@ -731,19 +753,19 @@ uint32_t nve0_grhub_code[] = { | |||
731 | 0xfc90fca0, | 753 | 0xfc90fca0, |
732 | 0x0088fe80, | 754 | 0x0088fe80, |
733 | 0x32f480fc, | 755 | 0x32f480fc, |
734 | /* 0x077f: ctx_4170s */ | 756 | /* 0x07d7: ctx_4170s */ |
735 | 0xf001f800, | 757 | 0xf001f800, |
736 | 0xffb910f5, | 758 | 0xffb910f5, |
737 | 0x70e7f102, | 759 | 0x70e7f102, |
738 | 0x40e3f041, | 760 | 0x40e3f041, |
739 | 0xf89d21f4, | 761 | 0xf89d21f4, |
740 | /* 0x0791: ctx_4170w */ | 762 | /* 0x07e9: ctx_4170w */ |
741 | 0x70e7f100, | 763 | 0x70e7f100, |
742 | 0x40e3f041, | 764 | 0x40e3f041, |
743 | 0xb96821f4, | 765 | 0xb96821f4, |
744 | 0xf4f002ff, | 766 | 0xf4f002ff, |
745 | 0xf01bf410, | 767 | 0xf01bf410, |
746 | /* 0x07a6: ctx_redswitch */ | 768 | /* 0x07fe: ctx_redswitch */ |
747 | 0xe7f100f8, | 769 | 0xe7f100f8, |
748 | 0xe5f00200, | 770 | 0xe5f00200, |
749 | 0x20e5f040, | 771 | 0x20e5f040, |
@@ -751,7 +773,7 @@ uint32_t nve0_grhub_code[] = { | |||
751 | 0xf0850007, | 773 | 0xf0850007, |
752 | 0x0ed00103, | 774 | 0x0ed00103, |
753 | 0xf004bd00, | 775 | 0xf004bd00, |
754 | /* 0x07c2: ctx_redswitch_delay */ | 776 | /* 0x081a: ctx_redswitch_delay */ |
755 | 0xf2b608f7, | 777 | 0xf2b608f7, |
756 | 0xfd1bf401, | 778 | 0xfd1bf401, |
757 | 0x0400e5f1, | 779 | 0x0400e5f1, |
@@ -759,7 +781,7 @@ uint32_t nve0_grhub_code[] = { | |||
759 | 0x850007f1, | 781 | 0x850007f1, |
760 | 0xd00103f0, | 782 | 0xd00103f0, |
761 | 0x04bd000e, | 783 | 0x04bd000e, |
762 | /* 0x07de: ctx_86c */ | 784 | /* 0x0836: ctx_86c */ |
763 | 0x07f100f8, | 785 | 0x07f100f8, |
764 | 0x03f01b00, | 786 | 0x03f01b00, |
765 | 0x000fd002, | 787 | 0x000fd002, |
@@ -770,17 +792,17 @@ uint32_t nve0_grhub_code[] = { | |||
770 | 0xe7f102ff, | 792 | 0xe7f102ff, |
771 | 0xe3f0a86c, | 793 | 0xe3f0a86c, |
772 | 0x9d21f441, | 794 | 0x9d21f441, |
773 | /* 0x0806: ctx_mem */ | 795 | /* 0x085e: ctx_mem */ |
774 | 0x07f100f8, | 796 | 0x07f100f8, |
775 | 0x03f08400, | 797 | 0x03f08400, |
776 | 0x000fd002, | 798 | 0x000fd002, |
777 | /* 0x0812: ctx_mem_wait */ | 799 | /* 0x086a: ctx_mem_wait */ |
778 | 0xf7f104bd, | 800 | 0xf7f104bd, |
779 | 0xf3f08400, | 801 | 0xf3f08400, |
780 | 0x00ffcf02, | 802 | 0x00ffcf02, |
781 | 0xf405fffd, | 803 | 0xf405fffd, |
782 | 0x00f8f31b, | 804 | 0x00f8f31b, |
783 | /* 0x0824: ctx_load */ | 805 | /* 0x087c: ctx_load */ |
784 | 0x99f094bd, | 806 | 0x99f094bd, |
785 | 0x0007f105, | 807 | 0x0007f105, |
786 | 0x0203f00f, | 808 | 0x0203f00f, |
@@ -797,7 +819,7 @@ uint32_t nve0_grhub_code[] = { | |||
797 | 0x0203f083, | 819 | 0x0203f083, |
798 | 0xbd0002d0, | 820 | 0xbd0002d0, |
799 | 0x07f7f004, | 821 | 0x07f7f004, |
800 | 0x080621f5, | 822 | 0x085e21f5, |
801 | 0xc00007f1, | 823 | 0xc00007f1, |
802 | 0xd00203f0, | 824 | 0xd00203f0, |
803 | 0x04bd0002, | 825 | 0x04bd0002, |
@@ -852,29 +874,29 @@ uint32_t nve0_grhub_code[] = { | |||
852 | 0x170007f1, | 874 | 0x170007f1, |
853 | 0xd00203f0, | 875 | 0xd00203f0, |
854 | 0x04bd0009, | 876 | 0x04bd0009, |
855 | /* 0x0942: ctx_chan */ | 877 | /* 0x099a: ctx_chan */ |
856 | 0x21f500f8, | 878 | 0x21f500f8, |
857 | 0xa7f00824, | 879 | 0xa7f0087c, |
858 | 0xd021f40c, | 880 | 0xd021f40c, |
859 | 0xf505f7f0, | 881 | 0xf505f7f0, |
860 | 0xf8080621, | 882 | 0xf8085e21, |
861 | /* 0x0955: ctx_mmio_exec */ | 883 | /* 0x09ad: ctx_mmio_exec */ |
862 | 0x41039800, | 884 | 0x41039800, |
863 | 0x810007f1, | 885 | 0x810007f1, |
864 | 0xd00203f0, | 886 | 0xd00203f0, |
865 | 0x04bd0003, | 887 | 0x04bd0003, |
866 | /* 0x0966: ctx_mmio_loop */ | 888 | /* 0x09be: ctx_mmio_loop */ |
867 | 0x34c434bd, | 889 | 0x34c434bd, |
868 | 0x0f1bf4ff, | 890 | 0x0f1bf4ff, |
869 | 0x020057f1, | 891 | 0x020057f1, |
870 | 0xfa0653f0, | 892 | 0xfa0653f0, |
871 | 0x03f80535, | 893 | 0x03f80535, |
872 | /* 0x0978: ctx_mmio_pull */ | 894 | /* 0x09d0: ctx_mmio_pull */ |
873 | 0x98804e98, | 895 | 0x98804e98, |
874 | 0x21f4814f, | 896 | 0x21f4814f, |
875 | 0x0830b69d, | 897 | 0x0830b69d, |
876 | 0xf40112b6, | 898 | 0xf40112b6, |
877 | /* 0x098a: ctx_mmio_done */ | 899 | /* 0x09e2: ctx_mmio_done */ |
878 | 0x0398df1b, | 900 | 0x0398df1b, |
879 | 0x0007f116, | 901 | 0x0007f116, |
880 | 0x0203f081, | 902 | 0x0203f081, |
@@ -883,30 +905,30 @@ uint32_t nve0_grhub_code[] = { | |||
883 | 0x010017f1, | 905 | 0x010017f1, |
884 | 0xfa0613f0, | 906 | 0xfa0613f0, |
885 | 0x03f80601, | 907 | 0x03f80601, |
886 | /* 0x09aa: ctx_xfer */ | 908 | /* 0x0a02: ctx_xfer */ |
887 | 0xe7f000f8, | 909 | 0xe7f000f8, |
888 | 0x0007f104, | 910 | 0x0007f104, |
889 | 0x0303f002, | 911 | 0x0303f002, |
890 | 0xbd000ed0, | 912 | 0xbd000ed0, |
891 | /* 0x09b9: ctx_xfer_idle */ | 913 | /* 0x0a11: ctx_xfer_idle */ |
892 | 0x00e7f104, | 914 | 0x00e7f104, |
893 | 0x03e3f000, | 915 | 0x03e3f000, |
894 | 0xf100eecf, | 916 | 0xf100eecf, |
895 | 0xf42000e4, | 917 | 0xf42000e4, |
896 | 0x11f4f21b, | 918 | 0x11f4f21b, |
897 | 0x0d02f406, | 919 | 0x0d02f406, |
898 | /* 0x09d0: ctx_xfer_pre */ | 920 | /* 0x0a28: ctx_xfer_pre */ |
899 | 0xf510f7f0, | 921 | 0xf510f7f0, |
900 | 0xf407de21, | 922 | 0xf4083621, |
901 | /* 0x09da: ctx_xfer_pre_load */ | 923 | /* 0x0a32: ctx_xfer_pre_load */ |
902 | 0xf7f01c11, | 924 | 0xf7f01c11, |
903 | 0x7f21f502, | 925 | 0xd721f502, |
904 | 0x9121f507, | 926 | 0xe921f507, |
905 | 0xa621f507, | 927 | 0xfe21f507, |
906 | 0xf5f4bd07, | 928 | 0xf5f4bd07, |
907 | 0xf5077f21, | 929 | 0xf507d721, |
908 | /* 0x09f3: ctx_xfer_exec */ | 930 | /* 0x0a4b: ctx_xfer_exec */ |
909 | 0x98082421, | 931 | 0x98087c21, |
910 | 0x24bd1601, | 932 | 0x24bd1601, |
911 | 0x050007f1, | 933 | 0x050007f1, |
912 | 0xd00103f0, | 934 | 0xd00103f0, |
@@ -941,21 +963,21 @@ uint32_t nve0_grhub_code[] = { | |||
941 | 0xa7f01301, | 963 | 0xa7f01301, |
942 | 0xd021f40c, | 964 | 0xd021f40c, |
943 | 0xf505f7f0, | 965 | 0xf505f7f0, |
944 | 0xf4080621, | 966 | 0xf4085e21, |
945 | /* 0x0a82: ctx_xfer_post */ | 967 | /* 0x0ada: ctx_xfer_post */ |
946 | 0xf7f02e02, | 968 | 0xf7f02e02, |
947 | 0x7f21f502, | 969 | 0xd721f502, |
948 | 0xf5f4bd07, | 970 | 0xf5f4bd07, |
949 | 0xf507de21, | 971 | 0xf5083621, |
950 | 0xf5027f21, | 972 | 0xf5027f21, |
951 | 0xbd079121, | 973 | 0xbd07e921, |
952 | 0x7f21f5f4, | 974 | 0xd721f5f4, |
953 | 0x1011f407, | 975 | 0x1011f407, |
954 | 0xfd400198, | 976 | 0xfd400198, |
955 | 0x0bf40511, | 977 | 0x0bf40511, |
956 | 0x5521f507, | 978 | 0xad21f507, |
957 | /* 0x0aad: ctx_xfer_no_post_mmio */ | 979 | /* 0x0b05: ctx_xfer_no_post_mmio */ |
958 | /* 0x0aad: ctx_xfer_done */ | 980 | /* 0x0b05: ctx_xfer_done */ |
959 | 0x0000f809, | 981 | 0x0000f809, |
960 | 0x00000000, | 982 | 0x00000000, |
961 | 0x00000000, | 983 | 0x00000000, |
@@ -977,4 +999,46 @@ uint32_t nve0_grhub_code[] = { | |||
977 | 0x00000000, | 999 | 0x00000000, |
978 | 0x00000000, | 1000 | 0x00000000, |
979 | 0x00000000, | 1001 | 0x00000000, |
1002 | 0x00000000, | ||
1003 | 0x00000000, | ||
1004 | 0x00000000, | ||
1005 | 0x00000000, | ||
1006 | 0x00000000, | ||
1007 | 0x00000000, | ||
1008 | 0x00000000, | ||
1009 | 0x00000000, | ||
1010 | 0x00000000, | ||
1011 | 0x00000000, | ||
1012 | 0x00000000, | ||
1013 | 0x00000000, | ||
1014 | 0x00000000, | ||
1015 | 0x00000000, | ||
1016 | 0x00000000, | ||
1017 | 0x00000000, | ||
1018 | 0x00000000, | ||
1019 | 0x00000000, | ||
1020 | 0x00000000, | ||
1021 | 0x00000000, | ||
1022 | 0x00000000, | ||
1023 | 0x00000000, | ||
1024 | 0x00000000, | ||
1025 | 0x00000000, | ||
1026 | 0x00000000, | ||
1027 | 0x00000000, | ||
1028 | 0x00000000, | ||
1029 | 0x00000000, | ||
1030 | 0x00000000, | ||
1031 | 0x00000000, | ||
1032 | 0x00000000, | ||
1033 | 0x00000000, | ||
1034 | 0x00000000, | ||
1035 | 0x00000000, | ||
1036 | 0x00000000, | ||
1037 | 0x00000000, | ||
1038 | 0x00000000, | ||
1039 | 0x00000000, | ||
1040 | 0x00000000, | ||
1041 | 0x00000000, | ||
1042 | 0x00000000, | ||
1043 | 0x00000000, | ||
980 | }; | 1044 | }; |
diff --git a/drivers/gpu/drm/nouveau/core/engine/graph/fuc/hubnvf0.fuc.h b/drivers/gpu/drm/nouveau/core/engine/graph/fuc/hubnvf0.fuc.h index a5aee5a4302f..a0af4b703a8e 100644 --- a/drivers/gpu/drm/nouveau/core/engine/graph/fuc/hubnvf0.fuc.h +++ b/drivers/gpu/drm/nouveau/core/engine/graph/fuc/hubnvf0.fuc.h | |||
@@ -528,10 +528,10 @@ uint32_t nvf0_grhub_code[] = { | |||
528 | 0x0001d001, | 528 | 0x0001d001, |
529 | 0x17f104bd, | 529 | 0x17f104bd, |
530 | 0xf7f00100, | 530 | 0xf7f00100, |
531 | 0x7f21f502, | 531 | 0xd721f502, |
532 | 0x9121f507, | 532 | 0xe921f507, |
533 | 0x10f7f007, | 533 | 0x10f7f007, |
534 | 0x07de21f5, | 534 | 0x083621f5, |
535 | 0x98000e98, | 535 | 0x98000e98, |
536 | 0x21f5010f, | 536 | 0x21f5010f, |
537 | 0x14950150, | 537 | 0x14950150, |
@@ -574,9 +574,9 @@ uint32_t nvf0_grhub_code[] = { | |||
574 | 0xb6800040, | 574 | 0xb6800040, |
575 | 0x1bf40132, | 575 | 0x1bf40132, |
576 | 0x00f7f0be, | 576 | 0x00f7f0be, |
577 | 0x07de21f5, | 577 | 0x083621f5, |
578 | 0xf500f7f0, | 578 | 0xf500f7f0, |
579 | 0xf1077f21, | 579 | 0xf107d721, |
580 | 0xf0010007, | 580 | 0xf0010007, |
581 | 0x01d00203, | 581 | 0x01d00203, |
582 | 0xbd04bd00, | 582 | 0xbd04bd00, |
@@ -610,8 +610,8 @@ uint32_t nvf0_grhub_code[] = { | |||
610 | 0x09d00203, | 610 | 0x09d00203, |
611 | 0xf404bd00, | 611 | 0xf404bd00, |
612 | 0x31f40132, | 612 | 0x31f40132, |
613 | 0xaa21f502, | 613 | 0x0221f502, |
614 | 0xf094bd09, | 614 | 0xf094bd0a, |
615 | 0x07f10799, | 615 | 0x07f10799, |
616 | 0x03f01700, | 616 | 0x03f01700, |
617 | 0x0009d002, | 617 | 0x0009d002, |
@@ -621,7 +621,7 @@ uint32_t nvf0_grhub_code[] = { | |||
621 | 0x0203f037, | 621 | 0x0203f037, |
622 | 0xbd0009d0, | 622 | 0xbd0009d0, |
623 | 0x0131f404, | 623 | 0x0131f404, |
624 | 0x09aa21f5, | 624 | 0x0a0221f5, |
625 | 0x99f094bd, | 625 | 0x99f094bd, |
626 | 0x0007f106, | 626 | 0x0007f106, |
627 | 0x0203f017, | 627 | 0x0203f017, |
@@ -631,7 +631,7 @@ uint32_t nvf0_grhub_code[] = { | |||
631 | 0x12b920f9, | 631 | 0x12b920f9, |
632 | 0x0132f402, | 632 | 0x0132f402, |
633 | 0xf50232f4, | 633 | 0xf50232f4, |
634 | 0xfc09aa21, | 634 | 0xfc0a0221, |
635 | 0x0007f120, | 635 | 0x0007f120, |
636 | 0x0203f0c0, | 636 | 0x0203f0c0, |
637 | 0xbd0002d0, | 637 | 0xbd0002d0, |
@@ -640,7 +640,7 @@ uint32_t nvf0_grhub_code[] = { | |||
640 | 0xf41f23c8, | 640 | 0xf41f23c8, |
641 | 0x31f40d0b, | 641 | 0x31f40d0b, |
642 | 0x0232f401, | 642 | 0x0232f401, |
643 | 0x09aa21f5, | 643 | 0x0a0221f5, |
644 | /* 0x063c: chsw_done */ | 644 | /* 0x063c: chsw_done */ |
645 | 0xf10127f0, | 645 | 0xf10127f0, |
646 | 0xf0c30007, | 646 | 0xf0c30007, |
@@ -654,7 +654,7 @@ uint32_t nvf0_grhub_code[] = { | |||
654 | /* 0x0660: main_not_ctx_switch */ | 654 | /* 0x0660: main_not_ctx_switch */ |
655 | 0xf401e4b0, | 655 | 0xf401e4b0, |
656 | 0xf2b90d1b, | 656 | 0xf2b90d1b, |
657 | 0x4221f502, | 657 | 0x9a21f502, |
658 | 0x460ef409, | 658 | 0x460ef409, |
659 | /* 0x0670: main_not_ctx_chan */ | 659 | /* 0x0670: main_not_ctx_chan */ |
660 | 0xf402e4b0, | 660 | 0xf402e4b0, |
@@ -664,8 +664,8 @@ uint32_t nvf0_grhub_code[] = { | |||
664 | 0x09d00203, | 664 | 0x09d00203, |
665 | 0xf404bd00, | 665 | 0xf404bd00, |
666 | 0x32f40132, | 666 | 0x32f40132, |
667 | 0xaa21f502, | 667 | 0x0221f502, |
668 | 0xf094bd09, | 668 | 0xf094bd0a, |
669 | 0x07f10799, | 669 | 0x07f10799, |
670 | 0x03f01700, | 670 | 0x03f01700, |
671 | 0x0009d002, | 671 | 0x0009d002, |
@@ -710,18 +710,40 @@ uint32_t nvf0_grhub_code[] = { | |||
710 | /* 0x072b: ih_no_ctxsw */ | 710 | /* 0x072b: ih_no_ctxsw */ |
711 | 0xe40421f4, | 711 | 0xe40421f4, |
712 | 0xf40400ab, | 712 | 0xf40400ab, |
713 | 0xb7f1140b, | 713 | 0xe7f16c0b, |
714 | 0xe3f00708, | ||
715 | 0x6821f440, | ||
716 | 0xf102ffb9, | ||
717 | 0xf0040007, | ||
718 | 0x0fd00203, | ||
719 | 0xf104bd00, | ||
720 | 0xf00704e7, | ||
721 | 0x21f440e3, | ||
722 | 0x02ffb968, | ||
723 | 0x030007f1, | ||
724 | 0xd00203f0, | ||
725 | 0x04bd000f, | ||
726 | 0x9450fec7, | ||
727 | 0xf7f102ee, | ||
728 | 0xf3f00700, | ||
729 | 0x00efbb40, | ||
730 | 0xf16821f4, | ||
731 | 0xf0020007, | ||
732 | 0x0fd00203, | ||
733 | 0xf004bd00, | ||
734 | 0x21f503f7, | ||
735 | 0xb7f1037e, | ||
714 | 0xbfb90100, | 736 | 0xbfb90100, |
715 | 0x44e7f102, | 737 | 0x44e7f102, |
716 | 0x40e3f001, | 738 | 0x40e3f001, |
717 | /* 0x0743: ih_no_fwmthd */ | 739 | /* 0x079b: ih_no_fwmthd */ |
718 | 0xf19d21f4, | 740 | 0xf19d21f4, |
719 | 0xbd0104b7, | 741 | 0xbd0504b7, |
720 | 0xb4abffb0, | 742 | 0xb4abffb0, |
721 | 0xf10f0bf4, | 743 | 0xf10f0bf4, |
722 | 0xf0070007, | 744 | 0xf0070007, |
723 | 0x0bd00303, | 745 | 0x0bd00303, |
724 | /* 0x075b: ih_no_other */ | 746 | /* 0x07b3: ih_no_other */ |
725 | 0xf104bd00, | 747 | 0xf104bd00, |
726 | 0xf0010007, | 748 | 0xf0010007, |
727 | 0x0ad00003, | 749 | 0x0ad00003, |
@@ -731,19 +753,19 @@ uint32_t nvf0_grhub_code[] = { | |||
731 | 0xfc90fca0, | 753 | 0xfc90fca0, |
732 | 0x0088fe80, | 754 | 0x0088fe80, |
733 | 0x32f480fc, | 755 | 0x32f480fc, |
734 | /* 0x077f: ctx_4170s */ | 756 | /* 0x07d7: ctx_4170s */ |
735 | 0xf001f800, | 757 | 0xf001f800, |
736 | 0xffb910f5, | 758 | 0xffb910f5, |
737 | 0x70e7f102, | 759 | 0x70e7f102, |
738 | 0x40e3f041, | 760 | 0x40e3f041, |
739 | 0xf89d21f4, | 761 | 0xf89d21f4, |
740 | /* 0x0791: ctx_4170w */ | 762 | /* 0x07e9: ctx_4170w */ |
741 | 0x70e7f100, | 763 | 0x70e7f100, |
742 | 0x40e3f041, | 764 | 0x40e3f041, |
743 | 0xb96821f4, | 765 | 0xb96821f4, |
744 | 0xf4f002ff, | 766 | 0xf4f002ff, |
745 | 0xf01bf410, | 767 | 0xf01bf410, |
746 | /* 0x07a6: ctx_redswitch */ | 768 | /* 0x07fe: ctx_redswitch */ |
747 | 0xe7f100f8, | 769 | 0xe7f100f8, |
748 | 0xe5f00200, | 770 | 0xe5f00200, |
749 | 0x20e5f040, | 771 | 0x20e5f040, |
@@ -751,7 +773,7 @@ uint32_t nvf0_grhub_code[] = { | |||
751 | 0xf0850007, | 773 | 0xf0850007, |
752 | 0x0ed00103, | 774 | 0x0ed00103, |
753 | 0xf004bd00, | 775 | 0xf004bd00, |
754 | /* 0x07c2: ctx_redswitch_delay */ | 776 | /* 0x081a: ctx_redswitch_delay */ |
755 | 0xf2b608f7, | 777 | 0xf2b608f7, |
756 | 0xfd1bf401, | 778 | 0xfd1bf401, |
757 | 0x0400e5f1, | 779 | 0x0400e5f1, |
@@ -759,7 +781,7 @@ uint32_t nvf0_grhub_code[] = { | |||
759 | 0x850007f1, | 781 | 0x850007f1, |
760 | 0xd00103f0, | 782 | 0xd00103f0, |
761 | 0x04bd000e, | 783 | 0x04bd000e, |
762 | /* 0x07de: ctx_86c */ | 784 | /* 0x0836: ctx_86c */ |
763 | 0x07f100f8, | 785 | 0x07f100f8, |
764 | 0x03f02300, | 786 | 0x03f02300, |
765 | 0x000fd002, | 787 | 0x000fd002, |
@@ -770,17 +792,17 @@ uint32_t nvf0_grhub_code[] = { | |||
770 | 0xe7f102ff, | 792 | 0xe7f102ff, |
771 | 0xe3f0a88c, | 793 | 0xe3f0a88c, |
772 | 0x9d21f441, | 794 | 0x9d21f441, |
773 | /* 0x0806: ctx_mem */ | 795 | /* 0x085e: ctx_mem */ |
774 | 0x07f100f8, | 796 | 0x07f100f8, |
775 | 0x03f08400, | 797 | 0x03f08400, |
776 | 0x000fd002, | 798 | 0x000fd002, |
777 | /* 0x0812: ctx_mem_wait */ | 799 | /* 0x086a: ctx_mem_wait */ |
778 | 0xf7f104bd, | 800 | 0xf7f104bd, |
779 | 0xf3f08400, | 801 | 0xf3f08400, |
780 | 0x00ffcf02, | 802 | 0x00ffcf02, |
781 | 0xf405fffd, | 803 | 0xf405fffd, |
782 | 0x00f8f31b, | 804 | 0x00f8f31b, |
783 | /* 0x0824: ctx_load */ | 805 | /* 0x087c: ctx_load */ |
784 | 0x99f094bd, | 806 | 0x99f094bd, |
785 | 0x0007f105, | 807 | 0x0007f105, |
786 | 0x0203f037, | 808 | 0x0203f037, |
@@ -797,7 +819,7 @@ uint32_t nvf0_grhub_code[] = { | |||
797 | 0x0203f083, | 819 | 0x0203f083, |
798 | 0xbd0002d0, | 820 | 0xbd0002d0, |
799 | 0x07f7f004, | 821 | 0x07f7f004, |
800 | 0x080621f5, | 822 | 0x085e21f5, |
801 | 0xc00007f1, | 823 | 0xc00007f1, |
802 | 0xd00203f0, | 824 | 0xd00203f0, |
803 | 0x04bd0002, | 825 | 0x04bd0002, |
@@ -852,29 +874,29 @@ uint32_t nvf0_grhub_code[] = { | |||
852 | 0x170007f1, | 874 | 0x170007f1, |
853 | 0xd00203f0, | 875 | 0xd00203f0, |
854 | 0x04bd0009, | 876 | 0x04bd0009, |
855 | /* 0x0942: ctx_chan */ | 877 | /* 0x099a: ctx_chan */ |
856 | 0x21f500f8, | 878 | 0x21f500f8, |
857 | 0xa7f00824, | 879 | 0xa7f0087c, |
858 | 0xd021f40c, | 880 | 0xd021f40c, |
859 | 0xf505f7f0, | 881 | 0xf505f7f0, |
860 | 0xf8080621, | 882 | 0xf8085e21, |
861 | /* 0x0955: ctx_mmio_exec */ | 883 | /* 0x09ad: ctx_mmio_exec */ |
862 | 0x41039800, | 884 | 0x41039800, |
863 | 0x810007f1, | 885 | 0x810007f1, |
864 | 0xd00203f0, | 886 | 0xd00203f0, |
865 | 0x04bd0003, | 887 | 0x04bd0003, |
866 | /* 0x0966: ctx_mmio_loop */ | 888 | /* 0x09be: ctx_mmio_loop */ |
867 | 0x34c434bd, | 889 | 0x34c434bd, |
868 | 0x0f1bf4ff, | 890 | 0x0f1bf4ff, |
869 | 0x020057f1, | 891 | 0x020057f1, |
870 | 0xfa0653f0, | 892 | 0xfa0653f0, |
871 | 0x03f80535, | 893 | 0x03f80535, |
872 | /* 0x0978: ctx_mmio_pull */ | 894 | /* 0x09d0: ctx_mmio_pull */ |
873 | 0x98804e98, | 895 | 0x98804e98, |
874 | 0x21f4814f, | 896 | 0x21f4814f, |
875 | 0x0830b69d, | 897 | 0x0830b69d, |
876 | 0xf40112b6, | 898 | 0xf40112b6, |
877 | /* 0x098a: ctx_mmio_done */ | 899 | /* 0x09e2: ctx_mmio_done */ |
878 | 0x0398df1b, | 900 | 0x0398df1b, |
879 | 0x0007f116, | 901 | 0x0007f116, |
880 | 0x0203f081, | 902 | 0x0203f081, |
@@ -883,30 +905,30 @@ uint32_t nvf0_grhub_code[] = { | |||
883 | 0x010017f1, | 905 | 0x010017f1, |
884 | 0xfa0613f0, | 906 | 0xfa0613f0, |
885 | 0x03f80601, | 907 | 0x03f80601, |
886 | /* 0x09aa: ctx_xfer */ | 908 | /* 0x0a02: ctx_xfer */ |
887 | 0xe7f000f8, | 909 | 0xe7f000f8, |
888 | 0x0007f104, | 910 | 0x0007f104, |
889 | 0x0303f002, | 911 | 0x0303f002, |
890 | 0xbd000ed0, | 912 | 0xbd000ed0, |
891 | /* 0x09b9: ctx_xfer_idle */ | 913 | /* 0x0a11: ctx_xfer_idle */ |
892 | 0x00e7f104, | 914 | 0x00e7f104, |
893 | 0x03e3f000, | 915 | 0x03e3f000, |
894 | 0xf100eecf, | 916 | 0xf100eecf, |
895 | 0xf42000e4, | 917 | 0xf42000e4, |
896 | 0x11f4f21b, | 918 | 0x11f4f21b, |
897 | 0x0d02f406, | 919 | 0x0d02f406, |
898 | /* 0x09d0: ctx_xfer_pre */ | 920 | /* 0x0a28: ctx_xfer_pre */ |
899 | 0xf510f7f0, | 921 | 0xf510f7f0, |
900 | 0xf407de21, | 922 | 0xf4083621, |
901 | /* 0x09da: ctx_xfer_pre_load */ | 923 | /* 0x0a32: ctx_xfer_pre_load */ |
902 | 0xf7f01c11, | 924 | 0xf7f01c11, |
903 | 0x7f21f502, | 925 | 0xd721f502, |
904 | 0x9121f507, | 926 | 0xe921f507, |
905 | 0xa621f507, | 927 | 0xfe21f507, |
906 | 0xf5f4bd07, | 928 | 0xf5f4bd07, |
907 | 0xf5077f21, | 929 | 0xf507d721, |
908 | /* 0x09f3: ctx_xfer_exec */ | 930 | /* 0x0a4b: ctx_xfer_exec */ |
909 | 0x98082421, | 931 | 0x98087c21, |
910 | 0x24bd1601, | 932 | 0x24bd1601, |
911 | 0x050007f1, | 933 | 0x050007f1, |
912 | 0xd00103f0, | 934 | 0xd00103f0, |
@@ -941,21 +963,21 @@ uint32_t nvf0_grhub_code[] = { | |||
941 | 0xa7f01301, | 963 | 0xa7f01301, |
942 | 0xd021f40c, | 964 | 0xd021f40c, |
943 | 0xf505f7f0, | 965 | 0xf505f7f0, |
944 | 0xf4080621, | 966 | 0xf4085e21, |
945 | /* 0x0a82: ctx_xfer_post */ | 967 | /* 0x0ada: ctx_xfer_post */ |
946 | 0xf7f02e02, | 968 | 0xf7f02e02, |
947 | 0x7f21f502, | 969 | 0xd721f502, |
948 | 0xf5f4bd07, | 970 | 0xf5f4bd07, |
949 | 0xf507de21, | 971 | 0xf5083621, |
950 | 0xf5027f21, | 972 | 0xf5027f21, |
951 | 0xbd079121, | 973 | 0xbd07e921, |
952 | 0x7f21f5f4, | 974 | 0xd721f5f4, |
953 | 0x1011f407, | 975 | 0x1011f407, |
954 | 0xfd400198, | 976 | 0xfd400198, |
955 | 0x0bf40511, | 977 | 0x0bf40511, |
956 | 0x5521f507, | 978 | 0xad21f507, |
957 | /* 0x0aad: ctx_xfer_no_post_mmio */ | 979 | /* 0x0b05: ctx_xfer_no_post_mmio */ |
958 | /* 0x0aad: ctx_xfer_done */ | 980 | /* 0x0b05: ctx_xfer_done */ |
959 | 0x0000f809, | 981 | 0x0000f809, |
960 | 0x00000000, | 982 | 0x00000000, |
961 | 0x00000000, | 983 | 0x00000000, |
@@ -977,4 +999,46 @@ uint32_t nvf0_grhub_code[] = { | |||
977 | 0x00000000, | 999 | 0x00000000, |
978 | 0x00000000, | 1000 | 0x00000000, |
979 | 0x00000000, | 1001 | 0x00000000, |
1002 | 0x00000000, | ||
1003 | 0x00000000, | ||
1004 | 0x00000000, | ||
1005 | 0x00000000, | ||
1006 | 0x00000000, | ||
1007 | 0x00000000, | ||
1008 | 0x00000000, | ||
1009 | 0x00000000, | ||
1010 | 0x00000000, | ||
1011 | 0x00000000, | ||
1012 | 0x00000000, | ||
1013 | 0x00000000, | ||
1014 | 0x00000000, | ||
1015 | 0x00000000, | ||
1016 | 0x00000000, | ||
1017 | 0x00000000, | ||
1018 | 0x00000000, | ||
1019 | 0x00000000, | ||
1020 | 0x00000000, | ||
1021 | 0x00000000, | ||
1022 | 0x00000000, | ||
1023 | 0x00000000, | ||
1024 | 0x00000000, | ||
1025 | 0x00000000, | ||
1026 | 0x00000000, | ||
1027 | 0x00000000, | ||
1028 | 0x00000000, | ||
1029 | 0x00000000, | ||
1030 | 0x00000000, | ||
1031 | 0x00000000, | ||
1032 | 0x00000000, | ||
1033 | 0x00000000, | ||
1034 | 0x00000000, | ||
1035 | 0x00000000, | ||
1036 | 0x00000000, | ||
1037 | 0x00000000, | ||
1038 | 0x00000000, | ||
1039 | 0x00000000, | ||
1040 | 0x00000000, | ||
1041 | 0x00000000, | ||
1042 | 0x00000000, | ||
1043 | 0x00000000, | ||
980 | }; | 1044 | }; |
diff --git a/drivers/gpu/drm/nouveau/core/engine/graph/fuc/macros.fuc b/drivers/gpu/drm/nouveau/core/engine/graph/fuc/macros.fuc index a47d49db5232..2a0b0f844299 100644 --- a/drivers/gpu/drm/nouveau/core/engine/graph/fuc/macros.fuc +++ b/drivers/gpu/drm/nouveau/core/engine/graph/fuc/macros.fuc | |||
@@ -30,6 +30,12 @@ | |||
30 | #define GK110 0xf0 | 30 | #define GK110 0xf0 |
31 | #define GK208 0x108 | 31 | #define GK208 0x108 |
32 | 32 | ||
33 | #define NV_PGRAPH_TRAPPED_ADDR 0x400704 | ||
34 | #define NV_PGRAPH_TRAPPED_DATA_LO 0x400708 | ||
35 | #define NV_PGRAPH_TRAPPED_DATA_HI 0x40070c | ||
36 | |||
37 | #define NV_PGRAPH_FE_OBJECT_TABLE(n) ((n) * 4 + 0x400700) | ||
38 | |||
33 | #define NV_PGRAPH_FECS_INTR_ACK 0x409004 | 39 | #define NV_PGRAPH_FECS_INTR_ACK 0x409004 |
34 | #define NV_PGRAPH_FECS_INTR 0x409008 | 40 | #define NV_PGRAPH_FECS_INTR 0x409008 |
35 | #define NV_PGRAPH_FECS_INTR_FWMTHD 0x00000400 | 41 | #define NV_PGRAPH_FECS_INTR_FWMTHD 0x00000400 |
diff --git a/drivers/gpu/drm/nouveau/core/engine/graph/fuc/os.h b/drivers/gpu/drm/nouveau/core/engine/graph/fuc/os.h index fd1d380de094..1718ae4e8224 100644 --- a/drivers/gpu/drm/nouveau/core/engine/graph/fuc/os.h +++ b/drivers/gpu/drm/nouveau/core/engine/graph/fuc/os.h | |||
@@ -3,5 +3,6 @@ | |||
3 | 3 | ||
4 | #define E_BAD_COMMAND 0x00000001 | 4 | #define E_BAD_COMMAND 0x00000001 |
5 | #define E_CMD_OVERFLOW 0x00000002 | 5 | #define E_CMD_OVERFLOW 0x00000002 |
6 | #define E_BAD_FWMTHD 0x00000003 | ||
6 | 7 | ||
7 | #endif | 8 | #endif |
diff --git a/drivers/gpu/drm/nouveau/core/engine/graph/nv50.c b/drivers/gpu/drm/nouveau/core/engine/graph/nv50.c index 1a2d56493cf6..20665c21d80e 100644 --- a/drivers/gpu/drm/nouveau/core/engine/graph/nv50.c +++ b/drivers/gpu/drm/nouveau/core/engine/graph/nv50.c | |||
@@ -976,7 +976,6 @@ nv50_graph_init(struct nouveau_object *object) | |||
976 | break; | 976 | break; |
977 | case 0xa0: | 977 | case 0xa0: |
978 | default: | 978 | default: |
979 | nv_wr32(priv, 0x402cc0, 0x00000000); | ||
980 | if (nv_device(priv)->chipset == 0xa0 || | 979 | if (nv_device(priv)->chipset == 0xa0 || |
981 | nv_device(priv)->chipset == 0xaa || | 980 | nv_device(priv)->chipset == 0xaa || |
982 | nv_device(priv)->chipset == 0xac) { | 981 | nv_device(priv)->chipset == 0xac) { |
@@ -991,10 +990,10 @@ nv50_graph_init(struct nouveau_object *object) | |||
991 | 990 | ||
992 | /* zero out zcull regions */ | 991 | /* zero out zcull regions */ |
993 | for (i = 0; i < 8; i++) { | 992 | for (i = 0; i < 8; i++) { |
994 | nv_wr32(priv, 0x402c20 + (i * 8), 0x00000000); | 993 | nv_wr32(priv, 0x402c20 + (i * 0x10), 0x00000000); |
995 | nv_wr32(priv, 0x402c24 + (i * 8), 0x00000000); | 994 | nv_wr32(priv, 0x402c24 + (i * 0x10), 0x00000000); |
996 | nv_wr32(priv, 0x402c28 + (i * 8), 0x00000000); | 995 | nv_wr32(priv, 0x402c28 + (i * 0x10), 0x00000000); |
997 | nv_wr32(priv, 0x402c2c + (i * 8), 0x00000000); | 996 | nv_wr32(priv, 0x402c2c + (i * 0x10), 0x00000000); |
998 | } | 997 | } |
999 | return 0; | 998 | return 0; |
1000 | } | 999 | } |
diff --git a/drivers/gpu/drm/nouveau/core/engine/graph/nvc0.c b/drivers/gpu/drm/nouveau/core/engine/graph/nvc0.c index bf7bdb1f291e..aa0838916354 100644 --- a/drivers/gpu/drm/nouveau/core/engine/graph/nvc0.c +++ b/drivers/gpu/drm/nouveau/core/engine/graph/nvc0.c | |||
@@ -789,17 +789,40 @@ nvc0_graph_ctxctl_debug(struct nvc0_graph_priv *priv) | |||
789 | static void | 789 | static void |
790 | nvc0_graph_ctxctl_isr(struct nvc0_graph_priv *priv) | 790 | nvc0_graph_ctxctl_isr(struct nvc0_graph_priv *priv) |
791 | { | 791 | { |
792 | u32 ustat = nv_rd32(priv, 0x409c18); | 792 | u32 stat = nv_rd32(priv, 0x409c18); |
793 | 793 | ||
794 | if (ustat & 0x00000001) | 794 | if (stat & 0x00000001) { |
795 | nv_error(priv, "CTXCTL ucode error\n"); | 795 | u32 code = nv_rd32(priv, 0x409814); |
796 | if (ustat & 0x00080000) | 796 | if (code == E_BAD_FWMTHD) { |
797 | nv_error(priv, "CTXCTL watchdog timeout\n"); | 797 | u32 class = nv_rd32(priv, 0x409808); |
798 | if (ustat & ~0x00080001) | 798 | u32 addr = nv_rd32(priv, 0x40980c); |
799 | nv_error(priv, "CTXCTL 0x%08x\n", ustat); | 799 | u32 subc = (addr & 0x00070000) >> 16; |
800 | u32 mthd = (addr & 0x00003ffc); | ||
801 | u32 data = nv_rd32(priv, 0x409810); | ||
802 | |||
803 | nv_error(priv, "FECS MTHD subc %d class 0x%04x " | ||
804 | "mthd 0x%04x data 0x%08x\n", | ||
805 | subc, class, mthd, data); | ||
800 | 806 | ||
801 | nvc0_graph_ctxctl_debug(priv); | 807 | nv_wr32(priv, 0x409c20, 0x00000001); |
802 | nv_wr32(priv, 0x409c20, ustat); | 808 | stat &= ~0x00000001; |
809 | } else { | ||
810 | nv_error(priv, "FECS ucode error %d\n", code); | ||
811 | } | ||
812 | } | ||
813 | |||
814 | if (stat & 0x00080000) { | ||
815 | nv_error(priv, "FECS watchdog timeout\n"); | ||
816 | nvc0_graph_ctxctl_debug(priv); | ||
817 | nv_wr32(priv, 0x409c20, 0x00080000); | ||
818 | stat &= ~0x00080000; | ||
819 | } | ||
820 | |||
821 | if (stat) { | ||
822 | nv_error(priv, "FECS 0x%08x\n", stat); | ||
823 | nvc0_graph_ctxctl_debug(priv); | ||
824 | nv_wr32(priv, 0x409c20, stat); | ||
825 | } | ||
803 | } | 826 | } |
804 | 827 | ||
805 | static void | 828 | static void |
diff --git a/drivers/gpu/drm/nouveau/core/engine/graph/nvc0.h b/drivers/gpu/drm/nouveau/core/engine/graph/nvc0.h index 75203a99d902..ffc289198dd8 100644 --- a/drivers/gpu/drm/nouveau/core/engine/graph/nvc0.h +++ b/drivers/gpu/drm/nouveau/core/engine/graph/nvc0.h | |||
@@ -38,6 +38,8 @@ | |||
38 | #include <engine/fifo.h> | 38 | #include <engine/fifo.h> |
39 | #include <engine/graph.h> | 39 | #include <engine/graph.h> |
40 | 40 | ||
41 | #include "fuc/os.h" | ||
42 | |||
41 | #define GPC_MAX 32 | 43 | #define GPC_MAX 32 |
42 | #define TPC_MAX (GPC_MAX * 8) | 44 | #define TPC_MAX (GPC_MAX * 8) |
43 | 45 | ||
diff --git a/drivers/gpu/drm/nouveau/core/include/subdev/i2c.h b/drivers/gpu/drm/nouveau/core/include/subdev/i2c.h index db1b39d08013..825f7bb46b67 100644 --- a/drivers/gpu/drm/nouveau/core/include/subdev/i2c.h +++ b/drivers/gpu/drm/nouveau/core/include/subdev/i2c.h | |||
@@ -84,6 +84,7 @@ extern struct nouveau_oclass *nv4e_i2c_oclass; | |||
84 | extern struct nouveau_oclass *nv50_i2c_oclass; | 84 | extern struct nouveau_oclass *nv50_i2c_oclass; |
85 | extern struct nouveau_oclass *nv94_i2c_oclass; | 85 | extern struct nouveau_oclass *nv94_i2c_oclass; |
86 | extern struct nouveau_oclass *nvd0_i2c_oclass; | 86 | extern struct nouveau_oclass *nvd0_i2c_oclass; |
87 | extern struct nouveau_oclass *gf117_i2c_oclass; | ||
87 | extern struct nouveau_oclass *nve0_i2c_oclass; | 88 | extern struct nouveau_oclass *nve0_i2c_oclass; |
88 | 89 | ||
89 | static inline int | 90 | static inline int |
diff --git a/drivers/gpu/drm/nouveau/core/subdev/clock/nve0.c b/drivers/gpu/drm/nouveau/core/subdev/clock/nve0.c index 4ac1aa30ea11..0e62a3240144 100644 --- a/drivers/gpu/drm/nouveau/core/subdev/clock/nve0.c +++ b/drivers/gpu/drm/nouveau/core/subdev/clock/nve0.c | |||
@@ -307,7 +307,6 @@ calc_clk(struct nve0_clock_priv *priv, | |||
307 | info->dsrc = src0; | 307 | info->dsrc = src0; |
308 | if (div0) { | 308 | if (div0) { |
309 | info->ddiv |= 0x80000000; | 309 | info->ddiv |= 0x80000000; |
310 | info->ddiv |= div0 << 8; | ||
311 | info->ddiv |= div0; | 310 | info->ddiv |= div0; |
312 | } | 311 | } |
313 | if (div1D) { | 312 | if (div1D) { |
@@ -352,7 +351,7 @@ nve0_clock_prog_0(struct nve0_clock_priv *priv, int clk) | |||
352 | { | 351 | { |
353 | struct nve0_clock_info *info = &priv->eng[clk]; | 352 | struct nve0_clock_info *info = &priv->eng[clk]; |
354 | if (!info->ssel) { | 353 | if (!info->ssel) { |
355 | nv_mask(priv, 0x1371d0 + (clk * 0x04), 0x80003f3f, info->ddiv); | 354 | nv_mask(priv, 0x1371d0 + (clk * 0x04), 0x8000003f, info->ddiv); |
356 | nv_wr32(priv, 0x137160 + (clk * 0x04), info->dsrc); | 355 | nv_wr32(priv, 0x137160 + (clk * 0x04), info->dsrc); |
357 | } | 356 | } |
358 | } | 357 | } |
@@ -389,7 +388,10 @@ static void | |||
389 | nve0_clock_prog_3(struct nve0_clock_priv *priv, int clk) | 388 | nve0_clock_prog_3(struct nve0_clock_priv *priv, int clk) |
390 | { | 389 | { |
391 | struct nve0_clock_info *info = &priv->eng[clk]; | 390 | struct nve0_clock_info *info = &priv->eng[clk]; |
392 | nv_mask(priv, 0x137250 + (clk * 0x04), 0x00003f3f, info->mdiv); | 391 | if (info->ssel) |
392 | nv_mask(priv, 0x137250 + (clk * 0x04), 0x00003f00, info->mdiv); | ||
393 | else | ||
394 | nv_mask(priv, 0x137250 + (clk * 0x04), 0x0000003f, info->mdiv); | ||
393 | } | 395 | } |
394 | 396 | ||
395 | static void | 397 | static void |
diff --git a/drivers/gpu/drm/nouveau/core/subdev/fb/ramfuc.h b/drivers/gpu/drm/nouveau/core/subdev/fb/ramfuc.h index 0f57fcfe0bbf..2af9cfd2c60f 100644 --- a/drivers/gpu/drm/nouveau/core/subdev/fb/ramfuc.h +++ b/drivers/gpu/drm/nouveau/core/subdev/fb/ramfuc.h | |||
@@ -26,7 +26,7 @@ ramfuc_reg2(u32 addr1, u32 addr2) | |||
26 | }; | 26 | }; |
27 | } | 27 | } |
28 | 28 | ||
29 | static inline struct ramfuc_reg | 29 | static noinline struct ramfuc_reg |
30 | ramfuc_reg(u32 addr) | 30 | ramfuc_reg(u32 addr) |
31 | { | 31 | { |
32 | return ramfuc_reg2(addr, addr); | 32 | return ramfuc_reg2(addr, addr); |
@@ -107,7 +107,7 @@ ramfuc_nsec(struct ramfuc *ram, u32 nsec) | |||
107 | 107 | ||
108 | #define ram_init(s,p) ramfuc_init(&(s)->base, (p)) | 108 | #define ram_init(s,p) ramfuc_init(&(s)->base, (p)) |
109 | #define ram_exec(s,e) ramfuc_exec(&(s)->base, (e)) | 109 | #define ram_exec(s,e) ramfuc_exec(&(s)->base, (e)) |
110 | #define ram_have(s,r) ((s)->r_##r.addr != 0x000000) | 110 | #define ram_have(s,r) ((s)->r_##r.addr[0] != 0x000000) |
111 | #define ram_rd32(s,r) ramfuc_rd32(&(s)->base, &(s)->r_##r) | 111 | #define ram_rd32(s,r) ramfuc_rd32(&(s)->base, &(s)->r_##r) |
112 | #define ram_wr32(s,r,d) ramfuc_wr32(&(s)->base, &(s)->r_##r, (d)) | 112 | #define ram_wr32(s,r,d) ramfuc_wr32(&(s)->base, &(s)->r_##r, (d)) |
113 | #define ram_nuke(s,r) ramfuc_nuke(&(s)->base, &(s)->r_##r) | 113 | #define ram_nuke(s,r) ramfuc_nuke(&(s)->base, &(s)->r_##r) |
diff --git a/drivers/gpu/drm/nouveau/core/subdev/fb/ramnve0.c b/drivers/gpu/drm/nouveau/core/subdev/fb/ramnve0.c index 84c7efbc4f38..c5b46e302319 100644 --- a/drivers/gpu/drm/nouveau/core/subdev/fb/ramnve0.c +++ b/drivers/gpu/drm/nouveau/core/subdev/fb/ramnve0.c | |||
@@ -200,6 +200,7 @@ r1373f4_init(struct nve0_ramfuc *fuc) | |||
200 | /* (re)program mempll, if required */ | 200 | /* (re)program mempll, if required */ |
201 | if (ram->mode == 2) { | 201 | if (ram->mode == 2) { |
202 | ram_mask(fuc, 0x1373f4, 0x00010000, 0x00000000); | 202 | ram_mask(fuc, 0x1373f4, 0x00010000, 0x00000000); |
203 | ram_mask(fuc, 0x132000, 0x80000000, 0x80000000); | ||
203 | ram_mask(fuc, 0x132000, 0x00000001, 0x00000000); | 204 | ram_mask(fuc, 0x132000, 0x00000001, 0x00000000); |
204 | ram_mask(fuc, 0x132004, 0x103fffff, mcoef); | 205 | ram_mask(fuc, 0x132004, 0x103fffff, mcoef); |
205 | ram_mask(fuc, 0x132000, 0x00000001, 0x00000001); | 206 | ram_mask(fuc, 0x132000, 0x00000001, 0x00000001); |
@@ -262,8 +263,8 @@ nve0_ram_calc_gddr5(struct nouveau_fb *pfb, u32 freq) | |||
262 | struct nve0_ram *ram = (void *)pfb->ram; | 263 | struct nve0_ram *ram = (void *)pfb->ram; |
263 | struct nve0_ramfuc *fuc = &ram->fuc; | 264 | struct nve0_ramfuc *fuc = &ram->fuc; |
264 | struct nouveau_ram_data *next = ram->base.next; | 265 | struct nouveau_ram_data *next = ram->base.next; |
265 | int vc = !(next->bios.ramcfg_11_02_08); | 266 | int vc = !next->bios.ramcfg_11_02_08; |
266 | int mv = !(next->bios.ramcfg_11_02_04); | 267 | int mv = !next->bios.ramcfg_11_02_04; |
267 | u32 mask, data; | 268 | u32 mask, data; |
268 | 269 | ||
269 | ram_mask(fuc, 0x10f808, 0x40000000, 0x40000000); | 270 | ram_mask(fuc, 0x10f808, 0x40000000, 0x40000000); |
@@ -370,8 +371,8 @@ nve0_ram_calc_gddr5(struct nouveau_fb *pfb, u32 freq) | |||
370 | } | 371 | } |
371 | } | 372 | } |
372 | 373 | ||
373 | if ( (next->bios.ramcfg_11_02_40) || | 374 | if (next->bios.ramcfg_11_02_40 || |
374 | (next->bios.ramcfg_11_07_10)) { | 375 | next->bios.ramcfg_11_07_10) { |
375 | ram_mask(fuc, 0x132040, 0x00010000, 0x00010000); | 376 | ram_mask(fuc, 0x132040, 0x00010000, 0x00010000); |
376 | ram_nsec(fuc, 20000); | 377 | ram_nsec(fuc, 20000); |
377 | } | 378 | } |
@@ -417,7 +418,7 @@ nve0_ram_calc_gddr5(struct nouveau_fb *pfb, u32 freq) | |||
417 | ram_mask(fuc, 0x10f694, 0xff00ff00, data); | 418 | ram_mask(fuc, 0x10f694, 0xff00ff00, data); |
418 | } | 419 | } |
419 | 420 | ||
420 | if (ram->mode == 2 && (next->bios.ramcfg_11_08_10)) | 421 | if (ram->mode == 2 && next->bios.ramcfg_11_08_10) |
421 | data = 0x00000080; | 422 | data = 0x00000080; |
422 | else | 423 | else |
423 | data = 0x00000000; | 424 | data = 0x00000000; |
@@ -425,13 +426,13 @@ nve0_ram_calc_gddr5(struct nouveau_fb *pfb, u32 freq) | |||
425 | 426 | ||
426 | mask = 0x00070000; | 427 | mask = 0x00070000; |
427 | data = 0x00000000; | 428 | data = 0x00000000; |
428 | if (!(next->bios.ramcfg_11_02_80)) | 429 | if (!next->bios.ramcfg_11_02_80) |
429 | data |= 0x03000000; | 430 | data |= 0x03000000; |
430 | if (!(next->bios.ramcfg_11_02_40)) | 431 | if (!next->bios.ramcfg_11_02_40) |
431 | data |= 0x00002000; | 432 | data |= 0x00002000; |
432 | if (!(next->bios.ramcfg_11_07_10)) | 433 | if (!next->bios.ramcfg_11_07_10) |
433 | data |= 0x00004000; | 434 | data |= 0x00004000; |
434 | if (!(next->bios.ramcfg_11_07_08)) | 435 | if (!next->bios.ramcfg_11_07_08) |
435 | data |= 0x00000003; | 436 | data |= 0x00000003; |
436 | else | 437 | else |
437 | data |= 0x74000000; | 438 | data |= 0x74000000; |
@@ -486,7 +487,7 @@ nve0_ram_calc_gddr5(struct nouveau_fb *pfb, u32 freq) | |||
486 | 487 | ||
487 | data = mask = 0x00000000; | 488 | data = mask = 0x00000000; |
488 | if (NOTE00(ramcfg_02_03 != 0)) { | 489 | if (NOTE00(ramcfg_02_03 != 0)) { |
489 | data |= (next->bios.ramcfg_11_02_03) << 8; | 490 | data |= next->bios.ramcfg_11_02_03 << 8; |
490 | mask |= 0x00000300; | 491 | mask |= 0x00000300; |
491 | } | 492 | } |
492 | if (NOTE00(ramcfg_01_10)) { | 493 | if (NOTE00(ramcfg_01_10)) { |
@@ -498,7 +499,7 @@ nve0_ram_calc_gddr5(struct nouveau_fb *pfb, u32 freq) | |||
498 | 499 | ||
499 | data = mask = 0x00000000; | 500 | data = mask = 0x00000000; |
500 | if (NOTE00(timing_30_07 != 0)) { | 501 | if (NOTE00(timing_30_07 != 0)) { |
501 | data |= (next->bios.timing_20_30_07) << 28; | 502 | data |= next->bios.timing_20_30_07 << 28; |
502 | mask |= 0x70000000; | 503 | mask |= 0x70000000; |
503 | } | 504 | } |
504 | if (NOTE00(ramcfg_01_01)) { | 505 | if (NOTE00(ramcfg_01_01)) { |
@@ -510,7 +511,7 @@ nve0_ram_calc_gddr5(struct nouveau_fb *pfb, u32 freq) | |||
510 | 511 | ||
511 | data = mask = 0x00000000; | 512 | data = mask = 0x00000000; |
512 | if (NOTE00(timing_30_07 != 0)) { | 513 | if (NOTE00(timing_30_07 != 0)) { |
513 | data |= (next->bios.timing_20_30_07) << 28; | 514 | data |= next->bios.timing_20_30_07 << 28; |
514 | mask |= 0x70000000; | 515 | mask |= 0x70000000; |
515 | } | 516 | } |
516 | if (NOTE00(ramcfg_01_02)) { | 517 | if (NOTE00(ramcfg_01_02)) { |
@@ -522,16 +523,16 @@ nve0_ram_calc_gddr5(struct nouveau_fb *pfb, u32 freq) | |||
522 | 523 | ||
523 | mask = 0x33f00000; | 524 | mask = 0x33f00000; |
524 | data = 0x00000000; | 525 | data = 0x00000000; |
525 | if (!(next->bios.ramcfg_11_01_04)) | 526 | if (!next->bios.ramcfg_11_01_04) |
526 | data |= 0x20200000; | 527 | data |= 0x20200000; |
527 | if (!(next->bios.ramcfg_11_07_80)) | 528 | if (!next->bios.ramcfg_11_07_80) |
528 | data |= 0x12800000; | 529 | data |= 0x12800000; |
529 | /*XXX: see note above about there probably being some condition | 530 | /*XXX: see note above about there probably being some condition |
530 | * for the 10f824 stuff that uses ramcfg 3... | 531 | * for the 10f824 stuff that uses ramcfg 3... |
531 | */ | 532 | */ |
532 | if ( (next->bios.ramcfg_11_03_f0)) { | 533 | if (next->bios.ramcfg_11_03_f0) { |
533 | if (next->bios.rammap_11_08_0c) { | 534 | if (next->bios.rammap_11_08_0c) { |
534 | if (!(next->bios.ramcfg_11_07_80)) | 535 | if (!next->bios.ramcfg_11_07_80) |
535 | mask |= 0x00000020; | 536 | mask |= 0x00000020; |
536 | else | 537 | else |
537 | data |= 0x00000020; | 538 | data |= 0x00000020; |
@@ -563,7 +564,7 @@ nve0_ram_calc_gddr5(struct nouveau_fb *pfb, u32 freq) | |||
563 | ram_wait(fuc, 0x100710, 0x80000000, 0x80000000, 200000); | 564 | ram_wait(fuc, 0x100710, 0x80000000, 0x80000000, 200000); |
564 | } | 565 | } |
565 | 566 | ||
566 | data = (next->bios.timing_20_30_07) << 8; | 567 | data = next->bios.timing_20_30_07 << 8; |
567 | if (next->bios.ramcfg_11_01_01) | 568 | if (next->bios.ramcfg_11_01_01) |
568 | data |= 0x80000000; | 569 | data |= 0x80000000; |
569 | ram_mask(fuc, 0x100778, 0x00000700, data); | 570 | ram_mask(fuc, 0x100778, 0x00000700, data); |
@@ -588,7 +589,7 @@ nve0_ram_calc_gddr5(struct nouveau_fb *pfb, u32 freq) | |||
588 | ram_wr32(fuc, 0x10f310, 0x00000001); /* REFRESH */ | 589 | ram_wr32(fuc, 0x10f310, 0x00000001); /* REFRESH */ |
589 | ram_wr32(fuc, 0x10f210, 0x80000000); /* REFRESH_AUTO = 1 */ | 590 | ram_wr32(fuc, 0x10f210, 0x80000000); /* REFRESH_AUTO = 1 */ |
590 | 591 | ||
591 | if ((next->bios.ramcfg_11_08_10) && (ram->mode == 2) /*XXX*/) { | 592 | if (next->bios.ramcfg_11_08_10 && (ram->mode == 2) /*XXX*/) { |
592 | u32 temp = ram_mask(fuc, 0x10f294, 0xff000000, 0x24000000); | 593 | u32 temp = ram_mask(fuc, 0x10f294, 0xff000000, 0x24000000); |
593 | nve0_ram_train(fuc, 0xbc0e0000, 0xa4010000); /*XXX*/ | 594 | nve0_ram_train(fuc, 0xbc0e0000, 0xa4010000); /*XXX*/ |
594 | ram_nsec(fuc, 1000); | 595 | ram_nsec(fuc, 1000); |
@@ -621,8 +622,8 @@ nve0_ram_calc_gddr5(struct nouveau_fb *pfb, u32 freq) | |||
621 | data = ram_rd32(fuc, 0x10f978); | 622 | data = ram_rd32(fuc, 0x10f978); |
622 | data &= ~0x00046144; | 623 | data &= ~0x00046144; |
623 | data |= 0x0000000b; | 624 | data |= 0x0000000b; |
624 | if (!(next->bios.ramcfg_11_07_08)) { | 625 | if (!next->bios.ramcfg_11_07_08) { |
625 | if (!(next->bios.ramcfg_11_07_04)) | 626 | if (!next->bios.ramcfg_11_07_04) |
626 | data |= 0x0000200c; | 627 | data |= 0x0000200c; |
627 | else | 628 | else |
628 | data |= 0x00000000; | 629 | data |= 0x00000000; |
@@ -636,11 +637,11 @@ nve0_ram_calc_gddr5(struct nouveau_fb *pfb, u32 freq) | |||
636 | ram_wr32(fuc, 0x10f830, data); | 637 | ram_wr32(fuc, 0x10f830, data); |
637 | } | 638 | } |
638 | 639 | ||
639 | if (!(next->bios.ramcfg_11_07_08)) { | 640 | if (!next->bios.ramcfg_11_07_08) { |
640 | data = 0x88020000; | 641 | data = 0x88020000; |
641 | if ( (next->bios.ramcfg_11_07_04)) | 642 | if ( next->bios.ramcfg_11_07_04) |
642 | data |= 0x10000000; | 643 | data |= 0x10000000; |
643 | if (!(next->bios.rammap_11_08_10)) | 644 | if (!next->bios.rammap_11_08_10) |
644 | data |= 0x00080000; | 645 | data |= 0x00080000; |
645 | } else { | 646 | } else { |
646 | data = 0xa40e0000; | 647 | data = 0xa40e0000; |
@@ -689,8 +690,8 @@ nve0_ram_calc_sddr3(struct nouveau_fb *pfb, u32 freq) | |||
689 | const u32 runk0 = ram->fN1 << 16; | 690 | const u32 runk0 = ram->fN1 << 16; |
690 | const u32 runk1 = ram->fN1; | 691 | const u32 runk1 = ram->fN1; |
691 | struct nouveau_ram_data *next = ram->base.next; | 692 | struct nouveau_ram_data *next = ram->base.next; |
692 | int vc = !(next->bios.ramcfg_11_02_08); | 693 | int vc = !next->bios.ramcfg_11_02_08; |
693 | int mv = !(next->bios.ramcfg_11_02_04); | 694 | int mv = !next->bios.ramcfg_11_02_04; |
694 | u32 mask, data; | 695 | u32 mask, data; |
695 | 696 | ||
696 | ram_mask(fuc, 0x10f808, 0x40000000, 0x40000000); | 697 | ram_mask(fuc, 0x10f808, 0x40000000, 0x40000000); |
@@ -705,7 +706,7 @@ nve0_ram_calc_sddr3(struct nouveau_fb *pfb, u32 freq) | |||
705 | } | 706 | } |
706 | 707 | ||
707 | ram_mask(fuc, 0x10f200, 0x00000800, 0x00000000); | 708 | ram_mask(fuc, 0x10f200, 0x00000800, 0x00000000); |
708 | if ((next->bios.ramcfg_11_03_f0)) | 709 | if (next->bios.ramcfg_11_03_f0) |
709 | ram_mask(fuc, 0x10f808, 0x04000000, 0x04000000); | 710 | ram_mask(fuc, 0x10f808, 0x04000000, 0x04000000); |
710 | 711 | ||
711 | ram_wr32(fuc, 0x10f314, 0x00000001); /* PRECHARGE */ | 712 | ram_wr32(fuc, 0x10f314, 0x00000001); /* PRECHARGE */ |
@@ -761,7 +762,7 @@ nve0_ram_calc_sddr3(struct nouveau_fb *pfb, u32 freq) | |||
761 | 762 | ||
762 | ram_mask(fuc, 0x1373f4, 0x00000000, 0x00010010); | 763 | ram_mask(fuc, 0x1373f4, 0x00000000, 0x00010010); |
763 | data = ram_rd32(fuc, 0x1373ec) & ~0x00030000; | 764 | data = ram_rd32(fuc, 0x1373ec) & ~0x00030000; |
764 | data |= (next->bios.ramcfg_11_03_30) << 12; | 765 | data |= next->bios.ramcfg_11_03_30 << 16; |
765 | ram_wr32(fuc, 0x1373ec, data); | 766 | ram_wr32(fuc, 0x1373ec, data); |
766 | ram_mask(fuc, 0x1373f4, 0x00000003, 0x00000000); | 767 | ram_mask(fuc, 0x1373f4, 0x00000003, 0x00000000); |
767 | ram_mask(fuc, 0x1373f4, 0x00000010, 0x00000000); | 768 | ram_mask(fuc, 0x1373f4, 0x00000010, 0x00000000); |
@@ -793,8 +794,8 @@ nve0_ram_calc_sddr3(struct nouveau_fb *pfb, u32 freq) | |||
793 | } | 794 | } |
794 | } | 795 | } |
795 | 796 | ||
796 | if ( (next->bios.ramcfg_11_02_40) || | 797 | if (next->bios.ramcfg_11_02_40 || |
797 | (next->bios.ramcfg_11_07_10)) { | 798 | next->bios.ramcfg_11_07_10) { |
798 | ram_mask(fuc, 0x132040, 0x00010000, 0x00010000); | 799 | ram_mask(fuc, 0x132040, 0x00010000, 0x00010000); |
799 | ram_nsec(fuc, 20000); | 800 | ram_nsec(fuc, 20000); |
800 | } | 801 | } |
@@ -810,13 +811,13 @@ nve0_ram_calc_sddr3(struct nouveau_fb *pfb, u32 freq) | |||
810 | 811 | ||
811 | mask = 0x00010000; | 812 | mask = 0x00010000; |
812 | data = 0x00000000; | 813 | data = 0x00000000; |
813 | if (!(next->bios.ramcfg_11_02_80)) | 814 | if (!next->bios.ramcfg_11_02_80) |
814 | data |= 0x03000000; | 815 | data |= 0x03000000; |
815 | if (!(next->bios.ramcfg_11_02_40)) | 816 | if (!next->bios.ramcfg_11_02_40) |
816 | data |= 0x00002000; | 817 | data |= 0x00002000; |
817 | if (!(next->bios.ramcfg_11_07_10)) | 818 | if (!next->bios.ramcfg_11_07_10) |
818 | data |= 0x00004000; | 819 | data |= 0x00004000; |
819 | if (!(next->bios.ramcfg_11_07_08)) | 820 | if (!next->bios.ramcfg_11_07_08) |
820 | data |= 0x00000003; | 821 | data |= 0x00000003; |
821 | else | 822 | else |
822 | data |= 0x14000000; | 823 | data |= 0x14000000; |
@@ -844,16 +845,16 @@ nve0_ram_calc_sddr3(struct nouveau_fb *pfb, u32 freq) | |||
844 | 845 | ||
845 | mask = 0x33f00000; | 846 | mask = 0x33f00000; |
846 | data = 0x00000000; | 847 | data = 0x00000000; |
847 | if (!(next->bios.ramcfg_11_01_04)) | 848 | if (!next->bios.ramcfg_11_01_04) |
848 | data |= 0x20200000; | 849 | data |= 0x20200000; |
849 | if (!(next->bios.ramcfg_11_07_80)) | 850 | if (!next->bios.ramcfg_11_07_80) |
850 | data |= 0x12800000; | 851 | data |= 0x12800000; |
851 | /*XXX: see note above about there probably being some condition | 852 | /*XXX: see note above about there probably being some condition |
852 | * for the 10f824 stuff that uses ramcfg 3... | 853 | * for the 10f824 stuff that uses ramcfg 3... |
853 | */ | 854 | */ |
854 | if ( (next->bios.ramcfg_11_03_f0)) { | 855 | if (next->bios.ramcfg_11_03_f0) { |
855 | if (next->bios.rammap_11_08_0c) { | 856 | if (next->bios.rammap_11_08_0c) { |
856 | if (!(next->bios.ramcfg_11_07_80)) | 857 | if (!next->bios.ramcfg_11_07_80) |
857 | mask |= 0x00000020; | 858 | mask |= 0x00000020; |
858 | else | 859 | else |
859 | data |= 0x00000020; | 860 | data |= 0x00000020; |
@@ -876,7 +877,7 @@ nve0_ram_calc_sddr3(struct nouveau_fb *pfb, u32 freq) | |||
876 | data = next->bios.timing_20_2c_1fc0; | 877 | data = next->bios.timing_20_2c_1fc0; |
877 | ram_mask(fuc, 0x10f24c, 0x7f000000, data << 24); | 878 | ram_mask(fuc, 0x10f24c, 0x7f000000, data << 24); |
878 | 879 | ||
879 | ram_mask(fuc, 0x10f224, 0x001f0000, next->bios.timing_20_30_f8); | 880 | ram_mask(fuc, 0x10f224, 0x001f0000, next->bios.timing_20_30_f8 << 16); |
880 | 881 | ||
881 | ram_wr32(fuc, 0x10f090, 0x4000007f); | 882 | ram_wr32(fuc, 0x10f090, 0x4000007f); |
882 | ram_nsec(fuc, 1000); | 883 | ram_nsec(fuc, 1000); |
diff --git a/drivers/gpu/drm/nouveau/core/subdev/i2c/gf117.c b/drivers/gpu/drm/nouveau/core/subdev/i2c/gf117.c new file mode 100644 index 000000000000..fa891c39866b --- /dev/null +++ b/drivers/gpu/drm/nouveau/core/subdev/i2c/gf117.c | |||
@@ -0,0 +1,39 @@ | |||
1 | /* | ||
2 | * Copyright 2012 Red Hat Inc. | ||
3 | * | ||
4 | * Permission is hereby granted, free of charge, to any person obtaining a | ||
5 | * copy of this software and associated documentation files (the "Software"), | ||
6 | * to deal in the Software without restriction, including without limitation | ||
7 | * the rights to use, copy, modify, merge, publish, distribute, sublicense, | ||
8 | * and/or sell copies of the Software, and to permit persons to whom the | ||
9 | * Software is furnished to do so, subject to the following conditions: | ||
10 | * | ||
11 | * The above copyright notice and this permission notice shall be included in | ||
12 | * all copies or substantial portions of the Software. | ||
13 | * | ||
14 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
15 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
16 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL | ||
17 | * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR | ||
18 | * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, | ||
19 | * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR | ||
20 | * OTHER DEALINGS IN THE SOFTWARE. | ||
21 | * | ||
22 | * Authors: Ben Skeggs | ||
23 | */ | ||
24 | |||
25 | #include "nv50.h" | ||
26 | |||
27 | struct nouveau_oclass * | ||
28 | gf117_i2c_oclass = &(struct nouveau_i2c_impl) { | ||
29 | .base.handle = NV_SUBDEV(I2C, 0xd7), | ||
30 | .base.ofuncs = &(struct nouveau_ofuncs) { | ||
31 | .ctor = _nouveau_i2c_ctor, | ||
32 | .dtor = _nouveau_i2c_dtor, | ||
33 | .init = _nouveau_i2c_init, | ||
34 | .fini = _nouveau_i2c_fini, | ||
35 | }, | ||
36 | .sclass = nvd0_i2c_sclass, | ||
37 | .pad_x = &nv04_i2c_pad_oclass, | ||
38 | .pad_s = &nv04_i2c_pad_oclass, | ||
39 | }.base; | ||
diff --git a/drivers/gpu/drm/nouveau/core/subdev/ibus/nve0.c b/drivers/gpu/drm/nouveau/core/subdev/ibus/nve0.c index 7120124dceac..ebef970a0645 100644 --- a/drivers/gpu/drm/nouveau/core/subdev/ibus/nve0.c +++ b/drivers/gpu/drm/nouveau/core/subdev/ibus/nve0.c | |||
@@ -95,6 +95,23 @@ nve0_ibus_intr(struct nouveau_subdev *subdev) | |||
95 | } | 95 | } |
96 | 96 | ||
97 | static int | 97 | static int |
98 | nve0_ibus_init(struct nouveau_object *object) | ||
99 | { | ||
100 | struct nve0_ibus_priv *priv = (void *)object; | ||
101 | int ret = nouveau_ibus_init(&priv->base); | ||
102 | if (ret == 0) { | ||
103 | nv_mask(priv, 0x122318, 0x0003ffff, 0x00001000); | ||
104 | nv_mask(priv, 0x12231c, 0x0003ffff, 0x00000200); | ||
105 | nv_mask(priv, 0x122310, 0x0003ffff, 0x00000800); | ||
106 | nv_mask(priv, 0x122348, 0x0003ffff, 0x00000100); | ||
107 | nv_mask(priv, 0x1223b0, 0x0003ffff, 0x00000fff); | ||
108 | nv_mask(priv, 0x122348, 0x0003ffff, 0x00000200); | ||
109 | nv_mask(priv, 0x122358, 0x0003ffff, 0x00002880); | ||
110 | } | ||
111 | return ret; | ||
112 | } | ||
113 | |||
114 | static int | ||
98 | nve0_ibus_ctor(struct nouveau_object *parent, struct nouveau_object *engine, | 115 | nve0_ibus_ctor(struct nouveau_object *parent, struct nouveau_object *engine, |
99 | struct nouveau_oclass *oclass, void *data, u32 size, | 116 | struct nouveau_oclass *oclass, void *data, u32 size, |
100 | struct nouveau_object **pobject) | 117 | struct nouveau_object **pobject) |
@@ -117,7 +134,7 @@ nve0_ibus_oclass = { | |||
117 | .ofuncs = &(struct nouveau_ofuncs) { | 134 | .ofuncs = &(struct nouveau_ofuncs) { |
118 | .ctor = nve0_ibus_ctor, | 135 | .ctor = nve0_ibus_ctor, |
119 | .dtor = _nouveau_ibus_dtor, | 136 | .dtor = _nouveau_ibus_dtor, |
120 | .init = _nouveau_ibus_init, | 137 | .init = nve0_ibus_init, |
121 | .fini = _nouveau_ibus_fini, | 138 | .fini = _nouveau_ibus_fini, |
122 | }, | 139 | }, |
123 | }; | 140 | }; |
diff --git a/drivers/gpu/drm/nouveau/core/subdev/pwr/fuc/host.fuc b/drivers/gpu/drm/nouveau/core/subdev/pwr/fuc/host.fuc index 2284ecb1c9b8..c2bb616a8da5 100644 --- a/drivers/gpu/drm/nouveau/core/subdev/pwr/fuc/host.fuc +++ b/drivers/gpu/drm/nouveau/core/subdev/pwr/fuc/host.fuc | |||
@@ -83,7 +83,7 @@ host_send: | |||
83 | // increment GET | 83 | // increment GET |
84 | add b32 $r1 0x1 | 84 | add b32 $r1 0x1 |
85 | and $r14 $r1 #fifo_qmaskf | 85 | and $r14 $r1 #fifo_qmaskf |
86 | nv_iowr(NV_PPWR_FIFO_GET(0), $r1) | 86 | nv_iowr(NV_PPWR_FIFO_GET(0), $r14) |
87 | bra #host_send | 87 | bra #host_send |
88 | host_send_done: | 88 | host_send_done: |
89 | ret | 89 | ret |
diff --git a/drivers/gpu/drm/nouveau/core/subdev/pwr/fuc/nv108.fuc.h b/drivers/gpu/drm/nouveau/core/subdev/pwr/fuc/nv108.fuc.h index 4bd43a99fdcc..39a5dc150a05 100644 --- a/drivers/gpu/drm/nouveau/core/subdev/pwr/fuc/nv108.fuc.h +++ b/drivers/gpu/drm/nouveau/core/subdev/pwr/fuc/nv108.fuc.h | |||
@@ -1018,7 +1018,7 @@ uint32_t nv108_pwr_code[] = { | |||
1018 | 0xb600023f, | 1018 | 0xb600023f, |
1019 | 0x1ec40110, | 1019 | 0x1ec40110, |
1020 | 0x04b0400f, | 1020 | 0x04b0400f, |
1021 | 0xbd0001f6, | 1021 | 0xbd000ef6, |
1022 | 0xc70ef404, | 1022 | 0xc70ef404, |
1023 | /* 0x0328: host_send_done */ | 1023 | /* 0x0328: host_send_done */ |
1024 | /* 0x032a: host_recv */ | 1024 | /* 0x032a: host_recv */ |
diff --git a/drivers/gpu/drm/nouveau/core/subdev/pwr/fuc/nva3.fuc.h b/drivers/gpu/drm/nouveau/core/subdev/pwr/fuc/nva3.fuc.h index 5a73fa620978..254205cd5166 100644 --- a/drivers/gpu/drm/nouveau/core/subdev/pwr/fuc/nva3.fuc.h +++ b/drivers/gpu/drm/nouveau/core/subdev/pwr/fuc/nva3.fuc.h | |||
@@ -1124,7 +1124,7 @@ uint32_t nva3_pwr_code[] = { | |||
1124 | 0x0f1ec401, | 1124 | 0x0f1ec401, |
1125 | 0x04b007f1, | 1125 | 0x04b007f1, |
1126 | 0xd00604b6, | 1126 | 0xd00604b6, |
1127 | 0x04bd0001, | 1127 | 0x04bd000e, |
1128 | /* 0x03cb: host_send_done */ | 1128 | /* 0x03cb: host_send_done */ |
1129 | 0xf8ba0ef4, | 1129 | 0xf8ba0ef4, |
1130 | /* 0x03cd: host_recv */ | 1130 | /* 0x03cd: host_recv */ |
diff --git a/drivers/gpu/drm/nouveau/core/subdev/pwr/fuc/nvc0.fuc.h b/drivers/gpu/drm/nouveau/core/subdev/pwr/fuc/nvc0.fuc.h index 4dba00d2dd1a..7ac87405d01b 100644 --- a/drivers/gpu/drm/nouveau/core/subdev/pwr/fuc/nvc0.fuc.h +++ b/drivers/gpu/drm/nouveau/core/subdev/pwr/fuc/nvc0.fuc.h | |||
@@ -1124,7 +1124,7 @@ uint32_t nvc0_pwr_code[] = { | |||
1124 | 0x0f1ec401, | 1124 | 0x0f1ec401, |
1125 | 0x04b007f1, | 1125 | 0x04b007f1, |
1126 | 0xd00604b6, | 1126 | 0xd00604b6, |
1127 | 0x04bd0001, | 1127 | 0x04bd000e, |
1128 | /* 0x03cb: host_send_done */ | 1128 | /* 0x03cb: host_send_done */ |
1129 | 0xf8ba0ef4, | 1129 | 0xf8ba0ef4, |
1130 | /* 0x03cd: host_recv */ | 1130 | /* 0x03cd: host_recv */ |
diff --git a/drivers/gpu/drm/nouveau/core/subdev/pwr/fuc/nvd0.fuc.h b/drivers/gpu/drm/nouveau/core/subdev/pwr/fuc/nvd0.fuc.h index 5e24c6bc041d..cd9ff1a73284 100644 --- a/drivers/gpu/drm/nouveau/core/subdev/pwr/fuc/nvd0.fuc.h +++ b/drivers/gpu/drm/nouveau/core/subdev/pwr/fuc/nvd0.fuc.h | |||
@@ -1033,7 +1033,7 @@ uint32_t nvd0_pwr_code[] = { | |||
1033 | 0xb6026b21, | 1033 | 0xb6026b21, |
1034 | 0x1ec40110, | 1034 | 0x1ec40110, |
1035 | 0xb007f10f, | 1035 | 0xb007f10f, |
1036 | 0x0001d004, | 1036 | 0x000ed004, |
1037 | 0x0ef404bd, | 1037 | 0x0ef404bd, |
1038 | /* 0x0365: host_send_done */ | 1038 | /* 0x0365: host_send_done */ |
1039 | /* 0x0367: host_recv */ | 1039 | /* 0x0367: host_recv */ |
diff --git a/drivers/gpu/drm/nouveau/nouveau_display.c b/drivers/gpu/drm/nouveau/nouveau_display.c index 26b5647188ef..47ad74255bf1 100644 --- a/drivers/gpu/drm/nouveau/nouveau_display.c +++ b/drivers/gpu/drm/nouveau/nouveau_display.c | |||
@@ -736,6 +736,9 @@ nouveau_crtc_page_flip(struct drm_crtc *crtc, struct drm_framebuffer *fb, | |||
736 | fb->bits_per_pixel, fb->pitches[0], crtc->x, crtc->y, | 736 | fb->bits_per_pixel, fb->pitches[0], crtc->x, crtc->y, |
737 | new_bo->bo.offset }; | 737 | new_bo->bo.offset }; |
738 | 738 | ||
739 | /* Keep vblanks on during flip, for the target crtc of this flip */ | ||
740 | drm_vblank_get(dev, nouveau_crtc(crtc)->index); | ||
741 | |||
739 | /* Emit a page flip */ | 742 | /* Emit a page flip */ |
740 | if (nv_device(drm->device)->card_type >= NV_50) { | 743 | if (nv_device(drm->device)->card_type >= NV_50) { |
741 | ret = nv50_display_flip_next(crtc, fb, chan, swap_interval); | 744 | ret = nv50_display_flip_next(crtc, fb, chan, swap_interval); |
@@ -779,6 +782,7 @@ nouveau_crtc_page_flip(struct drm_crtc *crtc, struct drm_framebuffer *fb, | |||
779 | return 0; | 782 | return 0; |
780 | 783 | ||
781 | fail_unreserve: | 784 | fail_unreserve: |
785 | drm_vblank_put(dev, nouveau_crtc(crtc)->index); | ||
782 | ttm_bo_unreserve(&old_bo->bo); | 786 | ttm_bo_unreserve(&old_bo->bo); |
783 | fail_unpin: | 787 | fail_unpin: |
784 | mutex_unlock(&chan->cli->mutex); | 788 | mutex_unlock(&chan->cli->mutex); |
@@ -817,6 +821,9 @@ nouveau_finish_page_flip(struct nouveau_channel *chan, | |||
817 | drm_send_vblank_event(dev, crtcid, s->event); | 821 | drm_send_vblank_event(dev, crtcid, s->event); |
818 | } | 822 | } |
819 | 823 | ||
824 | /* Give up ownership of vblank for page-flipped crtc */ | ||
825 | drm_vblank_put(dev, s->crtc); | ||
826 | |||
820 | list_del(&s->head); | 827 | list_del(&s->head); |
821 | if (ps) | 828 | if (ps) |
822 | *ps = *s; | 829 | *ps = *s; |
diff --git a/drivers/gpu/drm/nouveau/nouveau_drm.c b/drivers/gpu/drm/nouveau/nouveau_drm.c index ddd83756b9a2..5425ffe3931d 100644 --- a/drivers/gpu/drm/nouveau/nouveau_drm.c +++ b/drivers/gpu/drm/nouveau/nouveau_drm.c | |||
@@ -652,12 +652,12 @@ int nouveau_pmops_resume(struct device *dev) | |||
652 | ret = nouveau_do_resume(drm_dev); | 652 | ret = nouveau_do_resume(drm_dev); |
653 | if (ret) | 653 | if (ret) |
654 | return ret; | 654 | return ret; |
655 | if (drm_dev->mode_config.num_crtc) | ||
656 | nouveau_fbcon_set_suspend(drm_dev, 0); | ||
657 | 655 | ||
658 | nouveau_fbcon_zfill_all(drm_dev); | 656 | if (drm_dev->mode_config.num_crtc) { |
659 | if (drm_dev->mode_config.num_crtc) | ||
660 | nouveau_display_resume(drm_dev); | 657 | nouveau_display_resume(drm_dev); |
658 | nouveau_fbcon_set_suspend(drm_dev, 0); | ||
659 | } | ||
660 | |||
661 | return 0; | 661 | return 0; |
662 | } | 662 | } |
663 | 663 | ||
@@ -683,11 +683,12 @@ static int nouveau_pmops_thaw(struct device *dev) | |||
683 | ret = nouveau_do_resume(drm_dev); | 683 | ret = nouveau_do_resume(drm_dev); |
684 | if (ret) | 684 | if (ret) |
685 | return ret; | 685 | return ret; |
686 | if (drm_dev->mode_config.num_crtc) | 686 | |
687 | nouveau_fbcon_set_suspend(drm_dev, 0); | 687 | if (drm_dev->mode_config.num_crtc) { |
688 | nouveau_fbcon_zfill_all(drm_dev); | ||
689 | if (drm_dev->mode_config.num_crtc) | ||
690 | nouveau_display_resume(drm_dev); | 688 | nouveau_display_resume(drm_dev); |
689 | nouveau_fbcon_set_suspend(drm_dev, 0); | ||
690 | } | ||
691 | |||
691 | return 0; | 692 | return 0; |
692 | } | 693 | } |
693 | 694 | ||
diff --git a/drivers/gpu/drm/nouveau/nouveau_fbcon.c b/drivers/gpu/drm/nouveau/nouveau_fbcon.c index 64a42cfd3717..191665ee7f52 100644 --- a/drivers/gpu/drm/nouveau/nouveau_fbcon.c +++ b/drivers/gpu/drm/nouveau/nouveau_fbcon.c | |||
@@ -531,17 +531,10 @@ nouveau_fbcon_set_suspend(struct drm_device *dev, int state) | |||
531 | if (state == 1) | 531 | if (state == 1) |
532 | nouveau_fbcon_save_disable_accel(dev); | 532 | nouveau_fbcon_save_disable_accel(dev); |
533 | fb_set_suspend(drm->fbcon->helper.fbdev, state); | 533 | fb_set_suspend(drm->fbcon->helper.fbdev, state); |
534 | if (state == 0) | 534 | if (state == 0) { |
535 | nouveau_fbcon_restore_accel(dev); | 535 | nouveau_fbcon_restore_accel(dev); |
536 | nouveau_fbcon_zfill(dev, drm->fbcon); | ||
537 | } | ||
536 | console_unlock(); | 538 | console_unlock(); |
537 | } | 539 | } |
538 | } | 540 | } |
539 | |||
540 | void | ||
541 | nouveau_fbcon_zfill_all(struct drm_device *dev) | ||
542 | { | ||
543 | struct nouveau_drm *drm = nouveau_drm(dev); | ||
544 | if (drm->fbcon) { | ||
545 | nouveau_fbcon_zfill(dev, drm->fbcon); | ||
546 | } | ||
547 | } | ||
diff --git a/drivers/gpu/drm/nouveau/nouveau_fbcon.h b/drivers/gpu/drm/nouveau/nouveau_fbcon.h index fdfc0c94fbcc..fcff797d2084 100644 --- a/drivers/gpu/drm/nouveau/nouveau_fbcon.h +++ b/drivers/gpu/drm/nouveau/nouveau_fbcon.h | |||
@@ -61,7 +61,6 @@ void nouveau_fbcon_gpu_lockup(struct fb_info *info); | |||
61 | int nouveau_fbcon_init(struct drm_device *dev); | 61 | int nouveau_fbcon_init(struct drm_device *dev); |
62 | void nouveau_fbcon_fini(struct drm_device *dev); | 62 | void nouveau_fbcon_fini(struct drm_device *dev); |
63 | void nouveau_fbcon_set_suspend(struct drm_device *dev, int state); | 63 | void nouveau_fbcon_set_suspend(struct drm_device *dev, int state); |
64 | void nouveau_fbcon_zfill_all(struct drm_device *dev); | ||
65 | void nouveau_fbcon_save_disable_accel(struct drm_device *dev); | 64 | void nouveau_fbcon_save_disable_accel(struct drm_device *dev); |
66 | void nouveau_fbcon_restore_accel(struct drm_device *dev); | 65 | void nouveau_fbcon_restore_accel(struct drm_device *dev); |
67 | 66 | ||
diff --git a/drivers/gpu/drm/nouveau/nv50_display.c b/drivers/gpu/drm/nouveau/nv50_display.c index afdf607df3e6..4c534b7b04da 100644 --- a/drivers/gpu/drm/nouveau/nv50_display.c +++ b/drivers/gpu/drm/nouveau/nv50_display.c | |||
@@ -1741,7 +1741,8 @@ nv50_sor_dpms(struct drm_encoder *encoder, int mode) | |||
1741 | } | 1741 | } |
1742 | } | 1742 | } |
1743 | 1743 | ||
1744 | mthd = (ffs(nv_encoder->dcb->sorconf.link) - 1) << 2; | 1744 | mthd = (ffs(nv_encoder->dcb->heads) - 1) << 3; |
1745 | mthd |= (ffs(nv_encoder->dcb->sorconf.link) - 1) << 2; | ||
1745 | mthd |= nv_encoder->or; | 1746 | mthd |= nv_encoder->or; |
1746 | 1747 | ||
1747 | if (nv_encoder->dcb->type == DCB_OUTPUT_DP) { | 1748 | if (nv_encoder->dcb->type == DCB_OUTPUT_DP) { |
diff --git a/drivers/gpu/drm/radeon/atombios_crtc.c b/drivers/gpu/drm/radeon/atombios_crtc.c index 26c12a3fe430..a03c73411a56 100644 --- a/drivers/gpu/drm/radeon/atombios_crtc.c +++ b/drivers/gpu/drm/radeon/atombios_crtc.c | |||
@@ -1052,7 +1052,7 @@ static void atombios_crtc_set_pll(struct drm_crtc *crtc, struct drm_display_mode | |||
1052 | int encoder_mode = atombios_get_encoder_mode(radeon_crtc->encoder); | 1052 | int encoder_mode = atombios_get_encoder_mode(radeon_crtc->encoder); |
1053 | 1053 | ||
1054 | /* pass the actual clock to atombios_crtc_program_pll for DCE5,6 for HDMI */ | 1054 | /* pass the actual clock to atombios_crtc_program_pll for DCE5,6 for HDMI */ |
1055 | if (ASIC_IS_DCE5(rdev) && !ASIC_IS_DCE8(rdev) && | 1055 | if (ASIC_IS_DCE5(rdev) && |
1056 | (encoder_mode == ATOM_ENCODER_MODE_HDMI) && | 1056 | (encoder_mode == ATOM_ENCODER_MODE_HDMI) && |
1057 | (radeon_crtc->bpc > 8)) | 1057 | (radeon_crtc->bpc > 8)) |
1058 | clock = radeon_crtc->adjusted_clock; | 1058 | clock = radeon_crtc->adjusted_clock; |
@@ -1136,6 +1136,7 @@ static int dce4_crtc_do_set_base(struct drm_crtc *crtc, | |||
1136 | u32 fb_swap = EVERGREEN_GRPH_ENDIAN_SWAP(EVERGREEN_GRPH_ENDIAN_NONE); | 1136 | u32 fb_swap = EVERGREEN_GRPH_ENDIAN_SWAP(EVERGREEN_GRPH_ENDIAN_NONE); |
1137 | u32 tmp, viewport_w, viewport_h; | 1137 | u32 tmp, viewport_w, viewport_h; |
1138 | int r; | 1138 | int r; |
1139 | bool bypass_lut = false; | ||
1139 | 1140 | ||
1140 | /* no fb bound */ | 1141 | /* no fb bound */ |
1141 | if (!atomic && !crtc->primary->fb) { | 1142 | if (!atomic && !crtc->primary->fb) { |
@@ -1174,33 +1175,73 @@ static int dce4_crtc_do_set_base(struct drm_crtc *crtc, | |||
1174 | radeon_bo_get_tiling_flags(rbo, &tiling_flags, NULL); | 1175 | radeon_bo_get_tiling_flags(rbo, &tiling_flags, NULL); |
1175 | radeon_bo_unreserve(rbo); | 1176 | radeon_bo_unreserve(rbo); |
1176 | 1177 | ||
1177 | switch (target_fb->bits_per_pixel) { | 1178 | switch (target_fb->pixel_format) { |
1178 | case 8: | 1179 | case DRM_FORMAT_C8: |
1179 | fb_format = (EVERGREEN_GRPH_DEPTH(EVERGREEN_GRPH_DEPTH_8BPP) | | 1180 | fb_format = (EVERGREEN_GRPH_DEPTH(EVERGREEN_GRPH_DEPTH_8BPP) | |
1180 | EVERGREEN_GRPH_FORMAT(EVERGREEN_GRPH_FORMAT_INDEXED)); | 1181 | EVERGREEN_GRPH_FORMAT(EVERGREEN_GRPH_FORMAT_INDEXED)); |
1181 | break; | 1182 | break; |
1182 | case 15: | 1183 | case DRM_FORMAT_XRGB4444: |
1184 | case DRM_FORMAT_ARGB4444: | ||
1185 | fb_format = (EVERGREEN_GRPH_DEPTH(EVERGREEN_GRPH_DEPTH_16BPP) | | ||
1186 | EVERGREEN_GRPH_FORMAT(EVERGREEN_GRPH_FORMAT_ARGB4444)); | ||
1187 | #ifdef __BIG_ENDIAN | ||
1188 | fb_swap = EVERGREEN_GRPH_ENDIAN_SWAP(EVERGREEN_GRPH_ENDIAN_8IN16); | ||
1189 | #endif | ||
1190 | break; | ||
1191 | case DRM_FORMAT_XRGB1555: | ||
1192 | case DRM_FORMAT_ARGB1555: | ||
1183 | fb_format = (EVERGREEN_GRPH_DEPTH(EVERGREEN_GRPH_DEPTH_16BPP) | | 1193 | fb_format = (EVERGREEN_GRPH_DEPTH(EVERGREEN_GRPH_DEPTH_16BPP) | |
1184 | EVERGREEN_GRPH_FORMAT(EVERGREEN_GRPH_FORMAT_ARGB1555)); | 1194 | EVERGREEN_GRPH_FORMAT(EVERGREEN_GRPH_FORMAT_ARGB1555)); |
1195 | #ifdef __BIG_ENDIAN | ||
1196 | fb_swap = EVERGREEN_GRPH_ENDIAN_SWAP(EVERGREEN_GRPH_ENDIAN_8IN16); | ||
1197 | #endif | ||
1198 | break; | ||
1199 | case DRM_FORMAT_BGRX5551: | ||
1200 | case DRM_FORMAT_BGRA5551: | ||
1201 | fb_format = (EVERGREEN_GRPH_DEPTH(EVERGREEN_GRPH_DEPTH_16BPP) | | ||
1202 | EVERGREEN_GRPH_FORMAT(EVERGREEN_GRPH_FORMAT_BGRA5551)); | ||
1203 | #ifdef __BIG_ENDIAN | ||
1204 | fb_swap = EVERGREEN_GRPH_ENDIAN_SWAP(EVERGREEN_GRPH_ENDIAN_8IN16); | ||
1205 | #endif | ||
1185 | break; | 1206 | break; |
1186 | case 16: | 1207 | case DRM_FORMAT_RGB565: |
1187 | fb_format = (EVERGREEN_GRPH_DEPTH(EVERGREEN_GRPH_DEPTH_16BPP) | | 1208 | fb_format = (EVERGREEN_GRPH_DEPTH(EVERGREEN_GRPH_DEPTH_16BPP) | |
1188 | EVERGREEN_GRPH_FORMAT(EVERGREEN_GRPH_FORMAT_ARGB565)); | 1209 | EVERGREEN_GRPH_FORMAT(EVERGREEN_GRPH_FORMAT_ARGB565)); |
1189 | #ifdef __BIG_ENDIAN | 1210 | #ifdef __BIG_ENDIAN |
1190 | fb_swap = EVERGREEN_GRPH_ENDIAN_SWAP(EVERGREEN_GRPH_ENDIAN_8IN16); | 1211 | fb_swap = EVERGREEN_GRPH_ENDIAN_SWAP(EVERGREEN_GRPH_ENDIAN_8IN16); |
1191 | #endif | 1212 | #endif |
1192 | break; | 1213 | break; |
1193 | case 24: | 1214 | case DRM_FORMAT_XRGB8888: |
1194 | case 32: | 1215 | case DRM_FORMAT_ARGB8888: |
1195 | fb_format = (EVERGREEN_GRPH_DEPTH(EVERGREEN_GRPH_DEPTH_32BPP) | | 1216 | fb_format = (EVERGREEN_GRPH_DEPTH(EVERGREEN_GRPH_DEPTH_32BPP) | |
1196 | EVERGREEN_GRPH_FORMAT(EVERGREEN_GRPH_FORMAT_ARGB8888)); | 1217 | EVERGREEN_GRPH_FORMAT(EVERGREEN_GRPH_FORMAT_ARGB8888)); |
1197 | #ifdef __BIG_ENDIAN | 1218 | #ifdef __BIG_ENDIAN |
1198 | fb_swap = EVERGREEN_GRPH_ENDIAN_SWAP(EVERGREEN_GRPH_ENDIAN_8IN32); | 1219 | fb_swap = EVERGREEN_GRPH_ENDIAN_SWAP(EVERGREEN_GRPH_ENDIAN_8IN32); |
1199 | #endif | 1220 | #endif |
1200 | break; | 1221 | break; |
1222 | case DRM_FORMAT_XRGB2101010: | ||
1223 | case DRM_FORMAT_ARGB2101010: | ||
1224 | fb_format = (EVERGREEN_GRPH_DEPTH(EVERGREEN_GRPH_DEPTH_32BPP) | | ||
1225 | EVERGREEN_GRPH_FORMAT(EVERGREEN_GRPH_FORMAT_ARGB2101010)); | ||
1226 | #ifdef __BIG_ENDIAN | ||
1227 | fb_swap = EVERGREEN_GRPH_ENDIAN_SWAP(EVERGREEN_GRPH_ENDIAN_8IN32); | ||
1228 | #endif | ||
1229 | /* Greater 8 bpc fb needs to bypass hw-lut to retain precision */ | ||
1230 | bypass_lut = true; | ||
1231 | break; | ||
1232 | case DRM_FORMAT_BGRX1010102: | ||
1233 | case DRM_FORMAT_BGRA1010102: | ||
1234 | fb_format = (EVERGREEN_GRPH_DEPTH(EVERGREEN_GRPH_DEPTH_32BPP) | | ||
1235 | EVERGREEN_GRPH_FORMAT(EVERGREEN_GRPH_FORMAT_BGRA1010102)); | ||
1236 | #ifdef __BIG_ENDIAN | ||
1237 | fb_swap = EVERGREEN_GRPH_ENDIAN_SWAP(EVERGREEN_GRPH_ENDIAN_8IN32); | ||
1238 | #endif | ||
1239 | /* Greater 8 bpc fb needs to bypass hw-lut to retain precision */ | ||
1240 | bypass_lut = true; | ||
1241 | break; | ||
1201 | default: | 1242 | default: |
1202 | DRM_ERROR("Unsupported screen depth %d\n", | 1243 | DRM_ERROR("Unsupported screen format %s\n", |
1203 | target_fb->bits_per_pixel); | 1244 | drm_get_format_name(target_fb->pixel_format)); |
1204 | return -EINVAL; | 1245 | return -EINVAL; |
1205 | } | 1246 | } |
1206 | 1247 | ||
@@ -1329,6 +1370,18 @@ static int dce4_crtc_do_set_base(struct drm_crtc *crtc, | |||
1329 | WREG32(EVERGREEN_GRPH_CONTROL + radeon_crtc->crtc_offset, fb_format); | 1370 | WREG32(EVERGREEN_GRPH_CONTROL + radeon_crtc->crtc_offset, fb_format); |
1330 | WREG32(EVERGREEN_GRPH_SWAP_CONTROL + radeon_crtc->crtc_offset, fb_swap); | 1371 | WREG32(EVERGREEN_GRPH_SWAP_CONTROL + radeon_crtc->crtc_offset, fb_swap); |
1331 | 1372 | ||
1373 | /* | ||
1374 | * The LUT only has 256 slots for indexing by a 8 bpc fb. Bypass the LUT | ||
1375 | * for > 8 bpc scanout to avoid truncation of fb indices to 8 msb's, to | ||
1376 | * retain the full precision throughout the pipeline. | ||
1377 | */ | ||
1378 | WREG32_P(EVERGREEN_GRPH_LUT_10BIT_BYPASS_CONTROL + radeon_crtc->crtc_offset, | ||
1379 | (bypass_lut ? EVERGREEN_LUT_10BIT_BYPASS_EN : 0), | ||
1380 | ~EVERGREEN_LUT_10BIT_BYPASS_EN); | ||
1381 | |||
1382 | if (bypass_lut) | ||
1383 | DRM_DEBUG_KMS("Bypassing hardware LUT due to 10 bit fb scanout.\n"); | ||
1384 | |||
1332 | WREG32(EVERGREEN_GRPH_SURFACE_OFFSET_X + radeon_crtc->crtc_offset, 0); | 1385 | WREG32(EVERGREEN_GRPH_SURFACE_OFFSET_X + radeon_crtc->crtc_offset, 0); |
1333 | WREG32(EVERGREEN_GRPH_SURFACE_OFFSET_Y + radeon_crtc->crtc_offset, 0); | 1386 | WREG32(EVERGREEN_GRPH_SURFACE_OFFSET_Y + radeon_crtc->crtc_offset, 0); |
1334 | WREG32(EVERGREEN_GRPH_X_START + radeon_crtc->crtc_offset, 0); | 1387 | WREG32(EVERGREEN_GRPH_X_START + radeon_crtc->crtc_offset, 0); |
@@ -1396,6 +1449,7 @@ static int avivo_crtc_do_set_base(struct drm_crtc *crtc, | |||
1396 | u32 fb_swap = R600_D1GRPH_SWAP_ENDIAN_NONE; | 1449 | u32 fb_swap = R600_D1GRPH_SWAP_ENDIAN_NONE; |
1397 | u32 tmp, viewport_w, viewport_h; | 1450 | u32 tmp, viewport_w, viewport_h; |
1398 | int r; | 1451 | int r; |
1452 | bool bypass_lut = false; | ||
1399 | 1453 | ||
1400 | /* no fb bound */ | 1454 | /* no fb bound */ |
1401 | if (!atomic && !crtc->primary->fb) { | 1455 | if (!atomic && !crtc->primary->fb) { |
@@ -1433,18 +1487,30 @@ static int avivo_crtc_do_set_base(struct drm_crtc *crtc, | |||
1433 | radeon_bo_get_tiling_flags(rbo, &tiling_flags, NULL); | 1487 | radeon_bo_get_tiling_flags(rbo, &tiling_flags, NULL); |
1434 | radeon_bo_unreserve(rbo); | 1488 | radeon_bo_unreserve(rbo); |
1435 | 1489 | ||
1436 | switch (target_fb->bits_per_pixel) { | 1490 | switch (target_fb->pixel_format) { |
1437 | case 8: | 1491 | case DRM_FORMAT_C8: |
1438 | fb_format = | 1492 | fb_format = |
1439 | AVIVO_D1GRPH_CONTROL_DEPTH_8BPP | | 1493 | AVIVO_D1GRPH_CONTROL_DEPTH_8BPP | |
1440 | AVIVO_D1GRPH_CONTROL_8BPP_INDEXED; | 1494 | AVIVO_D1GRPH_CONTROL_8BPP_INDEXED; |
1441 | break; | 1495 | break; |
1442 | case 15: | 1496 | case DRM_FORMAT_XRGB4444: |
1497 | case DRM_FORMAT_ARGB4444: | ||
1498 | fb_format = | ||
1499 | AVIVO_D1GRPH_CONTROL_DEPTH_16BPP | | ||
1500 | AVIVO_D1GRPH_CONTROL_16BPP_ARGB4444; | ||
1501 | #ifdef __BIG_ENDIAN | ||
1502 | fb_swap = R600_D1GRPH_SWAP_ENDIAN_16BIT; | ||
1503 | #endif | ||
1504 | break; | ||
1505 | case DRM_FORMAT_XRGB1555: | ||
1443 | fb_format = | 1506 | fb_format = |
1444 | AVIVO_D1GRPH_CONTROL_DEPTH_16BPP | | 1507 | AVIVO_D1GRPH_CONTROL_DEPTH_16BPP | |
1445 | AVIVO_D1GRPH_CONTROL_16BPP_ARGB1555; | 1508 | AVIVO_D1GRPH_CONTROL_16BPP_ARGB1555; |
1509 | #ifdef __BIG_ENDIAN | ||
1510 | fb_swap = R600_D1GRPH_SWAP_ENDIAN_16BIT; | ||
1511 | #endif | ||
1446 | break; | 1512 | break; |
1447 | case 16: | 1513 | case DRM_FORMAT_RGB565: |
1448 | fb_format = | 1514 | fb_format = |
1449 | AVIVO_D1GRPH_CONTROL_DEPTH_16BPP | | 1515 | AVIVO_D1GRPH_CONTROL_DEPTH_16BPP | |
1450 | AVIVO_D1GRPH_CONTROL_16BPP_RGB565; | 1516 | AVIVO_D1GRPH_CONTROL_16BPP_RGB565; |
@@ -1452,8 +1518,8 @@ static int avivo_crtc_do_set_base(struct drm_crtc *crtc, | |||
1452 | fb_swap = R600_D1GRPH_SWAP_ENDIAN_16BIT; | 1518 | fb_swap = R600_D1GRPH_SWAP_ENDIAN_16BIT; |
1453 | #endif | 1519 | #endif |
1454 | break; | 1520 | break; |
1455 | case 24: | 1521 | case DRM_FORMAT_XRGB8888: |
1456 | case 32: | 1522 | case DRM_FORMAT_ARGB8888: |
1457 | fb_format = | 1523 | fb_format = |
1458 | AVIVO_D1GRPH_CONTROL_DEPTH_32BPP | | 1524 | AVIVO_D1GRPH_CONTROL_DEPTH_32BPP | |
1459 | AVIVO_D1GRPH_CONTROL_32BPP_ARGB8888; | 1525 | AVIVO_D1GRPH_CONTROL_32BPP_ARGB8888; |
@@ -1461,9 +1527,20 @@ static int avivo_crtc_do_set_base(struct drm_crtc *crtc, | |||
1461 | fb_swap = R600_D1GRPH_SWAP_ENDIAN_32BIT; | 1527 | fb_swap = R600_D1GRPH_SWAP_ENDIAN_32BIT; |
1462 | #endif | 1528 | #endif |
1463 | break; | 1529 | break; |
1530 | case DRM_FORMAT_XRGB2101010: | ||
1531 | case DRM_FORMAT_ARGB2101010: | ||
1532 | fb_format = | ||
1533 | AVIVO_D1GRPH_CONTROL_DEPTH_32BPP | | ||
1534 | AVIVO_D1GRPH_CONTROL_32BPP_ARGB2101010; | ||
1535 | #ifdef __BIG_ENDIAN | ||
1536 | fb_swap = R600_D1GRPH_SWAP_ENDIAN_32BIT; | ||
1537 | #endif | ||
1538 | /* Greater 8 bpc fb needs to bypass hw-lut to retain precision */ | ||
1539 | bypass_lut = true; | ||
1540 | break; | ||
1464 | default: | 1541 | default: |
1465 | DRM_ERROR("Unsupported screen depth %d\n", | 1542 | DRM_ERROR("Unsupported screen format %s\n", |
1466 | target_fb->bits_per_pixel); | 1543 | drm_get_format_name(target_fb->pixel_format)); |
1467 | return -EINVAL; | 1544 | return -EINVAL; |
1468 | } | 1545 | } |
1469 | 1546 | ||
@@ -1502,6 +1579,13 @@ static int avivo_crtc_do_set_base(struct drm_crtc *crtc, | |||
1502 | if (rdev->family >= CHIP_R600) | 1579 | if (rdev->family >= CHIP_R600) |
1503 | WREG32(R600_D1GRPH_SWAP_CONTROL + radeon_crtc->crtc_offset, fb_swap); | 1580 | WREG32(R600_D1GRPH_SWAP_CONTROL + radeon_crtc->crtc_offset, fb_swap); |
1504 | 1581 | ||
1582 | /* LUT only has 256 slots for 8 bpc fb. Bypass for > 8 bpc scanout for precision */ | ||
1583 | WREG32_P(AVIVO_D1GRPH_LUT_SEL + radeon_crtc->crtc_offset, | ||
1584 | (bypass_lut ? AVIVO_LUT_10BIT_BYPASS_EN : 0), ~AVIVO_LUT_10BIT_BYPASS_EN); | ||
1585 | |||
1586 | if (bypass_lut) | ||
1587 | DRM_DEBUG_KMS("Bypassing hardware LUT due to 10 bit fb scanout.\n"); | ||
1588 | |||
1505 | WREG32(AVIVO_D1GRPH_SURFACE_OFFSET_X + radeon_crtc->crtc_offset, 0); | 1589 | WREG32(AVIVO_D1GRPH_SURFACE_OFFSET_X + radeon_crtc->crtc_offset, 0); |
1506 | WREG32(AVIVO_D1GRPH_SURFACE_OFFSET_Y + radeon_crtc->crtc_offset, 0); | 1590 | WREG32(AVIVO_D1GRPH_SURFACE_OFFSET_Y + radeon_crtc->crtc_offset, 0); |
1507 | WREG32(AVIVO_D1GRPH_X_START + radeon_crtc->crtc_offset, 0); | 1591 | WREG32(AVIVO_D1GRPH_X_START + radeon_crtc->crtc_offset, 0); |
diff --git a/drivers/gpu/drm/radeon/atombios_dp.c b/drivers/gpu/drm/radeon/atombios_dp.c index c5b1f2da3954..b1e11f8434e2 100644 --- a/drivers/gpu/drm/radeon/atombios_dp.c +++ b/drivers/gpu/drm/radeon/atombios_dp.c | |||
@@ -127,7 +127,7 @@ static int radeon_process_aux_ch(struct radeon_i2c_chan *chan, | |||
127 | /* flags not zero */ | 127 | /* flags not zero */ |
128 | if (args.v1.ucReplyStatus == 2) { | 128 | if (args.v1.ucReplyStatus == 2) { |
129 | DRM_DEBUG_KMS("dp_aux_ch flags not zero\n"); | 129 | DRM_DEBUG_KMS("dp_aux_ch flags not zero\n"); |
130 | r = -EBUSY; | 130 | r = -EIO; |
131 | goto done; | 131 | goto done; |
132 | } | 132 | } |
133 | 133 | ||
@@ -403,16 +403,18 @@ bool radeon_dp_getdpcd(struct radeon_connector *radeon_connector) | |||
403 | { | 403 | { |
404 | struct radeon_connector_atom_dig *dig_connector = radeon_connector->con_priv; | 404 | struct radeon_connector_atom_dig *dig_connector = radeon_connector->con_priv; |
405 | u8 msg[DP_DPCD_SIZE]; | 405 | u8 msg[DP_DPCD_SIZE]; |
406 | int ret, i; | 406 | int ret; |
407 | |||
408 | char dpcd_hex_dump[DP_DPCD_SIZE * 3]; | ||
407 | 409 | ||
408 | ret = drm_dp_dpcd_read(&radeon_connector->ddc_bus->aux, DP_DPCD_REV, msg, | 410 | ret = drm_dp_dpcd_read(&radeon_connector->ddc_bus->aux, DP_DPCD_REV, msg, |
409 | DP_DPCD_SIZE); | 411 | DP_DPCD_SIZE); |
410 | if (ret > 0) { | 412 | if (ret > 0) { |
411 | memcpy(dig_connector->dpcd, msg, DP_DPCD_SIZE); | 413 | memcpy(dig_connector->dpcd, msg, DP_DPCD_SIZE); |
412 | DRM_DEBUG_KMS("DPCD: "); | 414 | |
413 | for (i = 0; i < DP_DPCD_SIZE; i++) | 415 | hex_dump_to_buffer(dig_connector->dpcd, sizeof(dig_connector->dpcd), |
414 | DRM_DEBUG_KMS("%02x ", msg[i]); | 416 | 32, 1, dpcd_hex_dump, sizeof(dpcd_hex_dump), false); |
415 | DRM_DEBUG_KMS("\n"); | 417 | DRM_DEBUG_KMS("DPCD: %s\n", dpcd_hex_dump); |
416 | 418 | ||
417 | radeon_dp_probe_oui(radeon_connector); | 419 | radeon_dp_probe_oui(radeon_connector); |
418 | 420 | ||
diff --git a/drivers/gpu/drm/radeon/ci_dpm.c b/drivers/gpu/drm/radeon/ci_dpm.c index 10dae4106c08..584090ac3eb9 100644 --- a/drivers/gpu/drm/radeon/ci_dpm.c +++ b/drivers/gpu/drm/radeon/ci_dpm.c | |||
@@ -1179,7 +1179,7 @@ static int ci_stop_dpm(struct radeon_device *rdev) | |||
1179 | tmp &= ~GLOBAL_PWRMGT_EN; | 1179 | tmp &= ~GLOBAL_PWRMGT_EN; |
1180 | WREG32_SMC(GENERAL_PWRMGT, tmp); | 1180 | WREG32_SMC(GENERAL_PWRMGT, tmp); |
1181 | 1181 | ||
1182 | tmp = RREG32(SCLK_PWRMGT_CNTL); | 1182 | tmp = RREG32_SMC(SCLK_PWRMGT_CNTL); |
1183 | tmp &= ~DYNAMIC_PM_EN; | 1183 | tmp &= ~DYNAMIC_PM_EN; |
1184 | WREG32_SMC(SCLK_PWRMGT_CNTL, tmp); | 1184 | WREG32_SMC(SCLK_PWRMGT_CNTL, tmp); |
1185 | 1185 | ||
diff --git a/drivers/gpu/drm/radeon/cik.c b/drivers/gpu/drm/radeon/cik.c index dcd4518a9b08..0b2471107137 100644 --- a/drivers/gpu/drm/radeon/cik.c +++ b/drivers/gpu/drm/radeon/cik.c | |||
@@ -7676,14 +7676,16 @@ restart_ih: | |||
7676 | addr = RREG32(VM_CONTEXT1_PROTECTION_FAULT_ADDR); | 7676 | addr = RREG32(VM_CONTEXT1_PROTECTION_FAULT_ADDR); |
7677 | status = RREG32(VM_CONTEXT1_PROTECTION_FAULT_STATUS); | 7677 | status = RREG32(VM_CONTEXT1_PROTECTION_FAULT_STATUS); |
7678 | mc_client = RREG32(VM_CONTEXT1_PROTECTION_FAULT_MCCLIENT); | 7678 | mc_client = RREG32(VM_CONTEXT1_PROTECTION_FAULT_MCCLIENT); |
7679 | /* reset addr and status */ | ||
7680 | WREG32_P(VM_CONTEXT1_CNTL2, 1, ~1); | ||
7681 | if (addr == 0x0 && status == 0x0) | ||
7682 | break; | ||
7679 | dev_err(rdev->dev, "GPU fault detected: %d 0x%08x\n", src_id, src_data); | 7683 | dev_err(rdev->dev, "GPU fault detected: %d 0x%08x\n", src_id, src_data); |
7680 | dev_err(rdev->dev, " VM_CONTEXT1_PROTECTION_FAULT_ADDR 0x%08X\n", | 7684 | dev_err(rdev->dev, " VM_CONTEXT1_PROTECTION_FAULT_ADDR 0x%08X\n", |
7681 | addr); | 7685 | addr); |
7682 | dev_err(rdev->dev, " VM_CONTEXT1_PROTECTION_FAULT_STATUS 0x%08X\n", | 7686 | dev_err(rdev->dev, " VM_CONTEXT1_PROTECTION_FAULT_STATUS 0x%08X\n", |
7683 | status); | 7687 | status); |
7684 | cik_vm_decode_fault(rdev, status, addr, mc_client); | 7688 | cik_vm_decode_fault(rdev, status, addr, mc_client); |
7685 | /* reset addr and status */ | ||
7686 | WREG32_P(VM_CONTEXT1_CNTL2, 1, ~1); | ||
7687 | break; | 7689 | break; |
7688 | case 167: /* VCE */ | 7690 | case 167: /* VCE */ |
7689 | DRM_DEBUG("IH: VCE int: 0x%08x\n", src_data); | 7691 | DRM_DEBUG("IH: VCE int: 0x%08x\n", src_data); |
diff --git a/drivers/gpu/drm/radeon/cikd.h b/drivers/gpu/drm/radeon/cikd.h index ae88660f34ea..0c6e1b55d968 100644 --- a/drivers/gpu/drm/radeon/cikd.h +++ b/drivers/gpu/drm/radeon/cikd.h | |||
@@ -1752,12 +1752,12 @@ | |||
1752 | #define EOP_TC_WB_ACTION_EN (1 << 15) /* L2 */ | 1752 | #define EOP_TC_WB_ACTION_EN (1 << 15) /* L2 */ |
1753 | #define EOP_TCL1_ACTION_EN (1 << 16) | 1753 | #define EOP_TCL1_ACTION_EN (1 << 16) |
1754 | #define EOP_TC_ACTION_EN (1 << 17) /* L2 */ | 1754 | #define EOP_TC_ACTION_EN (1 << 17) /* L2 */ |
1755 | #define EOP_TCL2_VOLATILE (1 << 24) | ||
1755 | #define EOP_CACHE_POLICY(x) ((x) << 25) | 1756 | #define EOP_CACHE_POLICY(x) ((x) << 25) |
1756 | /* 0 - LRU | 1757 | /* 0 - LRU |
1757 | * 1 - Stream | 1758 | * 1 - Stream |
1758 | * 2 - Bypass | 1759 | * 2 - Bypass |
1759 | */ | 1760 | */ |
1760 | #define EOP_TCL2_VOLATILE (1 << 27) | ||
1761 | #define DATA_SEL(x) ((x) << 29) | 1761 | #define DATA_SEL(x) ((x) << 29) |
1762 | /* 0 - discard | 1762 | /* 0 - discard |
1763 | * 1 - send low 32bit data | 1763 | * 1 - send low 32bit data |
diff --git a/drivers/gpu/drm/radeon/cypress_dpm.c b/drivers/gpu/drm/radeon/cypress_dpm.c index 5a9a5f4d7888..47d31e915758 100644 --- a/drivers/gpu/drm/radeon/cypress_dpm.c +++ b/drivers/gpu/drm/radeon/cypress_dpm.c | |||
@@ -1551,7 +1551,7 @@ int cypress_populate_smc_voltage_tables(struct radeon_device *rdev, | |||
1551 | 1551 | ||
1552 | table->voltageMaskTable.highMask[RV770_SMC_VOLTAGEMASK_VDDCI] = 0; | 1552 | table->voltageMaskTable.highMask[RV770_SMC_VOLTAGEMASK_VDDCI] = 0; |
1553 | table->voltageMaskTable.lowMask[RV770_SMC_VOLTAGEMASK_VDDCI] = | 1553 | table->voltageMaskTable.lowMask[RV770_SMC_VOLTAGEMASK_VDDCI] = |
1554 | cpu_to_be32(eg_pi->vddc_voltage_table.mask_low); | 1554 | cpu_to_be32(eg_pi->vddci_voltage_table.mask_low); |
1555 | } | 1555 | } |
1556 | 1556 | ||
1557 | return 0; | 1557 | return 0; |
diff --git a/drivers/gpu/drm/radeon/evergreen.c b/drivers/gpu/drm/radeon/evergreen.c index e2f605224e8c..f7ece0ff431b 100644 --- a/drivers/gpu/drm/radeon/evergreen.c +++ b/drivers/gpu/drm/radeon/evergreen.c | |||
@@ -189,7 +189,7 @@ static const u32 evergreen_golden_registers[] = | |||
189 | 0x8c1c, 0xffffffff, 0x00001010, | 189 | 0x8c1c, 0xffffffff, 0x00001010, |
190 | 0x28350, 0xffffffff, 0x00000000, | 190 | 0x28350, 0xffffffff, 0x00000000, |
191 | 0xa008, 0xffffffff, 0x00010000, | 191 | 0xa008, 0xffffffff, 0x00010000, |
192 | 0x5cc, 0xffffffff, 0x00000001, | 192 | 0x5c4, 0xffffffff, 0x00000001, |
193 | 0x9508, 0xffffffff, 0x00000002, | 193 | 0x9508, 0xffffffff, 0x00000002, |
194 | 0x913c, 0x0000000f, 0x0000000a | 194 | 0x913c, 0x0000000f, 0x0000000a |
195 | }; | 195 | }; |
@@ -476,7 +476,7 @@ static const u32 cedar_golden_registers[] = | |||
476 | 0x8c1c, 0xffffffff, 0x00001010, | 476 | 0x8c1c, 0xffffffff, 0x00001010, |
477 | 0x28350, 0xffffffff, 0x00000000, | 477 | 0x28350, 0xffffffff, 0x00000000, |
478 | 0xa008, 0xffffffff, 0x00010000, | 478 | 0xa008, 0xffffffff, 0x00010000, |
479 | 0x5cc, 0xffffffff, 0x00000001, | 479 | 0x5c4, 0xffffffff, 0x00000001, |
480 | 0x9508, 0xffffffff, 0x00000002 | 480 | 0x9508, 0xffffffff, 0x00000002 |
481 | }; | 481 | }; |
482 | 482 | ||
@@ -635,7 +635,7 @@ static const u32 juniper_mgcg_init[] = | |||
635 | static const u32 supersumo_golden_registers[] = | 635 | static const u32 supersumo_golden_registers[] = |
636 | { | 636 | { |
637 | 0x5eb4, 0xffffffff, 0x00000002, | 637 | 0x5eb4, 0xffffffff, 0x00000002, |
638 | 0x5cc, 0xffffffff, 0x00000001, | 638 | 0x5c4, 0xffffffff, 0x00000001, |
639 | 0x7030, 0xffffffff, 0x00000011, | 639 | 0x7030, 0xffffffff, 0x00000011, |
640 | 0x7c30, 0xffffffff, 0x00000011, | 640 | 0x7c30, 0xffffffff, 0x00000011, |
641 | 0x6104, 0x01000300, 0x00000000, | 641 | 0x6104, 0x01000300, 0x00000000, |
@@ -719,7 +719,7 @@ static const u32 sumo_golden_registers[] = | |||
719 | static const u32 wrestler_golden_registers[] = | 719 | static const u32 wrestler_golden_registers[] = |
720 | { | 720 | { |
721 | 0x5eb4, 0xffffffff, 0x00000002, | 721 | 0x5eb4, 0xffffffff, 0x00000002, |
722 | 0x5cc, 0xffffffff, 0x00000001, | 722 | 0x5c4, 0xffffffff, 0x00000001, |
723 | 0x7030, 0xffffffff, 0x00000011, | 723 | 0x7030, 0xffffffff, 0x00000011, |
724 | 0x7c30, 0xffffffff, 0x00000011, | 724 | 0x7c30, 0xffffffff, 0x00000011, |
725 | 0x6104, 0x01000300, 0x00000000, | 725 | 0x6104, 0x01000300, 0x00000000, |
@@ -5066,14 +5066,16 @@ restart_ih: | |||
5066 | case 147: | 5066 | case 147: |
5067 | addr = RREG32(VM_CONTEXT1_PROTECTION_FAULT_ADDR); | 5067 | addr = RREG32(VM_CONTEXT1_PROTECTION_FAULT_ADDR); |
5068 | status = RREG32(VM_CONTEXT1_PROTECTION_FAULT_STATUS); | 5068 | status = RREG32(VM_CONTEXT1_PROTECTION_FAULT_STATUS); |
5069 | /* reset addr and status */ | ||
5070 | WREG32_P(VM_CONTEXT1_CNTL2, 1, ~1); | ||
5071 | if (addr == 0x0 && status == 0x0) | ||
5072 | break; | ||
5069 | dev_err(rdev->dev, "GPU fault detected: %d 0x%08x\n", src_id, src_data); | 5073 | dev_err(rdev->dev, "GPU fault detected: %d 0x%08x\n", src_id, src_data); |
5070 | dev_err(rdev->dev, " VM_CONTEXT1_PROTECTION_FAULT_ADDR 0x%08X\n", | 5074 | dev_err(rdev->dev, " VM_CONTEXT1_PROTECTION_FAULT_ADDR 0x%08X\n", |
5071 | addr); | 5075 | addr); |
5072 | dev_err(rdev->dev, " VM_CONTEXT1_PROTECTION_FAULT_STATUS 0x%08X\n", | 5076 | dev_err(rdev->dev, " VM_CONTEXT1_PROTECTION_FAULT_STATUS 0x%08X\n", |
5073 | status); | 5077 | status); |
5074 | cayman_vm_decode_fault(rdev, status, addr); | 5078 | cayman_vm_decode_fault(rdev, status, addr); |
5075 | /* reset addr and status */ | ||
5076 | WREG32_P(VM_CONTEXT1_CNTL2, 1, ~1); | ||
5077 | break; | 5079 | break; |
5078 | case 176: /* CP_INT in ring buffer */ | 5080 | case 176: /* CP_INT in ring buffer */ |
5079 | case 177: /* CP_INT in IB1 */ | 5081 | case 177: /* CP_INT in IB1 */ |
diff --git a/drivers/gpu/drm/radeon/evergreen_reg.h b/drivers/gpu/drm/radeon/evergreen_reg.h index a0f63ff5a5e9..333d143fca2c 100644 --- a/drivers/gpu/drm/radeon/evergreen_reg.h +++ b/drivers/gpu/drm/radeon/evergreen_reg.h | |||
@@ -116,6 +116,8 @@ | |||
116 | # define EVERGREEN_GRPH_ARRAY_LINEAR_ALIGNED 1 | 116 | # define EVERGREEN_GRPH_ARRAY_LINEAR_ALIGNED 1 |
117 | # define EVERGREEN_GRPH_ARRAY_1D_TILED_THIN1 2 | 117 | # define EVERGREEN_GRPH_ARRAY_1D_TILED_THIN1 2 |
118 | # define EVERGREEN_GRPH_ARRAY_2D_TILED_THIN1 4 | 118 | # define EVERGREEN_GRPH_ARRAY_2D_TILED_THIN1 4 |
119 | #define EVERGREEN_GRPH_LUT_10BIT_BYPASS_CONTROL 0x6808 | ||
120 | # define EVERGREEN_LUT_10BIT_BYPASS_EN (1 << 8) | ||
119 | #define EVERGREEN_GRPH_SWAP_CONTROL 0x680c | 121 | #define EVERGREEN_GRPH_SWAP_CONTROL 0x680c |
120 | # define EVERGREEN_GRPH_ENDIAN_SWAP(x) (((x) & 0x3) << 0) | 122 | # define EVERGREEN_GRPH_ENDIAN_SWAP(x) (((x) & 0x3) << 0) |
121 | # define EVERGREEN_GRPH_ENDIAN_NONE 0 | 123 | # define EVERGREEN_GRPH_ENDIAN_NONE 0 |
diff --git a/drivers/gpu/drm/radeon/kv_dpm.c b/drivers/gpu/drm/radeon/kv_dpm.c index 3f6e817d97ee..9ef8c38f2d66 100644 --- a/drivers/gpu/drm/radeon/kv_dpm.c +++ b/drivers/gpu/drm/radeon/kv_dpm.c | |||
@@ -2726,7 +2726,7 @@ int kv_dpm_init(struct radeon_device *rdev) | |||
2726 | pi->caps_sclk_ds = true; | 2726 | pi->caps_sclk_ds = true; |
2727 | pi->enable_auto_thermal_throttling = true; | 2727 | pi->enable_auto_thermal_throttling = true; |
2728 | pi->disable_nb_ps3_in_battery = false; | 2728 | pi->disable_nb_ps3_in_battery = false; |
2729 | pi->bapm_enable = false; | 2729 | pi->bapm_enable = true; |
2730 | pi->voltage_drop_t = 0; | 2730 | pi->voltage_drop_t = 0; |
2731 | pi->caps_sclk_throttle_low_notification = false; | 2731 | pi->caps_sclk_throttle_low_notification = false; |
2732 | pi->caps_fps = false; /* true? */ | 2732 | pi->caps_fps = false; /* true? */ |
diff --git a/drivers/gpu/drm/radeon/ni_dpm.c b/drivers/gpu/drm/radeon/ni_dpm.c index 004c931606c4..01fc4888e6fe 100644 --- a/drivers/gpu/drm/radeon/ni_dpm.c +++ b/drivers/gpu/drm/radeon/ni_dpm.c | |||
@@ -1315,7 +1315,7 @@ static void ni_populate_smc_voltage_tables(struct radeon_device *rdev, | |||
1315 | 1315 | ||
1316 | table->voltageMaskTable.highMask[NISLANDS_SMC_VOLTAGEMASK_VDDCI] = 0; | 1316 | table->voltageMaskTable.highMask[NISLANDS_SMC_VOLTAGEMASK_VDDCI] = 0; |
1317 | table->voltageMaskTable.lowMask[NISLANDS_SMC_VOLTAGEMASK_VDDCI] = | 1317 | table->voltageMaskTable.lowMask[NISLANDS_SMC_VOLTAGEMASK_VDDCI] = |
1318 | cpu_to_be32(eg_pi->vddc_voltage_table.mask_low); | 1318 | cpu_to_be32(eg_pi->vddci_voltage_table.mask_low); |
1319 | } | 1319 | } |
1320 | } | 1320 | } |
1321 | 1321 | ||
diff --git a/drivers/gpu/drm/radeon/r500_reg.h b/drivers/gpu/drm/radeon/r500_reg.h index 1dd0d32993d5..136b7bc7cd20 100644 --- a/drivers/gpu/drm/radeon/r500_reg.h +++ b/drivers/gpu/drm/radeon/r500_reg.h | |||
@@ -402,6 +402,7 @@ | |||
402 | * block and vice versa. This applies to GRPH, CUR, etc. | 402 | * block and vice versa. This applies to GRPH, CUR, etc. |
403 | */ | 403 | */ |
404 | #define AVIVO_D1GRPH_LUT_SEL 0x6108 | 404 | #define AVIVO_D1GRPH_LUT_SEL 0x6108 |
405 | # define AVIVO_LUT_10BIT_BYPASS_EN (1 << 8) | ||
405 | #define AVIVO_D1GRPH_PRIMARY_SURFACE_ADDRESS 0x6110 | 406 | #define AVIVO_D1GRPH_PRIMARY_SURFACE_ADDRESS 0x6110 |
406 | #define R700_D1GRPH_PRIMARY_SURFACE_ADDRESS_HIGH 0x6914 | 407 | #define R700_D1GRPH_PRIMARY_SURFACE_ADDRESS_HIGH 0x6914 |
407 | #define R700_D2GRPH_PRIMARY_SURFACE_ADDRESS_HIGH 0x6114 | 408 | #define R700_D2GRPH_PRIMARY_SURFACE_ADDRESS_HIGH 0x6114 |
diff --git a/drivers/gpu/drm/radeon/radeon.h b/drivers/gpu/drm/radeon/radeon.h index 4b0bbf88d5c0..29d9cc04c04e 100644 --- a/drivers/gpu/drm/radeon/radeon.h +++ b/drivers/gpu/drm/radeon/radeon.h | |||
@@ -102,6 +102,7 @@ extern int radeon_runtime_pm; | |||
102 | extern int radeon_hard_reset; | 102 | extern int radeon_hard_reset; |
103 | extern int radeon_vm_size; | 103 | extern int radeon_vm_size; |
104 | extern int radeon_vm_block_size; | 104 | extern int radeon_vm_block_size; |
105 | extern int radeon_deep_color; | ||
105 | 106 | ||
106 | /* | 107 | /* |
107 | * Copy from radeon_drv.h so we don't have to include both and have conflicting | 108 | * Copy from radeon_drv.h so we don't have to include both and have conflicting |
@@ -749,10 +750,6 @@ union radeon_irq_stat_regs { | |||
749 | struct cik_irq_stat_regs cik; | 750 | struct cik_irq_stat_regs cik; |
750 | }; | 751 | }; |
751 | 752 | ||
752 | #define RADEON_MAX_HPD_PINS 7 | ||
753 | #define RADEON_MAX_CRTCS 6 | ||
754 | #define RADEON_MAX_AFMT_BLOCKS 7 | ||
755 | |||
756 | struct radeon_irq { | 753 | struct radeon_irq { |
757 | bool installed; | 754 | bool installed; |
758 | spinlock_t lock; | 755 | spinlock_t lock; |
diff --git a/drivers/gpu/drm/radeon/radeon_atombios.c b/drivers/gpu/drm/radeon/radeon_atombios.c index 30844814c25a..173f378428a9 100644 --- a/drivers/gpu/drm/radeon/radeon_atombios.c +++ b/drivers/gpu/drm/radeon/radeon_atombios.c | |||
@@ -1227,11 +1227,19 @@ bool radeon_atom_get_clock_info(struct drm_device *dev) | |||
1227 | rdev->clock.default_dispclk = | 1227 | rdev->clock.default_dispclk = |
1228 | le32_to_cpu(firmware_info->info_21.ulDefaultDispEngineClkFreq); | 1228 | le32_to_cpu(firmware_info->info_21.ulDefaultDispEngineClkFreq); |
1229 | if (rdev->clock.default_dispclk == 0) { | 1229 | if (rdev->clock.default_dispclk == 0) { |
1230 | if (ASIC_IS_DCE5(rdev)) | 1230 | if (ASIC_IS_DCE6(rdev)) |
1231 | rdev->clock.default_dispclk = 60000; /* 600 Mhz */ | ||
1232 | else if (ASIC_IS_DCE5(rdev)) | ||
1231 | rdev->clock.default_dispclk = 54000; /* 540 Mhz */ | 1233 | rdev->clock.default_dispclk = 54000; /* 540 Mhz */ |
1232 | else | 1234 | else |
1233 | rdev->clock.default_dispclk = 60000; /* 600 Mhz */ | 1235 | rdev->clock.default_dispclk = 60000; /* 600 Mhz */ |
1234 | } | 1236 | } |
1237 | /* set a reasonable default for DP */ | ||
1238 | if (ASIC_IS_DCE6(rdev) && (rdev->clock.default_dispclk < 53900)) { | ||
1239 | DRM_INFO("Changing default dispclk from %dMhz to 600Mhz\n", | ||
1240 | rdev->clock.default_dispclk / 100); | ||
1241 | rdev->clock.default_dispclk = 60000; | ||
1242 | } | ||
1235 | rdev->clock.dp_extclk = | 1243 | rdev->clock.dp_extclk = |
1236 | le16_to_cpu(firmware_info->info_21.usUniphyDPModeExtClkFreq); | 1244 | le16_to_cpu(firmware_info->info_21.usUniphyDPModeExtClkFreq); |
1237 | rdev->clock.current_dispclk = rdev->clock.default_dispclk; | 1245 | rdev->clock.current_dispclk = rdev->clock.default_dispclk; |
diff --git a/drivers/gpu/drm/radeon/radeon_connectors.c b/drivers/gpu/drm/radeon/radeon_connectors.c index 933c5c39654d..44831197e82e 100644 --- a/drivers/gpu/drm/radeon/radeon_connectors.c +++ b/drivers/gpu/drm/radeon/radeon_connectors.c | |||
@@ -199,6 +199,9 @@ int radeon_get_monitor_bpc(struct drm_connector *connector) | |||
199 | } | 199 | } |
200 | } | 200 | } |
201 | 201 | ||
202 | if ((radeon_deep_color == 0) && (bpc > 8)) | ||
203 | bpc = 8; | ||
204 | |||
202 | DRM_DEBUG("%s: Display bpc=%d, returned bpc=%d\n", | 205 | DRM_DEBUG("%s: Display bpc=%d, returned bpc=%d\n", |
203 | connector->name, connector->display_info.bpc, bpc); | 206 | connector->name, connector->display_info.bpc, bpc); |
204 | 207 | ||
@@ -1288,17 +1291,15 @@ static int radeon_dvi_mode_valid(struct drm_connector *connector, | |||
1288 | (radeon_connector->connector_object_id == CONNECTOR_OBJECT_ID_DUAL_LINK_DVI_D) || | 1291 | (radeon_connector->connector_object_id == CONNECTOR_OBJECT_ID_DUAL_LINK_DVI_D) || |
1289 | (radeon_connector->connector_object_id == CONNECTOR_OBJECT_ID_HDMI_TYPE_B)) | 1292 | (radeon_connector->connector_object_id == CONNECTOR_OBJECT_ID_HDMI_TYPE_B)) |
1290 | return MODE_OK; | 1293 | return MODE_OK; |
1291 | else if (radeon_connector->connector_object_id == CONNECTOR_OBJECT_ID_HDMI_TYPE_A) { | 1294 | else if (ASIC_IS_DCE6(rdev) && drm_detect_hdmi_monitor(radeon_connector->edid)) { |
1292 | if (ASIC_IS_DCE6(rdev)) { | 1295 | /* HDMI 1.3+ supports max clock of 340 Mhz */ |
1293 | /* HDMI 1.3+ supports max clock of 340 Mhz */ | 1296 | if (mode->clock > 340000) |
1294 | if (mode->clock > 340000) | ||
1295 | return MODE_CLOCK_HIGH; | ||
1296 | else | ||
1297 | return MODE_OK; | ||
1298 | } else | ||
1299 | return MODE_CLOCK_HIGH; | 1297 | return MODE_CLOCK_HIGH; |
1300 | } else | 1298 | else |
1299 | return MODE_OK; | ||
1300 | } else { | ||
1301 | return MODE_CLOCK_HIGH; | 1301 | return MODE_CLOCK_HIGH; |
1302 | } | ||
1302 | } | 1303 | } |
1303 | 1304 | ||
1304 | /* check against the max pixel clock */ | 1305 | /* check against the max pixel clock */ |
@@ -1549,6 +1550,8 @@ out: | |||
1549 | static int radeon_dp_mode_valid(struct drm_connector *connector, | 1550 | static int radeon_dp_mode_valid(struct drm_connector *connector, |
1550 | struct drm_display_mode *mode) | 1551 | struct drm_display_mode *mode) |
1551 | { | 1552 | { |
1553 | struct drm_device *dev = connector->dev; | ||
1554 | struct radeon_device *rdev = dev->dev_private; | ||
1552 | struct radeon_connector *radeon_connector = to_radeon_connector(connector); | 1555 | struct radeon_connector *radeon_connector = to_radeon_connector(connector); |
1553 | struct radeon_connector_atom_dig *radeon_dig_connector = radeon_connector->con_priv; | 1556 | struct radeon_connector_atom_dig *radeon_dig_connector = radeon_connector->con_priv; |
1554 | 1557 | ||
@@ -1579,14 +1582,23 @@ static int radeon_dp_mode_valid(struct drm_connector *connector, | |||
1579 | return MODE_PANEL; | 1582 | return MODE_PANEL; |
1580 | } | 1583 | } |
1581 | } | 1584 | } |
1582 | return MODE_OK; | ||
1583 | } else { | 1585 | } else { |
1584 | if ((radeon_dig_connector->dp_sink_type == CONNECTOR_OBJECT_ID_DISPLAYPORT) || | 1586 | if ((radeon_dig_connector->dp_sink_type == CONNECTOR_OBJECT_ID_DISPLAYPORT) || |
1585 | (radeon_dig_connector->dp_sink_type == CONNECTOR_OBJECT_ID_eDP)) | 1587 | (radeon_dig_connector->dp_sink_type == CONNECTOR_OBJECT_ID_eDP)) { |
1586 | return radeon_dp_mode_valid_helper(connector, mode); | 1588 | return radeon_dp_mode_valid_helper(connector, mode); |
1587 | else | 1589 | } else { |
1588 | return MODE_OK; | 1590 | if (ASIC_IS_DCE6(rdev) && drm_detect_hdmi_monitor(radeon_connector->edid)) { |
1591 | /* HDMI 1.3+ supports max clock of 340 Mhz */ | ||
1592 | if (mode->clock > 340000) | ||
1593 | return MODE_CLOCK_HIGH; | ||
1594 | } else { | ||
1595 | if (mode->clock > 165000) | ||
1596 | return MODE_CLOCK_HIGH; | ||
1597 | } | ||
1598 | } | ||
1589 | } | 1599 | } |
1600 | |||
1601 | return MODE_OK; | ||
1590 | } | 1602 | } |
1591 | 1603 | ||
1592 | static const struct drm_connector_helper_funcs radeon_dp_connector_helper_funcs = { | 1604 | static const struct drm_connector_helper_funcs radeon_dp_connector_helper_funcs = { |
diff --git a/drivers/gpu/drm/radeon/radeon_display.c b/drivers/gpu/drm/radeon/radeon_display.c index 5ed617056b9c..13896edcf0b6 100644 --- a/drivers/gpu/drm/radeon/radeon_display.c +++ b/drivers/gpu/drm/radeon/radeon_display.c | |||
@@ -66,7 +66,8 @@ static void avivo_crtc_load_lut(struct drm_crtc *crtc) | |||
66 | (radeon_crtc->lut_b[i] << 0)); | 66 | (radeon_crtc->lut_b[i] << 0)); |
67 | } | 67 | } |
68 | 68 | ||
69 | WREG32(AVIVO_D1GRPH_LUT_SEL + radeon_crtc->crtc_offset, radeon_crtc->crtc_id); | 69 | /* Only change bit 0 of LUT_SEL, other bits are set elsewhere */ |
70 | WREG32_P(AVIVO_D1GRPH_LUT_SEL + radeon_crtc->crtc_offset, radeon_crtc->crtc_id, ~1); | ||
70 | } | 71 | } |
71 | 72 | ||
72 | static void dce4_crtc_load_lut(struct drm_crtc *crtc) | 73 | static void dce4_crtc_load_lut(struct drm_crtc *crtc) |
@@ -284,7 +285,6 @@ static void radeon_unpin_work_func(struct work_struct *__work) | |||
284 | void radeon_crtc_handle_vblank(struct radeon_device *rdev, int crtc_id) | 285 | void radeon_crtc_handle_vblank(struct radeon_device *rdev, int crtc_id) |
285 | { | 286 | { |
286 | struct radeon_crtc *radeon_crtc = rdev->mode_info.crtcs[crtc_id]; | 287 | struct radeon_crtc *radeon_crtc = rdev->mode_info.crtcs[crtc_id]; |
287 | struct radeon_flip_work *work; | ||
288 | unsigned long flags; | 288 | unsigned long flags; |
289 | u32 update_pending; | 289 | u32 update_pending; |
290 | int vpos, hpos; | 290 | int vpos, hpos; |
@@ -294,8 +294,11 @@ void radeon_crtc_handle_vblank(struct radeon_device *rdev, int crtc_id) | |||
294 | return; | 294 | return; |
295 | 295 | ||
296 | spin_lock_irqsave(&rdev->ddev->event_lock, flags); | 296 | spin_lock_irqsave(&rdev->ddev->event_lock, flags); |
297 | work = radeon_crtc->flip_work; | 297 | if (radeon_crtc->flip_status != RADEON_FLIP_SUBMITTED) { |
298 | if (work == NULL) { | 298 | DRM_DEBUG_DRIVER("radeon_crtc->flip_status = %d != " |
299 | "RADEON_FLIP_SUBMITTED(%d)\n", | ||
300 | radeon_crtc->flip_status, | ||
301 | RADEON_FLIP_SUBMITTED); | ||
299 | spin_unlock_irqrestore(&rdev->ddev->event_lock, flags); | 302 | spin_unlock_irqrestore(&rdev->ddev->event_lock, flags); |
300 | return; | 303 | return; |
301 | } | 304 | } |
@@ -343,12 +346,17 @@ void radeon_crtc_handle_flip(struct radeon_device *rdev, int crtc_id) | |||
343 | 346 | ||
344 | spin_lock_irqsave(&rdev->ddev->event_lock, flags); | 347 | spin_lock_irqsave(&rdev->ddev->event_lock, flags); |
345 | work = radeon_crtc->flip_work; | 348 | work = radeon_crtc->flip_work; |
346 | if (work == NULL) { | 349 | if (radeon_crtc->flip_status != RADEON_FLIP_SUBMITTED) { |
350 | DRM_DEBUG_DRIVER("radeon_crtc->flip_status = %d != " | ||
351 | "RADEON_FLIP_SUBMITTED(%d)\n", | ||
352 | radeon_crtc->flip_status, | ||
353 | RADEON_FLIP_SUBMITTED); | ||
347 | spin_unlock_irqrestore(&rdev->ddev->event_lock, flags); | 354 | spin_unlock_irqrestore(&rdev->ddev->event_lock, flags); |
348 | return; | 355 | return; |
349 | } | 356 | } |
350 | 357 | ||
351 | /* Pageflip completed. Clean up. */ | 358 | /* Pageflip completed. Clean up. */ |
359 | radeon_crtc->flip_status = RADEON_FLIP_NONE; | ||
352 | radeon_crtc->flip_work = NULL; | 360 | radeon_crtc->flip_work = NULL; |
353 | 361 | ||
354 | /* wakeup userspace */ | 362 | /* wakeup userspace */ |
@@ -357,8 +365,9 @@ void radeon_crtc_handle_flip(struct radeon_device *rdev, int crtc_id) | |||
357 | 365 | ||
358 | spin_unlock_irqrestore(&rdev->ddev->event_lock, flags); | 366 | spin_unlock_irqrestore(&rdev->ddev->event_lock, flags); |
359 | 367 | ||
368 | drm_vblank_put(rdev->ddev, radeon_crtc->crtc_id); | ||
360 | radeon_fence_unref(&work->fence); | 369 | radeon_fence_unref(&work->fence); |
361 | radeon_irq_kms_pflip_irq_get(rdev, work->crtc_id); | 370 | radeon_irq_kms_pflip_irq_put(rdev, work->crtc_id); |
362 | queue_work(radeon_crtc->flip_queue, &work->unpin_work); | 371 | queue_work(radeon_crtc->flip_queue, &work->unpin_work); |
363 | } | 372 | } |
364 | 373 | ||
@@ -459,6 +468,12 @@ static void radeon_flip_work_func(struct work_struct *__work) | |||
459 | base &= ~7; | 468 | base &= ~7; |
460 | } | 469 | } |
461 | 470 | ||
471 | r = drm_vblank_get(crtc->dev, radeon_crtc->crtc_id); | ||
472 | if (r) { | ||
473 | DRM_ERROR("failed to get vblank before flip\n"); | ||
474 | goto pflip_cleanup; | ||
475 | } | ||
476 | |||
462 | /* We borrow the event spin lock for protecting flip_work */ | 477 | /* We borrow the event spin lock for protecting flip_work */ |
463 | spin_lock_irqsave(&crtc->dev->event_lock, flags); | 478 | spin_lock_irqsave(&crtc->dev->event_lock, flags); |
464 | 479 | ||
@@ -468,11 +483,22 @@ static void radeon_flip_work_func(struct work_struct *__work) | |||
468 | /* do the flip (mmio) */ | 483 | /* do the flip (mmio) */ |
469 | radeon_page_flip(rdev, radeon_crtc->crtc_id, base); | 484 | radeon_page_flip(rdev, radeon_crtc->crtc_id, base); |
470 | 485 | ||
486 | radeon_crtc->flip_status = RADEON_FLIP_SUBMITTED; | ||
471 | spin_unlock_irqrestore(&crtc->dev->event_lock, flags); | 487 | spin_unlock_irqrestore(&crtc->dev->event_lock, flags); |
472 | up_read(&rdev->exclusive_lock); | 488 | up_read(&rdev->exclusive_lock); |
473 | 489 | ||
474 | return; | 490 | return; |
475 | 491 | ||
492 | pflip_cleanup: | ||
493 | if (unlikely(radeon_bo_reserve(work->new_rbo, false) != 0)) { | ||
494 | DRM_ERROR("failed to reserve new rbo in error path\n"); | ||
495 | goto cleanup; | ||
496 | } | ||
497 | if (unlikely(radeon_bo_unpin(work->new_rbo) != 0)) { | ||
498 | DRM_ERROR("failed to unpin new rbo in error path\n"); | ||
499 | } | ||
500 | radeon_bo_unreserve(work->new_rbo); | ||
501 | |||
476 | cleanup: | 502 | cleanup: |
477 | drm_gem_object_unreference_unlocked(&work->old_rbo->gem_base); | 503 | drm_gem_object_unreference_unlocked(&work->old_rbo->gem_base); |
478 | radeon_fence_unref(&work->fence); | 504 | radeon_fence_unref(&work->fence); |
@@ -526,7 +552,7 @@ static int radeon_crtc_page_flip(struct drm_crtc *crtc, | |||
526 | /* We borrow the event spin lock for protecting flip_work */ | 552 | /* We borrow the event spin lock for protecting flip_work */ |
527 | spin_lock_irqsave(&crtc->dev->event_lock, flags); | 553 | spin_lock_irqsave(&crtc->dev->event_lock, flags); |
528 | 554 | ||
529 | if (radeon_crtc->flip_work) { | 555 | if (radeon_crtc->flip_status != RADEON_FLIP_NONE) { |
530 | DRM_DEBUG_DRIVER("flip queue: crtc already busy\n"); | 556 | DRM_DEBUG_DRIVER("flip queue: crtc already busy\n"); |
531 | spin_unlock_irqrestore(&crtc->dev->event_lock, flags); | 557 | spin_unlock_irqrestore(&crtc->dev->event_lock, flags); |
532 | drm_gem_object_unreference_unlocked(&work->old_rbo->gem_base); | 558 | drm_gem_object_unreference_unlocked(&work->old_rbo->gem_base); |
@@ -534,6 +560,7 @@ static int radeon_crtc_page_flip(struct drm_crtc *crtc, | |||
534 | kfree(work); | 560 | kfree(work); |
535 | return -EBUSY; | 561 | return -EBUSY; |
536 | } | 562 | } |
563 | radeon_crtc->flip_status = RADEON_FLIP_PENDING; | ||
537 | radeon_crtc->flip_work = work; | 564 | radeon_crtc->flip_work = work; |
538 | 565 | ||
539 | /* update crtc fb */ | 566 | /* update crtc fb */ |
diff --git a/drivers/gpu/drm/radeon/radeon_drv.c b/drivers/gpu/drm/radeon/radeon_drv.c index 6e3017413386..cb1421369e3a 100644 --- a/drivers/gpu/drm/radeon/radeon_drv.c +++ b/drivers/gpu/drm/radeon/radeon_drv.c | |||
@@ -175,6 +175,7 @@ int radeon_runtime_pm = -1; | |||
175 | int radeon_hard_reset = 0; | 175 | int radeon_hard_reset = 0; |
176 | int radeon_vm_size = 4096; | 176 | int radeon_vm_size = 4096; |
177 | int radeon_vm_block_size = 9; | 177 | int radeon_vm_block_size = 9; |
178 | int radeon_deep_color = 0; | ||
178 | 179 | ||
179 | MODULE_PARM_DESC(no_wb, "Disable AGP writeback for scratch registers"); | 180 | MODULE_PARM_DESC(no_wb, "Disable AGP writeback for scratch registers"); |
180 | module_param_named(no_wb, radeon_no_wb, int, 0444); | 181 | module_param_named(no_wb, radeon_no_wb, int, 0444); |
@@ -248,6 +249,9 @@ module_param_named(vm_size, radeon_vm_size, int, 0444); | |||
248 | MODULE_PARM_DESC(vm_block_size, "VM page table size in bits (default 9)"); | 249 | MODULE_PARM_DESC(vm_block_size, "VM page table size in bits (default 9)"); |
249 | module_param_named(vm_block_size, radeon_vm_block_size, int, 0444); | 250 | module_param_named(vm_block_size, radeon_vm_block_size, int, 0444); |
250 | 251 | ||
252 | MODULE_PARM_DESC(deep_color, "Deep Color support (1 = enable, 0 = disable (default))"); | ||
253 | module_param_named(deep_color, radeon_deep_color, int, 0444); | ||
254 | |||
251 | static struct pci_device_id pciidlist[] = { | 255 | static struct pci_device_id pciidlist[] = { |
252 | radeon_PCI_IDS | 256 | radeon_PCI_IDS |
253 | }; | 257 | }; |
diff --git a/drivers/gpu/drm/radeon/radeon_mode.h b/drivers/gpu/drm/radeon/radeon_mode.h index ad0e4b8cc7e3..0592ddb0904b 100644 --- a/drivers/gpu/drm/radeon/radeon_mode.h +++ b/drivers/gpu/drm/radeon/radeon_mode.h | |||
@@ -46,6 +46,10 @@ struct radeon_device; | |||
46 | #define to_radeon_encoder(x) container_of(x, struct radeon_encoder, base) | 46 | #define to_radeon_encoder(x) container_of(x, struct radeon_encoder, base) |
47 | #define to_radeon_framebuffer(x) container_of(x, struct radeon_framebuffer, base) | 47 | #define to_radeon_framebuffer(x) container_of(x, struct radeon_framebuffer, base) |
48 | 48 | ||
49 | #define RADEON_MAX_HPD_PINS 7 | ||
50 | #define RADEON_MAX_CRTCS 6 | ||
51 | #define RADEON_MAX_AFMT_BLOCKS 7 | ||
52 | |||
49 | enum radeon_rmx_type { | 53 | enum radeon_rmx_type { |
50 | RMX_OFF, | 54 | RMX_OFF, |
51 | RMX_FULL, | 55 | RMX_FULL, |
@@ -233,8 +237,8 @@ struct radeon_mode_info { | |||
233 | struct card_info *atom_card_info; | 237 | struct card_info *atom_card_info; |
234 | enum radeon_connector_table connector_table; | 238 | enum radeon_connector_table connector_table; |
235 | bool mode_config_initialized; | 239 | bool mode_config_initialized; |
236 | struct radeon_crtc *crtcs[6]; | 240 | struct radeon_crtc *crtcs[RADEON_MAX_CRTCS]; |
237 | struct radeon_afmt *afmt[7]; | 241 | struct radeon_afmt *afmt[RADEON_MAX_AFMT_BLOCKS]; |
238 | /* DVI-I properties */ | 242 | /* DVI-I properties */ |
239 | struct drm_property *coherent_mode_property; | 243 | struct drm_property *coherent_mode_property; |
240 | /* DAC enable load detect */ | 244 | /* DAC enable load detect */ |
@@ -302,6 +306,12 @@ struct radeon_atom_ss { | |||
302 | uint16_t amount; | 306 | uint16_t amount; |
303 | }; | 307 | }; |
304 | 308 | ||
309 | enum radeon_flip_status { | ||
310 | RADEON_FLIP_NONE, | ||
311 | RADEON_FLIP_PENDING, | ||
312 | RADEON_FLIP_SUBMITTED | ||
313 | }; | ||
314 | |||
305 | struct radeon_crtc { | 315 | struct radeon_crtc { |
306 | struct drm_crtc base; | 316 | struct drm_crtc base; |
307 | int crtc_id; | 317 | int crtc_id; |
@@ -327,6 +337,7 @@ struct radeon_crtc { | |||
327 | /* page flipping */ | 337 | /* page flipping */ |
328 | struct workqueue_struct *flip_queue; | 338 | struct workqueue_struct *flip_queue; |
329 | struct radeon_flip_work *flip_work; | 339 | struct radeon_flip_work *flip_work; |
340 | enum radeon_flip_status flip_status; | ||
330 | /* pll sharing */ | 341 | /* pll sharing */ |
331 | struct radeon_atom_ss ss; | 342 | struct radeon_atom_ss ss; |
332 | bool ss_enabled; | 343 | bool ss_enabled; |
diff --git a/drivers/gpu/drm/radeon/radeon_pm.c b/drivers/gpu/drm/radeon/radeon_pm.c index 12c663e86ca1..e447e390d09a 100644 --- a/drivers/gpu/drm/radeon/radeon_pm.c +++ b/drivers/gpu/drm/radeon/radeon_pm.c | |||
@@ -73,8 +73,10 @@ void radeon_pm_acpi_event_handler(struct radeon_device *rdev) | |||
73 | rdev->pm.dpm.ac_power = true; | 73 | rdev->pm.dpm.ac_power = true; |
74 | else | 74 | else |
75 | rdev->pm.dpm.ac_power = false; | 75 | rdev->pm.dpm.ac_power = false; |
76 | if (rdev->asic->dpm.enable_bapm) | 76 | if (rdev->family == CHIP_ARUBA) { |
77 | radeon_dpm_enable_bapm(rdev, rdev->pm.dpm.ac_power); | 77 | if (rdev->asic->dpm.enable_bapm) |
78 | radeon_dpm_enable_bapm(rdev, rdev->pm.dpm.ac_power); | ||
79 | } | ||
78 | mutex_unlock(&rdev->pm.mutex); | 80 | mutex_unlock(&rdev->pm.mutex); |
79 | } else if (rdev->pm.pm_method == PM_METHOD_PROFILE) { | 81 | } else if (rdev->pm.pm_method == PM_METHOD_PROFILE) { |
80 | if (rdev->pm.profile == PM_PROFILE_AUTO) { | 82 | if (rdev->pm.profile == PM_PROFILE_AUTO) { |
diff --git a/drivers/gpu/drm/radeon/radeon_vm.c b/drivers/gpu/drm/radeon/radeon_vm.c index 899d9126cad6..eecff6bbd341 100644 --- a/drivers/gpu/drm/radeon/radeon_vm.c +++ b/drivers/gpu/drm/radeon/radeon_vm.c | |||
@@ -495,7 +495,7 @@ int radeon_vm_bo_set_addr(struct radeon_device *rdev, | |||
495 | mutex_unlock(&vm->mutex); | 495 | mutex_unlock(&vm->mutex); |
496 | 496 | ||
497 | r = radeon_bo_create(rdev, RADEON_VM_PTE_COUNT * 8, | 497 | r = radeon_bo_create(rdev, RADEON_VM_PTE_COUNT * 8, |
498 | RADEON_GPU_PAGE_SIZE, false, | 498 | RADEON_GPU_PAGE_SIZE, true, |
499 | RADEON_GEM_DOMAIN_VRAM, NULL, &pt); | 499 | RADEON_GEM_DOMAIN_VRAM, NULL, &pt); |
500 | if (r) | 500 | if (r) |
501 | return r; | 501 | return r; |
@@ -992,7 +992,7 @@ int radeon_vm_init(struct radeon_device *rdev, struct radeon_vm *vm) | |||
992 | return -ENOMEM; | 992 | return -ENOMEM; |
993 | } | 993 | } |
994 | 994 | ||
995 | r = radeon_bo_create(rdev, pd_size, align, false, | 995 | r = radeon_bo_create(rdev, pd_size, align, true, |
996 | RADEON_GEM_DOMAIN_VRAM, NULL, | 996 | RADEON_GEM_DOMAIN_VRAM, NULL, |
997 | &vm->page_directory); | 997 | &vm->page_directory); |
998 | if (r) | 998 | if (r) |
diff --git a/drivers/gpu/drm/radeon/rv770_dpm.c b/drivers/gpu/drm/radeon/rv770_dpm.c index da041a43d82e..3c76e1dcdf04 100644 --- a/drivers/gpu/drm/radeon/rv770_dpm.c +++ b/drivers/gpu/drm/radeon/rv770_dpm.c | |||
@@ -2329,12 +2329,6 @@ void rv770_get_engine_memory_ss(struct radeon_device *rdev) | |||
2329 | pi->mclk_ss = radeon_atombios_get_asic_ss_info(rdev, &ss, | 2329 | pi->mclk_ss = radeon_atombios_get_asic_ss_info(rdev, &ss, |
2330 | ASIC_INTERNAL_MEMORY_SS, 0); | 2330 | ASIC_INTERNAL_MEMORY_SS, 0); |
2331 | 2331 | ||
2332 | /* disable ss, causes hangs on some cayman boards */ | ||
2333 | if (rdev->family == CHIP_CAYMAN) { | ||
2334 | pi->sclk_ss = false; | ||
2335 | pi->mclk_ss = false; | ||
2336 | } | ||
2337 | |||
2338 | if (pi->sclk_ss || pi->mclk_ss) | 2332 | if (pi->sclk_ss || pi->mclk_ss) |
2339 | pi->dynamic_ss = true; | 2333 | pi->dynamic_ss = true; |
2340 | else | 2334 | else |
diff --git a/drivers/gpu/drm/radeon/si.c b/drivers/gpu/drm/radeon/si.c index 730cee2c34cf..eba0225259a4 100644 --- a/drivers/gpu/drm/radeon/si.c +++ b/drivers/gpu/drm/radeon/si.c | |||
@@ -6376,14 +6376,16 @@ restart_ih: | |||
6376 | case 147: | 6376 | case 147: |
6377 | addr = RREG32(VM_CONTEXT1_PROTECTION_FAULT_ADDR); | 6377 | addr = RREG32(VM_CONTEXT1_PROTECTION_FAULT_ADDR); |
6378 | status = RREG32(VM_CONTEXT1_PROTECTION_FAULT_STATUS); | 6378 | status = RREG32(VM_CONTEXT1_PROTECTION_FAULT_STATUS); |
6379 | /* reset addr and status */ | ||
6380 | WREG32_P(VM_CONTEXT1_CNTL2, 1, ~1); | ||
6381 | if (addr == 0x0 && status == 0x0) | ||
6382 | break; | ||
6379 | dev_err(rdev->dev, "GPU fault detected: %d 0x%08x\n", src_id, src_data); | 6383 | dev_err(rdev->dev, "GPU fault detected: %d 0x%08x\n", src_id, src_data); |
6380 | dev_err(rdev->dev, " VM_CONTEXT1_PROTECTION_FAULT_ADDR 0x%08X\n", | 6384 | dev_err(rdev->dev, " VM_CONTEXT1_PROTECTION_FAULT_ADDR 0x%08X\n", |
6381 | addr); | 6385 | addr); |
6382 | dev_err(rdev->dev, " VM_CONTEXT1_PROTECTION_FAULT_STATUS 0x%08X\n", | 6386 | dev_err(rdev->dev, " VM_CONTEXT1_PROTECTION_FAULT_STATUS 0x%08X\n", |
6383 | status); | 6387 | status); |
6384 | si_vm_decode_fault(rdev, status, addr); | 6388 | si_vm_decode_fault(rdev, status, addr); |
6385 | /* reset addr and status */ | ||
6386 | WREG32_P(VM_CONTEXT1_CNTL2, 1, ~1); | ||
6387 | break; | 6389 | break; |
6388 | case 176: /* RINGID0 CP_INT */ | 6390 | case 176: /* RINGID0 CP_INT */ |
6389 | radeon_fence_process(rdev, RADEON_RING_TYPE_GFX_INDEX); | 6391 | radeon_fence_process(rdev, RADEON_RING_TYPE_GFX_INDEX); |
diff --git a/drivers/gpu/drm/radeon/trinity_dpm.c b/drivers/gpu/drm/radeon/trinity_dpm.c index 2a2822c03329..20da6ff183df 100644 --- a/drivers/gpu/drm/radeon/trinity_dpm.c +++ b/drivers/gpu/drm/radeon/trinity_dpm.c | |||
@@ -1874,7 +1874,15 @@ int trinity_dpm_init(struct radeon_device *rdev) | |||
1874 | for (i = 0; i < SUMO_MAX_HARDWARE_POWERLEVELS; i++) | 1874 | for (i = 0; i < SUMO_MAX_HARDWARE_POWERLEVELS; i++) |
1875 | pi->at[i] = TRINITY_AT_DFLT; | 1875 | pi->at[i] = TRINITY_AT_DFLT; |
1876 | 1876 | ||
1877 | pi->enable_bapm = false; | 1877 | /* There are stability issues reported on latops with |
1878 | * bapm installed when switching between AC and battery | ||
1879 | * power. At the same time, some desktop boards hang | ||
1880 | * if it's not enabled and dpm is enabled. | ||
1881 | */ | ||
1882 | if (rdev->flags & RADEON_IS_MOBILITY) | ||
1883 | pi->enable_bapm = false; | ||
1884 | else | ||
1885 | pi->enable_bapm = true; | ||
1878 | pi->enable_nbps_policy = true; | 1886 | pi->enable_nbps_policy = true; |
1879 | pi->enable_sclk_ds = true; | 1887 | pi->enable_sclk_ds = true; |
1880 | pi->enable_gfx_power_gating = true; | 1888 | pi->enable_gfx_power_gating = true; |
diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_fb.c b/drivers/gpu/drm/vmwgfx/vmwgfx_fb.c index a89ad938eacf..b031b48dbb3c 100644 --- a/drivers/gpu/drm/vmwgfx/vmwgfx_fb.c +++ b/drivers/gpu/drm/vmwgfx/vmwgfx_fb.c | |||
@@ -179,7 +179,6 @@ static int vmw_fb_set_par(struct fb_info *info) | |||
179 | vmw_write(vmw_priv, SVGA_REG_DISPLAY_POSITION_Y, info->var.yoffset); | 179 | vmw_write(vmw_priv, SVGA_REG_DISPLAY_POSITION_Y, info->var.yoffset); |
180 | vmw_write(vmw_priv, SVGA_REG_DISPLAY_WIDTH, info->var.xres); | 180 | vmw_write(vmw_priv, SVGA_REG_DISPLAY_WIDTH, info->var.xres); |
181 | vmw_write(vmw_priv, SVGA_REG_DISPLAY_HEIGHT, info->var.yres); | 181 | vmw_write(vmw_priv, SVGA_REG_DISPLAY_HEIGHT, info->var.yres); |
182 | vmw_write(vmw_priv, SVGA_REG_BYTES_PER_LINE, info->fix.line_length); | ||
183 | vmw_write(vmw_priv, SVGA_REG_DISPLAY_ID, SVGA_ID_INVALID); | 182 | vmw_write(vmw_priv, SVGA_REG_DISPLAY_ID, SVGA_ID_INVALID); |
184 | } | 183 | } |
185 | 184 | ||
diff --git a/drivers/hid/Kconfig b/drivers/hid/Kconfig index 800c8b60f7a2..5e79c6ad914f 100644 --- a/drivers/hid/Kconfig +++ b/drivers/hid/Kconfig | |||
@@ -810,7 +810,7 @@ config HID_ZYDACRON | |||
810 | 810 | ||
811 | config HID_SENSOR_HUB | 811 | config HID_SENSOR_HUB |
812 | tristate "HID Sensors framework support" | 812 | tristate "HID Sensors framework support" |
813 | depends on HID | 813 | depends on HID && HAS_IOMEM |
814 | select MFD_CORE | 814 | select MFD_CORE |
815 | default n | 815 | default n |
816 | ---help--- | 816 | ---help--- |
diff --git a/drivers/hid/hid-ids.h b/drivers/hid/hid-ids.h index 6d00bb9366fa..48b66bbffc94 100644 --- a/drivers/hid/hid-ids.h +++ b/drivers/hid/hid-ids.h | |||
@@ -323,6 +323,7 @@ | |||
323 | 323 | ||
324 | #define USB_VENDOR_ID_ETURBOTOUCH 0x22b9 | 324 | #define USB_VENDOR_ID_ETURBOTOUCH 0x22b9 |
325 | #define USB_DEVICE_ID_ETURBOTOUCH 0x0006 | 325 | #define USB_DEVICE_ID_ETURBOTOUCH 0x0006 |
326 | #define USB_DEVICE_ID_ETURBOTOUCH_2968 0x2968 | ||
326 | 327 | ||
327 | #define USB_VENDOR_ID_EZKEY 0x0518 | 328 | #define USB_VENDOR_ID_EZKEY 0x0518 |
328 | #define USB_DEVICE_ID_BTC_8193 0x0002 | 329 | #define USB_DEVICE_ID_BTC_8193 0x0002 |
@@ -715,6 +716,8 @@ | |||
715 | 716 | ||
716 | #define USB_VENDOR_ID_PENMOUNT 0x14e1 | 717 | #define USB_VENDOR_ID_PENMOUNT 0x14e1 |
717 | #define USB_DEVICE_ID_PENMOUNT_PCI 0x3500 | 718 | #define USB_DEVICE_ID_PENMOUNT_PCI 0x3500 |
719 | #define USB_DEVICE_ID_PENMOUNT_1610 0x1610 | ||
720 | #define USB_DEVICE_ID_PENMOUNT_1640 0x1640 | ||
718 | 721 | ||
719 | #define USB_VENDOR_ID_PETALYNX 0x18b1 | 722 | #define USB_VENDOR_ID_PETALYNX 0x18b1 |
720 | #define USB_DEVICE_ID_PETALYNX_MAXTER_REMOTE 0x0037 | 723 | #define USB_DEVICE_ID_PETALYNX_MAXTER_REMOTE 0x0037 |
diff --git a/drivers/hid/hid-rmi.c b/drivers/hid/hid-rmi.c index 2451c7e5febd..578bbe65902b 100644 --- a/drivers/hid/hid-rmi.c +++ b/drivers/hid/hid-rmi.c | |||
@@ -428,6 +428,7 @@ static int rmi_raw_event(struct hid_device *hdev, | |||
428 | return 0; | 428 | return 0; |
429 | } | 429 | } |
430 | 430 | ||
431 | #ifdef CONFIG_PM | ||
431 | static int rmi_post_reset(struct hid_device *hdev) | 432 | static int rmi_post_reset(struct hid_device *hdev) |
432 | { | 433 | { |
433 | return rmi_set_mode(hdev, RMI_MODE_ATTN_REPORTS); | 434 | return rmi_set_mode(hdev, RMI_MODE_ATTN_REPORTS); |
@@ -437,6 +438,7 @@ static int rmi_post_resume(struct hid_device *hdev) | |||
437 | { | 438 | { |
438 | return rmi_set_mode(hdev, RMI_MODE_ATTN_REPORTS); | 439 | return rmi_set_mode(hdev, RMI_MODE_ATTN_REPORTS); |
439 | } | 440 | } |
441 | #endif /* CONFIG_PM */ | ||
440 | 442 | ||
441 | #define RMI4_MAX_PAGE 0xff | 443 | #define RMI4_MAX_PAGE 0xff |
442 | #define RMI4_PAGE_SIZE 0x0100 | 444 | #define RMI4_PAGE_SIZE 0x0100 |
diff --git a/drivers/hid/hid-sensor-hub.c b/drivers/hid/hid-sensor-hub.c index a8d5c8faf8cf..e244e449cbba 100644 --- a/drivers/hid/hid-sensor-hub.c +++ b/drivers/hid/hid-sensor-hub.c | |||
@@ -159,17 +159,18 @@ int sensor_hub_register_callback(struct hid_sensor_hub_device *hsdev, | |||
159 | { | 159 | { |
160 | struct hid_sensor_hub_callbacks_list *callback; | 160 | struct hid_sensor_hub_callbacks_list *callback; |
161 | struct sensor_hub_data *pdata = hid_get_drvdata(hsdev->hdev); | 161 | struct sensor_hub_data *pdata = hid_get_drvdata(hsdev->hdev); |
162 | unsigned long flags; | ||
162 | 163 | ||
163 | spin_lock(&pdata->dyn_callback_lock); | 164 | spin_lock_irqsave(&pdata->dyn_callback_lock, flags); |
164 | list_for_each_entry(callback, &pdata->dyn_callback_list, list) | 165 | list_for_each_entry(callback, &pdata->dyn_callback_list, list) |
165 | if (callback->usage_id == usage_id && | 166 | if (callback->usage_id == usage_id && |
166 | callback->hsdev == hsdev) { | 167 | callback->hsdev == hsdev) { |
167 | spin_unlock(&pdata->dyn_callback_lock); | 168 | spin_unlock_irqrestore(&pdata->dyn_callback_lock, flags); |
168 | return -EINVAL; | 169 | return -EINVAL; |
169 | } | 170 | } |
170 | callback = kzalloc(sizeof(*callback), GFP_ATOMIC); | 171 | callback = kzalloc(sizeof(*callback), GFP_ATOMIC); |
171 | if (!callback) { | 172 | if (!callback) { |
172 | spin_unlock(&pdata->dyn_callback_lock); | 173 | spin_unlock_irqrestore(&pdata->dyn_callback_lock, flags); |
173 | return -ENOMEM; | 174 | return -ENOMEM; |
174 | } | 175 | } |
175 | callback->hsdev = hsdev; | 176 | callback->hsdev = hsdev; |
@@ -177,7 +178,7 @@ int sensor_hub_register_callback(struct hid_sensor_hub_device *hsdev, | |||
177 | callback->usage_id = usage_id; | 178 | callback->usage_id = usage_id; |
178 | callback->priv = NULL; | 179 | callback->priv = NULL; |
179 | list_add_tail(&callback->list, &pdata->dyn_callback_list); | 180 | list_add_tail(&callback->list, &pdata->dyn_callback_list); |
180 | spin_unlock(&pdata->dyn_callback_lock); | 181 | spin_unlock_irqrestore(&pdata->dyn_callback_lock, flags); |
181 | 182 | ||
182 | return 0; | 183 | return 0; |
183 | } | 184 | } |
@@ -188,8 +189,9 @@ int sensor_hub_remove_callback(struct hid_sensor_hub_device *hsdev, | |||
188 | { | 189 | { |
189 | struct hid_sensor_hub_callbacks_list *callback; | 190 | struct hid_sensor_hub_callbacks_list *callback; |
190 | struct sensor_hub_data *pdata = hid_get_drvdata(hsdev->hdev); | 191 | struct sensor_hub_data *pdata = hid_get_drvdata(hsdev->hdev); |
192 | unsigned long flags; | ||
191 | 193 | ||
192 | spin_lock(&pdata->dyn_callback_lock); | 194 | spin_lock_irqsave(&pdata->dyn_callback_lock, flags); |
193 | list_for_each_entry(callback, &pdata->dyn_callback_list, list) | 195 | list_for_each_entry(callback, &pdata->dyn_callback_list, list) |
194 | if (callback->usage_id == usage_id && | 196 | if (callback->usage_id == usage_id && |
195 | callback->hsdev == hsdev) { | 197 | callback->hsdev == hsdev) { |
@@ -197,7 +199,7 @@ int sensor_hub_remove_callback(struct hid_sensor_hub_device *hsdev, | |||
197 | kfree(callback); | 199 | kfree(callback); |
198 | break; | 200 | break; |
199 | } | 201 | } |
200 | spin_unlock(&pdata->dyn_callback_lock); | 202 | spin_unlock_irqrestore(&pdata->dyn_callback_lock, flags); |
201 | 203 | ||
202 | return 0; | 204 | return 0; |
203 | } | 205 | } |
@@ -378,15 +380,16 @@ static int sensor_hub_suspend(struct hid_device *hdev, pm_message_t message) | |||
378 | { | 380 | { |
379 | struct sensor_hub_data *pdata = hid_get_drvdata(hdev); | 381 | struct sensor_hub_data *pdata = hid_get_drvdata(hdev); |
380 | struct hid_sensor_hub_callbacks_list *callback; | 382 | struct hid_sensor_hub_callbacks_list *callback; |
383 | unsigned long flags; | ||
381 | 384 | ||
382 | hid_dbg(hdev, " sensor_hub_suspend\n"); | 385 | hid_dbg(hdev, " sensor_hub_suspend\n"); |
383 | spin_lock(&pdata->dyn_callback_lock); | 386 | spin_lock_irqsave(&pdata->dyn_callback_lock, flags); |
384 | list_for_each_entry(callback, &pdata->dyn_callback_list, list) { | 387 | list_for_each_entry(callback, &pdata->dyn_callback_list, list) { |
385 | if (callback->usage_callback->suspend) | 388 | if (callback->usage_callback->suspend) |
386 | callback->usage_callback->suspend( | 389 | callback->usage_callback->suspend( |
387 | callback->hsdev, callback->priv); | 390 | callback->hsdev, callback->priv); |
388 | } | 391 | } |
389 | spin_unlock(&pdata->dyn_callback_lock); | 392 | spin_unlock_irqrestore(&pdata->dyn_callback_lock, flags); |
390 | 393 | ||
391 | return 0; | 394 | return 0; |
392 | } | 395 | } |
@@ -395,15 +398,16 @@ static int sensor_hub_resume(struct hid_device *hdev) | |||
395 | { | 398 | { |
396 | struct sensor_hub_data *pdata = hid_get_drvdata(hdev); | 399 | struct sensor_hub_data *pdata = hid_get_drvdata(hdev); |
397 | struct hid_sensor_hub_callbacks_list *callback; | 400 | struct hid_sensor_hub_callbacks_list *callback; |
401 | unsigned long flags; | ||
398 | 402 | ||
399 | hid_dbg(hdev, " sensor_hub_resume\n"); | 403 | hid_dbg(hdev, " sensor_hub_resume\n"); |
400 | spin_lock(&pdata->dyn_callback_lock); | 404 | spin_lock_irqsave(&pdata->dyn_callback_lock, flags); |
401 | list_for_each_entry(callback, &pdata->dyn_callback_list, list) { | 405 | list_for_each_entry(callback, &pdata->dyn_callback_list, list) { |
402 | if (callback->usage_callback->resume) | 406 | if (callback->usage_callback->resume) |
403 | callback->usage_callback->resume( | 407 | callback->usage_callback->resume( |
404 | callback->hsdev, callback->priv); | 408 | callback->hsdev, callback->priv); |
405 | } | 409 | } |
406 | spin_unlock(&pdata->dyn_callback_lock); | 410 | spin_unlock_irqrestore(&pdata->dyn_callback_lock, flags); |
407 | 411 | ||
408 | return 0; | 412 | return 0; |
409 | } | 413 | } |
@@ -632,6 +636,7 @@ static int sensor_hub_probe(struct hid_device *hdev, | |||
632 | if (name == NULL) { | 636 | if (name == NULL) { |
633 | hid_err(hdev, "Failed MFD device name\n"); | 637 | hid_err(hdev, "Failed MFD device name\n"); |
634 | ret = -ENOMEM; | 638 | ret = -ENOMEM; |
639 | kfree(hsdev); | ||
635 | goto err_no_mem; | 640 | goto err_no_mem; |
636 | } | 641 | } |
637 | sd->hid_sensor_hub_client_devs[ | 642 | sd->hid_sensor_hub_client_devs[ |
diff --git a/drivers/hid/usbhid/hid-quirks.c b/drivers/hid/usbhid/hid-quirks.c index 59badc10a08c..31e6727cd009 100644 --- a/drivers/hid/usbhid/hid-quirks.c +++ b/drivers/hid/usbhid/hid-quirks.c | |||
@@ -49,6 +49,7 @@ static const struct hid_blacklist { | |||
49 | 49 | ||
50 | { USB_VENDOR_ID_EMS, USB_DEVICE_ID_EMS_TRIO_LINKER_PLUS_II, HID_QUIRK_MULTI_INPUT }, | 50 | { USB_VENDOR_ID_EMS, USB_DEVICE_ID_EMS_TRIO_LINKER_PLUS_II, HID_QUIRK_MULTI_INPUT }, |
51 | { USB_VENDOR_ID_ETURBOTOUCH, USB_DEVICE_ID_ETURBOTOUCH, HID_QUIRK_MULTI_INPUT }, | 51 | { USB_VENDOR_ID_ETURBOTOUCH, USB_DEVICE_ID_ETURBOTOUCH, HID_QUIRK_MULTI_INPUT }, |
52 | { USB_VENDOR_ID_ETURBOTOUCH, USB_DEVICE_ID_ETURBOTOUCH_2968, HID_QUIRK_MULTI_INPUT }, | ||
52 | { USB_VENDOR_ID_GREENASIA, USB_DEVICE_ID_GREENASIA_DUAL_USB_JOYPAD, HID_QUIRK_MULTI_INPUT }, | 53 | { USB_VENDOR_ID_GREENASIA, USB_DEVICE_ID_GREENASIA_DUAL_USB_JOYPAD, HID_QUIRK_MULTI_INPUT }, |
53 | { USB_VENDOR_ID_PANTHERLORD, USB_DEVICE_ID_PANTHERLORD_TWIN_USB_JOYSTICK, HID_QUIRK_MULTI_INPUT | HID_QUIRK_SKIP_OUTPUT_REPORTS }, | 54 | { USB_VENDOR_ID_PANTHERLORD, USB_DEVICE_ID_PANTHERLORD_TWIN_USB_JOYSTICK, HID_QUIRK_MULTI_INPUT | HID_QUIRK_SKIP_OUTPUT_REPORTS }, |
54 | { USB_VENDOR_ID_PLAYDOTCOM, USB_DEVICE_ID_PLAYDOTCOM_EMS_USBII, HID_QUIRK_MULTI_INPUT }, | 55 | { USB_VENDOR_ID_PLAYDOTCOM, USB_DEVICE_ID_PLAYDOTCOM_EMS_USBII, HID_QUIRK_MULTI_INPUT }, |
@@ -76,6 +77,8 @@ static const struct hid_blacklist { | |||
76 | { USB_VENDOR_ID_MSI, USB_DEVICE_ID_MSI_GX680R_LED_PANEL, HID_QUIRK_NO_INIT_REPORTS }, | 77 | { USB_VENDOR_ID_MSI, USB_DEVICE_ID_MSI_GX680R_LED_PANEL, HID_QUIRK_NO_INIT_REPORTS }, |
77 | { USB_VENDOR_ID_NEXIO, USB_DEVICE_ID_NEXIO_MULTITOUCH_PTI0750, HID_QUIRK_NO_INIT_REPORTS }, | 78 | { USB_VENDOR_ID_NEXIO, USB_DEVICE_ID_NEXIO_MULTITOUCH_PTI0750, HID_QUIRK_NO_INIT_REPORTS }, |
78 | { USB_VENDOR_ID_NOVATEK, USB_DEVICE_ID_NOVATEK_MOUSE, HID_QUIRK_NO_INIT_REPORTS }, | 79 | { USB_VENDOR_ID_NOVATEK, USB_DEVICE_ID_NOVATEK_MOUSE, HID_QUIRK_NO_INIT_REPORTS }, |
80 | { USB_VENDOR_ID_PENMOUNT, USB_DEVICE_ID_PENMOUNT_1610, HID_QUIRK_NOGET }, | ||
81 | { USB_VENDOR_ID_PENMOUNT, USB_DEVICE_ID_PENMOUNT_1640, HID_QUIRK_NOGET }, | ||
79 | { USB_VENDOR_ID_PIXART, USB_DEVICE_ID_PIXART_OPTICAL_TOUCH_SCREEN, HID_QUIRK_NO_INIT_REPORTS }, | 82 | { USB_VENDOR_ID_PIXART, USB_DEVICE_ID_PIXART_OPTICAL_TOUCH_SCREEN, HID_QUIRK_NO_INIT_REPORTS }, |
80 | { USB_VENDOR_ID_PIXART, USB_DEVICE_ID_PIXART_OPTICAL_TOUCH_SCREEN1, HID_QUIRK_NO_INIT_REPORTS }, | 83 | { USB_VENDOR_ID_PIXART, USB_DEVICE_ID_PIXART_OPTICAL_TOUCH_SCREEN1, HID_QUIRK_NO_INIT_REPORTS }, |
81 | { USB_VENDOR_ID_PIXART, USB_DEVICE_ID_PIXART_OPTICAL_TOUCH_SCREEN2, HID_QUIRK_NO_INIT_REPORTS }, | 84 | { USB_VENDOR_ID_PIXART, USB_DEVICE_ID_PIXART_OPTICAL_TOUCH_SCREEN2, HID_QUIRK_NO_INIT_REPORTS }, |
diff --git a/drivers/hv/connection.c b/drivers/hv/connection.c index e84f4526eb36..ae22e3c1fc4c 100644 --- a/drivers/hv/connection.c +++ b/drivers/hv/connection.c | |||
@@ -339,9 +339,13 @@ static void process_chn_event(u32 relid) | |||
339 | */ | 339 | */ |
340 | 340 | ||
341 | do { | 341 | do { |
342 | hv_begin_read(&channel->inbound); | 342 | if (read_state) |
343 | hv_begin_read(&channel->inbound); | ||
343 | channel->onchannel_callback(arg); | 344 | channel->onchannel_callback(arg); |
344 | bytes_to_read = hv_end_read(&channel->inbound); | 345 | if (read_state) |
346 | bytes_to_read = hv_end_read(&channel->inbound); | ||
347 | else | ||
348 | bytes_to_read = 0; | ||
345 | } while (read_state && (bytes_to_read != 0)); | 349 | } while (read_state && (bytes_to_read != 0)); |
346 | } else { | 350 | } else { |
347 | pr_err("no channel callback for relid - %u\n", relid); | 351 | pr_err("no channel callback for relid - %u\n", relid); |
diff --git a/drivers/hv/hv_kvp.c b/drivers/hv/hv_kvp.c index ea852537307e..521c14625b3a 100644 --- a/drivers/hv/hv_kvp.c +++ b/drivers/hv/hv_kvp.c | |||
@@ -127,6 +127,17 @@ kvp_work_func(struct work_struct *dummy) | |||
127 | kvp_respond_to_host(NULL, HV_E_FAIL); | 127 | kvp_respond_to_host(NULL, HV_E_FAIL); |
128 | } | 128 | } |
129 | 129 | ||
130 | static void poll_channel(struct vmbus_channel *channel) | ||
131 | { | ||
132 | if (channel->target_cpu != smp_processor_id()) | ||
133 | smp_call_function_single(channel->target_cpu, | ||
134 | hv_kvp_onchannelcallback, | ||
135 | channel, true); | ||
136 | else | ||
137 | hv_kvp_onchannelcallback(channel); | ||
138 | } | ||
139 | |||
140 | |||
130 | static int kvp_handle_handshake(struct hv_kvp_msg *msg) | 141 | static int kvp_handle_handshake(struct hv_kvp_msg *msg) |
131 | { | 142 | { |
132 | int ret = 1; | 143 | int ret = 1; |
@@ -155,7 +166,7 @@ static int kvp_handle_handshake(struct hv_kvp_msg *msg) | |||
155 | kvp_register(dm_reg_value); | 166 | kvp_register(dm_reg_value); |
156 | kvp_transaction.active = false; | 167 | kvp_transaction.active = false; |
157 | if (kvp_transaction.kvp_context) | 168 | if (kvp_transaction.kvp_context) |
158 | hv_kvp_onchannelcallback(kvp_transaction.kvp_context); | 169 | poll_channel(kvp_transaction.kvp_context); |
159 | } | 170 | } |
160 | return ret; | 171 | return ret; |
161 | } | 172 | } |
@@ -568,7 +579,7 @@ response_done: | |||
568 | 579 | ||
569 | vmbus_sendpacket(channel, recv_buffer, buf_len, req_id, | 580 | vmbus_sendpacket(channel, recv_buffer, buf_len, req_id, |
570 | VM_PKT_DATA_INBAND, 0); | 581 | VM_PKT_DATA_INBAND, 0); |
571 | 582 | poll_channel(channel); | |
572 | } | 583 | } |
573 | 584 | ||
574 | /* | 585 | /* |
@@ -603,7 +614,7 @@ void hv_kvp_onchannelcallback(void *context) | |||
603 | return; | 614 | return; |
604 | } | 615 | } |
605 | 616 | ||
606 | vmbus_recvpacket(channel, recv_buffer, PAGE_SIZE * 2, &recvlen, | 617 | vmbus_recvpacket(channel, recv_buffer, PAGE_SIZE * 4, &recvlen, |
607 | &requestid); | 618 | &requestid); |
608 | 619 | ||
609 | if (recvlen > 0) { | 620 | if (recvlen > 0) { |
diff --git a/drivers/hv/hv_util.c b/drivers/hv/hv_util.c index dd761806f0e8..3b9c9ef0deb8 100644 --- a/drivers/hv/hv_util.c +++ b/drivers/hv/hv_util.c | |||
@@ -319,7 +319,7 @@ static int util_probe(struct hv_device *dev, | |||
319 | (struct hv_util_service *)dev_id->driver_data; | 319 | (struct hv_util_service *)dev_id->driver_data; |
320 | int ret; | 320 | int ret; |
321 | 321 | ||
322 | srv->recv_buffer = kmalloc(PAGE_SIZE * 2, GFP_KERNEL); | 322 | srv->recv_buffer = kmalloc(PAGE_SIZE * 4, GFP_KERNEL); |
323 | if (!srv->recv_buffer) | 323 | if (!srv->recv_buffer) |
324 | return -ENOMEM; | 324 | return -ENOMEM; |
325 | if (srv->util_init) { | 325 | if (srv->util_init) { |
diff --git a/drivers/hwmon/Kconfig b/drivers/hwmon/Kconfig index 08531a128f53..02d3d85829f3 100644 --- a/drivers/hwmon/Kconfig +++ b/drivers/hwmon/Kconfig | |||
@@ -1052,7 +1052,7 @@ config SENSORS_PC87427 | |||
1052 | will be called pc87427. | 1052 | will be called pc87427. |
1053 | 1053 | ||
1054 | config SENSORS_NTC_THERMISTOR | 1054 | config SENSORS_NTC_THERMISTOR |
1055 | tristate "NTC thermistor support" | 1055 | tristate "NTC thermistor support from Murata" |
1056 | depends on !OF || IIO=n || IIO | 1056 | depends on !OF || IIO=n || IIO |
1057 | help | 1057 | help |
1058 | This driver supports NTC thermistors sensor reading and its | 1058 | This driver supports NTC thermistors sensor reading and its |
@@ -1060,7 +1060,8 @@ config SENSORS_NTC_THERMISTOR | |||
1060 | send notifications about the temperature. | 1060 | send notifications about the temperature. |
1061 | 1061 | ||
1062 | Currently, this driver supports | 1062 | Currently, this driver supports |
1063 | NCP15WB473, NCP18WB473, NCP21WB473, NCP03WB473, and NCP15WL333. | 1063 | NCP15WB473, NCP18WB473, NCP21WB473, NCP03WB473, and NCP15WL333 |
1064 | from Murata. | ||
1064 | 1065 | ||
1065 | This driver can also be built as a module. If so, the module | 1066 | This driver can also be built as a module. If so, the module |
1066 | will be called ntc-thermistor. | 1067 | will be called ntc-thermistor. |
@@ -1176,6 +1177,7 @@ config SENSORS_DME1737 | |||
1176 | config SENSORS_EMC1403 | 1177 | config SENSORS_EMC1403 |
1177 | tristate "SMSC EMC1403/23 thermal sensor" | 1178 | tristate "SMSC EMC1403/23 thermal sensor" |
1178 | depends on I2C | 1179 | depends on I2C |
1180 | select REGMAP_I2C | ||
1179 | help | 1181 | help |
1180 | If you say yes here you get support for the SMSC EMC1403/23 | 1182 | If you say yes here you get support for the SMSC EMC1403/23 |
1181 | temperature monitoring chip. | 1183 | temperature monitoring chip. |
diff --git a/drivers/hwmon/adc128d818.c b/drivers/hwmon/adc128d818.c index 5ffd81f19d01..0625e50d7a6e 100644 --- a/drivers/hwmon/adc128d818.c +++ b/drivers/hwmon/adc128d818.c | |||
@@ -239,50 +239,50 @@ static ssize_t adc128_show_alarm(struct device *dev, | |||
239 | return sprintf(buf, "%u\n", !!(alarms & mask)); | 239 | return sprintf(buf, "%u\n", !!(alarms & mask)); |
240 | } | 240 | } |
241 | 241 | ||
242 | static SENSOR_DEVICE_ATTR_2(in0_input, S_IWUSR | S_IRUGO, | 242 | static SENSOR_DEVICE_ATTR_2(in0_input, S_IRUGO, |
243 | adc128_show_in, adc128_set_in, 0, 0); | 243 | adc128_show_in, NULL, 0, 0); |
244 | static SENSOR_DEVICE_ATTR_2(in0_min, S_IWUSR | S_IRUGO, | 244 | static SENSOR_DEVICE_ATTR_2(in0_min, S_IWUSR | S_IRUGO, |
245 | adc128_show_in, adc128_set_in, 0, 1); | 245 | adc128_show_in, adc128_set_in, 0, 1); |
246 | static SENSOR_DEVICE_ATTR_2(in0_max, S_IWUSR | S_IRUGO, | 246 | static SENSOR_DEVICE_ATTR_2(in0_max, S_IWUSR | S_IRUGO, |
247 | adc128_show_in, adc128_set_in, 0, 2); | 247 | adc128_show_in, adc128_set_in, 0, 2); |
248 | 248 | ||
249 | static SENSOR_DEVICE_ATTR_2(in1_input, S_IWUSR | S_IRUGO, | 249 | static SENSOR_DEVICE_ATTR_2(in1_input, S_IRUGO, |
250 | adc128_show_in, adc128_set_in, 1, 0); | 250 | adc128_show_in, NULL, 1, 0); |
251 | static SENSOR_DEVICE_ATTR_2(in1_min, S_IWUSR | S_IRUGO, | 251 | static SENSOR_DEVICE_ATTR_2(in1_min, S_IWUSR | S_IRUGO, |
252 | adc128_show_in, adc128_set_in, 1, 1); | 252 | adc128_show_in, adc128_set_in, 1, 1); |
253 | static SENSOR_DEVICE_ATTR_2(in1_max, S_IWUSR | S_IRUGO, | 253 | static SENSOR_DEVICE_ATTR_2(in1_max, S_IWUSR | S_IRUGO, |
254 | adc128_show_in, adc128_set_in, 1, 2); | 254 | adc128_show_in, adc128_set_in, 1, 2); |
255 | 255 | ||
256 | static SENSOR_DEVICE_ATTR_2(in2_input, S_IWUSR | S_IRUGO, | 256 | static SENSOR_DEVICE_ATTR_2(in2_input, S_IRUGO, |
257 | adc128_show_in, adc128_set_in, 2, 0); | 257 | adc128_show_in, NULL, 2, 0); |
258 | static SENSOR_DEVICE_ATTR_2(in2_min, S_IWUSR | S_IRUGO, | 258 | static SENSOR_DEVICE_ATTR_2(in2_min, S_IWUSR | S_IRUGO, |
259 | adc128_show_in, adc128_set_in, 2, 1); | 259 | adc128_show_in, adc128_set_in, 2, 1); |
260 | static SENSOR_DEVICE_ATTR_2(in2_max, S_IWUSR | S_IRUGO, | 260 | static SENSOR_DEVICE_ATTR_2(in2_max, S_IWUSR | S_IRUGO, |
261 | adc128_show_in, adc128_set_in, 2, 2); | 261 | adc128_show_in, adc128_set_in, 2, 2); |
262 | 262 | ||
263 | static SENSOR_DEVICE_ATTR_2(in3_input, S_IWUSR | S_IRUGO, | 263 | static SENSOR_DEVICE_ATTR_2(in3_input, S_IRUGO, |
264 | adc128_show_in, adc128_set_in, 3, 0); | 264 | adc128_show_in, NULL, 3, 0); |
265 | static SENSOR_DEVICE_ATTR_2(in3_min, S_IWUSR | S_IRUGO, | 265 | static SENSOR_DEVICE_ATTR_2(in3_min, S_IWUSR | S_IRUGO, |
266 | adc128_show_in, adc128_set_in, 3, 1); | 266 | adc128_show_in, adc128_set_in, 3, 1); |
267 | static SENSOR_DEVICE_ATTR_2(in3_max, S_IWUSR | S_IRUGO, | 267 | static SENSOR_DEVICE_ATTR_2(in3_max, S_IWUSR | S_IRUGO, |
268 | adc128_show_in, adc128_set_in, 3, 2); | 268 | adc128_show_in, adc128_set_in, 3, 2); |
269 | 269 | ||
270 | static SENSOR_DEVICE_ATTR_2(in4_input, S_IWUSR | S_IRUGO, | 270 | static SENSOR_DEVICE_ATTR_2(in4_input, S_IRUGO, |
271 | adc128_show_in, adc128_set_in, 4, 0); | 271 | adc128_show_in, NULL, 4, 0); |
272 | static SENSOR_DEVICE_ATTR_2(in4_min, S_IWUSR | S_IRUGO, | 272 | static SENSOR_DEVICE_ATTR_2(in4_min, S_IWUSR | S_IRUGO, |
273 | adc128_show_in, adc128_set_in, 4, 1); | 273 | adc128_show_in, adc128_set_in, 4, 1); |
274 | static SENSOR_DEVICE_ATTR_2(in4_max, S_IWUSR | S_IRUGO, | 274 | static SENSOR_DEVICE_ATTR_2(in4_max, S_IWUSR | S_IRUGO, |
275 | adc128_show_in, adc128_set_in, 4, 2); | 275 | adc128_show_in, adc128_set_in, 4, 2); |
276 | 276 | ||
277 | static SENSOR_DEVICE_ATTR_2(in5_input, S_IWUSR | S_IRUGO, | 277 | static SENSOR_DEVICE_ATTR_2(in5_input, S_IRUGO, |
278 | adc128_show_in, adc128_set_in, 5, 0); | 278 | adc128_show_in, NULL, 5, 0); |
279 | static SENSOR_DEVICE_ATTR_2(in5_min, S_IWUSR | S_IRUGO, | 279 | static SENSOR_DEVICE_ATTR_2(in5_min, S_IWUSR | S_IRUGO, |
280 | adc128_show_in, adc128_set_in, 5, 1); | 280 | adc128_show_in, adc128_set_in, 5, 1); |
281 | static SENSOR_DEVICE_ATTR_2(in5_max, S_IWUSR | S_IRUGO, | 281 | static SENSOR_DEVICE_ATTR_2(in5_max, S_IWUSR | S_IRUGO, |
282 | adc128_show_in, adc128_set_in, 5, 2); | 282 | adc128_show_in, adc128_set_in, 5, 2); |
283 | 283 | ||
284 | static SENSOR_DEVICE_ATTR_2(in6_input, S_IWUSR | S_IRUGO, | 284 | static SENSOR_DEVICE_ATTR_2(in6_input, S_IRUGO, |
285 | adc128_show_in, adc128_set_in, 6, 0); | 285 | adc128_show_in, NULL, 6, 0); |
286 | static SENSOR_DEVICE_ATTR_2(in6_min, S_IWUSR | S_IRUGO, | 286 | static SENSOR_DEVICE_ATTR_2(in6_min, S_IWUSR | S_IRUGO, |
287 | adc128_show_in, adc128_set_in, 6, 1); | 287 | adc128_show_in, adc128_set_in, 6, 1); |
288 | static SENSOR_DEVICE_ATTR_2(in6_max, S_IWUSR | S_IRUGO, | 288 | static SENSOR_DEVICE_ATTR_2(in6_max, S_IWUSR | S_IRUGO, |
diff --git a/drivers/hwmon/adm1021.c b/drivers/hwmon/adm1021.c index 3eb4281689b5..d74241bb278c 100644 --- a/drivers/hwmon/adm1021.c +++ b/drivers/hwmon/adm1021.c | |||
@@ -185,7 +185,7 @@ static ssize_t set_temp_max(struct device *dev, | |||
185 | struct adm1021_data *data = dev_get_drvdata(dev); | 185 | struct adm1021_data *data = dev_get_drvdata(dev); |
186 | struct i2c_client *client = data->client; | 186 | struct i2c_client *client = data->client; |
187 | long temp; | 187 | long temp; |
188 | int err; | 188 | int reg_val, err; |
189 | 189 | ||
190 | err = kstrtol(buf, 10, &temp); | 190 | err = kstrtol(buf, 10, &temp); |
191 | if (err) | 191 | if (err) |
@@ -193,10 +193,11 @@ static ssize_t set_temp_max(struct device *dev, | |||
193 | temp /= 1000; | 193 | temp /= 1000; |
194 | 194 | ||
195 | mutex_lock(&data->update_lock); | 195 | mutex_lock(&data->update_lock); |
196 | data->temp_max[index] = clamp_val(temp, -128, 127); | 196 | reg_val = clamp_val(temp, -128, 127); |
197 | data->temp_max[index] = reg_val * 1000; | ||
197 | if (!read_only) | 198 | if (!read_only) |
198 | i2c_smbus_write_byte_data(client, ADM1021_REG_TOS_W(index), | 199 | i2c_smbus_write_byte_data(client, ADM1021_REG_TOS_W(index), |
199 | data->temp_max[index]); | 200 | reg_val); |
200 | mutex_unlock(&data->update_lock); | 201 | mutex_unlock(&data->update_lock); |
201 | 202 | ||
202 | return count; | 203 | return count; |
@@ -210,7 +211,7 @@ static ssize_t set_temp_min(struct device *dev, | |||
210 | struct adm1021_data *data = dev_get_drvdata(dev); | 211 | struct adm1021_data *data = dev_get_drvdata(dev); |
211 | struct i2c_client *client = data->client; | 212 | struct i2c_client *client = data->client; |
212 | long temp; | 213 | long temp; |
213 | int err; | 214 | int reg_val, err; |
214 | 215 | ||
215 | err = kstrtol(buf, 10, &temp); | 216 | err = kstrtol(buf, 10, &temp); |
216 | if (err) | 217 | if (err) |
@@ -218,10 +219,11 @@ static ssize_t set_temp_min(struct device *dev, | |||
218 | temp /= 1000; | 219 | temp /= 1000; |
219 | 220 | ||
220 | mutex_lock(&data->update_lock); | 221 | mutex_lock(&data->update_lock); |
221 | data->temp_min[index] = clamp_val(temp, -128, 127); | 222 | reg_val = clamp_val(temp, -128, 127); |
223 | data->temp_min[index] = reg_val * 1000; | ||
222 | if (!read_only) | 224 | if (!read_only) |
223 | i2c_smbus_write_byte_data(client, ADM1021_REG_THYST_W(index), | 225 | i2c_smbus_write_byte_data(client, ADM1021_REG_THYST_W(index), |
224 | data->temp_min[index]); | 226 | reg_val); |
225 | mutex_unlock(&data->update_lock); | 227 | mutex_unlock(&data->update_lock); |
226 | 228 | ||
227 | return count; | 229 | return count; |
diff --git a/drivers/hwmon/adm1029.c b/drivers/hwmon/adm1029.c index 78339e880bd6..2804571b269e 100644 --- a/drivers/hwmon/adm1029.c +++ b/drivers/hwmon/adm1029.c | |||
@@ -232,6 +232,9 @@ static ssize_t set_fan_div(struct device *dev, | |||
232 | /* Update the value */ | 232 | /* Update the value */ |
233 | reg = (reg & 0x3F) | (val << 6); | 233 | reg = (reg & 0x3F) | (val << 6); |
234 | 234 | ||
235 | /* Update the cache */ | ||
236 | data->fan_div[attr->index] = reg; | ||
237 | |||
235 | /* Write value */ | 238 | /* Write value */ |
236 | i2c_smbus_write_byte_data(client, | 239 | i2c_smbus_write_byte_data(client, |
237 | ADM1029_REG_FAN_DIV[attr->index], reg); | 240 | ADM1029_REG_FAN_DIV[attr->index], reg); |
diff --git a/drivers/hwmon/adm1031.c b/drivers/hwmon/adm1031.c index a8a540ca8c34..51c1a5a165ab 100644 --- a/drivers/hwmon/adm1031.c +++ b/drivers/hwmon/adm1031.c | |||
@@ -365,6 +365,7 @@ set_auto_temp_min(struct device *dev, struct device_attribute *attr, | |||
365 | if (ret) | 365 | if (ret) |
366 | return ret; | 366 | return ret; |
367 | 367 | ||
368 | val = clamp_val(val, 0, 127000); | ||
368 | mutex_lock(&data->update_lock); | 369 | mutex_lock(&data->update_lock); |
369 | data->auto_temp[nr] = AUTO_TEMP_MIN_TO_REG(val, data->auto_temp[nr]); | 370 | data->auto_temp[nr] = AUTO_TEMP_MIN_TO_REG(val, data->auto_temp[nr]); |
370 | adm1031_write_value(client, ADM1031_REG_AUTO_TEMP(nr), | 371 | adm1031_write_value(client, ADM1031_REG_AUTO_TEMP(nr), |
@@ -394,6 +395,7 @@ set_auto_temp_max(struct device *dev, struct device_attribute *attr, | |||
394 | if (ret) | 395 | if (ret) |
395 | return ret; | 396 | return ret; |
396 | 397 | ||
398 | val = clamp_val(val, 0, 127000); | ||
397 | mutex_lock(&data->update_lock); | 399 | mutex_lock(&data->update_lock); |
398 | data->temp_max[nr] = AUTO_TEMP_MAX_TO_REG(val, data->auto_temp[nr], | 400 | data->temp_max[nr] = AUTO_TEMP_MAX_TO_REG(val, data->auto_temp[nr], |
399 | data->pwm[nr]); | 401 | data->pwm[nr]); |
@@ -696,7 +698,7 @@ static ssize_t set_temp_min(struct device *dev, struct device_attribute *attr, | |||
696 | if (ret) | 698 | if (ret) |
697 | return ret; | 699 | return ret; |
698 | 700 | ||
699 | val = clamp_val(val, -55000, nr == 0 ? 127750 : 127875); | 701 | val = clamp_val(val, -55000, 127000); |
700 | mutex_lock(&data->update_lock); | 702 | mutex_lock(&data->update_lock); |
701 | data->temp_min[nr] = TEMP_TO_REG(val); | 703 | data->temp_min[nr] = TEMP_TO_REG(val); |
702 | adm1031_write_value(client, ADM1031_REG_TEMP_MIN(nr), | 704 | adm1031_write_value(client, ADM1031_REG_TEMP_MIN(nr), |
@@ -717,7 +719,7 @@ static ssize_t set_temp_max(struct device *dev, struct device_attribute *attr, | |||
717 | if (ret) | 719 | if (ret) |
718 | return ret; | 720 | return ret; |
719 | 721 | ||
720 | val = clamp_val(val, -55000, nr == 0 ? 127750 : 127875); | 722 | val = clamp_val(val, -55000, 127000); |
721 | mutex_lock(&data->update_lock); | 723 | mutex_lock(&data->update_lock); |
722 | data->temp_max[nr] = TEMP_TO_REG(val); | 724 | data->temp_max[nr] = TEMP_TO_REG(val); |
723 | adm1031_write_value(client, ADM1031_REG_TEMP_MAX(nr), | 725 | adm1031_write_value(client, ADM1031_REG_TEMP_MAX(nr), |
@@ -738,7 +740,7 @@ static ssize_t set_temp_crit(struct device *dev, struct device_attribute *attr, | |||
738 | if (ret) | 740 | if (ret) |
739 | return ret; | 741 | return ret; |
740 | 742 | ||
741 | val = clamp_val(val, -55000, nr == 0 ? 127750 : 127875); | 743 | val = clamp_val(val, -55000, 127000); |
742 | mutex_lock(&data->update_lock); | 744 | mutex_lock(&data->update_lock); |
743 | data->temp_crit[nr] = TEMP_TO_REG(val); | 745 | data->temp_crit[nr] = TEMP_TO_REG(val); |
744 | adm1031_write_value(client, ADM1031_REG_TEMP_CRIT(nr), | 746 | adm1031_write_value(client, ADM1031_REG_TEMP_CRIT(nr), |
diff --git a/drivers/hwmon/amc6821.c b/drivers/hwmon/amc6821.c index eea817296513..9f2be3dd28f3 100644 --- a/drivers/hwmon/amc6821.c +++ b/drivers/hwmon/amc6821.c | |||
@@ -704,7 +704,7 @@ static SENSOR_DEVICE_ATTR(temp1_max_alarm, S_IRUGO, | |||
704 | get_temp_alarm, NULL, IDX_TEMP1_MAX); | 704 | get_temp_alarm, NULL, IDX_TEMP1_MAX); |
705 | static SENSOR_DEVICE_ATTR(temp1_crit_alarm, S_IRUGO, | 705 | static SENSOR_DEVICE_ATTR(temp1_crit_alarm, S_IRUGO, |
706 | get_temp_alarm, NULL, IDX_TEMP1_CRIT); | 706 | get_temp_alarm, NULL, IDX_TEMP1_CRIT); |
707 | static SENSOR_DEVICE_ATTR(temp2_input, S_IRUGO | S_IWUSR, | 707 | static SENSOR_DEVICE_ATTR(temp2_input, S_IRUGO, |
708 | get_temp, NULL, IDX_TEMP2_INPUT); | 708 | get_temp, NULL, IDX_TEMP2_INPUT); |
709 | static SENSOR_DEVICE_ATTR(temp2_min, S_IRUGO | S_IWUSR, get_temp, | 709 | static SENSOR_DEVICE_ATTR(temp2_min, S_IRUGO | S_IWUSR, get_temp, |
710 | set_temp, IDX_TEMP2_MIN); | 710 | set_temp, IDX_TEMP2_MIN); |
diff --git a/drivers/hwmon/emc2103.c b/drivers/hwmon/emc2103.c index fd892dd48e4c..78002de46cb6 100644 --- a/drivers/hwmon/emc2103.c +++ b/drivers/hwmon/emc2103.c | |||
@@ -250,9 +250,7 @@ static ssize_t set_temp_min(struct device *dev, struct device_attribute *da, | |||
250 | if (result < 0) | 250 | if (result < 0) |
251 | return result; | 251 | return result; |
252 | 252 | ||
253 | val = DIV_ROUND_CLOSEST(val, 1000); | 253 | val = clamp_val(DIV_ROUND_CLOSEST(val, 1000), -63, 127); |
254 | if ((val < -63) || (val > 127)) | ||
255 | return -EINVAL; | ||
256 | 254 | ||
257 | mutex_lock(&data->update_lock); | 255 | mutex_lock(&data->update_lock); |
258 | data->temp_min[nr] = val; | 256 | data->temp_min[nr] = val; |
@@ -274,9 +272,7 @@ static ssize_t set_temp_max(struct device *dev, struct device_attribute *da, | |||
274 | if (result < 0) | 272 | if (result < 0) |
275 | return result; | 273 | return result; |
276 | 274 | ||
277 | val = DIV_ROUND_CLOSEST(val, 1000); | 275 | val = clamp_val(DIV_ROUND_CLOSEST(val, 1000), -63, 127); |
278 | if ((val < -63) || (val > 127)) | ||
279 | return -EINVAL; | ||
280 | 276 | ||
281 | mutex_lock(&data->update_lock); | 277 | mutex_lock(&data->update_lock); |
282 | data->temp_max[nr] = val; | 278 | data->temp_max[nr] = val; |
@@ -390,15 +386,14 @@ static ssize_t set_fan_target(struct device *dev, struct device_attribute *da, | |||
390 | { | 386 | { |
391 | struct emc2103_data *data = emc2103_update_device(dev); | 387 | struct emc2103_data *data = emc2103_update_device(dev); |
392 | struct i2c_client *client = to_i2c_client(dev); | 388 | struct i2c_client *client = to_i2c_client(dev); |
393 | long rpm_target; | 389 | unsigned long rpm_target; |
394 | 390 | ||
395 | int result = kstrtol(buf, 10, &rpm_target); | 391 | int result = kstrtoul(buf, 10, &rpm_target); |
396 | if (result < 0) | 392 | if (result < 0) |
397 | return result; | 393 | return result; |
398 | 394 | ||
399 | /* Datasheet states 16384 as maximum RPM target (table 3.2) */ | 395 | /* Datasheet states 16384 as maximum RPM target (table 3.2) */ |
400 | if ((rpm_target < 0) || (rpm_target > 16384)) | 396 | rpm_target = clamp_val(rpm_target, 0, 16384); |
401 | return -EINVAL; | ||
402 | 397 | ||
403 | mutex_lock(&data->update_lock); | 398 | mutex_lock(&data->update_lock); |
404 | 399 | ||
diff --git a/drivers/hwmon/gpio-fan.c b/drivers/hwmon/gpio-fan.c index ba35e4d530b5..2566c43dd1e9 100644 --- a/drivers/hwmon/gpio-fan.c +++ b/drivers/hwmon/gpio-fan.c | |||
@@ -538,7 +538,7 @@ static int gpio_fan_probe(struct platform_device *pdev) | |||
538 | 538 | ||
539 | /* Make this driver part of hwmon class. */ | 539 | /* Make this driver part of hwmon class. */ |
540 | fan_data->hwmon_dev = hwmon_device_register_with_groups(&pdev->dev, | 540 | fan_data->hwmon_dev = hwmon_device_register_with_groups(&pdev->dev, |
541 | "gpio-fan", fan_data, | 541 | "gpio_fan", fan_data, |
542 | gpio_fan_groups); | 542 | gpio_fan_groups); |
543 | if (IS_ERR(fan_data->hwmon_dev)) | 543 | if (IS_ERR(fan_data->hwmon_dev)) |
544 | return PTR_ERR(fan_data->hwmon_dev); | 544 | return PTR_ERR(fan_data->hwmon_dev); |
diff --git a/drivers/hwmon/ntc_thermistor.c b/drivers/hwmon/ntc_thermistor.c index e76feb86a1d4..ae66f42c4d6d 100644 --- a/drivers/hwmon/ntc_thermistor.c +++ b/drivers/hwmon/ntc_thermistor.c | |||
@@ -163,6 +163,18 @@ static int ntc_adc_iio_read(struct ntc_thermistor_platform_data *pdata) | |||
163 | } | 163 | } |
164 | 164 | ||
165 | static const struct of_device_id ntc_match[] = { | 165 | static const struct of_device_id ntc_match[] = { |
166 | { .compatible = "murata,ncp15wb473", | ||
167 | .data = &ntc_thermistor_id[0] }, | ||
168 | { .compatible = "murata,ncp18wb473", | ||
169 | .data = &ntc_thermistor_id[1] }, | ||
170 | { .compatible = "murata,ncp21wb473", | ||
171 | .data = &ntc_thermistor_id[2] }, | ||
172 | { .compatible = "murata,ncp03wb473", | ||
173 | .data = &ntc_thermistor_id[3] }, | ||
174 | { .compatible = "murata,ncp15wl333", | ||
175 | .data = &ntc_thermistor_id[4] }, | ||
176 | |||
177 | /* Usage of vendor name "ntc" is deprecated */ | ||
166 | { .compatible = "ntc,ncp15wb473", | 178 | { .compatible = "ntc,ncp15wb473", |
167 | .data = &ntc_thermistor_id[0] }, | 179 | .data = &ntc_thermistor_id[0] }, |
168 | { .compatible = "ntc,ncp18wb473", | 180 | { .compatible = "ntc,ncp18wb473", |
@@ -500,7 +512,7 @@ static int ntc_thermistor_probe(struct platform_device *pdev) | |||
500 | } | 512 | } |
501 | 513 | ||
502 | dev_info(&pdev->dev, "Thermistor type: %s successfully probed.\n", | 514 | dev_info(&pdev->dev, "Thermistor type: %s successfully probed.\n", |
503 | pdev->name); | 515 | pdev_id->name); |
504 | 516 | ||
505 | return 0; | 517 | return 0; |
506 | err_after_sysfs: | 518 | err_after_sysfs: |
@@ -534,7 +546,7 @@ static struct platform_driver ntc_thermistor_driver = { | |||
534 | 546 | ||
535 | module_platform_driver(ntc_thermistor_driver); | 547 | module_platform_driver(ntc_thermistor_driver); |
536 | 548 | ||
537 | MODULE_DESCRIPTION("NTC Thermistor Driver"); | 549 | MODULE_DESCRIPTION("NTC Thermistor Driver from Murata"); |
538 | MODULE_AUTHOR("MyungJoo Ham <myungjoo.ham@samsung.com>"); | 550 | MODULE_AUTHOR("MyungJoo Ham <myungjoo.ham@samsung.com>"); |
539 | MODULE_LICENSE("GPL"); | 551 | MODULE_LICENSE("GPL"); |
540 | MODULE_ALIAS("platform:ntc-thermistor"); | 552 | MODULE_ALIAS("platform:ntc-thermistor"); |
diff --git a/drivers/hwmon/w83l786ng.c b/drivers/hwmon/w83l786ng.c index 6ed76ceb9270..32487c19cbfc 100644 --- a/drivers/hwmon/w83l786ng.c +++ b/drivers/hwmon/w83l786ng.c | |||
@@ -249,7 +249,7 @@ static ssize_t show_##reg(struct device *dev, struct device_attribute *attr, \ | |||
249 | int nr = to_sensor_dev_attr(attr)->index; \ | 249 | int nr = to_sensor_dev_attr(attr)->index; \ |
250 | struct w83l786ng_data *data = w83l786ng_update_device(dev); \ | 250 | struct w83l786ng_data *data = w83l786ng_update_device(dev); \ |
251 | return sprintf(buf, "%d\n", \ | 251 | return sprintf(buf, "%d\n", \ |
252 | FAN_FROM_REG(data->fan[nr], DIV_FROM_REG(data->fan_div[nr]))); \ | 252 | FAN_FROM_REG(data->reg[nr], DIV_FROM_REG(data->fan_div[nr]))); \ |
253 | } | 253 | } |
254 | 254 | ||
255 | show_fan_reg(fan); | 255 | show_fan_reg(fan); |
diff --git a/drivers/i2c/busses/Kconfig b/drivers/i2c/busses/Kconfig index 620d1004a1e7..9f7d5859cf65 100644 --- a/drivers/i2c/busses/Kconfig +++ b/drivers/i2c/busses/Kconfig | |||
@@ -676,6 +676,16 @@ config I2C_RIIC | |||
676 | This driver can also be built as a module. If so, the module | 676 | This driver can also be built as a module. If so, the module |
677 | will be called i2c-riic. | 677 | will be called i2c-riic. |
678 | 678 | ||
679 | config I2C_RK3X | ||
680 | tristate "Rockchip RK3xxx I2C adapter" | ||
681 | depends on OF | ||
682 | help | ||
683 | Say Y here to include support for the I2C adapter in Rockchip RK3xxx | ||
684 | SoCs. | ||
685 | |||
686 | This driver can also be built as a module. If so, the module will | ||
687 | be called i2c-rk3x. | ||
688 | |||
679 | config HAVE_S3C2410_I2C | 689 | config HAVE_S3C2410_I2C |
680 | bool | 690 | bool |
681 | help | 691 | help |
@@ -764,6 +774,19 @@ config I2C_STU300 | |||
764 | This driver can also be built as a module. If so, the module | 774 | This driver can also be built as a module. If so, the module |
765 | will be called i2c-stu300. | 775 | will be called i2c-stu300. |
766 | 776 | ||
777 | config I2C_SUN6I_P2WI | ||
778 | tristate "Allwinner sun6i internal P2WI controller" | ||
779 | depends on RESET_CONTROLLER | ||
780 | depends on MACH_SUN6I || COMPILE_TEST | ||
781 | help | ||
782 | If you say yes to this option, support will be included for the | ||
783 | P2WI (Push/Pull 2 Wire Interface) controller embedded in some sunxi | ||
784 | SOCs. | ||
785 | The P2WI looks like an SMBus controller (which supports only byte | ||
786 | accesses), except that it only supports one slave device. | ||
787 | This interface is used to connect to specific PMIC devices (like the | ||
788 | AXP221). | ||
789 | |||
767 | config I2C_TEGRA | 790 | config I2C_TEGRA |
768 | tristate "NVIDIA Tegra internal I2C controller" | 791 | tristate "NVIDIA Tegra internal I2C controller" |
769 | depends on ARCH_TEGRA | 792 | depends on ARCH_TEGRA |
diff --git a/drivers/i2c/busses/Makefile b/drivers/i2c/busses/Makefile index 298692cc6000..dd9a7f8e873f 100644 --- a/drivers/i2c/busses/Makefile +++ b/drivers/i2c/busses/Makefile | |||
@@ -66,6 +66,7 @@ obj-$(CONFIG_I2C_PXA) += i2c-pxa.o | |||
66 | obj-$(CONFIG_I2C_PXA_PCI) += i2c-pxa-pci.o | 66 | obj-$(CONFIG_I2C_PXA_PCI) += i2c-pxa-pci.o |
67 | obj-$(CONFIG_I2C_QUP) += i2c-qup.o | 67 | obj-$(CONFIG_I2C_QUP) += i2c-qup.o |
68 | obj-$(CONFIG_I2C_RIIC) += i2c-riic.o | 68 | obj-$(CONFIG_I2C_RIIC) += i2c-riic.o |
69 | obj-$(CONFIG_I2C_RK3X) += i2c-rk3x.o | ||
69 | obj-$(CONFIG_I2C_S3C2410) += i2c-s3c2410.o | 70 | obj-$(CONFIG_I2C_S3C2410) += i2c-s3c2410.o |
70 | obj-$(CONFIG_I2C_S6000) += i2c-s6000.o | 71 | obj-$(CONFIG_I2C_S6000) += i2c-s6000.o |
71 | obj-$(CONFIG_I2C_SH7760) += i2c-sh7760.o | 72 | obj-$(CONFIG_I2C_SH7760) += i2c-sh7760.o |
@@ -74,6 +75,7 @@ obj-$(CONFIG_I2C_SIMTEC) += i2c-simtec.o | |||
74 | obj-$(CONFIG_I2C_SIRF) += i2c-sirf.o | 75 | obj-$(CONFIG_I2C_SIRF) += i2c-sirf.o |
75 | obj-$(CONFIG_I2C_ST) += i2c-st.o | 76 | obj-$(CONFIG_I2C_ST) += i2c-st.o |
76 | obj-$(CONFIG_I2C_STU300) += i2c-stu300.o | 77 | obj-$(CONFIG_I2C_STU300) += i2c-stu300.o |
78 | obj-$(CONFIG_I2C_SUN6I_P2WI) += i2c-sun6i-p2wi.o | ||
77 | obj-$(CONFIG_I2C_TEGRA) += i2c-tegra.o | 79 | obj-$(CONFIG_I2C_TEGRA) += i2c-tegra.o |
78 | obj-$(CONFIG_I2C_VERSATILE) += i2c-versatile.o | 80 | obj-$(CONFIG_I2C_VERSATILE) += i2c-versatile.o |
79 | obj-$(CONFIG_I2C_WMT) += i2c-wmt.o | 81 | obj-$(CONFIG_I2C_WMT) += i2c-wmt.o |
diff --git a/drivers/i2c/busses/i2c-rk3x.c b/drivers/i2c/busses/i2c-rk3x.c new file mode 100644 index 000000000000..a9791509966a --- /dev/null +++ b/drivers/i2c/busses/i2c-rk3x.c | |||
@@ -0,0 +1,763 @@ | |||
1 | /* | ||
2 | * Driver for I2C adapter in Rockchip RK3xxx SoC | ||
3 | * | ||
4 | * Max Schwarz <max.schwarz@online.de> | ||
5 | * based on the patches by Rockchip Inc. | ||
6 | * | ||
7 | * This program is free software; you can redistribute it and/or modify | ||
8 | * it under the terms of the GNU General Public License version 2 as | ||
9 | * published by the Free Software Foundation. | ||
10 | */ | ||
11 | |||
12 | #include <linux/kernel.h> | ||
13 | #include <linux/module.h> | ||
14 | #include <linux/i2c.h> | ||
15 | #include <linux/interrupt.h> | ||
16 | #include <linux/errno.h> | ||
17 | #include <linux/err.h> | ||
18 | #include <linux/platform_device.h> | ||
19 | #include <linux/io.h> | ||
20 | #include <linux/of_address.h> | ||
21 | #include <linux/of_irq.h> | ||
22 | #include <linux/spinlock.h> | ||
23 | #include <linux/clk.h> | ||
24 | #include <linux/wait.h> | ||
25 | #include <linux/mfd/syscon.h> | ||
26 | #include <linux/regmap.h> | ||
27 | |||
28 | |||
29 | /* Register Map */ | ||
30 | #define REG_CON 0x00 /* control register */ | ||
31 | #define REG_CLKDIV 0x04 /* clock divisor register */ | ||
32 | #define REG_MRXADDR 0x08 /* slave address for REGISTER_TX */ | ||
33 | #define REG_MRXRADDR 0x0c /* slave register address for REGISTER_TX */ | ||
34 | #define REG_MTXCNT 0x10 /* number of bytes to be transmitted */ | ||
35 | #define REG_MRXCNT 0x14 /* number of bytes to be received */ | ||
36 | #define REG_IEN 0x18 /* interrupt enable */ | ||
37 | #define REG_IPD 0x1c /* interrupt pending */ | ||
38 | #define REG_FCNT 0x20 /* finished count */ | ||
39 | |||
40 | /* Data buffer offsets */ | ||
41 | #define TXBUFFER_BASE 0x100 | ||
42 | #define RXBUFFER_BASE 0x200 | ||
43 | |||
44 | /* REG_CON bits */ | ||
45 | #define REG_CON_EN BIT(0) | ||
46 | enum { | ||
47 | REG_CON_MOD_TX = 0, /* transmit data */ | ||
48 | REG_CON_MOD_REGISTER_TX, /* select register and restart */ | ||
49 | REG_CON_MOD_RX, /* receive data */ | ||
50 | REG_CON_MOD_REGISTER_RX, /* broken: transmits read addr AND writes | ||
51 | * register addr */ | ||
52 | }; | ||
53 | #define REG_CON_MOD(mod) ((mod) << 1) | ||
54 | #define REG_CON_MOD_MASK (BIT(1) | BIT(2)) | ||
55 | #define REG_CON_START BIT(3) | ||
56 | #define REG_CON_STOP BIT(4) | ||
57 | #define REG_CON_LASTACK BIT(5) /* 1: send NACK after last received byte */ | ||
58 | #define REG_CON_ACTACK BIT(6) /* 1: stop if NACK is received */ | ||
59 | |||
60 | /* REG_MRXADDR bits */ | ||
61 | #define REG_MRXADDR_VALID(x) BIT(24 + (x)) /* [x*8+7:x*8] of MRX[R]ADDR valid */ | ||
62 | |||
63 | /* REG_IEN/REG_IPD bits */ | ||
64 | #define REG_INT_BTF BIT(0) /* a byte was transmitted */ | ||
65 | #define REG_INT_BRF BIT(1) /* a byte was received */ | ||
66 | #define REG_INT_MBTF BIT(2) /* master data transmit finished */ | ||
67 | #define REG_INT_MBRF BIT(3) /* master data receive finished */ | ||
68 | #define REG_INT_START BIT(4) /* START condition generated */ | ||
69 | #define REG_INT_STOP BIT(5) /* STOP condition generated */ | ||
70 | #define REG_INT_NAKRCV BIT(6) /* NACK received */ | ||
71 | #define REG_INT_ALL 0x7f | ||
72 | |||
73 | /* Constants */ | ||
74 | #define WAIT_TIMEOUT 200 /* ms */ | ||
75 | #define DEFAULT_SCL_RATE (100 * 1000) /* Hz */ | ||
76 | |||
77 | enum rk3x_i2c_state { | ||
78 | STATE_IDLE, | ||
79 | STATE_START, | ||
80 | STATE_READ, | ||
81 | STATE_WRITE, | ||
82 | STATE_STOP | ||
83 | }; | ||
84 | |||
85 | /** | ||
86 | * @grf_offset: offset inside the grf regmap for setting the i2c type | ||
87 | */ | ||
88 | struct rk3x_i2c_soc_data { | ||
89 | int grf_offset; | ||
90 | }; | ||
91 | |||
92 | struct rk3x_i2c { | ||
93 | struct i2c_adapter adap; | ||
94 | struct device *dev; | ||
95 | struct rk3x_i2c_soc_data *soc_data; | ||
96 | |||
97 | /* Hardware resources */ | ||
98 | void __iomem *regs; | ||
99 | struct clk *clk; | ||
100 | |||
101 | /* Settings */ | ||
102 | unsigned int scl_frequency; | ||
103 | |||
104 | /* Synchronization & notification */ | ||
105 | spinlock_t lock; | ||
106 | wait_queue_head_t wait; | ||
107 | bool busy; | ||
108 | |||
109 | /* Current message */ | ||
110 | struct i2c_msg *msg; | ||
111 | u8 addr; | ||
112 | unsigned int mode; | ||
113 | bool is_last_msg; | ||
114 | |||
115 | /* I2C state machine */ | ||
116 | enum rk3x_i2c_state state; | ||
117 | unsigned int processed; /* sent/received bytes */ | ||
118 | int error; | ||
119 | }; | ||
120 | |||
121 | static inline void i2c_writel(struct rk3x_i2c *i2c, u32 value, | ||
122 | unsigned int offset) | ||
123 | { | ||
124 | writel(value, i2c->regs + offset); | ||
125 | } | ||
126 | |||
127 | static inline u32 i2c_readl(struct rk3x_i2c *i2c, unsigned int offset) | ||
128 | { | ||
129 | return readl(i2c->regs + offset); | ||
130 | } | ||
131 | |||
132 | /* Reset all interrupt pending bits */ | ||
133 | static inline void rk3x_i2c_clean_ipd(struct rk3x_i2c *i2c) | ||
134 | { | ||
135 | i2c_writel(i2c, REG_INT_ALL, REG_IPD); | ||
136 | } | ||
137 | |||
138 | /** | ||
139 | * Generate a START condition, which triggers a REG_INT_START interrupt. | ||
140 | */ | ||
141 | static void rk3x_i2c_start(struct rk3x_i2c *i2c) | ||
142 | { | ||
143 | u32 val; | ||
144 | |||
145 | rk3x_i2c_clean_ipd(i2c); | ||
146 | i2c_writel(i2c, REG_INT_START, REG_IEN); | ||
147 | |||
148 | /* enable adapter with correct mode, send START condition */ | ||
149 | val = REG_CON_EN | REG_CON_MOD(i2c->mode) | REG_CON_START; | ||
150 | |||
151 | /* if we want to react to NACK, set ACTACK bit */ | ||
152 | if (!(i2c->msg->flags & I2C_M_IGNORE_NAK)) | ||
153 | val |= REG_CON_ACTACK; | ||
154 | |||
155 | i2c_writel(i2c, val, REG_CON); | ||
156 | } | ||
157 | |||
158 | /** | ||
159 | * Generate a STOP condition, which triggers a REG_INT_STOP interrupt. | ||
160 | * | ||
161 | * @error: Error code to return in rk3x_i2c_xfer | ||
162 | */ | ||
163 | static void rk3x_i2c_stop(struct rk3x_i2c *i2c, int error) | ||
164 | { | ||
165 | unsigned int ctrl; | ||
166 | |||
167 | i2c->processed = 0; | ||
168 | i2c->msg = NULL; | ||
169 | i2c->error = error; | ||
170 | |||
171 | if (i2c->is_last_msg) { | ||
172 | /* Enable stop interrupt */ | ||
173 | i2c_writel(i2c, REG_INT_STOP, REG_IEN); | ||
174 | |||
175 | i2c->state = STATE_STOP; | ||
176 | |||
177 | ctrl = i2c_readl(i2c, REG_CON); | ||
178 | ctrl |= REG_CON_STOP; | ||
179 | i2c_writel(i2c, ctrl, REG_CON); | ||
180 | } else { | ||
181 | /* Signal rk3x_i2c_xfer to start the next message. */ | ||
182 | i2c->busy = false; | ||
183 | i2c->state = STATE_IDLE; | ||
184 | |||
185 | /* | ||
186 | * The HW is actually not capable of REPEATED START. But we can | ||
187 | * get the intended effect by resetting its internal state | ||
188 | * and issuing an ordinary START. | ||
189 | */ | ||
190 | i2c_writel(i2c, 0, REG_CON); | ||
191 | |||
192 | /* signal that we are finished with the current msg */ | ||
193 | wake_up(&i2c->wait); | ||
194 | } | ||
195 | } | ||
196 | |||
197 | /** | ||
198 | * Setup a read according to i2c->msg | ||
199 | */ | ||
200 | static void rk3x_i2c_prepare_read(struct rk3x_i2c *i2c) | ||
201 | { | ||
202 | unsigned int len = i2c->msg->len - i2c->processed; | ||
203 | u32 con; | ||
204 | |||
205 | con = i2c_readl(i2c, REG_CON); | ||
206 | |||
207 | /* | ||
208 | * The hw can read up to 32 bytes at a time. If we need more than one | ||
209 | * chunk, send an ACK after the last byte of the current chunk. | ||
210 | */ | ||
211 | if (unlikely(len > 32)) { | ||
212 | len = 32; | ||
213 | con &= ~REG_CON_LASTACK; | ||
214 | } else { | ||
215 | con |= REG_CON_LASTACK; | ||
216 | } | ||
217 | |||
218 | /* make sure we are in plain RX mode if we read a second chunk */ | ||
219 | if (i2c->processed != 0) { | ||
220 | con &= ~REG_CON_MOD_MASK; | ||
221 | con |= REG_CON_MOD(REG_CON_MOD_RX); | ||
222 | } | ||
223 | |||
224 | i2c_writel(i2c, con, REG_CON); | ||
225 | i2c_writel(i2c, len, REG_MRXCNT); | ||
226 | } | ||
227 | |||
228 | /** | ||
229 | * Fill the transmit buffer with data from i2c->msg | ||
230 | */ | ||
231 | static void rk3x_i2c_fill_transmit_buf(struct rk3x_i2c *i2c) | ||
232 | { | ||
233 | unsigned int i, j; | ||
234 | u32 cnt = 0; | ||
235 | u32 val; | ||
236 | u8 byte; | ||
237 | |||
238 | for (i = 0; i < 8; ++i) { | ||
239 | val = 0; | ||
240 | for (j = 0; j < 4; ++j) { | ||
241 | if (i2c->processed == i2c->msg->len) | ||
242 | break; | ||
243 | |||
244 | if (i2c->processed == 0 && cnt == 0) | ||
245 | byte = (i2c->addr & 0x7f) << 1; | ||
246 | else | ||
247 | byte = i2c->msg->buf[i2c->processed++]; | ||
248 | |||
249 | val |= byte << (j * 8); | ||
250 | cnt++; | ||
251 | } | ||
252 | |||
253 | i2c_writel(i2c, val, TXBUFFER_BASE + 4 * i); | ||
254 | |||
255 | if (i2c->processed == i2c->msg->len) | ||
256 | break; | ||
257 | } | ||
258 | |||
259 | i2c_writel(i2c, cnt, REG_MTXCNT); | ||
260 | } | ||
261 | |||
262 | |||
263 | /* IRQ handlers for individual states */ | ||
264 | |||
265 | static void rk3x_i2c_handle_start(struct rk3x_i2c *i2c, unsigned int ipd) | ||
266 | { | ||
267 | if (!(ipd & REG_INT_START)) { | ||
268 | rk3x_i2c_stop(i2c, -EIO); | ||
269 | dev_warn(i2c->dev, "unexpected irq in START: 0x%x\n", ipd); | ||
270 | rk3x_i2c_clean_ipd(i2c); | ||
271 | return; | ||
272 | } | ||
273 | |||
274 | /* ack interrupt */ | ||
275 | i2c_writel(i2c, REG_INT_START, REG_IPD); | ||
276 | |||
277 | /* disable start bit */ | ||
278 | i2c_writel(i2c, i2c_readl(i2c, REG_CON) & ~REG_CON_START, REG_CON); | ||
279 | |||
280 | /* enable appropriate interrupts and transition */ | ||
281 | if (i2c->mode == REG_CON_MOD_TX) { | ||
282 | i2c_writel(i2c, REG_INT_MBTF | REG_INT_NAKRCV, REG_IEN); | ||
283 | i2c->state = STATE_WRITE; | ||
284 | rk3x_i2c_fill_transmit_buf(i2c); | ||
285 | } else { | ||
286 | /* in any other case, we are going to be reading. */ | ||
287 | i2c_writel(i2c, REG_INT_MBRF | REG_INT_NAKRCV, REG_IEN); | ||
288 | i2c->state = STATE_READ; | ||
289 | rk3x_i2c_prepare_read(i2c); | ||
290 | } | ||
291 | } | ||
292 | |||
293 | static void rk3x_i2c_handle_write(struct rk3x_i2c *i2c, unsigned int ipd) | ||
294 | { | ||
295 | if (!(ipd & REG_INT_MBTF)) { | ||
296 | rk3x_i2c_stop(i2c, -EIO); | ||
297 | dev_err(i2c->dev, "unexpected irq in WRITE: 0x%x\n", ipd); | ||
298 | rk3x_i2c_clean_ipd(i2c); | ||
299 | return; | ||
300 | } | ||
301 | |||
302 | /* ack interrupt */ | ||
303 | i2c_writel(i2c, REG_INT_MBTF, REG_IPD); | ||
304 | |||
305 | /* are we finished? */ | ||
306 | if (i2c->processed == i2c->msg->len) | ||
307 | rk3x_i2c_stop(i2c, i2c->error); | ||
308 | else | ||
309 | rk3x_i2c_fill_transmit_buf(i2c); | ||
310 | } | ||
311 | |||
312 | static void rk3x_i2c_handle_read(struct rk3x_i2c *i2c, unsigned int ipd) | ||
313 | { | ||
314 | unsigned int i; | ||
315 | unsigned int len = i2c->msg->len - i2c->processed; | ||
316 | u32 uninitialized_var(val); | ||
317 | u8 byte; | ||
318 | |||
319 | /* we only care for MBRF here. */ | ||
320 | if (!(ipd & REG_INT_MBRF)) | ||
321 | return; | ||
322 | |||
323 | /* ack interrupt */ | ||
324 | i2c_writel(i2c, REG_INT_MBRF, REG_IPD); | ||
325 | |||
326 | /* read the data from receive buffer */ | ||
327 | for (i = 0; i < len; ++i) { | ||
328 | if (i % 4 == 0) | ||
329 | val = i2c_readl(i2c, RXBUFFER_BASE + (i / 4) * 4); | ||
330 | |||
331 | byte = (val >> ((i % 4) * 8)) & 0xff; | ||
332 | i2c->msg->buf[i2c->processed++] = byte; | ||
333 | } | ||
334 | |||
335 | /* are we finished? */ | ||
336 | if (i2c->processed == i2c->msg->len) | ||
337 | rk3x_i2c_stop(i2c, i2c->error); | ||
338 | else | ||
339 | rk3x_i2c_prepare_read(i2c); | ||
340 | } | ||
341 | |||
342 | static void rk3x_i2c_handle_stop(struct rk3x_i2c *i2c, unsigned int ipd) | ||
343 | { | ||
344 | unsigned int con; | ||
345 | |||
346 | if (!(ipd & REG_INT_STOP)) { | ||
347 | rk3x_i2c_stop(i2c, -EIO); | ||
348 | dev_err(i2c->dev, "unexpected irq in STOP: 0x%x\n", ipd); | ||
349 | rk3x_i2c_clean_ipd(i2c); | ||
350 | return; | ||
351 | } | ||
352 | |||
353 | /* ack interrupt */ | ||
354 | i2c_writel(i2c, REG_INT_STOP, REG_IPD); | ||
355 | |||
356 | /* disable STOP bit */ | ||
357 | con = i2c_readl(i2c, REG_CON); | ||
358 | con &= ~REG_CON_STOP; | ||
359 | i2c_writel(i2c, con, REG_CON); | ||
360 | |||
361 | i2c->busy = false; | ||
362 | i2c->state = STATE_IDLE; | ||
363 | |||
364 | /* signal rk3x_i2c_xfer that we are finished */ | ||
365 | wake_up(&i2c->wait); | ||
366 | } | ||
367 | |||
368 | static irqreturn_t rk3x_i2c_irq(int irqno, void *dev_id) | ||
369 | { | ||
370 | struct rk3x_i2c *i2c = dev_id; | ||
371 | unsigned int ipd; | ||
372 | |||
373 | spin_lock(&i2c->lock); | ||
374 | |||
375 | ipd = i2c_readl(i2c, REG_IPD); | ||
376 | if (i2c->state == STATE_IDLE) { | ||
377 | dev_warn(i2c->dev, "irq in STATE_IDLE, ipd = 0x%x\n", ipd); | ||
378 | rk3x_i2c_clean_ipd(i2c); | ||
379 | goto out; | ||
380 | } | ||
381 | |||
382 | dev_dbg(i2c->dev, "IRQ: state %d, ipd: %x\n", i2c->state, ipd); | ||
383 | |||
384 | /* Clean interrupt bits we don't care about */ | ||
385 | ipd &= ~(REG_INT_BRF | REG_INT_BTF); | ||
386 | |||
387 | if (ipd & REG_INT_NAKRCV) { | ||
388 | /* | ||
389 | * We got a NACK in the last operation. Depending on whether | ||
390 | * IGNORE_NAK is set, we have to stop the operation and report | ||
391 | * an error. | ||
392 | */ | ||
393 | i2c_writel(i2c, REG_INT_NAKRCV, REG_IPD); | ||
394 | |||
395 | ipd &= ~REG_INT_NAKRCV; | ||
396 | |||
397 | if (!(i2c->msg->flags & I2C_M_IGNORE_NAK)) | ||
398 | rk3x_i2c_stop(i2c, -ENXIO); | ||
399 | } | ||
400 | |||
401 | /* is there anything left to handle? */ | ||
402 | if (unlikely(ipd == 0)) | ||
403 | goto out; | ||
404 | |||
405 | switch (i2c->state) { | ||
406 | case STATE_START: | ||
407 | rk3x_i2c_handle_start(i2c, ipd); | ||
408 | break; | ||
409 | case STATE_WRITE: | ||
410 | rk3x_i2c_handle_write(i2c, ipd); | ||
411 | break; | ||
412 | case STATE_READ: | ||
413 | rk3x_i2c_handle_read(i2c, ipd); | ||
414 | break; | ||
415 | case STATE_STOP: | ||
416 | rk3x_i2c_handle_stop(i2c, ipd); | ||
417 | break; | ||
418 | case STATE_IDLE: | ||
419 | break; | ||
420 | } | ||
421 | |||
422 | out: | ||
423 | spin_unlock(&i2c->lock); | ||
424 | return IRQ_HANDLED; | ||
425 | } | ||
426 | |||
427 | static void rk3x_i2c_set_scl_rate(struct rk3x_i2c *i2c, unsigned long scl_rate) | ||
428 | { | ||
429 | unsigned long i2c_rate = clk_get_rate(i2c->clk); | ||
430 | unsigned int div; | ||
431 | |||
432 | /* SCL rate = (clk rate) / (8 * DIV) */ | ||
433 | div = DIV_ROUND_UP(i2c_rate, scl_rate * 8); | ||
434 | |||
435 | /* The lower and upper half of the CLKDIV reg describe the length of | ||
436 | * SCL low & high periods. */ | ||
437 | div = DIV_ROUND_UP(div, 2); | ||
438 | |||
439 | i2c_writel(i2c, (div << 16) | (div & 0xffff), REG_CLKDIV); | ||
440 | } | ||
441 | |||
442 | /** | ||
443 | * Setup I2C registers for an I2C operation specified by msgs, num. | ||
444 | * | ||
445 | * Must be called with i2c->lock held. | ||
446 | * | ||
447 | * @msgs: I2C msgs to process | ||
448 | * @num: Number of msgs | ||
449 | * | ||
450 | * returns: Number of I2C msgs processed or negative in case of error | ||
451 | */ | ||
452 | static int rk3x_i2c_setup(struct rk3x_i2c *i2c, struct i2c_msg *msgs, int num) | ||
453 | { | ||
454 | u32 addr = (msgs[0].addr & 0x7f) << 1; | ||
455 | int ret = 0; | ||
456 | |||
457 | /* | ||
458 | * The I2C adapter can issue a small (len < 4) write packet before | ||
459 | * reading. This speeds up SMBus-style register reads. | ||
460 | * The MRXADDR/MRXRADDR hold the slave address and the slave register | ||
461 | * address in this case. | ||
462 | */ | ||
463 | |||
464 | if (num >= 2 && msgs[0].len < 4 && | ||
465 | !(msgs[0].flags & I2C_M_RD) && (msgs[1].flags & I2C_M_RD)) { | ||
466 | u32 reg_addr = 0; | ||
467 | int i; | ||
468 | |||
469 | dev_dbg(i2c->dev, "Combined write/read from addr 0x%x\n", | ||
470 | addr >> 1); | ||
471 | |||
472 | /* Fill MRXRADDR with the register address(es) */ | ||
473 | for (i = 0; i < msgs[0].len; ++i) { | ||
474 | reg_addr |= msgs[0].buf[i] << (i * 8); | ||
475 | reg_addr |= REG_MRXADDR_VALID(i); | ||
476 | } | ||
477 | |||
478 | /* msgs[0] is handled by hw. */ | ||
479 | i2c->msg = &msgs[1]; | ||
480 | |||
481 | i2c->mode = REG_CON_MOD_REGISTER_TX; | ||
482 | |||
483 | i2c_writel(i2c, addr | REG_MRXADDR_VALID(0), REG_MRXADDR); | ||
484 | i2c_writel(i2c, reg_addr, REG_MRXRADDR); | ||
485 | |||
486 | ret = 2; | ||
487 | } else { | ||
488 | /* | ||
489 | * We'll have to do it the boring way and process the msgs | ||
490 | * one-by-one. | ||
491 | */ | ||
492 | |||
493 | if (msgs[0].flags & I2C_M_RD) { | ||
494 | addr |= 1; /* set read bit */ | ||
495 | |||
496 | /* | ||
497 | * We have to transmit the slave addr first. Use | ||
498 | * MOD_REGISTER_TX for that purpose. | ||
499 | */ | ||
500 | i2c->mode = REG_CON_MOD_REGISTER_TX; | ||
501 | i2c_writel(i2c, addr | REG_MRXADDR_VALID(0), | ||
502 | REG_MRXADDR); | ||
503 | i2c_writel(i2c, 0, REG_MRXRADDR); | ||
504 | } else { | ||
505 | i2c->mode = REG_CON_MOD_TX; | ||
506 | } | ||
507 | |||
508 | i2c->msg = &msgs[0]; | ||
509 | |||
510 | ret = 1; | ||
511 | } | ||
512 | |||
513 | i2c->addr = msgs[0].addr; | ||
514 | i2c->busy = true; | ||
515 | i2c->state = STATE_START; | ||
516 | i2c->processed = 0; | ||
517 | i2c->error = 0; | ||
518 | |||
519 | rk3x_i2c_clean_ipd(i2c); | ||
520 | |||
521 | return ret; | ||
522 | } | ||
523 | |||
524 | static int rk3x_i2c_xfer(struct i2c_adapter *adap, | ||
525 | struct i2c_msg *msgs, int num) | ||
526 | { | ||
527 | struct rk3x_i2c *i2c = (struct rk3x_i2c *)adap->algo_data; | ||
528 | unsigned long timeout, flags; | ||
529 | int ret = 0; | ||
530 | int i; | ||
531 | |||
532 | spin_lock_irqsave(&i2c->lock, flags); | ||
533 | |||
534 | clk_enable(i2c->clk); | ||
535 | |||
536 | /* The clock rate might have changed, so setup the divider again */ | ||
537 | rk3x_i2c_set_scl_rate(i2c, i2c->scl_frequency); | ||
538 | |||
539 | i2c->is_last_msg = false; | ||
540 | |||
541 | /* | ||
542 | * Process msgs. We can handle more than one message at once (see | ||
543 | * rk3x_i2c_setup()). | ||
544 | */ | ||
545 | for (i = 0; i < num; i += ret) { | ||
546 | ret = rk3x_i2c_setup(i2c, msgs + i, num - i); | ||
547 | |||
548 | if (ret < 0) { | ||
549 | dev_err(i2c->dev, "rk3x_i2c_setup() failed\n"); | ||
550 | break; | ||
551 | } | ||
552 | |||
553 | if (i + ret >= num) | ||
554 | i2c->is_last_msg = true; | ||
555 | |||
556 | spin_unlock_irqrestore(&i2c->lock, flags); | ||
557 | |||
558 | rk3x_i2c_start(i2c); | ||
559 | |||
560 | timeout = wait_event_timeout(i2c->wait, !i2c->busy, | ||
561 | msecs_to_jiffies(WAIT_TIMEOUT)); | ||
562 | |||
563 | spin_lock_irqsave(&i2c->lock, flags); | ||
564 | |||
565 | if (timeout == 0) { | ||
566 | dev_err(i2c->dev, "timeout, ipd: 0x%02x, state: %d\n", | ||
567 | i2c_readl(i2c, REG_IPD), i2c->state); | ||
568 | |||
569 | /* Force a STOP condition without interrupt */ | ||
570 | i2c_writel(i2c, 0, REG_IEN); | ||
571 | i2c_writel(i2c, REG_CON_EN | REG_CON_STOP, REG_CON); | ||
572 | |||
573 | i2c->state = STATE_IDLE; | ||
574 | |||
575 | ret = -ETIMEDOUT; | ||
576 | break; | ||
577 | } | ||
578 | |||
579 | if (i2c->error) { | ||
580 | ret = i2c->error; | ||
581 | break; | ||
582 | } | ||
583 | } | ||
584 | |||
585 | clk_disable(i2c->clk); | ||
586 | spin_unlock_irqrestore(&i2c->lock, flags); | ||
587 | |||
588 | return ret; | ||
589 | } | ||
590 | |||
591 | static u32 rk3x_i2c_func(struct i2c_adapter *adap) | ||
592 | { | ||
593 | return I2C_FUNC_I2C | I2C_FUNC_SMBUS_EMUL | I2C_FUNC_PROTOCOL_MANGLING; | ||
594 | } | ||
595 | |||
596 | static const struct i2c_algorithm rk3x_i2c_algorithm = { | ||
597 | .master_xfer = rk3x_i2c_xfer, | ||
598 | .functionality = rk3x_i2c_func, | ||
599 | }; | ||
600 | |||
601 | static struct rk3x_i2c_soc_data soc_data[3] = { | ||
602 | { .grf_offset = 0x154 }, /* rk3066 */ | ||
603 | { .grf_offset = 0x0a4 }, /* rk3188 */ | ||
604 | { .grf_offset = -1 }, /* no I2C switching needed */ | ||
605 | }; | ||
606 | |||
607 | static const struct of_device_id rk3x_i2c_match[] = { | ||
608 | { .compatible = "rockchip,rk3066-i2c", .data = (void *)&soc_data[0] }, | ||
609 | { .compatible = "rockchip,rk3188-i2c", .data = (void *)&soc_data[1] }, | ||
610 | { .compatible = "rockchip,rk3288-i2c", .data = (void *)&soc_data[2] }, | ||
611 | {}, | ||
612 | }; | ||
613 | |||
614 | static int rk3x_i2c_probe(struct platform_device *pdev) | ||
615 | { | ||
616 | struct device_node *np = pdev->dev.of_node; | ||
617 | const struct of_device_id *match; | ||
618 | struct rk3x_i2c *i2c; | ||
619 | struct resource *mem; | ||
620 | int ret = 0; | ||
621 | int bus_nr; | ||
622 | u32 value; | ||
623 | int irq; | ||
624 | |||
625 | i2c = devm_kzalloc(&pdev->dev, sizeof(struct rk3x_i2c), GFP_KERNEL); | ||
626 | if (!i2c) | ||
627 | return -ENOMEM; | ||
628 | |||
629 | match = of_match_node(rk3x_i2c_match, np); | ||
630 | i2c->soc_data = (struct rk3x_i2c_soc_data *)match->data; | ||
631 | |||
632 | if (of_property_read_u32(pdev->dev.of_node, "clock-frequency", | ||
633 | &i2c->scl_frequency)) { | ||
634 | dev_info(&pdev->dev, "using default SCL frequency: %d\n", | ||
635 | DEFAULT_SCL_RATE); | ||
636 | i2c->scl_frequency = DEFAULT_SCL_RATE; | ||
637 | } | ||
638 | |||
639 | if (i2c->scl_frequency == 0 || i2c->scl_frequency > 400 * 1000) { | ||
640 | dev_warn(&pdev->dev, "invalid SCL frequency specified.\n"); | ||
641 | dev_warn(&pdev->dev, "using default SCL frequency: %d\n", | ||
642 | DEFAULT_SCL_RATE); | ||
643 | i2c->scl_frequency = DEFAULT_SCL_RATE; | ||
644 | } | ||
645 | |||
646 | strlcpy(i2c->adap.name, "rk3x-i2c", sizeof(i2c->adap.name)); | ||
647 | i2c->adap.owner = THIS_MODULE; | ||
648 | i2c->adap.algo = &rk3x_i2c_algorithm; | ||
649 | i2c->adap.retries = 3; | ||
650 | i2c->adap.dev.of_node = np; | ||
651 | i2c->adap.algo_data = i2c; | ||
652 | i2c->adap.dev.parent = &pdev->dev; | ||
653 | |||
654 | i2c->dev = &pdev->dev; | ||
655 | |||
656 | spin_lock_init(&i2c->lock); | ||
657 | init_waitqueue_head(&i2c->wait); | ||
658 | |||
659 | i2c->clk = devm_clk_get(&pdev->dev, NULL); | ||
660 | if (IS_ERR(i2c->clk)) { | ||
661 | dev_err(&pdev->dev, "cannot get clock\n"); | ||
662 | return PTR_ERR(i2c->clk); | ||
663 | } | ||
664 | |||
665 | mem = platform_get_resource(pdev, IORESOURCE_MEM, 0); | ||
666 | i2c->regs = devm_ioremap_resource(&pdev->dev, mem); | ||
667 | if (IS_ERR(i2c->regs)) | ||
668 | return PTR_ERR(i2c->regs); | ||
669 | |||
670 | /* Try to set the I2C adapter number from dt */ | ||
671 | bus_nr = of_alias_get_id(np, "i2c"); | ||
672 | |||
673 | /* | ||
674 | * Switch to new interface if the SoC also offers the old one. | ||
675 | * The control bit is located in the GRF register space. | ||
676 | */ | ||
677 | if (i2c->soc_data->grf_offset >= 0) { | ||
678 | struct regmap *grf; | ||
679 | |||
680 | grf = syscon_regmap_lookup_by_phandle(np, "rockchip,grf"); | ||
681 | if (IS_ERR(grf)) { | ||
682 | dev_err(&pdev->dev, | ||
683 | "rk3x-i2c needs 'rockchip,grf' property\n"); | ||
684 | return PTR_ERR(grf); | ||
685 | } | ||
686 | |||
687 | if (bus_nr < 0) { | ||
688 | dev_err(&pdev->dev, "rk3x-i2c needs i2cX alias"); | ||
689 | return -EINVAL; | ||
690 | } | ||
691 | |||
692 | /* 27+i: write mask, 11+i: value */ | ||
693 | value = BIT(27 + bus_nr) | BIT(11 + bus_nr); | ||
694 | |||
695 | ret = regmap_write(grf, i2c->soc_data->grf_offset, value); | ||
696 | if (ret != 0) { | ||
697 | dev_err(i2c->dev, "Could not write to GRF: %d\n", ret); | ||
698 | return ret; | ||
699 | } | ||
700 | } | ||
701 | |||
702 | /* IRQ setup */ | ||
703 | irq = platform_get_irq(pdev, 0); | ||
704 | if (irq < 0) { | ||
705 | dev_err(&pdev->dev, "cannot find rk3x IRQ\n"); | ||
706 | return irq; | ||
707 | } | ||
708 | |||
709 | ret = devm_request_irq(&pdev->dev, irq, rk3x_i2c_irq, | ||
710 | 0, dev_name(&pdev->dev), i2c); | ||
711 | if (ret < 0) { | ||
712 | dev_err(&pdev->dev, "cannot request IRQ\n"); | ||
713 | return ret; | ||
714 | } | ||
715 | |||
716 | platform_set_drvdata(pdev, i2c); | ||
717 | |||
718 | ret = clk_prepare(i2c->clk); | ||
719 | if (ret < 0) { | ||
720 | dev_err(&pdev->dev, "Could not prepare clock\n"); | ||
721 | return ret; | ||
722 | } | ||
723 | |||
724 | ret = i2c_add_adapter(&i2c->adap); | ||
725 | if (ret < 0) { | ||
726 | dev_err(&pdev->dev, "Could not register adapter\n"); | ||
727 | goto err_clk; | ||
728 | } | ||
729 | |||
730 | dev_info(&pdev->dev, "Initialized RK3xxx I2C bus at %p\n", i2c->regs); | ||
731 | |||
732 | return 0; | ||
733 | |||
734 | err_clk: | ||
735 | clk_unprepare(i2c->clk); | ||
736 | return ret; | ||
737 | } | ||
738 | |||
739 | static int rk3x_i2c_remove(struct platform_device *pdev) | ||
740 | { | ||
741 | struct rk3x_i2c *i2c = platform_get_drvdata(pdev); | ||
742 | |||
743 | i2c_del_adapter(&i2c->adap); | ||
744 | clk_unprepare(i2c->clk); | ||
745 | |||
746 | return 0; | ||
747 | } | ||
748 | |||
749 | static struct platform_driver rk3x_i2c_driver = { | ||
750 | .probe = rk3x_i2c_probe, | ||
751 | .remove = rk3x_i2c_remove, | ||
752 | .driver = { | ||
753 | .owner = THIS_MODULE, | ||
754 | .name = "rk3x-i2c", | ||
755 | .of_match_table = rk3x_i2c_match, | ||
756 | }, | ||
757 | }; | ||
758 | |||
759 | module_platform_driver(rk3x_i2c_driver); | ||
760 | |||
761 | MODULE_DESCRIPTION("Rockchip RK3xxx I2C Bus driver"); | ||
762 | MODULE_AUTHOR("Max Schwarz <max.schwarz@online.de>"); | ||
763 | MODULE_LICENSE("GPL v2"); | ||
diff --git a/drivers/i2c/busses/i2c-sun6i-p2wi.c b/drivers/i2c/busses/i2c-sun6i-p2wi.c new file mode 100644 index 000000000000..4d75d4759709 --- /dev/null +++ b/drivers/i2c/busses/i2c-sun6i-p2wi.c | |||
@@ -0,0 +1,344 @@ | |||
1 | /* | ||
2 | * P2WI (Push-Pull Two Wire Interface) bus driver. | ||
3 | * | ||
4 | * Author: Boris BREZILLON <boris.brezillon@free-electrons.com> | ||
5 | * | ||
6 | * This file is licensed under the terms of the GNU General Public License | ||
7 | * version 2. This program is licensed "as is" without any warranty of any | ||
8 | * kind, whether express or implied. | ||
9 | * | ||
10 | * The P2WI controller looks like an SMBus controller which only supports byte | ||
11 | * data transfers. But, it differs from standard SMBus protocol on several | ||
12 | * aspects: | ||
13 | * - it supports only one slave device, and thus drop the address field | ||
14 | * - it adds a parity bit every 8bits of data | ||
15 | * - only one read access is required to read a byte (instead of a write | ||
16 | * followed by a read access in standard SMBus protocol) | ||
17 | * - there's no Ack bit after each byte transfer | ||
18 | * | ||
19 | * This means this bus cannot be used to interface with standard SMBus | ||
20 | * devices (the only known device to support this interface is the AXP221 | ||
21 | * PMIC). | ||
22 | * | ||
23 | */ | ||
24 | #include <linux/clk.h> | ||
25 | #include <linux/i2c.h> | ||
26 | #include <linux/io.h> | ||
27 | #include <linux/interrupt.h> | ||
28 | #include <linux/module.h> | ||
29 | #include <linux/of.h> | ||
30 | #include <linux/platform_device.h> | ||
31 | #include <linux/reset.h> | ||
32 | |||
33 | |||
34 | /* P2WI registers */ | ||
35 | #define P2WI_CTRL 0x0 | ||
36 | #define P2WI_CCR 0x4 | ||
37 | #define P2WI_INTE 0x8 | ||
38 | #define P2WI_INTS 0xc | ||
39 | #define P2WI_DADDR0 0x10 | ||
40 | #define P2WI_DADDR1 0x14 | ||
41 | #define P2WI_DLEN 0x18 | ||
42 | #define P2WI_DATA0 0x1c | ||
43 | #define P2WI_DATA1 0x20 | ||
44 | #define P2WI_LCR 0x24 | ||
45 | #define P2WI_PMCR 0x28 | ||
46 | |||
47 | /* CTRL fields */ | ||
48 | #define P2WI_CTRL_START_TRANS BIT(7) | ||
49 | #define P2WI_CTRL_ABORT_TRANS BIT(6) | ||
50 | #define P2WI_CTRL_GLOBAL_INT_ENB BIT(1) | ||
51 | #define P2WI_CTRL_SOFT_RST BIT(0) | ||
52 | |||
53 | /* CLK CTRL fields */ | ||
54 | #define P2WI_CCR_SDA_OUT_DELAY(v) (((v) & 0x7) << 8) | ||
55 | #define P2WI_CCR_MAX_CLK_DIV 0xff | ||
56 | #define P2WI_CCR_CLK_DIV(v) ((v) & P2WI_CCR_MAX_CLK_DIV) | ||
57 | |||
58 | /* STATUS fields */ | ||
59 | #define P2WI_INTS_TRANS_ERR_ID(v) (((v) >> 8) & 0xff) | ||
60 | #define P2WI_INTS_LOAD_BSY BIT(2) | ||
61 | #define P2WI_INTS_TRANS_ERR BIT(1) | ||
62 | #define P2WI_INTS_TRANS_OVER BIT(0) | ||
63 | |||
64 | /* DATA LENGTH fields*/ | ||
65 | #define P2WI_DLEN_READ BIT(4) | ||
66 | #define P2WI_DLEN_DATA_LENGTH(v) ((v - 1) & 0x7) | ||
67 | |||
68 | /* LINE CTRL fields*/ | ||
69 | #define P2WI_LCR_SCL_STATE BIT(5) | ||
70 | #define P2WI_LCR_SDA_STATE BIT(4) | ||
71 | #define P2WI_LCR_SCL_CTL BIT(3) | ||
72 | #define P2WI_LCR_SCL_CTL_EN BIT(2) | ||
73 | #define P2WI_LCR_SDA_CTL BIT(1) | ||
74 | #define P2WI_LCR_SDA_CTL_EN BIT(0) | ||
75 | |||
76 | /* PMU MODE CTRL fields */ | ||
77 | #define P2WI_PMCR_PMU_INIT_SEND BIT(31) | ||
78 | #define P2WI_PMCR_PMU_INIT_DATA(v) (((v) & 0xff) << 16) | ||
79 | #define P2WI_PMCR_PMU_MODE_REG(v) (((v) & 0xff) << 8) | ||
80 | #define P2WI_PMCR_PMU_DEV_ADDR(v) ((v) & 0xff) | ||
81 | |||
82 | #define P2WI_MAX_FREQ 6000000 | ||
83 | |||
84 | struct p2wi { | ||
85 | struct i2c_adapter adapter; | ||
86 | struct completion complete; | ||
87 | unsigned int status; | ||
88 | void __iomem *regs; | ||
89 | struct clk *clk; | ||
90 | struct reset_control *rstc; | ||
91 | int slave_addr; | ||
92 | }; | ||
93 | |||
94 | static irqreturn_t p2wi_interrupt(int irq, void *dev_id) | ||
95 | { | ||
96 | struct p2wi *p2wi = dev_id; | ||
97 | unsigned long status; | ||
98 | |||
99 | status = readl(p2wi->regs + P2WI_INTS); | ||
100 | p2wi->status = status; | ||
101 | |||
102 | /* Clear interrupts */ | ||
103 | status &= (P2WI_INTS_LOAD_BSY | P2WI_INTS_TRANS_ERR | | ||
104 | P2WI_INTS_TRANS_OVER); | ||
105 | writel(status, p2wi->regs + P2WI_INTS); | ||
106 | |||
107 | complete(&p2wi->complete); | ||
108 | |||
109 | return IRQ_HANDLED; | ||
110 | } | ||
111 | |||
112 | static u32 p2wi_functionality(struct i2c_adapter *adap) | ||
113 | { | ||
114 | return I2C_FUNC_SMBUS_BYTE_DATA; | ||
115 | } | ||
116 | |||
117 | static int p2wi_smbus_xfer(struct i2c_adapter *adap, u16 addr, | ||
118 | unsigned short flags, char read_write, | ||
119 | u8 command, int size, union i2c_smbus_data *data) | ||
120 | { | ||
121 | struct p2wi *p2wi = i2c_get_adapdata(adap); | ||
122 | unsigned long dlen = P2WI_DLEN_DATA_LENGTH(1); | ||
123 | |||
124 | if (p2wi->slave_addr >= 0 && addr != p2wi->slave_addr) { | ||
125 | dev_err(&adap->dev, "invalid P2WI address\n"); | ||
126 | return -EINVAL; | ||
127 | } | ||
128 | |||
129 | if (!data) | ||
130 | return -EINVAL; | ||
131 | |||
132 | writel(command, p2wi->regs + P2WI_DADDR0); | ||
133 | |||
134 | if (read_write == I2C_SMBUS_READ) | ||
135 | dlen |= P2WI_DLEN_READ; | ||
136 | else | ||
137 | writel(data->byte, p2wi->regs + P2WI_DATA0); | ||
138 | |||
139 | writel(dlen, p2wi->regs + P2WI_DLEN); | ||
140 | |||
141 | if (readl(p2wi->regs + P2WI_CTRL) & P2WI_CTRL_START_TRANS) { | ||
142 | dev_err(&adap->dev, "P2WI bus busy\n"); | ||
143 | return -EBUSY; | ||
144 | } | ||
145 | |||
146 | reinit_completion(&p2wi->complete); | ||
147 | |||
148 | writel(P2WI_INTS_LOAD_BSY | P2WI_INTS_TRANS_ERR | P2WI_INTS_TRANS_OVER, | ||
149 | p2wi->regs + P2WI_INTE); | ||
150 | |||
151 | writel(P2WI_CTRL_START_TRANS | P2WI_CTRL_GLOBAL_INT_ENB, | ||
152 | p2wi->regs + P2WI_CTRL); | ||
153 | |||
154 | wait_for_completion(&p2wi->complete); | ||
155 | |||
156 | if (p2wi->status & P2WI_INTS_LOAD_BSY) { | ||
157 | dev_err(&adap->dev, "P2WI bus busy\n"); | ||
158 | return -EBUSY; | ||
159 | } | ||
160 | |||
161 | if (p2wi->status & P2WI_INTS_TRANS_ERR) { | ||
162 | dev_err(&adap->dev, "P2WI bus xfer error\n"); | ||
163 | return -ENXIO; | ||
164 | } | ||
165 | |||
166 | if (read_write == I2C_SMBUS_READ) | ||
167 | data->byte = readl(p2wi->regs + P2WI_DATA0); | ||
168 | |||
169 | return 0; | ||
170 | } | ||
171 | |||
172 | static const struct i2c_algorithm p2wi_algo = { | ||
173 | .smbus_xfer = p2wi_smbus_xfer, | ||
174 | .functionality = p2wi_functionality, | ||
175 | }; | ||
176 | |||
177 | static const struct of_device_id p2wi_of_match_table[] = { | ||
178 | { .compatible = "allwinner,sun6i-a31-p2wi" }, | ||
179 | {} | ||
180 | }; | ||
181 | MODULE_DEVICE_TABLE(of, p2wi_of_match_table); | ||
182 | |||
183 | static int p2wi_probe(struct platform_device *pdev) | ||
184 | { | ||
185 | struct device *dev = &pdev->dev; | ||
186 | struct device_node *np = dev->of_node; | ||
187 | struct device_node *childnp; | ||
188 | unsigned long parent_clk_freq; | ||
189 | u32 clk_freq = 100000; | ||
190 | struct resource *r; | ||
191 | struct p2wi *p2wi; | ||
192 | u32 slave_addr; | ||
193 | int clk_div; | ||
194 | int irq; | ||
195 | int ret; | ||
196 | |||
197 | of_property_read_u32(np, "clock-frequency", &clk_freq); | ||
198 | if (clk_freq > P2WI_MAX_FREQ) { | ||
199 | dev_err(dev, | ||
200 | "required clock-frequency (%u Hz) is too high (max = 6MHz)", | ||
201 | clk_freq); | ||
202 | return -EINVAL; | ||
203 | } | ||
204 | |||
205 | if (of_get_child_count(np) > 1) { | ||
206 | dev_err(dev, "P2WI only supports one slave device\n"); | ||
207 | return -EINVAL; | ||
208 | } | ||
209 | |||
210 | p2wi = devm_kzalloc(dev, sizeof(struct p2wi), GFP_KERNEL); | ||
211 | if (!p2wi) | ||
212 | return -ENOMEM; | ||
213 | |||
214 | p2wi->slave_addr = -1; | ||
215 | |||
216 | /* | ||
217 | * Authorize a p2wi node without any children to be able to use an | ||
218 | * i2c-dev from userpace. | ||
219 | * In this case the slave_addr is set to -1 and won't be checked when | ||
220 | * launching a P2WI transfer. | ||
221 | */ | ||
222 | childnp = of_get_next_available_child(np, NULL); | ||
223 | if (childnp) { | ||
224 | ret = of_property_read_u32(childnp, "reg", &slave_addr); | ||
225 | if (ret) { | ||
226 | dev_err(dev, "invalid slave address on node %s\n", | ||
227 | childnp->full_name); | ||
228 | return -EINVAL; | ||
229 | } | ||
230 | |||
231 | p2wi->slave_addr = slave_addr; | ||
232 | } | ||
233 | |||
234 | r = platform_get_resource(pdev, IORESOURCE_MEM, 0); | ||
235 | p2wi->regs = devm_ioremap_resource(dev, r); | ||
236 | if (IS_ERR(p2wi->regs)) | ||
237 | return PTR_ERR(p2wi->regs); | ||
238 | |||
239 | strlcpy(p2wi->adapter.name, pdev->name, sizeof(p2wi->adapter.name)); | ||
240 | irq = platform_get_irq(pdev, 0); | ||
241 | if (irq < 0) { | ||
242 | dev_err(dev, "failed to retrieve irq: %d\n", irq); | ||
243 | return irq; | ||
244 | } | ||
245 | |||
246 | p2wi->clk = devm_clk_get(dev, NULL); | ||
247 | if (IS_ERR(p2wi->clk)) { | ||
248 | ret = PTR_ERR(p2wi->clk); | ||
249 | dev_err(dev, "failed to retrieve clk: %d\n", ret); | ||
250 | return ret; | ||
251 | } | ||
252 | |||
253 | ret = clk_prepare_enable(p2wi->clk); | ||
254 | if (ret) { | ||
255 | dev_err(dev, "failed to enable clk: %d\n", ret); | ||
256 | return ret; | ||
257 | } | ||
258 | |||
259 | parent_clk_freq = clk_get_rate(p2wi->clk); | ||
260 | |||
261 | p2wi->rstc = devm_reset_control_get(dev, NULL); | ||
262 | if (IS_ERR(p2wi->rstc)) { | ||
263 | ret = PTR_ERR(p2wi->rstc); | ||
264 | dev_err(dev, "failed to retrieve reset controller: %d\n", ret); | ||
265 | goto err_clk_disable; | ||
266 | } | ||
267 | |||
268 | ret = reset_control_deassert(p2wi->rstc); | ||
269 | if (ret) { | ||
270 | dev_err(dev, "failed to deassert reset line: %d\n", ret); | ||
271 | goto err_clk_disable; | ||
272 | } | ||
273 | |||
274 | init_completion(&p2wi->complete); | ||
275 | p2wi->adapter.dev.parent = dev; | ||
276 | p2wi->adapter.algo = &p2wi_algo; | ||
277 | p2wi->adapter.owner = THIS_MODULE; | ||
278 | p2wi->adapter.dev.of_node = pdev->dev.of_node; | ||
279 | platform_set_drvdata(pdev, p2wi); | ||
280 | i2c_set_adapdata(&p2wi->adapter, p2wi); | ||
281 | |||
282 | ret = devm_request_irq(dev, irq, p2wi_interrupt, 0, pdev->name, p2wi); | ||
283 | if (ret) { | ||
284 | dev_err(dev, "can't register interrupt handler irq%d: %d\n", | ||
285 | irq, ret); | ||
286 | goto err_reset_assert; | ||
287 | } | ||
288 | |||
289 | writel(P2WI_CTRL_SOFT_RST, p2wi->regs + P2WI_CTRL); | ||
290 | |||
291 | clk_div = parent_clk_freq / clk_freq; | ||
292 | if (!clk_div) { | ||
293 | dev_warn(dev, | ||
294 | "clock-frequency is too high, setting it to %lu Hz\n", | ||
295 | parent_clk_freq); | ||
296 | clk_div = 1; | ||
297 | } else if (clk_div > P2WI_CCR_MAX_CLK_DIV) { | ||
298 | dev_warn(dev, | ||
299 | "clock-frequency is too low, setting it to %lu Hz\n", | ||
300 | parent_clk_freq / P2WI_CCR_MAX_CLK_DIV); | ||
301 | clk_div = P2WI_CCR_MAX_CLK_DIV; | ||
302 | } | ||
303 | |||
304 | writel(P2WI_CCR_SDA_OUT_DELAY(1) | P2WI_CCR_CLK_DIV(clk_div), | ||
305 | p2wi->regs + P2WI_CCR); | ||
306 | |||
307 | ret = i2c_add_adapter(&p2wi->adapter); | ||
308 | if (!ret) | ||
309 | return 0; | ||
310 | |||
311 | err_reset_assert: | ||
312 | reset_control_assert(p2wi->rstc); | ||
313 | |||
314 | err_clk_disable: | ||
315 | clk_disable_unprepare(p2wi->clk); | ||
316 | |||
317 | return ret; | ||
318 | } | ||
319 | |||
320 | static int p2wi_remove(struct platform_device *dev) | ||
321 | { | ||
322 | struct p2wi *p2wi = platform_get_drvdata(dev); | ||
323 | |||
324 | reset_control_assert(p2wi->rstc); | ||
325 | clk_disable_unprepare(p2wi->clk); | ||
326 | i2c_del_adapter(&p2wi->adapter); | ||
327 | |||
328 | return 0; | ||
329 | } | ||
330 | |||
331 | static struct platform_driver p2wi_driver = { | ||
332 | .probe = p2wi_probe, | ||
333 | .remove = p2wi_remove, | ||
334 | .driver = { | ||
335 | .owner = THIS_MODULE, | ||
336 | .name = "i2c-sunxi-p2wi", | ||
337 | .of_match_table = p2wi_of_match_table, | ||
338 | }, | ||
339 | }; | ||
340 | module_platform_driver(p2wi_driver); | ||
341 | |||
342 | MODULE_AUTHOR("Boris BREZILLON <boris.brezillon@free-electrons.com>"); | ||
343 | MODULE_DESCRIPTION("Allwinner P2WI driver"); | ||
344 | MODULE_LICENSE("GPL v2"); | ||
diff --git a/drivers/i2c/muxes/Kconfig b/drivers/i2c/muxes/Kconfig index f7f9865b8b89..f6d313e528de 100644 --- a/drivers/i2c/muxes/Kconfig +++ b/drivers/i2c/muxes/Kconfig | |||
@@ -40,6 +40,7 @@ config I2C_MUX_PCA9541 | |||
40 | 40 | ||
41 | config I2C_MUX_PCA954x | 41 | config I2C_MUX_PCA954x |
42 | tristate "Philips PCA954x I2C Mux/switches" | 42 | tristate "Philips PCA954x I2C Mux/switches" |
43 | depends on GPIOLIB | ||
43 | help | 44 | help |
44 | If you say yes here you get support for the Philips PCA954x | 45 | If you say yes here you get support for the Philips PCA954x |
45 | I2C mux/switch devices. | 46 | I2C mux/switch devices. |
diff --git a/drivers/iio/accel/hid-sensor-accel-3d.c b/drivers/iio/accel/hid-sensor-accel-3d.c index 69abf9163df7..54e464e4bb72 100644 --- a/drivers/iio/accel/hid-sensor-accel-3d.c +++ b/drivers/iio/accel/hid-sensor-accel-3d.c | |||
@@ -110,7 +110,6 @@ static int accel_3d_read_raw(struct iio_dev *indio_dev, | |||
110 | struct accel_3d_state *accel_state = iio_priv(indio_dev); | 110 | struct accel_3d_state *accel_state = iio_priv(indio_dev); |
111 | int report_id = -1; | 111 | int report_id = -1; |
112 | u32 address; | 112 | u32 address; |
113 | int ret; | ||
114 | int ret_type; | 113 | int ret_type; |
115 | s32 poll_value; | 114 | s32 poll_value; |
116 | 115 | ||
@@ -151,14 +150,12 @@ static int accel_3d_read_raw(struct iio_dev *indio_dev, | |||
151 | ret_type = IIO_VAL_INT; | 150 | ret_type = IIO_VAL_INT; |
152 | break; | 151 | break; |
153 | case IIO_CHAN_INFO_SAMP_FREQ: | 152 | case IIO_CHAN_INFO_SAMP_FREQ: |
154 | ret = hid_sensor_read_samp_freq_value( | 153 | ret_type = hid_sensor_read_samp_freq_value( |
155 | &accel_state->common_attributes, val, val2); | 154 | &accel_state->common_attributes, val, val2); |
156 | ret_type = IIO_VAL_INT_PLUS_MICRO; | ||
157 | break; | 155 | break; |
158 | case IIO_CHAN_INFO_HYSTERESIS: | 156 | case IIO_CHAN_INFO_HYSTERESIS: |
159 | ret = hid_sensor_read_raw_hyst_value( | 157 | ret_type = hid_sensor_read_raw_hyst_value( |
160 | &accel_state->common_attributes, val, val2); | 158 | &accel_state->common_attributes, val, val2); |
161 | ret_type = IIO_VAL_INT_PLUS_MICRO; | ||
162 | break; | 159 | break; |
163 | default: | 160 | default: |
164 | ret_type = -EINVAL; | 161 | ret_type = -EINVAL; |
diff --git a/drivers/iio/adc/ad799x.c b/drivers/iio/adc/ad799x.c index 39b4cb48d738..6eba301ee03d 100644 --- a/drivers/iio/adc/ad799x.c +++ b/drivers/iio/adc/ad799x.c | |||
@@ -427,9 +427,12 @@ static int ad799x_write_event_value(struct iio_dev *indio_dev, | |||
427 | int ret; | 427 | int ret; |
428 | struct ad799x_state *st = iio_priv(indio_dev); | 428 | struct ad799x_state *st = iio_priv(indio_dev); |
429 | 429 | ||
430 | if (val < 0 || val > RES_MASK(chan->scan_type.realbits)) | ||
431 | return -EINVAL; | ||
432 | |||
430 | mutex_lock(&indio_dev->mlock); | 433 | mutex_lock(&indio_dev->mlock); |
431 | ret = ad799x_i2c_write16(st, ad799x_threshold_reg(chan, dir, info), | 434 | ret = ad799x_i2c_write16(st, ad799x_threshold_reg(chan, dir, info), |
432 | val); | 435 | val << chan->scan_type.shift); |
433 | mutex_unlock(&indio_dev->mlock); | 436 | mutex_unlock(&indio_dev->mlock); |
434 | 437 | ||
435 | return ret; | 438 | return ret; |
@@ -452,7 +455,8 @@ static int ad799x_read_event_value(struct iio_dev *indio_dev, | |||
452 | mutex_unlock(&indio_dev->mlock); | 455 | mutex_unlock(&indio_dev->mlock); |
453 | if (ret < 0) | 456 | if (ret < 0) |
454 | return ret; | 457 | return ret; |
455 | *val = valin; | 458 | *val = (valin >> chan->scan_type.shift) & |
459 | RES_MASK(chan->scan_type.realbits); | ||
456 | 460 | ||
457 | return IIO_VAL_INT; | 461 | return IIO_VAL_INT; |
458 | } | 462 | } |
diff --git a/drivers/iio/adc/at91_adc.c b/drivers/iio/adc/at91_adc.c index 3b5bacd4d8da..2b6a9ce9927c 100644 --- a/drivers/iio/adc/at91_adc.c +++ b/drivers/iio/adc/at91_adc.c | |||
@@ -510,12 +510,11 @@ static int at91_adc_channel_init(struct iio_dev *idev) | |||
510 | return idev->num_channels; | 510 | return idev->num_channels; |
511 | } | 511 | } |
512 | 512 | ||
513 | static u8 at91_adc_get_trigger_value_by_name(struct iio_dev *idev, | 513 | static int at91_adc_get_trigger_value_by_name(struct iio_dev *idev, |
514 | struct at91_adc_trigger *triggers, | 514 | struct at91_adc_trigger *triggers, |
515 | const char *trigger_name) | 515 | const char *trigger_name) |
516 | { | 516 | { |
517 | struct at91_adc_state *st = iio_priv(idev); | 517 | struct at91_adc_state *st = iio_priv(idev); |
518 | u8 value = 0; | ||
519 | int i; | 518 | int i; |
520 | 519 | ||
521 | for (i = 0; i < st->trigger_number; i++) { | 520 | for (i = 0; i < st->trigger_number; i++) { |
@@ -528,15 +527,16 @@ static u8 at91_adc_get_trigger_value_by_name(struct iio_dev *idev, | |||
528 | return -ENOMEM; | 527 | return -ENOMEM; |
529 | 528 | ||
530 | if (strcmp(trigger_name, name) == 0) { | 529 | if (strcmp(trigger_name, name) == 0) { |
531 | value = triggers[i].value; | ||
532 | kfree(name); | 530 | kfree(name); |
533 | break; | 531 | if (triggers[i].value == 0) |
532 | return -EINVAL; | ||
533 | return triggers[i].value; | ||
534 | } | 534 | } |
535 | 535 | ||
536 | kfree(name); | 536 | kfree(name); |
537 | } | 537 | } |
538 | 538 | ||
539 | return value; | 539 | return -EINVAL; |
540 | } | 540 | } |
541 | 541 | ||
542 | static int at91_adc_configure_trigger(struct iio_trigger *trig, bool state) | 542 | static int at91_adc_configure_trigger(struct iio_trigger *trig, bool state) |
@@ -546,14 +546,14 @@ static int at91_adc_configure_trigger(struct iio_trigger *trig, bool state) | |||
546 | struct iio_buffer *buffer = idev->buffer; | 546 | struct iio_buffer *buffer = idev->buffer; |
547 | struct at91_adc_reg_desc *reg = st->registers; | 547 | struct at91_adc_reg_desc *reg = st->registers; |
548 | u32 status = at91_adc_readl(st, reg->trigger_register); | 548 | u32 status = at91_adc_readl(st, reg->trigger_register); |
549 | u8 value; | 549 | int value; |
550 | u8 bit; | 550 | u8 bit; |
551 | 551 | ||
552 | value = at91_adc_get_trigger_value_by_name(idev, | 552 | value = at91_adc_get_trigger_value_by_name(idev, |
553 | st->trigger_list, | 553 | st->trigger_list, |
554 | idev->trig->name); | 554 | idev->trig->name); |
555 | if (value == 0) | 555 | if (value < 0) |
556 | return -EINVAL; | 556 | return value; |
557 | 557 | ||
558 | if (state) { | 558 | if (state) { |
559 | st->buffer = kmalloc(idev->scan_bytes, GFP_KERNEL); | 559 | st->buffer = kmalloc(idev->scan_bytes, GFP_KERNEL); |
diff --git a/drivers/iio/adc/men_z188_adc.c b/drivers/iio/adc/men_z188_adc.c index 6989c16aec2b..b58d6302521f 100644 --- a/drivers/iio/adc/men_z188_adc.c +++ b/drivers/iio/adc/men_z188_adc.c | |||
@@ -121,8 +121,8 @@ static int men_z188_probe(struct mcb_device *dev, | |||
121 | indio_dev->num_channels = ARRAY_SIZE(z188_adc_iio_channels); | 121 | indio_dev->num_channels = ARRAY_SIZE(z188_adc_iio_channels); |
122 | 122 | ||
123 | mem = mcb_request_mem(dev, "z188-adc"); | 123 | mem = mcb_request_mem(dev, "z188-adc"); |
124 | if (!mem) | 124 | if (IS_ERR(mem)) |
125 | return -ENOMEM; | 125 | return PTR_ERR(mem); |
126 | 126 | ||
127 | adc->base = ioremap(mem->start, resource_size(mem)); | 127 | adc->base = ioremap(mem->start, resource_size(mem)); |
128 | if (adc->base == NULL) | 128 | if (adc->base == NULL) |
diff --git a/drivers/iio/adc/ti_am335x_adc.c b/drivers/iio/adc/ti_am335x_adc.c index a4db3026bec6..d5dc4c6ce86c 100644 --- a/drivers/iio/adc/ti_am335x_adc.c +++ b/drivers/iio/adc/ti_am335x_adc.c | |||
@@ -374,7 +374,7 @@ static int tiadc_read_raw(struct iio_dev *indio_dev, | |||
374 | return -EAGAIN; | 374 | return -EAGAIN; |
375 | } | 375 | } |
376 | } | 376 | } |
377 | map_val = chan->channel + TOTAL_CHANNELS; | 377 | map_val = adc_dev->channel_step[chan->scan_index]; |
378 | 378 | ||
379 | /* | 379 | /* |
380 | * We check the complete FIFO. We programmed just one entry but in case | 380 | * We check the complete FIFO. We programmed just one entry but in case |
diff --git a/drivers/iio/adc/twl4030-madc.c b/drivers/iio/adc/twl4030-madc.c index 7de1c4c87942..eb86786e698e 100644 --- a/drivers/iio/adc/twl4030-madc.c +++ b/drivers/iio/adc/twl4030-madc.c | |||
@@ -645,6 +645,7 @@ int twl4030_get_madc_conversion(int channel_no) | |||
645 | req.channels = (1 << channel_no); | 645 | req.channels = (1 << channel_no); |
646 | req.method = TWL4030_MADC_SW2; | 646 | req.method = TWL4030_MADC_SW2; |
647 | req.active = 0; | 647 | req.active = 0; |
648 | req.raw = 0; | ||
648 | req.func_cb = NULL; | 649 | req.func_cb = NULL; |
649 | ret = twl4030_madc_conversion(&req); | 650 | ret = twl4030_madc_conversion(&req); |
650 | if (ret < 0) | 651 | if (ret < 0) |
diff --git a/drivers/iio/common/hid-sensors/hid-sensor-trigger.c b/drivers/iio/common/hid-sensors/hid-sensor-trigger.c index 73282cee0c81..a3109a6f4d86 100644 --- a/drivers/iio/common/hid-sensors/hid-sensor-trigger.c +++ b/drivers/iio/common/hid-sensors/hid-sensor-trigger.c | |||
@@ -75,6 +75,9 @@ int hid_sensor_power_state(struct hid_sensor_common *st, bool state) | |||
75 | (s32)report_val); | 75 | (s32)report_val); |
76 | } | 76 | } |
77 | 77 | ||
78 | sensor_hub_get_feature(st->hsdev, st->power_state.report_id, | ||
79 | st->power_state.index, | ||
80 | &state_val); | ||
78 | return 0; | 81 | return 0; |
79 | } | 82 | } |
80 | EXPORT_SYMBOL(hid_sensor_power_state); | 83 | EXPORT_SYMBOL(hid_sensor_power_state); |
diff --git a/drivers/iio/gyro/hid-sensor-gyro-3d.c b/drivers/iio/gyro/hid-sensor-gyro-3d.c index 40f4e4935d0d..fa034a3dad78 100644 --- a/drivers/iio/gyro/hid-sensor-gyro-3d.c +++ b/drivers/iio/gyro/hid-sensor-gyro-3d.c | |||
@@ -110,7 +110,6 @@ static int gyro_3d_read_raw(struct iio_dev *indio_dev, | |||
110 | struct gyro_3d_state *gyro_state = iio_priv(indio_dev); | 110 | struct gyro_3d_state *gyro_state = iio_priv(indio_dev); |
111 | int report_id = -1; | 111 | int report_id = -1; |
112 | u32 address; | 112 | u32 address; |
113 | int ret; | ||
114 | int ret_type; | 113 | int ret_type; |
115 | s32 poll_value; | 114 | s32 poll_value; |
116 | 115 | ||
@@ -151,14 +150,12 @@ static int gyro_3d_read_raw(struct iio_dev *indio_dev, | |||
151 | ret_type = IIO_VAL_INT; | 150 | ret_type = IIO_VAL_INT; |
152 | break; | 151 | break; |
153 | case IIO_CHAN_INFO_SAMP_FREQ: | 152 | case IIO_CHAN_INFO_SAMP_FREQ: |
154 | ret = hid_sensor_read_samp_freq_value( | 153 | ret_type = hid_sensor_read_samp_freq_value( |
155 | &gyro_state->common_attributes, val, val2); | 154 | &gyro_state->common_attributes, val, val2); |
156 | ret_type = IIO_VAL_INT_PLUS_MICRO; | ||
157 | break; | 155 | break; |
158 | case IIO_CHAN_INFO_HYSTERESIS: | 156 | case IIO_CHAN_INFO_HYSTERESIS: |
159 | ret = hid_sensor_read_raw_hyst_value( | 157 | ret_type = hid_sensor_read_raw_hyst_value( |
160 | &gyro_state->common_attributes, val, val2); | 158 | &gyro_state->common_attributes, val, val2); |
161 | ret_type = IIO_VAL_INT_PLUS_MICRO; | ||
162 | break; | 159 | break; |
163 | default: | 160 | default: |
164 | ret_type = -EINVAL; | 161 | ret_type = -EINVAL; |
diff --git a/drivers/iio/inkern.c b/drivers/iio/inkern.c index d833d55052ea..c7497009d60a 100644 --- a/drivers/iio/inkern.c +++ b/drivers/iio/inkern.c | |||
@@ -183,7 +183,7 @@ static struct iio_channel *of_iio_channel_get_by_name(struct device_node *np, | |||
183 | else if (name && index >= 0) { | 183 | else if (name && index >= 0) { |
184 | pr_err("ERROR: could not get IIO channel %s:%s(%i)\n", | 184 | pr_err("ERROR: could not get IIO channel %s:%s(%i)\n", |
185 | np->full_name, name ? name : "", index); | 185 | np->full_name, name ? name : "", index); |
186 | return chan; | 186 | return NULL; |
187 | } | 187 | } |
188 | 188 | ||
189 | /* | 189 | /* |
@@ -193,8 +193,9 @@ static struct iio_channel *of_iio_channel_get_by_name(struct device_node *np, | |||
193 | */ | 193 | */ |
194 | np = np->parent; | 194 | np = np->parent; |
195 | if (np && !of_get_property(np, "io-channel-ranges", NULL)) | 195 | if (np && !of_get_property(np, "io-channel-ranges", NULL)) |
196 | break; | 196 | return NULL; |
197 | } | 197 | } |
198 | |||
198 | return chan; | 199 | return chan; |
199 | } | 200 | } |
200 | 201 | ||
@@ -317,6 +318,7 @@ struct iio_channel *iio_channel_get(struct device *dev, | |||
317 | if (channel != NULL) | 318 | if (channel != NULL) |
318 | return channel; | 319 | return channel; |
319 | } | 320 | } |
321 | |||
320 | return iio_channel_get_sys(name, channel_name); | 322 | return iio_channel_get_sys(name, channel_name); |
321 | } | 323 | } |
322 | EXPORT_SYMBOL_GPL(iio_channel_get); | 324 | EXPORT_SYMBOL_GPL(iio_channel_get); |
diff --git a/drivers/iio/light/hid-sensor-als.c b/drivers/iio/light/hid-sensor-als.c index f34c94380b41..96e71e103ea7 100644 --- a/drivers/iio/light/hid-sensor-als.c +++ b/drivers/iio/light/hid-sensor-als.c | |||
@@ -79,7 +79,6 @@ static int als_read_raw(struct iio_dev *indio_dev, | |||
79 | struct als_state *als_state = iio_priv(indio_dev); | 79 | struct als_state *als_state = iio_priv(indio_dev); |
80 | int report_id = -1; | 80 | int report_id = -1; |
81 | u32 address; | 81 | u32 address; |
82 | int ret; | ||
83 | int ret_type; | 82 | int ret_type; |
84 | s32 poll_value; | 83 | s32 poll_value; |
85 | 84 | ||
@@ -129,14 +128,12 @@ static int als_read_raw(struct iio_dev *indio_dev, | |||
129 | ret_type = IIO_VAL_INT; | 128 | ret_type = IIO_VAL_INT; |
130 | break; | 129 | break; |
131 | case IIO_CHAN_INFO_SAMP_FREQ: | 130 | case IIO_CHAN_INFO_SAMP_FREQ: |
132 | ret = hid_sensor_read_samp_freq_value( | 131 | ret_type = hid_sensor_read_samp_freq_value( |
133 | &als_state->common_attributes, val, val2); | 132 | &als_state->common_attributes, val, val2); |
134 | ret_type = IIO_VAL_INT_PLUS_MICRO; | ||
135 | break; | 133 | break; |
136 | case IIO_CHAN_INFO_HYSTERESIS: | 134 | case IIO_CHAN_INFO_HYSTERESIS: |
137 | ret = hid_sensor_read_raw_hyst_value( | 135 | ret_type = hid_sensor_read_raw_hyst_value( |
138 | &als_state->common_attributes, val, val2); | 136 | &als_state->common_attributes, val, val2); |
139 | ret_type = IIO_VAL_INT_PLUS_MICRO; | ||
140 | break; | 137 | break; |
141 | default: | 138 | default: |
142 | ret_type = -EINVAL; | 139 | ret_type = -EINVAL; |
diff --git a/drivers/iio/light/hid-sensor-prox.c b/drivers/iio/light/hid-sensor-prox.c index d203ef4d892f..412bae86d6ae 100644 --- a/drivers/iio/light/hid-sensor-prox.c +++ b/drivers/iio/light/hid-sensor-prox.c | |||
@@ -74,7 +74,6 @@ static int prox_read_raw(struct iio_dev *indio_dev, | |||
74 | struct prox_state *prox_state = iio_priv(indio_dev); | 74 | struct prox_state *prox_state = iio_priv(indio_dev); |
75 | int report_id = -1; | 75 | int report_id = -1; |
76 | u32 address; | 76 | u32 address; |
77 | int ret; | ||
78 | int ret_type; | 77 | int ret_type; |
79 | s32 poll_value; | 78 | s32 poll_value; |
80 | 79 | ||
@@ -125,14 +124,12 @@ static int prox_read_raw(struct iio_dev *indio_dev, | |||
125 | ret_type = IIO_VAL_INT; | 124 | ret_type = IIO_VAL_INT; |
126 | break; | 125 | break; |
127 | case IIO_CHAN_INFO_SAMP_FREQ: | 126 | case IIO_CHAN_INFO_SAMP_FREQ: |
128 | ret = hid_sensor_read_samp_freq_value( | 127 | ret_type = hid_sensor_read_samp_freq_value( |
129 | &prox_state->common_attributes, val, val2); | 128 | &prox_state->common_attributes, val, val2); |
130 | ret_type = IIO_VAL_INT_PLUS_MICRO; | ||
131 | break; | 129 | break; |
132 | case IIO_CHAN_INFO_HYSTERESIS: | 130 | case IIO_CHAN_INFO_HYSTERESIS: |
133 | ret = hid_sensor_read_raw_hyst_value( | 131 | ret_type = hid_sensor_read_raw_hyst_value( |
134 | &prox_state->common_attributes, val, val2); | 132 | &prox_state->common_attributes, val, val2); |
135 | ret_type = IIO_VAL_INT_PLUS_MICRO; | ||
136 | break; | 133 | break; |
137 | default: | 134 | default: |
138 | ret_type = -EINVAL; | 135 | ret_type = -EINVAL; |
diff --git a/drivers/iio/light/tcs3472.c b/drivers/iio/light/tcs3472.c index fe063a0a21cd..752569985d1d 100644 --- a/drivers/iio/light/tcs3472.c +++ b/drivers/iio/light/tcs3472.c | |||
@@ -52,6 +52,7 @@ | |||
52 | 52 | ||
53 | struct tcs3472_data { | 53 | struct tcs3472_data { |
54 | struct i2c_client *client; | 54 | struct i2c_client *client; |
55 | struct mutex lock; | ||
55 | u8 enable; | 56 | u8 enable; |
56 | u8 control; | 57 | u8 control; |
57 | u8 atime; | 58 | u8 atime; |
@@ -116,10 +117,17 @@ static int tcs3472_read_raw(struct iio_dev *indio_dev, | |||
116 | 117 | ||
117 | switch (mask) { | 118 | switch (mask) { |
118 | case IIO_CHAN_INFO_RAW: | 119 | case IIO_CHAN_INFO_RAW: |
120 | if (iio_buffer_enabled(indio_dev)) | ||
121 | return -EBUSY; | ||
122 | |||
123 | mutex_lock(&data->lock); | ||
119 | ret = tcs3472_req_data(data); | 124 | ret = tcs3472_req_data(data); |
120 | if (ret < 0) | 125 | if (ret < 0) { |
126 | mutex_unlock(&data->lock); | ||
121 | return ret; | 127 | return ret; |
128 | } | ||
122 | ret = i2c_smbus_read_word_data(data->client, chan->address); | 129 | ret = i2c_smbus_read_word_data(data->client, chan->address); |
130 | mutex_unlock(&data->lock); | ||
123 | if (ret < 0) | 131 | if (ret < 0) |
124 | return ret; | 132 | return ret; |
125 | *val = ret; | 133 | *val = ret; |
@@ -255,6 +263,7 @@ static int tcs3472_probe(struct i2c_client *client, | |||
255 | data = iio_priv(indio_dev); | 263 | data = iio_priv(indio_dev); |
256 | i2c_set_clientdata(client, indio_dev); | 264 | i2c_set_clientdata(client, indio_dev); |
257 | data->client = client; | 265 | data->client = client; |
266 | mutex_init(&data->lock); | ||
258 | 267 | ||
259 | indio_dev->dev.parent = &client->dev; | 268 | indio_dev->dev.parent = &client->dev; |
260 | indio_dev->info = &tcs3472_info; | 269 | indio_dev->info = &tcs3472_info; |
diff --git a/drivers/iio/magnetometer/ak8975.c b/drivers/iio/magnetometer/ak8975.c index 09ea5c481f4c..ea08313af0d2 100644 --- a/drivers/iio/magnetometer/ak8975.c +++ b/drivers/iio/magnetometer/ak8975.c | |||
@@ -373,8 +373,6 @@ static int ak8975_read_axis(struct iio_dev *indio_dev, int index, int *val) | |||
373 | { | 373 | { |
374 | struct ak8975_data *data = iio_priv(indio_dev); | 374 | struct ak8975_data *data = iio_priv(indio_dev); |
375 | struct i2c_client *client = data->client; | 375 | struct i2c_client *client = data->client; |
376 | u16 meas_reg; | ||
377 | s16 raw; | ||
378 | int ret; | 376 | int ret; |
379 | 377 | ||
380 | mutex_lock(&data->lock); | 378 | mutex_lock(&data->lock); |
@@ -422,16 +420,11 @@ static int ak8975_read_axis(struct iio_dev *indio_dev, int index, int *val) | |||
422 | dev_err(&client->dev, "Read axis data fails\n"); | 420 | dev_err(&client->dev, "Read axis data fails\n"); |
423 | goto exit; | 421 | goto exit; |
424 | } | 422 | } |
425 | meas_reg = ret; | ||
426 | 423 | ||
427 | mutex_unlock(&data->lock); | 424 | mutex_unlock(&data->lock); |
428 | 425 | ||
429 | /* Endian conversion of the measured values. */ | ||
430 | raw = (s16) (le16_to_cpu(meas_reg)); | ||
431 | |||
432 | /* Clamp to valid range. */ | 426 | /* Clamp to valid range. */ |
433 | raw = clamp_t(s16, raw, -4096, 4095); | 427 | *val = clamp_t(s16, ret, -4096, 4095); |
434 | *val = raw; | ||
435 | return IIO_VAL_INT; | 428 | return IIO_VAL_INT; |
436 | 429 | ||
437 | exit: | 430 | exit: |
diff --git a/drivers/iio/magnetometer/hid-sensor-magn-3d.c b/drivers/iio/magnetometer/hid-sensor-magn-3d.c index 41cf29e2a371..b2b0937d5133 100644 --- a/drivers/iio/magnetometer/hid-sensor-magn-3d.c +++ b/drivers/iio/magnetometer/hid-sensor-magn-3d.c | |||
@@ -110,7 +110,6 @@ static int magn_3d_read_raw(struct iio_dev *indio_dev, | |||
110 | struct magn_3d_state *magn_state = iio_priv(indio_dev); | 110 | struct magn_3d_state *magn_state = iio_priv(indio_dev); |
111 | int report_id = -1; | 111 | int report_id = -1; |
112 | u32 address; | 112 | u32 address; |
113 | int ret; | ||
114 | int ret_type; | 113 | int ret_type; |
115 | s32 poll_value; | 114 | s32 poll_value; |
116 | 115 | ||
@@ -153,14 +152,12 @@ static int magn_3d_read_raw(struct iio_dev *indio_dev, | |||
153 | ret_type = IIO_VAL_INT; | 152 | ret_type = IIO_VAL_INT; |
154 | break; | 153 | break; |
155 | case IIO_CHAN_INFO_SAMP_FREQ: | 154 | case IIO_CHAN_INFO_SAMP_FREQ: |
156 | ret = hid_sensor_read_samp_freq_value( | 155 | ret_type = hid_sensor_read_samp_freq_value( |
157 | &magn_state->common_attributes, val, val2); | 156 | &magn_state->common_attributes, val, val2); |
158 | ret_type = IIO_VAL_INT_PLUS_MICRO; | ||
159 | break; | 157 | break; |
160 | case IIO_CHAN_INFO_HYSTERESIS: | 158 | case IIO_CHAN_INFO_HYSTERESIS: |
161 | ret = hid_sensor_read_raw_hyst_value( | 159 | ret_type = hid_sensor_read_raw_hyst_value( |
162 | &magn_state->common_attributes, val, val2); | 160 | &magn_state->common_attributes, val, val2); |
163 | ret_type = IIO_VAL_INT_PLUS_MICRO; | ||
164 | break; | 161 | break; |
165 | default: | 162 | default: |
166 | ret_type = -EINVAL; | 163 | ret_type = -EINVAL; |
diff --git a/drivers/iio/pressure/hid-sensor-press.c b/drivers/iio/pressure/hid-sensor-press.c index 1cd190c73788..2c0d2a4fed8c 100644 --- a/drivers/iio/pressure/hid-sensor-press.c +++ b/drivers/iio/pressure/hid-sensor-press.c | |||
@@ -78,7 +78,6 @@ static int press_read_raw(struct iio_dev *indio_dev, | |||
78 | struct press_state *press_state = iio_priv(indio_dev); | 78 | struct press_state *press_state = iio_priv(indio_dev); |
79 | int report_id = -1; | 79 | int report_id = -1; |
80 | u32 address; | 80 | u32 address; |
81 | int ret; | ||
82 | int ret_type; | 81 | int ret_type; |
83 | s32 poll_value; | 82 | s32 poll_value; |
84 | 83 | ||
@@ -128,14 +127,12 @@ static int press_read_raw(struct iio_dev *indio_dev, | |||
128 | ret_type = IIO_VAL_INT; | 127 | ret_type = IIO_VAL_INT; |
129 | break; | 128 | break; |
130 | case IIO_CHAN_INFO_SAMP_FREQ: | 129 | case IIO_CHAN_INFO_SAMP_FREQ: |
131 | ret = hid_sensor_read_samp_freq_value( | 130 | ret_type = hid_sensor_read_samp_freq_value( |
132 | &press_state->common_attributes, val, val2); | 131 | &press_state->common_attributes, val, val2); |
133 | ret_type = IIO_VAL_INT_PLUS_MICRO; | ||
134 | break; | 132 | break; |
135 | case IIO_CHAN_INFO_HYSTERESIS: | 133 | case IIO_CHAN_INFO_HYSTERESIS: |
136 | ret = hid_sensor_read_raw_hyst_value( | 134 | ret_type = hid_sensor_read_raw_hyst_value( |
137 | &press_state->common_attributes, val, val2); | 135 | &press_state->common_attributes, val, val2); |
138 | ret_type = IIO_VAL_INT_PLUS_MICRO; | ||
139 | break; | 136 | break; |
140 | default: | 137 | default: |
141 | ret_type = -EINVAL; | 138 | ret_type = -EINVAL; |
diff --git a/drivers/iio/pressure/mpl3115.c b/drivers/iio/pressure/mpl3115.c index ba6d0c520e63..01b2e0b18878 100644 --- a/drivers/iio/pressure/mpl3115.c +++ b/drivers/iio/pressure/mpl3115.c | |||
@@ -98,7 +98,7 @@ static int mpl3115_read_raw(struct iio_dev *indio_dev, | |||
98 | mutex_unlock(&data->lock); | 98 | mutex_unlock(&data->lock); |
99 | if (ret < 0) | 99 | if (ret < 0) |
100 | return ret; | 100 | return ret; |
101 | *val = sign_extend32(be32_to_cpu(tmp) >> 12, 23); | 101 | *val = be32_to_cpu(tmp) >> 12; |
102 | return IIO_VAL_INT; | 102 | return IIO_VAL_INT; |
103 | case IIO_TEMP: /* in 0.0625 celsius / LSB */ | 103 | case IIO_TEMP: /* in 0.0625 celsius / LSB */ |
104 | mutex_lock(&data->lock); | 104 | mutex_lock(&data->lock); |
@@ -112,7 +112,7 @@ static int mpl3115_read_raw(struct iio_dev *indio_dev, | |||
112 | mutex_unlock(&data->lock); | 112 | mutex_unlock(&data->lock); |
113 | if (ret < 0) | 113 | if (ret < 0) |
114 | return ret; | 114 | return ret; |
115 | *val = sign_extend32(be32_to_cpu(tmp) >> 20, 15); | 115 | *val = sign_extend32(be32_to_cpu(tmp) >> 20, 11); |
116 | return IIO_VAL_INT; | 116 | return IIO_VAL_INT; |
117 | default: | 117 | default: |
118 | return -EINVAL; | 118 | return -EINVAL; |
@@ -185,7 +185,7 @@ static const struct iio_chan_spec mpl3115_channels[] = { | |||
185 | BIT(IIO_CHAN_INFO_SCALE), | 185 | BIT(IIO_CHAN_INFO_SCALE), |
186 | .scan_index = 0, | 186 | .scan_index = 0, |
187 | .scan_type = { | 187 | .scan_type = { |
188 | .sign = 's', | 188 | .sign = 'u', |
189 | .realbits = 20, | 189 | .realbits = 20, |
190 | .storagebits = 32, | 190 | .storagebits = 32, |
191 | .shift = 12, | 191 | .shift = 12, |
diff --git a/drivers/iommu/amd_iommu_v2.c b/drivers/iommu/amd_iommu_v2.c index d4daa05efe60..499b4366a98d 100644 --- a/drivers/iommu/amd_iommu_v2.c +++ b/drivers/iommu/amd_iommu_v2.c | |||
@@ -45,7 +45,7 @@ struct pri_queue { | |||
45 | struct pasid_state { | 45 | struct pasid_state { |
46 | struct list_head list; /* For global state-list */ | 46 | struct list_head list; /* For global state-list */ |
47 | atomic_t count; /* Reference count */ | 47 | atomic_t count; /* Reference count */ |
48 | atomic_t mmu_notifier_count; /* Counting nested mmu_notifier | 48 | unsigned mmu_notifier_count; /* Counting nested mmu_notifier |
49 | calls */ | 49 | calls */ |
50 | struct task_struct *task; /* Task bound to this PASID */ | 50 | struct task_struct *task; /* Task bound to this PASID */ |
51 | struct mm_struct *mm; /* mm_struct for the faults */ | 51 | struct mm_struct *mm; /* mm_struct for the faults */ |
@@ -53,7 +53,8 @@ struct pasid_state { | |||
53 | struct pri_queue pri[PRI_QUEUE_SIZE]; /* PRI tag states */ | 53 | struct pri_queue pri[PRI_QUEUE_SIZE]; /* PRI tag states */ |
54 | struct device_state *device_state; /* Link to our device_state */ | 54 | struct device_state *device_state; /* Link to our device_state */ |
55 | int pasid; /* PASID index */ | 55 | int pasid; /* PASID index */ |
56 | spinlock_t lock; /* Protect pri_queues */ | 56 | spinlock_t lock; /* Protect pri_queues and |
57 | mmu_notifer_count */ | ||
57 | wait_queue_head_t wq; /* To wait for count == 0 */ | 58 | wait_queue_head_t wq; /* To wait for count == 0 */ |
58 | }; | 59 | }; |
59 | 60 | ||
@@ -431,15 +432,19 @@ static void mn_invalidate_range_start(struct mmu_notifier *mn, | |||
431 | { | 432 | { |
432 | struct pasid_state *pasid_state; | 433 | struct pasid_state *pasid_state; |
433 | struct device_state *dev_state; | 434 | struct device_state *dev_state; |
435 | unsigned long flags; | ||
434 | 436 | ||
435 | pasid_state = mn_to_state(mn); | 437 | pasid_state = mn_to_state(mn); |
436 | dev_state = pasid_state->device_state; | 438 | dev_state = pasid_state->device_state; |
437 | 439 | ||
438 | if (atomic_add_return(1, &pasid_state->mmu_notifier_count) == 1) { | 440 | spin_lock_irqsave(&pasid_state->lock, flags); |
441 | if (pasid_state->mmu_notifier_count == 0) { | ||
439 | amd_iommu_domain_set_gcr3(dev_state->domain, | 442 | amd_iommu_domain_set_gcr3(dev_state->domain, |
440 | pasid_state->pasid, | 443 | pasid_state->pasid, |
441 | __pa(empty_page_table)); | 444 | __pa(empty_page_table)); |
442 | } | 445 | } |
446 | pasid_state->mmu_notifier_count += 1; | ||
447 | spin_unlock_irqrestore(&pasid_state->lock, flags); | ||
443 | } | 448 | } |
444 | 449 | ||
445 | static void mn_invalidate_range_end(struct mmu_notifier *mn, | 450 | static void mn_invalidate_range_end(struct mmu_notifier *mn, |
@@ -448,15 +453,19 @@ static void mn_invalidate_range_end(struct mmu_notifier *mn, | |||
448 | { | 453 | { |
449 | struct pasid_state *pasid_state; | 454 | struct pasid_state *pasid_state; |
450 | struct device_state *dev_state; | 455 | struct device_state *dev_state; |
456 | unsigned long flags; | ||
451 | 457 | ||
452 | pasid_state = mn_to_state(mn); | 458 | pasid_state = mn_to_state(mn); |
453 | dev_state = pasid_state->device_state; | 459 | dev_state = pasid_state->device_state; |
454 | 460 | ||
455 | if (atomic_dec_and_test(&pasid_state->mmu_notifier_count)) { | 461 | spin_lock_irqsave(&pasid_state->lock, flags); |
462 | pasid_state->mmu_notifier_count -= 1; | ||
463 | if (pasid_state->mmu_notifier_count == 0) { | ||
456 | amd_iommu_domain_set_gcr3(dev_state->domain, | 464 | amd_iommu_domain_set_gcr3(dev_state->domain, |
457 | pasid_state->pasid, | 465 | pasid_state->pasid, |
458 | __pa(pasid_state->mm->pgd)); | 466 | __pa(pasid_state->mm->pgd)); |
459 | } | 467 | } |
468 | spin_unlock_irqrestore(&pasid_state->lock, flags); | ||
460 | } | 469 | } |
461 | 470 | ||
462 | static void mn_release(struct mmu_notifier *mn, struct mm_struct *mm) | 471 | static void mn_release(struct mmu_notifier *mn, struct mm_struct *mm) |
@@ -650,7 +659,6 @@ int amd_iommu_bind_pasid(struct pci_dev *pdev, int pasid, | |||
650 | goto out; | 659 | goto out; |
651 | 660 | ||
652 | atomic_set(&pasid_state->count, 1); | 661 | atomic_set(&pasid_state->count, 1); |
653 | atomic_set(&pasid_state->mmu_notifier_count, 0); | ||
654 | init_waitqueue_head(&pasid_state->wq); | 662 | init_waitqueue_head(&pasid_state->wq); |
655 | spin_lock_init(&pasid_state->lock); | 663 | spin_lock_init(&pasid_state->lock); |
656 | 664 | ||
diff --git a/drivers/iommu/intel-iommu.c b/drivers/iommu/intel-iommu.c index 6bb32773c3ac..51b6b77dc3e5 100644 --- a/drivers/iommu/intel-iommu.c +++ b/drivers/iommu/intel-iommu.c | |||
@@ -3816,14 +3816,11 @@ int dmar_iommu_notify_scope_dev(struct dmar_pci_notify_info *info) | |||
3816 | ((void *)rmrr) + rmrr->header.length, | 3816 | ((void *)rmrr) + rmrr->header.length, |
3817 | rmrr->segment, rmrru->devices, | 3817 | rmrr->segment, rmrru->devices, |
3818 | rmrru->devices_cnt); | 3818 | rmrru->devices_cnt); |
3819 | if (ret > 0) | 3819 | if(ret < 0) |
3820 | break; | ||
3821 | else if(ret < 0) | ||
3822 | return ret; | 3820 | return ret; |
3823 | } else if (info->event == BUS_NOTIFY_DEL_DEVICE) { | 3821 | } else if (info->event == BUS_NOTIFY_DEL_DEVICE) { |
3824 | if (dmar_remove_dev_scope(info, rmrr->segment, | 3822 | dmar_remove_dev_scope(info, rmrr->segment, |
3825 | rmrru->devices, rmrru->devices_cnt)) | 3823 | rmrru->devices, rmrru->devices_cnt); |
3826 | break; | ||
3827 | } | 3824 | } |
3828 | } | 3825 | } |
3829 | 3826 | ||
diff --git a/drivers/irqchip/irq-armada-370-xp.c b/drivers/irqchip/irq-armada-370-xp.c index c887e6eebc41..574aba0eba4e 100644 --- a/drivers/irqchip/irq-armada-370-xp.c +++ b/drivers/irqchip/irq-armada-370-xp.c | |||
@@ -334,6 +334,15 @@ static void armada_mpic_send_doorbell(const struct cpumask *mask, | |||
334 | 334 | ||
335 | static void armada_xp_mpic_smp_cpu_init(void) | 335 | static void armada_xp_mpic_smp_cpu_init(void) |
336 | { | 336 | { |
337 | u32 control; | ||
338 | int nr_irqs, i; | ||
339 | |||
340 | control = readl(main_int_base + ARMADA_370_XP_INT_CONTROL); | ||
341 | nr_irqs = (control >> 2) & 0x3ff; | ||
342 | |||
343 | for (i = 0; i < nr_irqs; i++) | ||
344 | writel(i, per_cpu_int_base + ARMADA_370_XP_INT_SET_MASK_OFFS); | ||
345 | |||
337 | /* Clear pending IPIs */ | 346 | /* Clear pending IPIs */ |
338 | writel(0, per_cpu_int_base + ARMADA_370_XP_IN_DRBEL_CAUSE_OFFS); | 347 | writel(0, per_cpu_int_base + ARMADA_370_XP_IN_DRBEL_CAUSE_OFFS); |
339 | 348 | ||
@@ -474,7 +483,7 @@ static int __init armada_370_xp_mpic_of_init(struct device_node *node, | |||
474 | struct device_node *parent) | 483 | struct device_node *parent) |
475 | { | 484 | { |
476 | struct resource main_int_res, per_cpu_int_res; | 485 | struct resource main_int_res, per_cpu_int_res; |
477 | int parent_irq; | 486 | int parent_irq, nr_irqs, i; |
478 | u32 control; | 487 | u32 control; |
479 | 488 | ||
480 | BUG_ON(of_address_to_resource(node, 0, &main_int_res)); | 489 | BUG_ON(of_address_to_resource(node, 0, &main_int_res)); |
@@ -496,9 +505,13 @@ static int __init armada_370_xp_mpic_of_init(struct device_node *node, | |||
496 | BUG_ON(!per_cpu_int_base); | 505 | BUG_ON(!per_cpu_int_base); |
497 | 506 | ||
498 | control = readl(main_int_base + ARMADA_370_XP_INT_CONTROL); | 507 | control = readl(main_int_base + ARMADA_370_XP_INT_CONTROL); |
508 | nr_irqs = (control >> 2) & 0x3ff; | ||
509 | |||
510 | for (i = 0; i < nr_irqs; i++) | ||
511 | writel(i, main_int_base + ARMADA_370_XP_INT_CLEAR_ENABLE_OFFS); | ||
499 | 512 | ||
500 | armada_370_xp_mpic_domain = | 513 | armada_370_xp_mpic_domain = |
501 | irq_domain_add_linear(node, (control >> 2) & 0x3ff, | 514 | irq_domain_add_linear(node, nr_irqs, |
502 | &armada_370_xp_mpic_irq_ops, NULL); | 515 | &armada_370_xp_mpic_irq_ops, NULL); |
503 | 516 | ||
504 | BUG_ON(!armada_370_xp_mpic_domain); | 517 | BUG_ON(!armada_370_xp_mpic_domain); |
diff --git a/drivers/irqchip/irq-brcmstb-l2.c b/drivers/irqchip/irq-brcmstb-l2.c index 8ee2a36d5840..c15c840987d2 100644 --- a/drivers/irqchip/irq-brcmstb-l2.c +++ b/drivers/irqchip/irq-brcmstb-l2.c | |||
@@ -150,7 +150,7 @@ int __init brcmstb_l2_intc_of_init(struct device_node *np, | |||
150 | 150 | ||
151 | /* Allocate a single Generic IRQ chip for this node */ | 151 | /* Allocate a single Generic IRQ chip for this node */ |
152 | ret = irq_alloc_domain_generic_chips(data->domain, 32, 1, | 152 | ret = irq_alloc_domain_generic_chips(data->domain, 32, 1, |
153 | np->full_name, handle_level_irq, clr, 0, 0); | 153 | np->full_name, handle_edge_irq, clr, 0, 0); |
154 | if (ret) { | 154 | if (ret) { |
155 | pr_err("failed to allocate generic irq chip\n"); | 155 | pr_err("failed to allocate generic irq chip\n"); |
156 | goto out_free_domain; | 156 | goto out_free_domain; |
diff --git a/drivers/irqchip/spear-shirq.c b/drivers/irqchip/spear-shirq.c index 3fdda3a40269..6ce6bd3441bf 100644 --- a/drivers/irqchip/spear-shirq.c +++ b/drivers/irqchip/spear-shirq.c | |||
@@ -125,7 +125,7 @@ static struct spear_shirq spear320_shirq_ras2 = { | |||
125 | }; | 125 | }; |
126 | 126 | ||
127 | static struct spear_shirq spear320_shirq_ras3 = { | 127 | static struct spear_shirq spear320_shirq_ras3 = { |
128 | .irq_nr = 3, | 128 | .irq_nr = 7, |
129 | .irq_bit_off = 0, | 129 | .irq_bit_off = 0, |
130 | .invalid_irq = 1, | 130 | .invalid_irq = 1, |
131 | .regs = { | 131 | .regs = { |
diff --git a/drivers/isdn/hisax/Kconfig b/drivers/isdn/hisax/Kconfig index d9edcc94c2a8..97465ac5a2d5 100644 --- a/drivers/isdn/hisax/Kconfig +++ b/drivers/isdn/hisax/Kconfig | |||
@@ -16,7 +16,7 @@ config ISDN_DRV_HISAX | |||
16 | also to the configuration option of the driver for your particular | 16 | also to the configuration option of the driver for your particular |
17 | card, below. | 17 | card, below. |
18 | 18 | ||
19 | if ISDN_DRV_HISAX!=n | 19 | if ISDN_DRV_HISAX |
20 | 20 | ||
21 | comment "D-channel protocol features" | 21 | comment "D-channel protocol features" |
22 | 22 | ||
@@ -348,10 +348,6 @@ config HISAX_ENTERNOW_PCI | |||
348 | This enables HiSax support for the Formula-n enter:now PCI | 348 | This enables HiSax support for the Formula-n enter:now PCI |
349 | ISDN card. | 349 | ISDN card. |
350 | 350 | ||
351 | endif | ||
352 | |||
353 | if ISDN_DRV_HISAX | ||
354 | |||
355 | config HISAX_DEBUG | 351 | config HISAX_DEBUG |
356 | bool "HiSax debugging" | 352 | bool "HiSax debugging" |
357 | help | 353 | help |
@@ -420,11 +416,6 @@ config HISAX_FRITZ_PCIPNP | |||
420 | (the latter also needs you to select "ISA Plug and Play support" | 416 | (the latter also needs you to select "ISA Plug and Play support" |
421 | from the menu "Plug and Play configuration") | 417 | from the menu "Plug and Play configuration") |
422 | 418 | ||
423 | config HISAX_AVM_A1_PCMCIA | ||
424 | bool | ||
425 | depends on HISAX_AVM_A1_CS | ||
426 | default y | ||
427 | |||
428 | endif | 419 | endif |
429 | 420 | ||
430 | endmenu | 421 | endmenu |
diff --git a/drivers/macintosh/smu.c b/drivers/macintosh/smu.c index 23b4a3b28dbc..4eab93aa570b 100644 --- a/drivers/macintosh/smu.c +++ b/drivers/macintosh/smu.c | |||
@@ -1257,7 +1257,8 @@ static unsigned int smu_fpoll(struct file *file, poll_table *wait) | |||
1257 | if (pp->busy && pp->cmd.status != 1) | 1257 | if (pp->busy && pp->cmd.status != 1) |
1258 | mask |= POLLIN; | 1258 | mask |= POLLIN; |
1259 | spin_unlock_irqrestore(&pp->lock, flags); | 1259 | spin_unlock_irqrestore(&pp->lock, flags); |
1260 | } if (pp->mode == smu_file_events) { | 1260 | } |
1261 | if (pp->mode == smu_file_events) { | ||
1261 | /* Not yet implemented */ | 1262 | /* Not yet implemented */ |
1262 | } | 1263 | } |
1263 | return mask; | 1264 | return mask; |
diff --git a/drivers/md/dm-crypt.c b/drivers/md/dm-crypt.c index 53b213226c01..4cba2d808afb 100644 --- a/drivers/md/dm-crypt.c +++ b/drivers/md/dm-crypt.c | |||
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | * Copyright (C) 2003 Christophe Saout <christophe@saout.de> | 2 | * Copyright (C) 2003 Jana Saout <jana@saout.de> |
3 | * Copyright (C) 2004 Clemens Fruhwirth <clemens@endorphin.org> | 3 | * Copyright (C) 2004 Clemens Fruhwirth <clemens@endorphin.org> |
4 | * Copyright (C) 2006-2009 Red Hat, Inc. All rights reserved. | 4 | * Copyright (C) 2006-2009 Red Hat, Inc. All rights reserved. |
5 | * Copyright (C) 2013 Milan Broz <gmazyland@gmail.com> | 5 | * Copyright (C) 2013 Milan Broz <gmazyland@gmail.com> |
@@ -1996,6 +1996,6 @@ static void __exit dm_crypt_exit(void) | |||
1996 | module_init(dm_crypt_init); | 1996 | module_init(dm_crypt_init); |
1997 | module_exit(dm_crypt_exit); | 1997 | module_exit(dm_crypt_exit); |
1998 | 1998 | ||
1999 | MODULE_AUTHOR("Christophe Saout <christophe@saout.de>"); | 1999 | MODULE_AUTHOR("Jana Saout <jana@saout.de>"); |
2000 | MODULE_DESCRIPTION(DM_NAME " target for transparent encryption / decryption"); | 2000 | MODULE_DESCRIPTION(DM_NAME " target for transparent encryption / decryption"); |
2001 | MODULE_LICENSE("GPL"); | 2001 | MODULE_LICENSE("GPL"); |
diff --git a/drivers/md/dm-io.c b/drivers/md/dm-io.c index 3842ac738f98..db404a0f7e2c 100644 --- a/drivers/md/dm-io.c +++ b/drivers/md/dm-io.c | |||
@@ -10,6 +10,7 @@ | |||
10 | #include <linux/device-mapper.h> | 10 | #include <linux/device-mapper.h> |
11 | 11 | ||
12 | #include <linux/bio.h> | 12 | #include <linux/bio.h> |
13 | #include <linux/completion.h> | ||
13 | #include <linux/mempool.h> | 14 | #include <linux/mempool.h> |
14 | #include <linux/module.h> | 15 | #include <linux/module.h> |
15 | #include <linux/sched.h> | 16 | #include <linux/sched.h> |
@@ -32,7 +33,7 @@ struct dm_io_client { | |||
32 | struct io { | 33 | struct io { |
33 | unsigned long error_bits; | 34 | unsigned long error_bits; |
34 | atomic_t count; | 35 | atomic_t count; |
35 | struct task_struct *sleeper; | 36 | struct completion *wait; |
36 | struct dm_io_client *client; | 37 | struct dm_io_client *client; |
37 | io_notify_fn callback; | 38 | io_notify_fn callback; |
38 | void *context; | 39 | void *context; |
@@ -121,8 +122,8 @@ static void dec_count(struct io *io, unsigned int region, int error) | |||
121 | invalidate_kernel_vmap_range(io->vma_invalidate_address, | 122 | invalidate_kernel_vmap_range(io->vma_invalidate_address, |
122 | io->vma_invalidate_size); | 123 | io->vma_invalidate_size); |
123 | 124 | ||
124 | if (io->sleeper) | 125 | if (io->wait) |
125 | wake_up_process(io->sleeper); | 126 | complete(io->wait); |
126 | 127 | ||
127 | else { | 128 | else { |
128 | unsigned long r = io->error_bits; | 129 | unsigned long r = io->error_bits; |
@@ -387,6 +388,7 @@ static int sync_io(struct dm_io_client *client, unsigned int num_regions, | |||
387 | */ | 388 | */ |
388 | volatile char io_[sizeof(struct io) + __alignof__(struct io) - 1]; | 389 | volatile char io_[sizeof(struct io) + __alignof__(struct io) - 1]; |
389 | struct io *io = (struct io *)PTR_ALIGN(&io_, __alignof__(struct io)); | 390 | struct io *io = (struct io *)PTR_ALIGN(&io_, __alignof__(struct io)); |
391 | DECLARE_COMPLETION_ONSTACK(wait); | ||
390 | 392 | ||
391 | if (num_regions > 1 && (rw & RW_MASK) != WRITE) { | 393 | if (num_regions > 1 && (rw & RW_MASK) != WRITE) { |
392 | WARN_ON(1); | 394 | WARN_ON(1); |
@@ -395,7 +397,7 @@ static int sync_io(struct dm_io_client *client, unsigned int num_regions, | |||
395 | 397 | ||
396 | io->error_bits = 0; | 398 | io->error_bits = 0; |
397 | atomic_set(&io->count, 1); /* see dispatch_io() */ | 399 | atomic_set(&io->count, 1); /* see dispatch_io() */ |
398 | io->sleeper = current; | 400 | io->wait = &wait; |
399 | io->client = client; | 401 | io->client = client; |
400 | 402 | ||
401 | io->vma_invalidate_address = dp->vma_invalidate_address; | 403 | io->vma_invalidate_address = dp->vma_invalidate_address; |
@@ -403,15 +405,7 @@ static int sync_io(struct dm_io_client *client, unsigned int num_regions, | |||
403 | 405 | ||
404 | dispatch_io(rw, num_regions, where, dp, io, 1); | 406 | dispatch_io(rw, num_regions, where, dp, io, 1); |
405 | 407 | ||
406 | while (1) { | 408 | wait_for_completion_io(&wait); |
407 | set_current_state(TASK_UNINTERRUPTIBLE); | ||
408 | |||
409 | if (!atomic_read(&io->count)) | ||
410 | break; | ||
411 | |||
412 | io_schedule(); | ||
413 | } | ||
414 | set_current_state(TASK_RUNNING); | ||
415 | 409 | ||
416 | if (error_bits) | 410 | if (error_bits) |
417 | *error_bits = io->error_bits; | 411 | *error_bits = io->error_bits; |
@@ -434,7 +428,7 @@ static int async_io(struct dm_io_client *client, unsigned int num_regions, | |||
434 | io = mempool_alloc(client->pool, GFP_NOIO); | 428 | io = mempool_alloc(client->pool, GFP_NOIO); |
435 | io->error_bits = 0; | 429 | io->error_bits = 0; |
436 | atomic_set(&io->count, 1); /* see dispatch_io() */ | 430 | atomic_set(&io->count, 1); /* see dispatch_io() */ |
437 | io->sleeper = NULL; | 431 | io->wait = NULL; |
438 | io->client = client; | 432 | io->client = client; |
439 | io->callback = fn; | 433 | io->callback = fn; |
440 | io->context = context; | 434 | io->context = context; |
diff --git a/drivers/md/dm-mpath.c b/drivers/md/dm-mpath.c index 3f6fd9d33ba3..f4167b013d99 100644 --- a/drivers/md/dm-mpath.c +++ b/drivers/md/dm-mpath.c | |||
@@ -1611,8 +1611,9 @@ static int multipath_busy(struct dm_target *ti) | |||
1611 | 1611 | ||
1612 | spin_lock_irqsave(&m->lock, flags); | 1612 | spin_lock_irqsave(&m->lock, flags); |
1613 | 1613 | ||
1614 | /* pg_init in progress, requeue until done */ | 1614 | /* pg_init in progress or no paths available */ |
1615 | if (!pg_ready(m)) { | 1615 | if (m->pg_init_in_progress || |
1616 | (!m->nr_valid_paths && m->queue_if_no_path)) { | ||
1616 | busy = 1; | 1617 | busy = 1; |
1617 | goto out; | 1618 | goto out; |
1618 | } | 1619 | } |
diff --git a/drivers/md/dm-zero.c b/drivers/md/dm-zero.c index c99003e0d47a..b9a64bbce304 100644 --- a/drivers/md/dm-zero.c +++ b/drivers/md/dm-zero.c | |||
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | * Copyright (C) 2003 Christophe Saout <christophe@saout.de> | 2 | * Copyright (C) 2003 Jana Saout <jana@saout.de> |
3 | * | 3 | * |
4 | * This file is released under the GPL. | 4 | * This file is released under the GPL. |
5 | */ | 5 | */ |
@@ -79,6 +79,6 @@ static void __exit dm_zero_exit(void) | |||
79 | module_init(dm_zero_init) | 79 | module_init(dm_zero_init) |
80 | module_exit(dm_zero_exit) | 80 | module_exit(dm_zero_exit) |
81 | 81 | ||
82 | MODULE_AUTHOR("Christophe Saout <christophe@saout.de>"); | 82 | MODULE_AUTHOR("Jana Saout <jana@saout.de>"); |
83 | MODULE_DESCRIPTION(DM_NAME " dummy target returning zeros"); | 83 | MODULE_DESCRIPTION(DM_NAME " dummy target returning zeros"); |
84 | MODULE_LICENSE("GPL"); | 84 | MODULE_LICENSE("GPL"); |
diff --git a/drivers/md/dm.c b/drivers/md/dm.c index 437d99045ef2..32b958dbc499 100644 --- a/drivers/md/dm.c +++ b/drivers/md/dm.c | |||
@@ -54,6 +54,8 @@ static void do_deferred_remove(struct work_struct *w); | |||
54 | 54 | ||
55 | static DECLARE_WORK(deferred_remove_work, do_deferred_remove); | 55 | static DECLARE_WORK(deferred_remove_work, do_deferred_remove); |
56 | 56 | ||
57 | static struct workqueue_struct *deferred_remove_workqueue; | ||
58 | |||
57 | /* | 59 | /* |
58 | * For bio-based dm. | 60 | * For bio-based dm. |
59 | * One of these is allocated per bio. | 61 | * One of these is allocated per bio. |
@@ -276,16 +278,24 @@ static int __init local_init(void) | |||
276 | if (r) | 278 | if (r) |
277 | goto out_free_rq_tio_cache; | 279 | goto out_free_rq_tio_cache; |
278 | 280 | ||
281 | deferred_remove_workqueue = alloc_workqueue("kdmremove", WQ_UNBOUND, 1); | ||
282 | if (!deferred_remove_workqueue) { | ||
283 | r = -ENOMEM; | ||
284 | goto out_uevent_exit; | ||
285 | } | ||
286 | |||
279 | _major = major; | 287 | _major = major; |
280 | r = register_blkdev(_major, _name); | 288 | r = register_blkdev(_major, _name); |
281 | if (r < 0) | 289 | if (r < 0) |
282 | goto out_uevent_exit; | 290 | goto out_free_workqueue; |
283 | 291 | ||
284 | if (!_major) | 292 | if (!_major) |
285 | _major = r; | 293 | _major = r; |
286 | 294 | ||
287 | return 0; | 295 | return 0; |
288 | 296 | ||
297 | out_free_workqueue: | ||
298 | destroy_workqueue(deferred_remove_workqueue); | ||
289 | out_uevent_exit: | 299 | out_uevent_exit: |
290 | dm_uevent_exit(); | 300 | dm_uevent_exit(); |
291 | out_free_rq_tio_cache: | 301 | out_free_rq_tio_cache: |
@@ -299,6 +309,7 @@ out_free_io_cache: | |||
299 | static void local_exit(void) | 309 | static void local_exit(void) |
300 | { | 310 | { |
301 | flush_scheduled_work(); | 311 | flush_scheduled_work(); |
312 | destroy_workqueue(deferred_remove_workqueue); | ||
302 | 313 | ||
303 | kmem_cache_destroy(_rq_tio_cache); | 314 | kmem_cache_destroy(_rq_tio_cache); |
304 | kmem_cache_destroy(_io_cache); | 315 | kmem_cache_destroy(_io_cache); |
@@ -407,7 +418,7 @@ static void dm_blk_close(struct gendisk *disk, fmode_t mode) | |||
407 | 418 | ||
408 | if (atomic_dec_and_test(&md->open_count) && | 419 | if (atomic_dec_and_test(&md->open_count) && |
409 | (test_bit(DMF_DEFERRED_REMOVE, &md->flags))) | 420 | (test_bit(DMF_DEFERRED_REMOVE, &md->flags))) |
410 | schedule_work(&deferred_remove_work); | 421 | queue_work(deferred_remove_workqueue, &deferred_remove_work); |
411 | 422 | ||
412 | dm_put(md); | 423 | dm_put(md); |
413 | 424 | ||
diff --git a/drivers/md/md.c b/drivers/md/md.c index 34846856dbc6..32fc19c540d4 100644 --- a/drivers/md/md.c +++ b/drivers/md/md.c | |||
@@ -5599,7 +5599,7 @@ static int get_array_info(struct mddev * mddev, void __user * arg) | |||
5599 | if (mddev->in_sync) | 5599 | if (mddev->in_sync) |
5600 | info.state = (1<<MD_SB_CLEAN); | 5600 | info.state = (1<<MD_SB_CLEAN); |
5601 | if (mddev->bitmap && mddev->bitmap_info.offset) | 5601 | if (mddev->bitmap && mddev->bitmap_info.offset) |
5602 | info.state = (1<<MD_SB_BITMAP_PRESENT); | 5602 | info.state |= (1<<MD_SB_BITMAP_PRESENT); |
5603 | info.active_disks = insync; | 5603 | info.active_disks = insync; |
5604 | info.working_disks = working; | 5604 | info.working_disks = working; |
5605 | info.failed_disks = failed; | 5605 | info.failed_disks = failed; |
@@ -7501,6 +7501,19 @@ void md_do_sync(struct md_thread *thread) | |||
7501 | rdev->recovery_offset < j) | 7501 | rdev->recovery_offset < j) |
7502 | j = rdev->recovery_offset; | 7502 | j = rdev->recovery_offset; |
7503 | rcu_read_unlock(); | 7503 | rcu_read_unlock(); |
7504 | |||
7505 | /* If there is a bitmap, we need to make sure all | ||
7506 | * writes that started before we added a spare | ||
7507 | * complete before we start doing a recovery. | ||
7508 | * Otherwise the write might complete and (via | ||
7509 | * bitmap_endwrite) set a bit in the bitmap after the | ||
7510 | * recovery has checked that bit and skipped that | ||
7511 | * region. | ||
7512 | */ | ||
7513 | if (mddev->bitmap) { | ||
7514 | mddev->pers->quiesce(mddev, 1); | ||
7515 | mddev->pers->quiesce(mddev, 0); | ||
7516 | } | ||
7504 | } | 7517 | } |
7505 | 7518 | ||
7506 | printk(KERN_INFO "md: %s of RAID array %s\n", desc, mdname(mddev)); | 7519 | printk(KERN_INFO "md: %s of RAID array %s\n", desc, mdname(mddev)); |
diff --git a/drivers/memstick/host/rtsx_pci_ms.c b/drivers/memstick/host/rtsx_pci_ms.c index 2a635b6fdaf7..c880ba685754 100644 --- a/drivers/memstick/host/rtsx_pci_ms.c +++ b/drivers/memstick/host/rtsx_pci_ms.c | |||
@@ -601,6 +601,7 @@ static int rtsx_pci_ms_drv_remove(struct platform_device *pdev) | |||
601 | pcr->slots[RTSX_MS_CARD].card_event = NULL; | 601 | pcr->slots[RTSX_MS_CARD].card_event = NULL; |
602 | msh = host->msh; | 602 | msh = host->msh; |
603 | host->eject = true; | 603 | host->eject = true; |
604 | cancel_work_sync(&host->handle_req); | ||
604 | 605 | ||
605 | mutex_lock(&host->host_mutex); | 606 | mutex_lock(&host->host_mutex); |
606 | if (host->req) { | 607 | if (host->req) { |
diff --git a/drivers/mfd/Kconfig b/drivers/mfd/Kconfig index ee8204cc31e9..6cc4b6acc22a 100644 --- a/drivers/mfd/Kconfig +++ b/drivers/mfd/Kconfig | |||
@@ -760,6 +760,7 @@ config MFD_SYSCON | |||
760 | config MFD_DAVINCI_VOICECODEC | 760 | config MFD_DAVINCI_VOICECODEC |
761 | tristate | 761 | tristate |
762 | select MFD_CORE | 762 | select MFD_CORE |
763 | select REGMAP_MMIO | ||
763 | 764 | ||
764 | config MFD_TI_AM335X_TSCADC | 765 | config MFD_TI_AM335X_TSCADC |
765 | tristate "TI ADC / Touch Screen chip support" | 766 | tristate "TI ADC / Touch Screen chip support" |
@@ -1225,7 +1226,7 @@ config MFD_WM8994 | |||
1225 | functionaltiy of the device other drivers must be enabled. | 1226 | functionaltiy of the device other drivers must be enabled. |
1226 | 1227 | ||
1227 | config MFD_STW481X | 1228 | config MFD_STW481X |
1228 | bool "Support for ST Microelectronics STw481x" | 1229 | tristate "Support for ST Microelectronics STw481x" |
1229 | depends on I2C && ARCH_NOMADIK | 1230 | depends on I2C && ARCH_NOMADIK |
1230 | select REGMAP_I2C | 1231 | select REGMAP_I2C |
1231 | select MFD_CORE | 1232 | select MFD_CORE |
@@ -1248,7 +1249,7 @@ config MCP_SA11X0 | |||
1248 | 1249 | ||
1249 | # Chip drivers | 1250 | # Chip drivers |
1250 | config MCP_UCB1200 | 1251 | config MCP_UCB1200 |
1251 | bool "Support for UCB1200 / UCB1300" | 1252 | tristate "Support for UCB1200 / UCB1300" |
1252 | depends on MCP_SA11X0 | 1253 | depends on MCP_SA11X0 |
1253 | select MCP | 1254 | select MCP |
1254 | 1255 | ||
diff --git a/drivers/mfd/ab8500-core.c b/drivers/mfd/ab8500-core.c index a8ee4a36a1d8..cf2e6a198c6b 100644 --- a/drivers/mfd/ab8500-core.c +++ b/drivers/mfd/ab8500-core.c | |||
@@ -591,7 +591,7 @@ static int ab8500_irq_init(struct ab8500 *ab8500, struct device_node *np) | |||
591 | num_irqs = AB8500_NR_IRQS; | 591 | num_irqs = AB8500_NR_IRQS; |
592 | 592 | ||
593 | /* If ->irq_base is zero this will give a linear mapping */ | 593 | /* If ->irq_base is zero this will give a linear mapping */ |
594 | ab8500->domain = irq_domain_add_simple(NULL, | 594 | ab8500->domain = irq_domain_add_simple(ab8500->dev->of_node, |
595 | num_irqs, 0, | 595 | num_irqs, 0, |
596 | &ab8500_irq_ops, ab8500); | 596 | &ab8500_irq_ops, ab8500); |
597 | 597 | ||
diff --git a/drivers/misc/Kconfig b/drivers/misc/Kconfig index a43d0c467274..ee9402324a23 100644 --- a/drivers/misc/Kconfig +++ b/drivers/misc/Kconfig | |||
@@ -54,7 +54,7 @@ config AD525X_DPOT_SPI | |||
54 | config ATMEL_PWM | 54 | config ATMEL_PWM |
55 | tristate "Atmel AT32/AT91 PWM support" | 55 | tristate "Atmel AT32/AT91 PWM support" |
56 | depends on HAVE_CLK | 56 | depends on HAVE_CLK |
57 | depends on AVR32 || AT91SAM9263 || AT91SAM9RL || AT91SAM9G45 | 57 | depends on AVR32 || ARCH_AT91SAM9263 || ARCH_AT91SAM9RL || ARCH_AT91SAM9G45 |
58 | help | 58 | help |
59 | This option enables device driver support for the PWM channels | 59 | This option enables device driver support for the PWM channels |
60 | on certain Atmel processors. Pulse Width Modulation is used for | 60 | on certain Atmel processors. Pulse Width Modulation is used for |
diff --git a/drivers/misc/vexpress-syscfg.c b/drivers/misc/vexpress-syscfg.c index 73068e50e56d..3250fc1df0aa 100644 --- a/drivers/misc/vexpress-syscfg.c +++ b/drivers/misc/vexpress-syscfg.c | |||
@@ -199,7 +199,7 @@ static struct regmap *vexpress_syscfg_regmap_init(struct device *dev, | |||
199 | func = kzalloc(sizeof(*func) + sizeof(*func->template) * num, | 199 | func = kzalloc(sizeof(*func) + sizeof(*func->template) * num, |
200 | GFP_KERNEL); | 200 | GFP_KERNEL); |
201 | if (!func) | 201 | if (!func) |
202 | return NULL; | 202 | return ERR_PTR(-ENOMEM); |
203 | 203 | ||
204 | func->syscfg = syscfg; | 204 | func->syscfg = syscfg; |
205 | func->num_templates = num; | 205 | func->num_templates = num; |
@@ -231,10 +231,14 @@ static struct regmap *vexpress_syscfg_regmap_init(struct device *dev, | |||
231 | func->regmap = regmap_init(dev, NULL, func, | 231 | func->regmap = regmap_init(dev, NULL, func, |
232 | &vexpress_syscfg_regmap_config); | 232 | &vexpress_syscfg_regmap_config); |
233 | 233 | ||
234 | if (IS_ERR(func->regmap)) | 234 | if (IS_ERR(func->regmap)) { |
235 | void *err = func->regmap; | ||
236 | |||
235 | kfree(func); | 237 | kfree(func); |
236 | else | 238 | return err; |
237 | list_add(&func->list, &syscfg->funcs); | 239 | } |
240 | |||
241 | list_add(&func->list, &syscfg->funcs); | ||
238 | 242 | ||
239 | return func->regmap; | 243 | return func->regmap; |
240 | } | 244 | } |
diff --git a/drivers/misc/vmw_balloon.c b/drivers/misc/vmw_balloon.c index 2421835d5daf..191617492181 100644 --- a/drivers/misc/vmw_balloon.c +++ b/drivers/misc/vmw_balloon.c | |||
@@ -17,7 +17,8 @@ | |||
17 | * along with this program; if not, write to the Free Software | 17 | * along with this program; if not, write to the Free Software |
18 | * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. | 18 | * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
19 | * | 19 | * |
20 | * Maintained by: Dmitry Torokhov <dtor@vmware.com> | 20 | * Maintained by: Xavier Deguillard <xdeguillard@vmware.com> |
21 | * Philip Moltmann <moltmann@vmware.com> | ||
21 | */ | 22 | */ |
22 | 23 | ||
23 | /* | 24 | /* |
diff --git a/drivers/net/bonding/bond_main.c b/drivers/net/bonding/bond_main.c index 04f35f960cb8..3a451b6cd3d5 100644 --- a/drivers/net/bonding/bond_main.c +++ b/drivers/net/bonding/bond_main.c | |||
@@ -1025,10 +1025,14 @@ static netdev_features_t bond_fix_features(struct net_device *dev, | |||
1025 | NETIF_F_FRAGLIST | NETIF_F_ALL_TSO | \ | 1025 | NETIF_F_FRAGLIST | NETIF_F_ALL_TSO | \ |
1026 | NETIF_F_HIGHDMA | NETIF_F_LRO) | 1026 | NETIF_F_HIGHDMA | NETIF_F_LRO) |
1027 | 1027 | ||
1028 | #define BOND_ENC_FEATURES (NETIF_F_ALL_CSUM | NETIF_F_SG | NETIF_F_RXCSUM |\ | ||
1029 | NETIF_F_TSO | NETIF_F_GSO_UDP_TUNNEL) | ||
1030 | |||
1028 | static void bond_compute_features(struct bonding *bond) | 1031 | static void bond_compute_features(struct bonding *bond) |
1029 | { | 1032 | { |
1030 | unsigned int flags, dst_release_flag = IFF_XMIT_DST_RELEASE; | 1033 | unsigned int flags, dst_release_flag = IFF_XMIT_DST_RELEASE; |
1031 | netdev_features_t vlan_features = BOND_VLAN_FEATURES; | 1034 | netdev_features_t vlan_features = BOND_VLAN_FEATURES; |
1035 | netdev_features_t enc_features = BOND_ENC_FEATURES; | ||
1032 | struct net_device *bond_dev = bond->dev; | 1036 | struct net_device *bond_dev = bond->dev; |
1033 | struct list_head *iter; | 1037 | struct list_head *iter; |
1034 | struct slave *slave; | 1038 | struct slave *slave; |
@@ -1044,6 +1048,9 @@ static void bond_compute_features(struct bonding *bond) | |||
1044 | vlan_features = netdev_increment_features(vlan_features, | 1048 | vlan_features = netdev_increment_features(vlan_features, |
1045 | slave->dev->vlan_features, BOND_VLAN_FEATURES); | 1049 | slave->dev->vlan_features, BOND_VLAN_FEATURES); |
1046 | 1050 | ||
1051 | enc_features = netdev_increment_features(enc_features, | ||
1052 | slave->dev->hw_enc_features, | ||
1053 | BOND_ENC_FEATURES); | ||
1047 | dst_release_flag &= slave->dev->priv_flags; | 1054 | dst_release_flag &= slave->dev->priv_flags; |
1048 | if (slave->dev->hard_header_len > max_hard_header_len) | 1055 | if (slave->dev->hard_header_len > max_hard_header_len) |
1049 | max_hard_header_len = slave->dev->hard_header_len; | 1056 | max_hard_header_len = slave->dev->hard_header_len; |
@@ -1054,6 +1061,7 @@ static void bond_compute_features(struct bonding *bond) | |||
1054 | 1061 | ||
1055 | done: | 1062 | done: |
1056 | bond_dev->vlan_features = vlan_features; | 1063 | bond_dev->vlan_features = vlan_features; |
1064 | bond_dev->hw_enc_features = enc_features; | ||
1057 | bond_dev->hard_header_len = max_hard_header_len; | 1065 | bond_dev->hard_header_len = max_hard_header_len; |
1058 | bond_dev->gso_max_segs = gso_max_segs; | 1066 | bond_dev->gso_max_segs = gso_max_segs; |
1059 | netif_set_gso_max_size(bond_dev, gso_max_size); | 1067 | netif_set_gso_max_size(bond_dev, gso_max_size); |
@@ -3975,6 +3983,7 @@ void bond_setup(struct net_device *bond_dev) | |||
3975 | NETIF_F_HW_VLAN_CTAG_FILTER; | 3983 | NETIF_F_HW_VLAN_CTAG_FILTER; |
3976 | 3984 | ||
3977 | bond_dev->hw_features &= ~(NETIF_F_ALL_CSUM & ~NETIF_F_HW_CSUM); | 3985 | bond_dev->hw_features &= ~(NETIF_F_ALL_CSUM & ~NETIF_F_HW_CSUM); |
3986 | bond_dev->hw_features |= NETIF_F_GSO_UDP_TUNNEL; | ||
3978 | bond_dev->features |= bond_dev->hw_features; | 3987 | bond_dev->features |= bond_dev->hw_features; |
3979 | } | 3988 | } |
3980 | 3989 | ||
diff --git a/drivers/net/can/slcan.c b/drivers/net/can/slcan.c index dcf9196f6316..ea4d4f1a6411 100644 --- a/drivers/net/can/slcan.c +++ b/drivers/net/can/slcan.c | |||
@@ -52,6 +52,7 @@ | |||
52 | #include <linux/delay.h> | 52 | #include <linux/delay.h> |
53 | #include <linux/init.h> | 53 | #include <linux/init.h> |
54 | #include <linux/kernel.h> | 54 | #include <linux/kernel.h> |
55 | #include <linux/workqueue.h> | ||
55 | #include <linux/can.h> | 56 | #include <linux/can.h> |
56 | #include <linux/can/skb.h> | 57 | #include <linux/can/skb.h> |
57 | 58 | ||
@@ -85,6 +86,7 @@ struct slcan { | |||
85 | struct tty_struct *tty; /* ptr to TTY structure */ | 86 | struct tty_struct *tty; /* ptr to TTY structure */ |
86 | struct net_device *dev; /* easy for intr handling */ | 87 | struct net_device *dev; /* easy for intr handling */ |
87 | spinlock_t lock; | 88 | spinlock_t lock; |
89 | struct work_struct tx_work; /* Flushes transmit buffer */ | ||
88 | 90 | ||
89 | /* These are pointers to the malloc()ed frame buffers. */ | 91 | /* These are pointers to the malloc()ed frame buffers. */ |
90 | unsigned char rbuff[SLC_MTU]; /* receiver buffer */ | 92 | unsigned char rbuff[SLC_MTU]; /* receiver buffer */ |
@@ -309,36 +311,46 @@ static void slc_encaps(struct slcan *sl, struct can_frame *cf) | |||
309 | sl->dev->stats.tx_bytes += cf->can_dlc; | 311 | sl->dev->stats.tx_bytes += cf->can_dlc; |
310 | } | 312 | } |
311 | 313 | ||
312 | /* | 314 | /* Write out any remaining transmit buffer. Scheduled when tty is writable */ |
313 | * Called by the driver when there's room for more data. If we have | 315 | static void slcan_transmit(struct work_struct *work) |
314 | * more packets to send, we send them here. | ||
315 | */ | ||
316 | static void slcan_write_wakeup(struct tty_struct *tty) | ||
317 | { | 316 | { |
317 | struct slcan *sl = container_of(work, struct slcan, tx_work); | ||
318 | int actual; | 318 | int actual; |
319 | struct slcan *sl = (struct slcan *) tty->disc_data; | ||
320 | 319 | ||
320 | spin_lock_bh(&sl->lock); | ||
321 | /* First make sure we're connected. */ | 321 | /* First make sure we're connected. */ |
322 | if (!sl || sl->magic != SLCAN_MAGIC || !netif_running(sl->dev)) | 322 | if (!sl->tty || sl->magic != SLCAN_MAGIC || !netif_running(sl->dev)) { |
323 | spin_unlock_bh(&sl->lock); | ||
323 | return; | 324 | return; |
325 | } | ||
324 | 326 | ||
325 | spin_lock_bh(&sl->lock); | ||
326 | if (sl->xleft <= 0) { | 327 | if (sl->xleft <= 0) { |
327 | /* Now serial buffer is almost free & we can start | 328 | /* Now serial buffer is almost free & we can start |
328 | * transmission of another packet */ | 329 | * transmission of another packet */ |
329 | sl->dev->stats.tx_packets++; | 330 | sl->dev->stats.tx_packets++; |
330 | clear_bit(TTY_DO_WRITE_WAKEUP, &tty->flags); | 331 | clear_bit(TTY_DO_WRITE_WAKEUP, &sl->tty->flags); |
331 | spin_unlock_bh(&sl->lock); | 332 | spin_unlock_bh(&sl->lock); |
332 | netif_wake_queue(sl->dev); | 333 | netif_wake_queue(sl->dev); |
333 | return; | 334 | return; |
334 | } | 335 | } |
335 | 336 | ||
336 | actual = tty->ops->write(tty, sl->xhead, sl->xleft); | 337 | actual = sl->tty->ops->write(sl->tty, sl->xhead, sl->xleft); |
337 | sl->xleft -= actual; | 338 | sl->xleft -= actual; |
338 | sl->xhead += actual; | 339 | sl->xhead += actual; |
339 | spin_unlock_bh(&sl->lock); | 340 | spin_unlock_bh(&sl->lock); |
340 | } | 341 | } |
341 | 342 | ||
343 | /* | ||
344 | * Called by the driver when there's room for more data. | ||
345 | * Schedule the transmit. | ||
346 | */ | ||
347 | static void slcan_write_wakeup(struct tty_struct *tty) | ||
348 | { | ||
349 | struct slcan *sl = tty->disc_data; | ||
350 | |||
351 | schedule_work(&sl->tx_work); | ||
352 | } | ||
353 | |||
342 | /* Send a can_frame to a TTY queue. */ | 354 | /* Send a can_frame to a TTY queue. */ |
343 | static netdev_tx_t slc_xmit(struct sk_buff *skb, struct net_device *dev) | 355 | static netdev_tx_t slc_xmit(struct sk_buff *skb, struct net_device *dev) |
344 | { | 356 | { |
@@ -528,6 +540,7 @@ static struct slcan *slc_alloc(dev_t line) | |||
528 | sl->magic = SLCAN_MAGIC; | 540 | sl->magic = SLCAN_MAGIC; |
529 | sl->dev = dev; | 541 | sl->dev = dev; |
530 | spin_lock_init(&sl->lock); | 542 | spin_lock_init(&sl->lock); |
543 | INIT_WORK(&sl->tx_work, slcan_transmit); | ||
531 | slcan_devs[i] = dev; | 544 | slcan_devs[i] = dev; |
532 | 545 | ||
533 | return sl; | 546 | return sl; |
@@ -626,8 +639,12 @@ static void slcan_close(struct tty_struct *tty) | |||
626 | if (!sl || sl->magic != SLCAN_MAGIC || sl->tty != tty) | 639 | if (!sl || sl->magic != SLCAN_MAGIC || sl->tty != tty) |
627 | return; | 640 | return; |
628 | 641 | ||
642 | spin_lock_bh(&sl->lock); | ||
629 | tty->disc_data = NULL; | 643 | tty->disc_data = NULL; |
630 | sl->tty = NULL; | 644 | sl->tty = NULL; |
645 | spin_unlock_bh(&sl->lock); | ||
646 | |||
647 | flush_work(&sl->tx_work); | ||
631 | 648 | ||
632 | /* Flush network side */ | 649 | /* Flush network side */ |
633 | unregister_netdev(sl->dev); | 650 | unregister_netdev(sl->dev); |
diff --git a/drivers/net/ethernet/allwinner/sun4i-emac.c b/drivers/net/ethernet/allwinner/sun4i-emac.c index 28460676b8ca..d81e7167a8b5 100644 --- a/drivers/net/ethernet/allwinner/sun4i-emac.c +++ b/drivers/net/ethernet/allwinner/sun4i-emac.c | |||
@@ -736,6 +736,7 @@ static int emac_open(struct net_device *dev) | |||
736 | 736 | ||
737 | ret = emac_mdio_probe(dev); | 737 | ret = emac_mdio_probe(dev); |
738 | if (ret < 0) { | 738 | if (ret < 0) { |
739 | free_irq(dev->irq, dev); | ||
739 | netdev_err(dev, "cannot probe MDIO bus\n"); | 740 | netdev_err(dev, "cannot probe MDIO bus\n"); |
740 | return ret; | 741 | return ret; |
741 | } | 742 | } |
diff --git a/drivers/net/ethernet/broadcom/tg3.c b/drivers/net/ethernet/broadcom/tg3.c index df2792d8383d..8afa579e7c40 100644 --- a/drivers/net/ethernet/broadcom/tg3.c +++ b/drivers/net/ethernet/broadcom/tg3.c | |||
@@ -3224,7 +3224,7 @@ static int tg3_nvram_read_using_eeprom(struct tg3 *tp, | |||
3224 | return 0; | 3224 | return 0; |
3225 | } | 3225 | } |
3226 | 3226 | ||
3227 | #define NVRAM_CMD_TIMEOUT 100 | 3227 | #define NVRAM_CMD_TIMEOUT 5000 |
3228 | 3228 | ||
3229 | static int tg3_nvram_exec_cmd(struct tg3 *tp, u32 nvram_cmd) | 3229 | static int tg3_nvram_exec_cmd(struct tg3 *tp, u32 nvram_cmd) |
3230 | { | 3230 | { |
@@ -3232,7 +3232,7 @@ static int tg3_nvram_exec_cmd(struct tg3 *tp, u32 nvram_cmd) | |||
3232 | 3232 | ||
3233 | tw32(NVRAM_CMD, nvram_cmd); | 3233 | tw32(NVRAM_CMD, nvram_cmd); |
3234 | for (i = 0; i < NVRAM_CMD_TIMEOUT; i++) { | 3234 | for (i = 0; i < NVRAM_CMD_TIMEOUT; i++) { |
3235 | udelay(10); | 3235 | usleep_range(10, 40); |
3236 | if (tr32(NVRAM_CMD) & NVRAM_CMD_DONE) { | 3236 | if (tr32(NVRAM_CMD) & NVRAM_CMD_DONE) { |
3237 | udelay(10); | 3237 | udelay(10); |
3238 | break; | 3238 | break; |
@@ -7854,8 +7854,8 @@ static int tg3_tso_bug(struct tg3 *tp, struct sk_buff *skb) | |||
7854 | netif_wake_queue(tp->dev); | 7854 | netif_wake_queue(tp->dev); |
7855 | } | 7855 | } |
7856 | 7856 | ||
7857 | segs = skb_gso_segment(skb, tp->dev->features & ~NETIF_F_TSO); | 7857 | segs = skb_gso_segment(skb, tp->dev->features & ~(NETIF_F_TSO | NETIF_F_TSO6)); |
7858 | if (IS_ERR(segs)) | 7858 | if (IS_ERR(segs) || !segs) |
7859 | goto tg3_tso_bug_end; | 7859 | goto tg3_tso_bug_end; |
7860 | 7860 | ||
7861 | do { | 7861 | do { |
diff --git a/drivers/net/ethernet/chelsio/cxgb4/cxgb4_main.c b/drivers/net/ethernet/chelsio/cxgb4/cxgb4_main.c index 2f8d6b910383..a83271cf17c3 100644 --- a/drivers/net/ethernet/chelsio/cxgb4/cxgb4_main.c +++ b/drivers/net/ethernet/chelsio/cxgb4/cxgb4_main.c | |||
@@ -4057,22 +4057,19 @@ int cxgb4_unregister_uld(enum cxgb4_uld type) | |||
4057 | EXPORT_SYMBOL(cxgb4_unregister_uld); | 4057 | EXPORT_SYMBOL(cxgb4_unregister_uld); |
4058 | 4058 | ||
4059 | /* Check if netdev on which event is occured belongs to us or not. Return | 4059 | /* Check if netdev on which event is occured belongs to us or not. Return |
4060 | * suceess (1) if it belongs otherwise failure (0). | 4060 | * success (true) if it belongs otherwise failure (false). |
4061 | * Called with rcu_read_lock() held. | ||
4061 | */ | 4062 | */ |
4062 | static int cxgb4_netdev(struct net_device *netdev) | 4063 | static bool cxgb4_netdev(const struct net_device *netdev) |
4063 | { | 4064 | { |
4064 | struct adapter *adap; | 4065 | struct adapter *adap; |
4065 | int i; | 4066 | int i; |
4066 | 4067 | ||
4067 | spin_lock(&adap_rcu_lock); | ||
4068 | list_for_each_entry_rcu(adap, &adap_rcu_list, rcu_node) | 4068 | list_for_each_entry_rcu(adap, &adap_rcu_list, rcu_node) |
4069 | for (i = 0; i < MAX_NPORTS; i++) | 4069 | for (i = 0; i < MAX_NPORTS; i++) |
4070 | if (adap->port[i] == netdev) { | 4070 | if (adap->port[i] == netdev) |
4071 | spin_unlock(&adap_rcu_lock); | 4071 | return true; |
4072 | return 1; | 4072 | return false; |
4073 | } | ||
4074 | spin_unlock(&adap_rcu_lock); | ||
4075 | return 0; | ||
4076 | } | 4073 | } |
4077 | 4074 | ||
4078 | static int clip_add(struct net_device *event_dev, struct inet6_ifaddr *ifa, | 4075 | static int clip_add(struct net_device *event_dev, struct inet6_ifaddr *ifa, |
@@ -6396,6 +6393,7 @@ static void remove_one(struct pci_dev *pdev) | |||
6396 | adapter->flags &= ~DEV_ENABLED; | 6393 | adapter->flags &= ~DEV_ENABLED; |
6397 | } | 6394 | } |
6398 | pci_release_regions(pdev); | 6395 | pci_release_regions(pdev); |
6396 | synchronize_rcu(); | ||
6399 | kfree(adapter); | 6397 | kfree(adapter); |
6400 | } else | 6398 | } else |
6401 | pci_release_regions(pdev); | 6399 | pci_release_regions(pdev); |
diff --git a/drivers/net/ethernet/chelsio/cxgb4/t4_hw.c b/drivers/net/ethernet/chelsio/cxgb4/t4_hw.c index bba67681aeaa..931478e7bd28 100644 --- a/drivers/net/ethernet/chelsio/cxgb4/t4_hw.c +++ b/drivers/net/ethernet/chelsio/cxgb4/t4_hw.c | |||
@@ -3962,6 +3962,7 @@ int t4_port_init(struct adapter *adap, int mbox, int pf, int vf) | |||
3962 | p->lport = j; | 3962 | p->lport = j; |
3963 | p->rss_size = rss_size; | 3963 | p->rss_size = rss_size; |
3964 | memcpy(adap->port[i]->dev_addr, addr, ETH_ALEN); | 3964 | memcpy(adap->port[i]->dev_addr, addr, ETH_ALEN); |
3965 | adap->port[i]->dev_port = j; | ||
3965 | 3966 | ||
3966 | ret = ntohl(c.u.info.lstatus_to_modtype); | 3967 | ret = ntohl(c.u.info.lstatus_to_modtype); |
3967 | p->mdio_addr = (ret & FW_PORT_CMD_MDIOCAP) ? | 3968 | p->mdio_addr = (ret & FW_PORT_CMD_MDIOCAP) ? |
diff --git a/drivers/net/ethernet/dec/tulip/timer.c b/drivers/net/ethernet/dec/tulip/timer.c index 768379b8aee9..523d9dde50a2 100644 --- a/drivers/net/ethernet/dec/tulip/timer.c +++ b/drivers/net/ethernet/dec/tulip/timer.c | |||
@@ -158,7 +158,7 @@ void comet_timer(unsigned long data) | |||
158 | { | 158 | { |
159 | struct net_device *dev = (struct net_device *)data; | 159 | struct net_device *dev = (struct net_device *)data; |
160 | struct tulip_private *tp = netdev_priv(dev); | 160 | struct tulip_private *tp = netdev_priv(dev); |
161 | int next_tick = 60*HZ; | 161 | int next_tick = 2*HZ; |
162 | 162 | ||
163 | if (tulip_debug > 1) | 163 | if (tulip_debug > 1) |
164 | netdev_dbg(dev, "Comet link status %04x partner capability %04x\n", | 164 | netdev_dbg(dev, "Comet link status %04x partner capability %04x\n", |
diff --git a/drivers/net/ethernet/emulex/benet/be.h b/drivers/net/ethernet/emulex/benet/be.h index 2e7c5553955e..c2f5d2d3b932 100644 --- a/drivers/net/ethernet/emulex/benet/be.h +++ b/drivers/net/ethernet/emulex/benet/be.h | |||
@@ -557,9 +557,7 @@ static inline u16 be_max_qs(struct be_adapter *adapter) | |||
557 | #define be_pvid_tagging_enabled(adapter) (adapter->pvid) | 557 | #define be_pvid_tagging_enabled(adapter) (adapter->pvid) |
558 | 558 | ||
559 | /* Is BE in QNQ multi-channel mode */ | 559 | /* Is BE in QNQ multi-channel mode */ |
560 | #define be_is_qnq_mode(adapter) (adapter->mc_type == FLEX10 || \ | 560 | #define be_is_qnq_mode(adapter) (adapter->function_mode & QNQ_MODE) |
561 | adapter->mc_type == vNIC1 || \ | ||
562 | adapter->mc_type == UFP) | ||
563 | 561 | ||
564 | #define lancer_chip(adapter) (adapter->pdev->device == OC_DEVICE_ID3 || \ | 562 | #define lancer_chip(adapter) (adapter->pdev->device == OC_DEVICE_ID3 || \ |
565 | adapter->pdev->device == OC_DEVICE_ID4) | 563 | adapter->pdev->device == OC_DEVICE_ID4) |
diff --git a/drivers/net/ethernet/emulex/benet/be_cmds.h b/drivers/net/ethernet/emulex/benet/be_cmds.h index 3e0a6b243806..59b3c056f329 100644 --- a/drivers/net/ethernet/emulex/benet/be_cmds.h +++ b/drivers/net/ethernet/emulex/benet/be_cmds.h | |||
@@ -1091,7 +1091,7 @@ struct be_cmd_resp_modify_eq_delay { | |||
1091 | * based on the skew/IPL. | 1091 | * based on the skew/IPL. |
1092 | */ | 1092 | */ |
1093 | #define RDMA_ENABLED 0x4 | 1093 | #define RDMA_ENABLED 0x4 |
1094 | #define FLEX10_MODE 0x400 | 1094 | #define QNQ_MODE 0x400 |
1095 | #define VNIC_MODE 0x20000 | 1095 | #define VNIC_MODE 0x20000 |
1096 | #define UMC_ENABLED 0x1000000 | 1096 | #define UMC_ENABLED 0x1000000 |
1097 | struct be_cmd_req_query_fw_cfg { | 1097 | struct be_cmd_req_query_fw_cfg { |
diff --git a/drivers/net/ethernet/emulex/benet/be_main.c b/drivers/net/ethernet/emulex/benet/be_main.c index 6822b3d76d85..34a26e42f19d 100644 --- a/drivers/net/ethernet/emulex/benet/be_main.c +++ b/drivers/net/ethernet/emulex/benet/be_main.c | |||
@@ -3254,9 +3254,9 @@ err: | |||
3254 | 3254 | ||
3255 | static u8 be_convert_mc_type(u32 function_mode) | 3255 | static u8 be_convert_mc_type(u32 function_mode) |
3256 | { | 3256 | { |
3257 | if (function_mode & VNIC_MODE && function_mode & FLEX10_MODE) | 3257 | if (function_mode & VNIC_MODE && function_mode & QNQ_MODE) |
3258 | return vNIC1; | 3258 | return vNIC1; |
3259 | else if (function_mode & FLEX10_MODE) | 3259 | else if (function_mode & QNQ_MODE) |
3260 | return FLEX10; | 3260 | return FLEX10; |
3261 | else if (function_mode & VNIC_MODE) | 3261 | else if (function_mode & VNIC_MODE) |
3262 | return vNIC2; | 3262 | return vNIC2; |
diff --git a/drivers/net/ethernet/freescale/fec_main.c b/drivers/net/ethernet/freescale/fec_main.c index 38d9d276ab8b..77037fd377b8 100644 --- a/drivers/net/ethernet/freescale/fec_main.c +++ b/drivers/net/ethernet/freescale/fec_main.c | |||
@@ -320,6 +320,11 @@ static void *swap_buffer(void *bufaddr, int len) | |||
320 | return bufaddr; | 320 | return bufaddr; |
321 | } | 321 | } |
322 | 322 | ||
323 | static inline bool is_ipv4_pkt(struct sk_buff *skb) | ||
324 | { | ||
325 | return skb->protocol == htons(ETH_P_IP) && ip_hdr(skb)->version == 4; | ||
326 | } | ||
327 | |||
323 | static int | 328 | static int |
324 | fec_enet_clear_csum(struct sk_buff *skb, struct net_device *ndev) | 329 | fec_enet_clear_csum(struct sk_buff *skb, struct net_device *ndev) |
325 | { | 330 | { |
@@ -330,7 +335,8 @@ fec_enet_clear_csum(struct sk_buff *skb, struct net_device *ndev) | |||
330 | if (unlikely(skb_cow_head(skb, 0))) | 335 | if (unlikely(skb_cow_head(skb, 0))) |
331 | return -1; | 336 | return -1; |
332 | 337 | ||
333 | ip_hdr(skb)->check = 0; | 338 | if (is_ipv4_pkt(skb)) |
339 | ip_hdr(skb)->check = 0; | ||
334 | *(__sum16 *)(skb->head + skb->csum_start + skb->csum_offset) = 0; | 340 | *(__sum16 *)(skb->head + skb->csum_start + skb->csum_offset) = 0; |
335 | 341 | ||
336 | return 0; | 342 | return 0; |
diff --git a/drivers/net/ethernet/marvell/skge.c b/drivers/net/ethernet/marvell/skge.c index 7f81ae66cc89..e912b6887d40 100644 --- a/drivers/net/ethernet/marvell/skge.c +++ b/drivers/net/ethernet/marvell/skge.c | |||
@@ -4199,6 +4199,13 @@ static struct dmi_system_id skge_32bit_dma_boards[] = { | |||
4199 | DMI_MATCH(DMI_BOARD_NAME, "P5NSLI") | 4199 | DMI_MATCH(DMI_BOARD_NAME, "P5NSLI") |
4200 | }, | 4200 | }, |
4201 | }, | 4201 | }, |
4202 | { | ||
4203 | .ident = "FUJITSU SIEMENS A8NE-FM", | ||
4204 | .matches = { | ||
4205 | DMI_MATCH(DMI_BOARD_VENDOR, "ASUSTek Computer INC."), | ||
4206 | DMI_MATCH(DMI_BOARD_NAME, "A8NE-FM") | ||
4207 | }, | ||
4208 | }, | ||
4202 | {} | 4209 | {} |
4203 | }; | 4210 | }; |
4204 | 4211 | ||
diff --git a/drivers/net/ethernet/mellanox/mlx4/main.c b/drivers/net/ethernet/mellanox/mlx4/main.c index 5f42f6d6e4c6..82ab427290c3 100644 --- a/drivers/net/ethernet/mellanox/mlx4/main.c +++ b/drivers/net/ethernet/mellanox/mlx4/main.c | |||
@@ -2439,7 +2439,8 @@ slave_start: | |||
2439 | (num_vfs_argc > 1 || probe_vfs_argc > 1)) { | 2439 | (num_vfs_argc > 1 || probe_vfs_argc > 1)) { |
2440 | mlx4_err(dev, | 2440 | mlx4_err(dev, |
2441 | "Invalid syntax of num_vfs/probe_vfs with IB port - single port VFs syntax is only supported when all ports are configured as ethernet\n"); | 2441 | "Invalid syntax of num_vfs/probe_vfs with IB port - single port VFs syntax is only supported when all ports are configured as ethernet\n"); |
2442 | goto err_close; | 2442 | err = -EINVAL; |
2443 | goto err_master_mfunc; | ||
2443 | } | 2444 | } |
2444 | for (i = 0; i < sizeof(nvfs)/sizeof(nvfs[0]); i++) { | 2445 | for (i = 0; i < sizeof(nvfs)/sizeof(nvfs[0]); i++) { |
2445 | unsigned j; | 2446 | unsigned j; |
diff --git a/drivers/net/ethernet/ti/cpsw.c b/drivers/net/ethernet/ti/cpsw.c index ff380dac6629..b988d16cd34e 100644 --- a/drivers/net/ethernet/ti/cpsw.c +++ b/drivers/net/ethernet/ti/cpsw.c | |||
@@ -1212,7 +1212,12 @@ static int cpsw_ndo_open(struct net_device *ndev) | |||
1212 | for_each_slave(priv, cpsw_slave_open, priv); | 1212 | for_each_slave(priv, cpsw_slave_open, priv); |
1213 | 1213 | ||
1214 | /* Add default VLAN */ | 1214 | /* Add default VLAN */ |
1215 | cpsw_add_default_vlan(priv); | 1215 | if (!priv->data.dual_emac) |
1216 | cpsw_add_default_vlan(priv); | ||
1217 | else | ||
1218 | cpsw_ale_add_vlan(priv->ale, priv->data.default_vlan, | ||
1219 | ALE_ALL_PORTS << priv->host_port, | ||
1220 | ALE_ALL_PORTS << priv->host_port, 0, 0); | ||
1216 | 1221 | ||
1217 | if (!cpsw_common_res_usage_state(priv)) { | 1222 | if (!cpsw_common_res_usage_state(priv)) { |
1218 | /* setup tx dma to fixed prio and zero offset */ | 1223 | /* setup tx dma to fixed prio and zero offset */ |
diff --git a/drivers/net/ethernet/tile/tilegx.c b/drivers/net/ethernet/tile/tilegx.c index 14389f841d43..4c70360967c2 100644 --- a/drivers/net/ethernet/tile/tilegx.c +++ b/drivers/net/ethernet/tile/tilegx.c | |||
@@ -2191,7 +2191,6 @@ static void tile_net_setup(struct net_device *dev) | |||
2191 | static void tile_net_dev_init(const char *name, const uint8_t *mac) | 2191 | static void tile_net_dev_init(const char *name, const uint8_t *mac) |
2192 | { | 2192 | { |
2193 | int ret; | 2193 | int ret; |
2194 | int i; | ||
2195 | struct net_device *dev; | 2194 | struct net_device *dev; |
2196 | struct tile_net_priv *priv; | 2195 | struct tile_net_priv *priv; |
2197 | 2196 | ||
diff --git a/drivers/net/hyperv/netvsc.c b/drivers/net/hyperv/netvsc.c index c041f63a6d30..4ed38eaecea8 100644 --- a/drivers/net/hyperv/netvsc.c +++ b/drivers/net/hyperv/netvsc.c | |||
@@ -189,7 +189,7 @@ static int netvsc_destroy_buf(struct netvsc_device *net_device) | |||
189 | "unable to teardown send buffer's gpadl\n"); | 189 | "unable to teardown send buffer's gpadl\n"); |
190 | return ret; | 190 | return ret; |
191 | } | 191 | } |
192 | net_device->recv_buf_gpadl_handle = 0; | 192 | net_device->send_buf_gpadl_handle = 0; |
193 | } | 193 | } |
194 | if (net_device->send_buf) { | 194 | if (net_device->send_buf) { |
195 | /* Free up the receive buffer */ | 195 | /* Free up the receive buffer */ |
diff --git a/drivers/net/ieee802154/at86rf230.c b/drivers/net/ieee802154/at86rf230.c index 4517b149ed07..50899416f668 100644 --- a/drivers/net/ieee802154/at86rf230.c +++ b/drivers/net/ieee802154/at86rf230.c | |||
@@ -1137,6 +1137,8 @@ static int at86rf230_probe(struct spi_device *spi) | |||
1137 | dev->flags = IEEE802154_HW_OMIT_CKSUM | IEEE802154_HW_AACK; | 1137 | dev->flags = IEEE802154_HW_OMIT_CKSUM | IEEE802154_HW_AACK; |
1138 | 1138 | ||
1139 | irq_type = irq_get_trigger_type(spi->irq); | 1139 | irq_type = irq_get_trigger_type(spi->irq); |
1140 | if (!irq_type) | ||
1141 | irq_type = IRQF_TRIGGER_RISING; | ||
1140 | if (irq_type & (IRQF_TRIGGER_RISING | IRQF_TRIGGER_FALLING)) { | 1142 | if (irq_type & (IRQF_TRIGGER_RISING | IRQF_TRIGGER_FALLING)) { |
1141 | irq_worker = at86rf230_irqwork; | 1143 | irq_worker = at86rf230_irqwork; |
1142 | irq_handler = at86rf230_isr; | 1144 | irq_handler = at86rf230_isr; |
@@ -1168,7 +1170,8 @@ static int at86rf230_probe(struct spi_device *spi) | |||
1168 | if (rc) | 1170 | if (rc) |
1169 | goto err_hw_init; | 1171 | goto err_hw_init; |
1170 | 1172 | ||
1171 | rc = devm_request_irq(&spi->dev, spi->irq, irq_handler, IRQF_SHARED, | 1173 | rc = devm_request_irq(&spi->dev, spi->irq, irq_handler, |
1174 | IRQF_SHARED | irq_type, | ||
1172 | dev_name(&spi->dev), lp); | 1175 | dev_name(&spi->dev), lp); |
1173 | if (rc) | 1176 | if (rc) |
1174 | goto err_hw_init; | 1177 | goto err_hw_init; |
diff --git a/drivers/net/phy/at803x.c b/drivers/net/phy/at803x.c index 6c622aedbae1..fdc1b418fa6a 100644 --- a/drivers/net/phy/at803x.c +++ b/drivers/net/phy/at803x.c | |||
@@ -16,9 +16,13 @@ | |||
16 | #include <linux/string.h> | 16 | #include <linux/string.h> |
17 | #include <linux/netdevice.h> | 17 | #include <linux/netdevice.h> |
18 | #include <linux/etherdevice.h> | 18 | #include <linux/etherdevice.h> |
19 | #include <linux/of_gpio.h> | ||
20 | #include <linux/gpio/consumer.h> | ||
19 | 21 | ||
20 | #define AT803X_INTR_ENABLE 0x12 | 22 | #define AT803X_INTR_ENABLE 0x12 |
21 | #define AT803X_INTR_STATUS 0x13 | 23 | #define AT803X_INTR_STATUS 0x13 |
24 | #define AT803X_SMART_SPEED 0x14 | ||
25 | #define AT803X_LED_CONTROL 0x18 | ||
22 | #define AT803X_WOL_ENABLE 0x01 | 26 | #define AT803X_WOL_ENABLE 0x01 |
23 | #define AT803X_DEVICE_ADDR 0x03 | 27 | #define AT803X_DEVICE_ADDR 0x03 |
24 | #define AT803X_LOC_MAC_ADDR_0_15_OFFSET 0x804C | 28 | #define AT803X_LOC_MAC_ADDR_0_15_OFFSET 0x804C |
@@ -35,10 +39,52 @@ | |||
35 | #define AT803X_DEBUG_SYSTEM_MODE_CTRL 0x05 | 39 | #define AT803X_DEBUG_SYSTEM_MODE_CTRL 0x05 |
36 | #define AT803X_DEBUG_RGMII_TX_CLK_DLY BIT(8) | 40 | #define AT803X_DEBUG_RGMII_TX_CLK_DLY BIT(8) |
37 | 41 | ||
42 | #define ATH8030_PHY_ID 0x004dd076 | ||
43 | #define ATH8031_PHY_ID 0x004dd074 | ||
44 | #define ATH8035_PHY_ID 0x004dd072 | ||
45 | |||
38 | MODULE_DESCRIPTION("Atheros 803x PHY driver"); | 46 | MODULE_DESCRIPTION("Atheros 803x PHY driver"); |
39 | MODULE_AUTHOR("Matus Ujhelyi"); | 47 | MODULE_AUTHOR("Matus Ujhelyi"); |
40 | MODULE_LICENSE("GPL"); | 48 | MODULE_LICENSE("GPL"); |
41 | 49 | ||
50 | struct at803x_priv { | ||
51 | bool phy_reset:1; | ||
52 | struct gpio_desc *gpiod_reset; | ||
53 | }; | ||
54 | |||
55 | struct at803x_context { | ||
56 | u16 bmcr; | ||
57 | u16 advertise; | ||
58 | u16 control1000; | ||
59 | u16 int_enable; | ||
60 | u16 smart_speed; | ||
61 | u16 led_control; | ||
62 | }; | ||
63 | |||
64 | /* save relevant PHY registers to private copy */ | ||
65 | static void at803x_context_save(struct phy_device *phydev, | ||
66 | struct at803x_context *context) | ||
67 | { | ||
68 | context->bmcr = phy_read(phydev, MII_BMCR); | ||
69 | context->advertise = phy_read(phydev, MII_ADVERTISE); | ||
70 | context->control1000 = phy_read(phydev, MII_CTRL1000); | ||
71 | context->int_enable = phy_read(phydev, AT803X_INTR_ENABLE); | ||
72 | context->smart_speed = phy_read(phydev, AT803X_SMART_SPEED); | ||
73 | context->led_control = phy_read(phydev, AT803X_LED_CONTROL); | ||
74 | } | ||
75 | |||
76 | /* restore relevant PHY registers from private copy */ | ||
77 | static void at803x_context_restore(struct phy_device *phydev, | ||
78 | const struct at803x_context *context) | ||
79 | { | ||
80 | phy_write(phydev, MII_BMCR, context->bmcr); | ||
81 | phy_write(phydev, MII_ADVERTISE, context->advertise); | ||
82 | phy_write(phydev, MII_CTRL1000, context->control1000); | ||
83 | phy_write(phydev, AT803X_INTR_ENABLE, context->int_enable); | ||
84 | phy_write(phydev, AT803X_SMART_SPEED, context->smart_speed); | ||
85 | phy_write(phydev, AT803X_LED_CONTROL, context->led_control); | ||
86 | } | ||
87 | |||
42 | static int at803x_set_wol(struct phy_device *phydev, | 88 | static int at803x_set_wol(struct phy_device *phydev, |
43 | struct ethtool_wolinfo *wol) | 89 | struct ethtool_wolinfo *wol) |
44 | { | 90 | { |
@@ -142,6 +188,26 @@ static int at803x_resume(struct phy_device *phydev) | |||
142 | return 0; | 188 | return 0; |
143 | } | 189 | } |
144 | 190 | ||
191 | static int at803x_probe(struct phy_device *phydev) | ||
192 | { | ||
193 | struct device *dev = &phydev->dev; | ||
194 | struct at803x_priv *priv; | ||
195 | |||
196 | priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL); | ||
197 | if (!priv) | ||
198 | return -ENOMEM; | ||
199 | |||
200 | priv->gpiod_reset = devm_gpiod_get(dev, "reset"); | ||
201 | if (IS_ERR(priv->gpiod_reset)) | ||
202 | priv->gpiod_reset = NULL; | ||
203 | else | ||
204 | gpiod_direction_output(priv->gpiod_reset, 1); | ||
205 | |||
206 | phydev->priv = priv; | ||
207 | |||
208 | return 0; | ||
209 | } | ||
210 | |||
145 | static int at803x_config_init(struct phy_device *phydev) | 211 | static int at803x_config_init(struct phy_device *phydev) |
146 | { | 212 | { |
147 | int ret; | 213 | int ret; |
@@ -189,58 +255,99 @@ static int at803x_config_intr(struct phy_device *phydev) | |||
189 | return err; | 255 | return err; |
190 | } | 256 | } |
191 | 257 | ||
258 | static void at803x_link_change_notify(struct phy_device *phydev) | ||
259 | { | ||
260 | struct at803x_priv *priv = phydev->priv; | ||
261 | |||
262 | /* | ||
263 | * Conduct a hardware reset for AT8030 every time a link loss is | ||
264 | * signalled. This is necessary to circumvent a hardware bug that | ||
265 | * occurs when the cable is unplugged while TX packets are pending | ||
266 | * in the FIFO. In such cases, the FIFO enters an error mode it | ||
267 | * cannot recover from by software. | ||
268 | */ | ||
269 | if (phydev->drv->phy_id == ATH8030_PHY_ID) { | ||
270 | if (phydev->state == PHY_NOLINK) { | ||
271 | if (priv->gpiod_reset && !priv->phy_reset) { | ||
272 | struct at803x_context context; | ||
273 | |||
274 | at803x_context_save(phydev, &context); | ||
275 | |||
276 | gpiod_set_value(priv->gpiod_reset, 0); | ||
277 | msleep(1); | ||
278 | gpiod_set_value(priv->gpiod_reset, 1); | ||
279 | msleep(1); | ||
280 | |||
281 | at803x_context_restore(phydev, &context); | ||
282 | |||
283 | dev_dbg(&phydev->dev, "%s(): phy was reset\n", | ||
284 | __func__); | ||
285 | priv->phy_reset = true; | ||
286 | } | ||
287 | } else { | ||
288 | priv->phy_reset = false; | ||
289 | } | ||
290 | } | ||
291 | } | ||
292 | |||
192 | static struct phy_driver at803x_driver[] = { | 293 | static struct phy_driver at803x_driver[] = { |
193 | { | 294 | { |
194 | /* ATHEROS 8035 */ | 295 | /* ATHEROS 8035 */ |
195 | .phy_id = 0x004dd072, | 296 | .phy_id = ATH8035_PHY_ID, |
196 | .name = "Atheros 8035 ethernet", | 297 | .name = "Atheros 8035 ethernet", |
197 | .phy_id_mask = 0xffffffef, | 298 | .phy_id_mask = 0xffffffef, |
198 | .config_init = at803x_config_init, | 299 | .probe = at803x_probe, |
199 | .set_wol = at803x_set_wol, | 300 | .config_init = at803x_config_init, |
200 | .get_wol = at803x_get_wol, | 301 | .link_change_notify = at803x_link_change_notify, |
201 | .suspend = at803x_suspend, | 302 | .set_wol = at803x_set_wol, |
202 | .resume = at803x_resume, | 303 | .get_wol = at803x_get_wol, |
203 | .features = PHY_GBIT_FEATURES, | 304 | .suspend = at803x_suspend, |
204 | .flags = PHY_HAS_INTERRUPT, | 305 | .resume = at803x_resume, |
205 | .config_aneg = genphy_config_aneg, | 306 | .features = PHY_GBIT_FEATURES, |
206 | .read_status = genphy_read_status, | 307 | .flags = PHY_HAS_INTERRUPT, |
207 | .driver = { | 308 | .config_aneg = genphy_config_aneg, |
309 | .read_status = genphy_read_status, | ||
310 | .driver = { | ||
208 | .owner = THIS_MODULE, | 311 | .owner = THIS_MODULE, |
209 | }, | 312 | }, |
210 | }, { | 313 | }, { |
211 | /* ATHEROS 8030 */ | 314 | /* ATHEROS 8030 */ |
212 | .phy_id = 0x004dd076, | 315 | .phy_id = ATH8030_PHY_ID, |
213 | .name = "Atheros 8030 ethernet", | 316 | .name = "Atheros 8030 ethernet", |
214 | .phy_id_mask = 0xffffffef, | 317 | .phy_id_mask = 0xffffffef, |
215 | .config_init = at803x_config_init, | 318 | .probe = at803x_probe, |
216 | .set_wol = at803x_set_wol, | 319 | .config_init = at803x_config_init, |
217 | .get_wol = at803x_get_wol, | 320 | .link_change_notify = at803x_link_change_notify, |
218 | .suspend = at803x_suspend, | 321 | .set_wol = at803x_set_wol, |
219 | .resume = at803x_resume, | 322 | .get_wol = at803x_get_wol, |
220 | .features = PHY_GBIT_FEATURES, | 323 | .suspend = at803x_suspend, |
221 | .flags = PHY_HAS_INTERRUPT, | 324 | .resume = at803x_resume, |
222 | .config_aneg = genphy_config_aneg, | 325 | .features = PHY_GBIT_FEATURES, |
223 | .read_status = genphy_read_status, | 326 | .flags = PHY_HAS_INTERRUPT, |
224 | .driver = { | 327 | .config_aneg = genphy_config_aneg, |
328 | .read_status = genphy_read_status, | ||
329 | .driver = { | ||
225 | .owner = THIS_MODULE, | 330 | .owner = THIS_MODULE, |
226 | }, | 331 | }, |
227 | }, { | 332 | }, { |
228 | /* ATHEROS 8031 */ | 333 | /* ATHEROS 8031 */ |
229 | .phy_id = 0x004dd074, | 334 | .phy_id = ATH8031_PHY_ID, |
230 | .name = "Atheros 8031 ethernet", | 335 | .name = "Atheros 8031 ethernet", |
231 | .phy_id_mask = 0xffffffef, | 336 | .phy_id_mask = 0xffffffef, |
232 | .config_init = at803x_config_init, | 337 | .probe = at803x_probe, |
233 | .set_wol = at803x_set_wol, | 338 | .config_init = at803x_config_init, |
234 | .get_wol = at803x_get_wol, | 339 | .link_change_notify = at803x_link_change_notify, |
235 | .suspend = at803x_suspend, | 340 | .set_wol = at803x_set_wol, |
236 | .resume = at803x_resume, | 341 | .get_wol = at803x_get_wol, |
237 | .features = PHY_GBIT_FEATURES, | 342 | .suspend = at803x_suspend, |
238 | .flags = PHY_HAS_INTERRUPT, | 343 | .resume = at803x_resume, |
239 | .config_aneg = genphy_config_aneg, | 344 | .features = PHY_GBIT_FEATURES, |
240 | .read_status = genphy_read_status, | 345 | .flags = PHY_HAS_INTERRUPT, |
241 | .ack_interrupt = &at803x_ack_interrupt, | 346 | .config_aneg = genphy_config_aneg, |
242 | .config_intr = &at803x_config_intr, | 347 | .read_status = genphy_read_status, |
243 | .driver = { | 348 | .ack_interrupt = &at803x_ack_interrupt, |
349 | .config_intr = &at803x_config_intr, | ||
350 | .driver = { | ||
244 | .owner = THIS_MODULE, | 351 | .owner = THIS_MODULE, |
245 | }, | 352 | }, |
246 | } }; | 353 | } }; |
@@ -260,9 +367,9 @@ module_init(atheros_init); | |||
260 | module_exit(atheros_exit); | 367 | module_exit(atheros_exit); |
261 | 368 | ||
262 | static struct mdio_device_id __maybe_unused atheros_tbl[] = { | 369 | static struct mdio_device_id __maybe_unused atheros_tbl[] = { |
263 | { 0x004dd076, 0xffffffef }, | 370 | { ATH8030_PHY_ID, 0xffffffef }, |
264 | { 0x004dd074, 0xffffffef }, | 371 | { ATH8031_PHY_ID, 0xffffffef }, |
265 | { 0x004dd072, 0xffffffef }, | 372 | { ATH8035_PHY_ID, 0xffffffef }, |
266 | { } | 373 | { } |
267 | }; | 374 | }; |
268 | 375 | ||
diff --git a/drivers/net/phy/phy.c b/drivers/net/phy/phy.c index 3bc079a67a3d..f7c61812ea4a 100644 --- a/drivers/net/phy/phy.c +++ b/drivers/net/phy/phy.c | |||
@@ -720,6 +720,9 @@ void phy_state_machine(struct work_struct *work) | |||
720 | 720 | ||
721 | mutex_lock(&phydev->lock); | 721 | mutex_lock(&phydev->lock); |
722 | 722 | ||
723 | if (phydev->drv->link_change_notify) | ||
724 | phydev->drv->link_change_notify(phydev); | ||
725 | |||
723 | switch (phydev->state) { | 726 | switch (phydev->state) { |
724 | case PHY_DOWN: | 727 | case PHY_DOWN: |
725 | case PHY_STARTING: | 728 | case PHY_STARTING: |
diff --git a/drivers/net/slip/slip.c b/drivers/net/slip/slip.c index ad4a94e9ff57..87526443841f 100644 --- a/drivers/net/slip/slip.c +++ b/drivers/net/slip/slip.c | |||
@@ -83,6 +83,7 @@ | |||
83 | #include <linux/delay.h> | 83 | #include <linux/delay.h> |
84 | #include <linux/init.h> | 84 | #include <linux/init.h> |
85 | #include <linux/slab.h> | 85 | #include <linux/slab.h> |
86 | #include <linux/workqueue.h> | ||
86 | #include "slip.h" | 87 | #include "slip.h" |
87 | #ifdef CONFIG_INET | 88 | #ifdef CONFIG_INET |
88 | #include <linux/ip.h> | 89 | #include <linux/ip.h> |
@@ -416,36 +417,46 @@ static void sl_encaps(struct slip *sl, unsigned char *icp, int len) | |||
416 | #endif | 417 | #endif |
417 | } | 418 | } |
418 | 419 | ||
419 | /* | 420 | /* Write out any remaining transmit buffer. Scheduled when tty is writable */ |
420 | * Called by the driver when there's room for more data. If we have | 421 | static void slip_transmit(struct work_struct *work) |
421 | * more packets to send, we send them here. | ||
422 | */ | ||
423 | static void slip_write_wakeup(struct tty_struct *tty) | ||
424 | { | 422 | { |
423 | struct slip *sl = container_of(work, struct slip, tx_work); | ||
425 | int actual; | 424 | int actual; |
426 | struct slip *sl = tty->disc_data; | ||
427 | 425 | ||
426 | spin_lock_bh(&sl->lock); | ||
428 | /* First make sure we're connected. */ | 427 | /* First make sure we're connected. */ |
429 | if (!sl || sl->magic != SLIP_MAGIC || !netif_running(sl->dev)) | 428 | if (!sl->tty || sl->magic != SLIP_MAGIC || !netif_running(sl->dev)) { |
429 | spin_unlock_bh(&sl->lock); | ||
430 | return; | 430 | return; |
431 | } | ||
431 | 432 | ||
432 | spin_lock_bh(&sl->lock); | ||
433 | if (sl->xleft <= 0) { | 433 | if (sl->xleft <= 0) { |
434 | /* Now serial buffer is almost free & we can start | 434 | /* Now serial buffer is almost free & we can start |
435 | * transmission of another packet */ | 435 | * transmission of another packet */ |
436 | sl->dev->stats.tx_packets++; | 436 | sl->dev->stats.tx_packets++; |
437 | clear_bit(TTY_DO_WRITE_WAKEUP, &tty->flags); | 437 | clear_bit(TTY_DO_WRITE_WAKEUP, &sl->tty->flags); |
438 | spin_unlock_bh(&sl->lock); | 438 | spin_unlock_bh(&sl->lock); |
439 | sl_unlock(sl); | 439 | sl_unlock(sl); |
440 | return; | 440 | return; |
441 | } | 441 | } |
442 | 442 | ||
443 | actual = tty->ops->write(tty, sl->xhead, sl->xleft); | 443 | actual = sl->tty->ops->write(sl->tty, sl->xhead, sl->xleft); |
444 | sl->xleft -= actual; | 444 | sl->xleft -= actual; |
445 | sl->xhead += actual; | 445 | sl->xhead += actual; |
446 | spin_unlock_bh(&sl->lock); | 446 | spin_unlock_bh(&sl->lock); |
447 | } | 447 | } |
448 | 448 | ||
449 | /* | ||
450 | * Called by the driver when there's room for more data. | ||
451 | * Schedule the transmit. | ||
452 | */ | ||
453 | static void slip_write_wakeup(struct tty_struct *tty) | ||
454 | { | ||
455 | struct slip *sl = tty->disc_data; | ||
456 | |||
457 | schedule_work(&sl->tx_work); | ||
458 | } | ||
459 | |||
449 | static void sl_tx_timeout(struct net_device *dev) | 460 | static void sl_tx_timeout(struct net_device *dev) |
450 | { | 461 | { |
451 | struct slip *sl = netdev_priv(dev); | 462 | struct slip *sl = netdev_priv(dev); |
@@ -749,6 +760,7 @@ static struct slip *sl_alloc(dev_t line) | |||
749 | sl->magic = SLIP_MAGIC; | 760 | sl->magic = SLIP_MAGIC; |
750 | sl->dev = dev; | 761 | sl->dev = dev; |
751 | spin_lock_init(&sl->lock); | 762 | spin_lock_init(&sl->lock); |
763 | INIT_WORK(&sl->tx_work, slip_transmit); | ||
752 | sl->mode = SL_MODE_DEFAULT; | 764 | sl->mode = SL_MODE_DEFAULT; |
753 | #ifdef CONFIG_SLIP_SMART | 765 | #ifdef CONFIG_SLIP_SMART |
754 | /* initialize timer_list struct */ | 766 | /* initialize timer_list struct */ |
@@ -872,8 +884,12 @@ static void slip_close(struct tty_struct *tty) | |||
872 | if (!sl || sl->magic != SLIP_MAGIC || sl->tty != tty) | 884 | if (!sl || sl->magic != SLIP_MAGIC || sl->tty != tty) |
873 | return; | 885 | return; |
874 | 886 | ||
887 | spin_lock_bh(&sl->lock); | ||
875 | tty->disc_data = NULL; | 888 | tty->disc_data = NULL; |
876 | sl->tty = NULL; | 889 | sl->tty = NULL; |
890 | spin_unlock_bh(&sl->lock); | ||
891 | |||
892 | flush_work(&sl->tx_work); | ||
877 | 893 | ||
878 | /* VSV = very important to remove timers */ | 894 | /* VSV = very important to remove timers */ |
879 | #ifdef CONFIG_SLIP_SMART | 895 | #ifdef CONFIG_SLIP_SMART |
diff --git a/drivers/net/slip/slip.h b/drivers/net/slip/slip.h index 67673cf1266b..cf32aadf508f 100644 --- a/drivers/net/slip/slip.h +++ b/drivers/net/slip/slip.h | |||
@@ -53,6 +53,7 @@ struct slip { | |||
53 | struct tty_struct *tty; /* ptr to TTY structure */ | 53 | struct tty_struct *tty; /* ptr to TTY structure */ |
54 | struct net_device *dev; /* easy for intr handling */ | 54 | struct net_device *dev; /* easy for intr handling */ |
55 | spinlock_t lock; | 55 | spinlock_t lock; |
56 | struct work_struct tx_work; /* Flushes transmit buffer */ | ||
56 | 57 | ||
57 | #ifdef SL_INCLUDE_CSLIP | 58 | #ifdef SL_INCLUDE_CSLIP |
58 | struct slcompress *slcomp; /* for header compression */ | 59 | struct slcompress *slcomp; /* for header compression */ |
diff --git a/drivers/net/usb/huawei_cdc_ncm.c b/drivers/net/usb/huawei_cdc_ncm.c index f9822bc75425..5d95a13dbe2a 100644 --- a/drivers/net/usb/huawei_cdc_ncm.c +++ b/drivers/net/usb/huawei_cdc_ncm.c | |||
@@ -84,12 +84,13 @@ static int huawei_cdc_ncm_bind(struct usbnet *usbnet_dev, | |||
84 | ctx = drvstate->ctx; | 84 | ctx = drvstate->ctx; |
85 | 85 | ||
86 | if (usbnet_dev->status) | 86 | if (usbnet_dev->status) |
87 | /* CDC-WMC r1.1 requires wMaxCommand to be "at least 256 | 87 | /* The wMaxCommand buffer must be big enough to hold |
88 | * decimal (0x100)" | 88 | * any message from the modem. Experience has shown |
89 | * that some replies are more than 256 bytes long | ||
89 | */ | 90 | */ |
90 | subdriver = usb_cdc_wdm_register(ctx->control, | 91 | subdriver = usb_cdc_wdm_register(ctx->control, |
91 | &usbnet_dev->status->desc, | 92 | &usbnet_dev->status->desc, |
92 | 256, /* wMaxCommand */ | 93 | 1024, /* wMaxCommand */ |
93 | huawei_cdc_ncm_wdm_manage_power); | 94 | huawei_cdc_ncm_wdm_manage_power); |
94 | if (IS_ERR(subdriver)) { | 95 | if (IS_ERR(subdriver)) { |
95 | ret = PTR_ERR(subdriver); | 96 | ret = PTR_ERR(subdriver); |
diff --git a/drivers/net/vmxnet3/vmxnet3_drv.c b/drivers/net/vmxnet3/vmxnet3_drv.c index 97394345e5dd..b76f7dcde0db 100644 --- a/drivers/net/vmxnet3/vmxnet3_drv.c +++ b/drivers/net/vmxnet3/vmxnet3_drv.c | |||
@@ -2589,8 +2589,8 @@ vmxnet3_open(struct net_device *netdev) | |||
2589 | for (i = 0; i < adapter->num_tx_queues; i++) | 2589 | for (i = 0; i < adapter->num_tx_queues; i++) |
2590 | spin_lock_init(&adapter->tx_queue[i].tx_lock); | 2590 | spin_lock_init(&adapter->tx_queue[i].tx_lock); |
2591 | 2591 | ||
2592 | err = vmxnet3_create_queues(adapter, VMXNET3_DEF_TX_RING_SIZE, | 2592 | err = vmxnet3_create_queues(adapter, adapter->tx_ring_size, |
2593 | VMXNET3_DEF_RX_RING_SIZE, | 2593 | adapter->rx_ring_size, |
2594 | VMXNET3_DEF_RX_RING_SIZE); | 2594 | VMXNET3_DEF_RX_RING_SIZE); |
2595 | if (err) | 2595 | if (err) |
2596 | goto queue_err; | 2596 | goto queue_err; |
@@ -2968,6 +2968,9 @@ vmxnet3_probe_device(struct pci_dev *pdev, | |||
2968 | adapter->netdev = netdev; | 2968 | adapter->netdev = netdev; |
2969 | adapter->pdev = pdev; | 2969 | adapter->pdev = pdev; |
2970 | 2970 | ||
2971 | adapter->tx_ring_size = VMXNET3_DEF_TX_RING_SIZE; | ||
2972 | adapter->rx_ring_size = VMXNET3_DEF_RX_RING_SIZE; | ||
2973 | |||
2971 | spin_lock_init(&adapter->cmd_lock); | 2974 | spin_lock_init(&adapter->cmd_lock); |
2972 | adapter->adapter_pa = dma_map_single(&adapter->pdev->dev, adapter, | 2975 | adapter->adapter_pa = dma_map_single(&adapter->pdev->dev, adapter, |
2973 | sizeof(struct vmxnet3_adapter), | 2976 | sizeof(struct vmxnet3_adapter), |
diff --git a/drivers/net/vmxnet3/vmxnet3_ethtool.c b/drivers/net/vmxnet3/vmxnet3_ethtool.c index 40c1c7b0d9e0..b725fd9e7803 100644 --- a/drivers/net/vmxnet3/vmxnet3_ethtool.c +++ b/drivers/net/vmxnet3/vmxnet3_ethtool.c | |||
@@ -449,8 +449,8 @@ vmxnet3_get_ringparam(struct net_device *netdev, | |||
449 | param->rx_mini_max_pending = 0; | 449 | param->rx_mini_max_pending = 0; |
450 | param->rx_jumbo_max_pending = 0; | 450 | param->rx_jumbo_max_pending = 0; |
451 | 451 | ||
452 | param->rx_pending = adapter->rx_queue[0].rx_ring[0].size; | 452 | param->rx_pending = adapter->rx_ring_size; |
453 | param->tx_pending = adapter->tx_queue[0].tx_ring.size; | 453 | param->tx_pending = adapter->tx_ring_size; |
454 | param->rx_mini_pending = 0; | 454 | param->rx_mini_pending = 0; |
455 | param->rx_jumbo_pending = 0; | 455 | param->rx_jumbo_pending = 0; |
456 | } | 456 | } |
@@ -529,9 +529,11 @@ vmxnet3_set_ringparam(struct net_device *netdev, | |||
529 | * size */ | 529 | * size */ |
530 | netdev_err(netdev, "failed to apply new sizes, " | 530 | netdev_err(netdev, "failed to apply new sizes, " |
531 | "try the default ones\n"); | 531 | "try the default ones\n"); |
532 | new_rx_ring_size = VMXNET3_DEF_RX_RING_SIZE; | ||
533 | new_tx_ring_size = VMXNET3_DEF_TX_RING_SIZE; | ||
532 | err = vmxnet3_create_queues(adapter, | 534 | err = vmxnet3_create_queues(adapter, |
533 | VMXNET3_DEF_TX_RING_SIZE, | 535 | new_tx_ring_size, |
534 | VMXNET3_DEF_RX_RING_SIZE, | 536 | new_rx_ring_size, |
535 | VMXNET3_DEF_RX_RING_SIZE); | 537 | VMXNET3_DEF_RX_RING_SIZE); |
536 | if (err) { | 538 | if (err) { |
537 | netdev_err(netdev, "failed to create queues " | 539 | netdev_err(netdev, "failed to create queues " |
@@ -545,6 +547,8 @@ vmxnet3_set_ringparam(struct net_device *netdev, | |||
545 | netdev_err(netdev, "failed to re-activate, error %d." | 547 | netdev_err(netdev, "failed to re-activate, error %d." |
546 | " Closing it\n", err); | 548 | " Closing it\n", err); |
547 | } | 549 | } |
550 | adapter->tx_ring_size = new_tx_ring_size; | ||
551 | adapter->rx_ring_size = new_rx_ring_size; | ||
548 | 552 | ||
549 | out: | 553 | out: |
550 | clear_bit(VMXNET3_STATE_BIT_RESETTING, &adapter->state); | 554 | clear_bit(VMXNET3_STATE_BIT_RESETTING, &adapter->state); |
diff --git a/drivers/net/vmxnet3/vmxnet3_int.h b/drivers/net/vmxnet3/vmxnet3_int.h index 190569d02450..29ee77f2c97f 100644 --- a/drivers/net/vmxnet3/vmxnet3_int.h +++ b/drivers/net/vmxnet3/vmxnet3_int.h | |||
@@ -349,6 +349,11 @@ struct vmxnet3_adapter { | |||
349 | u32 link_speed; /* in mbps */ | 349 | u32 link_speed; /* in mbps */ |
350 | 350 | ||
351 | u64 tx_timeout_count; | 351 | u64 tx_timeout_count; |
352 | |||
353 | /* Ring sizes */ | ||
354 | u32 tx_ring_size; | ||
355 | u32 rx_ring_size; | ||
356 | |||
352 | struct work_struct work; | 357 | struct work_struct work; |
353 | 358 | ||
354 | unsigned long state; /* VMXNET3_STATE_BIT_xxx */ | 359 | unsigned long state; /* VMXNET3_STATE_BIT_xxx */ |
diff --git a/drivers/net/wireless/b43/Kconfig b/drivers/net/wireless/b43/Kconfig index e3f67b8d3f80..40fd9b7b1426 100644 --- a/drivers/net/wireless/b43/Kconfig +++ b/drivers/net/wireless/b43/Kconfig | |||
@@ -36,7 +36,7 @@ config B43_SSB | |||
36 | choice | 36 | choice |
37 | prompt "Supported bus types" | 37 | prompt "Supported bus types" |
38 | depends on B43 | 38 | depends on B43 |
39 | default B43_BCMA_AND_SSB | 39 | default B43_BUSES_BCMA_AND_SSB |
40 | 40 | ||
41 | config B43_BUSES_BCMA_AND_SSB | 41 | config B43_BUSES_BCMA_AND_SSB |
42 | bool "BCMA and SSB" | 42 | bool "BCMA and SSB" |
diff --git a/drivers/net/wireless/b43/main.c b/drivers/net/wireless/b43/main.c index 32538ac5f7e4..0d6a0bb1f876 100644 --- a/drivers/net/wireless/b43/main.c +++ b/drivers/net/wireless/b43/main.c | |||
@@ -5221,6 +5221,7 @@ static int b43_wireless_core_attach(struct b43_wldev *dev) | |||
5221 | /* We don't support 5 GHz on some PHYs yet */ | 5221 | /* We don't support 5 GHz on some PHYs yet */ |
5222 | switch (dev->phy.type) { | 5222 | switch (dev->phy.type) { |
5223 | case B43_PHYTYPE_A: | 5223 | case B43_PHYTYPE_A: |
5224 | case B43_PHYTYPE_G: | ||
5224 | case B43_PHYTYPE_N: | 5225 | case B43_PHYTYPE_N: |
5225 | case B43_PHYTYPE_LP: | 5226 | case B43_PHYTYPE_LP: |
5226 | case B43_PHYTYPE_HT: | 5227 | case B43_PHYTYPE_HT: |
diff --git a/drivers/net/wireless/b43/xmit.c b/drivers/net/wireless/b43/xmit.c index 4f38f19b8e3d..6e6ef3fc2247 100644 --- a/drivers/net/wireless/b43/xmit.c +++ b/drivers/net/wireless/b43/xmit.c | |||
@@ -811,9 +811,13 @@ void b43_rx(struct b43_wldev *dev, struct sk_buff *skb, const void *_rxhdr) | |||
811 | break; | 811 | break; |
812 | case B43_PHYTYPE_G: | 812 | case B43_PHYTYPE_G: |
813 | status.band = IEEE80211_BAND_2GHZ; | 813 | status.band = IEEE80211_BAND_2GHZ; |
814 | /* chanid is the radio channel cookie value as used | 814 | /* Somewhere between 478.104 and 508.1084 firmware for G-PHY |
815 | * to tune the radio. */ | 815 | * has been modified to be compatible with N-PHY and others. |
816 | status.freq = chanid + 2400; | 816 | */ |
817 | if (dev->fw.rev >= 508) | ||
818 | status.freq = ieee80211_channel_to_frequency(chanid, status.band); | ||
819 | else | ||
820 | status.freq = chanid + 2400; | ||
817 | break; | 821 | break; |
818 | case B43_PHYTYPE_N: | 822 | case B43_PHYTYPE_N: |
819 | case B43_PHYTYPE_LP: | 823 | case B43_PHYTYPE_LP: |
diff --git a/drivers/net/wireless/mwifiex/pcie.c b/drivers/net/wireless/mwifiex/pcie.c index 574d4b597468..2cc9b6fca490 100644 --- a/drivers/net/wireless/mwifiex/pcie.c +++ b/drivers/net/wireless/mwifiex/pcie.c | |||
@@ -50,7 +50,7 @@ mwifiex_map_pci_memory(struct mwifiex_adapter *adapter, struct sk_buff *skb, | |||
50 | return -1; | 50 | return -1; |
51 | } | 51 | } |
52 | mapping.len = size; | 52 | mapping.len = size; |
53 | memcpy(skb->cb, &mapping, sizeof(mapping)); | 53 | mwifiex_store_mapping(skb, &mapping); |
54 | return 0; | 54 | return 0; |
55 | } | 55 | } |
56 | 56 | ||
@@ -60,7 +60,7 @@ static void mwifiex_unmap_pci_memory(struct mwifiex_adapter *adapter, | |||
60 | struct pcie_service_card *card = adapter->card; | 60 | struct pcie_service_card *card = adapter->card; |
61 | struct mwifiex_dma_mapping mapping; | 61 | struct mwifiex_dma_mapping mapping; |
62 | 62 | ||
63 | MWIFIEX_SKB_PACB(skb, &mapping); | 63 | mwifiex_get_mapping(skb, &mapping); |
64 | pci_unmap_single(card->dev, mapping.addr, mapping.len, flags); | 64 | pci_unmap_single(card->dev, mapping.addr, mapping.len, flags); |
65 | } | 65 | } |
66 | 66 | ||
diff --git a/drivers/net/wireless/mwifiex/util.h b/drivers/net/wireless/mwifiex/util.h index ddae57021397..caadb3737b9e 100644 --- a/drivers/net/wireless/mwifiex/util.h +++ b/drivers/net/wireless/mwifiex/util.h | |||
@@ -20,32 +20,55 @@ | |||
20 | #ifndef _MWIFIEX_UTIL_H_ | 20 | #ifndef _MWIFIEX_UTIL_H_ |
21 | #define _MWIFIEX_UTIL_H_ | 21 | #define _MWIFIEX_UTIL_H_ |
22 | 22 | ||
23 | struct mwifiex_dma_mapping { | ||
24 | dma_addr_t addr; | ||
25 | size_t len; | ||
26 | }; | ||
27 | |||
28 | struct mwifiex_cb { | ||
29 | struct mwifiex_dma_mapping dma_mapping; | ||
30 | union { | ||
31 | struct mwifiex_rxinfo rx_info; | ||
32 | struct mwifiex_txinfo tx_info; | ||
33 | }; | ||
34 | }; | ||
35 | |||
23 | static inline struct mwifiex_rxinfo *MWIFIEX_SKB_RXCB(struct sk_buff *skb) | 36 | static inline struct mwifiex_rxinfo *MWIFIEX_SKB_RXCB(struct sk_buff *skb) |
24 | { | 37 | { |
25 | return (struct mwifiex_rxinfo *)(skb->cb + sizeof(dma_addr_t)); | 38 | struct mwifiex_cb *cb = (struct mwifiex_cb *)skb->cb; |
39 | |||
40 | BUILD_BUG_ON(sizeof(struct mwifiex_cb) > sizeof(skb->cb)); | ||
41 | return &cb->rx_info; | ||
26 | } | 42 | } |
27 | 43 | ||
28 | static inline struct mwifiex_txinfo *MWIFIEX_SKB_TXCB(struct sk_buff *skb) | 44 | static inline struct mwifiex_txinfo *MWIFIEX_SKB_TXCB(struct sk_buff *skb) |
29 | { | 45 | { |
30 | return (struct mwifiex_txinfo *)(skb->cb + sizeof(dma_addr_t)); | 46 | struct mwifiex_cb *cb = (struct mwifiex_cb *)skb->cb; |
47 | |||
48 | return &cb->tx_info; | ||
31 | } | 49 | } |
32 | 50 | ||
33 | struct mwifiex_dma_mapping { | 51 | static inline void mwifiex_store_mapping(struct sk_buff *skb, |
34 | dma_addr_t addr; | 52 | struct mwifiex_dma_mapping *mapping) |
35 | size_t len; | 53 | { |
36 | }; | 54 | struct mwifiex_cb *cb = (struct mwifiex_cb *)skb->cb; |
55 | |||
56 | memcpy(&cb->dma_mapping, mapping, sizeof(*mapping)); | ||
57 | } | ||
37 | 58 | ||
38 | static inline void MWIFIEX_SKB_PACB(struct sk_buff *skb, | 59 | static inline void mwifiex_get_mapping(struct sk_buff *skb, |
39 | struct mwifiex_dma_mapping *mapping) | 60 | struct mwifiex_dma_mapping *mapping) |
40 | { | 61 | { |
41 | memcpy(mapping, skb->cb, sizeof(*mapping)); | 62 | struct mwifiex_cb *cb = (struct mwifiex_cb *)skb->cb; |
63 | |||
64 | memcpy(mapping, &cb->dma_mapping, sizeof(*mapping)); | ||
42 | } | 65 | } |
43 | 66 | ||
44 | static inline dma_addr_t MWIFIEX_SKB_DMA_ADDR(struct sk_buff *skb) | 67 | static inline dma_addr_t MWIFIEX_SKB_DMA_ADDR(struct sk_buff *skb) |
45 | { | 68 | { |
46 | struct mwifiex_dma_mapping mapping; | 69 | struct mwifiex_dma_mapping mapping; |
47 | 70 | ||
48 | MWIFIEX_SKB_PACB(skb, &mapping); | 71 | mwifiex_get_mapping(skb, &mapping); |
49 | 72 | ||
50 | return mapping.addr; | 73 | return mapping.addr; |
51 | } | 74 | } |
diff --git a/drivers/net/wireless/rt2x00/rt2500pci.c b/drivers/net/wireless/rt2x00/rt2500pci.c index 2f1cd929c6f6..a511cccc9f01 100644 --- a/drivers/net/wireless/rt2x00/rt2500pci.c +++ b/drivers/net/wireless/rt2x00/rt2500pci.c | |||
@@ -1681,8 +1681,13 @@ static int rt2500pci_init_eeprom(struct rt2x00_dev *rt2x00dev) | |||
1681 | /* | 1681 | /* |
1682 | * Detect if this device has an hardware controlled radio. | 1682 | * Detect if this device has an hardware controlled radio. |
1683 | */ | 1683 | */ |
1684 | if (rt2x00_get_field16(eeprom, EEPROM_ANTENNA_HARDWARE_RADIO)) | 1684 | if (rt2x00_get_field16(eeprom, EEPROM_ANTENNA_HARDWARE_RADIO)) { |
1685 | __set_bit(CAPABILITY_HW_BUTTON, &rt2x00dev->cap_flags); | 1685 | __set_bit(CAPABILITY_HW_BUTTON, &rt2x00dev->cap_flags); |
1686 | /* | ||
1687 | * On this device RFKILL initialized during probe does not work. | ||
1688 | */ | ||
1689 | __set_bit(REQUIRE_DELAYED_RFKILL, &rt2x00dev->cap_flags); | ||
1690 | } | ||
1686 | 1691 | ||
1687 | /* | 1692 | /* |
1688 | * Check if the BBP tuning should be enabled. | 1693 | * Check if the BBP tuning should be enabled. |
diff --git a/drivers/net/wireless/rt2x00/rt2800usb.c b/drivers/net/wireless/rt2x00/rt2800usb.c index a49c3d73ea2c..e11dab2216c6 100644 --- a/drivers/net/wireless/rt2x00/rt2800usb.c +++ b/drivers/net/wireless/rt2x00/rt2800usb.c | |||
@@ -229,6 +229,27 @@ static enum hrtimer_restart rt2800usb_tx_sta_fifo_timeout(struct hrtimer *timer) | |||
229 | /* | 229 | /* |
230 | * Firmware functions | 230 | * Firmware functions |
231 | */ | 231 | */ |
232 | static int rt2800usb_autorun_detect(struct rt2x00_dev *rt2x00dev) | ||
233 | { | ||
234 | __le32 reg; | ||
235 | u32 fw_mode; | ||
236 | |||
237 | /* cannot use rt2x00usb_register_read here as it uses different | ||
238 | * mode (MULTI_READ vs. DEVICE_MODE) and does not pass the | ||
239 | * magic value USB_MODE_AUTORUN (0x11) to the device, thus the | ||
240 | * returned value would be invalid. | ||
241 | */ | ||
242 | rt2x00usb_vendor_request(rt2x00dev, USB_DEVICE_MODE, | ||
243 | USB_VENDOR_REQUEST_IN, 0, USB_MODE_AUTORUN, | ||
244 | ®, sizeof(reg), REGISTER_TIMEOUT_FIRMWARE); | ||
245 | fw_mode = le32_to_cpu(reg); | ||
246 | |||
247 | if ((fw_mode & 0x00000003) == 2) | ||
248 | return 1; | ||
249 | |||
250 | return 0; | ||
251 | } | ||
252 | |||
232 | static char *rt2800usb_get_firmware_name(struct rt2x00_dev *rt2x00dev) | 253 | static char *rt2800usb_get_firmware_name(struct rt2x00_dev *rt2x00dev) |
233 | { | 254 | { |
234 | return FIRMWARE_RT2870; | 255 | return FIRMWARE_RT2870; |
@@ -257,8 +278,13 @@ static int rt2800usb_write_firmware(struct rt2x00_dev *rt2x00dev, | |||
257 | /* | 278 | /* |
258 | * Write firmware to device. | 279 | * Write firmware to device. |
259 | */ | 280 | */ |
260 | rt2x00usb_register_multiwrite(rt2x00dev, FIRMWARE_IMAGE_BASE, | 281 | if (rt2800usb_autorun_detect(rt2x00dev)) { |
261 | data + offset, length); | 282 | rt2x00_info(rt2x00dev, |
283 | "Firmware loading not required - NIC in AutoRun mode\n"); | ||
284 | } else { | ||
285 | rt2x00usb_register_multiwrite(rt2x00dev, FIRMWARE_IMAGE_BASE, | ||
286 | data + offset, length); | ||
287 | } | ||
262 | 288 | ||
263 | rt2x00usb_register_write(rt2x00dev, H2M_MAILBOX_CID, ~0); | 289 | rt2x00usb_register_write(rt2x00dev, H2M_MAILBOX_CID, ~0); |
264 | rt2x00usb_register_write(rt2x00dev, H2M_MAILBOX_STATUS, ~0); | 290 | rt2x00usb_register_write(rt2x00dev, H2M_MAILBOX_STATUS, ~0); |
@@ -735,11 +761,18 @@ static void rt2800usb_fill_rxdone(struct queue_entry *entry, | |||
735 | /* | 761 | /* |
736 | * Device probe functions. | 762 | * Device probe functions. |
737 | */ | 763 | */ |
764 | static int rt2800usb_efuse_detect(struct rt2x00_dev *rt2x00dev) | ||
765 | { | ||
766 | if (rt2800usb_autorun_detect(rt2x00dev)) | ||
767 | return 1; | ||
768 | return rt2800_efuse_detect(rt2x00dev); | ||
769 | } | ||
770 | |||
738 | static int rt2800usb_read_eeprom(struct rt2x00_dev *rt2x00dev) | 771 | static int rt2800usb_read_eeprom(struct rt2x00_dev *rt2x00dev) |
739 | { | 772 | { |
740 | int retval; | 773 | int retval; |
741 | 774 | ||
742 | if (rt2800_efuse_detect(rt2x00dev)) | 775 | if (rt2800usb_efuse_detect(rt2x00dev)) |
743 | retval = rt2800_read_eeprom_efuse(rt2x00dev); | 776 | retval = rt2800_read_eeprom_efuse(rt2x00dev); |
744 | else | 777 | else |
745 | retval = rt2x00usb_eeprom_read(rt2x00dev, rt2x00dev->eeprom, | 778 | retval = rt2x00usb_eeprom_read(rt2x00dev, rt2x00dev->eeprom, |
diff --git a/drivers/net/wireless/rt2x00/rt2x00.h b/drivers/net/wireless/rt2x00/rt2x00.h index 010b76505243..d13f25cd70d5 100644 --- a/drivers/net/wireless/rt2x00/rt2x00.h +++ b/drivers/net/wireless/rt2x00/rt2x00.h | |||
@@ -693,6 +693,7 @@ enum rt2x00_capability_flags { | |||
693 | REQUIRE_SW_SEQNO, | 693 | REQUIRE_SW_SEQNO, |
694 | REQUIRE_HT_TX_DESC, | 694 | REQUIRE_HT_TX_DESC, |
695 | REQUIRE_PS_AUTOWAKE, | 695 | REQUIRE_PS_AUTOWAKE, |
696 | REQUIRE_DELAYED_RFKILL, | ||
696 | 697 | ||
697 | /* | 698 | /* |
698 | * Capabilities | 699 | * Capabilities |
diff --git a/drivers/net/wireless/rt2x00/rt2x00dev.c b/drivers/net/wireless/rt2x00/rt2x00dev.c index 2bde6729f5e6..4fa43a2eeb73 100644 --- a/drivers/net/wireless/rt2x00/rt2x00dev.c +++ b/drivers/net/wireless/rt2x00/rt2x00dev.c | |||
@@ -1126,9 +1126,10 @@ static void rt2x00lib_uninitialize(struct rt2x00_dev *rt2x00dev) | |||
1126 | return; | 1126 | return; |
1127 | 1127 | ||
1128 | /* | 1128 | /* |
1129 | * Unregister extra components. | 1129 | * Stop rfkill polling. |
1130 | */ | 1130 | */ |
1131 | rt2x00rfkill_unregister(rt2x00dev); | 1131 | if (test_bit(REQUIRE_DELAYED_RFKILL, &rt2x00dev->cap_flags)) |
1132 | rt2x00rfkill_unregister(rt2x00dev); | ||
1132 | 1133 | ||
1133 | /* | 1134 | /* |
1134 | * Allow the HW to uninitialize. | 1135 | * Allow the HW to uninitialize. |
@@ -1166,6 +1167,12 @@ static int rt2x00lib_initialize(struct rt2x00_dev *rt2x00dev) | |||
1166 | 1167 | ||
1167 | set_bit(DEVICE_STATE_INITIALIZED, &rt2x00dev->flags); | 1168 | set_bit(DEVICE_STATE_INITIALIZED, &rt2x00dev->flags); |
1168 | 1169 | ||
1170 | /* | ||
1171 | * Start rfkill polling. | ||
1172 | */ | ||
1173 | if (test_bit(REQUIRE_DELAYED_RFKILL, &rt2x00dev->cap_flags)) | ||
1174 | rt2x00rfkill_register(rt2x00dev); | ||
1175 | |||
1169 | return 0; | 1176 | return 0; |
1170 | } | 1177 | } |
1171 | 1178 | ||
@@ -1375,7 +1382,12 @@ int rt2x00lib_probe_dev(struct rt2x00_dev *rt2x00dev) | |||
1375 | rt2x00link_register(rt2x00dev); | 1382 | rt2x00link_register(rt2x00dev); |
1376 | rt2x00leds_register(rt2x00dev); | 1383 | rt2x00leds_register(rt2x00dev); |
1377 | rt2x00debug_register(rt2x00dev); | 1384 | rt2x00debug_register(rt2x00dev); |
1378 | rt2x00rfkill_register(rt2x00dev); | 1385 | |
1386 | /* | ||
1387 | * Start rfkill polling. | ||
1388 | */ | ||
1389 | if (!test_bit(REQUIRE_DELAYED_RFKILL, &rt2x00dev->cap_flags)) | ||
1390 | rt2x00rfkill_register(rt2x00dev); | ||
1379 | 1391 | ||
1380 | return 0; | 1392 | return 0; |
1381 | 1393 | ||
@@ -1391,6 +1403,12 @@ void rt2x00lib_remove_dev(struct rt2x00_dev *rt2x00dev) | |||
1391 | clear_bit(DEVICE_STATE_PRESENT, &rt2x00dev->flags); | 1403 | clear_bit(DEVICE_STATE_PRESENT, &rt2x00dev->flags); |
1392 | 1404 | ||
1393 | /* | 1405 | /* |
1406 | * Stop rfkill polling. | ||
1407 | */ | ||
1408 | if (!test_bit(REQUIRE_DELAYED_RFKILL, &rt2x00dev->cap_flags)) | ||
1409 | rt2x00rfkill_unregister(rt2x00dev); | ||
1410 | |||
1411 | /* | ||
1394 | * Disable radio. | 1412 | * Disable radio. |
1395 | */ | 1413 | */ |
1396 | rt2x00lib_disable_radio(rt2x00dev); | 1414 | rt2x00lib_disable_radio(rt2x00dev); |
diff --git a/drivers/net/wireless/rt2x00/rt2x00mac.c b/drivers/net/wireless/rt2x00/rt2x00mac.c index 212ac4842c16..004dff9b962d 100644 --- a/drivers/net/wireless/rt2x00/rt2x00mac.c +++ b/drivers/net/wireless/rt2x00/rt2x00mac.c | |||
@@ -487,6 +487,8 @@ int rt2x00mac_set_key(struct ieee80211_hw *hw, enum set_key_cmd cmd, | |||
487 | crypto.cipher = rt2x00crypto_key_to_cipher(key); | 487 | crypto.cipher = rt2x00crypto_key_to_cipher(key); |
488 | if (crypto.cipher == CIPHER_NONE) | 488 | if (crypto.cipher == CIPHER_NONE) |
489 | return -EOPNOTSUPP; | 489 | return -EOPNOTSUPP; |
490 | if (crypto.cipher == CIPHER_TKIP && rt2x00_is_usb(rt2x00dev)) | ||
491 | return -EOPNOTSUPP; | ||
490 | 492 | ||
491 | crypto.cmd = cmd; | 493 | crypto.cmd = cmd; |
492 | 494 | ||
diff --git a/drivers/net/wireless/rt2x00/rt2x00usb.h b/drivers/net/wireless/rt2x00/rt2x00usb.h index e7bcf62347d5..831b65f93feb 100644 --- a/drivers/net/wireless/rt2x00/rt2x00usb.h +++ b/drivers/net/wireless/rt2x00/rt2x00usb.h | |||
@@ -93,6 +93,7 @@ enum rt2x00usb_mode_offset { | |||
93 | USB_MODE_SLEEP = 7, /* RT73USB */ | 93 | USB_MODE_SLEEP = 7, /* RT73USB */ |
94 | USB_MODE_FIRMWARE = 8, /* RT73USB */ | 94 | USB_MODE_FIRMWARE = 8, /* RT73USB */ |
95 | USB_MODE_WAKEUP = 9, /* RT73USB */ | 95 | USB_MODE_WAKEUP = 9, /* RT73USB */ |
96 | USB_MODE_AUTORUN = 17, /* RT2800USB */ | ||
96 | }; | 97 | }; |
97 | 98 | ||
98 | /** | 99 | /** |
diff --git a/drivers/net/xen-netback/common.h b/drivers/net/xen-netback/common.h index 4dd7c4a1923b..2532ce85d718 100644 --- a/drivers/net/xen-netback/common.h +++ b/drivers/net/xen-netback/common.h | |||
@@ -222,6 +222,7 @@ struct xenvif { | |||
222 | 222 | ||
223 | /* Queues */ | 223 | /* Queues */ |
224 | struct xenvif_queue *queues; | 224 | struct xenvif_queue *queues; |
225 | unsigned int num_queues; /* active queues, resource allocated */ | ||
225 | 226 | ||
226 | /* Miscellaneous private stuff. */ | 227 | /* Miscellaneous private stuff. */ |
227 | struct net_device *dev; | 228 | struct net_device *dev; |
diff --git a/drivers/net/xen-netback/interface.c b/drivers/net/xen-netback/interface.c index 852da34b8961..9e97c7ca0ddd 100644 --- a/drivers/net/xen-netback/interface.c +++ b/drivers/net/xen-netback/interface.c | |||
@@ -137,32 +137,11 @@ static void xenvif_wake_queue_callback(unsigned long data) | |||
137 | } | 137 | } |
138 | } | 138 | } |
139 | 139 | ||
140 | static u16 xenvif_select_queue(struct net_device *dev, struct sk_buff *skb, | ||
141 | void *accel_priv, select_queue_fallback_t fallback) | ||
142 | { | ||
143 | unsigned int num_queues = dev->real_num_tx_queues; | ||
144 | u32 hash; | ||
145 | u16 queue_index; | ||
146 | |||
147 | /* First, check if there is only one queue to optimise the | ||
148 | * single-queue or old frontend scenario. | ||
149 | */ | ||
150 | if (num_queues == 1) { | ||
151 | queue_index = 0; | ||
152 | } else { | ||
153 | /* Use skb_get_hash to obtain an L4 hash if available */ | ||
154 | hash = skb_get_hash(skb); | ||
155 | queue_index = hash % num_queues; | ||
156 | } | ||
157 | |||
158 | return queue_index; | ||
159 | } | ||
160 | |||
161 | static int xenvif_start_xmit(struct sk_buff *skb, struct net_device *dev) | 140 | static int xenvif_start_xmit(struct sk_buff *skb, struct net_device *dev) |
162 | { | 141 | { |
163 | struct xenvif *vif = netdev_priv(dev); | 142 | struct xenvif *vif = netdev_priv(dev); |
164 | struct xenvif_queue *queue = NULL; | 143 | struct xenvif_queue *queue = NULL; |
165 | unsigned int num_queues = dev->real_num_tx_queues; | 144 | unsigned int num_queues = vif->num_queues; |
166 | u16 index; | 145 | u16 index; |
167 | int min_slots_needed; | 146 | int min_slots_needed; |
168 | 147 | ||
@@ -225,7 +204,7 @@ static struct net_device_stats *xenvif_get_stats(struct net_device *dev) | |||
225 | { | 204 | { |
226 | struct xenvif *vif = netdev_priv(dev); | 205 | struct xenvif *vif = netdev_priv(dev); |
227 | struct xenvif_queue *queue = NULL; | 206 | struct xenvif_queue *queue = NULL; |
228 | unsigned int num_queues = dev->real_num_tx_queues; | 207 | unsigned int num_queues = vif->num_queues; |
229 | unsigned long rx_bytes = 0; | 208 | unsigned long rx_bytes = 0; |
230 | unsigned long rx_packets = 0; | 209 | unsigned long rx_packets = 0; |
231 | unsigned long tx_bytes = 0; | 210 | unsigned long tx_bytes = 0; |
@@ -256,7 +235,7 @@ out: | |||
256 | static void xenvif_up(struct xenvif *vif) | 235 | static void xenvif_up(struct xenvif *vif) |
257 | { | 236 | { |
258 | struct xenvif_queue *queue = NULL; | 237 | struct xenvif_queue *queue = NULL; |
259 | unsigned int num_queues = vif->dev->real_num_tx_queues; | 238 | unsigned int num_queues = vif->num_queues; |
260 | unsigned int queue_index; | 239 | unsigned int queue_index; |
261 | 240 | ||
262 | for (queue_index = 0; queue_index < num_queues; ++queue_index) { | 241 | for (queue_index = 0; queue_index < num_queues; ++queue_index) { |
@@ -272,7 +251,7 @@ static void xenvif_up(struct xenvif *vif) | |||
272 | static void xenvif_down(struct xenvif *vif) | 251 | static void xenvif_down(struct xenvif *vif) |
273 | { | 252 | { |
274 | struct xenvif_queue *queue = NULL; | 253 | struct xenvif_queue *queue = NULL; |
275 | unsigned int num_queues = vif->dev->real_num_tx_queues; | 254 | unsigned int num_queues = vif->num_queues; |
276 | unsigned int queue_index; | 255 | unsigned int queue_index; |
277 | 256 | ||
278 | for (queue_index = 0; queue_index < num_queues; ++queue_index) { | 257 | for (queue_index = 0; queue_index < num_queues; ++queue_index) { |
@@ -379,7 +358,7 @@ static void xenvif_get_ethtool_stats(struct net_device *dev, | |||
379 | struct ethtool_stats *stats, u64 * data) | 358 | struct ethtool_stats *stats, u64 * data) |
380 | { | 359 | { |
381 | struct xenvif *vif = netdev_priv(dev); | 360 | struct xenvif *vif = netdev_priv(dev); |
382 | unsigned int num_queues = dev->real_num_tx_queues; | 361 | unsigned int num_queues = vif->num_queues; |
383 | int i; | 362 | int i; |
384 | unsigned int queue_index; | 363 | unsigned int queue_index; |
385 | struct xenvif_stats *vif_stats; | 364 | struct xenvif_stats *vif_stats; |
@@ -424,7 +403,6 @@ static const struct net_device_ops xenvif_netdev_ops = { | |||
424 | .ndo_fix_features = xenvif_fix_features, | 403 | .ndo_fix_features = xenvif_fix_features, |
425 | .ndo_set_mac_address = eth_mac_addr, | 404 | .ndo_set_mac_address = eth_mac_addr, |
426 | .ndo_validate_addr = eth_validate_addr, | 405 | .ndo_validate_addr = eth_validate_addr, |
427 | .ndo_select_queue = xenvif_select_queue, | ||
428 | }; | 406 | }; |
429 | 407 | ||
430 | struct xenvif *xenvif_alloc(struct device *parent, domid_t domid, | 408 | struct xenvif *xenvif_alloc(struct device *parent, domid_t domid, |
@@ -438,7 +416,7 @@ struct xenvif *xenvif_alloc(struct device *parent, domid_t domid, | |||
438 | snprintf(name, IFNAMSIZ - 1, "vif%u.%u", domid, handle); | 416 | snprintf(name, IFNAMSIZ - 1, "vif%u.%u", domid, handle); |
439 | /* Allocate a netdev with the max. supported number of queues. | 417 | /* Allocate a netdev with the max. supported number of queues. |
440 | * When the guest selects the desired number, it will be updated | 418 | * When the guest selects the desired number, it will be updated |
441 | * via netif_set_real_num_tx_queues(). | 419 | * via netif_set_real_num_*_queues(). |
442 | */ | 420 | */ |
443 | dev = alloc_netdev_mq(sizeof(struct xenvif), name, ether_setup, | 421 | dev = alloc_netdev_mq(sizeof(struct xenvif), name, ether_setup, |
444 | xenvif_max_queues); | 422 | xenvif_max_queues); |
@@ -458,11 +436,9 @@ struct xenvif *xenvif_alloc(struct device *parent, domid_t domid, | |||
458 | vif->dev = dev; | 436 | vif->dev = dev; |
459 | vif->disabled = false; | 437 | vif->disabled = false; |
460 | 438 | ||
461 | /* Start out with no queues. The call below does not require | 439 | /* Start out with no queues. */ |
462 | * rtnl_lock() as it happens before register_netdev(). | ||
463 | */ | ||
464 | vif->queues = NULL; | 440 | vif->queues = NULL; |
465 | netif_set_real_num_tx_queues(dev, 0); | 441 | vif->num_queues = 0; |
466 | 442 | ||
467 | dev->netdev_ops = &xenvif_netdev_ops; | 443 | dev->netdev_ops = &xenvif_netdev_ops; |
468 | dev->hw_features = NETIF_F_SG | | 444 | dev->hw_features = NETIF_F_SG | |
@@ -677,7 +653,7 @@ static void xenvif_wait_unmap_timeout(struct xenvif_queue *queue, | |||
677 | void xenvif_disconnect(struct xenvif *vif) | 653 | void xenvif_disconnect(struct xenvif *vif) |
678 | { | 654 | { |
679 | struct xenvif_queue *queue = NULL; | 655 | struct xenvif_queue *queue = NULL; |
680 | unsigned int num_queues = vif->dev->real_num_tx_queues; | 656 | unsigned int num_queues = vif->num_queues; |
681 | unsigned int queue_index; | 657 | unsigned int queue_index; |
682 | 658 | ||
683 | if (netif_carrier_ok(vif->dev)) | 659 | if (netif_carrier_ok(vif->dev)) |
@@ -724,7 +700,7 @@ void xenvif_deinit_queue(struct xenvif_queue *queue) | |||
724 | void xenvif_free(struct xenvif *vif) | 700 | void xenvif_free(struct xenvif *vif) |
725 | { | 701 | { |
726 | struct xenvif_queue *queue = NULL; | 702 | struct xenvif_queue *queue = NULL; |
727 | unsigned int num_queues = vif->dev->real_num_tx_queues; | 703 | unsigned int num_queues = vif->num_queues; |
728 | unsigned int queue_index; | 704 | unsigned int queue_index; |
729 | /* Here we want to avoid timeout messages if an skb can be legitimately | 705 | /* Here we want to avoid timeout messages if an skb can be legitimately |
730 | * stuck somewhere else. Realistically this could be an another vif's | 706 | * stuck somewhere else. Realistically this could be an another vif's |
@@ -748,12 +724,9 @@ void xenvif_free(struct xenvif *vif) | |||
748 | xenvif_deinit_queue(queue); | 724 | xenvif_deinit_queue(queue); |
749 | } | 725 | } |
750 | 726 | ||
751 | /* Free the array of queues. The call below does not require | ||
752 | * rtnl_lock() because it happens after unregister_netdev(). | ||
753 | */ | ||
754 | netif_set_real_num_tx_queues(vif->dev, 0); | ||
755 | vfree(vif->queues); | 727 | vfree(vif->queues); |
756 | vif->queues = NULL; | 728 | vif->queues = NULL; |
729 | vif->num_queues = 0; | ||
757 | 730 | ||
758 | free_netdev(vif->dev); | 731 | free_netdev(vif->dev); |
759 | 732 | ||
diff --git a/drivers/net/xen-netback/xenbus.c b/drivers/net/xen-netback/xenbus.c index 96c63dc2509e..3d85acd84bad 100644 --- a/drivers/net/xen-netback/xenbus.c +++ b/drivers/net/xen-netback/xenbus.c | |||
@@ -527,9 +527,7 @@ static void connect(struct backend_info *be) | |||
527 | /* Use the number of queues requested by the frontend */ | 527 | /* Use the number of queues requested by the frontend */ |
528 | be->vif->queues = vzalloc(requested_num_queues * | 528 | be->vif->queues = vzalloc(requested_num_queues * |
529 | sizeof(struct xenvif_queue)); | 529 | sizeof(struct xenvif_queue)); |
530 | rtnl_lock(); | 530 | be->vif->num_queues = requested_num_queues; |
531 | netif_set_real_num_tx_queues(be->vif->dev, requested_num_queues); | ||
532 | rtnl_unlock(); | ||
533 | 531 | ||
534 | for (queue_index = 0; queue_index < requested_num_queues; ++queue_index) { | 532 | for (queue_index = 0; queue_index < requested_num_queues; ++queue_index) { |
535 | queue = &be->vif->queues[queue_index]; | 533 | queue = &be->vif->queues[queue_index]; |
@@ -546,9 +544,7 @@ static void connect(struct backend_info *be) | |||
546 | * earlier queues can be destroyed using the regular | 544 | * earlier queues can be destroyed using the regular |
547 | * disconnect logic. | 545 | * disconnect logic. |
548 | */ | 546 | */ |
549 | rtnl_lock(); | 547 | be->vif->num_queues = queue_index; |
550 | netif_set_real_num_tx_queues(be->vif->dev, queue_index); | ||
551 | rtnl_unlock(); | ||
552 | goto err; | 548 | goto err; |
553 | } | 549 | } |
554 | 550 | ||
@@ -561,13 +557,19 @@ static void connect(struct backend_info *be) | |||
561 | * and also clean up any previously initialised queues. | 557 | * and also clean up any previously initialised queues. |
562 | */ | 558 | */ |
563 | xenvif_deinit_queue(queue); | 559 | xenvif_deinit_queue(queue); |
564 | rtnl_lock(); | 560 | be->vif->num_queues = queue_index; |
565 | netif_set_real_num_tx_queues(be->vif->dev, queue_index); | ||
566 | rtnl_unlock(); | ||
567 | goto err; | 561 | goto err; |
568 | } | 562 | } |
569 | } | 563 | } |
570 | 564 | ||
565 | /* Initialisation completed, tell core driver the number of | ||
566 | * active queues. | ||
567 | */ | ||
568 | rtnl_lock(); | ||
569 | netif_set_real_num_tx_queues(be->vif->dev, requested_num_queues); | ||
570 | netif_set_real_num_rx_queues(be->vif->dev, requested_num_queues); | ||
571 | rtnl_unlock(); | ||
572 | |||
571 | xenvif_carrier_on(be->vif); | 573 | xenvif_carrier_on(be->vif); |
572 | 574 | ||
573 | unregister_hotplug_status_watch(be); | 575 | unregister_hotplug_status_watch(be); |
@@ -582,13 +584,11 @@ static void connect(struct backend_info *be) | |||
582 | return; | 584 | return; |
583 | 585 | ||
584 | err: | 586 | err: |
585 | if (be->vif->dev->real_num_tx_queues > 0) | 587 | if (be->vif->num_queues > 0) |
586 | xenvif_disconnect(be->vif); /* Clean up existing queues */ | 588 | xenvif_disconnect(be->vif); /* Clean up existing queues */ |
587 | vfree(be->vif->queues); | 589 | vfree(be->vif->queues); |
588 | be->vif->queues = NULL; | 590 | be->vif->queues = NULL; |
589 | rtnl_lock(); | 591 | be->vif->num_queues = 0; |
590 | netif_set_real_num_tx_queues(be->vif->dev, 0); | ||
591 | rtnl_unlock(); | ||
592 | return; | 592 | return; |
593 | } | 593 | } |
594 | 594 | ||
@@ -596,7 +596,7 @@ err: | |||
596 | static int connect_rings(struct backend_info *be, struct xenvif_queue *queue) | 596 | static int connect_rings(struct backend_info *be, struct xenvif_queue *queue) |
597 | { | 597 | { |
598 | struct xenbus_device *dev = be->dev; | 598 | struct xenbus_device *dev = be->dev; |
599 | unsigned int num_queues = queue->vif->dev->real_num_tx_queues; | 599 | unsigned int num_queues = queue->vif->num_queues; |
600 | unsigned long tx_ring_ref, rx_ring_ref; | 600 | unsigned long tx_ring_ref, rx_ring_ref; |
601 | unsigned int tx_evtchn, rx_evtchn; | 601 | unsigned int tx_evtchn, rx_evtchn; |
602 | int err; | 602 | int err; |
diff --git a/drivers/net/xen-netfront.c b/drivers/net/xen-netfront.c index 5a7872ac3566..2ccb4a02368b 100644 --- a/drivers/net/xen-netfront.c +++ b/drivers/net/xen-netfront.c | |||
@@ -1287,7 +1287,7 @@ static irqreturn_t xennet_rx_interrupt(int irq, void *dev_id) | |||
1287 | 1287 | ||
1288 | if (likely(netif_carrier_ok(dev) && | 1288 | if (likely(netif_carrier_ok(dev) && |
1289 | RING_HAS_UNCONSUMED_RESPONSES(&queue->rx))) | 1289 | RING_HAS_UNCONSUMED_RESPONSES(&queue->rx))) |
1290 | napi_schedule(&queue->napi); | 1290 | napi_schedule(&queue->napi); |
1291 | 1291 | ||
1292 | return IRQ_HANDLED; | 1292 | return IRQ_HANDLED; |
1293 | } | 1293 | } |
@@ -1437,10 +1437,11 @@ static void xennet_end_access(int ref, void *page) | |||
1437 | static void xennet_disconnect_backend(struct netfront_info *info) | 1437 | static void xennet_disconnect_backend(struct netfront_info *info) |
1438 | { | 1438 | { |
1439 | unsigned int i = 0; | 1439 | unsigned int i = 0; |
1440 | struct netfront_queue *queue = NULL; | ||
1441 | unsigned int num_queues = info->netdev->real_num_tx_queues; | 1440 | unsigned int num_queues = info->netdev->real_num_tx_queues; |
1442 | 1441 | ||
1443 | for (i = 0; i < num_queues; ++i) { | 1442 | for (i = 0; i < num_queues; ++i) { |
1443 | struct netfront_queue *queue = &info->queues[i]; | ||
1444 | |||
1444 | /* Stop old i/f to prevent errors whilst we rebuild the state. */ | 1445 | /* Stop old i/f to prevent errors whilst we rebuild the state. */ |
1445 | spin_lock_bh(&queue->rx_lock); | 1446 | spin_lock_bh(&queue->rx_lock); |
1446 | spin_lock_irq(&queue->tx_lock); | 1447 | spin_lock_irq(&queue->tx_lock); |
@@ -1698,8 +1699,6 @@ static int xennet_init_queue(struct netfront_queue *queue) | |||
1698 | goto exit_free_tx; | 1699 | goto exit_free_tx; |
1699 | } | 1700 | } |
1700 | 1701 | ||
1701 | netif_napi_add(queue->info->netdev, &queue->napi, xennet_poll, 64); | ||
1702 | |||
1703 | return 0; | 1702 | return 0; |
1704 | 1703 | ||
1705 | exit_free_tx: | 1704 | exit_free_tx: |
@@ -1790,6 +1789,70 @@ error: | |||
1790 | return err; | 1789 | return err; |
1791 | } | 1790 | } |
1792 | 1791 | ||
1792 | static void xennet_destroy_queues(struct netfront_info *info) | ||
1793 | { | ||
1794 | unsigned int i; | ||
1795 | |||
1796 | rtnl_lock(); | ||
1797 | |||
1798 | for (i = 0; i < info->netdev->real_num_tx_queues; i++) { | ||
1799 | struct netfront_queue *queue = &info->queues[i]; | ||
1800 | |||
1801 | if (netif_running(info->netdev)) | ||
1802 | napi_disable(&queue->napi); | ||
1803 | netif_napi_del(&queue->napi); | ||
1804 | } | ||
1805 | |||
1806 | rtnl_unlock(); | ||
1807 | |||
1808 | kfree(info->queues); | ||
1809 | info->queues = NULL; | ||
1810 | } | ||
1811 | |||
1812 | static int xennet_create_queues(struct netfront_info *info, | ||
1813 | unsigned int num_queues) | ||
1814 | { | ||
1815 | unsigned int i; | ||
1816 | int ret; | ||
1817 | |||
1818 | info->queues = kcalloc(num_queues, sizeof(struct netfront_queue), | ||
1819 | GFP_KERNEL); | ||
1820 | if (!info->queues) | ||
1821 | return -ENOMEM; | ||
1822 | |||
1823 | rtnl_lock(); | ||
1824 | |||
1825 | for (i = 0; i < num_queues; i++) { | ||
1826 | struct netfront_queue *queue = &info->queues[i]; | ||
1827 | |||
1828 | queue->id = i; | ||
1829 | queue->info = info; | ||
1830 | |||
1831 | ret = xennet_init_queue(queue); | ||
1832 | if (ret < 0) { | ||
1833 | dev_warn(&info->netdev->dev, "only created %d queues\n", | ||
1834 | num_queues); | ||
1835 | num_queues = i; | ||
1836 | break; | ||
1837 | } | ||
1838 | |||
1839 | netif_napi_add(queue->info->netdev, &queue->napi, | ||
1840 | xennet_poll, 64); | ||
1841 | if (netif_running(info->netdev)) | ||
1842 | napi_enable(&queue->napi); | ||
1843 | } | ||
1844 | |||
1845 | netif_set_real_num_tx_queues(info->netdev, num_queues); | ||
1846 | |||
1847 | rtnl_unlock(); | ||
1848 | |||
1849 | if (num_queues == 0) { | ||
1850 | dev_err(&info->netdev->dev, "no queues\n"); | ||
1851 | return -EINVAL; | ||
1852 | } | ||
1853 | return 0; | ||
1854 | } | ||
1855 | |||
1793 | /* Common code used when first setting up, and when resuming. */ | 1856 | /* Common code used when first setting up, and when resuming. */ |
1794 | static int talk_to_netback(struct xenbus_device *dev, | 1857 | static int talk_to_netback(struct xenbus_device *dev, |
1795 | struct netfront_info *info) | 1858 | struct netfront_info *info) |
@@ -1826,42 +1889,20 @@ static int talk_to_netback(struct xenbus_device *dev, | |||
1826 | goto out; | 1889 | goto out; |
1827 | } | 1890 | } |
1828 | 1891 | ||
1829 | /* Allocate array of queues */ | 1892 | if (info->queues) |
1830 | info->queues = kcalloc(num_queues, sizeof(struct netfront_queue), GFP_KERNEL); | 1893 | xennet_destroy_queues(info); |
1831 | if (!info->queues) { | 1894 | |
1832 | err = -ENOMEM; | 1895 | err = xennet_create_queues(info, num_queues); |
1833 | goto out; | 1896 | if (err < 0) |
1834 | } | 1897 | goto destroy_ring; |
1835 | rtnl_lock(); | ||
1836 | netif_set_real_num_tx_queues(info->netdev, num_queues); | ||
1837 | rtnl_unlock(); | ||
1838 | 1898 | ||
1839 | /* Create shared ring, alloc event channel -- for each queue */ | 1899 | /* Create shared ring, alloc event channel -- for each queue */ |
1840 | for (i = 0; i < num_queues; ++i) { | 1900 | for (i = 0; i < num_queues; ++i) { |
1841 | queue = &info->queues[i]; | 1901 | queue = &info->queues[i]; |
1842 | queue->id = i; | ||
1843 | queue->info = info; | ||
1844 | err = xennet_init_queue(queue); | ||
1845 | if (err) { | ||
1846 | /* xennet_init_queue() cleans up after itself on failure, | ||
1847 | * but we still have to clean up any previously initialised | ||
1848 | * queues. If i > 0, set num_queues to i, then goto | ||
1849 | * destroy_ring, which calls xennet_disconnect_backend() | ||
1850 | * to tidy up. | ||
1851 | */ | ||
1852 | if (i > 0) { | ||
1853 | rtnl_lock(); | ||
1854 | netif_set_real_num_tx_queues(info->netdev, i); | ||
1855 | rtnl_unlock(); | ||
1856 | goto destroy_ring; | ||
1857 | } else { | ||
1858 | goto out; | ||
1859 | } | ||
1860 | } | ||
1861 | err = setup_netfront(dev, queue, feature_split_evtchn); | 1902 | err = setup_netfront(dev, queue, feature_split_evtchn); |
1862 | if (err) { | 1903 | if (err) { |
1863 | /* As for xennet_init_queue(), setup_netfront() will tidy | 1904 | /* setup_netfront() will tidy up the current |
1864 | * up the current queue on error, but we need to clean up | 1905 | * queue on error, but we need to clean up |
1865 | * those already allocated. | 1906 | * those already allocated. |
1866 | */ | 1907 | */ |
1867 | if (i > 0) { | 1908 | if (i > 0) { |
diff --git a/drivers/of/base.c b/drivers/of/base.c index 8368d96ae7b4..b9864806e9b8 100644 --- a/drivers/of/base.c +++ b/drivers/of/base.c | |||
@@ -227,7 +227,8 @@ static int __of_node_add(struct device_node *np) | |||
227 | np->kobj.kset = of_kset; | 227 | np->kobj.kset = of_kset; |
228 | if (!np->parent) { | 228 | if (!np->parent) { |
229 | /* Nodes without parents are new top level trees */ | 229 | /* Nodes without parents are new top level trees */ |
230 | rc = kobject_add(&np->kobj, NULL, safe_name(&of_kset->kobj, "base")); | 230 | rc = kobject_add(&np->kobj, NULL, "%s", |
231 | safe_name(&of_kset->kobj, "base")); | ||
231 | } else { | 232 | } else { |
232 | name = safe_name(&np->parent->kobj, kbasename(np->full_name)); | 233 | name = safe_name(&np->parent->kobj, kbasename(np->full_name)); |
233 | if (!name || !name[0]) | 234 | if (!name || !name[0]) |
@@ -1960,9 +1961,9 @@ int of_attach_node(struct device_node *np) | |||
1960 | 1961 | ||
1961 | raw_spin_lock_irqsave(&devtree_lock, flags); | 1962 | raw_spin_lock_irqsave(&devtree_lock, flags); |
1962 | np->sibling = np->parent->child; | 1963 | np->sibling = np->parent->child; |
1963 | np->allnext = of_allnodes; | 1964 | np->allnext = np->parent->allnext; |
1965 | np->parent->allnext = np; | ||
1964 | np->parent->child = np; | 1966 | np->parent->child = np; |
1965 | of_allnodes = np; | ||
1966 | of_node_clear_flag(np, OF_DETACHED); | 1967 | of_node_clear_flag(np, OF_DETACHED); |
1967 | raw_spin_unlock_irqrestore(&devtree_lock, flags); | 1968 | raw_spin_unlock_irqrestore(&devtree_lock, flags); |
1968 | 1969 | ||
diff --git a/drivers/of/fdt.c b/drivers/of/fdt.c index c4cddf0cd96d..b777d8f46bd5 100644 --- a/drivers/of/fdt.c +++ b/drivers/of/fdt.c | |||
@@ -880,6 +880,21 @@ void __init __weak early_init_dt_add_memory_arch(u64 base, u64 size) | |||
880 | const u64 phys_offset = __pa(PAGE_OFFSET); | 880 | const u64 phys_offset = __pa(PAGE_OFFSET); |
881 | base &= PAGE_MASK; | 881 | base &= PAGE_MASK; |
882 | size &= PAGE_MASK; | 882 | size &= PAGE_MASK; |
883 | |||
884 | if (sizeof(phys_addr_t) < sizeof(u64)) { | ||
885 | if (base > ULONG_MAX) { | ||
886 | pr_warning("Ignoring memory block 0x%llx - 0x%llx\n", | ||
887 | base, base + size); | ||
888 | return; | ||
889 | } | ||
890 | |||
891 | if (base + size > ULONG_MAX) { | ||
892 | pr_warning("Ignoring memory range 0x%lx - 0x%llx\n", | ||
893 | ULONG_MAX, base + size); | ||
894 | size = ULONG_MAX - base; | ||
895 | } | ||
896 | } | ||
897 | |||
883 | if (base + size < phys_offset) { | 898 | if (base + size < phys_offset) { |
884 | pr_warning("Ignoring memory block 0x%llx - 0x%llx\n", | 899 | pr_warning("Ignoring memory block 0x%llx - 0x%llx\n", |
885 | base, base + size); | 900 | base, base + size); |
diff --git a/drivers/of/of_mdio.c b/drivers/of/of_mdio.c index fb4a59830648..a3bf2122a8d5 100644 --- a/drivers/of/of_mdio.c +++ b/drivers/of/of_mdio.c | |||
@@ -323,11 +323,13 @@ int of_phy_register_fixed_link(struct device_node *np) | |||
323 | fixed_link_node = of_get_child_by_name(np, "fixed-link"); | 323 | fixed_link_node = of_get_child_by_name(np, "fixed-link"); |
324 | if (fixed_link_node) { | 324 | if (fixed_link_node) { |
325 | status.link = 1; | 325 | status.link = 1; |
326 | status.duplex = of_property_read_bool(np, "full-duplex"); | 326 | status.duplex = of_property_read_bool(fixed_link_node, |
327 | "full-duplex"); | ||
327 | if (of_property_read_u32(fixed_link_node, "speed", &status.speed)) | 328 | if (of_property_read_u32(fixed_link_node, "speed", &status.speed)) |
328 | return -EINVAL; | 329 | return -EINVAL; |
329 | status.pause = of_property_read_bool(np, "pause"); | 330 | status.pause = of_property_read_bool(fixed_link_node, "pause"); |
330 | status.asym_pause = of_property_read_bool(np, "asym-pause"); | 331 | status.asym_pause = of_property_read_bool(fixed_link_node, |
332 | "asym-pause"); | ||
331 | of_node_put(fixed_link_node); | 333 | of_node_put(fixed_link_node); |
332 | return fixed_phy_register(PHY_POLL, &status, np); | 334 | return fixed_phy_register(PHY_POLL, &status, np); |
333 | } | 335 | } |
diff --git a/drivers/of/platform.c b/drivers/of/platform.c index 6c48d73a7fd7..500436f9be7f 100644 --- a/drivers/of/platform.c +++ b/drivers/of/platform.c | |||
@@ -166,10 +166,6 @@ static void of_dma_configure(struct platform_device *pdev) | |||
166 | int ret; | 166 | int ret; |
167 | struct device *dev = &pdev->dev; | 167 | struct device *dev = &pdev->dev; |
168 | 168 | ||
169 | #if defined(CONFIG_MICROBLAZE) | ||
170 | pdev->archdata.dma_mask = 0xffffffffUL; | ||
171 | #endif | ||
172 | |||
173 | /* | 169 | /* |
174 | * Set default dma-mask to 32 bit. Drivers are expected to setup | 170 | * Set default dma-mask to 32 bit. Drivers are expected to setup |
175 | * the correct supported dma_mask. | 171 | * the correct supported dma_mask. |
diff --git a/drivers/pci/pci.c b/drivers/pci/pci.c index 63a54a340863..1c8592b0e146 100644 --- a/drivers/pci/pci.c +++ b/drivers/pci/pci.c | |||
@@ -3135,8 +3135,13 @@ static int pci_af_flr(struct pci_dev *dev, int probe) | |||
3135 | if (probe) | 3135 | if (probe) |
3136 | return 0; | 3136 | return 0; |
3137 | 3137 | ||
3138 | /* Wait for Transaction Pending bit clean */ | 3138 | /* |
3139 | if (pci_wait_for_pending(dev, pos + PCI_AF_STATUS, PCI_AF_STATUS_TP)) | 3139 | * Wait for Transaction Pending bit to clear. A word-aligned test |
3140 | * is used, so we use the conrol offset rather than status and shift | ||
3141 | * the test bit to match. | ||
3142 | */ | ||
3143 | if (pci_wait_for_pending(dev, pos + PCI_AF_CTRL, | ||
3144 | PCI_AF_STATUS_TP << 8)) | ||
3140 | goto clear; | 3145 | goto clear; |
3141 | 3146 | ||
3142 | dev_err(&dev->dev, "transaction is not cleared; proceeding with reset anyway\n"); | 3147 | dev_err(&dev->dev, "transaction is not cleared; proceeding with reset anyway\n"); |
diff --git a/drivers/phy/Kconfig b/drivers/phy/Kconfig index 16a2f067c242..64b98d242ea6 100644 --- a/drivers/phy/Kconfig +++ b/drivers/phy/Kconfig | |||
@@ -112,6 +112,7 @@ config PHY_EXYNOS5250_SATA | |||
112 | config PHY_SUN4I_USB | 112 | config PHY_SUN4I_USB |
113 | tristate "Allwinner sunxi SoC USB PHY driver" | 113 | tristate "Allwinner sunxi SoC USB PHY driver" |
114 | depends on ARCH_SUNXI && HAS_IOMEM && OF | 114 | depends on ARCH_SUNXI && HAS_IOMEM && OF |
115 | depends on RESET_CONTROLLER | ||
115 | select GENERIC_PHY | 116 | select GENERIC_PHY |
116 | help | 117 | help |
117 | Enable this to support the transceiver that is part of Allwinner | 118 | Enable this to support the transceiver that is part of Allwinner |
@@ -122,6 +123,7 @@ config PHY_SUN4I_USB | |||
122 | 123 | ||
123 | config PHY_SAMSUNG_USB2 | 124 | config PHY_SAMSUNG_USB2 |
124 | tristate "Samsung USB 2.0 PHY driver" | 125 | tristate "Samsung USB 2.0 PHY driver" |
126 | depends on HAS_IOMEM | ||
125 | select GENERIC_PHY | 127 | select GENERIC_PHY |
126 | select MFD_SYSCON | 128 | select MFD_SYSCON |
127 | help | 129 | help |
diff --git a/drivers/phy/phy-core.c b/drivers/phy/phy-core.c index c64a2f3b2d62..49c446530101 100644 --- a/drivers/phy/phy-core.c +++ b/drivers/phy/phy-core.c | |||
@@ -614,8 +614,9 @@ struct phy *phy_create(struct device *dev, const struct phy_ops *ops, | |||
614 | return phy; | 614 | return phy; |
615 | 615 | ||
616 | put_dev: | 616 | put_dev: |
617 | put_device(&phy->dev); | 617 | put_device(&phy->dev); /* calls phy_release() which frees resources */ |
618 | ida_remove(&phy_ida, phy->id); | 618 | return ERR_PTR(ret); |
619 | |||
619 | free_phy: | 620 | free_phy: |
620 | kfree(phy); | 621 | kfree(phy); |
621 | return ERR_PTR(ret); | 622 | return ERR_PTR(ret); |
@@ -799,7 +800,7 @@ static void phy_release(struct device *dev) | |||
799 | 800 | ||
800 | phy = to_phy(dev); | 801 | phy = to_phy(dev); |
801 | dev_vdbg(dev, "releasing '%s'\n", dev_name(dev)); | 802 | dev_vdbg(dev, "releasing '%s'\n", dev_name(dev)); |
802 | ida_remove(&phy_ida, phy->id); | 803 | ida_simple_remove(&phy_ida, phy->id); |
803 | kfree(phy); | 804 | kfree(phy); |
804 | } | 805 | } |
805 | 806 | ||
diff --git a/drivers/phy/phy-omap-usb2.c b/drivers/phy/phy-omap-usb2.c index 7007c11fe07d..34b396146c8a 100644 --- a/drivers/phy/phy-omap-usb2.c +++ b/drivers/phy/phy-omap-usb2.c | |||
@@ -233,8 +233,8 @@ static int omap_usb2_probe(struct platform_device *pdev) | |||
233 | if (phy_data->flags & OMAP_USB2_CALIBRATE_FALSE_DISCONNECT) { | 233 | if (phy_data->flags & OMAP_USB2_CALIBRATE_FALSE_DISCONNECT) { |
234 | res = platform_get_resource(pdev, IORESOURCE_MEM, 0); | 234 | res = platform_get_resource(pdev, IORESOURCE_MEM, 0); |
235 | phy->phy_base = devm_ioremap_resource(&pdev->dev, res); | 235 | phy->phy_base = devm_ioremap_resource(&pdev->dev, res); |
236 | if (!phy->phy_base) | 236 | if (IS_ERR(phy->phy_base)) |
237 | return -ENOMEM; | 237 | return PTR_ERR(phy->phy_base); |
238 | phy->flags |= OMAP_USB2_CALIBRATE_FALSE_DISCONNECT; | 238 | phy->flags |= OMAP_USB2_CALIBRATE_FALSE_DISCONNECT; |
239 | } | 239 | } |
240 | 240 | ||
@@ -262,7 +262,6 @@ static int omap_usb2_probe(struct platform_device *pdev) | |||
262 | otg->phy = &phy->phy; | 262 | otg->phy = &phy->phy; |
263 | 263 | ||
264 | platform_set_drvdata(pdev, phy); | 264 | platform_set_drvdata(pdev, phy); |
265 | pm_runtime_enable(phy->dev); | ||
266 | 265 | ||
267 | generic_phy = devm_phy_create(phy->dev, &ops, NULL); | 266 | generic_phy = devm_phy_create(phy->dev, &ops, NULL); |
268 | if (IS_ERR(generic_phy)) | 267 | if (IS_ERR(generic_phy)) |
@@ -270,10 +269,13 @@ static int omap_usb2_probe(struct platform_device *pdev) | |||
270 | 269 | ||
271 | phy_set_drvdata(generic_phy, phy); | 270 | phy_set_drvdata(generic_phy, phy); |
272 | 271 | ||
272 | pm_runtime_enable(phy->dev); | ||
273 | phy_provider = devm_of_phy_provider_register(phy->dev, | 273 | phy_provider = devm_of_phy_provider_register(phy->dev, |
274 | of_phy_simple_xlate); | 274 | of_phy_simple_xlate); |
275 | if (IS_ERR(phy_provider)) | 275 | if (IS_ERR(phy_provider)) { |
276 | pm_runtime_disable(phy->dev); | ||
276 | return PTR_ERR(phy_provider); | 277 | return PTR_ERR(phy_provider); |
278 | } | ||
277 | 279 | ||
278 | phy->wkupclk = devm_clk_get(phy->dev, "wkupclk"); | 280 | phy->wkupclk = devm_clk_get(phy->dev, "wkupclk"); |
279 | if (IS_ERR(phy->wkupclk)) { | 281 | if (IS_ERR(phy->wkupclk)) { |
@@ -317,6 +319,7 @@ static int omap_usb2_remove(struct platform_device *pdev) | |||
317 | if (!IS_ERR(phy->optclk)) | 319 | if (!IS_ERR(phy->optclk)) |
318 | clk_unprepare(phy->optclk); | 320 | clk_unprepare(phy->optclk); |
319 | usb_remove_phy(&phy->phy); | 321 | usb_remove_phy(&phy->phy); |
322 | pm_runtime_disable(phy->dev); | ||
320 | 323 | ||
321 | return 0; | 324 | return 0; |
322 | } | 325 | } |
diff --git a/drivers/phy/phy-samsung-usb2.c b/drivers/phy/phy-samsung-usb2.c index 8a8c6bc8709a..1e69a32c221d 100644 --- a/drivers/phy/phy-samsung-usb2.c +++ b/drivers/phy/phy-samsung-usb2.c | |||
@@ -107,6 +107,7 @@ static const struct of_device_id samsung_usb2_phy_of_match[] = { | |||
107 | #endif | 107 | #endif |
108 | { }, | 108 | { }, |
109 | }; | 109 | }; |
110 | MODULE_DEVICE_TABLE(of, samsung_usb2_phy_of_match); | ||
110 | 111 | ||
111 | static int samsung_usb2_phy_probe(struct platform_device *pdev) | 112 | static int samsung_usb2_phy_probe(struct platform_device *pdev) |
112 | { | 113 | { |
diff --git a/drivers/pinctrl/berlin/berlin.c b/drivers/pinctrl/berlin/berlin.c index edf5d2fd2b22..86db2235ab00 100644 --- a/drivers/pinctrl/berlin/berlin.c +++ b/drivers/pinctrl/berlin/berlin.c | |||
@@ -320,7 +320,7 @@ int berlin_pinctrl_probe(struct platform_device *pdev, | |||
320 | 320 | ||
321 | regmap = dev_get_regmap(&pdev->dev, NULL); | 321 | regmap = dev_get_regmap(&pdev->dev, NULL); |
322 | if (!regmap) | 322 | if (!regmap) |
323 | return PTR_ERR(regmap); | 323 | return -ENODEV; |
324 | 324 | ||
325 | pctrl = devm_kzalloc(dev, sizeof(*pctrl), GFP_KERNEL); | 325 | pctrl = devm_kzalloc(dev, sizeof(*pctrl), GFP_KERNEL); |
326 | if (!pctrl) | 326 | if (!pctrl) |
diff --git a/drivers/pinctrl/sunxi/pinctrl-sunxi.c b/drivers/pinctrl/sunxi/pinctrl-sunxi.c index f1ca75e6d7b1..5f38c7f67834 100644 --- a/drivers/pinctrl/sunxi/pinctrl-sunxi.c +++ b/drivers/pinctrl/sunxi/pinctrl-sunxi.c | |||
@@ -211,6 +211,10 @@ static int sunxi_pctrl_dt_node_to_map(struct pinctrl_dev *pctldev, | |||
211 | configlen++; | 211 | configlen++; |
212 | 212 | ||
213 | pinconfig = kzalloc(configlen * sizeof(*pinconfig), GFP_KERNEL); | 213 | pinconfig = kzalloc(configlen * sizeof(*pinconfig), GFP_KERNEL); |
214 | if (!pinconfig) { | ||
215 | kfree(*map); | ||
216 | return -ENOMEM; | ||
217 | } | ||
214 | 218 | ||
215 | if (!of_property_read_u32(node, "allwinner,drive", &val)) { | 219 | if (!of_property_read_u32(node, "allwinner,drive", &val)) { |
216 | u16 strength = (val + 1) * 10; | 220 | u16 strength = (val + 1) * 10; |
diff --git a/drivers/ptp/Kconfig b/drivers/ptp/Kconfig index 6aea373547f6..ee3de3421f2d 100644 --- a/drivers/ptp/Kconfig +++ b/drivers/ptp/Kconfig | |||
@@ -74,7 +74,7 @@ config DP83640_PHY | |||
74 | 74 | ||
75 | config PTP_1588_CLOCK_PCH | 75 | config PTP_1588_CLOCK_PCH |
76 | tristate "Intel PCH EG20T as PTP clock" | 76 | tristate "Intel PCH EG20T as PTP clock" |
77 | depends on X86 || COMPILE_TEST | 77 | depends on X86_32 || COMPILE_TEST |
78 | depends on HAS_IOMEM && NET | 78 | depends on HAS_IOMEM && NET |
79 | select PTP_1588_CLOCK | 79 | select PTP_1588_CLOCK |
80 | help | 80 | help |
diff --git a/drivers/regulator/as3722-regulator.c b/drivers/regulator/as3722-regulator.c index 85585219ce82..ad9e0c9b7daf 100644 --- a/drivers/regulator/as3722-regulator.c +++ b/drivers/regulator/as3722-regulator.c | |||
@@ -433,6 +433,7 @@ static struct regulator_ops as3722_ldo3_extcntrl_ops = { | |||
433 | }; | 433 | }; |
434 | 434 | ||
435 | static const struct regulator_linear_range as3722_ldo_ranges[] = { | 435 | static const struct regulator_linear_range as3722_ldo_ranges[] = { |
436 | REGULATOR_LINEAR_RANGE(0, 0x00, 0x00, 0), | ||
436 | REGULATOR_LINEAR_RANGE(825000, 0x01, 0x24, 25000), | 437 | REGULATOR_LINEAR_RANGE(825000, 0x01, 0x24, 25000), |
437 | REGULATOR_LINEAR_RANGE(1725000, 0x40, 0x7F, 25000), | 438 | REGULATOR_LINEAR_RANGE(1725000, 0x40, 0x7F, 25000), |
438 | }; | 439 | }; |
@@ -609,6 +610,7 @@ static bool as3722_sd0_is_low_voltage(struct as3722_regulators *as3722_regs) | |||
609 | } | 610 | } |
610 | 611 | ||
611 | static const struct regulator_linear_range as3722_sd2345_ranges[] = { | 612 | static const struct regulator_linear_range as3722_sd2345_ranges[] = { |
613 | REGULATOR_LINEAR_RANGE(0, 0x00, 0x00, 0), | ||
612 | REGULATOR_LINEAR_RANGE(612500, 0x01, 0x40, 12500), | 614 | REGULATOR_LINEAR_RANGE(612500, 0x01, 0x40, 12500), |
613 | REGULATOR_LINEAR_RANGE(1425000, 0x41, 0x70, 25000), | 615 | REGULATOR_LINEAR_RANGE(1425000, 0x41, 0x70, 25000), |
614 | REGULATOR_LINEAR_RANGE(2650000, 0x71, 0x7F, 50000), | 616 | REGULATOR_LINEAR_RANGE(2650000, 0x71, 0x7F, 50000), |
diff --git a/drivers/regulator/bcm590xx-regulator.c b/drivers/regulator/bcm590xx-regulator.c index 57544e254a78..58ece59367ae 100644 --- a/drivers/regulator/bcm590xx-regulator.c +++ b/drivers/regulator/bcm590xx-regulator.c | |||
@@ -119,6 +119,10 @@ static const unsigned int ldo_c_table[] = { | |||
119 | 2900000, 3000000, 3300000, | 119 | 2900000, 3000000, 3300000, |
120 | }; | 120 | }; |
121 | 121 | ||
122 | static const unsigned int ldo_vbus[] = { | ||
123 | 5000000, | ||
124 | }; | ||
125 | |||
122 | /* DCDC group CSR: supported voltages in microvolts */ | 126 | /* DCDC group CSR: supported voltages in microvolts */ |
123 | static const struct regulator_linear_range dcdc_csr_ranges[] = { | 127 | static const struct regulator_linear_range dcdc_csr_ranges[] = { |
124 | REGULATOR_LINEAR_RANGE(860000, 2, 50, 10000), | 128 | REGULATOR_LINEAR_RANGE(860000, 2, 50, 10000), |
@@ -192,6 +196,7 @@ static struct bcm590xx_info bcm590xx_regs[] = { | |||
192 | BCM590XX_REG_TABLE(gpldo4, ldo_a_table), | 196 | BCM590XX_REG_TABLE(gpldo4, ldo_a_table), |
193 | BCM590XX_REG_TABLE(gpldo5, ldo_a_table), | 197 | BCM590XX_REG_TABLE(gpldo5, ldo_a_table), |
194 | BCM590XX_REG_TABLE(gpldo6, ldo_a_table), | 198 | BCM590XX_REG_TABLE(gpldo6, ldo_a_table), |
199 | BCM590XX_REG_TABLE(vbus, ldo_vbus), | ||
195 | }; | 200 | }; |
196 | 201 | ||
197 | struct bcm590xx_reg { | 202 | struct bcm590xx_reg { |
diff --git a/drivers/regulator/ltc3589.c b/drivers/regulator/ltc3589.c index 110a99ee1162..c8105182b8b8 100644 --- a/drivers/regulator/ltc3589.c +++ b/drivers/regulator/ltc3589.c | |||
@@ -255,7 +255,7 @@ static int ltc3589_parse_regulators_dt(struct ltc3589 *ltc3589) | |||
255 | struct device_node *node; | 255 | struct device_node *node; |
256 | int i, ret; | 256 | int i, ret; |
257 | 257 | ||
258 | node = of_find_node_by_name(dev->of_node, "regulators"); | 258 | node = of_get_child_by_name(dev->of_node, "regulators"); |
259 | if (!node) { | 259 | if (!node) { |
260 | dev_err(dev, "regulators node not found\n"); | 260 | dev_err(dev, "regulators node not found\n"); |
261 | return -EINVAL; | 261 | return -EINVAL; |
diff --git a/drivers/regulator/palmas-regulator.c b/drivers/regulator/palmas-regulator.c index 864ed02ce4b7..93b4ad842901 100644 --- a/drivers/regulator/palmas-regulator.c +++ b/drivers/regulator/palmas-regulator.c | |||
@@ -37,12 +37,14 @@ struct regs_info { | |||
37 | }; | 37 | }; |
38 | 38 | ||
39 | static const struct regulator_linear_range smps_low_ranges[] = { | 39 | static const struct regulator_linear_range smps_low_ranges[] = { |
40 | REGULATOR_LINEAR_RANGE(0, 0x0, 0x0, 0), | ||
40 | REGULATOR_LINEAR_RANGE(500000, 0x1, 0x6, 0), | 41 | REGULATOR_LINEAR_RANGE(500000, 0x1, 0x6, 0), |
41 | REGULATOR_LINEAR_RANGE(510000, 0x7, 0x79, 10000), | 42 | REGULATOR_LINEAR_RANGE(510000, 0x7, 0x79, 10000), |
42 | REGULATOR_LINEAR_RANGE(1650000, 0x7A, 0x7f, 0), | 43 | REGULATOR_LINEAR_RANGE(1650000, 0x7A, 0x7f, 0), |
43 | }; | 44 | }; |
44 | 45 | ||
45 | static const struct regulator_linear_range smps_high_ranges[] = { | 46 | static const struct regulator_linear_range smps_high_ranges[] = { |
47 | REGULATOR_LINEAR_RANGE(0, 0x0, 0x0, 0), | ||
46 | REGULATOR_LINEAR_RANGE(1000000, 0x1, 0x6, 0), | 48 | REGULATOR_LINEAR_RANGE(1000000, 0x1, 0x6, 0), |
47 | REGULATOR_LINEAR_RANGE(1020000, 0x7, 0x79, 20000), | 49 | REGULATOR_LINEAR_RANGE(1020000, 0x7, 0x79, 20000), |
48 | REGULATOR_LINEAR_RANGE(3300000, 0x7A, 0x7f, 0), | 50 | REGULATOR_LINEAR_RANGE(3300000, 0x7A, 0x7f, 0), |
@@ -323,6 +325,10 @@ static int palmas_set_mode_smps(struct regulator_dev *dev, unsigned int mode) | |||
323 | if (rail_enable) | 325 | if (rail_enable) |
324 | palmas_smps_write(pmic->palmas, | 326 | palmas_smps_write(pmic->palmas, |
325 | palmas_regs_info[id].ctrl_addr, reg); | 327 | palmas_regs_info[id].ctrl_addr, reg); |
328 | |||
329 | /* Switch the enable value to ensure this is used for enable */ | ||
330 | pmic->desc[id].enable_val = pmic->current_reg_mode[id]; | ||
331 | |||
326 | return 0; | 332 | return 0; |
327 | } | 333 | } |
328 | 334 | ||
@@ -962,6 +968,14 @@ static int palmas_regulators_probe(struct platform_device *pdev) | |||
962 | return ret; | 968 | return ret; |
963 | pmic->current_reg_mode[id] = reg & | 969 | pmic->current_reg_mode[id] = reg & |
964 | PALMAS_SMPS12_CTRL_MODE_ACTIVE_MASK; | 970 | PALMAS_SMPS12_CTRL_MODE_ACTIVE_MASK; |
971 | |||
972 | pmic->desc[id].enable_reg = | ||
973 | PALMAS_BASE_TO_REG(PALMAS_SMPS_BASE, | ||
974 | palmas_regs_info[id].ctrl_addr); | ||
975 | pmic->desc[id].enable_mask = | ||
976 | PALMAS_SMPS12_CTRL_MODE_ACTIVE_MASK; | ||
977 | /* set_mode overrides this value */ | ||
978 | pmic->desc[id].enable_val = SMPS_CTRL_MODE_ON; | ||
965 | } | 979 | } |
966 | 980 | ||
967 | pmic->desc[id].type = REGULATOR_VOLTAGE; | 981 | pmic->desc[id].type = REGULATOR_VOLTAGE; |
diff --git a/drivers/regulator/tps65218-regulator.c b/drivers/regulator/tps65218-regulator.c index 69b4b7750410..9effe48c605e 100644 --- a/drivers/regulator/tps65218-regulator.c +++ b/drivers/regulator/tps65218-regulator.c | |||
@@ -209,7 +209,7 @@ static const struct regulator_desc regulators[] = { | |||
209 | 1, -1, -1, TPS65218_REG_ENABLE1, | 209 | 1, -1, -1, TPS65218_REG_ENABLE1, |
210 | TPS65218_ENABLE1_DC6_EN, NULL, NULL, 0, 0), | 210 | TPS65218_ENABLE1_DC6_EN, NULL, NULL, 0, 0), |
211 | TPS65218_REGULATOR("LDO1", TPS65218_LDO_1, tps65218_ldo1_dcdc34_ops, 64, | 211 | TPS65218_REGULATOR("LDO1", TPS65218_LDO_1, tps65218_ldo1_dcdc34_ops, 64, |
212 | TPS65218_REG_CONTROL_DCDC4, | 212 | TPS65218_REG_CONTROL_LDO1, |
213 | TPS65218_CONTROL_LDO1_MASK, TPS65218_REG_ENABLE2, | 213 | TPS65218_CONTROL_LDO1_MASK, TPS65218_REG_ENABLE2, |
214 | TPS65218_ENABLE2_LDO1_EN, NULL, ldo1_dcdc3_ranges, | 214 | TPS65218_ENABLE2_LDO1_EN, NULL, ldo1_dcdc3_ranges, |
215 | 2, 0), | 215 | 2, 0), |
@@ -240,6 +240,7 @@ static int tps65218_regulator_probe(struct platform_device *pdev) | |||
240 | config.init_data = init_data; | 240 | config.init_data = init_data; |
241 | config.driver_data = tps; | 241 | config.driver_data = tps; |
242 | config.regmap = tps->regmap; | 242 | config.regmap = tps->regmap; |
243 | config.of_node = pdev->dev.of_node; | ||
243 | 244 | ||
244 | rdev = devm_regulator_register(&pdev->dev, ®ulators[id], &config); | 245 | rdev = devm_regulator_register(&pdev->dev, ®ulators[id], &config); |
245 | if (IS_ERR(rdev)) { | 246 | if (IS_ERR(rdev)) { |
diff --git a/drivers/remoteproc/Kconfig b/drivers/remoteproc/Kconfig index ce1743d0b679..5e343bab9458 100644 --- a/drivers/remoteproc/Kconfig +++ b/drivers/remoteproc/Kconfig | |||
@@ -44,7 +44,7 @@ config STE_MODEM_RPROC | |||
44 | config DA8XX_REMOTEPROC | 44 | config DA8XX_REMOTEPROC |
45 | tristate "DA8xx/OMAP-L13x remoteproc support" | 45 | tristate "DA8xx/OMAP-L13x remoteproc support" |
46 | depends on ARCH_DAVINCI_DA8XX | 46 | depends on ARCH_DAVINCI_DA8XX |
47 | select CMA | 47 | select CMA if MMU |
48 | select REMOTEPROC | 48 | select REMOTEPROC |
49 | select RPMSG | 49 | select RPMSG |
50 | help | 50 | help |
diff --git a/drivers/rtc/rtc-puv3.c b/drivers/rtc/rtc-puv3.c index 1ecfe3bd92ac..1cff2a21db67 100644 --- a/drivers/rtc/rtc-puv3.c +++ b/drivers/rtc/rtc-puv3.c | |||
@@ -71,7 +71,7 @@ static int puv3_rtc_setpie(struct device *dev, int enabled) | |||
71 | { | 71 | { |
72 | unsigned int tmp; | 72 | unsigned int tmp; |
73 | 73 | ||
74 | dev_debug(dev, "%s: pie=%d\n", __func__, enabled); | 74 | dev_dbg(dev, "%s: pie=%d\n", __func__, enabled); |
75 | 75 | ||
76 | spin_lock_irq(&puv3_rtc_pie_lock); | 76 | spin_lock_irq(&puv3_rtc_pie_lock); |
77 | tmp = readl(RTC_RTSR) & ~RTC_RTSR_HZE; | 77 | tmp = readl(RTC_RTSR) & ~RTC_RTSR_HZE; |
@@ -140,7 +140,7 @@ static int puv3_rtc_setalarm(struct device *dev, struct rtc_wkalrm *alrm) | |||
140 | rtc_tm_to_time(tm, &rtcalarm_count); | 140 | rtc_tm_to_time(tm, &rtcalarm_count); |
141 | writel(rtcalarm_count, RTC_RTAR); | 141 | writel(rtcalarm_count, RTC_RTAR); |
142 | 142 | ||
143 | puv3_rtc_setaie(&dev->dev, alrm->enabled); | 143 | puv3_rtc_setaie(dev, alrm->enabled); |
144 | 144 | ||
145 | if (alrm->enabled) | 145 | if (alrm->enabled) |
146 | enable_irq_wake(puv3_rtc_alarmno); | 146 | enable_irq_wake(puv3_rtc_alarmno); |
diff --git a/drivers/s390/block/dcssblk.c b/drivers/s390/block/dcssblk.c index ee0e85abe1fd..0f471750327e 100644 --- a/drivers/s390/block/dcssblk.c +++ b/drivers/s390/block/dcssblk.c | |||
@@ -593,7 +593,7 @@ dcssblk_add_store(struct device *dev, struct device_attribute *attr, const char | |||
593 | dev_info->start = dcssblk_find_lowest_addr(dev_info); | 593 | dev_info->start = dcssblk_find_lowest_addr(dev_info); |
594 | dev_info->end = dcssblk_find_highest_addr(dev_info); | 594 | dev_info->end = dcssblk_find_highest_addr(dev_info); |
595 | 595 | ||
596 | dev_set_name(&dev_info->dev, dev_info->segment_name); | 596 | dev_set_name(&dev_info->dev, "%s", dev_info->segment_name); |
597 | dev_info->dev.release = dcssblk_release_segment; | 597 | dev_info->dev.release = dcssblk_release_segment; |
598 | dev_info->dev.groups = dcssblk_dev_attr_groups; | 598 | dev_info->dev.groups = dcssblk_dev_attr_groups; |
599 | INIT_LIST_HEAD(&dev_info->lh); | 599 | INIT_LIST_HEAD(&dev_info->lh); |
diff --git a/drivers/s390/char/Makefile b/drivers/s390/char/Makefile index 629fcc275e92..78b6ace7edcb 100644 --- a/drivers/s390/char/Makefile +++ b/drivers/s390/char/Makefile | |||
@@ -19,7 +19,6 @@ obj-$(CONFIG_SCLP_VT220_TTY) += sclp_vt220.o | |||
19 | obj-$(CONFIG_SCLP_CPI) += sclp_cpi.o | 19 | obj-$(CONFIG_SCLP_CPI) += sclp_cpi.o |
20 | obj-$(CONFIG_SCLP_ASYNC) += sclp_async.o | 20 | obj-$(CONFIG_SCLP_ASYNC) += sclp_async.o |
21 | 21 | ||
22 | obj-$(CONFIG_ZVM_WATCHDOG) += vmwatchdog.o | ||
23 | obj-$(CONFIG_VMLOGRDR) += vmlogrdr.o | 22 | obj-$(CONFIG_VMLOGRDR) += vmlogrdr.o |
24 | obj-$(CONFIG_VMCP) += vmcp.o | 23 | obj-$(CONFIG_VMCP) += vmcp.o |
25 | 24 | ||
diff --git a/drivers/s390/char/sclp_vt220.c b/drivers/s390/char/sclp_vt220.c index cd9c91909596..b9a9f721716d 100644 --- a/drivers/s390/char/sclp_vt220.c +++ b/drivers/s390/char/sclp_vt220.c | |||
@@ -838,8 +838,6 @@ sclp_vt220_con_init(void) | |||
838 | { | 838 | { |
839 | int rc; | 839 | int rc; |
840 | 840 | ||
841 | if (!CONSOLE_IS_SCLP) | ||
842 | return 0; | ||
843 | rc = __sclp_vt220_init(sclp_console_pages); | 841 | rc = __sclp_vt220_init(sclp_console_pages); |
844 | if (rc) | 842 | if (rc) |
845 | return rc; | 843 | return rc; |
diff --git a/drivers/s390/char/vmlogrdr.c b/drivers/s390/char/vmlogrdr.c index cf31d3321dab..a8848db7b09d 100644 --- a/drivers/s390/char/vmlogrdr.c +++ b/drivers/s390/char/vmlogrdr.c | |||
@@ -761,7 +761,7 @@ static int vmlogrdr_register_device(struct vmlogrdr_priv_t *priv) | |||
761 | 761 | ||
762 | dev = kzalloc(sizeof(struct device), GFP_KERNEL); | 762 | dev = kzalloc(sizeof(struct device), GFP_KERNEL); |
763 | if (dev) { | 763 | if (dev) { |
764 | dev_set_name(dev, priv->internal_name); | 764 | dev_set_name(dev, "%s", priv->internal_name); |
765 | dev->bus = &iucv_bus; | 765 | dev->bus = &iucv_bus; |
766 | dev->parent = iucv_root; | 766 | dev->parent = iucv_root; |
767 | dev->driver = &vmlogrdr_driver; | 767 | dev->driver = &vmlogrdr_driver; |
diff --git a/drivers/s390/char/vmwatchdog.c b/drivers/s390/char/vmwatchdog.c deleted file mode 100644 index d5eac985976b..000000000000 --- a/drivers/s390/char/vmwatchdog.c +++ /dev/null | |||
@@ -1,338 +0,0 @@ | |||
1 | /* | ||
2 | * Watchdog implementation based on z/VM Watchdog Timer API | ||
3 | * | ||
4 | * Copyright IBM Corp. 2004, 2009 | ||
5 | * | ||
6 | * The user space watchdog daemon can use this driver as | ||
7 | * /dev/vmwatchdog to have z/VM execute the specified CP | ||
8 | * command when the timeout expires. The default command is | ||
9 | * "IPL", which which cause an immediate reboot. | ||
10 | */ | ||
11 | #define KMSG_COMPONENT "vmwatchdog" | ||
12 | #define pr_fmt(fmt) KMSG_COMPONENT ": " fmt | ||
13 | |||
14 | #include <linux/init.h> | ||
15 | #include <linux/fs.h> | ||
16 | #include <linux/kernel.h> | ||
17 | #include <linux/miscdevice.h> | ||
18 | #include <linux/module.h> | ||
19 | #include <linux/moduleparam.h> | ||
20 | #include <linux/slab.h> | ||
21 | #include <linux/suspend.h> | ||
22 | #include <linux/watchdog.h> | ||
23 | |||
24 | #include <asm/ebcdic.h> | ||
25 | #include <asm/io.h> | ||
26 | #include <asm/uaccess.h> | ||
27 | |||
28 | #define MAX_CMDLEN 240 | ||
29 | #define MIN_INTERVAL 15 | ||
30 | static char vmwdt_cmd[MAX_CMDLEN] = "IPL"; | ||
31 | static bool vmwdt_conceal; | ||
32 | |||
33 | static bool vmwdt_nowayout = WATCHDOG_NOWAYOUT; | ||
34 | |||
35 | MODULE_LICENSE("GPL"); | ||
36 | MODULE_AUTHOR("Arnd Bergmann <arndb@de.ibm.com>"); | ||
37 | MODULE_DESCRIPTION("z/VM Watchdog Timer"); | ||
38 | module_param_string(cmd, vmwdt_cmd, MAX_CMDLEN, 0644); | ||
39 | MODULE_PARM_DESC(cmd, "CP command that is run when the watchdog triggers"); | ||
40 | module_param_named(conceal, vmwdt_conceal, bool, 0644); | ||
41 | MODULE_PARM_DESC(conceal, "Enable the CONCEAL CP option while the watchdog " | ||
42 | " is active"); | ||
43 | module_param_named(nowayout, vmwdt_nowayout, bool, 0); | ||
44 | MODULE_PARM_DESC(nowayout, "Watchdog cannot be stopped once started" | ||
45 | " (default=CONFIG_WATCHDOG_NOWAYOUT)"); | ||
46 | MODULE_ALIAS_MISCDEV(WATCHDOG_MINOR); | ||
47 | |||
48 | static unsigned int vmwdt_interval = 60; | ||
49 | static unsigned long vmwdt_is_open; | ||
50 | static int vmwdt_expect_close; | ||
51 | |||
52 | static DEFINE_MUTEX(vmwdt_mutex); | ||
53 | |||
54 | #define VMWDT_OPEN 0 /* devnode is open or suspend in progress */ | ||
55 | #define VMWDT_RUNNING 1 /* The watchdog is armed */ | ||
56 | |||
57 | enum vmwdt_func { | ||
58 | /* function codes */ | ||
59 | wdt_init = 0, | ||
60 | wdt_change = 1, | ||
61 | wdt_cancel = 2, | ||
62 | /* flags */ | ||
63 | wdt_conceal = 0x80000000, | ||
64 | }; | ||
65 | |||
66 | static int __diag288(enum vmwdt_func func, unsigned int timeout, | ||
67 | char *cmd, size_t len) | ||
68 | { | ||
69 | register unsigned long __func asm("2") = func; | ||
70 | register unsigned long __timeout asm("3") = timeout; | ||
71 | register unsigned long __cmdp asm("4") = virt_to_phys(cmd); | ||
72 | register unsigned long __cmdl asm("5") = len; | ||
73 | int err; | ||
74 | |||
75 | err = -EINVAL; | ||
76 | asm volatile( | ||
77 | " diag %1,%3,0x288\n" | ||
78 | "0: la %0,0\n" | ||
79 | "1:\n" | ||
80 | EX_TABLE(0b,1b) | ||
81 | : "+d" (err) : "d"(__func), "d"(__timeout), | ||
82 | "d"(__cmdp), "d"(__cmdl) : "1", "cc"); | ||
83 | return err; | ||
84 | } | ||
85 | |||
86 | static int vmwdt_keepalive(void) | ||
87 | { | ||
88 | /* we allocate new memory every time to avoid having | ||
89 | * to track the state. static allocation is not an | ||
90 | * option since that might not be contiguous in real | ||
91 | * storage in case of a modular build */ | ||
92 | static char *ebc_cmd; | ||
93 | size_t len; | ||
94 | int ret; | ||
95 | unsigned int func; | ||
96 | |||
97 | ebc_cmd = kmalloc(MAX_CMDLEN, GFP_KERNEL); | ||
98 | if (!ebc_cmd) | ||
99 | return -ENOMEM; | ||
100 | |||
101 | len = strlcpy(ebc_cmd, vmwdt_cmd, MAX_CMDLEN); | ||
102 | ASCEBC(ebc_cmd, MAX_CMDLEN); | ||
103 | EBC_TOUPPER(ebc_cmd, MAX_CMDLEN); | ||
104 | |||
105 | func = vmwdt_conceal ? (wdt_init | wdt_conceal) : wdt_init; | ||
106 | set_bit(VMWDT_RUNNING, &vmwdt_is_open); | ||
107 | ret = __diag288(func, vmwdt_interval, ebc_cmd, len); | ||
108 | WARN_ON(ret != 0); | ||
109 | kfree(ebc_cmd); | ||
110 | return ret; | ||
111 | } | ||
112 | |||
113 | static int vmwdt_disable(void) | ||
114 | { | ||
115 | char cmd[] = {'\0'}; | ||
116 | int ret = __diag288(wdt_cancel, 0, cmd, 0); | ||
117 | WARN_ON(ret != 0); | ||
118 | clear_bit(VMWDT_RUNNING, &vmwdt_is_open); | ||
119 | return ret; | ||
120 | } | ||
121 | |||
122 | static int __init vmwdt_probe(void) | ||
123 | { | ||
124 | /* there is no real way to see if the watchdog is supported, | ||
125 | * so we try initializing it with a NOP command ("BEGIN") | ||
126 | * that won't cause any harm even if the following disable | ||
127 | * fails for some reason */ | ||
128 | char ebc_begin[] = { | ||
129 | 194, 197, 199, 201, 213 | ||
130 | }; | ||
131 | if (__diag288(wdt_init, 15, ebc_begin, sizeof(ebc_begin)) != 0) | ||
132 | return -EINVAL; | ||
133 | return vmwdt_disable(); | ||
134 | } | ||
135 | |||
136 | static int vmwdt_open(struct inode *i, struct file *f) | ||
137 | { | ||
138 | int ret; | ||
139 | if (test_and_set_bit(VMWDT_OPEN, &vmwdt_is_open)) | ||
140 | return -EBUSY; | ||
141 | ret = vmwdt_keepalive(); | ||
142 | if (ret) | ||
143 | clear_bit(VMWDT_OPEN, &vmwdt_is_open); | ||
144 | return ret ? ret : nonseekable_open(i, f); | ||
145 | } | ||
146 | |||
147 | static int vmwdt_close(struct inode *i, struct file *f) | ||
148 | { | ||
149 | if (vmwdt_expect_close == 42) | ||
150 | vmwdt_disable(); | ||
151 | vmwdt_expect_close = 0; | ||
152 | clear_bit(VMWDT_OPEN, &vmwdt_is_open); | ||
153 | return 0; | ||
154 | } | ||
155 | |||
156 | static struct watchdog_info vmwdt_info = { | ||
157 | .options = WDIOF_SETTIMEOUT | WDIOF_KEEPALIVEPING | WDIOF_MAGICCLOSE, | ||
158 | .firmware_version = 0, | ||
159 | .identity = "z/VM Watchdog Timer", | ||
160 | }; | ||
161 | |||
162 | static int __vmwdt_ioctl(unsigned int cmd, unsigned long arg) | ||
163 | { | ||
164 | switch (cmd) { | ||
165 | case WDIOC_GETSUPPORT: | ||
166 | if (copy_to_user((void __user *)arg, &vmwdt_info, | ||
167 | sizeof(vmwdt_info))) | ||
168 | return -EFAULT; | ||
169 | return 0; | ||
170 | case WDIOC_GETSTATUS: | ||
171 | case WDIOC_GETBOOTSTATUS: | ||
172 | return put_user(0, (int __user *)arg); | ||
173 | case WDIOC_GETTEMP: | ||
174 | return -EINVAL; | ||
175 | case WDIOC_SETOPTIONS: | ||
176 | { | ||
177 | int options, ret; | ||
178 | if (get_user(options, (int __user *)arg)) | ||
179 | return -EFAULT; | ||
180 | ret = -EINVAL; | ||
181 | if (options & WDIOS_DISABLECARD) { | ||
182 | ret = vmwdt_disable(); | ||
183 | if (ret) | ||
184 | return ret; | ||
185 | } | ||
186 | if (options & WDIOS_ENABLECARD) { | ||
187 | ret = vmwdt_keepalive(); | ||
188 | } | ||
189 | return ret; | ||
190 | } | ||
191 | case WDIOC_GETTIMEOUT: | ||
192 | return put_user(vmwdt_interval, (int __user *)arg); | ||
193 | case WDIOC_SETTIMEOUT: | ||
194 | { | ||
195 | int interval; | ||
196 | if (get_user(interval, (int __user *)arg)) | ||
197 | return -EFAULT; | ||
198 | if (interval < MIN_INTERVAL) | ||
199 | return -EINVAL; | ||
200 | vmwdt_interval = interval; | ||
201 | } | ||
202 | return vmwdt_keepalive(); | ||
203 | case WDIOC_KEEPALIVE: | ||
204 | return vmwdt_keepalive(); | ||
205 | } | ||
206 | return -EINVAL; | ||
207 | } | ||
208 | |||
209 | static long vmwdt_ioctl(struct file *f, unsigned int cmd, unsigned long arg) | ||
210 | { | ||
211 | int rc; | ||
212 | |||
213 | mutex_lock(&vmwdt_mutex); | ||
214 | rc = __vmwdt_ioctl(cmd, arg); | ||
215 | mutex_unlock(&vmwdt_mutex); | ||
216 | return (long) rc; | ||
217 | } | ||
218 | |||
219 | static ssize_t vmwdt_write(struct file *f, const char __user *buf, | ||
220 | size_t count, loff_t *ppos) | ||
221 | { | ||
222 | if(count) { | ||
223 | if (!vmwdt_nowayout) { | ||
224 | size_t i; | ||
225 | |||
226 | /* note: just in case someone wrote the magic character | ||
227 | * five months ago... */ | ||
228 | vmwdt_expect_close = 0; | ||
229 | |||
230 | for (i = 0; i != count; i++) { | ||
231 | char c; | ||
232 | if (get_user(c, buf+i)) | ||
233 | return -EFAULT; | ||
234 | if (c == 'V') | ||
235 | vmwdt_expect_close = 42; | ||
236 | } | ||
237 | } | ||
238 | /* someone wrote to us, we should restart timer */ | ||
239 | vmwdt_keepalive(); | ||
240 | } | ||
241 | return count; | ||
242 | } | ||
243 | |||
244 | static int vmwdt_resume(void) | ||
245 | { | ||
246 | clear_bit(VMWDT_OPEN, &vmwdt_is_open); | ||
247 | return NOTIFY_DONE; | ||
248 | } | ||
249 | |||
250 | /* | ||
251 | * It makes no sense to go into suspend while the watchdog is running. | ||
252 | * Depending on the memory size, the watchdog might trigger, while we | ||
253 | * are still saving the memory. | ||
254 | * We reuse the open flag to ensure that suspend and watchdog open are | ||
255 | * exclusive operations | ||
256 | */ | ||
257 | static int vmwdt_suspend(void) | ||
258 | { | ||
259 | if (test_and_set_bit(VMWDT_OPEN, &vmwdt_is_open)) { | ||
260 | pr_err("The system cannot be suspended while the watchdog" | ||
261 | " is in use\n"); | ||
262 | return notifier_from_errno(-EBUSY); | ||
263 | } | ||
264 | if (test_bit(VMWDT_RUNNING, &vmwdt_is_open)) { | ||
265 | clear_bit(VMWDT_OPEN, &vmwdt_is_open); | ||
266 | pr_err("The system cannot be suspended while the watchdog" | ||
267 | " is running\n"); | ||
268 | return notifier_from_errno(-EBUSY); | ||
269 | } | ||
270 | return NOTIFY_DONE; | ||
271 | } | ||
272 | |||
273 | /* | ||
274 | * This function is called for suspend and resume. | ||
275 | */ | ||
276 | static int vmwdt_power_event(struct notifier_block *this, unsigned long event, | ||
277 | void *ptr) | ||
278 | { | ||
279 | switch (event) { | ||
280 | case PM_POST_HIBERNATION: | ||
281 | case PM_POST_SUSPEND: | ||
282 | return vmwdt_resume(); | ||
283 | case PM_HIBERNATION_PREPARE: | ||
284 | case PM_SUSPEND_PREPARE: | ||
285 | return vmwdt_suspend(); | ||
286 | default: | ||
287 | return NOTIFY_DONE; | ||
288 | } | ||
289 | } | ||
290 | |||
291 | static struct notifier_block vmwdt_power_notifier = { | ||
292 | .notifier_call = vmwdt_power_event, | ||
293 | }; | ||
294 | |||
295 | static const struct file_operations vmwdt_fops = { | ||
296 | .open = &vmwdt_open, | ||
297 | .release = &vmwdt_close, | ||
298 | .unlocked_ioctl = &vmwdt_ioctl, | ||
299 | .write = &vmwdt_write, | ||
300 | .owner = THIS_MODULE, | ||
301 | .llseek = noop_llseek, | ||
302 | }; | ||
303 | |||
304 | static struct miscdevice vmwdt_dev = { | ||
305 | .minor = WATCHDOG_MINOR, | ||
306 | .name = "watchdog", | ||
307 | .fops = &vmwdt_fops, | ||
308 | }; | ||
309 | |||
310 | static int __init vmwdt_init(void) | ||
311 | { | ||
312 | int ret; | ||
313 | |||
314 | ret = vmwdt_probe(); | ||
315 | if (ret) | ||
316 | return ret; | ||
317 | ret = register_pm_notifier(&vmwdt_power_notifier); | ||
318 | if (ret) | ||
319 | return ret; | ||
320 | /* | ||
321 | * misc_register() has to be the last action in module_init(), because | ||
322 | * file operations will be available right after this. | ||
323 | */ | ||
324 | ret = misc_register(&vmwdt_dev); | ||
325 | if (ret) { | ||
326 | unregister_pm_notifier(&vmwdt_power_notifier); | ||
327 | return ret; | ||
328 | } | ||
329 | return 0; | ||
330 | } | ||
331 | module_init(vmwdt_init); | ||
332 | |||
333 | static void __exit vmwdt_exit(void) | ||
334 | { | ||
335 | unregister_pm_notifier(&vmwdt_power_notifier); | ||
336 | misc_deregister(&vmwdt_dev); | ||
337 | } | ||
338 | module_exit(vmwdt_exit); | ||
diff --git a/drivers/s390/cio/airq.c b/drivers/s390/cio/airq.c index 445564c790f6..00bfbee0af9e 100644 --- a/drivers/s390/cio/airq.c +++ b/drivers/s390/cio/airq.c | |||
@@ -196,11 +196,11 @@ EXPORT_SYMBOL(airq_iv_release); | |||
196 | */ | 196 | */ |
197 | unsigned long airq_iv_alloc(struct airq_iv *iv, unsigned long num) | 197 | unsigned long airq_iv_alloc(struct airq_iv *iv, unsigned long num) |
198 | { | 198 | { |
199 | unsigned long bit, i; | 199 | unsigned long bit, i, flags; |
200 | 200 | ||
201 | if (!iv->avail || num == 0) | 201 | if (!iv->avail || num == 0) |
202 | return -1UL; | 202 | return -1UL; |
203 | spin_lock(&iv->lock); | 203 | spin_lock_irqsave(&iv->lock, flags); |
204 | bit = find_first_bit_inv(iv->avail, iv->bits); | 204 | bit = find_first_bit_inv(iv->avail, iv->bits); |
205 | while (bit + num <= iv->bits) { | 205 | while (bit + num <= iv->bits) { |
206 | for (i = 1; i < num; i++) | 206 | for (i = 1; i < num; i++) |
@@ -218,9 +218,8 @@ unsigned long airq_iv_alloc(struct airq_iv *iv, unsigned long num) | |||
218 | } | 218 | } |
219 | if (bit + num > iv->bits) | 219 | if (bit + num > iv->bits) |
220 | bit = -1UL; | 220 | bit = -1UL; |
221 | spin_unlock(&iv->lock); | 221 | spin_unlock_irqrestore(&iv->lock, flags); |
222 | return bit; | 222 | return bit; |
223 | |||
224 | } | 223 | } |
225 | EXPORT_SYMBOL(airq_iv_alloc); | 224 | EXPORT_SYMBOL(airq_iv_alloc); |
226 | 225 | ||
@@ -232,11 +231,11 @@ EXPORT_SYMBOL(airq_iv_alloc); | |||
232 | */ | 231 | */ |
233 | void airq_iv_free(struct airq_iv *iv, unsigned long bit, unsigned long num) | 232 | void airq_iv_free(struct airq_iv *iv, unsigned long bit, unsigned long num) |
234 | { | 233 | { |
235 | unsigned long i; | 234 | unsigned long i, flags; |
236 | 235 | ||
237 | if (!iv->avail || num == 0) | 236 | if (!iv->avail || num == 0) |
238 | return; | 237 | return; |
239 | spin_lock(&iv->lock); | 238 | spin_lock_irqsave(&iv->lock, flags); |
240 | for (i = 0; i < num; i++) { | 239 | for (i = 0; i < num; i++) { |
241 | /* Clear (possibly left over) interrupt bit */ | 240 | /* Clear (possibly left over) interrupt bit */ |
242 | clear_bit_inv(bit + i, iv->vector); | 241 | clear_bit_inv(bit + i, iv->vector); |
@@ -248,7 +247,7 @@ void airq_iv_free(struct airq_iv *iv, unsigned long bit, unsigned long num) | |||
248 | while (iv->end > 0 && !test_bit_inv(iv->end - 1, iv->avail)) | 247 | while (iv->end > 0 && !test_bit_inv(iv->end - 1, iv->avail)) |
249 | iv->end--; | 248 | iv->end--; |
250 | } | 249 | } |
251 | spin_unlock(&iv->lock); | 250 | spin_unlock_irqrestore(&iv->lock, flags); |
252 | } | 251 | } |
253 | EXPORT_SYMBOL(airq_iv_free); | 252 | EXPORT_SYMBOL(airq_iv_free); |
254 | 253 | ||
diff --git a/drivers/s390/cio/ccwgroup.c b/drivers/s390/cio/ccwgroup.c index dfd7bc681c25..e443b0d0b236 100644 --- a/drivers/s390/cio/ccwgroup.c +++ b/drivers/s390/cio/ccwgroup.c | |||
@@ -184,7 +184,7 @@ static ssize_t ccwgroup_ungroup_store(struct device *dev, | |||
184 | const char *buf, size_t count) | 184 | const char *buf, size_t count) |
185 | { | 185 | { |
186 | struct ccwgroup_device *gdev = to_ccwgroupdev(dev); | 186 | struct ccwgroup_device *gdev = to_ccwgroupdev(dev); |
187 | int rc; | 187 | int rc = 0; |
188 | 188 | ||
189 | /* Prevent concurrent online/offline processing and ungrouping. */ | 189 | /* Prevent concurrent online/offline processing and ungrouping. */ |
190 | if (atomic_cmpxchg(&gdev->onoff, 0, 1) != 0) | 190 | if (atomic_cmpxchg(&gdev->onoff, 0, 1) != 0) |
@@ -196,11 +196,12 @@ static ssize_t ccwgroup_ungroup_store(struct device *dev, | |||
196 | 196 | ||
197 | if (device_remove_file_self(dev, attr)) | 197 | if (device_remove_file_self(dev, attr)) |
198 | ccwgroup_ungroup(gdev); | 198 | ccwgroup_ungroup(gdev); |
199 | else | ||
200 | rc = -ENODEV; | ||
199 | out: | 201 | out: |
200 | if (rc) { | 202 | if (rc) { |
201 | if (rc != -EAGAIN) | 203 | /* Release onoff "lock" when ungrouping failed. */ |
202 | /* Release onoff "lock" when ungrouping failed. */ | 204 | atomic_set(&gdev->onoff, 0); |
203 | atomic_set(&gdev->onoff, 0); | ||
204 | return rc; | 205 | return rc; |
205 | } | 206 | } |
206 | return count; | 207 | return count; |
@@ -227,6 +228,7 @@ static void ccwgroup_ungroup_workfn(struct work_struct *work) | |||
227 | container_of(work, struct ccwgroup_device, ungroup_work); | 228 | container_of(work, struct ccwgroup_device, ungroup_work); |
228 | 229 | ||
229 | ccwgroup_ungroup(gdev); | 230 | ccwgroup_ungroup(gdev); |
231 | put_device(&gdev->dev); | ||
230 | } | 232 | } |
231 | 233 | ||
232 | static void ccwgroup_release(struct device *dev) | 234 | static void ccwgroup_release(struct device *dev) |
@@ -412,8 +414,10 @@ static int ccwgroup_notifier(struct notifier_block *nb, unsigned long action, | |||
412 | { | 414 | { |
413 | struct ccwgroup_device *gdev = to_ccwgroupdev(data); | 415 | struct ccwgroup_device *gdev = to_ccwgroupdev(data); |
414 | 416 | ||
415 | if (action == BUS_NOTIFY_UNBIND_DRIVER) | 417 | if (action == BUS_NOTIFY_UNBIND_DRIVER) { |
418 | get_device(&gdev->dev); | ||
416 | schedule_work(&gdev->ungroup_work); | 419 | schedule_work(&gdev->ungroup_work); |
420 | } | ||
417 | 421 | ||
418 | return NOTIFY_OK; | 422 | return NOTIFY_OK; |
419 | } | 423 | } |
@@ -582,11 +586,7 @@ void ccwgroup_driver_unregister(struct ccwgroup_driver *cdriver) | |||
582 | __ccwgroup_match_all))) { | 586 | __ccwgroup_match_all))) { |
583 | struct ccwgroup_device *gdev = to_ccwgroupdev(dev); | 587 | struct ccwgroup_device *gdev = to_ccwgroupdev(dev); |
584 | 588 | ||
585 | mutex_lock(&gdev->reg_mutex); | 589 | ccwgroup_ungroup(gdev); |
586 | __ccwgroup_remove_symlinks(gdev); | ||
587 | device_unregister(dev); | ||
588 | __ccwgroup_remove_cdev_refs(gdev); | ||
589 | mutex_unlock(&gdev->reg_mutex); | ||
590 | put_device(dev); | 590 | put_device(dev); |
591 | } | 591 | } |
592 | driver_unregister(&cdriver->driver); | 592 | driver_unregister(&cdriver->driver); |
@@ -633,13 +633,7 @@ void ccwgroup_remove_ccwdev(struct ccw_device *cdev) | |||
633 | get_device(&gdev->dev); | 633 | get_device(&gdev->dev); |
634 | spin_unlock_irq(cdev->ccwlock); | 634 | spin_unlock_irq(cdev->ccwlock); |
635 | /* Unregister group device. */ | 635 | /* Unregister group device. */ |
636 | mutex_lock(&gdev->reg_mutex); | 636 | ccwgroup_ungroup(gdev); |
637 | if (device_is_registered(&gdev->dev)) { | ||
638 | __ccwgroup_remove_symlinks(gdev); | ||
639 | device_unregister(&gdev->dev); | ||
640 | __ccwgroup_remove_cdev_refs(gdev); | ||
641 | } | ||
642 | mutex_unlock(&gdev->reg_mutex); | ||
643 | /* Release ccwgroup device reference for local processing. */ | 637 | /* Release ccwgroup device reference for local processing. */ |
644 | put_device(&gdev->dev); | 638 | put_device(&gdev->dev); |
645 | } | 639 | } |
diff --git a/drivers/s390/cio/cio.c b/drivers/s390/cio/cio.c index 77f9c92df4b9..2905d8b0ec95 100644 --- a/drivers/s390/cio/cio.c +++ b/drivers/s390/cio/cio.c | |||
@@ -602,6 +602,7 @@ void __init init_cio_interrupts(void) | |||
602 | 602 | ||
603 | #ifdef CONFIG_CCW_CONSOLE | 603 | #ifdef CONFIG_CCW_CONSOLE |
604 | static struct subchannel *console_sch; | 604 | static struct subchannel *console_sch; |
605 | static struct lock_class_key console_sch_key; | ||
605 | 606 | ||
606 | /* | 607 | /* |
607 | * Use cio_tsch to update the subchannel status and call the interrupt handler | 608 | * Use cio_tsch to update the subchannel status and call the interrupt handler |
@@ -686,6 +687,7 @@ struct subchannel *cio_probe_console(void) | |||
686 | if (IS_ERR(sch)) | 687 | if (IS_ERR(sch)) |
687 | return sch; | 688 | return sch; |
688 | 689 | ||
690 | lockdep_set_class(sch->lock, &console_sch_key); | ||
689 | isc_register(CONSOLE_ISC); | 691 | isc_register(CONSOLE_ISC); |
690 | sch->config.isc = CONSOLE_ISC; | 692 | sch->config.isc = CONSOLE_ISC; |
691 | sch->config.intparm = (u32)(addr_t)sch; | 693 | sch->config.intparm = (u32)(addr_t)sch; |
diff --git a/drivers/s390/cio/device.c b/drivers/s390/cio/device.c index d8d9b5b5cc56..dfef5e63cb7b 100644 --- a/drivers/s390/cio/device.c +++ b/drivers/s390/cio/device.c | |||
@@ -678,18 +678,11 @@ static const struct attribute_group *ccwdev_attr_groups[] = { | |||
678 | NULL, | 678 | NULL, |
679 | }; | 679 | }; |
680 | 680 | ||
681 | /* this is a simple abstraction for device_register that sets the | 681 | static int ccw_device_add(struct ccw_device *cdev) |
682 | * correct bus type and adds the bus specific files */ | ||
683 | static int ccw_device_register(struct ccw_device *cdev) | ||
684 | { | 682 | { |
685 | struct device *dev = &cdev->dev; | 683 | struct device *dev = &cdev->dev; |
686 | int ret; | ||
687 | 684 | ||
688 | dev->bus = &ccw_bus_type; | 685 | dev->bus = &ccw_bus_type; |
689 | ret = dev_set_name(&cdev->dev, "0.%x.%04x", cdev->private->dev_id.ssid, | ||
690 | cdev->private->dev_id.devno); | ||
691 | if (ret) | ||
692 | return ret; | ||
693 | return device_add(dev); | 686 | return device_add(dev); |
694 | } | 687 | } |
695 | 688 | ||
@@ -764,22 +757,46 @@ static void ccw_device_todo(struct work_struct *work); | |||
764 | static int io_subchannel_initialize_dev(struct subchannel *sch, | 757 | static int io_subchannel_initialize_dev(struct subchannel *sch, |
765 | struct ccw_device *cdev) | 758 | struct ccw_device *cdev) |
766 | { | 759 | { |
767 | cdev->private->cdev = cdev; | 760 | struct ccw_device_private *priv = cdev->private; |
768 | cdev->private->int_class = IRQIO_CIO; | 761 | int ret; |
769 | atomic_set(&cdev->private->onoff, 0); | 762 | |
763 | priv->cdev = cdev; | ||
764 | priv->int_class = IRQIO_CIO; | ||
765 | priv->state = DEV_STATE_NOT_OPER; | ||
766 | priv->dev_id.devno = sch->schib.pmcw.dev; | ||
767 | priv->dev_id.ssid = sch->schid.ssid; | ||
768 | priv->schid = sch->schid; | ||
769 | |||
770 | INIT_WORK(&priv->todo_work, ccw_device_todo); | ||
771 | INIT_LIST_HEAD(&priv->cmb_list); | ||
772 | init_waitqueue_head(&priv->wait_q); | ||
773 | init_timer(&priv->timer); | ||
774 | |||
775 | atomic_set(&priv->onoff, 0); | ||
776 | cdev->ccwlock = sch->lock; | ||
770 | cdev->dev.parent = &sch->dev; | 777 | cdev->dev.parent = &sch->dev; |
771 | cdev->dev.release = ccw_device_release; | 778 | cdev->dev.release = ccw_device_release; |
772 | INIT_WORK(&cdev->private->todo_work, ccw_device_todo); | ||
773 | cdev->dev.groups = ccwdev_attr_groups; | 779 | cdev->dev.groups = ccwdev_attr_groups; |
774 | /* Do first half of device_register. */ | 780 | /* Do first half of device_register. */ |
775 | device_initialize(&cdev->dev); | 781 | device_initialize(&cdev->dev); |
782 | ret = dev_set_name(&cdev->dev, "0.%x.%04x", cdev->private->dev_id.ssid, | ||
783 | cdev->private->dev_id.devno); | ||
784 | if (ret) | ||
785 | goto out_put; | ||
776 | if (!get_device(&sch->dev)) { | 786 | if (!get_device(&sch->dev)) { |
777 | /* Release reference from device_initialize(). */ | 787 | ret = -ENODEV; |
778 | put_device(&cdev->dev); | 788 | goto out_put; |
779 | return -ENODEV; | ||
780 | } | 789 | } |
781 | cdev->private->flags.initialized = 1; | 790 | priv->flags.initialized = 1; |
791 | spin_lock_irq(sch->lock); | ||
792 | sch_set_cdev(sch, cdev); | ||
793 | spin_unlock_irq(sch->lock); | ||
782 | return 0; | 794 | return 0; |
795 | |||
796 | out_put: | ||
797 | /* Release reference from device_initialize(). */ | ||
798 | put_device(&cdev->dev); | ||
799 | return ret; | ||
783 | } | 800 | } |
784 | 801 | ||
785 | static struct ccw_device * io_subchannel_create_ccwdev(struct subchannel *sch) | 802 | static struct ccw_device * io_subchannel_create_ccwdev(struct subchannel *sch) |
@@ -858,7 +875,7 @@ static void io_subchannel_register(struct ccw_device *cdev) | |||
858 | dev_set_uevent_suppress(&sch->dev, 0); | 875 | dev_set_uevent_suppress(&sch->dev, 0); |
859 | kobject_uevent(&sch->dev.kobj, KOBJ_ADD); | 876 | kobject_uevent(&sch->dev.kobj, KOBJ_ADD); |
860 | /* make it known to the system */ | 877 | /* make it known to the system */ |
861 | ret = ccw_device_register(cdev); | 878 | ret = ccw_device_add(cdev); |
862 | if (ret) { | 879 | if (ret) { |
863 | CIO_MSG_EVENT(0, "Could not register ccw dev 0.%x.%04x: %d\n", | 880 | CIO_MSG_EVENT(0, "Could not register ccw dev 0.%x.%04x: %d\n", |
864 | cdev->private->dev_id.ssid, | 881 | cdev->private->dev_id.ssid, |
@@ -923,26 +940,11 @@ io_subchannel_recog_done(struct ccw_device *cdev) | |||
923 | 940 | ||
924 | static void io_subchannel_recog(struct ccw_device *cdev, struct subchannel *sch) | 941 | static void io_subchannel_recog(struct ccw_device *cdev, struct subchannel *sch) |
925 | { | 942 | { |
926 | struct ccw_device_private *priv; | ||
927 | |||
928 | cdev->ccwlock = sch->lock; | ||
929 | |||
930 | /* Init private data. */ | ||
931 | priv = cdev->private; | ||
932 | priv->dev_id.devno = sch->schib.pmcw.dev; | ||
933 | priv->dev_id.ssid = sch->schid.ssid; | ||
934 | priv->schid = sch->schid; | ||
935 | priv->state = DEV_STATE_NOT_OPER; | ||
936 | INIT_LIST_HEAD(&priv->cmb_list); | ||
937 | init_waitqueue_head(&priv->wait_q); | ||
938 | init_timer(&priv->timer); | ||
939 | |||
940 | /* Increase counter of devices currently in recognition. */ | 943 | /* Increase counter of devices currently in recognition. */ |
941 | atomic_inc(&ccw_device_init_count); | 944 | atomic_inc(&ccw_device_init_count); |
942 | 945 | ||
943 | /* Start async. device sensing. */ | 946 | /* Start async. device sensing. */ |
944 | spin_lock_irq(sch->lock); | 947 | spin_lock_irq(sch->lock); |
945 | sch_set_cdev(sch, cdev); | ||
946 | ccw_device_recognition(cdev); | 948 | ccw_device_recognition(cdev); |
947 | spin_unlock_irq(sch->lock); | 949 | spin_unlock_irq(sch->lock); |
948 | } | 950 | } |
@@ -1083,7 +1085,7 @@ static int io_subchannel_probe(struct subchannel *sch) | |||
1083 | dev_set_uevent_suppress(&sch->dev, 0); | 1085 | dev_set_uevent_suppress(&sch->dev, 0); |
1084 | kobject_uevent(&sch->dev.kobj, KOBJ_ADD); | 1086 | kobject_uevent(&sch->dev.kobj, KOBJ_ADD); |
1085 | cdev = sch_get_cdev(sch); | 1087 | cdev = sch_get_cdev(sch); |
1086 | rc = ccw_device_register(cdev); | 1088 | rc = ccw_device_add(cdev); |
1087 | if (rc) { | 1089 | if (rc) { |
1088 | /* Release online reference. */ | 1090 | /* Release online reference. */ |
1089 | put_device(&cdev->dev); | 1091 | put_device(&cdev->dev); |
@@ -1597,7 +1599,6 @@ int __init ccw_device_enable_console(struct ccw_device *cdev) | |||
1597 | if (rc) | 1599 | if (rc) |
1598 | return rc; | 1600 | return rc; |
1599 | sch->driver = &io_subchannel_driver; | 1601 | sch->driver = &io_subchannel_driver; |
1600 | sch_set_cdev(sch, cdev); | ||
1601 | io_subchannel_recog(cdev, sch); | 1602 | io_subchannel_recog(cdev, sch); |
1602 | /* Now wait for the async. recognition to come to an end. */ | 1603 | /* Now wait for the async. recognition to come to an end. */ |
1603 | spin_lock_irq(cdev->ccwlock); | 1604 | spin_lock_irq(cdev->ccwlock); |
@@ -1639,6 +1640,7 @@ struct ccw_device * __init ccw_device_create_console(struct ccw_driver *drv) | |||
1639 | put_device(&sch->dev); | 1640 | put_device(&sch->dev); |
1640 | return ERR_PTR(-ENOMEM); | 1641 | return ERR_PTR(-ENOMEM); |
1641 | } | 1642 | } |
1643 | set_io_private(sch, io_priv); | ||
1642 | cdev = io_subchannel_create_ccwdev(sch); | 1644 | cdev = io_subchannel_create_ccwdev(sch); |
1643 | if (IS_ERR(cdev)) { | 1645 | if (IS_ERR(cdev)) { |
1644 | put_device(&sch->dev); | 1646 | put_device(&sch->dev); |
@@ -1646,7 +1648,6 @@ struct ccw_device * __init ccw_device_create_console(struct ccw_driver *drv) | |||
1646 | return cdev; | 1648 | return cdev; |
1647 | } | 1649 | } |
1648 | cdev->drv = drv; | 1650 | cdev->drv = drv; |
1649 | set_io_private(sch, io_priv); | ||
1650 | ccw_device_set_int_class(cdev); | 1651 | ccw_device_set_int_class(cdev); |
1651 | return cdev; | 1652 | return cdev; |
1652 | } | 1653 | } |
diff --git a/drivers/s390/cio/qdio_debug.c b/drivers/s390/cio/qdio_debug.c index 4221b02085ad..f1f3baa8e6e4 100644 --- a/drivers/s390/cio/qdio_debug.c +++ b/drivers/s390/cio/qdio_debug.c | |||
@@ -7,6 +7,7 @@ | |||
7 | #include <linux/debugfs.h> | 7 | #include <linux/debugfs.h> |
8 | #include <linux/uaccess.h> | 8 | #include <linux/uaccess.h> |
9 | #include <linux/export.h> | 9 | #include <linux/export.h> |
10 | #include <linux/slab.h> | ||
10 | #include <asm/debug.h> | 11 | #include <asm/debug.h> |
11 | #include "qdio_debug.h" | 12 | #include "qdio_debug.h" |
12 | #include "qdio.h" | 13 | #include "qdio.h" |
@@ -16,11 +17,51 @@ debug_info_t *qdio_dbf_error; | |||
16 | 17 | ||
17 | static struct dentry *debugfs_root; | 18 | static struct dentry *debugfs_root; |
18 | #define QDIO_DEBUGFS_NAME_LEN 10 | 19 | #define QDIO_DEBUGFS_NAME_LEN 10 |
20 | #define QDIO_DBF_NAME_LEN 20 | ||
19 | 21 | ||
20 | void qdio_allocate_dbf(struct qdio_initialize *init_data, | 22 | struct qdio_dbf_entry { |
23 | char dbf_name[QDIO_DBF_NAME_LEN]; | ||
24 | debug_info_t *dbf_info; | ||
25 | struct list_head dbf_list; | ||
26 | }; | ||
27 | |||
28 | static LIST_HEAD(qdio_dbf_list); | ||
29 | static DEFINE_MUTEX(qdio_dbf_list_mutex); | ||
30 | |||
31 | static debug_info_t *qdio_get_dbf_entry(char *name) | ||
32 | { | ||
33 | struct qdio_dbf_entry *entry; | ||
34 | debug_info_t *rc = NULL; | ||
35 | |||
36 | mutex_lock(&qdio_dbf_list_mutex); | ||
37 | list_for_each_entry(entry, &qdio_dbf_list, dbf_list) { | ||
38 | if (strcmp(entry->dbf_name, name) == 0) { | ||
39 | rc = entry->dbf_info; | ||
40 | break; | ||
41 | } | ||
42 | } | ||
43 | mutex_unlock(&qdio_dbf_list_mutex); | ||
44 | return rc; | ||
45 | } | ||
46 | |||
47 | static void qdio_clear_dbf_list(void) | ||
48 | { | ||
49 | struct qdio_dbf_entry *entry, *tmp; | ||
50 | |||
51 | mutex_lock(&qdio_dbf_list_mutex); | ||
52 | list_for_each_entry_safe(entry, tmp, &qdio_dbf_list, dbf_list) { | ||
53 | list_del(&entry->dbf_list); | ||
54 | debug_unregister(entry->dbf_info); | ||
55 | kfree(entry); | ||
56 | } | ||
57 | mutex_unlock(&qdio_dbf_list_mutex); | ||
58 | } | ||
59 | |||
60 | int qdio_allocate_dbf(struct qdio_initialize *init_data, | ||
21 | struct qdio_irq *irq_ptr) | 61 | struct qdio_irq *irq_ptr) |
22 | { | 62 | { |
23 | char text[20]; | 63 | char text[QDIO_DBF_NAME_LEN]; |
64 | struct qdio_dbf_entry *new_entry; | ||
24 | 65 | ||
25 | DBF_EVENT("qfmt:%1d", init_data->q_format); | 66 | DBF_EVENT("qfmt:%1d", init_data->q_format); |
26 | DBF_HEX(init_data->adapter_name, 8); | 67 | DBF_HEX(init_data->adapter_name, 8); |
@@ -38,11 +79,34 @@ void qdio_allocate_dbf(struct qdio_initialize *init_data, | |||
38 | DBF_EVENT("irq:%8lx", (unsigned long)irq_ptr); | 79 | DBF_EVENT("irq:%8lx", (unsigned long)irq_ptr); |
39 | 80 | ||
40 | /* allocate trace view for the interface */ | 81 | /* allocate trace view for the interface */ |
41 | snprintf(text, 20, "qdio_%s", dev_name(&init_data->cdev->dev)); | 82 | snprintf(text, QDIO_DBF_NAME_LEN, "qdio_%s", |
42 | irq_ptr->debug_area = debug_register(text, 2, 1, 16); | 83 | dev_name(&init_data->cdev->dev)); |
43 | debug_register_view(irq_ptr->debug_area, &debug_hex_ascii_view); | 84 | irq_ptr->debug_area = qdio_get_dbf_entry(text); |
44 | debug_set_level(irq_ptr->debug_area, DBF_WARN); | 85 | if (irq_ptr->debug_area) |
45 | DBF_DEV_EVENT(DBF_ERR, irq_ptr, "dbf created"); | 86 | DBF_DEV_EVENT(DBF_ERR, irq_ptr, "dbf reused"); |
87 | else { | ||
88 | irq_ptr->debug_area = debug_register(text, 2, 1, 16); | ||
89 | if (!irq_ptr->debug_area) | ||
90 | return -ENOMEM; | ||
91 | if (debug_register_view(irq_ptr->debug_area, | ||
92 | &debug_hex_ascii_view)) { | ||
93 | debug_unregister(irq_ptr->debug_area); | ||
94 | return -ENOMEM; | ||
95 | } | ||
96 | debug_set_level(irq_ptr->debug_area, DBF_WARN); | ||
97 | DBF_DEV_EVENT(DBF_ERR, irq_ptr, "dbf created"); | ||
98 | new_entry = kzalloc(sizeof(struct qdio_dbf_entry), GFP_KERNEL); | ||
99 | if (!new_entry) { | ||
100 | debug_unregister(irq_ptr->debug_area); | ||
101 | return -ENOMEM; | ||
102 | } | ||
103 | strlcpy(new_entry->dbf_name, text, QDIO_DBF_NAME_LEN); | ||
104 | new_entry->dbf_info = irq_ptr->debug_area; | ||
105 | mutex_lock(&qdio_dbf_list_mutex); | ||
106 | list_add(&new_entry->dbf_list, &qdio_dbf_list); | ||
107 | mutex_unlock(&qdio_dbf_list_mutex); | ||
108 | } | ||
109 | return 0; | ||
46 | } | 110 | } |
47 | 111 | ||
48 | static int qstat_show(struct seq_file *m, void *v) | 112 | static int qstat_show(struct seq_file *m, void *v) |
@@ -300,6 +364,7 @@ int __init qdio_debug_init(void) | |||
300 | 364 | ||
301 | void qdio_debug_exit(void) | 365 | void qdio_debug_exit(void) |
302 | { | 366 | { |
367 | qdio_clear_dbf_list(); | ||
303 | debugfs_remove(debugfs_root); | 368 | debugfs_remove(debugfs_root); |
304 | if (qdio_dbf_setup) | 369 | if (qdio_dbf_setup) |
305 | debug_unregister(qdio_dbf_setup); | 370 | debug_unregister(qdio_dbf_setup); |
diff --git a/drivers/s390/cio/qdio_debug.h b/drivers/s390/cio/qdio_debug.h index dfac9bfefea3..f33ce8577619 100644 --- a/drivers/s390/cio/qdio_debug.h +++ b/drivers/s390/cio/qdio_debug.h | |||
@@ -75,7 +75,7 @@ static inline void DBF_DEV_HEX(struct qdio_irq *dev, void *addr, | |||
75 | } | 75 | } |
76 | } | 76 | } |
77 | 77 | ||
78 | void qdio_allocate_dbf(struct qdio_initialize *init_data, | 78 | int qdio_allocate_dbf(struct qdio_initialize *init_data, |
79 | struct qdio_irq *irq_ptr); | 79 | struct qdio_irq *irq_ptr); |
80 | void qdio_setup_debug_entries(struct qdio_irq *irq_ptr, | 80 | void qdio_setup_debug_entries(struct qdio_irq *irq_ptr, |
81 | struct ccw_device *cdev); | 81 | struct ccw_device *cdev); |
diff --git a/drivers/s390/cio/qdio_main.c b/drivers/s390/cio/qdio_main.c index 77466c4faabb..848e3b64ea6e 100644 --- a/drivers/s390/cio/qdio_main.c +++ b/drivers/s390/cio/qdio_main.c | |||
@@ -409,17 +409,16 @@ static inline void qdio_stop_polling(struct qdio_q *q) | |||
409 | set_buf_state(q, q->u.in.ack_start, SLSB_P_INPUT_NOT_INIT); | 409 | set_buf_state(q, q->u.in.ack_start, SLSB_P_INPUT_NOT_INIT); |
410 | } | 410 | } |
411 | 411 | ||
412 | static inline void account_sbals(struct qdio_q *q, int count) | 412 | static inline void account_sbals(struct qdio_q *q, unsigned int count) |
413 | { | 413 | { |
414 | int pos = 0; | 414 | int pos; |
415 | 415 | ||
416 | q->q_stats.nr_sbal_total += count; | 416 | q->q_stats.nr_sbal_total += count; |
417 | if (count == QDIO_MAX_BUFFERS_MASK) { | 417 | if (count == QDIO_MAX_BUFFERS_MASK) { |
418 | q->q_stats.nr_sbals[7]++; | 418 | q->q_stats.nr_sbals[7]++; |
419 | return; | 419 | return; |
420 | } | 420 | } |
421 | while (count >>= 1) | 421 | pos = ilog2(count); |
422 | pos++; | ||
423 | q->q_stats.nr_sbals[pos]++; | 422 | q->q_stats.nr_sbals[pos]++; |
424 | } | 423 | } |
425 | 424 | ||
@@ -1234,12 +1233,10 @@ int qdio_free(struct ccw_device *cdev) | |||
1234 | return -ENODEV; | 1233 | return -ENODEV; |
1235 | 1234 | ||
1236 | DBF_EVENT("qfree:%4x", cdev->private->schid.sch_no); | 1235 | DBF_EVENT("qfree:%4x", cdev->private->schid.sch_no); |
1236 | DBF_DEV_EVENT(DBF_ERR, irq_ptr, "dbf abandoned"); | ||
1237 | mutex_lock(&irq_ptr->setup_mutex); | 1237 | mutex_lock(&irq_ptr->setup_mutex); |
1238 | 1238 | ||
1239 | if (irq_ptr->debug_area != NULL) { | 1239 | irq_ptr->debug_area = NULL; |
1240 | debug_unregister(irq_ptr->debug_area); | ||
1241 | irq_ptr->debug_area = NULL; | ||
1242 | } | ||
1243 | cdev->private->qdio_data = NULL; | 1240 | cdev->private->qdio_data = NULL; |
1244 | mutex_unlock(&irq_ptr->setup_mutex); | 1241 | mutex_unlock(&irq_ptr->setup_mutex); |
1245 | 1242 | ||
@@ -1276,7 +1273,8 @@ int qdio_allocate(struct qdio_initialize *init_data) | |||
1276 | goto out_err; | 1273 | goto out_err; |
1277 | 1274 | ||
1278 | mutex_init(&irq_ptr->setup_mutex); | 1275 | mutex_init(&irq_ptr->setup_mutex); |
1279 | qdio_allocate_dbf(init_data, irq_ptr); | 1276 | if (qdio_allocate_dbf(init_data, irq_ptr)) |
1277 | goto out_rel; | ||
1280 | 1278 | ||
1281 | /* | 1279 | /* |
1282 | * Allocate a page for the chsc calls in qdio_establish. | 1280 | * Allocate a page for the chsc calls in qdio_establish. |
diff --git a/drivers/s390/crypto/ap_bus.c b/drivers/s390/crypto/ap_bus.c index 8eec1653c9cc..69ef4f8cfac8 100644 --- a/drivers/s390/crypto/ap_bus.c +++ b/drivers/s390/crypto/ap_bus.c | |||
@@ -77,12 +77,12 @@ MODULE_ALIAS("z90crypt"); | |||
77 | * Module parameter | 77 | * Module parameter |
78 | */ | 78 | */ |
79 | int ap_domain_index = -1; /* Adjunct Processor Domain Index */ | 79 | int ap_domain_index = -1; /* Adjunct Processor Domain Index */ |
80 | module_param_named(domain, ap_domain_index, int, 0000); | 80 | module_param_named(domain, ap_domain_index, int, S_IRUSR|S_IRGRP); |
81 | MODULE_PARM_DESC(domain, "domain index for ap devices"); | 81 | MODULE_PARM_DESC(domain, "domain index for ap devices"); |
82 | EXPORT_SYMBOL(ap_domain_index); | 82 | EXPORT_SYMBOL(ap_domain_index); |
83 | 83 | ||
84 | static int ap_thread_flag = 0; | 84 | static int ap_thread_flag = 0; |
85 | module_param_named(poll_thread, ap_thread_flag, int, 0000); | 85 | module_param_named(poll_thread, ap_thread_flag, int, S_IRUSR|S_IRGRP); |
86 | MODULE_PARM_DESC(poll_thread, "Turn on/off poll thread, default is 0 (off)."); | 86 | MODULE_PARM_DESC(poll_thread, "Turn on/off poll thread, default is 0 (off)."); |
87 | 87 | ||
88 | static struct device *ap_root_device = NULL; | 88 | static struct device *ap_root_device = NULL; |
diff --git a/drivers/s390/crypto/zcrypt_api.c b/drivers/s390/crypto/zcrypt_api.c index 5222ebe15705..0e18c5dcd91f 100644 --- a/drivers/s390/crypto/zcrypt_api.c +++ b/drivers/s390/crypto/zcrypt_api.c | |||
@@ -356,7 +356,7 @@ struct zcrypt_ops *zcrypt_msgtype_request(unsigned char *name, int variant) | |||
356 | 356 | ||
357 | zops = __ops_lookup(name, variant); | 357 | zops = __ops_lookup(name, variant); |
358 | if (!zops) { | 358 | if (!zops) { |
359 | request_module(name); | 359 | request_module("%s", name); |
360 | zops = __ops_lookup(name, variant); | 360 | zops = __ops_lookup(name, variant); |
361 | } | 361 | } |
362 | if ((!zops) || (!try_module_get(zops->owner))) | 362 | if ((!zops) || (!try_module_get(zops->owner))) |
diff --git a/drivers/scsi/be2iscsi/be_main.c b/drivers/scsi/be2iscsi/be_main.c index 554349029628..56467df3d6de 100644 --- a/drivers/scsi/be2iscsi/be_main.c +++ b/drivers/scsi/be2iscsi/be_main.c | |||
@@ -4198,6 +4198,8 @@ static int hba_setup_cid_tbls(struct beiscsi_hba *phba) | |||
4198 | kfree(phba->ep_array); | 4198 | kfree(phba->ep_array); |
4199 | phba->ep_array = NULL; | 4199 | phba->ep_array = NULL; |
4200 | ret = -ENOMEM; | 4200 | ret = -ENOMEM; |
4201 | |||
4202 | goto free_memory; | ||
4201 | } | 4203 | } |
4202 | 4204 | ||
4203 | for (i = 0; i < phba->params.cxns_per_ctrl; i++) { | 4205 | for (i = 0; i < phba->params.cxns_per_ctrl; i++) { |
diff --git a/drivers/scsi/be2iscsi/be_mgmt.c b/drivers/scsi/be2iscsi/be_mgmt.c index 6045aa78986a..07934b0b9ee1 100644 --- a/drivers/scsi/be2iscsi/be_mgmt.c +++ b/drivers/scsi/be2iscsi/be_mgmt.c | |||
@@ -1008,10 +1008,8 @@ int mgmt_set_ip(struct beiscsi_hba *phba, | |||
1008 | BE2_IPV6 : BE2_IPV4 ; | 1008 | BE2_IPV6 : BE2_IPV4 ; |
1009 | 1009 | ||
1010 | rc = mgmt_get_if_info(phba, ip_type, &if_info); | 1010 | rc = mgmt_get_if_info(phba, ip_type, &if_info); |
1011 | if (rc) { | 1011 | if (rc) |
1012 | kfree(if_info); | ||
1013 | return rc; | 1012 | return rc; |
1014 | } | ||
1015 | 1013 | ||
1016 | if (boot_proto == ISCSI_BOOTPROTO_DHCP) { | 1014 | if (boot_proto == ISCSI_BOOTPROTO_DHCP) { |
1017 | if (if_info->dhcp_state) { | 1015 | if (if_info->dhcp_state) { |
diff --git a/drivers/scsi/bnx2fc/bnx2fc_fcoe.c b/drivers/scsi/bnx2fc/bnx2fc_fcoe.c index f54843023466..785d0d71781e 100644 --- a/drivers/scsi/bnx2fc/bnx2fc_fcoe.c +++ b/drivers/scsi/bnx2fc/bnx2fc_fcoe.c | |||
@@ -516,23 +516,17 @@ static void bnx2fc_recv_frame(struct sk_buff *skb) | |||
516 | skb_pull(skb, sizeof(struct fcoe_hdr)); | 516 | skb_pull(skb, sizeof(struct fcoe_hdr)); |
517 | fr_len = skb->len - sizeof(struct fcoe_crc_eof); | 517 | fr_len = skb->len - sizeof(struct fcoe_crc_eof); |
518 | 518 | ||
519 | stats = per_cpu_ptr(lport->stats, get_cpu()); | ||
520 | stats->RxFrames++; | ||
521 | stats->RxWords += fr_len / FCOE_WORD_TO_BYTE; | ||
522 | |||
523 | fp = (struct fc_frame *)skb; | 519 | fp = (struct fc_frame *)skb; |
524 | fc_frame_init(fp); | 520 | fc_frame_init(fp); |
525 | fr_dev(fp) = lport; | 521 | fr_dev(fp) = lport; |
526 | fr_sof(fp) = hp->fcoe_sof; | 522 | fr_sof(fp) = hp->fcoe_sof; |
527 | if (skb_copy_bits(skb, fr_len, &crc_eof, sizeof(crc_eof))) { | 523 | if (skb_copy_bits(skb, fr_len, &crc_eof, sizeof(crc_eof))) { |
528 | put_cpu(); | ||
529 | kfree_skb(skb); | 524 | kfree_skb(skb); |
530 | return; | 525 | return; |
531 | } | 526 | } |
532 | fr_eof(fp) = crc_eof.fcoe_eof; | 527 | fr_eof(fp) = crc_eof.fcoe_eof; |
533 | fr_crc(fp) = crc_eof.fcoe_crc32; | 528 | fr_crc(fp) = crc_eof.fcoe_crc32; |
534 | if (pskb_trim(skb, fr_len)) { | 529 | if (pskb_trim(skb, fr_len)) { |
535 | put_cpu(); | ||
536 | kfree_skb(skb); | 530 | kfree_skb(skb); |
537 | return; | 531 | return; |
538 | } | 532 | } |
@@ -544,7 +538,6 @@ static void bnx2fc_recv_frame(struct sk_buff *skb) | |||
544 | port = lport_priv(vn_port); | 538 | port = lport_priv(vn_port); |
545 | if (!ether_addr_equal(port->data_src_addr, dest_mac)) { | 539 | if (!ether_addr_equal(port->data_src_addr, dest_mac)) { |
546 | BNX2FC_HBA_DBG(lport, "fpma mismatch\n"); | 540 | BNX2FC_HBA_DBG(lport, "fpma mismatch\n"); |
547 | put_cpu(); | ||
548 | kfree_skb(skb); | 541 | kfree_skb(skb); |
549 | return; | 542 | return; |
550 | } | 543 | } |
@@ -552,7 +545,6 @@ static void bnx2fc_recv_frame(struct sk_buff *skb) | |||
552 | if (fh->fh_r_ctl == FC_RCTL_DD_SOL_DATA && | 545 | if (fh->fh_r_ctl == FC_RCTL_DD_SOL_DATA && |
553 | fh->fh_type == FC_TYPE_FCP) { | 546 | fh->fh_type == FC_TYPE_FCP) { |
554 | /* Drop FCP data. We dont this in L2 path */ | 547 | /* Drop FCP data. We dont this in L2 path */ |
555 | put_cpu(); | ||
556 | kfree_skb(skb); | 548 | kfree_skb(skb); |
557 | return; | 549 | return; |
558 | } | 550 | } |
@@ -562,7 +554,6 @@ static void bnx2fc_recv_frame(struct sk_buff *skb) | |||
562 | case ELS_LOGO: | 554 | case ELS_LOGO: |
563 | if (ntoh24(fh->fh_s_id) == FC_FID_FLOGI) { | 555 | if (ntoh24(fh->fh_s_id) == FC_FID_FLOGI) { |
564 | /* drop non-FIP LOGO */ | 556 | /* drop non-FIP LOGO */ |
565 | put_cpu(); | ||
566 | kfree_skb(skb); | 557 | kfree_skb(skb); |
567 | return; | 558 | return; |
568 | } | 559 | } |
@@ -572,22 +563,23 @@ static void bnx2fc_recv_frame(struct sk_buff *skb) | |||
572 | 563 | ||
573 | if (fh->fh_r_ctl == FC_RCTL_BA_ABTS) { | 564 | if (fh->fh_r_ctl == FC_RCTL_BA_ABTS) { |
574 | /* Drop incoming ABTS */ | 565 | /* Drop incoming ABTS */ |
575 | put_cpu(); | ||
576 | kfree_skb(skb); | 566 | kfree_skb(skb); |
577 | return; | 567 | return; |
578 | } | 568 | } |
579 | 569 | ||
570 | stats = per_cpu_ptr(lport->stats, smp_processor_id()); | ||
571 | stats->RxFrames++; | ||
572 | stats->RxWords += fr_len / FCOE_WORD_TO_BYTE; | ||
573 | |||
580 | if (le32_to_cpu(fr_crc(fp)) != | 574 | if (le32_to_cpu(fr_crc(fp)) != |
581 | ~crc32(~0, skb->data, fr_len)) { | 575 | ~crc32(~0, skb->data, fr_len)) { |
582 | if (stats->InvalidCRCCount < 5) | 576 | if (stats->InvalidCRCCount < 5) |
583 | printk(KERN_WARNING PFX "dropping frame with " | 577 | printk(KERN_WARNING PFX "dropping frame with " |
584 | "CRC error\n"); | 578 | "CRC error\n"); |
585 | stats->InvalidCRCCount++; | 579 | stats->InvalidCRCCount++; |
586 | put_cpu(); | ||
587 | kfree_skb(skb); | 580 | kfree_skb(skb); |
588 | return; | 581 | return; |
589 | } | 582 | } |
590 | put_cpu(); | ||
591 | fc_exch_recv(lport, fp); | 583 | fc_exch_recv(lport, fp); |
592 | } | 584 | } |
593 | 585 | ||
diff --git a/drivers/scsi/bnx2fc/bnx2fc_io.c b/drivers/scsi/bnx2fc/bnx2fc_io.c index 32a5e0a2a669..7bc47fc7c686 100644 --- a/drivers/scsi/bnx2fc/bnx2fc_io.c +++ b/drivers/scsi/bnx2fc/bnx2fc_io.c | |||
@@ -282,6 +282,8 @@ struct bnx2fc_cmd_mgr *bnx2fc_cmd_mgr_alloc(struct bnx2fc_hba *hba) | |||
282 | arr_sz, GFP_KERNEL); | 282 | arr_sz, GFP_KERNEL); |
283 | if (!cmgr->free_list_lock) { | 283 | if (!cmgr->free_list_lock) { |
284 | printk(KERN_ERR PFX "failed to alloc free_list_lock\n"); | 284 | printk(KERN_ERR PFX "failed to alloc free_list_lock\n"); |
285 | kfree(cmgr->free_list); | ||
286 | cmgr->free_list = NULL; | ||
285 | goto mem_err; | 287 | goto mem_err; |
286 | } | 288 | } |
287 | 289 | ||
diff --git a/drivers/scsi/ibmvscsi/ibmvscsi.c b/drivers/scsi/ibmvscsi/ibmvscsi.c index 2ebfb2bb0f42..7b23f21f22f1 100644 --- a/drivers/scsi/ibmvscsi/ibmvscsi.c +++ b/drivers/scsi/ibmvscsi/ibmvscsi.c | |||
@@ -185,6 +185,11 @@ static struct viosrp_crq *crq_queue_next_crq(struct crq_queue *queue) | |||
185 | if (crq->valid & 0x80) { | 185 | if (crq->valid & 0x80) { |
186 | if (++queue->cur == queue->size) | 186 | if (++queue->cur == queue->size) |
187 | queue->cur = 0; | 187 | queue->cur = 0; |
188 | |||
189 | /* Ensure the read of the valid bit occurs before reading any | ||
190 | * other bits of the CRQ entry | ||
191 | */ | ||
192 | rmb(); | ||
188 | } else | 193 | } else |
189 | crq = NULL; | 194 | crq = NULL; |
190 | spin_unlock_irqrestore(&queue->lock, flags); | 195 | spin_unlock_irqrestore(&queue->lock, flags); |
@@ -203,6 +208,11 @@ static int ibmvscsi_send_crq(struct ibmvscsi_host_data *hostdata, | |||
203 | { | 208 | { |
204 | struct vio_dev *vdev = to_vio_dev(hostdata->dev); | 209 | struct vio_dev *vdev = to_vio_dev(hostdata->dev); |
205 | 210 | ||
211 | /* | ||
212 | * Ensure the command buffer is flushed to memory before handing it | ||
213 | * over to the VIOS to prevent it from fetching any stale data. | ||
214 | */ | ||
215 | mb(); | ||
206 | return plpar_hcall_norets(H_SEND_CRQ, vdev->unit_address, word1, word2); | 216 | return plpar_hcall_norets(H_SEND_CRQ, vdev->unit_address, word1, word2); |
207 | } | 217 | } |
208 | 218 | ||
@@ -797,7 +807,8 @@ static void purge_requests(struct ibmvscsi_host_data *hostdata, int error_code) | |||
797 | evt->hostdata->dev); | 807 | evt->hostdata->dev); |
798 | if (evt->cmnd_done) | 808 | if (evt->cmnd_done) |
799 | evt->cmnd_done(evt->cmnd); | 809 | evt->cmnd_done(evt->cmnd); |
800 | } else if (evt->done) | 810 | } else if (evt->done && evt->crq.format != VIOSRP_MAD_FORMAT && |
811 | evt->iu.srp.login_req.opcode != SRP_LOGIN_REQ) | ||
801 | evt->done(evt); | 812 | evt->done(evt); |
802 | free_event_struct(&evt->hostdata->pool, evt); | 813 | free_event_struct(&evt->hostdata->pool, evt); |
803 | spin_lock_irqsave(hostdata->host->host_lock, flags); | 814 | spin_lock_irqsave(hostdata->host->host_lock, flags); |
diff --git a/drivers/scsi/mvsas/mv_94xx.c b/drivers/scsi/mvsas/mv_94xx.c index 1e4479f3331a..9270d15ff1a4 100644 --- a/drivers/scsi/mvsas/mv_94xx.c +++ b/drivers/scsi/mvsas/mv_94xx.c | |||
@@ -564,7 +564,7 @@ static void mvs_94xx_interrupt_enable(struct mvs_info *mvi) | |||
564 | u32 tmp; | 564 | u32 tmp; |
565 | 565 | ||
566 | tmp = mr32(MVS_GBL_CTL); | 566 | tmp = mr32(MVS_GBL_CTL); |
567 | tmp |= (IRQ_SAS_A | IRQ_SAS_B); | 567 | tmp |= (MVS_IRQ_SAS_A | MVS_IRQ_SAS_B); |
568 | mw32(MVS_GBL_INT_STAT, tmp); | 568 | mw32(MVS_GBL_INT_STAT, tmp); |
569 | writel(tmp, regs + 0x0C); | 569 | writel(tmp, regs + 0x0C); |
570 | writel(tmp, regs + 0x10); | 570 | writel(tmp, regs + 0x10); |
@@ -580,7 +580,7 @@ static void mvs_94xx_interrupt_disable(struct mvs_info *mvi) | |||
580 | 580 | ||
581 | tmp = mr32(MVS_GBL_CTL); | 581 | tmp = mr32(MVS_GBL_CTL); |
582 | 582 | ||
583 | tmp &= ~(IRQ_SAS_A | IRQ_SAS_B); | 583 | tmp &= ~(MVS_IRQ_SAS_A | MVS_IRQ_SAS_B); |
584 | mw32(MVS_GBL_INT_STAT, tmp); | 584 | mw32(MVS_GBL_INT_STAT, tmp); |
585 | writel(tmp, regs + 0x0C); | 585 | writel(tmp, regs + 0x0C); |
586 | writel(tmp, regs + 0x10); | 586 | writel(tmp, regs + 0x10); |
@@ -596,7 +596,7 @@ static u32 mvs_94xx_isr_status(struct mvs_info *mvi, int irq) | |||
596 | if (!(mvi->flags & MVF_FLAG_SOC)) { | 596 | if (!(mvi->flags & MVF_FLAG_SOC)) { |
597 | stat = mr32(MVS_GBL_INT_STAT); | 597 | stat = mr32(MVS_GBL_INT_STAT); |
598 | 598 | ||
599 | if (!(stat & (IRQ_SAS_A | IRQ_SAS_B))) | 599 | if (!(stat & (MVS_IRQ_SAS_A | MVS_IRQ_SAS_B))) |
600 | return 0; | 600 | return 0; |
601 | } | 601 | } |
602 | return stat; | 602 | return stat; |
@@ -606,8 +606,8 @@ static irqreturn_t mvs_94xx_isr(struct mvs_info *mvi, int irq, u32 stat) | |||
606 | { | 606 | { |
607 | void __iomem *regs = mvi->regs; | 607 | void __iomem *regs = mvi->regs; |
608 | 608 | ||
609 | if (((stat & IRQ_SAS_A) && mvi->id == 0) || | 609 | if (((stat & MVS_IRQ_SAS_A) && mvi->id == 0) || |
610 | ((stat & IRQ_SAS_B) && mvi->id == 1)) { | 610 | ((stat & MVS_IRQ_SAS_B) && mvi->id == 1)) { |
611 | mw32_f(MVS_INT_STAT, CINT_DONE); | 611 | mw32_f(MVS_INT_STAT, CINT_DONE); |
612 | 612 | ||
613 | spin_lock(&mvi->lock); | 613 | spin_lock(&mvi->lock); |
diff --git a/drivers/scsi/mvsas/mv_94xx.h b/drivers/scsi/mvsas/mv_94xx.h index 487aa6f97412..14e197497b46 100644 --- a/drivers/scsi/mvsas/mv_94xx.h +++ b/drivers/scsi/mvsas/mv_94xx.h | |||
@@ -150,35 +150,35 @@ enum chip_register_bits { | |||
150 | 150 | ||
151 | enum pci_interrupt_cause { | 151 | enum pci_interrupt_cause { |
152 | /* MAIN_IRQ_CAUSE (R10200) Bits*/ | 152 | /* MAIN_IRQ_CAUSE (R10200) Bits*/ |
153 | IRQ_COM_IN_I2O_IOP0 = (1 << 0), | 153 | MVS_IRQ_COM_IN_I2O_IOP0 = (1 << 0), |
154 | IRQ_COM_IN_I2O_IOP1 = (1 << 1), | 154 | MVS_IRQ_COM_IN_I2O_IOP1 = (1 << 1), |
155 | IRQ_COM_IN_I2O_IOP2 = (1 << 2), | 155 | MVS_IRQ_COM_IN_I2O_IOP2 = (1 << 2), |
156 | IRQ_COM_IN_I2O_IOP3 = (1 << 3), | 156 | MVS_IRQ_COM_IN_I2O_IOP3 = (1 << 3), |
157 | IRQ_COM_OUT_I2O_HOS0 = (1 << 4), | 157 | MVS_IRQ_COM_OUT_I2O_HOS0 = (1 << 4), |
158 | IRQ_COM_OUT_I2O_HOS1 = (1 << 5), | 158 | MVS_IRQ_COM_OUT_I2O_HOS1 = (1 << 5), |
159 | IRQ_COM_OUT_I2O_HOS2 = (1 << 6), | 159 | MVS_IRQ_COM_OUT_I2O_HOS2 = (1 << 6), |
160 | IRQ_COM_OUT_I2O_HOS3 = (1 << 7), | 160 | MVS_IRQ_COM_OUT_I2O_HOS3 = (1 << 7), |
161 | IRQ_PCIF_TO_CPU_DRBL0 = (1 << 8), | 161 | MVS_IRQ_PCIF_TO_CPU_DRBL0 = (1 << 8), |
162 | IRQ_PCIF_TO_CPU_DRBL1 = (1 << 9), | 162 | MVS_IRQ_PCIF_TO_CPU_DRBL1 = (1 << 9), |
163 | IRQ_PCIF_TO_CPU_DRBL2 = (1 << 10), | 163 | MVS_IRQ_PCIF_TO_CPU_DRBL2 = (1 << 10), |
164 | IRQ_PCIF_TO_CPU_DRBL3 = (1 << 11), | 164 | MVS_IRQ_PCIF_TO_CPU_DRBL3 = (1 << 11), |
165 | IRQ_PCIF_DRBL0 = (1 << 12), | 165 | MVS_IRQ_PCIF_DRBL0 = (1 << 12), |
166 | IRQ_PCIF_DRBL1 = (1 << 13), | 166 | MVS_IRQ_PCIF_DRBL1 = (1 << 13), |
167 | IRQ_PCIF_DRBL2 = (1 << 14), | 167 | MVS_IRQ_PCIF_DRBL2 = (1 << 14), |
168 | IRQ_PCIF_DRBL3 = (1 << 15), | 168 | MVS_IRQ_PCIF_DRBL3 = (1 << 15), |
169 | IRQ_XOR_A = (1 << 16), | 169 | MVS_IRQ_XOR_A = (1 << 16), |
170 | IRQ_XOR_B = (1 << 17), | 170 | MVS_IRQ_XOR_B = (1 << 17), |
171 | IRQ_SAS_A = (1 << 18), | 171 | MVS_IRQ_SAS_A = (1 << 18), |
172 | IRQ_SAS_B = (1 << 19), | 172 | MVS_IRQ_SAS_B = (1 << 19), |
173 | IRQ_CPU_CNTRL = (1 << 20), | 173 | MVS_IRQ_CPU_CNTRL = (1 << 20), |
174 | IRQ_GPIO = (1 << 21), | 174 | MVS_IRQ_GPIO = (1 << 21), |
175 | IRQ_UART = (1 << 22), | 175 | MVS_IRQ_UART = (1 << 22), |
176 | IRQ_SPI = (1 << 23), | 176 | MVS_IRQ_SPI = (1 << 23), |
177 | IRQ_I2C = (1 << 24), | 177 | MVS_IRQ_I2C = (1 << 24), |
178 | IRQ_SGPIO = (1 << 25), | 178 | MVS_IRQ_SGPIO = (1 << 25), |
179 | IRQ_COM_ERR = (1 << 29), | 179 | MVS_IRQ_COM_ERR = (1 << 29), |
180 | IRQ_I2O_ERR = (1 << 30), | 180 | MVS_IRQ_I2O_ERR = (1 << 30), |
181 | IRQ_PCIE_ERR = (1 << 31), | 181 | MVS_IRQ_PCIE_ERR = (1 << 31), |
182 | }; | 182 | }; |
183 | 183 | ||
184 | union reg_phy_cfg { | 184 | union reg_phy_cfg { |
diff --git a/drivers/scsi/pm8001/pm8001_init.c b/drivers/scsi/pm8001/pm8001_init.c index c4f31b21feb8..e90c89f1d480 100644 --- a/drivers/scsi/pm8001/pm8001_init.c +++ b/drivers/scsi/pm8001/pm8001_init.c | |||
@@ -677,7 +677,7 @@ static void pm8001_init_sas_add(struct pm8001_hba_info *pm8001_ha) | |||
677 | * pm8001_get_phy_settings_info : Read phy setting values. | 677 | * pm8001_get_phy_settings_info : Read phy setting values. |
678 | * @pm8001_ha : our hba. | 678 | * @pm8001_ha : our hba. |
679 | */ | 679 | */ |
680 | void pm8001_get_phy_settings_info(struct pm8001_hba_info *pm8001_ha) | 680 | static int pm8001_get_phy_settings_info(struct pm8001_hba_info *pm8001_ha) |
681 | { | 681 | { |
682 | 682 | ||
683 | #ifdef PM8001_READ_VPD | 683 | #ifdef PM8001_READ_VPD |
@@ -691,11 +691,15 @@ void pm8001_get_phy_settings_info(struct pm8001_hba_info *pm8001_ha) | |||
691 | payload.offset = 0; | 691 | payload.offset = 0; |
692 | payload.length = 4096; | 692 | payload.length = 4096; |
693 | payload.func_specific = kzalloc(4096, GFP_KERNEL); | 693 | payload.func_specific = kzalloc(4096, GFP_KERNEL); |
694 | if (!payload.func_specific) | ||
695 | return -ENOMEM; | ||
694 | /* Read phy setting values from flash */ | 696 | /* Read phy setting values from flash */ |
695 | PM8001_CHIP_DISP->get_nvmd_req(pm8001_ha, &payload); | 697 | PM8001_CHIP_DISP->get_nvmd_req(pm8001_ha, &payload); |
696 | wait_for_completion(&completion); | 698 | wait_for_completion(&completion); |
697 | pm8001_set_phy_profile(pm8001_ha, sizeof(u8), payload.func_specific); | 699 | pm8001_set_phy_profile(pm8001_ha, sizeof(u8), payload.func_specific); |
700 | kfree(payload.func_specific); | ||
698 | #endif | 701 | #endif |
702 | return 0; | ||
699 | } | 703 | } |
700 | 704 | ||
701 | #ifdef PM8001_USE_MSIX | 705 | #ifdef PM8001_USE_MSIX |
@@ -879,8 +883,11 @@ static int pm8001_pci_probe(struct pci_dev *pdev, | |||
879 | pm8001_init_sas_add(pm8001_ha); | 883 | pm8001_init_sas_add(pm8001_ha); |
880 | /* phy setting support for motherboard controller */ | 884 | /* phy setting support for motherboard controller */ |
881 | if (pdev->subsystem_vendor != PCI_VENDOR_ID_ADAPTEC2 && | 885 | if (pdev->subsystem_vendor != PCI_VENDOR_ID_ADAPTEC2 && |
882 | pdev->subsystem_vendor != 0) | 886 | pdev->subsystem_vendor != 0) { |
883 | pm8001_get_phy_settings_info(pm8001_ha); | 887 | rc = pm8001_get_phy_settings_info(pm8001_ha); |
888 | if (rc) | ||
889 | goto err_out_shost; | ||
890 | } | ||
884 | pm8001_post_sas_ha_init(shost, chip); | 891 | pm8001_post_sas_ha_init(shost, chip); |
885 | rc = sas_register_ha(SHOST_TO_SAS_HA(shost)); | 892 | rc = sas_register_ha(SHOST_TO_SAS_HA(shost)); |
886 | if (rc) | 893 | if (rc) |
diff --git a/drivers/scsi/qla2xxx/qla_target.c b/drivers/scsi/qla2xxx/qla_target.c index 4b188b0164e9..e632e14180cf 100644 --- a/drivers/scsi/qla2xxx/qla_target.c +++ b/drivers/scsi/qla2xxx/qla_target.c | |||
@@ -1128,7 +1128,7 @@ static void qlt_24xx_retry_term_exchange(struct scsi_qla_host *vha, | |||
1128 | ctio->u.status1.flags = | 1128 | ctio->u.status1.flags = |
1129 | __constant_cpu_to_le16(CTIO7_FLAGS_STATUS_MODE_1 | | 1129 | __constant_cpu_to_le16(CTIO7_FLAGS_STATUS_MODE_1 | |
1130 | CTIO7_FLAGS_TERMINATE); | 1130 | CTIO7_FLAGS_TERMINATE); |
1131 | ctio->u.status1.ox_id = entry->fcp_hdr_le.ox_id; | 1131 | ctio->u.status1.ox_id = cpu_to_le16(entry->fcp_hdr_le.ox_id); |
1132 | 1132 | ||
1133 | qla2x00_start_iocbs(vha, vha->req); | 1133 | qla2x00_start_iocbs(vha, vha->req); |
1134 | 1134 | ||
@@ -1262,6 +1262,7 @@ static void qlt_24xx_send_task_mgmt_ctio(struct scsi_qla_host *ha, | |||
1262 | { | 1262 | { |
1263 | struct atio_from_isp *atio = &mcmd->orig_iocb.atio; | 1263 | struct atio_from_isp *atio = &mcmd->orig_iocb.atio; |
1264 | struct ctio7_to_24xx *ctio; | 1264 | struct ctio7_to_24xx *ctio; |
1265 | uint16_t temp; | ||
1265 | 1266 | ||
1266 | ql_dbg(ql_dbg_tgt, ha, 0xe008, | 1267 | ql_dbg(ql_dbg_tgt, ha, 0xe008, |
1267 | "Sending task mgmt CTIO7 (ha=%p, atio=%p, resp_code=%x\n", | 1268 | "Sending task mgmt CTIO7 (ha=%p, atio=%p, resp_code=%x\n", |
@@ -1292,7 +1293,8 @@ static void qlt_24xx_send_task_mgmt_ctio(struct scsi_qla_host *ha, | |||
1292 | ctio->u.status1.flags = (atio->u.isp24.attr << 9) | | 1293 | ctio->u.status1.flags = (atio->u.isp24.attr << 9) | |
1293 | __constant_cpu_to_le16(CTIO7_FLAGS_STATUS_MODE_1 | | 1294 | __constant_cpu_to_le16(CTIO7_FLAGS_STATUS_MODE_1 | |
1294 | CTIO7_FLAGS_SEND_STATUS); | 1295 | CTIO7_FLAGS_SEND_STATUS); |
1295 | ctio->u.status1.ox_id = swab16(atio->u.isp24.fcp_hdr.ox_id); | 1296 | temp = be16_to_cpu(atio->u.isp24.fcp_hdr.ox_id); |
1297 | ctio->u.status1.ox_id = cpu_to_le16(temp); | ||
1296 | ctio->u.status1.scsi_status = | 1298 | ctio->u.status1.scsi_status = |
1297 | __constant_cpu_to_le16(SS_RESPONSE_INFO_LEN_VALID); | 1299 | __constant_cpu_to_le16(SS_RESPONSE_INFO_LEN_VALID); |
1298 | ctio->u.status1.response_len = __constant_cpu_to_le16(8); | 1300 | ctio->u.status1.response_len = __constant_cpu_to_le16(8); |
@@ -1513,6 +1515,7 @@ static int qlt_24xx_build_ctio_pkt(struct qla_tgt_prm *prm, | |||
1513 | struct ctio7_to_24xx *pkt; | 1515 | struct ctio7_to_24xx *pkt; |
1514 | struct qla_hw_data *ha = vha->hw; | 1516 | struct qla_hw_data *ha = vha->hw; |
1515 | struct atio_from_isp *atio = &prm->cmd->atio; | 1517 | struct atio_from_isp *atio = &prm->cmd->atio; |
1518 | uint16_t temp; | ||
1516 | 1519 | ||
1517 | pkt = (struct ctio7_to_24xx *)vha->req->ring_ptr; | 1520 | pkt = (struct ctio7_to_24xx *)vha->req->ring_ptr; |
1518 | prm->pkt = pkt; | 1521 | prm->pkt = pkt; |
@@ -1541,13 +1544,13 @@ static int qlt_24xx_build_ctio_pkt(struct qla_tgt_prm *prm, | |||
1541 | pkt->initiator_id[2] = atio->u.isp24.fcp_hdr.s_id[0]; | 1544 | pkt->initiator_id[2] = atio->u.isp24.fcp_hdr.s_id[0]; |
1542 | pkt->exchange_addr = atio->u.isp24.exchange_addr; | 1545 | pkt->exchange_addr = atio->u.isp24.exchange_addr; |
1543 | pkt->u.status0.flags |= (atio->u.isp24.attr << 9); | 1546 | pkt->u.status0.flags |= (atio->u.isp24.attr << 9); |
1544 | pkt->u.status0.ox_id = swab16(atio->u.isp24.fcp_hdr.ox_id); | 1547 | temp = be16_to_cpu(atio->u.isp24.fcp_hdr.ox_id); |
1548 | pkt->u.status0.ox_id = cpu_to_le16(temp); | ||
1545 | pkt->u.status0.relative_offset = cpu_to_le32(prm->cmd->offset); | 1549 | pkt->u.status0.relative_offset = cpu_to_le32(prm->cmd->offset); |
1546 | 1550 | ||
1547 | ql_dbg(ql_dbg_tgt, vha, 0xe00c, | 1551 | ql_dbg(ql_dbg_tgt, vha, 0xe00c, |
1548 | "qla_target(%d): handle(cmd) -> %08x, timeout %d, ox_id %#x\n", | 1552 | "qla_target(%d): handle(cmd) -> %08x, timeout %d, ox_id %#x\n", |
1549 | vha->vp_idx, pkt->handle, QLA_TGT_TIMEOUT, | 1553 | vha->vp_idx, pkt->handle, QLA_TGT_TIMEOUT, temp); |
1550 | le16_to_cpu(pkt->u.status0.ox_id)); | ||
1551 | return 0; | 1554 | return 0; |
1552 | } | 1555 | } |
1553 | 1556 | ||
@@ -2619,6 +2622,7 @@ static int __qlt_send_term_exchange(struct scsi_qla_host *vha, | |||
2619 | struct qla_hw_data *ha = vha->hw; | 2622 | struct qla_hw_data *ha = vha->hw; |
2620 | request_t *pkt; | 2623 | request_t *pkt; |
2621 | int ret = 0; | 2624 | int ret = 0; |
2625 | uint16_t temp; | ||
2622 | 2626 | ||
2623 | ql_dbg(ql_dbg_tgt, vha, 0xe01c, "Sending TERM EXCH CTIO (ha=%p)\n", ha); | 2627 | ql_dbg(ql_dbg_tgt, vha, 0xe01c, "Sending TERM EXCH CTIO (ha=%p)\n", ha); |
2624 | 2628 | ||
@@ -2655,7 +2659,8 @@ static int __qlt_send_term_exchange(struct scsi_qla_host *vha, | |||
2655 | ctio24->u.status1.flags = (atio->u.isp24.attr << 9) | | 2659 | ctio24->u.status1.flags = (atio->u.isp24.attr << 9) | |
2656 | __constant_cpu_to_le16(CTIO7_FLAGS_STATUS_MODE_1 | | 2660 | __constant_cpu_to_le16(CTIO7_FLAGS_STATUS_MODE_1 | |
2657 | CTIO7_FLAGS_TERMINATE); | 2661 | CTIO7_FLAGS_TERMINATE); |
2658 | ctio24->u.status1.ox_id = swab16(atio->u.isp24.fcp_hdr.ox_id); | 2662 | temp = be16_to_cpu(atio->u.isp24.fcp_hdr.ox_id); |
2663 | ctio24->u.status1.ox_id = cpu_to_le16(temp); | ||
2659 | 2664 | ||
2660 | /* Most likely, it isn't needed */ | 2665 | /* Most likely, it isn't needed */ |
2661 | ctio24->u.status1.residual = get_unaligned((uint32_t *) | 2666 | ctio24->u.status1.residual = get_unaligned((uint32_t *) |
diff --git a/drivers/scsi/qla2xxx/qla_target.h b/drivers/scsi/qla2xxx/qla_target.h index e0a58fd13f66..d1d24fb0160a 100644 --- a/drivers/scsi/qla2xxx/qla_target.h +++ b/drivers/scsi/qla2xxx/qla_target.h | |||
@@ -443,7 +443,7 @@ struct ctio7_to_24xx { | |||
443 | uint16_t reserved1; | 443 | uint16_t reserved1; |
444 | __le16 flags; | 444 | __le16 flags; |
445 | uint32_t residual; | 445 | uint32_t residual; |
446 | uint16_t ox_id; | 446 | __le16 ox_id; |
447 | uint16_t scsi_status; | 447 | uint16_t scsi_status; |
448 | uint32_t relative_offset; | 448 | uint32_t relative_offset; |
449 | uint32_t reserved2; | 449 | uint32_t reserved2; |
@@ -458,7 +458,7 @@ struct ctio7_to_24xx { | |||
458 | uint16_t sense_length; | 458 | uint16_t sense_length; |
459 | uint16_t flags; | 459 | uint16_t flags; |
460 | uint32_t residual; | 460 | uint32_t residual; |
461 | uint16_t ox_id; | 461 | __le16 ox_id; |
462 | uint16_t scsi_status; | 462 | uint16_t scsi_status; |
463 | uint16_t response_len; | 463 | uint16_t response_len; |
464 | uint16_t reserved; | 464 | uint16_t reserved; |
diff --git a/drivers/scsi/scsi_error.c b/drivers/scsi/scsi_error.c index cbe38e5e7955..7e957918f33f 100644 --- a/drivers/scsi/scsi_error.c +++ b/drivers/scsi/scsi_error.c | |||
@@ -131,7 +131,7 @@ scmd_eh_abort_handler(struct work_struct *work) | |||
131 | "aborting command %p\n", scmd)); | 131 | "aborting command %p\n", scmd)); |
132 | rtn = scsi_try_to_abort_cmd(sdev->host->hostt, scmd); | 132 | rtn = scsi_try_to_abort_cmd(sdev->host->hostt, scmd); |
133 | if (rtn == SUCCESS) { | 133 | if (rtn == SUCCESS) { |
134 | scmd->result |= DID_TIME_OUT << 16; | 134 | set_host_byte(scmd, DID_TIME_OUT); |
135 | if (scsi_host_eh_past_deadline(sdev->host)) { | 135 | if (scsi_host_eh_past_deadline(sdev->host)) { |
136 | SCSI_LOG_ERROR_RECOVERY(3, | 136 | SCSI_LOG_ERROR_RECOVERY(3, |
137 | scmd_printk(KERN_INFO, scmd, | 137 | scmd_printk(KERN_INFO, scmd, |
@@ -167,7 +167,7 @@ scmd_eh_abort_handler(struct work_struct *work) | |||
167 | scmd_printk(KERN_WARNING, scmd, | 167 | scmd_printk(KERN_WARNING, scmd, |
168 | "scmd %p terminate " | 168 | "scmd %p terminate " |
169 | "aborted command\n", scmd)); | 169 | "aborted command\n", scmd)); |
170 | scmd->result |= DID_TIME_OUT << 16; | 170 | set_host_byte(scmd, DID_TIME_OUT); |
171 | scsi_finish_command(scmd); | 171 | scsi_finish_command(scmd); |
172 | } | 172 | } |
173 | } | 173 | } |
@@ -287,15 +287,15 @@ enum blk_eh_timer_return scsi_times_out(struct request *req) | |||
287 | else if (host->hostt->eh_timed_out) | 287 | else if (host->hostt->eh_timed_out) |
288 | rtn = host->hostt->eh_timed_out(scmd); | 288 | rtn = host->hostt->eh_timed_out(scmd); |
289 | 289 | ||
290 | if (rtn == BLK_EH_NOT_HANDLED && !host->hostt->no_async_abort) | 290 | if (rtn == BLK_EH_NOT_HANDLED) { |
291 | if (scsi_abort_command(scmd) == SUCCESS) | 291 | if (!host->hostt->no_async_abort && |
292 | scsi_abort_command(scmd) == SUCCESS) | ||
292 | return BLK_EH_NOT_HANDLED; | 293 | return BLK_EH_NOT_HANDLED; |
293 | 294 | ||
294 | scmd->result |= DID_TIME_OUT << 16; | 295 | set_host_byte(scmd, DID_TIME_OUT); |
295 | 296 | if (!scsi_eh_scmd_add(scmd, SCSI_EH_CANCEL_CMD)) | |
296 | if (unlikely(rtn == BLK_EH_NOT_HANDLED && | 297 | rtn = BLK_EH_HANDLED; |
297 | !scsi_eh_scmd_add(scmd, SCSI_EH_CANCEL_CMD))) | 298 | } |
298 | rtn = BLK_EH_HANDLED; | ||
299 | 299 | ||
300 | return rtn; | 300 | return rtn; |
301 | } | 301 | } |
@@ -1777,7 +1777,7 @@ int scsi_decide_disposition(struct scsi_cmnd *scmd) | |||
1777 | break; | 1777 | break; |
1778 | case DID_ABORT: | 1778 | case DID_ABORT: |
1779 | if (scmd->eh_eflags & SCSI_EH_ABORT_SCHEDULED) { | 1779 | if (scmd->eh_eflags & SCSI_EH_ABORT_SCHEDULED) { |
1780 | scmd->result |= DID_TIME_OUT << 16; | 1780 | set_host_byte(scmd, DID_TIME_OUT); |
1781 | return SUCCESS; | 1781 | return SUCCESS; |
1782 | } | 1782 | } |
1783 | case DID_NO_CONNECT: | 1783 | case DID_NO_CONNECT: |
diff --git a/drivers/scsi/scsi_transport_fc.c b/drivers/scsi/scsi_transport_fc.c index f80908f74ca9..521f5838594b 100644 --- a/drivers/scsi/scsi_transport_fc.c +++ b/drivers/scsi/scsi_transport_fc.c | |||
@@ -2549,6 +2549,7 @@ fc_rport_final_delete(struct work_struct *work) | |||
2549 | fc_flush_devloss(shost); | 2549 | fc_flush_devloss(shost); |
2550 | if (!cancel_delayed_work(&rport->dev_loss_work)) | 2550 | if (!cancel_delayed_work(&rport->dev_loss_work)) |
2551 | fc_flush_devloss(shost); | 2551 | fc_flush_devloss(shost); |
2552 | cancel_work_sync(&rport->scan_work); | ||
2552 | spin_lock_irqsave(shost->host_lock, flags); | 2553 | spin_lock_irqsave(shost->host_lock, flags); |
2553 | rport->flags &= ~FC_RPORT_DEVLOSS_PENDING; | 2554 | rport->flags &= ~FC_RPORT_DEVLOSS_PENDING; |
2554 | } | 2555 | } |
diff --git a/drivers/scsi/sd.c b/drivers/scsi/sd.c index e9689d57ccb6..6825eda1114a 100644 --- a/drivers/scsi/sd.c +++ b/drivers/scsi/sd.c | |||
@@ -2441,7 +2441,10 @@ sd_read_cache_type(struct scsi_disk *sdkp, unsigned char *buffer) | |||
2441 | } | 2441 | } |
2442 | 2442 | ||
2443 | sdkp->DPOFUA = (data.device_specific & 0x10) != 0; | 2443 | sdkp->DPOFUA = (data.device_specific & 0x10) != 0; |
2444 | if (sdkp->DPOFUA && !sdkp->device->use_10_for_rw) { | 2444 | if (sdp->broken_fua) { |
2445 | sd_first_printk(KERN_NOTICE, sdkp, "Disabling FUA\n"); | ||
2446 | sdkp->DPOFUA = 0; | ||
2447 | } else if (sdkp->DPOFUA && !sdkp->device->use_10_for_rw) { | ||
2445 | sd_first_printk(KERN_NOTICE, sdkp, | 2448 | sd_first_printk(KERN_NOTICE, sdkp, |
2446 | "Uses READ/WRITE(6), disabling FUA\n"); | 2449 | "Uses READ/WRITE(6), disabling FUA\n"); |
2447 | sdkp->DPOFUA = 0; | 2450 | sdkp->DPOFUA = 0; |
diff --git a/drivers/scsi/virtio_scsi.c b/drivers/scsi/virtio_scsi.c index 89ee5929eb6d..308256b5e4cb 100644 --- a/drivers/scsi/virtio_scsi.c +++ b/drivers/scsi/virtio_scsi.c | |||
@@ -237,6 +237,16 @@ static void virtscsi_req_done(struct virtqueue *vq) | |||
237 | virtscsi_vq_done(vscsi, req_vq, virtscsi_complete_cmd); | 237 | virtscsi_vq_done(vscsi, req_vq, virtscsi_complete_cmd); |
238 | }; | 238 | }; |
239 | 239 | ||
240 | static void virtscsi_poll_requests(struct virtio_scsi *vscsi) | ||
241 | { | ||
242 | int i, num_vqs; | ||
243 | |||
244 | num_vqs = vscsi->num_queues; | ||
245 | for (i = 0; i < num_vqs; i++) | ||
246 | virtscsi_vq_done(vscsi, &vscsi->req_vqs[i], | ||
247 | virtscsi_complete_cmd); | ||
248 | } | ||
249 | |||
240 | static void virtscsi_complete_free(struct virtio_scsi *vscsi, void *buf) | 250 | static void virtscsi_complete_free(struct virtio_scsi *vscsi, void *buf) |
241 | { | 251 | { |
242 | struct virtio_scsi_cmd *cmd = buf; | 252 | struct virtio_scsi_cmd *cmd = buf; |
@@ -253,6 +263,8 @@ static void virtscsi_ctrl_done(struct virtqueue *vq) | |||
253 | virtscsi_vq_done(vscsi, &vscsi->ctrl_vq, virtscsi_complete_free); | 263 | virtscsi_vq_done(vscsi, &vscsi->ctrl_vq, virtscsi_complete_free); |
254 | }; | 264 | }; |
255 | 265 | ||
266 | static void virtscsi_handle_event(struct work_struct *work); | ||
267 | |||
256 | static int virtscsi_kick_event(struct virtio_scsi *vscsi, | 268 | static int virtscsi_kick_event(struct virtio_scsi *vscsi, |
257 | struct virtio_scsi_event_node *event_node) | 269 | struct virtio_scsi_event_node *event_node) |
258 | { | 270 | { |
@@ -260,6 +272,7 @@ static int virtscsi_kick_event(struct virtio_scsi *vscsi, | |||
260 | struct scatterlist sg; | 272 | struct scatterlist sg; |
261 | unsigned long flags; | 273 | unsigned long flags; |
262 | 274 | ||
275 | INIT_WORK(&event_node->work, virtscsi_handle_event); | ||
263 | sg_init_one(&sg, &event_node->event, sizeof(struct virtio_scsi_event)); | 276 | sg_init_one(&sg, &event_node->event, sizeof(struct virtio_scsi_event)); |
264 | 277 | ||
265 | spin_lock_irqsave(&vscsi->event_vq.vq_lock, flags); | 278 | spin_lock_irqsave(&vscsi->event_vq.vq_lock, flags); |
@@ -377,7 +390,6 @@ static void virtscsi_complete_event(struct virtio_scsi *vscsi, void *buf) | |||
377 | { | 390 | { |
378 | struct virtio_scsi_event_node *event_node = buf; | 391 | struct virtio_scsi_event_node *event_node = buf; |
379 | 392 | ||
380 | INIT_WORK(&event_node->work, virtscsi_handle_event); | ||
381 | schedule_work(&event_node->work); | 393 | schedule_work(&event_node->work); |
382 | } | 394 | } |
383 | 395 | ||
@@ -589,6 +601,18 @@ static int virtscsi_tmf(struct virtio_scsi *vscsi, struct virtio_scsi_cmd *cmd) | |||
589 | cmd->resp.tmf.response == VIRTIO_SCSI_S_FUNCTION_SUCCEEDED) | 601 | cmd->resp.tmf.response == VIRTIO_SCSI_S_FUNCTION_SUCCEEDED) |
590 | ret = SUCCESS; | 602 | ret = SUCCESS; |
591 | 603 | ||
604 | /* | ||
605 | * The spec guarantees that all requests related to the TMF have | ||
606 | * been completed, but the callback might not have run yet if | ||
607 | * we're using independent interrupts (e.g. MSI). Poll the | ||
608 | * virtqueues once. | ||
609 | * | ||
610 | * In the abort case, sc->scsi_done will do nothing, because | ||
611 | * the block layer must have detected a timeout and as a result | ||
612 | * REQ_ATOM_COMPLETE has been set. | ||
613 | */ | ||
614 | virtscsi_poll_requests(vscsi); | ||
615 | |||
592 | out: | 616 | out: |
593 | mempool_free(cmd, virtscsi_cmd_pool); | 617 | mempool_free(cmd, virtscsi_cmd_pool); |
594 | return ret; | 618 | return ret; |
diff --git a/drivers/spi/spi-pxa2xx-dma.c b/drivers/spi/spi-pxa2xx-dma.c index f6759dc0153b..c41ff148a2b4 100644 --- a/drivers/spi/spi-pxa2xx-dma.c +++ b/drivers/spi/spi-pxa2xx-dma.c | |||
@@ -368,7 +368,7 @@ int pxa2xx_spi_set_dma_burst_and_threshold(struct chip_data *chip, | |||
368 | * otherwise we use the default. Also we use the default FIFO | 368 | * otherwise we use the default. Also we use the default FIFO |
369 | * thresholds for now. | 369 | * thresholds for now. |
370 | */ | 370 | */ |
371 | *burst_code = chip_info ? chip_info->dma_burst_size : 16; | 371 | *burst_code = chip_info ? chip_info->dma_burst_size : 1; |
372 | *threshold = SSCR1_RxTresh(RX_THRESH_DFLT) | 372 | *threshold = SSCR1_RxTresh(RX_THRESH_DFLT) |
373 | | SSCR1_TxTresh(TX_THRESH_DFLT); | 373 | | SSCR1_TxTresh(TX_THRESH_DFLT); |
374 | 374 | ||
diff --git a/drivers/spi/spi-pxa2xx.c b/drivers/spi/spi-pxa2xx.c index a98df7eeb42d..fe792106bdc5 100644 --- a/drivers/spi/spi-pxa2xx.c +++ b/drivers/spi/spi-pxa2xx.c | |||
@@ -118,6 +118,7 @@ static void lpss_ssp_setup(struct driver_data *drv_data) | |||
118 | */ | 118 | */ |
119 | orig = readl(drv_data->ioaddr + offset + SPI_CS_CONTROL); | 119 | orig = readl(drv_data->ioaddr + offset + SPI_CS_CONTROL); |
120 | 120 | ||
121 | /* Test SPI_CS_CONTROL_SW_MODE bit enabling */ | ||
121 | value = orig | SPI_CS_CONTROL_SW_MODE; | 122 | value = orig | SPI_CS_CONTROL_SW_MODE; |
122 | writel(value, drv_data->ioaddr + offset + SPI_CS_CONTROL); | 123 | writel(value, drv_data->ioaddr + offset + SPI_CS_CONTROL); |
123 | value = readl(drv_data->ioaddr + offset + SPI_CS_CONTROL); | 124 | value = readl(drv_data->ioaddr + offset + SPI_CS_CONTROL); |
@@ -126,10 +127,13 @@ static void lpss_ssp_setup(struct driver_data *drv_data) | |||
126 | goto detection_done; | 127 | goto detection_done; |
127 | } | 128 | } |
128 | 129 | ||
129 | value &= ~SPI_CS_CONTROL_SW_MODE; | 130 | orig = readl(drv_data->ioaddr + offset + SPI_CS_CONTROL); |
131 | |||
132 | /* Test SPI_CS_CONTROL_SW_MODE bit disabling */ | ||
133 | value = orig & ~SPI_CS_CONTROL_SW_MODE; | ||
130 | writel(value, drv_data->ioaddr + offset + SPI_CS_CONTROL); | 134 | writel(value, drv_data->ioaddr + offset + SPI_CS_CONTROL); |
131 | value = readl(drv_data->ioaddr + offset + SPI_CS_CONTROL); | 135 | value = readl(drv_data->ioaddr + offset + SPI_CS_CONTROL); |
132 | if (value != orig) { | 136 | if (value != (orig & ~SPI_CS_CONTROL_SW_MODE)) { |
133 | offset = 0x800; | 137 | offset = 0x800; |
134 | goto detection_done; | 138 | goto detection_done; |
135 | } | 139 | } |
diff --git a/drivers/spi/spi-qup.c b/drivers/spi/spi-qup.c index fc1de86d3c8a..c08da380cb23 100644 --- a/drivers/spi/spi-qup.c +++ b/drivers/spi/spi-qup.c | |||
@@ -424,31 +424,6 @@ static int spi_qup_io_config(struct spi_device *spi, struct spi_transfer *xfer) | |||
424 | return 0; | 424 | return 0; |
425 | } | 425 | } |
426 | 426 | ||
427 | static void spi_qup_set_cs(struct spi_device *spi, bool enable) | ||
428 | { | ||
429 | struct spi_qup *controller = spi_master_get_devdata(spi->master); | ||
430 | |||
431 | u32 iocontol, mask; | ||
432 | |||
433 | iocontol = readl_relaxed(controller->base + SPI_IO_CONTROL); | ||
434 | |||
435 | /* Disable auto CS toggle and use manual */ | ||
436 | iocontol &= ~SPI_IO_C_MX_CS_MODE; | ||
437 | iocontol |= SPI_IO_C_FORCE_CS; | ||
438 | |||
439 | iocontol &= ~SPI_IO_C_CS_SELECT_MASK; | ||
440 | iocontol |= SPI_IO_C_CS_SELECT(spi->chip_select); | ||
441 | |||
442 | mask = SPI_IO_C_CS_N_POLARITY_0 << spi->chip_select; | ||
443 | |||
444 | if (enable) | ||
445 | iocontol |= mask; | ||
446 | else | ||
447 | iocontol &= ~mask; | ||
448 | |||
449 | writel_relaxed(iocontol, controller->base + SPI_IO_CONTROL); | ||
450 | } | ||
451 | |||
452 | static int spi_qup_transfer_one(struct spi_master *master, | 427 | static int spi_qup_transfer_one(struct spi_master *master, |
453 | struct spi_device *spi, | 428 | struct spi_device *spi, |
454 | struct spi_transfer *xfer) | 429 | struct spi_transfer *xfer) |
@@ -571,12 +546,16 @@ static int spi_qup_probe(struct platform_device *pdev) | |||
571 | return -ENOMEM; | 546 | return -ENOMEM; |
572 | } | 547 | } |
573 | 548 | ||
549 | /* use num-cs unless not present or out of range */ | ||
550 | if (of_property_read_u16(dev->of_node, "num-cs", | ||
551 | &master->num_chipselect) || | ||
552 | (master->num_chipselect > SPI_NUM_CHIPSELECTS)) | ||
553 | master->num_chipselect = SPI_NUM_CHIPSELECTS; | ||
554 | |||
574 | master->bus_num = pdev->id; | 555 | master->bus_num = pdev->id; |
575 | master->mode_bits = SPI_CPOL | SPI_CPHA | SPI_CS_HIGH | SPI_LOOP; | 556 | master->mode_bits = SPI_CPOL | SPI_CPHA | SPI_CS_HIGH | SPI_LOOP; |
576 | master->num_chipselect = SPI_NUM_CHIPSELECTS; | ||
577 | master->bits_per_word_mask = SPI_BPW_RANGE_MASK(4, 32); | 557 | master->bits_per_word_mask = SPI_BPW_RANGE_MASK(4, 32); |
578 | master->max_speed_hz = max_freq; | 558 | master->max_speed_hz = max_freq; |
579 | master->set_cs = spi_qup_set_cs; | ||
580 | master->transfer_one = spi_qup_transfer_one; | 559 | master->transfer_one = spi_qup_transfer_one; |
581 | master->dev.of_node = pdev->dev.of_node; | 560 | master->dev.of_node = pdev->dev.of_node; |
582 | master->auto_runtime_pm = true; | 561 | master->auto_runtime_pm = true; |
@@ -640,16 +619,19 @@ static int spi_qup_probe(struct platform_device *pdev) | |||
640 | if (ret) | 619 | if (ret) |
641 | goto error; | 620 | goto error; |
642 | 621 | ||
643 | ret = devm_spi_register_master(dev, master); | ||
644 | if (ret) | ||
645 | goto error; | ||
646 | |||
647 | pm_runtime_set_autosuspend_delay(dev, MSEC_PER_SEC); | 622 | pm_runtime_set_autosuspend_delay(dev, MSEC_PER_SEC); |
648 | pm_runtime_use_autosuspend(dev); | 623 | pm_runtime_use_autosuspend(dev); |
649 | pm_runtime_set_active(dev); | 624 | pm_runtime_set_active(dev); |
650 | pm_runtime_enable(dev); | 625 | pm_runtime_enable(dev); |
626 | |||
627 | ret = devm_spi_register_master(dev, master); | ||
628 | if (ret) | ||
629 | goto disable_pm; | ||
630 | |||
651 | return 0; | 631 | return 0; |
652 | 632 | ||
633 | disable_pm: | ||
634 | pm_runtime_disable(&pdev->dev); | ||
653 | error: | 635 | error: |
654 | clk_disable_unprepare(cclk); | 636 | clk_disable_unprepare(cclk); |
655 | clk_disable_unprepare(iclk); | 637 | clk_disable_unprepare(iclk); |
diff --git a/drivers/spi/spi-sh-sci.c b/drivers/spi/spi-sh-sci.c index 1f56ef651d1a..b83dd733684c 100644 --- a/drivers/spi/spi-sh-sci.c +++ b/drivers/spi/spi-sh-sci.c | |||
@@ -175,9 +175,9 @@ static int sh_sci_spi_remove(struct platform_device *dev) | |||
175 | { | 175 | { |
176 | struct sh_sci_spi *sp = platform_get_drvdata(dev); | 176 | struct sh_sci_spi *sp = platform_get_drvdata(dev); |
177 | 177 | ||
178 | iounmap(sp->membase); | ||
179 | setbits(sp, PIN_INIT, 0); | ||
180 | spi_bitbang_stop(&sp->bitbang); | 178 | spi_bitbang_stop(&sp->bitbang); |
179 | setbits(sp, PIN_INIT, 0); | ||
180 | iounmap(sp->membase); | ||
181 | spi_master_put(sp->bitbang.master); | 181 | spi_master_put(sp->bitbang.master); |
182 | return 0; | 182 | return 0; |
183 | } | 183 | } |
diff --git a/drivers/staging/android/timed_output.c b/drivers/staging/android/timed_output.c index 2c617834dc46..c341ac11c5a3 100644 --- a/drivers/staging/android/timed_output.c +++ b/drivers/staging/android/timed_output.c | |||
@@ -97,7 +97,6 @@ void timed_output_dev_unregister(struct timed_output_dev *tdev) | |||
97 | { | 97 | { |
98 | tdev->enable(tdev, 0); | 98 | tdev->enable(tdev, 0); |
99 | device_destroy(timed_output_class, MKDEV(0, tdev->index)); | 99 | device_destroy(timed_output_class, MKDEV(0, tdev->index)); |
100 | dev_set_drvdata(tdev->dev, NULL); | ||
101 | } | 100 | } |
102 | EXPORT_SYMBOL_GPL(timed_output_dev_unregister); | 101 | EXPORT_SYMBOL_GPL(timed_output_dev_unregister); |
103 | 102 | ||
diff --git a/drivers/staging/comedi/Kconfig b/drivers/staging/comedi/Kconfig index 5d56428d508a..a2f6957e7ee9 100644 --- a/drivers/staging/comedi/Kconfig +++ b/drivers/staging/comedi/Kconfig | |||
@@ -651,6 +651,7 @@ config COMEDI_ADDI_APCI_1516 | |||
651 | 651 | ||
652 | config COMEDI_ADDI_APCI_1564 | 652 | config COMEDI_ADDI_APCI_1564 |
653 | tristate "ADDI-DATA APCI_1564 support" | 653 | tristate "ADDI-DATA APCI_1564 support" |
654 | select COMEDI_ADDI_WATCHDOG | ||
654 | ---help--- | 655 | ---help--- |
655 | Enable support for ADDI-DATA APCI_1564 cards | 656 | Enable support for ADDI-DATA APCI_1564 cards |
656 | 657 | ||
diff --git a/drivers/staging/iio/Kconfig b/drivers/staging/iio/Kconfig index b36feb080cba..fa38be0982f9 100644 --- a/drivers/staging/iio/Kconfig +++ b/drivers/staging/iio/Kconfig | |||
@@ -36,10 +36,11 @@ config IIO_SIMPLE_DUMMY_EVENTS | |||
36 | Add some dummy events to the simple dummy driver. | 36 | Add some dummy events to the simple dummy driver. |
37 | 37 | ||
38 | config IIO_SIMPLE_DUMMY_BUFFER | 38 | config IIO_SIMPLE_DUMMY_BUFFER |
39 | boolean "Buffered capture support" | 39 | boolean "Buffered capture support" |
40 | select IIO_KFIFO_BUF | 40 | select IIO_BUFFER |
41 | help | 41 | select IIO_KFIFO_BUF |
42 | Add buffered data capture to the simple dummy driver. | 42 | help |
43 | Add buffered data capture to the simple dummy driver. | ||
43 | 44 | ||
44 | endif # IIO_SIMPLE_DUMMY | 45 | endif # IIO_SIMPLE_DUMMY |
45 | 46 | ||
diff --git a/drivers/staging/iio/adc/ad7291.c b/drivers/staging/iio/adc/ad7291.c index 357cef2a6f4c..7194bd138762 100644 --- a/drivers/staging/iio/adc/ad7291.c +++ b/drivers/staging/iio/adc/ad7291.c | |||
@@ -465,7 +465,7 @@ static int ad7291_probe(struct i2c_client *client, | |||
465 | struct ad7291_platform_data *pdata = client->dev.platform_data; | 465 | struct ad7291_platform_data *pdata = client->dev.platform_data; |
466 | struct ad7291_chip_info *chip; | 466 | struct ad7291_chip_info *chip; |
467 | struct iio_dev *indio_dev; | 467 | struct iio_dev *indio_dev; |
468 | int ret = 0; | 468 | int ret; |
469 | 469 | ||
470 | indio_dev = devm_iio_device_alloc(&client->dev, sizeof(*chip)); | 470 | indio_dev = devm_iio_device_alloc(&client->dev, sizeof(*chip)); |
471 | if (!indio_dev) | 471 | if (!indio_dev) |
@@ -475,7 +475,7 @@ static int ad7291_probe(struct i2c_client *client, | |||
475 | if (pdata && pdata->use_external_ref) { | 475 | if (pdata && pdata->use_external_ref) { |
476 | chip->reg = devm_regulator_get(&client->dev, "vref"); | 476 | chip->reg = devm_regulator_get(&client->dev, "vref"); |
477 | if (IS_ERR(chip->reg)) | 477 | if (IS_ERR(chip->reg)) |
478 | return ret; | 478 | return PTR_ERR(chip->reg); |
479 | 479 | ||
480 | ret = regulator_enable(chip->reg); | 480 | ret = regulator_enable(chip->reg); |
481 | if (ret) | 481 | if (ret) |
diff --git a/drivers/staging/iio/adc/mxs-lradc.c b/drivers/staging/iio/adc/mxs-lradc.c index dae8d1a9038e..52d7517b342e 100644 --- a/drivers/staging/iio/adc/mxs-lradc.c +++ b/drivers/staging/iio/adc/mxs-lradc.c | |||
@@ -846,6 +846,14 @@ static int mxs_lradc_read_single(struct iio_dev *iio_dev, int chan, int *val) | |||
846 | LRADC_CTRL1); | 846 | LRADC_CTRL1); |
847 | mxs_lradc_reg_clear(lradc, 0xff, LRADC_CTRL0); | 847 | mxs_lradc_reg_clear(lradc, 0xff, LRADC_CTRL0); |
848 | 848 | ||
849 | /* Enable / disable the divider per requirement */ | ||
850 | if (test_bit(chan, &lradc->is_divided)) | ||
851 | mxs_lradc_reg_set(lradc, 1 << LRADC_CTRL2_DIVIDE_BY_TWO_OFFSET, | ||
852 | LRADC_CTRL2); | ||
853 | else | ||
854 | mxs_lradc_reg_clear(lradc, | ||
855 | 1 << LRADC_CTRL2_DIVIDE_BY_TWO_OFFSET, LRADC_CTRL2); | ||
856 | |||
849 | /* Clean the slot's previous content, then set new one. */ | 857 | /* Clean the slot's previous content, then set new one. */ |
850 | mxs_lradc_reg_clear(lradc, LRADC_CTRL4_LRADCSELECT_MASK(0), | 858 | mxs_lradc_reg_clear(lradc, LRADC_CTRL4_LRADCSELECT_MASK(0), |
851 | LRADC_CTRL4); | 859 | LRADC_CTRL4); |
@@ -961,15 +969,11 @@ static int mxs_lradc_write_raw(struct iio_dev *iio_dev, | |||
961 | if (val == scale_avail[MXS_LRADC_DIV_DISABLED].integer && | 969 | if (val == scale_avail[MXS_LRADC_DIV_DISABLED].integer && |
962 | val2 == scale_avail[MXS_LRADC_DIV_DISABLED].nano) { | 970 | val2 == scale_avail[MXS_LRADC_DIV_DISABLED].nano) { |
963 | /* divider by two disabled */ | 971 | /* divider by two disabled */ |
964 | writel(1 << LRADC_CTRL2_DIVIDE_BY_TWO_OFFSET, | ||
965 | lradc->base + LRADC_CTRL2 + STMP_OFFSET_REG_CLR); | ||
966 | clear_bit(chan->channel, &lradc->is_divided); | 972 | clear_bit(chan->channel, &lradc->is_divided); |
967 | ret = 0; | 973 | ret = 0; |
968 | } else if (val == scale_avail[MXS_LRADC_DIV_ENABLED].integer && | 974 | } else if (val == scale_avail[MXS_LRADC_DIV_ENABLED].integer && |
969 | val2 == scale_avail[MXS_LRADC_DIV_ENABLED].nano) { | 975 | val2 == scale_avail[MXS_LRADC_DIV_ENABLED].nano) { |
970 | /* divider by two enabled */ | 976 | /* divider by two enabled */ |
971 | writel(1 << LRADC_CTRL2_DIVIDE_BY_TWO_OFFSET, | ||
972 | lradc->base + LRADC_CTRL2 + STMP_OFFSET_REG_SET); | ||
973 | set_bit(chan->channel, &lradc->is_divided); | 977 | set_bit(chan->channel, &lradc->is_divided); |
974 | ret = 0; | 978 | ret = 0; |
975 | } | 979 | } |
diff --git a/drivers/staging/iio/light/tsl2x7x_core.c b/drivers/staging/iio/light/tsl2x7x_core.c index 9e0f2a9c73ae..ab338e3ddd05 100644 --- a/drivers/staging/iio/light/tsl2x7x_core.c +++ b/drivers/staging/iio/light/tsl2x7x_core.c | |||
@@ -667,9 +667,13 @@ static int tsl2x7x_chip_on(struct iio_dev *indio_dev) | |||
667 | chip->tsl2x7x_config[TSL2X7X_PRX_COUNT] = | 667 | chip->tsl2x7x_config[TSL2X7X_PRX_COUNT] = |
668 | chip->tsl2x7x_settings.prox_pulse_count; | 668 | chip->tsl2x7x_settings.prox_pulse_count; |
669 | chip->tsl2x7x_config[TSL2X7X_PRX_MINTHRESHLO] = | 669 | chip->tsl2x7x_config[TSL2X7X_PRX_MINTHRESHLO] = |
670 | chip->tsl2x7x_settings.prox_thres_low; | 670 | (chip->tsl2x7x_settings.prox_thres_low) & 0xFF; |
671 | chip->tsl2x7x_config[TSL2X7X_PRX_MINTHRESHHI] = | ||
672 | (chip->tsl2x7x_settings.prox_thres_low >> 8) & 0xFF; | ||
671 | chip->tsl2x7x_config[TSL2X7X_PRX_MAXTHRESHLO] = | 673 | chip->tsl2x7x_config[TSL2X7X_PRX_MAXTHRESHLO] = |
672 | chip->tsl2x7x_settings.prox_thres_high; | 674 | (chip->tsl2x7x_settings.prox_thres_high) & 0xFF; |
675 | chip->tsl2x7x_config[TSL2X7X_PRX_MAXTHRESHHI] = | ||
676 | (chip->tsl2x7x_settings.prox_thres_high >> 8) & 0xFF; | ||
673 | 677 | ||
674 | /* and make sure we're not already on */ | 678 | /* and make sure we're not already on */ |
675 | if (chip->tsl2x7x_chip_status == TSL2X7X_CHIP_WORKING) { | 679 | if (chip->tsl2x7x_chip_status == TSL2X7X_CHIP_WORKING) { |
diff --git a/drivers/staging/imx-drm/parallel-display.c b/drivers/staging/imx-drm/parallel-display.c index b5678328fc40..4ca61afdf622 100644 --- a/drivers/staging/imx-drm/parallel-display.c +++ b/drivers/staging/imx-drm/parallel-display.c | |||
@@ -173,6 +173,13 @@ static int imx_pd_register(struct drm_device *drm, | |||
173 | if (ret) | 173 | if (ret) |
174 | return ret; | 174 | return ret; |
175 | 175 | ||
176 | /* set the connector's dpms to OFF so that | ||
177 | * drm_helper_connector_dpms() won't return | ||
178 | * immediately since the current state is ON | ||
179 | * at this point. | ||
180 | */ | ||
181 | imxpd->connector.dpms = DRM_MODE_DPMS_OFF; | ||
182 | |||
176 | drm_encoder_helper_add(&imxpd->encoder, &imx_pd_encoder_helper_funcs); | 183 | drm_encoder_helper_add(&imxpd->encoder, &imx_pd_encoder_helper_funcs); |
177 | drm_encoder_init(drm, &imxpd->encoder, &imx_pd_encoder_funcs, | 184 | drm_encoder_init(drm, &imxpd->encoder, &imx_pd_encoder_funcs, |
178 | DRM_MODE_ENCODER_NONE); | 185 | DRM_MODE_ENCODER_NONE); |
diff --git a/drivers/staging/rtl8723au/hal/rtl8723a_hal_init.c b/drivers/staging/rtl8723au/hal/rtl8723a_hal_init.c index 0acacab95a48..46f5abcbaeeb 100644 --- a/drivers/staging/rtl8723au/hal/rtl8723a_hal_init.c +++ b/drivers/staging/rtl8723au/hal/rtl8723a_hal_init.c | |||
@@ -298,7 +298,7 @@ int rtl8723a_FirmwareDownload(struct rtw_adapter *padapter) | |||
298 | RT_TRACE(_module_hal_init_c_, _drv_info_, ("+%s\n", __func__)); | 298 | RT_TRACE(_module_hal_init_c_, _drv_info_, ("+%s\n", __func__)); |
299 | 299 | ||
300 | if (IS_8723A_A_CUT(pHalData->VersionID)) { | 300 | if (IS_8723A_A_CUT(pHalData->VersionID)) { |
301 | fw_name = "rtlwifi/rtl8723aufw.bin"; | 301 | fw_name = "rtlwifi/rtl8723aufw_A.bin"; |
302 | RT_TRACE(_module_hal_init_c_, _drv_info_, | 302 | RT_TRACE(_module_hal_init_c_, _drv_info_, |
303 | ("rtl8723a_FirmwareDownload: R8723FwImageArray_UMC " | 303 | ("rtl8723a_FirmwareDownload: R8723FwImageArray_UMC " |
304 | "for RTL8723A A CUT\n")); | 304 | "for RTL8723A A CUT\n")); |
diff --git a/drivers/staging/rtl8723au/os_dep/os_intfs.c b/drivers/staging/rtl8723au/os_dep/os_intfs.c index 4e32003a4437..1fb34386a4e5 100644 --- a/drivers/staging/rtl8723au/os_dep/os_intfs.c +++ b/drivers/staging/rtl8723au/os_dep/os_intfs.c | |||
@@ -29,7 +29,9 @@ MODULE_AUTHOR("Realtek Semiconductor Corp."); | |||
29 | MODULE_AUTHOR("Larry Finger <Larry.Finger@lwfinger.net>"); | 29 | MODULE_AUTHOR("Larry Finger <Larry.Finger@lwfinger.net>"); |
30 | MODULE_AUTHOR("Jes Sorensen <Jes.Sorensen@redhat.com>"); | 30 | MODULE_AUTHOR("Jes Sorensen <Jes.Sorensen@redhat.com>"); |
31 | MODULE_VERSION(DRIVERVERSION); | 31 | MODULE_VERSION(DRIVERVERSION); |
32 | MODULE_FIRMWARE("rtlwifi/rtl8821aefw.bin"); | 32 | MODULE_FIRMWARE("rtlwifi/rtl8723aufw_A.bin"); |
33 | MODULE_FIRMWARE("rtlwifi/rtl8723aufw_B.bin"); | ||
34 | MODULE_FIRMWARE("rtlwifi/rtl8723aufw_B_NoBT.bin"); | ||
33 | 35 | ||
34 | /* module param defaults */ | 36 | /* module param defaults */ |
35 | static int rtw_chip_version = 0x00; | 37 | static int rtw_chip_version = 0x00; |
diff --git a/drivers/staging/tidspbridge/core/tiomap3430.c b/drivers/staging/tidspbridge/core/tiomap3430.c index 8945b4e3a2a6..cb50120ed7b5 100644 --- a/drivers/staging/tidspbridge/core/tiomap3430.c +++ b/drivers/staging/tidspbridge/core/tiomap3430.c | |||
@@ -280,8 +280,10 @@ static int bridge_brd_monitor(struct bridge_dev_context *dev_ctxt) | |||
280 | OMAP3430_IVA2_MOD, OMAP2_CM_CLKSTCTRL); | 280 | OMAP3430_IVA2_MOD, OMAP2_CM_CLKSTCTRL); |
281 | 281 | ||
282 | /* Wait until the state has moved to ON */ | 282 | /* Wait until the state has moved to ON */ |
283 | while (*pdata->dsp_prm_read(OMAP3430_IVA2_MOD, OMAP2_PM_PWSTST)& | 283 | while ((*pdata->dsp_prm_read)(OMAP3430_IVA2_MOD, |
284 | OMAP_INTRANSITION_MASK); | 284 | OMAP2_PM_PWSTST) & |
285 | OMAP_INTRANSITION_MASK) | ||
286 | ; | ||
285 | /* Disable Automatic transition */ | 287 | /* Disable Automatic transition */ |
286 | (*pdata->dsp_cm_write)(OMAP34XX_CLKSTCTRL_DISABLE_AUTO, | 288 | (*pdata->dsp_cm_write)(OMAP34XX_CLKSTCTRL_DISABLE_AUTO, |
287 | OMAP3430_IVA2_MOD, OMAP2_CM_CLKSTCTRL); | 289 | OMAP3430_IVA2_MOD, OMAP2_CM_CLKSTCTRL); |
diff --git a/drivers/target/iscsi/iscsi_target.c b/drivers/target/iscsi/iscsi_target.c index 5663f4d19d02..1f4c794f5fcc 100644 --- a/drivers/target/iscsi/iscsi_target.c +++ b/drivers/target/iscsi/iscsi_target.c | |||
@@ -1309,7 +1309,7 @@ iscsit_check_dataout_hdr(struct iscsi_conn *conn, unsigned char *buf, | |||
1309 | if (cmd->data_direction != DMA_TO_DEVICE) { | 1309 | if (cmd->data_direction != DMA_TO_DEVICE) { |
1310 | pr_err("Command ITT: 0x%08x received DataOUT for a" | 1310 | pr_err("Command ITT: 0x%08x received DataOUT for a" |
1311 | " NON-WRITE command.\n", cmd->init_task_tag); | 1311 | " NON-WRITE command.\n", cmd->init_task_tag); |
1312 | return iscsit_reject_cmd(cmd, ISCSI_REASON_PROTOCOL_ERROR, buf); | 1312 | return iscsit_dump_data_payload(conn, payload_length, 1); |
1313 | } | 1313 | } |
1314 | se_cmd = &cmd->se_cmd; | 1314 | se_cmd = &cmd->se_cmd; |
1315 | iscsit_mod_dataout_timer(cmd); | 1315 | iscsit_mod_dataout_timer(cmd); |
diff --git a/drivers/target/iscsi/iscsi_target_auth.c b/drivers/target/iscsi/iscsi_target_auth.c index 19b842c3e0b3..ab4915c0d933 100644 --- a/drivers/target/iscsi/iscsi_target_auth.c +++ b/drivers/target/iscsi/iscsi_target_auth.c | |||
@@ -174,7 +174,6 @@ static int chap_server_compute_md5( | |||
174 | char *nr_out_ptr, | 174 | char *nr_out_ptr, |
175 | unsigned int *nr_out_len) | 175 | unsigned int *nr_out_len) |
176 | { | 176 | { |
177 | char *endptr; | ||
178 | unsigned long id; | 177 | unsigned long id; |
179 | unsigned char id_as_uchar; | 178 | unsigned char id_as_uchar; |
180 | unsigned char digest[MD5_SIGNATURE_SIZE]; | 179 | unsigned char digest[MD5_SIGNATURE_SIZE]; |
@@ -320,9 +319,14 @@ static int chap_server_compute_md5( | |||
320 | } | 319 | } |
321 | 320 | ||
322 | if (type == HEX) | 321 | if (type == HEX) |
323 | id = simple_strtoul(&identifier[2], &endptr, 0); | 322 | ret = kstrtoul(&identifier[2], 0, &id); |
324 | else | 323 | else |
325 | id = simple_strtoul(identifier, &endptr, 0); | 324 | ret = kstrtoul(identifier, 0, &id); |
325 | |||
326 | if (ret < 0) { | ||
327 | pr_err("kstrtoul() failed for CHAP identifier: %d\n", ret); | ||
328 | goto out; | ||
329 | } | ||
326 | if (id > 255) { | 330 | if (id > 255) { |
327 | pr_err("chap identifier: %lu greater than 255\n", id); | 331 | pr_err("chap identifier: %lu greater than 255\n", id); |
328 | goto out; | 332 | goto out; |
@@ -351,6 +355,10 @@ static int chap_server_compute_md5( | |||
351 | pr_err("Unable to convert incoming challenge\n"); | 355 | pr_err("Unable to convert incoming challenge\n"); |
352 | goto out; | 356 | goto out; |
353 | } | 357 | } |
358 | if (challenge_len > 1024) { | ||
359 | pr_err("CHAP_C exceeds maximum binary size of 1024 bytes\n"); | ||
360 | goto out; | ||
361 | } | ||
354 | /* | 362 | /* |
355 | * During mutual authentication, the CHAP_C generated by the | 363 | * During mutual authentication, the CHAP_C generated by the |
356 | * initiator must not match the original CHAP_C generated by | 364 | * initiator must not match the original CHAP_C generated by |
diff --git a/drivers/target/iscsi/iscsi_target_login.c b/drivers/target/iscsi/iscsi_target_login.c index fecb69535a15..5e71ac609418 100644 --- a/drivers/target/iscsi/iscsi_target_login.c +++ b/drivers/target/iscsi/iscsi_target_login.c | |||
@@ -1216,7 +1216,7 @@ old_sess_out: | |||
1216 | static int __iscsi_target_login_thread(struct iscsi_np *np) | 1216 | static int __iscsi_target_login_thread(struct iscsi_np *np) |
1217 | { | 1217 | { |
1218 | u8 *buffer, zero_tsih = 0; | 1218 | u8 *buffer, zero_tsih = 0; |
1219 | int ret = 0, rc, stop; | 1219 | int ret = 0, rc; |
1220 | struct iscsi_conn *conn = NULL; | 1220 | struct iscsi_conn *conn = NULL; |
1221 | struct iscsi_login *login; | 1221 | struct iscsi_login *login; |
1222 | struct iscsi_portal_group *tpg = NULL; | 1222 | struct iscsi_portal_group *tpg = NULL; |
@@ -1230,6 +1230,9 @@ static int __iscsi_target_login_thread(struct iscsi_np *np) | |||
1230 | if (np->np_thread_state == ISCSI_NP_THREAD_RESET) { | 1230 | if (np->np_thread_state == ISCSI_NP_THREAD_RESET) { |
1231 | np->np_thread_state = ISCSI_NP_THREAD_ACTIVE; | 1231 | np->np_thread_state = ISCSI_NP_THREAD_ACTIVE; |
1232 | complete(&np->np_restart_comp); | 1232 | complete(&np->np_restart_comp); |
1233 | } else if (np->np_thread_state == ISCSI_NP_THREAD_SHUTDOWN) { | ||
1234 | spin_unlock_bh(&np->np_thread_lock); | ||
1235 | goto exit; | ||
1233 | } else { | 1236 | } else { |
1234 | np->np_thread_state = ISCSI_NP_THREAD_ACTIVE; | 1237 | np->np_thread_state = ISCSI_NP_THREAD_ACTIVE; |
1235 | } | 1238 | } |
@@ -1422,10 +1425,8 @@ old_sess_out: | |||
1422 | } | 1425 | } |
1423 | 1426 | ||
1424 | out: | 1427 | out: |
1425 | stop = kthread_should_stop(); | 1428 | return 1; |
1426 | /* Wait for another socket.. */ | 1429 | |
1427 | if (!stop) | ||
1428 | return 1; | ||
1429 | exit: | 1430 | exit: |
1430 | iscsi_stop_login_thread_timer(np); | 1431 | iscsi_stop_login_thread_timer(np); |
1431 | spin_lock_bh(&np->np_thread_lock); | 1432 | spin_lock_bh(&np->np_thread_lock); |
@@ -1442,7 +1443,7 @@ int iscsi_target_login_thread(void *arg) | |||
1442 | 1443 | ||
1443 | allow_signal(SIGINT); | 1444 | allow_signal(SIGINT); |
1444 | 1445 | ||
1445 | while (!kthread_should_stop()) { | 1446 | while (1) { |
1446 | ret = __iscsi_target_login_thread(np); | 1447 | ret = __iscsi_target_login_thread(np); |
1447 | /* | 1448 | /* |
1448 | * We break and exit here unless another sock_accept() call | 1449 | * We break and exit here unless another sock_accept() call |
diff --git a/drivers/target/iscsi/iscsi_target_util.c b/drivers/target/iscsi/iscsi_target_util.c index 53e157cb8c54..fd90b28f1d94 100644 --- a/drivers/target/iscsi/iscsi_target_util.c +++ b/drivers/target/iscsi/iscsi_target_util.c | |||
@@ -1295,6 +1295,8 @@ int iscsit_tx_login_rsp(struct iscsi_conn *conn, u8 status_class, u8 status_deta | |||
1295 | login->login_failed = 1; | 1295 | login->login_failed = 1; |
1296 | iscsit_collect_login_stats(conn, status_class, status_detail); | 1296 | iscsit_collect_login_stats(conn, status_class, status_detail); |
1297 | 1297 | ||
1298 | memset(&login->rsp[0], 0, ISCSI_HDR_LEN); | ||
1299 | |||
1298 | hdr = (struct iscsi_login_rsp *)&login->rsp[0]; | 1300 | hdr = (struct iscsi_login_rsp *)&login->rsp[0]; |
1299 | hdr->opcode = ISCSI_OP_LOGIN_RSP; | 1301 | hdr->opcode = ISCSI_OP_LOGIN_RSP; |
1300 | hdr->status_class = status_class; | 1302 | hdr->status_class = status_class; |
diff --git a/drivers/target/loopback/tcm_loop.c b/drivers/target/loopback/tcm_loop.c index 6d2f37578b29..8c64b8776a96 100644 --- a/drivers/target/loopback/tcm_loop.c +++ b/drivers/target/loopback/tcm_loop.c | |||
@@ -239,6 +239,7 @@ static void tcm_loop_submission_work(struct work_struct *work) | |||
239 | return; | 239 | return; |
240 | 240 | ||
241 | out_done: | 241 | out_done: |
242 | kmem_cache_free(tcm_loop_cmd_cache, tl_cmd); | ||
242 | sc->scsi_done(sc); | 243 | sc->scsi_done(sc); |
243 | return; | 244 | return; |
244 | } | 245 | } |
diff --git a/drivers/target/target_core_device.c b/drivers/target/target_core_device.c index 11d26fe65bfb..98da90167159 100644 --- a/drivers/target/target_core_device.c +++ b/drivers/target/target_core_device.c | |||
@@ -616,6 +616,7 @@ void core_dev_unexport( | |||
616 | dev->export_count--; | 616 | dev->export_count--; |
617 | spin_unlock(&hba->device_lock); | 617 | spin_unlock(&hba->device_lock); |
618 | 618 | ||
619 | lun->lun_sep = NULL; | ||
619 | lun->lun_se_dev = NULL; | 620 | lun->lun_se_dev = NULL; |
620 | } | 621 | } |
621 | 622 | ||
diff --git a/drivers/tc/tc.c b/drivers/tc/tc.c index a8aaf6ac2ae2..946562389ca8 100644 --- a/drivers/tc/tc.c +++ b/drivers/tc/tc.c | |||
@@ -129,7 +129,10 @@ static void __init tc_bus_add_devices(struct tc_bus *tbus) | |||
129 | 129 | ||
130 | tc_device_get_irq(tdev); | 130 | tc_device_get_irq(tdev); |
131 | 131 | ||
132 | device_register(&tdev->dev); | 132 | if (device_register(&tdev->dev)) { |
133 | put_device(&tdev->dev); | ||
134 | goto out_err; | ||
135 | } | ||
133 | list_add_tail(&tdev->node, &tbus->devices); | 136 | list_add_tail(&tdev->node, &tbus->devices); |
134 | 137 | ||
135 | out_err: | 138 | out_err: |
@@ -148,7 +151,10 @@ static int __init tc_init(void) | |||
148 | 151 | ||
149 | INIT_LIST_HEAD(&tc_bus.devices); | 152 | INIT_LIST_HEAD(&tc_bus.devices); |
150 | dev_set_name(&tc_bus.dev, "tc"); | 153 | dev_set_name(&tc_bus.dev, "tc"); |
151 | device_register(&tc_bus.dev); | 154 | if (device_register(&tc_bus.dev)) { |
155 | put_device(&tc_bus.dev); | ||
156 | return 0; | ||
157 | } | ||
152 | 158 | ||
153 | if (tc_bus.info.slot_size) { | 159 | if (tc_bus.info.slot_size) { |
154 | unsigned int tc_clock = tc_get_speed(&tc_bus) / 100000; | 160 | unsigned int tc_clock = tc_get_speed(&tc_bus) / 100000; |
diff --git a/drivers/thermal/imx_thermal.c b/drivers/thermal/imx_thermal.c index a99c63152b8d..2c516f2eebed 100644 --- a/drivers/thermal/imx_thermal.c +++ b/drivers/thermal/imx_thermal.c | |||
@@ -306,7 +306,7 @@ static int imx_get_sensor_data(struct platform_device *pdev) | |||
306 | { | 306 | { |
307 | struct imx_thermal_data *data = platform_get_drvdata(pdev); | 307 | struct imx_thermal_data *data = platform_get_drvdata(pdev); |
308 | struct regmap *map; | 308 | struct regmap *map; |
309 | int t1, t2, n1, n2; | 309 | int t1, n1; |
310 | int ret; | 310 | int ret; |
311 | u32 val; | 311 | u32 val; |
312 | u64 temp64; | 312 | u64 temp64; |
@@ -333,14 +333,10 @@ static int imx_get_sensor_data(struct platform_device *pdev) | |||
333 | /* | 333 | /* |
334 | * Sensor data layout: | 334 | * Sensor data layout: |
335 | * [31:20] - sensor value @ 25C | 335 | * [31:20] - sensor value @ 25C |
336 | * [19:8] - sensor value of hot | ||
337 | * [7:0] - hot temperature value | ||
338 | * Use universal formula now and only need sensor value @ 25C | 336 | * Use universal formula now and only need sensor value @ 25C |
339 | * slope = 0.4297157 - (0.0015976 * 25C fuse) | 337 | * slope = 0.4297157 - (0.0015976 * 25C fuse) |
340 | */ | 338 | */ |
341 | n1 = val >> 20; | 339 | n1 = val >> 20; |
342 | n2 = (val & 0xfff00) >> 8; | ||
343 | t2 = val & 0xff; | ||
344 | t1 = 25; /* t1 always 25C */ | 340 | t1 = 25; /* t1 always 25C */ |
345 | 341 | ||
346 | /* | 342 | /* |
@@ -366,16 +362,16 @@ static int imx_get_sensor_data(struct platform_device *pdev) | |||
366 | data->c2 = n1 * data->c1 + 1000 * t1; | 362 | data->c2 = n1 * data->c1 + 1000 * t1; |
367 | 363 | ||
368 | /* | 364 | /* |
369 | * Set the default passive cooling trip point to 20 °C below the | 365 | * Set the default passive cooling trip point, |
370 | * maximum die temperature. Can be changed from userspace. | 366 | * can be changed from userspace. |
371 | */ | 367 | */ |
372 | data->temp_passive = 1000 * (t2 - 20); | 368 | data->temp_passive = IMX_TEMP_PASSIVE; |
373 | 369 | ||
374 | /* | 370 | /* |
375 | * The maximum die temperature is t2, let's give 5 °C cushion | 371 | * The maximum die temperature set to 20 C higher than |
376 | * for noise and possible temperature rise between measurements. | 372 | * IMX_TEMP_PASSIVE. |
377 | */ | 373 | */ |
378 | data->temp_critical = 1000 * (t2 - 5); | 374 | data->temp_critical = 1000 * 20 + data->temp_passive; |
379 | 375 | ||
380 | return 0; | 376 | return 0; |
381 | } | 377 | } |
diff --git a/drivers/thermal/of-thermal.c b/drivers/thermal/of-thermal.c index 04b1be7fa018..4b2b999b7611 100644 --- a/drivers/thermal/of-thermal.c +++ b/drivers/thermal/of-thermal.c | |||
@@ -156,8 +156,8 @@ static int of_thermal_bind(struct thermal_zone_device *thermal, | |||
156 | 156 | ||
157 | ret = thermal_zone_bind_cooling_device(thermal, | 157 | ret = thermal_zone_bind_cooling_device(thermal, |
158 | tbp->trip_id, cdev, | 158 | tbp->trip_id, cdev, |
159 | tbp->min, | 159 | tbp->max, |
160 | tbp->max); | 160 | tbp->min); |
161 | if (ret) | 161 | if (ret) |
162 | return ret; | 162 | return ret; |
163 | } | 163 | } |
@@ -712,11 +712,12 @@ thermal_of_build_thermal_zone(struct device_node *np) | |||
712 | } | 712 | } |
713 | 713 | ||
714 | i = 0; | 714 | i = 0; |
715 | for_each_child_of_node(child, gchild) | 715 | for_each_child_of_node(child, gchild) { |
716 | ret = thermal_of_populate_bind_params(gchild, &tz->tbps[i++], | 716 | ret = thermal_of_populate_bind_params(gchild, &tz->tbps[i++], |
717 | tz->trips, tz->ntrips); | 717 | tz->trips, tz->ntrips); |
718 | if (ret) | 718 | if (ret) |
719 | goto free_tbps; | 719 | goto free_tbps; |
720 | } | ||
720 | 721 | ||
721 | finish: | 722 | finish: |
722 | of_node_put(child); | 723 | of_node_put(child); |
diff --git a/drivers/thermal/thermal_hwmon.c b/drivers/thermal/thermal_hwmon.c index fdb07199d9c2..1967bee4f076 100644 --- a/drivers/thermal/thermal_hwmon.c +++ b/drivers/thermal/thermal_hwmon.c | |||
@@ -140,6 +140,12 @@ thermal_hwmon_lookup_temp(const struct thermal_hwmon_device *hwmon, | |||
140 | return NULL; | 140 | return NULL; |
141 | } | 141 | } |
142 | 142 | ||
143 | static bool thermal_zone_crit_temp_valid(struct thermal_zone_device *tz) | ||
144 | { | ||
145 | unsigned long temp; | ||
146 | return tz->ops->get_crit_temp && !tz->ops->get_crit_temp(tz, &temp); | ||
147 | } | ||
148 | |||
143 | int thermal_add_hwmon_sysfs(struct thermal_zone_device *tz) | 149 | int thermal_add_hwmon_sysfs(struct thermal_zone_device *tz) |
144 | { | 150 | { |
145 | struct thermal_hwmon_device *hwmon; | 151 | struct thermal_hwmon_device *hwmon; |
@@ -189,21 +195,18 @@ int thermal_add_hwmon_sysfs(struct thermal_zone_device *tz) | |||
189 | if (result) | 195 | if (result) |
190 | goto free_temp_mem; | 196 | goto free_temp_mem; |
191 | 197 | ||
192 | if (tz->ops->get_crit_temp) { | 198 | if (thermal_zone_crit_temp_valid(tz)) { |
193 | unsigned long temperature; | 199 | snprintf(temp->temp_crit.name, |
194 | if (!tz->ops->get_crit_temp(tz, &temperature)) { | 200 | sizeof(temp->temp_crit.name), |
195 | snprintf(temp->temp_crit.name, | ||
196 | sizeof(temp->temp_crit.name), | ||
197 | "temp%d_crit", hwmon->count); | 201 | "temp%d_crit", hwmon->count); |
198 | temp->temp_crit.attr.attr.name = temp->temp_crit.name; | 202 | temp->temp_crit.attr.attr.name = temp->temp_crit.name; |
199 | temp->temp_crit.attr.attr.mode = 0444; | 203 | temp->temp_crit.attr.attr.mode = 0444; |
200 | temp->temp_crit.attr.show = temp_crit_show; | 204 | temp->temp_crit.attr.show = temp_crit_show; |
201 | sysfs_attr_init(&temp->temp_crit.attr.attr); | 205 | sysfs_attr_init(&temp->temp_crit.attr.attr); |
202 | result = device_create_file(hwmon->device, | 206 | result = device_create_file(hwmon->device, |
203 | &temp->temp_crit.attr); | 207 | &temp->temp_crit.attr); |
204 | if (result) | 208 | if (result) |
205 | goto unregister_input; | 209 | goto unregister_input; |
206 | } | ||
207 | } | 210 | } |
208 | 211 | ||
209 | mutex_lock(&thermal_hwmon_list_lock); | 212 | mutex_lock(&thermal_hwmon_list_lock); |
@@ -250,7 +253,7 @@ void thermal_remove_hwmon_sysfs(struct thermal_zone_device *tz) | |||
250 | } | 253 | } |
251 | 254 | ||
252 | device_remove_file(hwmon->device, &temp->temp_input.attr); | 255 | device_remove_file(hwmon->device, &temp->temp_input.attr); |
253 | if (tz->ops->get_crit_temp) | 256 | if (thermal_zone_crit_temp_valid(tz)) |
254 | device_remove_file(hwmon->device, &temp->temp_crit.attr); | 257 | device_remove_file(hwmon->device, &temp->temp_crit.attr); |
255 | 258 | ||
256 | mutex_lock(&thermal_hwmon_list_lock); | 259 | mutex_lock(&thermal_hwmon_list_lock); |
diff --git a/drivers/thermal/ti-soc-thermal/ti-bandgap.c b/drivers/thermal/ti-soc-thermal/ti-bandgap.c index a1271b55103a..634b6ce0e63a 100644 --- a/drivers/thermal/ti-soc-thermal/ti-bandgap.c +++ b/drivers/thermal/ti-soc-thermal/ti-bandgap.c | |||
@@ -1155,7 +1155,7 @@ static struct ti_bandgap *ti_bandgap_build(struct platform_device *pdev) | |||
1155 | /* register shadow for context save and restore */ | 1155 | /* register shadow for context save and restore */ |
1156 | bgp->regval = devm_kzalloc(&pdev->dev, sizeof(*bgp->regval) * | 1156 | bgp->regval = devm_kzalloc(&pdev->dev, sizeof(*bgp->regval) * |
1157 | bgp->conf->sensor_count, GFP_KERNEL); | 1157 | bgp->conf->sensor_count, GFP_KERNEL); |
1158 | if (!bgp) { | 1158 | if (!bgp->regval) { |
1159 | dev_err(&pdev->dev, "Unable to allocate mem for driver ref\n"); | 1159 | dev_err(&pdev->dev, "Unable to allocate mem for driver ref\n"); |
1160 | return ERR_PTR(-ENOMEM); | 1160 | return ERR_PTR(-ENOMEM); |
1161 | } | 1161 | } |
diff --git a/drivers/tty/n_tty.c b/drivers/tty/n_tty.c index f95569dedc88..f44f1ba762c3 100644 --- a/drivers/tty/n_tty.c +++ b/drivers/tty/n_tty.c | |||
@@ -1214,15 +1214,16 @@ static void n_tty_receive_parity_error(struct tty_struct *tty, unsigned char c) | |||
1214 | { | 1214 | { |
1215 | struct n_tty_data *ldata = tty->disc_data; | 1215 | struct n_tty_data *ldata = tty->disc_data; |
1216 | 1216 | ||
1217 | if (I_IGNPAR(tty)) | 1217 | if (I_INPCK(tty)) { |
1218 | return; | 1218 | if (I_IGNPAR(tty)) |
1219 | if (I_PARMRK(tty)) { | 1219 | return; |
1220 | put_tty_queue('\377', ldata); | 1220 | if (I_PARMRK(tty)) { |
1221 | put_tty_queue('\0', ldata); | 1221 | put_tty_queue('\377', ldata); |
1222 | put_tty_queue(c, ldata); | 1222 | put_tty_queue('\0', ldata); |
1223 | } else if (I_INPCK(tty)) | 1223 | put_tty_queue(c, ldata); |
1224 | put_tty_queue('\0', ldata); | 1224 | } else |
1225 | else | 1225 | put_tty_queue('\0', ldata); |
1226 | } else | ||
1226 | put_tty_queue(c, ldata); | 1227 | put_tty_queue(c, ldata); |
1227 | if (waitqueue_active(&tty->read_wait)) | 1228 | if (waitqueue_active(&tty->read_wait)) |
1228 | wake_up_interruptible(&tty->read_wait); | 1229 | wake_up_interruptible(&tty->read_wait); |
diff --git a/drivers/tty/serial/8250/8250_core.c b/drivers/tty/serial/8250/8250_core.c index 27f7ad6b74c1..7a91c6d1eb7d 100644 --- a/drivers/tty/serial/8250/8250_core.c +++ b/drivers/tty/serial/8250/8250_core.c | |||
@@ -2357,7 +2357,7 @@ serial8250_do_set_termios(struct uart_port *port, struct ktermios *termios, | |||
2357 | port->read_status_mask = UART_LSR_OE | UART_LSR_THRE | UART_LSR_DR; | 2357 | port->read_status_mask = UART_LSR_OE | UART_LSR_THRE | UART_LSR_DR; |
2358 | if (termios->c_iflag & INPCK) | 2358 | if (termios->c_iflag & INPCK) |
2359 | port->read_status_mask |= UART_LSR_FE | UART_LSR_PE; | 2359 | port->read_status_mask |= UART_LSR_FE | UART_LSR_PE; |
2360 | if (termios->c_iflag & (BRKINT | PARMRK)) | 2360 | if (termios->c_iflag & (IGNBRK | BRKINT | PARMRK)) |
2361 | port->read_status_mask |= UART_LSR_BI; | 2361 | port->read_status_mask |= UART_LSR_BI; |
2362 | 2362 | ||
2363 | /* | 2363 | /* |
diff --git a/drivers/tty/serial/8250/8250_early.c b/drivers/tty/serial/8250/8250_early.c index cfef801a49d4..4858b8a99d3b 100644 --- a/drivers/tty/serial/8250/8250_early.c +++ b/drivers/tty/serial/8250/8250_early.c | |||
@@ -144,8 +144,11 @@ static int __init early_serial8250_setup(struct earlycon_device *device, | |||
144 | if (!(device->port.membase || device->port.iobase)) | 144 | if (!(device->port.membase || device->port.iobase)) |
145 | return 0; | 145 | return 0; |
146 | 146 | ||
147 | if (!device->baud) | 147 | if (!device->baud) { |
148 | device->baud = probe_baud(&device->port); | 148 | device->baud = probe_baud(&device->port); |
149 | snprintf(device->options, sizeof(device->options), "%u", | ||
150 | device->baud); | ||
151 | } | ||
149 | 152 | ||
150 | init_port(device); | 153 | init_port(device); |
151 | 154 | ||
diff --git a/drivers/tty/serial/altera_uart.c b/drivers/tty/serial/altera_uart.c index 501667e3e3f5..323376668b72 100644 --- a/drivers/tty/serial/altera_uart.c +++ b/drivers/tty/serial/altera_uart.c | |||
@@ -185,6 +185,12 @@ static void altera_uart_set_termios(struct uart_port *port, | |||
185 | uart_update_timeout(port, termios->c_cflag, baud); | 185 | uart_update_timeout(port, termios->c_cflag, baud); |
186 | altera_uart_writel(port, baudclk, ALTERA_UART_DIVISOR_REG); | 186 | altera_uart_writel(port, baudclk, ALTERA_UART_DIVISOR_REG); |
187 | spin_unlock_irqrestore(&port->lock, flags); | 187 | spin_unlock_irqrestore(&port->lock, flags); |
188 | |||
189 | /* | ||
190 | * FIXME: port->read_status_mask and port->ignore_status_mask | ||
191 | * need to be initialized based on termios settings for | ||
192 | * INPCK, IGNBRK, IGNPAR, PARMRK, BRKINT | ||
193 | */ | ||
188 | } | 194 | } |
189 | 195 | ||
190 | static void altera_uart_rx_chars(struct altera_uart *pp) | 196 | static void altera_uart_rx_chars(struct altera_uart *pp) |
diff --git a/drivers/tty/serial/amba-pl010.c b/drivers/tty/serial/amba-pl010.c index 01c9e72433e1..971af1e22d0f 100644 --- a/drivers/tty/serial/amba-pl010.c +++ b/drivers/tty/serial/amba-pl010.c | |||
@@ -420,7 +420,7 @@ pl010_set_termios(struct uart_port *port, struct ktermios *termios, | |||
420 | uap->port.read_status_mask = UART01x_RSR_OE; | 420 | uap->port.read_status_mask = UART01x_RSR_OE; |
421 | if (termios->c_iflag & INPCK) | 421 | if (termios->c_iflag & INPCK) |
422 | uap->port.read_status_mask |= UART01x_RSR_FE | UART01x_RSR_PE; | 422 | uap->port.read_status_mask |= UART01x_RSR_FE | UART01x_RSR_PE; |
423 | if (termios->c_iflag & (BRKINT | PARMRK)) | 423 | if (termios->c_iflag & (IGNBRK | BRKINT | PARMRK)) |
424 | uap->port.read_status_mask |= UART01x_RSR_BE; | 424 | uap->port.read_status_mask |= UART01x_RSR_BE; |
425 | 425 | ||
426 | /* | 426 | /* |
diff --git a/drivers/tty/serial/amba-pl011.c b/drivers/tty/serial/amba-pl011.c index 908a6e3142a2..0e26dcbd5ea4 100644 --- a/drivers/tty/serial/amba-pl011.c +++ b/drivers/tty/serial/amba-pl011.c | |||
@@ -1744,7 +1744,7 @@ pl011_set_termios(struct uart_port *port, struct ktermios *termios, | |||
1744 | port->read_status_mask = UART011_DR_OE | 255; | 1744 | port->read_status_mask = UART011_DR_OE | 255; |
1745 | if (termios->c_iflag & INPCK) | 1745 | if (termios->c_iflag & INPCK) |
1746 | port->read_status_mask |= UART011_DR_FE | UART011_DR_PE; | 1746 | port->read_status_mask |= UART011_DR_FE | UART011_DR_PE; |
1747 | if (termios->c_iflag & (BRKINT | PARMRK)) | 1747 | if (termios->c_iflag & (IGNBRK | BRKINT | PARMRK)) |
1748 | port->read_status_mask |= UART011_DR_BE; | 1748 | port->read_status_mask |= UART011_DR_BE; |
1749 | 1749 | ||
1750 | /* | 1750 | /* |
diff --git a/drivers/tty/serial/arc_uart.c b/drivers/tty/serial/arc_uart.c index c9f5c9dcc15c..008c223eaf26 100644 --- a/drivers/tty/serial/arc_uart.c +++ b/drivers/tty/serial/arc_uart.c | |||
@@ -177,7 +177,7 @@ static void arc_serial_tx_chars(struct arc_uart_port *uart) | |||
177 | uart->port.icount.tx++; | 177 | uart->port.icount.tx++; |
178 | uart->port.x_char = 0; | 178 | uart->port.x_char = 0; |
179 | sent = 1; | 179 | sent = 1; |
180 | } else if (xmit->tail != xmit->head) { /* TODO: uart_circ_empty */ | 180 | } else if (!uart_circ_empty(xmit)) { |
181 | ch = xmit->buf[xmit->tail]; | 181 | ch = xmit->buf[xmit->tail]; |
182 | xmit->tail = (xmit->tail + 1) & (UART_XMIT_SIZE - 1); | 182 | xmit->tail = (xmit->tail + 1) & (UART_XMIT_SIZE - 1); |
183 | uart->port.icount.tx++; | 183 | uart->port.icount.tx++; |
diff --git a/drivers/tty/serial/atmel_serial.c b/drivers/tty/serial/atmel_serial.c index 3fceae099c44..c4f750314100 100644 --- a/drivers/tty/serial/atmel_serial.c +++ b/drivers/tty/serial/atmel_serial.c | |||
@@ -1932,7 +1932,7 @@ static void atmel_set_termios(struct uart_port *port, struct ktermios *termios, | |||
1932 | port->read_status_mask = ATMEL_US_OVRE; | 1932 | port->read_status_mask = ATMEL_US_OVRE; |
1933 | if (termios->c_iflag & INPCK) | 1933 | if (termios->c_iflag & INPCK) |
1934 | port->read_status_mask |= (ATMEL_US_FRAME | ATMEL_US_PARE); | 1934 | port->read_status_mask |= (ATMEL_US_FRAME | ATMEL_US_PARE); |
1935 | if (termios->c_iflag & (BRKINT | PARMRK)) | 1935 | if (termios->c_iflag & (IGNBRK | BRKINT | PARMRK)) |
1936 | port->read_status_mask |= ATMEL_US_RXBRK; | 1936 | port->read_status_mask |= ATMEL_US_RXBRK; |
1937 | 1937 | ||
1938 | if (atmel_use_pdc_rx(port)) | 1938 | if (atmel_use_pdc_rx(port)) |
diff --git a/drivers/tty/serial/bcm63xx_uart.c b/drivers/tty/serial/bcm63xx_uart.c index a47421e4627c..231519022b73 100644 --- a/drivers/tty/serial/bcm63xx_uart.c +++ b/drivers/tty/serial/bcm63xx_uart.c | |||
@@ -567,7 +567,7 @@ static void bcm_uart_set_termios(struct uart_port *port, | |||
567 | port->read_status_mask |= UART_FIFO_FRAMEERR_MASK; | 567 | port->read_status_mask |= UART_FIFO_FRAMEERR_MASK; |
568 | port->read_status_mask |= UART_FIFO_PARERR_MASK; | 568 | port->read_status_mask |= UART_FIFO_PARERR_MASK; |
569 | } | 569 | } |
570 | if (new->c_iflag & (BRKINT)) | 570 | if (new->c_iflag & (IGNBRK | BRKINT)) |
571 | port->read_status_mask |= UART_FIFO_BRKDET_MASK; | 571 | port->read_status_mask |= UART_FIFO_BRKDET_MASK; |
572 | 572 | ||
573 | port->ignore_status_mask = 0; | 573 | port->ignore_status_mask = 0; |
diff --git a/drivers/tty/serial/bfin_uart.c b/drivers/tty/serial/bfin_uart.c index 869ceba2ec57..ac86a20992e9 100644 --- a/drivers/tty/serial/bfin_uart.c +++ b/drivers/tty/serial/bfin_uart.c | |||
@@ -833,7 +833,7 @@ bfin_serial_set_termios(struct uart_port *port, struct ktermios *termios, | |||
833 | port->read_status_mask = OE; | 833 | port->read_status_mask = OE; |
834 | if (termios->c_iflag & INPCK) | 834 | if (termios->c_iflag & INPCK) |
835 | port->read_status_mask |= (FE | PE); | 835 | port->read_status_mask |= (FE | PE); |
836 | if (termios->c_iflag & (BRKINT | PARMRK)) | 836 | if (termios->c_iflag & (IGNBRK | BRKINT | PARMRK)) |
837 | port->read_status_mask |= BI; | 837 | port->read_status_mask |= BI; |
838 | 838 | ||
839 | /* | 839 | /* |
diff --git a/drivers/tty/serial/dz.c b/drivers/tty/serial/dz.c index 2f2b2e538a54..cdbbc788230a 100644 --- a/drivers/tty/serial/dz.c +++ b/drivers/tty/serial/dz.c | |||
@@ -625,7 +625,7 @@ static void dz_set_termios(struct uart_port *uport, struct ktermios *termios, | |||
625 | dport->port.read_status_mask = DZ_OERR; | 625 | dport->port.read_status_mask = DZ_OERR; |
626 | if (termios->c_iflag & INPCK) | 626 | if (termios->c_iflag & INPCK) |
627 | dport->port.read_status_mask |= DZ_FERR | DZ_PERR; | 627 | dport->port.read_status_mask |= DZ_FERR | DZ_PERR; |
628 | if (termios->c_iflag & (BRKINT | PARMRK)) | 628 | if (termios->c_iflag & (IGNBRK | BRKINT | PARMRK)) |
629 | dport->port.read_status_mask |= DZ_BREAK; | 629 | dport->port.read_status_mask |= DZ_BREAK; |
630 | 630 | ||
631 | /* characters to ignore */ | 631 | /* characters to ignore */ |
diff --git a/drivers/tty/serial/earlycon.c b/drivers/tty/serial/earlycon.c index 5131b5ee6164..a514ee6f5406 100644 --- a/drivers/tty/serial/earlycon.c +++ b/drivers/tty/serial/earlycon.c | |||
@@ -25,7 +25,7 @@ | |||
25 | #include <asm/serial.h> | 25 | #include <asm/serial.h> |
26 | 26 | ||
27 | static struct console early_con = { | 27 | static struct console early_con = { |
28 | .name = "earlycon", | 28 | .name = "uart", /* 8250 console switch requires this name */ |
29 | .flags = CON_PRINTBUFFER | CON_BOOT, | 29 | .flags = CON_PRINTBUFFER | CON_BOOT, |
30 | .index = -1, | 30 | .index = -1, |
31 | }; | 31 | }; |
diff --git a/drivers/tty/serial/efm32-uart.c b/drivers/tty/serial/efm32-uart.c index b373f6416e8c..3b0ee9afd76f 100644 --- a/drivers/tty/serial/efm32-uart.c +++ b/drivers/tty/serial/efm32-uart.c | |||
@@ -407,7 +407,7 @@ static void efm32_uart_set_termios(struct uart_port *port, | |||
407 | if (new->c_iflag & INPCK) | 407 | if (new->c_iflag & INPCK) |
408 | port->read_status_mask |= | 408 | port->read_status_mask |= |
409 | UARTn_RXDATAX_FERR | UARTn_RXDATAX_PERR; | 409 | UARTn_RXDATAX_FERR | UARTn_RXDATAX_PERR; |
410 | if (new->c_iflag & (BRKINT | PARMRK)) | 410 | if (new->c_iflag & (IGNBRK | BRKINT | PARMRK)) |
411 | port->read_status_mask |= SW_UARTn_RXDATAX_BERR; | 411 | port->read_status_mask |= SW_UARTn_RXDATAX_BERR; |
412 | 412 | ||
413 | port->ignore_status_mask = 0; | 413 | port->ignore_status_mask = 0; |
diff --git a/drivers/tty/serial/fsl_lpuart.c b/drivers/tty/serial/fsl_lpuart.c index c5eb897de9de..49385c86cfba 100644 --- a/drivers/tty/serial/fsl_lpuart.c +++ b/drivers/tty/serial/fsl_lpuart.c | |||
@@ -902,7 +902,7 @@ lpuart_set_termios(struct uart_port *port, struct ktermios *termios, | |||
902 | sport->port.read_status_mask = 0; | 902 | sport->port.read_status_mask = 0; |
903 | if (termios->c_iflag & INPCK) | 903 | if (termios->c_iflag & INPCK) |
904 | sport->port.read_status_mask |= (UARTSR1_FE | UARTSR1_PE); | 904 | sport->port.read_status_mask |= (UARTSR1_FE | UARTSR1_PE); |
905 | if (termios->c_iflag & (BRKINT | PARMRK)) | 905 | if (termios->c_iflag & (IGNBRK | BRKINT | PARMRK)) |
906 | sport->port.read_status_mask |= UARTSR1_FE; | 906 | sport->port.read_status_mask |= UARTSR1_FE; |
907 | 907 | ||
908 | /* characters to ignore */ | 908 | /* characters to ignore */ |
diff --git a/drivers/tty/serial/imx.c b/drivers/tty/serial/imx.c index e2f93874989b..044e86d528ae 100644 --- a/drivers/tty/serial/imx.c +++ b/drivers/tty/serial/imx.c | |||
@@ -567,6 +567,9 @@ static void imx_start_tx(struct uart_port *port) | |||
567 | struct imx_port *sport = (struct imx_port *)port; | 567 | struct imx_port *sport = (struct imx_port *)port; |
568 | unsigned long temp; | 568 | unsigned long temp; |
569 | 569 | ||
570 | if (uart_circ_empty(&port->state->xmit)) | ||
571 | return; | ||
572 | |||
570 | if (USE_IRDA(sport)) { | 573 | if (USE_IRDA(sport)) { |
571 | /* half duplex in IrDA mode; have to disable receive mode */ | 574 | /* half duplex in IrDA mode; have to disable receive mode */ |
572 | temp = readl(sport->port.membase + UCR4); | 575 | temp = readl(sport->port.membase + UCR4); |
diff --git a/drivers/tty/serial/ip22zilog.c b/drivers/tty/serial/ip22zilog.c index 1d9420548e16..99b7b8697861 100644 --- a/drivers/tty/serial/ip22zilog.c +++ b/drivers/tty/serial/ip22zilog.c | |||
@@ -603,6 +603,8 @@ static void ip22zilog_start_tx(struct uart_port *port) | |||
603 | } else { | 603 | } else { |
604 | struct circ_buf *xmit = &port->state->xmit; | 604 | struct circ_buf *xmit = &port->state->xmit; |
605 | 605 | ||
606 | if (uart_circ_empty(xmit)) | ||
607 | return; | ||
606 | writeb(xmit->buf[xmit->tail], &channel->data); | 608 | writeb(xmit->buf[xmit->tail], &channel->data); |
607 | ZSDELAY(); | 609 | ZSDELAY(); |
608 | ZS_WSYNC(channel); | 610 | ZS_WSYNC(channel); |
@@ -850,7 +852,7 @@ ip22zilog_convert_to_zs(struct uart_ip22zilog_port *up, unsigned int cflag, | |||
850 | up->port.read_status_mask = Rx_OVR; | 852 | up->port.read_status_mask = Rx_OVR; |
851 | if (iflag & INPCK) | 853 | if (iflag & INPCK) |
852 | up->port.read_status_mask |= CRC_ERR | PAR_ERR; | 854 | up->port.read_status_mask |= CRC_ERR | PAR_ERR; |
853 | if (iflag & (BRKINT | PARMRK)) | 855 | if (iflag & (IGNBRK | BRKINT | PARMRK)) |
854 | up->port.read_status_mask |= BRK_ABRT; | 856 | up->port.read_status_mask |= BRK_ABRT; |
855 | 857 | ||
856 | up->port.ignore_status_mask = 0; | 858 | up->port.ignore_status_mask = 0; |
diff --git a/drivers/tty/serial/m32r_sio.c b/drivers/tty/serial/m32r_sio.c index 9cd9b4eba9fc..5702828fb62e 100644 --- a/drivers/tty/serial/m32r_sio.c +++ b/drivers/tty/serial/m32r_sio.c | |||
@@ -266,9 +266,11 @@ static void m32r_sio_start_tx(struct uart_port *port) | |||
266 | if (!(up->ier & UART_IER_THRI)) { | 266 | if (!(up->ier & UART_IER_THRI)) { |
267 | up->ier |= UART_IER_THRI; | 267 | up->ier |= UART_IER_THRI; |
268 | serial_out(up, UART_IER, up->ier); | 268 | serial_out(up, UART_IER, up->ier); |
269 | serial_out(up, UART_TX, xmit->buf[xmit->tail]); | 269 | if (!uart_circ_empty(xmit)) { |
270 | xmit->tail = (xmit->tail + 1) & (UART_XMIT_SIZE - 1); | 270 | serial_out(up, UART_TX, xmit->buf[xmit->tail]); |
271 | up->port.icount.tx++; | 271 | xmit->tail = (xmit->tail + 1) & (UART_XMIT_SIZE - 1); |
272 | up->port.icount.tx++; | ||
273 | } | ||
272 | } | 274 | } |
273 | while((serial_in(up, UART_LSR) & UART_EMPTY) != UART_EMPTY); | 275 | while((serial_in(up, UART_LSR) & UART_EMPTY) != UART_EMPTY); |
274 | #else | 276 | #else |
@@ -737,7 +739,7 @@ static void m32r_sio_set_termios(struct uart_port *port, | |||
737 | up->port.read_status_mask = UART_LSR_OE | UART_LSR_THRE | UART_LSR_DR; | 739 | up->port.read_status_mask = UART_LSR_OE | UART_LSR_THRE | UART_LSR_DR; |
738 | if (termios->c_iflag & INPCK) | 740 | if (termios->c_iflag & INPCK) |
739 | up->port.read_status_mask |= UART_LSR_FE | UART_LSR_PE; | 741 | up->port.read_status_mask |= UART_LSR_FE | UART_LSR_PE; |
740 | if (termios->c_iflag & (BRKINT | PARMRK)) | 742 | if (termios->c_iflag & (IGNBRK | BRKINT | PARMRK)) |
741 | up->port.read_status_mask |= UART_LSR_BI; | 743 | up->port.read_status_mask |= UART_LSR_BI; |
742 | 744 | ||
743 | /* | 745 | /* |
diff --git a/drivers/tty/serial/max310x.c b/drivers/tty/serial/max310x.c index 2a99d0c61b9e..ba285cd45b59 100644 --- a/drivers/tty/serial/max310x.c +++ b/drivers/tty/serial/max310x.c | |||
@@ -835,7 +835,7 @@ static void max310x_set_termios(struct uart_port *port, | |||
835 | if (termios->c_iflag & INPCK) | 835 | if (termios->c_iflag & INPCK) |
836 | port->read_status_mask |= MAX310X_LSR_RXPAR_BIT | | 836 | port->read_status_mask |= MAX310X_LSR_RXPAR_BIT | |
837 | MAX310X_LSR_FRERR_BIT; | 837 | MAX310X_LSR_FRERR_BIT; |
838 | if (termios->c_iflag & (BRKINT | PARMRK)) | 838 | if (termios->c_iflag & (IGNBRK | BRKINT | PARMRK)) |
839 | port->read_status_mask |= MAX310X_LSR_RXBRK_BIT; | 839 | port->read_status_mask |= MAX310X_LSR_RXBRK_BIT; |
840 | 840 | ||
841 | /* Set status ignore mask */ | 841 | /* Set status ignore mask */ |
diff --git a/drivers/tty/serial/mcf.c b/drivers/tty/serial/mcf.c index 0edfaf8cd269..a6f085717f94 100644 --- a/drivers/tty/serial/mcf.c +++ b/drivers/tty/serial/mcf.c | |||
@@ -248,6 +248,12 @@ static void mcf_set_termios(struct uart_port *port, struct ktermios *termios, | |||
248 | mr1 |= MCFUART_MR1_PARITYNONE; | 248 | mr1 |= MCFUART_MR1_PARITYNONE; |
249 | } | 249 | } |
250 | 250 | ||
251 | /* | ||
252 | * FIXME: port->read_status_mask and port->ignore_status_mask | ||
253 | * need to be initialized based on termios settings for | ||
254 | * INPCK, IGNBRK, IGNPAR, PARMRK, BRKINT | ||
255 | */ | ||
256 | |||
251 | if (termios->c_cflag & CSTOPB) | 257 | if (termios->c_cflag & CSTOPB) |
252 | mr2 |= MCFUART_MR2_STOP2; | 258 | mr2 |= MCFUART_MR2_STOP2; |
253 | else | 259 | else |
diff --git a/drivers/tty/serial/mfd.c b/drivers/tty/serial/mfd.c index 52c930fac210..445799dc9846 100644 --- a/drivers/tty/serial/mfd.c +++ b/drivers/tty/serial/mfd.c | |||
@@ -977,7 +977,7 @@ serial_hsu_set_termios(struct uart_port *port, struct ktermios *termios, | |||
977 | up->port.read_status_mask = UART_LSR_OE | UART_LSR_THRE | UART_LSR_DR; | 977 | up->port.read_status_mask = UART_LSR_OE | UART_LSR_THRE | UART_LSR_DR; |
978 | if (termios->c_iflag & INPCK) | 978 | if (termios->c_iflag & INPCK) |
979 | up->port.read_status_mask |= UART_LSR_FE | UART_LSR_PE; | 979 | up->port.read_status_mask |= UART_LSR_FE | UART_LSR_PE; |
980 | if (termios->c_iflag & (BRKINT | PARMRK)) | 980 | if (termios->c_iflag & (IGNBRK | BRKINT | PARMRK)) |
981 | up->port.read_status_mask |= UART_LSR_BI; | 981 | up->port.read_status_mask |= UART_LSR_BI; |
982 | 982 | ||
983 | /* Characters to ignore */ | 983 | /* Characters to ignore */ |
diff --git a/drivers/tty/serial/mpsc.c b/drivers/tty/serial/mpsc.c index e30a3ca3cea3..759c6a6fa74a 100644 --- a/drivers/tty/serial/mpsc.c +++ b/drivers/tty/serial/mpsc.c | |||
@@ -1458,7 +1458,7 @@ static void mpsc_set_termios(struct uart_port *port, struct ktermios *termios, | |||
1458 | pi->port.read_status_mask |= SDMA_DESC_CMDSTAT_PE | 1458 | pi->port.read_status_mask |= SDMA_DESC_CMDSTAT_PE |
1459 | | SDMA_DESC_CMDSTAT_FR; | 1459 | | SDMA_DESC_CMDSTAT_FR; |
1460 | 1460 | ||
1461 | if (termios->c_iflag & (BRKINT | PARMRK)) | 1461 | if (termios->c_iflag & (IGNBRK | BRKINT | PARMRK)) |
1462 | pi->port.read_status_mask |= SDMA_DESC_CMDSTAT_BR; | 1462 | pi->port.read_status_mask |= SDMA_DESC_CMDSTAT_BR; |
1463 | 1463 | ||
1464 | /* Characters/events to ignore */ | 1464 | /* Characters/events to ignore */ |
diff --git a/drivers/tty/serial/msm_serial.c b/drivers/tty/serial/msm_serial.c index 778e376f197e..72000a6d5af0 100644 --- a/drivers/tty/serial/msm_serial.c +++ b/drivers/tty/serial/msm_serial.c | |||
@@ -582,7 +582,7 @@ static void msm_set_termios(struct uart_port *port, struct ktermios *termios, | |||
582 | port->read_status_mask = 0; | 582 | port->read_status_mask = 0; |
583 | if (termios->c_iflag & INPCK) | 583 | if (termios->c_iflag & INPCK) |
584 | port->read_status_mask |= UART_SR_PAR_FRAME_ERR; | 584 | port->read_status_mask |= UART_SR_PAR_FRAME_ERR; |
585 | if (termios->c_iflag & (BRKINT | PARMRK)) | 585 | if (termios->c_iflag & (IGNBRK | BRKINT | PARMRK)) |
586 | port->read_status_mask |= UART_SR_RX_BREAK; | 586 | port->read_status_mask |= UART_SR_RX_BREAK; |
587 | 587 | ||
588 | uart_update_timeout(port, termios->c_cflag, baud); | 588 | uart_update_timeout(port, termios->c_cflag, baud); |
@@ -991,7 +991,7 @@ static const struct of_device_id msm_uartdm_table[] = { | |||
991 | { } | 991 | { } |
992 | }; | 992 | }; |
993 | 993 | ||
994 | static int __init msm_serial_probe(struct platform_device *pdev) | 994 | static int msm_serial_probe(struct platform_device *pdev) |
995 | { | 995 | { |
996 | struct msm_port *msm_port; | 996 | struct msm_port *msm_port; |
997 | struct resource *resource; | 997 | struct resource *resource; |
diff --git a/drivers/tty/serial/mxs-auart.c b/drivers/tty/serial/mxs-auart.c index 4b5b3c2fe328..86de4477d98a 100644 --- a/drivers/tty/serial/mxs-auart.c +++ b/drivers/tty/serial/mxs-auart.c | |||
@@ -604,7 +604,7 @@ static void mxs_auart_settermios(struct uart_port *u, | |||
604 | 604 | ||
605 | if (termios->c_iflag & INPCK) | 605 | if (termios->c_iflag & INPCK) |
606 | u->read_status_mask |= AUART_STAT_PERR; | 606 | u->read_status_mask |= AUART_STAT_PERR; |
607 | if (termios->c_iflag & (BRKINT | PARMRK)) | 607 | if (termios->c_iflag & (IGNBRK | BRKINT | PARMRK)) |
608 | u->read_status_mask |= AUART_STAT_BERR; | 608 | u->read_status_mask |= AUART_STAT_BERR; |
609 | 609 | ||
610 | /* | 610 | /* |
diff --git a/drivers/tty/serial/netx-serial.c b/drivers/tty/serial/netx-serial.c index 0a4dd70d29eb..7a6745601d4e 100644 --- a/drivers/tty/serial/netx-serial.c +++ b/drivers/tty/serial/netx-serial.c | |||
@@ -419,7 +419,7 @@ netx_set_termios(struct uart_port *port, struct ktermios *termios, | |||
419 | } | 419 | } |
420 | 420 | ||
421 | port->read_status_mask = 0; | 421 | port->read_status_mask = 0; |
422 | if (termios->c_iflag & (BRKINT | PARMRK)) | 422 | if (termios->c_iflag & (IGNBRK | BRKINT | PARMRK)) |
423 | port->read_status_mask |= SR_BE; | 423 | port->read_status_mask |= SR_BE; |
424 | if (termios->c_iflag & INPCK) | 424 | if (termios->c_iflag & INPCK) |
425 | port->read_status_mask |= SR_PE | SR_FE; | 425 | port->read_status_mask |= SR_PE | SR_FE; |
diff --git a/drivers/tty/serial/pmac_zilog.c b/drivers/tty/serial/pmac_zilog.c index e9d420ff3931..f7ad5b903055 100644 --- a/drivers/tty/serial/pmac_zilog.c +++ b/drivers/tty/serial/pmac_zilog.c | |||
@@ -653,6 +653,8 @@ static void pmz_start_tx(struct uart_port *port) | |||
653 | } else { | 653 | } else { |
654 | struct circ_buf *xmit = &port->state->xmit; | 654 | struct circ_buf *xmit = &port->state->xmit; |
655 | 655 | ||
656 | if (uart_circ_empty(xmit)) | ||
657 | goto out; | ||
656 | write_zsdata(uap, xmit->buf[xmit->tail]); | 658 | write_zsdata(uap, xmit->buf[xmit->tail]); |
657 | zssync(uap); | 659 | zssync(uap); |
658 | xmit->tail = (xmit->tail + 1) & (UART_XMIT_SIZE - 1); | 660 | xmit->tail = (xmit->tail + 1) & (UART_XMIT_SIZE - 1); |
@@ -661,6 +663,7 @@ static void pmz_start_tx(struct uart_port *port) | |||
661 | if (uart_circ_chars_pending(xmit) < WAKEUP_CHARS) | 663 | if (uart_circ_chars_pending(xmit) < WAKEUP_CHARS) |
662 | uart_write_wakeup(&uap->port); | 664 | uart_write_wakeup(&uap->port); |
663 | } | 665 | } |
666 | out: | ||
664 | pmz_debug("pmz: start_tx() done.\n"); | 667 | pmz_debug("pmz: start_tx() done.\n"); |
665 | } | 668 | } |
666 | 669 | ||
@@ -1092,7 +1095,7 @@ static void pmz_convert_to_zs(struct uart_pmac_port *uap, unsigned int cflag, | |||
1092 | uap->port.read_status_mask = Rx_OVR; | 1095 | uap->port.read_status_mask = Rx_OVR; |
1093 | if (iflag & INPCK) | 1096 | if (iflag & INPCK) |
1094 | uap->port.read_status_mask |= CRC_ERR | PAR_ERR; | 1097 | uap->port.read_status_mask |= CRC_ERR | PAR_ERR; |
1095 | if (iflag & (BRKINT | PARMRK)) | 1098 | if (iflag & (IGNBRK | BRKINT | PARMRK)) |
1096 | uap->port.read_status_mask |= BRK_ABRT; | 1099 | uap->port.read_status_mask |= BRK_ABRT; |
1097 | 1100 | ||
1098 | uap->port.ignore_status_mask = 0; | 1101 | uap->port.ignore_status_mask = 0; |
diff --git a/drivers/tty/serial/pnx8xxx_uart.c b/drivers/tty/serial/pnx8xxx_uart.c index de6c05c63683..2ba24a45c97f 100644 --- a/drivers/tty/serial/pnx8xxx_uart.c +++ b/drivers/tty/serial/pnx8xxx_uart.c | |||
@@ -477,7 +477,7 @@ pnx8xxx_set_termios(struct uart_port *port, struct ktermios *termios, | |||
477 | sport->port.read_status_mask |= | 477 | sport->port.read_status_mask |= |
478 | FIFO_TO_SM(PNX8XXX_UART_FIFO_RXFE) | | 478 | FIFO_TO_SM(PNX8XXX_UART_FIFO_RXFE) | |
479 | FIFO_TO_SM(PNX8XXX_UART_FIFO_RXPAR); | 479 | FIFO_TO_SM(PNX8XXX_UART_FIFO_RXPAR); |
480 | if (termios->c_iflag & (BRKINT | PARMRK)) | 480 | if (termios->c_iflag & (IGNBRK | BRKINT | PARMRK)) |
481 | sport->port.read_status_mask |= | 481 | sport->port.read_status_mask |= |
482 | ISTAT_TO_SM(PNX8XXX_UART_INT_BREAK); | 482 | ISTAT_TO_SM(PNX8XXX_UART_INT_BREAK); |
483 | 483 | ||
diff --git a/drivers/tty/serial/pxa.c b/drivers/tty/serial/pxa.c index 9e7ee39f8b2a..c638c53cd2b6 100644 --- a/drivers/tty/serial/pxa.c +++ b/drivers/tty/serial/pxa.c | |||
@@ -492,7 +492,7 @@ serial_pxa_set_termios(struct uart_port *port, struct ktermios *termios, | |||
492 | up->port.read_status_mask = UART_LSR_OE | UART_LSR_THRE | UART_LSR_DR; | 492 | up->port.read_status_mask = UART_LSR_OE | UART_LSR_THRE | UART_LSR_DR; |
493 | if (termios->c_iflag & INPCK) | 493 | if (termios->c_iflag & INPCK) |
494 | up->port.read_status_mask |= UART_LSR_FE | UART_LSR_PE; | 494 | up->port.read_status_mask |= UART_LSR_FE | UART_LSR_PE; |
495 | if (termios->c_iflag & (BRKINT | PARMRK)) | 495 | if (termios->c_iflag & (IGNBRK | BRKINT | PARMRK)) |
496 | up->port.read_status_mask |= UART_LSR_BI; | 496 | up->port.read_status_mask |= UART_LSR_BI; |
497 | 497 | ||
498 | /* | 498 | /* |
diff --git a/drivers/tty/serial/samsung.c b/drivers/tty/serial/samsung.c index 329337711bb0..c1d3ebdf3b97 100644 --- a/drivers/tty/serial/samsung.c +++ b/drivers/tty/serial/samsung.c | |||
@@ -66,7 +66,7 @@ static void dbg(const char *fmt, ...) | |||
66 | char buff[256]; | 66 | char buff[256]; |
67 | 67 | ||
68 | va_start(va, fmt); | 68 | va_start(va, fmt); |
69 | vscnprintf(buff, sizeof(buf), fmt, va); | 69 | vscnprintf(buff, sizeof(buff), fmt, va); |
70 | va_end(va); | 70 | va_end(va); |
71 | 71 | ||
72 | printascii(buff); | 72 | printascii(buff); |
diff --git a/drivers/tty/serial/sb1250-duart.c b/drivers/tty/serial/sb1250-duart.c index a7cdec2962dd..771f361c47ea 100644 --- a/drivers/tty/serial/sb1250-duart.c +++ b/drivers/tty/serial/sb1250-duart.c | |||
@@ -596,7 +596,7 @@ static void sbd_set_termios(struct uart_port *uport, struct ktermios *termios, | |||
596 | if (termios->c_iflag & INPCK) | 596 | if (termios->c_iflag & INPCK) |
597 | uport->read_status_mask |= M_DUART_FRM_ERR | | 597 | uport->read_status_mask |= M_DUART_FRM_ERR | |
598 | M_DUART_PARITY_ERR; | 598 | M_DUART_PARITY_ERR; |
599 | if (termios->c_iflag & (BRKINT | PARMRK)) | 599 | if (termios->c_iflag & (IGNBRK | BRKINT | PARMRK)) |
600 | uport->read_status_mask |= M_DUART_RCVD_BRK; | 600 | uport->read_status_mask |= M_DUART_RCVD_BRK; |
601 | 601 | ||
602 | uport->ignore_status_mask = 0; | 602 | uport->ignore_status_mask = 0; |
diff --git a/drivers/tty/serial/sccnxp.c b/drivers/tty/serial/sccnxp.c index 5443b46345ed..e84b6a3bdd18 100644 --- a/drivers/tty/serial/sccnxp.c +++ b/drivers/tty/serial/sccnxp.c | |||
@@ -665,7 +665,7 @@ static void sccnxp_set_termios(struct uart_port *port, | |||
665 | port->read_status_mask = SR_OVR; | 665 | port->read_status_mask = SR_OVR; |
666 | if (termios->c_iflag & INPCK) | 666 | if (termios->c_iflag & INPCK) |
667 | port->read_status_mask |= SR_PE | SR_FE; | 667 | port->read_status_mask |= SR_PE | SR_FE; |
668 | if (termios->c_iflag & (BRKINT | PARMRK)) | 668 | if (termios->c_iflag & (IGNBRK | BRKINT | PARMRK)) |
669 | port->read_status_mask |= SR_BRK; | 669 | port->read_status_mask |= SR_BRK; |
670 | 670 | ||
671 | /* Set status ignore mask */ | 671 | /* Set status ignore mask */ |
diff --git a/drivers/tty/serial/serial_ks8695.c b/drivers/tty/serial/serial_ks8695.c index e1caa99e3d3b..5c79bdab985d 100644 --- a/drivers/tty/serial/serial_ks8695.c +++ b/drivers/tty/serial/serial_ks8695.c | |||
@@ -437,7 +437,7 @@ static void ks8695uart_set_termios(struct uart_port *port, struct ktermios *term | |||
437 | port->read_status_mask = URLS_URROE; | 437 | port->read_status_mask = URLS_URROE; |
438 | if (termios->c_iflag & INPCK) | 438 | if (termios->c_iflag & INPCK) |
439 | port->read_status_mask |= (URLS_URFE | URLS_URPE); | 439 | port->read_status_mask |= (URLS_URFE | URLS_URPE); |
440 | if (termios->c_iflag & (BRKINT | PARMRK)) | 440 | if (termios->c_iflag & (IGNBRK | BRKINT | PARMRK)) |
441 | port->read_status_mask |= URLS_URBI; | 441 | port->read_status_mask |= URLS_URBI; |
442 | 442 | ||
443 | /* | 443 | /* |
diff --git a/drivers/tty/serial/serial_txx9.c b/drivers/tty/serial/serial_txx9.c index 60f49b9d7e39..ea8546092c7e 100644 --- a/drivers/tty/serial/serial_txx9.c +++ b/drivers/tty/serial/serial_txx9.c | |||
@@ -697,7 +697,7 @@ serial_txx9_set_termios(struct uart_port *port, struct ktermios *termios, | |||
697 | TXX9_SIDISR_TDIS | TXX9_SIDISR_RDIS; | 697 | TXX9_SIDISR_TDIS | TXX9_SIDISR_RDIS; |
698 | if (termios->c_iflag & INPCK) | 698 | if (termios->c_iflag & INPCK) |
699 | up->port.read_status_mask |= TXX9_SIDISR_UFER | TXX9_SIDISR_UPER; | 699 | up->port.read_status_mask |= TXX9_SIDISR_UFER | TXX9_SIDISR_UPER; |
700 | if (termios->c_iflag & (BRKINT | PARMRK)) | 700 | if (termios->c_iflag & (IGNBRK | BRKINT | PARMRK)) |
701 | up->port.read_status_mask |= TXX9_SIDISR_UBRK; | 701 | up->port.read_status_mask |= TXX9_SIDISR_UBRK; |
702 | 702 | ||
703 | /* | 703 | /* |
diff --git a/drivers/tty/serial/sirfsoc_uart.c b/drivers/tty/serial/sirfsoc_uart.c index 1f2be48c92ce..9b4d71cff00d 100644 --- a/drivers/tty/serial/sirfsoc_uart.c +++ b/drivers/tty/serial/sirfsoc_uart.c | |||
@@ -896,7 +896,7 @@ static void sirfsoc_uart_set_termios(struct uart_port *port, | |||
896 | if (termios->c_iflag & INPCK) | 896 | if (termios->c_iflag & INPCK) |
897 | port->read_status_mask |= uint_en->sirfsoc_frm_err_en; | 897 | port->read_status_mask |= uint_en->sirfsoc_frm_err_en; |
898 | } | 898 | } |
899 | if (termios->c_iflag & (BRKINT | PARMRK)) | 899 | if (termios->c_iflag & (IGNBRK | BRKINT | PARMRK)) |
900 | port->read_status_mask |= uint_en->sirfsoc_rxd_brk_en; | 900 | port->read_status_mask |= uint_en->sirfsoc_rxd_brk_en; |
901 | if (sirfport->uart_reg->uart_type == SIRF_REAL_UART) { | 901 | if (sirfport->uart_reg->uart_type == SIRF_REAL_UART) { |
902 | if (termios->c_iflag & IGNPAR) | 902 | if (termios->c_iflag & IGNPAR) |
diff --git a/drivers/tty/serial/st-asc.c b/drivers/tty/serial/st-asc.c index c7f61ac27132..f48b1cc07eea 100644 --- a/drivers/tty/serial/st-asc.c +++ b/drivers/tty/serial/st-asc.c | |||
@@ -547,7 +547,7 @@ static void asc_set_termios(struct uart_port *port, struct ktermios *termios, | |||
547 | ascport->port.read_status_mask = ASC_RXBUF_DUMMY_OE; | 547 | ascport->port.read_status_mask = ASC_RXBUF_DUMMY_OE; |
548 | if (termios->c_iflag & INPCK) | 548 | if (termios->c_iflag & INPCK) |
549 | ascport->port.read_status_mask |= ASC_RXBUF_FE | ASC_RXBUF_PE; | 549 | ascport->port.read_status_mask |= ASC_RXBUF_FE | ASC_RXBUF_PE; |
550 | if (termios->c_iflag & (BRKINT | PARMRK)) | 550 | if (termios->c_iflag & (IGNBRK | BRKINT | PARMRK)) |
551 | ascport->port.read_status_mask |= ASC_RXBUF_DUMMY_BE; | 551 | ascport->port.read_status_mask |= ASC_RXBUF_DUMMY_BE; |
552 | 552 | ||
553 | /* | 553 | /* |
diff --git a/drivers/tty/serial/sunsab.c b/drivers/tty/serial/sunsab.c index 5faa8e905e98..2f57df9a71d9 100644 --- a/drivers/tty/serial/sunsab.c +++ b/drivers/tty/serial/sunsab.c | |||
@@ -427,6 +427,9 @@ static void sunsab_start_tx(struct uart_port *port) | |||
427 | struct circ_buf *xmit = &up->port.state->xmit; | 427 | struct circ_buf *xmit = &up->port.state->xmit; |
428 | int i; | 428 | int i; |
429 | 429 | ||
430 | if (uart_circ_empty(xmit)) | ||
431 | return; | ||
432 | |||
430 | up->interrupt_mask1 &= ~(SAB82532_IMR1_ALLS|SAB82532_IMR1_XPR); | 433 | up->interrupt_mask1 &= ~(SAB82532_IMR1_ALLS|SAB82532_IMR1_XPR); |
431 | writeb(up->interrupt_mask1, &up->regs->w.imr1); | 434 | writeb(up->interrupt_mask1, &up->regs->w.imr1); |
432 | 435 | ||
@@ -719,7 +722,7 @@ static void sunsab_convert_to_sab(struct uart_sunsab_port *up, unsigned int cfla | |||
719 | if (iflag & INPCK) | 722 | if (iflag & INPCK) |
720 | up->port.read_status_mask |= (SAB82532_ISR0_PERR | | 723 | up->port.read_status_mask |= (SAB82532_ISR0_PERR | |
721 | SAB82532_ISR0_FERR); | 724 | SAB82532_ISR0_FERR); |
722 | if (iflag & (BRKINT | PARMRK)) | 725 | if (iflag & (IGNBRK | BRKINT | PARMRK)) |
723 | up->port.read_status_mask |= (SAB82532_ISR1_BRK << 8); | 726 | up->port.read_status_mask |= (SAB82532_ISR1_BRK << 8); |
724 | 727 | ||
725 | /* | 728 | /* |
diff --git a/drivers/tty/serial/sunsu.c b/drivers/tty/serial/sunsu.c index 9a0f24f83720..5326ae195e5f 100644 --- a/drivers/tty/serial/sunsu.c +++ b/drivers/tty/serial/sunsu.c | |||
@@ -834,7 +834,7 @@ sunsu_change_speed(struct uart_port *port, unsigned int cflag, | |||
834 | up->port.read_status_mask = UART_LSR_OE | UART_LSR_THRE | UART_LSR_DR; | 834 | up->port.read_status_mask = UART_LSR_OE | UART_LSR_THRE | UART_LSR_DR; |
835 | if (iflag & INPCK) | 835 | if (iflag & INPCK) |
836 | up->port.read_status_mask |= UART_LSR_FE | UART_LSR_PE; | 836 | up->port.read_status_mask |= UART_LSR_FE | UART_LSR_PE; |
837 | if (iflag & (BRKINT | PARMRK)) | 837 | if (iflag & (IGNBRK | BRKINT | PARMRK)) |
838 | up->port.read_status_mask |= UART_LSR_BI; | 838 | up->port.read_status_mask |= UART_LSR_BI; |
839 | 839 | ||
840 | /* | 840 | /* |
diff --git a/drivers/tty/serial/sunzilog.c b/drivers/tty/serial/sunzilog.c index a2c40ed287d2..02df3940b95e 100644 --- a/drivers/tty/serial/sunzilog.c +++ b/drivers/tty/serial/sunzilog.c | |||
@@ -703,6 +703,8 @@ static void sunzilog_start_tx(struct uart_port *port) | |||
703 | } else { | 703 | } else { |
704 | struct circ_buf *xmit = &port->state->xmit; | 704 | struct circ_buf *xmit = &port->state->xmit; |
705 | 705 | ||
706 | if (uart_circ_empty(xmit)) | ||
707 | return; | ||
706 | writeb(xmit->buf[xmit->tail], &channel->data); | 708 | writeb(xmit->buf[xmit->tail], &channel->data); |
707 | ZSDELAY(); | 709 | ZSDELAY(); |
708 | ZS_WSYNC(channel); | 710 | ZS_WSYNC(channel); |
@@ -915,7 +917,7 @@ sunzilog_convert_to_zs(struct uart_sunzilog_port *up, unsigned int cflag, | |||
915 | up->port.read_status_mask = Rx_OVR; | 917 | up->port.read_status_mask = Rx_OVR; |
916 | if (iflag & INPCK) | 918 | if (iflag & INPCK) |
917 | up->port.read_status_mask |= CRC_ERR | PAR_ERR; | 919 | up->port.read_status_mask |= CRC_ERR | PAR_ERR; |
918 | if (iflag & (BRKINT | PARMRK)) | 920 | if (iflag & (IGNBRK | BRKINT | PARMRK)) |
919 | up->port.read_status_mask |= BRK_ABRT; | 921 | up->port.read_status_mask |= BRK_ABRT; |
920 | 922 | ||
921 | up->port.ignore_status_mask = 0; | 923 | up->port.ignore_status_mask = 0; |
diff --git a/drivers/tty/serial/ucc_uart.c b/drivers/tty/serial/ucc_uart.c index d569ca58bab6..1c52074c38df 100644 --- a/drivers/tty/serial/ucc_uart.c +++ b/drivers/tty/serial/ucc_uart.c | |||
@@ -936,7 +936,7 @@ static void qe_uart_set_termios(struct uart_port *port, | |||
936 | port->read_status_mask = BD_SC_EMPTY | BD_SC_OV; | 936 | port->read_status_mask = BD_SC_EMPTY | BD_SC_OV; |
937 | if (termios->c_iflag & INPCK) | 937 | if (termios->c_iflag & INPCK) |
938 | port->read_status_mask |= BD_SC_FR | BD_SC_PR; | 938 | port->read_status_mask |= BD_SC_FR | BD_SC_PR; |
939 | if (termios->c_iflag & (BRKINT | PARMRK)) | 939 | if (termios->c_iflag & (IGNBRK | BRKINT | PARMRK)) |
940 | port->read_status_mask |= BD_SC_BR; | 940 | port->read_status_mask |= BD_SC_BR; |
941 | 941 | ||
942 | /* | 942 | /* |
diff --git a/drivers/tty/serial/vr41xx_siu.c b/drivers/tty/serial/vr41xx_siu.c index a63c14bc9a24..db0c8a4ab03e 100644 --- a/drivers/tty/serial/vr41xx_siu.c +++ b/drivers/tty/serial/vr41xx_siu.c | |||
@@ -559,7 +559,7 @@ static void siu_set_termios(struct uart_port *port, struct ktermios *new, | |||
559 | port->read_status_mask = UART_LSR_THRE | UART_LSR_OE | UART_LSR_DR; | 559 | port->read_status_mask = UART_LSR_THRE | UART_LSR_OE | UART_LSR_DR; |
560 | if (c_iflag & INPCK) | 560 | if (c_iflag & INPCK) |
561 | port->read_status_mask |= UART_LSR_FE | UART_LSR_PE; | 561 | port->read_status_mask |= UART_LSR_FE | UART_LSR_PE; |
562 | if (c_iflag & (BRKINT | PARMRK)) | 562 | if (c_iflag & (IGNBRK | BRKINT | PARMRK)) |
563 | port->read_status_mask |= UART_LSR_BI; | 563 | port->read_status_mask |= UART_LSR_BI; |
564 | 564 | ||
565 | port->ignore_status_mask = 0; | 565 | port->ignore_status_mask = 0; |
diff --git a/drivers/tty/serial/zs.c b/drivers/tty/serial/zs.c index 6a169877109b..2b65bb7ffb8a 100644 --- a/drivers/tty/serial/zs.c +++ b/drivers/tty/serial/zs.c | |||
@@ -923,7 +923,7 @@ static void zs_set_termios(struct uart_port *uport, struct ktermios *termios, | |||
923 | uport->read_status_mask = Rx_OVR; | 923 | uport->read_status_mask = Rx_OVR; |
924 | if (termios->c_iflag & INPCK) | 924 | if (termios->c_iflag & INPCK) |
925 | uport->read_status_mask |= FRM_ERR | PAR_ERR; | 925 | uport->read_status_mask |= FRM_ERR | PAR_ERR; |
926 | if (termios->c_iflag & (BRKINT | PARMRK)) | 926 | if (termios->c_iflag & (IGNBRK | BRKINT | PARMRK)) |
927 | uport->read_status_mask |= Rx_BRK; | 927 | uport->read_status_mask |= Rx_BRK; |
928 | 928 | ||
929 | uport->ignore_status_mask = 0; | 929 | uport->ignore_status_mask = 0; |
diff --git a/drivers/tty/vt/vt.c b/drivers/tty/vt/vt.c index 5e0f6ff2e2f5..b33b00b386de 100644 --- a/drivers/tty/vt/vt.c +++ b/drivers/tty/vt/vt.c | |||
@@ -3226,8 +3226,7 @@ int do_unbind_con_driver(const struct consw *csw, int first, int last, int deflt | |||
3226 | for (i = 0; i < MAX_NR_CON_DRIVER; i++) { | 3226 | for (i = 0; i < MAX_NR_CON_DRIVER; i++) { |
3227 | con_back = ®istered_con_driver[i]; | 3227 | con_back = ®istered_con_driver[i]; |
3228 | 3228 | ||
3229 | if (con_back->con && | 3229 | if (con_back->con && con_back->con != csw) { |
3230 | !(con_back->flag & CON_DRIVER_FLAG_MODULE)) { | ||
3231 | defcsw = con_back->con; | 3230 | defcsw = con_back->con; |
3232 | retval = 0; | 3231 | retval = 0; |
3233 | break; | 3232 | break; |
@@ -3332,6 +3331,7 @@ static int vt_unbind(struct con_driver *con) | |||
3332 | { | 3331 | { |
3333 | const struct consw *csw = NULL; | 3332 | const struct consw *csw = NULL; |
3334 | int i, more = 1, first = -1, last = -1, deflt = 0; | 3333 | int i, more = 1, first = -1, last = -1, deflt = 0; |
3334 | int ret; | ||
3335 | 3335 | ||
3336 | if (!con->con || !(con->flag & CON_DRIVER_FLAG_MODULE) || | 3336 | if (!con->con || !(con->flag & CON_DRIVER_FLAG_MODULE) || |
3337 | con_is_graphics(con->con, con->first, con->last)) | 3337 | con_is_graphics(con->con, con->first, con->last)) |
@@ -3357,8 +3357,10 @@ static int vt_unbind(struct con_driver *con) | |||
3357 | 3357 | ||
3358 | if (first != -1) { | 3358 | if (first != -1) { |
3359 | console_lock(); | 3359 | console_lock(); |
3360 | do_unbind_con_driver(csw, first, last, deflt); | 3360 | ret = do_unbind_con_driver(csw, first, last, deflt); |
3361 | console_unlock(); | 3361 | console_unlock(); |
3362 | if (ret != 0) | ||
3363 | return ret; | ||
3362 | } | 3364 | } |
3363 | 3365 | ||
3364 | first = -1; | 3366 | first = -1; |
@@ -3645,17 +3647,20 @@ err: | |||
3645 | */ | 3647 | */ |
3646 | int do_unregister_con_driver(const struct consw *csw) | 3648 | int do_unregister_con_driver(const struct consw *csw) |
3647 | { | 3649 | { |
3648 | int i, retval = -ENODEV; | 3650 | int i; |
3649 | 3651 | ||
3650 | /* cannot unregister a bound driver */ | 3652 | /* cannot unregister a bound driver */ |
3651 | if (con_is_bound(csw)) | 3653 | if (con_is_bound(csw)) |
3652 | goto err; | 3654 | return -EBUSY; |
3655 | |||
3656 | if (csw == conswitchp) | ||
3657 | return -EINVAL; | ||
3653 | 3658 | ||
3654 | for (i = 0; i < MAX_NR_CON_DRIVER; i++) { | 3659 | for (i = 0; i < MAX_NR_CON_DRIVER; i++) { |
3655 | struct con_driver *con_driver = ®istered_con_driver[i]; | 3660 | struct con_driver *con_driver = ®istered_con_driver[i]; |
3656 | 3661 | ||
3657 | if (con_driver->con == csw && | 3662 | if (con_driver->con == csw && |
3658 | con_driver->flag & CON_DRIVER_FLAG_MODULE) { | 3663 | con_driver->flag & CON_DRIVER_FLAG_INIT) { |
3659 | vtconsole_deinit_device(con_driver); | 3664 | vtconsole_deinit_device(con_driver); |
3660 | device_destroy(vtconsole_class, | 3665 | device_destroy(vtconsole_class, |
3661 | MKDEV(0, con_driver->node)); | 3666 | MKDEV(0, con_driver->node)); |
@@ -3666,12 +3671,11 @@ int do_unregister_con_driver(const struct consw *csw) | |||
3666 | con_driver->flag = 0; | 3671 | con_driver->flag = 0; |
3667 | con_driver->first = 0; | 3672 | con_driver->first = 0; |
3668 | con_driver->last = 0; | 3673 | con_driver->last = 0; |
3669 | retval = 0; | 3674 | return 0; |
3670 | break; | ||
3671 | } | 3675 | } |
3672 | } | 3676 | } |
3673 | err: | 3677 | |
3674 | return retval; | 3678 | return -ENODEV; |
3675 | } | 3679 | } |
3676 | EXPORT_SYMBOL_GPL(do_unregister_con_driver); | 3680 | EXPORT_SYMBOL_GPL(do_unregister_con_driver); |
3677 | 3681 | ||
diff --git a/drivers/uio/uio.c b/drivers/uio/uio.c index e371f5af11f5..a673e5b6a2e0 100644 --- a/drivers/uio/uio.c +++ b/drivers/uio/uio.c | |||
@@ -655,7 +655,7 @@ static int uio_mmap_physical(struct vm_area_struct *vma) | |||
655 | 655 | ||
656 | if (mem->addr & ~PAGE_MASK) | 656 | if (mem->addr & ~PAGE_MASK) |
657 | return -ENODEV; | 657 | return -ENODEV; |
658 | if (vma->vm_end - vma->vm_start > PAGE_ALIGN(mem->size)) | 658 | if (vma->vm_end - vma->vm_start > mem->size) |
659 | return -EINVAL; | 659 | return -EINVAL; |
660 | 660 | ||
661 | vma->vm_ops = &uio_physical_vm_ops; | 661 | vma->vm_ops = &uio_physical_vm_ops; |
diff --git a/drivers/usb/chipidea/udc.c b/drivers/usb/chipidea/udc.c index 69425b3cb6b7..9d2b673f90e3 100644 --- a/drivers/usb/chipidea/udc.c +++ b/drivers/usb/chipidea/udc.c | |||
@@ -1321,6 +1321,7 @@ static int ep_dequeue(struct usb_ep *ep, struct usb_request *req) | |||
1321 | struct ci_hw_ep *hwep = container_of(ep, struct ci_hw_ep, ep); | 1321 | struct ci_hw_ep *hwep = container_of(ep, struct ci_hw_ep, ep); |
1322 | struct ci_hw_req *hwreq = container_of(req, struct ci_hw_req, req); | 1322 | struct ci_hw_req *hwreq = container_of(req, struct ci_hw_req, req); |
1323 | unsigned long flags; | 1323 | unsigned long flags; |
1324 | struct td_node *node, *tmpnode; | ||
1324 | 1325 | ||
1325 | if (ep == NULL || req == NULL || hwreq->req.status != -EALREADY || | 1326 | if (ep == NULL || req == NULL || hwreq->req.status != -EALREADY || |
1326 | hwep->ep.desc == NULL || list_empty(&hwreq->queue) || | 1327 | hwep->ep.desc == NULL || list_empty(&hwreq->queue) || |
@@ -1331,6 +1332,12 @@ static int ep_dequeue(struct usb_ep *ep, struct usb_request *req) | |||
1331 | 1332 | ||
1332 | hw_ep_flush(hwep->ci, hwep->num, hwep->dir); | 1333 | hw_ep_flush(hwep->ci, hwep->num, hwep->dir); |
1333 | 1334 | ||
1335 | list_for_each_entry_safe(node, tmpnode, &hwreq->tds, td) { | ||
1336 | dma_pool_free(hwep->td_pool, node->ptr, node->dma); | ||
1337 | list_del(&node->td); | ||
1338 | kfree(node); | ||
1339 | } | ||
1340 | |||
1334 | /* pop request */ | 1341 | /* pop request */ |
1335 | list_del_init(&hwreq->queue); | 1342 | list_del_init(&hwreq->queue); |
1336 | 1343 | ||
diff --git a/drivers/usb/core/hub.c b/drivers/usb/core/hub.c index 879b66e13370..21b99b4b4082 100644 --- a/drivers/usb/core/hub.c +++ b/drivers/usb/core/hub.c | |||
@@ -1526,18 +1526,6 @@ static int hub_configure(struct usb_hub *hub, | |||
1526 | dev_dbg(hub_dev, "%umA bus power budget for each child\n", | 1526 | dev_dbg(hub_dev, "%umA bus power budget for each child\n", |
1527 | hub->mA_per_port); | 1527 | hub->mA_per_port); |
1528 | 1528 | ||
1529 | /* Update the HCD's internal representation of this hub before khubd | ||
1530 | * starts getting port status changes for devices under the hub. | ||
1531 | */ | ||
1532 | if (hcd->driver->update_hub_device) { | ||
1533 | ret = hcd->driver->update_hub_device(hcd, hdev, | ||
1534 | &hub->tt, GFP_KERNEL); | ||
1535 | if (ret < 0) { | ||
1536 | message = "can't update HCD hub info"; | ||
1537 | goto fail; | ||
1538 | } | ||
1539 | } | ||
1540 | |||
1541 | ret = hub_hub_status(hub, &hubstatus, &hubchange); | 1529 | ret = hub_hub_status(hub, &hubstatus, &hubchange); |
1542 | if (ret < 0) { | 1530 | if (ret < 0) { |
1543 | message = "can't get hub status"; | 1531 | message = "can't get hub status"; |
@@ -1589,10 +1577,28 @@ static int hub_configure(struct usb_hub *hub, | |||
1589 | } | 1577 | } |
1590 | } | 1578 | } |
1591 | hdev->maxchild = i; | 1579 | hdev->maxchild = i; |
1580 | for (i = 0; i < hdev->maxchild; i++) { | ||
1581 | struct usb_port *port_dev = hub->ports[i]; | ||
1582 | |||
1583 | pm_runtime_put(&port_dev->dev); | ||
1584 | } | ||
1585 | |||
1592 | mutex_unlock(&usb_port_peer_mutex); | 1586 | mutex_unlock(&usb_port_peer_mutex); |
1593 | if (ret < 0) | 1587 | if (ret < 0) |
1594 | goto fail; | 1588 | goto fail; |
1595 | 1589 | ||
1590 | /* Update the HCD's internal representation of this hub before khubd | ||
1591 | * starts getting port status changes for devices under the hub. | ||
1592 | */ | ||
1593 | if (hcd->driver->update_hub_device) { | ||
1594 | ret = hcd->driver->update_hub_device(hcd, hdev, | ||
1595 | &hub->tt, GFP_KERNEL); | ||
1596 | if (ret < 0) { | ||
1597 | message = "can't update HCD hub info"; | ||
1598 | goto fail; | ||
1599 | } | ||
1600 | } | ||
1601 | |||
1596 | usb_hub_adjust_deviceremovable(hdev, hub->descriptor); | 1602 | usb_hub_adjust_deviceremovable(hdev, hub->descriptor); |
1597 | 1603 | ||
1598 | hub_activate(hub, HUB_INIT); | 1604 | hub_activate(hub, HUB_INIT); |
@@ -3458,7 +3464,8 @@ static int hub_suspend(struct usb_interface *intf, pm_message_t msg) | |||
3458 | struct usb_device *udev = port_dev->child; | 3464 | struct usb_device *udev = port_dev->child; |
3459 | 3465 | ||
3460 | if (udev && udev->can_submit) { | 3466 | if (udev && udev->can_submit) { |
3461 | dev_warn(&port_dev->dev, "not suspended yet\n"); | 3467 | dev_warn(&port_dev->dev, "device %s not suspended yet\n", |
3468 | dev_name(&udev->dev)); | ||
3462 | if (PMSG_IS_AUTO(msg)) | 3469 | if (PMSG_IS_AUTO(msg)) |
3463 | return -EBUSY; | 3470 | return -EBUSY; |
3464 | } | 3471 | } |
diff --git a/drivers/usb/core/hub.h b/drivers/usb/core/hub.h index 0a7cdc0ef0a9..326308e53961 100644 --- a/drivers/usb/core/hub.h +++ b/drivers/usb/core/hub.h | |||
@@ -84,6 +84,7 @@ struct usb_hub { | |||
84 | * @dev: generic device interface | 84 | * @dev: generic device interface |
85 | * @port_owner: port's owner | 85 | * @port_owner: port's owner |
86 | * @peer: related usb2 and usb3 ports (share the same connector) | 86 | * @peer: related usb2 and usb3 ports (share the same connector) |
87 | * @req: default pm qos request for hubs without port power control | ||
87 | * @connect_type: port's connect type | 88 | * @connect_type: port's connect type |
88 | * @location: opaque representation of platform connector location | 89 | * @location: opaque representation of platform connector location |
89 | * @status_lock: synchronize port_event() vs usb_port_{suspend|resume} | 90 | * @status_lock: synchronize port_event() vs usb_port_{suspend|resume} |
@@ -95,6 +96,7 @@ struct usb_port { | |||
95 | struct device dev; | 96 | struct device dev; |
96 | struct usb_dev_state *port_owner; | 97 | struct usb_dev_state *port_owner; |
97 | struct usb_port *peer; | 98 | struct usb_port *peer; |
99 | struct dev_pm_qos_request *req; | ||
98 | enum usb_port_connect_type connect_type; | 100 | enum usb_port_connect_type connect_type; |
99 | usb_port_location_t location; | 101 | usb_port_location_t location; |
100 | struct mutex status_lock; | 102 | struct mutex status_lock; |
diff --git a/drivers/usb/core/port.c b/drivers/usb/core/port.c index 62036faf56c0..fe1b6d0967e3 100644 --- a/drivers/usb/core/port.c +++ b/drivers/usb/core/port.c | |||
@@ -21,6 +21,8 @@ | |||
21 | 21 | ||
22 | #include "hub.h" | 22 | #include "hub.h" |
23 | 23 | ||
24 | static int usb_port_block_power_off; | ||
25 | |||
24 | static const struct attribute_group *port_dev_group[]; | 26 | static const struct attribute_group *port_dev_group[]; |
25 | 27 | ||
26 | static ssize_t connect_type_show(struct device *dev, | 28 | static ssize_t connect_type_show(struct device *dev, |
@@ -66,6 +68,7 @@ static void usb_port_device_release(struct device *dev) | |||
66 | { | 68 | { |
67 | struct usb_port *port_dev = to_usb_port(dev); | 69 | struct usb_port *port_dev = to_usb_port(dev); |
68 | 70 | ||
71 | kfree(port_dev->req); | ||
69 | kfree(port_dev); | 72 | kfree(port_dev); |
70 | } | 73 | } |
71 | 74 | ||
@@ -142,6 +145,9 @@ static int usb_port_runtime_suspend(struct device *dev) | |||
142 | == PM_QOS_FLAGS_ALL) | 145 | == PM_QOS_FLAGS_ALL) |
143 | return -EAGAIN; | 146 | return -EAGAIN; |
144 | 147 | ||
148 | if (usb_port_block_power_off) | ||
149 | return -EBUSY; | ||
150 | |||
145 | usb_autopm_get_interface(intf); | 151 | usb_autopm_get_interface(intf); |
146 | retval = usb_hub_set_port_power(hdev, hub, port1, false); | 152 | retval = usb_hub_set_port_power(hdev, hub, port1, false); |
147 | usb_clear_port_feature(hdev, port1, USB_PORT_FEAT_C_CONNECTION); | 153 | usb_clear_port_feature(hdev, port1, USB_PORT_FEAT_C_CONNECTION); |
@@ -190,11 +196,19 @@ static int link_peers(struct usb_port *left, struct usb_port *right) | |||
190 | if (left->peer || right->peer) { | 196 | if (left->peer || right->peer) { |
191 | struct usb_port *lpeer = left->peer; | 197 | struct usb_port *lpeer = left->peer; |
192 | struct usb_port *rpeer = right->peer; | 198 | struct usb_port *rpeer = right->peer; |
193 | 199 | char *method; | |
194 | WARN(1, "failed to peer %s and %s (%s -> %p) (%s -> %p)\n", | 200 | |
195 | dev_name(&left->dev), dev_name(&right->dev), | 201 | if (left->location && left->location == right->location) |
196 | dev_name(&left->dev), lpeer, | 202 | method = "location"; |
197 | dev_name(&right->dev), rpeer); | 203 | else |
204 | method = "default"; | ||
205 | |||
206 | pr_warn("usb: failed to peer %s and %s by %s (%s:%s) (%s:%s)\n", | ||
207 | dev_name(&left->dev), dev_name(&right->dev), method, | ||
208 | dev_name(&left->dev), | ||
209 | lpeer ? dev_name(&lpeer->dev) : "none", | ||
210 | dev_name(&right->dev), | ||
211 | rpeer ? dev_name(&rpeer->dev) : "none"); | ||
198 | return -EBUSY; | 212 | return -EBUSY; |
199 | } | 213 | } |
200 | 214 | ||
@@ -251,6 +265,7 @@ static void link_peers_report(struct usb_port *left, struct usb_port *right) | |||
251 | dev_warn(&left->dev, "failed to peer to %s (%d)\n", | 265 | dev_warn(&left->dev, "failed to peer to %s (%d)\n", |
252 | dev_name(&right->dev), rc); | 266 | dev_name(&right->dev), rc); |
253 | pr_warn_once("usb: port power management may be unreliable\n"); | 267 | pr_warn_once("usb: port power management may be unreliable\n"); |
268 | usb_port_block_power_off = 1; | ||
254 | } | 269 | } |
255 | } | 270 | } |
256 | 271 | ||
@@ -386,9 +401,13 @@ int usb_hub_create_port_device(struct usb_hub *hub, int port1) | |||
386 | int retval; | 401 | int retval; |
387 | 402 | ||
388 | port_dev = kzalloc(sizeof(*port_dev), GFP_KERNEL); | 403 | port_dev = kzalloc(sizeof(*port_dev), GFP_KERNEL); |
389 | if (!port_dev) { | 404 | if (!port_dev) |
390 | retval = -ENOMEM; | 405 | return -ENOMEM; |
391 | goto exit; | 406 | |
407 | port_dev->req = kzalloc(sizeof(*(port_dev->req)), GFP_KERNEL); | ||
408 | if (!port_dev->req) { | ||
409 | kfree(port_dev); | ||
410 | return -ENOMEM; | ||
392 | } | 411 | } |
393 | 412 | ||
394 | hub->ports[port1 - 1] = port_dev; | 413 | hub->ports[port1 - 1] = port_dev; |
@@ -404,31 +423,53 @@ int usb_hub_create_port_device(struct usb_hub *hub, int port1) | |||
404 | port1); | 423 | port1); |
405 | mutex_init(&port_dev->status_lock); | 424 | mutex_init(&port_dev->status_lock); |
406 | retval = device_register(&port_dev->dev); | 425 | retval = device_register(&port_dev->dev); |
407 | if (retval) | 426 | if (retval) { |
408 | goto error_register; | 427 | put_device(&port_dev->dev); |
428 | return retval; | ||
429 | } | ||
430 | |||
431 | /* Set default policy of port-poweroff disabled. */ | ||
432 | retval = dev_pm_qos_add_request(&port_dev->dev, port_dev->req, | ||
433 | DEV_PM_QOS_FLAGS, PM_QOS_FLAG_NO_POWER_OFF); | ||
434 | if (retval < 0) { | ||
435 | device_unregister(&port_dev->dev); | ||
436 | return retval; | ||
437 | } | ||
409 | 438 | ||
410 | find_and_link_peer(hub, port1); | 439 | find_and_link_peer(hub, port1); |
411 | 440 | ||
441 | /* | ||
442 | * Enable runtime pm and hold a refernce that hub_configure() | ||
443 | * will drop once the PM_QOS_NO_POWER_OFF flag state has been set | ||
444 | * and the hub has been fully registered (hdev->maxchild set). | ||
445 | */ | ||
412 | pm_runtime_set_active(&port_dev->dev); | 446 | pm_runtime_set_active(&port_dev->dev); |
447 | pm_runtime_get_noresume(&port_dev->dev); | ||
448 | pm_runtime_enable(&port_dev->dev); | ||
449 | device_enable_async_suspend(&port_dev->dev); | ||
413 | 450 | ||
414 | /* | 451 | /* |
415 | * Do not enable port runtime pm if the hub does not support | 452 | * Keep hidden the ability to enable port-poweroff if the hub |
416 | * power switching. Also, userspace must have final say of | 453 | * does not support power switching. |
417 | * whether a port is permitted to power-off. Do not enable | ||
418 | * runtime pm if we fail to expose pm_qos_no_power_off. | ||
419 | */ | 454 | */ |
420 | if (hub_is_port_power_switchable(hub) | 455 | if (!hub_is_port_power_switchable(hub)) |
421 | && dev_pm_qos_expose_flags(&port_dev->dev, | 456 | return 0; |
422 | PM_QOS_FLAG_NO_POWER_OFF) == 0) | ||
423 | pm_runtime_enable(&port_dev->dev); | ||
424 | 457 | ||
425 | device_enable_async_suspend(&port_dev->dev); | 458 | /* Attempt to let userspace take over the policy. */ |
426 | return 0; | 459 | retval = dev_pm_qos_expose_flags(&port_dev->dev, |
460 | PM_QOS_FLAG_NO_POWER_OFF); | ||
461 | if (retval < 0) { | ||
462 | dev_warn(&port_dev->dev, "failed to expose pm_qos_no_poweroff\n"); | ||
463 | return 0; | ||
464 | } | ||
427 | 465 | ||
428 | error_register: | 466 | /* Userspace owns the policy, drop the kernel 'no_poweroff' request. */ |
429 | put_device(&port_dev->dev); | 467 | retval = dev_pm_qos_remove_request(port_dev->req); |
430 | exit: | 468 | if (retval >= 0) { |
431 | return retval; | 469 | kfree(port_dev->req); |
470 | port_dev->req = NULL; | ||
471 | } | ||
472 | return 0; | ||
432 | } | 473 | } |
433 | 474 | ||
434 | void usb_hub_remove_port_device(struct usb_hub *hub, int port1) | 475 | void usb_hub_remove_port_device(struct usb_hub *hub, int port1) |
diff --git a/drivers/usb/dwc3/Kconfig b/drivers/usb/dwc3/Kconfig index 8eb996e4f058..261c3b428220 100644 --- a/drivers/usb/dwc3/Kconfig +++ b/drivers/usb/dwc3/Kconfig | |||
@@ -45,6 +45,7 @@ comment "Platform Glue Driver Support" | |||
45 | config USB_DWC3_OMAP | 45 | config USB_DWC3_OMAP |
46 | tristate "Texas Instruments OMAP5 and similar Platforms" | 46 | tristate "Texas Instruments OMAP5 and similar Platforms" |
47 | depends on EXTCON && (ARCH_OMAP2PLUS || COMPILE_TEST) | 47 | depends on EXTCON && (ARCH_OMAP2PLUS || COMPILE_TEST) |
48 | depends on OF | ||
48 | default USB_DWC3 | 49 | default USB_DWC3 |
49 | help | 50 | help |
50 | Some platforms from Texas Instruments like OMAP5, DRA7xxx and | 51 | Some platforms from Texas Instruments like OMAP5, DRA7xxx and |
diff --git a/drivers/usb/dwc3/dwc3-omap.c b/drivers/usb/dwc3/dwc3-omap.c index 4af4c3567656..07a736acd0f2 100644 --- a/drivers/usb/dwc3/dwc3-omap.c +++ b/drivers/usb/dwc3/dwc3-omap.c | |||
@@ -322,7 +322,7 @@ static int dwc3_omap_remove_core(struct device *dev, void *c) | |||
322 | { | 322 | { |
323 | struct platform_device *pdev = to_platform_device(dev); | 323 | struct platform_device *pdev = to_platform_device(dev); |
324 | 324 | ||
325 | platform_device_unregister(pdev); | 325 | of_device_unregister(pdev); |
326 | 326 | ||
327 | return 0; | 327 | return 0; |
328 | } | 328 | } |
@@ -599,7 +599,7 @@ static int dwc3_omap_prepare(struct device *dev) | |||
599 | { | 599 | { |
600 | struct dwc3_omap *omap = dev_get_drvdata(dev); | 600 | struct dwc3_omap *omap = dev_get_drvdata(dev); |
601 | 601 | ||
602 | dwc3_omap_disable_irqs(omap); | 602 | dwc3_omap_write_irqmisc_set(omap, 0x00); |
603 | 603 | ||
604 | return 0; | 604 | return 0; |
605 | } | 605 | } |
@@ -607,8 +607,19 @@ static int dwc3_omap_prepare(struct device *dev) | |||
607 | static void dwc3_omap_complete(struct device *dev) | 607 | static void dwc3_omap_complete(struct device *dev) |
608 | { | 608 | { |
609 | struct dwc3_omap *omap = dev_get_drvdata(dev); | 609 | struct dwc3_omap *omap = dev_get_drvdata(dev); |
610 | u32 reg; | ||
610 | 611 | ||
611 | dwc3_omap_enable_irqs(omap); | 612 | reg = (USBOTGSS_IRQMISC_OEVT | |
613 | USBOTGSS_IRQMISC_DRVVBUS_RISE | | ||
614 | USBOTGSS_IRQMISC_CHRGVBUS_RISE | | ||
615 | USBOTGSS_IRQMISC_DISCHRGVBUS_RISE | | ||
616 | USBOTGSS_IRQMISC_IDPULLUP_RISE | | ||
617 | USBOTGSS_IRQMISC_DRVVBUS_FALL | | ||
618 | USBOTGSS_IRQMISC_CHRGVBUS_FALL | | ||
619 | USBOTGSS_IRQMISC_DISCHRGVBUS_FALL | | ||
620 | USBOTGSS_IRQMISC_IDPULLUP_FALL); | ||
621 | |||
622 | dwc3_omap_write_irqmisc_set(omap, reg); | ||
612 | } | 623 | } |
613 | 624 | ||
614 | static int dwc3_omap_suspend(struct device *dev) | 625 | static int dwc3_omap_suspend(struct device *dev) |
diff --git a/drivers/usb/dwc3/gadget.c b/drivers/usb/dwc3/gadget.c index 9d64dd02c57e..dab7927d1009 100644 --- a/drivers/usb/dwc3/gadget.c +++ b/drivers/usb/dwc3/gadget.c | |||
@@ -828,10 +828,6 @@ static void dwc3_prepare_one_trb(struct dwc3_ep *dep, | |||
828 | length, last ? " last" : "", | 828 | length, last ? " last" : "", |
829 | chain ? " chain" : ""); | 829 | chain ? " chain" : ""); |
830 | 830 | ||
831 | /* Skip the LINK-TRB on ISOC */ | ||
832 | if (((dep->free_slot & DWC3_TRB_MASK) == DWC3_TRB_NUM - 1) && | ||
833 | usb_endpoint_xfer_isoc(dep->endpoint.desc)) | ||
834 | dep->free_slot++; | ||
835 | 831 | ||
836 | trb = &dep->trb_pool[dep->free_slot & DWC3_TRB_MASK]; | 832 | trb = &dep->trb_pool[dep->free_slot & DWC3_TRB_MASK]; |
837 | 833 | ||
@@ -843,6 +839,10 @@ static void dwc3_prepare_one_trb(struct dwc3_ep *dep, | |||
843 | } | 839 | } |
844 | 840 | ||
845 | dep->free_slot++; | 841 | dep->free_slot++; |
842 | /* Skip the LINK-TRB on ISOC */ | ||
843 | if (((dep->free_slot & DWC3_TRB_MASK) == DWC3_TRB_NUM - 1) && | ||
844 | usb_endpoint_xfer_isoc(dep->endpoint.desc)) | ||
845 | dep->free_slot++; | ||
846 | 846 | ||
847 | trb->size = DWC3_TRB_SIZE_LENGTH(length); | 847 | trb->size = DWC3_TRB_SIZE_LENGTH(length); |
848 | trb->bpl = lower_32_bits(dma); | 848 | trb->bpl = lower_32_bits(dma); |
diff --git a/drivers/usb/gadget/configfs.c b/drivers/usb/gadget/configfs.c index 2ddcd635ca2a..97142146eead 100644 --- a/drivers/usb/gadget/configfs.c +++ b/drivers/usb/gadget/configfs.c | |||
@@ -1145,15 +1145,15 @@ static struct configfs_item_operations interf_item_ops = { | |||
1145 | .store_attribute = usb_os_desc_attr_store, | 1145 | .store_attribute = usb_os_desc_attr_store, |
1146 | }; | 1146 | }; |
1147 | 1147 | ||
1148 | static ssize_t rndis_grp_compatible_id_show(struct usb_os_desc *desc, | 1148 | static ssize_t interf_grp_compatible_id_show(struct usb_os_desc *desc, |
1149 | char *page) | 1149 | char *page) |
1150 | { | 1150 | { |
1151 | memcpy(page, desc->ext_compat_id, 8); | 1151 | memcpy(page, desc->ext_compat_id, 8); |
1152 | return 8; | 1152 | return 8; |
1153 | } | 1153 | } |
1154 | 1154 | ||
1155 | static ssize_t rndis_grp_compatible_id_store(struct usb_os_desc *desc, | 1155 | static ssize_t interf_grp_compatible_id_store(struct usb_os_desc *desc, |
1156 | const char *page, size_t len) | 1156 | const char *page, size_t len) |
1157 | { | 1157 | { |
1158 | int l; | 1158 | int l; |
1159 | 1159 | ||
@@ -1171,20 +1171,20 @@ static ssize_t rndis_grp_compatible_id_store(struct usb_os_desc *desc, | |||
1171 | return len; | 1171 | return len; |
1172 | } | 1172 | } |
1173 | 1173 | ||
1174 | static struct usb_os_desc_attribute rndis_grp_attr_compatible_id = | 1174 | static struct usb_os_desc_attribute interf_grp_attr_compatible_id = |
1175 | __CONFIGFS_ATTR(compatible_id, S_IRUGO | S_IWUSR, | 1175 | __CONFIGFS_ATTR(compatible_id, S_IRUGO | S_IWUSR, |
1176 | rndis_grp_compatible_id_show, | 1176 | interf_grp_compatible_id_show, |
1177 | rndis_grp_compatible_id_store); | 1177 | interf_grp_compatible_id_store); |
1178 | 1178 | ||
1179 | static ssize_t rndis_grp_sub_compatible_id_show(struct usb_os_desc *desc, | 1179 | static ssize_t interf_grp_sub_compatible_id_show(struct usb_os_desc *desc, |
1180 | char *page) | 1180 | char *page) |
1181 | { | 1181 | { |
1182 | memcpy(page, desc->ext_compat_id + 8, 8); | 1182 | memcpy(page, desc->ext_compat_id + 8, 8); |
1183 | return 8; | 1183 | return 8; |
1184 | } | 1184 | } |
1185 | 1185 | ||
1186 | static ssize_t rndis_grp_sub_compatible_id_store(struct usb_os_desc *desc, | 1186 | static ssize_t interf_grp_sub_compatible_id_store(struct usb_os_desc *desc, |
1187 | const char *page, size_t len) | 1187 | const char *page, size_t len) |
1188 | { | 1188 | { |
1189 | int l; | 1189 | int l; |
1190 | 1190 | ||
@@ -1202,20 +1202,21 @@ static ssize_t rndis_grp_sub_compatible_id_store(struct usb_os_desc *desc, | |||
1202 | return len; | 1202 | return len; |
1203 | } | 1203 | } |
1204 | 1204 | ||
1205 | static struct usb_os_desc_attribute rndis_grp_attr_sub_compatible_id = | 1205 | static struct usb_os_desc_attribute interf_grp_attr_sub_compatible_id = |
1206 | __CONFIGFS_ATTR(sub_compatible_id, S_IRUGO | S_IWUSR, | 1206 | __CONFIGFS_ATTR(sub_compatible_id, S_IRUGO | S_IWUSR, |
1207 | rndis_grp_sub_compatible_id_show, | 1207 | interf_grp_sub_compatible_id_show, |
1208 | rndis_grp_sub_compatible_id_store); | 1208 | interf_grp_sub_compatible_id_store); |
1209 | 1209 | ||
1210 | static struct configfs_attribute *interf_grp_attrs[] = { | 1210 | static struct configfs_attribute *interf_grp_attrs[] = { |
1211 | &rndis_grp_attr_compatible_id.attr, | 1211 | &interf_grp_attr_compatible_id.attr, |
1212 | &rndis_grp_attr_sub_compatible_id.attr, | 1212 | &interf_grp_attr_sub_compatible_id.attr, |
1213 | NULL | 1213 | NULL |
1214 | }; | 1214 | }; |
1215 | 1215 | ||
1216 | int usb_os_desc_prepare_interf_dir(struct config_group *parent, | 1216 | int usb_os_desc_prepare_interf_dir(struct config_group *parent, |
1217 | int n_interf, | 1217 | int n_interf, |
1218 | struct usb_os_desc **desc, | 1218 | struct usb_os_desc **desc, |
1219 | char **names, | ||
1219 | struct module *owner) | 1220 | struct module *owner) |
1220 | { | 1221 | { |
1221 | struct config_group **f_default_groups, *os_desc_group, | 1222 | struct config_group **f_default_groups, *os_desc_group, |
@@ -1257,8 +1258,8 @@ int usb_os_desc_prepare_interf_dir(struct config_group *parent, | |||
1257 | d = desc[n_interf]; | 1258 | d = desc[n_interf]; |
1258 | d->owner = owner; | 1259 | d->owner = owner; |
1259 | config_group_init_type_name(&d->group, "", interface_type); | 1260 | config_group_init_type_name(&d->group, "", interface_type); |
1260 | config_item_set_name(&d->group.cg_item, "interface.%d", | 1261 | config_item_set_name(&d->group.cg_item, "interface.%s", |
1261 | n_interf); | 1262 | names[n_interf]); |
1262 | interface_groups[n_interf] = &d->group; | 1263 | interface_groups[n_interf] = &d->group; |
1263 | } | 1264 | } |
1264 | 1265 | ||
diff --git a/drivers/usb/gadget/configfs.h b/drivers/usb/gadget/configfs.h index a14ac792c698..36c468c4f5e9 100644 --- a/drivers/usb/gadget/configfs.h +++ b/drivers/usb/gadget/configfs.h | |||
@@ -8,6 +8,7 @@ void unregister_gadget_item(struct config_item *item); | |||
8 | int usb_os_desc_prepare_interf_dir(struct config_group *parent, | 8 | int usb_os_desc_prepare_interf_dir(struct config_group *parent, |
9 | int n_interf, | 9 | int n_interf, |
10 | struct usb_os_desc **desc, | 10 | struct usb_os_desc **desc, |
11 | char **names, | ||
11 | struct module *owner); | 12 | struct module *owner); |
12 | 13 | ||
13 | static inline struct usb_os_desc *to_usb_os_desc(struct config_item *item) | 14 | static inline struct usb_os_desc *to_usb_os_desc(struct config_item *item) |
diff --git a/drivers/usb/gadget/f_fs.c b/drivers/usb/gadget/f_fs.c index 74202d67f911..8598c27c7d43 100644 --- a/drivers/usb/gadget/f_fs.c +++ b/drivers/usb/gadget/f_fs.c | |||
@@ -1483,11 +1483,13 @@ static int functionfs_bind(struct ffs_data *ffs, struct usb_composite_dev *cdev) | |||
1483 | ffs->ep0req->context = ffs; | 1483 | ffs->ep0req->context = ffs; |
1484 | 1484 | ||
1485 | lang = ffs->stringtabs; | 1485 | lang = ffs->stringtabs; |
1486 | for (lang = ffs->stringtabs; *lang; ++lang) { | 1486 | if (lang) { |
1487 | struct usb_string *str = (*lang)->strings; | 1487 | for (; *lang; ++lang) { |
1488 | int id = first_id; | 1488 | struct usb_string *str = (*lang)->strings; |
1489 | for (; str->s; ++id, ++str) | 1489 | int id = first_id; |
1490 | str->id = id; | 1490 | for (; str->s; ++id, ++str) |
1491 | str->id = id; | ||
1492 | } | ||
1491 | } | 1493 | } |
1492 | 1494 | ||
1493 | ffs->gadget = cdev->gadget; | 1495 | ffs->gadget = cdev->gadget; |
diff --git a/drivers/usb/gadget/f_rndis.c b/drivers/usb/gadget/f_rndis.c index eed3ad878047..9c41e9515b8e 100644 --- a/drivers/usb/gadget/f_rndis.c +++ b/drivers/usb/gadget/f_rndis.c | |||
@@ -687,7 +687,7 @@ rndis_bind(struct usb_configuration *c, struct usb_function *f) | |||
687 | f->os_desc_table = kzalloc(sizeof(*f->os_desc_table), | 687 | f->os_desc_table = kzalloc(sizeof(*f->os_desc_table), |
688 | GFP_KERNEL); | 688 | GFP_KERNEL); |
689 | if (!f->os_desc_table) | 689 | if (!f->os_desc_table) |
690 | return PTR_ERR(f->os_desc_table); | 690 | return -ENOMEM; |
691 | f->os_desc_n = 1; | 691 | f->os_desc_n = 1; |
692 | f->os_desc_table[0].os_desc = &rndis_opts->rndis_os_desc; | 692 | f->os_desc_table[0].os_desc = &rndis_opts->rndis_os_desc; |
693 | } | 693 | } |
@@ -905,6 +905,7 @@ static struct usb_function_instance *rndis_alloc_inst(void) | |||
905 | { | 905 | { |
906 | struct f_rndis_opts *opts; | 906 | struct f_rndis_opts *opts; |
907 | struct usb_os_desc *descs[1]; | 907 | struct usb_os_desc *descs[1]; |
908 | char *names[1]; | ||
908 | 909 | ||
909 | opts = kzalloc(sizeof(*opts), GFP_KERNEL); | 910 | opts = kzalloc(sizeof(*opts), GFP_KERNEL); |
910 | if (!opts) | 911 | if (!opts) |
@@ -922,8 +923,9 @@ static struct usb_function_instance *rndis_alloc_inst(void) | |||
922 | INIT_LIST_HEAD(&opts->rndis_os_desc.ext_prop); | 923 | INIT_LIST_HEAD(&opts->rndis_os_desc.ext_prop); |
923 | 924 | ||
924 | descs[0] = &opts->rndis_os_desc; | 925 | descs[0] = &opts->rndis_os_desc; |
926 | names[0] = "rndis"; | ||
925 | usb_os_desc_prepare_interf_dir(&opts->func_inst.group, 1, descs, | 927 | usb_os_desc_prepare_interf_dir(&opts->func_inst.group, 1, descs, |
926 | THIS_MODULE); | 928 | names, THIS_MODULE); |
927 | config_group_init_type_name(&opts->func_inst.group, "", | 929 | config_group_init_type_name(&opts->func_inst.group, "", |
928 | &rndis_func_type); | 930 | &rndis_func_type); |
929 | 931 | ||
diff --git a/drivers/usb/gadget/gr_udc.c b/drivers/usb/gadget/gr_udc.c index 99a37ed03e27..c7004ee89c90 100644 --- a/drivers/usb/gadget/gr_udc.c +++ b/drivers/usb/gadget/gr_udc.c | |||
@@ -1532,8 +1532,9 @@ static int gr_ep_enable(struct usb_ep *_ep, | |||
1532 | "%s mode: multiple trans./microframe not valid\n", | 1532 | "%s mode: multiple trans./microframe not valid\n", |
1533 | (mode == 2 ? "Bulk" : "Control")); | 1533 | (mode == 2 ? "Bulk" : "Control")); |
1534 | return -EINVAL; | 1534 | return -EINVAL; |
1535 | } else if (nt == 0x11) { | 1535 | } else if (nt == 0x3) { |
1536 | dev_err(dev->dev, "Invalid value for trans./microframe\n"); | 1536 | dev_err(dev->dev, |
1537 | "Invalid value 0x3 for additional trans./microframe\n"); | ||
1537 | return -EINVAL; | 1538 | return -EINVAL; |
1538 | } else if ((nt + 1) * max > buffer_size) { | 1539 | } else if ((nt + 1) * max > buffer_size) { |
1539 | dev_err(dev->dev, "Hw buffer size %d < max payload %d * %d\n", | 1540 | dev_err(dev->dev, "Hw buffer size %d < max payload %d * %d\n", |
diff --git a/drivers/usb/gadget/inode.c b/drivers/usb/gadget/inode.c index ee6c16416c30..2e4ce7704908 100644 --- a/drivers/usb/gadget/inode.c +++ b/drivers/usb/gadget/inode.c | |||
@@ -1264,8 +1264,13 @@ dev_release (struct inode *inode, struct file *fd) | |||
1264 | 1264 | ||
1265 | kfree (dev->buf); | 1265 | kfree (dev->buf); |
1266 | dev->buf = NULL; | 1266 | dev->buf = NULL; |
1267 | put_dev (dev); | ||
1268 | 1267 | ||
1268 | /* other endpoints were all decoupled from this device */ | ||
1269 | spin_lock_irq(&dev->lock); | ||
1270 | dev->state = STATE_DEV_DISABLED; | ||
1271 | spin_unlock_irq(&dev->lock); | ||
1272 | |||
1273 | put_dev (dev); | ||
1269 | return 0; | 1274 | return 0; |
1270 | } | 1275 | } |
1271 | 1276 | ||
diff --git a/drivers/usb/gadget/u_ether.c b/drivers/usb/gadget/u_ether.c index 3d78a8844e43..97b027724ee7 100644 --- a/drivers/usb/gadget/u_ether.c +++ b/drivers/usb/gadget/u_ether.c | |||
@@ -1120,7 +1120,10 @@ void gether_disconnect(struct gether *link) | |||
1120 | 1120 | ||
1121 | DBG(dev, "%s\n", __func__); | 1121 | DBG(dev, "%s\n", __func__); |
1122 | 1122 | ||
1123 | netif_tx_lock(dev->net); | ||
1123 | netif_stop_queue(dev->net); | 1124 | netif_stop_queue(dev->net); |
1125 | netif_tx_unlock(dev->net); | ||
1126 | |||
1124 | netif_carrier_off(dev->net); | 1127 | netif_carrier_off(dev->net); |
1125 | 1128 | ||
1126 | /* disable endpoints, forcing (synchronous) completion | 1129 | /* disable endpoints, forcing (synchronous) completion |
diff --git a/drivers/usb/host/Kconfig b/drivers/usb/host/Kconfig index 61b7817bd66b..03314f861bee 100644 --- a/drivers/usb/host/Kconfig +++ b/drivers/usb/host/Kconfig | |||
@@ -176,7 +176,7 @@ config USB_EHCI_HCD_AT91 | |||
176 | 176 | ||
177 | config USB_EHCI_MSM | 177 | config USB_EHCI_MSM |
178 | tristate "Support for Qualcomm QSD/MSM on-chip EHCI USB controller" | 178 | tristate "Support for Qualcomm QSD/MSM on-chip EHCI USB controller" |
179 | depends on ARCH_MSM | 179 | depends on ARCH_MSM || ARCH_QCOM |
180 | select USB_EHCI_ROOT_HUB_TT | 180 | select USB_EHCI_ROOT_HUB_TT |
181 | ---help--- | 181 | ---help--- |
182 | Enables support for the USB Host controller present on the | 182 | Enables support for the USB Host controller present on the |
diff --git a/drivers/usb/host/pci-quirks.c b/drivers/usb/host/pci-quirks.c index 4a6d3dd68572..2f3acebb577a 100644 --- a/drivers/usb/host/pci-quirks.c +++ b/drivers/usb/host/pci-quirks.c | |||
@@ -656,6 +656,14 @@ static const struct dmi_system_id ehci_dmi_nohandoff_table[] = { | |||
656 | DMI_MATCH(DMI_BIOS_VERSION, "Lucid-"), | 656 | DMI_MATCH(DMI_BIOS_VERSION, "Lucid-"), |
657 | }, | 657 | }, |
658 | }, | 658 | }, |
659 | { | ||
660 | /* HASEE E200 */ | ||
661 | .matches = { | ||
662 | DMI_MATCH(DMI_BOARD_VENDOR, "HASEE"), | ||
663 | DMI_MATCH(DMI_BOARD_NAME, "E210"), | ||
664 | DMI_MATCH(DMI_BIOS_VERSION, "6.00"), | ||
665 | }, | ||
666 | }, | ||
659 | { } | 667 | { } |
660 | }; | 668 | }; |
661 | 669 | ||
@@ -665,9 +673,14 @@ static void ehci_bios_handoff(struct pci_dev *pdev, | |||
665 | { | 673 | { |
666 | int try_handoff = 1, tried_handoff = 0; | 674 | int try_handoff = 1, tried_handoff = 0; |
667 | 675 | ||
668 | /* The Pegatron Lucid tablet sporadically waits for 98 seconds trying | 676 | /* |
669 | * the handoff on its unused controller. Skip it. */ | 677 | * The Pegatron Lucid tablet sporadically waits for 98 seconds trying |
670 | if (pdev->vendor == 0x8086 && pdev->device == 0x283a) { | 678 | * the handoff on its unused controller. Skip it. |
679 | * | ||
680 | * The HASEE E200 hangs when the semaphore is set (bugzilla #77021). | ||
681 | */ | ||
682 | if (pdev->vendor == 0x8086 && (pdev->device == 0x283a || | ||
683 | pdev->device == 0x27cc)) { | ||
671 | if (dmi_check_system(ehci_dmi_nohandoff_table)) | 684 | if (dmi_check_system(ehci_dmi_nohandoff_table)) |
672 | try_handoff = 0; | 685 | try_handoff = 0; |
673 | } | 686 | } |
diff --git a/drivers/usb/host/xhci-hub.c b/drivers/usb/host/xhci-hub.c index 6231ce6aa0c3..aa79e8749040 100644 --- a/drivers/usb/host/xhci-hub.c +++ b/drivers/usb/host/xhci-hub.c | |||
@@ -22,6 +22,7 @@ | |||
22 | 22 | ||
23 | 23 | ||
24 | #include <linux/slab.h> | 24 | #include <linux/slab.h> |
25 | #include <linux/device.h> | ||
25 | #include <asm/unaligned.h> | 26 | #include <asm/unaligned.h> |
26 | 27 | ||
27 | #include "xhci.h" | 28 | #include "xhci.h" |
@@ -287,7 +288,7 @@ static int xhci_stop_device(struct xhci_hcd *xhci, int slot_id, int suspend) | |||
287 | if (virt_dev->eps[i].ring && virt_dev->eps[i].ring->dequeue) { | 288 | if (virt_dev->eps[i].ring && virt_dev->eps[i].ring->dequeue) { |
288 | struct xhci_command *command; | 289 | struct xhci_command *command; |
289 | command = xhci_alloc_command(xhci, false, false, | 290 | command = xhci_alloc_command(xhci, false, false, |
290 | GFP_NOIO); | 291 | GFP_NOWAIT); |
291 | if (!command) { | 292 | if (!command) { |
292 | spin_unlock_irqrestore(&xhci->lock, flags); | 293 | spin_unlock_irqrestore(&xhci->lock, flags); |
293 | xhci_free_command(xhci, cmd); | 294 | xhci_free_command(xhci, cmd); |
@@ -1139,7 +1140,9 @@ int xhci_bus_suspend(struct usb_hcd *hcd) | |||
1139 | * including the USB 3.0 roothub, but only if CONFIG_PM_RUNTIME | 1140 | * including the USB 3.0 roothub, but only if CONFIG_PM_RUNTIME |
1140 | * is enabled, so also enable remote wake here. | 1141 | * is enabled, so also enable remote wake here. |
1141 | */ | 1142 | */ |
1142 | if (hcd->self.root_hub->do_remote_wakeup) { | 1143 | if (hcd->self.root_hub->do_remote_wakeup |
1144 | && device_may_wakeup(hcd->self.controller)) { | ||
1145 | |||
1143 | if (t1 & PORT_CONNECT) { | 1146 | if (t1 & PORT_CONNECT) { |
1144 | t2 |= PORT_WKOC_E | PORT_WKDISC_E; | 1147 | t2 |= PORT_WKOC_E | PORT_WKDISC_E; |
1145 | t2 &= ~PORT_WKCONN_E; | 1148 | t2 &= ~PORT_WKCONN_E; |
diff --git a/drivers/usb/host/xhci-ring.c b/drivers/usb/host/xhci-ring.c index d67ff71209f5..749fc68eb5c1 100644 --- a/drivers/usb/host/xhci-ring.c +++ b/drivers/usb/host/xhci-ring.c | |||
@@ -1433,8 +1433,11 @@ static void handle_cmd_completion(struct xhci_hcd *xhci, | |||
1433 | xhci_handle_cmd_reset_ep(xhci, slot_id, cmd_trb, cmd_comp_code); | 1433 | xhci_handle_cmd_reset_ep(xhci, slot_id, cmd_trb, cmd_comp_code); |
1434 | break; | 1434 | break; |
1435 | case TRB_RESET_DEV: | 1435 | case TRB_RESET_DEV: |
1436 | WARN_ON(slot_id != TRB_TO_SLOT_ID( | 1436 | /* SLOT_ID field in reset device cmd completion event TRB is 0. |
1437 | le32_to_cpu(cmd_trb->generic.field[3]))); | 1437 | * Use the SLOT_ID from the command TRB instead (xhci 4.6.11) |
1438 | */ | ||
1439 | slot_id = TRB_TO_SLOT_ID( | ||
1440 | le32_to_cpu(cmd_trb->generic.field[3])); | ||
1438 | xhci_handle_cmd_reset_dev(xhci, slot_id, event); | 1441 | xhci_handle_cmd_reset_dev(xhci, slot_id, event); |
1439 | break; | 1442 | break; |
1440 | case TRB_NEC_GET_FW: | 1443 | case TRB_NEC_GET_FW: |
@@ -3534,7 +3537,7 @@ static unsigned int xhci_get_burst_count(struct xhci_hcd *xhci, | |||
3534 | return 0; | 3537 | return 0; |
3535 | 3538 | ||
3536 | max_burst = urb->ep->ss_ep_comp.bMaxBurst; | 3539 | max_burst = urb->ep->ss_ep_comp.bMaxBurst; |
3537 | return roundup(total_packet_count, max_burst + 1) - 1; | 3540 | return DIV_ROUND_UP(total_packet_count, max_burst + 1) - 1; |
3538 | } | 3541 | } |
3539 | 3542 | ||
3540 | /* | 3543 | /* |
diff --git a/drivers/usb/host/xhci.c b/drivers/usb/host/xhci.c index 2b8d9a24af09..7436d5f5e67a 100644 --- a/drivers/usb/host/xhci.c +++ b/drivers/usb/host/xhci.c | |||
@@ -936,7 +936,7 @@ int xhci_suspend(struct xhci_hcd *xhci) | |||
936 | */ | 936 | */ |
937 | int xhci_resume(struct xhci_hcd *xhci, bool hibernated) | 937 | int xhci_resume(struct xhci_hcd *xhci, bool hibernated) |
938 | { | 938 | { |
939 | u32 command, temp = 0; | 939 | u32 command, temp = 0, status; |
940 | struct usb_hcd *hcd = xhci_to_hcd(xhci); | 940 | struct usb_hcd *hcd = xhci_to_hcd(xhci); |
941 | struct usb_hcd *secondary_hcd; | 941 | struct usb_hcd *secondary_hcd; |
942 | int retval = 0; | 942 | int retval = 0; |
@@ -1054,8 +1054,12 @@ int xhci_resume(struct xhci_hcd *xhci, bool hibernated) | |||
1054 | 1054 | ||
1055 | done: | 1055 | done: |
1056 | if (retval == 0) { | 1056 | if (retval == 0) { |
1057 | usb_hcd_resume_root_hub(hcd); | 1057 | /* Resume root hubs only when have pending events. */ |
1058 | usb_hcd_resume_root_hub(xhci->shared_hcd); | 1058 | status = readl(&xhci->op_regs->status); |
1059 | if (status & STS_EINT) { | ||
1060 | usb_hcd_resume_root_hub(hcd); | ||
1061 | usb_hcd_resume_root_hub(xhci->shared_hcd); | ||
1062 | } | ||
1059 | } | 1063 | } |
1060 | 1064 | ||
1061 | /* | 1065 | /* |
diff --git a/drivers/usb/misc/usbtest.c b/drivers/usb/misc/usbtest.c index 51a6da256772..829f446064ea 100644 --- a/drivers/usb/misc/usbtest.c +++ b/drivers/usb/misc/usbtest.c | |||
@@ -7,7 +7,7 @@ | |||
7 | #include <linux/moduleparam.h> | 7 | #include <linux/moduleparam.h> |
8 | #include <linux/scatterlist.h> | 8 | #include <linux/scatterlist.h> |
9 | #include <linux/mutex.h> | 9 | #include <linux/mutex.h> |
10 | 10 | #include <linux/timer.h> | |
11 | #include <linux/usb.h> | 11 | #include <linux/usb.h> |
12 | 12 | ||
13 | #define SIMPLE_IO_TIMEOUT 10000 /* in milliseconds */ | 13 | #define SIMPLE_IO_TIMEOUT 10000 /* in milliseconds */ |
@@ -484,6 +484,14 @@ alloc_sglist(int nents, int max, int vary) | |||
484 | return sg; | 484 | return sg; |
485 | } | 485 | } |
486 | 486 | ||
487 | static void sg_timeout(unsigned long _req) | ||
488 | { | ||
489 | struct usb_sg_request *req = (struct usb_sg_request *) _req; | ||
490 | |||
491 | req->status = -ETIMEDOUT; | ||
492 | usb_sg_cancel(req); | ||
493 | } | ||
494 | |||
487 | static int perform_sglist( | 495 | static int perform_sglist( |
488 | struct usbtest_dev *tdev, | 496 | struct usbtest_dev *tdev, |
489 | unsigned iterations, | 497 | unsigned iterations, |
@@ -495,6 +503,9 @@ static int perform_sglist( | |||
495 | { | 503 | { |
496 | struct usb_device *udev = testdev_to_usbdev(tdev); | 504 | struct usb_device *udev = testdev_to_usbdev(tdev); |
497 | int retval = 0; | 505 | int retval = 0; |
506 | struct timer_list sg_timer; | ||
507 | |||
508 | setup_timer_on_stack(&sg_timer, sg_timeout, (unsigned long) req); | ||
498 | 509 | ||
499 | while (retval == 0 && iterations-- > 0) { | 510 | while (retval == 0 && iterations-- > 0) { |
500 | retval = usb_sg_init(req, udev, pipe, | 511 | retval = usb_sg_init(req, udev, pipe, |
@@ -505,7 +516,10 @@ static int perform_sglist( | |||
505 | 516 | ||
506 | if (retval) | 517 | if (retval) |
507 | break; | 518 | break; |
519 | mod_timer(&sg_timer, jiffies + | ||
520 | msecs_to_jiffies(SIMPLE_IO_TIMEOUT)); | ||
508 | usb_sg_wait(req); | 521 | usb_sg_wait(req); |
522 | del_timer_sync(&sg_timer); | ||
509 | retval = req->status; | 523 | retval = req->status; |
510 | 524 | ||
511 | /* FIXME check resulting data pattern */ | 525 | /* FIXME check resulting data pattern */ |
diff --git a/drivers/usb/musb/musb_am335x.c b/drivers/usb/musb/musb_am335x.c index d2353781bd2d..1e58ed2361cc 100644 --- a/drivers/usb/musb/musb_am335x.c +++ b/drivers/usb/musb/musb_am335x.c | |||
@@ -19,21 +19,6 @@ err: | |||
19 | return ret; | 19 | return ret; |
20 | } | 20 | } |
21 | 21 | ||
22 | static int of_remove_populated_child(struct device *dev, void *d) | ||
23 | { | ||
24 | struct platform_device *pdev = to_platform_device(dev); | ||
25 | |||
26 | of_device_unregister(pdev); | ||
27 | return 0; | ||
28 | } | ||
29 | |||
30 | static int am335x_child_remove(struct platform_device *pdev) | ||
31 | { | ||
32 | device_for_each_child(&pdev->dev, NULL, of_remove_populated_child); | ||
33 | pm_runtime_disable(&pdev->dev); | ||
34 | return 0; | ||
35 | } | ||
36 | |||
37 | static const struct of_device_id am335x_child_of_match[] = { | 22 | static const struct of_device_id am335x_child_of_match[] = { |
38 | { .compatible = "ti,am33xx-usb" }, | 23 | { .compatible = "ti,am33xx-usb" }, |
39 | { }, | 24 | { }, |
@@ -42,13 +27,17 @@ MODULE_DEVICE_TABLE(of, am335x_child_of_match); | |||
42 | 27 | ||
43 | static struct platform_driver am335x_child_driver = { | 28 | static struct platform_driver am335x_child_driver = { |
44 | .probe = am335x_child_probe, | 29 | .probe = am335x_child_probe, |
45 | .remove = am335x_child_remove, | ||
46 | .driver = { | 30 | .driver = { |
47 | .name = "am335x-usb-childs", | 31 | .name = "am335x-usb-childs", |
48 | .of_match_table = am335x_child_of_match, | 32 | .of_match_table = am335x_child_of_match, |
49 | }, | 33 | }, |
50 | }; | 34 | }; |
51 | 35 | ||
52 | module_platform_driver(am335x_child_driver); | 36 | static int __init am335x_child_init(void) |
37 | { | ||
38 | return platform_driver_register(&am335x_child_driver); | ||
39 | } | ||
40 | module_init(am335x_child_init); | ||
41 | |||
53 | MODULE_DESCRIPTION("AM33xx child devices"); | 42 | MODULE_DESCRIPTION("AM33xx child devices"); |
54 | MODULE_LICENSE("GPL v2"); | 43 | MODULE_LICENSE("GPL v2"); |
diff --git a/drivers/usb/musb/musb_core.c b/drivers/usb/musb/musb_core.c index 61da471b7aed..eff3c5cf84f4 100644 --- a/drivers/usb/musb/musb_core.c +++ b/drivers/usb/musb/musb_core.c | |||
@@ -849,7 +849,7 @@ b_host: | |||
849 | } | 849 | } |
850 | 850 | ||
851 | /* handle babble condition */ | 851 | /* handle babble condition */ |
852 | if (int_usb & MUSB_INTR_BABBLE) | 852 | if (int_usb & MUSB_INTR_BABBLE && is_host_active(musb)) |
853 | schedule_work(&musb->recover_work); | 853 | schedule_work(&musb->recover_work); |
854 | 854 | ||
855 | #if 0 | 855 | #if 0 |
diff --git a/drivers/usb/musb/musb_cppi41.c b/drivers/usb/musb/musb_cppi41.c index 7b8bbf53127e..5341bb223b7c 100644 --- a/drivers/usb/musb/musb_cppi41.c +++ b/drivers/usb/musb/musb_cppi41.c | |||
@@ -318,7 +318,7 @@ static void cppi41_dma_callback(void *private_data) | |||
318 | } | 318 | } |
319 | list_add_tail(&cppi41_channel->tx_check, | 319 | list_add_tail(&cppi41_channel->tx_check, |
320 | &controller->early_tx_list); | 320 | &controller->early_tx_list); |
321 | if (!hrtimer_active(&controller->early_tx)) { | 321 | if (!hrtimer_is_queued(&controller->early_tx)) { |
322 | hrtimer_start_range_ns(&controller->early_tx, | 322 | hrtimer_start_range_ns(&controller->early_tx, |
323 | ktime_set(0, 140 * NSEC_PER_USEC), | 323 | ktime_set(0, 140 * NSEC_PER_USEC), |
324 | 40 * NSEC_PER_USEC, | 324 | 40 * NSEC_PER_USEC, |
diff --git a/drivers/usb/musb/musb_dsps.c b/drivers/usb/musb/musb_dsps.c index 51beb13c7e1a..09529f94e72d 100644 --- a/drivers/usb/musb/musb_dsps.c +++ b/drivers/usb/musb/musb_dsps.c | |||
@@ -494,10 +494,9 @@ static int dsps_musb_set_mode(struct musb *musb, u8 mode) | |||
494 | struct dsps_glue *glue = dev_get_drvdata(dev->parent); | 494 | struct dsps_glue *glue = dev_get_drvdata(dev->parent); |
495 | const struct dsps_musb_wrapper *wrp = glue->wrp; | 495 | const struct dsps_musb_wrapper *wrp = glue->wrp; |
496 | void __iomem *ctrl_base = musb->ctrl_base; | 496 | void __iomem *ctrl_base = musb->ctrl_base; |
497 | void __iomem *base = musb->mregs; | ||
498 | u32 reg; | 497 | u32 reg; |
499 | 498 | ||
500 | reg = dsps_readl(base, wrp->mode); | 499 | reg = dsps_readl(ctrl_base, wrp->mode); |
501 | 500 | ||
502 | switch (mode) { | 501 | switch (mode) { |
503 | case MUSB_HOST: | 502 | case MUSB_HOST: |
@@ -510,7 +509,7 @@ static int dsps_musb_set_mode(struct musb *musb, u8 mode) | |||
510 | */ | 509 | */ |
511 | reg |= (1 << wrp->iddig_mux); | 510 | reg |= (1 << wrp->iddig_mux); |
512 | 511 | ||
513 | dsps_writel(base, wrp->mode, reg); | 512 | dsps_writel(ctrl_base, wrp->mode, reg); |
514 | dsps_writel(ctrl_base, wrp->phy_utmi, 0x02); | 513 | dsps_writel(ctrl_base, wrp->phy_utmi, 0x02); |
515 | break; | 514 | break; |
516 | case MUSB_PERIPHERAL: | 515 | case MUSB_PERIPHERAL: |
@@ -523,10 +522,10 @@ static int dsps_musb_set_mode(struct musb *musb, u8 mode) | |||
523 | */ | 522 | */ |
524 | reg |= (1 << wrp->iddig_mux); | 523 | reg |= (1 << wrp->iddig_mux); |
525 | 524 | ||
526 | dsps_writel(base, wrp->mode, reg); | 525 | dsps_writel(ctrl_base, wrp->mode, reg); |
527 | break; | 526 | break; |
528 | case MUSB_OTG: | 527 | case MUSB_OTG: |
529 | dsps_writel(base, wrp->phy_utmi, 0x02); | 528 | dsps_writel(ctrl_base, wrp->phy_utmi, 0x02); |
530 | break; | 529 | break; |
531 | default: | 530 | default: |
532 | dev_err(glue->dev, "unsupported mode %d\n", mode); | 531 | dev_err(glue->dev, "unsupported mode %d\n", mode); |
diff --git a/drivers/usb/musb/ux500.c b/drivers/usb/musb/ux500.c index c2e45e632723..f202e5088461 100644 --- a/drivers/usb/musb/ux500.c +++ b/drivers/usb/musb/ux500.c | |||
@@ -274,7 +274,6 @@ static int ux500_probe(struct platform_device *pdev) | |||
274 | musb->dev.parent = &pdev->dev; | 274 | musb->dev.parent = &pdev->dev; |
275 | musb->dev.dma_mask = &pdev->dev.coherent_dma_mask; | 275 | musb->dev.dma_mask = &pdev->dev.coherent_dma_mask; |
276 | musb->dev.coherent_dma_mask = pdev->dev.coherent_dma_mask; | 276 | musb->dev.coherent_dma_mask = pdev->dev.coherent_dma_mask; |
277 | musb->dev.of_node = pdev->dev.of_node; | ||
278 | 277 | ||
279 | glue->dev = &pdev->dev; | 278 | glue->dev = &pdev->dev; |
280 | glue->musb = musb; | 279 | glue->musb = musb; |
diff --git a/drivers/usb/phy/phy-msm-usb.c b/drivers/usb/phy/phy-msm-usb.c index ced34f39bdd4..c929370cdaa6 100644 --- a/drivers/usb/phy/phy-msm-usb.c +++ b/drivers/usb/phy/phy-msm-usb.c | |||
@@ -1229,7 +1229,9 @@ static void msm_otg_sm_work(struct work_struct *w) | |||
1229 | motg->chg_state = USB_CHG_STATE_UNDEFINED; | 1229 | motg->chg_state = USB_CHG_STATE_UNDEFINED; |
1230 | motg->chg_type = USB_INVALID_CHARGER; | 1230 | motg->chg_type = USB_INVALID_CHARGER; |
1231 | } | 1231 | } |
1232 | pm_runtime_put_sync(otg->phy->dev); | 1232 | |
1233 | if (otg->phy->state == OTG_STATE_B_IDLE) | ||
1234 | pm_runtime_put_sync(otg->phy->dev); | ||
1233 | break; | 1235 | break; |
1234 | case OTG_STATE_B_PERIPHERAL: | 1236 | case OTG_STATE_B_PERIPHERAL: |
1235 | dev_dbg(otg->phy->dev, "OTG_STATE_B_PERIPHERAL state\n"); | 1237 | dev_dbg(otg->phy->dev, "OTG_STATE_B_PERIPHERAL state\n"); |
diff --git a/drivers/usb/renesas_usbhs/fifo.c b/drivers/usb/renesas_usbhs/fifo.c index d49f9c326035..4fd36530bfa3 100644 --- a/drivers/usb/renesas_usbhs/fifo.c +++ b/drivers/usb/renesas_usbhs/fifo.c | |||
@@ -681,6 +681,14 @@ usbhs_fifo_read_end: | |||
681 | usbhs_pipe_number(pipe), | 681 | usbhs_pipe_number(pipe), |
682 | pkt->length, pkt->actual, *is_done, pkt->zero); | 682 | pkt->length, pkt->actual, *is_done, pkt->zero); |
683 | 683 | ||
684 | /* | ||
685 | * Transmission end | ||
686 | */ | ||
687 | if (*is_done) { | ||
688 | if (usbhs_pipe_is_dcp(pipe)) | ||
689 | usbhs_dcp_control_transfer_done(pipe); | ||
690 | } | ||
691 | |||
684 | usbhs_fifo_read_busy: | 692 | usbhs_fifo_read_busy: |
685 | usbhsf_fifo_unselect(pipe, fifo); | 693 | usbhsf_fifo_unselect(pipe, fifo); |
686 | 694 | ||
diff --git a/drivers/usb/serial/cp210x.c b/drivers/usb/serial/cp210x.c index 762e4a5f5ae9..330df5ce435b 100644 --- a/drivers/usb/serial/cp210x.c +++ b/drivers/usb/serial/cp210x.c | |||
@@ -153,6 +153,7 @@ static const struct usb_device_id id_table[] = { | |||
153 | { USB_DEVICE(0x1843, 0x0200) }, /* Vaisala USB Instrument Cable */ | 153 | { USB_DEVICE(0x1843, 0x0200) }, /* Vaisala USB Instrument Cable */ |
154 | { USB_DEVICE(0x18EF, 0xE00F) }, /* ELV USB-I2C-Interface */ | 154 | { USB_DEVICE(0x18EF, 0xE00F) }, /* ELV USB-I2C-Interface */ |
155 | { USB_DEVICE(0x1ADB, 0x0001) }, /* Schweitzer Engineering C662 Cable */ | 155 | { USB_DEVICE(0x1ADB, 0x0001) }, /* Schweitzer Engineering C662 Cable */ |
156 | { USB_DEVICE(0x1B1C, 0x1C00) }, /* Corsair USB Dongle */ | ||
156 | { USB_DEVICE(0x1BE3, 0x07A6) }, /* WAGO 750-923 USB Service Cable */ | 157 | { USB_DEVICE(0x1BE3, 0x07A6) }, /* WAGO 750-923 USB Service Cable */ |
157 | { USB_DEVICE(0x1E29, 0x0102) }, /* Festo CPX-USB */ | 158 | { USB_DEVICE(0x1E29, 0x0102) }, /* Festo CPX-USB */ |
158 | { USB_DEVICE(0x1E29, 0x0501) }, /* Festo CMSP */ | 159 | { USB_DEVICE(0x1E29, 0x0501) }, /* Festo CMSP */ |
diff --git a/drivers/usb/serial/ftdi_sio.c b/drivers/usb/serial/ftdi_sio.c index edf3b124583c..8a3813be1b28 100644 --- a/drivers/usb/serial/ftdi_sio.c +++ b/drivers/usb/serial/ftdi_sio.c | |||
@@ -720,7 +720,8 @@ static const struct usb_device_id id_table_combined[] = { | |||
720 | { USB_DEVICE(FTDI_VID, FTDI_ACG_HFDUAL_PID) }, | 720 | { USB_DEVICE(FTDI_VID, FTDI_ACG_HFDUAL_PID) }, |
721 | { USB_DEVICE(FTDI_VID, FTDI_YEI_SERVOCENTER31_PID) }, | 721 | { USB_DEVICE(FTDI_VID, FTDI_YEI_SERVOCENTER31_PID) }, |
722 | { USB_DEVICE(FTDI_VID, FTDI_THORLABS_PID) }, | 722 | { USB_DEVICE(FTDI_VID, FTDI_THORLABS_PID) }, |
723 | { USB_DEVICE(TESTO_VID, TESTO_USB_INTERFACE_PID) }, | 723 | { USB_DEVICE(TESTO_VID, TESTO_1_PID) }, |
724 | { USB_DEVICE(TESTO_VID, TESTO_3_PID) }, | ||
724 | { USB_DEVICE(FTDI_VID, FTDI_GAMMA_SCOUT_PID) }, | 725 | { USB_DEVICE(FTDI_VID, FTDI_GAMMA_SCOUT_PID) }, |
725 | { USB_DEVICE(FTDI_VID, FTDI_TACTRIX_OPENPORT_13M_PID) }, | 726 | { USB_DEVICE(FTDI_VID, FTDI_TACTRIX_OPENPORT_13M_PID) }, |
726 | { USB_DEVICE(FTDI_VID, FTDI_TACTRIX_OPENPORT_13S_PID) }, | 727 | { USB_DEVICE(FTDI_VID, FTDI_TACTRIX_OPENPORT_13S_PID) }, |
@@ -944,6 +945,8 @@ static const struct usb_device_id id_table_combined[] = { | |||
944 | { USB_DEVICE(BRAINBOXES_VID, BRAINBOXES_US_842_2_PID) }, | 945 | { USB_DEVICE(BRAINBOXES_VID, BRAINBOXES_US_842_2_PID) }, |
945 | { USB_DEVICE(BRAINBOXES_VID, BRAINBOXES_US_842_3_PID) }, | 946 | { USB_DEVICE(BRAINBOXES_VID, BRAINBOXES_US_842_3_PID) }, |
946 | { USB_DEVICE(BRAINBOXES_VID, BRAINBOXES_US_842_4_PID) }, | 947 | { USB_DEVICE(BRAINBOXES_VID, BRAINBOXES_US_842_4_PID) }, |
948 | /* Infineon Devices */ | ||
949 | { USB_DEVICE_INTERFACE_NUMBER(INFINEON_VID, INFINEON_TRIBOARD_PID, 1) }, | ||
947 | { } /* Terminating entry */ | 950 | { } /* Terminating entry */ |
948 | }; | 951 | }; |
949 | 952 | ||
@@ -1566,14 +1569,17 @@ static void ftdi_set_max_packet_size(struct usb_serial_port *port) | |||
1566 | struct usb_device *udev = serial->dev; | 1569 | struct usb_device *udev = serial->dev; |
1567 | 1570 | ||
1568 | struct usb_interface *interface = serial->interface; | 1571 | struct usb_interface *interface = serial->interface; |
1569 | struct usb_endpoint_descriptor *ep_desc = &interface->cur_altsetting->endpoint[1].desc; | 1572 | struct usb_endpoint_descriptor *ep_desc; |
1570 | 1573 | ||
1571 | unsigned num_endpoints; | 1574 | unsigned num_endpoints; |
1572 | int i; | 1575 | unsigned i; |
1573 | 1576 | ||
1574 | num_endpoints = interface->cur_altsetting->desc.bNumEndpoints; | 1577 | num_endpoints = interface->cur_altsetting->desc.bNumEndpoints; |
1575 | dev_info(&udev->dev, "Number of endpoints %d\n", num_endpoints); | 1578 | dev_info(&udev->dev, "Number of endpoints %d\n", num_endpoints); |
1576 | 1579 | ||
1580 | if (!num_endpoints) | ||
1581 | return; | ||
1582 | |||
1577 | /* NOTE: some customers have programmed FT232R/FT245R devices | 1583 | /* NOTE: some customers have programmed FT232R/FT245R devices |
1578 | * with an endpoint size of 0 - not good. In this case, we | 1584 | * with an endpoint size of 0 - not good. In this case, we |
1579 | * want to override the endpoint descriptor setting and use a | 1585 | * want to override the endpoint descriptor setting and use a |
diff --git a/drivers/usb/serial/ftdi_sio_ids.h b/drivers/usb/serial/ftdi_sio_ids.h index 500474c48f4b..c4777bc6aee0 100644 --- a/drivers/usb/serial/ftdi_sio_ids.h +++ b/drivers/usb/serial/ftdi_sio_ids.h | |||
@@ -584,6 +584,12 @@ | |||
584 | #define RATOC_PRODUCT_ID_USB60F 0xb020 | 584 | #define RATOC_PRODUCT_ID_USB60F 0xb020 |
585 | 585 | ||
586 | /* | 586 | /* |
587 | * Infineon Technologies | ||
588 | */ | ||
589 | #define INFINEON_VID 0x058b | ||
590 | #define INFINEON_TRIBOARD_PID 0x0028 /* DAS JTAG TriBoard TC1798 V1.0 */ | ||
591 | |||
592 | /* | ||
587 | * Acton Research Corp. | 593 | * Acton Research Corp. |
588 | */ | 594 | */ |
589 | #define ACTON_VID 0x0647 /* Vendor ID */ | 595 | #define ACTON_VID 0x0647 /* Vendor ID */ |
@@ -798,7 +804,8 @@ | |||
798 | * Submitted by Colin Leroy | 804 | * Submitted by Colin Leroy |
799 | */ | 805 | */ |
800 | #define TESTO_VID 0x128D | 806 | #define TESTO_VID 0x128D |
801 | #define TESTO_USB_INTERFACE_PID 0x0001 | 807 | #define TESTO_1_PID 0x0001 |
808 | #define TESTO_3_PID 0x0003 | ||
802 | 809 | ||
803 | /* | 810 | /* |
804 | * Mobility Electronics products. | 811 | * Mobility Electronics products. |
diff --git a/drivers/usb/serial/option.c b/drivers/usb/serial/option.c index 59c3108cc136..a9688940543d 100644 --- a/drivers/usb/serial/option.c +++ b/drivers/usb/serial/option.c | |||
@@ -352,6 +352,9 @@ static void option_instat_callback(struct urb *urb); | |||
352 | /* Zoom */ | 352 | /* Zoom */ |
353 | #define ZOOM_PRODUCT_4597 0x9607 | 353 | #define ZOOM_PRODUCT_4597 0x9607 |
354 | 354 | ||
355 | /* SpeedUp SU9800 usb 3g modem */ | ||
356 | #define SPEEDUP_PRODUCT_SU9800 0x9800 | ||
357 | |||
355 | /* Haier products */ | 358 | /* Haier products */ |
356 | #define HAIER_VENDOR_ID 0x201e | 359 | #define HAIER_VENDOR_ID 0x201e |
357 | #define HAIER_PRODUCT_CE100 0x2009 | 360 | #define HAIER_PRODUCT_CE100 0x2009 |
@@ -372,8 +375,12 @@ static void option_instat_callback(struct urb *urb); | |||
372 | /* Olivetti products */ | 375 | /* Olivetti products */ |
373 | #define OLIVETTI_VENDOR_ID 0x0b3c | 376 | #define OLIVETTI_VENDOR_ID 0x0b3c |
374 | #define OLIVETTI_PRODUCT_OLICARD100 0xc000 | 377 | #define OLIVETTI_PRODUCT_OLICARD100 0xc000 |
378 | #define OLIVETTI_PRODUCT_OLICARD120 0xc001 | ||
379 | #define OLIVETTI_PRODUCT_OLICARD140 0xc002 | ||
375 | #define OLIVETTI_PRODUCT_OLICARD145 0xc003 | 380 | #define OLIVETTI_PRODUCT_OLICARD145 0xc003 |
381 | #define OLIVETTI_PRODUCT_OLICARD155 0xc004 | ||
376 | #define OLIVETTI_PRODUCT_OLICARD200 0xc005 | 382 | #define OLIVETTI_PRODUCT_OLICARD200 0xc005 |
383 | #define OLIVETTI_PRODUCT_OLICARD160 0xc00a | ||
377 | #define OLIVETTI_PRODUCT_OLICARD500 0xc00b | 384 | #define OLIVETTI_PRODUCT_OLICARD500 0xc00b |
378 | 385 | ||
379 | /* Celot products */ | 386 | /* Celot products */ |
@@ -1480,6 +1487,8 @@ static const struct usb_device_id option_ids[] = { | |||
1480 | .driver_info = (kernel_ulong_t)&net_intf2_blacklist }, | 1487 | .driver_info = (kernel_ulong_t)&net_intf2_blacklist }, |
1481 | { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1426, 0xff, 0xff, 0xff), /* ZTE MF91 */ | 1488 | { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1426, 0xff, 0xff, 0xff), /* ZTE MF91 */ |
1482 | .driver_info = (kernel_ulong_t)&net_intf2_blacklist }, | 1489 | .driver_info = (kernel_ulong_t)&net_intf2_blacklist }, |
1490 | { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1428, 0xff, 0xff, 0xff), /* Telewell TW-LTE 4G v2 */ | ||
1491 | .driver_info = (kernel_ulong_t)&net_intf2_blacklist }, | ||
1483 | { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1533, 0xff, 0xff, 0xff) }, | 1492 | { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1533, 0xff, 0xff, 0xff) }, |
1484 | { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1534, 0xff, 0xff, 0xff) }, | 1493 | { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1534, 0xff, 0xff, 0xff) }, |
1485 | { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1535, 0xff, 0xff, 0xff) }, | 1494 | { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1535, 0xff, 0xff, 0xff) }, |
@@ -1577,6 +1586,7 @@ static const struct usb_device_id option_ids[] = { | |||
1577 | { USB_DEVICE(LONGCHEER_VENDOR_ID, FOUR_G_SYSTEMS_PRODUCT_W14), | 1586 | { USB_DEVICE(LONGCHEER_VENDOR_ID, FOUR_G_SYSTEMS_PRODUCT_W14), |
1578 | .driver_info = (kernel_ulong_t)&four_g_w14_blacklist | 1587 | .driver_info = (kernel_ulong_t)&four_g_w14_blacklist |
1579 | }, | 1588 | }, |
1589 | { USB_DEVICE_INTERFACE_CLASS(LONGCHEER_VENDOR_ID, SPEEDUP_PRODUCT_SU9800, 0xff) }, | ||
1580 | { USB_DEVICE(LONGCHEER_VENDOR_ID, ZOOM_PRODUCT_4597) }, | 1590 | { USB_DEVICE(LONGCHEER_VENDOR_ID, ZOOM_PRODUCT_4597) }, |
1581 | { USB_DEVICE(LONGCHEER_VENDOR_ID, IBALL_3_5G_CONNECT) }, | 1591 | { USB_DEVICE(LONGCHEER_VENDOR_ID, IBALL_3_5G_CONNECT) }, |
1582 | { USB_DEVICE(HAIER_VENDOR_ID, HAIER_PRODUCT_CE100) }, | 1592 | { USB_DEVICE(HAIER_VENDOR_ID, HAIER_PRODUCT_CE100) }, |
@@ -1611,15 +1621,21 @@ static const struct usb_device_id option_ids[] = { | |||
1611 | { USB_DEVICE(SIEMENS_VENDOR_ID, CINTERION_PRODUCT_HC25_MDMNET) }, | 1621 | { USB_DEVICE(SIEMENS_VENDOR_ID, CINTERION_PRODUCT_HC25_MDMNET) }, |
1612 | { USB_DEVICE(SIEMENS_VENDOR_ID, CINTERION_PRODUCT_HC28_MDM) }, /* HC28 enumerates with Siemens or Cinterion VID depending on FW revision */ | 1622 | { USB_DEVICE(SIEMENS_VENDOR_ID, CINTERION_PRODUCT_HC28_MDM) }, /* HC28 enumerates with Siemens or Cinterion VID depending on FW revision */ |
1613 | { USB_DEVICE(SIEMENS_VENDOR_ID, CINTERION_PRODUCT_HC28_MDMNET) }, | 1623 | { USB_DEVICE(SIEMENS_VENDOR_ID, CINTERION_PRODUCT_HC28_MDMNET) }, |
1614 | 1624 | { USB_DEVICE(OLIVETTI_VENDOR_ID, OLIVETTI_PRODUCT_OLICARD100), | |
1615 | { USB_DEVICE(OLIVETTI_VENDOR_ID, OLIVETTI_PRODUCT_OLICARD100) }, | 1625 | .driver_info = (kernel_ulong_t)&net_intf4_blacklist }, |
1626 | { USB_DEVICE(OLIVETTI_VENDOR_ID, OLIVETTI_PRODUCT_OLICARD120), | ||
1627 | .driver_info = (kernel_ulong_t)&net_intf4_blacklist }, | ||
1628 | { USB_DEVICE(OLIVETTI_VENDOR_ID, OLIVETTI_PRODUCT_OLICARD140), | ||
1629 | .driver_info = (kernel_ulong_t)&net_intf4_blacklist }, | ||
1616 | { USB_DEVICE(OLIVETTI_VENDOR_ID, OLIVETTI_PRODUCT_OLICARD145) }, | 1630 | { USB_DEVICE(OLIVETTI_VENDOR_ID, OLIVETTI_PRODUCT_OLICARD145) }, |
1631 | { USB_DEVICE(OLIVETTI_VENDOR_ID, OLIVETTI_PRODUCT_OLICARD155), | ||
1632 | .driver_info = (kernel_ulong_t)&net_intf6_blacklist }, | ||
1617 | { USB_DEVICE(OLIVETTI_VENDOR_ID, OLIVETTI_PRODUCT_OLICARD200), | 1633 | { USB_DEVICE(OLIVETTI_VENDOR_ID, OLIVETTI_PRODUCT_OLICARD200), |
1618 | .driver_info = (kernel_ulong_t)&net_intf6_blacklist | 1634 | .driver_info = (kernel_ulong_t)&net_intf6_blacklist }, |
1619 | }, | 1635 | { USB_DEVICE(OLIVETTI_VENDOR_ID, OLIVETTI_PRODUCT_OLICARD160), |
1636 | .driver_info = (kernel_ulong_t)&net_intf6_blacklist }, | ||
1620 | { USB_DEVICE(OLIVETTI_VENDOR_ID, OLIVETTI_PRODUCT_OLICARD500), | 1637 | { USB_DEVICE(OLIVETTI_VENDOR_ID, OLIVETTI_PRODUCT_OLICARD500), |
1621 | .driver_info = (kernel_ulong_t)&net_intf4_blacklist | 1638 | .driver_info = (kernel_ulong_t)&net_intf4_blacklist }, |
1622 | }, | ||
1623 | { USB_DEVICE(CELOT_VENDOR_ID, CELOT_PRODUCT_CT680M) }, /* CT-650 CDMA 450 1xEVDO modem */ | 1639 | { USB_DEVICE(CELOT_VENDOR_ID, CELOT_PRODUCT_CT680M) }, /* CT-650 CDMA 450 1xEVDO modem */ |
1624 | { USB_DEVICE_AND_INTERFACE_INFO(SAMSUNG_VENDOR_ID, SAMSUNG_PRODUCT_GT_B3730, USB_CLASS_CDC_DATA, 0x00, 0x00) }, /* Samsung GT-B3730 LTE USB modem.*/ | 1640 | { USB_DEVICE_AND_INTERFACE_INFO(SAMSUNG_VENDOR_ID, SAMSUNG_PRODUCT_GT_B3730, USB_CLASS_CDC_DATA, 0x00, 0x00) }, /* Samsung GT-B3730 LTE USB modem.*/ |
1625 | { USB_DEVICE(YUGA_VENDOR_ID, YUGA_PRODUCT_CEM600) }, | 1641 | { USB_DEVICE(YUGA_VENDOR_ID, YUGA_PRODUCT_CEM600) }, |
diff --git a/drivers/usb/storage/scsiglue.c b/drivers/usb/storage/scsiglue.c index 9d38ddc8da49..866b5df36ed1 100644 --- a/drivers/usb/storage/scsiglue.c +++ b/drivers/usb/storage/scsiglue.c | |||
@@ -256,6 +256,10 @@ static int slave_configure(struct scsi_device *sdev) | |||
256 | if (us->fflags & US_FL_WRITE_CACHE) | 256 | if (us->fflags & US_FL_WRITE_CACHE) |
257 | sdev->wce_default_on = 1; | 257 | sdev->wce_default_on = 1; |
258 | 258 | ||
259 | /* A few buggy USB-ATA bridges don't understand FUA */ | ||
260 | if (us->fflags & US_FL_BROKEN_FUA) | ||
261 | sdev->broken_fua = 1; | ||
262 | |||
259 | } else { | 263 | } else { |
260 | 264 | ||
261 | /* Non-disk-type devices don't need to blacklist any pages | 265 | /* Non-disk-type devices don't need to blacklist any pages |
diff --git a/drivers/usb/storage/unusual_devs.h b/drivers/usb/storage/unusual_devs.h index 174a447868cd..80a5b366255f 100644 --- a/drivers/usb/storage/unusual_devs.h +++ b/drivers/usb/storage/unusual_devs.h | |||
@@ -1936,6 +1936,13 @@ UNUSUAL_DEV( 0x14cd, 0x6600, 0x0201, 0x0201, | |||
1936 | USB_SC_DEVICE, USB_PR_DEVICE, NULL, | 1936 | USB_SC_DEVICE, USB_PR_DEVICE, NULL, |
1937 | US_FL_IGNORE_RESIDUE ), | 1937 | US_FL_IGNORE_RESIDUE ), |
1938 | 1938 | ||
1939 | /* Reported by Michael Büsch <m@bues.ch> */ | ||
1940 | UNUSUAL_DEV( 0x152d, 0x0567, 0x0114, 0x0114, | ||
1941 | "JMicron", | ||
1942 | "USB to ATA/ATAPI Bridge", | ||
1943 | USB_SC_DEVICE, USB_PR_DEVICE, NULL, | ||
1944 | US_FL_BROKEN_FUA ), | ||
1945 | |||
1939 | /* Reported by Alexandre Oliva <oliva@lsd.ic.unicamp.br> | 1946 | /* Reported by Alexandre Oliva <oliva@lsd.ic.unicamp.br> |
1940 | * JMicron responds to USN and several other SCSI ioctls with a | 1947 | * JMicron responds to USN and several other SCSI ioctls with a |
1941 | * residue that causes subsequent I/O requests to fail. */ | 1948 | * residue that causes subsequent I/O requests to fail. */ |
diff --git a/drivers/vhost/net.c b/drivers/vhost/net.c index 971a760af4a1..8dae2f724a35 100644 --- a/drivers/vhost/net.c +++ b/drivers/vhost/net.c | |||
@@ -700,14 +700,6 @@ static void handle_rx_net(struct vhost_work *work) | |||
700 | handle_rx(net); | 700 | handle_rx(net); |
701 | } | 701 | } |
702 | 702 | ||
703 | static void vhost_net_free(void *addr) | ||
704 | { | ||
705 | if (is_vmalloc_addr(addr)) | ||
706 | vfree(addr); | ||
707 | else | ||
708 | kfree(addr); | ||
709 | } | ||
710 | |||
711 | static int vhost_net_open(struct inode *inode, struct file *f) | 703 | static int vhost_net_open(struct inode *inode, struct file *f) |
712 | { | 704 | { |
713 | struct vhost_net *n; | 705 | struct vhost_net *n; |
@@ -723,7 +715,7 @@ static int vhost_net_open(struct inode *inode, struct file *f) | |||
723 | } | 715 | } |
724 | vqs = kmalloc(VHOST_NET_VQ_MAX * sizeof(*vqs), GFP_KERNEL); | 716 | vqs = kmalloc(VHOST_NET_VQ_MAX * sizeof(*vqs), GFP_KERNEL); |
725 | if (!vqs) { | 717 | if (!vqs) { |
726 | vhost_net_free(n); | 718 | kvfree(n); |
727 | return -ENOMEM; | 719 | return -ENOMEM; |
728 | } | 720 | } |
729 | 721 | ||
@@ -840,7 +832,7 @@ static int vhost_net_release(struct inode *inode, struct file *f) | |||
840 | * since jobs can re-queue themselves. */ | 832 | * since jobs can re-queue themselves. */ |
841 | vhost_net_flush(n); | 833 | vhost_net_flush(n); |
842 | kfree(n->dev.vqs); | 834 | kfree(n->dev.vqs); |
843 | vhost_net_free(n); | 835 | kvfree(n); |
844 | return 0; | 836 | return 0; |
845 | } | 837 | } |
846 | 838 | ||
diff --git a/drivers/vhost/scsi.c b/drivers/vhost/scsi.c index 4f4ffa4c604e..69906cacd04f 100644 --- a/drivers/vhost/scsi.c +++ b/drivers/vhost/scsi.c | |||
@@ -1503,14 +1503,6 @@ static int vhost_scsi_set_features(struct vhost_scsi *vs, u64 features) | |||
1503 | return 0; | 1503 | return 0; |
1504 | } | 1504 | } |
1505 | 1505 | ||
1506 | static void vhost_scsi_free(struct vhost_scsi *vs) | ||
1507 | { | ||
1508 | if (is_vmalloc_addr(vs)) | ||
1509 | vfree(vs); | ||
1510 | else | ||
1511 | kfree(vs); | ||
1512 | } | ||
1513 | |||
1514 | static int vhost_scsi_open(struct inode *inode, struct file *f) | 1506 | static int vhost_scsi_open(struct inode *inode, struct file *f) |
1515 | { | 1507 | { |
1516 | struct vhost_scsi *vs; | 1508 | struct vhost_scsi *vs; |
@@ -1550,7 +1542,7 @@ static int vhost_scsi_open(struct inode *inode, struct file *f) | |||
1550 | return 0; | 1542 | return 0; |
1551 | 1543 | ||
1552 | err_vqs: | 1544 | err_vqs: |
1553 | vhost_scsi_free(vs); | 1545 | kvfree(vs); |
1554 | err_vs: | 1546 | err_vs: |
1555 | return r; | 1547 | return r; |
1556 | } | 1548 | } |
@@ -1569,7 +1561,7 @@ static int vhost_scsi_release(struct inode *inode, struct file *f) | |||
1569 | /* Jobs can re-queue themselves in evt kick handler. Do extra flush. */ | 1561 | /* Jobs can re-queue themselves in evt kick handler. Do extra flush. */ |
1570 | vhost_scsi_flush(vs); | 1562 | vhost_scsi_flush(vs); |
1571 | kfree(vs->dev.vqs); | 1563 | kfree(vs->dev.vqs); |
1572 | vhost_scsi_free(vs); | 1564 | kvfree(vs); |
1573 | return 0; | 1565 | return 0; |
1574 | } | 1566 | } |
1575 | 1567 | ||
diff --git a/drivers/video/console/dummycon.c b/drivers/video/console/dummycon.c index b63860f7beab..40bec8d64b0a 100644 --- a/drivers/video/console/dummycon.c +++ b/drivers/video/console/dummycon.c | |||
@@ -77,3 +77,4 @@ const struct consw dummy_con = { | |||
77 | .con_set_palette = DUMMY, | 77 | .con_set_palette = DUMMY, |
78 | .con_scrolldelta = DUMMY, | 78 | .con_scrolldelta = DUMMY, |
79 | }; | 79 | }; |
80 | EXPORT_SYMBOL_GPL(dummy_con); | ||
diff --git a/drivers/video/console/vgacon.c b/drivers/video/console/vgacon.c index f267284b423b..6e6aa704fe84 100644 --- a/drivers/video/console/vgacon.c +++ b/drivers/video/console/vgacon.c | |||
@@ -1441,5 +1441,6 @@ const struct consw vga_con = { | |||
1441 | .con_build_attr = vgacon_build_attr, | 1441 | .con_build_attr = vgacon_build_attr, |
1442 | .con_invert_region = vgacon_invert_region, | 1442 | .con_invert_region = vgacon_invert_region, |
1443 | }; | 1443 | }; |
1444 | EXPORT_SYMBOL(vga_con); | ||
1444 | 1445 | ||
1445 | MODULE_LICENSE("GPL"); | 1446 | MODULE_LICENSE("GPL"); |
diff --git a/drivers/video/fbdev/atmel_lcdfb.c b/drivers/video/fbdev/atmel_lcdfb.c index e683b6ef9594..d36e830d6fc6 100644 --- a/drivers/video/fbdev/atmel_lcdfb.c +++ b/drivers/video/fbdev/atmel_lcdfb.c | |||
@@ -1057,6 +1057,7 @@ static int atmel_lcdfb_of_init(struct atmel_lcdfb_info *sinfo) | |||
1057 | goto put_display_node; | 1057 | goto put_display_node; |
1058 | } | 1058 | } |
1059 | 1059 | ||
1060 | INIT_LIST_HEAD(&pdata->pwr_gpios); | ||
1060 | ret = -ENOMEM; | 1061 | ret = -ENOMEM; |
1061 | for (i = 0; i < of_gpio_named_count(display_np, "atmel,power-control-gpio"); i++) { | 1062 | for (i = 0; i < of_gpio_named_count(display_np, "atmel,power-control-gpio"); i++) { |
1062 | gpio = of_get_named_gpio_flags(display_np, "atmel,power-control-gpio", | 1063 | gpio = of_get_named_gpio_flags(display_np, "atmel,power-control-gpio", |
@@ -1082,6 +1083,7 @@ static int atmel_lcdfb_of_init(struct atmel_lcdfb_info *sinfo) | |||
1082 | dev_err(dev, "set direction output gpio %d failed\n", gpio); | 1083 | dev_err(dev, "set direction output gpio %d failed\n", gpio); |
1083 | goto put_display_node; | 1084 | goto put_display_node; |
1084 | } | 1085 | } |
1086 | list_add(&og->list, &pdata->pwr_gpios); | ||
1085 | } | 1087 | } |
1086 | 1088 | ||
1087 | if (is_gpio_power) | 1089 | if (is_gpio_power) |
diff --git a/drivers/video/fbdev/bfin_adv7393fb.c b/drivers/video/fbdev/bfin_adv7393fb.c index a54f7f7d763b..8fe41caac38e 100644 --- a/drivers/video/fbdev/bfin_adv7393fb.c +++ b/drivers/video/fbdev/bfin_adv7393fb.c | |||
@@ -408,7 +408,7 @@ static int bfin_adv7393_fb_probe(struct i2c_client *client, | |||
408 | /* Workaround "PPI Does Not Start Properly In Specific Mode" */ | 408 | /* Workaround "PPI Does Not Start Properly In Specific Mode" */ |
409 | if (ANOMALY_05000400) { | 409 | if (ANOMALY_05000400) { |
410 | ret = gpio_request_one(P_IDENT(P_PPI0_FS3), GPIOF_OUT_INIT_LOW, | 410 | ret = gpio_request_one(P_IDENT(P_PPI0_FS3), GPIOF_OUT_INIT_LOW, |
411 | "PPI0_FS3") | 411 | "PPI0_FS3"); |
412 | if (ret) { | 412 | if (ret) { |
413 | dev_err(&client->dev, "PPI0_FS3 GPIO request failed\n"); | 413 | dev_err(&client->dev, "PPI0_FS3 GPIO request failed\n"); |
414 | ret = -EBUSY; | 414 | ret = -EBUSY; |
diff --git a/drivers/video/fbdev/omap2/dss/omapdss-boot-init.c b/drivers/video/fbdev/omap2/dss/omapdss-boot-init.c index 99af9e88b2d8..2f0822ee3ff9 100644 --- a/drivers/video/fbdev/omap2/dss/omapdss-boot-init.c +++ b/drivers/video/fbdev/omap2/dss/omapdss-boot-init.c | |||
@@ -121,9 +121,11 @@ static void __init omapdss_add_to_list(struct device_node *node, bool root) | |||
121 | { | 121 | { |
122 | struct dss_conv_node *n = kmalloc(sizeof(struct dss_conv_node), | 122 | struct dss_conv_node *n = kmalloc(sizeof(struct dss_conv_node), |
123 | GFP_KERNEL); | 123 | GFP_KERNEL); |
124 | n->node = node; | 124 | if (n) { |
125 | n->root = root; | 125 | n->node = node; |
126 | list_add(&n->list, &dss_conv_list); | 126 | n->root = root; |
127 | list_add(&n->list, &dss_conv_list); | ||
128 | } | ||
127 | } | 129 | } |
128 | 130 | ||
129 | static bool __init omapdss_list_contains(const struct device_node *node) | 131 | static bool __init omapdss_list_contains(const struct device_node *node) |
diff --git a/drivers/video/fbdev/vt8500lcdfb.c b/drivers/video/fbdev/vt8500lcdfb.c index a8f2b280f796..a1134c3f6c11 100644 --- a/drivers/video/fbdev/vt8500lcdfb.c +++ b/drivers/video/fbdev/vt8500lcdfb.c | |||
@@ -474,8 +474,6 @@ static int vt8500lcd_remove(struct platform_device *pdev) | |||
474 | res = platform_get_resource(pdev, IORESOURCE_MEM, 0); | 474 | res = platform_get_resource(pdev, IORESOURCE_MEM, 0); |
475 | release_mem_region(res->start, resource_size(res)); | 475 | release_mem_region(res->start, resource_size(res)); |
476 | 476 | ||
477 | kfree(fbi); | ||
478 | |||
479 | return 0; | 477 | return 0; |
480 | } | 478 | } |
481 | 479 | ||
diff --git a/drivers/w1/masters/mxc_w1.c b/drivers/w1/masters/mxc_w1.c index 67b067a3e2ab..a5df5e89d456 100644 --- a/drivers/w1/masters/mxc_w1.c +++ b/drivers/w1/masters/mxc_w1.c | |||
@@ -66,7 +66,7 @@ static u8 mxc_w1_ds2_reset_bus(void *data) | |||
66 | 66 | ||
67 | udelay(100); | 67 | udelay(100); |
68 | } | 68 | } |
69 | return !!(reg_val & MXC_W1_CONTROL_PST); | 69 | return !(reg_val & MXC_W1_CONTROL_PST); |
70 | } | 70 | } |
71 | 71 | ||
72 | /* | 72 | /* |
diff --git a/drivers/watchdog/Kconfig b/drivers/watchdog/Kconfig index c845527b503a..76dd54122f76 100644 --- a/drivers/watchdog/Kconfig +++ b/drivers/watchdog/Kconfig | |||
@@ -1280,14 +1280,17 @@ config WATCHDOG_RTAS | |||
1280 | 1280 | ||
1281 | # S390 Architecture | 1281 | # S390 Architecture |
1282 | 1282 | ||
1283 | config ZVM_WATCHDOG | 1283 | config DIAG288_WATCHDOG |
1284 | tristate "z/VM Watchdog Timer" | 1284 | tristate "System z diag288 Watchdog" |
1285 | depends on S390 | 1285 | depends on S390 |
1286 | select WATCHDOG_CORE | ||
1286 | help | 1287 | help |
1287 | IBM s/390 and zSeries machines running under z/VM 5.1 or later | 1288 | IBM s/390 and zSeries machines running under z/VM 5.1 or later |
1288 | provide a virtual watchdog timer to their guest that cause a | 1289 | provide a virtual watchdog timer to their guest that cause a |
1289 | user define Control Program command to be executed after a | 1290 | user define Control Program command to be executed after a |
1290 | timeout. | 1291 | timeout. |
1292 | LPAR provides a very similar interface. This driver handles | ||
1293 | both. | ||
1291 | 1294 | ||
1292 | To compile this driver as a module, choose M here. The module | 1295 | To compile this driver as a module, choose M here. The module |
1293 | will be called vmwatchdog. | 1296 | will be called vmwatchdog. |
diff --git a/drivers/watchdog/Makefile b/drivers/watchdog/Makefile index 7b8a91ed20e7..468c3204c3b1 100644 --- a/drivers/watchdog/Makefile +++ b/drivers/watchdog/Makefile | |||
@@ -153,6 +153,7 @@ obj-$(CONFIG_MEN_A21_WDT) += mena21_wdt.o | |||
153 | obj-$(CONFIG_WATCHDOG_RTAS) += wdrtas.o | 153 | obj-$(CONFIG_WATCHDOG_RTAS) += wdrtas.o |
154 | 154 | ||
155 | # S390 Architecture | 155 | # S390 Architecture |
156 | obj-$(CONFIG_DIAG288_WATCHDOG) += diag288_wdt.o | ||
156 | 157 | ||
157 | # SUPERH (sh + sh64) Architecture | 158 | # SUPERH (sh + sh64) Architecture |
158 | obj-$(CONFIG_SH_WDT) += shwdt.o | 159 | obj-$(CONFIG_SH_WDT) += shwdt.o |
diff --git a/drivers/watchdog/diag288_wdt.c b/drivers/watchdog/diag288_wdt.c new file mode 100644 index 000000000000..429494b6c822 --- /dev/null +++ b/drivers/watchdog/diag288_wdt.c | |||
@@ -0,0 +1,316 @@ | |||
1 | /* | ||
2 | * Watchdog driver for z/VM and LPAR using the diag 288 interface. | ||
3 | * | ||
4 | * Under z/VM, expiration of the watchdog will send a "system restart" command | ||
5 | * to CP. | ||
6 | * | ||
7 | * The command can be altered using the module parameter "cmd". This is | ||
8 | * not recommended because it's only supported on z/VM but not whith LPAR. | ||
9 | * | ||
10 | * On LPAR, the watchdog will always trigger a system restart. the module | ||
11 | * paramter cmd is meaningless here. | ||
12 | * | ||
13 | * | ||
14 | * Copyright IBM Corp. 2004, 2013 | ||
15 | * Author(s): Arnd Bergmann (arndb@de.ibm.com) | ||
16 | * Philipp Hachtmann (phacht@de.ibm.com) | ||
17 | * | ||
18 | */ | ||
19 | |||
20 | #define KMSG_COMPONENT "diag288_wdt" | ||
21 | #define pr_fmt(fmt) KMSG_COMPONENT ": " fmt | ||
22 | |||
23 | #include <linux/init.h> | ||
24 | #include <linux/kernel.h> | ||
25 | #include <linux/module.h> | ||
26 | #include <linux/moduleparam.h> | ||
27 | #include <linux/slab.h> | ||
28 | #include <linux/miscdevice.h> | ||
29 | #include <linux/watchdog.h> | ||
30 | #include <linux/suspend.h> | ||
31 | #include <asm/ebcdic.h> | ||
32 | #include <linux/io.h> | ||
33 | #include <linux/uaccess.h> | ||
34 | |||
35 | #define MAX_CMDLEN 240 | ||
36 | #define DEFAULT_CMD "SYSTEM RESTART" | ||
37 | |||
38 | #define MIN_INTERVAL 15 /* Minimal time supported by diag88 */ | ||
39 | #define MAX_INTERVAL 3600 /* One hour should be enough - pure estimation */ | ||
40 | |||
41 | #define WDT_DEFAULT_TIMEOUT 30 | ||
42 | |||
43 | /* Function codes - init, change, cancel */ | ||
44 | #define WDT_FUNC_INIT 0 | ||
45 | #define WDT_FUNC_CHANGE 1 | ||
46 | #define WDT_FUNC_CANCEL 2 | ||
47 | #define WDT_FUNC_CONCEAL 0x80000000 | ||
48 | |||
49 | /* Action codes for LPAR watchdog */ | ||
50 | #define LPARWDT_RESTART 0 | ||
51 | |||
52 | static char wdt_cmd[MAX_CMDLEN] = DEFAULT_CMD; | ||
53 | static bool conceal_on; | ||
54 | static bool nowayout_info = WATCHDOG_NOWAYOUT; | ||
55 | |||
56 | MODULE_LICENSE("GPL"); | ||
57 | MODULE_AUTHOR("Arnd Bergmann <arndb@de.ibm.com>"); | ||
58 | MODULE_AUTHOR("Philipp Hachtmann <phacht@de.ibm.com>"); | ||
59 | |||
60 | MODULE_DESCRIPTION("System z diag288 Watchdog Timer"); | ||
61 | |||
62 | module_param_string(cmd, wdt_cmd, MAX_CMDLEN, 0644); | ||
63 | MODULE_PARM_DESC(cmd, "CP command that is run when the watchdog triggers (z/VM only)"); | ||
64 | |||
65 | module_param_named(conceal, conceal_on, bool, 0644); | ||
66 | MODULE_PARM_DESC(conceal, "Enable the CONCEAL CP option while the watchdog is active (z/VM only)"); | ||
67 | |||
68 | module_param_named(nowayout, nowayout_info, bool, 0444); | ||
69 | MODULE_PARM_DESC(nowayout, "Watchdog cannot be stopped once started (default = CONFIG_WATCHDOG_NOWAYOUT)"); | ||
70 | |||
71 | MODULE_ALIAS_MISCDEV(WATCHDOG_MINOR); | ||
72 | MODULE_ALIAS("vmwatchdog"); | ||
73 | |||
74 | static int __diag288(unsigned int func, unsigned int timeout, | ||
75 | unsigned long action, unsigned int len) | ||
76 | { | ||
77 | register unsigned long __func asm("2") = func; | ||
78 | register unsigned long __timeout asm("3") = timeout; | ||
79 | register unsigned long __action asm("4") = action; | ||
80 | register unsigned long __len asm("5") = len; | ||
81 | int err; | ||
82 | |||
83 | err = -EINVAL; | ||
84 | asm volatile( | ||
85 | " diag %1, %3, 0x288\n" | ||
86 | "0: la %0, 0\n" | ||
87 | "1:\n" | ||
88 | EX_TABLE(0b, 1b) | ||
89 | : "+d" (err) : "d"(__func), "d"(__timeout), | ||
90 | "d"(__action), "d"(__len) : "1", "cc"); | ||
91 | return err; | ||
92 | } | ||
93 | |||
94 | static int __diag288_vm(unsigned int func, unsigned int timeout, | ||
95 | char *cmd, size_t len) | ||
96 | { | ||
97 | return __diag288(func, timeout, virt_to_phys(cmd), len); | ||
98 | } | ||
99 | |||
100 | static int __diag288_lpar(unsigned int func, unsigned int timeout, | ||
101 | unsigned long action) | ||
102 | { | ||
103 | return __diag288(func, timeout, action, 0); | ||
104 | } | ||
105 | |||
106 | static int wdt_start(struct watchdog_device *dev) | ||
107 | { | ||
108 | char *ebc_cmd; | ||
109 | size_t len; | ||
110 | int ret; | ||
111 | unsigned int func; | ||
112 | |||
113 | ret = -ENODEV; | ||
114 | |||
115 | if (MACHINE_IS_VM) { | ||
116 | ebc_cmd = kmalloc(MAX_CMDLEN, GFP_KERNEL); | ||
117 | if (!ebc_cmd) | ||
118 | return -ENOMEM; | ||
119 | len = strlcpy(ebc_cmd, wdt_cmd, MAX_CMDLEN); | ||
120 | ASCEBC(ebc_cmd, MAX_CMDLEN); | ||
121 | EBC_TOUPPER(ebc_cmd, MAX_CMDLEN); | ||
122 | |||
123 | func = conceal_on ? (WDT_FUNC_INIT | WDT_FUNC_CONCEAL) | ||
124 | : WDT_FUNC_INIT; | ||
125 | ret = __diag288_vm(func, dev->timeout, ebc_cmd, len); | ||
126 | WARN_ON(ret != 0); | ||
127 | kfree(ebc_cmd); | ||
128 | } | ||
129 | |||
130 | if (MACHINE_IS_LPAR) { | ||
131 | ret = __diag288_lpar(WDT_FUNC_INIT, | ||
132 | dev->timeout, LPARWDT_RESTART); | ||
133 | } | ||
134 | |||
135 | if (ret) { | ||
136 | pr_err("The watchdog cannot be activated\n"); | ||
137 | return ret; | ||
138 | } | ||
139 | pr_info("The watchdog was activated\n"); | ||
140 | return 0; | ||
141 | } | ||
142 | |||
143 | static int wdt_stop(struct watchdog_device *dev) | ||
144 | { | ||
145 | int ret; | ||
146 | |||
147 | ret = __diag288(WDT_FUNC_CANCEL, 0, 0, 0); | ||
148 | pr_info("The watchdog was deactivated\n"); | ||
149 | return ret; | ||
150 | } | ||
151 | |||
152 | static int wdt_ping(struct watchdog_device *dev) | ||
153 | { | ||
154 | char *ebc_cmd; | ||
155 | size_t len; | ||
156 | int ret; | ||
157 | unsigned int func; | ||
158 | |||
159 | ret = -ENODEV; | ||
160 | |||
161 | if (MACHINE_IS_VM) { | ||
162 | ebc_cmd = kmalloc(MAX_CMDLEN, GFP_KERNEL); | ||
163 | if (!ebc_cmd) | ||
164 | return -ENOMEM; | ||
165 | len = strlcpy(ebc_cmd, wdt_cmd, MAX_CMDLEN); | ||
166 | ASCEBC(ebc_cmd, MAX_CMDLEN); | ||
167 | EBC_TOUPPER(ebc_cmd, MAX_CMDLEN); | ||
168 | |||
169 | /* | ||
170 | * It seems to be ok to z/VM to use the init function to | ||
171 | * retrigger the watchdog. On LPAR WDT_FUNC_CHANGE must | ||
172 | * be used when the watchdog is running. | ||
173 | */ | ||
174 | func = conceal_on ? (WDT_FUNC_INIT | WDT_FUNC_CONCEAL) | ||
175 | : WDT_FUNC_INIT; | ||
176 | |||
177 | ret = __diag288_vm(func, dev->timeout, ebc_cmd, len); | ||
178 | WARN_ON(ret != 0); | ||
179 | kfree(ebc_cmd); | ||
180 | } | ||
181 | |||
182 | if (MACHINE_IS_LPAR) | ||
183 | ret = __diag288_lpar(WDT_FUNC_CHANGE, dev->timeout, 0); | ||
184 | |||
185 | if (ret) | ||
186 | pr_err("The watchdog timer cannot be started or reset\n"); | ||
187 | return ret; | ||
188 | } | ||
189 | |||
190 | static int wdt_set_timeout(struct watchdog_device * dev, unsigned int new_to) | ||
191 | { | ||
192 | dev->timeout = new_to; | ||
193 | return wdt_ping(dev); | ||
194 | } | ||
195 | |||
196 | static struct watchdog_ops wdt_ops = { | ||
197 | .owner = THIS_MODULE, | ||
198 | .start = wdt_start, | ||
199 | .stop = wdt_stop, | ||
200 | .ping = wdt_ping, | ||
201 | .set_timeout = wdt_set_timeout, | ||
202 | }; | ||
203 | |||
204 | static struct watchdog_info wdt_info = { | ||
205 | .options = WDIOF_SETTIMEOUT | WDIOF_MAGICCLOSE, | ||
206 | .firmware_version = 0, | ||
207 | .identity = "z Watchdog", | ||
208 | }; | ||
209 | |||
210 | static struct watchdog_device wdt_dev = { | ||
211 | .parent = NULL, | ||
212 | .info = &wdt_info, | ||
213 | .ops = &wdt_ops, | ||
214 | .bootstatus = 0, | ||
215 | .timeout = WDT_DEFAULT_TIMEOUT, | ||
216 | .min_timeout = MIN_INTERVAL, | ||
217 | .max_timeout = MAX_INTERVAL, | ||
218 | }; | ||
219 | |||
220 | /* | ||
221 | * It makes no sense to go into suspend while the watchdog is running. | ||
222 | * Depending on the memory size, the watchdog might trigger, while we | ||
223 | * are still saving the memory. | ||
224 | * We reuse the open flag to ensure that suspend and watchdog open are | ||
225 | * exclusive operations | ||
226 | */ | ||
227 | static int wdt_suspend(void) | ||
228 | { | ||
229 | if (test_and_set_bit(WDOG_DEV_OPEN, &wdt_dev.status)) { | ||
230 | pr_err("Linux cannot be suspended while the watchdog is in use\n"); | ||
231 | return notifier_from_errno(-EBUSY); | ||
232 | } | ||
233 | if (test_bit(WDOG_ACTIVE, &wdt_dev.status)) { | ||
234 | clear_bit(WDOG_DEV_OPEN, &wdt_dev.status); | ||
235 | pr_err("Linux cannot be suspended while the watchdog is in use\n"); | ||
236 | return notifier_from_errno(-EBUSY); | ||
237 | } | ||
238 | return NOTIFY_DONE; | ||
239 | } | ||
240 | |||
241 | static int wdt_resume(void) | ||
242 | { | ||
243 | clear_bit(WDOG_DEV_OPEN, &wdt_dev.status); | ||
244 | return NOTIFY_DONE; | ||
245 | } | ||
246 | |||
247 | static int wdt_power_event(struct notifier_block *this, unsigned long event, | ||
248 | void *ptr) | ||
249 | { | ||
250 | switch (event) { | ||
251 | case PM_POST_HIBERNATION: | ||
252 | case PM_POST_SUSPEND: | ||
253 | return wdt_resume(); | ||
254 | case PM_HIBERNATION_PREPARE: | ||
255 | case PM_SUSPEND_PREPARE: | ||
256 | return wdt_suspend(); | ||
257 | default: | ||
258 | return NOTIFY_DONE; | ||
259 | } | ||
260 | } | ||
261 | |||
262 | static struct notifier_block wdt_power_notifier = { | ||
263 | .notifier_call = wdt_power_event, | ||
264 | }; | ||
265 | |||
266 | static int __init diag288_init(void) | ||
267 | { | ||
268 | int ret; | ||
269 | char ebc_begin[] = { | ||
270 | 194, 197, 199, 201, 213 | ||
271 | }; | ||
272 | |||
273 | watchdog_set_nowayout(&wdt_dev, nowayout_info); | ||
274 | |||
275 | if (MACHINE_IS_VM) { | ||
276 | pr_info("The watchdog device driver detected a z/VM environment\n"); | ||
277 | if (__diag288_vm(WDT_FUNC_INIT, 15, | ||
278 | ebc_begin, sizeof(ebc_begin)) != 0) { | ||
279 | pr_err("The watchdog cannot be initialized\n"); | ||
280 | return -EINVAL; | ||
281 | } | ||
282 | } else if (MACHINE_IS_LPAR) { | ||
283 | pr_info("The watchdog device driver detected an LPAR environment\n"); | ||
284 | if (__diag288_lpar(WDT_FUNC_INIT, 30, LPARWDT_RESTART)) { | ||
285 | pr_err("The watchdog cannot be initialized\n"); | ||
286 | return -EINVAL; | ||
287 | } | ||
288 | } else { | ||
289 | pr_err("Linux runs in an environment that does not support the diag288 watchdog\n"); | ||
290 | return -ENODEV; | ||
291 | } | ||
292 | |||
293 | if (__diag288_lpar(WDT_FUNC_CANCEL, 0, 0)) { | ||
294 | pr_err("The watchdog cannot be deactivated\n"); | ||
295 | return -EINVAL; | ||
296 | } | ||
297 | |||
298 | ret = register_pm_notifier(&wdt_power_notifier); | ||
299 | if (ret) | ||
300 | return ret; | ||
301 | |||
302 | ret = watchdog_register_device(&wdt_dev); | ||
303 | if (ret) | ||
304 | unregister_pm_notifier(&wdt_power_notifier); | ||
305 | |||
306 | return ret; | ||
307 | } | ||
308 | |||
309 | static void __exit diag288_exit(void) | ||
310 | { | ||
311 | watchdog_unregister_device(&wdt_dev); | ||
312 | unregister_pm_notifier(&wdt_power_notifier); | ||
313 | } | ||
314 | |||
315 | module_init(diag288_init); | ||
316 | module_exit(diag288_exit); | ||
diff --git a/drivers/xen/grant-table.c b/drivers/xen/grant-table.c index 6d325bda76da..5d4de88fe5b8 100644 --- a/drivers/xen/grant-table.c +++ b/drivers/xen/grant-table.c | |||
@@ -1168,7 +1168,8 @@ int gnttab_resume(void) | |||
1168 | 1168 | ||
1169 | int gnttab_suspend(void) | 1169 | int gnttab_suspend(void) |
1170 | { | 1170 | { |
1171 | gnttab_interface->unmap_frames(); | 1171 | if (!xen_feature(XENFEAT_auto_translated_physmap)) |
1172 | gnttab_interface->unmap_frames(); | ||
1172 | return 0; | 1173 | return 0; |
1173 | } | 1174 | } |
1174 | 1175 | ||