diff options
Diffstat (limited to 'drivers')
214 files changed, 1745 insertions, 1871 deletions
diff --git a/drivers/amba/bus.c b/drivers/amba/bus.c index 821040503154..7025593a58c8 100644 --- a/drivers/amba/bus.c +++ b/drivers/amba/bus.c | |||
| @@ -214,7 +214,7 @@ static int amba_pm_resume_noirq(struct device *dev) | |||
| 214 | 214 | ||
| 215 | #endif /* !CONFIG_SUSPEND */ | 215 | #endif /* !CONFIG_SUSPEND */ |
| 216 | 216 | ||
| 217 | #ifdef CONFIG_HIBERNATION | 217 | #ifdef CONFIG_HIBERNATE_CALLBACKS |
| 218 | 218 | ||
| 219 | static int amba_pm_freeze(struct device *dev) | 219 | static int amba_pm_freeze(struct device *dev) |
| 220 | { | 220 | { |
| @@ -352,7 +352,7 @@ static int amba_pm_restore_noirq(struct device *dev) | |||
| 352 | return ret; | 352 | return ret; |
| 353 | } | 353 | } |
| 354 | 354 | ||
| 355 | #else /* !CONFIG_HIBERNATION */ | 355 | #else /* !CONFIG_HIBERNATE_CALLBACKS */ |
| 356 | 356 | ||
| 357 | #define amba_pm_freeze NULL | 357 | #define amba_pm_freeze NULL |
| 358 | #define amba_pm_thaw NULL | 358 | #define amba_pm_thaw NULL |
| @@ -363,7 +363,7 @@ static int amba_pm_restore_noirq(struct device *dev) | |||
| 363 | #define amba_pm_poweroff_noirq NULL | 363 | #define amba_pm_poweroff_noirq NULL |
| 364 | #define amba_pm_restore_noirq NULL | 364 | #define amba_pm_restore_noirq NULL |
| 365 | 365 | ||
| 366 | #endif /* !CONFIG_HIBERNATION */ | 366 | #endif /* !CONFIG_HIBERNATE_CALLBACKS */ |
| 367 | 367 | ||
| 368 | #ifdef CONFIG_PM | 368 | #ifdef CONFIG_PM |
| 369 | 369 | ||
diff --git a/drivers/base/platform.c b/drivers/base/platform.c index f051cfff18af..9e0e4fc24c46 100644 --- a/drivers/base/platform.c +++ b/drivers/base/platform.c | |||
| @@ -149,6 +149,7 @@ static void platform_device_release(struct device *dev) | |||
| 149 | 149 | ||
| 150 | of_device_node_put(&pa->pdev.dev); | 150 | of_device_node_put(&pa->pdev.dev); |
| 151 | kfree(pa->pdev.dev.platform_data); | 151 | kfree(pa->pdev.dev.platform_data); |
| 152 | kfree(pa->pdev.mfd_cell); | ||
| 152 | kfree(pa->pdev.resource); | 153 | kfree(pa->pdev.resource); |
| 153 | kfree(pa); | 154 | kfree(pa); |
| 154 | } | 155 | } |
| @@ -771,7 +772,7 @@ int __weak platform_pm_resume_noirq(struct device *dev) | |||
| 771 | 772 | ||
| 772 | #endif /* !CONFIG_SUSPEND */ | 773 | #endif /* !CONFIG_SUSPEND */ |
| 773 | 774 | ||
| 774 | #ifdef CONFIG_HIBERNATION | 775 | #ifdef CONFIG_HIBERNATE_CALLBACKS |
| 775 | 776 | ||
| 776 | static int platform_pm_freeze(struct device *dev) | 777 | static int platform_pm_freeze(struct device *dev) |
| 777 | { | 778 | { |
| @@ -909,7 +910,7 @@ static int platform_pm_restore_noirq(struct device *dev) | |||
| 909 | return ret; | 910 | return ret; |
| 910 | } | 911 | } |
| 911 | 912 | ||
| 912 | #else /* !CONFIG_HIBERNATION */ | 913 | #else /* !CONFIG_HIBERNATE_CALLBACKS */ |
| 913 | 914 | ||
| 914 | #define platform_pm_freeze NULL | 915 | #define platform_pm_freeze NULL |
| 915 | #define platform_pm_thaw NULL | 916 | #define platform_pm_thaw NULL |
| @@ -920,7 +921,7 @@ static int platform_pm_restore_noirq(struct device *dev) | |||
| 920 | #define platform_pm_poweroff_noirq NULL | 921 | #define platform_pm_poweroff_noirq NULL |
| 921 | #define platform_pm_restore_noirq NULL | 922 | #define platform_pm_restore_noirq NULL |
| 922 | 923 | ||
| 923 | #endif /* !CONFIG_HIBERNATION */ | 924 | #endif /* !CONFIG_HIBERNATE_CALLBACKS */ |
| 924 | 925 | ||
| 925 | #ifdef CONFIG_PM_RUNTIME | 926 | #ifdef CONFIG_PM_RUNTIME |
| 926 | 927 | ||
diff --git a/drivers/base/power/main.c b/drivers/base/power/main.c index 052dc53eef38..fbc5b6e7c591 100644 --- a/drivers/base/power/main.c +++ b/drivers/base/power/main.c | |||
| @@ -233,7 +233,7 @@ static int pm_op(struct device *dev, | |||
| 233 | } | 233 | } |
| 234 | break; | 234 | break; |
| 235 | #endif /* CONFIG_SUSPEND */ | 235 | #endif /* CONFIG_SUSPEND */ |
| 236 | #ifdef CONFIG_HIBERNATION | 236 | #ifdef CONFIG_HIBERNATE_CALLBACKS |
| 237 | case PM_EVENT_FREEZE: | 237 | case PM_EVENT_FREEZE: |
| 238 | case PM_EVENT_QUIESCE: | 238 | case PM_EVENT_QUIESCE: |
| 239 | if (ops->freeze) { | 239 | if (ops->freeze) { |
| @@ -260,7 +260,7 @@ static int pm_op(struct device *dev, | |||
| 260 | suspend_report_result(ops->restore, error); | 260 | suspend_report_result(ops->restore, error); |
| 261 | } | 261 | } |
| 262 | break; | 262 | break; |
| 263 | #endif /* CONFIG_HIBERNATION */ | 263 | #endif /* CONFIG_HIBERNATE_CALLBACKS */ |
| 264 | default: | 264 | default: |
| 265 | error = -EINVAL; | 265 | error = -EINVAL; |
| 266 | } | 266 | } |
| @@ -308,7 +308,7 @@ static int pm_noirq_op(struct device *dev, | |||
| 308 | } | 308 | } |
| 309 | break; | 309 | break; |
| 310 | #endif /* CONFIG_SUSPEND */ | 310 | #endif /* CONFIG_SUSPEND */ |
| 311 | #ifdef CONFIG_HIBERNATION | 311 | #ifdef CONFIG_HIBERNATE_CALLBACKS |
| 312 | case PM_EVENT_FREEZE: | 312 | case PM_EVENT_FREEZE: |
| 313 | case PM_EVENT_QUIESCE: | 313 | case PM_EVENT_QUIESCE: |
| 314 | if (ops->freeze_noirq) { | 314 | if (ops->freeze_noirq) { |
| @@ -335,7 +335,7 @@ static int pm_noirq_op(struct device *dev, | |||
| 335 | suspend_report_result(ops->restore_noirq, error); | 335 | suspend_report_result(ops->restore_noirq, error); |
| 336 | } | 336 | } |
| 337 | break; | 337 | break; |
| 338 | #endif /* CONFIG_HIBERNATION */ | 338 | #endif /* CONFIG_HIBERNATE_CALLBACKS */ |
| 339 | default: | 339 | default: |
| 340 | error = -EINVAL; | 340 | error = -EINVAL; |
| 341 | } | 341 | } |
diff --git a/drivers/char/agp/generic.c b/drivers/char/agp/generic.c index 012cba0d6d96..b072648dc3f6 100644 --- a/drivers/char/agp/generic.c +++ b/drivers/char/agp/generic.c | |||
| @@ -115,6 +115,9 @@ static struct agp_memory *agp_create_user_memory(unsigned long num_agp_pages) | |||
| 115 | struct agp_memory *new; | 115 | struct agp_memory *new; |
| 116 | unsigned long alloc_size = num_agp_pages*sizeof(struct page *); | 116 | unsigned long alloc_size = num_agp_pages*sizeof(struct page *); |
| 117 | 117 | ||
| 118 | if (INT_MAX/sizeof(struct page *) < num_agp_pages) | ||
| 119 | return NULL; | ||
| 120 | |||
| 118 | new = kzalloc(sizeof(struct agp_memory), GFP_KERNEL); | 121 | new = kzalloc(sizeof(struct agp_memory), GFP_KERNEL); |
| 119 | if (new == NULL) | 122 | if (new == NULL) |
| 120 | return NULL; | 123 | return NULL; |
| @@ -234,11 +237,14 @@ struct agp_memory *agp_allocate_memory(struct agp_bridge_data *bridge, | |||
| 234 | int scratch_pages; | 237 | int scratch_pages; |
| 235 | struct agp_memory *new; | 238 | struct agp_memory *new; |
| 236 | size_t i; | 239 | size_t i; |
| 240 | int cur_memory; | ||
| 237 | 241 | ||
| 238 | if (!bridge) | 242 | if (!bridge) |
| 239 | return NULL; | 243 | return NULL; |
| 240 | 244 | ||
| 241 | if ((atomic_read(&bridge->current_memory_agp) + page_count) > bridge->max_memory_agp) | 245 | cur_memory = atomic_read(&bridge->current_memory_agp); |
| 246 | if ((cur_memory + page_count > bridge->max_memory_agp) || | ||
| 247 | (cur_memory + page_count < page_count)) | ||
| 242 | return NULL; | 248 | return NULL; |
| 243 | 249 | ||
| 244 | if (type >= AGP_USER_TYPES) { | 250 | if (type >= AGP_USER_TYPES) { |
| @@ -1089,8 +1095,8 @@ int agp_generic_insert_memory(struct agp_memory * mem, off_t pg_start, int type) | |||
| 1089 | return -EINVAL; | 1095 | return -EINVAL; |
| 1090 | } | 1096 | } |
| 1091 | 1097 | ||
| 1092 | /* AK: could wrap */ | 1098 | if (((pg_start + mem->page_count) > num_entries) || |
| 1093 | if ((pg_start + mem->page_count) > num_entries) | 1099 | ((pg_start + mem->page_count) < pg_start)) |
| 1094 | return -EINVAL; | 1100 | return -EINVAL; |
| 1095 | 1101 | ||
| 1096 | j = pg_start; | 1102 | j = pg_start; |
| @@ -1124,7 +1130,7 @@ int agp_generic_remove_memory(struct agp_memory *mem, off_t pg_start, int type) | |||
| 1124 | { | 1130 | { |
| 1125 | size_t i; | 1131 | size_t i; |
| 1126 | struct agp_bridge_data *bridge; | 1132 | struct agp_bridge_data *bridge; |
| 1127 | int mask_type; | 1133 | int mask_type, num_entries; |
| 1128 | 1134 | ||
| 1129 | bridge = mem->bridge; | 1135 | bridge = mem->bridge; |
| 1130 | if (!bridge) | 1136 | if (!bridge) |
| @@ -1136,6 +1142,11 @@ int agp_generic_remove_memory(struct agp_memory *mem, off_t pg_start, int type) | |||
| 1136 | if (type != mem->type) | 1142 | if (type != mem->type) |
| 1137 | return -EINVAL; | 1143 | return -EINVAL; |
| 1138 | 1144 | ||
| 1145 | num_entries = agp_num_entries(); | ||
| 1146 | if (((pg_start + mem->page_count) > num_entries) || | ||
| 1147 | ((pg_start + mem->page_count) < pg_start)) | ||
| 1148 | return -EINVAL; | ||
| 1149 | |||
| 1139 | mask_type = bridge->driver->agp_type_to_mask_type(bridge, type); | 1150 | mask_type = bridge->driver->agp_type_to_mask_type(bridge, type); |
| 1140 | if (mask_type != 0) { | 1151 | if (mask_type != 0) { |
| 1141 | /* The generic routines know nothing of memory types */ | 1152 | /* The generic routines know nothing of memory types */ |
diff --git a/drivers/char/virtio_console.c b/drivers/char/virtio_console.c index 84b164d1eb2b..838568a7dbf5 100644 --- a/drivers/char/virtio_console.c +++ b/drivers/char/virtio_console.c | |||
| @@ -1280,18 +1280,7 @@ static void unplug_port(struct port *port) | |||
| 1280 | spin_lock_irq(&pdrvdata_lock); | 1280 | spin_lock_irq(&pdrvdata_lock); |
| 1281 | list_del(&port->cons.list); | 1281 | list_del(&port->cons.list); |
| 1282 | spin_unlock_irq(&pdrvdata_lock); | 1282 | spin_unlock_irq(&pdrvdata_lock); |
| 1283 | #if 0 | ||
| 1284 | /* | ||
| 1285 | * hvc_remove() not called as removing one hvc port | ||
| 1286 | * results in other hvc ports getting frozen. | ||
| 1287 | * | ||
| 1288 | * Once this is resolved in hvc, this functionality | ||
| 1289 | * will be enabled. Till that is done, the -EPIPE | ||
| 1290 | * return from get_chars() above will help | ||
| 1291 | * hvc_console.c to clean up on ports we remove here. | ||
| 1292 | */ | ||
| 1293 | hvc_remove(port->cons.hvc); | 1283 | hvc_remove(port->cons.hvc); |
| 1294 | #endif | ||
| 1295 | } | 1284 | } |
| 1296 | 1285 | ||
| 1297 | /* Remove unused data this port might have received. */ | 1286 | /* Remove unused data this port might have received. */ |
diff --git a/drivers/connector/connector.c b/drivers/connector/connector.c index d77005849af8..219d88a0eeae 100644 --- a/drivers/connector/connector.c +++ b/drivers/connector/connector.c | |||
| @@ -142,6 +142,7 @@ static int cn_call_callback(struct sk_buff *skb) | |||
| 142 | cbq->callback(msg, nsp); | 142 | cbq->callback(msg, nsp); |
| 143 | kfree_skb(skb); | 143 | kfree_skb(skb); |
| 144 | cn_queue_release_callback(cbq); | 144 | cn_queue_release_callback(cbq); |
| 145 | err = 0; | ||
| 145 | } | 146 | } |
| 146 | 147 | ||
| 147 | return err; | 148 | return err; |
diff --git a/drivers/dma/fsldma.c b/drivers/dma/fsldma.c index 6b396759e7f5..8a781540590c 100644 --- a/drivers/dma/fsldma.c +++ b/drivers/dma/fsldma.c | |||
| @@ -1448,7 +1448,7 @@ static const struct of_device_id fsldma_of_ids[] = { | |||
| 1448 | {} | 1448 | {} |
| 1449 | }; | 1449 | }; |
| 1450 | 1450 | ||
| 1451 | static struct of_platform_driver fsldma_of_driver = { | 1451 | static struct platform_driver fsldma_of_driver = { |
| 1452 | .driver = { | 1452 | .driver = { |
| 1453 | .name = "fsl-elo-dma", | 1453 | .name = "fsl-elo-dma", |
| 1454 | .owner = THIS_MODULE, | 1454 | .owner = THIS_MODULE, |
diff --git a/drivers/gpio/ml_ioh_gpio.c b/drivers/gpio/ml_ioh_gpio.c index 7f6f01a4b145..0a775f7987c2 100644 --- a/drivers/gpio/ml_ioh_gpio.c +++ b/drivers/gpio/ml_ioh_gpio.c | |||
| @@ -116,6 +116,7 @@ static int ioh_gpio_direction_output(struct gpio_chip *gpio, unsigned nr, | |||
| 116 | reg_val |= (1 << nr); | 116 | reg_val |= (1 << nr); |
| 117 | else | 117 | else |
| 118 | reg_val &= ~(1 << nr); | 118 | reg_val &= ~(1 << nr); |
| 119 | iowrite32(reg_val, &chip->reg->regs[chip->ch].po); | ||
| 119 | 120 | ||
| 120 | mutex_unlock(&chip->lock); | 121 | mutex_unlock(&chip->lock); |
| 121 | 122 | ||
diff --git a/drivers/gpio/pca953x.c b/drivers/gpio/pca953x.c index 583e92592073..7630ab7b9bec 100644 --- a/drivers/gpio/pca953x.c +++ b/drivers/gpio/pca953x.c | |||
| @@ -558,7 +558,7 @@ static int __devinit pca953x_probe(struct i2c_client *client, | |||
| 558 | 558 | ||
| 559 | ret = gpiochip_add(&chip->gpio_chip); | 559 | ret = gpiochip_add(&chip->gpio_chip); |
| 560 | if (ret) | 560 | if (ret) |
| 561 | goto out_failed; | 561 | goto out_failed_irq; |
| 562 | 562 | ||
| 563 | if (pdata->setup) { | 563 | if (pdata->setup) { |
| 564 | ret = pdata->setup(client, chip->gpio_chip.base, | 564 | ret = pdata->setup(client, chip->gpio_chip.base, |
| @@ -570,8 +570,9 @@ static int __devinit pca953x_probe(struct i2c_client *client, | |||
| 570 | i2c_set_clientdata(client, chip); | 570 | i2c_set_clientdata(client, chip); |
| 571 | return 0; | 571 | return 0; |
| 572 | 572 | ||
| 573 | out_failed: | 573 | out_failed_irq: |
| 574 | pca953x_irq_teardown(chip); | 574 | pca953x_irq_teardown(chip); |
| 575 | out_failed: | ||
| 575 | kfree(chip->dyn_pdata); | 576 | kfree(chip->dyn_pdata); |
| 576 | kfree(chip); | 577 | kfree(chip); |
| 577 | return ret; | 578 | return ret; |
diff --git a/drivers/gpio/pch_gpio.c b/drivers/gpio/pch_gpio.c index 2c6af8705103..f970a5f3585e 100644 --- a/drivers/gpio/pch_gpio.c +++ b/drivers/gpio/pch_gpio.c | |||
| @@ -105,6 +105,7 @@ static int pch_gpio_direction_output(struct gpio_chip *gpio, unsigned nr, | |||
| 105 | reg_val |= (1 << nr); | 105 | reg_val |= (1 << nr); |
| 106 | else | 106 | else |
| 107 | reg_val &= ~(1 << nr); | 107 | reg_val &= ~(1 << nr); |
| 108 | iowrite32(reg_val, &chip->reg->po); | ||
| 108 | 109 | ||
| 109 | mutex_unlock(&chip->lock); | 110 | mutex_unlock(&chip->lock); |
| 110 | 111 | ||
diff --git a/drivers/gpu/drm/Kconfig b/drivers/gpu/drm/Kconfig index a6feb78c404c..c58f691ec3ce 100644 --- a/drivers/gpu/drm/Kconfig +++ b/drivers/gpu/drm/Kconfig | |||
| @@ -96,6 +96,7 @@ config DRM_I915 | |||
| 96 | # i915 depends on ACPI_VIDEO when ACPI is enabled | 96 | # i915 depends on ACPI_VIDEO when ACPI is enabled |
| 97 | # but for select to work, need to select ACPI_VIDEO's dependencies, ick | 97 | # but for select to work, need to select ACPI_VIDEO's dependencies, ick |
| 98 | select BACKLIGHT_CLASS_DEVICE if ACPI | 98 | select BACKLIGHT_CLASS_DEVICE if ACPI |
| 99 | select VIDEO_OUTPUT_CONTROL if ACPI | ||
| 99 | select INPUT if ACPI | 100 | select INPUT if ACPI |
| 100 | select ACPI_VIDEO if ACPI | 101 | select ACPI_VIDEO if ACPI |
| 101 | select ACPI_BUTTON if ACPI | 102 | select ACPI_BUTTON if ACPI |
diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c index 432fc04c6bff..e522c702b04e 100644 --- a/drivers/gpu/drm/i915/intel_display.c +++ b/drivers/gpu/drm/i915/intel_display.c | |||
| @@ -3771,8 +3771,11 @@ static bool g4x_compute_wm0(struct drm_device *dev, | |||
| 3771 | int entries, tlb_miss; | 3771 | int entries, tlb_miss; |
| 3772 | 3772 | ||
| 3773 | crtc = intel_get_crtc_for_plane(dev, plane); | 3773 | crtc = intel_get_crtc_for_plane(dev, plane); |
| 3774 | if (crtc->fb == NULL || !crtc->enabled) | 3774 | if (crtc->fb == NULL || !crtc->enabled) { |
| 3775 | *cursor_wm = cursor->guard_size; | ||
| 3776 | *plane_wm = display->guard_size; | ||
| 3775 | return false; | 3777 | return false; |
| 3778 | } | ||
| 3776 | 3779 | ||
| 3777 | htotal = crtc->mode.htotal; | 3780 | htotal = crtc->mode.htotal; |
| 3778 | hdisplay = crtc->mode.hdisplay; | 3781 | hdisplay = crtc->mode.hdisplay; |
| @@ -6215,36 +6218,6 @@ cleanup_work: | |||
| 6215 | return ret; | 6218 | return ret; |
| 6216 | } | 6219 | } |
| 6217 | 6220 | ||
| 6218 | static void intel_crtc_reset(struct drm_crtc *crtc) | ||
| 6219 | { | ||
| 6220 | struct intel_crtc *intel_crtc = to_intel_crtc(crtc); | ||
| 6221 | |||
| 6222 | /* Reset flags back to the 'unknown' status so that they | ||
| 6223 | * will be correctly set on the initial modeset. | ||
| 6224 | */ | ||
| 6225 | intel_crtc->dpms_mode = -1; | ||
| 6226 | } | ||
| 6227 | |||
| 6228 | static struct drm_crtc_helper_funcs intel_helper_funcs = { | ||
| 6229 | .dpms = intel_crtc_dpms, | ||
| 6230 | .mode_fixup = intel_crtc_mode_fixup, | ||
| 6231 | .mode_set = intel_crtc_mode_set, | ||
| 6232 | .mode_set_base = intel_pipe_set_base, | ||
| 6233 | .mode_set_base_atomic = intel_pipe_set_base_atomic, | ||
| 6234 | .load_lut = intel_crtc_load_lut, | ||
| 6235 | .disable = intel_crtc_disable, | ||
| 6236 | }; | ||
| 6237 | |||
| 6238 | static const struct drm_crtc_funcs intel_crtc_funcs = { | ||
| 6239 | .reset = intel_crtc_reset, | ||
| 6240 | .cursor_set = intel_crtc_cursor_set, | ||
| 6241 | .cursor_move = intel_crtc_cursor_move, | ||
| 6242 | .gamma_set = intel_crtc_gamma_set, | ||
| 6243 | .set_config = drm_crtc_helper_set_config, | ||
| 6244 | .destroy = intel_crtc_destroy, | ||
| 6245 | .page_flip = intel_crtc_page_flip, | ||
| 6246 | }; | ||
| 6247 | |||
| 6248 | static void intel_sanitize_modesetting(struct drm_device *dev, | 6221 | static void intel_sanitize_modesetting(struct drm_device *dev, |
| 6249 | int pipe, int plane) | 6222 | int pipe, int plane) |
| 6250 | { | 6223 | { |
| @@ -6281,6 +6254,42 @@ static void intel_sanitize_modesetting(struct drm_device *dev, | |||
| 6281 | intel_disable_pipe(dev_priv, pipe); | 6254 | intel_disable_pipe(dev_priv, pipe); |
| 6282 | } | 6255 | } |
| 6283 | 6256 | ||
| 6257 | static void intel_crtc_reset(struct drm_crtc *crtc) | ||
| 6258 | { | ||
| 6259 | struct drm_device *dev = crtc->dev; | ||
| 6260 | struct intel_crtc *intel_crtc = to_intel_crtc(crtc); | ||
| 6261 | |||
| 6262 | /* Reset flags back to the 'unknown' status so that they | ||
| 6263 | * will be correctly set on the initial modeset. | ||
| 6264 | */ | ||
| 6265 | intel_crtc->dpms_mode = -1; | ||
| 6266 | |||
| 6267 | /* We need to fix up any BIOS configuration that conflicts with | ||
| 6268 | * our expectations. | ||
| 6269 | */ | ||
| 6270 | intel_sanitize_modesetting(dev, intel_crtc->pipe, intel_crtc->plane); | ||
| 6271 | } | ||
| 6272 | |||
| 6273 | static struct drm_crtc_helper_funcs intel_helper_funcs = { | ||
| 6274 | .dpms = intel_crtc_dpms, | ||
| 6275 | .mode_fixup = intel_crtc_mode_fixup, | ||
| 6276 | .mode_set = intel_crtc_mode_set, | ||
| 6277 | .mode_set_base = intel_pipe_set_base, | ||
| 6278 | .mode_set_base_atomic = intel_pipe_set_base_atomic, | ||
| 6279 | .load_lut = intel_crtc_load_lut, | ||
| 6280 | .disable = intel_crtc_disable, | ||
| 6281 | }; | ||
| 6282 | |||
| 6283 | static const struct drm_crtc_funcs intel_crtc_funcs = { | ||
| 6284 | .reset = intel_crtc_reset, | ||
| 6285 | .cursor_set = intel_crtc_cursor_set, | ||
| 6286 | .cursor_move = intel_crtc_cursor_move, | ||
| 6287 | .gamma_set = intel_crtc_gamma_set, | ||
| 6288 | .set_config = drm_crtc_helper_set_config, | ||
| 6289 | .destroy = intel_crtc_destroy, | ||
| 6290 | .page_flip = intel_crtc_page_flip, | ||
| 6291 | }; | ||
| 6292 | |||
| 6284 | static void intel_crtc_init(struct drm_device *dev, int pipe) | 6293 | static void intel_crtc_init(struct drm_device *dev, int pipe) |
| 6285 | { | 6294 | { |
| 6286 | drm_i915_private_t *dev_priv = dev->dev_private; | 6295 | drm_i915_private_t *dev_priv = dev->dev_private; |
| @@ -6330,8 +6339,6 @@ static void intel_crtc_init(struct drm_device *dev, int pipe) | |||
| 6330 | 6339 | ||
| 6331 | setup_timer(&intel_crtc->idle_timer, intel_crtc_idle_timer, | 6340 | setup_timer(&intel_crtc->idle_timer, intel_crtc_idle_timer, |
| 6332 | (unsigned long)intel_crtc); | 6341 | (unsigned long)intel_crtc); |
| 6333 | |||
| 6334 | intel_sanitize_modesetting(dev, intel_crtc->pipe, intel_crtc->plane); | ||
| 6335 | } | 6342 | } |
| 6336 | 6343 | ||
| 6337 | int intel_get_pipe_from_crtc_id(struct drm_device *dev, void *data, | 6344 | int intel_get_pipe_from_crtc_id(struct drm_device *dev, void *data, |
diff --git a/drivers/gpu/drm/i915/intel_tv.c b/drivers/gpu/drm/i915/intel_tv.c index 4256b8ef3947..6b22c1dcc015 100644 --- a/drivers/gpu/drm/i915/intel_tv.c +++ b/drivers/gpu/drm/i915/intel_tv.c | |||
| @@ -1151,10 +1151,10 @@ intel_tv_mode_set(struct drm_encoder *encoder, struct drm_display_mode *mode, | |||
| 1151 | (video_levels->blank << TV_BLANK_LEVEL_SHIFT))); | 1151 | (video_levels->blank << TV_BLANK_LEVEL_SHIFT))); |
| 1152 | { | 1152 | { |
| 1153 | int pipeconf_reg = PIPECONF(pipe); | 1153 | int pipeconf_reg = PIPECONF(pipe); |
| 1154 | int dspcntr_reg = DSPCNTR(pipe); | 1154 | int dspcntr_reg = DSPCNTR(intel_crtc->plane); |
| 1155 | int pipeconf = I915_READ(pipeconf_reg); | 1155 | int pipeconf = I915_READ(pipeconf_reg); |
| 1156 | int dspcntr = I915_READ(dspcntr_reg); | 1156 | int dspcntr = I915_READ(dspcntr_reg); |
| 1157 | int dspbase_reg = DSPADDR(pipe); | 1157 | int dspbase_reg = DSPADDR(intel_crtc->plane); |
| 1158 | int xpos = 0x0, ypos = 0x0; | 1158 | int xpos = 0x0, ypos = 0x0; |
| 1159 | unsigned int xsize, ysize; | 1159 | unsigned int xsize, ysize; |
| 1160 | /* Pipe must be off here */ | 1160 | /* Pipe must be off here */ |
| @@ -1378,7 +1378,9 @@ intel_tv_detect(struct drm_connector *connector, bool force) | |||
| 1378 | if (type < 0) | 1378 | if (type < 0) |
| 1379 | return connector_status_disconnected; | 1379 | return connector_status_disconnected; |
| 1380 | 1380 | ||
| 1381 | intel_tv->type = type; | ||
| 1381 | intel_tv_find_better_format(connector); | 1382 | intel_tv_find_better_format(connector); |
| 1383 | |||
| 1382 | return connector_status_connected; | 1384 | return connector_status_connected; |
| 1383 | } | 1385 | } |
| 1384 | 1386 | ||
| @@ -1670,8 +1672,7 @@ intel_tv_init(struct drm_device *dev) | |||
| 1670 | * | 1672 | * |
| 1671 | * More recent chipsets favour HDMI rather than integrated S-Video. | 1673 | * More recent chipsets favour HDMI rather than integrated S-Video. |
| 1672 | */ | 1674 | */ |
| 1673 | connector->polled = | 1675 | connector->polled = DRM_CONNECTOR_POLL_CONNECT; |
| 1674 | DRM_CONNECTOR_POLL_CONNECT | DRM_CONNECTOR_POLL_DISCONNECT; | ||
| 1675 | 1676 | ||
| 1676 | drm_connector_init(dev, connector, &intel_tv_connector_funcs, | 1677 | drm_connector_init(dev, connector, &intel_tv_connector_funcs, |
| 1677 | DRM_MODE_CONNECTOR_SVIDEO); | 1678 | DRM_MODE_CONNECTOR_SVIDEO); |
diff --git a/drivers/gpu/drm/nouveau/nouveau_bios.c b/drivers/gpu/drm/nouveau/nouveau_bios.c index 8314a49b6b9a..90aef64b76f2 100644 --- a/drivers/gpu/drm/nouveau/nouveau_bios.c +++ b/drivers/gpu/drm/nouveau/nouveau_bios.c | |||
| @@ -269,7 +269,7 @@ struct init_tbl_entry { | |||
| 269 | int (*handler)(struct nvbios *, uint16_t, struct init_exec *); | 269 | int (*handler)(struct nvbios *, uint16_t, struct init_exec *); |
| 270 | }; | 270 | }; |
| 271 | 271 | ||
| 272 | static int parse_init_table(struct nvbios *, unsigned int, struct init_exec *); | 272 | static int parse_init_table(struct nvbios *, uint16_t, struct init_exec *); |
| 273 | 273 | ||
| 274 | #define MACRO_INDEX_SIZE 2 | 274 | #define MACRO_INDEX_SIZE 2 |
| 275 | #define MACRO_SIZE 8 | 275 | #define MACRO_SIZE 8 |
| @@ -2011,6 +2011,27 @@ init_sub_direct(struct nvbios *bios, uint16_t offset, struct init_exec *iexec) | |||
| 2011 | } | 2011 | } |
| 2012 | 2012 | ||
| 2013 | static int | 2013 | static int |
| 2014 | init_jump(struct nvbios *bios, uint16_t offset, struct init_exec *iexec) | ||
| 2015 | { | ||
| 2016 | /* | ||
| 2017 | * INIT_JUMP opcode: 0x5C ('\') | ||
| 2018 | * | ||
| 2019 | * offset (8 bit): opcode | ||
| 2020 | * offset + 1 (16 bit): offset (in bios) | ||
| 2021 | * | ||
| 2022 | * Continue execution of init table from 'offset' | ||
| 2023 | */ | ||
| 2024 | |||
| 2025 | uint16_t jmp_offset = ROM16(bios->data[offset + 1]); | ||
| 2026 | |||
| 2027 | if (!iexec->execute) | ||
| 2028 | return 3; | ||
| 2029 | |||
| 2030 | BIOSLOG(bios, "0x%04X: Jump to 0x%04X\n", offset, jmp_offset); | ||
| 2031 | return jmp_offset - offset; | ||
| 2032 | } | ||
| 2033 | |||
| 2034 | static int | ||
| 2014 | init_i2c_if(struct nvbios *bios, uint16_t offset, struct init_exec *iexec) | 2035 | init_i2c_if(struct nvbios *bios, uint16_t offset, struct init_exec *iexec) |
| 2015 | { | 2036 | { |
| 2016 | /* | 2037 | /* |
| @@ -3659,6 +3680,7 @@ static struct init_tbl_entry itbl_entry[] = { | |||
| 3659 | { "INIT_ZM_REG_SEQUENCE" , 0x58, init_zm_reg_sequence }, | 3680 | { "INIT_ZM_REG_SEQUENCE" , 0x58, init_zm_reg_sequence }, |
| 3660 | /* INIT_INDIRECT_REG (0x5A, 7, 0, 0) removed due to no example of use */ | 3681 | /* INIT_INDIRECT_REG (0x5A, 7, 0, 0) removed due to no example of use */ |
| 3661 | { "INIT_SUB_DIRECT" , 0x5B, init_sub_direct }, | 3682 | { "INIT_SUB_DIRECT" , 0x5B, init_sub_direct }, |
| 3683 | { "INIT_JUMP" , 0x5C, init_jump }, | ||
| 3662 | { "INIT_I2C_IF" , 0x5E, init_i2c_if }, | 3684 | { "INIT_I2C_IF" , 0x5E, init_i2c_if }, |
| 3663 | { "INIT_COPY_NV_REG" , 0x5F, init_copy_nv_reg }, | 3685 | { "INIT_COPY_NV_REG" , 0x5F, init_copy_nv_reg }, |
| 3664 | { "INIT_ZM_INDEX_IO" , 0x62, init_zm_index_io }, | 3686 | { "INIT_ZM_INDEX_IO" , 0x62, init_zm_index_io }, |
| @@ -3700,8 +3722,7 @@ static struct init_tbl_entry itbl_entry[] = { | |||
| 3700 | #define MAX_TABLE_OPS 1000 | 3722 | #define MAX_TABLE_OPS 1000 |
| 3701 | 3723 | ||
| 3702 | static int | 3724 | static int |
| 3703 | parse_init_table(struct nvbios *bios, unsigned int offset, | 3725 | parse_init_table(struct nvbios *bios, uint16_t offset, struct init_exec *iexec) |
| 3704 | struct init_exec *iexec) | ||
| 3705 | { | 3726 | { |
| 3706 | /* | 3727 | /* |
| 3707 | * Parses all commands in an init table. | 3728 | * Parses all commands in an init table. |
| @@ -6333,6 +6354,32 @@ apply_dcb_encoder_quirks(struct drm_device *dev, int idx, u32 *conn, u32 *conf) | |||
| 6333 | } | 6354 | } |
| 6334 | } | 6355 | } |
| 6335 | 6356 | ||
| 6357 | /* XFX GT-240X-YA | ||
| 6358 | * | ||
| 6359 | * So many things wrong here, replace the entire encoder table.. | ||
| 6360 | */ | ||
| 6361 | if (nv_match_device(dev, 0x0ca3, 0x1682, 0x3003)) { | ||
| 6362 | if (idx == 0) { | ||
| 6363 | *conn = 0x02001300; /* VGA, connector 1 */ | ||
| 6364 | *conf = 0x00000028; | ||
| 6365 | } else | ||
| 6366 | if (idx == 1) { | ||
| 6367 | *conn = 0x01010312; /* DVI, connector 0 */ | ||
| 6368 | *conf = 0x00020030; | ||
| 6369 | } else | ||
| 6370 | if (idx == 2) { | ||
| 6371 | *conn = 0x01010310; /* VGA, connector 0 */ | ||
| 6372 | *conf = 0x00000028; | ||
| 6373 | } else | ||
| 6374 | if (idx == 3) { | ||
| 6375 | *conn = 0x02022362; /* HDMI, connector 2 */ | ||
| 6376 | *conf = 0x00020010; | ||
| 6377 | } else { | ||
| 6378 | *conn = 0x0000000e; /* EOL */ | ||
| 6379 | *conf = 0x00000000; | ||
| 6380 | } | ||
| 6381 | } | ||
| 6382 | |||
| 6336 | return true; | 6383 | return true; |
| 6337 | } | 6384 | } |
| 6338 | 6385 | ||
diff --git a/drivers/gpu/drm/nouveau/nouveau_dma.c b/drivers/gpu/drm/nouveau/nouveau_dma.c index ce38e97b9428..568caedd7216 100644 --- a/drivers/gpu/drm/nouveau/nouveau_dma.c +++ b/drivers/gpu/drm/nouveau/nouveau_dma.c | |||
| @@ -83,7 +83,7 @@ nouveau_dma_init(struct nouveau_channel *chan) | |||
| 83 | return ret; | 83 | return ret; |
| 84 | 84 | ||
| 85 | /* NV_MEMORY_TO_MEMORY_FORMAT requires a notifier object */ | 85 | /* NV_MEMORY_TO_MEMORY_FORMAT requires a notifier object */ |
| 86 | ret = nouveau_notifier_alloc(chan, NvNotify0, 32, 0xfd0, 0x1000, | 86 | ret = nouveau_notifier_alloc(chan, NvNotify0, 32, 0xfe0, 0x1000, |
| 87 | &chan->m2mf_ntfy); | 87 | &chan->m2mf_ntfy); |
| 88 | if (ret) | 88 | if (ret) |
| 89 | return ret; | 89 | return ret; |
diff --git a/drivers/gpu/drm/nouveau/nouveau_drv.h b/drivers/gpu/drm/nouveau/nouveau_drv.h index 57e5302503db..a76514a209b3 100644 --- a/drivers/gpu/drm/nouveau/nouveau_drv.h +++ b/drivers/gpu/drm/nouveau/nouveau_drv.h | |||
| @@ -682,6 +682,9 @@ struct drm_nouveau_private { | |||
| 682 | /* For PFIFO and PGRAPH. */ | 682 | /* For PFIFO and PGRAPH. */ |
| 683 | spinlock_t context_switch_lock; | 683 | spinlock_t context_switch_lock; |
| 684 | 684 | ||
| 685 | /* VM/PRAMIN flush, legacy PRAMIN aperture */ | ||
| 686 | spinlock_t vm_lock; | ||
| 687 | |||
| 685 | /* RAMIN configuration, RAMFC, RAMHT and RAMRO offsets */ | 688 | /* RAMIN configuration, RAMFC, RAMHT and RAMRO offsets */ |
| 686 | struct nouveau_ramht *ramht; | 689 | struct nouveau_ramht *ramht; |
| 687 | struct nouveau_gpuobj *ramfc; | 690 | struct nouveau_gpuobj *ramfc; |
| @@ -1190,7 +1193,7 @@ extern int nv50_graph_load_context(struct nouveau_channel *); | |||
| 1190 | extern int nv50_graph_unload_context(struct drm_device *); | 1193 | extern int nv50_graph_unload_context(struct drm_device *); |
| 1191 | extern int nv50_grctx_init(struct nouveau_grctx *); | 1194 | extern int nv50_grctx_init(struct nouveau_grctx *); |
| 1192 | extern void nv50_graph_tlb_flush(struct drm_device *dev); | 1195 | extern void nv50_graph_tlb_flush(struct drm_device *dev); |
| 1193 | extern void nv86_graph_tlb_flush(struct drm_device *dev); | 1196 | extern void nv84_graph_tlb_flush(struct drm_device *dev); |
| 1194 | extern struct nouveau_enum nv50_data_error_names[]; | 1197 | extern struct nouveau_enum nv50_data_error_names[]; |
| 1195 | 1198 | ||
| 1196 | /* nvc0_graph.c */ | 1199 | /* nvc0_graph.c */ |
diff --git a/drivers/gpu/drm/nouveau/nouveau_fbcon.c b/drivers/gpu/drm/nouveau/nouveau_fbcon.c index 889c4454682e..39aee6d4daf8 100644 --- a/drivers/gpu/drm/nouveau/nouveau_fbcon.c +++ b/drivers/gpu/drm/nouveau/nouveau_fbcon.c | |||
| @@ -181,13 +181,13 @@ nouveau_fbcon_sync(struct fb_info *info) | |||
| 181 | OUT_RING (chan, 0); | 181 | OUT_RING (chan, 0); |
| 182 | } | 182 | } |
| 183 | 183 | ||
| 184 | nouveau_bo_wr32(chan->notifier_bo, chan->m2mf_ntfy + 3, 0xffffffff); | 184 | nouveau_bo_wr32(chan->notifier_bo, chan->m2mf_ntfy/4 + 3, 0xffffffff); |
| 185 | FIRE_RING(chan); | 185 | FIRE_RING(chan); |
| 186 | mutex_unlock(&chan->mutex); | 186 | mutex_unlock(&chan->mutex); |
| 187 | 187 | ||
| 188 | ret = -EBUSY; | 188 | ret = -EBUSY; |
| 189 | for (i = 0; i < 100000; i++) { | 189 | for (i = 0; i < 100000; i++) { |
| 190 | if (!nouveau_bo_rd32(chan->notifier_bo, chan->m2mf_ntfy + 3)) { | 190 | if (!nouveau_bo_rd32(chan->notifier_bo, chan->m2mf_ntfy/4 + 3)) { |
| 191 | ret = 0; | 191 | ret = 0; |
| 192 | break; | 192 | break; |
| 193 | } | 193 | } |
diff --git a/drivers/gpu/drm/nouveau/nouveau_mem.c b/drivers/gpu/drm/nouveau/nouveau_mem.c index 2683377f4131..5045f8b921d6 100644 --- a/drivers/gpu/drm/nouveau/nouveau_mem.c +++ b/drivers/gpu/drm/nouveau/nouveau_mem.c | |||
| @@ -398,7 +398,7 @@ nouveau_mem_vram_init(struct drm_device *dev) | |||
| 398 | dma_bits = 40; | 398 | dma_bits = 40; |
| 399 | } else | 399 | } else |
| 400 | if (drm_pci_device_is_pcie(dev) && | 400 | if (drm_pci_device_is_pcie(dev) && |
| 401 | dev_priv->chipset != 0x40 && | 401 | dev_priv->chipset > 0x40 && |
| 402 | dev_priv->chipset != 0x45) { | 402 | dev_priv->chipset != 0x45) { |
| 403 | if (pci_dma_supported(dev->pdev, DMA_BIT_MASK(39))) | 403 | if (pci_dma_supported(dev->pdev, DMA_BIT_MASK(39))) |
| 404 | dma_bits = 39; | 404 | dma_bits = 39; |
| @@ -552,6 +552,7 @@ nouveau_mem_timing_init(struct drm_device *dev) | |||
| 552 | u8 tRC; /* Byte 9 */ | 552 | u8 tRC; /* Byte 9 */ |
| 553 | u8 tUNK_10, tUNK_11, tUNK_12, tUNK_13, tUNK_14; | 553 | u8 tUNK_10, tUNK_11, tUNK_12, tUNK_13, tUNK_14; |
| 554 | u8 tUNK_18, tUNK_19, tUNK_20, tUNK_21; | 554 | u8 tUNK_18, tUNK_19, tUNK_20, tUNK_21; |
| 555 | u8 magic_number = 0; /* Yeah... sorry*/ | ||
| 555 | u8 *mem = NULL, *entry; | 556 | u8 *mem = NULL, *entry; |
| 556 | int i, recordlen, entries; | 557 | int i, recordlen, entries; |
| 557 | 558 | ||
| @@ -596,6 +597,12 @@ nouveau_mem_timing_init(struct drm_device *dev) | |||
| 596 | if (!memtimings->timing) | 597 | if (!memtimings->timing) |
| 597 | return; | 598 | return; |
| 598 | 599 | ||
| 600 | /* Get "some number" from the timing reg for NV_40 | ||
| 601 | * Used in calculations later */ | ||
| 602 | if(dev_priv->card_type == NV_40) { | ||
| 603 | magic_number = (nv_rd32(dev,0x100228) & 0x0f000000) >> 24; | ||
| 604 | } | ||
| 605 | |||
| 599 | entry = mem + mem[1]; | 606 | entry = mem + mem[1]; |
| 600 | for (i = 0; i < entries; i++, entry += recordlen) { | 607 | for (i = 0; i < entries; i++, entry += recordlen) { |
| 601 | struct nouveau_pm_memtiming *timing = &pm->memtimings.timing[i]; | 608 | struct nouveau_pm_memtiming *timing = &pm->memtimings.timing[i]; |
| @@ -635,36 +642,51 @@ nouveau_mem_timing_init(struct drm_device *dev) | |||
| 635 | 642 | ||
| 636 | /* XXX: I don't trust the -1's and +1's... they must come | 643 | /* XXX: I don't trust the -1's and +1's... they must come |
| 637 | * from somewhere! */ | 644 | * from somewhere! */ |
| 638 | timing->reg_100224 = ((tUNK_0 + tUNK_19 + 1) << 24 | | 645 | timing->reg_100224 = (tUNK_0 + tUNK_19 + 1 + magic_number) << 24 | |
| 639 | tUNK_18 << 16 | | 646 | tUNK_18 << 16 | |
| 640 | (tUNK_1 + tUNK_19 + 1) << 8 | | 647 | (tUNK_1 + tUNK_19 + 1 + magic_number) << 8; |
| 641 | (tUNK_2 - 1)); | 648 | if(dev_priv->chipset == 0xa8) { |
| 649 | timing->reg_100224 |= (tUNK_2 - 1); | ||
| 650 | } else { | ||
| 651 | timing->reg_100224 |= (tUNK_2 + 2 - magic_number); | ||
| 652 | } | ||
| 642 | 653 | ||
| 643 | timing->reg_100228 = (tUNK_12 << 16 | tUNK_11 << 8 | tUNK_10); | 654 | timing->reg_100228 = (tUNK_12 << 16 | tUNK_11 << 8 | tUNK_10); |
| 644 | if(recordlen > 19) { | 655 | if(dev_priv->chipset >= 0xa3 && dev_priv->chipset < 0xaa) { |
| 645 | timing->reg_100228 += (tUNK_19 - 1) << 24; | 656 | timing->reg_100228 |= (tUNK_19 - 1) << 24; |
| 646 | }/* I cannot back-up this else-statement right now | 657 | } |
| 647 | else { | 658 | |
| 648 | timing->reg_100228 += tUNK_12 << 24; | 659 | if(dev_priv->card_type == NV_40) { |
| 649 | }*/ | 660 | /* NV40: don't know what the rest of the regs are.. |
| 650 | 661 | * And don't need to know either */ | |
| 651 | /* XXX: reg_10022c */ | 662 | timing->reg_100228 |= 0x20200000 | magic_number << 24; |
| 652 | timing->reg_10022c = tUNK_2 - 1; | 663 | } else if(dev_priv->card_type >= NV_50) { |
| 653 | 664 | /* XXX: reg_10022c */ | |
| 654 | timing->reg_100230 = (tUNK_20 << 24 | tUNK_21 << 16 | | 665 | timing->reg_10022c = tUNK_2 - 1; |
| 655 | tUNK_13 << 8 | tUNK_13); | 666 | |
| 656 | 667 | timing->reg_100230 = (tUNK_20 << 24 | tUNK_21 << 16 | | |
| 657 | /* XXX: +6? */ | 668 | tUNK_13 << 8 | tUNK_13); |
| 658 | timing->reg_100234 = (tRAS << 24 | (tUNK_19 + 6) << 8 | tRC); | 669 | |
| 659 | timing->reg_100234 += max(tUNK_10,tUNK_11) << 16; | 670 | timing->reg_100234 = (tRAS << 24 | tRC); |
| 660 | 671 | timing->reg_100234 += max(tUNK_10,tUNK_11) << 16; | |
| 661 | /* XXX; reg_100238, reg_10023c | 672 | |
| 662 | * reg: 0x00?????? | 673 | if(dev_priv->chipset < 0xa3) { |
| 663 | * reg_10023c: | 674 | timing->reg_100234 |= (tUNK_2 + 2) << 8; |
| 664 | * 0 for pre-NV50 cards | 675 | } else { |
| 665 | * 0x????0202 for NV50+ cards (empirical evidence) */ | 676 | /* XXX: +6? */ |
| 666 | if(dev_priv->card_type >= NV_50) { | 677 | timing->reg_100234 |= (tUNK_19 + 6) << 8; |
| 678 | } | ||
| 679 | |||
| 680 | /* XXX; reg_100238, reg_10023c | ||
| 681 | * reg_100238: 0x00?????? | ||
| 682 | * reg_10023c: 0x!!??0202 for NV50+ cards (empirical evidence) */ | ||
| 667 | timing->reg_10023c = 0x202; | 683 | timing->reg_10023c = 0x202; |
| 684 | if(dev_priv->chipset < 0xa3) { | ||
| 685 | timing->reg_10023c |= 0x4000000 | (tUNK_2 - 1) << 16; | ||
| 686 | } else { | ||
| 687 | /* currently unknown | ||
| 688 | * 10023c seen as 06xxxxxx, 0bxxxxxx or 0fxxxxxx */ | ||
| 689 | } | ||
| 668 | } | 690 | } |
| 669 | 691 | ||
| 670 | NV_DEBUG(dev, "Entry %d: 220: %08x %08x %08x %08x\n", i, | 692 | NV_DEBUG(dev, "Entry %d: 220: %08x %08x %08x %08x\n", i, |
| @@ -675,7 +697,7 @@ nouveau_mem_timing_init(struct drm_device *dev) | |||
| 675 | timing->reg_100238, timing->reg_10023c); | 697 | timing->reg_100238, timing->reg_10023c); |
| 676 | } | 698 | } |
| 677 | 699 | ||
| 678 | memtimings->nr_timing = entries; | 700 | memtimings->nr_timing = entries; |
| 679 | memtimings->supported = true; | 701 | memtimings->supported = true; |
| 680 | } | 702 | } |
| 681 | 703 | ||
diff --git a/drivers/gpu/drm/nouveau/nouveau_notifier.c b/drivers/gpu/drm/nouveau/nouveau_notifier.c index 7ba3fc0b30c1..5b39718ae1f8 100644 --- a/drivers/gpu/drm/nouveau/nouveau_notifier.c +++ b/drivers/gpu/drm/nouveau/nouveau_notifier.c | |||
| @@ -35,19 +35,22 @@ nouveau_notifier_init_channel(struct nouveau_channel *chan) | |||
| 35 | { | 35 | { |
| 36 | struct drm_device *dev = chan->dev; | 36 | struct drm_device *dev = chan->dev; |
| 37 | struct nouveau_bo *ntfy = NULL; | 37 | struct nouveau_bo *ntfy = NULL; |
| 38 | uint32_t flags; | 38 | uint32_t flags, ttmpl; |
| 39 | int ret; | 39 | int ret; |
| 40 | 40 | ||
| 41 | if (nouveau_vram_notify) | 41 | if (nouveau_vram_notify) { |
| 42 | flags = NOUVEAU_GEM_DOMAIN_VRAM; | 42 | flags = NOUVEAU_GEM_DOMAIN_VRAM; |
| 43 | else | 43 | ttmpl = TTM_PL_FLAG_VRAM; |
| 44 | } else { | ||
| 44 | flags = NOUVEAU_GEM_DOMAIN_GART; | 45 | flags = NOUVEAU_GEM_DOMAIN_GART; |
| 46 | ttmpl = TTM_PL_FLAG_TT; | ||
| 47 | } | ||
| 45 | 48 | ||
| 46 | ret = nouveau_gem_new(dev, NULL, PAGE_SIZE, 0, flags, 0, 0, &ntfy); | 49 | ret = nouveau_gem_new(dev, NULL, PAGE_SIZE, 0, flags, 0, 0, &ntfy); |
| 47 | if (ret) | 50 | if (ret) |
| 48 | return ret; | 51 | return ret; |
| 49 | 52 | ||
| 50 | ret = nouveau_bo_pin(ntfy, flags); | 53 | ret = nouveau_bo_pin(ntfy, ttmpl); |
| 51 | if (ret) | 54 | if (ret) |
| 52 | goto out_err; | 55 | goto out_err; |
| 53 | 56 | ||
diff --git a/drivers/gpu/drm/nouveau/nouveau_object.c b/drivers/gpu/drm/nouveau/nouveau_object.c index 4f00c87ed86e..67a16e01ffa6 100644 --- a/drivers/gpu/drm/nouveau/nouveau_object.c +++ b/drivers/gpu/drm/nouveau/nouveau_object.c | |||
| @@ -1039,19 +1039,20 @@ nv_ro32(struct nouveau_gpuobj *gpuobj, u32 offset) | |||
| 1039 | { | 1039 | { |
| 1040 | struct drm_nouveau_private *dev_priv = gpuobj->dev->dev_private; | 1040 | struct drm_nouveau_private *dev_priv = gpuobj->dev->dev_private; |
| 1041 | struct drm_device *dev = gpuobj->dev; | 1041 | struct drm_device *dev = gpuobj->dev; |
| 1042 | unsigned long flags; | ||
| 1042 | 1043 | ||
| 1043 | if (gpuobj->pinst == ~0 || !dev_priv->ramin_available) { | 1044 | if (gpuobj->pinst == ~0 || !dev_priv->ramin_available) { |
| 1044 | u64 ptr = gpuobj->vinst + offset; | 1045 | u64 ptr = gpuobj->vinst + offset; |
| 1045 | u32 base = ptr >> 16; | 1046 | u32 base = ptr >> 16; |
| 1046 | u32 val; | 1047 | u32 val; |
| 1047 | 1048 | ||
| 1048 | spin_lock(&dev_priv->ramin_lock); | 1049 | spin_lock_irqsave(&dev_priv->vm_lock, flags); |
| 1049 | if (dev_priv->ramin_base != base) { | 1050 | if (dev_priv->ramin_base != base) { |
| 1050 | dev_priv->ramin_base = base; | 1051 | dev_priv->ramin_base = base; |
| 1051 | nv_wr32(dev, 0x001700, dev_priv->ramin_base); | 1052 | nv_wr32(dev, 0x001700, dev_priv->ramin_base); |
| 1052 | } | 1053 | } |
| 1053 | val = nv_rd32(dev, 0x700000 + (ptr & 0xffff)); | 1054 | val = nv_rd32(dev, 0x700000 + (ptr & 0xffff)); |
| 1054 | spin_unlock(&dev_priv->ramin_lock); | 1055 | spin_unlock_irqrestore(&dev_priv->vm_lock, flags); |
| 1055 | return val; | 1056 | return val; |
| 1056 | } | 1057 | } |
| 1057 | 1058 | ||
| @@ -1063,18 +1064,19 @@ nv_wo32(struct nouveau_gpuobj *gpuobj, u32 offset, u32 val) | |||
| 1063 | { | 1064 | { |
| 1064 | struct drm_nouveau_private *dev_priv = gpuobj->dev->dev_private; | 1065 | struct drm_nouveau_private *dev_priv = gpuobj->dev->dev_private; |
| 1065 | struct drm_device *dev = gpuobj->dev; | 1066 | struct drm_device *dev = gpuobj->dev; |
| 1067 | unsigned long flags; | ||
| 1066 | 1068 | ||
| 1067 | if (gpuobj->pinst == ~0 || !dev_priv->ramin_available) { | 1069 | if (gpuobj->pinst == ~0 || !dev_priv->ramin_available) { |
| 1068 | u64 ptr = gpuobj->vinst + offset; | 1070 | u64 ptr = gpuobj->vinst + offset; |
| 1069 | u32 base = ptr >> 16; | 1071 | u32 base = ptr >> 16; |
| 1070 | 1072 | ||
| 1071 | spin_lock(&dev_priv->ramin_lock); | 1073 | spin_lock_irqsave(&dev_priv->vm_lock, flags); |
| 1072 | if (dev_priv->ramin_base != base) { | 1074 | if (dev_priv->ramin_base != base) { |
| 1073 | dev_priv->ramin_base = base; | 1075 | dev_priv->ramin_base = base; |
| 1074 | nv_wr32(dev, 0x001700, dev_priv->ramin_base); | 1076 | nv_wr32(dev, 0x001700, dev_priv->ramin_base); |
| 1075 | } | 1077 | } |
| 1076 | nv_wr32(dev, 0x700000 + (ptr & 0xffff), val); | 1078 | nv_wr32(dev, 0x700000 + (ptr & 0xffff), val); |
| 1077 | spin_unlock(&dev_priv->ramin_lock); | 1079 | spin_unlock_irqrestore(&dev_priv->vm_lock, flags); |
| 1078 | return; | 1080 | return; |
| 1079 | } | 1081 | } |
| 1080 | 1082 | ||
diff --git a/drivers/gpu/drm/nouveau/nouveau_perf.c b/drivers/gpu/drm/nouveau/nouveau_perf.c index ac62a1b8c4fc..670e3cb697ec 100644 --- a/drivers/gpu/drm/nouveau/nouveau_perf.c +++ b/drivers/gpu/drm/nouveau/nouveau_perf.c | |||
| @@ -134,7 +134,7 @@ nouveau_perf_init(struct drm_device *dev) | |||
| 134 | case 0x13: | 134 | case 0x13: |
| 135 | case 0x15: | 135 | case 0x15: |
| 136 | perflvl->fanspeed = entry[55]; | 136 | perflvl->fanspeed = entry[55]; |
| 137 | perflvl->voltage = entry[56]; | 137 | perflvl->voltage = (recordlen > 56) ? entry[56] : 0; |
| 138 | perflvl->core = ROM32(entry[1]) * 10; | 138 | perflvl->core = ROM32(entry[1]) * 10; |
| 139 | perflvl->memory = ROM32(entry[5]) * 20; | 139 | perflvl->memory = ROM32(entry[5]) * 20; |
| 140 | break; | 140 | break; |
diff --git a/drivers/gpu/drm/nouveau/nouveau_sgdma.c b/drivers/gpu/drm/nouveau/nouveau_sgdma.c index a33fe4019286..4bce801bc588 100644 --- a/drivers/gpu/drm/nouveau/nouveau_sgdma.c +++ b/drivers/gpu/drm/nouveau/nouveau_sgdma.c | |||
| @@ -55,6 +55,7 @@ nouveau_sgdma_populate(struct ttm_backend *be, unsigned long num_pages, | |||
| 55 | be->func->clear(be); | 55 | be->func->clear(be); |
| 56 | return -EFAULT; | 56 | return -EFAULT; |
| 57 | } | 57 | } |
| 58 | nvbe->ttm_alloced[nvbe->nr_pages] = false; | ||
| 58 | } | 59 | } |
| 59 | 60 | ||
| 60 | nvbe->nr_pages++; | 61 | nvbe->nr_pages++; |
| @@ -427,7 +428,7 @@ nouveau_sgdma_init(struct drm_device *dev) | |||
| 427 | u32 aper_size, align; | 428 | u32 aper_size, align; |
| 428 | int ret; | 429 | int ret; |
| 429 | 430 | ||
| 430 | if (dev_priv->card_type >= NV_50 || drm_pci_device_is_pcie(dev)) | 431 | if (dev_priv->card_type >= NV_40 && drm_pci_device_is_pcie(dev)) |
| 431 | aper_size = 512 * 1024 * 1024; | 432 | aper_size = 512 * 1024 * 1024; |
| 432 | else | 433 | else |
| 433 | aper_size = 64 * 1024 * 1024; | 434 | aper_size = 64 * 1024 * 1024; |
| @@ -457,7 +458,7 @@ nouveau_sgdma_init(struct drm_device *dev) | |||
| 457 | dev_priv->gart_info.func = &nv50_sgdma_backend; | 458 | dev_priv->gart_info.func = &nv50_sgdma_backend; |
| 458 | } else | 459 | } else |
| 459 | if (drm_pci_device_is_pcie(dev) && | 460 | if (drm_pci_device_is_pcie(dev) && |
| 460 | dev_priv->chipset != 0x40 && dev_priv->chipset != 0x45) { | 461 | dev_priv->chipset > 0x40 && dev_priv->chipset != 0x45) { |
| 461 | if (nv44_graph_class(dev)) { | 462 | if (nv44_graph_class(dev)) { |
| 462 | dev_priv->gart_info.func = &nv44_sgdma_backend; | 463 | dev_priv->gart_info.func = &nv44_sgdma_backend; |
| 463 | align = 512 * 1024; | 464 | align = 512 * 1024; |
diff --git a/drivers/gpu/drm/nouveau/nouveau_state.c b/drivers/gpu/drm/nouveau/nouveau_state.c index 5bb2859001e2..a30adec5beaa 100644 --- a/drivers/gpu/drm/nouveau/nouveau_state.c +++ b/drivers/gpu/drm/nouveau/nouveau_state.c | |||
| @@ -376,15 +376,11 @@ static int nouveau_init_engine_ptrs(struct drm_device *dev) | |||
| 376 | engine->graph.destroy_context = nv50_graph_destroy_context; | 376 | engine->graph.destroy_context = nv50_graph_destroy_context; |
| 377 | engine->graph.load_context = nv50_graph_load_context; | 377 | engine->graph.load_context = nv50_graph_load_context; |
| 378 | engine->graph.unload_context = nv50_graph_unload_context; | 378 | engine->graph.unload_context = nv50_graph_unload_context; |
| 379 | if (dev_priv->chipset != 0x86) | 379 | if (dev_priv->chipset == 0x50 || |
| 380 | dev_priv->chipset == 0xac) | ||
| 380 | engine->graph.tlb_flush = nv50_graph_tlb_flush; | 381 | engine->graph.tlb_flush = nv50_graph_tlb_flush; |
| 381 | else { | 382 | else |
| 382 | /* from what i can see nvidia do this on every | 383 | engine->graph.tlb_flush = nv84_graph_tlb_flush; |
| 383 | * pre-NVA3 board except NVAC, but, we've only | ||
| 384 | * ever seen problems on NV86 | ||
| 385 | */ | ||
| 386 | engine->graph.tlb_flush = nv86_graph_tlb_flush; | ||
| 387 | } | ||
| 388 | engine->fifo.channels = 128; | 384 | engine->fifo.channels = 128; |
| 389 | engine->fifo.init = nv50_fifo_init; | 385 | engine->fifo.init = nv50_fifo_init; |
| 390 | engine->fifo.takedown = nv50_fifo_takedown; | 386 | engine->fifo.takedown = nv50_fifo_takedown; |
| @@ -612,6 +608,7 @@ nouveau_card_init(struct drm_device *dev) | |||
| 612 | spin_lock_init(&dev_priv->channels.lock); | 608 | spin_lock_init(&dev_priv->channels.lock); |
| 613 | spin_lock_init(&dev_priv->tile.lock); | 609 | spin_lock_init(&dev_priv->tile.lock); |
| 614 | spin_lock_init(&dev_priv->context_switch_lock); | 610 | spin_lock_init(&dev_priv->context_switch_lock); |
| 611 | spin_lock_init(&dev_priv->vm_lock); | ||
| 615 | 612 | ||
| 616 | /* Make the CRTCs and I2C buses accessible */ | 613 | /* Make the CRTCs and I2C buses accessible */ |
| 617 | ret = engine->display.early_init(dev); | 614 | ret = engine->display.early_init(dev); |
diff --git a/drivers/gpu/drm/nouveau/nv04_dfp.c b/drivers/gpu/drm/nouveau/nv04_dfp.c index c82db37d9f41..12098bf839c4 100644 --- a/drivers/gpu/drm/nouveau/nv04_dfp.c +++ b/drivers/gpu/drm/nouveau/nv04_dfp.c | |||
| @@ -581,12 +581,13 @@ static void nv04_dfp_restore(struct drm_encoder *encoder) | |||
| 581 | int head = nv_encoder->restore.head; | 581 | int head = nv_encoder->restore.head; |
| 582 | 582 | ||
| 583 | if (nv_encoder->dcb->type == OUTPUT_LVDS) { | 583 | if (nv_encoder->dcb->type == OUTPUT_LVDS) { |
| 584 | struct drm_display_mode *native_mode = nouveau_encoder_connector_get(nv_encoder)->native_mode; | 584 | struct nouveau_connector *connector = |
| 585 | if (native_mode) | 585 | nouveau_encoder_connector_get(nv_encoder); |
| 586 | call_lvds_script(dev, nv_encoder->dcb, head, LVDS_PANEL_ON, | 586 | |
| 587 | native_mode->clock); | 587 | if (connector && connector->native_mode) |
| 588 | else | 588 | call_lvds_script(dev, nv_encoder->dcb, head, |
| 589 | NV_ERROR(dev, "Not restoring LVDS without native mode\n"); | 589 | LVDS_PANEL_ON, |
| 590 | connector->native_mode->clock); | ||
| 590 | 591 | ||
| 591 | } else if (nv_encoder->dcb->type == OUTPUT_TMDS) { | 592 | } else if (nv_encoder->dcb->type == OUTPUT_TMDS) { |
| 592 | int clock = nouveau_hw_pllvals_to_clk | 593 | int clock = nouveau_hw_pllvals_to_clk |
diff --git a/drivers/gpu/drm/nouveau/nv50_crtc.c b/drivers/gpu/drm/nouveau/nv50_crtc.c index 2b9984027f41..a19ccaa025b3 100644 --- a/drivers/gpu/drm/nouveau/nv50_crtc.c +++ b/drivers/gpu/drm/nouveau/nv50_crtc.c | |||
| @@ -469,9 +469,6 @@ nv50_crtc_wait_complete(struct drm_crtc *crtc) | |||
| 469 | 469 | ||
| 470 | start = ptimer->read(dev); | 470 | start = ptimer->read(dev); |
| 471 | do { | 471 | do { |
| 472 | nv_wr32(dev, 0x61002c, 0x370); | ||
| 473 | nv_wr32(dev, 0x000140, 1); | ||
| 474 | |||
| 475 | if (nv_ro32(disp->ntfy, 0x000)) | 472 | if (nv_ro32(disp->ntfy, 0x000)) |
| 476 | return 0; | 473 | return 0; |
| 477 | } while (ptimer->read(dev) - start < 2000000000ULL); | 474 | } while (ptimer->read(dev) - start < 2000000000ULL); |
diff --git a/drivers/gpu/drm/nouveau/nv50_evo.c b/drivers/gpu/drm/nouveau/nv50_evo.c index a2cfaa691e9b..c8e83c1a4de8 100644 --- a/drivers/gpu/drm/nouveau/nv50_evo.c +++ b/drivers/gpu/drm/nouveau/nv50_evo.c | |||
| @@ -186,6 +186,7 @@ nv50_evo_channel_init(struct nouveau_channel *evo) | |||
| 186 | nv_mask(dev, 0x610028, 0x00000000, 0x00010001 << id); | 186 | nv_mask(dev, 0x610028, 0x00000000, 0x00010001 << id); |
| 187 | 187 | ||
| 188 | evo->dma.max = (4096/4) - 2; | 188 | evo->dma.max = (4096/4) - 2; |
| 189 | evo->dma.max &= ~7; | ||
| 189 | evo->dma.put = 0; | 190 | evo->dma.put = 0; |
| 190 | evo->dma.cur = evo->dma.put; | 191 | evo->dma.cur = evo->dma.put; |
| 191 | evo->dma.free = evo->dma.max - evo->dma.cur; | 192 | evo->dma.free = evo->dma.max - evo->dma.cur; |
diff --git a/drivers/gpu/drm/nouveau/nv50_graph.c b/drivers/gpu/drm/nouveau/nv50_graph.c index 8675b00caf18..b02a5b1e7d37 100644 --- a/drivers/gpu/drm/nouveau/nv50_graph.c +++ b/drivers/gpu/drm/nouveau/nv50_graph.c | |||
| @@ -503,7 +503,7 @@ nv50_graph_tlb_flush(struct drm_device *dev) | |||
| 503 | } | 503 | } |
| 504 | 504 | ||
| 505 | void | 505 | void |
| 506 | nv86_graph_tlb_flush(struct drm_device *dev) | 506 | nv84_graph_tlb_flush(struct drm_device *dev) |
| 507 | { | 507 | { |
| 508 | struct drm_nouveau_private *dev_priv = dev->dev_private; | 508 | struct drm_nouveau_private *dev_priv = dev->dev_private; |
| 509 | struct nouveau_timer_engine *ptimer = &dev_priv->engine.timer; | 509 | struct nouveau_timer_engine *ptimer = &dev_priv->engine.timer; |
diff --git a/drivers/gpu/drm/nouveau/nv50_instmem.c b/drivers/gpu/drm/nouveau/nv50_instmem.c index a6f8aa651fc6..4f95a1e5822e 100644 --- a/drivers/gpu/drm/nouveau/nv50_instmem.c +++ b/drivers/gpu/drm/nouveau/nv50_instmem.c | |||
| @@ -404,23 +404,25 @@ void | |||
| 404 | nv50_instmem_flush(struct drm_device *dev) | 404 | nv50_instmem_flush(struct drm_device *dev) |
| 405 | { | 405 | { |
| 406 | struct drm_nouveau_private *dev_priv = dev->dev_private; | 406 | struct drm_nouveau_private *dev_priv = dev->dev_private; |
| 407 | unsigned long flags; | ||
| 407 | 408 | ||
| 408 | spin_lock(&dev_priv->ramin_lock); | 409 | spin_lock_irqsave(&dev_priv->vm_lock, flags); |
| 409 | nv_wr32(dev, 0x00330c, 0x00000001); | 410 | nv_wr32(dev, 0x00330c, 0x00000001); |
| 410 | if (!nv_wait(dev, 0x00330c, 0x00000002, 0x00000000)) | 411 | if (!nv_wait(dev, 0x00330c, 0x00000002, 0x00000000)) |
| 411 | NV_ERROR(dev, "PRAMIN flush timeout\n"); | 412 | NV_ERROR(dev, "PRAMIN flush timeout\n"); |
| 412 | spin_unlock(&dev_priv->ramin_lock); | 413 | spin_unlock_irqrestore(&dev_priv->vm_lock, flags); |
| 413 | } | 414 | } |
| 414 | 415 | ||
| 415 | void | 416 | void |
| 416 | nv84_instmem_flush(struct drm_device *dev) | 417 | nv84_instmem_flush(struct drm_device *dev) |
| 417 | { | 418 | { |
| 418 | struct drm_nouveau_private *dev_priv = dev->dev_private; | 419 | struct drm_nouveau_private *dev_priv = dev->dev_private; |
| 420 | unsigned long flags; | ||
| 419 | 421 | ||
| 420 | spin_lock(&dev_priv->ramin_lock); | 422 | spin_lock_irqsave(&dev_priv->vm_lock, flags); |
| 421 | nv_wr32(dev, 0x070000, 0x00000001); | 423 | nv_wr32(dev, 0x070000, 0x00000001); |
| 422 | if (!nv_wait(dev, 0x070000, 0x00000002, 0x00000000)) | 424 | if (!nv_wait(dev, 0x070000, 0x00000002, 0x00000000)) |
| 423 | NV_ERROR(dev, "PRAMIN flush timeout\n"); | 425 | NV_ERROR(dev, "PRAMIN flush timeout\n"); |
| 424 | spin_unlock(&dev_priv->ramin_lock); | 426 | spin_unlock_irqrestore(&dev_priv->vm_lock, flags); |
| 425 | } | 427 | } |
| 426 | 428 | ||
diff --git a/drivers/gpu/drm/nouveau/nv50_vm.c b/drivers/gpu/drm/nouveau/nv50_vm.c index 4fd3432b5b8d..6c2694490741 100644 --- a/drivers/gpu/drm/nouveau/nv50_vm.c +++ b/drivers/gpu/drm/nouveau/nv50_vm.c | |||
| @@ -174,10 +174,11 @@ void | |||
| 174 | nv50_vm_flush_engine(struct drm_device *dev, int engine) | 174 | nv50_vm_flush_engine(struct drm_device *dev, int engine) |
| 175 | { | 175 | { |
| 176 | struct drm_nouveau_private *dev_priv = dev->dev_private; | 176 | struct drm_nouveau_private *dev_priv = dev->dev_private; |
| 177 | unsigned long flags; | ||
| 177 | 178 | ||
| 178 | spin_lock(&dev_priv->ramin_lock); | 179 | spin_lock_irqsave(&dev_priv->vm_lock, flags); |
| 179 | nv_wr32(dev, 0x100c80, (engine << 16) | 1); | 180 | nv_wr32(dev, 0x100c80, (engine << 16) | 1); |
| 180 | if (!nv_wait(dev, 0x100c80, 0x00000001, 0x00000000)) | 181 | if (!nv_wait(dev, 0x100c80, 0x00000001, 0x00000000)) |
| 181 | NV_ERROR(dev, "vm flush timeout: engine %d\n", engine); | 182 | NV_ERROR(dev, "vm flush timeout: engine %d\n", engine); |
| 182 | spin_unlock(&dev_priv->ramin_lock); | 183 | spin_unlock_irqrestore(&dev_priv->vm_lock, flags); |
| 183 | } | 184 | } |
diff --git a/drivers/gpu/drm/nouveau/nvc0_vm.c b/drivers/gpu/drm/nouveau/nvc0_vm.c index 69af0ba7edd3..a179e6c55afb 100644 --- a/drivers/gpu/drm/nouveau/nvc0_vm.c +++ b/drivers/gpu/drm/nouveau/nvc0_vm.c | |||
| @@ -104,20 +104,27 @@ nvc0_vm_flush(struct nouveau_vm *vm) | |||
| 104 | struct nouveau_instmem_engine *pinstmem = &dev_priv->engine.instmem; | 104 | struct nouveau_instmem_engine *pinstmem = &dev_priv->engine.instmem; |
| 105 | struct drm_device *dev = vm->dev; | 105 | struct drm_device *dev = vm->dev; |
| 106 | struct nouveau_vm_pgd *vpgd; | 106 | struct nouveau_vm_pgd *vpgd; |
| 107 | u32 r100c80, engine; | 107 | unsigned long flags; |
| 108 | u32 engine = (dev_priv->chan_vm == vm) ? 1 : 5; | ||
| 108 | 109 | ||
| 109 | pinstmem->flush(vm->dev); | 110 | pinstmem->flush(vm->dev); |
| 110 | 111 | ||
| 111 | if (vm == dev_priv->chan_vm) | 112 | spin_lock_irqsave(&dev_priv->vm_lock, flags); |
| 112 | engine = 1; | ||
| 113 | else | ||
| 114 | engine = 5; | ||
| 115 | |||
| 116 | list_for_each_entry(vpgd, &vm->pgd_list, head) { | 113 | list_for_each_entry(vpgd, &vm->pgd_list, head) { |
| 117 | r100c80 = nv_rd32(dev, 0x100c80); | 114 | /* looks like maybe a "free flush slots" counter, the |
| 115 | * faster you write to 0x100cbc to more it decreases | ||
| 116 | */ | ||
| 117 | if (!nv_wait_ne(dev, 0x100c80, 0x00ff0000, 0x00000000)) { | ||
| 118 | NV_ERROR(dev, "vm timeout 0: 0x%08x %d\n", | ||
| 119 | nv_rd32(dev, 0x100c80), engine); | ||
| 120 | } | ||
| 118 | nv_wr32(dev, 0x100cb8, vpgd->obj->vinst >> 8); | 121 | nv_wr32(dev, 0x100cb8, vpgd->obj->vinst >> 8); |
| 119 | nv_wr32(dev, 0x100cbc, 0x80000000 | engine); | 122 | nv_wr32(dev, 0x100cbc, 0x80000000 | engine); |
| 120 | if (!nv_wait(dev, 0x100c80, 0xffffffff, r100c80)) | 123 | /* wait for flush to be queued? */ |
| 121 | NV_ERROR(dev, "vm flush timeout eng %d\n", engine); | 124 | if (!nv_wait(dev, 0x100c80, 0x00008000, 0x00008000)) { |
| 125 | NV_ERROR(dev, "vm timeout 1: 0x%08x %d\n", | ||
| 126 | nv_rd32(dev, 0x100c80), engine); | ||
| 127 | } | ||
| 122 | } | 128 | } |
| 129 | spin_unlock_irqrestore(&dev_priv->vm_lock, flags); | ||
| 123 | } | 130 | } |
diff --git a/drivers/gpu/drm/radeon/atom.c b/drivers/gpu/drm/radeon/atom.c index 258fa5e7a2d9..7bd745689097 100644 --- a/drivers/gpu/drm/radeon/atom.c +++ b/drivers/gpu/drm/radeon/atom.c | |||
| @@ -32,6 +32,7 @@ | |||
| 32 | #include "atom.h" | 32 | #include "atom.h" |
| 33 | #include "atom-names.h" | 33 | #include "atom-names.h" |
| 34 | #include "atom-bits.h" | 34 | #include "atom-bits.h" |
| 35 | #include "radeon.h" | ||
| 35 | 36 | ||
| 36 | #define ATOM_COND_ABOVE 0 | 37 | #define ATOM_COND_ABOVE 0 |
| 37 | #define ATOM_COND_ABOVEOREQUAL 1 | 38 | #define ATOM_COND_ABOVEOREQUAL 1 |
| @@ -101,7 +102,9 @@ static void debug_print_spaces(int n) | |||
| 101 | static uint32_t atom_iio_execute(struct atom_context *ctx, int base, | 102 | static uint32_t atom_iio_execute(struct atom_context *ctx, int base, |
| 102 | uint32_t index, uint32_t data) | 103 | uint32_t index, uint32_t data) |
| 103 | { | 104 | { |
| 105 | struct radeon_device *rdev = ctx->card->dev->dev_private; | ||
| 104 | uint32_t temp = 0xCDCDCDCD; | 106 | uint32_t temp = 0xCDCDCDCD; |
| 107 | |||
| 105 | while (1) | 108 | while (1) |
| 106 | switch (CU8(base)) { | 109 | switch (CU8(base)) { |
| 107 | case ATOM_IIO_NOP: | 110 | case ATOM_IIO_NOP: |
| @@ -112,7 +115,8 @@ static uint32_t atom_iio_execute(struct atom_context *ctx, int base, | |||
| 112 | base += 3; | 115 | base += 3; |
| 113 | break; | 116 | break; |
| 114 | case ATOM_IIO_WRITE: | 117 | case ATOM_IIO_WRITE: |
| 115 | (void)ctx->card->ioreg_read(ctx->card, CU16(base + 1)); | 118 | if (rdev->family == CHIP_RV515) |
| 119 | (void)ctx->card->ioreg_read(ctx->card, CU16(base + 1)); | ||
| 116 | ctx->card->ioreg_write(ctx->card, CU16(base + 1), temp); | 120 | ctx->card->ioreg_write(ctx->card, CU16(base + 1), temp); |
| 117 | base += 3; | 121 | base += 3; |
| 118 | break; | 122 | break; |
| @@ -131,7 +135,7 @@ static uint32_t atom_iio_execute(struct atom_context *ctx, int base, | |||
| 131 | case ATOM_IIO_MOVE_INDEX: | 135 | case ATOM_IIO_MOVE_INDEX: |
| 132 | temp &= | 136 | temp &= |
| 133 | ~((0xFFFFFFFF >> (32 - CU8(base + 1))) << | 137 | ~((0xFFFFFFFF >> (32 - CU8(base + 1))) << |
| 134 | CU8(base + 2)); | 138 | CU8(base + 3)); |
| 135 | temp |= | 139 | temp |= |
| 136 | ((index >> CU8(base + 2)) & | 140 | ((index >> CU8(base + 2)) & |
| 137 | (0xFFFFFFFF >> (32 - CU8(base + 1)))) << CU8(base + | 141 | (0xFFFFFFFF >> (32 - CU8(base + 1)))) << CU8(base + |
| @@ -141,7 +145,7 @@ static uint32_t atom_iio_execute(struct atom_context *ctx, int base, | |||
| 141 | case ATOM_IIO_MOVE_DATA: | 145 | case ATOM_IIO_MOVE_DATA: |
| 142 | temp &= | 146 | temp &= |
| 143 | ~((0xFFFFFFFF >> (32 - CU8(base + 1))) << | 147 | ~((0xFFFFFFFF >> (32 - CU8(base + 1))) << |
| 144 | CU8(base + 2)); | 148 | CU8(base + 3)); |
| 145 | temp |= | 149 | temp |= |
| 146 | ((data >> CU8(base + 2)) & | 150 | ((data >> CU8(base + 2)) & |
| 147 | (0xFFFFFFFF >> (32 - CU8(base + 1)))) << CU8(base + | 151 | (0xFFFFFFFF >> (32 - CU8(base + 1)))) << CU8(base + |
| @@ -151,7 +155,7 @@ static uint32_t atom_iio_execute(struct atom_context *ctx, int base, | |||
| 151 | case ATOM_IIO_MOVE_ATTR: | 155 | case ATOM_IIO_MOVE_ATTR: |
| 152 | temp &= | 156 | temp &= |
| 153 | ~((0xFFFFFFFF >> (32 - CU8(base + 1))) << | 157 | ~((0xFFFFFFFF >> (32 - CU8(base + 1))) << |
| 154 | CU8(base + 2)); | 158 | CU8(base + 3)); |
| 155 | temp |= | 159 | temp |= |
| 156 | ((ctx-> | 160 | ((ctx-> |
| 157 | io_attr >> CU8(base + 2)) & (0xFFFFFFFF >> (32 - | 161 | io_attr >> CU8(base + 2)) & (0xFFFFFFFF >> (32 - |
diff --git a/drivers/gpu/drm/radeon/atombios_crtc.c b/drivers/gpu/drm/radeon/atombios_crtc.c index b41ec59c7100..529a3a704731 100644 --- a/drivers/gpu/drm/radeon/atombios_crtc.c +++ b/drivers/gpu/drm/radeon/atombios_crtc.c | |||
| @@ -531,6 +531,9 @@ static u32 atombios_adjust_pll(struct drm_crtc *crtc, | |||
| 531 | pll->flags |= RADEON_PLL_PREFER_HIGH_FB_DIV; | 531 | pll->flags |= RADEON_PLL_PREFER_HIGH_FB_DIV; |
| 532 | else | 532 | else |
| 533 | pll->flags |= RADEON_PLL_PREFER_LOW_REF_DIV; | 533 | pll->flags |= RADEON_PLL_PREFER_LOW_REF_DIV; |
| 534 | |||
| 535 | if (rdev->family < CHIP_RV770) | ||
| 536 | pll->flags |= RADEON_PLL_PREFER_MINM_OVER_MAXP; | ||
| 534 | } else { | 537 | } else { |
| 535 | pll->flags |= RADEON_PLL_LEGACY; | 538 | pll->flags |= RADEON_PLL_LEGACY; |
| 536 | 539 | ||
| @@ -559,7 +562,6 @@ static u32 atombios_adjust_pll(struct drm_crtc *crtc, | |||
| 559 | if (radeon_encoder->devices & (ATOM_DEVICE_LCD_SUPPORT)) { | 562 | if (radeon_encoder->devices & (ATOM_DEVICE_LCD_SUPPORT)) { |
| 560 | if (ss_enabled) { | 563 | if (ss_enabled) { |
| 561 | if (ss->refdiv) { | 564 | if (ss->refdiv) { |
| 562 | pll->flags |= RADEON_PLL_PREFER_MINM_OVER_MAXP; | ||
| 563 | pll->flags |= RADEON_PLL_USE_REF_DIV; | 565 | pll->flags |= RADEON_PLL_USE_REF_DIV; |
| 564 | pll->reference_div = ss->refdiv; | 566 | pll->reference_div = ss->refdiv; |
| 565 | if (ASIC_IS_AVIVO(rdev)) | 567 | if (ASIC_IS_AVIVO(rdev)) |
diff --git a/drivers/gpu/drm/radeon/evergreen.c b/drivers/gpu/drm/radeon/evergreen.c index 0b0cc74c08c0..e9bc135d9189 100644 --- a/drivers/gpu/drm/radeon/evergreen.c +++ b/drivers/gpu/drm/radeon/evergreen.c | |||
| @@ -120,11 +120,16 @@ void evergreen_pm_misc(struct radeon_device *rdev) | |||
| 120 | struct radeon_power_state *ps = &rdev->pm.power_state[req_ps_idx]; | 120 | struct radeon_power_state *ps = &rdev->pm.power_state[req_ps_idx]; |
| 121 | struct radeon_voltage *voltage = &ps->clock_info[req_cm_idx].voltage; | 121 | struct radeon_voltage *voltage = &ps->clock_info[req_cm_idx].voltage; |
| 122 | 122 | ||
| 123 | if ((voltage->type == VOLTAGE_SW) && voltage->voltage) { | 123 | if (voltage->type == VOLTAGE_SW) { |
| 124 | if (voltage->voltage != rdev->pm.current_vddc) { | 124 | if (voltage->voltage && (voltage->voltage != rdev->pm.current_vddc)) { |
| 125 | radeon_atom_set_voltage(rdev, voltage->voltage); | 125 | radeon_atom_set_voltage(rdev, voltage->voltage, SET_VOLTAGE_TYPE_ASIC_VDDC); |
| 126 | rdev->pm.current_vddc = voltage->voltage; | 126 | rdev->pm.current_vddc = voltage->voltage; |
| 127 | DRM_DEBUG("Setting: v: %d\n", voltage->voltage); | 127 | DRM_DEBUG("Setting: vddc: %d\n", voltage->voltage); |
| 128 | } | ||
| 129 | if (voltage->vddci && (voltage->vddci != rdev->pm.current_vddci)) { | ||
| 130 | radeon_atom_set_voltage(rdev, voltage->vddci, SET_VOLTAGE_TYPE_ASIC_VDDCI); | ||
| 131 | rdev->pm.current_vddci = voltage->vddci; | ||
| 132 | DRM_DEBUG("Setting: vddci: %d\n", voltage->vddci); | ||
| 128 | } | 133 | } |
| 129 | } | 134 | } |
| 130 | } | 135 | } |
| @@ -348,7 +353,7 @@ static u32 evergreen_line_buffer_adjust(struct radeon_device *rdev, | |||
| 348 | struct drm_display_mode *mode, | 353 | struct drm_display_mode *mode, |
| 349 | struct drm_display_mode *other_mode) | 354 | struct drm_display_mode *other_mode) |
| 350 | { | 355 | { |
| 351 | u32 tmp = 0; | 356 | u32 tmp; |
| 352 | /* | 357 | /* |
| 353 | * Line Buffer Setup | 358 | * Line Buffer Setup |
| 354 | * There are 3 line buffers, each one shared by 2 display controllers. | 359 | * There are 3 line buffers, each one shared by 2 display controllers. |
| @@ -358,64 +363,63 @@ static u32 evergreen_line_buffer_adjust(struct radeon_device *rdev, | |||
| 358 | * first display controller | 363 | * first display controller |
| 359 | * 0 - first half of lb (3840 * 2) | 364 | * 0 - first half of lb (3840 * 2) |
| 360 | * 1 - first 3/4 of lb (5760 * 2) | 365 | * 1 - first 3/4 of lb (5760 * 2) |
| 361 | * 2 - whole lb (7680 * 2) | 366 | * 2 - whole lb (7680 * 2), other crtc must be disabled |
| 362 | * 3 - first 1/4 of lb (1920 * 2) | 367 | * 3 - first 1/4 of lb (1920 * 2) |
| 363 | * second display controller | 368 | * second display controller |
| 364 | * 4 - second half of lb (3840 * 2) | 369 | * 4 - second half of lb (3840 * 2) |
| 365 | * 5 - second 3/4 of lb (5760 * 2) | 370 | * 5 - second 3/4 of lb (5760 * 2) |
| 366 | * 6 - whole lb (7680 * 2) | 371 | * 6 - whole lb (7680 * 2), other crtc must be disabled |
| 367 | * 7 - last 1/4 of lb (1920 * 2) | 372 | * 7 - last 1/4 of lb (1920 * 2) |
| 368 | */ | 373 | */ |
| 369 | if (mode && other_mode) { | 374 | /* this can get tricky if we have two large displays on a paired group |
| 370 | if (mode->hdisplay > other_mode->hdisplay) { | 375 | * of crtcs. Ideally for multiple large displays we'd assign them to |
| 371 | if (mode->hdisplay > 2560) | 376 | * non-linked crtcs for maximum line buffer allocation. |
| 372 | tmp = 1; /* 3/4 */ | 377 | */ |
| 373 | else | 378 | if (radeon_crtc->base.enabled && mode) { |
| 374 | tmp = 0; /* 1/2 */ | 379 | if (other_mode) |
| 375 | } else if (other_mode->hdisplay > mode->hdisplay) { | ||
| 376 | if (other_mode->hdisplay > 2560) | ||
| 377 | tmp = 3; /* 1/4 */ | ||
| 378 | else | ||
| 379 | tmp = 0; /* 1/2 */ | ||
| 380 | } else | ||
| 381 | tmp = 0; /* 1/2 */ | 380 | tmp = 0; /* 1/2 */ |
| 382 | } else if (mode) | 381 | else |
| 383 | tmp = 2; /* whole */ | 382 | tmp = 2; /* whole */ |
| 384 | else if (other_mode) | 383 | } else |
| 385 | tmp = 3; /* 1/4 */ | 384 | tmp = 0; |
| 386 | 385 | ||
| 387 | /* second controller of the pair uses second half of the lb */ | 386 | /* second controller of the pair uses second half of the lb */ |
| 388 | if (radeon_crtc->crtc_id % 2) | 387 | if (radeon_crtc->crtc_id % 2) |
| 389 | tmp += 4; | 388 | tmp += 4; |
| 390 | WREG32(DC_LB_MEMORY_SPLIT + radeon_crtc->crtc_offset, tmp); | 389 | WREG32(DC_LB_MEMORY_SPLIT + radeon_crtc->crtc_offset, tmp); |
| 391 | 390 | ||
| 392 | switch (tmp) { | 391 | if (radeon_crtc->base.enabled && mode) { |
| 393 | case 0: | 392 | switch (tmp) { |
| 394 | case 4: | 393 | case 0: |
| 395 | default: | 394 | case 4: |
| 396 | if (ASIC_IS_DCE5(rdev)) | 395 | default: |
| 397 | return 4096 * 2; | 396 | if (ASIC_IS_DCE5(rdev)) |
| 398 | else | 397 | return 4096 * 2; |
| 399 | return 3840 * 2; | 398 | else |
| 400 | case 1: | 399 | return 3840 * 2; |
| 401 | case 5: | 400 | case 1: |
| 402 | if (ASIC_IS_DCE5(rdev)) | 401 | case 5: |
| 403 | return 6144 * 2; | 402 | if (ASIC_IS_DCE5(rdev)) |
| 404 | else | 403 | return 6144 * 2; |
| 405 | return 5760 * 2; | 404 | else |
| 406 | case 2: | 405 | return 5760 * 2; |
| 407 | case 6: | 406 | case 2: |
| 408 | if (ASIC_IS_DCE5(rdev)) | 407 | case 6: |
| 409 | return 8192 * 2; | 408 | if (ASIC_IS_DCE5(rdev)) |
| 410 | else | 409 | return 8192 * 2; |
| 411 | return 7680 * 2; | 410 | else |
| 412 | case 3: | 411 | return 7680 * 2; |
| 413 | case 7: | 412 | case 3: |
| 414 | if (ASIC_IS_DCE5(rdev)) | 413 | case 7: |
| 415 | return 2048 * 2; | 414 | if (ASIC_IS_DCE5(rdev)) |
| 416 | else | 415 | return 2048 * 2; |
| 417 | return 1920 * 2; | 416 | else |
| 417 | return 1920 * 2; | ||
| 418 | } | ||
| 418 | } | 419 | } |
| 420 | |||
| 421 | /* controller not enabled, so no lb used */ | ||
| 422 | return 0; | ||
| 419 | } | 423 | } |
| 420 | 424 | ||
| 421 | static u32 evergreen_get_number_of_dram_channels(struct radeon_device *rdev) | 425 | static u32 evergreen_get_number_of_dram_channels(struct radeon_device *rdev) |
| @@ -2576,7 +2580,7 @@ static inline u32 evergreen_get_ih_wptr(struct radeon_device *rdev) | |||
| 2576 | u32 wptr, tmp; | 2580 | u32 wptr, tmp; |
| 2577 | 2581 | ||
| 2578 | if (rdev->wb.enabled) | 2582 | if (rdev->wb.enabled) |
| 2579 | wptr = rdev->wb.wb[R600_WB_IH_WPTR_OFFSET/4]; | 2583 | wptr = le32_to_cpu(rdev->wb.wb[R600_WB_IH_WPTR_OFFSET/4]); |
| 2580 | else | 2584 | else |
| 2581 | wptr = RREG32(IH_RB_WPTR); | 2585 | wptr = RREG32(IH_RB_WPTR); |
| 2582 | 2586 | ||
| @@ -3036,9 +3040,6 @@ int evergreen_init(struct radeon_device *rdev) | |||
| 3036 | { | 3040 | { |
| 3037 | int r; | 3041 | int r; |
| 3038 | 3042 | ||
| 3039 | r = radeon_dummy_page_init(rdev); | ||
| 3040 | if (r) | ||
| 3041 | return r; | ||
| 3042 | /* This don't do much */ | 3043 | /* This don't do much */ |
| 3043 | r = radeon_gem_init(rdev); | 3044 | r = radeon_gem_init(rdev); |
| 3044 | if (r) | 3045 | if (r) |
| @@ -3150,7 +3151,6 @@ void evergreen_fini(struct radeon_device *rdev) | |||
| 3150 | radeon_atombios_fini(rdev); | 3151 | radeon_atombios_fini(rdev); |
| 3151 | kfree(rdev->bios); | 3152 | kfree(rdev->bios); |
| 3152 | rdev->bios = NULL; | 3153 | rdev->bios = NULL; |
| 3153 | radeon_dummy_page_fini(rdev); | ||
| 3154 | } | 3154 | } |
| 3155 | 3155 | ||
| 3156 | static void evergreen_pcie_gen2_enable(struct radeon_device *rdev) | 3156 | static void evergreen_pcie_gen2_enable(struct radeon_device *rdev) |
diff --git a/drivers/gpu/drm/radeon/r600.c b/drivers/gpu/drm/radeon/r600.c index be271c42de4d..6f27593901c7 100644 --- a/drivers/gpu/drm/radeon/r600.c +++ b/drivers/gpu/drm/radeon/r600.c | |||
| @@ -587,7 +587,7 @@ void r600_pm_misc(struct radeon_device *rdev) | |||
| 587 | 587 | ||
| 588 | if ((voltage->type == VOLTAGE_SW) && voltage->voltage) { | 588 | if ((voltage->type == VOLTAGE_SW) && voltage->voltage) { |
| 589 | if (voltage->voltage != rdev->pm.current_vddc) { | 589 | if (voltage->voltage != rdev->pm.current_vddc) { |
| 590 | radeon_atom_set_voltage(rdev, voltage->voltage); | 590 | radeon_atom_set_voltage(rdev, voltage->voltage, SET_VOLTAGE_TYPE_ASIC_VDDC); |
| 591 | rdev->pm.current_vddc = voltage->voltage; | 591 | rdev->pm.current_vddc = voltage->voltage; |
| 592 | DRM_DEBUG_DRIVER("Setting: v: %d\n", voltage->voltage); | 592 | DRM_DEBUG_DRIVER("Setting: v: %d\n", voltage->voltage); |
| 593 | } | 593 | } |
| @@ -2509,9 +2509,6 @@ int r600_init(struct radeon_device *rdev) | |||
| 2509 | { | 2509 | { |
| 2510 | int r; | 2510 | int r; |
| 2511 | 2511 | ||
| 2512 | r = radeon_dummy_page_init(rdev); | ||
| 2513 | if (r) | ||
| 2514 | return r; | ||
| 2515 | if (r600_debugfs_mc_info_init(rdev)) { | 2512 | if (r600_debugfs_mc_info_init(rdev)) { |
| 2516 | DRM_ERROR("Failed to register debugfs file for mc !\n"); | 2513 | DRM_ERROR("Failed to register debugfs file for mc !\n"); |
| 2517 | } | 2514 | } |
| @@ -2625,7 +2622,6 @@ void r600_fini(struct radeon_device *rdev) | |||
| 2625 | radeon_atombios_fini(rdev); | 2622 | radeon_atombios_fini(rdev); |
| 2626 | kfree(rdev->bios); | 2623 | kfree(rdev->bios); |
| 2627 | rdev->bios = NULL; | 2624 | rdev->bios = NULL; |
| 2628 | radeon_dummy_page_fini(rdev); | ||
| 2629 | } | 2625 | } |
| 2630 | 2626 | ||
| 2631 | 2627 | ||
| @@ -3235,7 +3231,7 @@ static inline u32 r600_get_ih_wptr(struct radeon_device *rdev) | |||
| 3235 | u32 wptr, tmp; | 3231 | u32 wptr, tmp; |
| 3236 | 3232 | ||
| 3237 | if (rdev->wb.enabled) | 3233 | if (rdev->wb.enabled) |
| 3238 | wptr = rdev->wb.wb[R600_WB_IH_WPTR_OFFSET/4]; | 3234 | wptr = le32_to_cpu(rdev->wb.wb[R600_WB_IH_WPTR_OFFSET/4]); |
| 3239 | else | 3235 | else |
| 3240 | wptr = RREG32(IH_RB_WPTR); | 3236 | wptr = RREG32(IH_RB_WPTR); |
| 3241 | 3237 | ||
diff --git a/drivers/gpu/drm/radeon/radeon.h b/drivers/gpu/drm/radeon/radeon.h index 93f536594c73..ba643b576054 100644 --- a/drivers/gpu/drm/radeon/radeon.h +++ b/drivers/gpu/drm/radeon/radeon.h | |||
| @@ -177,7 +177,7 @@ void radeon_pm_suspend(struct radeon_device *rdev); | |||
| 177 | void radeon_pm_resume(struct radeon_device *rdev); | 177 | void radeon_pm_resume(struct radeon_device *rdev); |
| 178 | void radeon_combios_get_power_modes(struct radeon_device *rdev); | 178 | void radeon_combios_get_power_modes(struct radeon_device *rdev); |
| 179 | void radeon_atombios_get_power_modes(struct radeon_device *rdev); | 179 | void radeon_atombios_get_power_modes(struct radeon_device *rdev); |
| 180 | void radeon_atom_set_voltage(struct radeon_device *rdev, u16 level); | 180 | void radeon_atom_set_voltage(struct radeon_device *rdev, u16 voltage_level, u8 voltage_type); |
| 181 | void rs690_pm_info(struct radeon_device *rdev); | 181 | void rs690_pm_info(struct radeon_device *rdev); |
| 182 | extern int rv6xx_get_temp(struct radeon_device *rdev); | 182 | extern int rv6xx_get_temp(struct radeon_device *rdev); |
| 183 | extern int rv770_get_temp(struct radeon_device *rdev); | 183 | extern int rv770_get_temp(struct radeon_device *rdev); |
| @@ -767,7 +767,9 @@ struct radeon_voltage { | |||
| 767 | u8 vddci_id; /* index into vddci voltage table */ | 767 | u8 vddci_id; /* index into vddci voltage table */ |
| 768 | bool vddci_enabled; | 768 | bool vddci_enabled; |
| 769 | /* r6xx+ sw */ | 769 | /* r6xx+ sw */ |
| 770 | u32 voltage; | 770 | u16 voltage; |
| 771 | /* evergreen+ vddci */ | ||
| 772 | u16 vddci; | ||
| 771 | }; | 773 | }; |
| 772 | 774 | ||
| 773 | /* clock mode flags */ | 775 | /* clock mode flags */ |
| @@ -835,10 +837,12 @@ struct radeon_pm { | |||
| 835 | int default_power_state_index; | 837 | int default_power_state_index; |
| 836 | u32 current_sclk; | 838 | u32 current_sclk; |
| 837 | u32 current_mclk; | 839 | u32 current_mclk; |
| 838 | u32 current_vddc; | 840 | u16 current_vddc; |
| 841 | u16 current_vddci; | ||
| 839 | u32 default_sclk; | 842 | u32 default_sclk; |
| 840 | u32 default_mclk; | 843 | u32 default_mclk; |
| 841 | u32 default_vddc; | 844 | u16 default_vddc; |
| 845 | u16 default_vddci; | ||
| 842 | struct radeon_i2c_chan *i2c_bus; | 846 | struct radeon_i2c_chan *i2c_bus; |
| 843 | /* selected pm method */ | 847 | /* selected pm method */ |
| 844 | enum radeon_pm_method pm_method; | 848 | enum radeon_pm_method pm_method; |
diff --git a/drivers/gpu/drm/radeon/radeon_asic.c b/drivers/gpu/drm/radeon/radeon_asic.c index eb888ee5f674..ca576191d058 100644 --- a/drivers/gpu/drm/radeon/radeon_asic.c +++ b/drivers/gpu/drm/radeon/radeon_asic.c | |||
| @@ -94,7 +94,7 @@ static void radeon_register_accessor_init(struct radeon_device *rdev) | |||
| 94 | rdev->mc_rreg = &rs600_mc_rreg; | 94 | rdev->mc_rreg = &rs600_mc_rreg; |
| 95 | rdev->mc_wreg = &rs600_mc_wreg; | 95 | rdev->mc_wreg = &rs600_mc_wreg; |
| 96 | } | 96 | } |
| 97 | if ((rdev->family >= CHIP_R600) && (rdev->family <= CHIP_HEMLOCK)) { | 97 | if (rdev->family >= CHIP_R600) { |
| 98 | rdev->pciep_rreg = &r600_pciep_rreg; | 98 | rdev->pciep_rreg = &r600_pciep_rreg; |
| 99 | rdev->pciep_wreg = &r600_pciep_wreg; | 99 | rdev->pciep_wreg = &r600_pciep_wreg; |
| 100 | } | 100 | } |
diff --git a/drivers/gpu/drm/radeon/radeon_atombios.c b/drivers/gpu/drm/radeon/radeon_atombios.c index 99768d9d91da..f5d12fb103fa 100644 --- a/drivers/gpu/drm/radeon/radeon_atombios.c +++ b/drivers/gpu/drm/radeon/radeon_atombios.c | |||
| @@ -2176,24 +2176,27 @@ static void radeon_atombios_add_pplib_thermal_controller(struct radeon_device *r | |||
| 2176 | } | 2176 | } |
| 2177 | } | 2177 | } |
| 2178 | 2178 | ||
| 2179 | static u16 radeon_atombios_get_default_vddc(struct radeon_device *rdev) | 2179 | static void radeon_atombios_get_default_voltages(struct radeon_device *rdev, |
| 2180 | u16 *vddc, u16 *vddci) | ||
| 2180 | { | 2181 | { |
| 2181 | struct radeon_mode_info *mode_info = &rdev->mode_info; | 2182 | struct radeon_mode_info *mode_info = &rdev->mode_info; |
| 2182 | int index = GetIndexIntoMasterTable(DATA, FirmwareInfo); | 2183 | int index = GetIndexIntoMasterTable(DATA, FirmwareInfo); |
| 2183 | u8 frev, crev; | 2184 | u8 frev, crev; |
| 2184 | u16 data_offset; | 2185 | u16 data_offset; |
| 2185 | union firmware_info *firmware_info; | 2186 | union firmware_info *firmware_info; |
| 2186 | u16 vddc = 0; | 2187 | |
| 2188 | *vddc = 0; | ||
| 2189 | *vddci = 0; | ||
| 2187 | 2190 | ||
| 2188 | if (atom_parse_data_header(mode_info->atom_context, index, NULL, | 2191 | if (atom_parse_data_header(mode_info->atom_context, index, NULL, |
| 2189 | &frev, &crev, &data_offset)) { | 2192 | &frev, &crev, &data_offset)) { |
| 2190 | firmware_info = | 2193 | firmware_info = |
| 2191 | (union firmware_info *)(mode_info->atom_context->bios + | 2194 | (union firmware_info *)(mode_info->atom_context->bios + |
| 2192 | data_offset); | 2195 | data_offset); |
| 2193 | vddc = le16_to_cpu(firmware_info->info_14.usBootUpVDDCVoltage); | 2196 | *vddc = le16_to_cpu(firmware_info->info_14.usBootUpVDDCVoltage); |
| 2197 | if ((frev == 2) && (crev >= 2)) | ||
| 2198 | *vddci = le16_to_cpu(firmware_info->info_22.usBootUpVDDCIVoltage); | ||
| 2194 | } | 2199 | } |
| 2195 | |||
| 2196 | return vddc; | ||
| 2197 | } | 2200 | } |
| 2198 | 2201 | ||
| 2199 | static void radeon_atombios_parse_pplib_non_clock_info(struct radeon_device *rdev, | 2202 | static void radeon_atombios_parse_pplib_non_clock_info(struct radeon_device *rdev, |
| @@ -2203,7 +2206,9 @@ static void radeon_atombios_parse_pplib_non_clock_info(struct radeon_device *rde | |||
| 2203 | int j; | 2206 | int j; |
| 2204 | u32 misc = le32_to_cpu(non_clock_info->ulCapsAndSettings); | 2207 | u32 misc = le32_to_cpu(non_clock_info->ulCapsAndSettings); |
| 2205 | u32 misc2 = le16_to_cpu(non_clock_info->usClassification); | 2208 | u32 misc2 = le16_to_cpu(non_clock_info->usClassification); |
| 2206 | u16 vddc = radeon_atombios_get_default_vddc(rdev); | 2209 | u16 vddc, vddci; |
| 2210 | |||
| 2211 | radeon_atombios_get_default_voltages(rdev, &vddc, &vddci); | ||
| 2207 | 2212 | ||
| 2208 | rdev->pm.power_state[state_index].misc = misc; | 2213 | rdev->pm.power_state[state_index].misc = misc; |
| 2209 | rdev->pm.power_state[state_index].misc2 = misc2; | 2214 | rdev->pm.power_state[state_index].misc2 = misc2; |
| @@ -2244,6 +2249,7 @@ static void radeon_atombios_parse_pplib_non_clock_info(struct radeon_device *rde | |||
| 2244 | rdev->pm.default_sclk = rdev->pm.power_state[state_index].clock_info[0].sclk; | 2249 | rdev->pm.default_sclk = rdev->pm.power_state[state_index].clock_info[0].sclk; |
| 2245 | rdev->pm.default_mclk = rdev->pm.power_state[state_index].clock_info[0].mclk; | 2250 | rdev->pm.default_mclk = rdev->pm.power_state[state_index].clock_info[0].mclk; |
| 2246 | rdev->pm.default_vddc = rdev->pm.power_state[state_index].clock_info[0].voltage.voltage; | 2251 | rdev->pm.default_vddc = rdev->pm.power_state[state_index].clock_info[0].voltage.voltage; |
| 2252 | rdev->pm.default_vddci = rdev->pm.power_state[state_index].clock_info[0].voltage.vddci; | ||
| 2247 | } else { | 2253 | } else { |
| 2248 | /* patch the table values with the default slck/mclk from firmware info */ | 2254 | /* patch the table values with the default slck/mclk from firmware info */ |
| 2249 | for (j = 0; j < mode_index; j++) { | 2255 | for (j = 0; j < mode_index; j++) { |
| @@ -2286,6 +2292,8 @@ static bool radeon_atombios_parse_pplib_clock_info(struct radeon_device *rdev, | |||
| 2286 | VOLTAGE_SW; | 2292 | VOLTAGE_SW; |
| 2287 | rdev->pm.power_state[state_index].clock_info[mode_index].voltage.voltage = | 2293 | rdev->pm.power_state[state_index].clock_info[mode_index].voltage.voltage = |
| 2288 | le16_to_cpu(clock_info->evergreen.usVDDC); | 2294 | le16_to_cpu(clock_info->evergreen.usVDDC); |
| 2295 | rdev->pm.power_state[state_index].clock_info[mode_index].voltage.vddci = | ||
| 2296 | le16_to_cpu(clock_info->evergreen.usVDDCI); | ||
| 2289 | } else { | 2297 | } else { |
| 2290 | sclk = le16_to_cpu(clock_info->r600.usEngineClockLow); | 2298 | sclk = le16_to_cpu(clock_info->r600.usEngineClockLow); |
| 2291 | sclk |= clock_info->r600.ucEngineClockHigh << 16; | 2299 | sclk |= clock_info->r600.ucEngineClockHigh << 16; |
| @@ -2577,25 +2585,25 @@ union set_voltage { | |||
| 2577 | struct _SET_VOLTAGE_PARAMETERS_V2 v2; | 2585 | struct _SET_VOLTAGE_PARAMETERS_V2 v2; |
| 2578 | }; | 2586 | }; |
| 2579 | 2587 | ||
| 2580 | void radeon_atom_set_voltage(struct radeon_device *rdev, u16 level) | 2588 | void radeon_atom_set_voltage(struct radeon_device *rdev, u16 voltage_level, u8 voltage_type) |
| 2581 | { | 2589 | { |
| 2582 | union set_voltage args; | 2590 | union set_voltage args; |
| 2583 | int index = GetIndexIntoMasterTable(COMMAND, SetVoltage); | 2591 | int index = GetIndexIntoMasterTable(COMMAND, SetVoltage); |
| 2584 | u8 frev, crev, volt_index = level; | 2592 | u8 frev, crev, volt_index = voltage_level; |
| 2585 | 2593 | ||
| 2586 | if (!atom_parse_cmd_header(rdev->mode_info.atom_context, index, &frev, &crev)) | 2594 | if (!atom_parse_cmd_header(rdev->mode_info.atom_context, index, &frev, &crev)) |
| 2587 | return; | 2595 | return; |
| 2588 | 2596 | ||
| 2589 | switch (crev) { | 2597 | switch (crev) { |
| 2590 | case 1: | 2598 | case 1: |
| 2591 | args.v1.ucVoltageType = SET_VOLTAGE_TYPE_ASIC_VDDC; | 2599 | args.v1.ucVoltageType = voltage_type; |
| 2592 | args.v1.ucVoltageMode = SET_ASIC_VOLTAGE_MODE_ALL_SOURCE; | 2600 | args.v1.ucVoltageMode = SET_ASIC_VOLTAGE_MODE_ALL_SOURCE; |
| 2593 | args.v1.ucVoltageIndex = volt_index; | 2601 | args.v1.ucVoltageIndex = volt_index; |
| 2594 | break; | 2602 | break; |
| 2595 | case 2: | 2603 | case 2: |
| 2596 | args.v2.ucVoltageType = SET_VOLTAGE_TYPE_ASIC_VDDC; | 2604 | args.v2.ucVoltageType = voltage_type; |
| 2597 | args.v2.ucVoltageMode = SET_ASIC_VOLTAGE_MODE_SET_VOLTAGE; | 2605 | args.v2.ucVoltageMode = SET_ASIC_VOLTAGE_MODE_SET_VOLTAGE; |
| 2598 | args.v2.usVoltageLevel = cpu_to_le16(level); | 2606 | args.v2.usVoltageLevel = cpu_to_le16(voltage_level); |
| 2599 | break; | 2607 | break; |
| 2600 | default: | 2608 | default: |
| 2601 | DRM_ERROR("Unknown table version %d, %d\n", frev, crev); | 2609 | DRM_ERROR("Unknown table version %d, %d\n", frev, crev); |
diff --git a/drivers/gpu/drm/radeon/radeon_connectors.c b/drivers/gpu/drm/radeon/radeon_connectors.c index 2ef6d5135064..5f45fa12bb8b 100644 --- a/drivers/gpu/drm/radeon/radeon_connectors.c +++ b/drivers/gpu/drm/radeon/radeon_connectors.c | |||
| @@ -1199,7 +1199,7 @@ radeon_add_atom_connector(struct drm_device *dev, | |||
| 1199 | if (router->ddc_valid || router->cd_valid) { | 1199 | if (router->ddc_valid || router->cd_valid) { |
| 1200 | radeon_connector->router_bus = radeon_i2c_lookup(rdev, &router->i2c_info); | 1200 | radeon_connector->router_bus = radeon_i2c_lookup(rdev, &router->i2c_info); |
| 1201 | if (!radeon_connector->router_bus) | 1201 | if (!radeon_connector->router_bus) |
| 1202 | goto failed; | 1202 | DRM_ERROR("Failed to assign router i2c bus! Check dmesg for i2c errors.\n"); |
| 1203 | } | 1203 | } |
| 1204 | switch (connector_type) { | 1204 | switch (connector_type) { |
| 1205 | case DRM_MODE_CONNECTOR_VGA: | 1205 | case DRM_MODE_CONNECTOR_VGA: |
| @@ -1208,7 +1208,7 @@ radeon_add_atom_connector(struct drm_device *dev, | |||
| 1208 | if (i2c_bus->valid) { | 1208 | if (i2c_bus->valid) { |
| 1209 | radeon_connector->ddc_bus = radeon_i2c_lookup(rdev, i2c_bus); | 1209 | radeon_connector->ddc_bus = radeon_i2c_lookup(rdev, i2c_bus); |
| 1210 | if (!radeon_connector->ddc_bus) | 1210 | if (!radeon_connector->ddc_bus) |
| 1211 | goto failed; | 1211 | DRM_ERROR("VGA: Failed to assign ddc bus! Check dmesg for i2c errors.\n"); |
| 1212 | } | 1212 | } |
| 1213 | radeon_connector->dac_load_detect = true; | 1213 | radeon_connector->dac_load_detect = true; |
| 1214 | drm_connector_attach_property(&radeon_connector->base, | 1214 | drm_connector_attach_property(&radeon_connector->base, |
| @@ -1226,7 +1226,7 @@ radeon_add_atom_connector(struct drm_device *dev, | |||
| 1226 | if (i2c_bus->valid) { | 1226 | if (i2c_bus->valid) { |
| 1227 | radeon_connector->ddc_bus = radeon_i2c_lookup(rdev, i2c_bus); | 1227 | radeon_connector->ddc_bus = radeon_i2c_lookup(rdev, i2c_bus); |
| 1228 | if (!radeon_connector->ddc_bus) | 1228 | if (!radeon_connector->ddc_bus) |
| 1229 | goto failed; | 1229 | DRM_ERROR("DVIA: Failed to assign ddc bus! Check dmesg for i2c errors.\n"); |
| 1230 | } | 1230 | } |
| 1231 | radeon_connector->dac_load_detect = true; | 1231 | radeon_connector->dac_load_detect = true; |
| 1232 | drm_connector_attach_property(&radeon_connector->base, | 1232 | drm_connector_attach_property(&radeon_connector->base, |
| @@ -1249,7 +1249,7 @@ radeon_add_atom_connector(struct drm_device *dev, | |||
| 1249 | if (i2c_bus->valid) { | 1249 | if (i2c_bus->valid) { |
| 1250 | radeon_connector->ddc_bus = radeon_i2c_lookup(rdev, i2c_bus); | 1250 | radeon_connector->ddc_bus = radeon_i2c_lookup(rdev, i2c_bus); |
| 1251 | if (!radeon_connector->ddc_bus) | 1251 | if (!radeon_connector->ddc_bus) |
| 1252 | goto failed; | 1252 | DRM_ERROR("DVI: Failed to assign ddc bus! Check dmesg for i2c errors.\n"); |
| 1253 | } | 1253 | } |
| 1254 | subpixel_order = SubPixelHorizontalRGB; | 1254 | subpixel_order = SubPixelHorizontalRGB; |
| 1255 | drm_connector_attach_property(&radeon_connector->base, | 1255 | drm_connector_attach_property(&radeon_connector->base, |
| @@ -1290,7 +1290,7 @@ radeon_add_atom_connector(struct drm_device *dev, | |||
| 1290 | if (i2c_bus->valid) { | 1290 | if (i2c_bus->valid) { |
| 1291 | radeon_connector->ddc_bus = radeon_i2c_lookup(rdev, i2c_bus); | 1291 | radeon_connector->ddc_bus = radeon_i2c_lookup(rdev, i2c_bus); |
| 1292 | if (!radeon_connector->ddc_bus) | 1292 | if (!radeon_connector->ddc_bus) |
| 1293 | goto failed; | 1293 | DRM_ERROR("HDMI: Failed to assign ddc bus! Check dmesg for i2c errors.\n"); |
| 1294 | } | 1294 | } |
| 1295 | drm_connector_attach_property(&radeon_connector->base, | 1295 | drm_connector_attach_property(&radeon_connector->base, |
| 1296 | rdev->mode_info.coherent_mode_property, | 1296 | rdev->mode_info.coherent_mode_property, |
| @@ -1329,10 +1329,10 @@ radeon_add_atom_connector(struct drm_device *dev, | |||
| 1329 | else | 1329 | else |
| 1330 | radeon_dig_connector->dp_i2c_bus = radeon_i2c_create_dp(dev, i2c_bus, "DP-auxch"); | 1330 | radeon_dig_connector->dp_i2c_bus = radeon_i2c_create_dp(dev, i2c_bus, "DP-auxch"); |
| 1331 | if (!radeon_dig_connector->dp_i2c_bus) | 1331 | if (!radeon_dig_connector->dp_i2c_bus) |
| 1332 | goto failed; | 1332 | DRM_ERROR("DP: Failed to assign dp ddc bus! Check dmesg for i2c errors.\n"); |
| 1333 | radeon_connector->ddc_bus = radeon_i2c_lookup(rdev, i2c_bus); | 1333 | radeon_connector->ddc_bus = radeon_i2c_lookup(rdev, i2c_bus); |
| 1334 | if (!radeon_connector->ddc_bus) | 1334 | if (!radeon_connector->ddc_bus) |
| 1335 | goto failed; | 1335 | DRM_ERROR("DP: Failed to assign ddc bus! Check dmesg for i2c errors.\n"); |
| 1336 | } | 1336 | } |
| 1337 | subpixel_order = SubPixelHorizontalRGB; | 1337 | subpixel_order = SubPixelHorizontalRGB; |
| 1338 | drm_connector_attach_property(&radeon_connector->base, | 1338 | drm_connector_attach_property(&radeon_connector->base, |
| @@ -1381,7 +1381,7 @@ radeon_add_atom_connector(struct drm_device *dev, | |||
| 1381 | if (i2c_bus->valid) { | 1381 | if (i2c_bus->valid) { |
| 1382 | radeon_connector->ddc_bus = radeon_i2c_lookup(rdev, i2c_bus); | 1382 | radeon_connector->ddc_bus = radeon_i2c_lookup(rdev, i2c_bus); |
| 1383 | if (!radeon_connector->ddc_bus) | 1383 | if (!radeon_connector->ddc_bus) |
| 1384 | goto failed; | 1384 | DRM_ERROR("LVDS: Failed to assign ddc bus! Check dmesg for i2c errors.\n"); |
| 1385 | } | 1385 | } |
| 1386 | drm_connector_attach_property(&radeon_connector->base, | 1386 | drm_connector_attach_property(&radeon_connector->base, |
| 1387 | dev->mode_config.scaling_mode_property, | 1387 | dev->mode_config.scaling_mode_property, |
| @@ -1457,7 +1457,7 @@ radeon_add_legacy_connector(struct drm_device *dev, | |||
| 1457 | if (i2c_bus->valid) { | 1457 | if (i2c_bus->valid) { |
| 1458 | radeon_connector->ddc_bus = radeon_i2c_lookup(rdev, i2c_bus); | 1458 | radeon_connector->ddc_bus = radeon_i2c_lookup(rdev, i2c_bus); |
| 1459 | if (!radeon_connector->ddc_bus) | 1459 | if (!radeon_connector->ddc_bus) |
| 1460 | goto failed; | 1460 | DRM_ERROR("VGA: Failed to assign ddc bus! Check dmesg for i2c errors.\n"); |
| 1461 | } | 1461 | } |
| 1462 | radeon_connector->dac_load_detect = true; | 1462 | radeon_connector->dac_load_detect = true; |
| 1463 | drm_connector_attach_property(&radeon_connector->base, | 1463 | drm_connector_attach_property(&radeon_connector->base, |
| @@ -1475,7 +1475,7 @@ radeon_add_legacy_connector(struct drm_device *dev, | |||
| 1475 | if (i2c_bus->valid) { | 1475 | if (i2c_bus->valid) { |
| 1476 | radeon_connector->ddc_bus = radeon_i2c_lookup(rdev, i2c_bus); | 1476 | radeon_connector->ddc_bus = radeon_i2c_lookup(rdev, i2c_bus); |
| 1477 | if (!radeon_connector->ddc_bus) | 1477 | if (!radeon_connector->ddc_bus) |
| 1478 | goto failed; | 1478 | DRM_ERROR("DVIA: Failed to assign ddc bus! Check dmesg for i2c errors.\n"); |
| 1479 | } | 1479 | } |
| 1480 | radeon_connector->dac_load_detect = true; | 1480 | radeon_connector->dac_load_detect = true; |
| 1481 | drm_connector_attach_property(&radeon_connector->base, | 1481 | drm_connector_attach_property(&radeon_connector->base, |
| @@ -1493,7 +1493,7 @@ radeon_add_legacy_connector(struct drm_device *dev, | |||
| 1493 | if (i2c_bus->valid) { | 1493 | if (i2c_bus->valid) { |
| 1494 | radeon_connector->ddc_bus = radeon_i2c_lookup(rdev, i2c_bus); | 1494 | radeon_connector->ddc_bus = radeon_i2c_lookup(rdev, i2c_bus); |
| 1495 | if (!radeon_connector->ddc_bus) | 1495 | if (!radeon_connector->ddc_bus) |
| 1496 | goto failed; | 1496 | DRM_ERROR("DVI: Failed to assign ddc bus! Check dmesg for i2c errors.\n"); |
| 1497 | } | 1497 | } |
| 1498 | if (connector_type == DRM_MODE_CONNECTOR_DVII) { | 1498 | if (connector_type == DRM_MODE_CONNECTOR_DVII) { |
| 1499 | radeon_connector->dac_load_detect = true; | 1499 | radeon_connector->dac_load_detect = true; |
| @@ -1538,7 +1538,7 @@ radeon_add_legacy_connector(struct drm_device *dev, | |||
| 1538 | if (i2c_bus->valid) { | 1538 | if (i2c_bus->valid) { |
| 1539 | radeon_connector->ddc_bus = radeon_i2c_lookup(rdev, i2c_bus); | 1539 | radeon_connector->ddc_bus = radeon_i2c_lookup(rdev, i2c_bus); |
| 1540 | if (!radeon_connector->ddc_bus) | 1540 | if (!radeon_connector->ddc_bus) |
| 1541 | goto failed; | 1541 | DRM_ERROR("LVDS: Failed to assign ddc bus! Check dmesg for i2c errors.\n"); |
| 1542 | } | 1542 | } |
| 1543 | drm_connector_attach_property(&radeon_connector->base, | 1543 | drm_connector_attach_property(&radeon_connector->base, |
| 1544 | dev->mode_config.scaling_mode_property, | 1544 | dev->mode_config.scaling_mode_property, |
| @@ -1567,9 +1567,4 @@ radeon_add_legacy_connector(struct drm_device *dev, | |||
| 1567 | radeon_legacy_backlight_init(radeon_encoder, connector); | 1567 | radeon_legacy_backlight_init(radeon_encoder, connector); |
| 1568 | } | 1568 | } |
| 1569 | } | 1569 | } |
| 1570 | return; | ||
| 1571 | |||
| 1572 | failed: | ||
| 1573 | drm_connector_cleanup(connector); | ||
| 1574 | kfree(connector); | ||
| 1575 | } | 1570 | } |
diff --git a/drivers/gpu/drm/radeon/radeon_fence.c b/drivers/gpu/drm/radeon/radeon_fence.c index 9e59868d354e..bbcd1dd7bac0 100644 --- a/drivers/gpu/drm/radeon/radeon_fence.c +++ b/drivers/gpu/drm/radeon/radeon_fence.c | |||
| @@ -79,7 +79,7 @@ static bool radeon_fence_poll_locked(struct radeon_device *rdev) | |||
| 79 | scratch_index = R600_WB_EVENT_OFFSET + rdev->fence_drv.scratch_reg - rdev->scratch.reg_base; | 79 | scratch_index = R600_WB_EVENT_OFFSET + rdev->fence_drv.scratch_reg - rdev->scratch.reg_base; |
| 80 | else | 80 | else |
| 81 | scratch_index = RADEON_WB_SCRATCH_OFFSET + rdev->fence_drv.scratch_reg - rdev->scratch.reg_base; | 81 | scratch_index = RADEON_WB_SCRATCH_OFFSET + rdev->fence_drv.scratch_reg - rdev->scratch.reg_base; |
| 82 | seq = rdev->wb.wb[scratch_index/4]; | 82 | seq = le32_to_cpu(rdev->wb.wb[scratch_index/4]); |
| 83 | } else | 83 | } else |
| 84 | seq = RREG32(rdev->fence_drv.scratch_reg); | 84 | seq = RREG32(rdev->fence_drv.scratch_reg); |
| 85 | if (seq != rdev->fence_drv.last_seq) { | 85 | if (seq != rdev->fence_drv.last_seq) { |
diff --git a/drivers/gpu/drm/radeon/radeon_gart.c b/drivers/gpu/drm/radeon/radeon_gart.c index f0534ef2f331..8a955bbdb608 100644 --- a/drivers/gpu/drm/radeon/radeon_gart.c +++ b/drivers/gpu/drm/radeon/radeon_gart.c | |||
| @@ -285,4 +285,6 @@ void radeon_gart_fini(struct radeon_device *rdev) | |||
| 285 | rdev->gart.pages = NULL; | 285 | rdev->gart.pages = NULL; |
| 286 | rdev->gart.pages_addr = NULL; | 286 | rdev->gart.pages_addr = NULL; |
| 287 | rdev->gart.ttm_alloced = NULL; | 287 | rdev->gart.ttm_alloced = NULL; |
| 288 | |||
| 289 | radeon_dummy_page_fini(rdev); | ||
| 288 | } | 290 | } |
diff --git a/drivers/gpu/drm/radeon/radeon_i2c.c b/drivers/gpu/drm/radeon/radeon_i2c.c index ded2a45bc95c..983cbac75af0 100644 --- a/drivers/gpu/drm/radeon/radeon_i2c.c +++ b/drivers/gpu/drm/radeon/radeon_i2c.c | |||
| @@ -1062,7 +1062,7 @@ void radeon_i2c_get_byte(struct radeon_i2c_chan *i2c_bus, | |||
| 1062 | *val = in_buf[0]; | 1062 | *val = in_buf[0]; |
| 1063 | DRM_DEBUG("val = 0x%02x\n", *val); | 1063 | DRM_DEBUG("val = 0x%02x\n", *val); |
| 1064 | } else { | 1064 | } else { |
| 1065 | DRM_ERROR("i2c 0x%02x 0x%02x read failed\n", | 1065 | DRM_DEBUG("i2c 0x%02x 0x%02x read failed\n", |
| 1066 | addr, *val); | 1066 | addr, *val); |
| 1067 | } | 1067 | } |
| 1068 | } | 1068 | } |
| @@ -1084,7 +1084,7 @@ void radeon_i2c_put_byte(struct radeon_i2c_chan *i2c_bus, | |||
| 1084 | out_buf[1] = val; | 1084 | out_buf[1] = val; |
| 1085 | 1085 | ||
| 1086 | if (i2c_transfer(&i2c_bus->adapter, &msg, 1) != 1) | 1086 | if (i2c_transfer(&i2c_bus->adapter, &msg, 1) != 1) |
| 1087 | DRM_ERROR("i2c 0x%02x 0x%02x write failed\n", | 1087 | DRM_DEBUG("i2c 0x%02x 0x%02x write failed\n", |
| 1088 | addr, val); | 1088 | addr, val); |
| 1089 | } | 1089 | } |
| 1090 | 1090 | ||
| @@ -1096,6 +1096,9 @@ void radeon_router_select_ddc_port(struct radeon_connector *radeon_connector) | |||
| 1096 | if (!radeon_connector->router.ddc_valid) | 1096 | if (!radeon_connector->router.ddc_valid) |
| 1097 | return; | 1097 | return; |
| 1098 | 1098 | ||
| 1099 | if (!radeon_connector->router_bus) | ||
| 1100 | return; | ||
| 1101 | |||
| 1099 | radeon_i2c_get_byte(radeon_connector->router_bus, | 1102 | radeon_i2c_get_byte(radeon_connector->router_bus, |
| 1100 | radeon_connector->router.i2c_addr, | 1103 | radeon_connector->router.i2c_addr, |
| 1101 | 0x3, &val); | 1104 | 0x3, &val); |
| @@ -1121,6 +1124,9 @@ void radeon_router_select_cd_port(struct radeon_connector *radeon_connector) | |||
| 1121 | if (!radeon_connector->router.cd_valid) | 1124 | if (!radeon_connector->router.cd_valid) |
| 1122 | return; | 1125 | return; |
| 1123 | 1126 | ||
| 1127 | if (!radeon_connector->router_bus) | ||
| 1128 | return; | ||
| 1129 | |||
| 1124 | radeon_i2c_get_byte(radeon_connector->router_bus, | 1130 | radeon_i2c_get_byte(radeon_connector->router_bus, |
| 1125 | radeon_connector->router.i2c_addr, | 1131 | radeon_connector->router.i2c_addr, |
| 1126 | 0x3, &val); | 1132 | 0x3, &val); |
diff --git a/drivers/gpu/drm/radeon/radeon_legacy_encoders.c b/drivers/gpu/drm/radeon/radeon_legacy_encoders.c index 5b54268ed6b2..2f46e0c8df53 100644 --- a/drivers/gpu/drm/radeon/radeon_legacy_encoders.c +++ b/drivers/gpu/drm/radeon/radeon_legacy_encoders.c | |||
| @@ -269,7 +269,7 @@ static const struct drm_encoder_helper_funcs radeon_legacy_lvds_helper_funcs = { | |||
| 269 | .disable = radeon_legacy_encoder_disable, | 269 | .disable = radeon_legacy_encoder_disable, |
| 270 | }; | 270 | }; |
| 271 | 271 | ||
| 272 | #ifdef CONFIG_BACKLIGHT_CLASS_DEVICE | 272 | #if defined(CONFIG_BACKLIGHT_CLASS_DEVICE) || defined(CONFIG_BACKLIGHT_CLASS_DEVICE_MODULE) |
| 273 | 273 | ||
| 274 | #define MAX_RADEON_LEVEL 0xFF | 274 | #define MAX_RADEON_LEVEL 0xFF |
| 275 | 275 | ||
diff --git a/drivers/gpu/drm/radeon/radeon_pm.c b/drivers/gpu/drm/radeon/radeon_pm.c index 08de669e025a..86eda1ea94df 100644 --- a/drivers/gpu/drm/radeon/radeon_pm.c +++ b/drivers/gpu/drm/radeon/radeon_pm.c | |||
| @@ -23,6 +23,7 @@ | |||
| 23 | #include "drmP.h" | 23 | #include "drmP.h" |
| 24 | #include "radeon.h" | 24 | #include "radeon.h" |
| 25 | #include "avivod.h" | 25 | #include "avivod.h" |
| 26 | #include "atom.h" | ||
| 26 | #ifdef CONFIG_ACPI | 27 | #ifdef CONFIG_ACPI |
| 27 | #include <linux/acpi.h> | 28 | #include <linux/acpi.h> |
| 28 | #endif | 29 | #endif |
| @@ -535,7 +536,11 @@ void radeon_pm_resume(struct radeon_device *rdev) | |||
| 535 | /* set up the default clocks if the MC ucode is loaded */ | 536 | /* set up the default clocks if the MC ucode is loaded */ |
| 536 | if (ASIC_IS_DCE5(rdev) && rdev->mc_fw) { | 537 | if (ASIC_IS_DCE5(rdev) && rdev->mc_fw) { |
| 537 | if (rdev->pm.default_vddc) | 538 | if (rdev->pm.default_vddc) |
| 538 | radeon_atom_set_voltage(rdev, rdev->pm.default_vddc); | 539 | radeon_atom_set_voltage(rdev, rdev->pm.default_vddc, |
| 540 | SET_VOLTAGE_TYPE_ASIC_VDDC); | ||
| 541 | if (rdev->pm.default_vddci) | ||
| 542 | radeon_atom_set_voltage(rdev, rdev->pm.default_vddci, | ||
| 543 | SET_VOLTAGE_TYPE_ASIC_VDDCI); | ||
| 539 | if (rdev->pm.default_sclk) | 544 | if (rdev->pm.default_sclk) |
| 540 | radeon_set_engine_clock(rdev, rdev->pm.default_sclk); | 545 | radeon_set_engine_clock(rdev, rdev->pm.default_sclk); |
| 541 | if (rdev->pm.default_mclk) | 546 | if (rdev->pm.default_mclk) |
| @@ -548,6 +553,7 @@ void radeon_pm_resume(struct radeon_device *rdev) | |||
| 548 | rdev->pm.current_sclk = rdev->pm.default_sclk; | 553 | rdev->pm.current_sclk = rdev->pm.default_sclk; |
| 549 | rdev->pm.current_mclk = rdev->pm.default_mclk; | 554 | rdev->pm.current_mclk = rdev->pm.default_mclk; |
| 550 | rdev->pm.current_vddc = rdev->pm.power_state[rdev->pm.default_power_state_index].clock_info[0].voltage.voltage; | 555 | rdev->pm.current_vddc = rdev->pm.power_state[rdev->pm.default_power_state_index].clock_info[0].voltage.voltage; |
| 556 | rdev->pm.current_vddci = rdev->pm.power_state[rdev->pm.default_power_state_index].clock_info[0].voltage.vddci; | ||
| 551 | if (rdev->pm.pm_method == PM_METHOD_DYNPM | 557 | if (rdev->pm.pm_method == PM_METHOD_DYNPM |
| 552 | && rdev->pm.dynpm_state == DYNPM_STATE_SUSPENDED) { | 558 | && rdev->pm.dynpm_state == DYNPM_STATE_SUSPENDED) { |
| 553 | rdev->pm.dynpm_state = DYNPM_STATE_ACTIVE; | 559 | rdev->pm.dynpm_state = DYNPM_STATE_ACTIVE; |
| @@ -585,7 +591,8 @@ int radeon_pm_init(struct radeon_device *rdev) | |||
| 585 | /* set up the default clocks if the MC ucode is loaded */ | 591 | /* set up the default clocks if the MC ucode is loaded */ |
| 586 | if (ASIC_IS_DCE5(rdev) && rdev->mc_fw) { | 592 | if (ASIC_IS_DCE5(rdev) && rdev->mc_fw) { |
| 587 | if (rdev->pm.default_vddc) | 593 | if (rdev->pm.default_vddc) |
| 588 | radeon_atom_set_voltage(rdev, rdev->pm.default_vddc); | 594 | radeon_atom_set_voltage(rdev, rdev->pm.default_vddc, |
| 595 | SET_VOLTAGE_TYPE_ASIC_VDDC); | ||
| 589 | if (rdev->pm.default_sclk) | 596 | if (rdev->pm.default_sclk) |
| 590 | radeon_set_engine_clock(rdev, rdev->pm.default_sclk); | 597 | radeon_set_engine_clock(rdev, rdev->pm.default_sclk); |
| 591 | if (rdev->pm.default_mclk) | 598 | if (rdev->pm.default_mclk) |
diff --git a/drivers/gpu/drm/radeon/radeon_ring.c b/drivers/gpu/drm/radeon/radeon_ring.c index bbc9cd823334..c6776e48fdde 100644 --- a/drivers/gpu/drm/radeon/radeon_ring.c +++ b/drivers/gpu/drm/radeon/radeon_ring.c | |||
| @@ -248,7 +248,7 @@ void radeon_ib_pool_fini(struct radeon_device *rdev) | |||
| 248 | void radeon_ring_free_size(struct radeon_device *rdev) | 248 | void radeon_ring_free_size(struct radeon_device *rdev) |
| 249 | { | 249 | { |
| 250 | if (rdev->wb.enabled) | 250 | if (rdev->wb.enabled) |
| 251 | rdev->cp.rptr = rdev->wb.wb[RADEON_WB_CP_RPTR_OFFSET/4]; | 251 | rdev->cp.rptr = le32_to_cpu(rdev->wb.wb[RADEON_WB_CP_RPTR_OFFSET/4]); |
| 252 | else { | 252 | else { |
| 253 | if (rdev->family >= CHIP_R600) | 253 | if (rdev->family >= CHIP_R600) |
| 254 | rdev->cp.rptr = RREG32(R600_CP_RB_RPTR); | 254 | rdev->cp.rptr = RREG32(R600_CP_RB_RPTR); |
diff --git a/drivers/gpu/drm/radeon/rs600.c b/drivers/gpu/drm/radeon/rs600.c index 876cebc4b8ba..6e3b11e5abbe 100644 --- a/drivers/gpu/drm/radeon/rs600.c +++ b/drivers/gpu/drm/radeon/rs600.c | |||
| @@ -114,7 +114,7 @@ void rs600_pm_misc(struct radeon_device *rdev) | |||
| 114 | udelay(voltage->delay); | 114 | udelay(voltage->delay); |
| 115 | } | 115 | } |
| 116 | } else if (voltage->type == VOLTAGE_VDDC) | 116 | } else if (voltage->type == VOLTAGE_VDDC) |
| 117 | radeon_atom_set_voltage(rdev, voltage->vddc_id); | 117 | radeon_atom_set_voltage(rdev, voltage->vddc_id, SET_VOLTAGE_TYPE_ASIC_VDDC); |
| 118 | 118 | ||
| 119 | dyn_pwrmgt_sclk_length = RREG32_PLL(DYN_PWRMGT_SCLK_LENGTH); | 119 | dyn_pwrmgt_sclk_length = RREG32_PLL(DYN_PWRMGT_SCLK_LENGTH); |
| 120 | dyn_pwrmgt_sclk_length &= ~REDUCED_POWER_SCLK_HILEN(0xf); | 120 | dyn_pwrmgt_sclk_length &= ~REDUCED_POWER_SCLK_HILEN(0xf); |
diff --git a/drivers/gpu/drm/radeon/rv770.c b/drivers/gpu/drm/radeon/rv770.c index b974ac7df8df..ef8a5babe9f7 100644 --- a/drivers/gpu/drm/radeon/rv770.c +++ b/drivers/gpu/drm/radeon/rv770.c | |||
| @@ -106,7 +106,7 @@ void rv770_pm_misc(struct radeon_device *rdev) | |||
| 106 | 106 | ||
| 107 | if ((voltage->type == VOLTAGE_SW) && voltage->voltage) { | 107 | if ((voltage->type == VOLTAGE_SW) && voltage->voltage) { |
| 108 | if (voltage->voltage != rdev->pm.current_vddc) { | 108 | if (voltage->voltage != rdev->pm.current_vddc) { |
| 109 | radeon_atom_set_voltage(rdev, voltage->voltage); | 109 | radeon_atom_set_voltage(rdev, voltage->voltage, SET_VOLTAGE_TYPE_ASIC_VDDC); |
| 110 | rdev->pm.current_vddc = voltage->voltage; | 110 | rdev->pm.current_vddc = voltage->voltage; |
| 111 | DRM_DEBUG("Setting: v: %d\n", voltage->voltage); | 111 | DRM_DEBUG("Setting: v: %d\n", voltage->voltage); |
| 112 | } | 112 | } |
| @@ -1255,9 +1255,6 @@ int rv770_init(struct radeon_device *rdev) | |||
| 1255 | { | 1255 | { |
| 1256 | int r; | 1256 | int r; |
| 1257 | 1257 | ||
| 1258 | r = radeon_dummy_page_init(rdev); | ||
| 1259 | if (r) | ||
| 1260 | return r; | ||
| 1261 | /* This don't do much */ | 1258 | /* This don't do much */ |
| 1262 | r = radeon_gem_init(rdev); | 1259 | r = radeon_gem_init(rdev); |
| 1263 | if (r) | 1260 | if (r) |
| @@ -1372,7 +1369,6 @@ void rv770_fini(struct radeon_device *rdev) | |||
| 1372 | radeon_atombios_fini(rdev); | 1369 | radeon_atombios_fini(rdev); |
| 1373 | kfree(rdev->bios); | 1370 | kfree(rdev->bios); |
| 1374 | rdev->bios = NULL; | 1371 | rdev->bios = NULL; |
| 1375 | radeon_dummy_page_fini(rdev); | ||
| 1376 | } | 1372 | } |
| 1377 | 1373 | ||
| 1378 | static void rv770_pcie_gen2_enable(struct radeon_device *rdev) | 1374 | static void rv770_pcie_gen2_enable(struct radeon_device *rdev) |
diff --git a/drivers/gpu/drm/ttm/ttm_page_alloc.c b/drivers/gpu/drm/ttm/ttm_page_alloc.c index 737a2a2e46a5..9d9d92945f8c 100644 --- a/drivers/gpu/drm/ttm/ttm_page_alloc.c +++ b/drivers/gpu/drm/ttm/ttm_page_alloc.c | |||
| @@ -683,22 +683,14 @@ int ttm_get_pages(struct list_head *pages, int flags, | |||
| 683 | gfp_flags |= GFP_HIGHUSER; | 683 | gfp_flags |= GFP_HIGHUSER; |
| 684 | 684 | ||
| 685 | for (r = 0; r < count; ++r) { | 685 | for (r = 0; r < count; ++r) { |
| 686 | if ((flags & TTM_PAGE_FLAG_DMA32) && dma_address) { | 686 | p = alloc_page(gfp_flags); |
| 687 | void *addr; | ||
| 688 | addr = dma_alloc_coherent(NULL, PAGE_SIZE, | ||
| 689 | &dma_address[r], | ||
| 690 | gfp_flags); | ||
| 691 | if (addr == NULL) | ||
| 692 | return -ENOMEM; | ||
| 693 | p = virt_to_page(addr); | ||
| 694 | } else | ||
| 695 | p = alloc_page(gfp_flags); | ||
| 696 | if (!p) { | 687 | if (!p) { |
| 697 | 688 | ||
| 698 | printk(KERN_ERR TTM_PFX | 689 | printk(KERN_ERR TTM_PFX |
| 699 | "Unable to allocate page."); | 690 | "Unable to allocate page."); |
| 700 | return -ENOMEM; | 691 | return -ENOMEM; |
| 701 | } | 692 | } |
| 693 | |||
| 702 | list_add(&p->lru, pages); | 694 | list_add(&p->lru, pages); |
| 703 | } | 695 | } |
| 704 | return 0; | 696 | return 0; |
| @@ -746,24 +738,12 @@ void ttm_put_pages(struct list_head *pages, unsigned page_count, int flags, | |||
| 746 | unsigned long irq_flags; | 738 | unsigned long irq_flags; |
| 747 | struct ttm_page_pool *pool = ttm_get_pool(flags, cstate); | 739 | struct ttm_page_pool *pool = ttm_get_pool(flags, cstate); |
| 748 | struct page *p, *tmp; | 740 | struct page *p, *tmp; |
| 749 | unsigned r; | ||
| 750 | 741 | ||
| 751 | if (pool == NULL) { | 742 | if (pool == NULL) { |
| 752 | /* No pool for this memory type so free the pages */ | 743 | /* No pool for this memory type so free the pages */ |
| 753 | 744 | ||
| 754 | r = page_count-1; | ||
| 755 | list_for_each_entry_safe(p, tmp, pages, lru) { | 745 | list_for_each_entry_safe(p, tmp, pages, lru) { |
| 756 | if ((flags & TTM_PAGE_FLAG_DMA32) && dma_address) { | 746 | __free_page(p); |
| 757 | void *addr = page_address(p); | ||
| 758 | WARN_ON(!addr || !dma_address[r]); | ||
| 759 | if (addr) | ||
| 760 | dma_free_coherent(NULL, PAGE_SIZE, | ||
| 761 | addr, | ||
| 762 | dma_address[r]); | ||
| 763 | dma_address[r] = 0; | ||
| 764 | } else | ||
| 765 | __free_page(p); | ||
| 766 | r--; | ||
| 767 | } | 747 | } |
| 768 | /* Make the pages list empty */ | 748 | /* Make the pages list empty */ |
| 769 | INIT_LIST_HEAD(pages); | 749 | INIT_LIST_HEAD(pages); |
diff --git a/drivers/gpu/stub/Kconfig b/drivers/gpu/stub/Kconfig index 70e60a4bb678..419917955bf6 100644 --- a/drivers/gpu/stub/Kconfig +++ b/drivers/gpu/stub/Kconfig | |||
| @@ -5,6 +5,7 @@ config STUB_POULSBO | |||
| 5 | # Poulsbo stub depends on ACPI_VIDEO when ACPI is enabled | 5 | # Poulsbo stub depends on ACPI_VIDEO when ACPI is enabled |
| 6 | # but for select to work, need to select ACPI_VIDEO's dependencies, ick | 6 | # but for select to work, need to select ACPI_VIDEO's dependencies, ick |
| 7 | select BACKLIGHT_CLASS_DEVICE if ACPI | 7 | select BACKLIGHT_CLASS_DEVICE if ACPI |
| 8 | select VIDEO_OUTPUT_CONTROL if ACPI | ||
| 8 | select INPUT if ACPI | 9 | select INPUT if ACPI |
| 9 | select ACPI_VIDEO if ACPI | 10 | select ACPI_VIDEO if ACPI |
| 10 | select THERMAL if ACPI | 11 | select THERMAL if ACPI |
diff --git a/drivers/hwmon/pmbus_core.c b/drivers/hwmon/pmbus_core.c index edfb92e41735..196ffafafd88 100644 --- a/drivers/hwmon/pmbus_core.c +++ b/drivers/hwmon/pmbus_core.c | |||
| @@ -139,7 +139,6 @@ struct pmbus_data { | |||
| 139 | * A single status register covers multiple attributes, | 139 | * A single status register covers multiple attributes, |
| 140 | * so we keep them all together. | 140 | * so we keep them all together. |
| 141 | */ | 141 | */ |
| 142 | u8 status_bits; | ||
| 143 | u8 status[PB_NUM_STATUS_REG]; | 142 | u8 status[PB_NUM_STATUS_REG]; |
| 144 | 143 | ||
| 145 | u8 currpage; | 144 | u8 currpage; |
diff --git a/drivers/i2c/algos/i2c-algo-bit.c b/drivers/i2c/algos/i2c-algo-bit.c index 38319a69bd0a..d6d58684712b 100644 --- a/drivers/i2c/algos/i2c-algo-bit.c +++ b/drivers/i2c/algos/i2c-algo-bit.c | |||
| @@ -232,9 +232,17 @@ static int i2c_inb(struct i2c_adapter *i2c_adap) | |||
| 232 | * Sanity check for the adapter hardware - check the reaction of | 232 | * Sanity check for the adapter hardware - check the reaction of |
| 233 | * the bus lines only if it seems to be idle. | 233 | * the bus lines only if it seems to be idle. |
| 234 | */ | 234 | */ |
| 235 | static int test_bus(struct i2c_algo_bit_data *adap, char *name) | 235 | static int test_bus(struct i2c_adapter *i2c_adap) |
| 236 | { | 236 | { |
| 237 | int scl, sda; | 237 | struct i2c_algo_bit_data *adap = i2c_adap->algo_data; |
| 238 | const char *name = i2c_adap->name; | ||
| 239 | int scl, sda, ret; | ||
| 240 | |||
| 241 | if (adap->pre_xfer) { | ||
| 242 | ret = adap->pre_xfer(i2c_adap); | ||
| 243 | if (ret < 0) | ||
| 244 | return -ENODEV; | ||
| 245 | } | ||
| 238 | 246 | ||
| 239 | if (adap->getscl == NULL) | 247 | if (adap->getscl == NULL) |
| 240 | pr_info("%s: Testing SDA only, SCL is not readable\n", name); | 248 | pr_info("%s: Testing SDA only, SCL is not readable\n", name); |
| @@ -297,11 +305,19 @@ static int test_bus(struct i2c_algo_bit_data *adap, char *name) | |||
| 297 | "while pulling SCL high!\n", name); | 305 | "while pulling SCL high!\n", name); |
| 298 | goto bailout; | 306 | goto bailout; |
| 299 | } | 307 | } |
| 308 | |||
| 309 | if (adap->post_xfer) | ||
| 310 | adap->post_xfer(i2c_adap); | ||
| 311 | |||
| 300 | pr_info("%s: Test OK\n", name); | 312 | pr_info("%s: Test OK\n", name); |
| 301 | return 0; | 313 | return 0; |
| 302 | bailout: | 314 | bailout: |
| 303 | sdahi(adap); | 315 | sdahi(adap); |
| 304 | sclhi(adap); | 316 | sclhi(adap); |
| 317 | |||
| 318 | if (adap->post_xfer) | ||
| 319 | adap->post_xfer(i2c_adap); | ||
| 320 | |||
| 305 | return -ENODEV; | 321 | return -ENODEV; |
| 306 | } | 322 | } |
| 307 | 323 | ||
| @@ -607,7 +623,7 @@ static int __i2c_bit_add_bus(struct i2c_adapter *adap, | |||
| 607 | int ret; | 623 | int ret; |
| 608 | 624 | ||
| 609 | if (bit_test) { | 625 | if (bit_test) { |
| 610 | ret = test_bus(bit_adap, adap->name); | 626 | ret = test_bus(adap); |
| 611 | if (ret < 0) | 627 | if (ret < 0) |
| 612 | return -ENODEV; | 628 | return -ENODEV; |
| 613 | } | 629 | } |
diff --git a/drivers/i2c/i2c-core.c b/drivers/i2c/i2c-core.c index 70c30e6bce0b..9a58994ff7ea 100644 --- a/drivers/i2c/i2c-core.c +++ b/drivers/i2c/i2c-core.c | |||
| @@ -797,7 +797,8 @@ static int i2c_do_add_adapter(struct i2c_driver *driver, | |||
| 797 | 797 | ||
| 798 | /* Let legacy drivers scan this bus for matching devices */ | 798 | /* Let legacy drivers scan this bus for matching devices */ |
| 799 | if (driver->attach_adapter) { | 799 | if (driver->attach_adapter) { |
| 800 | dev_warn(&adap->dev, "attach_adapter method is deprecated\n"); | 800 | dev_warn(&adap->dev, "%s: attach_adapter method is deprecated\n", |
| 801 | driver->driver.name); | ||
| 801 | dev_warn(&adap->dev, "Please use another way to instantiate " | 802 | dev_warn(&adap->dev, "Please use another way to instantiate " |
| 802 | "your i2c_client\n"); | 803 | "your i2c_client\n"); |
| 803 | /* We ignore the return code; if it fails, too bad */ | 804 | /* We ignore the return code; if it fails, too bad */ |
| @@ -984,7 +985,8 @@ static int i2c_do_del_adapter(struct i2c_driver *driver, | |||
| 984 | 985 | ||
| 985 | if (!driver->detach_adapter) | 986 | if (!driver->detach_adapter) |
| 986 | return 0; | 987 | return 0; |
| 987 | dev_warn(&adapter->dev, "detach_adapter method is deprecated\n"); | 988 | dev_warn(&adapter->dev, "%s: detach_adapter method is deprecated\n", |
| 989 | driver->driver.name); | ||
| 988 | res = driver->detach_adapter(adapter); | 990 | res = driver->detach_adapter(adapter); |
| 989 | if (res) | 991 | if (res) |
| 990 | dev_err(&adapter->dev, "detach_adapter failed (%d) " | 992 | dev_err(&adapter->dev, "detach_adapter failed (%d) " |
diff --git a/drivers/ide/ide-cd.c b/drivers/ide/ide-cd.c index fd1e11799137..a5ec5a7cb381 100644 --- a/drivers/ide/ide-cd.c +++ b/drivers/ide/ide-cd.c | |||
| @@ -1782,7 +1782,6 @@ static int ide_cd_probe(ide_drive_t *drive) | |||
| 1782 | ide_cd_read_toc(drive, &sense); | 1782 | ide_cd_read_toc(drive, &sense); |
| 1783 | g->fops = &idecd_ops; | 1783 | g->fops = &idecd_ops; |
| 1784 | g->flags |= GENHD_FL_REMOVABLE; | 1784 | g->flags |= GENHD_FL_REMOVABLE; |
| 1785 | g->events = DISK_EVENT_MEDIA_CHANGE; | ||
| 1786 | add_disk(g); | 1785 | add_disk(g); |
| 1787 | return 0; | 1786 | return 0; |
| 1788 | 1787 | ||
diff --git a/drivers/ide/ide-cd_ioctl.c b/drivers/ide/ide-cd_ioctl.c index 2a6bc50e8a41..02caa7dd51c8 100644 --- a/drivers/ide/ide-cd_ioctl.c +++ b/drivers/ide/ide-cd_ioctl.c | |||
| @@ -79,6 +79,12 @@ int ide_cdrom_drive_status(struct cdrom_device_info *cdi, int slot_nr) | |||
| 79 | return CDS_DRIVE_NOT_READY; | 79 | return CDS_DRIVE_NOT_READY; |
| 80 | } | 80 | } |
| 81 | 81 | ||
| 82 | /* | ||
| 83 | * ide-cd always generates media changed event if media is missing, which | ||
| 84 | * makes it impossible to use for proper event reporting, so disk->events | ||
| 85 | * is cleared to 0 and the following function is used only to trigger | ||
| 86 | * revalidation and never propagated to userland. | ||
| 87 | */ | ||
| 82 | unsigned int ide_cdrom_check_events_real(struct cdrom_device_info *cdi, | 88 | unsigned int ide_cdrom_check_events_real(struct cdrom_device_info *cdi, |
| 83 | unsigned int clearing, int slot_nr) | 89 | unsigned int clearing, int slot_nr) |
| 84 | { | 90 | { |
diff --git a/drivers/ide/ide-gd.c b/drivers/ide/ide-gd.c index c4ffd4888939..70ea8763567d 100644 --- a/drivers/ide/ide-gd.c +++ b/drivers/ide/ide-gd.c | |||
| @@ -298,6 +298,12 @@ static unsigned int ide_gd_check_events(struct gendisk *disk, | |||
| 298 | return 0; | 298 | return 0; |
| 299 | } | 299 | } |
| 300 | 300 | ||
| 301 | /* | ||
| 302 | * The following is used to force revalidation on the first open on | ||
| 303 | * removeable devices, and never gets reported to userland as | ||
| 304 | * genhd->events is 0. This is intended as removeable ide disk | ||
| 305 | * can't really detect MEDIA_CHANGE events. | ||
| 306 | */ | ||
| 301 | ret = drive->dev_flags & IDE_DFLAG_MEDIA_CHANGED; | 307 | ret = drive->dev_flags & IDE_DFLAG_MEDIA_CHANGED; |
| 302 | drive->dev_flags &= ~IDE_DFLAG_MEDIA_CHANGED; | 308 | drive->dev_flags &= ~IDE_DFLAG_MEDIA_CHANGED; |
| 303 | 309 | ||
| @@ -413,7 +419,6 @@ static int ide_gd_probe(ide_drive_t *drive) | |||
| 413 | if (drive->dev_flags & IDE_DFLAG_REMOVABLE) | 419 | if (drive->dev_flags & IDE_DFLAG_REMOVABLE) |
| 414 | g->flags = GENHD_FL_REMOVABLE; | 420 | g->flags = GENHD_FL_REMOVABLE; |
| 415 | g->fops = &ide_gd_ops; | 421 | g->fops = &ide_gd_ops; |
| 416 | g->events = DISK_EVENT_MEDIA_CHANGE; | ||
| 417 | add_disk(g); | 422 | add_disk(g); |
| 418 | return 0; | 423 | return 0; |
| 419 | 424 | ||
diff --git a/drivers/input/evdev.c b/drivers/input/evdev.c index 7f42d3a454d2..88d8e4cb419a 100644 --- a/drivers/input/evdev.c +++ b/drivers/input/evdev.c | |||
| @@ -39,13 +39,13 @@ struct evdev { | |||
| 39 | }; | 39 | }; |
| 40 | 40 | ||
| 41 | struct evdev_client { | 41 | struct evdev_client { |
| 42 | int head; | 42 | unsigned int head; |
| 43 | int tail; | 43 | unsigned int tail; |
| 44 | spinlock_t buffer_lock; /* protects access to buffer, head and tail */ | 44 | spinlock_t buffer_lock; /* protects access to buffer, head and tail */ |
| 45 | struct fasync_struct *fasync; | 45 | struct fasync_struct *fasync; |
| 46 | struct evdev *evdev; | 46 | struct evdev *evdev; |
| 47 | struct list_head node; | 47 | struct list_head node; |
| 48 | int bufsize; | 48 | unsigned int bufsize; |
| 49 | struct input_event buffer[]; | 49 | struct input_event buffer[]; |
| 50 | }; | 50 | }; |
| 51 | 51 | ||
| @@ -55,16 +55,25 @@ static DEFINE_MUTEX(evdev_table_mutex); | |||
| 55 | static void evdev_pass_event(struct evdev_client *client, | 55 | static void evdev_pass_event(struct evdev_client *client, |
| 56 | struct input_event *event) | 56 | struct input_event *event) |
| 57 | { | 57 | { |
| 58 | /* | 58 | /* Interrupts are disabled, just acquire the lock. */ |
| 59 | * Interrupts are disabled, just acquire the lock. | ||
| 60 | * Make sure we don't leave with the client buffer | ||
| 61 | * "empty" by having client->head == client->tail. | ||
| 62 | */ | ||
| 63 | spin_lock(&client->buffer_lock); | 59 | spin_lock(&client->buffer_lock); |
| 64 | do { | 60 | |
| 65 | client->buffer[client->head++] = *event; | 61 | client->buffer[client->head++] = *event; |
| 66 | client->head &= client->bufsize - 1; | 62 | client->head &= client->bufsize - 1; |
| 67 | } while (client->head == client->tail); | 63 | |
| 64 | if (unlikely(client->head == client->tail)) { | ||
| 65 | /* | ||
| 66 | * This effectively "drops" all unconsumed events, leaving | ||
| 67 | * EV_SYN/SYN_DROPPED plus the newest event in the queue. | ||
| 68 | */ | ||
| 69 | client->tail = (client->head - 2) & (client->bufsize - 1); | ||
| 70 | |||
| 71 | client->buffer[client->tail].time = event->time; | ||
| 72 | client->buffer[client->tail].type = EV_SYN; | ||
| 73 | client->buffer[client->tail].code = SYN_DROPPED; | ||
| 74 | client->buffer[client->tail].value = 0; | ||
| 75 | } | ||
| 76 | |||
| 68 | spin_unlock(&client->buffer_lock); | 77 | spin_unlock(&client->buffer_lock); |
| 69 | 78 | ||
| 70 | if (event->type == EV_SYN) | 79 | if (event->type == EV_SYN) |
diff --git a/drivers/input/input.c b/drivers/input/input.c index d6e8bd8a851c..ebbceedc92f4 100644 --- a/drivers/input/input.c +++ b/drivers/input/input.c | |||
| @@ -1746,6 +1746,42 @@ void input_set_capability(struct input_dev *dev, unsigned int type, unsigned int | |||
| 1746 | } | 1746 | } |
| 1747 | EXPORT_SYMBOL(input_set_capability); | 1747 | EXPORT_SYMBOL(input_set_capability); |
| 1748 | 1748 | ||
| 1749 | static unsigned int input_estimate_events_per_packet(struct input_dev *dev) | ||
| 1750 | { | ||
| 1751 | int mt_slots; | ||
| 1752 | int i; | ||
| 1753 | unsigned int events; | ||
| 1754 | |||
| 1755 | if (dev->mtsize) { | ||
| 1756 | mt_slots = dev->mtsize; | ||
| 1757 | } else if (test_bit(ABS_MT_TRACKING_ID, dev->absbit)) { | ||
| 1758 | mt_slots = dev->absinfo[ABS_MT_TRACKING_ID].maximum - | ||
| 1759 | dev->absinfo[ABS_MT_TRACKING_ID].minimum + 1, | ||
| 1760 | clamp(mt_slots, 2, 32); | ||
| 1761 | } else if (test_bit(ABS_MT_POSITION_X, dev->absbit)) { | ||
| 1762 | mt_slots = 2; | ||
| 1763 | } else { | ||
| 1764 | mt_slots = 0; | ||
| 1765 | } | ||
| 1766 | |||
| 1767 | events = mt_slots + 1; /* count SYN_MT_REPORT and SYN_REPORT */ | ||
| 1768 | |||
| 1769 | for (i = 0; i < ABS_CNT; i++) { | ||
| 1770 | if (test_bit(i, dev->absbit)) { | ||
| 1771 | if (input_is_mt_axis(i)) | ||
| 1772 | events += mt_slots; | ||
| 1773 | else | ||
| 1774 | events++; | ||
| 1775 | } | ||
| 1776 | } | ||
| 1777 | |||
| 1778 | for (i = 0; i < REL_CNT; i++) | ||
| 1779 | if (test_bit(i, dev->relbit)) | ||
| 1780 | events++; | ||
| 1781 | |||
| 1782 | return events; | ||
| 1783 | } | ||
| 1784 | |||
| 1749 | #define INPUT_CLEANSE_BITMASK(dev, type, bits) \ | 1785 | #define INPUT_CLEANSE_BITMASK(dev, type, bits) \ |
| 1750 | do { \ | 1786 | do { \ |
| 1751 | if (!test_bit(EV_##type, dev->evbit)) \ | 1787 | if (!test_bit(EV_##type, dev->evbit)) \ |
| @@ -1793,6 +1829,10 @@ int input_register_device(struct input_dev *dev) | |||
| 1793 | /* Make sure that bitmasks not mentioned in dev->evbit are clean. */ | 1829 | /* Make sure that bitmasks not mentioned in dev->evbit are clean. */ |
| 1794 | input_cleanse_bitmasks(dev); | 1830 | input_cleanse_bitmasks(dev); |
| 1795 | 1831 | ||
| 1832 | if (!dev->hint_events_per_packet) | ||
| 1833 | dev->hint_events_per_packet = | ||
| 1834 | input_estimate_events_per_packet(dev); | ||
| 1835 | |||
| 1796 | /* | 1836 | /* |
| 1797 | * If delay and period are pre-set by the driver, then autorepeating | 1837 | * If delay and period are pre-set by the driver, then autorepeating |
| 1798 | * is handled by the driver itself and we don't do it in input.c. | 1838 | * is handled by the driver itself and we don't do it in input.c. |
diff --git a/drivers/input/keyboard/twl4030_keypad.c b/drivers/input/keyboard/twl4030_keypad.c index 09bef79d9da1..a26922cf0e84 100644 --- a/drivers/input/keyboard/twl4030_keypad.c +++ b/drivers/input/keyboard/twl4030_keypad.c | |||
| @@ -332,18 +332,20 @@ static int __devinit twl4030_kp_program(struct twl4030_keypad *kp) | |||
| 332 | static int __devinit twl4030_kp_probe(struct platform_device *pdev) | 332 | static int __devinit twl4030_kp_probe(struct platform_device *pdev) |
| 333 | { | 333 | { |
| 334 | struct twl4030_keypad_data *pdata = pdev->dev.platform_data; | 334 | struct twl4030_keypad_data *pdata = pdev->dev.platform_data; |
| 335 | const struct matrix_keymap_data *keymap_data = pdata->keymap_data; | 335 | const struct matrix_keymap_data *keymap_data; |
| 336 | struct twl4030_keypad *kp; | 336 | struct twl4030_keypad *kp; |
| 337 | struct input_dev *input; | 337 | struct input_dev *input; |
| 338 | u8 reg; | 338 | u8 reg; |
| 339 | int error; | 339 | int error; |
| 340 | 340 | ||
| 341 | if (!pdata || !pdata->rows || !pdata->cols || | 341 | if (!pdata || !pdata->rows || !pdata->cols || !pdata->keymap_data || |
| 342 | pdata->rows > TWL4030_MAX_ROWS || pdata->cols > TWL4030_MAX_COLS) { | 342 | pdata->rows > TWL4030_MAX_ROWS || pdata->cols > TWL4030_MAX_COLS) { |
| 343 | dev_err(&pdev->dev, "Invalid platform_data\n"); | 343 | dev_err(&pdev->dev, "Invalid platform_data\n"); |
| 344 | return -EINVAL; | 344 | return -EINVAL; |
| 345 | } | 345 | } |
| 346 | 346 | ||
| 347 | keymap_data = pdata->keymap_data; | ||
| 348 | |||
| 347 | kp = kzalloc(sizeof(*kp), GFP_KERNEL); | 349 | kp = kzalloc(sizeof(*kp), GFP_KERNEL); |
| 348 | input = input_allocate_device(); | 350 | input = input_allocate_device(); |
| 349 | if (!kp || !input) { | 351 | if (!kp || !input) { |
diff --git a/drivers/input/misc/xen-kbdfront.c b/drivers/input/misc/xen-kbdfront.c index 7077f9bf5ead..62bae99424e6 100644 --- a/drivers/input/misc/xen-kbdfront.c +++ b/drivers/input/misc/xen-kbdfront.c | |||
| @@ -303,7 +303,7 @@ static void xenkbd_backend_changed(struct xenbus_device *dev, | |||
| 303 | enum xenbus_state backend_state) | 303 | enum xenbus_state backend_state) |
| 304 | { | 304 | { |
| 305 | struct xenkbd_info *info = dev_get_drvdata(&dev->dev); | 305 | struct xenkbd_info *info = dev_get_drvdata(&dev->dev); |
| 306 | int val; | 306 | int ret, val; |
| 307 | 307 | ||
| 308 | switch (backend_state) { | 308 | switch (backend_state) { |
| 309 | case XenbusStateInitialising: | 309 | case XenbusStateInitialising: |
| @@ -316,6 +316,17 @@ static void xenkbd_backend_changed(struct xenbus_device *dev, | |||
| 316 | 316 | ||
| 317 | case XenbusStateInitWait: | 317 | case XenbusStateInitWait: |
| 318 | InitWait: | 318 | InitWait: |
| 319 | ret = xenbus_scanf(XBT_NIL, info->xbdev->otherend, | ||
| 320 | "feature-abs-pointer", "%d", &val); | ||
| 321 | if (ret < 0) | ||
| 322 | val = 0; | ||
| 323 | if (val) { | ||
| 324 | ret = xenbus_printf(XBT_NIL, info->xbdev->nodename, | ||
| 325 | "request-abs-pointer", "1"); | ||
| 326 | if (ret) | ||
| 327 | pr_warning("xenkbd: can't request abs-pointer"); | ||
| 328 | } | ||
| 329 | |||
| 319 | xenbus_switch_state(dev, XenbusStateConnected); | 330 | xenbus_switch_state(dev, XenbusStateConnected); |
| 320 | break; | 331 | break; |
| 321 | 332 | ||
diff --git a/drivers/input/touchscreen/h3600_ts_input.c b/drivers/input/touchscreen/h3600_ts_input.c index efa06882de00..45f93d0f5592 100644 --- a/drivers/input/touchscreen/h3600_ts_input.c +++ b/drivers/input/touchscreen/h3600_ts_input.c | |||
| @@ -399,31 +399,34 @@ static int h3600ts_connect(struct serio *serio, struct serio_driver *drv) | |||
| 399 | IRQF_SHARED | IRQF_DISABLED, "h3600_action", &ts->dev)) { | 399 | IRQF_SHARED | IRQF_DISABLED, "h3600_action", &ts->dev)) { |
| 400 | printk(KERN_ERR "h3600ts.c: Could not allocate Action Button IRQ!\n"); | 400 | printk(KERN_ERR "h3600ts.c: Could not allocate Action Button IRQ!\n"); |
| 401 | err = -EBUSY; | 401 | err = -EBUSY; |
| 402 | goto fail2; | 402 | goto fail1; |
| 403 | } | 403 | } |
| 404 | 404 | ||
| 405 | if (request_irq(IRQ_GPIO_BITSY_NPOWER_BUTTON, npower_button_handler, | 405 | if (request_irq(IRQ_GPIO_BITSY_NPOWER_BUTTON, npower_button_handler, |
| 406 | IRQF_SHARED | IRQF_DISABLED, "h3600_suspend", &ts->dev)) { | 406 | IRQF_SHARED | IRQF_DISABLED, "h3600_suspend", &ts->dev)) { |
| 407 | printk(KERN_ERR "h3600ts.c: Could not allocate Power Button IRQ!\n"); | 407 | printk(KERN_ERR "h3600ts.c: Could not allocate Power Button IRQ!\n"); |
| 408 | err = -EBUSY; | 408 | err = -EBUSY; |
| 409 | goto fail3; | 409 | goto fail2; |
| 410 | } | 410 | } |
| 411 | 411 | ||
| 412 | serio_set_drvdata(serio, ts); | 412 | serio_set_drvdata(serio, ts); |
| 413 | 413 | ||
| 414 | err = serio_open(serio, drv); | 414 | err = serio_open(serio, drv); |
| 415 | if (err) | 415 | if (err) |
| 416 | return err; | 416 | goto fail3; |
| 417 | 417 | ||
| 418 | //h3600_flite_control(1, 25); /* default brightness */ | 418 | //h3600_flite_control(1, 25); /* default brightness */ |
| 419 | input_register_device(ts->dev); | 419 | err = input_register_device(ts->dev); |
| 420 | if (err) | ||
| 421 | goto fail4; | ||
| 420 | 422 | ||
| 421 | return 0; | 423 | return 0; |
| 422 | 424 | ||
| 423 | fail3: free_irq(IRQ_GPIO_BITSY_NPOWER_BUTTON, ts->dev); | 425 | fail4: serio_close(serio); |
| 426 | fail3: serio_set_drvdata(serio, NULL); | ||
| 427 | free_irq(IRQ_GPIO_BITSY_NPOWER_BUTTON, ts->dev); | ||
| 424 | fail2: free_irq(IRQ_GPIO_BITSY_ACTION_BUTTON, ts->dev); | 428 | fail2: free_irq(IRQ_GPIO_BITSY_ACTION_BUTTON, ts->dev); |
| 425 | fail1: serio_set_drvdata(serio, NULL); | 429 | fail1: input_free_device(input_dev); |
| 426 | input_free_device(input_dev); | ||
| 427 | kfree(ts); | 430 | kfree(ts); |
| 428 | return err; | 431 | return err; |
| 429 | } | 432 | } |
diff --git a/drivers/leds/leds-regulator.c b/drivers/leds/leds-regulator.c index 3790816643be..8497f56f8e46 100644 --- a/drivers/leds/leds-regulator.c +++ b/drivers/leds/leds-regulator.c | |||
| @@ -178,6 +178,10 @@ static int __devinit regulator_led_probe(struct platform_device *pdev) | |||
| 178 | led->cdev.flags |= LED_CORE_SUSPENDRESUME; | 178 | led->cdev.flags |= LED_CORE_SUSPENDRESUME; |
| 179 | led->vcc = vcc; | 179 | led->vcc = vcc; |
| 180 | 180 | ||
| 181 | /* to handle correctly an already enabled regulator */ | ||
| 182 | if (regulator_is_enabled(led->vcc)) | ||
| 183 | led->enabled = 1; | ||
| 184 | |||
| 181 | mutex_init(&led->mutex); | 185 | mutex_init(&led->mutex); |
| 182 | INIT_WORK(&led->work, led_work); | 186 | INIT_WORK(&led->work, led_work); |
| 183 | 187 | ||
diff --git a/drivers/md/dm-raid.c b/drivers/md/dm-raid.c index 5ef136cdba91..e5d8904fc8f6 100644 --- a/drivers/md/dm-raid.c +++ b/drivers/md/dm-raid.c | |||
| @@ -390,13 +390,6 @@ static int raid_is_congested(struct dm_target_callbacks *cb, int bits) | |||
| 390 | return md_raid5_congested(&rs->md, bits); | 390 | return md_raid5_congested(&rs->md, bits); |
| 391 | } | 391 | } |
| 392 | 392 | ||
| 393 | static void raid_unplug(struct dm_target_callbacks *cb) | ||
| 394 | { | ||
| 395 | struct raid_set *rs = container_of(cb, struct raid_set, callbacks); | ||
| 396 | |||
| 397 | md_raid5_kick_device(rs->md.private); | ||
| 398 | } | ||
| 399 | |||
| 400 | /* | 393 | /* |
| 401 | * Construct a RAID4/5/6 mapping: | 394 | * Construct a RAID4/5/6 mapping: |
| 402 | * Args: | 395 | * Args: |
| @@ -487,7 +480,6 @@ static int raid_ctr(struct dm_target *ti, unsigned argc, char **argv) | |||
| 487 | } | 480 | } |
| 488 | 481 | ||
| 489 | rs->callbacks.congested_fn = raid_is_congested; | 482 | rs->callbacks.congested_fn = raid_is_congested; |
| 490 | rs->callbacks.unplug_fn = raid_unplug; | ||
| 491 | dm_table_add_target_callbacks(ti->table, &rs->callbacks); | 483 | dm_table_add_target_callbacks(ti->table, &rs->callbacks); |
| 492 | 484 | ||
| 493 | return 0; | 485 | return 0; |
diff --git a/drivers/md/md.c b/drivers/md/md.c index b12b3776c0c0..7d6f7f18a920 100644 --- a/drivers/md/md.c +++ b/drivers/md/md.c | |||
| @@ -447,48 +447,59 @@ EXPORT_SYMBOL(md_flush_request); | |||
| 447 | 447 | ||
| 448 | /* Support for plugging. | 448 | /* Support for plugging. |
| 449 | * This mirrors the plugging support in request_queue, but does not | 449 | * This mirrors the plugging support in request_queue, but does not |
| 450 | * require having a whole queue | 450 | * require having a whole queue or request structures. |
| 451 | * We allocate an md_plug_cb for each md device and each thread it gets | ||
| 452 | * plugged on. This links tot the private plug_handle structure in the | ||
| 453 | * personality data where we keep a count of the number of outstanding | ||
| 454 | * plugs so other code can see if a plug is active. | ||
| 451 | */ | 455 | */ |
| 452 | static void plugger_work(struct work_struct *work) | 456 | struct md_plug_cb { |
| 453 | { | 457 | struct blk_plug_cb cb; |
| 454 | struct plug_handle *plug = | 458 | mddev_t *mddev; |
| 455 | container_of(work, struct plug_handle, unplug_work); | 459 | }; |
| 456 | plug->unplug_fn(plug); | ||
| 457 | } | ||
| 458 | static void plugger_timeout(unsigned long data) | ||
| 459 | { | ||
| 460 | struct plug_handle *plug = (void *)data; | ||
| 461 | kblockd_schedule_work(NULL, &plug->unplug_work); | ||
| 462 | } | ||
| 463 | void plugger_init(struct plug_handle *plug, | ||
| 464 | void (*unplug_fn)(struct plug_handle *)) | ||
| 465 | { | ||
| 466 | plug->unplug_flag = 0; | ||
| 467 | plug->unplug_fn = unplug_fn; | ||
| 468 | init_timer(&plug->unplug_timer); | ||
| 469 | plug->unplug_timer.function = plugger_timeout; | ||
| 470 | plug->unplug_timer.data = (unsigned long)plug; | ||
| 471 | INIT_WORK(&plug->unplug_work, plugger_work); | ||
| 472 | } | ||
| 473 | EXPORT_SYMBOL_GPL(plugger_init); | ||
| 474 | 460 | ||
| 475 | void plugger_set_plug(struct plug_handle *plug) | 461 | static void plugger_unplug(struct blk_plug_cb *cb) |
| 476 | { | 462 | { |
| 477 | if (!test_and_set_bit(PLUGGED_FLAG, &plug->unplug_flag)) | 463 | struct md_plug_cb *mdcb = container_of(cb, struct md_plug_cb, cb); |
| 478 | mod_timer(&plug->unplug_timer, jiffies + msecs_to_jiffies(3)+1); | 464 | if (atomic_dec_and_test(&mdcb->mddev->plug_cnt)) |
| 465 | md_wakeup_thread(mdcb->mddev->thread); | ||
| 466 | kfree(mdcb); | ||
| 479 | } | 467 | } |
| 480 | EXPORT_SYMBOL_GPL(plugger_set_plug); | ||
| 481 | 468 | ||
| 482 | int plugger_remove_plug(struct plug_handle *plug) | 469 | /* Check that an unplug wakeup will come shortly. |
| 470 | * If not, wakeup the md thread immediately | ||
| 471 | */ | ||
| 472 | int mddev_check_plugged(mddev_t *mddev) | ||
| 483 | { | 473 | { |
| 484 | if (test_and_clear_bit(PLUGGED_FLAG, &plug->unplug_flag)) { | 474 | struct blk_plug *plug = current->plug; |
| 485 | del_timer(&plug->unplug_timer); | 475 | struct md_plug_cb *mdcb; |
| 486 | return 1; | 476 | |
| 487 | } else | 477 | if (!plug) |
| 488 | return 0; | 478 | return 0; |
| 489 | } | ||
| 490 | EXPORT_SYMBOL_GPL(plugger_remove_plug); | ||
| 491 | 479 | ||
| 480 | list_for_each_entry(mdcb, &plug->cb_list, cb.list) { | ||
| 481 | if (mdcb->cb.callback == plugger_unplug && | ||
| 482 | mdcb->mddev == mddev) { | ||
| 483 | /* Already on the list, move to top */ | ||
| 484 | if (mdcb != list_first_entry(&plug->cb_list, | ||
| 485 | struct md_plug_cb, | ||
| 486 | cb.list)) | ||
| 487 | list_move(&mdcb->cb.list, &plug->cb_list); | ||
| 488 | return 1; | ||
| 489 | } | ||
| 490 | } | ||
| 491 | /* Not currently on the callback list */ | ||
| 492 | mdcb = kmalloc(sizeof(*mdcb), GFP_ATOMIC); | ||
| 493 | if (!mdcb) | ||
| 494 | return 0; | ||
| 495 | |||
| 496 | mdcb->mddev = mddev; | ||
| 497 | mdcb->cb.callback = plugger_unplug; | ||
| 498 | atomic_inc(&mddev->plug_cnt); | ||
| 499 | list_add(&mdcb->cb.list, &plug->cb_list); | ||
| 500 | return 1; | ||
| 501 | } | ||
| 502 | EXPORT_SYMBOL_GPL(mddev_check_plugged); | ||
| 492 | 503 | ||
| 493 | static inline mddev_t *mddev_get(mddev_t *mddev) | 504 | static inline mddev_t *mddev_get(mddev_t *mddev) |
| 494 | { | 505 | { |
| @@ -538,6 +549,7 @@ void mddev_init(mddev_t *mddev) | |||
| 538 | atomic_set(&mddev->active, 1); | 549 | atomic_set(&mddev->active, 1); |
| 539 | atomic_set(&mddev->openers, 0); | 550 | atomic_set(&mddev->openers, 0); |
| 540 | atomic_set(&mddev->active_io, 0); | 551 | atomic_set(&mddev->active_io, 0); |
| 552 | atomic_set(&mddev->plug_cnt, 0); | ||
| 541 | spin_lock_init(&mddev->write_lock); | 553 | spin_lock_init(&mddev->write_lock); |
| 542 | atomic_set(&mddev->flush_pending, 0); | 554 | atomic_set(&mddev->flush_pending, 0); |
| 543 | init_waitqueue_head(&mddev->sb_wait); | 555 | init_waitqueue_head(&mddev->sb_wait); |
| @@ -3158,6 +3170,7 @@ level_store(mddev_t *mddev, const char *buf, size_t len) | |||
| 3158 | mddev->layout = mddev->new_layout; | 3170 | mddev->layout = mddev->new_layout; |
| 3159 | mddev->chunk_sectors = mddev->new_chunk_sectors; | 3171 | mddev->chunk_sectors = mddev->new_chunk_sectors; |
| 3160 | mddev->delta_disks = 0; | 3172 | mddev->delta_disks = 0; |
| 3173 | mddev->degraded = 0; | ||
| 3161 | if (mddev->pers->sync_request == NULL) { | 3174 | if (mddev->pers->sync_request == NULL) { |
| 3162 | /* this is now an array without redundancy, so | 3175 | /* this is now an array without redundancy, so |
| 3163 | * it must always be in_sync | 3176 | * it must always be in_sync |
| @@ -4723,7 +4736,6 @@ static void md_clean(mddev_t *mddev) | |||
| 4723 | mddev->bitmap_info.chunksize = 0; | 4736 | mddev->bitmap_info.chunksize = 0; |
| 4724 | mddev->bitmap_info.daemon_sleep = 0; | 4737 | mddev->bitmap_info.daemon_sleep = 0; |
| 4725 | mddev->bitmap_info.max_write_behind = 0; | 4738 | mddev->bitmap_info.max_write_behind = 0; |
| 4726 | mddev->plug = NULL; | ||
| 4727 | } | 4739 | } |
| 4728 | 4740 | ||
| 4729 | static void __md_stop_writes(mddev_t *mddev) | 4741 | static void __md_stop_writes(mddev_t *mddev) |
| @@ -6688,12 +6700,6 @@ int md_allow_write(mddev_t *mddev) | |||
| 6688 | } | 6700 | } |
| 6689 | EXPORT_SYMBOL_GPL(md_allow_write); | 6701 | EXPORT_SYMBOL_GPL(md_allow_write); |
| 6690 | 6702 | ||
| 6691 | void md_unplug(mddev_t *mddev) | ||
| 6692 | { | ||
| 6693 | if (mddev->plug) | ||
| 6694 | mddev->plug->unplug_fn(mddev->plug); | ||
| 6695 | } | ||
| 6696 | |||
| 6697 | #define SYNC_MARKS 10 | 6703 | #define SYNC_MARKS 10 |
| 6698 | #define SYNC_MARK_STEP (3*HZ) | 6704 | #define SYNC_MARK_STEP (3*HZ) |
| 6699 | void md_do_sync(mddev_t *mddev) | 6705 | void md_do_sync(mddev_t *mddev) |
diff --git a/drivers/md/md.h b/drivers/md/md.h index 52b407369e13..0b1fd3f1d85b 100644 --- a/drivers/md/md.h +++ b/drivers/md/md.h | |||
| @@ -29,26 +29,6 @@ | |||
| 29 | typedef struct mddev_s mddev_t; | 29 | typedef struct mddev_s mddev_t; |
| 30 | typedef struct mdk_rdev_s mdk_rdev_t; | 30 | typedef struct mdk_rdev_s mdk_rdev_t; |
| 31 | 31 | ||
| 32 | /* generic plugging support - like that provided with request_queue, | ||
| 33 | * but does not require a request_queue | ||
| 34 | */ | ||
| 35 | struct plug_handle { | ||
| 36 | void (*unplug_fn)(struct plug_handle *); | ||
| 37 | struct timer_list unplug_timer; | ||
| 38 | struct work_struct unplug_work; | ||
| 39 | unsigned long unplug_flag; | ||
| 40 | }; | ||
| 41 | #define PLUGGED_FLAG 1 | ||
| 42 | void plugger_init(struct plug_handle *plug, | ||
| 43 | void (*unplug_fn)(struct plug_handle *)); | ||
| 44 | void plugger_set_plug(struct plug_handle *plug); | ||
| 45 | int plugger_remove_plug(struct plug_handle *plug); | ||
| 46 | static inline void plugger_flush(struct plug_handle *plug) | ||
| 47 | { | ||
| 48 | del_timer_sync(&plug->unplug_timer); | ||
| 49 | cancel_work_sync(&plug->unplug_work); | ||
| 50 | } | ||
| 51 | |||
| 52 | /* | 32 | /* |
| 53 | * MD's 'extended' device | 33 | * MD's 'extended' device |
| 54 | */ | 34 | */ |
| @@ -199,6 +179,9 @@ struct mddev_s | |||
| 199 | int delta_disks, new_level, new_layout; | 179 | int delta_disks, new_level, new_layout; |
| 200 | int new_chunk_sectors; | 180 | int new_chunk_sectors; |
| 201 | 181 | ||
| 182 | atomic_t plug_cnt; /* If device is expecting | ||
| 183 | * more bios soon. | ||
| 184 | */ | ||
| 202 | struct mdk_thread_s *thread; /* management thread */ | 185 | struct mdk_thread_s *thread; /* management thread */ |
| 203 | struct mdk_thread_s *sync_thread; /* doing resync or reconstruct */ | 186 | struct mdk_thread_s *sync_thread; /* doing resync or reconstruct */ |
| 204 | sector_t curr_resync; /* last block scheduled */ | 187 | sector_t curr_resync; /* last block scheduled */ |
| @@ -336,7 +319,6 @@ struct mddev_s | |||
| 336 | struct list_head all_mddevs; | 319 | struct list_head all_mddevs; |
| 337 | 320 | ||
| 338 | struct attribute_group *to_remove; | 321 | struct attribute_group *to_remove; |
| 339 | struct plug_handle *plug; /* if used by personality */ | ||
| 340 | 322 | ||
| 341 | struct bio_set *bio_set; | 323 | struct bio_set *bio_set; |
| 342 | 324 | ||
| @@ -516,7 +498,6 @@ extern int md_integrity_register(mddev_t *mddev); | |||
| 516 | extern void md_integrity_add_rdev(mdk_rdev_t *rdev, mddev_t *mddev); | 498 | extern void md_integrity_add_rdev(mdk_rdev_t *rdev, mddev_t *mddev); |
| 517 | extern int strict_strtoul_scaled(const char *cp, unsigned long *res, int scale); | 499 | extern int strict_strtoul_scaled(const char *cp, unsigned long *res, int scale); |
| 518 | extern void restore_bitmap_write_access(struct file *file); | 500 | extern void restore_bitmap_write_access(struct file *file); |
| 519 | extern void md_unplug(mddev_t *mddev); | ||
| 520 | 501 | ||
| 521 | extern void mddev_init(mddev_t *mddev); | 502 | extern void mddev_init(mddev_t *mddev); |
| 522 | extern int md_run(mddev_t *mddev); | 503 | extern int md_run(mddev_t *mddev); |
| @@ -530,4 +511,5 @@ extern struct bio *bio_clone_mddev(struct bio *bio, gfp_t gfp_mask, | |||
| 530 | mddev_t *mddev); | 511 | mddev_t *mddev); |
| 531 | extern struct bio *bio_alloc_mddev(gfp_t gfp_mask, int nr_iovecs, | 512 | extern struct bio *bio_alloc_mddev(gfp_t gfp_mask, int nr_iovecs, |
| 532 | mddev_t *mddev); | 513 | mddev_t *mddev); |
| 514 | extern int mddev_check_plugged(mddev_t *mddev); | ||
| 533 | #endif /* _MD_MD_H */ | 515 | #endif /* _MD_MD_H */ |
diff --git a/drivers/md/raid1.c b/drivers/md/raid1.c index c2a21ae56d97..2b7a7ff401dc 100644 --- a/drivers/md/raid1.c +++ b/drivers/md/raid1.c | |||
| @@ -565,12 +565,6 @@ static void flush_pending_writes(conf_t *conf) | |||
| 565 | spin_unlock_irq(&conf->device_lock); | 565 | spin_unlock_irq(&conf->device_lock); |
| 566 | } | 566 | } |
| 567 | 567 | ||
| 568 | static void md_kick_device(mddev_t *mddev) | ||
| 569 | { | ||
| 570 | blk_flush_plug(current); | ||
| 571 | md_wakeup_thread(mddev->thread); | ||
| 572 | } | ||
| 573 | |||
| 574 | /* Barriers.... | 568 | /* Barriers.... |
| 575 | * Sometimes we need to suspend IO while we do something else, | 569 | * Sometimes we need to suspend IO while we do something else, |
| 576 | * either some resync/recovery, or reconfigure the array. | 570 | * either some resync/recovery, or reconfigure the array. |
| @@ -600,7 +594,7 @@ static void raise_barrier(conf_t *conf) | |||
| 600 | 594 | ||
| 601 | /* Wait until no block IO is waiting */ | 595 | /* Wait until no block IO is waiting */ |
| 602 | wait_event_lock_irq(conf->wait_barrier, !conf->nr_waiting, | 596 | wait_event_lock_irq(conf->wait_barrier, !conf->nr_waiting, |
| 603 | conf->resync_lock, md_kick_device(conf->mddev)); | 597 | conf->resync_lock, ); |
| 604 | 598 | ||
| 605 | /* block any new IO from starting */ | 599 | /* block any new IO from starting */ |
| 606 | conf->barrier++; | 600 | conf->barrier++; |
| @@ -608,7 +602,7 @@ static void raise_barrier(conf_t *conf) | |||
| 608 | /* Now wait for all pending IO to complete */ | 602 | /* Now wait for all pending IO to complete */ |
| 609 | wait_event_lock_irq(conf->wait_barrier, | 603 | wait_event_lock_irq(conf->wait_barrier, |
| 610 | !conf->nr_pending && conf->barrier < RESYNC_DEPTH, | 604 | !conf->nr_pending && conf->barrier < RESYNC_DEPTH, |
| 611 | conf->resync_lock, md_kick_device(conf->mddev)); | 605 | conf->resync_lock, ); |
| 612 | 606 | ||
| 613 | spin_unlock_irq(&conf->resync_lock); | 607 | spin_unlock_irq(&conf->resync_lock); |
| 614 | } | 608 | } |
| @@ -630,7 +624,7 @@ static void wait_barrier(conf_t *conf) | |||
| 630 | conf->nr_waiting++; | 624 | conf->nr_waiting++; |
| 631 | wait_event_lock_irq(conf->wait_barrier, !conf->barrier, | 625 | wait_event_lock_irq(conf->wait_barrier, !conf->barrier, |
| 632 | conf->resync_lock, | 626 | conf->resync_lock, |
| 633 | md_kick_device(conf->mddev)); | 627 | ); |
| 634 | conf->nr_waiting--; | 628 | conf->nr_waiting--; |
| 635 | } | 629 | } |
| 636 | conf->nr_pending++; | 630 | conf->nr_pending++; |
| @@ -666,8 +660,7 @@ static void freeze_array(conf_t *conf) | |||
| 666 | wait_event_lock_irq(conf->wait_barrier, | 660 | wait_event_lock_irq(conf->wait_barrier, |
| 667 | conf->nr_pending == conf->nr_queued+1, | 661 | conf->nr_pending == conf->nr_queued+1, |
| 668 | conf->resync_lock, | 662 | conf->resync_lock, |
| 669 | ({ flush_pending_writes(conf); | 663 | flush_pending_writes(conf)); |
| 670 | md_kick_device(conf->mddev); })); | ||
| 671 | spin_unlock_irq(&conf->resync_lock); | 664 | spin_unlock_irq(&conf->resync_lock); |
| 672 | } | 665 | } |
| 673 | static void unfreeze_array(conf_t *conf) | 666 | static void unfreeze_array(conf_t *conf) |
| @@ -729,6 +722,7 @@ static int make_request(mddev_t *mddev, struct bio * bio) | |||
| 729 | const unsigned long do_sync = (bio->bi_rw & REQ_SYNC); | 722 | const unsigned long do_sync = (bio->bi_rw & REQ_SYNC); |
| 730 | const unsigned long do_flush_fua = (bio->bi_rw & (REQ_FLUSH | REQ_FUA)); | 723 | const unsigned long do_flush_fua = (bio->bi_rw & (REQ_FLUSH | REQ_FUA)); |
| 731 | mdk_rdev_t *blocked_rdev; | 724 | mdk_rdev_t *blocked_rdev; |
| 725 | int plugged; | ||
| 732 | 726 | ||
| 733 | /* | 727 | /* |
| 734 | * Register the new request and wait if the reconstruction | 728 | * Register the new request and wait if the reconstruction |
| @@ -820,6 +814,8 @@ static int make_request(mddev_t *mddev, struct bio * bio) | |||
| 820 | * inc refcount on their rdev. Record them by setting | 814 | * inc refcount on their rdev. Record them by setting |
| 821 | * bios[x] to bio | 815 | * bios[x] to bio |
| 822 | */ | 816 | */ |
| 817 | plugged = mddev_check_plugged(mddev); | ||
| 818 | |||
| 823 | disks = conf->raid_disks; | 819 | disks = conf->raid_disks; |
| 824 | retry_write: | 820 | retry_write: |
| 825 | blocked_rdev = NULL; | 821 | blocked_rdev = NULL; |
| @@ -925,7 +921,7 @@ static int make_request(mddev_t *mddev, struct bio * bio) | |||
| 925 | /* In case raid1d snuck in to freeze_array */ | 921 | /* In case raid1d snuck in to freeze_array */ |
| 926 | wake_up(&conf->wait_barrier); | 922 | wake_up(&conf->wait_barrier); |
| 927 | 923 | ||
| 928 | if (do_sync || !bitmap) | 924 | if (do_sync || !bitmap || !plugged) |
| 929 | md_wakeup_thread(mddev->thread); | 925 | md_wakeup_thread(mddev->thread); |
| 930 | 926 | ||
| 931 | return 0; | 927 | return 0; |
| @@ -1516,13 +1512,16 @@ static void raid1d(mddev_t *mddev) | |||
| 1516 | conf_t *conf = mddev->private; | 1512 | conf_t *conf = mddev->private; |
| 1517 | struct list_head *head = &conf->retry_list; | 1513 | struct list_head *head = &conf->retry_list; |
| 1518 | mdk_rdev_t *rdev; | 1514 | mdk_rdev_t *rdev; |
| 1515 | struct blk_plug plug; | ||
| 1519 | 1516 | ||
| 1520 | md_check_recovery(mddev); | 1517 | md_check_recovery(mddev); |
| 1521 | 1518 | ||
| 1519 | blk_start_plug(&plug); | ||
| 1522 | for (;;) { | 1520 | for (;;) { |
| 1523 | char b[BDEVNAME_SIZE]; | 1521 | char b[BDEVNAME_SIZE]; |
| 1524 | 1522 | ||
| 1525 | flush_pending_writes(conf); | 1523 | if (atomic_read(&mddev->plug_cnt) == 0) |
| 1524 | flush_pending_writes(conf); | ||
| 1526 | 1525 | ||
| 1527 | spin_lock_irqsave(&conf->device_lock, flags); | 1526 | spin_lock_irqsave(&conf->device_lock, flags); |
| 1528 | if (list_empty(head)) { | 1527 | if (list_empty(head)) { |
| @@ -1593,6 +1592,7 @@ static void raid1d(mddev_t *mddev) | |||
| 1593 | } | 1592 | } |
| 1594 | cond_resched(); | 1593 | cond_resched(); |
| 1595 | } | 1594 | } |
| 1595 | blk_finish_plug(&plug); | ||
| 1596 | } | 1596 | } |
| 1597 | 1597 | ||
| 1598 | 1598 | ||
| @@ -2039,7 +2039,6 @@ static int stop(mddev_t *mddev) | |||
| 2039 | 2039 | ||
| 2040 | md_unregister_thread(mddev->thread); | 2040 | md_unregister_thread(mddev->thread); |
| 2041 | mddev->thread = NULL; | 2041 | mddev->thread = NULL; |
| 2042 | blk_sync_queue(mddev->queue); /* the unplug fn references 'conf'*/ | ||
| 2043 | if (conf->r1bio_pool) | 2042 | if (conf->r1bio_pool) |
| 2044 | mempool_destroy(conf->r1bio_pool); | 2043 | mempool_destroy(conf->r1bio_pool); |
| 2045 | kfree(conf->mirrors); | 2044 | kfree(conf->mirrors); |
diff --git a/drivers/md/raid10.c b/drivers/md/raid10.c index 2da83d566592..8e9462626ec5 100644 --- a/drivers/md/raid10.c +++ b/drivers/md/raid10.c | |||
| @@ -634,12 +634,6 @@ static void flush_pending_writes(conf_t *conf) | |||
| 634 | spin_unlock_irq(&conf->device_lock); | 634 | spin_unlock_irq(&conf->device_lock); |
| 635 | } | 635 | } |
| 636 | 636 | ||
| 637 | static void md_kick_device(mddev_t *mddev) | ||
| 638 | { | ||
| 639 | blk_flush_plug(current); | ||
| 640 | md_wakeup_thread(mddev->thread); | ||
| 641 | } | ||
| 642 | |||
| 643 | /* Barriers.... | 637 | /* Barriers.... |
| 644 | * Sometimes we need to suspend IO while we do something else, | 638 | * Sometimes we need to suspend IO while we do something else, |
| 645 | * either some resync/recovery, or reconfigure the array. | 639 | * either some resync/recovery, or reconfigure the array. |
| @@ -669,15 +663,15 @@ static void raise_barrier(conf_t *conf, int force) | |||
| 669 | 663 | ||
| 670 | /* Wait until no block IO is waiting (unless 'force') */ | 664 | /* Wait until no block IO is waiting (unless 'force') */ |
| 671 | wait_event_lock_irq(conf->wait_barrier, force || !conf->nr_waiting, | 665 | wait_event_lock_irq(conf->wait_barrier, force || !conf->nr_waiting, |
| 672 | conf->resync_lock, md_kick_device(conf->mddev)); | 666 | conf->resync_lock, ); |
| 673 | 667 | ||
| 674 | /* block any new IO from starting */ | 668 | /* block any new IO from starting */ |
| 675 | conf->barrier++; | 669 | conf->barrier++; |
| 676 | 670 | ||
| 677 | /* No wait for all pending IO to complete */ | 671 | /* Now wait for all pending IO to complete */ |
| 678 | wait_event_lock_irq(conf->wait_barrier, | 672 | wait_event_lock_irq(conf->wait_barrier, |
| 679 | !conf->nr_pending && conf->barrier < RESYNC_DEPTH, | 673 | !conf->nr_pending && conf->barrier < RESYNC_DEPTH, |
| 680 | conf->resync_lock, md_kick_device(conf->mddev)); | 674 | conf->resync_lock, ); |
| 681 | 675 | ||
| 682 | spin_unlock_irq(&conf->resync_lock); | 676 | spin_unlock_irq(&conf->resync_lock); |
| 683 | } | 677 | } |
| @@ -698,7 +692,7 @@ static void wait_barrier(conf_t *conf) | |||
| 698 | conf->nr_waiting++; | 692 | conf->nr_waiting++; |
| 699 | wait_event_lock_irq(conf->wait_barrier, !conf->barrier, | 693 | wait_event_lock_irq(conf->wait_barrier, !conf->barrier, |
| 700 | conf->resync_lock, | 694 | conf->resync_lock, |
| 701 | md_kick_device(conf->mddev)); | 695 | ); |
| 702 | conf->nr_waiting--; | 696 | conf->nr_waiting--; |
| 703 | } | 697 | } |
| 704 | conf->nr_pending++; | 698 | conf->nr_pending++; |
| @@ -734,8 +728,8 @@ static void freeze_array(conf_t *conf) | |||
| 734 | wait_event_lock_irq(conf->wait_barrier, | 728 | wait_event_lock_irq(conf->wait_barrier, |
| 735 | conf->nr_pending == conf->nr_queued+1, | 729 | conf->nr_pending == conf->nr_queued+1, |
| 736 | conf->resync_lock, | 730 | conf->resync_lock, |
| 737 | ({ flush_pending_writes(conf); | 731 | flush_pending_writes(conf)); |
| 738 | md_kick_device(conf->mddev); })); | 732 | |
| 739 | spin_unlock_irq(&conf->resync_lock); | 733 | spin_unlock_irq(&conf->resync_lock); |
| 740 | } | 734 | } |
| 741 | 735 | ||
| @@ -762,6 +756,7 @@ static int make_request(mddev_t *mddev, struct bio * bio) | |||
| 762 | const unsigned long do_fua = (bio->bi_rw & REQ_FUA); | 756 | const unsigned long do_fua = (bio->bi_rw & REQ_FUA); |
| 763 | unsigned long flags; | 757 | unsigned long flags; |
| 764 | mdk_rdev_t *blocked_rdev; | 758 | mdk_rdev_t *blocked_rdev; |
| 759 | int plugged; | ||
| 765 | 760 | ||
| 766 | if (unlikely(bio->bi_rw & REQ_FLUSH)) { | 761 | if (unlikely(bio->bi_rw & REQ_FLUSH)) { |
| 767 | md_flush_request(mddev, bio); | 762 | md_flush_request(mddev, bio); |
| @@ -870,6 +865,8 @@ static int make_request(mddev_t *mddev, struct bio * bio) | |||
| 870 | * inc refcount on their rdev. Record them by setting | 865 | * inc refcount on their rdev. Record them by setting |
| 871 | * bios[x] to bio | 866 | * bios[x] to bio |
| 872 | */ | 867 | */ |
| 868 | plugged = mddev_check_plugged(mddev); | ||
| 869 | |||
| 873 | raid10_find_phys(conf, r10_bio); | 870 | raid10_find_phys(conf, r10_bio); |
| 874 | retry_write: | 871 | retry_write: |
| 875 | blocked_rdev = NULL; | 872 | blocked_rdev = NULL; |
| @@ -946,9 +943,8 @@ static int make_request(mddev_t *mddev, struct bio * bio) | |||
| 946 | /* In case raid10d snuck in to freeze_array */ | 943 | /* In case raid10d snuck in to freeze_array */ |
| 947 | wake_up(&conf->wait_barrier); | 944 | wake_up(&conf->wait_barrier); |
| 948 | 945 | ||
| 949 | if (do_sync || !mddev->bitmap) | 946 | if (do_sync || !mddev->bitmap || !plugged) |
| 950 | md_wakeup_thread(mddev->thread); | 947 | md_wakeup_thread(mddev->thread); |
| 951 | |||
| 952 | return 0; | 948 | return 0; |
| 953 | } | 949 | } |
| 954 | 950 | ||
| @@ -1640,9 +1636,11 @@ static void raid10d(mddev_t *mddev) | |||
| 1640 | conf_t *conf = mddev->private; | 1636 | conf_t *conf = mddev->private; |
| 1641 | struct list_head *head = &conf->retry_list; | 1637 | struct list_head *head = &conf->retry_list; |
| 1642 | mdk_rdev_t *rdev; | 1638 | mdk_rdev_t *rdev; |
| 1639 | struct blk_plug plug; | ||
| 1643 | 1640 | ||
| 1644 | md_check_recovery(mddev); | 1641 | md_check_recovery(mddev); |
| 1645 | 1642 | ||
| 1643 | blk_start_plug(&plug); | ||
| 1646 | for (;;) { | 1644 | for (;;) { |
| 1647 | char b[BDEVNAME_SIZE]; | 1645 | char b[BDEVNAME_SIZE]; |
| 1648 | 1646 | ||
| @@ -1716,6 +1714,7 @@ static void raid10d(mddev_t *mddev) | |||
| 1716 | } | 1714 | } |
| 1717 | cond_resched(); | 1715 | cond_resched(); |
| 1718 | } | 1716 | } |
| 1717 | blk_finish_plug(&plug); | ||
| 1719 | } | 1718 | } |
| 1720 | 1719 | ||
| 1721 | 1720 | ||
diff --git a/drivers/md/raid5.c b/drivers/md/raid5.c index e867ee42b152..49bf5f891435 100644 --- a/drivers/md/raid5.c +++ b/drivers/md/raid5.c | |||
| @@ -27,12 +27,12 @@ | |||
| 27 | * | 27 | * |
| 28 | * We group bitmap updates into batches. Each batch has a number. | 28 | * We group bitmap updates into batches. Each batch has a number. |
| 29 | * We may write out several batches at once, but that isn't very important. | 29 | * We may write out several batches at once, but that isn't very important. |
| 30 | * conf->bm_write is the number of the last batch successfully written. | 30 | * conf->seq_write is the number of the last batch successfully written. |
| 31 | * conf->bm_flush is the number of the last batch that was closed to | 31 | * conf->seq_flush is the number of the last batch that was closed to |
| 32 | * new additions. | 32 | * new additions. |
| 33 | * When we discover that we will need to write to any block in a stripe | 33 | * When we discover that we will need to write to any block in a stripe |
| 34 | * (in add_stripe_bio) we update the in-memory bitmap and record in sh->bm_seq | 34 | * (in add_stripe_bio) we update the in-memory bitmap and record in sh->bm_seq |
| 35 | * the number of the batch it will be in. This is bm_flush+1. | 35 | * the number of the batch it will be in. This is seq_flush+1. |
| 36 | * When we are ready to do a write, if that batch hasn't been written yet, | 36 | * When we are ready to do a write, if that batch hasn't been written yet, |
| 37 | * we plug the array and queue the stripe for later. | 37 | * we plug the array and queue the stripe for later. |
| 38 | * When an unplug happens, we increment bm_flush, thus closing the current | 38 | * When an unplug happens, we increment bm_flush, thus closing the current |
| @@ -199,14 +199,12 @@ static void __release_stripe(raid5_conf_t *conf, struct stripe_head *sh) | |||
| 199 | BUG_ON(!list_empty(&sh->lru)); | 199 | BUG_ON(!list_empty(&sh->lru)); |
| 200 | BUG_ON(atomic_read(&conf->active_stripes)==0); | 200 | BUG_ON(atomic_read(&conf->active_stripes)==0); |
| 201 | if (test_bit(STRIPE_HANDLE, &sh->state)) { | 201 | if (test_bit(STRIPE_HANDLE, &sh->state)) { |
| 202 | if (test_bit(STRIPE_DELAYED, &sh->state)) { | 202 | if (test_bit(STRIPE_DELAYED, &sh->state)) |
| 203 | list_add_tail(&sh->lru, &conf->delayed_list); | 203 | list_add_tail(&sh->lru, &conf->delayed_list); |
| 204 | plugger_set_plug(&conf->plug); | 204 | else if (test_bit(STRIPE_BIT_DELAY, &sh->state) && |
| 205 | } else if (test_bit(STRIPE_BIT_DELAY, &sh->state) && | 205 | sh->bm_seq - conf->seq_write > 0) |
| 206 | sh->bm_seq - conf->seq_write > 0) { | ||
| 207 | list_add_tail(&sh->lru, &conf->bitmap_list); | 206 | list_add_tail(&sh->lru, &conf->bitmap_list); |
| 208 | plugger_set_plug(&conf->plug); | 207 | else { |
| 209 | } else { | ||
| 210 | clear_bit(STRIPE_BIT_DELAY, &sh->state); | 208 | clear_bit(STRIPE_BIT_DELAY, &sh->state); |
| 211 | list_add_tail(&sh->lru, &conf->handle_list); | 209 | list_add_tail(&sh->lru, &conf->handle_list); |
| 212 | } | 210 | } |
| @@ -461,7 +459,7 @@ get_active_stripe(raid5_conf_t *conf, sector_t sector, | |||
| 461 | < (conf->max_nr_stripes *3/4) | 459 | < (conf->max_nr_stripes *3/4) |
| 462 | || !conf->inactive_blocked), | 460 | || !conf->inactive_blocked), |
| 463 | conf->device_lock, | 461 | conf->device_lock, |
| 464 | md_raid5_kick_device(conf)); | 462 | ); |
| 465 | conf->inactive_blocked = 0; | 463 | conf->inactive_blocked = 0; |
| 466 | } else | 464 | } else |
| 467 | init_stripe(sh, sector, previous); | 465 | init_stripe(sh, sector, previous); |
| @@ -1470,7 +1468,7 @@ static int resize_stripes(raid5_conf_t *conf, int newsize) | |||
| 1470 | wait_event_lock_irq(conf->wait_for_stripe, | 1468 | wait_event_lock_irq(conf->wait_for_stripe, |
| 1471 | !list_empty(&conf->inactive_list), | 1469 | !list_empty(&conf->inactive_list), |
| 1472 | conf->device_lock, | 1470 | conf->device_lock, |
| 1473 | blk_flush_plug(current)); | 1471 | ); |
| 1474 | osh = get_free_stripe(conf); | 1472 | osh = get_free_stripe(conf); |
| 1475 | spin_unlock_irq(&conf->device_lock); | 1473 | spin_unlock_irq(&conf->device_lock); |
| 1476 | atomic_set(&nsh->count, 1); | 1474 | atomic_set(&nsh->count, 1); |
| @@ -3623,8 +3621,7 @@ static void raid5_activate_delayed(raid5_conf_t *conf) | |||
| 3623 | atomic_inc(&conf->preread_active_stripes); | 3621 | atomic_inc(&conf->preread_active_stripes); |
| 3624 | list_add_tail(&sh->lru, &conf->hold_list); | 3622 | list_add_tail(&sh->lru, &conf->hold_list); |
| 3625 | } | 3623 | } |
| 3626 | } else | 3624 | } |
| 3627 | plugger_set_plug(&conf->plug); | ||
| 3628 | } | 3625 | } |
| 3629 | 3626 | ||
| 3630 | static void activate_bit_delay(raid5_conf_t *conf) | 3627 | static void activate_bit_delay(raid5_conf_t *conf) |
| @@ -3641,21 +3638,6 @@ static void activate_bit_delay(raid5_conf_t *conf) | |||
| 3641 | } | 3638 | } |
| 3642 | } | 3639 | } |
| 3643 | 3640 | ||
| 3644 | void md_raid5_kick_device(raid5_conf_t *conf) | ||
| 3645 | { | ||
| 3646 | blk_flush_plug(current); | ||
| 3647 | raid5_activate_delayed(conf); | ||
| 3648 | md_wakeup_thread(conf->mddev->thread); | ||
| 3649 | } | ||
| 3650 | EXPORT_SYMBOL_GPL(md_raid5_kick_device); | ||
| 3651 | |||
| 3652 | static void raid5_unplug(struct plug_handle *plug) | ||
| 3653 | { | ||
| 3654 | raid5_conf_t *conf = container_of(plug, raid5_conf_t, plug); | ||
| 3655 | |||
| 3656 | md_raid5_kick_device(conf); | ||
| 3657 | } | ||
| 3658 | |||
| 3659 | int md_raid5_congested(mddev_t *mddev, int bits) | 3641 | int md_raid5_congested(mddev_t *mddev, int bits) |
| 3660 | { | 3642 | { |
| 3661 | raid5_conf_t *conf = mddev->private; | 3643 | raid5_conf_t *conf = mddev->private; |
| @@ -3945,6 +3927,7 @@ static int make_request(mddev_t *mddev, struct bio * bi) | |||
| 3945 | struct stripe_head *sh; | 3927 | struct stripe_head *sh; |
| 3946 | const int rw = bio_data_dir(bi); | 3928 | const int rw = bio_data_dir(bi); |
| 3947 | int remaining; | 3929 | int remaining; |
| 3930 | int plugged; | ||
| 3948 | 3931 | ||
| 3949 | if (unlikely(bi->bi_rw & REQ_FLUSH)) { | 3932 | if (unlikely(bi->bi_rw & REQ_FLUSH)) { |
| 3950 | md_flush_request(mddev, bi); | 3933 | md_flush_request(mddev, bi); |
| @@ -3963,6 +3946,7 @@ static int make_request(mddev_t *mddev, struct bio * bi) | |||
| 3963 | bi->bi_next = NULL; | 3946 | bi->bi_next = NULL; |
| 3964 | bi->bi_phys_segments = 1; /* over-loaded to count active stripes */ | 3947 | bi->bi_phys_segments = 1; /* over-loaded to count active stripes */ |
| 3965 | 3948 | ||
| 3949 | plugged = mddev_check_plugged(mddev); | ||
| 3966 | for (;logical_sector < last_sector; logical_sector += STRIPE_SECTORS) { | 3950 | for (;logical_sector < last_sector; logical_sector += STRIPE_SECTORS) { |
| 3967 | DEFINE_WAIT(w); | 3951 | DEFINE_WAIT(w); |
| 3968 | int disks, data_disks; | 3952 | int disks, data_disks; |
| @@ -4057,7 +4041,7 @@ static int make_request(mddev_t *mddev, struct bio * bi) | |||
| 4057 | * add failed due to overlap. Flush everything | 4041 | * add failed due to overlap. Flush everything |
| 4058 | * and wait a while | 4042 | * and wait a while |
| 4059 | */ | 4043 | */ |
| 4060 | md_raid5_kick_device(conf); | 4044 | md_wakeup_thread(mddev->thread); |
| 4061 | release_stripe(sh); | 4045 | release_stripe(sh); |
| 4062 | schedule(); | 4046 | schedule(); |
| 4063 | goto retry; | 4047 | goto retry; |
| @@ -4077,6 +4061,9 @@ static int make_request(mddev_t *mddev, struct bio * bi) | |||
| 4077 | } | 4061 | } |
| 4078 | 4062 | ||
| 4079 | } | 4063 | } |
| 4064 | if (!plugged) | ||
| 4065 | md_wakeup_thread(mddev->thread); | ||
| 4066 | |||
| 4080 | spin_lock_irq(&conf->device_lock); | 4067 | spin_lock_irq(&conf->device_lock); |
| 4081 | remaining = raid5_dec_bi_phys_segments(bi); | 4068 | remaining = raid5_dec_bi_phys_segments(bi); |
| 4082 | spin_unlock_irq(&conf->device_lock); | 4069 | spin_unlock_irq(&conf->device_lock); |
| @@ -4478,24 +4465,30 @@ static void raid5d(mddev_t *mddev) | |||
| 4478 | struct stripe_head *sh; | 4465 | struct stripe_head *sh; |
| 4479 | raid5_conf_t *conf = mddev->private; | 4466 | raid5_conf_t *conf = mddev->private; |
| 4480 | int handled; | 4467 | int handled; |
| 4468 | struct blk_plug plug; | ||
| 4481 | 4469 | ||
| 4482 | pr_debug("+++ raid5d active\n"); | 4470 | pr_debug("+++ raid5d active\n"); |
| 4483 | 4471 | ||
| 4484 | md_check_recovery(mddev); | 4472 | md_check_recovery(mddev); |
| 4485 | 4473 | ||
| 4474 | blk_start_plug(&plug); | ||
| 4486 | handled = 0; | 4475 | handled = 0; |
| 4487 | spin_lock_irq(&conf->device_lock); | 4476 | spin_lock_irq(&conf->device_lock); |
| 4488 | while (1) { | 4477 | while (1) { |
| 4489 | struct bio *bio; | 4478 | struct bio *bio; |
| 4490 | 4479 | ||
| 4491 | if (conf->seq_flush != conf->seq_write) { | 4480 | if (atomic_read(&mddev->plug_cnt) == 0 && |
| 4492 | int seq = conf->seq_flush; | 4481 | !list_empty(&conf->bitmap_list)) { |
| 4482 | /* Now is a good time to flush some bitmap updates */ | ||
| 4483 | conf->seq_flush++; | ||
| 4493 | spin_unlock_irq(&conf->device_lock); | 4484 | spin_unlock_irq(&conf->device_lock); |
| 4494 | bitmap_unplug(mddev->bitmap); | 4485 | bitmap_unplug(mddev->bitmap); |
| 4495 | spin_lock_irq(&conf->device_lock); | 4486 | spin_lock_irq(&conf->device_lock); |
| 4496 | conf->seq_write = seq; | 4487 | conf->seq_write = conf->seq_flush; |
| 4497 | activate_bit_delay(conf); | 4488 | activate_bit_delay(conf); |
| 4498 | } | 4489 | } |
| 4490 | if (atomic_read(&mddev->plug_cnt) == 0) | ||
| 4491 | raid5_activate_delayed(conf); | ||
| 4499 | 4492 | ||
| 4500 | while ((bio = remove_bio_from_retry(conf))) { | 4493 | while ((bio = remove_bio_from_retry(conf))) { |
| 4501 | int ok; | 4494 | int ok; |
| @@ -4525,6 +4518,7 @@ static void raid5d(mddev_t *mddev) | |||
| 4525 | spin_unlock_irq(&conf->device_lock); | 4518 | spin_unlock_irq(&conf->device_lock); |
| 4526 | 4519 | ||
| 4527 | async_tx_issue_pending_all(); | 4520 | async_tx_issue_pending_all(); |
| 4521 | blk_finish_plug(&plug); | ||
| 4528 | 4522 | ||
| 4529 | pr_debug("--- raid5d inactive\n"); | 4523 | pr_debug("--- raid5d inactive\n"); |
| 4530 | } | 4524 | } |
| @@ -5141,8 +5135,6 @@ static int run(mddev_t *mddev) | |||
| 5141 | mdname(mddev)); | 5135 | mdname(mddev)); |
| 5142 | md_set_array_sectors(mddev, raid5_size(mddev, 0, 0)); | 5136 | md_set_array_sectors(mddev, raid5_size(mddev, 0, 0)); |
| 5143 | 5137 | ||
| 5144 | plugger_init(&conf->plug, raid5_unplug); | ||
| 5145 | mddev->plug = &conf->plug; | ||
| 5146 | if (mddev->queue) { | 5138 | if (mddev->queue) { |
| 5147 | int chunk_size; | 5139 | int chunk_size; |
| 5148 | /* read-ahead size must cover two whole stripes, which | 5140 | /* read-ahead size must cover two whole stripes, which |
| @@ -5159,7 +5151,6 @@ static int run(mddev_t *mddev) | |||
| 5159 | 5151 | ||
| 5160 | mddev->queue->backing_dev_info.congested_data = mddev; | 5152 | mddev->queue->backing_dev_info.congested_data = mddev; |
| 5161 | mddev->queue->backing_dev_info.congested_fn = raid5_congested; | 5153 | mddev->queue->backing_dev_info.congested_fn = raid5_congested; |
| 5162 | mddev->queue->queue_lock = &conf->device_lock; | ||
| 5163 | 5154 | ||
| 5164 | chunk_size = mddev->chunk_sectors << 9; | 5155 | chunk_size = mddev->chunk_sectors << 9; |
| 5165 | blk_queue_io_min(mddev->queue, chunk_size); | 5156 | blk_queue_io_min(mddev->queue, chunk_size); |
| @@ -5192,7 +5183,6 @@ static int stop(mddev_t *mddev) | |||
| 5192 | mddev->thread = NULL; | 5183 | mddev->thread = NULL; |
| 5193 | if (mddev->queue) | 5184 | if (mddev->queue) |
| 5194 | mddev->queue->backing_dev_info.congested_fn = NULL; | 5185 | mddev->queue->backing_dev_info.congested_fn = NULL; |
| 5195 | plugger_flush(&conf->plug); /* the unplug fn references 'conf'*/ | ||
| 5196 | free_conf(conf); | 5186 | free_conf(conf); |
| 5197 | mddev->private = NULL; | 5187 | mddev->private = NULL; |
| 5198 | mddev->to_remove = &raid5_attrs_group; | 5188 | mddev->to_remove = &raid5_attrs_group; |
| @@ -5688,6 +5678,7 @@ static void raid5_quiesce(mddev_t *mddev, int state) | |||
| 5688 | static void *raid45_takeover_raid0(mddev_t *mddev, int level) | 5678 | static void *raid45_takeover_raid0(mddev_t *mddev, int level) |
| 5689 | { | 5679 | { |
| 5690 | struct raid0_private_data *raid0_priv = mddev->private; | 5680 | struct raid0_private_data *raid0_priv = mddev->private; |
| 5681 | sector_t sectors; | ||
| 5691 | 5682 | ||
| 5692 | /* for raid0 takeover only one zone is supported */ | 5683 | /* for raid0 takeover only one zone is supported */ |
| 5693 | if (raid0_priv->nr_strip_zones > 1) { | 5684 | if (raid0_priv->nr_strip_zones > 1) { |
| @@ -5696,6 +5687,9 @@ static void *raid45_takeover_raid0(mddev_t *mddev, int level) | |||
| 5696 | return ERR_PTR(-EINVAL); | 5687 | return ERR_PTR(-EINVAL); |
| 5697 | } | 5688 | } |
| 5698 | 5689 | ||
| 5690 | sectors = raid0_priv->strip_zone[0].zone_end; | ||
| 5691 | sector_div(sectors, raid0_priv->strip_zone[0].nb_dev); | ||
| 5692 | mddev->dev_sectors = sectors; | ||
| 5699 | mddev->new_level = level; | 5693 | mddev->new_level = level; |
| 5700 | mddev->new_layout = ALGORITHM_PARITY_N; | 5694 | mddev->new_layout = ALGORITHM_PARITY_N; |
| 5701 | mddev->new_chunk_sectors = mddev->chunk_sectors; | 5695 | mddev->new_chunk_sectors = mddev->chunk_sectors; |
diff --git a/drivers/md/raid5.h b/drivers/md/raid5.h index 8d563a4f022a..3ca77a2613ba 100644 --- a/drivers/md/raid5.h +++ b/drivers/md/raid5.h | |||
| @@ -400,8 +400,6 @@ struct raid5_private_data { | |||
| 400 | * Cleared when a sync completes. | 400 | * Cleared when a sync completes. |
| 401 | */ | 401 | */ |
| 402 | 402 | ||
| 403 | struct plug_handle plug; | ||
| 404 | |||
| 405 | /* per cpu variables */ | 403 | /* per cpu variables */ |
| 406 | struct raid5_percpu { | 404 | struct raid5_percpu { |
| 407 | struct page *spare_page; /* Used when checking P/Q in raid6 */ | 405 | struct page *spare_page; /* Used when checking P/Q in raid6 */ |
diff --git a/drivers/media/video/videobuf-dma-contig.c b/drivers/media/video/videobuf-dma-contig.c index c4742fc15529..c9691115f2d2 100644 --- a/drivers/media/video/videobuf-dma-contig.c +++ b/drivers/media/video/videobuf-dma-contig.c | |||
| @@ -300,7 +300,7 @@ static int __videobuf_mmap_mapper(struct videobuf_queue *q, | |||
| 300 | 300 | ||
| 301 | vma->vm_page_prot = pgprot_noncached(vma->vm_page_prot); | 301 | vma->vm_page_prot = pgprot_noncached(vma->vm_page_prot); |
| 302 | retval = remap_pfn_range(vma, vma->vm_start, | 302 | retval = remap_pfn_range(vma, vma->vm_start, |
| 303 | PFN_DOWN(virt_to_phys(mem->vaddr)), | 303 | mem->dma_handle >> PAGE_SHIFT, |
| 304 | size, vma->vm_page_prot); | 304 | size, vma->vm_page_prot); |
| 305 | if (retval) { | 305 | if (retval) { |
| 306 | dev_err(q->dev, "mmap: remap failed with error %d. ", retval); | 306 | dev_err(q->dev, "mmap: remap failed with error %d. ", retval); |
diff --git a/drivers/mfd/mfd-core.c b/drivers/mfd/mfd-core.c index d01574d98870..f4c8c844b913 100644 --- a/drivers/mfd/mfd-core.c +++ b/drivers/mfd/mfd-core.c | |||
| @@ -55,6 +55,19 @@ int mfd_cell_disable(struct platform_device *pdev) | |||
| 55 | } | 55 | } |
| 56 | EXPORT_SYMBOL(mfd_cell_disable); | 56 | EXPORT_SYMBOL(mfd_cell_disable); |
| 57 | 57 | ||
| 58 | static int mfd_platform_add_cell(struct platform_device *pdev, | ||
| 59 | const struct mfd_cell *cell) | ||
| 60 | { | ||
| 61 | if (!cell) | ||
| 62 | return 0; | ||
| 63 | |||
| 64 | pdev->mfd_cell = kmemdup(cell, sizeof(*cell), GFP_KERNEL); | ||
| 65 | if (!pdev->mfd_cell) | ||
| 66 | return -ENOMEM; | ||
| 67 | |||
| 68 | return 0; | ||
| 69 | } | ||
| 70 | |||
| 58 | static int mfd_add_device(struct device *parent, int id, | 71 | static int mfd_add_device(struct device *parent, int id, |
| 59 | const struct mfd_cell *cell, | 72 | const struct mfd_cell *cell, |
| 60 | struct resource *mem_base, | 73 | struct resource *mem_base, |
| @@ -75,7 +88,7 @@ static int mfd_add_device(struct device *parent, int id, | |||
| 75 | 88 | ||
| 76 | pdev->dev.parent = parent; | 89 | pdev->dev.parent = parent; |
| 77 | 90 | ||
| 78 | ret = platform_device_add_data(pdev, cell, sizeof(*cell)); | 91 | ret = mfd_platform_add_cell(pdev, cell); |
| 79 | if (ret) | 92 | if (ret) |
| 80 | goto fail_res; | 93 | goto fail_res; |
| 81 | 94 | ||
| @@ -123,7 +136,6 @@ static int mfd_add_device(struct device *parent, int id, | |||
| 123 | 136 | ||
| 124 | return 0; | 137 | return 0; |
| 125 | 138 | ||
| 126 | /* platform_device_del(pdev); */ | ||
| 127 | fail_res: | 139 | fail_res: |
| 128 | kfree(res); | 140 | kfree(res); |
| 129 | fail_device: | 141 | fail_device: |
diff --git a/drivers/misc/sgi-gru/grufile.c b/drivers/misc/sgi-gru/grufile.c index 20e4e9395b61..ecafa4ba238b 100644 --- a/drivers/misc/sgi-gru/grufile.c +++ b/drivers/misc/sgi-gru/grufile.c | |||
| @@ -348,15 +348,15 @@ static unsigned long gru_chiplet_cpu_to_mmr(int chiplet, int cpu, int *corep) | |||
| 348 | 348 | ||
| 349 | static int gru_irq_count[GRU_CHIPLETS_PER_BLADE]; | 349 | static int gru_irq_count[GRU_CHIPLETS_PER_BLADE]; |
| 350 | 350 | ||
| 351 | static void gru_noop(unsigned int irq) | 351 | static void gru_noop(struct irq_data *d) |
| 352 | { | 352 | { |
| 353 | } | 353 | } |
| 354 | 354 | ||
| 355 | static struct irq_chip gru_chip[GRU_CHIPLETS_PER_BLADE] = { | 355 | static struct irq_chip gru_chip[GRU_CHIPLETS_PER_BLADE] = { |
| 356 | [0 ... GRU_CHIPLETS_PER_BLADE - 1] { | 356 | [0 ... GRU_CHIPLETS_PER_BLADE - 1] { |
| 357 | .mask = gru_noop, | 357 | .irq_mask = gru_noop, |
| 358 | .unmask = gru_noop, | 358 | .irq_unmask = gru_noop, |
| 359 | .ack = gru_noop | 359 | .irq_ack = gru_noop |
| 360 | } | 360 | } |
| 361 | }; | 361 | }; |
| 362 | 362 | ||
diff --git a/drivers/mtd/mtdswap.c b/drivers/mtd/mtdswap.c index 237913c5c92c..fed215c4cfa1 100644 --- a/drivers/mtd/mtdswap.c +++ b/drivers/mtd/mtdswap.c | |||
| @@ -1452,7 +1452,7 @@ static void mtdswap_add_mtd(struct mtd_blktrans_ops *tr, struct mtd_info *mtd) | |||
| 1452 | oinfo = mtd->ecclayout; | 1452 | oinfo = mtd->ecclayout; |
| 1453 | if (!mtd->oobsize || !oinfo || oinfo->oobavail < MTDSWAP_OOBSIZE) { | 1453 | if (!mtd->oobsize || !oinfo || oinfo->oobavail < MTDSWAP_OOBSIZE) { |
| 1454 | printk(KERN_ERR "%s: Not enough free bytes in OOB, " | 1454 | printk(KERN_ERR "%s: Not enough free bytes in OOB, " |
| 1455 | "%d available, %lu needed.\n", | 1455 | "%d available, %zu needed.\n", |
| 1456 | MTDSWAP_PREFIX, oinfo->oobavail, MTDSWAP_OOBSIZE); | 1456 | MTDSWAP_PREFIX, oinfo->oobavail, MTDSWAP_OOBSIZE); |
| 1457 | return; | 1457 | return; |
| 1458 | } | 1458 | } |
diff --git a/drivers/mtd/nand/atmel_nand.c b/drivers/mtd/nand/atmel_nand.c index 6fae04b3fc6d..950646aa4c4b 100644 --- a/drivers/mtd/nand/atmel_nand.c +++ b/drivers/mtd/nand/atmel_nand.c | |||
| @@ -209,22 +209,8 @@ static int atmel_nand_dma_op(struct mtd_info *mtd, void *buf, int len, | |||
| 209 | int err = -EIO; | 209 | int err = -EIO; |
| 210 | enum dma_data_direction dir = is_read ? DMA_FROM_DEVICE : DMA_TO_DEVICE; | 210 | enum dma_data_direction dir = is_read ? DMA_FROM_DEVICE : DMA_TO_DEVICE; |
| 211 | 211 | ||
| 212 | if (buf >= high_memory) { | 212 | if (buf >= high_memory) |
| 213 | struct page *pg; | 213 | goto err_buf; |
| 214 | |||
| 215 | if (((size_t)buf & PAGE_MASK) != | ||
| 216 | ((size_t)(buf + len - 1) & PAGE_MASK)) { | ||
| 217 | dev_warn(host->dev, "Buffer not fit in one page\n"); | ||
| 218 | goto err_buf; | ||
| 219 | } | ||
| 220 | |||
| 221 | pg = vmalloc_to_page(buf); | ||
| 222 | if (pg == 0) { | ||
| 223 | dev_err(host->dev, "Failed to vmalloc_to_page\n"); | ||
| 224 | goto err_buf; | ||
| 225 | } | ||
| 226 | p = page_address(pg) + ((size_t)buf & ~PAGE_MASK); | ||
| 227 | } | ||
| 228 | 214 | ||
| 229 | dma_dev = host->dma_chan->device; | 215 | dma_dev = host->dma_chan->device; |
| 230 | 216 | ||
| @@ -280,7 +266,8 @@ static void atmel_read_buf(struct mtd_info *mtd, u8 *buf, int len) | |||
| 280 | struct nand_chip *chip = mtd->priv; | 266 | struct nand_chip *chip = mtd->priv; |
| 281 | struct atmel_nand_host *host = chip->priv; | 267 | struct atmel_nand_host *host = chip->priv; |
| 282 | 268 | ||
| 283 | if (use_dma && len >= mtd->oobsize) | 269 | if (use_dma && len > mtd->oobsize) |
| 270 | /* only use DMA for bigger than oob size: better performances */ | ||
| 284 | if (atmel_nand_dma_op(mtd, buf, len, 1) == 0) | 271 | if (atmel_nand_dma_op(mtd, buf, len, 1) == 0) |
| 285 | return; | 272 | return; |
| 286 | 273 | ||
| @@ -295,7 +282,8 @@ static void atmel_write_buf(struct mtd_info *mtd, const u8 *buf, int len) | |||
| 295 | struct nand_chip *chip = mtd->priv; | 282 | struct nand_chip *chip = mtd->priv; |
| 296 | struct atmel_nand_host *host = chip->priv; | 283 | struct atmel_nand_host *host = chip->priv; |
| 297 | 284 | ||
| 298 | if (use_dma && len >= mtd->oobsize) | 285 | if (use_dma && len > mtd->oobsize) |
| 286 | /* only use DMA for bigger than oob size: better performances */ | ||
| 299 | if (atmel_nand_dma_op(mtd, (void *)buf, len, 0) == 0) | 287 | if (atmel_nand_dma_op(mtd, (void *)buf, len, 0) == 0) |
| 300 | return; | 288 | return; |
| 301 | 289 | ||
| @@ -599,7 +587,10 @@ static int __init atmel_nand_probe(struct platform_device *pdev) | |||
| 599 | nand_chip->options |= NAND_USE_FLASH_BBT; | 587 | nand_chip->options |= NAND_USE_FLASH_BBT; |
| 600 | } | 588 | } |
| 601 | 589 | ||
| 602 | if (cpu_has_dma() && use_dma) { | 590 | if (!cpu_has_dma()) |
| 591 | use_dma = 0; | ||
| 592 | |||
| 593 | if (use_dma) { | ||
| 603 | dma_cap_mask_t mask; | 594 | dma_cap_mask_t mask; |
| 604 | 595 | ||
| 605 | dma_cap_zero(mask); | 596 | dma_cap_zero(mask); |
| @@ -611,7 +602,8 @@ static int __init atmel_nand_probe(struct platform_device *pdev) | |||
| 611 | } | 602 | } |
| 612 | } | 603 | } |
| 613 | if (use_dma) | 604 | if (use_dma) |
| 614 | dev_info(host->dev, "Using DMA for NAND access.\n"); | 605 | dev_info(host->dev, "Using %s for DMA transfers.\n", |
| 606 | dma_chan_name(host->dma_chan)); | ||
| 615 | else | 607 | else |
| 616 | dev_info(host->dev, "No DMA support for NAND access.\n"); | 608 | dev_info(host->dev, "No DMA support for NAND access.\n"); |
| 617 | 609 | ||
diff --git a/drivers/net/benet/be.h b/drivers/net/benet/be.h index f803c58b941d..66823eded7a3 100644 --- a/drivers/net/benet/be.h +++ b/drivers/net/benet/be.h | |||
| @@ -154,7 +154,7 @@ struct be_eq_obj { | |||
| 154 | u16 min_eqd; /* in usecs */ | 154 | u16 min_eqd; /* in usecs */ |
| 155 | u16 max_eqd; /* in usecs */ | 155 | u16 max_eqd; /* in usecs */ |
| 156 | u16 cur_eqd; /* in usecs */ | 156 | u16 cur_eqd; /* in usecs */ |
| 157 | u8 msix_vec_idx; | 157 | u8 eq_idx; |
| 158 | 158 | ||
| 159 | struct napi_struct napi; | 159 | struct napi_struct napi; |
| 160 | }; | 160 | }; |
| @@ -291,7 +291,7 @@ struct be_adapter { | |||
| 291 | u32 num_rx_qs; | 291 | u32 num_rx_qs; |
| 292 | u32 big_page_size; /* Compounded page size shared by rx wrbs */ | 292 | u32 big_page_size; /* Compounded page size shared by rx wrbs */ |
| 293 | 293 | ||
| 294 | u8 msix_vec_next_idx; | 294 | u8 eq_next_idx; |
| 295 | struct be_drv_stats drv_stats; | 295 | struct be_drv_stats drv_stats; |
| 296 | 296 | ||
| 297 | struct vlan_group *vlan_grp; | 297 | struct vlan_group *vlan_grp; |
diff --git a/drivers/net/benet/be_main.c b/drivers/net/benet/be_main.c index 9a54c8b24ff9..7cb5a114c733 100644 --- a/drivers/net/benet/be_main.c +++ b/drivers/net/benet/be_main.c | |||
| @@ -1497,7 +1497,7 @@ static int be_tx_queues_create(struct be_adapter *adapter) | |||
| 1497 | if (be_cmd_eq_create(adapter, eq, adapter->tx_eq.cur_eqd)) | 1497 | if (be_cmd_eq_create(adapter, eq, adapter->tx_eq.cur_eqd)) |
| 1498 | goto tx_eq_free; | 1498 | goto tx_eq_free; |
| 1499 | 1499 | ||
| 1500 | adapter->tx_eq.msix_vec_idx = adapter->msix_vec_next_idx++; | 1500 | adapter->tx_eq.eq_idx = adapter->eq_next_idx++; |
| 1501 | 1501 | ||
| 1502 | 1502 | ||
| 1503 | /* Alloc TX eth compl queue */ | 1503 | /* Alloc TX eth compl queue */ |
| @@ -1590,7 +1590,7 @@ static int be_rx_queues_create(struct be_adapter *adapter) | |||
| 1590 | if (rc) | 1590 | if (rc) |
| 1591 | goto err; | 1591 | goto err; |
| 1592 | 1592 | ||
| 1593 | rxo->rx_eq.msix_vec_idx = adapter->msix_vec_next_idx++; | 1593 | rxo->rx_eq.eq_idx = adapter->eq_next_idx++; |
| 1594 | 1594 | ||
| 1595 | /* CQ */ | 1595 | /* CQ */ |
| 1596 | cq = &rxo->cq; | 1596 | cq = &rxo->cq; |
| @@ -1666,11 +1666,11 @@ static irqreturn_t be_intx(int irq, void *dev) | |||
| 1666 | if (!isr) | 1666 | if (!isr) |
| 1667 | return IRQ_NONE; | 1667 | return IRQ_NONE; |
| 1668 | 1668 | ||
| 1669 | if ((1 << adapter->tx_eq.msix_vec_idx & isr)) | 1669 | if ((1 << adapter->tx_eq.eq_idx & isr)) |
| 1670 | event_handle(adapter, &adapter->tx_eq); | 1670 | event_handle(adapter, &adapter->tx_eq); |
| 1671 | 1671 | ||
| 1672 | for_all_rx_queues(adapter, rxo, i) { | 1672 | for_all_rx_queues(adapter, rxo, i) { |
| 1673 | if ((1 << rxo->rx_eq.msix_vec_idx & isr)) | 1673 | if ((1 << rxo->rx_eq.eq_idx & isr)) |
| 1674 | event_handle(adapter, &rxo->rx_eq); | 1674 | event_handle(adapter, &rxo->rx_eq); |
| 1675 | } | 1675 | } |
| 1676 | } | 1676 | } |
| @@ -1951,7 +1951,7 @@ static void be_sriov_disable(struct be_adapter *adapter) | |||
| 1951 | static inline int be_msix_vec_get(struct be_adapter *adapter, | 1951 | static inline int be_msix_vec_get(struct be_adapter *adapter, |
| 1952 | struct be_eq_obj *eq_obj) | 1952 | struct be_eq_obj *eq_obj) |
| 1953 | { | 1953 | { |
| 1954 | return adapter->msix_entries[eq_obj->msix_vec_idx].vector; | 1954 | return adapter->msix_entries[eq_obj->eq_idx].vector; |
| 1955 | } | 1955 | } |
| 1956 | 1956 | ||
| 1957 | static int be_request_irq(struct be_adapter *adapter, | 1957 | static int be_request_irq(struct be_adapter *adapter, |
| @@ -2345,6 +2345,7 @@ static int be_clear(struct be_adapter *adapter) | |||
| 2345 | be_mcc_queues_destroy(adapter); | 2345 | be_mcc_queues_destroy(adapter); |
| 2346 | be_rx_queues_destroy(adapter); | 2346 | be_rx_queues_destroy(adapter); |
| 2347 | be_tx_queues_destroy(adapter); | 2347 | be_tx_queues_destroy(adapter); |
| 2348 | adapter->eq_next_idx = 0; | ||
| 2348 | 2349 | ||
| 2349 | if (be_physfn(adapter) && adapter->sriov_enabled) | 2350 | if (be_physfn(adapter) && adapter->sriov_enabled) |
| 2350 | for (vf = 0; vf < num_vfs; vf++) | 2351 | for (vf = 0; vf < num_vfs; vf++) |
| @@ -3141,12 +3142,14 @@ static int be_resume(struct pci_dev *pdev) | |||
| 3141 | static void be_shutdown(struct pci_dev *pdev) | 3142 | static void be_shutdown(struct pci_dev *pdev) |
| 3142 | { | 3143 | { |
| 3143 | struct be_adapter *adapter = pci_get_drvdata(pdev); | 3144 | struct be_adapter *adapter = pci_get_drvdata(pdev); |
| 3144 | struct net_device *netdev = adapter->netdev; | ||
| 3145 | 3145 | ||
| 3146 | if (netif_running(netdev)) | 3146 | if (!adapter) |
| 3147 | return; | ||
| 3148 | |||
| 3149 | if (netif_running(adapter->netdev)) | ||
| 3147 | cancel_delayed_work_sync(&adapter->work); | 3150 | cancel_delayed_work_sync(&adapter->work); |
| 3148 | 3151 | ||
| 3149 | netif_device_detach(netdev); | 3152 | netif_device_detach(adapter->netdev); |
| 3150 | 3153 | ||
| 3151 | be_cmd_reset_function(adapter); | 3154 | be_cmd_reset_function(adapter); |
| 3152 | 3155 | ||
diff --git a/drivers/net/bna/bfa_ioc.c b/drivers/net/bna/bfa_ioc.c index 34933cb9569f..7581518ecfa2 100644 --- a/drivers/net/bna/bfa_ioc.c +++ b/drivers/net/bna/bfa_ioc.c | |||
| @@ -38,6 +38,8 @@ | |||
| 38 | #define bfa_ioc_map_port(__ioc) ((__ioc)->ioc_hwif->ioc_map_port(__ioc)) | 38 | #define bfa_ioc_map_port(__ioc) ((__ioc)->ioc_hwif->ioc_map_port(__ioc)) |
| 39 | #define bfa_ioc_notify_fail(__ioc) \ | 39 | #define bfa_ioc_notify_fail(__ioc) \ |
| 40 | ((__ioc)->ioc_hwif->ioc_notify_fail(__ioc)) | 40 | ((__ioc)->ioc_hwif->ioc_notify_fail(__ioc)) |
| 41 | #define bfa_ioc_sync_start(__ioc) \ | ||
| 42 | ((__ioc)->ioc_hwif->ioc_sync_start(__ioc)) | ||
| 41 | #define bfa_ioc_sync_join(__ioc) \ | 43 | #define bfa_ioc_sync_join(__ioc) \ |
| 42 | ((__ioc)->ioc_hwif->ioc_sync_join(__ioc)) | 44 | ((__ioc)->ioc_hwif->ioc_sync_join(__ioc)) |
| 43 | #define bfa_ioc_sync_leave(__ioc) \ | 45 | #define bfa_ioc_sync_leave(__ioc) \ |
| @@ -602,7 +604,7 @@ bfa_iocpf_sm_fwcheck(struct bfa_iocpf *iocpf, enum iocpf_event event) | |||
| 602 | switch (event) { | 604 | switch (event) { |
| 603 | case IOCPF_E_SEMLOCKED: | 605 | case IOCPF_E_SEMLOCKED: |
| 604 | if (bfa_ioc_firmware_lock(ioc)) { | 606 | if (bfa_ioc_firmware_lock(ioc)) { |
| 605 | if (bfa_ioc_sync_complete(ioc)) { | 607 | if (bfa_ioc_sync_start(ioc)) { |
| 606 | iocpf->retry_count = 0; | 608 | iocpf->retry_count = 0; |
| 607 | bfa_ioc_sync_join(ioc); | 609 | bfa_ioc_sync_join(ioc); |
| 608 | bfa_fsm_set_state(iocpf, bfa_iocpf_sm_hwinit); | 610 | bfa_fsm_set_state(iocpf, bfa_iocpf_sm_hwinit); |
| @@ -1314,7 +1316,7 @@ bfa_nw_ioc_fwver_cmp(struct bfa_ioc *ioc, struct bfi_ioc_image_hdr *fwhdr) | |||
| 1314 | * execution context (driver/bios) must match. | 1316 | * execution context (driver/bios) must match. |
| 1315 | */ | 1317 | */ |
| 1316 | static bool | 1318 | static bool |
| 1317 | bfa_ioc_fwver_valid(struct bfa_ioc *ioc) | 1319 | bfa_ioc_fwver_valid(struct bfa_ioc *ioc, u32 boot_env) |
| 1318 | { | 1320 | { |
| 1319 | struct bfi_ioc_image_hdr fwhdr, *drv_fwhdr; | 1321 | struct bfi_ioc_image_hdr fwhdr, *drv_fwhdr; |
| 1320 | 1322 | ||
| @@ -1325,7 +1327,7 @@ bfa_ioc_fwver_valid(struct bfa_ioc *ioc) | |||
| 1325 | if (fwhdr.signature != drv_fwhdr->signature) | 1327 | if (fwhdr.signature != drv_fwhdr->signature) |
| 1326 | return false; | 1328 | return false; |
| 1327 | 1329 | ||
| 1328 | if (fwhdr.exec != drv_fwhdr->exec) | 1330 | if (swab32(fwhdr.param) != boot_env) |
| 1329 | return false; | 1331 | return false; |
| 1330 | 1332 | ||
| 1331 | return bfa_nw_ioc_fwver_cmp(ioc, &fwhdr); | 1333 | return bfa_nw_ioc_fwver_cmp(ioc, &fwhdr); |
| @@ -1352,9 +1354,12 @@ bfa_ioc_hwinit(struct bfa_ioc *ioc, bool force) | |||
| 1352 | { | 1354 | { |
| 1353 | enum bfi_ioc_state ioc_fwstate; | 1355 | enum bfi_ioc_state ioc_fwstate; |
| 1354 | bool fwvalid; | 1356 | bool fwvalid; |
| 1357 | u32 boot_env; | ||
| 1355 | 1358 | ||
| 1356 | ioc_fwstate = readl(ioc->ioc_regs.ioc_fwstate); | 1359 | ioc_fwstate = readl(ioc->ioc_regs.ioc_fwstate); |
| 1357 | 1360 | ||
| 1361 | boot_env = BFI_BOOT_LOADER_OS; | ||
| 1362 | |||
| 1358 | if (force) | 1363 | if (force) |
| 1359 | ioc_fwstate = BFI_IOC_UNINIT; | 1364 | ioc_fwstate = BFI_IOC_UNINIT; |
| 1360 | 1365 | ||
| @@ -1362,10 +1367,10 @@ bfa_ioc_hwinit(struct bfa_ioc *ioc, bool force) | |||
| 1362 | * check if firmware is valid | 1367 | * check if firmware is valid |
| 1363 | */ | 1368 | */ |
| 1364 | fwvalid = (ioc_fwstate == BFI_IOC_UNINIT) ? | 1369 | fwvalid = (ioc_fwstate == BFI_IOC_UNINIT) ? |
| 1365 | false : bfa_ioc_fwver_valid(ioc); | 1370 | false : bfa_ioc_fwver_valid(ioc, boot_env); |
| 1366 | 1371 | ||
| 1367 | if (!fwvalid) { | 1372 | if (!fwvalid) { |
| 1368 | bfa_ioc_boot(ioc, BFI_BOOT_TYPE_NORMAL, ioc->pcidev.device_id); | 1373 | bfa_ioc_boot(ioc, BFI_BOOT_TYPE_NORMAL, boot_env); |
| 1369 | return; | 1374 | return; |
| 1370 | } | 1375 | } |
| 1371 | 1376 | ||
| @@ -1396,7 +1401,7 @@ bfa_ioc_hwinit(struct bfa_ioc *ioc, bool force) | |||
| 1396 | /** | 1401 | /** |
| 1397 | * Initialize the h/w for any other states. | 1402 | * Initialize the h/w for any other states. |
| 1398 | */ | 1403 | */ |
| 1399 | bfa_ioc_boot(ioc, BFI_BOOT_TYPE_NORMAL, ioc->pcidev.device_id); | 1404 | bfa_ioc_boot(ioc, BFI_BOOT_TYPE_NORMAL, boot_env); |
| 1400 | } | 1405 | } |
| 1401 | 1406 | ||
| 1402 | void | 1407 | void |
| @@ -1506,7 +1511,7 @@ bfa_ioc_hb_stop(struct bfa_ioc *ioc) | |||
| 1506 | */ | 1511 | */ |
| 1507 | static void | 1512 | static void |
| 1508 | bfa_ioc_download_fw(struct bfa_ioc *ioc, u32 boot_type, | 1513 | bfa_ioc_download_fw(struct bfa_ioc *ioc, u32 boot_type, |
| 1509 | u32 boot_param) | 1514 | u32 boot_env) |
| 1510 | { | 1515 | { |
| 1511 | u32 *fwimg; | 1516 | u32 *fwimg; |
| 1512 | u32 pgnum, pgoff; | 1517 | u32 pgnum, pgoff; |
| @@ -1558,10 +1563,10 @@ bfa_ioc_download_fw(struct bfa_ioc *ioc, u32 boot_type, | |||
| 1558 | /* | 1563 | /* |
| 1559 | * Set boot type and boot param at the end. | 1564 | * Set boot type and boot param at the end. |
| 1560 | */ | 1565 | */ |
| 1561 | writel((swab32(swab32(boot_type))), ((ioc->ioc_regs.smem_page_start) | 1566 | writel(boot_type, ((ioc->ioc_regs.smem_page_start) |
| 1562 | + (BFI_BOOT_TYPE_OFF))); | 1567 | + (BFI_BOOT_TYPE_OFF))); |
| 1563 | writel((swab32(swab32(boot_param))), ((ioc->ioc_regs.smem_page_start) | 1568 | writel(boot_env, ((ioc->ioc_regs.smem_page_start) |
| 1564 | + (BFI_BOOT_PARAM_OFF))); | 1569 | + (BFI_BOOT_LOADER_OFF))); |
| 1565 | } | 1570 | } |
| 1566 | 1571 | ||
| 1567 | static void | 1572 | static void |
| @@ -1721,7 +1726,7 @@ bfa_ioc_pll_init(struct bfa_ioc *ioc) | |||
| 1721 | * as the entry vector. | 1726 | * as the entry vector. |
| 1722 | */ | 1727 | */ |
| 1723 | static void | 1728 | static void |
| 1724 | bfa_ioc_boot(struct bfa_ioc *ioc, u32 boot_type, u32 boot_param) | 1729 | bfa_ioc_boot(struct bfa_ioc *ioc, u32 boot_type, u32 boot_env) |
| 1725 | { | 1730 | { |
| 1726 | void __iomem *rb; | 1731 | void __iomem *rb; |
| 1727 | 1732 | ||
| @@ -1734,7 +1739,7 @@ bfa_ioc_boot(struct bfa_ioc *ioc, u32 boot_type, u32 boot_param) | |||
| 1734 | * Initialize IOC state of all functions on a chip reset. | 1739 | * Initialize IOC state of all functions on a chip reset. |
| 1735 | */ | 1740 | */ |
| 1736 | rb = ioc->pcidev.pci_bar_kva; | 1741 | rb = ioc->pcidev.pci_bar_kva; |
| 1737 | if (boot_param == BFI_BOOT_TYPE_MEMTEST) { | 1742 | if (boot_type == BFI_BOOT_TYPE_MEMTEST) { |
| 1738 | writel(BFI_IOC_MEMTEST, (rb + BFA_IOC0_STATE_REG)); | 1743 | writel(BFI_IOC_MEMTEST, (rb + BFA_IOC0_STATE_REG)); |
| 1739 | writel(BFI_IOC_MEMTEST, (rb + BFA_IOC1_STATE_REG)); | 1744 | writel(BFI_IOC_MEMTEST, (rb + BFA_IOC1_STATE_REG)); |
| 1740 | } else { | 1745 | } else { |
| @@ -1743,7 +1748,7 @@ bfa_ioc_boot(struct bfa_ioc *ioc, u32 boot_type, u32 boot_param) | |||
| 1743 | } | 1748 | } |
| 1744 | 1749 | ||
| 1745 | bfa_ioc_msgflush(ioc); | 1750 | bfa_ioc_msgflush(ioc); |
| 1746 | bfa_ioc_download_fw(ioc, boot_type, boot_param); | 1751 | bfa_ioc_download_fw(ioc, boot_type, boot_env); |
| 1747 | 1752 | ||
| 1748 | /** | 1753 | /** |
| 1749 | * Enable interrupts just before starting LPU | 1754 | * Enable interrupts just before starting LPU |
| @@ -2219,13 +2224,9 @@ bfa_nw_ioc_get_mac(struct bfa_ioc *ioc) | |||
| 2219 | static void | 2224 | static void |
| 2220 | bfa_ioc_recover(struct bfa_ioc *ioc) | 2225 | bfa_ioc_recover(struct bfa_ioc *ioc) |
| 2221 | { | 2226 | { |
| 2222 | u16 bdf; | 2227 | pr_crit("Heart Beat of IOC has failed\n"); |
| 2223 | 2228 | bfa_ioc_stats(ioc, ioc_hbfails); | |
| 2224 | bdf = (ioc->pcidev.pci_slot << 8 | ioc->pcidev.pci_func << 3 | | 2229 | bfa_fsm_send_event(ioc, IOC_E_HBFAIL); |
| 2225 | ioc->pcidev.device_id); | ||
| 2226 | |||
| 2227 | pr_crit("Firmware heartbeat failure at %d", bdf); | ||
| 2228 | BUG_ON(1); | ||
| 2229 | } | 2230 | } |
| 2230 | 2231 | ||
| 2231 | static void | 2232 | static void |
diff --git a/drivers/net/bna/bfa_ioc.h b/drivers/net/bna/bfa_ioc.h index e4974bc24ef6..bd48abee781f 100644 --- a/drivers/net/bna/bfa_ioc.h +++ b/drivers/net/bna/bfa_ioc.h | |||
| @@ -194,6 +194,7 @@ struct bfa_ioc_hwif { | |||
| 194 | bool msix); | 194 | bool msix); |
| 195 | void (*ioc_notify_fail) (struct bfa_ioc *ioc); | 195 | void (*ioc_notify_fail) (struct bfa_ioc *ioc); |
| 196 | void (*ioc_ownership_reset) (struct bfa_ioc *ioc); | 196 | void (*ioc_ownership_reset) (struct bfa_ioc *ioc); |
| 197 | bool (*ioc_sync_start) (struct bfa_ioc *ioc); | ||
| 197 | void (*ioc_sync_join) (struct bfa_ioc *ioc); | 198 | void (*ioc_sync_join) (struct bfa_ioc *ioc); |
| 198 | void (*ioc_sync_leave) (struct bfa_ioc *ioc); | 199 | void (*ioc_sync_leave) (struct bfa_ioc *ioc); |
| 199 | void (*ioc_sync_ack) (struct bfa_ioc *ioc); | 200 | void (*ioc_sync_ack) (struct bfa_ioc *ioc); |
diff --git a/drivers/net/bna/bfa_ioc_ct.c b/drivers/net/bna/bfa_ioc_ct.c index 469997c4ffd1..87aecdf22cf9 100644 --- a/drivers/net/bna/bfa_ioc_ct.c +++ b/drivers/net/bna/bfa_ioc_ct.c | |||
| @@ -41,6 +41,7 @@ static void bfa_ioc_ct_map_port(struct bfa_ioc *ioc); | |||
| 41 | static void bfa_ioc_ct_isr_mode_set(struct bfa_ioc *ioc, bool msix); | 41 | static void bfa_ioc_ct_isr_mode_set(struct bfa_ioc *ioc, bool msix); |
| 42 | static void bfa_ioc_ct_notify_fail(struct bfa_ioc *ioc); | 42 | static void bfa_ioc_ct_notify_fail(struct bfa_ioc *ioc); |
| 43 | static void bfa_ioc_ct_ownership_reset(struct bfa_ioc *ioc); | 43 | static void bfa_ioc_ct_ownership_reset(struct bfa_ioc *ioc); |
| 44 | static bool bfa_ioc_ct_sync_start(struct bfa_ioc *ioc); | ||
| 44 | static void bfa_ioc_ct_sync_join(struct bfa_ioc *ioc); | 45 | static void bfa_ioc_ct_sync_join(struct bfa_ioc *ioc); |
| 45 | static void bfa_ioc_ct_sync_leave(struct bfa_ioc *ioc); | 46 | static void bfa_ioc_ct_sync_leave(struct bfa_ioc *ioc); |
| 46 | static void bfa_ioc_ct_sync_ack(struct bfa_ioc *ioc); | 47 | static void bfa_ioc_ct_sync_ack(struct bfa_ioc *ioc); |
| @@ -63,6 +64,7 @@ bfa_nw_ioc_set_ct_hwif(struct bfa_ioc *ioc) | |||
| 63 | nw_hwif_ct.ioc_isr_mode_set = bfa_ioc_ct_isr_mode_set; | 64 | nw_hwif_ct.ioc_isr_mode_set = bfa_ioc_ct_isr_mode_set; |
| 64 | nw_hwif_ct.ioc_notify_fail = bfa_ioc_ct_notify_fail; | 65 | nw_hwif_ct.ioc_notify_fail = bfa_ioc_ct_notify_fail; |
| 65 | nw_hwif_ct.ioc_ownership_reset = bfa_ioc_ct_ownership_reset; | 66 | nw_hwif_ct.ioc_ownership_reset = bfa_ioc_ct_ownership_reset; |
| 67 | nw_hwif_ct.ioc_sync_start = bfa_ioc_ct_sync_start; | ||
| 66 | nw_hwif_ct.ioc_sync_join = bfa_ioc_ct_sync_join; | 68 | nw_hwif_ct.ioc_sync_join = bfa_ioc_ct_sync_join; |
| 67 | nw_hwif_ct.ioc_sync_leave = bfa_ioc_ct_sync_leave; | 69 | nw_hwif_ct.ioc_sync_leave = bfa_ioc_ct_sync_leave; |
| 68 | nw_hwif_ct.ioc_sync_ack = bfa_ioc_ct_sync_ack; | 70 | nw_hwif_ct.ioc_sync_ack = bfa_ioc_ct_sync_ack; |
| @@ -345,6 +347,32 @@ bfa_ioc_ct_ownership_reset(struct bfa_ioc *ioc) | |||
| 345 | /** | 347 | /** |
| 346 | * Synchronized IOC failure processing routines | 348 | * Synchronized IOC failure processing routines |
| 347 | */ | 349 | */ |
| 350 | static bool | ||
| 351 | bfa_ioc_ct_sync_start(struct bfa_ioc *ioc) | ||
| 352 | { | ||
| 353 | u32 r32 = readl(ioc->ioc_regs.ioc_fail_sync); | ||
| 354 | u32 sync_reqd = bfa_ioc_ct_get_sync_reqd(r32); | ||
| 355 | |||
| 356 | /* | ||
| 357 | * Driver load time. If the sync required bit for this PCI fn | ||
| 358 | * is set, it is due to an unclean exit by the driver for this | ||
| 359 | * PCI fn in the previous incarnation. Whoever comes here first | ||
| 360 | * should clean it up, no matter which PCI fn. | ||
| 361 | */ | ||
| 362 | |||
| 363 | if (sync_reqd & bfa_ioc_ct_sync_pos(ioc)) { | ||
| 364 | writel(0, ioc->ioc_regs.ioc_fail_sync); | ||
| 365 | writel(1, ioc->ioc_regs.ioc_usage_reg); | ||
| 366 | writel(BFI_IOC_UNINIT, ioc->ioc_regs.ioc_fwstate); | ||
| 367 | writel(BFI_IOC_UNINIT, ioc->ioc_regs.alt_ioc_fwstate); | ||
| 368 | return true; | ||
| 369 | } | ||
| 370 | |||
| 371 | return bfa_ioc_ct_sync_complete(ioc); | ||
| 372 | } | ||
| 373 | /** | ||
| 374 | * Synchronized IOC failure processing routines | ||
| 375 | */ | ||
| 348 | static void | 376 | static void |
| 349 | bfa_ioc_ct_sync_join(struct bfa_ioc *ioc) | 377 | bfa_ioc_ct_sync_join(struct bfa_ioc *ioc) |
| 350 | { | 378 | { |
diff --git a/drivers/net/bna/bfi.h b/drivers/net/bna/bfi.h index a97396811050..6050379526f7 100644 --- a/drivers/net/bna/bfi.h +++ b/drivers/net/bna/bfi.h | |||
| @@ -184,12 +184,14 @@ enum bfi_mclass { | |||
| 184 | #define BFI_IOC_MSGLEN_MAX 32 /* 32 bytes */ | 184 | #define BFI_IOC_MSGLEN_MAX 32 /* 32 bytes */ |
| 185 | 185 | ||
| 186 | #define BFI_BOOT_TYPE_OFF 8 | 186 | #define BFI_BOOT_TYPE_OFF 8 |
| 187 | #define BFI_BOOT_PARAM_OFF 12 | 187 | #define BFI_BOOT_LOADER_OFF 12 |
| 188 | 188 | ||
| 189 | #define BFI_BOOT_TYPE_NORMAL 0 /* param is device id */ | 189 | #define BFI_BOOT_TYPE_NORMAL 0 |
| 190 | #define BFI_BOOT_TYPE_FLASH 1 | 190 | #define BFI_BOOT_TYPE_FLASH 1 |
| 191 | #define BFI_BOOT_TYPE_MEMTEST 2 | 191 | #define BFI_BOOT_TYPE_MEMTEST 2 |
| 192 | 192 | ||
| 193 | #define BFI_BOOT_LOADER_OS 0 | ||
| 194 | |||
| 193 | #define BFI_BOOT_MEMTEST_RES_ADDR 0x900 | 195 | #define BFI_BOOT_MEMTEST_RES_ADDR 0x900 |
| 194 | #define BFI_BOOT_MEMTEST_RES_SIG 0xA0A1A2A3 | 196 | #define BFI_BOOT_MEMTEST_RES_SIG 0xA0A1A2A3 |
| 195 | 197 | ||
diff --git a/drivers/net/bna/bnad.c b/drivers/net/bna/bnad.c index 9f356d5d0f33..8e6ceab9f4d8 100644 --- a/drivers/net/bna/bnad.c +++ b/drivers/net/bna/bnad.c | |||
| @@ -1837,7 +1837,6 @@ bnad_setup_rx(struct bnad *bnad, uint rx_id) | |||
| 1837 | /* Initialize the Rx event handlers */ | 1837 | /* Initialize the Rx event handlers */ |
| 1838 | rx_cbfn.rcb_setup_cbfn = bnad_cb_rcb_setup; | 1838 | rx_cbfn.rcb_setup_cbfn = bnad_cb_rcb_setup; |
| 1839 | rx_cbfn.rcb_destroy_cbfn = bnad_cb_rcb_destroy; | 1839 | rx_cbfn.rcb_destroy_cbfn = bnad_cb_rcb_destroy; |
| 1840 | rx_cbfn.rcb_destroy_cbfn = NULL; | ||
| 1841 | rx_cbfn.ccb_setup_cbfn = bnad_cb_ccb_setup; | 1840 | rx_cbfn.ccb_setup_cbfn = bnad_cb_ccb_setup; |
| 1842 | rx_cbfn.ccb_destroy_cbfn = bnad_cb_ccb_destroy; | 1841 | rx_cbfn.ccb_destroy_cbfn = bnad_cb_ccb_destroy; |
| 1843 | rx_cbfn.rx_cleanup_cbfn = bnad_cb_rx_cleanup; | 1842 | rx_cbfn.rx_cleanup_cbfn = bnad_cb_rx_cleanup; |
diff --git a/drivers/net/bnx2x/bnx2x_ethtool.c b/drivers/net/bnx2x/bnx2x_ethtool.c index f5050155c6b5..89cb977898cb 100644 --- a/drivers/net/bnx2x/bnx2x_ethtool.c +++ b/drivers/net/bnx2x/bnx2x_ethtool.c | |||
| @@ -2114,19 +2114,18 @@ static int bnx2x_phys_id(struct net_device *dev, u32 data) | |||
| 2114 | for (i = 0; i < (data * 2); i++) { | 2114 | for (i = 0; i < (data * 2); i++) { |
| 2115 | if ((i % 2) == 0) | 2115 | if ((i % 2) == 0) |
| 2116 | bnx2x_set_led(&bp->link_params, &bp->link_vars, | 2116 | bnx2x_set_led(&bp->link_params, &bp->link_vars, |
| 2117 | LED_MODE_OPER, SPEED_1000); | 2117 | LED_MODE_ON, SPEED_1000); |
| 2118 | else | 2118 | else |
| 2119 | bnx2x_set_led(&bp->link_params, &bp->link_vars, | 2119 | bnx2x_set_led(&bp->link_params, &bp->link_vars, |
| 2120 | LED_MODE_OFF, 0); | 2120 | LED_MODE_FRONT_PANEL_OFF, 0); |
| 2121 | 2121 | ||
| 2122 | msleep_interruptible(500); | 2122 | msleep_interruptible(500); |
| 2123 | if (signal_pending(current)) | 2123 | if (signal_pending(current)) |
| 2124 | break; | 2124 | break; |
| 2125 | } | 2125 | } |
| 2126 | 2126 | ||
| 2127 | if (bp->link_vars.link_up) | 2127 | bnx2x_set_led(&bp->link_params, &bp->link_vars, |
| 2128 | bnx2x_set_led(&bp->link_params, &bp->link_vars, LED_MODE_OPER, | 2128 | LED_MODE_OPER, bp->link_vars.line_speed); |
| 2129 | bp->link_vars.line_speed); | ||
| 2130 | 2129 | ||
| 2131 | return 0; | 2130 | return 0; |
| 2132 | } | 2131 | } |
diff --git a/drivers/net/bonding/bond_alb.c b/drivers/net/bonding/bond_alb.c index 9bc5de3e04a8..ba715826e2a8 100644 --- a/drivers/net/bonding/bond_alb.c +++ b/drivers/net/bonding/bond_alb.c | |||
| @@ -176,7 +176,7 @@ static int tlb_initialize(struct bonding *bond) | |||
| 176 | bond_info->tx_hashtbl = new_hashtbl; | 176 | bond_info->tx_hashtbl = new_hashtbl; |
| 177 | 177 | ||
| 178 | for (i = 0; i < TLB_HASH_TABLE_SIZE; i++) { | 178 | for (i = 0; i < TLB_HASH_TABLE_SIZE; i++) { |
| 179 | tlb_init_table_entry(&bond_info->tx_hashtbl[i], 1); | 179 | tlb_init_table_entry(&bond_info->tx_hashtbl[i], 0); |
| 180 | } | 180 | } |
| 181 | 181 | ||
| 182 | _unlock_tx_hashtbl(bond); | 182 | _unlock_tx_hashtbl(bond); |
| @@ -701,7 +701,7 @@ static struct slave *rlb_arp_xmit(struct sk_buff *skb, struct bonding *bond) | |||
| 701 | */ | 701 | */ |
| 702 | rlb_choose_channel(skb, bond); | 702 | rlb_choose_channel(skb, bond); |
| 703 | 703 | ||
| 704 | /* The ARP relpy packets must be delayed so that | 704 | /* The ARP reply packets must be delayed so that |
| 705 | * they can cancel out the influence of the ARP request. | 705 | * they can cancel out the influence of the ARP request. |
| 706 | */ | 706 | */ |
| 707 | bond->alb_info.rlb_update_delay_counter = RLB_UPDATE_DELAY; | 707 | bond->alb_info.rlb_update_delay_counter = RLB_UPDATE_DELAY; |
| @@ -1042,7 +1042,7 @@ static void alb_change_hw_addr_on_detach(struct bonding *bond, struct slave *sla | |||
| 1042 | * | 1042 | * |
| 1043 | * If the permanent hw address of @slave is @bond's hw address, we need to | 1043 | * If the permanent hw address of @slave is @bond's hw address, we need to |
| 1044 | * find a different hw address to give @slave, that isn't in use by any other | 1044 | * find a different hw address to give @slave, that isn't in use by any other |
| 1045 | * slave in the bond. This address must be, of course, one of the premanent | 1045 | * slave in the bond. This address must be, of course, one of the permanent |
| 1046 | * addresses of the other slaves. | 1046 | * addresses of the other slaves. |
| 1047 | * | 1047 | * |
| 1048 | * We go over the slave list, and for each slave there we compare its | 1048 | * We go over the slave list, and for each slave there we compare its |
diff --git a/drivers/net/bonding/bond_alb.h b/drivers/net/bonding/bond_alb.h index 86861f08b24d..8ca7158b2dda 100644 --- a/drivers/net/bonding/bond_alb.h +++ b/drivers/net/bonding/bond_alb.h | |||
| @@ -75,7 +75,7 @@ struct tlb_client_info { | |||
| 75 | * gave this entry index. | 75 | * gave this entry index. |
| 76 | */ | 76 | */ |
| 77 | u32 tx_bytes; /* Each Client accumulates the BytesTx that | 77 | u32 tx_bytes; /* Each Client accumulates the BytesTx that |
| 78 | * were tranmitted to it, and after each | 78 | * were transmitted to it, and after each |
| 79 | * CallBack the LoadHistory is divided | 79 | * CallBack the LoadHistory is divided |
| 80 | * by the balance interval | 80 | * by the balance interval |
| 81 | */ | 81 | */ |
| @@ -122,7 +122,6 @@ struct tlb_slave_info { | |||
| 122 | }; | 122 | }; |
| 123 | 123 | ||
| 124 | struct alb_bond_info { | 124 | struct alb_bond_info { |
| 125 | struct timer_list alb_timer; | ||
| 126 | struct tlb_client_info *tx_hashtbl; /* Dynamically allocated */ | 125 | struct tlb_client_info *tx_hashtbl; /* Dynamically allocated */ |
| 127 | spinlock_t tx_hashtbl_lock; | 126 | spinlock_t tx_hashtbl_lock; |
| 128 | u32 unbalanced_load; | 127 | u32 unbalanced_load; |
| @@ -140,7 +139,6 @@ struct alb_bond_info { | |||
| 140 | struct slave *next_rx_slave;/* next slave to be assigned | 139 | struct slave *next_rx_slave;/* next slave to be assigned |
| 141 | * to a new rx client for | 140 | * to a new rx client for |
| 142 | */ | 141 | */ |
| 143 | u32 rlb_interval_counter; | ||
| 144 | u8 primary_is_promisc; /* boolean */ | 142 | u8 primary_is_promisc; /* boolean */ |
| 145 | u32 rlb_promisc_timeout_counter;/* counts primary | 143 | u32 rlb_promisc_timeout_counter;/* counts primary |
| 146 | * promiscuity time | 144 | * promiscuity time |
diff --git a/drivers/net/can/mcp251x.c b/drivers/net/can/mcp251x.c index 7513c4523ac4..330140ee266d 100644 --- a/drivers/net/can/mcp251x.c +++ b/drivers/net/can/mcp251x.c | |||
| @@ -931,7 +931,8 @@ static int mcp251x_open(struct net_device *net) | |||
| 931 | priv->tx_len = 0; | 931 | priv->tx_len = 0; |
| 932 | 932 | ||
| 933 | ret = request_threaded_irq(spi->irq, NULL, mcp251x_can_ist, | 933 | ret = request_threaded_irq(spi->irq, NULL, mcp251x_can_ist, |
| 934 | IRQF_TRIGGER_FALLING, DEVICE_NAME, priv); | 934 | pdata->irq_flags ? pdata->irq_flags : IRQF_TRIGGER_FALLING, |
| 935 | DEVICE_NAME, priv); | ||
| 935 | if (ret) { | 936 | if (ret) { |
| 936 | dev_err(&spi->dev, "failed to acquire irq %d\n", spi->irq); | 937 | dev_err(&spi->dev, "failed to acquire irq %d\n", spi->irq); |
| 937 | if (pdata->transceiver_enable) | 938 | if (pdata->transceiver_enable) |
diff --git a/drivers/net/can/mscan/mpc5xxx_can.c b/drivers/net/can/mscan/mpc5xxx_can.c index c0a1bc5b1435..bd1d811c204f 100644 --- a/drivers/net/can/mscan/mpc5xxx_can.c +++ b/drivers/net/can/mscan/mpc5xxx_can.c | |||
| @@ -260,7 +260,7 @@ static int __devinit mpc5xxx_can_probe(struct platform_device *ofdev) | |||
| 260 | 260 | ||
| 261 | if (!ofdev->dev.of_match) | 261 | if (!ofdev->dev.of_match) |
| 262 | return -EINVAL; | 262 | return -EINVAL; |
| 263 | data = (struct mpc5xxx_can_data *)of_dev->dev.of_match->data; | 263 | data = (struct mpc5xxx_can_data *)ofdev->dev.of_match->data; |
| 264 | 264 | ||
| 265 | base = of_iomap(np, 0); | 265 | base = of_iomap(np, 0); |
| 266 | if (!base) { | 266 | if (!base) { |
diff --git a/drivers/net/loopback.c b/drivers/net/loopback.c index ea0dc451da9c..d70fb76edb77 100644 --- a/drivers/net/loopback.c +++ b/drivers/net/loopback.c | |||
| @@ -173,7 +173,8 @@ static void loopback_setup(struct net_device *dev) | |||
| 173 | | NETIF_F_RXCSUM | 173 | | NETIF_F_RXCSUM |
| 174 | | NETIF_F_HIGHDMA | 174 | | NETIF_F_HIGHDMA |
| 175 | | NETIF_F_LLTX | 175 | | NETIF_F_LLTX |
| 176 | | NETIF_F_NETNS_LOCAL; | 176 | | NETIF_F_NETNS_LOCAL |
| 177 | | NETIF_F_VLAN_CHALLENGED; | ||
| 177 | dev->ethtool_ops = &loopback_ethtool_ops; | 178 | dev->ethtool_ops = &loopback_ethtool_ops; |
| 178 | dev->header_ops = ð_header_ops; | 179 | dev->header_ops = ð_header_ops; |
| 179 | dev->netdev_ops = &loopback_ops; | 180 | dev->netdev_ops = &loopback_ops; |
diff --git a/drivers/net/mlx4/en_rx.c b/drivers/net/mlx4/en_rx.c index cfd50bc49169..62dd21b06df4 100644 --- a/drivers/net/mlx4/en_rx.c +++ b/drivers/net/mlx4/en_rx.c | |||
| @@ -345,6 +345,8 @@ int mlx4_en_activate_rx_rings(struct mlx4_en_priv *priv) | |||
| 345 | err = mlx4_en_init_allocator(priv, ring); | 345 | err = mlx4_en_init_allocator(priv, ring); |
| 346 | if (err) { | 346 | if (err) { |
| 347 | en_err(priv, "Failed initializing ring allocator\n"); | 347 | en_err(priv, "Failed initializing ring allocator\n"); |
| 348 | if (ring->stride <= TXBB_SIZE) | ||
| 349 | ring->buf -= TXBB_SIZE; | ||
| 348 | ring_ind--; | 350 | ring_ind--; |
| 349 | goto err_allocator; | 351 | goto err_allocator; |
| 350 | } | 352 | } |
| @@ -369,6 +371,8 @@ err_buffers: | |||
| 369 | ring_ind = priv->rx_ring_num - 1; | 371 | ring_ind = priv->rx_ring_num - 1; |
| 370 | err_allocator: | 372 | err_allocator: |
| 371 | while (ring_ind >= 0) { | 373 | while (ring_ind >= 0) { |
| 374 | if (priv->rx_ring[ring_ind].stride <= TXBB_SIZE) | ||
| 375 | priv->rx_ring[ring_ind].buf -= TXBB_SIZE; | ||
| 372 | mlx4_en_destroy_allocator(priv, &priv->rx_ring[ring_ind]); | 376 | mlx4_en_destroy_allocator(priv, &priv->rx_ring[ring_ind]); |
| 373 | ring_ind--; | 377 | ring_ind--; |
| 374 | } | 378 | } |
diff --git a/drivers/net/mlx4/main.c b/drivers/net/mlx4/main.c index 62fa7eec5f0c..3814fc9b1145 100644 --- a/drivers/net/mlx4/main.c +++ b/drivers/net/mlx4/main.c | |||
| @@ -944,6 +944,10 @@ static int mlx4_setup_hca(struct mlx4_dev *dev) | |||
| 944 | } | 944 | } |
| 945 | 945 | ||
| 946 | for (port = 1; port <= dev->caps.num_ports; port++) { | 946 | for (port = 1; port <= dev->caps.num_ports; port++) { |
| 947 | enum mlx4_port_type port_type = 0; | ||
| 948 | mlx4_SENSE_PORT(dev, port, &port_type); | ||
| 949 | if (port_type) | ||
| 950 | dev->caps.port_type[port] = port_type; | ||
| 947 | ib_port_default_caps = 0; | 951 | ib_port_default_caps = 0; |
| 948 | err = mlx4_get_port_ib_caps(dev, port, &ib_port_default_caps); | 952 | err = mlx4_get_port_ib_caps(dev, port, &ib_port_default_caps); |
| 949 | if (err) | 953 | if (err) |
| @@ -958,6 +962,7 @@ static int mlx4_setup_hca(struct mlx4_dev *dev) | |||
| 958 | goto err_mcg_table_free; | 962 | goto err_mcg_table_free; |
| 959 | } | 963 | } |
| 960 | } | 964 | } |
| 965 | mlx4_set_port_mask(dev); | ||
| 961 | 966 | ||
| 962 | return 0; | 967 | return 0; |
| 963 | 968 | ||
diff --git a/drivers/net/mlx4/mlx4.h b/drivers/net/mlx4/mlx4.h index c1e0e5f1bcdb..dd7d745fbab4 100644 --- a/drivers/net/mlx4/mlx4.h +++ b/drivers/net/mlx4/mlx4.h | |||
| @@ -431,6 +431,8 @@ void mlx4_srq_event(struct mlx4_dev *dev, u32 srqn, int event_type); | |||
| 431 | 431 | ||
| 432 | void mlx4_handle_catas_err(struct mlx4_dev *dev); | 432 | void mlx4_handle_catas_err(struct mlx4_dev *dev); |
| 433 | 433 | ||
| 434 | int mlx4_SENSE_PORT(struct mlx4_dev *dev, int port, | ||
| 435 | enum mlx4_port_type *type); | ||
| 434 | void mlx4_do_sense_ports(struct mlx4_dev *dev, | 436 | void mlx4_do_sense_ports(struct mlx4_dev *dev, |
| 435 | enum mlx4_port_type *stype, | 437 | enum mlx4_port_type *stype, |
| 436 | enum mlx4_port_type *defaults); | 438 | enum mlx4_port_type *defaults); |
diff --git a/drivers/net/mlx4/sense.c b/drivers/net/mlx4/sense.c index 015fbe785c13..e2337a7411d9 100644 --- a/drivers/net/mlx4/sense.c +++ b/drivers/net/mlx4/sense.c | |||
| @@ -38,8 +38,8 @@ | |||
| 38 | 38 | ||
| 39 | #include "mlx4.h" | 39 | #include "mlx4.h" |
| 40 | 40 | ||
| 41 | static int mlx4_SENSE_PORT(struct mlx4_dev *dev, int port, | 41 | int mlx4_SENSE_PORT(struct mlx4_dev *dev, int port, |
| 42 | enum mlx4_port_type *type) | 42 | enum mlx4_port_type *type) |
| 43 | { | 43 | { |
| 44 | u64 out_param; | 44 | u64 out_param; |
| 45 | int err = 0; | 45 | int err = 0; |
diff --git a/drivers/net/natsemi.c b/drivers/net/natsemi.c index aa2813e06d00..1074231f0a0d 100644 --- a/drivers/net/natsemi.c +++ b/drivers/net/natsemi.c | |||
| @@ -860,6 +860,9 @@ static int __devinit natsemi_probe1 (struct pci_dev *pdev, | |||
| 860 | prev_eedata = eedata; | 860 | prev_eedata = eedata; |
| 861 | } | 861 | } |
| 862 | 862 | ||
| 863 | /* Store MAC Address in perm_addr */ | ||
| 864 | memcpy(dev->perm_addr, dev->dev_addr, ETH_ALEN); | ||
| 865 | |||
| 863 | dev->base_addr = (unsigned long __force) ioaddr; | 866 | dev->base_addr = (unsigned long __force) ioaddr; |
| 864 | dev->irq = irq; | 867 | dev->irq = irq; |
| 865 | 868 | ||
diff --git a/drivers/net/netxen/netxen_nic.h b/drivers/net/netxen/netxen_nic.h index d7299f1a4940..679dc8519c5b 100644 --- a/drivers/net/netxen/netxen_nic.h +++ b/drivers/net/netxen/netxen_nic.h | |||
| @@ -174,7 +174,7 @@ | |||
| 174 | 174 | ||
| 175 | #define MAX_NUM_CARDS 4 | 175 | #define MAX_NUM_CARDS 4 |
| 176 | 176 | ||
| 177 | #define MAX_BUFFERS_PER_CMD 32 | 177 | #define NETXEN_MAX_FRAGS_PER_TX 14 |
| 178 | #define MAX_TSO_HEADER_DESC 2 | 178 | #define MAX_TSO_HEADER_DESC 2 |
| 179 | #define MGMT_CMD_DESC_RESV 4 | 179 | #define MGMT_CMD_DESC_RESV 4 |
| 180 | #define TX_STOP_THRESH ((MAX_SKB_FRAGS >> 2) + MAX_TSO_HEADER_DESC \ | 180 | #define TX_STOP_THRESH ((MAX_SKB_FRAGS >> 2) + MAX_TSO_HEADER_DESC \ |
| @@ -558,7 +558,7 @@ struct netxen_recv_crb { | |||
| 558 | */ | 558 | */ |
| 559 | struct netxen_cmd_buffer { | 559 | struct netxen_cmd_buffer { |
| 560 | struct sk_buff *skb; | 560 | struct sk_buff *skb; |
| 561 | struct netxen_skb_frag frag_array[MAX_BUFFERS_PER_CMD + 1]; | 561 | struct netxen_skb_frag frag_array[MAX_SKB_FRAGS + 1]; |
| 562 | u32 frag_count; | 562 | u32 frag_count; |
| 563 | }; | 563 | }; |
| 564 | 564 | ||
diff --git a/drivers/net/netxen/netxen_nic_main.c b/drivers/net/netxen/netxen_nic_main.c index 83348dc4b184..e8a4b6655999 100644 --- a/drivers/net/netxen/netxen_nic_main.c +++ b/drivers/net/netxen/netxen_nic_main.c | |||
| @@ -1844,6 +1844,8 @@ netxen_nic_xmit_frame(struct sk_buff *skb, struct net_device *netdev) | |||
| 1844 | struct cmd_desc_type0 *hwdesc, *first_desc; | 1844 | struct cmd_desc_type0 *hwdesc, *first_desc; |
| 1845 | struct pci_dev *pdev; | 1845 | struct pci_dev *pdev; |
| 1846 | int i, k; | 1846 | int i, k; |
| 1847 | int delta = 0; | ||
| 1848 | struct skb_frag_struct *frag; | ||
| 1847 | 1849 | ||
| 1848 | u32 producer; | 1850 | u32 producer; |
| 1849 | int frag_count, no_of_desc; | 1851 | int frag_count, no_of_desc; |
| @@ -1851,6 +1853,21 @@ netxen_nic_xmit_frame(struct sk_buff *skb, struct net_device *netdev) | |||
| 1851 | 1853 | ||
| 1852 | frag_count = skb_shinfo(skb)->nr_frags + 1; | 1854 | frag_count = skb_shinfo(skb)->nr_frags + 1; |
| 1853 | 1855 | ||
| 1856 | /* 14 frags supported for normal packet and | ||
| 1857 | * 32 frags supported for TSO packet | ||
| 1858 | */ | ||
| 1859 | if (!skb_is_gso(skb) && frag_count > NETXEN_MAX_FRAGS_PER_TX) { | ||
| 1860 | |||
| 1861 | for (i = 0; i < (frag_count - NETXEN_MAX_FRAGS_PER_TX); i++) { | ||
| 1862 | frag = &skb_shinfo(skb)->frags[i]; | ||
| 1863 | delta += frag->size; | ||
| 1864 | } | ||
| 1865 | |||
| 1866 | if (!__pskb_pull_tail(skb, delta)) | ||
| 1867 | goto drop_packet; | ||
| 1868 | |||
| 1869 | frag_count = 1 + skb_shinfo(skb)->nr_frags; | ||
| 1870 | } | ||
| 1854 | /* 4 fragments per cmd des */ | 1871 | /* 4 fragments per cmd des */ |
| 1855 | no_of_desc = (frag_count + 3) >> 2; | 1872 | no_of_desc = (frag_count + 3) >> 2; |
| 1856 | 1873 | ||
diff --git a/drivers/net/pppoe.c b/drivers/net/pppoe.c index 693aaef4e3ce..718879b35b7d 100644 --- a/drivers/net/pppoe.c +++ b/drivers/net/pppoe.c | |||
| @@ -317,7 +317,7 @@ static void pppoe_flush_dev(struct net_device *dev) | |||
| 317 | lock_sock(sk); | 317 | lock_sock(sk); |
| 318 | 318 | ||
| 319 | if (po->pppoe_dev == dev && | 319 | if (po->pppoe_dev == dev && |
| 320 | sk->sk_state & (PPPOX_CONNECTED | PPPOX_BOUND)) { | 320 | sk->sk_state & (PPPOX_CONNECTED | PPPOX_BOUND | PPPOX_ZOMBIE)) { |
| 321 | pppox_unbind_sock(sk); | 321 | pppox_unbind_sock(sk); |
| 322 | sk->sk_state = PPPOX_ZOMBIE; | 322 | sk->sk_state = PPPOX_ZOMBIE; |
| 323 | sk->sk_state_change(sk); | 323 | sk->sk_state_change(sk); |
diff --git a/drivers/net/qlcnic/qlcnic.h b/drivers/net/qlcnic/qlcnic.h index dc44564ef6f9..b0dead00b2d1 100644 --- a/drivers/net/qlcnic/qlcnic.h +++ b/drivers/net/qlcnic/qlcnic.h | |||
| @@ -99,6 +99,7 @@ | |||
| 99 | #define TX_UDPV6_PKT 0x0c | 99 | #define TX_UDPV6_PKT 0x0c |
| 100 | 100 | ||
| 101 | /* Tx defines */ | 101 | /* Tx defines */ |
| 102 | #define QLCNIC_MAX_FRAGS_PER_TX 14 | ||
| 102 | #define MAX_TSO_HEADER_DESC 2 | 103 | #define MAX_TSO_HEADER_DESC 2 |
| 103 | #define MGMT_CMD_DESC_RESV 4 | 104 | #define MGMT_CMD_DESC_RESV 4 |
| 104 | #define TX_STOP_THRESH ((MAX_SKB_FRAGS >> 2) + MAX_TSO_HEADER_DESC \ | 105 | #define TX_STOP_THRESH ((MAX_SKB_FRAGS >> 2) + MAX_TSO_HEADER_DESC \ |
diff --git a/drivers/net/qlcnic/qlcnic_main.c b/drivers/net/qlcnic/qlcnic_main.c index cd88c7e1bfa9..cb1a1ef36c0a 100644 --- a/drivers/net/qlcnic/qlcnic_main.c +++ b/drivers/net/qlcnic/qlcnic_main.c | |||
| @@ -2099,6 +2099,7 @@ qlcnic_xmit_frame(struct sk_buff *skb, struct net_device *netdev) | |||
| 2099 | struct cmd_desc_type0 *hwdesc, *first_desc; | 2099 | struct cmd_desc_type0 *hwdesc, *first_desc; |
| 2100 | struct pci_dev *pdev; | 2100 | struct pci_dev *pdev; |
| 2101 | struct ethhdr *phdr; | 2101 | struct ethhdr *phdr; |
| 2102 | int delta = 0; | ||
| 2102 | int i, k; | 2103 | int i, k; |
| 2103 | 2104 | ||
| 2104 | u32 producer; | 2105 | u32 producer; |
| @@ -2118,6 +2119,19 @@ qlcnic_xmit_frame(struct sk_buff *skb, struct net_device *netdev) | |||
| 2118 | } | 2119 | } |
| 2119 | 2120 | ||
| 2120 | frag_count = skb_shinfo(skb)->nr_frags + 1; | 2121 | frag_count = skb_shinfo(skb)->nr_frags + 1; |
| 2122 | /* 14 frags supported for normal packet and | ||
| 2123 | * 32 frags supported for TSO packet | ||
| 2124 | */ | ||
| 2125 | if (!skb_is_gso(skb) && frag_count > QLCNIC_MAX_FRAGS_PER_TX) { | ||
| 2126 | |||
| 2127 | for (i = 0; i < (frag_count - QLCNIC_MAX_FRAGS_PER_TX); i++) | ||
| 2128 | delta += skb_shinfo(skb)->frags[i].size; | ||
| 2129 | |||
| 2130 | if (!__pskb_pull_tail(skb, delta)) | ||
| 2131 | goto drop_packet; | ||
| 2132 | |||
| 2133 | frag_count = 1 + skb_shinfo(skb)->nr_frags; | ||
| 2134 | } | ||
| 2121 | 2135 | ||
| 2122 | /* 4 fragments per cmd des */ | 2136 | /* 4 fragments per cmd des */ |
| 2123 | no_of_desc = (frag_count + 3) >> 2; | 2137 | no_of_desc = (frag_count + 3) >> 2; |
diff --git a/drivers/net/sfc/efx.c b/drivers/net/sfc/efx.c index d890679e4c4d..a3c2aab53de8 100644 --- a/drivers/net/sfc/efx.c +++ b/drivers/net/sfc/efx.c | |||
| @@ -328,7 +328,8 @@ static int efx_poll(struct napi_struct *napi, int budget) | |||
| 328 | * processing to finish, then directly poll (and ack ) the eventq. | 328 | * processing to finish, then directly poll (and ack ) the eventq. |
| 329 | * Finally reenable NAPI and interrupts. | 329 | * Finally reenable NAPI and interrupts. |
| 330 | * | 330 | * |
| 331 | * Since we are touching interrupts the caller should hold the suspend lock | 331 | * This is for use only during a loopback self-test. It must not |
| 332 | * deliver any packets up the stack as this can result in deadlock. | ||
| 332 | */ | 333 | */ |
| 333 | void efx_process_channel_now(struct efx_channel *channel) | 334 | void efx_process_channel_now(struct efx_channel *channel) |
| 334 | { | 335 | { |
| @@ -336,6 +337,7 @@ void efx_process_channel_now(struct efx_channel *channel) | |||
| 336 | 337 | ||
| 337 | BUG_ON(channel->channel >= efx->n_channels); | 338 | BUG_ON(channel->channel >= efx->n_channels); |
| 338 | BUG_ON(!channel->enabled); | 339 | BUG_ON(!channel->enabled); |
| 340 | BUG_ON(!efx->loopback_selftest); | ||
| 339 | 341 | ||
| 340 | /* Disable interrupts and wait for ISRs to complete */ | 342 | /* Disable interrupts and wait for ISRs to complete */ |
| 341 | efx_nic_disable_interrupts(efx); | 343 | efx_nic_disable_interrupts(efx); |
| @@ -1436,7 +1438,7 @@ static void efx_start_all(struct efx_nic *efx) | |||
| 1436 | * restart the transmit interface early so the watchdog timer stops */ | 1438 | * restart the transmit interface early so the watchdog timer stops */ |
| 1437 | efx_start_port(efx); | 1439 | efx_start_port(efx); |
| 1438 | 1440 | ||
| 1439 | if (efx_dev_registered(efx)) | 1441 | if (efx_dev_registered(efx) && !efx->port_inhibited) |
| 1440 | netif_tx_wake_all_queues(efx->net_dev); | 1442 | netif_tx_wake_all_queues(efx->net_dev); |
| 1441 | 1443 | ||
| 1442 | efx_for_each_channel(channel, efx) | 1444 | efx_for_each_channel(channel, efx) |
diff --git a/drivers/net/sfc/io.h b/drivers/net/sfc/io.h index d9d8c2ef1074..cc978803d484 100644 --- a/drivers/net/sfc/io.h +++ b/drivers/net/sfc/io.h | |||
| @@ -152,6 +152,7 @@ static inline void efx_reado(struct efx_nic *efx, efx_oword_t *value, | |||
| 152 | 152 | ||
| 153 | spin_lock_irqsave(&efx->biu_lock, flags); | 153 | spin_lock_irqsave(&efx->biu_lock, flags); |
| 154 | value->u32[0] = _efx_readd(efx, reg + 0); | 154 | value->u32[0] = _efx_readd(efx, reg + 0); |
| 155 | rmb(); | ||
| 155 | value->u32[1] = _efx_readd(efx, reg + 4); | 156 | value->u32[1] = _efx_readd(efx, reg + 4); |
| 156 | value->u32[2] = _efx_readd(efx, reg + 8); | 157 | value->u32[2] = _efx_readd(efx, reg + 8); |
| 157 | value->u32[3] = _efx_readd(efx, reg + 12); | 158 | value->u32[3] = _efx_readd(efx, reg + 12); |
| @@ -174,6 +175,7 @@ static inline void efx_sram_readq(struct efx_nic *efx, void __iomem *membase, | |||
| 174 | value->u64[0] = (__force __le64)__raw_readq(membase + addr); | 175 | value->u64[0] = (__force __le64)__raw_readq(membase + addr); |
| 175 | #else | 176 | #else |
| 176 | value->u32[0] = (__force __le32)__raw_readl(membase + addr); | 177 | value->u32[0] = (__force __le32)__raw_readl(membase + addr); |
| 178 | rmb(); | ||
| 177 | value->u32[1] = (__force __le32)__raw_readl(membase + addr + 4); | 179 | value->u32[1] = (__force __le32)__raw_readl(membase + addr + 4); |
| 178 | #endif | 180 | #endif |
| 179 | spin_unlock_irqrestore(&efx->biu_lock, flags); | 181 | spin_unlock_irqrestore(&efx->biu_lock, flags); |
diff --git a/drivers/net/sfc/net_driver.h b/drivers/net/sfc/net_driver.h index 9ffa9a6b55a0..191a311da2dc 100644 --- a/drivers/net/sfc/net_driver.h +++ b/drivers/net/sfc/net_driver.h | |||
| @@ -330,7 +330,6 @@ enum efx_rx_alloc_method { | |||
| 330 | * @eventq_mask: Event queue pointer mask | 330 | * @eventq_mask: Event queue pointer mask |
| 331 | * @eventq_read_ptr: Event queue read pointer | 331 | * @eventq_read_ptr: Event queue read pointer |
| 332 | * @last_eventq_read_ptr: Last event queue read pointer value. | 332 | * @last_eventq_read_ptr: Last event queue read pointer value. |
| 333 | * @magic_count: Event queue test event count | ||
| 334 | * @irq_count: Number of IRQs since last adaptive moderation decision | 333 | * @irq_count: Number of IRQs since last adaptive moderation decision |
| 335 | * @irq_mod_score: IRQ moderation score | 334 | * @irq_mod_score: IRQ moderation score |
| 336 | * @rx_alloc_level: Watermark based heuristic counter for pushing descriptors | 335 | * @rx_alloc_level: Watermark based heuristic counter for pushing descriptors |
| @@ -360,7 +359,6 @@ struct efx_channel { | |||
| 360 | unsigned int eventq_mask; | 359 | unsigned int eventq_mask; |
| 361 | unsigned int eventq_read_ptr; | 360 | unsigned int eventq_read_ptr; |
| 362 | unsigned int last_eventq_read_ptr; | 361 | unsigned int last_eventq_read_ptr; |
| 363 | unsigned int magic_count; | ||
| 364 | 362 | ||
| 365 | unsigned int irq_count; | 363 | unsigned int irq_count; |
| 366 | unsigned int irq_mod_score; | 364 | unsigned int irq_mod_score; |
diff --git a/drivers/net/sfc/nic.c b/drivers/net/sfc/nic.c index e8396614daf3..10f1cb79c147 100644 --- a/drivers/net/sfc/nic.c +++ b/drivers/net/sfc/nic.c | |||
| @@ -84,7 +84,8 @@ static inline void efx_write_buf_tbl(struct efx_nic *efx, efx_qword_t *value, | |||
| 84 | static inline efx_qword_t *efx_event(struct efx_channel *channel, | 84 | static inline efx_qword_t *efx_event(struct efx_channel *channel, |
| 85 | unsigned int index) | 85 | unsigned int index) |
| 86 | { | 86 | { |
| 87 | return ((efx_qword_t *) (channel->eventq.addr)) + index; | 87 | return ((efx_qword_t *) (channel->eventq.addr)) + |
| 88 | (index & channel->eventq_mask); | ||
| 88 | } | 89 | } |
| 89 | 90 | ||
| 90 | /* See if an event is present | 91 | /* See if an event is present |
| @@ -673,7 +674,8 @@ void efx_nic_eventq_read_ack(struct efx_channel *channel) | |||
| 673 | efx_dword_t reg; | 674 | efx_dword_t reg; |
| 674 | struct efx_nic *efx = channel->efx; | 675 | struct efx_nic *efx = channel->efx; |
| 675 | 676 | ||
| 676 | EFX_POPULATE_DWORD_1(reg, FRF_AZ_EVQ_RPTR, channel->eventq_read_ptr); | 677 | EFX_POPULATE_DWORD_1(reg, FRF_AZ_EVQ_RPTR, |
| 678 | channel->eventq_read_ptr & channel->eventq_mask); | ||
| 677 | efx_writed_table(efx, ®, efx->type->evq_rptr_tbl_base, | 679 | efx_writed_table(efx, ®, efx->type->evq_rptr_tbl_base, |
| 678 | channel->channel); | 680 | channel->channel); |
| 679 | } | 681 | } |
| @@ -908,7 +910,7 @@ efx_handle_generated_event(struct efx_channel *channel, efx_qword_t *event) | |||
| 908 | 910 | ||
| 909 | code = EFX_QWORD_FIELD(*event, FSF_AZ_DRV_GEN_EV_MAGIC); | 911 | code = EFX_QWORD_FIELD(*event, FSF_AZ_DRV_GEN_EV_MAGIC); |
| 910 | if (code == EFX_CHANNEL_MAGIC_TEST(channel)) | 912 | if (code == EFX_CHANNEL_MAGIC_TEST(channel)) |
| 911 | ++channel->magic_count; | 913 | ; /* ignore */ |
| 912 | else if (code == EFX_CHANNEL_MAGIC_FILL(channel)) | 914 | else if (code == EFX_CHANNEL_MAGIC_FILL(channel)) |
| 913 | /* The queue must be empty, so we won't receive any rx | 915 | /* The queue must be empty, so we won't receive any rx |
| 914 | * events, so efx_process_channel() won't refill the | 916 | * events, so efx_process_channel() won't refill the |
| @@ -1015,8 +1017,7 @@ int efx_nic_process_eventq(struct efx_channel *channel, int budget) | |||
| 1015 | /* Clear this event by marking it all ones */ | 1017 | /* Clear this event by marking it all ones */ |
| 1016 | EFX_SET_QWORD(*p_event); | 1018 | EFX_SET_QWORD(*p_event); |
| 1017 | 1019 | ||
| 1018 | /* Increment read pointer */ | 1020 | ++read_ptr; |
| 1019 | read_ptr = (read_ptr + 1) & channel->eventq_mask; | ||
| 1020 | 1021 | ||
| 1021 | ev_code = EFX_QWORD_FIELD(event, FSF_AZ_EV_CODE); | 1022 | ev_code = EFX_QWORD_FIELD(event, FSF_AZ_EV_CODE); |
| 1022 | 1023 | ||
| @@ -1060,6 +1061,13 @@ out: | |||
| 1060 | return spent; | 1061 | return spent; |
| 1061 | } | 1062 | } |
| 1062 | 1063 | ||
| 1064 | /* Check whether an event is present in the eventq at the current | ||
| 1065 | * read pointer. Only useful for self-test. | ||
| 1066 | */ | ||
| 1067 | bool efx_nic_event_present(struct efx_channel *channel) | ||
| 1068 | { | ||
| 1069 | return efx_event_present(efx_event(channel, channel->eventq_read_ptr)); | ||
| 1070 | } | ||
| 1063 | 1071 | ||
| 1064 | /* Allocate buffer table entries for event queue */ | 1072 | /* Allocate buffer table entries for event queue */ |
| 1065 | int efx_nic_probe_eventq(struct efx_channel *channel) | 1073 | int efx_nic_probe_eventq(struct efx_channel *channel) |
| @@ -1165,7 +1173,7 @@ static void efx_poll_flush_events(struct efx_nic *efx) | |||
| 1165 | struct efx_tx_queue *tx_queue; | 1173 | struct efx_tx_queue *tx_queue; |
| 1166 | struct efx_rx_queue *rx_queue; | 1174 | struct efx_rx_queue *rx_queue; |
| 1167 | unsigned int read_ptr = channel->eventq_read_ptr; | 1175 | unsigned int read_ptr = channel->eventq_read_ptr; |
| 1168 | unsigned int end_ptr = (read_ptr - 1) & channel->eventq_mask; | 1176 | unsigned int end_ptr = read_ptr + channel->eventq_mask - 1; |
| 1169 | 1177 | ||
| 1170 | do { | 1178 | do { |
| 1171 | efx_qword_t *event = efx_event(channel, read_ptr); | 1179 | efx_qword_t *event = efx_event(channel, read_ptr); |
| @@ -1205,7 +1213,7 @@ static void efx_poll_flush_events(struct efx_nic *efx) | |||
| 1205 | * it's ok to throw away every non-flush event */ | 1213 | * it's ok to throw away every non-flush event */ |
| 1206 | EFX_SET_QWORD(*event); | 1214 | EFX_SET_QWORD(*event); |
| 1207 | 1215 | ||
| 1208 | read_ptr = (read_ptr + 1) & channel->eventq_mask; | 1216 | ++read_ptr; |
| 1209 | } while (read_ptr != end_ptr); | 1217 | } while (read_ptr != end_ptr); |
| 1210 | 1218 | ||
| 1211 | channel->eventq_read_ptr = read_ptr; | 1219 | channel->eventq_read_ptr = read_ptr; |
diff --git a/drivers/net/sfc/nic.h b/drivers/net/sfc/nic.h index d9de1b647d41..a42db6e35be3 100644 --- a/drivers/net/sfc/nic.h +++ b/drivers/net/sfc/nic.h | |||
| @@ -184,6 +184,7 @@ extern void efx_nic_fini_eventq(struct efx_channel *channel); | |||
| 184 | extern void efx_nic_remove_eventq(struct efx_channel *channel); | 184 | extern void efx_nic_remove_eventq(struct efx_channel *channel); |
| 185 | extern int efx_nic_process_eventq(struct efx_channel *channel, int rx_quota); | 185 | extern int efx_nic_process_eventq(struct efx_channel *channel, int rx_quota); |
| 186 | extern void efx_nic_eventq_read_ack(struct efx_channel *channel); | 186 | extern void efx_nic_eventq_read_ack(struct efx_channel *channel); |
| 187 | extern bool efx_nic_event_present(struct efx_channel *channel); | ||
| 187 | 188 | ||
| 188 | /* MAC/PHY */ | 189 | /* MAC/PHY */ |
| 189 | extern void falcon_drain_tx_fifo(struct efx_nic *efx); | 190 | extern void falcon_drain_tx_fifo(struct efx_nic *efx); |
diff --git a/drivers/net/sfc/selftest.c b/drivers/net/sfc/selftest.c index a0f49b348d62..50ad3bcaf68a 100644 --- a/drivers/net/sfc/selftest.c +++ b/drivers/net/sfc/selftest.c | |||
| @@ -131,8 +131,6 @@ static int efx_test_chip(struct efx_nic *efx, struct efx_self_tests *tests) | |||
| 131 | static int efx_test_interrupts(struct efx_nic *efx, | 131 | static int efx_test_interrupts(struct efx_nic *efx, |
| 132 | struct efx_self_tests *tests) | 132 | struct efx_self_tests *tests) |
| 133 | { | 133 | { |
| 134 | struct efx_channel *channel; | ||
| 135 | |||
| 136 | netif_dbg(efx, drv, efx->net_dev, "testing interrupts\n"); | 134 | netif_dbg(efx, drv, efx->net_dev, "testing interrupts\n"); |
| 137 | tests->interrupt = -1; | 135 | tests->interrupt = -1; |
| 138 | 136 | ||
| @@ -140,15 +138,6 @@ static int efx_test_interrupts(struct efx_nic *efx, | |||
| 140 | efx->last_irq_cpu = -1; | 138 | efx->last_irq_cpu = -1; |
| 141 | smp_wmb(); | 139 | smp_wmb(); |
| 142 | 140 | ||
| 143 | /* ACK each interrupting event queue. Receiving an interrupt due to | ||
| 144 | * traffic before a test event is raised is considered a pass */ | ||
| 145 | efx_for_each_channel(channel, efx) { | ||
| 146 | if (channel->work_pending) | ||
| 147 | efx_process_channel_now(channel); | ||
| 148 | if (efx->last_irq_cpu >= 0) | ||
| 149 | goto success; | ||
| 150 | } | ||
| 151 | |||
| 152 | efx_nic_generate_interrupt(efx); | 141 | efx_nic_generate_interrupt(efx); |
| 153 | 142 | ||
| 154 | /* Wait for arrival of test interrupt. */ | 143 | /* Wait for arrival of test interrupt. */ |
| @@ -173,13 +162,13 @@ static int efx_test_eventq_irq(struct efx_channel *channel, | |||
| 173 | struct efx_self_tests *tests) | 162 | struct efx_self_tests *tests) |
| 174 | { | 163 | { |
| 175 | struct efx_nic *efx = channel->efx; | 164 | struct efx_nic *efx = channel->efx; |
| 176 | unsigned int magic_count, count; | 165 | unsigned int read_ptr, count; |
| 177 | 166 | ||
| 178 | tests->eventq_dma[channel->channel] = -1; | 167 | tests->eventq_dma[channel->channel] = -1; |
| 179 | tests->eventq_int[channel->channel] = -1; | 168 | tests->eventq_int[channel->channel] = -1; |
| 180 | tests->eventq_poll[channel->channel] = -1; | 169 | tests->eventq_poll[channel->channel] = -1; |
| 181 | 170 | ||
| 182 | magic_count = channel->magic_count; | 171 | read_ptr = channel->eventq_read_ptr; |
| 183 | channel->efx->last_irq_cpu = -1; | 172 | channel->efx->last_irq_cpu = -1; |
| 184 | smp_wmb(); | 173 | smp_wmb(); |
| 185 | 174 | ||
| @@ -190,10 +179,7 @@ static int efx_test_eventq_irq(struct efx_channel *channel, | |||
| 190 | do { | 179 | do { |
| 191 | schedule_timeout_uninterruptible(HZ / 100); | 180 | schedule_timeout_uninterruptible(HZ / 100); |
| 192 | 181 | ||
| 193 | if (channel->work_pending) | 182 | if (ACCESS_ONCE(channel->eventq_read_ptr) != read_ptr) |
| 194 | efx_process_channel_now(channel); | ||
| 195 | |||
| 196 | if (channel->magic_count != magic_count) | ||
| 197 | goto eventq_ok; | 183 | goto eventq_ok; |
| 198 | } while (++count < 2); | 184 | } while (++count < 2); |
| 199 | 185 | ||
| @@ -211,8 +197,7 @@ static int efx_test_eventq_irq(struct efx_channel *channel, | |||
| 211 | } | 197 | } |
| 212 | 198 | ||
| 213 | /* Check to see if event was received even if interrupt wasn't */ | 199 | /* Check to see if event was received even if interrupt wasn't */ |
| 214 | efx_process_channel_now(channel); | 200 | if (efx_nic_event_present(channel)) { |
| 215 | if (channel->magic_count != magic_count) { | ||
| 216 | netif_err(efx, drv, efx->net_dev, | 201 | netif_err(efx, drv, efx->net_dev, |
| 217 | "channel %d event was generated, but " | 202 | "channel %d event was generated, but " |
| 218 | "failed to trigger an interrupt\n", channel->channel); | 203 | "failed to trigger an interrupt\n", channel->channel); |
| @@ -770,6 +755,8 @@ int efx_selftest(struct efx_nic *efx, struct efx_self_tests *tests, | |||
| 770 | __efx_reconfigure_port(efx); | 755 | __efx_reconfigure_port(efx); |
| 771 | mutex_unlock(&efx->mac_lock); | 756 | mutex_unlock(&efx->mac_lock); |
| 772 | 757 | ||
| 758 | netif_tx_wake_all_queues(efx->net_dev); | ||
| 759 | |||
| 773 | return rc_test; | 760 | return rc_test; |
| 774 | } | 761 | } |
| 775 | 762 | ||
diff --git a/drivers/net/sfc/tx.c b/drivers/net/sfc/tx.c index 139801908217..d2c85dfdf3bf 100644 --- a/drivers/net/sfc/tx.c +++ b/drivers/net/sfc/tx.c | |||
| @@ -435,7 +435,8 @@ void efx_xmit_done(struct efx_tx_queue *tx_queue, unsigned int index) | |||
| 435 | * queue state. */ | 435 | * queue state. */ |
| 436 | smp_mb(); | 436 | smp_mb(); |
| 437 | if (unlikely(netif_tx_queue_stopped(tx_queue->core_txq)) && | 437 | if (unlikely(netif_tx_queue_stopped(tx_queue->core_txq)) && |
| 438 | likely(efx->port_enabled)) { | 438 | likely(efx->port_enabled) && |
| 439 | likely(!efx->port_inhibited)) { | ||
| 439 | fill_level = tx_queue->insert_count - tx_queue->read_count; | 440 | fill_level = tx_queue->insert_count - tx_queue->read_count; |
| 440 | if (fill_level < EFX_TXQ_THRESHOLD(efx)) { | 441 | if (fill_level < EFX_TXQ_THRESHOLD(efx)) { |
| 441 | EFX_BUG_ON_PARANOID(!efx_dev_registered(efx)); | 442 | EFX_BUG_ON_PARANOID(!efx_dev_registered(efx)); |
diff --git a/drivers/net/sis900.c b/drivers/net/sis900.c index cb317cd069ff..484f795a779d 100644 --- a/drivers/net/sis900.c +++ b/drivers/net/sis900.c | |||
| @@ -240,7 +240,8 @@ static const struct ethtool_ops sis900_ethtool_ops; | |||
| 240 | * @net_dev: the net device to get address for | 240 | * @net_dev: the net device to get address for |
| 241 | * | 241 | * |
| 242 | * Older SiS900 and friends, use EEPROM to store MAC address. | 242 | * Older SiS900 and friends, use EEPROM to store MAC address. |
| 243 | * MAC address is read from read_eeprom() into @net_dev->dev_addr. | 243 | * MAC address is read from read_eeprom() into @net_dev->dev_addr and |
| 244 | * @net_dev->perm_addr. | ||
| 244 | */ | 245 | */ |
| 245 | 246 | ||
| 246 | static int __devinit sis900_get_mac_addr(struct pci_dev * pci_dev, struct net_device *net_dev) | 247 | static int __devinit sis900_get_mac_addr(struct pci_dev * pci_dev, struct net_device *net_dev) |
| @@ -261,6 +262,9 @@ static int __devinit sis900_get_mac_addr(struct pci_dev * pci_dev, struct net_de | |||
| 261 | for (i = 0; i < 3; i++) | 262 | for (i = 0; i < 3; i++) |
| 262 | ((u16 *)(net_dev->dev_addr))[i] = read_eeprom(ioaddr, i+EEPROMMACAddr); | 263 | ((u16 *)(net_dev->dev_addr))[i] = read_eeprom(ioaddr, i+EEPROMMACAddr); |
| 263 | 264 | ||
| 265 | /* Store MAC Address in perm_addr */ | ||
| 266 | memcpy(net_dev->perm_addr, net_dev->dev_addr, ETH_ALEN); | ||
| 267 | |||
| 264 | return 1; | 268 | return 1; |
| 265 | } | 269 | } |
| 266 | 270 | ||
| @@ -271,7 +275,8 @@ static int __devinit sis900_get_mac_addr(struct pci_dev * pci_dev, struct net_de | |||
| 271 | * | 275 | * |
| 272 | * SiS630E model, use APC CMOS RAM to store MAC address. | 276 | * SiS630E model, use APC CMOS RAM to store MAC address. |
| 273 | * APC CMOS RAM is accessed through ISA bridge. | 277 | * APC CMOS RAM is accessed through ISA bridge. |
| 274 | * MAC address is read into @net_dev->dev_addr. | 278 | * MAC address is read into @net_dev->dev_addr and |
| 279 | * @net_dev->perm_addr. | ||
| 275 | */ | 280 | */ |
| 276 | 281 | ||
| 277 | static int __devinit sis630e_get_mac_addr(struct pci_dev * pci_dev, | 282 | static int __devinit sis630e_get_mac_addr(struct pci_dev * pci_dev, |
| @@ -296,6 +301,10 @@ static int __devinit sis630e_get_mac_addr(struct pci_dev * pci_dev, | |||
| 296 | outb(0x09 + i, 0x70); | 301 | outb(0x09 + i, 0x70); |
| 297 | ((u8 *)(net_dev->dev_addr))[i] = inb(0x71); | 302 | ((u8 *)(net_dev->dev_addr))[i] = inb(0x71); |
| 298 | } | 303 | } |
| 304 | |||
| 305 | /* Store MAC Address in perm_addr */ | ||
| 306 | memcpy(net_dev->perm_addr, net_dev->dev_addr, ETH_ALEN); | ||
| 307 | |||
| 299 | pci_write_config_byte(isa_bridge, 0x48, reg & ~0x40); | 308 | pci_write_config_byte(isa_bridge, 0x48, reg & ~0x40); |
| 300 | pci_dev_put(isa_bridge); | 309 | pci_dev_put(isa_bridge); |
| 301 | 310 | ||
| @@ -310,7 +319,7 @@ static int __devinit sis630e_get_mac_addr(struct pci_dev * pci_dev, | |||
| 310 | * | 319 | * |
| 311 | * SiS635 model, set MAC Reload Bit to load Mac address from APC | 320 | * SiS635 model, set MAC Reload Bit to load Mac address from APC |
| 312 | * to rfdr. rfdr is accessed through rfcr. MAC address is read into | 321 | * to rfdr. rfdr is accessed through rfcr. MAC address is read into |
| 313 | * @net_dev->dev_addr. | 322 | * @net_dev->dev_addr and @net_dev->perm_addr. |
| 314 | */ | 323 | */ |
| 315 | 324 | ||
| 316 | static int __devinit sis635_get_mac_addr(struct pci_dev * pci_dev, | 325 | static int __devinit sis635_get_mac_addr(struct pci_dev * pci_dev, |
| @@ -334,6 +343,9 @@ static int __devinit sis635_get_mac_addr(struct pci_dev * pci_dev, | |||
| 334 | *( ((u16 *)net_dev->dev_addr) + i) = inw(ioaddr + rfdr); | 343 | *( ((u16 *)net_dev->dev_addr) + i) = inw(ioaddr + rfdr); |
| 335 | } | 344 | } |
| 336 | 345 | ||
| 346 | /* Store MAC Address in perm_addr */ | ||
| 347 | memcpy(net_dev->perm_addr, net_dev->dev_addr, ETH_ALEN); | ||
| 348 | |||
| 337 | /* enable packet filtering */ | 349 | /* enable packet filtering */ |
| 338 | outl(rfcrSave | RFEN, rfcr + ioaddr); | 350 | outl(rfcrSave | RFEN, rfcr + ioaddr); |
| 339 | 351 | ||
| @@ -353,7 +365,7 @@ static int __devinit sis635_get_mac_addr(struct pci_dev * pci_dev, | |||
| 353 | * EEDONE signal to refuse EEPROM access by LAN. | 365 | * EEDONE signal to refuse EEPROM access by LAN. |
| 354 | * The EEPROM map of SiS962 or SiS963 is different to SiS900. | 366 | * The EEPROM map of SiS962 or SiS963 is different to SiS900. |
| 355 | * The signature field in SiS962 or SiS963 spec is meaningless. | 367 | * The signature field in SiS962 or SiS963 spec is meaningless. |
| 356 | * MAC address is read into @net_dev->dev_addr. | 368 | * MAC address is read into @net_dev->dev_addr and @net_dev->perm_addr. |
| 357 | */ | 369 | */ |
| 358 | 370 | ||
| 359 | static int __devinit sis96x_get_mac_addr(struct pci_dev * pci_dev, | 371 | static int __devinit sis96x_get_mac_addr(struct pci_dev * pci_dev, |
| @@ -372,6 +384,9 @@ static int __devinit sis96x_get_mac_addr(struct pci_dev * pci_dev, | |||
| 372 | for (i = 0; i < 3; i++) | 384 | for (i = 0; i < 3; i++) |
| 373 | ((u16 *)(net_dev->dev_addr))[i] = read_eeprom(ioaddr, i+EEPROMMACAddr); | 385 | ((u16 *)(net_dev->dev_addr))[i] = read_eeprom(ioaddr, i+EEPROMMACAddr); |
| 374 | 386 | ||
| 387 | /* Store MAC Address in perm_addr */ | ||
| 388 | memcpy(net_dev->perm_addr, net_dev->dev_addr, ETH_ALEN); | ||
| 389 | |||
| 375 | outl(EEDONE, ee_addr); | 390 | outl(EEDONE, ee_addr); |
| 376 | return 1; | 391 | return 1; |
| 377 | } else { | 392 | } else { |
diff --git a/drivers/net/smsc911x.c b/drivers/net/smsc911x.c index c498b720b532..4b42ecc63dcf 100644 --- a/drivers/net/smsc911x.c +++ b/drivers/net/smsc911x.c | |||
| @@ -1818,6 +1818,7 @@ static int __devinit smsc911x_init(struct net_device *dev) | |||
| 1818 | SMSC_TRACE(PROBE, "PHY will be autodetected."); | 1818 | SMSC_TRACE(PROBE, "PHY will be autodetected."); |
| 1819 | 1819 | ||
| 1820 | spin_lock_init(&pdata->dev_lock); | 1820 | spin_lock_init(&pdata->dev_lock); |
| 1821 | spin_lock_init(&pdata->mac_lock); | ||
| 1821 | 1822 | ||
| 1822 | if (pdata->ioaddr == 0) { | 1823 | if (pdata->ioaddr == 0) { |
| 1823 | SMSC_WARNING(PROBE, "pdata->ioaddr: 0x00000000"); | 1824 | SMSC_WARNING(PROBE, "pdata->ioaddr: 0x00000000"); |
| @@ -1895,8 +1896,11 @@ static int __devinit smsc911x_init(struct net_device *dev) | |||
| 1895 | /* workaround for platforms without an eeprom, where the mac address | 1896 | /* workaround for platforms without an eeprom, where the mac address |
| 1896 | * is stored elsewhere and set by the bootloader. This saves the | 1897 | * is stored elsewhere and set by the bootloader. This saves the |
| 1897 | * mac address before resetting the device */ | 1898 | * mac address before resetting the device */ |
| 1898 | if (pdata->config.flags & SMSC911X_SAVE_MAC_ADDRESS) | 1899 | if (pdata->config.flags & SMSC911X_SAVE_MAC_ADDRESS) { |
| 1900 | spin_lock_irq(&pdata->mac_lock); | ||
| 1899 | smsc911x_read_mac_address(dev); | 1901 | smsc911x_read_mac_address(dev); |
| 1902 | spin_unlock_irq(&pdata->mac_lock); | ||
| 1903 | } | ||
| 1900 | 1904 | ||
| 1901 | /* Reset the LAN911x */ | 1905 | /* Reset the LAN911x */ |
| 1902 | if (smsc911x_soft_reset(pdata)) | 1906 | if (smsc911x_soft_reset(pdata)) |
| @@ -2059,8 +2063,6 @@ static int __devinit smsc911x_drv_probe(struct platform_device *pdev) | |||
| 2059 | SMSC_TRACE(PROBE, "Network interface: \"%s\"", dev->name); | 2063 | SMSC_TRACE(PROBE, "Network interface: \"%s\"", dev->name); |
| 2060 | } | 2064 | } |
| 2061 | 2065 | ||
| 2062 | spin_lock_init(&pdata->mac_lock); | ||
| 2063 | |||
| 2064 | retval = smsc911x_mii_init(pdev, dev); | 2066 | retval = smsc911x_mii_init(pdev, dev); |
| 2065 | if (retval) { | 2067 | if (retval) { |
| 2066 | SMSC_WARNING(PROBE, | 2068 | SMSC_WARNING(PROBE, |
diff --git a/drivers/net/stmmac/dwmac_lib.c b/drivers/net/stmmac/dwmac_lib.c index d65fab1ba790..e25093510b0c 100644 --- a/drivers/net/stmmac/dwmac_lib.c +++ b/drivers/net/stmmac/dwmac_lib.c | |||
| @@ -26,9 +26,9 @@ | |||
| 26 | 26 | ||
| 27 | #undef DWMAC_DMA_DEBUG | 27 | #undef DWMAC_DMA_DEBUG |
| 28 | #ifdef DWMAC_DMA_DEBUG | 28 | #ifdef DWMAC_DMA_DEBUG |
| 29 | #define DBG(fmt, args...) printk(fmt, ## args) | 29 | #define DWMAC_LIB_DBG(fmt, args...) printk(fmt, ## args) |
| 30 | #else | 30 | #else |
| 31 | #define DBG(fmt, args...) do { } while (0) | 31 | #define DWMAC_LIB_DBG(fmt, args...) do { } while (0) |
| 32 | #endif | 32 | #endif |
| 33 | 33 | ||
| 34 | /* CSR1 enables the transmit DMA to check for new descriptor */ | 34 | /* CSR1 enables the transmit DMA to check for new descriptor */ |
| @@ -152,7 +152,7 @@ int dwmac_dma_interrupt(void __iomem *ioaddr, | |||
| 152 | /* read the status register (CSR5) */ | 152 | /* read the status register (CSR5) */ |
| 153 | u32 intr_status = readl(ioaddr + DMA_STATUS); | 153 | u32 intr_status = readl(ioaddr + DMA_STATUS); |
| 154 | 154 | ||
| 155 | DBG(INFO, "%s: [CSR5: 0x%08x]\n", __func__, intr_status); | 155 | DWMAC_LIB_DBG(KERN_INFO "%s: [CSR5: 0x%08x]\n", __func__, intr_status); |
| 156 | #ifdef DWMAC_DMA_DEBUG | 156 | #ifdef DWMAC_DMA_DEBUG |
| 157 | /* It displays the DMA process states (CSR5 register) */ | 157 | /* It displays the DMA process states (CSR5 register) */ |
| 158 | show_tx_process_state(intr_status); | 158 | show_tx_process_state(intr_status); |
| @@ -160,43 +160,43 @@ int dwmac_dma_interrupt(void __iomem *ioaddr, | |||
| 160 | #endif | 160 | #endif |
| 161 | /* ABNORMAL interrupts */ | 161 | /* ABNORMAL interrupts */ |
| 162 | if (unlikely(intr_status & DMA_STATUS_AIS)) { | 162 | if (unlikely(intr_status & DMA_STATUS_AIS)) { |
| 163 | DBG(INFO, "CSR5[15] DMA ABNORMAL IRQ: "); | 163 | DWMAC_LIB_DBG(KERN_INFO "CSR5[15] DMA ABNORMAL IRQ: "); |
| 164 | if (unlikely(intr_status & DMA_STATUS_UNF)) { | 164 | if (unlikely(intr_status & DMA_STATUS_UNF)) { |
| 165 | DBG(INFO, "transmit underflow\n"); | 165 | DWMAC_LIB_DBG(KERN_INFO "transmit underflow\n"); |
| 166 | ret = tx_hard_error_bump_tc; | 166 | ret = tx_hard_error_bump_tc; |
| 167 | x->tx_undeflow_irq++; | 167 | x->tx_undeflow_irq++; |
| 168 | } | 168 | } |
| 169 | if (unlikely(intr_status & DMA_STATUS_TJT)) { | 169 | if (unlikely(intr_status & DMA_STATUS_TJT)) { |
| 170 | DBG(INFO, "transmit jabber\n"); | 170 | DWMAC_LIB_DBG(KERN_INFO "transmit jabber\n"); |
| 171 | x->tx_jabber_irq++; | 171 | x->tx_jabber_irq++; |
| 172 | } | 172 | } |
| 173 | if (unlikely(intr_status & DMA_STATUS_OVF)) { | 173 | if (unlikely(intr_status & DMA_STATUS_OVF)) { |
| 174 | DBG(INFO, "recv overflow\n"); | 174 | DWMAC_LIB_DBG(KERN_INFO "recv overflow\n"); |
| 175 | x->rx_overflow_irq++; | 175 | x->rx_overflow_irq++; |
| 176 | } | 176 | } |
| 177 | if (unlikely(intr_status & DMA_STATUS_RU)) { | 177 | if (unlikely(intr_status & DMA_STATUS_RU)) { |
| 178 | DBG(INFO, "receive buffer unavailable\n"); | 178 | DWMAC_LIB_DBG(KERN_INFO "receive buffer unavailable\n"); |
| 179 | x->rx_buf_unav_irq++; | 179 | x->rx_buf_unav_irq++; |
| 180 | } | 180 | } |
| 181 | if (unlikely(intr_status & DMA_STATUS_RPS)) { | 181 | if (unlikely(intr_status & DMA_STATUS_RPS)) { |
| 182 | DBG(INFO, "receive process stopped\n"); | 182 | DWMAC_LIB_DBG(KERN_INFO "receive process stopped\n"); |
| 183 | x->rx_process_stopped_irq++; | 183 | x->rx_process_stopped_irq++; |
| 184 | } | 184 | } |
| 185 | if (unlikely(intr_status & DMA_STATUS_RWT)) { | 185 | if (unlikely(intr_status & DMA_STATUS_RWT)) { |
| 186 | DBG(INFO, "receive watchdog\n"); | 186 | DWMAC_LIB_DBG(KERN_INFO "receive watchdog\n"); |
| 187 | x->rx_watchdog_irq++; | 187 | x->rx_watchdog_irq++; |
| 188 | } | 188 | } |
| 189 | if (unlikely(intr_status & DMA_STATUS_ETI)) { | 189 | if (unlikely(intr_status & DMA_STATUS_ETI)) { |
| 190 | DBG(INFO, "transmit early interrupt\n"); | 190 | DWMAC_LIB_DBG(KERN_INFO "transmit early interrupt\n"); |
| 191 | x->tx_early_irq++; | 191 | x->tx_early_irq++; |
| 192 | } | 192 | } |
| 193 | if (unlikely(intr_status & DMA_STATUS_TPS)) { | 193 | if (unlikely(intr_status & DMA_STATUS_TPS)) { |
| 194 | DBG(INFO, "transmit process stopped\n"); | 194 | DWMAC_LIB_DBG(KERN_INFO "transmit process stopped\n"); |
| 195 | x->tx_process_stopped_irq++; | 195 | x->tx_process_stopped_irq++; |
| 196 | ret = tx_hard_error; | 196 | ret = tx_hard_error; |
| 197 | } | 197 | } |
| 198 | if (unlikely(intr_status & DMA_STATUS_FBI)) { | 198 | if (unlikely(intr_status & DMA_STATUS_FBI)) { |
| 199 | DBG(INFO, "fatal bus error\n"); | 199 | DWMAC_LIB_DBG(KERN_INFO "fatal bus error\n"); |
| 200 | x->fatal_bus_error_irq++; | 200 | x->fatal_bus_error_irq++; |
| 201 | ret = tx_hard_error; | 201 | ret = tx_hard_error; |
| 202 | } | 202 | } |
| @@ -215,7 +215,7 @@ int dwmac_dma_interrupt(void __iomem *ioaddr, | |||
| 215 | /* Clear the interrupt by writing a logic 1 to the CSR5[15-0] */ | 215 | /* Clear the interrupt by writing a logic 1 to the CSR5[15-0] */ |
| 216 | writel((intr_status & 0x1ffff), ioaddr + DMA_STATUS); | 216 | writel((intr_status & 0x1ffff), ioaddr + DMA_STATUS); |
| 217 | 217 | ||
| 218 | DBG(INFO, "\n\n"); | 218 | DWMAC_LIB_DBG(KERN_INFO "\n\n"); |
| 219 | return ret; | 219 | return ret; |
| 220 | } | 220 | } |
| 221 | 221 | ||
diff --git a/drivers/net/stmmac/stmmac_main.c b/drivers/net/stmmac/stmmac_main.c index 0e5f03135b50..cc973fc38405 100644 --- a/drivers/net/stmmac/stmmac_main.c +++ b/drivers/net/stmmac/stmmac_main.c | |||
| @@ -750,7 +750,6 @@ static void stmmac_dma_interrupt(struct stmmac_priv *priv) | |||
| 750 | priv->hw->dma->dma_mode(priv->ioaddr, tc, SF_DMA_MODE); | 750 | priv->hw->dma->dma_mode(priv->ioaddr, tc, SF_DMA_MODE); |
| 751 | priv->xstats.threshold = tc; | 751 | priv->xstats.threshold = tc; |
| 752 | } | 752 | } |
| 753 | stmmac_tx_err(priv); | ||
| 754 | } else if (unlikely(status == tx_hard_error)) | 753 | } else if (unlikely(status == tx_hard_error)) |
| 755 | stmmac_tx_err(priv); | 754 | stmmac_tx_err(priv); |
| 756 | } | 755 | } |
| @@ -781,21 +780,6 @@ static int stmmac_open(struct net_device *dev) | |||
| 781 | 780 | ||
| 782 | stmmac_verify_args(); | 781 | stmmac_verify_args(); |
| 783 | 782 | ||
| 784 | ret = stmmac_init_phy(dev); | ||
| 785 | if (unlikely(ret)) { | ||
| 786 | pr_err("%s: Cannot attach to PHY (error: %d)\n", __func__, ret); | ||
| 787 | return ret; | ||
| 788 | } | ||
| 789 | |||
| 790 | /* Request the IRQ lines */ | ||
| 791 | ret = request_irq(dev->irq, stmmac_interrupt, | ||
| 792 | IRQF_SHARED, dev->name, dev); | ||
| 793 | if (unlikely(ret < 0)) { | ||
| 794 | pr_err("%s: ERROR: allocating the IRQ %d (error: %d)\n", | ||
| 795 | __func__, dev->irq, ret); | ||
| 796 | return ret; | ||
| 797 | } | ||
| 798 | |||
| 799 | #ifdef CONFIG_STMMAC_TIMER | 783 | #ifdef CONFIG_STMMAC_TIMER |
| 800 | priv->tm = kzalloc(sizeof(struct stmmac_timer *), GFP_KERNEL); | 784 | priv->tm = kzalloc(sizeof(struct stmmac_timer *), GFP_KERNEL); |
| 801 | if (unlikely(priv->tm == NULL)) { | 785 | if (unlikely(priv->tm == NULL)) { |
| @@ -814,6 +798,11 @@ static int stmmac_open(struct net_device *dev) | |||
| 814 | } else | 798 | } else |
| 815 | priv->tm->enable = 1; | 799 | priv->tm->enable = 1; |
| 816 | #endif | 800 | #endif |
| 801 | ret = stmmac_init_phy(dev); | ||
| 802 | if (unlikely(ret)) { | ||
| 803 | pr_err("%s: Cannot attach to PHY (error: %d)\n", __func__, ret); | ||
| 804 | goto open_error; | ||
| 805 | } | ||
| 817 | 806 | ||
| 818 | /* Create and initialize the TX/RX descriptors chains. */ | 807 | /* Create and initialize the TX/RX descriptors chains. */ |
| 819 | priv->dma_tx_size = STMMAC_ALIGN(dma_txsize); | 808 | priv->dma_tx_size = STMMAC_ALIGN(dma_txsize); |
| @@ -822,12 +811,11 @@ static int stmmac_open(struct net_device *dev) | |||
| 822 | init_dma_desc_rings(dev); | 811 | init_dma_desc_rings(dev); |
| 823 | 812 | ||
| 824 | /* DMA initialization and SW reset */ | 813 | /* DMA initialization and SW reset */ |
| 825 | if (unlikely(priv->hw->dma->init(priv->ioaddr, priv->plat->pbl, | 814 | ret = priv->hw->dma->init(priv->ioaddr, priv->plat->pbl, |
| 826 | priv->dma_tx_phy, | 815 | priv->dma_tx_phy, priv->dma_rx_phy); |
| 827 | priv->dma_rx_phy) < 0)) { | 816 | if (ret < 0) { |
| 828 | |||
| 829 | pr_err("%s: DMA initialization failed\n", __func__); | 817 | pr_err("%s: DMA initialization failed\n", __func__); |
| 830 | return -1; | 818 | goto open_error; |
| 831 | } | 819 | } |
| 832 | 820 | ||
| 833 | /* Copy the MAC addr into the HW */ | 821 | /* Copy the MAC addr into the HW */ |
| @@ -848,6 +836,15 @@ static int stmmac_open(struct net_device *dev) | |||
| 848 | writel(0xffffffff, priv->ioaddr + MMC_HIGH_INTR_MASK); | 836 | writel(0xffffffff, priv->ioaddr + MMC_HIGH_INTR_MASK); |
| 849 | writel(0xffffffff, priv->ioaddr + MMC_LOW_INTR_MASK); | 837 | writel(0xffffffff, priv->ioaddr + MMC_LOW_INTR_MASK); |
| 850 | 838 | ||
| 839 | /* Request the IRQ lines */ | ||
| 840 | ret = request_irq(dev->irq, stmmac_interrupt, | ||
| 841 | IRQF_SHARED, dev->name, dev); | ||
| 842 | if (unlikely(ret < 0)) { | ||
| 843 | pr_err("%s: ERROR: allocating the IRQ %d (error: %d)\n", | ||
| 844 | __func__, dev->irq, ret); | ||
| 845 | goto open_error; | ||
| 846 | } | ||
| 847 | |||
| 851 | /* Enable the MAC Rx/Tx */ | 848 | /* Enable the MAC Rx/Tx */ |
| 852 | stmmac_enable_mac(priv->ioaddr); | 849 | stmmac_enable_mac(priv->ioaddr); |
| 853 | 850 | ||
| @@ -878,7 +875,17 @@ static int stmmac_open(struct net_device *dev) | |||
| 878 | napi_enable(&priv->napi); | 875 | napi_enable(&priv->napi); |
| 879 | skb_queue_head_init(&priv->rx_recycle); | 876 | skb_queue_head_init(&priv->rx_recycle); |
| 880 | netif_start_queue(dev); | 877 | netif_start_queue(dev); |
| 878 | |||
| 881 | return 0; | 879 | return 0; |
| 880 | |||
| 881 | open_error: | ||
| 882 | #ifdef CONFIG_STMMAC_TIMER | ||
| 883 | kfree(priv->tm); | ||
| 884 | #endif | ||
| 885 | if (priv->phydev) | ||
| 886 | phy_disconnect(priv->phydev); | ||
| 887 | |||
| 888 | return ret; | ||
| 882 | } | 889 | } |
| 883 | 890 | ||
| 884 | /** | 891 | /** |
diff --git a/drivers/net/tokenring/3c359.c b/drivers/net/tokenring/3c359.c index 8a3b191b195b..ff32befd8443 100644 --- a/drivers/net/tokenring/3c359.c +++ b/drivers/net/tokenring/3c359.c | |||
| @@ -1251,7 +1251,7 @@ static netdev_tx_t xl_xmit(struct sk_buff *skb, struct net_device *dev) | |||
| 1251 | /* | 1251 | /* |
| 1252 | * The NIC has told us that a packet has been downloaded onto the card, we must | 1252 | * The NIC has told us that a packet has been downloaded onto the card, we must |
| 1253 | * find out which packet it has done, clear the skb and information for the packet | 1253 | * find out which packet it has done, clear the skb and information for the packet |
| 1254 | * then advance around the ring for all tranmitted packets | 1254 | * then advance around the ring for all transmitted packets |
| 1255 | */ | 1255 | */ |
| 1256 | 1256 | ||
| 1257 | static void xl_dn_comp(struct net_device *dev) | 1257 | static void xl_dn_comp(struct net_device *dev) |
| @@ -1568,7 +1568,7 @@ static void xl_arb_cmd(struct net_device *dev) | |||
| 1568 | if (lan_status_diff & LSC_SOFT_ERR) | 1568 | if (lan_status_diff & LSC_SOFT_ERR) |
| 1569 | printk(KERN_WARNING "%s: Adapter transmitted Soft Error Report Mac Frame\n",dev->name); | 1569 | printk(KERN_WARNING "%s: Adapter transmitted Soft Error Report Mac Frame\n",dev->name); |
| 1570 | if (lan_status_diff & LSC_TRAN_BCN) | 1570 | if (lan_status_diff & LSC_TRAN_BCN) |
| 1571 | printk(KERN_INFO "%s: We are tranmitting the beacon, aaah\n",dev->name); | 1571 | printk(KERN_INFO "%s: We are transmitting the beacon, aaah\n",dev->name); |
| 1572 | if (lan_status_diff & LSC_SS) | 1572 | if (lan_status_diff & LSC_SS) |
| 1573 | printk(KERN_INFO "%s: Single Station on the ring\n", dev->name); | 1573 | printk(KERN_INFO "%s: Single Station on the ring\n", dev->name); |
| 1574 | if (lan_status_diff & LSC_RING_REC) | 1574 | if (lan_status_diff & LSC_RING_REC) |
diff --git a/drivers/net/tokenring/lanstreamer.c b/drivers/net/tokenring/lanstreamer.c index 5bd140704533..9354ca9da576 100644 --- a/drivers/net/tokenring/lanstreamer.c +++ b/drivers/net/tokenring/lanstreamer.c | |||
| @@ -1675,7 +1675,7 @@ drop_frame: | |||
| 1675 | if (lan_status_diff & LSC_SOFT_ERR) | 1675 | if (lan_status_diff & LSC_SOFT_ERR) |
| 1676 | printk(KERN_WARNING "%s: Adapter transmitted Soft Error Report Mac Frame\n", dev->name); | 1676 | printk(KERN_WARNING "%s: Adapter transmitted Soft Error Report Mac Frame\n", dev->name); |
| 1677 | if (lan_status_diff & LSC_TRAN_BCN) | 1677 | if (lan_status_diff & LSC_TRAN_BCN) |
| 1678 | printk(KERN_INFO "%s: We are tranmitting the beacon, aaah\n", dev->name); | 1678 | printk(KERN_INFO "%s: We are transmitting the beacon, aaah\n", dev->name); |
| 1679 | if (lan_status_diff & LSC_SS) | 1679 | if (lan_status_diff & LSC_SS) |
| 1680 | printk(KERN_INFO "%s: Single Station on the ring\n", dev->name); | 1680 | printk(KERN_INFO "%s: Single Station on the ring\n", dev->name); |
| 1681 | if (lan_status_diff & LSC_RING_REC) | 1681 | if (lan_status_diff & LSC_RING_REC) |
diff --git a/drivers/net/tokenring/olympic.c b/drivers/net/tokenring/olympic.c index 3d2fbe60b46e..2684003b8ab6 100644 --- a/drivers/net/tokenring/olympic.c +++ b/drivers/net/tokenring/olympic.c | |||
| @@ -1500,7 +1500,7 @@ drop_frame: | |||
| 1500 | if (lan_status_diff & LSC_SOFT_ERR) | 1500 | if (lan_status_diff & LSC_SOFT_ERR) |
| 1501 | printk(KERN_WARNING "%s: Adapter transmitted Soft Error Report Mac Frame\n",dev->name); | 1501 | printk(KERN_WARNING "%s: Adapter transmitted Soft Error Report Mac Frame\n",dev->name); |
| 1502 | if (lan_status_diff & LSC_TRAN_BCN) | 1502 | if (lan_status_diff & LSC_TRAN_BCN) |
| 1503 | printk(KERN_INFO "%s: We are tranmitting the beacon, aaah\n",dev->name); | 1503 | printk(KERN_INFO "%s: We are transmitting the beacon, aaah\n",dev->name); |
| 1504 | if (lan_status_diff & LSC_SS) | 1504 | if (lan_status_diff & LSC_SS) |
| 1505 | printk(KERN_INFO "%s: Single Station on the ring\n", dev->name); | 1505 | printk(KERN_INFO "%s: Single Station on the ring\n", dev->name); |
| 1506 | if (lan_status_diff & LSC_RING_REC) | 1506 | if (lan_status_diff & LSC_RING_REC) |
diff --git a/drivers/net/usb/smsc95xx.c b/drivers/net/usb/smsc95xx.c index 727874d9deb6..47a6c870b51f 100644 --- a/drivers/net/usb/smsc95xx.c +++ b/drivers/net/usb/smsc95xx.c | |||
| @@ -1313,6 +1313,21 @@ static const struct usb_device_id products[] = { | |||
| 1313 | USB_DEVICE(0x0424, 0x9909), | 1313 | USB_DEVICE(0x0424, 0x9909), |
| 1314 | .driver_info = (unsigned long) &smsc95xx_info, | 1314 | .driver_info = (unsigned long) &smsc95xx_info, |
| 1315 | }, | 1315 | }, |
| 1316 | { | ||
| 1317 | /* SMSC LAN9530 USB Ethernet Device */ | ||
| 1318 | USB_DEVICE(0x0424, 0x9530), | ||
| 1319 | .driver_info = (unsigned long) &smsc95xx_info, | ||
| 1320 | }, | ||
| 1321 | { | ||
| 1322 | /* SMSC LAN9730 USB Ethernet Device */ | ||
| 1323 | USB_DEVICE(0x0424, 0x9730), | ||
| 1324 | .driver_info = (unsigned long) &smsc95xx_info, | ||
| 1325 | }, | ||
| 1326 | { | ||
| 1327 | /* SMSC LAN89530 USB Ethernet Device */ | ||
| 1328 | USB_DEVICE(0x0424, 0x9E08), | ||
| 1329 | .driver_info = (unsigned long) &smsc95xx_info, | ||
| 1330 | }, | ||
| 1316 | { }, /* END */ | 1331 | { }, /* END */ |
| 1317 | }; | 1332 | }; |
| 1318 | MODULE_DEVICE_TABLE(usb, products); | 1333 | MODULE_DEVICE_TABLE(usb, products); |
diff --git a/drivers/net/wireless/ath/ath9k/hif_usb.c b/drivers/net/wireless/ath/ath9k/hif_usb.c index f1b8af64569c..2d10239ce829 100644 --- a/drivers/net/wireless/ath/ath9k/hif_usb.c +++ b/drivers/net/wireless/ath/ath9k/hif_usb.c | |||
| @@ -1040,7 +1040,7 @@ static int ath9k_hif_usb_probe(struct usb_interface *interface, | |||
| 1040 | } | 1040 | } |
| 1041 | 1041 | ||
| 1042 | ret = ath9k_htc_hw_init(hif_dev->htc_handle, | 1042 | ret = ath9k_htc_hw_init(hif_dev->htc_handle, |
| 1043 | &hif_dev->udev->dev, hif_dev->device_id, | 1043 | &interface->dev, hif_dev->device_id, |
| 1044 | hif_dev->udev->product, id->driver_info); | 1044 | hif_dev->udev->product, id->driver_info); |
| 1045 | if (ret) { | 1045 | if (ret) { |
| 1046 | ret = -EINVAL; | 1046 | ret = -EINVAL; |
| @@ -1158,7 +1158,7 @@ fail_resume: | |||
| 1158 | #endif | 1158 | #endif |
| 1159 | 1159 | ||
| 1160 | static struct usb_driver ath9k_hif_usb_driver = { | 1160 | static struct usb_driver ath9k_hif_usb_driver = { |
| 1161 | .name = "ath9k_hif_usb", | 1161 | .name = KBUILD_MODNAME, |
| 1162 | .probe = ath9k_hif_usb_probe, | 1162 | .probe = ath9k_hif_usb_probe, |
| 1163 | .disconnect = ath9k_hif_usb_disconnect, | 1163 | .disconnect = ath9k_hif_usb_disconnect, |
| 1164 | #ifdef CONFIG_PM | 1164 | #ifdef CONFIG_PM |
diff --git a/drivers/net/wireless/ath/ath9k/hw.c b/drivers/net/wireless/ath/ath9k/hw.c index 338b07502f1a..c95bc5cc1a1f 100644 --- a/drivers/net/wireless/ath/ath9k/hw.c +++ b/drivers/net/wireless/ath/ath9k/hw.c | |||
| @@ -1254,15 +1254,6 @@ int ath9k_hw_reset(struct ath_hw *ah, struct ath9k_channel *chan, | |||
| 1254 | ah->txchainmask = common->tx_chainmask; | 1254 | ah->txchainmask = common->tx_chainmask; |
| 1255 | ah->rxchainmask = common->rx_chainmask; | 1255 | ah->rxchainmask = common->rx_chainmask; |
| 1256 | 1256 | ||
| 1257 | if ((common->bus_ops->ath_bus_type != ATH_USB) && !ah->chip_fullsleep) { | ||
| 1258 | ath9k_hw_abortpcurecv(ah); | ||
| 1259 | if (!ath9k_hw_stopdmarecv(ah)) { | ||
| 1260 | ath_dbg(common, ATH_DBG_XMIT, | ||
| 1261 | "Failed to stop receive dma\n"); | ||
| 1262 | bChannelChange = false; | ||
| 1263 | } | ||
| 1264 | } | ||
| 1265 | |||
| 1266 | if (!ath9k_hw_setpower(ah, ATH9K_PM_AWAKE)) | 1257 | if (!ath9k_hw_setpower(ah, ATH9K_PM_AWAKE)) |
| 1267 | return -EIO; | 1258 | return -EIO; |
| 1268 | 1259 | ||
| @@ -2546,6 +2537,7 @@ static struct { | |||
| 2546 | { AR_SREV_VERSION_9287, "9287" }, | 2537 | { AR_SREV_VERSION_9287, "9287" }, |
| 2547 | { AR_SREV_VERSION_9271, "9271" }, | 2538 | { AR_SREV_VERSION_9271, "9271" }, |
| 2548 | { AR_SREV_VERSION_9300, "9300" }, | 2539 | { AR_SREV_VERSION_9300, "9300" }, |
| 2540 | { AR_SREV_VERSION_9485, "9485" }, | ||
| 2549 | }; | 2541 | }; |
| 2550 | 2542 | ||
| 2551 | /* For devices with external radios */ | 2543 | /* For devices with external radios */ |
diff --git a/drivers/net/wireless/ath/ath9k/mac.c b/drivers/net/wireless/ath/ath9k/mac.c index 562257ac52cf..edc1cbbfecaf 100644 --- a/drivers/net/wireless/ath/ath9k/mac.c +++ b/drivers/net/wireless/ath/ath9k/mac.c | |||
| @@ -751,28 +751,47 @@ void ath9k_hw_abortpcurecv(struct ath_hw *ah) | |||
| 751 | } | 751 | } |
| 752 | EXPORT_SYMBOL(ath9k_hw_abortpcurecv); | 752 | EXPORT_SYMBOL(ath9k_hw_abortpcurecv); |
| 753 | 753 | ||
| 754 | bool ath9k_hw_stopdmarecv(struct ath_hw *ah) | 754 | bool ath9k_hw_stopdmarecv(struct ath_hw *ah, bool *reset) |
| 755 | { | 755 | { |
| 756 | #define AH_RX_STOP_DMA_TIMEOUT 10000 /* usec */ | 756 | #define AH_RX_STOP_DMA_TIMEOUT 10000 /* usec */ |
| 757 | #define AH_RX_TIME_QUANTUM 100 /* usec */ | 757 | #define AH_RX_TIME_QUANTUM 100 /* usec */ |
| 758 | struct ath_common *common = ath9k_hw_common(ah); | 758 | struct ath_common *common = ath9k_hw_common(ah); |
| 759 | u32 mac_status, last_mac_status = 0; | ||
| 759 | int i; | 760 | int i; |
| 760 | 761 | ||
| 762 | /* Enable access to the DMA observation bus */ | ||
| 763 | REG_WRITE(ah, AR_MACMISC, | ||
| 764 | ((AR_MACMISC_DMA_OBS_LINE_8 << AR_MACMISC_DMA_OBS_S) | | ||
| 765 | (AR_MACMISC_MISC_OBS_BUS_1 << | ||
| 766 | AR_MACMISC_MISC_OBS_BUS_MSB_S))); | ||
| 767 | |||
| 761 | REG_WRITE(ah, AR_CR, AR_CR_RXD); | 768 | REG_WRITE(ah, AR_CR, AR_CR_RXD); |
| 762 | 769 | ||
| 763 | /* Wait for rx enable bit to go low */ | 770 | /* Wait for rx enable bit to go low */ |
| 764 | for (i = AH_RX_STOP_DMA_TIMEOUT / AH_TIME_QUANTUM; i != 0; i--) { | 771 | for (i = AH_RX_STOP_DMA_TIMEOUT / AH_TIME_QUANTUM; i != 0; i--) { |
| 765 | if ((REG_READ(ah, AR_CR) & AR_CR_RXE) == 0) | 772 | if ((REG_READ(ah, AR_CR) & AR_CR_RXE) == 0) |
| 766 | break; | 773 | break; |
| 774 | |||
| 775 | if (!AR_SREV_9300_20_OR_LATER(ah)) { | ||
| 776 | mac_status = REG_READ(ah, AR_DMADBG_7) & 0x7f0; | ||
| 777 | if (mac_status == 0x1c0 && mac_status == last_mac_status) { | ||
| 778 | *reset = true; | ||
| 779 | break; | ||
| 780 | } | ||
| 781 | |||
| 782 | last_mac_status = mac_status; | ||
| 783 | } | ||
| 784 | |||
| 767 | udelay(AH_TIME_QUANTUM); | 785 | udelay(AH_TIME_QUANTUM); |
| 768 | } | 786 | } |
| 769 | 787 | ||
| 770 | if (i == 0) { | 788 | if (i == 0) { |
| 771 | ath_err(common, | 789 | ath_err(common, |
| 772 | "DMA failed to stop in %d ms AR_CR=0x%08x AR_DIAG_SW=0x%08x\n", | 790 | "DMA failed to stop in %d ms AR_CR=0x%08x AR_DIAG_SW=0x%08x DMADBG_7=0x%08x\n", |
| 773 | AH_RX_STOP_DMA_TIMEOUT / 1000, | 791 | AH_RX_STOP_DMA_TIMEOUT / 1000, |
| 774 | REG_READ(ah, AR_CR), | 792 | REG_READ(ah, AR_CR), |
| 775 | REG_READ(ah, AR_DIAG_SW)); | 793 | REG_READ(ah, AR_DIAG_SW), |
| 794 | REG_READ(ah, AR_DMADBG_7)); | ||
| 776 | return false; | 795 | return false; |
| 777 | } else { | 796 | } else { |
| 778 | return true; | 797 | return true; |
diff --git a/drivers/net/wireless/ath/ath9k/mac.h b/drivers/net/wireless/ath/ath9k/mac.h index b2b2ff852c32..c2a59386fb9c 100644 --- a/drivers/net/wireless/ath/ath9k/mac.h +++ b/drivers/net/wireless/ath/ath9k/mac.h | |||
| @@ -695,7 +695,7 @@ bool ath9k_hw_setrxabort(struct ath_hw *ah, bool set); | |||
| 695 | void ath9k_hw_putrxbuf(struct ath_hw *ah, u32 rxdp); | 695 | void ath9k_hw_putrxbuf(struct ath_hw *ah, u32 rxdp); |
| 696 | void ath9k_hw_startpcureceive(struct ath_hw *ah, bool is_scanning); | 696 | void ath9k_hw_startpcureceive(struct ath_hw *ah, bool is_scanning); |
| 697 | void ath9k_hw_abortpcurecv(struct ath_hw *ah); | 697 | void ath9k_hw_abortpcurecv(struct ath_hw *ah); |
| 698 | bool ath9k_hw_stopdmarecv(struct ath_hw *ah); | 698 | bool ath9k_hw_stopdmarecv(struct ath_hw *ah, bool *reset); |
| 699 | int ath9k_hw_beaconq_setup(struct ath_hw *ah); | 699 | int ath9k_hw_beaconq_setup(struct ath_hw *ah); |
| 700 | 700 | ||
| 701 | /* Interrupt Handling */ | 701 | /* Interrupt Handling */ |
diff --git a/drivers/net/wireless/ath/ath9k/main.c b/drivers/net/wireless/ath/ath9k/main.c index dddb85de622d..17d04ff8d678 100644 --- a/drivers/net/wireless/ath/ath9k/main.c +++ b/drivers/net/wireless/ath/ath9k/main.c | |||
| @@ -1376,7 +1376,6 @@ static void ath9k_calculate_summary_state(struct ieee80211_hw *hw, | |||
| 1376 | 1376 | ||
| 1377 | ath9k_calculate_iter_data(hw, vif, &iter_data); | 1377 | ath9k_calculate_iter_data(hw, vif, &iter_data); |
| 1378 | 1378 | ||
| 1379 | ath9k_ps_wakeup(sc); | ||
| 1380 | /* Set BSSID mask. */ | 1379 | /* Set BSSID mask. */ |
| 1381 | memcpy(common->bssidmask, iter_data.mask, ETH_ALEN); | 1380 | memcpy(common->bssidmask, iter_data.mask, ETH_ALEN); |
| 1382 | ath_hw_setbssidmask(common); | 1381 | ath_hw_setbssidmask(common); |
| @@ -1411,7 +1410,6 @@ static void ath9k_calculate_summary_state(struct ieee80211_hw *hw, | |||
| 1411 | } | 1410 | } |
| 1412 | 1411 | ||
| 1413 | ath9k_hw_set_interrupts(ah, ah->imask); | 1412 | ath9k_hw_set_interrupts(ah, ah->imask); |
| 1414 | ath9k_ps_restore(sc); | ||
| 1415 | 1413 | ||
| 1416 | /* Set up ANI */ | 1414 | /* Set up ANI */ |
| 1417 | if ((iter_data.naps + iter_data.nadhocs) > 0) { | 1415 | if ((iter_data.naps + iter_data.nadhocs) > 0) { |
| @@ -1457,6 +1455,7 @@ static int ath9k_add_interface(struct ieee80211_hw *hw, | |||
| 1457 | struct ath_vif *avp = (void *)vif->drv_priv; | 1455 | struct ath_vif *avp = (void *)vif->drv_priv; |
| 1458 | int ret = 0; | 1456 | int ret = 0; |
| 1459 | 1457 | ||
| 1458 | ath9k_ps_wakeup(sc); | ||
| 1460 | mutex_lock(&sc->mutex); | 1459 | mutex_lock(&sc->mutex); |
| 1461 | 1460 | ||
| 1462 | switch (vif->type) { | 1461 | switch (vif->type) { |
| @@ -1503,6 +1502,7 @@ static int ath9k_add_interface(struct ieee80211_hw *hw, | |||
| 1503 | ath9k_do_vif_add_setup(hw, vif); | 1502 | ath9k_do_vif_add_setup(hw, vif); |
| 1504 | out: | 1503 | out: |
| 1505 | mutex_unlock(&sc->mutex); | 1504 | mutex_unlock(&sc->mutex); |
| 1505 | ath9k_ps_restore(sc); | ||
| 1506 | return ret; | 1506 | return ret; |
| 1507 | } | 1507 | } |
| 1508 | 1508 | ||
| @@ -1517,6 +1517,7 @@ static int ath9k_change_interface(struct ieee80211_hw *hw, | |||
| 1517 | 1517 | ||
| 1518 | ath_dbg(common, ATH_DBG_CONFIG, "Change Interface\n"); | 1518 | ath_dbg(common, ATH_DBG_CONFIG, "Change Interface\n"); |
| 1519 | mutex_lock(&sc->mutex); | 1519 | mutex_lock(&sc->mutex); |
| 1520 | ath9k_ps_wakeup(sc); | ||
| 1520 | 1521 | ||
| 1521 | /* See if new interface type is valid. */ | 1522 | /* See if new interface type is valid. */ |
| 1522 | if ((new_type == NL80211_IFTYPE_ADHOC) && | 1523 | if ((new_type == NL80211_IFTYPE_ADHOC) && |
| @@ -1546,6 +1547,7 @@ static int ath9k_change_interface(struct ieee80211_hw *hw, | |||
| 1546 | 1547 | ||
| 1547 | ath9k_do_vif_add_setup(hw, vif); | 1548 | ath9k_do_vif_add_setup(hw, vif); |
| 1548 | out: | 1549 | out: |
| 1550 | ath9k_ps_restore(sc); | ||
| 1549 | mutex_unlock(&sc->mutex); | 1551 | mutex_unlock(&sc->mutex); |
| 1550 | return ret; | 1552 | return ret; |
| 1551 | } | 1553 | } |
| @@ -1558,6 +1560,7 @@ static void ath9k_remove_interface(struct ieee80211_hw *hw, | |||
| 1558 | 1560 | ||
| 1559 | ath_dbg(common, ATH_DBG_CONFIG, "Detach Interface\n"); | 1561 | ath_dbg(common, ATH_DBG_CONFIG, "Detach Interface\n"); |
| 1560 | 1562 | ||
| 1563 | ath9k_ps_wakeup(sc); | ||
| 1561 | mutex_lock(&sc->mutex); | 1564 | mutex_lock(&sc->mutex); |
| 1562 | 1565 | ||
| 1563 | sc->nvifs--; | 1566 | sc->nvifs--; |
| @@ -1569,6 +1572,7 @@ static void ath9k_remove_interface(struct ieee80211_hw *hw, | |||
| 1569 | ath9k_calculate_summary_state(hw, NULL); | 1572 | ath9k_calculate_summary_state(hw, NULL); |
| 1570 | 1573 | ||
| 1571 | mutex_unlock(&sc->mutex); | 1574 | mutex_unlock(&sc->mutex); |
| 1575 | ath9k_ps_restore(sc); | ||
| 1572 | } | 1576 | } |
| 1573 | 1577 | ||
| 1574 | static void ath9k_enable_ps(struct ath_softc *sc) | 1578 | static void ath9k_enable_ps(struct ath_softc *sc) |
| @@ -1809,6 +1813,7 @@ static int ath9k_conf_tx(struct ieee80211_hw *hw, u16 queue, | |||
| 1809 | 1813 | ||
| 1810 | txq = sc->tx.txq_map[queue]; | 1814 | txq = sc->tx.txq_map[queue]; |
| 1811 | 1815 | ||
| 1816 | ath9k_ps_wakeup(sc); | ||
| 1812 | mutex_lock(&sc->mutex); | 1817 | mutex_lock(&sc->mutex); |
| 1813 | 1818 | ||
| 1814 | memset(&qi, 0, sizeof(struct ath9k_tx_queue_info)); | 1819 | memset(&qi, 0, sizeof(struct ath9k_tx_queue_info)); |
| @@ -1832,6 +1837,7 @@ static int ath9k_conf_tx(struct ieee80211_hw *hw, u16 queue, | |||
| 1832 | ath_beaconq_config(sc); | 1837 | ath_beaconq_config(sc); |
| 1833 | 1838 | ||
| 1834 | mutex_unlock(&sc->mutex); | 1839 | mutex_unlock(&sc->mutex); |
| 1840 | ath9k_ps_restore(sc); | ||
| 1835 | 1841 | ||
| 1836 | return ret; | 1842 | return ret; |
| 1837 | } | 1843 | } |
| @@ -1894,6 +1900,7 @@ static void ath9k_bss_info_changed(struct ieee80211_hw *hw, | |||
| 1894 | int slottime; | 1900 | int slottime; |
| 1895 | int error; | 1901 | int error; |
| 1896 | 1902 | ||
| 1903 | ath9k_ps_wakeup(sc); | ||
| 1897 | mutex_lock(&sc->mutex); | 1904 | mutex_lock(&sc->mutex); |
| 1898 | 1905 | ||
| 1899 | if (changed & BSS_CHANGED_BSSID) { | 1906 | if (changed & BSS_CHANGED_BSSID) { |
| @@ -1994,6 +2001,7 @@ static void ath9k_bss_info_changed(struct ieee80211_hw *hw, | |||
| 1994 | } | 2001 | } |
| 1995 | 2002 | ||
| 1996 | mutex_unlock(&sc->mutex); | 2003 | mutex_unlock(&sc->mutex); |
| 2004 | ath9k_ps_restore(sc); | ||
| 1997 | } | 2005 | } |
| 1998 | 2006 | ||
| 1999 | static u64 ath9k_get_tsf(struct ieee80211_hw *hw) | 2007 | static u64 ath9k_get_tsf(struct ieee80211_hw *hw) |
diff --git a/drivers/net/wireless/ath/ath9k/recv.c b/drivers/net/wireless/ath/ath9k/recv.c index a9c3f4672aa0..dcd19bc337d1 100644 --- a/drivers/net/wireless/ath/ath9k/recv.c +++ b/drivers/net/wireless/ath/ath9k/recv.c | |||
| @@ -486,12 +486,12 @@ start_recv: | |||
| 486 | bool ath_stoprecv(struct ath_softc *sc) | 486 | bool ath_stoprecv(struct ath_softc *sc) |
| 487 | { | 487 | { |
| 488 | struct ath_hw *ah = sc->sc_ah; | 488 | struct ath_hw *ah = sc->sc_ah; |
| 489 | bool stopped; | 489 | bool stopped, reset = false; |
| 490 | 490 | ||
| 491 | spin_lock_bh(&sc->rx.rxbuflock); | 491 | spin_lock_bh(&sc->rx.rxbuflock); |
| 492 | ath9k_hw_abortpcurecv(ah); | 492 | ath9k_hw_abortpcurecv(ah); |
| 493 | ath9k_hw_setrxfilter(ah, 0); | 493 | ath9k_hw_setrxfilter(ah, 0); |
| 494 | stopped = ath9k_hw_stopdmarecv(ah); | 494 | stopped = ath9k_hw_stopdmarecv(ah, &reset); |
| 495 | 495 | ||
| 496 | if (sc->sc_ah->caps.hw_caps & ATH9K_HW_CAP_EDMA) | 496 | if (sc->sc_ah->caps.hw_caps & ATH9K_HW_CAP_EDMA) |
| 497 | ath_edma_stop_recv(sc); | 497 | ath_edma_stop_recv(sc); |
| @@ -506,7 +506,7 @@ bool ath_stoprecv(struct ath_softc *sc) | |||
| 506 | "confusing the DMA engine when we start RX up\n"); | 506 | "confusing the DMA engine when we start RX up\n"); |
| 507 | ATH_DBG_WARN_ON_ONCE(!stopped); | 507 | ATH_DBG_WARN_ON_ONCE(!stopped); |
| 508 | } | 508 | } |
| 509 | return stopped; | 509 | return stopped || reset; |
| 510 | } | 510 | } |
| 511 | 511 | ||
| 512 | void ath_flushrecv(struct ath_softc *sc) | 512 | void ath_flushrecv(struct ath_softc *sc) |
diff --git a/drivers/net/wireless/ath/regd_common.h b/drivers/net/wireless/ath/regd_common.h index 248c670fdfbe..5c2cfe694152 100644 --- a/drivers/net/wireless/ath/regd_common.h +++ b/drivers/net/wireless/ath/regd_common.h | |||
| @@ -195,6 +195,7 @@ static struct reg_dmn_pair_mapping regDomainPairs[] = { | |||
| 195 | {APL9_WORLD, CTL_ETSI, CTL_ETSI}, | 195 | {APL9_WORLD, CTL_ETSI, CTL_ETSI}, |
| 196 | 196 | ||
| 197 | {APL3_FCCA, CTL_FCC, CTL_FCC}, | 197 | {APL3_FCCA, CTL_FCC, CTL_FCC}, |
| 198 | {APL7_FCCA, CTL_FCC, CTL_FCC}, | ||
| 198 | {APL1_ETSIC, CTL_FCC, CTL_ETSI}, | 199 | {APL1_ETSIC, CTL_FCC, CTL_ETSI}, |
| 199 | {APL2_ETSIC, CTL_FCC, CTL_ETSI}, | 200 | {APL2_ETSIC, CTL_FCC, CTL_ETSI}, |
| 200 | {APL2_APLD, CTL_FCC, NO_CTL}, | 201 | {APL2_APLD, CTL_FCC, NO_CTL}, |
diff --git a/drivers/net/wireless/b43/dma.c b/drivers/net/wireless/b43/dma.c index 3d5566e7af0a..ff0f5ba14b2c 100644 --- a/drivers/net/wireless/b43/dma.c +++ b/drivers/net/wireless/b43/dma.c | |||
| @@ -1536,7 +1536,7 @@ static void dma_rx(struct b43_dmaring *ring, int *slot) | |||
| 1536 | dmaaddr = meta->dmaaddr; | 1536 | dmaaddr = meta->dmaaddr; |
| 1537 | goto drop_recycle_buffer; | 1537 | goto drop_recycle_buffer; |
| 1538 | } | 1538 | } |
| 1539 | if (unlikely(len > ring->rx_buffersize)) { | 1539 | if (unlikely(len + ring->frameoffset > ring->rx_buffersize)) { |
| 1540 | /* The data did not fit into one descriptor buffer | 1540 | /* The data did not fit into one descriptor buffer |
| 1541 | * and is split over multiple buffers. | 1541 | * and is split over multiple buffers. |
| 1542 | * This should never happen, as we try to allocate buffers | 1542 | * This should never happen, as we try to allocate buffers |
diff --git a/drivers/net/wireless/b43/dma.h b/drivers/net/wireless/b43/dma.h index a01c2100f166..e8a80a1251bf 100644 --- a/drivers/net/wireless/b43/dma.h +++ b/drivers/net/wireless/b43/dma.h | |||
| @@ -163,7 +163,7 @@ struct b43_dmadesc_generic { | |||
| 163 | /* DMA engine tuning knobs */ | 163 | /* DMA engine tuning knobs */ |
| 164 | #define B43_TXRING_SLOTS 256 | 164 | #define B43_TXRING_SLOTS 256 |
| 165 | #define B43_RXRING_SLOTS 64 | 165 | #define B43_RXRING_SLOTS 64 |
| 166 | #define B43_DMA0_RX_BUFFERSIZE IEEE80211_MAX_FRAME_LEN | 166 | #define B43_DMA0_RX_BUFFERSIZE (B43_DMA0_RX_FRAMEOFFSET + IEEE80211_MAX_FRAME_LEN) |
| 167 | 167 | ||
| 168 | /* Pointer poison */ | 168 | /* Pointer poison */ |
| 169 | #define B43_DMA_PTR_POISON ((void *)ERR_PTR(-ENOMEM)) | 169 | #define B43_DMA_PTR_POISON ((void *)ERR_PTR(-ENOMEM)) |
diff --git a/drivers/net/wireless/iwlegacy/Kconfig b/drivers/net/wireless/iwlegacy/Kconfig index 2a45dd44cc12..aef65cd47661 100644 --- a/drivers/net/wireless/iwlegacy/Kconfig +++ b/drivers/net/wireless/iwlegacy/Kconfig | |||
| @@ -1,6 +1,5 @@ | |||
| 1 | config IWLWIFI_LEGACY | 1 | config IWLWIFI_LEGACY |
| 2 | tristate "Intel Wireless Wifi legacy devices" | 2 | tristate |
| 3 | depends on PCI && MAC80211 | ||
| 4 | select FW_LOADER | 3 | select FW_LOADER |
| 5 | select NEW_LEDS | 4 | select NEW_LEDS |
| 6 | select LEDS_CLASS | 5 | select LEDS_CLASS |
| @@ -65,7 +64,8 @@ endmenu | |||
| 65 | 64 | ||
| 66 | config IWL4965 | 65 | config IWL4965 |
| 67 | tristate "Intel Wireless WiFi 4965AGN (iwl4965)" | 66 | tristate "Intel Wireless WiFi 4965AGN (iwl4965)" |
| 68 | depends on IWLWIFI_LEGACY | 67 | depends on PCI && MAC80211 |
| 68 | select IWLWIFI_LEGACY | ||
| 69 | ---help--- | 69 | ---help--- |
| 70 | This option enables support for | 70 | This option enables support for |
| 71 | 71 | ||
| @@ -92,7 +92,8 @@ config IWL4965 | |||
| 92 | 92 | ||
| 93 | config IWL3945 | 93 | config IWL3945 |
| 94 | tristate "Intel PRO/Wireless 3945ABG/BG Network Connection (iwl3945)" | 94 | tristate "Intel PRO/Wireless 3945ABG/BG Network Connection (iwl3945)" |
| 95 | depends on IWLWIFI_LEGACY | 95 | depends on PCI && MAC80211 |
| 96 | select IWLWIFI_LEGACY | ||
| 96 | ---help--- | 97 | ---help--- |
| 97 | Select to build the driver supporting the: | 98 | Select to build the driver supporting the: |
| 98 | 99 | ||
diff --git a/drivers/net/wireless/iwlegacy/iwl-3945-hw.h b/drivers/net/wireless/iwlegacy/iwl-3945-hw.h index 779d3cb86e2c..5c3a68d3af12 100644 --- a/drivers/net/wireless/iwlegacy/iwl-3945-hw.h +++ b/drivers/net/wireless/iwlegacy/iwl-3945-hw.h | |||
| @@ -74,8 +74,6 @@ | |||
| 74 | /* RSSI to dBm */ | 74 | /* RSSI to dBm */ |
| 75 | #define IWL39_RSSI_OFFSET 95 | 75 | #define IWL39_RSSI_OFFSET 95 |
| 76 | 76 | ||
| 77 | #define IWL_DEFAULT_TX_POWER 0x0F | ||
| 78 | |||
| 79 | /* | 77 | /* |
| 80 | * EEPROM related constants, enums, and structures. | 78 | * EEPROM related constants, enums, and structures. |
| 81 | */ | 79 | */ |
diff --git a/drivers/net/wireless/iwlegacy/iwl-4965-hw.h b/drivers/net/wireless/iwlegacy/iwl-4965-hw.h index 08b189c8472d..fc6fa2886d9c 100644 --- a/drivers/net/wireless/iwlegacy/iwl-4965-hw.h +++ b/drivers/net/wireless/iwlegacy/iwl-4965-hw.h | |||
| @@ -804,9 +804,6 @@ struct iwl4965_scd_bc_tbl { | |||
| 804 | 804 | ||
| 805 | #define IWL4965_DEFAULT_TX_RETRY 15 | 805 | #define IWL4965_DEFAULT_TX_RETRY 15 |
| 806 | 806 | ||
| 807 | /* Limit range of txpower output target to be between these values */ | ||
| 808 | #define IWL4965_TX_POWER_TARGET_POWER_MIN (0) /* 0 dBm: 1 milliwatt */ | ||
| 809 | |||
| 810 | /* EEPROM */ | 807 | /* EEPROM */ |
| 811 | #define IWL4965_FIRST_AMPDU_QUEUE 10 | 808 | #define IWL4965_FIRST_AMPDU_QUEUE 10 |
| 812 | 809 | ||
diff --git a/drivers/net/wireless/iwlegacy/iwl-core.c b/drivers/net/wireless/iwlegacy/iwl-core.c index 7007d61bb6b5..c1511b14b239 100644 --- a/drivers/net/wireless/iwlegacy/iwl-core.c +++ b/drivers/net/wireless/iwlegacy/iwl-core.c | |||
| @@ -160,6 +160,7 @@ int iwl_legacy_init_geos(struct iwl_priv *priv) | |||
| 160 | struct ieee80211_channel *geo_ch; | 160 | struct ieee80211_channel *geo_ch; |
| 161 | struct ieee80211_rate *rates; | 161 | struct ieee80211_rate *rates; |
| 162 | int i = 0; | 162 | int i = 0; |
| 163 | s8 max_tx_power = 0; | ||
| 163 | 164 | ||
| 164 | if (priv->bands[IEEE80211_BAND_2GHZ].n_bitrates || | 165 | if (priv->bands[IEEE80211_BAND_2GHZ].n_bitrates || |
| 165 | priv->bands[IEEE80211_BAND_5GHZ].n_bitrates) { | 166 | priv->bands[IEEE80211_BAND_5GHZ].n_bitrates) { |
| @@ -235,8 +236,8 @@ int iwl_legacy_init_geos(struct iwl_priv *priv) | |||
| 235 | 236 | ||
| 236 | geo_ch->flags |= ch->ht40_extension_channel; | 237 | geo_ch->flags |= ch->ht40_extension_channel; |
| 237 | 238 | ||
| 238 | if (ch->max_power_avg > priv->tx_power_device_lmt) | 239 | if (ch->max_power_avg > max_tx_power) |
| 239 | priv->tx_power_device_lmt = ch->max_power_avg; | 240 | max_tx_power = ch->max_power_avg; |
| 240 | } else { | 241 | } else { |
| 241 | geo_ch->flags |= IEEE80211_CHAN_DISABLED; | 242 | geo_ch->flags |= IEEE80211_CHAN_DISABLED; |
| 242 | } | 243 | } |
| @@ -249,6 +250,10 @@ int iwl_legacy_init_geos(struct iwl_priv *priv) | |||
| 249 | geo_ch->flags); | 250 | geo_ch->flags); |
| 250 | } | 251 | } |
| 251 | 252 | ||
| 253 | priv->tx_power_device_lmt = max_tx_power; | ||
| 254 | priv->tx_power_user_lmt = max_tx_power; | ||
| 255 | priv->tx_power_next = max_tx_power; | ||
| 256 | |||
| 252 | if ((priv->bands[IEEE80211_BAND_5GHZ].n_channels == 0) && | 257 | if ((priv->bands[IEEE80211_BAND_5GHZ].n_channels == 0) && |
| 253 | priv->cfg->sku & IWL_SKU_A) { | 258 | priv->cfg->sku & IWL_SKU_A) { |
| 254 | IWL_INFO(priv, "Incorrectly detected BG card as ABG. " | 259 | IWL_INFO(priv, "Incorrectly detected BG card as ABG. " |
| @@ -1124,11 +1129,11 @@ int iwl_legacy_set_tx_power(struct iwl_priv *priv, s8 tx_power, bool force) | |||
| 1124 | if (!priv->cfg->ops->lib->send_tx_power) | 1129 | if (!priv->cfg->ops->lib->send_tx_power) |
| 1125 | return -EOPNOTSUPP; | 1130 | return -EOPNOTSUPP; |
| 1126 | 1131 | ||
| 1127 | if (tx_power < IWL4965_TX_POWER_TARGET_POWER_MIN) { | 1132 | /* 0 dBm mean 1 milliwatt */ |
| 1133 | if (tx_power < 0) { | ||
| 1128 | IWL_WARN(priv, | 1134 | IWL_WARN(priv, |
| 1129 | "Requested user TXPOWER %d below lower limit %d.\n", | 1135 | "Requested user TXPOWER %d below 1 mW.\n", |
| 1130 | tx_power, | 1136 | tx_power); |
| 1131 | IWL4965_TX_POWER_TARGET_POWER_MIN); | ||
| 1132 | return -EINVAL; | 1137 | return -EINVAL; |
| 1133 | } | 1138 | } |
| 1134 | 1139 | ||
diff --git a/drivers/net/wireless/iwlegacy/iwl-eeprom.c b/drivers/net/wireless/iwlegacy/iwl-eeprom.c index 04c5648027df..cb346d1a9ffa 100644 --- a/drivers/net/wireless/iwlegacy/iwl-eeprom.c +++ b/drivers/net/wireless/iwlegacy/iwl-eeprom.c | |||
| @@ -471,13 +471,6 @@ int iwl_legacy_init_channel_map(struct iwl_priv *priv) | |||
| 471 | flags & EEPROM_CHANNEL_RADAR)) | 471 | flags & EEPROM_CHANNEL_RADAR)) |
| 472 | ? "" : "not "); | 472 | ? "" : "not "); |
| 473 | 473 | ||
| 474 | /* Set the tx_power_user_lmt to the highest power | ||
| 475 | * supported by any channel */ | ||
| 476 | if (eeprom_ch_info[ch].max_power_avg > | ||
| 477 | priv->tx_power_user_lmt) | ||
| 478 | priv->tx_power_user_lmt = | ||
| 479 | eeprom_ch_info[ch].max_power_avg; | ||
| 480 | |||
| 481 | ch_info++; | 474 | ch_info++; |
| 482 | } | 475 | } |
| 483 | } | 476 | } |
diff --git a/drivers/net/wireless/iwlegacy/iwl3945-base.c b/drivers/net/wireless/iwlegacy/iwl3945-base.c index 28eb3d885ba1..cc7ebcee60e5 100644 --- a/drivers/net/wireless/iwlegacy/iwl3945-base.c +++ b/drivers/net/wireless/iwlegacy/iwl3945-base.c | |||
| @@ -3825,10 +3825,6 @@ static int iwl3945_init_drv(struct iwl_priv *priv) | |||
| 3825 | priv->force_reset[IWL_FW_RESET].reset_duration = | 3825 | priv->force_reset[IWL_FW_RESET].reset_duration = |
| 3826 | IWL_DELAY_NEXT_FORCE_FW_RELOAD; | 3826 | IWL_DELAY_NEXT_FORCE_FW_RELOAD; |
| 3827 | 3827 | ||
| 3828 | |||
| 3829 | priv->tx_power_user_lmt = IWL_DEFAULT_TX_POWER; | ||
| 3830 | priv->tx_power_next = IWL_DEFAULT_TX_POWER; | ||
| 3831 | |||
| 3832 | if (eeprom->version < EEPROM_3945_EEPROM_VERSION) { | 3828 | if (eeprom->version < EEPROM_3945_EEPROM_VERSION) { |
| 3833 | IWL_WARN(priv, "Unsupported EEPROM version: 0x%04X\n", | 3829 | IWL_WARN(priv, "Unsupported EEPROM version: 0x%04X\n", |
| 3834 | eeprom->version); | 3830 | eeprom->version); |
diff --git a/drivers/net/wireless/iwlegacy/iwl4965-base.c b/drivers/net/wireless/iwlegacy/iwl4965-base.c index 91b3d8b9d7a5..d484c3678163 100644 --- a/drivers/net/wireless/iwlegacy/iwl4965-base.c +++ b/drivers/net/wireless/iwlegacy/iwl4965-base.c | |||
| @@ -3140,12 +3140,6 @@ static int iwl4965_init_drv(struct iwl_priv *priv) | |||
| 3140 | 3140 | ||
| 3141 | iwl_legacy_init_scan_params(priv); | 3141 | iwl_legacy_init_scan_params(priv); |
| 3142 | 3142 | ||
| 3143 | /* Set the tx_power_user_lmt to the lowest power level | ||
| 3144 | * this value will get overwritten by channel max power avg | ||
| 3145 | * from eeprom */ | ||
| 3146 | priv->tx_power_user_lmt = IWL4965_TX_POWER_TARGET_POWER_MIN; | ||
| 3147 | priv->tx_power_next = IWL4965_TX_POWER_TARGET_POWER_MIN; | ||
| 3148 | |||
| 3149 | ret = iwl_legacy_init_channel_map(priv); | 3143 | ret = iwl_legacy_init_channel_map(priv); |
| 3150 | if (ret) { | 3144 | if (ret) { |
| 3151 | IWL_ERR(priv, "initializing regulatory failed: %d\n", ret); | 3145 | IWL_ERR(priv, "initializing regulatory failed: %d\n", ret); |
diff --git a/drivers/net/wireless/iwlwifi/iwl-5000.c b/drivers/net/wireless/iwlwifi/iwl-5000.c index 3ea31b659d1a..22e045b5bcee 100644 --- a/drivers/net/wireless/iwlwifi/iwl-5000.c +++ b/drivers/net/wireless/iwlwifi/iwl-5000.c | |||
| @@ -530,6 +530,9 @@ static struct iwl_ht_params iwl5000_ht_params = { | |||
| 530 | struct iwl_cfg iwl5300_agn_cfg = { | 530 | struct iwl_cfg iwl5300_agn_cfg = { |
| 531 | .name = "Intel(R) Ultimate N WiFi Link 5300 AGN", | 531 | .name = "Intel(R) Ultimate N WiFi Link 5300 AGN", |
| 532 | IWL_DEVICE_5000, | 532 | IWL_DEVICE_5000, |
| 533 | /* at least EEPROM 0x11A has wrong info */ | ||
| 534 | .valid_tx_ant = ANT_ABC, /* .cfg overwrite */ | ||
| 535 | .valid_rx_ant = ANT_ABC, /* .cfg overwrite */ | ||
| 533 | .ht_params = &iwl5000_ht_params, | 536 | .ht_params = &iwl5000_ht_params, |
| 534 | }; | 537 | }; |
| 535 | 538 | ||
diff --git a/drivers/net/wireless/iwlwifi/iwl-eeprom.h b/drivers/net/wireless/iwlwifi/iwl-eeprom.h index 98aa8af01192..20b66469d68f 100644 --- a/drivers/net/wireless/iwlwifi/iwl-eeprom.h +++ b/drivers/net/wireless/iwlwifi/iwl-eeprom.h | |||
| @@ -241,7 +241,7 @@ struct iwl_eeprom_enhanced_txpwr { | |||
| 241 | 241 | ||
| 242 | /* 6x00 Specific */ | 242 | /* 6x00 Specific */ |
| 243 | #define EEPROM_6000_TX_POWER_VERSION (4) | 243 | #define EEPROM_6000_TX_POWER_VERSION (4) |
| 244 | #define EEPROM_6000_EEPROM_VERSION (0x434) | 244 | #define EEPROM_6000_EEPROM_VERSION (0x423) |
| 245 | 245 | ||
| 246 | /* 6x50 Specific */ | 246 | /* 6x50 Specific */ |
| 247 | #define EEPROM_6050_TX_POWER_VERSION (4) | 247 | #define EEPROM_6050_TX_POWER_VERSION (4) |
diff --git a/drivers/net/wireless/mwl8k.c b/drivers/net/wireless/mwl8k.c index 36952274950e..c1ceb4b23971 100644 --- a/drivers/net/wireless/mwl8k.c +++ b/drivers/net/wireless/mwl8k.c | |||
| @@ -137,6 +137,7 @@ struct mwl8k_tx_queue { | |||
| 137 | struct mwl8k_priv { | 137 | struct mwl8k_priv { |
| 138 | struct ieee80211_hw *hw; | 138 | struct ieee80211_hw *hw; |
| 139 | struct pci_dev *pdev; | 139 | struct pci_dev *pdev; |
| 140 | int irq; | ||
| 140 | 141 | ||
| 141 | struct mwl8k_device_info *device_info; | 142 | struct mwl8k_device_info *device_info; |
| 142 | 143 | ||
| @@ -3761,9 +3762,11 @@ static int mwl8k_start(struct ieee80211_hw *hw) | |||
| 3761 | rc = request_irq(priv->pdev->irq, mwl8k_interrupt, | 3762 | rc = request_irq(priv->pdev->irq, mwl8k_interrupt, |
| 3762 | IRQF_SHARED, MWL8K_NAME, hw); | 3763 | IRQF_SHARED, MWL8K_NAME, hw); |
| 3763 | if (rc) { | 3764 | if (rc) { |
| 3765 | priv->irq = -1; | ||
| 3764 | wiphy_err(hw->wiphy, "failed to register IRQ handler\n"); | 3766 | wiphy_err(hw->wiphy, "failed to register IRQ handler\n"); |
| 3765 | return -EIO; | 3767 | return -EIO; |
| 3766 | } | 3768 | } |
| 3769 | priv->irq = priv->pdev->irq; | ||
| 3767 | 3770 | ||
| 3768 | /* Enable TX reclaim and RX tasklets. */ | 3771 | /* Enable TX reclaim and RX tasklets. */ |
| 3769 | tasklet_enable(&priv->poll_tx_task); | 3772 | tasklet_enable(&priv->poll_tx_task); |
| @@ -3800,6 +3803,7 @@ static int mwl8k_start(struct ieee80211_hw *hw) | |||
| 3800 | if (rc) { | 3803 | if (rc) { |
| 3801 | iowrite32(0, priv->regs + MWL8K_HIU_A2H_INTERRUPT_MASK); | 3804 | iowrite32(0, priv->regs + MWL8K_HIU_A2H_INTERRUPT_MASK); |
| 3802 | free_irq(priv->pdev->irq, hw); | 3805 | free_irq(priv->pdev->irq, hw); |
| 3806 | priv->irq = -1; | ||
| 3803 | tasklet_disable(&priv->poll_tx_task); | 3807 | tasklet_disable(&priv->poll_tx_task); |
| 3804 | tasklet_disable(&priv->poll_rx_task); | 3808 | tasklet_disable(&priv->poll_rx_task); |
| 3805 | } | 3809 | } |
| @@ -3818,7 +3822,10 @@ static void mwl8k_stop(struct ieee80211_hw *hw) | |||
| 3818 | 3822 | ||
| 3819 | /* Disable interrupts */ | 3823 | /* Disable interrupts */ |
| 3820 | iowrite32(0, priv->regs + MWL8K_HIU_A2H_INTERRUPT_MASK); | 3824 | iowrite32(0, priv->regs + MWL8K_HIU_A2H_INTERRUPT_MASK); |
| 3821 | free_irq(priv->pdev->irq, hw); | 3825 | if (priv->irq != -1) { |
| 3826 | free_irq(priv->pdev->irq, hw); | ||
| 3827 | priv->irq = -1; | ||
| 3828 | } | ||
| 3822 | 3829 | ||
| 3823 | /* Stop finalize join worker */ | 3830 | /* Stop finalize join worker */ |
| 3824 | cancel_work_sync(&priv->finalize_join_worker); | 3831 | cancel_work_sync(&priv->finalize_join_worker); |
diff --git a/drivers/net/wireless/p54/p54usb.c b/drivers/net/wireless/p54/p54usb.c index 9b344a921e74..e18358725b69 100644 --- a/drivers/net/wireless/p54/p54usb.c +++ b/drivers/net/wireless/p54/p54usb.c | |||
| @@ -56,6 +56,7 @@ static struct usb_device_id p54u_table[] __devinitdata = { | |||
| 56 | {USB_DEVICE(0x0846, 0x4210)}, /* Netgear WG121 the second ? */ | 56 | {USB_DEVICE(0x0846, 0x4210)}, /* Netgear WG121 the second ? */ |
| 57 | {USB_DEVICE(0x0846, 0x4220)}, /* Netgear WG111 */ | 57 | {USB_DEVICE(0x0846, 0x4220)}, /* Netgear WG111 */ |
| 58 | {USB_DEVICE(0x09aa, 0x1000)}, /* Spinnaker Proto board */ | 58 | {USB_DEVICE(0x09aa, 0x1000)}, /* Spinnaker Proto board */ |
| 59 | {USB_DEVICE(0x0bf8, 0x1007)}, /* Fujitsu E-5400 USB */ | ||
| 59 | {USB_DEVICE(0x0cde, 0x0006)}, /* Medion 40900, Roper Europe */ | 60 | {USB_DEVICE(0x0cde, 0x0006)}, /* Medion 40900, Roper Europe */ |
| 60 | {USB_DEVICE(0x0db0, 0x6826)}, /* MSI UB54G (MS-6826) */ | 61 | {USB_DEVICE(0x0db0, 0x6826)}, /* MSI UB54G (MS-6826) */ |
| 61 | {USB_DEVICE(0x107b, 0x55f2)}, /* Gateway WGU-210 (Gemtek) */ | 62 | {USB_DEVICE(0x107b, 0x55f2)}, /* Gateway WGU-210 (Gemtek) */ |
| @@ -68,6 +69,7 @@ static struct usb_device_id p54u_table[] __devinitdata = { | |||
| 68 | {USB_DEVICE(0x1915, 0x2235)}, /* Linksys WUSB54G Portable OEM */ | 69 | {USB_DEVICE(0x1915, 0x2235)}, /* Linksys WUSB54G Portable OEM */ |
| 69 | {USB_DEVICE(0x2001, 0x3701)}, /* DLink DWL-G120 Spinnaker */ | 70 | {USB_DEVICE(0x2001, 0x3701)}, /* DLink DWL-G120 Spinnaker */ |
| 70 | {USB_DEVICE(0x2001, 0x3703)}, /* DLink DWL-G122 */ | 71 | {USB_DEVICE(0x2001, 0x3703)}, /* DLink DWL-G122 */ |
| 72 | {USB_DEVICE(0x2001, 0x3762)}, /* Conceptronic C54U */ | ||
| 71 | {USB_DEVICE(0x5041, 0x2234)}, /* Linksys WUSB54G */ | 73 | {USB_DEVICE(0x5041, 0x2234)}, /* Linksys WUSB54G */ |
| 72 | {USB_DEVICE(0x5041, 0x2235)}, /* Linksys WUSB54G Portable */ | 74 | {USB_DEVICE(0x5041, 0x2235)}, /* Linksys WUSB54G Portable */ |
| 73 | 75 | ||
diff --git a/drivers/net/wireless/p54/txrx.c b/drivers/net/wireless/p54/txrx.c index 7834c26c2954..042842e704de 100644 --- a/drivers/net/wireless/p54/txrx.c +++ b/drivers/net/wireless/p54/txrx.c | |||
| @@ -703,7 +703,7 @@ void p54_tx_80211(struct ieee80211_hw *dev, struct sk_buff *skb) | |||
| 703 | struct p54_tx_info *p54info; | 703 | struct p54_tx_info *p54info; |
| 704 | struct p54_hdr *hdr; | 704 | struct p54_hdr *hdr; |
| 705 | struct p54_tx_data *txhdr; | 705 | struct p54_tx_data *txhdr; |
| 706 | unsigned int padding, len, extra_len; | 706 | unsigned int padding, len, extra_len = 0; |
| 707 | int i, j, ridx; | 707 | int i, j, ridx; |
| 708 | u16 hdr_flags = 0, aid = 0; | 708 | u16 hdr_flags = 0, aid = 0; |
| 709 | u8 rate, queue = 0, crypt_offset = 0; | 709 | u8 rate, queue = 0, crypt_offset = 0; |
diff --git a/drivers/net/wireless/rt2x00/rt2x00dev.c b/drivers/net/wireless/rt2x00/rt2x00dev.c index 9de9dbe94399..84eb6ad36377 100644 --- a/drivers/net/wireless/rt2x00/rt2x00dev.c +++ b/drivers/net/wireless/rt2x00/rt2x00dev.c | |||
| @@ -1062,8 +1062,10 @@ void rt2x00lib_remove_dev(struct rt2x00_dev *rt2x00dev) | |||
| 1062 | * Stop all work. | 1062 | * Stop all work. |
| 1063 | */ | 1063 | */ |
| 1064 | cancel_work_sync(&rt2x00dev->intf_work); | 1064 | cancel_work_sync(&rt2x00dev->intf_work); |
| 1065 | cancel_work_sync(&rt2x00dev->rxdone_work); | 1065 | if (rt2x00_is_usb(rt2x00dev)) { |
| 1066 | cancel_work_sync(&rt2x00dev->txdone_work); | 1066 | cancel_work_sync(&rt2x00dev->rxdone_work); |
| 1067 | cancel_work_sync(&rt2x00dev->txdone_work); | ||
| 1068 | } | ||
| 1067 | destroy_workqueue(rt2x00dev->workqueue); | 1069 | destroy_workqueue(rt2x00dev->workqueue); |
| 1068 | 1070 | ||
| 1069 | /* | 1071 | /* |
diff --git a/drivers/net/wireless/rtlwifi/efuse.c b/drivers/net/wireless/rtlwifi/efuse.c index f74a8701c67d..590f14f45a89 100644 --- a/drivers/net/wireless/rtlwifi/efuse.c +++ b/drivers/net/wireless/rtlwifi/efuse.c | |||
| @@ -685,7 +685,7 @@ static int efuse_pg_packet_read(struct ieee80211_hw *hw, u8 offset, u8 *data) | |||
| 685 | 685 | ||
| 686 | u8 efuse_data, word_cnts = 0; | 686 | u8 efuse_data, word_cnts = 0; |
| 687 | u16 efuse_addr = 0; | 687 | u16 efuse_addr = 0; |
| 688 | u8 hworden; | 688 | u8 hworden = 0; |
| 689 | u8 tmpdata[8]; | 689 | u8 tmpdata[8]; |
| 690 | 690 | ||
| 691 | if (data == NULL) | 691 | if (data == NULL) |
diff --git a/drivers/net/wireless/rtlwifi/rtl8192c/fw_common.c b/drivers/net/wireless/rtlwifi/rtl8192c/fw_common.c index 5ef91374b230..28a6ce3bc239 100644 --- a/drivers/net/wireless/rtlwifi/rtl8192c/fw_common.c +++ b/drivers/net/wireless/rtlwifi/rtl8192c/fw_common.c | |||
| @@ -303,7 +303,7 @@ static void _rtl92c_fill_h2c_command(struct ieee80211_hw *hw, | |||
| 303 | u16 box_reg, box_extreg; | 303 | u16 box_reg, box_extreg; |
| 304 | u8 u1b_tmp; | 304 | u8 u1b_tmp; |
| 305 | bool isfw_read = false; | 305 | bool isfw_read = false; |
| 306 | u8 buf_index; | 306 | u8 buf_index = 0; |
| 307 | bool bwrite_sucess = false; | 307 | bool bwrite_sucess = false; |
| 308 | u8 wait_h2c_limmit = 100; | 308 | u8 wait_h2c_limmit = 100; |
| 309 | u8 wait_writeh2c_limmit = 100; | 309 | u8 wait_writeh2c_limmit = 100; |
diff --git a/drivers/net/wireless/rtlwifi/usb.c b/drivers/net/wireless/rtlwifi/usb.c index a4b2613d6a8c..f5d85735d642 100644 --- a/drivers/net/wireless/rtlwifi/usb.c +++ b/drivers/net/wireless/rtlwifi/usb.c | |||
| @@ -246,7 +246,7 @@ static void _rtl_usb_io_handler_init(struct device *dev, | |||
| 246 | 246 | ||
| 247 | static void _rtl_usb_io_handler_release(struct ieee80211_hw *hw) | 247 | static void _rtl_usb_io_handler_release(struct ieee80211_hw *hw) |
| 248 | { | 248 | { |
| 249 | struct rtl_priv *rtlpriv = rtl_priv(hw); | 249 | struct rtl_priv __maybe_unused *rtlpriv = rtl_priv(hw); |
| 250 | 250 | ||
| 251 | mutex_destroy(&rtlpriv->io.bb_mutex); | 251 | mutex_destroy(&rtlpriv->io.bb_mutex); |
| 252 | } | 252 | } |
diff --git a/drivers/net/wireless/wl12xx/sdio.c b/drivers/net/wireless/wl12xx/sdio.c index 5b9dbeafec06..b1c7d031c391 100644 --- a/drivers/net/wireless/wl12xx/sdio.c +++ b/drivers/net/wireless/wl12xx/sdio.c | |||
| @@ -340,7 +340,7 @@ module_init(wl1271_init); | |||
| 340 | module_exit(wl1271_exit); | 340 | module_exit(wl1271_exit); |
| 341 | 341 | ||
| 342 | MODULE_LICENSE("GPL"); | 342 | MODULE_LICENSE("GPL"); |
| 343 | MODULE_AUTHOR("Luciano Coelho <luciano.coelho@nokia.com>"); | 343 | MODULE_AUTHOR("Luciano Coelho <coelho@ti.com>"); |
| 344 | MODULE_AUTHOR("Juuso Oikarinen <juuso.oikarinen@nokia.com>"); | 344 | MODULE_AUTHOR("Juuso Oikarinen <juuso.oikarinen@nokia.com>"); |
| 345 | MODULE_FIRMWARE(WL1271_FW_NAME); | 345 | MODULE_FIRMWARE(WL1271_FW_NAME); |
| 346 | MODULE_FIRMWARE(WL1271_AP_FW_NAME); | 346 | MODULE_FIRMWARE(WL1271_AP_FW_NAME); |
diff --git a/drivers/net/wireless/wl12xx/spi.c b/drivers/net/wireless/wl12xx/spi.c index 18cf01719ae0..ffc745b17f4d 100644 --- a/drivers/net/wireless/wl12xx/spi.c +++ b/drivers/net/wireless/wl12xx/spi.c | |||
| @@ -487,7 +487,7 @@ module_init(wl1271_init); | |||
| 487 | module_exit(wl1271_exit); | 487 | module_exit(wl1271_exit); |
| 488 | 488 | ||
| 489 | MODULE_LICENSE("GPL"); | 489 | MODULE_LICENSE("GPL"); |
| 490 | MODULE_AUTHOR("Luciano Coelho <luciano.coelho@nokia.com>"); | 490 | MODULE_AUTHOR("Luciano Coelho <coelho@ti.com>"); |
| 491 | MODULE_AUTHOR("Juuso Oikarinen <juuso.oikarinen@nokia.com>"); | 491 | MODULE_AUTHOR("Juuso Oikarinen <juuso.oikarinen@nokia.com>"); |
| 492 | MODULE_FIRMWARE(WL1271_FW_NAME); | 492 | MODULE_FIRMWARE(WL1271_FW_NAME); |
| 493 | MODULE_FIRMWARE(WL1271_AP_FW_NAME); | 493 | MODULE_FIRMWARE(WL1271_AP_FW_NAME); |
diff --git a/drivers/net/wireless/wl12xx/testmode.c b/drivers/net/wireless/wl12xx/testmode.c index e64403b6896d..6ec06a4a4c6d 100644 --- a/drivers/net/wireless/wl12xx/testmode.c +++ b/drivers/net/wireless/wl12xx/testmode.c | |||
| @@ -204,7 +204,10 @@ static int wl1271_tm_cmd_nvs_push(struct wl1271 *wl, struct nlattr *tb[]) | |||
| 204 | 204 | ||
| 205 | kfree(wl->nvs); | 205 | kfree(wl->nvs); |
| 206 | 206 | ||
| 207 | wl->nvs = kzalloc(sizeof(struct wl1271_nvs_file), GFP_KERNEL); | 207 | if (len != sizeof(struct wl1271_nvs_file)) |
| 208 | return -EINVAL; | ||
| 209 | |||
| 210 | wl->nvs = kzalloc(len, GFP_KERNEL); | ||
| 208 | if (!wl->nvs) { | 211 | if (!wl->nvs) { |
| 209 | wl1271_error("could not allocate memory for the nvs file"); | 212 | wl1271_error("could not allocate memory for the nvs file"); |
| 210 | ret = -ENOMEM; | 213 | ret = -ENOMEM; |
diff --git a/drivers/net/wireless/zd1211rw/zd_usb.c b/drivers/net/wireless/zd1211rw/zd_usb.c index 58236e6d0921..ab607bbd6291 100644 --- a/drivers/net/wireless/zd1211rw/zd_usb.c +++ b/drivers/net/wireless/zd1211rw/zd_usb.c | |||
| @@ -643,7 +643,7 @@ static void rx_urb_complete(struct urb *urb) | |||
| 643 | usb = urb->context; | 643 | usb = urb->context; |
| 644 | rx = &usb->rx; | 644 | rx = &usb->rx; |
| 645 | 645 | ||
| 646 | zd_usb_reset_rx_idle_timer(usb); | 646 | tasklet_schedule(&rx->reset_timer_tasklet); |
| 647 | 647 | ||
| 648 | if (length%rx->usb_packet_size > rx->usb_packet_size-4) { | 648 | if (length%rx->usb_packet_size > rx->usb_packet_size-4) { |
| 649 | /* If there is an old first fragment, we don't care. */ | 649 | /* If there is an old first fragment, we don't care. */ |
| @@ -812,6 +812,7 @@ void zd_usb_disable_rx(struct zd_usb *usb) | |||
| 812 | __zd_usb_disable_rx(usb); | 812 | __zd_usb_disable_rx(usb); |
| 813 | mutex_unlock(&rx->setup_mutex); | 813 | mutex_unlock(&rx->setup_mutex); |
| 814 | 814 | ||
| 815 | tasklet_kill(&rx->reset_timer_tasklet); | ||
| 815 | cancel_delayed_work_sync(&rx->idle_work); | 816 | cancel_delayed_work_sync(&rx->idle_work); |
| 816 | } | 817 | } |
| 817 | 818 | ||
| @@ -1106,6 +1107,13 @@ static void zd_rx_idle_timer_handler(struct work_struct *work) | |||
| 1106 | zd_usb_reset_rx(usb); | 1107 | zd_usb_reset_rx(usb); |
| 1107 | } | 1108 | } |
| 1108 | 1109 | ||
| 1110 | static void zd_usb_reset_rx_idle_timer_tasklet(unsigned long param) | ||
| 1111 | { | ||
| 1112 | struct zd_usb *usb = (struct zd_usb *)param; | ||
| 1113 | |||
| 1114 | zd_usb_reset_rx_idle_timer(usb); | ||
| 1115 | } | ||
| 1116 | |||
| 1109 | void zd_usb_reset_rx_idle_timer(struct zd_usb *usb) | 1117 | void zd_usb_reset_rx_idle_timer(struct zd_usb *usb) |
| 1110 | { | 1118 | { |
| 1111 | struct zd_usb_rx *rx = &usb->rx; | 1119 | struct zd_usb_rx *rx = &usb->rx; |
| @@ -1127,6 +1135,7 @@ static inline void init_usb_interrupt(struct zd_usb *usb) | |||
| 1127 | static inline void init_usb_rx(struct zd_usb *usb) | 1135 | static inline void init_usb_rx(struct zd_usb *usb) |
| 1128 | { | 1136 | { |
| 1129 | struct zd_usb_rx *rx = &usb->rx; | 1137 | struct zd_usb_rx *rx = &usb->rx; |
| 1138 | |||
| 1130 | spin_lock_init(&rx->lock); | 1139 | spin_lock_init(&rx->lock); |
| 1131 | mutex_init(&rx->setup_mutex); | 1140 | mutex_init(&rx->setup_mutex); |
| 1132 | if (interface_to_usbdev(usb->intf)->speed == USB_SPEED_HIGH) { | 1141 | if (interface_to_usbdev(usb->intf)->speed == USB_SPEED_HIGH) { |
| @@ -1136,11 +1145,14 @@ static inline void init_usb_rx(struct zd_usb *usb) | |||
| 1136 | } | 1145 | } |
| 1137 | ZD_ASSERT(rx->fragment_length == 0); | 1146 | ZD_ASSERT(rx->fragment_length == 0); |
| 1138 | INIT_DELAYED_WORK(&rx->idle_work, zd_rx_idle_timer_handler); | 1147 | INIT_DELAYED_WORK(&rx->idle_work, zd_rx_idle_timer_handler); |
| 1148 | rx->reset_timer_tasklet.func = zd_usb_reset_rx_idle_timer_tasklet; | ||
| 1149 | rx->reset_timer_tasklet.data = (unsigned long)usb; | ||
| 1139 | } | 1150 | } |
| 1140 | 1151 | ||
| 1141 | static inline void init_usb_tx(struct zd_usb *usb) | 1152 | static inline void init_usb_tx(struct zd_usb *usb) |
| 1142 | { | 1153 | { |
| 1143 | struct zd_usb_tx *tx = &usb->tx; | 1154 | struct zd_usb_tx *tx = &usb->tx; |
| 1155 | |||
| 1144 | spin_lock_init(&tx->lock); | 1156 | spin_lock_init(&tx->lock); |
| 1145 | atomic_set(&tx->enabled, 0); | 1157 | atomic_set(&tx->enabled, 0); |
| 1146 | tx->stopped = 0; | 1158 | tx->stopped = 0; |
| @@ -1671,6 +1683,10 @@ static void iowrite16v_urb_complete(struct urb *urb) | |||
| 1671 | 1683 | ||
| 1672 | if (urb->status && !usb->cmd_error) | 1684 | if (urb->status && !usb->cmd_error) |
| 1673 | usb->cmd_error = urb->status; | 1685 | usb->cmd_error = urb->status; |
| 1686 | |||
| 1687 | if (!usb->cmd_error && | ||
| 1688 | urb->actual_length != urb->transfer_buffer_length) | ||
| 1689 | usb->cmd_error = -EIO; | ||
| 1674 | } | 1690 | } |
| 1675 | 1691 | ||
| 1676 | static int zd_submit_waiting_urb(struct zd_usb *usb, bool last) | 1692 | static int zd_submit_waiting_urb(struct zd_usb *usb, bool last) |
| @@ -1805,7 +1821,7 @@ int zd_usb_iowrite16v_async(struct zd_usb *usb, const struct zd_ioreq16 *ioreqs, | |||
| 1805 | usb_fill_int_urb(urb, udev, usb_sndintpipe(udev, EP_REGS_OUT), | 1821 | usb_fill_int_urb(urb, udev, usb_sndintpipe(udev, EP_REGS_OUT), |
| 1806 | req, req_len, iowrite16v_urb_complete, usb, | 1822 | req, req_len, iowrite16v_urb_complete, usb, |
| 1807 | ep->desc.bInterval); | 1823 | ep->desc.bInterval); |
| 1808 | urb->transfer_flags |= URB_FREE_BUFFER | URB_SHORT_NOT_OK; | 1824 | urb->transfer_flags |= URB_FREE_BUFFER; |
| 1809 | 1825 | ||
| 1810 | /* Submit previous URB */ | 1826 | /* Submit previous URB */ |
| 1811 | r = zd_submit_waiting_urb(usb, false); | 1827 | r = zd_submit_waiting_urb(usb, false); |
diff --git a/drivers/net/wireless/zd1211rw/zd_usb.h b/drivers/net/wireless/zd1211rw/zd_usb.h index b3df2c8116cc..325d0f989257 100644 --- a/drivers/net/wireless/zd1211rw/zd_usb.h +++ b/drivers/net/wireless/zd1211rw/zd_usb.h | |||
| @@ -183,6 +183,7 @@ struct zd_usb_rx { | |||
| 183 | spinlock_t lock; | 183 | spinlock_t lock; |
| 184 | struct mutex setup_mutex; | 184 | struct mutex setup_mutex; |
| 185 | struct delayed_work idle_work; | 185 | struct delayed_work idle_work; |
| 186 | struct tasklet_struct reset_timer_tasklet; | ||
| 186 | u8 fragment[2 * USB_MAX_RX_SIZE]; | 187 | u8 fragment[2 * USB_MAX_RX_SIZE]; |
| 187 | unsigned int fragment_length; | 188 | unsigned int fragment_length; |
| 188 | unsigned int usb_packet_size; | 189 | unsigned int usb_packet_size; |
diff --git a/drivers/pci/Kconfig b/drivers/pci/Kconfig index c8ff646c0b05..0fa466a91bf4 100644 --- a/drivers/pci/Kconfig +++ b/drivers/pci/Kconfig | |||
| @@ -88,4 +88,6 @@ config PCI_IOAPIC | |||
| 88 | depends on HOTPLUG | 88 | depends on HOTPLUG |
| 89 | default y | 89 | default y |
| 90 | 90 | ||
| 91 | select NLS if (DMI || ACPI) | 91 | config PCI_LABEL |
| 92 | def_bool y if (DMI || ACPI) | ||
| 93 | select NLS | ||
diff --git a/drivers/pci/Makefile b/drivers/pci/Makefile index 98d61c8e984b..c85f744270a5 100644 --- a/drivers/pci/Makefile +++ b/drivers/pci/Makefile | |||
| @@ -56,10 +56,10 @@ obj-$(CONFIG_TILE) += setup-bus.o setup-irq.o | |||
| 56 | # ACPI Related PCI FW Functions | 56 | # ACPI Related PCI FW Functions |
| 57 | # ACPI _DSM provided firmware instance and string name | 57 | # ACPI _DSM provided firmware instance and string name |
| 58 | # | 58 | # |
| 59 | obj-$(CONFIG_ACPI) += pci-acpi.o pci-label.o | 59 | obj-$(CONFIG_ACPI) += pci-acpi.o |
| 60 | 60 | ||
| 61 | # SMBIOS provided firmware instance and labels | 61 | # SMBIOS provided firmware instance and labels |
| 62 | obj-$(CONFIG_DMI) += pci-label.o | 62 | obj-$(CONFIG_PCI_LABEL) += pci-label.o |
| 63 | 63 | ||
| 64 | # Cardbus & CompactPCI use setup-bus | 64 | # Cardbus & CompactPCI use setup-bus |
| 65 | obj-$(CONFIG_HOTPLUG) += setup-bus.o | 65 | obj-$(CONFIG_HOTPLUG) += setup-bus.o |
diff --git a/drivers/pci/intel-iommu.c b/drivers/pci/intel-iommu.c index 505c1c7075f0..d552d2c77844 100644 --- a/drivers/pci/intel-iommu.c +++ b/drivers/pci/intel-iommu.c | |||
| @@ -1299,7 +1299,7 @@ static void iommu_detach_domain(struct dmar_domain *domain, | |||
| 1299 | static struct iova_domain reserved_iova_list; | 1299 | static struct iova_domain reserved_iova_list; |
| 1300 | static struct lock_class_key reserved_rbtree_key; | 1300 | static struct lock_class_key reserved_rbtree_key; |
| 1301 | 1301 | ||
| 1302 | static void dmar_init_reserved_ranges(void) | 1302 | static int dmar_init_reserved_ranges(void) |
| 1303 | { | 1303 | { |
| 1304 | struct pci_dev *pdev = NULL; | 1304 | struct pci_dev *pdev = NULL; |
| 1305 | struct iova *iova; | 1305 | struct iova *iova; |
| @@ -1313,8 +1313,10 @@ static void dmar_init_reserved_ranges(void) | |||
| 1313 | /* IOAPIC ranges shouldn't be accessed by DMA */ | 1313 | /* IOAPIC ranges shouldn't be accessed by DMA */ |
| 1314 | iova = reserve_iova(&reserved_iova_list, IOVA_PFN(IOAPIC_RANGE_START), | 1314 | iova = reserve_iova(&reserved_iova_list, IOVA_PFN(IOAPIC_RANGE_START), |
| 1315 | IOVA_PFN(IOAPIC_RANGE_END)); | 1315 | IOVA_PFN(IOAPIC_RANGE_END)); |
| 1316 | if (!iova) | 1316 | if (!iova) { |
| 1317 | printk(KERN_ERR "Reserve IOAPIC range failed\n"); | 1317 | printk(KERN_ERR "Reserve IOAPIC range failed\n"); |
| 1318 | return -ENODEV; | ||
| 1319 | } | ||
| 1318 | 1320 | ||
| 1319 | /* Reserve all PCI MMIO to avoid peer-to-peer access */ | 1321 | /* Reserve all PCI MMIO to avoid peer-to-peer access */ |
| 1320 | for_each_pci_dev(pdev) { | 1322 | for_each_pci_dev(pdev) { |
| @@ -1327,11 +1329,13 @@ static void dmar_init_reserved_ranges(void) | |||
| 1327 | iova = reserve_iova(&reserved_iova_list, | 1329 | iova = reserve_iova(&reserved_iova_list, |
| 1328 | IOVA_PFN(r->start), | 1330 | IOVA_PFN(r->start), |
| 1329 | IOVA_PFN(r->end)); | 1331 | IOVA_PFN(r->end)); |
| 1330 | if (!iova) | 1332 | if (!iova) { |
| 1331 | printk(KERN_ERR "Reserve iova failed\n"); | 1333 | printk(KERN_ERR "Reserve iova failed\n"); |
| 1334 | return -ENODEV; | ||
| 1335 | } | ||
| 1332 | } | 1336 | } |
| 1333 | } | 1337 | } |
| 1334 | 1338 | return 0; | |
| 1335 | } | 1339 | } |
| 1336 | 1340 | ||
| 1337 | static void domain_reserve_special_ranges(struct dmar_domain *domain) | 1341 | static void domain_reserve_special_ranges(struct dmar_domain *domain) |
| @@ -1835,7 +1839,7 @@ static struct dmar_domain *get_domain_for_dev(struct pci_dev *pdev, int gaw) | |||
| 1835 | 1839 | ||
| 1836 | ret = iommu_attach_domain(domain, iommu); | 1840 | ret = iommu_attach_domain(domain, iommu); |
| 1837 | if (ret) { | 1841 | if (ret) { |
| 1838 | domain_exit(domain); | 1842 | free_domain_mem(domain); |
| 1839 | goto error; | 1843 | goto error; |
| 1840 | } | 1844 | } |
| 1841 | 1845 | ||
| @@ -2213,7 +2217,7 @@ static int __init iommu_prepare_static_identity_mapping(int hw) | |||
| 2213 | return 0; | 2217 | return 0; |
| 2214 | } | 2218 | } |
| 2215 | 2219 | ||
| 2216 | int __init init_dmars(void) | 2220 | static int __init init_dmars(int force_on) |
| 2217 | { | 2221 | { |
| 2218 | struct dmar_drhd_unit *drhd; | 2222 | struct dmar_drhd_unit *drhd; |
| 2219 | struct dmar_rmrr_unit *rmrr; | 2223 | struct dmar_rmrr_unit *rmrr; |
| @@ -2393,8 +2397,15 @@ int __init init_dmars(void) | |||
| 2393 | * enable translation | 2397 | * enable translation |
| 2394 | */ | 2398 | */ |
| 2395 | for_each_drhd_unit(drhd) { | 2399 | for_each_drhd_unit(drhd) { |
| 2396 | if (drhd->ignored) | 2400 | if (drhd->ignored) { |
| 2401 | /* | ||
| 2402 | * we always have to disable PMRs or DMA may fail on | ||
| 2403 | * this device | ||
| 2404 | */ | ||
| 2405 | if (force_on) | ||
| 2406 | iommu_disable_protect_mem_regions(drhd->iommu); | ||
| 2397 | continue; | 2407 | continue; |
| 2408 | } | ||
| 2398 | iommu = drhd->iommu; | 2409 | iommu = drhd->iommu; |
| 2399 | 2410 | ||
| 2400 | iommu_flush_write_buffer(iommu); | 2411 | iommu_flush_write_buffer(iommu); |
| @@ -3240,9 +3251,15 @@ static int device_notifier(struct notifier_block *nb, | |||
| 3240 | if (!domain) | 3251 | if (!domain) |
| 3241 | return 0; | 3252 | return 0; |
| 3242 | 3253 | ||
| 3243 | if (action == BUS_NOTIFY_UNBOUND_DRIVER && !iommu_pass_through) | 3254 | if (action == BUS_NOTIFY_UNBOUND_DRIVER && !iommu_pass_through) { |
| 3244 | domain_remove_one_dev_info(domain, pdev); | 3255 | domain_remove_one_dev_info(domain, pdev); |
| 3245 | 3256 | ||
| 3257 | if (!(domain->flags & DOMAIN_FLAG_VIRTUAL_MACHINE) && | ||
| 3258 | !(domain->flags & DOMAIN_FLAG_STATIC_IDENTITY) && | ||
| 3259 | list_empty(&domain->devices)) | ||
| 3260 | domain_exit(domain); | ||
| 3261 | } | ||
| 3262 | |||
| 3246 | return 0; | 3263 | return 0; |
| 3247 | } | 3264 | } |
| 3248 | 3265 | ||
| @@ -3277,12 +3294,21 @@ int __init intel_iommu_init(void) | |||
| 3277 | if (no_iommu || dmar_disabled) | 3294 | if (no_iommu || dmar_disabled) |
| 3278 | return -ENODEV; | 3295 | return -ENODEV; |
| 3279 | 3296 | ||
| 3280 | iommu_init_mempool(); | 3297 | if (iommu_init_mempool()) { |
| 3281 | dmar_init_reserved_ranges(); | 3298 | if (force_on) |
| 3299 | panic("tboot: Failed to initialize iommu memory\n"); | ||
| 3300 | return -ENODEV; | ||
| 3301 | } | ||
| 3302 | |||
| 3303 | if (dmar_init_reserved_ranges()) { | ||
| 3304 | if (force_on) | ||
| 3305 | panic("tboot: Failed to reserve iommu ranges\n"); | ||
| 3306 | return -ENODEV; | ||
| 3307 | } | ||
| 3282 | 3308 | ||
| 3283 | init_no_remapping_devices(); | 3309 | init_no_remapping_devices(); |
| 3284 | 3310 | ||
| 3285 | ret = init_dmars(); | 3311 | ret = init_dmars(force_on); |
| 3286 | if (ret) { | 3312 | if (ret) { |
| 3287 | if (force_on) | 3313 | if (force_on) |
| 3288 | panic("tboot: Failed to initialize DMARs\n"); | 3314 | panic("tboot: Failed to initialize DMARs\n"); |
| @@ -3391,6 +3417,11 @@ static void domain_remove_one_dev_info(struct dmar_domain *domain, | |||
| 3391 | domain->iommu_count--; | 3417 | domain->iommu_count--; |
| 3392 | domain_update_iommu_cap(domain); | 3418 | domain_update_iommu_cap(domain); |
| 3393 | spin_unlock_irqrestore(&domain->iommu_lock, tmp_flags); | 3419 | spin_unlock_irqrestore(&domain->iommu_lock, tmp_flags); |
| 3420 | |||
| 3421 | spin_lock_irqsave(&iommu->lock, tmp_flags); | ||
| 3422 | clear_bit(domain->id, iommu->domain_ids); | ||
| 3423 | iommu->domains[domain->id] = NULL; | ||
| 3424 | spin_unlock_irqrestore(&iommu->lock, tmp_flags); | ||
| 3394 | } | 3425 | } |
| 3395 | 3426 | ||
| 3396 | spin_unlock_irqrestore(&device_domain_lock, flags); | 3427 | spin_unlock_irqrestore(&device_domain_lock, flags); |
| @@ -3607,9 +3638,9 @@ static int intel_iommu_attach_device(struct iommu_domain *domain, | |||
| 3607 | 3638 | ||
| 3608 | pte = dmar_domain->pgd; | 3639 | pte = dmar_domain->pgd; |
| 3609 | if (dma_pte_present(pte)) { | 3640 | if (dma_pte_present(pte)) { |
| 3610 | free_pgtable_page(dmar_domain->pgd); | ||
| 3611 | dmar_domain->pgd = (struct dma_pte *) | 3641 | dmar_domain->pgd = (struct dma_pte *) |
| 3612 | phys_to_virt(dma_pte_addr(pte)); | 3642 | phys_to_virt(dma_pte_addr(pte)); |
| 3643 | free_pgtable_page(pte); | ||
| 3613 | } | 3644 | } |
| 3614 | dmar_domain->agaw--; | 3645 | dmar_domain->agaw--; |
| 3615 | } | 3646 | } |
diff --git a/drivers/pci/pci-driver.c b/drivers/pci/pci-driver.c index d86ea8b01137..135df164a4c1 100644 --- a/drivers/pci/pci-driver.c +++ b/drivers/pci/pci-driver.c | |||
| @@ -781,7 +781,7 @@ static int pci_pm_resume(struct device *dev) | |||
| 781 | 781 | ||
| 782 | #endif /* !CONFIG_SUSPEND */ | 782 | #endif /* !CONFIG_SUSPEND */ |
| 783 | 783 | ||
| 784 | #ifdef CONFIG_HIBERNATION | 784 | #ifdef CONFIG_HIBERNATE_CALLBACKS |
| 785 | 785 | ||
| 786 | static int pci_pm_freeze(struct device *dev) | 786 | static int pci_pm_freeze(struct device *dev) |
| 787 | { | 787 | { |
| @@ -970,7 +970,7 @@ static int pci_pm_restore(struct device *dev) | |||
| 970 | return error; | 970 | return error; |
| 971 | } | 971 | } |
| 972 | 972 | ||
| 973 | #else /* !CONFIG_HIBERNATION */ | 973 | #else /* !CONFIG_HIBERNATE_CALLBACKS */ |
| 974 | 974 | ||
| 975 | #define pci_pm_freeze NULL | 975 | #define pci_pm_freeze NULL |
| 976 | #define pci_pm_freeze_noirq NULL | 976 | #define pci_pm_freeze_noirq NULL |
| @@ -981,7 +981,7 @@ static int pci_pm_restore(struct device *dev) | |||
| 981 | #define pci_pm_restore NULL | 981 | #define pci_pm_restore NULL |
| 982 | #define pci_pm_restore_noirq NULL | 982 | #define pci_pm_restore_noirq NULL |
| 983 | 983 | ||
| 984 | #endif /* !CONFIG_HIBERNATION */ | 984 | #endif /* !CONFIG_HIBERNATE_CALLBACKS */ |
| 985 | 985 | ||
| 986 | #ifdef CONFIG_PM_RUNTIME | 986 | #ifdef CONFIG_PM_RUNTIME |
| 987 | 987 | ||
diff --git a/drivers/pci/setup-bus.c b/drivers/pci/setup-bus.c index 89d0a6a88df7..ebf51ad1b714 100644 --- a/drivers/pci/setup-bus.c +++ b/drivers/pci/setup-bus.c | |||
| @@ -676,10 +676,10 @@ static int pbus_size_mem(struct pci_bus *bus, unsigned long mask, | |||
| 676 | min_align = align1 >> 1; | 676 | min_align = align1 >> 1; |
| 677 | align += aligns[order]; | 677 | align += aligns[order]; |
| 678 | } | 678 | } |
| 679 | size0 = calculate_memsize(size, min_size, 0, resource_size(b_res), align); | 679 | size0 = calculate_memsize(size, min_size, 0, resource_size(b_res), min_align); |
| 680 | size1 = !add_size ? size : | 680 | size1 = !add_size ? size : |
| 681 | calculate_memsize(size, min_size+add_size, 0, | 681 | calculate_memsize(size, min_size+add_size, 0, |
| 682 | resource_size(b_res), align); | 682 | resource_size(b_res), min_align); |
| 683 | if (!size0 && !size1) { | 683 | if (!size0 && !size1) { |
| 684 | if (b_res->start || b_res->end) | 684 | if (b_res->start || b_res->end) |
| 685 | dev_info(&bus->self->dev, "disabling bridge window " | 685 | dev_info(&bus->self->dev, "disabling bridge window " |
diff --git a/drivers/pcmcia/pxa2xx_balloon3.c b/drivers/pcmcia/pxa2xx_balloon3.c index 453c54c97612..4c3e94c0ae85 100644 --- a/drivers/pcmcia/pxa2xx_balloon3.c +++ b/drivers/pcmcia/pxa2xx_balloon3.c | |||
| @@ -25,6 +25,8 @@ | |||
| 25 | 25 | ||
| 26 | #include <mach/balloon3.h> | 26 | #include <mach/balloon3.h> |
| 27 | 27 | ||
| 28 | #include <asm/mach-types.h> | ||
| 29 | |||
| 28 | #include "soc_common.h" | 30 | #include "soc_common.h" |
| 29 | 31 | ||
| 30 | /* | 32 | /* |
| @@ -127,6 +129,9 @@ static int __init balloon3_pcmcia_init(void) | |||
| 127 | { | 129 | { |
| 128 | int ret; | 130 | int ret; |
| 129 | 131 | ||
| 132 | if (!machine_is_balloon3()) | ||
| 133 | return -ENODEV; | ||
| 134 | |||
| 130 | balloon3_pcmcia_device = platform_device_alloc("pxa2xx-pcmcia", -1); | 135 | balloon3_pcmcia_device = platform_device_alloc("pxa2xx-pcmcia", -1); |
| 131 | if (!balloon3_pcmcia_device) | 136 | if (!balloon3_pcmcia_device) |
| 132 | return -ENOMEM; | 137 | return -ENOMEM; |
diff --git a/drivers/pcmcia/pxa2xx_trizeps4.c b/drivers/pcmcia/pxa2xx_trizeps4.c index b7e596620db1..b829e655457b 100644 --- a/drivers/pcmcia/pxa2xx_trizeps4.c +++ b/drivers/pcmcia/pxa2xx_trizeps4.c | |||
| @@ -69,15 +69,15 @@ static int trizeps_pcmcia_hw_init(struct soc_pcmcia_socket *skt) | |||
| 69 | for (i = 0; i < ARRAY_SIZE(irqs); i++) { | 69 | for (i = 0; i < ARRAY_SIZE(irqs); i++) { |
| 70 | if (irqs[i].sock != skt->nr) | 70 | if (irqs[i].sock != skt->nr) |
| 71 | continue; | 71 | continue; |
| 72 | if (gpio_request(IRQ_TO_GPIO(irqs[i].irq), irqs[i].str) < 0) { | 72 | if (gpio_request(irq_to_gpio(irqs[i].irq), irqs[i].str) < 0) { |
| 73 | pr_err("%s: sock %d unable to request gpio %d\n", | 73 | pr_err("%s: sock %d unable to request gpio %d\n", |
| 74 | __func__, skt->nr, IRQ_TO_GPIO(irqs[i].irq)); | 74 | __func__, skt->nr, irq_to_gpio(irqs[i].irq)); |
| 75 | ret = -EBUSY; | 75 | ret = -EBUSY; |
| 76 | goto error; | 76 | goto error; |
| 77 | } | 77 | } |
| 78 | if (gpio_direction_input(IRQ_TO_GPIO(irqs[i].irq)) < 0) { | 78 | if (gpio_direction_input(irq_to_gpio(irqs[i].irq)) < 0) { |
| 79 | pr_err("%s: sock %d unable to set input gpio %d\n", | 79 | pr_err("%s: sock %d unable to set input gpio %d\n", |
| 80 | __func__, skt->nr, IRQ_TO_GPIO(irqs[i].irq)); | 80 | __func__, skt->nr, irq_to_gpio(irqs[i].irq)); |
| 81 | ret = -EINVAL; | 81 | ret = -EINVAL; |
| 82 | goto error; | 82 | goto error; |
| 83 | } | 83 | } |
| @@ -86,7 +86,7 @@ static int trizeps_pcmcia_hw_init(struct soc_pcmcia_socket *skt) | |||
| 86 | 86 | ||
| 87 | error: | 87 | error: |
| 88 | for (; i >= 0; i--) { | 88 | for (; i >= 0; i--) { |
| 89 | gpio_free(IRQ_TO_GPIO(irqs[i].irq)); | 89 | gpio_free(irq_to_gpio(irqs[i].irq)); |
| 90 | } | 90 | } |
| 91 | return (ret); | 91 | return (ret); |
| 92 | } | 92 | } |
| @@ -97,7 +97,7 @@ static void trizeps_pcmcia_hw_shutdown(struct soc_pcmcia_socket *skt) | |||
| 97 | /* free allocated gpio's */ | 97 | /* free allocated gpio's */ |
| 98 | gpio_free(GPIO_PRDY); | 98 | gpio_free(GPIO_PRDY); |
| 99 | for (i = 0; i < ARRAY_SIZE(irqs); i++) | 99 | for (i = 0; i < ARRAY_SIZE(irqs); i++) |
| 100 | gpio_free(IRQ_TO_GPIO(irqs[i].irq)); | 100 | gpio_free(irq_to_gpio(irqs[i].irq)); |
| 101 | } | 101 | } |
| 102 | 102 | ||
| 103 | static unsigned long trizeps_pcmcia_status[2]; | 103 | static unsigned long trizeps_pcmcia_status[2]; |
| @@ -226,6 +226,9 @@ static int __init trizeps_pcmcia_init(void) | |||
| 226 | { | 226 | { |
| 227 | int ret; | 227 | int ret; |
| 228 | 228 | ||
| 229 | if (!machine_is_trizeps4() && !machine_is_trizeps4wl()) | ||
| 230 | return -ENODEV; | ||
| 231 | |||
| 229 | trizeps_pcmcia_device = platform_device_alloc("pxa2xx-pcmcia", -1); | 232 | trizeps_pcmcia_device = platform_device_alloc("pxa2xx-pcmcia", -1); |
| 230 | if (!trizeps_pcmcia_device) | 233 | if (!trizeps_pcmcia_device) |
| 231 | return -ENOMEM; | 234 | return -ENOMEM; |
diff --git a/drivers/platform/x86/Kconfig b/drivers/platform/x86/Kconfig index 2ee442c2a5db..0485e394712a 100644 --- a/drivers/platform/x86/Kconfig +++ b/drivers/platform/x86/Kconfig | |||
| @@ -187,7 +187,8 @@ config MSI_LAPTOP | |||
| 187 | depends on ACPI | 187 | depends on ACPI |
| 188 | depends on BACKLIGHT_CLASS_DEVICE | 188 | depends on BACKLIGHT_CLASS_DEVICE |
| 189 | depends on RFKILL | 189 | depends on RFKILL |
| 190 | depends on SERIO_I8042 | 190 | depends on INPUT && SERIO_I8042 |
| 191 | select INPUT_SPARSEKMAP | ||
| 191 | ---help--- | 192 | ---help--- |
| 192 | This is a driver for laptops built by MSI (MICRO-STAR | 193 | This is a driver for laptops built by MSI (MICRO-STAR |
| 193 | INTERNATIONAL): | 194 | INTERNATIONAL): |
diff --git a/drivers/platform/x86/acer-wmi.c b/drivers/platform/x86/acer-wmi.c index 5ea6c3477d17..ac4e7f83ce6c 100644 --- a/drivers/platform/x86/acer-wmi.c +++ b/drivers/platform/x86/acer-wmi.c | |||
| @@ -89,7 +89,7 @@ MODULE_LICENSE("GPL"); | |||
| 89 | #define ACERWMID_EVENT_GUID "676AA15E-6A47-4D9F-A2CC-1E6D18D14026" | 89 | #define ACERWMID_EVENT_GUID "676AA15E-6A47-4D9F-A2CC-1E6D18D14026" |
| 90 | 90 | ||
| 91 | MODULE_ALIAS("wmi:67C3371D-95A3-4C37-BB61-DD47B491DAAB"); | 91 | MODULE_ALIAS("wmi:67C3371D-95A3-4C37-BB61-DD47B491DAAB"); |
| 92 | MODULE_ALIAS("wmi:6AF4F258-B401-42Fd-BE91-3D4AC2D7C0D3"); | 92 | MODULE_ALIAS("wmi:6AF4F258-B401-42FD-BE91-3D4AC2D7C0D3"); |
| 93 | MODULE_ALIAS("wmi:676AA15E-6A47-4D9F-A2CC-1E6D18D14026"); | 93 | MODULE_ALIAS("wmi:676AA15E-6A47-4D9F-A2CC-1E6D18D14026"); |
| 94 | 94 | ||
| 95 | enum acer_wmi_event_ids { | 95 | enum acer_wmi_event_ids { |
diff --git a/drivers/platform/x86/asus-wmi.c b/drivers/platform/x86/asus-wmi.c index efc776cb0c66..832a3fd7c1c8 100644 --- a/drivers/platform/x86/asus-wmi.c +++ b/drivers/platform/x86/asus-wmi.c | |||
| @@ -201,8 +201,8 @@ static int asus_wmi_input_init(struct asus_wmi *asus) | |||
| 201 | if (!asus->inputdev) | 201 | if (!asus->inputdev) |
| 202 | return -ENOMEM; | 202 | return -ENOMEM; |
| 203 | 203 | ||
| 204 | asus->inputdev->name = asus->driver->input_phys; | 204 | asus->inputdev->name = asus->driver->input_name; |
| 205 | asus->inputdev->phys = asus->driver->input_name; | 205 | asus->inputdev->phys = asus->driver->input_phys; |
| 206 | asus->inputdev->id.bustype = BUS_HOST; | 206 | asus->inputdev->id.bustype = BUS_HOST; |
| 207 | asus->inputdev->dev.parent = &asus->platform_device->dev; | 207 | asus->inputdev->dev.parent = &asus->platform_device->dev; |
| 208 | 208 | ||
diff --git a/drivers/platform/x86/eeepc-wmi.c b/drivers/platform/x86/eeepc-wmi.c index 0ddc434fb93b..649dcadd8ea3 100644 --- a/drivers/platform/x86/eeepc-wmi.c +++ b/drivers/platform/x86/eeepc-wmi.c | |||
| @@ -67,9 +67,11 @@ static const struct key_entry eeepc_wmi_keymap[] = { | |||
| 67 | { KE_KEY, 0x82, { KEY_CAMERA } }, | 67 | { KE_KEY, 0x82, { KEY_CAMERA } }, |
| 68 | { KE_KEY, 0x83, { KEY_CAMERA_ZOOMIN } }, | 68 | { KE_KEY, 0x83, { KEY_CAMERA_ZOOMIN } }, |
| 69 | { KE_KEY, 0x88, { KEY_WLAN } }, | 69 | { KE_KEY, 0x88, { KEY_WLAN } }, |
| 70 | { KE_KEY, 0xbd, { KEY_CAMERA } }, | ||
| 70 | { KE_KEY, 0xcc, { KEY_SWITCHVIDEOMODE } }, | 71 | { KE_KEY, 0xcc, { KEY_SWITCHVIDEOMODE } }, |
| 71 | { KE_KEY, 0xe0, { KEY_PROG1 } }, /* Task Manager */ | 72 | { KE_KEY, 0xe0, { KEY_PROG1 } }, /* Task Manager */ |
| 72 | { KE_KEY, 0xe1, { KEY_F14 } }, /* Change Resolution */ | 73 | { KE_KEY, 0xe1, { KEY_F14 } }, /* Change Resolution */ |
| 74 | { KE_KEY, 0xe8, { KEY_SCREENLOCK } }, | ||
| 73 | { KE_KEY, 0xe9, { KEY_BRIGHTNESS_ZERO } }, | 75 | { KE_KEY, 0xe9, { KEY_BRIGHTNESS_ZERO } }, |
| 74 | { KE_KEY, 0xeb, { KEY_CAMERA_ZOOMOUT } }, | 76 | { KE_KEY, 0xeb, { KEY_CAMERA_ZOOMOUT } }, |
| 75 | { KE_KEY, 0xec, { KEY_CAMERA_UP } }, | 77 | { KE_KEY, 0xec, { KEY_CAMERA_UP } }, |
diff --git a/drivers/platform/x86/intel_pmic_gpio.c b/drivers/platform/x86/intel_pmic_gpio.c index d653104b59cb..464bb3fc4d88 100644 --- a/drivers/platform/x86/intel_pmic_gpio.c +++ b/drivers/platform/x86/intel_pmic_gpio.c | |||
| @@ -74,6 +74,19 @@ struct pmic_gpio { | |||
| 74 | u32 trigger_type; | 74 | u32 trigger_type; |
| 75 | }; | 75 | }; |
| 76 | 76 | ||
| 77 | static void pmic_program_irqtype(int gpio, int type) | ||
| 78 | { | ||
| 79 | if (type & IRQ_TYPE_EDGE_RISING) | ||
| 80 | intel_scu_ipc_update_register(GPIO0 + gpio, 0x20, 0x20); | ||
| 81 | else | ||
| 82 | intel_scu_ipc_update_register(GPIO0 + gpio, 0x00, 0x20); | ||
| 83 | |||
| 84 | if (type & IRQ_TYPE_EDGE_FALLING) | ||
| 85 | intel_scu_ipc_update_register(GPIO0 + gpio, 0x10, 0x10); | ||
| 86 | else | ||
| 87 | intel_scu_ipc_update_register(GPIO0 + gpio, 0x00, 0x10); | ||
| 88 | }; | ||
| 89 | |||
| 77 | static int pmic_gpio_direction_input(struct gpio_chip *chip, unsigned offset) | 90 | static int pmic_gpio_direction_input(struct gpio_chip *chip, unsigned offset) |
| 78 | { | 91 | { |
| 79 | if (offset > 8) { | 92 | if (offset > 8) { |
| @@ -166,16 +179,38 @@ static int pmic_gpio_to_irq(struct gpio_chip *chip, unsigned offset) | |||
| 166 | return pg->irq_base + offset; | 179 | return pg->irq_base + offset; |
| 167 | } | 180 | } |
| 168 | 181 | ||
| 182 | static void pmic_bus_lock(struct irq_data *data) | ||
| 183 | { | ||
| 184 | struct pmic_gpio *pg = irq_data_get_irq_chip_data(data); | ||
| 185 | |||
| 186 | mutex_lock(&pg->buslock); | ||
| 187 | } | ||
| 188 | |||
| 189 | static void pmic_bus_sync_unlock(struct irq_data *data) | ||
| 190 | { | ||
| 191 | struct pmic_gpio *pg = irq_data_get_irq_chip_data(data); | ||
| 192 | |||
| 193 | if (pg->update_type) { | ||
| 194 | unsigned int gpio = pg->update_type & ~GPIO_UPDATE_TYPE; | ||
| 195 | |||
| 196 | pmic_program_irqtype(gpio, pg->trigger_type); | ||
| 197 | pg->update_type = 0; | ||
| 198 | } | ||
| 199 | mutex_unlock(&pg->buslock); | ||
| 200 | } | ||
| 201 | |||
| 169 | /* the gpiointr register is read-clear, so just do nothing. */ | 202 | /* the gpiointr register is read-clear, so just do nothing. */ |
| 170 | static void pmic_irq_unmask(struct irq_data *data) { } | 203 | static void pmic_irq_unmask(struct irq_data *data) { } |
| 171 | 204 | ||
| 172 | static void pmic_irq_mask(struct irq_data *data) { } | 205 | static void pmic_irq_mask(struct irq_data *data) { } |
| 173 | 206 | ||
| 174 | static struct irq_chip pmic_irqchip = { | 207 | static struct irq_chip pmic_irqchip = { |
| 175 | .name = "PMIC-GPIO", | 208 | .name = "PMIC-GPIO", |
| 176 | .irq_mask = pmic_irq_mask, | 209 | .irq_mask = pmic_irq_mask, |
| 177 | .irq_unmask = pmic_irq_unmask, | 210 | .irq_unmask = pmic_irq_unmask, |
| 178 | .irq_set_type = pmic_irq_type, | 211 | .irq_set_type = pmic_irq_type, |
| 212 | .irq_bus_lock = pmic_bus_lock, | ||
| 213 | .irq_bus_sync_unlock = pmic_bus_sync_unlock, | ||
| 179 | }; | 214 | }; |
| 180 | 215 | ||
| 181 | static irqreturn_t pmic_irq_handler(int irq, void *data) | 216 | static irqreturn_t pmic_irq_handler(int irq, void *data) |
diff --git a/drivers/platform/x86/samsung-laptop.c b/drivers/platform/x86/samsung-laptop.c index de434c6dc2d6..d347116d150e 100644 --- a/drivers/platform/x86/samsung-laptop.c +++ b/drivers/platform/x86/samsung-laptop.c | |||
| @@ -571,6 +571,16 @@ static struct dmi_system_id __initdata samsung_dmi_table[] = { | |||
| 571 | .callback = dmi_check_cb, | 571 | .callback = dmi_check_cb, |
| 572 | }, | 572 | }, |
| 573 | { | 573 | { |
| 574 | .ident = "R410 Plus", | ||
| 575 | .matches = { | ||
| 576 | DMI_MATCH(DMI_SYS_VENDOR, | ||
| 577 | "SAMSUNG ELECTRONICS CO., LTD."), | ||
| 578 | DMI_MATCH(DMI_PRODUCT_NAME, "R410P"), | ||
| 579 | DMI_MATCH(DMI_BOARD_NAME, "R460"), | ||
| 580 | }, | ||
| 581 | .callback = dmi_check_cb, | ||
| 582 | }, | ||
| 583 | { | ||
| 574 | .ident = "R518", | 584 | .ident = "R518", |
| 575 | .matches = { | 585 | .matches = { |
| 576 | DMI_MATCH(DMI_SYS_VENDOR, | 586 | DMI_MATCH(DMI_SYS_VENDOR, |
| @@ -591,12 +601,12 @@ static struct dmi_system_id __initdata samsung_dmi_table[] = { | |||
| 591 | .callback = dmi_check_cb, | 601 | .callback = dmi_check_cb, |
| 592 | }, | 602 | }, |
| 593 | { | 603 | { |
| 594 | .ident = "N150/N210/N220", | 604 | .ident = "N150/N210/N220/N230", |
| 595 | .matches = { | 605 | .matches = { |
| 596 | DMI_MATCH(DMI_SYS_VENDOR, | 606 | DMI_MATCH(DMI_SYS_VENDOR, |
| 597 | "SAMSUNG ELECTRONICS CO., LTD."), | 607 | "SAMSUNG ELECTRONICS CO., LTD."), |
| 598 | DMI_MATCH(DMI_PRODUCT_NAME, "N150/N210/N220"), | 608 | DMI_MATCH(DMI_PRODUCT_NAME, "N150/N210/N220/N230"), |
| 599 | DMI_MATCH(DMI_BOARD_NAME, "N150/N210/N220"), | 609 | DMI_MATCH(DMI_BOARD_NAME, "N150/N210/N220/N230"), |
| 600 | }, | 610 | }, |
| 601 | .callback = dmi_check_cb, | 611 | .callback = dmi_check_cb, |
| 602 | }, | 612 | }, |
| @@ -771,6 +781,7 @@ static int __init samsung_init(void) | |||
| 771 | 781 | ||
| 772 | /* create a backlight device to talk to this one */ | 782 | /* create a backlight device to talk to this one */ |
| 773 | memset(&props, 0, sizeof(struct backlight_properties)); | 783 | memset(&props, 0, sizeof(struct backlight_properties)); |
| 784 | props.type = BACKLIGHT_PLATFORM; | ||
| 774 | props.max_brightness = sabi_config->max_brightness; | 785 | props.max_brightness = sabi_config->max_brightness; |
| 775 | backlight_device = backlight_device_register("samsung", &sdev->dev, | 786 | backlight_device = backlight_device_register("samsung", &sdev->dev, |
| 776 | NULL, &backlight_ops, | 787 | NULL, &backlight_ops, |
diff --git a/drivers/platform/x86/sony-laptop.c b/drivers/platform/x86/sony-laptop.c index e642f5f29504..8f709aec4da0 100644 --- a/drivers/platform/x86/sony-laptop.c +++ b/drivers/platform/x86/sony-laptop.c | |||
| @@ -138,6 +138,8 @@ MODULE_PARM_DESC(kbd_backlight_timeout, | |||
| 138 | "1 for 30 seconds, 2 for 60 seconds and 3 to disable timeout " | 138 | "1 for 30 seconds, 2 for 60 seconds and 3 to disable timeout " |
| 139 | "(default: 0)"); | 139 | "(default: 0)"); |
| 140 | 140 | ||
| 141 | static void sony_nc_kbd_backlight_resume(void); | ||
| 142 | |||
| 141 | enum sony_nc_rfkill { | 143 | enum sony_nc_rfkill { |
| 142 | SONY_WIFI, | 144 | SONY_WIFI, |
| 143 | SONY_BLUETOOTH, | 145 | SONY_BLUETOOTH, |
| @@ -771,11 +773,6 @@ static int sony_nc_handles_setup(struct platform_device *pd) | |||
| 771 | if (!handles) | 773 | if (!handles) |
| 772 | return -ENOMEM; | 774 | return -ENOMEM; |
| 773 | 775 | ||
| 774 | sysfs_attr_init(&handles->devattr.attr); | ||
| 775 | handles->devattr.attr.name = "handles"; | ||
| 776 | handles->devattr.attr.mode = S_IRUGO; | ||
| 777 | handles->devattr.show = sony_nc_handles_show; | ||
| 778 | |||
| 779 | for (i = 0; i < ARRAY_SIZE(handles->cap); i++) { | 776 | for (i = 0; i < ARRAY_SIZE(handles->cap); i++) { |
| 780 | if (!acpi_callsetfunc(sony_nc_acpi_handle, | 777 | if (!acpi_callsetfunc(sony_nc_acpi_handle, |
| 781 | "SN00", i + 0x20, &result)) { | 778 | "SN00", i + 0x20, &result)) { |
| @@ -785,11 +782,18 @@ static int sony_nc_handles_setup(struct platform_device *pd) | |||
| 785 | } | 782 | } |
| 786 | } | 783 | } |
| 787 | 784 | ||
| 788 | /* allow reading capabilities via sysfs */ | 785 | if (debug) { |
| 789 | if (device_create_file(&pd->dev, &handles->devattr)) { | 786 | sysfs_attr_init(&handles->devattr.attr); |
| 790 | kfree(handles); | 787 | handles->devattr.attr.name = "handles"; |
| 791 | handles = NULL; | 788 | handles->devattr.attr.mode = S_IRUGO; |
| 792 | return -1; | 789 | handles->devattr.show = sony_nc_handles_show; |
| 790 | |||
| 791 | /* allow reading capabilities via sysfs */ | ||
| 792 | if (device_create_file(&pd->dev, &handles->devattr)) { | ||
| 793 | kfree(handles); | ||
| 794 | handles = NULL; | ||
| 795 | return -1; | ||
| 796 | } | ||
| 793 | } | 797 | } |
| 794 | 798 | ||
| 795 | return 0; | 799 | return 0; |
| @@ -798,7 +802,8 @@ static int sony_nc_handles_setup(struct platform_device *pd) | |||
| 798 | static int sony_nc_handles_cleanup(struct platform_device *pd) | 802 | static int sony_nc_handles_cleanup(struct platform_device *pd) |
| 799 | { | 803 | { |
| 800 | if (handles) { | 804 | if (handles) { |
| 801 | device_remove_file(&pd->dev, &handles->devattr); | 805 | if (debug) |
| 806 | device_remove_file(&pd->dev, &handles->devattr); | ||
| 802 | kfree(handles); | 807 | kfree(handles); |
| 803 | handles = NULL; | 808 | handles = NULL; |
| 804 | } | 809 | } |
| @@ -808,6 +813,11 @@ static int sony_nc_handles_cleanup(struct platform_device *pd) | |||
| 808 | static int sony_find_snc_handle(int handle) | 813 | static int sony_find_snc_handle(int handle) |
| 809 | { | 814 | { |
| 810 | int i; | 815 | int i; |
| 816 | |||
| 817 | /* not initialized yet, return early */ | ||
| 818 | if (!handles) | ||
| 819 | return -1; | ||
| 820 | |||
| 811 | for (i = 0; i < 0x10; i++) { | 821 | for (i = 0; i < 0x10; i++) { |
| 812 | if (handles->cap[i] == handle) { | 822 | if (handles->cap[i] == handle) { |
| 813 | dprintk("found handle 0x%.4x (offset: 0x%.2x)\n", | 823 | dprintk("found handle 0x%.4x (offset: 0x%.2x)\n", |
| @@ -1168,6 +1178,9 @@ static int sony_nc_resume(struct acpi_device *device) | |||
| 1168 | /* re-read rfkill state */ | 1178 | /* re-read rfkill state */ |
| 1169 | sony_nc_rfkill_update(); | 1179 | sony_nc_rfkill_update(); |
| 1170 | 1180 | ||
| 1181 | /* restore kbd backlight states */ | ||
| 1182 | sony_nc_kbd_backlight_resume(); | ||
| 1183 | |||
| 1171 | return 0; | 1184 | return 0; |
| 1172 | } | 1185 | } |
| 1173 | 1186 | ||
| @@ -1355,6 +1368,7 @@ out_no_enum: | |||
| 1355 | #define KBDBL_HANDLER 0x137 | 1368 | #define KBDBL_HANDLER 0x137 |
| 1356 | #define KBDBL_PRESENT 0xB00 | 1369 | #define KBDBL_PRESENT 0xB00 |
| 1357 | #define SET_MODE 0xC00 | 1370 | #define SET_MODE 0xC00 |
| 1371 | #define SET_STATE 0xD00 | ||
| 1358 | #define SET_TIMEOUT 0xE00 | 1372 | #define SET_TIMEOUT 0xE00 |
| 1359 | 1373 | ||
| 1360 | struct kbd_backlight { | 1374 | struct kbd_backlight { |
| @@ -1377,6 +1391,10 @@ static ssize_t __sony_nc_kbd_backlight_mode_set(u8 value) | |||
| 1377 | (value << 0x10) | SET_MODE, &result)) | 1391 | (value << 0x10) | SET_MODE, &result)) |
| 1378 | return -EIO; | 1392 | return -EIO; |
| 1379 | 1393 | ||
| 1394 | /* Try to turn the light on/off immediately */ | ||
| 1395 | sony_call_snc_handle(KBDBL_HANDLER, (value << 0x10) | SET_STATE, | ||
| 1396 | &result); | ||
| 1397 | |||
| 1380 | kbdbl_handle->mode = value; | 1398 | kbdbl_handle->mode = value; |
| 1381 | 1399 | ||
| 1382 | return 0; | 1400 | return 0; |
| @@ -1458,7 +1476,7 @@ static int sony_nc_kbd_backlight_setup(struct platform_device *pd) | |||
| 1458 | { | 1476 | { |
| 1459 | int result; | 1477 | int result; |
| 1460 | 1478 | ||
| 1461 | if (sony_call_snc_handle(0x137, KBDBL_PRESENT, &result)) | 1479 | if (sony_call_snc_handle(KBDBL_HANDLER, KBDBL_PRESENT, &result)) |
| 1462 | return 0; | 1480 | return 0; |
| 1463 | if (!(result & 0x02)) | 1481 | if (!(result & 0x02)) |
| 1464 | return 0; | 1482 | return 0; |
| @@ -1501,13 +1519,36 @@ outkzalloc: | |||
| 1501 | static int sony_nc_kbd_backlight_cleanup(struct platform_device *pd) | 1519 | static int sony_nc_kbd_backlight_cleanup(struct platform_device *pd) |
| 1502 | { | 1520 | { |
| 1503 | if (kbdbl_handle) { | 1521 | if (kbdbl_handle) { |
| 1522 | int result; | ||
| 1523 | |||
| 1504 | device_remove_file(&pd->dev, &kbdbl_handle->mode_attr); | 1524 | device_remove_file(&pd->dev, &kbdbl_handle->mode_attr); |
| 1505 | device_remove_file(&pd->dev, &kbdbl_handle->timeout_attr); | 1525 | device_remove_file(&pd->dev, &kbdbl_handle->timeout_attr); |
| 1526 | |||
| 1527 | /* restore the default hw behaviour */ | ||
| 1528 | sony_call_snc_handle(KBDBL_HANDLER, 0x1000 | SET_MODE, &result); | ||
| 1529 | sony_call_snc_handle(KBDBL_HANDLER, SET_TIMEOUT, &result); | ||
| 1530 | |||
| 1506 | kfree(kbdbl_handle); | 1531 | kfree(kbdbl_handle); |
| 1507 | } | 1532 | } |
| 1508 | return 0; | 1533 | return 0; |
| 1509 | } | 1534 | } |
| 1510 | 1535 | ||
| 1536 | static void sony_nc_kbd_backlight_resume(void) | ||
| 1537 | { | ||
| 1538 | int ignore = 0; | ||
| 1539 | |||
| 1540 | if (!kbdbl_handle) | ||
| 1541 | return; | ||
| 1542 | |||
| 1543 | if (kbdbl_handle->mode == 0) | ||
| 1544 | sony_call_snc_handle(KBDBL_HANDLER, SET_MODE, &ignore); | ||
| 1545 | |||
| 1546 | if (kbdbl_handle->timeout != 0) | ||
| 1547 | sony_call_snc_handle(KBDBL_HANDLER, | ||
| 1548 | (kbdbl_handle->timeout << 0x10) | SET_TIMEOUT, | ||
| 1549 | &ignore); | ||
| 1550 | } | ||
| 1551 | |||
| 1511 | static void sony_nc_backlight_setup(void) | 1552 | static void sony_nc_backlight_setup(void) |
| 1512 | { | 1553 | { |
| 1513 | acpi_handle unused; | 1554 | acpi_handle unused; |
diff --git a/drivers/platform/x86/thinkpad_acpi.c b/drivers/platform/x86/thinkpad_acpi.c index a08561f5349e..efb3b6b9bcdb 100644 --- a/drivers/platform/x86/thinkpad_acpi.c +++ b/drivers/platform/x86/thinkpad_acpi.c | |||
| @@ -8618,8 +8618,7 @@ static bool __pure __init tpacpi_is_valid_fw_id(const char* const s, | |||
| 8618 | tpacpi_is_fw_digit(s[1]) && | 8618 | tpacpi_is_fw_digit(s[1]) && |
| 8619 | s[2] == t && s[3] == 'T' && | 8619 | s[2] == t && s[3] == 'T' && |
| 8620 | tpacpi_is_fw_digit(s[4]) && | 8620 | tpacpi_is_fw_digit(s[4]) && |
| 8621 | tpacpi_is_fw_digit(s[5]) && | 8621 | tpacpi_is_fw_digit(s[5]); |
| 8622 | s[6] == 'W' && s[7] == 'W'; | ||
| 8623 | } | 8622 | } |
| 8624 | 8623 | ||
| 8625 | /* returns 0 - probe ok, or < 0 - probe error. | 8624 | /* returns 0 - probe ok, or < 0 - probe error. |
diff --git a/drivers/rapidio/rio.c b/drivers/rapidio/rio.c index c29719cacbca..86c9a091a2ff 100644 --- a/drivers/rapidio/rio.c +++ b/drivers/rapidio/rio.c | |||
| @@ -1171,16 +1171,17 @@ static int rio_hdid_setup(char *str) | |||
| 1171 | 1171 | ||
| 1172 | __setup("riohdid=", rio_hdid_setup); | 1172 | __setup("riohdid=", rio_hdid_setup); |
| 1173 | 1173 | ||
| 1174 | void rio_register_mport(struct rio_mport *port) | 1174 | int rio_register_mport(struct rio_mport *port) |
| 1175 | { | 1175 | { |
| 1176 | if (next_portid >= RIO_MAX_MPORTS) { | 1176 | if (next_portid >= RIO_MAX_MPORTS) { |
| 1177 | pr_err("RIO: reached specified max number of mports\n"); | 1177 | pr_err("RIO: reached specified max number of mports\n"); |
| 1178 | return; | 1178 | return 1; |
| 1179 | } | 1179 | } |
| 1180 | 1180 | ||
| 1181 | port->id = next_portid++; | 1181 | port->id = next_portid++; |
| 1182 | port->host_deviceid = rio_get_hdid(port->id); | 1182 | port->host_deviceid = rio_get_hdid(port->id); |
| 1183 | list_add_tail(&port->node, &rio_mports); | 1183 | list_add_tail(&port->node, &rio_mports); |
| 1184 | return 0; | ||
| 1184 | } | 1185 | } |
| 1185 | 1186 | ||
| 1186 | EXPORT_SYMBOL_GPL(rio_local_get_device_id); | 1187 | EXPORT_SYMBOL_GPL(rio_local_get_device_id); |
diff --git a/drivers/rapidio/switches/idt_gen2.c b/drivers/rapidio/switches/idt_gen2.c index 095016a9dec1..ac2701b22e71 100644 --- a/drivers/rapidio/switches/idt_gen2.c +++ b/drivers/rapidio/switches/idt_gen2.c | |||
| @@ -418,3 +418,4 @@ DECLARE_RIO_SWITCH_INIT(RIO_VID_IDT, RIO_DID_IDTCPS1848, idtg2_switch_init); | |||
| 418 | DECLARE_RIO_SWITCH_INIT(RIO_VID_IDT, RIO_DID_IDTCPS1616, idtg2_switch_init); | 418 | DECLARE_RIO_SWITCH_INIT(RIO_VID_IDT, RIO_DID_IDTCPS1616, idtg2_switch_init); |
| 419 | DECLARE_RIO_SWITCH_INIT(RIO_VID_IDT, RIO_DID_IDTVPS1616, idtg2_switch_init); | 419 | DECLARE_RIO_SWITCH_INIT(RIO_VID_IDT, RIO_DID_IDTVPS1616, idtg2_switch_init); |
| 420 | DECLARE_RIO_SWITCH_INIT(RIO_VID_IDT, RIO_DID_IDTSPS1616, idtg2_switch_init); | 420 | DECLARE_RIO_SWITCH_INIT(RIO_VID_IDT, RIO_DID_IDTSPS1616, idtg2_switch_init); |
| 421 | DECLARE_RIO_SWITCH_INIT(RIO_VID_IDT, RIO_DID_IDTCPS1432, idtg2_switch_init); | ||
diff --git a/drivers/rtc/class.c b/drivers/rtc/class.c index 09b4437b3e61..39013867cbd6 100644 --- a/drivers/rtc/class.c +++ b/drivers/rtc/class.c | |||
| @@ -171,7 +171,7 @@ struct rtc_device *rtc_device_register(const char *name, struct device *dev, | |||
| 171 | err = __rtc_read_alarm(rtc, &alrm); | 171 | err = __rtc_read_alarm(rtc, &alrm); |
| 172 | 172 | ||
| 173 | if (!err && !rtc_valid_tm(&alrm.time)) | 173 | if (!err && !rtc_valid_tm(&alrm.time)) |
| 174 | rtc_set_alarm(rtc, &alrm); | 174 | rtc_initialize_alarm(rtc, &alrm); |
| 175 | 175 | ||
| 176 | strlcpy(rtc->name, name, RTC_DEVICE_NAME_SIZE); | 176 | strlcpy(rtc->name, name, RTC_DEVICE_NAME_SIZE); |
| 177 | dev_set_name(&rtc->dev, "rtc%d", id); | 177 | dev_set_name(&rtc->dev, "rtc%d", id); |
diff --git a/drivers/rtc/interface.c b/drivers/rtc/interface.c index 23719f0acbf6..ef6316acec43 100644 --- a/drivers/rtc/interface.c +++ b/drivers/rtc/interface.c | |||
| @@ -375,6 +375,32 @@ int rtc_set_alarm(struct rtc_device *rtc, struct rtc_wkalrm *alarm) | |||
| 375 | } | 375 | } |
| 376 | EXPORT_SYMBOL_GPL(rtc_set_alarm); | 376 | EXPORT_SYMBOL_GPL(rtc_set_alarm); |
| 377 | 377 | ||
| 378 | /* Called once per device from rtc_device_register */ | ||
| 379 | int rtc_initialize_alarm(struct rtc_device *rtc, struct rtc_wkalrm *alarm) | ||
| 380 | { | ||
| 381 | int err; | ||
| 382 | |||
| 383 | err = rtc_valid_tm(&alarm->time); | ||
| 384 | if (err != 0) | ||
| 385 | return err; | ||
| 386 | |||
| 387 | err = mutex_lock_interruptible(&rtc->ops_lock); | ||
| 388 | if (err) | ||
| 389 | return err; | ||
| 390 | |||
| 391 | rtc->aie_timer.node.expires = rtc_tm_to_ktime(alarm->time); | ||
| 392 | rtc->aie_timer.period = ktime_set(0, 0); | ||
| 393 | if (alarm->enabled) { | ||
| 394 | rtc->aie_timer.enabled = 1; | ||
| 395 | timerqueue_add(&rtc->timerqueue, &rtc->aie_timer.node); | ||
| 396 | } | ||
| 397 | mutex_unlock(&rtc->ops_lock); | ||
| 398 | return err; | ||
| 399 | } | ||
| 400 | EXPORT_SYMBOL_GPL(rtc_initialize_alarm); | ||
| 401 | |||
| 402 | |||
| 403 | |||
| 378 | int rtc_alarm_irq_enable(struct rtc_device *rtc, unsigned int enabled) | 404 | int rtc_alarm_irq_enable(struct rtc_device *rtc, unsigned int enabled) |
| 379 | { | 405 | { |
| 380 | int err = mutex_lock_interruptible(&rtc->ops_lock); | 406 | int err = mutex_lock_interruptible(&rtc->ops_lock); |
diff --git a/drivers/rtc/rtc-bfin.c b/drivers/rtc/rtc-bfin.c index a0fc4cf42abf..90d866272c8e 100644 --- a/drivers/rtc/rtc-bfin.c +++ b/drivers/rtc/rtc-bfin.c | |||
| @@ -250,6 +250,8 @@ static int bfin_rtc_alarm_irq_enable(struct device *dev, unsigned int enabled) | |||
| 250 | bfin_rtc_int_set_alarm(rtc); | 250 | bfin_rtc_int_set_alarm(rtc); |
| 251 | else | 251 | else |
| 252 | bfin_rtc_int_clear(~(RTC_ISTAT_ALARM | RTC_ISTAT_ALARM_DAY)); | 252 | bfin_rtc_int_clear(~(RTC_ISTAT_ALARM | RTC_ISTAT_ALARM_DAY)); |
| 253 | |||
| 254 | return 0; | ||
| 253 | } | 255 | } |
| 254 | 256 | ||
| 255 | static int bfin_rtc_read_time(struct device *dev, struct rtc_time *tm) | 257 | static int bfin_rtc_read_time(struct device *dev, struct rtc_time *tm) |
diff --git a/drivers/rtc/rtc-mc13xxx.c b/drivers/rtc/rtc-mc13xxx.c index c42006469559..c5ac03793e79 100644 --- a/drivers/rtc/rtc-mc13xxx.c +++ b/drivers/rtc/rtc-mc13xxx.c | |||
| @@ -401,6 +401,7 @@ const struct platform_device_id mc13xxx_rtc_idtable[] = { | |||
| 401 | }, { | 401 | }, { |
| 402 | .name = "mc13892-rtc", | 402 | .name = "mc13892-rtc", |
| 403 | }, | 403 | }, |
| 404 | { } | ||
| 404 | }; | 405 | }; |
| 405 | 406 | ||
| 406 | static struct platform_driver mc13xxx_rtc_driver = { | 407 | static struct platform_driver mc13xxx_rtc_driver = { |
diff --git a/drivers/rtc/rtc-omap.c b/drivers/rtc/rtc-omap.c index de0dd7b1f146..bcae8dd41496 100644 --- a/drivers/rtc/rtc-omap.c +++ b/drivers/rtc/rtc-omap.c | |||
| @@ -394,7 +394,7 @@ static int __init omap_rtc_probe(struct platform_device *pdev) | |||
| 394 | return 0; | 394 | return 0; |
| 395 | 395 | ||
| 396 | fail2: | 396 | fail2: |
| 397 | free_irq(omap_rtc_timer, NULL); | 397 | free_irq(omap_rtc_timer, rtc); |
| 398 | fail1: | 398 | fail1: |
| 399 | rtc_device_unregister(rtc); | 399 | rtc_device_unregister(rtc); |
| 400 | fail0: | 400 | fail0: |
diff --git a/drivers/rtc/rtc-s3c.c b/drivers/rtc/rtc-s3c.c index 714964913e5e..b3466c491cd3 100644 --- a/drivers/rtc/rtc-s3c.c +++ b/drivers/rtc/rtc-s3c.c | |||
| @@ -336,7 +336,6 @@ static void s3c_rtc_release(struct device *dev) | |||
| 336 | 336 | ||
| 337 | /* do not clear AIE here, it may be needed for wake */ | 337 | /* do not clear AIE here, it may be needed for wake */ |
| 338 | 338 | ||
| 339 | s3c_rtc_setpie(dev, 0); | ||
| 340 | free_irq(s3c_rtc_alarmno, rtc_dev); | 339 | free_irq(s3c_rtc_alarmno, rtc_dev); |
| 341 | free_irq(s3c_rtc_tickno, rtc_dev); | 340 | free_irq(s3c_rtc_tickno, rtc_dev); |
| 342 | } | 341 | } |
| @@ -408,7 +407,6 @@ static int __devexit s3c_rtc_remove(struct platform_device *dev) | |||
| 408 | platform_set_drvdata(dev, NULL); | 407 | platform_set_drvdata(dev, NULL); |
| 409 | rtc_device_unregister(rtc); | 408 | rtc_device_unregister(rtc); |
| 410 | 409 | ||
| 411 | s3c_rtc_setpie(&dev->dev, 0); | ||
| 412 | s3c_rtc_setaie(&dev->dev, 0); | 410 | s3c_rtc_setaie(&dev->dev, 0); |
| 413 | 411 | ||
| 414 | clk_disable(rtc_clk); | 412 | clk_disable(rtc_clk); |
diff --git a/drivers/s390/cio/device.c b/drivers/s390/cio/device.c index df14c51f6532..8e04c00cf0ad 100644 --- a/drivers/s390/cio/device.c +++ b/drivers/s390/cio/device.c | |||
| @@ -541,15 +541,24 @@ static ssize_t online_store (struct device *dev, struct device_attribute *attr, | |||
| 541 | int force, ret; | 541 | int force, ret; |
| 542 | unsigned long i; | 542 | unsigned long i; |
| 543 | 543 | ||
| 544 | if (!dev_fsm_final_state(cdev) && | 544 | /* Prevent conflict between multiple on-/offline processing requests. */ |
| 545 | cdev->private->state != DEV_STATE_DISCONNECTED) | ||
| 546 | return -EAGAIN; | ||
| 547 | if (atomic_cmpxchg(&cdev->private->onoff, 0, 1) != 0) | 545 | if (atomic_cmpxchg(&cdev->private->onoff, 0, 1) != 0) |
| 548 | return -EAGAIN; | 546 | return -EAGAIN; |
| 547 | /* Prevent conflict between internal I/Os and on-/offline processing. */ | ||
| 548 | if (!dev_fsm_final_state(cdev) && | ||
| 549 | cdev->private->state != DEV_STATE_DISCONNECTED) { | ||
| 550 | ret = -EAGAIN; | ||
| 551 | goto out_onoff; | ||
| 552 | } | ||
| 553 | /* Prevent conflict between pending work and on-/offline processing.*/ | ||
| 554 | if (work_pending(&cdev->private->todo_work)) { | ||
| 555 | ret = -EAGAIN; | ||
| 556 | goto out_onoff; | ||
| 557 | } | ||
| 549 | 558 | ||
| 550 | if (cdev->drv && !try_module_get(cdev->drv->driver.owner)) { | 559 | if (cdev->drv && !try_module_get(cdev->drv->driver.owner)) { |
| 551 | atomic_set(&cdev->private->onoff, 0); | 560 | ret = -EINVAL; |
| 552 | return -EINVAL; | 561 | goto out_onoff; |
| 553 | } | 562 | } |
| 554 | if (!strncmp(buf, "force\n", count)) { | 563 | if (!strncmp(buf, "force\n", count)) { |
| 555 | force = 1; | 564 | force = 1; |
| @@ -574,6 +583,7 @@ static ssize_t online_store (struct device *dev, struct device_attribute *attr, | |||
| 574 | out: | 583 | out: |
| 575 | if (cdev->drv) | 584 | if (cdev->drv) |
| 576 | module_put(cdev->drv->driver.owner); | 585 | module_put(cdev->drv->driver.owner); |
| 586 | out_onoff: | ||
| 577 | atomic_set(&cdev->private->onoff, 0); | 587 | atomic_set(&cdev->private->onoff, 0); |
| 578 | return (ret < 0) ? ret : count; | 588 | return (ret < 0) ? ret : count; |
| 579 | } | 589 | } |
| @@ -1311,10 +1321,12 @@ static int purge_fn(struct device *dev, void *data) | |||
| 1311 | 1321 | ||
| 1312 | spin_lock_irq(cdev->ccwlock); | 1322 | spin_lock_irq(cdev->ccwlock); |
| 1313 | if (is_blacklisted(id->ssid, id->devno) && | 1323 | if (is_blacklisted(id->ssid, id->devno) && |
| 1314 | (cdev->private->state == DEV_STATE_OFFLINE)) { | 1324 | (cdev->private->state == DEV_STATE_OFFLINE) && |
| 1325 | (atomic_cmpxchg(&cdev->private->onoff, 0, 1) == 0)) { | ||
| 1315 | CIO_MSG_EVENT(3, "ccw: purging 0.%x.%04x\n", id->ssid, | 1326 | CIO_MSG_EVENT(3, "ccw: purging 0.%x.%04x\n", id->ssid, |
| 1316 | id->devno); | 1327 | id->devno); |
| 1317 | ccw_device_sched_todo(cdev, CDEV_TODO_UNREG); | 1328 | ccw_device_sched_todo(cdev, CDEV_TODO_UNREG); |
| 1329 | atomic_set(&cdev->private->onoff, 0); | ||
| 1318 | } | 1330 | } |
| 1319 | spin_unlock_irq(cdev->ccwlock); | 1331 | spin_unlock_irq(cdev->ccwlock); |
| 1320 | /* Abort loop in case of pending signal. */ | 1332 | /* Abort loop in case of pending signal. */ |
diff --git a/drivers/s390/cio/qdio_main.c b/drivers/s390/cio/qdio_main.c index 479c665e9e7c..c532ba929ccd 100644 --- a/drivers/s390/cio/qdio_main.c +++ b/drivers/s390/cio/qdio_main.c | |||
| @@ -1649,26 +1649,26 @@ static int __init init_QDIO(void) | |||
| 1649 | { | 1649 | { |
| 1650 | int rc; | 1650 | int rc; |
| 1651 | 1651 | ||
| 1652 | rc = qdio_setup_init(); | 1652 | rc = qdio_debug_init(); |
| 1653 | if (rc) | 1653 | if (rc) |
| 1654 | return rc; | 1654 | return rc; |
| 1655 | rc = qdio_setup_init(); | ||
| 1656 | if (rc) | ||
| 1657 | goto out_debug; | ||
| 1655 | rc = tiqdio_allocate_memory(); | 1658 | rc = tiqdio_allocate_memory(); |
| 1656 | if (rc) | 1659 | if (rc) |
| 1657 | goto out_cache; | 1660 | goto out_cache; |
| 1658 | rc = qdio_debug_init(); | ||
| 1659 | if (rc) | ||
| 1660 | goto out_ti; | ||
| 1661 | rc = tiqdio_register_thinints(); | 1661 | rc = tiqdio_register_thinints(); |
| 1662 | if (rc) | 1662 | if (rc) |
| 1663 | goto out_debug; | 1663 | goto out_ti; |
| 1664 | return 0; | 1664 | return 0; |
| 1665 | 1665 | ||
| 1666 | out_debug: | ||
| 1667 | qdio_debug_exit(); | ||
| 1668 | out_ti: | 1666 | out_ti: |
| 1669 | tiqdio_free_memory(); | 1667 | tiqdio_free_memory(); |
| 1670 | out_cache: | 1668 | out_cache: |
| 1671 | qdio_setup_exit(); | 1669 | qdio_setup_exit(); |
| 1670 | out_debug: | ||
| 1671 | qdio_debug_exit(); | ||
| 1672 | return rc; | 1672 | return rc; |
| 1673 | } | 1673 | } |
| 1674 | 1674 | ||
| @@ -1676,8 +1676,8 @@ static void __exit exit_QDIO(void) | |||
| 1676 | { | 1676 | { |
| 1677 | tiqdio_unregister_thinints(); | 1677 | tiqdio_unregister_thinints(); |
| 1678 | tiqdio_free_memory(); | 1678 | tiqdio_free_memory(); |
| 1679 | qdio_debug_exit(); | ||
| 1680 | qdio_setup_exit(); | 1679 | qdio_setup_exit(); |
| 1680 | qdio_debug_exit(); | ||
| 1681 | } | 1681 | } |
| 1682 | 1682 | ||
| 1683 | module_init(init_QDIO); | 1683 | module_init(init_QDIO); |
diff --git a/drivers/scsi/scsi_lib.c b/drivers/scsi/scsi_lib.c index 6d5c7ff43f5b..e9901b8f8443 100644 --- a/drivers/scsi/scsi_lib.c +++ b/drivers/scsi/scsi_lib.c | |||
| @@ -411,8 +411,6 @@ static void scsi_run_queue(struct request_queue *q) | |||
| 411 | list_splice_init(&shost->starved_list, &starved_list); | 411 | list_splice_init(&shost->starved_list, &starved_list); |
| 412 | 412 | ||
| 413 | while (!list_empty(&starved_list)) { | 413 | while (!list_empty(&starved_list)) { |
| 414 | int flagset; | ||
| 415 | |||
| 416 | /* | 414 | /* |
| 417 | * As long as shost is accepting commands and we have | 415 | * As long as shost is accepting commands and we have |
| 418 | * starved queues, call blk_run_queue. scsi_request_fn | 416 | * starved queues, call blk_run_queue. scsi_request_fn |
| @@ -435,20 +433,7 @@ static void scsi_run_queue(struct request_queue *q) | |||
| 435 | continue; | 433 | continue; |
| 436 | } | 434 | } |
| 437 | 435 | ||
| 438 | spin_unlock(shost->host_lock); | 436 | blk_run_queue_async(sdev->request_queue); |
| 439 | |||
| 440 | spin_lock(sdev->request_queue->queue_lock); | ||
| 441 | flagset = test_bit(QUEUE_FLAG_REENTER, &q->queue_flags) && | ||
| 442 | !test_bit(QUEUE_FLAG_REENTER, | ||
| 443 | &sdev->request_queue->queue_flags); | ||
| 444 | if (flagset) | ||
| 445 | queue_flag_set(QUEUE_FLAG_REENTER, sdev->request_queue); | ||
| 446 | __blk_run_queue(sdev->request_queue, false); | ||
| 447 | if (flagset) | ||
| 448 | queue_flag_clear(QUEUE_FLAG_REENTER, sdev->request_queue); | ||
| 449 | spin_unlock(sdev->request_queue->queue_lock); | ||
| 450 | |||
| 451 | spin_lock(shost->host_lock); | ||
| 452 | } | 437 | } |
| 453 | /* put any unprocessed entries back */ | 438 | /* put any unprocessed entries back */ |
| 454 | list_splice(&starved_list, &shost->starved_list); | 439 | list_splice(&starved_list, &shost->starved_list); |
diff --git a/drivers/scsi/scsi_transport_fc.c b/drivers/scsi/scsi_transport_fc.c index fdf3fa639056..815069d13f9b 100644 --- a/drivers/scsi/scsi_transport_fc.c +++ b/drivers/scsi/scsi_transport_fc.c | |||
| @@ -3816,28 +3816,17 @@ fail_host_msg: | |||
| 3816 | static void | 3816 | static void |
| 3817 | fc_bsg_goose_queue(struct fc_rport *rport) | 3817 | fc_bsg_goose_queue(struct fc_rport *rport) |
| 3818 | { | 3818 | { |
| 3819 | int flagset; | ||
| 3820 | unsigned long flags; | ||
| 3821 | |||
| 3822 | if (!rport->rqst_q) | 3819 | if (!rport->rqst_q) |
| 3823 | return; | 3820 | return; |
| 3824 | 3821 | ||
| 3822 | /* | ||
| 3823 | * This get/put dance makes no sense | ||
| 3824 | */ | ||
| 3825 | get_device(&rport->dev); | 3825 | get_device(&rport->dev); |
| 3826 | 3826 | blk_run_queue_async(rport->rqst_q); | |
| 3827 | spin_lock_irqsave(rport->rqst_q->queue_lock, flags); | ||
| 3828 | flagset = test_bit(QUEUE_FLAG_REENTER, &rport->rqst_q->queue_flags) && | ||
| 3829 | !test_bit(QUEUE_FLAG_REENTER, &rport->rqst_q->queue_flags); | ||
| 3830 | if (flagset) | ||
| 3831 | queue_flag_set(QUEUE_FLAG_REENTER, rport->rqst_q); | ||
| 3832 | __blk_run_queue(rport->rqst_q, false); | ||
| 3833 | if (flagset) | ||
| 3834 | queue_flag_clear(QUEUE_FLAG_REENTER, rport->rqst_q); | ||
| 3835 | spin_unlock_irqrestore(rport->rqst_q->queue_lock, flags); | ||
| 3836 | |||
| 3837 | put_device(&rport->dev); | 3827 | put_device(&rport->dev); |
| 3838 | } | 3828 | } |
| 3839 | 3829 | ||
| 3840 | |||
| 3841 | /** | 3830 | /** |
| 3842 | * fc_bsg_rport_dispatch - process rport bsg requests and dispatch to LLDD | 3831 | * fc_bsg_rport_dispatch - process rport bsg requests and dispatch to LLDD |
| 3843 | * @q: rport request queue | 3832 | * @q: rport request queue |
diff --git a/drivers/spi/amba-pl022.c b/drivers/spi/amba-pl022.c index 5825370bad25..08de58e7f59f 100644 --- a/drivers/spi/amba-pl022.c +++ b/drivers/spi/amba-pl022.c | |||
| @@ -1555,7 +1555,7 @@ static int stop_queue(struct pl022 *pl022) | |||
| 1555 | * A wait_queue on the pl022->busy could be used, but then the common | 1555 | * A wait_queue on the pl022->busy could be used, but then the common |
| 1556 | * execution path (pump_messages) would be required to call wake_up or | 1556 | * execution path (pump_messages) would be required to call wake_up or |
| 1557 | * friends on every SPI message. Do this instead */ | 1557 | * friends on every SPI message. Do this instead */ |
| 1558 | while (!list_empty(&pl022->queue) && pl022->busy && limit--) { | 1558 | while ((!list_empty(&pl022->queue) || pl022->busy) && limit--) { |
| 1559 | spin_unlock_irqrestore(&pl022->queue_lock, flags); | 1559 | spin_unlock_irqrestore(&pl022->queue_lock, flags); |
| 1560 | msleep(10); | 1560 | msleep(10); |
| 1561 | spin_lock_irqsave(&pl022->queue_lock, flags); | 1561 | spin_lock_irqsave(&pl022->queue_lock, flags); |
diff --git a/drivers/spi/dw_spi.c b/drivers/spi/dw_spi.c index b1a4b9f503ae..871e337c917f 100644 --- a/drivers/spi/dw_spi.c +++ b/drivers/spi/dw_spi.c | |||
| @@ -821,7 +821,7 @@ static int stop_queue(struct dw_spi *dws) | |||
| 821 | 821 | ||
| 822 | spin_lock_irqsave(&dws->lock, flags); | 822 | spin_lock_irqsave(&dws->lock, flags); |
| 823 | dws->run = QUEUE_STOPPED; | 823 | dws->run = QUEUE_STOPPED; |
| 824 | while (!list_empty(&dws->queue) && dws->busy && limit--) { | 824 | while ((!list_empty(&dws->queue) || dws->busy) && limit--) { |
| 825 | spin_unlock_irqrestore(&dws->lock, flags); | 825 | spin_unlock_irqrestore(&dws->lock, flags); |
| 826 | msleep(10); | 826 | msleep(10); |
| 827 | spin_lock_irqsave(&dws->lock, flags); | 827 | spin_lock_irqsave(&dws->lock, flags); |
diff --git a/drivers/spi/pxa2xx_spi.c b/drivers/spi/pxa2xx_spi.c index 9c74aad6be93..dc25bee8d33f 100644 --- a/drivers/spi/pxa2xx_spi.c +++ b/drivers/spi/pxa2xx_spi.c | |||
| @@ -1493,7 +1493,7 @@ static int stop_queue(struct driver_data *drv_data) | |||
| 1493 | * execution path (pump_messages) would be required to call wake_up or | 1493 | * execution path (pump_messages) would be required to call wake_up or |
| 1494 | * friends on every SPI message. Do this instead */ | 1494 | * friends on every SPI message. Do this instead */ |
| 1495 | drv_data->run = QUEUE_STOPPED; | 1495 | drv_data->run = QUEUE_STOPPED; |
| 1496 | while (!list_empty(&drv_data->queue) && drv_data->busy && limit--) { | 1496 | while ((!list_empty(&drv_data->queue) || drv_data->busy) && limit--) { |
| 1497 | spin_unlock_irqrestore(&drv_data->lock, flags); | 1497 | spin_unlock_irqrestore(&drv_data->lock, flags); |
| 1498 | msleep(10); | 1498 | msleep(10); |
| 1499 | spin_lock_irqsave(&drv_data->lock, flags); | 1499 | spin_lock_irqsave(&drv_data->lock, flags); |
diff --git a/drivers/spi/spi_bfin5xx.c b/drivers/spi/spi_bfin5xx.c index bdb7289a1d22..f706dba165cf 100644 --- a/drivers/spi/spi_bfin5xx.c +++ b/drivers/spi/spi_bfin5xx.c | |||
| @@ -1284,7 +1284,7 @@ static inline int bfin_spi_stop_queue(struct bfin_spi_master_data *drv_data) | |||
| 1284 | * friends on every SPI message. Do this instead | 1284 | * friends on every SPI message. Do this instead |
| 1285 | */ | 1285 | */ |
| 1286 | drv_data->running = false; | 1286 | drv_data->running = false; |
| 1287 | while (!list_empty(&drv_data->queue) && drv_data->busy && limit--) { | 1287 | while ((!list_empty(&drv_data->queue) || drv_data->busy) && limit--) { |
| 1288 | spin_unlock_irqrestore(&drv_data->lock, flags); | 1288 | spin_unlock_irqrestore(&drv_data->lock, flags); |
| 1289 | msleep(10); | 1289 | msleep(10); |
| 1290 | spin_lock_irqsave(&drv_data->lock, flags); | 1290 | spin_lock_irqsave(&drv_data->lock, flags); |
diff --git a/drivers/staging/Kconfig b/drivers/staging/Kconfig index dca4a0bb6ca9..e3786f161bc3 100644 --- a/drivers/staging/Kconfig +++ b/drivers/staging/Kconfig | |||
| @@ -131,8 +131,6 @@ source "drivers/staging/wlags49_h2/Kconfig" | |||
| 131 | 131 | ||
| 132 | source "drivers/staging/wlags49_h25/Kconfig" | 132 | source "drivers/staging/wlags49_h25/Kconfig" |
| 133 | 133 | ||
| 134 | source "drivers/staging/samsung-laptop/Kconfig" | ||
| 135 | |||
| 136 | source "drivers/staging/sm7xx/Kconfig" | 134 | source "drivers/staging/sm7xx/Kconfig" |
| 137 | 135 | ||
| 138 | source "drivers/staging/dt3155v4l/Kconfig" | 136 | source "drivers/staging/dt3155v4l/Kconfig" |
diff --git a/drivers/staging/Makefile b/drivers/staging/Makefile index eb93012b6f59..f0d5c5315612 100644 --- a/drivers/staging/Makefile +++ b/drivers/staging/Makefile | |||
| @@ -48,7 +48,6 @@ obj-$(CONFIG_XVMALLOC) += zram/ | |||
| 48 | obj-$(CONFIG_ZCACHE) += zcache/ | 48 | obj-$(CONFIG_ZCACHE) += zcache/ |
| 49 | obj-$(CONFIG_WLAGS49_H2) += wlags49_h2/ | 49 | obj-$(CONFIG_WLAGS49_H2) += wlags49_h2/ |
| 50 | obj-$(CONFIG_WLAGS49_H25) += wlags49_h25/ | 50 | obj-$(CONFIG_WLAGS49_H25) += wlags49_h25/ |
| 51 | obj-$(CONFIG_SAMSUNG_LAPTOP) += samsung-laptop/ | ||
| 52 | obj-$(CONFIG_FB_SM7XX) += sm7xx/ | 51 | obj-$(CONFIG_FB_SM7XX) += sm7xx/ |
| 53 | obj-$(CONFIG_VIDEO_DT3155) += dt3155v4l/ | 52 | obj-$(CONFIG_VIDEO_DT3155) += dt3155v4l/ |
| 54 | obj-$(CONFIG_CRYSTALHD) += crystalhd/ | 53 | obj-$(CONFIG_CRYSTALHD) += crystalhd/ |
diff --git a/drivers/staging/samsung-laptop/Kconfig b/drivers/staging/samsung-laptop/Kconfig deleted file mode 100644 index f27c60864c26..000000000000 --- a/drivers/staging/samsung-laptop/Kconfig +++ /dev/null | |||
| @@ -1,10 +0,0 @@ | |||
| 1 | config SAMSUNG_LAPTOP | ||
| 2 | tristate "Samsung Laptop driver" | ||
| 3 | default n | ||
| 4 | depends on RFKILL && BACKLIGHT_CLASS_DEVICE && X86 | ||
| 5 | help | ||
| 6 | This module implements a driver for the N128 Samsung Laptop | ||
| 7 | providing control over the Wireless LED and the LCD backlight | ||
| 8 | |||
| 9 | To compile this driver as a module, choose | ||
| 10 | M here: the module will be called samsung-laptop. | ||
diff --git a/drivers/staging/samsung-laptop/Makefile b/drivers/staging/samsung-laptop/Makefile deleted file mode 100644 index 3c6f42045211..000000000000 --- a/drivers/staging/samsung-laptop/Makefile +++ /dev/null | |||
| @@ -1 +0,0 @@ | |||
| 1 | obj-$(CONFIG_SAMSUNG_LAPTOP) += samsung-laptop.o | ||
diff --git a/drivers/staging/samsung-laptop/TODO b/drivers/staging/samsung-laptop/TODO deleted file mode 100644 index f7a6d589916e..000000000000 --- a/drivers/staging/samsung-laptop/TODO +++ /dev/null | |||
| @@ -1,5 +0,0 @@ | |||
| 1 | TODO: | ||
| 2 | - review from other developers | ||
| 3 | - figure out ACPI video issues | ||
| 4 | |||
| 5 | Please send patches to Greg Kroah-Hartman <gregkh@suse.de> | ||
diff --git a/drivers/staging/samsung-laptop/samsung-laptop.c b/drivers/staging/samsung-laptop/samsung-laptop.c deleted file mode 100644 index 25294462b8b6..000000000000 --- a/drivers/staging/samsung-laptop/samsung-laptop.c +++ /dev/null | |||
| @@ -1,843 +0,0 @@ | |||
| 1 | /* | ||
| 2 | * Samsung Laptop driver | ||
| 3 | * | ||
| 4 | * Copyright (C) 2009,2011 Greg Kroah-Hartman (gregkh@suse.de) | ||
| 5 | * Copyright (C) 2009,2011 Novell Inc. | ||
| 6 | * | ||
| 7 | * This program is free software; you can redistribute it and/or modify it | ||
| 8 | * under the terms of the GNU General Public License version 2 as published by | ||
| 9 | * the Free Software Foundation. | ||
| 10 | * | ||
| 11 | */ | ||
| 12 | #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt | ||
| 13 | |||
| 14 | #include <linux/kernel.h> | ||
| 15 | #include <linux/init.h> | ||
| 16 | #include <linux/module.h> | ||
| 17 | #include <linux/delay.h> | ||
| 18 | #include <linux/pci.h> | ||
| 19 | #include <linux/backlight.h> | ||
| 20 | #include <linux/fb.h> | ||
| 21 | #include <linux/dmi.h> | ||
| 22 | #include <linux/platform_device.h> | ||
| 23 | #include <linux/rfkill.h> | ||
| 24 | |||
| 25 | /* | ||
| 26 | * This driver is needed because a number of Samsung laptops do not hook | ||
| 27 | * their control settings through ACPI. So we have to poke around in the | ||
| 28 | * BIOS to do things like brightness values, and "special" key controls. | ||
| 29 | */ | ||
| 30 | |||
| 31 | /* | ||
| 32 | * We have 0 - 8 as valid brightness levels. The specs say that level 0 should | ||
| 33 | * be reserved by the BIOS (which really doesn't make much sense), we tell | ||
| 34 | * userspace that the value is 0 - 7 and then just tell the hardware 1 - 8 | ||
| 35 | */ | ||
| 36 | #define MAX_BRIGHT 0x07 | ||
| 37 | |||
| 38 | |||
| 39 | #define SABI_IFACE_MAIN 0x00 | ||
| 40 | #define SABI_IFACE_SUB 0x02 | ||
| 41 | #define SABI_IFACE_COMPLETE 0x04 | ||
| 42 | #define SABI_IFACE_DATA 0x05 | ||
| 43 | |||
| 44 | /* Structure to get data back to the calling function */ | ||
| 45 | struct sabi_retval { | ||
| 46 | u8 retval[20]; | ||
| 47 | }; | ||
| 48 | |||
| 49 | struct sabi_header_offsets { | ||
| 50 | u8 port; | ||
| 51 | u8 re_mem; | ||
| 52 | u8 iface_func; | ||
| 53 | u8 en_mem; | ||
| 54 | u8 data_offset; | ||
| 55 | u8 data_segment; | ||
| 56 | }; | ||
| 57 | |||
| 58 | struct sabi_commands { | ||
| 59 | /* | ||
| 60 | * Brightness is 0 - 8, as described above. | ||
| 61 | * Value 0 is for the BIOS to use | ||
| 62 | */ | ||
| 63 | u8 get_brightness; | ||
| 64 | u8 set_brightness; | ||
| 65 | |||
| 66 | /* | ||
| 67 | * first byte: | ||
| 68 | * 0x00 - wireless is off | ||
| 69 | * 0x01 - wireless is on | ||
| 70 | * second byte: | ||
| 71 | * 0x02 - 3G is off | ||
| 72 | * 0x03 - 3G is on | ||
| 73 | * TODO, verify 3G is correct, that doesn't seem right... | ||
| 74 | */ | ||
| 75 | u8 get_wireless_button; | ||
| 76 | u8 set_wireless_button; | ||
| 77 | |||
| 78 | /* 0 is off, 1 is on */ | ||
| 79 | u8 get_backlight; | ||
| 80 | u8 set_backlight; | ||
| 81 | |||
| 82 | /* | ||
| 83 | * 0x80 or 0x00 - no action | ||
| 84 | * 0x81 - recovery key pressed | ||
| 85 | */ | ||
| 86 | u8 get_recovery_mode; | ||
| 87 | u8 set_recovery_mode; | ||
| 88 | |||
| 89 | /* | ||
| 90 | * on seclinux: 0 is low, 1 is high, | ||
| 91 | * on swsmi: 0 is normal, 1 is silent, 2 is turbo | ||
| 92 | */ | ||
| 93 | u8 get_performance_level; | ||
| 94 | u8 set_performance_level; | ||
| 95 | |||
| 96 | /* | ||
| 97 | * Tell the BIOS that Linux is running on this machine. | ||
| 98 | * 81 is on, 80 is off | ||
| 99 | */ | ||
| 100 | u8 set_linux; | ||
| 101 | }; | ||
| 102 | |||
| 103 | struct sabi_performance_level { | ||
| 104 | const char *name; | ||
| 105 | u8 value; | ||
| 106 | }; | ||
| 107 | |||
| 108 | struct sabi_config { | ||
| 109 | const char *test_string; | ||
| 110 | u16 main_function; | ||
| 111 | const struct sabi_header_offsets header_offsets; | ||
| 112 | const struct sabi_commands commands; | ||
| 113 | const struct sabi_performance_level performance_levels[4]; | ||
| 114 | u8 min_brightness; | ||
| 115 | u8 max_brightness; | ||
| 116 | }; | ||
| 117 | |||
| 118 | static const struct sabi_config sabi_configs[] = { | ||
| 119 | { | ||
| 120 | .test_string = "SECLINUX", | ||
| 121 | |||
| 122 | .main_function = 0x4c49, | ||
| 123 | |||
| 124 | .header_offsets = { | ||
| 125 | .port = 0x00, | ||
| 126 | .re_mem = 0x02, | ||
| 127 | .iface_func = 0x03, | ||
| 128 | .en_mem = 0x04, | ||
| 129 | .data_offset = 0x05, | ||
| 130 | .data_segment = 0x07, | ||
| 131 | }, | ||
| 132 | |||
| 133 | .commands = { | ||
| 134 | .get_brightness = 0x00, | ||
| 135 | .set_brightness = 0x01, | ||
| 136 | |||
| 137 | .get_wireless_button = 0x02, | ||
| 138 | .set_wireless_button = 0x03, | ||
| 139 | |||
| 140 | .get_backlight = 0x04, | ||
| 141 | .set_backlight = 0x05, | ||
| 142 | |||
| 143 | .get_recovery_mode = 0x06, | ||
| 144 | .set_recovery_mode = 0x07, | ||
| 145 | |||
| 146 | .get_performance_level = 0x08, | ||
| 147 | .set_performance_level = 0x09, | ||
| 148 | |||
| 149 | .set_linux = 0x0a, | ||
| 150 | }, | ||
| 151 | |||
| 152 | .performance_levels = { | ||
| 153 | { | ||
| 154 | .name = "silent", | ||
| 155 | .value = 0, | ||
| 156 | }, | ||
| 157 | { | ||
| 158 | .name = "normal", | ||
| 159 | .value = 1, | ||
| 160 | }, | ||
| 161 | { }, | ||
| 162 | }, | ||
| 163 | .min_brightness = 1, | ||
| 164 | .max_brightness = 8, | ||
| 165 | }, | ||
| 166 | { | ||
| 167 | .test_string = "SwSmi@", | ||
| 168 | |||
| 169 | .main_function = 0x5843, | ||
| 170 | |||
| 171 | .header_offsets = { | ||
| 172 | .port = 0x00, | ||
| 173 | .re_mem = 0x04, | ||
| 174 | .iface_func = 0x02, | ||
| 175 | .en_mem = 0x03, | ||
| 176 | .data_offset = 0x05, | ||
| 177 | .data_segment = 0x07, | ||
| 178 | }, | ||
| 179 | |||
| 180 | .commands = { | ||
| 181 | .get_brightness = 0x10, | ||
| 182 | .set_brightness = 0x11, | ||
| 183 | |||
| 184 | .get_wireless_button = 0x12, | ||
| 185 | .set_wireless_button = 0x13, | ||
| 186 | |||
| 187 | .get_backlight = 0x2d, | ||
| 188 | .set_backlight = 0x2e, | ||
| 189 | |||
| 190 | .get_recovery_mode = 0xff, | ||
| 191 | .set_recovery_mode = 0xff, | ||
| 192 | |||
| 193 | .get_performance_level = 0x31, | ||
| 194 | .set_performance_level = 0x32, | ||
| 195 | |||
| 196 | .set_linux = 0xff, | ||
| 197 | }, | ||
| 198 | |||
| 199 | .performance_levels = { | ||
| 200 | { | ||
| 201 | .name = "normal", | ||
| 202 | .value = 0, | ||
| 203 | }, | ||
| 204 | { | ||
| 205 | .name = "silent", | ||
| 206 | .value = 1, | ||
| 207 | }, | ||
| 208 | { | ||
| 209 | .name = "overclock", | ||
| 210 | .value = 2, | ||
| 211 | }, | ||
| 212 | { }, | ||
| 213 | }, | ||
| 214 | .min_brightness = 0, | ||
| 215 | .max_brightness = 8, | ||
| 216 | }, | ||
| 217 | { }, | ||
| 218 | }; | ||
| 219 | |||
| 220 | static const struct sabi_config *sabi_config; | ||
| 221 | |||
| 222 | static void __iomem *sabi; | ||
| 223 | static void __iomem *sabi_iface; | ||
| 224 | static void __iomem *f0000_segment; | ||
| 225 | static struct backlight_device *backlight_device; | ||
| 226 | static struct mutex sabi_mutex; | ||
| 227 | static struct platform_device *sdev; | ||
| 228 | static struct rfkill *rfk; | ||
| 229 | |||
| 230 | static int force; | ||
| 231 | module_param(force, bool, 0); | ||
| 232 | MODULE_PARM_DESC(force, | ||
| 233 | "Disable the DMI check and forces the driver to be loaded"); | ||
| 234 | |||
| 235 | static int debug; | ||
| 236 | module_param(debug, bool, S_IRUGO | S_IWUSR); | ||
| 237 | MODULE_PARM_DESC(debug, "Debug enabled or not"); | ||
| 238 | |||
| 239 | static int sabi_get_command(u8 command, struct sabi_retval *sretval) | ||
| 240 | { | ||
| 241 | int retval = 0; | ||
| 242 | u16 port = readw(sabi + sabi_config->header_offsets.port); | ||
| 243 | u8 complete, iface_data; | ||
| 244 | |||
| 245 | mutex_lock(&sabi_mutex); | ||
| 246 | |||
| 247 | /* enable memory to be able to write to it */ | ||
| 248 | outb(readb(sabi + sabi_config->header_offsets.en_mem), port); | ||
| 249 | |||
| 250 | /* write out the command */ | ||
| 251 | writew(sabi_config->main_function, sabi_iface + SABI_IFACE_MAIN); | ||
| 252 | writew(command, sabi_iface + SABI_IFACE_SUB); | ||
| 253 | writeb(0, sabi_iface + SABI_IFACE_COMPLETE); | ||
| 254 | outb(readb(sabi + sabi_config->header_offsets.iface_func), port); | ||
| 255 | |||
| 256 | /* write protect memory to make it safe */ | ||
| 257 | outb(readb(sabi + sabi_config->header_offsets.re_mem), port); | ||
| 258 | |||
| 259 | /* see if the command actually succeeded */ | ||
| 260 | complete = readb(sabi_iface + SABI_IFACE_COMPLETE); | ||
| 261 | iface_data = readb(sabi_iface + SABI_IFACE_DATA); | ||
| 262 | if (complete != 0xaa || iface_data == 0xff) { | ||
| 263 | pr_warn("SABI get command 0x%02x failed with completion flag 0x%02x and data 0x%02x\n", | ||
| 264 | command, complete, iface_data); | ||
| 265 | retval = -EINVAL; | ||
| 266 | goto exit; | ||
| 267 | } | ||
| 268 | /* | ||
| 269 | * Save off the data into a structure so the caller use it. | ||
| 270 | * Right now we only want the first 4 bytes, | ||
| 271 | * There are commands that need more, but not for the ones we | ||
| 272 | * currently care about. | ||
| 273 | */ | ||
| 274 | sretval->retval[0] = readb(sabi_iface + SABI_IFACE_DATA); | ||
| 275 | sretval->retval[1] = readb(sabi_iface + SABI_IFACE_DATA + 1); | ||
| 276 | sretval->retval[2] = readb(sabi_iface + SABI_IFACE_DATA + 2); | ||
| 277 | sretval->retval[3] = readb(sabi_iface + SABI_IFACE_DATA + 3); | ||
| 278 | |||
| 279 | exit: | ||
| 280 | mutex_unlock(&sabi_mutex); | ||
| 281 | return retval; | ||
| 282 | |||
| 283 | } | ||
| 284 | |||
| 285 | static int sabi_set_command(u8 command, u8 data) | ||
| 286 | { | ||
| 287 | int retval = 0; | ||
| 288 | u16 port = readw(sabi + sabi_config->header_offsets.port); | ||
| 289 | u8 complete, iface_data; | ||
| 290 | |||
| 291 | mutex_lock(&sabi_mutex); | ||
| 292 | |||
| 293 | /* enable memory to be able to write to it */ | ||
| 294 | outb(readb(sabi + sabi_config->header_offsets.en_mem), port); | ||
| 295 | |||
| 296 | /* write out the command */ | ||
| 297 | writew(sabi_config->main_function, sabi_iface + SABI_IFACE_MAIN); | ||
| 298 | writew(command, sabi_iface + SABI_IFACE_SUB); | ||
| 299 | writeb(0, sabi_iface + SABI_IFACE_COMPLETE); | ||
| 300 | writeb(data, sabi_iface + SABI_IFACE_DATA); | ||
| 301 | outb(readb(sabi + sabi_config->header_offsets.iface_func), port); | ||
| 302 | |||
| 303 | /* write protect memory to make it safe */ | ||
| 304 | outb(readb(sabi + sabi_config->header_offsets.re_mem), port); | ||
| 305 | |||
| 306 | /* see if the command actually succeeded */ | ||
| 307 | complete = readb(sabi_iface + SABI_IFACE_COMPLETE); | ||
| 308 | iface_data = readb(sabi_iface + SABI_IFACE_DATA); | ||
| 309 | if (complete != 0xaa || iface_data == 0xff) { | ||
| 310 | pr_warn("SABI set command 0x%02x failed with completion flag 0x%02x and data 0x%02x\n", | ||
| 311 | command, complete, iface_data); | ||
| 312 | retval = -EINVAL; | ||
| 313 | } | ||
| 314 | |||
| 315 | mutex_unlock(&sabi_mutex); | ||
| 316 | return retval; | ||
| 317 | } | ||
| 318 | |||
| 319 | static void test_backlight(void) | ||
| 320 | { | ||
| 321 | struct sabi_retval sretval; | ||
| 322 | |||
| 323 | sabi_get_command(sabi_config->commands.get_backlight, &sretval); | ||
| 324 | printk(KERN_DEBUG "backlight = 0x%02x\n", sretval.retval[0]); | ||
| 325 | |||
| 326 | sabi_set_command(sabi_config->commands.set_backlight, 0); | ||
| 327 | printk(KERN_DEBUG "backlight should be off\n"); | ||
| 328 | |||
| 329 | sabi_get_command(sabi_config->commands.get_backlight, &sretval); | ||
| 330 | printk(KERN_DEBUG "backlight = 0x%02x\n", sretval.retval[0]); | ||
| 331 | |||
| 332 | msleep(1000); | ||
| 333 | |||
| 334 | sabi_set_command(sabi_config->commands.set_backlight, 1); | ||
| 335 | printk(KERN_DEBUG "backlight should be on\n"); | ||
| 336 | |||
| 337 | sabi_get_command(sabi_config->commands.get_backlight, &sretval); | ||
| 338 | printk(KERN_DEBUG "backlight = 0x%02x\n", sretval.retval[0]); | ||
| 339 | } | ||
| 340 | |||
| 341 | static void test_wireless(void) | ||
| 342 | { | ||
| 343 | struct sabi_retval sretval; | ||
| 344 | |||
| 345 | sabi_get_command(sabi_config->commands.get_wireless_button, &sretval); | ||
| 346 | printk(KERN_DEBUG "wireless led = 0x%02x\n", sretval.retval[0]); | ||
| 347 | |||
| 348 | sabi_set_command(sabi_config->commands.set_wireless_button, 0); | ||
| 349 | printk(KERN_DEBUG "wireless led should be off\n"); | ||
| 350 | |||
| 351 | sabi_get_command(sabi_config->commands.get_wireless_button, &sretval); | ||
| 352 | printk(KERN_DEBUG "wireless led = 0x%02x\n", sretval.retval[0]); | ||
| 353 | |||
| 354 | msleep(1000); | ||
| 355 | |||
| 356 | sabi_set_command(sabi_config->commands.set_wireless_button, 1); | ||
| 357 | printk(KERN_DEBUG "wireless led should be on\n"); | ||
| 358 | |||
| 359 | sabi_get_command(sabi_config->commands.get_wireless_button, &sretval); | ||
| 360 | printk(KERN_DEBUG "wireless led = 0x%02x\n", sretval.retval[0]); | ||
| 361 | } | ||
| 362 | |||
| 363 | static u8 read_brightness(void) | ||
| 364 | { | ||
| 365 | struct sabi_retval sretval; | ||
| 366 | int user_brightness = 0; | ||
| 367 | int retval; | ||
| 368 | |||
| 369 | retval = sabi_get_command(sabi_config->commands.get_brightness, | ||
| 370 | &sretval); | ||
| 371 | if (!retval) { | ||
| 372 | user_brightness = sretval.retval[0]; | ||
| 373 | if (user_brightness != 0) | ||
| 374 | user_brightness -= sabi_config->min_brightness; | ||
| 375 | } | ||
| 376 | return user_brightness; | ||
| 377 | } | ||
| 378 | |||
| 379 | static void set_brightness(u8 user_brightness) | ||
| 380 | { | ||
| 381 | u8 user_level = user_brightness - sabi_config->min_brightness; | ||
| 382 | |||
| 383 | sabi_set_command(sabi_config->commands.set_brightness, user_level); | ||
| 384 | } | ||
| 385 | |||
| 386 | static int get_brightness(struct backlight_device *bd) | ||
| 387 | { | ||
| 388 | return (int)read_brightness(); | ||
| 389 | } | ||
| 390 | |||
| 391 | static int update_status(struct backlight_device *bd) | ||
| 392 | { | ||
| 393 | set_brightness(bd->props.brightness); | ||
| 394 | |||
| 395 | if (bd->props.power == FB_BLANK_UNBLANK) | ||
| 396 | sabi_set_command(sabi_config->commands.set_backlight, 1); | ||
| 397 | else | ||
| 398 | sabi_set_command(sabi_config->commands.set_backlight, 0); | ||
| 399 | return 0; | ||
| 400 | } | ||
| 401 | |||
| 402 | static const struct backlight_ops backlight_ops = { | ||
| 403 | .get_brightness = get_brightness, | ||
| 404 | .update_status = update_status, | ||
| 405 | }; | ||
| 406 | |||
| 407 | static int rfkill_set(void *data, bool blocked) | ||
| 408 | { | ||
| 409 | /* Do something with blocked...*/ | ||
| 410 | /* | ||
| 411 | * blocked == false is on | ||
| 412 | * blocked == true is off | ||
| 413 | */ | ||
| 414 | if (blocked) | ||
| 415 | sabi_set_command(sabi_config->commands.set_wireless_button, 0); | ||
| 416 | else | ||
| 417 | sabi_set_command(sabi_config->commands.set_wireless_button, 1); | ||
| 418 | |||
| 419 | return 0; | ||
| 420 | } | ||
| 421 | |||
| 422 | static struct rfkill_ops rfkill_ops = { | ||
| 423 | .set_block = rfkill_set, | ||
| 424 | }; | ||
| 425 | |||
| 426 | static int init_wireless(struct platform_device *sdev) | ||
| 427 | { | ||
| 428 | int retval; | ||
| 429 | |||
| 430 | rfk = rfkill_alloc("samsung-wifi", &sdev->dev, RFKILL_TYPE_WLAN, | ||
| 431 | &rfkill_ops, NULL); | ||
| 432 | if (!rfk) | ||
| 433 | return -ENOMEM; | ||
| 434 | |||
| 435 | retval = rfkill_register(rfk); | ||
| 436 | if (retval) { | ||
| 437 | rfkill_destroy(rfk); | ||
| 438 | return -ENODEV; | ||
| 439 | } | ||
| 440 | |||
| 441 | return 0; | ||
| 442 | } | ||
| 443 | |||
| 444 | static void destroy_wireless(void) | ||
| 445 | { | ||
| 446 | rfkill_unregister(rfk); | ||
| 447 | rfkill_destroy(rfk); | ||
| 448 | } | ||
| 449 | |||
| 450 | static ssize_t get_performance_level(struct device *dev, | ||
| 451 | struct device_attribute *attr, char *buf) | ||
| 452 | { | ||
| 453 | struct sabi_retval sretval; | ||
| 454 | int retval; | ||
| 455 | int i; | ||
| 456 | |||
| 457 | /* Read the state */ | ||
| 458 | retval = sabi_get_command(sabi_config->commands.get_performance_level, | ||
| 459 | &sretval); | ||
| 460 | if (retval) | ||
| 461 | return retval; | ||
| 462 | |||
| 463 | /* The logic is backwards, yeah, lots of fun... */ | ||
| 464 | for (i = 0; sabi_config->performance_levels[i].name; ++i) { | ||
| 465 | if (sretval.retval[0] == sabi_config->performance_levels[i].value) | ||
| 466 | return sprintf(buf, "%s\n", sabi_config->performance_levels[i].name); | ||
| 467 | } | ||
| 468 | return sprintf(buf, "%s\n", "unknown"); | ||
| 469 | } | ||
| 470 | |||
| 471 | static ssize_t set_performance_level(struct device *dev, | ||
| 472 | struct device_attribute *attr, const char *buf, | ||
| 473 | size_t count) | ||
| 474 | { | ||
| 475 | if (count >= 1) { | ||
| 476 | int i; | ||
| 477 | for (i = 0; sabi_config->performance_levels[i].name; ++i) { | ||
| 478 | const struct sabi_performance_level *level = | ||
| 479 | &sabi_config->performance_levels[i]; | ||
| 480 | if (!strncasecmp(level->name, buf, strlen(level->name))) { | ||
| 481 | sabi_set_command(sabi_config->commands.set_performance_level, | ||
| 482 | level->value); | ||
| 483 | break; | ||
| 484 | } | ||
| 485 | } | ||
| 486 | if (!sabi_config->performance_levels[i].name) | ||
| 487 | return -EINVAL; | ||
| 488 | } | ||
| 489 | return count; | ||
| 490 | } | ||
| 491 | static DEVICE_ATTR(performance_level, S_IWUSR | S_IRUGO, | ||
| 492 | get_performance_level, set_performance_level); | ||
| 493 | |||
| 494 | |||
| 495 | static int __init dmi_check_cb(const struct dmi_system_id *id) | ||
| 496 | { | ||
| 497 | pr_info("found laptop model '%s'\n", | ||
| 498 | id->ident); | ||
| 499 | return 0; | ||
| 500 | } | ||
| 501 | |||
| 502 | static struct dmi_system_id __initdata samsung_dmi_table[] = { | ||
| 503 | { | ||
| 504 | .ident = "N128", | ||
| 505 | .matches = { | ||
| 506 | DMI_MATCH(DMI_SYS_VENDOR, | ||
| 507 | "SAMSUNG ELECTRONICS CO., LTD."), | ||
| 508 | DMI_MATCH(DMI_PRODUCT_NAME, "N128"), | ||
| 509 | DMI_MATCH(DMI_BOARD_NAME, "N128"), | ||
| 510 | }, | ||
| 511 | .callback = dmi_check_cb, | ||
| 512 | }, | ||
| 513 | { | ||
| 514 | .ident = "N130", | ||
| 515 | .matches = { | ||
| 516 | DMI_MATCH(DMI_SYS_VENDOR, | ||
| 517 | "SAMSUNG ELECTRONICS CO., LTD."), | ||
| 518 | DMI_MATCH(DMI_PRODUCT_NAME, "N130"), | ||
| 519 | DMI_MATCH(DMI_BOARD_NAME, "N130"), | ||
| 520 | }, | ||
| 521 | .callback = dmi_check_cb, | ||
| 522 | }, | ||
| 523 | { | ||
| 524 | .ident = "X125", | ||
| 525 | .matches = { | ||
| 526 | DMI_MATCH(DMI_SYS_VENDOR, | ||
| 527 | "SAMSUNG ELECTRONICS CO., LTD."), | ||
| 528 | DMI_MATCH(DMI_PRODUCT_NAME, "X125"), | ||
| 529 | DMI_MATCH(DMI_BOARD_NAME, "X125"), | ||
| 530 | }, | ||
| 531 | .callback = dmi_check_cb, | ||
| 532 | }, | ||
| 533 | { | ||
| 534 | .ident = "X120/X170", | ||
| 535 | .matches = { | ||
| 536 | DMI_MATCH(DMI_SYS_VENDOR, | ||
| 537 | "SAMSUNG ELECTRONICS CO., LTD."), | ||
| 538 | DMI_MATCH(DMI_PRODUCT_NAME, "X120/X170"), | ||
| 539 | DMI_MATCH(DMI_BOARD_NAME, "X120/X170"), | ||
| 540 | }, | ||
| 541 | .callback = dmi_check_cb, | ||
| 542 | }, | ||
| 543 | { | ||
| 544 | .ident = "NC10", | ||
| 545 | .matches = { | ||
| 546 | DMI_MATCH(DMI_SYS_VENDOR, | ||
| 547 | "SAMSUNG ELECTRONICS CO., LTD."), | ||
| 548 | DMI_MATCH(DMI_PRODUCT_NAME, "NC10"), | ||
| 549 | DMI_MATCH(DMI_BOARD_NAME, "NC10"), | ||
| 550 | }, | ||
| 551 | .callback = dmi_check_cb, | ||
| 552 | }, | ||
| 553 | { | ||
| 554 | .ident = "NP-Q45", | ||
| 555 | .matches = { | ||
| 556 | DMI_MATCH(DMI_SYS_VENDOR, | ||
| 557 | "SAMSUNG ELECTRONICS CO., LTD."), | ||
| 558 | DMI_MATCH(DMI_PRODUCT_NAME, "SQ45S70S"), | ||
| 559 | DMI_MATCH(DMI_BOARD_NAME, "SQ45S70S"), | ||
| 560 | }, | ||
| 561 | .callback = dmi_check_cb, | ||
| 562 | }, | ||
| 563 | { | ||
| 564 | .ident = "X360", | ||
| 565 | .matches = { | ||
| 566 | DMI_MATCH(DMI_SYS_VENDOR, | ||
| 567 | "SAMSUNG ELECTRONICS CO., LTD."), | ||
| 568 | DMI_MATCH(DMI_PRODUCT_NAME, "X360"), | ||
| 569 | DMI_MATCH(DMI_BOARD_NAME, "X360"), | ||
| 570 | }, | ||
| 571 | .callback = dmi_check_cb, | ||
| 572 | }, | ||
| 573 | { | ||
| 574 | .ident = "R410 Plus", | ||
| 575 | .matches = { | ||
| 576 | DMI_MATCH(DMI_SYS_VENDOR, | ||
| 577 | "SAMSUNG ELECTRONICS CO., LTD."), | ||
| 578 | DMI_MATCH(DMI_PRODUCT_NAME, "R410P"), | ||
| 579 | DMI_MATCH(DMI_BOARD_NAME, "R460"), | ||
| 580 | }, | ||
| 581 | .callback = dmi_check_cb, | ||
| 582 | }, | ||
| 583 | { | ||
| 584 | .ident = "R518", | ||
| 585 | .matches = { | ||
| 586 | DMI_MATCH(DMI_SYS_VENDOR, | ||
| 587 | "SAMSUNG ELECTRONICS CO., LTD."), | ||
| 588 | DMI_MATCH(DMI_PRODUCT_NAME, "R518"), | ||
| 589 | DMI_MATCH(DMI_BOARD_NAME, "R518"), | ||
| 590 | }, | ||
| 591 | .callback = dmi_check_cb, | ||
| 592 | }, | ||
| 593 | { | ||
| 594 | .ident = "R519/R719", | ||
| 595 | .matches = { | ||
| 596 | DMI_MATCH(DMI_SYS_VENDOR, | ||
| 597 | "SAMSUNG ELECTRONICS CO., LTD."), | ||
| 598 | DMI_MATCH(DMI_PRODUCT_NAME, "R519/R719"), | ||
| 599 | DMI_MATCH(DMI_BOARD_NAME, "R519/R719"), | ||
| 600 | }, | ||
| 601 | .callback = dmi_check_cb, | ||
| 602 | }, | ||
| 603 | { | ||
| 604 | .ident = "N150/N210/N220/N230", | ||
| 605 | .matches = { | ||
| 606 | DMI_MATCH(DMI_SYS_VENDOR, | ||
| 607 | "SAMSUNG ELECTRONICS CO., LTD."), | ||
| 608 | DMI_MATCH(DMI_PRODUCT_NAME, "N150/N210/N220/N230"), | ||
| 609 | DMI_MATCH(DMI_BOARD_NAME, "N150/N210/N220/N230"), | ||
| 610 | }, | ||
| 611 | .callback = dmi_check_cb, | ||
| 612 | }, | ||
| 613 | { | ||
| 614 | .ident = "N150P/N210P/N220P", | ||
| 615 | .matches = { | ||
| 616 | DMI_MATCH(DMI_SYS_VENDOR, | ||
| 617 | "SAMSUNG ELECTRONICS CO., LTD."), | ||
| 618 | DMI_MATCH(DMI_PRODUCT_NAME, "N150P/N210P/N220P"), | ||
| 619 | DMI_MATCH(DMI_BOARD_NAME, "N150P/N210P/N220P"), | ||
| 620 | }, | ||
| 621 | .callback = dmi_check_cb, | ||
| 622 | }, | ||
| 623 | { | ||
| 624 | .ident = "R530/R730", | ||
| 625 | .matches = { | ||
| 626 | DMI_MATCH(DMI_SYS_VENDOR, "SAMSUNG ELECTRONICS CO., LTD."), | ||
| 627 | DMI_MATCH(DMI_PRODUCT_NAME, "R530/R730"), | ||
| 628 | DMI_MATCH(DMI_BOARD_NAME, "R530/R730"), | ||
| 629 | }, | ||
| 630 | .callback = dmi_check_cb, | ||
| 631 | }, | ||
| 632 | { | ||
| 633 | .ident = "NF110/NF210/NF310", | ||
| 634 | .matches = { | ||
| 635 | DMI_MATCH(DMI_SYS_VENDOR, "SAMSUNG ELECTRONICS CO., LTD."), | ||
| 636 | DMI_MATCH(DMI_PRODUCT_NAME, "NF110/NF210/NF310"), | ||
| 637 | DMI_MATCH(DMI_BOARD_NAME, "NF110/NF210/NF310"), | ||
| 638 | }, | ||
| 639 | .callback = dmi_check_cb, | ||
| 640 | }, | ||
| 641 | { | ||
| 642 | .ident = "N145P/N250P/N260P", | ||
| 643 | .matches = { | ||
| 644 | DMI_MATCH(DMI_SYS_VENDOR, "SAMSUNG ELECTRONICS CO., LTD."), | ||
| 645 | DMI_MATCH(DMI_PRODUCT_NAME, "N145P/N250P/N260P"), | ||
| 646 | DMI_MATCH(DMI_BOARD_NAME, "N145P/N250P/N260P"), | ||
| 647 | }, | ||
| 648 | .callback = dmi_check_cb, | ||
| 649 | }, | ||
| 650 | { | ||
| 651 | .ident = "R70/R71", | ||
| 652 | .matches = { | ||
| 653 | DMI_MATCH(DMI_SYS_VENDOR, | ||
| 654 | "SAMSUNG ELECTRONICS CO., LTD."), | ||
| 655 | DMI_MATCH(DMI_PRODUCT_NAME, "R70/R71"), | ||
| 656 | DMI_MATCH(DMI_BOARD_NAME, "R70/R71"), | ||
| 657 | }, | ||
| 658 | .callback = dmi_check_cb, | ||
| 659 | }, | ||
| 660 | { | ||
| 661 | .ident = "P460", | ||
| 662 | .matches = { | ||
| 663 | DMI_MATCH(DMI_SYS_VENDOR, "SAMSUNG ELECTRONICS CO., LTD."), | ||
| 664 | DMI_MATCH(DMI_PRODUCT_NAME, "P460"), | ||
| 665 | DMI_MATCH(DMI_BOARD_NAME, "P460"), | ||
| 666 | }, | ||
| 667 | .callback = dmi_check_cb, | ||
| 668 | }, | ||
| 669 | { }, | ||
| 670 | }; | ||
| 671 | MODULE_DEVICE_TABLE(dmi, samsung_dmi_table); | ||
| 672 | |||
| 673 | static int find_signature(void __iomem *memcheck, const char *testStr) | ||
| 674 | { | ||
| 675 | int i = 0; | ||
| 676 | int loca; | ||
| 677 | |||
| 678 | for (loca = 0; loca < 0xffff; loca++) { | ||
| 679 | char temp = readb(memcheck + loca); | ||
| 680 | |||
| 681 | if (temp == testStr[i]) { | ||
| 682 | if (i == strlen(testStr)-1) | ||
| 683 | break; | ||
| 684 | ++i; | ||
| 685 | } else { | ||
| 686 | i = 0; | ||
| 687 | } | ||
| 688 | } | ||
| 689 | return loca; | ||
| 690 | } | ||
| 691 | |||
| 692 | static int __init samsung_init(void) | ||
| 693 | { | ||
| 694 | struct backlight_properties props; | ||
| 695 | struct sabi_retval sretval; | ||
| 696 | unsigned int ifaceP; | ||
| 697 | int i; | ||
| 698 | int loca; | ||
| 699 | int retval; | ||
| 700 | |||
| 701 | mutex_init(&sabi_mutex); | ||
| 702 | |||
| 703 | if (!force && !dmi_check_system(samsung_dmi_table)) | ||
| 704 | return -ENODEV; | ||
| 705 | |||
| 706 | f0000_segment = ioremap_nocache(0xf0000, 0xffff); | ||
| 707 | if (!f0000_segment) { | ||
| 708 | pr_err("Can't map the segment at 0xf0000\n"); | ||
| 709 | return -EINVAL; | ||
| 710 | } | ||
| 711 | |||
| 712 | /* Try to find one of the signatures in memory to find the header */ | ||
| 713 | for (i = 0; sabi_configs[i].test_string != 0; ++i) { | ||
| 714 | sabi_config = &sabi_configs[i]; | ||
| 715 | loca = find_signature(f0000_segment, sabi_config->test_string); | ||
| 716 | if (loca != 0xffff) | ||
| 717 | break; | ||
| 718 | } | ||
| 719 | |||
| 720 | if (loca == 0xffff) { | ||
| 721 | pr_err("This computer does not support SABI\n"); | ||
| 722 | goto error_no_signature; | ||
| 723 | } | ||
| 724 | |||
| 725 | /* point to the SMI port Number */ | ||
| 726 | loca += 1; | ||
| 727 | sabi = (f0000_segment + loca); | ||
| 728 | |||
| 729 | if (debug) { | ||
| 730 | printk(KERN_DEBUG "This computer supports SABI==%x\n", | ||
| 731 | loca + 0xf0000 - 6); | ||
| 732 | printk(KERN_DEBUG "SABI header:\n"); | ||
| 733 | printk(KERN_DEBUG " SMI Port Number = 0x%04x\n", | ||
| 734 | readw(sabi + sabi_config->header_offsets.port)); | ||
| 735 | printk(KERN_DEBUG " SMI Interface Function = 0x%02x\n", | ||
| 736 | readb(sabi + sabi_config->header_offsets.iface_func)); | ||
| 737 | printk(KERN_DEBUG " SMI enable memory buffer = 0x%02x\n", | ||
| 738 | readb(sabi + sabi_config->header_offsets.en_mem)); | ||
| 739 | printk(KERN_DEBUG " SMI restore memory buffer = 0x%02x\n", | ||
| 740 | readb(sabi + sabi_config->header_offsets.re_mem)); | ||
| 741 | printk(KERN_DEBUG " SABI data offset = 0x%04x\n", | ||
| 742 | readw(sabi + sabi_config->header_offsets.data_offset)); | ||
| 743 | printk(KERN_DEBUG " SABI data segment = 0x%04x\n", | ||
| 744 | readw(sabi + sabi_config->header_offsets.data_segment)); | ||
| 745 | } | ||
| 746 | |||
| 747 | /* Get a pointer to the SABI Interface */ | ||
| 748 | ifaceP = (readw(sabi + sabi_config->header_offsets.data_segment) & 0x0ffff) << 4; | ||
| 749 | ifaceP += readw(sabi + sabi_config->header_offsets.data_offset) & 0x0ffff; | ||
| 750 | sabi_iface = ioremap_nocache(ifaceP, 16); | ||
| 751 | if (!sabi_iface) { | ||
| 752 | pr_err("Can't remap %x\n", ifaceP); | ||
| 753 | goto exit; | ||
| 754 | } | ||
| 755 | if (debug) { | ||
| 756 | printk(KERN_DEBUG "ifaceP = 0x%08x\n", ifaceP); | ||
| 757 | printk(KERN_DEBUG "sabi_iface = %p\n", sabi_iface); | ||
| 758 | |||
| 759 | test_backlight(); | ||
| 760 | test_wireless(); | ||
| 761 | |||
| 762 | retval = sabi_get_command(sabi_config->commands.get_brightness, | ||
| 763 | &sretval); | ||
| 764 | printk(KERN_DEBUG "brightness = 0x%02x\n", sretval.retval[0]); | ||
| 765 | } | ||
| 766 | |||
| 767 | /* Turn on "Linux" mode in the BIOS */ | ||
| 768 | if (sabi_config->commands.set_linux != 0xff) { | ||
| 769 | retval = sabi_set_command(sabi_config->commands.set_linux, | ||
| 770 | 0x81); | ||
| 771 | if (retval) { | ||
| 772 | pr_warn("Linux mode was not set!\n"); | ||
| 773 | goto error_no_platform; | ||
| 774 | } | ||
| 775 | } | ||
| 776 | |||
| 777 | /* knock up a platform device to hang stuff off of */ | ||
| 778 | sdev = platform_device_register_simple("samsung", -1, NULL, 0); | ||
| 779 | if (IS_ERR(sdev)) | ||
| 780 | goto error_no_platform; | ||
| 781 | |||
| 782 | /* create a backlight device to talk to this one */ | ||
| 783 | memset(&props, 0, sizeof(struct backlight_properties)); | ||
| 784 | props.type = BACKLIGHT_PLATFORM; | ||
| 785 | props.max_brightness = sabi_config->max_brightness; | ||
| 786 | backlight_device = backlight_device_register("samsung", &sdev->dev, | ||
| 787 | NULL, &backlight_ops, | ||
| 788 | &props); | ||
| 789 | if (IS_ERR(backlight_device)) | ||
| 790 | goto error_no_backlight; | ||
| 791 | |||
| 792 | backlight_device->props.brightness = read_brightness(); | ||
| 793 | backlight_device->props.power = FB_BLANK_UNBLANK; | ||
| 794 | backlight_update_status(backlight_device); | ||
| 795 | |||
| 796 | retval = init_wireless(sdev); | ||
| 797 | if (retval) | ||
| 798 | goto error_no_rfk; | ||
| 799 | |||
| 800 | retval = device_create_file(&sdev->dev, &dev_attr_performance_level); | ||
| 801 | if (retval) | ||
| 802 | goto error_file_create; | ||
| 803 | |||
| 804 | exit: | ||
| 805 | return 0; | ||
| 806 | |||
| 807 | error_file_create: | ||
| 808 | destroy_wireless(); | ||
| 809 | |||
| 810 | error_no_rfk: | ||
| 811 | backlight_device_unregister(backlight_device); | ||
| 812 | |||
| 813 | error_no_backlight: | ||
| 814 | platform_device_unregister(sdev); | ||
| 815 | |||
| 816 | error_no_platform: | ||
| 817 | iounmap(sabi_iface); | ||
| 818 | |||
| 819 | error_no_signature: | ||
| 820 | iounmap(f0000_segment); | ||
| 821 | return -EINVAL; | ||
| 822 | } | ||
| 823 | |||
| 824 | static void __exit samsung_exit(void) | ||
| 825 | { | ||
| 826 | /* Turn off "Linux" mode in the BIOS */ | ||
| 827 | if (sabi_config->commands.set_linux != 0xff) | ||
| 828 | sabi_set_command(sabi_config->commands.set_linux, 0x80); | ||
| 829 | |||
| 830 | device_remove_file(&sdev->dev, &dev_attr_performance_level); | ||
| 831 | backlight_device_unregister(backlight_device); | ||
| 832 | destroy_wireless(); | ||
| 833 | iounmap(sabi_iface); | ||
| 834 | iounmap(f0000_segment); | ||
| 835 | platform_device_unregister(sdev); | ||
| 836 | } | ||
| 837 | |||
| 838 | module_init(samsung_init); | ||
| 839 | module_exit(samsung_exit); | ||
| 840 | |||
| 841 | MODULE_AUTHOR("Greg Kroah-Hartman <gregkh@suse.de>"); | ||
| 842 | MODULE_DESCRIPTION("Samsung Backlight driver"); | ||
| 843 | MODULE_LICENSE("GPL"); | ||
diff --git a/drivers/usb/Kconfig b/drivers/usb/Kconfig index 41b6e51188e4..006489d82dc3 100644 --- a/drivers/usb/Kconfig +++ b/drivers/usb/Kconfig | |||
| @@ -66,6 +66,7 @@ config USB_ARCH_HAS_EHCI | |||
| 66 | default y if ARCH_VT8500 | 66 | default y if ARCH_VT8500 |
| 67 | default y if PLAT_SPEAR | 67 | default y if PLAT_SPEAR |
| 68 | default y if ARCH_MSM | 68 | default y if ARCH_MSM |
| 69 | default y if MICROBLAZE | ||
| 69 | default PCI | 70 | default PCI |
| 70 | 71 | ||
| 71 | # ARM SA1111 chips have a non-PCI based "OHCI-compatible" USB host interface. | 72 | # ARM SA1111 chips have a non-PCI based "OHCI-compatible" USB host interface. |
diff --git a/drivers/usb/core/devices.c b/drivers/usb/core/devices.c index a3d2e2399655..96fdfb815f89 100644 --- a/drivers/usb/core/devices.c +++ b/drivers/usb/core/devices.c | |||
| @@ -221,7 +221,7 @@ static char *usb_dump_endpoint_descriptor(int speed, char *start, char *end, | |||
| 221 | break; | 221 | break; |
| 222 | case USB_ENDPOINT_XFER_INT: | 222 | case USB_ENDPOINT_XFER_INT: |
| 223 | type = "Int."; | 223 | type = "Int."; |
| 224 | if (speed == USB_SPEED_HIGH) | 224 | if (speed == USB_SPEED_HIGH || speed == USB_SPEED_SUPER) |
| 225 | interval = 1 << (desc->bInterval - 1); | 225 | interval = 1 << (desc->bInterval - 1); |
| 226 | else | 226 | else |
| 227 | interval = desc->bInterval; | 227 | interval = desc->bInterval; |
| @@ -229,7 +229,8 @@ static char *usb_dump_endpoint_descriptor(int speed, char *start, char *end, | |||
| 229 | default: /* "can't happen" */ | 229 | default: /* "can't happen" */ |
| 230 | return start; | 230 | return start; |
| 231 | } | 231 | } |
| 232 | interval *= (speed == USB_SPEED_HIGH) ? 125 : 1000; | 232 | interval *= (speed == USB_SPEED_HIGH || |
| 233 | speed == USB_SPEED_SUPER) ? 125 : 1000; | ||
| 233 | if (interval % 1000) | 234 | if (interval % 1000) |
| 234 | unit = 'u'; | 235 | unit = 'u'; |
| 235 | else { | 236 | else { |
| @@ -542,8 +543,9 @@ static ssize_t usb_device_dump(char __user **buffer, size_t *nbytes, | |||
| 542 | if (level == 0) { | 543 | if (level == 0) { |
| 543 | int max; | 544 | int max; |
| 544 | 545 | ||
| 545 | /* high speed reserves 80%, full/low reserves 90% */ | 546 | /* super/high speed reserves 80%, full/low reserves 90% */ |
| 546 | if (usbdev->speed == USB_SPEED_HIGH) | 547 | if (usbdev->speed == USB_SPEED_HIGH || |
| 548 | usbdev->speed == USB_SPEED_SUPER) | ||
| 547 | max = 800; | 549 | max = 800; |
| 548 | else | 550 | else |
| 549 | max = FRAME_TIME_MAX_USECS_ALLOC; | 551 | max = FRAME_TIME_MAX_USECS_ALLOC; |
diff --git a/drivers/usb/core/hcd.c b/drivers/usb/core/hcd.c index 8eed05d23838..77a7faec8d78 100644 --- a/drivers/usb/core/hcd.c +++ b/drivers/usb/core/hcd.c | |||
| @@ -1908,7 +1908,7 @@ void usb_free_streams(struct usb_interface *interface, | |||
| 1908 | 1908 | ||
| 1909 | /* Streams only apply to bulk endpoints. */ | 1909 | /* Streams only apply to bulk endpoints. */ |
| 1910 | for (i = 0; i < num_eps; i++) | 1910 | for (i = 0; i < num_eps; i++) |
| 1911 | if (!usb_endpoint_xfer_bulk(&eps[i]->desc)) | 1911 | if (!eps[i] || !usb_endpoint_xfer_bulk(&eps[i]->desc)) |
| 1912 | return; | 1912 | return; |
| 1913 | 1913 | ||
| 1914 | hcd->driver->free_streams(hcd, dev, eps, num_eps, mem_flags); | 1914 | hcd->driver->free_streams(hcd, dev, eps, num_eps, mem_flags); |
diff --git a/drivers/usb/core/hub.c b/drivers/usb/core/hub.c index 8fb754916c67..93720bdc9efd 100644 --- a/drivers/usb/core/hub.c +++ b/drivers/usb/core/hub.c | |||
| @@ -2285,7 +2285,17 @@ int usb_port_suspend(struct usb_device *udev, pm_message_t msg) | |||
| 2285 | } | 2285 | } |
| 2286 | 2286 | ||
| 2287 | /* see 7.1.7.6 */ | 2287 | /* see 7.1.7.6 */ |
| 2288 | status = set_port_feature(hub->hdev, port1, USB_PORT_FEAT_SUSPEND); | 2288 | /* Clear PORT_POWER if it's a USB3.0 device connected to USB 3.0 |
| 2289 | * external hub. | ||
| 2290 | * FIXME: this is a temporary workaround to make the system able | ||
| 2291 | * to suspend/resume. | ||
| 2292 | */ | ||
| 2293 | if ((hub->hdev->parent != NULL) && hub_is_superspeed(hub->hdev)) | ||
| 2294 | status = clear_port_feature(hub->hdev, port1, | ||
| 2295 | USB_PORT_FEAT_POWER); | ||
| 2296 | else | ||
| 2297 | status = set_port_feature(hub->hdev, port1, | ||
| 2298 | USB_PORT_FEAT_SUSPEND); | ||
| 2289 | if (status) { | 2299 | if (status) { |
| 2290 | dev_dbg(hub->intfdev, "can't suspend port %d, status %d\n", | 2300 | dev_dbg(hub->intfdev, "can't suspend port %d, status %d\n", |
| 2291 | port1, status); | 2301 | port1, status); |
diff --git a/drivers/usb/gadget/f_audio.c b/drivers/usb/gadget/f_audio.c index 9abecfddb27d..0111f8a9cf7f 100644 --- a/drivers/usb/gadget/f_audio.c +++ b/drivers/usb/gadget/f_audio.c | |||
| @@ -706,6 +706,7 @@ f_audio_unbind(struct usb_configuration *c, struct usb_function *f) | |||
| 706 | struct f_audio *audio = func_to_audio(f); | 706 | struct f_audio *audio = func_to_audio(f); |
| 707 | 707 | ||
| 708 | usb_free_descriptors(f->descriptors); | 708 | usb_free_descriptors(f->descriptors); |
| 709 | usb_free_descriptors(f->hs_descriptors); | ||
| 709 | kfree(audio); | 710 | kfree(audio); |
| 710 | } | 711 | } |
| 711 | 712 | ||
diff --git a/drivers/usb/gadget/f_eem.c b/drivers/usb/gadget/f_eem.c index 95dd4662d6a8..b3c304290150 100644 --- a/drivers/usb/gadget/f_eem.c +++ b/drivers/usb/gadget/f_eem.c | |||
| @@ -314,6 +314,9 @@ eem_unbind(struct usb_configuration *c, struct usb_function *f) | |||
| 314 | 314 | ||
| 315 | static void eem_cmd_complete(struct usb_ep *ep, struct usb_request *req) | 315 | static void eem_cmd_complete(struct usb_ep *ep, struct usb_request *req) |
| 316 | { | 316 | { |
| 317 | struct sk_buff *skb = (struct sk_buff *)req->context; | ||
| 318 | |||
| 319 | dev_kfree_skb_any(skb); | ||
| 317 | } | 320 | } |
| 318 | 321 | ||
| 319 | /* | 322 | /* |
| @@ -428,10 +431,11 @@ static int eem_unwrap(struct gether *port, | |||
| 428 | skb_trim(skb2, len); | 431 | skb_trim(skb2, len); |
| 429 | put_unaligned_le16(BIT(15) | BIT(11) | len, | 432 | put_unaligned_le16(BIT(15) | BIT(11) | len, |
| 430 | skb_push(skb2, 2)); | 433 | skb_push(skb2, 2)); |
| 431 | skb_copy_bits(skb, 0, req->buf, skb->len); | 434 | skb_copy_bits(skb2, 0, req->buf, skb2->len); |
| 432 | req->length = skb->len; | 435 | req->length = skb2->len; |
| 433 | req->complete = eem_cmd_complete; | 436 | req->complete = eem_cmd_complete; |
| 434 | req->zero = 1; | 437 | req->zero = 1; |
| 438 | req->context = skb2; | ||
| 435 | if (usb_ep_queue(port->in_ep, req, GFP_ATOMIC)) | 439 | if (usb_ep_queue(port->in_ep, req, GFP_ATOMIC)) |
| 436 | DBG(cdev, "echo response queue fail\n"); | 440 | DBG(cdev, "echo response queue fail\n"); |
| 437 | break; | 441 | break; |
diff --git a/drivers/usb/gadget/fsl_qe_udc.c b/drivers/usb/gadget/fsl_qe_udc.c index aee7e3c53c38..36613b37c504 100644 --- a/drivers/usb/gadget/fsl_qe_udc.c +++ b/drivers/usb/gadget/fsl_qe_udc.c | |||
| @@ -1148,6 +1148,12 @@ static int qe_ep_tx(struct qe_ep *ep, struct qe_frame *frame) | |||
| 1148 | static int txcomplete(struct qe_ep *ep, unsigned char restart) | 1148 | static int txcomplete(struct qe_ep *ep, unsigned char restart) |
| 1149 | { | 1149 | { |
| 1150 | if (ep->tx_req != NULL) { | 1150 | if (ep->tx_req != NULL) { |
| 1151 | struct qe_req *req = ep->tx_req; | ||
| 1152 | unsigned zlp = 0, last_len = 0; | ||
| 1153 | |||
| 1154 | last_len = min_t(unsigned, req->req.length - ep->sent, | ||
| 1155 | ep->ep.maxpacket); | ||
| 1156 | |||
| 1151 | if (!restart) { | 1157 | if (!restart) { |
| 1152 | int asent = ep->last; | 1158 | int asent = ep->last; |
| 1153 | ep->sent += asent; | 1159 | ep->sent += asent; |
| @@ -1156,9 +1162,18 @@ static int txcomplete(struct qe_ep *ep, unsigned char restart) | |||
| 1156 | ep->last = 0; | 1162 | ep->last = 0; |
| 1157 | } | 1163 | } |
| 1158 | 1164 | ||
| 1165 | /* zlp needed when req->re.zero is set */ | ||
| 1166 | if (req->req.zero) { | ||
| 1167 | if (last_len == 0 || | ||
| 1168 | (req->req.length % ep->ep.maxpacket) != 0) | ||
| 1169 | zlp = 0; | ||
| 1170 | else | ||
| 1171 | zlp = 1; | ||
| 1172 | } else | ||
| 1173 | zlp = 0; | ||
| 1174 | |||
| 1159 | /* a request already were transmitted completely */ | 1175 | /* a request already were transmitted completely */ |
| 1160 | if ((ep->tx_req->req.length - ep->sent) <= 0) { | 1176 | if (((ep->tx_req->req.length - ep->sent) <= 0) && !zlp) { |
| 1161 | ep->tx_req->req.actual = (unsigned int)ep->sent; | ||
| 1162 | done(ep, ep->tx_req, 0); | 1177 | done(ep, ep->tx_req, 0); |
| 1163 | ep->tx_req = NULL; | 1178 | ep->tx_req = NULL; |
| 1164 | ep->last = 0; | 1179 | ep->last = 0; |
| @@ -1191,6 +1206,7 @@ static int qe_usb_senddata(struct qe_ep *ep, struct qe_frame *frame) | |||
| 1191 | buf = (u8 *)ep->tx_req->req.buf + ep->sent; | 1206 | buf = (u8 *)ep->tx_req->req.buf + ep->sent; |
| 1192 | if (buf && size) { | 1207 | if (buf && size) { |
| 1193 | ep->last = size; | 1208 | ep->last = size; |
| 1209 | ep->tx_req->req.actual += size; | ||
| 1194 | frame_set_data(frame, buf); | 1210 | frame_set_data(frame, buf); |
| 1195 | frame_set_length(frame, size); | 1211 | frame_set_length(frame, size); |
| 1196 | frame_set_status(frame, FRAME_OK); | 1212 | frame_set_status(frame, FRAME_OK); |
diff --git a/drivers/usb/gadget/inode.c b/drivers/usb/gadget/inode.c index 3ed73f49cf18..a01383f71f38 100644 --- a/drivers/usb/gadget/inode.c +++ b/drivers/usb/gadget/inode.c | |||
| @@ -386,8 +386,10 @@ ep_read (struct file *fd, char __user *buf, size_t len, loff_t *ptr) | |||
| 386 | 386 | ||
| 387 | /* halt any endpoint by doing a "wrong direction" i/o call */ | 387 | /* halt any endpoint by doing a "wrong direction" i/o call */ |
| 388 | if (usb_endpoint_dir_in(&data->desc)) { | 388 | if (usb_endpoint_dir_in(&data->desc)) { |
| 389 | if (usb_endpoint_xfer_isoc(&data->desc)) | 389 | if (usb_endpoint_xfer_isoc(&data->desc)) { |
| 390 | mutex_unlock(&data->lock); | ||
| 390 | return -EINVAL; | 391 | return -EINVAL; |
| 392 | } | ||
| 391 | DBG (data->dev, "%s halt\n", data->name); | 393 | DBG (data->dev, "%s halt\n", data->name); |
| 392 | spin_lock_irq (&data->dev->lock); | 394 | spin_lock_irq (&data->dev->lock); |
| 393 | if (likely (data->ep != NULL)) | 395 | if (likely (data->ep != NULL)) |
diff --git a/drivers/usb/gadget/pch_udc.c b/drivers/usb/gadget/pch_udc.c index 3e4b35e50c24..68dbcc3e4cc2 100644 --- a/drivers/usb/gadget/pch_udc.c +++ b/drivers/usb/gadget/pch_udc.c | |||
| @@ -1608,7 +1608,7 @@ static int pch_udc_pcd_queue(struct usb_ep *usbep, struct usb_request *usbreq, | |||
| 1608 | return -EINVAL; | 1608 | return -EINVAL; |
| 1609 | if (!dev->driver || (dev->gadget.speed == USB_SPEED_UNKNOWN)) | 1609 | if (!dev->driver || (dev->gadget.speed == USB_SPEED_UNKNOWN)) |
| 1610 | return -ESHUTDOWN; | 1610 | return -ESHUTDOWN; |
| 1611 | spin_lock_irqsave(&ep->dev->lock, iflags); | 1611 | spin_lock_irqsave(&dev->lock, iflags); |
| 1612 | /* map the buffer for dma */ | 1612 | /* map the buffer for dma */ |
| 1613 | if (usbreq->length && | 1613 | if (usbreq->length && |
| 1614 | ((usbreq->dma == DMA_ADDR_INVALID) || !usbreq->dma)) { | 1614 | ((usbreq->dma == DMA_ADDR_INVALID) || !usbreq->dma)) { |
| @@ -1625,8 +1625,10 @@ static int pch_udc_pcd_queue(struct usb_ep *usbep, struct usb_request *usbreq, | |||
| 1625 | DMA_FROM_DEVICE); | 1625 | DMA_FROM_DEVICE); |
| 1626 | } else { | 1626 | } else { |
| 1627 | req->buf = kzalloc(usbreq->length, GFP_ATOMIC); | 1627 | req->buf = kzalloc(usbreq->length, GFP_ATOMIC); |
| 1628 | if (!req->buf) | 1628 | if (!req->buf) { |
| 1629 | return -ENOMEM; | 1629 | retval = -ENOMEM; |
| 1630 | goto probe_end; | ||
| 1631 | } | ||
| 1630 | if (ep->in) { | 1632 | if (ep->in) { |
| 1631 | memcpy(req->buf, usbreq->buf, usbreq->length); | 1633 | memcpy(req->buf, usbreq->buf, usbreq->length); |
| 1632 | req->dma = dma_map_single(&dev->pdev->dev, | 1634 | req->dma = dma_map_single(&dev->pdev->dev, |
diff --git a/drivers/usb/gadget/r8a66597-udc.c b/drivers/usb/gadget/r8a66597-udc.c index 015118535f77..6dcc1f68fa60 100644 --- a/drivers/usb/gadget/r8a66597-udc.c +++ b/drivers/usb/gadget/r8a66597-udc.c | |||
| @@ -1083,7 +1083,9 @@ static void irq_device_state(struct r8a66597 *r8a66597) | |||
| 1083 | 1083 | ||
| 1084 | if (dvsq == DS_DFLT) { | 1084 | if (dvsq == DS_DFLT) { |
| 1085 | /* bus reset */ | 1085 | /* bus reset */ |
| 1086 | spin_unlock(&r8a66597->lock); | ||
| 1086 | r8a66597->driver->disconnect(&r8a66597->gadget); | 1087 | r8a66597->driver->disconnect(&r8a66597->gadget); |
| 1088 | spin_lock(&r8a66597->lock); | ||
| 1087 | r8a66597_update_usb_speed(r8a66597); | 1089 | r8a66597_update_usb_speed(r8a66597); |
| 1088 | } | 1090 | } |
| 1089 | if (r8a66597->old_dvsq == DS_CNFG && dvsq != DS_CNFG) | 1091 | if (r8a66597->old_dvsq == DS_CNFG && dvsq != DS_CNFG) |
diff --git a/drivers/usb/host/ehci-q.c b/drivers/usb/host/ehci-q.c index 98ded66e8d3f..42abd0f603bf 100644 --- a/drivers/usb/host/ehci-q.c +++ b/drivers/usb/host/ehci-q.c | |||
| @@ -1247,24 +1247,27 @@ static void start_unlink_async (struct ehci_hcd *ehci, struct ehci_qh *qh) | |||
| 1247 | 1247 | ||
| 1248 | static void scan_async (struct ehci_hcd *ehci) | 1248 | static void scan_async (struct ehci_hcd *ehci) |
| 1249 | { | 1249 | { |
| 1250 | bool stopped; | ||
| 1250 | struct ehci_qh *qh; | 1251 | struct ehci_qh *qh; |
| 1251 | enum ehci_timer_action action = TIMER_IO_WATCHDOG; | 1252 | enum ehci_timer_action action = TIMER_IO_WATCHDOG; |
| 1252 | 1253 | ||
| 1253 | ehci->stamp = ehci_readl(ehci, &ehci->regs->frame_index); | 1254 | ehci->stamp = ehci_readl(ehci, &ehci->regs->frame_index); |
| 1254 | timer_action_done (ehci, TIMER_ASYNC_SHRINK); | 1255 | timer_action_done (ehci, TIMER_ASYNC_SHRINK); |
| 1255 | rescan: | 1256 | rescan: |
| 1257 | stopped = !HC_IS_RUNNING(ehci_to_hcd(ehci)->state); | ||
| 1256 | qh = ehci->async->qh_next.qh; | 1258 | qh = ehci->async->qh_next.qh; |
| 1257 | if (likely (qh != NULL)) { | 1259 | if (likely (qh != NULL)) { |
| 1258 | do { | 1260 | do { |
| 1259 | /* clean any finished work for this qh */ | 1261 | /* clean any finished work for this qh */ |
| 1260 | if (!list_empty (&qh->qtd_list) | 1262 | if (!list_empty(&qh->qtd_list) && (stopped || |
| 1261 | && qh->stamp != ehci->stamp) { | 1263 | qh->stamp != ehci->stamp)) { |
| 1262 | int temp; | 1264 | int temp; |
| 1263 | 1265 | ||
| 1264 | /* unlinks could happen here; completion | 1266 | /* unlinks could happen here; completion |
| 1265 | * reporting drops the lock. rescan using | 1267 | * reporting drops the lock. rescan using |
| 1266 | * the latest schedule, but don't rescan | 1268 | * the latest schedule, but don't rescan |
| 1267 | * qhs we already finished (no looping). | 1269 | * qhs we already finished (no looping) |
| 1270 | * unless the controller is stopped. | ||
| 1268 | */ | 1271 | */ |
| 1269 | qh = qh_get (qh); | 1272 | qh = qh_get (qh); |
| 1270 | qh->stamp = ehci->stamp; | 1273 | qh->stamp = ehci->stamp; |
| @@ -1285,9 +1288,9 @@ rescan: | |||
| 1285 | */ | 1288 | */ |
| 1286 | if (list_empty(&qh->qtd_list) | 1289 | if (list_empty(&qh->qtd_list) |
| 1287 | && qh->qh_state == QH_STATE_LINKED) { | 1290 | && qh->qh_state == QH_STATE_LINKED) { |
| 1288 | if (!ehci->reclaim | 1291 | if (!ehci->reclaim && (stopped || |
| 1289 | && ((ehci->stamp - qh->stamp) & 0x1fff) | 1292 | ((ehci->stamp - qh->stamp) & 0x1fff) |
| 1290 | >= (EHCI_SHRINK_FRAMES * 8)) | 1293 | >= EHCI_SHRINK_FRAMES * 8)) |
| 1291 | start_unlink_async(ehci, qh); | 1294 | start_unlink_async(ehci, qh); |
| 1292 | else | 1295 | else |
| 1293 | action = TIMER_ASYNC_SHRINK; | 1296 | action = TIMER_ASYNC_SHRINK; |
diff --git a/drivers/usb/host/isp1760-hcd.c b/drivers/usb/host/isp1760-hcd.c index f50e84ac570a..795345ad45e6 100644 --- a/drivers/usb/host/isp1760-hcd.c +++ b/drivers/usb/host/isp1760-hcd.c | |||
| @@ -295,7 +295,7 @@ static void alloc_mem(struct usb_hcd *hcd, struct isp1760_qtd *qtd) | |||
| 295 | } | 295 | } |
| 296 | 296 | ||
| 297 | dev_err(hcd->self.controller, | 297 | dev_err(hcd->self.controller, |
| 298 | "%s: Can not allocate %lu bytes of memory\n" | 298 | "%s: Cannot allocate %zu bytes of memory\n" |
| 299 | "Current memory map:\n", | 299 | "Current memory map:\n", |
| 300 | __func__, qtd->length); | 300 | __func__, qtd->length); |
| 301 | for (i = 0; i < BLOCKS; i++) { | 301 | for (i = 0; i < BLOCKS; i++) { |
diff --git a/drivers/usb/host/ohci-au1xxx.c b/drivers/usb/host/ohci-au1xxx.c index 17a6043c1fa0..958d985f2951 100644 --- a/drivers/usb/host/ohci-au1xxx.c +++ b/drivers/usb/host/ohci-au1xxx.c | |||
| @@ -33,7 +33,7 @@ | |||
| 33 | 33 | ||
| 34 | #ifdef __LITTLE_ENDIAN | 34 | #ifdef __LITTLE_ENDIAN |
| 35 | #define USBH_ENABLE_INIT (USBH_ENABLE_CE | USBH_ENABLE_E | USBH_ENABLE_C) | 35 | #define USBH_ENABLE_INIT (USBH_ENABLE_CE | USBH_ENABLE_E | USBH_ENABLE_C) |
| 36 | #elif __BIG_ENDIAN | 36 | #elif defined(__BIG_ENDIAN) |
| 37 | #define USBH_ENABLE_INIT (USBH_ENABLE_CE | USBH_ENABLE_E | USBH_ENABLE_C | \ | 37 | #define USBH_ENABLE_INIT (USBH_ENABLE_CE | USBH_ENABLE_E | USBH_ENABLE_C | \ |
| 38 | USBH_ENABLE_BE) | 38 | USBH_ENABLE_BE) |
| 39 | #else | 39 | #else |
diff --git a/drivers/usb/host/pci-quirks.c b/drivers/usb/host/pci-quirks.c index 1d586d4f7b56..9b166d70ae91 100644 --- a/drivers/usb/host/pci-quirks.c +++ b/drivers/usb/host/pci-quirks.c | |||
| @@ -84,65 +84,92 @@ int usb_amd_find_chipset_info(void) | |||
| 84 | { | 84 | { |
| 85 | u8 rev = 0; | 85 | u8 rev = 0; |
| 86 | unsigned long flags; | 86 | unsigned long flags; |
| 87 | struct amd_chipset_info info; | ||
| 88 | int ret; | ||
| 87 | 89 | ||
| 88 | spin_lock_irqsave(&amd_lock, flags); | 90 | spin_lock_irqsave(&amd_lock, flags); |
| 89 | 91 | ||
| 90 | amd_chipset.probe_count++; | ||
| 91 | /* probe only once */ | 92 | /* probe only once */ |
| 92 | if (amd_chipset.probe_count > 1) { | 93 | if (amd_chipset.probe_count > 0) { |
| 94 | amd_chipset.probe_count++; | ||
| 93 | spin_unlock_irqrestore(&amd_lock, flags); | 95 | spin_unlock_irqrestore(&amd_lock, flags); |
| 94 | return amd_chipset.probe_result; | 96 | return amd_chipset.probe_result; |
| 95 | } | 97 | } |
| 98 | memset(&info, 0, sizeof(info)); | ||
| 99 | spin_unlock_irqrestore(&amd_lock, flags); | ||
| 96 | 100 | ||
| 97 | amd_chipset.smbus_dev = pci_get_device(PCI_VENDOR_ID_ATI, 0x4385, NULL); | 101 | info.smbus_dev = pci_get_device(PCI_VENDOR_ID_ATI, 0x4385, NULL); |
| 98 | if (amd_chipset.smbus_dev) { | 102 | if (info.smbus_dev) { |
| 99 | rev = amd_chipset.smbus_dev->revision; | 103 | rev = info.smbus_dev->revision; |
| 100 | if (rev >= 0x40) | 104 | if (rev >= 0x40) |
| 101 | amd_chipset.sb_type = 1; | 105 | info.sb_type = 1; |
| 102 | else if (rev >= 0x30 && rev <= 0x3b) | 106 | else if (rev >= 0x30 && rev <= 0x3b) |
| 103 | amd_chipset.sb_type = 3; | 107 | info.sb_type = 3; |
| 104 | } else { | 108 | } else { |
| 105 | amd_chipset.smbus_dev = pci_get_device(PCI_VENDOR_ID_AMD, | 109 | info.smbus_dev = pci_get_device(PCI_VENDOR_ID_AMD, |
| 106 | 0x780b, NULL); | 110 | 0x780b, NULL); |
| 107 | if (!amd_chipset.smbus_dev) { | 111 | if (!info.smbus_dev) { |
| 108 | spin_unlock_irqrestore(&amd_lock, flags); | 112 | ret = 0; |
| 109 | return 0; | 113 | goto commit; |
| 110 | } | 114 | } |
| 111 | rev = amd_chipset.smbus_dev->revision; | 115 | |
| 116 | rev = info.smbus_dev->revision; | ||
| 112 | if (rev >= 0x11 && rev <= 0x18) | 117 | if (rev >= 0x11 && rev <= 0x18) |
| 113 | amd_chipset.sb_type = 2; | 118 | info.sb_type = 2; |
| 114 | } | 119 | } |
| 115 | 120 | ||
| 116 | if (amd_chipset.sb_type == 0) { | 121 | if (info.sb_type == 0) { |
| 117 | if (amd_chipset.smbus_dev) { | 122 | if (info.smbus_dev) { |
| 118 | pci_dev_put(amd_chipset.smbus_dev); | 123 | pci_dev_put(info.smbus_dev); |
| 119 | amd_chipset.smbus_dev = NULL; | 124 | info.smbus_dev = NULL; |
| 120 | } | 125 | } |
| 121 | spin_unlock_irqrestore(&amd_lock, flags); | 126 | ret = 0; |
| 122 | return 0; | 127 | goto commit; |
| 123 | } | 128 | } |
| 124 | 129 | ||
| 125 | amd_chipset.nb_dev = pci_get_device(PCI_VENDOR_ID_AMD, 0x9601, NULL); | 130 | info.nb_dev = pci_get_device(PCI_VENDOR_ID_AMD, 0x9601, NULL); |
| 126 | if (amd_chipset.nb_dev) { | 131 | if (info.nb_dev) { |
| 127 | amd_chipset.nb_type = 1; | 132 | info.nb_type = 1; |
| 128 | } else { | 133 | } else { |
| 129 | amd_chipset.nb_dev = pci_get_device(PCI_VENDOR_ID_AMD, | 134 | info.nb_dev = pci_get_device(PCI_VENDOR_ID_AMD, 0x1510, NULL); |
| 130 | 0x1510, NULL); | 135 | if (info.nb_dev) { |
| 131 | if (amd_chipset.nb_dev) { | 136 | info.nb_type = 2; |
| 132 | amd_chipset.nb_type = 2; | 137 | } else { |
| 133 | } else { | 138 | info.nb_dev = pci_get_device(PCI_VENDOR_ID_AMD, |
| 134 | amd_chipset.nb_dev = pci_get_device(PCI_VENDOR_ID_AMD, | 139 | 0x9600, NULL); |
| 135 | 0x9600, NULL); | 140 | if (info.nb_dev) |
| 136 | if (amd_chipset.nb_dev) | 141 | info.nb_type = 3; |
| 137 | amd_chipset.nb_type = 3; | ||
| 138 | } | 142 | } |
| 139 | } | 143 | } |
| 140 | 144 | ||
| 141 | amd_chipset.probe_result = 1; | 145 | ret = info.probe_result = 1; |
| 142 | printk(KERN_DEBUG "QUIRK: Enable AMD PLL fix\n"); | 146 | printk(KERN_DEBUG "QUIRK: Enable AMD PLL fix\n"); |
| 143 | 147 | ||
| 144 | spin_unlock_irqrestore(&amd_lock, flags); | 148 | commit: |
| 145 | return amd_chipset.probe_result; | 149 | |
| 150 | spin_lock_irqsave(&amd_lock, flags); | ||
| 151 | if (amd_chipset.probe_count > 0) { | ||
| 152 | /* race - someone else was faster - drop devices */ | ||
| 153 | |||
| 154 | /* Mark that we where here */ | ||
| 155 | amd_chipset.probe_count++; | ||
| 156 | ret = amd_chipset.probe_result; | ||
| 157 | |||
| 158 | spin_unlock_irqrestore(&amd_lock, flags); | ||
| 159 | |||
| 160 | if (info.nb_dev) | ||
| 161 | pci_dev_put(info.nb_dev); | ||
| 162 | if (info.smbus_dev) | ||
| 163 | pci_dev_put(info.smbus_dev); | ||
| 164 | |||
| 165 | } else { | ||
| 166 | /* no race - commit the result */ | ||
| 167 | info.probe_count++; | ||
| 168 | amd_chipset = info; | ||
| 169 | spin_unlock_irqrestore(&amd_lock, flags); | ||
| 170 | } | ||
| 171 | |||
| 172 | return ret; | ||
| 146 | } | 173 | } |
| 147 | EXPORT_SYMBOL_GPL(usb_amd_find_chipset_info); | 174 | EXPORT_SYMBOL_GPL(usb_amd_find_chipset_info); |
| 148 | 175 | ||
| @@ -284,6 +311,7 @@ EXPORT_SYMBOL_GPL(usb_amd_quirk_pll_enable); | |||
| 284 | 311 | ||
| 285 | void usb_amd_dev_put(void) | 312 | void usb_amd_dev_put(void) |
| 286 | { | 313 | { |
| 314 | struct pci_dev *nb, *smbus; | ||
| 287 | unsigned long flags; | 315 | unsigned long flags; |
| 288 | 316 | ||
| 289 | spin_lock_irqsave(&amd_lock, flags); | 317 | spin_lock_irqsave(&amd_lock, flags); |
| @@ -294,20 +322,23 @@ void usb_amd_dev_put(void) | |||
| 294 | return; | 322 | return; |
| 295 | } | 323 | } |
| 296 | 324 | ||
| 297 | if (amd_chipset.nb_dev) { | 325 | /* save them to pci_dev_put outside of spinlock */ |
| 298 | pci_dev_put(amd_chipset.nb_dev); | 326 | nb = amd_chipset.nb_dev; |
| 299 | amd_chipset.nb_dev = NULL; | 327 | smbus = amd_chipset.smbus_dev; |
| 300 | } | 328 | |
| 301 | if (amd_chipset.smbus_dev) { | 329 | amd_chipset.nb_dev = NULL; |
| 302 | pci_dev_put(amd_chipset.smbus_dev); | 330 | amd_chipset.smbus_dev = NULL; |
| 303 | amd_chipset.smbus_dev = NULL; | ||
| 304 | } | ||
| 305 | amd_chipset.nb_type = 0; | 331 | amd_chipset.nb_type = 0; |
| 306 | amd_chipset.sb_type = 0; | 332 | amd_chipset.sb_type = 0; |
| 307 | amd_chipset.isoc_reqs = 0; | 333 | amd_chipset.isoc_reqs = 0; |
| 308 | amd_chipset.probe_result = 0; | 334 | amd_chipset.probe_result = 0; |
| 309 | 335 | ||
| 310 | spin_unlock_irqrestore(&amd_lock, flags); | 336 | spin_unlock_irqrestore(&amd_lock, flags); |
| 337 | |||
| 338 | if (nb) | ||
| 339 | pci_dev_put(nb); | ||
| 340 | if (smbus) | ||
| 341 | pci_dev_put(smbus); | ||
| 311 | } | 342 | } |
| 312 | EXPORT_SYMBOL_GPL(usb_amd_dev_put); | 343 | EXPORT_SYMBOL_GPL(usb_amd_dev_put); |
| 313 | 344 | ||
diff --git a/drivers/usb/host/xhci-mem.c b/drivers/usb/host/xhci-mem.c index a003e79aacdc..627f3438028c 100644 --- a/drivers/usb/host/xhci-mem.c +++ b/drivers/usb/host/xhci-mem.c | |||
| @@ -846,7 +846,7 @@ static u32 xhci_find_real_port_number(struct xhci_hcd *xhci, | |||
| 846 | * Skip ports that don't have known speeds, or have duplicate | 846 | * Skip ports that don't have known speeds, or have duplicate |
| 847 | * Extended Capabilities port speed entries. | 847 | * Extended Capabilities port speed entries. |
| 848 | */ | 848 | */ |
| 849 | if (port_speed == 0 || port_speed == -1) | 849 | if (port_speed == 0 || port_speed == DUPLICATE_ENTRY) |
| 850 | continue; | 850 | continue; |
| 851 | 851 | ||
| 852 | /* | 852 | /* |
| @@ -974,6 +974,47 @@ int xhci_setup_addressable_virt_dev(struct xhci_hcd *xhci, struct usb_device *ud | |||
| 974 | return 0; | 974 | return 0; |
| 975 | } | 975 | } |
| 976 | 976 | ||
| 977 | /* | ||
| 978 | * Convert interval expressed as 2^(bInterval - 1) == interval into | ||
| 979 | * straight exponent value 2^n == interval. | ||
| 980 | * | ||
| 981 | */ | ||
| 982 | static unsigned int xhci_parse_exponent_interval(struct usb_device *udev, | ||
| 983 | struct usb_host_endpoint *ep) | ||
| 984 | { | ||
| 985 | unsigned int interval; | ||
| 986 | |||
| 987 | interval = clamp_val(ep->desc.bInterval, 1, 16) - 1; | ||
| 988 | if (interval != ep->desc.bInterval - 1) | ||
| 989 | dev_warn(&udev->dev, | ||
| 990 | "ep %#x - rounding interval to %d microframes\n", | ||
| 991 | ep->desc.bEndpointAddress, | ||
| 992 | 1 << interval); | ||
| 993 | |||
| 994 | return interval; | ||
| 995 | } | ||
| 996 | |||
| 997 | /* | ||
| 998 | * Convert bInterval expressed in frames (in 1-255 range) to exponent of | ||
| 999 | * microframes, rounded down to nearest power of 2. | ||
| 1000 | */ | ||
| 1001 | static unsigned int xhci_parse_frame_interval(struct usb_device *udev, | ||
| 1002 | struct usb_host_endpoint *ep) | ||
| 1003 | { | ||
| 1004 | unsigned int interval; | ||
| 1005 | |||
| 1006 | interval = fls(8 * ep->desc.bInterval) - 1; | ||
| 1007 | interval = clamp_val(interval, 3, 10); | ||
| 1008 | if ((1 << interval) != 8 * ep->desc.bInterval) | ||
| 1009 | dev_warn(&udev->dev, | ||
| 1010 | "ep %#x - rounding interval to %d microframes, ep desc says %d microframes\n", | ||
| 1011 | ep->desc.bEndpointAddress, | ||
| 1012 | 1 << interval, | ||
| 1013 | 8 * ep->desc.bInterval); | ||
| 1014 | |||
| 1015 | return interval; | ||
| 1016 | } | ||
| 1017 | |||
| 977 | /* Return the polling or NAK interval. | 1018 | /* Return the polling or NAK interval. |
| 978 | * | 1019 | * |
| 979 | * The polling interval is expressed in "microframes". If xHCI's Interval field | 1020 | * The polling interval is expressed in "microframes". If xHCI's Interval field |
| @@ -982,7 +1023,7 @@ int xhci_setup_addressable_virt_dev(struct xhci_hcd *xhci, struct usb_device *ud | |||
| 982 | * The NAK interval is one NAK per 1 to 255 microframes, or no NAKs if interval | 1023 | * The NAK interval is one NAK per 1 to 255 microframes, or no NAKs if interval |
| 983 | * is set to 0. | 1024 | * is set to 0. |
| 984 | */ | 1025 | */ |
| 985 | static inline unsigned int xhci_get_endpoint_interval(struct usb_device *udev, | 1026 | static unsigned int xhci_get_endpoint_interval(struct usb_device *udev, |
| 986 | struct usb_host_endpoint *ep) | 1027 | struct usb_host_endpoint *ep) |
| 987 | { | 1028 | { |
| 988 | unsigned int interval = 0; | 1029 | unsigned int interval = 0; |
| @@ -991,45 +1032,38 @@ static inline unsigned int xhci_get_endpoint_interval(struct usb_device *udev, | |||
| 991 | case USB_SPEED_HIGH: | 1032 | case USB_SPEED_HIGH: |
| 992 | /* Max NAK rate */ | 1033 | /* Max NAK rate */ |
| 993 | if (usb_endpoint_xfer_control(&ep->desc) || | 1034 | if (usb_endpoint_xfer_control(&ep->desc) || |
| 994 | usb_endpoint_xfer_bulk(&ep->desc)) | 1035 | usb_endpoint_xfer_bulk(&ep->desc)) { |
| 995 | interval = ep->desc.bInterval; | 1036 | interval = ep->desc.bInterval; |
| 1037 | break; | ||
| 1038 | } | ||
| 996 | /* Fall through - SS and HS isoc/int have same decoding */ | 1039 | /* Fall through - SS and HS isoc/int have same decoding */ |
| 1040 | |||
| 997 | case USB_SPEED_SUPER: | 1041 | case USB_SPEED_SUPER: |
| 998 | if (usb_endpoint_xfer_int(&ep->desc) || | 1042 | if (usb_endpoint_xfer_int(&ep->desc) || |
| 999 | usb_endpoint_xfer_isoc(&ep->desc)) { | 1043 | usb_endpoint_xfer_isoc(&ep->desc)) { |
| 1000 | if (ep->desc.bInterval == 0) | 1044 | interval = xhci_parse_exponent_interval(udev, ep); |
| 1001 | interval = 0; | ||
| 1002 | else | ||
| 1003 | interval = ep->desc.bInterval - 1; | ||
| 1004 | if (interval > 15) | ||
| 1005 | interval = 15; | ||
| 1006 | if (interval != ep->desc.bInterval + 1) | ||
| 1007 | dev_warn(&udev->dev, "ep %#x - rounding interval to %d microframes\n", | ||
| 1008 | ep->desc.bEndpointAddress, 1 << interval); | ||
| 1009 | } | 1045 | } |
| 1010 | break; | 1046 | break; |
| 1011 | /* Convert bInterval (in 1-255 frames) to microframes and round down to | 1047 | |
| 1012 | * nearest power of 2. | ||
| 1013 | */ | ||
| 1014 | case USB_SPEED_FULL: | 1048 | case USB_SPEED_FULL: |
| 1049 | if (usb_endpoint_xfer_int(&ep->desc)) { | ||
| 1050 | interval = xhci_parse_exponent_interval(udev, ep); | ||
| 1051 | break; | ||
| 1052 | } | ||
| 1053 | /* | ||
| 1054 | * Fall through for isochronous endpoint interval decoding | ||
| 1055 | * since it uses the same rules as low speed interrupt | ||
| 1056 | * endpoints. | ||
| 1057 | */ | ||
| 1058 | |||
| 1015 | case USB_SPEED_LOW: | 1059 | case USB_SPEED_LOW: |
| 1016 | if (usb_endpoint_xfer_int(&ep->desc) || | 1060 | if (usb_endpoint_xfer_int(&ep->desc) || |
| 1017 | usb_endpoint_xfer_isoc(&ep->desc)) { | 1061 | usb_endpoint_xfer_isoc(&ep->desc)) { |
| 1018 | interval = fls(8*ep->desc.bInterval) - 1; | 1062 | |
| 1019 | if (interval > 10) | 1063 | interval = xhci_parse_frame_interval(udev, ep); |
| 1020 | interval = 10; | ||
| 1021 | if (interval < 3) | ||
| 1022 | interval = 3; | ||
| 1023 | if ((1 << interval) != 8*ep->desc.bInterval) | ||
| 1024 | dev_warn(&udev->dev, | ||
| 1025 | "ep %#x - rounding interval" | ||
| 1026 | " to %d microframes, " | ||
| 1027 | "ep desc says %d microframes\n", | ||
| 1028 | ep->desc.bEndpointAddress, | ||
| 1029 | 1 << interval, | ||
| 1030 | 8*ep->desc.bInterval); | ||
| 1031 | } | 1064 | } |
| 1032 | break; | 1065 | break; |
| 1066 | |||
| 1033 | default: | 1067 | default: |
| 1034 | BUG(); | 1068 | BUG(); |
| 1035 | } | 1069 | } |
| @@ -1041,7 +1075,7 @@ static inline unsigned int xhci_get_endpoint_interval(struct usb_device *udev, | |||
| 1041 | * transaction opportunities per microframe", but that goes in the Max Burst | 1075 | * transaction opportunities per microframe", but that goes in the Max Burst |
| 1042 | * endpoint context field. | 1076 | * endpoint context field. |
| 1043 | */ | 1077 | */ |
| 1044 | static inline u32 xhci_get_endpoint_mult(struct usb_device *udev, | 1078 | static u32 xhci_get_endpoint_mult(struct usb_device *udev, |
| 1045 | struct usb_host_endpoint *ep) | 1079 | struct usb_host_endpoint *ep) |
| 1046 | { | 1080 | { |
| 1047 | if (udev->speed != USB_SPEED_SUPER || | 1081 | if (udev->speed != USB_SPEED_SUPER || |
| @@ -1050,7 +1084,7 @@ static inline u32 xhci_get_endpoint_mult(struct usb_device *udev, | |||
| 1050 | return ep->ss_ep_comp.bmAttributes; | 1084 | return ep->ss_ep_comp.bmAttributes; |
| 1051 | } | 1085 | } |
| 1052 | 1086 | ||
| 1053 | static inline u32 xhci_get_endpoint_type(struct usb_device *udev, | 1087 | static u32 xhci_get_endpoint_type(struct usb_device *udev, |
| 1054 | struct usb_host_endpoint *ep) | 1088 | struct usb_host_endpoint *ep) |
| 1055 | { | 1089 | { |
| 1056 | int in; | 1090 | int in; |
| @@ -1084,7 +1118,7 @@ static inline u32 xhci_get_endpoint_type(struct usb_device *udev, | |||
| 1084 | * Basically, this is the maxpacket size, multiplied by the burst size | 1118 | * Basically, this is the maxpacket size, multiplied by the burst size |
| 1085 | * and mult size. | 1119 | * and mult size. |
| 1086 | */ | 1120 | */ |
| 1087 | static inline u32 xhci_get_max_esit_payload(struct xhci_hcd *xhci, | 1121 | static u32 xhci_get_max_esit_payload(struct xhci_hcd *xhci, |
| 1088 | struct usb_device *udev, | 1122 | struct usb_device *udev, |
| 1089 | struct usb_host_endpoint *ep) | 1123 | struct usb_host_endpoint *ep) |
| 1090 | { | 1124 | { |
| @@ -1727,12 +1761,12 @@ static void xhci_add_in_port(struct xhci_hcd *xhci, unsigned int num_ports, | |||
| 1727 | * found a similar duplicate. | 1761 | * found a similar duplicate. |
| 1728 | */ | 1762 | */ |
| 1729 | if (xhci->port_array[i] != major_revision && | 1763 | if (xhci->port_array[i] != major_revision && |
| 1730 | xhci->port_array[i] != (u8) -1) { | 1764 | xhci->port_array[i] != DUPLICATE_ENTRY) { |
| 1731 | if (xhci->port_array[i] == 0x03) | 1765 | if (xhci->port_array[i] == 0x03) |
| 1732 | xhci->num_usb3_ports--; | 1766 | xhci->num_usb3_ports--; |
| 1733 | else | 1767 | else |
| 1734 | xhci->num_usb2_ports--; | 1768 | xhci->num_usb2_ports--; |
| 1735 | xhci->port_array[i] = (u8) -1; | 1769 | xhci->port_array[i] = DUPLICATE_ENTRY; |
| 1736 | } | 1770 | } |
| 1737 | /* FIXME: Should we disable the port? */ | 1771 | /* FIXME: Should we disable the port? */ |
| 1738 | continue; | 1772 | continue; |
| @@ -1831,7 +1865,7 @@ static int xhci_setup_port_arrays(struct xhci_hcd *xhci, gfp_t flags) | |||
| 1831 | for (i = 0; i < num_ports; i++) { | 1865 | for (i = 0; i < num_ports; i++) { |
| 1832 | if (xhci->port_array[i] == 0x03 || | 1866 | if (xhci->port_array[i] == 0x03 || |
| 1833 | xhci->port_array[i] == 0 || | 1867 | xhci->port_array[i] == 0 || |
| 1834 | xhci->port_array[i] == -1) | 1868 | xhci->port_array[i] == DUPLICATE_ENTRY) |
| 1835 | continue; | 1869 | continue; |
| 1836 | 1870 | ||
| 1837 | xhci->usb2_ports[port_index] = | 1871 | xhci->usb2_ports[port_index] = |
diff --git a/drivers/usb/host/xhci-pci.c b/drivers/usb/host/xhci-pci.c index ceea9f33491c..a10494c2f3c7 100644 --- a/drivers/usb/host/xhci-pci.c +++ b/drivers/usb/host/xhci-pci.c | |||
| @@ -114,6 +114,10 @@ static int xhci_pci_setup(struct usb_hcd *hcd) | |||
| 114 | if (pdev->vendor == PCI_VENDOR_ID_NEC) | 114 | if (pdev->vendor == PCI_VENDOR_ID_NEC) |
| 115 | xhci->quirks |= XHCI_NEC_HOST; | 115 | xhci->quirks |= XHCI_NEC_HOST; |
| 116 | 116 | ||
| 117 | /* AMD PLL quirk */ | ||
| 118 | if (pdev->vendor == PCI_VENDOR_ID_AMD && usb_amd_find_chipset_info()) | ||
| 119 | xhci->quirks |= XHCI_AMD_PLL_FIX; | ||
| 120 | |||
| 117 | /* Make sure the HC is halted. */ | 121 | /* Make sure the HC is halted. */ |
| 118 | retval = xhci_halt(xhci); | 122 | retval = xhci_halt(xhci); |
| 119 | if (retval) | 123 | if (retval) |
diff --git a/drivers/usb/host/xhci-ring.c b/drivers/usb/host/xhci-ring.c index cfc1ad92473f..7437386a9a50 100644 --- a/drivers/usb/host/xhci-ring.c +++ b/drivers/usb/host/xhci-ring.c | |||
| @@ -93,7 +93,7 @@ dma_addr_t xhci_trb_virt_to_dma(struct xhci_segment *seg, | |||
| 93 | /* Does this link TRB point to the first segment in a ring, | 93 | /* Does this link TRB point to the first segment in a ring, |
| 94 | * or was the previous TRB the last TRB on the last segment in the ERST? | 94 | * or was the previous TRB the last TRB on the last segment in the ERST? |
| 95 | */ | 95 | */ |
| 96 | static inline bool last_trb_on_last_seg(struct xhci_hcd *xhci, struct xhci_ring *ring, | 96 | static bool last_trb_on_last_seg(struct xhci_hcd *xhci, struct xhci_ring *ring, |
| 97 | struct xhci_segment *seg, union xhci_trb *trb) | 97 | struct xhci_segment *seg, union xhci_trb *trb) |
| 98 | { | 98 | { |
| 99 | if (ring == xhci->event_ring) | 99 | if (ring == xhci->event_ring) |
| @@ -107,7 +107,7 @@ static inline bool last_trb_on_last_seg(struct xhci_hcd *xhci, struct xhci_ring | |||
| 107 | * segment? I.e. would the updated event TRB pointer step off the end of the | 107 | * segment? I.e. would the updated event TRB pointer step off the end of the |
| 108 | * event seg? | 108 | * event seg? |
| 109 | */ | 109 | */ |
| 110 | static inline int last_trb(struct xhci_hcd *xhci, struct xhci_ring *ring, | 110 | static int last_trb(struct xhci_hcd *xhci, struct xhci_ring *ring, |
| 111 | struct xhci_segment *seg, union xhci_trb *trb) | 111 | struct xhci_segment *seg, union xhci_trb *trb) |
| 112 | { | 112 | { |
| 113 | if (ring == xhci->event_ring) | 113 | if (ring == xhci->event_ring) |
| @@ -116,7 +116,7 @@ static inline int last_trb(struct xhci_hcd *xhci, struct xhci_ring *ring, | |||
| 116 | return (trb->link.control & TRB_TYPE_BITMASK) == TRB_TYPE(TRB_LINK); | 116 | return (trb->link.control & TRB_TYPE_BITMASK) == TRB_TYPE(TRB_LINK); |
| 117 | } | 117 | } |
| 118 | 118 | ||
| 119 | static inline int enqueue_is_link_trb(struct xhci_ring *ring) | 119 | static int enqueue_is_link_trb(struct xhci_ring *ring) |
| 120 | { | 120 | { |
| 121 | struct xhci_link_trb *link = &ring->enqueue->link; | 121 | struct xhci_link_trb *link = &ring->enqueue->link; |
| 122 | return ((link->control & TRB_TYPE_BITMASK) == TRB_TYPE(TRB_LINK)); | 122 | return ((link->control & TRB_TYPE_BITMASK) == TRB_TYPE(TRB_LINK)); |
| @@ -592,7 +592,7 @@ void xhci_queue_new_dequeue_state(struct xhci_hcd *xhci, | |||
| 592 | ep->ep_state |= SET_DEQ_PENDING; | 592 | ep->ep_state |= SET_DEQ_PENDING; |
| 593 | } | 593 | } |
| 594 | 594 | ||
| 595 | static inline void xhci_stop_watchdog_timer_in_irq(struct xhci_hcd *xhci, | 595 | static void xhci_stop_watchdog_timer_in_irq(struct xhci_hcd *xhci, |
| 596 | struct xhci_virt_ep *ep) | 596 | struct xhci_virt_ep *ep) |
| 597 | { | 597 | { |
| 598 | ep->ep_state &= ~EP_HALT_PENDING; | 598 | ep->ep_state &= ~EP_HALT_PENDING; |
| @@ -619,6 +619,13 @@ static void xhci_giveback_urb_in_irq(struct xhci_hcd *xhci, | |||
| 619 | 619 | ||
| 620 | /* Only giveback urb when this is the last td in urb */ | 620 | /* Only giveback urb when this is the last td in urb */ |
| 621 | if (urb_priv->td_cnt == urb_priv->length) { | 621 | if (urb_priv->td_cnt == urb_priv->length) { |
| 622 | if (usb_pipetype(urb->pipe) == PIPE_ISOCHRONOUS) { | ||
| 623 | xhci_to_hcd(xhci)->self.bandwidth_isoc_reqs--; | ||
| 624 | if (xhci_to_hcd(xhci)->self.bandwidth_isoc_reqs == 0) { | ||
| 625 | if (xhci->quirks & XHCI_AMD_PLL_FIX) | ||
| 626 | usb_amd_quirk_pll_enable(); | ||
| 627 | } | ||
| 628 | } | ||
| 622 | usb_hcd_unlink_urb_from_ep(hcd, urb); | 629 | usb_hcd_unlink_urb_from_ep(hcd, urb); |
| 623 | xhci_dbg(xhci, "Giveback %s URB %p\n", adjective, urb); | 630 | xhci_dbg(xhci, "Giveback %s URB %p\n", adjective, urb); |
| 624 | 631 | ||
| @@ -1209,7 +1216,7 @@ static unsigned int find_faked_portnum_from_hw_portnum(struct usb_hcd *hcd, | |||
| 1209 | * Skip ports that don't have known speeds, or have duplicate | 1216 | * Skip ports that don't have known speeds, or have duplicate |
| 1210 | * Extended Capabilities port speed entries. | 1217 | * Extended Capabilities port speed entries. |
| 1211 | */ | 1218 | */ |
| 1212 | if (port_speed == 0 || port_speed == -1) | 1219 | if (port_speed == 0 || port_speed == DUPLICATE_ENTRY) |
| 1213 | continue; | 1220 | continue; |
| 1214 | 1221 | ||
| 1215 | /* | 1222 | /* |
| @@ -1235,6 +1242,7 @@ static void handle_port_status(struct xhci_hcd *xhci, | |||
| 1235 | u8 major_revision; | 1242 | u8 major_revision; |
| 1236 | struct xhci_bus_state *bus_state; | 1243 | struct xhci_bus_state *bus_state; |
| 1237 | u32 __iomem **port_array; | 1244 | u32 __iomem **port_array; |
| 1245 | bool bogus_port_status = false; | ||
| 1238 | 1246 | ||
| 1239 | /* Port status change events always have a successful completion code */ | 1247 | /* Port status change events always have a successful completion code */ |
| 1240 | if (GET_COMP_CODE(event->generic.field[2]) != COMP_SUCCESS) { | 1248 | if (GET_COMP_CODE(event->generic.field[2]) != COMP_SUCCESS) { |
| @@ -1247,6 +1255,7 @@ static void handle_port_status(struct xhci_hcd *xhci, | |||
| 1247 | max_ports = HCS_MAX_PORTS(xhci->hcs_params1); | 1255 | max_ports = HCS_MAX_PORTS(xhci->hcs_params1); |
| 1248 | if ((port_id <= 0) || (port_id > max_ports)) { | 1256 | if ((port_id <= 0) || (port_id > max_ports)) { |
| 1249 | xhci_warn(xhci, "Invalid port id %d\n", port_id); | 1257 | xhci_warn(xhci, "Invalid port id %d\n", port_id); |
| 1258 | bogus_port_status = true; | ||
| 1250 | goto cleanup; | 1259 | goto cleanup; |
| 1251 | } | 1260 | } |
| 1252 | 1261 | ||
| @@ -1258,12 +1267,14 @@ static void handle_port_status(struct xhci_hcd *xhci, | |||
| 1258 | xhci_warn(xhci, "Event for port %u not in " | 1267 | xhci_warn(xhci, "Event for port %u not in " |
| 1259 | "Extended Capabilities, ignoring.\n", | 1268 | "Extended Capabilities, ignoring.\n", |
| 1260 | port_id); | 1269 | port_id); |
| 1270 | bogus_port_status = true; | ||
| 1261 | goto cleanup; | 1271 | goto cleanup; |
| 1262 | } | 1272 | } |
| 1263 | if (major_revision == (u8) -1) { | 1273 | if (major_revision == DUPLICATE_ENTRY) { |
| 1264 | xhci_warn(xhci, "Event for port %u duplicated in" | 1274 | xhci_warn(xhci, "Event for port %u duplicated in" |
| 1265 | "Extended Capabilities, ignoring.\n", | 1275 | "Extended Capabilities, ignoring.\n", |
| 1266 | port_id); | 1276 | port_id); |
| 1277 | bogus_port_status = true; | ||
| 1267 | goto cleanup; | 1278 | goto cleanup; |
| 1268 | } | 1279 | } |
| 1269 | 1280 | ||
| @@ -1335,6 +1346,13 @@ cleanup: | |||
| 1335 | /* Update event ring dequeue pointer before dropping the lock */ | 1346 | /* Update event ring dequeue pointer before dropping the lock */ |
| 1336 | inc_deq(xhci, xhci->event_ring, true); | 1347 | inc_deq(xhci, xhci->event_ring, true); |
| 1337 | 1348 | ||
| 1349 | /* Don't make the USB core poll the roothub if we got a bad port status | ||
| 1350 | * change event. Besides, at that point we can't tell which roothub | ||
| 1351 | * (USB 2.0 or USB 3.0) to kick. | ||
| 1352 | */ | ||
| 1353 | if (bogus_port_status) | ||
| 1354 | return; | ||
| 1355 | |||
| 1338 | spin_unlock(&xhci->lock); | 1356 | spin_unlock(&xhci->lock); |
| 1339 | /* Pass this up to the core */ | 1357 | /* Pass this up to the core */ |
| 1340 | usb_hcd_poll_rh_status(hcd); | 1358 | usb_hcd_poll_rh_status(hcd); |
| @@ -1554,8 +1572,17 @@ td_cleanup: | |||
| 1554 | 1572 | ||
| 1555 | urb_priv->td_cnt++; | 1573 | urb_priv->td_cnt++; |
| 1556 | /* Giveback the urb when all the tds are completed */ | 1574 | /* Giveback the urb when all the tds are completed */ |
| 1557 | if (urb_priv->td_cnt == urb_priv->length) | 1575 | if (urb_priv->td_cnt == urb_priv->length) { |
| 1558 | ret = 1; | 1576 | ret = 1; |
| 1577 | if (usb_pipetype(urb->pipe) == PIPE_ISOCHRONOUS) { | ||
| 1578 | xhci_to_hcd(xhci)->self.bandwidth_isoc_reqs--; | ||
| 1579 | if (xhci_to_hcd(xhci)->self.bandwidth_isoc_reqs | ||
| 1580 | == 0) { | ||
| 1581 | if (xhci->quirks & XHCI_AMD_PLL_FIX) | ||
| 1582 | usb_amd_quirk_pll_enable(); | ||
| 1583 | } | ||
| 1584 | } | ||
| 1585 | } | ||
| 1559 | } | 1586 | } |
| 1560 | 1587 | ||
| 1561 | return ret; | 1588 | return ret; |
| @@ -1675,71 +1702,52 @@ static int process_isoc_td(struct xhci_hcd *xhci, struct xhci_td *td, | |||
| 1675 | struct urb_priv *urb_priv; | 1702 | struct urb_priv *urb_priv; |
| 1676 | int idx; | 1703 | int idx; |
| 1677 | int len = 0; | 1704 | int len = 0; |
| 1678 | int skip_td = 0; | ||
| 1679 | union xhci_trb *cur_trb; | 1705 | union xhci_trb *cur_trb; |
| 1680 | struct xhci_segment *cur_seg; | 1706 | struct xhci_segment *cur_seg; |
| 1707 | struct usb_iso_packet_descriptor *frame; | ||
| 1681 | u32 trb_comp_code; | 1708 | u32 trb_comp_code; |
| 1709 | bool skip_td = false; | ||
| 1682 | 1710 | ||
| 1683 | ep_ring = xhci_dma_to_transfer_ring(ep, event->buffer); | 1711 | ep_ring = xhci_dma_to_transfer_ring(ep, event->buffer); |
| 1684 | trb_comp_code = GET_COMP_CODE(event->transfer_len); | 1712 | trb_comp_code = GET_COMP_CODE(event->transfer_len); |
| 1685 | urb_priv = td->urb->hcpriv; | 1713 | urb_priv = td->urb->hcpriv; |
| 1686 | idx = urb_priv->td_cnt; | 1714 | idx = urb_priv->td_cnt; |
| 1715 | frame = &td->urb->iso_frame_desc[idx]; | ||
| 1687 | 1716 | ||
| 1688 | if (ep->skip) { | 1717 | /* handle completion code */ |
| 1689 | /* The transfer is partly done */ | 1718 | switch (trb_comp_code) { |
| 1690 | *status = -EXDEV; | 1719 | case COMP_SUCCESS: |
| 1691 | td->urb->iso_frame_desc[idx].status = -EXDEV; | 1720 | frame->status = 0; |
| 1692 | } else { | 1721 | xhci_dbg(xhci, "Successful isoc transfer!\n"); |
| 1693 | /* handle completion code */ | 1722 | break; |
| 1694 | switch (trb_comp_code) { | 1723 | case COMP_SHORT_TX: |
| 1695 | case COMP_SUCCESS: | 1724 | frame->status = td->urb->transfer_flags & URB_SHORT_NOT_OK ? |
| 1696 | td->urb->iso_frame_desc[idx].status = 0; | 1725 | -EREMOTEIO : 0; |
| 1697 | xhci_dbg(xhci, "Successful isoc transfer!\n"); | 1726 | break; |
| 1698 | break; | 1727 | case COMP_BW_OVER: |
| 1699 | case COMP_SHORT_TX: | 1728 | frame->status = -ECOMM; |
| 1700 | if (td->urb->transfer_flags & URB_SHORT_NOT_OK) | 1729 | skip_td = true; |
| 1701 | td->urb->iso_frame_desc[idx].status = | 1730 | break; |
| 1702 | -EREMOTEIO; | 1731 | case COMP_BUFF_OVER: |
| 1703 | else | 1732 | case COMP_BABBLE: |
| 1704 | td->urb->iso_frame_desc[idx].status = 0; | 1733 | frame->status = -EOVERFLOW; |
| 1705 | break; | 1734 | skip_td = true; |
| 1706 | case COMP_BW_OVER: | 1735 | break; |
| 1707 | td->urb->iso_frame_desc[idx].status = -ECOMM; | 1736 | case COMP_STALL: |
| 1708 | skip_td = 1; | 1737 | frame->status = -EPROTO; |
| 1709 | break; | 1738 | skip_td = true; |
| 1710 | case COMP_BUFF_OVER: | 1739 | break; |
| 1711 | case COMP_BABBLE: | 1740 | case COMP_STOP: |
| 1712 | td->urb->iso_frame_desc[idx].status = -EOVERFLOW; | 1741 | case COMP_STOP_INVAL: |
| 1713 | skip_td = 1; | 1742 | break; |
| 1714 | break; | 1743 | default: |
| 1715 | case COMP_STALL: | 1744 | frame->status = -1; |
| 1716 | td->urb->iso_frame_desc[idx].status = -EPROTO; | 1745 | break; |
| 1717 | skip_td = 1; | ||
| 1718 | break; | ||
| 1719 | case COMP_STOP: | ||
| 1720 | case COMP_STOP_INVAL: | ||
| 1721 | break; | ||
| 1722 | default: | ||
| 1723 | td->urb->iso_frame_desc[idx].status = -1; | ||
| 1724 | break; | ||
| 1725 | } | ||
| 1726 | } | ||
| 1727 | |||
| 1728 | /* calc actual length */ | ||
| 1729 | if (ep->skip) { | ||
| 1730 | td->urb->iso_frame_desc[idx].actual_length = 0; | ||
| 1731 | /* Update ring dequeue pointer */ | ||
| 1732 | while (ep_ring->dequeue != td->last_trb) | ||
| 1733 | inc_deq(xhci, ep_ring, false); | ||
| 1734 | inc_deq(xhci, ep_ring, false); | ||
| 1735 | return finish_td(xhci, td, event_trb, event, ep, status, true); | ||
| 1736 | } | 1746 | } |
| 1737 | 1747 | ||
| 1738 | if (trb_comp_code == COMP_SUCCESS || skip_td == 1) { | 1748 | if (trb_comp_code == COMP_SUCCESS || skip_td) { |
| 1739 | td->urb->iso_frame_desc[idx].actual_length = | 1749 | frame->actual_length = frame->length; |
| 1740 | td->urb->iso_frame_desc[idx].length; | 1750 | td->urb->actual_length += frame->length; |
| 1741 | td->urb->actual_length += | ||
| 1742 | td->urb->iso_frame_desc[idx].length; | ||
| 1743 | } else { | 1751 | } else { |
| 1744 | for (cur_trb = ep_ring->dequeue, | 1752 | for (cur_trb = ep_ring->dequeue, |
| 1745 | cur_seg = ep_ring->deq_seg; cur_trb != event_trb; | 1753 | cur_seg = ep_ring->deq_seg; cur_trb != event_trb; |
| @@ -1755,7 +1763,7 @@ static int process_isoc_td(struct xhci_hcd *xhci, struct xhci_td *td, | |||
| 1755 | TRB_LEN(event->transfer_len); | 1763 | TRB_LEN(event->transfer_len); |
| 1756 | 1764 | ||
| 1757 | if (trb_comp_code != COMP_STOP_INVAL) { | 1765 | if (trb_comp_code != COMP_STOP_INVAL) { |
| 1758 | td->urb->iso_frame_desc[idx].actual_length = len; | 1766 | frame->actual_length = len; |
| 1759 | td->urb->actual_length += len; | 1767 | td->urb->actual_length += len; |
| 1760 | } | 1768 | } |
| 1761 | } | 1769 | } |
| @@ -1766,6 +1774,35 @@ static int process_isoc_td(struct xhci_hcd *xhci, struct xhci_td *td, | |||
| 1766 | return finish_td(xhci, td, event_trb, event, ep, status, false); | 1774 | return finish_td(xhci, td, event_trb, event, ep, status, false); |
| 1767 | } | 1775 | } |
| 1768 | 1776 | ||
| 1777 | static int skip_isoc_td(struct xhci_hcd *xhci, struct xhci_td *td, | ||
| 1778 | struct xhci_transfer_event *event, | ||
| 1779 | struct xhci_virt_ep *ep, int *status) | ||
| 1780 | { | ||
| 1781 | struct xhci_ring *ep_ring; | ||
| 1782 | struct urb_priv *urb_priv; | ||
| 1783 | struct usb_iso_packet_descriptor *frame; | ||
| 1784 | int idx; | ||
| 1785 | |||
| 1786 | ep_ring = xhci_dma_to_transfer_ring(ep, event->buffer); | ||
| 1787 | urb_priv = td->urb->hcpriv; | ||
| 1788 | idx = urb_priv->td_cnt; | ||
| 1789 | frame = &td->urb->iso_frame_desc[idx]; | ||
| 1790 | |||
| 1791 | /* The transfer is partly done */ | ||
| 1792 | *status = -EXDEV; | ||
| 1793 | frame->status = -EXDEV; | ||
| 1794 | |||
| 1795 | /* calc actual length */ | ||
| 1796 | frame->actual_length = 0; | ||
| 1797 | |||
| 1798 | /* Update ring dequeue pointer */ | ||
| 1799 | while (ep_ring->dequeue != td->last_trb) | ||
| 1800 | inc_deq(xhci, ep_ring, false); | ||
| 1801 | inc_deq(xhci, ep_ring, false); | ||
| 1802 | |||
| 1803 | return finish_td(xhci, td, NULL, event, ep, status, true); | ||
| 1804 | } | ||
| 1805 | |||
| 1769 | /* | 1806 | /* |
| 1770 | * Process bulk and interrupt tds, update urb status and actual_length. | 1807 | * Process bulk and interrupt tds, update urb status and actual_length. |
| 1771 | */ | 1808 | */ |
| @@ -2024,36 +2061,42 @@ static int handle_tx_event(struct xhci_hcd *xhci, | |||
| 2024 | } | 2061 | } |
| 2025 | 2062 | ||
| 2026 | td = list_entry(ep_ring->td_list.next, struct xhci_td, td_list); | 2063 | td = list_entry(ep_ring->td_list.next, struct xhci_td, td_list); |
| 2064 | |||
| 2027 | /* Is this a TRB in the currently executing TD? */ | 2065 | /* Is this a TRB in the currently executing TD? */ |
| 2028 | event_seg = trb_in_td(ep_ring->deq_seg, ep_ring->dequeue, | 2066 | event_seg = trb_in_td(ep_ring->deq_seg, ep_ring->dequeue, |
| 2029 | td->last_trb, event_dma); | 2067 | td->last_trb, event_dma); |
| 2030 | if (event_seg && ep->skip) { | 2068 | if (!event_seg) { |
| 2069 | if (!ep->skip || | ||
| 2070 | !usb_endpoint_xfer_isoc(&td->urb->ep->desc)) { | ||
| 2071 | /* HC is busted, give up! */ | ||
| 2072 | xhci_err(xhci, | ||
| 2073 | "ERROR Transfer event TRB DMA ptr not " | ||
| 2074 | "part of current TD\n"); | ||
| 2075 | return -ESHUTDOWN; | ||
| 2076 | } | ||
| 2077 | |||
| 2078 | ret = skip_isoc_td(xhci, td, event, ep, &status); | ||
| 2079 | goto cleanup; | ||
| 2080 | } | ||
| 2081 | |||
| 2082 | if (ep->skip) { | ||
| 2031 | xhci_dbg(xhci, "Found td. Clear skip flag.\n"); | 2083 | xhci_dbg(xhci, "Found td. Clear skip flag.\n"); |
| 2032 | ep->skip = false; | 2084 | ep->skip = false; |
| 2033 | } | 2085 | } |
| 2034 | if (!event_seg && | ||
| 2035 | (!ep->skip || !usb_endpoint_xfer_isoc(&td->urb->ep->desc))) { | ||
| 2036 | /* HC is busted, give up! */ | ||
| 2037 | xhci_err(xhci, "ERROR Transfer event TRB DMA ptr not " | ||
| 2038 | "part of current TD\n"); | ||
| 2039 | return -ESHUTDOWN; | ||
| 2040 | } | ||
| 2041 | 2086 | ||
| 2042 | if (event_seg) { | 2087 | event_trb = &event_seg->trbs[(event_dma - event_seg->dma) / |
| 2043 | event_trb = &event_seg->trbs[(event_dma - | 2088 | sizeof(*event_trb)]; |
| 2044 | event_seg->dma) / sizeof(*event_trb)]; | 2089 | /* |
| 2045 | /* | 2090 | * No-op TRB should not trigger interrupts. |
| 2046 | * No-op TRB should not trigger interrupts. | 2091 | * If event_trb is a no-op TRB, it means the |
| 2047 | * If event_trb is a no-op TRB, it means the | 2092 | * corresponding TD has been cancelled. Just ignore |
| 2048 | * corresponding TD has been cancelled. Just ignore | 2093 | * the TD. |
| 2049 | * the TD. | 2094 | */ |
| 2050 | */ | 2095 | if ((event_trb->generic.field[3] & TRB_TYPE_BITMASK) |
| 2051 | if ((event_trb->generic.field[3] & TRB_TYPE_BITMASK) | 2096 | == TRB_TYPE(TRB_TR_NOOP)) { |
| 2052 | == TRB_TYPE(TRB_TR_NOOP)) { | 2097 | xhci_dbg(xhci, |
| 2053 | xhci_dbg(xhci, "event_trb is a no-op TRB. " | 2098 | "event_trb is a no-op TRB. Skip it\n"); |
| 2054 | "Skip it\n"); | 2099 | goto cleanup; |
| 2055 | goto cleanup; | ||
| 2056 | } | ||
| 2057 | } | 2100 | } |
| 2058 | 2101 | ||
| 2059 | /* Now update the urb's actual_length and give back to | 2102 | /* Now update the urb's actual_length and give back to |
| @@ -3126,6 +3169,12 @@ static int xhci_queue_isoc_tx(struct xhci_hcd *xhci, gfp_t mem_flags, | |||
| 3126 | } | 3169 | } |
| 3127 | } | 3170 | } |
| 3128 | 3171 | ||
| 3172 | if (xhci_to_hcd(xhci)->self.bandwidth_isoc_reqs == 0) { | ||
| 3173 | if (xhci->quirks & XHCI_AMD_PLL_FIX) | ||
| 3174 | usb_amd_quirk_pll_disable(); | ||
| 3175 | } | ||
| 3176 | xhci_to_hcd(xhci)->self.bandwidth_isoc_reqs++; | ||
| 3177 | |||
| 3129 | giveback_first_trb(xhci, slot_id, ep_index, urb->stream_id, | 3178 | giveback_first_trb(xhci, slot_id, ep_index, urb->stream_id, |
| 3130 | start_cycle, start_trb); | 3179 | start_cycle, start_trb); |
| 3131 | return 0; | 3180 | return 0; |
diff --git a/drivers/usb/host/xhci.c b/drivers/usb/host/xhci.c index 196e0181b2ed..81b976e45880 100644 --- a/drivers/usb/host/xhci.c +++ b/drivers/usb/host/xhci.c | |||
| @@ -550,6 +550,9 @@ void xhci_stop(struct usb_hcd *hcd) | |||
| 550 | del_timer_sync(&xhci->event_ring_timer); | 550 | del_timer_sync(&xhci->event_ring_timer); |
| 551 | #endif | 551 | #endif |
| 552 | 552 | ||
| 553 | if (xhci->quirks & XHCI_AMD_PLL_FIX) | ||
| 554 | usb_amd_dev_put(); | ||
| 555 | |||
| 553 | xhci_dbg(xhci, "// Disabling event ring interrupts\n"); | 556 | xhci_dbg(xhci, "// Disabling event ring interrupts\n"); |
| 554 | temp = xhci_readl(xhci, &xhci->op_regs->status); | 557 | temp = xhci_readl(xhci, &xhci->op_regs->status); |
| 555 | xhci_writel(xhci, temp & ~STS_EINT, &xhci->op_regs->status); | 558 | xhci_writel(xhci, temp & ~STS_EINT, &xhci->op_regs->status); |
| @@ -771,7 +774,9 @@ int xhci_resume(struct xhci_hcd *xhci, bool hibernated) | |||
| 771 | 774 | ||
| 772 | /* If restore operation fails, re-initialize the HC during resume */ | 775 | /* If restore operation fails, re-initialize the HC during resume */ |
| 773 | if ((temp & STS_SRE) || hibernated) { | 776 | if ((temp & STS_SRE) || hibernated) { |
| 774 | usb_root_hub_lost_power(hcd->self.root_hub); | 777 | /* Let the USB core know _both_ roothubs lost power. */ |
| 778 | usb_root_hub_lost_power(xhci->main_hcd->self.root_hub); | ||
| 779 | usb_root_hub_lost_power(xhci->shared_hcd->self.root_hub); | ||
| 775 | 780 | ||
| 776 | xhci_dbg(xhci, "Stop HCD\n"); | 781 | xhci_dbg(xhci, "Stop HCD\n"); |
| 777 | xhci_halt(xhci); | 782 | xhci_halt(xhci); |
| @@ -2386,10 +2391,18 @@ int xhci_discover_or_reset_device(struct usb_hcd *hcd, struct usb_device *udev) | |||
| 2386 | /* Everything but endpoint 0 is disabled, so free or cache the rings. */ | 2391 | /* Everything but endpoint 0 is disabled, so free or cache the rings. */ |
| 2387 | last_freed_endpoint = 1; | 2392 | last_freed_endpoint = 1; |
| 2388 | for (i = 1; i < 31; ++i) { | 2393 | for (i = 1; i < 31; ++i) { |
| 2389 | if (!virt_dev->eps[i].ring) | 2394 | struct xhci_virt_ep *ep = &virt_dev->eps[i]; |
| 2390 | continue; | 2395 | |
| 2391 | xhci_free_or_cache_endpoint_ring(xhci, virt_dev, i); | 2396 | if (ep->ep_state & EP_HAS_STREAMS) { |
| 2392 | last_freed_endpoint = i; | 2397 | xhci_free_stream_info(xhci, ep->stream_info); |
| 2398 | ep->stream_info = NULL; | ||
| 2399 | ep->ep_state &= ~EP_HAS_STREAMS; | ||
| 2400 | } | ||
| 2401 | |||
| 2402 | if (ep->ring) { | ||
| 2403 | xhci_free_or_cache_endpoint_ring(xhci, virt_dev, i); | ||
| 2404 | last_freed_endpoint = i; | ||
| 2405 | } | ||
| 2393 | } | 2406 | } |
| 2394 | xhci_dbg(xhci, "Output context after successful reset device cmd:\n"); | 2407 | xhci_dbg(xhci, "Output context after successful reset device cmd:\n"); |
| 2395 | xhci_dbg_ctx(xhci, virt_dev->out_ctx, last_freed_endpoint); | 2408 | xhci_dbg_ctx(xhci, virt_dev->out_ctx, last_freed_endpoint); |
diff --git a/drivers/usb/host/xhci.h b/drivers/usb/host/xhci.h index 07e263063e37..ba1be6b7cc6d 100644 --- a/drivers/usb/host/xhci.h +++ b/drivers/usb/host/xhci.h | |||
| @@ -30,6 +30,7 @@ | |||
| 30 | 30 | ||
| 31 | /* Code sharing between pci-quirks and xhci hcd */ | 31 | /* Code sharing between pci-quirks and xhci hcd */ |
| 32 | #include "xhci-ext-caps.h" | 32 | #include "xhci-ext-caps.h" |
| 33 | #include "pci-quirks.h" | ||
| 33 | 34 | ||
| 34 | /* xHCI PCI Configuration Registers */ | 35 | /* xHCI PCI Configuration Registers */ |
| 35 | #define XHCI_SBRN_OFFSET (0x60) | 36 | #define XHCI_SBRN_OFFSET (0x60) |
| @@ -232,7 +233,7 @@ struct xhci_op_regs { | |||
| 232 | * notification type that matches a bit set in this bit field. | 233 | * notification type that matches a bit set in this bit field. |
| 233 | */ | 234 | */ |
| 234 | #define DEV_NOTE_MASK (0xffff) | 235 | #define DEV_NOTE_MASK (0xffff) |
| 235 | #define ENABLE_DEV_NOTE(x) (1 << x) | 236 | #define ENABLE_DEV_NOTE(x) (1 << (x)) |
| 236 | /* Most of the device notification types should only be used for debug. | 237 | /* Most of the device notification types should only be used for debug. |
| 237 | * SW does need to pay attention to function wake notifications. | 238 | * SW does need to pay attention to function wake notifications. |
| 238 | */ | 239 | */ |
| @@ -348,6 +349,9 @@ struct xhci_op_regs { | |||
| 348 | /* Initiate a warm port reset - complete when PORT_WRC is '1' */ | 349 | /* Initiate a warm port reset - complete when PORT_WRC is '1' */ |
| 349 | #define PORT_WR (1 << 31) | 350 | #define PORT_WR (1 << 31) |
| 350 | 351 | ||
| 352 | /* We mark duplicate entries with -1 */ | ||
| 353 | #define DUPLICATE_ENTRY ((u8)(-1)) | ||
| 354 | |||
| 351 | /* Port Power Management Status and Control - port_power_base bitmasks */ | 355 | /* Port Power Management Status and Control - port_power_base bitmasks */ |
| 352 | /* Inactivity timer value for transitions into U1, in microseconds. | 356 | /* Inactivity timer value for transitions into U1, in microseconds. |
| 353 | * Timeout can be up to 127us. 0xFF means an infinite timeout. | 357 | * Timeout can be up to 127us. 0xFF means an infinite timeout. |
| @@ -601,11 +605,11 @@ struct xhci_ep_ctx { | |||
| 601 | #define EP_STATE_STOPPED 3 | 605 | #define EP_STATE_STOPPED 3 |
| 602 | #define EP_STATE_ERROR 4 | 606 | #define EP_STATE_ERROR 4 |
| 603 | /* Mult - Max number of burtst within an interval, in EP companion desc. */ | 607 | /* Mult - Max number of burtst within an interval, in EP companion desc. */ |
| 604 | #define EP_MULT(p) ((p & 0x3) << 8) | 608 | #define EP_MULT(p) (((p) & 0x3) << 8) |
| 605 | /* bits 10:14 are Max Primary Streams */ | 609 | /* bits 10:14 are Max Primary Streams */ |
| 606 | /* bit 15 is Linear Stream Array */ | 610 | /* bit 15 is Linear Stream Array */ |
| 607 | /* Interval - period between requests to an endpoint - 125u increments. */ | 611 | /* Interval - period between requests to an endpoint - 125u increments. */ |
| 608 | #define EP_INTERVAL(p) ((p & 0xff) << 16) | 612 | #define EP_INTERVAL(p) (((p) & 0xff) << 16) |
| 609 | #define EP_INTERVAL_TO_UFRAMES(p) (1 << (((p) >> 16) & 0xff)) | 613 | #define EP_INTERVAL_TO_UFRAMES(p) (1 << (((p) >> 16) & 0xff)) |
| 610 | #define EP_MAXPSTREAMS_MASK (0x1f << 10) | 614 | #define EP_MAXPSTREAMS_MASK (0x1f << 10) |
| 611 | #define EP_MAXPSTREAMS(p) (((p) << 10) & EP_MAXPSTREAMS_MASK) | 615 | #define EP_MAXPSTREAMS(p) (((p) << 10) & EP_MAXPSTREAMS_MASK) |
| @@ -1276,6 +1280,7 @@ struct xhci_hcd { | |||
| 1276 | #define XHCI_LINK_TRB_QUIRK (1 << 0) | 1280 | #define XHCI_LINK_TRB_QUIRK (1 << 0) |
| 1277 | #define XHCI_RESET_EP_QUIRK (1 << 1) | 1281 | #define XHCI_RESET_EP_QUIRK (1 << 1) |
| 1278 | #define XHCI_NEC_HOST (1 << 2) | 1282 | #define XHCI_NEC_HOST (1 << 2) |
| 1283 | #define XHCI_AMD_PLL_FIX (1 << 3) | ||
| 1279 | /* There are two roothubs to keep track of bus suspend info for */ | 1284 | /* There are two roothubs to keep track of bus suspend info for */ |
| 1280 | struct xhci_bus_state bus_state[2]; | 1285 | struct xhci_bus_state bus_state[2]; |
| 1281 | /* Is each xHCI roothub port a USB 3.0, USB 2.0, or USB 1.1 port? */ | 1286 | /* Is each xHCI roothub port a USB 3.0, USB 2.0, or USB 1.1 port? */ |
diff --git a/drivers/usb/musb/Kconfig b/drivers/usb/musb/Kconfig index 4cbb7e4b368d..74073b363c30 100644 --- a/drivers/usb/musb/Kconfig +++ b/drivers/usb/musb/Kconfig | |||
| @@ -14,7 +14,7 @@ config USB_MUSB_HDRC | |||
| 14 | select TWL4030_USB if MACH_OMAP_3430SDP | 14 | select TWL4030_USB if MACH_OMAP_3430SDP |
| 15 | select TWL6030_USB if MACH_OMAP_4430SDP || MACH_OMAP4_PANDA | 15 | select TWL6030_USB if MACH_OMAP_4430SDP || MACH_OMAP4_PANDA |
| 16 | select USB_OTG_UTILS | 16 | select USB_OTG_UTILS |
| 17 | tristate 'Inventra Highspeed Dual Role Controller (TI, ADI, ...)' | 17 | bool 'Inventra Highspeed Dual Role Controller (TI, ADI, ...)' |
| 18 | help | 18 | help |
| 19 | Say Y here if your system has a dual role high speed USB | 19 | Say Y here if your system has a dual role high speed USB |
| 20 | controller based on the Mentor Graphics silicon IP. Then | 20 | controller based on the Mentor Graphics silicon IP. Then |
| @@ -30,8 +30,8 @@ config USB_MUSB_HDRC | |||
| 30 | 30 | ||
| 31 | If you do not know what this is, please say N. | 31 | If you do not know what this is, please say N. |
| 32 | 32 | ||
| 33 | To compile this driver as a module, choose M here; the | 33 | # To compile this driver as a module, choose M here; the |
| 34 | module will be called "musb-hdrc". | 34 | # module will be called "musb-hdrc". |
| 35 | 35 | ||
| 36 | choice | 36 | choice |
| 37 | prompt "Platform Glue Layer" | 37 | prompt "Platform Glue Layer" |
diff --git a/drivers/usb/musb/blackfin.c b/drivers/usb/musb/blackfin.c index 52312e8af213..8e2a1ff8a35a 100644 --- a/drivers/usb/musb/blackfin.c +++ b/drivers/usb/musb/blackfin.c | |||
| @@ -21,6 +21,7 @@ | |||
| 21 | #include <asm/cacheflush.h> | 21 | #include <asm/cacheflush.h> |
| 22 | 22 | ||
| 23 | #include "musb_core.h" | 23 | #include "musb_core.h" |
| 24 | #include "musbhsdma.h" | ||
| 24 | #include "blackfin.h" | 25 | #include "blackfin.h" |
| 25 | 26 | ||
| 26 | struct bfin_glue { | 27 | struct bfin_glue { |
| @@ -332,6 +333,27 @@ static int bfin_musb_set_mode(struct musb *musb, u8 musb_mode) | |||
| 332 | return -EIO; | 333 | return -EIO; |
| 333 | } | 334 | } |
| 334 | 335 | ||
| 336 | static int bfin_musb_adjust_channel_params(struct dma_channel *channel, | ||
| 337 | u16 packet_sz, u8 *mode, | ||
| 338 | dma_addr_t *dma_addr, u32 *len) | ||
| 339 | { | ||
| 340 | struct musb_dma_channel *musb_channel = channel->private_data; | ||
| 341 | |||
| 342 | /* | ||
| 343 | * Anomaly 05000450 might cause data corruption when using DMA | ||
| 344 | * MODE 1 transmits with short packet. So to work around this, | ||
| 345 | * we truncate all MODE 1 transfers down to a multiple of the | ||
| 346 | * max packet size, and then do the last short packet transfer | ||
| 347 | * (if there is any) using MODE 0. | ||
| 348 | */ | ||
| 349 | if (ANOMALY_05000450) { | ||
| 350 | if (musb_channel->transmit && *mode == 1) | ||
| 351 | *len = *len - (*len % packet_sz); | ||
| 352 | } | ||
| 353 | |||
| 354 | return 0; | ||
| 355 | } | ||
| 356 | |||
| 335 | static void bfin_musb_reg_init(struct musb *musb) | 357 | static void bfin_musb_reg_init(struct musb *musb) |
| 336 | { | 358 | { |
| 337 | if (ANOMALY_05000346) { | 359 | if (ANOMALY_05000346) { |
| @@ -430,6 +452,8 @@ static const struct musb_platform_ops bfin_ops = { | |||
| 430 | 452 | ||
| 431 | .vbus_status = bfin_musb_vbus_status, | 453 | .vbus_status = bfin_musb_vbus_status, |
| 432 | .set_vbus = bfin_musb_set_vbus, | 454 | .set_vbus = bfin_musb_set_vbus, |
| 455 | |||
| 456 | .adjust_channel_params = bfin_musb_adjust_channel_params, | ||
| 433 | }; | 457 | }; |
| 434 | 458 | ||
| 435 | static u64 bfin_dmamask = DMA_BIT_MASK(32); | 459 | static u64 bfin_dmamask = DMA_BIT_MASK(32); |
diff --git a/drivers/usb/musb/cppi_dma.c b/drivers/usb/musb/cppi_dma.c index de55a3c3259a..ab434fbd8c35 100644 --- a/drivers/usb/musb/cppi_dma.c +++ b/drivers/usb/musb/cppi_dma.c | |||
| @@ -597,12 +597,12 @@ cppi_next_tx_segment(struct musb *musb, struct cppi_channel *tx) | |||
| 597 | length = min(n_bds * maxpacket, length); | 597 | length = min(n_bds * maxpacket, length); |
| 598 | } | 598 | } |
| 599 | 599 | ||
| 600 | DBG(4, "TX DMA%d, pktSz %d %s bds %d dma 0x%x len %u\n", | 600 | DBG(4, "TX DMA%d, pktSz %d %s bds %d dma 0x%llx len %u\n", |
| 601 | tx->index, | 601 | tx->index, |
| 602 | maxpacket, | 602 | maxpacket, |
| 603 | rndis ? "rndis" : "transparent", | 603 | rndis ? "rndis" : "transparent", |
| 604 | n_bds, | 604 | n_bds, |
| 605 | addr, length); | 605 | (unsigned long long)addr, length); |
| 606 | 606 | ||
| 607 | cppi_rndis_update(tx, 0, musb->ctrl_base, rndis); | 607 | cppi_rndis_update(tx, 0, musb->ctrl_base, rndis); |
| 608 | 608 | ||
| @@ -820,7 +820,7 @@ cppi_next_rx_segment(struct musb *musb, struct cppi_channel *rx, int onepacket) | |||
| 820 | length = min(n_bds * maxpacket, length); | 820 | length = min(n_bds * maxpacket, length); |
| 821 | 821 | ||
| 822 | DBG(4, "RX DMA%d seg, maxp %d %s bds %d (cnt %d) " | 822 | DBG(4, "RX DMA%d seg, maxp %d %s bds %d (cnt %d) " |
| 823 | "dma 0x%x len %u %u/%u\n", | 823 | "dma 0x%llx len %u %u/%u\n", |
| 824 | rx->index, maxpacket, | 824 | rx->index, maxpacket, |
| 825 | onepacket | 825 | onepacket |
| 826 | ? (is_rndis ? "rndis" : "onepacket") | 826 | ? (is_rndis ? "rndis" : "onepacket") |
| @@ -829,7 +829,8 @@ cppi_next_rx_segment(struct musb *musb, struct cppi_channel *rx, int onepacket) | |||
| 829 | musb_readl(tibase, | 829 | musb_readl(tibase, |
| 830 | DAVINCI_RXCPPI_BUFCNT0_REG + (rx->index * 4)) | 830 | DAVINCI_RXCPPI_BUFCNT0_REG + (rx->index * 4)) |
| 831 | & 0xffff, | 831 | & 0xffff, |
| 832 | addr, length, rx->channel.actual_len, rx->buf_len); | 832 | (unsigned long long)addr, length, |
| 833 | rx->channel.actual_len, rx->buf_len); | ||
| 833 | 834 | ||
| 834 | /* only queue one segment at a time, since the hardware prevents | 835 | /* only queue one segment at a time, since the hardware prevents |
| 835 | * correct queue shutdown after unexpected short packets | 836 | * correct queue shutdown after unexpected short packets |
| @@ -1039,9 +1040,9 @@ static bool cppi_rx_scan(struct cppi *cppi, unsigned ch) | |||
| 1039 | if (!completed && (bd->hw_options & CPPI_OWN_SET)) | 1040 | if (!completed && (bd->hw_options & CPPI_OWN_SET)) |
| 1040 | break; | 1041 | break; |
| 1041 | 1042 | ||
| 1042 | DBG(5, "C/RXBD %08x: nxt %08x buf %08x " | 1043 | DBG(5, "C/RXBD %llx: nxt %08x buf %08x " |
| 1043 | "off.len %08x opt.len %08x (%d)\n", | 1044 | "off.len %08x opt.len %08x (%d)\n", |
| 1044 | bd->dma, bd->hw_next, bd->hw_bufp, | 1045 | (unsigned long long)bd->dma, bd->hw_next, bd->hw_bufp, |
| 1045 | bd->hw_off_len, bd->hw_options, | 1046 | bd->hw_off_len, bd->hw_options, |
| 1046 | rx->channel.actual_len); | 1047 | rx->channel.actual_len); |
| 1047 | 1048 | ||
| @@ -1111,11 +1112,12 @@ static bool cppi_rx_scan(struct cppi *cppi, unsigned ch) | |||
| 1111 | musb_ep_select(cppi->mregs, rx->index + 1); | 1112 | musb_ep_select(cppi->mregs, rx->index + 1); |
| 1112 | csr = musb_readw(regs, MUSB_RXCSR); | 1113 | csr = musb_readw(regs, MUSB_RXCSR); |
| 1113 | if (csr & MUSB_RXCSR_DMAENAB) { | 1114 | if (csr & MUSB_RXCSR_DMAENAB) { |
| 1114 | DBG(4, "list%d %p/%p, last %08x%s, csr %04x\n", | 1115 | DBG(4, "list%d %p/%p, last %llx%s, csr %04x\n", |
| 1115 | rx->index, | 1116 | rx->index, |
| 1116 | rx->head, rx->tail, | 1117 | rx->head, rx->tail, |
| 1117 | rx->last_processed | 1118 | rx->last_processed |
| 1118 | ? rx->last_processed->dma | 1119 | ? (unsigned long long) |
| 1120 | rx->last_processed->dma | ||
| 1119 | : 0, | 1121 | : 0, |
| 1120 | completed ? ", completed" : "", | 1122 | completed ? ", completed" : "", |
| 1121 | csr); | 1123 | csr); |
| @@ -1167,8 +1169,11 @@ irqreturn_t cppi_interrupt(int irq, void *dev_id) | |||
| 1167 | tx = musb_readl(tibase, DAVINCI_TXCPPI_MASKED_REG); | 1169 | tx = musb_readl(tibase, DAVINCI_TXCPPI_MASKED_REG); |
| 1168 | rx = musb_readl(tibase, DAVINCI_RXCPPI_MASKED_REG); | 1170 | rx = musb_readl(tibase, DAVINCI_RXCPPI_MASKED_REG); |
| 1169 | 1171 | ||
| 1170 | if (!tx && !rx) | 1172 | if (!tx && !rx) { |
| 1173 | if (cppi->irq) | ||
| 1174 | spin_unlock_irqrestore(&musb->lock, flags); | ||
| 1171 | return IRQ_NONE; | 1175 | return IRQ_NONE; |
| 1176 | } | ||
| 1172 | 1177 | ||
| 1173 | DBG(4, "CPPI IRQ Tx%x Rx%x\n", tx, rx); | 1178 | DBG(4, "CPPI IRQ Tx%x Rx%x\n", tx, rx); |
| 1174 | 1179 | ||
| @@ -1199,7 +1204,7 @@ irqreturn_t cppi_interrupt(int irq, void *dev_id) | |||
| 1199 | */ | 1204 | */ |
| 1200 | if (NULL == bd) { | 1205 | if (NULL == bd) { |
| 1201 | DBG(1, "null BD\n"); | 1206 | DBG(1, "null BD\n"); |
| 1202 | tx_ram->tx_complete = 0; | 1207 | musb_writel(&tx_ram->tx_complete, 0, 0); |
| 1203 | continue; | 1208 | continue; |
| 1204 | } | 1209 | } |
| 1205 | 1210 | ||
| @@ -1452,7 +1457,7 @@ static int cppi_channel_abort(struct dma_channel *channel) | |||
| 1452 | * compare mode by writing 1 to the tx_complete register. | 1457 | * compare mode by writing 1 to the tx_complete register. |
| 1453 | */ | 1458 | */ |
| 1454 | cppi_reset_tx(tx_ram, 1); | 1459 | cppi_reset_tx(tx_ram, 1); |
| 1455 | cppi_ch->head = 0; | 1460 | cppi_ch->head = NULL; |
| 1456 | musb_writel(&tx_ram->tx_complete, 0, 1); | 1461 | musb_writel(&tx_ram->tx_complete, 0, 1); |
| 1457 | cppi_dump_tx(5, cppi_ch, " (done teardown)"); | 1462 | cppi_dump_tx(5, cppi_ch, " (done teardown)"); |
| 1458 | 1463 | ||
diff --git a/drivers/usb/musb/musb_core.c b/drivers/usb/musb/musb_core.c index 630ae7f3cd4c..f10ff00ca09e 100644 --- a/drivers/usb/musb/musb_core.c +++ b/drivers/usb/musb/musb_core.c | |||
| @@ -1030,6 +1030,7 @@ static void musb_shutdown(struct platform_device *pdev) | |||
| 1030 | struct musb *musb = dev_to_musb(&pdev->dev); | 1030 | struct musb *musb = dev_to_musb(&pdev->dev); |
| 1031 | unsigned long flags; | 1031 | unsigned long flags; |
| 1032 | 1032 | ||
| 1033 | pm_runtime_get_sync(musb->controller); | ||
| 1033 | spin_lock_irqsave(&musb->lock, flags); | 1034 | spin_lock_irqsave(&musb->lock, flags); |
| 1034 | musb_platform_disable(musb); | 1035 | musb_platform_disable(musb); |
| 1035 | musb_generic_disable(musb); | 1036 | musb_generic_disable(musb); |
| @@ -1040,6 +1041,7 @@ static void musb_shutdown(struct platform_device *pdev) | |||
| 1040 | musb_writeb(musb->mregs, MUSB_DEVCTL, 0); | 1041 | musb_writeb(musb->mregs, MUSB_DEVCTL, 0); |
| 1041 | musb_platform_exit(musb); | 1042 | musb_platform_exit(musb); |
| 1042 | 1043 | ||
| 1044 | pm_runtime_put(musb->controller); | ||
| 1043 | /* FIXME power down */ | 1045 | /* FIXME power down */ |
| 1044 | } | 1046 | } |
| 1045 | 1047 | ||
diff --git a/drivers/usb/musb/musb_core.h b/drivers/usb/musb/musb_core.h index 4bd9e2145ee4..0e053b587960 100644 --- a/drivers/usb/musb/musb_core.h +++ b/drivers/usb/musb/musb_core.h | |||
| @@ -261,6 +261,7 @@ enum musb_g_ep0_state { | |||
| 261 | * @try_ilde: tries to idle the IP | 261 | * @try_ilde: tries to idle the IP |
| 262 | * @vbus_status: returns vbus status if possible | 262 | * @vbus_status: returns vbus status if possible |
| 263 | * @set_vbus: forces vbus status | 263 | * @set_vbus: forces vbus status |
| 264 | * @channel_program: pre check for standard dma channel_program func | ||
| 264 | */ | 265 | */ |
| 265 | struct musb_platform_ops { | 266 | struct musb_platform_ops { |
| 266 | int (*init)(struct musb *musb); | 267 | int (*init)(struct musb *musb); |
| @@ -274,6 +275,10 @@ struct musb_platform_ops { | |||
| 274 | 275 | ||
| 275 | int (*vbus_status)(struct musb *musb); | 276 | int (*vbus_status)(struct musb *musb); |
| 276 | void (*set_vbus)(struct musb *musb, int on); | 277 | void (*set_vbus)(struct musb *musb, int on); |
| 278 | |||
| 279 | int (*adjust_channel_params)(struct dma_channel *channel, | ||
| 280 | u16 packet_sz, u8 *mode, | ||
| 281 | dma_addr_t *dma_addr, u32 *len); | ||
| 277 | }; | 282 | }; |
| 278 | 283 | ||
| 279 | /* | 284 | /* |
diff --git a/drivers/usb/musb/musb_gadget.c b/drivers/usb/musb/musb_gadget.c index 98519c5d8b5c..6dfbf9ffd7a6 100644 --- a/drivers/usb/musb/musb_gadget.c +++ b/drivers/usb/musb/musb_gadget.c | |||
| @@ -535,7 +535,7 @@ void musb_g_tx(struct musb *musb, u8 epnum) | |||
| 535 | is_dma = 1; | 535 | is_dma = 1; |
| 536 | csr |= MUSB_TXCSR_P_WZC_BITS; | 536 | csr |= MUSB_TXCSR_P_WZC_BITS; |
| 537 | csr &= ~(MUSB_TXCSR_DMAENAB | MUSB_TXCSR_P_UNDERRUN | | 537 | csr &= ~(MUSB_TXCSR_DMAENAB | MUSB_TXCSR_P_UNDERRUN | |
| 538 | MUSB_TXCSR_TXPKTRDY); | 538 | MUSB_TXCSR_TXPKTRDY | MUSB_TXCSR_AUTOSET); |
| 539 | musb_writew(epio, MUSB_TXCSR, csr); | 539 | musb_writew(epio, MUSB_TXCSR, csr); |
| 540 | /* Ensure writebuffer is empty. */ | 540 | /* Ensure writebuffer is empty. */ |
| 541 | csr = musb_readw(epio, MUSB_TXCSR); | 541 | csr = musb_readw(epio, MUSB_TXCSR); |
| @@ -1296,7 +1296,7 @@ static int musb_gadget_dequeue(struct usb_ep *ep, struct usb_request *request) | |||
| 1296 | } | 1296 | } |
| 1297 | 1297 | ||
| 1298 | /* if the hardware doesn't have the request, easy ... */ | 1298 | /* if the hardware doesn't have the request, easy ... */ |
| 1299 | if (musb_ep->req_list.next != &request->list || musb_ep->busy) | 1299 | if (musb_ep->req_list.next != &req->list || musb_ep->busy) |
| 1300 | musb_g_giveback(musb_ep, request, -ECONNRESET); | 1300 | musb_g_giveback(musb_ep, request, -ECONNRESET); |
| 1301 | 1301 | ||
| 1302 | /* ... else abort the dma transfer ... */ | 1302 | /* ... else abort the dma transfer ... */ |
diff --git a/drivers/usb/musb/musbhsdma.c b/drivers/usb/musb/musbhsdma.c index 0144a2d481fd..d281792db05c 100644 --- a/drivers/usb/musb/musbhsdma.c +++ b/drivers/usb/musb/musbhsdma.c | |||
| @@ -169,6 +169,14 @@ static int dma_channel_program(struct dma_channel *channel, | |||
| 169 | BUG_ON(channel->status == MUSB_DMA_STATUS_UNKNOWN || | 169 | BUG_ON(channel->status == MUSB_DMA_STATUS_UNKNOWN || |
| 170 | channel->status == MUSB_DMA_STATUS_BUSY); | 170 | channel->status == MUSB_DMA_STATUS_BUSY); |
| 171 | 171 | ||
| 172 | /* Let targets check/tweak the arguments */ | ||
| 173 | if (musb->ops->adjust_channel_params) { | ||
| 174 | int ret = musb->ops->adjust_channel_params(channel, | ||
| 175 | packet_sz, &mode, &dma_addr, &len); | ||
| 176 | if (ret) | ||
| 177 | return ret; | ||
| 178 | } | ||
| 179 | |||
| 172 | /* | 180 | /* |
| 173 | * The DMA engine in RTL1.8 and above cannot handle | 181 | * The DMA engine in RTL1.8 and above cannot handle |
| 174 | * DMA addresses that are not aligned to a 4 byte boundary. | 182 | * DMA addresses that are not aligned to a 4 byte boundary. |
diff --git a/drivers/usb/musb/omap2430.c b/drivers/usb/musb/omap2430.c index 25cb8b0003b1..57a27fa954b4 100644 --- a/drivers/usb/musb/omap2430.c +++ b/drivers/usb/musb/omap2430.c | |||
| @@ -259,9 +259,10 @@ static int musb_otg_notifications(struct notifier_block *nb, | |||
| 259 | case USB_EVENT_VBUS: | 259 | case USB_EVENT_VBUS: |
| 260 | DBG(4, "VBUS Connect\n"); | 260 | DBG(4, "VBUS Connect\n"); |
| 261 | 261 | ||
| 262 | #ifdef CONFIG_USB_GADGET_MUSB_HDRC | ||
| 262 | if (musb->gadget_driver) | 263 | if (musb->gadget_driver) |
| 263 | pm_runtime_get_sync(musb->controller); | 264 | pm_runtime_get_sync(musb->controller); |
| 264 | 265 | #endif | |
| 265 | otg_init(musb->xceiv); | 266 | otg_init(musb->xceiv); |
| 266 | break; | 267 | break; |
| 267 | 268 | ||
diff --git a/drivers/usb/musb/ux500.c b/drivers/usb/musb/ux500.c index d6384e4aeef9..f7e04bf34a13 100644 --- a/drivers/usb/musb/ux500.c +++ b/drivers/usb/musb/ux500.c | |||
| @@ -93,6 +93,8 @@ static int __init ux500_probe(struct platform_device *pdev) | |||
| 93 | } | 93 | } |
| 94 | 94 | ||
| 95 | musb->dev.parent = &pdev->dev; | 95 | musb->dev.parent = &pdev->dev; |
| 96 | musb->dev.dma_mask = pdev->dev.dma_mask; | ||
| 97 | musb->dev.coherent_dma_mask = pdev->dev.coherent_dma_mask; | ||
| 96 | 98 | ||
| 97 | glue->dev = &pdev->dev; | 99 | glue->dev = &pdev->dev; |
| 98 | glue->musb = musb; | 100 | glue->musb = musb; |
diff --git a/drivers/usb/serial/ftdi_sio.c b/drivers/usb/serial/ftdi_sio.c index a973c7a29d6e..4de6ef0ae52a 100644 --- a/drivers/usb/serial/ftdi_sio.c +++ b/drivers/usb/serial/ftdi_sio.c | |||
| @@ -151,6 +151,8 @@ static struct ftdi_sio_quirk ftdi_stmclite_quirk = { | |||
| 151 | * /sys/bus/usb/ftdi_sio/new_id, then send patch/report! | 151 | * /sys/bus/usb/ftdi_sio/new_id, then send patch/report! |
| 152 | */ | 152 | */ |
| 153 | static struct usb_device_id id_table_combined [] = { | 153 | static struct usb_device_id id_table_combined [] = { |
| 154 | { USB_DEVICE(FTDI_VID, FTDI_CTI_MINI_PID) }, | ||
| 155 | { USB_DEVICE(FTDI_VID, FTDI_CTI_NANO_PID) }, | ||
| 154 | { USB_DEVICE(FTDI_VID, FTDI_AMC232_PID) }, | 156 | { USB_DEVICE(FTDI_VID, FTDI_AMC232_PID) }, |
| 155 | { USB_DEVICE(FTDI_VID, FTDI_CANUSB_PID) }, | 157 | { USB_DEVICE(FTDI_VID, FTDI_CANUSB_PID) }, |
| 156 | { USB_DEVICE(FTDI_VID, FTDI_CANDAPTER_PID) }, | 158 | { USB_DEVICE(FTDI_VID, FTDI_CANDAPTER_PID) }, |
| @@ -525,6 +527,7 @@ static struct usb_device_id id_table_combined [] = { | |||
| 525 | { USB_DEVICE(SEALEVEL_VID, SEALEVEL_2803_8_PID) }, | 527 | { USB_DEVICE(SEALEVEL_VID, SEALEVEL_2803_8_PID) }, |
| 526 | { USB_DEVICE(IDTECH_VID, IDTECH_IDT1221U_PID) }, | 528 | { USB_DEVICE(IDTECH_VID, IDTECH_IDT1221U_PID) }, |
| 527 | { USB_DEVICE(OCT_VID, OCT_US101_PID) }, | 529 | { USB_DEVICE(OCT_VID, OCT_US101_PID) }, |
| 530 | { USB_DEVICE(OCT_VID, OCT_DK201_PID) }, | ||
| 528 | { USB_DEVICE(FTDI_VID, FTDI_HE_TIRA1_PID), | 531 | { USB_DEVICE(FTDI_VID, FTDI_HE_TIRA1_PID), |
| 529 | .driver_info = (kernel_ulong_t)&ftdi_HE_TIRA1_quirk }, | 532 | .driver_info = (kernel_ulong_t)&ftdi_HE_TIRA1_quirk }, |
| 530 | { USB_DEVICE(FTDI_VID, FTDI_USB_UIRT_PID), | 533 | { USB_DEVICE(FTDI_VID, FTDI_USB_UIRT_PID), |
| @@ -787,6 +790,8 @@ static struct usb_device_id id_table_combined [] = { | |||
| 787 | { USB_DEVICE(FTDI_VID, MARVELL_OPENRD_PID), | 790 | { USB_DEVICE(FTDI_VID, MARVELL_OPENRD_PID), |
| 788 | .driver_info = (kernel_ulong_t)&ftdi_jtag_quirk }, | 791 | .driver_info = (kernel_ulong_t)&ftdi_jtag_quirk }, |
| 789 | { USB_DEVICE(FTDI_VID, HAMEG_HO820_PID) }, | 792 | { USB_DEVICE(FTDI_VID, HAMEG_HO820_PID) }, |
| 793 | { USB_DEVICE(FTDI_VID, HAMEG_HO720_PID) }, | ||
| 794 | { USB_DEVICE(FTDI_VID, HAMEG_HO730_PID) }, | ||
| 790 | { USB_DEVICE(FTDI_VID, HAMEG_HO870_PID) }, | 795 | { USB_DEVICE(FTDI_VID, HAMEG_HO870_PID) }, |
| 791 | { USB_DEVICE(FTDI_VID, MJSG_GENERIC_PID) }, | 796 | { USB_DEVICE(FTDI_VID, MJSG_GENERIC_PID) }, |
| 792 | { USB_DEVICE(FTDI_VID, MJSG_SR_RADIO_PID) }, | 797 | { USB_DEVICE(FTDI_VID, MJSG_SR_RADIO_PID) }, |
diff --git a/drivers/usb/serial/ftdi_sio_ids.h b/drivers/usb/serial/ftdi_sio_ids.h index c543e55bafba..efffc23723bd 100644 --- a/drivers/usb/serial/ftdi_sio_ids.h +++ b/drivers/usb/serial/ftdi_sio_ids.h | |||
| @@ -300,6 +300,8 @@ | |||
| 300 | * Hameg HO820 and HO870 interface (using VID 0x0403) | 300 | * Hameg HO820 and HO870 interface (using VID 0x0403) |
| 301 | */ | 301 | */ |
| 302 | #define HAMEG_HO820_PID 0xed74 | 302 | #define HAMEG_HO820_PID 0xed74 |
| 303 | #define HAMEG_HO730_PID 0xed73 | ||
| 304 | #define HAMEG_HO720_PID 0xed72 | ||
| 303 | #define HAMEG_HO870_PID 0xed71 | 305 | #define HAMEG_HO870_PID 0xed71 |
| 304 | 306 | ||
| 305 | /* | 307 | /* |
| @@ -572,6 +574,7 @@ | |||
| 572 | /* Note: OCT US101 is also rebadged as Dick Smith Electronics (NZ) XH6381 */ | 574 | /* Note: OCT US101 is also rebadged as Dick Smith Electronics (NZ) XH6381 */ |
| 573 | /* Also rebadged as Dick Smith Electronics (Aus) XH6451 */ | 575 | /* Also rebadged as Dick Smith Electronics (Aus) XH6451 */ |
| 574 | /* Also rebadged as SIIG Inc. model US2308 hardware version 1 */ | 576 | /* Also rebadged as SIIG Inc. model US2308 hardware version 1 */ |
| 577 | #define OCT_DK201_PID 0x0103 /* OCT DK201 USB docking station */ | ||
| 575 | #define OCT_US101_PID 0x0421 /* OCT US101 USB to RS-232 */ | 578 | #define OCT_US101_PID 0x0421 /* OCT US101 USB to RS-232 */ |
| 576 | 579 | ||
| 577 | /* | 580 | /* |
| @@ -1141,3 +1144,12 @@ | |||
| 1141 | #define QIHARDWARE_VID 0x20B7 | 1144 | #define QIHARDWARE_VID 0x20B7 |
| 1142 | #define MILKYMISTONE_JTAGSERIAL_PID 0x0713 | 1145 | #define MILKYMISTONE_JTAGSERIAL_PID 0x0713 |
| 1143 | 1146 | ||
| 1147 | /* | ||
| 1148 | * CTI GmbH RS485 Converter http://www.cti-lean.com/ | ||
| 1149 | */ | ||
| 1150 | /* USB-485-Mini*/ | ||
| 1151 | #define FTDI_CTI_MINI_PID 0xF608 | ||
| 1152 | /* USB-Nano-485*/ | ||
| 1153 | #define FTDI_CTI_NANO_PID 0xF60B | ||
| 1154 | |||
| 1155 | |||
diff --git a/drivers/usb/serial/option.c b/drivers/usb/serial/option.c index 75c7f456eed5..d77ff0435896 100644 --- a/drivers/usb/serial/option.c +++ b/drivers/usb/serial/option.c | |||
| @@ -407,6 +407,10 @@ static void option_instat_callback(struct urb *urb); | |||
| 407 | /* ONDA MT825UP HSDPA 14.2 modem */ | 407 | /* ONDA MT825UP HSDPA 14.2 modem */ |
| 408 | #define ONDA_MT825UP 0x000b | 408 | #define ONDA_MT825UP 0x000b |
| 409 | 409 | ||
| 410 | /* Samsung products */ | ||
| 411 | #define SAMSUNG_VENDOR_ID 0x04e8 | ||
| 412 | #define SAMSUNG_PRODUCT_GT_B3730 0x6889 | ||
| 413 | |||
| 410 | /* some devices interfaces need special handling due to a number of reasons */ | 414 | /* some devices interfaces need special handling due to a number of reasons */ |
| 411 | enum option_blacklist_reason { | 415 | enum option_blacklist_reason { |
| 412 | OPTION_BLACKLIST_NONE = 0, | 416 | OPTION_BLACKLIST_NONE = 0, |
| @@ -968,6 +972,7 @@ static const struct usb_device_id option_ids[] = { | |||
| 968 | { USB_DEVICE(OLIVETTI_VENDOR_ID, OLIVETTI_PRODUCT_OLICARD100) }, | 972 | { USB_DEVICE(OLIVETTI_VENDOR_ID, OLIVETTI_PRODUCT_OLICARD100) }, |
| 969 | { USB_DEVICE(CELOT_VENDOR_ID, CELOT_PRODUCT_CT680M) }, /* CT-650 CDMA 450 1xEVDO modem */ | 973 | { USB_DEVICE(CELOT_VENDOR_ID, CELOT_PRODUCT_CT680M) }, /* CT-650 CDMA 450 1xEVDO modem */ |
| 970 | { USB_DEVICE(ONDA_VENDOR_ID, ONDA_MT825UP) }, /* ONDA MT825UP modem */ | 974 | { USB_DEVICE(ONDA_VENDOR_ID, ONDA_MT825UP) }, /* ONDA MT825UP modem */ |
| 975 | { USB_DEVICE_AND_INTERFACE_INFO(SAMSUNG_VENDOR_ID, SAMSUNG_PRODUCT_GT_B3730, USB_CLASS_CDC_DATA, 0x00, 0x00) }, /* Samsung GT-B3730/GT-B3710 LTE USB modem.*/ | ||
| 971 | { } /* Terminating entry */ | 976 | { } /* Terminating entry */ |
| 972 | }; | 977 | }; |
| 973 | MODULE_DEVICE_TABLE(usb, option_ids); | 978 | MODULE_DEVICE_TABLE(usb, option_ids); |
diff --git a/drivers/usb/serial/qcserial.c b/drivers/usb/serial/qcserial.c index 8858201eb1d3..54a9dab1f33b 100644 --- a/drivers/usb/serial/qcserial.c +++ b/drivers/usb/serial/qcserial.c | |||
| @@ -111,7 +111,7 @@ static int qcprobe(struct usb_serial *serial, const struct usb_device_id *id) | |||
| 111 | ifnum = intf->desc.bInterfaceNumber; | 111 | ifnum = intf->desc.bInterfaceNumber; |
| 112 | dbg("This Interface = %d", ifnum); | 112 | dbg("This Interface = %d", ifnum); |
| 113 | 113 | ||
| 114 | data = serial->private = kzalloc(sizeof(struct usb_wwan_intf_private), | 114 | data = kzalloc(sizeof(struct usb_wwan_intf_private), |
| 115 | GFP_KERNEL); | 115 | GFP_KERNEL); |
| 116 | if (!data) | 116 | if (!data) |
| 117 | return -ENOMEM; | 117 | return -ENOMEM; |
| @@ -134,8 +134,10 @@ static int qcprobe(struct usb_serial *serial, const struct usb_device_id *id) | |||
| 134 | usb_endpoint_is_bulk_out(&intf->endpoint[1].desc)) { | 134 | usb_endpoint_is_bulk_out(&intf->endpoint[1].desc)) { |
| 135 | dbg("QDL port found"); | 135 | dbg("QDL port found"); |
| 136 | 136 | ||
| 137 | if (serial->interface->num_altsetting == 1) | 137 | if (serial->interface->num_altsetting == 1) { |
| 138 | return 0; | 138 | retval = 0; /* Success */ |
| 139 | break; | ||
| 140 | } | ||
| 139 | 141 | ||
| 140 | retval = usb_set_interface(serial->dev, ifnum, 1); | 142 | retval = usb_set_interface(serial->dev, ifnum, 1); |
| 141 | if (retval < 0) { | 143 | if (retval < 0) { |
| @@ -145,7 +147,6 @@ static int qcprobe(struct usb_serial *serial, const struct usb_device_id *id) | |||
| 145 | retval = -ENODEV; | 147 | retval = -ENODEV; |
| 146 | kfree(data); | 148 | kfree(data); |
| 147 | } | 149 | } |
| 148 | return retval; | ||
| 149 | } | 150 | } |
| 150 | break; | 151 | break; |
| 151 | 152 | ||
| @@ -166,6 +167,7 @@ static int qcprobe(struct usb_serial *serial, const struct usb_device_id *id) | |||
| 166 | "Could not set interface, error %d\n", | 167 | "Could not set interface, error %d\n", |
| 167 | retval); | 168 | retval); |
| 168 | retval = -ENODEV; | 169 | retval = -ENODEV; |
| 170 | kfree(data); | ||
| 169 | } | 171 | } |
| 170 | } else if (ifnum == 2) { | 172 | } else if (ifnum == 2) { |
| 171 | dbg("Modem port found"); | 173 | dbg("Modem port found"); |
| @@ -177,7 +179,6 @@ static int qcprobe(struct usb_serial *serial, const struct usb_device_id *id) | |||
| 177 | retval = -ENODEV; | 179 | retval = -ENODEV; |
| 178 | kfree(data); | 180 | kfree(data); |
| 179 | } | 181 | } |
| 180 | return retval; | ||
| 181 | } else if (ifnum==3) { | 182 | } else if (ifnum==3) { |
| 182 | /* | 183 | /* |
| 183 | * NMEA (serial line 9600 8N1) | 184 | * NMEA (serial line 9600 8N1) |
| @@ -191,6 +192,7 @@ static int qcprobe(struct usb_serial *serial, const struct usb_device_id *id) | |||
| 191 | "Could not set interface, error %d\n", | 192 | "Could not set interface, error %d\n", |
| 192 | retval); | 193 | retval); |
| 193 | retval = -ENODEV; | 194 | retval = -ENODEV; |
| 195 | kfree(data); | ||
| 194 | } | 196 | } |
| 195 | } | 197 | } |
| 196 | break; | 198 | break; |
| @@ -199,12 +201,27 @@ static int qcprobe(struct usb_serial *serial, const struct usb_device_id *id) | |||
| 199 | dev_err(&serial->dev->dev, | 201 | dev_err(&serial->dev->dev, |
| 200 | "unknown number of interfaces: %d\n", nintf); | 202 | "unknown number of interfaces: %d\n", nintf); |
| 201 | kfree(data); | 203 | kfree(data); |
| 202 | return -ENODEV; | 204 | retval = -ENODEV; |
| 203 | } | 205 | } |
| 204 | 206 | ||
| 207 | /* Set serial->private if not returning -ENODEV */ | ||
| 208 | if (retval != -ENODEV) | ||
| 209 | usb_set_serial_data(serial, data); | ||
| 205 | return retval; | 210 | return retval; |
| 206 | } | 211 | } |
| 207 | 212 | ||
| 213 | static void qc_release(struct usb_serial *serial) | ||
| 214 | { | ||
| 215 | struct usb_wwan_intf_private *priv = usb_get_serial_data(serial); | ||
| 216 | |||
| 217 | dbg("%s", __func__); | ||
| 218 | |||
| 219 | /* Call usb_wwan release & free the private data allocated in qcprobe */ | ||
| 220 | usb_wwan_release(serial); | ||
| 221 | usb_set_serial_data(serial, NULL); | ||
| 222 | kfree(priv); | ||
| 223 | } | ||
| 224 | |||
| 208 | static struct usb_serial_driver qcdevice = { | 225 | static struct usb_serial_driver qcdevice = { |
| 209 | .driver = { | 226 | .driver = { |
| 210 | .owner = THIS_MODULE, | 227 | .owner = THIS_MODULE, |
| @@ -222,7 +239,7 @@ static struct usb_serial_driver qcdevice = { | |||
| 222 | .chars_in_buffer = usb_wwan_chars_in_buffer, | 239 | .chars_in_buffer = usb_wwan_chars_in_buffer, |
| 223 | .attach = usb_wwan_startup, | 240 | .attach = usb_wwan_startup, |
| 224 | .disconnect = usb_wwan_disconnect, | 241 | .disconnect = usb_wwan_disconnect, |
| 225 | .release = usb_wwan_release, | 242 | .release = qc_release, |
| 226 | #ifdef CONFIG_PM | 243 | #ifdef CONFIG_PM |
| 227 | .suspend = usb_wwan_suspend, | 244 | .suspend = usb_wwan_suspend, |
| 228 | .resume = usb_wwan_resume, | 245 | .resume = usb_wwan_resume, |
diff --git a/drivers/video/pxafb.c b/drivers/video/pxafb.c index a2e5b5100ab4..0f4e8c942f9e 100644 --- a/drivers/video/pxafb.c +++ b/drivers/video/pxafb.c | |||
| @@ -1648,7 +1648,9 @@ pxafb_freq_transition(struct notifier_block *nb, unsigned long val, void *data) | |||
| 1648 | 1648 | ||
| 1649 | switch (val) { | 1649 | switch (val) { |
| 1650 | case CPUFREQ_PRECHANGE: | 1650 | case CPUFREQ_PRECHANGE: |
| 1651 | if (!fbi->overlay[0].usage && !fbi->overlay[1].usage) | 1651 | #ifdef CONFIG_FB_PXA_OVERLAY |
| 1652 | if (!(fbi->overlay[0].usage || fbi->overlay[1].usage)) | ||
| 1653 | #endif | ||
| 1652 | set_ctrlr_state(fbi, C_DISABLE_CLKCHANGE); | 1654 | set_ctrlr_state(fbi, C_DISABLE_CLKCHANGE); |
| 1653 | break; | 1655 | break; |
| 1654 | 1656 | ||
diff --git a/drivers/virtio/virtio_pci.c b/drivers/virtio/virtio_pci.c index 4fb5b2bf2348..4bcc8b82640b 100644 --- a/drivers/virtio/virtio_pci.c +++ b/drivers/virtio/virtio_pci.c | |||
| @@ -590,15 +590,10 @@ static struct virtio_config_ops virtio_pci_config_ops = { | |||
| 590 | 590 | ||
| 591 | static void virtio_pci_release_dev(struct device *_d) | 591 | static void virtio_pci_release_dev(struct device *_d) |
| 592 | { | 592 | { |
| 593 | struct virtio_device *dev = container_of(_d, struct virtio_device, dev); | 593 | struct virtio_device *dev = container_of(_d, struct virtio_device, |
| 594 | dev); | ||
| 594 | struct virtio_pci_device *vp_dev = to_vp_device(dev); | 595 | struct virtio_pci_device *vp_dev = to_vp_device(dev); |
| 595 | struct pci_dev *pci_dev = vp_dev->pci_dev; | ||
| 596 | 596 | ||
| 597 | vp_del_vqs(dev); | ||
| 598 | pci_set_drvdata(pci_dev, NULL); | ||
| 599 | pci_iounmap(pci_dev, vp_dev->ioaddr); | ||
| 600 | pci_release_regions(pci_dev); | ||
| 601 | pci_disable_device(pci_dev); | ||
| 602 | kfree(vp_dev); | 597 | kfree(vp_dev); |
| 603 | } | 598 | } |
| 604 | 599 | ||
| @@ -681,6 +676,12 @@ static void __devexit virtio_pci_remove(struct pci_dev *pci_dev) | |||
| 681 | struct virtio_pci_device *vp_dev = pci_get_drvdata(pci_dev); | 676 | struct virtio_pci_device *vp_dev = pci_get_drvdata(pci_dev); |
| 682 | 677 | ||
| 683 | unregister_virtio_device(&vp_dev->vdev); | 678 | unregister_virtio_device(&vp_dev->vdev); |
| 679 | |||
| 680 | vp_del_vqs(&vp_dev->vdev); | ||
| 681 | pci_set_drvdata(pci_dev, NULL); | ||
| 682 | pci_iounmap(pci_dev, vp_dev->ioaddr); | ||
| 683 | pci_release_regions(pci_dev); | ||
| 684 | pci_disable_device(pci_dev); | ||
| 684 | } | 685 | } |
| 685 | 686 | ||
| 686 | #ifdef CONFIG_PM | 687 | #ifdef CONFIG_PM |
diff --git a/drivers/virtio/virtio_ring.c b/drivers/virtio/virtio_ring.c index cc2f73e03475..b0043fb26a4d 100644 --- a/drivers/virtio/virtio_ring.c +++ b/drivers/virtio/virtio_ring.c | |||
| @@ -371,6 +371,7 @@ void *virtqueue_detach_unused_buf(struct virtqueue *_vq) | |||
| 371 | /* detach_buf clears data, so grab it now. */ | 371 | /* detach_buf clears data, so grab it now. */ |
| 372 | buf = vq->data[i]; | 372 | buf = vq->data[i]; |
| 373 | detach_buf(vq, i); | 373 | detach_buf(vq, i); |
| 374 | vq->vring.avail->idx--; | ||
| 374 | END_USE(vq); | 375 | END_USE(vq); |
| 375 | return buf; | 376 | return buf; |
| 376 | } | 377 | } |
diff --git a/drivers/xen/events.c b/drivers/xen/events.c index 42d6c930cc87..33167b43ac7e 100644 --- a/drivers/xen/events.c +++ b/drivers/xen/events.c | |||
| @@ -912,8 +912,7 @@ int bind_evtchn_to_irqhandler(unsigned int evtchn, | |||
| 912 | unsigned long irqflags, | 912 | unsigned long irqflags, |
| 913 | const char *devname, void *dev_id) | 913 | const char *devname, void *dev_id) |
| 914 | { | 914 | { |
| 915 | unsigned int irq; | 915 | int irq, retval; |
| 916 | int retval; | ||
| 917 | 916 | ||
| 918 | irq = bind_evtchn_to_irq(evtchn); | 917 | irq = bind_evtchn_to_irq(evtchn); |
| 919 | if (irq < 0) | 918 | if (irq < 0) |
| @@ -955,8 +954,7 @@ int bind_virq_to_irqhandler(unsigned int virq, unsigned int cpu, | |||
| 955 | irq_handler_t handler, | 954 | irq_handler_t handler, |
| 956 | unsigned long irqflags, const char *devname, void *dev_id) | 955 | unsigned long irqflags, const char *devname, void *dev_id) |
| 957 | { | 956 | { |
| 958 | unsigned int irq; | 957 | int irq, retval; |
| 959 | int retval; | ||
| 960 | 958 | ||
| 961 | irq = bind_virq_to_irq(virq, cpu); | 959 | irq = bind_virq_to_irq(virq, cpu); |
| 962 | if (irq < 0) | 960 | if (irq < 0) |
diff --git a/drivers/xen/manage.c b/drivers/xen/manage.c index 95143dd6904d..1ac94125bf93 100644 --- a/drivers/xen/manage.c +++ b/drivers/xen/manage.c | |||
| @@ -61,7 +61,7 @@ static void xen_post_suspend(int cancelled) | |||
| 61 | xen_mm_unpin_all(); | 61 | xen_mm_unpin_all(); |
| 62 | } | 62 | } |
| 63 | 63 | ||
| 64 | #ifdef CONFIG_HIBERNATION | 64 | #ifdef CONFIG_HIBERNATE_CALLBACKS |
| 65 | static int xen_suspend(void *data) | 65 | static int xen_suspend(void *data) |
| 66 | { | 66 | { |
| 67 | struct suspend_info *si = data; | 67 | struct suspend_info *si = data; |
| @@ -173,7 +173,7 @@ out: | |||
| 173 | #endif | 173 | #endif |
| 174 | shutting_down = SHUTDOWN_INVALID; | 174 | shutting_down = SHUTDOWN_INVALID; |
| 175 | } | 175 | } |
| 176 | #endif /* CONFIG_HIBERNATION */ | 176 | #endif /* CONFIG_HIBERNATE_CALLBACKS */ |
| 177 | 177 | ||
| 178 | struct shutdown_handler { | 178 | struct shutdown_handler { |
| 179 | const char *command; | 179 | const char *command; |
| @@ -202,7 +202,7 @@ static void shutdown_handler(struct xenbus_watch *watch, | |||
| 202 | { "poweroff", do_poweroff }, | 202 | { "poweroff", do_poweroff }, |
| 203 | { "halt", do_poweroff }, | 203 | { "halt", do_poweroff }, |
| 204 | { "reboot", do_reboot }, | 204 | { "reboot", do_reboot }, |
| 205 | #ifdef CONFIG_HIBERNATION | 205 | #ifdef CONFIG_HIBERNATE_CALLBACKS |
| 206 | { "suspend", do_suspend }, | 206 | { "suspend", do_suspend }, |
| 207 | #endif | 207 | #endif |
| 208 | {NULL, NULL}, | 208 | {NULL, NULL}, |
