diff options
Diffstat (limited to 'drivers')
587 files changed, 7335 insertions, 3477 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..350d52a8f781 100644 --- a/drivers/acpi/video.c +++ b/drivers/acpi/video.c | |||
| @@ -68,7 +68,7 @@ MODULE_AUTHOR("Bruno Ducrot"); | |||
| 68 | MODULE_DESCRIPTION("ACPI Video Driver"); | 68 | MODULE_DESCRIPTION("ACPI Video Driver"); |
| 69 | MODULE_LICENSE("GPL"); | 69 | MODULE_LICENSE("GPL"); |
| 70 | 70 | ||
| 71 | static bool brightness_switch_enabled; | 71 | static bool brightness_switch_enabled = 1; |
| 72 | module_param(brightness_switch_enabled, bool, 0644); | 72 | module_param(brightness_switch_enabled, bool, 0644); |
| 73 | 73 | ||
| 74 | /* | 74 | /* |
| @@ -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 = { |
| @@ -572,6 +581,14 @@ static struct dmi_system_id video_dmi_table[] __initdata = { | |||
| 572 | }, | 581 | }, |
| 573 | { | 582 | { |
| 574 | .callback = video_set_use_native_backlight, | 583 | .callback = video_set_use_native_backlight, |
| 584 | .ident = "HP ProBook 4540s", | ||
| 585 | .matches = { | ||
| 586 | DMI_MATCH(DMI_SYS_VENDOR, "Hewlett-Packard"), | ||
| 587 | DMI_MATCH(DMI_PRODUCT_VERSION, "HP ProBook 4540s"), | ||
| 588 | }, | ||
| 589 | }, | ||
| 590 | { | ||
| 591 | .callback = video_set_use_native_backlight, | ||
| 575 | .ident = "HP ProBook 2013 models", | 592 | .ident = "HP ProBook 2013 models", |
| 576 | .matches = { | 593 | .matches = { |
| 577 | DMI_MATCH(DMI_SYS_VENDOR, "Hewlett-Packard"), | 594 | DMI_MATCH(DMI_SYS_VENDOR, "Hewlett-Packard"), |
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.c b/drivers/ata/ahci.c index dae5607e1115..4cd52a4541a9 100644 --- a/drivers/ata/ahci.c +++ b/drivers/ata/ahci.c | |||
| @@ -456,6 +456,7 @@ static const struct pci_device_id ahci_pci_tbl[] = { | |||
| 456 | 456 | ||
| 457 | /* Promise */ | 457 | /* Promise */ |
| 458 | { PCI_VDEVICE(PROMISE, 0x3f20), board_ahci }, /* PDC42819 */ | 458 | { PCI_VDEVICE(PROMISE, 0x3f20), board_ahci }, /* PDC42819 */ |
| 459 | { PCI_VDEVICE(PROMISE, 0x3781), board_ahci }, /* FastTrak TX8660 ahci-mode */ | ||
| 459 | 460 | ||
| 460 | /* Asmedia */ | 461 | /* Asmedia */ |
| 461 | { PCI_VDEVICE(ASMEDIA, 0x0601), board_ahci }, /* ASM1060 */ | 462 | { PCI_VDEVICE(ASMEDIA, 0x0601), board_ahci }, /* ASM1060 */ |
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/ata/libata-core.c b/drivers/ata/libata-core.c index 18d97d5c7d90..677c0c1b03bd 100644 --- a/drivers/ata/libata-core.c +++ b/drivers/ata/libata-core.c | |||
| @@ -4787,6 +4787,10 @@ void swap_buf_le16(u16 *buf, unsigned int buf_words) | |||
| 4787 | * ata_qc_new - Request an available ATA command, for queueing | 4787 | * ata_qc_new - Request an available ATA command, for queueing |
| 4788 | * @ap: target port | 4788 | * @ap: target port |
| 4789 | * | 4789 | * |
| 4790 | * Some ATA host controllers may implement a queue depth which is less | ||
| 4791 | * than ATA_MAX_QUEUE. So we shouldn't allocate a tag which is beyond | ||
| 4792 | * the hardware limitation. | ||
| 4793 | * | ||
| 4790 | * LOCKING: | 4794 | * LOCKING: |
| 4791 | * None. | 4795 | * None. |
| 4792 | */ | 4796 | */ |
| @@ -4794,14 +4798,15 @@ void swap_buf_le16(u16 *buf, unsigned int buf_words) | |||
| 4794 | static struct ata_queued_cmd *ata_qc_new(struct ata_port *ap) | 4798 | static struct ata_queued_cmd *ata_qc_new(struct ata_port *ap) |
| 4795 | { | 4799 | { |
| 4796 | struct ata_queued_cmd *qc = NULL; | 4800 | struct ata_queued_cmd *qc = NULL; |
| 4801 | unsigned int max_queue = ap->host->n_tags; | ||
| 4797 | unsigned int i, tag; | 4802 | unsigned int i, tag; |
| 4798 | 4803 | ||
| 4799 | /* no command while frozen */ | 4804 | /* no command while frozen */ |
| 4800 | if (unlikely(ap->pflags & ATA_PFLAG_FROZEN)) | 4805 | if (unlikely(ap->pflags & ATA_PFLAG_FROZEN)) |
| 4801 | return NULL; | 4806 | return NULL; |
| 4802 | 4807 | ||
| 4803 | for (i = 0; i < ATA_MAX_QUEUE; i++) { | 4808 | for (i = 0, tag = ap->last_tag + 1; i < max_queue; i++, tag++) { |
| 4804 | tag = (i + ap->last_tag + 1) % ATA_MAX_QUEUE; | 4809 | tag = tag < max_queue ? tag : 0; |
| 4805 | 4810 | ||
| 4806 | /* the last tag is reserved for internal command. */ | 4811 | /* the last tag is reserved for internal command. */ |
| 4807 | if (tag == ATA_TAG_INTERNAL) | 4812 | if (tag == ATA_TAG_INTERNAL) |
| @@ -6088,6 +6093,7 @@ void ata_host_init(struct ata_host *host, struct device *dev, | |||
| 6088 | { | 6093 | { |
| 6089 | spin_lock_init(&host->lock); | 6094 | spin_lock_init(&host->lock); |
| 6090 | mutex_init(&host->eh_mutex); | 6095 | mutex_init(&host->eh_mutex); |
| 6096 | host->n_tags = ATA_MAX_QUEUE - 1; | ||
| 6091 | host->dev = dev; | 6097 | host->dev = dev; |
| 6092 | host->ops = ops; | 6098 | host->ops = ops; |
| 6093 | } | 6099 | } |
| @@ -6169,6 +6175,8 @@ int ata_host_register(struct ata_host *host, struct scsi_host_template *sht) | |||
| 6169 | { | 6175 | { |
| 6170 | int i, rc; | 6176 | int i, rc; |
| 6171 | 6177 | ||
| 6178 | host->n_tags = clamp(sht->can_queue, 1, ATA_MAX_QUEUE - 1); | ||
| 6179 | |||
| 6172 | /* host must have been started */ | 6180 | /* host must have been started */ |
| 6173 | if (!(host->flags & ATA_HOST_STARTED)) { | 6181 | if (!(host->flags & ATA_HOST_STARTED)) { |
| 6174 | dev_err(host->dev, "BUG: trying to register unstarted host\n"); | 6182 | dev_err(host->dev, "BUG: trying to register unstarted host\n"); |
diff --git a/drivers/ata/libata-eh.c b/drivers/ata/libata-eh.c index 6760fc4e85b8..dad83df555c4 100644 --- a/drivers/ata/libata-eh.c +++ b/drivers/ata/libata-eh.c | |||
| @@ -1811,7 +1811,7 @@ static unsigned int ata_eh_analyze_tf(struct ata_queued_cmd *qc, | |||
| 1811 | case ATA_DEV_ATA: | 1811 | case ATA_DEV_ATA: |
| 1812 | if (err & ATA_ICRC) | 1812 | if (err & ATA_ICRC) |
| 1813 | qc->err_mask |= AC_ERR_ATA_BUS; | 1813 | qc->err_mask |= AC_ERR_ATA_BUS; |
| 1814 | if (err & ATA_UNC) | 1814 | if (err & (ATA_UNC | ATA_AMNF)) |
| 1815 | qc->err_mask |= AC_ERR_MEDIA; | 1815 | qc->err_mask |= AC_ERR_MEDIA; |
| 1816 | if (err & ATA_IDNF) | 1816 | if (err & ATA_IDNF) |
| 1817 | qc->err_mask |= AC_ERR_INVALID; | 1817 | qc->err_mask |= AC_ERR_INVALID; |
| @@ -2556,11 +2556,12 @@ static void ata_eh_link_report(struct ata_link *link) | |||
| 2556 | } | 2556 | } |
| 2557 | 2557 | ||
| 2558 | if (cmd->command != ATA_CMD_PACKET && | 2558 | if (cmd->command != ATA_CMD_PACKET && |
| 2559 | (res->feature & (ATA_ICRC | ATA_UNC | ATA_IDNF | | 2559 | (res->feature & (ATA_ICRC | ATA_UNC | ATA_AMNF | |
| 2560 | ATA_ABORTED))) | 2560 | ATA_IDNF | ATA_ABORTED))) |
| 2561 | ata_dev_err(qc->dev, "error: { %s%s%s%s}\n", | 2561 | ata_dev_err(qc->dev, "error: { %s%s%s%s%s}\n", |
| 2562 | res->feature & ATA_ICRC ? "ICRC " : "", | 2562 | res->feature & ATA_ICRC ? "ICRC " : "", |
| 2563 | res->feature & ATA_UNC ? "UNC " : "", | 2563 | res->feature & ATA_UNC ? "UNC " : "", |
| 2564 | res->feature & ATA_AMNF ? "AMNF " : "", | ||
| 2564 | res->feature & ATA_IDNF ? "IDNF " : "", | 2565 | res->feature & ATA_IDNF ? "IDNF " : "", |
| 2565 | res->feature & ATA_ABORTED ? "ABRT " : ""); | 2566 | res->feature & ATA_ABORTED ? "ABRT " : ""); |
| 2566 | #endif | 2567 | #endif |
diff --git a/drivers/ata/pata_ep93xx.c b/drivers/ata/pata_ep93xx.c index 6ad5c072ce34..4d37c5415fc7 100644 --- a/drivers/ata/pata_ep93xx.c +++ b/drivers/ata/pata_ep93xx.c | |||
| @@ -915,7 +915,7 @@ static int ep93xx_pata_probe(struct platform_device *pdev) | |||
| 915 | struct ep93xx_pata_data *drv_data; | 915 | struct ep93xx_pata_data *drv_data; |
| 916 | struct ata_host *host; | 916 | struct ata_host *host; |
| 917 | struct ata_port *ap; | 917 | struct ata_port *ap; |
| 918 | unsigned int irq; | 918 | int irq; |
| 919 | struct resource *mem_res; | 919 | struct resource *mem_res; |
| 920 | void __iomem *ide_base; | 920 | void __iomem *ide_base; |
| 921 | int err; | 921 | int err; |
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/base/platform.c b/drivers/base/platform.c index 9e9227e1762d..eee48c49f5de 100644 --- a/drivers/base/platform.c +++ b/drivers/base/platform.c | |||
| @@ -89,8 +89,13 @@ int platform_get_irq(struct platform_device *dev, unsigned int num) | |||
| 89 | return dev->archdata.irqs[num]; | 89 | return dev->archdata.irqs[num]; |
| 90 | #else | 90 | #else |
| 91 | struct resource *r; | 91 | struct resource *r; |
| 92 | if (IS_ENABLED(CONFIG_OF_IRQ) && dev->dev.of_node) | 92 | if (IS_ENABLED(CONFIG_OF_IRQ) && dev->dev.of_node) { |
| 93 | return of_irq_get(dev->dev.of_node, num); | 93 | int ret; |
| 94 | |||
| 95 | ret = of_irq_get(dev->dev.of_node, num); | ||
| 96 | if (ret >= 0 || ret == -EPROBE_DEFER) | ||
| 97 | return ret; | ||
| 98 | } | ||
| 94 | 99 | ||
| 95 | r = platform_get_resource(dev, IORESOURCE_IRQ, num); | 100 | r = platform_get_resource(dev, IORESOURCE_IRQ, num); |
| 96 | 101 | ||
| @@ -133,8 +138,13 @@ int platform_get_irq_byname(struct platform_device *dev, const char *name) | |||
| 133 | { | 138 | { |
| 134 | struct resource *r; | 139 | struct resource *r; |
| 135 | 140 | ||
| 136 | if (IS_ENABLED(CONFIG_OF_IRQ) && dev->dev.of_node) | 141 | if (IS_ENABLED(CONFIG_OF_IRQ) && dev->dev.of_node) { |
| 137 | return of_irq_get_byname(dev->dev.of_node, name); | 142 | int ret; |
| 143 | |||
| 144 | ret = of_irq_get_byname(dev->dev.of_node, name); | ||
| 145 | if (ret >= 0 || ret == -EPROBE_DEFER) | ||
| 146 | return ret; | ||
| 147 | } | ||
| 138 | 148 | ||
| 139 | r = platform_get_resource_byname(dev, IORESOURCE_IRQ, name); | 149 | r = platform_get_resource_byname(dev, IORESOURCE_IRQ, name); |
| 140 | return r ? r->start : -ENXIO; | 150 | return r ? r->start : -ENXIO; |
diff --git a/drivers/block/drbd/drbd_nl.c b/drivers/block/drbd/drbd_nl.c index 1b35c45c92b7..3f2e16738080 100644 --- a/drivers/block/drbd/drbd_nl.c +++ b/drivers/block/drbd/drbd_nl.c | |||
| @@ -544,6 +544,12 @@ void conn_try_outdate_peer_async(struct drbd_connection *connection) | |||
| 544 | struct task_struct *opa; | 544 | struct task_struct *opa; |
| 545 | 545 | ||
| 546 | kref_get(&connection->kref); | 546 | kref_get(&connection->kref); |
| 547 | /* We may just have force_sig()'ed this thread | ||
| 548 | * to get it out of some blocking network function. | ||
| 549 | * Clear signals; otherwise kthread_run(), which internally uses | ||
| 550 | * wait_on_completion_killable(), will mistake our pending signal | ||
| 551 | * for a new fatal signal and fail. */ | ||
| 552 | flush_signals(current); | ||
| 547 | opa = kthread_run(_try_outdate_peer_async, connection, "drbd_async_h"); | 553 | opa = kthread_run(_try_outdate_peer_async, connection, "drbd_async_h"); |
| 548 | if (IS_ERR(opa)) { | 554 | if (IS_ERR(opa)) { |
| 549 | drbd_err(connection, "out of mem, failed to invoke fence-peer helper\n"); | 555 | drbd_err(connection, "out of mem, failed to invoke fence-peer helper\n"); |
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..36e54be402df 100644 --- a/drivers/block/zram/zram_drv.c +++ b/drivers/block/zram/zram_drv.c | |||
| @@ -624,7 +624,16 @@ static void zram_reset_device(struct zram *zram, bool reset_capacity) | |||
| 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 | |||
| 627 | up_write(&zram->init_lock); | 628 | up_write(&zram->init_lock); |
| 629 | |||
| 630 | /* | ||
| 631 | * Revalidate disk out of the init_lock to avoid lockdep splat. | ||
| 632 | * It's okay because disk's capacity is protected by init_lock | ||
| 633 | * so that revalidate_disk always sees up-to-date capacity. | ||
| 634 | */ | ||
| 635 | if (reset_capacity) | ||
| 636 | revalidate_disk(zram->disk); | ||
| 628 | } | 637 | } |
| 629 | 638 | ||
| 630 | static ssize_t disksize_store(struct device *dev, | 639 | static ssize_t disksize_store(struct device *dev, |
| @@ -665,6 +674,14 @@ static ssize_t disksize_store(struct device *dev, | |||
| 665 | zram->disksize = disksize; | 674 | zram->disksize = disksize; |
| 666 | set_capacity(zram->disk, zram->disksize >> SECTOR_SHIFT); | 675 | set_capacity(zram->disk, zram->disksize >> SECTOR_SHIFT); |
| 667 | up_write(&zram->init_lock); | 676 | up_write(&zram->init_lock); |
| 677 | |||
| 678 | /* | ||
| 679 | * Revalidate disk out of the init_lock to avoid lockdep splat. | ||
| 680 | * It's okay because disk's capacity is protected by init_lock | ||
| 681 | * so that revalidate_disk always sees up-to-date capacity. | ||
| 682 | */ | ||
| 683 | revalidate_disk(zram->disk); | ||
| 684 | |||
| 668 | return len; | 685 | return len; |
| 669 | 686 | ||
| 670 | out_destroy_comp: | 687 | out_destroy_comp: |
diff --git a/drivers/bluetooth/ath3k.c b/drivers/bluetooth/ath3k.c index f98380648cb3..f50dffc0374f 100644 --- a/drivers/bluetooth/ath3k.c +++ b/drivers/bluetooth/ath3k.c | |||
| @@ -90,7 +90,6 @@ static const struct usb_device_id ath3k_table[] = { | |||
| 90 | { USB_DEVICE(0x0b05, 0x17d0) }, | 90 | { USB_DEVICE(0x0b05, 0x17d0) }, |
| 91 | { USB_DEVICE(0x0CF3, 0x0036) }, | 91 | { USB_DEVICE(0x0CF3, 0x0036) }, |
| 92 | { USB_DEVICE(0x0CF3, 0x3004) }, | 92 | { USB_DEVICE(0x0CF3, 0x3004) }, |
| 93 | { USB_DEVICE(0x0CF3, 0x3005) }, | ||
| 94 | { USB_DEVICE(0x0CF3, 0x3008) }, | 93 | { USB_DEVICE(0x0CF3, 0x3008) }, |
| 95 | { USB_DEVICE(0x0CF3, 0x311D) }, | 94 | { USB_DEVICE(0x0CF3, 0x311D) }, |
| 96 | { USB_DEVICE(0x0CF3, 0x311E) }, | 95 | { USB_DEVICE(0x0CF3, 0x311E) }, |
| @@ -140,7 +139,6 @@ static const struct usb_device_id ath3k_blist_tbl[] = { | |||
| 140 | { USB_DEVICE(0x0b05, 0x17d0), .driver_info = BTUSB_ATH3012 }, | 139 | { USB_DEVICE(0x0b05, 0x17d0), .driver_info = BTUSB_ATH3012 }, |
| 141 | { USB_DEVICE(0x0CF3, 0x0036), .driver_info = BTUSB_ATH3012 }, | 140 | { USB_DEVICE(0x0CF3, 0x0036), .driver_info = BTUSB_ATH3012 }, |
| 142 | { USB_DEVICE(0x0cf3, 0x3004), .driver_info = BTUSB_ATH3012 }, | 141 | { USB_DEVICE(0x0cf3, 0x3004), .driver_info = BTUSB_ATH3012 }, |
| 143 | { USB_DEVICE(0x0cf3, 0x3005), .driver_info = BTUSB_ATH3012 }, | ||
| 144 | { USB_DEVICE(0x0cf3, 0x3008), .driver_info = BTUSB_ATH3012 }, | 142 | { USB_DEVICE(0x0cf3, 0x3008), .driver_info = BTUSB_ATH3012 }, |
| 145 | { USB_DEVICE(0x0cf3, 0x311D), .driver_info = BTUSB_ATH3012 }, | 143 | { USB_DEVICE(0x0cf3, 0x311D), .driver_info = BTUSB_ATH3012 }, |
| 146 | { USB_DEVICE(0x0cf3, 0x311E), .driver_info = BTUSB_ATH3012 }, | 144 | { USB_DEVICE(0x0cf3, 0x311E), .driver_info = BTUSB_ATH3012 }, |
diff --git a/drivers/bluetooth/btusb.c b/drivers/bluetooth/btusb.c index a1c80b0c7663..6250fc2fb93a 100644 --- a/drivers/bluetooth/btusb.c +++ b/drivers/bluetooth/btusb.c | |||
| @@ -162,7 +162,6 @@ static const struct usb_device_id blacklist_table[] = { | |||
| 162 | { USB_DEVICE(0x0b05, 0x17d0), .driver_info = BTUSB_ATH3012 }, | 162 | { USB_DEVICE(0x0b05, 0x17d0), .driver_info = BTUSB_ATH3012 }, |
| 163 | { USB_DEVICE(0x0cf3, 0x0036), .driver_info = BTUSB_ATH3012 }, | 163 | { USB_DEVICE(0x0cf3, 0x0036), .driver_info = BTUSB_ATH3012 }, |
| 164 | { USB_DEVICE(0x0cf3, 0x3004), .driver_info = BTUSB_ATH3012 }, | 164 | { USB_DEVICE(0x0cf3, 0x3004), .driver_info = BTUSB_ATH3012 }, |
| 165 | { USB_DEVICE(0x0cf3, 0x3005), .driver_info = BTUSB_ATH3012 }, | ||
| 166 | { USB_DEVICE(0x0cf3, 0x3008), .driver_info = BTUSB_ATH3012 }, | 165 | { USB_DEVICE(0x0cf3, 0x3008), .driver_info = BTUSB_ATH3012 }, |
| 167 | { USB_DEVICE(0x0cf3, 0x311d), .driver_info = BTUSB_ATH3012 }, | 166 | { USB_DEVICE(0x0cf3, 0x311d), .driver_info = BTUSB_ATH3012 }, |
| 168 | { USB_DEVICE(0x0cf3, 0x311e), .driver_info = BTUSB_ATH3012 }, | 167 | { USB_DEVICE(0x0cf3, 0x311e), .driver_info = BTUSB_ATH3012 }, |
diff --git a/drivers/bluetooth/hci_h5.c b/drivers/bluetooth/hci_h5.c index 04680ead9275..fede8ca7147c 100644 --- a/drivers/bluetooth/hci_h5.c +++ b/drivers/bluetooth/hci_h5.c | |||
| @@ -406,6 +406,7 @@ static int h5_rx_3wire_hdr(struct hci_uart *hu, unsigned char c) | |||
| 406 | H5_HDR_PKT_TYPE(hdr) != HCI_3WIRE_LINK_PKT) { | 406 | H5_HDR_PKT_TYPE(hdr) != HCI_3WIRE_LINK_PKT) { |
| 407 | BT_ERR("Non-link packet received in non-active state"); | 407 | BT_ERR("Non-link packet received in non-active state"); |
| 408 | h5_reset_rx(h5); | 408 | h5_reset_rx(h5); |
| 409 | return 0; | ||
| 409 | } | 410 | } |
| 410 | 411 | ||
| 411 | h5->rx_func = h5_rx_payload; | 412 | h5->rx_func = h5_rx_payload; |
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/hw_random/core.c b/drivers/char/hw_random/core.c index 334601cc81cf..c4419ea1ab07 100644 --- a/drivers/char/hw_random/core.c +++ b/drivers/char/hw_random/core.c | |||
| @@ -55,16 +55,41 @@ static DEFINE_MUTEX(rng_mutex); | |||
| 55 | static int data_avail; | 55 | static int data_avail; |
| 56 | static u8 *rng_buffer; | 56 | static u8 *rng_buffer; |
| 57 | 57 | ||
| 58 | static inline int rng_get_data(struct hwrng *rng, u8 *buffer, size_t size, | ||
| 59 | int wait); | ||
| 60 | |||
| 58 | static size_t rng_buffer_size(void) | 61 | static size_t rng_buffer_size(void) |
| 59 | { | 62 | { |
| 60 | return SMP_CACHE_BYTES < 32 ? 32 : SMP_CACHE_BYTES; | 63 | return SMP_CACHE_BYTES < 32 ? 32 : SMP_CACHE_BYTES; |
| 61 | } | 64 | } |
| 62 | 65 | ||
| 66 | static void add_early_randomness(struct hwrng *rng) | ||
| 67 | { | ||
| 68 | unsigned char bytes[16]; | ||
| 69 | int bytes_read; | ||
| 70 | |||
| 71 | /* | ||
| 72 | * Currently only virtio-rng cannot return data during device | ||
| 73 | * probe, and that's handled in virtio-rng.c itself. If there | ||
| 74 | * are more such devices, this call to rng_get_data can be | ||
| 75 | * made conditional here instead of doing it per-device. | ||
| 76 | */ | ||
| 77 | bytes_read = rng_get_data(rng, bytes, sizeof(bytes), 1); | ||
| 78 | if (bytes_read > 0) | ||
| 79 | add_device_randomness(bytes, bytes_read); | ||
| 80 | } | ||
| 81 | |||
| 63 | static inline int hwrng_init(struct hwrng *rng) | 82 | static inline int hwrng_init(struct hwrng *rng) |
| 64 | { | 83 | { |
| 65 | if (!rng->init) | 84 | if (rng->init) { |
| 66 | return 0; | 85 | int ret; |
| 67 | return rng->init(rng); | 86 | |
| 87 | ret = rng->init(rng); | ||
| 88 | if (ret) | ||
| 89 | return ret; | ||
| 90 | } | ||
| 91 | add_early_randomness(rng); | ||
| 92 | return 0; | ||
| 68 | } | 93 | } |
| 69 | 94 | ||
| 70 | static inline void hwrng_cleanup(struct hwrng *rng) | 95 | static inline void hwrng_cleanup(struct hwrng *rng) |
| @@ -304,8 +329,6 @@ int hwrng_register(struct hwrng *rng) | |||
| 304 | { | 329 | { |
| 305 | int err = -EINVAL; | 330 | int err = -EINVAL; |
| 306 | struct hwrng *old_rng, *tmp; | 331 | struct hwrng *old_rng, *tmp; |
| 307 | unsigned char bytes[16]; | ||
| 308 | int bytes_read; | ||
| 309 | 332 | ||
| 310 | if (rng->name == NULL || | 333 | if (rng->name == NULL || |
| 311 | (rng->data_read == NULL && rng->read == NULL)) | 334 | (rng->data_read == NULL && rng->read == NULL)) |
| @@ -347,9 +370,17 @@ int hwrng_register(struct hwrng *rng) | |||
| 347 | INIT_LIST_HEAD(&rng->list); | 370 | INIT_LIST_HEAD(&rng->list); |
| 348 | list_add_tail(&rng->list, &rng_list); | 371 | list_add_tail(&rng->list, &rng_list); |
| 349 | 372 | ||
| 350 | bytes_read = rng_get_data(rng, bytes, sizeof(bytes), 1); | 373 | if (old_rng && !rng->init) { |
| 351 | if (bytes_read > 0) | 374 | /* |
| 352 | add_device_randomness(bytes, bytes_read); | 375 | * Use a new device's input to add some randomness to |
| 376 | * the system. If this rng device isn't going to be | ||
| 377 | * used right away, its init function hasn't been | ||
| 378 | * called yet; so only use the randomness from devices | ||
| 379 | * that don't need an init callback. | ||
| 380 | */ | ||
| 381 | add_early_randomness(rng); | ||
| 382 | } | ||
| 383 | |||
| 353 | out_unlock: | 384 | out_unlock: |
| 354 | mutex_unlock(&rng_mutex); | 385 | mutex_unlock(&rng_mutex); |
| 355 | out: | 386 | out: |
diff --git a/drivers/char/hw_random/virtio-rng.c b/drivers/char/hw_random/virtio-rng.c index f3e71501de54..e9b15bc18b4d 100644 --- a/drivers/char/hw_random/virtio-rng.c +++ b/drivers/char/hw_random/virtio-rng.c | |||
| @@ -38,6 +38,8 @@ struct virtrng_info { | |||
| 38 | int index; | 38 | int index; |
| 39 | }; | 39 | }; |
| 40 | 40 | ||
| 41 | static bool probe_done; | ||
| 42 | |||
| 41 | static void random_recv_done(struct virtqueue *vq) | 43 | static void random_recv_done(struct virtqueue *vq) |
| 42 | { | 44 | { |
| 43 | struct virtrng_info *vi = vq->vdev->priv; | 45 | struct virtrng_info *vi = vq->vdev->priv; |
| @@ -67,6 +69,13 @@ static int virtio_read(struct hwrng *rng, void *buf, size_t size, bool wait) | |||
| 67 | int ret; | 69 | int ret; |
| 68 | struct virtrng_info *vi = (struct virtrng_info *)rng->priv; | 70 | struct virtrng_info *vi = (struct virtrng_info *)rng->priv; |
| 69 | 71 | ||
| 72 | /* | ||
| 73 | * Don't ask host for data till we're setup. This call can | ||
| 74 | * happen during hwrng_register(), after commit d9e7972619. | ||
| 75 | */ | ||
| 76 | if (unlikely(!probe_done)) | ||
| 77 | return 0; | ||
| 78 | |||
| 70 | if (!vi->busy) { | 79 | if (!vi->busy) { |
| 71 | vi->busy = true; | 80 | vi->busy = true; |
| 72 | init_completion(&vi->have_data); | 81 | init_completion(&vi->have_data); |
| @@ -137,6 +146,7 @@ static int probe_common(struct virtio_device *vdev) | |||
| 137 | return err; | 146 | return err; |
| 138 | } | 147 | } |
| 139 | 148 | ||
| 149 | probe_done = true; | ||
| 140 | return 0; | 150 | return 0; |
| 141 | } | 151 | } |
| 142 | 152 | ||
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..71529e196b84 100644 --- a/drivers/char/random.c +++ b/drivers/char/random.c | |||
| @@ -641,7 +641,7 @@ retry: | |||
| 641 | } while (unlikely(entropy_count < pool_size-2 && pnfrac)); | 641 | } while (unlikely(entropy_count < pool_size-2 && pnfrac)); |
| 642 | } | 642 | } |
| 643 | 643 | ||
| 644 | if (entropy_count < 0) { | 644 | if (unlikely(entropy_count < 0)) { |
| 645 | pr_warn("random: negative entropy/overflow: pool %s count %d\n", | 645 | pr_warn("random: negative entropy/overflow: pool %s count %d\n", |
| 646 | r->name, entropy_count); | 646 | r->name, entropy_count); |
| 647 | WARN_ON(1); | 647 | WARN_ON(1); |
| @@ -980,26 +980,37 @@ 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, nfrac; |
| 986 | 985 | ||
| 987 | BUG_ON(r->entropy_count > r->poolinfo->poolfracbits); | 986 | BUG_ON(r->entropy_count > r->poolinfo->poolfracbits); |
| 988 | 987 | ||
| 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 | |
| 1000 | entropy_count -= ibytes << (ENTROPY_SHIFT + 3); | 1003 | if (unlikely(entropy_count < 0)) { |
| 1004 | pr_warn("random: negative entropy count: pool %s count %d\n", | ||
| 1005 | r->name, entropy_count); | ||
| 1006 | WARN_ON(1); | ||
| 1007 | entropy_count = 0; | ||
| 1008 | } | ||
| 1009 | nfrac = ibytes << (ENTROPY_SHIFT + 3); | ||
| 1010 | if ((size_t) entropy_count > nfrac) | ||
| 1011 | entropy_count -= nfrac; | ||
| 1001 | else | 1012 | else |
| 1002 | entropy_count = reserved << (ENTROPY_SHIFT + 3); | 1013 | entropy_count = 0; |
| 1003 | 1014 | ||
| 1004 | if (cmpxchg(&r->entropy_count, orig, entropy_count) != orig) | 1015 | if (cmpxchg(&r->entropy_count, orig, entropy_count) != orig) |
| 1005 | goto retry; | 1016 | goto retry; |
| @@ -1375,6 +1386,7 @@ urandom_read(struct file *file, char __user *buf, size_t nbytes, loff_t *ppos) | |||
| 1375 | "with %d bits of entropy available\n", | 1386 | "with %d bits of entropy available\n", |
| 1376 | current->comm, nonblocking_pool.entropy_total); | 1387 | current->comm, nonblocking_pool.entropy_total); |
| 1377 | 1388 | ||
| 1389 | nbytes = min_t(size_t, nbytes, INT_MAX >> (ENTROPY_SHIFT + 3)); | ||
| 1378 | ret = extract_entropy_user(&nonblocking_pool, buf, nbytes); | 1390 | ret = extract_entropy_user(&nonblocking_pool, buf, nbytes); |
| 1379 | 1391 | ||
| 1380 | trace_urandom_read(8 * nbytes, ENTROPY_BITS(&nonblocking_pool), | 1392 | trace_urandom_read(8 * nbytes, ENTROPY_BITS(&nonblocking_pool), |
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/clk-7xx.c b/drivers/clk/ti/clk-7xx.c index e1581335937d..cb8e6f14e880 100644 --- a/drivers/clk/ti/clk-7xx.c +++ b/drivers/clk/ti/clk-7xx.c | |||
| @@ -16,7 +16,7 @@ | |||
| 16 | #include <linux/clkdev.h> | 16 | #include <linux/clkdev.h> |
| 17 | #include <linux/clk/ti.h> | 17 | #include <linux/clk/ti.h> |
| 18 | 18 | ||
| 19 | #define DRA7_DPLL_ABE_DEFFREQ 361267200 | 19 | #define DRA7_DPLL_ABE_DEFFREQ 180633600 |
| 20 | #define DRA7_DPLL_GMAC_DEFFREQ 1000000000 | 20 | #define DRA7_DPLL_GMAC_DEFFREQ 1000000000 |
| 21 | 21 | ||
| 22 | 22 | ||
| @@ -322,6 +322,11 @@ int __init dra7xx_dt_clk_init(void) | |||
| 322 | if (rc) | 322 | if (rc) |
| 323 | pr_err("%s: failed to configure ABE DPLL!\n", __func__); | 323 | pr_err("%s: failed to configure ABE DPLL!\n", __func__); |
| 324 | 324 | ||
| 325 | dpll_ck = clk_get_sys(NULL, "dpll_abe_m2x2_ck"); | ||
| 326 | rc = clk_set_rate(dpll_ck, DRA7_DPLL_ABE_DEFFREQ * 2); | ||
| 327 | if (rc) | ||
| 328 | pr_err("%s: failed to configure ABE DPLL m2x2!\n", __func__); | ||
| 329 | |||
| 325 | dpll_ck = clk_get_sys(NULL, "dpll_gmac_ck"); | 330 | dpll_ck = clk_get_sys(NULL, "dpll_gmac_ck"); |
| 326 | rc = clk_set_rate(dpll_ck, DRA7_DPLL_GMAC_DEFFREQ); | 331 | rc = clk_set_rate(dpll_ck, DRA7_DPLL_GMAC_DEFFREQ); |
| 327 | if (rc) | 332 | if (rc) |
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/Kconfig.arm b/drivers/cpufreq/Kconfig.arm index ebac67115009..7364a538e056 100644 --- a/drivers/cpufreq/Kconfig.arm +++ b/drivers/cpufreq/Kconfig.arm | |||
| @@ -104,6 +104,7 @@ config ARM_IMX6Q_CPUFREQ | |||
| 104 | tristate "Freescale i.MX6 cpufreq support" | 104 | tristate "Freescale i.MX6 cpufreq support" |
| 105 | depends on ARCH_MXC | 105 | depends on ARCH_MXC |
| 106 | depends on REGULATOR_ANATOP | 106 | depends on REGULATOR_ANATOP |
| 107 | select PM_OPP | ||
| 107 | help | 108 | help |
| 108 | This adds cpufreq driver support for Freescale i.MX6 series SoCs. | 109 | This adds cpufreq driver support for Freescale i.MX6 series SoCs. |
| 109 | 110 | ||
| @@ -118,7 +119,7 @@ config ARM_INTEGRATOR | |||
| 118 | If in doubt, say Y. | 119 | If in doubt, say Y. |
| 119 | 120 | ||
| 120 | config ARM_KIRKWOOD_CPUFREQ | 121 | config ARM_KIRKWOOD_CPUFREQ |
| 121 | def_bool MACH_KIRKWOOD | 122 | def_bool ARCH_KIRKWOOD || MACH_KIRKWOOD |
| 122 | help | 123 | help |
| 123 | This adds the CPUFreq driver for Marvell Kirkwood | 124 | This adds the CPUFreq driver for Marvell Kirkwood |
| 124 | SoCs. | 125 | SoCs. |
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-cpu0.c b/drivers/cpufreq/cpufreq-cpu0.c index ee1ae303a07c..86beda9f950b 100644 --- a/drivers/cpufreq/cpufreq-cpu0.c +++ b/drivers/cpufreq/cpufreq-cpu0.c | |||
| @@ -152,11 +152,8 @@ static int cpu0_cpufreq_probe(struct platform_device *pdev) | |||
| 152 | goto out_put_reg; | 152 | goto out_put_reg; |
| 153 | } | 153 | } |
| 154 | 154 | ||
| 155 | ret = of_init_opp_table(cpu_dev); | 155 | /* OPPs might be populated at runtime, don't check for error here */ |
| 156 | if (ret) { | 156 | of_init_opp_table(cpu_dev); |
| 157 | pr_err("failed to init OPP table: %d\n", ret); | ||
| 158 | goto out_put_clk; | ||
| 159 | } | ||
| 160 | 157 | ||
| 161 | ret = dev_pm_opp_init_cpufreq_table(cpu_dev, &freq_table); | 158 | ret = dev_pm_opp_init_cpufreq_table(cpu_dev, &freq_table); |
| 162 | if (ret) { | 159 | if (ret) { |
diff --git a/drivers/cpufreq/cpufreq.c b/drivers/cpufreq/cpufreq.c index aed2b0cb83dc..6f024852c6fb 100644 --- a/drivers/cpufreq/cpufreq.c +++ b/drivers/cpufreq/cpufreq.c | |||
| @@ -1153,10 +1153,12 @@ static int __cpufreq_add_dev(struct device *dev, struct subsys_interface *sif) | |||
| 1153 | * the creation of a brand new one. So we need to perform this update | 1153 | * the creation of a brand new one. So we need to perform this update |
| 1154 | * by invoking update_policy_cpu(). | 1154 | * by invoking update_policy_cpu(). |
| 1155 | */ | 1155 | */ |
| 1156 | if (recover_policy && cpu != policy->cpu) | 1156 | if (recover_policy && cpu != policy->cpu) { |
| 1157 | update_policy_cpu(policy, cpu); | 1157 | update_policy_cpu(policy, cpu); |
| 1158 | else | 1158 | WARN_ON(kobject_move(&policy->kobj, &dev->kobj)); |
| 1159 | } else { | ||
| 1159 | policy->cpu = cpu; | 1160 | policy->cpu = cpu; |
| 1161 | } | ||
| 1160 | 1162 | ||
| 1161 | cpumask_copy(policy->cpus, cpumask_of(cpu)); | 1163 | cpumask_copy(policy->cpus, cpumask_of(cpu)); |
| 1162 | 1164 | ||
| @@ -2242,10 +2244,8 @@ int cpufreq_update_policy(unsigned int cpu) | |||
| 2242 | struct cpufreq_policy new_policy; | 2244 | struct cpufreq_policy new_policy; |
| 2243 | int ret; | 2245 | int ret; |
| 2244 | 2246 | ||
| 2245 | if (!policy) { | 2247 | if (!policy) |
| 2246 | ret = -ENODEV; | 2248 | return -ENODEV; |
| 2247 | goto no_policy; | ||
| 2248 | } | ||
| 2249 | 2249 | ||
| 2250 | down_write(&policy->rwsem); | 2250 | down_write(&policy->rwsem); |
| 2251 | 2251 | ||
| @@ -2264,7 +2264,7 @@ int cpufreq_update_policy(unsigned int cpu) | |||
| 2264 | new_policy.cur = cpufreq_driver->get(cpu); | 2264 | new_policy.cur = cpufreq_driver->get(cpu); |
| 2265 | if (WARN_ON(!new_policy.cur)) { | 2265 | if (WARN_ON(!new_policy.cur)) { |
| 2266 | ret = -EIO; | 2266 | ret = -EIO; |
| 2267 | goto no_policy; | 2267 | goto unlock; |
| 2268 | } | 2268 | } |
| 2269 | 2269 | ||
| 2270 | if (!policy->cur) { | 2270 | if (!policy->cur) { |
| @@ -2279,10 +2279,10 @@ int cpufreq_update_policy(unsigned int cpu) | |||
| 2279 | 2279 | ||
| 2280 | ret = cpufreq_set_policy(policy, &new_policy); | 2280 | ret = cpufreq_set_policy(policy, &new_policy); |
| 2281 | 2281 | ||
| 2282 | unlock: | ||
| 2282 | up_write(&policy->rwsem); | 2283 | up_write(&policy->rwsem); |
| 2283 | 2284 | ||
| 2284 | cpufreq_cpu_put(policy); | 2285 | cpufreq_cpu_put(policy); |
| 2285 | no_policy: | ||
| 2286 | return ret; | 2286 | return ret; |
| 2287 | } | 2287 | } |
| 2288 | EXPORT_SYMBOL(cpufreq_update_policy); | 2288 | 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/cpufreq/sa1110-cpufreq.c b/drivers/cpufreq/sa1110-cpufreq.c index 546376719d8f..b5befc211172 100644 --- a/drivers/cpufreq/sa1110-cpufreq.c +++ b/drivers/cpufreq/sa1110-cpufreq.c | |||
| @@ -349,7 +349,7 @@ static int __init sa1110_clk_init(void) | |||
| 349 | name = "K4S641632D"; | 349 | name = "K4S641632D"; |
| 350 | if (machine_is_h3100()) | 350 | if (machine_is_h3100()) |
| 351 | name = "KM416S4030CT"; | 351 | name = "KM416S4030CT"; |
| 352 | if (machine_is_jornada720()) | 352 | if (machine_is_jornada720() || machine_is_h3600()) |
| 353 | name = "K4S281632B-1H"; | 353 | name = "K4S281632B-1H"; |
| 354 | if (machine_is_nanoengine()) | 354 | if (machine_is_nanoengine()) |
| 355 | name = "MT48LC8M16A2TG-75"; | 355 | name = "MT48LC8M16A2TG-75"; |
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/firewire/Kconfig b/drivers/firewire/Kconfig index 4199849e3758..145974f9662b 100644 --- a/drivers/firewire/Kconfig +++ b/drivers/firewire/Kconfig | |||
| @@ -1,4 +1,5 @@ | |||
| 1 | menu "IEEE 1394 (FireWire) support" | 1 | menu "IEEE 1394 (FireWire) support" |
| 2 | depends on HAS_DMA | ||
| 2 | depends on PCI || COMPILE_TEST | 3 | depends on PCI || COMPILE_TEST |
| 3 | # firewire-core does not depend on PCI but is | 4 | # firewire-core does not depend on PCI but is |
| 4 | # not useful without PCI controller driver | 5 | # not useful without PCI controller driver |
diff --git a/drivers/firewire/ohci.c b/drivers/firewire/ohci.c index 57985410f12f..a66a3217f1d9 100644 --- a/drivers/firewire/ohci.c +++ b/drivers/firewire/ohci.c | |||
| @@ -336,10 +336,10 @@ static const struct { | |||
| 336 | QUIRK_CYCLE_TIMER | QUIRK_IR_WAKE}, | 336 | QUIRK_CYCLE_TIMER | QUIRK_IR_WAKE}, |
| 337 | 337 | ||
| 338 | {PCI_VENDOR_ID_VIA, PCI_DEVICE_ID_VIA_VT6315, 0, | 338 | {PCI_VENDOR_ID_VIA, PCI_DEVICE_ID_VIA_VT6315, 0, |
| 339 | QUIRK_CYCLE_TIMER | QUIRK_NO_MSI}, | 339 | QUIRK_CYCLE_TIMER /* FIXME: necessary? */ | QUIRK_NO_MSI}, |
| 340 | 340 | ||
| 341 | {PCI_VENDOR_ID_VIA, PCI_DEVICE_ID_VIA_VT6315, PCI_ANY_ID, | 341 | {PCI_VENDOR_ID_VIA, PCI_DEVICE_ID_VIA_VT6315, PCI_ANY_ID, |
| 342 | 0}, | 342 | QUIRK_NO_MSI}, |
| 343 | 343 | ||
| 344 | {PCI_VENDOR_ID_VIA, PCI_ANY_ID, PCI_ANY_ID, | 344 | {PCI_VENDOR_ID_VIA, PCI_ANY_ID, PCI_ANY_ID, |
| 345 | QUIRK_CYCLE_TIMER | QUIRK_NO_MSI}, | 345 | QUIRK_CYCLE_TIMER | QUIRK_NO_MSI}, |
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..dc79346689e6 100644 --- a/drivers/firmware/efi/efi.c +++ b/drivers/firmware/efi/efi.c | |||
| @@ -346,6 +346,7 @@ static __initdata struct { | |||
| 346 | 346 | ||
| 347 | struct param_info { | 347 | struct param_info { |
| 348 | int verbose; | 348 | int verbose; |
| 349 | int found; | ||
| 349 | void *params; | 350 | void *params; |
| 350 | }; | 351 | }; |
| 351 | 352 | ||
| @@ -353,25 +354,21 @@ static int __init fdt_find_uefi_params(unsigned long node, const char *uname, | |||
| 353 | int depth, void *data) | 354 | int depth, void *data) |
| 354 | { | 355 | { |
| 355 | struct param_info *info = data; | 356 | struct param_info *info = data; |
| 356 | void *prop, *dest; | 357 | const void *prop; |
| 357 | unsigned long len; | 358 | void *dest; |
| 358 | u64 val; | 359 | u64 val; |
| 359 | int i; | 360 | int i, len; |
| 360 | 361 | ||
| 361 | if (depth != 1 || | 362 | if (depth != 1 || |
| 362 | (strcmp(uname, "chosen") != 0 && strcmp(uname, "chosen@0") != 0)) | 363 | (strcmp(uname, "chosen") != 0 && strcmp(uname, "chosen@0") != 0)) |
| 363 | return 0; | 364 | return 0; |
| 364 | 365 | ||
| 365 | pr_info("Getting parameters from FDT:\n"); | ||
| 366 | |||
| 367 | for (i = 0; i < ARRAY_SIZE(dt_params); i++) { | 366 | for (i = 0; i < ARRAY_SIZE(dt_params); i++) { |
| 368 | prop = of_get_flat_dt_prop(node, dt_params[i].propname, &len); | 367 | prop = of_get_flat_dt_prop(node, dt_params[i].propname, &len); |
| 369 | if (!prop) { | 368 | if (!prop) |
| 370 | pr_err("Can't find %s in device tree!\n", | ||
| 371 | dt_params[i].name); | ||
| 372 | return 0; | 369 | return 0; |
| 373 | } | ||
| 374 | dest = info->params + dt_params[i].offset; | 370 | dest = info->params + dt_params[i].offset; |
| 371 | info->found++; | ||
| 375 | 372 | ||
| 376 | val = of_read_number(prop, len / sizeof(u32)); | 373 | val = of_read_number(prop, len / sizeof(u32)); |
| 377 | 374 | ||
| @@ -390,10 +387,21 @@ static int __init fdt_find_uefi_params(unsigned long node, const char *uname, | |||
| 390 | int __init efi_get_fdt_params(struct efi_fdt_params *params, int verbose) | 387 | int __init efi_get_fdt_params(struct efi_fdt_params *params, int verbose) |
| 391 | { | 388 | { |
| 392 | struct param_info info; | 389 | struct param_info info; |
| 390 | int ret; | ||
| 391 | |||
| 392 | pr_info("Getting EFI parameters from FDT:\n"); | ||
| 393 | 393 | ||
| 394 | info.verbose = verbose; | 394 | info.verbose = verbose; |
| 395 | info.found = 0; | ||
| 395 | info.params = params; | 396 | info.params = params; |
| 396 | 397 | ||
| 397 | return of_scan_flat_dt(fdt_find_uefi_params, &info); | 398 | ret = of_scan_flat_dt(fdt_find_uefi_params, &info); |
| 399 | if (!info.found) | ||
| 400 | pr_info("UEFI not found.\n"); | ||
| 401 | else if (!ret) | ||
| 402 | pr_err("Can't find '%s' in device tree!\n", | ||
| 403 | dt_params[info.found].name); | ||
| 404 | |||
| 405 | return ret; | ||
| 398 | } | 406 | } |
| 399 | #endif /* CONFIG_EFI_PARAMS_FROM_FDT */ | 407 | #endif /* CONFIG_EFI_PARAMS_FROM_FDT */ |
diff --git a/drivers/firmware/efi/fdt.c b/drivers/firmware/efi/fdt.c index 5c6a8e8a9580..507a3df46a5d 100644 --- a/drivers/firmware/efi/fdt.c +++ b/drivers/firmware/efi/fdt.c | |||
| @@ -23,16 +23,6 @@ static efi_status_t update_fdt(efi_system_table_t *sys_table, void *orig_fdt, | |||
| 23 | u32 fdt_val32; | 23 | u32 fdt_val32; |
| 24 | u64 fdt_val64; | 24 | u64 fdt_val64; |
| 25 | 25 | ||
| 26 | /* | ||
| 27 | * Copy definition of linux_banner here. Since this code is | ||
| 28 | * built as part of the decompressor for ARM v7, pulling | ||
| 29 | * in version.c where linux_banner is defined for the | ||
| 30 | * kernel brings other kernel dependencies with it. | ||
| 31 | */ | ||
| 32 | const char linux_banner[] = | ||
| 33 | "Linux version " UTS_RELEASE " (" LINUX_COMPILE_BY "@" | ||
| 34 | LINUX_COMPILE_HOST ") (" LINUX_COMPILER ") " UTS_VERSION "\n"; | ||
| 35 | |||
| 36 | /* Do some checks on provided FDT, if it exists*/ | 26 | /* Do some checks on provided FDT, if it exists*/ |
| 37 | if (orig_fdt) { | 27 | if (orig_fdt) { |
| 38 | if (fdt_check_header(orig_fdt)) { | 28 | if (fdt_check_header(orig_fdt)) { |
| @@ -63,7 +53,7 @@ static efi_status_t update_fdt(efi_system_table_t *sys_table, void *orig_fdt, | |||
| 63 | */ | 53 | */ |
| 64 | prev = 0; | 54 | prev = 0; |
| 65 | for (;;) { | 55 | for (;;) { |
| 66 | const char *type, *name; | 56 | const char *type; |
| 67 | int len; | 57 | int len; |
| 68 | 58 | ||
| 69 | node = fdt_next_node(fdt, prev, NULL); | 59 | node = fdt_next_node(fdt, prev, NULL); |
diff --git a/drivers/gpio/gpio-mcp23s08.c b/drivers/gpio/gpio-mcp23s08.c index fe7c0e211f9a..57adbc90fdad 100644 --- a/drivers/gpio/gpio-mcp23s08.c +++ b/drivers/gpio/gpio-mcp23s08.c | |||
| @@ -900,8 +900,6 @@ static int mcp23s08_probe(struct spi_device *spi) | |||
| 900 | if (spi_present_mask & (1 << addr)) | 900 | if (spi_present_mask & (1 << addr)) |
| 901 | chips++; | 901 | chips++; |
| 902 | } | 902 | } |
| 903 | if (!chips) | ||
| 904 | return -ENODEV; | ||
| 905 | } else { | 903 | } else { |
| 906 | type = spi_get_device_id(spi)->driver_data; | 904 | type = spi_get_device_id(spi)->driver_data; |
| 907 | pdata = dev_get_platdata(&spi->dev); | 905 | pdata = dev_get_platdata(&spi->dev); |
| @@ -940,10 +938,6 @@ static int mcp23s08_probe(struct spi_device *spi) | |||
| 940 | if (!(spi_present_mask & (1 << addr))) | 938 | if (!(spi_present_mask & (1 << addr))) |
| 941 | continue; | 939 | continue; |
| 942 | chips--; | 940 | chips--; |
| 943 | if (chips < 0) { | ||
| 944 | dev_err(&spi->dev, "FATAL: invalid negative chip id\n"); | ||
| 945 | goto fail; | ||
| 946 | } | ||
| 947 | data->mcp[addr] = &data->chip[chips]; | 941 | data->mcp[addr] = &data->chip[chips]; |
| 948 | status = mcp23s08_probe_one(data->mcp[addr], &spi->dev, spi, | 942 | status = mcp23s08_probe_one(data->mcp[addr], &spi->dev, spi, |
| 949 | 0x40 | (addr << 1), type, base, | 943 | 0x40 | (addr << 1), type, base, |
diff --git a/drivers/gpio/gpio-rcar.c b/drivers/gpio/gpio-rcar.c index 0c9f803fc1ac..b6ae89ea8811 100644 --- a/drivers/gpio/gpio-rcar.c +++ b/drivers/gpio/gpio-rcar.c | |||
| @@ -284,6 +284,7 @@ static int gpio_rcar_irq_domain_map(struct irq_domain *h, unsigned int irq, | |||
| 284 | 284 | ||
| 285 | static struct irq_domain_ops gpio_rcar_irq_domain_ops = { | 285 | static struct irq_domain_ops gpio_rcar_irq_domain_ops = { |
| 286 | .map = gpio_rcar_irq_domain_map, | 286 | .map = gpio_rcar_irq_domain_map, |
| 287 | .xlate = irq_domain_xlate_twocell, | ||
| 287 | }; | 288 | }; |
| 288 | 289 | ||
| 289 | struct gpio_rcar_info { | 290 | struct gpio_rcar_info { |
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.c b/drivers/gpu/drm/i915/i915_gem.c index f36126383d26..d893e4da5dce 100644 --- a/drivers/gpu/drm/i915/i915_gem.c +++ b/drivers/gpu/drm/i915/i915_gem.c | |||
| @@ -1616,22 +1616,6 @@ out: | |||
| 1616 | return ret; | 1616 | return ret; |
| 1617 | } | 1617 | } |
| 1618 | 1618 | ||
| 1619 | void i915_gem_release_all_mmaps(struct drm_i915_private *dev_priv) | ||
| 1620 | { | ||
| 1621 | struct i915_vma *vma; | ||
| 1622 | |||
| 1623 | /* | ||
| 1624 | * Only the global gtt is relevant for gtt memory mappings, so restrict | ||
| 1625 | * list traversal to objects bound into the global address space. Note | ||
| 1626 | * that the active list should be empty, but better safe than sorry. | ||
| 1627 | */ | ||
| 1628 | WARN_ON(!list_empty(&dev_priv->gtt.base.active_list)); | ||
| 1629 | list_for_each_entry(vma, &dev_priv->gtt.base.active_list, mm_list) | ||
| 1630 | i915_gem_release_mmap(vma->obj); | ||
| 1631 | list_for_each_entry(vma, &dev_priv->gtt.base.inactive_list, mm_list) | ||
| 1632 | i915_gem_release_mmap(vma->obj); | ||
| 1633 | } | ||
| 1634 | |||
| 1635 | /** | 1619 | /** |
| 1636 | * i915_gem_release_mmap - remove physical page mappings | 1620 | * i915_gem_release_mmap - remove physical page mappings |
| 1637 | * @obj: obj in question | 1621 | * @obj: obj in question |
| @@ -1657,6 +1641,15 @@ i915_gem_release_mmap(struct drm_i915_gem_object *obj) | |||
| 1657 | obj->fault_mappable = false; | 1641 | obj->fault_mappable = false; |
| 1658 | } | 1642 | } |
| 1659 | 1643 | ||
| 1644 | void | ||
| 1645 | i915_gem_release_all_mmaps(struct drm_i915_private *dev_priv) | ||
| 1646 | { | ||
| 1647 | struct drm_i915_gem_object *obj; | ||
| 1648 | |||
| 1649 | list_for_each_entry(obj, &dev_priv->mm.bound_list, global_list) | ||
| 1650 | i915_gem_release_mmap(obj); | ||
| 1651 | } | ||
| 1652 | |||
| 1660 | uint32_t | 1653 | uint32_t |
| 1661 | i915_gem_get_gtt_size(struct drm_device *dev, uint32_t size, int tiling_mode) | 1654 | i915_gem_get_gtt_size(struct drm_device *dev, uint32_t size, int tiling_mode) |
| 1662 | { | 1655 | { |
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_render_state.c b/drivers/gpu/drm/i915/i915_gem_render_state.c index 3521f998a178..34894b573064 100644 --- a/drivers/gpu/drm/i915/i915_gem_render_state.c +++ b/drivers/gpu/drm/i915/i915_gem_render_state.c | |||
| @@ -31,7 +31,7 @@ | |||
| 31 | struct i915_render_state { | 31 | struct i915_render_state { |
| 32 | struct drm_i915_gem_object *obj; | 32 | struct drm_i915_gem_object *obj; |
| 33 | unsigned long ggtt_offset; | 33 | unsigned long ggtt_offset; |
| 34 | void *batch; | 34 | u32 *batch; |
| 35 | u32 size; | 35 | u32 size; |
| 36 | u32 len; | 36 | u32 len; |
| 37 | }; | 37 | }; |
| @@ -80,7 +80,7 @@ free: | |||
| 80 | 80 | ||
| 81 | static void render_state_free(struct i915_render_state *so) | 81 | static void render_state_free(struct i915_render_state *so) |
| 82 | { | 82 | { |
| 83 | kunmap(so->batch); | 83 | kunmap(kmap_to_page(so->batch)); |
| 84 | i915_gem_object_ggtt_unpin(so->obj); | 84 | i915_gem_object_ggtt_unpin(so->obj); |
| 85 | drm_gem_object_unreference(&so->obj->base); | 85 | drm_gem_object_unreference(&so->obj->base); |
| 86 | kfree(so); | 86 | kfree(so); |
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..c05c84f3f091 100644 --- a/drivers/gpu/drm/i915/i915_irq.c +++ b/drivers/gpu/drm/i915/i915_irq.c | |||
| @@ -2845,20 +2845,27 @@ static int semaphore_passed(struct intel_engine_cs *ring) | |||
| 2845 | { | 2845 | { |
| 2846 | struct drm_i915_private *dev_priv = ring->dev->dev_private; | 2846 | struct drm_i915_private *dev_priv = ring->dev->dev_private; |
| 2847 | struct intel_engine_cs *signaller; | 2847 | struct intel_engine_cs *signaller; |
| 2848 | u32 seqno, ctl; | 2848 | u32 seqno; |
| 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; | 2854 | return -1; |
| 2855 | 2855 | ||
| 2856 | /* Prevent pathological recursion due to driver bugs */ | ||
| 2857 | if (signaller->hangcheck.deadlock >= I915_NUM_RINGS) | ||
| 2858 | return -1; | ||
| 2859 | |||
| 2860 | if (i915_seqno_passed(signaller->get_seqno(signaller, false), seqno)) | ||
| 2861 | return 1; | ||
| 2862 | |||
| 2856 | /* cursory check for an unkickable deadlock */ | 2863 | /* cursory check for an unkickable deadlock */ |
| 2857 | ctl = I915_READ_CTL(signaller); | 2864 | if (I915_READ_CTL(signaller) & RING_WAIT_SEMAPHORE && |
| 2858 | if (ctl & RING_WAIT_SEMAPHORE && semaphore_passed(signaller) < 0) | 2865 | semaphore_passed(signaller) < 0) |
| 2859 | return -1; | 2866 | return -1; |
| 2860 | 2867 | ||
| 2861 | return i915_seqno_passed(signaller->get_seqno(signaller, false), seqno); | 2868 | return 0; |
| 2862 | } | 2869 | } |
| 2863 | 2870 | ||
| 2864 | static void semaphore_clear_deadlocks(struct drm_i915_private *dev_priv) | 2871 | static void semaphore_clear_deadlocks(struct drm_i915_private *dev_priv) |
| @@ -2867,7 +2874,7 @@ static void semaphore_clear_deadlocks(struct drm_i915_private *dev_priv) | |||
| 2867 | int i; | 2874 | int i; |
| 2868 | 2875 | ||
| 2869 | for_each_ring(ring, dev_priv, i) | 2876 | for_each_ring(ring, dev_priv, i) |
| 2870 | ring->hangcheck.deadlock = false; | 2877 | ring->hangcheck.deadlock = 0; |
| 2871 | } | 2878 | } |
| 2872 | 2879 | ||
| 2873 | static enum intel_ring_hangcheck_action | 2880 | 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..f0be855ddf45 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,15 @@ 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 }, | ||
| 11676 | |||
| 11677 | /* HP Chromebook 14 (Celeron 2955U) */ | ||
| 11678 | { 0x0a06, 0x103c, 0x21ed, quirk_backlight_present }, | ||
| 11636 | }; | 11679 | }; |
| 11637 | 11680 | ||
| 11638 | static void intel_init_quirks(struct drm_device *dev) | 11681 | static void intel_init_quirks(struct drm_device *dev) |
| @@ -11871,6 +11914,7 @@ static void intel_sanitize_crtc(struct intel_crtc *crtc) | |||
| 11871 | * ... */ | 11914 | * ... */ |
| 11872 | plane = crtc->plane; | 11915 | plane = crtc->plane; |
| 11873 | crtc->plane = !plane; | 11916 | crtc->plane = !plane; |
| 11917 | crtc->primary_enabled = true; | ||
| 11874 | dev_priv->display.crtc_disable(&crtc->base); | 11918 | dev_priv->display.crtc_disable(&crtc->base); |
| 11875 | crtc->plane = plane; | 11919 | crtc->plane = plane; |
| 11876 | 11920 | ||
| @@ -12411,8 +12455,8 @@ intel_display_capture_error_state(struct drm_device *dev) | |||
| 12411 | 12455 | ||
| 12412 | for_each_pipe(i) { | 12456 | for_each_pipe(i) { |
| 12413 | error->pipe[i].power_domain_on = | 12457 | error->pipe[i].power_domain_on = |
| 12414 | intel_display_power_enabled_sw(dev_priv, | 12458 | intel_display_power_enabled_unlocked(dev_priv, |
| 12415 | POWER_DOMAIN_PIPE(i)); | 12459 | POWER_DOMAIN_PIPE(i)); |
| 12416 | if (!error->pipe[i].power_domain_on) | 12460 | if (!error->pipe[i].power_domain_on) |
| 12417 | continue; | 12461 | continue; |
| 12418 | 12462 | ||
| @@ -12447,7 +12491,7 @@ intel_display_capture_error_state(struct drm_device *dev) | |||
| 12447 | enum transcoder cpu_transcoder = transcoders[i]; | 12491 | enum transcoder cpu_transcoder = transcoders[i]; |
| 12448 | 12492 | ||
| 12449 | error->transcoder[i].power_domain_on = | 12493 | error->transcoder[i].power_domain_on = |
| 12450 | intel_display_power_enabled_sw(dev_priv, | 12494 | intel_display_power_enabled_unlocked(dev_priv, |
| 12451 | POWER_DOMAIN_TRANSCODER(cpu_transcoder)); | 12495 | POWER_DOMAIN_TRANSCODER(cpu_transcoder)); |
| 12452 | if (!error->transcoder[i].power_domain_on) | 12496 | if (!error->transcoder[i].power_domain_on) |
| 12453 | continue; | 12497 | continue; |
diff --git a/drivers/gpu/drm/i915/intel_dp.c b/drivers/gpu/drm/i915/intel_dp.c index 52fda950fd2a..8a1a4fbc06ac 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); |
| @@ -873,8 +906,8 @@ intel_dp_compute_config(struct intel_encoder *encoder, | |||
| 873 | mode_rate = intel_dp_link_required(adjusted_mode->crtc_clock, | 906 | mode_rate = intel_dp_link_required(adjusted_mode->crtc_clock, |
| 874 | bpp); | 907 | bpp); |
| 875 | 908 | ||
| 876 | for (lane_count = min_lane_count; lane_count <= max_lane_count; lane_count <<= 1) { | 909 | for (clock = min_clock; clock <= max_clock; clock++) { |
| 877 | for (clock = min_clock; clock <= max_clock; clock++) { | 910 | for (lane_count = min_lane_count; lane_count <= max_lane_count; lane_count <<= 1) { |
| 878 | link_clock = drm_dp_bw_code_to_link_rate(bws[clock]); | 911 | link_clock = drm_dp_bw_code_to_link_rate(bws[clock]); |
| 879 | link_avail = intel_dp_max_data_rate(link_clock, | 912 | link_avail = intel_dp_max_data_rate(link_clock, |
| 880 | lane_count); | 913 | lane_count); |
| @@ -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_lvds.c b/drivers/gpu/drm/i915/intel_lvds.c index 23126023aeba..5e5a72fca5fb 100644 --- a/drivers/gpu/drm/i915/intel_lvds.c +++ b/drivers/gpu/drm/i915/intel_lvds.c | |||
| @@ -111,6 +111,13 @@ static void intel_lvds_get_config(struct intel_encoder *encoder, | |||
| 111 | 111 | ||
| 112 | pipe_config->adjusted_mode.flags |= flags; | 112 | pipe_config->adjusted_mode.flags |= flags; |
| 113 | 113 | ||
| 114 | /* gen2/3 store dither state in pfit control, needs to match */ | ||
| 115 | if (INTEL_INFO(dev)->gen < 4) { | ||
| 116 | tmp = I915_READ(PFIT_CONTROL); | ||
| 117 | |||
| 118 | pipe_config->gmch_pfit.control |= tmp & PANEL_8TO6_DITHER_ENABLE; | ||
| 119 | } | ||
| 120 | |||
| 114 | dotclock = pipe_config->port_clock; | 121 | dotclock = pipe_config->port_clock; |
| 115 | 122 | ||
| 116 | if (HAS_PCH_SPLIT(dev_priv->dev)) | 123 | if (HAS_PCH_SPLIT(dev_priv->dev)) |
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..12b02fe1d0ae 100644 --- a/drivers/gpu/drm/i915/intel_panel.c +++ b/drivers/gpu/drm/i915/intel_panel.c | |||
| @@ -361,16 +361,16 @@ void intel_gmch_panel_fitting(struct intel_crtc *intel_crtc, | |||
| 361 | pfit_control |= ((intel_crtc->pipe << PFIT_PIPE_SHIFT) | | 361 | pfit_control |= ((intel_crtc->pipe << PFIT_PIPE_SHIFT) | |
| 362 | PFIT_FILTER_FUZZY); | 362 | PFIT_FILTER_FUZZY); |
| 363 | 363 | ||
| 364 | /* Make sure pre-965 set dither correctly for 18bpp panels. */ | ||
| 365 | if (INTEL_INFO(dev)->gen < 4 && pipe_config->pipe_bpp == 18) | ||
| 366 | pfit_control |= PANEL_8TO6_DITHER_ENABLE; | ||
| 367 | |||
| 368 | out: | 364 | out: |
| 369 | if ((pfit_control & PFIT_ENABLE) == 0) { | 365 | if ((pfit_control & PFIT_ENABLE) == 0) { |
| 370 | pfit_control = 0; | 366 | pfit_control = 0; |
| 371 | pfit_pgm_ratios = 0; | 367 | pfit_pgm_ratios = 0; |
| 372 | } | 368 | } |
| 373 | 369 | ||
| 370 | /* Make sure pre-965 set dither correctly for 18bpp panels. */ | ||
| 371 | if (INTEL_INFO(dev)->gen < 4 && pipe_config->pipe_bpp == 18) | ||
| 372 | pfit_control |= PANEL_8TO6_DITHER_ENABLE; | ||
| 373 | |||
| 374 | pipe_config->gmch_pfit.control = pfit_control; | 374 | pipe_config->gmch_pfit.control = pfit_control; |
| 375 | pipe_config->gmch_pfit.pgm_ratios = pfit_pgm_ratios; | 375 | pipe_config->gmch_pfit.pgm_ratios = pfit_pgm_ratios; |
| 376 | pipe_config->gmch_pfit.lvds_border_bits = border; | 376 | pipe_config->gmch_pfit.lvds_border_bits = border; |
| @@ -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/core/subdev/therm/temp.c b/drivers/gpu/drm/nouveau/core/subdev/therm/temp.c index cfde9eb44ad0..6212537b90c5 100644 --- a/drivers/gpu/drm/nouveau/core/subdev/therm/temp.c +++ b/drivers/gpu/drm/nouveau/core/subdev/therm/temp.c | |||
| @@ -192,11 +192,11 @@ alarm_timer_callback(struct nouveau_alarm *alarm) | |||
| 192 | nouveau_therm_threshold_hyst_polling(therm, &sensor->thrs_shutdown, | 192 | nouveau_therm_threshold_hyst_polling(therm, &sensor->thrs_shutdown, |
| 193 | NOUVEAU_THERM_THRS_SHUTDOWN); | 193 | NOUVEAU_THERM_THRS_SHUTDOWN); |
| 194 | 194 | ||
| 195 | spin_unlock_irqrestore(&priv->sensor.alarm_program_lock, flags); | ||
| 196 | |||
| 195 | /* schedule the next poll in one second */ | 197 | /* schedule the next poll in one second */ |
| 196 | if (therm->temp_get(therm) >= 0 && list_empty(&alarm->head)) | 198 | if (therm->temp_get(therm) >= 0 && list_empty(&alarm->head)) |
| 197 | ptimer->alarm(ptimer, 1000 * 1000 * 1000, alarm); | 199 | ptimer->alarm(ptimer, 1000000000ULL, alarm); |
| 198 | |||
| 199 | spin_unlock_irqrestore(&priv->sensor.alarm_program_lock, flags); | ||
| 200 | } | 200 | } |
| 201 | 201 | ||
| 202 | void | 202 | void |
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/qxl/qxl_irq.c b/drivers/gpu/drm/qxl/qxl_irq.c index 34d6a85e9023..0bf1e20c6e44 100644 --- a/drivers/gpu/drm/qxl/qxl_irq.c +++ b/drivers/gpu/drm/qxl/qxl_irq.c | |||
| @@ -33,6 +33,9 @@ irqreturn_t qxl_irq_handler(int irq, void *arg) | |||
| 33 | 33 | ||
| 34 | pending = xchg(&qdev->ram_header->int_pending, 0); | 34 | pending = xchg(&qdev->ram_header->int_pending, 0); |
| 35 | 35 | ||
| 36 | if (!pending) | ||
| 37 | return IRQ_NONE; | ||
| 38 | |||
| 36 | atomic_inc(&qdev->irq_received); | 39 | atomic_inc(&qdev->irq_received); |
| 37 | 40 | ||
| 38 | if (pending & QXL_INTERRUPT_DISPLAY) { | 41 | if (pending & QXL_INTERRUPT_DISPLAY) { |
diff --git a/drivers/gpu/drm/radeon/atombios_crtc.c b/drivers/gpu/drm/radeon/atombios_crtc.c index 26c12a3fe430..30d242b25078 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); |
| @@ -1361,8 +1414,8 @@ static int dce4_crtc_do_set_base(struct drm_crtc *crtc, | |||
| 1361 | tmp &= ~EVERGREEN_GRPH_SURFACE_UPDATE_H_RETRACE_EN; | 1414 | tmp &= ~EVERGREEN_GRPH_SURFACE_UPDATE_H_RETRACE_EN; |
| 1362 | WREG32(EVERGREEN_GRPH_FLIP_CONTROL + radeon_crtc->crtc_offset, tmp); | 1415 | WREG32(EVERGREEN_GRPH_FLIP_CONTROL + radeon_crtc->crtc_offset, tmp); |
| 1363 | 1416 | ||
| 1364 | /* set pageflip to happen anywhere in vblank interval */ | 1417 | /* set pageflip to happen only at start of vblank interval (front porch) */ |
| 1365 | WREG32(EVERGREEN_MASTER_UPDATE_MODE + radeon_crtc->crtc_offset, 0); | 1418 | WREG32(EVERGREEN_MASTER_UPDATE_MODE + radeon_crtc->crtc_offset, 3); |
| 1366 | 1419 | ||
| 1367 | if (!atomic && fb && fb != crtc->primary->fb) { | 1420 | if (!atomic && fb && fb != crtc->primary->fb) { |
| 1368 | radeon_fb = to_radeon_framebuffer(fb); | 1421 | radeon_fb = to_radeon_framebuffer(fb); |
| @@ -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); |
| @@ -1530,8 +1614,8 @@ static int avivo_crtc_do_set_base(struct drm_crtc *crtc, | |||
| 1530 | tmp &= ~AVIVO_D1GRPH_SURFACE_UPDATE_H_RETRACE_EN; | 1614 | tmp &= ~AVIVO_D1GRPH_SURFACE_UPDATE_H_RETRACE_EN; |
| 1531 | WREG32(AVIVO_D1GRPH_FLIP_CONTROL + radeon_crtc->crtc_offset, tmp); | 1615 | WREG32(AVIVO_D1GRPH_FLIP_CONTROL + radeon_crtc->crtc_offset, tmp); |
| 1532 | 1616 | ||
| 1533 | /* set pageflip to happen anywhere in vblank interval */ | 1617 | /* set pageflip to happen only at start of vblank interval (front porch) */ |
| 1534 | WREG32(AVIVO_D1MODE_MASTER_UPDATE_MODE + radeon_crtc->crtc_offset, 0); | 1618 | WREG32(AVIVO_D1MODE_MASTER_UPDATE_MODE + radeon_crtc->crtc_offset, 3); |
| 1535 | 1619 | ||
| 1536 | if (!atomic && fb && fb != crtc->primary->fb) { | 1620 | if (!atomic && fb && fb != crtc->primary->fb) { |
| 1537 | radeon_fb = to_radeon_framebuffer(fb); | 1621 | radeon_fb = to_radeon_framebuffer(fb); |
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/atombios_encoders.c b/drivers/gpu/drm/radeon/atombios_encoders.c index 2b2908440644..7d68203a3737 100644 --- a/drivers/gpu/drm/radeon/atombios_encoders.c +++ b/drivers/gpu/drm/radeon/atombios_encoders.c | |||
| @@ -183,7 +183,6 @@ void radeon_atom_backlight_init(struct radeon_encoder *radeon_encoder, | |||
| 183 | struct backlight_properties props; | 183 | struct backlight_properties props; |
| 184 | struct radeon_backlight_privdata *pdata; | 184 | struct radeon_backlight_privdata *pdata; |
| 185 | struct radeon_encoder_atom_dig *dig; | 185 | struct radeon_encoder_atom_dig *dig; |
| 186 | u8 backlight_level; | ||
| 187 | char bl_name[16]; | 186 | char bl_name[16]; |
| 188 | 187 | ||
| 189 | /* Mac laptops with multiple GPUs use the gmux driver for backlight | 188 | /* Mac laptops with multiple GPUs use the gmux driver for backlight |
| @@ -222,12 +221,17 @@ void radeon_atom_backlight_init(struct radeon_encoder *radeon_encoder, | |||
| 222 | 221 | ||
| 223 | pdata->encoder = radeon_encoder; | 222 | pdata->encoder = radeon_encoder; |
| 224 | 223 | ||
| 225 | backlight_level = radeon_atom_get_backlight_level_from_reg(rdev); | ||
| 226 | |||
| 227 | dig = radeon_encoder->enc_priv; | 224 | dig = radeon_encoder->enc_priv; |
| 228 | dig->bl_dev = bd; | 225 | dig->bl_dev = bd; |
| 229 | 226 | ||
| 230 | bd->props.brightness = radeon_atom_backlight_get_brightness(bd); | 227 | bd->props.brightness = radeon_atom_backlight_get_brightness(bd); |
| 228 | /* Set a reasonable default here if the level is 0 otherwise | ||
| 229 | * fbdev will attempt to turn the backlight on after console | ||
| 230 | * unblanking and it will try and restore 0 which turns the backlight | ||
| 231 | * off again. | ||
| 232 | */ | ||
| 233 | if (bd->props.brightness == 0) | ||
| 234 | bd->props.brightness = RADEON_MAX_BL_LEVEL; | ||
| 231 | bd->props.power = FB_BLANK_UNBLANK; | 235 | bd->props.power = FB_BLANK_UNBLANK; |
| 232 | backlight_update_status(bd); | 236 | backlight_update_status(bd); |
| 233 | 237 | ||
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..c0ea66192fe0 100644 --- a/drivers/gpu/drm/radeon/cik.c +++ b/drivers/gpu/drm/radeon/cik.c | |||
| @@ -2291,6 +2291,7 @@ static void cik_tiling_mode_table_init(struct radeon_device *rdev) | |||
| 2291 | gb_tile_moden = 0; | 2291 | gb_tile_moden = 0; |
| 2292 | break; | 2292 | break; |
| 2293 | } | 2293 | } |
| 2294 | rdev->config.cik.macrotile_mode_array[reg_offset] = gb_tile_moden; | ||
| 2294 | WREG32(GB_MACROTILE_MODE0 + (reg_offset * 4), gb_tile_moden); | 2295 | WREG32(GB_MACROTILE_MODE0 + (reg_offset * 4), gb_tile_moden); |
| 2295 | } | 2296 | } |
| 2296 | } else if (num_pipe_configs == 8) { | 2297 | } else if (num_pipe_configs == 8) { |
| @@ -7376,6 +7377,7 @@ static inline u32 cik_get_ih_wptr(struct radeon_device *rdev) | |||
| 7376 | tmp = RREG32(IH_RB_CNTL); | 7377 | tmp = RREG32(IH_RB_CNTL); |
| 7377 | tmp |= IH_WPTR_OVERFLOW_CLEAR; | 7378 | tmp |= IH_WPTR_OVERFLOW_CLEAR; |
| 7378 | WREG32(IH_RB_CNTL, tmp); | 7379 | WREG32(IH_RB_CNTL, tmp); |
| 7380 | wptr &= ~RB_OVERFLOW; | ||
| 7379 | } | 7381 | } |
| 7380 | return (wptr & rdev->ih.ptr_mask); | 7382 | return (wptr & rdev->ih.ptr_mask); |
| 7381 | } | 7383 | } |
| @@ -7676,14 +7678,16 @@ restart_ih: | |||
| 7676 | addr = RREG32(VM_CONTEXT1_PROTECTION_FAULT_ADDR); | 7678 | addr = RREG32(VM_CONTEXT1_PROTECTION_FAULT_ADDR); |
| 7677 | status = RREG32(VM_CONTEXT1_PROTECTION_FAULT_STATUS); | 7679 | status = RREG32(VM_CONTEXT1_PROTECTION_FAULT_STATUS); |
| 7678 | mc_client = RREG32(VM_CONTEXT1_PROTECTION_FAULT_MCCLIENT); | 7680 | mc_client = RREG32(VM_CONTEXT1_PROTECTION_FAULT_MCCLIENT); |
| 7681 | /* reset addr and status */ | ||
| 7682 | WREG32_P(VM_CONTEXT1_CNTL2, 1, ~1); | ||
| 7683 | if (addr == 0x0 && status == 0x0) | ||
| 7684 | break; | ||
| 7679 | dev_err(rdev->dev, "GPU fault detected: %d 0x%08x\n", src_id, src_data); | 7685 | 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", | 7686 | dev_err(rdev->dev, " VM_CONTEXT1_PROTECTION_FAULT_ADDR 0x%08X\n", |
| 7681 | addr); | 7687 | addr); |
| 7682 | dev_err(rdev->dev, " VM_CONTEXT1_PROTECTION_FAULT_STATUS 0x%08X\n", | 7688 | dev_err(rdev->dev, " VM_CONTEXT1_PROTECTION_FAULT_STATUS 0x%08X\n", |
| 7683 | status); | 7689 | status); |
| 7684 | cik_vm_decode_fault(rdev, status, addr, mc_client); | 7690 | cik_vm_decode_fault(rdev, status, addr, mc_client); |
| 7685 | /* reset addr and status */ | ||
| 7686 | WREG32_P(VM_CONTEXT1_CNTL2, 1, ~1); | ||
| 7687 | break; | 7691 | break; |
| 7688 | case 167: /* VCE */ | 7692 | case 167: /* VCE */ |
| 7689 | DRM_DEBUG("IH: VCE int: 0x%08x\n", src_data); | 7693 | 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..15e4f28015e1 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, |
| @@ -2642,8 +2642,9 @@ void evergreen_mc_resume(struct radeon_device *rdev, struct evergreen_mc_save *s | |||
| 2642 | for (i = 0; i < rdev->num_crtc; i++) { | 2642 | for (i = 0; i < rdev->num_crtc; i++) { |
| 2643 | if (save->crtc_enabled[i]) { | 2643 | if (save->crtc_enabled[i]) { |
| 2644 | tmp = RREG32(EVERGREEN_MASTER_UPDATE_MODE + crtc_offsets[i]); | 2644 | tmp = RREG32(EVERGREEN_MASTER_UPDATE_MODE + crtc_offsets[i]); |
| 2645 | if ((tmp & 0x3) != 0) { | 2645 | if ((tmp & 0x7) != 3) { |
| 2646 | tmp &= ~0x3; | 2646 | tmp &= ~0x7; |
| 2647 | tmp |= 0x3; | ||
| 2647 | WREG32(EVERGREEN_MASTER_UPDATE_MODE + crtc_offsets[i], tmp); | 2648 | WREG32(EVERGREEN_MASTER_UPDATE_MODE + crtc_offsets[i], tmp); |
| 2648 | } | 2649 | } |
| 2649 | tmp = RREG32(EVERGREEN_GRPH_UPDATE + crtc_offsets[i]); | 2650 | tmp = RREG32(EVERGREEN_GRPH_UPDATE + crtc_offsets[i]); |
| @@ -4755,6 +4756,7 @@ static u32 evergreen_get_ih_wptr(struct radeon_device *rdev) | |||
| 4755 | tmp = RREG32(IH_RB_CNTL); | 4756 | tmp = RREG32(IH_RB_CNTL); |
| 4756 | tmp |= IH_WPTR_OVERFLOW_CLEAR; | 4757 | tmp |= IH_WPTR_OVERFLOW_CLEAR; |
| 4757 | WREG32(IH_RB_CNTL, tmp); | 4758 | WREG32(IH_RB_CNTL, tmp); |
| 4759 | wptr &= ~RB_OVERFLOW; | ||
| 4758 | } | 4760 | } |
| 4759 | return (wptr & rdev->ih.ptr_mask); | 4761 | return (wptr & rdev->ih.ptr_mask); |
| 4760 | } | 4762 | } |
| @@ -5066,14 +5068,16 @@ restart_ih: | |||
| 5066 | case 147: | 5068 | case 147: |
| 5067 | addr = RREG32(VM_CONTEXT1_PROTECTION_FAULT_ADDR); | 5069 | addr = RREG32(VM_CONTEXT1_PROTECTION_FAULT_ADDR); |
| 5068 | status = RREG32(VM_CONTEXT1_PROTECTION_FAULT_STATUS); | 5070 | status = RREG32(VM_CONTEXT1_PROTECTION_FAULT_STATUS); |
| 5071 | /* reset addr and status */ | ||
| 5072 | WREG32_P(VM_CONTEXT1_CNTL2, 1, ~1); | ||
| 5073 | if (addr == 0x0 && status == 0x0) | ||
| 5074 | break; | ||
| 5069 | dev_err(rdev->dev, "GPU fault detected: %d 0x%08x\n", src_id, src_data); | 5075 | 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", | 5076 | dev_err(rdev->dev, " VM_CONTEXT1_PROTECTION_FAULT_ADDR 0x%08X\n", |
| 5071 | addr); | 5077 | addr); |
| 5072 | dev_err(rdev->dev, " VM_CONTEXT1_PROTECTION_FAULT_STATUS 0x%08X\n", | 5078 | dev_err(rdev->dev, " VM_CONTEXT1_PROTECTION_FAULT_STATUS 0x%08X\n", |
| 5073 | status); | 5079 | status); |
| 5074 | cayman_vm_decode_fault(rdev, status, addr); | 5080 | cayman_vm_decode_fault(rdev, status, addr); |
| 5075 | /* reset addr and status */ | ||
| 5076 | WREG32_P(VM_CONTEXT1_CNTL2, 1, ~1); | ||
| 5077 | break; | 5081 | break; |
| 5078 | case 176: /* CP_INT in ring buffer */ | 5082 | case 176: /* CP_INT in ring buffer */ |
| 5079 | case 177: /* CP_INT in IB1 */ | 5083 | 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..23bff590fb6e 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 |
| @@ -237,7 +239,6 @@ | |||
| 237 | # define EVERGREEN_CRTC_V_BLANK (1 << 0) | 239 | # define EVERGREEN_CRTC_V_BLANK (1 << 0) |
| 238 | #define EVERGREEN_CRTC_STATUS_POSITION 0x6e90 | 240 | #define EVERGREEN_CRTC_STATUS_POSITION 0x6e90 |
| 239 | #define EVERGREEN_CRTC_STATUS_HV_COUNT 0x6ea0 | 241 | #define EVERGREEN_CRTC_STATUS_HV_COUNT 0x6ea0 |
| 240 | #define EVERGREEN_MASTER_UPDATE_MODE 0x6ef8 | ||
| 241 | #define EVERGREEN_CRTC_UPDATE_LOCK 0x6ed4 | 242 | #define EVERGREEN_CRTC_UPDATE_LOCK 0x6ed4 |
| 242 | #define EVERGREEN_MASTER_UPDATE_LOCK 0x6ef4 | 243 | #define EVERGREEN_MASTER_UPDATE_LOCK 0x6ef4 |
| 243 | #define EVERGREEN_MASTER_UPDATE_MODE 0x6ef8 | 244 | #define EVERGREEN_MASTER_UPDATE_MODE 0x6ef8 |
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/r600.c b/drivers/gpu/drm/radeon/r600.c index c66952d4b00c..3c69f58e46ef 100644 --- a/drivers/gpu/drm/radeon/r600.c +++ b/drivers/gpu/drm/radeon/r600.c | |||
| @@ -3795,6 +3795,7 @@ static u32 r600_get_ih_wptr(struct radeon_device *rdev) | |||
| 3795 | tmp = RREG32(IH_RB_CNTL); | 3795 | tmp = RREG32(IH_RB_CNTL); |
| 3796 | tmp |= IH_WPTR_OVERFLOW_CLEAR; | 3796 | tmp |= IH_WPTR_OVERFLOW_CLEAR; |
| 3797 | WREG32(IH_RB_CNTL, tmp); | 3797 | WREG32(IH_RB_CNTL, tmp); |
| 3798 | wptr &= ~RB_OVERFLOW; | ||
| 3798 | } | 3799 | } |
| 3799 | return (wptr & rdev->ih.ptr_mask); | 3800 | return (wptr & rdev->ih.ptr_mask); |
| 3800 | } | 3801 | } |
diff --git a/drivers/gpu/drm/radeon/radeon.h b/drivers/gpu/drm/radeon/radeon.h index 4b0bbf88d5c0..60c47f829122 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 |
| @@ -448,6 +449,7 @@ struct radeon_bo_va { | |||
| 448 | 449 | ||
| 449 | /* protected by vm mutex */ | 450 | /* protected by vm mutex */ |
| 450 | struct list_head vm_list; | 451 | struct list_head vm_list; |
| 452 | struct list_head vm_status; | ||
| 451 | 453 | ||
| 452 | /* constant after initialization */ | 454 | /* constant after initialization */ |
| 453 | struct radeon_vm *vm; | 455 | struct radeon_vm *vm; |
| @@ -683,10 +685,9 @@ struct radeon_flip_work { | |||
| 683 | struct work_struct unpin_work; | 685 | struct work_struct unpin_work; |
| 684 | struct radeon_device *rdev; | 686 | struct radeon_device *rdev; |
| 685 | int crtc_id; | 687 | int crtc_id; |
| 686 | struct drm_framebuffer *fb; | 688 | uint64_t base; |
| 687 | struct drm_pending_vblank_event *event; | 689 | struct drm_pending_vblank_event *event; |
| 688 | struct radeon_bo *old_rbo; | 690 | struct radeon_bo *old_rbo; |
| 689 | struct radeon_bo *new_rbo; | ||
| 690 | struct radeon_fence *fence; | 691 | struct radeon_fence *fence; |
| 691 | }; | 692 | }; |
| 692 | 693 | ||
| @@ -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; |
| @@ -871,6 +868,9 @@ struct radeon_vm { | |||
| 871 | struct list_head va; | 868 | struct list_head va; |
| 872 | unsigned id; | 869 | unsigned id; |
| 873 | 870 | ||
| 871 | /* BOs freed, but not yet updated in the PT */ | ||
| 872 | struct list_head freed; | ||
| 873 | |||
| 874 | /* contains the page directory */ | 874 | /* contains the page directory */ |
| 875 | struct radeon_bo *page_directory; | 875 | struct radeon_bo *page_directory; |
| 876 | uint64_t pd_gpu_addr; | 876 | uint64_t pd_gpu_addr; |
| @@ -879,6 +879,8 @@ struct radeon_vm { | |||
| 879 | /* array of page tables, one for each page directory entry */ | 879 | /* array of page tables, one for each page directory entry */ |
| 880 | struct radeon_vm_pt *page_tables; | 880 | struct radeon_vm_pt *page_tables; |
| 881 | 881 | ||
| 882 | struct radeon_bo_va *ib_bo_va; | ||
| 883 | |||
| 882 | struct mutex mutex; | 884 | struct mutex mutex; |
| 883 | /* last fence for cs using this vm */ | 885 | /* last fence for cs using this vm */ |
| 884 | struct radeon_fence *fence; | 886 | struct radeon_fence *fence; |
| @@ -2836,9 +2838,10 @@ void radeon_vm_fence(struct radeon_device *rdev, | |||
| 2836 | uint64_t radeon_vm_map_gart(struct radeon_device *rdev, uint64_t addr); | 2838 | uint64_t radeon_vm_map_gart(struct radeon_device *rdev, uint64_t addr); |
| 2837 | int radeon_vm_update_page_directory(struct radeon_device *rdev, | 2839 | int radeon_vm_update_page_directory(struct radeon_device *rdev, |
| 2838 | struct radeon_vm *vm); | 2840 | struct radeon_vm *vm); |
| 2841 | int radeon_vm_clear_freed(struct radeon_device *rdev, | ||
| 2842 | struct radeon_vm *vm); | ||
| 2839 | int radeon_vm_bo_update(struct radeon_device *rdev, | 2843 | int radeon_vm_bo_update(struct radeon_device *rdev, |
| 2840 | struct radeon_vm *vm, | 2844 | struct radeon_bo_va *bo_va, |
| 2841 | struct radeon_bo *bo, | ||
| 2842 | struct ttm_mem_reg *mem); | 2845 | struct ttm_mem_reg *mem); |
| 2843 | void radeon_vm_bo_invalidate(struct radeon_device *rdev, | 2846 | void radeon_vm_bo_invalidate(struct radeon_device *rdev, |
| 2844 | struct radeon_bo *bo); | 2847 | struct radeon_bo *bo); |
| @@ -2851,8 +2854,8 @@ int radeon_vm_bo_set_addr(struct radeon_device *rdev, | |||
| 2851 | struct radeon_bo_va *bo_va, | 2854 | struct radeon_bo_va *bo_va, |
| 2852 | uint64_t offset, | 2855 | uint64_t offset, |
| 2853 | uint32_t flags); | 2856 | uint32_t flags); |
| 2854 | int radeon_vm_bo_rmv(struct radeon_device *rdev, | 2857 | void radeon_vm_bo_rmv(struct radeon_device *rdev, |
| 2855 | struct radeon_bo_va *bo_va); | 2858 | struct radeon_bo_va *bo_va); |
| 2856 | 2859 | ||
| 2857 | /* audio */ | 2860 | /* audio */ |
| 2858 | void r600_audio_update_hdmi(struct work_struct *work); | 2861 | void r600_audio_update_hdmi(struct work_struct *work); |
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_cs.c b/drivers/gpu/drm/radeon/radeon_cs.c index 71a143461478..ae763f60c8a0 100644 --- a/drivers/gpu/drm/radeon/radeon_cs.c +++ b/drivers/gpu/drm/radeon/radeon_cs.c | |||
| @@ -461,13 +461,23 @@ static int radeon_bo_vm_update_pte(struct radeon_cs_parser *p, | |||
| 461 | struct radeon_vm *vm) | 461 | struct radeon_vm *vm) |
| 462 | { | 462 | { |
| 463 | struct radeon_device *rdev = p->rdev; | 463 | struct radeon_device *rdev = p->rdev; |
| 464 | struct radeon_bo_va *bo_va; | ||
| 464 | int i, r; | 465 | int i, r; |
| 465 | 466 | ||
| 466 | r = radeon_vm_update_page_directory(rdev, vm); | 467 | r = radeon_vm_update_page_directory(rdev, vm); |
| 467 | if (r) | 468 | if (r) |
| 468 | return r; | 469 | return r; |
| 469 | 470 | ||
| 470 | r = radeon_vm_bo_update(rdev, vm, rdev->ring_tmp_bo.bo, | 471 | r = radeon_vm_clear_freed(rdev, vm); |
| 472 | if (r) | ||
| 473 | return r; | ||
| 474 | |||
| 475 | if (vm->ib_bo_va == NULL) { | ||
| 476 | DRM_ERROR("Tmp BO not in VM!\n"); | ||
| 477 | return -EINVAL; | ||
| 478 | } | ||
| 479 | |||
| 480 | r = radeon_vm_bo_update(rdev, vm->ib_bo_va, | ||
| 471 | &rdev->ring_tmp_bo.bo->tbo.mem); | 481 | &rdev->ring_tmp_bo.bo->tbo.mem); |
| 472 | if (r) | 482 | if (r) |
| 473 | return r; | 483 | return r; |
| @@ -480,7 +490,13 @@ static int radeon_bo_vm_update_pte(struct radeon_cs_parser *p, | |||
| 480 | continue; | 490 | continue; |
| 481 | 491 | ||
| 482 | bo = p->relocs[i].robj; | 492 | bo = p->relocs[i].robj; |
| 483 | r = radeon_vm_bo_update(rdev, vm, bo, &bo->tbo.mem); | 493 | bo_va = radeon_vm_bo_find(vm, bo); |
| 494 | if (bo_va == NULL) { | ||
| 495 | dev_err(rdev->dev, "bo %p not in vm %p\n", bo, vm); | ||
| 496 | return -EINVAL; | ||
| 497 | } | ||
| 498 | |||
| 499 | r = radeon_vm_bo_update(rdev, bo_va, &bo->tbo.mem); | ||
| 484 | if (r) | 500 | if (r) |
| 485 | return r; | 501 | return r; |
| 486 | } | 502 | } |
diff --git a/drivers/gpu/drm/radeon/radeon_device.c b/drivers/gpu/drm/radeon/radeon_device.c index 03686fab842d..697add2cd4e3 100644 --- a/drivers/gpu/drm/radeon/radeon_device.c +++ b/drivers/gpu/drm/radeon/radeon_device.c | |||
| @@ -1056,36 +1056,36 @@ static void radeon_check_arguments(struct radeon_device *rdev) | |||
| 1056 | if (!radeon_check_pot_argument(radeon_vm_size)) { | 1056 | if (!radeon_check_pot_argument(radeon_vm_size)) { |
| 1057 | dev_warn(rdev->dev, "VM size (%d) must be a power of 2\n", | 1057 | dev_warn(rdev->dev, "VM size (%d) must be a power of 2\n", |
| 1058 | radeon_vm_size); | 1058 | radeon_vm_size); |
| 1059 | radeon_vm_size = 4096; | 1059 | radeon_vm_size = 4; |
| 1060 | } | 1060 | } |
| 1061 | 1061 | ||
| 1062 | if (radeon_vm_size < 4) { | 1062 | if (radeon_vm_size < 1) { |
| 1063 | dev_warn(rdev->dev, "VM size (%d) to small, min is 4MB\n", | 1063 | dev_warn(rdev->dev, "VM size (%d) to small, min is 1GB\n", |
| 1064 | radeon_vm_size); | 1064 | radeon_vm_size); |
| 1065 | radeon_vm_size = 4096; | 1065 | radeon_vm_size = 4; |
| 1066 | } | 1066 | } |
| 1067 | 1067 | ||
| 1068 | /* | 1068 | /* |
| 1069 | * Max GPUVM size for Cayman, SI and CI are 40 bits. | 1069 | * Max GPUVM size for Cayman, SI and CI are 40 bits. |
| 1070 | */ | 1070 | */ |
| 1071 | if (radeon_vm_size > 1024*1024) { | 1071 | if (radeon_vm_size > 1024) { |
| 1072 | dev_warn(rdev->dev, "VM size (%d) to large, max is 1TB\n", | 1072 | dev_warn(rdev->dev, "VM size (%d) too large, max is 1TB\n", |
| 1073 | radeon_vm_size); | 1073 | radeon_vm_size); |
| 1074 | radeon_vm_size = 4096; | 1074 | radeon_vm_size = 4; |
| 1075 | } | 1075 | } |
| 1076 | 1076 | ||
| 1077 | /* defines number of bits in page table versus page directory, | 1077 | /* defines number of bits in page table versus page directory, |
| 1078 | * a page is 4KB so we have 12 bits offset, minimum 9 bits in the | 1078 | * a page is 4KB so we have 12 bits offset, minimum 9 bits in the |
| 1079 | * page table and the remaining bits are in the page directory */ | 1079 | * page table and the remaining bits are in the page directory */ |
| 1080 | if (radeon_vm_block_size < 9) { | 1080 | if (radeon_vm_block_size < 9) { |
| 1081 | dev_warn(rdev->dev, "VM page table size (%d) to small\n", | 1081 | dev_warn(rdev->dev, "VM page table size (%d) too small\n", |
| 1082 | radeon_vm_block_size); | 1082 | radeon_vm_block_size); |
| 1083 | radeon_vm_block_size = 9; | 1083 | radeon_vm_block_size = 9; |
| 1084 | } | 1084 | } |
| 1085 | 1085 | ||
| 1086 | if (radeon_vm_block_size > 24 || | 1086 | if (radeon_vm_block_size > 24 || |
| 1087 | radeon_vm_size < (1ull << radeon_vm_block_size)) { | 1087 | (radeon_vm_size * 1024) < (1ull << radeon_vm_block_size)) { |
| 1088 | dev_warn(rdev->dev, "VM page table size (%d) to large\n", | 1088 | dev_warn(rdev->dev, "VM page table size (%d) too large\n", |
| 1089 | radeon_vm_block_size); | 1089 | radeon_vm_block_size); |
| 1090 | radeon_vm_block_size = 9; | 1090 | radeon_vm_block_size = 9; |
| 1091 | } | 1091 | } |
| @@ -1238,7 +1238,7 @@ int radeon_device_init(struct radeon_device *rdev, | |||
| 1238 | /* Adjust VM size here. | 1238 | /* Adjust VM size here. |
| 1239 | * Max GPUVM size for cayman+ is 40 bits. | 1239 | * Max GPUVM size for cayman+ is 40 bits. |
| 1240 | */ | 1240 | */ |
| 1241 | rdev->vm_manager.max_pfn = radeon_vm_size << 8; | 1241 | rdev->vm_manager.max_pfn = radeon_vm_size << 18; |
| 1242 | 1242 | ||
| 1243 | /* Set asic functions */ | 1243 | /* Set asic functions */ |
| 1244 | r = radeon_asic_init(rdev); | 1244 | r = radeon_asic_init(rdev); |
diff --git a/drivers/gpu/drm/radeon/radeon_display.c b/drivers/gpu/drm/radeon/radeon_display.c index 5ed617056b9c..bf25061c8ac4 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,8 @@ 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 | ||
| 360 | radeon_fence_unref(&work->fence); | 368 | drm_vblank_put(rdev->ddev, radeon_crtc->crtc_id); |
| 361 | radeon_irq_kms_pflip_irq_get(rdev, work->crtc_id); | 369 | radeon_irq_kms_pflip_irq_put(rdev, work->crtc_id); |
| 362 | queue_work(radeon_crtc->flip_queue, &work->unpin_work); | 370 | queue_work(radeon_crtc->flip_queue, &work->unpin_work); |
| 363 | } | 371 | } |
| 364 | 372 | ||
| @@ -377,51 +385,108 @@ static void radeon_flip_work_func(struct work_struct *__work) | |||
| 377 | struct radeon_crtc *radeon_crtc = rdev->mode_info.crtcs[work->crtc_id]; | 385 | struct radeon_crtc *radeon_crtc = rdev->mode_info.crtcs[work->crtc_id]; |
| 378 | 386 | ||
| 379 | struct drm_crtc *crtc = &radeon_crtc->base; | 387 | struct drm_crtc *crtc = &radeon_crtc->base; |
| 380 | struct drm_framebuffer *fb = work->fb; | ||
| 381 | |||
| 382 | uint32_t tiling_flags, pitch_pixels; | ||
| 383 | uint64_t base; | ||
| 384 | |||
| 385 | unsigned long flags; | 388 | unsigned long flags; |
| 386 | int r; | 389 | int r; |
| 387 | 390 | ||
| 388 | down_read(&rdev->exclusive_lock); | 391 | down_read(&rdev->exclusive_lock); |
| 389 | while (work->fence) { | 392 | if (work->fence) { |
| 390 | r = radeon_fence_wait(work->fence, false); | 393 | r = radeon_fence_wait(work->fence, false); |
| 391 | if (r == -EDEADLK) { | 394 | if (r == -EDEADLK) { |
| 392 | up_read(&rdev->exclusive_lock); | 395 | up_read(&rdev->exclusive_lock); |
| 393 | r = radeon_gpu_reset(rdev); | 396 | r = radeon_gpu_reset(rdev); |
| 394 | down_read(&rdev->exclusive_lock); | 397 | down_read(&rdev->exclusive_lock); |
| 395 | } | 398 | } |
| 399 | if (r) | ||
| 400 | DRM_ERROR("failed to wait on page flip fence (%d)!\n", r); | ||
| 396 | 401 | ||
| 397 | if (r) { | 402 | /* We continue with the page flip even if we failed to wait on |
| 398 | DRM_ERROR("failed to wait on page flip fence (%d)!\n", | 403 | * the fence, otherwise the DRM core and userspace will be |
| 399 | r); | 404 | * confused about which BO the CRTC is scanning out |
| 400 | goto cleanup; | 405 | */ |
| 401 | } else | 406 | |
| 402 | radeon_fence_unref(&work->fence); | 407 | radeon_fence_unref(&work->fence); |
| 403 | } | 408 | } |
| 404 | 409 | ||
| 410 | /* We borrow the event spin lock for protecting flip_status */ | ||
| 411 | spin_lock_irqsave(&crtc->dev->event_lock, flags); | ||
| 412 | |||
| 413 | /* set the proper interrupt */ | ||
| 414 | radeon_irq_kms_pflip_irq_get(rdev, radeon_crtc->crtc_id); | ||
| 415 | |||
| 416 | /* do the flip (mmio) */ | ||
| 417 | radeon_page_flip(rdev, radeon_crtc->crtc_id, work->base); | ||
| 418 | |||
| 419 | radeon_crtc->flip_status = RADEON_FLIP_SUBMITTED; | ||
| 420 | spin_unlock_irqrestore(&crtc->dev->event_lock, flags); | ||
| 421 | up_read(&rdev->exclusive_lock); | ||
| 422 | } | ||
| 423 | |||
| 424 | static int radeon_crtc_page_flip(struct drm_crtc *crtc, | ||
| 425 | struct drm_framebuffer *fb, | ||
| 426 | struct drm_pending_vblank_event *event, | ||
| 427 | uint32_t page_flip_flags) | ||
| 428 | { | ||
| 429 | struct drm_device *dev = crtc->dev; | ||
| 430 | struct radeon_device *rdev = dev->dev_private; | ||
| 431 | struct radeon_crtc *radeon_crtc = to_radeon_crtc(crtc); | ||
| 432 | struct radeon_framebuffer *old_radeon_fb; | ||
| 433 | struct radeon_framebuffer *new_radeon_fb; | ||
| 434 | struct drm_gem_object *obj; | ||
| 435 | struct radeon_flip_work *work; | ||
| 436 | struct radeon_bo *new_rbo; | ||
| 437 | uint32_t tiling_flags, pitch_pixels; | ||
| 438 | uint64_t base; | ||
| 439 | unsigned long flags; | ||
| 440 | int r; | ||
| 441 | |||
| 442 | work = kzalloc(sizeof *work, GFP_KERNEL); | ||
| 443 | if (work == NULL) | ||
| 444 | return -ENOMEM; | ||
| 445 | |||
| 446 | INIT_WORK(&work->flip_work, radeon_flip_work_func); | ||
| 447 | INIT_WORK(&work->unpin_work, radeon_unpin_work_func); | ||
| 448 | |||
| 449 | work->rdev = rdev; | ||
| 450 | work->crtc_id = radeon_crtc->crtc_id; | ||
| 451 | work->event = event; | ||
| 452 | |||
| 453 | /* schedule unpin of the old buffer */ | ||
| 454 | old_radeon_fb = to_radeon_framebuffer(crtc->primary->fb); | ||
| 455 | obj = old_radeon_fb->obj; | ||
| 456 | |||
| 457 | /* take a reference to the old object */ | ||
| 458 | drm_gem_object_reference(obj); | ||
| 459 | work->old_rbo = gem_to_radeon_bo(obj); | ||
| 460 | |||
| 461 | new_radeon_fb = to_radeon_framebuffer(fb); | ||
| 462 | obj = new_radeon_fb->obj; | ||
| 463 | new_rbo = gem_to_radeon_bo(obj); | ||
| 464 | |||
| 465 | spin_lock(&new_rbo->tbo.bdev->fence_lock); | ||
| 466 | if (new_rbo->tbo.sync_obj) | ||
| 467 | work->fence = radeon_fence_ref(new_rbo->tbo.sync_obj); | ||
| 468 | spin_unlock(&new_rbo->tbo.bdev->fence_lock); | ||
| 469 | |||
| 405 | /* pin the new buffer */ | 470 | /* pin the new buffer */ |
| 406 | DRM_DEBUG_DRIVER("flip-ioctl() cur_fbo = %p, cur_bbo = %p\n", | 471 | DRM_DEBUG_DRIVER("flip-ioctl() cur_rbo = %p, new_rbo = %p\n", |
| 407 | work->old_rbo, work->new_rbo); | 472 | work->old_rbo, new_rbo); |
| 408 | 473 | ||
| 409 | r = radeon_bo_reserve(work->new_rbo, false); | 474 | r = radeon_bo_reserve(new_rbo, false); |
| 410 | if (unlikely(r != 0)) { | 475 | if (unlikely(r != 0)) { |
| 411 | DRM_ERROR("failed to reserve new rbo buffer before flip\n"); | 476 | DRM_ERROR("failed to reserve new rbo buffer before flip\n"); |
| 412 | goto cleanup; | 477 | goto cleanup; |
| 413 | } | 478 | } |
| 414 | /* Only 27 bit offset for legacy CRTC */ | 479 | /* Only 27 bit offset for legacy CRTC */ |
| 415 | r = radeon_bo_pin_restricted(work->new_rbo, RADEON_GEM_DOMAIN_VRAM, | 480 | r = radeon_bo_pin_restricted(new_rbo, RADEON_GEM_DOMAIN_VRAM, |
| 416 | ASIC_IS_AVIVO(rdev) ? 0 : 1 << 27, &base); | 481 | ASIC_IS_AVIVO(rdev) ? 0 : 1 << 27, &base); |
| 417 | if (unlikely(r != 0)) { | 482 | if (unlikely(r != 0)) { |
| 418 | radeon_bo_unreserve(work->new_rbo); | 483 | radeon_bo_unreserve(new_rbo); |
| 419 | r = -EINVAL; | 484 | r = -EINVAL; |
| 420 | DRM_ERROR("failed to pin new rbo buffer before flip\n"); | 485 | DRM_ERROR("failed to pin new rbo buffer before flip\n"); |
| 421 | goto cleanup; | 486 | goto cleanup; |
| 422 | } | 487 | } |
| 423 | radeon_bo_get_tiling_flags(work->new_rbo, &tiling_flags, NULL); | 488 | radeon_bo_get_tiling_flags(new_rbo, &tiling_flags, NULL); |
| 424 | radeon_bo_unreserve(work->new_rbo); | 489 | radeon_bo_unreserve(new_rbo); |
| 425 | 490 | ||
| 426 | if (!ASIC_IS_AVIVO(rdev)) { | 491 | if (!ASIC_IS_AVIVO(rdev)) { |
| 427 | /* crtc offset is from display base addr not FB location */ | 492 | /* crtc offset is from display base addr not FB location */ |
| @@ -458,82 +523,24 @@ static void radeon_flip_work_func(struct work_struct *__work) | |||
| 458 | } | 523 | } |
| 459 | base &= ~7; | 524 | base &= ~7; |
| 460 | } | 525 | } |
| 526 | work->base = base; | ||
| 461 | 527 | ||
| 462 | /* We borrow the event spin lock for protecting flip_work */ | 528 | r = drm_vblank_get(crtc->dev, radeon_crtc->crtc_id); |
| 463 | spin_lock_irqsave(&crtc->dev->event_lock, flags); | 529 | if (r) { |
| 464 | 530 | DRM_ERROR("failed to get vblank before flip\n"); | |
| 465 | /* set the proper interrupt */ | 531 | goto pflip_cleanup; |
| 466 | radeon_irq_kms_pflip_irq_get(rdev, radeon_crtc->crtc_id); | 532 | } |
| 467 | |||
| 468 | /* do the flip (mmio) */ | ||
| 469 | radeon_page_flip(rdev, radeon_crtc->crtc_id, base); | ||
| 470 | |||
| 471 | spin_unlock_irqrestore(&crtc->dev->event_lock, flags); | ||
| 472 | up_read(&rdev->exclusive_lock); | ||
| 473 | |||
| 474 | return; | ||
| 475 | |||
| 476 | cleanup: | ||
| 477 | drm_gem_object_unreference_unlocked(&work->old_rbo->gem_base); | ||
| 478 | radeon_fence_unref(&work->fence); | ||
| 479 | kfree(work); | ||
| 480 | up_read(&rdev->exclusive_lock); | ||
| 481 | } | ||
| 482 | |||
| 483 | static int radeon_crtc_page_flip(struct drm_crtc *crtc, | ||
| 484 | struct drm_framebuffer *fb, | ||
| 485 | struct drm_pending_vblank_event *event, | ||
| 486 | uint32_t page_flip_flags) | ||
| 487 | { | ||
| 488 | struct drm_device *dev = crtc->dev; | ||
| 489 | struct radeon_device *rdev = dev->dev_private; | ||
| 490 | struct radeon_crtc *radeon_crtc = to_radeon_crtc(crtc); | ||
| 491 | struct radeon_framebuffer *old_radeon_fb; | ||
| 492 | struct radeon_framebuffer *new_radeon_fb; | ||
| 493 | struct drm_gem_object *obj; | ||
| 494 | struct radeon_flip_work *work; | ||
| 495 | unsigned long flags; | ||
| 496 | |||
| 497 | work = kzalloc(sizeof *work, GFP_KERNEL); | ||
| 498 | if (work == NULL) | ||
| 499 | return -ENOMEM; | ||
| 500 | |||
| 501 | INIT_WORK(&work->flip_work, radeon_flip_work_func); | ||
| 502 | INIT_WORK(&work->unpin_work, radeon_unpin_work_func); | ||
| 503 | |||
| 504 | work->rdev = rdev; | ||
| 505 | work->crtc_id = radeon_crtc->crtc_id; | ||
| 506 | work->fb = fb; | ||
| 507 | work->event = event; | ||
| 508 | |||
| 509 | /* schedule unpin of the old buffer */ | ||
| 510 | old_radeon_fb = to_radeon_framebuffer(crtc->primary->fb); | ||
| 511 | obj = old_radeon_fb->obj; | ||
| 512 | |||
| 513 | /* take a reference to the old object */ | ||
| 514 | drm_gem_object_reference(obj); | ||
| 515 | work->old_rbo = gem_to_radeon_bo(obj); | ||
| 516 | |||
| 517 | new_radeon_fb = to_radeon_framebuffer(fb); | ||
| 518 | obj = new_radeon_fb->obj; | ||
| 519 | work->new_rbo = gem_to_radeon_bo(obj); | ||
| 520 | |||
| 521 | spin_lock(&work->new_rbo->tbo.bdev->fence_lock); | ||
| 522 | if (work->new_rbo->tbo.sync_obj) | ||
| 523 | work->fence = radeon_fence_ref(work->new_rbo->tbo.sync_obj); | ||
| 524 | spin_unlock(&work->new_rbo->tbo.bdev->fence_lock); | ||
| 525 | 533 | ||
| 526 | /* We borrow the event spin lock for protecting flip_work */ | 534 | /* We borrow the event spin lock for protecting flip_work */ |
| 527 | spin_lock_irqsave(&crtc->dev->event_lock, flags); | 535 | spin_lock_irqsave(&crtc->dev->event_lock, flags); |
| 528 | 536 | ||
| 529 | if (radeon_crtc->flip_work) { | 537 | if (radeon_crtc->flip_status != RADEON_FLIP_NONE) { |
| 530 | DRM_DEBUG_DRIVER("flip queue: crtc already busy\n"); | 538 | DRM_DEBUG_DRIVER("flip queue: crtc already busy\n"); |
| 531 | spin_unlock_irqrestore(&crtc->dev->event_lock, flags); | 539 | spin_unlock_irqrestore(&crtc->dev->event_lock, flags); |
| 532 | drm_gem_object_unreference_unlocked(&work->old_rbo->gem_base); | 540 | r = -EBUSY; |
| 533 | radeon_fence_unref(&work->fence); | 541 | goto vblank_cleanup; |
| 534 | kfree(work); | ||
| 535 | return -EBUSY; | ||
| 536 | } | 542 | } |
| 543 | radeon_crtc->flip_status = RADEON_FLIP_PENDING; | ||
| 537 | radeon_crtc->flip_work = work; | 544 | radeon_crtc->flip_work = work; |
| 538 | 545 | ||
| 539 | /* update crtc fb */ | 546 | /* update crtc fb */ |
| @@ -542,8 +549,27 @@ static int radeon_crtc_page_flip(struct drm_crtc *crtc, | |||
| 542 | spin_unlock_irqrestore(&crtc->dev->event_lock, flags); | 549 | spin_unlock_irqrestore(&crtc->dev->event_lock, flags); |
| 543 | 550 | ||
| 544 | queue_work(radeon_crtc->flip_queue, &work->flip_work); | 551 | queue_work(radeon_crtc->flip_queue, &work->flip_work); |
| 545 | |||
| 546 | return 0; | 552 | return 0; |
| 553 | |||
| 554 | vblank_cleanup: | ||
| 555 | drm_vblank_put(crtc->dev, radeon_crtc->crtc_id); | ||
| 556 | |||
| 557 | pflip_cleanup: | ||
| 558 | if (unlikely(radeon_bo_reserve(new_rbo, false) != 0)) { | ||
| 559 | DRM_ERROR("failed to reserve new rbo in error path\n"); | ||
| 560 | goto cleanup; | ||
| 561 | } | ||
| 562 | if (unlikely(radeon_bo_unpin(new_rbo) != 0)) { | ||
| 563 | DRM_ERROR("failed to unpin new rbo in error path\n"); | ||
| 564 | } | ||
| 565 | radeon_bo_unreserve(new_rbo); | ||
| 566 | |||
| 567 | cleanup: | ||
| 568 | drm_gem_object_unreference_unlocked(&work->old_rbo->gem_base); | ||
| 569 | radeon_fence_unref(&work->fence); | ||
| 570 | kfree(work); | ||
| 571 | |||
| 572 | return r; | ||
| 547 | } | 573 | } |
| 548 | 574 | ||
| 549 | static int | 575 | static int |
| @@ -803,6 +829,10 @@ int radeon_ddc_get_modes(struct radeon_connector *radeon_connector) | |||
| 803 | struct radeon_device *rdev = dev->dev_private; | 829 | struct radeon_device *rdev = dev->dev_private; |
| 804 | int ret = 0; | 830 | int ret = 0; |
| 805 | 831 | ||
| 832 | /* don't leak the edid if we already fetched it in detect() */ | ||
| 833 | if (radeon_connector->edid) | ||
| 834 | goto got_edid; | ||
| 835 | |||
| 806 | /* on hw with routers, select right port */ | 836 | /* on hw with routers, select right port */ |
| 807 | if (radeon_connector->router.ddc_valid) | 837 | if (radeon_connector->router.ddc_valid) |
| 808 | radeon_router_select_ddc_port(radeon_connector); | 838 | radeon_router_select_ddc_port(radeon_connector); |
| @@ -841,6 +871,7 @@ int radeon_ddc_get_modes(struct radeon_connector *radeon_connector) | |||
| 841 | radeon_connector->edid = radeon_bios_get_hardcoded_edid(rdev); | 871 | radeon_connector->edid = radeon_bios_get_hardcoded_edid(rdev); |
| 842 | } | 872 | } |
| 843 | if (radeon_connector->edid) { | 873 | if (radeon_connector->edid) { |
| 874 | got_edid: | ||
| 844 | drm_mode_connector_update_edid_property(&radeon_connector->base, radeon_connector->edid); | 875 | drm_mode_connector_update_edid_property(&radeon_connector->base, radeon_connector->edid); |
| 845 | ret = drm_add_edid_modes(&radeon_connector->base, radeon_connector->edid); | 876 | ret = drm_add_edid_modes(&radeon_connector->base, radeon_connector->edid); |
| 846 | drm_edid_to_eld(&radeon_connector->base, radeon_connector->edid); | 877 | drm_edid_to_eld(&radeon_connector->base, radeon_connector->edid); |
diff --git a/drivers/gpu/drm/radeon/radeon_drv.c b/drivers/gpu/drm/radeon/radeon_drv.c index 6e3017413386..e9e361084249 100644 --- a/drivers/gpu/drm/radeon/radeon_drv.c +++ b/drivers/gpu/drm/radeon/radeon_drv.c | |||
| @@ -173,8 +173,9 @@ int radeon_dpm = -1; | |||
| 173 | int radeon_aspm = -1; | 173 | int radeon_aspm = -1; |
| 174 | int radeon_runtime_pm = -1; | 174 | 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 = 4; |
| 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); |
| @@ -242,12 +243,15 @@ module_param_named(runpm, radeon_runtime_pm, int, 0444); | |||
| 242 | MODULE_PARM_DESC(hard_reset, "PCI config reset (1 = force enable, 0 = disable (default))"); | 243 | MODULE_PARM_DESC(hard_reset, "PCI config reset (1 = force enable, 0 = disable (default))"); |
| 243 | module_param_named(hard_reset, radeon_hard_reset, int, 0444); | 244 | module_param_named(hard_reset, radeon_hard_reset, int, 0444); |
| 244 | 245 | ||
| 245 | MODULE_PARM_DESC(vm_size, "VM address space size in megabytes (default 4GB)"); | 246 | MODULE_PARM_DESC(vm_size, "VM address space size in gigabytes (default 4GB)"); |
| 246 | module_param_named(vm_size, radeon_vm_size, int, 0444); | 247 | module_param_named(vm_size, radeon_vm_size, int, 0444); |
| 247 | 248 | ||
| 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_kms.c b/drivers/gpu/drm/radeon/radeon_kms.c index 35d931881b4b..d25ae6acfd5a 100644 --- a/drivers/gpu/drm/radeon/radeon_kms.c +++ b/drivers/gpu/drm/radeon/radeon_kms.c | |||
| @@ -579,7 +579,7 @@ int radeon_driver_open_kms(struct drm_device *dev, struct drm_file *file_priv) | |||
| 579 | /* new gpu have virtual address space support */ | 579 | /* new gpu have virtual address space support */ |
| 580 | if (rdev->family >= CHIP_CAYMAN) { | 580 | if (rdev->family >= CHIP_CAYMAN) { |
| 581 | struct radeon_fpriv *fpriv; | 581 | struct radeon_fpriv *fpriv; |
| 582 | struct radeon_bo_va *bo_va; | 582 | struct radeon_vm *vm; |
| 583 | int r; | 583 | int r; |
| 584 | 584 | ||
| 585 | fpriv = kzalloc(sizeof(*fpriv), GFP_KERNEL); | 585 | fpriv = kzalloc(sizeof(*fpriv), GFP_KERNEL); |
| @@ -587,7 +587,8 @@ int radeon_driver_open_kms(struct drm_device *dev, struct drm_file *file_priv) | |||
| 587 | return -ENOMEM; | 587 | return -ENOMEM; |
| 588 | } | 588 | } |
| 589 | 589 | ||
| 590 | r = radeon_vm_init(rdev, &fpriv->vm); | 590 | vm = &fpriv->vm; |
| 591 | r = radeon_vm_init(rdev, vm); | ||
| 591 | if (r) { | 592 | if (r) { |
| 592 | kfree(fpriv); | 593 | kfree(fpriv); |
| 593 | return r; | 594 | return r; |
| @@ -596,22 +597,23 @@ int radeon_driver_open_kms(struct drm_device *dev, struct drm_file *file_priv) | |||
| 596 | if (rdev->accel_working) { | 597 | if (rdev->accel_working) { |
| 597 | r = radeon_bo_reserve(rdev->ring_tmp_bo.bo, false); | 598 | r = radeon_bo_reserve(rdev->ring_tmp_bo.bo, false); |
| 598 | if (r) { | 599 | if (r) { |
| 599 | radeon_vm_fini(rdev, &fpriv->vm); | 600 | radeon_vm_fini(rdev, vm); |
| 600 | kfree(fpriv); | 601 | kfree(fpriv); |
| 601 | return r; | 602 | return r; |
| 602 | } | 603 | } |
| 603 | 604 | ||
| 604 | /* map the ib pool buffer read only into | 605 | /* map the ib pool buffer read only into |
| 605 | * virtual address space */ | 606 | * virtual address space */ |
| 606 | bo_va = radeon_vm_bo_add(rdev, &fpriv->vm, | 607 | vm->ib_bo_va = radeon_vm_bo_add(rdev, vm, |
| 607 | rdev->ring_tmp_bo.bo); | 608 | rdev->ring_tmp_bo.bo); |
| 608 | r = radeon_vm_bo_set_addr(rdev, bo_va, RADEON_VA_IB_OFFSET, | 609 | r = radeon_vm_bo_set_addr(rdev, vm->ib_bo_va, |
| 610 | RADEON_VA_IB_OFFSET, | ||
| 609 | RADEON_VM_PAGE_READABLE | | 611 | RADEON_VM_PAGE_READABLE | |
| 610 | RADEON_VM_PAGE_SNOOPED); | 612 | RADEON_VM_PAGE_SNOOPED); |
| 611 | 613 | ||
| 612 | radeon_bo_unreserve(rdev->ring_tmp_bo.bo); | 614 | radeon_bo_unreserve(rdev->ring_tmp_bo.bo); |
| 613 | if (r) { | 615 | if (r) { |
| 614 | radeon_vm_fini(rdev, &fpriv->vm); | 616 | radeon_vm_fini(rdev, vm); |
| 615 | kfree(fpriv); | 617 | kfree(fpriv); |
| 616 | return r; | 618 | return r; |
| 617 | } | 619 | } |
| @@ -640,21 +642,19 @@ void radeon_driver_postclose_kms(struct drm_device *dev, | |||
| 640 | /* new gpu have virtual address space support */ | 642 | /* new gpu have virtual address space support */ |
| 641 | if (rdev->family >= CHIP_CAYMAN && file_priv->driver_priv) { | 643 | if (rdev->family >= CHIP_CAYMAN && file_priv->driver_priv) { |
| 642 | struct radeon_fpriv *fpriv = file_priv->driver_priv; | 644 | struct radeon_fpriv *fpriv = file_priv->driver_priv; |
| 643 | struct radeon_bo_va *bo_va; | 645 | struct radeon_vm *vm = &fpriv->vm; |
| 644 | int r; | 646 | int r; |
| 645 | 647 | ||
| 646 | if (rdev->accel_working) { | 648 | if (rdev->accel_working) { |
| 647 | r = radeon_bo_reserve(rdev->ring_tmp_bo.bo, false); | 649 | r = radeon_bo_reserve(rdev->ring_tmp_bo.bo, false); |
| 648 | if (!r) { | 650 | if (!r) { |
| 649 | bo_va = radeon_vm_bo_find(&fpriv->vm, | 651 | if (vm->ib_bo_va) |
| 650 | rdev->ring_tmp_bo.bo); | 652 | radeon_vm_bo_rmv(rdev, vm->ib_bo_va); |
| 651 | if (bo_va) | ||
| 652 | radeon_vm_bo_rmv(rdev, bo_va); | ||
| 653 | radeon_bo_unreserve(rdev->ring_tmp_bo.bo); | 653 | radeon_bo_unreserve(rdev->ring_tmp_bo.bo); |
| 654 | } | 654 | } |
| 655 | } | 655 | } |
| 656 | 656 | ||
| 657 | radeon_vm_fini(rdev, &fpriv->vm); | 657 | radeon_vm_fini(rdev, vm); |
| 658 | kfree(fpriv); | 658 | kfree(fpriv); |
| 659 | file_priv->driver_priv = NULL; | 659 | file_priv->driver_priv = NULL; |
| 660 | } | 660 | } |
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..725d3669014f 100644 --- a/drivers/gpu/drm/radeon/radeon_vm.c +++ b/drivers/gpu/drm/radeon/radeon_vm.c | |||
| @@ -332,6 +332,7 @@ struct radeon_bo_va *radeon_vm_bo_add(struct radeon_device *rdev, | |||
| 332 | bo_va->ref_count = 1; | 332 | bo_va->ref_count = 1; |
| 333 | INIT_LIST_HEAD(&bo_va->bo_list); | 333 | INIT_LIST_HEAD(&bo_va->bo_list); |
| 334 | INIT_LIST_HEAD(&bo_va->vm_list); | 334 | INIT_LIST_HEAD(&bo_va->vm_list); |
| 335 | INIT_LIST_HEAD(&bo_va->vm_status); | ||
| 335 | 336 | ||
| 336 | mutex_lock(&vm->mutex); | 337 | mutex_lock(&vm->mutex); |
| 337 | list_add(&bo_va->vm_list, &vm->va); | 338 | list_add(&bo_va->vm_list, &vm->va); |
| @@ -468,6 +469,19 @@ int radeon_vm_bo_set_addr(struct radeon_device *rdev, | |||
| 468 | head = &tmp->vm_list; | 469 | head = &tmp->vm_list; |
| 469 | } | 470 | } |
| 470 | 471 | ||
| 472 | if (bo_va->soffset) { | ||
| 473 | /* add a clone of the bo_va to clear the old address */ | ||
| 474 | tmp = kzalloc(sizeof(struct radeon_bo_va), GFP_KERNEL); | ||
| 475 | if (!tmp) { | ||
| 476 | mutex_unlock(&vm->mutex); | ||
| 477 | return -ENOMEM; | ||
| 478 | } | ||
| 479 | tmp->soffset = bo_va->soffset; | ||
| 480 | tmp->eoffset = bo_va->eoffset; | ||
| 481 | tmp->vm = vm; | ||
| 482 | list_add(&tmp->vm_status, &vm->freed); | ||
| 483 | } | ||
| 484 | |||
| 471 | bo_va->soffset = soffset; | 485 | bo_va->soffset = soffset; |
| 472 | bo_va->eoffset = eoffset; | 486 | bo_va->eoffset = eoffset; |
| 473 | bo_va->flags = flags; | 487 | bo_va->flags = flags; |
| @@ -495,7 +509,7 @@ int radeon_vm_bo_set_addr(struct radeon_device *rdev, | |||
| 495 | mutex_unlock(&vm->mutex); | 509 | mutex_unlock(&vm->mutex); |
| 496 | 510 | ||
| 497 | r = radeon_bo_create(rdev, RADEON_VM_PTE_COUNT * 8, | 511 | r = radeon_bo_create(rdev, RADEON_VM_PTE_COUNT * 8, |
| 498 | RADEON_GPU_PAGE_SIZE, false, | 512 | RADEON_GPU_PAGE_SIZE, true, |
| 499 | RADEON_GEM_DOMAIN_VRAM, NULL, &pt); | 513 | RADEON_GEM_DOMAIN_VRAM, NULL, &pt); |
| 500 | if (r) | 514 | if (r) |
| 501 | return r; | 515 | return r; |
| @@ -823,25 +837,19 @@ static void radeon_vm_update_ptes(struct radeon_device *rdev, | |||
| 823 | * Object have to be reserved and mutex must be locked! | 837 | * Object have to be reserved and mutex must be locked! |
| 824 | */ | 838 | */ |
| 825 | int radeon_vm_bo_update(struct radeon_device *rdev, | 839 | int radeon_vm_bo_update(struct radeon_device *rdev, |
| 826 | struct radeon_vm *vm, | 840 | struct radeon_bo_va *bo_va, |
| 827 | struct radeon_bo *bo, | ||
| 828 | struct ttm_mem_reg *mem) | 841 | struct ttm_mem_reg *mem) |
| 829 | { | 842 | { |
| 843 | struct radeon_vm *vm = bo_va->vm; | ||
| 830 | struct radeon_ib ib; | 844 | struct radeon_ib ib; |
| 831 | struct radeon_bo_va *bo_va; | ||
| 832 | unsigned nptes, ndw; | 845 | unsigned nptes, ndw; |
| 833 | uint64_t addr; | 846 | uint64_t addr; |
| 834 | int r; | 847 | int r; |
| 835 | 848 | ||
| 836 | bo_va = radeon_vm_bo_find(vm, bo); | ||
| 837 | if (bo_va == NULL) { | ||
| 838 | dev_err(rdev->dev, "bo %p not in vm %p\n", bo, vm); | ||
| 839 | return -EINVAL; | ||
| 840 | } | ||
| 841 | 849 | ||
| 842 | if (!bo_va->soffset) { | 850 | if (!bo_va->soffset) { |
| 843 | dev_err(rdev->dev, "bo %p don't has a mapping in vm %p\n", | 851 | dev_err(rdev->dev, "bo %p don't has a mapping in vm %p\n", |
| 844 | bo, vm); | 852 | bo_va->bo, vm); |
| 845 | return -EINVAL; | 853 | return -EINVAL; |
| 846 | } | 854 | } |
| 847 | 855 | ||
| @@ -868,7 +876,7 @@ int radeon_vm_bo_update(struct radeon_device *rdev, | |||
| 868 | 876 | ||
| 869 | trace_radeon_vm_bo_update(bo_va); | 877 | trace_radeon_vm_bo_update(bo_va); |
| 870 | 878 | ||
| 871 | nptes = radeon_bo_ngpu_pages(bo); | 879 | nptes = (bo_va->eoffset - bo_va->soffset) / RADEON_GPU_PAGE_SIZE; |
| 872 | 880 | ||
| 873 | /* padding, etc. */ | 881 | /* padding, etc. */ |
| 874 | ndw = 64; | 882 | ndw = 64; |
| @@ -911,33 +919,61 @@ int radeon_vm_bo_update(struct radeon_device *rdev, | |||
| 911 | } | 919 | } |
| 912 | 920 | ||
| 913 | /** | 921 | /** |
| 922 | * radeon_vm_clear_freed - clear freed BOs in the PT | ||
| 923 | * | ||
| 924 | * @rdev: radeon_device pointer | ||
| 925 | * @vm: requested vm | ||
| 926 | * | ||
| 927 | * Make sure all freed BOs are cleared in the PT. | ||
| 928 | * Returns 0 for success. | ||
| 929 | * | ||
| 930 | * PTs have to be reserved and mutex must be locked! | ||
| 931 | */ | ||
| 932 | int radeon_vm_clear_freed(struct radeon_device *rdev, | ||
| 933 | struct radeon_vm *vm) | ||
| 934 | { | ||
| 935 | struct radeon_bo_va *bo_va, *tmp; | ||
| 936 | int r; | ||
| 937 | |||
| 938 | list_for_each_entry_safe(bo_va, tmp, &vm->freed, vm_status) { | ||
| 939 | list_del(&bo_va->vm_status); | ||
| 940 | r = radeon_vm_bo_update(rdev, bo_va, NULL); | ||
| 941 | kfree(bo_va); | ||
| 942 | if (r) | ||
| 943 | return r; | ||
| 944 | } | ||
| 945 | return 0; | ||
| 946 | |||
| 947 | } | ||
| 948 | |||
| 949 | /** | ||
| 914 | * radeon_vm_bo_rmv - remove a bo to a specific vm | 950 | * radeon_vm_bo_rmv - remove a bo to a specific vm |
| 915 | * | 951 | * |
| 916 | * @rdev: radeon_device pointer | 952 | * @rdev: radeon_device pointer |
| 917 | * @bo_va: requested bo_va | 953 | * @bo_va: requested bo_va |
| 918 | * | 954 | * |
| 919 | * Remove @bo_va->bo from the requested vm (cayman+). | 955 | * Remove @bo_va->bo from the requested vm (cayman+). |
| 920 | * Remove @bo_va->bo from the list of bos associated with the bo_va->vm and | ||
| 921 | * remove the ptes for @bo_va in the page table. | ||
| 922 | * Returns 0 for success. | ||
| 923 | * | 956 | * |
| 924 | * Object have to be reserved! | 957 | * Object have to be reserved! |
| 925 | */ | 958 | */ |
| 926 | int radeon_vm_bo_rmv(struct radeon_device *rdev, | 959 | void radeon_vm_bo_rmv(struct radeon_device *rdev, |
| 927 | struct radeon_bo_va *bo_va) | 960 | struct radeon_bo_va *bo_va) |
| 928 | { | 961 | { |
| 929 | int r = 0; | 962 | struct radeon_vm *vm = bo_va->vm; |
| 930 | 963 | ||
| 931 | mutex_lock(&bo_va->vm->mutex); | 964 | list_del(&bo_va->bo_list); |
| 932 | if (bo_va->soffset) | ||
| 933 | r = radeon_vm_bo_update(rdev, bo_va->vm, bo_va->bo, NULL); | ||
| 934 | 965 | ||
| 966 | mutex_lock(&vm->mutex); | ||
| 935 | list_del(&bo_va->vm_list); | 967 | list_del(&bo_va->vm_list); |
| 936 | mutex_unlock(&bo_va->vm->mutex); | ||
| 937 | list_del(&bo_va->bo_list); | ||
| 938 | 968 | ||
| 939 | kfree(bo_va); | 969 | if (bo_va->soffset) { |
| 940 | return r; | 970 | bo_va->bo = NULL; |
| 971 | list_add(&bo_va->vm_status, &vm->freed); | ||
| 972 | } else { | ||
| 973 | kfree(bo_va); | ||
| 974 | } | ||
| 975 | |||
| 976 | mutex_unlock(&vm->mutex); | ||
| 941 | } | 977 | } |
| 942 | 978 | ||
| 943 | /** | 979 | /** |
| @@ -975,11 +1011,13 @@ int radeon_vm_init(struct radeon_device *rdev, struct radeon_vm *vm) | |||
| 975 | int r; | 1011 | int r; |
| 976 | 1012 | ||
| 977 | vm->id = 0; | 1013 | vm->id = 0; |
| 1014 | vm->ib_bo_va = NULL; | ||
| 978 | vm->fence = NULL; | 1015 | vm->fence = NULL; |
| 979 | vm->last_flush = NULL; | 1016 | vm->last_flush = NULL; |
| 980 | vm->last_id_use = NULL; | 1017 | vm->last_id_use = NULL; |
| 981 | mutex_init(&vm->mutex); | 1018 | mutex_init(&vm->mutex); |
| 982 | INIT_LIST_HEAD(&vm->va); | 1019 | INIT_LIST_HEAD(&vm->va); |
| 1020 | INIT_LIST_HEAD(&vm->freed); | ||
| 983 | 1021 | ||
| 984 | pd_size = radeon_vm_directory_size(rdev); | 1022 | pd_size = radeon_vm_directory_size(rdev); |
| 985 | pd_entries = radeon_vm_num_pdes(rdev); | 1023 | pd_entries = radeon_vm_num_pdes(rdev); |
| @@ -992,7 +1030,7 @@ int radeon_vm_init(struct radeon_device *rdev, struct radeon_vm *vm) | |||
| 992 | return -ENOMEM; | 1030 | return -ENOMEM; |
| 993 | } | 1031 | } |
| 994 | 1032 | ||
| 995 | r = radeon_bo_create(rdev, pd_size, align, false, | 1033 | r = radeon_bo_create(rdev, pd_size, align, true, |
| 996 | RADEON_GEM_DOMAIN_VRAM, NULL, | 1034 | RADEON_GEM_DOMAIN_VRAM, NULL, |
| 997 | &vm->page_directory); | 1035 | &vm->page_directory); |
| 998 | if (r) | 1036 | if (r) |
| @@ -1034,7 +1072,8 @@ void radeon_vm_fini(struct radeon_device *rdev, struct radeon_vm *vm) | |||
| 1034 | kfree(bo_va); | 1072 | kfree(bo_va); |
| 1035 | } | 1073 | } |
| 1036 | } | 1074 | } |
| 1037 | 1075 | list_for_each_entry_safe(bo_va, tmp, &vm->freed, vm_status) | |
| 1076 | kfree(bo_va); | ||
| 1038 | 1077 | ||
| 1039 | for (i = 0; i < radeon_vm_num_pdes(rdev); i++) | 1078 | for (i = 0; i < radeon_vm_num_pdes(rdev); i++) |
| 1040 | radeon_bo_unref(&vm->page_tables[i].bo); | 1079 | radeon_bo_unref(&vm->page_tables[i].bo); |
diff --git a/drivers/gpu/drm/radeon/rv515.c b/drivers/gpu/drm/radeon/rv515.c index 237dd29d9f1c..3e21e869015f 100644 --- a/drivers/gpu/drm/radeon/rv515.c +++ b/drivers/gpu/drm/radeon/rv515.c | |||
| @@ -406,8 +406,9 @@ void rv515_mc_resume(struct radeon_device *rdev, struct rv515_mc_save *save) | |||
| 406 | for (i = 0; i < rdev->num_crtc; i++) { | 406 | for (i = 0; i < rdev->num_crtc; i++) { |
| 407 | if (save->crtc_enabled[i]) { | 407 | if (save->crtc_enabled[i]) { |
| 408 | tmp = RREG32(AVIVO_D1MODE_MASTER_UPDATE_MODE + crtc_offsets[i]); | 408 | tmp = RREG32(AVIVO_D1MODE_MASTER_UPDATE_MODE + crtc_offsets[i]); |
| 409 | if ((tmp & 0x3) != 0) { | 409 | if ((tmp & 0x7) != 3) { |
| 410 | tmp &= ~0x3; | 410 | tmp &= ~0x7; |
| 411 | tmp |= 0x3; | ||
| 411 | WREG32(AVIVO_D1MODE_MASTER_UPDATE_MODE + crtc_offsets[i], tmp); | 412 | WREG32(AVIVO_D1MODE_MASTER_UPDATE_MODE + crtc_offsets[i], tmp); |
| 412 | } | 413 | } |
| 413 | tmp = RREG32(AVIVO_D1GRPH_UPDATE + crtc_offsets[i]); | 414 | tmp = RREG32(AVIVO_D1GRPH_UPDATE + crtc_offsets[i]); |
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..9e854fd016da 100644 --- a/drivers/gpu/drm/radeon/si.c +++ b/drivers/gpu/drm/radeon/si.c | |||
| @@ -6103,6 +6103,7 @@ static inline u32 si_get_ih_wptr(struct radeon_device *rdev) | |||
| 6103 | tmp = RREG32(IH_RB_CNTL); | 6103 | tmp = RREG32(IH_RB_CNTL); |
| 6104 | tmp |= IH_WPTR_OVERFLOW_CLEAR; | 6104 | tmp |= IH_WPTR_OVERFLOW_CLEAR; |
| 6105 | WREG32(IH_RB_CNTL, tmp); | 6105 | WREG32(IH_RB_CNTL, tmp); |
| 6106 | wptr &= ~RB_OVERFLOW; | ||
| 6106 | } | 6107 | } |
| 6107 | return (wptr & rdev->ih.ptr_mask); | 6108 | return (wptr & rdev->ih.ptr_mask); |
| 6108 | } | 6109 | } |
| @@ -6376,14 +6377,16 @@ restart_ih: | |||
| 6376 | case 147: | 6377 | case 147: |
| 6377 | addr = RREG32(VM_CONTEXT1_PROTECTION_FAULT_ADDR); | 6378 | addr = RREG32(VM_CONTEXT1_PROTECTION_FAULT_ADDR); |
| 6378 | status = RREG32(VM_CONTEXT1_PROTECTION_FAULT_STATUS); | 6379 | status = RREG32(VM_CONTEXT1_PROTECTION_FAULT_STATUS); |
| 6380 | /* reset addr and status */ | ||
| 6381 | WREG32_P(VM_CONTEXT1_CNTL2, 1, ~1); | ||
| 6382 | if (addr == 0x0 && status == 0x0) | ||
| 6383 | break; | ||
| 6379 | dev_err(rdev->dev, "GPU fault detected: %d 0x%08x\n", src_id, src_data); | 6384 | 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", | 6385 | dev_err(rdev->dev, " VM_CONTEXT1_PROTECTION_FAULT_ADDR 0x%08X\n", |
| 6381 | addr); | 6386 | addr); |
| 6382 | dev_err(rdev->dev, " VM_CONTEXT1_PROTECTION_FAULT_STATUS 0x%08X\n", | 6387 | dev_err(rdev->dev, " VM_CONTEXT1_PROTECTION_FAULT_STATUS 0x%08X\n", |
| 6383 | status); | 6388 | status); |
| 6384 | si_vm_decode_fault(rdev, status, addr); | 6389 | si_vm_decode_fault(rdev, status, addr); |
| 6385 | /* reset addr and status */ | ||
| 6386 | WREG32_P(VM_CONTEXT1_CNTL2, 1, ~1); | ||
| 6387 | break; | 6390 | break; |
| 6388 | case 176: /* RINGID0 CP_INT */ | 6391 | case 176: /* RINGID0 CP_INT */ |
| 6389 | radeon_fence_process(rdev, RADEON_RING_TYPE_GFX_INDEX); | 6392 | 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..32e50be9c4ac 100644 --- a/drivers/gpu/drm/radeon/trinity_dpm.c +++ b/drivers/gpu/drm/radeon/trinity_dpm.c | |||
| @@ -1874,7 +1874,16 @@ 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 with |
| 1878 | * bapm enabled when switching between AC and battery | ||
| 1879 | * power. At the same time, some MSI boards hang | ||
| 1880 | * if it's not enabled and dpm is enabled. Just enable | ||
| 1881 | * it for MSI boards right now. | ||
| 1882 | */ | ||
| 1883 | if (rdev->pdev->subsystem_vendor == 0x1462) | ||
| 1884 | pi->enable_bapm = true; | ||
| 1885 | else | ||
| 1886 | pi->enable_bapm = false; | ||
| 1878 | pi->enable_nbps_policy = true; | 1887 | pi->enable_nbps_policy = true; |
| 1879 | pi->enable_sclk_ds = true; | 1888 | pi->enable_sclk_ds = true; |
| 1880 | pi->enable_gfx_power_gating = true; | 1889 | 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_fcopy.c b/drivers/hv/hv_fcopy.c index eaaa3d843b80..23b2ce294c4c 100644 --- a/drivers/hv/hv_fcopy.c +++ b/drivers/hv/hv_fcopy.c | |||
| @@ -246,8 +246,8 @@ void hv_fcopy_onchannelcallback(void *context) | |||
| 246 | /* | 246 | /* |
| 247 | * Send the information to the user-level daemon. | 247 | * Send the information to the user-level daemon. |
| 248 | */ | 248 | */ |
| 249 | fcopy_send_data(); | ||
| 250 | schedule_delayed_work(&fcopy_work, 5*HZ); | 249 | schedule_delayed_work(&fcopy_work, 5*HZ); |
| 250 | fcopy_send_data(); | ||
| 251 | return; | 251 | return; |
| 252 | } | 252 | } |
| 253 | icmsghdr->icflags = ICMSGHDRFLAG_TRANSACTION | ICMSGHDRFLAG_RESPONSE; | 253 | icmsghdr->icflags = ICMSGHDRFLAG_TRANSACTION | ICMSGHDRFLAG_RESPONSE; |
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/adt7470.c b/drivers/hwmon/adt7470.c index 0f4dea5ccf17..9ee3913850d6 100644 --- a/drivers/hwmon/adt7470.c +++ b/drivers/hwmon/adt7470.c | |||
| @@ -515,7 +515,7 @@ static ssize_t set_temp_min(struct device *dev, | |||
| 515 | return -EINVAL; | 515 | return -EINVAL; |
| 516 | 516 | ||
| 517 | temp = DIV_ROUND_CLOSEST(temp, 1000); | 517 | temp = DIV_ROUND_CLOSEST(temp, 1000); |
| 518 | temp = clamp_val(temp, 0, 255); | 518 | temp = clamp_val(temp, -128, 127); |
| 519 | 519 | ||
| 520 | mutex_lock(&data->lock); | 520 | mutex_lock(&data->lock); |
| 521 | data->temp_min[attr->index] = temp; | 521 | data->temp_min[attr->index] = temp; |
| @@ -549,7 +549,7 @@ static ssize_t set_temp_max(struct device *dev, | |||
| 549 | return -EINVAL; | 549 | return -EINVAL; |
| 550 | 550 | ||
| 551 | temp = DIV_ROUND_CLOSEST(temp, 1000); | 551 | temp = DIV_ROUND_CLOSEST(temp, 1000); |
| 552 | temp = clamp_val(temp, 0, 255); | 552 | temp = clamp_val(temp, -128, 127); |
| 553 | 553 | ||
| 554 | mutex_lock(&data->lock); | 554 | mutex_lock(&data->lock); |
| 555 | data->temp_max[attr->index] = temp; | 555 | data->temp_max[attr->index] = temp; |
| @@ -826,7 +826,7 @@ static ssize_t set_pwm_tmin(struct device *dev, | |||
| 826 | return -EINVAL; | 826 | return -EINVAL; |
| 827 | 827 | ||
| 828 | temp = DIV_ROUND_CLOSEST(temp, 1000); | 828 | temp = DIV_ROUND_CLOSEST(temp, 1000); |
| 829 | temp = clamp_val(temp, 0, 255); | 829 | temp = clamp_val(temp, -128, 127); |
| 830 | 830 | ||
| 831 | mutex_lock(&data->lock); | 831 | mutex_lock(&data->lock); |
| 832 | data->pwm_tmin[attr->index] = temp; | 832 | data->pwm_tmin[attr->index] = temp; |
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/da9052-hwmon.c b/drivers/hwmon/da9052-hwmon.c index afd31042b452..d14ab3c45daa 100644 --- a/drivers/hwmon/da9052-hwmon.c +++ b/drivers/hwmon/da9052-hwmon.c | |||
| @@ -194,7 +194,7 @@ static ssize_t da9052_hwmon_show_name(struct device *dev, | |||
| 194 | struct device_attribute *devattr, | 194 | struct device_attribute *devattr, |
| 195 | char *buf) | 195 | char *buf) |
| 196 | { | 196 | { |
| 197 | return sprintf(buf, "da9052-hwmon\n"); | 197 | return sprintf(buf, "da9052\n"); |
| 198 | } | 198 | } |
| 199 | 199 | ||
| 200 | static ssize_t show_label(struct device *dev, | 200 | static ssize_t show_label(struct device *dev, |
diff --git a/drivers/hwmon/da9055-hwmon.c b/drivers/hwmon/da9055-hwmon.c index 73b3865f1207..35eb7738d711 100644 --- a/drivers/hwmon/da9055-hwmon.c +++ b/drivers/hwmon/da9055-hwmon.c | |||
| @@ -204,7 +204,7 @@ static ssize_t da9055_hwmon_show_name(struct device *dev, | |||
| 204 | struct device_attribute *devattr, | 204 | struct device_attribute *devattr, |
| 205 | char *buf) | 205 | char *buf) |
| 206 | { | 206 | { |
| 207 | return sprintf(buf, "da9055-hwmon\n"); | 207 | return sprintf(buf, "da9055\n"); |
| 208 | } | 208 | } |
| 209 | 209 | ||
| 210 | static ssize_t show_label(struct device *dev, | 210 | static ssize_t show_label(struct device *dev, |
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/smsc47m192.c b/drivers/hwmon/smsc47m192.c index efee4c59239f..34b9a601ad07 100644 --- a/drivers/hwmon/smsc47m192.c +++ b/drivers/hwmon/smsc47m192.c | |||
| @@ -86,7 +86,7 @@ static inline u8 IN_TO_REG(unsigned long val, int n) | |||
| 86 | */ | 86 | */ |
| 87 | static inline s8 TEMP_TO_REG(int val) | 87 | static inline s8 TEMP_TO_REG(int val) |
| 88 | { | 88 | { |
| 89 | return clamp_val(SCALE(val, 1, 1000), -128000, 127000); | 89 | return SCALE(clamp_val(val, -128000, 127000), 1, 1000); |
| 90 | } | 90 | } |
| 91 | 91 | ||
| 92 | static inline int TEMP_FROM_REG(s8 val) | 92 | static inline int TEMP_FROM_REG(s8 val) |
| @@ -384,6 +384,8 @@ static ssize_t set_vrm(struct device *dev, struct device_attribute *attr, | |||
| 384 | err = kstrtoul(buf, 10, &val); | 384 | err = kstrtoul(buf, 10, &val); |
| 385 | if (err) | 385 | if (err) |
| 386 | return err; | 386 | return err; |
| 387 | if (val > 255) | ||
| 388 | return -EINVAL; | ||
| 387 | 389 | ||
| 388 | data->vrm = val; | 390 | data->vrm = val; |
| 389 | return count; | 391 | return count; |
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/ide/Kconfig b/drivers/ide/Kconfig index 8fb46aab2d87..a04c49f2a011 100644 --- a/drivers/ide/Kconfig +++ b/drivers/ide/Kconfig | |||
| @@ -416,6 +416,7 @@ config BLK_DEV_CY82C693 | |||
| 416 | 416 | ||
| 417 | config BLK_DEV_CS5520 | 417 | config BLK_DEV_CS5520 |
| 418 | tristate "Cyrix CS5510/20 MediaGX chipset support (VERY EXPERIMENTAL)" | 418 | tristate "Cyrix CS5510/20 MediaGX chipset support (VERY EXPERIMENTAL)" |
| 419 | depends on X86_32 || COMPILE_TEST | ||
| 419 | select BLK_DEV_IDEDMA_PCI | 420 | select BLK_DEV_IDEDMA_PCI |
| 420 | help | 421 | help |
| 421 | Include support for PIO tuning and virtual DMA on the Cyrix MediaGX | 422 | Include support for PIO tuning and virtual DMA on the Cyrix MediaGX |
| @@ -426,6 +427,7 @@ config BLK_DEV_CS5520 | |||
| 426 | 427 | ||
| 427 | config BLK_DEV_CS5530 | 428 | config BLK_DEV_CS5530 |
| 428 | tristate "Cyrix/National Semiconductor CS5530 MediaGX chipset support" | 429 | tristate "Cyrix/National Semiconductor CS5530 MediaGX chipset support" |
| 430 | depends on X86_32 || COMPILE_TEST | ||
| 429 | select BLK_DEV_IDEDMA_PCI | 431 | select BLK_DEV_IDEDMA_PCI |
| 430 | help | 432 | help |
| 431 | Include support for UDMA on the Cyrix MediaGX 5530 chipset. This | 433 | Include support for UDMA on the Cyrix MediaGX 5530 chipset. This |
| @@ -435,7 +437,7 @@ config BLK_DEV_CS5530 | |||
| 435 | 437 | ||
| 436 | config BLK_DEV_CS5535 | 438 | config BLK_DEV_CS5535 |
| 437 | tristate "AMD CS5535 chipset support" | 439 | tristate "AMD CS5535 chipset support" |
| 438 | depends on X86 && !X86_64 | 440 | depends on X86_32 |
| 439 | select BLK_DEV_IDEDMA_PCI | 441 | select BLK_DEV_IDEDMA_PCI |
| 440 | help | 442 | help |
| 441 | Include support for UDMA on the NSC/AMD CS5535 companion chipset. | 443 | Include support for UDMA on the NSC/AMD CS5535 companion chipset. |
| @@ -486,6 +488,7 @@ config BLK_DEV_JMICRON | |||
| 486 | 488 | ||
| 487 | config BLK_DEV_SC1200 | 489 | config BLK_DEV_SC1200 |
| 488 | tristate "National SCx200 chipset support" | 490 | tristate "National SCx200 chipset support" |
| 491 | depends on X86_32 || COMPILE_TEST | ||
| 489 | select BLK_DEV_IDEDMA_PCI | 492 | select BLK_DEV_IDEDMA_PCI |
| 490 | help | 493 | help |
| 491 | This driver adds support for the on-board IDE controller on the | 494 | This driver adds support for the on-board IDE controller on the |
diff --git a/drivers/ide/ide-probe.c b/drivers/ide/ide-probe.c index 2a744a91370e..a3d3b1733c49 100644 --- a/drivers/ide/ide-probe.c +++ b/drivers/ide/ide-probe.c | |||
| @@ -853,8 +853,9 @@ static int init_irq (ide_hwif_t *hwif) | |||
| 853 | if (irq_handler == NULL) | 853 | if (irq_handler == NULL) |
| 854 | irq_handler = ide_intr; | 854 | irq_handler = ide_intr; |
| 855 | 855 | ||
| 856 | if (request_irq(hwif->irq, irq_handler, sa, hwif->name, hwif)) | 856 | if (!host->get_lock) |
| 857 | goto out_up; | 857 | if (request_irq(hwif->irq, irq_handler, sa, hwif->name, hwif)) |
| 858 | goto out_up; | ||
| 858 | 859 | ||
| 859 | #if !defined(__mc68000__) | 860 | #if !defined(__mc68000__) |
| 860 | printk(KERN_INFO "%s at 0x%03lx-0x%03lx,0x%03lx on irq %d", hwif->name, | 861 | printk(KERN_INFO "%s at 0x%03lx-0x%03lx,0x%03lx on irq %d", hwif->name, |
| @@ -1533,7 +1534,8 @@ static void ide_unregister(ide_hwif_t *hwif) | |||
| 1533 | 1534 | ||
| 1534 | ide_proc_unregister_port(hwif); | 1535 | ide_proc_unregister_port(hwif); |
| 1535 | 1536 | ||
| 1536 | free_irq(hwif->irq, hwif); | 1537 | if (!hwif->host->get_lock) |
| 1538 | free_irq(hwif->irq, hwif); | ||
| 1537 | 1539 | ||
| 1538 | device_unregister(hwif->portdev); | 1540 | device_unregister(hwif->portdev); |
| 1539 | device_unregister(&hwif->gendev); | 1541 | device_unregister(&hwif->gendev); |
diff --git a/drivers/iio/accel/bma180.c b/drivers/iio/accel/bma180.c index a7e68c81f89d..a077cc86421b 100644 --- a/drivers/iio/accel/bma180.c +++ b/drivers/iio/accel/bma180.c | |||
| @@ -68,13 +68,13 @@ | |||
| 68 | /* Defaults values */ | 68 | /* Defaults values */ |
| 69 | #define BMA180_DEF_PMODE 0 | 69 | #define BMA180_DEF_PMODE 0 |
| 70 | #define BMA180_DEF_BW 20 | 70 | #define BMA180_DEF_BW 20 |
| 71 | #define BMA180_DEF_SCALE 250 | 71 | #define BMA180_DEF_SCALE 2452 |
| 72 | 72 | ||
| 73 | /* Available values for sysfs */ | 73 | /* Available values for sysfs */ |
| 74 | #define BMA180_FLP_FREQ_AVAILABLE \ | 74 | #define BMA180_FLP_FREQ_AVAILABLE \ |
| 75 | "10 20 40 75 150 300" | 75 | "10 20 40 75 150 300" |
| 76 | #define BMA180_SCALE_AVAILABLE \ | 76 | #define BMA180_SCALE_AVAILABLE \ |
| 77 | "0.000130 0.000190 0.000250 0.000380 0.000500 0.000990 0.001980" | 77 | "0.001275 0.001863 0.002452 0.003727 0.004903 0.009709 0.019417" |
| 78 | 78 | ||
| 79 | struct bma180_data { | 79 | struct bma180_data { |
| 80 | struct i2c_client *client; | 80 | struct i2c_client *client; |
| @@ -94,7 +94,7 @@ enum bma180_axis { | |||
| 94 | }; | 94 | }; |
| 95 | 95 | ||
| 96 | static int bw_table[] = { 10, 20, 40, 75, 150, 300 }; /* Hz */ | 96 | static int bw_table[] = { 10, 20, 40, 75, 150, 300 }; /* Hz */ |
| 97 | static int scale_table[] = { 130, 190, 250, 380, 500, 990, 1980 }; | 97 | static int scale_table[] = { 1275, 1863, 2452, 3727, 4903, 9709, 19417 }; |
| 98 | 98 | ||
| 99 | static int bma180_get_acc_reg(struct bma180_data *data, enum bma180_axis axis) | 99 | static int bma180_get_acc_reg(struct bma180_data *data, enum bma180_axis axis) |
| 100 | { | 100 | { |
| @@ -376,6 +376,8 @@ static int bma180_write_raw(struct iio_dev *indio_dev, | |||
| 376 | mutex_unlock(&data->mutex); | 376 | mutex_unlock(&data->mutex); |
| 377 | return ret; | 377 | return ret; |
| 378 | case IIO_CHAN_INFO_LOW_PASS_FILTER_3DB_FREQUENCY: | 378 | case IIO_CHAN_INFO_LOW_PASS_FILTER_3DB_FREQUENCY: |
| 379 | if (val2) | ||
| 380 | return -EINVAL; | ||
| 379 | mutex_lock(&data->mutex); | 381 | mutex_lock(&data->mutex); |
| 380 | ret = bma180_set_bw(data, val); | 382 | ret = bma180_set_bw(data, val); |
| 381 | mutex_unlock(&data->mutex); | 383 | mutex_unlock(&data->mutex); |
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/accel/mma8452.c b/drivers/iio/accel/mma8452.c index 17aeea170566..2a5fa9a436e5 100644 --- a/drivers/iio/accel/mma8452.c +++ b/drivers/iio/accel/mma8452.c | |||
| @@ -111,8 +111,14 @@ static const int mma8452_samp_freq[8][2] = { | |||
| 111 | {6, 250000}, {1, 560000} | 111 | {6, 250000}, {1, 560000} |
| 112 | }; | 112 | }; |
| 113 | 113 | ||
| 114 | /* | ||
| 115 | * Hardware has fullscale of -2G, -4G, -8G corresponding to raw value -2048 | ||
| 116 | * The userspace interface uses m/s^2 and we declare micro units | ||
| 117 | * So scale factor is given by: | ||
| 118 | * g * N * 1000000 / 2048 for N = 2, 4, 8 and g=9.80665 | ||
| 119 | */ | ||
| 114 | static const int mma8452_scales[3][2] = { | 120 | static const int mma8452_scales[3][2] = { |
| 115 | {0, 977}, {0, 1953}, {0, 3906} | 121 | {0, 9577}, {0, 19154}, {0, 38307} |
| 116 | }; | 122 | }; |
| 117 | 123 | ||
| 118 | static ssize_t mma8452_show_samp_freq_avail(struct device *dev, | 124 | static ssize_t mma8452_show_samp_freq_avail(struct device *dev, |
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/industrialio-buffer.c b/drivers/iio/industrialio-buffer.c index 36b1ae92e239..9f1a14009901 100644 --- a/drivers/iio/industrialio-buffer.c +++ b/drivers/iio/industrialio-buffer.c | |||
| @@ -966,7 +966,7 @@ static int iio_buffer_update_demux(struct iio_dev *indio_dev, | |||
| 966 | 966 | ||
| 967 | /* Now we have the two masks, work from least sig and build up sizes */ | 967 | /* Now we have the two masks, work from least sig and build up sizes */ |
| 968 | for_each_set_bit(out_ind, | 968 | for_each_set_bit(out_ind, |
| 969 | indio_dev->active_scan_mask, | 969 | buffer->scan_mask, |
| 970 | indio_dev->masklength) { | 970 | indio_dev->masklength) { |
| 971 | in_ind = find_next_bit(indio_dev->active_scan_mask, | 971 | in_ind = find_next_bit(indio_dev->active_scan_mask, |
| 972 | indio_dev->masklength, | 972 | indio_dev->masklength, |
diff --git a/drivers/iio/industrialio-event.c b/drivers/iio/industrialio-event.c index 258a973a1fb8..bfbf4d419f41 100644 --- a/drivers/iio/industrialio-event.c +++ b/drivers/iio/industrialio-event.c | |||
| @@ -345,6 +345,9 @@ static int iio_device_add_event(struct iio_dev *indio_dev, | |||
| 345 | &indio_dev->event_interface->dev_attr_list); | 345 | &indio_dev->event_interface->dev_attr_list); |
| 346 | kfree(postfix); | 346 | kfree(postfix); |
| 347 | 347 | ||
| 348 | if ((ret == -EBUSY) && (shared_by != IIO_SEPARATE)) | ||
| 349 | continue; | ||
| 350 | |||
| 348 | if (ret) | 351 | if (ret) |
| 349 | return ret; | 352 | return ret; |
| 350 | 353 | ||
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/infiniband/hw/cxgb4/cm.c b/drivers/infiniband/hw/cxgb4/cm.c index 5e153f6d4b48..768a0fb67dd6 100644 --- a/drivers/infiniband/hw/cxgb4/cm.c +++ b/drivers/infiniband/hw/cxgb4/cm.c | |||
| @@ -432,8 +432,17 @@ static void arp_failure_discard(void *handle, struct sk_buff *skb) | |||
| 432 | */ | 432 | */ |
| 433 | static void act_open_req_arp_failure(void *handle, struct sk_buff *skb) | 433 | static void act_open_req_arp_failure(void *handle, struct sk_buff *skb) |
| 434 | { | 434 | { |
| 435 | struct c4iw_ep *ep = handle; | ||
| 436 | |||
| 435 | printk(KERN_ERR MOD "ARP failure duing connect\n"); | 437 | printk(KERN_ERR MOD "ARP failure duing connect\n"); |
| 436 | kfree_skb(skb); | 438 | kfree_skb(skb); |
| 439 | connect_reply_upcall(ep, -EHOSTUNREACH); | ||
| 440 | state_set(&ep->com, DEAD); | ||
| 441 | remove_handle(ep->com.dev, &ep->com.dev->atid_idr, ep->atid); | ||
| 442 | cxgb4_free_atid(ep->com.dev->rdev.lldi.tids, ep->atid); | ||
| 443 | dst_release(ep->dst); | ||
| 444 | cxgb4_l2t_release(ep->l2t); | ||
| 445 | c4iw_put_ep(&ep->com); | ||
| 437 | } | 446 | } |
| 438 | 447 | ||
| 439 | /* | 448 | /* |
| @@ -658,7 +667,7 @@ static int send_connect(struct c4iw_ep *ep) | |||
| 658 | opt2 |= T5_OPT_2_VALID; | 667 | opt2 |= T5_OPT_2_VALID; |
| 659 | opt2 |= V_CONG_CNTRL(CONG_ALG_TAHOE); | 668 | opt2 |= V_CONG_CNTRL(CONG_ALG_TAHOE); |
| 660 | } | 669 | } |
| 661 | t4_set_arp_err_handler(skb, NULL, act_open_req_arp_failure); | 670 | t4_set_arp_err_handler(skb, ep, act_open_req_arp_failure); |
| 662 | 671 | ||
| 663 | if (is_t4(ep->com.dev->rdev.lldi.adapter_type)) { | 672 | if (is_t4(ep->com.dev->rdev.lldi.adapter_type)) { |
| 664 | if (ep->com.remote_addr.ss_family == AF_INET) { | 673 | if (ep->com.remote_addr.ss_family == AF_INET) { |
| @@ -2180,7 +2189,6 @@ static void reject_cr(struct c4iw_dev *dev, u32 hwtid, struct sk_buff *skb) | |||
| 2180 | PDBG("%s c4iw_dev %p tid %u\n", __func__, dev, hwtid); | 2189 | PDBG("%s c4iw_dev %p tid %u\n", __func__, dev, hwtid); |
| 2181 | BUG_ON(skb_cloned(skb)); | 2190 | BUG_ON(skb_cloned(skb)); |
| 2182 | skb_trim(skb, sizeof(struct cpl_tid_release)); | 2191 | skb_trim(skb, sizeof(struct cpl_tid_release)); |
| 2183 | skb_get(skb); | ||
| 2184 | release_tid(&dev->rdev, hwtid, skb); | 2192 | release_tid(&dev->rdev, hwtid, skb); |
| 2185 | return; | 2193 | return; |
| 2186 | } | 2194 | } |
| @@ -3917,7 +3925,7 @@ int __init c4iw_cm_init(void) | |||
| 3917 | return 0; | 3925 | return 0; |
| 3918 | } | 3926 | } |
| 3919 | 3927 | ||
| 3920 | void __exit c4iw_cm_term(void) | 3928 | void c4iw_cm_term(void) |
| 3921 | { | 3929 | { |
| 3922 | WARN_ON(!list_empty(&timeout_list)); | 3930 | WARN_ON(!list_empty(&timeout_list)); |
| 3923 | flush_workqueue(workq); | 3931 | flush_workqueue(workq); |
diff --git a/drivers/infiniband/hw/cxgb4/device.c b/drivers/infiniband/hw/cxgb4/device.c index dd93aadc996e..7db82b24302b 100644 --- a/drivers/infiniband/hw/cxgb4/device.c +++ b/drivers/infiniband/hw/cxgb4/device.c | |||
| @@ -696,6 +696,7 @@ static int c4iw_rdev_open(struct c4iw_rdev *rdev) | |||
| 696 | pr_err(MOD "error allocating status page\n"); | 696 | pr_err(MOD "error allocating status page\n"); |
| 697 | goto err4; | 697 | goto err4; |
| 698 | } | 698 | } |
| 699 | rdev->status_page->db_off = 0; | ||
| 699 | return 0; | 700 | return 0; |
| 700 | err4: | 701 | err4: |
| 701 | c4iw_rqtpool_destroy(rdev); | 702 | c4iw_rqtpool_destroy(rdev); |
| @@ -729,7 +730,6 @@ static void c4iw_dealloc(struct uld_ctx *ctx) | |||
| 729 | if (ctx->dev->rdev.oc_mw_kva) | 730 | if (ctx->dev->rdev.oc_mw_kva) |
| 730 | iounmap(ctx->dev->rdev.oc_mw_kva); | 731 | iounmap(ctx->dev->rdev.oc_mw_kva); |
| 731 | ib_dealloc_device(&ctx->dev->ibdev); | 732 | ib_dealloc_device(&ctx->dev->ibdev); |
| 732 | iwpm_exit(RDMA_NL_C4IW); | ||
| 733 | ctx->dev = NULL; | 733 | ctx->dev = NULL; |
| 734 | } | 734 | } |
| 735 | 735 | ||
| @@ -826,12 +826,6 @@ static struct c4iw_dev *c4iw_alloc(const struct cxgb4_lld_info *infop) | |||
| 826 | setup_debugfs(devp); | 826 | setup_debugfs(devp); |
| 827 | } | 827 | } |
| 828 | 828 | ||
| 829 | ret = iwpm_init(RDMA_NL_C4IW); | ||
| 830 | if (ret) { | ||
| 831 | pr_err("port mapper initialization failed with %d\n", ret); | ||
| 832 | ib_dealloc_device(&devp->ibdev); | ||
| 833 | return ERR_PTR(ret); | ||
| 834 | } | ||
| 835 | 829 | ||
| 836 | return devp; | 830 | return devp; |
| 837 | } | 831 | } |
| @@ -1332,6 +1326,15 @@ static int __init c4iw_init_module(void) | |||
| 1332 | pr_err("%s[%u]: Failed to add netlink callback\n" | 1326 | pr_err("%s[%u]: Failed to add netlink callback\n" |
| 1333 | , __func__, __LINE__); | 1327 | , __func__, __LINE__); |
| 1334 | 1328 | ||
| 1329 | err = iwpm_init(RDMA_NL_C4IW); | ||
| 1330 | if (err) { | ||
| 1331 | pr_err("port mapper initialization failed with %d\n", err); | ||
| 1332 | ibnl_remove_client(RDMA_NL_C4IW); | ||
| 1333 | c4iw_cm_term(); | ||
| 1334 | debugfs_remove_recursive(c4iw_debugfs_root); | ||
| 1335 | return err; | ||
| 1336 | } | ||
| 1337 | |||
| 1335 | cxgb4_register_uld(CXGB4_ULD_RDMA, &c4iw_uld_info); | 1338 | cxgb4_register_uld(CXGB4_ULD_RDMA, &c4iw_uld_info); |
| 1336 | 1339 | ||
| 1337 | return 0; | 1340 | return 0; |
| @@ -1349,6 +1352,7 @@ static void __exit c4iw_exit_module(void) | |||
| 1349 | } | 1352 | } |
| 1350 | mutex_unlock(&dev_mutex); | 1353 | mutex_unlock(&dev_mutex); |
| 1351 | cxgb4_unregister_uld(CXGB4_ULD_RDMA); | 1354 | cxgb4_unregister_uld(CXGB4_ULD_RDMA); |
| 1355 | iwpm_exit(RDMA_NL_C4IW); | ||
| 1352 | ibnl_remove_client(RDMA_NL_C4IW); | 1356 | ibnl_remove_client(RDMA_NL_C4IW); |
| 1353 | c4iw_cm_term(); | 1357 | c4iw_cm_term(); |
| 1354 | debugfs_remove_recursive(c4iw_debugfs_root); | 1358 | debugfs_remove_recursive(c4iw_debugfs_root); |
diff --git a/drivers/infiniband/hw/cxgb4/iw_cxgb4.h b/drivers/infiniband/hw/cxgb4/iw_cxgb4.h index 125bc5d1e175..361fff7a0742 100644 --- a/drivers/infiniband/hw/cxgb4/iw_cxgb4.h +++ b/drivers/infiniband/hw/cxgb4/iw_cxgb4.h | |||
| @@ -908,7 +908,7 @@ int c4iw_destroy_ctrl_qp(struct c4iw_rdev *rdev); | |||
| 908 | int c4iw_register_device(struct c4iw_dev *dev); | 908 | int c4iw_register_device(struct c4iw_dev *dev); |
| 909 | void c4iw_unregister_device(struct c4iw_dev *dev); | 909 | void c4iw_unregister_device(struct c4iw_dev *dev); |
| 910 | int __init c4iw_cm_init(void); | 910 | int __init c4iw_cm_init(void); |
| 911 | void __exit c4iw_cm_term(void); | 911 | void c4iw_cm_term(void); |
| 912 | void c4iw_release_dev_ucontext(struct c4iw_rdev *rdev, | 912 | void c4iw_release_dev_ucontext(struct c4iw_rdev *rdev, |
| 913 | struct c4iw_dev_ucontext *uctx); | 913 | struct c4iw_dev_ucontext *uctx); |
| 914 | void c4iw_init_dev_ucontext(struct c4iw_rdev *rdev, | 914 | void c4iw_init_dev_ucontext(struct c4iw_rdev *rdev, |
diff --git a/drivers/infiniband/hw/mlx5/qp.c b/drivers/infiniband/hw/mlx5/qp.c index d13ddf1c0033..bbbcf389272c 100644 --- a/drivers/infiniband/hw/mlx5/qp.c +++ b/drivers/infiniband/hw/mlx5/qp.c | |||
| @@ -675,7 +675,7 @@ static int create_kernel_qp(struct mlx5_ib_dev *dev, | |||
| 675 | int err; | 675 | int err; |
| 676 | 676 | ||
| 677 | uuari = &dev->mdev.priv.uuari; | 677 | uuari = &dev->mdev.priv.uuari; |
| 678 | if (init_attr->create_flags & ~IB_QP_CREATE_SIGNATURE_EN) | 678 | if (init_attr->create_flags & ~(IB_QP_CREATE_SIGNATURE_EN | IB_QP_CREATE_BLOCK_MULTICAST_LOOPBACK)) |
| 679 | return -EINVAL; | 679 | return -EINVAL; |
| 680 | 680 | ||
| 681 | if (init_attr->qp_type == MLX5_IB_QPT_REG_UMR) | 681 | if (init_attr->qp_type == MLX5_IB_QPT_REG_UMR) |
diff --git a/drivers/input/input.c b/drivers/input/input.c index 1c4c0db05550..29ca0bb4f561 100644 --- a/drivers/input/input.c +++ b/drivers/input/input.c | |||
| @@ -257,9 +257,10 @@ static int input_handle_abs_event(struct input_dev *dev, | |||
| 257 | } | 257 | } |
| 258 | 258 | ||
| 259 | static int input_get_disposition(struct input_dev *dev, | 259 | static int input_get_disposition(struct input_dev *dev, |
| 260 | unsigned int type, unsigned int code, int value) | 260 | unsigned int type, unsigned int code, int *pval) |
| 261 | { | 261 | { |
| 262 | int disposition = INPUT_IGNORE_EVENT; | 262 | int disposition = INPUT_IGNORE_EVENT; |
| 263 | int value = *pval; | ||
| 263 | 264 | ||
| 264 | switch (type) { | 265 | switch (type) { |
| 265 | 266 | ||
| @@ -357,6 +358,7 @@ static int input_get_disposition(struct input_dev *dev, | |||
| 357 | break; | 358 | break; |
| 358 | } | 359 | } |
| 359 | 360 | ||
| 361 | *pval = value; | ||
| 360 | return disposition; | 362 | return disposition; |
| 361 | } | 363 | } |
| 362 | 364 | ||
| @@ -365,7 +367,7 @@ static void input_handle_event(struct input_dev *dev, | |||
| 365 | { | 367 | { |
| 366 | int disposition; | 368 | int disposition; |
| 367 | 369 | ||
| 368 | disposition = input_get_disposition(dev, type, code, value); | 370 | disposition = input_get_disposition(dev, type, code, &value); |
| 369 | 371 | ||
| 370 | if ((disposition & INPUT_PASS_TO_DEVICE) && dev->event) | 372 | if ((disposition & INPUT_PASS_TO_DEVICE) && dev->event) |
| 371 | dev->event(dev, type, code, value); | 373 | dev->event(dev, type, code, value); |
diff --git a/drivers/input/keyboard/st-keyscan.c b/drivers/input/keyboard/st-keyscan.c index 758b48731415..de7be4f03d91 100644 --- a/drivers/input/keyboard/st-keyscan.c +++ b/drivers/input/keyboard/st-keyscan.c | |||
| @@ -215,6 +215,7 @@ static int keyscan_probe(struct platform_device *pdev) | |||
| 215 | return 0; | 215 | return 0; |
| 216 | } | 216 | } |
| 217 | 217 | ||
| 218 | #ifdef CONFIG_PM_SLEEP | ||
| 218 | static int keyscan_suspend(struct device *dev) | 219 | static int keyscan_suspend(struct device *dev) |
| 219 | { | 220 | { |
| 220 | struct platform_device *pdev = to_platform_device(dev); | 221 | struct platform_device *pdev = to_platform_device(dev); |
| @@ -249,6 +250,7 @@ static int keyscan_resume(struct device *dev) | |||
| 249 | mutex_unlock(&input->mutex); | 250 | mutex_unlock(&input->mutex); |
| 250 | return retval; | 251 | return retval; |
| 251 | } | 252 | } |
| 253 | #endif | ||
| 252 | 254 | ||
| 253 | static SIMPLE_DEV_PM_OPS(keyscan_dev_pm_ops, keyscan_suspend, keyscan_resume); | 255 | static SIMPLE_DEV_PM_OPS(keyscan_dev_pm_ops, keyscan_suspend, keyscan_resume); |
| 254 | 256 | ||
diff --git a/drivers/input/misc/sirfsoc-onkey.c b/drivers/input/misc/sirfsoc-onkey.c index e4104f9b2e6d..fed5102e1802 100644 --- a/drivers/input/misc/sirfsoc-onkey.c +++ b/drivers/input/misc/sirfsoc-onkey.c | |||
| @@ -213,7 +213,7 @@ static struct platform_driver sirfsoc_pwrc_driver = { | |||
| 213 | 213 | ||
| 214 | module_platform_driver(sirfsoc_pwrc_driver); | 214 | module_platform_driver(sirfsoc_pwrc_driver); |
| 215 | 215 | ||
| 216 | MODULE_LICENSE("GPLv2"); | 216 | MODULE_LICENSE("GPL v2"); |
| 217 | MODULE_AUTHOR("Binghua Duan <Binghua.Duan@csr.com>, Xianglong Du <Xianglong.Du@csr.com>"); | 217 | MODULE_AUTHOR("Binghua Duan <Binghua.Duan@csr.com>, Xianglong Du <Xianglong.Du@csr.com>"); |
| 218 | MODULE_DESCRIPTION("CSR Prima2 PWRC Driver"); | 218 | MODULE_DESCRIPTION("CSR Prima2 PWRC Driver"); |
| 219 | MODULE_ALIAS("platform:sirfsoc-pwrc"); | 219 | MODULE_ALIAS("platform:sirfsoc-pwrc"); |
diff --git a/drivers/input/mouse/synaptics.c b/drivers/input/mouse/synaptics.c index ec772d962f06..ef9e0b8a9aa7 100644 --- a/drivers/input/mouse/synaptics.c +++ b/drivers/input/mouse/synaptics.c | |||
| @@ -132,7 +132,8 @@ static const struct min_max_quirk min_max_pnpid_table[] = { | |||
| 132 | 1232, 5710, 1156, 4696 | 132 | 1232, 5710, 1156, 4696 |
| 133 | }, | 133 | }, |
| 134 | { | 134 | { |
| 135 | (const char * const []){"LEN0034", "LEN0036", "LEN2004", NULL}, | 135 | (const char * const []){"LEN0034", "LEN0036", "LEN2002", |
| 136 | "LEN2004", NULL}, | ||
| 136 | 1024, 5112, 2024, 4832 | 137 | 1024, 5112, 2024, 4832 |
| 137 | }, | 138 | }, |
| 138 | { | 139 | { |
| @@ -168,7 +169,7 @@ static const char * const topbuttonpad_pnp_ids[] = { | |||
| 168 | "LEN0049", | 169 | "LEN0049", |
| 169 | "LEN2000", | 170 | "LEN2000", |
| 170 | "LEN2001", /* Edge E431 */ | 171 | "LEN2001", /* Edge E431 */ |
| 171 | "LEN2002", | 172 | "LEN2002", /* Edge E531 */ |
| 172 | "LEN2003", | 173 | "LEN2003", |
| 173 | "LEN2004", /* L440 */ | 174 | "LEN2004", /* L440 */ |
| 174 | "LEN2005", | 175 | "LEN2005", |
diff --git a/drivers/input/serio/i8042-x86ia64io.h b/drivers/input/serio/i8042-x86ia64io.h index 381b20d4c561..136b7b204f56 100644 --- a/drivers/input/serio/i8042-x86ia64io.h +++ b/drivers/input/serio/i8042-x86ia64io.h | |||
| @@ -402,6 +402,13 @@ static const struct dmi_system_id __initconst i8042_dmi_nomux_table[] = { | |||
| 402 | }, | 402 | }, |
| 403 | }, | 403 | }, |
| 404 | { | 404 | { |
| 405 | /* Acer Aspire 5710 */ | ||
| 406 | .matches = { | ||
| 407 | DMI_MATCH(DMI_SYS_VENDOR, "Acer"), | ||
| 408 | DMI_MATCH(DMI_PRODUCT_NAME, "Aspire 5710"), | ||
| 409 | }, | ||
| 410 | }, | ||
| 411 | { | ||
| 405 | /* Gericom Bellagio */ | 412 | /* Gericom Bellagio */ |
| 406 | .matches = { | 413 | .matches = { |
| 407 | DMI_MATCH(DMI_SYS_VENDOR, "Gericom"), | 414 | DMI_MATCH(DMI_SYS_VENDOR, "Gericom"), |
diff --git a/drivers/input/tablet/wacom_wac.c b/drivers/input/tablet/wacom_wac.c index 977d05cd9e2e..e73cf2c71f35 100644 --- a/drivers/input/tablet/wacom_wac.c +++ b/drivers/input/tablet/wacom_wac.c | |||
| @@ -1217,9 +1217,9 @@ static void wacom_bpt3_touch_msg(struct wacom_wac *wacom, unsigned char *data) | |||
| 1217 | * a=(pi*r^2)/C. | 1217 | * a=(pi*r^2)/C. |
| 1218 | */ | 1218 | */ |
| 1219 | int a = data[5]; | 1219 | int a = data[5]; |
| 1220 | int x_res = input_abs_get_res(input, ABS_X); | 1220 | int x_res = input_abs_get_res(input, ABS_MT_POSITION_X); |
| 1221 | int y_res = input_abs_get_res(input, ABS_Y); | 1221 | int y_res = input_abs_get_res(input, ABS_MT_POSITION_Y); |
| 1222 | width = 2 * int_sqrt(a * WACOM_CONTACT_AREA_SCALE); | 1222 | width = 2 * int_sqrt(a * WACOM_CONTACT_AREA_SCALE); |
| 1223 | height = width * y_res / x_res; | 1223 | height = width * y_res / x_res; |
| 1224 | } | 1224 | } |
| 1225 | 1225 | ||
| @@ -1587,7 +1587,7 @@ static void wacom_abs_set_axis(struct input_dev *input_dev, | |||
| 1587 | input_abs_set_res(input_dev, ABS_X, features->x_resolution); | 1587 | input_abs_set_res(input_dev, ABS_X, features->x_resolution); |
| 1588 | input_abs_set_res(input_dev, ABS_Y, features->y_resolution); | 1588 | input_abs_set_res(input_dev, ABS_Y, features->y_resolution); |
| 1589 | } else { | 1589 | } else { |
| 1590 | if (features->touch_max <= 2) { | 1590 | if (features->touch_max == 1) { |
| 1591 | input_set_abs_params(input_dev, ABS_X, 0, | 1591 | input_set_abs_params(input_dev, ABS_X, 0, |
| 1592 | features->x_max, features->x_fuzz, 0); | 1592 | features->x_max, features->x_fuzz, 0); |
| 1593 | input_set_abs_params(input_dev, ABS_Y, 0, | 1593 | input_set_abs_params(input_dev, ABS_Y, 0, |
| @@ -1815,14 +1815,8 @@ int wacom_setup_input_capabilities(struct input_dev *input_dev, | |||
| 1815 | case MTTPC: | 1815 | case MTTPC: |
| 1816 | case MTTPC_B: | 1816 | case MTTPC_B: |
| 1817 | case TABLETPC2FG: | 1817 | case TABLETPC2FG: |
| 1818 | if (features->device_type == BTN_TOOL_FINGER) { | 1818 | if (features->device_type == BTN_TOOL_FINGER && features->touch_max > 1) |
| 1819 | unsigned int flags = INPUT_MT_DIRECT; | 1819 | input_mt_init_slots(input_dev, features->touch_max, INPUT_MT_DIRECT); |
| 1820 | |||
| 1821 | if (wacom_wac->features.type == TABLETPC2FG) | ||
| 1822 | flags = 0; | ||
| 1823 | |||
| 1824 | input_mt_init_slots(input_dev, features->touch_max, flags); | ||
| 1825 | } | ||
| 1826 | /* fall through */ | 1820 | /* fall through */ |
| 1827 | 1821 | ||
| 1828 | case TABLETPC: | 1822 | case TABLETPC: |
| @@ -1883,10 +1877,6 @@ int wacom_setup_input_capabilities(struct input_dev *input_dev, | |||
| 1883 | __set_bit(BTN_RIGHT, input_dev->keybit); | 1877 | __set_bit(BTN_RIGHT, input_dev->keybit); |
| 1884 | 1878 | ||
| 1885 | if (features->touch_max) { | 1879 | if (features->touch_max) { |
| 1886 | /* touch interface */ | ||
| 1887 | unsigned int flags = INPUT_MT_POINTER; | ||
| 1888 | |||
| 1889 | __set_bit(INPUT_PROP_POINTER, input_dev->propbit); | ||
| 1890 | if (features->pktlen == WACOM_PKGLEN_BBTOUCH3) { | 1880 | if (features->pktlen == WACOM_PKGLEN_BBTOUCH3) { |
| 1891 | input_set_abs_params(input_dev, | 1881 | input_set_abs_params(input_dev, |
| 1892 | ABS_MT_TOUCH_MAJOR, | 1882 | ABS_MT_TOUCH_MAJOR, |
| @@ -1894,12 +1884,8 @@ int wacom_setup_input_capabilities(struct input_dev *input_dev, | |||
| 1894 | input_set_abs_params(input_dev, | 1884 | input_set_abs_params(input_dev, |
| 1895 | ABS_MT_TOUCH_MINOR, | 1885 | ABS_MT_TOUCH_MINOR, |
| 1896 | 0, features->y_max, 0, 0); | 1886 | 0, features->y_max, 0, 0); |
| 1897 | } else { | ||
| 1898 | __set_bit(BTN_TOOL_FINGER, input_dev->keybit); | ||
| 1899 | __set_bit(BTN_TOOL_DOUBLETAP, input_dev->keybit); | ||
| 1900 | flags = 0; | ||
| 1901 | } | 1887 | } |
| 1902 | input_mt_init_slots(input_dev, features->touch_max, flags); | 1888 | input_mt_init_slots(input_dev, features->touch_max, INPUT_MT_POINTER); |
| 1903 | } else { | 1889 | } else { |
| 1904 | /* buttons/keys only interface */ | 1890 | /* buttons/keys only interface */ |
| 1905 | __clear_bit(ABS_X, input_dev->absbit); | 1891 | __clear_bit(ABS_X, input_dev->absbit); |
diff --git a/drivers/input/touchscreen/ti_am335x_tsc.c b/drivers/input/touchscreen/ti_am335x_tsc.c index 4e793a17361f..2ce649520fe0 100644 --- a/drivers/input/touchscreen/ti_am335x_tsc.c +++ b/drivers/input/touchscreen/ti_am335x_tsc.c | |||
| @@ -359,9 +359,12 @@ static int titsc_parse_dt(struct platform_device *pdev, | |||
| 359 | */ | 359 | */ |
| 360 | err = of_property_read_u32(node, "ti,coordinate-readouts", | 360 | err = of_property_read_u32(node, "ti,coordinate-readouts", |
| 361 | &ts_dev->coordinate_readouts); | 361 | &ts_dev->coordinate_readouts); |
| 362 | if (err < 0) | 362 | if (err < 0) { |
| 363 | dev_warn(&pdev->dev, "please use 'ti,coordinate-readouts' instead\n"); | ||
| 363 | err = of_property_read_u32(node, "ti,coordiante-readouts", | 364 | err = of_property_read_u32(node, "ti,coordiante-readouts", |
| 364 | &ts_dev->coordinate_readouts); | 365 | &ts_dev->coordinate_readouts); |
| 366 | } | ||
| 367 | |||
| 365 | if (err < 0) | 368 | if (err < 0) |
| 366 | return err; | 369 | return err; |
| 367 | 370 | ||
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/fsl_pamu.c b/drivers/iommu/fsl_pamu.c index b99dd88e31b9..bb446d742a2d 100644 --- a/drivers/iommu/fsl_pamu.c +++ b/drivers/iommu/fsl_pamu.c | |||
| @@ -170,10 +170,10 @@ int pamu_disable_liodn(int liodn) | |||
| 170 | static unsigned int map_addrspace_size_to_wse(phys_addr_t addrspace_size) | 170 | static unsigned int map_addrspace_size_to_wse(phys_addr_t addrspace_size) |
| 171 | { | 171 | { |
| 172 | /* Bug if not a power of 2 */ | 172 | /* Bug if not a power of 2 */ |
| 173 | BUG_ON(!is_power_of_2(addrspace_size)); | 173 | BUG_ON((addrspace_size & (addrspace_size - 1))); |
| 174 | 174 | ||
| 175 | /* window size is 2^(WSE+1) bytes */ | 175 | /* window size is 2^(WSE+1) bytes */ |
| 176 | return __ffs(addrspace_size) - 1; | 176 | return fls64(addrspace_size) - 2; |
| 177 | } | 177 | } |
| 178 | 178 | ||
| 179 | /* Derive the PAACE window count encoding for the subwindow count */ | 179 | /* Derive the PAACE window count encoding for the subwindow count */ |
| @@ -351,7 +351,7 @@ int pamu_config_ppaace(int liodn, phys_addr_t win_addr, phys_addr_t win_size, | |||
| 351 | struct paace *ppaace; | 351 | struct paace *ppaace; |
| 352 | unsigned long fspi; | 352 | unsigned long fspi; |
| 353 | 353 | ||
| 354 | if (!is_power_of_2(win_size) || win_size < PAMU_PAGE_SIZE) { | 354 | if ((win_size & (win_size - 1)) || win_size < PAMU_PAGE_SIZE) { |
| 355 | pr_debug("window size too small or not a power of two %llx\n", win_size); | 355 | pr_debug("window size too small or not a power of two %llx\n", win_size); |
| 356 | return -EINVAL; | 356 | return -EINVAL; |
| 357 | } | 357 | } |
| @@ -464,7 +464,7 @@ int pamu_config_spaace(int liodn, u32 subwin_cnt, u32 subwin, | |||
| 464 | return -ENOENT; | 464 | return -ENOENT; |
| 465 | } | 465 | } |
| 466 | 466 | ||
| 467 | if (!is_power_of_2(subwin_size) || subwin_size < PAMU_PAGE_SIZE) { | 467 | if ((subwin_size & (subwin_size - 1)) || subwin_size < PAMU_PAGE_SIZE) { |
| 468 | pr_debug("subwindow size out of range, or not a power of 2\n"); | 468 | pr_debug("subwindow size out of range, or not a power of 2\n"); |
| 469 | return -EINVAL; | 469 | return -EINVAL; |
| 470 | } | 470 | } |
diff --git a/drivers/iommu/fsl_pamu_domain.c b/drivers/iommu/fsl_pamu_domain.c index 93072ba44b1d..af47648301a9 100644 --- a/drivers/iommu/fsl_pamu_domain.c +++ b/drivers/iommu/fsl_pamu_domain.c | |||
| @@ -301,7 +301,7 @@ static int check_size(u64 size, dma_addr_t iova) | |||
| 301 | * Size must be a power of two and at least be equal | 301 | * Size must be a power of two and at least be equal |
| 302 | * to PAMU page size. | 302 | * to PAMU page size. |
| 303 | */ | 303 | */ |
| 304 | if (!is_power_of_2(size) || size < PAMU_PAGE_SIZE) { | 304 | if ((size & (size - 1)) || size < PAMU_PAGE_SIZE) { |
| 305 | pr_debug("%s: size too small or not a power of two\n", __func__); | 305 | pr_debug("%s: size too small or not a power of two\n", __func__); |
| 306 | return -EINVAL; | 306 | return -EINVAL; |
| 307 | } | 307 | } |
| @@ -335,11 +335,6 @@ static struct fsl_dma_domain *iommu_alloc_dma_domain(void) | |||
| 335 | return domain; | 335 | return domain; |
| 336 | } | 336 | } |
| 337 | 337 | ||
| 338 | static inline struct device_domain_info *find_domain(struct device *dev) | ||
| 339 | { | ||
| 340 | return dev->archdata.iommu_domain; | ||
| 341 | } | ||
| 342 | |||
| 343 | static void remove_device_ref(struct device_domain_info *info, u32 win_cnt) | 338 | static void remove_device_ref(struct device_domain_info *info, u32 win_cnt) |
| 344 | { | 339 | { |
| 345 | unsigned long flags; | 340 | unsigned long flags; |
| @@ -380,7 +375,7 @@ static void attach_device(struct fsl_dma_domain *dma_domain, int liodn, struct d | |||
| 380 | * Check here if the device is already attached to domain or not. | 375 | * Check here if the device is already attached to domain or not. |
| 381 | * If the device is already attached to a domain detach it. | 376 | * If the device is already attached to a domain detach it. |
| 382 | */ | 377 | */ |
| 383 | old_domain_info = find_domain(dev); | 378 | old_domain_info = dev->archdata.iommu_domain; |
| 384 | if (old_domain_info && old_domain_info->domain != dma_domain) { | 379 | if (old_domain_info && old_domain_info->domain != dma_domain) { |
| 385 | spin_unlock_irqrestore(&device_domain_lock, flags); | 380 | spin_unlock_irqrestore(&device_domain_lock, flags); |
| 386 | detach_device(dev, old_domain_info->domain); | 381 | detach_device(dev, old_domain_info->domain); |
| @@ -399,7 +394,7 @@ static void attach_device(struct fsl_dma_domain *dma_domain, int liodn, struct d | |||
| 399 | * the info for the first LIODN as all | 394 | * the info for the first LIODN as all |
| 400 | * LIODNs share the same domain | 395 | * LIODNs share the same domain |
| 401 | */ | 396 | */ |
| 402 | if (!old_domain_info) | 397 | if (!dev->archdata.iommu_domain) |
| 403 | dev->archdata.iommu_domain = info; | 398 | dev->archdata.iommu_domain = info; |
| 404 | spin_unlock_irqrestore(&device_domain_lock, flags); | 399 | spin_unlock_irqrestore(&device_domain_lock, flags); |
| 405 | 400 | ||
| @@ -1042,12 +1037,15 @@ root_bus: | |||
| 1042 | group = get_shared_pci_device_group(pdev); | 1037 | group = get_shared_pci_device_group(pdev); |
| 1043 | } | 1038 | } |
| 1044 | 1039 | ||
| 1040 | if (!group) | ||
| 1041 | group = ERR_PTR(-ENODEV); | ||
| 1042 | |||
| 1045 | return group; | 1043 | return group; |
| 1046 | } | 1044 | } |
| 1047 | 1045 | ||
| 1048 | static int fsl_pamu_add_device(struct device *dev) | 1046 | static int fsl_pamu_add_device(struct device *dev) |
| 1049 | { | 1047 | { |
| 1050 | struct iommu_group *group = NULL; | 1048 | struct iommu_group *group = ERR_PTR(-ENODEV); |
| 1051 | struct pci_dev *pdev; | 1049 | struct pci_dev *pdev; |
| 1052 | const u32 *prop; | 1050 | const u32 *prop; |
| 1053 | int ret, len; | 1051 | int ret, len; |
| @@ -1070,7 +1068,7 @@ static int fsl_pamu_add_device(struct device *dev) | |||
| 1070 | group = get_device_iommu_group(dev); | 1068 | group = get_device_iommu_group(dev); |
| 1071 | } | 1069 | } |
| 1072 | 1070 | ||
| 1073 | if (!group || IS_ERR(group)) | 1071 | if (IS_ERR(group)) |
| 1074 | return PTR_ERR(group); | 1072 | return PTR_ERR(group); |
| 1075 | 1073 | ||
| 1076 | ret = iommu_group_add_device(group, dev); | 1074 | ret = iommu_group_add_device(group, dev); |
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/irq-gic.c b/drivers/irqchip/irq-gic.c index 7e11c9d6ae8c..7c131cf7cc13 100644 --- a/drivers/irqchip/irq-gic.c +++ b/drivers/irqchip/irq-gic.c | |||
| @@ -42,6 +42,7 @@ | |||
| 42 | #include <linux/irqchip/chained_irq.h> | 42 | #include <linux/irqchip/chained_irq.h> |
| 43 | #include <linux/irqchip/arm-gic.h> | 43 | #include <linux/irqchip/arm-gic.h> |
| 44 | 44 | ||
| 45 | #include <asm/cputype.h> | ||
| 45 | #include <asm/irq.h> | 46 | #include <asm/irq.h> |
| 46 | #include <asm/exception.h> | 47 | #include <asm/exception.h> |
| 47 | #include <asm/smp_plat.h> | 48 | #include <asm/smp_plat.h> |
| @@ -954,7 +955,9 @@ void __init gic_init_bases(unsigned int gic_nr, int irq_start, | |||
| 954 | } | 955 | } |
| 955 | 956 | ||
| 956 | for_each_possible_cpu(cpu) { | 957 | for_each_possible_cpu(cpu) { |
| 957 | unsigned long offset = percpu_offset * cpu_logical_map(cpu); | 958 | u32 mpidr = cpu_logical_map(cpu); |
| 959 | u32 core_id = MPIDR_AFFINITY_LEVEL(mpidr, 0); | ||
| 960 | unsigned long offset = percpu_offset * core_id; | ||
| 958 | *per_cpu_ptr(gic->dist_base.percpu_base, cpu) = dist_base + offset; | 961 | *per_cpu_ptr(gic->dist_base.percpu_base, cpu) = dist_base + offset; |
| 959 | *per_cpu_ptr(gic->cpu_base.percpu_base, cpu) = cpu_base + offset; | 962 | *per_cpu_ptr(gic->cpu_base.percpu_base, cpu) = cpu_base + offset; |
| 960 | } | 963 | } |
| @@ -1071,8 +1074,10 @@ gic_of_init(struct device_node *node, struct device_node *parent) | |||
| 1071 | gic_cnt++; | 1074 | gic_cnt++; |
| 1072 | return 0; | 1075 | return 0; |
| 1073 | } | 1076 | } |
| 1077 | IRQCHIP_DECLARE(gic_400, "arm,gic-400", gic_of_init); | ||
| 1074 | IRQCHIP_DECLARE(cortex_a15_gic, "arm,cortex-a15-gic", gic_of_init); | 1078 | IRQCHIP_DECLARE(cortex_a15_gic, "arm,cortex-a15-gic", gic_of_init); |
| 1075 | IRQCHIP_DECLARE(cortex_a9_gic, "arm,cortex-a9-gic", gic_of_init); | 1079 | IRQCHIP_DECLARE(cortex_a9_gic, "arm,cortex-a9-gic", gic_of_init); |
| 1080 | IRQCHIP_DECLARE(cortex_a7_gic, "arm,cortex-a7-gic", gic_of_init); | ||
| 1076 | IRQCHIP_DECLARE(msm_8660_qgic, "qcom,msm-8660-qgic", gic_of_init); | 1081 | IRQCHIP_DECLARE(msm_8660_qgic, "qcom,msm-8660-qgic", gic_of_init); |
| 1077 | IRQCHIP_DECLARE(msm_qgic2, "qcom,msm-qgic2", gic_of_init); | 1082 | IRQCHIP_DECLARE(msm_qgic2, "qcom,msm-qgic2", gic_of_init); |
| 1078 | 1083 | ||
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/gigaset/bas-gigaset.c b/drivers/isdn/gigaset/bas-gigaset.c index c44950d3eb7b..b7ae0a0dd5b6 100644 --- a/drivers/isdn/gigaset/bas-gigaset.c +++ b/drivers/isdn/gigaset/bas-gigaset.c | |||
| @@ -2400,6 +2400,7 @@ allocerr: | |||
| 2400 | error: | 2400 | error: |
| 2401 | freeurbs(cs); | 2401 | freeurbs(cs); |
| 2402 | usb_set_intfdata(interface, NULL); | 2402 | usb_set_intfdata(interface, NULL); |
| 2403 | usb_put_dev(udev); | ||
| 2403 | gigaset_freecs(cs); | 2404 | gigaset_freecs(cs); |
| 2404 | return rc; | 2405 | return rc; |
| 2405 | } | 2406 | } |
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/isdn/hisax/l3ni1.c b/drivers/isdn/hisax/l3ni1.c index 0df6691d045c..8dc791bfaa6f 100644 --- a/drivers/isdn/hisax/l3ni1.c +++ b/drivers/isdn/hisax/l3ni1.c | |||
| @@ -2059,13 +2059,17 @@ static int l3ni1_cmd_global(struct PStack *st, isdn_ctrl *ic) | |||
| 2059 | memcpy(p, ic->parm.ni1_io.data, ic->parm.ni1_io.datalen); /* copy data */ | 2059 | memcpy(p, ic->parm.ni1_io.data, ic->parm.ni1_io.datalen); /* copy data */ |
| 2060 | l = (p - temp) + ic->parm.ni1_io.datalen; /* total length */ | 2060 | l = (p - temp) + ic->parm.ni1_io.datalen; /* total length */ |
| 2061 | 2061 | ||
| 2062 | if (ic->parm.ni1_io.timeout > 0) | 2062 | if (ic->parm.ni1_io.timeout > 0) { |
| 2063 | if (!(pc = ni1_new_l3_process(st, -1))) | 2063 | pc = ni1_new_l3_process(st, -1); |
| 2064 | { free_invoke_id(st, id); | 2064 | if (!pc) { |
| 2065 | free_invoke_id(st, id); | ||
| 2065 | return (-2); | 2066 | return (-2); |
| 2066 | } | 2067 | } |
| 2067 | pc->prot.ni1.ll_id = ic->parm.ni1_io.ll_id; /* remember id */ | 2068 | /* remember id */ |
| 2068 | pc->prot.ni1.proc = ic->parm.ni1_io.proc; /* and procedure */ | 2069 | pc->prot.ni1.ll_id = ic->parm.ni1_io.ll_id; |
| 2070 | /* and procedure */ | ||
| 2071 | pc->prot.ni1.proc = ic->parm.ni1_io.proc; | ||
| 2072 | } | ||
| 2069 | 2073 | ||
| 2070 | if (!(skb = l3_alloc_skb(l))) | 2074 | if (!(skb = l3_alloc_skb(l))) |
| 2071 | { free_invoke_id(st, id); | 2075 | { free_invoke_id(st, id); |
diff --git a/drivers/isdn/i4l/isdn_ppp.c b/drivers/isdn/i4l/isdn_ppp.c index 61ac63237446..62f0688d45a5 100644 --- a/drivers/isdn/i4l/isdn_ppp.c +++ b/drivers/isdn/i4l/isdn_ppp.c | |||
| @@ -442,7 +442,7 @@ static int get_filter(void __user *arg, struct sock_filter **p) | |||
| 442 | { | 442 | { |
| 443 | struct sock_fprog uprog; | 443 | struct sock_fprog uprog; |
| 444 | struct sock_filter *code = NULL; | 444 | struct sock_filter *code = NULL; |
| 445 | int len, err; | 445 | int len; |
| 446 | 446 | ||
| 447 | if (copy_from_user(&uprog, arg, sizeof(uprog))) | 447 | if (copy_from_user(&uprog, arg, sizeof(uprog))) |
| 448 | return -EFAULT; | 448 | return -EFAULT; |
| @@ -458,12 +458,6 @@ static int get_filter(void __user *arg, struct sock_filter **p) | |||
| 458 | if (IS_ERR(code)) | 458 | if (IS_ERR(code)) |
| 459 | return PTR_ERR(code); | 459 | return PTR_ERR(code); |
| 460 | 460 | ||
| 461 | err = sk_chk_filter(code, uprog.len); | ||
| 462 | if (err) { | ||
| 463 | kfree(code); | ||
| 464 | return err; | ||
| 465 | } | ||
| 466 | |||
| 467 | *p = code; | 461 | *p = code; |
| 468 | return uprog.len; | 462 | return uprog.len; |
| 469 | } | 463 | } |
| @@ -644,9 +638,15 @@ isdn_ppp_ioctl(int min, struct file *file, unsigned int cmd, unsigned long arg) | |||
| 644 | fprog.len = len; | 638 | fprog.len = len; |
| 645 | fprog.filter = code; | 639 | fprog.filter = code; |
| 646 | 640 | ||
| 647 | if (is->pass_filter) | 641 | if (is->pass_filter) { |
| 648 | sk_unattached_filter_destroy(is->pass_filter); | 642 | sk_unattached_filter_destroy(is->pass_filter); |
| 649 | err = sk_unattached_filter_create(&is->pass_filter, &fprog); | 643 | is->pass_filter = NULL; |
| 644 | } | ||
| 645 | if (fprog.filter != NULL) | ||
| 646 | err = sk_unattached_filter_create(&is->pass_filter, | ||
| 647 | &fprog); | ||
| 648 | else | ||
| 649 | err = 0; | ||
| 650 | kfree(code); | 650 | kfree(code); |
| 651 | 651 | ||
| 652 | return err; | 652 | return err; |
| @@ -663,9 +663,15 @@ isdn_ppp_ioctl(int min, struct file *file, unsigned int cmd, unsigned long arg) | |||
| 663 | fprog.len = len; | 663 | fprog.len = len; |
| 664 | fprog.filter = code; | 664 | fprog.filter = code; |
| 665 | 665 | ||
| 666 | if (is->active_filter) | 666 | if (is->active_filter) { |
| 667 | sk_unattached_filter_destroy(is->active_filter); | 667 | sk_unattached_filter_destroy(is->active_filter); |
| 668 | err = sk_unattached_filter_create(&is->active_filter, &fprog); | 668 | is->active_filter = NULL; |
| 669 | } | ||
| 670 | if (fprog.filter != NULL) | ||
| 671 | err = sk_unattached_filter_create(&is->active_filter, | ||
| 672 | &fprog); | ||
| 673 | else | ||
| 674 | err = 0; | ||
| 669 | kfree(code); | 675 | kfree(code); |
| 670 | 676 | ||
| 671 | return err; | 677 | return err; |
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-bufio.c b/drivers/md/dm-bufio.c index 4e84095833db..d724459860d9 100644 --- a/drivers/md/dm-bufio.c +++ b/drivers/md/dm-bufio.c | |||
| @@ -1541,7 +1541,7 @@ struct dm_bufio_client *dm_bufio_client_create(struct block_device *bdev, unsign | |||
| 1541 | BUG_ON(block_size < 1 << SECTOR_SHIFT || | 1541 | BUG_ON(block_size < 1 << SECTOR_SHIFT || |
| 1542 | (block_size & (block_size - 1))); | 1542 | (block_size & (block_size - 1))); |
| 1543 | 1543 | ||
| 1544 | c = kmalloc(sizeof(*c), GFP_KERNEL); | 1544 | c = kzalloc(sizeof(*c), GFP_KERNEL); |
| 1545 | if (!c) { | 1545 | if (!c) { |
| 1546 | r = -ENOMEM; | 1546 | r = -ENOMEM; |
| 1547 | goto bad_client; | 1547 | goto bad_client; |
diff --git a/drivers/md/dm-cache-metadata.c b/drivers/md/dm-cache-metadata.c index 4ead4ba60656..d2899e7eb3aa 100644 --- a/drivers/md/dm-cache-metadata.c +++ b/drivers/md/dm-cache-metadata.c | |||
| @@ -425,6 +425,15 @@ static int __open_metadata(struct dm_cache_metadata *cmd) | |||
| 425 | 425 | ||
| 426 | disk_super = dm_block_data(sblock); | 426 | disk_super = dm_block_data(sblock); |
| 427 | 427 | ||
| 428 | /* Verify the data block size hasn't changed */ | ||
| 429 | if (le32_to_cpu(disk_super->data_block_size) != cmd->data_block_size) { | ||
| 430 | DMERR("changing the data block size (from %u to %llu) is not supported", | ||
| 431 | le32_to_cpu(disk_super->data_block_size), | ||
| 432 | (unsigned long long)cmd->data_block_size); | ||
| 433 | r = -EINVAL; | ||
| 434 | goto bad; | ||
| 435 | } | ||
| 436 | |||
| 428 | r = __check_incompat_features(disk_super, cmd); | 437 | r = __check_incompat_features(disk_super, cmd); |
| 429 | if (r < 0) | 438 | if (r < 0) |
| 430 | goto bad; | 439 | goto bad; |
diff --git a/drivers/md/dm-cache-target.c b/drivers/md/dm-cache-target.c index 5f054c44b485..2c63326638b6 100644 --- a/drivers/md/dm-cache-target.c +++ b/drivers/md/dm-cache-target.c | |||
| @@ -231,7 +231,7 @@ struct cache { | |||
| 231 | /* | 231 | /* |
| 232 | * cache_size entries, dirty if set | 232 | * cache_size entries, dirty if set |
| 233 | */ | 233 | */ |
| 234 | dm_cblock_t nr_dirty; | 234 | atomic_t nr_dirty; |
| 235 | unsigned long *dirty_bitset; | 235 | unsigned long *dirty_bitset; |
| 236 | 236 | ||
| 237 | /* | 237 | /* |
| @@ -492,7 +492,7 @@ static bool is_dirty(struct cache *cache, dm_cblock_t b) | |||
| 492 | static void set_dirty(struct cache *cache, dm_oblock_t oblock, dm_cblock_t cblock) | 492 | static void set_dirty(struct cache *cache, dm_oblock_t oblock, dm_cblock_t cblock) |
| 493 | { | 493 | { |
| 494 | if (!test_and_set_bit(from_cblock(cblock), cache->dirty_bitset)) { | 494 | if (!test_and_set_bit(from_cblock(cblock), cache->dirty_bitset)) { |
| 495 | cache->nr_dirty = to_cblock(from_cblock(cache->nr_dirty) + 1); | 495 | atomic_inc(&cache->nr_dirty); |
| 496 | policy_set_dirty(cache->policy, oblock); | 496 | policy_set_dirty(cache->policy, oblock); |
| 497 | } | 497 | } |
| 498 | } | 498 | } |
| @@ -501,8 +501,7 @@ static void clear_dirty(struct cache *cache, dm_oblock_t oblock, dm_cblock_t cbl | |||
| 501 | { | 501 | { |
| 502 | if (test_and_clear_bit(from_cblock(cblock), cache->dirty_bitset)) { | 502 | if (test_and_clear_bit(from_cblock(cblock), cache->dirty_bitset)) { |
| 503 | policy_clear_dirty(cache->policy, oblock); | 503 | policy_clear_dirty(cache->policy, oblock); |
| 504 | cache->nr_dirty = to_cblock(from_cblock(cache->nr_dirty) - 1); | 504 | if (atomic_dec_return(&cache->nr_dirty) == 0) |
| 505 | if (!from_cblock(cache->nr_dirty)) | ||
| 506 | dm_table_event(cache->ti->table); | 505 | dm_table_event(cache->ti->table); |
| 507 | } | 506 | } |
| 508 | } | 507 | } |
| @@ -2269,7 +2268,7 @@ static int cache_create(struct cache_args *ca, struct cache **result) | |||
| 2269 | atomic_set(&cache->quiescing_ack, 0); | 2268 | atomic_set(&cache->quiescing_ack, 0); |
| 2270 | 2269 | ||
| 2271 | r = -ENOMEM; | 2270 | r = -ENOMEM; |
| 2272 | cache->nr_dirty = 0; | 2271 | atomic_set(&cache->nr_dirty, 0); |
| 2273 | cache->dirty_bitset = alloc_bitset(from_cblock(cache->cache_size)); | 2272 | cache->dirty_bitset = alloc_bitset(from_cblock(cache->cache_size)); |
| 2274 | if (!cache->dirty_bitset) { | 2273 | if (!cache->dirty_bitset) { |
| 2275 | *error = "could not allocate dirty bitset"; | 2274 | *error = "could not allocate dirty bitset"; |
| @@ -2808,7 +2807,7 @@ static void cache_status(struct dm_target *ti, status_type_t type, | |||
| 2808 | 2807 | ||
| 2809 | residency = policy_residency(cache->policy); | 2808 | residency = policy_residency(cache->policy); |
| 2810 | 2809 | ||
| 2811 | DMEMIT("%u %llu/%llu %u %llu/%llu %u %u %u %u %u %u %llu ", | 2810 | DMEMIT("%u %llu/%llu %u %llu/%llu %u %u %u %u %u %u %lu ", |
| 2812 | (unsigned)(DM_CACHE_METADATA_BLOCK_SIZE >> SECTOR_SHIFT), | 2811 | (unsigned)(DM_CACHE_METADATA_BLOCK_SIZE >> SECTOR_SHIFT), |
| 2813 | (unsigned long long)(nr_blocks_metadata - nr_free_blocks_metadata), | 2812 | (unsigned long long)(nr_blocks_metadata - nr_free_blocks_metadata), |
| 2814 | (unsigned long long)nr_blocks_metadata, | 2813 | (unsigned long long)nr_blocks_metadata, |
| @@ -2821,7 +2820,7 @@ static void cache_status(struct dm_target *ti, status_type_t type, | |||
| 2821 | (unsigned) atomic_read(&cache->stats.write_miss), | 2820 | (unsigned) atomic_read(&cache->stats.write_miss), |
| 2822 | (unsigned) atomic_read(&cache->stats.demotion), | 2821 | (unsigned) atomic_read(&cache->stats.demotion), |
| 2823 | (unsigned) atomic_read(&cache->stats.promotion), | 2822 | (unsigned) atomic_read(&cache->stats.promotion), |
| 2824 | (unsigned long long) from_cblock(cache->nr_dirty)); | 2823 | (unsigned long) atomic_read(&cache->nr_dirty)); |
| 2825 | 2824 | ||
| 2826 | if (writethrough_mode(&cache->features)) | 2825 | if (writethrough_mode(&cache->features)) |
| 2827 | DMEMIT("1 writethrough "); | 2826 | DMEMIT("1 writethrough "); |
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-thin-metadata.c b/drivers/md/dm-thin-metadata.c index b086a945edcb..e9d33ad59df5 100644 --- a/drivers/md/dm-thin-metadata.c +++ b/drivers/md/dm-thin-metadata.c | |||
| @@ -613,6 +613,15 @@ static int __open_metadata(struct dm_pool_metadata *pmd) | |||
| 613 | 613 | ||
| 614 | disk_super = dm_block_data(sblock); | 614 | disk_super = dm_block_data(sblock); |
| 615 | 615 | ||
| 616 | /* Verify the data block size hasn't changed */ | ||
| 617 | if (le32_to_cpu(disk_super->data_block_size) != pmd->data_block_size) { | ||
| 618 | DMERR("changing the data block size (from %u to %llu) is not supported", | ||
| 619 | le32_to_cpu(disk_super->data_block_size), | ||
| 620 | (unsigned long long)pmd->data_block_size); | ||
| 621 | r = -EINVAL; | ||
| 622 | goto bad_unlock_sblock; | ||
| 623 | } | ||
| 624 | |||
| 616 | r = __check_incompat_features(disk_super, pmd); | 625 | r = __check_incompat_features(disk_super, pmd); |
| 617 | if (r < 0) | 626 | if (r < 0) |
| 618 | goto bad_unlock_sblock; | 627 | goto bad_unlock_sblock; |
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/media/dvb-frontends/si2168.c b/drivers/media/dvb-frontends/si2168.c index 8637d2ed7623..2e3cdcfa0a67 100644 --- a/drivers/media/dvb-frontends/si2168.c +++ b/drivers/media/dvb-frontends/si2168.c | |||
| @@ -60,7 +60,7 @@ static int si2168_cmd_execute(struct si2168 *s, struct si2168_cmd *cmd) | |||
| 60 | jiffies_to_msecs(jiffies) - | 60 | jiffies_to_msecs(jiffies) - |
| 61 | (jiffies_to_msecs(timeout) - TIMEOUT)); | 61 | (jiffies_to_msecs(timeout) - TIMEOUT)); |
| 62 | 62 | ||
| 63 | if (!(cmd->args[0] >> 7) & 0x01) { | 63 | if (!((cmd->args[0] >> 7) & 0x01)) { |
| 64 | ret = -ETIMEDOUT; | 64 | ret = -ETIMEDOUT; |
| 65 | goto err_mutex_unlock; | 65 | goto err_mutex_unlock; |
| 66 | } | 66 | } |
| @@ -485,20 +485,6 @@ static int si2168_init(struct dvb_frontend *fe) | |||
| 485 | if (ret) | 485 | if (ret) |
| 486 | goto err; | 486 | goto err; |
| 487 | 487 | ||
| 488 | cmd.args[0] = 0x05; | ||
| 489 | cmd.args[1] = 0x00; | ||
| 490 | cmd.args[2] = 0xaa; | ||
| 491 | cmd.args[3] = 0x4d; | ||
| 492 | cmd.args[4] = 0x56; | ||
| 493 | cmd.args[5] = 0x40; | ||
| 494 | cmd.args[6] = 0x00; | ||
| 495 | cmd.args[7] = 0x00; | ||
| 496 | cmd.wlen = 8; | ||
| 497 | cmd.rlen = 1; | ||
| 498 | ret = si2168_cmd_execute(s, &cmd); | ||
| 499 | if (ret) | ||
| 500 | goto err; | ||
| 501 | |||
| 502 | /* cold state - try to download firmware */ | 488 | /* cold state - try to download firmware */ |
| 503 | dev_info(&s->client->dev, "%s: found a '%s' in cold state\n", | 489 | dev_info(&s->client->dev, "%s: found a '%s' in cold state\n", |
| 504 | KBUILD_MODNAME, si2168_ops.info.name); | 490 | KBUILD_MODNAME, si2168_ops.info.name); |
diff --git a/drivers/media/dvb-frontends/si2168_priv.h b/drivers/media/dvb-frontends/si2168_priv.h index 2a343e896f40..53f7f06ae343 100644 --- a/drivers/media/dvb-frontends/si2168_priv.h +++ b/drivers/media/dvb-frontends/si2168_priv.h | |||
| @@ -22,7 +22,7 @@ | |||
| 22 | #include <linux/firmware.h> | 22 | #include <linux/firmware.h> |
| 23 | #include <linux/i2c-mux.h> | 23 | #include <linux/i2c-mux.h> |
| 24 | 24 | ||
| 25 | #define SI2168_FIRMWARE "dvb-demod-si2168-01.fw" | 25 | #define SI2168_FIRMWARE "dvb-demod-si2168-02.fw" |
| 26 | 26 | ||
| 27 | /* state struct */ | 27 | /* state struct */ |
| 28 | struct si2168 { | 28 | struct si2168 { |
diff --git a/drivers/media/dvb-frontends/tda10071.c b/drivers/media/dvb-frontends/tda10071.c index 522fe00f5eee..9619be5d4827 100644 --- a/drivers/media/dvb-frontends/tda10071.c +++ b/drivers/media/dvb-frontends/tda10071.c | |||
| @@ -668,6 +668,7 @@ static int tda10071_set_frontend(struct dvb_frontend *fe) | |||
| 668 | struct dtv_frontend_properties *c = &fe->dtv_property_cache; | 668 | struct dtv_frontend_properties *c = &fe->dtv_property_cache; |
| 669 | int ret, i; | 669 | int ret, i; |
| 670 | u8 mode, rolloff, pilot, inversion, div; | 670 | u8 mode, rolloff, pilot, inversion, div; |
| 671 | fe_modulation_t modulation; | ||
| 671 | 672 | ||
| 672 | dev_dbg(&priv->i2c->dev, | 673 | dev_dbg(&priv->i2c->dev, |
| 673 | "%s: delivery_system=%d modulation=%d frequency=%d symbol_rate=%d inversion=%d pilot=%d rolloff=%d\n", | 674 | "%s: delivery_system=%d modulation=%d frequency=%d symbol_rate=%d inversion=%d pilot=%d rolloff=%d\n", |
| @@ -702,10 +703,13 @@ static int tda10071_set_frontend(struct dvb_frontend *fe) | |||
| 702 | 703 | ||
| 703 | switch (c->delivery_system) { | 704 | switch (c->delivery_system) { |
| 704 | case SYS_DVBS: | 705 | case SYS_DVBS: |
| 706 | modulation = QPSK; | ||
| 705 | rolloff = 0; | 707 | rolloff = 0; |
| 706 | pilot = 2; | 708 | pilot = 2; |
| 707 | break; | 709 | break; |
| 708 | case SYS_DVBS2: | 710 | case SYS_DVBS2: |
| 711 | modulation = c->modulation; | ||
| 712 | |||
| 709 | switch (c->rolloff) { | 713 | switch (c->rolloff) { |
| 710 | case ROLLOFF_20: | 714 | case ROLLOFF_20: |
| 711 | rolloff = 2; | 715 | rolloff = 2; |
| @@ -750,7 +754,7 @@ static int tda10071_set_frontend(struct dvb_frontend *fe) | |||
| 750 | 754 | ||
| 751 | for (i = 0, mode = 0xff; i < ARRAY_SIZE(TDA10071_MODCOD); i++) { | 755 | for (i = 0, mode = 0xff; i < ARRAY_SIZE(TDA10071_MODCOD); i++) { |
| 752 | if (c->delivery_system == TDA10071_MODCOD[i].delivery_system && | 756 | if (c->delivery_system == TDA10071_MODCOD[i].delivery_system && |
| 753 | c->modulation == TDA10071_MODCOD[i].modulation && | 757 | modulation == TDA10071_MODCOD[i].modulation && |
| 754 | c->fec_inner == TDA10071_MODCOD[i].fec) { | 758 | c->fec_inner == TDA10071_MODCOD[i].fec) { |
| 755 | mode = TDA10071_MODCOD[i].val; | 759 | mode = TDA10071_MODCOD[i].val; |
| 756 | dev_dbg(&priv->i2c->dev, "%s: mode found=%02x\n", | 760 | dev_dbg(&priv->i2c->dev, "%s: mode found=%02x\n", |
| @@ -834,10 +838,10 @@ static int tda10071_get_frontend(struct dvb_frontend *fe) | |||
| 834 | 838 | ||
| 835 | switch ((buf[1] >> 0) & 0x01) { | 839 | switch ((buf[1] >> 0) & 0x01) { |
| 836 | case 0: | 840 | case 0: |
| 837 | c->inversion = INVERSION_OFF; | 841 | c->inversion = INVERSION_ON; |
| 838 | break; | 842 | break; |
| 839 | case 1: | 843 | case 1: |
| 840 | c->inversion = INVERSION_ON; | 844 | c->inversion = INVERSION_OFF; |
| 841 | break; | 845 | break; |
| 842 | } | 846 | } |
| 843 | 847 | ||
| @@ -856,7 +860,7 @@ static int tda10071_get_frontend(struct dvb_frontend *fe) | |||
| 856 | if (ret) | 860 | if (ret) |
| 857 | goto error; | 861 | goto error; |
| 858 | 862 | ||
| 859 | c->symbol_rate = (buf[0] << 16) | (buf[1] << 8) | (buf[2] << 0); | 863 | c->symbol_rate = ((buf[0] << 16) | (buf[1] << 8) | (buf[2] << 0)) * 1000; |
| 860 | 864 | ||
| 861 | return ret; | 865 | return ret; |
| 862 | error: | 866 | error: |
diff --git a/drivers/media/dvb-frontends/tda10071_priv.h b/drivers/media/dvb-frontends/tda10071_priv.h index 4baf14bfb65a..420486192736 100644 --- a/drivers/media/dvb-frontends/tda10071_priv.h +++ b/drivers/media/dvb-frontends/tda10071_priv.h | |||
| @@ -55,6 +55,7 @@ static struct tda10071_modcod { | |||
| 55 | { SYS_DVBS2, QPSK, FEC_8_9, 0x0a }, | 55 | { SYS_DVBS2, QPSK, FEC_8_9, 0x0a }, |
| 56 | { SYS_DVBS2, QPSK, FEC_9_10, 0x0b }, | 56 | { SYS_DVBS2, QPSK, FEC_9_10, 0x0b }, |
| 57 | /* 8PSK */ | 57 | /* 8PSK */ |
| 58 | { SYS_DVBS2, PSK_8, FEC_AUTO, 0x00 }, | ||
| 58 | { SYS_DVBS2, PSK_8, FEC_3_5, 0x0c }, | 59 | { SYS_DVBS2, PSK_8, FEC_3_5, 0x0c }, |
| 59 | { SYS_DVBS2, PSK_8, FEC_2_3, 0x0d }, | 60 | { SYS_DVBS2, PSK_8, FEC_2_3, 0x0d }, |
| 60 | { SYS_DVBS2, PSK_8, FEC_3_4, 0x0e }, | 61 | { SYS_DVBS2, PSK_8, FEC_3_4, 0x0e }, |
diff --git a/drivers/media/pci/saa7134/saa7134-empress.c b/drivers/media/pci/saa7134/saa7134-empress.c index e65c760e4e8b..0006d6bf8c18 100644 --- a/drivers/media/pci/saa7134/saa7134-empress.c +++ b/drivers/media/pci/saa7134/saa7134-empress.c | |||
| @@ -179,7 +179,7 @@ static const struct v4l2_file_operations ts_fops = | |||
| 179 | .read = vb2_fop_read, | 179 | .read = vb2_fop_read, |
| 180 | .poll = vb2_fop_poll, | 180 | .poll = vb2_fop_poll, |
| 181 | .mmap = vb2_fop_mmap, | 181 | .mmap = vb2_fop_mmap, |
| 182 | .ioctl = video_ioctl2, | 182 | .unlocked_ioctl = video_ioctl2, |
| 183 | }; | 183 | }; |
| 184 | 184 | ||
| 185 | static const struct v4l2_ioctl_ops ts_ioctl_ops = { | 185 | static const struct v4l2_ioctl_ops ts_ioctl_ops = { |
diff --git a/drivers/media/platform/davinci/vpif_capture.c b/drivers/media/platform/davinci/vpif_capture.c index a7ed16497903..1e4ec697fb10 100644 --- a/drivers/media/platform/davinci/vpif_capture.c +++ b/drivers/media/platform/davinci/vpif_capture.c | |||
| @@ -269,6 +269,7 @@ err: | |||
| 269 | list_del(&buf->list); | 269 | list_del(&buf->list); |
| 270 | vb2_buffer_done(&buf->vb, VB2_BUF_STATE_QUEUED); | 270 | vb2_buffer_done(&buf->vb, VB2_BUF_STATE_QUEUED); |
| 271 | } | 271 | } |
| 272 | spin_unlock_irqrestore(&common->irqlock, flags); | ||
| 272 | 273 | ||
| 273 | return ret; | 274 | return ret; |
| 274 | } | 275 | } |
diff --git a/drivers/media/platform/davinci/vpif_display.c b/drivers/media/platform/davinci/vpif_display.c index 5bb085b19bcb..b431b58f39e3 100644 --- a/drivers/media/platform/davinci/vpif_display.c +++ b/drivers/media/platform/davinci/vpif_display.c | |||
| @@ -233,6 +233,7 @@ err: | |||
| 233 | list_del(&buf->list); | 233 | list_del(&buf->list); |
| 234 | vb2_buffer_done(&buf->vb, VB2_BUF_STATE_QUEUED); | 234 | vb2_buffer_done(&buf->vb, VB2_BUF_STATE_QUEUED); |
| 235 | } | 235 | } |
| 236 | spin_unlock_irqrestore(&common->irqlock, flags); | ||
| 236 | 237 | ||
| 237 | return ret; | 238 | return ret; |
| 238 | } | 239 | } |
diff --git a/drivers/media/tuners/si2157.c b/drivers/media/tuners/si2157.c index 271a752cee54..fa4cc7b880aa 100644 --- a/drivers/media/tuners/si2157.c +++ b/drivers/media/tuners/si2157.c | |||
| @@ -57,7 +57,7 @@ static int si2157_cmd_execute(struct si2157 *s, struct si2157_cmd *cmd) | |||
| 57 | jiffies_to_msecs(jiffies) - | 57 | jiffies_to_msecs(jiffies) - |
| 58 | (jiffies_to_msecs(timeout) - TIMEOUT)); | 58 | (jiffies_to_msecs(timeout) - TIMEOUT)); |
| 59 | 59 | ||
| 60 | if (!(buf[0] >> 7) & 0x01) { | 60 | if (!((buf[0] >> 7) & 0x01)) { |
| 61 | ret = -ETIMEDOUT; | 61 | ret = -ETIMEDOUT; |
| 62 | goto err_mutex_unlock; | 62 | goto err_mutex_unlock; |
| 63 | } else { | 63 | } else { |
diff --git a/drivers/media/usb/dvb-usb-v2/af9035.c b/drivers/media/usb/dvb-usb-v2/af9035.c index 021e4d35e4d7..7b9b75f60774 100644 --- a/drivers/media/usb/dvb-usb-v2/af9035.c +++ b/drivers/media/usb/dvb-usb-v2/af9035.c | |||
| @@ -704,15 +704,41 @@ static int af9035_read_config(struct dvb_usb_device *d) | |||
| 704 | if (ret < 0) | 704 | if (ret < 0) |
| 705 | goto err; | 705 | goto err; |
| 706 | 706 | ||
| 707 | if (tmp == 0x00) | 707 | dev_dbg(&d->udev->dev, "%s: [%d]tuner=%02x\n", |
| 708 | dev_dbg(&d->udev->dev, | 708 | __func__, i, tmp); |
| 709 | "%s: [%d]tuner not set, using default\n", | 709 | |
| 710 | __func__, i); | 710 | /* tuner sanity check */ |
| 711 | else | 711 | if (state->chip_type == 0x9135) { |
| 712 | if (state->chip_version == 0x02) { | ||
| 713 | /* IT9135 BX (v2) */ | ||
| 714 | switch (tmp) { | ||
| 715 | case AF9033_TUNER_IT9135_60: | ||
| 716 | case AF9033_TUNER_IT9135_61: | ||
| 717 | case AF9033_TUNER_IT9135_62: | ||
| 718 | state->af9033_config[i].tuner = tmp; | ||
| 719 | break; | ||
| 720 | } | ||
| 721 | } else { | ||
| 722 | /* IT9135 AX (v1) */ | ||
| 723 | switch (tmp) { | ||
| 724 | case AF9033_TUNER_IT9135_38: | ||
| 725 | case AF9033_TUNER_IT9135_51: | ||
| 726 | case AF9033_TUNER_IT9135_52: | ||
| 727 | state->af9033_config[i].tuner = tmp; | ||
| 728 | break; | ||
| 729 | } | ||
| 730 | } | ||
| 731 | } else { | ||
| 732 | /* AF9035 */ | ||
| 712 | state->af9033_config[i].tuner = tmp; | 733 | state->af9033_config[i].tuner = tmp; |
| 734 | } | ||
| 713 | 735 | ||
| 714 | dev_dbg(&d->udev->dev, "%s: [%d]tuner=%02x\n", | 736 | if (state->af9033_config[i].tuner != tmp) { |
| 715 | __func__, i, state->af9033_config[i].tuner); | 737 | dev_info(&d->udev->dev, |
| 738 | "%s: [%d] overriding tuner from %02x to %02x\n", | ||
| 739 | KBUILD_MODNAME, i, tmp, | ||
| 740 | state->af9033_config[i].tuner); | ||
| 741 | } | ||
| 716 | 742 | ||
| 717 | switch (state->af9033_config[i].tuner) { | 743 | switch (state->af9033_config[i].tuner) { |
| 718 | case AF9033_TUNER_TUA9001: | 744 | case AF9033_TUNER_TUA9001: |
diff --git a/drivers/media/usb/gspca/pac7302.c b/drivers/media/usb/gspca/pac7302.c index 2fd1c5e31a0f..339adce7c7a5 100644 --- a/drivers/media/usb/gspca/pac7302.c +++ b/drivers/media/usb/gspca/pac7302.c | |||
| @@ -928,6 +928,7 @@ static const struct usb_device_id device_table[] = { | |||
| 928 | {USB_DEVICE(0x093a, 0x2620)}, | 928 | {USB_DEVICE(0x093a, 0x2620)}, |
| 929 | {USB_DEVICE(0x093a, 0x2621)}, | 929 | {USB_DEVICE(0x093a, 0x2621)}, |
| 930 | {USB_DEVICE(0x093a, 0x2622), .driver_info = FL_VFLIP}, | 930 | {USB_DEVICE(0x093a, 0x2622), .driver_info = FL_VFLIP}, |
| 931 | {USB_DEVICE(0x093a, 0x2623), .driver_info = FL_VFLIP}, | ||
| 931 | {USB_DEVICE(0x093a, 0x2624), .driver_info = FL_VFLIP}, | 932 | {USB_DEVICE(0x093a, 0x2624), .driver_info = FL_VFLIP}, |
| 932 | {USB_DEVICE(0x093a, 0x2625)}, | 933 | {USB_DEVICE(0x093a, 0x2625)}, |
| 933 | {USB_DEVICE(0x093a, 0x2626)}, | 934 | {USB_DEVICE(0x093a, 0x2626)}, |
diff --git a/drivers/media/usb/hdpvr/hdpvr-video.c b/drivers/media/usb/hdpvr/hdpvr-video.c index 0500c4175d5f..6bce01a674f9 100644 --- a/drivers/media/usb/hdpvr/hdpvr-video.c +++ b/drivers/media/usb/hdpvr/hdpvr-video.c | |||
| @@ -82,7 +82,7 @@ static void hdpvr_read_bulk_callback(struct urb *urb) | |||
| 82 | } | 82 | } |
| 83 | 83 | ||
| 84 | /*=========================================================================*/ | 84 | /*=========================================================================*/ |
| 85 | /* bufffer bits */ | 85 | /* buffer bits */ |
| 86 | 86 | ||
| 87 | /* function expects dev->io_mutex to be hold by caller */ | 87 | /* function expects dev->io_mutex to be hold by caller */ |
| 88 | int hdpvr_cancel_queue(struct hdpvr_device *dev) | 88 | int hdpvr_cancel_queue(struct hdpvr_device *dev) |
| @@ -926,7 +926,7 @@ static int hdpvr_s_ctrl(struct v4l2_ctrl *ctrl) | |||
| 926 | case V4L2_CID_MPEG_AUDIO_ENCODING: | 926 | case V4L2_CID_MPEG_AUDIO_ENCODING: |
| 927 | if (dev->flags & HDPVR_FLAG_AC3_CAP) { | 927 | if (dev->flags & HDPVR_FLAG_AC3_CAP) { |
| 928 | opt->audio_codec = ctrl->val; | 928 | opt->audio_codec = ctrl->val; |
| 929 | return hdpvr_set_audio(dev, opt->audio_input, | 929 | return hdpvr_set_audio(dev, opt->audio_input + 1, |
| 930 | opt->audio_codec); | 930 | opt->audio_codec); |
| 931 | } | 931 | } |
| 932 | return 0; | 932 | return 0; |
| @@ -1198,7 +1198,7 @@ int hdpvr_register_videodev(struct hdpvr_device *dev, struct device *parent, | |||
| 1198 | v4l2_ctrl_new_std_menu(hdl, &hdpvr_ctrl_ops, | 1198 | v4l2_ctrl_new_std_menu(hdl, &hdpvr_ctrl_ops, |
| 1199 | V4L2_CID_MPEG_AUDIO_ENCODING, | 1199 | V4L2_CID_MPEG_AUDIO_ENCODING, |
| 1200 | ac3 ? V4L2_MPEG_AUDIO_ENCODING_AC3 : V4L2_MPEG_AUDIO_ENCODING_AAC, | 1200 | ac3 ? V4L2_MPEG_AUDIO_ENCODING_AC3 : V4L2_MPEG_AUDIO_ENCODING_AAC, |
| 1201 | 0x7, V4L2_MPEG_AUDIO_ENCODING_AAC); | 1201 | 0x7, ac3 ? dev->options.audio_codec : V4L2_MPEG_AUDIO_ENCODING_AAC); |
| 1202 | v4l2_ctrl_new_std_menu(hdl, &hdpvr_ctrl_ops, | 1202 | v4l2_ctrl_new_std_menu(hdl, &hdpvr_ctrl_ops, |
| 1203 | V4L2_CID_MPEG_VIDEO_ENCODING, | 1203 | V4L2_CID_MPEG_VIDEO_ENCODING, |
| 1204 | V4L2_MPEG_VIDEO_ENCODING_MPEG_4_AVC, 0x3, | 1204 | V4L2_MPEG_VIDEO_ENCODING_MPEG_4_AVC, 0x3, |
diff --git a/drivers/media/v4l2-core/v4l2-dv-timings.c b/drivers/media/v4l2-core/v4l2-dv-timings.c index 4ae54caadd03..ce1c9f5d9dee 100644 --- a/drivers/media/v4l2-core/v4l2-dv-timings.c +++ b/drivers/media/v4l2-core/v4l2-dv-timings.c | |||
| @@ -610,10 +610,10 @@ struct v4l2_fract v4l2_calc_aspect_ratio(u8 hor_landscape, u8 vert_portrait) | |||
| 610 | aspect.denominator = 9; | 610 | aspect.denominator = 9; |
| 611 | } else if (ratio == 34) { | 611 | } else if (ratio == 34) { |
| 612 | aspect.numerator = 4; | 612 | aspect.numerator = 4; |
| 613 | aspect.numerator = 3; | 613 | aspect.denominator = 3; |
| 614 | } else if (ratio == 68) { | 614 | } else if (ratio == 68) { |
| 615 | aspect.numerator = 15; | 615 | aspect.numerator = 15; |
| 616 | aspect.numerator = 9; | 616 | aspect.denominator = 9; |
| 617 | } else { | 617 | } else { |
| 618 | aspect.numerator = hor_landscape + 99; | 618 | aspect.numerator = hor_landscape + 99; |
| 619 | aspect.denominator = 100; | 619 | aspect.denominator = 100; |
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/mtd/chips/cfi_cmdset_0001.c b/drivers/mtd/chips/cfi_cmdset_0001.c index e4ec355704a6..a7543ba3e190 100644 --- a/drivers/mtd/chips/cfi_cmdset_0001.c +++ b/drivers/mtd/chips/cfi_cmdset_0001.c | |||
| @@ -52,6 +52,11 @@ | |||
| 52 | /* Atmel chips */ | 52 | /* Atmel chips */ |
| 53 | #define AT49BV640D 0x02de | 53 | #define AT49BV640D 0x02de |
| 54 | #define AT49BV640DT 0x02db | 54 | #define AT49BV640DT 0x02db |
| 55 | /* Sharp chips */ | ||
| 56 | #define LH28F640BFHE_PTTL90 0x00b0 | ||
| 57 | #define LH28F640BFHE_PBTL90 0x00b1 | ||
| 58 | #define LH28F640BFHE_PTTL70A 0x00b2 | ||
| 59 | #define LH28F640BFHE_PBTL70A 0x00b3 | ||
| 55 | 60 | ||
| 56 | static int cfi_intelext_read (struct mtd_info *, loff_t, size_t, size_t *, u_char *); | 61 | static int cfi_intelext_read (struct mtd_info *, loff_t, size_t, size_t *, u_char *); |
| 57 | static int cfi_intelext_write_words(struct mtd_info *, loff_t, size_t, size_t *, const u_char *); | 62 | static int cfi_intelext_write_words(struct mtd_info *, loff_t, size_t, size_t *, const u_char *); |
| @@ -258,6 +263,36 @@ static void fixup_st_m28w320cb(struct mtd_info *mtd) | |||
| 258 | (cfi->cfiq->EraseRegionInfo[1] & 0xffff0000) | 0x3e; | 263 | (cfi->cfiq->EraseRegionInfo[1] & 0xffff0000) | 0x3e; |
| 259 | }; | 264 | }; |
| 260 | 265 | ||
| 266 | static int is_LH28F640BF(struct cfi_private *cfi) | ||
| 267 | { | ||
| 268 | /* Sharp LH28F640BF Family */ | ||
| 269 | if (cfi->mfr == CFI_MFR_SHARP && ( | ||
| 270 | cfi->id == LH28F640BFHE_PTTL90 || cfi->id == LH28F640BFHE_PBTL90 || | ||
| 271 | cfi->id == LH28F640BFHE_PTTL70A || cfi->id == LH28F640BFHE_PBTL70A)) | ||
| 272 | return 1; | ||
| 273 | return 0; | ||
| 274 | } | ||
| 275 | |||
| 276 | static void fixup_LH28F640BF(struct mtd_info *mtd) | ||
| 277 | { | ||
| 278 | struct map_info *map = mtd->priv; | ||
| 279 | struct cfi_private *cfi = map->fldrv_priv; | ||
| 280 | struct cfi_pri_intelext *extp = cfi->cmdset_priv; | ||
| 281 | |||
| 282 | /* Reset the Partition Configuration Register on LH28F640BF | ||
| 283 | * to a single partition (PCR = 0x000): PCR is embedded into A0-A15. */ | ||
| 284 | if (is_LH28F640BF(cfi)) { | ||
| 285 | printk(KERN_INFO "Reset Partition Config. Register: 1 Partition of 4 planes\n"); | ||
| 286 | map_write(map, CMD(0x60), 0); | ||
| 287 | map_write(map, CMD(0x04), 0); | ||
| 288 | |||
| 289 | /* We have set one single partition thus | ||
| 290 | * Simultaneous Operations are not allowed */ | ||
| 291 | printk(KERN_INFO "cfi_cmdset_0001: Simultaneous Operations disabled\n"); | ||
| 292 | extp->FeatureSupport &= ~512; | ||
| 293 | } | ||
| 294 | } | ||
| 295 | |||
| 261 | static void fixup_use_point(struct mtd_info *mtd) | 296 | static void fixup_use_point(struct mtd_info *mtd) |
| 262 | { | 297 | { |
| 263 | struct map_info *map = mtd->priv; | 298 | struct map_info *map = mtd->priv; |
| @@ -309,6 +344,8 @@ static struct cfi_fixup cfi_fixup_table[] = { | |||
| 309 | { CFI_MFR_ST, 0x00ba, /* M28W320CT */ fixup_st_m28w320ct }, | 344 | { CFI_MFR_ST, 0x00ba, /* M28W320CT */ fixup_st_m28w320ct }, |
| 310 | { CFI_MFR_ST, 0x00bb, /* M28W320CB */ fixup_st_m28w320cb }, | 345 | { CFI_MFR_ST, 0x00bb, /* M28W320CB */ fixup_st_m28w320cb }, |
| 311 | { CFI_MFR_INTEL, CFI_ID_ANY, fixup_unlock_powerup_lock }, | 346 | { CFI_MFR_INTEL, CFI_ID_ANY, fixup_unlock_powerup_lock }, |
| 347 | { CFI_MFR_SHARP, CFI_ID_ANY, fixup_unlock_powerup_lock }, | ||
| 348 | { CFI_MFR_SHARP, CFI_ID_ANY, fixup_LH28F640BF }, | ||
| 312 | { 0, 0, NULL } | 349 | { 0, 0, NULL } |
| 313 | }; | 350 | }; |
| 314 | 351 | ||
| @@ -1649,6 +1686,12 @@ static int __xipram do_write_buffer(struct map_info *map, struct flchip *chip, | |||
| 1649 | initial_adr = adr; | 1686 | initial_adr = adr; |
| 1650 | cmd_adr = adr & ~(wbufsize-1); | 1687 | cmd_adr = adr & ~(wbufsize-1); |
| 1651 | 1688 | ||
| 1689 | /* Sharp LH28F640BF chips need the first address for the | ||
| 1690 | * Page Buffer Program command. See Table 5 of | ||
| 1691 | * LH28F320BF, LH28F640BF, LH28F128BF Series (Appendix FUM00701) */ | ||
| 1692 | if (is_LH28F640BF(cfi)) | ||
| 1693 | cmd_adr = adr; | ||
| 1694 | |||
| 1652 | /* Let's determine this according to the interleave only once */ | 1695 | /* Let's determine this according to the interleave only once */ |
| 1653 | write_cmd = (cfi->cfiq->P_ID != P_ID_INTEL_PERFORMANCE) ? CMD(0xe8) : CMD(0xe9); | 1696 | write_cmd = (cfi->cfiq->P_ID != P_ID_INTEL_PERFORMANCE) ? CMD(0xe8) : CMD(0xe9); |
| 1654 | 1697 | ||
diff --git a/drivers/mtd/devices/elm.c b/drivers/mtd/devices/elm.c index 7df86948e6d4..b4f61c7fc161 100644 --- a/drivers/mtd/devices/elm.c +++ b/drivers/mtd/devices/elm.c | |||
| @@ -475,6 +475,7 @@ static int elm_context_save(struct elm_info *info) | |||
| 475 | ELM_SYNDROME_FRAGMENT_1 + offset); | 475 | ELM_SYNDROME_FRAGMENT_1 + offset); |
| 476 | regs->elm_syndrome_fragment_0[i] = elm_read_reg(info, | 476 | regs->elm_syndrome_fragment_0[i] = elm_read_reg(info, |
| 477 | ELM_SYNDROME_FRAGMENT_0 + offset); | 477 | ELM_SYNDROME_FRAGMENT_0 + offset); |
| 478 | break; | ||
| 478 | default: | 479 | default: |
| 479 | return -EINVAL; | 480 | return -EINVAL; |
| 480 | } | 481 | } |
| @@ -520,6 +521,7 @@ static int elm_context_restore(struct elm_info *info) | |||
| 520 | regs->elm_syndrome_fragment_1[i]); | 521 | regs->elm_syndrome_fragment_1[i]); |
| 521 | elm_write_reg(info, ELM_SYNDROME_FRAGMENT_0 + offset, | 522 | elm_write_reg(info, ELM_SYNDROME_FRAGMENT_0 + offset, |
| 522 | regs->elm_syndrome_fragment_0[i]); | 523 | regs->elm_syndrome_fragment_0[i]); |
| 524 | break; | ||
| 523 | default: | 525 | default: |
| 524 | return -EINVAL; | 526 | return -EINVAL; |
| 525 | } | 527 | } |
diff --git a/drivers/mtd/nand/nand_base.c b/drivers/mtd/nand/nand_base.c index 41167e9e991e..4f3e80c68a26 100644 --- a/drivers/mtd/nand/nand_base.c +++ b/drivers/mtd/nand/nand_base.c | |||
| @@ -4047,8 +4047,10 @@ int nand_scan_tail(struct mtd_info *mtd) | |||
| 4047 | ecc->layout->oobavail += ecc->layout->oobfree[i].length; | 4047 | ecc->layout->oobavail += ecc->layout->oobfree[i].length; |
| 4048 | mtd->oobavail = ecc->layout->oobavail; | 4048 | mtd->oobavail = ecc->layout->oobavail; |
| 4049 | 4049 | ||
| 4050 | /* ECC sanity check: warn noisily if it's too weak */ | 4050 | /* ECC sanity check: warn if it's too weak */ |
| 4051 | WARN_ON(!nand_ecc_strength_good(mtd)); | 4051 | if (!nand_ecc_strength_good(mtd)) |
| 4052 | pr_warn("WARNING: %s: the ECC used on your system is too weak compared to the one required by the NAND chip\n", | ||
| 4053 | mtd->name); | ||
| 4052 | 4054 | ||
| 4053 | /* | 4055 | /* |
| 4054 | * Set the number of read / write steps for one page depending on ECC | 4056 | * Set the number of read / write steps for one page depending on ECC |
diff --git a/drivers/mtd/ubi/fastmap.c b/drivers/mtd/ubi/fastmap.c index b04e7d059888..0431b46d9fd9 100644 --- a/drivers/mtd/ubi/fastmap.c +++ b/drivers/mtd/ubi/fastmap.c | |||
| @@ -125,7 +125,7 @@ static struct ubi_ainf_volume *add_vol(struct ubi_attach_info *ai, int vol_id, | |||
| 125 | parent = *p; | 125 | parent = *p; |
| 126 | av = rb_entry(parent, struct ubi_ainf_volume, rb); | 126 | av = rb_entry(parent, struct ubi_ainf_volume, rb); |
| 127 | 127 | ||
| 128 | if (vol_id < av->vol_id) | 128 | if (vol_id > av->vol_id) |
| 129 | p = &(*p)->rb_left; | 129 | p = &(*p)->rb_left; |
| 130 | else | 130 | else |
| 131 | p = &(*p)->rb_right; | 131 | p = &(*p)->rb_right; |
| @@ -423,7 +423,7 @@ static int scan_pool(struct ubi_device *ubi, struct ubi_attach_info *ai, | |||
| 423 | pnum, err); | 423 | pnum, err); |
| 424 | ret = err > 0 ? UBI_BAD_FASTMAP : err; | 424 | ret = err > 0 ? UBI_BAD_FASTMAP : err; |
| 425 | goto out; | 425 | goto out; |
| 426 | } else if (ret == UBI_IO_BITFLIPS) | 426 | } else if (err == UBI_IO_BITFLIPS) |
| 427 | scrub = 1; | 427 | scrub = 1; |
| 428 | 428 | ||
| 429 | /* | 429 | /* |
diff --git a/drivers/net/bonding/bond_main.c b/drivers/net/bonding/bond_main.c index 04f35f960cb8..701f86cd5993 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 | ||
| @@ -4059,7 +4068,7 @@ static int bond_check_params(struct bond_params *params) | |||
| 4059 | } | 4068 | } |
| 4060 | 4069 | ||
| 4061 | if (ad_select) { | 4070 | if (ad_select) { |
| 4062 | bond_opt_initstr(&newval, lacp_rate); | 4071 | bond_opt_initstr(&newval, ad_select); |
| 4063 | valptr = bond_opt_parse(bond_opt_get(BOND_OPT_AD_SELECT), | 4072 | valptr = bond_opt_parse(bond_opt_get(BOND_OPT_AD_SELECT), |
| 4064 | &newval); | 4073 | &newval); |
| 4065 | if (!valptr) { | 4074 | if (!valptr) { |
diff --git a/drivers/net/can/c_can/c_can_platform.c b/drivers/net/can/c_can/c_can_platform.c index 824108cd9fd5..12430be6448a 100644 --- a/drivers/net/can/c_can/c_can_platform.c +++ b/drivers/net/can/c_can/c_can_platform.c | |||
| @@ -287,7 +287,8 @@ static int c_can_plat_probe(struct platform_device *pdev) | |||
| 287 | break; | 287 | break; |
| 288 | } | 288 | } |
| 289 | 289 | ||
| 290 | priv->raminit_ctrlreg = devm_ioremap_resource(&pdev->dev, res); | 290 | priv->raminit_ctrlreg = devm_ioremap(&pdev->dev, res->start, |
| 291 | resource_size(res)); | ||
| 291 | if (IS_ERR(priv->raminit_ctrlreg) || priv->instance < 0) | 292 | if (IS_ERR(priv->raminit_ctrlreg) || priv->instance < 0) |
| 292 | dev_info(&pdev->dev, "control memory is not used for raminit\n"); | 293 | dev_info(&pdev->dev, "control memory is not used for raminit\n"); |
| 293 | else | 294 | else |
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/amd/xgbe/xgbe-main.c b/drivers/net/ethernet/amd/xgbe/xgbe-main.c index c83584a26713..5a1891faba8a 100644 --- a/drivers/net/ethernet/amd/xgbe/xgbe-main.c +++ b/drivers/net/ethernet/amd/xgbe/xgbe-main.c | |||
| @@ -339,7 +339,8 @@ static int xgbe_probe(struct platform_device *pdev) | |||
| 339 | /* Calculate the number of Tx and Rx rings to be created */ | 339 | /* Calculate the number of Tx and Rx rings to be created */ |
| 340 | pdata->tx_ring_count = min_t(unsigned int, num_online_cpus(), | 340 | pdata->tx_ring_count = min_t(unsigned int, num_online_cpus(), |
| 341 | pdata->hw_feat.tx_ch_cnt); | 341 | pdata->hw_feat.tx_ch_cnt); |
| 342 | if (netif_set_real_num_tx_queues(netdev, pdata->tx_ring_count)) { | 342 | ret = netif_set_real_num_tx_queues(netdev, pdata->tx_ring_count); |
| 343 | if (ret) { | ||
| 343 | dev_err(dev, "error setting real tx queue count\n"); | 344 | dev_err(dev, "error setting real tx queue count\n"); |
| 344 | goto err_io; | 345 | goto err_io; |
| 345 | } | 346 | } |
diff --git a/drivers/net/ethernet/broadcom/bcmsysport.c b/drivers/net/ethernet/broadcom/bcmsysport.c index 141160ef249a..5776e503e4c5 100644 --- a/drivers/net/ethernet/broadcom/bcmsysport.c +++ b/drivers/net/ethernet/broadcom/bcmsysport.c | |||
| @@ -654,13 +654,13 @@ static int bcm_sysport_tx_poll(struct napi_struct *napi, int budget) | |||
| 654 | 654 | ||
| 655 | work_done = bcm_sysport_tx_reclaim(ring->priv, ring); | 655 | work_done = bcm_sysport_tx_reclaim(ring->priv, ring); |
| 656 | 656 | ||
| 657 | if (work_done < budget) { | 657 | if (work_done == 0) { |
| 658 | napi_complete(napi); | 658 | napi_complete(napi); |
| 659 | /* re-enable TX interrupt */ | 659 | /* re-enable TX interrupt */ |
| 660 | intrl2_1_mask_clear(ring->priv, BIT(ring->index)); | 660 | intrl2_1_mask_clear(ring->priv, BIT(ring->index)); |
| 661 | } | 661 | } |
| 662 | 662 | ||
| 663 | return work_done; | 663 | return 0; |
| 664 | } | 664 | } |
| 665 | 665 | ||
| 666 | static void bcm_sysport_tx_reclaim_all(struct bcm_sysport_priv *priv) | 666 | static void bcm_sysport_tx_reclaim_all(struct bcm_sysport_priv *priv) |
| @@ -1254,28 +1254,17 @@ static inline void umac_enable_set(struct bcm_sysport_priv *priv, | |||
| 1254 | usleep_range(1000, 2000); | 1254 | usleep_range(1000, 2000); |
| 1255 | } | 1255 | } |
| 1256 | 1256 | ||
| 1257 | static inline int umac_reset(struct bcm_sysport_priv *priv) | 1257 | static inline void umac_reset(struct bcm_sysport_priv *priv) |
| 1258 | { | 1258 | { |
| 1259 | unsigned int timeout = 0; | ||
| 1260 | u32 reg; | 1259 | u32 reg; |
| 1261 | int ret = 0; | ||
| 1262 | |||
| 1263 | umac_writel(priv, 0, UMAC_CMD); | ||
| 1264 | while (timeout++ < 1000) { | ||
| 1265 | reg = umac_readl(priv, UMAC_CMD); | ||
| 1266 | if (!(reg & CMD_SW_RESET)) | ||
| 1267 | break; | ||
| 1268 | |||
| 1269 | udelay(1); | ||
| 1270 | } | ||
| 1271 | |||
| 1272 | if (timeout == 1000) { | ||
| 1273 | dev_err(&priv->pdev->dev, | ||
| 1274 | "timeout waiting for MAC to come out of reset\n"); | ||
| 1275 | ret = -ETIMEDOUT; | ||
| 1276 | } | ||
| 1277 | 1260 | ||
| 1278 | return ret; | 1261 | reg = umac_readl(priv, UMAC_CMD); |
| 1262 | reg |= CMD_SW_RESET; | ||
| 1263 | umac_writel(priv, reg, UMAC_CMD); | ||
| 1264 | udelay(10); | ||
| 1265 | reg = umac_readl(priv, UMAC_CMD); | ||
| 1266 | reg &= ~CMD_SW_RESET; | ||
| 1267 | umac_writel(priv, reg, UMAC_CMD); | ||
| 1279 | } | 1268 | } |
| 1280 | 1269 | ||
| 1281 | static void umac_set_hw_addr(struct bcm_sysport_priv *priv, | 1270 | static void umac_set_hw_addr(struct bcm_sysport_priv *priv, |
| @@ -1303,11 +1292,7 @@ static int bcm_sysport_open(struct net_device *dev) | |||
| 1303 | int ret; | 1292 | int ret; |
| 1304 | 1293 | ||
| 1305 | /* Reset UniMAC */ | 1294 | /* Reset UniMAC */ |
| 1306 | ret = umac_reset(priv); | 1295 | umac_reset(priv); |
| 1307 | if (ret) { | ||
| 1308 | netdev_err(dev, "UniMAC reset failed\n"); | ||
| 1309 | return ret; | ||
| 1310 | } | ||
| 1311 | 1296 | ||
| 1312 | /* Flush TX and RX FIFOs at TOPCTRL level */ | 1297 | /* Flush TX and RX FIFOs at TOPCTRL level */ |
| 1313 | topctrl_flush(priv); | 1298 | topctrl_flush(priv); |
| @@ -1589,12 +1574,6 @@ static int bcm_sysport_probe(struct platform_device *pdev) | |||
| 1589 | BUILD_BUG_ON(sizeof(struct bcm_tsb) != 8); | 1574 | BUILD_BUG_ON(sizeof(struct bcm_tsb) != 8); |
| 1590 | dev->needed_headroom += sizeof(struct bcm_tsb); | 1575 | dev->needed_headroom += sizeof(struct bcm_tsb); |
| 1591 | 1576 | ||
| 1592 | /* We are interfaced to a switch which handles the multicast | ||
| 1593 | * filtering for us, so we do not support programming any | ||
| 1594 | * multicast hash table in this Ethernet MAC. | ||
| 1595 | */ | ||
| 1596 | dev->flags &= ~IFF_MULTICAST; | ||
| 1597 | |||
| 1598 | /* libphy will adjust the link state accordingly */ | 1577 | /* libphy will adjust the link state accordingly */ |
| 1599 | netif_carrier_off(dev); | 1578 | netif_carrier_off(dev); |
| 1600 | 1579 | ||
diff --git a/drivers/net/ethernet/broadcom/bnx2x/bnx2x.h b/drivers/net/ethernet/broadcom/bnx2x/bnx2x.h index 4cab09d3f807..8206a293e6b4 100644 --- a/drivers/net/ethernet/broadcom/bnx2x/bnx2x.h +++ b/drivers/net/ethernet/broadcom/bnx2x/bnx2x.h | |||
| @@ -346,6 +346,7 @@ struct sw_tx_bd { | |||
| 346 | u8 flags; | 346 | u8 flags; |
| 347 | /* Set on the first BD descriptor when there is a split BD */ | 347 | /* Set on the first BD descriptor when there is a split BD */ |
| 348 | #define BNX2X_TSO_SPLIT_BD (1<<0) | 348 | #define BNX2X_TSO_SPLIT_BD (1<<0) |
| 349 | #define BNX2X_HAS_SECOND_PBD (1<<1) | ||
| 349 | }; | 350 | }; |
| 350 | 351 | ||
| 351 | struct sw_rx_page { | 352 | struct sw_rx_page { |
diff --git a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.c b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.c index 47c5814114e1..c43e7238de21 100644 --- a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.c +++ b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.c | |||
| @@ -227,6 +227,12 @@ static u16 bnx2x_free_tx_pkt(struct bnx2x *bp, struct bnx2x_fp_txdata *txdata, | |||
| 227 | --nbd; | 227 | --nbd; |
| 228 | bd_idx = TX_BD(NEXT_TX_IDX(bd_idx)); | 228 | bd_idx = TX_BD(NEXT_TX_IDX(bd_idx)); |
| 229 | 229 | ||
| 230 | if (tx_buf->flags & BNX2X_HAS_SECOND_PBD) { | ||
| 231 | /* Skip second parse bd... */ | ||
| 232 | --nbd; | ||
| 233 | bd_idx = TX_BD(NEXT_TX_IDX(bd_idx)); | ||
| 234 | } | ||
| 235 | |||
| 230 | /* TSO headers+data bds share a common mapping. See bnx2x_tx_split() */ | 236 | /* TSO headers+data bds share a common mapping. See bnx2x_tx_split() */ |
| 231 | if (tx_buf->flags & BNX2X_TSO_SPLIT_BD) { | 237 | if (tx_buf->flags & BNX2X_TSO_SPLIT_BD) { |
| 232 | tx_data_bd = &txdata->tx_desc_ring[bd_idx].reg_bd; | 238 | tx_data_bd = &txdata->tx_desc_ring[bd_idx].reg_bd; |
| @@ -797,7 +803,8 @@ static void bnx2x_tpa_stop(struct bnx2x *bp, struct bnx2x_fastpath *fp, | |||
| 797 | 803 | ||
| 798 | return; | 804 | return; |
| 799 | } | 805 | } |
| 800 | bnx2x_frag_free(fp, new_data); | 806 | if (new_data) |
| 807 | bnx2x_frag_free(fp, new_data); | ||
| 801 | drop: | 808 | drop: |
| 802 | /* drop the packet and keep the buffer in the bin */ | 809 | /* drop the packet and keep the buffer in the bin */ |
| 803 | DP(NETIF_MSG_RX_STATUS, | 810 | DP(NETIF_MSG_RX_STATUS, |
| @@ -3888,6 +3895,9 @@ netdev_tx_t bnx2x_start_xmit(struct sk_buff *skb, struct net_device *dev) | |||
| 3888 | /* set encapsulation flag in start BD */ | 3895 | /* set encapsulation flag in start BD */ |
| 3889 | SET_FLAG(tx_start_bd->general_data, | 3896 | SET_FLAG(tx_start_bd->general_data, |
| 3890 | ETH_TX_START_BD_TUNNEL_EXIST, 1); | 3897 | ETH_TX_START_BD_TUNNEL_EXIST, 1); |
| 3898 | |||
| 3899 | tx_buf->flags |= BNX2X_HAS_SECOND_PBD; | ||
| 3900 | |||
| 3891 | nbd++; | 3901 | nbd++; |
| 3892 | } else if (xmit_type & XMIT_CSUM) { | 3902 | } else if (xmit_type & XMIT_CSUM) { |
| 3893 | /* Set PBD in checksum offload case w/o encapsulation */ | 3903 | /* Set PBD in checksum offload case w/o encapsulation */ |
diff --git a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_ethtool.c b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_ethtool.c index bd0600cf7266..25eddd90f482 100644 --- a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_ethtool.c +++ b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_ethtool.c | |||
| @@ -379,6 +379,7 @@ static int bnx2x_set_settings(struct net_device *dev, struct ethtool_cmd *cmd) | |||
| 379 | break; | 379 | break; |
| 380 | case PORT_FIBRE: | 380 | case PORT_FIBRE: |
| 381 | case PORT_DA: | 381 | case PORT_DA: |
| 382 | case PORT_NONE: | ||
| 382 | if (!(bp->port.supported[0] & SUPPORTED_FIBRE || | 383 | if (!(bp->port.supported[0] & SUPPORTED_FIBRE || |
| 383 | bp->port.supported[1] & SUPPORTED_FIBRE)) { | 384 | bp->port.supported[1] & SUPPORTED_FIBRE)) { |
| 384 | DP(BNX2X_MSG_ETHTOOL, | 385 | DP(BNX2X_MSG_ETHTOOL, |
diff --git a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c index 2887034523e0..6a8b1453a1b9 100644 --- a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c +++ b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c | |||
| @@ -12937,7 +12937,7 @@ static int bnx2x_get_num_non_def_sbs(struct pci_dev *pdev, int cnic_cnt) | |||
| 12937 | * without the default SB. | 12937 | * without the default SB. |
| 12938 | * For VFs there is no default SB, then we return (index+1). | 12938 | * For VFs there is no default SB, then we return (index+1). |
| 12939 | */ | 12939 | */ |
| 12940 | pci_read_config_word(pdev, pdev->msix_cap + PCI_MSI_FLAGS, &control); | 12940 | pci_read_config_word(pdev, pdev->msix_cap + PCI_MSIX_FLAGS, &control); |
| 12941 | 12941 | ||
| 12942 | index = control & PCI_MSIX_FLAGS_QSIZE; | 12942 | index = control & PCI_MSIX_FLAGS_QSIZE; |
| 12943 | 12943 | ||
diff --git a/drivers/net/ethernet/broadcom/genet/bcmgenet.c b/drivers/net/ethernet/broadcom/genet/bcmgenet.c index 5ba1cfbd60da..4e615debe472 100644 --- a/drivers/net/ethernet/broadcom/genet/bcmgenet.c +++ b/drivers/net/ethernet/broadcom/genet/bcmgenet.c | |||
| @@ -1149,6 +1149,11 @@ static netdev_tx_t bcmgenet_xmit(struct sk_buff *skb, struct net_device *dev) | |||
| 1149 | goto out; | 1149 | goto out; |
| 1150 | } | 1150 | } |
| 1151 | 1151 | ||
| 1152 | if (skb_padto(skb, ETH_ZLEN)) { | ||
| 1153 | ret = NETDEV_TX_OK; | ||
| 1154 | goto out; | ||
| 1155 | } | ||
| 1156 | |||
| 1152 | /* set the SKB transmit checksum */ | 1157 | /* set the SKB transmit checksum */ |
| 1153 | if (priv->desc_64b_en) { | 1158 | if (priv->desc_64b_en) { |
| 1154 | ret = bcmgenet_put_tx_csum(dev, skb); | 1159 | ret = bcmgenet_put_tx_csum(dev, skb); |
| @@ -1408,13 +1413,6 @@ static int bcmgenet_alloc_rx_buffers(struct bcmgenet_priv *priv) | |||
| 1408 | if (cb->skb) | 1413 | if (cb->skb) |
| 1409 | continue; | 1414 | continue; |
| 1410 | 1415 | ||
| 1411 | /* set the DMA descriptor length once and for all | ||
| 1412 | * it will only change if we support dynamically sizing | ||
| 1413 | * priv->rx_buf_len, but we do not | ||
| 1414 | */ | ||
| 1415 | dmadesc_set_length_status(priv, priv->rx_bd_assign_ptr, | ||
| 1416 | priv->rx_buf_len << DMA_BUFLENGTH_SHIFT); | ||
| 1417 | |||
| 1418 | ret = bcmgenet_rx_refill(priv, cb); | 1416 | ret = bcmgenet_rx_refill(priv, cb); |
| 1419 | if (ret) | 1417 | if (ret) |
| 1420 | break; | 1418 | break; |
| @@ -2535,14 +2533,17 @@ static int bcmgenet_probe(struct platform_device *pdev) | |||
| 2535 | netif_set_real_num_tx_queues(priv->dev, priv->hw_params->tx_queues + 1); | 2533 | netif_set_real_num_tx_queues(priv->dev, priv->hw_params->tx_queues + 1); |
| 2536 | netif_set_real_num_rx_queues(priv->dev, priv->hw_params->rx_queues + 1); | 2534 | netif_set_real_num_rx_queues(priv->dev, priv->hw_params->rx_queues + 1); |
| 2537 | 2535 | ||
| 2538 | err = register_netdev(dev); | 2536 | /* libphy will determine the link state */ |
| 2539 | if (err) | 2537 | netif_carrier_off(dev); |
| 2540 | goto err_clk_disable; | ||
| 2541 | 2538 | ||
| 2542 | /* Turn off the main clock, WOL clock is handled separately */ | 2539 | /* Turn off the main clock, WOL clock is handled separately */ |
| 2543 | if (!IS_ERR(priv->clk)) | 2540 | if (!IS_ERR(priv->clk)) |
| 2544 | clk_disable_unprepare(priv->clk); | 2541 | clk_disable_unprepare(priv->clk); |
| 2545 | 2542 | ||
| 2543 | err = register_netdev(dev); | ||
| 2544 | if (err) | ||
| 2545 | goto err; | ||
| 2546 | |||
| 2546 | return err; | 2547 | return err; |
| 2547 | 2548 | ||
| 2548 | err_clk_disable: | 2549 | err_clk_disable: |
diff --git a/drivers/net/ethernet/broadcom/genet/bcmgenet.h b/drivers/net/ethernet/broadcom/genet/bcmgenet.h index 0f117105fed1..e23c993b1362 100644 --- a/drivers/net/ethernet/broadcom/genet/bcmgenet.h +++ b/drivers/net/ethernet/broadcom/genet/bcmgenet.h | |||
| @@ -331,9 +331,9 @@ struct bcmgenet_mib_counters { | |||
| 331 | #define EXT_ENERGY_DET_MASK (1 << 12) | 331 | #define EXT_ENERGY_DET_MASK (1 << 12) |
| 332 | 332 | ||
| 333 | #define EXT_RGMII_OOB_CTRL 0x0C | 333 | #define EXT_RGMII_OOB_CTRL 0x0C |
| 334 | #define RGMII_MODE_EN (1 << 0) | ||
| 335 | #define RGMII_LINK (1 << 4) | 334 | #define RGMII_LINK (1 << 4) |
| 336 | #define OOB_DISABLE (1 << 5) | 335 | #define OOB_DISABLE (1 << 5) |
| 336 | #define RGMII_MODE_EN (1 << 6) | ||
| 337 | #define ID_MODE_DIS (1 << 16) | 337 | #define ID_MODE_DIS (1 << 16) |
| 338 | 338 | ||
| 339 | #define EXT_GPHY_CTRL 0x1C | 339 | #define EXT_GPHY_CTRL 0x1C |
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..1e187fb760f8 100644 --- a/drivers/net/ethernet/emulex/benet/be_main.c +++ b/drivers/net/ethernet/emulex/benet/be_main.c | |||
| @@ -2902,7 +2902,7 @@ static int be_open(struct net_device *netdev) | |||
| 2902 | for_all_evt_queues(adapter, eqo, i) { | 2902 | for_all_evt_queues(adapter, eqo, i) { |
| 2903 | napi_enable(&eqo->napi); | 2903 | napi_enable(&eqo->napi); |
| 2904 | be_enable_busy_poll(eqo); | 2904 | be_enable_busy_poll(eqo); |
| 2905 | be_eq_notify(adapter, eqo->q.id, true, false, 0); | 2905 | be_eq_notify(adapter, eqo->q.id, true, true, 0); |
| 2906 | } | 2906 | } |
| 2907 | adapter->flags |= BE_FLAGS_NAPI_ENABLED; | 2907 | adapter->flags |= BE_FLAGS_NAPI_ENABLED; |
| 2908 | 2908 | ||
| @@ -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/freescale/ucc_geth.c b/drivers/net/ethernet/freescale/ucc_geth.c index fab39e295441..36fc429298e3 100644 --- a/drivers/net/ethernet/freescale/ucc_geth.c +++ b/drivers/net/ethernet/freescale/ucc_geth.c | |||
| @@ -2990,11 +2990,11 @@ static int ucc_geth_startup(struct ucc_geth_private *ugeth) | |||
| 2990 | if (ug_info->rxExtendedFiltering) { | 2990 | if (ug_info->rxExtendedFiltering) { |
| 2991 | size += THREAD_RX_PRAM_ADDITIONAL_FOR_EXTENDED_FILTERING; | 2991 | size += THREAD_RX_PRAM_ADDITIONAL_FOR_EXTENDED_FILTERING; |
| 2992 | if (ug_info->largestexternallookupkeysize == | 2992 | if (ug_info->largestexternallookupkeysize == |
| 2993 | QE_FLTR_TABLE_LOOKUP_KEY_SIZE_8_BYTES) | 2993 | QE_FLTR_LARGEST_EXTERNAL_TABLE_LOOKUP_KEY_SIZE_8_BYTES) |
| 2994 | size += | 2994 | size += |
| 2995 | THREAD_RX_PRAM_ADDITIONAL_FOR_EXTENDED_FILTERING_8; | 2995 | THREAD_RX_PRAM_ADDITIONAL_FOR_EXTENDED_FILTERING_8; |
| 2996 | if (ug_info->largestexternallookupkeysize == | 2996 | if (ug_info->largestexternallookupkeysize == |
| 2997 | QE_FLTR_TABLE_LOOKUP_KEY_SIZE_16_BYTES) | 2997 | QE_FLTR_LARGEST_EXTERNAL_TABLE_LOOKUP_KEY_SIZE_16_BYTES) |
| 2998 | size += | 2998 | size += |
| 2999 | THREAD_RX_PRAM_ADDITIONAL_FOR_EXTENDED_FILTERING_16; | 2999 | THREAD_RX_PRAM_ADDITIONAL_FOR_EXTENDED_FILTERING_16; |
| 3000 | } | 3000 | } |
diff --git a/drivers/net/ethernet/intel/igb/e1000_82575.c b/drivers/net/ethernet/intel/igb/e1000_82575.c index a2db388cc31e..ee74f9536b31 100644 --- a/drivers/net/ethernet/intel/igb/e1000_82575.c +++ b/drivers/net/ethernet/intel/igb/e1000_82575.c | |||
| @@ -1481,6 +1481,13 @@ static s32 igb_init_hw_82575(struct e1000_hw *hw) | |||
| 1481 | s32 ret_val; | 1481 | s32 ret_val; |
| 1482 | u16 i, rar_count = mac->rar_entry_count; | 1482 | u16 i, rar_count = mac->rar_entry_count; |
| 1483 | 1483 | ||
| 1484 | if ((hw->mac.type >= e1000_i210) && | ||
| 1485 | !(igb_get_flash_presence_i210(hw))) { | ||
| 1486 | ret_val = igb_pll_workaround_i210(hw); | ||
| 1487 | if (ret_val) | ||
| 1488 | return ret_val; | ||
| 1489 | } | ||
| 1490 | |||
| 1484 | /* Initialize identification LED */ | 1491 | /* Initialize identification LED */ |
| 1485 | ret_val = igb_id_led_init(hw); | 1492 | ret_val = igb_id_led_init(hw); |
| 1486 | if (ret_val) { | 1493 | if (ret_val) { |
diff --git a/drivers/net/ethernet/intel/igb/e1000_defines.h b/drivers/net/ethernet/intel/igb/e1000_defines.h index 2a8bb35c2df2..217f8138851b 100644 --- a/drivers/net/ethernet/intel/igb/e1000_defines.h +++ b/drivers/net/ethernet/intel/igb/e1000_defines.h | |||
| @@ -46,14 +46,15 @@ | |||
| 46 | #define E1000_CTRL_EXT_SDP3_DIR 0x00000800 /* SDP3 Data direction */ | 46 | #define E1000_CTRL_EXT_SDP3_DIR 0x00000800 /* SDP3 Data direction */ |
| 47 | 47 | ||
| 48 | /* Physical Func Reset Done Indication */ | 48 | /* Physical Func Reset Done Indication */ |
| 49 | #define E1000_CTRL_EXT_PFRSTD 0x00004000 | 49 | #define E1000_CTRL_EXT_PFRSTD 0x00004000 |
| 50 | #define E1000_CTRL_EXT_LINK_MODE_MASK 0x00C00000 | 50 | #define E1000_CTRL_EXT_SDLPE 0X00040000 /* SerDes Low Power Enable */ |
| 51 | #define E1000_CTRL_EXT_LINK_MODE_PCIE_SERDES 0x00C00000 | 51 | #define E1000_CTRL_EXT_LINK_MODE_MASK 0x00C00000 |
| 52 | #define E1000_CTRL_EXT_LINK_MODE_1000BASE_KX 0x00400000 | 52 | #define E1000_CTRL_EXT_LINK_MODE_PCIE_SERDES 0x00C00000 |
| 53 | #define E1000_CTRL_EXT_LINK_MODE_SGMII 0x00800000 | 53 | #define E1000_CTRL_EXT_LINK_MODE_1000BASE_KX 0x00400000 |
| 54 | #define E1000_CTRL_EXT_LINK_MODE_GMII 0x00000000 | 54 | #define E1000_CTRL_EXT_LINK_MODE_SGMII 0x00800000 |
| 55 | #define E1000_CTRL_EXT_EIAME 0x01000000 | 55 | #define E1000_CTRL_EXT_LINK_MODE_GMII 0x00000000 |
| 56 | #define E1000_CTRL_EXT_IRCA 0x00000001 | 56 | #define E1000_CTRL_EXT_EIAME 0x01000000 |
| 57 | #define E1000_CTRL_EXT_IRCA 0x00000001 | ||
| 57 | /* Interrupt delay cancellation */ | 58 | /* Interrupt delay cancellation */ |
| 58 | /* Driver loaded bit for FW */ | 59 | /* Driver loaded bit for FW */ |
| 59 | #define E1000_CTRL_EXT_DRV_LOAD 0x10000000 | 60 | #define E1000_CTRL_EXT_DRV_LOAD 0x10000000 |
| @@ -62,6 +63,7 @@ | |||
| 62 | /* packet buffer parity error detection enabled */ | 63 | /* packet buffer parity error detection enabled */ |
| 63 | /* descriptor FIFO parity error detection enable */ | 64 | /* descriptor FIFO parity error detection enable */ |
| 64 | #define E1000_CTRL_EXT_PBA_CLR 0x80000000 /* PBA Clear */ | 65 | #define E1000_CTRL_EXT_PBA_CLR 0x80000000 /* PBA Clear */ |
| 66 | #define E1000_CTRL_EXT_PHYPDEN 0x00100000 | ||
| 65 | #define E1000_I2CCMD_REG_ADDR_SHIFT 16 | 67 | #define E1000_I2CCMD_REG_ADDR_SHIFT 16 |
| 66 | #define E1000_I2CCMD_PHY_ADDR_SHIFT 24 | 68 | #define E1000_I2CCMD_PHY_ADDR_SHIFT 24 |
| 67 | #define E1000_I2CCMD_OPCODE_READ 0x08000000 | 69 | #define E1000_I2CCMD_OPCODE_READ 0x08000000 |
diff --git a/drivers/net/ethernet/intel/igb/e1000_hw.h b/drivers/net/ethernet/intel/igb/e1000_hw.h index 89925e405849..ce55ea5d750c 100644 --- a/drivers/net/ethernet/intel/igb/e1000_hw.h +++ b/drivers/net/ethernet/intel/igb/e1000_hw.h | |||
| @@ -567,4 +567,7 @@ struct net_device *igb_get_hw_dev(struct e1000_hw *hw); | |||
| 567 | /* These functions must be implemented by drivers */ | 567 | /* These functions must be implemented by drivers */ |
| 568 | s32 igb_read_pcie_cap_reg(struct e1000_hw *hw, u32 reg, u16 *value); | 568 | s32 igb_read_pcie_cap_reg(struct e1000_hw *hw, u32 reg, u16 *value); |
| 569 | s32 igb_write_pcie_cap_reg(struct e1000_hw *hw, u32 reg, u16 *value); | 569 | s32 igb_write_pcie_cap_reg(struct e1000_hw *hw, u32 reg, u16 *value); |
| 570 | |||
| 571 | void igb_read_pci_cfg(struct e1000_hw *hw, u32 reg, u16 *value); | ||
| 572 | void igb_write_pci_cfg(struct e1000_hw *hw, u32 reg, u16 *value); | ||
| 570 | #endif /* _E1000_HW_H_ */ | 573 | #endif /* _E1000_HW_H_ */ |
diff --git a/drivers/net/ethernet/intel/igb/e1000_i210.c b/drivers/net/ethernet/intel/igb/e1000_i210.c index 337161f440dd..65d931669f81 100644 --- a/drivers/net/ethernet/intel/igb/e1000_i210.c +++ b/drivers/net/ethernet/intel/igb/e1000_i210.c | |||
| @@ -834,3 +834,69 @@ s32 igb_init_nvm_params_i210(struct e1000_hw *hw) | |||
| 834 | } | 834 | } |
| 835 | return ret_val; | 835 | return ret_val; |
| 836 | } | 836 | } |
| 837 | |||
| 838 | /** | ||
| 839 | * igb_pll_workaround_i210 | ||
| 840 | * @hw: pointer to the HW structure | ||
| 841 | * | ||
| 842 | * Works around an errata in the PLL circuit where it occasionally | ||
| 843 | * provides the wrong clock frequency after power up. | ||
| 844 | **/ | ||
| 845 | s32 igb_pll_workaround_i210(struct e1000_hw *hw) | ||
| 846 | { | ||
| 847 | s32 ret_val; | ||
| 848 | u32 wuc, mdicnfg, ctrl, ctrl_ext, reg_val; | ||
| 849 | u16 nvm_word, phy_word, pci_word, tmp_nvm; | ||
| 850 | int i; | ||
| 851 | |||
| 852 | /* Get and set needed register values */ | ||
| 853 | wuc = rd32(E1000_WUC); | ||
| 854 | mdicnfg = rd32(E1000_MDICNFG); | ||
| 855 | reg_val = mdicnfg & ~E1000_MDICNFG_EXT_MDIO; | ||
| 856 | wr32(E1000_MDICNFG, reg_val); | ||
| 857 | |||
| 858 | /* Get data from NVM, or set default */ | ||
| 859 | ret_val = igb_read_invm_word_i210(hw, E1000_INVM_AUTOLOAD, | ||
| 860 | &nvm_word); | ||
| 861 | if (ret_val) | ||
| 862 | nvm_word = E1000_INVM_DEFAULT_AL; | ||
| 863 | tmp_nvm = nvm_word | E1000_INVM_PLL_WO_VAL; | ||
| 864 | for (i = 0; i < E1000_MAX_PLL_TRIES; i++) { | ||
| 865 | /* check current state directly from internal PHY */ | ||
| 866 | igb_read_phy_reg_gs40g(hw, (E1000_PHY_PLL_FREQ_PAGE | | ||
| 867 | E1000_PHY_PLL_FREQ_REG), &phy_word); | ||
| 868 | if ((phy_word & E1000_PHY_PLL_UNCONF) | ||
| 869 | != E1000_PHY_PLL_UNCONF) { | ||
| 870 | ret_val = 0; | ||
| 871 | break; | ||
| 872 | } else { | ||
| 873 | ret_val = -E1000_ERR_PHY; | ||
| 874 | } | ||
| 875 | /* directly reset the internal PHY */ | ||
| 876 | ctrl = rd32(E1000_CTRL); | ||
| 877 | wr32(E1000_CTRL, ctrl|E1000_CTRL_PHY_RST); | ||
| 878 | |||
| 879 | ctrl_ext = rd32(E1000_CTRL_EXT); | ||
| 880 | ctrl_ext |= (E1000_CTRL_EXT_PHYPDEN | E1000_CTRL_EXT_SDLPE); | ||
| 881 | wr32(E1000_CTRL_EXT, ctrl_ext); | ||
| 882 | |||
| 883 | wr32(E1000_WUC, 0); | ||
| 884 | reg_val = (E1000_INVM_AUTOLOAD << 4) | (tmp_nvm << 16); | ||
| 885 | wr32(E1000_EEARBC_I210, reg_val); | ||
| 886 | |||
| 887 | igb_read_pci_cfg(hw, E1000_PCI_PMCSR, &pci_word); | ||
| 888 | pci_word |= E1000_PCI_PMCSR_D3; | ||
| 889 | igb_write_pci_cfg(hw, E1000_PCI_PMCSR, &pci_word); | ||
| 890 | usleep_range(1000, 2000); | ||
| 891 | pci_word &= ~E1000_PCI_PMCSR_D3; | ||
| 892 | igb_write_pci_cfg(hw, E1000_PCI_PMCSR, &pci_word); | ||
| 893 | reg_val = (E1000_INVM_AUTOLOAD << 4) | (nvm_word << 16); | ||
| 894 | wr32(E1000_EEARBC_I210, reg_val); | ||
| 895 | |||
| 896 | /* restore WUC register */ | ||
| 897 | wr32(E1000_WUC, wuc); | ||
| 898 | } | ||
| 899 | /* restore MDICNFG setting */ | ||
| 900 | wr32(E1000_MDICNFG, mdicnfg); | ||
| 901 | return ret_val; | ||
| 902 | } | ||
diff --git a/drivers/net/ethernet/intel/igb/e1000_i210.h b/drivers/net/ethernet/intel/igb/e1000_i210.h index 9f34976687ba..3442b6357d01 100644 --- a/drivers/net/ethernet/intel/igb/e1000_i210.h +++ b/drivers/net/ethernet/intel/igb/e1000_i210.h | |||
| @@ -33,6 +33,7 @@ s32 igb_read_xmdio_reg(struct e1000_hw *hw, u16 addr, u8 dev_addr, u16 *data); | |||
| 33 | s32 igb_write_xmdio_reg(struct e1000_hw *hw, u16 addr, u8 dev_addr, u16 data); | 33 | s32 igb_write_xmdio_reg(struct e1000_hw *hw, u16 addr, u8 dev_addr, u16 data); |
| 34 | s32 igb_init_nvm_params_i210(struct e1000_hw *hw); | 34 | s32 igb_init_nvm_params_i210(struct e1000_hw *hw); |
| 35 | bool igb_get_flash_presence_i210(struct e1000_hw *hw); | 35 | bool igb_get_flash_presence_i210(struct e1000_hw *hw); |
| 36 | s32 igb_pll_workaround_i210(struct e1000_hw *hw); | ||
| 36 | 37 | ||
| 37 | #define E1000_STM_OPCODE 0xDB00 | 38 | #define E1000_STM_OPCODE 0xDB00 |
| 38 | #define E1000_EEPROM_FLASH_SIZE_WORD 0x11 | 39 | #define E1000_EEPROM_FLASH_SIZE_WORD 0x11 |
| @@ -78,4 +79,15 @@ enum E1000_INVM_STRUCTURE_TYPE { | |||
| 78 | #define NVM_LED_1_CFG_DEFAULT_I211 0x0184 | 79 | #define NVM_LED_1_CFG_DEFAULT_I211 0x0184 |
| 79 | #define NVM_LED_0_2_CFG_DEFAULT_I211 0x200C | 80 | #define NVM_LED_0_2_CFG_DEFAULT_I211 0x200C |
| 80 | 81 | ||
| 82 | /* PLL Defines */ | ||
| 83 | #define E1000_PCI_PMCSR 0x44 | ||
| 84 | #define E1000_PCI_PMCSR_D3 0x03 | ||
| 85 | #define E1000_MAX_PLL_TRIES 5 | ||
| 86 | #define E1000_PHY_PLL_UNCONF 0xFF | ||
| 87 | #define E1000_PHY_PLL_FREQ_PAGE 0xFC0000 | ||
| 88 | #define E1000_PHY_PLL_FREQ_REG 0x000E | ||
| 89 | #define E1000_INVM_DEFAULT_AL 0x202F | ||
| 90 | #define E1000_INVM_AUTOLOAD 0x0A | ||
| 91 | #define E1000_INVM_PLL_WO_VAL 0x0010 | ||
| 92 | |||
| 81 | #endif | 93 | #endif |
diff --git a/drivers/net/ethernet/intel/igb/e1000_regs.h b/drivers/net/ethernet/intel/igb/e1000_regs.h index 1cc4b1a7e597..f5ba4e4eafb9 100644 --- a/drivers/net/ethernet/intel/igb/e1000_regs.h +++ b/drivers/net/ethernet/intel/igb/e1000_regs.h | |||
| @@ -66,6 +66,7 @@ | |||
| 66 | #define E1000_PBA 0x01000 /* Packet Buffer Allocation - RW */ | 66 | #define E1000_PBA 0x01000 /* Packet Buffer Allocation - RW */ |
| 67 | #define E1000_PBS 0x01008 /* Packet Buffer Size */ | 67 | #define E1000_PBS 0x01008 /* Packet Buffer Size */ |
| 68 | #define E1000_EEMNGCTL 0x01010 /* MNG EEprom Control */ | 68 | #define E1000_EEMNGCTL 0x01010 /* MNG EEprom Control */ |
| 69 | #define E1000_EEARBC_I210 0x12024 /* EEPROM Auto Read Bus Control */ | ||
| 69 | #define E1000_EEWR 0x0102C /* EEPROM Write Register - RW */ | 70 | #define E1000_EEWR 0x0102C /* EEPROM Write Register - RW */ |
| 70 | #define E1000_I2CCMD 0x01028 /* SFPI2C Command Register - RW */ | 71 | #define E1000_I2CCMD 0x01028 /* SFPI2C Command Register - RW */ |
| 71 | #define E1000_FRTIMER 0x01048 /* Free Running Timer - RW */ | 72 | #define E1000_FRTIMER 0x01048 /* Free Running Timer - RW */ |
diff --git a/drivers/net/ethernet/intel/igb/igb_main.c b/drivers/net/ethernet/intel/igb/igb_main.c index f145adbb55ac..a9537ba7a5a0 100644 --- a/drivers/net/ethernet/intel/igb/igb_main.c +++ b/drivers/net/ethernet/intel/igb/igb_main.c | |||
| @@ -7215,6 +7215,20 @@ static int igb_ioctl(struct net_device *netdev, struct ifreq *ifr, int cmd) | |||
| 7215 | } | 7215 | } |
| 7216 | } | 7216 | } |
| 7217 | 7217 | ||
| 7218 | void igb_read_pci_cfg(struct e1000_hw *hw, u32 reg, u16 *value) | ||
| 7219 | { | ||
| 7220 | struct igb_adapter *adapter = hw->back; | ||
| 7221 | |||
| 7222 | pci_read_config_word(adapter->pdev, reg, value); | ||
| 7223 | } | ||
| 7224 | |||
| 7225 | void igb_write_pci_cfg(struct e1000_hw *hw, u32 reg, u16 *value) | ||
| 7226 | { | ||
| 7227 | struct igb_adapter *adapter = hw->back; | ||
| 7228 | |||
| 7229 | pci_write_config_word(adapter->pdev, reg, *value); | ||
| 7230 | } | ||
| 7231 | |||
| 7218 | s32 igb_read_pcie_cap_reg(struct e1000_hw *hw, u32 reg, u16 *value) | 7232 | s32 igb_read_pcie_cap_reg(struct e1000_hw *hw, u32 reg, u16 *value) |
| 7219 | { | 7233 | { |
| 7220 | struct igb_adapter *adapter = hw->back; | 7234 | struct igb_adapter *adapter = hw->back; |
| @@ -7578,6 +7592,8 @@ static int igb_sriov_reinit(struct pci_dev *dev) | |||
| 7578 | 7592 | ||
| 7579 | if (netif_running(netdev)) | 7593 | if (netif_running(netdev)) |
| 7580 | igb_close(netdev); | 7594 | igb_close(netdev); |
| 7595 | else | ||
| 7596 | igb_reset(adapter); | ||
| 7581 | 7597 | ||
| 7582 | igb_clear_interrupt_scheme(adapter); | 7598 | igb_clear_interrupt_scheme(adapter); |
| 7583 | 7599 | ||
diff --git a/drivers/net/ethernet/marvell/mvneta.c b/drivers/net/ethernet/marvell/mvneta.c index 45beca17fa50..dadd9a5f6323 100644 --- a/drivers/net/ethernet/marvell/mvneta.c +++ b/drivers/net/ethernet/marvell/mvneta.c | |||
| @@ -1207,7 +1207,7 @@ static u32 mvneta_txq_desc_csum(int l3_offs, int l3_proto, | |||
| 1207 | command = l3_offs << MVNETA_TX_L3_OFF_SHIFT; | 1207 | command = l3_offs << MVNETA_TX_L3_OFF_SHIFT; |
| 1208 | command |= ip_hdr_len << MVNETA_TX_IP_HLEN_SHIFT; | 1208 | command |= ip_hdr_len << MVNETA_TX_IP_HLEN_SHIFT; |
| 1209 | 1209 | ||
| 1210 | if (l3_proto == swab16(ETH_P_IP)) | 1210 | if (l3_proto == htons(ETH_P_IP)) |
| 1211 | command |= MVNETA_TXD_IP_CSUM; | 1211 | command |= MVNETA_TXD_IP_CSUM; |
| 1212 | else | 1212 | else |
| 1213 | command |= MVNETA_TX_L3_IP6; | 1213 | command |= MVNETA_TX_L3_IP6; |
| @@ -2529,7 +2529,7 @@ static void mvneta_adjust_link(struct net_device *ndev) | |||
| 2529 | 2529 | ||
| 2530 | if (phydev->speed == SPEED_1000) | 2530 | if (phydev->speed == SPEED_1000) |
| 2531 | val |= MVNETA_GMAC_CONFIG_GMII_SPEED; | 2531 | val |= MVNETA_GMAC_CONFIG_GMII_SPEED; |
| 2532 | else | 2532 | else if (phydev->speed == SPEED_100) |
| 2533 | val |= MVNETA_GMAC_CONFIG_MII_SPEED; | 2533 | val |= MVNETA_GMAC_CONFIG_MII_SPEED; |
| 2534 | 2534 | ||
| 2535 | mvreg_write(pp, MVNETA_GMAC_AUTONEG_CONFIG, val); | 2535 | mvreg_write(pp, MVNETA_GMAC_AUTONEG_CONFIG, val); |
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/cq.c b/drivers/net/ethernet/mellanox/mlx4/cq.c index 80f725228f5b..56022d647837 100644 --- a/drivers/net/ethernet/mellanox/mlx4/cq.c +++ b/drivers/net/ethernet/mellanox/mlx4/cq.c | |||
| @@ -294,8 +294,6 @@ int mlx4_cq_alloc(struct mlx4_dev *dev, int nent, | |||
| 294 | init_completion(&cq->free); | 294 | init_completion(&cq->free); |
| 295 | 295 | ||
| 296 | cq->irq = priv->eq_table.eq[cq->vector].irq; | 296 | cq->irq = priv->eq_table.eq[cq->vector].irq; |
| 297 | cq->irq_affinity_change = false; | ||
| 298 | |||
| 299 | return 0; | 297 | return 0; |
| 300 | 298 | ||
| 301 | err_radix: | 299 | err_radix: |
diff --git a/drivers/net/ethernet/mellanox/mlx4/en_cq.c b/drivers/net/ethernet/mellanox/mlx4/en_cq.c index 4b2130760eed..82322b1c8411 100644 --- a/drivers/net/ethernet/mellanox/mlx4/en_cq.c +++ b/drivers/net/ethernet/mellanox/mlx4/en_cq.c | |||
| @@ -128,11 +128,16 @@ int mlx4_en_activate_cq(struct mlx4_en_priv *priv, struct mlx4_en_cq *cq, | |||
| 128 | mlx4_warn(mdev, "Failed assigning an EQ to %s, falling back to legacy EQ's\n", | 128 | mlx4_warn(mdev, "Failed assigning an EQ to %s, falling back to legacy EQ's\n", |
| 129 | name); | 129 | name); |
| 130 | } | 130 | } |
| 131 | |||
| 131 | } | 132 | } |
| 132 | } else { | 133 | } else { |
| 133 | cq->vector = (cq->ring + 1 + priv->port) % | 134 | cq->vector = (cq->ring + 1 + priv->port) % |
| 134 | mdev->dev->caps.num_comp_vectors; | 135 | mdev->dev->caps.num_comp_vectors; |
| 135 | } | 136 | } |
| 137 | |||
| 138 | cq->irq_desc = | ||
| 139 | irq_to_desc(mlx4_eq_get_irq(mdev->dev, | ||
| 140 | cq->vector)); | ||
| 136 | } else { | 141 | } else { |
| 137 | /* For TX we use the same irq per | 142 | /* For TX we use the same irq per |
| 138 | ring we assigned for the RX */ | 143 | ring we assigned for the RX */ |
| @@ -187,8 +192,6 @@ void mlx4_en_destroy_cq(struct mlx4_en_priv *priv, struct mlx4_en_cq **pcq) | |||
| 187 | mlx4_en_unmap_buffer(&cq->wqres.buf); | 192 | mlx4_en_unmap_buffer(&cq->wqres.buf); |
| 188 | mlx4_free_hwq_res(mdev->dev, &cq->wqres, cq->buf_size); | 193 | mlx4_free_hwq_res(mdev->dev, &cq->wqres, cq->buf_size); |
| 189 | if (priv->mdev->dev->caps.comp_pool && cq->vector) { | 194 | if (priv->mdev->dev->caps.comp_pool && cq->vector) { |
| 190 | if (!cq->is_tx) | ||
| 191 | irq_set_affinity_hint(cq->mcq.irq, NULL); | ||
| 192 | mlx4_release_eq(priv->mdev->dev, cq->vector); | 195 | mlx4_release_eq(priv->mdev->dev, cq->vector); |
| 193 | } | 196 | } |
| 194 | cq->vector = 0; | 197 | cq->vector = 0; |
| @@ -204,6 +207,7 @@ void mlx4_en_deactivate_cq(struct mlx4_en_priv *priv, struct mlx4_en_cq *cq) | |||
| 204 | if (!cq->is_tx) { | 207 | if (!cq->is_tx) { |
| 205 | napi_hash_del(&cq->napi); | 208 | napi_hash_del(&cq->napi); |
| 206 | synchronize_rcu(); | 209 | synchronize_rcu(); |
| 210 | irq_set_affinity_hint(cq->mcq.irq, NULL); | ||
| 207 | } | 211 | } |
| 208 | netif_napi_del(&cq->napi); | 212 | netif_napi_del(&cq->napi); |
| 209 | 213 | ||
diff --git a/drivers/net/ethernet/mellanox/mlx4/en_ethtool.c b/drivers/net/ethernet/mellanox/mlx4/en_ethtool.c index fa1a069e14e6..68d763d2d030 100644 --- a/drivers/net/ethernet/mellanox/mlx4/en_ethtool.c +++ b/drivers/net/ethernet/mellanox/mlx4/en_ethtool.c | |||
| @@ -417,6 +417,8 @@ static int mlx4_en_get_coalesce(struct net_device *dev, | |||
| 417 | 417 | ||
| 418 | coal->tx_coalesce_usecs = priv->tx_usecs; | 418 | coal->tx_coalesce_usecs = priv->tx_usecs; |
| 419 | coal->tx_max_coalesced_frames = priv->tx_frames; | 419 | coal->tx_max_coalesced_frames = priv->tx_frames; |
| 420 | coal->tx_max_coalesced_frames_irq = priv->tx_work_limit; | ||
| 421 | |||
| 420 | coal->rx_coalesce_usecs = priv->rx_usecs; | 422 | coal->rx_coalesce_usecs = priv->rx_usecs; |
| 421 | coal->rx_max_coalesced_frames = priv->rx_frames; | 423 | coal->rx_max_coalesced_frames = priv->rx_frames; |
| 422 | 424 | ||
| @@ -426,6 +428,7 @@ static int mlx4_en_get_coalesce(struct net_device *dev, | |||
| 426 | coal->rx_coalesce_usecs_high = priv->rx_usecs_high; | 428 | coal->rx_coalesce_usecs_high = priv->rx_usecs_high; |
| 427 | coal->rate_sample_interval = priv->sample_interval; | 429 | coal->rate_sample_interval = priv->sample_interval; |
| 428 | coal->use_adaptive_rx_coalesce = priv->adaptive_rx_coal; | 430 | coal->use_adaptive_rx_coalesce = priv->adaptive_rx_coal; |
| 431 | |||
| 429 | return 0; | 432 | return 0; |
| 430 | } | 433 | } |
| 431 | 434 | ||
| @@ -434,6 +437,9 @@ static int mlx4_en_set_coalesce(struct net_device *dev, | |||
| 434 | { | 437 | { |
| 435 | struct mlx4_en_priv *priv = netdev_priv(dev); | 438 | struct mlx4_en_priv *priv = netdev_priv(dev); |
| 436 | 439 | ||
| 440 | if (!coal->tx_max_coalesced_frames_irq) | ||
| 441 | return -EINVAL; | ||
| 442 | |||
| 437 | priv->rx_frames = (coal->rx_max_coalesced_frames == | 443 | priv->rx_frames = (coal->rx_max_coalesced_frames == |
| 438 | MLX4_EN_AUTO_CONF) ? | 444 | MLX4_EN_AUTO_CONF) ? |
| 439 | MLX4_EN_RX_COAL_TARGET : | 445 | MLX4_EN_RX_COAL_TARGET : |
| @@ -457,6 +463,7 @@ static int mlx4_en_set_coalesce(struct net_device *dev, | |||
| 457 | priv->rx_usecs_high = coal->rx_coalesce_usecs_high; | 463 | priv->rx_usecs_high = coal->rx_coalesce_usecs_high; |
| 458 | priv->sample_interval = coal->rate_sample_interval; | 464 | priv->sample_interval = coal->rate_sample_interval; |
| 459 | priv->adaptive_rx_coal = coal->use_adaptive_rx_coalesce; | 465 | priv->adaptive_rx_coal = coal->use_adaptive_rx_coalesce; |
| 466 | priv->tx_work_limit = coal->tx_max_coalesced_frames_irq; | ||
| 460 | 467 | ||
| 461 | return mlx4_en_moderation_update(priv); | 468 | return mlx4_en_moderation_update(priv); |
| 462 | } | 469 | } |
diff --git a/drivers/net/ethernet/mellanox/mlx4/en_netdev.c b/drivers/net/ethernet/mellanox/mlx4/en_netdev.c index 7d4fb7bf2593..7345c43b019e 100644 --- a/drivers/net/ethernet/mellanox/mlx4/en_netdev.c +++ b/drivers/net/ethernet/mellanox/mlx4/en_netdev.c | |||
| @@ -2336,7 +2336,7 @@ static void mlx4_en_add_vxlan_port(struct net_device *dev, | |||
| 2336 | struct mlx4_en_priv *priv = netdev_priv(dev); | 2336 | struct mlx4_en_priv *priv = netdev_priv(dev); |
| 2337 | __be16 current_port; | 2337 | __be16 current_port; |
| 2338 | 2338 | ||
| 2339 | if (!(priv->mdev->dev->caps.flags2 & MLX4_DEV_CAP_FLAG2_VXLAN_OFFLOADS)) | 2339 | if (priv->mdev->dev->caps.tunnel_offload_mode != MLX4_TUNNEL_OFFLOAD_MODE_VXLAN) |
| 2340 | return; | 2340 | return; |
| 2341 | 2341 | ||
| 2342 | if (sa_family == AF_INET6) | 2342 | if (sa_family == AF_INET6) |
| @@ -2473,6 +2473,7 @@ int mlx4_en_init_netdev(struct mlx4_en_dev *mdev, int port, | |||
| 2473 | MLX4_WQE_CTRL_SOLICITED); | 2473 | MLX4_WQE_CTRL_SOLICITED); |
| 2474 | priv->num_tx_rings_p_up = mdev->profile.num_tx_rings_p_up; | 2474 | priv->num_tx_rings_p_up = mdev->profile.num_tx_rings_p_up; |
| 2475 | priv->tx_ring_num = prof->tx_ring_num; | 2475 | priv->tx_ring_num = prof->tx_ring_num; |
| 2476 | priv->tx_work_limit = MLX4_EN_DEFAULT_TX_WORK; | ||
| 2476 | 2477 | ||
| 2477 | priv->tx_ring = kzalloc(sizeof(struct mlx4_en_tx_ring *) * MAX_TX_RINGS, | 2478 | priv->tx_ring = kzalloc(sizeof(struct mlx4_en_tx_ring *) * MAX_TX_RINGS, |
| 2478 | GFP_KERNEL); | 2479 | GFP_KERNEL); |
diff --git a/drivers/net/ethernet/mellanox/mlx4/en_rx.c b/drivers/net/ethernet/mellanox/mlx4/en_rx.c index d2d415732d99..5535862f27cc 100644 --- a/drivers/net/ethernet/mellanox/mlx4/en_rx.c +++ b/drivers/net/ethernet/mellanox/mlx4/en_rx.c | |||
| @@ -40,6 +40,7 @@ | |||
| 40 | #include <linux/if_ether.h> | 40 | #include <linux/if_ether.h> |
| 41 | #include <linux/if_vlan.h> | 41 | #include <linux/if_vlan.h> |
| 42 | #include <linux/vmalloc.h> | 42 | #include <linux/vmalloc.h> |
| 43 | #include <linux/irq.h> | ||
| 43 | 44 | ||
| 44 | #include "mlx4_en.h" | 45 | #include "mlx4_en.h" |
| 45 | 46 | ||
| @@ -782,6 +783,7 @@ int mlx4_en_process_rx_cq(struct net_device *dev, struct mlx4_en_cq *cq, int bud | |||
| 782 | PKT_HASH_TYPE_L3); | 783 | PKT_HASH_TYPE_L3); |
| 783 | 784 | ||
| 784 | skb_record_rx_queue(gro_skb, cq->ring); | 785 | skb_record_rx_queue(gro_skb, cq->ring); |
| 786 | skb_mark_napi_id(gro_skb, &cq->napi); | ||
| 785 | 787 | ||
| 786 | if (ring->hwtstamp_rx_filter == HWTSTAMP_FILTER_ALL) { | 788 | if (ring->hwtstamp_rx_filter == HWTSTAMP_FILTER_ALL) { |
| 787 | timestamp = mlx4_en_get_cqe_ts(cqe); | 789 | timestamp = mlx4_en_get_cqe_ts(cqe); |
| @@ -896,16 +898,25 @@ int mlx4_en_poll_rx_cq(struct napi_struct *napi, int budget) | |||
| 896 | 898 | ||
| 897 | /* If we used up all the quota - we're probably not done yet... */ | 899 | /* If we used up all the quota - we're probably not done yet... */ |
| 898 | if (done == budget) { | 900 | if (done == budget) { |
| 901 | int cpu_curr; | ||
| 902 | const struct cpumask *aff; | ||
| 903 | |||
| 899 | INC_PERF_COUNTER(priv->pstats.napi_quota); | 904 | INC_PERF_COUNTER(priv->pstats.napi_quota); |
| 900 | if (unlikely(cq->mcq.irq_affinity_change)) { | 905 | |
| 901 | cq->mcq.irq_affinity_change = false; | 906 | cpu_curr = smp_processor_id(); |
| 907 | aff = irq_desc_get_irq_data(cq->irq_desc)->affinity; | ||
| 908 | |||
| 909 | if (unlikely(!cpumask_test_cpu(cpu_curr, aff))) { | ||
| 910 | /* Current cpu is not according to smp_irq_affinity - | ||
| 911 | * probably affinity changed. need to stop this NAPI | ||
| 912 | * poll, and restart it on the right CPU | ||
| 913 | */ | ||
| 902 | napi_complete(napi); | 914 | napi_complete(napi); |
| 903 | mlx4_en_arm_cq(priv, cq); | 915 | mlx4_en_arm_cq(priv, cq); |
| 904 | return 0; | 916 | return 0; |
| 905 | } | 917 | } |
| 906 | } else { | 918 | } else { |
| 907 | /* Done for now */ | 919 | /* Done for now */ |
| 908 | cq->mcq.irq_affinity_change = false; | ||
| 909 | napi_complete(napi); | 920 | napi_complete(napi); |
| 910 | mlx4_en_arm_cq(priv, cq); | 921 | mlx4_en_arm_cq(priv, cq); |
| 911 | } | 922 | } |
diff --git a/drivers/net/ethernet/mellanox/mlx4/en_tx.c b/drivers/net/ethernet/mellanox/mlx4/en_tx.c index 8be7483f8236..5045bab59633 100644 --- a/drivers/net/ethernet/mellanox/mlx4/en_tx.c +++ b/drivers/net/ethernet/mellanox/mlx4/en_tx.c | |||
| @@ -351,9 +351,8 @@ int mlx4_en_free_tx_buf(struct net_device *dev, struct mlx4_en_tx_ring *ring) | |||
| 351 | return cnt; | 351 | return cnt; |
| 352 | } | 352 | } |
| 353 | 353 | ||
| 354 | static int mlx4_en_process_tx_cq(struct net_device *dev, | 354 | static bool mlx4_en_process_tx_cq(struct net_device *dev, |
| 355 | struct mlx4_en_cq *cq, | 355 | struct mlx4_en_cq *cq) |
| 356 | int budget) | ||
| 357 | { | 356 | { |
| 358 | struct mlx4_en_priv *priv = netdev_priv(dev); | 357 | struct mlx4_en_priv *priv = netdev_priv(dev); |
| 359 | struct mlx4_cq *mcq = &cq->mcq; | 358 | struct mlx4_cq *mcq = &cq->mcq; |
| @@ -372,9 +371,10 @@ static int mlx4_en_process_tx_cq(struct net_device *dev, | |||
| 372 | int factor = priv->cqe_factor; | 371 | int factor = priv->cqe_factor; |
| 373 | u64 timestamp = 0; | 372 | u64 timestamp = 0; |
| 374 | int done = 0; | 373 | int done = 0; |
| 374 | int budget = priv->tx_work_limit; | ||
| 375 | 375 | ||
| 376 | if (!priv->port_up) | 376 | if (!priv->port_up) |
| 377 | return 0; | 377 | return true; |
| 378 | 378 | ||
| 379 | index = cons_index & size_mask; | 379 | index = cons_index & size_mask; |
| 380 | cqe = &buf[(index << factor) + factor]; | 380 | cqe = &buf[(index << factor) + factor]; |
| @@ -447,7 +447,7 @@ static int mlx4_en_process_tx_cq(struct net_device *dev, | |||
| 447 | netif_tx_wake_queue(ring->tx_queue); | 447 | netif_tx_wake_queue(ring->tx_queue); |
| 448 | ring->wake_queue++; | 448 | ring->wake_queue++; |
| 449 | } | 449 | } |
| 450 | return done; | 450 | return done < budget; |
| 451 | } | 451 | } |
| 452 | 452 | ||
| 453 | void mlx4_en_tx_irq(struct mlx4_cq *mcq) | 453 | void mlx4_en_tx_irq(struct mlx4_cq *mcq) |
| @@ -467,24 +467,16 @@ int mlx4_en_poll_tx_cq(struct napi_struct *napi, int budget) | |||
| 467 | struct mlx4_en_cq *cq = container_of(napi, struct mlx4_en_cq, napi); | 467 | struct mlx4_en_cq *cq = container_of(napi, struct mlx4_en_cq, napi); |
| 468 | struct net_device *dev = cq->dev; | 468 | struct net_device *dev = cq->dev; |
| 469 | struct mlx4_en_priv *priv = netdev_priv(dev); | 469 | struct mlx4_en_priv *priv = netdev_priv(dev); |
| 470 | int done; | 470 | int clean_complete; |
| 471 | 471 | ||
| 472 | done = mlx4_en_process_tx_cq(dev, cq, budget); | 472 | clean_complete = mlx4_en_process_tx_cq(dev, cq); |
| 473 | if (!clean_complete) | ||
| 474 | return budget; | ||
| 473 | 475 | ||
| 474 | /* If we used up all the quota - we're probably not done yet... */ | 476 | napi_complete(napi); |
| 475 | if (done < budget) { | 477 | mlx4_en_arm_cq(priv, cq); |
| 476 | /* Done for now */ | 478 | |
| 477 | cq->mcq.irq_affinity_change = false; | 479 | return 0; |
| 478 | napi_complete(napi); | ||
| 479 | mlx4_en_arm_cq(priv, cq); | ||
| 480 | return done; | ||
| 481 | } else if (unlikely(cq->mcq.irq_affinity_change)) { | ||
| 482 | cq->mcq.irq_affinity_change = false; | ||
| 483 | napi_complete(napi); | ||
| 484 | mlx4_en_arm_cq(priv, cq); | ||
| 485 | return 0; | ||
| 486 | } | ||
| 487 | return budget; | ||
| 488 | } | 480 | } |
| 489 | 481 | ||
| 490 | static struct mlx4_en_tx_desc *mlx4_en_bounce_to_desc(struct mlx4_en_priv *priv, | 482 | static struct mlx4_en_tx_desc *mlx4_en_bounce_to_desc(struct mlx4_en_priv *priv, |
diff --git a/drivers/net/ethernet/mellanox/mlx4/eq.c b/drivers/net/ethernet/mellanox/mlx4/eq.c index d954ec1eac17..2a004b347e1d 100644 --- a/drivers/net/ethernet/mellanox/mlx4/eq.c +++ b/drivers/net/ethernet/mellanox/mlx4/eq.c | |||
| @@ -53,11 +53,6 @@ enum { | |||
| 53 | MLX4_EQ_ENTRY_SIZE = 0x20 | 53 | MLX4_EQ_ENTRY_SIZE = 0x20 |
| 54 | }; | 54 | }; |
| 55 | 55 | ||
| 56 | struct mlx4_irq_notify { | ||
| 57 | void *arg; | ||
| 58 | struct irq_affinity_notify notify; | ||
| 59 | }; | ||
| 60 | |||
| 61 | #define MLX4_EQ_STATUS_OK ( 0 << 28) | 56 | #define MLX4_EQ_STATUS_OK ( 0 << 28) |
| 62 | #define MLX4_EQ_STATUS_WRITE_FAIL (10 << 28) | 57 | #define MLX4_EQ_STATUS_WRITE_FAIL (10 << 28) |
| 63 | #define MLX4_EQ_OWNER_SW ( 0 << 24) | 58 | #define MLX4_EQ_OWNER_SW ( 0 << 24) |
| @@ -1088,57 +1083,6 @@ static void mlx4_unmap_clr_int(struct mlx4_dev *dev) | |||
| 1088 | iounmap(priv->clr_base); | 1083 | iounmap(priv->clr_base); |
| 1089 | } | 1084 | } |
| 1090 | 1085 | ||
| 1091 | static void mlx4_irq_notifier_notify(struct irq_affinity_notify *notify, | ||
| 1092 | const cpumask_t *mask) | ||
| 1093 | { | ||
| 1094 | struct mlx4_irq_notify *n = container_of(notify, | ||
| 1095 | struct mlx4_irq_notify, | ||
| 1096 | notify); | ||
| 1097 | struct mlx4_priv *priv = (struct mlx4_priv *)n->arg; | ||
| 1098 | struct radix_tree_iter iter; | ||
| 1099 | void **slot; | ||
| 1100 | |||
| 1101 | radix_tree_for_each_slot(slot, &priv->cq_table.tree, &iter, 0) { | ||
| 1102 | struct mlx4_cq *cq = (struct mlx4_cq *)(*slot); | ||
| 1103 | |||
| 1104 | if (cq->irq == notify->irq) | ||
| 1105 | cq->irq_affinity_change = true; | ||
| 1106 | } | ||
| 1107 | } | ||
| 1108 | |||
| 1109 | static void mlx4_release_irq_notifier(struct kref *ref) | ||
| 1110 | { | ||
| 1111 | struct mlx4_irq_notify *n = container_of(ref, struct mlx4_irq_notify, | ||
| 1112 | notify.kref); | ||
| 1113 | kfree(n); | ||
| 1114 | } | ||
| 1115 | |||
| 1116 | static void mlx4_assign_irq_notifier(struct mlx4_priv *priv, | ||
| 1117 | struct mlx4_dev *dev, int irq) | ||
| 1118 | { | ||
| 1119 | struct mlx4_irq_notify *irq_notifier = NULL; | ||
| 1120 | int err = 0; | ||
| 1121 | |||
| 1122 | irq_notifier = kzalloc(sizeof(*irq_notifier), GFP_KERNEL); | ||
| 1123 | if (!irq_notifier) { | ||
| 1124 | mlx4_warn(dev, "Failed to allocate irq notifier. irq %d\n", | ||
| 1125 | irq); | ||
| 1126 | return; | ||
| 1127 | } | ||
| 1128 | |||
| 1129 | irq_notifier->notify.irq = irq; | ||
| 1130 | irq_notifier->notify.notify = mlx4_irq_notifier_notify; | ||
| 1131 | irq_notifier->notify.release = mlx4_release_irq_notifier; | ||
| 1132 | irq_notifier->arg = priv; | ||
| 1133 | err = irq_set_affinity_notifier(irq, &irq_notifier->notify); | ||
| 1134 | if (err) { | ||
| 1135 | kfree(irq_notifier); | ||
| 1136 | irq_notifier = NULL; | ||
| 1137 | mlx4_warn(dev, "Failed to set irq notifier. irq %d\n", irq); | ||
| 1138 | } | ||
| 1139 | } | ||
| 1140 | |||
| 1141 | |||
| 1142 | int mlx4_alloc_eq_table(struct mlx4_dev *dev) | 1086 | int mlx4_alloc_eq_table(struct mlx4_dev *dev) |
| 1143 | { | 1087 | { |
| 1144 | struct mlx4_priv *priv = mlx4_priv(dev); | 1088 | struct mlx4_priv *priv = mlx4_priv(dev); |
| @@ -1409,8 +1353,6 @@ int mlx4_assign_eq(struct mlx4_dev *dev, char *name, struct cpu_rmap *rmap, | |||
| 1409 | continue; | 1353 | continue; |
| 1410 | /*we dont want to break here*/ | 1354 | /*we dont want to break here*/ |
| 1411 | } | 1355 | } |
| 1412 | mlx4_assign_irq_notifier(priv, dev, | ||
| 1413 | priv->eq_table.eq[vec].irq); | ||
| 1414 | 1356 | ||
| 1415 | eq_set_ci(&priv->eq_table.eq[vec], 1); | 1357 | eq_set_ci(&priv->eq_table.eq[vec], 1); |
| 1416 | } | 1358 | } |
| @@ -1427,6 +1369,14 @@ int mlx4_assign_eq(struct mlx4_dev *dev, char *name, struct cpu_rmap *rmap, | |||
| 1427 | } | 1369 | } |
| 1428 | EXPORT_SYMBOL(mlx4_assign_eq); | 1370 | EXPORT_SYMBOL(mlx4_assign_eq); |
| 1429 | 1371 | ||
| 1372 | int mlx4_eq_get_irq(struct mlx4_dev *dev, int vec) | ||
| 1373 | { | ||
| 1374 | struct mlx4_priv *priv = mlx4_priv(dev); | ||
| 1375 | |||
| 1376 | return priv->eq_table.eq[vec].irq; | ||
| 1377 | } | ||
| 1378 | EXPORT_SYMBOL(mlx4_eq_get_irq); | ||
| 1379 | |||
| 1430 | void mlx4_release_eq(struct mlx4_dev *dev, int vec) | 1380 | void mlx4_release_eq(struct mlx4_dev *dev, int vec) |
| 1431 | { | 1381 | { |
| 1432 | struct mlx4_priv *priv = mlx4_priv(dev); | 1382 | struct mlx4_priv *priv = mlx4_priv(dev); |
| @@ -1438,9 +1388,6 @@ void mlx4_release_eq(struct mlx4_dev *dev, int vec) | |||
| 1438 | Belonging to a legacy EQ*/ | 1388 | Belonging to a legacy EQ*/ |
| 1439 | mutex_lock(&priv->msix_ctl.pool_lock); | 1389 | mutex_lock(&priv->msix_ctl.pool_lock); |
| 1440 | if (priv->msix_ctl.pool_bm & 1ULL << i) { | 1390 | if (priv->msix_ctl.pool_bm & 1ULL << i) { |
| 1441 | irq_set_affinity_notifier( | ||
| 1442 | priv->eq_table.eq[vec].irq, | ||
| 1443 | NULL); | ||
| 1444 | free_irq(priv->eq_table.eq[vec].irq, | 1391 | free_irq(priv->eq_table.eq[vec].irq, |
| 1445 | &priv->eq_table.eq[vec]); | 1392 | &priv->eq_table.eq[vec]); |
| 1446 | priv->msix_ctl.pool_bm &= ~(1ULL << i); | 1393 | priv->msix_ctl.pool_bm &= ~(1ULL << i); |
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/mellanox/mlx4/mlx4_en.h b/drivers/net/ethernet/mellanox/mlx4/mlx4_en.h index 0e15295bedd6..d72a5a894fc6 100644 --- a/drivers/net/ethernet/mellanox/mlx4/mlx4_en.h +++ b/drivers/net/ethernet/mellanox/mlx4/mlx4_en.h | |||
| @@ -126,6 +126,8 @@ enum { | |||
| 126 | #define MAX_TX_RINGS (MLX4_EN_MAX_TX_RING_P_UP * \ | 126 | #define MAX_TX_RINGS (MLX4_EN_MAX_TX_RING_P_UP * \ |
| 127 | MLX4_EN_NUM_UP) | 127 | MLX4_EN_NUM_UP) |
| 128 | 128 | ||
| 129 | #define MLX4_EN_DEFAULT_TX_WORK 256 | ||
| 130 | |||
| 129 | /* Target number of packets to coalesce with interrupt moderation */ | 131 | /* Target number of packets to coalesce with interrupt moderation */ |
| 130 | #define MLX4_EN_RX_COAL_TARGET 44 | 132 | #define MLX4_EN_RX_COAL_TARGET 44 |
| 131 | #define MLX4_EN_RX_COAL_TIME 0x10 | 133 | #define MLX4_EN_RX_COAL_TIME 0x10 |
| @@ -343,6 +345,7 @@ struct mlx4_en_cq { | |||
| 343 | #define CQ_USER_PEND (MLX4_EN_CQ_STATE_POLL | MLX4_EN_CQ_STATE_POLL_YIELD) | 345 | #define CQ_USER_PEND (MLX4_EN_CQ_STATE_POLL | MLX4_EN_CQ_STATE_POLL_YIELD) |
| 344 | spinlock_t poll_lock; /* protects from LLS/napi conflicts */ | 346 | spinlock_t poll_lock; /* protects from LLS/napi conflicts */ |
| 345 | #endif /* CONFIG_NET_RX_BUSY_POLL */ | 347 | #endif /* CONFIG_NET_RX_BUSY_POLL */ |
| 348 | struct irq_desc *irq_desc; | ||
| 346 | }; | 349 | }; |
| 347 | 350 | ||
| 348 | struct mlx4_en_port_profile { | 351 | struct mlx4_en_port_profile { |
| @@ -542,6 +545,7 @@ struct mlx4_en_priv { | |||
| 542 | __be32 ctrl_flags; | 545 | __be32 ctrl_flags; |
| 543 | u32 flags; | 546 | u32 flags; |
| 544 | u8 num_tx_rings_p_up; | 547 | u8 num_tx_rings_p_up; |
| 548 | u32 tx_work_limit; | ||
| 545 | u32 tx_ring_num; | 549 | u32 tx_ring_num; |
| 546 | u32 rx_ring_num; | 550 | u32 rx_ring_num; |
| 547 | u32 rx_skb_size; | 551 | u32 rx_skb_size; |
diff --git a/drivers/net/ethernet/mellanox/mlx5/core/mr.c b/drivers/net/ethernet/mellanox/mlx5/core/mr.c index ba0401d4af50..184c3615f479 100644 --- a/drivers/net/ethernet/mellanox/mlx5/core/mr.c +++ b/drivers/net/ethernet/mellanox/mlx5/core/mr.c | |||
| @@ -94,6 +94,11 @@ int mlx5_core_create_mkey(struct mlx5_core_dev *dev, struct mlx5_core_mr *mr, | |||
| 94 | write_lock_irq(&table->lock); | 94 | write_lock_irq(&table->lock); |
| 95 | err = radix_tree_insert(&table->tree, mlx5_base_mkey(mr->key), mr); | 95 | err = radix_tree_insert(&table->tree, mlx5_base_mkey(mr->key), mr); |
| 96 | write_unlock_irq(&table->lock); | 96 | write_unlock_irq(&table->lock); |
| 97 | if (err) { | ||
| 98 | mlx5_core_warn(dev, "failed radix tree insert of mr 0x%x, %d\n", | ||
| 99 | mlx5_base_mkey(mr->key), err); | ||
| 100 | mlx5_core_destroy_mkey(dev, mr); | ||
| 101 | } | ||
| 97 | 102 | ||
| 98 | return err; | 103 | return err; |
| 99 | } | 104 | } |
| @@ -104,12 +109,22 @@ int mlx5_core_destroy_mkey(struct mlx5_core_dev *dev, struct mlx5_core_mr *mr) | |||
| 104 | struct mlx5_mr_table *table = &dev->priv.mr_table; | 109 | struct mlx5_mr_table *table = &dev->priv.mr_table; |
| 105 | struct mlx5_destroy_mkey_mbox_in in; | 110 | struct mlx5_destroy_mkey_mbox_in in; |
| 106 | struct mlx5_destroy_mkey_mbox_out out; | 111 | struct mlx5_destroy_mkey_mbox_out out; |
| 112 | struct mlx5_core_mr *deleted_mr; | ||
| 107 | unsigned long flags; | 113 | unsigned long flags; |
| 108 | int err; | 114 | int err; |
| 109 | 115 | ||
| 110 | memset(&in, 0, sizeof(in)); | 116 | memset(&in, 0, sizeof(in)); |
| 111 | memset(&out, 0, sizeof(out)); | 117 | memset(&out, 0, sizeof(out)); |
| 112 | 118 | ||
| 119 | write_lock_irqsave(&table->lock, flags); | ||
| 120 | deleted_mr = radix_tree_delete(&table->tree, mlx5_base_mkey(mr->key)); | ||
| 121 | write_unlock_irqrestore(&table->lock, flags); | ||
| 122 | if (!deleted_mr) { | ||
| 123 | mlx5_core_warn(dev, "failed radix tree delete of mr 0x%x\n", | ||
| 124 | mlx5_base_mkey(mr->key)); | ||
| 125 | return -ENOENT; | ||
| 126 | } | ||
| 127 | |||
| 113 | in.hdr.opcode = cpu_to_be16(MLX5_CMD_OP_DESTROY_MKEY); | 128 | in.hdr.opcode = cpu_to_be16(MLX5_CMD_OP_DESTROY_MKEY); |
| 114 | in.mkey = cpu_to_be32(mlx5_mkey_to_idx(mr->key)); | 129 | in.mkey = cpu_to_be32(mlx5_mkey_to_idx(mr->key)); |
| 115 | err = mlx5_cmd_exec(dev, &in, sizeof(in), &out, sizeof(out)); | 130 | err = mlx5_cmd_exec(dev, &in, sizeof(in), &out, sizeof(out)); |
| @@ -119,10 +134,6 @@ int mlx5_core_destroy_mkey(struct mlx5_core_dev *dev, struct mlx5_core_mr *mr) | |||
| 119 | if (out.hdr.status) | 134 | if (out.hdr.status) |
| 120 | return mlx5_cmd_status_to_err(&out.hdr); | 135 | return mlx5_cmd_status_to_err(&out.hdr); |
| 121 | 136 | ||
| 122 | write_lock_irqsave(&table->lock, flags); | ||
| 123 | radix_tree_delete(&table->tree, mlx5_base_mkey(mr->key)); | ||
| 124 | write_unlock_irqrestore(&table->lock, flags); | ||
| 125 | |||
| 126 | return err; | 137 | return err; |
| 127 | } | 138 | } |
| 128 | EXPORT_SYMBOL(mlx5_core_destroy_mkey); | 139 | EXPORT_SYMBOL(mlx5_core_destroy_mkey); |
diff --git a/drivers/net/ethernet/realtek/r8169.c b/drivers/net/ethernet/realtek/r8169.c index be425ad5e824..61623e9af574 100644 --- a/drivers/net/ethernet/realtek/r8169.c +++ b/drivers/net/ethernet/realtek/r8169.c | |||
| @@ -538,6 +538,7 @@ enum rtl_register_content { | |||
| 538 | MagicPacket = (1 << 5), /* Wake up when receives a Magic Packet */ | 538 | MagicPacket = (1 << 5), /* Wake up when receives a Magic Packet */ |
| 539 | LinkUp = (1 << 4), /* Wake up when the cable connection is re-established */ | 539 | LinkUp = (1 << 4), /* Wake up when the cable connection is re-established */ |
| 540 | Jumbo_En0 = (1 << 2), /* 8168 only. Reserved in the 8168b */ | 540 | Jumbo_En0 = (1 << 2), /* 8168 only. Reserved in the 8168b */ |
| 541 | Rdy_to_L23 = (1 << 1), /* L23 Enable */ | ||
| 541 | Beacon_en = (1 << 0), /* 8168 only. Reserved in the 8168b */ | 542 | Beacon_en = (1 << 0), /* 8168 only. Reserved in the 8168b */ |
| 542 | 543 | ||
| 543 | /* Config4 register */ | 544 | /* Config4 register */ |
| @@ -4239,6 +4240,8 @@ static void rtl_init_rxcfg(struct rtl8169_private *tp) | |||
| 4239 | RTL_W32(RxConfig, RX128_INT_EN | RX_MULTI_EN | RX_DMA_BURST); | 4240 | RTL_W32(RxConfig, RX128_INT_EN | RX_MULTI_EN | RX_DMA_BURST); |
| 4240 | break; | 4241 | break; |
| 4241 | case RTL_GIGA_MAC_VER_40: | 4242 | case RTL_GIGA_MAC_VER_40: |
| 4243 | RTL_W32(RxConfig, RX128_INT_EN | RX_MULTI_EN | RX_DMA_BURST | RX_EARLY_OFF); | ||
| 4244 | break; | ||
| 4242 | case RTL_GIGA_MAC_VER_41: | 4245 | case RTL_GIGA_MAC_VER_41: |
| 4243 | case RTL_GIGA_MAC_VER_42: | 4246 | case RTL_GIGA_MAC_VER_42: |
| 4244 | case RTL_GIGA_MAC_VER_43: | 4247 | case RTL_GIGA_MAC_VER_43: |
| @@ -4897,6 +4900,21 @@ static void rtl_enable_clock_request(struct pci_dev *pdev) | |||
| 4897 | PCI_EXP_LNKCTL_CLKREQ_EN); | 4900 | PCI_EXP_LNKCTL_CLKREQ_EN); |
| 4898 | } | 4901 | } |
| 4899 | 4902 | ||
| 4903 | static void rtl_pcie_state_l2l3_enable(struct rtl8169_private *tp, bool enable) | ||
| 4904 | { | ||
| 4905 | void __iomem *ioaddr = tp->mmio_addr; | ||
| 4906 | u8 data; | ||
| 4907 | |||
| 4908 | data = RTL_R8(Config3); | ||
| 4909 | |||
| 4910 | if (enable) | ||
| 4911 | data |= Rdy_to_L23; | ||
| 4912 | else | ||
| 4913 | data &= ~Rdy_to_L23; | ||
| 4914 | |||
| 4915 | RTL_W8(Config3, data); | ||
| 4916 | } | ||
| 4917 | |||
| 4900 | #define R8168_CPCMD_QUIRK_MASK (\ | 4918 | #define R8168_CPCMD_QUIRK_MASK (\ |
| 4901 | EnableBist | \ | 4919 | EnableBist | \ |
| 4902 | Mac_dbgo_oe | \ | 4920 | Mac_dbgo_oe | \ |
| @@ -5246,6 +5264,7 @@ static void rtl_hw_start_8411(struct rtl8169_private *tp) | |||
| 5246 | }; | 5264 | }; |
| 5247 | 5265 | ||
| 5248 | rtl_hw_start_8168f(tp); | 5266 | rtl_hw_start_8168f(tp); |
| 5267 | rtl_pcie_state_l2l3_enable(tp, false); | ||
| 5249 | 5268 | ||
| 5250 | rtl_ephy_init(tp, e_info_8168f_1, ARRAY_SIZE(e_info_8168f_1)); | 5269 | rtl_ephy_init(tp, e_info_8168f_1, ARRAY_SIZE(e_info_8168f_1)); |
| 5251 | 5270 | ||
| @@ -5284,6 +5303,8 @@ static void rtl_hw_start_8168g_1(struct rtl8169_private *tp) | |||
| 5284 | 5303 | ||
| 5285 | rtl_w1w0_eri(tp, 0x2fc, ERIAR_MASK_0001, 0x01, 0x06, ERIAR_EXGMAC); | 5304 | rtl_w1w0_eri(tp, 0x2fc, ERIAR_MASK_0001, 0x01, 0x06, ERIAR_EXGMAC); |
| 5286 | rtl_w1w0_eri(tp, 0x1b0, ERIAR_MASK_0011, 0x0000, 0x1000, ERIAR_EXGMAC); | 5305 | rtl_w1w0_eri(tp, 0x1b0, ERIAR_MASK_0011, 0x0000, 0x1000, ERIAR_EXGMAC); |
| 5306 | |||
| 5307 | rtl_pcie_state_l2l3_enable(tp, false); | ||
| 5287 | } | 5308 | } |
| 5288 | 5309 | ||
| 5289 | static void rtl_hw_start_8168g_2(struct rtl8169_private *tp) | 5310 | static void rtl_hw_start_8168g_2(struct rtl8169_private *tp) |
| @@ -5536,6 +5557,8 @@ static void rtl_hw_start_8105e_1(struct rtl8169_private *tp) | |||
| 5536 | RTL_W8(DLLPR, RTL_R8(DLLPR) | PFM_EN); | 5557 | RTL_W8(DLLPR, RTL_R8(DLLPR) | PFM_EN); |
| 5537 | 5558 | ||
| 5538 | rtl_ephy_init(tp, e_info_8105e_1, ARRAY_SIZE(e_info_8105e_1)); | 5559 | rtl_ephy_init(tp, e_info_8105e_1, ARRAY_SIZE(e_info_8105e_1)); |
| 5560 | |||
| 5561 | rtl_pcie_state_l2l3_enable(tp, false); | ||
| 5539 | } | 5562 | } |
| 5540 | 5563 | ||
| 5541 | static void rtl_hw_start_8105e_2(struct rtl8169_private *tp) | 5564 | static void rtl_hw_start_8105e_2(struct rtl8169_private *tp) |
| @@ -5571,6 +5594,8 @@ static void rtl_hw_start_8402(struct rtl8169_private *tp) | |||
| 5571 | rtl_eri_write(tp, 0xc0, ERIAR_MASK_0011, 0x0000, ERIAR_EXGMAC); | 5594 | rtl_eri_write(tp, 0xc0, ERIAR_MASK_0011, 0x0000, ERIAR_EXGMAC); |
| 5572 | rtl_eri_write(tp, 0xb8, ERIAR_MASK_0011, 0x0000, ERIAR_EXGMAC); | 5595 | rtl_eri_write(tp, 0xb8, ERIAR_MASK_0011, 0x0000, ERIAR_EXGMAC); |
| 5573 | rtl_w1w0_eri(tp, 0x0d4, ERIAR_MASK_0011, 0x0e00, 0xff00, ERIAR_EXGMAC); | 5596 | rtl_w1w0_eri(tp, 0x0d4, ERIAR_MASK_0011, 0x0e00, 0xff00, ERIAR_EXGMAC); |
| 5597 | |||
| 5598 | rtl_pcie_state_l2l3_enable(tp, false); | ||
| 5574 | } | 5599 | } |
| 5575 | 5600 | ||
| 5576 | static void rtl_hw_start_8106(struct rtl8169_private *tp) | 5601 | static void rtl_hw_start_8106(struct rtl8169_private *tp) |
| @@ -5583,6 +5608,8 @@ static void rtl_hw_start_8106(struct rtl8169_private *tp) | |||
| 5583 | RTL_W32(MISC, (RTL_R32(MISC) | DISABLE_LAN_EN) & ~EARLY_TALLY_EN); | 5608 | RTL_W32(MISC, (RTL_R32(MISC) | DISABLE_LAN_EN) & ~EARLY_TALLY_EN); |
| 5584 | RTL_W8(MCU, RTL_R8(MCU) | EN_NDP | EN_OOB_RESET); | 5609 | RTL_W8(MCU, RTL_R8(MCU) | EN_NDP | EN_OOB_RESET); |
| 5585 | RTL_W8(DLLPR, RTL_R8(DLLPR) & ~PFM_EN); | 5610 | RTL_W8(DLLPR, RTL_R8(DLLPR) & ~PFM_EN); |
| 5611 | |||
| 5612 | rtl_pcie_state_l2l3_enable(tp, false); | ||
| 5586 | } | 5613 | } |
| 5587 | 5614 | ||
| 5588 | static void rtl_hw_start_8101(struct net_device *dev) | 5615 | static void rtl_hw_start_8101(struct net_device *dev) |
diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac1000_core.c b/drivers/net/ethernet/stmicro/stmmac/dwmac1000_core.c index b3e148ef5683..9d3748361a1e 100644 --- a/drivers/net/ethernet/stmicro/stmmac/dwmac1000_core.c +++ b/drivers/net/ethernet/stmicro/stmmac/dwmac1000_core.c | |||
| @@ -320,11 +320,8 @@ static void dwmac1000_set_eee_timer(void __iomem *ioaddr, int ls, int tw) | |||
| 320 | 320 | ||
| 321 | static void dwmac1000_ctrl_ane(void __iomem *ioaddr, bool restart) | 321 | static void dwmac1000_ctrl_ane(void __iomem *ioaddr, bool restart) |
| 322 | { | 322 | { |
| 323 | u32 value; | ||
| 324 | |||
| 325 | value = readl(ioaddr + GMAC_AN_CTRL); | ||
| 326 | /* auto negotiation enable and External Loopback enable */ | 323 | /* auto negotiation enable and External Loopback enable */ |
| 327 | value = GMAC_AN_CTRL_ANE | GMAC_AN_CTRL_ELE; | 324 | u32 value = GMAC_AN_CTRL_ANE | GMAC_AN_CTRL_ELE; |
| 328 | 325 | ||
| 329 | if (restart) | 326 | if (restart) |
| 330 | value |= GMAC_AN_CTRL_RAN; | 327 | value |= GMAC_AN_CTRL_RAN; |
diff --git a/drivers/net/ethernet/stmicro/stmmac/enh_desc.c b/drivers/net/ethernet/stmicro/stmmac/enh_desc.c index 7e6628a91514..1e2bcf5f89e1 100644 --- a/drivers/net/ethernet/stmicro/stmmac/enh_desc.c +++ b/drivers/net/ethernet/stmicro/stmmac/enh_desc.c | |||
| @@ -145,7 +145,7 @@ static void enh_desc_get_ext_status(void *data, struct stmmac_extra_stats *x, | |||
| 145 | x->rx_msg_type_delay_req++; | 145 | x->rx_msg_type_delay_req++; |
| 146 | else if (p->des4.erx.msg_type == RDES_EXT_DELAY_RESP) | 146 | else if (p->des4.erx.msg_type == RDES_EXT_DELAY_RESP) |
| 147 | x->rx_msg_type_delay_resp++; | 147 | x->rx_msg_type_delay_resp++; |
| 148 | else if (p->des4.erx.msg_type == RDES_EXT_DELAY_REQ) | 148 | else if (p->des4.erx.msg_type == RDES_EXT_PDELAY_REQ) |
| 149 | x->rx_msg_type_pdelay_req++; | 149 | x->rx_msg_type_pdelay_req++; |
| 150 | else if (p->des4.erx.msg_type == RDES_EXT_PDELAY_RESP) | 150 | else if (p->des4.erx.msg_type == RDES_EXT_PDELAY_RESP) |
| 151 | x->rx_msg_type_pdelay_resp++; | 151 | x->rx_msg_type_pdelay_resp++; |
diff --git a/drivers/net/ethernet/sun/sunvnet.c b/drivers/net/ethernet/sun/sunvnet.c index 1c24a8f368bd..d813bfb1a847 100644 --- a/drivers/net/ethernet/sun/sunvnet.c +++ b/drivers/net/ethernet/sun/sunvnet.c | |||
| @@ -610,6 +610,13 @@ static int __vnet_tx_trigger(struct vnet_port *port) | |||
| 610 | return err; | 610 | return err; |
| 611 | } | 611 | } |
| 612 | 612 | ||
| 613 | static inline bool port_is_up(struct vnet_port *vnet) | ||
| 614 | { | ||
| 615 | struct vio_driver_state *vio = &vnet->vio; | ||
| 616 | |||
| 617 | return !!(vio->hs_state & VIO_HS_COMPLETE); | ||
| 618 | } | ||
| 619 | |||
| 613 | struct vnet_port *__tx_port_find(struct vnet *vp, struct sk_buff *skb) | 620 | struct vnet_port *__tx_port_find(struct vnet *vp, struct sk_buff *skb) |
| 614 | { | 621 | { |
| 615 | unsigned int hash = vnet_hashfn(skb->data); | 622 | unsigned int hash = vnet_hashfn(skb->data); |
| @@ -617,14 +624,19 @@ struct vnet_port *__tx_port_find(struct vnet *vp, struct sk_buff *skb) | |||
| 617 | struct vnet_port *port; | 624 | struct vnet_port *port; |
| 618 | 625 | ||
| 619 | hlist_for_each_entry(port, hp, hash) { | 626 | hlist_for_each_entry(port, hp, hash) { |
| 627 | if (!port_is_up(port)) | ||
| 628 | continue; | ||
| 620 | if (ether_addr_equal(port->raddr, skb->data)) | 629 | if (ether_addr_equal(port->raddr, skb->data)) |
| 621 | return port; | 630 | return port; |
| 622 | } | 631 | } |
| 623 | port = NULL; | 632 | list_for_each_entry(port, &vp->port_list, list) { |
| 624 | if (!list_empty(&vp->port_list)) | 633 | if (!port->switch_port) |
| 625 | port = list_entry(vp->port_list.next, struct vnet_port, list); | 634 | continue; |
| 626 | 635 | if (!port_is_up(port)) | |
| 627 | return port; | 636 | continue; |
| 637 | return port; | ||
| 638 | } | ||
| 639 | return NULL; | ||
| 628 | } | 640 | } |
| 629 | 641 | ||
| 630 | struct vnet_port *tx_port_find(struct vnet *vp, struct sk_buff *skb) | 642 | struct vnet_port *tx_port_find(struct vnet *vp, struct sk_buff *skb) |
| @@ -1083,6 +1095,24 @@ static struct vnet *vnet_find_or_create(const u64 *local_mac) | |||
| 1083 | return vp; | 1095 | return vp; |
| 1084 | } | 1096 | } |
| 1085 | 1097 | ||
| 1098 | static void vnet_cleanup(void) | ||
| 1099 | { | ||
| 1100 | struct vnet *vp; | ||
| 1101 | struct net_device *dev; | ||
| 1102 | |||
| 1103 | mutex_lock(&vnet_list_mutex); | ||
| 1104 | while (!list_empty(&vnet_list)) { | ||
| 1105 | vp = list_first_entry(&vnet_list, struct vnet, list); | ||
| 1106 | list_del(&vp->list); | ||
| 1107 | dev = vp->dev; | ||
| 1108 | /* vio_unregister_driver() should have cleaned up port_list */ | ||
| 1109 | BUG_ON(!list_empty(&vp->port_list)); | ||
| 1110 | unregister_netdev(dev); | ||
| 1111 | free_netdev(dev); | ||
| 1112 | } | ||
| 1113 | mutex_unlock(&vnet_list_mutex); | ||
| 1114 | } | ||
| 1115 | |||
| 1086 | static const char *local_mac_prop = "local-mac-address"; | 1116 | static const char *local_mac_prop = "local-mac-address"; |
| 1087 | 1117 | ||
| 1088 | static struct vnet *vnet_find_parent(struct mdesc_handle *hp, | 1118 | static struct vnet *vnet_find_parent(struct mdesc_handle *hp, |
| @@ -1240,7 +1270,6 @@ static int vnet_port_remove(struct vio_dev *vdev) | |||
| 1240 | 1270 | ||
| 1241 | kfree(port); | 1271 | kfree(port); |
| 1242 | 1272 | ||
| 1243 | unregister_netdev(vp->dev); | ||
| 1244 | } | 1273 | } |
| 1245 | return 0; | 1274 | return 0; |
| 1246 | } | 1275 | } |
| @@ -1268,6 +1297,7 @@ static int __init vnet_init(void) | |||
| 1268 | static void __exit vnet_exit(void) | 1297 | static void __exit vnet_exit(void) |
| 1269 | { | 1298 | { |
| 1270 | vio_unregister_driver(&vnet_port_driver); | 1299 | vio_unregister_driver(&vnet_port_driver); |
| 1300 | vnet_cleanup(); | ||
| 1271 | } | 1301 | } |
| 1272 | 1302 | ||
| 1273 | module_init(vnet_init); | 1303 | module_init(vnet_init); |
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/fddi/defxx.c b/drivers/net/fddi/defxx.c index eb78203cd58e..2aa57270838f 100644 --- a/drivers/net/fddi/defxx.c +++ b/drivers/net/fddi/defxx.c | |||
| @@ -291,7 +291,11 @@ static int dfx_hw_dma_uninit(DFX_board_t *bp, PI_UINT32 type); | |||
| 291 | 291 | ||
| 292 | static int dfx_rcv_init(DFX_board_t *bp, int get_buffers); | 292 | static int dfx_rcv_init(DFX_board_t *bp, int get_buffers); |
| 293 | static void dfx_rcv_queue_process(DFX_board_t *bp); | 293 | static void dfx_rcv_queue_process(DFX_board_t *bp); |
| 294 | #ifdef DYNAMIC_BUFFERS | ||
| 294 | static void dfx_rcv_flush(DFX_board_t *bp); | 295 | static void dfx_rcv_flush(DFX_board_t *bp); |
| 296 | #else | ||
| 297 | static inline void dfx_rcv_flush(DFX_board_t *bp) {} | ||
| 298 | #endif | ||
| 295 | 299 | ||
| 296 | static netdev_tx_t dfx_xmt_queue_pkt(struct sk_buff *skb, | 300 | static netdev_tx_t dfx_xmt_queue_pkt(struct sk_buff *skb, |
| 297 | struct net_device *dev); | 301 | struct net_device *dev); |
| @@ -2849,7 +2853,7 @@ static int dfx_hw_dma_uninit(DFX_board_t *bp, PI_UINT32 type) | |||
| 2849 | * Align an sk_buff to a boundary power of 2 | 2853 | * Align an sk_buff to a boundary power of 2 |
| 2850 | * | 2854 | * |
| 2851 | */ | 2855 | */ |
| 2852 | 2856 | #ifdef DYNAMIC_BUFFERS | |
| 2853 | static void my_skb_align(struct sk_buff *skb, int n) | 2857 | static void my_skb_align(struct sk_buff *skb, int n) |
| 2854 | { | 2858 | { |
| 2855 | unsigned long x = (unsigned long)skb->data; | 2859 | unsigned long x = (unsigned long)skb->data; |
| @@ -2859,7 +2863,7 @@ static void my_skb_align(struct sk_buff *skb, int n) | |||
| 2859 | 2863 | ||
| 2860 | skb_reserve(skb, v - x); | 2864 | skb_reserve(skb, v - x); |
| 2861 | } | 2865 | } |
| 2862 | 2866 | #endif | |
| 2863 | 2867 | ||
| 2864 | /* | 2868 | /* |
| 2865 | * ================ | 2869 | * ================ |
| @@ -3074,10 +3078,7 @@ static void dfx_rcv_queue_process( | |||
| 3074 | break; | 3078 | break; |
| 3075 | } | 3079 | } |
| 3076 | else { | 3080 | else { |
| 3077 | #ifndef DYNAMIC_BUFFERS | 3081 | if (!rx_in_place) { |
| 3078 | if (! rx_in_place) | ||
| 3079 | #endif | ||
| 3080 | { | ||
| 3081 | /* Receive buffer allocated, pass receive packet up */ | 3082 | /* Receive buffer allocated, pass receive packet up */ |
| 3082 | 3083 | ||
| 3083 | skb_copy_to_linear_data(skb, | 3084 | skb_copy_to_linear_data(skb, |
| @@ -3453,10 +3454,6 @@ static void dfx_rcv_flush( DFX_board_t *bp ) | |||
| 3453 | } | 3454 | } |
| 3454 | 3455 | ||
| 3455 | } | 3456 | } |
| 3456 | #else | ||
| 3457 | static inline void dfx_rcv_flush( DFX_board_t *bp ) | ||
| 3458 | { | ||
| 3459 | } | ||
| 3460 | #endif /* DYNAMIC_BUFFERS */ | 3457 | #endif /* DYNAMIC_BUFFERS */ |
| 3461 | 3458 | ||
| 3462 | /* | 3459 | /* |
diff --git a/drivers/net/hyperv/netvsc.c b/drivers/net/hyperv/netvsc.c index c041f63a6d30..d97d5f39a04e 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 */ |
| @@ -378,8 +378,10 @@ static int netvsc_init_buf(struct hv_device *device) | |||
| 378 | 378 | ||
| 379 | net_device->send_section_map = | 379 | net_device->send_section_map = |
| 380 | kzalloc(net_device->map_words * sizeof(ulong), GFP_KERNEL); | 380 | kzalloc(net_device->map_words * sizeof(ulong), GFP_KERNEL); |
| 381 | if (net_device->send_section_map == NULL) | 381 | if (net_device->send_section_map == NULL) { |
| 382 | ret = -ENOMEM; | ||
| 382 | goto cleanup; | 383 | goto cleanup; |
| 384 | } | ||
| 383 | 385 | ||
| 384 | goto exit; | 386 | goto exit; |
| 385 | 387 | ||
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/dp83640.c b/drivers/net/phy/dp83640.c index 6a999e6814a0..9408157a246c 100644 --- a/drivers/net/phy/dp83640.c +++ b/drivers/net/phy/dp83640.c | |||
| @@ -1323,15 +1323,15 @@ static bool dp83640_rxtstamp(struct phy_device *phydev, | |||
| 1323 | { | 1323 | { |
| 1324 | struct dp83640_private *dp83640 = phydev->priv; | 1324 | struct dp83640_private *dp83640 = phydev->priv; |
| 1325 | 1325 | ||
| 1326 | if (!dp83640->hwts_rx_en) | ||
| 1327 | return false; | ||
| 1328 | |||
| 1329 | if (is_status_frame(skb, type)) { | 1326 | if (is_status_frame(skb, type)) { |
| 1330 | decode_status_frame(dp83640, skb); | 1327 | decode_status_frame(dp83640, skb); |
| 1331 | kfree_skb(skb); | 1328 | kfree_skb(skb); |
| 1332 | return true; | 1329 | return true; |
| 1333 | } | 1330 | } |
| 1334 | 1331 | ||
| 1332 | if (!dp83640->hwts_rx_en) | ||
| 1333 | return false; | ||
| 1334 | |||
| 1335 | SKB_PTP_TYPE(skb) = type; | 1335 | SKB_PTP_TYPE(skb) = type; |
| 1336 | skb_queue_tail(&dp83640->rx_queue, skb); | 1336 | skb_queue_tail(&dp83640->rx_queue, skb); |
| 1337 | schedule_work(&dp83640->ts_work); | 1337 | schedule_work(&dp83640->ts_work); |
diff --git a/drivers/net/phy/mdio_bus.c b/drivers/net/phy/mdio_bus.c index 2e58aa54484c..203651ebccb0 100644 --- a/drivers/net/phy/mdio_bus.c +++ b/drivers/net/phy/mdio_bus.c | |||
| @@ -187,6 +187,50 @@ struct mii_bus *of_mdio_find_bus(struct device_node *mdio_bus_np) | |||
| 187 | return d ? to_mii_bus(d) : NULL; | 187 | return d ? to_mii_bus(d) : NULL; |
| 188 | } | 188 | } |
| 189 | EXPORT_SYMBOL(of_mdio_find_bus); | 189 | EXPORT_SYMBOL(of_mdio_find_bus); |
| 190 | |||
| 191 | /* Walk the list of subnodes of a mdio bus and look for a node that matches the | ||
| 192 | * phy's address with its 'reg' property. If found, set the of_node pointer for | ||
| 193 | * the phy. This allows auto-probed pyh devices to be supplied with information | ||
| 194 | * passed in via DT. | ||
| 195 | */ | ||
| 196 | static void of_mdiobus_link_phydev(struct mii_bus *mdio, | ||
| 197 | struct phy_device *phydev) | ||
| 198 | { | ||
| 199 | struct device *dev = &phydev->dev; | ||
| 200 | struct device_node *child; | ||
| 201 | |||
| 202 | if (dev->of_node || !mdio->dev.of_node) | ||
| 203 | return; | ||
| 204 | |||
| 205 | for_each_available_child_of_node(mdio->dev.of_node, child) { | ||
| 206 | int addr; | ||
| 207 | int ret; | ||
| 208 | |||
| 209 | ret = of_property_read_u32(child, "reg", &addr); | ||
| 210 | if (ret < 0) { | ||
| 211 | dev_err(dev, "%s has invalid PHY address\n", | ||
| 212 | child->full_name); | ||
| 213 | continue; | ||
| 214 | } | ||
| 215 | |||
| 216 | /* A PHY must have a reg property in the range [0-31] */ | ||
| 217 | if (addr >= PHY_MAX_ADDR) { | ||
| 218 | dev_err(dev, "%s PHY address %i is too large\n", | ||
| 219 | child->full_name, addr); | ||
| 220 | continue; | ||
| 221 | } | ||
| 222 | |||
| 223 | if (addr == phydev->addr) { | ||
| 224 | dev->of_node = child; | ||
| 225 | return; | ||
| 226 | } | ||
| 227 | } | ||
| 228 | } | ||
| 229 | #else /* !IS_ENABLED(CONFIG_OF_MDIO) */ | ||
| 230 | static inline void of_mdiobus_link_phydev(struct mii_bus *mdio, | ||
| 231 | struct phy_device *phydev) | ||
| 232 | { | ||
| 233 | } | ||
| 190 | #endif | 234 | #endif |
| 191 | 235 | ||
| 192 | /** | 236 | /** |
| @@ -211,6 +255,7 @@ int mdiobus_register(struct mii_bus *bus) | |||
| 211 | 255 | ||
| 212 | bus->dev.parent = bus->parent; | 256 | bus->dev.parent = bus->parent; |
| 213 | bus->dev.class = &mdio_bus_class; | 257 | bus->dev.class = &mdio_bus_class; |
| 258 | bus->dev.driver = bus->parent->driver; | ||
| 214 | bus->dev.groups = NULL; | 259 | bus->dev.groups = NULL; |
| 215 | dev_set_name(&bus->dev, "%s", bus->id); | 260 | dev_set_name(&bus->dev, "%s", bus->id); |
| 216 | 261 | ||
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/phy/phy_device.c b/drivers/net/phy/phy_device.c index 35d753d22f78..22c57be4dfa0 100644 --- a/drivers/net/phy/phy_device.c +++ b/drivers/net/phy/phy_device.c | |||
| @@ -355,7 +355,7 @@ int phy_device_register(struct phy_device *phydev) | |||
| 355 | phydev->bus->phy_map[phydev->addr] = phydev; | 355 | phydev->bus->phy_map[phydev->addr] = phydev; |
| 356 | 356 | ||
| 357 | /* Run all of the fixups for this PHY */ | 357 | /* Run all of the fixups for this PHY */ |
| 358 | err = phy_init_hw(phydev); | 358 | err = phy_scan_fixups(phydev); |
| 359 | if (err) { | 359 | if (err) { |
| 360 | pr_err("PHY %d failed to initialize\n", phydev->addr); | 360 | pr_err("PHY %d failed to initialize\n", phydev->addr); |
| 361 | goto out; | 361 | goto out; |
| @@ -575,6 +575,7 @@ int phy_attach_direct(struct net_device *dev, struct phy_device *phydev, | |||
| 575 | u32 flags, phy_interface_t interface) | 575 | u32 flags, phy_interface_t interface) |
| 576 | { | 576 | { |
| 577 | struct device *d = &phydev->dev; | 577 | struct device *d = &phydev->dev; |
| 578 | struct module *bus_module; | ||
| 578 | int err; | 579 | int err; |
| 579 | 580 | ||
| 580 | /* Assume that if there is no driver, that it doesn't | 581 | /* Assume that if there is no driver, that it doesn't |
| @@ -599,6 +600,14 @@ int phy_attach_direct(struct net_device *dev, struct phy_device *phydev, | |||
| 599 | return -EBUSY; | 600 | return -EBUSY; |
| 600 | } | 601 | } |
| 601 | 602 | ||
| 603 | /* Increment the bus module reference count */ | ||
| 604 | bus_module = phydev->bus->dev.driver ? | ||
| 605 | phydev->bus->dev.driver->owner : NULL; | ||
| 606 | if (!try_module_get(bus_module)) { | ||
| 607 | dev_err(&dev->dev, "failed to get the bus module\n"); | ||
| 608 | return -EIO; | ||
| 609 | } | ||
| 610 | |||
| 602 | phydev->attached_dev = dev; | 611 | phydev->attached_dev = dev; |
| 603 | dev->phydev = phydev; | 612 | dev->phydev = phydev; |
| 604 | 613 | ||
| @@ -664,6 +673,10 @@ EXPORT_SYMBOL(phy_attach); | |||
| 664 | void phy_detach(struct phy_device *phydev) | 673 | void phy_detach(struct phy_device *phydev) |
| 665 | { | 674 | { |
| 666 | int i; | 675 | int i; |
| 676 | |||
| 677 | if (phydev->bus->dev.driver) | ||
| 678 | module_put(phydev->bus->dev.driver->owner); | ||
| 679 | |||
| 667 | phydev->attached_dev->phydev = NULL; | 680 | phydev->attached_dev->phydev = NULL; |
| 668 | phydev->attached_dev = NULL; | 681 | phydev->attached_dev = NULL; |
| 669 | phy_suspend(phydev); | 682 | phy_suspend(phydev); |
diff --git a/drivers/net/ppp/ppp_generic.c b/drivers/net/ppp/ppp_generic.c index 91d6c1272fcf..d5b77ef3a210 100644 --- a/drivers/net/ppp/ppp_generic.c +++ b/drivers/net/ppp/ppp_generic.c | |||
| @@ -539,7 +539,7 @@ static int get_filter(void __user *arg, struct sock_filter **p) | |||
| 539 | { | 539 | { |
| 540 | struct sock_fprog uprog; | 540 | struct sock_fprog uprog; |
| 541 | struct sock_filter *code = NULL; | 541 | struct sock_filter *code = NULL; |
| 542 | int len, err; | 542 | int len; |
| 543 | 543 | ||
| 544 | if (copy_from_user(&uprog, arg, sizeof(uprog))) | 544 | if (copy_from_user(&uprog, arg, sizeof(uprog))) |
| 545 | return -EFAULT; | 545 | return -EFAULT; |
| @@ -554,12 +554,6 @@ static int get_filter(void __user *arg, struct sock_filter **p) | |||
| 554 | if (IS_ERR(code)) | 554 | if (IS_ERR(code)) |
| 555 | return PTR_ERR(code); | 555 | return PTR_ERR(code); |
| 556 | 556 | ||
| 557 | err = sk_chk_filter(code, uprog.len); | ||
| 558 | if (err) { | ||
| 559 | kfree(code); | ||
| 560 | return err; | ||
| 561 | } | ||
| 562 | |||
| 563 | *p = code; | 557 | *p = code; |
| 564 | return uprog.len; | 558 | return uprog.len; |
| 565 | } | 559 | } |
| @@ -763,10 +757,15 @@ static long ppp_ioctl(struct file *file, unsigned int cmd, unsigned long arg) | |||
| 763 | }; | 757 | }; |
| 764 | 758 | ||
| 765 | ppp_lock(ppp); | 759 | ppp_lock(ppp); |
| 766 | if (ppp->pass_filter) | 760 | if (ppp->pass_filter) { |
| 767 | sk_unattached_filter_destroy(ppp->pass_filter); | 761 | sk_unattached_filter_destroy(ppp->pass_filter); |
| 768 | err = sk_unattached_filter_create(&ppp->pass_filter, | 762 | ppp->pass_filter = NULL; |
| 769 | &fprog); | 763 | } |
| 764 | if (fprog.filter != NULL) | ||
| 765 | err = sk_unattached_filter_create(&ppp->pass_filter, | ||
| 766 | &fprog); | ||
| 767 | else | ||
| 768 | err = 0; | ||
| 770 | kfree(code); | 769 | kfree(code); |
| 771 | ppp_unlock(ppp); | 770 | ppp_unlock(ppp); |
| 772 | } | 771 | } |
| @@ -784,10 +783,15 @@ static long ppp_ioctl(struct file *file, unsigned int cmd, unsigned long arg) | |||
| 784 | }; | 783 | }; |
| 785 | 784 | ||
| 786 | ppp_lock(ppp); | 785 | ppp_lock(ppp); |
| 787 | if (ppp->active_filter) | 786 | if (ppp->active_filter) { |
| 788 | sk_unattached_filter_destroy(ppp->active_filter); | 787 | sk_unattached_filter_destroy(ppp->active_filter); |
| 789 | err = sk_unattached_filter_create(&ppp->active_filter, | 788 | ppp->active_filter = NULL; |
| 790 | &fprog); | 789 | } |
| 790 | if (fprog.filter != NULL) | ||
| 791 | err = sk_unattached_filter_create(&ppp->active_filter, | ||
| 792 | &fprog); | ||
| 793 | else | ||
| 794 | err = 0; | ||
| 791 | kfree(code); | 795 | kfree(code); |
| 792 | ppp_unlock(ppp); | 796 | ppp_unlock(ppp); |
| 793 | } | 797 | } |
diff --git a/drivers/net/ppp/pppoe.c b/drivers/net/ppp/pppoe.c index 2ea7efd11857..6c9c16d76935 100644 --- a/drivers/net/ppp/pppoe.c +++ b/drivers/net/ppp/pppoe.c | |||
| @@ -675,7 +675,7 @@ static int pppoe_connect(struct socket *sock, struct sockaddr *uservaddr, | |||
| 675 | po->chan.hdrlen = (sizeof(struct pppoe_hdr) + | 675 | po->chan.hdrlen = (sizeof(struct pppoe_hdr) + |
| 676 | dev->hard_header_len); | 676 | dev->hard_header_len); |
| 677 | 677 | ||
| 678 | po->chan.mtu = dev->mtu - sizeof(struct pppoe_hdr); | 678 | po->chan.mtu = dev->mtu - sizeof(struct pppoe_hdr) - 2; |
| 679 | po->chan.private = sk; | 679 | po->chan.private = sk; |
| 680 | po->chan.ops = &pppoe_chan_ops; | 680 | po->chan.ops = &pppoe_chan_ops; |
| 681 | 681 | ||
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/cdc_ether.c b/drivers/net/usb/cdc_ether.c index 9ea4bfe5d318..2a32d9167d3b 100644 --- a/drivers/net/usb/cdc_ether.c +++ b/drivers/net/usb/cdc_ether.c | |||
| @@ -341,6 +341,22 @@ next_desc: | |||
| 341 | usb_driver_release_interface(driver, info->data); | 341 | usb_driver_release_interface(driver, info->data); |
| 342 | return -ENODEV; | 342 | return -ENODEV; |
| 343 | } | 343 | } |
| 344 | |||
| 345 | /* Some devices don't initialise properly. In particular | ||
| 346 | * the packet filter is not reset. There are devices that | ||
| 347 | * don't do reset all the way. So the packet filter should | ||
| 348 | * be set to a sane initial value. | ||
| 349 | */ | ||
| 350 | usb_control_msg(dev->udev, | ||
| 351 | usb_sndctrlpipe(dev->udev, 0), | ||
| 352 | USB_CDC_SET_ETHERNET_PACKET_FILTER, | ||
| 353 | USB_TYPE_CLASS | USB_RECIP_INTERFACE, | ||
| 354 | USB_CDC_PACKET_TYPE_ALL_MULTICAST | USB_CDC_PACKET_TYPE_DIRECTED | USB_CDC_PACKET_TYPE_BROADCAST, | ||
| 355 | intf->cur_altsetting->desc.bInterfaceNumber, | ||
| 356 | NULL, | ||
| 357 | 0, | ||
| 358 | USB_CTRL_SET_TIMEOUT | ||
| 359 | ); | ||
| 344 | return 0; | 360 | return 0; |
| 345 | 361 | ||
| 346 | bad_desc: | 362 | bad_desc: |
diff --git a/drivers/net/usb/hso.c b/drivers/net/usb/hso.c index a3a05869309d..a4272ed62da8 100644 --- a/drivers/net/usb/hso.c +++ b/drivers/net/usb/hso.c | |||
| @@ -258,10 +258,8 @@ struct hso_serial { | |||
| 258 | * so as not to drop characters on the floor. | 258 | * so as not to drop characters on the floor. |
| 259 | */ | 259 | */ |
| 260 | int curr_rx_urb_idx; | 260 | int curr_rx_urb_idx; |
| 261 | u16 curr_rx_urb_offset; | ||
| 262 | u8 rx_urb_filled[MAX_RX_URBS]; | 261 | u8 rx_urb_filled[MAX_RX_URBS]; |
| 263 | struct tasklet_struct unthrottle_tasklet; | 262 | struct tasklet_struct unthrottle_tasklet; |
| 264 | struct work_struct retry_unthrottle_workqueue; | ||
| 265 | }; | 263 | }; |
| 266 | 264 | ||
| 267 | struct hso_device { | 265 | struct hso_device { |
| @@ -1252,14 +1250,6 @@ static void hso_unthrottle(struct tty_struct *tty) | |||
| 1252 | tasklet_hi_schedule(&serial->unthrottle_tasklet); | 1250 | tasklet_hi_schedule(&serial->unthrottle_tasklet); |
| 1253 | } | 1251 | } |
| 1254 | 1252 | ||
| 1255 | static void hso_unthrottle_workfunc(struct work_struct *work) | ||
| 1256 | { | ||
| 1257 | struct hso_serial *serial = | ||
| 1258 | container_of(work, struct hso_serial, | ||
| 1259 | retry_unthrottle_workqueue); | ||
| 1260 | hso_unthrottle_tasklet(serial); | ||
| 1261 | } | ||
| 1262 | |||
| 1263 | /* open the requested serial port */ | 1253 | /* open the requested serial port */ |
| 1264 | static int hso_serial_open(struct tty_struct *tty, struct file *filp) | 1254 | static int hso_serial_open(struct tty_struct *tty, struct file *filp) |
| 1265 | { | 1255 | { |
| @@ -1295,8 +1285,6 @@ static int hso_serial_open(struct tty_struct *tty, struct file *filp) | |||
| 1295 | tasklet_init(&serial->unthrottle_tasklet, | 1285 | tasklet_init(&serial->unthrottle_tasklet, |
| 1296 | (void (*)(unsigned long))hso_unthrottle_tasklet, | 1286 | (void (*)(unsigned long))hso_unthrottle_tasklet, |
| 1297 | (unsigned long)serial); | 1287 | (unsigned long)serial); |
| 1298 | INIT_WORK(&serial->retry_unthrottle_workqueue, | ||
| 1299 | hso_unthrottle_workfunc); | ||
| 1300 | result = hso_start_serial_device(serial->parent, GFP_KERNEL); | 1288 | result = hso_start_serial_device(serial->parent, GFP_KERNEL); |
| 1301 | if (result) { | 1289 | if (result) { |
| 1302 | hso_stop_serial_device(serial->parent); | 1290 | hso_stop_serial_device(serial->parent); |
| @@ -1345,7 +1333,6 @@ static void hso_serial_close(struct tty_struct *tty, struct file *filp) | |||
| 1345 | if (!usb_gone) | 1333 | if (!usb_gone) |
| 1346 | hso_stop_serial_device(serial->parent); | 1334 | hso_stop_serial_device(serial->parent); |
| 1347 | tasklet_kill(&serial->unthrottle_tasklet); | 1335 | tasklet_kill(&serial->unthrottle_tasklet); |
| 1348 | cancel_work_sync(&serial->retry_unthrottle_workqueue); | ||
| 1349 | } | 1336 | } |
| 1350 | 1337 | ||
| 1351 | if (!usb_gone) | 1338 | if (!usb_gone) |
| @@ -2013,8 +2000,7 @@ static void ctrl_callback(struct urb *urb) | |||
| 2013 | static int put_rxbuf_data(struct urb *urb, struct hso_serial *serial) | 2000 | static int put_rxbuf_data(struct urb *urb, struct hso_serial *serial) |
| 2014 | { | 2001 | { |
| 2015 | struct tty_struct *tty; | 2002 | struct tty_struct *tty; |
| 2016 | int write_length_remaining = 0; | 2003 | int count; |
| 2017 | int curr_write_len; | ||
| 2018 | 2004 | ||
| 2019 | /* Sanity check */ | 2005 | /* Sanity check */ |
| 2020 | if (urb == NULL || serial == NULL) { | 2006 | if (urb == NULL || serial == NULL) { |
| @@ -2024,29 +2010,28 @@ static int put_rxbuf_data(struct urb *urb, struct hso_serial *serial) | |||
| 2024 | 2010 | ||
| 2025 | tty = tty_port_tty_get(&serial->port); | 2011 | tty = tty_port_tty_get(&serial->port); |
| 2026 | 2012 | ||
| 2013 | if (tty && test_bit(TTY_THROTTLED, &tty->flags)) { | ||
| 2014 | tty_kref_put(tty); | ||
| 2015 | return -1; | ||
| 2016 | } | ||
| 2017 | |||
| 2027 | /* Push data to tty */ | 2018 | /* Push data to tty */ |
| 2028 | write_length_remaining = urb->actual_length - | ||
| 2029 | serial->curr_rx_urb_offset; | ||
| 2030 | D1("data to push to tty"); | 2019 | D1("data to push to tty"); |
| 2031 | while (write_length_remaining) { | 2020 | count = tty_buffer_request_room(&serial->port, urb->actual_length); |
| 2032 | if (tty && test_bit(TTY_THROTTLED, &tty->flags)) { | 2021 | if (count >= urb->actual_length) { |
| 2033 | tty_kref_put(tty); | 2022 | tty_insert_flip_string(&serial->port, urb->transfer_buffer, |
| 2034 | return -1; | 2023 | urb->actual_length); |
| 2035 | } | ||
| 2036 | curr_write_len = tty_insert_flip_string(&serial->port, | ||
| 2037 | urb->transfer_buffer + serial->curr_rx_urb_offset, | ||
| 2038 | write_length_remaining); | ||
| 2039 | serial->curr_rx_urb_offset += curr_write_len; | ||
| 2040 | write_length_remaining -= curr_write_len; | ||
| 2041 | tty_flip_buffer_push(&serial->port); | 2024 | tty_flip_buffer_push(&serial->port); |
| 2025 | } else { | ||
| 2026 | dev_warn(&serial->parent->usb->dev, | ||
| 2027 | "dropping data, %d bytes lost\n", urb->actual_length); | ||
| 2042 | } | 2028 | } |
| 2029 | |||
| 2043 | tty_kref_put(tty); | 2030 | tty_kref_put(tty); |
| 2044 | 2031 | ||
| 2045 | if (write_length_remaining == 0) { | 2032 | serial->rx_urb_filled[hso_urb_to_index(serial, urb)] = 0; |
| 2046 | serial->curr_rx_urb_offset = 0; | 2033 | |
| 2047 | serial->rx_urb_filled[hso_urb_to_index(serial, urb)] = 0; | 2034 | return 0; |
| 2048 | } | ||
| 2049 | return write_length_remaining; | ||
| 2050 | } | 2035 | } |
| 2051 | 2036 | ||
| 2052 | 2037 | ||
| @@ -2217,7 +2202,6 @@ static int hso_stop_serial_device(struct hso_device *hso_dev) | |||
| 2217 | } | 2202 | } |
| 2218 | } | 2203 | } |
| 2219 | serial->curr_rx_urb_idx = 0; | 2204 | serial->curr_rx_urb_idx = 0; |
| 2220 | serial->curr_rx_urb_offset = 0; | ||
| 2221 | 2205 | ||
| 2222 | if (serial->tx_urb) | 2206 | if (serial->tx_urb) |
| 2223 | usb_kill_urb(serial->tx_urb); | 2207 | usb_kill_urb(serial->tx_urb); |
diff --git a/drivers/net/usb/huawei_cdc_ncm.c b/drivers/net/usb/huawei_cdc_ncm.c index f9822bc75425..735f7dadb9a0 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); |
| @@ -193,6 +194,9 @@ static const struct usb_device_id huawei_cdc_ncm_devs[] = { | |||
| 193 | { USB_VENDOR_AND_INTERFACE_INFO(0x12d1, 0xff, 0x02, 0x76), | 194 | { USB_VENDOR_AND_INTERFACE_INFO(0x12d1, 0xff, 0x02, 0x76), |
| 194 | .driver_info = (unsigned long)&huawei_cdc_ncm_info, | 195 | .driver_info = (unsigned long)&huawei_cdc_ncm_info, |
| 195 | }, | 196 | }, |
| 197 | { USB_VENDOR_AND_INTERFACE_INFO(0x12d1, 0xff, 0x03, 0x16), | ||
| 198 | .driver_info = (unsigned long)&huawei_cdc_ncm_info, | ||
| 199 | }, | ||
| 196 | 200 | ||
| 197 | /* Terminating entry */ | 201 | /* Terminating entry */ |
| 198 | { | 202 | { |
diff --git a/drivers/net/usb/qmi_wwan.c b/drivers/net/usb/qmi_wwan.c index cf62d7e8329f..22756db53dca 100644 --- a/drivers/net/usb/qmi_wwan.c +++ b/drivers/net/usb/qmi_wwan.c | |||
| @@ -667,6 +667,7 @@ static const struct usb_device_id products[] = { | |||
| 667 | {QMI_FIXED_INTF(0x05c6, 0x9084, 4)}, | 667 | {QMI_FIXED_INTF(0x05c6, 0x9084, 4)}, |
| 668 | {QMI_FIXED_INTF(0x05c6, 0x920d, 0)}, | 668 | {QMI_FIXED_INTF(0x05c6, 0x920d, 0)}, |
| 669 | {QMI_FIXED_INTF(0x05c6, 0x920d, 5)}, | 669 | {QMI_FIXED_INTF(0x05c6, 0x920d, 5)}, |
| 670 | {QMI_FIXED_INTF(0x0846, 0x68a2, 8)}, | ||
| 670 | {QMI_FIXED_INTF(0x12d1, 0x140c, 1)}, /* Huawei E173 */ | 671 | {QMI_FIXED_INTF(0x12d1, 0x140c, 1)}, /* Huawei E173 */ |
| 671 | {QMI_FIXED_INTF(0x12d1, 0x14ac, 1)}, /* Huawei E1820 */ | 672 | {QMI_FIXED_INTF(0x12d1, 0x14ac, 1)}, /* Huawei E1820 */ |
| 672 | {QMI_FIXED_INTF(0x16d8, 0x6003, 0)}, /* CMOTech 6003 */ | 673 | {QMI_FIXED_INTF(0x16d8, 0x6003, 0)}, /* CMOTech 6003 */ |
| @@ -741,6 +742,7 @@ static const struct usb_device_id products[] = { | |||
| 741 | {QMI_FIXED_INTF(0x19d2, 0x1424, 2)}, | 742 | {QMI_FIXED_INTF(0x19d2, 0x1424, 2)}, |
| 742 | {QMI_FIXED_INTF(0x19d2, 0x1425, 2)}, | 743 | {QMI_FIXED_INTF(0x19d2, 0x1425, 2)}, |
| 743 | {QMI_FIXED_INTF(0x19d2, 0x1426, 2)}, /* ZTE MF91 */ | 744 | {QMI_FIXED_INTF(0x19d2, 0x1426, 2)}, /* ZTE MF91 */ |
| 745 | {QMI_FIXED_INTF(0x19d2, 0x1428, 2)}, /* Telewell TW-LTE 4G v2 */ | ||
| 744 | {QMI_FIXED_INTF(0x19d2, 0x2002, 4)}, /* ZTE (Vodafone) K3765-Z */ | 746 | {QMI_FIXED_INTF(0x19d2, 0x2002, 4)}, /* ZTE (Vodafone) K3765-Z */ |
| 745 | {QMI_FIXED_INTF(0x0f3d, 0x68a2, 8)}, /* Sierra Wireless MC7700 */ | 747 | {QMI_FIXED_INTF(0x0f3d, 0x68a2, 8)}, /* Sierra Wireless MC7700 */ |
| 746 | {QMI_FIXED_INTF(0x114f, 0x68a2, 8)}, /* Sierra Wireless MC7750 */ | 748 | {QMI_FIXED_INTF(0x114f, 0x68a2, 8)}, /* Sierra Wireless MC7750 */ |
| @@ -756,6 +758,7 @@ static const struct usb_device_id products[] = { | |||
| 756 | {QMI_FIXED_INTF(0x1199, 0x9054, 8)}, /* Sierra Wireless Modem */ | 758 | {QMI_FIXED_INTF(0x1199, 0x9054, 8)}, /* Sierra Wireless Modem */ |
| 757 | {QMI_FIXED_INTF(0x1199, 0x9055, 8)}, /* Netgear AirCard 341U */ | 759 | {QMI_FIXED_INTF(0x1199, 0x9055, 8)}, /* Netgear AirCard 341U */ |
| 758 | {QMI_FIXED_INTF(0x1199, 0x9056, 8)}, /* Sierra Wireless Modem */ | 760 | {QMI_FIXED_INTF(0x1199, 0x9056, 8)}, /* Sierra Wireless Modem */ |
| 761 | {QMI_FIXED_INTF(0x1199, 0x9057, 8)}, | ||
| 759 | {QMI_FIXED_INTF(0x1199, 0x9061, 8)}, /* Sierra Wireless Modem */ | 762 | {QMI_FIXED_INTF(0x1199, 0x9061, 8)}, /* Sierra Wireless Modem */ |
| 760 | {QMI_FIXED_INTF(0x1bbb, 0x011e, 4)}, /* Telekom Speedstick LTE II (Alcatel One Touch L100V LTE) */ | 763 | {QMI_FIXED_INTF(0x1bbb, 0x011e, 4)}, /* Telekom Speedstick LTE II (Alcatel One Touch L100V LTE) */ |
| 761 | {QMI_FIXED_INTF(0x1bbb, 0x0203, 2)}, /* Alcatel L800MA */ | 764 | {QMI_FIXED_INTF(0x1bbb, 0x0203, 2)}, /* Alcatel L800MA */ |
diff --git a/drivers/net/usb/r8152.c b/drivers/net/usb/r8152.c index 25431965a625..3eab74c7c554 100644 --- a/drivers/net/usb/r8152.c +++ b/drivers/net/usb/r8152.c | |||
| @@ -282,7 +282,7 @@ | |||
| 282 | /* USB_DEV_STAT */ | 282 | /* USB_DEV_STAT */ |
| 283 | #define STAT_SPEED_MASK 0x0006 | 283 | #define STAT_SPEED_MASK 0x0006 |
| 284 | #define STAT_SPEED_HIGH 0x0000 | 284 | #define STAT_SPEED_HIGH 0x0000 |
| 285 | #define STAT_SPEED_FULL 0x0001 | 285 | #define STAT_SPEED_FULL 0x0002 |
| 286 | 286 | ||
| 287 | /* USB_TX_AGG */ | 287 | /* USB_TX_AGG */ |
| 288 | #define TX_AGG_MAX_THRESHOLD 0x03 | 288 | #define TX_AGG_MAX_THRESHOLD 0x03 |
| @@ -1359,7 +1359,7 @@ static void r8152_csum_workaround(struct r8152 *tp, struct sk_buff *skb, | |||
| 1359 | struct sk_buff_head seg_list; | 1359 | struct sk_buff_head seg_list; |
| 1360 | struct sk_buff *segs, *nskb; | 1360 | struct sk_buff *segs, *nskb; |
| 1361 | 1361 | ||
| 1362 | features &= ~(NETIF_F_IP_CSUM | NETIF_F_SG | NETIF_F_TSO); | 1362 | features &= ~(NETIF_F_SG | NETIF_F_IPV6_CSUM | NETIF_F_TSO6); |
| 1363 | segs = skb_gso_segment(skb, features); | 1363 | segs = skb_gso_segment(skb, features); |
| 1364 | if (IS_ERR(segs) || !segs) | 1364 | if (IS_ERR(segs) || !segs) |
| 1365 | goto drop; | 1365 | goto drop; |
| @@ -2292,9 +2292,8 @@ static void r8152b_exit_oob(struct r8152 *tp) | |||
| 2292 | /* rx share fifo credit full threshold */ | 2292 | /* rx share fifo credit full threshold */ |
| 2293 | ocp_write_dword(tp, MCU_TYPE_PLA, PLA_RXFIFO_CTRL0, RXFIFO_THR1_NORMAL); | 2293 | ocp_write_dword(tp, MCU_TYPE_PLA, PLA_RXFIFO_CTRL0, RXFIFO_THR1_NORMAL); |
| 2294 | 2294 | ||
| 2295 | ocp_data = ocp_read_word(tp, MCU_TYPE_USB, USB_DEV_STAT); | 2295 | if (tp->udev->speed == USB_SPEED_FULL || |
| 2296 | ocp_data &= STAT_SPEED_MASK; | 2296 | tp->udev->speed == USB_SPEED_LOW) { |
| 2297 | if (ocp_data == STAT_SPEED_FULL) { | ||
| 2298 | /* rx share fifo credit near full threshold */ | 2297 | /* rx share fifo credit near full threshold */ |
| 2299 | ocp_write_dword(tp, MCU_TYPE_PLA, PLA_RXFIFO_CTRL1, | 2298 | ocp_write_dword(tp, MCU_TYPE_PLA, PLA_RXFIFO_CTRL1, |
| 2300 | RXFIFO_THR2_FULL); | 2299 | RXFIFO_THR2_FULL); |
| @@ -3204,8 +3203,13 @@ static void rtl8152_get_ethtool_stats(struct net_device *dev, | |||
| 3204 | struct r8152 *tp = netdev_priv(dev); | 3203 | struct r8152 *tp = netdev_priv(dev); |
| 3205 | struct tally_counter tally; | 3204 | struct tally_counter tally; |
| 3206 | 3205 | ||
| 3206 | if (usb_autopm_get_interface(tp->intf) < 0) | ||
| 3207 | return; | ||
| 3208 | |||
| 3207 | generic_ocp_read(tp, PLA_TALLYCNT, sizeof(tally), &tally, MCU_TYPE_PLA); | 3209 | generic_ocp_read(tp, PLA_TALLYCNT, sizeof(tally), &tally, MCU_TYPE_PLA); |
| 3208 | 3210 | ||
| 3211 | usb_autopm_put_interface(tp->intf); | ||
| 3212 | |||
| 3209 | data[0] = le64_to_cpu(tally.tx_packets); | 3213 | data[0] = le64_to_cpu(tally.tx_packets); |
| 3210 | data[1] = le64_to_cpu(tally.rx_packets); | 3214 | data[1] = le64_to_cpu(tally.rx_packets); |
| 3211 | data[2] = le64_to_cpu(tally.tx_errors); | 3215 | data[2] = le64_to_cpu(tally.tx_errors); |
diff --git a/drivers/net/usb/smsc95xx.c b/drivers/net/usb/smsc95xx.c index 424db65e4396..d07bf4cb893f 100644 --- a/drivers/net/usb/smsc95xx.c +++ b/drivers/net/usb/smsc95xx.c | |||
| @@ -1714,6 +1714,18 @@ static int smsc95xx_resume(struct usb_interface *intf) | |||
| 1714 | return ret; | 1714 | return ret; |
| 1715 | } | 1715 | } |
| 1716 | 1716 | ||
| 1717 | static int smsc95xx_reset_resume(struct usb_interface *intf) | ||
| 1718 | { | ||
| 1719 | struct usbnet *dev = usb_get_intfdata(intf); | ||
| 1720 | int ret; | ||
| 1721 | |||
| 1722 | ret = smsc95xx_reset(dev); | ||
| 1723 | if (ret < 0) | ||
| 1724 | return ret; | ||
| 1725 | |||
| 1726 | return smsc95xx_resume(intf); | ||
| 1727 | } | ||
| 1728 | |||
| 1717 | static void smsc95xx_rx_csum_offload(struct sk_buff *skb) | 1729 | static void smsc95xx_rx_csum_offload(struct sk_buff *skb) |
| 1718 | { | 1730 | { |
| 1719 | skb->csum = *(u16 *)(skb_tail_pointer(skb) - 2); | 1731 | skb->csum = *(u16 *)(skb_tail_pointer(skb) - 2); |
| @@ -2004,7 +2016,7 @@ static struct usb_driver smsc95xx_driver = { | |||
| 2004 | .probe = usbnet_probe, | 2016 | .probe = usbnet_probe, |
| 2005 | .suspend = smsc95xx_suspend, | 2017 | .suspend = smsc95xx_suspend, |
| 2006 | .resume = smsc95xx_resume, | 2018 | .resume = smsc95xx_resume, |
| 2007 | .reset_resume = smsc95xx_resume, | 2019 | .reset_resume = smsc95xx_reset_resume, |
| 2008 | .disconnect = usbnet_disconnect, | 2020 | .disconnect = usbnet_disconnect, |
| 2009 | .disable_hub_initiated_lpm = 1, | 2021 | .disable_hub_initiated_lpm = 1, |
| 2010 | .supports_autosuspend = 1, | 2022 | .supports_autosuspend = 1, |
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/vxlan.c b/drivers/net/vxlan.c index ade33ef82823..9f79192c9aa0 100644 --- a/drivers/net/vxlan.c +++ b/drivers/net/vxlan.c | |||
| @@ -339,7 +339,7 @@ static int vxlan_fdb_info(struct sk_buff *skb, struct vxlan_dev *vxlan, | |||
| 339 | ndm->ndm_state = fdb->state; | 339 | ndm->ndm_state = fdb->state; |
| 340 | ndm->ndm_ifindex = vxlan->dev->ifindex; | 340 | ndm->ndm_ifindex = vxlan->dev->ifindex; |
| 341 | ndm->ndm_flags = fdb->flags; | 341 | ndm->ndm_flags = fdb->flags; |
| 342 | ndm->ndm_type = NDA_DST; | 342 | ndm->ndm_type = RTN_UNICAST; |
| 343 | 343 | ||
| 344 | if (send_eth && nla_put(skb, NDA_LLADDR, ETH_ALEN, &fdb->eth_addr)) | 344 | if (send_eth && nla_put(skb, NDA_LLADDR, ETH_ALEN, &fdb->eth_addr)) |
| 345 | goto nla_put_failure; | 345 | goto nla_put_failure; |
diff --git a/drivers/net/wan/farsync.c b/drivers/net/wan/farsync.c index 93ace042d0aa..1f041271f7fe 100644 --- a/drivers/net/wan/farsync.c +++ b/drivers/net/wan/farsync.c | |||
| @@ -2363,7 +2363,7 @@ static char *type_strings[] = { | |||
| 2363 | "FarSync TE1" | 2363 | "FarSync TE1" |
| 2364 | }; | 2364 | }; |
| 2365 | 2365 | ||
| 2366 | static void | 2366 | static int |
| 2367 | fst_init_card(struct fst_card_info *card) | 2367 | fst_init_card(struct fst_card_info *card) |
| 2368 | { | 2368 | { |
| 2369 | int i; | 2369 | int i; |
| @@ -2374,24 +2374,21 @@ fst_init_card(struct fst_card_info *card) | |||
| 2374 | * we'll have to revise it in some way then. | 2374 | * we'll have to revise it in some way then. |
| 2375 | */ | 2375 | */ |
| 2376 | for (i = 0; i < card->nports; i++) { | 2376 | for (i = 0; i < card->nports; i++) { |
| 2377 | err = register_hdlc_device(card->ports[i].dev); | 2377 | err = register_hdlc_device(card->ports[i].dev); |
| 2378 | if (err < 0) { | 2378 | if (err < 0) { |
| 2379 | int j; | ||
| 2380 | pr_err("Cannot register HDLC device for port %d (errno %d)\n", | 2379 | pr_err("Cannot register HDLC device for port %d (errno %d)\n", |
| 2381 | i, -err); | 2380 | i, -err); |
| 2382 | for (j = i; j < card->nports; j++) { | 2381 | while (i--) |
| 2383 | free_netdev(card->ports[j].dev); | 2382 | unregister_hdlc_device(card->ports[i].dev); |
| 2384 | card->ports[j].dev = NULL; | 2383 | return err; |
| 2385 | } | 2384 | } |
| 2386 | card->nports = i; | ||
| 2387 | break; | ||
| 2388 | } | ||
| 2389 | } | 2385 | } |
| 2390 | 2386 | ||
| 2391 | pr_info("%s-%s: %s IRQ%d, %d ports\n", | 2387 | pr_info("%s-%s: %s IRQ%d, %d ports\n", |
| 2392 | port_to_dev(&card->ports[0])->name, | 2388 | port_to_dev(&card->ports[0])->name, |
| 2393 | port_to_dev(&card->ports[card->nports - 1])->name, | 2389 | port_to_dev(&card->ports[card->nports - 1])->name, |
| 2394 | type_strings[card->type], card->irq, card->nports); | 2390 | type_strings[card->type], card->irq, card->nports); |
| 2391 | return 0; | ||
| 2395 | } | 2392 | } |
| 2396 | 2393 | ||
| 2397 | static const struct net_device_ops fst_ops = { | 2394 | static const struct net_device_ops fst_ops = { |
| @@ -2447,15 +2444,12 @@ fst_add_one(struct pci_dev *pdev, const struct pci_device_id *ent) | |||
| 2447 | /* Try to enable the device */ | 2444 | /* Try to enable the device */ |
| 2448 | if ((err = pci_enable_device(pdev)) != 0) { | 2445 | if ((err = pci_enable_device(pdev)) != 0) { |
| 2449 | pr_err("Failed to enable card. Err %d\n", -err); | 2446 | pr_err("Failed to enable card. Err %d\n", -err); |
| 2450 | kfree(card); | 2447 | goto enable_fail; |
| 2451 | return err; | ||
| 2452 | } | 2448 | } |
| 2453 | 2449 | ||
| 2454 | if ((err = pci_request_regions(pdev, "FarSync")) !=0) { | 2450 | if ((err = pci_request_regions(pdev, "FarSync")) !=0) { |
| 2455 | pr_err("Failed to allocate regions. Err %d\n", -err); | 2451 | pr_err("Failed to allocate regions. Err %d\n", -err); |
| 2456 | pci_disable_device(pdev); | 2452 | goto regions_fail; |
| 2457 | kfree(card); | ||
| 2458 | return err; | ||
| 2459 | } | 2453 | } |
| 2460 | 2454 | ||
| 2461 | /* Get virtual addresses of memory regions */ | 2455 | /* Get virtual addresses of memory regions */ |
| @@ -2464,30 +2458,21 @@ fst_add_one(struct pci_dev *pdev, const struct pci_device_id *ent) | |||
| 2464 | card->phys_ctlmem = pci_resource_start(pdev, 3); | 2458 | card->phys_ctlmem = pci_resource_start(pdev, 3); |
| 2465 | if ((card->mem = ioremap(card->phys_mem, FST_MEMSIZE)) == NULL) { | 2459 | if ((card->mem = ioremap(card->phys_mem, FST_MEMSIZE)) == NULL) { |
| 2466 | pr_err("Physical memory remap failed\n"); | 2460 | pr_err("Physical memory remap failed\n"); |
| 2467 | pci_release_regions(pdev); | 2461 | err = -ENODEV; |
| 2468 | pci_disable_device(pdev); | 2462 | goto ioremap_physmem_fail; |
| 2469 | kfree(card); | ||
| 2470 | return -ENODEV; | ||
| 2471 | } | 2463 | } |
| 2472 | if ((card->ctlmem = ioremap(card->phys_ctlmem, 0x10)) == NULL) { | 2464 | if ((card->ctlmem = ioremap(card->phys_ctlmem, 0x10)) == NULL) { |
| 2473 | pr_err("Control memory remap failed\n"); | 2465 | pr_err("Control memory remap failed\n"); |
| 2474 | pci_release_regions(pdev); | 2466 | err = -ENODEV; |
| 2475 | pci_disable_device(pdev); | 2467 | goto ioremap_ctlmem_fail; |
| 2476 | iounmap(card->mem); | ||
| 2477 | kfree(card); | ||
| 2478 | return -ENODEV; | ||
| 2479 | } | 2468 | } |
| 2480 | dbg(DBG_PCI, "kernel mem %p, ctlmem %p\n", card->mem, card->ctlmem); | 2469 | dbg(DBG_PCI, "kernel mem %p, ctlmem %p\n", card->mem, card->ctlmem); |
| 2481 | 2470 | ||
| 2482 | /* Register the interrupt handler */ | 2471 | /* Register the interrupt handler */ |
| 2483 | if (request_irq(pdev->irq, fst_intr, IRQF_SHARED, FST_DEV_NAME, card)) { | 2472 | if (request_irq(pdev->irq, fst_intr, IRQF_SHARED, FST_DEV_NAME, card)) { |
| 2484 | pr_err("Unable to register interrupt %d\n", card->irq); | 2473 | pr_err("Unable to register interrupt %d\n", card->irq); |
| 2485 | pci_release_regions(pdev); | 2474 | err = -ENODEV; |
| 2486 | pci_disable_device(pdev); | 2475 | goto irq_fail; |
| 2487 | iounmap(card->ctlmem); | ||
| 2488 | iounmap(card->mem); | ||
| 2489 | kfree(card); | ||
| 2490 | return -ENODEV; | ||
| 2491 | } | 2476 | } |
| 2492 | 2477 | ||
| 2493 | /* Record info we need */ | 2478 | /* Record info we need */ |
| @@ -2513,13 +2498,8 @@ fst_add_one(struct pci_dev *pdev, const struct pci_device_id *ent) | |||
| 2513 | while (i--) | 2498 | while (i--) |
| 2514 | free_netdev(card->ports[i].dev); | 2499 | free_netdev(card->ports[i].dev); |
| 2515 | pr_err("FarSync: out of memory\n"); | 2500 | pr_err("FarSync: out of memory\n"); |
| 2516 | free_irq(card->irq, card); | 2501 | err = -ENOMEM; |
| 2517 | pci_release_regions(pdev); | 2502 | goto hdlcdev_fail; |
| 2518 | pci_disable_device(pdev); | ||
| 2519 | iounmap(card->ctlmem); | ||
| 2520 | iounmap(card->mem); | ||
| 2521 | kfree(card); | ||
| 2522 | return -ENODEV; | ||
| 2523 | } | 2503 | } |
| 2524 | card->ports[i].dev = dev; | 2504 | card->ports[i].dev = dev; |
| 2525 | card->ports[i].card = card; | 2505 | card->ports[i].card = card; |
| @@ -2565,9 +2545,16 @@ fst_add_one(struct pci_dev *pdev, const struct pci_device_id *ent) | |||
| 2565 | pci_set_drvdata(pdev, card); | 2545 | pci_set_drvdata(pdev, card); |
| 2566 | 2546 | ||
| 2567 | /* Remainder of card setup */ | 2547 | /* Remainder of card setup */ |
| 2548 | if (no_of_cards_added >= FST_MAX_CARDS) { | ||
| 2549 | pr_err("FarSync: too many cards\n"); | ||
| 2550 | err = -ENOMEM; | ||
| 2551 | goto card_array_fail; | ||
| 2552 | } | ||
| 2568 | fst_card_array[no_of_cards_added] = card; | 2553 | fst_card_array[no_of_cards_added] = card; |
| 2569 | card->card_no = no_of_cards_added++; /* Record instance and bump it */ | 2554 | card->card_no = no_of_cards_added++; /* Record instance and bump it */ |
| 2570 | fst_init_card(card); | 2555 | err = fst_init_card(card); |
| 2556 | if (err) | ||
| 2557 | goto init_card_fail; | ||
| 2571 | if (card->family == FST_FAMILY_TXU) { | 2558 | if (card->family == FST_FAMILY_TXU) { |
| 2572 | /* | 2559 | /* |
| 2573 | * Allocate a dma buffer for transmit and receives | 2560 | * Allocate a dma buffer for transmit and receives |
| @@ -2577,29 +2564,46 @@ fst_add_one(struct pci_dev *pdev, const struct pci_device_id *ent) | |||
| 2577 | &card->rx_dma_handle_card); | 2564 | &card->rx_dma_handle_card); |
| 2578 | if (card->rx_dma_handle_host == NULL) { | 2565 | if (card->rx_dma_handle_host == NULL) { |
| 2579 | pr_err("Could not allocate rx dma buffer\n"); | 2566 | pr_err("Could not allocate rx dma buffer\n"); |
| 2580 | fst_disable_intr(card); | 2567 | err = -ENOMEM; |
| 2581 | pci_release_regions(pdev); | 2568 | goto rx_dma_fail; |
| 2582 | pci_disable_device(pdev); | ||
| 2583 | iounmap(card->ctlmem); | ||
| 2584 | iounmap(card->mem); | ||
| 2585 | kfree(card); | ||
| 2586 | return -ENOMEM; | ||
| 2587 | } | 2569 | } |
| 2588 | card->tx_dma_handle_host = | 2570 | card->tx_dma_handle_host = |
| 2589 | pci_alloc_consistent(card->device, FST_MAX_MTU, | 2571 | pci_alloc_consistent(card->device, FST_MAX_MTU, |
| 2590 | &card->tx_dma_handle_card); | 2572 | &card->tx_dma_handle_card); |
| 2591 | if (card->tx_dma_handle_host == NULL) { | 2573 | if (card->tx_dma_handle_host == NULL) { |
| 2592 | pr_err("Could not allocate tx dma buffer\n"); | 2574 | pr_err("Could not allocate tx dma buffer\n"); |
| 2593 | fst_disable_intr(card); | 2575 | err = -ENOMEM; |
| 2594 | pci_release_regions(pdev); | 2576 | goto tx_dma_fail; |
| 2595 | pci_disable_device(pdev); | ||
| 2596 | iounmap(card->ctlmem); | ||
| 2597 | iounmap(card->mem); | ||
| 2598 | kfree(card); | ||
| 2599 | return -ENOMEM; | ||
| 2600 | } | 2577 | } |
| 2601 | } | 2578 | } |
| 2602 | return 0; /* Success */ | 2579 | return 0; /* Success */ |
| 2580 | |||
| 2581 | tx_dma_fail: | ||
| 2582 | pci_free_consistent(card->device, FST_MAX_MTU, | ||
| 2583 | card->rx_dma_handle_host, | ||
| 2584 | card->rx_dma_handle_card); | ||
| 2585 | rx_dma_fail: | ||
| 2586 | fst_disable_intr(card); | ||
| 2587 | for (i = 0 ; i < card->nports ; i++) | ||
| 2588 | unregister_hdlc_device(card->ports[i].dev); | ||
| 2589 | init_card_fail: | ||
| 2590 | fst_card_array[card->card_no] = NULL; | ||
| 2591 | card_array_fail: | ||
| 2592 | for (i = 0 ; i < card->nports ; i++) | ||
| 2593 | free_netdev(card->ports[i].dev); | ||
| 2594 | hdlcdev_fail: | ||
| 2595 | free_irq(card->irq, card); | ||
| 2596 | irq_fail: | ||
| 2597 | iounmap(card->ctlmem); | ||
| 2598 | ioremap_ctlmem_fail: | ||
| 2599 | iounmap(card->mem); | ||
| 2600 | ioremap_physmem_fail: | ||
| 2601 | pci_release_regions(pdev); | ||
| 2602 | regions_fail: | ||
| 2603 | pci_disable_device(pdev); | ||
| 2604 | enable_fail: | ||
| 2605 | kfree(card); | ||
| 2606 | return err; | ||
| 2603 | } | 2607 | } |
| 2604 | 2608 | ||
| 2605 | /* | 2609 | /* |
diff --git a/drivers/net/wan/x25_asy.c b/drivers/net/wan/x25_asy.c index 5895f1978691..fa9fdfa128c1 100644 --- a/drivers/net/wan/x25_asy.c +++ b/drivers/net/wan/x25_asy.c | |||
| @@ -122,8 +122,12 @@ static int x25_asy_change_mtu(struct net_device *dev, int newmtu) | |||
| 122 | { | 122 | { |
| 123 | struct x25_asy *sl = netdev_priv(dev); | 123 | struct x25_asy *sl = netdev_priv(dev); |
| 124 | unsigned char *xbuff, *rbuff; | 124 | unsigned char *xbuff, *rbuff; |
| 125 | int len = 2 * newmtu; | 125 | int len; |
| 126 | 126 | ||
| 127 | if (newmtu > 65534) | ||
| 128 | return -EINVAL; | ||
| 129 | |||
| 130 | len = 2 * newmtu; | ||
| 127 | xbuff = kmalloc(len + 4, GFP_ATOMIC); | 131 | xbuff = kmalloc(len + 4, GFP_ATOMIC); |
| 128 | rbuff = kmalloc(len + 4, GFP_ATOMIC); | 132 | rbuff = kmalloc(len + 4, GFP_ATOMIC); |
| 129 | 133 | ||
diff --git a/drivers/net/wireless/ath/ath10k/core.c b/drivers/net/wireless/ath/ath10k/core.c index 82017f56e661..e6c56c5bb0f6 100644 --- a/drivers/net/wireless/ath/ath10k/core.c +++ b/drivers/net/wireless/ath/ath10k/core.c | |||
| @@ -795,7 +795,11 @@ int ath10k_core_start(struct ath10k *ar) | |||
| 795 | if (status) | 795 | if (status) |
| 796 | goto err_htc_stop; | 796 | goto err_htc_stop; |
| 797 | 797 | ||
| 798 | ar->free_vdev_map = (1 << TARGET_NUM_VDEVS) - 1; | 798 | if (test_bit(ATH10K_FW_FEATURE_WMI_10X, ar->fw_features)) |
| 799 | ar->free_vdev_map = (1 << TARGET_10X_NUM_VDEVS) - 1; | ||
| 800 | else | ||
| 801 | ar->free_vdev_map = (1 << TARGET_NUM_VDEVS) - 1; | ||
| 802 | |||
| 799 | INIT_LIST_HEAD(&ar->arvifs); | 803 | INIT_LIST_HEAD(&ar->arvifs); |
| 800 | 804 | ||
| 801 | if (!test_bit(ATH10K_FLAG_FIRST_BOOT_DONE, &ar->dev_flags)) | 805 | if (!test_bit(ATH10K_FLAG_FIRST_BOOT_DONE, &ar->dev_flags)) |
diff --git a/drivers/net/wireless/ath/ath10k/htt_rx.c b/drivers/net/wireless/ath/ath10k/htt_rx.c index 6c102b1312ff..eebc860c3655 100644 --- a/drivers/net/wireless/ath/ath10k/htt_rx.c +++ b/drivers/net/wireless/ath/ath10k/htt_rx.c | |||
| @@ -312,7 +312,6 @@ static int ath10k_htt_rx_amsdu_pop(struct ath10k_htt *htt, | |||
| 312 | int msdu_len, msdu_chaining = 0; | 312 | int msdu_len, msdu_chaining = 0; |
| 313 | struct sk_buff *msdu; | 313 | struct sk_buff *msdu; |
| 314 | struct htt_rx_desc *rx_desc; | 314 | struct htt_rx_desc *rx_desc; |
| 315 | bool corrupted = false; | ||
| 316 | 315 | ||
| 317 | lockdep_assert_held(&htt->rx_ring.lock); | 316 | lockdep_assert_held(&htt->rx_ring.lock); |
| 318 | 317 | ||
| @@ -439,9 +438,6 @@ static int ath10k_htt_rx_amsdu_pop(struct ath10k_htt *htt, | |||
| 439 | last_msdu = __le32_to_cpu(rx_desc->msdu_end.info0) & | 438 | last_msdu = __le32_to_cpu(rx_desc->msdu_end.info0) & |
| 440 | RX_MSDU_END_INFO0_LAST_MSDU; | 439 | RX_MSDU_END_INFO0_LAST_MSDU; |
| 441 | 440 | ||
| 442 | if (msdu_chaining && !last_msdu) | ||
| 443 | corrupted = true; | ||
| 444 | |||
| 445 | if (last_msdu) { | 441 | if (last_msdu) { |
| 446 | msdu->next = NULL; | 442 | msdu->next = NULL; |
| 447 | break; | 443 | break; |
| @@ -457,20 +453,6 @@ static int ath10k_htt_rx_amsdu_pop(struct ath10k_htt *htt, | |||
| 457 | msdu_chaining = -1; | 453 | msdu_chaining = -1; |
| 458 | 454 | ||
| 459 | /* | 455 | /* |
| 460 | * Apparently FW sometimes reports weird chained MSDU sequences with | ||
| 461 | * more than one rx descriptor. This seems like a bug but needs more | ||
| 462 | * analyzing. For the time being fix it by dropping such sequences to | ||
| 463 | * avoid blowing up the host system. | ||
| 464 | */ | ||
| 465 | if (corrupted) { | ||
| 466 | ath10k_warn("failed to pop chained msdus, dropping\n"); | ||
| 467 | ath10k_htt_rx_free_msdu_chain(*head_msdu); | ||
| 468 | *head_msdu = NULL; | ||
| 469 | *tail_msdu = NULL; | ||
| 470 | msdu_chaining = -EINVAL; | ||
| 471 | } | ||
| 472 | |||
| 473 | /* | ||
| 474 | * Don't refill the ring yet. | 456 | * Don't refill the ring yet. |
| 475 | * | 457 | * |
| 476 | * First, the elements popped here are still in use - it is not | 458 | * First, the elements popped here are still in use - it is not |
diff --git a/drivers/net/wireless/ath/ath9k/xmit.c b/drivers/net/wireless/ath/ath9k/xmit.c index 66acb2cbd9df..7c28cb55610b 100644 --- a/drivers/net/wireless/ath/ath9k/xmit.c +++ b/drivers/net/wireless/ath/ath9k/xmit.c | |||
| @@ -887,6 +887,15 @@ ath_tx_get_tid_subframe(struct ath_softc *sc, struct ath_txq *txq, | |||
| 887 | 887 | ||
| 888 | tx_info = IEEE80211_SKB_CB(skb); | 888 | tx_info = IEEE80211_SKB_CB(skb); |
| 889 | tx_info->flags &= ~IEEE80211_TX_CTL_CLEAR_PS_FILT; | 889 | tx_info->flags &= ~IEEE80211_TX_CTL_CLEAR_PS_FILT; |
| 890 | |||
| 891 | /* | ||
| 892 | * No aggregation session is running, but there may be frames | ||
| 893 | * from a previous session or a failed attempt in the queue. | ||
| 894 | * Send them out as normal data frames | ||
| 895 | */ | ||
| 896 | if (!tid->active) | ||
| 897 | tx_info->flags &= ~IEEE80211_TX_CTL_AMPDU; | ||
| 898 | |||
| 890 | if (!(tx_info->flags & IEEE80211_TX_CTL_AMPDU)) { | 899 | if (!(tx_info->flags & IEEE80211_TX_CTL_AMPDU)) { |
| 891 | bf->bf_state.bf_type = 0; | 900 | bf->bf_state.bf_type = 0; |
| 892 | return bf; | 901 | return bf; |
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/brcm80211/brcmfmac/usb.c b/drivers/net/wireless/brcm80211/brcmfmac/usb.c index 6db51a666f61..d06fcb05adf2 100644 --- a/drivers/net/wireless/brcm80211/brcmfmac/usb.c +++ b/drivers/net/wireless/brcm80211/brcmfmac/usb.c | |||
| @@ -1184,8 +1184,6 @@ static int brcmf_usb_probe_cb(struct brcmf_usbdev_info *devinfo) | |||
| 1184 | bus->bus_priv.usb = bus_pub; | 1184 | bus->bus_priv.usb = bus_pub; |
| 1185 | dev_set_drvdata(dev, bus); | 1185 | dev_set_drvdata(dev, bus); |
| 1186 | bus->ops = &brcmf_usb_bus_ops; | 1186 | bus->ops = &brcmf_usb_bus_ops; |
| 1187 | bus->chip = bus_pub->devid; | ||
| 1188 | bus->chiprev = bus_pub->chiprev; | ||
| 1189 | bus->proto_type = BRCMF_PROTO_BCDC; | 1187 | bus->proto_type = BRCMF_PROTO_BCDC; |
| 1190 | bus->always_use_fws_queue = true; | 1188 | bus->always_use_fws_queue = true; |
| 1191 | 1189 | ||
| @@ -1194,6 +1192,9 @@ static int brcmf_usb_probe_cb(struct brcmf_usbdev_info *devinfo) | |||
| 1194 | if (ret) | 1192 | if (ret) |
| 1195 | goto fail; | 1193 | goto fail; |
| 1196 | } | 1194 | } |
| 1195 | bus->chip = bus_pub->devid; | ||
| 1196 | bus->chiprev = bus_pub->chiprev; | ||
| 1197 | |||
| 1197 | /* request firmware here */ | 1198 | /* request firmware here */ |
| 1198 | brcmf_fw_get_firmwares(dev, 0, brcmf_usb_get_fwname(devinfo), NULL, | 1199 | brcmf_fw_get_firmwares(dev, 0, brcmf_usb_get_fwname(devinfo), NULL, |
| 1199 | brcmf_usb_probe_phase2); | 1200 | brcmf_usb_probe_phase2); |
diff --git a/drivers/net/wireless/iwlwifi/dvm/rxon.c b/drivers/net/wireless/iwlwifi/dvm/rxon.c index ed50de6362ed..6dc5dd3ced44 100644 --- a/drivers/net/wireless/iwlwifi/dvm/rxon.c +++ b/drivers/net/wireless/iwlwifi/dvm/rxon.c | |||
| @@ -1068,13 +1068,6 @@ int iwlagn_commit_rxon(struct iwl_priv *priv, struct iwl_rxon_context *ctx) | |||
| 1068 | /* recalculate basic rates */ | 1068 | /* recalculate basic rates */ |
| 1069 | iwl_calc_basic_rates(priv, ctx); | 1069 | iwl_calc_basic_rates(priv, ctx); |
| 1070 | 1070 | ||
| 1071 | /* | ||
| 1072 | * force CTS-to-self frames protection if RTS-CTS is not preferred | ||
| 1073 | * one aggregation protection method | ||
| 1074 | */ | ||
| 1075 | if (!priv->hw_params.use_rts_for_aggregation) | ||
| 1076 | ctx->staging.flags |= RXON_FLG_SELF_CTS_EN; | ||
| 1077 | |||
| 1078 | if ((ctx->vif && ctx->vif->bss_conf.use_short_slot) || | 1071 | if ((ctx->vif && ctx->vif->bss_conf.use_short_slot) || |
| 1079 | !(ctx->staging.flags & RXON_FLG_BAND_24G_MSK)) | 1072 | !(ctx->staging.flags & RXON_FLG_BAND_24G_MSK)) |
| 1080 | ctx->staging.flags |= RXON_FLG_SHORT_SLOT_MSK; | 1073 | ctx->staging.flags |= RXON_FLG_SHORT_SLOT_MSK; |
| @@ -1480,11 +1473,6 @@ void iwlagn_bss_info_changed(struct ieee80211_hw *hw, | |||
| 1480 | else | 1473 | else |
| 1481 | ctx->staging.flags &= ~RXON_FLG_TGG_PROTECT_MSK; | 1474 | ctx->staging.flags &= ~RXON_FLG_TGG_PROTECT_MSK; |
| 1482 | 1475 | ||
| 1483 | if (bss_conf->use_cts_prot) | ||
| 1484 | ctx->staging.flags |= RXON_FLG_SELF_CTS_EN; | ||
| 1485 | else | ||
| 1486 | ctx->staging.flags &= ~RXON_FLG_SELF_CTS_EN; | ||
| 1487 | |||
| 1488 | memcpy(ctx->staging.bssid_addr, bss_conf->bssid, ETH_ALEN); | 1476 | memcpy(ctx->staging.bssid_addr, bss_conf->bssid, ETH_ALEN); |
| 1489 | 1477 | ||
| 1490 | if (vif->type == NL80211_IFTYPE_AP || | 1478 | if (vif->type == NL80211_IFTYPE_AP || |
diff --git a/drivers/net/wireless/iwlwifi/iwl-fw.h b/drivers/net/wireless/iwlwifi/iwl-fw.h index 0aa7c0085c9f..b1a33322b9ba 100644 --- a/drivers/net/wireless/iwlwifi/iwl-fw.h +++ b/drivers/net/wireless/iwlwifi/iwl-fw.h | |||
| @@ -88,6 +88,7 @@ | |||
| 88 | * P2P client interfaces simultaneously if they are in different bindings. | 88 | * P2P client interfaces simultaneously if they are in different bindings. |
| 89 | * @IWL_UCODE_TLV_FLAGS_P2P_BSS_PS_SCM: support power save on BSS station and | 89 | * @IWL_UCODE_TLV_FLAGS_P2P_BSS_PS_SCM: support power save on BSS station and |
| 90 | * P2P client interfaces simultaneously if they are in same bindings. | 90 | * P2P client interfaces simultaneously if they are in same bindings. |
| 91 | * @IWL_UCODE_TLV_FLAGS_UAPSD_SUPPORT: General support for uAPSD | ||
| 91 | * @IWL_UCODE_TLV_FLAGS_P2P_PS_UAPSD: P2P client supports uAPSD power save | 92 | * @IWL_UCODE_TLV_FLAGS_P2P_PS_UAPSD: P2P client supports uAPSD power save |
| 92 | * @IWL_UCODE_TLV_FLAGS_BCAST_FILTERING: uCode supports broadcast filtering. | 93 | * @IWL_UCODE_TLV_FLAGS_BCAST_FILTERING: uCode supports broadcast filtering. |
| 93 | * @IWL_UCODE_TLV_FLAGS_GO_UAPSD: AP/GO interfaces support uAPSD clients | 94 | * @IWL_UCODE_TLV_FLAGS_GO_UAPSD: AP/GO interfaces support uAPSD clients |
diff --git a/drivers/net/wireless/iwlwifi/mvm/mac-ctxt.c b/drivers/net/wireless/iwlwifi/mvm/mac-ctxt.c index 8b5302777632..8b79081d4885 100644 --- a/drivers/net/wireless/iwlwifi/mvm/mac-ctxt.c +++ b/drivers/net/wireless/iwlwifi/mvm/mac-ctxt.c | |||
| @@ -667,10 +667,9 @@ static void iwl_mvm_mac_ctxt_cmd_common(struct iwl_mvm *mvm, | |||
| 667 | if (vif->bss_conf.qos) | 667 | if (vif->bss_conf.qos) |
| 668 | cmd->qos_flags |= cpu_to_le32(MAC_QOS_FLG_UPDATE_EDCA); | 668 | cmd->qos_flags |= cpu_to_le32(MAC_QOS_FLG_UPDATE_EDCA); |
| 669 | 669 | ||
| 670 | if (vif->bss_conf.use_cts_prot) { | 670 | if (vif->bss_conf.use_cts_prot) |
| 671 | cmd->protection_flags |= cpu_to_le32(MAC_PROT_FLG_TGG_PROTECT); | 671 | cmd->protection_flags |= cpu_to_le32(MAC_PROT_FLG_TGG_PROTECT); |
| 672 | cmd->protection_flags |= cpu_to_le32(MAC_PROT_FLG_SELF_CTS_EN); | 672 | |
| 673 | } | ||
| 674 | IWL_DEBUG_RATE(mvm, "use_cts_prot %d, ht_operation_mode %d\n", | 673 | IWL_DEBUG_RATE(mvm, "use_cts_prot %d, ht_operation_mode %d\n", |
| 675 | vif->bss_conf.use_cts_prot, | 674 | vif->bss_conf.use_cts_prot, |
| 676 | vif->bss_conf.ht_operation_mode); | 675 | vif->bss_conf.ht_operation_mode); |
| @@ -1073,8 +1072,12 @@ static int iwl_mvm_mac_ctxt_cmd_ap(struct iwl_mvm *mvm, | |||
| 1073 | /* Fill the common data for all mac context types */ | 1072 | /* Fill the common data for all mac context types */ |
| 1074 | iwl_mvm_mac_ctxt_cmd_common(mvm, vif, &cmd, action); | 1073 | iwl_mvm_mac_ctxt_cmd_common(mvm, vif, &cmd, action); |
| 1075 | 1074 | ||
| 1076 | /* Also enable probe requests to pass */ | 1075 | /* |
| 1077 | cmd.filter_flags |= cpu_to_le32(MAC_FILTER_IN_PROBE_REQUEST); | 1076 | * pass probe requests and beacons from other APs (needed |
| 1077 | * for ht protection) | ||
| 1078 | */ | ||
| 1079 | cmd.filter_flags |= cpu_to_le32(MAC_FILTER_IN_PROBE_REQUEST | | ||
| 1080 | MAC_FILTER_IN_BEACON); | ||
| 1078 | 1081 | ||
| 1079 | /* Fill the data specific for ap mode */ | 1082 | /* Fill the data specific for ap mode */ |
| 1080 | iwl_mvm_mac_ctxt_cmd_fill_ap(mvm, vif, &cmd.ap, | 1083 | iwl_mvm_mac_ctxt_cmd_fill_ap(mvm, vif, &cmd.ap, |
| @@ -1095,6 +1098,13 @@ static int iwl_mvm_mac_ctxt_cmd_go(struct iwl_mvm *mvm, | |||
| 1095 | /* Fill the common data for all mac context types */ | 1098 | /* Fill the common data for all mac context types */ |
| 1096 | iwl_mvm_mac_ctxt_cmd_common(mvm, vif, &cmd, action); | 1099 | iwl_mvm_mac_ctxt_cmd_common(mvm, vif, &cmd, action); |
| 1097 | 1100 | ||
| 1101 | /* | ||
| 1102 | * pass probe requests and beacons from other APs (needed | ||
| 1103 | * for ht protection) | ||
| 1104 | */ | ||
| 1105 | cmd.filter_flags |= cpu_to_le32(MAC_FILTER_IN_PROBE_REQUEST | | ||
| 1106 | MAC_FILTER_IN_BEACON); | ||
| 1107 | |||
| 1098 | /* Fill the data specific for GO mode */ | 1108 | /* Fill the data specific for GO mode */ |
| 1099 | iwl_mvm_mac_ctxt_cmd_fill_ap(mvm, vif, &cmd.go.ap, | 1109 | iwl_mvm_mac_ctxt_cmd_fill_ap(mvm, vif, &cmd.go.ap, |
| 1100 | action == FW_CTXT_ACTION_ADD); | 1110 | action == FW_CTXT_ACTION_ADD); |
diff --git a/drivers/net/wireless/iwlwifi/mvm/mac80211.c b/drivers/net/wireless/iwlwifi/mvm/mac80211.c index 7215f5980186..98556d03c1ed 100644 --- a/drivers/net/wireless/iwlwifi/mvm/mac80211.c +++ b/drivers/net/wireless/iwlwifi/mvm/mac80211.c | |||
| @@ -1159,8 +1159,12 @@ static void iwl_mvm_bcast_filter_iterator(void *_data, u8 *mac, | |||
| 1159 | 1159 | ||
| 1160 | bcast_mac = &cmd->macs[mvmvif->id]; | 1160 | bcast_mac = &cmd->macs[mvmvif->id]; |
| 1161 | 1161 | ||
| 1162 | /* enable filtering only for associated stations */ | 1162 | /* |
| 1163 | if (vif->type != NL80211_IFTYPE_STATION || !vif->bss_conf.assoc) | 1163 | * enable filtering only for associated stations, but not for P2P |
| 1164 | * Clients | ||
| 1165 | */ | ||
| 1166 | if (vif->type != NL80211_IFTYPE_STATION || vif->p2p || | ||
| 1167 | !vif->bss_conf.assoc) | ||
| 1164 | return; | 1168 | return; |
| 1165 | 1169 | ||
| 1166 | bcast_mac->default_discard = 1; | 1170 | bcast_mac->default_discard = 1; |
| @@ -1237,10 +1241,6 @@ static int iwl_mvm_configure_bcast_filter(struct iwl_mvm *mvm, | |||
| 1237 | if (!(mvm->fw->ucode_capa.flags & IWL_UCODE_TLV_FLAGS_BCAST_FILTERING)) | 1241 | if (!(mvm->fw->ucode_capa.flags & IWL_UCODE_TLV_FLAGS_BCAST_FILTERING)) |
| 1238 | return 0; | 1242 | return 0; |
| 1239 | 1243 | ||
| 1240 | /* bcast filtering isn't supported for P2P client */ | ||
| 1241 | if (vif->p2p) | ||
| 1242 | return 0; | ||
| 1243 | |||
| 1244 | if (!iwl_mvm_bcast_filter_build_cmd(mvm, &cmd)) | 1244 | if (!iwl_mvm_bcast_filter_build_cmd(mvm, &cmd)) |
| 1245 | return 0; | 1245 | return 0; |
| 1246 | 1246 | ||
diff --git a/drivers/net/wireless/iwlwifi/mvm/scan.c b/drivers/net/wireless/iwlwifi/mvm/scan.c index 4b6c7d4bd199..eac2b424f6a0 100644 --- a/drivers/net/wireless/iwlwifi/mvm/scan.c +++ b/drivers/net/wireless/iwlwifi/mvm/scan.c | |||
| @@ -588,9 +588,7 @@ static void iwl_build_scan_cmd(struct iwl_mvm *mvm, | |||
| 588 | struct iwl_scan_offload_cmd *scan, | 588 | struct iwl_scan_offload_cmd *scan, |
| 589 | struct iwl_mvm_scan_params *params) | 589 | struct iwl_mvm_scan_params *params) |
| 590 | { | 590 | { |
| 591 | scan->channel_count = | 591 | scan->channel_count = req->n_channels; |
| 592 | mvm->nvm_data->bands[IEEE80211_BAND_2GHZ].n_channels + | ||
| 593 | mvm->nvm_data->bands[IEEE80211_BAND_5GHZ].n_channels; | ||
| 594 | scan->quiet_time = cpu_to_le16(IWL_ACTIVE_QUIET_TIME); | 592 | scan->quiet_time = cpu_to_le16(IWL_ACTIVE_QUIET_TIME); |
| 595 | scan->quiet_plcp_th = cpu_to_le16(IWL_PLCP_QUIET_THRESH); | 593 | scan->quiet_plcp_th = cpu_to_le16(IWL_PLCP_QUIET_THRESH); |
| 596 | scan->good_CRC_th = IWL_GOOD_CRC_TH_DEFAULT; | 594 | scan->good_CRC_th = IWL_GOOD_CRC_TH_DEFAULT; |
| @@ -669,61 +667,37 @@ static void iwl_build_channel_cfg(struct iwl_mvm *mvm, | |||
| 669 | struct cfg80211_sched_scan_request *req, | 667 | struct cfg80211_sched_scan_request *req, |
| 670 | struct iwl_scan_channel_cfg *channels, | 668 | struct iwl_scan_channel_cfg *channels, |
| 671 | enum ieee80211_band band, | 669 | enum ieee80211_band band, |
| 672 | int *head, int *tail, | 670 | int *head, |
| 673 | u32 ssid_bitmap, | 671 | u32 ssid_bitmap, |
| 674 | struct iwl_mvm_scan_params *params) | 672 | struct iwl_mvm_scan_params *params) |
| 675 | { | 673 | { |
| 676 | struct ieee80211_supported_band *s_band; | 674 | int i, index = 0; |
| 677 | int n_channels = req->n_channels; | ||
| 678 | int i, j, index = 0; | ||
| 679 | bool partial; | ||
| 680 | 675 | ||
| 681 | /* | 676 | for (i = 0; i < req->n_channels; i++) { |
| 682 | * We have to configure all supported channels, even if we don't want to | 677 | struct ieee80211_channel *chan = req->channels[i]; |
| 683 | * scan on them, but we have to send channels in the order that we want | 678 | |
| 684 | * to scan. So add requested channels to head of the list and others to | 679 | if (chan->band != band) |
| 685 | * the end. | 680 | continue; |
| 686 | */ | 681 | |
| 687 | s_band = &mvm->nvm_data->bands[band]; | 682 | index = *head; |
| 688 | 683 | (*head)++; | |
| 689 | for (i = 0; i < s_band->n_channels && *head <= *tail; i++) { | 684 | |
| 690 | partial = false; | 685 | channels->channel_number[index] = cpu_to_le16(chan->hw_value); |
| 691 | for (j = 0; j < n_channels; j++) | ||
| 692 | if (s_band->channels[i].center_freq == | ||
| 693 | req->channels[j]->center_freq) { | ||
| 694 | index = *head; | ||
| 695 | (*head)++; | ||
| 696 | /* | ||
| 697 | * Channels that came with the request will be | ||
| 698 | * in partial scan . | ||
| 699 | */ | ||
| 700 | partial = true; | ||
| 701 | break; | ||
| 702 | } | ||
| 703 | if (!partial) { | ||
| 704 | index = *tail; | ||
| 705 | (*tail)--; | ||
| 706 | } | ||
| 707 | channels->channel_number[index] = | ||
| 708 | cpu_to_le16(ieee80211_frequency_to_channel( | ||
| 709 | s_band->channels[i].center_freq)); | ||
| 710 | channels->dwell_time[index][0] = params->dwell[band].active; | 686 | channels->dwell_time[index][0] = params->dwell[band].active; |
| 711 | channels->dwell_time[index][1] = params->dwell[band].passive; | 687 | channels->dwell_time[index][1] = params->dwell[band].passive; |
| 712 | 688 | ||
| 713 | channels->iter_count[index] = cpu_to_le16(1); | 689 | channels->iter_count[index] = cpu_to_le16(1); |
| 714 | channels->iter_interval[index] = 0; | 690 | channels->iter_interval[index] = 0; |
| 715 | 691 | ||
| 716 | if (!(s_band->channels[i].flags & IEEE80211_CHAN_NO_IR)) | 692 | if (!(chan->flags & IEEE80211_CHAN_NO_IR)) |
| 717 | channels->type[index] |= | 693 | channels->type[index] |= |
| 718 | cpu_to_le32(IWL_SCAN_OFFLOAD_CHANNEL_ACTIVE); | 694 | cpu_to_le32(IWL_SCAN_OFFLOAD_CHANNEL_ACTIVE); |
| 719 | 695 | ||
| 720 | channels->type[index] |= | 696 | channels->type[index] |= |
| 721 | cpu_to_le32(IWL_SCAN_OFFLOAD_CHANNEL_FULL); | 697 | cpu_to_le32(IWL_SCAN_OFFLOAD_CHANNEL_FULL | |
| 722 | if (partial) | 698 | IWL_SCAN_OFFLOAD_CHANNEL_PARTIAL); |
| 723 | channels->type[index] |= | ||
| 724 | cpu_to_le32(IWL_SCAN_OFFLOAD_CHANNEL_PARTIAL); | ||
| 725 | 699 | ||
| 726 | if (s_band->channels[i].flags & IEEE80211_CHAN_NO_HT40) | 700 | if (chan->flags & IEEE80211_CHAN_NO_HT40) |
| 727 | channels->type[index] |= | 701 | channels->type[index] |= |
| 728 | cpu_to_le32(IWL_SCAN_OFFLOAD_CHANNEL_NARROW); | 702 | cpu_to_le32(IWL_SCAN_OFFLOAD_CHANNEL_NARROW); |
| 729 | 703 | ||
| @@ -740,7 +714,6 @@ int iwl_mvm_config_sched_scan(struct iwl_mvm *mvm, | |||
| 740 | int band_2ghz = mvm->nvm_data->bands[IEEE80211_BAND_2GHZ].n_channels; | 714 | int band_2ghz = mvm->nvm_data->bands[IEEE80211_BAND_2GHZ].n_channels; |
| 741 | int band_5ghz = mvm->nvm_data->bands[IEEE80211_BAND_5GHZ].n_channels; | 715 | int band_5ghz = mvm->nvm_data->bands[IEEE80211_BAND_5GHZ].n_channels; |
| 742 | int head = 0; | 716 | int head = 0; |
| 743 | int tail = band_2ghz + band_5ghz - 1; | ||
| 744 | u32 ssid_bitmap; | 717 | u32 ssid_bitmap; |
| 745 | int cmd_len; | 718 | int cmd_len; |
| 746 | int ret; | 719 | int ret; |
| @@ -772,7 +745,7 @@ int iwl_mvm_config_sched_scan(struct iwl_mvm *mvm, | |||
| 772 | &scan_cfg->scan_cmd.tx_cmd[0], | 745 | &scan_cfg->scan_cmd.tx_cmd[0], |
| 773 | scan_cfg->data); | 746 | scan_cfg->data); |
| 774 | iwl_build_channel_cfg(mvm, req, &scan_cfg->channel_cfg, | 747 | iwl_build_channel_cfg(mvm, req, &scan_cfg->channel_cfg, |
| 775 | IEEE80211_BAND_2GHZ, &head, &tail, | 748 | IEEE80211_BAND_2GHZ, &head, |
| 776 | ssid_bitmap, ¶ms); | 749 | ssid_bitmap, ¶ms); |
| 777 | } | 750 | } |
| 778 | if (band_5ghz) { | 751 | if (band_5ghz) { |
| @@ -782,7 +755,7 @@ int iwl_mvm_config_sched_scan(struct iwl_mvm *mvm, | |||
| 782 | scan_cfg->data + | 755 | scan_cfg->data + |
| 783 | SCAN_OFFLOAD_PROBE_REQ_SIZE); | 756 | SCAN_OFFLOAD_PROBE_REQ_SIZE); |
| 784 | iwl_build_channel_cfg(mvm, req, &scan_cfg->channel_cfg, | 757 | iwl_build_channel_cfg(mvm, req, &scan_cfg->channel_cfg, |
| 785 | IEEE80211_BAND_5GHZ, &head, &tail, | 758 | IEEE80211_BAND_5GHZ, &head, |
| 786 | ssid_bitmap, ¶ms); | 759 | ssid_bitmap, ¶ms); |
| 787 | } | 760 | } |
| 788 | 761 | ||
diff --git a/drivers/net/wireless/iwlwifi/pcie/drv.c b/drivers/net/wireless/iwlwifi/pcie/drv.c index 7091a18d5a72..98950e45c7b0 100644 --- a/drivers/net/wireless/iwlwifi/pcie/drv.c +++ b/drivers/net/wireless/iwlwifi/pcie/drv.c | |||
| @@ -367,6 +367,7 @@ static DEFINE_PCI_DEVICE_TABLE(iwl_hw_card_ids) = { | |||
| 367 | {IWL_PCI_DEVICE(0x095A, 0x5012, iwl7265_2ac_cfg)}, | 367 | {IWL_PCI_DEVICE(0x095A, 0x5012, iwl7265_2ac_cfg)}, |
| 368 | {IWL_PCI_DEVICE(0x095A, 0x5412, iwl7265_2ac_cfg)}, | 368 | {IWL_PCI_DEVICE(0x095A, 0x5412, iwl7265_2ac_cfg)}, |
| 369 | {IWL_PCI_DEVICE(0x095A, 0x5410, iwl7265_2ac_cfg)}, | 369 | {IWL_PCI_DEVICE(0x095A, 0x5410, iwl7265_2ac_cfg)}, |
| 370 | {IWL_PCI_DEVICE(0x095A, 0x5510, iwl7265_2ac_cfg)}, | ||
| 370 | {IWL_PCI_DEVICE(0x095A, 0x5400, iwl7265_2ac_cfg)}, | 371 | {IWL_PCI_DEVICE(0x095A, 0x5400, iwl7265_2ac_cfg)}, |
| 371 | {IWL_PCI_DEVICE(0x095A, 0x1010, iwl7265_2ac_cfg)}, | 372 | {IWL_PCI_DEVICE(0x095A, 0x1010, iwl7265_2ac_cfg)}, |
| 372 | {IWL_PCI_DEVICE(0x095A, 0x5000, iwl7265_2n_cfg)}, | 373 | {IWL_PCI_DEVICE(0x095A, 0x5000, iwl7265_2n_cfg)}, |
| @@ -380,7 +381,7 @@ static DEFINE_PCI_DEVICE_TABLE(iwl_hw_card_ids) = { | |||
| 380 | {IWL_PCI_DEVICE(0x095A, 0x9110, iwl7265_2ac_cfg)}, | 381 | {IWL_PCI_DEVICE(0x095A, 0x9110, iwl7265_2ac_cfg)}, |
| 381 | {IWL_PCI_DEVICE(0x095A, 0x9112, iwl7265_2ac_cfg)}, | 382 | {IWL_PCI_DEVICE(0x095A, 0x9112, iwl7265_2ac_cfg)}, |
| 382 | {IWL_PCI_DEVICE(0x095A, 0x9210, iwl7265_2ac_cfg)}, | 383 | {IWL_PCI_DEVICE(0x095A, 0x9210, iwl7265_2ac_cfg)}, |
| 383 | {IWL_PCI_DEVICE(0x095A, 0x9200, iwl7265_2ac_cfg)}, | 384 | {IWL_PCI_DEVICE(0x095B, 0x9200, iwl7265_2ac_cfg)}, |
| 384 | {IWL_PCI_DEVICE(0x095A, 0x9510, iwl7265_2ac_cfg)}, | 385 | {IWL_PCI_DEVICE(0x095A, 0x9510, iwl7265_2ac_cfg)}, |
| 385 | {IWL_PCI_DEVICE(0x095A, 0x9310, iwl7265_2ac_cfg)}, | 386 | {IWL_PCI_DEVICE(0x095A, 0x9310, iwl7265_2ac_cfg)}, |
| 386 | {IWL_PCI_DEVICE(0x095A, 0x9410, iwl7265_2ac_cfg)}, | 387 | {IWL_PCI_DEVICE(0x095A, 0x9410, iwl7265_2ac_cfg)}, |
diff --git a/drivers/net/wireless/mwifiex/11n_aggr.c b/drivers/net/wireless/mwifiex/11n_aggr.c index 5b32106182f8..fe0f66f73507 100644 --- a/drivers/net/wireless/mwifiex/11n_aggr.c +++ b/drivers/net/wireless/mwifiex/11n_aggr.c | |||
| @@ -185,6 +185,7 @@ mwifiex_11n_aggregate_pkt(struct mwifiex_private *priv, | |||
| 185 | skb_reserve(skb_aggr, headroom + sizeof(struct txpd)); | 185 | skb_reserve(skb_aggr, headroom + sizeof(struct txpd)); |
| 186 | tx_info_aggr = MWIFIEX_SKB_TXCB(skb_aggr); | 186 | tx_info_aggr = MWIFIEX_SKB_TXCB(skb_aggr); |
| 187 | 187 | ||
| 188 | memset(tx_info_aggr, 0, sizeof(*tx_info_aggr)); | ||
| 188 | tx_info_aggr->bss_type = tx_info_src->bss_type; | 189 | tx_info_aggr->bss_type = tx_info_src->bss_type; |
| 189 | tx_info_aggr->bss_num = tx_info_src->bss_num; | 190 | tx_info_aggr->bss_num = tx_info_src->bss_num; |
| 190 | 191 | ||
diff --git a/drivers/net/wireless/mwifiex/cfg80211.c b/drivers/net/wireless/mwifiex/cfg80211.c index e95dec91a561..b511613bba2d 100644 --- a/drivers/net/wireless/mwifiex/cfg80211.c +++ b/drivers/net/wireless/mwifiex/cfg80211.c | |||
| @@ -220,6 +220,7 @@ mwifiex_cfg80211_mgmt_tx(struct wiphy *wiphy, struct wireless_dev *wdev, | |||
| 220 | } | 220 | } |
| 221 | 221 | ||
| 222 | tx_info = MWIFIEX_SKB_TXCB(skb); | 222 | tx_info = MWIFIEX_SKB_TXCB(skb); |
| 223 | memset(tx_info, 0, sizeof(*tx_info)); | ||
| 223 | tx_info->bss_num = priv->bss_num; | 224 | tx_info->bss_num = priv->bss_num; |
| 224 | tx_info->bss_type = priv->bss_type; | 225 | tx_info->bss_type = priv->bss_type; |
| 225 | tx_info->pkt_len = pkt_len; | 226 | tx_info->pkt_len = pkt_len; |
diff --git a/drivers/net/wireless/mwifiex/cmdevt.c b/drivers/net/wireless/mwifiex/cmdevt.c index 8dee6c86f4f1..c161141f6c39 100644 --- a/drivers/net/wireless/mwifiex/cmdevt.c +++ b/drivers/net/wireless/mwifiex/cmdevt.c | |||
| @@ -453,6 +453,7 @@ int mwifiex_process_event(struct mwifiex_adapter *adapter) | |||
| 453 | 453 | ||
| 454 | if (skb) { | 454 | if (skb) { |
| 455 | rx_info = MWIFIEX_SKB_RXCB(skb); | 455 | rx_info = MWIFIEX_SKB_RXCB(skb); |
| 456 | memset(rx_info, 0, sizeof(*rx_info)); | ||
| 456 | rx_info->bss_num = priv->bss_num; | 457 | rx_info->bss_num = priv->bss_num; |
| 457 | rx_info->bss_type = priv->bss_type; | 458 | rx_info->bss_type = priv->bss_type; |
| 458 | } | 459 | } |
diff --git a/drivers/net/wireless/mwifiex/main.c b/drivers/net/wireless/mwifiex/main.c index cbabc12fbda3..e91cd0fa5ca8 100644 --- a/drivers/net/wireless/mwifiex/main.c +++ b/drivers/net/wireless/mwifiex/main.c | |||
| @@ -645,6 +645,7 @@ mwifiex_hard_start_xmit(struct sk_buff *skb, struct net_device *dev) | |||
| 645 | } | 645 | } |
| 646 | 646 | ||
| 647 | tx_info = MWIFIEX_SKB_TXCB(skb); | 647 | tx_info = MWIFIEX_SKB_TXCB(skb); |
| 648 | memset(tx_info, 0, sizeof(*tx_info)); | ||
| 648 | tx_info->bss_num = priv->bss_num; | 649 | tx_info->bss_num = priv->bss_num; |
| 649 | tx_info->bss_type = priv->bss_type; | 650 | tx_info->bss_type = priv->bss_type; |
| 650 | tx_info->pkt_len = skb->len; | 651 | tx_info->pkt_len = skb->len; |
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/sta_tx.c b/drivers/net/wireless/mwifiex/sta_tx.c index 5fce7e78a36e..70eb863c7249 100644 --- a/drivers/net/wireless/mwifiex/sta_tx.c +++ b/drivers/net/wireless/mwifiex/sta_tx.c | |||
| @@ -150,6 +150,7 @@ int mwifiex_send_null_packet(struct mwifiex_private *priv, u8 flags) | |||
| 150 | return -1; | 150 | return -1; |
| 151 | 151 | ||
| 152 | tx_info = MWIFIEX_SKB_TXCB(skb); | 152 | tx_info = MWIFIEX_SKB_TXCB(skb); |
| 153 | memset(tx_info, 0, sizeof(*tx_info)); | ||
| 153 | tx_info->bss_num = priv->bss_num; | 154 | tx_info->bss_num = priv->bss_num; |
| 154 | tx_info->bss_type = priv->bss_type; | 155 | tx_info->bss_type = priv->bss_type; |
| 155 | tx_info->pkt_len = data_len - (sizeof(struct txpd) + INTF_HEADER_LEN); | 156 | tx_info->pkt_len = data_len - (sizeof(struct txpd) + INTF_HEADER_LEN); |
diff --git a/drivers/net/wireless/mwifiex/tdls.c b/drivers/net/wireless/mwifiex/tdls.c index e73034fbbde9..0e88364e0c67 100644 --- a/drivers/net/wireless/mwifiex/tdls.c +++ b/drivers/net/wireless/mwifiex/tdls.c | |||
| @@ -605,6 +605,7 @@ int mwifiex_send_tdls_data_frame(struct mwifiex_private *priv, const u8 *peer, | |||
| 605 | } | 605 | } |
| 606 | 606 | ||
| 607 | tx_info = MWIFIEX_SKB_TXCB(skb); | 607 | tx_info = MWIFIEX_SKB_TXCB(skb); |
| 608 | memset(tx_info, 0, sizeof(*tx_info)); | ||
| 608 | tx_info->bss_num = priv->bss_num; | 609 | tx_info->bss_num = priv->bss_num; |
| 609 | tx_info->bss_type = priv->bss_type; | 610 | tx_info->bss_type = priv->bss_type; |
| 610 | 611 | ||
| @@ -760,6 +761,7 @@ int mwifiex_send_tdls_action_frame(struct mwifiex_private *priv, const u8 *peer, | |||
| 760 | skb->priority = MWIFIEX_PRIO_VI; | 761 | skb->priority = MWIFIEX_PRIO_VI; |
| 761 | 762 | ||
| 762 | tx_info = MWIFIEX_SKB_TXCB(skb); | 763 | tx_info = MWIFIEX_SKB_TXCB(skb); |
| 764 | memset(tx_info, 0, sizeof(*tx_info)); | ||
| 763 | tx_info->bss_num = priv->bss_num; | 765 | tx_info->bss_num = priv->bss_num; |
| 764 | tx_info->bss_type = priv->bss_type; | 766 | tx_info->bss_type = priv->bss_type; |
| 765 | tx_info->flags |= MWIFIEX_BUF_FLAG_TDLS_PKT; | 767 | tx_info->flags |= MWIFIEX_BUF_FLAG_TDLS_PKT; |
diff --git a/drivers/net/wireless/mwifiex/txrx.c b/drivers/net/wireless/mwifiex/txrx.c index 37f26afd4314..fd7e5b9b4581 100644 --- a/drivers/net/wireless/mwifiex/txrx.c +++ b/drivers/net/wireless/mwifiex/txrx.c | |||
| @@ -55,6 +55,7 @@ int mwifiex_handle_rx_packet(struct mwifiex_adapter *adapter, | |||
| 55 | return -1; | 55 | return -1; |
| 56 | } | 56 | } |
| 57 | 57 | ||
| 58 | memset(rx_info, 0, sizeof(*rx_info)); | ||
| 58 | rx_info->bss_num = priv->bss_num; | 59 | rx_info->bss_num = priv->bss_num; |
| 59 | rx_info->bss_type = priv->bss_type; | 60 | rx_info->bss_type = priv->bss_type; |
| 60 | 61 | ||
diff --git a/drivers/net/wireless/mwifiex/uap_txrx.c b/drivers/net/wireless/mwifiex/uap_txrx.c index 9a56bc61cb1d..b0601b91cc4f 100644 --- a/drivers/net/wireless/mwifiex/uap_txrx.c +++ b/drivers/net/wireless/mwifiex/uap_txrx.c | |||
| @@ -175,6 +175,7 @@ static void mwifiex_uap_queue_bridged_pkt(struct mwifiex_private *priv, | |||
| 175 | } | 175 | } |
| 176 | 176 | ||
| 177 | tx_info = MWIFIEX_SKB_TXCB(skb); | 177 | tx_info = MWIFIEX_SKB_TXCB(skb); |
| 178 | memset(tx_info, 0, sizeof(*tx_info)); | ||
| 178 | tx_info->bss_num = priv->bss_num; | 179 | tx_info->bss_num = priv->bss_num; |
| 179 | tx_info->bss_type = priv->bss_type; | 180 | tx_info->bss_type = priv->bss_type; |
| 180 | tx_info->flags |= MWIFIEX_BUF_FLAG_BRIDGED_PKT; | 181 | tx_info->flags |= MWIFIEX_BUF_FLAG_BRIDGED_PKT; |
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..832006b5aab1 100644 --- a/drivers/net/wireless/rt2x00/rt2800usb.c +++ b/drivers/net/wireless/rt2x00/rt2800usb.c | |||
| @@ -229,6 +229,31 @@ 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 | reg = kmalloc(sizeof(*reg), GFP_KERNEL); | ||
| 238 | if (reg == NULL) | ||
| 239 | return -ENOMEM; | ||
| 240 | /* cannot use rt2x00usb_register_read here as it uses different | ||
| 241 | * mode (MULTI_READ vs. DEVICE_MODE) and does not pass the | ||
| 242 | * magic value USB_MODE_AUTORUN (0x11) to the device, thus the | ||
| 243 | * returned value would be invalid. | ||
| 244 | */ | ||
| 245 | rt2x00usb_vendor_request(rt2x00dev, USB_DEVICE_MODE, | ||
| 246 | USB_VENDOR_REQUEST_IN, 0, USB_MODE_AUTORUN, | ||
| 247 | reg, sizeof(*reg), REGISTER_TIMEOUT_FIRMWARE); | ||
| 248 | fw_mode = le32_to_cpu(*reg); | ||
| 249 | kfree(reg); | ||
| 250 | |||
| 251 | if ((fw_mode & 0x00000003) == 2) | ||
| 252 | return 1; | ||
| 253 | |||
| 254 | return 0; | ||
| 255 | } | ||
| 256 | |||
| 232 | static char *rt2800usb_get_firmware_name(struct rt2x00_dev *rt2x00dev) | 257 | static char *rt2800usb_get_firmware_name(struct rt2x00_dev *rt2x00dev) |
| 233 | { | 258 | { |
| 234 | return FIRMWARE_RT2870; | 259 | return FIRMWARE_RT2870; |
| @@ -240,6 +265,7 @@ static int rt2800usb_write_firmware(struct rt2x00_dev *rt2x00dev, | |||
| 240 | int status; | 265 | int status; |
| 241 | u32 offset; | 266 | u32 offset; |
| 242 | u32 length; | 267 | u32 length; |
| 268 | int retval; | ||
| 243 | 269 | ||
| 244 | /* | 270 | /* |
| 245 | * Check which section of the firmware we need. | 271 | * Check which section of the firmware we need. |
| @@ -257,8 +283,16 @@ static int rt2800usb_write_firmware(struct rt2x00_dev *rt2x00dev, | |||
| 257 | /* | 283 | /* |
| 258 | * Write firmware to device. | 284 | * Write firmware to device. |
| 259 | */ | 285 | */ |
| 260 | rt2x00usb_register_multiwrite(rt2x00dev, FIRMWARE_IMAGE_BASE, | 286 | retval = rt2800usb_autorun_detect(rt2x00dev); |
| 261 | data + offset, length); | 287 | if (retval < 0) |
| 288 | return retval; | ||
| 289 | if (retval) { | ||
| 290 | rt2x00_info(rt2x00dev, | ||
| 291 | "Firmware loading not required - NIC in AutoRun mode\n"); | ||
| 292 | } else { | ||
| 293 | rt2x00usb_register_multiwrite(rt2x00dev, FIRMWARE_IMAGE_BASE, | ||
| 294 | data + offset, length); | ||
| 295 | } | ||
| 262 | 296 | ||
| 263 | rt2x00usb_register_write(rt2x00dev, H2M_MAILBOX_CID, ~0); | 297 | rt2x00usb_register_write(rt2x00dev, H2M_MAILBOX_CID, ~0); |
| 264 | rt2x00usb_register_write(rt2x00dev, H2M_MAILBOX_STATUS, ~0); | 298 | rt2x00usb_register_write(rt2x00dev, H2M_MAILBOX_STATUS, ~0); |
| @@ -735,11 +769,26 @@ static void rt2800usb_fill_rxdone(struct queue_entry *entry, | |||
| 735 | /* | 769 | /* |
| 736 | * Device probe functions. | 770 | * Device probe functions. |
| 737 | */ | 771 | */ |
| 772 | static int rt2800usb_efuse_detect(struct rt2x00_dev *rt2x00dev) | ||
| 773 | { | ||
| 774 | int retval; | ||
| 775 | |||
| 776 | retval = rt2800usb_autorun_detect(rt2x00dev); | ||
| 777 | if (retval < 0) | ||
| 778 | return retval; | ||
| 779 | if (retval) | ||
| 780 | return 1; | ||
| 781 | return rt2800_efuse_detect(rt2x00dev); | ||
| 782 | } | ||
| 783 | |||
| 738 | static int rt2800usb_read_eeprom(struct rt2x00_dev *rt2x00dev) | 784 | static int rt2800usb_read_eeprom(struct rt2x00_dev *rt2x00dev) |
| 739 | { | 785 | { |
| 740 | int retval; | 786 | int retval; |
| 741 | 787 | ||
| 742 | if (rt2800_efuse_detect(rt2x00dev)) | 788 | retval = rt2800usb_efuse_detect(rt2x00dev); |
| 789 | if (retval < 0) | ||
| 790 | return retval; | ||
| 791 | if (retval) | ||
| 743 | retval = rt2800_read_eeprom_efuse(rt2x00dev); | 792 | retval = rt2800_read_eeprom_efuse(rt2x00dev); |
| 744 | else | 793 | else |
| 745 | retval = rt2x00usb_eeprom_read(rt2x00dev, rt2x00dev->eeprom, | 794 | 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/netback.c b/drivers/net/xen-netback/netback.c index 1844a47636b6..c65b636bcab9 100644 --- a/drivers/net/xen-netback/netback.c +++ b/drivers/net/xen-netback/netback.c | |||
| @@ -1030,14 +1030,21 @@ static int xenvif_tx_check_gop(struct xenvif_queue *queue, | |||
| 1030 | { | 1030 | { |
| 1031 | struct gnttab_map_grant_ref *gop_map = *gopp_map; | 1031 | struct gnttab_map_grant_ref *gop_map = *gopp_map; |
| 1032 | u16 pending_idx = XENVIF_TX_CB(skb)->pending_idx; | 1032 | u16 pending_idx = XENVIF_TX_CB(skb)->pending_idx; |
| 1033 | /* This always points to the shinfo of the skb being checked, which | ||
| 1034 | * could be either the first or the one on the frag_list | ||
| 1035 | */ | ||
| 1033 | struct skb_shared_info *shinfo = skb_shinfo(skb); | 1036 | struct skb_shared_info *shinfo = skb_shinfo(skb); |
| 1037 | /* If this is non-NULL, we are currently checking the frag_list skb, and | ||
| 1038 | * this points to the shinfo of the first one | ||
| 1039 | */ | ||
| 1040 | struct skb_shared_info *first_shinfo = NULL; | ||
| 1034 | int nr_frags = shinfo->nr_frags; | 1041 | int nr_frags = shinfo->nr_frags; |
| 1042 | const bool sharedslot = nr_frags && | ||
| 1043 | frag_get_pending_idx(&shinfo->frags[0]) == pending_idx; | ||
| 1035 | int i, err; | 1044 | int i, err; |
| 1036 | struct sk_buff *first_skb = NULL; | ||
| 1037 | 1045 | ||
| 1038 | /* Check status of header. */ | 1046 | /* Check status of header. */ |
| 1039 | err = (*gopp_copy)->status; | 1047 | err = (*gopp_copy)->status; |
| 1040 | (*gopp_copy)++; | ||
| 1041 | if (unlikely(err)) { | 1048 | if (unlikely(err)) { |
| 1042 | if (net_ratelimit()) | 1049 | if (net_ratelimit()) |
| 1043 | netdev_dbg(queue->vif->dev, | 1050 | netdev_dbg(queue->vif->dev, |
| @@ -1045,8 +1052,12 @@ static int xenvif_tx_check_gop(struct xenvif_queue *queue, | |||
| 1045 | (*gopp_copy)->status, | 1052 | (*gopp_copy)->status, |
| 1046 | pending_idx, | 1053 | pending_idx, |
| 1047 | (*gopp_copy)->source.u.ref); | 1054 | (*gopp_copy)->source.u.ref); |
| 1048 | xenvif_idx_release(queue, pending_idx, XEN_NETIF_RSP_ERROR); | 1055 | /* The first frag might still have this slot mapped */ |
| 1056 | if (!sharedslot) | ||
| 1057 | xenvif_idx_release(queue, pending_idx, | ||
| 1058 | XEN_NETIF_RSP_ERROR); | ||
| 1049 | } | 1059 | } |
| 1060 | (*gopp_copy)++; | ||
| 1050 | 1061 | ||
| 1051 | check_frags: | 1062 | check_frags: |
| 1052 | for (i = 0; i < nr_frags; i++, gop_map++) { | 1063 | for (i = 0; i < nr_frags; i++, gop_map++) { |
| @@ -1062,8 +1073,19 @@ check_frags: | |||
| 1062 | pending_idx, | 1073 | pending_idx, |
| 1063 | gop_map->handle); | 1074 | gop_map->handle); |
| 1064 | /* Had a previous error? Invalidate this fragment. */ | 1075 | /* Had a previous error? Invalidate this fragment. */ |
| 1065 | if (unlikely(err)) | 1076 | if (unlikely(err)) { |
| 1066 | xenvif_idx_unmap(queue, pending_idx); | 1077 | xenvif_idx_unmap(queue, pending_idx); |
| 1078 | /* If the mapping of the first frag was OK, but | ||
| 1079 | * the header's copy failed, and they are | ||
| 1080 | * sharing a slot, send an error | ||
| 1081 | */ | ||
| 1082 | if (i == 0 && sharedslot) | ||
| 1083 | xenvif_idx_release(queue, pending_idx, | ||
| 1084 | XEN_NETIF_RSP_ERROR); | ||
| 1085 | else | ||
| 1086 | xenvif_idx_release(queue, pending_idx, | ||
| 1087 | XEN_NETIF_RSP_OKAY); | ||
| 1088 | } | ||
| 1067 | continue; | 1089 | continue; |
| 1068 | } | 1090 | } |
| 1069 | 1091 | ||
| @@ -1075,42 +1097,53 @@ check_frags: | |||
| 1075 | gop_map->status, | 1097 | gop_map->status, |
| 1076 | pending_idx, | 1098 | pending_idx, |
| 1077 | gop_map->ref); | 1099 | gop_map->ref); |
| 1100 | |||
| 1078 | xenvif_idx_release(queue, pending_idx, XEN_NETIF_RSP_ERROR); | 1101 | xenvif_idx_release(queue, pending_idx, XEN_NETIF_RSP_ERROR); |
| 1079 | 1102 | ||
| 1080 | /* Not the first error? Preceding frags already invalidated. */ | 1103 | /* Not the first error? Preceding frags already invalidated. */ |
| 1081 | if (err) | 1104 | if (err) |
| 1082 | continue; | 1105 | continue; |
| 1083 | /* First error: invalidate preceding fragments. */ | 1106 | |
| 1107 | /* First error: if the header haven't shared a slot with the | ||
| 1108 | * first frag, release it as well. | ||
| 1109 | */ | ||
| 1110 | if (!sharedslot) | ||
| 1111 | xenvif_idx_release(queue, | ||
| 1112 | XENVIF_TX_CB(skb)->pending_idx, | ||
| 1113 | XEN_NETIF_RSP_OKAY); | ||
| 1114 | |||
| 1115 | /* Invalidate preceding fragments of this skb. */ | ||
| 1084 | for (j = 0; j < i; j++) { | 1116 | for (j = 0; j < i; j++) { |
| 1085 | pending_idx = frag_get_pending_idx(&shinfo->frags[j]); | 1117 | pending_idx = frag_get_pending_idx(&shinfo->frags[j]); |
| 1086 | xenvif_idx_unmap(queue, pending_idx); | 1118 | xenvif_idx_unmap(queue, pending_idx); |
| 1119 | xenvif_idx_release(queue, pending_idx, | ||
| 1120 | XEN_NETIF_RSP_OKAY); | ||
| 1121 | } | ||
| 1122 | |||
| 1123 | /* And if we found the error while checking the frag_list, unmap | ||
| 1124 | * the first skb's frags | ||
| 1125 | */ | ||
| 1126 | if (first_shinfo) { | ||
| 1127 | for (j = 0; j < first_shinfo->nr_frags; j++) { | ||
| 1128 | pending_idx = frag_get_pending_idx(&first_shinfo->frags[j]); | ||
| 1129 | xenvif_idx_unmap(queue, pending_idx); | ||
| 1130 | xenvif_idx_release(queue, pending_idx, | ||
| 1131 | XEN_NETIF_RSP_OKAY); | ||
| 1132 | } | ||
| 1087 | } | 1133 | } |
| 1088 | 1134 | ||
| 1089 | /* Remember the error: invalidate all subsequent fragments. */ | 1135 | /* Remember the error: invalidate all subsequent fragments. */ |
| 1090 | err = newerr; | 1136 | err = newerr; |
| 1091 | } | 1137 | } |
| 1092 | 1138 | ||
| 1093 | if (skb_has_frag_list(skb)) { | 1139 | if (skb_has_frag_list(skb) && !first_shinfo) { |
| 1094 | first_skb = skb; | 1140 | first_shinfo = skb_shinfo(skb); |
| 1095 | skb = shinfo->frag_list; | 1141 | shinfo = skb_shinfo(skb_shinfo(skb)->frag_list); |
| 1096 | shinfo = skb_shinfo(skb); | ||
| 1097 | nr_frags = shinfo->nr_frags; | 1142 | nr_frags = shinfo->nr_frags; |
| 1098 | 1143 | ||
| 1099 | goto check_frags; | 1144 | goto check_frags; |
| 1100 | } | 1145 | } |
| 1101 | 1146 | ||
| 1102 | /* There was a mapping error in the frag_list skb. We have to unmap | ||
| 1103 | * the first skb's frags | ||
| 1104 | */ | ||
| 1105 | if (first_skb && err) { | ||
| 1106 | int j; | ||
| 1107 | shinfo = skb_shinfo(first_skb); | ||
| 1108 | for (j = 0; j < shinfo->nr_frags; j++) { | ||
| 1109 | pending_idx = frag_get_pending_idx(&shinfo->frags[j]); | ||
| 1110 | xenvif_idx_unmap(queue, pending_idx); | ||
| 1111 | } | ||
| 1112 | } | ||
| 1113 | |||
| 1114 | *gopp_map = gop_map; | 1147 | *gopp_map = gop_map; |
| 1115 | return err; | 1148 | return err; |
| 1116 | } | 1149 | } |
| @@ -1518,7 +1551,16 @@ static int xenvif_tx_submit(struct xenvif_queue *queue) | |||
| 1518 | 1551 | ||
| 1519 | /* Check the remap error code. */ | 1552 | /* Check the remap error code. */ |
| 1520 | if (unlikely(xenvif_tx_check_gop(queue, skb, &gop_map, &gop_copy))) { | 1553 | if (unlikely(xenvif_tx_check_gop(queue, skb, &gop_map, &gop_copy))) { |
| 1554 | /* If there was an error, xenvif_tx_check_gop is | ||
| 1555 | * expected to release all the frags which were mapped, | ||
| 1556 | * so kfree_skb shouldn't do it again | ||
| 1557 | */ | ||
| 1521 | skb_shinfo(skb)->nr_frags = 0; | 1558 | skb_shinfo(skb)->nr_frags = 0; |
| 1559 | if (skb_has_frag_list(skb)) { | ||
| 1560 | struct sk_buff *nskb = | ||
| 1561 | skb_shinfo(skb)->frag_list; | ||
| 1562 | skb_shinfo(nskb)->nr_frags = 0; | ||
| 1563 | } | ||
| 1522 | kfree_skb(skb); | 1564 | kfree_skb(skb); |
| 1523 | continue; | 1565 | continue; |
| 1524 | } | 1566 | } |
| @@ -1822,8 +1864,6 @@ void xenvif_idx_unmap(struct xenvif_queue *queue, u16 pending_idx) | |||
| 1822 | tx_unmap_op.status); | 1864 | tx_unmap_op.status); |
| 1823 | BUG(); | 1865 | BUG(); |
| 1824 | } | 1866 | } |
| 1825 | |||
| 1826 | xenvif_idx_release(queue, pending_idx, XEN_NETIF_RSP_OKAY); | ||
| 1827 | } | 1867 | } |
| 1828 | 1868 | ||
| 1829 | static inline int rx_work_todo(struct xenvif_queue *queue) | 1869 | static inline int rx_work_todo(struct xenvif_queue *queue) |
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..055222bae6e4 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,16 +1437,12 @@ 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 | ||
| 1442 | netif_carrier_off(info->netdev); | ||
| 1443 | |||
| 1443 | for (i = 0; i < num_queues; ++i) { | 1444 | for (i = 0; i < num_queues; ++i) { |
| 1444 | /* Stop old i/f to prevent errors whilst we rebuild the state. */ | 1445 | struct netfront_queue *queue = &info->queues[i]; |
| 1445 | spin_lock_bh(&queue->rx_lock); | ||
| 1446 | spin_lock_irq(&queue->tx_lock); | ||
| 1447 | netif_carrier_off(queue->info->netdev); | ||
| 1448 | spin_unlock_irq(&queue->tx_lock); | ||
| 1449 | spin_unlock_bh(&queue->rx_lock); | ||
| 1450 | 1446 | ||
| 1451 | if (queue->tx_irq && (queue->tx_irq == queue->rx_irq)) | 1447 | if (queue->tx_irq && (queue->tx_irq == queue->rx_irq)) |
| 1452 | unbind_from_irqhandler(queue->tx_irq, queue); | 1448 | unbind_from_irqhandler(queue->tx_irq, queue); |
| @@ -1457,6 +1453,8 @@ static void xennet_disconnect_backend(struct netfront_info *info) | |||
| 1457 | queue->tx_evtchn = queue->rx_evtchn = 0; | 1453 | queue->tx_evtchn = queue->rx_evtchn = 0; |
| 1458 | queue->tx_irq = queue->rx_irq = 0; | 1454 | queue->tx_irq = queue->rx_irq = 0; |
| 1459 | 1455 | ||
| 1456 | napi_synchronize(&queue->napi); | ||
| 1457 | |||
| 1460 | /* End access and free the pages */ | 1458 | /* End access and free the pages */ |
| 1461 | xennet_end_access(queue->tx_ring_ref, queue->tx.sring); | 1459 | xennet_end_access(queue->tx_ring_ref, queue->tx.sring); |
| 1462 | xennet_end_access(queue->rx_ring_ref, queue->rx.sring); | 1460 | xennet_end_access(queue->rx_ring_ref, queue->rx.sring); |
| @@ -1698,8 +1696,6 @@ static int xennet_init_queue(struct netfront_queue *queue) | |||
| 1698 | goto exit_free_tx; | 1696 | goto exit_free_tx; |
| 1699 | } | 1697 | } |
| 1700 | 1698 | ||
| 1701 | netif_napi_add(queue->info->netdev, &queue->napi, xennet_poll, 64); | ||
| 1702 | |||
| 1703 | return 0; | 1699 | return 0; |
| 1704 | 1700 | ||
| 1705 | exit_free_tx: | 1701 | exit_free_tx: |
| @@ -1790,6 +1786,70 @@ error: | |||
| 1790 | return err; | 1786 | return err; |
| 1791 | } | 1787 | } |
| 1792 | 1788 | ||
| 1789 | static void xennet_destroy_queues(struct netfront_info *info) | ||
| 1790 | { | ||
| 1791 | unsigned int i; | ||
| 1792 | |||
| 1793 | rtnl_lock(); | ||
| 1794 | |||
| 1795 | for (i = 0; i < info->netdev->real_num_tx_queues; i++) { | ||
| 1796 | struct netfront_queue *queue = &info->queues[i]; | ||
| 1797 | |||
| 1798 | if (netif_running(info->netdev)) | ||
| 1799 | napi_disable(&queue->napi); | ||
| 1800 | netif_napi_del(&queue->napi); | ||
| 1801 | } | ||
| 1802 | |||
| 1803 | rtnl_unlock(); | ||
| 1804 | |||
| 1805 | kfree(info->queues); | ||
| 1806 | info->queues = NULL; | ||
| 1807 | } | ||
| 1808 | |||
| 1809 | static int xennet_create_queues(struct netfront_info *info, | ||
| 1810 | unsigned int num_queues) | ||
| 1811 | { | ||
| 1812 | unsigned int i; | ||
| 1813 | int ret; | ||
| 1814 | |||
| 1815 | info->queues = kcalloc(num_queues, sizeof(struct netfront_queue), | ||
| 1816 | GFP_KERNEL); | ||
| 1817 | if (!info->queues) | ||
| 1818 | return -ENOMEM; | ||
| 1819 | |||
| 1820 | rtnl_lock(); | ||
| 1821 | |||
| 1822 | for (i = 0; i < num_queues; i++) { | ||
| 1823 | struct netfront_queue *queue = &info->queues[i]; | ||
| 1824 | |||
| 1825 | queue->id = i; | ||
| 1826 | queue->info = info; | ||
| 1827 | |||
| 1828 | ret = xennet_init_queue(queue); | ||
| 1829 | if (ret < 0) { | ||
| 1830 | dev_warn(&info->netdev->dev, "only created %d queues\n", | ||
| 1831 | num_queues); | ||
| 1832 | num_queues = i; | ||
| 1833 | break; | ||
| 1834 | } | ||
| 1835 | |||
| 1836 | netif_napi_add(queue->info->netdev, &queue->napi, | ||
| 1837 | xennet_poll, 64); | ||
| 1838 | if (netif_running(info->netdev)) | ||
| 1839 | napi_enable(&queue->napi); | ||
| 1840 | } | ||
| 1841 | |||
| 1842 | netif_set_real_num_tx_queues(info->netdev, num_queues); | ||
| 1843 | |||
| 1844 | rtnl_unlock(); | ||
| 1845 | |||
| 1846 | if (num_queues == 0) { | ||
| 1847 | dev_err(&info->netdev->dev, "no queues\n"); | ||
| 1848 | return -EINVAL; | ||
| 1849 | } | ||
| 1850 | return 0; | ||
| 1851 | } | ||
| 1852 | |||
| 1793 | /* Common code used when first setting up, and when resuming. */ | 1853 | /* Common code used when first setting up, and when resuming. */ |
| 1794 | static int talk_to_netback(struct xenbus_device *dev, | 1854 | static int talk_to_netback(struct xenbus_device *dev, |
| 1795 | struct netfront_info *info) | 1855 | struct netfront_info *info) |
| @@ -1826,42 +1886,20 @@ static int talk_to_netback(struct xenbus_device *dev, | |||
| 1826 | goto out; | 1886 | goto out; |
| 1827 | } | 1887 | } |
| 1828 | 1888 | ||
| 1829 | /* Allocate array of queues */ | 1889 | if (info->queues) |
| 1830 | info->queues = kcalloc(num_queues, sizeof(struct netfront_queue), GFP_KERNEL); | 1890 | xennet_destroy_queues(info); |
| 1831 | if (!info->queues) { | 1891 | |
| 1832 | err = -ENOMEM; | 1892 | err = xennet_create_queues(info, num_queues); |
| 1833 | goto out; | 1893 | if (err < 0) |
| 1834 | } | 1894 | goto destroy_ring; |
| 1835 | rtnl_lock(); | ||
| 1836 | netif_set_real_num_tx_queues(info->netdev, num_queues); | ||
| 1837 | rtnl_unlock(); | ||
| 1838 | 1895 | ||
| 1839 | /* Create shared ring, alloc event channel -- for each queue */ | 1896 | /* Create shared ring, alloc event channel -- for each queue */ |
| 1840 | for (i = 0; i < num_queues; ++i) { | 1897 | for (i = 0; i < num_queues; ++i) { |
| 1841 | queue = &info->queues[i]; | 1898 | 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); | 1899 | err = setup_netfront(dev, queue, feature_split_evtchn); |
| 1862 | if (err) { | 1900 | if (err) { |
| 1863 | /* As for xennet_init_queue(), setup_netfront() will tidy | 1901 | /* setup_netfront() will tidy up the current |
| 1864 | * up the current queue on error, but we need to clean up | 1902 | * queue on error, but we need to clean up |
| 1865 | * those already allocated. | 1903 | * those already allocated. |
| 1866 | */ | 1904 | */ |
| 1867 | if (i > 0) { | 1905 | if (i > 0) { |
| @@ -2005,13 +2043,15 @@ static int xennet_connect(struct net_device *dev) | |||
| 2005 | /* By now, the queue structures have been set up */ | 2043 | /* By now, the queue structures have been set up */ |
| 2006 | for (j = 0; j < num_queues; ++j) { | 2044 | for (j = 0; j < num_queues; ++j) { |
| 2007 | queue = &np->queues[j]; | 2045 | queue = &np->queues[j]; |
| 2008 | spin_lock_bh(&queue->rx_lock); | ||
| 2009 | spin_lock_irq(&queue->tx_lock); | ||
| 2010 | 2046 | ||
| 2011 | /* Step 1: Discard all pending TX packet fragments. */ | 2047 | /* Step 1: Discard all pending TX packet fragments. */ |
| 2048 | spin_lock_irq(&queue->tx_lock); | ||
| 2012 | xennet_release_tx_bufs(queue); | 2049 | xennet_release_tx_bufs(queue); |
| 2050 | spin_unlock_irq(&queue->tx_lock); | ||
| 2013 | 2051 | ||
| 2014 | /* Step 2: Rebuild the RX buffer freelist and the RX ring itself. */ | 2052 | /* Step 2: Rebuild the RX buffer freelist and the RX ring itself. */ |
| 2053 | spin_lock_bh(&queue->rx_lock); | ||
| 2054 | |||
| 2015 | for (requeue_idx = 0, i = 0; i < NET_RX_RING_SIZE; i++) { | 2055 | for (requeue_idx = 0, i = 0; i < NET_RX_RING_SIZE; i++) { |
| 2016 | skb_frag_t *frag; | 2056 | skb_frag_t *frag; |
| 2017 | const struct page *page; | 2057 | const struct page *page; |
| @@ -2035,6 +2075,8 @@ static int xennet_connect(struct net_device *dev) | |||
| 2035 | } | 2075 | } |
| 2036 | 2076 | ||
| 2037 | queue->rx.req_prod_pvt = requeue_idx; | 2077 | queue->rx.req_prod_pvt = requeue_idx; |
| 2078 | |||
| 2079 | spin_unlock_bh(&queue->rx_lock); | ||
| 2038 | } | 2080 | } |
| 2039 | 2081 | ||
| 2040 | /* | 2082 | /* |
| @@ -2046,13 +2088,17 @@ static int xennet_connect(struct net_device *dev) | |||
| 2046 | netif_carrier_on(np->netdev); | 2088 | netif_carrier_on(np->netdev); |
| 2047 | for (j = 0; j < num_queues; ++j) { | 2089 | for (j = 0; j < num_queues; ++j) { |
| 2048 | queue = &np->queues[j]; | 2090 | queue = &np->queues[j]; |
| 2091 | |||
| 2049 | notify_remote_via_irq(queue->tx_irq); | 2092 | notify_remote_via_irq(queue->tx_irq); |
| 2050 | if (queue->tx_irq != queue->rx_irq) | 2093 | if (queue->tx_irq != queue->rx_irq) |
| 2051 | notify_remote_via_irq(queue->rx_irq); | 2094 | notify_remote_via_irq(queue->rx_irq); |
| 2052 | xennet_tx_buf_gc(queue); | ||
| 2053 | xennet_alloc_rx_buffers(queue); | ||
| 2054 | 2095 | ||
| 2096 | spin_lock_irq(&queue->tx_lock); | ||
| 2097 | xennet_tx_buf_gc(queue); | ||
| 2055 | spin_unlock_irq(&queue->tx_lock); | 2098 | spin_unlock_irq(&queue->tx_lock); |
| 2099 | |||
| 2100 | spin_lock_bh(&queue->rx_lock); | ||
| 2101 | xennet_alloc_rx_buffers(queue); | ||
| 2056 | spin_unlock_bh(&queue->rx_lock); | 2102 | spin_unlock_bh(&queue->rx_lock); |
| 2057 | } | 2103 | } |
| 2058 | 2104 | ||
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..9aa012e6ea0a 100644 --- a/drivers/of/fdt.c +++ b/drivers/of/fdt.c | |||
| @@ -26,6 +26,54 @@ | |||
| 26 | #include <asm/setup.h> /* for COMMAND_LINE_SIZE */ | 26 | #include <asm/setup.h> /* for COMMAND_LINE_SIZE */ |
| 27 | #include <asm/page.h> | 27 | #include <asm/page.h> |
| 28 | 28 | ||
| 29 | /* | ||
| 30 | * of_fdt_limit_memory - limit the number of regions in the /memory node | ||
| 31 | * @limit: maximum entries | ||
| 32 | * | ||
| 33 | * Adjust the flattened device tree to have at most 'limit' number of | ||
| 34 | * memory entries in the /memory node. This function may be called | ||
| 35 | * any time after initial_boot_param is set. | ||
| 36 | */ | ||
| 37 | void of_fdt_limit_memory(int limit) | ||
| 38 | { | ||
| 39 | int memory; | ||
| 40 | int len; | ||
| 41 | const void *val; | ||
| 42 | int nr_address_cells = OF_ROOT_NODE_ADDR_CELLS_DEFAULT; | ||
| 43 | int nr_size_cells = OF_ROOT_NODE_SIZE_CELLS_DEFAULT; | ||
| 44 | const uint32_t *addr_prop; | ||
| 45 | const uint32_t *size_prop; | ||
| 46 | int root_offset; | ||
| 47 | int cell_size; | ||
| 48 | |||
| 49 | root_offset = fdt_path_offset(initial_boot_params, "/"); | ||
| 50 | if (root_offset < 0) | ||
| 51 | return; | ||
| 52 | |||
| 53 | addr_prop = fdt_getprop(initial_boot_params, root_offset, | ||
| 54 | "#address-cells", NULL); | ||
| 55 | if (addr_prop) | ||
| 56 | nr_address_cells = fdt32_to_cpu(*addr_prop); | ||
| 57 | |||
| 58 | size_prop = fdt_getprop(initial_boot_params, root_offset, | ||
| 59 | "#size-cells", NULL); | ||
| 60 | if (size_prop) | ||
| 61 | nr_size_cells = fdt32_to_cpu(*size_prop); | ||
| 62 | |||
| 63 | cell_size = sizeof(uint32_t)*(nr_address_cells + nr_size_cells); | ||
| 64 | |||
| 65 | memory = fdt_path_offset(initial_boot_params, "/memory"); | ||
| 66 | if (memory > 0) { | ||
| 67 | val = fdt_getprop(initial_boot_params, memory, "reg", &len); | ||
| 68 | if (len > limit*cell_size) { | ||
| 69 | len = limit*cell_size; | ||
| 70 | pr_debug("Limiting number of entries to %d\n", limit); | ||
| 71 | fdt_setprop(initial_boot_params, memory, "reg", val, | ||
| 72 | len); | ||
| 73 | } | ||
| 74 | } | ||
| 75 | } | ||
| 76 | |||
| 29 | /** | 77 | /** |
| 30 | * of_fdt_is_compatible - Return true if given node from the given blob has | 78 | * of_fdt_is_compatible - Return true if given node from the given blob has |
| 31 | * compat in its compatible list | 79 | * compat in its compatible list |
| @@ -880,6 +928,21 @@ void __init __weak early_init_dt_add_memory_arch(u64 base, u64 size) | |||
| 880 | const u64 phys_offset = __pa(PAGE_OFFSET); | 928 | const u64 phys_offset = __pa(PAGE_OFFSET); |
| 881 | base &= PAGE_MASK; | 929 | base &= PAGE_MASK; |
| 882 | size &= PAGE_MASK; | 930 | size &= PAGE_MASK; |
| 931 | |||
| 932 | if (sizeof(phys_addr_t) < sizeof(u64)) { | ||
| 933 | if (base > ULONG_MAX) { | ||
| 934 | pr_warning("Ignoring memory block 0x%llx - 0x%llx\n", | ||
| 935 | base, base + size); | ||
| 936 | return; | ||
| 937 | } | ||
| 938 | |||
| 939 | if (base + size > ULONG_MAX) { | ||
| 940 | pr_warning("Ignoring memory range 0x%lx - 0x%llx\n", | ||
| 941 | ULONG_MAX, base + size); | ||
| 942 | size = ULONG_MAX - base; | ||
| 943 | } | ||
| 944 | } | ||
| 945 | |||
| 883 | if (base + size < phys_offset) { | 946 | if (base + size < phys_offset) { |
| 884 | pr_warning("Ignoring memory block 0x%llx - 0x%llx\n", | 947 | pr_warning("Ignoring memory block 0x%llx - 0x%llx\n", |
| 885 | base, base + size); | 948 | base, base + size); |
| @@ -922,7 +985,7 @@ int __init __weak early_init_dt_reserve_memory_arch(phys_addr_t base, | |||
| 922 | } | 985 | } |
| 923 | #endif | 986 | #endif |
| 924 | 987 | ||
| 925 | bool __init early_init_dt_scan(void *params) | 988 | bool __init early_init_dt_verify(void *params) |
| 926 | { | 989 | { |
| 927 | if (!params) | 990 | if (!params) |
| 928 | return false; | 991 | return false; |
| @@ -936,6 +999,12 @@ bool __init early_init_dt_scan(void *params) | |||
| 936 | return false; | 999 | return false; |
| 937 | } | 1000 | } |
| 938 | 1001 | ||
| 1002 | return true; | ||
| 1003 | } | ||
| 1004 | |||
| 1005 | |||
| 1006 | void __init early_init_dt_scan_nodes(void) | ||
| 1007 | { | ||
| 939 | /* Retrieve various information from the /chosen node */ | 1008 | /* Retrieve various information from the /chosen node */ |
| 940 | of_scan_flat_dt(early_init_dt_scan_chosen, boot_command_line); | 1009 | of_scan_flat_dt(early_init_dt_scan_chosen, boot_command_line); |
| 941 | 1010 | ||
| @@ -944,7 +1013,17 @@ bool __init early_init_dt_scan(void *params) | |||
| 944 | 1013 | ||
| 945 | /* Setup memory, calling early_init_dt_add_memory_arch */ | 1014 | /* Setup memory, calling early_init_dt_add_memory_arch */ |
| 946 | of_scan_flat_dt(early_init_dt_scan_memory, NULL); | 1015 | of_scan_flat_dt(early_init_dt_scan_memory, NULL); |
| 1016 | } | ||
| 1017 | |||
| 1018 | bool __init early_init_dt_scan(void *params) | ||
| 1019 | { | ||
| 1020 | bool status; | ||
| 1021 | |||
| 1022 | status = early_init_dt_verify(params); | ||
| 1023 | if (!status) | ||
| 1024 | return false; | ||
| 947 | 1025 | ||
| 1026 | early_init_dt_scan_nodes(); | ||
| 948 | return true; | 1027 | return true; |
| 949 | } | 1028 | } |
| 950 | 1029 | ||
diff --git a/drivers/of/of_mdio.c b/drivers/of/of_mdio.c index fb4a59830648..401b2453da45 100644 --- a/drivers/of/of_mdio.c +++ b/drivers/of/of_mdio.c | |||
| @@ -182,40 +182,6 @@ int of_mdiobus_register(struct mii_bus *mdio, struct device_node *np) | |||
| 182 | } | 182 | } |
| 183 | EXPORT_SYMBOL(of_mdiobus_register); | 183 | EXPORT_SYMBOL(of_mdiobus_register); |
| 184 | 184 | ||
| 185 | /** | ||
| 186 | * of_mdiobus_link_phydev - Find a device node for a phy | ||
| 187 | * @mdio: pointer to mii_bus structure | ||
| 188 | * @phydev: phydev for which the of_node pointer should be set | ||
| 189 | * | ||
| 190 | * Walk the list of subnodes of a mdio bus and look for a node that matches the | ||
| 191 | * phy's address with its 'reg' property. If found, set the of_node pointer for | ||
| 192 | * the phy. This allows auto-probed pyh devices to be supplied with information | ||
| 193 | * passed in via DT. | ||
| 194 | */ | ||
| 195 | void of_mdiobus_link_phydev(struct mii_bus *mdio, | ||
| 196 | struct phy_device *phydev) | ||
| 197 | { | ||
| 198 | struct device *dev = &phydev->dev; | ||
| 199 | struct device_node *child; | ||
| 200 | |||
| 201 | if (dev->of_node || !mdio->dev.of_node) | ||
| 202 | return; | ||
| 203 | |||
| 204 | for_each_available_child_of_node(mdio->dev.of_node, child) { | ||
| 205 | int addr; | ||
| 206 | |||
| 207 | addr = of_mdio_parse_addr(&mdio->dev, child); | ||
| 208 | if (addr < 0) | ||
| 209 | continue; | ||
| 210 | |||
| 211 | if (addr == phydev->addr) { | ||
| 212 | dev->of_node = child; | ||
| 213 | return; | ||
| 214 | } | ||
| 215 | } | ||
| 216 | } | ||
| 217 | EXPORT_SYMBOL(of_mdiobus_link_phydev); | ||
| 218 | |||
| 219 | /* Helper function for of_phy_find_device */ | 185 | /* Helper function for of_phy_find_device */ |
| 220 | static int of_phy_match(struct device *dev, void *phy_np) | 186 | static int of_phy_match(struct device *dev, void *phy_np) |
| 221 | { | 187 | { |
| @@ -323,11 +289,13 @@ int of_phy_register_fixed_link(struct device_node *np) | |||
| 323 | fixed_link_node = of_get_child_by_name(np, "fixed-link"); | 289 | fixed_link_node = of_get_child_by_name(np, "fixed-link"); |
| 324 | if (fixed_link_node) { | 290 | if (fixed_link_node) { |
| 325 | status.link = 1; | 291 | status.link = 1; |
| 326 | status.duplex = of_property_read_bool(np, "full-duplex"); | 292 | status.duplex = of_property_read_bool(fixed_link_node, |
| 293 | "full-duplex"); | ||
| 327 | if (of_property_read_u32(fixed_link_node, "speed", &status.speed)) | 294 | if (of_property_read_u32(fixed_link_node, "speed", &status.speed)) |
| 328 | return -EINVAL; | 295 | return -EINVAL; |
| 329 | status.pause = of_property_read_bool(np, "pause"); | 296 | status.pause = of_property_read_bool(fixed_link_node, "pause"); |
| 330 | status.asym_pause = of_property_read_bool(np, "asym-pause"); | 297 | status.asym_pause = of_property_read_bool(fixed_link_node, |
| 298 | "asym-pause"); | ||
| 331 | of_node_put(fixed_link_node); | 299 | of_node_put(fixed_link_node); |
| 332 | return fixed_phy_register(PHY_POLL, &status, np); | 300 | return fixed_phy_register(PHY_POLL, &status, np); |
| 333 | } | 301 | } |
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/parport/Kconfig b/drivers/parport/Kconfig index 2872ece81f35..44333bd8f908 100644 --- a/drivers/parport/Kconfig +++ b/drivers/parport/Kconfig | |||
| @@ -5,6 +5,12 @@ | |||
| 5 | # Parport configuration. | 5 | # Parport configuration. |
| 6 | # | 6 | # |
| 7 | 7 | ||
| 8 | config ARCH_MIGHT_HAVE_PC_PARPORT | ||
| 9 | bool | ||
| 10 | help | ||
| 11 | Select this config option from the architecture Kconfig if | ||
| 12 | the architecture might have PC parallel port hardware. | ||
| 13 | |||
| 8 | menuconfig PARPORT | 14 | menuconfig PARPORT |
| 9 | tristate "Parallel port support" | 15 | tristate "Parallel port support" |
| 10 | depends on HAS_IOMEM | 16 | depends on HAS_IOMEM |
| @@ -31,12 +37,6 @@ menuconfig PARPORT | |||
| 31 | 37 | ||
| 32 | If unsure, say Y. | 38 | If unsure, say Y. |
| 33 | 39 | ||
| 34 | config ARCH_MIGHT_HAVE_PC_PARPORT | ||
| 35 | bool | ||
| 36 | help | ||
| 37 | Select this config option from the architecture Kconfig if | ||
| 38 | the architecture might have PC parallel port hardware. | ||
| 39 | |||
| 40 | if PARPORT | 40 | if PARPORT |
| 41 | 41 | ||
| 42 | config PARPORT_PC | 42 | config PARPORT_PC |
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/pinctrl-st.c b/drivers/pinctrl/pinctrl-st.c index 1bd6363bc95e..9f43916637ca 100644 --- a/drivers/pinctrl/pinctrl-st.c +++ b/drivers/pinctrl/pinctrl-st.c | |||
| @@ -1431,7 +1431,7 @@ static void st_gpio_irqmux_handler(unsigned irq, struct irq_desc *desc) | |||
| 1431 | 1431 | ||
| 1432 | status = readl(info->irqmux_base); | 1432 | status = readl(info->irqmux_base); |
| 1433 | 1433 | ||
| 1434 | for_each_set_bit(n, &status, ST_GPIO_PINS_PER_BANK) | 1434 | for_each_set_bit(n, &status, info->nbanks) |
| 1435 | __gpio_irq_handler(&info->banks[n]); | 1435 | __gpio_irq_handler(&info->banks[n]); |
| 1436 | 1436 | ||
| 1437 | chained_irq_exit(chip, desc); | 1437 | chained_irq_exit(chip, desc); |
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/pnp/pnpacpi/core.c b/drivers/pnp/pnpacpi/core.c index b81448b2c75d..a5c6cb773e5f 100644 --- a/drivers/pnp/pnpacpi/core.c +++ b/drivers/pnp/pnpacpi/core.c | |||
| @@ -319,8 +319,7 @@ static int __init acpi_pnp_match(struct device *dev, void *_pnp) | |||
| 319 | struct pnp_dev *pnp = _pnp; | 319 | struct pnp_dev *pnp = _pnp; |
| 320 | 320 | ||
| 321 | /* true means it matched */ | 321 | /* true means it matched */ |
| 322 | return !acpi->physical_node_count | 322 | return pnp->data == acpi; |
| 323 | && compare_pnp_id(pnp->id, acpi_device_hid(acpi)); | ||
| 324 | } | 323 | } |
| 325 | 324 | ||
| 326 | static struct acpi_device * __init acpi_pnp_find_companion(struct device *dev) | 325 | static struct acpi_device * __init acpi_pnp_find_companion(struct device *dev) |
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/rapidio/devices/tsi721_dma.c b/drivers/rapidio/devices/tsi721_dma.c index 9b60b1f3261c..44341dc5b148 100644 --- a/drivers/rapidio/devices/tsi721_dma.c +++ b/drivers/rapidio/devices/tsi721_dma.c | |||
| @@ -287,6 +287,12 @@ struct tsi721_tx_desc *tsi721_desc_get(struct tsi721_bdma_chan *bdma_chan) | |||
| 287 | "desc %p not ACKed\n", tx_desc); | 287 | "desc %p not ACKed\n", tx_desc); |
| 288 | } | 288 | } |
| 289 | 289 | ||
| 290 | if (ret == NULL) { | ||
| 291 | dev_dbg(bdma_chan->dchan.device->dev, | ||
| 292 | "%s: unable to obtain tx descriptor\n", __func__); | ||
| 293 | goto err_out; | ||
| 294 | } | ||
| 295 | |||
| 290 | i = bdma_chan->wr_count_next % bdma_chan->bd_num; | 296 | i = bdma_chan->wr_count_next % bdma_chan->bd_num; |
| 291 | if (i == bdma_chan->bd_num - 1) { | 297 | if (i == bdma_chan->bd_num - 1) { |
| 292 | i = 0; | 298 | i = 0; |
| @@ -297,7 +303,7 @@ struct tsi721_tx_desc *tsi721_desc_get(struct tsi721_bdma_chan *bdma_chan) | |||
| 297 | tx_desc->txd.phys = bdma_chan->bd_phys + | 303 | tx_desc->txd.phys = bdma_chan->bd_phys + |
| 298 | i * sizeof(struct tsi721_dma_desc); | 304 | i * sizeof(struct tsi721_dma_desc); |
| 299 | tx_desc->hw_desc = &((struct tsi721_dma_desc *)bdma_chan->bd_base)[i]; | 305 | tx_desc->hw_desc = &((struct tsi721_dma_desc *)bdma_chan->bd_base)[i]; |
| 300 | 306 | err_out: | |
| 301 | spin_unlock_bh(&bdma_chan->lock); | 307 | spin_unlock_bh(&bdma_chan->lock); |
| 302 | 308 | ||
| 303 | return ret; | 309 | return ret; |
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/raw3270.c b/drivers/s390/char/raw3270.c index 15b3459f8656..220acb4cbee5 100644 --- a/drivers/s390/char/raw3270.c +++ b/drivers/s390/char/raw3270.c | |||
| @@ -633,7 +633,6 @@ raw3270_reset_device_cb(struct raw3270_request *rq, void *data) | |||
| 633 | } else | 633 | } else |
| 634 | raw3270_writesf_readpart(rp); | 634 | raw3270_writesf_readpart(rp); |
| 635 | memset(&rp->init_reset, 0, sizeof(rp->init_reset)); | 635 | memset(&rp->init_reset, 0, sizeof(rp->init_reset)); |
| 636 | memset(&rp->init_data, 0, sizeof(rp->init_data)); | ||
| 637 | } | 636 | } |
| 638 | 637 | ||
| 639 | static int | 638 | static int |
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..4038437ff033 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; |
| @@ -901,10 +901,15 @@ static int ap_device_probe(struct device *dev) | |||
| 901 | int rc; | 901 | int rc; |
| 902 | 902 | ||
| 903 | ap_dev->drv = ap_drv; | 903 | ap_dev->drv = ap_drv; |
| 904 | |||
| 905 | spin_lock_bh(&ap_device_list_lock); | ||
| 906 | list_add(&ap_dev->list, &ap_device_list); | ||
| 907 | spin_unlock_bh(&ap_device_list_lock); | ||
| 908 | |||
| 904 | rc = ap_drv->probe ? ap_drv->probe(ap_dev) : -ENODEV; | 909 | rc = ap_drv->probe ? ap_drv->probe(ap_dev) : -ENODEV; |
| 905 | if (!rc) { | 910 | if (rc) { |
| 906 | spin_lock_bh(&ap_device_list_lock); | 911 | spin_lock_bh(&ap_device_list_lock); |
| 907 | list_add(&ap_dev->list, &ap_device_list); | 912 | list_del_init(&ap_dev->list); |
| 908 | spin_unlock_bh(&ap_device_list_lock); | 913 | spin_unlock_bh(&ap_device_list_lock); |
| 909 | } | 914 | } |
| 910 | return rc; | 915 | return rc; |
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_lib.c b/drivers/scsi/scsi_lib.c index f7e316368c99..3f50dfcb3227 100644 --- a/drivers/scsi/scsi_lib.c +++ b/drivers/scsi/scsi_lib.c | |||
| @@ -733,6 +733,14 @@ void scsi_io_completion(struct scsi_cmnd *cmd, unsigned int good_bytes) | |||
| 733 | scsi_next_command(cmd); | 733 | scsi_next_command(cmd); |
| 734 | return; | 734 | return; |
| 735 | } | 735 | } |
| 736 | } else if (blk_rq_bytes(req) == 0 && result && !sense_deferred) { | ||
| 737 | /* | ||
| 738 | * Certain non BLOCK_PC requests are commands that don't | ||
| 739 | * actually transfer anything (FLUSH), so cannot use | ||
| 740 | * good_bytes != blk_rq_bytes(req) as the signal for an error. | ||
| 741 | * This sets the error explicitly for the problem case. | ||
| 742 | */ | ||
| 743 | error = __scsi_error_from_host_byte(cmd, result); | ||
| 736 | } | 744 | } |
| 737 | 745 | ||
| 738 | /* no bidi support for !REQ_TYPE_BLOCK_PC yet */ | 746 | /* no bidi support for !REQ_TYPE_BLOCK_PC yet */ |
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/Kconfig b/drivers/spi/Kconfig index 79ace88030c4..20bd055ea2d1 100644 --- a/drivers/spi/Kconfig +++ b/drivers/spi/Kconfig | |||
| @@ -396,7 +396,7 @@ config SPI_ROCKCHIP | |||
| 396 | 396 | ||
| 397 | config SPI_RSPI | 397 | config SPI_RSPI |
| 398 | tristate "Renesas RSPI/QSPI controller" | 398 | tristate "Renesas RSPI/QSPI controller" |
| 399 | depends on (SUPERH && SH_DMAE_BASE) || ARCH_SHMOBILE | 399 | depends on SUPERH || ARCH_SHMOBILE || COMPILE_TEST |
| 400 | help | 400 | help |
| 401 | SPI driver for Renesas RSPI and QSPI blocks. | 401 | SPI driver for Renesas RSPI and QSPI blocks. |
| 402 | 402 | ||
diff --git a/drivers/spi/spi-adi-v3.c b/drivers/spi/spi-adi-v3.c index dcb2287c7f8a..19ea8fb78cc7 100644 --- a/drivers/spi/spi-adi-v3.c +++ b/drivers/spi/spi-adi-v3.c | |||
| @@ -660,10 +660,9 @@ static int adi_spi_setup(struct spi_device *spi) | |||
| 660 | struct adi_spi3_chip *chip_info = spi->controller_data; | 660 | struct adi_spi3_chip *chip_info = spi->controller_data; |
| 661 | 661 | ||
| 662 | chip = kzalloc(sizeof(*chip), GFP_KERNEL); | 662 | chip = kzalloc(sizeof(*chip), GFP_KERNEL); |
| 663 | if (!chip) { | 663 | if (!chip) |
| 664 | dev_err(&spi->dev, "can not allocate chip data\n"); | ||
| 665 | return -ENOMEM; | 664 | return -ENOMEM; |
| 666 | } | 665 | |
| 667 | if (chip_info) { | 666 | if (chip_info) { |
| 668 | if (chip_info->control & ~ctl_reg) { | 667 | if (chip_info->control & ~ctl_reg) { |
| 669 | dev_err(&spi->dev, | 668 | dev_err(&spi->dev, |
diff --git a/drivers/spi/spi-atmel.c b/drivers/spi/spi-atmel.c index 92a6f0d93233..113c83f44b5c 100644 --- a/drivers/spi/spi-atmel.c +++ b/drivers/spi/spi-atmel.c | |||
| @@ -597,21 +597,15 @@ static int atmel_spi_next_xfer_dma_submit(struct spi_master *master, | |||
| 597 | goto err_exit; | 597 | goto err_exit; |
| 598 | 598 | ||
| 599 | /* Send both scatterlists */ | 599 | /* Send both scatterlists */ |
| 600 | rxdesc = rxchan->device->device_prep_slave_sg(rxchan, | 600 | rxdesc = dmaengine_prep_slave_sg(rxchan, &as->dma.sgrx, 1, |
| 601 | &as->dma.sgrx, | 601 | DMA_FROM_DEVICE, |
| 602 | 1, | 602 | DMA_PREP_INTERRUPT | DMA_CTRL_ACK); |
| 603 | DMA_FROM_DEVICE, | ||
| 604 | DMA_PREP_INTERRUPT | DMA_CTRL_ACK, | ||
| 605 | NULL); | ||
| 606 | if (!rxdesc) | 603 | if (!rxdesc) |
| 607 | goto err_dma; | 604 | goto err_dma; |
| 608 | 605 | ||
| 609 | txdesc = txchan->device->device_prep_slave_sg(txchan, | 606 | txdesc = dmaengine_prep_slave_sg(txchan, &as->dma.sgtx, 1, |
| 610 | &as->dma.sgtx, | 607 | DMA_TO_DEVICE, |
| 611 | 1, | 608 | DMA_PREP_INTERRUPT | DMA_CTRL_ACK); |
| 612 | DMA_TO_DEVICE, | ||
| 613 | DMA_PREP_INTERRUPT | DMA_CTRL_ACK, | ||
| 614 | NULL); | ||
| 615 | if (!txdesc) | 609 | if (!txdesc) |
| 616 | goto err_dma; | 610 | goto err_dma; |
| 617 | 611 | ||
| @@ -1018,7 +1012,7 @@ static int atmel_spi_setup(struct spi_device *spi) | |||
| 1018 | csr |= SPI_BF(DLYBCT, 0); | 1012 | csr |= SPI_BF(DLYBCT, 0); |
| 1019 | 1013 | ||
| 1020 | /* chipselect must have been muxed as GPIO (e.g. in board setup) */ | 1014 | /* chipselect must have been muxed as GPIO (e.g. in board setup) */ |
| 1021 | npcs_pin = (unsigned int)spi->controller_data; | 1015 | npcs_pin = (unsigned long)spi->controller_data; |
| 1022 | 1016 | ||
| 1023 | if (gpio_is_valid(spi->cs_gpio)) | 1017 | if (gpio_is_valid(spi->cs_gpio)) |
| 1024 | npcs_pin = spi->cs_gpio; | 1018 | npcs_pin = spi->cs_gpio; |
| @@ -1253,7 +1247,7 @@ msg_done: | |||
| 1253 | static void atmel_spi_cleanup(struct spi_device *spi) | 1247 | static void atmel_spi_cleanup(struct spi_device *spi) |
| 1254 | { | 1248 | { |
| 1255 | struct atmel_spi_device *asd = spi->controller_state; | 1249 | struct atmel_spi_device *asd = spi->controller_state; |
| 1256 | unsigned gpio = (unsigned) spi->controller_data; | 1250 | unsigned gpio = (unsigned long) spi->controller_data; |
| 1257 | 1251 | ||
| 1258 | if (!asd) | 1252 | if (!asd) |
| 1259 | return; | 1253 | return; |
diff --git a/drivers/spi/spi-au1550.c b/drivers/spi/spi-au1550.c index 67375a11d4bd..fb61464348a1 100644 --- a/drivers/spi/spi-au1550.c +++ b/drivers/spi/spi-au1550.c | |||
| @@ -925,8 +925,7 @@ err_no_txdma: | |||
| 925 | iounmap((void __iomem *)hw->regs); | 925 | iounmap((void __iomem *)hw->regs); |
| 926 | 926 | ||
| 927 | err_ioremap: | 927 | err_ioremap: |
| 928 | release_resource(hw->ioarea); | 928 | release_mem_region(r->start, sizeof(psc_spi_t)); |
| 929 | kfree(hw->ioarea); | ||
| 930 | 929 | ||
| 931 | err_no_iores: | 930 | err_no_iores: |
| 932 | err_no_pdata: | 931 | err_no_pdata: |
| @@ -946,8 +945,7 @@ static int au1550_spi_remove(struct platform_device *pdev) | |||
| 946 | spi_bitbang_stop(&hw->bitbang); | 945 | spi_bitbang_stop(&hw->bitbang); |
| 947 | free_irq(hw->irq, hw); | 946 | free_irq(hw->irq, hw); |
| 948 | iounmap((void __iomem *)hw->regs); | 947 | iounmap((void __iomem *)hw->regs); |
| 949 | release_resource(hw->ioarea); | 948 | release_mem_region(r->start, sizeof(psc_spi_t)); |
| 950 | kfree(hw->ioarea); | ||
| 951 | 949 | ||
| 952 | if (hw->usedma) { | 950 | if (hw->usedma) { |
| 953 | au1550_spi_dma_rxtmp_free(hw); | 951 | au1550_spi_dma_rxtmp_free(hw); |
diff --git a/drivers/spi/spi-cadence.c b/drivers/spi/spi-cadence.c index bb758978465d..562ff83debd9 100644 --- a/drivers/spi/spi-cadence.c +++ b/drivers/spi/spi-cadence.c | |||
| @@ -205,18 +205,30 @@ static void cdns_spi_chipselect(struct spi_device *spi, bool is_high) | |||
| 205 | static void cdns_spi_config_clock_mode(struct spi_device *spi) | 205 | static void cdns_spi_config_clock_mode(struct spi_device *spi) |
| 206 | { | 206 | { |
| 207 | struct cdns_spi *xspi = spi_master_get_devdata(spi->master); | 207 | struct cdns_spi *xspi = spi_master_get_devdata(spi->master); |
| 208 | u32 ctrl_reg; | 208 | u32 ctrl_reg, new_ctrl_reg; |
| 209 | 209 | ||
| 210 | ctrl_reg = cdns_spi_read(xspi, CDNS_SPI_CR_OFFSET); | 210 | new_ctrl_reg = ctrl_reg = cdns_spi_read(xspi, CDNS_SPI_CR_OFFSET); |
| 211 | 211 | ||
| 212 | /* Set the SPI clock phase and clock polarity */ | 212 | /* Set the SPI clock phase and clock polarity */ |
| 213 | ctrl_reg &= ~(CDNS_SPI_CR_CPHA_MASK | CDNS_SPI_CR_CPOL_MASK); | 213 | new_ctrl_reg &= ~(CDNS_SPI_CR_CPHA_MASK | CDNS_SPI_CR_CPOL_MASK); |
| 214 | if (spi->mode & SPI_CPHA) | 214 | if (spi->mode & SPI_CPHA) |
| 215 | ctrl_reg |= CDNS_SPI_CR_CPHA_MASK; | 215 | new_ctrl_reg |= CDNS_SPI_CR_CPHA_MASK; |
| 216 | if (spi->mode & SPI_CPOL) | 216 | if (spi->mode & SPI_CPOL) |
| 217 | ctrl_reg |= CDNS_SPI_CR_CPOL_MASK; | 217 | new_ctrl_reg |= CDNS_SPI_CR_CPOL_MASK; |
| 218 | 218 | ||
| 219 | cdns_spi_write(xspi, CDNS_SPI_CR_OFFSET, ctrl_reg); | 219 | if (new_ctrl_reg != ctrl_reg) { |
| 220 | /* | ||
| 221 | * Just writing the CR register does not seem to apply the clock | ||
| 222 | * setting changes. This is problematic when changing the clock | ||
| 223 | * polarity as it will cause the SPI slave to see spurious clock | ||
| 224 | * transitions. To workaround the issue toggle the ER register. | ||
| 225 | */ | ||
| 226 | cdns_spi_write(xspi, CDNS_SPI_ER_OFFSET, | ||
| 227 | CDNS_SPI_ER_DISABLE_MASK); | ||
| 228 | cdns_spi_write(xspi, CDNS_SPI_CR_OFFSET, new_ctrl_reg); | ||
| 229 | cdns_spi_write(xspi, CDNS_SPI_ER_OFFSET, | ||
| 230 | CDNS_SPI_ER_ENABLE_MASK); | ||
| 231 | } | ||
| 220 | } | 232 | } |
| 221 | 233 | ||
| 222 | /** | 234 | /** |
| @@ -370,6 +382,12 @@ static irqreturn_t cdns_spi_irq(int irq, void *dev_id) | |||
| 370 | 382 | ||
| 371 | return status; | 383 | return status; |
| 372 | } | 384 | } |
| 385 | static int cdns_prepare_message(struct spi_master *master, | ||
| 386 | struct spi_message *msg) | ||
| 387 | { | ||
| 388 | cdns_spi_config_clock_mode(msg->spi); | ||
| 389 | return 0; | ||
| 390 | } | ||
| 373 | 391 | ||
| 374 | /** | 392 | /** |
| 375 | * cdns_transfer_one - Initiates the SPI transfer | 393 | * cdns_transfer_one - Initiates the SPI transfer |
| @@ -416,8 +434,6 @@ static int cdns_prepare_transfer_hardware(struct spi_master *master) | |||
| 416 | { | 434 | { |
| 417 | struct cdns_spi *xspi = spi_master_get_devdata(master); | 435 | struct cdns_spi *xspi = spi_master_get_devdata(master); |
| 418 | 436 | ||
| 419 | cdns_spi_config_clock_mode(master->cur_msg->spi); | ||
| 420 | |||
| 421 | cdns_spi_write(xspi, CDNS_SPI_ER_OFFSET, | 437 | cdns_spi_write(xspi, CDNS_SPI_ER_OFFSET, |
| 422 | CDNS_SPI_ER_ENABLE_MASK); | 438 | CDNS_SPI_ER_ENABLE_MASK); |
| 423 | 439 | ||
| @@ -532,6 +548,7 @@ static int cdns_spi_probe(struct platform_device *pdev) | |||
| 532 | xspi->is_decoded_cs = 0; | 548 | xspi->is_decoded_cs = 0; |
| 533 | 549 | ||
| 534 | master->prepare_transfer_hardware = cdns_prepare_transfer_hardware; | 550 | master->prepare_transfer_hardware = cdns_prepare_transfer_hardware; |
| 551 | master->prepare_message = cdns_prepare_message; | ||
| 535 | master->transfer_one = cdns_transfer_one; | 552 | master->transfer_one = cdns_transfer_one; |
| 536 | master->unprepare_transfer_hardware = cdns_unprepare_transfer_hardware; | 553 | master->unprepare_transfer_hardware = cdns_unprepare_transfer_hardware; |
| 537 | master->set_cs = cdns_spi_chipselect; | 554 | master->set_cs = cdns_spi_chipselect; |
| @@ -647,7 +664,7 @@ static int __maybe_unused cdns_spi_resume(struct device *dev) | |||
| 647 | static SIMPLE_DEV_PM_OPS(cdns_spi_dev_pm_ops, cdns_spi_suspend, | 664 | static SIMPLE_DEV_PM_OPS(cdns_spi_dev_pm_ops, cdns_spi_suspend, |
| 648 | cdns_spi_resume); | 665 | cdns_spi_resume); |
| 649 | 666 | ||
| 650 | static struct of_device_id cdns_spi_of_match[] = { | 667 | static const struct of_device_id cdns_spi_of_match[] = { |
| 651 | { .compatible = "xlnx,zynq-spi-r1p6" }, | 668 | { .compatible = "xlnx,zynq-spi-r1p6" }, |
| 652 | { .compatible = "cdns,spi-r1p6" }, | 669 | { .compatible = "cdns,spi-r1p6" }, |
| 653 | { /* end of table */ } | 670 | { /* end of table */ } |
diff --git a/drivers/spi/spi-clps711x.c b/drivers/spi/spi-clps711x.c index 4cd62f636547..ce538dad526b 100644 --- a/drivers/spi/spi-clps711x.c +++ b/drivers/spi/spi-clps711x.c | |||
| @@ -184,8 +184,6 @@ static int spi_clps711x_probe(struct platform_device *pdev) | |||
| 184 | } | 184 | } |
| 185 | master->max_speed_hz = clk_get_rate(hw->spi_clk); | 185 | master->max_speed_hz = clk_get_rate(hw->spi_clk); |
| 186 | 186 | ||
| 187 | platform_set_drvdata(pdev, master); | ||
| 188 | |||
| 189 | hw->syscon = syscon_regmap_lookup_by_pdevname("syscon.3"); | 187 | hw->syscon = syscon_regmap_lookup_by_pdevname("syscon.3"); |
| 190 | if (IS_ERR(hw->syscon)) { | 188 | if (IS_ERR(hw->syscon)) { |
| 191 | ret = PTR_ERR(hw->syscon); | 189 | ret = PTR_ERR(hw->syscon); |
diff --git a/drivers/spi/spi-davinci.c b/drivers/spi/spi-davinci.c index 50f750989258..276a3884fb3c 100644 --- a/drivers/spi/spi-davinci.c +++ b/drivers/spi/spi-davinci.c | |||
| @@ -30,6 +30,7 @@ | |||
| 30 | #include <linux/edma.h> | 30 | #include <linux/edma.h> |
| 31 | #include <linux/of.h> | 31 | #include <linux/of.h> |
| 32 | #include <linux/of_device.h> | 32 | #include <linux/of_device.h> |
| 33 | #include <linux/of_gpio.h> | ||
| 33 | #include <linux/spi/spi.h> | 34 | #include <linux/spi/spi.h> |
| 34 | #include <linux/spi/spi_bitbang.h> | 35 | #include <linux/spi/spi_bitbang.h> |
| 35 | #include <linux/slab.h> | 36 | #include <linux/slab.h> |
| @@ -38,8 +39,6 @@ | |||
| 38 | 39 | ||
| 39 | #define SPI_NO_RESOURCE ((resource_size_t)-1) | 40 | #define SPI_NO_RESOURCE ((resource_size_t)-1) |
| 40 | 41 | ||
| 41 | #define SPI_MAX_CHIPSELECT 2 | ||
| 42 | |||
| 43 | #define CS_DEFAULT 0xFF | 42 | #define CS_DEFAULT 0xFF |
| 44 | 43 | ||
| 45 | #define SPIFMT_PHASE_MASK BIT(16) | 44 | #define SPIFMT_PHASE_MASK BIT(16) |
| @@ -142,7 +141,7 @@ struct davinci_spi { | |||
| 142 | void (*get_rx)(u32 rx_data, struct davinci_spi *); | 141 | void (*get_rx)(u32 rx_data, struct davinci_spi *); |
| 143 | u32 (*get_tx)(struct davinci_spi *); | 142 | u32 (*get_tx)(struct davinci_spi *); |
| 144 | 143 | ||
| 145 | u8 bytes_per_word[SPI_MAX_CHIPSELECT]; | 144 | u8 *bytes_per_word; |
| 146 | }; | 145 | }; |
| 147 | 146 | ||
| 148 | static struct davinci_spi_config davinci_spi_default_cfg; | 147 | static struct davinci_spi_config davinci_spi_default_cfg; |
| @@ -213,13 +212,16 @@ static void davinci_spi_chipselect(struct spi_device *spi, int value) | |||
| 213 | u8 chip_sel = spi->chip_select; | 212 | u8 chip_sel = spi->chip_select; |
| 214 | u16 spidat1 = CS_DEFAULT; | 213 | u16 spidat1 = CS_DEFAULT; |
| 215 | bool gpio_chipsel = false; | 214 | bool gpio_chipsel = false; |
| 215 | int gpio; | ||
| 216 | 216 | ||
| 217 | dspi = spi_master_get_devdata(spi->master); | 217 | dspi = spi_master_get_devdata(spi->master); |
| 218 | pdata = &dspi->pdata; | 218 | pdata = &dspi->pdata; |
| 219 | 219 | ||
| 220 | if (pdata->chip_sel && chip_sel < pdata->num_chipselect && | 220 | if (spi->cs_gpio >= 0) { |
| 221 | pdata->chip_sel[chip_sel] != SPI_INTERN_CS) | 221 | /* SPI core parse and update master->cs_gpio */ |
| 222 | gpio_chipsel = true; | 222 | gpio_chipsel = true; |
| 223 | gpio = spi->cs_gpio; | ||
| 224 | } | ||
| 223 | 225 | ||
| 224 | /* | 226 | /* |
| 225 | * Board specific chip select logic decides the polarity and cs | 227 | * Board specific chip select logic decides the polarity and cs |
| @@ -227,9 +229,9 @@ static void davinci_spi_chipselect(struct spi_device *spi, int value) | |||
| 227 | */ | 229 | */ |
| 228 | if (gpio_chipsel) { | 230 | if (gpio_chipsel) { |
| 229 | if (value == BITBANG_CS_ACTIVE) | 231 | if (value == BITBANG_CS_ACTIVE) |
| 230 | gpio_set_value(pdata->chip_sel[chip_sel], 0); | 232 | gpio_set_value(gpio, spi->mode & SPI_CS_HIGH); |
| 231 | else | 233 | else |
| 232 | gpio_set_value(pdata->chip_sel[chip_sel], 1); | 234 | gpio_set_value(gpio, !(spi->mode & SPI_CS_HIGH)); |
| 233 | } else { | 235 | } else { |
| 234 | if (value == BITBANG_CS_ACTIVE) { | 236 | if (value == BITBANG_CS_ACTIVE) { |
| 235 | spidat1 |= SPIDAT1_CSHOLD_MASK; | 237 | spidat1 |= SPIDAT1_CSHOLD_MASK; |
| @@ -392,17 +394,40 @@ static int davinci_spi_setup(struct spi_device *spi) | |||
| 392 | int retval = 0; | 394 | int retval = 0; |
| 393 | struct davinci_spi *dspi; | 395 | struct davinci_spi *dspi; |
| 394 | struct davinci_spi_platform_data *pdata; | 396 | struct davinci_spi_platform_data *pdata; |
| 397 | struct spi_master *master = spi->master; | ||
| 398 | struct device_node *np = spi->dev.of_node; | ||
| 399 | bool internal_cs = true; | ||
| 400 | unsigned long flags = GPIOF_DIR_OUT; | ||
| 395 | 401 | ||
| 396 | dspi = spi_master_get_devdata(spi->master); | 402 | dspi = spi_master_get_devdata(spi->master); |
| 397 | pdata = &dspi->pdata; | 403 | pdata = &dspi->pdata; |
| 398 | 404 | ||
| 405 | flags |= (spi->mode & SPI_CS_HIGH) ? GPIOF_INIT_LOW : GPIOF_INIT_HIGH; | ||
| 406 | |||
| 399 | if (!(spi->mode & SPI_NO_CS)) { | 407 | if (!(spi->mode & SPI_NO_CS)) { |
| 400 | if ((pdata->chip_sel == NULL) || | 408 | if (np && (master->cs_gpios != NULL) && (spi->cs_gpio >= 0)) { |
| 401 | (pdata->chip_sel[spi->chip_select] == SPI_INTERN_CS)) | 409 | retval = gpio_request_one(spi->cs_gpio, |
| 402 | set_io_bits(dspi->base + SPIPC0, 1 << spi->chip_select); | 410 | flags, dev_name(&spi->dev)); |
| 411 | internal_cs = false; | ||
| 412 | } else if (pdata->chip_sel && | ||
| 413 | spi->chip_select < pdata->num_chipselect && | ||
| 414 | pdata->chip_sel[spi->chip_select] != SPI_INTERN_CS) { | ||
| 415 | spi->cs_gpio = pdata->chip_sel[spi->chip_select]; | ||
| 416 | retval = gpio_request_one(spi->cs_gpio, | ||
| 417 | flags, dev_name(&spi->dev)); | ||
| 418 | internal_cs = false; | ||
| 419 | } | ||
| 420 | } | ||
| 403 | 421 | ||
| 422 | if (retval) { | ||
| 423 | dev_err(&spi->dev, "GPIO %d setup failed (%d)\n", | ||
| 424 | spi->cs_gpio, retval); | ||
| 425 | return retval; | ||
| 404 | } | 426 | } |
| 405 | 427 | ||
| 428 | if (internal_cs) | ||
| 429 | set_io_bits(dspi->base + SPIPC0, 1 << spi->chip_select); | ||
| 430 | |||
| 406 | if (spi->mode & SPI_READY) | 431 | if (spi->mode & SPI_READY) |
| 407 | set_io_bits(dspi->base + SPIPC0, SPIPC0_SPIENA_MASK); | 432 | set_io_bits(dspi->base + SPIPC0, SPIPC0_SPIENA_MASK); |
| 408 | 433 | ||
| @@ -414,6 +439,12 @@ static int davinci_spi_setup(struct spi_device *spi) | |||
| 414 | return retval; | 439 | return retval; |
| 415 | } | 440 | } |
| 416 | 441 | ||
| 442 | static void davinci_spi_cleanup(struct spi_device *spi) | ||
| 443 | { | ||
| 444 | if (spi->cs_gpio >= 0) | ||
| 445 | gpio_free(spi->cs_gpio); | ||
| 446 | } | ||
| 447 | |||
| 417 | static int davinci_spi_check_error(struct davinci_spi *dspi, int int_status) | 448 | static int davinci_spi_check_error(struct davinci_spi *dspi, int int_status) |
| 418 | { | 449 | { |
| 419 | struct device *sdev = dspi->bitbang.master->dev.parent; | 450 | struct device *sdev = dspi->bitbang.master->dev.parent; |
| @@ -812,6 +843,8 @@ static int spi_davinci_get_pdata(struct platform_device *pdev, | |||
| 812 | 843 | ||
| 813 | /* | 844 | /* |
| 814 | * default num_cs is 1 and all chipsel are internal to the chip | 845 | * default num_cs is 1 and all chipsel are internal to the chip |
| 846 | * indicated by chip_sel being NULL or cs_gpios being NULL or | ||
| 847 | * set to -ENOENT. num-cs includes internal as well as gpios. | ||
| 815 | * indicated by chip_sel being NULL. GPIO based CS is not | 848 | * indicated by chip_sel being NULL. GPIO based CS is not |
| 816 | * supported yet in DT bindings. | 849 | * supported yet in DT bindings. |
| 817 | */ | 850 | */ |
| @@ -850,7 +883,7 @@ static int davinci_spi_probe(struct platform_device *pdev) | |||
| 850 | struct resource *r; | 883 | struct resource *r; |
| 851 | resource_size_t dma_rx_chan = SPI_NO_RESOURCE; | 884 | resource_size_t dma_rx_chan = SPI_NO_RESOURCE; |
| 852 | resource_size_t dma_tx_chan = SPI_NO_RESOURCE; | 885 | resource_size_t dma_tx_chan = SPI_NO_RESOURCE; |
| 853 | int i = 0, ret = 0; | 886 | int ret = 0; |
| 854 | u32 spipc0; | 887 | u32 spipc0; |
| 855 | 888 | ||
| 856 | master = spi_alloc_master(&pdev->dev, sizeof(struct davinci_spi)); | 889 | master = spi_alloc_master(&pdev->dev, sizeof(struct davinci_spi)); |
| @@ -876,6 +909,14 @@ static int davinci_spi_probe(struct platform_device *pdev) | |||
| 876 | /* pdata in dspi is now updated and point pdata to that */ | 909 | /* pdata in dspi is now updated and point pdata to that */ |
| 877 | pdata = &dspi->pdata; | 910 | pdata = &dspi->pdata; |
| 878 | 911 | ||
| 912 | dspi->bytes_per_word = devm_kzalloc(&pdev->dev, | ||
| 913 | sizeof(*dspi->bytes_per_word) * | ||
| 914 | pdata->num_chipselect, GFP_KERNEL); | ||
| 915 | if (dspi->bytes_per_word == NULL) { | ||
| 916 | ret = -ENOMEM; | ||
| 917 | goto free_master; | ||
| 918 | } | ||
| 919 | |||
| 879 | r = platform_get_resource(pdev, IORESOURCE_MEM, 0); | 920 | r = platform_get_resource(pdev, IORESOURCE_MEM, 0); |
| 880 | if (r == NULL) { | 921 | if (r == NULL) { |
| 881 | ret = -ENOENT; | 922 | ret = -ENOENT; |
| @@ -915,6 +956,7 @@ static int davinci_spi_probe(struct platform_device *pdev) | |||
| 915 | master->num_chipselect = pdata->num_chipselect; | 956 | master->num_chipselect = pdata->num_chipselect; |
| 916 | master->bits_per_word_mask = SPI_BPW_RANGE_MASK(2, 16); | 957 | master->bits_per_word_mask = SPI_BPW_RANGE_MASK(2, 16); |
| 917 | master->setup = davinci_spi_setup; | 958 | master->setup = davinci_spi_setup; |
| 959 | master->cleanup = davinci_spi_cleanup; | ||
| 918 | 960 | ||
| 919 | dspi->bitbang.chipselect = davinci_spi_chipselect; | 961 | dspi->bitbang.chipselect = davinci_spi_chipselect; |
| 920 | dspi->bitbang.setup_transfer = davinci_spi_setup_transfer; | 962 | dspi->bitbang.setup_transfer = davinci_spi_setup_transfer; |
| @@ -962,14 +1004,6 @@ static int davinci_spi_probe(struct platform_device *pdev) | |||
| 962 | spipc0 = SPIPC0_DIFUN_MASK | SPIPC0_DOFUN_MASK | SPIPC0_CLKFUN_MASK; | 1004 | spipc0 = SPIPC0_DIFUN_MASK | SPIPC0_DOFUN_MASK | SPIPC0_CLKFUN_MASK; |
| 963 | iowrite32(spipc0, dspi->base + SPIPC0); | 1005 | iowrite32(spipc0, dspi->base + SPIPC0); |
| 964 | 1006 | ||
| 965 | /* initialize chip selects */ | ||
| 966 | if (pdata->chip_sel) { | ||
| 967 | for (i = 0; i < pdata->num_chipselect; i++) { | ||
| 968 | if (pdata->chip_sel[i] != SPI_INTERN_CS) | ||
| 969 | gpio_direction_output(pdata->chip_sel[i], 1); | ||
| 970 | } | ||
| 971 | } | ||
| 972 | |||
| 973 | if (pdata->intr_line) | 1007 | if (pdata->intr_line) |
| 974 | iowrite32(SPI_INTLVL_1, dspi->base + SPILVL); | 1008 | iowrite32(SPI_INTLVL_1, dspi->base + SPILVL); |
| 975 | else | 1009 | else |
diff --git a/drivers/spi/spi-dw-mmio.c b/drivers/spi/spi-dw-mmio.c index a5cba14ac3d2..21ce0e36fa00 100644 --- a/drivers/spi/spi-dw-mmio.c +++ b/drivers/spi/spi-dw-mmio.c | |||
| @@ -16,7 +16,9 @@ | |||
| 16 | #include <linux/spi/spi.h> | 16 | #include <linux/spi/spi.h> |
| 17 | #include <linux/scatterlist.h> | 17 | #include <linux/scatterlist.h> |
| 18 | #include <linux/module.h> | 18 | #include <linux/module.h> |
| 19 | #include <linux/of.h> | ||
| 19 | #include <linux/of_gpio.h> | 20 | #include <linux/of_gpio.h> |
| 21 | #include <linux/of_platform.h> | ||
| 20 | 22 | ||
| 21 | #include "spi-dw.h" | 23 | #include "spi-dw.h" |
| 22 | 24 | ||
| @@ -33,6 +35,7 @@ static int dw_spi_mmio_probe(struct platform_device *pdev) | |||
| 33 | struct dw_spi *dws; | 35 | struct dw_spi *dws; |
| 34 | struct resource *mem; | 36 | struct resource *mem; |
| 35 | int ret; | 37 | int ret; |
| 38 | int num_cs; | ||
| 36 | 39 | ||
| 37 | dwsmmio = devm_kzalloc(&pdev->dev, sizeof(struct dw_spi_mmio), | 40 | dwsmmio = devm_kzalloc(&pdev->dev, sizeof(struct dw_spi_mmio), |
| 38 | GFP_KERNEL); | 41 | GFP_KERNEL); |
| @@ -68,9 +71,16 @@ static int dw_spi_mmio_probe(struct platform_device *pdev) | |||
| 68 | return ret; | 71 | return ret; |
| 69 | 72 | ||
| 70 | dws->bus_num = pdev->id; | 73 | dws->bus_num = pdev->id; |
| 71 | dws->num_cs = 4; | 74 | |
| 72 | dws->max_freq = clk_get_rate(dwsmmio->clk); | 75 | dws->max_freq = clk_get_rate(dwsmmio->clk); |
| 73 | 76 | ||
| 77 | num_cs = 4; | ||
| 78 | |||
| 79 | if (pdev->dev.of_node) | ||
| 80 | of_property_read_u32(pdev->dev.of_node, "num-cs", &num_cs); | ||
| 81 | |||
| 82 | dws->num_cs = num_cs; | ||
| 83 | |||
| 74 | if (pdev->dev.of_node) { | 84 | if (pdev->dev.of_node) { |
| 75 | int i; | 85 | int i; |
| 76 | 86 | ||
| @@ -114,12 +124,19 @@ static int dw_spi_mmio_remove(struct platform_device *pdev) | |||
| 114 | return 0; | 124 | return 0; |
| 115 | } | 125 | } |
| 116 | 126 | ||
| 127 | static const struct of_device_id dw_spi_mmio_of_match[] = { | ||
| 128 | { .compatible = "snps,dw-apb-ssi", }, | ||
| 129 | { /* end of table */} | ||
| 130 | }; | ||
| 131 | MODULE_DEVICE_TABLE(of, dw_spi_mmio_of_match); | ||
| 132 | |||
| 117 | static struct platform_driver dw_spi_mmio_driver = { | 133 | static struct platform_driver dw_spi_mmio_driver = { |
| 118 | .probe = dw_spi_mmio_probe, | 134 | .probe = dw_spi_mmio_probe, |
| 119 | .remove = dw_spi_mmio_remove, | 135 | .remove = dw_spi_mmio_remove, |
| 120 | .driver = { | 136 | .driver = { |
| 121 | .name = DRIVER_NAME, | 137 | .name = DRIVER_NAME, |
| 122 | .owner = THIS_MODULE, | 138 | .owner = THIS_MODULE, |
| 139 | .of_match_table = dw_spi_mmio_of_match, | ||
| 123 | }, | 140 | }, |
| 124 | }; | 141 | }; |
| 125 | module_platform_driver(dw_spi_mmio_driver); | 142 | module_platform_driver(dw_spi_mmio_driver); |
diff --git a/drivers/spi/spi-efm32.c b/drivers/spi/spi-efm32.c index be44a3eeb5e8..6caeb1cac0f3 100644 --- a/drivers/spi/spi-efm32.c +++ b/drivers/spi/spi-efm32.c | |||
| @@ -294,10 +294,16 @@ static void efm32_spi_probe_dt(struct platform_device *pdev, | |||
| 294 | u32 location; | 294 | u32 location; |
| 295 | int ret; | 295 | int ret; |
| 296 | 296 | ||
| 297 | ret = of_property_read_u32(np, "efm32,location", &location); | 297 | ret = of_property_read_u32(np, "energymicro,location", &location); |
| 298 | |||
| 299 | if (ret) | ||
| 300 | /* fall back to wrongly namespaced property */ | ||
| 301 | ret = of_property_read_u32(np, "efm32,location", &location); | ||
| 302 | |||
| 298 | if (ret) | 303 | if (ret) |
| 299 | /* fall back to old and (wrongly) generic property "location" */ | 304 | /* fall back to old and (wrongly) generic property "location" */ |
| 300 | ret = of_property_read_u32(np, "location", &location); | 305 | ret = of_property_read_u32(np, "location", &location); |
| 306 | |||
| 301 | if (!ret) { | 307 | if (!ret) { |
| 302 | dev_dbg(&pdev->dev, "using location %u\n", location); | 308 | dev_dbg(&pdev->dev, "using location %u\n", location); |
| 303 | } else { | 309 | } else { |
diff --git a/drivers/spi/spi-falcon.c b/drivers/spi/spi-falcon.c index ba441ad9a007..f73b3004d6d3 100644 --- a/drivers/spi/spi-falcon.c +++ b/drivers/spi/spi-falcon.c | |||
| @@ -425,8 +425,6 @@ static int falcon_sflash_probe(struct platform_device *pdev) | |||
| 425 | master->unprepare_transfer_hardware = falcon_sflash_unprepare_xfer; | 425 | master->unprepare_transfer_hardware = falcon_sflash_unprepare_xfer; |
| 426 | master->dev.of_node = pdev->dev.of_node; | 426 | master->dev.of_node = pdev->dev.of_node; |
| 427 | 427 | ||
| 428 | platform_set_drvdata(pdev, priv); | ||
| 429 | |||
| 430 | ret = devm_spi_register_master(&pdev->dev, master); | 428 | ret = devm_spi_register_master(&pdev->dev, master); |
| 431 | if (ret) | 429 | if (ret) |
| 432 | spi_master_put(master); | 430 | spi_master_put(master); |
diff --git a/drivers/spi/spi-fsl-lib.c b/drivers/spi/spi-fsl-lib.c index 95212ea96c8d..e0b773fc29cb 100644 --- a/drivers/spi/spi-fsl-lib.c +++ b/drivers/spi/spi-fsl-lib.c | |||
| @@ -196,7 +196,7 @@ int of_mpc8xxx_spi_probe(struct platform_device *ofdev) | |||
| 196 | 196 | ||
| 197 | pinfo = devm_kzalloc(&ofdev->dev, sizeof(*pinfo), GFP_KERNEL); | 197 | pinfo = devm_kzalloc(&ofdev->dev, sizeof(*pinfo), GFP_KERNEL); |
| 198 | if (!pinfo) | 198 | if (!pinfo) |
| 199 | return -ENOMEM; | 199 | return ret; |
| 200 | 200 | ||
| 201 | pdata = &pinfo->pdata; | 201 | pdata = &pinfo->pdata; |
| 202 | dev->platform_data = pdata; | 202 | dev->platform_data = pdata; |
diff --git a/drivers/spi/spi-fsl-spi.c b/drivers/spi/spi-fsl-spi.c index 98ccd231bf00..9452f6740997 100644 --- a/drivers/spi/spi-fsl-spi.c +++ b/drivers/spi/spi-fsl-spi.c | |||
| @@ -58,7 +58,7 @@ static struct fsl_spi_match_data of_fsl_spi_grlib_config = { | |||
| 58 | .type = TYPE_GRLIB, | 58 | .type = TYPE_GRLIB, |
| 59 | }; | 59 | }; |
| 60 | 60 | ||
| 61 | static struct of_device_id of_fsl_spi_match[] = { | 61 | static const struct of_device_id of_fsl_spi_match[] = { |
| 62 | { | 62 | { |
| 63 | .compatible = "fsl,spi", | 63 | .compatible = "fsl,spi", |
| 64 | .data = &of_fsl_spi_fsl_config, | 64 | .data = &of_fsl_spi_fsl_config, |
diff --git a/drivers/spi/spi-omap-100k.c b/drivers/spi/spi-omap-100k.c index e7ffcded4e14..5e91858f6f01 100644 --- a/drivers/spi/spi-omap-100k.c +++ b/drivers/spi/spi-omap-100k.c | |||
| @@ -420,8 +420,6 @@ static int omap1_spi100k_probe(struct platform_device *pdev) | |||
| 420 | master->min_speed_hz = OMAP1_SPI100K_MAX_FREQ/(1<<16); | 420 | master->min_speed_hz = OMAP1_SPI100K_MAX_FREQ/(1<<16); |
| 421 | master->max_speed_hz = OMAP1_SPI100K_MAX_FREQ; | 421 | master->max_speed_hz = OMAP1_SPI100K_MAX_FREQ; |
| 422 | 422 | ||
| 423 | platform_set_drvdata(pdev, master); | ||
| 424 | |||
| 425 | spi100k = spi_master_get_devdata(master); | 423 | spi100k = spi_master_get_devdata(master); |
| 426 | 424 | ||
| 427 | /* | 425 | /* |
diff --git a/drivers/spi/spi-omap-uwire.c b/drivers/spi/spi-omap-uwire.c index 0f5a0aa3b871..8bca90a19dd1 100644 --- a/drivers/spi/spi-omap-uwire.c +++ b/drivers/spi/spi-omap-uwire.c | |||
| @@ -41,14 +41,15 @@ | |||
| 41 | #include <linux/err.h> | 41 | #include <linux/err.h> |
| 42 | #include <linux/clk.h> | 42 | #include <linux/clk.h> |
| 43 | #include <linux/slab.h> | 43 | #include <linux/slab.h> |
| 44 | #include <linux/device.h> | ||
| 44 | 45 | ||
| 45 | #include <linux/spi/spi.h> | 46 | #include <linux/spi/spi.h> |
| 46 | #include <linux/spi/spi_bitbang.h> | 47 | #include <linux/spi/spi_bitbang.h> |
| 47 | #include <linux/module.h> | 48 | #include <linux/module.h> |
| 49 | #include <linux/io.h> | ||
| 48 | 50 | ||
| 49 | #include <asm/irq.h> | 51 | #include <asm/irq.h> |
| 50 | #include <mach/hardware.h> | 52 | #include <mach/hardware.h> |
| 51 | #include <asm/io.h> | ||
| 52 | #include <asm/mach-types.h> | 53 | #include <asm/mach-types.h> |
| 53 | 54 | ||
| 54 | #include <mach/mux.h> | 55 | #include <mach/mux.h> |
| @@ -447,7 +448,6 @@ static void uwire_off(struct uwire_spi *uwire) | |||
| 447 | { | 448 | { |
| 448 | uwire_write_reg(UWIRE_SR3, 0); | 449 | uwire_write_reg(UWIRE_SR3, 0); |
| 449 | clk_disable(uwire->ck); | 450 | clk_disable(uwire->ck); |
| 450 | clk_put(uwire->ck); | ||
| 451 | spi_master_put(uwire->bitbang.master); | 451 | spi_master_put(uwire->bitbang.master); |
| 452 | } | 452 | } |
| 453 | 453 | ||
| @@ -463,7 +463,7 @@ static int uwire_probe(struct platform_device *pdev) | |||
| 463 | 463 | ||
| 464 | uwire = spi_master_get_devdata(master); | 464 | uwire = spi_master_get_devdata(master); |
| 465 | 465 | ||
| 466 | uwire_base = ioremap(UWIRE_BASE_PHYS, UWIRE_IO_SIZE); | 466 | uwire_base = devm_ioremap(&pdev->dev, UWIRE_BASE_PHYS, UWIRE_IO_SIZE); |
| 467 | if (!uwire_base) { | 467 | if (!uwire_base) { |
| 468 | dev_dbg(&pdev->dev, "can't ioremap UWIRE\n"); | 468 | dev_dbg(&pdev->dev, "can't ioremap UWIRE\n"); |
| 469 | spi_master_put(master); | 469 | spi_master_put(master); |
| @@ -472,12 +472,11 @@ static int uwire_probe(struct platform_device *pdev) | |||
| 472 | 472 | ||
| 473 | platform_set_drvdata(pdev, uwire); | 473 | platform_set_drvdata(pdev, uwire); |
| 474 | 474 | ||
| 475 | uwire->ck = clk_get(&pdev->dev, "fck"); | 475 | uwire->ck = devm_clk_get(&pdev->dev, "fck"); |
| 476 | if (IS_ERR(uwire->ck)) { | 476 | if (IS_ERR(uwire->ck)) { |
| 477 | status = PTR_ERR(uwire->ck); | 477 | status = PTR_ERR(uwire->ck); |
| 478 | dev_dbg(&pdev->dev, "no functional clock?\n"); | 478 | dev_dbg(&pdev->dev, "no functional clock?\n"); |
| 479 | spi_master_put(master); | 479 | spi_master_put(master); |
| 480 | iounmap(uwire_base); | ||
| 481 | return status; | 480 | return status; |
| 482 | } | 481 | } |
| 483 | clk_enable(uwire->ck); | 482 | clk_enable(uwire->ck); |
| @@ -507,7 +506,6 @@ static int uwire_probe(struct platform_device *pdev) | |||
| 507 | status = spi_bitbang_start(&uwire->bitbang); | 506 | status = spi_bitbang_start(&uwire->bitbang); |
| 508 | if (status < 0) { | 507 | if (status < 0) { |
| 509 | uwire_off(uwire); | 508 | uwire_off(uwire); |
| 510 | iounmap(uwire_base); | ||
| 511 | } | 509 | } |
| 512 | return status; | 510 | return status; |
| 513 | } | 511 | } |
| @@ -520,7 +518,6 @@ static int uwire_remove(struct platform_device *pdev) | |||
| 520 | 518 | ||
| 521 | spi_bitbang_stop(&uwire->bitbang); | 519 | spi_bitbang_stop(&uwire->bitbang); |
| 522 | uwire_off(uwire); | 520 | uwire_off(uwire); |
| 523 | iounmap(uwire_base); | ||
| 524 | return 0; | 521 | return 0; |
| 525 | } | 522 | } |
| 526 | 523 | ||
diff --git a/drivers/spi/spi-omap2-mcspi.c b/drivers/spi/spi-omap2-mcspi.c index 4dc77df38864..68441fa448de 100644 --- a/drivers/spi/spi-omap2-mcspi.c +++ b/drivers/spi/spi-omap2-mcspi.c | |||
| @@ -149,6 +149,7 @@ struct omap2_mcspi_cs { | |||
| 149 | void __iomem *base; | 149 | void __iomem *base; |
| 150 | unsigned long phys; | 150 | unsigned long phys; |
| 151 | int word_len; | 151 | int word_len; |
| 152 | u16 mode; | ||
| 152 | struct list_head node; | 153 | struct list_head node; |
| 153 | /* Context save and restore shadow register */ | 154 | /* Context save and restore shadow register */ |
| 154 | u32 chconf0, chctrl0; | 155 | u32 chconf0, chctrl0; |
| @@ -926,6 +927,8 @@ static int omap2_mcspi_setup_transfer(struct spi_device *spi, | |||
| 926 | 927 | ||
| 927 | mcspi_write_chconf0(spi, l); | 928 | mcspi_write_chconf0(spi, l); |
| 928 | 929 | ||
| 930 | cs->mode = spi->mode; | ||
| 931 | |||
| 929 | dev_dbg(&spi->dev, "setup: speed %d, sample %s edge, clk %s\n", | 932 | dev_dbg(&spi->dev, "setup: speed %d, sample %s edge, clk %s\n", |
| 930 | speed_hz, | 933 | speed_hz, |
| 931 | (spi->mode & SPI_CPHA) ? "trailing" : "leading", | 934 | (spi->mode & SPI_CPHA) ? "trailing" : "leading", |
| @@ -998,6 +1001,7 @@ static int omap2_mcspi_setup(struct spi_device *spi) | |||
| 998 | return -ENOMEM; | 1001 | return -ENOMEM; |
| 999 | cs->base = mcspi->base + spi->chip_select * 0x14; | 1002 | cs->base = mcspi->base + spi->chip_select * 0x14; |
| 1000 | cs->phys = mcspi->phys + spi->chip_select * 0x14; | 1003 | cs->phys = mcspi->phys + spi->chip_select * 0x14; |
| 1004 | cs->mode = 0; | ||
| 1001 | cs->chconf0 = 0; | 1005 | cs->chconf0 = 0; |
| 1002 | cs->chctrl0 = 0; | 1006 | cs->chctrl0 = 0; |
| 1003 | spi->controller_state = cs; | 1007 | spi->controller_state = cs; |
| @@ -1079,6 +1083,16 @@ static void omap2_mcspi_work(struct omap2_mcspi *mcspi, struct spi_message *m) | |||
| 1079 | cs = spi->controller_state; | 1083 | cs = spi->controller_state; |
| 1080 | cd = spi->controller_data; | 1084 | cd = spi->controller_data; |
| 1081 | 1085 | ||
| 1086 | /* | ||
| 1087 | * The slave driver could have changed spi->mode in which case | ||
| 1088 | * it will be different from cs->mode (the current hardware setup). | ||
| 1089 | * If so, set par_override (even though its not a parity issue) so | ||
| 1090 | * omap2_mcspi_setup_transfer will be called to configure the hardware | ||
| 1091 | * with the correct mode on the first iteration of the loop below. | ||
| 1092 | */ | ||
| 1093 | if (spi->mode != cs->mode) | ||
| 1094 | par_override = 1; | ||
| 1095 | |||
| 1082 | omap2_mcspi_set_enable(spi, 0); | 1096 | omap2_mcspi_set_enable(spi, 0); |
| 1083 | list_for_each_entry(t, &m->transfers, transfer_list) { | 1097 | list_for_each_entry(t, &m->transfers, transfer_list) { |
| 1084 | if (t->tx_buf == NULL && t->rx_buf == NULL && t->len) { | 1098 | if (t->tx_buf == NULL && t->rx_buf == NULL && t->len) { |
diff --git a/drivers/spi/spi-orion.c b/drivers/spi/spi-orion.c index d018a4aac3a1..c4675fa8b645 100644 --- a/drivers/spi/spi-orion.c +++ b/drivers/spi/spi-orion.c | |||
| @@ -16,6 +16,7 @@ | |||
| 16 | #include <linux/io.h> | 16 | #include <linux/io.h> |
| 17 | #include <linux/spi/spi.h> | 17 | #include <linux/spi/spi.h> |
| 18 | #include <linux/module.h> | 18 | #include <linux/module.h> |
| 19 | #include <linux/pm_runtime.h> | ||
| 19 | #include <linux/of.h> | 20 | #include <linux/of.h> |
| 20 | #include <linux/clk.h> | 21 | #include <linux/clk.h> |
| 21 | #include <linux/sizes.h> | 22 | #include <linux/sizes.h> |
| @@ -23,6 +24,9 @@ | |||
| 23 | 24 | ||
| 24 | #define DRIVER_NAME "orion_spi" | 25 | #define DRIVER_NAME "orion_spi" |
| 25 | 26 | ||
| 27 | /* Runtime PM autosuspend timeout: PM is fairly light on this driver */ | ||
| 28 | #define SPI_AUTOSUSPEND_TIMEOUT 200 | ||
| 29 | |||
| 26 | #define ORION_NUM_CHIPSELECTS 1 /* only one slave is supported*/ | 30 | #define ORION_NUM_CHIPSELECTS 1 /* only one slave is supported*/ |
| 27 | #define ORION_SPI_WAIT_RDY_MAX_LOOP 2000 /* in usec */ | 31 | #define ORION_SPI_WAIT_RDY_MAX_LOOP 2000 /* in usec */ |
| 28 | 32 | ||
| @@ -277,7 +281,6 @@ out: | |||
| 277 | return xfer->len - count; | 281 | return xfer->len - count; |
| 278 | } | 282 | } |
| 279 | 283 | ||
| 280 | |||
| 281 | static int orion_spi_transfer_one_message(struct spi_master *master, | 284 | static int orion_spi_transfer_one_message(struct spi_master *master, |
| 282 | struct spi_message *m) | 285 | struct spi_message *m) |
| 283 | { | 286 | { |
| @@ -346,8 +349,6 @@ static int orion_spi_probe(struct platform_device *pdev) | |||
| 346 | struct resource *r; | 349 | struct resource *r; |
| 347 | unsigned long tclk_hz; | 350 | unsigned long tclk_hz; |
| 348 | int status = 0; | 351 | int status = 0; |
| 349 | const u32 *iprop; | ||
| 350 | int size; | ||
| 351 | 352 | ||
| 352 | master = spi_alloc_master(&pdev->dev, sizeof(*spi)); | 353 | master = spi_alloc_master(&pdev->dev, sizeof(*spi)); |
| 353 | if (master == NULL) { | 354 | if (master == NULL) { |
| @@ -358,10 +359,10 @@ static int orion_spi_probe(struct platform_device *pdev) | |||
| 358 | if (pdev->id != -1) | 359 | if (pdev->id != -1) |
| 359 | master->bus_num = pdev->id; | 360 | master->bus_num = pdev->id; |
| 360 | if (pdev->dev.of_node) { | 361 | if (pdev->dev.of_node) { |
| 361 | iprop = of_get_property(pdev->dev.of_node, "cell-index", | 362 | u32 cell_index; |
| 362 | &size); | 363 | if (!of_property_read_u32(pdev->dev.of_node, "cell-index", |
| 363 | if (iprop && size == sizeof(*iprop)) | 364 | &cell_index)) |
| 364 | master->bus_num = *iprop; | 365 | master->bus_num = cell_index; |
| 365 | } | 366 | } |
| 366 | 367 | ||
| 367 | /* we support only mode 0, and no options */ | 368 | /* we support only mode 0, and no options */ |
| @@ -370,6 +371,7 @@ static int orion_spi_probe(struct platform_device *pdev) | |||
| 370 | master->transfer_one_message = orion_spi_transfer_one_message; | 371 | master->transfer_one_message = orion_spi_transfer_one_message; |
| 371 | master->num_chipselect = ORION_NUM_CHIPSELECTS; | 372 | master->num_chipselect = ORION_NUM_CHIPSELECTS; |
| 372 | master->bits_per_word_mask = SPI_BPW_MASK(8) | SPI_BPW_MASK(16); | 373 | master->bits_per_word_mask = SPI_BPW_MASK(8) | SPI_BPW_MASK(16); |
| 374 | master->auto_runtime_pm = true; | ||
| 373 | 375 | ||
| 374 | platform_set_drvdata(pdev, master); | 376 | platform_set_drvdata(pdev, master); |
| 375 | 377 | ||
| @@ -382,8 +384,10 @@ static int orion_spi_probe(struct platform_device *pdev) | |||
| 382 | goto out; | 384 | goto out; |
| 383 | } | 385 | } |
| 384 | 386 | ||
| 385 | clk_prepare(spi->clk); | 387 | status = clk_prepare_enable(spi->clk); |
| 386 | clk_enable(spi->clk); | 388 | if (status) |
| 389 | goto out; | ||
| 390 | |||
| 387 | tclk_hz = clk_get_rate(spi->clk); | 391 | tclk_hz = clk_get_rate(spi->clk); |
| 388 | master->max_speed_hz = DIV_ROUND_UP(tclk_hz, 4); | 392 | master->max_speed_hz = DIV_ROUND_UP(tclk_hz, 4); |
| 389 | master->min_speed_hz = DIV_ROUND_UP(tclk_hz, 30); | 393 | master->min_speed_hz = DIV_ROUND_UP(tclk_hz, 30); |
| @@ -395,16 +399,27 @@ static int orion_spi_probe(struct platform_device *pdev) | |||
| 395 | goto out_rel_clk; | 399 | goto out_rel_clk; |
| 396 | } | 400 | } |
| 397 | 401 | ||
| 398 | if (orion_spi_reset(spi) < 0) | 402 | pm_runtime_set_active(&pdev->dev); |
| 399 | goto out_rel_clk; | 403 | pm_runtime_use_autosuspend(&pdev->dev); |
| 404 | pm_runtime_set_autosuspend_delay(&pdev->dev, SPI_AUTOSUSPEND_TIMEOUT); | ||
| 405 | pm_runtime_enable(&pdev->dev); | ||
| 406 | |||
| 407 | status = orion_spi_reset(spi); | ||
| 408 | if (status < 0) | ||
| 409 | goto out_rel_pm; | ||
| 410 | |||
| 411 | pm_runtime_mark_last_busy(&pdev->dev); | ||
| 412 | pm_runtime_put_autosuspend(&pdev->dev); | ||
| 400 | 413 | ||
| 401 | master->dev.of_node = pdev->dev.of_node; | 414 | master->dev.of_node = pdev->dev.of_node; |
| 402 | status = devm_spi_register_master(&pdev->dev, master); | 415 | status = spi_register_master(master); |
| 403 | if (status < 0) | 416 | if (status < 0) |
| 404 | goto out_rel_clk; | 417 | goto out_rel_pm; |
| 405 | 418 | ||
| 406 | return status; | 419 | return status; |
| 407 | 420 | ||
| 421 | out_rel_pm: | ||
| 422 | pm_runtime_disable(&pdev->dev); | ||
| 408 | out_rel_clk: | 423 | out_rel_clk: |
| 409 | clk_disable_unprepare(spi->clk); | 424 | clk_disable_unprepare(spi->clk); |
| 410 | out: | 425 | out: |
| @@ -415,19 +430,45 @@ out: | |||
| 415 | 430 | ||
| 416 | static int orion_spi_remove(struct platform_device *pdev) | 431 | static int orion_spi_remove(struct platform_device *pdev) |
| 417 | { | 432 | { |
| 418 | struct spi_master *master; | 433 | struct spi_master *master = platform_get_drvdata(pdev); |
| 419 | struct orion_spi *spi; | 434 | struct orion_spi *spi = spi_master_get_devdata(master); |
| 420 | |||
| 421 | master = platform_get_drvdata(pdev); | ||
| 422 | spi = spi_master_get_devdata(master); | ||
| 423 | 435 | ||
| 436 | pm_runtime_get_sync(&pdev->dev); | ||
| 424 | clk_disable_unprepare(spi->clk); | 437 | clk_disable_unprepare(spi->clk); |
| 425 | 438 | ||
| 439 | spi_unregister_master(master); | ||
| 440 | pm_runtime_disable(&pdev->dev); | ||
| 441 | |||
| 426 | return 0; | 442 | return 0; |
| 427 | } | 443 | } |
| 428 | 444 | ||
| 429 | MODULE_ALIAS("platform:" DRIVER_NAME); | 445 | MODULE_ALIAS("platform:" DRIVER_NAME); |
| 430 | 446 | ||
| 447 | #ifdef CONFIG_PM_RUNTIME | ||
| 448 | static int orion_spi_runtime_suspend(struct device *dev) | ||
| 449 | { | ||
| 450 | struct spi_master *master = dev_get_drvdata(dev); | ||
| 451 | struct orion_spi *spi = spi_master_get_devdata(master); | ||
| 452 | |||
| 453 | clk_disable_unprepare(spi->clk); | ||
| 454 | return 0; | ||
| 455 | } | ||
| 456 | |||
| 457 | static int orion_spi_runtime_resume(struct device *dev) | ||
| 458 | { | ||
| 459 | struct spi_master *master = dev_get_drvdata(dev); | ||
| 460 | struct orion_spi *spi = spi_master_get_devdata(master); | ||
| 461 | |||
| 462 | return clk_prepare_enable(spi->clk); | ||
| 463 | } | ||
| 464 | #endif | ||
| 465 | |||
| 466 | static const struct dev_pm_ops orion_spi_pm_ops = { | ||
| 467 | SET_RUNTIME_PM_OPS(orion_spi_runtime_suspend, | ||
| 468 | orion_spi_runtime_resume, | ||
| 469 | NULL) | ||
| 470 | }; | ||
| 471 | |||
| 431 | static const struct of_device_id orion_spi_of_match_table[] = { | 472 | static const struct of_device_id orion_spi_of_match_table[] = { |
| 432 | { .compatible = "marvell,orion-spi", }, | 473 | { .compatible = "marvell,orion-spi", }, |
| 433 | {} | 474 | {} |
| @@ -438,6 +479,7 @@ static struct platform_driver orion_spi_driver = { | |||
| 438 | .driver = { | 479 | .driver = { |
| 439 | .name = DRIVER_NAME, | 480 | .name = DRIVER_NAME, |
| 440 | .owner = THIS_MODULE, | 481 | .owner = THIS_MODULE, |
| 482 | .pm = &orion_spi_pm_ops, | ||
| 441 | .of_match_table = of_match_ptr(orion_spi_of_match_table), | 483 | .of_match_table = of_match_ptr(orion_spi_of_match_table), |
| 442 | }, | 484 | }, |
| 443 | .probe = orion_spi_probe, | 485 | .probe = orion_spi_probe, |
diff --git a/drivers/spi/spi-pl022.c b/drivers/spi/spi-pl022.c index 66d2ae21e78e..1189cfd96477 100644 --- a/drivers/spi/spi-pl022.c +++ b/drivers/spi/spi-pl022.c | |||
| @@ -1417,7 +1417,7 @@ static void do_interrupt_dma_transfer(struct pl022 *pl022) | |||
| 1417 | * Default is to enable all interrupts except RX - | 1417 | * Default is to enable all interrupts except RX - |
| 1418 | * this will be enabled once TX is complete | 1418 | * this will be enabled once TX is complete |
| 1419 | */ | 1419 | */ |
| 1420 | u32 irqflags = ENABLE_ALL_INTERRUPTS & ~SSP_IMSC_MASK_RXIM; | 1420 | u32 irqflags = (u32)(ENABLE_ALL_INTERRUPTS & ~SSP_IMSC_MASK_RXIM); |
| 1421 | 1421 | ||
| 1422 | /* Enable target chip, if not already active */ | 1422 | /* Enable target chip, if not already active */ |
| 1423 | if (!pl022->next_msg_cs_active) | 1423 | if (!pl022->next_msg_cs_active) |
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..9f83d2950748 100644 --- a/drivers/spi/spi-qup.c +++ b/drivers/spi/spi-qup.c | |||
| @@ -142,6 +142,7 @@ struct spi_qup { | |||
| 142 | int w_size; /* bytes per SPI word */ | 142 | int w_size; /* bytes per SPI word */ |
| 143 | int tx_bytes; | 143 | int tx_bytes; |
| 144 | int rx_bytes; | 144 | int rx_bytes; |
| 145 | int qup_v1; | ||
| 145 | }; | 146 | }; |
| 146 | 147 | ||
| 147 | 148 | ||
| @@ -420,35 +421,12 @@ static int spi_qup_io_config(struct spi_device *spi, struct spi_transfer *xfer) | |||
| 420 | config |= QUP_CONFIG_SPI_MODE; | 421 | config |= QUP_CONFIG_SPI_MODE; |
| 421 | writel_relaxed(config, controller->base + QUP_CONFIG); | 422 | writel_relaxed(config, controller->base + QUP_CONFIG); |
| 422 | 423 | ||
| 423 | writel_relaxed(0, controller->base + QUP_OPERATIONAL_MASK); | 424 | /* only write to OPERATIONAL_MASK when register is present */ |
| 425 | if (!controller->qup_v1) | ||
| 426 | writel_relaxed(0, controller->base + QUP_OPERATIONAL_MASK); | ||
| 424 | return 0; | 427 | return 0; |
| 425 | } | 428 | } |
| 426 | 429 | ||
| 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, | 430 | static int spi_qup_transfer_one(struct spi_master *master, |
| 453 | struct spi_device *spi, | 431 | struct spi_device *spi, |
| 454 | struct spi_transfer *xfer) | 432 | struct spi_transfer *xfer) |
| @@ -511,7 +489,7 @@ static int spi_qup_probe(struct platform_device *pdev) | |||
| 511 | struct resource *res; | 489 | struct resource *res; |
| 512 | struct device *dev; | 490 | struct device *dev; |
| 513 | void __iomem *base; | 491 | void __iomem *base; |
| 514 | u32 data, max_freq, iomode; | 492 | u32 max_freq, iomode; |
| 515 | int ret, irq, size; | 493 | int ret, irq, size; |
| 516 | 494 | ||
| 517 | dev = &pdev->dev; | 495 | dev = &pdev->dev; |
| @@ -554,15 +532,6 @@ static int spi_qup_probe(struct platform_device *pdev) | |||
| 554 | return ret; | 532 | return ret; |
| 555 | } | 533 | } |
| 556 | 534 | ||
| 557 | data = readl_relaxed(base + QUP_HW_VERSION); | ||
| 558 | |||
| 559 | if (data < QUP_HW_VERSION_2_1_1) { | ||
| 560 | clk_disable_unprepare(cclk); | ||
| 561 | clk_disable_unprepare(iclk); | ||
| 562 | dev_err(dev, "v.%08x is not supported\n", data); | ||
| 563 | return -ENXIO; | ||
| 564 | } | ||
| 565 | |||
| 566 | master = spi_alloc_master(dev, sizeof(struct spi_qup)); | 535 | master = spi_alloc_master(dev, sizeof(struct spi_qup)); |
| 567 | if (!master) { | 536 | if (!master) { |
| 568 | clk_disable_unprepare(cclk); | 537 | clk_disable_unprepare(cclk); |
| @@ -571,12 +540,16 @@ static int spi_qup_probe(struct platform_device *pdev) | |||
| 571 | return -ENOMEM; | 540 | return -ENOMEM; |
| 572 | } | 541 | } |
| 573 | 542 | ||
| 543 | /* use num-cs unless not present or out of range */ | ||
| 544 | if (of_property_read_u16(dev->of_node, "num-cs", | ||
| 545 | &master->num_chipselect) || | ||
| 546 | (master->num_chipselect > SPI_NUM_CHIPSELECTS)) | ||
| 547 | master->num_chipselect = SPI_NUM_CHIPSELECTS; | ||
| 548 | |||
| 574 | master->bus_num = pdev->id; | 549 | master->bus_num = pdev->id; |
| 575 | master->mode_bits = SPI_CPOL | SPI_CPHA | SPI_CS_HIGH | SPI_LOOP; | 550 | 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); | 551 | master->bits_per_word_mask = SPI_BPW_RANGE_MASK(4, 32); |
| 578 | master->max_speed_hz = max_freq; | 552 | master->max_speed_hz = max_freq; |
| 579 | master->set_cs = spi_qup_set_cs; | ||
| 580 | master->transfer_one = spi_qup_transfer_one; | 553 | master->transfer_one = spi_qup_transfer_one; |
| 581 | master->dev.of_node = pdev->dev.of_node; | 554 | master->dev.of_node = pdev->dev.of_node; |
| 582 | master->auto_runtime_pm = true; | 555 | master->auto_runtime_pm = true; |
| @@ -591,6 +564,10 @@ static int spi_qup_probe(struct platform_device *pdev) | |||
| 591 | controller->cclk = cclk; | 564 | controller->cclk = cclk; |
| 592 | controller->irq = irq; | 565 | controller->irq = irq; |
| 593 | 566 | ||
| 567 | /* set v1 flag if device is version 1 */ | ||
| 568 | if (of_device_is_compatible(dev->of_node, "qcom,spi-qup-v1.1.1")) | ||
| 569 | controller->qup_v1 = 1; | ||
| 570 | |||
| 594 | spin_lock_init(&controller->lock); | 571 | spin_lock_init(&controller->lock); |
| 595 | init_completion(&controller->done); | 572 | init_completion(&controller->done); |
| 596 | 573 | ||
| @@ -614,8 +591,8 @@ static int spi_qup_probe(struct platform_device *pdev) | |||
| 614 | size = QUP_IO_M_INPUT_FIFO_SIZE(iomode); | 591 | size = QUP_IO_M_INPUT_FIFO_SIZE(iomode); |
| 615 | controller->in_fifo_sz = controller->in_blk_sz * (2 << size); | 592 | controller->in_fifo_sz = controller->in_blk_sz * (2 << size); |
| 616 | 593 | ||
| 617 | dev_info(dev, "v.%08x IN:block:%d, fifo:%d, OUT:block:%d, fifo:%d\n", | 594 | dev_info(dev, "IN:block:%d, fifo:%d, OUT:block:%d, fifo:%d\n", |
| 618 | data, controller->in_blk_sz, controller->in_fifo_sz, | 595 | controller->in_blk_sz, controller->in_fifo_sz, |
| 619 | controller->out_blk_sz, controller->out_fifo_sz); | 596 | controller->out_blk_sz, controller->out_fifo_sz); |
| 620 | 597 | ||
| 621 | writel_relaxed(1, base + QUP_SW_RESET); | 598 | writel_relaxed(1, base + QUP_SW_RESET); |
| @@ -628,10 +605,19 @@ static int spi_qup_probe(struct platform_device *pdev) | |||
| 628 | 605 | ||
| 629 | writel_relaxed(0, base + QUP_OPERATIONAL); | 606 | writel_relaxed(0, base + QUP_OPERATIONAL); |
| 630 | writel_relaxed(0, base + QUP_IO_M_MODES); | 607 | writel_relaxed(0, base + QUP_IO_M_MODES); |
| 631 | writel_relaxed(0, base + QUP_OPERATIONAL_MASK); | 608 | |
| 609 | if (!controller->qup_v1) | ||
| 610 | writel_relaxed(0, base + QUP_OPERATIONAL_MASK); | ||
| 611 | |||
| 632 | writel_relaxed(SPI_ERROR_CLK_UNDER_RUN | SPI_ERROR_CLK_OVER_RUN, | 612 | writel_relaxed(SPI_ERROR_CLK_UNDER_RUN | SPI_ERROR_CLK_OVER_RUN, |
| 633 | base + SPI_ERROR_FLAGS_EN); | 613 | base + SPI_ERROR_FLAGS_EN); |
| 634 | 614 | ||
| 615 | /* if earlier version of the QUP, disable INPUT_OVERRUN */ | ||
| 616 | if (controller->qup_v1) | ||
| 617 | writel_relaxed(QUP_ERROR_OUTPUT_OVER_RUN | | ||
| 618 | QUP_ERROR_INPUT_UNDER_RUN | QUP_ERROR_OUTPUT_UNDER_RUN, | ||
| 619 | base + QUP_ERROR_FLAGS_EN); | ||
| 620 | |||
| 635 | writel_relaxed(0, base + SPI_CONFIG); | 621 | writel_relaxed(0, base + SPI_CONFIG); |
| 636 | writel_relaxed(SPI_IO_C_NO_TRI_STATE, base + SPI_IO_CONTROL); | 622 | writel_relaxed(SPI_IO_C_NO_TRI_STATE, base + SPI_IO_CONTROL); |
| 637 | 623 | ||
| @@ -640,16 +626,19 @@ static int spi_qup_probe(struct platform_device *pdev) | |||
| 640 | if (ret) | 626 | if (ret) |
| 641 | goto error; | 627 | goto error; |
| 642 | 628 | ||
| 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); | 629 | pm_runtime_set_autosuspend_delay(dev, MSEC_PER_SEC); |
| 648 | pm_runtime_use_autosuspend(dev); | 630 | pm_runtime_use_autosuspend(dev); |
| 649 | pm_runtime_set_active(dev); | 631 | pm_runtime_set_active(dev); |
| 650 | pm_runtime_enable(dev); | 632 | pm_runtime_enable(dev); |
| 633 | |||
| 634 | ret = devm_spi_register_master(dev, master); | ||
| 635 | if (ret) | ||
| 636 | goto disable_pm; | ||
| 637 | |||
| 651 | return 0; | 638 | return 0; |
| 652 | 639 | ||
| 640 | disable_pm: | ||
| 641 | pm_runtime_disable(&pdev->dev); | ||
| 653 | error: | 642 | error: |
| 654 | clk_disable_unprepare(cclk); | 643 | clk_disable_unprepare(cclk); |
| 655 | clk_disable_unprepare(iclk); | 644 | clk_disable_unprepare(iclk); |
| @@ -750,6 +739,7 @@ static int spi_qup_remove(struct platform_device *pdev) | |||
| 750 | } | 739 | } |
| 751 | 740 | ||
| 752 | static const struct of_device_id spi_qup_dt_match[] = { | 741 | static const struct of_device_id spi_qup_dt_match[] = { |
| 742 | { .compatible = "qcom,spi-qup-v1.1.1", }, | ||
| 753 | { .compatible = "qcom,spi-qup-v2.1.1", }, | 743 | { .compatible = "qcom,spi-qup-v2.1.1", }, |
| 754 | { .compatible = "qcom,spi-qup-v2.2.1", }, | 744 | { .compatible = "qcom,spi-qup-v2.2.1", }, |
| 755 | { } | 745 | { } |
diff --git a/drivers/spi/spi-rspi.c b/drivers/spi/spi-rspi.c index 10112745bb17..c850dfdfa9e3 100644 --- a/drivers/spi/spi-rspi.c +++ b/drivers/spi/spi-rspi.c | |||
| @@ -477,7 +477,7 @@ static int rspi_dma_transfer(struct rspi_data *rspi, struct sg_table *tx, | |||
| 477 | tx->sgl, tx->nents, DMA_TO_DEVICE, | 477 | tx->sgl, tx->nents, DMA_TO_DEVICE, |
| 478 | DMA_PREP_INTERRUPT | DMA_CTRL_ACK); | 478 | DMA_PREP_INTERRUPT | DMA_CTRL_ACK); |
| 479 | if (!desc_tx) | 479 | if (!desc_tx) |
| 480 | return -EIO; | 480 | goto no_dma; |
| 481 | 481 | ||
| 482 | irq_mask |= SPCR_SPTIE; | 482 | irq_mask |= SPCR_SPTIE; |
| 483 | } | 483 | } |
| @@ -486,7 +486,7 @@ static int rspi_dma_transfer(struct rspi_data *rspi, struct sg_table *tx, | |||
| 486 | rx->sgl, rx->nents, DMA_FROM_DEVICE, | 486 | rx->sgl, rx->nents, DMA_FROM_DEVICE, |
| 487 | DMA_PREP_INTERRUPT | DMA_CTRL_ACK); | 487 | DMA_PREP_INTERRUPT | DMA_CTRL_ACK); |
| 488 | if (!desc_rx) | 488 | if (!desc_rx) |
| 489 | return -EIO; | 489 | goto no_dma; |
| 490 | 490 | ||
| 491 | irq_mask |= SPCR_SPRIE; | 491 | irq_mask |= SPCR_SPRIE; |
| 492 | } | 492 | } |
| @@ -540,6 +540,12 @@ static int rspi_dma_transfer(struct rspi_data *rspi, struct sg_table *tx, | |||
| 540 | enable_irq(rspi->rx_irq); | 540 | enable_irq(rspi->rx_irq); |
| 541 | 541 | ||
| 542 | return ret; | 542 | return ret; |
| 543 | |||
| 544 | no_dma: | ||
| 545 | pr_warn_once("%s %s: DMA not available, falling back to PIO\n", | ||
| 546 | dev_driver_string(&rspi->master->dev), | ||
| 547 | dev_name(&rspi->master->dev)); | ||
| 548 | return -EAGAIN; | ||
| 543 | } | 549 | } |
| 544 | 550 | ||
| 545 | static void rspi_receive_init(const struct rspi_data *rspi) | 551 | static void rspi_receive_init(const struct rspi_data *rspi) |
| @@ -593,8 +599,10 @@ static int rspi_common_transfer(struct rspi_data *rspi, | |||
| 593 | 599 | ||
| 594 | if (rspi->master->can_dma && __rspi_can_dma(rspi, xfer)) { | 600 | if (rspi->master->can_dma && __rspi_can_dma(rspi, xfer)) { |
| 595 | /* rx_buf can be NULL on RSPI on SH in TX-only Mode */ | 601 | /* rx_buf can be NULL on RSPI on SH in TX-only Mode */ |
| 596 | return rspi_dma_transfer(rspi, &xfer->tx_sg, | 602 | ret = rspi_dma_transfer(rspi, &xfer->tx_sg, |
| 597 | xfer->rx_buf ? &xfer->rx_sg : NULL); | 603 | xfer->rx_buf ? &xfer->rx_sg : NULL); |
| 604 | if (ret != -EAGAIN) | ||
| 605 | return ret; | ||
| 598 | } | 606 | } |
| 599 | 607 | ||
| 600 | ret = rspi_pio_transfer(rspi, xfer->tx_buf, xfer->rx_buf, xfer->len); | 608 | ret = rspi_pio_transfer(rspi, xfer->tx_buf, xfer->rx_buf, xfer->len); |
| @@ -630,7 +638,6 @@ static int rspi_rz_transfer_one(struct spi_master *master, | |||
| 630 | struct spi_transfer *xfer) | 638 | struct spi_transfer *xfer) |
| 631 | { | 639 | { |
| 632 | struct rspi_data *rspi = spi_master_get_devdata(master); | 640 | struct rspi_data *rspi = spi_master_get_devdata(master); |
| 633 | int ret; | ||
| 634 | 641 | ||
| 635 | rspi_rz_receive_init(rspi); | 642 | rspi_rz_receive_init(rspi); |
| 636 | 643 | ||
| @@ -649,8 +656,11 @@ static int qspi_transfer_out(struct rspi_data *rspi, struct spi_transfer *xfer) | |||
| 649 | { | 656 | { |
| 650 | int ret; | 657 | int ret; |
| 651 | 658 | ||
| 652 | if (rspi->master->can_dma && __rspi_can_dma(rspi, xfer)) | 659 | if (rspi->master->can_dma && __rspi_can_dma(rspi, xfer)) { |
| 653 | return rspi_dma_transfer(rspi, &xfer->tx_sg, NULL); | 660 | ret = rspi_dma_transfer(rspi, &xfer->tx_sg, NULL); |
| 661 | if (ret != -EAGAIN) | ||
| 662 | return ret; | ||
| 663 | } | ||
| 654 | 664 | ||
| 655 | ret = rspi_pio_transfer(rspi, xfer->tx_buf, NULL, xfer->len); | 665 | ret = rspi_pio_transfer(rspi, xfer->tx_buf, NULL, xfer->len); |
| 656 | if (ret < 0) | 666 | if (ret < 0) |
| @@ -664,8 +674,11 @@ static int qspi_transfer_out(struct rspi_data *rspi, struct spi_transfer *xfer) | |||
| 664 | 674 | ||
| 665 | static int qspi_transfer_in(struct rspi_data *rspi, struct spi_transfer *xfer) | 675 | static int qspi_transfer_in(struct rspi_data *rspi, struct spi_transfer *xfer) |
| 666 | { | 676 | { |
| 667 | if (rspi->master->can_dma && __rspi_can_dma(rspi, xfer)) | 677 | if (rspi->master->can_dma && __rspi_can_dma(rspi, xfer)) { |
| 668 | return rspi_dma_transfer(rspi, NULL, &xfer->rx_sg); | 678 | int ret = rspi_dma_transfer(rspi, NULL, &xfer->rx_sg); |
| 679 | if (ret != -EAGAIN) | ||
| 680 | return ret; | ||
| 681 | } | ||
| 669 | 682 | ||
| 670 | return rspi_pio_transfer(rspi, NULL, xfer->rx_buf, xfer->len); | 683 | return rspi_pio_transfer(rspi, NULL, xfer->rx_buf, xfer->len); |
| 671 | } | 684 | } |
| @@ -927,19 +940,19 @@ static int rspi_request_dma(struct device *dev, struct spi_master *master, | |||
| 927 | return 0; | 940 | return 0; |
| 928 | } | 941 | } |
| 929 | 942 | ||
| 930 | static void rspi_release_dma(struct rspi_data *rspi) | 943 | static void rspi_release_dma(struct spi_master *master) |
| 931 | { | 944 | { |
| 932 | if (rspi->master->dma_tx) | 945 | if (master->dma_tx) |
| 933 | dma_release_channel(rspi->master->dma_tx); | 946 | dma_release_channel(master->dma_tx); |
| 934 | if (rspi->master->dma_rx) | 947 | if (master->dma_rx) |
| 935 | dma_release_channel(rspi->master->dma_rx); | 948 | dma_release_channel(master->dma_rx); |
| 936 | } | 949 | } |
| 937 | 950 | ||
| 938 | static int rspi_remove(struct platform_device *pdev) | 951 | static int rspi_remove(struct platform_device *pdev) |
| 939 | { | 952 | { |
| 940 | struct rspi_data *rspi = platform_get_drvdata(pdev); | 953 | struct rspi_data *rspi = platform_get_drvdata(pdev); |
| 941 | 954 | ||
| 942 | rspi_release_dma(rspi); | 955 | rspi_release_dma(rspi->master); |
| 943 | pm_runtime_disable(&pdev->dev); | 956 | pm_runtime_disable(&pdev->dev); |
| 944 | 957 | ||
| 945 | return 0; | 958 | return 0; |
| @@ -1141,7 +1154,7 @@ static int rspi_probe(struct platform_device *pdev) | |||
| 1141 | return 0; | 1154 | return 0; |
| 1142 | 1155 | ||
| 1143 | error3: | 1156 | error3: |
| 1144 | rspi_release_dma(rspi); | 1157 | rspi_release_dma(master); |
| 1145 | error2: | 1158 | error2: |
| 1146 | pm_runtime_disable(&pdev->dev); | 1159 | pm_runtime_disable(&pdev->dev); |
| 1147 | error1: | 1160 | error1: |
diff --git a/drivers/spi/spi-s3c64xx.c b/drivers/spi/spi-s3c64xx.c index 75a56968b14c..1c36311935d7 100644 --- a/drivers/spi/spi-s3c64xx.c +++ b/drivers/spi/spi-s3c64xx.c | |||
| @@ -197,7 +197,6 @@ struct s3c64xx_spi_driver_data { | |||
| 197 | struct s3c64xx_spi_dma_data tx_dma; | 197 | struct s3c64xx_spi_dma_data tx_dma; |
| 198 | struct s3c64xx_spi_port_config *port_conf; | 198 | struct s3c64xx_spi_port_config *port_conf; |
| 199 | unsigned int port_id; | 199 | unsigned int port_id; |
| 200 | bool cs_gpio; | ||
| 201 | }; | 200 | }; |
| 202 | 201 | ||
| 203 | static void flush_fifo(struct s3c64xx_spi_driver_data *sdd) | 202 | static void flush_fifo(struct s3c64xx_spi_driver_data *sdd) |
| @@ -754,10 +753,8 @@ static struct s3c64xx_spi_csinfo *s3c64xx_get_slave_ctrldata( | |||
| 754 | { | 753 | { |
| 755 | struct s3c64xx_spi_csinfo *cs; | 754 | struct s3c64xx_spi_csinfo *cs; |
| 756 | struct device_node *slave_np, *data_np = NULL; | 755 | struct device_node *slave_np, *data_np = NULL; |
| 757 | struct s3c64xx_spi_driver_data *sdd; | ||
| 758 | u32 fb_delay = 0; | 756 | u32 fb_delay = 0; |
| 759 | 757 | ||
| 760 | sdd = spi_master_get_devdata(spi->master); | ||
| 761 | slave_np = spi->dev.of_node; | 758 | slave_np = spi->dev.of_node; |
| 762 | if (!slave_np) { | 759 | if (!slave_np) { |
| 763 | dev_err(&spi->dev, "device node not found\n"); | 760 | dev_err(&spi->dev, "device node not found\n"); |
| @@ -776,17 +773,6 @@ static struct s3c64xx_spi_csinfo *s3c64xx_get_slave_ctrldata( | |||
| 776 | return ERR_PTR(-ENOMEM); | 773 | return ERR_PTR(-ENOMEM); |
| 777 | } | 774 | } |
| 778 | 775 | ||
| 779 | /* The CS line is asserted/deasserted by the gpio pin */ | ||
| 780 | if (sdd->cs_gpio) | ||
| 781 | cs->line = of_get_named_gpio(data_np, "cs-gpio", 0); | ||
| 782 | |||
| 783 | if (!gpio_is_valid(cs->line)) { | ||
| 784 | dev_err(&spi->dev, "chip select gpio is not specified or invalid\n"); | ||
| 785 | kfree(cs); | ||
| 786 | of_node_put(data_np); | ||
| 787 | return ERR_PTR(-EINVAL); | ||
| 788 | } | ||
| 789 | |||
| 790 | of_property_read_u32(data_np, "samsung,spi-feedback-delay", &fb_delay); | 776 | of_property_read_u32(data_np, "samsung,spi-feedback-delay", &fb_delay); |
| 791 | cs->fb_delay = fb_delay; | 777 | cs->fb_delay = fb_delay; |
| 792 | of_node_put(data_np); | 778 | of_node_put(data_np); |
| @@ -807,9 +793,16 @@ static int s3c64xx_spi_setup(struct spi_device *spi) | |||
| 807 | int err; | 793 | int err; |
| 808 | 794 | ||
| 809 | sdd = spi_master_get_devdata(spi->master); | 795 | sdd = spi_master_get_devdata(spi->master); |
| 810 | if (!cs && spi->dev.of_node) { | 796 | if (spi->dev.of_node) { |
| 811 | cs = s3c64xx_get_slave_ctrldata(spi); | 797 | cs = s3c64xx_get_slave_ctrldata(spi); |
| 812 | spi->controller_data = cs; | 798 | spi->controller_data = cs; |
| 799 | } else if (cs) { | ||
| 800 | /* On non-DT platforms the SPI core will set spi->cs_gpio | ||
| 801 | * to -ENOENT. The GPIO pin used to drive the chip select | ||
| 802 | * is defined by using platform data so spi->cs_gpio value | ||
| 803 | * has to be override to have the proper GPIO pin number. | ||
| 804 | */ | ||
| 805 | spi->cs_gpio = cs->line; | ||
| 813 | } | 806 | } |
| 814 | 807 | ||
| 815 | if (IS_ERR_OR_NULL(cs)) { | 808 | if (IS_ERR_OR_NULL(cs)) { |
| @@ -818,18 +811,15 @@ static int s3c64xx_spi_setup(struct spi_device *spi) | |||
| 818 | } | 811 | } |
| 819 | 812 | ||
| 820 | if (!spi_get_ctldata(spi)) { | 813 | if (!spi_get_ctldata(spi)) { |
| 821 | /* Request gpio only if cs line is asserted by gpio pins */ | 814 | if (gpio_is_valid(spi->cs_gpio)) { |
| 822 | if (sdd->cs_gpio) { | 815 | err = gpio_request_one(spi->cs_gpio, GPIOF_OUT_INIT_HIGH, |
| 823 | err = gpio_request_one(cs->line, GPIOF_OUT_INIT_HIGH, | 816 | dev_name(&spi->dev)); |
| 824 | dev_name(&spi->dev)); | ||
| 825 | if (err) { | 817 | if (err) { |
| 826 | dev_err(&spi->dev, | 818 | dev_err(&spi->dev, |
| 827 | "Failed to get /CS gpio [%d]: %d\n", | 819 | "Failed to get /CS gpio [%d]: %d\n", |
| 828 | cs->line, err); | 820 | spi->cs_gpio, err); |
| 829 | goto err_gpio_req; | 821 | goto err_gpio_req; |
| 830 | } | 822 | } |
| 831 | |||
| 832 | spi->cs_gpio = cs->line; | ||
| 833 | } | 823 | } |
| 834 | 824 | ||
| 835 | spi_set_ctldata(spi, cs); | 825 | spi_set_ctldata(spi, cs); |
| @@ -884,7 +874,8 @@ setup_exit: | |||
| 884 | /* setup() returns with device de-selected */ | 874 | /* setup() returns with device de-selected */ |
| 885 | writel(S3C64XX_SPI_SLAVE_SIG_INACT, sdd->regs + S3C64XX_SPI_SLAVE_SEL); | 875 | writel(S3C64XX_SPI_SLAVE_SIG_INACT, sdd->regs + S3C64XX_SPI_SLAVE_SEL); |
| 886 | 876 | ||
| 887 | gpio_free(cs->line); | 877 | if (gpio_is_valid(spi->cs_gpio)) |
| 878 | gpio_free(spi->cs_gpio); | ||
| 888 | spi_set_ctldata(spi, NULL); | 879 | spi_set_ctldata(spi, NULL); |
| 889 | 880 | ||
| 890 | err_gpio_req: | 881 | err_gpio_req: |
| @@ -897,14 +888,21 @@ err_gpio_req: | |||
| 897 | static void s3c64xx_spi_cleanup(struct spi_device *spi) | 888 | static void s3c64xx_spi_cleanup(struct spi_device *spi) |
| 898 | { | 889 | { |
| 899 | struct s3c64xx_spi_csinfo *cs = spi_get_ctldata(spi); | 890 | struct s3c64xx_spi_csinfo *cs = spi_get_ctldata(spi); |
| 900 | struct s3c64xx_spi_driver_data *sdd; | ||
| 901 | 891 | ||
| 902 | sdd = spi_master_get_devdata(spi->master); | 892 | if (gpio_is_valid(spi->cs_gpio)) { |
| 903 | if (spi->cs_gpio) { | ||
| 904 | gpio_free(spi->cs_gpio); | 893 | gpio_free(spi->cs_gpio); |
| 905 | if (spi->dev.of_node) | 894 | if (spi->dev.of_node) |
| 906 | kfree(cs); | 895 | kfree(cs); |
| 896 | else { | ||
| 897 | /* On non-DT platforms, the SPI core sets | ||
| 898 | * spi->cs_gpio to -ENOENT and .setup() | ||
| 899 | * overrides it with the GPIO pin value | ||
| 900 | * passed using platform data. | ||
| 901 | */ | ||
| 902 | spi->cs_gpio = -ENOENT; | ||
| 903 | } | ||
| 907 | } | 904 | } |
| 905 | |||
| 908 | spi_set_ctldata(spi, NULL); | 906 | spi_set_ctldata(spi, NULL); |
| 909 | } | 907 | } |
| 910 | 908 | ||
| @@ -1075,11 +1073,7 @@ static int s3c64xx_spi_probe(struct platform_device *pdev) | |||
| 1075 | sdd->cntrlr_info = sci; | 1073 | sdd->cntrlr_info = sci; |
| 1076 | sdd->pdev = pdev; | 1074 | sdd->pdev = pdev; |
| 1077 | sdd->sfr_start = mem_res->start; | 1075 | sdd->sfr_start = mem_res->start; |
| 1078 | sdd->cs_gpio = true; | ||
| 1079 | if (pdev->dev.of_node) { | 1076 | if (pdev->dev.of_node) { |
| 1080 | if (!of_find_property(pdev->dev.of_node, "cs-gpio", NULL)) | ||
| 1081 | sdd->cs_gpio = false; | ||
| 1082 | |||
| 1083 | ret = of_alias_get_id(pdev->dev.of_node, "spi"); | 1077 | ret = of_alias_get_id(pdev->dev.of_node, "spi"); |
| 1084 | if (ret < 0) { | 1078 | if (ret < 0) { |
| 1085 | dev_err(&pdev->dev, "failed to get alias id, errno %d\n", | 1079 | dev_err(&pdev->dev, "failed to get alias id, errno %d\n", |
diff --git a/drivers/spi/spi-sh-hspi.c b/drivers/spi/spi-sh-hspi.c index c8e795ef2e13..94b5faed21e2 100644 --- a/drivers/spi/spi-sh-hspi.c +++ b/drivers/spi/spi-sh-hspi.c | |||
| @@ -304,7 +304,7 @@ static int hspi_remove(struct platform_device *pdev) | |||
| 304 | return 0; | 304 | return 0; |
| 305 | } | 305 | } |
| 306 | 306 | ||
| 307 | static struct of_device_id hspi_of_match[] = { | 307 | static const struct of_device_id hspi_of_match[] = { |
| 308 | { .compatible = "renesas,hspi", }, | 308 | { .compatible = "renesas,hspi", }, |
| 309 | { /* sentinel */ } | 309 | { /* sentinel */ } |
| 310 | }; | 310 | }; |
diff --git a/drivers/spi/spi-sh-msiof.c b/drivers/spi/spi-sh-msiof.c index 45b09142afe2..83c43707f093 100644 --- a/drivers/spi/spi-sh-msiof.c +++ b/drivers/spi/spi-sh-msiof.c | |||
| @@ -680,8 +680,6 @@ static int sh_msiof_spi_probe(struct platform_device *pdev) | |||
| 680 | 680 | ||
| 681 | p = spi_master_get_devdata(master); | 681 | p = spi_master_get_devdata(master); |
| 682 | 682 | ||
| 683 | platform_set_drvdata(pdev, p); | ||
| 684 | |||
| 685 | of_id = of_match_device(sh_msiof_match, &pdev->dev); | 683 | of_id = of_match_device(sh_msiof_match, &pdev->dev); |
| 686 | if (of_id) { | 684 | if (of_id) { |
| 687 | p->chipdata = of_id->data; | 685 | p->chipdata = of_id->data; |
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/spi/spi-xilinx.c b/drivers/spi/spi-xilinx.c index a3b0b9944bf0..4d8efb16573d 100644 --- a/drivers/spi/spi-xilinx.c +++ b/drivers/spi/spi-xilinx.c | |||
| @@ -369,7 +369,7 @@ static int xilinx_spi_probe(struct platform_device *pdev) | |||
| 369 | goto put_master; | 369 | goto put_master; |
| 370 | } | 370 | } |
| 371 | 371 | ||
| 372 | master->bus_num = pdev->dev.id; | 372 | master->bus_num = pdev->id; |
| 373 | master->num_chipselect = num_cs; | 373 | master->num_chipselect = num_cs; |
| 374 | master->dev.of_node = pdev->dev.of_node; | 374 | master->dev.of_node = pdev->dev.of_node; |
| 375 | 375 | ||
diff --git a/drivers/spi/spi.c b/drivers/spi/spi.c index d4f9670b51bc..e6f076d5ffd5 100644 --- a/drivers/spi/spi.c +++ b/drivers/spi/spi.c | |||
| @@ -345,14 +345,12 @@ static DEFINE_MUTEX(board_lock); | |||
| 345 | struct spi_device *spi_alloc_device(struct spi_master *master) | 345 | struct spi_device *spi_alloc_device(struct spi_master *master) |
| 346 | { | 346 | { |
| 347 | struct spi_device *spi; | 347 | struct spi_device *spi; |
| 348 | struct device *dev = master->dev.parent; | ||
| 349 | 348 | ||
| 350 | if (!spi_master_get(master)) | 349 | if (!spi_master_get(master)) |
| 351 | return NULL; | 350 | return NULL; |
| 352 | 351 | ||
| 353 | spi = kzalloc(sizeof(*spi), GFP_KERNEL); | 352 | spi = kzalloc(sizeof(*spi), GFP_KERNEL); |
| 354 | if (!spi) { | 353 | if (!spi) { |
| 355 | dev_err(dev, "cannot alloc spi_device\n"); | ||
| 356 | spi_master_put(master); | 354 | spi_master_put(master); |
| 357 | return NULL; | 355 | return NULL; |
| 358 | } | 356 | } |
| @@ -619,6 +617,8 @@ static int spi_map_buf(struct spi_master *master, struct device *dev, | |||
| 619 | } | 617 | } |
| 620 | 618 | ||
| 621 | ret = dma_map_sg(dev, sgt->sgl, sgt->nents, dir); | 619 | ret = dma_map_sg(dev, sgt->sgl, sgt->nents, dir); |
| 620 | if (!ret) | ||
| 621 | ret = -ENOMEM; | ||
| 622 | if (ret < 0) { | 622 | if (ret < 0) { |
| 623 | sg_free_table(sgt); | 623 | sg_free_table(sgt); |
| 624 | return ret; | 624 | return ret; |
| @@ -647,8 +647,8 @@ static int __spi_map_msg(struct spi_master *master, struct spi_message *msg) | |||
| 647 | if (!master->can_dma) | 647 | if (!master->can_dma) |
| 648 | return 0; | 648 | return 0; |
| 649 | 649 | ||
| 650 | tx_dev = &master->dma_tx->dev->device; | 650 | tx_dev = master->dma_tx->device->dev; |
| 651 | rx_dev = &master->dma_rx->dev->device; | 651 | rx_dev = master->dma_rx->device->dev; |
| 652 | 652 | ||
| 653 | list_for_each_entry(xfer, &msg->transfers, transfer_list) { | 653 | list_for_each_entry(xfer, &msg->transfers, transfer_list) { |
| 654 | if (!master->can_dma(master, msg->spi, xfer)) | 654 | if (!master->can_dma(master, msg->spi, xfer)) |
| @@ -687,8 +687,8 @@ static int spi_unmap_msg(struct spi_master *master, struct spi_message *msg) | |||
| 687 | if (!master->cur_msg_mapped || !master->can_dma) | 687 | if (!master->cur_msg_mapped || !master->can_dma) |
| 688 | return 0; | 688 | return 0; |
| 689 | 689 | ||
| 690 | tx_dev = &master->dma_tx->dev->device; | 690 | tx_dev = master->dma_tx->device->dev; |
| 691 | rx_dev = &master->dma_rx->dev->device; | 691 | rx_dev = master->dma_rx->device->dev; |
| 692 | 692 | ||
| 693 | list_for_each_entry(xfer, &msg->transfers, transfer_list) { | 693 | list_for_each_entry(xfer, &msg->transfers, transfer_list) { |
| 694 | if (!master->can_dma(master, msg->spi, xfer)) | 694 | if (!master->can_dma(master, msg->spi, xfer)) |
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/media/omap4iss/Kconfig b/drivers/staging/media/omap4iss/Kconfig index 78b0fba7047e..8afc6fee40c5 100644 --- a/drivers/staging/media/omap4iss/Kconfig +++ b/drivers/staging/media/omap4iss/Kconfig | |||
| @@ -1,6 +1,6 @@ | |||
| 1 | config VIDEO_OMAP4 | 1 | config VIDEO_OMAP4 |
| 2 | bool "OMAP 4 Camera support" | 2 | bool "OMAP 4 Camera support" |
| 3 | depends on VIDEO_V4L2 && VIDEO_V4L2_SUBDEV_API && I2C && ARCH_OMAP4 | 3 | depends on VIDEO_V4L2=y && VIDEO_V4L2_SUBDEV_API && I2C=y && ARCH_OMAP4 |
| 4 | select VIDEOBUF2_DMA_CONTIG | 4 | select VIDEOBUF2_DMA_CONTIG |
| 5 | ---help--- | 5 | ---help--- |
| 6 | Driver for an OMAP 4 ISS controller. | 6 | Driver for an OMAP 4 ISS controller. |
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/rtl8723au/os_dep/usb_intf.c b/drivers/staging/rtl8723au/os_dep/usb_intf.c index 8b25c1aa2025..ebb19b22f47f 100644 --- a/drivers/staging/rtl8723au/os_dep/usb_intf.c +++ b/drivers/staging/rtl8723au/os_dep/usb_intf.c | |||
| @@ -530,8 +530,10 @@ int rtw_resume_process23a(struct rtw_adapter *padapter) | |||
| 530 | pwrpriv->bkeepfwalive = false; | 530 | pwrpriv->bkeepfwalive = false; |
| 531 | 531 | ||
| 532 | DBG_8723A("bkeepfwalive(%x)\n", pwrpriv->bkeepfwalive); | 532 | DBG_8723A("bkeepfwalive(%x)\n", pwrpriv->bkeepfwalive); |
| 533 | if (pm_netdev_open23a(pnetdev, true) != 0) | 533 | if (pm_netdev_open23a(pnetdev, true) != 0) { |
| 534 | up(&pwrpriv->lock); | ||
| 534 | goto exit; | 535 | goto exit; |
| 536 | } | ||
| 535 | 537 | ||
| 536 | netif_device_attach(pnetdev); | 538 | netif_device_attach(pnetdev); |
| 537 | netif_carrier_on(pnetdev); | 539 | netif_carrier_on(pnetdev); |
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/staging/vt6655/bssdb.c b/drivers/staging/vt6655/bssdb.c index 59679cd46816..69b80e80b011 100644 --- a/drivers/staging/vt6655/bssdb.c +++ b/drivers/staging/vt6655/bssdb.c | |||
| @@ -981,7 +981,7 @@ start: | |||
| 981 | pDevice->byERPFlag &= ~(WLAN_SET_ERP_USE_PROTECTION(1)); | 981 | pDevice->byERPFlag &= ~(WLAN_SET_ERP_USE_PROTECTION(1)); |
| 982 | } | 982 | } |
| 983 | 983 | ||
| 984 | { | 984 | if (pDevice->eCommandState == WLAN_ASSOCIATE_WAIT) { |
| 985 | pDevice->byReAssocCount++; | 985 | pDevice->byReAssocCount++; |
| 986 | /* 10 sec timeout */ | 986 | /* 10 sec timeout */ |
| 987 | if ((pDevice->byReAssocCount > 10) && (!pDevice->bLinkPass)) { | 987 | if ((pDevice->byReAssocCount > 10) && (!pDevice->bLinkPass)) { |
diff --git a/drivers/staging/vt6655/device_main.c b/drivers/staging/vt6655/device_main.c index 1d3908d044d0..5a5fd937a442 100644 --- a/drivers/staging/vt6655/device_main.c +++ b/drivers/staging/vt6655/device_main.c | |||
| @@ -2318,6 +2318,7 @@ static irqreturn_t device_intr(int irq, void *dev_instance) { | |||
| 2318 | int handled = 0; | 2318 | int handled = 0; |
| 2319 | unsigned char byData = 0; | 2319 | unsigned char byData = 0; |
| 2320 | int ii = 0; | 2320 | int ii = 0; |
| 2321 | unsigned long flags; | ||
| 2321 | 2322 | ||
| 2322 | MACvReadISR(pDevice->PortOffset, &pDevice->dwIsr); | 2323 | MACvReadISR(pDevice->PortOffset, &pDevice->dwIsr); |
| 2323 | 2324 | ||
| @@ -2331,7 +2332,8 @@ static irqreturn_t device_intr(int irq, void *dev_instance) { | |||
| 2331 | 2332 | ||
| 2332 | handled = 1; | 2333 | handled = 1; |
| 2333 | MACvIntDisable(pDevice->PortOffset); | 2334 | MACvIntDisable(pDevice->PortOffset); |
| 2334 | spin_lock_irq(&pDevice->lock); | 2335 | |
| 2336 | spin_lock_irqsave(&pDevice->lock, flags); | ||
| 2335 | 2337 | ||
| 2336 | //Make sure current page is 0 | 2338 | //Make sure current page is 0 |
| 2337 | VNSvInPortB(pDevice->PortOffset + MAC_REG_PAGE1SEL, &byOrgPageSel); | 2339 | VNSvInPortB(pDevice->PortOffset + MAC_REG_PAGE1SEL, &byOrgPageSel); |
| @@ -2560,7 +2562,8 @@ static irqreturn_t device_intr(int irq, void *dev_instance) { | |||
| 2560 | if (byOrgPageSel == 1) | 2562 | if (byOrgPageSel == 1) |
| 2561 | MACvSelectPage1(pDevice->PortOffset); | 2563 | MACvSelectPage1(pDevice->PortOffset); |
| 2562 | 2564 | ||
| 2563 | spin_unlock_irq(&pDevice->lock); | 2565 | spin_unlock_irqrestore(&pDevice->lock, flags); |
| 2566 | |||
| 2564 | MACvIntEnable(pDevice->PortOffset, IMR_MASK_VALUE); | 2567 | MACvIntEnable(pDevice->PortOffset, IMR_MASK_VALUE); |
| 2565 | 2568 | ||
| 2566 | return IRQ_RETVAL(handled); | 2569 | return IRQ_RETVAL(handled); |
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..b8125aa64ad8 100644 --- a/drivers/usb/chipidea/udc.c +++ b/drivers/usb/chipidea/udc.c | |||
| @@ -1169,8 +1169,8 @@ static int ep_enable(struct usb_ep *ep, | |||
| 1169 | 1169 | ||
| 1170 | if (hwep->type == USB_ENDPOINT_XFER_CONTROL) | 1170 | if (hwep->type == USB_ENDPOINT_XFER_CONTROL) |
| 1171 | cap |= QH_IOS; | 1171 | cap |= QH_IOS; |
| 1172 | if (hwep->num) | 1172 | |
| 1173 | cap |= QH_ZLT; | 1173 | cap |= QH_ZLT; |
| 1174 | cap |= (hwep->ep.maxpacket << __ffs(QH_MAX_PKT)) & QH_MAX_PKT; | 1174 | cap |= (hwep->ep.maxpacket << __ffs(QH_MAX_PKT)) & QH_MAX_PKT; |
| 1175 | /* | 1175 | /* |
| 1176 | * For ISO-TX, we set mult at QH as the largest value, and use | 1176 | * For ISO-TX, we set mult at QH as the largest value, and use |
| @@ -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..0e950ad8cb25 100644 --- a/drivers/usb/core/hub.c +++ b/drivers/usb/core/hub.c | |||
| @@ -889,6 +889,25 @@ static int hub_usb3_port_disable(struct usb_hub *hub, int port1) | |||
| 889 | if (!hub_is_superspeed(hub->hdev)) | 889 | if (!hub_is_superspeed(hub->hdev)) |
| 890 | return -EINVAL; | 890 | return -EINVAL; |
| 891 | 891 | ||
| 892 | ret = hub_port_status(hub, port1, &portstatus, &portchange); | ||
| 893 | if (ret < 0) | ||
| 894 | return ret; | ||
| 895 | |||
| 896 | /* | ||
| 897 | * USB controller Advanced Micro Devices, Inc. [AMD] FCH USB XHCI | ||
| 898 | * Controller [1022:7814] will have spurious result making the following | ||
| 899 | * usb 3.0 device hotplugging route to the 2.0 root hub and recognized | ||
| 900 | * as high-speed device if we set the usb 3.0 port link state to | ||
| 901 | * Disabled. Since it's already in USB_SS_PORT_LS_RX_DETECT state, we | ||
| 902 | * check the state here to avoid the bug. | ||
| 903 | */ | ||
| 904 | if ((portstatus & USB_PORT_STAT_LINK_STATE) == | ||
| 905 | USB_SS_PORT_LS_RX_DETECT) { | ||
| 906 | dev_dbg(&hub->ports[port1 - 1]->dev, | ||
| 907 | "Not disabling port; link state is RxDetect\n"); | ||
| 908 | return ret; | ||
| 909 | } | ||
| 910 | |||
| 892 | ret = hub_set_port_link_state(hub, port1, USB_SS_PORT_LS_SS_DISABLED); | 911 | ret = hub_set_port_link_state(hub, port1, USB_SS_PORT_LS_SS_DISABLED); |
| 893 | if (ret) | 912 | if (ret) |
| 894 | return ret; | 913 | return ret; |
| @@ -1526,18 +1545,6 @@ static int hub_configure(struct usb_hub *hub, | |||
| 1526 | dev_dbg(hub_dev, "%umA bus power budget for each child\n", | 1545 | dev_dbg(hub_dev, "%umA bus power budget for each child\n", |
| 1527 | hub->mA_per_port); | 1546 | hub->mA_per_port); |
| 1528 | 1547 | ||
| 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); | 1548 | ret = hub_hub_status(hub, &hubstatus, &hubchange); |
| 1542 | if (ret < 0) { | 1549 | if (ret < 0) { |
| 1543 | message = "can't get hub status"; | 1550 | message = "can't get hub status"; |
| @@ -1589,10 +1596,28 @@ static int hub_configure(struct usb_hub *hub, | |||
| 1589 | } | 1596 | } |
| 1590 | } | 1597 | } |
| 1591 | hdev->maxchild = i; | 1598 | hdev->maxchild = i; |
| 1599 | for (i = 0; i < hdev->maxchild; i++) { | ||
| 1600 | struct usb_port *port_dev = hub->ports[i]; | ||
| 1601 | |||
| 1602 | pm_runtime_put(&port_dev->dev); | ||
| 1603 | } | ||
| 1604 | |||
| 1592 | mutex_unlock(&usb_port_peer_mutex); | 1605 | mutex_unlock(&usb_port_peer_mutex); |
| 1593 | if (ret < 0) | 1606 | if (ret < 0) |
| 1594 | goto fail; | 1607 | goto fail; |
| 1595 | 1608 | ||
| 1609 | /* Update the HCD's internal representation of this hub before khubd | ||
| 1610 | * starts getting port status changes for devices under the hub. | ||
| 1611 | */ | ||
| 1612 | if (hcd->driver->update_hub_device) { | ||
| 1613 | ret = hcd->driver->update_hub_device(hcd, hdev, | ||
| 1614 | &hub->tt, GFP_KERNEL); | ||
| 1615 | if (ret < 0) { | ||
| 1616 | message = "can't update HCD hub info"; | ||
| 1617 | goto fail; | ||
| 1618 | } | ||
| 1619 | } | ||
| 1620 | |||
| 1596 | usb_hub_adjust_deviceremovable(hdev, hub->descriptor); | 1621 | usb_hub_adjust_deviceremovable(hdev, hub->descriptor); |
| 1597 | 1622 | ||
| 1598 | hub_activate(hub, HUB_INIT); | 1623 | hub_activate(hub, HUB_INIT); |
| @@ -3458,7 +3483,8 @@ static int hub_suspend(struct usb_interface *intf, pm_message_t msg) | |||
| 3458 | struct usb_device *udev = port_dev->child; | 3483 | struct usb_device *udev = port_dev->child; |
| 3459 | 3484 | ||
| 3460 | if (udev && udev->can_submit) { | 3485 | if (udev && udev->can_submit) { |
| 3461 | dev_warn(&port_dev->dev, "not suspended yet\n"); | 3486 | dev_warn(&port_dev->dev, "device %s not suspended yet\n", |
| 3487 | dev_name(&udev->dev)); | ||
| 3462 | if (PMSG_IS_AUTO(msg)) | 3488 | if (PMSG_IS_AUTO(msg)) |
| 3463 | return -EBUSY; | 3489 | return -EBUSY; |
| 3464 | } | 3490 | } |
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/offb.c b/drivers/video/fbdev/offb.c index 7d44d669d5b6..43a0a52fc527 100644 --- a/drivers/video/fbdev/offb.c +++ b/drivers/video/fbdev/offb.c | |||
| @@ -91,15 +91,6 @@ extern boot_infos_t *boot_infos; | |||
| 91 | #define AVIVO_DC_LUTB_WHITE_OFFSET_GREEN 0x6cd4 | 91 | #define AVIVO_DC_LUTB_WHITE_OFFSET_GREEN 0x6cd4 |
| 92 | #define AVIVO_DC_LUTB_WHITE_OFFSET_RED 0x6cd8 | 92 | #define AVIVO_DC_LUTB_WHITE_OFFSET_RED 0x6cd8 |
| 93 | 93 | ||
| 94 | #define FB_RIGHT_POS(p, bpp) (fb_be_math(p) ? 0 : (32 - (bpp))) | ||
| 95 | |||
| 96 | static inline u32 offb_cmap_byteswap(struct fb_info *info, u32 value) | ||
| 97 | { | ||
| 98 | u32 bpp = info->var.bits_per_pixel; | ||
| 99 | |||
| 100 | return cpu_to_be32(value) >> FB_RIGHT_POS(info, bpp); | ||
| 101 | } | ||
| 102 | |||
| 103 | /* | 94 | /* |
| 104 | * Set a single color register. The values supplied are already | 95 | * Set a single color register. The values supplied are already |
| 105 | * rounded down to the hardware's capabilities (according to the | 96 | * rounded down to the hardware's capabilities (according to the |
| @@ -129,7 +120,7 @@ static int offb_setcolreg(u_int regno, u_int red, u_int green, u_int blue, | |||
| 129 | mask <<= info->var.transp.offset; | 120 | mask <<= info->var.transp.offset; |
| 130 | value |= mask; | 121 | value |= mask; |
| 131 | } | 122 | } |
| 132 | pal[regno] = offb_cmap_byteswap(info, value); | 123 | pal[regno] = value; |
| 133 | return 0; | 124 | return 0; |
| 134 | } | 125 | } |
| 135 | 126 | ||
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/balloon.c b/drivers/xen/balloon.c index b7a506f2bb14..5c660c77f03b 100644 --- a/drivers/xen/balloon.c +++ b/drivers/xen/balloon.c | |||
| @@ -426,20 +426,18 @@ static enum bp_state decrease_reservation(unsigned long nr_pages, gfp_t gfp) | |||
| 426 | * p2m are consistent. | 426 | * p2m are consistent. |
| 427 | */ | 427 | */ |
| 428 | if (!xen_feature(XENFEAT_auto_translated_physmap)) { | 428 | if (!xen_feature(XENFEAT_auto_translated_physmap)) { |
| 429 | unsigned long p; | ||
| 430 | struct page *scratch_page = get_balloon_scratch_page(); | ||
| 431 | |||
| 432 | if (!PageHighMem(page)) { | 429 | if (!PageHighMem(page)) { |
| 430 | struct page *scratch_page = get_balloon_scratch_page(); | ||
| 431 | |||
| 433 | ret = HYPERVISOR_update_va_mapping( | 432 | ret = HYPERVISOR_update_va_mapping( |
| 434 | (unsigned long)__va(pfn << PAGE_SHIFT), | 433 | (unsigned long)__va(pfn << PAGE_SHIFT), |
| 435 | pfn_pte(page_to_pfn(scratch_page), | 434 | pfn_pte(page_to_pfn(scratch_page), |
| 436 | PAGE_KERNEL_RO), 0); | 435 | PAGE_KERNEL_RO), 0); |
| 437 | BUG_ON(ret); | 436 | BUG_ON(ret); |
| 438 | } | ||
| 439 | p = page_to_pfn(scratch_page); | ||
| 440 | __set_phys_to_machine(pfn, pfn_to_mfn(p)); | ||
| 441 | 437 | ||
| 442 | put_balloon_scratch_page(); | 438 | put_balloon_scratch_page(); |
| 439 | } | ||
| 440 | __set_phys_to_machine(pfn, INVALID_P2M_ENTRY); | ||
| 443 | } | 441 | } |
| 444 | #endif | 442 | #endif |
| 445 | 443 | ||
diff --git a/drivers/xen/grant-table.c b/drivers/xen/grant-table.c index 6d325bda76da..eeba7544f0cd 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 | ||
| @@ -1194,18 +1195,20 @@ static int gnttab_expand(unsigned int req_entries) | |||
| 1194 | int gnttab_init(void) | 1195 | int gnttab_init(void) |
| 1195 | { | 1196 | { |
| 1196 | int i; | 1197 | int i; |
| 1198 | unsigned long max_nr_grant_frames; | ||
| 1197 | unsigned int max_nr_glist_frames, nr_glist_frames; | 1199 | unsigned int max_nr_glist_frames, nr_glist_frames; |
| 1198 | unsigned int nr_init_grefs; | 1200 | unsigned int nr_init_grefs; |
| 1199 | int ret; | 1201 | int ret; |
| 1200 | 1202 | ||
| 1201 | gnttab_request_version(); | 1203 | gnttab_request_version(); |
| 1204 | max_nr_grant_frames = gnttab_max_grant_frames(); | ||
| 1202 | nr_grant_frames = 1; | 1205 | nr_grant_frames = 1; |
| 1203 | 1206 | ||
| 1204 | /* Determine the maximum number of frames required for the | 1207 | /* Determine the maximum number of frames required for the |
| 1205 | * grant reference free list on the current hypervisor. | 1208 | * grant reference free list on the current hypervisor. |
| 1206 | */ | 1209 | */ |
| 1207 | BUG_ON(grefs_per_grant_frame == 0); | 1210 | BUG_ON(grefs_per_grant_frame == 0); |
| 1208 | max_nr_glist_frames = (gnttab_max_grant_frames() * | 1211 | max_nr_glist_frames = (max_nr_grant_frames * |
| 1209 | grefs_per_grant_frame / RPP); | 1212 | grefs_per_grant_frame / RPP); |
| 1210 | 1213 | ||
| 1211 | gnttab_list = kmalloc(max_nr_glist_frames * sizeof(grant_ref_t *), | 1214 | gnttab_list = kmalloc(max_nr_glist_frames * sizeof(grant_ref_t *), |
| @@ -1222,6 +1225,11 @@ int gnttab_init(void) | |||
| 1222 | } | 1225 | } |
| 1223 | } | 1226 | } |
| 1224 | 1227 | ||
| 1228 | ret = arch_gnttab_init(max_nr_grant_frames, | ||
| 1229 | nr_status_frames(max_nr_grant_frames)); | ||
| 1230 | if (ret < 0) | ||
| 1231 | goto ini_nomem; | ||
| 1232 | |||
| 1225 | if (gnttab_setup() < 0) { | 1233 | if (gnttab_setup() < 0) { |
| 1226 | ret = -ENODEV; | 1234 | ret = -ENODEV; |
| 1227 | goto ini_nomem; | 1235 | goto ini_nomem; |
diff --git a/drivers/xen/manage.c b/drivers/xen/manage.c index c3667b202f2f..5f1e1f3cd186 100644 --- a/drivers/xen/manage.c +++ b/drivers/xen/manage.c | |||
| @@ -88,7 +88,6 @@ static int xen_suspend(void *data) | |||
| 88 | 88 | ||
| 89 | if (!si->cancelled) { | 89 | if (!si->cancelled) { |
| 90 | xen_irq_resume(); | 90 | xen_irq_resume(); |
| 91 | xen_console_resume(); | ||
| 92 | xen_timer_resume(); | 91 | xen_timer_resume(); |
| 93 | } | 92 | } |
| 94 | 93 | ||
| @@ -135,6 +134,10 @@ static void do_suspend(void) | |||
| 135 | 134 | ||
| 136 | err = stop_machine(xen_suspend, &si, cpumask_of(0)); | 135 | err = stop_machine(xen_suspend, &si, cpumask_of(0)); |
| 137 | 136 | ||
| 137 | /* Resume console as early as possible. */ | ||
| 138 | if (!si.cancelled) | ||
| 139 | xen_console_resume(); | ||
| 140 | |||
| 138 | raw_notifier_call_chain(&xen_resume_notifier, 0, NULL); | 141 | raw_notifier_call_chain(&xen_resume_notifier, 0, NULL); |
| 139 | 142 | ||
| 140 | dpm_resume_start(si.cancelled ? PMSG_THAW : PMSG_RESTORE); | 143 | dpm_resume_start(si.cancelled ? PMSG_THAW : PMSG_RESTORE); |
