diff options
Diffstat (limited to 'drivers')
120 files changed, 1329 insertions, 788 deletions
diff --git a/drivers/acpi/acpi_processor.c b/drivers/acpi/acpi_processor.c index fd6c51cc3acb..5a74a9c1e42c 100644 --- a/drivers/acpi/acpi_processor.c +++ b/drivers/acpi/acpi_processor.c | |||
@@ -451,7 +451,6 @@ static void acpi_processor_remove(struct acpi_device *device) | |||
451 | /* Clean up. */ | 451 | /* Clean up. */ |
452 | per_cpu(processor_device_array, pr->id) = NULL; | 452 | per_cpu(processor_device_array, pr->id) = NULL; |
453 | per_cpu(processors, pr->id) = NULL; | 453 | per_cpu(processors, pr->id) = NULL; |
454 | try_offline_node(cpu_to_node(pr->id)); | ||
455 | 454 | ||
456 | /* Remove the CPU. */ | 455 | /* Remove the CPU. */ |
457 | get_online_cpus(); | 456 | get_online_cpus(); |
@@ -459,6 +458,8 @@ static void acpi_processor_remove(struct acpi_device *device) | |||
459 | acpi_unmap_lsapic(pr->id); | 458 | acpi_unmap_lsapic(pr->id); |
460 | put_online_cpus(); | 459 | put_online_cpus(); |
461 | 460 | ||
461 | try_offline_node(cpu_to_node(pr->id)); | ||
462 | |||
462 | out: | 463 | out: |
463 | free_cpumask_var(pr->throttling.shared_cpu_map); | 464 | free_cpumask_var(pr->throttling.shared_cpu_map); |
464 | kfree(pr); | 465 | kfree(pr); |
diff --git a/drivers/acpi/glue.c b/drivers/acpi/glue.c index f68095756fb7..408f6b2a5fa8 100644 --- a/drivers/acpi/glue.c +++ b/drivers/acpi/glue.c | |||
@@ -31,6 +31,7 @@ static LIST_HEAD(bus_type_list); | |||
31 | static DECLARE_RWSEM(bus_type_sem); | 31 | static DECLARE_RWSEM(bus_type_sem); |
32 | 32 | ||
33 | #define PHYSICAL_NODE_STRING "physical_node" | 33 | #define PHYSICAL_NODE_STRING "physical_node" |
34 | #define PHYSICAL_NODE_NAME_SIZE (sizeof(PHYSICAL_NODE_STRING) + 10) | ||
34 | 35 | ||
35 | int register_acpi_bus_type(struct acpi_bus_type *type) | 36 | int register_acpi_bus_type(struct acpi_bus_type *type) |
36 | { | 37 | { |
@@ -78,41 +79,108 @@ static struct acpi_bus_type *acpi_get_bus_type(struct device *dev) | |||
78 | return ret; | 79 | return ret; |
79 | } | 80 | } |
80 | 81 | ||
81 | static acpi_status do_acpi_find_child(acpi_handle handle, u32 lvl_not_used, | 82 | static acpi_status acpi_dev_present(acpi_handle handle, u32 lvl_not_used, |
82 | void *addr_p, void **ret_p) | 83 | void *not_used, void **ret_p) |
83 | { | 84 | { |
84 | unsigned long long addr, sta; | 85 | struct acpi_device *adev = NULL; |
85 | acpi_status status; | ||
86 | 86 | ||
87 | status = acpi_evaluate_integer(handle, METHOD_NAME__ADR, NULL, &addr); | 87 | acpi_bus_get_device(handle, &adev); |
88 | if (ACPI_SUCCESS(status) && addr == *((u64 *)addr_p)) { | 88 | if (adev) { |
89 | *ret_p = handle; | 89 | *ret_p = handle; |
90 | status = acpi_bus_get_status_handle(handle, &sta); | 90 | return AE_CTRL_TERMINATE; |
91 | if (ACPI_SUCCESS(status) && (sta & ACPI_STA_DEVICE_ENABLED)) | ||
92 | return AE_CTRL_TERMINATE; | ||
93 | } | 91 | } |
94 | return AE_OK; | 92 | return AE_OK; |
95 | } | 93 | } |
96 | 94 | ||
97 | acpi_handle acpi_get_child(acpi_handle parent, u64 address) | 95 | static bool acpi_extra_checks_passed(acpi_handle handle, bool is_bridge) |
98 | { | 96 | { |
99 | void *ret = NULL; | 97 | unsigned long long sta; |
98 | acpi_status status; | ||
99 | |||
100 | status = acpi_bus_get_status_handle(handle, &sta); | ||
101 | if (ACPI_FAILURE(status) || !(sta & ACPI_STA_DEVICE_ENABLED)) | ||
102 | return false; | ||
103 | |||
104 | if (is_bridge) { | ||
105 | void *test = NULL; | ||
106 | |||
107 | /* Check if this object has at least one child device. */ | ||
108 | acpi_walk_namespace(ACPI_TYPE_DEVICE, handle, 1, | ||
109 | acpi_dev_present, NULL, NULL, &test); | ||
110 | return !!test; | ||
111 | } | ||
112 | return true; | ||
113 | } | ||
114 | |||
115 | struct find_child_context { | ||
116 | u64 addr; | ||
117 | bool is_bridge; | ||
118 | acpi_handle ret; | ||
119 | bool ret_checked; | ||
120 | }; | ||
121 | |||
122 | static acpi_status do_find_child(acpi_handle handle, u32 lvl_not_used, | ||
123 | void *data, void **not_used) | ||
124 | { | ||
125 | struct find_child_context *context = data; | ||
126 | unsigned long long addr; | ||
127 | acpi_status status; | ||
100 | 128 | ||
101 | if (!parent) | 129 | status = acpi_evaluate_integer(handle, METHOD_NAME__ADR, NULL, &addr); |
102 | return NULL; | 130 | if (ACPI_FAILURE(status) || addr != context->addr) |
131 | return AE_OK; | ||
103 | 132 | ||
104 | acpi_walk_namespace(ACPI_TYPE_DEVICE, parent, 1, NULL, | 133 | if (!context->ret) { |
105 | do_acpi_find_child, &address, &ret); | 134 | /* This is the first matching object. Save its handle. */ |
106 | return (acpi_handle)ret; | 135 | context->ret = handle; |
136 | return AE_OK; | ||
137 | } | ||
138 | /* | ||
139 | * There is more than one matching object with the same _ADR value. | ||
140 | * That really is unexpected, so we are kind of beyond the scope of the | ||
141 | * spec here. We have to choose which one to return, though. | ||
142 | * | ||
143 | * First, check if the previously found object is good enough and return | ||
144 | * its handle if so. Second, check the same for the object that we've | ||
145 | * just found. | ||
146 | */ | ||
147 | if (!context->ret_checked) { | ||
148 | if (acpi_extra_checks_passed(context->ret, context->is_bridge)) | ||
149 | return AE_CTRL_TERMINATE; | ||
150 | else | ||
151 | context->ret_checked = true; | ||
152 | } | ||
153 | if (acpi_extra_checks_passed(handle, context->is_bridge)) { | ||
154 | context->ret = handle; | ||
155 | return AE_CTRL_TERMINATE; | ||
156 | } | ||
157 | return AE_OK; | ||
107 | } | 158 | } |
108 | EXPORT_SYMBOL(acpi_get_child); | 159 | |
160 | acpi_handle acpi_find_child(acpi_handle parent, u64 addr, bool is_bridge) | ||
161 | { | ||
162 | if (parent) { | ||
163 | struct find_child_context context = { | ||
164 | .addr = addr, | ||
165 | .is_bridge = is_bridge, | ||
166 | }; | ||
167 | |||
168 | acpi_walk_namespace(ACPI_TYPE_DEVICE, parent, 1, do_find_child, | ||
169 | NULL, &context, NULL); | ||
170 | return context.ret; | ||
171 | } | ||
172 | return NULL; | ||
173 | } | ||
174 | EXPORT_SYMBOL_GPL(acpi_find_child); | ||
109 | 175 | ||
110 | int acpi_bind_one(struct device *dev, acpi_handle handle) | 176 | int acpi_bind_one(struct device *dev, acpi_handle handle) |
111 | { | 177 | { |
112 | struct acpi_device *acpi_dev; | 178 | struct acpi_device *acpi_dev; |
113 | acpi_status status; | 179 | acpi_status status; |
114 | struct acpi_device_physical_node *physical_node, *pn; | 180 | struct acpi_device_physical_node *physical_node, *pn; |
115 | char physical_node_name[sizeof(PHYSICAL_NODE_STRING) + 2]; | 181 | char physical_node_name[PHYSICAL_NODE_NAME_SIZE]; |
182 | struct list_head *physnode_list; | ||
183 | unsigned int node_id; | ||
116 | int retval = -EINVAL; | 184 | int retval = -EINVAL; |
117 | 185 | ||
118 | if (ACPI_HANDLE(dev)) { | 186 | if (ACPI_HANDLE(dev)) { |
@@ -139,25 +207,27 @@ int acpi_bind_one(struct device *dev, acpi_handle handle) | |||
139 | 207 | ||
140 | mutex_lock(&acpi_dev->physical_node_lock); | 208 | mutex_lock(&acpi_dev->physical_node_lock); |
141 | 209 | ||
142 | /* Sanity check. */ | 210 | /* |
143 | list_for_each_entry(pn, &acpi_dev->physical_node_list, node) | 211 | * Keep the list sorted by node_id so that the IDs of removed nodes can |
212 | * be recycled easily. | ||
213 | */ | ||
214 | physnode_list = &acpi_dev->physical_node_list; | ||
215 | node_id = 0; | ||
216 | list_for_each_entry(pn, &acpi_dev->physical_node_list, node) { | ||
217 | /* Sanity check. */ | ||
144 | if (pn->dev == dev) { | 218 | if (pn->dev == dev) { |
145 | dev_warn(dev, "Already associated with ACPI node\n"); | 219 | dev_warn(dev, "Already associated with ACPI node\n"); |
146 | goto err_free; | 220 | goto err_free; |
147 | } | 221 | } |
148 | 222 | if (pn->node_id == node_id) { | |
149 | /* allocate physical node id according to physical_node_id_bitmap */ | 223 | physnode_list = &pn->node; |
150 | physical_node->node_id = | 224 | node_id++; |
151 | find_first_zero_bit(acpi_dev->physical_node_id_bitmap, | 225 | } |
152 | ACPI_MAX_PHYSICAL_NODE); | ||
153 | if (physical_node->node_id >= ACPI_MAX_PHYSICAL_NODE) { | ||
154 | retval = -ENOSPC; | ||
155 | goto err_free; | ||
156 | } | 226 | } |
157 | 227 | ||
158 | set_bit(physical_node->node_id, acpi_dev->physical_node_id_bitmap); | 228 | physical_node->node_id = node_id; |
159 | physical_node->dev = dev; | 229 | physical_node->dev = dev; |
160 | list_add_tail(&physical_node->node, &acpi_dev->physical_node_list); | 230 | list_add(&physical_node->node, physnode_list); |
161 | acpi_dev->physical_node_count++; | 231 | acpi_dev->physical_node_count++; |
162 | 232 | ||
163 | mutex_unlock(&acpi_dev->physical_node_lock); | 233 | mutex_unlock(&acpi_dev->physical_node_lock); |
@@ -208,7 +278,7 @@ int acpi_unbind_one(struct device *dev) | |||
208 | 278 | ||
209 | mutex_lock(&acpi_dev->physical_node_lock); | 279 | mutex_lock(&acpi_dev->physical_node_lock); |
210 | list_for_each_safe(node, next, &acpi_dev->physical_node_list) { | 280 | list_for_each_safe(node, next, &acpi_dev->physical_node_list) { |
211 | char physical_node_name[sizeof(PHYSICAL_NODE_STRING) + 2]; | 281 | char physical_node_name[PHYSICAL_NODE_NAME_SIZE]; |
212 | 282 | ||
213 | entry = list_entry(node, struct acpi_device_physical_node, | 283 | entry = list_entry(node, struct acpi_device_physical_node, |
214 | node); | 284 | node); |
@@ -216,7 +286,6 @@ int acpi_unbind_one(struct device *dev) | |||
216 | continue; | 286 | continue; |
217 | 287 | ||
218 | list_del(node); | 288 | list_del(node); |
219 | clear_bit(entry->node_id, acpi_dev->physical_node_id_bitmap); | ||
220 | 289 | ||
221 | acpi_dev->physical_node_count--; | 290 | acpi_dev->physical_node_count--; |
222 | 291 | ||
diff --git a/drivers/acpi/proc.c b/drivers/acpi/proc.c index aa1227a7e3f2..04a13784dd20 100644 --- a/drivers/acpi/proc.c +++ b/drivers/acpi/proc.c | |||
@@ -311,6 +311,8 @@ acpi_system_wakeup_device_seq_show(struct seq_file *seq, void *offset) | |||
311 | dev->pnp.bus_id, | 311 | dev->pnp.bus_id, |
312 | (u32) dev->wakeup.sleep_state); | 312 | (u32) dev->wakeup.sleep_state); |
313 | 313 | ||
314 | mutex_lock(&dev->physical_node_lock); | ||
315 | |||
314 | if (!dev->physical_node_count) { | 316 | if (!dev->physical_node_count) { |
315 | seq_printf(seq, "%c%-8s\n", | 317 | seq_printf(seq, "%c%-8s\n", |
316 | dev->wakeup.flags.run_wake ? '*' : ' ', | 318 | dev->wakeup.flags.run_wake ? '*' : ' ', |
@@ -338,6 +340,8 @@ acpi_system_wakeup_device_seq_show(struct seq_file *seq, void *offset) | |||
338 | put_device(ldev); | 340 | put_device(ldev); |
339 | } | 341 | } |
340 | } | 342 | } |
343 | |||
344 | mutex_unlock(&dev->physical_node_lock); | ||
341 | } | 345 | } |
342 | mutex_unlock(&acpi_device_lock); | 346 | mutex_unlock(&acpi_device_lock); |
343 | return 0; | 347 | return 0; |
@@ -347,12 +351,16 @@ static void physical_device_enable_wakeup(struct acpi_device *adev) | |||
347 | { | 351 | { |
348 | struct acpi_device_physical_node *entry; | 352 | struct acpi_device_physical_node *entry; |
349 | 353 | ||
354 | mutex_lock(&adev->physical_node_lock); | ||
355 | |||
350 | list_for_each_entry(entry, | 356 | list_for_each_entry(entry, |
351 | &adev->physical_node_list, node) | 357 | &adev->physical_node_list, node) |
352 | if (entry->dev && device_can_wakeup(entry->dev)) { | 358 | if (entry->dev && device_can_wakeup(entry->dev)) { |
353 | bool enable = !device_may_wakeup(entry->dev); | 359 | bool enable = !device_may_wakeup(entry->dev); |
354 | device_set_wakeup_enable(entry->dev, enable); | 360 | device_set_wakeup_enable(entry->dev, enable); |
355 | } | 361 | } |
362 | |||
363 | mutex_unlock(&adev->physical_node_lock); | ||
356 | } | 364 | } |
357 | 365 | ||
358 | static ssize_t | 366 | static ssize_t |
diff --git a/drivers/acpi/video.c b/drivers/acpi/video.c index 0ec434d2586d..e1284b8dc6ee 100644 --- a/drivers/acpi/video.c +++ b/drivers/acpi/video.c | |||
@@ -689,7 +689,7 @@ static int acpi_video_bqc_quirk(struct acpi_video_device *device, | |||
689 | * Some systems always report current brightness level as maximum | 689 | * Some systems always report current brightness level as maximum |
690 | * through _BQC, we need to test another value for them. | 690 | * through _BQC, we need to test another value for them. |
691 | */ | 691 | */ |
692 | test_level = current_level == max_level ? br->levels[2] : max_level; | 692 | test_level = current_level == max_level ? br->levels[3] : max_level; |
693 | 693 | ||
694 | result = acpi_video_device_lcd_set_level(device, test_level); | 694 | result = acpi_video_device_lcd_set_level(device, test_level); |
695 | if (result) | 695 | if (result) |
diff --git a/drivers/ata/pata_imx.c b/drivers/ata/pata_imx.c index 4ec7c04b3f82..26386f0b89a8 100644 --- a/drivers/ata/pata_imx.c +++ b/drivers/ata/pata_imx.c | |||
@@ -237,6 +237,7 @@ static const struct of_device_id imx_pata_dt_ids[] = { | |||
237 | /* sentinel */ | 237 | /* sentinel */ |
238 | } | 238 | } |
239 | }; | 239 | }; |
240 | MODULE_DEVICE_TABLE(of, imx_pata_dt_ids); | ||
240 | 241 | ||
241 | static struct platform_driver pata_imx_driver = { | 242 | static struct platform_driver pata_imx_driver = { |
242 | .probe = pata_imx_probe, | 243 | .probe = pata_imx_probe, |
diff --git a/drivers/base/regmap/regcache.c b/drivers/base/regmap/regcache.c index e69102696533..3455f833e473 100644 --- a/drivers/base/regmap/regcache.c +++ b/drivers/base/regmap/regcache.c | |||
@@ -719,7 +719,8 @@ static int regcache_sync_block_raw(struct regmap *map, void *block, | |||
719 | } | 719 | } |
720 | } | 720 | } |
721 | 721 | ||
722 | return regcache_sync_block_raw_flush(map, &data, base, regtmp); | 722 | return regcache_sync_block_raw_flush(map, &data, base, regtmp + |
723 | map->reg_stride); | ||
723 | } | 724 | } |
724 | 725 | ||
725 | int regcache_sync_block(struct regmap *map, void *block, | 726 | int regcache_sync_block(struct regmap *map, void *block, |
diff --git a/drivers/block/aoe/aoecmd.c b/drivers/block/aoe/aoecmd.c index 99cb944a002d..4d45dba7fb8f 100644 --- a/drivers/block/aoe/aoecmd.c +++ b/drivers/block/aoe/aoecmd.c | |||
@@ -906,16 +906,10 @@ bio_pageinc(struct bio *bio) | |||
906 | int i; | 906 | int i; |
907 | 907 | ||
908 | bio_for_each_segment(bv, bio, i) { | 908 | bio_for_each_segment(bv, bio, i) { |
909 | page = bv->bv_page; | ||
910 | /* Non-zero page count for non-head members of | 909 | /* Non-zero page count for non-head members of |
911 | * compound pages is no longer allowed by the kernel, | 910 | * compound pages is no longer allowed by the kernel. |
912 | * but this has never been seen here. | ||
913 | */ | 911 | */ |
914 | if (unlikely(PageCompound(page))) | 912 | page = compound_trans_head(bv->bv_page); |
915 | if (compound_trans_head(page) != page) { | ||
916 | pr_crit("page tail used for block I/O\n"); | ||
917 | BUG(); | ||
918 | } | ||
919 | atomic_inc(&page->_count); | 913 | atomic_inc(&page->_count); |
920 | } | 914 | } |
921 | } | 915 | } |
@@ -924,10 +918,13 @@ static void | |||
924 | bio_pagedec(struct bio *bio) | 918 | bio_pagedec(struct bio *bio) |
925 | { | 919 | { |
926 | struct bio_vec *bv; | 920 | struct bio_vec *bv; |
921 | struct page *page; | ||
927 | int i; | 922 | int i; |
928 | 923 | ||
929 | bio_for_each_segment(bv, bio, i) | 924 | bio_for_each_segment(bv, bio, i) { |
930 | atomic_dec(&bv->bv_page->_count); | 925 | page = compound_trans_head(bv->bv_page); |
926 | atomic_dec(&page->_count); | ||
927 | } | ||
931 | } | 928 | } |
932 | 929 | ||
933 | static void | 930 | static void |
diff --git a/drivers/char/virtio_console.c b/drivers/char/virtio_console.c index 1b456fe9b87a..fc45567ad3ac 100644 --- a/drivers/char/virtio_console.c +++ b/drivers/char/virtio_console.c | |||
@@ -272,9 +272,12 @@ static struct port *find_port_by_devt_in_portdev(struct ports_device *portdev, | |||
272 | unsigned long flags; | 272 | unsigned long flags; |
273 | 273 | ||
274 | spin_lock_irqsave(&portdev->ports_lock, flags); | 274 | spin_lock_irqsave(&portdev->ports_lock, flags); |
275 | list_for_each_entry(port, &portdev->ports, list) | 275 | list_for_each_entry(port, &portdev->ports, list) { |
276 | if (port->cdev->dev == dev) | 276 | if (port->cdev->dev == dev) { |
277 | kref_get(&port->kref); | ||
277 | goto out; | 278 | goto out; |
279 | } | ||
280 | } | ||
278 | port = NULL; | 281 | port = NULL; |
279 | out: | 282 | out: |
280 | spin_unlock_irqrestore(&portdev->ports_lock, flags); | 283 | spin_unlock_irqrestore(&portdev->ports_lock, flags); |
@@ -746,6 +749,10 @@ static ssize_t port_fops_read(struct file *filp, char __user *ubuf, | |||
746 | 749 | ||
747 | port = filp->private_data; | 750 | port = filp->private_data; |
748 | 751 | ||
752 | /* Port is hot-unplugged. */ | ||
753 | if (!port->guest_connected) | ||
754 | return -ENODEV; | ||
755 | |||
749 | if (!port_has_data(port)) { | 756 | if (!port_has_data(port)) { |
750 | /* | 757 | /* |
751 | * If nothing's connected on the host just return 0 in | 758 | * If nothing's connected on the host just return 0 in |
@@ -762,7 +769,7 @@ static ssize_t port_fops_read(struct file *filp, char __user *ubuf, | |||
762 | if (ret < 0) | 769 | if (ret < 0) |
763 | return ret; | 770 | return ret; |
764 | } | 771 | } |
765 | /* Port got hot-unplugged. */ | 772 | /* Port got hot-unplugged while we were waiting above. */ |
766 | if (!port->guest_connected) | 773 | if (!port->guest_connected) |
767 | return -ENODEV; | 774 | return -ENODEV; |
768 | /* | 775 | /* |
@@ -932,13 +939,25 @@ static ssize_t port_fops_splice_write(struct pipe_inode_info *pipe, | |||
932 | if (is_rproc_serial(port->out_vq->vdev)) | 939 | if (is_rproc_serial(port->out_vq->vdev)) |
933 | return -EINVAL; | 940 | return -EINVAL; |
934 | 941 | ||
942 | /* | ||
943 | * pipe->nrbufs == 0 means there are no data to transfer, | ||
944 | * so this returns just 0 for no data. | ||
945 | */ | ||
946 | pipe_lock(pipe); | ||
947 | if (!pipe->nrbufs) { | ||
948 | ret = 0; | ||
949 | goto error_out; | ||
950 | } | ||
951 | |||
935 | ret = wait_port_writable(port, filp->f_flags & O_NONBLOCK); | 952 | ret = wait_port_writable(port, filp->f_flags & O_NONBLOCK); |
936 | if (ret < 0) | 953 | if (ret < 0) |
937 | return ret; | 954 | goto error_out; |
938 | 955 | ||
939 | buf = alloc_buf(port->out_vq, 0, pipe->nrbufs); | 956 | buf = alloc_buf(port->out_vq, 0, pipe->nrbufs); |
940 | if (!buf) | 957 | if (!buf) { |
941 | return -ENOMEM; | 958 | ret = -ENOMEM; |
959 | goto error_out; | ||
960 | } | ||
942 | 961 | ||
943 | sgl.n = 0; | 962 | sgl.n = 0; |
944 | sgl.len = 0; | 963 | sgl.len = 0; |
@@ -946,12 +965,17 @@ static ssize_t port_fops_splice_write(struct pipe_inode_info *pipe, | |||
946 | sgl.sg = buf->sg; | 965 | sgl.sg = buf->sg; |
947 | sg_init_table(sgl.sg, sgl.size); | 966 | sg_init_table(sgl.sg, sgl.size); |
948 | ret = __splice_from_pipe(pipe, &sd, pipe_to_sg); | 967 | ret = __splice_from_pipe(pipe, &sd, pipe_to_sg); |
968 | pipe_unlock(pipe); | ||
949 | if (likely(ret > 0)) | 969 | if (likely(ret > 0)) |
950 | ret = __send_to_port(port, buf->sg, sgl.n, sgl.len, buf, true); | 970 | ret = __send_to_port(port, buf->sg, sgl.n, sgl.len, buf, true); |
951 | 971 | ||
952 | if (unlikely(ret <= 0)) | 972 | if (unlikely(ret <= 0)) |
953 | free_buf(buf, true); | 973 | free_buf(buf, true); |
954 | return ret; | 974 | return ret; |
975 | |||
976 | error_out: | ||
977 | pipe_unlock(pipe); | ||
978 | return ret; | ||
955 | } | 979 | } |
956 | 980 | ||
957 | static unsigned int port_fops_poll(struct file *filp, poll_table *wait) | 981 | static unsigned int port_fops_poll(struct file *filp, poll_table *wait) |
@@ -1019,14 +1043,14 @@ static int port_fops_open(struct inode *inode, struct file *filp) | |||
1019 | struct port *port; | 1043 | struct port *port; |
1020 | int ret; | 1044 | int ret; |
1021 | 1045 | ||
1046 | /* We get the port with a kref here */ | ||
1022 | port = find_port_by_devt(cdev->dev); | 1047 | port = find_port_by_devt(cdev->dev); |
1048 | if (!port) { | ||
1049 | /* Port was unplugged before we could proceed */ | ||
1050 | return -ENXIO; | ||
1051 | } | ||
1023 | filp->private_data = port; | 1052 | filp->private_data = port; |
1024 | 1053 | ||
1025 | /* Prevent against a port getting hot-unplugged at the same time */ | ||
1026 | spin_lock_irq(&port->portdev->ports_lock); | ||
1027 | kref_get(&port->kref); | ||
1028 | spin_unlock_irq(&port->portdev->ports_lock); | ||
1029 | |||
1030 | /* | 1054 | /* |
1031 | * Don't allow opening of console port devices -- that's done | 1055 | * Don't allow opening of console port devices -- that's done |
1032 | * via /dev/hvc | 1056 | * via /dev/hvc |
@@ -1498,14 +1522,6 @@ static void remove_port(struct kref *kref) | |||
1498 | 1522 | ||
1499 | port = container_of(kref, struct port, kref); | 1523 | port = container_of(kref, struct port, kref); |
1500 | 1524 | ||
1501 | sysfs_remove_group(&port->dev->kobj, &port_attribute_group); | ||
1502 | device_destroy(pdrvdata.class, port->dev->devt); | ||
1503 | cdev_del(port->cdev); | ||
1504 | |||
1505 | kfree(port->name); | ||
1506 | |||
1507 | debugfs_remove(port->debugfs_file); | ||
1508 | |||
1509 | kfree(port); | 1525 | kfree(port); |
1510 | } | 1526 | } |
1511 | 1527 | ||
@@ -1539,12 +1555,14 @@ static void unplug_port(struct port *port) | |||
1539 | spin_unlock_irq(&port->portdev->ports_lock); | 1555 | spin_unlock_irq(&port->portdev->ports_lock); |
1540 | 1556 | ||
1541 | if (port->guest_connected) { | 1557 | if (port->guest_connected) { |
1558 | /* Let the app know the port is going down. */ | ||
1559 | send_sigio_to_port(port); | ||
1560 | |||
1561 | /* Do this after sigio is actually sent */ | ||
1542 | port->guest_connected = false; | 1562 | port->guest_connected = false; |
1543 | port->host_connected = false; | 1563 | port->host_connected = false; |
1544 | wake_up_interruptible(&port->waitqueue); | ||
1545 | 1564 | ||
1546 | /* Let the app know the port is going down. */ | 1565 | wake_up_interruptible(&port->waitqueue); |
1547 | send_sigio_to_port(port); | ||
1548 | } | 1566 | } |
1549 | 1567 | ||
1550 | if (is_console_port(port)) { | 1568 | if (is_console_port(port)) { |
@@ -1563,6 +1581,14 @@ static void unplug_port(struct port *port) | |||
1563 | */ | 1581 | */ |
1564 | port->portdev = NULL; | 1582 | port->portdev = NULL; |
1565 | 1583 | ||
1584 | sysfs_remove_group(&port->dev->kobj, &port_attribute_group); | ||
1585 | device_destroy(pdrvdata.class, port->dev->devt); | ||
1586 | cdev_del(port->cdev); | ||
1587 | |||
1588 | kfree(port->name); | ||
1589 | |||
1590 | debugfs_remove(port->debugfs_file); | ||
1591 | |||
1566 | /* | 1592 | /* |
1567 | * Locks around here are not necessary - a port can't be | 1593 | * Locks around here are not necessary - a port can't be |
1568 | * opened after we removed the port struct from ports_list | 1594 | * opened after we removed the port struct from ports_list |
diff --git a/drivers/clk/samsung/clk-exynos4.c b/drivers/clk/samsung/clk-exynos4.c index 1bdb882c845b..4e5739773c33 100644 --- a/drivers/clk/samsung/clk-exynos4.c +++ b/drivers/clk/samsung/clk-exynos4.c | |||
@@ -581,11 +581,15 @@ struct samsung_div_clock exynos4x12_div_clks[] __initdata = { | |||
581 | DIV(none, "div_spi1_isp", "mout_spi1_isp", E4X12_DIV_ISP, 16, 4), | 581 | DIV(none, "div_spi1_isp", "mout_spi1_isp", E4X12_DIV_ISP, 16, 4), |
582 | DIV(none, "div_spi1_isp_pre", "div_spi1_isp", E4X12_DIV_ISP, 20, 8), | 582 | DIV(none, "div_spi1_isp_pre", "div_spi1_isp", E4X12_DIV_ISP, 20, 8), |
583 | DIV(none, "div_uart_isp", "mout_uart_isp", E4X12_DIV_ISP, 28, 4), | 583 | DIV(none, "div_uart_isp", "mout_uart_isp", E4X12_DIV_ISP, 28, 4), |
584 | DIV(div_isp0, "div_isp0", "aclk200", E4X12_DIV_ISP0, 0, 3), | 584 | DIV_F(div_isp0, "div_isp0", "aclk200", E4X12_DIV_ISP0, 0, 3, |
585 | DIV(div_isp1, "div_isp1", "aclk200", E4X12_DIV_ISP0, 4, 3), | 585 | CLK_GET_RATE_NOCACHE, 0), |
586 | DIV_F(div_isp1, "div_isp1", "aclk200", E4X12_DIV_ISP0, 4, 3, | ||
587 | CLK_GET_RATE_NOCACHE, 0), | ||
586 | DIV(none, "div_mpwm", "div_isp1", E4X12_DIV_ISP1, 0, 3), | 588 | DIV(none, "div_mpwm", "div_isp1", E4X12_DIV_ISP1, 0, 3), |
587 | DIV(div_mcuisp0, "div_mcuisp0", "aclk400_mcuisp", E4X12_DIV_ISP1, 4, 3), | 589 | DIV_F(div_mcuisp0, "div_mcuisp0", "aclk400_mcuisp", E4X12_DIV_ISP1, |
588 | DIV(div_mcuisp1, "div_mcuisp1", "div_mcuisp0", E4X12_DIV_ISP1, 8, 3), | 590 | 4, 3, CLK_GET_RATE_NOCACHE, 0), |
591 | DIV_F(div_mcuisp1, "div_mcuisp1", "div_mcuisp0", E4X12_DIV_ISP1, | ||
592 | 8, 3, CLK_GET_RATE_NOCACHE, 0), | ||
589 | DIV(sclk_fimg2d, "sclk_fimg2d", "mout_g2d", DIV_DMC1, 0, 4), | 593 | DIV(sclk_fimg2d, "sclk_fimg2d", "mout_g2d", DIV_DMC1, 0, 4), |
590 | }; | 594 | }; |
591 | 595 | ||
@@ -863,57 +867,57 @@ struct samsung_gate_clock exynos4x12_gate_clks[] __initdata = { | |||
863 | GATE_DA(i2s0, "samsung-i2s.0", "i2s0", "aclk100", | 867 | GATE_DA(i2s0, "samsung-i2s.0", "i2s0", "aclk100", |
864 | E4X12_GATE_IP_MAUDIO, 3, 0, 0, "iis"), | 868 | E4X12_GATE_IP_MAUDIO, 3, 0, 0, "iis"), |
865 | GATE(fimc_isp, "isp", "aclk200", E4X12_GATE_ISP0, 0, | 869 | GATE(fimc_isp, "isp", "aclk200", E4X12_GATE_ISP0, 0, |
866 | CLK_IGNORE_UNUSED, 0), | 870 | CLK_IGNORE_UNUSED | CLK_GET_RATE_NOCACHE, 0), |
867 | GATE(fimc_drc, "drc", "aclk200", E4X12_GATE_ISP0, 1, | 871 | GATE(fimc_drc, "drc", "aclk200", E4X12_GATE_ISP0, 1, |
868 | CLK_IGNORE_UNUSED, 0), | 872 | CLK_IGNORE_UNUSED | CLK_GET_RATE_NOCACHE, 0), |
869 | GATE(fimc_fd, "fd", "aclk200", E4X12_GATE_ISP0, 2, | 873 | GATE(fimc_fd, "fd", "aclk200", E4X12_GATE_ISP0, 2, |
870 | CLK_IGNORE_UNUSED, 0), | 874 | CLK_IGNORE_UNUSED | CLK_GET_RATE_NOCACHE, 0), |
871 | GATE(fimc_lite0, "lite0", "aclk200", E4X12_GATE_ISP0, 3, | 875 | GATE(fimc_lite0, "lite0", "aclk200", E4X12_GATE_ISP0, 3, |
872 | CLK_IGNORE_UNUSED, 0), | 876 | CLK_IGNORE_UNUSED | CLK_GET_RATE_NOCACHE, 0), |
873 | GATE(fimc_lite1, "lite1", "aclk200", E4X12_GATE_ISP0, 4, | 877 | GATE(fimc_lite1, "lite1", "aclk200", E4X12_GATE_ISP0, 4, |
874 | CLK_IGNORE_UNUSED, 0), | 878 | CLK_IGNORE_UNUSED | CLK_GET_RATE_NOCACHE, 0), |
875 | GATE(mcuisp, "mcuisp", "aclk200", E4X12_GATE_ISP0, 5, | 879 | GATE(mcuisp, "mcuisp", "aclk200", E4X12_GATE_ISP0, 5, |
876 | CLK_IGNORE_UNUSED, 0), | 880 | CLK_IGNORE_UNUSED | CLK_GET_RATE_NOCACHE, 0), |
877 | GATE(gicisp, "gicisp", "aclk200", E4X12_GATE_ISP0, 7, | 881 | GATE(gicisp, "gicisp", "aclk200", E4X12_GATE_ISP0, 7, |
878 | CLK_IGNORE_UNUSED, 0), | 882 | CLK_IGNORE_UNUSED | CLK_GET_RATE_NOCACHE, 0), |
879 | GATE(smmu_isp, "smmu_isp", "aclk200", E4X12_GATE_ISP0, 8, | 883 | GATE(smmu_isp, "smmu_isp", "aclk200", E4X12_GATE_ISP0, 8, |
880 | CLK_IGNORE_UNUSED, 0), | 884 | CLK_IGNORE_UNUSED | CLK_GET_RATE_NOCACHE, 0), |
881 | GATE(smmu_drc, "smmu_drc", "aclk200", E4X12_GATE_ISP0, 9, | 885 | GATE(smmu_drc, "smmu_drc", "aclk200", E4X12_GATE_ISP0, 9, |
882 | CLK_IGNORE_UNUSED, 0), | 886 | CLK_IGNORE_UNUSED | CLK_GET_RATE_NOCACHE, 0), |
883 | GATE(smmu_fd, "smmu_fd", "aclk200", E4X12_GATE_ISP0, 10, | 887 | GATE(smmu_fd, "smmu_fd", "aclk200", E4X12_GATE_ISP0, 10, |
884 | CLK_IGNORE_UNUSED, 0), | 888 | CLK_IGNORE_UNUSED | CLK_GET_RATE_NOCACHE, 0), |
885 | GATE(smmu_lite0, "smmu_lite0", "aclk200", E4X12_GATE_ISP0, 11, | 889 | GATE(smmu_lite0, "smmu_lite0", "aclk200", E4X12_GATE_ISP0, 11, |
886 | CLK_IGNORE_UNUSED, 0), | 890 | CLK_IGNORE_UNUSED | CLK_GET_RATE_NOCACHE, 0), |
887 | GATE(smmu_lite1, "smmu_lite1", "aclk200", E4X12_GATE_ISP0, 12, | 891 | GATE(smmu_lite1, "smmu_lite1", "aclk200", E4X12_GATE_ISP0, 12, |
888 | CLK_IGNORE_UNUSED, 0), | 892 | CLK_IGNORE_UNUSED | CLK_GET_RATE_NOCACHE, 0), |
889 | GATE(ppmuispmx, "ppmuispmx", "aclk200", E4X12_GATE_ISP0, 20, | 893 | GATE(ppmuispmx, "ppmuispmx", "aclk200", E4X12_GATE_ISP0, 20, |
890 | CLK_IGNORE_UNUSED, 0), | 894 | CLK_IGNORE_UNUSED | CLK_GET_RATE_NOCACHE, 0), |
891 | GATE(ppmuispx, "ppmuispx", "aclk200", E4X12_GATE_ISP0, 21, | 895 | GATE(ppmuispx, "ppmuispx", "aclk200", E4X12_GATE_ISP0, 21, |
892 | CLK_IGNORE_UNUSED, 0), | 896 | CLK_IGNORE_UNUSED | CLK_GET_RATE_NOCACHE, 0), |
893 | GATE(mcuctl_isp, "mcuctl_isp", "aclk200", E4X12_GATE_ISP0, 23, | 897 | GATE(mcuctl_isp, "mcuctl_isp", "aclk200", E4X12_GATE_ISP0, 23, |
894 | CLK_IGNORE_UNUSED, 0), | 898 | CLK_IGNORE_UNUSED | CLK_GET_RATE_NOCACHE, 0), |
895 | GATE(mpwm_isp, "mpwm_isp", "aclk200", E4X12_GATE_ISP0, 24, | 899 | GATE(mpwm_isp, "mpwm_isp", "aclk200", E4X12_GATE_ISP0, 24, |
896 | CLK_IGNORE_UNUSED, 0), | 900 | CLK_IGNORE_UNUSED | CLK_GET_RATE_NOCACHE, 0), |
897 | GATE(i2c0_isp, "i2c0_isp", "aclk200", E4X12_GATE_ISP0, 25, | 901 | GATE(i2c0_isp, "i2c0_isp", "aclk200", E4X12_GATE_ISP0, 25, |
898 | CLK_IGNORE_UNUSED, 0), | 902 | CLK_IGNORE_UNUSED | CLK_GET_RATE_NOCACHE, 0), |
899 | GATE(i2c1_isp, "i2c1_isp", "aclk200", E4X12_GATE_ISP0, 26, | 903 | GATE(i2c1_isp, "i2c1_isp", "aclk200", E4X12_GATE_ISP0, 26, |
900 | CLK_IGNORE_UNUSED, 0), | 904 | CLK_IGNORE_UNUSED | CLK_GET_RATE_NOCACHE, 0), |
901 | GATE(mtcadc_isp, "mtcadc_isp", "aclk200", E4X12_GATE_ISP0, 27, | 905 | GATE(mtcadc_isp, "mtcadc_isp", "aclk200", E4X12_GATE_ISP0, 27, |
902 | CLK_IGNORE_UNUSED, 0), | 906 | CLK_IGNORE_UNUSED | CLK_GET_RATE_NOCACHE, 0), |
903 | GATE(pwm_isp, "pwm_isp", "aclk200", E4X12_GATE_ISP0, 28, | 907 | GATE(pwm_isp, "pwm_isp", "aclk200", E4X12_GATE_ISP0, 28, |
904 | CLK_IGNORE_UNUSED, 0), | 908 | CLK_IGNORE_UNUSED | CLK_GET_RATE_NOCACHE, 0), |
905 | GATE(wdt_isp, "wdt_isp", "aclk200", E4X12_GATE_ISP0, 30, | 909 | GATE(wdt_isp, "wdt_isp", "aclk200", E4X12_GATE_ISP0, 30, |
906 | CLK_IGNORE_UNUSED, 0), | 910 | CLK_IGNORE_UNUSED | CLK_GET_RATE_NOCACHE, 0), |
907 | GATE(uart_isp, "uart_isp", "aclk200", E4X12_GATE_ISP0, 31, | 911 | GATE(uart_isp, "uart_isp", "aclk200", E4X12_GATE_ISP0, 31, |
908 | CLK_IGNORE_UNUSED, 0), | 912 | CLK_IGNORE_UNUSED | CLK_GET_RATE_NOCACHE, 0), |
909 | GATE(asyncaxim, "asyncaxim", "aclk200", E4X12_GATE_ISP1, 0, | 913 | GATE(asyncaxim, "asyncaxim", "aclk200", E4X12_GATE_ISP1, 0, |
910 | CLK_IGNORE_UNUSED, 0), | 914 | CLK_IGNORE_UNUSED | CLK_GET_RATE_NOCACHE, 0), |
911 | GATE(smmu_ispcx, "smmu_ispcx", "aclk200", E4X12_GATE_ISP1, 4, | 915 | GATE(smmu_ispcx, "smmu_ispcx", "aclk200", E4X12_GATE_ISP1, 4, |
912 | CLK_IGNORE_UNUSED, 0), | 916 | CLK_IGNORE_UNUSED | CLK_GET_RATE_NOCACHE, 0), |
913 | GATE(spi0_isp, "spi0_isp", "aclk200", E4X12_GATE_ISP1, 12, | 917 | GATE(spi0_isp, "spi0_isp", "aclk200", E4X12_GATE_ISP1, 12, |
914 | CLK_IGNORE_UNUSED, 0), | 918 | CLK_IGNORE_UNUSED | CLK_GET_RATE_NOCACHE, 0), |
915 | GATE(spi1_isp, "spi1_isp", "aclk200", E4X12_GATE_ISP1, 13, | 919 | GATE(spi1_isp, "spi1_isp", "aclk200", E4X12_GATE_ISP1, 13, |
916 | CLK_IGNORE_UNUSED, 0), | 920 | CLK_IGNORE_UNUSED | CLK_GET_RATE_NOCACHE, 0), |
917 | GATE(g2d, "g2d", "aclk200", GATE_IP_DMC, 23, 0, 0), | 921 | GATE(g2d, "g2d", "aclk200", GATE_IP_DMC, 23, 0, 0), |
918 | }; | 922 | }; |
919 | 923 | ||
diff --git a/drivers/clk/zynq/clkc.c b/drivers/clk/zynq/clkc.c index 5c205b60a82a..089d3e30e221 100644 --- a/drivers/clk/zynq/clkc.c +++ b/drivers/clk/zynq/clkc.c | |||
@@ -71,6 +71,7 @@ static DEFINE_SPINLOCK(armpll_lock); | |||
71 | static DEFINE_SPINLOCK(ddrpll_lock); | 71 | static DEFINE_SPINLOCK(ddrpll_lock); |
72 | static DEFINE_SPINLOCK(iopll_lock); | 72 | static DEFINE_SPINLOCK(iopll_lock); |
73 | static DEFINE_SPINLOCK(armclk_lock); | 73 | static DEFINE_SPINLOCK(armclk_lock); |
74 | static DEFINE_SPINLOCK(swdtclk_lock); | ||
74 | static DEFINE_SPINLOCK(ddrclk_lock); | 75 | static DEFINE_SPINLOCK(ddrclk_lock); |
75 | static DEFINE_SPINLOCK(dciclk_lock); | 76 | static DEFINE_SPINLOCK(dciclk_lock); |
76 | static DEFINE_SPINLOCK(gem0clk_lock); | 77 | static DEFINE_SPINLOCK(gem0clk_lock); |
@@ -293,7 +294,7 @@ static void __init zynq_clk_setup(struct device_node *np) | |||
293 | } | 294 | } |
294 | clks[swdt] = clk_register_mux(NULL, clk_output_name[swdt], | 295 | clks[swdt] = clk_register_mux(NULL, clk_output_name[swdt], |
295 | swdt_ext_clk_mux_parents, 2, CLK_SET_RATE_PARENT, | 296 | swdt_ext_clk_mux_parents, 2, CLK_SET_RATE_PARENT, |
296 | SLCR_SWDT_CLK_SEL, 0, 1, 0, &gem0clk_lock); | 297 | SLCR_SWDT_CLK_SEL, 0, 1, 0, &swdtclk_lock); |
297 | 298 | ||
298 | /* DDR clocks */ | 299 | /* DDR clocks */ |
299 | clk = clk_register_divider(NULL, "ddr2x_div", "ddrpll", 0, | 300 | clk = clk_register_divider(NULL, "ddr2x_div", "ddrpll", 0, |
@@ -364,8 +365,9 @@ static void __init zynq_clk_setup(struct device_node *np) | |||
364 | CLK_SET_RATE_PARENT, SLCR_GEM0_CLK_CTRL, 20, 6, | 365 | CLK_SET_RATE_PARENT, SLCR_GEM0_CLK_CTRL, 20, 6, |
365 | CLK_DIVIDER_ONE_BASED | CLK_DIVIDER_ALLOW_ZERO, | 366 | CLK_DIVIDER_ONE_BASED | CLK_DIVIDER_ALLOW_ZERO, |
366 | &gem0clk_lock); | 367 | &gem0clk_lock); |
367 | clk = clk_register_mux(NULL, "gem0_emio_mux", gem0_mux_parents, 2, 0, | 368 | clk = clk_register_mux(NULL, "gem0_emio_mux", gem0_mux_parents, 2, |
368 | SLCR_GEM0_CLK_CTRL, 6, 1, 0, &gem0clk_lock); | 369 | CLK_SET_RATE_PARENT, SLCR_GEM0_CLK_CTRL, 6, 1, 0, |
370 | &gem0clk_lock); | ||
369 | clks[gem0] = clk_register_gate(NULL, clk_output_name[gem0], | 371 | clks[gem0] = clk_register_gate(NULL, clk_output_name[gem0], |
370 | "gem0_emio_mux", CLK_SET_RATE_PARENT, | 372 | "gem0_emio_mux", CLK_SET_RATE_PARENT, |
371 | SLCR_GEM0_CLK_CTRL, 0, 0, &gem0clk_lock); | 373 | SLCR_GEM0_CLK_CTRL, 0, 0, &gem0clk_lock); |
@@ -386,8 +388,9 @@ static void __init zynq_clk_setup(struct device_node *np) | |||
386 | CLK_SET_RATE_PARENT, SLCR_GEM1_CLK_CTRL, 20, 6, | 388 | CLK_SET_RATE_PARENT, SLCR_GEM1_CLK_CTRL, 20, 6, |
387 | CLK_DIVIDER_ONE_BASED | CLK_DIVIDER_ALLOW_ZERO, | 389 | CLK_DIVIDER_ONE_BASED | CLK_DIVIDER_ALLOW_ZERO, |
388 | &gem1clk_lock); | 390 | &gem1clk_lock); |
389 | clk = clk_register_mux(NULL, "gem1_emio_mux", gem1_mux_parents, 2, 0, | 391 | clk = clk_register_mux(NULL, "gem1_emio_mux", gem1_mux_parents, 2, |
390 | SLCR_GEM1_CLK_CTRL, 6, 1, 0, &gem1clk_lock); | 392 | CLK_SET_RATE_PARENT, SLCR_GEM1_CLK_CTRL, 6, 1, 0, |
393 | &gem1clk_lock); | ||
391 | clks[gem1] = clk_register_gate(NULL, clk_output_name[gem1], | 394 | clks[gem1] = clk_register_gate(NULL, clk_output_name[gem1], |
392 | "gem1_emio_mux", CLK_SET_RATE_PARENT, | 395 | "gem1_emio_mux", CLK_SET_RATE_PARENT, |
393 | SLCR_GEM1_CLK_CTRL, 0, 0, &gem1clk_lock); | 396 | SLCR_GEM1_CLK_CTRL, 0, 0, &gem1clk_lock); |
diff --git a/drivers/cpufreq/cpufreq_conservative.c b/drivers/cpufreq/cpufreq_conservative.c index 0ceb2eff5a7e..f97cb3d8c5a2 100644 --- a/drivers/cpufreq/cpufreq_conservative.c +++ b/drivers/cpufreq/cpufreq_conservative.c | |||
@@ -221,8 +221,8 @@ static ssize_t store_down_threshold(struct dbs_data *dbs_data, const char *buf, | |||
221 | return count; | 221 | return count; |
222 | } | 222 | } |
223 | 223 | ||
224 | static ssize_t store_ignore_nice(struct dbs_data *dbs_data, const char *buf, | 224 | static ssize_t store_ignore_nice_load(struct dbs_data *dbs_data, |
225 | size_t count) | 225 | const char *buf, size_t count) |
226 | { | 226 | { |
227 | struct cs_dbs_tuners *cs_tuners = dbs_data->tuners; | 227 | struct cs_dbs_tuners *cs_tuners = dbs_data->tuners; |
228 | unsigned int input, j; | 228 | unsigned int input, j; |
@@ -235,10 +235,10 @@ static ssize_t store_ignore_nice(struct dbs_data *dbs_data, const char *buf, | |||
235 | if (input > 1) | 235 | if (input > 1) |
236 | input = 1; | 236 | input = 1; |
237 | 237 | ||
238 | if (input == cs_tuners->ignore_nice) /* nothing to do */ | 238 | if (input == cs_tuners->ignore_nice_load) /* nothing to do */ |
239 | return count; | 239 | return count; |
240 | 240 | ||
241 | cs_tuners->ignore_nice = input; | 241 | cs_tuners->ignore_nice_load = input; |
242 | 242 | ||
243 | /* we need to re-evaluate prev_cpu_idle */ | 243 | /* we need to re-evaluate prev_cpu_idle */ |
244 | for_each_online_cpu(j) { | 244 | for_each_online_cpu(j) { |
@@ -246,7 +246,7 @@ static ssize_t store_ignore_nice(struct dbs_data *dbs_data, const char *buf, | |||
246 | dbs_info = &per_cpu(cs_cpu_dbs_info, j); | 246 | dbs_info = &per_cpu(cs_cpu_dbs_info, j); |
247 | dbs_info->cdbs.prev_cpu_idle = get_cpu_idle_time(j, | 247 | dbs_info->cdbs.prev_cpu_idle = get_cpu_idle_time(j, |
248 | &dbs_info->cdbs.prev_cpu_wall, 0); | 248 | &dbs_info->cdbs.prev_cpu_wall, 0); |
249 | if (cs_tuners->ignore_nice) | 249 | if (cs_tuners->ignore_nice_load) |
250 | dbs_info->cdbs.prev_cpu_nice = | 250 | dbs_info->cdbs.prev_cpu_nice = |
251 | kcpustat_cpu(j).cpustat[CPUTIME_NICE]; | 251 | kcpustat_cpu(j).cpustat[CPUTIME_NICE]; |
252 | } | 252 | } |
@@ -279,7 +279,7 @@ show_store_one(cs, sampling_rate); | |||
279 | show_store_one(cs, sampling_down_factor); | 279 | show_store_one(cs, sampling_down_factor); |
280 | show_store_one(cs, up_threshold); | 280 | show_store_one(cs, up_threshold); |
281 | show_store_one(cs, down_threshold); | 281 | show_store_one(cs, down_threshold); |
282 | show_store_one(cs, ignore_nice); | 282 | show_store_one(cs, ignore_nice_load); |
283 | show_store_one(cs, freq_step); | 283 | show_store_one(cs, freq_step); |
284 | declare_show_sampling_rate_min(cs); | 284 | declare_show_sampling_rate_min(cs); |
285 | 285 | ||
@@ -287,7 +287,7 @@ gov_sys_pol_attr_rw(sampling_rate); | |||
287 | gov_sys_pol_attr_rw(sampling_down_factor); | 287 | gov_sys_pol_attr_rw(sampling_down_factor); |
288 | gov_sys_pol_attr_rw(up_threshold); | 288 | gov_sys_pol_attr_rw(up_threshold); |
289 | gov_sys_pol_attr_rw(down_threshold); | 289 | gov_sys_pol_attr_rw(down_threshold); |
290 | gov_sys_pol_attr_rw(ignore_nice); | 290 | gov_sys_pol_attr_rw(ignore_nice_load); |
291 | gov_sys_pol_attr_rw(freq_step); | 291 | gov_sys_pol_attr_rw(freq_step); |
292 | gov_sys_pol_attr_ro(sampling_rate_min); | 292 | gov_sys_pol_attr_ro(sampling_rate_min); |
293 | 293 | ||
@@ -297,7 +297,7 @@ static struct attribute *dbs_attributes_gov_sys[] = { | |||
297 | &sampling_down_factor_gov_sys.attr, | 297 | &sampling_down_factor_gov_sys.attr, |
298 | &up_threshold_gov_sys.attr, | 298 | &up_threshold_gov_sys.attr, |
299 | &down_threshold_gov_sys.attr, | 299 | &down_threshold_gov_sys.attr, |
300 | &ignore_nice_gov_sys.attr, | 300 | &ignore_nice_load_gov_sys.attr, |
301 | &freq_step_gov_sys.attr, | 301 | &freq_step_gov_sys.attr, |
302 | NULL | 302 | NULL |
303 | }; | 303 | }; |
@@ -313,7 +313,7 @@ static struct attribute *dbs_attributes_gov_pol[] = { | |||
313 | &sampling_down_factor_gov_pol.attr, | 313 | &sampling_down_factor_gov_pol.attr, |
314 | &up_threshold_gov_pol.attr, | 314 | &up_threshold_gov_pol.attr, |
315 | &down_threshold_gov_pol.attr, | 315 | &down_threshold_gov_pol.attr, |
316 | &ignore_nice_gov_pol.attr, | 316 | &ignore_nice_load_gov_pol.attr, |
317 | &freq_step_gov_pol.attr, | 317 | &freq_step_gov_pol.attr, |
318 | NULL | 318 | NULL |
319 | }; | 319 | }; |
@@ -338,7 +338,7 @@ static int cs_init(struct dbs_data *dbs_data) | |||
338 | tuners->up_threshold = DEF_FREQUENCY_UP_THRESHOLD; | 338 | tuners->up_threshold = DEF_FREQUENCY_UP_THRESHOLD; |
339 | tuners->down_threshold = DEF_FREQUENCY_DOWN_THRESHOLD; | 339 | tuners->down_threshold = DEF_FREQUENCY_DOWN_THRESHOLD; |
340 | tuners->sampling_down_factor = DEF_SAMPLING_DOWN_FACTOR; | 340 | tuners->sampling_down_factor = DEF_SAMPLING_DOWN_FACTOR; |
341 | tuners->ignore_nice = 0; | 341 | tuners->ignore_nice_load = 0; |
342 | tuners->freq_step = DEF_FREQUENCY_STEP; | 342 | tuners->freq_step = DEF_FREQUENCY_STEP; |
343 | 343 | ||
344 | dbs_data->tuners = tuners; | 344 | dbs_data->tuners = tuners; |
diff --git a/drivers/cpufreq/cpufreq_governor.c b/drivers/cpufreq/cpufreq_governor.c index 7b839a8db2a7..e59afaa9da23 100644 --- a/drivers/cpufreq/cpufreq_governor.c +++ b/drivers/cpufreq/cpufreq_governor.c | |||
@@ -47,9 +47,9 @@ void dbs_check_cpu(struct dbs_data *dbs_data, int cpu) | |||
47 | unsigned int j; | 47 | unsigned int j; |
48 | 48 | ||
49 | if (dbs_data->cdata->governor == GOV_ONDEMAND) | 49 | if (dbs_data->cdata->governor == GOV_ONDEMAND) |
50 | ignore_nice = od_tuners->ignore_nice; | 50 | ignore_nice = od_tuners->ignore_nice_load; |
51 | else | 51 | else |
52 | ignore_nice = cs_tuners->ignore_nice; | 52 | ignore_nice = cs_tuners->ignore_nice_load; |
53 | 53 | ||
54 | policy = cdbs->cur_policy; | 54 | policy = cdbs->cur_policy; |
55 | 55 | ||
@@ -298,12 +298,12 @@ int cpufreq_governor_dbs(struct cpufreq_policy *policy, | |||
298 | cs_tuners = dbs_data->tuners; | 298 | cs_tuners = dbs_data->tuners; |
299 | cs_dbs_info = dbs_data->cdata->get_cpu_dbs_info_s(cpu); | 299 | cs_dbs_info = dbs_data->cdata->get_cpu_dbs_info_s(cpu); |
300 | sampling_rate = cs_tuners->sampling_rate; | 300 | sampling_rate = cs_tuners->sampling_rate; |
301 | ignore_nice = cs_tuners->ignore_nice; | 301 | ignore_nice = cs_tuners->ignore_nice_load; |
302 | } else { | 302 | } else { |
303 | od_tuners = dbs_data->tuners; | 303 | od_tuners = dbs_data->tuners; |
304 | od_dbs_info = dbs_data->cdata->get_cpu_dbs_info_s(cpu); | 304 | od_dbs_info = dbs_data->cdata->get_cpu_dbs_info_s(cpu); |
305 | sampling_rate = od_tuners->sampling_rate; | 305 | sampling_rate = od_tuners->sampling_rate; |
306 | ignore_nice = od_tuners->ignore_nice; | 306 | ignore_nice = od_tuners->ignore_nice_load; |
307 | od_ops = dbs_data->cdata->gov_ops; | 307 | od_ops = dbs_data->cdata->gov_ops; |
308 | io_busy = od_tuners->io_is_busy; | 308 | io_busy = od_tuners->io_is_busy; |
309 | } | 309 | } |
diff --git a/drivers/cpufreq/cpufreq_governor.h b/drivers/cpufreq/cpufreq_governor.h index 6663ec3b3056..d5f12b4b11b8 100644 --- a/drivers/cpufreq/cpufreq_governor.h +++ b/drivers/cpufreq/cpufreq_governor.h | |||
@@ -165,7 +165,7 @@ struct cs_cpu_dbs_info_s { | |||
165 | 165 | ||
166 | /* Per policy Governers sysfs tunables */ | 166 | /* Per policy Governers sysfs tunables */ |
167 | struct od_dbs_tuners { | 167 | struct od_dbs_tuners { |
168 | unsigned int ignore_nice; | 168 | unsigned int ignore_nice_load; |
169 | unsigned int sampling_rate; | 169 | unsigned int sampling_rate; |
170 | unsigned int sampling_down_factor; | 170 | unsigned int sampling_down_factor; |
171 | unsigned int up_threshold; | 171 | unsigned int up_threshold; |
@@ -175,7 +175,7 @@ struct od_dbs_tuners { | |||
175 | }; | 175 | }; |
176 | 176 | ||
177 | struct cs_dbs_tuners { | 177 | struct cs_dbs_tuners { |
178 | unsigned int ignore_nice; | 178 | unsigned int ignore_nice_load; |
179 | unsigned int sampling_rate; | 179 | unsigned int sampling_rate; |
180 | unsigned int sampling_down_factor; | 180 | unsigned int sampling_down_factor; |
181 | unsigned int up_threshold; | 181 | unsigned int up_threshold; |
diff --git a/drivers/cpufreq/cpufreq_ondemand.c b/drivers/cpufreq/cpufreq_ondemand.c index 93eb5cbcc1f6..c087347d6688 100644 --- a/drivers/cpufreq/cpufreq_ondemand.c +++ b/drivers/cpufreq/cpufreq_ondemand.c | |||
@@ -403,8 +403,8 @@ static ssize_t store_sampling_down_factor(struct dbs_data *dbs_data, | |||
403 | return count; | 403 | return count; |
404 | } | 404 | } |
405 | 405 | ||
406 | static ssize_t store_ignore_nice(struct dbs_data *dbs_data, const char *buf, | 406 | static ssize_t store_ignore_nice_load(struct dbs_data *dbs_data, |
407 | size_t count) | 407 | const char *buf, size_t count) |
408 | { | 408 | { |
409 | struct od_dbs_tuners *od_tuners = dbs_data->tuners; | 409 | struct od_dbs_tuners *od_tuners = dbs_data->tuners; |
410 | unsigned int input; | 410 | unsigned int input; |
@@ -419,10 +419,10 @@ static ssize_t store_ignore_nice(struct dbs_data *dbs_data, const char *buf, | |||
419 | if (input > 1) | 419 | if (input > 1) |
420 | input = 1; | 420 | input = 1; |
421 | 421 | ||
422 | if (input == od_tuners->ignore_nice) { /* nothing to do */ | 422 | if (input == od_tuners->ignore_nice_load) { /* nothing to do */ |
423 | return count; | 423 | return count; |
424 | } | 424 | } |
425 | od_tuners->ignore_nice = input; | 425 | od_tuners->ignore_nice_load = input; |
426 | 426 | ||
427 | /* we need to re-evaluate prev_cpu_idle */ | 427 | /* we need to re-evaluate prev_cpu_idle */ |
428 | for_each_online_cpu(j) { | 428 | for_each_online_cpu(j) { |
@@ -430,7 +430,7 @@ static ssize_t store_ignore_nice(struct dbs_data *dbs_data, const char *buf, | |||
430 | dbs_info = &per_cpu(od_cpu_dbs_info, j); | 430 | dbs_info = &per_cpu(od_cpu_dbs_info, j); |
431 | dbs_info->cdbs.prev_cpu_idle = get_cpu_idle_time(j, | 431 | dbs_info->cdbs.prev_cpu_idle = get_cpu_idle_time(j, |
432 | &dbs_info->cdbs.prev_cpu_wall, od_tuners->io_is_busy); | 432 | &dbs_info->cdbs.prev_cpu_wall, od_tuners->io_is_busy); |
433 | if (od_tuners->ignore_nice) | 433 | if (od_tuners->ignore_nice_load) |
434 | dbs_info->cdbs.prev_cpu_nice = | 434 | dbs_info->cdbs.prev_cpu_nice = |
435 | kcpustat_cpu(j).cpustat[CPUTIME_NICE]; | 435 | kcpustat_cpu(j).cpustat[CPUTIME_NICE]; |
436 | 436 | ||
@@ -461,7 +461,7 @@ show_store_one(od, sampling_rate); | |||
461 | show_store_one(od, io_is_busy); | 461 | show_store_one(od, io_is_busy); |
462 | show_store_one(od, up_threshold); | 462 | show_store_one(od, up_threshold); |
463 | show_store_one(od, sampling_down_factor); | 463 | show_store_one(od, sampling_down_factor); |
464 | show_store_one(od, ignore_nice); | 464 | show_store_one(od, ignore_nice_load); |
465 | show_store_one(od, powersave_bias); | 465 | show_store_one(od, powersave_bias); |
466 | declare_show_sampling_rate_min(od); | 466 | declare_show_sampling_rate_min(od); |
467 | 467 | ||
@@ -469,7 +469,7 @@ gov_sys_pol_attr_rw(sampling_rate); | |||
469 | gov_sys_pol_attr_rw(io_is_busy); | 469 | gov_sys_pol_attr_rw(io_is_busy); |
470 | gov_sys_pol_attr_rw(up_threshold); | 470 | gov_sys_pol_attr_rw(up_threshold); |
471 | gov_sys_pol_attr_rw(sampling_down_factor); | 471 | gov_sys_pol_attr_rw(sampling_down_factor); |
472 | gov_sys_pol_attr_rw(ignore_nice); | 472 | gov_sys_pol_attr_rw(ignore_nice_load); |
473 | gov_sys_pol_attr_rw(powersave_bias); | 473 | gov_sys_pol_attr_rw(powersave_bias); |
474 | gov_sys_pol_attr_ro(sampling_rate_min); | 474 | gov_sys_pol_attr_ro(sampling_rate_min); |
475 | 475 | ||
@@ -478,7 +478,7 @@ static struct attribute *dbs_attributes_gov_sys[] = { | |||
478 | &sampling_rate_gov_sys.attr, | 478 | &sampling_rate_gov_sys.attr, |
479 | &up_threshold_gov_sys.attr, | 479 | &up_threshold_gov_sys.attr, |
480 | &sampling_down_factor_gov_sys.attr, | 480 | &sampling_down_factor_gov_sys.attr, |
481 | &ignore_nice_gov_sys.attr, | 481 | &ignore_nice_load_gov_sys.attr, |
482 | &powersave_bias_gov_sys.attr, | 482 | &powersave_bias_gov_sys.attr, |
483 | &io_is_busy_gov_sys.attr, | 483 | &io_is_busy_gov_sys.attr, |
484 | NULL | 484 | NULL |
@@ -494,7 +494,7 @@ static struct attribute *dbs_attributes_gov_pol[] = { | |||
494 | &sampling_rate_gov_pol.attr, | 494 | &sampling_rate_gov_pol.attr, |
495 | &up_threshold_gov_pol.attr, | 495 | &up_threshold_gov_pol.attr, |
496 | &sampling_down_factor_gov_pol.attr, | 496 | &sampling_down_factor_gov_pol.attr, |
497 | &ignore_nice_gov_pol.attr, | 497 | &ignore_nice_load_gov_pol.attr, |
498 | &powersave_bias_gov_pol.attr, | 498 | &powersave_bias_gov_pol.attr, |
499 | &io_is_busy_gov_pol.attr, | 499 | &io_is_busy_gov_pol.attr, |
500 | NULL | 500 | NULL |
@@ -544,7 +544,7 @@ static int od_init(struct dbs_data *dbs_data) | |||
544 | } | 544 | } |
545 | 545 | ||
546 | tuners->sampling_down_factor = DEF_SAMPLING_DOWN_FACTOR; | 546 | tuners->sampling_down_factor = DEF_SAMPLING_DOWN_FACTOR; |
547 | tuners->ignore_nice = 0; | 547 | tuners->ignore_nice_load = 0; |
548 | tuners->powersave_bias = default_powersave_bias; | 548 | tuners->powersave_bias = default_powersave_bias; |
549 | tuners->io_is_busy = should_io_be_busy(); | 549 | tuners->io_is_busy = should_io_be_busy(); |
550 | 550 | ||
diff --git a/drivers/cpufreq/loongson2_cpufreq.c b/drivers/cpufreq/loongson2_cpufreq.c index bb838b985077..9536852c504a 100644 --- a/drivers/cpufreq/loongson2_cpufreq.c +++ b/drivers/cpufreq/loongson2_cpufreq.c | |||
@@ -118,11 +118,6 @@ static int loongson2_cpufreq_cpu_init(struct cpufreq_policy *policy) | |||
118 | clk_put(cpuclk); | 118 | clk_put(cpuclk); |
119 | return -EINVAL; | 119 | return -EINVAL; |
120 | } | 120 | } |
121 | ret = clk_set_rate(cpuclk, rate); | ||
122 | if (ret) { | ||
123 | clk_put(cpuclk); | ||
124 | return ret; | ||
125 | } | ||
126 | 121 | ||
127 | /* clock table init */ | 122 | /* clock table init */ |
128 | for (i = 2; | 123 | for (i = 2; |
@@ -130,6 +125,12 @@ static int loongson2_cpufreq_cpu_init(struct cpufreq_policy *policy) | |||
130 | i++) | 125 | i++) |
131 | loongson2_clockmod_table[i].frequency = (rate * i) / 8; | 126 | loongson2_clockmod_table[i].frequency = (rate * i) / 8; |
132 | 127 | ||
128 | ret = clk_set_rate(cpuclk, rate); | ||
129 | if (ret) { | ||
130 | clk_put(cpuclk); | ||
131 | return ret; | ||
132 | } | ||
133 | |||
133 | policy->cur = loongson2_cpufreq_get(policy->cpu); | 134 | policy->cur = loongson2_cpufreq_get(policy->cpu); |
134 | 135 | ||
135 | cpufreq_frequency_table_get_attr(&loongson2_clockmod_table[0], | 136 | cpufreq_frequency_table_get_attr(&loongson2_clockmod_table[0], |
diff --git a/drivers/dma/pch_dma.c b/drivers/dma/pch_dma.c index ce3dc3e9688c..0bbdea5059f3 100644 --- a/drivers/dma/pch_dma.c +++ b/drivers/dma/pch_dma.c | |||
@@ -867,6 +867,7 @@ static int pch_dma_probe(struct pci_dev *pdev, | |||
867 | 867 | ||
868 | if (!(pci_resource_flags(pdev, 1) & IORESOURCE_MEM)) { | 868 | if (!(pci_resource_flags(pdev, 1) & IORESOURCE_MEM)) { |
869 | dev_err(&pdev->dev, "Cannot find proper base address\n"); | 869 | dev_err(&pdev->dev, "Cannot find proper base address\n"); |
870 | err = -ENODEV; | ||
870 | goto err_disable_pdev; | 871 | goto err_disable_pdev; |
871 | } | 872 | } |
872 | 873 | ||
diff --git a/drivers/dma/pl330.c b/drivers/dma/pl330.c index 593827b3fdd4..fa645d825009 100644 --- a/drivers/dma/pl330.c +++ b/drivers/dma/pl330.c | |||
@@ -2505,6 +2505,10 @@ static dma_cookie_t pl330_tx_submit(struct dma_async_tx_descriptor *tx) | |||
2505 | /* Assign cookies to all nodes */ | 2505 | /* Assign cookies to all nodes */ |
2506 | while (!list_empty(&last->node)) { | 2506 | while (!list_empty(&last->node)) { |
2507 | desc = list_entry(last->node.next, struct dma_pl330_desc, node); | 2507 | desc = list_entry(last->node.next, struct dma_pl330_desc, node); |
2508 | if (pch->cyclic) { | ||
2509 | desc->txd.callback = last->txd.callback; | ||
2510 | desc->txd.callback_param = last->txd.callback_param; | ||
2511 | } | ||
2508 | 2512 | ||
2509 | dma_cookie_assign(&desc->txd); | 2513 | dma_cookie_assign(&desc->txd); |
2510 | 2514 | ||
@@ -2688,45 +2692,82 @@ static struct dma_async_tx_descriptor *pl330_prep_dma_cyclic( | |||
2688 | size_t period_len, enum dma_transfer_direction direction, | 2692 | size_t period_len, enum dma_transfer_direction direction, |
2689 | unsigned long flags, void *context) | 2693 | unsigned long flags, void *context) |
2690 | { | 2694 | { |
2691 | struct dma_pl330_desc *desc; | 2695 | struct dma_pl330_desc *desc = NULL, *first = NULL; |
2692 | struct dma_pl330_chan *pch = to_pchan(chan); | 2696 | struct dma_pl330_chan *pch = to_pchan(chan); |
2697 | struct dma_pl330_dmac *pdmac = pch->dmac; | ||
2698 | unsigned int i; | ||
2693 | dma_addr_t dst; | 2699 | dma_addr_t dst; |
2694 | dma_addr_t src; | 2700 | dma_addr_t src; |
2695 | 2701 | ||
2696 | desc = pl330_get_desc(pch); | 2702 | if (len % period_len != 0) |
2697 | if (!desc) { | ||
2698 | dev_err(pch->dmac->pif.dev, "%s:%d Unable to fetch desc\n", | ||
2699 | __func__, __LINE__); | ||
2700 | return NULL; | 2703 | return NULL; |
2701 | } | ||
2702 | 2704 | ||
2703 | switch (direction) { | 2705 | if (!is_slave_direction(direction)) { |
2704 | case DMA_MEM_TO_DEV: | ||
2705 | desc->rqcfg.src_inc = 1; | ||
2706 | desc->rqcfg.dst_inc = 0; | ||
2707 | desc->req.rqtype = MEMTODEV; | ||
2708 | src = dma_addr; | ||
2709 | dst = pch->fifo_addr; | ||
2710 | break; | ||
2711 | case DMA_DEV_TO_MEM: | ||
2712 | desc->rqcfg.src_inc = 0; | ||
2713 | desc->rqcfg.dst_inc = 1; | ||
2714 | desc->req.rqtype = DEVTOMEM; | ||
2715 | src = pch->fifo_addr; | ||
2716 | dst = dma_addr; | ||
2717 | break; | ||
2718 | default: | ||
2719 | dev_err(pch->dmac->pif.dev, "%s:%d Invalid dma direction\n", | 2706 | dev_err(pch->dmac->pif.dev, "%s:%d Invalid dma direction\n", |
2720 | __func__, __LINE__); | 2707 | __func__, __LINE__); |
2721 | return NULL; | 2708 | return NULL; |
2722 | } | 2709 | } |
2723 | 2710 | ||
2724 | desc->rqcfg.brst_size = pch->burst_sz; | 2711 | for (i = 0; i < len / period_len; i++) { |
2725 | desc->rqcfg.brst_len = 1; | 2712 | desc = pl330_get_desc(pch); |
2713 | if (!desc) { | ||
2714 | dev_err(pch->dmac->pif.dev, "%s:%d Unable to fetch desc\n", | ||
2715 | __func__, __LINE__); | ||
2726 | 2716 | ||
2727 | pch->cyclic = true; | 2717 | if (!first) |
2718 | return NULL; | ||
2719 | |||
2720 | spin_lock_irqsave(&pdmac->pool_lock, flags); | ||
2721 | |||
2722 | while (!list_empty(&first->node)) { | ||
2723 | desc = list_entry(first->node.next, | ||
2724 | struct dma_pl330_desc, node); | ||
2725 | list_move_tail(&desc->node, &pdmac->desc_pool); | ||
2726 | } | ||
2727 | |||
2728 | list_move_tail(&first->node, &pdmac->desc_pool); | ||
2728 | 2729 | ||
2729 | fill_px(&desc->px, dst, src, period_len); | 2730 | spin_unlock_irqrestore(&pdmac->pool_lock, flags); |
2731 | |||
2732 | return NULL; | ||
2733 | } | ||
2734 | |||
2735 | switch (direction) { | ||
2736 | case DMA_MEM_TO_DEV: | ||
2737 | desc->rqcfg.src_inc = 1; | ||
2738 | desc->rqcfg.dst_inc = 0; | ||
2739 | desc->req.rqtype = MEMTODEV; | ||
2740 | src = dma_addr; | ||
2741 | dst = pch->fifo_addr; | ||
2742 | break; | ||
2743 | case DMA_DEV_TO_MEM: | ||
2744 | desc->rqcfg.src_inc = 0; | ||
2745 | desc->rqcfg.dst_inc = 1; | ||
2746 | desc->req.rqtype = DEVTOMEM; | ||
2747 | src = pch->fifo_addr; | ||
2748 | dst = dma_addr; | ||
2749 | break; | ||
2750 | default: | ||
2751 | break; | ||
2752 | } | ||
2753 | |||
2754 | desc->rqcfg.brst_size = pch->burst_sz; | ||
2755 | desc->rqcfg.brst_len = 1; | ||
2756 | fill_px(&desc->px, dst, src, period_len); | ||
2757 | |||
2758 | if (!first) | ||
2759 | first = desc; | ||
2760 | else | ||
2761 | list_add_tail(&desc->node, &first->node); | ||
2762 | |||
2763 | dma_addr += period_len; | ||
2764 | } | ||
2765 | |||
2766 | if (!desc) | ||
2767 | return NULL; | ||
2768 | |||
2769 | pch->cyclic = true; | ||
2770 | desc->txd.flags = flags; | ||
2730 | 2771 | ||
2731 | return &desc->txd; | 2772 | return &desc->txd; |
2732 | } | 2773 | } |
diff --git a/drivers/dma/sh/shdma.c b/drivers/dma/sh/shdma.c index b67f45f5c271..5039fbc88254 100644 --- a/drivers/dma/sh/shdma.c +++ b/drivers/dma/sh/shdma.c | |||
@@ -400,8 +400,8 @@ static size_t sh_dmae_get_partial(struct shdma_chan *schan, | |||
400 | shdma_chan); | 400 | shdma_chan); |
401 | struct sh_dmae_desc *sh_desc = container_of(sdesc, | 401 | struct sh_dmae_desc *sh_desc = container_of(sdesc, |
402 | struct sh_dmae_desc, shdma_desc); | 402 | struct sh_dmae_desc, shdma_desc); |
403 | return (sh_desc->hw.tcr - sh_dmae_readl(sh_chan, TCR)) << | 403 | return sh_desc->hw.tcr - |
404 | sh_chan->xmit_shift; | 404 | (sh_dmae_readl(sh_chan, TCR) << sh_chan->xmit_shift); |
405 | } | 405 | } |
406 | 406 | ||
407 | /* Called from error IRQ or NMI */ | 407 | /* Called from error IRQ or NMI */ |
diff --git a/drivers/gpu/drm/ast/ast_ttm.c b/drivers/gpu/drm/ast/ast_ttm.c index 98d670825a1a..6e8887fe6c1b 100644 --- a/drivers/gpu/drm/ast/ast_ttm.c +++ b/drivers/gpu/drm/ast/ast_ttm.c | |||
@@ -323,6 +323,7 @@ int ast_bo_create(struct drm_device *dev, int size, int align, | |||
323 | 323 | ||
324 | astbo->gem.driver_private = NULL; | 324 | astbo->gem.driver_private = NULL; |
325 | astbo->bo.bdev = &ast->ttm.bdev; | 325 | astbo->bo.bdev = &ast->ttm.bdev; |
326 | astbo->bo.bdev->dev_mapping = dev->dev_mapping; | ||
326 | 327 | ||
327 | ast_ttm_placement(astbo, TTM_PL_FLAG_VRAM | TTM_PL_FLAG_SYSTEM); | 328 | ast_ttm_placement(astbo, TTM_PL_FLAG_VRAM | TTM_PL_FLAG_SYSTEM); |
328 | 329 | ||
diff --git a/drivers/gpu/drm/cirrus/cirrus_ttm.c b/drivers/gpu/drm/cirrus/cirrus_ttm.c index 0047012045c2..69fd8f1ac8df 100644 --- a/drivers/gpu/drm/cirrus/cirrus_ttm.c +++ b/drivers/gpu/drm/cirrus/cirrus_ttm.c | |||
@@ -328,6 +328,7 @@ int cirrus_bo_create(struct drm_device *dev, int size, int align, | |||
328 | 328 | ||
329 | cirrusbo->gem.driver_private = NULL; | 329 | cirrusbo->gem.driver_private = NULL; |
330 | cirrusbo->bo.bdev = &cirrus->ttm.bdev; | 330 | cirrusbo->bo.bdev = &cirrus->ttm.bdev; |
331 | cirrusbo->bo.bdev->dev_mapping = dev->dev_mapping; | ||
331 | 332 | ||
332 | cirrus_ttm_placement(cirrusbo, TTM_PL_FLAG_VRAM | TTM_PL_FLAG_SYSTEM); | 333 | cirrus_ttm_placement(cirrusbo, TTM_PL_FLAG_VRAM | TTM_PL_FLAG_SYSTEM); |
333 | 334 | ||
diff --git a/drivers/gpu/drm/drm_irq.c b/drivers/gpu/drm/drm_irq.c index 8bcce7866d36..f92da0a32f0d 100644 --- a/drivers/gpu/drm/drm_irq.c +++ b/drivers/gpu/drm/drm_irq.c | |||
@@ -708,7 +708,10 @@ int drm_calc_vbltimestamp_from_scanoutpos(struct drm_device *dev, int crtc, | |||
708 | /* Subtract time delta from raw timestamp to get final | 708 | /* Subtract time delta from raw timestamp to get final |
709 | * vblank_time timestamp for end of vblank. | 709 | * vblank_time timestamp for end of vblank. |
710 | */ | 710 | */ |
711 | etime = ktime_sub_ns(etime, delta_ns); | 711 | if (delta_ns < 0) |
712 | etime = ktime_add_ns(etime, -delta_ns); | ||
713 | else | ||
714 | etime = ktime_sub_ns(etime, delta_ns); | ||
712 | *vblank_time = ktime_to_timeval(etime); | 715 | *vblank_time = ktime_to_timeval(etime); |
713 | 716 | ||
714 | DRM_DEBUG("crtc %d : v %d p(%d,%d)@ %ld.%ld -> %ld.%ld [e %d us, %d rep]\n", | 717 | DRM_DEBUG("crtc %d : v %d p(%d,%d)@ %ld.%ld -> %ld.%ld [e %d us, %d rep]\n", |
diff --git a/drivers/gpu/drm/i915/i915_reg.h b/drivers/gpu/drm/i915/i915_reg.h index f2326fc60ac9..6f514297c483 100644 --- a/drivers/gpu/drm/i915/i915_reg.h +++ b/drivers/gpu/drm/i915/i915_reg.h | |||
@@ -1856,10 +1856,16 @@ | |||
1856 | #define CRT_HOTPLUG_DETECT_VOLTAGE_475MV (1 << 2) | 1856 | #define CRT_HOTPLUG_DETECT_VOLTAGE_475MV (1 << 2) |
1857 | 1857 | ||
1858 | #define PORT_HOTPLUG_STAT (dev_priv->info->display_mmio_offset + 0x61114) | 1858 | #define PORT_HOTPLUG_STAT (dev_priv->info->display_mmio_offset + 0x61114) |
1859 | /* HDMI/DP bits are gen4+ */ | 1859 | /* |
1860 | #define PORTB_HOTPLUG_LIVE_STATUS (1 << 29) | 1860 | * HDMI/DP bits are gen4+ |
1861 | * | ||
1862 | * WARNING: Bspec for hpd status bits on gen4 seems to be completely confused. | ||
1863 | * Please check the detailed lore in the commit message for for experimental | ||
1864 | * evidence. | ||
1865 | */ | ||
1866 | #define PORTD_HOTPLUG_LIVE_STATUS (1 << 29) | ||
1861 | #define PORTC_HOTPLUG_LIVE_STATUS (1 << 28) | 1867 | #define PORTC_HOTPLUG_LIVE_STATUS (1 << 28) |
1862 | #define PORTD_HOTPLUG_LIVE_STATUS (1 << 27) | 1868 | #define PORTB_HOTPLUG_LIVE_STATUS (1 << 27) |
1863 | #define PORTD_HOTPLUG_INT_STATUS (3 << 21) | 1869 | #define PORTD_HOTPLUG_INT_STATUS (3 << 21) |
1864 | #define PORTC_HOTPLUG_INT_STATUS (3 << 19) | 1870 | #define PORTC_HOTPLUG_INT_STATUS (3 << 19) |
1865 | #define PORTB_HOTPLUG_INT_STATUS (3 << 17) | 1871 | #define PORTB_HOTPLUG_INT_STATUS (3 << 17) |
diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c index 5fb305840db8..e38b45786653 100644 --- a/drivers/gpu/drm/i915/intel_display.c +++ b/drivers/gpu/drm/i915/intel_display.c | |||
@@ -8269,9 +8269,11 @@ check_crtc_state(struct drm_device *dev) | |||
8269 | 8269 | ||
8270 | list_for_each_entry(encoder, &dev->mode_config.encoder_list, | 8270 | list_for_each_entry(encoder, &dev->mode_config.encoder_list, |
8271 | base.head) { | 8271 | base.head) { |
8272 | enum pipe pipe; | ||
8272 | if (encoder->base.crtc != &crtc->base) | 8273 | if (encoder->base.crtc != &crtc->base) |
8273 | continue; | 8274 | continue; |
8274 | if (encoder->get_config) | 8275 | if (encoder->get_config && |
8276 | encoder->get_hw_state(encoder, &pipe)) | ||
8275 | encoder->get_config(encoder, &pipe_config); | 8277 | encoder->get_config(encoder, &pipe_config); |
8276 | } | 8278 | } |
8277 | 8279 | ||
diff --git a/drivers/gpu/drm/i915/intel_panel.c b/drivers/gpu/drm/i915/intel_panel.c index 67e2c1f1c9a8..5950888ae1d0 100644 --- a/drivers/gpu/drm/i915/intel_panel.c +++ b/drivers/gpu/drm/i915/intel_panel.c | |||
@@ -497,8 +497,11 @@ void intel_panel_set_backlight(struct drm_device *dev, u32 level, u32 max) | |||
497 | goto out; | 497 | goto out; |
498 | } | 498 | } |
499 | 499 | ||
500 | /* scale to hardware */ | 500 | /* scale to hardware, but be careful to not overflow */ |
501 | level = level * freq / max; | 501 | if (freq < max) |
502 | level = level * freq / max; | ||
503 | else | ||
504 | level = freq / max * level; | ||
502 | 505 | ||
503 | dev_priv->backlight.level = level; | 506 | dev_priv->backlight.level = level; |
504 | if (dev_priv->backlight.device) | 507 | if (dev_priv->backlight.device) |
@@ -515,6 +518,17 @@ void intel_panel_disable_backlight(struct drm_device *dev) | |||
515 | struct drm_i915_private *dev_priv = dev->dev_private; | 518 | struct drm_i915_private *dev_priv = dev->dev_private; |
516 | unsigned long flags; | 519 | unsigned long flags; |
517 | 520 | ||
521 | /* | ||
522 | * Do not disable backlight on the vgaswitcheroo path. When switching | ||
523 | * away from i915, the other client may depend on i915 to handle the | ||
524 | * backlight. This will leave the backlight on unnecessarily when | ||
525 | * another client is not activated. | ||
526 | */ | ||
527 | if (dev->switch_power_state == DRM_SWITCH_POWER_CHANGING) { | ||
528 | DRM_DEBUG_DRIVER("Skipping backlight disable on vga switch\n"); | ||
529 | return; | ||
530 | } | ||
531 | |||
518 | spin_lock_irqsave(&dev_priv->backlight.lock, flags); | 532 | spin_lock_irqsave(&dev_priv->backlight.lock, flags); |
519 | 533 | ||
520 | dev_priv->backlight.enabled = false; | 534 | dev_priv->backlight.enabled = false; |
diff --git a/drivers/gpu/drm/i915/intel_pm.c b/drivers/gpu/drm/i915/intel_pm.c index f895d1508df8..b0e4a0bd1313 100644 --- a/drivers/gpu/drm/i915/intel_pm.c +++ b/drivers/gpu/drm/i915/intel_pm.c | |||
@@ -5063,8 +5063,26 @@ static void __intel_set_power_well(struct drm_device *dev, bool enable) | |||
5063 | } | 5063 | } |
5064 | } else { | 5064 | } else { |
5065 | if (enable_requested) { | 5065 | if (enable_requested) { |
5066 | unsigned long irqflags; | ||
5067 | enum pipe p; | ||
5068 | |||
5066 | I915_WRITE(HSW_PWR_WELL_DRIVER, 0); | 5069 | I915_WRITE(HSW_PWR_WELL_DRIVER, 0); |
5070 | POSTING_READ(HSW_PWR_WELL_DRIVER); | ||
5067 | DRM_DEBUG_KMS("Requesting to disable the power well\n"); | 5071 | DRM_DEBUG_KMS("Requesting to disable the power well\n"); |
5072 | |||
5073 | /* | ||
5074 | * After this, the registers on the pipes that are part | ||
5075 | * of the power well will become zero, so we have to | ||
5076 | * adjust our counters according to that. | ||
5077 | * | ||
5078 | * FIXME: Should we do this in general in | ||
5079 | * drm_vblank_post_modeset? | ||
5080 | */ | ||
5081 | spin_lock_irqsave(&dev->vbl_lock, irqflags); | ||
5082 | for_each_pipe(p) | ||
5083 | if (p != PIPE_A) | ||
5084 | dev->last_vblank[p] = 0; | ||
5085 | spin_unlock_irqrestore(&dev->vbl_lock, irqflags); | ||
5068 | } | 5086 | } |
5069 | } | 5087 | } |
5070 | } | 5088 | } |
diff --git a/drivers/gpu/drm/mgag200/mgag200_ttm.c b/drivers/gpu/drm/mgag200/mgag200_ttm.c index 13878d5de063..d70e4a92773b 100644 --- a/drivers/gpu/drm/mgag200/mgag200_ttm.c +++ b/drivers/gpu/drm/mgag200/mgag200_ttm.c | |||
@@ -323,6 +323,7 @@ int mgag200_bo_create(struct drm_device *dev, int size, int align, | |||
323 | 323 | ||
324 | mgabo->gem.driver_private = NULL; | 324 | mgabo->gem.driver_private = NULL; |
325 | mgabo->bo.bdev = &mdev->ttm.bdev; | 325 | mgabo->bo.bdev = &mdev->ttm.bdev; |
326 | mgabo->bo.bdev->dev_mapping = dev->dev_mapping; | ||
326 | 327 | ||
327 | mgag200_ttm_placement(mgabo, TTM_PL_FLAG_VRAM | TTM_PL_FLAG_SYSTEM); | 328 | mgag200_ttm_placement(mgabo, TTM_PL_FLAG_VRAM | TTM_PL_FLAG_SYSTEM); |
328 | 329 | ||
diff --git a/drivers/gpu/drm/radeon/btc_dpm.c b/drivers/gpu/drm/radeon/btc_dpm.c index 0bfd55e08820..9953e1fbc46d 100644 --- a/drivers/gpu/drm/radeon/btc_dpm.c +++ b/drivers/gpu/drm/radeon/btc_dpm.c | |||
@@ -2548,9 +2548,6 @@ int btc_dpm_init(struct radeon_device *rdev) | |||
2548 | { | 2548 | { |
2549 | struct rv7xx_power_info *pi; | 2549 | struct rv7xx_power_info *pi; |
2550 | struct evergreen_power_info *eg_pi; | 2550 | struct evergreen_power_info *eg_pi; |
2551 | int index = GetIndexIntoMasterTable(DATA, ASIC_InternalSS_Info); | ||
2552 | u16 data_offset, size; | ||
2553 | u8 frev, crev; | ||
2554 | struct atom_clock_dividers dividers; | 2551 | struct atom_clock_dividers dividers; |
2555 | int ret; | 2552 | int ret; |
2556 | 2553 | ||
@@ -2633,16 +2630,7 @@ int btc_dpm_init(struct radeon_device *rdev) | |||
2633 | eg_pi->vddci_control = | 2630 | eg_pi->vddci_control = |
2634 | radeon_atom_is_voltage_gpio(rdev, SET_VOLTAGE_TYPE_ASIC_VDDCI, 0); | 2631 | radeon_atom_is_voltage_gpio(rdev, SET_VOLTAGE_TYPE_ASIC_VDDCI, 0); |
2635 | 2632 | ||
2636 | if (atom_parse_data_header(rdev->mode_info.atom_context, index, &size, | 2633 | rv770_get_engine_memory_ss(rdev); |
2637 | &frev, &crev, &data_offset)) { | ||
2638 | pi->sclk_ss = true; | ||
2639 | pi->mclk_ss = true; | ||
2640 | pi->dynamic_ss = true; | ||
2641 | } else { | ||
2642 | pi->sclk_ss = false; | ||
2643 | pi->mclk_ss = false; | ||
2644 | pi->dynamic_ss = true; | ||
2645 | } | ||
2646 | 2634 | ||
2647 | pi->asi = RV770_ASI_DFLT; | 2635 | pi->asi = RV770_ASI_DFLT; |
2648 | pi->pasi = CYPRESS_HASI_DFLT; | 2636 | pi->pasi = CYPRESS_HASI_DFLT; |
@@ -2659,8 +2647,7 @@ int btc_dpm_init(struct radeon_device *rdev) | |||
2659 | 2647 | ||
2660 | pi->dynamic_pcie_gen2 = true; | 2648 | pi->dynamic_pcie_gen2 = true; |
2661 | 2649 | ||
2662 | if (pi->gfx_clock_gating && | 2650 | if (rdev->pm.int_thermal_type != THERMAL_TYPE_NONE) |
2663 | (rdev->pm.int_thermal_type != THERMAL_TYPE_NONE)) | ||
2664 | pi->thermal_protection = true; | 2651 | pi->thermal_protection = true; |
2665 | else | 2652 | else |
2666 | pi->thermal_protection = false; | 2653 | pi->thermal_protection = false; |
diff --git a/drivers/gpu/drm/radeon/cik.c b/drivers/gpu/drm/radeon/cik.c index 6dacec4e2090..8928bd109c16 100644 --- a/drivers/gpu/drm/radeon/cik.c +++ b/drivers/gpu/drm/radeon/cik.c | |||
@@ -2587,9 +2587,11 @@ u32 cik_compute_ring_get_rptr(struct radeon_device *rdev, | |||
2587 | if (rdev->wb.enabled) { | 2587 | if (rdev->wb.enabled) { |
2588 | rptr = le32_to_cpu(rdev->wb.wb[ring->rptr_offs/4]); | 2588 | rptr = le32_to_cpu(rdev->wb.wb[ring->rptr_offs/4]); |
2589 | } else { | 2589 | } else { |
2590 | mutex_lock(&rdev->srbm_mutex); | ||
2590 | cik_srbm_select(rdev, ring->me, ring->pipe, ring->queue, 0); | 2591 | cik_srbm_select(rdev, ring->me, ring->pipe, ring->queue, 0); |
2591 | rptr = RREG32(CP_HQD_PQ_RPTR); | 2592 | rptr = RREG32(CP_HQD_PQ_RPTR); |
2592 | cik_srbm_select(rdev, 0, 0, 0, 0); | 2593 | cik_srbm_select(rdev, 0, 0, 0, 0); |
2594 | mutex_unlock(&rdev->srbm_mutex); | ||
2593 | } | 2595 | } |
2594 | rptr = (rptr & ring->ptr_reg_mask) >> ring->ptr_reg_shift; | 2596 | rptr = (rptr & ring->ptr_reg_mask) >> ring->ptr_reg_shift; |
2595 | 2597 | ||
@@ -2604,9 +2606,11 @@ u32 cik_compute_ring_get_wptr(struct radeon_device *rdev, | |||
2604 | if (rdev->wb.enabled) { | 2606 | if (rdev->wb.enabled) { |
2605 | wptr = le32_to_cpu(rdev->wb.wb[ring->wptr_offs/4]); | 2607 | wptr = le32_to_cpu(rdev->wb.wb[ring->wptr_offs/4]); |
2606 | } else { | 2608 | } else { |
2609 | mutex_lock(&rdev->srbm_mutex); | ||
2607 | cik_srbm_select(rdev, ring->me, ring->pipe, ring->queue, 0); | 2610 | cik_srbm_select(rdev, ring->me, ring->pipe, ring->queue, 0); |
2608 | wptr = RREG32(CP_HQD_PQ_WPTR); | 2611 | wptr = RREG32(CP_HQD_PQ_WPTR); |
2609 | cik_srbm_select(rdev, 0, 0, 0, 0); | 2612 | cik_srbm_select(rdev, 0, 0, 0, 0); |
2613 | mutex_unlock(&rdev->srbm_mutex); | ||
2610 | } | 2614 | } |
2611 | wptr = (wptr & ring->ptr_reg_mask) >> ring->ptr_reg_shift; | 2615 | wptr = (wptr & ring->ptr_reg_mask) >> ring->ptr_reg_shift; |
2612 | 2616 | ||
@@ -2897,6 +2901,7 @@ static int cik_cp_compute_resume(struct radeon_device *rdev) | |||
2897 | WREG32(CP_CPF_DEBUG, tmp); | 2901 | WREG32(CP_CPF_DEBUG, tmp); |
2898 | 2902 | ||
2899 | /* init the pipes */ | 2903 | /* init the pipes */ |
2904 | mutex_lock(&rdev->srbm_mutex); | ||
2900 | for (i = 0; i < (rdev->mec.num_pipe * rdev->mec.num_mec); i++) { | 2905 | for (i = 0; i < (rdev->mec.num_pipe * rdev->mec.num_mec); i++) { |
2901 | int me = (i < 4) ? 1 : 2; | 2906 | int me = (i < 4) ? 1 : 2; |
2902 | int pipe = (i < 4) ? i : (i - 4); | 2907 | int pipe = (i < 4) ? i : (i - 4); |
@@ -2919,6 +2924,7 @@ static int cik_cp_compute_resume(struct radeon_device *rdev) | |||
2919 | WREG32(CP_HPD_EOP_CONTROL, tmp); | 2924 | WREG32(CP_HPD_EOP_CONTROL, tmp); |
2920 | } | 2925 | } |
2921 | cik_srbm_select(rdev, 0, 0, 0, 0); | 2926 | cik_srbm_select(rdev, 0, 0, 0, 0); |
2927 | mutex_unlock(&rdev->srbm_mutex); | ||
2922 | 2928 | ||
2923 | /* init the queues. Just two for now. */ | 2929 | /* init the queues. Just two for now. */ |
2924 | for (i = 0; i < 2; i++) { | 2930 | for (i = 0; i < 2; i++) { |
@@ -2972,6 +2978,7 @@ static int cik_cp_compute_resume(struct radeon_device *rdev) | |||
2972 | mqd->static_thread_mgmt23[0] = 0xffffffff; | 2978 | mqd->static_thread_mgmt23[0] = 0xffffffff; |
2973 | mqd->static_thread_mgmt23[1] = 0xffffffff; | 2979 | mqd->static_thread_mgmt23[1] = 0xffffffff; |
2974 | 2980 | ||
2981 | mutex_lock(&rdev->srbm_mutex); | ||
2975 | cik_srbm_select(rdev, rdev->ring[idx].me, | 2982 | cik_srbm_select(rdev, rdev->ring[idx].me, |
2976 | rdev->ring[idx].pipe, | 2983 | rdev->ring[idx].pipe, |
2977 | rdev->ring[idx].queue, 0); | 2984 | rdev->ring[idx].queue, 0); |
@@ -3099,6 +3106,7 @@ static int cik_cp_compute_resume(struct radeon_device *rdev) | |||
3099 | WREG32(CP_HQD_ACTIVE, mqd->queue_state.cp_hqd_active); | 3106 | WREG32(CP_HQD_ACTIVE, mqd->queue_state.cp_hqd_active); |
3100 | 3107 | ||
3101 | cik_srbm_select(rdev, 0, 0, 0, 0); | 3108 | cik_srbm_select(rdev, 0, 0, 0, 0); |
3109 | mutex_unlock(&rdev->srbm_mutex); | ||
3102 | 3110 | ||
3103 | radeon_bo_kunmap(rdev->ring[idx].mqd_obj); | 3111 | radeon_bo_kunmap(rdev->ring[idx].mqd_obj); |
3104 | radeon_bo_unreserve(rdev->ring[idx].mqd_obj); | 3112 | radeon_bo_unreserve(rdev->ring[idx].mqd_obj); |
@@ -4320,6 +4328,7 @@ static int cik_pcie_gart_enable(struct radeon_device *rdev) | |||
4320 | 4328 | ||
4321 | /* XXX SH_MEM regs */ | 4329 | /* XXX SH_MEM regs */ |
4322 | /* where to put LDS, scratch, GPUVM in FSA64 space */ | 4330 | /* where to put LDS, scratch, GPUVM in FSA64 space */ |
4331 | mutex_lock(&rdev->srbm_mutex); | ||
4323 | for (i = 0; i < 16; i++) { | 4332 | for (i = 0; i < 16; i++) { |
4324 | cik_srbm_select(rdev, 0, 0, 0, i); | 4333 | cik_srbm_select(rdev, 0, 0, 0, i); |
4325 | /* CP and shaders */ | 4334 | /* CP and shaders */ |
@@ -4335,6 +4344,7 @@ static int cik_pcie_gart_enable(struct radeon_device *rdev) | |||
4335 | /* XXX SDMA RLC - todo */ | 4344 | /* XXX SDMA RLC - todo */ |
4336 | } | 4345 | } |
4337 | cik_srbm_select(rdev, 0, 0, 0, 0); | 4346 | cik_srbm_select(rdev, 0, 0, 0, 0); |
4347 | mutex_unlock(&rdev->srbm_mutex); | ||
4338 | 4348 | ||
4339 | cik_pcie_gart_tlb_flush(rdev); | 4349 | cik_pcie_gart_tlb_flush(rdev); |
4340 | DRM_INFO("PCIE GART of %uM enabled (table at 0x%016llX).\n", | 4350 | DRM_INFO("PCIE GART of %uM enabled (table at 0x%016llX).\n", |
@@ -5954,6 +5964,8 @@ static int cik_startup(struct radeon_device *rdev) | |||
5954 | struct radeon_ring *ring; | 5964 | struct radeon_ring *ring; |
5955 | int r; | 5965 | int r; |
5956 | 5966 | ||
5967 | cik_mc_program(rdev); | ||
5968 | |||
5957 | if (rdev->flags & RADEON_IS_IGP) { | 5969 | if (rdev->flags & RADEON_IS_IGP) { |
5958 | if (!rdev->me_fw || !rdev->pfp_fw || !rdev->ce_fw || | 5970 | if (!rdev->me_fw || !rdev->pfp_fw || !rdev->ce_fw || |
5959 | !rdev->mec_fw || !rdev->sdma_fw || !rdev->rlc_fw) { | 5971 | !rdev->mec_fw || !rdev->sdma_fw || !rdev->rlc_fw) { |
@@ -5985,7 +5997,6 @@ static int cik_startup(struct radeon_device *rdev) | |||
5985 | if (r) | 5997 | if (r) |
5986 | return r; | 5998 | return r; |
5987 | 5999 | ||
5988 | cik_mc_program(rdev); | ||
5989 | r = cik_pcie_gart_enable(rdev); | 6000 | r = cik_pcie_gart_enable(rdev); |
5990 | if (r) | 6001 | if (r) |
5991 | return r; | 6002 | return r; |
@@ -6194,7 +6205,7 @@ int cik_suspend(struct radeon_device *rdev) | |||
6194 | radeon_vm_manager_fini(rdev); | 6205 | radeon_vm_manager_fini(rdev); |
6195 | cik_cp_enable(rdev, false); | 6206 | cik_cp_enable(rdev, false); |
6196 | cik_sdma_enable(rdev, false); | 6207 | cik_sdma_enable(rdev, false); |
6197 | r600_uvd_rbc_stop(rdev); | 6208 | r600_uvd_stop(rdev); |
6198 | radeon_uvd_suspend(rdev); | 6209 | radeon_uvd_suspend(rdev); |
6199 | cik_irq_suspend(rdev); | 6210 | cik_irq_suspend(rdev); |
6200 | radeon_wb_disable(rdev); | 6211 | radeon_wb_disable(rdev); |
@@ -6358,6 +6369,7 @@ void cik_fini(struct radeon_device *rdev) | |||
6358 | radeon_vm_manager_fini(rdev); | 6369 | radeon_vm_manager_fini(rdev); |
6359 | radeon_ib_pool_fini(rdev); | 6370 | radeon_ib_pool_fini(rdev); |
6360 | radeon_irq_kms_fini(rdev); | 6371 | radeon_irq_kms_fini(rdev); |
6372 | r600_uvd_stop(rdev); | ||
6361 | radeon_uvd_fini(rdev); | 6373 | radeon_uvd_fini(rdev); |
6362 | cik_pcie_gart_fini(rdev); | 6374 | cik_pcie_gart_fini(rdev); |
6363 | r600_vram_scratch_fini(rdev); | 6375 | r600_vram_scratch_fini(rdev); |
@@ -6978,7 +6990,7 @@ int cik_uvd_resume(struct radeon_device *rdev) | |||
6978 | 6990 | ||
6979 | /* programm the VCPU memory controller bits 0-27 */ | 6991 | /* programm the VCPU memory controller bits 0-27 */ |
6980 | addr = rdev->uvd.gpu_addr >> 3; | 6992 | addr = rdev->uvd.gpu_addr >> 3; |
6981 | size = RADEON_GPU_PAGE_ALIGN(rdev->uvd.fw_size + 4) >> 3; | 6993 | size = RADEON_GPU_PAGE_ALIGN(rdev->uvd_fw->size + 4) >> 3; |
6982 | WREG32(UVD_VCPU_CACHE_OFFSET0, addr); | 6994 | WREG32(UVD_VCPU_CACHE_OFFSET0, addr); |
6983 | WREG32(UVD_VCPU_CACHE_SIZE0, size); | 6995 | WREG32(UVD_VCPU_CACHE_SIZE0, size); |
6984 | 6996 | ||
diff --git a/drivers/gpu/drm/radeon/cypress_dpm.c b/drivers/gpu/drm/radeon/cypress_dpm.c index 9bcdd174780f..7e5d0b570a30 100644 --- a/drivers/gpu/drm/radeon/cypress_dpm.c +++ b/drivers/gpu/drm/radeon/cypress_dpm.c | |||
@@ -2038,9 +2038,6 @@ int cypress_dpm_init(struct radeon_device *rdev) | |||
2038 | { | 2038 | { |
2039 | struct rv7xx_power_info *pi; | 2039 | struct rv7xx_power_info *pi; |
2040 | struct evergreen_power_info *eg_pi; | 2040 | struct evergreen_power_info *eg_pi; |
2041 | int index = GetIndexIntoMasterTable(DATA, ASIC_InternalSS_Info); | ||
2042 | uint16_t data_offset, size; | ||
2043 | uint8_t frev, crev; | ||
2044 | struct atom_clock_dividers dividers; | 2041 | struct atom_clock_dividers dividers; |
2045 | int ret; | 2042 | int ret; |
2046 | 2043 | ||
@@ -2092,16 +2089,7 @@ int cypress_dpm_init(struct radeon_device *rdev) | |||
2092 | eg_pi->vddci_control = | 2089 | eg_pi->vddci_control = |
2093 | radeon_atom_is_voltage_gpio(rdev, SET_VOLTAGE_TYPE_ASIC_VDDCI, 0); | 2090 | radeon_atom_is_voltage_gpio(rdev, SET_VOLTAGE_TYPE_ASIC_VDDCI, 0); |
2094 | 2091 | ||
2095 | if (atom_parse_data_header(rdev->mode_info.atom_context, index, &size, | 2092 | rv770_get_engine_memory_ss(rdev); |
2096 | &frev, &crev, &data_offset)) { | ||
2097 | pi->sclk_ss = true; | ||
2098 | pi->mclk_ss = true; | ||
2099 | pi->dynamic_ss = true; | ||
2100 | } else { | ||
2101 | pi->sclk_ss = false; | ||
2102 | pi->mclk_ss = false; | ||
2103 | pi->dynamic_ss = true; | ||
2104 | } | ||
2105 | 2093 | ||
2106 | pi->asi = RV770_ASI_DFLT; | 2094 | pi->asi = RV770_ASI_DFLT; |
2107 | pi->pasi = CYPRESS_HASI_DFLT; | 2095 | pi->pasi = CYPRESS_HASI_DFLT; |
@@ -2122,8 +2110,7 @@ int cypress_dpm_init(struct radeon_device *rdev) | |||
2122 | 2110 | ||
2123 | pi->dynamic_pcie_gen2 = true; | 2111 | pi->dynamic_pcie_gen2 = true; |
2124 | 2112 | ||
2125 | if (pi->gfx_clock_gating && | 2113 | if (rdev->pm.int_thermal_type != THERMAL_TYPE_NONE) |
2126 | (rdev->pm.int_thermal_type != THERMAL_TYPE_NONE)) | ||
2127 | pi->thermal_protection = true; | 2114 | pi->thermal_protection = true; |
2128 | else | 2115 | else |
2129 | pi->thermal_protection = false; | 2116 | pi->thermal_protection = false; |
diff --git a/drivers/gpu/drm/radeon/evergreen.c b/drivers/gpu/drm/radeon/evergreen.c index 038dcac7670c..d5b49e33315e 100644 --- a/drivers/gpu/drm/radeon/evergreen.c +++ b/drivers/gpu/drm/radeon/evergreen.c | |||
@@ -5106,6 +5106,8 @@ static int evergreen_startup(struct radeon_device *rdev) | |||
5106 | /* enable aspm */ | 5106 | /* enable aspm */ |
5107 | evergreen_program_aspm(rdev); | 5107 | evergreen_program_aspm(rdev); |
5108 | 5108 | ||
5109 | evergreen_mc_program(rdev); | ||
5110 | |||
5109 | if (ASIC_IS_DCE5(rdev)) { | 5111 | if (ASIC_IS_DCE5(rdev)) { |
5110 | if (!rdev->me_fw || !rdev->pfp_fw || !rdev->rlc_fw || !rdev->mc_fw) { | 5112 | if (!rdev->me_fw || !rdev->pfp_fw || !rdev->rlc_fw || !rdev->mc_fw) { |
5111 | r = ni_init_microcode(rdev); | 5113 | r = ni_init_microcode(rdev); |
@@ -5133,7 +5135,6 @@ static int evergreen_startup(struct radeon_device *rdev) | |||
5133 | if (r) | 5135 | if (r) |
5134 | return r; | 5136 | return r; |
5135 | 5137 | ||
5136 | evergreen_mc_program(rdev); | ||
5137 | if (rdev->flags & RADEON_IS_AGP) { | 5138 | if (rdev->flags & RADEON_IS_AGP) { |
5138 | evergreen_agp_enable(rdev); | 5139 | evergreen_agp_enable(rdev); |
5139 | } else { | 5140 | } else { |
@@ -5291,10 +5292,10 @@ int evergreen_resume(struct radeon_device *rdev) | |||
5291 | int evergreen_suspend(struct radeon_device *rdev) | 5292 | int evergreen_suspend(struct radeon_device *rdev) |
5292 | { | 5293 | { |
5293 | r600_audio_fini(rdev); | 5294 | r600_audio_fini(rdev); |
5295 | r600_uvd_stop(rdev); | ||
5294 | radeon_uvd_suspend(rdev); | 5296 | radeon_uvd_suspend(rdev); |
5295 | r700_cp_stop(rdev); | 5297 | r700_cp_stop(rdev); |
5296 | r600_dma_stop(rdev); | 5298 | r600_dma_stop(rdev); |
5297 | r600_uvd_rbc_stop(rdev); | ||
5298 | evergreen_irq_suspend(rdev); | 5299 | evergreen_irq_suspend(rdev); |
5299 | radeon_wb_disable(rdev); | 5300 | radeon_wb_disable(rdev); |
5300 | evergreen_pcie_gart_disable(rdev); | 5301 | evergreen_pcie_gart_disable(rdev); |
@@ -5429,6 +5430,7 @@ void evergreen_fini(struct radeon_device *rdev) | |||
5429 | radeon_ib_pool_fini(rdev); | 5430 | radeon_ib_pool_fini(rdev); |
5430 | radeon_irq_kms_fini(rdev); | 5431 | radeon_irq_kms_fini(rdev); |
5431 | evergreen_pcie_gart_fini(rdev); | 5432 | evergreen_pcie_gart_fini(rdev); |
5433 | r600_uvd_stop(rdev); | ||
5432 | radeon_uvd_fini(rdev); | 5434 | radeon_uvd_fini(rdev); |
5433 | r600_vram_scratch_fini(rdev); | 5435 | r600_vram_scratch_fini(rdev); |
5434 | radeon_gem_fini(rdev); | 5436 | radeon_gem_fini(rdev); |
diff --git a/drivers/gpu/drm/radeon/evergreen_hdmi.c b/drivers/gpu/drm/radeon/evergreen_hdmi.c index bb9ea3641312..b0e280058b9b 100644 --- a/drivers/gpu/drm/radeon/evergreen_hdmi.c +++ b/drivers/gpu/drm/radeon/evergreen_hdmi.c | |||
@@ -148,18 +148,40 @@ static void evergreen_audio_set_dto(struct drm_encoder *encoder, u32 clock) | |||
148 | struct radeon_encoder_atom_dig *dig = radeon_encoder->enc_priv; | 148 | struct radeon_encoder_atom_dig *dig = radeon_encoder->enc_priv; |
149 | struct radeon_crtc *radeon_crtc = to_radeon_crtc(encoder->crtc); | 149 | struct radeon_crtc *radeon_crtc = to_radeon_crtc(encoder->crtc); |
150 | u32 base_rate = 24000; | 150 | u32 base_rate = 24000; |
151 | u32 max_ratio = clock / base_rate; | ||
152 | u32 dto_phase; | ||
153 | u32 dto_modulo = clock; | ||
154 | u32 wallclock_ratio; | ||
155 | u32 dto_cntl; | ||
151 | 156 | ||
152 | if (!dig || !dig->afmt) | 157 | if (!dig || !dig->afmt) |
153 | return; | 158 | return; |
154 | 159 | ||
160 | if (max_ratio >= 8) { | ||
161 | dto_phase = 192 * 1000; | ||
162 | wallclock_ratio = 3; | ||
163 | } else if (max_ratio >= 4) { | ||
164 | dto_phase = 96 * 1000; | ||
165 | wallclock_ratio = 2; | ||
166 | } else if (max_ratio >= 2) { | ||
167 | dto_phase = 48 * 1000; | ||
168 | wallclock_ratio = 1; | ||
169 | } else { | ||
170 | dto_phase = 24 * 1000; | ||
171 | wallclock_ratio = 0; | ||
172 | } | ||
173 | dto_cntl = RREG32(DCCG_AUDIO_DTO0_CNTL) & ~DCCG_AUDIO_DTO_WALLCLOCK_RATIO_MASK; | ||
174 | dto_cntl |= DCCG_AUDIO_DTO_WALLCLOCK_RATIO(wallclock_ratio); | ||
175 | WREG32(DCCG_AUDIO_DTO0_CNTL, dto_cntl); | ||
176 | |||
155 | /* XXX two dtos; generally use dto0 for hdmi */ | 177 | /* XXX two dtos; generally use dto0 for hdmi */ |
156 | /* Express [24MHz / target pixel clock] as an exact rational | 178 | /* Express [24MHz / target pixel clock] as an exact rational |
157 | * number (coefficient of two integer numbers. DCCG_AUDIO_DTOx_PHASE | 179 | * number (coefficient of two integer numbers. DCCG_AUDIO_DTOx_PHASE |
158 | * is the numerator, DCCG_AUDIO_DTOx_MODULE is the denominator | 180 | * is the numerator, DCCG_AUDIO_DTOx_MODULE is the denominator |
159 | */ | 181 | */ |
160 | WREG32(DCCG_AUDIO_DTO_SOURCE, DCCG_AUDIO_DTO0_SOURCE_SEL(radeon_crtc->crtc_id)); | 182 | WREG32(DCCG_AUDIO_DTO_SOURCE, DCCG_AUDIO_DTO0_SOURCE_SEL(radeon_crtc->crtc_id)); |
161 | WREG32(DCCG_AUDIO_DTO0_PHASE, base_rate * 100); | 183 | WREG32(DCCG_AUDIO_DTO0_PHASE, dto_phase); |
162 | WREG32(DCCG_AUDIO_DTO0_MODULE, clock * 100); | 184 | WREG32(DCCG_AUDIO_DTO0_MODULE, dto_modulo); |
163 | } | 185 | } |
164 | 186 | ||
165 | 187 | ||
diff --git a/drivers/gpu/drm/radeon/evergreend.h b/drivers/gpu/drm/radeon/evergreend.h index a7baf67aef6c..0d582ac1dc31 100644 --- a/drivers/gpu/drm/radeon/evergreend.h +++ b/drivers/gpu/drm/radeon/evergreend.h | |||
@@ -497,6 +497,9 @@ | |||
497 | #define DCCG_AUDIO_DTO0_MODULE 0x05b4 | 497 | #define DCCG_AUDIO_DTO0_MODULE 0x05b4 |
498 | #define DCCG_AUDIO_DTO0_LOAD 0x05b8 | 498 | #define DCCG_AUDIO_DTO0_LOAD 0x05b8 |
499 | #define DCCG_AUDIO_DTO0_CNTL 0x05bc | 499 | #define DCCG_AUDIO_DTO0_CNTL 0x05bc |
500 | # define DCCG_AUDIO_DTO_WALLCLOCK_RATIO(x) (((x) & 7) << 0) | ||
501 | # define DCCG_AUDIO_DTO_WALLCLOCK_RATIO_MASK 7 | ||
502 | # define DCCG_AUDIO_DTO_WALLCLOCK_RATIO_SHIFT 0 | ||
500 | 503 | ||
501 | #define DCCG_AUDIO_DTO1_PHASE 0x05c0 | 504 | #define DCCG_AUDIO_DTO1_PHASE 0x05c0 |
502 | #define DCCG_AUDIO_DTO1_MODULE 0x05c4 | 505 | #define DCCG_AUDIO_DTO1_MODULE 0x05c4 |
diff --git a/drivers/gpu/drm/radeon/ni.c b/drivers/gpu/drm/radeon/ni.c index 56bd4f3be4fe..ccb4f8b54852 100644 --- a/drivers/gpu/drm/radeon/ni.c +++ b/drivers/gpu/drm/radeon/ni.c | |||
@@ -794,9 +794,13 @@ int ni_init_microcode(struct radeon_device *rdev) | |||
794 | if ((rdev->family >= CHIP_BARTS) && (rdev->family <= CHIP_CAYMAN)) { | 794 | if ((rdev->family >= CHIP_BARTS) && (rdev->family <= CHIP_CAYMAN)) { |
795 | snprintf(fw_name, sizeof(fw_name), "radeon/%s_smc.bin", chip_name); | 795 | snprintf(fw_name, sizeof(fw_name), "radeon/%s_smc.bin", chip_name); |
796 | err = request_firmware(&rdev->smc_fw, fw_name, rdev->dev); | 796 | err = request_firmware(&rdev->smc_fw, fw_name, rdev->dev); |
797 | if (err) | 797 | if (err) { |
798 | goto out; | 798 | printk(KERN_ERR |
799 | if (rdev->smc_fw->size != smc_req_size) { | 799 | "smc: error loading firmware \"%s\"\n", |
800 | fw_name); | ||
801 | release_firmware(rdev->smc_fw); | ||
802 | rdev->smc_fw = NULL; | ||
803 | } else if (rdev->smc_fw->size != smc_req_size) { | ||
800 | printk(KERN_ERR | 804 | printk(KERN_ERR |
801 | "ni_mc: Bogus length %zu in firmware \"%s\"\n", | 805 | "ni_mc: Bogus length %zu in firmware \"%s\"\n", |
802 | rdev->mc_fw->size, fw_name); | 806 | rdev->mc_fw->size, fw_name); |
@@ -2079,6 +2083,8 @@ static int cayman_startup(struct radeon_device *rdev) | |||
2079 | /* enable aspm */ | 2083 | /* enable aspm */ |
2080 | evergreen_program_aspm(rdev); | 2084 | evergreen_program_aspm(rdev); |
2081 | 2085 | ||
2086 | evergreen_mc_program(rdev); | ||
2087 | |||
2082 | if (rdev->flags & RADEON_IS_IGP) { | 2088 | if (rdev->flags & RADEON_IS_IGP) { |
2083 | if (!rdev->me_fw || !rdev->pfp_fw || !rdev->rlc_fw) { | 2089 | if (!rdev->me_fw || !rdev->pfp_fw || !rdev->rlc_fw) { |
2084 | r = ni_init_microcode(rdev); | 2090 | r = ni_init_microcode(rdev); |
@@ -2107,7 +2113,6 @@ static int cayman_startup(struct radeon_device *rdev) | |||
2107 | if (r) | 2113 | if (r) |
2108 | return r; | 2114 | return r; |
2109 | 2115 | ||
2110 | evergreen_mc_program(rdev); | ||
2111 | r = cayman_pcie_gart_enable(rdev); | 2116 | r = cayman_pcie_gart_enable(rdev); |
2112 | if (r) | 2117 | if (r) |
2113 | return r; | 2118 | return r; |
@@ -2286,7 +2291,7 @@ int cayman_suspend(struct radeon_device *rdev) | |||
2286 | radeon_vm_manager_fini(rdev); | 2291 | radeon_vm_manager_fini(rdev); |
2287 | cayman_cp_enable(rdev, false); | 2292 | cayman_cp_enable(rdev, false); |
2288 | cayman_dma_stop(rdev); | 2293 | cayman_dma_stop(rdev); |
2289 | r600_uvd_rbc_stop(rdev); | 2294 | r600_uvd_stop(rdev); |
2290 | radeon_uvd_suspend(rdev); | 2295 | radeon_uvd_suspend(rdev); |
2291 | evergreen_irq_suspend(rdev); | 2296 | evergreen_irq_suspend(rdev); |
2292 | radeon_wb_disable(rdev); | 2297 | radeon_wb_disable(rdev); |
@@ -2418,6 +2423,7 @@ void cayman_fini(struct radeon_device *rdev) | |||
2418 | radeon_vm_manager_fini(rdev); | 2423 | radeon_vm_manager_fini(rdev); |
2419 | radeon_ib_pool_fini(rdev); | 2424 | radeon_ib_pool_fini(rdev); |
2420 | radeon_irq_kms_fini(rdev); | 2425 | radeon_irq_kms_fini(rdev); |
2426 | r600_uvd_stop(rdev); | ||
2421 | radeon_uvd_fini(rdev); | 2427 | radeon_uvd_fini(rdev); |
2422 | cayman_pcie_gart_fini(rdev); | 2428 | cayman_pcie_gart_fini(rdev); |
2423 | r600_vram_scratch_fini(rdev); | 2429 | r600_vram_scratch_fini(rdev); |
diff --git a/drivers/gpu/drm/radeon/ni_dpm.c b/drivers/gpu/drm/radeon/ni_dpm.c index 4f9b9bc20daa..f0f5f748938a 100644 --- a/drivers/gpu/drm/radeon/ni_dpm.c +++ b/drivers/gpu/drm/radeon/ni_dpm.c | |||
@@ -4067,9 +4067,6 @@ int ni_dpm_init(struct radeon_device *rdev) | |||
4067 | struct rv7xx_power_info *pi; | 4067 | struct rv7xx_power_info *pi; |
4068 | struct evergreen_power_info *eg_pi; | 4068 | struct evergreen_power_info *eg_pi; |
4069 | struct ni_power_info *ni_pi; | 4069 | struct ni_power_info *ni_pi; |
4070 | int index = GetIndexIntoMasterTable(DATA, ASIC_InternalSS_Info); | ||
4071 | u16 data_offset, size; | ||
4072 | u8 frev, crev; | ||
4073 | struct atom_clock_dividers dividers; | 4070 | struct atom_clock_dividers dividers; |
4074 | int ret; | 4071 | int ret; |
4075 | 4072 | ||
@@ -4162,16 +4159,7 @@ int ni_dpm_init(struct radeon_device *rdev) | |||
4162 | eg_pi->vddci_control = | 4159 | eg_pi->vddci_control = |
4163 | radeon_atom_is_voltage_gpio(rdev, SET_VOLTAGE_TYPE_ASIC_VDDCI, 0); | 4160 | radeon_atom_is_voltage_gpio(rdev, SET_VOLTAGE_TYPE_ASIC_VDDCI, 0); |
4164 | 4161 | ||
4165 | if (atom_parse_data_header(rdev->mode_info.atom_context, index, &size, | 4162 | rv770_get_engine_memory_ss(rdev); |
4166 | &frev, &crev, &data_offset)) { | ||
4167 | pi->sclk_ss = true; | ||
4168 | pi->mclk_ss = true; | ||
4169 | pi->dynamic_ss = true; | ||
4170 | } else { | ||
4171 | pi->sclk_ss = false; | ||
4172 | pi->mclk_ss = false; | ||
4173 | pi->dynamic_ss = true; | ||
4174 | } | ||
4175 | 4163 | ||
4176 | pi->asi = RV770_ASI_DFLT; | 4164 | pi->asi = RV770_ASI_DFLT; |
4177 | pi->pasi = CYPRESS_HASI_DFLT; | 4165 | pi->pasi = CYPRESS_HASI_DFLT; |
@@ -4188,8 +4176,7 @@ int ni_dpm_init(struct radeon_device *rdev) | |||
4188 | 4176 | ||
4189 | pi->dynamic_pcie_gen2 = true; | 4177 | pi->dynamic_pcie_gen2 = true; |
4190 | 4178 | ||
4191 | if (pi->gfx_clock_gating && | 4179 | if (rdev->pm.int_thermal_type != THERMAL_TYPE_NONE) |
4192 | (rdev->pm.int_thermal_type != THERMAL_TYPE_NONE)) | ||
4193 | pi->thermal_protection = true; | 4180 | pi->thermal_protection = true; |
4194 | else | 4181 | else |
4195 | pi->thermal_protection = false; | 4182 | pi->thermal_protection = false; |
diff --git a/drivers/gpu/drm/radeon/r600.c b/drivers/gpu/drm/radeon/r600.c index 10f712e37003..e66e72077350 100644 --- a/drivers/gpu/drm/radeon/r600.c +++ b/drivers/gpu/drm/radeon/r600.c | |||
@@ -2299,9 +2299,13 @@ int r600_init_microcode(struct radeon_device *rdev) | |||
2299 | if ((rdev->family >= CHIP_RV770) && (rdev->family <= CHIP_HEMLOCK)) { | 2299 | if ((rdev->family >= CHIP_RV770) && (rdev->family <= CHIP_HEMLOCK)) { |
2300 | snprintf(fw_name, sizeof(fw_name), "radeon/%s_smc.bin", smc_chip_name); | 2300 | snprintf(fw_name, sizeof(fw_name), "radeon/%s_smc.bin", smc_chip_name); |
2301 | err = request_firmware(&rdev->smc_fw, fw_name, rdev->dev); | 2301 | err = request_firmware(&rdev->smc_fw, fw_name, rdev->dev); |
2302 | if (err) | 2302 | if (err) { |
2303 | goto out; | 2303 | printk(KERN_ERR |
2304 | if (rdev->smc_fw->size != smc_req_size) { | 2304 | "smc: error loading firmware \"%s\"\n", |
2305 | fw_name); | ||
2306 | release_firmware(rdev->smc_fw); | ||
2307 | rdev->smc_fw = NULL; | ||
2308 | } else if (rdev->smc_fw->size != smc_req_size) { | ||
2305 | printk(KERN_ERR | 2309 | printk(KERN_ERR |
2306 | "smc: Bogus length %zu in firmware \"%s\"\n", | 2310 | "smc: Bogus length %zu in firmware \"%s\"\n", |
2307 | rdev->smc_fw->size, fw_name); | 2311 | rdev->smc_fw->size, fw_name); |
@@ -2697,12 +2701,29 @@ int r600_uvd_rbc_start(struct radeon_device *rdev) | |||
2697 | return 0; | 2701 | return 0; |
2698 | } | 2702 | } |
2699 | 2703 | ||
2700 | void r600_uvd_rbc_stop(struct radeon_device *rdev) | 2704 | void r600_uvd_stop(struct radeon_device *rdev) |
2701 | { | 2705 | { |
2702 | struct radeon_ring *ring = &rdev->ring[R600_RING_TYPE_UVD_INDEX]; | 2706 | struct radeon_ring *ring = &rdev->ring[R600_RING_TYPE_UVD_INDEX]; |
2703 | 2707 | ||
2704 | /* force RBC into idle state */ | 2708 | /* force RBC into idle state */ |
2705 | WREG32(UVD_RBC_RB_CNTL, 0x11010101); | 2709 | WREG32(UVD_RBC_RB_CNTL, 0x11010101); |
2710 | |||
2711 | /* Stall UMC and register bus before resetting VCPU */ | ||
2712 | WREG32_P(UVD_LMI_CTRL2, 1 << 8, ~(1 << 8)); | ||
2713 | WREG32_P(UVD_RB_ARB_CTRL, 1 << 3, ~(1 << 3)); | ||
2714 | mdelay(1); | ||
2715 | |||
2716 | /* put VCPU into reset */ | ||
2717 | WREG32(UVD_SOFT_RESET, VCPU_SOFT_RESET); | ||
2718 | mdelay(5); | ||
2719 | |||
2720 | /* disable VCPU clock */ | ||
2721 | WREG32(UVD_VCPU_CNTL, 0x0); | ||
2722 | |||
2723 | /* Unstall UMC and register bus */ | ||
2724 | WREG32_P(UVD_LMI_CTRL2, 0, ~(1 << 8)); | ||
2725 | WREG32_P(UVD_RB_ARB_CTRL, 0, ~(1 << 3)); | ||
2726 | |||
2706 | ring->ready = false; | 2727 | ring->ready = false; |
2707 | } | 2728 | } |
2708 | 2729 | ||
@@ -2722,6 +2743,11 @@ int r600_uvd_init(struct radeon_device *rdev) | |||
2722 | /* disable interupt */ | 2743 | /* disable interupt */ |
2723 | WREG32_P(UVD_MASTINT_EN, 0, ~(1 << 1)); | 2744 | WREG32_P(UVD_MASTINT_EN, 0, ~(1 << 1)); |
2724 | 2745 | ||
2746 | /* Stall UMC and register bus before resetting VCPU */ | ||
2747 | WREG32_P(UVD_LMI_CTRL2, 1 << 8, ~(1 << 8)); | ||
2748 | WREG32_P(UVD_RB_ARB_CTRL, 1 << 3, ~(1 << 3)); | ||
2749 | mdelay(1); | ||
2750 | |||
2725 | /* put LMI, VCPU, RBC etc... into reset */ | 2751 | /* put LMI, VCPU, RBC etc... into reset */ |
2726 | WREG32(UVD_SOFT_RESET, LMI_SOFT_RESET | VCPU_SOFT_RESET | | 2752 | WREG32(UVD_SOFT_RESET, LMI_SOFT_RESET | VCPU_SOFT_RESET | |
2727 | LBSI_SOFT_RESET | RBC_SOFT_RESET | CSM_SOFT_RESET | | 2753 | LBSI_SOFT_RESET | RBC_SOFT_RESET | CSM_SOFT_RESET | |
@@ -2751,10 +2777,6 @@ int r600_uvd_init(struct radeon_device *rdev) | |||
2751 | WREG32(UVD_MPC_SET_ALU, 0); | 2777 | WREG32(UVD_MPC_SET_ALU, 0); |
2752 | WREG32(UVD_MPC_SET_MUX, 0x88); | 2778 | WREG32(UVD_MPC_SET_MUX, 0x88); |
2753 | 2779 | ||
2754 | /* Stall UMC */ | ||
2755 | WREG32_P(UVD_LMI_CTRL2, 1 << 8, ~(1 << 8)); | ||
2756 | WREG32_P(UVD_RB_ARB_CTRL, 1 << 3, ~(1 << 3)); | ||
2757 | |||
2758 | /* take all subblocks out of reset, except VCPU */ | 2780 | /* take all subblocks out of reset, except VCPU */ |
2759 | WREG32(UVD_SOFT_RESET, VCPU_SOFT_RESET); | 2781 | WREG32(UVD_SOFT_RESET, VCPU_SOFT_RESET); |
2760 | mdelay(5); | 2782 | mdelay(5); |
@@ -3312,6 +3334,8 @@ static int r600_startup(struct radeon_device *rdev) | |||
3312 | /* enable pcie gen2 link */ | 3334 | /* enable pcie gen2 link */ |
3313 | r600_pcie_gen2_enable(rdev); | 3335 | r600_pcie_gen2_enable(rdev); |
3314 | 3336 | ||
3337 | r600_mc_program(rdev); | ||
3338 | |||
3315 | if (!rdev->me_fw || !rdev->pfp_fw || !rdev->rlc_fw) { | 3339 | if (!rdev->me_fw || !rdev->pfp_fw || !rdev->rlc_fw) { |
3316 | r = r600_init_microcode(rdev); | 3340 | r = r600_init_microcode(rdev); |
3317 | if (r) { | 3341 | if (r) { |
@@ -3324,7 +3348,6 @@ static int r600_startup(struct radeon_device *rdev) | |||
3324 | if (r) | 3348 | if (r) |
3325 | return r; | 3349 | return r; |
3326 | 3350 | ||
3327 | r600_mc_program(rdev); | ||
3328 | if (rdev->flags & RADEON_IS_AGP) { | 3351 | if (rdev->flags & RADEON_IS_AGP) { |
3329 | r600_agp_enable(rdev); | 3352 | r600_agp_enable(rdev); |
3330 | } else { | 3353 | } else { |
diff --git a/drivers/gpu/drm/radeon/r600_hdmi.c b/drivers/gpu/drm/radeon/r600_hdmi.c index f48240bb8c56..f264df5470f7 100644 --- a/drivers/gpu/drm/radeon/r600_hdmi.c +++ b/drivers/gpu/drm/radeon/r600_hdmi.c | |||
@@ -226,10 +226,29 @@ void r600_audio_set_dto(struct drm_encoder *encoder, u32 clock) | |||
226 | struct radeon_encoder *radeon_encoder = to_radeon_encoder(encoder); | 226 | struct radeon_encoder *radeon_encoder = to_radeon_encoder(encoder); |
227 | struct radeon_encoder_atom_dig *dig = radeon_encoder->enc_priv; | 227 | struct radeon_encoder_atom_dig *dig = radeon_encoder->enc_priv; |
228 | u32 base_rate = 24000; | 228 | u32 base_rate = 24000; |
229 | u32 max_ratio = clock / base_rate; | ||
230 | u32 dto_phase; | ||
231 | u32 dto_modulo = clock; | ||
232 | u32 wallclock_ratio; | ||
233 | u32 dto_cntl; | ||
229 | 234 | ||
230 | if (!dig || !dig->afmt) | 235 | if (!dig || !dig->afmt) |
231 | return; | 236 | return; |
232 | 237 | ||
238 | if (max_ratio >= 8) { | ||
239 | dto_phase = 192 * 1000; | ||
240 | wallclock_ratio = 3; | ||
241 | } else if (max_ratio >= 4) { | ||
242 | dto_phase = 96 * 1000; | ||
243 | wallclock_ratio = 2; | ||
244 | } else if (max_ratio >= 2) { | ||
245 | dto_phase = 48 * 1000; | ||
246 | wallclock_ratio = 1; | ||
247 | } else { | ||
248 | dto_phase = 24 * 1000; | ||
249 | wallclock_ratio = 0; | ||
250 | } | ||
251 | |||
233 | /* there are two DTOs selected by DCCG_AUDIO_DTO_SELECT. | 252 | /* there are two DTOs selected by DCCG_AUDIO_DTO_SELECT. |
234 | * doesn't matter which one you use. Just use the first one. | 253 | * doesn't matter which one you use. Just use the first one. |
235 | */ | 254 | */ |
@@ -242,9 +261,21 @@ void r600_audio_set_dto(struct drm_encoder *encoder, u32 clock) | |||
242 | /* according to the reg specs, this should DCE3.2 only, but in | 261 | /* according to the reg specs, this should DCE3.2 only, but in |
243 | * practice it seems to cover DCE3.0 as well. | 262 | * practice it seems to cover DCE3.0 as well. |
244 | */ | 263 | */ |
245 | WREG32(DCCG_AUDIO_DTO0_PHASE, base_rate * 100); | 264 | if (dig->dig_encoder == 0) { |
246 | WREG32(DCCG_AUDIO_DTO0_MODULE, clock * 100); | 265 | dto_cntl = RREG32(DCCG_AUDIO_DTO0_CNTL) & ~DCCG_AUDIO_DTO_WALLCLOCK_RATIO_MASK; |
247 | WREG32(DCCG_AUDIO_DTO_SELECT, 0); /* select DTO0 */ | 266 | dto_cntl |= DCCG_AUDIO_DTO_WALLCLOCK_RATIO(wallclock_ratio); |
267 | WREG32(DCCG_AUDIO_DTO0_CNTL, dto_cntl); | ||
268 | WREG32(DCCG_AUDIO_DTO0_PHASE, dto_phase); | ||
269 | WREG32(DCCG_AUDIO_DTO0_MODULE, dto_modulo); | ||
270 | WREG32(DCCG_AUDIO_DTO_SELECT, 0); /* select DTO0 */ | ||
271 | } else { | ||
272 | dto_cntl = RREG32(DCCG_AUDIO_DTO1_CNTL) & ~DCCG_AUDIO_DTO_WALLCLOCK_RATIO_MASK; | ||
273 | dto_cntl |= DCCG_AUDIO_DTO_WALLCLOCK_RATIO(wallclock_ratio); | ||
274 | WREG32(DCCG_AUDIO_DTO1_CNTL, dto_cntl); | ||
275 | WREG32(DCCG_AUDIO_DTO1_PHASE, dto_phase); | ||
276 | WREG32(DCCG_AUDIO_DTO1_MODULE, dto_modulo); | ||
277 | WREG32(DCCG_AUDIO_DTO_SELECT, 1); /* select DTO1 */ | ||
278 | } | ||
248 | } else { | 279 | } else { |
249 | /* according to the reg specs, this should be DCE2.0 and DCE3.0 */ | 280 | /* according to the reg specs, this should be DCE2.0 and DCE3.0 */ |
250 | WREG32(AUDIO_DTO, AUDIO_DTO_PHASE(base_rate / 10) | | 281 | WREG32(AUDIO_DTO, AUDIO_DTO_PHASE(base_rate / 10) | |
diff --git a/drivers/gpu/drm/radeon/r600d.h b/drivers/gpu/drm/radeon/r600d.h index 8e3fe815edab..7c780839a7f4 100644 --- a/drivers/gpu/drm/radeon/r600d.h +++ b/drivers/gpu/drm/radeon/r600d.h | |||
@@ -933,6 +933,9 @@ | |||
933 | #define DCCG_AUDIO_DTO0_LOAD 0x051c | 933 | #define DCCG_AUDIO_DTO0_LOAD 0x051c |
934 | # define DTO_LOAD (1 << 31) | 934 | # define DTO_LOAD (1 << 31) |
935 | #define DCCG_AUDIO_DTO0_CNTL 0x0520 | 935 | #define DCCG_AUDIO_DTO0_CNTL 0x0520 |
936 | # define DCCG_AUDIO_DTO_WALLCLOCK_RATIO(x) (((x) & 7) << 0) | ||
937 | # define DCCG_AUDIO_DTO_WALLCLOCK_RATIO_MASK 7 | ||
938 | # define DCCG_AUDIO_DTO_WALLCLOCK_RATIO_SHIFT 0 | ||
936 | 939 | ||
937 | #define DCCG_AUDIO_DTO1_PHASE 0x0524 | 940 | #define DCCG_AUDIO_DTO1_PHASE 0x0524 |
938 | #define DCCG_AUDIO_DTO1_MODULE 0x0528 | 941 | #define DCCG_AUDIO_DTO1_MODULE 0x0528 |
diff --git a/drivers/gpu/drm/radeon/radeon.h b/drivers/gpu/drm/radeon/radeon.h index 2f08219c39b6..274b8e1b889f 100644 --- a/drivers/gpu/drm/radeon/radeon.h +++ b/drivers/gpu/drm/radeon/radeon.h | |||
@@ -1468,7 +1468,6 @@ struct radeon_uvd { | |||
1468 | void *cpu_addr; | 1468 | void *cpu_addr; |
1469 | uint64_t gpu_addr; | 1469 | uint64_t gpu_addr; |
1470 | void *saved_bo; | 1470 | void *saved_bo; |
1471 | unsigned fw_size; | ||
1472 | atomic_t handles[RADEON_MAX_UVD_HANDLES]; | 1471 | atomic_t handles[RADEON_MAX_UVD_HANDLES]; |
1473 | struct drm_file *filp[RADEON_MAX_UVD_HANDLES]; | 1472 | struct drm_file *filp[RADEON_MAX_UVD_HANDLES]; |
1474 | struct delayed_work idle_work; | 1473 | struct delayed_work idle_work; |
@@ -2066,6 +2065,7 @@ struct radeon_device { | |||
2066 | const struct firmware *mec_fw; /* CIK MEC firmware */ | 2065 | const struct firmware *mec_fw; /* CIK MEC firmware */ |
2067 | const struct firmware *sdma_fw; /* CIK SDMA firmware */ | 2066 | const struct firmware *sdma_fw; /* CIK SDMA firmware */ |
2068 | const struct firmware *smc_fw; /* SMC firmware */ | 2067 | const struct firmware *smc_fw; /* SMC firmware */ |
2068 | const struct firmware *uvd_fw; /* UVD firmware */ | ||
2069 | struct r600_blit r600_blit; | 2069 | struct r600_blit r600_blit; |
2070 | struct r600_vram_scratch vram_scratch; | 2070 | struct r600_vram_scratch vram_scratch; |
2071 | int msi_enabled; /* msi enabled */ | 2071 | int msi_enabled; /* msi enabled */ |
@@ -2095,6 +2095,8 @@ struct radeon_device { | |||
2095 | /* ACPI interface */ | 2095 | /* ACPI interface */ |
2096 | struct radeon_atif atif; | 2096 | struct radeon_atif atif; |
2097 | struct radeon_atcs atcs; | 2097 | struct radeon_atcs atcs; |
2098 | /* srbm instance registers */ | ||
2099 | struct mutex srbm_mutex; | ||
2098 | }; | 2100 | }; |
2099 | 2101 | ||
2100 | int radeon_device_init(struct radeon_device *rdev, | 2102 | int radeon_device_init(struct radeon_device *rdev, |
diff --git a/drivers/gpu/drm/radeon/radeon_asic.h b/drivers/gpu/drm/radeon/radeon_asic.h index 902479fa737f..3d61d5aac18f 100644 --- a/drivers/gpu/drm/radeon/radeon_asic.h +++ b/drivers/gpu/drm/radeon/radeon_asic.h | |||
@@ -441,7 +441,7 @@ void rs780_dpm_debugfs_print_current_performance_level(struct radeon_device *rde | |||
441 | /* uvd */ | 441 | /* uvd */ |
442 | int r600_uvd_init(struct radeon_device *rdev); | 442 | int r600_uvd_init(struct radeon_device *rdev); |
443 | int r600_uvd_rbc_start(struct radeon_device *rdev); | 443 | int r600_uvd_rbc_start(struct radeon_device *rdev); |
444 | void r600_uvd_rbc_stop(struct radeon_device *rdev); | 444 | void r600_uvd_stop(struct radeon_device *rdev); |
445 | int r600_uvd_ib_test(struct radeon_device *rdev, struct radeon_ring *ring); | 445 | int r600_uvd_ib_test(struct radeon_device *rdev, struct radeon_ring *ring); |
446 | void r600_uvd_fence_emit(struct radeon_device *rdev, | 446 | void r600_uvd_fence_emit(struct radeon_device *rdev, |
447 | struct radeon_fence *fence); | 447 | struct radeon_fence *fence); |
diff --git a/drivers/gpu/drm/radeon/radeon_device.c b/drivers/gpu/drm/radeon/radeon_device.c index 82335e38ec4f..63398ae1dbf5 100644 --- a/drivers/gpu/drm/radeon/radeon_device.c +++ b/drivers/gpu/drm/radeon/radeon_device.c | |||
@@ -1163,6 +1163,7 @@ int radeon_device_init(struct radeon_device *rdev, | |||
1163 | mutex_init(&rdev->gem.mutex); | 1163 | mutex_init(&rdev->gem.mutex); |
1164 | mutex_init(&rdev->pm.mutex); | 1164 | mutex_init(&rdev->pm.mutex); |
1165 | mutex_init(&rdev->gpu_clock_mutex); | 1165 | mutex_init(&rdev->gpu_clock_mutex); |
1166 | mutex_init(&rdev->srbm_mutex); | ||
1166 | init_rwsem(&rdev->pm.mclk_lock); | 1167 | init_rwsem(&rdev->pm.mclk_lock); |
1167 | init_rwsem(&rdev->exclusive_lock); | 1168 | init_rwsem(&rdev->exclusive_lock); |
1168 | init_waitqueue_head(&rdev->irq.vblank_queue); | 1169 | init_waitqueue_head(&rdev->irq.vblank_queue); |
@@ -1519,6 +1520,7 @@ int radeon_gpu_reset(struct radeon_device *rdev) | |||
1519 | radeon_save_bios_scratch_regs(rdev); | 1520 | radeon_save_bios_scratch_regs(rdev); |
1520 | /* block TTM */ | 1521 | /* block TTM */ |
1521 | resched = ttm_bo_lock_delayed_workqueue(&rdev->mman.bdev); | 1522 | resched = ttm_bo_lock_delayed_workqueue(&rdev->mman.bdev); |
1523 | radeon_pm_suspend(rdev); | ||
1522 | radeon_suspend(rdev); | 1524 | radeon_suspend(rdev); |
1523 | 1525 | ||
1524 | for (i = 0; i < RADEON_NUM_RINGS; ++i) { | 1526 | for (i = 0; i < RADEON_NUM_RINGS; ++i) { |
@@ -1564,6 +1566,7 @@ retry: | |||
1564 | } | 1566 | } |
1565 | } | 1567 | } |
1566 | 1568 | ||
1569 | radeon_pm_resume(rdev); | ||
1567 | drm_helper_resume_force_mode(rdev->ddev); | 1570 | drm_helper_resume_force_mode(rdev->ddev); |
1568 | 1571 | ||
1569 | ttm_bo_unlock_delayed_workqueue(&rdev->mman.bdev, resched); | 1572 | ttm_bo_unlock_delayed_workqueue(&rdev->mman.bdev, resched); |
diff --git a/drivers/gpu/drm/radeon/radeon_fence.c b/drivers/gpu/drm/radeon/radeon_fence.c index 7ddb0efe2408..ddb8f8e04eb5 100644 --- a/drivers/gpu/drm/radeon/radeon_fence.c +++ b/drivers/gpu/drm/radeon/radeon_fence.c | |||
@@ -782,7 +782,7 @@ int radeon_fence_driver_start_ring(struct radeon_device *rdev, int ring) | |||
782 | 782 | ||
783 | } else { | 783 | } else { |
784 | /* put fence directly behind firmware */ | 784 | /* put fence directly behind firmware */ |
785 | index = ALIGN(rdev->uvd.fw_size, 8); | 785 | index = ALIGN(rdev->uvd_fw->size, 8); |
786 | rdev->fence_drv[ring].cpu_addr = rdev->uvd.cpu_addr + index; | 786 | rdev->fence_drv[ring].cpu_addr = rdev->uvd.cpu_addr + index; |
787 | rdev->fence_drv[ring].gpu_addr = rdev->uvd.gpu_addr + index; | 787 | rdev->fence_drv[ring].gpu_addr = rdev->uvd.gpu_addr + index; |
788 | } | 788 | } |
diff --git a/drivers/gpu/drm/radeon/radeon_gart.c b/drivers/gpu/drm/radeon/radeon_gart.c index 6a51d943ccf4..b990b1a2bd50 100644 --- a/drivers/gpu/drm/radeon/radeon_gart.c +++ b/drivers/gpu/drm/radeon/radeon_gart.c | |||
@@ -207,7 +207,6 @@ void radeon_gart_table_vram_free(struct radeon_device *rdev) | |||
207 | if (rdev->gart.robj == NULL) { | 207 | if (rdev->gart.robj == NULL) { |
208 | return; | 208 | return; |
209 | } | 209 | } |
210 | radeon_gart_table_vram_unpin(rdev); | ||
211 | radeon_bo_unref(&rdev->gart.robj); | 210 | radeon_bo_unref(&rdev->gart.robj); |
212 | } | 211 | } |
213 | 212 | ||
diff --git a/drivers/gpu/drm/radeon/radeon_pm.c b/drivers/gpu/drm/radeon/radeon_pm.c index f374c467aaca..c557850cd345 100644 --- a/drivers/gpu/drm/radeon/radeon_pm.c +++ b/drivers/gpu/drm/radeon/radeon_pm.c | |||
@@ -1176,7 +1176,14 @@ int radeon_pm_init(struct radeon_device *rdev) | |||
1176 | case CHIP_VERDE: | 1176 | case CHIP_VERDE: |
1177 | case CHIP_OLAND: | 1177 | case CHIP_OLAND: |
1178 | case CHIP_HAINAN: | 1178 | case CHIP_HAINAN: |
1179 | if (radeon_dpm == 1) | 1179 | /* DPM requires the RLC, RV770+ dGPU requires SMC */ |
1180 | if (!rdev->rlc_fw) | ||
1181 | rdev->pm.pm_method = PM_METHOD_PROFILE; | ||
1182 | else if ((rdev->family >= CHIP_RV770) && | ||
1183 | (!(rdev->flags & RADEON_IS_IGP)) && | ||
1184 | (!rdev->smc_fw)) | ||
1185 | rdev->pm.pm_method = PM_METHOD_PROFILE; | ||
1186 | else if (radeon_dpm == 1) | ||
1180 | rdev->pm.pm_method = PM_METHOD_DPM; | 1187 | rdev->pm.pm_method = PM_METHOD_DPM; |
1181 | else | 1188 | else |
1182 | rdev->pm.pm_method = PM_METHOD_PROFILE; | 1189 | rdev->pm.pm_method = PM_METHOD_PROFILE; |
diff --git a/drivers/gpu/drm/radeon/radeon_uvd.c b/drivers/gpu/drm/radeon/radeon_uvd.c index 414fd145d20e..f1c15754e73c 100644 --- a/drivers/gpu/drm/radeon/radeon_uvd.c +++ b/drivers/gpu/drm/radeon/radeon_uvd.c | |||
@@ -56,7 +56,6 @@ static void radeon_uvd_idle_work_handler(struct work_struct *work); | |||
56 | 56 | ||
57 | int radeon_uvd_init(struct radeon_device *rdev) | 57 | int radeon_uvd_init(struct radeon_device *rdev) |
58 | { | 58 | { |
59 | const struct firmware *fw; | ||
60 | unsigned long bo_size; | 59 | unsigned long bo_size; |
61 | const char *fw_name; | 60 | const char *fw_name; |
62 | int i, r; | 61 | int i, r; |
@@ -105,14 +104,14 @@ int radeon_uvd_init(struct radeon_device *rdev) | |||
105 | return -EINVAL; | 104 | return -EINVAL; |
106 | } | 105 | } |
107 | 106 | ||
108 | r = request_firmware(&fw, fw_name, rdev->dev); | 107 | r = request_firmware(&rdev->uvd_fw, fw_name, rdev->dev); |
109 | if (r) { | 108 | if (r) { |
110 | dev_err(rdev->dev, "radeon_uvd: Can't load firmware \"%s\"\n", | 109 | dev_err(rdev->dev, "radeon_uvd: Can't load firmware \"%s\"\n", |
111 | fw_name); | 110 | fw_name); |
112 | return r; | 111 | return r; |
113 | } | 112 | } |
114 | 113 | ||
115 | bo_size = RADEON_GPU_PAGE_ALIGN(fw->size + 8) + | 114 | bo_size = RADEON_GPU_PAGE_ALIGN(rdev->uvd_fw->size + 8) + |
116 | RADEON_UVD_STACK_SIZE + RADEON_UVD_HEAP_SIZE; | 115 | RADEON_UVD_STACK_SIZE + RADEON_UVD_HEAP_SIZE; |
117 | r = radeon_bo_create(rdev, bo_size, PAGE_SIZE, true, | 116 | r = radeon_bo_create(rdev, bo_size, PAGE_SIZE, true, |
118 | RADEON_GEM_DOMAIN_VRAM, NULL, &rdev->uvd.vcpu_bo); | 117 | RADEON_GEM_DOMAIN_VRAM, NULL, &rdev->uvd.vcpu_bo); |
@@ -145,12 +144,6 @@ int radeon_uvd_init(struct radeon_device *rdev) | |||
145 | 144 | ||
146 | radeon_bo_unreserve(rdev->uvd.vcpu_bo); | 145 | radeon_bo_unreserve(rdev->uvd.vcpu_bo); |
147 | 146 | ||
148 | rdev->uvd.fw_size = fw->size; | ||
149 | memset(rdev->uvd.cpu_addr, 0, bo_size); | ||
150 | memcpy(rdev->uvd.cpu_addr, fw->data, fw->size); | ||
151 | |||
152 | release_firmware(fw); | ||
153 | |||
154 | for (i = 0; i < RADEON_MAX_UVD_HANDLES; ++i) { | 147 | for (i = 0; i < RADEON_MAX_UVD_HANDLES; ++i) { |
155 | atomic_set(&rdev->uvd.handles[i], 0); | 148 | atomic_set(&rdev->uvd.handles[i], 0); |
156 | rdev->uvd.filp[i] = NULL; | 149 | rdev->uvd.filp[i] = NULL; |
@@ -174,33 +167,60 @@ void radeon_uvd_fini(struct radeon_device *rdev) | |||
174 | } | 167 | } |
175 | 168 | ||
176 | radeon_bo_unref(&rdev->uvd.vcpu_bo); | 169 | radeon_bo_unref(&rdev->uvd.vcpu_bo); |
170 | |||
171 | release_firmware(rdev->uvd_fw); | ||
177 | } | 172 | } |
178 | 173 | ||
179 | int radeon_uvd_suspend(struct radeon_device *rdev) | 174 | int radeon_uvd_suspend(struct radeon_device *rdev) |
180 | { | 175 | { |
181 | unsigned size; | 176 | unsigned size; |
177 | void *ptr; | ||
178 | int i; | ||
182 | 179 | ||
183 | if (rdev->uvd.vcpu_bo == NULL) | 180 | if (rdev->uvd.vcpu_bo == NULL) |
184 | return 0; | 181 | return 0; |
185 | 182 | ||
183 | for (i = 0; i < RADEON_MAX_UVD_HANDLES; ++i) | ||
184 | if (atomic_read(&rdev->uvd.handles[i])) | ||
185 | break; | ||
186 | |||
187 | if (i == RADEON_MAX_UVD_HANDLES) | ||
188 | return 0; | ||
189 | |||
186 | size = radeon_bo_size(rdev->uvd.vcpu_bo); | 190 | size = radeon_bo_size(rdev->uvd.vcpu_bo); |
191 | size -= rdev->uvd_fw->size; | ||
192 | |||
193 | ptr = rdev->uvd.cpu_addr; | ||
194 | ptr += rdev->uvd_fw->size; | ||
195 | |||
187 | rdev->uvd.saved_bo = kmalloc(size, GFP_KERNEL); | 196 | rdev->uvd.saved_bo = kmalloc(size, GFP_KERNEL); |
188 | memcpy(rdev->uvd.saved_bo, rdev->uvd.cpu_addr, size); | 197 | memcpy(rdev->uvd.saved_bo, ptr, size); |
189 | 198 | ||
190 | return 0; | 199 | return 0; |
191 | } | 200 | } |
192 | 201 | ||
193 | int radeon_uvd_resume(struct radeon_device *rdev) | 202 | int radeon_uvd_resume(struct radeon_device *rdev) |
194 | { | 203 | { |
204 | unsigned size; | ||
205 | void *ptr; | ||
206 | |||
195 | if (rdev->uvd.vcpu_bo == NULL) | 207 | if (rdev->uvd.vcpu_bo == NULL) |
196 | return -EINVAL; | 208 | return -EINVAL; |
197 | 209 | ||
210 | memcpy(rdev->uvd.cpu_addr, rdev->uvd_fw->data, rdev->uvd_fw->size); | ||
211 | |||
212 | size = radeon_bo_size(rdev->uvd.vcpu_bo); | ||
213 | size -= rdev->uvd_fw->size; | ||
214 | |||
215 | ptr = rdev->uvd.cpu_addr; | ||
216 | ptr += rdev->uvd_fw->size; | ||
217 | |||
198 | if (rdev->uvd.saved_bo != NULL) { | 218 | if (rdev->uvd.saved_bo != NULL) { |
199 | unsigned size = radeon_bo_size(rdev->uvd.vcpu_bo); | 219 | memcpy(ptr, rdev->uvd.saved_bo, size); |
200 | memcpy(rdev->uvd.cpu_addr, rdev->uvd.saved_bo, size); | ||
201 | kfree(rdev->uvd.saved_bo); | 220 | kfree(rdev->uvd.saved_bo); |
202 | rdev->uvd.saved_bo = NULL; | 221 | rdev->uvd.saved_bo = NULL; |
203 | } | 222 | } else |
223 | memset(ptr, 0, size); | ||
204 | 224 | ||
205 | return 0; | 225 | return 0; |
206 | } | 226 | } |
@@ -215,8 +235,8 @@ void radeon_uvd_free_handles(struct radeon_device *rdev, struct drm_file *filp) | |||
215 | { | 235 | { |
216 | int i, r; | 236 | int i, r; |
217 | for (i = 0; i < RADEON_MAX_UVD_HANDLES; ++i) { | 237 | for (i = 0; i < RADEON_MAX_UVD_HANDLES; ++i) { |
218 | if (rdev->uvd.filp[i] == filp) { | 238 | uint32_t handle = atomic_read(&rdev->uvd.handles[i]); |
219 | uint32_t handle = atomic_read(&rdev->uvd.handles[i]); | 239 | if (handle != 0 && rdev->uvd.filp[i] == filp) { |
220 | struct radeon_fence *fence; | 240 | struct radeon_fence *fence; |
221 | 241 | ||
222 | r = radeon_uvd_get_destroy_msg(rdev, | 242 | r = radeon_uvd_get_destroy_msg(rdev, |
@@ -337,8 +357,10 @@ static int radeon_uvd_cs_msg(struct radeon_cs_parser *p, struct radeon_bo *bo, | |||
337 | } | 357 | } |
338 | 358 | ||
339 | r = radeon_bo_kmap(bo, &ptr); | 359 | r = radeon_bo_kmap(bo, &ptr); |
340 | if (r) | 360 | if (r) { |
361 | DRM_ERROR("Failed mapping the UVD message (%d)!\n", r); | ||
341 | return r; | 362 | return r; |
363 | } | ||
342 | 364 | ||
343 | msg = ptr + offset; | 365 | msg = ptr + offset; |
344 | 366 | ||
@@ -364,8 +386,14 @@ static int radeon_uvd_cs_msg(struct radeon_cs_parser *p, struct radeon_bo *bo, | |||
364 | radeon_bo_kunmap(bo); | 386 | radeon_bo_kunmap(bo); |
365 | return 0; | 387 | return 0; |
366 | } else { | 388 | } else { |
367 | /* it's a create msg, no special handling needed */ | ||
368 | radeon_bo_kunmap(bo); | 389 | radeon_bo_kunmap(bo); |
390 | |||
391 | if (msg_type != 0) { | ||
392 | DRM_ERROR("Illegal UVD message type (%d)!\n", msg_type); | ||
393 | return -EINVAL; | ||
394 | } | ||
395 | |||
396 | /* it's a create msg, no special handling needed */ | ||
369 | } | 397 | } |
370 | 398 | ||
371 | /* create or decode, validate the handle */ | 399 | /* create or decode, validate the handle */ |
@@ -388,7 +416,7 @@ static int radeon_uvd_cs_msg(struct radeon_cs_parser *p, struct radeon_bo *bo, | |||
388 | 416 | ||
389 | static int radeon_uvd_cs_reloc(struct radeon_cs_parser *p, | 417 | static int radeon_uvd_cs_reloc(struct radeon_cs_parser *p, |
390 | int data0, int data1, | 418 | int data0, int data1, |
391 | unsigned buf_sizes[]) | 419 | unsigned buf_sizes[], bool *has_msg_cmd) |
392 | { | 420 | { |
393 | struct radeon_cs_chunk *relocs_chunk; | 421 | struct radeon_cs_chunk *relocs_chunk; |
394 | struct radeon_cs_reloc *reloc; | 422 | struct radeon_cs_reloc *reloc; |
@@ -417,7 +445,7 @@ static int radeon_uvd_cs_reloc(struct radeon_cs_parser *p, | |||
417 | 445 | ||
418 | if (cmd < 0x4) { | 446 | if (cmd < 0x4) { |
419 | if ((end - start) < buf_sizes[cmd]) { | 447 | if ((end - start) < buf_sizes[cmd]) { |
420 | DRM_ERROR("buffer to small (%d / %d)!\n", | 448 | DRM_ERROR("buffer (%d) to small (%d / %d)!\n", cmd, |
421 | (unsigned)(end - start), buf_sizes[cmd]); | 449 | (unsigned)(end - start), buf_sizes[cmd]); |
422 | return -EINVAL; | 450 | return -EINVAL; |
423 | } | 451 | } |
@@ -442,9 +470,17 @@ static int radeon_uvd_cs_reloc(struct radeon_cs_parser *p, | |||
442 | } | 470 | } |
443 | 471 | ||
444 | if (cmd == 0) { | 472 | if (cmd == 0) { |
473 | if (*has_msg_cmd) { | ||
474 | DRM_ERROR("More than one message in a UVD-IB!\n"); | ||
475 | return -EINVAL; | ||
476 | } | ||
477 | *has_msg_cmd = true; | ||
445 | r = radeon_uvd_cs_msg(p, reloc->robj, offset, buf_sizes); | 478 | r = radeon_uvd_cs_msg(p, reloc->robj, offset, buf_sizes); |
446 | if (r) | 479 | if (r) |
447 | return r; | 480 | return r; |
481 | } else if (!*has_msg_cmd) { | ||
482 | DRM_ERROR("Message needed before other commands are send!\n"); | ||
483 | return -EINVAL; | ||
448 | } | 484 | } |
449 | 485 | ||
450 | return 0; | 486 | return 0; |
@@ -453,7 +489,8 @@ static int radeon_uvd_cs_reloc(struct radeon_cs_parser *p, | |||
453 | static int radeon_uvd_cs_reg(struct radeon_cs_parser *p, | 489 | static int radeon_uvd_cs_reg(struct radeon_cs_parser *p, |
454 | struct radeon_cs_packet *pkt, | 490 | struct radeon_cs_packet *pkt, |
455 | int *data0, int *data1, | 491 | int *data0, int *data1, |
456 | unsigned buf_sizes[]) | 492 | unsigned buf_sizes[], |
493 | bool *has_msg_cmd) | ||
457 | { | 494 | { |
458 | int i, r; | 495 | int i, r; |
459 | 496 | ||
@@ -467,7 +504,8 @@ static int radeon_uvd_cs_reg(struct radeon_cs_parser *p, | |||
467 | *data1 = p->idx; | 504 | *data1 = p->idx; |
468 | break; | 505 | break; |
469 | case UVD_GPCOM_VCPU_CMD: | 506 | case UVD_GPCOM_VCPU_CMD: |
470 | r = radeon_uvd_cs_reloc(p, *data0, *data1, buf_sizes); | 507 | r = radeon_uvd_cs_reloc(p, *data0, *data1, |
508 | buf_sizes, has_msg_cmd); | ||
471 | if (r) | 509 | if (r) |
472 | return r; | 510 | return r; |
473 | break; | 511 | break; |
@@ -488,6 +526,9 @@ int radeon_uvd_cs_parse(struct radeon_cs_parser *p) | |||
488 | struct radeon_cs_packet pkt; | 526 | struct radeon_cs_packet pkt; |
489 | int r, data0 = 0, data1 = 0; | 527 | int r, data0 = 0, data1 = 0; |
490 | 528 | ||
529 | /* does the IB has a msg command */ | ||
530 | bool has_msg_cmd = false; | ||
531 | |||
491 | /* minimum buffer sizes */ | 532 | /* minimum buffer sizes */ |
492 | unsigned buf_sizes[] = { | 533 | unsigned buf_sizes[] = { |
493 | [0x00000000] = 2048, | 534 | [0x00000000] = 2048, |
@@ -514,8 +555,8 @@ int radeon_uvd_cs_parse(struct radeon_cs_parser *p) | |||
514 | return r; | 555 | return r; |
515 | switch (pkt.type) { | 556 | switch (pkt.type) { |
516 | case RADEON_PACKET_TYPE0: | 557 | case RADEON_PACKET_TYPE0: |
517 | r = radeon_uvd_cs_reg(p, &pkt, &data0, | 558 | r = radeon_uvd_cs_reg(p, &pkt, &data0, &data1, |
518 | &data1, buf_sizes); | 559 | buf_sizes, &has_msg_cmd); |
519 | if (r) | 560 | if (r) |
520 | return r; | 561 | return r; |
521 | break; | 562 | break; |
@@ -527,6 +568,12 @@ int radeon_uvd_cs_parse(struct radeon_cs_parser *p) | |||
527 | return -EINVAL; | 568 | return -EINVAL; |
528 | } | 569 | } |
529 | } while (p->idx < p->chunks[p->chunk_ib_idx].length_dw); | 570 | } while (p->idx < p->chunks[p->chunk_ib_idx].length_dw); |
571 | |||
572 | if (!has_msg_cmd) { | ||
573 | DRM_ERROR("UVD-IBs need a msg command!\n"); | ||
574 | return -EINVAL; | ||
575 | } | ||
576 | |||
530 | return 0; | 577 | return 0; |
531 | } | 578 | } |
532 | 579 | ||
diff --git a/drivers/gpu/drm/radeon/rv6xx_dpm.c b/drivers/gpu/drm/radeon/rv6xx_dpm.c index 363018c60412..bdd888b4db2b 100644 --- a/drivers/gpu/drm/radeon/rv6xx_dpm.c +++ b/drivers/gpu/drm/radeon/rv6xx_dpm.c | |||
@@ -1944,9 +1944,7 @@ static int rv6xx_parse_power_table(struct radeon_device *rdev) | |||
1944 | 1944 | ||
1945 | int rv6xx_dpm_init(struct radeon_device *rdev) | 1945 | int rv6xx_dpm_init(struct radeon_device *rdev) |
1946 | { | 1946 | { |
1947 | int index = GetIndexIntoMasterTable(DATA, ASIC_InternalSS_Info); | 1947 | struct radeon_atom_ss ss; |
1948 | uint16_t data_offset, size; | ||
1949 | uint8_t frev, crev; | ||
1950 | struct atom_clock_dividers dividers; | 1948 | struct atom_clock_dividers dividers; |
1951 | struct rv6xx_power_info *pi; | 1949 | struct rv6xx_power_info *pi; |
1952 | int ret; | 1950 | int ret; |
@@ -1989,16 +1987,18 @@ int rv6xx_dpm_init(struct radeon_device *rdev) | |||
1989 | 1987 | ||
1990 | pi->gfx_clock_gating = true; | 1988 | pi->gfx_clock_gating = true; |
1991 | 1989 | ||
1992 | if (atom_parse_data_header(rdev->mode_info.atom_context, index, &size, | 1990 | pi->sclk_ss = radeon_atombios_get_asic_ss_info(rdev, &ss, |
1993 | &frev, &crev, &data_offset)) { | 1991 | ASIC_INTERNAL_ENGINE_SS, 0); |
1994 | pi->sclk_ss = true; | 1992 | pi->mclk_ss = radeon_atombios_get_asic_ss_info(rdev, &ss, |
1995 | pi->mclk_ss = true; | 1993 | ASIC_INTERNAL_MEMORY_SS, 0); |
1994 | |||
1995 | /* Disable sclk ss, causes hangs on a lot of systems */ | ||
1996 | pi->sclk_ss = false; | ||
1997 | |||
1998 | if (pi->sclk_ss || pi->mclk_ss) | ||
1996 | pi->dynamic_ss = true; | 1999 | pi->dynamic_ss = true; |
1997 | } else { | 2000 | else |
1998 | pi->sclk_ss = false; | ||
1999 | pi->mclk_ss = false; | ||
2000 | pi->dynamic_ss = false; | 2001 | pi->dynamic_ss = false; |
2001 | } | ||
2002 | 2002 | ||
2003 | pi->dynamic_pcie_gen2 = true; | 2003 | pi->dynamic_pcie_gen2 = true; |
2004 | 2004 | ||
diff --git a/drivers/gpu/drm/radeon/rv770.c b/drivers/gpu/drm/radeon/rv770.c index 30ea14e8854c..bcc68ec204ad 100644 --- a/drivers/gpu/drm/radeon/rv770.c +++ b/drivers/gpu/drm/radeon/rv770.c | |||
@@ -813,7 +813,7 @@ int rv770_uvd_resume(struct radeon_device *rdev) | |||
813 | 813 | ||
814 | /* programm the VCPU memory controller bits 0-27 */ | 814 | /* programm the VCPU memory controller bits 0-27 */ |
815 | addr = rdev->uvd.gpu_addr >> 3; | 815 | addr = rdev->uvd.gpu_addr >> 3; |
816 | size = RADEON_GPU_PAGE_ALIGN(rdev->uvd.fw_size + 4) >> 3; | 816 | size = RADEON_GPU_PAGE_ALIGN(rdev->uvd_fw->size + 4) >> 3; |
817 | WREG32(UVD_VCPU_CACHE_OFFSET0, addr); | 817 | WREG32(UVD_VCPU_CACHE_OFFSET0, addr); |
818 | WREG32(UVD_VCPU_CACHE_SIZE0, size); | 818 | WREG32(UVD_VCPU_CACHE_SIZE0, size); |
819 | 819 | ||
@@ -1829,6 +1829,8 @@ static int rv770_startup(struct radeon_device *rdev) | |||
1829 | /* enable pcie gen2 link */ | 1829 | /* enable pcie gen2 link */ |
1830 | rv770_pcie_gen2_enable(rdev); | 1830 | rv770_pcie_gen2_enable(rdev); |
1831 | 1831 | ||
1832 | rv770_mc_program(rdev); | ||
1833 | |||
1832 | if (!rdev->me_fw || !rdev->pfp_fw || !rdev->rlc_fw) { | 1834 | if (!rdev->me_fw || !rdev->pfp_fw || !rdev->rlc_fw) { |
1833 | r = r600_init_microcode(rdev); | 1835 | r = r600_init_microcode(rdev); |
1834 | if (r) { | 1836 | if (r) { |
@@ -1841,7 +1843,6 @@ static int rv770_startup(struct radeon_device *rdev) | |||
1841 | if (r) | 1843 | if (r) |
1842 | return r; | 1844 | return r; |
1843 | 1845 | ||
1844 | rv770_mc_program(rdev); | ||
1845 | if (rdev->flags & RADEON_IS_AGP) { | 1846 | if (rdev->flags & RADEON_IS_AGP) { |
1846 | rv770_agp_enable(rdev); | 1847 | rv770_agp_enable(rdev); |
1847 | } else { | 1848 | } else { |
@@ -1983,6 +1984,7 @@ int rv770_resume(struct radeon_device *rdev) | |||
1983 | int rv770_suspend(struct radeon_device *rdev) | 1984 | int rv770_suspend(struct radeon_device *rdev) |
1984 | { | 1985 | { |
1985 | r600_audio_fini(rdev); | 1986 | r600_audio_fini(rdev); |
1987 | r600_uvd_stop(rdev); | ||
1986 | radeon_uvd_suspend(rdev); | 1988 | radeon_uvd_suspend(rdev); |
1987 | r700_cp_stop(rdev); | 1989 | r700_cp_stop(rdev); |
1988 | r600_dma_stop(rdev); | 1990 | r600_dma_stop(rdev); |
@@ -2098,6 +2100,7 @@ void rv770_fini(struct radeon_device *rdev) | |||
2098 | radeon_ib_pool_fini(rdev); | 2100 | radeon_ib_pool_fini(rdev); |
2099 | radeon_irq_kms_fini(rdev); | 2101 | radeon_irq_kms_fini(rdev); |
2100 | rv770_pcie_gart_fini(rdev); | 2102 | rv770_pcie_gart_fini(rdev); |
2103 | r600_uvd_stop(rdev); | ||
2101 | radeon_uvd_fini(rdev); | 2104 | radeon_uvd_fini(rdev); |
2102 | r600_vram_scratch_fini(rdev); | 2105 | r600_vram_scratch_fini(rdev); |
2103 | radeon_gem_fini(rdev); | 2106 | radeon_gem_fini(rdev); |
diff --git a/drivers/gpu/drm/radeon/rv770_dpm.c b/drivers/gpu/drm/radeon/rv770_dpm.c index 2d347925f77d..094c67a29d0d 100644 --- a/drivers/gpu/drm/radeon/rv770_dpm.c +++ b/drivers/gpu/drm/radeon/rv770_dpm.c | |||
@@ -2319,12 +2319,25 @@ int rv7xx_parse_power_table(struct radeon_device *rdev) | |||
2319 | return 0; | 2319 | return 0; |
2320 | } | 2320 | } |
2321 | 2321 | ||
2322 | void rv770_get_engine_memory_ss(struct radeon_device *rdev) | ||
2323 | { | ||
2324 | struct rv7xx_power_info *pi = rv770_get_pi(rdev); | ||
2325 | struct radeon_atom_ss ss; | ||
2326 | |||
2327 | pi->sclk_ss = radeon_atombios_get_asic_ss_info(rdev, &ss, | ||
2328 | ASIC_INTERNAL_ENGINE_SS, 0); | ||
2329 | pi->mclk_ss = radeon_atombios_get_asic_ss_info(rdev, &ss, | ||
2330 | ASIC_INTERNAL_MEMORY_SS, 0); | ||
2331 | |||
2332 | if (pi->sclk_ss || pi->mclk_ss) | ||
2333 | pi->dynamic_ss = true; | ||
2334 | else | ||
2335 | pi->dynamic_ss = false; | ||
2336 | } | ||
2337 | |||
2322 | int rv770_dpm_init(struct radeon_device *rdev) | 2338 | int rv770_dpm_init(struct radeon_device *rdev) |
2323 | { | 2339 | { |
2324 | struct rv7xx_power_info *pi; | 2340 | struct rv7xx_power_info *pi; |
2325 | int index = GetIndexIntoMasterTable(DATA, ASIC_InternalSS_Info); | ||
2326 | uint16_t data_offset, size; | ||
2327 | uint8_t frev, crev; | ||
2328 | struct atom_clock_dividers dividers; | 2341 | struct atom_clock_dividers dividers; |
2329 | int ret; | 2342 | int ret; |
2330 | 2343 | ||
@@ -2369,16 +2382,7 @@ int rv770_dpm_init(struct radeon_device *rdev) | |||
2369 | pi->mvdd_control = | 2382 | pi->mvdd_control = |
2370 | radeon_atom_is_voltage_gpio(rdev, SET_VOLTAGE_TYPE_ASIC_MVDDC, 0); | 2383 | radeon_atom_is_voltage_gpio(rdev, SET_VOLTAGE_TYPE_ASIC_MVDDC, 0); |
2371 | 2384 | ||
2372 | if (atom_parse_data_header(rdev->mode_info.atom_context, index, &size, | 2385 | rv770_get_engine_memory_ss(rdev); |
2373 | &frev, &crev, &data_offset)) { | ||
2374 | pi->sclk_ss = true; | ||
2375 | pi->mclk_ss = true; | ||
2376 | pi->dynamic_ss = true; | ||
2377 | } else { | ||
2378 | pi->sclk_ss = false; | ||
2379 | pi->mclk_ss = false; | ||
2380 | pi->dynamic_ss = false; | ||
2381 | } | ||
2382 | 2386 | ||
2383 | pi->asi = RV770_ASI_DFLT; | 2387 | pi->asi = RV770_ASI_DFLT; |
2384 | pi->pasi = RV770_HASI_DFLT; | 2388 | pi->pasi = RV770_HASI_DFLT; |
@@ -2393,8 +2397,7 @@ int rv770_dpm_init(struct radeon_device *rdev) | |||
2393 | 2397 | ||
2394 | pi->dynamic_pcie_gen2 = true; | 2398 | pi->dynamic_pcie_gen2 = true; |
2395 | 2399 | ||
2396 | if (pi->gfx_clock_gating && | 2400 | if (rdev->pm.int_thermal_type != THERMAL_TYPE_NONE) |
2397 | (rdev->pm.int_thermal_type != THERMAL_TYPE_NONE)) | ||
2398 | pi->thermal_protection = true; | 2401 | pi->thermal_protection = true; |
2399 | else | 2402 | else |
2400 | pi->thermal_protection = false; | 2403 | pi->thermal_protection = false; |
diff --git a/drivers/gpu/drm/radeon/rv770_dpm.h b/drivers/gpu/drm/radeon/rv770_dpm.h index 96b1b2a62a8a..9244effc6b59 100644 --- a/drivers/gpu/drm/radeon/rv770_dpm.h +++ b/drivers/gpu/drm/radeon/rv770_dpm.h | |||
@@ -275,6 +275,7 @@ void rv770_set_uvd_clock_before_set_eng_clock(struct radeon_device *rdev, | |||
275 | void rv770_set_uvd_clock_after_set_eng_clock(struct radeon_device *rdev, | 275 | void rv770_set_uvd_clock_after_set_eng_clock(struct radeon_device *rdev, |
276 | struct radeon_ps *new_ps, | 276 | struct radeon_ps *new_ps, |
277 | struct radeon_ps *old_ps); | 277 | struct radeon_ps *old_ps); |
278 | void rv770_get_engine_memory_ss(struct radeon_device *rdev); | ||
278 | 279 | ||
279 | /* smc */ | 280 | /* smc */ |
280 | int rv770_read_smc_soft_register(struct radeon_device *rdev, | 281 | int rv770_read_smc_soft_register(struct radeon_device *rdev, |
diff --git a/drivers/gpu/drm/radeon/si.c b/drivers/gpu/drm/radeon/si.c index 6ca904673a4f..daa8d2df8ec5 100644 --- a/drivers/gpu/drm/radeon/si.c +++ b/drivers/gpu/drm/radeon/si.c | |||
@@ -1663,9 +1663,13 @@ static int si_init_microcode(struct radeon_device *rdev) | |||
1663 | 1663 | ||
1664 | snprintf(fw_name, sizeof(fw_name), "radeon/%s_smc.bin", chip_name); | 1664 | snprintf(fw_name, sizeof(fw_name), "radeon/%s_smc.bin", chip_name); |
1665 | err = request_firmware(&rdev->smc_fw, fw_name, rdev->dev); | 1665 | err = request_firmware(&rdev->smc_fw, fw_name, rdev->dev); |
1666 | if (err) | 1666 | if (err) { |
1667 | goto out; | 1667 | printk(KERN_ERR |
1668 | if (rdev->smc_fw->size != smc_req_size) { | 1668 | "smc: error loading firmware \"%s\"\n", |
1669 | fw_name); | ||
1670 | release_firmware(rdev->smc_fw); | ||
1671 | rdev->smc_fw = NULL; | ||
1672 | } else if (rdev->smc_fw->size != smc_req_size) { | ||
1669 | printk(KERN_ERR | 1673 | printk(KERN_ERR |
1670 | "si_smc: Bogus length %zu in firmware \"%s\"\n", | 1674 | "si_smc: Bogus length %zu in firmware \"%s\"\n", |
1671 | rdev->smc_fw->size, fw_name); | 1675 | rdev->smc_fw->size, fw_name); |
@@ -6418,6 +6422,8 @@ static int si_startup(struct radeon_device *rdev) | |||
6418 | /* enable aspm */ | 6422 | /* enable aspm */ |
6419 | si_program_aspm(rdev); | 6423 | si_program_aspm(rdev); |
6420 | 6424 | ||
6425 | si_mc_program(rdev); | ||
6426 | |||
6421 | if (!rdev->me_fw || !rdev->pfp_fw || !rdev->ce_fw || | 6427 | if (!rdev->me_fw || !rdev->pfp_fw || !rdev->ce_fw || |
6422 | !rdev->rlc_fw || !rdev->mc_fw) { | 6428 | !rdev->rlc_fw || !rdev->mc_fw) { |
6423 | r = si_init_microcode(rdev); | 6429 | r = si_init_microcode(rdev); |
@@ -6437,7 +6443,6 @@ static int si_startup(struct radeon_device *rdev) | |||
6437 | if (r) | 6443 | if (r) |
6438 | return r; | 6444 | return r; |
6439 | 6445 | ||
6440 | si_mc_program(rdev); | ||
6441 | r = si_pcie_gart_enable(rdev); | 6446 | r = si_pcie_gart_enable(rdev); |
6442 | if (r) | 6447 | if (r) |
6443 | return r; | 6448 | return r; |
@@ -6621,7 +6626,7 @@ int si_suspend(struct radeon_device *rdev) | |||
6621 | si_cp_enable(rdev, false); | 6626 | si_cp_enable(rdev, false); |
6622 | cayman_dma_stop(rdev); | 6627 | cayman_dma_stop(rdev); |
6623 | if (rdev->has_uvd) { | 6628 | if (rdev->has_uvd) { |
6624 | r600_uvd_rbc_stop(rdev); | 6629 | r600_uvd_stop(rdev); |
6625 | radeon_uvd_suspend(rdev); | 6630 | radeon_uvd_suspend(rdev); |
6626 | } | 6631 | } |
6627 | si_irq_suspend(rdev); | 6632 | si_irq_suspend(rdev); |
@@ -6763,8 +6768,10 @@ void si_fini(struct radeon_device *rdev) | |||
6763 | radeon_vm_manager_fini(rdev); | 6768 | radeon_vm_manager_fini(rdev); |
6764 | radeon_ib_pool_fini(rdev); | 6769 | radeon_ib_pool_fini(rdev); |
6765 | radeon_irq_kms_fini(rdev); | 6770 | radeon_irq_kms_fini(rdev); |
6766 | if (rdev->has_uvd) | 6771 | if (rdev->has_uvd) { |
6772 | r600_uvd_stop(rdev); | ||
6767 | radeon_uvd_fini(rdev); | 6773 | radeon_uvd_fini(rdev); |
6774 | } | ||
6768 | si_pcie_gart_fini(rdev); | 6775 | si_pcie_gart_fini(rdev); |
6769 | r600_vram_scratch_fini(rdev); | 6776 | r600_vram_scratch_fini(rdev); |
6770 | radeon_gem_fini(rdev); | 6777 | radeon_gem_fini(rdev); |
diff --git a/drivers/gpu/drm/radeon/si_dpm.c b/drivers/gpu/drm/radeon/si_dpm.c index 7ad22e87cd62..88699e3cd868 100644 --- a/drivers/gpu/drm/radeon/si_dpm.c +++ b/drivers/gpu/drm/radeon/si_dpm.c | |||
@@ -1767,7 +1767,7 @@ static void si_calculate_leakage_for_v_and_t_formula(const struct ni_leakage_coe | |||
1767 | s64 temperature, t_slope, t_intercept, av, bv, t_ref; | 1767 | s64 temperature, t_slope, t_intercept, av, bv, t_ref; |
1768 | s64 tmp; | 1768 | s64 tmp; |
1769 | 1769 | ||
1770 | i_leakage = drm_int2fixp(ileakage) / 100; | 1770 | i_leakage = div64_s64(drm_int2fixp(ileakage), 100); |
1771 | vddc = div64_s64(drm_int2fixp(v), 1000); | 1771 | vddc = div64_s64(drm_int2fixp(v), 1000); |
1772 | temperature = div64_s64(drm_int2fixp(t), 1000); | 1772 | temperature = div64_s64(drm_int2fixp(t), 1000); |
1773 | 1773 | ||
@@ -2903,7 +2903,8 @@ static void si_apply_state_adjust_rules(struct radeon_device *rdev, | |||
2903 | { | 2903 | { |
2904 | struct ni_ps *ps = ni_get_ps(rps); | 2904 | struct ni_ps *ps = ni_get_ps(rps); |
2905 | struct radeon_clock_and_voltage_limits *max_limits; | 2905 | struct radeon_clock_and_voltage_limits *max_limits; |
2906 | bool disable_mclk_switching; | 2906 | bool disable_mclk_switching = false; |
2907 | bool disable_sclk_switching = false; | ||
2907 | u32 mclk, sclk; | 2908 | u32 mclk, sclk; |
2908 | u16 vddc, vddci; | 2909 | u16 vddc, vddci; |
2909 | int i; | 2910 | int i; |
@@ -2911,8 +2912,11 @@ static void si_apply_state_adjust_rules(struct radeon_device *rdev, | |||
2911 | if ((rdev->pm.dpm.new_active_crtc_count > 1) || | 2912 | if ((rdev->pm.dpm.new_active_crtc_count > 1) || |
2912 | ni_dpm_vblank_too_short(rdev)) | 2913 | ni_dpm_vblank_too_short(rdev)) |
2913 | disable_mclk_switching = true; | 2914 | disable_mclk_switching = true; |
2914 | else | 2915 | |
2915 | disable_mclk_switching = false; | 2916 | if (rps->vclk || rps->dclk) { |
2917 | disable_mclk_switching = true; | ||
2918 | disable_sclk_switching = true; | ||
2919 | } | ||
2916 | 2920 | ||
2917 | if (rdev->pm.dpm.ac_power) | 2921 | if (rdev->pm.dpm.ac_power) |
2918 | max_limits = &rdev->pm.dpm.dyn_state.max_clock_voltage_on_ac; | 2922 | max_limits = &rdev->pm.dpm.dyn_state.max_clock_voltage_on_ac; |
@@ -2940,27 +2944,43 @@ static void si_apply_state_adjust_rules(struct radeon_device *rdev, | |||
2940 | 2944 | ||
2941 | if (disable_mclk_switching) { | 2945 | if (disable_mclk_switching) { |
2942 | mclk = ps->performance_levels[ps->performance_level_count - 1].mclk; | 2946 | mclk = ps->performance_levels[ps->performance_level_count - 1].mclk; |
2943 | sclk = ps->performance_levels[0].sclk; | ||
2944 | vddc = ps->performance_levels[0].vddc; | ||
2945 | vddci = ps->performance_levels[ps->performance_level_count - 1].vddci; | 2947 | vddci = ps->performance_levels[ps->performance_level_count - 1].vddci; |
2946 | } else { | 2948 | } else { |
2947 | sclk = ps->performance_levels[0].sclk; | ||
2948 | mclk = ps->performance_levels[0].mclk; | 2949 | mclk = ps->performance_levels[0].mclk; |
2949 | vddc = ps->performance_levels[0].vddc; | ||
2950 | vddci = ps->performance_levels[0].vddci; | 2950 | vddci = ps->performance_levels[0].vddci; |
2951 | } | 2951 | } |
2952 | 2952 | ||
2953 | if (disable_sclk_switching) { | ||
2954 | sclk = ps->performance_levels[ps->performance_level_count - 1].sclk; | ||
2955 | vddc = ps->performance_levels[ps->performance_level_count - 1].vddc; | ||
2956 | } else { | ||
2957 | sclk = ps->performance_levels[0].sclk; | ||
2958 | vddc = ps->performance_levels[0].vddc; | ||
2959 | } | ||
2960 | |||
2953 | /* adjusted low state */ | 2961 | /* adjusted low state */ |
2954 | ps->performance_levels[0].sclk = sclk; | 2962 | ps->performance_levels[0].sclk = sclk; |
2955 | ps->performance_levels[0].mclk = mclk; | 2963 | ps->performance_levels[0].mclk = mclk; |
2956 | ps->performance_levels[0].vddc = vddc; | 2964 | ps->performance_levels[0].vddc = vddc; |
2957 | ps->performance_levels[0].vddci = vddci; | 2965 | ps->performance_levels[0].vddci = vddci; |
2958 | 2966 | ||
2959 | for (i = 1; i < ps->performance_level_count; i++) { | 2967 | if (disable_sclk_switching) { |
2960 | if (ps->performance_levels[i].sclk < ps->performance_levels[i - 1].sclk) | 2968 | sclk = ps->performance_levels[0].sclk; |
2961 | ps->performance_levels[i].sclk = ps->performance_levels[i - 1].sclk; | 2969 | for (i = 1; i < ps->performance_level_count; i++) { |
2962 | if (ps->performance_levels[i].vddc < ps->performance_levels[i - 1].vddc) | 2970 | if (sclk < ps->performance_levels[i].sclk) |
2963 | ps->performance_levels[i].vddc = ps->performance_levels[i - 1].vddc; | 2971 | sclk = ps->performance_levels[i].sclk; |
2972 | } | ||
2973 | for (i = 0; i < ps->performance_level_count; i++) { | ||
2974 | ps->performance_levels[i].sclk = sclk; | ||
2975 | ps->performance_levels[i].vddc = vddc; | ||
2976 | } | ||
2977 | } else { | ||
2978 | for (i = 1; i < ps->performance_level_count; i++) { | ||
2979 | if (ps->performance_levels[i].sclk < ps->performance_levels[i - 1].sclk) | ||
2980 | ps->performance_levels[i].sclk = ps->performance_levels[i - 1].sclk; | ||
2981 | if (ps->performance_levels[i].vddc < ps->performance_levels[i - 1].vddc) | ||
2982 | ps->performance_levels[i].vddc = ps->performance_levels[i - 1].vddc; | ||
2983 | } | ||
2964 | } | 2984 | } |
2965 | 2985 | ||
2966 | if (disable_mclk_switching) { | 2986 | if (disable_mclk_switching) { |
@@ -6253,9 +6273,6 @@ int si_dpm_init(struct radeon_device *rdev) | |||
6253 | struct evergreen_power_info *eg_pi; | 6273 | struct evergreen_power_info *eg_pi; |
6254 | struct ni_power_info *ni_pi; | 6274 | struct ni_power_info *ni_pi; |
6255 | struct si_power_info *si_pi; | 6275 | struct si_power_info *si_pi; |
6256 | int index = GetIndexIntoMasterTable(DATA, ASIC_InternalSS_Info); | ||
6257 | u16 data_offset, size; | ||
6258 | u8 frev, crev; | ||
6259 | struct atom_clock_dividers dividers; | 6276 | struct atom_clock_dividers dividers; |
6260 | int ret; | 6277 | int ret; |
6261 | u32 mask; | 6278 | u32 mask; |
@@ -6346,16 +6363,7 @@ int si_dpm_init(struct radeon_device *rdev) | |||
6346 | si_pi->vddc_phase_shed_control = | 6363 | si_pi->vddc_phase_shed_control = |
6347 | radeon_atom_is_voltage_gpio(rdev, SET_VOLTAGE_TYPE_ASIC_VDDC, VOLTAGE_OBJ_PHASE_LUT); | 6364 | radeon_atom_is_voltage_gpio(rdev, SET_VOLTAGE_TYPE_ASIC_VDDC, VOLTAGE_OBJ_PHASE_LUT); |
6348 | 6365 | ||
6349 | if (atom_parse_data_header(rdev->mode_info.atom_context, index, &size, | 6366 | rv770_get_engine_memory_ss(rdev); |
6350 | &frev, &crev, &data_offset)) { | ||
6351 | pi->sclk_ss = true; | ||
6352 | pi->mclk_ss = true; | ||
6353 | pi->dynamic_ss = true; | ||
6354 | } else { | ||
6355 | pi->sclk_ss = false; | ||
6356 | pi->mclk_ss = false; | ||
6357 | pi->dynamic_ss = true; | ||
6358 | } | ||
6359 | 6367 | ||
6360 | pi->asi = RV770_ASI_DFLT; | 6368 | pi->asi = RV770_ASI_DFLT; |
6361 | pi->pasi = CYPRESS_HASI_DFLT; | 6369 | pi->pasi = CYPRESS_HASI_DFLT; |
@@ -6366,8 +6374,7 @@ int si_dpm_init(struct radeon_device *rdev) | |||
6366 | eg_pi->sclk_deep_sleep = true; | 6374 | eg_pi->sclk_deep_sleep = true; |
6367 | si_pi->sclk_deep_sleep_above_low = false; | 6375 | si_pi->sclk_deep_sleep_above_low = false; |
6368 | 6376 | ||
6369 | if (pi->gfx_clock_gating && | 6377 | if (rdev->pm.int_thermal_type != THERMAL_TYPE_NONE) |
6370 | (rdev->pm.int_thermal_type != THERMAL_TYPE_NONE)) | ||
6371 | pi->thermal_protection = true; | 6378 | pi->thermal_protection = true; |
6372 | else | 6379 | else |
6373 | pi->thermal_protection = false; | 6380 | pi->thermal_protection = false; |
diff --git a/drivers/hid/hid-logitech-dj.c b/drivers/hid/hid-logitech-dj.c index 7a5764843bfb..cd33084c7860 100644 --- a/drivers/hid/hid-logitech-dj.c +++ b/drivers/hid/hid-logitech-dj.c | |||
@@ -488,8 +488,6 @@ static int logi_dj_recv_query_paired_devices(struct dj_receiver_dev *djrcv_dev) | |||
488 | if (djrcv_dev->querying_devices) | 488 | if (djrcv_dev->querying_devices) |
489 | return 0; | 489 | return 0; |
490 | 490 | ||
491 | djrcv_dev->querying_devices = true; | ||
492 | |||
493 | dj_report = kzalloc(sizeof(struct dj_report), GFP_KERNEL); | 491 | dj_report = kzalloc(sizeof(struct dj_report), GFP_KERNEL); |
494 | if (!dj_report) | 492 | if (!dj_report) |
495 | return -ENOMEM; | 493 | return -ENOMEM; |
diff --git a/drivers/hwmon/adt7470.c b/drivers/hwmon/adt7470.c index 0f34bca9f5e5..6099f50b28aa 100644 --- a/drivers/hwmon/adt7470.c +++ b/drivers/hwmon/adt7470.c | |||
@@ -215,7 +215,7 @@ static inline int adt7470_write_word_data(struct i2c_client *client, u8 reg, | |||
215 | u16 value) | 215 | u16 value) |
216 | { | 216 | { |
217 | return i2c_smbus_write_byte_data(client, reg, value & 0xFF) | 217 | return i2c_smbus_write_byte_data(client, reg, value & 0xFF) |
218 | && i2c_smbus_write_byte_data(client, reg + 1, value >> 8); | 218 | || i2c_smbus_write_byte_data(client, reg + 1, value >> 8); |
219 | } | 219 | } |
220 | 220 | ||
221 | static void adt7470_init_client(struct i2c_client *client) | 221 | static void adt7470_init_client(struct i2c_client *client) |
diff --git a/drivers/i2c/busses/i2c-kempld.c b/drivers/i2c/busses/i2c-kempld.c index ccec916bc3eb..af8f65fb1c05 100644 --- a/drivers/i2c/busses/i2c-kempld.c +++ b/drivers/i2c/busses/i2c-kempld.c | |||
@@ -246,9 +246,9 @@ static void kempld_i2c_device_init(struct kempld_i2c_data *i2c) | |||
246 | bus_frequency = KEMPLD_I2C_FREQ_MAX; | 246 | bus_frequency = KEMPLD_I2C_FREQ_MAX; |
247 | 247 | ||
248 | if (pld->info.spec_major == 1) | 248 | if (pld->info.spec_major == 1) |
249 | prescale = pld->pld_clock / bus_frequency * 5 - 1000; | 249 | prescale = pld->pld_clock / (bus_frequency * 5) - 1000; |
250 | else | 250 | else |
251 | prescale = pld->pld_clock / bus_frequency * 4 - 3000; | 251 | prescale = pld->pld_clock / (bus_frequency * 4) - 3000; |
252 | 252 | ||
253 | if (prescale < 0) | 253 | if (prescale < 0) |
254 | prescale = 0; | 254 | prescale = 0; |
diff --git a/drivers/i2c/busses/i2c-mxs.c b/drivers/i2c/busses/i2c-mxs.c index df8ff5aea5b5..e2e9a0dade96 100644 --- a/drivers/i2c/busses/i2c-mxs.c +++ b/drivers/i2c/busses/i2c-mxs.c | |||
@@ -493,7 +493,7 @@ static int mxs_i2c_xfer_msg(struct i2c_adapter *adap, struct i2c_msg *msg, | |||
493 | * based on this empirical measurement and a lot of previous frobbing. | 493 | * based on this empirical measurement and a lot of previous frobbing. |
494 | */ | 494 | */ |
495 | i2c->cmd_err = 0; | 495 | i2c->cmd_err = 0; |
496 | if (msg->len < 8) { | 496 | if (0) { /* disable PIO mode until a proper fix is made */ |
497 | ret = mxs_i2c_pio_setup_xfer(adap, msg, flags); | 497 | ret = mxs_i2c_pio_setup_xfer(adap, msg, flags); |
498 | if (ret) | 498 | if (ret) |
499 | mxs_i2c_reset(i2c); | 499 | mxs_i2c_reset(i2c); |
diff --git a/drivers/iio/adc/ti_am335x_adc.c b/drivers/iio/adc/ti_am335x_adc.c index 0ad208a69c29..3ceac3e91dde 100644 --- a/drivers/iio/adc/ti_am335x_adc.c +++ b/drivers/iio/adc/ti_am335x_adc.c | |||
@@ -60,7 +60,6 @@ static void tiadc_step_config(struct tiadc_device *adc_dev) | |||
60 | { | 60 | { |
61 | unsigned int stepconfig; | 61 | unsigned int stepconfig; |
62 | int i, steps; | 62 | int i, steps; |
63 | u32 step_en; | ||
64 | 63 | ||
65 | /* | 64 | /* |
66 | * There are 16 configurable steps and 8 analog input | 65 | * There are 16 configurable steps and 8 analog input |
@@ -86,8 +85,7 @@ static void tiadc_step_config(struct tiadc_device *adc_dev) | |||
86 | adc_dev->channel_step[i] = steps; | 85 | adc_dev->channel_step[i] = steps; |
87 | steps++; | 86 | steps++; |
88 | } | 87 | } |
89 | step_en = get_adc_step_mask(adc_dev); | 88 | |
90 | am335x_tsc_se_set(adc_dev->mfd_tscadc, step_en); | ||
91 | } | 89 | } |
92 | 90 | ||
93 | static const char * const chan_name_ain[] = { | 91 | static const char * const chan_name_ain[] = { |
@@ -142,10 +140,22 @@ static int tiadc_read_raw(struct iio_dev *indio_dev, | |||
142 | int *val, int *val2, long mask) | 140 | int *val, int *val2, long mask) |
143 | { | 141 | { |
144 | struct tiadc_device *adc_dev = iio_priv(indio_dev); | 142 | struct tiadc_device *adc_dev = iio_priv(indio_dev); |
145 | int i; | 143 | int i, map_val; |
146 | unsigned int fifo1count, read; | 144 | unsigned int fifo1count, read, stepid; |
147 | u32 step = UINT_MAX; | 145 | u32 step = UINT_MAX; |
148 | bool found = false; | 146 | bool found = false; |
147 | u32 step_en; | ||
148 | unsigned long timeout = jiffies + usecs_to_jiffies | ||
149 | (IDLE_TIMEOUT * adc_dev->channels); | ||
150 | step_en = get_adc_step_mask(adc_dev); | ||
151 | am335x_tsc_se_set(adc_dev->mfd_tscadc, step_en); | ||
152 | |||
153 | /* Wait for ADC sequencer to complete sampling */ | ||
154 | while (tiadc_readl(adc_dev, REG_ADCFSM) & SEQ_STATUS) { | ||
155 | if (time_after(jiffies, timeout)) | ||
156 | return -EAGAIN; | ||
157 | } | ||
158 | map_val = chan->channel + TOTAL_CHANNELS; | ||
149 | 159 | ||
150 | /* | 160 | /* |
151 | * When the sub-system is first enabled, | 161 | * When the sub-system is first enabled, |
@@ -170,12 +180,16 @@ static int tiadc_read_raw(struct iio_dev *indio_dev, | |||
170 | fifo1count = tiadc_readl(adc_dev, REG_FIFO1CNT); | 180 | fifo1count = tiadc_readl(adc_dev, REG_FIFO1CNT); |
171 | for (i = 0; i < fifo1count; i++) { | 181 | for (i = 0; i < fifo1count; i++) { |
172 | read = tiadc_readl(adc_dev, REG_FIFO1); | 182 | read = tiadc_readl(adc_dev, REG_FIFO1); |
173 | if (read >> 16 == step) { | 183 | stepid = read & FIFOREAD_CHNLID_MASK; |
174 | *val = read & 0xfff; | 184 | stepid = stepid >> 0x10; |
185 | |||
186 | if (stepid == map_val) { | ||
187 | read = read & FIFOREAD_DATA_MASK; | ||
175 | found = true; | 188 | found = true; |
189 | *val = read; | ||
176 | } | 190 | } |
177 | } | 191 | } |
178 | am335x_tsc_se_update(adc_dev->mfd_tscadc); | 192 | |
179 | if (found == false) | 193 | if (found == false) |
180 | return -EBUSY; | 194 | return -EBUSY; |
181 | return IIO_VAL_INT; | 195 | return IIO_VAL_INT; |
diff --git a/drivers/iio/industrialio-trigger.c b/drivers/iio/industrialio-trigger.c index ea8a4146620d..0dd9bb873130 100644 --- a/drivers/iio/industrialio-trigger.c +++ b/drivers/iio/industrialio-trigger.c | |||
@@ -127,12 +127,17 @@ static struct iio_trigger *iio_trigger_find_by_name(const char *name, | |||
127 | void iio_trigger_poll(struct iio_trigger *trig, s64 time) | 127 | void iio_trigger_poll(struct iio_trigger *trig, s64 time) |
128 | { | 128 | { |
129 | int i; | 129 | int i; |
130 | if (!trig->use_count) | 130 | |
131 | for (i = 0; i < CONFIG_IIO_CONSUMERS_PER_TRIGGER; i++) | 131 | if (!atomic_read(&trig->use_count)) { |
132 | if (trig->subirqs[i].enabled) { | 132 | atomic_set(&trig->use_count, CONFIG_IIO_CONSUMERS_PER_TRIGGER); |
133 | trig->use_count++; | 133 | |
134 | for (i = 0; i < CONFIG_IIO_CONSUMERS_PER_TRIGGER; i++) { | ||
135 | if (trig->subirqs[i].enabled) | ||
134 | generic_handle_irq(trig->subirq_base + i); | 136 | generic_handle_irq(trig->subirq_base + i); |
135 | } | 137 | else |
138 | iio_trigger_notify_done(trig); | ||
139 | } | ||
140 | } | ||
136 | } | 141 | } |
137 | EXPORT_SYMBOL(iio_trigger_poll); | 142 | EXPORT_SYMBOL(iio_trigger_poll); |
138 | 143 | ||
@@ -146,19 +151,24 @@ EXPORT_SYMBOL(iio_trigger_generic_data_rdy_poll); | |||
146 | void iio_trigger_poll_chained(struct iio_trigger *trig, s64 time) | 151 | void iio_trigger_poll_chained(struct iio_trigger *trig, s64 time) |
147 | { | 152 | { |
148 | int i; | 153 | int i; |
149 | if (!trig->use_count) | 154 | |
150 | for (i = 0; i < CONFIG_IIO_CONSUMERS_PER_TRIGGER; i++) | 155 | if (!atomic_read(&trig->use_count)) { |
151 | if (trig->subirqs[i].enabled) { | 156 | atomic_set(&trig->use_count, CONFIG_IIO_CONSUMERS_PER_TRIGGER); |
152 | trig->use_count++; | 157 | |
158 | for (i = 0; i < CONFIG_IIO_CONSUMERS_PER_TRIGGER; i++) { | ||
159 | if (trig->subirqs[i].enabled) | ||
153 | handle_nested_irq(trig->subirq_base + i); | 160 | handle_nested_irq(trig->subirq_base + i); |
154 | } | 161 | else |
162 | iio_trigger_notify_done(trig); | ||
163 | } | ||
164 | } | ||
155 | } | 165 | } |
156 | EXPORT_SYMBOL(iio_trigger_poll_chained); | 166 | EXPORT_SYMBOL(iio_trigger_poll_chained); |
157 | 167 | ||
158 | void iio_trigger_notify_done(struct iio_trigger *trig) | 168 | void iio_trigger_notify_done(struct iio_trigger *trig) |
159 | { | 169 | { |
160 | trig->use_count--; | 170 | if (atomic_dec_and_test(&trig->use_count) && trig->ops && |
161 | if (trig->use_count == 0 && trig->ops && trig->ops->try_reenable) | 171 | trig->ops->try_reenable) |
162 | if (trig->ops->try_reenable(trig)) | 172 | if (trig->ops->try_reenable(trig)) |
163 | /* Missed an interrupt so launch new poll now */ | 173 | /* Missed an interrupt so launch new poll now */ |
164 | iio_trigger_poll(trig, 0); | 174 | iio_trigger_poll(trig, 0); |
diff --git a/drivers/media/i2c/ml86v7667.c b/drivers/media/i2c/ml86v7667.c index efdc873e58d1..a9857022f71d 100644 --- a/drivers/media/i2c/ml86v7667.c +++ b/drivers/media/i2c/ml86v7667.c | |||
@@ -117,7 +117,7 @@ static int ml86v7667_s_ctrl(struct v4l2_ctrl *ctrl) | |||
117 | { | 117 | { |
118 | struct v4l2_subdev *sd = to_sd(ctrl); | 118 | struct v4l2_subdev *sd = to_sd(ctrl); |
119 | struct i2c_client *client = v4l2_get_subdevdata(sd); | 119 | struct i2c_client *client = v4l2_get_subdevdata(sd); |
120 | int ret; | 120 | int ret = -EINVAL; |
121 | 121 | ||
122 | switch (ctrl->id) { | 122 | switch (ctrl->id) { |
123 | case V4L2_CID_BRIGHTNESS: | 123 | case V4L2_CID_BRIGHTNESS: |
@@ -157,7 +157,7 @@ static int ml86v7667_s_ctrl(struct v4l2_ctrl *ctrl) | |||
157 | break; | 157 | break; |
158 | } | 158 | } |
159 | 159 | ||
160 | return 0; | 160 | return ret; |
161 | } | 161 | } |
162 | 162 | ||
163 | static int ml86v7667_querystd(struct v4l2_subdev *sd, v4l2_std_id *std) | 163 | static int ml86v7667_querystd(struct v4l2_subdev *sd, v4l2_std_id *std) |
diff --git a/drivers/media/platform/coda.c b/drivers/media/platform/coda.c index df4ada880e42..bd9405df1bd6 100644 --- a/drivers/media/platform/coda.c +++ b/drivers/media/platform/coda.c | |||
@@ -1987,7 +1987,7 @@ MODULE_DEVICE_TABLE(platform, coda_platform_ids); | |||
1987 | 1987 | ||
1988 | #ifdef CONFIG_OF | 1988 | #ifdef CONFIG_OF |
1989 | static const struct of_device_id coda_dt_ids[] = { | 1989 | static const struct of_device_id coda_dt_ids[] = { |
1990 | { .compatible = "fsl,imx27-vpu", .data = &coda_platform_ids[CODA_IMX27] }, | 1990 | { .compatible = "fsl,imx27-vpu", .data = &coda_devdata[CODA_IMX27] }, |
1991 | { .compatible = "fsl,imx53-vpu", .data = &coda_devdata[CODA_IMX53] }, | 1991 | { .compatible = "fsl,imx53-vpu", .data = &coda_devdata[CODA_IMX53] }, |
1992 | { /* sentinel */ } | 1992 | { /* sentinel */ } |
1993 | }; | 1993 | }; |
diff --git a/drivers/media/platform/s5p-g2d/g2d.c b/drivers/media/platform/s5p-g2d/g2d.c index 553d87e5ceab..fd6289d60cde 100644 --- a/drivers/media/platform/s5p-g2d/g2d.c +++ b/drivers/media/platform/s5p-g2d/g2d.c | |||
@@ -784,6 +784,7 @@ static int g2d_probe(struct platform_device *pdev) | |||
784 | } | 784 | } |
785 | *vfd = g2d_videodev; | 785 | *vfd = g2d_videodev; |
786 | vfd->lock = &dev->mutex; | 786 | vfd->lock = &dev->mutex; |
787 | vfd->v4l2_dev = &dev->v4l2_dev; | ||
787 | ret = video_register_device(vfd, VFL_TYPE_GRABBER, 0); | 788 | ret = video_register_device(vfd, VFL_TYPE_GRABBER, 0); |
788 | if (ret) { | 789 | if (ret) { |
789 | v4l2_err(&dev->v4l2_dev, "Failed to register video device\n"); | 790 | v4l2_err(&dev->v4l2_dev, "Failed to register video device\n"); |
diff --git a/drivers/media/platform/s5p-mfc/s5p_mfc_dec.c b/drivers/media/platform/s5p-mfc/s5p_mfc_dec.c index 5296385153d5..4f6dd42c9adb 100644 --- a/drivers/media/platform/s5p-mfc/s5p_mfc_dec.c +++ b/drivers/media/platform/s5p-mfc/s5p_mfc_dec.c | |||
@@ -344,7 +344,7 @@ static int vidioc_g_fmt(struct file *file, void *priv, struct v4l2_format *f) | |||
344 | pix_mp->num_planes = 2; | 344 | pix_mp->num_planes = 2; |
345 | /* Set pixelformat to the format in which MFC | 345 | /* Set pixelformat to the format in which MFC |
346 | outputs the decoded frame */ | 346 | outputs the decoded frame */ |
347 | pix_mp->pixelformat = V4L2_PIX_FMT_NV12MT; | 347 | pix_mp->pixelformat = ctx->dst_fmt->fourcc; |
348 | pix_mp->plane_fmt[0].bytesperline = ctx->buf_width; | 348 | pix_mp->plane_fmt[0].bytesperline = ctx->buf_width; |
349 | pix_mp->plane_fmt[0].sizeimage = ctx->luma_size; | 349 | pix_mp->plane_fmt[0].sizeimage = ctx->luma_size; |
350 | pix_mp->plane_fmt[1].bytesperline = ctx->buf_width; | 350 | pix_mp->plane_fmt[1].bytesperline = ctx->buf_width; |
@@ -382,10 +382,16 @@ static int vidioc_try_fmt(struct file *file, void *priv, struct v4l2_format *f) | |||
382 | mfc_err("Unsupported format for source.\n"); | 382 | mfc_err("Unsupported format for source.\n"); |
383 | return -EINVAL; | 383 | return -EINVAL; |
384 | } | 384 | } |
385 | if (!IS_MFCV6(dev) && (fmt->fourcc == V4L2_PIX_FMT_VP8)) { | 385 | if (fmt->codec_mode == S5P_FIMV_CODEC_NONE) { |
386 | mfc_err("Not supported format.\n"); | 386 | mfc_err("Unknown codec\n"); |
387 | return -EINVAL; | 387 | return -EINVAL; |
388 | } | 388 | } |
389 | if (!IS_MFCV6(dev)) { | ||
390 | if (fmt->fourcc == V4L2_PIX_FMT_VP8) { | ||
391 | mfc_err("Not supported format.\n"); | ||
392 | return -EINVAL; | ||
393 | } | ||
394 | } | ||
389 | } else if (f->type == V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE) { | 395 | } else if (f->type == V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE) { |
390 | fmt = find_format(f, MFC_FMT_RAW); | 396 | fmt = find_format(f, MFC_FMT_RAW); |
391 | if (!fmt) { | 397 | if (!fmt) { |
@@ -411,7 +417,6 @@ static int vidioc_s_fmt(struct file *file, void *priv, struct v4l2_format *f) | |||
411 | struct s5p_mfc_dev *dev = video_drvdata(file); | 417 | struct s5p_mfc_dev *dev = video_drvdata(file); |
412 | struct s5p_mfc_ctx *ctx = fh_to_ctx(priv); | 418 | struct s5p_mfc_ctx *ctx = fh_to_ctx(priv); |
413 | int ret = 0; | 419 | int ret = 0; |
414 | struct s5p_mfc_fmt *fmt; | ||
415 | struct v4l2_pix_format_mplane *pix_mp; | 420 | struct v4l2_pix_format_mplane *pix_mp; |
416 | 421 | ||
417 | mfc_debug_enter(); | 422 | mfc_debug_enter(); |
@@ -425,54 +430,32 @@ static int vidioc_s_fmt(struct file *file, void *priv, struct v4l2_format *f) | |||
425 | goto out; | 430 | goto out; |
426 | } | 431 | } |
427 | if (f->type == V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE) { | 432 | if (f->type == V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE) { |
428 | fmt = find_format(f, MFC_FMT_RAW); | 433 | /* dst_fmt is validated by call to vidioc_try_fmt */ |
429 | if (!fmt) { | 434 | ctx->dst_fmt = find_format(f, MFC_FMT_RAW); |
430 | mfc_err("Unsupported format for source.\n"); | 435 | ret = 0; |
431 | return -EINVAL; | ||
432 | } | ||
433 | if (!IS_MFCV6(dev) && (fmt->fourcc != V4L2_PIX_FMT_NV12MT)) { | ||
434 | mfc_err("Not supported format.\n"); | ||
435 | return -EINVAL; | ||
436 | } else if (IS_MFCV6(dev) && | ||
437 | (fmt->fourcc == V4L2_PIX_FMT_NV12MT)) { | ||
438 | mfc_err("Not supported format.\n"); | ||
439 | return -EINVAL; | ||
440 | } | ||
441 | ctx->dst_fmt = fmt; | ||
442 | mfc_debug_leave(); | ||
443 | return ret; | ||
444 | } else if (f->type != V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE) { | ||
445 | mfc_err("Wrong type error for S_FMT : %d", f->type); | ||
446 | return -EINVAL; | ||
447 | } | ||
448 | fmt = find_format(f, MFC_FMT_DEC); | ||
449 | if (!fmt || fmt->codec_mode == S5P_MFC_CODEC_NONE) { | ||
450 | mfc_err("Unknown codec\n"); | ||
451 | ret = -EINVAL; | ||
452 | goto out; | 436 | goto out; |
453 | } | 437 | } else if (f->type == V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE) { |
454 | if (fmt->type != MFC_FMT_DEC) { | 438 | /* src_fmt is validated by call to vidioc_try_fmt */ |
455 | mfc_err("Wrong format selected, you should choose " | 439 | ctx->src_fmt = find_format(f, MFC_FMT_DEC); |
456 | "format for decoding\n"); | 440 | ctx->codec_mode = ctx->src_fmt->codec_mode; |
441 | mfc_debug(2, "The codec number is: %d\n", ctx->codec_mode); | ||
442 | pix_mp->height = 0; | ||
443 | pix_mp->width = 0; | ||
444 | if (pix_mp->plane_fmt[0].sizeimage) | ||
445 | ctx->dec_src_buf_size = pix_mp->plane_fmt[0].sizeimage; | ||
446 | else | ||
447 | pix_mp->plane_fmt[0].sizeimage = ctx->dec_src_buf_size = | ||
448 | DEF_CPB_SIZE; | ||
449 | pix_mp->plane_fmt[0].bytesperline = 0; | ||
450 | ctx->state = MFCINST_INIT; | ||
451 | ret = 0; | ||
452 | goto out; | ||
453 | } else { | ||
454 | mfc_err("Wrong type error for S_FMT : %d", f->type); | ||
457 | ret = -EINVAL; | 455 | ret = -EINVAL; |
458 | goto out; | 456 | goto out; |
459 | } | 457 | } |
460 | if (!IS_MFCV6(dev) && (fmt->fourcc == V4L2_PIX_FMT_VP8)) { | 458 | |
461 | mfc_err("Not supported format.\n"); | ||
462 | return -EINVAL; | ||
463 | } | ||
464 | ctx->src_fmt = fmt; | ||
465 | ctx->codec_mode = fmt->codec_mode; | ||
466 | mfc_debug(2, "The codec number is: %d\n", ctx->codec_mode); | ||
467 | pix_mp->height = 0; | ||
468 | pix_mp->width = 0; | ||
469 | if (pix_mp->plane_fmt[0].sizeimage) | ||
470 | ctx->dec_src_buf_size = pix_mp->plane_fmt[0].sizeimage; | ||
471 | else | ||
472 | pix_mp->plane_fmt[0].sizeimage = ctx->dec_src_buf_size = | ||
473 | DEF_CPB_SIZE; | ||
474 | pix_mp->plane_fmt[0].bytesperline = 0; | ||
475 | ctx->state = MFCINST_INIT; | ||
476 | out: | 459 | out: |
477 | mfc_debug_leave(); | 460 | mfc_debug_leave(); |
478 | return ret; | 461 | return ret; |
diff --git a/drivers/media/platform/s5p-mfc/s5p_mfc_enc.c b/drivers/media/platform/s5p-mfc/s5p_mfc_enc.c index 2549967b2f85..59e56f4c8ce3 100644 --- a/drivers/media/platform/s5p-mfc/s5p_mfc_enc.c +++ b/drivers/media/platform/s5p-mfc/s5p_mfc_enc.c | |||
@@ -906,6 +906,7 @@ static int vidioc_g_fmt(struct file *file, void *priv, struct v4l2_format *f) | |||
906 | 906 | ||
907 | static int vidioc_try_fmt(struct file *file, void *priv, struct v4l2_format *f) | 907 | static int vidioc_try_fmt(struct file *file, void *priv, struct v4l2_format *f) |
908 | { | 908 | { |
909 | struct s5p_mfc_dev *dev = video_drvdata(file); | ||
909 | struct s5p_mfc_fmt *fmt; | 910 | struct s5p_mfc_fmt *fmt; |
910 | struct v4l2_pix_format_mplane *pix_fmt_mp = &f->fmt.pix_mp; | 911 | struct v4l2_pix_format_mplane *pix_fmt_mp = &f->fmt.pix_mp; |
911 | 912 | ||
@@ -930,6 +931,18 @@ static int vidioc_try_fmt(struct file *file, void *priv, struct v4l2_format *f) | |||
930 | return -EINVAL; | 931 | return -EINVAL; |
931 | } | 932 | } |
932 | 933 | ||
934 | if (!IS_MFCV6(dev)) { | ||
935 | if (fmt->fourcc == V4L2_PIX_FMT_NV12MT_16X16) { | ||
936 | mfc_err("Not supported format.\n"); | ||
937 | return -EINVAL; | ||
938 | } | ||
939 | } else if (IS_MFCV6(dev)) { | ||
940 | if (fmt->fourcc == V4L2_PIX_FMT_NV12MT) { | ||
941 | mfc_err("Not supported format.\n"); | ||
942 | return -EINVAL; | ||
943 | } | ||
944 | } | ||
945 | |||
933 | if (fmt->num_planes != pix_fmt_mp->num_planes) { | 946 | if (fmt->num_planes != pix_fmt_mp->num_planes) { |
934 | mfc_err("failed to try output format\n"); | 947 | mfc_err("failed to try output format\n"); |
935 | return -EINVAL; | 948 | return -EINVAL; |
@@ -947,7 +960,6 @@ static int vidioc_s_fmt(struct file *file, void *priv, struct v4l2_format *f) | |||
947 | { | 960 | { |
948 | struct s5p_mfc_dev *dev = video_drvdata(file); | 961 | struct s5p_mfc_dev *dev = video_drvdata(file); |
949 | struct s5p_mfc_ctx *ctx = fh_to_ctx(priv); | 962 | struct s5p_mfc_ctx *ctx = fh_to_ctx(priv); |
950 | struct s5p_mfc_fmt *fmt; | ||
951 | struct v4l2_pix_format_mplane *pix_fmt_mp = &f->fmt.pix_mp; | 963 | struct v4l2_pix_format_mplane *pix_fmt_mp = &f->fmt.pix_mp; |
952 | int ret = 0; | 964 | int ret = 0; |
953 | 965 | ||
@@ -960,13 +972,9 @@ static int vidioc_s_fmt(struct file *file, void *priv, struct v4l2_format *f) | |||
960 | goto out; | 972 | goto out; |
961 | } | 973 | } |
962 | if (f->type == V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE) { | 974 | if (f->type == V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE) { |
963 | fmt = find_format(f, MFC_FMT_ENC); | 975 | /* dst_fmt is validated by call to vidioc_try_fmt */ |
964 | if (!fmt) { | 976 | ctx->dst_fmt = find_format(f, MFC_FMT_ENC); |
965 | mfc_err("failed to set capture format\n"); | ||
966 | return -EINVAL; | ||
967 | } | ||
968 | ctx->state = MFCINST_INIT; | 977 | ctx->state = MFCINST_INIT; |
969 | ctx->dst_fmt = fmt; | ||
970 | ctx->codec_mode = ctx->dst_fmt->codec_mode; | 978 | ctx->codec_mode = ctx->dst_fmt->codec_mode; |
971 | ctx->enc_dst_buf_size = pix_fmt_mp->plane_fmt[0].sizeimage; | 979 | ctx->enc_dst_buf_size = pix_fmt_mp->plane_fmt[0].sizeimage; |
972 | pix_fmt_mp->plane_fmt[0].bytesperline = 0; | 980 | pix_fmt_mp->plane_fmt[0].bytesperline = 0; |
@@ -987,28 +995,8 @@ static int vidioc_s_fmt(struct file *file, void *priv, struct v4l2_format *f) | |||
987 | } | 995 | } |
988 | mfc_debug(2, "Got instance number: %d\n", ctx->inst_no); | 996 | mfc_debug(2, "Got instance number: %d\n", ctx->inst_no); |
989 | } else if (f->type == V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE) { | 997 | } else if (f->type == V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE) { |
990 | fmt = find_format(f, MFC_FMT_RAW); | 998 | /* src_fmt is validated by call to vidioc_try_fmt */ |
991 | if (!fmt) { | 999 | ctx->src_fmt = find_format(f, MFC_FMT_RAW); |
992 | mfc_err("failed to set output format\n"); | ||
993 | return -EINVAL; | ||
994 | } | ||
995 | |||
996 | if (!IS_MFCV6(dev) && | ||
997 | (fmt->fourcc == V4L2_PIX_FMT_NV12MT_16X16)) { | ||
998 | mfc_err("Not supported format.\n"); | ||
999 | return -EINVAL; | ||
1000 | } else if (IS_MFCV6(dev) && | ||
1001 | (fmt->fourcc == V4L2_PIX_FMT_NV12MT)) { | ||
1002 | mfc_err("Not supported format.\n"); | ||
1003 | return -EINVAL; | ||
1004 | } | ||
1005 | |||
1006 | if (fmt->num_planes != pix_fmt_mp->num_planes) { | ||
1007 | mfc_err("failed to set output format\n"); | ||
1008 | ret = -EINVAL; | ||
1009 | goto out; | ||
1010 | } | ||
1011 | ctx->src_fmt = fmt; | ||
1012 | ctx->img_width = pix_fmt_mp->width; | 1000 | ctx->img_width = pix_fmt_mp->width; |
1013 | ctx->img_height = pix_fmt_mp->height; | 1001 | ctx->img_height = pix_fmt_mp->height; |
1014 | mfc_debug(2, "codec number: %d\n", ctx->src_fmt->codec_mode); | 1002 | mfc_debug(2, "codec number: %d\n", ctx->src_fmt->codec_mode); |
diff --git a/drivers/media/usb/em28xx/em28xx-i2c.c b/drivers/media/usb/em28xx/em28xx-i2c.c index 4851cc2e4a4d..c4ff9739a7ae 100644 --- a/drivers/media/usb/em28xx/em28xx-i2c.c +++ b/drivers/media/usb/em28xx/em28xx-i2c.c | |||
@@ -726,7 +726,7 @@ static int em28xx_i2c_eeprom(struct em28xx *dev, unsigned bus, | |||
726 | 726 | ||
727 | *eedata = data; | 727 | *eedata = data; |
728 | *eedata_len = len; | 728 | *eedata_len = len; |
729 | dev_config = (void *)eedata; | 729 | dev_config = (void *)*eedata; |
730 | 730 | ||
731 | switch (le16_to_cpu(dev_config->chip_conf) >> 4 & 0x3) { | 731 | switch (le16_to_cpu(dev_config->chip_conf) >> 4 & 0x3) { |
732 | case 0: | 732 | case 0: |
diff --git a/drivers/media/usb/hdpvr/hdpvr-core.c b/drivers/media/usb/hdpvr/hdpvr-core.c index cb694055ba7d..6e5070774dc2 100644 --- a/drivers/media/usb/hdpvr/hdpvr-core.c +++ b/drivers/media/usb/hdpvr/hdpvr-core.c | |||
@@ -303,6 +303,11 @@ static int hdpvr_probe(struct usb_interface *interface, | |||
303 | 303 | ||
304 | dev->workqueue = 0; | 304 | dev->workqueue = 0; |
305 | 305 | ||
306 | /* init video transfer queues first of all */ | ||
307 | /* to prevent oops in hdpvr_delete() on error paths */ | ||
308 | INIT_LIST_HEAD(&dev->free_buff_list); | ||
309 | INIT_LIST_HEAD(&dev->rec_buff_list); | ||
310 | |||
306 | /* register v4l2_device early so it can be used for printks */ | 311 | /* register v4l2_device early so it can be used for printks */ |
307 | if (v4l2_device_register(&interface->dev, &dev->v4l2_dev)) { | 312 | if (v4l2_device_register(&interface->dev, &dev->v4l2_dev)) { |
308 | dev_err(&interface->dev, "v4l2_device_register failed\n"); | 313 | dev_err(&interface->dev, "v4l2_device_register failed\n"); |
@@ -325,10 +330,6 @@ static int hdpvr_probe(struct usb_interface *interface, | |||
325 | if (!dev->workqueue) | 330 | if (!dev->workqueue) |
326 | goto error; | 331 | goto error; |
327 | 332 | ||
328 | /* init video transfer queues */ | ||
329 | INIT_LIST_HEAD(&dev->free_buff_list); | ||
330 | INIT_LIST_HEAD(&dev->rec_buff_list); | ||
331 | |||
332 | dev->options = hdpvr_default_options; | 333 | dev->options = hdpvr_default_options; |
333 | 334 | ||
334 | if (default_video_input < HDPVR_VIDEO_INPUTS) | 335 | if (default_video_input < HDPVR_VIDEO_INPUTS) |
@@ -405,7 +406,7 @@ static int hdpvr_probe(struct usb_interface *interface, | |||
405 | video_nr[atomic_inc_return(&dev_nr)]); | 406 | video_nr[atomic_inc_return(&dev_nr)]); |
406 | if (retval < 0) { | 407 | if (retval < 0) { |
407 | v4l2_err(&dev->v4l2_dev, "registering videodev failed\n"); | 408 | v4l2_err(&dev->v4l2_dev, "registering videodev failed\n"); |
408 | goto error; | 409 | goto reg_fail; |
409 | } | 410 | } |
410 | 411 | ||
411 | /* let the user know what node this device is now attached to */ | 412 | /* let the user know what node this device is now attached to */ |
diff --git a/drivers/media/usb/usbtv/Kconfig b/drivers/media/usb/usbtv/Kconfig index 8864436464bf..7c5b86006ee6 100644 --- a/drivers/media/usb/usbtv/Kconfig +++ b/drivers/media/usb/usbtv/Kconfig | |||
@@ -1,6 +1,6 @@ | |||
1 | config VIDEO_USBTV | 1 | config VIDEO_USBTV |
2 | tristate "USBTV007 video capture support" | 2 | tristate "USBTV007 video capture support" |
3 | depends on VIDEO_DEV | 3 | depends on VIDEO_V4L2 |
4 | select VIDEOBUF2_VMALLOC | 4 | select VIDEOBUF2_VMALLOC |
5 | 5 | ||
6 | ---help--- | 6 | ---help--- |
diff --git a/drivers/media/usb/usbtv/usbtv.c b/drivers/media/usb/usbtv/usbtv.c index bf43f874685e..91650173941a 100644 --- a/drivers/media/usb/usbtv/usbtv.c +++ b/drivers/media/usb/usbtv/usbtv.c | |||
@@ -57,7 +57,7 @@ | |||
57 | #define USBTV_CHUNK_SIZE 256 | 57 | #define USBTV_CHUNK_SIZE 256 |
58 | #define USBTV_CHUNK 240 | 58 | #define USBTV_CHUNK 240 |
59 | #define USBTV_CHUNKS (USBTV_WIDTH * USBTV_HEIGHT \ | 59 | #define USBTV_CHUNKS (USBTV_WIDTH * USBTV_HEIGHT \ |
60 | / 2 / USBTV_CHUNK) | 60 | / 4 / USBTV_CHUNK) |
61 | 61 | ||
62 | /* Chunk header. */ | 62 | /* Chunk header. */ |
63 | #define USBTV_MAGIC_OK(chunk) ((be32_to_cpu(chunk[0]) & 0xff000000) \ | 63 | #define USBTV_MAGIC_OK(chunk) ((be32_to_cpu(chunk[0]) & 0xff000000) \ |
@@ -89,6 +89,7 @@ struct usbtv { | |||
89 | /* Number of currently processed frame, useful find | 89 | /* Number of currently processed frame, useful find |
90 | * out when a new one begins. */ | 90 | * out when a new one begins. */ |
91 | u32 frame_id; | 91 | u32 frame_id; |
92 | int chunks_done; | ||
92 | 93 | ||
93 | int iso_size; | 94 | int iso_size; |
94 | unsigned int sequence; | 95 | unsigned int sequence; |
@@ -202,6 +203,26 @@ static int usbtv_setup_capture(struct usbtv *usbtv) | |||
202 | return 0; | 203 | return 0; |
203 | } | 204 | } |
204 | 205 | ||
206 | /* Copy data from chunk into a frame buffer, deinterlacing the data | ||
207 | * into every second line. Unfortunately, they don't align nicely into | ||
208 | * 720 pixel lines, as the chunk is 240 words long, which is 480 pixels. | ||
209 | * Therefore, we break down the chunk into two halves before copyting, | ||
210 | * so that we can interleave a line if needed. */ | ||
211 | static void usbtv_chunk_to_vbuf(u32 *frame, u32 *src, int chunk_no, int odd) | ||
212 | { | ||
213 | int half; | ||
214 | |||
215 | for (half = 0; half < 2; half++) { | ||
216 | int part_no = chunk_no * 2 + half; | ||
217 | int line = part_no / 3; | ||
218 | int part_index = (line * 2 + !odd) * 3 + (part_no % 3); | ||
219 | |||
220 | u32 *dst = &frame[part_index * USBTV_CHUNK/2]; | ||
221 | memcpy(dst, src, USBTV_CHUNK/2 * sizeof(*src)); | ||
222 | src += USBTV_CHUNK/2; | ||
223 | } | ||
224 | } | ||
225 | |||
205 | /* Called for each 256-byte image chunk. | 226 | /* Called for each 256-byte image chunk. |
206 | * First word identifies the chunk, followed by 240 words of image | 227 | * First word identifies the chunk, followed by 240 words of image |
207 | * data and padding. */ | 228 | * data and padding. */ |
@@ -218,17 +239,17 @@ static void usbtv_image_chunk(struct usbtv *usbtv, u32 *chunk) | |||
218 | frame_id = USBTV_FRAME_ID(chunk); | 239 | frame_id = USBTV_FRAME_ID(chunk); |
219 | odd = USBTV_ODD(chunk); | 240 | odd = USBTV_ODD(chunk); |
220 | chunk_no = USBTV_CHUNK_NO(chunk); | 241 | chunk_no = USBTV_CHUNK_NO(chunk); |
221 | |||
222 | /* Deinterlace. TODO: Use interlaced frame format. */ | ||
223 | chunk_no = (chunk_no - chunk_no % 3) * 2 + chunk_no % 3; | ||
224 | chunk_no += !odd * 3; | ||
225 | |||
226 | if (chunk_no >= USBTV_CHUNKS) | 242 | if (chunk_no >= USBTV_CHUNKS) |
227 | return; | 243 | return; |
228 | 244 | ||
229 | /* Beginning of a frame. */ | 245 | /* Beginning of a frame. */ |
230 | if (chunk_no == 0) | 246 | if (chunk_no == 0) { |
231 | usbtv->frame_id = frame_id; | 247 | usbtv->frame_id = frame_id; |
248 | usbtv->chunks_done = 0; | ||
249 | } | ||
250 | |||
251 | if (usbtv->frame_id != frame_id) | ||
252 | return; | ||
232 | 253 | ||
233 | spin_lock_irqsave(&usbtv->buflock, flags); | 254 | spin_lock_irqsave(&usbtv->buflock, flags); |
234 | if (list_empty(&usbtv->bufs)) { | 255 | if (list_empty(&usbtv->bufs)) { |
@@ -241,19 +262,23 @@ static void usbtv_image_chunk(struct usbtv *usbtv, u32 *chunk) | |||
241 | buf = list_first_entry(&usbtv->bufs, struct usbtv_buf, list); | 262 | buf = list_first_entry(&usbtv->bufs, struct usbtv_buf, list); |
242 | frame = vb2_plane_vaddr(&buf->vb, 0); | 263 | frame = vb2_plane_vaddr(&buf->vb, 0); |
243 | 264 | ||
244 | /* Copy the chunk. */ | 265 | /* Copy the chunk data. */ |
245 | memcpy(&frame[chunk_no * USBTV_CHUNK], &chunk[1], | 266 | usbtv_chunk_to_vbuf(frame, &chunk[1], chunk_no, odd); |
246 | USBTV_CHUNK * sizeof(chunk[1])); | 267 | usbtv->chunks_done++; |
247 | 268 | ||
248 | /* Last chunk in a frame, signalling an end */ | 269 | /* Last chunk in a frame, signalling an end */ |
249 | if (usbtv->frame_id && chunk_no == USBTV_CHUNKS-1) { | 270 | if (odd && chunk_no == USBTV_CHUNKS-1) { |
250 | int size = vb2_plane_size(&buf->vb, 0); | 271 | int size = vb2_plane_size(&buf->vb, 0); |
272 | enum vb2_buffer_state state = usbtv->chunks_done == | ||
273 | USBTV_CHUNKS ? | ||
274 | VB2_BUF_STATE_DONE : | ||
275 | VB2_BUF_STATE_ERROR; | ||
251 | 276 | ||
252 | buf->vb.v4l2_buf.field = V4L2_FIELD_INTERLACED; | 277 | buf->vb.v4l2_buf.field = V4L2_FIELD_INTERLACED; |
253 | buf->vb.v4l2_buf.sequence = usbtv->sequence++; | 278 | buf->vb.v4l2_buf.sequence = usbtv->sequence++; |
254 | v4l2_get_timestamp(&buf->vb.v4l2_buf.timestamp); | 279 | v4l2_get_timestamp(&buf->vb.v4l2_buf.timestamp); |
255 | vb2_set_plane_payload(&buf->vb, 0, size); | 280 | vb2_set_plane_payload(&buf->vb, 0, size); |
256 | vb2_buffer_done(&buf->vb, VB2_BUF_STATE_DONE); | 281 | vb2_buffer_done(&buf->vb, state); |
257 | list_del(&buf->list); | 282 | list_del(&buf->list); |
258 | } | 283 | } |
259 | 284 | ||
@@ -518,7 +543,7 @@ static int usbtv_queue_setup(struct vb2_queue *vq, | |||
518 | if (*nbuffers < 2) | 543 | if (*nbuffers < 2) |
519 | *nbuffers = 2; | 544 | *nbuffers = 2; |
520 | *nplanes = 1; | 545 | *nplanes = 1; |
521 | sizes[0] = USBTV_CHUNK * USBTV_CHUNKS * sizeof(u32); | 546 | sizes[0] = USBTV_WIDTH * USBTV_HEIGHT / 2 * sizeof(u32); |
522 | 547 | ||
523 | return 0; | 548 | return 0; |
524 | } | 549 | } |
diff --git a/drivers/net/can/usb/peak_usb/pcan_usb.c b/drivers/net/can/usb/peak_usb/pcan_usb.c index 25723d8ee201..925ab8ec9329 100644 --- a/drivers/net/can/usb/peak_usb/pcan_usb.c +++ b/drivers/net/can/usb/peak_usb/pcan_usb.c | |||
@@ -649,7 +649,7 @@ static int pcan_usb_decode_data(struct pcan_usb_msg_context *mc, u8 status_len) | |||
649 | if ((mc->ptr + rec_len) > mc->end) | 649 | if ((mc->ptr + rec_len) > mc->end) |
650 | goto decode_failed; | 650 | goto decode_failed; |
651 | 651 | ||
652 | memcpy(cf->data, mc->ptr, rec_len); | 652 | memcpy(cf->data, mc->ptr, cf->can_dlc); |
653 | mc->ptr += rec_len; | 653 | mc->ptr += rec_len; |
654 | } | 654 | } |
655 | 655 | ||
diff --git a/drivers/net/ethernet/arc/emac_main.c b/drivers/net/ethernet/arc/emac_main.c index f1b121ee5525..55d79cb53a79 100644 --- a/drivers/net/ethernet/arc/emac_main.c +++ b/drivers/net/ethernet/arc/emac_main.c | |||
@@ -199,7 +199,7 @@ static int arc_emac_rx(struct net_device *ndev, int budget) | |||
199 | struct arc_emac_priv *priv = netdev_priv(ndev); | 199 | struct arc_emac_priv *priv = netdev_priv(ndev); |
200 | unsigned int work_done; | 200 | unsigned int work_done; |
201 | 201 | ||
202 | for (work_done = 0; work_done <= budget; work_done++) { | 202 | for (work_done = 0; work_done < budget; work_done++) { |
203 | unsigned int *last_rx_bd = &priv->last_rx_bd; | 203 | unsigned int *last_rx_bd = &priv->last_rx_bd; |
204 | struct net_device_stats *stats = &priv->stats; | 204 | struct net_device_stats *stats = &priv->stats; |
205 | struct buffer_state *rx_buff = &priv->rx_buff[*last_rx_bd]; | 205 | struct buffer_state *rx_buff = &priv->rx_buff[*last_rx_bd]; |
diff --git a/drivers/net/ethernet/broadcom/bnx2x/bnx2x.h b/drivers/net/ethernet/broadcom/bnx2x/bnx2x.h index 7ecb44ad24fb..126dec4342e6 100644 --- a/drivers/net/ethernet/broadcom/bnx2x/bnx2x.h +++ b/drivers/net/ethernet/broadcom/bnx2x/bnx2x.h | |||
@@ -1502,6 +1502,7 @@ struct bnx2x { | |||
1502 | #define BC_SUPPORTS_DCBX_MSG_NON_PMF (1 << 21) | 1502 | #define BC_SUPPORTS_DCBX_MSG_NON_PMF (1 << 21) |
1503 | #define IS_VF_FLAG (1 << 22) | 1503 | #define IS_VF_FLAG (1 << 22) |
1504 | #define INTERRUPTS_ENABLED_FLAG (1 << 23) | 1504 | #define INTERRUPTS_ENABLED_FLAG (1 << 23) |
1505 | #define BC_SUPPORTS_RMMOD_CMD (1 << 24) | ||
1505 | 1506 | ||
1506 | #define BP_NOMCP(bp) ((bp)->flags & NO_MCP_FLAG) | 1507 | #define BP_NOMCP(bp) ((bp)->flags & NO_MCP_FLAG) |
1507 | 1508 | ||
@@ -1830,6 +1831,8 @@ struct bnx2x { | |||
1830 | 1831 | ||
1831 | int fp_array_size; | 1832 | int fp_array_size; |
1832 | u32 dump_preset_idx; | 1833 | u32 dump_preset_idx; |
1834 | bool stats_started; | ||
1835 | struct semaphore stats_sema; | ||
1833 | }; | 1836 | }; |
1834 | 1837 | ||
1835 | /* Tx queues may be less or equal to Rx queues */ | 1838 | /* Tx queues may be less or equal to Rx queues */ |
@@ -2451,4 +2454,6 @@ enum bnx2x_pci_bus_speed { | |||
2451 | BNX2X_PCI_LINK_SPEED_5000 = 5000, | 2454 | BNX2X_PCI_LINK_SPEED_5000 = 5000, |
2452 | BNX2X_PCI_LINK_SPEED_8000 = 8000 | 2455 | BNX2X_PCI_LINK_SPEED_8000 = 8000 |
2453 | }; | 2456 | }; |
2457 | |||
2458 | void bnx2x_set_local_cmng(struct bnx2x *bp); | ||
2454 | #endif /* bnx2x.h */ | 2459 | #endif /* bnx2x.h */ |
diff --git a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_dcb.c b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_dcb.c index 0c94df47e0e8..f9122f2d6b65 100644 --- a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_dcb.c +++ b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_dcb.c | |||
@@ -753,6 +753,10 @@ void bnx2x_dcbx_set_params(struct bnx2x *bp, u32 state) | |||
753 | bnx2x_pfc_set_pfc(bp); | 753 | bnx2x_pfc_set_pfc(bp); |
754 | 754 | ||
755 | bnx2x_dcbx_update_ets_params(bp); | 755 | bnx2x_dcbx_update_ets_params(bp); |
756 | |||
757 | /* ets may affect cmng configuration: reinit it in hw */ | ||
758 | bnx2x_set_local_cmng(bp); | ||
759 | |||
756 | bnx2x_dcbx_resume_hw_tx(bp); | 760 | bnx2x_dcbx_resume_hw_tx(bp); |
757 | 761 | ||
758 | return; | 762 | return; |
diff --git a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_hsi.h b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_hsi.h index 5018e52ae2ad..32767f6aa33f 100644 --- a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_hsi.h +++ b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_hsi.h | |||
@@ -1300,6 +1300,9 @@ struct drv_func_mb { | |||
1300 | 1300 | ||
1301 | #define DRV_MSG_CODE_EEE_RESULTS_ACK 0xda000000 | 1301 | #define DRV_MSG_CODE_EEE_RESULTS_ACK 0xda000000 |
1302 | 1302 | ||
1303 | #define DRV_MSG_CODE_RMMOD 0xdb000000 | ||
1304 | #define REQ_BC_VER_4_RMMOD_CMD 0x0007080f | ||
1305 | |||
1303 | #define DRV_MSG_CODE_SET_MF_BW 0xe0000000 | 1306 | #define DRV_MSG_CODE_SET_MF_BW 0xe0000000 |
1304 | #define REQ_BC_VER_4_SET_MF_BW 0x00060202 | 1307 | #define REQ_BC_VER_4_SET_MF_BW 0x00060202 |
1305 | #define DRV_MSG_CODE_SET_MF_BW_ACK 0xe1000000 | 1308 | #define DRV_MSG_CODE_SET_MF_BW_ACK 0xe1000000 |
@@ -1372,6 +1375,8 @@ struct drv_func_mb { | |||
1372 | 1375 | ||
1373 | #define FW_MSG_CODE_EEE_RESULS_ACK 0xda100000 | 1376 | #define FW_MSG_CODE_EEE_RESULS_ACK 0xda100000 |
1374 | 1377 | ||
1378 | #define FW_MSG_CODE_RMMOD_ACK 0xdb100000 | ||
1379 | |||
1375 | #define FW_MSG_CODE_SET_MF_BW_SENT 0xe0000000 | 1380 | #define FW_MSG_CODE_SET_MF_BW_SENT 0xe0000000 |
1376 | #define FW_MSG_CODE_SET_MF_BW_DONE 0xe1000000 | 1381 | #define FW_MSG_CODE_SET_MF_BW_DONE 0xe1000000 |
1377 | 1382 | ||
diff --git a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c index 39d7db58bf86..7f4ec80f0cb3 100644 --- a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c +++ b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c | |||
@@ -2476,7 +2476,7 @@ static void bnx2x_cmng_fns_init(struct bnx2x *bp, u8 read_cfg, u8 cmng_type) | |||
2476 | 2476 | ||
2477 | input.port_rate = bp->link_vars.line_speed; | 2477 | input.port_rate = bp->link_vars.line_speed; |
2478 | 2478 | ||
2479 | if (cmng_type == CMNG_FNS_MINMAX) { | 2479 | if (cmng_type == CMNG_FNS_MINMAX && input.port_rate) { |
2480 | int vn; | 2480 | int vn; |
2481 | 2481 | ||
2482 | /* read mf conf from shmem */ | 2482 | /* read mf conf from shmem */ |
@@ -2533,6 +2533,21 @@ static void storm_memset_cmng(struct bnx2x *bp, | |||
2533 | } | 2533 | } |
2534 | } | 2534 | } |
2535 | 2535 | ||
2536 | /* init cmng mode in HW according to local configuration */ | ||
2537 | void bnx2x_set_local_cmng(struct bnx2x *bp) | ||
2538 | { | ||
2539 | int cmng_fns = bnx2x_get_cmng_fns_mode(bp); | ||
2540 | |||
2541 | if (cmng_fns != CMNG_FNS_NONE) { | ||
2542 | bnx2x_cmng_fns_init(bp, false, cmng_fns); | ||
2543 | storm_memset_cmng(bp, &bp->cmng, BP_PORT(bp)); | ||
2544 | } else { | ||
2545 | /* rate shaping and fairness are disabled */ | ||
2546 | DP(NETIF_MSG_IFUP, | ||
2547 | "single function mode without fairness\n"); | ||
2548 | } | ||
2549 | } | ||
2550 | |||
2536 | /* This function is called upon link interrupt */ | 2551 | /* This function is called upon link interrupt */ |
2537 | static void bnx2x_link_attn(struct bnx2x *bp) | 2552 | static void bnx2x_link_attn(struct bnx2x *bp) |
2538 | { | 2553 | { |
@@ -2568,17 +2583,8 @@ static void bnx2x_link_attn(struct bnx2x *bp) | |||
2568 | bnx2x_stats_handle(bp, STATS_EVENT_LINK_UP); | 2583 | bnx2x_stats_handle(bp, STATS_EVENT_LINK_UP); |
2569 | } | 2584 | } |
2570 | 2585 | ||
2571 | if (bp->link_vars.link_up && bp->link_vars.line_speed) { | 2586 | if (bp->link_vars.link_up && bp->link_vars.line_speed) |
2572 | int cmng_fns = bnx2x_get_cmng_fns_mode(bp); | 2587 | bnx2x_set_local_cmng(bp); |
2573 | |||
2574 | if (cmng_fns != CMNG_FNS_NONE) { | ||
2575 | bnx2x_cmng_fns_init(bp, false, cmng_fns); | ||
2576 | storm_memset_cmng(bp, &bp->cmng, BP_PORT(bp)); | ||
2577 | } else | ||
2578 | /* rate shaping and fairness are disabled */ | ||
2579 | DP(NETIF_MSG_IFUP, | ||
2580 | "single function mode without fairness\n"); | ||
2581 | } | ||
2582 | 2588 | ||
2583 | __bnx2x_link_report(bp); | 2589 | __bnx2x_link_report(bp); |
2584 | 2590 | ||
@@ -10360,6 +10366,10 @@ static void bnx2x_get_common_hwinfo(struct bnx2x *bp) | |||
10360 | 10366 | ||
10361 | bp->flags |= (val >= REQ_BC_VER_4_DCBX_ADMIN_MSG_NON_PMF) ? | 10367 | bp->flags |= (val >= REQ_BC_VER_4_DCBX_ADMIN_MSG_NON_PMF) ? |
10362 | BC_SUPPORTS_DCBX_MSG_NON_PMF : 0; | 10368 | BC_SUPPORTS_DCBX_MSG_NON_PMF : 0; |
10369 | |||
10370 | bp->flags |= (val >= REQ_BC_VER_4_RMMOD_CMD) ? | ||
10371 | BC_SUPPORTS_RMMOD_CMD : 0; | ||
10372 | |||
10363 | boot_mode = SHMEM_RD(bp, | 10373 | boot_mode = SHMEM_RD(bp, |
10364 | dev_info.port_feature_config[BP_PORT(bp)].mba_config) & | 10374 | dev_info.port_feature_config[BP_PORT(bp)].mba_config) & |
10365 | PORT_FEATURE_MBA_BOOT_AGENT_TYPE_MASK; | 10375 | PORT_FEATURE_MBA_BOOT_AGENT_TYPE_MASK; |
@@ -11522,6 +11532,7 @@ static int bnx2x_init_bp(struct bnx2x *bp) | |||
11522 | mutex_init(&bp->port.phy_mutex); | 11532 | mutex_init(&bp->port.phy_mutex); |
11523 | mutex_init(&bp->fw_mb_mutex); | 11533 | mutex_init(&bp->fw_mb_mutex); |
11524 | spin_lock_init(&bp->stats_lock); | 11534 | spin_lock_init(&bp->stats_lock); |
11535 | sema_init(&bp->stats_sema, 1); | ||
11525 | 11536 | ||
11526 | INIT_DELAYED_WORK(&bp->sp_task, bnx2x_sp_task); | 11537 | INIT_DELAYED_WORK(&bp->sp_task, bnx2x_sp_task); |
11527 | INIT_DELAYED_WORK(&bp->sp_rtnl_task, bnx2x_sp_rtnl_task); | 11538 | INIT_DELAYED_WORK(&bp->sp_rtnl_task, bnx2x_sp_rtnl_task); |
@@ -12825,13 +12836,17 @@ static void __bnx2x_remove(struct pci_dev *pdev, | |||
12825 | bnx2x_dcbnl_update_applist(bp, true); | 12836 | bnx2x_dcbnl_update_applist(bp, true); |
12826 | #endif | 12837 | #endif |
12827 | 12838 | ||
12839 | if (IS_PF(bp) && | ||
12840 | !BP_NOMCP(bp) && | ||
12841 | (bp->flags & BC_SUPPORTS_RMMOD_CMD)) | ||
12842 | bnx2x_fw_command(bp, DRV_MSG_CODE_RMMOD, 0); | ||
12843 | |||
12828 | /* Close the interface - either directly or implicitly */ | 12844 | /* Close the interface - either directly or implicitly */ |
12829 | if (remove_netdev) { | 12845 | if (remove_netdev) { |
12830 | unregister_netdev(dev); | 12846 | unregister_netdev(dev); |
12831 | } else { | 12847 | } else { |
12832 | rtnl_lock(); | 12848 | rtnl_lock(); |
12833 | if (netif_running(dev)) | 12849 | dev_close(dev); |
12834 | bnx2x_close(dev); | ||
12835 | rtnl_unlock(); | 12850 | rtnl_unlock(); |
12836 | } | 12851 | } |
12837 | 12852 | ||
diff --git a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_sriov.c b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_sriov.c index 6291324913e9..1d925fd9cdc6 100644 --- a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_sriov.c +++ b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_sriov.c | |||
@@ -3471,7 +3471,7 @@ int bnx2x_vf_pci_alloc(struct bnx2x *bp) | |||
3471 | alloc_mem_err: | 3471 | alloc_mem_err: |
3472 | BNX2X_PCI_FREE(bp->vf2pf_mbox, bp->vf2pf_mbox_mapping, | 3472 | BNX2X_PCI_FREE(bp->vf2pf_mbox, bp->vf2pf_mbox_mapping, |
3473 | sizeof(struct bnx2x_vf_mbx_msg)); | 3473 | sizeof(struct bnx2x_vf_mbx_msg)); |
3474 | BNX2X_PCI_FREE(bp->vf2pf_mbox, bp->vf2pf_mbox_mapping, | 3474 | BNX2X_PCI_FREE(bp->vf2pf_mbox, bp->pf2vf_bulletin_mapping, |
3475 | sizeof(union pf_vf_bulletin)); | 3475 | sizeof(union pf_vf_bulletin)); |
3476 | return -ENOMEM; | 3476 | return -ENOMEM; |
3477 | } | 3477 | } |
diff --git a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_stats.c b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_stats.c index 98366abd02bd..d63d1327b051 100644 --- a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_stats.c +++ b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_stats.c | |||
@@ -221,7 +221,8 @@ static int bnx2x_stats_comp(struct bnx2x *bp) | |||
221 | * Statistics service functions | 221 | * Statistics service functions |
222 | */ | 222 | */ |
223 | 223 | ||
224 | static void bnx2x_stats_pmf_update(struct bnx2x *bp) | 224 | /* should be called under stats_sema */ |
225 | static void __bnx2x_stats_pmf_update(struct bnx2x *bp) | ||
225 | { | 226 | { |
226 | struct dmae_command *dmae; | 227 | struct dmae_command *dmae; |
227 | u32 opcode; | 228 | u32 opcode; |
@@ -518,7 +519,8 @@ static void bnx2x_func_stats_init(struct bnx2x *bp) | |||
518 | *stats_comp = 0; | 519 | *stats_comp = 0; |
519 | } | 520 | } |
520 | 521 | ||
521 | static void bnx2x_stats_start(struct bnx2x *bp) | 522 | /* should be called under stats_sema */ |
523 | static void __bnx2x_stats_start(struct bnx2x *bp) | ||
522 | { | 524 | { |
523 | /* vfs travel through here as part of the statistics FSM, but no action | 525 | /* vfs travel through here as part of the statistics FSM, but no action |
524 | * is required | 526 | * is required |
@@ -534,13 +536,34 @@ static void bnx2x_stats_start(struct bnx2x *bp) | |||
534 | 536 | ||
535 | bnx2x_hw_stats_post(bp); | 537 | bnx2x_hw_stats_post(bp); |
536 | bnx2x_storm_stats_post(bp); | 538 | bnx2x_storm_stats_post(bp); |
539 | |||
540 | bp->stats_started = true; | ||
541 | } | ||
542 | |||
543 | static void bnx2x_stats_start(struct bnx2x *bp) | ||
544 | { | ||
545 | if (down_timeout(&bp->stats_sema, HZ/10)) | ||
546 | BNX2X_ERR("Unable to acquire stats lock\n"); | ||
547 | __bnx2x_stats_start(bp); | ||
548 | up(&bp->stats_sema); | ||
537 | } | 549 | } |
538 | 550 | ||
539 | static void bnx2x_stats_pmf_start(struct bnx2x *bp) | 551 | static void bnx2x_stats_pmf_start(struct bnx2x *bp) |
540 | { | 552 | { |
553 | if (down_timeout(&bp->stats_sema, HZ/10)) | ||
554 | BNX2X_ERR("Unable to acquire stats lock\n"); | ||
541 | bnx2x_stats_comp(bp); | 555 | bnx2x_stats_comp(bp); |
542 | bnx2x_stats_pmf_update(bp); | 556 | __bnx2x_stats_pmf_update(bp); |
543 | bnx2x_stats_start(bp); | 557 | __bnx2x_stats_start(bp); |
558 | up(&bp->stats_sema); | ||
559 | } | ||
560 | |||
561 | static void bnx2x_stats_pmf_update(struct bnx2x *bp) | ||
562 | { | ||
563 | if (down_timeout(&bp->stats_sema, HZ/10)) | ||
564 | BNX2X_ERR("Unable to acquire stats lock\n"); | ||
565 | __bnx2x_stats_pmf_update(bp); | ||
566 | up(&bp->stats_sema); | ||
544 | } | 567 | } |
545 | 568 | ||
546 | static void bnx2x_stats_restart(struct bnx2x *bp) | 569 | static void bnx2x_stats_restart(struct bnx2x *bp) |
@@ -550,8 +573,11 @@ static void bnx2x_stats_restart(struct bnx2x *bp) | |||
550 | */ | 573 | */ |
551 | if (IS_VF(bp)) | 574 | if (IS_VF(bp)) |
552 | return; | 575 | return; |
576 | if (down_timeout(&bp->stats_sema, HZ/10)) | ||
577 | BNX2X_ERR("Unable to acquire stats lock\n"); | ||
553 | bnx2x_stats_comp(bp); | 578 | bnx2x_stats_comp(bp); |
554 | bnx2x_stats_start(bp); | 579 | __bnx2x_stats_start(bp); |
580 | up(&bp->stats_sema); | ||
555 | } | 581 | } |
556 | 582 | ||
557 | static void bnx2x_bmac_stats_update(struct bnx2x *bp) | 583 | static void bnx2x_bmac_stats_update(struct bnx2x *bp) |
@@ -888,9 +914,7 @@ static int bnx2x_storm_stats_validate_counters(struct bnx2x *bp) | |||
888 | /* Make sure we use the value of the counter | 914 | /* Make sure we use the value of the counter |
889 | * used for sending the last stats ramrod. | 915 | * used for sending the last stats ramrod. |
890 | */ | 916 | */ |
891 | spin_lock_bh(&bp->stats_lock); | ||
892 | cur_stats_counter = bp->stats_counter - 1; | 917 | cur_stats_counter = bp->stats_counter - 1; |
893 | spin_unlock_bh(&bp->stats_lock); | ||
894 | 918 | ||
895 | /* are storm stats valid? */ | 919 | /* are storm stats valid? */ |
896 | if (le16_to_cpu(counters->xstats_counter) != cur_stats_counter) { | 920 | if (le16_to_cpu(counters->xstats_counter) != cur_stats_counter) { |
@@ -1227,12 +1251,18 @@ static void bnx2x_stats_update(struct bnx2x *bp) | |||
1227 | { | 1251 | { |
1228 | u32 *stats_comp = bnx2x_sp(bp, stats_comp); | 1252 | u32 *stats_comp = bnx2x_sp(bp, stats_comp); |
1229 | 1253 | ||
1230 | if (bnx2x_edebug_stats_stopped(bp)) | 1254 | /* we run update from timer context, so give up |
1255 | * if somebody is in the middle of transition | ||
1256 | */ | ||
1257 | if (down_trylock(&bp->stats_sema)) | ||
1231 | return; | 1258 | return; |
1232 | 1259 | ||
1260 | if (bnx2x_edebug_stats_stopped(bp) || !bp->stats_started) | ||
1261 | goto out; | ||
1262 | |||
1233 | if (IS_PF(bp)) { | 1263 | if (IS_PF(bp)) { |
1234 | if (*stats_comp != DMAE_COMP_VAL) | 1264 | if (*stats_comp != DMAE_COMP_VAL) |
1235 | return; | 1265 | goto out; |
1236 | 1266 | ||
1237 | if (bp->port.pmf) | 1267 | if (bp->port.pmf) |
1238 | bnx2x_hw_stats_update(bp); | 1268 | bnx2x_hw_stats_update(bp); |
@@ -1242,7 +1272,7 @@ static void bnx2x_stats_update(struct bnx2x *bp) | |||
1242 | BNX2X_ERR("storm stats were not updated for 3 times\n"); | 1272 | BNX2X_ERR("storm stats were not updated for 3 times\n"); |
1243 | bnx2x_panic(); | 1273 | bnx2x_panic(); |
1244 | } | 1274 | } |
1245 | return; | 1275 | goto out; |
1246 | } | 1276 | } |
1247 | } else { | 1277 | } else { |
1248 | /* vf doesn't collect HW statistics, and doesn't get completions | 1278 | /* vf doesn't collect HW statistics, and doesn't get completions |
@@ -1256,7 +1286,7 @@ static void bnx2x_stats_update(struct bnx2x *bp) | |||
1256 | 1286 | ||
1257 | /* vf is done */ | 1287 | /* vf is done */ |
1258 | if (IS_VF(bp)) | 1288 | if (IS_VF(bp)) |
1259 | return; | 1289 | goto out; |
1260 | 1290 | ||
1261 | if (netif_msg_timer(bp)) { | 1291 | if (netif_msg_timer(bp)) { |
1262 | struct bnx2x_eth_stats *estats = &bp->eth_stats; | 1292 | struct bnx2x_eth_stats *estats = &bp->eth_stats; |
@@ -1267,6 +1297,9 @@ static void bnx2x_stats_update(struct bnx2x *bp) | |||
1267 | 1297 | ||
1268 | bnx2x_hw_stats_post(bp); | 1298 | bnx2x_hw_stats_post(bp); |
1269 | bnx2x_storm_stats_post(bp); | 1299 | bnx2x_storm_stats_post(bp); |
1300 | |||
1301 | out: | ||
1302 | up(&bp->stats_sema); | ||
1270 | } | 1303 | } |
1271 | 1304 | ||
1272 | static void bnx2x_port_stats_stop(struct bnx2x *bp) | 1305 | static void bnx2x_port_stats_stop(struct bnx2x *bp) |
@@ -1332,6 +1365,11 @@ static void bnx2x_stats_stop(struct bnx2x *bp) | |||
1332 | { | 1365 | { |
1333 | int update = 0; | 1366 | int update = 0; |
1334 | 1367 | ||
1368 | if (down_timeout(&bp->stats_sema, HZ/10)) | ||
1369 | BNX2X_ERR("Unable to acquire stats lock\n"); | ||
1370 | |||
1371 | bp->stats_started = false; | ||
1372 | |||
1335 | bnx2x_stats_comp(bp); | 1373 | bnx2x_stats_comp(bp); |
1336 | 1374 | ||
1337 | if (bp->port.pmf) | 1375 | if (bp->port.pmf) |
@@ -1348,6 +1386,8 @@ static void bnx2x_stats_stop(struct bnx2x *bp) | |||
1348 | bnx2x_hw_stats_post(bp); | 1386 | bnx2x_hw_stats_post(bp); |
1349 | bnx2x_stats_comp(bp); | 1387 | bnx2x_stats_comp(bp); |
1350 | } | 1388 | } |
1389 | |||
1390 | up(&bp->stats_sema); | ||
1351 | } | 1391 | } |
1352 | 1392 | ||
1353 | static void bnx2x_stats_do_nothing(struct bnx2x *bp) | 1393 | static void bnx2x_stats_do_nothing(struct bnx2x *bp) |
@@ -1376,15 +1416,17 @@ static const struct { | |||
1376 | void bnx2x_stats_handle(struct bnx2x *bp, enum bnx2x_stats_event event) | 1416 | void bnx2x_stats_handle(struct bnx2x *bp, enum bnx2x_stats_event event) |
1377 | { | 1417 | { |
1378 | enum bnx2x_stats_state state; | 1418 | enum bnx2x_stats_state state; |
1419 | void (*action)(struct bnx2x *bp); | ||
1379 | if (unlikely(bp->panic)) | 1420 | if (unlikely(bp->panic)) |
1380 | return; | 1421 | return; |
1381 | 1422 | ||
1382 | spin_lock_bh(&bp->stats_lock); | 1423 | spin_lock_bh(&bp->stats_lock); |
1383 | state = bp->stats_state; | 1424 | state = bp->stats_state; |
1384 | bp->stats_state = bnx2x_stats_stm[state][event].next_state; | 1425 | bp->stats_state = bnx2x_stats_stm[state][event].next_state; |
1426 | action = bnx2x_stats_stm[state][event].action; | ||
1385 | spin_unlock_bh(&bp->stats_lock); | 1427 | spin_unlock_bh(&bp->stats_lock); |
1386 | 1428 | ||
1387 | bnx2x_stats_stm[state][event].action(bp); | 1429 | action(bp); |
1388 | 1430 | ||
1389 | if ((event != STATS_EVENT_UPDATE) || netif_msg_timer(bp)) | 1431 | if ((event != STATS_EVENT_UPDATE) || netif_msg_timer(bp)) |
1390 | DP(BNX2X_MSG_STATS, "state %d -> event %d -> state %d\n", | 1432 | DP(BNX2X_MSG_STATS, "state %d -> event %d -> state %d\n", |
diff --git a/drivers/net/ethernet/broadcom/tg3.c b/drivers/net/ethernet/broadcom/tg3.c index ff28081146f2..95b8995187d7 100644 --- a/drivers/net/ethernet/broadcom/tg3.c +++ b/drivers/net/ethernet/broadcom/tg3.c | |||
@@ -17858,8 +17858,10 @@ static pci_ers_result_t tg3_io_error_detected(struct pci_dev *pdev, | |||
17858 | 17858 | ||
17859 | done: | 17859 | done: |
17860 | if (state == pci_channel_io_perm_failure) { | 17860 | if (state == pci_channel_io_perm_failure) { |
17861 | tg3_napi_enable(tp); | 17861 | if (netdev) { |
17862 | dev_close(netdev); | 17862 | tg3_napi_enable(tp); |
17863 | dev_close(netdev); | ||
17864 | } | ||
17863 | err = PCI_ERS_RESULT_DISCONNECT; | 17865 | err = PCI_ERS_RESULT_DISCONNECT; |
17864 | } else { | 17866 | } else { |
17865 | pci_disable_device(pdev); | 17867 | pci_disable_device(pdev); |
@@ -17889,7 +17891,8 @@ static pci_ers_result_t tg3_io_slot_reset(struct pci_dev *pdev) | |||
17889 | rtnl_lock(); | 17891 | rtnl_lock(); |
17890 | 17892 | ||
17891 | if (pci_enable_device(pdev)) { | 17893 | if (pci_enable_device(pdev)) { |
17892 | netdev_err(netdev, "Cannot re-enable PCI device after reset.\n"); | 17894 | dev_err(&pdev->dev, |
17895 | "Cannot re-enable PCI device after reset.\n"); | ||
17893 | goto done; | 17896 | goto done; |
17894 | } | 17897 | } |
17895 | 17898 | ||
@@ -17897,7 +17900,7 @@ static pci_ers_result_t tg3_io_slot_reset(struct pci_dev *pdev) | |||
17897 | pci_restore_state(pdev); | 17900 | pci_restore_state(pdev); |
17898 | pci_save_state(pdev); | 17901 | pci_save_state(pdev); |
17899 | 17902 | ||
17900 | if (!netif_running(netdev)) { | 17903 | if (!netdev || !netif_running(netdev)) { |
17901 | rc = PCI_ERS_RESULT_RECOVERED; | 17904 | rc = PCI_ERS_RESULT_RECOVERED; |
17902 | goto done; | 17905 | goto done; |
17903 | } | 17906 | } |
@@ -17909,7 +17912,7 @@ static pci_ers_result_t tg3_io_slot_reset(struct pci_dev *pdev) | |||
17909 | rc = PCI_ERS_RESULT_RECOVERED; | 17912 | rc = PCI_ERS_RESULT_RECOVERED; |
17910 | 17913 | ||
17911 | done: | 17914 | done: |
17912 | if (rc != PCI_ERS_RESULT_RECOVERED && netif_running(netdev)) { | 17915 | if (rc != PCI_ERS_RESULT_RECOVERED && netdev && netif_running(netdev)) { |
17913 | tg3_napi_enable(tp); | 17916 | tg3_napi_enable(tp); |
17914 | dev_close(netdev); | 17917 | dev_close(netdev); |
17915 | } | 17918 | } |
diff --git a/drivers/net/ethernet/chelsio/cxgb3/sge.c b/drivers/net/ethernet/chelsio/cxgb3/sge.c index 687ec4a8bb48..9c89dc8fe105 100644 --- a/drivers/net/ethernet/chelsio/cxgb3/sge.c +++ b/drivers/net/ethernet/chelsio/cxgb3/sge.c | |||
@@ -455,11 +455,6 @@ static int alloc_pg_chunk(struct adapter *adapter, struct sge_fl *q, | |||
455 | q->pg_chunk.offset = 0; | 455 | q->pg_chunk.offset = 0; |
456 | mapping = pci_map_page(adapter->pdev, q->pg_chunk.page, | 456 | mapping = pci_map_page(adapter->pdev, q->pg_chunk.page, |
457 | 0, q->alloc_size, PCI_DMA_FROMDEVICE); | 457 | 0, q->alloc_size, PCI_DMA_FROMDEVICE); |
458 | if (unlikely(pci_dma_mapping_error(adapter->pdev, mapping))) { | ||
459 | __free_pages(q->pg_chunk.page, order); | ||
460 | q->pg_chunk.page = NULL; | ||
461 | return -EIO; | ||
462 | } | ||
463 | q->pg_chunk.mapping = mapping; | 458 | q->pg_chunk.mapping = mapping; |
464 | } | 459 | } |
465 | sd->pg_chunk = q->pg_chunk; | 460 | sd->pg_chunk = q->pg_chunk; |
@@ -954,75 +949,40 @@ static inline unsigned int calc_tx_descs(const struct sk_buff *skb) | |||
954 | return flits_to_desc(flits); | 949 | return flits_to_desc(flits); |
955 | } | 950 | } |
956 | 951 | ||
957 | |||
958 | /* map_skb - map a packet main body and its page fragments | ||
959 | * @pdev: the PCI device | ||
960 | * @skb: the packet | ||
961 | * @addr: placeholder to save the mapped addresses | ||
962 | * | ||
963 | * map the main body of an sk_buff and its page fragments, if any. | ||
964 | */ | ||
965 | static int map_skb(struct pci_dev *pdev, const struct sk_buff *skb, | ||
966 | dma_addr_t *addr) | ||
967 | { | ||
968 | const skb_frag_t *fp, *end; | ||
969 | const struct skb_shared_info *si; | ||
970 | |||
971 | *addr = pci_map_single(pdev, skb->data, skb_headlen(skb), | ||
972 | PCI_DMA_TODEVICE); | ||
973 | if (pci_dma_mapping_error(pdev, *addr)) | ||
974 | goto out_err; | ||
975 | |||
976 | si = skb_shinfo(skb); | ||
977 | end = &si->frags[si->nr_frags]; | ||
978 | |||
979 | for (fp = si->frags; fp < end; fp++) { | ||
980 | *++addr = skb_frag_dma_map(&pdev->dev, fp, 0, skb_frag_size(fp), | ||
981 | DMA_TO_DEVICE); | ||
982 | if (pci_dma_mapping_error(pdev, *addr)) | ||
983 | goto unwind; | ||
984 | } | ||
985 | return 0; | ||
986 | |||
987 | unwind: | ||
988 | while (fp-- > si->frags) | ||
989 | dma_unmap_page(&pdev->dev, *--addr, skb_frag_size(fp), | ||
990 | DMA_TO_DEVICE); | ||
991 | |||
992 | pci_unmap_single(pdev, addr[-1], skb_headlen(skb), PCI_DMA_TODEVICE); | ||
993 | out_err: | ||
994 | return -ENOMEM; | ||
995 | } | ||
996 | |||
997 | /** | 952 | /** |
998 | * write_sgl - populate a scatter/gather list for a packet | 953 | * make_sgl - populate a scatter/gather list for a packet |
999 | * @skb: the packet | 954 | * @skb: the packet |
1000 | * @sgp: the SGL to populate | 955 | * @sgp: the SGL to populate |
1001 | * @start: start address of skb main body data to include in the SGL | 956 | * @start: start address of skb main body data to include in the SGL |
1002 | * @len: length of skb main body data to include in the SGL | 957 | * @len: length of skb main body data to include in the SGL |
1003 | * @addr: the list of the mapped addresses | 958 | * @pdev: the PCI device |
1004 | * | 959 | * |
1005 | * Copies the scatter/gather list for the buffers that make up a packet | 960 | * Generates a scatter/gather list for the buffers that make up a packet |
1006 | * and returns the SGL size in 8-byte words. The caller must size the SGL | 961 | * and returns the SGL size in 8-byte words. The caller must size the SGL |
1007 | * appropriately. | 962 | * appropriately. |
1008 | */ | 963 | */ |
1009 | static inline unsigned int write_sgl(const struct sk_buff *skb, | 964 | static inline unsigned int make_sgl(const struct sk_buff *skb, |
1010 | struct sg_ent *sgp, unsigned char *start, | 965 | struct sg_ent *sgp, unsigned char *start, |
1011 | unsigned int len, const dma_addr_t *addr) | 966 | unsigned int len, struct pci_dev *pdev) |
1012 | { | 967 | { |
1013 | unsigned int i, j = 0, k = 0, nfrags; | 968 | dma_addr_t mapping; |
969 | unsigned int i, j = 0, nfrags; | ||
1014 | 970 | ||
1015 | if (len) { | 971 | if (len) { |
972 | mapping = pci_map_single(pdev, start, len, PCI_DMA_TODEVICE); | ||
1016 | sgp->len[0] = cpu_to_be32(len); | 973 | sgp->len[0] = cpu_to_be32(len); |
1017 | sgp->addr[j++] = cpu_to_be64(addr[k++]); | 974 | sgp->addr[0] = cpu_to_be64(mapping); |
975 | j = 1; | ||
1018 | } | 976 | } |
1019 | 977 | ||
1020 | nfrags = skb_shinfo(skb)->nr_frags; | 978 | nfrags = skb_shinfo(skb)->nr_frags; |
1021 | for (i = 0; i < nfrags; i++) { | 979 | for (i = 0; i < nfrags; i++) { |
1022 | const skb_frag_t *frag = &skb_shinfo(skb)->frags[i]; | 980 | const skb_frag_t *frag = &skb_shinfo(skb)->frags[i]; |
1023 | 981 | ||
982 | mapping = skb_frag_dma_map(&pdev->dev, frag, 0, skb_frag_size(frag), | ||
983 | DMA_TO_DEVICE); | ||
1024 | sgp->len[j] = cpu_to_be32(skb_frag_size(frag)); | 984 | sgp->len[j] = cpu_to_be32(skb_frag_size(frag)); |
1025 | sgp->addr[j] = cpu_to_be64(addr[k++]); | 985 | sgp->addr[j] = cpu_to_be64(mapping); |
1026 | j ^= 1; | 986 | j ^= 1; |
1027 | if (j == 0) | 987 | if (j == 0) |
1028 | ++sgp; | 988 | ++sgp; |
@@ -1178,7 +1138,7 @@ static void write_tx_pkt_wr(struct adapter *adap, struct sk_buff *skb, | |||
1178 | const struct port_info *pi, | 1138 | const struct port_info *pi, |
1179 | unsigned int pidx, unsigned int gen, | 1139 | unsigned int pidx, unsigned int gen, |
1180 | struct sge_txq *q, unsigned int ndesc, | 1140 | struct sge_txq *q, unsigned int ndesc, |
1181 | unsigned int compl, const dma_addr_t *addr) | 1141 | unsigned int compl) |
1182 | { | 1142 | { |
1183 | unsigned int flits, sgl_flits, cntrl, tso_info; | 1143 | unsigned int flits, sgl_flits, cntrl, tso_info; |
1184 | struct sg_ent *sgp, sgl[MAX_SKB_FRAGS / 2 + 1]; | 1144 | struct sg_ent *sgp, sgl[MAX_SKB_FRAGS / 2 + 1]; |
@@ -1236,7 +1196,7 @@ static void write_tx_pkt_wr(struct adapter *adap, struct sk_buff *skb, | |||
1236 | } | 1196 | } |
1237 | 1197 | ||
1238 | sgp = ndesc == 1 ? (struct sg_ent *)&d->flit[flits] : sgl; | 1198 | sgp = ndesc == 1 ? (struct sg_ent *)&d->flit[flits] : sgl; |
1239 | sgl_flits = write_sgl(skb, sgp, skb->data, skb_headlen(skb), addr); | 1199 | sgl_flits = make_sgl(skb, sgp, skb->data, skb_headlen(skb), adap->pdev); |
1240 | 1200 | ||
1241 | write_wr_hdr_sgl(ndesc, skb, d, pidx, q, sgl, flits, sgl_flits, gen, | 1201 | write_wr_hdr_sgl(ndesc, skb, d, pidx, q, sgl, flits, sgl_flits, gen, |
1242 | htonl(V_WR_OP(FW_WROPCODE_TUNNEL_TX_PKT) | compl), | 1202 | htonl(V_WR_OP(FW_WROPCODE_TUNNEL_TX_PKT) | compl), |
@@ -1267,7 +1227,6 @@ netdev_tx_t t3_eth_xmit(struct sk_buff *skb, struct net_device *dev) | |||
1267 | struct netdev_queue *txq; | 1227 | struct netdev_queue *txq; |
1268 | struct sge_qset *qs; | 1228 | struct sge_qset *qs; |
1269 | struct sge_txq *q; | 1229 | struct sge_txq *q; |
1270 | dma_addr_t addr[MAX_SKB_FRAGS + 1]; | ||
1271 | 1230 | ||
1272 | /* | 1231 | /* |
1273 | * The chip min packet length is 9 octets but play safe and reject | 1232 | * The chip min packet length is 9 octets but play safe and reject |
@@ -1296,11 +1255,6 @@ netdev_tx_t t3_eth_xmit(struct sk_buff *skb, struct net_device *dev) | |||
1296 | return NETDEV_TX_BUSY; | 1255 | return NETDEV_TX_BUSY; |
1297 | } | 1256 | } |
1298 | 1257 | ||
1299 | if (unlikely(map_skb(adap->pdev, skb, addr) < 0)) { | ||
1300 | dev_kfree_skb(skb); | ||
1301 | return NETDEV_TX_OK; | ||
1302 | } | ||
1303 | |||
1304 | q->in_use += ndesc; | 1258 | q->in_use += ndesc; |
1305 | if (unlikely(credits - ndesc < q->stop_thres)) { | 1259 | if (unlikely(credits - ndesc < q->stop_thres)) { |
1306 | t3_stop_tx_queue(txq, qs, q); | 1260 | t3_stop_tx_queue(txq, qs, q); |
@@ -1358,7 +1312,7 @@ netdev_tx_t t3_eth_xmit(struct sk_buff *skb, struct net_device *dev) | |||
1358 | if (likely(!skb_shared(skb))) | 1312 | if (likely(!skb_shared(skb))) |
1359 | skb_orphan(skb); | 1313 | skb_orphan(skb); |
1360 | 1314 | ||
1361 | write_tx_pkt_wr(adap, skb, pi, pidx, gen, q, ndesc, compl, addr); | 1315 | write_tx_pkt_wr(adap, skb, pi, pidx, gen, q, ndesc, compl); |
1362 | check_ring_tx_db(adap, q); | 1316 | check_ring_tx_db(adap, q); |
1363 | return NETDEV_TX_OK; | 1317 | return NETDEV_TX_OK; |
1364 | } | 1318 | } |
@@ -1623,8 +1577,7 @@ static void setup_deferred_unmapping(struct sk_buff *skb, struct pci_dev *pdev, | |||
1623 | */ | 1577 | */ |
1624 | static void write_ofld_wr(struct adapter *adap, struct sk_buff *skb, | 1578 | static void write_ofld_wr(struct adapter *adap, struct sk_buff *skb, |
1625 | struct sge_txq *q, unsigned int pidx, | 1579 | struct sge_txq *q, unsigned int pidx, |
1626 | unsigned int gen, unsigned int ndesc, | 1580 | unsigned int gen, unsigned int ndesc) |
1627 | const dma_addr_t *addr) | ||
1628 | { | 1581 | { |
1629 | unsigned int sgl_flits, flits; | 1582 | unsigned int sgl_flits, flits; |
1630 | struct work_request_hdr *from; | 1583 | struct work_request_hdr *from; |
@@ -1645,9 +1598,9 @@ static void write_ofld_wr(struct adapter *adap, struct sk_buff *skb, | |||
1645 | 1598 | ||
1646 | flits = skb_transport_offset(skb) / 8; | 1599 | flits = skb_transport_offset(skb) / 8; |
1647 | sgp = ndesc == 1 ? (struct sg_ent *)&d->flit[flits] : sgl; | 1600 | sgp = ndesc == 1 ? (struct sg_ent *)&d->flit[flits] : sgl; |
1648 | sgl_flits = write_sgl(skb, sgp, skb_transport_header(skb), | 1601 | sgl_flits = make_sgl(skb, sgp, skb_transport_header(skb), |
1649 | skb_tail_pointer(skb) - | 1602 | skb->tail - skb->transport_header, |
1650 | skb_transport_header(skb), addr); | 1603 | adap->pdev); |
1651 | if (need_skb_unmap()) { | 1604 | if (need_skb_unmap()) { |
1652 | setup_deferred_unmapping(skb, adap->pdev, sgp, sgl_flits); | 1605 | setup_deferred_unmapping(skb, adap->pdev, sgp, sgl_flits); |
1653 | skb->destructor = deferred_unmap_destructor; | 1606 | skb->destructor = deferred_unmap_destructor; |
@@ -1705,11 +1658,6 @@ again: reclaim_completed_tx(adap, q, TX_RECLAIM_CHUNK); | |||
1705 | goto again; | 1658 | goto again; |
1706 | } | 1659 | } |
1707 | 1660 | ||
1708 | if (map_skb(adap->pdev, skb, (dma_addr_t *)skb->head)) { | ||
1709 | spin_unlock(&q->lock); | ||
1710 | return NET_XMIT_SUCCESS; | ||
1711 | } | ||
1712 | |||
1713 | gen = q->gen; | 1661 | gen = q->gen; |
1714 | q->in_use += ndesc; | 1662 | q->in_use += ndesc; |
1715 | pidx = q->pidx; | 1663 | pidx = q->pidx; |
@@ -1720,7 +1668,7 @@ again: reclaim_completed_tx(adap, q, TX_RECLAIM_CHUNK); | |||
1720 | } | 1668 | } |
1721 | spin_unlock(&q->lock); | 1669 | spin_unlock(&q->lock); |
1722 | 1670 | ||
1723 | write_ofld_wr(adap, skb, q, pidx, gen, ndesc, (dma_addr_t *)skb->head); | 1671 | write_ofld_wr(adap, skb, q, pidx, gen, ndesc); |
1724 | check_ring_tx_db(adap, q); | 1672 | check_ring_tx_db(adap, q); |
1725 | return NET_XMIT_SUCCESS; | 1673 | return NET_XMIT_SUCCESS; |
1726 | } | 1674 | } |
@@ -1738,7 +1686,6 @@ static void restart_offloadq(unsigned long data) | |||
1738 | struct sge_txq *q = &qs->txq[TXQ_OFLD]; | 1686 | struct sge_txq *q = &qs->txq[TXQ_OFLD]; |
1739 | const struct port_info *pi = netdev_priv(qs->netdev); | 1687 | const struct port_info *pi = netdev_priv(qs->netdev); |
1740 | struct adapter *adap = pi->adapter; | 1688 | struct adapter *adap = pi->adapter; |
1741 | unsigned int written = 0; | ||
1742 | 1689 | ||
1743 | spin_lock(&q->lock); | 1690 | spin_lock(&q->lock); |
1744 | again: reclaim_completed_tx(adap, q, TX_RECLAIM_CHUNK); | 1691 | again: reclaim_completed_tx(adap, q, TX_RECLAIM_CHUNK); |
@@ -1758,14 +1705,10 @@ again: reclaim_completed_tx(adap, q, TX_RECLAIM_CHUNK); | |||
1758 | break; | 1705 | break; |
1759 | } | 1706 | } |
1760 | 1707 | ||
1761 | if (map_skb(adap->pdev, skb, (dma_addr_t *)skb->head)) | ||
1762 | break; | ||
1763 | |||
1764 | gen = q->gen; | 1708 | gen = q->gen; |
1765 | q->in_use += ndesc; | 1709 | q->in_use += ndesc; |
1766 | pidx = q->pidx; | 1710 | pidx = q->pidx; |
1767 | q->pidx += ndesc; | 1711 | q->pidx += ndesc; |
1768 | written += ndesc; | ||
1769 | if (q->pidx >= q->size) { | 1712 | if (q->pidx >= q->size) { |
1770 | q->pidx -= q->size; | 1713 | q->pidx -= q->size; |
1771 | q->gen ^= 1; | 1714 | q->gen ^= 1; |
@@ -1773,8 +1716,7 @@ again: reclaim_completed_tx(adap, q, TX_RECLAIM_CHUNK); | |||
1773 | __skb_unlink(skb, &q->sendq); | 1716 | __skb_unlink(skb, &q->sendq); |
1774 | spin_unlock(&q->lock); | 1717 | spin_unlock(&q->lock); |
1775 | 1718 | ||
1776 | write_ofld_wr(adap, skb, q, pidx, gen, ndesc, | 1719 | write_ofld_wr(adap, skb, q, pidx, gen, ndesc); |
1777 | (dma_addr_t *)skb->head); | ||
1778 | spin_lock(&q->lock); | 1720 | spin_lock(&q->lock); |
1779 | } | 1721 | } |
1780 | spin_unlock(&q->lock); | 1722 | spin_unlock(&q->lock); |
@@ -1784,9 +1726,8 @@ again: reclaim_completed_tx(adap, q, TX_RECLAIM_CHUNK); | |||
1784 | set_bit(TXQ_LAST_PKT_DB, &q->flags); | 1726 | set_bit(TXQ_LAST_PKT_DB, &q->flags); |
1785 | #endif | 1727 | #endif |
1786 | wmb(); | 1728 | wmb(); |
1787 | if (likely(written)) | 1729 | t3_write_reg(adap, A_SG_KDOORBELL, |
1788 | t3_write_reg(adap, A_SG_KDOORBELL, | 1730 | F_SELEGRCNTX | V_EGRCNTX(q->cntxt_id)); |
1789 | F_SELEGRCNTX | V_EGRCNTX(q->cntxt_id)); | ||
1790 | } | 1731 | } |
1791 | 1732 | ||
1792 | /** | 1733 | /** |
diff --git a/drivers/net/ethernet/emulex/benet/be_cmds.c b/drivers/net/ethernet/emulex/benet/be_cmds.c index 5175f9729970..85923e2d63b9 100644 --- a/drivers/net/ethernet/emulex/benet/be_cmds.c +++ b/drivers/net/ethernet/emulex/benet/be_cmds.c | |||
@@ -3168,6 +3168,9 @@ int be_cmd_get_func_config(struct be_adapter *adapter) | |||
3168 | 3168 | ||
3169 | adapter->max_event_queues = le16_to_cpu(desc->eq_count); | 3169 | adapter->max_event_queues = le16_to_cpu(desc->eq_count); |
3170 | adapter->if_cap_flags = le32_to_cpu(desc->cap_flags); | 3170 | adapter->if_cap_flags = le32_to_cpu(desc->cap_flags); |
3171 | |||
3172 | /* Clear flags that driver is not interested in */ | ||
3173 | adapter->if_cap_flags &= BE_IF_CAP_FLAGS_WANT; | ||
3171 | } | 3174 | } |
3172 | err: | 3175 | err: |
3173 | mutex_unlock(&adapter->mbox_lock); | 3176 | mutex_unlock(&adapter->mbox_lock); |
diff --git a/drivers/net/ethernet/emulex/benet/be_cmds.h b/drivers/net/ethernet/emulex/benet/be_cmds.h index 9b916086c335..6237192a55d1 100644 --- a/drivers/net/ethernet/emulex/benet/be_cmds.h +++ b/drivers/net/ethernet/emulex/benet/be_cmds.h | |||
@@ -564,6 +564,12 @@ enum be_if_flags { | |||
564 | BE_IF_FLAGS_MULTICAST = 0x1000 | 564 | BE_IF_FLAGS_MULTICAST = 0x1000 |
565 | }; | 565 | }; |
566 | 566 | ||
567 | #define BE_IF_CAP_FLAGS_WANT (BE_IF_FLAGS_RSS | BE_IF_FLAGS_PROMISCUOUS |\ | ||
568 | BE_IF_FLAGS_BROADCAST | BE_IF_FLAGS_VLAN_PROMISCUOUS |\ | ||
569 | BE_IF_FLAGS_VLAN | BE_IF_FLAGS_MCAST_PROMISCUOUS |\ | ||
570 | BE_IF_FLAGS_PASS_L3L4_ERRORS | BE_IF_FLAGS_MULTICAST |\ | ||
571 | BE_IF_FLAGS_UNTAGGED) | ||
572 | |||
567 | /* An RX interface is an object with one or more MAC addresses and | 573 | /* An RX interface is an object with one or more MAC addresses and |
568 | * filtering capabilities. */ | 574 | * filtering capabilities. */ |
569 | struct be_cmd_req_if_create { | 575 | struct be_cmd_req_if_create { |
diff --git a/drivers/net/ethernet/marvell/skge.c b/drivers/net/ethernet/marvell/skge.c index c896079728e1..ef94a591f9e5 100644 --- a/drivers/net/ethernet/marvell/skge.c +++ b/drivers/net/ethernet/marvell/skge.c | |||
@@ -931,17 +931,20 @@ static int skge_ring_alloc(struct skge_ring *ring, void *vaddr, u32 base) | |||
931 | } | 931 | } |
932 | 932 | ||
933 | /* Allocate and setup a new buffer for receiving */ | 933 | /* Allocate and setup a new buffer for receiving */ |
934 | static void skge_rx_setup(struct skge_port *skge, struct skge_element *e, | 934 | static int skge_rx_setup(struct skge_port *skge, struct skge_element *e, |
935 | struct sk_buff *skb, unsigned int bufsize) | 935 | struct sk_buff *skb, unsigned int bufsize) |
936 | { | 936 | { |
937 | struct skge_rx_desc *rd = e->desc; | 937 | struct skge_rx_desc *rd = e->desc; |
938 | u64 map; | 938 | dma_addr_t map; |
939 | 939 | ||
940 | map = pci_map_single(skge->hw->pdev, skb->data, bufsize, | 940 | map = pci_map_single(skge->hw->pdev, skb->data, bufsize, |
941 | PCI_DMA_FROMDEVICE); | 941 | PCI_DMA_FROMDEVICE); |
942 | 942 | ||
943 | rd->dma_lo = map; | 943 | if (pci_dma_mapping_error(skge->hw->pdev, map)) |
944 | rd->dma_hi = map >> 32; | 944 | return -1; |
945 | |||
946 | rd->dma_lo = lower_32_bits(map); | ||
947 | rd->dma_hi = upper_32_bits(map); | ||
945 | e->skb = skb; | 948 | e->skb = skb; |
946 | rd->csum1_start = ETH_HLEN; | 949 | rd->csum1_start = ETH_HLEN; |
947 | rd->csum2_start = ETH_HLEN; | 950 | rd->csum2_start = ETH_HLEN; |
@@ -953,6 +956,7 @@ static void skge_rx_setup(struct skge_port *skge, struct skge_element *e, | |||
953 | rd->control = BMU_OWN | BMU_STF | BMU_IRQ_EOF | BMU_TCP_CHECK | bufsize; | 956 | rd->control = BMU_OWN | BMU_STF | BMU_IRQ_EOF | BMU_TCP_CHECK | bufsize; |
954 | dma_unmap_addr_set(e, mapaddr, map); | 957 | dma_unmap_addr_set(e, mapaddr, map); |
955 | dma_unmap_len_set(e, maplen, bufsize); | 958 | dma_unmap_len_set(e, maplen, bufsize); |
959 | return 0; | ||
956 | } | 960 | } |
957 | 961 | ||
958 | /* Resume receiving using existing skb, | 962 | /* Resume receiving using existing skb, |
@@ -1014,7 +1018,10 @@ static int skge_rx_fill(struct net_device *dev) | |||
1014 | return -ENOMEM; | 1018 | return -ENOMEM; |
1015 | 1019 | ||
1016 | skb_reserve(skb, NET_IP_ALIGN); | 1020 | skb_reserve(skb, NET_IP_ALIGN); |
1017 | skge_rx_setup(skge, e, skb, skge->rx_buf_size); | 1021 | if (skge_rx_setup(skge, e, skb, skge->rx_buf_size) < 0) { |
1022 | dev_kfree_skb(skb); | ||
1023 | return -EIO; | ||
1024 | } | ||
1018 | } while ((e = e->next) != ring->start); | 1025 | } while ((e = e->next) != ring->start); |
1019 | 1026 | ||
1020 | ring->to_clean = ring->start; | 1027 | ring->to_clean = ring->start; |
@@ -2544,7 +2551,7 @@ static int skge_up(struct net_device *dev) | |||
2544 | 2551 | ||
2545 | BUG_ON(skge->dma & 7); | 2552 | BUG_ON(skge->dma & 7); |
2546 | 2553 | ||
2547 | if ((u64)skge->dma >> 32 != ((u64) skge->dma + skge->mem_size) >> 32) { | 2554 | if (upper_32_bits(skge->dma) != upper_32_bits(skge->dma + skge->mem_size)) { |
2548 | dev_err(&hw->pdev->dev, "pci_alloc_consistent region crosses 4G boundary\n"); | 2555 | dev_err(&hw->pdev->dev, "pci_alloc_consistent region crosses 4G boundary\n"); |
2549 | err = -EINVAL; | 2556 | err = -EINVAL; |
2550 | goto free_pci_mem; | 2557 | goto free_pci_mem; |
@@ -2729,7 +2736,7 @@ static netdev_tx_t skge_xmit_frame(struct sk_buff *skb, | |||
2729 | struct skge_tx_desc *td; | 2736 | struct skge_tx_desc *td; |
2730 | int i; | 2737 | int i; |
2731 | u32 control, len; | 2738 | u32 control, len; |
2732 | u64 map; | 2739 | dma_addr_t map; |
2733 | 2740 | ||
2734 | if (skb_padto(skb, ETH_ZLEN)) | 2741 | if (skb_padto(skb, ETH_ZLEN)) |
2735 | return NETDEV_TX_OK; | 2742 | return NETDEV_TX_OK; |
@@ -2743,11 +2750,14 @@ static netdev_tx_t skge_xmit_frame(struct sk_buff *skb, | |||
2743 | e->skb = skb; | 2750 | e->skb = skb; |
2744 | len = skb_headlen(skb); | 2751 | len = skb_headlen(skb); |
2745 | map = pci_map_single(hw->pdev, skb->data, len, PCI_DMA_TODEVICE); | 2752 | map = pci_map_single(hw->pdev, skb->data, len, PCI_DMA_TODEVICE); |
2753 | if (pci_dma_mapping_error(hw->pdev, map)) | ||
2754 | goto mapping_error; | ||
2755 | |||
2746 | dma_unmap_addr_set(e, mapaddr, map); | 2756 | dma_unmap_addr_set(e, mapaddr, map); |
2747 | dma_unmap_len_set(e, maplen, len); | 2757 | dma_unmap_len_set(e, maplen, len); |
2748 | 2758 | ||
2749 | td->dma_lo = map; | 2759 | td->dma_lo = lower_32_bits(map); |
2750 | td->dma_hi = map >> 32; | 2760 | td->dma_hi = upper_32_bits(map); |
2751 | 2761 | ||
2752 | if (skb->ip_summed == CHECKSUM_PARTIAL) { | 2762 | if (skb->ip_summed == CHECKSUM_PARTIAL) { |
2753 | const int offset = skb_checksum_start_offset(skb); | 2763 | const int offset = skb_checksum_start_offset(skb); |
@@ -2778,14 +2788,16 @@ static netdev_tx_t skge_xmit_frame(struct sk_buff *skb, | |||
2778 | 2788 | ||
2779 | map = skb_frag_dma_map(&hw->pdev->dev, frag, 0, | 2789 | map = skb_frag_dma_map(&hw->pdev->dev, frag, 0, |
2780 | skb_frag_size(frag), DMA_TO_DEVICE); | 2790 | skb_frag_size(frag), DMA_TO_DEVICE); |
2791 | if (dma_mapping_error(&hw->pdev->dev, map)) | ||
2792 | goto mapping_unwind; | ||
2781 | 2793 | ||
2782 | e = e->next; | 2794 | e = e->next; |
2783 | e->skb = skb; | 2795 | e->skb = skb; |
2784 | tf = e->desc; | 2796 | tf = e->desc; |
2785 | BUG_ON(tf->control & BMU_OWN); | 2797 | BUG_ON(tf->control & BMU_OWN); |
2786 | 2798 | ||
2787 | tf->dma_lo = map; | 2799 | tf->dma_lo = lower_32_bits(map); |
2788 | tf->dma_hi = (u64) map >> 32; | 2800 | tf->dma_hi = upper_32_bits(map); |
2789 | dma_unmap_addr_set(e, mapaddr, map); | 2801 | dma_unmap_addr_set(e, mapaddr, map); |
2790 | dma_unmap_len_set(e, maplen, skb_frag_size(frag)); | 2802 | dma_unmap_len_set(e, maplen, skb_frag_size(frag)); |
2791 | 2803 | ||
@@ -2815,6 +2827,26 @@ static netdev_tx_t skge_xmit_frame(struct sk_buff *skb, | |||
2815 | } | 2827 | } |
2816 | 2828 | ||
2817 | return NETDEV_TX_OK; | 2829 | return NETDEV_TX_OK; |
2830 | |||
2831 | mapping_unwind: | ||
2832 | e = skge->tx_ring.to_use; | ||
2833 | pci_unmap_single(hw->pdev, | ||
2834 | dma_unmap_addr(e, mapaddr), | ||
2835 | dma_unmap_len(e, maplen), | ||
2836 | PCI_DMA_TODEVICE); | ||
2837 | while (i-- > 0) { | ||
2838 | e = e->next; | ||
2839 | pci_unmap_page(hw->pdev, | ||
2840 | dma_unmap_addr(e, mapaddr), | ||
2841 | dma_unmap_len(e, maplen), | ||
2842 | PCI_DMA_TODEVICE); | ||
2843 | } | ||
2844 | |||
2845 | mapping_error: | ||
2846 | if (net_ratelimit()) | ||
2847 | dev_warn(&hw->pdev->dev, "%s: tx mapping error\n", dev->name); | ||
2848 | dev_kfree_skb(skb); | ||
2849 | return NETDEV_TX_OK; | ||
2818 | } | 2850 | } |
2819 | 2851 | ||
2820 | 2852 | ||
@@ -3045,11 +3077,13 @@ static struct sk_buff *skge_rx_get(struct net_device *dev, | |||
3045 | 3077 | ||
3046 | pci_dma_sync_single_for_cpu(skge->hw->pdev, | 3078 | pci_dma_sync_single_for_cpu(skge->hw->pdev, |
3047 | dma_unmap_addr(e, mapaddr), | 3079 | dma_unmap_addr(e, mapaddr), |
3048 | len, PCI_DMA_FROMDEVICE); | 3080 | dma_unmap_len(e, maplen), |
3081 | PCI_DMA_FROMDEVICE); | ||
3049 | skb_copy_from_linear_data(e->skb, skb->data, len); | 3082 | skb_copy_from_linear_data(e->skb, skb->data, len); |
3050 | pci_dma_sync_single_for_device(skge->hw->pdev, | 3083 | pci_dma_sync_single_for_device(skge->hw->pdev, |
3051 | dma_unmap_addr(e, mapaddr), | 3084 | dma_unmap_addr(e, mapaddr), |
3052 | len, PCI_DMA_FROMDEVICE); | 3085 | dma_unmap_len(e, maplen), |
3086 | PCI_DMA_FROMDEVICE); | ||
3053 | skge_rx_reuse(e, skge->rx_buf_size); | 3087 | skge_rx_reuse(e, skge->rx_buf_size); |
3054 | } else { | 3088 | } else { |
3055 | struct sk_buff *nskb; | 3089 | struct sk_buff *nskb; |
@@ -3058,13 +3092,17 @@ static struct sk_buff *skge_rx_get(struct net_device *dev, | |||
3058 | if (!nskb) | 3092 | if (!nskb) |
3059 | goto resubmit; | 3093 | goto resubmit; |
3060 | 3094 | ||
3095 | if (skge_rx_setup(skge, e, nskb, skge->rx_buf_size) < 0) { | ||
3096 | dev_kfree_skb(nskb); | ||
3097 | goto resubmit; | ||
3098 | } | ||
3099 | |||
3061 | pci_unmap_single(skge->hw->pdev, | 3100 | pci_unmap_single(skge->hw->pdev, |
3062 | dma_unmap_addr(e, mapaddr), | 3101 | dma_unmap_addr(e, mapaddr), |
3063 | dma_unmap_len(e, maplen), | 3102 | dma_unmap_len(e, maplen), |
3064 | PCI_DMA_FROMDEVICE); | 3103 | PCI_DMA_FROMDEVICE); |
3065 | skb = e->skb; | 3104 | skb = e->skb; |
3066 | prefetch(skb->data); | 3105 | prefetch(skb->data); |
3067 | skge_rx_setup(skge, e, nskb, skge->rx_buf_size); | ||
3068 | } | 3106 | } |
3069 | 3107 | ||
3070 | skb_put(skb, len); | 3108 | skb_put(skb, len); |
diff --git a/drivers/net/ethernet/mellanox/mlx5/core/cmd.c b/drivers/net/ethernet/mellanox/mlx5/core/cmd.c index c571de85d0f9..5472cbd34028 100644 --- a/drivers/net/ethernet/mellanox/mlx5/core/cmd.c +++ b/drivers/net/ethernet/mellanox/mlx5/core/cmd.c | |||
@@ -46,7 +46,7 @@ | |||
46 | #include "mlx5_core.h" | 46 | #include "mlx5_core.h" |
47 | 47 | ||
48 | enum { | 48 | enum { |
49 | CMD_IF_REV = 4, | 49 | CMD_IF_REV = 5, |
50 | }; | 50 | }; |
51 | 51 | ||
52 | enum { | 52 | enum { |
diff --git a/drivers/net/ethernet/mellanox/mlx5/core/eq.c b/drivers/net/ethernet/mellanox/mlx5/core/eq.c index c02cbcfd0fb8..443cc4d7b024 100644 --- a/drivers/net/ethernet/mellanox/mlx5/core/eq.c +++ b/drivers/net/ethernet/mellanox/mlx5/core/eq.c | |||
@@ -268,7 +268,7 @@ static int mlx5_eq_int(struct mlx5_core_dev *dev, struct mlx5_eq *eq) | |||
268 | case MLX5_EVENT_TYPE_PAGE_REQUEST: | 268 | case MLX5_EVENT_TYPE_PAGE_REQUEST: |
269 | { | 269 | { |
270 | u16 func_id = be16_to_cpu(eqe->data.req_pages.func_id); | 270 | u16 func_id = be16_to_cpu(eqe->data.req_pages.func_id); |
271 | s16 npages = be16_to_cpu(eqe->data.req_pages.num_pages); | 271 | s32 npages = be32_to_cpu(eqe->data.req_pages.num_pages); |
272 | 272 | ||
273 | mlx5_core_dbg(dev, "page request for func 0x%x, napges %d\n", func_id, npages); | 273 | mlx5_core_dbg(dev, "page request for func 0x%x, napges %d\n", func_id, npages); |
274 | mlx5_core_req_pages_handler(dev, func_id, npages); | 274 | mlx5_core_req_pages_handler(dev, func_id, npages); |
diff --git a/drivers/net/ethernet/mellanox/mlx5/core/fw.c b/drivers/net/ethernet/mellanox/mlx5/core/fw.c index 72a5222447f5..f012658b6a92 100644 --- a/drivers/net/ethernet/mellanox/mlx5/core/fw.c +++ b/drivers/net/ethernet/mellanox/mlx5/core/fw.c | |||
@@ -113,7 +113,7 @@ int mlx5_cmd_query_hca_cap(struct mlx5_core_dev *dev, | |||
113 | caps->log_max_srq = out->hca_cap.log_max_srqs & 0x1f; | 113 | caps->log_max_srq = out->hca_cap.log_max_srqs & 0x1f; |
114 | caps->local_ca_ack_delay = out->hca_cap.local_ca_ack_delay & 0x1f; | 114 | caps->local_ca_ack_delay = out->hca_cap.local_ca_ack_delay & 0x1f; |
115 | caps->log_max_mcg = out->hca_cap.log_max_mcg; | 115 | caps->log_max_mcg = out->hca_cap.log_max_mcg; |
116 | caps->max_qp_mcg = be16_to_cpu(out->hca_cap.max_qp_mcg); | 116 | caps->max_qp_mcg = be32_to_cpu(out->hca_cap.max_qp_mcg) & 0xffffff; |
117 | caps->max_ra_res_qp = 1 << (out->hca_cap.log_max_ra_res_qp & 0x3f); | 117 | caps->max_ra_res_qp = 1 << (out->hca_cap.log_max_ra_res_qp & 0x3f); |
118 | caps->max_ra_req_qp = 1 << (out->hca_cap.log_max_ra_req_qp & 0x3f); | 118 | caps->max_ra_req_qp = 1 << (out->hca_cap.log_max_ra_req_qp & 0x3f); |
119 | caps->max_srq_wqes = 1 << out->hca_cap.log_max_srq_sz; | 119 | caps->max_srq_wqes = 1 << out->hca_cap.log_max_srq_sz; |
diff --git a/drivers/net/ethernet/mellanox/mlx5/core/health.c b/drivers/net/ethernet/mellanox/mlx5/core/health.c index 748f10a155c4..3e6670c4a7cd 100644 --- a/drivers/net/ethernet/mellanox/mlx5/core/health.c +++ b/drivers/net/ethernet/mellanox/mlx5/core/health.c | |||
@@ -55,33 +55,9 @@ enum { | |||
55 | }; | 55 | }; |
56 | 56 | ||
57 | static DEFINE_SPINLOCK(health_lock); | 57 | static DEFINE_SPINLOCK(health_lock); |
58 | |||
59 | static LIST_HEAD(health_list); | 58 | static LIST_HEAD(health_list); |
60 | static struct work_struct health_work; | 59 | static struct work_struct health_work; |
61 | 60 | ||
62 | static health_handler_t reg_handler; | ||
63 | int mlx5_register_health_report_handler(health_handler_t handler) | ||
64 | { | ||
65 | spin_lock_irq(&health_lock); | ||
66 | if (reg_handler) { | ||
67 | spin_unlock_irq(&health_lock); | ||
68 | return -EEXIST; | ||
69 | } | ||
70 | reg_handler = handler; | ||
71 | spin_unlock_irq(&health_lock); | ||
72 | |||
73 | return 0; | ||
74 | } | ||
75 | EXPORT_SYMBOL(mlx5_register_health_report_handler); | ||
76 | |||
77 | void mlx5_unregister_health_report_handler(void) | ||
78 | { | ||
79 | spin_lock_irq(&health_lock); | ||
80 | reg_handler = NULL; | ||
81 | spin_unlock_irq(&health_lock); | ||
82 | } | ||
83 | EXPORT_SYMBOL(mlx5_unregister_health_report_handler); | ||
84 | |||
85 | static void health_care(struct work_struct *work) | 61 | static void health_care(struct work_struct *work) |
86 | { | 62 | { |
87 | struct mlx5_core_health *health, *n; | 63 | struct mlx5_core_health *health, *n; |
@@ -98,11 +74,8 @@ static void health_care(struct work_struct *work) | |||
98 | priv = container_of(health, struct mlx5_priv, health); | 74 | priv = container_of(health, struct mlx5_priv, health); |
99 | dev = container_of(priv, struct mlx5_core_dev, priv); | 75 | dev = container_of(priv, struct mlx5_core_dev, priv); |
100 | mlx5_core_warn(dev, "handling bad device here\n"); | 76 | mlx5_core_warn(dev, "handling bad device here\n"); |
77 | /* nothing yet */ | ||
101 | spin_lock_irq(&health_lock); | 78 | spin_lock_irq(&health_lock); |
102 | if (reg_handler) | ||
103 | reg_handler(dev->pdev, health->health, | ||
104 | sizeof(health->health)); | ||
105 | |||
106 | list_del_init(&health->list); | 79 | list_del_init(&health->list); |
107 | spin_unlock_irq(&health_lock); | 80 | spin_unlock_irq(&health_lock); |
108 | } | 81 | } |
diff --git a/drivers/net/ethernet/mellanox/mlx5/core/pagealloc.c b/drivers/net/ethernet/mellanox/mlx5/core/pagealloc.c index 4a3e137931a3..3a2408d44820 100644 --- a/drivers/net/ethernet/mellanox/mlx5/core/pagealloc.c +++ b/drivers/net/ethernet/mellanox/mlx5/core/pagealloc.c | |||
@@ -43,10 +43,16 @@ enum { | |||
43 | MLX5_PAGES_TAKE = 2 | 43 | MLX5_PAGES_TAKE = 2 |
44 | }; | 44 | }; |
45 | 45 | ||
46 | enum { | ||
47 | MLX5_BOOT_PAGES = 1, | ||
48 | MLX5_INIT_PAGES = 2, | ||
49 | MLX5_POST_INIT_PAGES = 3 | ||
50 | }; | ||
51 | |||
46 | struct mlx5_pages_req { | 52 | struct mlx5_pages_req { |
47 | struct mlx5_core_dev *dev; | 53 | struct mlx5_core_dev *dev; |
48 | u32 func_id; | 54 | u32 func_id; |
49 | s16 npages; | 55 | s32 npages; |
50 | struct work_struct work; | 56 | struct work_struct work; |
51 | }; | 57 | }; |
52 | 58 | ||
@@ -64,27 +70,23 @@ struct mlx5_query_pages_inbox { | |||
64 | 70 | ||
65 | struct mlx5_query_pages_outbox { | 71 | struct mlx5_query_pages_outbox { |
66 | struct mlx5_outbox_hdr hdr; | 72 | struct mlx5_outbox_hdr hdr; |
67 | __be16 num_boot_pages; | 73 | __be16 rsvd; |
68 | __be16 func_id; | 74 | __be16 func_id; |
69 | __be16 init_pages; | 75 | __be32 num_pages; |
70 | __be16 num_pages; | ||
71 | }; | 76 | }; |
72 | 77 | ||
73 | struct mlx5_manage_pages_inbox { | 78 | struct mlx5_manage_pages_inbox { |
74 | struct mlx5_inbox_hdr hdr; | 79 | struct mlx5_inbox_hdr hdr; |
75 | __be16 rsvd0; | 80 | __be16 rsvd; |
76 | __be16 func_id; | 81 | __be16 func_id; |
77 | __be16 rsvd1; | 82 | __be32 num_entries; |
78 | __be16 num_entries; | ||
79 | u8 rsvd2[16]; | ||
80 | __be64 pas[0]; | 83 | __be64 pas[0]; |
81 | }; | 84 | }; |
82 | 85 | ||
83 | struct mlx5_manage_pages_outbox { | 86 | struct mlx5_manage_pages_outbox { |
84 | struct mlx5_outbox_hdr hdr; | 87 | struct mlx5_outbox_hdr hdr; |
85 | u8 rsvd0[2]; | 88 | __be32 num_entries; |
86 | __be16 num_entries; | 89 | u8 rsvd[4]; |
87 | u8 rsvd1[20]; | ||
88 | __be64 pas[0]; | 90 | __be64 pas[0]; |
89 | }; | 91 | }; |
90 | 92 | ||
@@ -146,7 +148,7 @@ static struct page *remove_page(struct mlx5_core_dev *dev, u64 addr) | |||
146 | } | 148 | } |
147 | 149 | ||
148 | static int mlx5_cmd_query_pages(struct mlx5_core_dev *dev, u16 *func_id, | 150 | static int mlx5_cmd_query_pages(struct mlx5_core_dev *dev, u16 *func_id, |
149 | s16 *pages, s16 *init_pages, u16 *boot_pages) | 151 | s32 *npages, int boot) |
150 | { | 152 | { |
151 | struct mlx5_query_pages_inbox in; | 153 | struct mlx5_query_pages_inbox in; |
152 | struct mlx5_query_pages_outbox out; | 154 | struct mlx5_query_pages_outbox out; |
@@ -155,6 +157,8 @@ static int mlx5_cmd_query_pages(struct mlx5_core_dev *dev, u16 *func_id, | |||
155 | memset(&in, 0, sizeof(in)); | 157 | memset(&in, 0, sizeof(in)); |
156 | memset(&out, 0, sizeof(out)); | 158 | memset(&out, 0, sizeof(out)); |
157 | in.hdr.opcode = cpu_to_be16(MLX5_CMD_OP_QUERY_PAGES); | 159 | in.hdr.opcode = cpu_to_be16(MLX5_CMD_OP_QUERY_PAGES); |
160 | in.hdr.opmod = boot ? cpu_to_be16(MLX5_BOOT_PAGES) : cpu_to_be16(MLX5_INIT_PAGES); | ||
161 | |||
158 | err = mlx5_cmd_exec(dev, &in, sizeof(in), &out, sizeof(out)); | 162 | err = mlx5_cmd_exec(dev, &in, sizeof(in), &out, sizeof(out)); |
159 | if (err) | 163 | if (err) |
160 | return err; | 164 | return err; |
@@ -162,15 +166,7 @@ static int mlx5_cmd_query_pages(struct mlx5_core_dev *dev, u16 *func_id, | |||
162 | if (out.hdr.status) | 166 | if (out.hdr.status) |
163 | return mlx5_cmd_status_to_err(&out.hdr); | 167 | return mlx5_cmd_status_to_err(&out.hdr); |
164 | 168 | ||
165 | if (pages) | 169 | *npages = be32_to_cpu(out.num_pages); |
166 | *pages = be16_to_cpu(out.num_pages); | ||
167 | |||
168 | if (init_pages) | ||
169 | *init_pages = be16_to_cpu(out.init_pages); | ||
170 | |||
171 | if (boot_pages) | ||
172 | *boot_pages = be16_to_cpu(out.num_boot_pages); | ||
173 | |||
174 | *func_id = be16_to_cpu(out.func_id); | 170 | *func_id = be16_to_cpu(out.func_id); |
175 | 171 | ||
176 | return err; | 172 | return err; |
@@ -224,7 +220,7 @@ static int give_pages(struct mlx5_core_dev *dev, u16 func_id, int npages, | |||
224 | in->hdr.opcode = cpu_to_be16(MLX5_CMD_OP_MANAGE_PAGES); | 220 | in->hdr.opcode = cpu_to_be16(MLX5_CMD_OP_MANAGE_PAGES); |
225 | in->hdr.opmod = cpu_to_be16(MLX5_PAGES_GIVE); | 221 | in->hdr.opmod = cpu_to_be16(MLX5_PAGES_GIVE); |
226 | in->func_id = cpu_to_be16(func_id); | 222 | in->func_id = cpu_to_be16(func_id); |
227 | in->num_entries = cpu_to_be16(npages); | 223 | in->num_entries = cpu_to_be32(npages); |
228 | err = mlx5_cmd_exec(dev, in, inlen, &out, sizeof(out)); | 224 | err = mlx5_cmd_exec(dev, in, inlen, &out, sizeof(out)); |
229 | mlx5_core_dbg(dev, "err %d\n", err); | 225 | mlx5_core_dbg(dev, "err %d\n", err); |
230 | if (err) { | 226 | if (err) { |
@@ -292,7 +288,7 @@ static int reclaim_pages(struct mlx5_core_dev *dev, u32 func_id, int npages, | |||
292 | in.hdr.opcode = cpu_to_be16(MLX5_CMD_OP_MANAGE_PAGES); | 288 | in.hdr.opcode = cpu_to_be16(MLX5_CMD_OP_MANAGE_PAGES); |
293 | in.hdr.opmod = cpu_to_be16(MLX5_PAGES_TAKE); | 289 | in.hdr.opmod = cpu_to_be16(MLX5_PAGES_TAKE); |
294 | in.func_id = cpu_to_be16(func_id); | 290 | in.func_id = cpu_to_be16(func_id); |
295 | in.num_entries = cpu_to_be16(npages); | 291 | in.num_entries = cpu_to_be32(npages); |
296 | mlx5_core_dbg(dev, "npages %d, outlen %d\n", npages, outlen); | 292 | mlx5_core_dbg(dev, "npages %d, outlen %d\n", npages, outlen); |
297 | err = mlx5_cmd_exec(dev, &in, sizeof(in), out, outlen); | 293 | err = mlx5_cmd_exec(dev, &in, sizeof(in), out, outlen); |
298 | if (err) { | 294 | if (err) { |
@@ -306,7 +302,7 @@ static int reclaim_pages(struct mlx5_core_dev *dev, u32 func_id, int npages, | |||
306 | goto out_free; | 302 | goto out_free; |
307 | } | 303 | } |
308 | 304 | ||
309 | num_claimed = be16_to_cpu(out->num_entries); | 305 | num_claimed = be32_to_cpu(out->num_entries); |
310 | if (nclaimed) | 306 | if (nclaimed) |
311 | *nclaimed = num_claimed; | 307 | *nclaimed = num_claimed; |
312 | 308 | ||
@@ -345,7 +341,7 @@ static void pages_work_handler(struct work_struct *work) | |||
345 | } | 341 | } |
346 | 342 | ||
347 | void mlx5_core_req_pages_handler(struct mlx5_core_dev *dev, u16 func_id, | 343 | void mlx5_core_req_pages_handler(struct mlx5_core_dev *dev, u16 func_id, |
348 | s16 npages) | 344 | s32 npages) |
349 | { | 345 | { |
350 | struct mlx5_pages_req *req; | 346 | struct mlx5_pages_req *req; |
351 | 347 | ||
@@ -364,20 +360,18 @@ void mlx5_core_req_pages_handler(struct mlx5_core_dev *dev, u16 func_id, | |||
364 | 360 | ||
365 | int mlx5_satisfy_startup_pages(struct mlx5_core_dev *dev, int boot) | 361 | int mlx5_satisfy_startup_pages(struct mlx5_core_dev *dev, int boot) |
366 | { | 362 | { |
367 | u16 uninitialized_var(boot_pages); | ||
368 | s16 uninitialized_var(init_pages); | ||
369 | u16 uninitialized_var(func_id); | 363 | u16 uninitialized_var(func_id); |
364 | s32 uninitialized_var(npages); | ||
370 | int err; | 365 | int err; |
371 | 366 | ||
372 | err = mlx5_cmd_query_pages(dev, &func_id, NULL, &init_pages, | 367 | err = mlx5_cmd_query_pages(dev, &func_id, &npages, boot); |
373 | &boot_pages); | ||
374 | if (err) | 368 | if (err) |
375 | return err; | 369 | return err; |
376 | 370 | ||
371 | mlx5_core_dbg(dev, "requested %d %s pages for func_id 0x%x\n", | ||
372 | npages, boot ? "boot" : "init", func_id); | ||
377 | 373 | ||
378 | mlx5_core_dbg(dev, "requested %d init pages and %d boot pages for func_id 0x%x\n", | 374 | return give_pages(dev, func_id, npages, 0); |
379 | init_pages, boot_pages, func_id); | ||
380 | return give_pages(dev, func_id, boot ? boot_pages : init_pages, 0); | ||
381 | } | 375 | } |
382 | 376 | ||
383 | static int optimal_reclaimed_pages(void) | 377 | static int optimal_reclaimed_pages(void) |
diff --git a/drivers/net/ethernet/qlogic/qlcnic/qlcnic_83xx_hw.c b/drivers/net/ethernet/qlogic/qlcnic/qlcnic_83xx_hw.c index 78ca75576b9e..e53caaaf1303 100644 --- a/drivers/net/ethernet/qlogic/qlcnic/qlcnic_83xx_hw.c +++ b/drivers/net/ethernet/qlogic/qlcnic/qlcnic_83xx_hw.c | |||
@@ -3272,6 +3272,11 @@ int qlcnic_83xx_interrupt_test(struct net_device *netdev) | |||
3272 | u8 val; | 3272 | u8 val; |
3273 | int ret, max_sds_rings = adapter->max_sds_rings; | 3273 | int ret, max_sds_rings = adapter->max_sds_rings; |
3274 | 3274 | ||
3275 | if (test_bit(__QLCNIC_RESETTING, &adapter->state)) { | ||
3276 | netdev_info(netdev, "Device is resetting\n"); | ||
3277 | return -EBUSY; | ||
3278 | } | ||
3279 | |||
3275 | if (qlcnic_get_diag_lock(adapter)) { | 3280 | if (qlcnic_get_diag_lock(adapter)) { |
3276 | netdev_info(netdev, "Device in diagnostics mode\n"); | 3281 | netdev_info(netdev, "Device in diagnostics mode\n"); |
3277 | return -EBUSY; | 3282 | return -EBUSY; |
diff --git a/drivers/net/ethernet/qlogic/qlcnic/qlcnic_83xx_init.c b/drivers/net/ethernet/qlogic/qlcnic/qlcnic_83xx_init.c index 17c26a1158a0..c97e2e07b279 100644 --- a/drivers/net/ethernet/qlogic/qlcnic/qlcnic_83xx_init.c +++ b/drivers/net/ethernet/qlogic/qlcnic/qlcnic_83xx_init.c | |||
@@ -633,7 +633,8 @@ int qlcnic_83xx_idc_reattach_driver(struct qlcnic_adapter *adapter) | |||
633 | return -EIO; | 633 | return -EIO; |
634 | } | 634 | } |
635 | 635 | ||
636 | qlcnic_set_drv_version(adapter); | 636 | if (adapter->portnum == 0) |
637 | qlcnic_set_drv_version(adapter); | ||
637 | qlcnic_83xx_idc_attach_driver(adapter); | 638 | qlcnic_83xx_idc_attach_driver(adapter); |
638 | 639 | ||
639 | return 0; | 640 | return 0; |
diff --git a/drivers/net/ethernet/qlogic/qlcnic/qlcnic_main.c b/drivers/net/ethernet/qlogic/qlcnic/qlcnic_main.c index b8242bc0293b..a780b73e8b2b 100644 --- a/drivers/net/ethernet/qlogic/qlcnic/qlcnic_main.c +++ b/drivers/net/ethernet/qlogic/qlcnic/qlcnic_main.c | |||
@@ -2161,7 +2161,8 @@ qlcnic_probe(struct pci_dev *pdev, const struct pci_device_id *ent) | |||
2161 | if (err) | 2161 | if (err) |
2162 | goto err_out_disable_mbx_intr; | 2162 | goto err_out_disable_mbx_intr; |
2163 | 2163 | ||
2164 | qlcnic_set_drv_version(adapter); | 2164 | if (adapter->portnum == 0) |
2165 | qlcnic_set_drv_version(adapter); | ||
2165 | 2166 | ||
2166 | pci_set_drvdata(pdev, adapter); | 2167 | pci_set_drvdata(pdev, adapter); |
2167 | 2168 | ||
@@ -3083,7 +3084,8 @@ done: | |||
3083 | adapter->fw_fail_cnt = 0; | 3084 | adapter->fw_fail_cnt = 0; |
3084 | adapter->flags &= ~QLCNIC_FW_HANG; | 3085 | adapter->flags &= ~QLCNIC_FW_HANG; |
3085 | clear_bit(__QLCNIC_RESETTING, &adapter->state); | 3086 | clear_bit(__QLCNIC_RESETTING, &adapter->state); |
3086 | qlcnic_set_drv_version(adapter); | 3087 | if (adapter->portnum == 0) |
3088 | qlcnic_set_drv_version(adapter); | ||
3087 | 3089 | ||
3088 | if (!qlcnic_clr_drv_state(adapter)) | 3090 | if (!qlcnic_clr_drv_state(adapter)) |
3089 | qlcnic_schedule_work(adapter, qlcnic_fw_poll_work, | 3091 | qlcnic_schedule_work(adapter, qlcnic_fw_poll_work, |
diff --git a/drivers/net/ethernet/qlogic/qlcnic/qlcnic_sysfs.c b/drivers/net/ethernet/qlogic/qlcnic/qlcnic_sysfs.c index 10ed82b3baca..660c3f5b2237 100644 --- a/drivers/net/ethernet/qlogic/qlcnic/qlcnic_sysfs.c +++ b/drivers/net/ethernet/qlogic/qlcnic/qlcnic_sysfs.c | |||
@@ -170,9 +170,9 @@ static int qlcnic_82xx_store_beacon(struct qlcnic_adapter *adapter, | |||
170 | 170 | ||
171 | if (ahw->extra_capability[0] & QLCNIC_FW_CAPABILITY_2_BEACON) { | 171 | if (ahw->extra_capability[0] & QLCNIC_FW_CAPABILITY_2_BEACON) { |
172 | err = qlcnic_get_beacon_state(adapter, &h_beacon_state); | 172 | err = qlcnic_get_beacon_state(adapter, &h_beacon_state); |
173 | if (!err) { | 173 | if (err) { |
174 | dev_info(&adapter->pdev->dev, | 174 | netdev_err(adapter->netdev, |
175 | "Failed to get current beacon state\n"); | 175 | "Failed to get current beacon state\n"); |
176 | } else { | 176 | } else { |
177 | if (h_beacon_state == QLCNIC_BEACON_DISABLE) | 177 | if (h_beacon_state == QLCNIC_BEACON_DISABLE) |
178 | ahw->beacon_state = 0; | 178 | ahw->beacon_state = 0; |
diff --git a/drivers/net/ethernet/realtek/8139cp.c b/drivers/net/ethernet/realtek/8139cp.c index 6f35f8404d68..d2e591955bdd 100644 --- a/drivers/net/ethernet/realtek/8139cp.c +++ b/drivers/net/ethernet/realtek/8139cp.c | |||
@@ -524,6 +524,7 @@ rx_status_loop: | |||
524 | PCI_DMA_FROMDEVICE); | 524 | PCI_DMA_FROMDEVICE); |
525 | if (dma_mapping_error(&cp->pdev->dev, new_mapping)) { | 525 | if (dma_mapping_error(&cp->pdev->dev, new_mapping)) { |
526 | dev->stats.rx_dropped++; | 526 | dev->stats.rx_dropped++; |
527 | kfree_skb(new_skb); | ||
527 | goto rx_next; | 528 | goto rx_next; |
528 | } | 529 | } |
529 | 530 | ||
diff --git a/drivers/net/ethernet/stmicro/stmmac/ring_mode.c b/drivers/net/ethernet/stmicro/stmmac/ring_mode.c index c9d942a5c335..1ef9d8a555aa 100644 --- a/drivers/net/ethernet/stmicro/stmmac/ring_mode.c +++ b/drivers/net/ethernet/stmicro/stmmac/ring_mode.c | |||
@@ -33,10 +33,15 @@ static unsigned int stmmac_jumbo_frm(void *p, struct sk_buff *skb, int csum) | |||
33 | struct stmmac_priv *priv = (struct stmmac_priv *)p; | 33 | struct stmmac_priv *priv = (struct stmmac_priv *)p; |
34 | unsigned int txsize = priv->dma_tx_size; | 34 | unsigned int txsize = priv->dma_tx_size; |
35 | unsigned int entry = priv->cur_tx % txsize; | 35 | unsigned int entry = priv->cur_tx % txsize; |
36 | struct dma_desc *desc = priv->dma_tx + entry; | 36 | struct dma_desc *desc; |
37 | unsigned int nopaged_len = skb_headlen(skb); | 37 | unsigned int nopaged_len = skb_headlen(skb); |
38 | unsigned int bmax, len; | 38 | unsigned int bmax, len; |
39 | 39 | ||
40 | if (priv->extend_desc) | ||
41 | desc = (struct dma_desc *)(priv->dma_etx + entry); | ||
42 | else | ||
43 | desc = priv->dma_tx + entry; | ||
44 | |||
40 | if (priv->plat->enh_desc) | 45 | if (priv->plat->enh_desc) |
41 | bmax = BUF_SIZE_8KiB; | 46 | bmax = BUF_SIZE_8KiB; |
42 | else | 47 | else |
@@ -54,7 +59,11 @@ static unsigned int stmmac_jumbo_frm(void *p, struct sk_buff *skb, int csum) | |||
54 | STMMAC_RING_MODE); | 59 | STMMAC_RING_MODE); |
55 | wmb(); | 60 | wmb(); |
56 | entry = (++priv->cur_tx) % txsize; | 61 | entry = (++priv->cur_tx) % txsize; |
57 | desc = priv->dma_tx + entry; | 62 | |
63 | if (priv->extend_desc) | ||
64 | desc = (struct dma_desc *)(priv->dma_etx + entry); | ||
65 | else | ||
66 | desc = priv->dma_tx + entry; | ||
58 | 67 | ||
59 | desc->des2 = dma_map_single(priv->device, skb->data + bmax, | 68 | desc->des2 = dma_map_single(priv->device, skb->data + bmax, |
60 | len, DMA_TO_DEVICE); | 69 | len, DMA_TO_DEVICE); |
diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c index f2ccb36e8685..0a9bb9d30c3f 100644 --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c | |||
@@ -939,15 +939,20 @@ static int stmmac_init_rx_buffers(struct stmmac_priv *priv, struct dma_desc *p, | |||
939 | 939 | ||
940 | skb = __netdev_alloc_skb(priv->dev, priv->dma_buf_sz + NET_IP_ALIGN, | 940 | skb = __netdev_alloc_skb(priv->dev, priv->dma_buf_sz + NET_IP_ALIGN, |
941 | GFP_KERNEL); | 941 | GFP_KERNEL); |
942 | if (unlikely(skb == NULL)) { | 942 | if (!skb) { |
943 | pr_err("%s: Rx init fails; skb is NULL\n", __func__); | 943 | pr_err("%s: Rx init fails; skb is NULL\n", __func__); |
944 | return 1; | 944 | return -ENOMEM; |
945 | } | 945 | } |
946 | skb_reserve(skb, NET_IP_ALIGN); | 946 | skb_reserve(skb, NET_IP_ALIGN); |
947 | priv->rx_skbuff[i] = skb; | 947 | priv->rx_skbuff[i] = skb; |
948 | priv->rx_skbuff_dma[i] = dma_map_single(priv->device, skb->data, | 948 | priv->rx_skbuff_dma[i] = dma_map_single(priv->device, skb->data, |
949 | priv->dma_buf_sz, | 949 | priv->dma_buf_sz, |
950 | DMA_FROM_DEVICE); | 950 | DMA_FROM_DEVICE); |
951 | if (dma_mapping_error(priv->device, priv->rx_skbuff_dma[i])) { | ||
952 | pr_err("%s: DMA mapping error\n", __func__); | ||
953 | dev_kfree_skb_any(skb); | ||
954 | return -EINVAL; | ||
955 | } | ||
951 | 956 | ||
952 | p->des2 = priv->rx_skbuff_dma[i]; | 957 | p->des2 = priv->rx_skbuff_dma[i]; |
953 | 958 | ||
@@ -958,6 +963,16 @@ static int stmmac_init_rx_buffers(struct stmmac_priv *priv, struct dma_desc *p, | |||
958 | return 0; | 963 | return 0; |
959 | } | 964 | } |
960 | 965 | ||
966 | static void stmmac_free_rx_buffers(struct stmmac_priv *priv, int i) | ||
967 | { | ||
968 | if (priv->rx_skbuff[i]) { | ||
969 | dma_unmap_single(priv->device, priv->rx_skbuff_dma[i], | ||
970 | priv->dma_buf_sz, DMA_FROM_DEVICE); | ||
971 | dev_kfree_skb_any(priv->rx_skbuff[i]); | ||
972 | } | ||
973 | priv->rx_skbuff[i] = NULL; | ||
974 | } | ||
975 | |||
961 | /** | 976 | /** |
962 | * init_dma_desc_rings - init the RX/TX descriptor rings | 977 | * init_dma_desc_rings - init the RX/TX descriptor rings |
963 | * @dev: net device structure | 978 | * @dev: net device structure |
@@ -965,13 +980,14 @@ static int stmmac_init_rx_buffers(struct stmmac_priv *priv, struct dma_desc *p, | |||
965 | * and allocates the socket buffers. It suppors the chained and ring | 980 | * and allocates the socket buffers. It suppors the chained and ring |
966 | * modes. | 981 | * modes. |
967 | */ | 982 | */ |
968 | static void init_dma_desc_rings(struct net_device *dev) | 983 | static int init_dma_desc_rings(struct net_device *dev) |
969 | { | 984 | { |
970 | int i; | 985 | int i; |
971 | struct stmmac_priv *priv = netdev_priv(dev); | 986 | struct stmmac_priv *priv = netdev_priv(dev); |
972 | unsigned int txsize = priv->dma_tx_size; | 987 | unsigned int txsize = priv->dma_tx_size; |
973 | unsigned int rxsize = priv->dma_rx_size; | 988 | unsigned int rxsize = priv->dma_rx_size; |
974 | unsigned int bfsize = 0; | 989 | unsigned int bfsize = 0; |
990 | int ret = -ENOMEM; | ||
975 | 991 | ||
976 | /* Set the max buffer size according to the DESC mode | 992 | /* Set the max buffer size according to the DESC mode |
977 | * and the MTU. Note that RING mode allows 16KiB bsize. | 993 | * and the MTU. Note that RING mode allows 16KiB bsize. |
@@ -992,34 +1008,60 @@ static void init_dma_desc_rings(struct net_device *dev) | |||
992 | dma_extended_desc), | 1008 | dma_extended_desc), |
993 | &priv->dma_rx_phy, | 1009 | &priv->dma_rx_phy, |
994 | GFP_KERNEL); | 1010 | GFP_KERNEL); |
1011 | if (!priv->dma_erx) | ||
1012 | goto err_dma; | ||
1013 | |||
995 | priv->dma_etx = dma_alloc_coherent(priv->device, txsize * | 1014 | priv->dma_etx = dma_alloc_coherent(priv->device, txsize * |
996 | sizeof(struct | 1015 | sizeof(struct |
997 | dma_extended_desc), | 1016 | dma_extended_desc), |
998 | &priv->dma_tx_phy, | 1017 | &priv->dma_tx_phy, |
999 | GFP_KERNEL); | 1018 | GFP_KERNEL); |
1000 | if ((!priv->dma_erx) || (!priv->dma_etx)) | 1019 | if (!priv->dma_etx) { |
1001 | return; | 1020 | dma_free_coherent(priv->device, priv->dma_rx_size * |
1021 | sizeof(struct dma_extended_desc), | ||
1022 | priv->dma_erx, priv->dma_rx_phy); | ||
1023 | goto err_dma; | ||
1024 | } | ||
1002 | } else { | 1025 | } else { |
1003 | priv->dma_rx = dma_alloc_coherent(priv->device, rxsize * | 1026 | priv->dma_rx = dma_alloc_coherent(priv->device, rxsize * |
1004 | sizeof(struct dma_desc), | 1027 | sizeof(struct dma_desc), |
1005 | &priv->dma_rx_phy, | 1028 | &priv->dma_rx_phy, |
1006 | GFP_KERNEL); | 1029 | GFP_KERNEL); |
1030 | if (!priv->dma_rx) | ||
1031 | goto err_dma; | ||
1032 | |||
1007 | priv->dma_tx = dma_alloc_coherent(priv->device, txsize * | 1033 | priv->dma_tx = dma_alloc_coherent(priv->device, txsize * |
1008 | sizeof(struct dma_desc), | 1034 | sizeof(struct dma_desc), |
1009 | &priv->dma_tx_phy, | 1035 | &priv->dma_tx_phy, |
1010 | GFP_KERNEL); | 1036 | GFP_KERNEL); |
1011 | if ((!priv->dma_rx) || (!priv->dma_tx)) | 1037 | if (!priv->dma_tx) { |
1012 | return; | 1038 | dma_free_coherent(priv->device, priv->dma_rx_size * |
1039 | sizeof(struct dma_desc), | ||
1040 | priv->dma_rx, priv->dma_rx_phy); | ||
1041 | goto err_dma; | ||
1042 | } | ||
1013 | } | 1043 | } |
1014 | 1044 | ||
1015 | priv->rx_skbuff_dma = kmalloc_array(rxsize, sizeof(dma_addr_t), | 1045 | priv->rx_skbuff_dma = kmalloc_array(rxsize, sizeof(dma_addr_t), |
1016 | GFP_KERNEL); | 1046 | GFP_KERNEL); |
1047 | if (!priv->rx_skbuff_dma) | ||
1048 | goto err_rx_skbuff_dma; | ||
1049 | |||
1017 | priv->rx_skbuff = kmalloc_array(rxsize, sizeof(struct sk_buff *), | 1050 | priv->rx_skbuff = kmalloc_array(rxsize, sizeof(struct sk_buff *), |
1018 | GFP_KERNEL); | 1051 | GFP_KERNEL); |
1052 | if (!priv->rx_skbuff) | ||
1053 | goto err_rx_skbuff; | ||
1054 | |||
1019 | priv->tx_skbuff_dma = kmalloc_array(txsize, sizeof(dma_addr_t), | 1055 | priv->tx_skbuff_dma = kmalloc_array(txsize, sizeof(dma_addr_t), |
1020 | GFP_KERNEL); | 1056 | GFP_KERNEL); |
1057 | if (!priv->tx_skbuff_dma) | ||
1058 | goto err_tx_skbuff_dma; | ||
1059 | |||
1021 | priv->tx_skbuff = kmalloc_array(txsize, sizeof(struct sk_buff *), | 1060 | priv->tx_skbuff = kmalloc_array(txsize, sizeof(struct sk_buff *), |
1022 | GFP_KERNEL); | 1061 | GFP_KERNEL); |
1062 | if (!priv->tx_skbuff) | ||
1063 | goto err_tx_skbuff; | ||
1064 | |||
1023 | if (netif_msg_probe(priv)) { | 1065 | if (netif_msg_probe(priv)) { |
1024 | pr_debug("(%s) dma_rx_phy=0x%08x dma_tx_phy=0x%08x\n", __func__, | 1066 | pr_debug("(%s) dma_rx_phy=0x%08x dma_tx_phy=0x%08x\n", __func__, |
1025 | (u32) priv->dma_rx_phy, (u32) priv->dma_tx_phy); | 1067 | (u32) priv->dma_rx_phy, (u32) priv->dma_tx_phy); |
@@ -1034,8 +1076,9 @@ static void init_dma_desc_rings(struct net_device *dev) | |||
1034 | else | 1076 | else |
1035 | p = priv->dma_rx + i; | 1077 | p = priv->dma_rx + i; |
1036 | 1078 | ||
1037 | if (stmmac_init_rx_buffers(priv, p, i)) | 1079 | ret = stmmac_init_rx_buffers(priv, p, i); |
1038 | break; | 1080 | if (ret) |
1081 | goto err_init_rx_buffers; | ||
1039 | 1082 | ||
1040 | if (netif_msg_probe(priv)) | 1083 | if (netif_msg_probe(priv)) |
1041 | pr_debug("[%p]\t[%p]\t[%x]\n", priv->rx_skbuff[i], | 1084 | pr_debug("[%p]\t[%p]\t[%x]\n", priv->rx_skbuff[i], |
@@ -1081,20 +1124,44 @@ static void init_dma_desc_rings(struct net_device *dev) | |||
1081 | 1124 | ||
1082 | if (netif_msg_hw(priv)) | 1125 | if (netif_msg_hw(priv)) |
1083 | stmmac_display_rings(priv); | 1126 | stmmac_display_rings(priv); |
1127 | |||
1128 | return 0; | ||
1129 | err_init_rx_buffers: | ||
1130 | while (--i >= 0) | ||
1131 | stmmac_free_rx_buffers(priv, i); | ||
1132 | kfree(priv->tx_skbuff); | ||
1133 | err_tx_skbuff: | ||
1134 | kfree(priv->tx_skbuff_dma); | ||
1135 | err_tx_skbuff_dma: | ||
1136 | kfree(priv->rx_skbuff); | ||
1137 | err_rx_skbuff: | ||
1138 | kfree(priv->rx_skbuff_dma); | ||
1139 | err_rx_skbuff_dma: | ||
1140 | if (priv->extend_desc) { | ||
1141 | dma_free_coherent(priv->device, priv->dma_tx_size * | ||
1142 | sizeof(struct dma_extended_desc), | ||
1143 | priv->dma_etx, priv->dma_tx_phy); | ||
1144 | dma_free_coherent(priv->device, priv->dma_rx_size * | ||
1145 | sizeof(struct dma_extended_desc), | ||
1146 | priv->dma_erx, priv->dma_rx_phy); | ||
1147 | } else { | ||
1148 | dma_free_coherent(priv->device, | ||
1149 | priv->dma_tx_size * sizeof(struct dma_desc), | ||
1150 | priv->dma_tx, priv->dma_tx_phy); | ||
1151 | dma_free_coherent(priv->device, | ||
1152 | priv->dma_rx_size * sizeof(struct dma_desc), | ||
1153 | priv->dma_rx, priv->dma_rx_phy); | ||
1154 | } | ||
1155 | err_dma: | ||
1156 | return ret; | ||
1084 | } | 1157 | } |
1085 | 1158 | ||
1086 | static void dma_free_rx_skbufs(struct stmmac_priv *priv) | 1159 | static void dma_free_rx_skbufs(struct stmmac_priv *priv) |
1087 | { | 1160 | { |
1088 | int i; | 1161 | int i; |
1089 | 1162 | ||
1090 | for (i = 0; i < priv->dma_rx_size; i++) { | 1163 | for (i = 0; i < priv->dma_rx_size; i++) |
1091 | if (priv->rx_skbuff[i]) { | 1164 | stmmac_free_rx_buffers(priv, i); |
1092 | dma_unmap_single(priv->device, priv->rx_skbuff_dma[i], | ||
1093 | priv->dma_buf_sz, DMA_FROM_DEVICE); | ||
1094 | dev_kfree_skb_any(priv->rx_skbuff[i]); | ||
1095 | } | ||
1096 | priv->rx_skbuff[i] = NULL; | ||
1097 | } | ||
1098 | } | 1165 | } |
1099 | 1166 | ||
1100 | static void dma_free_tx_skbufs(struct stmmac_priv *priv) | 1167 | static void dma_free_tx_skbufs(struct stmmac_priv *priv) |
@@ -1560,12 +1627,17 @@ static int stmmac_open(struct net_device *dev) | |||
1560 | priv->dma_tx_size = STMMAC_ALIGN(dma_txsize); | 1627 | priv->dma_tx_size = STMMAC_ALIGN(dma_txsize); |
1561 | priv->dma_rx_size = STMMAC_ALIGN(dma_rxsize); | 1628 | priv->dma_rx_size = STMMAC_ALIGN(dma_rxsize); |
1562 | priv->dma_buf_sz = STMMAC_ALIGN(buf_sz); | 1629 | priv->dma_buf_sz = STMMAC_ALIGN(buf_sz); |
1563 | init_dma_desc_rings(dev); | 1630 | |
1631 | ret = init_dma_desc_rings(dev); | ||
1632 | if (ret < 0) { | ||
1633 | pr_err("%s: DMA descriptors initialization failed\n", __func__); | ||
1634 | goto dma_desc_error; | ||
1635 | } | ||
1564 | 1636 | ||
1565 | /* DMA initialization and SW reset */ | 1637 | /* DMA initialization and SW reset */ |
1566 | ret = stmmac_init_dma_engine(priv); | 1638 | ret = stmmac_init_dma_engine(priv); |
1567 | if (ret < 0) { | 1639 | if (ret < 0) { |
1568 | pr_err("%s: DMA initialization failed\n", __func__); | 1640 | pr_err("%s: DMA engine initialization failed\n", __func__); |
1569 | goto init_error; | 1641 | goto init_error; |
1570 | } | 1642 | } |
1571 | 1643 | ||
@@ -1672,6 +1744,7 @@ wolirq_error: | |||
1672 | 1744 | ||
1673 | init_error: | 1745 | init_error: |
1674 | free_dma_desc_resources(priv); | 1746 | free_dma_desc_resources(priv); |
1747 | dma_desc_error: | ||
1675 | if (priv->phydev) | 1748 | if (priv->phydev) |
1676 | phy_disconnect(priv->phydev); | 1749 | phy_disconnect(priv->phydev); |
1677 | phy_error: | 1750 | phy_error: |
diff --git a/drivers/net/ethernet/via/via-velocity.c b/drivers/net/ethernet/via/via-velocity.c index ef776310fab1..d022bf936572 100644 --- a/drivers/net/ethernet/via/via-velocity.c +++ b/drivers/net/ethernet/via/via-velocity.c | |||
@@ -2100,7 +2100,7 @@ static int velocity_receive_frame(struct velocity_info *vptr, int idx) | |||
2100 | 2100 | ||
2101 | __vlan_hwaccel_put_tag(skb, htons(ETH_P_8021Q), vid); | 2101 | __vlan_hwaccel_put_tag(skb, htons(ETH_P_8021Q), vid); |
2102 | } | 2102 | } |
2103 | netif_rx(skb); | 2103 | netif_receive_skb(skb); |
2104 | 2104 | ||
2105 | stats->rx_bytes += pkt_len; | 2105 | stats->rx_bytes += pkt_len; |
2106 | stats->rx_packets++; | 2106 | stats->rx_packets++; |
@@ -2904,6 +2904,7 @@ out: | |||
2904 | return ret; | 2904 | return ret; |
2905 | 2905 | ||
2906 | err_iounmap: | 2906 | err_iounmap: |
2907 | netif_napi_del(&vptr->napi); | ||
2907 | iounmap(regs); | 2908 | iounmap(regs); |
2908 | err_free_dev: | 2909 | err_free_dev: |
2909 | free_netdev(netdev); | 2910 | free_netdev(netdev); |
@@ -2924,6 +2925,7 @@ static int velocity_remove(struct device *dev) | |||
2924 | struct velocity_info *vptr = netdev_priv(netdev); | 2925 | struct velocity_info *vptr = netdev_priv(netdev); |
2925 | 2926 | ||
2926 | unregister_netdev(netdev); | 2927 | unregister_netdev(netdev); |
2928 | netif_napi_del(&vptr->napi); | ||
2927 | iounmap(vptr->mac_regs); | 2929 | iounmap(vptr->mac_regs); |
2928 | free_netdev(netdev); | 2930 | free_netdev(netdev); |
2929 | velocity_nics--; | 2931 | velocity_nics--; |
diff --git a/drivers/net/macvlan.c b/drivers/net/macvlan.c index a822207b8241..510a9b60fde1 100644 --- a/drivers/net/macvlan.c +++ b/drivers/net/macvlan.c | |||
@@ -742,6 +742,10 @@ static int macvlan_validate(struct nlattr *tb[], struct nlattr *data[]) | |||
742 | return -EADDRNOTAVAIL; | 742 | return -EADDRNOTAVAIL; |
743 | } | 743 | } |
744 | 744 | ||
745 | if (data && data[IFLA_MACVLAN_FLAGS] && | ||
746 | nla_get_u16(data[IFLA_MACVLAN_FLAGS]) & ~MACVLAN_FLAG_NOPROMISC) | ||
747 | return -EINVAL; | ||
748 | |||
745 | if (data && data[IFLA_MACVLAN_MODE]) { | 749 | if (data && data[IFLA_MACVLAN_MODE]) { |
746 | switch (nla_get_u32(data[IFLA_MACVLAN_MODE])) { | 750 | switch (nla_get_u32(data[IFLA_MACVLAN_MODE])) { |
747 | case MACVLAN_MODE_PRIVATE: | 751 | case MACVLAN_MODE_PRIVATE: |
diff --git a/drivers/net/macvtap.c b/drivers/net/macvtap.c index 8f6056d9ba97..1c6e1116eb0a 100644 --- a/drivers/net/macvtap.c +++ b/drivers/net/macvtap.c | |||
@@ -715,10 +715,13 @@ static ssize_t macvtap_get_user(struct macvtap_queue *q, struct msghdr *m, | |||
715 | skb_shinfo(skb)->tx_flags |= SKBTX_DEV_ZEROCOPY; | 715 | skb_shinfo(skb)->tx_flags |= SKBTX_DEV_ZEROCOPY; |
716 | skb_shinfo(skb)->tx_flags |= SKBTX_SHARED_FRAG; | 716 | skb_shinfo(skb)->tx_flags |= SKBTX_SHARED_FRAG; |
717 | } | 717 | } |
718 | if (vlan) | 718 | if (vlan) { |
719 | local_bh_disable(); | ||
719 | macvlan_start_xmit(skb, vlan->dev); | 720 | macvlan_start_xmit(skb, vlan->dev); |
720 | else | 721 | local_bh_enable(); |
722 | } else { | ||
721 | kfree_skb(skb); | 723 | kfree_skb(skb); |
724 | } | ||
722 | rcu_read_unlock(); | 725 | rcu_read_unlock(); |
723 | 726 | ||
724 | return total_len; | 727 | return total_len; |
@@ -809,8 +812,11 @@ static ssize_t macvtap_put_user(struct macvtap_queue *q, | |||
809 | done: | 812 | done: |
810 | rcu_read_lock(); | 813 | rcu_read_lock(); |
811 | vlan = rcu_dereference(q->vlan); | 814 | vlan = rcu_dereference(q->vlan); |
812 | if (vlan) | 815 | if (vlan) { |
816 | preempt_disable(); | ||
813 | macvlan_count_rx(vlan, copied - vnet_hdr_len, ret == 0, 0); | 817 | macvlan_count_rx(vlan, copied - vnet_hdr_len, ret == 0, 0); |
818 | preempt_enable(); | ||
819 | } | ||
814 | rcu_read_unlock(); | 820 | rcu_read_unlock(); |
815 | 821 | ||
816 | return ret ? ret : copied; | 822 | return ret ? ret : copied; |
diff --git a/drivers/net/tun.c b/drivers/net/tun.c index 978d8654b14a..7ed13cc0dcb2 100644 --- a/drivers/net/tun.c +++ b/drivers/net/tun.c | |||
@@ -977,8 +977,9 @@ static ssize_t tun_get_user(struct tun_struct *tun, struct tun_file *tfile, | |||
977 | u32 rxhash; | 977 | u32 rxhash; |
978 | 978 | ||
979 | if (!(tun->flags & TUN_NO_PI)) { | 979 | if (!(tun->flags & TUN_NO_PI)) { |
980 | if ((len -= sizeof(pi)) > total_len) | 980 | if (len < sizeof(pi)) |
981 | return -EINVAL; | 981 | return -EINVAL; |
982 | len -= sizeof(pi); | ||
982 | 983 | ||
983 | if (memcpy_fromiovecend((void *)&pi, iv, 0, sizeof(pi))) | 984 | if (memcpy_fromiovecend((void *)&pi, iv, 0, sizeof(pi))) |
984 | return -EFAULT; | 985 | return -EFAULT; |
@@ -986,8 +987,9 @@ static ssize_t tun_get_user(struct tun_struct *tun, struct tun_file *tfile, | |||
986 | } | 987 | } |
987 | 988 | ||
988 | if (tun->flags & TUN_VNET_HDR) { | 989 | if (tun->flags & TUN_VNET_HDR) { |
989 | if ((len -= tun->vnet_hdr_sz) > total_len) | 990 | if (len < tun->vnet_hdr_sz) |
990 | return -EINVAL; | 991 | return -EINVAL; |
992 | len -= tun->vnet_hdr_sz; | ||
991 | 993 | ||
992 | if (memcpy_fromiovecend((void *)&gso, iv, offset, sizeof(gso))) | 994 | if (memcpy_fromiovecend((void *)&gso, iv, offset, sizeof(gso))) |
993 | return -EFAULT; | 995 | return -EFAULT; |
diff --git a/drivers/net/vxlan.c b/drivers/net/vxlan.c index 8bf31d9a397c..570ad7aa7204 100644 --- a/drivers/net/vxlan.c +++ b/drivers/net/vxlan.c | |||
@@ -1430,7 +1430,7 @@ static int vxlan_open(struct net_device *dev) | |||
1430 | return -ENOTCONN; | 1430 | return -ENOTCONN; |
1431 | 1431 | ||
1432 | if (IN_MULTICAST(ntohl(vxlan->default_dst.remote_ip)) && | 1432 | if (IN_MULTICAST(ntohl(vxlan->default_dst.remote_ip)) && |
1433 | ! vxlan_group_used(vn, vxlan->default_dst.remote_ip)) { | 1433 | vxlan_group_used(vn, vxlan->default_dst.remote_ip)) { |
1434 | vxlan_sock_hold(vs); | 1434 | vxlan_sock_hold(vs); |
1435 | dev_hold(dev); | 1435 | dev_hold(dev); |
1436 | queue_work(vxlan_wq, &vxlan->igmp_join); | 1436 | queue_work(vxlan_wq, &vxlan->igmp_join); |
@@ -1837,8 +1837,6 @@ static void vxlan_dellink(struct net_device *dev, struct list_head *head) | |||
1837 | struct vxlan_net *vn = net_generic(dev_net(dev), vxlan_net_id); | 1837 | struct vxlan_net *vn = net_generic(dev_net(dev), vxlan_net_id); |
1838 | struct vxlan_dev *vxlan = netdev_priv(dev); | 1838 | struct vxlan_dev *vxlan = netdev_priv(dev); |
1839 | 1839 | ||
1840 | flush_workqueue(vxlan_wq); | ||
1841 | |||
1842 | spin_lock(&vn->sock_lock); | 1840 | spin_lock(&vn->sock_lock); |
1843 | hlist_del_rcu(&vxlan->hlist); | 1841 | hlist_del_rcu(&vxlan->hlist); |
1844 | spin_unlock(&vn->sock_lock); | 1842 | spin_unlock(&vn->sock_lock); |
diff --git a/drivers/pci/pci-acpi.c b/drivers/pci/pci-acpi.c index dbdc5f7e2b29..01e264fb50e0 100644 --- a/drivers/pci/pci-acpi.c +++ b/drivers/pci/pci-acpi.c | |||
@@ -317,13 +317,20 @@ void acpi_pci_remove_bus(struct pci_bus *bus) | |||
317 | /* ACPI bus type */ | 317 | /* ACPI bus type */ |
318 | static int acpi_pci_find_device(struct device *dev, acpi_handle *handle) | 318 | static int acpi_pci_find_device(struct device *dev, acpi_handle *handle) |
319 | { | 319 | { |
320 | struct pci_dev * pci_dev; | 320 | struct pci_dev *pci_dev = to_pci_dev(dev); |
321 | u64 addr; | 321 | bool is_bridge; |
322 | u64 addr; | ||
322 | 323 | ||
323 | pci_dev = to_pci_dev(dev); | 324 | /* |
325 | * pci_is_bridge() is not suitable here, because pci_dev->subordinate | ||
326 | * is set only after acpi_pci_find_device() has been called for the | ||
327 | * given device. | ||
328 | */ | ||
329 | is_bridge = pci_dev->hdr_type == PCI_HEADER_TYPE_BRIDGE | ||
330 | || pci_dev->hdr_type == PCI_HEADER_TYPE_CARDBUS; | ||
324 | /* Please ref to ACPI spec for the syntax of _ADR */ | 331 | /* Please ref to ACPI spec for the syntax of _ADR */ |
325 | addr = (PCI_SLOT(pci_dev->devfn) << 16) | PCI_FUNC(pci_dev->devfn); | 332 | addr = (PCI_SLOT(pci_dev->devfn) << 16) | PCI_FUNC(pci_dev->devfn); |
326 | *handle = acpi_get_child(DEVICE_ACPI_HANDLE(dev->parent), addr); | 333 | *handle = acpi_find_child(ACPI_HANDLE(dev->parent), addr, is_bridge); |
327 | if (!*handle) | 334 | if (!*handle) |
328 | return -ENODEV; | 335 | return -ENODEV; |
329 | return 0; | 336 | return 0; |
diff --git a/drivers/rtc/rtc-stmp3xxx.c b/drivers/rtc/rtc-stmp3xxx.c index 767fee2ab340..26019531db15 100644 --- a/drivers/rtc/rtc-stmp3xxx.c +++ b/drivers/rtc/rtc-stmp3xxx.c | |||
@@ -23,6 +23,7 @@ | |||
23 | #include <linux/init.h> | 23 | #include <linux/init.h> |
24 | #include <linux/platform_device.h> | 24 | #include <linux/platform_device.h> |
25 | #include <linux/interrupt.h> | 25 | #include <linux/interrupt.h> |
26 | #include <linux/delay.h> | ||
26 | #include <linux/rtc.h> | 27 | #include <linux/rtc.h> |
27 | #include <linux/slab.h> | 28 | #include <linux/slab.h> |
28 | #include <linux/of_device.h> | 29 | #include <linux/of_device.h> |
@@ -119,24 +120,39 @@ static void stmp3xxx_wdt_register(struct platform_device *rtc_pdev) | |||
119 | } | 120 | } |
120 | #endif /* CONFIG_STMP3XXX_RTC_WATCHDOG */ | 121 | #endif /* CONFIG_STMP3XXX_RTC_WATCHDOG */ |
121 | 122 | ||
122 | static void stmp3xxx_wait_time(struct stmp3xxx_rtc_data *rtc_data) | 123 | static int stmp3xxx_wait_time(struct stmp3xxx_rtc_data *rtc_data) |
123 | { | 124 | { |
125 | int timeout = 5000; /* 3ms according to i.MX28 Ref Manual */ | ||
124 | /* | 126 | /* |
125 | * The datasheet doesn't say which way round the | 127 | * The i.MX28 Applications Processor Reference Manual, Rev. 1, 2010 |
126 | * NEW_REGS/STALE_REGS bitfields go. In fact it's 0x1=P0, | 128 | * states: |
127 | * 0x2=P1, .., 0x20=P5, 0x40=ALARM, 0x80=SECONDS | 129 | * | The order in which registers are updated is |
130 | * | Persistent 0, 1, 2, 3, 4, 5, Alarm, Seconds. | ||
131 | * | (This list is in bitfield order, from LSB to MSB, as they would | ||
132 | * | appear in the STALE_REGS and NEW_REGS bitfields of the HW_RTC_STAT | ||
133 | * | register. For example, the Seconds register corresponds to | ||
134 | * | STALE_REGS or NEW_REGS containing 0x80.) | ||
128 | */ | 135 | */ |
129 | while (readl(rtc_data->io + STMP3XXX_RTC_STAT) & | 136 | do { |
130 | (0x80 << STMP3XXX_RTC_STAT_STALE_SHIFT)) | 137 | if (!(readl(rtc_data->io + STMP3XXX_RTC_STAT) & |
131 | cpu_relax(); | 138 | (0x80 << STMP3XXX_RTC_STAT_STALE_SHIFT))) |
139 | return 0; | ||
140 | udelay(1); | ||
141 | } while (--timeout > 0); | ||
142 | return (readl(rtc_data->io + STMP3XXX_RTC_STAT) & | ||
143 | (0x80 << STMP3XXX_RTC_STAT_STALE_SHIFT)) ? -ETIME : 0; | ||
132 | } | 144 | } |
133 | 145 | ||
134 | /* Time read/write */ | 146 | /* Time read/write */ |
135 | static int stmp3xxx_rtc_gettime(struct device *dev, struct rtc_time *rtc_tm) | 147 | static int stmp3xxx_rtc_gettime(struct device *dev, struct rtc_time *rtc_tm) |
136 | { | 148 | { |
149 | int ret; | ||
137 | struct stmp3xxx_rtc_data *rtc_data = dev_get_drvdata(dev); | 150 | struct stmp3xxx_rtc_data *rtc_data = dev_get_drvdata(dev); |
138 | 151 | ||
139 | stmp3xxx_wait_time(rtc_data); | 152 | ret = stmp3xxx_wait_time(rtc_data); |
153 | if (ret) | ||
154 | return ret; | ||
155 | |||
140 | rtc_time_to_tm(readl(rtc_data->io + STMP3XXX_RTC_SECONDS), rtc_tm); | 156 | rtc_time_to_tm(readl(rtc_data->io + STMP3XXX_RTC_SECONDS), rtc_tm); |
141 | return 0; | 157 | return 0; |
142 | } | 158 | } |
@@ -146,8 +162,7 @@ static int stmp3xxx_rtc_set_mmss(struct device *dev, unsigned long t) | |||
146 | struct stmp3xxx_rtc_data *rtc_data = dev_get_drvdata(dev); | 162 | struct stmp3xxx_rtc_data *rtc_data = dev_get_drvdata(dev); |
147 | 163 | ||
148 | writel(t, rtc_data->io + STMP3XXX_RTC_SECONDS); | 164 | writel(t, rtc_data->io + STMP3XXX_RTC_SECONDS); |
149 | stmp3xxx_wait_time(rtc_data); | 165 | return stmp3xxx_wait_time(rtc_data); |
150 | return 0; | ||
151 | } | 166 | } |
152 | 167 | ||
153 | /* interrupt(s) handler */ | 168 | /* interrupt(s) handler */ |
diff --git a/drivers/s390/block/dasd.c b/drivers/s390/block/dasd.c index 17150a778984..451bf99582ff 100644 --- a/drivers/s390/block/dasd.c +++ b/drivers/s390/block/dasd.c | |||
@@ -2392,6 +2392,12 @@ int dasd_sleep_on_immediatly(struct dasd_ccw_req *cqr) | |||
2392 | rc = cqr->intrc; | 2392 | rc = cqr->intrc; |
2393 | else | 2393 | else |
2394 | rc = -EIO; | 2394 | rc = -EIO; |
2395 | |||
2396 | /* kick tasklets */ | ||
2397 | dasd_schedule_device_bh(device); | ||
2398 | if (device->block) | ||
2399 | dasd_schedule_block_bh(device->block); | ||
2400 | |||
2395 | return rc; | 2401 | return rc; |
2396 | } | 2402 | } |
2397 | 2403 | ||
diff --git a/drivers/scsi/fnic/fnic.h b/drivers/scsi/fnic/fnic.h index b6d1f92ed33c..c18c68150e9f 100644 --- a/drivers/scsi/fnic/fnic.h +++ b/drivers/scsi/fnic/fnic.h | |||
@@ -38,7 +38,7 @@ | |||
38 | 38 | ||
39 | #define DRV_NAME "fnic" | 39 | #define DRV_NAME "fnic" |
40 | #define DRV_DESCRIPTION "Cisco FCoE HBA Driver" | 40 | #define DRV_DESCRIPTION "Cisco FCoE HBA Driver" |
41 | #define DRV_VERSION "1.5.0.22" | 41 | #define DRV_VERSION "1.5.0.23" |
42 | #define PFX DRV_NAME ": " | 42 | #define PFX DRV_NAME ": " |
43 | #define DFX DRV_NAME "%d: " | 43 | #define DFX DRV_NAME "%d: " |
44 | 44 | ||
diff --git a/drivers/scsi/fnic/fnic_main.c b/drivers/scsi/fnic/fnic_main.c index 5f09d1814d26..42e15ee6e1bb 100644 --- a/drivers/scsi/fnic/fnic_main.c +++ b/drivers/scsi/fnic/fnic_main.c | |||
@@ -642,19 +642,6 @@ static int fnic_probe(struct pci_dev *pdev, const struct pci_device_id *ent) | |||
642 | INIT_WORK(&fnic->fip_frame_work, fnic_handle_fip_frame); | 642 | INIT_WORK(&fnic->fip_frame_work, fnic_handle_fip_frame); |
643 | INIT_WORK(&fnic->event_work, fnic_handle_event); | 643 | INIT_WORK(&fnic->event_work, fnic_handle_event); |
644 | skb_queue_head_init(&fnic->fip_frame_queue); | 644 | skb_queue_head_init(&fnic->fip_frame_queue); |
645 | spin_lock_irqsave(&fnic_list_lock, flags); | ||
646 | if (!fnic_fip_queue) { | ||
647 | fnic_fip_queue = | ||
648 | create_singlethread_workqueue("fnic_fip_q"); | ||
649 | if (!fnic_fip_queue) { | ||
650 | spin_unlock_irqrestore(&fnic_list_lock, flags); | ||
651 | printk(KERN_ERR PFX "fnic FIP work queue " | ||
652 | "create failed\n"); | ||
653 | err = -ENOMEM; | ||
654 | goto err_out_free_max_pool; | ||
655 | } | ||
656 | } | ||
657 | spin_unlock_irqrestore(&fnic_list_lock, flags); | ||
658 | INIT_LIST_HEAD(&fnic->evlist); | 645 | INIT_LIST_HEAD(&fnic->evlist); |
659 | INIT_LIST_HEAD(&fnic->vlans); | 646 | INIT_LIST_HEAD(&fnic->vlans); |
660 | } else { | 647 | } else { |
@@ -960,6 +947,13 @@ static int __init fnic_init_module(void) | |||
960 | spin_lock_init(&fnic_list_lock); | 947 | spin_lock_init(&fnic_list_lock); |
961 | INIT_LIST_HEAD(&fnic_list); | 948 | INIT_LIST_HEAD(&fnic_list); |
962 | 949 | ||
950 | fnic_fip_queue = create_singlethread_workqueue("fnic_fip_q"); | ||
951 | if (!fnic_fip_queue) { | ||
952 | printk(KERN_ERR PFX "fnic FIP work queue create failed\n"); | ||
953 | err = -ENOMEM; | ||
954 | goto err_create_fip_workq; | ||
955 | } | ||
956 | |||
963 | fnic_fc_transport = fc_attach_transport(&fnic_fc_functions); | 957 | fnic_fc_transport = fc_attach_transport(&fnic_fc_functions); |
964 | if (!fnic_fc_transport) { | 958 | if (!fnic_fc_transport) { |
965 | printk(KERN_ERR PFX "fc_attach_transport error\n"); | 959 | printk(KERN_ERR PFX "fc_attach_transport error\n"); |
@@ -978,6 +972,8 @@ static int __init fnic_init_module(void) | |||
978 | err_pci_register: | 972 | err_pci_register: |
979 | fc_release_transport(fnic_fc_transport); | 973 | fc_release_transport(fnic_fc_transport); |
980 | err_fc_transport: | 974 | err_fc_transport: |
975 | destroy_workqueue(fnic_fip_queue); | ||
976 | err_create_fip_workq: | ||
981 | destroy_workqueue(fnic_event_queue); | 977 | destroy_workqueue(fnic_event_queue); |
982 | err_create_fnic_workq: | 978 | err_create_fnic_workq: |
983 | kmem_cache_destroy(fnic_io_req_cache); | 979 | kmem_cache_destroy(fnic_io_req_cache); |
diff --git a/drivers/scsi/megaraid/megaraid_sas_base.c b/drivers/scsi/megaraid/megaraid_sas_base.c index 0177295599e0..1f0ca68409d4 100644 --- a/drivers/scsi/megaraid/megaraid_sas_base.c +++ b/drivers/scsi/megaraid/megaraid_sas_base.c | |||
@@ -3547,11 +3547,21 @@ static int megasas_init_fw(struct megasas_instance *instance) | |||
3547 | break; | 3547 | break; |
3548 | } | 3548 | } |
3549 | 3549 | ||
3550 | /* | 3550 | if (megasas_transition_to_ready(instance, 0)) { |
3551 | * We expect the FW state to be READY | 3551 | atomic_set(&instance->fw_reset_no_pci_access, 1); |
3552 | */ | 3552 | instance->instancet->adp_reset |
3553 | if (megasas_transition_to_ready(instance, 0)) | 3553 | (instance, instance->reg_set); |
3554 | goto fail_ready_state; | 3554 | atomic_set(&instance->fw_reset_no_pci_access, 0); |
3555 | dev_info(&instance->pdev->dev, | ||
3556 | "megasas: FW restarted successfully from %s!\n", | ||
3557 | __func__); | ||
3558 | |||
3559 | /*waitting for about 30 second before retry*/ | ||
3560 | ssleep(30); | ||
3561 | |||
3562 | if (megasas_transition_to_ready(instance, 0)) | ||
3563 | goto fail_ready_state; | ||
3564 | } | ||
3555 | 3565 | ||
3556 | /* | 3566 | /* |
3557 | * MSI-X host index 0 is common for all adapter. | 3567 | * MSI-X host index 0 is common for all adapter. |
diff --git a/drivers/scsi/scsi.c b/drivers/scsi/scsi.c index 3b1ea34e1f5a..eaa808e6ba91 100644 --- a/drivers/scsi/scsi.c +++ b/drivers/scsi/scsi.c | |||
@@ -1031,6 +1031,9 @@ int scsi_get_vpd_page(struct scsi_device *sdev, u8 page, unsigned char *buf, | |||
1031 | { | 1031 | { |
1032 | int i, result; | 1032 | int i, result; |
1033 | 1033 | ||
1034 | if (sdev->skip_vpd_pages) | ||
1035 | goto fail; | ||
1036 | |||
1034 | /* Ask for all the pages supported by this device */ | 1037 | /* Ask for all the pages supported by this device */ |
1035 | result = scsi_vpd_inquiry(sdev, buf, 0, buf_len); | 1038 | result = scsi_vpd_inquiry(sdev, buf, 0, buf_len); |
1036 | if (result) | 1039 | if (result) |
diff --git a/drivers/scsi/virtio_scsi.c b/drivers/scsi/virtio_scsi.c index 2168258fb2c3..74b88efde6ad 100644 --- a/drivers/scsi/virtio_scsi.c +++ b/drivers/scsi/virtio_scsi.c | |||
@@ -751,7 +751,7 @@ static void __virtscsi_set_affinity(struct virtio_scsi *vscsi, bool affinity) | |||
751 | 751 | ||
752 | vscsi->affinity_hint_set = true; | 752 | vscsi->affinity_hint_set = true; |
753 | } else { | 753 | } else { |
754 | for (i = 0; i < vscsi->num_queues - VIRTIO_SCSI_VQ_BASE; i++) | 754 | for (i = 0; i < vscsi->num_queues; i++) |
755 | virtqueue_set_affinity(vscsi->req_vqs[i].vq, -1); | 755 | virtqueue_set_affinity(vscsi->req_vqs[i].vq, -1); |
756 | 756 | ||
757 | vscsi->affinity_hint_set = false; | 757 | vscsi->affinity_hint_set = false; |
diff --git a/drivers/spi/spi-davinci.c b/drivers/spi/spi-davinci.c index 222d3e37fc28..707966bd5610 100644 --- a/drivers/spi/spi-davinci.c +++ b/drivers/spi/spi-davinci.c | |||
@@ -609,7 +609,7 @@ static int davinci_spi_bufs(struct spi_device *spi, struct spi_transfer *t) | |||
609 | else | 609 | else |
610 | buf = (void *)t->tx_buf; | 610 | buf = (void *)t->tx_buf; |
611 | t->tx_dma = dma_map_single(&spi->dev, buf, | 611 | t->tx_dma = dma_map_single(&spi->dev, buf, |
612 | t->len, DMA_FROM_DEVICE); | 612 | t->len, DMA_TO_DEVICE); |
613 | if (!t->tx_dma) { | 613 | if (!t->tx_dma) { |
614 | ret = -EFAULT; | 614 | ret = -EFAULT; |
615 | goto err_tx_map; | 615 | goto err_tx_map; |
diff --git a/drivers/staging/zcache/zcache-main.c b/drivers/staging/zcache/zcache-main.c index dcceed29d31a..81972fa47beb 100644 --- a/drivers/staging/zcache/zcache-main.c +++ b/drivers/staging/zcache/zcache-main.c | |||
@@ -1811,10 +1811,12 @@ static int zcache_comp_init(void) | |||
1811 | #else | 1811 | #else |
1812 | if (*zcache_comp_name != '\0') { | 1812 | if (*zcache_comp_name != '\0') { |
1813 | ret = crypto_has_comp(zcache_comp_name, 0, 0); | 1813 | ret = crypto_has_comp(zcache_comp_name, 0, 0); |
1814 | if (!ret) | 1814 | if (!ret) { |
1815 | pr_info("zcache: %s not supported\n", | 1815 | pr_info("zcache: %s not supported\n", |
1816 | zcache_comp_name); | 1816 | zcache_comp_name); |
1817 | goto out; | 1817 | ret = 1; |
1818 | goto out; | ||
1819 | } | ||
1818 | } | 1820 | } |
1819 | if (!ret) | 1821 | if (!ret) |
1820 | strcpy(zcache_comp_name, "lzo"); | 1822 | strcpy(zcache_comp_name, "lzo"); |
diff --git a/drivers/usb/class/usbtmc.c b/drivers/usb/class/usbtmc.c index 609dbc2f7151..83b4ef4dfcf8 100644 --- a/drivers/usb/class/usbtmc.c +++ b/drivers/usb/class/usbtmc.c | |||
@@ -1119,11 +1119,11 @@ static int usbtmc_probe(struct usb_interface *intf, | |||
1119 | /* Determine if it is a Rigol or not */ | 1119 | /* Determine if it is a Rigol or not */ |
1120 | data->rigol_quirk = 0; | 1120 | data->rigol_quirk = 0; |
1121 | dev_dbg(&intf->dev, "Trying to find if device Vendor 0x%04X Product 0x%04X has the RIGOL quirk\n", | 1121 | dev_dbg(&intf->dev, "Trying to find if device Vendor 0x%04X Product 0x%04X has the RIGOL quirk\n", |
1122 | data->usb_dev->descriptor.idVendor, | 1122 | le16_to_cpu(data->usb_dev->descriptor.idVendor), |
1123 | data->usb_dev->descriptor.idProduct); | 1123 | le16_to_cpu(data->usb_dev->descriptor.idProduct)); |
1124 | for(n = 0; usbtmc_id_quirk[n].idVendor > 0; n++) { | 1124 | for(n = 0; usbtmc_id_quirk[n].idVendor > 0; n++) { |
1125 | if ((usbtmc_id_quirk[n].idVendor == data->usb_dev->descriptor.idVendor) && | 1125 | if ((usbtmc_id_quirk[n].idVendor == le16_to_cpu(data->usb_dev->descriptor.idVendor)) && |
1126 | (usbtmc_id_quirk[n].idProduct == data->usb_dev->descriptor.idProduct)) { | 1126 | (usbtmc_id_quirk[n].idProduct == le16_to_cpu(data->usb_dev->descriptor.idProduct))) { |
1127 | dev_dbg(&intf->dev, "Setting this device as having the RIGOL quirk\n"); | 1127 | dev_dbg(&intf->dev, "Setting this device as having the RIGOL quirk\n"); |
1128 | data->rigol_quirk = 1; | 1128 | data->rigol_quirk = 1; |
1129 | break; | 1129 | break; |
diff --git a/drivers/usb/core/hub.c b/drivers/usb/core/hub.c index 4a8a1d68002c..558313de4911 100644 --- a/drivers/usb/core/hub.c +++ b/drivers/usb/core/hub.c | |||
@@ -4798,7 +4798,8 @@ static void hub_events(void) | |||
4798 | hub->ports[i - 1]->child; | 4798 | hub->ports[i - 1]->child; |
4799 | 4799 | ||
4800 | dev_dbg(hub_dev, "warm reset port %d\n", i); | 4800 | dev_dbg(hub_dev, "warm reset port %d\n", i); |
4801 | if (!udev) { | 4801 | if (!udev || !(portstatus & |
4802 | USB_PORT_STAT_CONNECTION)) { | ||
4802 | status = hub_port_reset(hub, i, | 4803 | status = hub_port_reset(hub, i, |
4803 | NULL, HUB_BH_RESET_TIME, | 4804 | NULL, HUB_BH_RESET_TIME, |
4804 | true); | 4805 | true); |
@@ -4808,8 +4809,8 @@ static void hub_events(void) | |||
4808 | usb_lock_device(udev); | 4809 | usb_lock_device(udev); |
4809 | status = usb_reset_device(udev); | 4810 | status = usb_reset_device(udev); |
4810 | usb_unlock_device(udev); | 4811 | usb_unlock_device(udev); |
4812 | connect_change = 0; | ||
4811 | } | 4813 | } |
4812 | connect_change = 0; | ||
4813 | } | 4814 | } |
4814 | 4815 | ||
4815 | if (connect_change) | 4816 | if (connect_change) |
diff --git a/drivers/usb/core/quirks.c b/drivers/usb/core/quirks.c index a63598895077..5b44cd47da5b 100644 --- a/drivers/usb/core/quirks.c +++ b/drivers/usb/core/quirks.c | |||
@@ -78,6 +78,12 @@ static const struct usb_device_id usb_quirk_list[] = { | |||
78 | { USB_DEVICE(0x04d8, 0x000c), .driver_info = | 78 | { USB_DEVICE(0x04d8, 0x000c), .driver_info = |
79 | USB_QUIRK_CONFIG_INTF_STRINGS }, | 79 | USB_QUIRK_CONFIG_INTF_STRINGS }, |
80 | 80 | ||
81 | /* CarrolTouch 4000U */ | ||
82 | { USB_DEVICE(0x04e7, 0x0009), .driver_info = USB_QUIRK_RESET_RESUME }, | ||
83 | |||
84 | /* CarrolTouch 4500U */ | ||
85 | { USB_DEVICE(0x04e7, 0x0030), .driver_info = USB_QUIRK_RESET_RESUME }, | ||
86 | |||
81 | /* Samsung Android phone modem - ID conflict with SPH-I500 */ | 87 | /* Samsung Android phone modem - ID conflict with SPH-I500 */ |
82 | { USB_DEVICE(0x04e8, 0x6601), .driver_info = | 88 | { USB_DEVICE(0x04e8, 0x6601), .driver_info = |
83 | USB_QUIRK_CONFIG_INTF_STRINGS }, | 89 | USB_QUIRK_CONFIG_INTF_STRINGS }, |
diff --git a/drivers/usb/host/ehci-sched.c b/drivers/usb/host/ehci-sched.c index f80d0330d548..8e3c878f38cf 100644 --- a/drivers/usb/host/ehci-sched.c +++ b/drivers/usb/host/ehci-sched.c | |||
@@ -1391,21 +1391,20 @@ iso_stream_schedule ( | |||
1391 | 1391 | ||
1392 | /* Behind the scheduling threshold? */ | 1392 | /* Behind the scheduling threshold? */ |
1393 | if (unlikely(start < next)) { | 1393 | if (unlikely(start < next)) { |
1394 | unsigned now2 = (now - base) & (mod - 1); | ||
1394 | 1395 | ||
1395 | /* USB_ISO_ASAP: Round up to the first available slot */ | 1396 | /* USB_ISO_ASAP: Round up to the first available slot */ |
1396 | if (urb->transfer_flags & URB_ISO_ASAP) | 1397 | if (urb->transfer_flags & URB_ISO_ASAP) |
1397 | start += (next - start + period - 1) & -period; | 1398 | start += (next - start + period - 1) & -period; |
1398 | 1399 | ||
1399 | /* | 1400 | /* |
1400 | * Not ASAP: Use the next slot in the stream. If | 1401 | * Not ASAP: Use the next slot in the stream, |
1401 | * the entire URB falls before the threshold, fail. | 1402 | * no matter what. |
1402 | */ | 1403 | */ |
1403 | else if (start + span - period < next) { | 1404 | else if (start + span - period < now2) { |
1404 | ehci_dbg(ehci, "iso urb late %p (%u+%u < %u)\n", | 1405 | ehci_dbg(ehci, "iso underrun %p (%u+%u < %u)\n", |
1405 | urb, start + base, | 1406 | urb, start + base, |
1406 | span - period, next + base); | 1407 | span - period, now2 + base); |
1407 | status = -EXDEV; | ||
1408 | goto fail; | ||
1409 | } | 1408 | } |
1410 | } | 1409 | } |
1411 | 1410 | ||
diff --git a/drivers/usb/host/xhci-mem.c b/drivers/usb/host/xhci-mem.c index df6978abd7e6..6f8c2fd47675 100644 --- a/drivers/usb/host/xhci-mem.c +++ b/drivers/usb/host/xhci-mem.c | |||
@@ -24,6 +24,7 @@ | |||
24 | #include <linux/pci.h> | 24 | #include <linux/pci.h> |
25 | #include <linux/slab.h> | 25 | #include <linux/slab.h> |
26 | #include <linux/dmapool.h> | 26 | #include <linux/dmapool.h> |
27 | #include <linux/dma-mapping.h> | ||
27 | 28 | ||
28 | #include "xhci.h" | 29 | #include "xhci.h" |
29 | 30 | ||
diff --git a/drivers/usb/host/xhci.c b/drivers/usb/host/xhci.c index 41eb4fc33453..9478caa2f71f 100644 --- a/drivers/usb/host/xhci.c +++ b/drivers/usb/host/xhci.c | |||
@@ -27,6 +27,7 @@ | |||
27 | #include <linux/moduleparam.h> | 27 | #include <linux/moduleparam.h> |
28 | #include <linux/slab.h> | 28 | #include <linux/slab.h> |
29 | #include <linux/dmi.h> | 29 | #include <linux/dmi.h> |
30 | #include <linux/dma-mapping.h> | ||
30 | 31 | ||
31 | #include "xhci.h" | 32 | #include "xhci.h" |
32 | 33 | ||
diff --git a/drivers/usb/misc/adutux.c b/drivers/usb/misc/adutux.c index eb3c8c142fa9..eeb27208c0d1 100644 --- a/drivers/usb/misc/adutux.c +++ b/drivers/usb/misc/adutux.c | |||
@@ -830,7 +830,7 @@ static int adu_probe(struct usb_interface *interface, | |||
830 | 830 | ||
831 | /* let the user know what node this device is now attached to */ | 831 | /* let the user know what node this device is now attached to */ |
832 | dev_info(&interface->dev, "ADU%d %s now attached to /dev/usb/adutux%d\n", | 832 | dev_info(&interface->dev, "ADU%d %s now attached to /dev/usb/adutux%d\n", |
833 | udev->descriptor.idProduct, dev->serial_number, | 833 | le16_to_cpu(udev->descriptor.idProduct), dev->serial_number, |
834 | (dev->minor - ADU_MINOR_BASE)); | 834 | (dev->minor - ADU_MINOR_BASE)); |
835 | exit: | 835 | exit: |
836 | dbg(2, " %s : leave, return value %p (dev)", __func__, dev); | 836 | dbg(2, " %s : leave, return value %p (dev)", __func__, dev); |
diff --git a/drivers/usb/serial/keyspan.c b/drivers/usb/serial/keyspan.c index 5a979729f8ec..58c17fdc85eb 100644 --- a/drivers/usb/serial/keyspan.c +++ b/drivers/usb/serial/keyspan.c | |||
@@ -2303,7 +2303,7 @@ static int keyspan_startup(struct usb_serial *serial) | |||
2303 | if (d_details == NULL) { | 2303 | if (d_details == NULL) { |
2304 | dev_err(&serial->dev->dev, "%s - unknown product id %x\n", | 2304 | dev_err(&serial->dev->dev, "%s - unknown product id %x\n", |
2305 | __func__, le16_to_cpu(serial->dev->descriptor.idProduct)); | 2305 | __func__, le16_to_cpu(serial->dev->descriptor.idProduct)); |
2306 | return 1; | 2306 | return -ENODEV; |
2307 | } | 2307 | } |
2308 | 2308 | ||
2309 | /* Setup private data for serial driver */ | 2309 | /* Setup private data for serial driver */ |
diff --git a/drivers/usb/serial/mos7720.c b/drivers/usb/serial/mos7720.c index 51da424327b0..b01300164fc0 100644 --- a/drivers/usb/serial/mos7720.c +++ b/drivers/usb/serial/mos7720.c | |||
@@ -90,6 +90,7 @@ struct urbtracker { | |||
90 | struct list_head urblist_entry; | 90 | struct list_head urblist_entry; |
91 | struct kref ref_count; | 91 | struct kref ref_count; |
92 | struct urb *urb; | 92 | struct urb *urb; |
93 | struct usb_ctrlrequest *setup; | ||
93 | }; | 94 | }; |
94 | 95 | ||
95 | enum mos7715_pp_modes { | 96 | enum mos7715_pp_modes { |
@@ -271,6 +272,7 @@ static void destroy_urbtracker(struct kref *kref) | |||
271 | struct mos7715_parport *mos_parport = urbtrack->mos_parport; | 272 | struct mos7715_parport *mos_parport = urbtrack->mos_parport; |
272 | 273 | ||
273 | usb_free_urb(urbtrack->urb); | 274 | usb_free_urb(urbtrack->urb); |
275 | kfree(urbtrack->setup); | ||
274 | kfree(urbtrack); | 276 | kfree(urbtrack); |
275 | kref_put(&mos_parport->ref_count, destroy_mos_parport); | 277 | kref_put(&mos_parport->ref_count, destroy_mos_parport); |
276 | } | 278 | } |
@@ -355,7 +357,6 @@ static int write_parport_reg_nonblock(struct mos7715_parport *mos_parport, | |||
355 | struct urbtracker *urbtrack; | 357 | struct urbtracker *urbtrack; |
356 | int ret_val; | 358 | int ret_val; |
357 | unsigned long flags; | 359 | unsigned long flags; |
358 | struct usb_ctrlrequest setup; | ||
359 | struct usb_serial *serial = mos_parport->serial; | 360 | struct usb_serial *serial = mos_parport->serial; |
360 | struct usb_device *usbdev = serial->dev; | 361 | struct usb_device *usbdev = serial->dev; |
361 | 362 | ||
@@ -373,14 +374,20 @@ static int write_parport_reg_nonblock(struct mos7715_parport *mos_parport, | |||
373 | kfree(urbtrack); | 374 | kfree(urbtrack); |
374 | return -ENOMEM; | 375 | return -ENOMEM; |
375 | } | 376 | } |
376 | setup.bRequestType = (__u8)0x40; | 377 | urbtrack->setup = kmalloc(sizeof(*urbtrack->setup), GFP_KERNEL); |
377 | setup.bRequest = (__u8)0x0e; | 378 | if (!urbtrack->setup) { |
378 | setup.wValue = get_reg_value(reg, dummy); | 379 | usb_free_urb(urbtrack->urb); |
379 | setup.wIndex = get_reg_index(reg); | 380 | kfree(urbtrack); |
380 | setup.wLength = 0; | 381 | return -ENOMEM; |
382 | } | ||
383 | urbtrack->setup->bRequestType = (__u8)0x40; | ||
384 | urbtrack->setup->bRequest = (__u8)0x0e; | ||
385 | urbtrack->setup->wValue = get_reg_value(reg, dummy); | ||
386 | urbtrack->setup->wIndex = get_reg_index(reg); | ||
387 | urbtrack->setup->wLength = 0; | ||
381 | usb_fill_control_urb(urbtrack->urb, usbdev, | 388 | usb_fill_control_urb(urbtrack->urb, usbdev, |
382 | usb_sndctrlpipe(usbdev, 0), | 389 | usb_sndctrlpipe(usbdev, 0), |
383 | (unsigned char *)&setup, | 390 | (unsigned char *)urbtrack->setup, |
384 | NULL, 0, async_complete, urbtrack); | 391 | NULL, 0, async_complete, urbtrack); |
385 | kref_init(&urbtrack->ref_count); | 392 | kref_init(&urbtrack->ref_count); |
386 | INIT_LIST_HEAD(&urbtrack->urblist_entry); | 393 | INIT_LIST_HEAD(&urbtrack->urblist_entry); |
diff --git a/drivers/usb/serial/mos7840.c b/drivers/usb/serial/mos7840.c index d953d674f222..3bac4693c038 100644 --- a/drivers/usb/serial/mos7840.c +++ b/drivers/usb/serial/mos7840.c | |||
@@ -2193,7 +2193,7 @@ static int mos7810_check(struct usb_serial *serial) | |||
2193 | static int mos7840_probe(struct usb_serial *serial, | 2193 | static int mos7840_probe(struct usb_serial *serial, |
2194 | const struct usb_device_id *id) | 2194 | const struct usb_device_id *id) |
2195 | { | 2195 | { |
2196 | u16 product = serial->dev->descriptor.idProduct; | 2196 | u16 product = le16_to_cpu(serial->dev->descriptor.idProduct); |
2197 | u8 *buf; | 2197 | u8 *buf; |
2198 | int device_type; | 2198 | int device_type; |
2199 | 2199 | ||
diff --git a/drivers/usb/serial/ti_usb_3410_5052.c b/drivers/usb/serial/ti_usb_3410_5052.c index 375b5a400b6f..5c9f9b1d7736 100644 --- a/drivers/usb/serial/ti_usb_3410_5052.c +++ b/drivers/usb/serial/ti_usb_3410_5052.c | |||
@@ -1536,14 +1536,15 @@ static int ti_download_firmware(struct ti_device *tdev) | |||
1536 | char buf[32]; | 1536 | char buf[32]; |
1537 | 1537 | ||
1538 | /* try ID specific firmware first, then try generic firmware */ | 1538 | /* try ID specific firmware first, then try generic firmware */ |
1539 | sprintf(buf, "ti_usb-v%04x-p%04x.fw", dev->descriptor.idVendor, | 1539 | sprintf(buf, "ti_usb-v%04x-p%04x.fw", |
1540 | dev->descriptor.idProduct); | 1540 | le16_to_cpu(dev->descriptor.idVendor), |
1541 | le16_to_cpu(dev->descriptor.idProduct)); | ||
1541 | status = request_firmware(&fw_p, buf, &dev->dev); | 1542 | status = request_firmware(&fw_p, buf, &dev->dev); |
1542 | 1543 | ||
1543 | if (status != 0) { | 1544 | if (status != 0) { |
1544 | buf[0] = '\0'; | 1545 | buf[0] = '\0'; |
1545 | if (dev->descriptor.idVendor == MTS_VENDOR_ID) { | 1546 | if (le16_to_cpu(dev->descriptor.idVendor) == MTS_VENDOR_ID) { |
1546 | switch (dev->descriptor.idProduct) { | 1547 | switch (le16_to_cpu(dev->descriptor.idProduct)) { |
1547 | case MTS_CDMA_PRODUCT_ID: | 1548 | case MTS_CDMA_PRODUCT_ID: |
1548 | strcpy(buf, "mts_cdma.fw"); | 1549 | strcpy(buf, "mts_cdma.fw"); |
1549 | break; | 1550 | break; |
diff --git a/drivers/usb/serial/usb_wwan.c b/drivers/usb/serial/usb_wwan.c index 8257d30c4072..85365784040b 100644 --- a/drivers/usb/serial/usb_wwan.c +++ b/drivers/usb/serial/usb_wwan.c | |||
@@ -291,18 +291,18 @@ static void usb_wwan_indat_callback(struct urb *urb) | |||
291 | tty_flip_buffer_push(&port->port); | 291 | tty_flip_buffer_push(&port->port); |
292 | } else | 292 | } else |
293 | dev_dbg(dev, "%s: empty read urb received\n", __func__); | 293 | dev_dbg(dev, "%s: empty read urb received\n", __func__); |
294 | 294 | } | |
295 | /* Resubmit urb so we continue receiving */ | 295 | /* Resubmit urb so we continue receiving */ |
296 | err = usb_submit_urb(urb, GFP_ATOMIC); | 296 | err = usb_submit_urb(urb, GFP_ATOMIC); |
297 | if (err) { | 297 | if (err) { |
298 | if (err != -EPERM) { | 298 | if (err != -EPERM) { |
299 | dev_err(dev, "%s: resubmit read urb failed. (%d)\n", __func__, err); | 299 | dev_err(dev, "%s: resubmit read urb failed. (%d)\n", |
300 | /* busy also in error unless we are killed */ | 300 | __func__, err); |
301 | usb_mark_last_busy(port->serial->dev); | 301 | /* busy also in error unless we are killed */ |
302 | } | ||
303 | } else { | ||
304 | usb_mark_last_busy(port->serial->dev); | 302 | usb_mark_last_busy(port->serial->dev); |
305 | } | 303 | } |
304 | } else { | ||
305 | usb_mark_last_busy(port->serial->dev); | ||
306 | } | 306 | } |
307 | } | 307 | } |
308 | 308 | ||
diff --git a/drivers/usb/wusbcore/wa-xfer.c b/drivers/usb/wusbcore/wa-xfer.c index 16968c899493..d3493ca0525d 100644 --- a/drivers/usb/wusbcore/wa-xfer.c +++ b/drivers/usb/wusbcore/wa-xfer.c | |||
@@ -1226,6 +1226,12 @@ int wa_urb_dequeue(struct wahc *wa, struct urb *urb) | |||
1226 | } | 1226 | } |
1227 | spin_lock_irqsave(&xfer->lock, flags); | 1227 | spin_lock_irqsave(&xfer->lock, flags); |
1228 | rpipe = xfer->ep->hcpriv; | 1228 | rpipe = xfer->ep->hcpriv; |
1229 | if (rpipe == NULL) { | ||
1230 | pr_debug("%s: xfer id 0x%08X has no RPIPE. %s", | ||
1231 | __func__, wa_xfer_id(xfer), | ||
1232 | "Probably already aborted.\n" ); | ||
1233 | goto out_unlock; | ||
1234 | } | ||
1229 | /* Check the delayed list -> if there, release and complete */ | 1235 | /* Check the delayed list -> if there, release and complete */ |
1230 | spin_lock_irqsave(&wa->xfer_list_lock, flags2); | 1236 | spin_lock_irqsave(&wa->xfer_list_lock, flags2); |
1231 | if (!list_empty(&xfer->list_node) && xfer->seg == NULL) | 1237 | if (!list_empty(&xfer->list_node) && xfer->seg == NULL) |
@@ -1644,8 +1650,7 @@ static void wa_xfer_result_cb(struct urb *urb) | |||
1644 | break; | 1650 | break; |
1645 | } | 1651 | } |
1646 | usb_status = xfer_result->bTransferStatus & 0x3f; | 1652 | usb_status = xfer_result->bTransferStatus & 0x3f; |
1647 | if (usb_status == WA_XFER_STATUS_ABORTED | 1653 | if (usb_status == WA_XFER_STATUS_NOT_FOUND) |
1648 | || usb_status == WA_XFER_STATUS_NOT_FOUND) | ||
1649 | /* taken care of already */ | 1654 | /* taken care of already */ |
1650 | break; | 1655 | break; |
1651 | xfer_id = xfer_result->dwTransferID; | 1656 | xfer_id = xfer_result->dwTransferID; |
diff --git a/drivers/video/mxsfb.c b/drivers/video/mxsfb.c index 3ba37713b1f9..dc09ebe4aba5 100644 --- a/drivers/video/mxsfb.c +++ b/drivers/video/mxsfb.c | |||
@@ -239,24 +239,6 @@ static const struct fb_bitfield def_rgb565[] = { | |||
239 | } | 239 | } |
240 | }; | 240 | }; |
241 | 241 | ||
242 | static const struct fb_bitfield def_rgb666[] = { | ||
243 | [RED] = { | ||
244 | .offset = 16, | ||
245 | .length = 6, | ||
246 | }, | ||
247 | [GREEN] = { | ||
248 | .offset = 8, | ||
249 | .length = 6, | ||
250 | }, | ||
251 | [BLUE] = { | ||
252 | .offset = 0, | ||
253 | .length = 6, | ||
254 | }, | ||
255 | [TRANSP] = { /* no support for transparency */ | ||
256 | .length = 0, | ||
257 | } | ||
258 | }; | ||
259 | |||
260 | static const struct fb_bitfield def_rgb888[] = { | 242 | static const struct fb_bitfield def_rgb888[] = { |
261 | [RED] = { | 243 | [RED] = { |
262 | .offset = 16, | 244 | .offset = 16, |
@@ -309,9 +291,6 @@ static int mxsfb_check_var(struct fb_var_screeninfo *var, | |||
309 | break; | 291 | break; |
310 | case STMLCDIF_16BIT: | 292 | case STMLCDIF_16BIT: |
311 | case STMLCDIF_18BIT: | 293 | case STMLCDIF_18BIT: |
312 | /* 24 bit to 18 bit mapping */ | ||
313 | rgb = def_rgb666; | ||
314 | break; | ||
315 | case STMLCDIF_24BIT: | 294 | case STMLCDIF_24BIT: |
316 | /* real 24 bit */ | 295 | /* real 24 bit */ |
317 | rgb = def_rgb888; | 296 | rgb = def_rgb888; |
@@ -453,11 +432,6 @@ static int mxsfb_set_par(struct fb_info *fb_info) | |||
453 | return -EINVAL; | 432 | return -EINVAL; |
454 | case STMLCDIF_16BIT: | 433 | case STMLCDIF_16BIT: |
455 | case STMLCDIF_18BIT: | 434 | case STMLCDIF_18BIT: |
456 | /* 24 bit to 18 bit mapping */ | ||
457 | ctrl |= CTRL_DF24; /* ignore the upper 2 bits in | ||
458 | * each colour component | ||
459 | */ | ||
460 | break; | ||
461 | case STMLCDIF_24BIT: | 435 | case STMLCDIF_24BIT: |
462 | /* real 24 bit */ | 436 | /* real 24 bit */ |
463 | break; | 437 | break; |
diff --git a/drivers/video/omap2/displays-new/connector-analog-tv.c b/drivers/video/omap2/displays-new/connector-analog-tv.c index 5338f362293b..1b60698f141e 100644 --- a/drivers/video/omap2/displays-new/connector-analog-tv.c +++ b/drivers/video/omap2/displays-new/connector-analog-tv.c | |||
@@ -28,6 +28,20 @@ struct panel_drv_data { | |||
28 | bool invert_polarity; | 28 | bool invert_polarity; |
29 | }; | 29 | }; |
30 | 30 | ||
31 | static const struct omap_video_timings tvc_pal_timings = { | ||
32 | .x_res = 720, | ||
33 | .y_res = 574, | ||
34 | .pixel_clock = 13500, | ||
35 | .hsw = 64, | ||
36 | .hfp = 12, | ||
37 | .hbp = 68, | ||
38 | .vsw = 5, | ||
39 | .vfp = 5, | ||
40 | .vbp = 41, | ||
41 | |||
42 | .interlace = true, | ||
43 | }; | ||
44 | |||
31 | #define to_panel_data(x) container_of(x, struct panel_drv_data, dssdev) | 45 | #define to_panel_data(x) container_of(x, struct panel_drv_data, dssdev) |
32 | 46 | ||
33 | static int tvc_connect(struct omap_dss_device *dssdev) | 47 | static int tvc_connect(struct omap_dss_device *dssdev) |
@@ -212,14 +226,14 @@ static int tvc_probe(struct platform_device *pdev) | |||
212 | return -ENODEV; | 226 | return -ENODEV; |
213 | } | 227 | } |
214 | 228 | ||
215 | ddata->timings = omap_dss_pal_timings; | 229 | ddata->timings = tvc_pal_timings; |
216 | 230 | ||
217 | dssdev = &ddata->dssdev; | 231 | dssdev = &ddata->dssdev; |
218 | dssdev->driver = &tvc_driver; | 232 | dssdev->driver = &tvc_driver; |
219 | dssdev->dev = &pdev->dev; | 233 | dssdev->dev = &pdev->dev; |
220 | dssdev->type = OMAP_DISPLAY_TYPE_VENC; | 234 | dssdev->type = OMAP_DISPLAY_TYPE_VENC; |
221 | dssdev->owner = THIS_MODULE; | 235 | dssdev->owner = THIS_MODULE; |
222 | dssdev->panel.timings = omap_dss_pal_timings; | 236 | dssdev->panel.timings = tvc_pal_timings; |
223 | 237 | ||
224 | r = omapdss_register_display(dssdev); | 238 | r = omapdss_register_display(dssdev); |
225 | if (r) { | 239 | if (r) { |