diff options
Diffstat (limited to 'drivers')
206 files changed, 5023 insertions, 1420 deletions
diff --git a/drivers/amba/bus.c b/drivers/amba/bus.c index 3d763fdf99b..24665067301 100644 --- a/drivers/amba/bus.c +++ b/drivers/amba/bus.c | |||
@@ -207,6 +207,16 @@ int amba_device_register(struct amba_device *dev, struct resource *parent) | |||
207 | void __iomem *tmp; | 207 | void __iomem *tmp; |
208 | int i, ret; | 208 | int i, ret; |
209 | 209 | ||
210 | device_initialize(&dev->dev); | ||
211 | |||
212 | /* | ||
213 | * Copy from device_add | ||
214 | */ | ||
215 | if (dev->dev.init_name) { | ||
216 | dev_set_name(&dev->dev, "%s", dev->dev.init_name); | ||
217 | dev->dev.init_name = NULL; | ||
218 | } | ||
219 | |||
210 | dev->dev.release = amba_device_release; | 220 | dev->dev.release = amba_device_release; |
211 | dev->dev.bus = &amba_bustype; | 221 | dev->dev.bus = &amba_bustype; |
212 | dev->dev.dma_mask = &dev->dma_mask; | 222 | dev->dev.dma_mask = &dev->dma_mask; |
@@ -240,7 +250,7 @@ int amba_device_register(struct amba_device *dev, struct resource *parent) | |||
240 | goto err_release; | 250 | goto err_release; |
241 | } | 251 | } |
242 | 252 | ||
243 | ret = device_register(&dev->dev); | 253 | ret = device_add(&dev->dev); |
244 | if (ret) | 254 | if (ret) |
245 | goto err_release; | 255 | goto err_release; |
246 | 256 | ||
diff --git a/drivers/base/firmware_class.c b/drivers/base/firmware_class.c index ddeb819c8f8..fc466531260 100644 --- a/drivers/base/firmware_class.c +++ b/drivers/base/firmware_class.c | |||
@@ -357,7 +357,7 @@ static void fw_dev_release(struct device *dev) | |||
357 | kfree(fw_priv->pages); | 357 | kfree(fw_priv->pages); |
358 | kfree(fw_priv->fw_id); | 358 | kfree(fw_priv->fw_id); |
359 | kfree(fw_priv); | 359 | kfree(fw_priv); |
360 | put_device(dev); | 360 | kfree(dev); |
361 | 361 | ||
362 | module_put(THIS_MODULE); | 362 | module_put(THIS_MODULE); |
363 | } | 363 | } |
@@ -408,13 +408,11 @@ static int fw_register_device(struct device **dev_p, const char *fw_name, | |||
408 | if (retval) { | 408 | if (retval) { |
409 | dev_err(device, "%s: device_register failed\n", __func__); | 409 | dev_err(device, "%s: device_register failed\n", __func__); |
410 | put_device(f_dev); | 410 | put_device(f_dev); |
411 | goto error_kfree_fw_id; | 411 | return retval; |
412 | } | 412 | } |
413 | *dev_p = f_dev; | 413 | *dev_p = f_dev; |
414 | return 0; | 414 | return 0; |
415 | 415 | ||
416 | error_kfree_fw_id: | ||
417 | kfree(fw_priv->fw_id); | ||
418 | error_kfree: | 416 | error_kfree: |
419 | kfree(f_dev); | 417 | kfree(f_dev); |
420 | kfree(fw_priv); | 418 | kfree(fw_priv); |
diff --git a/drivers/base/power/main.c b/drivers/base/power/main.c index fae72545898..58a3e572f2c 100644 --- a/drivers/base/power/main.c +++ b/drivers/base/power/main.c | |||
@@ -762,6 +762,7 @@ static int dpm_prepare(pm_message_t state) | |||
762 | dev->power.status = DPM_ON; | 762 | dev->power.status = DPM_ON; |
763 | if (error == -EAGAIN) { | 763 | if (error == -EAGAIN) { |
764 | put_device(dev); | 764 | put_device(dev); |
765 | error = 0; | ||
765 | continue; | 766 | continue; |
766 | } | 767 | } |
767 | printk(KERN_ERR "PM: Failed to prepare device %s " | 768 | printk(KERN_ERR "PM: Failed to prepare device %s " |
diff --git a/drivers/block/Kconfig b/drivers/block/Kconfig index bb72ada9f07..1d886e079c5 100644 --- a/drivers/block/Kconfig +++ b/drivers/block/Kconfig | |||
@@ -298,6 +298,22 @@ config BLK_DEV_NBD | |||
298 | 298 | ||
299 | If unsure, say N. | 299 | If unsure, say N. |
300 | 300 | ||
301 | config BLK_DEV_OSD | ||
302 | tristate "OSD object-as-blkdev support" | ||
303 | depends on SCSI_OSD_ULD | ||
304 | ---help--- | ||
305 | Saying Y or M here will allow the exporting of a single SCSI | ||
306 | OSD (object-based storage) object as a Linux block device. | ||
307 | |||
308 | For example, if you create a 2G object on an OSD device, | ||
309 | you can then use this module to present that 2G object as | ||
310 | a Linux block device. | ||
311 | |||
312 | To compile this driver as a module, choose M here: the | ||
313 | module will be called osdblk. | ||
314 | |||
315 | If unsure, say N. | ||
316 | |||
301 | config BLK_DEV_SX8 | 317 | config BLK_DEV_SX8 |
302 | tristate "Promise SATA SX8 support" | 318 | tristate "Promise SATA SX8 support" |
303 | depends on PCI | 319 | depends on PCI |
diff --git a/drivers/block/Makefile b/drivers/block/Makefile index 7755a5e2a85..cdaa3f8fddf 100644 --- a/drivers/block/Makefile +++ b/drivers/block/Makefile | |||
@@ -23,6 +23,7 @@ obj-$(CONFIG_XILINX_SYSACE) += xsysace.o | |||
23 | obj-$(CONFIG_CDROM_PKTCDVD) += pktcdvd.o | 23 | obj-$(CONFIG_CDROM_PKTCDVD) += pktcdvd.o |
24 | obj-$(CONFIG_MG_DISK) += mg_disk.o | 24 | obj-$(CONFIG_MG_DISK) += mg_disk.o |
25 | obj-$(CONFIG_SUNVDC) += sunvdc.o | 25 | obj-$(CONFIG_SUNVDC) += sunvdc.o |
26 | obj-$(CONFIG_BLK_DEV_OSD) += osdblk.o | ||
26 | 27 | ||
27 | obj-$(CONFIG_BLK_DEV_UMEM) += umem.o | 28 | obj-$(CONFIG_BLK_DEV_UMEM) += umem.o |
28 | obj-$(CONFIG_BLK_DEV_NBD) += nbd.o | 29 | obj-$(CONFIG_BLK_DEV_NBD) += nbd.o |
diff --git a/drivers/block/amiflop.c b/drivers/block/amiflop.c index 9c6e5b0fe89..2f07b7c99a9 100644 --- a/drivers/block/amiflop.c +++ b/drivers/block/amiflop.c | |||
@@ -1645,7 +1645,7 @@ static int __init fd_probe_drives(void) | |||
1645 | { | 1645 | { |
1646 | int drive,drives,nomem; | 1646 | int drive,drives,nomem; |
1647 | 1647 | ||
1648 | printk(KERN_INFO "FD: probing units\n" KERN_INFO "found "); | 1648 | printk(KERN_INFO "FD: probing units\nfound "); |
1649 | drives=0; | 1649 | drives=0; |
1650 | nomem=0; | 1650 | nomem=0; |
1651 | for(drive=0;drive<FD_MAX_UNITS;drive++) { | 1651 | for(drive=0;drive<FD_MAX_UNITS;drive++) { |
diff --git a/drivers/block/osdblk.c b/drivers/block/osdblk.c new file mode 100644 index 00000000000..13c1aee6aa3 --- /dev/null +++ b/drivers/block/osdblk.c | |||
@@ -0,0 +1,701 @@ | |||
1 | |||
2 | /* | ||
3 | osdblk.c -- Export a single SCSI OSD object as a Linux block device | ||
4 | |||
5 | |||
6 | Copyright 2009 Red Hat, Inc. | ||
7 | |||
8 | This program is free software; you can redistribute it and/or modify | ||
9 | it under the terms of the GNU General Public License as published by | ||
10 | the Free Software Foundation. | ||
11 | |||
12 | This program is distributed in the hope that it will be useful, | ||
13 | but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
14 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
15 | GNU General Public License for more details. | ||
16 | |||
17 | You should have received a copy of the GNU General Public License | ||
18 | along with this program; see the file COPYING. If not, write to | ||
19 | the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. | ||
20 | |||
21 | |||
22 | Instructions for use | ||
23 | -------------------- | ||
24 | |||
25 | 1) Map a Linux block device to an existing OSD object. | ||
26 | |||
27 | In this example, we will use partition id 1234, object id 5678, | ||
28 | OSD device /dev/osd1. | ||
29 | |||
30 | $ echo "1234 5678 /dev/osd1" > /sys/class/osdblk/add | ||
31 | |||
32 | |||
33 | 2) List all active blkdev<->object mappings. | ||
34 | |||
35 | In this example, we have performed step #1 twice, creating two blkdevs, | ||
36 | mapped to two separate OSD objects. | ||
37 | |||
38 | $ cat /sys/class/osdblk/list | ||
39 | 0 174 1234 5678 /dev/osd1 | ||
40 | 1 179 1994 897123 /dev/osd0 | ||
41 | |||
42 | The columns, in order, are: | ||
43 | - blkdev unique id | ||
44 | - blkdev assigned major | ||
45 | - OSD object partition id | ||
46 | - OSD object id | ||
47 | - OSD device | ||
48 | |||
49 | |||
50 | 3) Remove an active blkdev<->object mapping. | ||
51 | |||
52 | In this example, we remove the mapping with blkdev unique id 1. | ||
53 | |||
54 | $ echo 1 > /sys/class/osdblk/remove | ||
55 | |||
56 | |||
57 | NOTE: The actual creation and deletion of OSD objects is outside the scope | ||
58 | of this driver. | ||
59 | |||
60 | */ | ||
61 | |||
62 | #include <linux/kernel.h> | ||
63 | #include <linux/device.h> | ||
64 | #include <linux/module.h> | ||
65 | #include <linux/fs.h> | ||
66 | #include <scsi/osd_initiator.h> | ||
67 | #include <scsi/osd_attributes.h> | ||
68 | #include <scsi/osd_sec.h> | ||
69 | #include <scsi/scsi_device.h> | ||
70 | |||
71 | #define DRV_NAME "osdblk" | ||
72 | #define PFX DRV_NAME ": " | ||
73 | |||
74 | /* #define _OSDBLK_DEBUG */ | ||
75 | #ifdef _OSDBLK_DEBUG | ||
76 | #define OSDBLK_DEBUG(fmt, a...) \ | ||
77 | printk(KERN_NOTICE "osdblk @%s:%d: " fmt, __func__, __LINE__, ##a) | ||
78 | #else | ||
79 | #define OSDBLK_DEBUG(fmt, a...) \ | ||
80 | do { if (0) printk(fmt, ##a); } while (0) | ||
81 | #endif | ||
82 | |||
83 | MODULE_AUTHOR("Jeff Garzik <jeff@garzik.org>"); | ||
84 | MODULE_DESCRIPTION("block device inside an OSD object osdblk.ko"); | ||
85 | MODULE_LICENSE("GPL"); | ||
86 | |||
87 | struct osdblk_device; | ||
88 | |||
89 | enum { | ||
90 | OSDBLK_MINORS_PER_MAJOR = 256, /* max minors per blkdev */ | ||
91 | OSDBLK_MAX_REQ = 32, /* max parallel requests */ | ||
92 | OSDBLK_OP_TIMEOUT = 4 * 60, /* sync OSD req timeout */ | ||
93 | }; | ||
94 | |||
95 | struct osdblk_request { | ||
96 | struct request *rq; /* blk layer request */ | ||
97 | struct bio *bio; /* cloned bio */ | ||
98 | struct osdblk_device *osdev; /* associated blkdev */ | ||
99 | }; | ||
100 | |||
101 | struct osdblk_device { | ||
102 | int id; /* blkdev unique id */ | ||
103 | |||
104 | int major; /* blkdev assigned major */ | ||
105 | struct gendisk *disk; /* blkdev's gendisk and rq */ | ||
106 | struct request_queue *q; | ||
107 | |||
108 | struct osd_dev *osd; /* associated OSD */ | ||
109 | |||
110 | char name[32]; /* blkdev name, e.g. osdblk34 */ | ||
111 | |||
112 | spinlock_t lock; /* queue lock */ | ||
113 | |||
114 | struct osd_obj_id obj; /* OSD partition, obj id */ | ||
115 | uint8_t obj_cred[OSD_CAP_LEN]; /* OSD cred */ | ||
116 | |||
117 | struct osdblk_request req[OSDBLK_MAX_REQ]; /* request table */ | ||
118 | |||
119 | struct list_head node; | ||
120 | |||
121 | char osd_path[0]; /* OSD device path */ | ||
122 | }; | ||
123 | |||
124 | static struct class *class_osdblk; /* /sys/class/osdblk */ | ||
125 | static DEFINE_MUTEX(ctl_mutex); /* Serialize open/close/setup/teardown */ | ||
126 | static LIST_HEAD(osdblkdev_list); | ||
127 | |||
128 | static struct block_device_operations osdblk_bd_ops = { | ||
129 | .owner = THIS_MODULE, | ||
130 | }; | ||
131 | |||
132 | static const struct osd_attr g_attr_logical_length = ATTR_DEF( | ||
133 | OSD_APAGE_OBJECT_INFORMATION, OSD_ATTR_OI_LOGICAL_LENGTH, 8); | ||
134 | |||
135 | static void osdblk_make_credential(u8 cred_a[OSD_CAP_LEN], | ||
136 | const struct osd_obj_id *obj) | ||
137 | { | ||
138 | osd_sec_init_nosec_doall_caps(cred_a, obj, false, true); | ||
139 | } | ||
140 | |||
141 | /* copied from exofs; move to libosd? */ | ||
142 | /* | ||
143 | * Perform a synchronous OSD operation. copied from exofs; move to libosd? | ||
144 | */ | ||
145 | static int osd_sync_op(struct osd_request *or, int timeout, uint8_t *credential) | ||
146 | { | ||
147 | int ret; | ||
148 | |||
149 | or->timeout = timeout; | ||
150 | ret = osd_finalize_request(or, 0, credential, NULL); | ||
151 | if (ret) | ||
152 | return ret; | ||
153 | |||
154 | ret = osd_execute_request(or); | ||
155 | |||
156 | /* osd_req_decode_sense(or, ret); */ | ||
157 | return ret; | ||
158 | } | ||
159 | |||
160 | /* | ||
161 | * Perform an asynchronous OSD operation. copied from exofs; move to libosd? | ||
162 | */ | ||
163 | static int osd_async_op(struct osd_request *or, osd_req_done_fn *async_done, | ||
164 | void *caller_context, u8 *cred) | ||
165 | { | ||
166 | int ret; | ||
167 | |||
168 | ret = osd_finalize_request(or, 0, cred, NULL); | ||
169 | if (ret) | ||
170 | return ret; | ||
171 | |||
172 | ret = osd_execute_request_async(or, async_done, caller_context); | ||
173 | |||
174 | return ret; | ||
175 | } | ||
176 | |||
177 | /* copied from exofs; move to libosd? */ | ||
178 | static int extract_attr_from_req(struct osd_request *or, struct osd_attr *attr) | ||
179 | { | ||
180 | struct osd_attr cur_attr = {.attr_page = 0}; /* start with zeros */ | ||
181 | void *iter = NULL; | ||
182 | int nelem; | ||
183 | |||
184 | do { | ||
185 | nelem = 1; | ||
186 | osd_req_decode_get_attr_list(or, &cur_attr, &nelem, &iter); | ||
187 | if ((cur_attr.attr_page == attr->attr_page) && | ||
188 | (cur_attr.attr_id == attr->attr_id)) { | ||
189 | attr->len = cur_attr.len; | ||
190 | attr->val_ptr = cur_attr.val_ptr; | ||
191 | return 0; | ||
192 | } | ||
193 | } while (iter); | ||
194 | |||
195 | return -EIO; | ||
196 | } | ||
197 | |||
198 | static int osdblk_get_obj_size(struct osdblk_device *osdev, u64 *size_out) | ||
199 | { | ||
200 | struct osd_request *or; | ||
201 | struct osd_attr attr; | ||
202 | int ret; | ||
203 | |||
204 | /* start request */ | ||
205 | or = osd_start_request(osdev->osd, GFP_KERNEL); | ||
206 | if (!or) | ||
207 | return -ENOMEM; | ||
208 | |||
209 | /* create a get-attributes(length) request */ | ||
210 | osd_req_get_attributes(or, &osdev->obj); | ||
211 | |||
212 | osd_req_add_get_attr_list(or, &g_attr_logical_length, 1); | ||
213 | |||
214 | /* execute op synchronously */ | ||
215 | ret = osd_sync_op(or, OSDBLK_OP_TIMEOUT, osdev->obj_cred); | ||
216 | if (ret) | ||
217 | goto out; | ||
218 | |||
219 | /* extract length from returned attribute info */ | ||
220 | attr = g_attr_logical_length; | ||
221 | ret = extract_attr_from_req(or, &attr); | ||
222 | if (ret) | ||
223 | goto out; | ||
224 | |||
225 | *size_out = get_unaligned_be64(attr.val_ptr); | ||
226 | |||
227 | out: | ||
228 | osd_end_request(or); | ||
229 | return ret; | ||
230 | |||
231 | } | ||
232 | |||
233 | static void osdblk_osd_complete(struct osd_request *or, void *private) | ||
234 | { | ||
235 | struct osdblk_request *orq = private; | ||
236 | struct osd_sense_info osi; | ||
237 | int ret = osd_req_decode_sense(or, &osi); | ||
238 | |||
239 | if (ret) { | ||
240 | ret = -EIO; | ||
241 | OSDBLK_DEBUG("osdblk_osd_complete with err=%d\n", ret); | ||
242 | } | ||
243 | |||
244 | /* complete OSD request */ | ||
245 | osd_end_request(or); | ||
246 | |||
247 | /* complete request passed to osdblk by block layer */ | ||
248 | __blk_end_request_all(orq->rq, ret); | ||
249 | } | ||
250 | |||
251 | static void bio_chain_put(struct bio *chain) | ||
252 | { | ||
253 | struct bio *tmp; | ||
254 | |||
255 | while (chain) { | ||
256 | tmp = chain; | ||
257 | chain = chain->bi_next; | ||
258 | |||
259 | bio_put(tmp); | ||
260 | } | ||
261 | } | ||
262 | |||
263 | static struct bio *bio_chain_clone(struct bio *old_chain, gfp_t gfpmask) | ||
264 | { | ||
265 | struct bio *tmp, *new_chain = NULL, *tail = NULL; | ||
266 | |||
267 | while (old_chain) { | ||
268 | tmp = bio_kmalloc(gfpmask, old_chain->bi_max_vecs); | ||
269 | if (!tmp) | ||
270 | goto err_out; | ||
271 | |||
272 | __bio_clone(tmp, old_chain); | ||
273 | tmp->bi_bdev = NULL; | ||
274 | gfpmask &= ~__GFP_WAIT; | ||
275 | tmp->bi_next = NULL; | ||
276 | |||
277 | if (!new_chain) | ||
278 | new_chain = tail = tmp; | ||
279 | else { | ||
280 | tail->bi_next = tmp; | ||
281 | tail = tmp; | ||
282 | } | ||
283 | |||
284 | old_chain = old_chain->bi_next; | ||
285 | } | ||
286 | |||
287 | return new_chain; | ||
288 | |||
289 | err_out: | ||
290 | OSDBLK_DEBUG("bio_chain_clone with err\n"); | ||
291 | bio_chain_put(new_chain); | ||
292 | return NULL; | ||
293 | } | ||
294 | |||
295 | static void osdblk_rq_fn(struct request_queue *q) | ||
296 | { | ||
297 | struct osdblk_device *osdev = q->queuedata; | ||
298 | |||
299 | while (1) { | ||
300 | struct request *rq; | ||
301 | struct osdblk_request *orq; | ||
302 | struct osd_request *or; | ||
303 | struct bio *bio; | ||
304 | bool do_write, do_flush; | ||
305 | |||
306 | /* peek at request from block layer */ | ||
307 | rq = blk_fetch_request(q); | ||
308 | if (!rq) | ||
309 | break; | ||
310 | |||
311 | /* filter out block requests we don't understand */ | ||
312 | if (!blk_fs_request(rq) && !blk_barrier_rq(rq)) { | ||
313 | blk_end_request_all(rq, 0); | ||
314 | continue; | ||
315 | } | ||
316 | |||
317 | /* deduce our operation (read, write, flush) */ | ||
318 | /* I wish the block layer simplified cmd_type/cmd_flags/cmd[] | ||
319 | * into a clearly defined set of RPC commands: | ||
320 | * read, write, flush, scsi command, power mgmt req, | ||
321 | * driver-specific, etc. | ||
322 | */ | ||
323 | |||
324 | do_flush = (rq->special == (void *) 0xdeadbeefUL); | ||
325 | do_write = (rq_data_dir(rq) == WRITE); | ||
326 | |||
327 | if (!do_flush) { /* osd_flush does not use a bio */ | ||
328 | /* a bio clone to be passed down to OSD request */ | ||
329 | bio = bio_chain_clone(rq->bio, GFP_ATOMIC); | ||
330 | if (!bio) | ||
331 | break; | ||
332 | } else | ||
333 | bio = NULL; | ||
334 | |||
335 | /* alloc internal OSD request, for OSD command execution */ | ||
336 | or = osd_start_request(osdev->osd, GFP_ATOMIC); | ||
337 | if (!or) { | ||
338 | bio_chain_put(bio); | ||
339 | OSDBLK_DEBUG("osd_start_request with err\n"); | ||
340 | break; | ||
341 | } | ||
342 | |||
343 | orq = &osdev->req[rq->tag]; | ||
344 | orq->rq = rq; | ||
345 | orq->bio = bio; | ||
346 | orq->osdev = osdev; | ||
347 | |||
348 | /* init OSD command: flush, write or read */ | ||
349 | if (do_flush) | ||
350 | osd_req_flush_object(or, &osdev->obj, | ||
351 | OSD_CDB_FLUSH_ALL, 0, 0); | ||
352 | else if (do_write) | ||
353 | osd_req_write(or, &osdev->obj, blk_rq_pos(rq) * 512ULL, | ||
354 | bio, blk_rq_bytes(rq)); | ||
355 | else | ||
356 | osd_req_read(or, &osdev->obj, blk_rq_pos(rq) * 512ULL, | ||
357 | bio, blk_rq_bytes(rq)); | ||
358 | |||
359 | OSDBLK_DEBUG("%s 0x%x bytes at 0x%llx\n", | ||
360 | do_flush ? "flush" : do_write ? | ||
361 | "write" : "read", blk_rq_bytes(rq), | ||
362 | blk_rq_pos(rq) * 512ULL); | ||
363 | |||
364 | /* begin OSD command execution */ | ||
365 | if (osd_async_op(or, osdblk_osd_complete, orq, | ||
366 | osdev->obj_cred)) { | ||
367 | osd_end_request(or); | ||
368 | blk_requeue_request(q, rq); | ||
369 | bio_chain_put(bio); | ||
370 | OSDBLK_DEBUG("osd_execute_request_async with err\n"); | ||
371 | break; | ||
372 | } | ||
373 | |||
374 | /* remove the special 'flush' marker, now that the command | ||
375 | * is executing | ||
376 | */ | ||
377 | rq->special = NULL; | ||
378 | } | ||
379 | } | ||
380 | |||
381 | static void osdblk_prepare_flush(struct request_queue *q, struct request *rq) | ||
382 | { | ||
383 | /* add driver-specific marker, to indicate that this request | ||
384 | * is a flush command | ||
385 | */ | ||
386 | rq->special = (void *) 0xdeadbeefUL; | ||
387 | } | ||
388 | |||
389 | static void osdblk_free_disk(struct osdblk_device *osdev) | ||
390 | { | ||
391 | struct gendisk *disk = osdev->disk; | ||
392 | |||
393 | if (!disk) | ||
394 | return; | ||
395 | |||
396 | if (disk->flags & GENHD_FL_UP) | ||
397 | del_gendisk(disk); | ||
398 | if (disk->queue) | ||
399 | blk_cleanup_queue(disk->queue); | ||
400 | put_disk(disk); | ||
401 | } | ||
402 | |||
403 | static int osdblk_init_disk(struct osdblk_device *osdev) | ||
404 | { | ||
405 | struct gendisk *disk; | ||
406 | struct request_queue *q; | ||
407 | int rc; | ||
408 | u64 obj_size = 0; | ||
409 | |||
410 | /* contact OSD, request size info about the object being mapped */ | ||
411 | rc = osdblk_get_obj_size(osdev, &obj_size); | ||
412 | if (rc) | ||
413 | return rc; | ||
414 | |||
415 | /* create gendisk info */ | ||
416 | disk = alloc_disk(OSDBLK_MINORS_PER_MAJOR); | ||
417 | if (!disk) | ||
418 | return -ENOMEM; | ||
419 | |||
420 | sprintf(disk->disk_name, DRV_NAME "%d", osdev->id); | ||
421 | disk->major = osdev->major; | ||
422 | disk->first_minor = 0; | ||
423 | disk->fops = &osdblk_bd_ops; | ||
424 | disk->private_data = osdev; | ||
425 | |||
426 | /* init rq */ | ||
427 | q = blk_init_queue(osdblk_rq_fn, &osdev->lock); | ||
428 | if (!q) { | ||
429 | put_disk(disk); | ||
430 | return -ENOMEM; | ||
431 | } | ||
432 | |||
433 | /* switch queue to TCQ mode; allocate tag map */ | ||
434 | rc = blk_queue_init_tags(q, OSDBLK_MAX_REQ, NULL); | ||
435 | if (rc) { | ||
436 | blk_cleanup_queue(q); | ||
437 | put_disk(disk); | ||
438 | return rc; | ||
439 | } | ||
440 | |||
441 | /* Set our limits to the lower device limits, because osdblk cannot | ||
442 | * sleep when allocating a lower-request and therefore cannot be | ||
443 | * bouncing. | ||
444 | */ | ||
445 | blk_queue_stack_limits(q, osd_request_queue(osdev->osd)); | ||
446 | |||
447 | blk_queue_prep_rq(q, blk_queue_start_tag); | ||
448 | blk_queue_ordered(q, QUEUE_ORDERED_DRAIN_FLUSH, osdblk_prepare_flush); | ||
449 | |||
450 | disk->queue = q; | ||
451 | |||
452 | q->queuedata = osdev; | ||
453 | |||
454 | osdev->disk = disk; | ||
455 | osdev->q = q; | ||
456 | |||
457 | /* finally, announce the disk to the world */ | ||
458 | set_capacity(disk, obj_size / 512ULL); | ||
459 | add_disk(disk); | ||
460 | |||
461 | printk(KERN_INFO "%s: Added of size 0x%llx\n", | ||
462 | disk->disk_name, (unsigned long long)obj_size); | ||
463 | |||
464 | return 0; | ||
465 | } | ||
466 | |||
467 | /******************************************************************** | ||
468 | * /sys/class/osdblk/ | ||
469 | * add map OSD object to blkdev | ||
470 | * remove unmap OSD object | ||
471 | * list show mappings | ||
472 | *******************************************************************/ | ||
473 | |||
474 | static void class_osdblk_release(struct class *cls) | ||
475 | { | ||
476 | kfree(cls); | ||
477 | } | ||
478 | |||
479 | static ssize_t class_osdblk_list(struct class *c, char *data) | ||
480 | { | ||
481 | int n = 0; | ||
482 | struct list_head *tmp; | ||
483 | |||
484 | mutex_lock_nested(&ctl_mutex, SINGLE_DEPTH_NESTING); | ||
485 | |||
486 | list_for_each(tmp, &osdblkdev_list) { | ||
487 | struct osdblk_device *osdev; | ||
488 | |||
489 | osdev = list_entry(tmp, struct osdblk_device, node); | ||
490 | |||
491 | n += sprintf(data+n, "%d %d %llu %llu %s\n", | ||
492 | osdev->id, | ||
493 | osdev->major, | ||
494 | osdev->obj.partition, | ||
495 | osdev->obj.id, | ||
496 | osdev->osd_path); | ||
497 | } | ||
498 | |||
499 | mutex_unlock(&ctl_mutex); | ||
500 | return n; | ||
501 | } | ||
502 | |||
503 | static ssize_t class_osdblk_add(struct class *c, const char *buf, size_t count) | ||
504 | { | ||
505 | struct osdblk_device *osdev; | ||
506 | ssize_t rc; | ||
507 | int irc, new_id = 0; | ||
508 | struct list_head *tmp; | ||
509 | |||
510 | if (!try_module_get(THIS_MODULE)) | ||
511 | return -ENODEV; | ||
512 | |||
513 | /* new osdblk_device object */ | ||
514 | osdev = kzalloc(sizeof(*osdev) + strlen(buf) + 1, GFP_KERNEL); | ||
515 | if (!osdev) { | ||
516 | rc = -ENOMEM; | ||
517 | goto err_out_mod; | ||
518 | } | ||
519 | |||
520 | /* static osdblk_device initialization */ | ||
521 | spin_lock_init(&osdev->lock); | ||
522 | INIT_LIST_HEAD(&osdev->node); | ||
523 | |||
524 | /* generate unique id: find highest unique id, add one */ | ||
525 | |||
526 | mutex_lock_nested(&ctl_mutex, SINGLE_DEPTH_NESTING); | ||
527 | |||
528 | list_for_each(tmp, &osdblkdev_list) { | ||
529 | struct osdblk_device *osdev; | ||
530 | |||
531 | osdev = list_entry(tmp, struct osdblk_device, node); | ||
532 | if (osdev->id > new_id) | ||
533 | new_id = osdev->id + 1; | ||
534 | } | ||
535 | |||
536 | osdev->id = new_id; | ||
537 | |||
538 | /* add to global list */ | ||
539 | list_add_tail(&osdev->node, &osdblkdev_list); | ||
540 | |||
541 | mutex_unlock(&ctl_mutex); | ||
542 | |||
543 | /* parse add command */ | ||
544 | if (sscanf(buf, "%llu %llu %s", &osdev->obj.partition, &osdev->obj.id, | ||
545 | osdev->osd_path) != 3) { | ||
546 | rc = -EINVAL; | ||
547 | goto err_out_slot; | ||
548 | } | ||
549 | |||
550 | /* initialize rest of new object */ | ||
551 | sprintf(osdev->name, DRV_NAME "%d", osdev->id); | ||
552 | |||
553 | /* contact requested OSD */ | ||
554 | osdev->osd = osduld_path_lookup(osdev->osd_path); | ||
555 | if (IS_ERR(osdev->osd)) { | ||
556 | rc = PTR_ERR(osdev->osd); | ||
557 | goto err_out_slot; | ||
558 | } | ||
559 | |||
560 | /* build OSD credential */ | ||
561 | osdblk_make_credential(osdev->obj_cred, &osdev->obj); | ||
562 | |||
563 | /* register our block device */ | ||
564 | irc = register_blkdev(0, osdev->name); | ||
565 | if (irc < 0) { | ||
566 | rc = irc; | ||
567 | goto err_out_osd; | ||
568 | } | ||
569 | |||
570 | osdev->major = irc; | ||
571 | |||
572 | /* set up and announce blkdev mapping */ | ||
573 | rc = osdblk_init_disk(osdev); | ||
574 | if (rc) | ||
575 | goto err_out_blkdev; | ||
576 | |||
577 | return count; | ||
578 | |||
579 | err_out_blkdev: | ||
580 | unregister_blkdev(osdev->major, osdev->name); | ||
581 | err_out_osd: | ||
582 | osduld_put_device(osdev->osd); | ||
583 | err_out_slot: | ||
584 | mutex_lock_nested(&ctl_mutex, SINGLE_DEPTH_NESTING); | ||
585 | list_del_init(&osdev->node); | ||
586 | mutex_unlock(&ctl_mutex); | ||
587 | |||
588 | kfree(osdev); | ||
589 | err_out_mod: | ||
590 | OSDBLK_DEBUG("Error adding device %s\n", buf); | ||
591 | module_put(THIS_MODULE); | ||
592 | return rc; | ||
593 | } | ||
594 | |||
595 | static ssize_t class_osdblk_remove(struct class *c, const char *buf, | ||
596 | size_t count) | ||
597 | { | ||
598 | struct osdblk_device *osdev = NULL; | ||
599 | int target_id, rc; | ||
600 | unsigned long ul; | ||
601 | struct list_head *tmp; | ||
602 | |||
603 | rc = strict_strtoul(buf, 10, &ul); | ||
604 | if (rc) | ||
605 | return rc; | ||
606 | |||
607 | /* convert to int; abort if we lost anything in the conversion */ | ||
608 | target_id = (int) ul; | ||
609 | if (target_id != ul) | ||
610 | return -EINVAL; | ||
611 | |||
612 | /* remove object from list immediately */ | ||
613 | mutex_lock_nested(&ctl_mutex, SINGLE_DEPTH_NESTING); | ||
614 | |||
615 | list_for_each(tmp, &osdblkdev_list) { | ||
616 | osdev = list_entry(tmp, struct osdblk_device, node); | ||
617 | if (osdev->id == target_id) { | ||
618 | list_del_init(&osdev->node); | ||
619 | break; | ||
620 | } | ||
621 | osdev = NULL; | ||
622 | } | ||
623 | |||
624 | mutex_unlock(&ctl_mutex); | ||
625 | |||
626 | if (!osdev) | ||
627 | return -ENOENT; | ||
628 | |||
629 | /* clean up and free blkdev and associated OSD connection */ | ||
630 | osdblk_free_disk(osdev); | ||
631 | unregister_blkdev(osdev->major, osdev->name); | ||
632 | osduld_put_device(osdev->osd); | ||
633 | kfree(osdev); | ||
634 | |||
635 | /* release module ref */ | ||
636 | module_put(THIS_MODULE); | ||
637 | |||
638 | return count; | ||
639 | } | ||
640 | |||
641 | static struct class_attribute class_osdblk_attrs[] = { | ||
642 | __ATTR(add, 0200, NULL, class_osdblk_add), | ||
643 | __ATTR(remove, 0200, NULL, class_osdblk_remove), | ||
644 | __ATTR(list, 0444, class_osdblk_list, NULL), | ||
645 | __ATTR_NULL | ||
646 | }; | ||
647 | |||
648 | static int osdblk_sysfs_init(void) | ||
649 | { | ||
650 | int ret = 0; | ||
651 | |||
652 | /* | ||
653 | * create control files in sysfs | ||
654 | * /sys/class/osdblk/... | ||
655 | */ | ||
656 | class_osdblk = kzalloc(sizeof(*class_osdblk), GFP_KERNEL); | ||
657 | if (!class_osdblk) | ||
658 | return -ENOMEM; | ||
659 | |||
660 | class_osdblk->name = DRV_NAME; | ||
661 | class_osdblk->owner = THIS_MODULE; | ||
662 | class_osdblk->class_release = class_osdblk_release; | ||
663 | class_osdblk->class_attrs = class_osdblk_attrs; | ||
664 | |||
665 | ret = class_register(class_osdblk); | ||
666 | if (ret) { | ||
667 | kfree(class_osdblk); | ||
668 | class_osdblk = NULL; | ||
669 | printk(PFX "failed to create class osdblk\n"); | ||
670 | return ret; | ||
671 | } | ||
672 | |||
673 | return 0; | ||
674 | } | ||
675 | |||
676 | static void osdblk_sysfs_cleanup(void) | ||
677 | { | ||
678 | if (class_osdblk) | ||
679 | class_destroy(class_osdblk); | ||
680 | class_osdblk = NULL; | ||
681 | } | ||
682 | |||
683 | static int __init osdblk_init(void) | ||
684 | { | ||
685 | int rc; | ||
686 | |||
687 | rc = osdblk_sysfs_init(); | ||
688 | if (rc) | ||
689 | return rc; | ||
690 | |||
691 | return 0; | ||
692 | } | ||
693 | |||
694 | static void __exit osdblk_exit(void) | ||
695 | { | ||
696 | osdblk_sysfs_cleanup(); | ||
697 | } | ||
698 | |||
699 | module_init(osdblk_init); | ||
700 | module_exit(osdblk_exit); | ||
701 | |||
diff --git a/drivers/block/pktcdvd.c b/drivers/block/pktcdvd.c index 83650e00632..99a506f619b 100644 --- a/drivers/block/pktcdvd.c +++ b/drivers/block/pktcdvd.c | |||
@@ -1372,8 +1372,10 @@ try_next_bio: | |||
1372 | wakeup = (pd->write_congestion_on > 0 | 1372 | wakeup = (pd->write_congestion_on > 0 |
1373 | && pd->bio_queue_size <= pd->write_congestion_off); | 1373 | && pd->bio_queue_size <= pd->write_congestion_off); |
1374 | spin_unlock(&pd->lock); | 1374 | spin_unlock(&pd->lock); |
1375 | if (wakeup) | 1375 | if (wakeup) { |
1376 | clear_bdi_congested(&pd->disk->queue->backing_dev_info, WRITE); | 1376 | clear_bdi_congested(&pd->disk->queue->backing_dev_info, |
1377 | BLK_RW_ASYNC); | ||
1378 | } | ||
1377 | 1379 | ||
1378 | pkt->sleep_time = max(PACKET_WAIT_TIME, 1); | 1380 | pkt->sleep_time = max(PACKET_WAIT_TIME, 1); |
1379 | pkt_set_state(pkt, PACKET_WAITING_STATE); | 1381 | pkt_set_state(pkt, PACKET_WAITING_STATE); |
@@ -2592,10 +2594,10 @@ static int pkt_make_request(struct request_queue *q, struct bio *bio) | |||
2592 | spin_lock(&pd->lock); | 2594 | spin_lock(&pd->lock); |
2593 | if (pd->write_congestion_on > 0 | 2595 | if (pd->write_congestion_on > 0 |
2594 | && pd->bio_queue_size >= pd->write_congestion_on) { | 2596 | && pd->bio_queue_size >= pd->write_congestion_on) { |
2595 | set_bdi_congested(&q->backing_dev_info, WRITE); | 2597 | set_bdi_congested(&q->backing_dev_info, BLK_RW_ASYNC); |
2596 | do { | 2598 | do { |
2597 | spin_unlock(&pd->lock); | 2599 | spin_unlock(&pd->lock); |
2598 | congestion_wait(WRITE, HZ); | 2600 | congestion_wait(BLK_RW_ASYNC, HZ); |
2599 | spin_lock(&pd->lock); | 2601 | spin_lock(&pd->lock); |
2600 | } while(pd->bio_queue_size > pd->write_congestion_off); | 2602 | } while(pd->bio_queue_size > pd->write_congestion_off); |
2601 | } | 2603 | } |
diff --git a/drivers/block/xsysace.c b/drivers/block/xsysace.c index f08491a3a81..b20abe102a2 100644 --- a/drivers/block/xsysace.c +++ b/drivers/block/xsysace.c | |||
@@ -390,9 +390,10 @@ static inline void ace_dump_mem(void *base, int len) | |||
390 | 390 | ||
391 | static void ace_dump_regs(struct ace_device *ace) | 391 | static void ace_dump_regs(struct ace_device *ace) |
392 | { | 392 | { |
393 | dev_info(ace->dev, " ctrl: %.8x seccnt/cmd: %.4x ver:%.4x\n" | 393 | dev_info(ace->dev, |
394 | KERN_INFO " status:%.8x mpu_lba:%.8x busmode:%4x\n" | 394 | " ctrl: %.8x seccnt/cmd: %.4x ver:%.4x\n" |
395 | KERN_INFO " error: %.8x cfg_lba:%.8x fatstat:%.4x\n", | 395 | " status:%.8x mpu_lba:%.8x busmode:%4x\n" |
396 | " error: %.8x cfg_lba:%.8x fatstat:%.4x\n", | ||
396 | ace_in32(ace, ACE_CTRL), | 397 | ace_in32(ace, ACE_CTRL), |
397 | ace_in(ace, ACE_SECCNTCMD), | 398 | ace_in(ace, ACE_SECCNTCMD), |
398 | ace_in(ace, ACE_VERSION), | 399 | ace_in(ace, ACE_VERSION), |
diff --git a/drivers/char/hw_random/intel-rng.c b/drivers/char/hw_random/intel-rng.c index 5dcbe603eca..91b53eb1c05 100644 --- a/drivers/char/hw_random/intel-rng.c +++ b/drivers/char/hw_random/intel-rng.c | |||
@@ -305,10 +305,11 @@ static int __init intel_init_hw_struct(struct intel_rng_hw *intel_rng_hw, | |||
305 | (BIOS_CNTL_LOCK_ENABLE_MASK|BIOS_CNTL_WRITE_ENABLE_MASK)) | 305 | (BIOS_CNTL_LOCK_ENABLE_MASK|BIOS_CNTL_WRITE_ENABLE_MASK)) |
306 | == BIOS_CNTL_LOCK_ENABLE_MASK) { | 306 | == BIOS_CNTL_LOCK_ENABLE_MASK) { |
307 | static __initdata /*const*/ char warning[] = | 307 | static __initdata /*const*/ char warning[] = |
308 | KERN_WARNING PFX "Firmware space is locked read-only. If you can't or\n" | 308 | KERN_WARNING |
309 | KERN_WARNING PFX "don't want to disable this in firmware setup, and if\n" | 309 | PFX "Firmware space is locked read-only. If you can't or\n" |
310 | KERN_WARNING PFX "you are certain that your system has a functional\n" | 310 | PFX "don't want to disable this in firmware setup, and if\n" |
311 | KERN_WARNING PFX "RNG, try using the 'no_fwh_detect' option.\n"; | 311 | PFX "you are certain that your system has a functional\n" |
312 | PFX "RNG, try using the 'no_fwh_detect' option.\n"; | ||
312 | 313 | ||
313 | if (no_fwh_detect) | 314 | if (no_fwh_detect) |
314 | return -ENODEV; | 315 | return -ENODEV; |
diff --git a/drivers/char/isicom.c b/drivers/char/isicom.c index 4159292e35c..621d1184673 100644 --- a/drivers/char/isicom.c +++ b/drivers/char/isicom.c | |||
@@ -1478,10 +1478,10 @@ static int __devinit load_firmware(struct pci_dev *pdev, | |||
1478 | status = inw(base + 0x4); | 1478 | status = inw(base + 0x4); |
1479 | if (status != 0) { | 1479 | if (status != 0) { |
1480 | dev_warn(&pdev->dev, "Card%d rejected load header:\n" | 1480 | dev_warn(&pdev->dev, "Card%d rejected load header:\n" |
1481 | KERN_WARNING "Address:0x%x\n" | 1481 | "Address:0x%x\n" |
1482 | KERN_WARNING "Count:0x%x\n" | 1482 | "Count:0x%x\n" |
1483 | KERN_WARNING "Status:0x%x\n", | 1483 | "Status:0x%x\n", |
1484 | index + 1, frame->addr, frame->count, status); | 1484 | index + 1, frame->addr, frame->count, status); |
1485 | goto errrelfw; | 1485 | goto errrelfw; |
1486 | } | 1486 | } |
1487 | outsw(base, frame->data, word_count); | 1487 | outsw(base, frame->data, word_count); |
@@ -1526,10 +1526,10 @@ static int __devinit load_firmware(struct pci_dev *pdev, | |||
1526 | status = inw(base + 0x4); | 1526 | status = inw(base + 0x4); |
1527 | if (status != 0) { | 1527 | if (status != 0) { |
1528 | dev_warn(&pdev->dev, "Card%d rejected verify header:\n" | 1528 | dev_warn(&pdev->dev, "Card%d rejected verify header:\n" |
1529 | KERN_WARNING "Address:0x%x\n" | 1529 | "Address:0x%x\n" |
1530 | KERN_WARNING "Count:0x%x\n" | 1530 | "Count:0x%x\n" |
1531 | KERN_WARNING "Status: 0x%x\n", | 1531 | "Status: 0x%x\n", |
1532 | index + 1, frame->addr, frame->count, status); | 1532 | index + 1, frame->addr, frame->count, status); |
1533 | goto errrelfw; | 1533 | goto errrelfw; |
1534 | } | 1534 | } |
1535 | 1535 | ||
diff --git a/drivers/char/pty.c b/drivers/char/pty.c index daebe1ba43d..9d1b4f548f6 100644 --- a/drivers/char/pty.c +++ b/drivers/char/pty.c | |||
@@ -75,114 +75,88 @@ static void pty_close(struct tty_struct *tty, struct file *filp) | |||
75 | */ | 75 | */ |
76 | static void pty_unthrottle(struct tty_struct *tty) | 76 | static void pty_unthrottle(struct tty_struct *tty) |
77 | { | 77 | { |
78 | struct tty_struct *o_tty = tty->link; | 78 | tty_wakeup(tty->link); |
79 | |||
80 | if (!o_tty) | ||
81 | return; | ||
82 | |||
83 | tty_wakeup(o_tty); | ||
84 | set_bit(TTY_THROTTLED, &tty->flags); | 79 | set_bit(TTY_THROTTLED, &tty->flags); |
85 | } | 80 | } |
86 | 81 | ||
87 | /* | 82 | /** |
88 | * WSH 05/24/97: modified to | 83 | * pty_space - report space left for writing |
89 | * (1) use space in tty->flip instead of a shared temp buffer | 84 | * @to: tty we are writing into |
90 | * The flip buffers aren't being used for a pty, so there's lots | ||
91 | * of space available. The buffer is protected by a per-pty | ||
92 | * semaphore that should almost never come under contention. | ||
93 | * (2) avoid redundant copying for cases where count >> receive_room | ||
94 | * N.B. Calls from user space may now return an error code instead of | ||
95 | * a count. | ||
96 | * | 85 | * |
97 | * FIXME: Our pty_write method is called with our ldisc lock held but | 86 | * The tty buffers allow 64K but we sneak a peak and clip at 8K this |
98 | * not our partners. We can't just wait on the other one blindly without | 87 | * allows a lot of overspill room for echo and other fun messes to |
99 | * risking deadlocks. At some point when everything has settled down we need | 88 | * be handled properly |
100 | * to look into making pty_write at least able to sleep over an ldisc change. | 89 | */ |
90 | |||
91 | static int pty_space(struct tty_struct *to) | ||
92 | { | ||
93 | int n = 8192 - to->buf.memory_used; | ||
94 | if (n < 0) | ||
95 | return 0; | ||
96 | return n; | ||
97 | } | ||
98 | |||
99 | /** | ||
100 | * pty_write - write to a pty | ||
101 | * @tty: the tty we write from | ||
102 | * @buf: kernel buffer of data | ||
103 | * @count: bytes to write | ||
101 | * | 104 | * |
102 | * The return on no ldisc is a bit counter intuitive but the logic works | 105 | * Our "hardware" write method. Data is coming from the ldisc which |
103 | * like this. During an ldisc change the other end will flush its buffers. We | 106 | * may be in a non sleeping state. We simply throw this at the other |
104 | * thus return the full length which is identical to the case where we had | 107 | * end of the link as if we were an IRQ handler receiving stuff for |
105 | * proper locking and happened to queue the bytes just before the flush during | 108 | * the other side of the pty/tty pair. |
106 | * the ldisc change. | ||
107 | */ | 109 | */ |
110 | |||
108 | static int pty_write(struct tty_struct *tty, const unsigned char *buf, | 111 | static int pty_write(struct tty_struct *tty, const unsigned char *buf, |
109 | int count) | 112 | int count) |
110 | { | 113 | { |
111 | struct tty_struct *to = tty->link; | 114 | struct tty_struct *to = tty->link; |
112 | struct tty_ldisc *ld; | 115 | int c; |
113 | int c = count; | ||
114 | 116 | ||
115 | if (!to || tty->stopped) | 117 | if (tty->stopped) |
116 | return 0; | 118 | return 0; |
117 | ld = tty_ldisc_ref(to); | 119 | |
118 | 120 | /* This isn't locked but our 8K is quite sloppy so no | |
119 | if (ld) { | 121 | big deal */ |
120 | c = to->receive_room; | 122 | |
121 | if (c > count) | 123 | c = pty_space(to); |
122 | c = count; | 124 | if (c > count) |
123 | ld->ops->receive_buf(to, buf, NULL, c); | 125 | c = count; |
124 | tty_ldisc_deref(ld); | 126 | if (c > 0) { |
127 | /* Stuff the data into the input queue of the other end */ | ||
128 | c = tty_insert_flip_string(to, buf, c); | ||
129 | /* And shovel */ | ||
130 | tty_flip_buffer_push(to); | ||
131 | tty_wakeup(tty); | ||
125 | } | 132 | } |
126 | return c; | 133 | return c; |
127 | } | 134 | } |
128 | 135 | ||
136 | /** | ||
137 | * pty_write_room - write space | ||
138 | * @tty: tty we are writing from | ||
139 | * | ||
140 | * Report how many bytes the ldisc can send into the queue for | ||
141 | * the other device. | ||
142 | */ | ||
143 | |||
129 | static int pty_write_room(struct tty_struct *tty) | 144 | static int pty_write_room(struct tty_struct *tty) |
130 | { | 145 | { |
131 | struct tty_struct *to = tty->link; | 146 | return pty_space(tty->link); |
132 | |||
133 | if (!to || tty->stopped) | ||
134 | return 0; | ||
135 | |||
136 | return to->receive_room; | ||
137 | } | 147 | } |
138 | 148 | ||
139 | /* | 149 | /** |
140 | * WSH 05/24/97: Modified for asymmetric MASTER/SLAVE behavior | 150 | * pty_chars_in_buffer - characters currently in our tx queue |
141 | * The chars_in_buffer() value is used by the ldisc select() function | 151 | * @tty: our tty |
142 | * to hold off writing when chars_in_buffer > WAKEUP_CHARS (== 256). | ||
143 | * The pty driver chars_in_buffer() Master/Slave must behave differently: | ||
144 | * | ||
145 | * The Master side needs to allow typed-ahead commands to accumulate | ||
146 | * while being canonicalized, so we report "our buffer" as empty until | ||
147 | * some threshold is reached, and then report the count. (Any count > | ||
148 | * WAKEUP_CHARS is regarded by select() as "full".) To avoid deadlock | ||
149 | * the count returned must be 0 if no canonical data is available to be | ||
150 | * read. (The N_TTY ldisc.chars_in_buffer now knows this.) | ||
151 | * | 152 | * |
152 | * The Slave side passes all characters in raw mode to the Master side's | 153 | * Report how much we have in the transmit queue. As everything is |
153 | * buffer where they can be read immediately, so in this case we can | 154 | * instantly at the other end this is easy to implement. |
154 | * return the true count in the buffer. | ||
155 | */ | 155 | */ |
156 | |||
156 | static int pty_chars_in_buffer(struct tty_struct *tty) | 157 | static int pty_chars_in_buffer(struct tty_struct *tty) |
157 | { | 158 | { |
158 | struct tty_struct *to = tty->link; | 159 | return 0; |
159 | struct tty_ldisc *ld; | ||
160 | int count = 0; | ||
161 | |||
162 | /* We should get the line discipline lock for "tty->link" */ | ||
163 | if (!to) | ||
164 | return 0; | ||
165 | /* We cannot take a sleeping reference here without deadlocking with | ||
166 | an ldisc change - but it doesn't really matter */ | ||
167 | ld = tty_ldisc_ref(to); | ||
168 | if (ld == NULL) | ||
169 | return 0; | ||
170 | |||
171 | /* The ldisc must report 0 if no characters available to be read */ | ||
172 | if (ld->ops->chars_in_buffer) | ||
173 | count = ld->ops->chars_in_buffer(to); | ||
174 | |||
175 | tty_ldisc_deref(ld); | ||
176 | |||
177 | if (tty->driver->subtype == PTY_TYPE_SLAVE) | ||
178 | return count; | ||
179 | |||
180 | /* Master side driver ... if the other side's read buffer is less than | ||
181 | * half full, return 0 to allow writers to proceed; otherwise return | ||
182 | * the count. This leaves a comfortable margin to avoid overflow, | ||
183 | * and still allows half a buffer's worth of typed-ahead commands. | ||
184 | */ | ||
185 | return (count < N_TTY_BUF_SIZE/2) ? 0 : count; | ||
186 | } | 160 | } |
187 | 161 | ||
188 | /* Set the lock flag on a pty */ | 162 | /* Set the lock flag on a pty */ |
@@ -202,20 +176,10 @@ static void pty_flush_buffer(struct tty_struct *tty) | |||
202 | { | 176 | { |
203 | struct tty_struct *to = tty->link; | 177 | struct tty_struct *to = tty->link; |
204 | unsigned long flags; | 178 | unsigned long flags; |
205 | struct tty_ldisc *ld; | ||
206 | 179 | ||
207 | if (!to) | 180 | if (!to) |
208 | return; | 181 | return; |
209 | ld = tty_ldisc_ref(to); | 182 | /* tty_buffer_flush(to); FIXME */ |
210 | |||
211 | /* The other end is changing discipline */ | ||
212 | if (!ld) | ||
213 | return; | ||
214 | |||
215 | if (ld->ops->flush_buffer) | ||
216 | to->ldisc->ops->flush_buffer(to); | ||
217 | tty_ldisc_deref(ld); | ||
218 | |||
219 | if (to->packet) { | 183 | if (to->packet) { |
220 | spin_lock_irqsave(&tty->ctrl_lock, flags); | 184 | spin_lock_irqsave(&tty->ctrl_lock, flags); |
221 | tty->ctrl_status |= TIOCPKT_FLUSHWRITE; | 185 | tty->ctrl_status |= TIOCPKT_FLUSHWRITE; |
diff --git a/drivers/cpufreq/cpufreq.c b/drivers/cpufreq/cpufreq.c index 6e2ec0b1894..b90eda8b344 100644 --- a/drivers/cpufreq/cpufreq.c +++ b/drivers/cpufreq/cpufreq.c | |||
@@ -761,6 +761,10 @@ static struct kobj_type ktype_cpufreq = { | |||
761 | * cpufreq_add_dev - add a CPU device | 761 | * cpufreq_add_dev - add a CPU device |
762 | * | 762 | * |
763 | * Adds the cpufreq interface for a CPU device. | 763 | * Adds the cpufreq interface for a CPU device. |
764 | * | ||
765 | * The Oracle says: try running cpufreq registration/unregistration concurrently | ||
766 | * with with cpu hotplugging and all hell will break loose. Tried to clean this | ||
767 | * mess up, but more thorough testing is needed. - Mathieu | ||
764 | */ | 768 | */ |
765 | static int cpufreq_add_dev(struct sys_device *sys_dev) | 769 | static int cpufreq_add_dev(struct sys_device *sys_dev) |
766 | { | 770 | { |
@@ -772,9 +776,6 @@ static int cpufreq_add_dev(struct sys_device *sys_dev) | |||
772 | struct sys_device *cpu_sys_dev; | 776 | struct sys_device *cpu_sys_dev; |
773 | unsigned long flags; | 777 | unsigned long flags; |
774 | unsigned int j; | 778 | unsigned int j; |
775 | #ifdef CONFIG_SMP | ||
776 | struct cpufreq_policy *managed_policy; | ||
777 | #endif | ||
778 | 779 | ||
779 | if (cpu_is_offline(cpu)) | 780 | if (cpu_is_offline(cpu)) |
780 | return 0; | 781 | return 0; |
@@ -804,15 +805,12 @@ static int cpufreq_add_dev(struct sys_device *sys_dev) | |||
804 | goto nomem_out; | 805 | goto nomem_out; |
805 | } | 806 | } |
806 | if (!alloc_cpumask_var(&policy->cpus, GFP_KERNEL)) { | 807 | if (!alloc_cpumask_var(&policy->cpus, GFP_KERNEL)) { |
807 | kfree(policy); | ||
808 | ret = -ENOMEM; | 808 | ret = -ENOMEM; |
809 | goto nomem_out; | 809 | goto err_free_policy; |
810 | } | 810 | } |
811 | if (!zalloc_cpumask_var(&policy->related_cpus, GFP_KERNEL)) { | 811 | if (!zalloc_cpumask_var(&policy->related_cpus, GFP_KERNEL)) { |
812 | free_cpumask_var(policy->cpus); | ||
813 | kfree(policy); | ||
814 | ret = -ENOMEM; | 812 | ret = -ENOMEM; |
815 | goto nomem_out; | 813 | goto err_free_cpumask; |
816 | } | 814 | } |
817 | 815 | ||
818 | policy->cpu = cpu; | 816 | policy->cpu = cpu; |
@@ -820,7 +818,8 @@ static int cpufreq_add_dev(struct sys_device *sys_dev) | |||
820 | 818 | ||
821 | /* Initially set CPU itself as the policy_cpu */ | 819 | /* Initially set CPU itself as the policy_cpu */ |
822 | per_cpu(policy_cpu, cpu) = cpu; | 820 | per_cpu(policy_cpu, cpu) = cpu; |
823 | lock_policy_rwsem_write(cpu); | 821 | ret = (lock_policy_rwsem_write(cpu) < 0); |
822 | WARN_ON(ret); | ||
824 | 823 | ||
825 | init_completion(&policy->kobj_unregister); | 824 | init_completion(&policy->kobj_unregister); |
826 | INIT_WORK(&policy->update, handle_update); | 825 | INIT_WORK(&policy->update, handle_update); |
@@ -833,7 +832,7 @@ static int cpufreq_add_dev(struct sys_device *sys_dev) | |||
833 | ret = cpufreq_driver->init(policy); | 832 | ret = cpufreq_driver->init(policy); |
834 | if (ret) { | 833 | if (ret) { |
835 | dprintk("initialization failed\n"); | 834 | dprintk("initialization failed\n"); |
836 | goto err_out; | 835 | goto err_unlock_policy; |
837 | } | 836 | } |
838 | policy->user_policy.min = policy->min; | 837 | policy->user_policy.min = policy->min; |
839 | policy->user_policy.max = policy->max; | 838 | policy->user_policy.max = policy->max; |
@@ -852,21 +851,29 @@ static int cpufreq_add_dev(struct sys_device *sys_dev) | |||
852 | #endif | 851 | #endif |
853 | 852 | ||
854 | for_each_cpu(j, policy->cpus) { | 853 | for_each_cpu(j, policy->cpus) { |
854 | struct cpufreq_policy *managed_policy; | ||
855 | |||
855 | if (cpu == j) | 856 | if (cpu == j) |
856 | continue; | 857 | continue; |
857 | 858 | ||
858 | /* Check for existing affected CPUs. | 859 | /* Check for existing affected CPUs. |
859 | * They may not be aware of it due to CPU Hotplug. | 860 | * They may not be aware of it due to CPU Hotplug. |
860 | */ | 861 | */ |
861 | managed_policy = cpufreq_cpu_get(j); /* FIXME: Where is this released? What about error paths? */ | 862 | managed_policy = cpufreq_cpu_get(j); |
862 | if (unlikely(managed_policy)) { | 863 | if (unlikely(managed_policy)) { |
863 | 864 | ||
864 | /* Set proper policy_cpu */ | 865 | /* Set proper policy_cpu */ |
865 | unlock_policy_rwsem_write(cpu); | 866 | unlock_policy_rwsem_write(cpu); |
866 | per_cpu(policy_cpu, cpu) = managed_policy->cpu; | 867 | per_cpu(policy_cpu, cpu) = managed_policy->cpu; |
867 | 868 | ||
868 | if (lock_policy_rwsem_write(cpu) < 0) | 869 | if (lock_policy_rwsem_write(cpu) < 0) { |
869 | goto err_out_driver_exit; | 870 | /* Should not go through policy unlock path */ |
871 | if (cpufreq_driver->exit) | ||
872 | cpufreq_driver->exit(policy); | ||
873 | ret = -EBUSY; | ||
874 | cpufreq_cpu_put(managed_policy); | ||
875 | goto err_free_cpumask; | ||
876 | } | ||
870 | 877 | ||
871 | spin_lock_irqsave(&cpufreq_driver_lock, flags); | 878 | spin_lock_irqsave(&cpufreq_driver_lock, flags); |
872 | cpumask_copy(managed_policy->cpus, policy->cpus); | 879 | cpumask_copy(managed_policy->cpus, policy->cpus); |
@@ -877,12 +884,14 @@ static int cpufreq_add_dev(struct sys_device *sys_dev) | |||
877 | ret = sysfs_create_link(&sys_dev->kobj, | 884 | ret = sysfs_create_link(&sys_dev->kobj, |
878 | &managed_policy->kobj, | 885 | &managed_policy->kobj, |
879 | "cpufreq"); | 886 | "cpufreq"); |
880 | if (ret) | 887 | if (!ret) |
881 | goto err_out_driver_exit; | 888 | cpufreq_cpu_put(managed_policy); |
882 | 889 | /* | |
883 | cpufreq_debug_enable_ratelimit(); | 890 | * Success. We only needed to be added to the mask. |
884 | ret = 0; | 891 | * Call driver->exit() because only the cpu parent of |
885 | goto err_out_driver_exit; /* call driver->exit() */ | 892 | * the kobj needed to call init(). |
893 | */ | ||
894 | goto out_driver_exit; /* call driver->exit() */ | ||
886 | } | 895 | } |
887 | } | 896 | } |
888 | #endif | 897 | #endif |
@@ -892,25 +901,25 @@ static int cpufreq_add_dev(struct sys_device *sys_dev) | |||
892 | ret = kobject_init_and_add(&policy->kobj, &ktype_cpufreq, &sys_dev->kobj, | 901 | ret = kobject_init_and_add(&policy->kobj, &ktype_cpufreq, &sys_dev->kobj, |
893 | "cpufreq"); | 902 | "cpufreq"); |
894 | if (ret) | 903 | if (ret) |
895 | goto err_out_driver_exit; | 904 | goto out_driver_exit; |
896 | 905 | ||
897 | /* set up files for this cpu device */ | 906 | /* set up files for this cpu device */ |
898 | drv_attr = cpufreq_driver->attr; | 907 | drv_attr = cpufreq_driver->attr; |
899 | while ((drv_attr) && (*drv_attr)) { | 908 | while ((drv_attr) && (*drv_attr)) { |
900 | ret = sysfs_create_file(&policy->kobj, &((*drv_attr)->attr)); | 909 | ret = sysfs_create_file(&policy->kobj, &((*drv_attr)->attr)); |
901 | if (ret) | 910 | if (ret) |
902 | goto err_out_driver_exit; | 911 | goto err_out_kobj_put; |
903 | drv_attr++; | 912 | drv_attr++; |
904 | } | 913 | } |
905 | if (cpufreq_driver->get) { | 914 | if (cpufreq_driver->get) { |
906 | ret = sysfs_create_file(&policy->kobj, &cpuinfo_cur_freq.attr); | 915 | ret = sysfs_create_file(&policy->kobj, &cpuinfo_cur_freq.attr); |
907 | if (ret) | 916 | if (ret) |
908 | goto err_out_driver_exit; | 917 | goto err_out_kobj_put; |
909 | } | 918 | } |
910 | if (cpufreq_driver->target) { | 919 | if (cpufreq_driver->target) { |
911 | ret = sysfs_create_file(&policy->kobj, &scaling_cur_freq.attr); | 920 | ret = sysfs_create_file(&policy->kobj, &scaling_cur_freq.attr); |
912 | if (ret) | 921 | if (ret) |
913 | goto err_out_driver_exit; | 922 | goto err_out_kobj_put; |
914 | } | 923 | } |
915 | 924 | ||
916 | spin_lock_irqsave(&cpufreq_driver_lock, flags); | 925 | spin_lock_irqsave(&cpufreq_driver_lock, flags); |
@@ -922,18 +931,22 @@ static int cpufreq_add_dev(struct sys_device *sys_dev) | |||
922 | 931 | ||
923 | /* symlink affected CPUs */ | 932 | /* symlink affected CPUs */ |
924 | for_each_cpu(j, policy->cpus) { | 933 | for_each_cpu(j, policy->cpus) { |
934 | struct cpufreq_policy *managed_policy; | ||
935 | |||
925 | if (j == cpu) | 936 | if (j == cpu) |
926 | continue; | 937 | continue; |
927 | if (!cpu_online(j)) | 938 | if (!cpu_online(j)) |
928 | continue; | 939 | continue; |
929 | 940 | ||
930 | dprintk("CPU %u already managed, adding link\n", j); | 941 | dprintk("CPU %u already managed, adding link\n", j); |
931 | cpufreq_cpu_get(cpu); | 942 | managed_policy = cpufreq_cpu_get(cpu); |
932 | cpu_sys_dev = get_cpu_sysdev(j); | 943 | cpu_sys_dev = get_cpu_sysdev(j); |
933 | ret = sysfs_create_link(&cpu_sys_dev->kobj, &policy->kobj, | 944 | ret = sysfs_create_link(&cpu_sys_dev->kobj, &policy->kobj, |
934 | "cpufreq"); | 945 | "cpufreq"); |
935 | if (ret) | 946 | if (ret) { |
947 | cpufreq_cpu_put(managed_policy); | ||
936 | goto err_out_unregister; | 948 | goto err_out_unregister; |
949 | } | ||
937 | } | 950 | } |
938 | 951 | ||
939 | policy->governor = NULL; /* to assure that the starting sequence is | 952 | policy->governor = NULL; /* to assure that the starting sequence is |
@@ -965,17 +978,20 @@ err_out_unregister: | |||
965 | per_cpu(cpufreq_cpu_data, j) = NULL; | 978 | per_cpu(cpufreq_cpu_data, j) = NULL; |
966 | spin_unlock_irqrestore(&cpufreq_driver_lock, flags); | 979 | spin_unlock_irqrestore(&cpufreq_driver_lock, flags); |
967 | 980 | ||
981 | err_out_kobj_put: | ||
968 | kobject_put(&policy->kobj); | 982 | kobject_put(&policy->kobj); |
969 | wait_for_completion(&policy->kobj_unregister); | 983 | wait_for_completion(&policy->kobj_unregister); |
970 | 984 | ||
971 | err_out_driver_exit: | 985 | out_driver_exit: |
972 | if (cpufreq_driver->exit) | 986 | if (cpufreq_driver->exit) |
973 | cpufreq_driver->exit(policy); | 987 | cpufreq_driver->exit(policy); |
974 | 988 | ||
975 | err_out: | 989 | err_unlock_policy: |
976 | unlock_policy_rwsem_write(cpu); | 990 | unlock_policy_rwsem_write(cpu); |
991 | err_free_cpumask: | ||
992 | free_cpumask_var(policy->cpus); | ||
993 | err_free_policy: | ||
977 | kfree(policy); | 994 | kfree(policy); |
978 | |||
979 | nomem_out: | 995 | nomem_out: |
980 | module_put(cpufreq_driver->owner); | 996 | module_put(cpufreq_driver->owner); |
981 | module_out: | 997 | module_out: |
@@ -1070,8 +1086,6 @@ static int __cpufreq_remove_dev(struct sys_device *sys_dev) | |||
1070 | spin_unlock_irqrestore(&cpufreq_driver_lock, flags); | 1086 | spin_unlock_irqrestore(&cpufreq_driver_lock, flags); |
1071 | #endif | 1087 | #endif |
1072 | 1088 | ||
1073 | unlock_policy_rwsem_write(cpu); | ||
1074 | |||
1075 | if (cpufreq_driver->target) | 1089 | if (cpufreq_driver->target) |
1076 | __cpufreq_governor(data, CPUFREQ_GOV_STOP); | 1090 | __cpufreq_governor(data, CPUFREQ_GOV_STOP); |
1077 | 1091 | ||
@@ -1088,6 +1102,8 @@ static int __cpufreq_remove_dev(struct sys_device *sys_dev) | |||
1088 | if (cpufreq_driver->exit) | 1102 | if (cpufreq_driver->exit) |
1089 | cpufreq_driver->exit(data); | 1103 | cpufreq_driver->exit(data); |
1090 | 1104 | ||
1105 | unlock_policy_rwsem_write(cpu); | ||
1106 | |||
1091 | free_cpumask_var(data->related_cpus); | 1107 | free_cpumask_var(data->related_cpus); |
1092 | free_cpumask_var(data->cpus); | 1108 | free_cpumask_var(data->cpus); |
1093 | kfree(data); | 1109 | kfree(data); |
diff --git a/drivers/cpufreq/cpufreq_conservative.c b/drivers/cpufreq/cpufreq_conservative.c index 7fc58af748b..57490502b21 100644 --- a/drivers/cpufreq/cpufreq_conservative.c +++ b/drivers/cpufreq/cpufreq_conservative.c | |||
@@ -63,22 +63,20 @@ struct cpu_dbs_info_s { | |||
63 | unsigned int down_skip; | 63 | unsigned int down_skip; |
64 | unsigned int requested_freq; | 64 | unsigned int requested_freq; |
65 | int cpu; | 65 | int cpu; |
66 | unsigned int enable:1; | 66 | /* |
67 | * percpu mutex that serializes governor limit change with | ||
68 | * do_dbs_timer invocation. We do not want do_dbs_timer to run | ||
69 | * when user is changing the governor or limits. | ||
70 | */ | ||
71 | struct mutex timer_mutex; | ||
67 | }; | 72 | }; |
68 | static DEFINE_PER_CPU(struct cpu_dbs_info_s, cpu_dbs_info); | 73 | static DEFINE_PER_CPU(struct cpu_dbs_info_s, cpu_dbs_info); |
69 | 74 | ||
70 | static unsigned int dbs_enable; /* number of CPUs using this policy */ | 75 | static unsigned int dbs_enable; /* number of CPUs using this policy */ |
71 | 76 | ||
72 | /* | 77 | /* |
73 | * DEADLOCK ALERT! There is a ordering requirement between cpu_hotplug | 78 | * dbs_mutex protects data in dbs_tuners_ins from concurrent changes on |
74 | * lock and dbs_mutex. cpu_hotplug lock should always be held before | 79 | * different CPUs. It protects dbs_enable in governor start/stop. |
75 | * dbs_mutex. If any function that can potentially take cpu_hotplug lock | ||
76 | * (like __cpufreq_driver_target()) is being called with dbs_mutex taken, then | ||
77 | * cpu_hotplug lock should be taken before that. Note that cpu_hotplug lock | ||
78 | * is recursive for the same process. -Venki | ||
79 | * DEADLOCK ALERT! (2) : do_dbs_timer() must not take the dbs_mutex, because it | ||
80 | * would deadlock with cancel_delayed_work_sync(), which is needed for proper | ||
81 | * raceless workqueue teardown. | ||
82 | */ | 80 | */ |
83 | static DEFINE_MUTEX(dbs_mutex); | 81 | static DEFINE_MUTEX(dbs_mutex); |
84 | 82 | ||
@@ -143,9 +141,6 @@ dbs_cpufreq_notifier(struct notifier_block *nb, unsigned long val, | |||
143 | 141 | ||
144 | struct cpufreq_policy *policy; | 142 | struct cpufreq_policy *policy; |
145 | 143 | ||
146 | if (!this_dbs_info->enable) | ||
147 | return 0; | ||
148 | |||
149 | policy = this_dbs_info->cur_policy; | 144 | policy = this_dbs_info->cur_policy; |
150 | 145 | ||
151 | /* | 146 | /* |
@@ -488,18 +483,12 @@ static void do_dbs_timer(struct work_struct *work) | |||
488 | 483 | ||
489 | delay -= jiffies % delay; | 484 | delay -= jiffies % delay; |
490 | 485 | ||
491 | if (lock_policy_rwsem_write(cpu) < 0) | 486 | mutex_lock(&dbs_info->timer_mutex); |
492 | return; | ||
493 | |||
494 | if (!dbs_info->enable) { | ||
495 | unlock_policy_rwsem_write(cpu); | ||
496 | return; | ||
497 | } | ||
498 | 487 | ||
499 | dbs_check_cpu(dbs_info); | 488 | dbs_check_cpu(dbs_info); |
500 | 489 | ||
501 | queue_delayed_work_on(cpu, kconservative_wq, &dbs_info->work, delay); | 490 | queue_delayed_work_on(cpu, kconservative_wq, &dbs_info->work, delay); |
502 | unlock_policy_rwsem_write(cpu); | 491 | mutex_unlock(&dbs_info->timer_mutex); |
503 | } | 492 | } |
504 | 493 | ||
505 | static inline void dbs_timer_init(struct cpu_dbs_info_s *dbs_info) | 494 | static inline void dbs_timer_init(struct cpu_dbs_info_s *dbs_info) |
@@ -508,7 +497,6 @@ static inline void dbs_timer_init(struct cpu_dbs_info_s *dbs_info) | |||
508 | int delay = usecs_to_jiffies(dbs_tuners_ins.sampling_rate); | 497 | int delay = usecs_to_jiffies(dbs_tuners_ins.sampling_rate); |
509 | delay -= jiffies % delay; | 498 | delay -= jiffies % delay; |
510 | 499 | ||
511 | dbs_info->enable = 1; | ||
512 | INIT_DELAYED_WORK_DEFERRABLE(&dbs_info->work, do_dbs_timer); | 500 | INIT_DELAYED_WORK_DEFERRABLE(&dbs_info->work, do_dbs_timer); |
513 | queue_delayed_work_on(dbs_info->cpu, kconservative_wq, &dbs_info->work, | 501 | queue_delayed_work_on(dbs_info->cpu, kconservative_wq, &dbs_info->work, |
514 | delay); | 502 | delay); |
@@ -516,7 +504,6 @@ static inline void dbs_timer_init(struct cpu_dbs_info_s *dbs_info) | |||
516 | 504 | ||
517 | static inline void dbs_timer_exit(struct cpu_dbs_info_s *dbs_info) | 505 | static inline void dbs_timer_exit(struct cpu_dbs_info_s *dbs_info) |
518 | { | 506 | { |
519 | dbs_info->enable = 0; | ||
520 | cancel_delayed_work_sync(&dbs_info->work); | 507 | cancel_delayed_work_sync(&dbs_info->work); |
521 | } | 508 | } |
522 | 509 | ||
@@ -535,9 +522,6 @@ static int cpufreq_governor_dbs(struct cpufreq_policy *policy, | |||
535 | if ((!cpu_online(cpu)) || (!policy->cur)) | 522 | if ((!cpu_online(cpu)) || (!policy->cur)) |
536 | return -EINVAL; | 523 | return -EINVAL; |
537 | 524 | ||
538 | if (this_dbs_info->enable) /* Already enabled */ | ||
539 | break; | ||
540 | |||
541 | mutex_lock(&dbs_mutex); | 525 | mutex_lock(&dbs_mutex); |
542 | 526 | ||
543 | rc = sysfs_create_group(&policy->kobj, &dbs_attr_group); | 527 | rc = sysfs_create_group(&policy->kobj, &dbs_attr_group); |
@@ -561,6 +545,7 @@ static int cpufreq_governor_dbs(struct cpufreq_policy *policy, | |||
561 | this_dbs_info->down_skip = 0; | 545 | this_dbs_info->down_skip = 0; |
562 | this_dbs_info->requested_freq = policy->cur; | 546 | this_dbs_info->requested_freq = policy->cur; |
563 | 547 | ||
548 | mutex_init(&this_dbs_info->timer_mutex); | ||
564 | dbs_enable++; | 549 | dbs_enable++; |
565 | /* | 550 | /* |
566 | * Start the timerschedule work, when this governor | 551 | * Start the timerschedule work, when this governor |
@@ -590,17 +575,19 @@ static int cpufreq_governor_dbs(struct cpufreq_policy *policy, | |||
590 | &dbs_cpufreq_notifier_block, | 575 | &dbs_cpufreq_notifier_block, |
591 | CPUFREQ_TRANSITION_NOTIFIER); | 576 | CPUFREQ_TRANSITION_NOTIFIER); |
592 | } | 577 | } |
593 | dbs_timer_init(this_dbs_info); | ||
594 | |||
595 | mutex_unlock(&dbs_mutex); | 578 | mutex_unlock(&dbs_mutex); |
596 | 579 | ||
580 | dbs_timer_init(this_dbs_info); | ||
581 | |||
597 | break; | 582 | break; |
598 | 583 | ||
599 | case CPUFREQ_GOV_STOP: | 584 | case CPUFREQ_GOV_STOP: |
600 | mutex_lock(&dbs_mutex); | ||
601 | dbs_timer_exit(this_dbs_info); | 585 | dbs_timer_exit(this_dbs_info); |
586 | |||
587 | mutex_lock(&dbs_mutex); | ||
602 | sysfs_remove_group(&policy->kobj, &dbs_attr_group); | 588 | sysfs_remove_group(&policy->kobj, &dbs_attr_group); |
603 | dbs_enable--; | 589 | dbs_enable--; |
590 | mutex_destroy(&this_dbs_info->timer_mutex); | ||
604 | 591 | ||
605 | /* | 592 | /* |
606 | * Stop the timerschedule work, when this governor | 593 | * Stop the timerschedule work, when this governor |
@@ -616,7 +603,7 @@ static int cpufreq_governor_dbs(struct cpufreq_policy *policy, | |||
616 | break; | 603 | break; |
617 | 604 | ||
618 | case CPUFREQ_GOV_LIMITS: | 605 | case CPUFREQ_GOV_LIMITS: |
619 | mutex_lock(&dbs_mutex); | 606 | mutex_lock(&this_dbs_info->timer_mutex); |
620 | if (policy->max < this_dbs_info->cur_policy->cur) | 607 | if (policy->max < this_dbs_info->cur_policy->cur) |
621 | __cpufreq_driver_target( | 608 | __cpufreq_driver_target( |
622 | this_dbs_info->cur_policy, | 609 | this_dbs_info->cur_policy, |
@@ -625,7 +612,7 @@ static int cpufreq_governor_dbs(struct cpufreq_policy *policy, | |||
625 | __cpufreq_driver_target( | 612 | __cpufreq_driver_target( |
626 | this_dbs_info->cur_policy, | 613 | this_dbs_info->cur_policy, |
627 | policy->min, CPUFREQ_RELATION_L); | 614 | policy->min, CPUFREQ_RELATION_L); |
628 | mutex_unlock(&dbs_mutex); | 615 | mutex_unlock(&this_dbs_info->timer_mutex); |
629 | 616 | ||
630 | break; | 617 | break; |
631 | } | 618 | } |
diff --git a/drivers/cpufreq/cpufreq_ondemand.c b/drivers/cpufreq/cpufreq_ondemand.c index 1911d172935..d6ba14276bb 100644 --- a/drivers/cpufreq/cpufreq_ondemand.c +++ b/drivers/cpufreq/cpufreq_ondemand.c | |||
@@ -70,23 +70,21 @@ struct cpu_dbs_info_s { | |||
70 | unsigned int freq_lo_jiffies; | 70 | unsigned int freq_lo_jiffies; |
71 | unsigned int freq_hi_jiffies; | 71 | unsigned int freq_hi_jiffies; |
72 | int cpu; | 72 | int cpu; |
73 | unsigned int enable:1, | 73 | unsigned int sample_type:1; |
74 | sample_type:1; | 74 | /* |
75 | * percpu mutex that serializes governor limit change with | ||
76 | * do_dbs_timer invocation. We do not want do_dbs_timer to run | ||
77 | * when user is changing the governor or limits. | ||
78 | */ | ||
79 | struct mutex timer_mutex; | ||
75 | }; | 80 | }; |
76 | static DEFINE_PER_CPU(struct cpu_dbs_info_s, cpu_dbs_info); | 81 | static DEFINE_PER_CPU(struct cpu_dbs_info_s, cpu_dbs_info); |
77 | 82 | ||
78 | static unsigned int dbs_enable; /* number of CPUs using this policy */ | 83 | static unsigned int dbs_enable; /* number of CPUs using this policy */ |
79 | 84 | ||
80 | /* | 85 | /* |
81 | * DEADLOCK ALERT! There is a ordering requirement between cpu_hotplug | 86 | * dbs_mutex protects data in dbs_tuners_ins from concurrent changes on |
82 | * lock and dbs_mutex. cpu_hotplug lock should always be held before | 87 | * different CPUs. It protects dbs_enable in governor start/stop. |
83 | * dbs_mutex. If any function that can potentially take cpu_hotplug lock | ||
84 | * (like __cpufreq_driver_target()) is being called with dbs_mutex taken, then | ||
85 | * cpu_hotplug lock should be taken before that. Note that cpu_hotplug lock | ||
86 | * is recursive for the same process. -Venki | ||
87 | * DEADLOCK ALERT! (2) : do_dbs_timer() must not take the dbs_mutex, because it | ||
88 | * would deadlock with cancel_delayed_work_sync(), which is needed for proper | ||
89 | * raceless workqueue teardown. | ||
90 | */ | 88 | */ |
91 | static DEFINE_MUTEX(dbs_mutex); | 89 | static DEFINE_MUTEX(dbs_mutex); |
92 | 90 | ||
@@ -192,13 +190,18 @@ static unsigned int powersave_bias_target(struct cpufreq_policy *policy, | |||
192 | return freq_hi; | 190 | return freq_hi; |
193 | } | 191 | } |
194 | 192 | ||
193 | static void ondemand_powersave_bias_init_cpu(int cpu) | ||
194 | { | ||
195 | struct cpu_dbs_info_s *dbs_info = &per_cpu(cpu_dbs_info, cpu); | ||
196 | dbs_info->freq_table = cpufreq_frequency_get_table(cpu); | ||
197 | dbs_info->freq_lo = 0; | ||
198 | } | ||
199 | |||
195 | static void ondemand_powersave_bias_init(void) | 200 | static void ondemand_powersave_bias_init(void) |
196 | { | 201 | { |
197 | int i; | 202 | int i; |
198 | for_each_online_cpu(i) { | 203 | for_each_online_cpu(i) { |
199 | struct cpu_dbs_info_s *dbs_info = &per_cpu(cpu_dbs_info, i); | 204 | ondemand_powersave_bias_init_cpu(i); |
200 | dbs_info->freq_table = cpufreq_frequency_get_table(i); | ||
201 | dbs_info->freq_lo = 0; | ||
202 | } | 205 | } |
203 | } | 206 | } |
204 | 207 | ||
@@ -240,12 +243,10 @@ static ssize_t store_sampling_rate(struct cpufreq_policy *unused, | |||
240 | unsigned int input; | 243 | unsigned int input; |
241 | int ret; | 244 | int ret; |
242 | ret = sscanf(buf, "%u", &input); | 245 | ret = sscanf(buf, "%u", &input); |
246 | if (ret != 1) | ||
247 | return -EINVAL; | ||
243 | 248 | ||
244 | mutex_lock(&dbs_mutex); | 249 | mutex_lock(&dbs_mutex); |
245 | if (ret != 1) { | ||
246 | mutex_unlock(&dbs_mutex); | ||
247 | return -EINVAL; | ||
248 | } | ||
249 | dbs_tuners_ins.sampling_rate = max(input, min_sampling_rate); | 250 | dbs_tuners_ins.sampling_rate = max(input, min_sampling_rate); |
250 | mutex_unlock(&dbs_mutex); | 251 | mutex_unlock(&dbs_mutex); |
251 | 252 | ||
@@ -259,13 +260,12 @@ static ssize_t store_up_threshold(struct cpufreq_policy *unused, | |||
259 | int ret; | 260 | int ret; |
260 | ret = sscanf(buf, "%u", &input); | 261 | ret = sscanf(buf, "%u", &input); |
261 | 262 | ||
262 | mutex_lock(&dbs_mutex); | ||
263 | if (ret != 1 || input > MAX_FREQUENCY_UP_THRESHOLD || | 263 | if (ret != 1 || input > MAX_FREQUENCY_UP_THRESHOLD || |
264 | input < MIN_FREQUENCY_UP_THRESHOLD) { | 264 | input < MIN_FREQUENCY_UP_THRESHOLD) { |
265 | mutex_unlock(&dbs_mutex); | ||
266 | return -EINVAL; | 265 | return -EINVAL; |
267 | } | 266 | } |
268 | 267 | ||
268 | mutex_lock(&dbs_mutex); | ||
269 | dbs_tuners_ins.up_threshold = input; | 269 | dbs_tuners_ins.up_threshold = input; |
270 | mutex_unlock(&dbs_mutex); | 270 | mutex_unlock(&dbs_mutex); |
271 | 271 | ||
@@ -363,9 +363,6 @@ static void dbs_check_cpu(struct cpu_dbs_info_s *this_dbs_info) | |||
363 | struct cpufreq_policy *policy; | 363 | struct cpufreq_policy *policy; |
364 | unsigned int j; | 364 | unsigned int j; |
365 | 365 | ||
366 | if (!this_dbs_info->enable) | ||
367 | return; | ||
368 | |||
369 | this_dbs_info->freq_lo = 0; | 366 | this_dbs_info->freq_lo = 0; |
370 | policy = this_dbs_info->cur_policy; | 367 | policy = this_dbs_info->cur_policy; |
371 | 368 | ||
@@ -493,14 +490,7 @@ static void do_dbs_timer(struct work_struct *work) | |||
493 | int delay = usecs_to_jiffies(dbs_tuners_ins.sampling_rate); | 490 | int delay = usecs_to_jiffies(dbs_tuners_ins.sampling_rate); |
494 | 491 | ||
495 | delay -= jiffies % delay; | 492 | delay -= jiffies % delay; |
496 | 493 | mutex_lock(&dbs_info->timer_mutex); | |
497 | if (lock_policy_rwsem_write(cpu) < 0) | ||
498 | return; | ||
499 | |||
500 | if (!dbs_info->enable) { | ||
501 | unlock_policy_rwsem_write(cpu); | ||
502 | return; | ||
503 | } | ||
504 | 494 | ||
505 | /* Common NORMAL_SAMPLE setup */ | 495 | /* Common NORMAL_SAMPLE setup */ |
506 | dbs_info->sample_type = DBS_NORMAL_SAMPLE; | 496 | dbs_info->sample_type = DBS_NORMAL_SAMPLE; |
@@ -517,7 +507,7 @@ static void do_dbs_timer(struct work_struct *work) | |||
517 | dbs_info->freq_lo, CPUFREQ_RELATION_H); | 507 | dbs_info->freq_lo, CPUFREQ_RELATION_H); |
518 | } | 508 | } |
519 | queue_delayed_work_on(cpu, kondemand_wq, &dbs_info->work, delay); | 509 | queue_delayed_work_on(cpu, kondemand_wq, &dbs_info->work, delay); |
520 | unlock_policy_rwsem_write(cpu); | 510 | mutex_unlock(&dbs_info->timer_mutex); |
521 | } | 511 | } |
522 | 512 | ||
523 | static inline void dbs_timer_init(struct cpu_dbs_info_s *dbs_info) | 513 | static inline void dbs_timer_init(struct cpu_dbs_info_s *dbs_info) |
@@ -526,8 +516,6 @@ static inline void dbs_timer_init(struct cpu_dbs_info_s *dbs_info) | |||
526 | int delay = usecs_to_jiffies(dbs_tuners_ins.sampling_rate); | 516 | int delay = usecs_to_jiffies(dbs_tuners_ins.sampling_rate); |
527 | delay -= jiffies % delay; | 517 | delay -= jiffies % delay; |
528 | 518 | ||
529 | dbs_info->enable = 1; | ||
530 | ondemand_powersave_bias_init(); | ||
531 | dbs_info->sample_type = DBS_NORMAL_SAMPLE; | 519 | dbs_info->sample_type = DBS_NORMAL_SAMPLE; |
532 | INIT_DELAYED_WORK_DEFERRABLE(&dbs_info->work, do_dbs_timer); | 520 | INIT_DELAYED_WORK_DEFERRABLE(&dbs_info->work, do_dbs_timer); |
533 | queue_delayed_work_on(dbs_info->cpu, kondemand_wq, &dbs_info->work, | 521 | queue_delayed_work_on(dbs_info->cpu, kondemand_wq, &dbs_info->work, |
@@ -536,7 +524,6 @@ static inline void dbs_timer_init(struct cpu_dbs_info_s *dbs_info) | |||
536 | 524 | ||
537 | static inline void dbs_timer_exit(struct cpu_dbs_info_s *dbs_info) | 525 | static inline void dbs_timer_exit(struct cpu_dbs_info_s *dbs_info) |
538 | { | 526 | { |
539 | dbs_info->enable = 0; | ||
540 | cancel_delayed_work_sync(&dbs_info->work); | 527 | cancel_delayed_work_sync(&dbs_info->work); |
541 | } | 528 | } |
542 | 529 | ||
@@ -555,19 +542,15 @@ static int cpufreq_governor_dbs(struct cpufreq_policy *policy, | |||
555 | if ((!cpu_online(cpu)) || (!policy->cur)) | 542 | if ((!cpu_online(cpu)) || (!policy->cur)) |
556 | return -EINVAL; | 543 | return -EINVAL; |
557 | 544 | ||
558 | if (this_dbs_info->enable) /* Already enabled */ | ||
559 | break; | ||
560 | |||
561 | mutex_lock(&dbs_mutex); | 545 | mutex_lock(&dbs_mutex); |
562 | dbs_enable++; | ||
563 | 546 | ||
564 | rc = sysfs_create_group(&policy->kobj, &dbs_attr_group); | 547 | rc = sysfs_create_group(&policy->kobj, &dbs_attr_group); |
565 | if (rc) { | 548 | if (rc) { |
566 | dbs_enable--; | ||
567 | mutex_unlock(&dbs_mutex); | 549 | mutex_unlock(&dbs_mutex); |
568 | return rc; | 550 | return rc; |
569 | } | 551 | } |
570 | 552 | ||
553 | dbs_enable++; | ||
571 | for_each_cpu(j, policy->cpus) { | 554 | for_each_cpu(j, policy->cpus) { |
572 | struct cpu_dbs_info_s *j_dbs_info; | 555 | struct cpu_dbs_info_s *j_dbs_info; |
573 | j_dbs_info = &per_cpu(cpu_dbs_info, j); | 556 | j_dbs_info = &per_cpu(cpu_dbs_info, j); |
@@ -581,6 +564,8 @@ static int cpufreq_governor_dbs(struct cpufreq_policy *policy, | |||
581 | } | 564 | } |
582 | } | 565 | } |
583 | this_dbs_info->cpu = cpu; | 566 | this_dbs_info->cpu = cpu; |
567 | ondemand_powersave_bias_init_cpu(cpu); | ||
568 | mutex_init(&this_dbs_info->timer_mutex); | ||
584 | /* | 569 | /* |
585 | * Start the timerschedule work, when this governor | 570 | * Start the timerschedule work, when this governor |
586 | * is used for first time | 571 | * is used for first time |
@@ -598,29 +583,31 @@ static int cpufreq_governor_dbs(struct cpufreq_policy *policy, | |||
598 | max(min_sampling_rate, | 583 | max(min_sampling_rate, |
599 | latency * LATENCY_MULTIPLIER); | 584 | latency * LATENCY_MULTIPLIER); |
600 | } | 585 | } |
601 | dbs_timer_init(this_dbs_info); | ||
602 | |||
603 | mutex_unlock(&dbs_mutex); | 586 | mutex_unlock(&dbs_mutex); |
587 | |||
588 | dbs_timer_init(this_dbs_info); | ||
604 | break; | 589 | break; |
605 | 590 | ||
606 | case CPUFREQ_GOV_STOP: | 591 | case CPUFREQ_GOV_STOP: |
607 | mutex_lock(&dbs_mutex); | ||
608 | dbs_timer_exit(this_dbs_info); | 592 | dbs_timer_exit(this_dbs_info); |
593 | |||
594 | mutex_lock(&dbs_mutex); | ||
609 | sysfs_remove_group(&policy->kobj, &dbs_attr_group); | 595 | sysfs_remove_group(&policy->kobj, &dbs_attr_group); |
596 | mutex_destroy(&this_dbs_info->timer_mutex); | ||
610 | dbs_enable--; | 597 | dbs_enable--; |
611 | mutex_unlock(&dbs_mutex); | 598 | mutex_unlock(&dbs_mutex); |
612 | 599 | ||
613 | break; | 600 | break; |
614 | 601 | ||
615 | case CPUFREQ_GOV_LIMITS: | 602 | case CPUFREQ_GOV_LIMITS: |
616 | mutex_lock(&dbs_mutex); | 603 | mutex_lock(&this_dbs_info->timer_mutex); |
617 | if (policy->max < this_dbs_info->cur_policy->cur) | 604 | if (policy->max < this_dbs_info->cur_policy->cur) |
618 | __cpufreq_driver_target(this_dbs_info->cur_policy, | 605 | __cpufreq_driver_target(this_dbs_info->cur_policy, |
619 | policy->max, CPUFREQ_RELATION_H); | 606 | policy->max, CPUFREQ_RELATION_H); |
620 | else if (policy->min > this_dbs_info->cur_policy->cur) | 607 | else if (policy->min > this_dbs_info->cur_policy->cur) |
621 | __cpufreq_driver_target(this_dbs_info->cur_policy, | 608 | __cpufreq_driver_target(this_dbs_info->cur_policy, |
622 | policy->min, CPUFREQ_RELATION_L); | 609 | policy->min, CPUFREQ_RELATION_L); |
623 | mutex_unlock(&dbs_mutex); | 610 | mutex_unlock(&this_dbs_info->timer_mutex); |
624 | break; | 611 | break; |
625 | } | 612 | } |
626 | return 0; | 613 | return 0; |
diff --git a/drivers/firewire/core-card.c b/drivers/firewire/core-card.c index 543fccac81b..f74edae5cb4 100644 --- a/drivers/firewire/core-card.c +++ b/drivers/firewire/core-card.c | |||
@@ -196,8 +196,8 @@ static void allocate_broadcast_channel(struct fw_card *card, int generation) | |||
196 | { | 196 | { |
197 | int channel, bandwidth = 0; | 197 | int channel, bandwidth = 0; |
198 | 198 | ||
199 | fw_iso_resource_manage(card, generation, 1ULL << 31, | 199 | fw_iso_resource_manage(card, generation, 1ULL << 31, &channel, |
200 | &channel, &bandwidth, true); | 200 | &bandwidth, true, card->bm_transaction_data); |
201 | if (channel == 31) { | 201 | if (channel == 31) { |
202 | card->broadcast_channel_allocated = true; | 202 | card->broadcast_channel_allocated = true; |
203 | device_for_each_child(card->device, (void *)(long)generation, | 203 | device_for_each_child(card->device, (void *)(long)generation, |
@@ -230,7 +230,6 @@ static void fw_card_bm_work(struct work_struct *work) | |||
230 | bool do_reset = false; | 230 | bool do_reset = false; |
231 | bool root_device_is_running; | 231 | bool root_device_is_running; |
232 | bool root_device_is_cmc; | 232 | bool root_device_is_cmc; |
233 | __be32 lock_data[2]; | ||
234 | 233 | ||
235 | spin_lock_irqsave(&card->lock, flags); | 234 | spin_lock_irqsave(&card->lock, flags); |
236 | 235 | ||
@@ -273,22 +272,23 @@ static void fw_card_bm_work(struct work_struct *work) | |||
273 | goto pick_me; | 272 | goto pick_me; |
274 | } | 273 | } |
275 | 274 | ||
276 | lock_data[0] = cpu_to_be32(0x3f); | 275 | card->bm_transaction_data[0] = cpu_to_be32(0x3f); |
277 | lock_data[1] = cpu_to_be32(local_id); | 276 | card->bm_transaction_data[1] = cpu_to_be32(local_id); |
278 | 277 | ||
279 | spin_unlock_irqrestore(&card->lock, flags); | 278 | spin_unlock_irqrestore(&card->lock, flags); |
280 | 279 | ||
281 | rcode = fw_run_transaction(card, TCODE_LOCK_COMPARE_SWAP, | 280 | rcode = fw_run_transaction(card, TCODE_LOCK_COMPARE_SWAP, |
282 | irm_id, generation, SCODE_100, | 281 | irm_id, generation, SCODE_100, |
283 | CSR_REGISTER_BASE + CSR_BUS_MANAGER_ID, | 282 | CSR_REGISTER_BASE + CSR_BUS_MANAGER_ID, |
284 | lock_data, sizeof(lock_data)); | 283 | card->bm_transaction_data, |
284 | sizeof(card->bm_transaction_data)); | ||
285 | 285 | ||
286 | if (rcode == RCODE_GENERATION) | 286 | if (rcode == RCODE_GENERATION) |
287 | /* Another bus reset, BM work has been rescheduled. */ | 287 | /* Another bus reset, BM work has been rescheduled. */ |
288 | goto out; | 288 | goto out; |
289 | 289 | ||
290 | if (rcode == RCODE_COMPLETE && | 290 | if (rcode == RCODE_COMPLETE && |
291 | lock_data[0] != cpu_to_be32(0x3f)) { | 291 | card->bm_transaction_data[0] != cpu_to_be32(0x3f)) { |
292 | 292 | ||
293 | /* Somebody else is BM. Only act as IRM. */ | 293 | /* Somebody else is BM. Only act as IRM. */ |
294 | if (local_id == irm_id) | 294 | if (local_id == irm_id) |
diff --git a/drivers/firewire/core-cdev.c b/drivers/firewire/core-cdev.c index d1d30c615b0..ced186d7e9a 100644 --- a/drivers/firewire/core-cdev.c +++ b/drivers/firewire/core-cdev.c | |||
@@ -125,6 +125,7 @@ struct iso_resource { | |||
125 | int generation; | 125 | int generation; |
126 | u64 channels; | 126 | u64 channels; |
127 | s32 bandwidth; | 127 | s32 bandwidth; |
128 | __be32 transaction_data[2]; | ||
128 | struct iso_resource_event *e_alloc, *e_dealloc; | 129 | struct iso_resource_event *e_alloc, *e_dealloc; |
129 | }; | 130 | }; |
130 | 131 | ||
@@ -1049,7 +1050,8 @@ static void iso_resource_work(struct work_struct *work) | |||
1049 | r->channels, &channel, &bandwidth, | 1050 | r->channels, &channel, &bandwidth, |
1050 | todo == ISO_RES_ALLOC || | 1051 | todo == ISO_RES_ALLOC || |
1051 | todo == ISO_RES_REALLOC || | 1052 | todo == ISO_RES_REALLOC || |
1052 | todo == ISO_RES_ALLOC_ONCE); | 1053 | todo == ISO_RES_ALLOC_ONCE, |
1054 | r->transaction_data); | ||
1053 | /* | 1055 | /* |
1054 | * Is this generation outdated already? As long as this resource sticks | 1056 | * Is this generation outdated already? As long as this resource sticks |
1055 | * in the idr, it will be scheduled again for a newer generation or at | 1057 | * in the idr, it will be scheduled again for a newer generation or at |
diff --git a/drivers/firewire/core-iso.c b/drivers/firewire/core-iso.c index 166f19c6d38..110e731f557 100644 --- a/drivers/firewire/core-iso.c +++ b/drivers/firewire/core-iso.c | |||
@@ -177,9 +177,8 @@ EXPORT_SYMBOL(fw_iso_context_stop); | |||
177 | */ | 177 | */ |
178 | 178 | ||
179 | static int manage_bandwidth(struct fw_card *card, int irm_id, int generation, | 179 | static int manage_bandwidth(struct fw_card *card, int irm_id, int generation, |
180 | int bandwidth, bool allocate) | 180 | int bandwidth, bool allocate, __be32 data[2]) |
181 | { | 181 | { |
182 | __be32 data[2]; | ||
183 | int try, new, old = allocate ? BANDWIDTH_AVAILABLE_INITIAL : 0; | 182 | int try, new, old = allocate ? BANDWIDTH_AVAILABLE_INITIAL : 0; |
184 | 183 | ||
185 | /* | 184 | /* |
@@ -215,9 +214,9 @@ static int manage_bandwidth(struct fw_card *card, int irm_id, int generation, | |||
215 | } | 214 | } |
216 | 215 | ||
217 | static int manage_channel(struct fw_card *card, int irm_id, int generation, | 216 | static int manage_channel(struct fw_card *card, int irm_id, int generation, |
218 | u32 channels_mask, u64 offset, bool allocate) | 217 | u32 channels_mask, u64 offset, bool allocate, __be32 data[2]) |
219 | { | 218 | { |
220 | __be32 data[2], c, all, old; | 219 | __be32 c, all, old; |
221 | int i, retry = 5; | 220 | int i, retry = 5; |
222 | 221 | ||
223 | old = all = allocate ? cpu_to_be32(~0) : 0; | 222 | old = all = allocate ? cpu_to_be32(~0) : 0; |
@@ -260,7 +259,7 @@ static int manage_channel(struct fw_card *card, int irm_id, int generation, | |||
260 | } | 259 | } |
261 | 260 | ||
262 | static void deallocate_channel(struct fw_card *card, int irm_id, | 261 | static void deallocate_channel(struct fw_card *card, int irm_id, |
263 | int generation, int channel) | 262 | int generation, int channel, __be32 buffer[2]) |
264 | { | 263 | { |
265 | u32 mask; | 264 | u32 mask; |
266 | u64 offset; | 265 | u64 offset; |
@@ -269,7 +268,7 @@ static void deallocate_channel(struct fw_card *card, int irm_id, | |||
269 | offset = channel < 32 ? CSR_REGISTER_BASE + CSR_CHANNELS_AVAILABLE_HI : | 268 | offset = channel < 32 ? CSR_REGISTER_BASE + CSR_CHANNELS_AVAILABLE_HI : |
270 | CSR_REGISTER_BASE + CSR_CHANNELS_AVAILABLE_LO; | 269 | CSR_REGISTER_BASE + CSR_CHANNELS_AVAILABLE_LO; |
271 | 270 | ||
272 | manage_channel(card, irm_id, generation, mask, offset, false); | 271 | manage_channel(card, irm_id, generation, mask, offset, false, buffer); |
273 | } | 272 | } |
274 | 273 | ||
275 | /** | 274 | /** |
@@ -298,7 +297,7 @@ static void deallocate_channel(struct fw_card *card, int irm_id, | |||
298 | */ | 297 | */ |
299 | void fw_iso_resource_manage(struct fw_card *card, int generation, | 298 | void fw_iso_resource_manage(struct fw_card *card, int generation, |
300 | u64 channels_mask, int *channel, int *bandwidth, | 299 | u64 channels_mask, int *channel, int *bandwidth, |
301 | bool allocate) | 300 | bool allocate, __be32 buffer[2]) |
302 | { | 301 | { |
303 | u32 channels_hi = channels_mask; /* channels 31...0 */ | 302 | u32 channels_hi = channels_mask; /* channels 31...0 */ |
304 | u32 channels_lo = channels_mask >> 32; /* channels 63...32 */ | 303 | u32 channels_lo = channels_mask >> 32; /* channels 63...32 */ |
@@ -310,10 +309,12 @@ void fw_iso_resource_manage(struct fw_card *card, int generation, | |||
310 | 309 | ||
311 | if (channels_hi) | 310 | if (channels_hi) |
312 | c = manage_channel(card, irm_id, generation, channels_hi, | 311 | c = manage_channel(card, irm_id, generation, channels_hi, |
313 | CSR_REGISTER_BASE + CSR_CHANNELS_AVAILABLE_HI, allocate); | 312 | CSR_REGISTER_BASE + CSR_CHANNELS_AVAILABLE_HI, |
313 | allocate, buffer); | ||
314 | if (channels_lo && c < 0) { | 314 | if (channels_lo && c < 0) { |
315 | c = manage_channel(card, irm_id, generation, channels_lo, | 315 | c = manage_channel(card, irm_id, generation, channels_lo, |
316 | CSR_REGISTER_BASE + CSR_CHANNELS_AVAILABLE_LO, allocate); | 316 | CSR_REGISTER_BASE + CSR_CHANNELS_AVAILABLE_LO, |
317 | allocate, buffer); | ||
317 | if (c >= 0) | 318 | if (c >= 0) |
318 | c += 32; | 319 | c += 32; |
319 | } | 320 | } |
@@ -325,12 +326,13 @@ void fw_iso_resource_manage(struct fw_card *card, int generation, | |||
325 | if (*bandwidth == 0) | 326 | if (*bandwidth == 0) |
326 | return; | 327 | return; |
327 | 328 | ||
328 | ret = manage_bandwidth(card, irm_id, generation, *bandwidth, allocate); | 329 | ret = manage_bandwidth(card, irm_id, generation, *bandwidth, |
330 | allocate, buffer); | ||
329 | if (ret < 0) | 331 | if (ret < 0) |
330 | *bandwidth = 0; | 332 | *bandwidth = 0; |
331 | 333 | ||
332 | if (allocate && ret < 0 && c >= 0) { | 334 | if (allocate && ret < 0 && c >= 0) { |
333 | deallocate_channel(card, irm_id, generation, c); | 335 | deallocate_channel(card, irm_id, generation, c, buffer); |
334 | *channel = ret; | 336 | *channel = ret; |
335 | } | 337 | } |
336 | } | 338 | } |
diff --git a/drivers/firewire/core.h b/drivers/firewire/core.h index c3cfc647e5e..6052816be35 100644 --- a/drivers/firewire/core.h +++ b/drivers/firewire/core.h | |||
@@ -120,7 +120,8 @@ void fw_node_event(struct fw_card *card, struct fw_node *node, int event); | |||
120 | 120 | ||
121 | int fw_iso_buffer_map(struct fw_iso_buffer *buffer, struct vm_area_struct *vma); | 121 | int fw_iso_buffer_map(struct fw_iso_buffer *buffer, struct vm_area_struct *vma); |
122 | void fw_iso_resource_manage(struct fw_card *card, int generation, | 122 | void fw_iso_resource_manage(struct fw_card *card, int generation, |
123 | u64 channels_mask, int *channel, int *bandwidth, bool allocate); | 123 | u64 channels_mask, int *channel, int *bandwidth, |
124 | bool allocate, __be32 buffer[2]); | ||
124 | 125 | ||
125 | 126 | ||
126 | /* -topology */ | 127 | /* -topology */ |
diff --git a/drivers/firewire/sbp2.c b/drivers/firewire/sbp2.c index 24c45635376..8d51568ee14 100644 --- a/drivers/firewire/sbp2.c +++ b/drivers/firewire/sbp2.c | |||
@@ -201,6 +201,12 @@ static struct fw_device *target_device(struct sbp2_target *tgt) | |||
201 | #define SBP2_CYCLE_LIMIT (0xc8 << 12) /* 200 125us cycles */ | 201 | #define SBP2_CYCLE_LIMIT (0xc8 << 12) /* 200 125us cycles */ |
202 | 202 | ||
203 | /* | 203 | /* |
204 | * There is no transport protocol limit to the CDB length, but we implement | ||
205 | * a fixed length only. 16 bytes is enough for disks larger than 2 TB. | ||
206 | */ | ||
207 | #define SBP2_MAX_CDB_SIZE 16 | ||
208 | |||
209 | /* | ||
204 | * The default maximum s/g segment size of a FireWire controller is | 210 | * The default maximum s/g segment size of a FireWire controller is |
205 | * usually 0x10000, but SBP-2 only allows 0xffff. Since buffers have to | 211 | * usually 0x10000, but SBP-2 only allows 0xffff. Since buffers have to |
206 | * be quadlet-aligned, we set the length limit to 0xffff & ~3. | 212 | * be quadlet-aligned, we set the length limit to 0xffff & ~3. |
@@ -312,7 +318,7 @@ struct sbp2_command_orb { | |||
312 | struct sbp2_pointer next; | 318 | struct sbp2_pointer next; |
313 | struct sbp2_pointer data_descriptor; | 319 | struct sbp2_pointer data_descriptor; |
314 | __be32 misc; | 320 | __be32 misc; |
315 | u8 command_block[12]; | 321 | u8 command_block[SBP2_MAX_CDB_SIZE]; |
316 | } request; | 322 | } request; |
317 | struct scsi_cmnd *cmd; | 323 | struct scsi_cmnd *cmd; |
318 | scsi_done_fn_t done; | 324 | scsi_done_fn_t done; |
@@ -1146,6 +1152,8 @@ static int sbp2_probe(struct device *dev) | |||
1146 | if (fw_device_enable_phys_dma(device) < 0) | 1152 | if (fw_device_enable_phys_dma(device) < 0) |
1147 | goto fail_shost_put; | 1153 | goto fail_shost_put; |
1148 | 1154 | ||
1155 | shost->max_cmd_len = SBP2_MAX_CDB_SIZE; | ||
1156 | |||
1149 | if (scsi_add_host(shost, &unit->device) < 0) | 1157 | if (scsi_add_host(shost, &unit->device) < 0) |
1150 | goto fail_shost_put; | 1158 | goto fail_shost_put; |
1151 | 1159 | ||
diff --git a/drivers/gpu/drm/drm_crtc_helper.c b/drivers/gpu/drm/drm_crtc_helper.c index a6f73f1e99d..3da9cfa3184 100644 --- a/drivers/gpu/drm/drm_crtc_helper.c +++ b/drivers/gpu/drm/drm_crtc_helper.c | |||
@@ -1090,6 +1090,8 @@ int drm_helper_resume_force_mode(struct drm_device *dev) | |||
1090 | if (ret == false) | 1090 | if (ret == false) |
1091 | DRM_ERROR("failed to set mode on crtc %p\n", crtc); | 1091 | DRM_ERROR("failed to set mode on crtc %p\n", crtc); |
1092 | } | 1092 | } |
1093 | /* disable the unused connectors while restoring the modesetting */ | ||
1094 | drm_helper_disable_unused_functions(dev); | ||
1093 | return 0; | 1095 | return 0; |
1094 | } | 1096 | } |
1095 | EXPORT_SYMBOL(drm_helper_resume_force_mode); | 1097 | EXPORT_SYMBOL(drm_helper_resume_force_mode); |
diff --git a/drivers/gpu/drm/i915/i915_dma.c b/drivers/gpu/drm/i915/i915_dma.c index f112c769d53..8c4783180bf 100644 --- a/drivers/gpu/drm/i915/i915_dma.c +++ b/drivers/gpu/drm/i915/i915_dma.c | |||
@@ -846,7 +846,7 @@ static int i915_set_status_page(struct drm_device *dev, void *data, | |||
846 | return 0; | 846 | return 0; |
847 | } | 847 | } |
848 | 848 | ||
849 | printk(KERN_DEBUG "set status page addr 0x%08x\n", (u32)hws->addr); | 849 | DRM_DEBUG("set status page addr 0x%08x\n", (u32)hws->addr); |
850 | 850 | ||
851 | dev_priv->status_gfx_addr = hws->addr & (0x1ffff<<12); | 851 | dev_priv->status_gfx_addr = hws->addr & (0x1ffff<<12); |
852 | 852 | ||
@@ -885,8 +885,8 @@ static int i915_set_status_page(struct drm_device *dev, void *data, | |||
885 | * some RAM for the framebuffer at early boot. This code figures out | 885 | * some RAM for the framebuffer at early boot. This code figures out |
886 | * how much was set aside so we can use it for our own purposes. | 886 | * how much was set aside so we can use it for our own purposes. |
887 | */ | 887 | */ |
888 | static int i915_probe_agp(struct drm_device *dev, unsigned long *aperture_size, | 888 | static int i915_probe_agp(struct drm_device *dev, uint32_t *aperture_size, |
889 | unsigned long *preallocated_size) | 889 | uint32_t *preallocated_size) |
890 | { | 890 | { |
891 | struct pci_dev *bridge_dev; | 891 | struct pci_dev *bridge_dev; |
892 | u16 tmp = 0; | 892 | u16 tmp = 0; |
@@ -984,10 +984,11 @@ static int i915_probe_agp(struct drm_device *dev, unsigned long *aperture_size, | |||
984 | return 0; | 984 | return 0; |
985 | } | 985 | } |
986 | 986 | ||
987 | static int i915_load_modeset_init(struct drm_device *dev) | 987 | static int i915_load_modeset_init(struct drm_device *dev, |
988 | unsigned long prealloc_size, | ||
989 | unsigned long agp_size) | ||
988 | { | 990 | { |
989 | struct drm_i915_private *dev_priv = dev->dev_private; | 991 | struct drm_i915_private *dev_priv = dev->dev_private; |
990 | unsigned long agp_size, prealloc_size; | ||
991 | int fb_bar = IS_I9XX(dev) ? 2 : 0; | 992 | int fb_bar = IS_I9XX(dev) ? 2 : 0; |
992 | int ret = 0; | 993 | int ret = 0; |
993 | 994 | ||
@@ -1002,10 +1003,6 @@ static int i915_load_modeset_init(struct drm_device *dev) | |||
1002 | if (IS_I965G(dev) || IS_G33(dev)) | 1003 | if (IS_I965G(dev) || IS_G33(dev)) |
1003 | dev_priv->cursor_needs_physical = false; | 1004 | dev_priv->cursor_needs_physical = false; |
1004 | 1005 | ||
1005 | ret = i915_probe_agp(dev, &agp_size, &prealloc_size); | ||
1006 | if (ret) | ||
1007 | goto out; | ||
1008 | |||
1009 | /* Basic memrange allocator for stolen space (aka vram) */ | 1006 | /* Basic memrange allocator for stolen space (aka vram) */ |
1010 | drm_mm_init(&dev_priv->vram, 0, prealloc_size); | 1007 | drm_mm_init(&dev_priv->vram, 0, prealloc_size); |
1011 | 1008 | ||
@@ -1082,6 +1079,44 @@ void i915_master_destroy(struct drm_device *dev, struct drm_master *master) | |||
1082 | master->driver_priv = NULL; | 1079 | master->driver_priv = NULL; |
1083 | } | 1080 | } |
1084 | 1081 | ||
1082 | static void i915_get_mem_freq(struct drm_device *dev) | ||
1083 | { | ||
1084 | drm_i915_private_t *dev_priv = dev->dev_private; | ||
1085 | u32 tmp; | ||
1086 | |||
1087 | if (!IS_IGD(dev)) | ||
1088 | return; | ||
1089 | |||
1090 | tmp = I915_READ(CLKCFG); | ||
1091 | |||
1092 | switch (tmp & CLKCFG_FSB_MASK) { | ||
1093 | case CLKCFG_FSB_533: | ||
1094 | dev_priv->fsb_freq = 533; /* 133*4 */ | ||
1095 | break; | ||
1096 | case CLKCFG_FSB_800: | ||
1097 | dev_priv->fsb_freq = 800; /* 200*4 */ | ||
1098 | break; | ||
1099 | case CLKCFG_FSB_667: | ||
1100 | dev_priv->fsb_freq = 667; /* 167*4 */ | ||
1101 | break; | ||
1102 | case CLKCFG_FSB_400: | ||
1103 | dev_priv->fsb_freq = 400; /* 100*4 */ | ||
1104 | break; | ||
1105 | } | ||
1106 | |||
1107 | switch (tmp & CLKCFG_MEM_MASK) { | ||
1108 | case CLKCFG_MEM_533: | ||
1109 | dev_priv->mem_freq = 533; | ||
1110 | break; | ||
1111 | case CLKCFG_MEM_667: | ||
1112 | dev_priv->mem_freq = 667; | ||
1113 | break; | ||
1114 | case CLKCFG_MEM_800: | ||
1115 | dev_priv->mem_freq = 800; | ||
1116 | break; | ||
1117 | } | ||
1118 | } | ||
1119 | |||
1085 | /** | 1120 | /** |
1086 | * i915_driver_load - setup chip and create an initial config | 1121 | * i915_driver_load - setup chip and create an initial config |
1087 | * @dev: DRM device | 1122 | * @dev: DRM device |
@@ -1098,6 +1133,7 @@ int i915_driver_load(struct drm_device *dev, unsigned long flags) | |||
1098 | struct drm_i915_private *dev_priv = dev->dev_private; | 1133 | struct drm_i915_private *dev_priv = dev->dev_private; |
1099 | resource_size_t base, size; | 1134 | resource_size_t base, size; |
1100 | int ret = 0, mmio_bar = IS_I9XX(dev) ? 0 : 1; | 1135 | int ret = 0, mmio_bar = IS_I9XX(dev) ? 0 : 1; |
1136 | uint32_t agp_size, prealloc_size; | ||
1101 | 1137 | ||
1102 | /* i915 has 4 more counters */ | 1138 | /* i915 has 4 more counters */ |
1103 | dev->counters += 4; | 1139 | dev->counters += 4; |
@@ -1146,9 +1182,22 @@ int i915_driver_load(struct drm_device *dev, unsigned long flags) | |||
1146 | "performance may suffer.\n"); | 1182 | "performance may suffer.\n"); |
1147 | } | 1183 | } |
1148 | 1184 | ||
1185 | ret = i915_probe_agp(dev, &agp_size, &prealloc_size); | ||
1186 | if (ret) | ||
1187 | goto out_iomapfree; | ||
1188 | |||
1149 | /* enable GEM by default */ | 1189 | /* enable GEM by default */ |
1150 | dev_priv->has_gem = 1; | 1190 | dev_priv->has_gem = 1; |
1151 | 1191 | ||
1192 | if (prealloc_size > agp_size * 3 / 4) { | ||
1193 | DRM_ERROR("Detected broken video BIOS with %d/%dkB of video " | ||
1194 | "memory stolen.\n", | ||
1195 | prealloc_size / 1024, agp_size / 1024); | ||
1196 | DRM_ERROR("Disabling GEM. (try reducing stolen memory or " | ||
1197 | "updating the BIOS to fix).\n"); | ||
1198 | dev_priv->has_gem = 0; | ||
1199 | } | ||
1200 | |||
1152 | dev->driver->get_vblank_counter = i915_get_vblank_counter; | 1201 | dev->driver->get_vblank_counter = i915_get_vblank_counter; |
1153 | dev->max_vblank_count = 0xffffff; /* only 24 bits of frame count */ | 1202 | dev->max_vblank_count = 0xffffff; /* only 24 bits of frame count */ |
1154 | if (IS_G4X(dev) || IS_IGDNG(dev)) { | 1203 | if (IS_G4X(dev) || IS_IGDNG(dev)) { |
@@ -1165,6 +1214,8 @@ int i915_driver_load(struct drm_device *dev, unsigned long flags) | |||
1165 | goto out_iomapfree; | 1214 | goto out_iomapfree; |
1166 | } | 1215 | } |
1167 | 1216 | ||
1217 | i915_get_mem_freq(dev); | ||
1218 | |||
1168 | /* On the 945G/GM, the chipset reports the MSI capability on the | 1219 | /* On the 945G/GM, the chipset reports the MSI capability on the |
1169 | * integrated graphics even though the support isn't actually there | 1220 | * integrated graphics even though the support isn't actually there |
1170 | * according to the published specs. It doesn't appear to function | 1221 | * according to the published specs. It doesn't appear to function |
@@ -1180,6 +1231,7 @@ int i915_driver_load(struct drm_device *dev, unsigned long flags) | |||
1180 | pci_enable_msi(dev->pdev); | 1231 | pci_enable_msi(dev->pdev); |
1181 | 1232 | ||
1182 | spin_lock_init(&dev_priv->user_irq_lock); | 1233 | spin_lock_init(&dev_priv->user_irq_lock); |
1234 | spin_lock_init(&dev_priv->error_lock); | ||
1183 | dev_priv->user_irq_refcount = 0; | 1235 | dev_priv->user_irq_refcount = 0; |
1184 | 1236 | ||
1185 | ret = drm_vblank_init(dev, I915_NUM_PIPE); | 1237 | ret = drm_vblank_init(dev, I915_NUM_PIPE); |
@@ -1190,7 +1242,7 @@ int i915_driver_load(struct drm_device *dev, unsigned long flags) | |||
1190 | } | 1242 | } |
1191 | 1243 | ||
1192 | if (drm_core_check_feature(dev, DRIVER_MODESET)) { | 1244 | if (drm_core_check_feature(dev, DRIVER_MODESET)) { |
1193 | ret = i915_load_modeset_init(dev); | 1245 | ret = i915_load_modeset_init(dev, prealloc_size, agp_size); |
1194 | if (ret < 0) { | 1246 | if (ret < 0) { |
1195 | DRM_ERROR("failed to init modeset\n"); | 1247 | DRM_ERROR("failed to init modeset\n"); |
1196 | goto out_rmmap; | 1248 | goto out_rmmap; |
diff --git a/drivers/gpu/drm/i915/i915_drv.c b/drivers/gpu/drm/i915/i915_drv.c index e3cb4025e32..fc4b68aa2d0 100644 --- a/drivers/gpu/drm/i915/i915_drv.c +++ b/drivers/gpu/drm/i915/i915_drv.c | |||
@@ -35,6 +35,7 @@ | |||
35 | 35 | ||
36 | #include "drm_pciids.h" | 36 | #include "drm_pciids.h" |
37 | #include <linux/console.h> | 37 | #include <linux/console.h> |
38 | #include "drm_crtc_helper.h" | ||
38 | 39 | ||
39 | static unsigned int i915_modeset = -1; | 40 | static unsigned int i915_modeset = -1; |
40 | module_param_named(modeset, i915_modeset, int, 0400); | 41 | module_param_named(modeset, i915_modeset, int, 0400); |
@@ -57,8 +58,8 @@ static int i915_suspend(struct drm_device *dev, pm_message_t state) | |||
57 | struct drm_i915_private *dev_priv = dev->dev_private; | 58 | struct drm_i915_private *dev_priv = dev->dev_private; |
58 | 59 | ||
59 | if (!dev || !dev_priv) { | 60 | if (!dev || !dev_priv) { |
60 | printk(KERN_ERR "dev: %p, dev_priv: %p\n", dev, dev_priv); | 61 | DRM_ERROR("dev: %p, dev_priv: %p\n", dev, dev_priv); |
61 | printk(KERN_ERR "DRM not initialized, aborting suspend.\n"); | 62 | DRM_ERROR("DRM not initialized, aborting suspend.\n"); |
62 | return -ENODEV; | 63 | return -ENODEV; |
63 | } | 64 | } |
64 | 65 | ||
@@ -115,6 +116,10 @@ static int i915_resume(struct drm_device *dev) | |||
115 | 116 | ||
116 | drm_irq_install(dev); | 117 | drm_irq_install(dev); |
117 | } | 118 | } |
119 | if (drm_core_check_feature(dev, DRIVER_MODESET)) { | ||
120 | /* Resume the modeset for every activated CRTC */ | ||
121 | drm_helper_resume_force_mode(dev); | ||
122 | } | ||
118 | 123 | ||
119 | return ret; | 124 | return ret; |
120 | } | 125 | } |
diff --git a/drivers/gpu/drm/i915/i915_drv.h b/drivers/gpu/drm/i915/i915_drv.h index bb4c2d387b6..d0875287588 100644 --- a/drivers/gpu/drm/i915/i915_drv.h +++ b/drivers/gpu/drm/i915/i915_drv.h | |||
@@ -133,6 +133,22 @@ struct sdvo_device_mapping { | |||
133 | u8 initialized; | 133 | u8 initialized; |
134 | }; | 134 | }; |
135 | 135 | ||
136 | struct drm_i915_error_state { | ||
137 | u32 eir; | ||
138 | u32 pgtbl_er; | ||
139 | u32 pipeastat; | ||
140 | u32 pipebstat; | ||
141 | u32 ipeir; | ||
142 | u32 ipehr; | ||
143 | u32 instdone; | ||
144 | u32 acthd; | ||
145 | u32 instpm; | ||
146 | u32 instps; | ||
147 | u32 instdone1; | ||
148 | u32 seqno; | ||
149 | struct timeval time; | ||
150 | }; | ||
151 | |||
136 | typedef struct drm_i915_private { | 152 | typedef struct drm_i915_private { |
137 | struct drm_device *dev; | 153 | struct drm_device *dev; |
138 | 154 | ||
@@ -209,6 +225,11 @@ typedef struct drm_i915_private { | |||
209 | int fence_reg_start; /* 4 if userland hasn't ioctl'd us yet */ | 225 | int fence_reg_start; /* 4 if userland hasn't ioctl'd us yet */ |
210 | int num_fence_regs; /* 8 on pre-965, 16 otherwise */ | 226 | int num_fence_regs; /* 8 on pre-965, 16 otherwise */ |
211 | 227 | ||
228 | unsigned int fsb_freq, mem_freq; | ||
229 | |||
230 | spinlock_t error_lock; | ||
231 | struct drm_i915_error_state *first_error; | ||
232 | |||
212 | /* Register state */ | 233 | /* Register state */ |
213 | u8 saveLBB; | 234 | u8 saveLBB; |
214 | u32 saveDSPACNTR; | 235 | u32 saveDSPACNTR; |
@@ -468,9 +489,6 @@ struct drm_i915_gem_object { | |||
468 | */ | 489 | */ |
469 | int fence_reg; | 490 | int fence_reg; |
470 | 491 | ||
471 | /** Boolean whether this object has a valid gtt offset. */ | ||
472 | int gtt_bound; | ||
473 | |||
474 | /** How many users have pinned this object in GTT space */ | 492 | /** How many users have pinned this object in GTT space */ |
475 | int pin_count; | 493 | int pin_count; |
476 | 494 | ||
@@ -655,6 +673,7 @@ void i915_gem_free_object(struct drm_gem_object *obj); | |||
655 | int i915_gem_object_pin(struct drm_gem_object *obj, uint32_t alignment); | 673 | int i915_gem_object_pin(struct drm_gem_object *obj, uint32_t alignment); |
656 | void i915_gem_object_unpin(struct drm_gem_object *obj); | 674 | void i915_gem_object_unpin(struct drm_gem_object *obj); |
657 | int i915_gem_object_unbind(struct drm_gem_object *obj); | 675 | int i915_gem_object_unbind(struct drm_gem_object *obj); |
676 | void i915_gem_release_mmap(struct drm_gem_object *obj); | ||
658 | void i915_gem_lastclose(struct drm_device *dev); | 677 | void i915_gem_lastclose(struct drm_device *dev); |
659 | uint32_t i915_get_gem_seqno(struct drm_device *dev); | 678 | uint32_t i915_get_gem_seqno(struct drm_device *dev); |
660 | int i915_gem_object_get_fence_reg(struct drm_gem_object *obj); | 679 | int i915_gem_object_get_fence_reg(struct drm_gem_object *obj); |
@@ -870,6 +889,8 @@ extern int i915_wait_ring(struct drm_device * dev, int n, const char *caller); | |||
870 | #define SUPPORTS_INTEGRATED_HDMI(dev) (IS_G4X(dev) || IS_IGDNG(dev)) | 889 | #define SUPPORTS_INTEGRATED_HDMI(dev) (IS_G4X(dev) || IS_IGDNG(dev)) |
871 | #define SUPPORTS_INTEGRATED_DP(dev) (IS_G4X(dev) || IS_IGDNG(dev)) | 890 | #define SUPPORTS_INTEGRATED_DP(dev) (IS_G4X(dev) || IS_IGDNG(dev)) |
872 | #define I915_HAS_HOTPLUG(dev) (IS_I945G(dev) || IS_I945GM(dev) || IS_I965G(dev)) | 891 | #define I915_HAS_HOTPLUG(dev) (IS_I945G(dev) || IS_I945GM(dev) || IS_I965G(dev)) |
892 | /* dsparb controlled by hw only */ | ||
893 | #define DSPARB_HWCONTROL(dev) (IS_G4X(dev) || IS_IGDNG(dev)) | ||
873 | 894 | ||
874 | #define PRIMARY_RINGBUFFER_SIZE (128*1024) | 895 | #define PRIMARY_RINGBUFFER_SIZE (128*1024) |
875 | 896 | ||
diff --git a/drivers/gpu/drm/i915/i915_gem.c b/drivers/gpu/drm/i915/i915_gem.c index 876b65cb762..5bf420378b6 100644 --- a/drivers/gpu/drm/i915/i915_gem.c +++ b/drivers/gpu/drm/i915/i915_gem.c | |||
@@ -1252,6 +1252,31 @@ out_free_list: | |||
1252 | return ret; | 1252 | return ret; |
1253 | } | 1253 | } |
1254 | 1254 | ||
1255 | /** | ||
1256 | * i915_gem_release_mmap - remove physical page mappings | ||
1257 | * @obj: obj in question | ||
1258 | * | ||
1259 | * Preserve the reservation of the mmaping with the DRM core code, but | ||
1260 | * relinquish ownership of the pages back to the system. | ||
1261 | * | ||
1262 | * It is vital that we remove the page mapping if we have mapped a tiled | ||
1263 | * object through the GTT and then lose the fence register due to | ||
1264 | * resource pressure. Similarly if the object has been moved out of the | ||
1265 | * aperture, than pages mapped into userspace must be revoked. Removing the | ||
1266 | * mapping will then trigger a page fault on the next user access, allowing | ||
1267 | * fixup by i915_gem_fault(). | ||
1268 | */ | ||
1269 | void | ||
1270 | i915_gem_release_mmap(struct drm_gem_object *obj) | ||
1271 | { | ||
1272 | struct drm_device *dev = obj->dev; | ||
1273 | struct drm_i915_gem_object *obj_priv = obj->driver_private; | ||
1274 | |||
1275 | if (dev->dev_mapping) | ||
1276 | unmap_mapping_range(dev->dev_mapping, | ||
1277 | obj_priv->mmap_offset, obj->size, 1); | ||
1278 | } | ||
1279 | |||
1255 | static void | 1280 | static void |
1256 | i915_gem_free_mmap_offset(struct drm_gem_object *obj) | 1281 | i915_gem_free_mmap_offset(struct drm_gem_object *obj) |
1257 | { | 1282 | { |
@@ -1861,7 +1886,6 @@ i915_gem_object_unbind(struct drm_gem_object *obj) | |||
1861 | { | 1886 | { |
1862 | struct drm_device *dev = obj->dev; | 1887 | struct drm_device *dev = obj->dev; |
1863 | struct drm_i915_gem_object *obj_priv = obj->driver_private; | 1888 | struct drm_i915_gem_object *obj_priv = obj->driver_private; |
1864 | loff_t offset; | ||
1865 | int ret = 0; | 1889 | int ret = 0; |
1866 | 1890 | ||
1867 | #if WATCH_BUF | 1891 | #if WATCH_BUF |
@@ -1898,9 +1922,7 @@ i915_gem_object_unbind(struct drm_gem_object *obj) | |||
1898 | BUG_ON(obj_priv->active); | 1922 | BUG_ON(obj_priv->active); |
1899 | 1923 | ||
1900 | /* blow away mappings if mapped through GTT */ | 1924 | /* blow away mappings if mapped through GTT */ |
1901 | offset = ((loff_t) obj->map_list.hash.key) << PAGE_SHIFT; | 1925 | i915_gem_release_mmap(obj); |
1902 | if (dev->dev_mapping) | ||
1903 | unmap_mapping_range(dev->dev_mapping, offset, obj->size, 1); | ||
1904 | 1926 | ||
1905 | if (obj_priv->fence_reg != I915_FENCE_REG_NONE) | 1927 | if (obj_priv->fence_reg != I915_FENCE_REG_NONE) |
1906 | i915_gem_clear_fence_reg(obj); | 1928 | i915_gem_clear_fence_reg(obj); |
@@ -2222,7 +2244,6 @@ try_again: | |||
2222 | /* None available, try to steal one or wait for a user to finish */ | 2244 | /* None available, try to steal one or wait for a user to finish */ |
2223 | if (i == dev_priv->num_fence_regs) { | 2245 | if (i == dev_priv->num_fence_regs) { |
2224 | uint32_t seqno = dev_priv->mm.next_gem_seqno; | 2246 | uint32_t seqno = dev_priv->mm.next_gem_seqno; |
2225 | loff_t offset; | ||
2226 | 2247 | ||
2227 | if (avail == 0) | 2248 | if (avail == 0) |
2228 | return -ENOSPC; | 2249 | return -ENOSPC; |
@@ -2274,10 +2295,7 @@ try_again: | |||
2274 | * Zap this virtual mapping so we can set up a fence again | 2295 | * Zap this virtual mapping so we can set up a fence again |
2275 | * for this object next time we need it. | 2296 | * for this object next time we need it. |
2276 | */ | 2297 | */ |
2277 | offset = ((loff_t) reg->obj->map_list.hash.key) << PAGE_SHIFT; | 2298 | i915_gem_release_mmap(reg->obj); |
2278 | if (dev->dev_mapping) | ||
2279 | unmap_mapping_range(dev->dev_mapping, offset, | ||
2280 | reg->obj->size, 1); | ||
2281 | old_obj_priv->fence_reg = I915_FENCE_REG_NONE; | 2299 | old_obj_priv->fence_reg = I915_FENCE_REG_NONE; |
2282 | } | 2300 | } |
2283 | 2301 | ||
diff --git a/drivers/gpu/drm/i915/i915_gem_debugfs.c b/drivers/gpu/drm/i915/i915_gem_debugfs.c index 28146e405e8..9a44bfcb813 100644 --- a/drivers/gpu/drm/i915/i915_gem_debugfs.c +++ b/drivers/gpu/drm/i915/i915_gem_debugfs.c | |||
@@ -75,11 +75,10 @@ static int i915_gem_object_list_info(struct seq_file *m, void *data) | |||
75 | case ACTIVE_LIST: | 75 | case ACTIVE_LIST: |
76 | seq_printf(m, "Active:\n"); | 76 | seq_printf(m, "Active:\n"); |
77 | lock = &dev_priv->mm.active_list_lock; | 77 | lock = &dev_priv->mm.active_list_lock; |
78 | spin_lock(lock); | ||
79 | head = &dev_priv->mm.active_list; | 78 | head = &dev_priv->mm.active_list; |
80 | break; | 79 | break; |
81 | case INACTIVE_LIST: | 80 | case INACTIVE_LIST: |
82 | seq_printf(m, "Inctive:\n"); | 81 | seq_printf(m, "Inactive:\n"); |
83 | head = &dev_priv->mm.inactive_list; | 82 | head = &dev_priv->mm.inactive_list; |
84 | break; | 83 | break; |
85 | case FLUSHING_LIST: | 84 | case FLUSHING_LIST: |
@@ -91,6 +90,8 @@ static int i915_gem_object_list_info(struct seq_file *m, void *data) | |||
91 | return 0; | 90 | return 0; |
92 | } | 91 | } |
93 | 92 | ||
93 | if (lock) | ||
94 | spin_lock(lock); | ||
94 | list_for_each_entry(obj_priv, head, list) | 95 | list_for_each_entry(obj_priv, head, list) |
95 | { | 96 | { |
96 | struct drm_gem_object *obj = obj_priv->obj; | 97 | struct drm_gem_object *obj = obj_priv->obj; |
@@ -104,7 +105,10 @@ static int i915_gem_object_list_info(struct seq_file *m, void *data) | |||
104 | if (obj->name) | 105 | if (obj->name) |
105 | seq_printf(m, " (name: %d)", obj->name); | 106 | seq_printf(m, " (name: %d)", obj->name); |
106 | if (obj_priv->fence_reg != I915_FENCE_REG_NONE) | 107 | if (obj_priv->fence_reg != I915_FENCE_REG_NONE) |
107 | seq_printf(m, " (fence: %d)\n", obj_priv->fence_reg); | 108 | seq_printf(m, " (fence: %d)", obj_priv->fence_reg); |
109 | if (obj_priv->gtt_space != NULL) | ||
110 | seq_printf(m, " (gtt_offset: %08x)", obj_priv->gtt_offset); | ||
111 | |||
108 | seq_printf(m, "\n"); | 112 | seq_printf(m, "\n"); |
109 | } | 113 | } |
110 | 114 | ||
@@ -323,6 +327,39 @@ static int i915_ringbuffer_info(struct seq_file *m, void *data) | |||
323 | return 0; | 327 | return 0; |
324 | } | 328 | } |
325 | 329 | ||
330 | static int i915_error_state(struct seq_file *m, void *unused) | ||
331 | { | ||
332 | struct drm_info_node *node = (struct drm_info_node *) m->private; | ||
333 | struct drm_device *dev = node->minor->dev; | ||
334 | drm_i915_private_t *dev_priv = dev->dev_private; | ||
335 | struct drm_i915_error_state *error; | ||
336 | unsigned long flags; | ||
337 | |||
338 | spin_lock_irqsave(&dev_priv->error_lock, flags); | ||
339 | if (!dev_priv->first_error) { | ||
340 | seq_printf(m, "no error state collected\n"); | ||
341 | goto out; | ||
342 | } | ||
343 | |||
344 | error = dev_priv->first_error; | ||
345 | |||
346 | seq_printf(m, "EIR: 0x%08x\n", error->eir); | ||
347 | seq_printf(m, " PGTBL_ER: 0x%08x\n", error->pgtbl_er); | ||
348 | seq_printf(m, " INSTPM: 0x%08x\n", error->instpm); | ||
349 | seq_printf(m, " IPEIR: 0x%08x\n", error->ipeir); | ||
350 | seq_printf(m, " IPEHR: 0x%08x\n", error->ipehr); | ||
351 | seq_printf(m, " INSTDONE: 0x%08x\n", error->instdone); | ||
352 | seq_printf(m, " ACTHD: 0x%08x\n", error->acthd); | ||
353 | if (IS_I965G(dev)) { | ||
354 | seq_printf(m, " INSTPS: 0x%08x\n", error->instps); | ||
355 | seq_printf(m, " INSTDONE1: 0x%08x\n", error->instdone1); | ||
356 | } | ||
357 | |||
358 | out: | ||
359 | spin_unlock_irqrestore(&dev_priv->error_lock, flags); | ||
360 | |||
361 | return 0; | ||
362 | } | ||
326 | 363 | ||
327 | static struct drm_info_list i915_gem_debugfs_list[] = { | 364 | static struct drm_info_list i915_gem_debugfs_list[] = { |
328 | {"i915_gem_active", i915_gem_object_list_info, 0, (void *) ACTIVE_LIST}, | 365 | {"i915_gem_active", i915_gem_object_list_info, 0, (void *) ACTIVE_LIST}, |
@@ -336,6 +373,7 @@ static struct drm_info_list i915_gem_debugfs_list[] = { | |||
336 | {"i915_ringbuffer_data", i915_ringbuffer_data, 0}, | 373 | {"i915_ringbuffer_data", i915_ringbuffer_data, 0}, |
337 | {"i915_ringbuffer_info", i915_ringbuffer_info, 0}, | 374 | {"i915_ringbuffer_info", i915_ringbuffer_info, 0}, |
338 | {"i915_batchbuffers", i915_batchbuffer_info, 0}, | 375 | {"i915_batchbuffers", i915_batchbuffer_info, 0}, |
376 | {"i915_error_state", i915_error_state, 0}, | ||
339 | }; | 377 | }; |
340 | #define I915_GEM_DEBUGFS_ENTRIES ARRAY_SIZE(i915_gem_debugfs_list) | 378 | #define I915_GEM_DEBUGFS_ENTRIES ARRAY_SIZE(i915_gem_debugfs_list) |
341 | 379 | ||
diff --git a/drivers/gpu/drm/i915/i915_gem_tiling.c b/drivers/gpu/drm/i915/i915_gem_tiling.c index daeae62e1c2..a2d527b22ec 100644 --- a/drivers/gpu/drm/i915/i915_gem_tiling.c +++ b/drivers/gpu/drm/i915/i915_gem_tiling.c | |||
@@ -521,6 +521,12 @@ i915_gem_set_tiling(struct drm_device *dev, void *data, | |||
521 | goto err; | 521 | goto err; |
522 | } | 522 | } |
523 | 523 | ||
524 | /* If we've changed tiling, GTT-mappings of the object | ||
525 | * need to re-fault to ensure that the correct fence register | ||
526 | * setup is in place. | ||
527 | */ | ||
528 | i915_gem_release_mmap(obj); | ||
529 | |||
524 | obj_priv->tiling_mode = args->tiling_mode; | 530 | obj_priv->tiling_mode = args->tiling_mode; |
525 | obj_priv->stride = args->stride; | 531 | obj_priv->stride = args->stride; |
526 | } | 532 | } |
diff --git a/drivers/gpu/drm/i915/i915_irq.c b/drivers/gpu/drm/i915/i915_irq.c index 228546f6eaa..7ba23a69a0c 100644 --- a/drivers/gpu/drm/i915/i915_irq.c +++ b/drivers/gpu/drm/i915/i915_irq.c | |||
@@ -26,6 +26,7 @@ | |||
26 | * | 26 | * |
27 | */ | 27 | */ |
28 | 28 | ||
29 | #include <linux/sysrq.h> | ||
29 | #include "drmP.h" | 30 | #include "drmP.h" |
30 | #include "drm.h" | 31 | #include "drm.h" |
31 | #include "i915_drm.h" | 32 | #include "i915_drm.h" |
@@ -41,9 +42,10 @@ | |||
41 | * we leave them always unmasked in IMR and then control enabling them through | 42 | * we leave them always unmasked in IMR and then control enabling them through |
42 | * PIPESTAT alone. | 43 | * PIPESTAT alone. |
43 | */ | 44 | */ |
44 | #define I915_INTERRUPT_ENABLE_FIX (I915_ASLE_INTERRUPT | \ | 45 | #define I915_INTERRUPT_ENABLE_FIX (I915_ASLE_INTERRUPT | \ |
45 | I915_DISPLAY_PIPE_A_EVENT_INTERRUPT | \ | 46 | I915_DISPLAY_PIPE_A_EVENT_INTERRUPT | \ |
46 | I915_DISPLAY_PIPE_B_EVENT_INTERRUPT) | 47 | I915_DISPLAY_PIPE_B_EVENT_INTERRUPT | \ |
48 | I915_RENDER_COMMAND_PARSER_ERROR_INTERRUPT) | ||
47 | 49 | ||
48 | /** Interrupts that we mask and unmask at runtime. */ | 50 | /** Interrupts that we mask and unmask at runtime. */ |
49 | #define I915_INTERRUPT_ENABLE_VAR (I915_USER_INTERRUPT) | 51 | #define I915_INTERRUPT_ENABLE_VAR (I915_USER_INTERRUPT) |
@@ -288,6 +290,47 @@ irqreturn_t igdng_irq_handler(struct drm_device *dev) | |||
288 | return ret; | 290 | return ret; |
289 | } | 291 | } |
290 | 292 | ||
293 | static void i915_capture_error_state(struct drm_device *dev) | ||
294 | { | ||
295 | struct drm_i915_private *dev_priv = dev->dev_private; | ||
296 | struct drm_i915_error_state *error; | ||
297 | unsigned long flags; | ||
298 | |||
299 | spin_lock_irqsave(&dev_priv->error_lock, flags); | ||
300 | if (dev_priv->first_error) | ||
301 | goto out; | ||
302 | |||
303 | error = kmalloc(sizeof(*error), GFP_ATOMIC); | ||
304 | if (!error) { | ||
305 | DRM_DEBUG("out ot memory, not capturing error state\n"); | ||
306 | goto out; | ||
307 | } | ||
308 | |||
309 | error->eir = I915_READ(EIR); | ||
310 | error->pgtbl_er = I915_READ(PGTBL_ER); | ||
311 | error->pipeastat = I915_READ(PIPEASTAT); | ||
312 | error->pipebstat = I915_READ(PIPEBSTAT); | ||
313 | error->instpm = I915_READ(INSTPM); | ||
314 | if (!IS_I965G(dev)) { | ||
315 | error->ipeir = I915_READ(IPEIR); | ||
316 | error->ipehr = I915_READ(IPEHR); | ||
317 | error->instdone = I915_READ(INSTDONE); | ||
318 | error->acthd = I915_READ(ACTHD); | ||
319 | } else { | ||
320 | error->ipeir = I915_READ(IPEIR_I965); | ||
321 | error->ipehr = I915_READ(IPEHR_I965); | ||
322 | error->instdone = I915_READ(INSTDONE_I965); | ||
323 | error->instps = I915_READ(INSTPS); | ||
324 | error->instdone1 = I915_READ(INSTDONE1); | ||
325 | error->acthd = I915_READ(ACTHD_I965); | ||
326 | } | ||
327 | |||
328 | dev_priv->first_error = error; | ||
329 | |||
330 | out: | ||
331 | spin_unlock_irqrestore(&dev_priv->error_lock, flags); | ||
332 | } | ||
333 | |||
291 | irqreturn_t i915_driver_irq_handler(DRM_IRQ_ARGS) | 334 | irqreturn_t i915_driver_irq_handler(DRM_IRQ_ARGS) |
292 | { | 335 | { |
293 | struct drm_device *dev = (struct drm_device *) arg; | 336 | struct drm_device *dev = (struct drm_device *) arg; |
@@ -333,11 +376,15 @@ irqreturn_t i915_driver_irq_handler(DRM_IRQ_ARGS) | |||
333 | * Clear the PIPE(A|B)STAT regs before the IIR | 376 | * Clear the PIPE(A|B)STAT regs before the IIR |
334 | */ | 377 | */ |
335 | if (pipea_stats & 0x8000ffff) { | 378 | if (pipea_stats & 0x8000ffff) { |
379 | if (pipea_stats & PIPE_FIFO_UNDERRUN_STATUS) | ||
380 | DRM_DEBUG("pipe a underrun\n"); | ||
336 | I915_WRITE(PIPEASTAT, pipea_stats); | 381 | I915_WRITE(PIPEASTAT, pipea_stats); |
337 | irq_received = 1; | 382 | irq_received = 1; |
338 | } | 383 | } |
339 | 384 | ||
340 | if (pipeb_stats & 0x8000ffff) { | 385 | if (pipeb_stats & 0x8000ffff) { |
386 | if (pipeb_stats & PIPE_FIFO_UNDERRUN_STATUS) | ||
387 | DRM_DEBUG("pipe b underrun\n"); | ||
341 | I915_WRITE(PIPEBSTAT, pipeb_stats); | 388 | I915_WRITE(PIPEBSTAT, pipeb_stats); |
342 | irq_received = 1; | 389 | irq_received = 1; |
343 | } | 390 | } |
@@ -362,6 +409,80 @@ irqreturn_t i915_driver_irq_handler(DRM_IRQ_ARGS) | |||
362 | I915_READ(PORT_HOTPLUG_STAT); | 409 | I915_READ(PORT_HOTPLUG_STAT); |
363 | } | 410 | } |
364 | 411 | ||
412 | if (iir & I915_RENDER_COMMAND_PARSER_ERROR_INTERRUPT) { | ||
413 | u32 eir = I915_READ(EIR); | ||
414 | |||
415 | i915_capture_error_state(dev); | ||
416 | |||
417 | printk(KERN_ERR "render error detected, EIR: 0x%08x\n", | ||
418 | eir); | ||
419 | if (eir & I915_ERROR_PAGE_TABLE) { | ||
420 | u32 pgtbl_err = I915_READ(PGTBL_ER); | ||
421 | printk(KERN_ERR "page table error\n"); | ||
422 | printk(KERN_ERR " PGTBL_ER: 0x%08x\n", | ||
423 | pgtbl_err); | ||
424 | I915_WRITE(PGTBL_ER, pgtbl_err); | ||
425 | (void)I915_READ(PGTBL_ER); | ||
426 | } | ||
427 | if (eir & I915_ERROR_MEMORY_REFRESH) { | ||
428 | printk(KERN_ERR "memory refresh error\n"); | ||
429 | printk(KERN_ERR "PIPEASTAT: 0x%08x\n", | ||
430 | pipea_stats); | ||
431 | printk(KERN_ERR "PIPEBSTAT: 0x%08x\n", | ||
432 | pipeb_stats); | ||
433 | /* pipestat has already been acked */ | ||
434 | } | ||
435 | if (eir & I915_ERROR_INSTRUCTION) { | ||
436 | printk(KERN_ERR "instruction error\n"); | ||
437 | printk(KERN_ERR " INSTPM: 0x%08x\n", | ||
438 | I915_READ(INSTPM)); | ||
439 | if (!IS_I965G(dev)) { | ||
440 | u32 ipeir = I915_READ(IPEIR); | ||
441 | |||
442 | printk(KERN_ERR " IPEIR: 0x%08x\n", | ||
443 | I915_READ(IPEIR)); | ||
444 | printk(KERN_ERR " IPEHR: 0x%08x\n", | ||
445 | I915_READ(IPEHR)); | ||
446 | printk(KERN_ERR " INSTDONE: 0x%08x\n", | ||
447 | I915_READ(INSTDONE)); | ||
448 | printk(KERN_ERR " ACTHD: 0x%08x\n", | ||
449 | I915_READ(ACTHD)); | ||
450 | I915_WRITE(IPEIR, ipeir); | ||
451 | (void)I915_READ(IPEIR); | ||
452 | } else { | ||
453 | u32 ipeir = I915_READ(IPEIR_I965); | ||
454 | |||
455 | printk(KERN_ERR " IPEIR: 0x%08x\n", | ||
456 | I915_READ(IPEIR_I965)); | ||
457 | printk(KERN_ERR " IPEHR: 0x%08x\n", | ||
458 | I915_READ(IPEHR_I965)); | ||
459 | printk(KERN_ERR " INSTDONE: 0x%08x\n", | ||
460 | I915_READ(INSTDONE_I965)); | ||
461 | printk(KERN_ERR " INSTPS: 0x%08x\n", | ||
462 | I915_READ(INSTPS)); | ||
463 | printk(KERN_ERR " INSTDONE1: 0x%08x\n", | ||
464 | I915_READ(INSTDONE1)); | ||
465 | printk(KERN_ERR " ACTHD: 0x%08x\n", | ||
466 | I915_READ(ACTHD_I965)); | ||
467 | I915_WRITE(IPEIR_I965, ipeir); | ||
468 | (void)I915_READ(IPEIR_I965); | ||
469 | } | ||
470 | } | ||
471 | |||
472 | I915_WRITE(EIR, eir); | ||
473 | (void)I915_READ(EIR); | ||
474 | eir = I915_READ(EIR); | ||
475 | if (eir) { | ||
476 | /* | ||
477 | * some errors might have become stuck, | ||
478 | * mask them. | ||
479 | */ | ||
480 | DRM_ERROR("EIR stuck: 0x%08x, masking\n", eir); | ||
481 | I915_WRITE(EMR, I915_READ(EMR) | eir); | ||
482 | I915_WRITE(IIR, I915_RENDER_COMMAND_PARSER_ERROR_INTERRUPT); | ||
483 | } | ||
484 | } | ||
485 | |||
365 | I915_WRITE(IIR, iir); | 486 | I915_WRITE(IIR, iir); |
366 | new_iir = I915_READ(IIR); /* Flush posted writes */ | 487 | new_iir = I915_READ(IIR); /* Flush posted writes */ |
367 | 488 | ||
@@ -732,6 +853,7 @@ int i915_driver_irq_postinstall(struct drm_device *dev) | |||
732 | { | 853 | { |
733 | drm_i915_private_t *dev_priv = (drm_i915_private_t *) dev->dev_private; | 854 | drm_i915_private_t *dev_priv = (drm_i915_private_t *) dev->dev_private; |
734 | u32 enable_mask = I915_INTERRUPT_ENABLE_FIX | I915_INTERRUPT_ENABLE_VAR; | 855 | u32 enable_mask = I915_INTERRUPT_ENABLE_FIX | I915_INTERRUPT_ENABLE_VAR; |
856 | u32 error_mask; | ||
735 | 857 | ||
736 | DRM_INIT_WAITQUEUE(&dev_priv->irq_queue); | 858 | DRM_INIT_WAITQUEUE(&dev_priv->irq_queue); |
737 | 859 | ||
@@ -768,6 +890,21 @@ int i915_driver_irq_postinstall(struct drm_device *dev) | |||
768 | i915_enable_irq(dev_priv, I915_DISPLAY_PORT_INTERRUPT); | 890 | i915_enable_irq(dev_priv, I915_DISPLAY_PORT_INTERRUPT); |
769 | } | 891 | } |
770 | 892 | ||
893 | /* | ||
894 | * Enable some error detection, note the instruction error mask | ||
895 | * bit is reserved, so we leave it masked. | ||
896 | */ | ||
897 | if (IS_G4X(dev)) { | ||
898 | error_mask = ~(GM45_ERROR_PAGE_TABLE | | ||
899 | GM45_ERROR_MEM_PRIV | | ||
900 | GM45_ERROR_CP_PRIV | | ||
901 | I915_ERROR_MEMORY_REFRESH); | ||
902 | } else { | ||
903 | error_mask = ~(I915_ERROR_PAGE_TABLE | | ||
904 | I915_ERROR_MEMORY_REFRESH); | ||
905 | } | ||
906 | I915_WRITE(EMR, error_mask); | ||
907 | |||
771 | /* Disable pipe interrupt enables, clear pending pipe status */ | 908 | /* Disable pipe interrupt enables, clear pending pipe status */ |
772 | I915_WRITE(PIPEASTAT, I915_READ(PIPEASTAT) & 0x8000ffff); | 909 | I915_WRITE(PIPEASTAT, I915_READ(PIPEASTAT) & 0x8000ffff); |
773 | I915_WRITE(PIPEBSTAT, I915_READ(PIPEBSTAT) & 0x8000ffff); | 910 | I915_WRITE(PIPEBSTAT, I915_READ(PIPEBSTAT) & 0x8000ffff); |
diff --git a/drivers/gpu/drm/i915/i915_reg.h b/drivers/gpu/drm/i915/i915_reg.h index 88bf7521405..6c085848409 100644 --- a/drivers/gpu/drm/i915/i915_reg.h +++ b/drivers/gpu/drm/i915/i915_reg.h | |||
@@ -206,6 +206,7 @@ | |||
206 | /* | 206 | /* |
207 | * Instruction and interrupt control regs | 207 | * Instruction and interrupt control regs |
208 | */ | 208 | */ |
209 | #define PGTBL_ER 0x02024 | ||
209 | #define PRB0_TAIL 0x02030 | 210 | #define PRB0_TAIL 0x02030 |
210 | #define PRB0_HEAD 0x02034 | 211 | #define PRB0_HEAD 0x02034 |
211 | #define PRB0_START 0x02038 | 212 | #define PRB0_START 0x02038 |
@@ -226,11 +227,18 @@ | |||
226 | #define PRB1_HEAD 0x02044 /* 915+ only */ | 227 | #define PRB1_HEAD 0x02044 /* 915+ only */ |
227 | #define PRB1_START 0x02048 /* 915+ only */ | 228 | #define PRB1_START 0x02048 /* 915+ only */ |
228 | #define PRB1_CTL 0x0204c /* 915+ only */ | 229 | #define PRB1_CTL 0x0204c /* 915+ only */ |
230 | #define IPEIR_I965 0x02064 | ||
231 | #define IPEHR_I965 0x02068 | ||
232 | #define INSTDONE_I965 0x0206c | ||
233 | #define INSTPS 0x02070 /* 965+ only */ | ||
234 | #define INSTDONE1 0x0207c /* 965+ only */ | ||
229 | #define ACTHD_I965 0x02074 | 235 | #define ACTHD_I965 0x02074 |
230 | #define HWS_PGA 0x02080 | 236 | #define HWS_PGA 0x02080 |
231 | #define HWS_ADDRESS_MASK 0xfffff000 | 237 | #define HWS_ADDRESS_MASK 0xfffff000 |
232 | #define HWS_START_ADDRESS_SHIFT 4 | 238 | #define HWS_START_ADDRESS_SHIFT 4 |
233 | #define IPEIR 0x02088 | 239 | #define IPEIR 0x02088 |
240 | #define IPEHR 0x0208c | ||
241 | #define INSTDONE 0x02090 | ||
234 | #define NOPID 0x02094 | 242 | #define NOPID 0x02094 |
235 | #define HWSTAM 0x02098 | 243 | #define HWSTAM 0x02098 |
236 | #define SCPD0 0x0209c /* 915+ only */ | 244 | #define SCPD0 0x0209c /* 915+ only */ |
@@ -258,10 +266,22 @@ | |||
258 | #define EIR 0x020b0 | 266 | #define EIR 0x020b0 |
259 | #define EMR 0x020b4 | 267 | #define EMR 0x020b4 |
260 | #define ESR 0x020b8 | 268 | #define ESR 0x020b8 |
269 | #define GM45_ERROR_PAGE_TABLE (1<<5) | ||
270 | #define GM45_ERROR_MEM_PRIV (1<<4) | ||
271 | #define I915_ERROR_PAGE_TABLE (1<<4) | ||
272 | #define GM45_ERROR_CP_PRIV (1<<3) | ||
273 | #define I915_ERROR_MEMORY_REFRESH (1<<1) | ||
274 | #define I915_ERROR_INSTRUCTION (1<<0) | ||
261 | #define INSTPM 0x020c0 | 275 | #define INSTPM 0x020c0 |
262 | #define ACTHD 0x020c8 | 276 | #define ACTHD 0x020c8 |
263 | #define FW_BLC 0x020d8 | 277 | #define FW_BLC 0x020d8 |
278 | #define FW_BLC2 0x020dc | ||
264 | #define FW_BLC_SELF 0x020e0 /* 915+ only */ | 279 | #define FW_BLC_SELF 0x020e0 /* 915+ only */ |
280 | #define FW_BLC_SELF_EN (1<<15) | ||
281 | #define MM_BURST_LENGTH 0x00700000 | ||
282 | #define MM_FIFO_WATERMARK 0x0001F000 | ||
283 | #define LM_BURST_LENGTH 0x00000700 | ||
284 | #define LM_FIFO_WATERMARK 0x0000001F | ||
265 | #define MI_ARB_STATE 0x020e4 /* 915+ only */ | 285 | #define MI_ARB_STATE 0x020e4 /* 915+ only */ |
266 | #define CACHE_MODE_0 0x02120 /* 915+ only */ | 286 | #define CACHE_MODE_0 0x02120 /* 915+ only */ |
267 | #define CM0_MASK_SHIFT 16 | 287 | #define CM0_MASK_SHIFT 16 |
@@ -571,17 +591,21 @@ | |||
571 | 591 | ||
572 | /* Clocking configuration register */ | 592 | /* Clocking configuration register */ |
573 | #define CLKCFG 0x10c00 | 593 | #define CLKCFG 0x10c00 |
574 | #define CLKCFG_FSB_400 (0 << 0) /* hrawclk 100 */ | 594 | #define CLKCFG_FSB_400 (5 << 0) /* hrawclk 100 */ |
575 | #define CLKCFG_FSB_533 (1 << 0) /* hrawclk 133 */ | 595 | #define CLKCFG_FSB_533 (1 << 0) /* hrawclk 133 */ |
576 | #define CLKCFG_FSB_667 (3 << 0) /* hrawclk 166 */ | 596 | #define CLKCFG_FSB_667 (3 << 0) /* hrawclk 166 */ |
577 | #define CLKCFG_FSB_800 (2 << 0) /* hrawclk 200 */ | 597 | #define CLKCFG_FSB_800 (2 << 0) /* hrawclk 200 */ |
578 | #define CLKCFG_FSB_1067 (6 << 0) /* hrawclk 266 */ | 598 | #define CLKCFG_FSB_1067 (6 << 0) /* hrawclk 266 */ |
579 | #define CLKCFG_FSB_1333 (7 << 0) /* hrawclk 333 */ | 599 | #define CLKCFG_FSB_1333 (7 << 0) /* hrawclk 333 */ |
580 | /* this is a guess, could be 5 as well */ | 600 | /* Note, below two are guess */ |
581 | #define CLKCFG_FSB_1600 (4 << 0) /* hrawclk 400 */ | 601 | #define CLKCFG_FSB_1600 (4 << 0) /* hrawclk 400 */ |
582 | #define CLKCFG_FSB_1600_ALT (5 << 0) /* hrawclk 400 */ | 602 | #define CLKCFG_FSB_1600_ALT (0 << 0) /* hrawclk 400 */ |
583 | #define CLKCFG_FSB_MASK (7 << 0) | 603 | #define CLKCFG_FSB_MASK (7 << 0) |
584 | 604 | #define CLKCFG_MEM_533 (1 << 4) | |
605 | #define CLKCFG_MEM_667 (2 << 4) | ||
606 | #define CLKCFG_MEM_800 (3 << 4) | ||
607 | #define CLKCFG_MEM_MASK (7 << 4) | ||
608 | |||
585 | /** GM965 GM45 render standby register */ | 609 | /** GM965 GM45 render standby register */ |
586 | #define MCHBAR_RENDER_STANDBY 0x111B8 | 610 | #define MCHBAR_RENDER_STANDBY 0x111B8 |
587 | 611 | ||
@@ -1581,6 +1605,34 @@ | |||
1581 | #define DSPARB_CSTART_SHIFT 7 | 1605 | #define DSPARB_CSTART_SHIFT 7 |
1582 | #define DSPARB_BSTART_MASK (0x7f) | 1606 | #define DSPARB_BSTART_MASK (0x7f) |
1583 | #define DSPARB_BSTART_SHIFT 0 | 1607 | #define DSPARB_BSTART_SHIFT 0 |
1608 | #define DSPARB_BEND_SHIFT 9 /* on 855 */ | ||
1609 | #define DSPARB_AEND_SHIFT 0 | ||
1610 | |||
1611 | #define DSPFW1 0x70034 | ||
1612 | #define DSPFW2 0x70038 | ||
1613 | #define DSPFW3 0x7003c | ||
1614 | #define IGD_SELF_REFRESH_EN (1<<30) | ||
1615 | |||
1616 | /* FIFO watermark sizes etc */ | ||
1617 | #define I915_FIFO_LINE_SIZE 64 | ||
1618 | #define I830_FIFO_LINE_SIZE 32 | ||
1619 | #define I945_FIFO_SIZE 127 /* 945 & 965 */ | ||
1620 | #define I915_FIFO_SIZE 95 | ||
1621 | #define I855GM_FIFO_SIZE 255 | ||
1622 | #define I830_FIFO_SIZE 95 | ||
1623 | #define I915_MAX_WM 0x3f | ||
1624 | |||
1625 | #define IGD_DISPLAY_FIFO 512 /* in 64byte unit */ | ||
1626 | #define IGD_FIFO_LINE_SIZE 64 | ||
1627 | #define IGD_MAX_WM 0x1ff | ||
1628 | #define IGD_DFT_WM 0x3f | ||
1629 | #define IGD_DFT_HPLLOFF_WM 0 | ||
1630 | #define IGD_GUARD_WM 10 | ||
1631 | #define IGD_CURSOR_FIFO 64 | ||
1632 | #define IGD_CURSOR_MAX_WM 0x3f | ||
1633 | #define IGD_CURSOR_DFT_WM 0 | ||
1634 | #define IGD_CURSOR_GUARD_WM 5 | ||
1635 | |||
1584 | /* | 1636 | /* |
1585 | * The two pipe frame counter registers are not synchronized, so | 1637 | * The two pipe frame counter registers are not synchronized, so |
1586 | * reading a stable value is somewhat tricky. The following code | 1638 | * reading a stable value is somewhat tricky. The following code |
diff --git a/drivers/gpu/drm/i915/i915_suspend.c b/drivers/gpu/drm/i915/i915_suspend.c index 8d8e083d14a..9e1d16e5c3e 100644 --- a/drivers/gpu/drm/i915/i915_suspend.c +++ b/drivers/gpu/drm/i915/i915_suspend.c | |||
@@ -222,23 +222,12 @@ static void i915_restore_vga(struct drm_device *dev) | |||
222 | I915_WRITE8(VGA_DACMASK, dev_priv->saveDACMASK); | 222 | I915_WRITE8(VGA_DACMASK, dev_priv->saveDACMASK); |
223 | } | 223 | } |
224 | 224 | ||
225 | int i915_save_state(struct drm_device *dev) | 225 | static void i915_save_modeset_reg(struct drm_device *dev) |
226 | { | 226 | { |
227 | struct drm_i915_private *dev_priv = dev->dev_private; | 227 | struct drm_i915_private *dev_priv = dev->dev_private; |
228 | int i; | ||
229 | |||
230 | pci_read_config_byte(dev->pdev, LBB, &dev_priv->saveLBB); | ||
231 | |||
232 | /* Render Standby */ | ||
233 | if (IS_I965G(dev) && IS_MOBILE(dev)) | ||
234 | dev_priv->saveRENDERSTANDBY = I915_READ(MCHBAR_RENDER_STANDBY); | ||
235 | |||
236 | /* Hardware status page */ | ||
237 | dev_priv->saveHWS = I915_READ(HWS_PGA); | ||
238 | |||
239 | /* Display arbitration control */ | ||
240 | dev_priv->saveDSPARB = I915_READ(DSPARB); | ||
241 | 228 | ||
229 | if (drm_core_check_feature(dev, DRIVER_MODESET)) | ||
230 | return; | ||
242 | /* Pipe & plane A info */ | 231 | /* Pipe & plane A info */ |
243 | dev_priv->savePIPEACONF = I915_READ(PIPEACONF); | 232 | dev_priv->savePIPEACONF = I915_READ(PIPEACONF); |
244 | dev_priv->savePIPEASRC = I915_READ(PIPEASRC); | 233 | dev_priv->savePIPEASRC = I915_READ(PIPEASRC); |
@@ -294,7 +283,122 @@ int i915_save_state(struct drm_device *dev) | |||
294 | } | 283 | } |
295 | i915_save_palette(dev, PIPE_B); | 284 | i915_save_palette(dev, PIPE_B); |
296 | dev_priv->savePIPEBSTAT = I915_READ(PIPEBSTAT); | 285 | dev_priv->savePIPEBSTAT = I915_READ(PIPEBSTAT); |
286 | return; | ||
287 | } | ||
288 | static void i915_restore_modeset_reg(struct drm_device *dev) | ||
289 | { | ||
290 | struct drm_i915_private *dev_priv = dev->dev_private; | ||
291 | |||
292 | if (drm_core_check_feature(dev, DRIVER_MODESET)) | ||
293 | return; | ||
294 | |||
295 | /* Pipe & plane A info */ | ||
296 | /* Prime the clock */ | ||
297 | if (dev_priv->saveDPLL_A & DPLL_VCO_ENABLE) { | ||
298 | I915_WRITE(DPLL_A, dev_priv->saveDPLL_A & | ||
299 | ~DPLL_VCO_ENABLE); | ||
300 | DRM_UDELAY(150); | ||
301 | } | ||
302 | I915_WRITE(FPA0, dev_priv->saveFPA0); | ||
303 | I915_WRITE(FPA1, dev_priv->saveFPA1); | ||
304 | /* Actually enable it */ | ||
305 | I915_WRITE(DPLL_A, dev_priv->saveDPLL_A); | ||
306 | DRM_UDELAY(150); | ||
307 | if (IS_I965G(dev)) | ||
308 | I915_WRITE(DPLL_A_MD, dev_priv->saveDPLL_A_MD); | ||
309 | DRM_UDELAY(150); | ||
310 | |||
311 | /* Restore mode */ | ||
312 | I915_WRITE(HTOTAL_A, dev_priv->saveHTOTAL_A); | ||
313 | I915_WRITE(HBLANK_A, dev_priv->saveHBLANK_A); | ||
314 | I915_WRITE(HSYNC_A, dev_priv->saveHSYNC_A); | ||
315 | I915_WRITE(VTOTAL_A, dev_priv->saveVTOTAL_A); | ||
316 | I915_WRITE(VBLANK_A, dev_priv->saveVBLANK_A); | ||
317 | I915_WRITE(VSYNC_A, dev_priv->saveVSYNC_A); | ||
318 | I915_WRITE(BCLRPAT_A, dev_priv->saveBCLRPAT_A); | ||
319 | |||
320 | /* Restore plane info */ | ||
321 | I915_WRITE(DSPASIZE, dev_priv->saveDSPASIZE); | ||
322 | I915_WRITE(DSPAPOS, dev_priv->saveDSPAPOS); | ||
323 | I915_WRITE(PIPEASRC, dev_priv->savePIPEASRC); | ||
324 | I915_WRITE(DSPAADDR, dev_priv->saveDSPAADDR); | ||
325 | I915_WRITE(DSPASTRIDE, dev_priv->saveDSPASTRIDE); | ||
326 | if (IS_I965G(dev)) { | ||
327 | I915_WRITE(DSPASURF, dev_priv->saveDSPASURF); | ||
328 | I915_WRITE(DSPATILEOFF, dev_priv->saveDSPATILEOFF); | ||
329 | } | ||
330 | |||
331 | I915_WRITE(PIPEACONF, dev_priv->savePIPEACONF); | ||
332 | |||
333 | i915_restore_palette(dev, PIPE_A); | ||
334 | /* Enable the plane */ | ||
335 | I915_WRITE(DSPACNTR, dev_priv->saveDSPACNTR); | ||
336 | I915_WRITE(DSPAADDR, I915_READ(DSPAADDR)); | ||
337 | |||
338 | /* Pipe & plane B info */ | ||
339 | if (dev_priv->saveDPLL_B & DPLL_VCO_ENABLE) { | ||
340 | I915_WRITE(DPLL_B, dev_priv->saveDPLL_B & | ||
341 | ~DPLL_VCO_ENABLE); | ||
342 | DRM_UDELAY(150); | ||
343 | } | ||
344 | I915_WRITE(FPB0, dev_priv->saveFPB0); | ||
345 | I915_WRITE(FPB1, dev_priv->saveFPB1); | ||
346 | /* Actually enable it */ | ||
347 | I915_WRITE(DPLL_B, dev_priv->saveDPLL_B); | ||
348 | DRM_UDELAY(150); | ||
349 | if (IS_I965G(dev)) | ||
350 | I915_WRITE(DPLL_B_MD, dev_priv->saveDPLL_B_MD); | ||
351 | DRM_UDELAY(150); | ||
352 | |||
353 | /* Restore mode */ | ||
354 | I915_WRITE(HTOTAL_B, dev_priv->saveHTOTAL_B); | ||
355 | I915_WRITE(HBLANK_B, dev_priv->saveHBLANK_B); | ||
356 | I915_WRITE(HSYNC_B, dev_priv->saveHSYNC_B); | ||
357 | I915_WRITE(VTOTAL_B, dev_priv->saveVTOTAL_B); | ||
358 | I915_WRITE(VBLANK_B, dev_priv->saveVBLANK_B); | ||
359 | I915_WRITE(VSYNC_B, dev_priv->saveVSYNC_B); | ||
360 | I915_WRITE(BCLRPAT_B, dev_priv->saveBCLRPAT_B); | ||
361 | |||
362 | /* Restore plane info */ | ||
363 | I915_WRITE(DSPBSIZE, dev_priv->saveDSPBSIZE); | ||
364 | I915_WRITE(DSPBPOS, dev_priv->saveDSPBPOS); | ||
365 | I915_WRITE(PIPEBSRC, dev_priv->savePIPEBSRC); | ||
366 | I915_WRITE(DSPBADDR, dev_priv->saveDSPBADDR); | ||
367 | I915_WRITE(DSPBSTRIDE, dev_priv->saveDSPBSTRIDE); | ||
368 | if (IS_I965G(dev)) { | ||
369 | I915_WRITE(DSPBSURF, dev_priv->saveDSPBSURF); | ||
370 | I915_WRITE(DSPBTILEOFF, dev_priv->saveDSPBTILEOFF); | ||
371 | } | ||
372 | |||
373 | I915_WRITE(PIPEBCONF, dev_priv->savePIPEBCONF); | ||
374 | |||
375 | i915_restore_palette(dev, PIPE_B); | ||
376 | /* Enable the plane */ | ||
377 | I915_WRITE(DSPBCNTR, dev_priv->saveDSPBCNTR); | ||
378 | I915_WRITE(DSPBADDR, I915_READ(DSPBADDR)); | ||
297 | 379 | ||
380 | return; | ||
381 | } | ||
382 | int i915_save_state(struct drm_device *dev) | ||
383 | { | ||
384 | struct drm_i915_private *dev_priv = dev->dev_private; | ||
385 | int i; | ||
386 | |||
387 | pci_read_config_byte(dev->pdev, LBB, &dev_priv->saveLBB); | ||
388 | |||
389 | /* Render Standby */ | ||
390 | if (IS_I965G(dev) && IS_MOBILE(dev)) | ||
391 | dev_priv->saveRENDERSTANDBY = I915_READ(MCHBAR_RENDER_STANDBY); | ||
392 | |||
393 | /* Hardware status page */ | ||
394 | dev_priv->saveHWS = I915_READ(HWS_PGA); | ||
395 | |||
396 | /* Display arbitration control */ | ||
397 | dev_priv->saveDSPARB = I915_READ(DSPARB); | ||
398 | |||
399 | /* This is only meaningful in non-KMS mode */ | ||
400 | /* Don't save them in KMS mode */ | ||
401 | i915_save_modeset_reg(dev); | ||
298 | /* Cursor state */ | 402 | /* Cursor state */ |
299 | dev_priv->saveCURACNTR = I915_READ(CURACNTR); | 403 | dev_priv->saveCURACNTR = I915_READ(CURACNTR); |
300 | dev_priv->saveCURAPOS = I915_READ(CURAPOS); | 404 | dev_priv->saveCURAPOS = I915_READ(CURAPOS); |
@@ -430,92 +534,9 @@ int i915_restore_state(struct drm_device *dev) | |||
430 | I915_WRITE(PIPEA_DP_LINK_N, dev_priv->savePIPEA_DP_LINK_N); | 534 | I915_WRITE(PIPEA_DP_LINK_N, dev_priv->savePIPEA_DP_LINK_N); |
431 | I915_WRITE(PIPEB_DP_LINK_N, dev_priv->savePIPEB_DP_LINK_N); | 535 | I915_WRITE(PIPEB_DP_LINK_N, dev_priv->savePIPEB_DP_LINK_N); |
432 | } | 536 | } |
433 | 537 | /* This is only meaningful in non-KMS mode */ | |
434 | /* Pipe & plane A info */ | 538 | /* Don't restore them in KMS mode */ |
435 | /* Prime the clock */ | 539 | i915_restore_modeset_reg(dev); |
436 | if (dev_priv->saveDPLL_A & DPLL_VCO_ENABLE) { | ||
437 | I915_WRITE(DPLL_A, dev_priv->saveDPLL_A & | ||
438 | ~DPLL_VCO_ENABLE); | ||
439 | DRM_UDELAY(150); | ||
440 | } | ||
441 | I915_WRITE(FPA0, dev_priv->saveFPA0); | ||
442 | I915_WRITE(FPA1, dev_priv->saveFPA1); | ||
443 | /* Actually enable it */ | ||
444 | I915_WRITE(DPLL_A, dev_priv->saveDPLL_A); | ||
445 | DRM_UDELAY(150); | ||
446 | if (IS_I965G(dev)) | ||
447 | I915_WRITE(DPLL_A_MD, dev_priv->saveDPLL_A_MD); | ||
448 | DRM_UDELAY(150); | ||
449 | |||
450 | /* Restore mode */ | ||
451 | I915_WRITE(HTOTAL_A, dev_priv->saveHTOTAL_A); | ||
452 | I915_WRITE(HBLANK_A, dev_priv->saveHBLANK_A); | ||
453 | I915_WRITE(HSYNC_A, dev_priv->saveHSYNC_A); | ||
454 | I915_WRITE(VTOTAL_A, dev_priv->saveVTOTAL_A); | ||
455 | I915_WRITE(VBLANK_A, dev_priv->saveVBLANK_A); | ||
456 | I915_WRITE(VSYNC_A, dev_priv->saveVSYNC_A); | ||
457 | I915_WRITE(BCLRPAT_A, dev_priv->saveBCLRPAT_A); | ||
458 | |||
459 | /* Restore plane info */ | ||
460 | I915_WRITE(DSPASIZE, dev_priv->saveDSPASIZE); | ||
461 | I915_WRITE(DSPAPOS, dev_priv->saveDSPAPOS); | ||
462 | I915_WRITE(PIPEASRC, dev_priv->savePIPEASRC); | ||
463 | I915_WRITE(DSPAADDR, dev_priv->saveDSPAADDR); | ||
464 | I915_WRITE(DSPASTRIDE, dev_priv->saveDSPASTRIDE); | ||
465 | if (IS_I965G(dev)) { | ||
466 | I915_WRITE(DSPASURF, dev_priv->saveDSPASURF); | ||
467 | I915_WRITE(DSPATILEOFF, dev_priv->saveDSPATILEOFF); | ||
468 | } | ||
469 | |||
470 | I915_WRITE(PIPEACONF, dev_priv->savePIPEACONF); | ||
471 | |||
472 | i915_restore_palette(dev, PIPE_A); | ||
473 | /* Enable the plane */ | ||
474 | I915_WRITE(DSPACNTR, dev_priv->saveDSPACNTR); | ||
475 | I915_WRITE(DSPAADDR, I915_READ(DSPAADDR)); | ||
476 | |||
477 | /* Pipe & plane B info */ | ||
478 | if (dev_priv->saveDPLL_B & DPLL_VCO_ENABLE) { | ||
479 | I915_WRITE(DPLL_B, dev_priv->saveDPLL_B & | ||
480 | ~DPLL_VCO_ENABLE); | ||
481 | DRM_UDELAY(150); | ||
482 | } | ||
483 | I915_WRITE(FPB0, dev_priv->saveFPB0); | ||
484 | I915_WRITE(FPB1, dev_priv->saveFPB1); | ||
485 | /* Actually enable it */ | ||
486 | I915_WRITE(DPLL_B, dev_priv->saveDPLL_B); | ||
487 | DRM_UDELAY(150); | ||
488 | if (IS_I965G(dev)) | ||
489 | I915_WRITE(DPLL_B_MD, dev_priv->saveDPLL_B_MD); | ||
490 | DRM_UDELAY(150); | ||
491 | |||
492 | /* Restore mode */ | ||
493 | I915_WRITE(HTOTAL_B, dev_priv->saveHTOTAL_B); | ||
494 | I915_WRITE(HBLANK_B, dev_priv->saveHBLANK_B); | ||
495 | I915_WRITE(HSYNC_B, dev_priv->saveHSYNC_B); | ||
496 | I915_WRITE(VTOTAL_B, dev_priv->saveVTOTAL_B); | ||
497 | I915_WRITE(VBLANK_B, dev_priv->saveVBLANK_B); | ||
498 | I915_WRITE(VSYNC_B, dev_priv->saveVSYNC_B); | ||
499 | I915_WRITE(BCLRPAT_B, dev_priv->saveBCLRPAT_B); | ||
500 | |||
501 | /* Restore plane info */ | ||
502 | I915_WRITE(DSPBSIZE, dev_priv->saveDSPBSIZE); | ||
503 | I915_WRITE(DSPBPOS, dev_priv->saveDSPBPOS); | ||
504 | I915_WRITE(PIPEBSRC, dev_priv->savePIPEBSRC); | ||
505 | I915_WRITE(DSPBADDR, dev_priv->saveDSPBADDR); | ||
506 | I915_WRITE(DSPBSTRIDE, dev_priv->saveDSPBSTRIDE); | ||
507 | if (IS_I965G(dev)) { | ||
508 | I915_WRITE(DSPBSURF, dev_priv->saveDSPBSURF); | ||
509 | I915_WRITE(DSPBTILEOFF, dev_priv->saveDSPBTILEOFF); | ||
510 | } | ||
511 | |||
512 | I915_WRITE(PIPEBCONF, dev_priv->savePIPEBCONF); | ||
513 | |||
514 | i915_restore_palette(dev, PIPE_B); | ||
515 | /* Enable the plane */ | ||
516 | I915_WRITE(DSPBCNTR, dev_priv->saveDSPBCNTR); | ||
517 | I915_WRITE(DSPBADDR, I915_READ(DSPBADDR)); | ||
518 | |||
519 | /* Cursor state */ | 540 | /* Cursor state */ |
520 | I915_WRITE(CURAPOS, dev_priv->saveCURAPOS); | 541 | I915_WRITE(CURAPOS, dev_priv->saveCURAPOS); |
521 | I915_WRITE(CURACNTR, dev_priv->saveCURACNTR); | 542 | I915_WRITE(CURACNTR, dev_priv->saveCURACNTR); |
diff --git a/drivers/gpu/drm/i915/intel_bios.c b/drivers/gpu/drm/i915/intel_bios.c index 716409a5724..7cc44719102 100644 --- a/drivers/gpu/drm/i915/intel_bios.c +++ b/drivers/gpu/drm/i915/intel_bios.c | |||
@@ -97,6 +97,7 @@ static void | |||
97 | parse_lfp_panel_data(struct drm_i915_private *dev_priv, | 97 | parse_lfp_panel_data(struct drm_i915_private *dev_priv, |
98 | struct bdb_header *bdb) | 98 | struct bdb_header *bdb) |
99 | { | 99 | { |
100 | struct drm_device *dev = dev_priv->dev; | ||
100 | struct bdb_lvds_options *lvds_options; | 101 | struct bdb_lvds_options *lvds_options; |
101 | struct bdb_lvds_lfp_data *lvds_lfp_data; | 102 | struct bdb_lvds_lfp_data *lvds_lfp_data; |
102 | struct bdb_lvds_lfp_data_ptrs *lvds_lfp_data_ptrs; | 103 | struct bdb_lvds_lfp_data_ptrs *lvds_lfp_data_ptrs; |
@@ -132,7 +133,14 @@ parse_lfp_panel_data(struct drm_i915_private *dev_priv, | |||
132 | entry = (struct bdb_lvds_lfp_data_entry *) | 133 | entry = (struct bdb_lvds_lfp_data_entry *) |
133 | ((uint8_t *)lvds_lfp_data->data + (lfp_data_size * | 134 | ((uint8_t *)lvds_lfp_data->data + (lfp_data_size * |
134 | lvds_options->panel_type)); | 135 | lvds_options->panel_type)); |
135 | dvo_timing = &entry->dvo_timing; | 136 | |
137 | /* On IGDNG mobile, LVDS data block removes panel fitting registers. | ||
138 | So dec 2 dword from dvo_timing offset */ | ||
139 | if (IS_IGDNG(dev)) | ||
140 | dvo_timing = (struct lvds_dvo_timing *) | ||
141 | ((u8 *)&entry->dvo_timing - 8); | ||
142 | else | ||
143 | dvo_timing = &entry->dvo_timing; | ||
136 | 144 | ||
137 | panel_fixed_mode = kzalloc(sizeof(*panel_fixed_mode), GFP_KERNEL); | 145 | panel_fixed_mode = kzalloc(sizeof(*panel_fixed_mode), GFP_KERNEL); |
138 | 146 | ||
@@ -195,10 +203,12 @@ parse_general_features(struct drm_i915_private *dev_priv, | |||
195 | dev_priv->lvds_use_ssc = general->enable_ssc; | 203 | dev_priv->lvds_use_ssc = general->enable_ssc; |
196 | 204 | ||
197 | if (dev_priv->lvds_use_ssc) { | 205 | if (dev_priv->lvds_use_ssc) { |
198 | if (IS_I855(dev_priv->dev)) | 206 | if (IS_I85X(dev_priv->dev)) |
199 | dev_priv->lvds_ssc_freq = general->ssc_freq ? 66 : 48; | 207 | dev_priv->lvds_ssc_freq = |
200 | else | 208 | general->ssc_freq ? 66 : 48; |
201 | dev_priv->lvds_ssc_freq = general->ssc_freq ? 100 : 96; | 209 | else |
210 | dev_priv->lvds_ssc_freq = | ||
211 | general->ssc_freq ? 100 : 96; | ||
202 | } | 212 | } |
203 | } | 213 | } |
204 | } | 214 | } |
diff --git a/drivers/gpu/drm/i915/intel_crt.c b/drivers/gpu/drm/i915/intel_crt.c index 6de97fc6602..d6a1a6e5539 100644 --- a/drivers/gpu/drm/i915/intel_crt.c +++ b/drivers/gpu/drm/i915/intel_crt.c | |||
@@ -46,7 +46,7 @@ static void intel_crt_dpms(struct drm_encoder *encoder, int mode) | |||
46 | 46 | ||
47 | temp = I915_READ(reg); | 47 | temp = I915_READ(reg); |
48 | temp &= ~(ADPA_HSYNC_CNTL_DISABLE | ADPA_VSYNC_CNTL_DISABLE); | 48 | temp &= ~(ADPA_HSYNC_CNTL_DISABLE | ADPA_VSYNC_CNTL_DISABLE); |
49 | temp |= ADPA_DAC_ENABLE; | 49 | temp &= ~ADPA_DAC_ENABLE; |
50 | 50 | ||
51 | switch(mode) { | 51 | switch(mode) { |
52 | case DRM_MODE_DPMS_ON: | 52 | case DRM_MODE_DPMS_ON: |
@@ -428,8 +428,34 @@ static void intel_crt_destroy(struct drm_connector *connector) | |||
428 | 428 | ||
429 | static int intel_crt_get_modes(struct drm_connector *connector) | 429 | static int intel_crt_get_modes(struct drm_connector *connector) |
430 | { | 430 | { |
431 | int ret; | ||
431 | struct intel_output *intel_output = to_intel_output(connector); | 432 | struct intel_output *intel_output = to_intel_output(connector); |
432 | return intel_ddc_get_modes(intel_output); | 433 | struct i2c_adapter *ddcbus; |
434 | struct drm_device *dev = connector->dev; | ||
435 | |||
436 | |||
437 | ret = intel_ddc_get_modes(intel_output); | ||
438 | if (ret || !IS_G4X(dev)) | ||
439 | goto end; | ||
440 | |||
441 | ddcbus = intel_output->ddc_bus; | ||
442 | /* Try to probe digital port for output in DVI-I -> VGA mode. */ | ||
443 | intel_output->ddc_bus = | ||
444 | intel_i2c_create(connector->dev, GPIOD, "CRTDDC_D"); | ||
445 | |||
446 | if (!intel_output->ddc_bus) { | ||
447 | intel_output->ddc_bus = ddcbus; | ||
448 | dev_printk(KERN_ERR, &connector->dev->pdev->dev, | ||
449 | "DDC bus registration failed for CRTDDC_D.\n"); | ||
450 | goto end; | ||
451 | } | ||
452 | /* Try to get modes by GPIOD port */ | ||
453 | ret = intel_ddc_get_modes(intel_output); | ||
454 | intel_i2c_destroy(ddcbus); | ||
455 | |||
456 | end: | ||
457 | return ret; | ||
458 | |||
433 | } | 459 | } |
434 | 460 | ||
435 | static int intel_crt_set_property(struct drm_connector *connector, | 461 | static int intel_crt_set_property(struct drm_connector *connector, |
diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c index 73e7b9cecac..508838ee31e 100644 --- a/drivers/gpu/drm/i915/intel_display.c +++ b/drivers/gpu/drm/i915/intel_display.c | |||
@@ -25,6 +25,7 @@ | |||
25 | */ | 25 | */ |
26 | 26 | ||
27 | #include <linux/i2c.h> | 27 | #include <linux/i2c.h> |
28 | #include <linux/kernel.h> | ||
28 | #include "drmP.h" | 29 | #include "drmP.h" |
29 | #include "intel_drv.h" | 30 | #include "intel_drv.h" |
30 | #include "i915_drm.h" | 31 | #include "i915_drm.h" |
@@ -34,6 +35,7 @@ | |||
34 | #include "drm_crtc_helper.h" | 35 | #include "drm_crtc_helper.h" |
35 | 36 | ||
36 | bool intel_pipe_has_type (struct drm_crtc *crtc, int type); | 37 | bool intel_pipe_has_type (struct drm_crtc *crtc, int type); |
38 | static void intel_update_watermarks(struct drm_device *dev); | ||
37 | 39 | ||
38 | typedef struct { | 40 | typedef struct { |
39 | /* given values */ | 41 | /* given values */ |
@@ -814,24 +816,21 @@ intel_find_pll_g4x_dp(const intel_limit_t *limit, struct drm_crtc *crtc, | |||
814 | { | 816 | { |
815 | intel_clock_t clock; | 817 | intel_clock_t clock; |
816 | if (target < 200000) { | 818 | if (target < 200000) { |
817 | clock.dot = 161670; | ||
818 | clock.p = 20; | ||
819 | clock.p1 = 2; | 819 | clock.p1 = 2; |
820 | clock.p2 = 10; | 820 | clock.p2 = 10; |
821 | clock.n = 0x01; | 821 | clock.n = 2; |
822 | clock.m = 97; | 822 | clock.m1 = 23; |
823 | clock.m1 = 0x10; | 823 | clock.m2 = 8; |
824 | clock.m2 = 0x05; | ||
825 | } else { | 824 | } else { |
826 | clock.dot = 270000; | ||
827 | clock.p = 10; | ||
828 | clock.p1 = 1; | 825 | clock.p1 = 1; |
829 | clock.p2 = 10; | 826 | clock.p2 = 10; |
830 | clock.n = 0x02; | 827 | clock.n = 1; |
831 | clock.m = 108; | 828 | clock.m1 = 14; |
832 | clock.m1 = 0x12; | 829 | clock.m2 = 2; |
833 | clock.m2 = 0x06; | ||
834 | } | 830 | } |
831 | clock.m = 5 * (clock.m1 + 2) + (clock.m2 + 2); | ||
832 | clock.p = (clock.p1 * clock.p2); | ||
833 | clock.dot = 96000 * clock.m / (clock.n + 2) / clock.p; | ||
835 | memcpy(best_clock, &clock, sizeof(intel_clock_t)); | 834 | memcpy(best_clock, &clock, sizeof(intel_clock_t)); |
836 | return true; | 835 | return true; |
837 | } | 836 | } |
@@ -1005,7 +1004,7 @@ static void igdng_crtc_dpms(struct drm_crtc *crtc, int mode) | |||
1005 | struct drm_i915_private *dev_priv = dev->dev_private; | 1004 | struct drm_i915_private *dev_priv = dev->dev_private; |
1006 | struct intel_crtc *intel_crtc = to_intel_crtc(crtc); | 1005 | struct intel_crtc *intel_crtc = to_intel_crtc(crtc); |
1007 | int pipe = intel_crtc->pipe; | 1006 | int pipe = intel_crtc->pipe; |
1008 | int plane = intel_crtc->pipe; | 1007 | int plane = intel_crtc->plane; |
1009 | int pch_dpll_reg = (pipe == 0) ? PCH_DPLL_A : PCH_DPLL_B; | 1008 | int pch_dpll_reg = (pipe == 0) ? PCH_DPLL_A : PCH_DPLL_B; |
1010 | int pipeconf_reg = (pipe == 0) ? PIPEACONF : PIPEBCONF; | 1009 | int pipeconf_reg = (pipe == 0) ? PIPEACONF : PIPEBCONF; |
1011 | int dspcntr_reg = (plane == 0) ? DSPACNTR : DSPBCNTR; | 1010 | int dspcntr_reg = (plane == 0) ? DSPACNTR : DSPBCNTR; |
@@ -1335,8 +1334,10 @@ static void i9xx_crtc_dpms(struct drm_crtc *crtc, int mode) | |||
1335 | 1334 | ||
1336 | /* Give the overlay scaler a chance to enable if it's on this pipe */ | 1335 | /* Give the overlay scaler a chance to enable if it's on this pipe */ |
1337 | //intel_crtc_dpms_video(crtc, true); TODO | 1336 | //intel_crtc_dpms_video(crtc, true); TODO |
1337 | intel_update_watermarks(dev); | ||
1338 | break; | 1338 | break; |
1339 | case DRM_MODE_DPMS_OFF: | 1339 | case DRM_MODE_DPMS_OFF: |
1340 | intel_update_watermarks(dev); | ||
1340 | /* Give the overlay scaler a chance to disable if it's on this pipe */ | 1341 | /* Give the overlay scaler a chance to disable if it's on this pipe */ |
1341 | //intel_crtc_dpms_video(crtc, FALSE); TODO | 1342 | //intel_crtc_dpms_video(crtc, FALSE); TODO |
1342 | 1343 | ||
@@ -1515,7 +1516,6 @@ static int intel_get_core_clock_speed(struct drm_device *dev) | |||
1515 | return 0; /* Silence gcc warning */ | 1516 | return 0; /* Silence gcc warning */ |
1516 | } | 1517 | } |
1517 | 1518 | ||
1518 | |||
1519 | /** | 1519 | /** |
1520 | * Return the pipe currently connected to the panel fitter, | 1520 | * Return the pipe currently connected to the panel fitter, |
1521 | * or -1 if the panel fitter is not present or not in use | 1521 | * or -1 if the panel fitter is not present or not in use |
@@ -1574,7 +1574,7 @@ igdng_compute_m_n(int bytes_per_pixel, int nlanes, | |||
1574 | 1574 | ||
1575 | temp = (u64) DATA_N * pixel_clock; | 1575 | temp = (u64) DATA_N * pixel_clock; |
1576 | temp = div_u64(temp, link_clock); | 1576 | temp = div_u64(temp, link_clock); |
1577 | m_n->gmch_m = (temp * bytes_per_pixel) / nlanes; | 1577 | m_n->gmch_m = div_u64(temp * bytes_per_pixel, nlanes); |
1578 | m_n->gmch_n = DATA_N; | 1578 | m_n->gmch_n = DATA_N; |
1579 | fdi_reduce_ratio(&m_n->gmch_m, &m_n->gmch_n); | 1579 | fdi_reduce_ratio(&m_n->gmch_m, &m_n->gmch_n); |
1580 | 1580 | ||
@@ -1585,6 +1585,420 @@ igdng_compute_m_n(int bytes_per_pixel, int nlanes, | |||
1585 | } | 1585 | } |
1586 | 1586 | ||
1587 | 1587 | ||
1588 | struct intel_watermark_params { | ||
1589 | unsigned long fifo_size; | ||
1590 | unsigned long max_wm; | ||
1591 | unsigned long default_wm; | ||
1592 | unsigned long guard_size; | ||
1593 | unsigned long cacheline_size; | ||
1594 | }; | ||
1595 | |||
1596 | /* IGD has different values for various configs */ | ||
1597 | static struct intel_watermark_params igd_display_wm = { | ||
1598 | IGD_DISPLAY_FIFO, | ||
1599 | IGD_MAX_WM, | ||
1600 | IGD_DFT_WM, | ||
1601 | IGD_GUARD_WM, | ||
1602 | IGD_FIFO_LINE_SIZE | ||
1603 | }; | ||
1604 | static struct intel_watermark_params igd_display_hplloff_wm = { | ||
1605 | IGD_DISPLAY_FIFO, | ||
1606 | IGD_MAX_WM, | ||
1607 | IGD_DFT_HPLLOFF_WM, | ||
1608 | IGD_GUARD_WM, | ||
1609 | IGD_FIFO_LINE_SIZE | ||
1610 | }; | ||
1611 | static struct intel_watermark_params igd_cursor_wm = { | ||
1612 | IGD_CURSOR_FIFO, | ||
1613 | IGD_CURSOR_MAX_WM, | ||
1614 | IGD_CURSOR_DFT_WM, | ||
1615 | IGD_CURSOR_GUARD_WM, | ||
1616 | IGD_FIFO_LINE_SIZE, | ||
1617 | }; | ||
1618 | static struct intel_watermark_params igd_cursor_hplloff_wm = { | ||
1619 | IGD_CURSOR_FIFO, | ||
1620 | IGD_CURSOR_MAX_WM, | ||
1621 | IGD_CURSOR_DFT_WM, | ||
1622 | IGD_CURSOR_GUARD_WM, | ||
1623 | IGD_FIFO_LINE_SIZE | ||
1624 | }; | ||
1625 | static struct intel_watermark_params i945_wm_info = { | ||
1626 | I915_FIFO_LINE_SIZE, | ||
1627 | I915_MAX_WM, | ||
1628 | 1, | ||
1629 | 0, | ||
1630 | IGD_FIFO_LINE_SIZE | ||
1631 | }; | ||
1632 | static struct intel_watermark_params i915_wm_info = { | ||
1633 | I945_FIFO_SIZE, | ||
1634 | I915_MAX_WM, | ||
1635 | 1, | ||
1636 | 0, | ||
1637 | I915_FIFO_LINE_SIZE | ||
1638 | }; | ||
1639 | static struct intel_watermark_params i855_wm_info = { | ||
1640 | I855GM_FIFO_SIZE, | ||
1641 | I915_MAX_WM, | ||
1642 | 1, | ||
1643 | 0, | ||
1644 | I830_FIFO_LINE_SIZE | ||
1645 | }; | ||
1646 | static struct intel_watermark_params i830_wm_info = { | ||
1647 | I830_FIFO_SIZE, | ||
1648 | I915_MAX_WM, | ||
1649 | 1, | ||
1650 | 0, | ||
1651 | I830_FIFO_LINE_SIZE | ||
1652 | }; | ||
1653 | |||
1654 | static unsigned long intel_calculate_wm(unsigned long clock_in_khz, | ||
1655 | struct intel_watermark_params *wm, | ||
1656 | int pixel_size, | ||
1657 | unsigned long latency_ns) | ||
1658 | { | ||
1659 | unsigned long bytes_required, wm_size; | ||
1660 | |||
1661 | bytes_required = (clock_in_khz * pixel_size * latency_ns) / 1000000; | ||
1662 | bytes_required /= wm->cacheline_size; | ||
1663 | wm_size = wm->fifo_size - bytes_required - wm->guard_size; | ||
1664 | |||
1665 | if (wm_size > wm->max_wm) | ||
1666 | wm_size = wm->max_wm; | ||
1667 | if (wm_size == 0) | ||
1668 | wm_size = wm->default_wm; | ||
1669 | return wm_size; | ||
1670 | } | ||
1671 | |||
1672 | struct cxsr_latency { | ||
1673 | int is_desktop; | ||
1674 | unsigned long fsb_freq; | ||
1675 | unsigned long mem_freq; | ||
1676 | unsigned long display_sr; | ||
1677 | unsigned long display_hpll_disable; | ||
1678 | unsigned long cursor_sr; | ||
1679 | unsigned long cursor_hpll_disable; | ||
1680 | }; | ||
1681 | |||
1682 | static struct cxsr_latency cxsr_latency_table[] = { | ||
1683 | {1, 800, 400, 3382, 33382, 3983, 33983}, /* DDR2-400 SC */ | ||
1684 | {1, 800, 667, 3354, 33354, 3807, 33807}, /* DDR2-667 SC */ | ||
1685 | {1, 800, 800, 3347, 33347, 3763, 33763}, /* DDR2-800 SC */ | ||
1686 | |||
1687 | {1, 667, 400, 3400, 33400, 4021, 34021}, /* DDR2-400 SC */ | ||
1688 | {1, 667, 667, 3372, 33372, 3845, 33845}, /* DDR2-667 SC */ | ||
1689 | {1, 667, 800, 3386, 33386, 3822, 33822}, /* DDR2-800 SC */ | ||
1690 | |||
1691 | {1, 400, 400, 3472, 33472, 4173, 34173}, /* DDR2-400 SC */ | ||
1692 | {1, 400, 667, 3443, 33443, 3996, 33996}, /* DDR2-667 SC */ | ||
1693 | {1, 400, 800, 3430, 33430, 3946, 33946}, /* DDR2-800 SC */ | ||
1694 | |||
1695 | {0, 800, 400, 3438, 33438, 4065, 34065}, /* DDR2-400 SC */ | ||
1696 | {0, 800, 667, 3410, 33410, 3889, 33889}, /* DDR2-667 SC */ | ||
1697 | {0, 800, 800, 3403, 33403, 3845, 33845}, /* DDR2-800 SC */ | ||
1698 | |||
1699 | {0, 667, 400, 3456, 33456, 4103, 34106}, /* DDR2-400 SC */ | ||
1700 | {0, 667, 667, 3428, 33428, 3927, 33927}, /* DDR2-667 SC */ | ||
1701 | {0, 667, 800, 3443, 33443, 3905, 33905}, /* DDR2-800 SC */ | ||
1702 | |||
1703 | {0, 400, 400, 3528, 33528, 4255, 34255}, /* DDR2-400 SC */ | ||
1704 | {0, 400, 667, 3500, 33500, 4079, 34079}, /* DDR2-667 SC */ | ||
1705 | {0, 400, 800, 3487, 33487, 4029, 34029}, /* DDR2-800 SC */ | ||
1706 | }; | ||
1707 | |||
1708 | static struct cxsr_latency *intel_get_cxsr_latency(int is_desktop, int fsb, | ||
1709 | int mem) | ||
1710 | { | ||
1711 | int i; | ||
1712 | struct cxsr_latency *latency; | ||
1713 | |||
1714 | if (fsb == 0 || mem == 0) | ||
1715 | return NULL; | ||
1716 | |||
1717 | for (i = 0; i < ARRAY_SIZE(cxsr_latency_table); i++) { | ||
1718 | latency = &cxsr_latency_table[i]; | ||
1719 | if (is_desktop == latency->is_desktop && | ||
1720 | fsb == latency->fsb_freq && mem == latency->mem_freq) | ||
1721 | break; | ||
1722 | } | ||
1723 | if (i >= ARRAY_SIZE(cxsr_latency_table)) { | ||
1724 | DRM_DEBUG("Unknown FSB/MEM found, disable CxSR\n"); | ||
1725 | return NULL; | ||
1726 | } | ||
1727 | return latency; | ||
1728 | } | ||
1729 | |||
1730 | static void igd_disable_cxsr(struct drm_device *dev) | ||
1731 | { | ||
1732 | struct drm_i915_private *dev_priv = dev->dev_private; | ||
1733 | u32 reg; | ||
1734 | |||
1735 | /* deactivate cxsr */ | ||
1736 | reg = I915_READ(DSPFW3); | ||
1737 | reg &= ~(IGD_SELF_REFRESH_EN); | ||
1738 | I915_WRITE(DSPFW3, reg); | ||
1739 | DRM_INFO("Big FIFO is disabled\n"); | ||
1740 | } | ||
1741 | |||
1742 | static void igd_enable_cxsr(struct drm_device *dev, unsigned long clock, | ||
1743 | int pixel_size) | ||
1744 | { | ||
1745 | struct drm_i915_private *dev_priv = dev->dev_private; | ||
1746 | u32 reg; | ||
1747 | unsigned long wm; | ||
1748 | struct cxsr_latency *latency; | ||
1749 | |||
1750 | latency = intel_get_cxsr_latency(IS_IGDG(dev), dev_priv->fsb_freq, | ||
1751 | dev_priv->mem_freq); | ||
1752 | if (!latency) { | ||
1753 | DRM_DEBUG("Unknown FSB/MEM found, disable CxSR\n"); | ||
1754 | igd_disable_cxsr(dev); | ||
1755 | return; | ||
1756 | } | ||
1757 | |||
1758 | /* Display SR */ | ||
1759 | wm = intel_calculate_wm(clock, &igd_display_wm, pixel_size, | ||
1760 | latency->display_sr); | ||
1761 | reg = I915_READ(DSPFW1); | ||
1762 | reg &= 0x7fffff; | ||
1763 | reg |= wm << 23; | ||
1764 | I915_WRITE(DSPFW1, reg); | ||
1765 | DRM_DEBUG("DSPFW1 register is %x\n", reg); | ||
1766 | |||
1767 | /* cursor SR */ | ||
1768 | wm = intel_calculate_wm(clock, &igd_cursor_wm, pixel_size, | ||
1769 | latency->cursor_sr); | ||
1770 | reg = I915_READ(DSPFW3); | ||
1771 | reg &= ~(0x3f << 24); | ||
1772 | reg |= (wm & 0x3f) << 24; | ||
1773 | I915_WRITE(DSPFW3, reg); | ||
1774 | |||
1775 | /* Display HPLL off SR */ | ||
1776 | wm = intel_calculate_wm(clock, &igd_display_hplloff_wm, | ||
1777 | latency->display_hpll_disable, I915_FIFO_LINE_SIZE); | ||
1778 | reg = I915_READ(DSPFW3); | ||
1779 | reg &= 0xfffffe00; | ||
1780 | reg |= wm & 0x1ff; | ||
1781 | I915_WRITE(DSPFW3, reg); | ||
1782 | |||
1783 | /* cursor HPLL off SR */ | ||
1784 | wm = intel_calculate_wm(clock, &igd_cursor_hplloff_wm, pixel_size, | ||
1785 | latency->cursor_hpll_disable); | ||
1786 | reg = I915_READ(DSPFW3); | ||
1787 | reg &= ~(0x3f << 16); | ||
1788 | reg |= (wm & 0x3f) << 16; | ||
1789 | I915_WRITE(DSPFW3, reg); | ||
1790 | DRM_DEBUG("DSPFW3 register is %x\n", reg); | ||
1791 | |||
1792 | /* activate cxsr */ | ||
1793 | reg = I915_READ(DSPFW3); | ||
1794 | reg |= IGD_SELF_REFRESH_EN; | ||
1795 | I915_WRITE(DSPFW3, reg); | ||
1796 | |||
1797 | DRM_INFO("Big FIFO is enabled\n"); | ||
1798 | |||
1799 | return; | ||
1800 | } | ||
1801 | |||
1802 | const static int latency_ns = 5000; /* default for non-igd platforms */ | ||
1803 | |||
1804 | |||
1805 | static void i965_update_wm(struct drm_device *dev) | ||
1806 | { | ||
1807 | struct drm_i915_private *dev_priv = dev->dev_private; | ||
1808 | |||
1809 | DRM_DEBUG("Setting FIFO watermarks - A: 8, B: 8, C: 8, SR 8\n"); | ||
1810 | |||
1811 | /* 965 has limitations... */ | ||
1812 | I915_WRITE(DSPFW1, (8 << 16) | (8 << 8) | (8 << 0)); | ||
1813 | I915_WRITE(DSPFW2, (8 << 8) | (8 << 0)); | ||
1814 | } | ||
1815 | |||
1816 | static void i9xx_update_wm(struct drm_device *dev, int planea_clock, | ||
1817 | int planeb_clock, int sr_hdisplay, int pixel_size) | ||
1818 | { | ||
1819 | struct drm_i915_private *dev_priv = dev->dev_private; | ||
1820 | uint32_t fwater_lo = I915_READ(FW_BLC) & MM_FIFO_WATERMARK; | ||
1821 | uint32_t fwater_hi = I915_READ(FW_BLC2) & LM_FIFO_WATERMARK; | ||
1822 | int bsize, asize, cwm, bwm = 1, awm = 1, srwm = 1; | ||
1823 | uint32_t dsparb = I915_READ(DSPARB); | ||
1824 | int planea_entries, planeb_entries; | ||
1825 | struct intel_watermark_params *wm_params; | ||
1826 | unsigned long line_time_us; | ||
1827 | int sr_clock, sr_entries = 0; | ||
1828 | |||
1829 | if (IS_I965GM(dev) || IS_I945GM(dev)) | ||
1830 | wm_params = &i945_wm_info; | ||
1831 | else if (IS_I9XX(dev)) | ||
1832 | wm_params = &i915_wm_info; | ||
1833 | else | ||
1834 | wm_params = &i855_wm_info; | ||
1835 | |||
1836 | planea_entries = intel_calculate_wm(planea_clock, wm_params, | ||
1837 | pixel_size, latency_ns); | ||
1838 | planeb_entries = intel_calculate_wm(planeb_clock, wm_params, | ||
1839 | pixel_size, latency_ns); | ||
1840 | |||
1841 | DRM_DEBUG("FIFO entries - A: %d, B: %d\n", planea_entries, | ||
1842 | planeb_entries); | ||
1843 | |||
1844 | if (IS_I9XX(dev)) { | ||
1845 | asize = dsparb & 0x7f; | ||
1846 | bsize = (dsparb >> DSPARB_CSTART_SHIFT) & 0x7f; | ||
1847 | } else { | ||
1848 | asize = dsparb & 0x1ff; | ||
1849 | bsize = (dsparb >> DSPARB_BEND_SHIFT) & 0x1ff; | ||
1850 | } | ||
1851 | DRM_DEBUG("FIFO size - A: %d, B: %d\n", asize, bsize); | ||
1852 | |||
1853 | /* Two extra entries for padding */ | ||
1854 | awm = asize - (planea_entries + 2); | ||
1855 | bwm = bsize - (planeb_entries + 2); | ||
1856 | |||
1857 | /* Sanity check against potentially bad FIFO allocations */ | ||
1858 | if (awm <= 0) { | ||
1859 | /* pipe is on but has too few FIFO entries */ | ||
1860 | if (planea_entries != 0) | ||
1861 | DRM_DEBUG("plane A needs more FIFO entries\n"); | ||
1862 | awm = 1; | ||
1863 | } | ||
1864 | if (bwm <= 0) { | ||
1865 | if (planeb_entries != 0) | ||
1866 | DRM_DEBUG("plane B needs more FIFO entries\n"); | ||
1867 | bwm = 1; | ||
1868 | } | ||
1869 | |||
1870 | /* | ||
1871 | * Overlay gets an aggressive default since video jitter is bad. | ||
1872 | */ | ||
1873 | cwm = 2; | ||
1874 | |||
1875 | /* Calc sr entries for one pipe configs */ | ||
1876 | if (!planea_clock || !planeb_clock) { | ||
1877 | sr_clock = planea_clock ? planea_clock : planeb_clock; | ||
1878 | line_time_us = (sr_hdisplay * 1000) / sr_clock; | ||
1879 | sr_entries = (((latency_ns / line_time_us) + 1) * pixel_size * | ||
1880 | sr_hdisplay) / 1000; | ||
1881 | sr_entries = roundup(sr_entries / wm_params->cacheline_size, 1); | ||
1882 | if (sr_entries < wm_params->fifo_size) | ||
1883 | srwm = wm_params->fifo_size - sr_entries; | ||
1884 | } | ||
1885 | |||
1886 | DRM_DEBUG("Setting FIFO watermarks - A: %d, B: %d, C: %d, SR %d\n", | ||
1887 | awm, bwm, cwm, srwm); | ||
1888 | |||
1889 | fwater_lo = fwater_lo | ((bwm & 0x3f) << 16) | (awm & 0x3f); | ||
1890 | fwater_hi = fwater_hi | (cwm & 0x1f); | ||
1891 | |||
1892 | I915_WRITE(FW_BLC, fwater_lo); | ||
1893 | I915_WRITE(FW_BLC2, fwater_hi); | ||
1894 | if (IS_I9XX(dev)) | ||
1895 | I915_WRITE(FW_BLC_SELF, FW_BLC_SELF_EN | (srwm & 0x3f)); | ||
1896 | } | ||
1897 | |||
1898 | static void i830_update_wm(struct drm_device *dev, int planea_clock, | ||
1899 | int pixel_size) | ||
1900 | { | ||
1901 | struct drm_i915_private *dev_priv = dev->dev_private; | ||
1902 | uint32_t dsparb = I915_READ(DSPARB); | ||
1903 | uint32_t fwater_lo = I915_READ(FW_BLC) & MM_FIFO_WATERMARK; | ||
1904 | unsigned int asize, awm; | ||
1905 | int planea_entries; | ||
1906 | |||
1907 | planea_entries = intel_calculate_wm(planea_clock, &i830_wm_info, | ||
1908 | pixel_size, latency_ns); | ||
1909 | |||
1910 | asize = dsparb & 0x7f; | ||
1911 | |||
1912 | awm = asize - planea_entries; | ||
1913 | |||
1914 | fwater_lo = fwater_lo | awm; | ||
1915 | |||
1916 | I915_WRITE(FW_BLC, fwater_lo); | ||
1917 | } | ||
1918 | |||
1919 | /** | ||
1920 | * intel_update_watermarks - update FIFO watermark values based on current modes | ||
1921 | * | ||
1922 | * Calculate watermark values for the various WM regs based on current mode | ||
1923 | * and plane configuration. | ||
1924 | * | ||
1925 | * There are several cases to deal with here: | ||
1926 | * - normal (i.e. non-self-refresh) | ||
1927 | * - self-refresh (SR) mode | ||
1928 | * - lines are large relative to FIFO size (buffer can hold up to 2) | ||
1929 | * - lines are small relative to FIFO size (buffer can hold more than 2 | ||
1930 | * lines), so need to account for TLB latency | ||
1931 | * | ||
1932 | * The normal calculation is: | ||
1933 | * watermark = dotclock * bytes per pixel * latency | ||
1934 | * where latency is platform & configuration dependent (we assume pessimal | ||
1935 | * values here). | ||
1936 | * | ||
1937 | * The SR calculation is: | ||
1938 | * watermark = (trunc(latency/line time)+1) * surface width * | ||
1939 | * bytes per pixel | ||
1940 | * where | ||
1941 | * line time = htotal / dotclock | ||
1942 | * and latency is assumed to be high, as above. | ||
1943 | * | ||
1944 | * The final value programmed to the register should always be rounded up, | ||
1945 | * and include an extra 2 entries to account for clock crossings. | ||
1946 | * | ||
1947 | * We don't use the sprite, so we can ignore that. And on Crestline we have | ||
1948 | * to set the non-SR watermarks to 8. | ||
1949 | */ | ||
1950 | static void intel_update_watermarks(struct drm_device *dev) | ||
1951 | { | ||
1952 | struct drm_crtc *crtc; | ||
1953 | struct intel_crtc *intel_crtc; | ||
1954 | int sr_hdisplay = 0; | ||
1955 | unsigned long planea_clock = 0, planeb_clock = 0, sr_clock = 0; | ||
1956 | int enabled = 0, pixel_size = 0; | ||
1957 | |||
1958 | if (DSPARB_HWCONTROL(dev)) | ||
1959 | return; | ||
1960 | |||
1961 | /* Get the clock config from both planes */ | ||
1962 | list_for_each_entry(crtc, &dev->mode_config.crtc_list, head) { | ||
1963 | intel_crtc = to_intel_crtc(crtc); | ||
1964 | if (crtc->enabled) { | ||
1965 | enabled++; | ||
1966 | if (intel_crtc->plane == 0) { | ||
1967 | DRM_DEBUG("plane A (pipe %d) clock: %d\n", | ||
1968 | intel_crtc->pipe, crtc->mode.clock); | ||
1969 | planea_clock = crtc->mode.clock; | ||
1970 | } else { | ||
1971 | DRM_DEBUG("plane B (pipe %d) clock: %d\n", | ||
1972 | intel_crtc->pipe, crtc->mode.clock); | ||
1973 | planeb_clock = crtc->mode.clock; | ||
1974 | } | ||
1975 | sr_hdisplay = crtc->mode.hdisplay; | ||
1976 | sr_clock = crtc->mode.clock; | ||
1977 | if (crtc->fb) | ||
1978 | pixel_size = crtc->fb->bits_per_pixel / 8; | ||
1979 | else | ||
1980 | pixel_size = 4; /* by default */ | ||
1981 | } | ||
1982 | } | ||
1983 | |||
1984 | if (enabled <= 0) | ||
1985 | return; | ||
1986 | |||
1987 | /* Single pipe configs can enable self refresh */ | ||
1988 | if (enabled == 1 && IS_IGD(dev)) | ||
1989 | igd_enable_cxsr(dev, sr_clock, pixel_size); | ||
1990 | else if (IS_IGD(dev)) | ||
1991 | igd_disable_cxsr(dev); | ||
1992 | |||
1993 | if (IS_I965G(dev)) | ||
1994 | i965_update_wm(dev); | ||
1995 | else if (IS_I9XX(dev) || IS_MOBILE(dev)) | ||
1996 | i9xx_update_wm(dev, planea_clock, planeb_clock, sr_hdisplay, | ||
1997 | pixel_size); | ||
1998 | else | ||
1999 | i830_update_wm(dev, planea_clock, pixel_size); | ||
2000 | } | ||
2001 | |||
1588 | static int intel_crtc_mode_set(struct drm_crtc *crtc, | 2002 | static int intel_crtc_mode_set(struct drm_crtc *crtc, |
1589 | struct drm_display_mode *mode, | 2003 | struct drm_display_mode *mode, |
1590 | struct drm_display_mode *adjusted_mode, | 2004 | struct drm_display_mode *adjusted_mode, |
@@ -1951,6 +2365,9 @@ static int intel_crtc_mode_set(struct drm_crtc *crtc, | |||
1951 | 2365 | ||
1952 | /* Flush the plane changes */ | 2366 | /* Flush the plane changes */ |
1953 | ret = intel_pipe_set_base(crtc, x, y, old_fb); | 2367 | ret = intel_pipe_set_base(crtc, x, y, old_fb); |
2368 | |||
2369 | intel_update_watermarks(dev); | ||
2370 | |||
1954 | drm_vblank_post_modeset(dev, pipe); | 2371 | drm_vblank_post_modeset(dev, pipe); |
1955 | 2372 | ||
1956 | return ret; | 2373 | return ret; |
@@ -2439,6 +2856,7 @@ static void intel_crtc_init(struct drm_device *dev, int pipe) | |||
2439 | 2856 | ||
2440 | drm_mode_crtc_set_gamma_size(&intel_crtc->base, 256); | 2857 | drm_mode_crtc_set_gamma_size(&intel_crtc->base, 256); |
2441 | intel_crtc->pipe = pipe; | 2858 | intel_crtc->pipe = pipe; |
2859 | intel_crtc->plane = pipe; | ||
2442 | for (i = 0; i < 256; i++) { | 2860 | for (i = 0; i < 256; i++) { |
2443 | intel_crtc->lut_r[i] = i; | 2861 | intel_crtc->lut_r[i] = i; |
2444 | intel_crtc->lut_g[i] = i; | 2862 | intel_crtc->lut_g[i] = i; |
diff --git a/drivers/gpu/drm/i915/intel_dp.c b/drivers/gpu/drm/i915/intel_dp.c index 8f8d37d5663..6770ae88370 100644 --- a/drivers/gpu/drm/i915/intel_dp.c +++ b/drivers/gpu/drm/i915/intel_dp.c | |||
@@ -246,7 +246,7 @@ intel_dp_aux_ch(struct intel_output *intel_output, | |||
246 | } | 246 | } |
247 | 247 | ||
248 | if ((status & DP_AUX_CH_CTL_DONE) == 0) { | 248 | if ((status & DP_AUX_CH_CTL_DONE) == 0) { |
249 | printk(KERN_ERR "dp_aux_ch not done status 0x%08x\n", status); | 249 | DRM_ERROR("dp_aux_ch not done status 0x%08x\n", status); |
250 | return -EBUSY; | 250 | return -EBUSY; |
251 | } | 251 | } |
252 | 252 | ||
@@ -254,11 +254,14 @@ intel_dp_aux_ch(struct intel_output *intel_output, | |||
254 | * Timeouts occur when the sink is not connected | 254 | * Timeouts occur when the sink is not connected |
255 | */ | 255 | */ |
256 | if (status & DP_AUX_CH_CTL_RECEIVE_ERROR) { | 256 | if (status & DP_AUX_CH_CTL_RECEIVE_ERROR) { |
257 | printk(KERN_ERR "dp_aux_ch receive error status 0x%08x\n", status); | 257 | DRM_ERROR("dp_aux_ch receive error status 0x%08x\n", status); |
258 | return -EIO; | 258 | return -EIO; |
259 | } | 259 | } |
260 | |||
261 | /* Timeouts occur when the device isn't connected, so they're | ||
262 | * "normal" -- don't fill the kernel log with these */ | ||
260 | if (status & DP_AUX_CH_CTL_TIME_OUT_ERROR) { | 263 | if (status & DP_AUX_CH_CTL_TIME_OUT_ERROR) { |
261 | printk(KERN_ERR "dp_aux_ch timeout status 0x%08x\n", status); | 264 | DRM_DEBUG("dp_aux_ch timeout status 0x%08x\n", status); |
262 | return -ETIMEDOUT; | 265 | return -ETIMEDOUT; |
263 | } | 266 | } |
264 | 267 | ||
@@ -411,7 +414,7 @@ intel_dp_mode_fixup(struct drm_encoder *encoder, struct drm_display_mode *mode, | |||
411 | dp_priv->link_bw = bws[clock]; | 414 | dp_priv->link_bw = bws[clock]; |
412 | dp_priv->lane_count = lane_count; | 415 | dp_priv->lane_count = lane_count; |
413 | adjusted_mode->clock = intel_dp_link_clock(dp_priv->link_bw); | 416 | adjusted_mode->clock = intel_dp_link_clock(dp_priv->link_bw); |
414 | printk(KERN_ERR "link bw %02x lane count %d clock %d\n", | 417 | DRM_DEBUG("Display port link bw %02x lane count %d clock %d\n", |
415 | dp_priv->link_bw, dp_priv->lane_count, | 418 | dp_priv->link_bw, dp_priv->lane_count, |
416 | adjusted_mode->clock); | 419 | adjusted_mode->clock); |
417 | return true; | 420 | return true; |
diff --git a/drivers/gpu/drm/i915/intel_dp_i2c.c b/drivers/gpu/drm/i915/intel_dp_i2c.c index 4e60f14b1a6..a63b6f57d2d 100644 --- a/drivers/gpu/drm/i915/intel_dp_i2c.c +++ b/drivers/gpu/drm/i915/intel_dp_i2c.c | |||
@@ -29,6 +29,7 @@ | |||
29 | #include <linux/sched.h> | 29 | #include <linux/sched.h> |
30 | #include <linux/i2c.h> | 30 | #include <linux/i2c.h> |
31 | #include "intel_dp.h" | 31 | #include "intel_dp.h" |
32 | #include "drmP.h" | ||
32 | 33 | ||
33 | /* Run a single AUX_CH I2C transaction, writing/reading data as necessary */ | 34 | /* Run a single AUX_CH I2C transaction, writing/reading data as necessary */ |
34 | 35 | ||
@@ -84,7 +85,7 @@ i2c_algo_dp_aux_transaction(struct i2c_adapter *adapter, int mode, | |||
84 | msg, msg_bytes, | 85 | msg, msg_bytes, |
85 | reply, reply_bytes); | 86 | reply, reply_bytes); |
86 | if (ret < 0) { | 87 | if (ret < 0) { |
87 | printk(KERN_ERR "aux_ch failed %d\n", ret); | 88 | DRM_DEBUG("aux_ch failed %d\n", ret); |
88 | return ret; | 89 | return ret; |
89 | } | 90 | } |
90 | switch (reply[0] & AUX_I2C_REPLY_MASK) { | 91 | switch (reply[0] & AUX_I2C_REPLY_MASK) { |
@@ -94,14 +95,14 @@ i2c_algo_dp_aux_transaction(struct i2c_adapter *adapter, int mode, | |||
94 | } | 95 | } |
95 | return reply_bytes - 1; | 96 | return reply_bytes - 1; |
96 | case AUX_I2C_REPLY_NACK: | 97 | case AUX_I2C_REPLY_NACK: |
97 | printk(KERN_ERR "aux_ch nack\n"); | 98 | DRM_DEBUG("aux_ch nack\n"); |
98 | return -EREMOTEIO; | 99 | return -EREMOTEIO; |
99 | case AUX_I2C_REPLY_DEFER: | 100 | case AUX_I2C_REPLY_DEFER: |
100 | printk(KERN_ERR "aux_ch defer\n"); | 101 | DRM_DEBUG("aux_ch defer\n"); |
101 | udelay(100); | 102 | udelay(100); |
102 | break; | 103 | break; |
103 | default: | 104 | default: |
104 | printk(KERN_ERR "aux_ch invalid reply 0x%02x\n", reply[0]); | 105 | DRM_ERROR("aux_ch invalid reply 0x%02x\n", reply[0]); |
105 | return -EREMOTEIO; | 106 | return -EREMOTEIO; |
106 | } | 107 | } |
107 | } | 108 | } |
@@ -223,7 +224,7 @@ i2c_algo_dp_aux_xfer(struct i2c_adapter *adapter, | |||
223 | if (ret >= 0) | 224 | if (ret >= 0) |
224 | ret = num; | 225 | ret = num; |
225 | i2c_algo_dp_aux_stop(adapter, reading); | 226 | i2c_algo_dp_aux_stop(adapter, reading); |
226 | printk(KERN_ERR "dp_aux_xfer return %d\n", ret); | 227 | DRM_DEBUG("dp_aux_xfer return %d\n", ret); |
227 | return ret; | 228 | return ret; |
228 | } | 229 | } |
229 | 230 | ||
diff --git a/drivers/gpu/drm/i915/intel_fb.c b/drivers/gpu/drm/i915/intel_fb.c index 1af7d68e380..1d30802e773 100644 --- a/drivers/gpu/drm/i915/intel_fb.c +++ b/drivers/gpu/drm/i915/intel_fb.c | |||
@@ -453,7 +453,7 @@ static int intelfb_create(struct drm_device *dev, uint32_t fb_width, | |||
453 | size = ALIGN(size, PAGE_SIZE); | 453 | size = ALIGN(size, PAGE_SIZE); |
454 | fbo = drm_gem_object_alloc(dev, size); | 454 | fbo = drm_gem_object_alloc(dev, size); |
455 | if (!fbo) { | 455 | if (!fbo) { |
456 | printk(KERN_ERR "failed to allocate framebuffer\n"); | 456 | DRM_ERROR("failed to allocate framebuffer\n"); |
457 | ret = -ENOMEM; | 457 | ret = -ENOMEM; |
458 | goto out; | 458 | goto out; |
459 | } | 459 | } |
@@ -610,8 +610,8 @@ static int intelfb_create(struct drm_device *dev, uint32_t fb_width, | |||
610 | par->dev = dev; | 610 | par->dev = dev; |
611 | 611 | ||
612 | /* To allow resizeing without swapping buffers */ | 612 | /* To allow resizeing without swapping buffers */ |
613 | printk("allocated %dx%d fb: 0x%08x, bo %p\n", intel_fb->base.width, | 613 | DRM_DEBUG("allocated %dx%d fb: 0x%08x, bo %p\n", intel_fb->base.width, |
614 | intel_fb->base.height, obj_priv->gtt_offset, fbo); | 614 | intel_fb->base.height, obj_priv->gtt_offset, fbo); |
615 | 615 | ||
616 | mutex_unlock(&dev->struct_mutex); | 616 | mutex_unlock(&dev->struct_mutex); |
617 | return 0; | 617 | return 0; |
@@ -698,13 +698,13 @@ static int intelfb_multi_fb_probe_crtc(struct drm_device *dev, struct drm_crtc * | |||
698 | } else | 698 | } else |
699 | intelfb_set_par(info); | 699 | intelfb_set_par(info); |
700 | 700 | ||
701 | printk(KERN_INFO "fb%d: %s frame buffer device\n", info->node, | 701 | DRM_INFO("fb%d: %s frame buffer device\n", info->node, |
702 | info->fix.id); | 702 | info->fix.id); |
703 | 703 | ||
704 | /* Switch back to kernel console on panic */ | 704 | /* Switch back to kernel console on panic */ |
705 | kernelfb_mode = *modeset; | 705 | kernelfb_mode = *modeset; |
706 | atomic_notifier_chain_register(&panic_notifier_list, &paniced); | 706 | atomic_notifier_chain_register(&panic_notifier_list, &paniced); |
707 | printk(KERN_INFO "registered panic notifier\n"); | 707 | DRM_DEBUG("registered panic notifier\n"); |
708 | 708 | ||
709 | return 0; | 709 | return 0; |
710 | } | 710 | } |
@@ -852,13 +852,13 @@ static int intelfb_single_fb_probe(struct drm_device *dev) | |||
852 | } else | 852 | } else |
853 | intelfb_set_par(info); | 853 | intelfb_set_par(info); |
854 | 854 | ||
855 | printk(KERN_INFO "fb%d: %s frame buffer device\n", info->node, | 855 | DRM_INFO("fb%d: %s frame buffer device\n", info->node, |
856 | info->fix.id); | 856 | info->fix.id); |
857 | 857 | ||
858 | /* Switch back to kernel console on panic */ | 858 | /* Switch back to kernel console on panic */ |
859 | kernelfb_mode = *modeset; | 859 | kernelfb_mode = *modeset; |
860 | atomic_notifier_chain_register(&panic_notifier_list, &paniced); | 860 | atomic_notifier_chain_register(&panic_notifier_list, &paniced); |
861 | printk(KERN_INFO "registered panic notifier\n"); | 861 | DRM_DEBUG("registered panic notifier\n"); |
862 | 862 | ||
863 | return 0; | 863 | return 0; |
864 | } | 864 | } |
@@ -872,8 +872,8 @@ void intelfb_restore(void) | |||
872 | { | 872 | { |
873 | int ret; | 873 | int ret; |
874 | if ((ret = drm_crtc_helper_set_config(&kernelfb_mode)) != 0) { | 874 | if ((ret = drm_crtc_helper_set_config(&kernelfb_mode)) != 0) { |
875 | printk(KERN_ERR "Failed to restore crtc configuration: %d\n", | 875 | DRM_ERROR("Failed to restore crtc configuration: %d\n", |
876 | ret); | 876 | ret); |
877 | } | 877 | } |
878 | } | 878 | } |
879 | 879 | ||
diff --git a/drivers/gpu/drm/i915/intel_lvds.c b/drivers/gpu/drm/i915/intel_lvds.c index 9564ca44a97..9ab38efffec 100644 --- a/drivers/gpu/drm/i915/intel_lvds.c +++ b/drivers/gpu/drm/i915/intel_lvds.c | |||
@@ -36,6 +36,7 @@ | |||
36 | #include "intel_drv.h" | 36 | #include "intel_drv.h" |
37 | #include "i915_drm.h" | 37 | #include "i915_drm.h" |
38 | #include "i915_drv.h" | 38 | #include "i915_drv.h" |
39 | #include <linux/acpi.h> | ||
39 | 40 | ||
40 | #define I915_LVDS "i915_lvds" | 41 | #define I915_LVDS "i915_lvds" |
41 | 42 | ||
@@ -252,14 +253,14 @@ static bool intel_lvds_mode_fixup(struct drm_encoder *encoder, | |||
252 | 253 | ||
253 | /* Should never happen!! */ | 254 | /* Should never happen!! */ |
254 | if (!IS_I965G(dev) && intel_crtc->pipe == 0) { | 255 | if (!IS_I965G(dev) && intel_crtc->pipe == 0) { |
255 | printk(KERN_ERR "Can't support LVDS on pipe A\n"); | 256 | DRM_ERROR("Can't support LVDS on pipe A\n"); |
256 | return false; | 257 | return false; |
257 | } | 258 | } |
258 | 259 | ||
259 | /* Should never happen!! */ | 260 | /* Should never happen!! */ |
260 | list_for_each_entry(tmp_encoder, &dev->mode_config.encoder_list, head) { | 261 | list_for_each_entry(tmp_encoder, &dev->mode_config.encoder_list, head) { |
261 | if (tmp_encoder != encoder && tmp_encoder->crtc == encoder->crtc) { | 262 | if (tmp_encoder != encoder && tmp_encoder->crtc == encoder->crtc) { |
262 | printk(KERN_ERR "Can't enable LVDS and another " | 263 | DRM_ERROR("Can't enable LVDS and another " |
263 | "encoder on the same pipe\n"); | 264 | "encoder on the same pipe\n"); |
264 | return false; | 265 | return false; |
265 | } | 266 | } |
@@ -788,6 +789,65 @@ static const struct dmi_system_id intel_no_lvds[] = { | |||
788 | { } /* terminating entry */ | 789 | { } /* terminating entry */ |
789 | }; | 790 | }; |
790 | 791 | ||
792 | #ifdef CONFIG_ACPI | ||
793 | /* | ||
794 | * check_lid_device -- check whether @handle is an ACPI LID device. | ||
795 | * @handle: ACPI device handle | ||
796 | * @level : depth in the ACPI namespace tree | ||
797 | * @context: the number of LID device when we find the device | ||
798 | * @rv: a return value to fill if desired (Not use) | ||
799 | */ | ||
800 | static acpi_status | ||
801 | check_lid_device(acpi_handle handle, u32 level, void *context, | ||
802 | void **return_value) | ||
803 | { | ||
804 | struct acpi_device *acpi_dev; | ||
805 | int *lid_present = context; | ||
806 | |||
807 | acpi_dev = NULL; | ||
808 | /* Get the acpi device for device handle */ | ||
809 | if (acpi_bus_get_device(handle, &acpi_dev) || !acpi_dev) { | ||
810 | /* If there is no ACPI device for handle, return */ | ||
811 | return AE_OK; | ||
812 | } | ||
813 | |||
814 | if (!strncmp(acpi_device_hid(acpi_dev), "PNP0C0D", 7)) | ||
815 | *lid_present = 1; | ||
816 | |||
817 | return AE_OK; | ||
818 | } | ||
819 | |||
820 | /** | ||
821 | * check whether there exists the ACPI LID device by enumerating the ACPI | ||
822 | * device tree. | ||
823 | */ | ||
824 | static int intel_lid_present(void) | ||
825 | { | ||
826 | int lid_present = 0; | ||
827 | |||
828 | if (acpi_disabled) { | ||
829 | /* If ACPI is disabled, there is no ACPI device tree to | ||
830 | * check, so assume the LID device would have been present. | ||
831 | */ | ||
832 | return 1; | ||
833 | } | ||
834 | |||
835 | acpi_walk_namespace(ACPI_TYPE_DEVICE, ACPI_ROOT_OBJECT, | ||
836 | ACPI_UINT32_MAX, | ||
837 | check_lid_device, &lid_present, NULL); | ||
838 | |||
839 | return lid_present; | ||
840 | } | ||
841 | #else | ||
842 | static int intel_lid_present(void) | ||
843 | { | ||
844 | /* In the absence of ACPI built in, assume that the LID device would | ||
845 | * have been present. | ||
846 | */ | ||
847 | return 1; | ||
848 | } | ||
849 | #endif | ||
850 | |||
791 | /** | 851 | /** |
792 | * intel_lvds_init - setup LVDS connectors on this device | 852 | * intel_lvds_init - setup LVDS connectors on this device |
793 | * @dev: drm device | 853 | * @dev: drm device |
@@ -811,6 +871,16 @@ void intel_lvds_init(struct drm_device *dev) | |||
811 | if (dmi_check_system(intel_no_lvds)) | 871 | if (dmi_check_system(intel_no_lvds)) |
812 | return; | 872 | return; |
813 | 873 | ||
874 | /* Assume that any device without an ACPI LID device also doesn't | ||
875 | * have an integrated LVDS. We would be better off parsing the BIOS | ||
876 | * to get a reliable indicator, but that code isn't written yet. | ||
877 | * | ||
878 | * In the case of all-in-one desktops using LVDS that we've seen, | ||
879 | * they're using SDVO LVDS. | ||
880 | */ | ||
881 | if (!intel_lid_present()) | ||
882 | return; | ||
883 | |||
814 | if (IS_IGDNG(dev)) { | 884 | if (IS_IGDNG(dev)) { |
815 | if ((I915_READ(PCH_LVDS) & LVDS_DETECTED) == 0) | 885 | if ((I915_READ(PCH_LVDS) & LVDS_DETECTED) == 0) |
816 | return; | 886 | return; |
diff --git a/drivers/gpu/drm/i915/intel_sdvo.c b/drivers/gpu/drm/i915/intel_sdvo.c index f03473779fe..4f0c30948bc 100644 --- a/drivers/gpu/drm/i915/intel_sdvo.c +++ b/drivers/gpu/drm/i915/intel_sdvo.c | |||
@@ -68,12 +68,23 @@ struct intel_sdvo_priv { | |||
68 | * This is set if we treat the device as HDMI, instead of DVI. | 68 | * This is set if we treat the device as HDMI, instead of DVI. |
69 | */ | 69 | */ |
70 | bool is_hdmi; | 70 | bool is_hdmi; |
71 | |||
71 | /** | 72 | /** |
72 | * This is set if we detect output of sdvo device as LVDS. | 73 | * This is set if we detect output of sdvo device as LVDS. |
73 | */ | 74 | */ |
74 | bool is_lvds; | 75 | bool is_lvds; |
75 | 76 | ||
76 | /** | 77 | /** |
78 | * This is sdvo flags for input timing. | ||
79 | */ | ||
80 | uint8_t sdvo_flags; | ||
81 | |||
82 | /** | ||
83 | * This is sdvo fixed pannel mode pointer | ||
84 | */ | ||
85 | struct drm_display_mode *sdvo_lvds_fixed_mode; | ||
86 | |||
87 | /** | ||
77 | * Returned SDTV resolutions allowed for the current format, if the | 88 | * Returned SDTV resolutions allowed for the current format, if the |
78 | * device reported it. | 89 | * device reported it. |
79 | */ | 90 | */ |
@@ -592,6 +603,7 @@ intel_sdvo_create_preferred_input_timing(struct intel_output *output, | |||
592 | uint16_t height) | 603 | uint16_t height) |
593 | { | 604 | { |
594 | struct intel_sdvo_preferred_input_timing_args args; | 605 | struct intel_sdvo_preferred_input_timing_args args; |
606 | struct intel_sdvo_priv *sdvo_priv = output->dev_priv; | ||
595 | uint8_t status; | 607 | uint8_t status; |
596 | 608 | ||
597 | memset(&args, 0, sizeof(args)); | 609 | memset(&args, 0, sizeof(args)); |
@@ -599,7 +611,12 @@ intel_sdvo_create_preferred_input_timing(struct intel_output *output, | |||
599 | args.width = width; | 611 | args.width = width; |
600 | args.height = height; | 612 | args.height = height; |
601 | args.interlace = 0; | 613 | args.interlace = 0; |
602 | args.scaled = 0; | 614 | |
615 | if (sdvo_priv->is_lvds && | ||
616 | (sdvo_priv->sdvo_lvds_fixed_mode->hdisplay != width || | ||
617 | sdvo_priv->sdvo_lvds_fixed_mode->vdisplay != height)) | ||
618 | args.scaled = 1; | ||
619 | |||
603 | intel_sdvo_write_cmd(output, SDVO_CMD_CREATE_PREFERRED_INPUT_TIMING, | 620 | intel_sdvo_write_cmd(output, SDVO_CMD_CREATE_PREFERRED_INPUT_TIMING, |
604 | &args, sizeof(args)); | 621 | &args, sizeof(args)); |
605 | status = intel_sdvo_read_response(output, NULL, 0); | 622 | status = intel_sdvo_read_response(output, NULL, 0); |
@@ -944,12 +961,7 @@ static bool intel_sdvo_mode_fixup(struct drm_encoder *encoder, | |||
944 | struct intel_output *output = enc_to_intel_output(encoder); | 961 | struct intel_output *output = enc_to_intel_output(encoder); |
945 | struct intel_sdvo_priv *dev_priv = output->dev_priv; | 962 | struct intel_sdvo_priv *dev_priv = output->dev_priv; |
946 | 963 | ||
947 | if (!dev_priv->is_tv) { | 964 | if (dev_priv->is_tv) { |
948 | /* Make the CRTC code factor in the SDVO pixel multiplier. The | ||
949 | * SDVO device will be told of the multiplier during mode_set. | ||
950 | */ | ||
951 | adjusted_mode->clock *= intel_sdvo_get_pixel_multiplier(mode); | ||
952 | } else { | ||
953 | struct intel_sdvo_dtd output_dtd; | 965 | struct intel_sdvo_dtd output_dtd; |
954 | bool success; | 966 | bool success; |
955 | 967 | ||
@@ -980,6 +992,47 @@ static bool intel_sdvo_mode_fixup(struct drm_encoder *encoder, | |||
980 | intel_sdvo_get_preferred_input_timing(output, | 992 | intel_sdvo_get_preferred_input_timing(output, |
981 | &input_dtd); | 993 | &input_dtd); |
982 | intel_sdvo_get_mode_from_dtd(adjusted_mode, &input_dtd); | 994 | intel_sdvo_get_mode_from_dtd(adjusted_mode, &input_dtd); |
995 | dev_priv->sdvo_flags = input_dtd.part2.sdvo_flags; | ||
996 | |||
997 | drm_mode_set_crtcinfo(adjusted_mode, 0); | ||
998 | |||
999 | mode->clock = adjusted_mode->clock; | ||
1000 | |||
1001 | adjusted_mode->clock *= | ||
1002 | intel_sdvo_get_pixel_multiplier(mode); | ||
1003 | } else { | ||
1004 | return false; | ||
1005 | } | ||
1006 | } else if (dev_priv->is_lvds) { | ||
1007 | struct intel_sdvo_dtd output_dtd; | ||
1008 | bool success; | ||
1009 | |||
1010 | drm_mode_set_crtcinfo(dev_priv->sdvo_lvds_fixed_mode, 0); | ||
1011 | /* Set output timings */ | ||
1012 | intel_sdvo_get_dtd_from_mode(&output_dtd, | ||
1013 | dev_priv->sdvo_lvds_fixed_mode); | ||
1014 | |||
1015 | intel_sdvo_set_target_output(output, | ||
1016 | dev_priv->controlled_output); | ||
1017 | intel_sdvo_set_output_timing(output, &output_dtd); | ||
1018 | |||
1019 | /* Set the input timing to the screen. Assume always input 0. */ | ||
1020 | intel_sdvo_set_target_input(output, true, false); | ||
1021 | |||
1022 | |||
1023 | success = intel_sdvo_create_preferred_input_timing( | ||
1024 | output, | ||
1025 | mode->clock / 10, | ||
1026 | mode->hdisplay, | ||
1027 | mode->vdisplay); | ||
1028 | |||
1029 | if (success) { | ||
1030 | struct intel_sdvo_dtd input_dtd; | ||
1031 | |||
1032 | intel_sdvo_get_preferred_input_timing(output, | ||
1033 | &input_dtd); | ||
1034 | intel_sdvo_get_mode_from_dtd(adjusted_mode, &input_dtd); | ||
1035 | dev_priv->sdvo_flags = input_dtd.part2.sdvo_flags; | ||
983 | 1036 | ||
984 | drm_mode_set_crtcinfo(adjusted_mode, 0); | 1037 | drm_mode_set_crtcinfo(adjusted_mode, 0); |
985 | 1038 | ||
@@ -990,6 +1043,12 @@ static bool intel_sdvo_mode_fixup(struct drm_encoder *encoder, | |||
990 | } else { | 1043 | } else { |
991 | return false; | 1044 | return false; |
992 | } | 1045 | } |
1046 | |||
1047 | } else { | ||
1048 | /* Make the CRTC code factor in the SDVO pixel multiplier. The | ||
1049 | * SDVO device will be told of the multiplier during mode_set. | ||
1050 | */ | ||
1051 | adjusted_mode->clock *= intel_sdvo_get_pixel_multiplier(mode); | ||
993 | } | 1052 | } |
994 | return true; | 1053 | return true; |
995 | } | 1054 | } |
@@ -1033,15 +1092,16 @@ static void intel_sdvo_mode_set(struct drm_encoder *encoder, | |||
1033 | 1092 | ||
1034 | /* We have tried to get input timing in mode_fixup, and filled into | 1093 | /* We have tried to get input timing in mode_fixup, and filled into |
1035 | adjusted_mode */ | 1094 | adjusted_mode */ |
1036 | if (sdvo_priv->is_tv) | 1095 | if (sdvo_priv->is_tv || sdvo_priv->is_lvds) { |
1037 | intel_sdvo_get_dtd_from_mode(&input_dtd, adjusted_mode); | 1096 | intel_sdvo_get_dtd_from_mode(&input_dtd, adjusted_mode); |
1038 | else | 1097 | input_dtd.part2.sdvo_flags = sdvo_priv->sdvo_flags; |
1098 | } else | ||
1039 | intel_sdvo_get_dtd_from_mode(&input_dtd, mode); | 1099 | intel_sdvo_get_dtd_from_mode(&input_dtd, mode); |
1040 | 1100 | ||
1041 | /* If it's a TV, we already set the output timing in mode_fixup. | 1101 | /* If it's a TV, we already set the output timing in mode_fixup. |
1042 | * Otherwise, the output timing is equal to the input timing. | 1102 | * Otherwise, the output timing is equal to the input timing. |
1043 | */ | 1103 | */ |
1044 | if (!sdvo_priv->is_tv) { | 1104 | if (!sdvo_priv->is_tv && !sdvo_priv->is_lvds) { |
1045 | /* Set the output timing to the screen */ | 1105 | /* Set the output timing to the screen */ |
1046 | intel_sdvo_set_target_output(output, | 1106 | intel_sdvo_set_target_output(output, |
1047 | sdvo_priv->controlled_output); | 1107 | sdvo_priv->controlled_output); |
@@ -1116,6 +1176,8 @@ static void intel_sdvo_mode_set(struct drm_encoder *encoder, | |||
1116 | sdvox |= (sdvo_pixel_multiply - 1) << SDVO_PORT_MULTIPLY_SHIFT; | 1176 | sdvox |= (sdvo_pixel_multiply - 1) << SDVO_PORT_MULTIPLY_SHIFT; |
1117 | } | 1177 | } |
1118 | 1178 | ||
1179 | if (sdvo_priv->sdvo_flags & SDVO_NEED_TO_STALL) | ||
1180 | sdvox |= SDVO_STALL_SELECT; | ||
1119 | intel_sdvo_write_sdvox(output, sdvox); | 1181 | intel_sdvo_write_sdvox(output, sdvox); |
1120 | } | 1182 | } |
1121 | 1183 | ||
@@ -1276,6 +1338,17 @@ static int intel_sdvo_mode_valid(struct drm_connector *connector, | |||
1276 | if (sdvo_priv->pixel_clock_max < mode->clock) | 1338 | if (sdvo_priv->pixel_clock_max < mode->clock) |
1277 | return MODE_CLOCK_HIGH; | 1339 | return MODE_CLOCK_HIGH; |
1278 | 1340 | ||
1341 | if (sdvo_priv->is_lvds == true) { | ||
1342 | if (sdvo_priv->sdvo_lvds_fixed_mode == NULL) | ||
1343 | return MODE_PANEL; | ||
1344 | |||
1345 | if (mode->hdisplay > sdvo_priv->sdvo_lvds_fixed_mode->hdisplay) | ||
1346 | return MODE_PANEL; | ||
1347 | |||
1348 | if (mode->vdisplay > sdvo_priv->sdvo_lvds_fixed_mode->vdisplay) | ||
1349 | return MODE_PANEL; | ||
1350 | } | ||
1351 | |||
1279 | return MODE_OK; | 1352 | return MODE_OK; |
1280 | } | 1353 | } |
1281 | 1354 | ||
@@ -1549,6 +1622,8 @@ static void intel_sdvo_get_lvds_modes(struct drm_connector *connector) | |||
1549 | { | 1622 | { |
1550 | struct intel_output *intel_output = to_intel_output(connector); | 1623 | struct intel_output *intel_output = to_intel_output(connector); |
1551 | struct drm_i915_private *dev_priv = connector->dev->dev_private; | 1624 | struct drm_i915_private *dev_priv = connector->dev->dev_private; |
1625 | struct intel_sdvo_priv *sdvo_priv = intel_output->dev_priv; | ||
1626 | struct drm_display_mode *newmode; | ||
1552 | 1627 | ||
1553 | /* | 1628 | /* |
1554 | * Attempt to get the mode list from DDC. | 1629 | * Attempt to get the mode list from DDC. |
@@ -1557,11 +1632,10 @@ static void intel_sdvo_get_lvds_modes(struct drm_connector *connector) | |||
1557 | */ | 1632 | */ |
1558 | intel_ddc_get_modes(intel_output); | 1633 | intel_ddc_get_modes(intel_output); |
1559 | if (list_empty(&connector->probed_modes) == false) | 1634 | if (list_empty(&connector->probed_modes) == false) |
1560 | return; | 1635 | goto end; |
1561 | 1636 | ||
1562 | /* Fetch modes from VBT */ | 1637 | /* Fetch modes from VBT */ |
1563 | if (dev_priv->sdvo_lvds_vbt_mode != NULL) { | 1638 | if (dev_priv->sdvo_lvds_vbt_mode != NULL) { |
1564 | struct drm_display_mode *newmode; | ||
1565 | newmode = drm_mode_duplicate(connector->dev, | 1639 | newmode = drm_mode_duplicate(connector->dev, |
1566 | dev_priv->sdvo_lvds_vbt_mode); | 1640 | dev_priv->sdvo_lvds_vbt_mode); |
1567 | if (newmode != NULL) { | 1641 | if (newmode != NULL) { |
@@ -1571,6 +1645,16 @@ static void intel_sdvo_get_lvds_modes(struct drm_connector *connector) | |||
1571 | drm_mode_probed_add(connector, newmode); | 1645 | drm_mode_probed_add(connector, newmode); |
1572 | } | 1646 | } |
1573 | } | 1647 | } |
1648 | |||
1649 | end: | ||
1650 | list_for_each_entry(newmode, &connector->probed_modes, head) { | ||
1651 | if (newmode->type & DRM_MODE_TYPE_PREFERRED) { | ||
1652 | sdvo_priv->sdvo_lvds_fixed_mode = | ||
1653 | drm_mode_duplicate(connector->dev, newmode); | ||
1654 | break; | ||
1655 | } | ||
1656 | } | ||
1657 | |||
1574 | } | 1658 | } |
1575 | 1659 | ||
1576 | static int intel_sdvo_get_modes(struct drm_connector *connector) | 1660 | static int intel_sdvo_get_modes(struct drm_connector *connector) |
@@ -1593,14 +1677,20 @@ static int intel_sdvo_get_modes(struct drm_connector *connector) | |||
1593 | static void intel_sdvo_destroy(struct drm_connector *connector) | 1677 | static void intel_sdvo_destroy(struct drm_connector *connector) |
1594 | { | 1678 | { |
1595 | struct intel_output *intel_output = to_intel_output(connector); | 1679 | struct intel_output *intel_output = to_intel_output(connector); |
1680 | struct intel_sdvo_priv *sdvo_priv = intel_output->dev_priv; | ||
1596 | 1681 | ||
1597 | if (intel_output->i2c_bus) | 1682 | if (intel_output->i2c_bus) |
1598 | intel_i2c_destroy(intel_output->i2c_bus); | 1683 | intel_i2c_destroy(intel_output->i2c_bus); |
1599 | if (intel_output->ddc_bus) | 1684 | if (intel_output->ddc_bus) |
1600 | intel_i2c_destroy(intel_output->ddc_bus); | 1685 | intel_i2c_destroy(intel_output->ddc_bus); |
1601 | 1686 | ||
1687 | if (sdvo_priv->sdvo_lvds_fixed_mode != NULL) | ||
1688 | drm_mode_destroy(connector->dev, | ||
1689 | sdvo_priv->sdvo_lvds_fixed_mode); | ||
1690 | |||
1602 | drm_sysfs_connector_remove(connector); | 1691 | drm_sysfs_connector_remove(connector); |
1603 | drm_connector_cleanup(connector); | 1692 | drm_connector_cleanup(connector); |
1693 | |||
1604 | kfree(intel_output); | 1694 | kfree(intel_output); |
1605 | } | 1695 | } |
1606 | 1696 | ||
diff --git a/drivers/gpu/drm/i915/intel_sdvo_regs.h b/drivers/gpu/drm/i915/intel_sdvo_regs.h index 193938b7d7f..ba5cdf8ae40 100644 --- a/drivers/gpu/drm/i915/intel_sdvo_regs.h +++ b/drivers/gpu/drm/i915/intel_sdvo_regs.h | |||
@@ -715,6 +715,7 @@ struct intel_sdvo_enhancements_arg { | |||
715 | #define SDVO_HBUF_TX_ONCE (2 << 6) | 715 | #define SDVO_HBUF_TX_ONCE (2 << 6) |
716 | #define SDVO_HBUF_TX_VSYNC (3 << 6) | 716 | #define SDVO_HBUF_TX_VSYNC (3 << 6) |
717 | #define SDVO_CMD_GET_AUDIO_TX_INFO 0x9c | 717 | #define SDVO_CMD_GET_AUDIO_TX_INFO 0x9c |
718 | #define SDVO_NEED_TO_STALL (1 << 7) | ||
718 | 719 | ||
719 | struct intel_sdvo_encode{ | 720 | struct intel_sdvo_encode{ |
720 | u8 dvi_rev; | 721 | u8 dvi_rev; |
diff --git a/drivers/i2c/busses/i2c-ibm_iic.c b/drivers/i2c/busses/i2c-ibm_iic.c index e4476743f20..b1bc6e277d2 100644 --- a/drivers/i2c/busses/i2c-ibm_iic.c +++ b/drivers/i2c/busses/i2c-ibm_iic.c | |||
@@ -85,10 +85,11 @@ static void dump_iic_regs(const char* header, struct ibm_iic_private* dev) | |||
85 | { | 85 | { |
86 | volatile struct iic_regs __iomem *iic = dev->vaddr; | 86 | volatile struct iic_regs __iomem *iic = dev->vaddr; |
87 | printk(KERN_DEBUG "ibm-iic%d: %s\n", dev->idx, header); | 87 | printk(KERN_DEBUG "ibm-iic%d: %s\n", dev->idx, header); |
88 | printk(KERN_DEBUG " cntl = 0x%02x, mdcntl = 0x%02x\n" | 88 | printk(KERN_DEBUG |
89 | KERN_DEBUG " sts = 0x%02x, extsts = 0x%02x\n" | 89 | " cntl = 0x%02x, mdcntl = 0x%02x\n" |
90 | KERN_DEBUG " clkdiv = 0x%02x, xfrcnt = 0x%02x\n" | 90 | " sts = 0x%02x, extsts = 0x%02x\n" |
91 | KERN_DEBUG " xtcntlss = 0x%02x, directcntl = 0x%02x\n", | 91 | " clkdiv = 0x%02x, xfrcnt = 0x%02x\n" |
92 | " xtcntlss = 0x%02x, directcntl = 0x%02x\n", | ||
92 | in_8(&iic->cntl), in_8(&iic->mdcntl), in_8(&iic->sts), | 93 | in_8(&iic->cntl), in_8(&iic->mdcntl), in_8(&iic->sts), |
93 | in_8(&iic->extsts), in_8(&iic->clkdiv), in_8(&iic->xfrcnt), | 94 | in_8(&iic->extsts), in_8(&iic->clkdiv), in_8(&iic->xfrcnt), |
94 | in_8(&iic->xtcntlss), in_8(&iic->directcntl)); | 95 | in_8(&iic->xtcntlss), in_8(&iic->directcntl)); |
diff --git a/drivers/ide/ide-io.c b/drivers/ide/ide-io.c index d5f3c77bead..db96138fefc 100644 --- a/drivers/ide/ide-io.c +++ b/drivers/ide/ide-io.c | |||
@@ -466,14 +466,10 @@ void do_ide_request(struct request_queue *q) | |||
466 | 466 | ||
467 | if (!ide_lock_port(hwif)) { | 467 | if (!ide_lock_port(hwif)) { |
468 | ide_hwif_t *prev_port; | 468 | ide_hwif_t *prev_port; |
469 | |||
470 | WARN_ON_ONCE(hwif->rq); | ||
469 | repeat: | 471 | repeat: |
470 | prev_port = hwif->host->cur_port; | 472 | prev_port = hwif->host->cur_port; |
471 | |||
472 | if (drive->dev_flags & IDE_DFLAG_BLOCKED) | ||
473 | rq = hwif->rq; | ||
474 | else | ||
475 | WARN_ON_ONCE(hwif->rq); | ||
476 | |||
477 | if (drive->dev_flags & IDE_DFLAG_SLEEPING && | 473 | if (drive->dev_flags & IDE_DFLAG_SLEEPING && |
478 | time_after(drive->sleep, jiffies)) { | 474 | time_after(drive->sleep, jiffies)) { |
479 | ide_unlock_port(hwif); | 475 | ide_unlock_port(hwif); |
@@ -500,29 +496,43 @@ repeat: | |||
500 | hwif->cur_dev = drive; | 496 | hwif->cur_dev = drive; |
501 | drive->dev_flags &= ~(IDE_DFLAG_SLEEPING | IDE_DFLAG_PARKED); | 497 | drive->dev_flags &= ~(IDE_DFLAG_SLEEPING | IDE_DFLAG_PARKED); |
502 | 498 | ||
503 | if (rq == NULL) { | 499 | spin_unlock_irq(&hwif->lock); |
504 | spin_unlock_irq(&hwif->lock); | 500 | spin_lock_irq(q->queue_lock); |
505 | spin_lock_irq(q->queue_lock); | 501 | /* |
506 | /* | 502 | * we know that the queue isn't empty, but this can happen |
507 | * we know that the queue isn't empty, but this can | 503 | * if the q->prep_rq_fn() decides to kill a request |
508 | * happen if ->prep_rq_fn() decides to kill a request | 504 | */ |
509 | */ | 505 | if (!rq) |
510 | rq = blk_fetch_request(drive->queue); | 506 | rq = blk_fetch_request(drive->queue); |
511 | spin_unlock_irq(q->queue_lock); | ||
512 | spin_lock_irq(&hwif->lock); | ||
513 | 507 | ||
514 | if (rq == NULL) { | 508 | spin_unlock_irq(q->queue_lock); |
515 | ide_unlock_port(hwif); | 509 | spin_lock_irq(&hwif->lock); |
516 | goto out; | 510 | |
517 | } | 511 | if (!rq) { |
512 | ide_unlock_port(hwif); | ||
513 | goto out; | ||
518 | } | 514 | } |
519 | 515 | ||
520 | /* | 516 | /* |
521 | * Sanity: don't accept a request that isn't a PM request | 517 | * Sanity: don't accept a request that isn't a PM request |
522 | * if we are currently power managed. | 518 | * if we are currently power managed. This is very important as |
519 | * blk_stop_queue() doesn't prevent the blk_fetch_request() | ||
520 | * above to return us whatever is in the queue. Since we call | ||
521 | * ide_do_request() ourselves, we end up taking requests while | ||
522 | * the queue is blocked... | ||
523 | * | ||
524 | * We let requests forced at head of queue with ide-preempt | ||
525 | * though. I hope that doesn't happen too much, hopefully not | ||
526 | * unless the subdriver triggers such a thing in its own PM | ||
527 | * state machine. | ||
523 | */ | 528 | */ |
524 | BUG_ON((drive->dev_flags & IDE_DFLAG_BLOCKED) && | 529 | if ((drive->dev_flags & IDE_DFLAG_BLOCKED) && |
525 | blk_pm_request(rq) == 0); | 530 | blk_pm_request(rq) == 0 && |
531 | (rq->cmd_flags & REQ_PREEMPT) == 0) { | ||
532 | /* there should be no pending command at this point */ | ||
533 | ide_unlock_port(hwif); | ||
534 | goto plug_device; | ||
535 | } | ||
526 | 536 | ||
527 | hwif->rq = rq; | 537 | hwif->rq = rq; |
528 | 538 | ||
diff --git a/drivers/ieee1394/sbp2.c b/drivers/ieee1394/sbp2.c index 83b734aec92..52b25f8b111 100644 --- a/drivers/ieee1394/sbp2.c +++ b/drivers/ieee1394/sbp2.c | |||
@@ -880,6 +880,7 @@ static struct sbp2_lu *sbp2_alloc_device(struct unit_directory *ud) | |||
880 | } | 880 | } |
881 | 881 | ||
882 | shost->hostdata[0] = (unsigned long)lu; | 882 | shost->hostdata[0] = (unsigned long)lu; |
883 | shost->max_cmd_len = SBP2_MAX_CDB_SIZE; | ||
883 | 884 | ||
884 | if (!scsi_add_host(shost, &ud->device)) { | 885 | if (!scsi_add_host(shost, &ud->device)) { |
885 | lu->shost = shost; | 886 | lu->shost = shost; |
diff --git a/drivers/ieee1394/sbp2.h b/drivers/ieee1394/sbp2.h index c5036f1cc5b..64a3a66a8a3 100644 --- a/drivers/ieee1394/sbp2.h +++ b/drivers/ieee1394/sbp2.h | |||
@@ -25,6 +25,12 @@ | |||
25 | #define SBP2_DEVICE_NAME "sbp2" | 25 | #define SBP2_DEVICE_NAME "sbp2" |
26 | 26 | ||
27 | /* | 27 | /* |
28 | * There is no transport protocol limit to the CDB length, but we implement | ||
29 | * a fixed length only. 16 bytes is enough for disks larger than 2 TB. | ||
30 | */ | ||
31 | #define SBP2_MAX_CDB_SIZE 16 | ||
32 | |||
33 | /* | ||
28 | * SBP-2 specific definitions | 34 | * SBP-2 specific definitions |
29 | */ | 35 | */ |
30 | 36 | ||
@@ -51,7 +57,7 @@ struct sbp2_command_orb { | |||
51 | u32 data_descriptor_hi; | 57 | u32 data_descriptor_hi; |
52 | u32 data_descriptor_lo; | 58 | u32 data_descriptor_lo; |
53 | u32 misc; | 59 | u32 misc; |
54 | u8 cdb[12]; | 60 | u8 cdb[SBP2_MAX_CDB_SIZE]; |
55 | } __attribute__((packed)); | 61 | } __attribute__((packed)); |
56 | 62 | ||
57 | #define SBP2_LOGIN_REQUEST 0x0 | 63 | #define SBP2_LOGIN_REQUEST 0x0 |
diff --git a/drivers/input/keyboard/Kconfig b/drivers/input/keyboard/Kconfig index 9d8f796c674..a6b989a9dc0 100644 --- a/drivers/input/keyboard/Kconfig +++ b/drivers/input/keyboard/Kconfig | |||
@@ -12,6 +12,42 @@ menuconfig INPUT_KEYBOARD | |||
12 | 12 | ||
13 | if INPUT_KEYBOARD | 13 | if INPUT_KEYBOARD |
14 | 14 | ||
15 | config KEYBOARD_AAED2000 | ||
16 | tristate "AAED-2000 keyboard" | ||
17 | depends on MACH_AAED2000 | ||
18 | select INPUT_POLLDEV | ||
19 | default y | ||
20 | help | ||
21 | Say Y here to enable the keyboard on the Agilent AAED-2000 | ||
22 | development board. | ||
23 | |||
24 | To compile this driver as a module, choose M here: the | ||
25 | module will be called aaed2000_kbd. | ||
26 | |||
27 | config KEYBOARD_AMIGA | ||
28 | tristate "Amiga keyboard" | ||
29 | depends on AMIGA | ||
30 | help | ||
31 | Say Y here if you are running Linux on any AMIGA and have a keyboard | ||
32 | attached. | ||
33 | |||
34 | To compile this driver as a module, choose M here: the | ||
35 | module will be called amikbd. | ||
36 | |||
37 | config ATARI_KBD_CORE | ||
38 | bool | ||
39 | |||
40 | config KEYBOARD_ATARI | ||
41 | tristate "Atari keyboard" | ||
42 | depends on ATARI | ||
43 | select ATARI_KBD_CORE | ||
44 | help | ||
45 | Say Y here if you are running Linux on any Atari and have a keyboard | ||
46 | attached. | ||
47 | |||
48 | To compile this driver as a module, choose M here: the | ||
49 | module will be called atakbd. | ||
50 | |||
15 | config KEYBOARD_ATKBD | 51 | config KEYBOARD_ATKBD |
16 | tristate "AT keyboard" if EMBEDDED || !X86 | 52 | tristate "AT keyboard" if EMBEDDED || !X86 |
17 | default y | 53 | default y |
@@ -68,69 +104,14 @@ config KEYBOARD_ATKBD_RDI_KEYCODES | |||
68 | right-hand column will be interpreted as the key shown in the | 104 | right-hand column will be interpreted as the key shown in the |
69 | left-hand column. | 105 | left-hand column. |
70 | 106 | ||
71 | config KEYBOARD_SUNKBD | 107 | config KEYBOARD_BFIN |
72 | tristate "Sun Type 4 and Type 5 keyboard" | 108 | tristate "Blackfin BF54x keypad support" |
73 | select SERIO | 109 | depends on (BF54x && !BF544) |
74 | help | ||
75 | Say Y here if you want to use a Sun Type 4 or Type 5 keyboard, | ||
76 | connected either to the Sun keyboard connector or to an serial | ||
77 | (RS-232) port via a simple adapter. | ||
78 | |||
79 | To compile this driver as a module, choose M here: the | ||
80 | module will be called sunkbd. | ||
81 | |||
82 | config KEYBOARD_LKKBD | ||
83 | tristate "DECstation/VAXstation LK201/LK401 keyboard" | ||
84 | select SERIO | ||
85 | help | ||
86 | Say Y here if you want to use a LK201 or LK401 style serial | ||
87 | keyboard. This keyboard is also useable on PCs if you attach | ||
88 | it with the inputattach program. The connector pinout is | ||
89 | described within lkkbd.c. | ||
90 | |||
91 | To compile this driver as a module, choose M here: the | ||
92 | module will be called lkkbd. | ||
93 | |||
94 | config KEYBOARD_LOCOMO | ||
95 | tristate "LoCoMo Keyboard Support" | ||
96 | depends on SHARP_LOCOMO && INPUT_KEYBOARD | ||
97 | help | ||
98 | Say Y here if you are running Linux on a Sharp Zaurus Collie or Poodle based PDA | ||
99 | |||
100 | To compile this driver as a module, choose M here: the | ||
101 | module will be called locomokbd. | ||
102 | |||
103 | config KEYBOARD_XTKBD | ||
104 | tristate "XT keyboard" | ||
105 | select SERIO | ||
106 | help | ||
107 | Say Y here if you want to use the old IBM PC/XT keyboard (or | ||
108 | compatible) on your system. This is only possible with a | ||
109 | parallel port keyboard adapter, you cannot connect it to the | ||
110 | keyboard port on a PC that runs Linux. | ||
111 | |||
112 | To compile this driver as a module, choose M here: the | ||
113 | module will be called xtkbd. | ||
114 | |||
115 | config KEYBOARD_NEWTON | ||
116 | tristate "Newton keyboard" | ||
117 | select SERIO | ||
118 | help | ||
119 | Say Y here if you have a Newton keyboard on a serial port. | ||
120 | |||
121 | To compile this driver as a module, choose M here: the | ||
122 | module will be called newtonkbd. | ||
123 | |||
124 | config KEYBOARD_STOWAWAY | ||
125 | tristate "Stowaway keyboard" | ||
126 | select SERIO | ||
127 | help | 110 | help |
128 | Say Y here if you have a Stowaway keyboard on a serial port. | 111 | Say Y here if you want to use the BF54x keypad. |
129 | Stowaway compatible keyboards like Dicota Input-PDA keyboard | ||
130 | are also supported by this driver. | ||
131 | 112 | ||
132 | To compile this driver as a module, choose M here: the | 113 | To compile this driver as a module, choose M here: the |
133 | module will be called stowaway. | 114 | module will be called bf54x-keys. |
134 | 115 | ||
135 | config KEYBOARD_CORGI | 116 | config KEYBOARD_CORGI |
136 | tristate "Corgi keyboard" | 117 | tristate "Corgi keyboard" |
@@ -143,61 +124,50 @@ config KEYBOARD_CORGI | |||
143 | To compile this driver as a module, choose M here: the | 124 | To compile this driver as a module, choose M here: the |
144 | module will be called corgikbd. | 125 | module will be called corgikbd. |
145 | 126 | ||
146 | config KEYBOARD_SPITZ | 127 | config KEYBOARD_LKKBD |
147 | tristate "Spitz keyboard" | 128 | tristate "DECstation/VAXstation LK201/LK401 keyboard" |
148 | depends on PXA_SHARPSL | 129 | select SERIO |
149 | default y | ||
150 | help | 130 | help |
151 | Say Y here to enable the keyboard on the Sharp Zaurus SL-C1000, | 131 | Say Y here if you want to use a LK201 or LK401 style serial |
152 | SL-C3000 and Sl-C3100 series of PDAs. | 132 | keyboard. This keyboard is also useable on PCs if you attach |
133 | it with the inputattach program. The connector pinout is | ||
134 | described within lkkbd.c. | ||
153 | 135 | ||
154 | To compile this driver as a module, choose M here: the | 136 | To compile this driver as a module, choose M here: the |
155 | module will be called spitzkbd. | 137 | module will be called lkkbd. |
156 | 138 | ||
157 | config KEYBOARD_TOSA | 139 | config KEYBOARD_EP93XX |
158 | tristate "Tosa keyboard" | 140 | tristate "EP93xx Matrix Keypad support" |
159 | depends on MACH_TOSA | 141 | depends on ARCH_EP93XX |
160 | default y | ||
161 | help | 142 | help |
162 | Say Y here to enable the keyboard on the Sharp Zaurus SL-6000x (Tosa) | 143 | Say Y here to enable the matrix keypad on the Cirrus EP93XX. |
163 | 144 | ||
164 | To compile this driver as a module, choose M here: the | 145 | To compile this driver as a module, choose M here: the |
165 | module will be called tosakbd. | 146 | module will be called ep93xx_keypad. |
166 | 147 | ||
167 | config KEYBOARD_TOSA_USE_EXT_KEYCODES | 148 | config KEYBOARD_GPIO |
168 | bool "Tosa keyboard: use extended keycodes" | 149 | tristate "GPIO Buttons" |
169 | depends on KEYBOARD_TOSA | 150 | depends on GENERIC_GPIO |
170 | default n | ||
171 | help | 151 | help |
172 | Say Y here to enable the tosa keyboard driver to generate extended | 152 | This driver implements support for buttons connected |
173 | (>= 127) keycodes. Be aware, that they can't be correctly interpreted | 153 | to GPIO pins of various CPUs (and some other chips). |
174 | by either console keyboard driver or by Kdrive keybd driver. | ||
175 | |||
176 | Say Y only if you know, what you are doing! | ||
177 | 154 | ||
178 | config KEYBOARD_AMIGA | 155 | Say Y here if your device has buttons connected |
179 | tristate "Amiga keyboard" | 156 | directly to such GPIO pins. Your board-specific |
180 | depends on AMIGA | 157 | setup logic must also provide a platform device, |
181 | help | 158 | with configuration data saying which GPIOs are used. |
182 | Say Y here if you are running Linux on any AMIGA and have a keyboard | ||
183 | attached. | ||
184 | 159 | ||
185 | To compile this driver as a module, choose M here: the | 160 | To compile this driver as a module, choose M here: the |
186 | module will be called amikbd. | 161 | module will be called gpio_keys. |
187 | 162 | ||
188 | config ATARI_KBD_CORE | 163 | config KEYBOARD_MATRIX |
189 | bool | 164 | tristate "GPIO driven matrix keypad support" |
190 | 165 | depends on GENERIC_GPIO | |
191 | config KEYBOARD_ATARI | ||
192 | tristate "Atari keyboard" | ||
193 | depends on ATARI | ||
194 | select ATARI_KBD_CORE | ||
195 | help | 166 | help |
196 | Say Y here if you are running Linux on any Atari and have a keyboard | 167 | Enable support for GPIO driven matrix keypad. |
197 | attached. | ||
198 | 168 | ||
199 | To compile this driver as a module, choose M here: the | 169 | To compile this driver as a module, choose M here: the |
200 | module will be called atakbd. | 170 | module will be called matrix_keypad. |
201 | 171 | ||
202 | config KEYBOARD_HIL_OLD | 172 | config KEYBOARD_HIL_OLD |
203 | tristate "HP HIL keyboard support (simple driver)" | 173 | tristate "HP HIL keyboard support (simple driver)" |
@@ -261,20 +231,39 @@ config KEYBOARD_LM8323 | |||
261 | To compile this driver as a module, choose M here: the | 231 | To compile this driver as a module, choose M here: the |
262 | module will be called lm8323. | 232 | module will be called lm8323. |
263 | 233 | ||
264 | config KEYBOARD_OMAP | 234 | config KEYBOARD_LOCOMO |
265 | tristate "TI OMAP keypad support" | 235 | tristate "LoCoMo Keyboard Support" |
266 | depends on (ARCH_OMAP1 || ARCH_OMAP2) | 236 | depends on SHARP_LOCOMO |
267 | help | 237 | help |
268 | Say Y here if you want to use the OMAP keypad. | 238 | Say Y here if you are running Linux on a Sharp Zaurus Collie or Poodle based PDA |
269 | 239 | ||
270 | To compile this driver as a module, choose M here: the | 240 | To compile this driver as a module, choose M here: the |
271 | module will be called omap-keypad. | 241 | module will be called locomokbd. |
242 | |||
243 | config KEYBOARD_MAPLE | ||
244 | tristate "Maple bus keyboard" | ||
245 | depends on SH_DREAMCAST && MAPLE | ||
246 | help | ||
247 | Say Y here if you have a Dreamcast console running Linux and have | ||
248 | a keyboard attached to its Maple bus. | ||
249 | |||
250 | To compile this driver as a module, choose M here: the | ||
251 | module will be called maple_keyb. | ||
252 | |||
253 | config KEYBOARD_NEWTON | ||
254 | tristate "Newton keyboard" | ||
255 | select SERIO | ||
256 | help | ||
257 | Say Y here if you have a Newton keyboard on a serial port. | ||
258 | |||
259 | To compile this driver as a module, choose M here: the | ||
260 | module will be called newtonkbd. | ||
272 | 261 | ||
273 | config KEYBOARD_PXA27x | 262 | config KEYBOARD_PXA27x |
274 | tristate "PXA27x/PXA3xx keypad support" | 263 | tristate "PXA27x/PXA3xx keypad support" |
275 | depends on PXA27x || PXA3xx | 264 | depends on PXA27x || PXA3xx |
276 | help | 265 | help |
277 | Enable support for PXA27x/PXA3xx keypad controller | 266 | Enable support for PXA27x/PXA3xx keypad controller. |
278 | 267 | ||
279 | To compile this driver as a module, choose M here: the | 268 | To compile this driver as a module, choose M here: the |
280 | module will be called pxa27x_keypad. | 269 | module will be called pxa27x_keypad. |
@@ -288,51 +277,38 @@ config KEYBOARD_PXA930_ROTARY | |||
288 | To compile this driver as a module, choose M here: the | 277 | To compile this driver as a module, choose M here: the |
289 | module will be called pxa930_rotary. | 278 | module will be called pxa930_rotary. |
290 | 279 | ||
291 | config KEYBOARD_AAED2000 | 280 | config KEYBOARD_SPITZ |
292 | tristate "AAED-2000 keyboard" | 281 | tristate "Spitz keyboard" |
293 | depends on MACH_AAED2000 | 282 | depends on PXA_SHARPSL |
294 | select INPUT_POLLDEV | ||
295 | default y | 283 | default y |
296 | help | 284 | help |
297 | Say Y here to enable the keyboard on the Agilent AAED-2000 | 285 | Say Y here to enable the keyboard on the Sharp Zaurus SL-C1000, |
298 | development board. | 286 | SL-C3000 and Sl-C3100 series of PDAs. |
299 | |||
300 | To compile this driver as a module, choose M here: the | ||
301 | module will be called aaed2000_kbd. | ||
302 | |||
303 | config KEYBOARD_GPIO | ||
304 | tristate "GPIO Buttons" | ||
305 | depends on GENERIC_GPIO | ||
306 | help | ||
307 | This driver implements support for buttons connected | ||
308 | to GPIO pins of various CPUs (and some other chips). | ||
309 | |||
310 | Say Y here if your device has buttons connected | ||
311 | directly to such GPIO pins. Your board-specific | ||
312 | setup logic must also provide a platform device, | ||
313 | with configuration data saying which GPIOs are used. | ||
314 | 287 | ||
315 | To compile this driver as a module, choose M here: the | 288 | To compile this driver as a module, choose M here: the |
316 | module will be called gpio-keys. | 289 | module will be called spitzkbd. |
317 | 290 | ||
318 | config KEYBOARD_MAPLE | 291 | config KEYBOARD_STOWAWAY |
319 | tristate "Maple bus keyboard" | 292 | tristate "Stowaway keyboard" |
320 | depends on SH_DREAMCAST && MAPLE | 293 | select SERIO |
321 | help | 294 | help |
322 | Say Y here if you have a Dreamcast console running Linux and have | 295 | Say Y here if you have a Stowaway keyboard on a serial port. |
323 | a keyboard attached to its Maple bus. | 296 | Stowaway compatible keyboards like Dicota Input-PDA keyboard |
297 | are also supported by this driver. | ||
324 | 298 | ||
325 | To compile this driver as a module, choose M here: the | 299 | To compile this driver as a module, choose M here: the |
326 | module will be called maple_keyb. | 300 | module will be called stowaway. |
327 | 301 | ||
328 | config KEYBOARD_BFIN | 302 | config KEYBOARD_SUNKBD |
329 | tristate "Blackfin BF54x keypad support" | 303 | tristate "Sun Type 4 and Type 5 keyboard" |
330 | depends on (BF54x && !BF544) | 304 | select SERIO |
331 | help | 305 | help |
332 | Say Y here if you want to use the BF54x keypad. | 306 | Say Y here if you want to use a Sun Type 4 or Type 5 keyboard, |
307 | connected either to the Sun keyboard connector or to an serial | ||
308 | (RS-232) port via a simple adapter. | ||
333 | 309 | ||
334 | To compile this driver as a module, choose M here: the | 310 | To compile this driver as a module, choose M here: the |
335 | module will be called bf54x-keys. | 311 | module will be called sunkbd. |
336 | 312 | ||
337 | config KEYBOARD_SH_KEYSC | 313 | config KEYBOARD_SH_KEYSC |
338 | tristate "SuperH KEYSC keypad support" | 314 | tristate "SuperH KEYSC keypad support" |
@@ -344,13 +320,45 @@ config KEYBOARD_SH_KEYSC | |||
344 | To compile this driver as a module, choose M here: the | 320 | To compile this driver as a module, choose M here: the |
345 | module will be called sh_keysc. | 321 | module will be called sh_keysc. |
346 | 322 | ||
347 | config KEYBOARD_EP93XX | 323 | config KEYBOARD_OMAP |
348 | tristate "EP93xx Matrix Keypad support" | 324 | tristate "TI OMAP keypad support" |
349 | depends on ARCH_EP93XX | 325 | depends on (ARCH_OMAP1 || ARCH_OMAP2) |
350 | help | 326 | help |
351 | Say Y here to enable the matrix keypad on the Cirrus EP93XX. | 327 | Say Y here if you want to use the OMAP keypad. |
352 | 328 | ||
353 | To compile this driver as a module, choose M here: the | 329 | To compile this driver as a module, choose M here: the |
354 | module will be called ep93xx_keypad. | 330 | module will be called omap-keypad. |
331 | |||
332 | config KEYBOARD_TOSA | ||
333 | tristate "Tosa keyboard" | ||
334 | depends on MACH_TOSA | ||
335 | default y | ||
336 | help | ||
337 | Say Y here to enable the keyboard on the Sharp Zaurus SL-6000x (Tosa) | ||
338 | |||
339 | To compile this driver as a module, choose M here: the | ||
340 | module will be called tosakbd. | ||
341 | |||
342 | config KEYBOARD_TOSA_USE_EXT_KEYCODES | ||
343 | bool "Tosa keyboard: use extended keycodes" | ||
344 | depends on KEYBOARD_TOSA | ||
345 | help | ||
346 | Say Y here to enable the tosa keyboard driver to generate extended | ||
347 | (>= 127) keycodes. Be aware, that they can't be correctly interpreted | ||
348 | by either console keyboard driver or by Kdrive keybd driver. | ||
349 | |||
350 | Say Y only if you know, what you are doing! | ||
351 | |||
352 | config KEYBOARD_XTKBD | ||
353 | tristate "XT keyboard" | ||
354 | select SERIO | ||
355 | help | ||
356 | Say Y here if you want to use the old IBM PC/XT keyboard (or | ||
357 | compatible) on your system. This is only possible with a | ||
358 | parallel port keyboard adapter, you cannot connect it to the | ||
359 | keyboard port on a PC that runs Linux. | ||
360 | |||
361 | To compile this driver as a module, choose M here: the | ||
362 | module will be called xtkbd. | ||
355 | 363 | ||
356 | endif | 364 | endif |
diff --git a/drivers/input/keyboard/Makefile b/drivers/input/keyboard/Makefile index 156b647a259..b5b5eae9724 100644 --- a/drivers/input/keyboard/Makefile +++ b/drivers/input/keyboard/Makefile | |||
@@ -4,29 +4,30 @@ | |||
4 | 4 | ||
5 | # Each configuration option enables a list of files. | 5 | # Each configuration option enables a list of files. |
6 | 6 | ||
7 | obj-$(CONFIG_KEYBOARD_ATKBD) += atkbd.o | 7 | obj-$(CONFIG_KEYBOARD_AAED2000) += aaed2000_kbd.o |
8 | obj-$(CONFIG_KEYBOARD_SUNKBD) += sunkbd.o | ||
9 | obj-$(CONFIG_KEYBOARD_LKKBD) += lkkbd.o | ||
10 | obj-$(CONFIG_KEYBOARD_XTKBD) += xtkbd.o | ||
11 | obj-$(CONFIG_KEYBOARD_AMIGA) += amikbd.o | 8 | obj-$(CONFIG_KEYBOARD_AMIGA) += amikbd.o |
12 | obj-$(CONFIG_KEYBOARD_ATARI) += atakbd.o | 9 | obj-$(CONFIG_KEYBOARD_ATARI) += atakbd.o |
13 | obj-$(CONFIG_KEYBOARD_LOCOMO) += locomokbd.o | 10 | obj-$(CONFIG_KEYBOARD_ATKBD) += atkbd.o |
14 | obj-$(CONFIG_KEYBOARD_NEWTON) += newtonkbd.o | 11 | obj-$(CONFIG_KEYBOARD_BFIN) += bf54x-keys.o |
15 | obj-$(CONFIG_KEYBOARD_STOWAWAY) += stowaway.o | ||
16 | obj-$(CONFIG_KEYBOARD_CORGI) += corgikbd.o | 12 | obj-$(CONFIG_KEYBOARD_CORGI) += corgikbd.o |
17 | obj-$(CONFIG_KEYBOARD_SPITZ) += spitzkbd.o | 13 | obj-$(CONFIG_KEYBOARD_EP93XX) += ep93xx_keypad.o |
18 | obj-$(CONFIG_KEYBOARD_TOSA) += tosakbd.o | 14 | obj-$(CONFIG_KEYBOARD_GPIO) += gpio_keys.o |
19 | obj-$(CONFIG_KEYBOARD_HIL) += hil_kbd.o | 15 | obj-$(CONFIG_KEYBOARD_HIL) += hil_kbd.o |
20 | obj-$(CONFIG_KEYBOARD_HIL_OLD) += hilkbd.o | 16 | obj-$(CONFIG_KEYBOARD_HIL_OLD) += hilkbd.o |
17 | obj-$(CONFIG_KEYBOARD_HP6XX) += jornada680_kbd.o | ||
18 | obj-$(CONFIG_KEYBOARD_HP7XX) += jornada720_kbd.o | ||
19 | obj-$(CONFIG_KEYBOARD_LKKBD) += lkkbd.o | ||
21 | obj-$(CONFIG_KEYBOARD_LM8323) += lm8323.o | 20 | obj-$(CONFIG_KEYBOARD_LM8323) += lm8323.o |
21 | obj-$(CONFIG_KEYBOARD_LOCOMO) += locomokbd.o | ||
22 | obj-$(CONFIG_KEYBOARD_MAPLE) += maple_keyb.o | ||
23 | obj-$(CONFIG_KEYBOARD_MATRIX) += matrix_keypad.o | ||
24 | obj-$(CONFIG_KEYBOARD_NEWTON) += newtonkbd.o | ||
22 | obj-$(CONFIG_KEYBOARD_OMAP) += omap-keypad.o | 25 | obj-$(CONFIG_KEYBOARD_OMAP) += omap-keypad.o |
23 | obj-$(CONFIG_KEYBOARD_PXA27x) += pxa27x_keypad.o | 26 | obj-$(CONFIG_KEYBOARD_PXA27x) += pxa27x_keypad.o |
24 | obj-$(CONFIG_KEYBOARD_PXA930_ROTARY) += pxa930_rotary.o | 27 | obj-$(CONFIG_KEYBOARD_PXA930_ROTARY) += pxa930_rotary.o |
25 | obj-$(CONFIG_KEYBOARD_AAED2000) += aaed2000_kbd.o | ||
26 | obj-$(CONFIG_KEYBOARD_GPIO) += gpio_keys.o | ||
27 | obj-$(CONFIG_KEYBOARD_HP6XX) += jornada680_kbd.o | ||
28 | obj-$(CONFIG_KEYBOARD_HP7XX) += jornada720_kbd.o | ||
29 | obj-$(CONFIG_KEYBOARD_MAPLE) += maple_keyb.o | ||
30 | obj-$(CONFIG_KEYBOARD_BFIN) += bf54x-keys.o | ||
31 | obj-$(CONFIG_KEYBOARD_SH_KEYSC) += sh_keysc.o | 28 | obj-$(CONFIG_KEYBOARD_SH_KEYSC) += sh_keysc.o |
32 | obj-$(CONFIG_KEYBOARD_EP93XX) += ep93xx_keypad.o | 29 | obj-$(CONFIG_KEYBOARD_SPITZ) += spitzkbd.o |
30 | obj-$(CONFIG_KEYBOARD_STOWAWAY) += stowaway.o | ||
31 | obj-$(CONFIG_KEYBOARD_SUNKBD) += sunkbd.o | ||
32 | obj-$(CONFIG_KEYBOARD_TOSA) += tosakbd.o | ||
33 | obj-$(CONFIG_KEYBOARD_XTKBD) += xtkbd.o | ||
diff --git a/drivers/input/keyboard/gpio_keys.c b/drivers/input/keyboard/gpio_keys.c index 2157cd7de00..efed0c9e242 100644 --- a/drivers/input/keyboard/gpio_keys.c +++ b/drivers/input/keyboard/gpio_keys.c | |||
@@ -29,7 +29,8 @@ | |||
29 | struct gpio_button_data { | 29 | struct gpio_button_data { |
30 | struct gpio_keys_button *button; | 30 | struct gpio_keys_button *button; |
31 | struct input_dev *input; | 31 | struct input_dev *input; |
32 | struct delayed_work work; | 32 | struct timer_list timer; |
33 | struct work_struct work; | ||
33 | }; | 34 | }; |
34 | 35 | ||
35 | struct gpio_keys_drvdata { | 36 | struct gpio_keys_drvdata { |
@@ -40,7 +41,7 @@ struct gpio_keys_drvdata { | |||
40 | static void gpio_keys_report_event(struct work_struct *work) | 41 | static void gpio_keys_report_event(struct work_struct *work) |
41 | { | 42 | { |
42 | struct gpio_button_data *bdata = | 43 | struct gpio_button_data *bdata = |
43 | container_of(work, struct gpio_button_data, work.work); | 44 | container_of(work, struct gpio_button_data, work); |
44 | struct gpio_keys_button *button = bdata->button; | 45 | struct gpio_keys_button *button = bdata->button; |
45 | struct input_dev *input = bdata->input; | 46 | struct input_dev *input = bdata->input; |
46 | unsigned int type = button->type ?: EV_KEY; | 47 | unsigned int type = button->type ?: EV_KEY; |
@@ -50,17 +51,25 @@ static void gpio_keys_report_event(struct work_struct *work) | |||
50 | input_sync(input); | 51 | input_sync(input); |
51 | } | 52 | } |
52 | 53 | ||
54 | static void gpio_keys_timer(unsigned long _data) | ||
55 | { | ||
56 | struct gpio_button_data *data = (struct gpio_button_data *)_data; | ||
57 | |||
58 | schedule_work(&data->work); | ||
59 | } | ||
60 | |||
53 | static irqreturn_t gpio_keys_isr(int irq, void *dev_id) | 61 | static irqreturn_t gpio_keys_isr(int irq, void *dev_id) |
54 | { | 62 | { |
55 | struct gpio_button_data *bdata = dev_id; | 63 | struct gpio_button_data *bdata = dev_id; |
56 | struct gpio_keys_button *button = bdata->button; | 64 | struct gpio_keys_button *button = bdata->button; |
57 | unsigned long delay; | ||
58 | 65 | ||
59 | BUG_ON(irq != gpio_to_irq(button->gpio)); | 66 | BUG_ON(irq != gpio_to_irq(button->gpio)); |
60 | 67 | ||
61 | delay = button->debounce_interval ? | 68 | if (button->debounce_interval) |
62 | msecs_to_jiffies(button->debounce_interval) : 0; | 69 | mod_timer(&bdata->timer, |
63 | schedule_delayed_work(&bdata->work, delay); | 70 | jiffies + msecs_to_jiffies(button->debounce_interval)); |
71 | else | ||
72 | schedule_work(&bdata->work); | ||
64 | 73 | ||
65 | return IRQ_HANDLED; | 74 | return IRQ_HANDLED; |
66 | } | 75 | } |
@@ -107,7 +116,9 @@ static int __devinit gpio_keys_probe(struct platform_device *pdev) | |||
107 | 116 | ||
108 | bdata->input = input; | 117 | bdata->input = input; |
109 | bdata->button = button; | 118 | bdata->button = button; |
110 | INIT_DELAYED_WORK(&bdata->work, gpio_keys_report_event); | 119 | setup_timer(&bdata->timer, |
120 | gpio_keys_timer, (unsigned long)bdata); | ||
121 | INIT_WORK(&bdata->work, gpio_keys_report_event); | ||
111 | 122 | ||
112 | error = gpio_request(button->gpio, button->desc ?: "gpio_keys"); | 123 | error = gpio_request(button->gpio, button->desc ?: "gpio_keys"); |
113 | if (error < 0) { | 124 | if (error < 0) { |
@@ -166,7 +177,9 @@ static int __devinit gpio_keys_probe(struct platform_device *pdev) | |||
166 | fail2: | 177 | fail2: |
167 | while (--i >= 0) { | 178 | while (--i >= 0) { |
168 | free_irq(gpio_to_irq(pdata->buttons[i].gpio), &ddata->data[i]); | 179 | free_irq(gpio_to_irq(pdata->buttons[i].gpio), &ddata->data[i]); |
169 | cancel_delayed_work_sync(&ddata->data[i].work); | 180 | if (pdata->buttons[i].debounce_interval) |
181 | del_timer_sync(&ddata->data[i].timer); | ||
182 | cancel_work_sync(&ddata->data[i].work); | ||
170 | gpio_free(pdata->buttons[i].gpio); | 183 | gpio_free(pdata->buttons[i].gpio); |
171 | } | 184 | } |
172 | 185 | ||
@@ -190,7 +203,9 @@ static int __devexit gpio_keys_remove(struct platform_device *pdev) | |||
190 | for (i = 0; i < pdata->nbuttons; i++) { | 203 | for (i = 0; i < pdata->nbuttons; i++) { |
191 | int irq = gpio_to_irq(pdata->buttons[i].gpio); | 204 | int irq = gpio_to_irq(pdata->buttons[i].gpio); |
192 | free_irq(irq, &ddata->data[i]); | 205 | free_irq(irq, &ddata->data[i]); |
193 | cancel_delayed_work_sync(&ddata->data[i].work); | 206 | if (pdata->buttons[i].debounce_interval) |
207 | del_timer_sync(&ddata->data[i].timer); | ||
208 | cancel_work_sync(&ddata->data[i].work); | ||
194 | gpio_free(pdata->buttons[i].gpio); | 209 | gpio_free(pdata->buttons[i].gpio); |
195 | } | 210 | } |
196 | 211 | ||
diff --git a/drivers/input/keyboard/matrix_keypad.c b/drivers/input/keyboard/matrix_keypad.c new file mode 100644 index 00000000000..e9b2e7cb05b --- /dev/null +++ b/drivers/input/keyboard/matrix_keypad.c | |||
@@ -0,0 +1,453 @@ | |||
1 | /* | ||
2 | * GPIO driven matrix keyboard driver | ||
3 | * | ||
4 | * Copyright (c) 2008 Marek Vasut <marek.vasut@gmail.com> | ||
5 | * | ||
6 | * Based on corgikbd.c | ||
7 | * | ||
8 | * This program is free software; you can redistribute it and/or modify | ||
9 | * it under the terms of the GNU General Public License version 2 as | ||
10 | * published by the Free Software Foundation. | ||
11 | * | ||
12 | */ | ||
13 | |||
14 | #include <linux/types.h> | ||
15 | #include <linux/delay.h> | ||
16 | #include <linux/platform_device.h> | ||
17 | #include <linux/init.h> | ||
18 | #include <linux/input.h> | ||
19 | #include <linux/irq.h> | ||
20 | #include <linux/interrupt.h> | ||
21 | #include <linux/jiffies.h> | ||
22 | #include <linux/module.h> | ||
23 | #include <linux/gpio.h> | ||
24 | #include <linux/input/matrix_keypad.h> | ||
25 | |||
26 | struct matrix_keypad { | ||
27 | const struct matrix_keypad_platform_data *pdata; | ||
28 | struct input_dev *input_dev; | ||
29 | unsigned short *keycodes; | ||
30 | |||
31 | uint32_t last_key_state[MATRIX_MAX_COLS]; | ||
32 | struct delayed_work work; | ||
33 | bool scan_pending; | ||
34 | bool stopped; | ||
35 | spinlock_t lock; | ||
36 | }; | ||
37 | |||
38 | /* | ||
39 | * NOTE: normally the GPIO has to be put into HiZ when de-activated to cause | ||
40 | * minmal side effect when scanning other columns, here it is configured to | ||
41 | * be input, and it should work on most platforms. | ||
42 | */ | ||
43 | static void __activate_col(const struct matrix_keypad_platform_data *pdata, | ||
44 | int col, bool on) | ||
45 | { | ||
46 | bool level_on = !pdata->active_low; | ||
47 | |||
48 | if (on) { | ||
49 | gpio_direction_output(pdata->col_gpios[col], level_on); | ||
50 | } else { | ||
51 | gpio_set_value_cansleep(pdata->col_gpios[col], !level_on); | ||
52 | gpio_direction_input(pdata->col_gpios[col]); | ||
53 | } | ||
54 | } | ||
55 | |||
56 | static void activate_col(const struct matrix_keypad_platform_data *pdata, | ||
57 | int col, bool on) | ||
58 | { | ||
59 | __activate_col(pdata, col, on); | ||
60 | |||
61 | if (on && pdata->col_scan_delay_us) | ||
62 | udelay(pdata->col_scan_delay_us); | ||
63 | } | ||
64 | |||
65 | static void activate_all_cols(const struct matrix_keypad_platform_data *pdata, | ||
66 | bool on) | ||
67 | { | ||
68 | int col; | ||
69 | |||
70 | for (col = 0; col < pdata->num_col_gpios; col++) | ||
71 | __activate_col(pdata, col, on); | ||
72 | } | ||
73 | |||
74 | static bool row_asserted(const struct matrix_keypad_platform_data *pdata, | ||
75 | int row) | ||
76 | { | ||
77 | return gpio_get_value_cansleep(pdata->row_gpios[row]) ? | ||
78 | !pdata->active_low : pdata->active_low; | ||
79 | } | ||
80 | |||
81 | static void enable_row_irqs(struct matrix_keypad *keypad) | ||
82 | { | ||
83 | const struct matrix_keypad_platform_data *pdata = keypad->pdata; | ||
84 | int i; | ||
85 | |||
86 | for (i = 0; i < pdata->num_row_gpios; i++) | ||
87 | enable_irq(gpio_to_irq(pdata->row_gpios[i])); | ||
88 | } | ||
89 | |||
90 | static void disable_row_irqs(struct matrix_keypad *keypad) | ||
91 | { | ||
92 | const struct matrix_keypad_platform_data *pdata = keypad->pdata; | ||
93 | int i; | ||
94 | |||
95 | for (i = 0; i < pdata->num_row_gpios; i++) | ||
96 | disable_irq_nosync(gpio_to_irq(pdata->row_gpios[i])); | ||
97 | } | ||
98 | |||
99 | /* | ||
100 | * This gets the keys from keyboard and reports it to input subsystem | ||
101 | */ | ||
102 | static void matrix_keypad_scan(struct work_struct *work) | ||
103 | { | ||
104 | struct matrix_keypad *keypad = | ||
105 | container_of(work, struct matrix_keypad, work.work); | ||
106 | struct input_dev *input_dev = keypad->input_dev; | ||
107 | const struct matrix_keypad_platform_data *pdata = keypad->pdata; | ||
108 | uint32_t new_state[MATRIX_MAX_COLS]; | ||
109 | int row, col, code; | ||
110 | |||
111 | /* de-activate all columns for scanning */ | ||
112 | activate_all_cols(pdata, false); | ||
113 | |||
114 | memset(new_state, 0, sizeof(new_state)); | ||
115 | |||
116 | /* assert each column and read the row status out */ | ||
117 | for (col = 0; col < pdata->num_col_gpios; col++) { | ||
118 | |||
119 | activate_col(pdata, col, true); | ||
120 | |||
121 | for (row = 0; row < pdata->num_row_gpios; row++) | ||
122 | new_state[col] |= | ||
123 | row_asserted(pdata, row) ? (1 << row) : 0; | ||
124 | |||
125 | activate_col(pdata, col, false); | ||
126 | } | ||
127 | |||
128 | for (col = 0; col < pdata->num_col_gpios; col++) { | ||
129 | uint32_t bits_changed; | ||
130 | |||
131 | bits_changed = keypad->last_key_state[col] ^ new_state[col]; | ||
132 | if (bits_changed == 0) | ||
133 | continue; | ||
134 | |||
135 | for (row = 0; row < pdata->num_row_gpios; row++) { | ||
136 | if ((bits_changed & (1 << row)) == 0) | ||
137 | continue; | ||
138 | |||
139 | code = (row << 4) + col; | ||
140 | input_event(input_dev, EV_MSC, MSC_SCAN, code); | ||
141 | input_report_key(input_dev, | ||
142 | keypad->keycodes[code], | ||
143 | new_state[col] & (1 << row)); | ||
144 | } | ||
145 | } | ||
146 | input_sync(input_dev); | ||
147 | |||
148 | memcpy(keypad->last_key_state, new_state, sizeof(new_state)); | ||
149 | |||
150 | activate_all_cols(pdata, true); | ||
151 | |||
152 | /* Enable IRQs again */ | ||
153 | spin_lock_irq(&keypad->lock); | ||
154 | keypad->scan_pending = false; | ||
155 | enable_row_irqs(keypad); | ||
156 | spin_unlock_irq(&keypad->lock); | ||
157 | } | ||
158 | |||
159 | static irqreturn_t matrix_keypad_interrupt(int irq, void *id) | ||
160 | { | ||
161 | struct matrix_keypad *keypad = id; | ||
162 | unsigned long flags; | ||
163 | |||
164 | spin_lock_irqsave(&keypad->lock, flags); | ||
165 | |||
166 | /* | ||
167 | * See if another IRQ beaten us to it and scheduled the | ||
168 | * scan already. In that case we should not try to | ||
169 | * disable IRQs again. | ||
170 | */ | ||
171 | if (unlikely(keypad->scan_pending || keypad->stopped)) | ||
172 | goto out; | ||
173 | |||
174 | disable_row_irqs(keypad); | ||
175 | keypad->scan_pending = true; | ||
176 | schedule_delayed_work(&keypad->work, | ||
177 | msecs_to_jiffies(keypad->pdata->debounce_ms)); | ||
178 | |||
179 | out: | ||
180 | spin_unlock_irqrestore(&keypad->lock, flags); | ||
181 | return IRQ_HANDLED; | ||
182 | } | ||
183 | |||
184 | static int matrix_keypad_start(struct input_dev *dev) | ||
185 | { | ||
186 | struct matrix_keypad *keypad = input_get_drvdata(dev); | ||
187 | |||
188 | keypad->stopped = false; | ||
189 | mb(); | ||
190 | |||
191 | /* | ||
192 | * Schedule an immediate key scan to capture current key state; | ||
193 | * columns will be activated and IRQs be enabled after the scan. | ||
194 | */ | ||
195 | schedule_delayed_work(&keypad->work, 0); | ||
196 | |||
197 | return 0; | ||
198 | } | ||
199 | |||
200 | static void matrix_keypad_stop(struct input_dev *dev) | ||
201 | { | ||
202 | struct matrix_keypad *keypad = input_get_drvdata(dev); | ||
203 | |||
204 | keypad->stopped = true; | ||
205 | mb(); | ||
206 | flush_work(&keypad->work.work); | ||
207 | /* | ||
208 | * matrix_keypad_scan() will leave IRQs enabled; | ||
209 | * we should disable them now. | ||
210 | */ | ||
211 | disable_row_irqs(keypad); | ||
212 | } | ||
213 | |||
214 | #ifdef CONFIG_PM | ||
215 | static int matrix_keypad_suspend(struct platform_device *pdev, pm_message_t state) | ||
216 | { | ||
217 | struct matrix_keypad *keypad = platform_get_drvdata(pdev); | ||
218 | const struct matrix_keypad_platform_data *pdata = keypad->pdata; | ||
219 | int i; | ||
220 | |||
221 | matrix_keypad_stop(keypad->input_dev); | ||
222 | |||
223 | if (device_may_wakeup(&pdev->dev)) | ||
224 | for (i = 0; i < pdata->num_row_gpios; i++) | ||
225 | enable_irq_wake(gpio_to_irq(pdata->row_gpios[i])); | ||
226 | |||
227 | return 0; | ||
228 | } | ||
229 | |||
230 | static int matrix_keypad_resume(struct platform_device *pdev) | ||
231 | { | ||
232 | struct matrix_keypad *keypad = platform_get_drvdata(pdev); | ||
233 | const struct matrix_keypad_platform_data *pdata = keypad->pdata; | ||
234 | int i; | ||
235 | |||
236 | if (device_may_wakeup(&pdev->dev)) | ||
237 | for (i = 0; i < pdata->num_row_gpios; i++) | ||
238 | disable_irq_wake(gpio_to_irq(pdata->row_gpios[i])); | ||
239 | |||
240 | matrix_keypad_start(keypad->input_dev); | ||
241 | |||
242 | return 0; | ||
243 | } | ||
244 | #else | ||
245 | #define matrix_keypad_suspend NULL | ||
246 | #define matrix_keypad_resume NULL | ||
247 | #endif | ||
248 | |||
249 | static int __devinit init_matrix_gpio(struct platform_device *pdev, | ||
250 | struct matrix_keypad *keypad) | ||
251 | { | ||
252 | const struct matrix_keypad_platform_data *pdata = keypad->pdata; | ||
253 | int i, err = -EINVAL; | ||
254 | |||
255 | /* initialized strobe lines as outputs, activated */ | ||
256 | for (i = 0; i < pdata->num_col_gpios; i++) { | ||
257 | err = gpio_request(pdata->col_gpios[i], "matrix_kbd_col"); | ||
258 | if (err) { | ||
259 | dev_err(&pdev->dev, | ||
260 | "failed to request GPIO%d for COL%d\n", | ||
261 | pdata->col_gpios[i], i); | ||
262 | goto err_free_cols; | ||
263 | } | ||
264 | |||
265 | gpio_direction_output(pdata->col_gpios[i], !pdata->active_low); | ||
266 | } | ||
267 | |||
268 | for (i = 0; i < pdata->num_row_gpios; i++) { | ||
269 | err = gpio_request(pdata->row_gpios[i], "matrix_kbd_row"); | ||
270 | if (err) { | ||
271 | dev_err(&pdev->dev, | ||
272 | "failed to request GPIO%d for ROW%d\n", | ||
273 | pdata->row_gpios[i], i); | ||
274 | goto err_free_rows; | ||
275 | } | ||
276 | |||
277 | gpio_direction_input(pdata->row_gpios[i]); | ||
278 | } | ||
279 | |||
280 | for (i = 0; i < pdata->num_row_gpios; i++) { | ||
281 | err = request_irq(gpio_to_irq(pdata->row_gpios[i]), | ||
282 | matrix_keypad_interrupt, | ||
283 | IRQF_DISABLED | | ||
284 | IRQF_TRIGGER_RISING | IRQF_TRIGGER_FALLING, | ||
285 | "matrix-keypad", keypad); | ||
286 | if (err) { | ||
287 | dev_err(&pdev->dev, | ||
288 | "Unable to acquire interrupt for GPIO line %i\n", | ||
289 | pdata->row_gpios[i]); | ||
290 | goto err_free_irqs; | ||
291 | } | ||
292 | } | ||
293 | |||
294 | /* initialized as disabled - enabled by input->open */ | ||
295 | disable_row_irqs(keypad); | ||
296 | return 0; | ||
297 | |||
298 | err_free_irqs: | ||
299 | while (--i >= 0) | ||
300 | free_irq(gpio_to_irq(pdata->row_gpios[i]), keypad); | ||
301 | i = pdata->num_row_gpios; | ||
302 | err_free_rows: | ||
303 | while (--i >= 0) | ||
304 | gpio_free(pdata->row_gpios[i]); | ||
305 | i = pdata->num_col_gpios; | ||
306 | err_free_cols: | ||
307 | while (--i >= 0) | ||
308 | gpio_free(pdata->col_gpios[i]); | ||
309 | |||
310 | return err; | ||
311 | } | ||
312 | |||
313 | static int __devinit matrix_keypad_probe(struct platform_device *pdev) | ||
314 | { | ||
315 | const struct matrix_keypad_platform_data *pdata; | ||
316 | const struct matrix_keymap_data *keymap_data; | ||
317 | struct matrix_keypad *keypad; | ||
318 | struct input_dev *input_dev; | ||
319 | unsigned short *keycodes; | ||
320 | int i; | ||
321 | int err; | ||
322 | |||
323 | pdata = pdev->dev.platform_data; | ||
324 | if (!pdata) { | ||
325 | dev_err(&pdev->dev, "no platform data defined\n"); | ||
326 | return -EINVAL; | ||
327 | } | ||
328 | |||
329 | keymap_data = pdata->keymap_data; | ||
330 | if (!keymap_data) { | ||
331 | dev_err(&pdev->dev, "no keymap data defined\n"); | ||
332 | return -EINVAL; | ||
333 | } | ||
334 | |||
335 | if (!keymap_data->max_keymap_size) { | ||
336 | dev_err(&pdev->dev, "invalid keymap data supplied\n"); | ||
337 | return -EINVAL; | ||
338 | } | ||
339 | |||
340 | keypad = kzalloc(sizeof(struct matrix_keypad), GFP_KERNEL); | ||
341 | keycodes = kzalloc(keymap_data->max_keymap_size * | ||
342 | sizeof(keypad->keycodes), | ||
343 | GFP_KERNEL); | ||
344 | input_dev = input_allocate_device(); | ||
345 | if (!keypad || !keycodes || !input_dev) { | ||
346 | err = -ENOMEM; | ||
347 | goto err_free_mem; | ||
348 | } | ||
349 | |||
350 | keypad->input_dev = input_dev; | ||
351 | keypad->pdata = pdata; | ||
352 | keypad->keycodes = keycodes; | ||
353 | keypad->stopped = true; | ||
354 | INIT_DELAYED_WORK(&keypad->work, matrix_keypad_scan); | ||
355 | spin_lock_init(&keypad->lock); | ||
356 | |||
357 | input_dev->name = pdev->name; | ||
358 | input_dev->id.bustype = BUS_HOST; | ||
359 | input_dev->dev.parent = &pdev->dev; | ||
360 | input_dev->evbit[0] = BIT_MASK(EV_KEY) | BIT_MASK(EV_REP); | ||
361 | input_dev->open = matrix_keypad_start; | ||
362 | input_dev->close = matrix_keypad_stop; | ||
363 | |||
364 | input_dev->keycode = keycodes; | ||
365 | input_dev->keycodesize = sizeof(*keycodes); | ||
366 | input_dev->keycodemax = keymap_data->max_keymap_size; | ||
367 | |||
368 | for (i = 0; i < keymap_data->keymap_size; i++) { | ||
369 | unsigned int key = keymap_data->keymap[i]; | ||
370 | unsigned int row = KEY_ROW(key); | ||
371 | unsigned int col = KEY_COL(key); | ||
372 | unsigned short code = KEY_VAL(key); | ||
373 | |||
374 | keycodes[(row << 4) + col] = code; | ||
375 | __set_bit(code, input_dev->keybit); | ||
376 | } | ||
377 | __clear_bit(KEY_RESERVED, input_dev->keybit); | ||
378 | |||
379 | input_set_capability(input_dev, EV_MSC, MSC_SCAN); | ||
380 | input_set_drvdata(input_dev, keypad); | ||
381 | |||
382 | err = init_matrix_gpio(pdev, keypad); | ||
383 | if (err) | ||
384 | goto err_free_mem; | ||
385 | |||
386 | err = input_register_device(keypad->input_dev); | ||
387 | if (err) | ||
388 | goto err_free_mem; | ||
389 | |||
390 | device_init_wakeup(&pdev->dev, pdata->wakeup); | ||
391 | platform_set_drvdata(pdev, keypad); | ||
392 | |||
393 | return 0; | ||
394 | |||
395 | err_free_mem: | ||
396 | input_free_device(input_dev); | ||
397 | kfree(keycodes); | ||
398 | kfree(keypad); | ||
399 | return err; | ||
400 | } | ||
401 | |||
402 | static int __devexit matrix_keypad_remove(struct platform_device *pdev) | ||
403 | { | ||
404 | struct matrix_keypad *keypad = platform_get_drvdata(pdev); | ||
405 | const struct matrix_keypad_platform_data *pdata = keypad->pdata; | ||
406 | int i; | ||
407 | |||
408 | device_init_wakeup(&pdev->dev, 0); | ||
409 | |||
410 | for (i = 0; i < pdata->num_row_gpios; i++) { | ||
411 | free_irq(gpio_to_irq(pdata->row_gpios[i]), keypad); | ||
412 | gpio_free(pdata->row_gpios[i]); | ||
413 | } | ||
414 | |||
415 | for (i = 0; i < pdata->num_col_gpios; i++) | ||
416 | gpio_free(pdata->col_gpios[i]); | ||
417 | |||
418 | input_unregister_device(keypad->input_dev); | ||
419 | platform_set_drvdata(pdev, NULL); | ||
420 | kfree(keypad->keycodes); | ||
421 | kfree(keypad); | ||
422 | |||
423 | return 0; | ||
424 | } | ||
425 | |||
426 | static struct platform_driver matrix_keypad_driver = { | ||
427 | .probe = matrix_keypad_probe, | ||
428 | .remove = __devexit_p(matrix_keypad_remove), | ||
429 | .suspend = matrix_keypad_suspend, | ||
430 | .resume = matrix_keypad_resume, | ||
431 | .driver = { | ||
432 | .name = "matrix-keypad", | ||
433 | .owner = THIS_MODULE, | ||
434 | }, | ||
435 | }; | ||
436 | |||
437 | static int __init matrix_keypad_init(void) | ||
438 | { | ||
439 | return platform_driver_register(&matrix_keypad_driver); | ||
440 | } | ||
441 | |||
442 | static void __exit matrix_keypad_exit(void) | ||
443 | { | ||
444 | platform_driver_unregister(&matrix_keypad_driver); | ||
445 | } | ||
446 | |||
447 | module_init(matrix_keypad_init); | ||
448 | module_exit(matrix_keypad_exit); | ||
449 | |||
450 | MODULE_AUTHOR("Marek Vasut <marek.vasut@gmail.com>"); | ||
451 | MODULE_DESCRIPTION("GPIO Driven Matrix Keypad Driver"); | ||
452 | MODULE_LICENSE("GPL v2"); | ||
453 | MODULE_ALIAS("platform:matrix-keypad"); | ||
diff --git a/drivers/input/mouse/gpio_mouse.c b/drivers/input/mouse/gpio_mouse.c index 5e5eb88d8d1..7b6ce178f1b 100644 --- a/drivers/input/mouse/gpio_mouse.c +++ b/drivers/input/mouse/gpio_mouse.c | |||
@@ -46,7 +46,7 @@ static void gpio_mouse_scan(struct input_polled_dev *dev) | |||
46 | input_sync(input); | 46 | input_sync(input); |
47 | } | 47 | } |
48 | 48 | ||
49 | static int __init gpio_mouse_probe(struct platform_device *pdev) | 49 | static int __devinit gpio_mouse_probe(struct platform_device *pdev) |
50 | { | 50 | { |
51 | struct gpio_mouse_platform_data *pdata = pdev->dev.platform_data; | 51 | struct gpio_mouse_platform_data *pdata = pdev->dev.platform_data; |
52 | struct input_polled_dev *input_poll; | 52 | struct input_polled_dev *input_poll; |
@@ -170,10 +170,8 @@ static int __devexit gpio_mouse_remove(struct platform_device *pdev) | |||
170 | return 0; | 170 | return 0; |
171 | } | 171 | } |
172 | 172 | ||
173 | /* work with hotplug and coldplug */ | ||
174 | MODULE_ALIAS("platform:gpio_mouse"); | ||
175 | |||
176 | static struct platform_driver gpio_mouse_device_driver = { | 173 | static struct platform_driver gpio_mouse_device_driver = { |
174 | .probe = gpio_mouse_probe, | ||
177 | .remove = __devexit_p(gpio_mouse_remove), | 175 | .remove = __devexit_p(gpio_mouse_remove), |
178 | .driver = { | 176 | .driver = { |
179 | .name = "gpio_mouse", | 177 | .name = "gpio_mouse", |
@@ -183,8 +181,7 @@ static struct platform_driver gpio_mouse_device_driver = { | |||
183 | 181 | ||
184 | static int __init gpio_mouse_init(void) | 182 | static int __init gpio_mouse_init(void) |
185 | { | 183 | { |
186 | return platform_driver_probe(&gpio_mouse_device_driver, | 184 | return platform_driver_register(&gpio_mouse_device_driver); |
187 | gpio_mouse_probe); | ||
188 | } | 185 | } |
189 | module_init(gpio_mouse_init); | 186 | module_init(gpio_mouse_init); |
190 | 187 | ||
@@ -197,3 +194,5 @@ module_exit(gpio_mouse_exit); | |||
197 | MODULE_AUTHOR("Hans-Christian Egtvedt <hcegtvedt@atmel.com>"); | 194 | MODULE_AUTHOR("Hans-Christian Egtvedt <hcegtvedt@atmel.com>"); |
198 | MODULE_DESCRIPTION("GPIO mouse driver"); | 195 | MODULE_DESCRIPTION("GPIO mouse driver"); |
199 | MODULE_LICENSE("GPL"); | 196 | MODULE_LICENSE("GPL"); |
197 | MODULE_ALIAS("platform:gpio_mouse"); /* work with hotplug and coldplug */ | ||
198 | |||
diff --git a/drivers/input/serio/i8042-x86ia64io.h b/drivers/input/serio/i8042-x86ia64io.h index fb8a3cd3ffd..924e8ed7f2c 100644 --- a/drivers/input/serio/i8042-x86ia64io.h +++ b/drivers/input/serio/i8042-x86ia64io.h | |||
@@ -392,6 +392,34 @@ static struct dmi_system_id __initdata i8042_dmi_reset_table[] = { | |||
392 | DMI_MATCH(DMI_BOARD_VENDOR, "LG Electronics Inc."), | 392 | DMI_MATCH(DMI_BOARD_VENDOR, "LG Electronics Inc."), |
393 | }, | 393 | }, |
394 | }, | 394 | }, |
395 | { | ||
396 | .ident = "Acer Aspire One 150", | ||
397 | .matches = { | ||
398 | DMI_MATCH(DMI_SYS_VENDOR, "Acer"), | ||
399 | DMI_MATCH(DMI_PRODUCT_NAME, "AOA150"), | ||
400 | }, | ||
401 | }, | ||
402 | { | ||
403 | .ident = "Advent 4211", | ||
404 | .matches = { | ||
405 | DMI_MATCH(DMI_SYS_VENDOR, "DIXONSXP"), | ||
406 | DMI_MATCH(DMI_PRODUCT_NAME, "Advent 4211"), | ||
407 | }, | ||
408 | }, | ||
409 | { | ||
410 | .ident = "Medion Akoya Mini E1210", | ||
411 | .matches = { | ||
412 | DMI_MATCH(DMI_SYS_VENDOR, "MEDION"), | ||
413 | DMI_MATCH(DMI_PRODUCT_NAME, "E1210"), | ||
414 | }, | ||
415 | }, | ||
416 | { | ||
417 | .ident = "Mivvy M310", | ||
418 | .matches = { | ||
419 | DMI_MATCH(DMI_SYS_VENDOR, "VIOOO"), | ||
420 | DMI_MATCH(DMI_PRODUCT_NAME, "N10"), | ||
421 | }, | ||
422 | }, | ||
395 | { } | 423 | { } |
396 | }; | 424 | }; |
397 | 425 | ||
diff --git a/drivers/input/serio/i8042.c b/drivers/input/serio/i8042.c index f919bf57293..582245c497e 100644 --- a/drivers/input/serio/i8042.c +++ b/drivers/input/serio/i8042.c | |||
@@ -934,10 +934,11 @@ static bool i8042_suspended; | |||
934 | 934 | ||
935 | static int i8042_suspend(struct platform_device *dev, pm_message_t state) | 935 | static int i8042_suspend(struct platform_device *dev, pm_message_t state) |
936 | { | 936 | { |
937 | if (!i8042_suspended && state.event == PM_EVENT_SUSPEND) { | 937 | if (!i8042_suspended && state.event == PM_EVENT_SUSPEND) |
938 | i8042_controller_reset(); | 938 | i8042_controller_reset(); |
939 | i8042_suspended = true; | 939 | |
940 | } | 940 | i8042_suspended = state.event == PM_EVENT_SUSPEND || |
941 | state.event == PM_EVENT_FREEZE; | ||
941 | 942 | ||
942 | return 0; | 943 | return 0; |
943 | } | 944 | } |
diff --git a/drivers/input/serio/serio.c b/drivers/input/serio/serio.c index fb17573f8f2..d66f4944f2a 100644 --- a/drivers/input/serio/serio.c +++ b/drivers/input/serio/serio.c | |||
@@ -935,10 +935,11 @@ static int serio_suspend(struct device *dev, pm_message_t state) | |||
935 | { | 935 | { |
936 | struct serio *serio = to_serio_port(dev); | 936 | struct serio *serio = to_serio_port(dev); |
937 | 937 | ||
938 | if (!serio->suspended && state.event == PM_EVENT_SUSPEND) { | 938 | if (!serio->suspended && state.event == PM_EVENT_SUSPEND) |
939 | serio_cleanup(serio); | 939 | serio_cleanup(serio); |
940 | serio->suspended = true; | 940 | |
941 | } | 941 | serio->suspended = state.event == PM_EVENT_SUSPEND || |
942 | state.event == PM_EVENT_FREEZE; | ||
942 | 943 | ||
943 | return 0; | 944 | return 0; |
944 | } | 945 | } |
diff --git a/drivers/input/tablet/wacom_wac.c b/drivers/input/tablet/wacom_wac.c index 38bf86384ae..c896d6a21b7 100644 --- a/drivers/input/tablet/wacom_wac.c +++ b/drivers/input/tablet/wacom_wac.c | |||
@@ -384,6 +384,8 @@ static int wacom_intuos_inout(struct wacom_wac *wacom, void *wcombo) | |||
384 | wacom_report_key(wcombo, BTN_STYLUS2, 0); | 384 | wacom_report_key(wcombo, BTN_STYLUS2, 0); |
385 | wacom_report_key(wcombo, BTN_TOUCH, 0); | 385 | wacom_report_key(wcombo, BTN_TOUCH, 0); |
386 | wacom_report_abs(wcombo, ABS_WHEEL, 0); | 386 | wacom_report_abs(wcombo, ABS_WHEEL, 0); |
387 | if (wacom->features->type >= INTUOS3S) | ||
388 | wacom_report_abs(wcombo, ABS_Z, 0); | ||
387 | } | 389 | } |
388 | wacom_report_key(wcombo, wacom->tool[idx], 0); | 390 | wacom_report_key(wcombo, wacom->tool[idx], 0); |
389 | wacom_report_abs(wcombo, ABS_MISC, 0); /* reset tool id */ | 391 | wacom_report_abs(wcombo, ABS_MISC, 0); /* reset tool id */ |
@@ -836,6 +838,7 @@ static struct wacom_features wacom_features[] = { | |||
836 | { "Wacom DTU710", 8, 34080, 27660, 511, 0, PL }, | 838 | { "Wacom DTU710", 8, 34080, 27660, 511, 0, PL }, |
837 | { "Wacom DTF521", 8, 6282, 4762, 511, 0, PL }, | 839 | { "Wacom DTF521", 8, 6282, 4762, 511, 0, PL }, |
838 | { "Wacom DTF720", 8, 6858, 5506, 511, 0, PL }, | 840 | { "Wacom DTF720", 8, 6858, 5506, 511, 0, PL }, |
841 | { "Wacom DTF720a", 8, 6858, 5506, 511, 0, PL }, | ||
839 | { "Wacom Cintiq Partner",8, 20480, 15360, 511, 0, PTU }, | 842 | { "Wacom Cintiq Partner",8, 20480, 15360, 511, 0, PTU }, |
840 | { "Wacom Intuos2 4x5", 10, 12700, 10600, 1023, 31, INTUOS }, | 843 | { "Wacom Intuos2 4x5", 10, 12700, 10600, 1023, 31, INTUOS }, |
841 | { "Wacom Intuos2 6x8", 10, 20320, 16240, 1023, 31, INTUOS }, | 844 | { "Wacom Intuos2 6x8", 10, 20320, 16240, 1023, 31, INTUOS }, |
@@ -897,8 +900,9 @@ static struct usb_device_id wacom_ids[] = { | |||
897 | { USB_DEVICE(USB_VENDOR_ID_WACOM, 0x37) }, | 900 | { USB_DEVICE(USB_VENDOR_ID_WACOM, 0x37) }, |
898 | { USB_DEVICE(USB_VENDOR_ID_WACOM, 0x38) }, | 901 | { USB_DEVICE(USB_VENDOR_ID_WACOM, 0x38) }, |
899 | { USB_DEVICE(USB_VENDOR_ID_WACOM, 0x39) }, | 902 | { USB_DEVICE(USB_VENDOR_ID_WACOM, 0x39) }, |
900 | { USB_DEVICE(USB_VENDOR_ID_WACOM, 0xC0) }, | ||
901 | { USB_DEVICE(USB_VENDOR_ID_WACOM, 0xC4) }, | 903 | { USB_DEVICE(USB_VENDOR_ID_WACOM, 0xC4) }, |
904 | { USB_DEVICE(USB_VENDOR_ID_WACOM, 0xC0) }, | ||
905 | { USB_DEVICE(USB_VENDOR_ID_WACOM, 0xC2) }, | ||
902 | { USB_DEVICE(USB_VENDOR_ID_WACOM, 0x03) }, | 906 | { USB_DEVICE(USB_VENDOR_ID_WACOM, 0x03) }, |
903 | { USB_DEVICE(USB_VENDOR_ID_WACOM, 0x41) }, | 907 | { USB_DEVICE(USB_VENDOR_ID_WACOM, 0x41) }, |
904 | { USB_DEVICE(USB_VENDOR_ID_WACOM, 0x42) }, | 908 | { USB_DEVICE(USB_VENDOR_ID_WACOM, 0x42) }, |
diff --git a/drivers/isdn/gigaset/ev-layer.c b/drivers/isdn/gigaset/ev-layer.c index ec5169604a6..2d91049571a 100644 --- a/drivers/isdn/gigaset/ev-layer.c +++ b/drivers/isdn/gigaset/ev-layer.c | |||
@@ -294,32 +294,33 @@ struct reply_t gigaset_tab_cid[] = | |||
294 | {RSP_OK, 604,604, -1, 605, 5, {ACT_CMD+AT_MSN}}, | 294 | {RSP_OK, 604,604, -1, 605, 5, {ACT_CMD+AT_MSN}}, |
295 | {RSP_OK, 605,605, -1, 606, 5, {ACT_CMD+AT_ISO}}, | 295 | {RSP_OK, 605,605, -1, 606, 5, {ACT_CMD+AT_ISO}}, |
296 | {RSP_NULL, 605,605, -1, 606, 5, {ACT_CMD+AT_ISO}}, | 296 | {RSP_NULL, 605,605, -1, 606, 5, {ACT_CMD+AT_ISO}}, |
297 | {RSP_OK, 606,606, -1, 607, 5, {0}, "+VLS=17\r"}, /* set "Endgeraetemodus" */ | 297 | {RSP_OK, 606,606, -1, 607, 5, {0}, "+VLS=17\r"}, |
298 | {RSP_OK, 607,607, -1, 608,-1}, | 298 | {RSP_OK, 607,607, -1, 608,-1}, |
299 | //{RSP_ZSAU, 608,608,ZSAU_PROCEEDING, 608, 0, {ACT_ERROR}},//DELETE | ||
300 | {RSP_ZSAU, 608,608,ZSAU_PROCEEDING, 609, 5, {ACT_CMD+AT_DIAL}}, | 299 | {RSP_ZSAU, 608,608,ZSAU_PROCEEDING, 609, 5, {ACT_CMD+AT_DIAL}}, |
301 | {RSP_OK, 609,609, -1, 650, 0, {ACT_DIALING}}, | 300 | {RSP_OK, 609,609, -1, 650, 0, {ACT_DIALING}}, |
302 | 301 | ||
303 | {RSP_ZVLS, 608,608, 17, -1,-1, {ACT_DEBUG}}, | ||
304 | {RSP_ZCTP, 609,609, -1, -1,-1, {ACT_DEBUG}}, | ||
305 | {RSP_ZCPN, 609,609, -1, -1,-1, {ACT_DEBUG}}, | ||
306 | {RSP_ERROR, 601,609, -1, 0, 0, {ACT_ABORTDIAL}}, | 302 | {RSP_ERROR, 601,609, -1, 0, 0, {ACT_ABORTDIAL}}, |
307 | {EV_TIMEOUT, 601,609, -1, 0, 0, {ACT_ABORTDIAL}}, | 303 | {EV_TIMEOUT, 601,609, -1, 0, 0, {ACT_ABORTDIAL}}, |
308 | 304 | ||
309 | /* dialing */ | 305 | /* optional dialing responses */ |
310 | {RSP_ZCTP, 650,650, -1, -1,-1, {ACT_DEBUG}}, | 306 | {EV_BC_OPEN, 650,650, -1, 651,-1}, |
311 | {RSP_ZCPN, 650,650, -1, -1,-1, {ACT_DEBUG}}, | 307 | {RSP_ZVLS, 608,651, 17, -1,-1, {ACT_DEBUG}}, |
312 | {RSP_ZSAU, 650,650,ZSAU_CALL_DELIVERED, -1,-1, {ACT_DEBUG}}, /* some devices don't send this */ | 308 | {RSP_ZCTP, 609,651, -1, -1,-1, {ACT_DEBUG}}, |
313 | 309 | {RSP_ZCPN, 609,651, -1, -1,-1, {ACT_DEBUG}}, | |
314 | /* connection established */ | 310 | {RSP_ZSAU, 650,651,ZSAU_CALL_DELIVERED, -1,-1, {ACT_DEBUG}}, |
315 | {RSP_ZSAU, 650,650,ZSAU_ACTIVE, 800,-1, {ACT_CONNECT}}, //FIXME -> DLE1 | 311 | |
316 | {RSP_ZSAU, 750,750,ZSAU_ACTIVE, 800,-1, {ACT_CONNECT}}, //FIXME -> DLE1 | 312 | /* connect */ |
317 | 313 | {RSP_ZSAU, 650,650,ZSAU_ACTIVE, 800,-1, {ACT_CONNECT}}, | |
318 | {EV_BC_OPEN, 800,800, -1, 800,-1, {ACT_NOTIFY_BC_UP}}, //FIXME new constate + timeout | 314 | {RSP_ZSAU, 651,651,ZSAU_ACTIVE, 800,-1, {ACT_CONNECT, |
315 | ACT_NOTIFY_BC_UP}}, | ||
316 | {RSP_ZSAU, 750,750,ZSAU_ACTIVE, 800,-1, {ACT_CONNECT}}, | ||
317 | {RSP_ZSAU, 751,751,ZSAU_ACTIVE, 800,-1, {ACT_CONNECT, | ||
318 | ACT_NOTIFY_BC_UP}}, | ||
319 | {EV_BC_OPEN, 800,800, -1, 800,-1, {ACT_NOTIFY_BC_UP}}, | ||
319 | 320 | ||
320 | /* remote hangup */ | 321 | /* remote hangup */ |
321 | {RSP_ZSAU, 650,650,ZSAU_DISCONNECT_IND, 0, 0, {ACT_REMOTEREJECT}}, | 322 | {RSP_ZSAU, 650,651,ZSAU_DISCONNECT_IND, 0, 0, {ACT_REMOTEREJECT}}, |
322 | {RSP_ZSAU, 750,750,ZSAU_DISCONNECT_IND, 0, 0, {ACT_REMOTEHUP}}, | 323 | {RSP_ZSAU, 750,751,ZSAU_DISCONNECT_IND, 0, 0, {ACT_REMOTEHUP}}, |
323 | {RSP_ZSAU, 800,800,ZSAU_DISCONNECT_IND, 0, 0, {ACT_REMOTEHUP}}, | 324 | {RSP_ZSAU, 800,800,ZSAU_DISCONNECT_IND, 0, 0, {ACT_REMOTEHUP}}, |
324 | 325 | ||
325 | /* hangup */ | 326 | /* hangup */ |
@@ -358,7 +359,8 @@ struct reply_t gigaset_tab_cid[] = | |||
358 | {RSP_ZSAU, 700,729,ZSAU_ACTIVE, 0, 0, {ACT_ABORTACCEPT}}, | 359 | {RSP_ZSAU, 700,729,ZSAU_ACTIVE, 0, 0, {ACT_ABORTACCEPT}}, |
359 | {RSP_ZSAU, 700,729,ZSAU_DISCONNECT_IND, 0, 0, {ACT_ABORTACCEPT}}, | 360 | {RSP_ZSAU, 700,729,ZSAU_DISCONNECT_IND, 0, 0, {ACT_ABORTACCEPT}}, |
360 | 361 | ||
361 | {EV_TIMEOUT, 750,750, -1, 0, 0, {ACT_CONNTIMEOUT}}, | 362 | {EV_BC_OPEN, 750,750, -1, 751,-1}, |
363 | {EV_TIMEOUT, 750,751, -1, 0, 0, {ACT_CONNTIMEOUT}}, | ||
362 | 364 | ||
363 | /* B channel closed (general case) */ | 365 | /* B channel closed (general case) */ |
364 | {EV_BC_CLOSED, -1, -1, -1, -1,-1, {ACT_NOTIFY_BC_DOWN}}, //FIXME | 366 | {EV_BC_CLOSED, -1, -1, -1, -1,-1, {ACT_NOTIFY_BC_DOWN}}, //FIXME |
@@ -876,12 +878,6 @@ static void bchannel_down(struct bc_state *bcs) | |||
876 | 878 | ||
877 | static void bchannel_up(struct bc_state *bcs) | 879 | static void bchannel_up(struct bc_state *bcs) |
878 | { | 880 | { |
879 | if (!(bcs->chstate & CHS_D_UP)) { | ||
880 | dev_notice(bcs->cs->dev, "%s: D channel not up\n", __func__); | ||
881 | bcs->chstate |= CHS_D_UP; | ||
882 | gigaset_i4l_channel_cmd(bcs, ISDN_STAT_DCONN); | ||
883 | } | ||
884 | |||
885 | if (bcs->chstate & CHS_B_UP) { | 881 | if (bcs->chstate & CHS_B_UP) { |
886 | dev_notice(bcs->cs->dev, "%s: B channel already up\n", | 882 | dev_notice(bcs->cs->dev, "%s: B channel already up\n", |
887 | __func__); | 883 | __func__); |
diff --git a/drivers/isdn/gigaset/isocdata.c b/drivers/isdn/gigaset/isocdata.c index db3a1e4cd48..bed38fcc432 100644 --- a/drivers/isdn/gigaset/isocdata.c +++ b/drivers/isdn/gigaset/isocdata.c | |||
@@ -174,12 +174,6 @@ int gigaset_isowbuf_getbytes(struct isowbuf_t *iwb, int size) | |||
174 | pr_err("invalid size %d\n", size); | 174 | pr_err("invalid size %d\n", size); |
175 | return -EINVAL; | 175 | return -EINVAL; |
176 | } | 176 | } |
177 | src = iwb->read; | ||
178 | if (unlikely(limit >= BAS_OUTBUFSIZE + BAS_OUTBUFPAD || | ||
179 | (read < src && limit >= src))) { | ||
180 | pr_err("isoc write buffer frame reservation violated\n"); | ||
181 | return -EFAULT; | ||
182 | } | ||
183 | #endif | 177 | #endif |
184 | 178 | ||
185 | if (read < write) { | 179 | if (read < write) { |
diff --git a/drivers/md/dm-crypt.c b/drivers/md/dm-crypt.c index 9933eb861c7..529e2ba505c 100644 --- a/drivers/md/dm-crypt.c +++ b/drivers/md/dm-crypt.c | |||
@@ -776,7 +776,7 @@ static void kcryptd_crypt_write_convert(struct dm_crypt_io *io) | |||
776 | * But don't wait if split was due to the io size restriction | 776 | * But don't wait if split was due to the io size restriction |
777 | */ | 777 | */ |
778 | if (unlikely(out_of_pages)) | 778 | if (unlikely(out_of_pages)) |
779 | congestion_wait(WRITE, HZ/100); | 779 | congestion_wait(BLK_RW_ASYNC, HZ/100); |
780 | 780 | ||
781 | /* | 781 | /* |
782 | * With async crypto it is unsafe to share the crypto context | 782 | * With async crypto it is unsafe to share the crypto context |
diff --git a/drivers/md/md.c b/drivers/md/md.c index 0f4a70c43ff..d4351ff0849 100644 --- a/drivers/md/md.c +++ b/drivers/md/md.c | |||
@@ -1756,9 +1756,10 @@ static void print_sb_1(struct mdp_superblock_1 *sb) | |||
1756 | __u8 *uuid; | 1756 | __u8 *uuid; |
1757 | 1757 | ||
1758 | uuid = sb->set_uuid; | 1758 | uuid = sb->set_uuid; |
1759 | printk(KERN_INFO "md: SB: (V:%u) (F:0x%08x) Array-ID:<%02x%02x%02x%02x" | 1759 | printk(KERN_INFO |
1760 | ":%02x%02x:%02x%02x:%02x%02x:%02x%02x%02x%02x%02x%02x>\n" | 1760 | "md: SB: (V:%u) (F:0x%08x) Array-ID:<%02x%02x%02x%02x" |
1761 | KERN_INFO "md: Name: \"%s\" CT:%llu\n", | 1761 | ":%02x%02x:%02x%02x:%02x%02x:%02x%02x%02x%02x%02x%02x>\n" |
1762 | "md: Name: \"%s\" CT:%llu\n", | ||
1762 | le32_to_cpu(sb->major_version), | 1763 | le32_to_cpu(sb->major_version), |
1763 | le32_to_cpu(sb->feature_map), | 1764 | le32_to_cpu(sb->feature_map), |
1764 | uuid[0], uuid[1], uuid[2], uuid[3], | 1765 | uuid[0], uuid[1], uuid[2], uuid[3], |
@@ -1770,12 +1771,13 @@ static void print_sb_1(struct mdp_superblock_1 *sb) | |||
1770 | & MD_SUPERBLOCK_1_TIME_SEC_MASK); | 1771 | & MD_SUPERBLOCK_1_TIME_SEC_MASK); |
1771 | 1772 | ||
1772 | uuid = sb->device_uuid; | 1773 | uuid = sb->device_uuid; |
1773 | printk(KERN_INFO "md: L%u SZ%llu RD:%u LO:%u CS:%u DO:%llu DS:%llu SO:%llu" | 1774 | printk(KERN_INFO |
1775 | "md: L%u SZ%llu RD:%u LO:%u CS:%u DO:%llu DS:%llu SO:%llu" | ||
1774 | " RO:%llu\n" | 1776 | " RO:%llu\n" |
1775 | KERN_INFO "md: Dev:%08x UUID: %02x%02x%02x%02x:%02x%02x:%02x%02x:%02x%02x" | 1777 | "md: Dev:%08x UUID: %02x%02x%02x%02x:%02x%02x:%02x%02x:%02x%02x" |
1776 | ":%02x%02x%02x%02x%02x%02x\n" | 1778 | ":%02x%02x%02x%02x%02x%02x\n" |
1777 | KERN_INFO "md: (F:0x%08x) UT:%llu Events:%llu ResyncOffset:%llu CSUM:0x%08x\n" | 1779 | "md: (F:0x%08x) UT:%llu Events:%llu ResyncOffset:%llu CSUM:0x%08x\n" |
1778 | KERN_INFO "md: (MaxDev:%u) \n", | 1780 | "md: (MaxDev:%u) \n", |
1779 | le32_to_cpu(sb->level), | 1781 | le32_to_cpu(sb->level), |
1780 | (unsigned long long)le64_to_cpu(sb->size), | 1782 | (unsigned long long)le64_to_cpu(sb->size), |
1781 | le32_to_cpu(sb->raid_disks), | 1783 | le32_to_cpu(sb->raid_disks), |
diff --git a/drivers/media/common/tuners/tuner-xc2028.c b/drivers/media/common/tuners/tuner-xc2028.c index b6da9c3873f..aa20ce8cc66 100644 --- a/drivers/media/common/tuners/tuner-xc2028.c +++ b/drivers/media/common/tuners/tuner-xc2028.c | |||
@@ -1096,8 +1096,19 @@ static int xc2028_set_params(struct dvb_frontend *fe, | |||
1096 | } | 1096 | } |
1097 | 1097 | ||
1098 | /* All S-code tables need a 200kHz shift */ | 1098 | /* All S-code tables need a 200kHz shift */ |
1099 | if (priv->ctrl.demod) | 1099 | if (priv->ctrl.demod) { |
1100 | demod = priv->ctrl.demod + 200; | 1100 | demod = priv->ctrl.demod + 200; |
1101 | /* | ||
1102 | * The DTV7 S-code table needs a 700 kHz shift. | ||
1103 | * Thanks to Terry Wu <terrywu2009@gmail.com> for reporting this | ||
1104 | * | ||
1105 | * DTV7 is only used in Australia. Germany or Italy may also | ||
1106 | * use this firmware after initialization, but a tune to a UHF | ||
1107 | * channel should then cause DTV78 to be used. | ||
1108 | */ | ||
1109 | if (type & DTV7) | ||
1110 | demod += 500; | ||
1111 | } | ||
1101 | 1112 | ||
1102 | return generic_set_freq(fe, p->frequency, | 1113 | return generic_set_freq(fe, p->frequency, |
1103 | T_DIGITAL_TV, type, 0, demod); | 1114 | T_DIGITAL_TV, type, 0, demod); |
diff --git a/drivers/media/dvb/ttpci/Kconfig b/drivers/media/dvb/ttpci/Kconfig index 68eb4493f99..d8d4214fd65 100644 --- a/drivers/media/dvb/ttpci/Kconfig +++ b/drivers/media/dvb/ttpci/Kconfig | |||
@@ -1,5 +1,6 @@ | |||
1 | config TTPCI_EEPROM | 1 | config TTPCI_EEPROM |
2 | tristate | 2 | tristate |
3 | depends on I2C | ||
3 | default n | 4 | default n |
4 | 5 | ||
5 | config DVB_AV7110 | 6 | config DVB_AV7110 |
diff --git a/drivers/media/radio/radio-si470x.c b/drivers/media/radio/radio-si470x.c index 640421ceb24..46d21632961 100644 --- a/drivers/media/radio/radio-si470x.c +++ b/drivers/media/radio/radio-si470x.c | |||
@@ -1200,7 +1200,7 @@ static int si470x_fops_release(struct file *file) | |||
1200 | video_unregister_device(radio->videodev); | 1200 | video_unregister_device(radio->videodev); |
1201 | kfree(radio->buffer); | 1201 | kfree(radio->buffer); |
1202 | kfree(radio); | 1202 | kfree(radio); |
1203 | goto done; | 1203 | goto unlock; |
1204 | } | 1204 | } |
1205 | 1205 | ||
1206 | /* stop rds reception */ | 1206 | /* stop rds reception */ |
@@ -1213,9 +1213,8 @@ static int si470x_fops_release(struct file *file) | |||
1213 | retval = si470x_stop(radio); | 1213 | retval = si470x_stop(radio); |
1214 | usb_autopm_put_interface(radio->intf); | 1214 | usb_autopm_put_interface(radio->intf); |
1215 | } | 1215 | } |
1216 | 1216 | unlock: | |
1217 | mutex_unlock(&radio->disconnect_lock); | 1217 | mutex_unlock(&radio->disconnect_lock); |
1218 | |||
1219 | done: | 1218 | done: |
1220 | return retval; | 1219 | return retval; |
1221 | } | 1220 | } |
diff --git a/drivers/media/video/Kconfig b/drivers/media/video/Kconfig index 061e147f6f2..84b6fc15519 100644 --- a/drivers/media/video/Kconfig +++ b/drivers/media/video/Kconfig | |||
@@ -312,6 +312,14 @@ config VIDEO_OV7670 | |||
312 | OV7670 VGA camera. It currently only works with the M88ALP01 | 312 | OV7670 VGA camera. It currently only works with the M88ALP01 |
313 | controller. | 313 | controller. |
314 | 314 | ||
315 | config VIDEO_MT9V011 | ||
316 | tristate "Micron mt9v011 sensor support" | ||
317 | depends on I2C && VIDEO_V4L2 | ||
318 | ---help--- | ||
319 | This is a Video4Linux2 sensor-level driver for the Micron | ||
320 | mt0v011 1.3 Mpixel camera. It currently only works with the | ||
321 | em28xx driver. | ||
322 | |||
315 | config VIDEO_TCM825X | 323 | config VIDEO_TCM825X |
316 | tristate "TCM825x camera sensor support" | 324 | tristate "TCM825x camera sensor support" |
317 | depends on I2C && VIDEO_V4L2 | 325 | depends on I2C && VIDEO_V4L2 |
diff --git a/drivers/media/video/Makefile b/drivers/media/video/Makefile index 7fb3add1b38..9f2e3214a48 100644 --- a/drivers/media/video/Makefile +++ b/drivers/media/video/Makefile | |||
@@ -69,6 +69,7 @@ obj-$(CONFIG_VIDEO_UPD64083) += upd64083.o | |||
69 | obj-$(CONFIG_VIDEO_OV7670) += ov7670.o | 69 | obj-$(CONFIG_VIDEO_OV7670) += ov7670.o |
70 | obj-$(CONFIG_VIDEO_TCM825X) += tcm825x.o | 70 | obj-$(CONFIG_VIDEO_TCM825X) += tcm825x.o |
71 | obj-$(CONFIG_VIDEO_TVEEPROM) += tveeprom.o | 71 | obj-$(CONFIG_VIDEO_TVEEPROM) += tveeprom.o |
72 | obj-$(CONFIG_VIDEO_MT9V011) += mt9v011.o | ||
72 | 73 | ||
73 | obj-$(CONFIG_SOC_CAMERA_MT9M001) += mt9m001.o | 74 | obj-$(CONFIG_SOC_CAMERA_MT9M001) += mt9m001.o |
74 | obj-$(CONFIG_SOC_CAMERA_MT9M111) += mt9m111.o | 75 | obj-$(CONFIG_SOC_CAMERA_MT9M111) += mt9m111.o |
diff --git a/drivers/media/video/cx18/cx18-cards.c b/drivers/media/video/cx18/cx18-cards.c index c92a25036f0..36f2d76006f 100644 --- a/drivers/media/video/cx18/cx18-cards.c +++ b/drivers/media/video/cx18/cx18-cards.c | |||
@@ -198,11 +198,14 @@ static const struct cx18_card_pci_info cx18_pci_mpc718[] = { | |||
198 | 198 | ||
199 | static const struct cx18_card cx18_card_mpc718 = { | 199 | static const struct cx18_card cx18_card_mpc718 = { |
200 | .type = CX18_CARD_YUAN_MPC718, | 200 | .type = CX18_CARD_YUAN_MPC718, |
201 | .name = "Yuan MPC718", | 201 | .name = "Yuan MPC718 MiniPCI DVB-T/Analog", |
202 | .comment = "Analog video capture works; some audio line in may not.\n", | 202 | .comment = "Experimenters needed for device to work well.\n" |
203 | "\tTo help, mail the ivtv-devel list (www.ivtvdriver.org).\n", | ||
203 | .v4l2_capabilities = CX18_CAP_ENCODER, | 204 | .v4l2_capabilities = CX18_CAP_ENCODER, |
204 | .hw_audio_ctrl = CX18_HW_418_AV, | 205 | .hw_audio_ctrl = CX18_HW_418_AV, |
205 | .hw_all = CX18_HW_418_AV | CX18_HW_TUNER | CX18_HW_GPIO_RESET_CTRL, | 206 | .hw_muxer = CX18_HW_GPIO_MUX, |
207 | .hw_all = CX18_HW_418_AV | CX18_HW_TUNER | | ||
208 | CX18_HW_GPIO_MUX | CX18_HW_DVB | CX18_HW_GPIO_RESET_CTRL, | ||
206 | .video_inputs = { | 209 | .video_inputs = { |
207 | { CX18_CARD_INPUT_VID_TUNER, 0, CX18_AV_COMPOSITE2 }, | 210 | { CX18_CARD_INPUT_VID_TUNER, 0, CX18_AV_COMPOSITE2 }, |
208 | { CX18_CARD_INPUT_SVIDEO1, 1, | 211 | { CX18_CARD_INPUT_SVIDEO1, 1, |
@@ -211,27 +214,34 @@ static const struct cx18_card cx18_card_mpc718 = { | |||
211 | { CX18_CARD_INPUT_SVIDEO2, 2, | 214 | { CX18_CARD_INPUT_SVIDEO2, 2, |
212 | CX18_AV_SVIDEO_LUMA7 | CX18_AV_SVIDEO_CHROMA8 }, | 215 | CX18_AV_SVIDEO_LUMA7 | CX18_AV_SVIDEO_CHROMA8 }, |
213 | { CX18_CARD_INPUT_COMPOSITE2, 2, CX18_AV_COMPOSITE6 }, | 216 | { CX18_CARD_INPUT_COMPOSITE2, 2, CX18_AV_COMPOSITE6 }, |
214 | { CX18_CARD_INPUT_COMPOSITE3, 2, CX18_AV_COMPOSITE3 }, | ||
215 | }, | 217 | }, |
216 | .audio_inputs = { | 218 | .audio_inputs = { |
217 | { CX18_CARD_INPUT_AUD_TUNER, CX18_AV_AUDIO5, 0 }, | 219 | { CX18_CARD_INPUT_AUD_TUNER, CX18_AV_AUDIO5, 0 }, |
218 | { CX18_CARD_INPUT_LINE_IN1, CX18_AV_AUDIO_SERIAL1, 0 }, | 220 | { CX18_CARD_INPUT_LINE_IN1, CX18_AV_AUDIO_SERIAL1, 1 }, |
219 | { CX18_CARD_INPUT_LINE_IN2, CX18_AV_AUDIO_SERIAL1, 0 }, | 221 | { CX18_CARD_INPUT_LINE_IN2, CX18_AV_AUDIO_SERIAL2, 1 }, |
220 | }, | 222 | }, |
221 | .radio_input = { CX18_CARD_INPUT_AUD_TUNER, CX18_AV_AUDIO_SERIAL1, 0 }, | ||
222 | .tuners = { | 223 | .tuners = { |
223 | /* XC3028 tuner */ | 224 | /* XC3028 tuner */ |
224 | { .std = V4L2_STD_ALL, .tuner = TUNER_XC2028 }, | 225 | { .std = V4L2_STD_ALL, .tuner = TUNER_XC2028 }, |
225 | }, | 226 | }, |
227 | /* FIXME - the FM radio is just a guess and driver doesn't use SIF */ | ||
228 | .radio_input = { CX18_CARD_INPUT_AUD_TUNER, CX18_AV_AUDIO5, 2 }, | ||
226 | .ddr = { | 229 | .ddr = { |
227 | /* Probably Samsung K4D263238G-VC33 memory */ | 230 | /* Hynix HY5DU283222B DDR RAM */ |
228 | .chip_config = 0x003, | 231 | .chip_config = 0x303, |
229 | .refresh = 0x30c, | 232 | .refresh = 0x3bd, |
230 | .timing1 = 0x23230b73, | 233 | .timing1 = 0x36320966, |
231 | .timing2 = 0x08, | 234 | .timing2 = 0x1f, |
232 | .tune_lane = 0, | 235 | .tune_lane = 0, |
233 | .initial_emrs = 2, | 236 | .initial_emrs = 2, |
234 | }, | 237 | }, |
238 | .gpio_init.initial_value = 0x1, | ||
239 | .gpio_init.direction = 0x3, | ||
240 | /* FIXME - these GPIO's are just guesses */ | ||
241 | .gpio_audio_input = { .mask = 0x3, | ||
242 | .tuner = 0x1, | ||
243 | .linein = 0x3, | ||
244 | .radio = 0x1 }, | ||
235 | .xceive_pin = 0, | 245 | .xceive_pin = 0, |
236 | .pci_list = cx18_pci_mpc718, | 246 | .pci_list = cx18_pci_mpc718, |
237 | .i2c = &cx18_i2c_std, | 247 | .i2c = &cx18_i2c_std, |
diff --git a/drivers/media/video/cx18/cx18-dvb.c b/drivers/media/video/cx18/cx18-dvb.c index 6ea3fe623ef..51a0c33b25b 100644 --- a/drivers/media/video/cx18/cx18-dvb.c +++ b/drivers/media/video/cx18/cx18-dvb.c | |||
@@ -30,6 +30,10 @@ | |||
30 | #include "s5h1409.h" | 30 | #include "s5h1409.h" |
31 | #include "mxl5005s.h" | 31 | #include "mxl5005s.h" |
32 | #include "zl10353.h" | 32 | #include "zl10353.h" |
33 | |||
34 | #include <linux/firmware.h> | ||
35 | #include "mt352.h" | ||
36 | #include "mt352_priv.h" | ||
33 | #include "tuner-xc2028.h" | 37 | #include "tuner-xc2028.h" |
34 | 38 | ||
35 | DVB_DEFINE_MOD_OPT_ADAPTER_NR(adapter_nr); | 39 | DVB_DEFINE_MOD_OPT_ADAPTER_NR(adapter_nr); |
@@ -38,6 +42,11 @@ DVB_DEFINE_MOD_OPT_ADAPTER_NR(adapter_nr); | |||
38 | #define CX18_CLOCK_ENABLE2 0xc71024 | 42 | #define CX18_CLOCK_ENABLE2 0xc71024 |
39 | #define CX18_DMUX_CLK_MASK 0x0080 | 43 | #define CX18_DMUX_CLK_MASK 0x0080 |
40 | 44 | ||
45 | /* | ||
46 | * CX18_CARD_HVR_1600_ESMT | ||
47 | * CX18_CARD_HVR_1600_SAMSUNG | ||
48 | */ | ||
49 | |||
41 | static struct mxl5005s_config hauppauge_hvr1600_tuner = { | 50 | static struct mxl5005s_config hauppauge_hvr1600_tuner = { |
42 | .i2c_address = 0xC6 >> 1, | 51 | .i2c_address = 0xC6 >> 1, |
43 | .if_freq = IF_FREQ_5380000HZ, | 52 | .if_freq = IF_FREQ_5380000HZ, |
@@ -65,6 +74,9 @@ static struct s5h1409_config hauppauge_hvr1600_config = { | |||
65 | .mpeg_timing = S5H1409_MPEGTIMING_CONTINOUS_NONINVERTING_CLOCK | 74 | .mpeg_timing = S5H1409_MPEGTIMING_CONTINOUS_NONINVERTING_CLOCK |
66 | }; | 75 | }; |
67 | 76 | ||
77 | /* | ||
78 | * CX18_CARD_LEADTEK_DVR3100H | ||
79 | */ | ||
68 | /* Information/confirmation of proper config values provided by Terry Wu */ | 80 | /* Information/confirmation of proper config values provided by Terry Wu */ |
69 | static struct zl10353_config leadtek_dvr3100h_demod = { | 81 | static struct zl10353_config leadtek_dvr3100h_demod = { |
70 | .demod_address = 0x1e >> 1, /* Datasheet suggested straps */ | 82 | .demod_address = 0x1e >> 1, /* Datasheet suggested straps */ |
@@ -74,6 +86,121 @@ static struct zl10353_config leadtek_dvr3100h_demod = { | |||
74 | .disable_i2c_gate_ctrl = 1, /* Disable the I2C gate */ | 86 | .disable_i2c_gate_ctrl = 1, /* Disable the I2C gate */ |
75 | }; | 87 | }; |
76 | 88 | ||
89 | /* | ||
90 | * CX18_CARD_YUAN_MPC718 | ||
91 | */ | ||
92 | /* | ||
93 | * Due to | ||
94 | * | ||
95 | * 1. an absence of information on how to prgram the MT352 | ||
96 | * 2. the Linux mt352 module pushing MT352 initialzation off onto us here | ||
97 | * | ||
98 | * We have to use an init sequence that *you* must extract from the Windows | ||
99 | * driver (yuanrap.sys) and which we load as a firmware. | ||
100 | * | ||
101 | * If someone can provide me with a Zarlink MT352 (Intel CE6352?) Design Manual | ||
102 | * with chip programming details, then I can remove this annoyance. | ||
103 | */ | ||
104 | static int yuan_mpc718_mt352_reqfw(struct cx18_stream *stream, | ||
105 | const struct firmware **fw) | ||
106 | { | ||
107 | struct cx18 *cx = stream->cx; | ||
108 | const char *fn = "dvb-cx18-mpc718-mt352.fw"; | ||
109 | int ret; | ||
110 | |||
111 | ret = request_firmware(fw, fn, &cx->pci_dev->dev); | ||
112 | if (ret) | ||
113 | CX18_ERR("Unable to open firmware file %s\n", fn); | ||
114 | else { | ||
115 | size_t sz = (*fw)->size; | ||
116 | if (sz < 2 || sz > 64 || (sz % 2) != 0) { | ||
117 | CX18_ERR("Firmware %s has a bad size: %lu bytes\n", | ||
118 | fn, (unsigned long) sz); | ||
119 | ret = -EILSEQ; | ||
120 | release_firmware(*fw); | ||
121 | *fw = NULL; | ||
122 | } | ||
123 | } | ||
124 | |||
125 | if (ret) { | ||
126 | CX18_ERR("The MPC718 board variant with the MT352 DVB-T" | ||
127 | "demodualtor will not work without it\n"); | ||
128 | CX18_ERR("Run 'linux/Documentation/dvb/get_dvb_firmware " | ||
129 | "mpc718' if you need the firmware\n"); | ||
130 | } | ||
131 | return ret; | ||
132 | } | ||
133 | |||
134 | static int yuan_mpc718_mt352_init(struct dvb_frontend *fe) | ||
135 | { | ||
136 | struct cx18_dvb *dvb = container_of(fe->dvb, | ||
137 | struct cx18_dvb, dvb_adapter); | ||
138 | struct cx18_stream *stream = container_of(dvb, struct cx18_stream, dvb); | ||
139 | const struct firmware *fw = NULL; | ||
140 | int ret; | ||
141 | int i; | ||
142 | u8 buf[3]; | ||
143 | |||
144 | ret = yuan_mpc718_mt352_reqfw(stream, &fw); | ||
145 | if (ret) | ||
146 | return ret; | ||
147 | |||
148 | /* Loop through all the register-value pairs in the firmware file */ | ||
149 | for (i = 0; i < fw->size; i += 2) { | ||
150 | buf[0] = fw->data[i]; | ||
151 | /* Intercept a few registers we want to set ourselves */ | ||
152 | switch (buf[0]) { | ||
153 | case TRL_NOMINAL_RATE_0: | ||
154 | /* Set our custom OFDM bandwidth in the case below */ | ||
155 | break; | ||
156 | case TRL_NOMINAL_RATE_1: | ||
157 | /* 6 MHz: 64/7 * 6/8 / 20.48 * 2^16 = 0x55b6.db6 */ | ||
158 | /* 7 MHz: 64/7 * 7/8 / 20.48 * 2^16 = 0x6400 */ | ||
159 | /* 8 MHz: 64/7 * 8/8 / 20.48 * 2^16 = 0x7249.249 */ | ||
160 | buf[1] = 0x72; | ||
161 | buf[2] = 0x49; | ||
162 | mt352_write(fe, buf, 3); | ||
163 | break; | ||
164 | case INPUT_FREQ_0: | ||
165 | /* Set our custom IF in the case below */ | ||
166 | break; | ||
167 | case INPUT_FREQ_1: | ||
168 | /* 4.56 MHz IF: (20.48 - 4.56)/20.48 * 2^14 = 0x31c0 */ | ||
169 | buf[1] = 0x31; | ||
170 | buf[2] = 0xc0; | ||
171 | mt352_write(fe, buf, 3); | ||
172 | break; | ||
173 | default: | ||
174 | /* Pass through the register-value pair from the fw */ | ||
175 | buf[1] = fw->data[i+1]; | ||
176 | mt352_write(fe, buf, 2); | ||
177 | break; | ||
178 | } | ||
179 | } | ||
180 | |||
181 | buf[0] = (u8) TUNER_GO; | ||
182 | buf[1] = 0x01; /* Go */ | ||
183 | mt352_write(fe, buf, 2); | ||
184 | release_firmware(fw); | ||
185 | return 0; | ||
186 | } | ||
187 | |||
188 | static struct mt352_config yuan_mpc718_mt352_demod = { | ||
189 | .demod_address = 0x1e >> 1, | ||
190 | .adc_clock = 20480, /* 20.480 MHz */ | ||
191 | .if2 = 4560, /* 4.560 MHz */ | ||
192 | .no_tuner = 1, /* XC3028 is not behind the gate */ | ||
193 | .demod_init = yuan_mpc718_mt352_init, | ||
194 | }; | ||
195 | |||
196 | static struct zl10353_config yuan_mpc718_zl10353_demod = { | ||
197 | .demod_address = 0x1e >> 1, /* Datasheet suggested straps */ | ||
198 | .if2 = 45600, /* 4.560 MHz IF from the XC3028 */ | ||
199 | .parallel_ts = 1, /* Not a serial TS */ | ||
200 | .no_tuner = 1, /* XC3028 is not behind the gate */ | ||
201 | .disable_i2c_gate_ctrl = 1, /* Disable the I2C gate */ | ||
202 | }; | ||
203 | |||
77 | static int dvb_register(struct cx18_stream *stream); | 204 | static int dvb_register(struct cx18_stream *stream); |
78 | 205 | ||
79 | /* Kernel DVB framework calls this when the feed needs to start. | 206 | /* Kernel DVB framework calls this when the feed needs to start. |
@@ -113,6 +240,7 @@ static int cx18_dvb_start_feed(struct dvb_demux_feed *feed) | |||
113 | break; | 240 | break; |
114 | 241 | ||
115 | case CX18_CARD_LEADTEK_DVR3100H: | 242 | case CX18_CARD_LEADTEK_DVR3100H: |
243 | case CX18_CARD_YUAN_MPC718: | ||
116 | default: | 244 | default: |
117 | /* Assumption - Parallel transport - Signalling | 245 | /* Assumption - Parallel transport - Signalling |
118 | * undefined or default. | 246 | * undefined or default. |
@@ -326,6 +454,38 @@ static int dvb_register(struct cx18_stream *stream) | |||
326 | fe->ops.tuner_ops.set_config(fe, &ctrl); | 454 | fe->ops.tuner_ops.set_config(fe, &ctrl); |
327 | } | 455 | } |
328 | break; | 456 | break; |
457 | case CX18_CARD_YUAN_MPC718: | ||
458 | /* | ||
459 | * TODO | ||
460 | * Apparently, these cards also could instead have a | ||
461 | * DiBcom demod supported by one of the db7000 drivers | ||
462 | */ | ||
463 | dvb->fe = dvb_attach(mt352_attach, | ||
464 | &yuan_mpc718_mt352_demod, | ||
465 | &cx->i2c_adap[1]); | ||
466 | if (dvb->fe == NULL) | ||
467 | dvb->fe = dvb_attach(zl10353_attach, | ||
468 | &yuan_mpc718_zl10353_demod, | ||
469 | &cx->i2c_adap[1]); | ||
470 | if (dvb->fe != NULL) { | ||
471 | struct dvb_frontend *fe; | ||
472 | struct xc2028_config cfg = { | ||
473 | .i2c_adap = &cx->i2c_adap[1], | ||
474 | .i2c_addr = 0xc2 >> 1, | ||
475 | .ctrl = NULL, | ||
476 | }; | ||
477 | static struct xc2028_ctrl ctrl = { | ||
478 | .fname = XC2028_DEFAULT_FIRMWARE, | ||
479 | .max_len = 64, | ||
480 | .demod = XC3028_FE_ZARLINK456, | ||
481 | .type = XC2028_AUTO, | ||
482 | }; | ||
483 | |||
484 | fe = dvb_attach(xc2028_attach, dvb->fe, &cfg); | ||
485 | if (fe != NULL && fe->ops.tuner_ops.set_config != NULL) | ||
486 | fe->ops.tuner_ops.set_config(fe, &ctrl); | ||
487 | } | ||
488 | break; | ||
329 | default: | 489 | default: |
330 | /* No Digital Tv Support */ | 490 | /* No Digital Tv Support */ |
331 | break; | 491 | break; |
diff --git a/drivers/media/video/cx23885/cx23885-dvb.c b/drivers/media/video/cx23885/cx23885-dvb.c index 48a975134ac..86ac529e62b 100644 --- a/drivers/media/video/cx23885/cx23885-dvb.c +++ b/drivers/media/video/cx23885/cx23885-dvb.c | |||
@@ -463,6 +463,30 @@ static struct xc5000_config mygica_x8506_xc5000_config = { | |||
463 | .if_khz = 5380, | 463 | .if_khz = 5380, |
464 | }; | 464 | }; |
465 | 465 | ||
466 | static int cx23885_dvb_set_frontend(struct dvb_frontend *fe, | ||
467 | struct dvb_frontend_parameters *param) | ||
468 | { | ||
469 | struct cx23885_tsport *port = fe->dvb->priv; | ||
470 | struct cx23885_dev *dev = port->dev; | ||
471 | |||
472 | switch (dev->board) { | ||
473 | case CX23885_BOARD_HAUPPAUGE_HVR1275: | ||
474 | switch (param->u.vsb.modulation) { | ||
475 | case VSB_8: | ||
476 | cx23885_gpio_clear(dev, GPIO_5); | ||
477 | break; | ||
478 | case QAM_64: | ||
479 | case QAM_256: | ||
480 | default: | ||
481 | cx23885_gpio_set(dev, GPIO_5); | ||
482 | break; | ||
483 | } | ||
484 | break; | ||
485 | } | ||
486 | return (port->set_frontend_save) ? | ||
487 | port->set_frontend_save(fe, param) : -ENODEV; | ||
488 | } | ||
489 | |||
466 | static int dvb_register(struct cx23885_tsport *port) | 490 | static int dvb_register(struct cx23885_tsport *port) |
467 | { | 491 | { |
468 | struct cx23885_dev *dev = port->dev; | 492 | struct cx23885_dev *dev = port->dev; |
@@ -502,6 +526,12 @@ static int dvb_register(struct cx23885_tsport *port) | |||
502 | 0x60, &dev->i2c_bus[1].i2c_adap, | 526 | 0x60, &dev->i2c_bus[1].i2c_adap, |
503 | &hauppauge_hvr127x_config); | 527 | &hauppauge_hvr127x_config); |
504 | } | 528 | } |
529 | |||
530 | /* FIXME: temporary hack */ | ||
531 | /* define bridge override to set_frontend */ | ||
532 | port->set_frontend_save = fe0->dvb.frontend->ops.set_frontend; | ||
533 | fe0->dvb.frontend->ops.set_frontend = cx23885_dvb_set_frontend; | ||
534 | |||
505 | break; | 535 | break; |
506 | case CX23885_BOARD_HAUPPAUGE_HVR1255: | 536 | case CX23885_BOARD_HAUPPAUGE_HVR1255: |
507 | i2c_bus = &dev->i2c_bus[0]; | 537 | i2c_bus = &dev->i2c_bus[0]; |
diff --git a/drivers/media/video/cx23885/cx23885.h b/drivers/media/video/cx23885/cx23885.h index 1a2ac518a3f..214a55e943b 100644 --- a/drivers/media/video/cx23885/cx23885.h +++ b/drivers/media/video/cx23885/cx23885.h | |||
@@ -288,6 +288,10 @@ struct cx23885_tsport { | |||
288 | /* Allow a single tsport to have multiple frontends */ | 288 | /* Allow a single tsport to have multiple frontends */ |
289 | u32 num_frontends; | 289 | u32 num_frontends; |
290 | void *port_priv; | 290 | void *port_priv; |
291 | |||
292 | /* FIXME: temporary hack */ | ||
293 | int (*set_frontend_save) (struct dvb_frontend *, | ||
294 | struct dvb_frontend_parameters *); | ||
291 | }; | 295 | }; |
292 | 296 | ||
293 | struct cx23885_dev { | 297 | struct cx23885_dev { |
diff --git a/drivers/media/video/em28xx/Kconfig b/drivers/media/video/em28xx/Kconfig index 16a5af30e9d..6524b493e03 100644 --- a/drivers/media/video/em28xx/Kconfig +++ b/drivers/media/video/em28xx/Kconfig | |||
@@ -8,6 +8,8 @@ config VIDEO_EM28XX | |||
8 | select VIDEO_SAA711X if VIDEO_HELPER_CHIPS_AUTO | 8 | select VIDEO_SAA711X if VIDEO_HELPER_CHIPS_AUTO |
9 | select VIDEO_TVP5150 if VIDEO_HELPER_CHIPS_AUTO | 9 | select VIDEO_TVP5150 if VIDEO_HELPER_CHIPS_AUTO |
10 | select VIDEO_MSP3400 if VIDEO_HELPER_CHIPS_AUTO | 10 | select VIDEO_MSP3400 if VIDEO_HELPER_CHIPS_AUTO |
11 | select VIDEO_MT9V011 if VIDEO_HELPER_CHIPS_AUTO | ||
12 | |||
11 | ---help--- | 13 | ---help--- |
12 | This is a video4linux driver for Empia 28xx based TV cards. | 14 | This is a video4linux driver for Empia 28xx based TV cards. |
13 | 15 | ||
diff --git a/drivers/media/video/em28xx/em28xx-cards.c b/drivers/media/video/em28xx/em28xx-cards.c index c43fdb9bc88..ebd24a25fb8 100644 --- a/drivers/media/video/em28xx/em28xx-cards.c +++ b/drivers/media/video/em28xx/em28xx-cards.c | |||
@@ -58,6 +58,8 @@ static unsigned int card[] = {[0 ... (EM28XX_MAXBOARDS - 1)] = UNSET }; | |||
58 | module_param_array(card, int, NULL, 0444); | 58 | module_param_array(card, int, NULL, 0444); |
59 | MODULE_PARM_DESC(card, "card type"); | 59 | MODULE_PARM_DESC(card, "card type"); |
60 | 60 | ||
61 | #define MT9V011_VERSION 0x8243 | ||
62 | |||
61 | /* Bitmask marking allocated devices from 0 to EM28XX_MAXBOARDS */ | 63 | /* Bitmask marking allocated devices from 0 to EM28XX_MAXBOARDS */ |
62 | static unsigned long em28xx_devused; | 64 | static unsigned long em28xx_devused; |
63 | 65 | ||
@@ -191,6 +193,13 @@ static struct em28xx_reg_seq terratec_av350_unmute_gpio[] = { | |||
191 | {EM28XX_R08_GPIO, 0xff, 0xff, 10}, | 193 | {EM28XX_R08_GPIO, 0xff, 0xff, 10}, |
192 | { -1, -1, -1, -1}, | 194 | { -1, -1, -1, -1}, |
193 | }; | 195 | }; |
196 | |||
197 | static struct em28xx_reg_seq silvercrest_reg_seq[] = { | ||
198 | {EM28XX_R08_GPIO, 0xff, 0xff, 10}, | ||
199 | {EM28XX_R08_GPIO, 0x01, 0xf7, 10}, | ||
200 | { -1, -1, -1, -1}, | ||
201 | }; | ||
202 | |||
194 | /* | 203 | /* |
195 | * Board definitions | 204 | * Board definitions |
196 | */ | 205 | */ |
@@ -438,6 +447,18 @@ struct em28xx_board em28xx_boards[] = { | |||
438 | .amux = EM28XX_AMUX_VIDEO, | 447 | .amux = EM28XX_AMUX_VIDEO, |
439 | } }, | 448 | } }, |
440 | }, | 449 | }, |
450 | [EM2820_BOARD_SILVERCREST_WEBCAM] = { | ||
451 | .name = "Silvercrest Webcam 1.3mpix", | ||
452 | .tuner_type = TUNER_ABSENT, | ||
453 | .is_27xx = 1, | ||
454 | .decoder = EM28XX_MT9V011, | ||
455 | .input = { { | ||
456 | .type = EM28XX_VMUX_COMPOSITE1, | ||
457 | .vmux = 0, | ||
458 | .amux = EM28XX_AMUX_VIDEO, | ||
459 | .gpio = silvercrest_reg_seq, | ||
460 | } }, | ||
461 | }, | ||
441 | [EM2821_BOARD_SUPERCOMP_USB_2] = { | 462 | [EM2821_BOARD_SUPERCOMP_USB_2] = { |
442 | .name = "Supercomp USB 2.0 TV", | 463 | .name = "Supercomp USB 2.0 TV", |
443 | .valid = EM28XX_BOARD_NOT_VALIDATED, | 464 | .valid = EM28XX_BOARD_NOT_VALIDATED, |
@@ -826,7 +847,7 @@ struct em28xx_board em28xx_boards[] = { | |||
826 | .tuner_gpio = default_tuner_gpio, | 847 | .tuner_gpio = default_tuner_gpio, |
827 | .decoder = EM28XX_TVP5150, | 848 | .decoder = EM28XX_TVP5150, |
828 | .has_dvb = 1, | 849 | .has_dvb = 1, |
829 | .dvb_gpio = default_analog, | 850 | .dvb_gpio = default_digital, |
830 | .input = { { | 851 | .input = { { |
831 | .type = EM28XX_VMUX_TELEVISION, | 852 | .type = EM28XX_VMUX_TELEVISION, |
832 | .vmux = TVP5150_COMPOSITE0, | 853 | .vmux = TVP5150_COMPOSITE0, |
@@ -1639,6 +1660,11 @@ static unsigned short tvp5150_addrs[] = { | |||
1639 | I2C_CLIENT_END | 1660 | I2C_CLIENT_END |
1640 | }; | 1661 | }; |
1641 | 1662 | ||
1663 | static unsigned short mt9v011_addrs[] = { | ||
1664 | 0xba >> 1, | ||
1665 | I2C_CLIENT_END | ||
1666 | }; | ||
1667 | |||
1642 | static unsigned short msp3400_addrs[] = { | 1668 | static unsigned short msp3400_addrs[] = { |
1643 | 0x80 >> 1, | 1669 | 0x80 >> 1, |
1644 | 0x88 >> 1, | 1670 | 0x88 >> 1, |
@@ -1678,6 +1704,46 @@ static inline void em28xx_set_model(struct em28xx *dev) | |||
1678 | EM28XX_I2C_FREQ_100_KHZ; | 1704 | EM28XX_I2C_FREQ_100_KHZ; |
1679 | } | 1705 | } |
1680 | 1706 | ||
1707 | /* HINT method: webcam I2C chips | ||
1708 | * | ||
1709 | * This method work for webcams with Micron sensors | ||
1710 | */ | ||
1711 | static int em28xx_hint_sensor(struct em28xx *dev) | ||
1712 | { | ||
1713 | int rc; | ||
1714 | char *sensor_name; | ||
1715 | unsigned char cmd; | ||
1716 | __be16 version_be; | ||
1717 | u16 version; | ||
1718 | |||
1719 | if (dev->model != EM2820_BOARD_UNKNOWN) | ||
1720 | return 0; | ||
1721 | |||
1722 | dev->i2c_client.addr = 0xba >> 1; | ||
1723 | cmd = 0; | ||
1724 | i2c_master_send(&dev->i2c_client, &cmd, 1); | ||
1725 | rc = i2c_master_recv(&dev->i2c_client, (char *)&version_be, 2); | ||
1726 | if (rc != 2) | ||
1727 | return -EINVAL; | ||
1728 | |||
1729 | version = be16_to_cpu(version_be); | ||
1730 | |||
1731 | switch (version) { | ||
1732 | case MT9V011_VERSION: | ||
1733 | dev->model = EM2820_BOARD_SILVERCREST_WEBCAM; | ||
1734 | sensor_name = "mt9v011"; | ||
1735 | break; | ||
1736 | default: | ||
1737 | printk("Unknown Sensor 0x%04x\n", be16_to_cpu(version)); | ||
1738 | return -EINVAL; | ||
1739 | } | ||
1740 | |||
1741 | em28xx_errdev("Sensor is %s, assuming that webcam is %s\n", | ||
1742 | sensor_name, em28xx_boards[dev->model].name); | ||
1743 | |||
1744 | return 0; | ||
1745 | } | ||
1746 | |||
1681 | /* Since em28xx_pre_card_setup() requires a proper dev->model, | 1747 | /* Since em28xx_pre_card_setup() requires a proper dev->model, |
1682 | * this won't work for boards with generic PCI IDs | 1748 | * this won't work for boards with generic PCI IDs |
1683 | */ | 1749 | */ |
@@ -1706,7 +1772,10 @@ void em28xx_pre_card_setup(struct em28xx *dev) | |||
1706 | em28xx_info("chip ID is em2750\n"); | 1772 | em28xx_info("chip ID is em2750\n"); |
1707 | break; | 1773 | break; |
1708 | case CHIP_ID_EM2820: | 1774 | case CHIP_ID_EM2820: |
1709 | em28xx_info("chip ID is em2820\n"); | 1775 | if (dev->board.is_27xx) |
1776 | em28xx_info("chip is em2710\n"); | ||
1777 | else | ||
1778 | em28xx_info("chip ID is em2820\n"); | ||
1710 | break; | 1779 | break; |
1711 | case CHIP_ID_EM2840: | 1780 | case CHIP_ID_EM2840: |
1712 | em28xx_info("chip ID is em2840\n"); | 1781 | em28xx_info("chip ID is em2840\n"); |
@@ -2158,6 +2227,10 @@ void em28xx_card_setup(struct em28xx *dev) | |||
2158 | before probing the i2c bus. */ | 2227 | before probing the i2c bus. */ |
2159 | em28xx_set_mode(dev, EM28XX_ANALOG_MODE); | 2228 | em28xx_set_mode(dev, EM28XX_ANALOG_MODE); |
2160 | break; | 2229 | break; |
2230 | case EM2820_BOARD_SILVERCREST_WEBCAM: | ||
2231 | /* FIXME: need to document the registers bellow */ | ||
2232 | em28xx_write_reg(dev, 0x0d, 0x42); | ||
2233 | em28xx_write_reg(dev, 0x13, 0x08); | ||
2161 | } | 2234 | } |
2162 | 2235 | ||
2163 | if (dev->board.has_snapshot_button) | 2236 | if (dev->board.has_snapshot_button) |
@@ -2189,6 +2262,10 @@ void em28xx_card_setup(struct em28xx *dev) | |||
2189 | v4l2_i2c_new_probed_subdev(&dev->v4l2_dev, &dev->i2c_adap, | 2262 | v4l2_i2c_new_probed_subdev(&dev->v4l2_dev, &dev->i2c_adap, |
2190 | "tvp5150", "tvp5150", tvp5150_addrs); | 2263 | "tvp5150", "tvp5150", tvp5150_addrs); |
2191 | 2264 | ||
2265 | if (dev->board.decoder == EM28XX_MT9V011) | ||
2266 | v4l2_i2c_new_probed_subdev(&dev->v4l2_dev, &dev->i2c_adap, | ||
2267 | "mt9v011", "mt9v011", mt9v011_addrs); | ||
2268 | |||
2192 | if (dev->board.adecoder == EM28XX_TVAUDIO) | 2269 | if (dev->board.adecoder == EM28XX_TVAUDIO) |
2193 | v4l2_i2c_new_subdev(&dev->v4l2_dev, &dev->i2c_adap, | 2270 | v4l2_i2c_new_subdev(&dev->v4l2_dev, &dev->i2c_adap, |
2194 | "tvaudio", "tvaudio", dev->board.tvaudio_addr); | 2271 | "tvaudio", "tvaudio", dev->board.tvaudio_addr); |
@@ -2333,6 +2410,8 @@ static int em28xx_init_dev(struct em28xx **devhandle, struct usb_device *udev, | |||
2333 | return errCode; | 2410 | return errCode; |
2334 | } | 2411 | } |
2335 | 2412 | ||
2413 | em28xx_hint_sensor(dev); | ||
2414 | |||
2336 | /* Do board specific init and eeprom reading */ | 2415 | /* Do board specific init and eeprom reading */ |
2337 | em28xx_card_setup(dev); | 2416 | em28xx_card_setup(dev); |
2338 | 2417 | ||
@@ -2573,6 +2652,7 @@ static int em28xx_usb_probe(struct usb_interface *interface, | |||
2573 | retval = em28xx_init_dev(&dev, udev, interface, nr); | 2652 | retval = em28xx_init_dev(&dev, udev, interface, nr); |
2574 | if (retval) { | 2653 | if (retval) { |
2575 | em28xx_devused &= ~(1<<dev->devno); | 2654 | em28xx_devused &= ~(1<<dev->devno); |
2655 | mutex_unlock(&dev->lock); | ||
2576 | kfree(dev); | 2656 | kfree(dev); |
2577 | goto err; | 2657 | goto err; |
2578 | } | 2658 | } |
diff --git a/drivers/media/video/em28xx/em28xx-core.c b/drivers/media/video/em28xx/em28xx-core.c index c8d7ce8fbd3..079ab4d563a 100644 --- a/drivers/media/video/em28xx/em28xx-core.c +++ b/drivers/media/video/em28xx/em28xx-core.c | |||
@@ -648,17 +648,28 @@ int em28xx_capture_start(struct em28xx *dev, int start) | |||
648 | int em28xx_set_outfmt(struct em28xx *dev) | 648 | int em28xx_set_outfmt(struct em28xx *dev) |
649 | { | 649 | { |
650 | int ret; | 650 | int ret; |
651 | int vinmode, vinctl, outfmt; | ||
652 | |||
653 | outfmt = dev->format->reg; | ||
654 | |||
655 | if (dev->board.is_27xx) { | ||
656 | vinmode = 0x0d; | ||
657 | vinctl = 0x00; | ||
658 | } else { | ||
659 | vinmode = 0x10; | ||
660 | vinctl = 0x11; | ||
661 | } | ||
651 | 662 | ||
652 | ret = em28xx_write_reg_bits(dev, EM28XX_R27_OUTFMT, | 663 | ret = em28xx_write_reg_bits(dev, EM28XX_R27_OUTFMT, |
653 | dev->format->reg | 0x20, 0x3f); | 664 | outfmt | 0x20, 0xff); |
654 | if (ret < 0) | 665 | if (ret < 0) |
655 | return ret; | 666 | return ret; |
656 | 667 | ||
657 | ret = em28xx_write_reg(dev, EM28XX_R10_VINMODE, 0x10); | 668 | ret = em28xx_write_reg(dev, EM28XX_R10_VINMODE, vinmode); |
658 | if (ret < 0) | 669 | if (ret < 0) |
659 | return ret; | 670 | return ret; |
660 | 671 | ||
661 | return em28xx_write_reg(dev, EM28XX_R11_VINCTRL, 0x11); | 672 | return em28xx_write_reg(dev, EM28XX_R11_VINCTRL, vinctl); |
662 | } | 673 | } |
663 | 674 | ||
664 | static int em28xx_accumulator_set(struct em28xx *dev, u8 xmin, u8 xmax, | 675 | static int em28xx_accumulator_set(struct em28xx *dev, u8 xmin, u8 xmax, |
@@ -695,13 +706,19 @@ static int em28xx_scaler_set(struct em28xx *dev, u16 h, u16 v) | |||
695 | { | 706 | { |
696 | u8 mode; | 707 | u8 mode; |
697 | /* the em2800 scaler only supports scaling down to 50% */ | 708 | /* the em2800 scaler only supports scaling down to 50% */ |
698 | if (dev->board.is_em2800) | 709 | |
710 | if (dev->board.is_27xx) { | ||
711 | /* FIXME: Don't use the scaler yet */ | ||
712 | mode = 0; | ||
713 | } else if (dev->board.is_em2800) { | ||
699 | mode = (v ? 0x20 : 0x00) | (h ? 0x10 : 0x00); | 714 | mode = (v ? 0x20 : 0x00) | (h ? 0x10 : 0x00); |
700 | else { | 715 | } else { |
701 | u8 buf[2]; | 716 | u8 buf[2]; |
717 | |||
702 | buf[0] = h; | 718 | buf[0] = h; |
703 | buf[1] = h >> 8; | 719 | buf[1] = h >> 8; |
704 | em28xx_write_regs(dev, EM28XX_R30_HSCALELOW, (char *)buf, 2); | 720 | em28xx_write_regs(dev, EM28XX_R30_HSCALELOW, (char *)buf, 2); |
721 | |||
705 | buf[0] = v; | 722 | buf[0] = v; |
706 | buf[1] = v >> 8; | 723 | buf[1] = v >> 8; |
707 | em28xx_write_regs(dev, EM28XX_R32_VSCALELOW, (char *)buf, 2); | 724 | em28xx_write_regs(dev, EM28XX_R32_VSCALELOW, (char *)buf, 2); |
@@ -720,8 +737,11 @@ int em28xx_resolution_set(struct em28xx *dev) | |||
720 | height = norm_maxh(dev) >> 1; | 737 | height = norm_maxh(dev) >> 1; |
721 | 738 | ||
722 | em28xx_set_outfmt(dev); | 739 | em28xx_set_outfmt(dev); |
740 | |||
741 | |||
723 | em28xx_accumulator_set(dev, 1, (width - 4) >> 2, 1, (height - 4) >> 2); | 742 | em28xx_accumulator_set(dev, 1, (width - 4) >> 2, 1, (height - 4) >> 2); |
724 | em28xx_capture_area_set(dev, 0, 0, width >> 2, height >> 2); | 743 | em28xx_capture_area_set(dev, 0, 0, width >> 2, height >> 2); |
744 | |||
725 | return em28xx_scaler_set(dev, dev->hscale, dev->vscale); | 745 | return em28xx_scaler_set(dev, dev->hscale, dev->vscale); |
726 | } | 746 | } |
727 | 747 | ||
diff --git a/drivers/media/video/em28xx/em28xx-dvb.c b/drivers/media/video/em28xx/em28xx-dvb.c index e7b47c8da8f..3da97c32b8f 100644 --- a/drivers/media/video/em28xx/em28xx-dvb.c +++ b/drivers/media/video/em28xx/em28xx-dvb.c | |||
@@ -243,6 +243,14 @@ static struct s5h1409_config em28xx_s5h1409_with_xc3028 = { | |||
243 | .mpeg_timing = S5H1409_MPEGTIMING_CONTINOUS_NONINVERTING_CLOCK | 243 | .mpeg_timing = S5H1409_MPEGTIMING_CONTINOUS_NONINVERTING_CLOCK |
244 | }; | 244 | }; |
245 | 245 | ||
246 | static struct zl10353_config em28xx_terratec_xs_zl10353_xc3028 = { | ||
247 | .demod_address = (0x1e >> 1), | ||
248 | .no_tuner = 1, | ||
249 | .disable_i2c_gate_ctrl = 1, | ||
250 | .parallel_ts = 1, | ||
251 | .if2 = 45600, | ||
252 | }; | ||
253 | |||
246 | #ifdef EM28XX_DRX397XD_SUPPORT | 254 | #ifdef EM28XX_DRX397XD_SUPPORT |
247 | /* [TODO] djh - not sure yet what the device config needs to contain */ | 255 | /* [TODO] djh - not sure yet what the device config needs to contain */ |
248 | static struct drx397xD_config em28xx_drx397xD_with_xc3028 = { | 256 | static struct drx397xD_config em28xx_drx397xD_with_xc3028 = { |
@@ -433,7 +441,6 @@ static int dvb_init(struct em28xx *dev) | |||
433 | } | 441 | } |
434 | break; | 442 | break; |
435 | case EM2880_BOARD_HAUPPAUGE_WINTV_HVR_900: | 443 | case EM2880_BOARD_HAUPPAUGE_WINTV_HVR_900: |
436 | case EM2880_BOARD_TERRATEC_HYBRID_XS: | ||
437 | case EM2880_BOARD_KWORLD_DVB_310U: | 444 | case EM2880_BOARD_KWORLD_DVB_310U: |
438 | case EM2880_BOARD_EMPIRE_DUAL_TV: | 445 | case EM2880_BOARD_EMPIRE_DUAL_TV: |
439 | dvb->frontend = dvb_attach(zl10353_attach, | 446 | dvb->frontend = dvb_attach(zl10353_attach, |
@@ -444,6 +451,25 @@ static int dvb_init(struct em28xx *dev) | |||
444 | goto out_free; | 451 | goto out_free; |
445 | } | 452 | } |
446 | break; | 453 | break; |
454 | case EM2880_BOARD_TERRATEC_HYBRID_XS: | ||
455 | dvb->frontend = dvb_attach(zl10353_attach, | ||
456 | &em28xx_terratec_xs_zl10353_xc3028, | ||
457 | &dev->i2c_adap); | ||
458 | if (dvb->frontend == NULL) { | ||
459 | /* This board could have either a zl10353 or a mt352. | ||
460 | If the chip id isn't for zl10353, try mt352 */ | ||
461 | |||
462 | /* FIXME: make support for mt352 work */ | ||
463 | printk(KERN_ERR "version of this board with mt352 not " | ||
464 | "currently supported\n"); | ||
465 | result = -EINVAL; | ||
466 | goto out_free; | ||
467 | } | ||
468 | if (attach_xc3028(0x61, dev) < 0) { | ||
469 | result = -EINVAL; | ||
470 | goto out_free; | ||
471 | } | ||
472 | break; | ||
447 | case EM2883_BOARD_KWORLD_HYBRID_330U: | 473 | case EM2883_BOARD_KWORLD_HYBRID_330U: |
448 | case EM2882_BOARD_EVGA_INDTUBE: | 474 | case EM2882_BOARD_EVGA_INDTUBE: |
449 | dvb->frontend = dvb_attach(s5h1409_attach, | 475 | dvb->frontend = dvb_attach(s5h1409_attach, |
diff --git a/drivers/media/video/em28xx/em28xx-i2c.c b/drivers/media/video/em28xx/em28xx-i2c.c index 2c86fcf089f..27e33a287df 100644 --- a/drivers/media/video/em28xx/em28xx-i2c.c +++ b/drivers/media/video/em28xx/em28xx-i2c.c | |||
@@ -483,7 +483,7 @@ static char *i2c_devs[128] = { | |||
483 | [0xa0 >> 1] = "eeprom", | 483 | [0xa0 >> 1] = "eeprom", |
484 | [0xb0 >> 1] = "tda9874", | 484 | [0xb0 >> 1] = "tda9874", |
485 | [0xb8 >> 1] = "tvp5150a", | 485 | [0xb8 >> 1] = "tvp5150a", |
486 | [0xba >> 1] = "tvp5150a", | 486 | [0xba >> 1] = "webcam sensor or tvp5150a", |
487 | [0xc0 >> 1] = "tuner (analog)", | 487 | [0xc0 >> 1] = "tuner (analog)", |
488 | [0xc2 >> 1] = "tuner (analog)", | 488 | [0xc2 >> 1] = "tuner (analog)", |
489 | [0xc4 >> 1] = "tuner (analog)", | 489 | [0xc4 >> 1] = "tuner (analog)", |
diff --git a/drivers/media/video/em28xx/em28xx-video.c b/drivers/media/video/em28xx/em28xx-video.c index 8fe1beecfff..14316c91217 100644 --- a/drivers/media/video/em28xx/em28xx-video.c +++ b/drivers/media/video/em28xx/em28xx-video.c | |||
@@ -90,10 +90,35 @@ MODULE_PARM_DESC(video_debug, "enable debug messages [video]"); | |||
90 | /* supported video standards */ | 90 | /* supported video standards */ |
91 | static struct em28xx_fmt format[] = { | 91 | static struct em28xx_fmt format[] = { |
92 | { | 92 | { |
93 | .name = "16bpp YUY2, 4:2:2, packed", | 93 | .name = "16 bpp YUY2, 4:2:2, packed", |
94 | .fourcc = V4L2_PIX_FMT_YUYV, | 94 | .fourcc = V4L2_PIX_FMT_YUYV, |
95 | .depth = 16, | 95 | .depth = 16, |
96 | .reg = EM28XX_OUTFMT_YUV422_Y0UY1V, | 96 | .reg = EM28XX_OUTFMT_YUV422_Y0UY1V, |
97 | }, { | ||
98 | .name = "16 bpp RGB 565, LE", | ||
99 | .fourcc = V4L2_PIX_FMT_RGB565, | ||
100 | .depth = 16, | ||
101 | .reg = EM28XX_OUTFMT_RGB_16_656, | ||
102 | }, { | ||
103 | .name = "8 bpp Bayer BGBG..GRGR", | ||
104 | .fourcc = V4L2_PIX_FMT_SBGGR8, | ||
105 | .depth = 8, | ||
106 | .reg = EM28XX_OUTFMT_RGB_8_BGBG, | ||
107 | }, { | ||
108 | .name = "8 bpp Bayer GRGR..BGBG", | ||
109 | .fourcc = V4L2_PIX_FMT_SGRBG8, | ||
110 | .depth = 8, | ||
111 | .reg = EM28XX_OUTFMT_RGB_8_GRGR, | ||
112 | }, { | ||
113 | .name = "8 bpp Bayer GBGB..RGRG", | ||
114 | .fourcc = V4L2_PIX_FMT_SGBRG8, | ||
115 | .depth = 8, | ||
116 | .reg = EM28XX_OUTFMT_RGB_8_GBGB, | ||
117 | }, { | ||
118 | .name = "12 bpp YUV411", | ||
119 | .fourcc = V4L2_PIX_FMT_YUV411P, | ||
120 | .depth = 12, | ||
121 | .reg = EM28XX_OUTFMT_YUV411, | ||
97 | }, | 122 | }, |
98 | }; | 123 | }; |
99 | 124 | ||
@@ -701,7 +726,11 @@ static int vidioc_try_fmt_vid_cap(struct file *file, void *priv, | |||
701 | return -EINVAL; | 726 | return -EINVAL; |
702 | } | 727 | } |
703 | 728 | ||
704 | if (dev->board.is_em2800) { | 729 | if (dev->board.is_27xx) { |
730 | /* FIXME: This is the only supported fmt */ | ||
731 | width = 640; | ||
732 | height = 480; | ||
733 | } else if (dev->board.is_em2800) { | ||
705 | /* the em2800 can only scale down to 50% */ | 734 | /* the em2800 can only scale down to 50% */ |
706 | height = height > (3 * maxh / 4) ? maxh : maxh / 2; | 735 | height = height > (3 * maxh / 4) ? maxh : maxh / 2; |
707 | width = width > (3 * maxw / 4) ? maxw : maxw / 2; | 736 | width = width > (3 * maxw / 4) ? maxw : maxw / 2; |
@@ -733,13 +762,40 @@ static int vidioc_try_fmt_vid_cap(struct file *file, void *priv, | |||
733 | return 0; | 762 | return 0; |
734 | } | 763 | } |
735 | 764 | ||
765 | static int em28xx_set_video_format(struct em28xx *dev, unsigned int fourcc, | ||
766 | unsigned width, unsigned height) | ||
767 | { | ||
768 | struct em28xx_fmt *fmt; | ||
769 | |||
770 | /* FIXME: This is the only supported fmt */ | ||
771 | if (dev->board.is_27xx) { | ||
772 | width = 640; | ||
773 | height = 480; | ||
774 | } | ||
775 | |||
776 | fmt = format_by_fourcc(fourcc); | ||
777 | if (!fmt) | ||
778 | return -EINVAL; | ||
779 | |||
780 | dev->format = fmt; | ||
781 | dev->width = width; | ||
782 | dev->height = height; | ||
783 | |||
784 | /* set new image size */ | ||
785 | get_scale(dev, dev->width, dev->height, &dev->hscale, &dev->vscale); | ||
786 | |||
787 | em28xx_set_alternate(dev); | ||
788 | em28xx_resolution_set(dev); | ||
789 | |||
790 | return 0; | ||
791 | } | ||
792 | |||
736 | static int vidioc_s_fmt_vid_cap(struct file *file, void *priv, | 793 | static int vidioc_s_fmt_vid_cap(struct file *file, void *priv, |
737 | struct v4l2_format *f) | 794 | struct v4l2_format *f) |
738 | { | 795 | { |
739 | struct em28xx_fh *fh = priv; | 796 | struct em28xx_fh *fh = priv; |
740 | struct em28xx *dev = fh->dev; | 797 | struct em28xx *dev = fh->dev; |
741 | int rc; | 798 | int rc; |
742 | struct em28xx_fmt *fmt; | ||
743 | 799 | ||
744 | rc = check_dev(dev); | 800 | rc = check_dev(dev); |
745 | if (rc < 0) | 801 | if (rc < 0) |
@@ -749,12 +805,6 @@ static int vidioc_s_fmt_vid_cap(struct file *file, void *priv, | |||
749 | 805 | ||
750 | vidioc_try_fmt_vid_cap(file, priv, f); | 806 | vidioc_try_fmt_vid_cap(file, priv, f); |
751 | 807 | ||
752 | fmt = format_by_fourcc(f->fmt.pix.pixelformat); | ||
753 | if (!fmt) { | ||
754 | rc = -EINVAL; | ||
755 | goto out; | ||
756 | } | ||
757 | |||
758 | if (videobuf_queue_is_busy(&fh->vb_vidq)) { | 808 | if (videobuf_queue_is_busy(&fh->vb_vidq)) { |
759 | em28xx_errdev("%s queue busy\n", __func__); | 809 | em28xx_errdev("%s queue busy\n", __func__); |
760 | rc = -EBUSY; | 810 | rc = -EBUSY; |
@@ -767,16 +817,8 @@ static int vidioc_s_fmt_vid_cap(struct file *file, void *priv, | |||
767 | goto out; | 817 | goto out; |
768 | } | 818 | } |
769 | 819 | ||
770 | /* set new image size */ | 820 | rc = em28xx_set_video_format(dev, f->fmt.pix.pixelformat, |
771 | dev->width = f->fmt.pix.width; | 821 | f->fmt.pix.width, f->fmt.pix.height); |
772 | dev->height = f->fmt.pix.height; | ||
773 | dev->format = fmt; | ||
774 | get_scale(dev, dev->width, dev->height, &dev->hscale, &dev->vscale); | ||
775 | |||
776 | em28xx_set_alternate(dev); | ||
777 | em28xx_resolution_set(dev); | ||
778 | |||
779 | rc = 0; | ||
780 | 822 | ||
781 | out: | 823 | out: |
782 | mutex_unlock(&dev->lock); | 824 | mutex_unlock(&dev->lock); |
@@ -1616,11 +1658,6 @@ static int em28xx_v4l2_open(struct file *filp) | |||
1616 | filp->private_data = fh; | 1658 | filp->private_data = fh; |
1617 | 1659 | ||
1618 | if (fh->type == V4L2_BUF_TYPE_VIDEO_CAPTURE && dev->users == 0) { | 1660 | if (fh->type == V4L2_BUF_TYPE_VIDEO_CAPTURE && dev->users == 0) { |
1619 | dev->width = norm_maxw(dev); | ||
1620 | dev->height = norm_maxh(dev); | ||
1621 | dev->hscale = 0; | ||
1622 | dev->vscale = 0; | ||
1623 | |||
1624 | em28xx_set_mode(dev, EM28XX_ANALOG_MODE); | 1661 | em28xx_set_mode(dev, EM28XX_ANALOG_MODE); |
1625 | em28xx_set_alternate(dev); | 1662 | em28xx_set_alternate(dev); |
1626 | em28xx_resolution_set(dev); | 1663 | em28xx_resolution_set(dev); |
@@ -1962,15 +1999,14 @@ int em28xx_register_analog_devices(struct em28xx *dev) | |||
1962 | 1999 | ||
1963 | /* set default norm */ | 2000 | /* set default norm */ |
1964 | dev->norm = em28xx_video_template.current_norm; | 2001 | dev->norm = em28xx_video_template.current_norm; |
1965 | dev->width = norm_maxw(dev); | ||
1966 | dev->height = norm_maxh(dev); | ||
1967 | dev->interlaced = EM28XX_INTERLACED_DEFAULT; | 2002 | dev->interlaced = EM28XX_INTERLACED_DEFAULT; |
1968 | dev->hscale = 0; | ||
1969 | dev->vscale = 0; | ||
1970 | dev->ctl_input = 0; | 2003 | dev->ctl_input = 0; |
1971 | 2004 | ||
1972 | /* Analog specific initialization */ | 2005 | /* Analog specific initialization */ |
1973 | dev->format = &format[0]; | 2006 | dev->format = &format[0]; |
2007 | em28xx_set_video_format(dev, format[0].fourcc, | ||
2008 | norm_maxw(dev), norm_maxh(dev)); | ||
2009 | |||
1974 | video_mux(dev, dev->ctl_input); | 2010 | video_mux(dev, dev->ctl_input); |
1975 | 2011 | ||
1976 | /* Audio defaults */ | 2012 | /* Audio defaults */ |
diff --git a/drivers/media/video/em28xx/em28xx.h b/drivers/media/video/em28xx/em28xx.h index 813ce45c2f9..d90fef46376 100644 --- a/drivers/media/video/em28xx/em28xx.h +++ b/drivers/media/video/em28xx/em28xx.h | |||
@@ -107,6 +107,7 @@ | |||
107 | #define EM2860_BOARD_TERRATEC_AV350 68 | 107 | #define EM2860_BOARD_TERRATEC_AV350 68 |
108 | #define EM2882_BOARD_KWORLD_ATSC_315U 69 | 108 | #define EM2882_BOARD_KWORLD_ATSC_315U 69 |
109 | #define EM2882_BOARD_EVGA_INDTUBE 70 | 109 | #define EM2882_BOARD_EVGA_INDTUBE 70 |
110 | #define EM2820_BOARD_SILVERCREST_WEBCAM 71 | ||
110 | 111 | ||
111 | /* Limits minimum and default number of buffers */ | 112 | /* Limits minimum and default number of buffers */ |
112 | #define EM28XX_MIN_BUF 4 | 113 | #define EM28XX_MIN_BUF 4 |
@@ -360,6 +361,7 @@ enum em28xx_decoder { | |||
360 | EM28XX_NODECODER, | 361 | EM28XX_NODECODER, |
361 | EM28XX_TVP5150, | 362 | EM28XX_TVP5150, |
362 | EM28XX_SAA711X, | 363 | EM28XX_SAA711X, |
364 | EM28XX_MT9V011, | ||
363 | }; | 365 | }; |
364 | 366 | ||
365 | enum em28xx_adecoder { | 367 | enum em28xx_adecoder { |
@@ -388,6 +390,7 @@ struct em28xx_board { | |||
388 | unsigned int max_range_640_480:1; | 390 | unsigned int max_range_640_480:1; |
389 | unsigned int has_dvb:1; | 391 | unsigned int has_dvb:1; |
390 | unsigned int has_snapshot_button:1; | 392 | unsigned int has_snapshot_button:1; |
393 | unsigned int is_27xx:1; | ||
391 | unsigned int valid:1; | 394 | unsigned int valid:1; |
392 | 395 | ||
393 | unsigned char xclk, i2c_speed; | 396 | unsigned char xclk, i2c_speed; |
diff --git a/drivers/media/video/gspca/stv06xx/stv06xx.h b/drivers/media/video/gspca/stv06xx/stv06xx.h index 9df7137fe67..992ce530f13 100644 --- a/drivers/media/video/gspca/stv06xx/stv06xx.h +++ b/drivers/media/video/gspca/stv06xx/stv06xx.h | |||
@@ -36,10 +36,6 @@ | |||
36 | 36 | ||
37 | #define STV_ISOC_ENDPOINT_ADDR 0x81 | 37 | #define STV_ISOC_ENDPOINT_ADDR 0x81 |
38 | 38 | ||
39 | #ifndef V4L2_PIX_FMT_SGRBG8 | ||
40 | #define V4L2_PIX_FMT_SGRBG8 v4l2_fourcc('G', 'R', 'B', 'G') | ||
41 | #endif | ||
42 | |||
43 | #define STV_REG23 0x0423 | 39 | #define STV_REG23 0x0423 |
44 | 40 | ||
45 | /* Control registers of the STV0600 ASIC */ | 41 | /* Control registers of the STV0600 ASIC */ |
diff --git a/drivers/media/video/mt9v011.c b/drivers/media/video/mt9v011.c new file mode 100644 index 00000000000..1fe8fc9183a --- /dev/null +++ b/drivers/media/video/mt9v011.c | |||
@@ -0,0 +1,431 @@ | |||
1 | /* | ||
2 | * mt9v011 -Micron 1/4-Inch VGA Digital Image Sensor | ||
3 | * | ||
4 | * Copyright (c) 2009 Mauro Carvalho Chehab (mchehab@redhat.com) | ||
5 | * This code is placed under the terms of the GNU General Public License v2 | ||
6 | */ | ||
7 | |||
8 | #include <linux/i2c.h> | ||
9 | #include <linux/videodev2.h> | ||
10 | #include <linux/delay.h> | ||
11 | #include <media/v4l2-device.h> | ||
12 | #include "mt9v011.h" | ||
13 | #include <media/v4l2-i2c-drv.h> | ||
14 | #include <media/v4l2-chip-ident.h> | ||
15 | |||
16 | MODULE_DESCRIPTION("Micron mt9v011 sensor driver"); | ||
17 | MODULE_AUTHOR("Mauro Carvalho Chehab <mchehab@redhat.com>"); | ||
18 | MODULE_LICENSE("GPL"); | ||
19 | |||
20 | |||
21 | static int debug; | ||
22 | module_param(debug, int, 0); | ||
23 | MODULE_PARM_DESC(debug, "Debug level (0-2)"); | ||
24 | |||
25 | /* supported controls */ | ||
26 | static struct v4l2_queryctrl mt9v011_qctrl[] = { | ||
27 | { | ||
28 | .id = V4L2_CID_GAIN, | ||
29 | .type = V4L2_CTRL_TYPE_INTEGER, | ||
30 | .name = "Gain", | ||
31 | .minimum = 0, | ||
32 | .maximum = (1 << 10) - 1, | ||
33 | .step = 1, | ||
34 | .default_value = 0x0020, | ||
35 | .flags = 0, | ||
36 | }, { | ||
37 | .id = V4L2_CID_RED_BALANCE, | ||
38 | .type = V4L2_CTRL_TYPE_INTEGER, | ||
39 | .name = "Red Balance", | ||
40 | .minimum = -1 << 9, | ||
41 | .maximum = (1 << 9) - 1, | ||
42 | .step = 1, | ||
43 | .default_value = 0, | ||
44 | .flags = 0, | ||
45 | }, { | ||
46 | .id = V4L2_CID_BLUE_BALANCE, | ||
47 | .type = V4L2_CTRL_TYPE_INTEGER, | ||
48 | .name = "Blue Balance", | ||
49 | .minimum = -1 << 9, | ||
50 | .maximum = (1 << 9) - 1, | ||
51 | .step = 1, | ||
52 | .default_value = 0, | ||
53 | .flags = 0, | ||
54 | }, | ||
55 | }; | ||
56 | |||
57 | struct mt9v011 { | ||
58 | struct v4l2_subdev sd; | ||
59 | unsigned width, height; | ||
60 | |||
61 | u16 global_gain, red_bal, blue_bal; | ||
62 | }; | ||
63 | |||
64 | static inline struct mt9v011 *to_mt9v011(struct v4l2_subdev *sd) | ||
65 | { | ||
66 | return container_of(sd, struct mt9v011, sd); | ||
67 | } | ||
68 | |||
69 | static int mt9v011_read(struct v4l2_subdev *sd, unsigned char addr) | ||
70 | { | ||
71 | struct i2c_client *c = v4l2_get_subdevdata(sd); | ||
72 | __be16 buffer; | ||
73 | int rc, val; | ||
74 | |||
75 | rc = i2c_master_send(c, &addr, 1); | ||
76 | if (rc != 1) | ||
77 | v4l2_dbg(0, debug, sd, | ||
78 | "i2c i/o error: rc == %d (should be 1)\n", rc); | ||
79 | |||
80 | msleep(10); | ||
81 | |||
82 | rc = i2c_master_recv(c, (char *)&buffer, 2); | ||
83 | if (rc != 2) | ||
84 | v4l2_dbg(0, debug, sd, | ||
85 | "i2c i/o error: rc == %d (should be 2)\n", rc); | ||
86 | |||
87 | val = be16_to_cpu(buffer); | ||
88 | |||
89 | v4l2_dbg(2, debug, sd, "mt9v011: read 0x%02x = 0x%04x\n", addr, val); | ||
90 | |||
91 | return val; | ||
92 | } | ||
93 | |||
94 | static void mt9v011_write(struct v4l2_subdev *sd, unsigned char addr, | ||
95 | u16 value) | ||
96 | { | ||
97 | struct i2c_client *c = v4l2_get_subdevdata(sd); | ||
98 | unsigned char buffer[3]; | ||
99 | int rc; | ||
100 | |||
101 | buffer[0] = addr; | ||
102 | buffer[1] = value >> 8; | ||
103 | buffer[2] = value & 0xff; | ||
104 | |||
105 | v4l2_dbg(2, debug, sd, | ||
106 | "mt9v011: writing 0x%02x 0x%04x\n", buffer[0], value); | ||
107 | rc = i2c_master_send(c, buffer, 3); | ||
108 | if (rc != 3) | ||
109 | v4l2_dbg(0, debug, sd, | ||
110 | "i2c i/o error: rc == %d (should be 3)\n", rc); | ||
111 | } | ||
112 | |||
113 | |||
114 | struct i2c_reg_value { | ||
115 | unsigned char reg; | ||
116 | u16 value; | ||
117 | }; | ||
118 | |||
119 | /* | ||
120 | * Values used at the original driver | ||
121 | * Some values are marked as Reserved at the datasheet | ||
122 | */ | ||
123 | static const struct i2c_reg_value mt9v011_init_default[] = { | ||
124 | { R0D_MT9V011_RESET, 0x0001 }, | ||
125 | { R0D_MT9V011_RESET, 0x0000 }, | ||
126 | |||
127 | { R0C_MT9V011_SHUTTER_DELAY, 0x0000 }, | ||
128 | { R09_MT9V011_SHUTTER_WIDTH, 0x1fc }, | ||
129 | |||
130 | { R0A_MT9V011_CLK_SPEED, 0x0000 }, | ||
131 | { R1E_MT9V011_DIGITAL_ZOOM, 0x0000 }, | ||
132 | { R20_MT9V011_READ_MODE, 0x1000 }, | ||
133 | |||
134 | { R07_MT9V011_OUT_CTRL, 0x000a }, /* chip enable */ | ||
135 | }; | ||
136 | |||
137 | static void set_balance(struct v4l2_subdev *sd) | ||
138 | { | ||
139 | struct mt9v011 *core = to_mt9v011(sd); | ||
140 | u16 green1_gain, green2_gain, blue_gain, red_gain; | ||
141 | |||
142 | green1_gain = core->global_gain; | ||
143 | green2_gain = core->global_gain; | ||
144 | |||
145 | blue_gain = core->global_gain + | ||
146 | core->global_gain * core->blue_bal / (1 << 9); | ||
147 | |||
148 | red_gain = core->global_gain + | ||
149 | core->global_gain * core->blue_bal / (1 << 9); | ||
150 | |||
151 | mt9v011_write(sd, R2B_MT9V011_GREEN_1_GAIN, green1_gain); | ||
152 | mt9v011_write(sd, R2E_MT9V011_GREEN_2_GAIN, green1_gain); | ||
153 | mt9v011_write(sd, R2C_MT9V011_BLUE_GAIN, blue_gain); | ||
154 | mt9v011_write(sd, R2D_MT9V011_RED_GAIN, red_gain); | ||
155 | } | ||
156 | |||
157 | static void set_res(struct v4l2_subdev *sd) | ||
158 | { | ||
159 | struct mt9v011 *core = to_mt9v011(sd); | ||
160 | unsigned vstart, hstart; | ||
161 | |||
162 | /* | ||
163 | * The mt9v011 doesn't have scaling. So, in order to select the desired | ||
164 | * resolution, we're cropping at the middle of the sensor. | ||
165 | * hblank and vblank should be adjusted, in order to warrant that | ||
166 | * we'll preserve the line timings for 30 fps, no matter what resolution | ||
167 | * is selected. | ||
168 | * NOTE: datasheet says that width (and height) should be filled with | ||
169 | * width-1. However, this doesn't work, since one pixel per line will | ||
170 | * be missing. | ||
171 | */ | ||
172 | |||
173 | hstart = 14 + (640 - core->width) / 2; | ||
174 | mt9v011_write(sd, R02_MT9V011_COLSTART, hstart); | ||
175 | mt9v011_write(sd, R04_MT9V011_WIDTH, core->width); | ||
176 | mt9v011_write(sd, R05_MT9V011_HBLANK, 771 - core->width); | ||
177 | |||
178 | vstart = 8 + (640 - core->height) / 2; | ||
179 | mt9v011_write(sd, R01_MT9V011_ROWSTART, vstart); | ||
180 | mt9v011_write(sd, R03_MT9V011_HEIGHT, core->height); | ||
181 | mt9v011_write(sd, R06_MT9V011_VBLANK, 508 - core->height); | ||
182 | }; | ||
183 | |||
184 | static int mt9v011_reset(struct v4l2_subdev *sd, u32 val) | ||
185 | { | ||
186 | int i; | ||
187 | |||
188 | for (i = 0; i < ARRAY_SIZE(mt9v011_init_default); i++) | ||
189 | mt9v011_write(sd, mt9v011_init_default[i].reg, | ||
190 | mt9v011_init_default[i].value); | ||
191 | |||
192 | set_balance(sd); | ||
193 | set_res(sd); | ||
194 | |||
195 | return 0; | ||
196 | }; | ||
197 | |||
198 | static int mt9v011_g_ctrl(struct v4l2_subdev *sd, struct v4l2_control *ctrl) | ||
199 | { | ||
200 | struct mt9v011 *core = to_mt9v011(sd); | ||
201 | |||
202 | v4l2_dbg(1, debug, sd, "g_ctrl called\n"); | ||
203 | |||
204 | switch (ctrl->id) { | ||
205 | case V4L2_CID_GAIN: | ||
206 | ctrl->value = core->global_gain; | ||
207 | return 0; | ||
208 | case V4L2_CID_RED_BALANCE: | ||
209 | ctrl->value = core->red_bal; | ||
210 | return 0; | ||
211 | case V4L2_CID_BLUE_BALANCE: | ||
212 | ctrl->value = core->blue_bal; | ||
213 | return 0; | ||
214 | } | ||
215 | return -EINVAL; | ||
216 | } | ||
217 | |||
218 | static int mt9v011_s_ctrl(struct v4l2_subdev *sd, struct v4l2_control *ctrl) | ||
219 | { | ||
220 | struct mt9v011 *core = to_mt9v011(sd); | ||
221 | u8 i, n; | ||
222 | n = ARRAY_SIZE(mt9v011_qctrl); | ||
223 | |||
224 | for (i = 0; i < n; i++) { | ||
225 | if (ctrl->id != mt9v011_qctrl[i].id) | ||
226 | continue; | ||
227 | if (ctrl->value < mt9v011_qctrl[i].minimum || | ||
228 | ctrl->value > mt9v011_qctrl[i].maximum) | ||
229 | return -ERANGE; | ||
230 | v4l2_dbg(1, debug, sd, "s_ctrl: id=%d, value=%d\n", | ||
231 | ctrl->id, ctrl->value); | ||
232 | break; | ||
233 | } | ||
234 | |||
235 | switch (ctrl->id) { | ||
236 | case V4L2_CID_GAIN: | ||
237 | core->global_gain = ctrl->value; | ||
238 | break; | ||
239 | case V4L2_CID_RED_BALANCE: | ||
240 | core->red_bal = ctrl->value; | ||
241 | break; | ||
242 | case V4L2_CID_BLUE_BALANCE: | ||
243 | core->blue_bal = ctrl->value; | ||
244 | break; | ||
245 | default: | ||
246 | return -EINVAL; | ||
247 | } | ||
248 | |||
249 | set_balance(sd); | ||
250 | |||
251 | return 0; | ||
252 | } | ||
253 | |||
254 | static int mt9v011_enum_fmt(struct v4l2_subdev *sd, struct v4l2_fmtdesc *fmt) | ||
255 | { | ||
256 | if (fmt->index > 0) | ||
257 | return -EINVAL; | ||
258 | |||
259 | fmt->flags = 0; | ||
260 | strcpy(fmt->description, "8 bpp Bayer GRGR..BGBG"); | ||
261 | fmt->pixelformat = V4L2_PIX_FMT_SGRBG8; | ||
262 | |||
263 | return 0; | ||
264 | } | ||
265 | |||
266 | static int mt9v011_try_fmt(struct v4l2_subdev *sd, struct v4l2_format *fmt) | ||
267 | { | ||
268 | struct v4l2_pix_format *pix = &fmt->fmt.pix; | ||
269 | |||
270 | if (pix->pixelformat != V4L2_PIX_FMT_SGRBG8) | ||
271 | return -EINVAL; | ||
272 | |||
273 | v4l_bound_align_image(&pix->width, 48, 639, 1, | ||
274 | &pix->height, 32, 480, 1, 0); | ||
275 | |||
276 | return 0; | ||
277 | } | ||
278 | |||
279 | static int mt9v011_s_fmt(struct v4l2_subdev *sd, struct v4l2_format *fmt) | ||
280 | { | ||
281 | struct v4l2_pix_format *pix = &fmt->fmt.pix; | ||
282 | struct mt9v011 *core = to_mt9v011(sd); | ||
283 | int rc; | ||
284 | |||
285 | rc = mt9v011_try_fmt(sd, fmt); | ||
286 | if (rc < 0) | ||
287 | return -EINVAL; | ||
288 | |||
289 | core->width = pix->width; | ||
290 | core->height = pix->height; | ||
291 | |||
292 | set_res(sd); | ||
293 | |||
294 | return 0; | ||
295 | } | ||
296 | |||
297 | |||
298 | #ifdef CONFIG_VIDEO_ADV_DEBUG | ||
299 | static int mt9v011_g_register(struct v4l2_subdev *sd, | ||
300 | struct v4l2_dbg_register *reg) | ||
301 | { | ||
302 | struct i2c_client *client = v4l2_get_subdevdata(sd); | ||
303 | |||
304 | if (!v4l2_chip_match_i2c_client(client, ®->match)) | ||
305 | return -EINVAL; | ||
306 | if (!capable(CAP_SYS_ADMIN)) | ||
307 | return -EPERM; | ||
308 | |||
309 | reg->val = mt9v011_read(sd, reg->reg & 0xff); | ||
310 | reg->size = 2; | ||
311 | |||
312 | return 0; | ||
313 | } | ||
314 | |||
315 | static int mt9v011_s_register(struct v4l2_subdev *sd, | ||
316 | struct v4l2_dbg_register *reg) | ||
317 | { | ||
318 | struct i2c_client *client = v4l2_get_subdevdata(sd); | ||
319 | |||
320 | if (!v4l2_chip_match_i2c_client(client, ®->match)) | ||
321 | return -EINVAL; | ||
322 | if (!capable(CAP_SYS_ADMIN)) | ||
323 | return -EPERM; | ||
324 | |||
325 | mt9v011_write(sd, reg->reg & 0xff, reg->val & 0xffff); | ||
326 | |||
327 | return 0; | ||
328 | } | ||
329 | #endif | ||
330 | |||
331 | static int mt9v011_g_chip_ident(struct v4l2_subdev *sd, | ||
332 | struct v4l2_dbg_chip_ident *chip) | ||
333 | { | ||
334 | struct i2c_client *client = v4l2_get_subdevdata(sd); | ||
335 | |||
336 | return v4l2_chip_ident_i2c_client(client, chip, V4L2_IDENT_MT9V011, | ||
337 | MT9V011_VERSION); | ||
338 | } | ||
339 | |||
340 | static const struct v4l2_subdev_core_ops mt9v011_core_ops = { | ||
341 | .g_ctrl = mt9v011_g_ctrl, | ||
342 | .s_ctrl = mt9v011_s_ctrl, | ||
343 | .reset = mt9v011_reset, | ||
344 | .g_chip_ident = mt9v011_g_chip_ident, | ||
345 | #ifdef CONFIG_VIDEO_ADV_DEBUG | ||
346 | .g_register = mt9v011_g_register, | ||
347 | .s_register = mt9v011_s_register, | ||
348 | #endif | ||
349 | }; | ||
350 | |||
351 | static const struct v4l2_subdev_video_ops mt9v011_video_ops = { | ||
352 | .enum_fmt = mt9v011_enum_fmt, | ||
353 | .try_fmt = mt9v011_try_fmt, | ||
354 | .s_fmt = mt9v011_s_fmt, | ||
355 | }; | ||
356 | |||
357 | static const struct v4l2_subdev_ops mt9v011_ops = { | ||
358 | .core = &mt9v011_core_ops, | ||
359 | .video = &mt9v011_video_ops, | ||
360 | }; | ||
361 | |||
362 | |||
363 | /**************************************************************************** | ||
364 | I2C Client & Driver | ||
365 | ****************************************************************************/ | ||
366 | |||
367 | static int mt9v011_probe(struct i2c_client *c, | ||
368 | const struct i2c_device_id *id) | ||
369 | { | ||
370 | u16 version; | ||
371 | struct mt9v011 *core; | ||
372 | struct v4l2_subdev *sd; | ||
373 | |||
374 | /* Check if the adapter supports the needed features */ | ||
375 | if (!i2c_check_functionality(c->adapter, | ||
376 | I2C_FUNC_SMBUS_READ_BYTE | I2C_FUNC_SMBUS_WRITE_BYTE_DATA)) | ||
377 | return -EIO; | ||
378 | |||
379 | core = kzalloc(sizeof(struct mt9v011), GFP_KERNEL); | ||
380 | if (!core) | ||
381 | return -ENOMEM; | ||
382 | |||
383 | sd = &core->sd; | ||
384 | v4l2_i2c_subdev_init(sd, c, &mt9v011_ops); | ||
385 | |||
386 | /* Check if the sensor is really a MT9V011 */ | ||
387 | version = mt9v011_read(sd, R00_MT9V011_CHIP_VERSION); | ||
388 | if (version != MT9V011_VERSION) { | ||
389 | v4l2_info(sd, "*** unknown micron chip detected (0x%04x.\n", | ||
390 | version); | ||
391 | kfree(core); | ||
392 | return -EINVAL; | ||
393 | } | ||
394 | |||
395 | core->global_gain = 0x0024; | ||
396 | core->width = 640; | ||
397 | core->height = 480; | ||
398 | |||
399 | v4l_info(c, "chip found @ 0x%02x (%s)\n", | ||
400 | c->addr << 1, c->adapter->name); | ||
401 | |||
402 | return 0; | ||
403 | } | ||
404 | |||
405 | static int mt9v011_remove(struct i2c_client *c) | ||
406 | { | ||
407 | struct v4l2_subdev *sd = i2c_get_clientdata(c); | ||
408 | |||
409 | v4l2_dbg(1, debug, sd, | ||
410 | "mt9v011.c: removing mt9v011 adapter on address 0x%x\n", | ||
411 | c->addr << 1); | ||
412 | |||
413 | v4l2_device_unregister_subdev(sd); | ||
414 | kfree(to_mt9v011(sd)); | ||
415 | return 0; | ||
416 | } | ||
417 | |||
418 | /* ----------------------------------------------------------------------- */ | ||
419 | |||
420 | static const struct i2c_device_id mt9v011_id[] = { | ||
421 | { "mt9v011", 0 }, | ||
422 | { } | ||
423 | }; | ||
424 | MODULE_DEVICE_TABLE(i2c, mt9v011_id); | ||
425 | |||
426 | static struct v4l2_i2c_driver_data v4l2_i2c_data = { | ||
427 | .name = "mt9v011", | ||
428 | .probe = mt9v011_probe, | ||
429 | .remove = mt9v011_remove, | ||
430 | .id_table = mt9v011_id, | ||
431 | }; | ||
diff --git a/drivers/media/video/mt9v011.h b/drivers/media/video/mt9v011.h new file mode 100644 index 00000000000..9e443ee3055 --- /dev/null +++ b/drivers/media/video/mt9v011.h | |||
@@ -0,0 +1,35 @@ | |||
1 | /* | ||
2 | * mt9v011 -Micron 1/4-Inch VGA Digital Image Sensor | ||
3 | * | ||
4 | * Copyright (c) 2009 Mauro Carvalho Chehab (mchehab@redhat.com) | ||
5 | * This code is placed under the terms of the GNU General Public License v2 | ||
6 | */ | ||
7 | |||
8 | #ifndef MT9V011_H_ | ||
9 | #define MT9V011_H_ | ||
10 | |||
11 | #define R00_MT9V011_CHIP_VERSION 0x00 | ||
12 | #define R01_MT9V011_ROWSTART 0x01 | ||
13 | #define R02_MT9V011_COLSTART 0x02 | ||
14 | #define R03_MT9V011_HEIGHT 0x03 | ||
15 | #define R04_MT9V011_WIDTH 0x04 | ||
16 | #define R05_MT9V011_HBLANK 0x05 | ||
17 | #define R06_MT9V011_VBLANK 0x06 | ||
18 | #define R07_MT9V011_OUT_CTRL 0x07 | ||
19 | #define R09_MT9V011_SHUTTER_WIDTH 0x09 | ||
20 | #define R0A_MT9V011_CLK_SPEED 0x0a | ||
21 | #define R0B_MT9V011_RESTART 0x0b | ||
22 | #define R0C_MT9V011_SHUTTER_DELAY 0x0c | ||
23 | #define R0D_MT9V011_RESET 0x0d | ||
24 | #define R1E_MT9V011_DIGITAL_ZOOM 0x1e | ||
25 | #define R20_MT9V011_READ_MODE 0x20 | ||
26 | #define R2B_MT9V011_GREEN_1_GAIN 0x2b | ||
27 | #define R2C_MT9V011_BLUE_GAIN 0x2c | ||
28 | #define R2D_MT9V011_RED_GAIN 0x2d | ||
29 | #define R2E_MT9V011_GREEN_2_GAIN 0x2e | ||
30 | #define R35_MT9V011_GLOBAL_GAIN 0x35 | ||
31 | #define RF1_MT9V011_CHIP_ENABLE 0xf1 | ||
32 | |||
33 | #define MT9V011_VERSION 0x8243 | ||
34 | |||
35 | #endif | ||
diff --git a/drivers/media/video/soc_camera.c b/drivers/media/video/soc_camera.c index 16f595d4337..9f5ae816785 100644 --- a/drivers/media/video/soc_camera.c +++ b/drivers/media/video/soc_camera.c | |||
@@ -237,11 +237,11 @@ static int soc_camera_init_user_formats(struct soc_camera_device *icd) | |||
237 | return -ENOMEM; | 237 | return -ENOMEM; |
238 | 238 | ||
239 | icd->num_user_formats = fmts; | 239 | icd->num_user_formats = fmts; |
240 | fmts = 0; | ||
241 | 240 | ||
242 | dev_dbg(&icd->dev, "Found %d supported formats.\n", fmts); | 241 | dev_dbg(&icd->dev, "Found %d supported formats.\n", fmts); |
243 | 242 | ||
244 | /* Second pass - actually fill data formats */ | 243 | /* Second pass - actually fill data formats */ |
244 | fmts = 0; | ||
245 | for (i = 0; i < icd->num_formats; i++) | 245 | for (i = 0; i < icd->num_formats; i++) |
246 | if (!ici->ops->get_formats) { | 246 | if (!ici->ops->get_formats) { |
247 | icd->user_formats[i].host_fmt = icd->formats + i; | 247 | icd->user_formats[i].host_fmt = icd->formats + i; |
@@ -877,8 +877,11 @@ static int soc_camera_probe(struct device *dev) | |||
877 | (unsigned short)~0; | 877 | (unsigned short)~0; |
878 | 878 | ||
879 | ret = soc_camera_init_user_formats(icd); | 879 | ret = soc_camera_init_user_formats(icd); |
880 | if (ret < 0) | 880 | if (ret < 0) { |
881 | if (icd->ops->remove) | ||
882 | icd->ops->remove(icd); | ||
881 | goto eiufmt; | 883 | goto eiufmt; |
884 | } | ||
882 | 885 | ||
883 | icd->height = DEFAULT_HEIGHT; | 886 | icd->height = DEFAULT_HEIGHT; |
884 | icd->width = DEFAULT_WIDTH; | 887 | icd->width = DEFAULT_WIDTH; |
@@ -902,8 +905,10 @@ static int soc_camera_remove(struct device *dev) | |||
902 | { | 905 | { |
903 | struct soc_camera_device *icd = to_soc_camera_dev(dev); | 906 | struct soc_camera_device *icd = to_soc_camera_dev(dev); |
904 | 907 | ||
908 | mutex_lock(&icd->video_lock); | ||
905 | if (icd->ops->remove) | 909 | if (icd->ops->remove) |
906 | icd->ops->remove(icd); | 910 | icd->ops->remove(icd); |
911 | mutex_unlock(&icd->video_lock); | ||
907 | 912 | ||
908 | soc_camera_free_user_formats(icd); | 913 | soc_camera_free_user_formats(icd); |
909 | 914 | ||
@@ -1145,6 +1150,7 @@ evidallocd: | |||
1145 | } | 1150 | } |
1146 | EXPORT_SYMBOL(soc_camera_video_start); | 1151 | EXPORT_SYMBOL(soc_camera_video_start); |
1147 | 1152 | ||
1153 | /* Called from client .remove() methods with .video_lock held */ | ||
1148 | void soc_camera_video_stop(struct soc_camera_device *icd) | 1154 | void soc_camera_video_stop(struct soc_camera_device *icd) |
1149 | { | 1155 | { |
1150 | struct video_device *vdev = icd->vdev; | 1156 | struct video_device *vdev = icd->vdev; |
@@ -1154,10 +1160,8 @@ void soc_camera_video_stop(struct soc_camera_device *icd) | |||
1154 | if (!icd->dev.parent || !vdev) | 1160 | if (!icd->dev.parent || !vdev) |
1155 | return; | 1161 | return; |
1156 | 1162 | ||
1157 | mutex_lock(&icd->video_lock); | ||
1158 | video_unregister_device(vdev); | 1163 | video_unregister_device(vdev); |
1159 | icd->vdev = NULL; | 1164 | icd->vdev = NULL; |
1160 | mutex_unlock(&icd->video_lock); | ||
1161 | } | 1165 | } |
1162 | EXPORT_SYMBOL(soc_camera_video_stop); | 1166 | EXPORT_SYMBOL(soc_camera_video_stop); |
1163 | 1167 | ||
diff --git a/drivers/media/video/vivi.c b/drivers/media/video/vivi.c index cd726685846..7705fc6baf0 100644 --- a/drivers/media/video/vivi.c +++ b/drivers/media/video/vivi.c | |||
@@ -343,6 +343,53 @@ static struct bar_std bars[] = { | |||
343 | #define TO_U(r, g, b) \ | 343 | #define TO_U(r, g, b) \ |
344 | (((-9714 * r - 19070 * g + 28784 * b + 32768) >> 16) + 128) | 344 | (((-9714 * r - 19070 * g + 28784 * b + 32768) >> 16) + 128) |
345 | 345 | ||
346 | /* precalculate color bar values to speed up rendering */ | ||
347 | static void precalculate_bars(struct vivi_fh *fh) | ||
348 | { | ||
349 | struct vivi_dev *dev = fh->dev; | ||
350 | unsigned char r, g, b; | ||
351 | int k, is_yuv; | ||
352 | |||
353 | fh->input = dev->input; | ||
354 | |||
355 | for (k = 0; k < 8; k++) { | ||
356 | r = bars[fh->input].bar[k][0]; | ||
357 | g = bars[fh->input].bar[k][1]; | ||
358 | b = bars[fh->input].bar[k][2]; | ||
359 | is_yuv = 0; | ||
360 | |||
361 | switch (fh->fmt->fourcc) { | ||
362 | case V4L2_PIX_FMT_YUYV: | ||
363 | case V4L2_PIX_FMT_UYVY: | ||
364 | is_yuv = 1; | ||
365 | break; | ||
366 | case V4L2_PIX_FMT_RGB565: | ||
367 | case V4L2_PIX_FMT_RGB565X: | ||
368 | r >>= 3; | ||
369 | g >>= 2; | ||
370 | b >>= 3; | ||
371 | break; | ||
372 | case V4L2_PIX_FMT_RGB555: | ||
373 | case V4L2_PIX_FMT_RGB555X: | ||
374 | r >>= 3; | ||
375 | g >>= 3; | ||
376 | b >>= 3; | ||
377 | break; | ||
378 | } | ||
379 | |||
380 | if (is_yuv) { | ||
381 | fh->bars[k][0] = TO_Y(r, g, b); /* Luma */ | ||
382 | fh->bars[k][1] = TO_U(r, g, b); /* Cb */ | ||
383 | fh->bars[k][2] = TO_V(r, g, b); /* Cr */ | ||
384 | } else { | ||
385 | fh->bars[k][0] = r; | ||
386 | fh->bars[k][1] = g; | ||
387 | fh->bars[k][2] = b; | ||
388 | } | ||
389 | } | ||
390 | |||
391 | } | ||
392 | |||
346 | #define TSTAMP_MIN_Y 24 | 393 | #define TSTAMP_MIN_Y 24 |
347 | #define TSTAMP_MAX_Y (TSTAMP_MIN_Y + 15) | 394 | #define TSTAMP_MAX_Y (TSTAMP_MIN_Y + 15) |
348 | #define TSTAMP_INPUT_X 10 | 395 | #define TSTAMP_INPUT_X 10 |
@@ -755,6 +802,8 @@ buffer_prepare(struct videobuf_queue *vq, struct videobuf_buffer *vb, | |||
755 | buf->vb.height = fh->height; | 802 | buf->vb.height = fh->height; |
756 | buf->vb.field = field; | 803 | buf->vb.field = field; |
757 | 804 | ||
805 | precalculate_bars(fh); | ||
806 | |||
758 | if (VIDEOBUF_NEEDS_INIT == buf->vb.state) { | 807 | if (VIDEOBUF_NEEDS_INIT == buf->vb.state) { |
759 | rc = videobuf_iolock(vq, &buf->vb, NULL); | 808 | rc = videobuf_iolock(vq, &buf->vb, NULL); |
760 | if (rc < 0) | 809 | if (rc < 0) |
@@ -893,53 +942,6 @@ static int vidioc_try_fmt_vid_cap(struct file *file, void *priv, | |||
893 | return 0; | 942 | return 0; |
894 | } | 943 | } |
895 | 944 | ||
896 | /* precalculate color bar values to speed up rendering */ | ||
897 | static void precalculate_bars(struct vivi_fh *fh) | ||
898 | { | ||
899 | struct vivi_dev *dev = fh->dev; | ||
900 | unsigned char r, g, b; | ||
901 | int k, is_yuv; | ||
902 | |||
903 | fh->input = dev->input; | ||
904 | |||
905 | for (k = 0; k < 8; k++) { | ||
906 | r = bars[fh->input].bar[k][0]; | ||
907 | g = bars[fh->input].bar[k][1]; | ||
908 | b = bars[fh->input].bar[k][2]; | ||
909 | is_yuv = 0; | ||
910 | |||
911 | switch (fh->fmt->fourcc) { | ||
912 | case V4L2_PIX_FMT_YUYV: | ||
913 | case V4L2_PIX_FMT_UYVY: | ||
914 | is_yuv = 1; | ||
915 | break; | ||
916 | case V4L2_PIX_FMT_RGB565: | ||
917 | case V4L2_PIX_FMT_RGB565X: | ||
918 | r >>= 3; | ||
919 | g >>= 2; | ||
920 | b >>= 3; | ||
921 | break; | ||
922 | case V4L2_PIX_FMT_RGB555: | ||
923 | case V4L2_PIX_FMT_RGB555X: | ||
924 | r >>= 3; | ||
925 | g >>= 3; | ||
926 | b >>= 3; | ||
927 | break; | ||
928 | } | ||
929 | |||
930 | if (is_yuv) { | ||
931 | fh->bars[k][0] = TO_Y(r, g, b); /* Luma */ | ||
932 | fh->bars[k][1] = TO_U(r, g, b); /* Cb */ | ||
933 | fh->bars[k][2] = TO_V(r, g, b); /* Cr */ | ||
934 | } else { | ||
935 | fh->bars[k][0] = r; | ||
936 | fh->bars[k][1] = g; | ||
937 | fh->bars[k][2] = b; | ||
938 | } | ||
939 | } | ||
940 | |||
941 | } | ||
942 | |||
943 | /*FIXME: This seems to be generic enough to be at videodev2 */ | 945 | /*FIXME: This seems to be generic enough to be at videodev2 */ |
944 | static int vidioc_s_fmt_vid_cap(struct file *file, void *priv, | 946 | static int vidioc_s_fmt_vid_cap(struct file *file, void *priv, |
945 | struct v4l2_format *f) | 947 | struct v4l2_format *f) |
@@ -965,8 +967,6 @@ static int vidioc_s_fmt_vid_cap(struct file *file, void *priv, | |||
965 | fh->vb_vidq.field = f->fmt.pix.field; | 967 | fh->vb_vidq.field = f->fmt.pix.field; |
966 | fh->type = f->type; | 968 | fh->type = f->type; |
967 | 969 | ||
968 | precalculate_bars(fh); | ||
969 | |||
970 | ret = 0; | 970 | ret = 0; |
971 | out: | 971 | out: |
972 | mutex_unlock(&q->vb_lock); | 972 | mutex_unlock(&q->vb_lock); |
@@ -1357,6 +1357,7 @@ static int __init vivi_create_instance(int inst) | |||
1357 | goto unreg_dev; | 1357 | goto unreg_dev; |
1358 | 1358 | ||
1359 | *vfd = vivi_template; | 1359 | *vfd = vivi_template; |
1360 | vfd->debug = debug; | ||
1360 | 1361 | ||
1361 | ret = video_register_device(vfd, VFL_TYPE_GRABBER, video_nr); | 1362 | ret = video_register_device(vfd, VFL_TYPE_GRABBER, video_nr); |
1362 | if (ret < 0) | 1363 | if (ret < 0) |
diff --git a/drivers/mfd/dm355evm_msp.c b/drivers/mfd/dm355evm_msp.c index 7ac12cb0be4..5b6e58a3ba4 100644 --- a/drivers/mfd/dm355evm_msp.c +++ b/drivers/mfd/dm355evm_msp.c | |||
@@ -32,8 +32,7 @@ | |||
32 | * This driver was tested with firmware revision A4. | 32 | * This driver was tested with firmware revision A4. |
33 | */ | 33 | */ |
34 | 34 | ||
35 | #if defined(CONFIG_KEYBOARD_DM355EVM) \ | 35 | #if defined(CONFIG_INPUT_DM355EVM) || defined(CONFIG_INPUT_DM355EVM_MODULE) |
36 | || defined(CONFIG_KEYBOARD_DM355EVM_MODULE) | ||
37 | #define msp_has_keyboard() true | 36 | #define msp_has_keyboard() true |
38 | #else | 37 | #else |
39 | #define msp_has_keyboard() false | 38 | #define msp_has_keyboard() false |
diff --git a/drivers/misc/sgi-xp/xpnet.c b/drivers/misc/sgi-xp/xpnet.c index 8d1c60a3f0d..5d778ec8cdb 100644 --- a/drivers/misc/sgi-xp/xpnet.c +++ b/drivers/misc/sgi-xp/xpnet.c | |||
@@ -235,7 +235,7 @@ xpnet_receive(short partid, int channel, struct xpnet_message *msg) | |||
235 | skb->ip_summed = CHECKSUM_UNNECESSARY; | 235 | skb->ip_summed = CHECKSUM_UNNECESSARY; |
236 | 236 | ||
237 | dev_dbg(xpnet, "passing skb to network layer\n" | 237 | dev_dbg(xpnet, "passing skb to network layer\n" |
238 | KERN_DEBUG "\tskb->head=0x%p skb->data=0x%p skb->tail=0x%p " | 238 | "\tskb->head=0x%p skb->data=0x%p skb->tail=0x%p " |
239 | "skb->end=0x%p skb->len=%d\n", | 239 | "skb->end=0x%p skb->len=%d\n", |
240 | (void *)skb->head, (void *)skb->data, skb_tail_pointer(skb), | 240 | (void *)skb->head, (void *)skb->data, skb_tail_pointer(skb), |
241 | skb_end_pointer(skb), skb->len); | 241 | skb_end_pointer(skb), skb->len); |
@@ -399,7 +399,7 @@ xpnet_send(struct sk_buff *skb, struct xpnet_pending_msg *queued_msg, | |||
399 | msg->buf_pa = xp_pa((void *)start_addr); | 399 | msg->buf_pa = xp_pa((void *)start_addr); |
400 | 400 | ||
401 | dev_dbg(xpnet, "sending XPC message to %d:%d\n" | 401 | dev_dbg(xpnet, "sending XPC message to %d:%d\n" |
402 | KERN_DEBUG "msg->buf_pa=0x%lx, msg->size=%u, " | 402 | "msg->buf_pa=0x%lx, msg->size=%u, " |
403 | "msg->leadin_ignore=%u, msg->tailout_ignore=%u\n", | 403 | "msg->leadin_ignore=%u, msg->tailout_ignore=%u\n", |
404 | dest_partid, XPC_NET_CHANNEL, msg->buf_pa, msg->size, | 404 | dest_partid, XPC_NET_CHANNEL, msg->buf_pa, msg->size, |
405 | msg->leadin_ignore, msg->tailout_ignore); | 405 | msg->leadin_ignore, msg->tailout_ignore); |
diff --git a/drivers/net/a2065.c b/drivers/net/a2065.c index 85a18175730..08787f5a22a 100644 --- a/drivers/net/a2065.c +++ b/drivers/net/a2065.c | |||
@@ -569,16 +569,8 @@ static int lance_start_xmit (struct sk_buff *skb, struct net_device *dev) | |||
569 | 569 | ||
570 | #ifdef DEBUG_DRIVER | 570 | #ifdef DEBUG_DRIVER |
571 | /* dump the packet */ | 571 | /* dump the packet */ |
572 | { | 572 | print_hex_dump(KERN_DEBUG, "skb->data: ", DUMP_PREFIX_NONE, |
573 | int i; | 573 | 16, 1, skb->data, 64, true); |
574 | |||
575 | for (i = 0; i < 64; i++) { | ||
576 | if ((i % 16) == 0) | ||
577 | printk("\n" KERN_DEBUG); | ||
578 | printk ("%2.2x ", skb->data [i]); | ||
579 | } | ||
580 | printk("\n"); | ||
581 | } | ||
582 | #endif | 574 | #endif |
583 | entry = lp->tx_new & lp->tx_ring_mod_mask; | 575 | entry = lp->tx_new & lp->tx_ring_mod_mask; |
584 | ib->btx_ring [entry].length = (-skblen) | 0xf000; | 576 | ib->btx_ring [entry].length = (-skblen) | 0xf000; |
diff --git a/drivers/net/arcnet/arcnet.c b/drivers/net/arcnet/arcnet.c index d6d4ab3b430..7d227cdab9f 100644 --- a/drivers/net/arcnet/arcnet.c +++ b/drivers/net/arcnet/arcnet.c | |||
@@ -158,15 +158,12 @@ module_exit(arcnet_exit); | |||
158 | void arcnet_dump_skb(struct net_device *dev, | 158 | void arcnet_dump_skb(struct net_device *dev, |
159 | struct sk_buff *skb, char *desc) | 159 | struct sk_buff *skb, char *desc) |
160 | { | 160 | { |
161 | int i; | 161 | char hdr[32]; |
162 | 162 | ||
163 | printk(KERN_DEBUG "%6s: skb dump (%s) follows:", dev->name, desc); | 163 | /* dump the packet */ |
164 | for (i = 0; i < skb->len; i++) { | 164 | snprintf(hdr, sizeof(hdr), "%6s:%s skb->data:", dev->name, desc); |
165 | if (i % 16 == 0) | 165 | print_hex_dump(KERN_DEBUG, hdr, DUMP_PREFIX_OFFSET, |
166 | printk("\n" KERN_DEBUG "[%04X] ", i); | 166 | 16, 1, skb->data, skb->len, true); |
167 | printk("%02X ", ((u_char *) skb->data)[i]); | ||
168 | } | ||
169 | printk("\n"); | ||
170 | } | 167 | } |
171 | 168 | ||
172 | EXPORT_SYMBOL(arcnet_dump_skb); | 169 | EXPORT_SYMBOL(arcnet_dump_skb); |
@@ -184,6 +181,7 @@ static void arcnet_dump_packet(struct net_device *dev, int bufnum, | |||
184 | int i, length; | 181 | int i, length; |
185 | unsigned long flags = 0; | 182 | unsigned long flags = 0; |
186 | static uint8_t buf[512]; | 183 | static uint8_t buf[512]; |
184 | char hdr[32]; | ||
187 | 185 | ||
188 | /* hw.copy_from_card expects IRQ context so take the IRQ lock | 186 | /* hw.copy_from_card expects IRQ context so take the IRQ lock |
189 | to keep it single threaded */ | 187 | to keep it single threaded */ |
@@ -197,14 +195,10 @@ static void arcnet_dump_packet(struct net_device *dev, int bufnum, | |||
197 | /* if the offset[0] byte is nonzero, this is a 256-byte packet */ | 195 | /* if the offset[0] byte is nonzero, this is a 256-byte packet */ |
198 | length = (buf[2] ? 256 : 512); | 196 | length = (buf[2] ? 256 : 512); |
199 | 197 | ||
200 | printk(KERN_DEBUG "%6s: packet dump (%s) follows:", dev->name, desc); | 198 | /* dump the packet */ |
201 | for (i = 0; i < length; i++) { | 199 | snprintf(hdr, sizeof(hdr), "%6s:%s packet dump:", dev->name, desc); |
202 | if (i % 16 == 0) | 200 | print_hex_dump(KERN_DEBUG, hdr, DUMP_PREFIX_OFFSET, |
203 | printk("\n" KERN_DEBUG "[%04X] ", i); | 201 | 16, 1, buf, length, true); |
204 | printk("%02X ", buf[i]); | ||
205 | } | ||
206 | printk("\n"); | ||
207 | |||
208 | } | 202 | } |
209 | 203 | ||
210 | #else | 204 | #else |
diff --git a/drivers/net/benet/be_hw.h b/drivers/net/benet/be_hw.h index b02e805c1db..29c33c709c6 100644 --- a/drivers/net/benet/be_hw.h +++ b/drivers/net/benet/be_hw.h | |||
@@ -55,6 +55,10 @@ | |||
55 | #define MEMBAR_CTRL_INT_CTRL_PFUNC_MASK 0x7 /* bits 26 - 28 */ | 55 | #define MEMBAR_CTRL_INT_CTRL_PFUNC_MASK 0x7 /* bits 26 - 28 */ |
56 | #define MEMBAR_CTRL_INT_CTRL_PFUNC_SHIFT 26 | 56 | #define MEMBAR_CTRL_INT_CTRL_PFUNC_SHIFT 26 |
57 | 57 | ||
58 | /********* ISR0 Register offset **********/ | ||
59 | #define CEV_ISR0_OFFSET 0xC18 | ||
60 | #define CEV_ISR_SIZE 4 | ||
61 | |||
58 | /********* Event Q door bell *************/ | 62 | /********* Event Q door bell *************/ |
59 | #define DB_EQ_OFFSET DB_CQ_OFFSET | 63 | #define DB_EQ_OFFSET DB_CQ_OFFSET |
60 | #define DB_EQ_RING_ID_MASK 0x1FF /* bits 0 - 8 */ | 64 | #define DB_EQ_RING_ID_MASK 0x1FF /* bits 0 - 8 */ |
diff --git a/drivers/net/benet/be_main.c b/drivers/net/benet/be_main.c index 308eb09ca56..c43f6a11929 100644 --- a/drivers/net/benet/be_main.c +++ b/drivers/net/benet/be_main.c | |||
@@ -1274,15 +1274,17 @@ static irqreturn_t be_intx(int irq, void *dev) | |||
1274 | { | 1274 | { |
1275 | struct be_adapter *adapter = dev; | 1275 | struct be_adapter *adapter = dev; |
1276 | struct be_ctrl_info *ctrl = &adapter->ctrl; | 1276 | struct be_ctrl_info *ctrl = &adapter->ctrl; |
1277 | int rx, tx; | 1277 | int isr; |
1278 | 1278 | ||
1279 | tx = event_handle(ctrl, &adapter->tx_eq); | 1279 | isr = ioread32(ctrl->csr + CEV_ISR0_OFFSET + |
1280 | rx = event_handle(ctrl, &adapter->rx_eq); | 1280 | ctrl->pci_func * CEV_ISR_SIZE); |
1281 | if (!isr) | ||
1282 | return IRQ_NONE; | ||
1281 | 1283 | ||
1282 | if (rx || tx) | 1284 | event_handle(ctrl, &adapter->tx_eq); |
1283 | return IRQ_HANDLED; | 1285 | event_handle(ctrl, &adapter->rx_eq); |
1284 | else | 1286 | |
1285 | return IRQ_NONE; | 1287 | return IRQ_HANDLED; |
1286 | } | 1288 | } |
1287 | 1289 | ||
1288 | static irqreturn_t be_msix_rx(int irq, void *dev) | 1290 | static irqreturn_t be_msix_rx(int irq, void *dev) |
diff --git a/drivers/net/bmac.c b/drivers/net/bmac.c index 9578a3dfac0..206144f2470 100644 --- a/drivers/net/bmac.c +++ b/drivers/net/bmac.c | |||
@@ -428,10 +428,11 @@ bmac_init_phy(struct net_device *dev) | |||
428 | printk(KERN_DEBUG "phy registers:"); | 428 | printk(KERN_DEBUG "phy registers:"); |
429 | for (addr = 0; addr < 32; ++addr) { | 429 | for (addr = 0; addr < 32; ++addr) { |
430 | if ((addr & 7) == 0) | 430 | if ((addr & 7) == 0) |
431 | printk("\n" KERN_DEBUG); | 431 | printk(KERN_DEBUG); |
432 | printk(" %.4x", bmac_mif_read(dev, addr)); | 432 | printk(KERN_CONT " %.4x", bmac_mif_read(dev, addr)); |
433 | } | 433 | } |
434 | printk("\n"); | 434 | printk(KERN_CONT "\n"); |
435 | |||
435 | if (bp->is_bmac_plus) { | 436 | if (bp->is_bmac_plus) { |
436 | unsigned int capable, ctrl; | 437 | unsigned int capable, ctrl; |
437 | 438 | ||
diff --git a/drivers/net/bnx2x.h b/drivers/net/bnx2x.h index 8678457849f..85a737c5c23 100644 --- a/drivers/net/bnx2x.h +++ b/drivers/net/bnx2x.h | |||
@@ -902,6 +902,8 @@ struct bnx2x { | |||
902 | u16 rx_quick_cons_trip; | 902 | u16 rx_quick_cons_trip; |
903 | u16 rx_ticks_int; | 903 | u16 rx_ticks_int; |
904 | u16 rx_ticks; | 904 | u16 rx_ticks; |
905 | /* Maximal coalescing timeout in us */ | ||
906 | #define BNX2X_MAX_COALESCE_TOUT (0xf0*12) | ||
905 | 907 | ||
906 | u32 lin_cnt; | 908 | u32 lin_cnt; |
907 | 909 | ||
diff --git a/drivers/net/bnx2x_main.c b/drivers/net/bnx2x_main.c index 951714a7f90..c36a5f33739 100644 --- a/drivers/net/bnx2x_main.c +++ b/drivers/net/bnx2x_main.c | |||
@@ -484,8 +484,9 @@ static void bnx2x_fw_dump(struct bnx2x *bp) | |||
484 | 484 | ||
485 | mark = REG_RD(bp, MCP_REG_MCPR_SCRATCH + 0xf104); | 485 | mark = REG_RD(bp, MCP_REG_MCPR_SCRATCH + 0xf104); |
486 | mark = ((mark + 0x3) & ~0x3); | 486 | mark = ((mark + 0x3) & ~0x3); |
487 | printk(KERN_ERR PFX "begin fw dump (mark 0x%x)\n" KERN_ERR, mark); | 487 | printk(KERN_ERR PFX "begin fw dump (mark 0x%x)\n", mark); |
488 | 488 | ||
489 | printk(KERN_ERR PFX); | ||
489 | for (offset = mark - 0x08000000; offset <= 0xF900; offset += 0x8*4) { | 490 | for (offset = mark - 0x08000000; offset <= 0xF900; offset += 0x8*4) { |
490 | for (word = 0; word < 8; word++) | 491 | for (word = 0; word < 8; word++) |
491 | data[word] = htonl(REG_RD(bp, MCP_REG_MCPR_SCRATCH + | 492 | data[word] = htonl(REG_RD(bp, MCP_REG_MCPR_SCRATCH + |
@@ -500,7 +501,7 @@ static void bnx2x_fw_dump(struct bnx2x *bp) | |||
500 | data[8] = 0x0; | 501 | data[8] = 0x0; |
501 | printk(KERN_CONT "%s", (char *)data); | 502 | printk(KERN_CONT "%s", (char *)data); |
502 | } | 503 | } |
503 | printk("\n" KERN_ERR PFX "end of fw dump\n"); | 504 | printk(KERN_ERR PFX "end of fw dump\n"); |
504 | } | 505 | } |
505 | 506 | ||
506 | static void bnx2x_panic_dump(struct bnx2x *bp) | 507 | static void bnx2x_panic_dump(struct bnx2x *bp) |
@@ -4434,7 +4435,7 @@ static void bnx2x_update_coalesce(struct bnx2x *bp) | |||
4434 | REG_WR16(bp, BAR_USTRORM_INTMEM + | 4435 | REG_WR16(bp, BAR_USTRORM_INTMEM + |
4435 | USTORM_SB_HC_DISABLE_OFFSET(port, sb_id, | 4436 | USTORM_SB_HC_DISABLE_OFFSET(port, sb_id, |
4436 | U_SB_ETH_RX_CQ_INDEX), | 4437 | U_SB_ETH_RX_CQ_INDEX), |
4437 | bp->rx_ticks ? 0 : 1); | 4438 | (bp->rx_ticks/12) ? 0 : 1); |
4438 | 4439 | ||
4439 | /* HC_INDEX_C_ETH_TX_CQ_CONS */ | 4440 | /* HC_INDEX_C_ETH_TX_CQ_CONS */ |
4440 | REG_WR8(bp, BAR_CSTRORM_INTMEM + | 4441 | REG_WR8(bp, BAR_CSTRORM_INTMEM + |
@@ -4444,7 +4445,7 @@ static void bnx2x_update_coalesce(struct bnx2x *bp) | |||
4444 | REG_WR16(bp, BAR_CSTRORM_INTMEM + | 4445 | REG_WR16(bp, BAR_CSTRORM_INTMEM + |
4445 | CSTORM_SB_HC_DISABLE_OFFSET(port, sb_id, | 4446 | CSTORM_SB_HC_DISABLE_OFFSET(port, sb_id, |
4446 | C_SB_ETH_TX_CQ_INDEX), | 4447 | C_SB_ETH_TX_CQ_INDEX), |
4447 | bp->tx_ticks ? 0 : 1); | 4448 | (bp->tx_ticks/12) ? 0 : 1); |
4448 | } | 4449 | } |
4449 | } | 4450 | } |
4450 | 4451 | ||
@@ -7354,7 +7355,7 @@ static void bnx2x_reset_task(struct work_struct *work) | |||
7354 | #ifdef BNX2X_STOP_ON_ERROR | 7355 | #ifdef BNX2X_STOP_ON_ERROR |
7355 | BNX2X_ERR("reset task called but STOP_ON_ERROR defined" | 7356 | BNX2X_ERR("reset task called but STOP_ON_ERROR defined" |
7356 | " so reset not done to allow debug dump,\n" | 7357 | " so reset not done to allow debug dump,\n" |
7357 | KERN_ERR " you will need to reboot when done\n"); | 7358 | " you will need to reboot when done\n"); |
7358 | return; | 7359 | return; |
7359 | #endif | 7360 | #endif |
7360 | 7361 | ||
@@ -9069,12 +9070,12 @@ static int bnx2x_set_coalesce(struct net_device *dev, | |||
9069 | struct bnx2x *bp = netdev_priv(dev); | 9070 | struct bnx2x *bp = netdev_priv(dev); |
9070 | 9071 | ||
9071 | bp->rx_ticks = (u16) coal->rx_coalesce_usecs; | 9072 | bp->rx_ticks = (u16) coal->rx_coalesce_usecs; |
9072 | if (bp->rx_ticks > 3000) | 9073 | if (bp->rx_ticks > BNX2X_MAX_COALESCE_TOUT) |
9073 | bp->rx_ticks = 3000; | 9074 | bp->rx_ticks = BNX2X_MAX_COALESCE_TOUT; |
9074 | 9075 | ||
9075 | bp->tx_ticks = (u16) coal->tx_coalesce_usecs; | 9076 | bp->tx_ticks = (u16) coal->tx_coalesce_usecs; |
9076 | if (bp->tx_ticks > 0x3000) | 9077 | if (bp->tx_ticks > BNX2X_MAX_COALESCE_TOUT) |
9077 | bp->tx_ticks = 0x3000; | 9078 | bp->tx_ticks = BNX2X_MAX_COALESCE_TOUT; |
9078 | 9079 | ||
9079 | if (netif_running(dev)) | 9080 | if (netif_running(dev)) |
9080 | bnx2x_update_coalesce(bp); | 9081 | bnx2x_update_coalesce(bp); |
diff --git a/drivers/net/cxgb3/cxgb3_main.c b/drivers/net/cxgb3/cxgb3_main.c index 538dda4422d..fb5df5c6203 100644 --- a/drivers/net/cxgb3/cxgb3_main.c +++ b/drivers/net/cxgb3/cxgb3_main.c | |||
@@ -642,8 +642,7 @@ static int setup_sge_qsets(struct adapter *adap) | |||
642 | struct port_info *pi = netdev_priv(dev); | 642 | struct port_info *pi = netdev_priv(dev); |
643 | 643 | ||
644 | pi->qs = &adap->sge.qs[pi->first_qset]; | 644 | pi->qs = &adap->sge.qs[pi->first_qset]; |
645 | for (j = pi->first_qset; j < pi->first_qset + pi->nqsets; | 645 | for (j = 0; j < pi->nqsets; ++j, ++qset_idx) { |
646 | ++j, ++qset_idx) { | ||
647 | set_qset_lro(dev, qset_idx, pi->rx_offload & T3_LRO); | 646 | set_qset_lro(dev, qset_idx, pi->rx_offload & T3_LRO); |
648 | err = t3_sge_alloc_qset(adap, qset_idx, 1, | 647 | err = t3_sge_alloc_qset(adap, qset_idx, 1, |
649 | (adap->flags & USING_MSIX) ? qset_idx + 1 : | 648 | (adap->flags & USING_MSIX) ? qset_idx + 1 : |
diff --git a/drivers/net/davinci_emac.c b/drivers/net/davinci_emac.c index 2df8fb0af70..12fd446f989 100644 --- a/drivers/net/davinci_emac.c +++ b/drivers/net/davinci_emac.c | |||
@@ -1820,11 +1820,19 @@ static int emac_dev_setmac_addr(struct net_device *ndev, void *addr) | |||
1820 | struct device *emac_dev = &priv->ndev->dev; | 1820 | struct device *emac_dev = &priv->ndev->dev; |
1821 | struct sockaddr *sa = addr; | 1821 | struct sockaddr *sa = addr; |
1822 | 1822 | ||
1823 | if (!is_valid_ether_addr(sa->sa_data)) | ||
1824 | return -EINVAL; | ||
1825 | |||
1823 | /* Store mac addr in priv and rx channel and set it in EMAC hw */ | 1826 | /* Store mac addr in priv and rx channel and set it in EMAC hw */ |
1824 | memcpy(priv->mac_addr, sa->sa_data, ndev->addr_len); | 1827 | memcpy(priv->mac_addr, sa->sa_data, ndev->addr_len); |
1825 | memcpy(rxch->mac_addr, sa->sa_data, ndev->addr_len); | ||
1826 | memcpy(ndev->dev_addr, sa->sa_data, ndev->addr_len); | 1828 | memcpy(ndev->dev_addr, sa->sa_data, ndev->addr_len); |
1827 | emac_setmac(priv, EMAC_DEF_RX_CH, rxch->mac_addr); | 1829 | |
1830 | /* If the interface is down - rxch is NULL. */ | ||
1831 | /* MAC address is configured only after the interface is enabled. */ | ||
1832 | if (netif_running(ndev)) { | ||
1833 | memcpy(rxch->mac_addr, sa->sa_data, ndev->addr_len); | ||
1834 | emac_setmac(priv, EMAC_DEF_RX_CH, rxch->mac_addr); | ||
1835 | } | ||
1828 | 1836 | ||
1829 | if (netif_msg_drv(priv)) | 1837 | if (netif_msg_drv(priv)) |
1830 | dev_notice(emac_dev, "DaVinci EMAC: emac_dev_setmac_addr %pM\n", | 1838 | dev_notice(emac_dev, "DaVinci EMAC: emac_dev_setmac_addr %pM\n", |
diff --git a/drivers/net/dl2k.c b/drivers/net/dl2k.c index 895d72143ee..4b6a219fece 100644 --- a/drivers/net/dl2k.c +++ b/drivers/net/dl2k.c | |||
@@ -268,8 +268,9 @@ rio_probe1 (struct pci_dev *pdev, const struct pci_device_id *ent) | |||
268 | printk(KERN_INFO "tx_coalesce:\t%d packets\n", | 268 | printk(KERN_INFO "tx_coalesce:\t%d packets\n", |
269 | tx_coalesce); | 269 | tx_coalesce); |
270 | if (np->coalesce) | 270 | if (np->coalesce) |
271 | printk(KERN_INFO "rx_coalesce:\t%d packets\n" | 271 | printk(KERN_INFO |
272 | KERN_INFO "rx_timeout: \t%d ns\n", | 272 | "rx_coalesce:\t%d packets\n" |
273 | "rx_timeout: \t%d ns\n", | ||
273 | np->rx_coalesce, np->rx_timeout*640); | 274 | np->rx_coalesce, np->rx_timeout*640); |
274 | if (np->vlan) | 275 | if (np->vlan) |
275 | printk(KERN_INFO "vlan(id):\t%d\n", np->vlan); | 276 | printk(KERN_INFO "vlan(id):\t%d\n", np->vlan); |
@@ -1522,9 +1523,9 @@ mii_get_media (struct net_device *dev) | |||
1522 | printk (KERN_INFO "Operating at 10 Mbps, "); | 1523 | printk (KERN_INFO "Operating at 10 Mbps, "); |
1523 | } | 1524 | } |
1524 | if (bmcr & MII_BMCR_DUPLEX_MODE) { | 1525 | if (bmcr & MII_BMCR_DUPLEX_MODE) { |
1525 | printk ("Full duplex\n"); | 1526 | printk (KERN_CONT "Full duplex\n"); |
1526 | } else { | 1527 | } else { |
1527 | printk ("Half duplex\n"); | 1528 | printk (KERN_CONT "Half duplex\n"); |
1528 | } | 1529 | } |
1529 | } | 1530 | } |
1530 | if (np->tx_flow) | 1531 | if (np->tx_flow) |
@@ -1614,9 +1615,9 @@ mii_set_media (struct net_device *dev) | |||
1614 | } | 1615 | } |
1615 | if (np->full_duplex) { | 1616 | if (np->full_duplex) { |
1616 | bmcr |= MII_BMCR_DUPLEX_MODE; | 1617 | bmcr |= MII_BMCR_DUPLEX_MODE; |
1617 | printk ("Full duplex\n"); | 1618 | printk (KERN_CONT "Full duplex\n"); |
1618 | } else { | 1619 | } else { |
1619 | printk ("Half duplex\n"); | 1620 | printk (KERN_CONT "Half duplex\n"); |
1620 | } | 1621 | } |
1621 | #if 0 | 1622 | #if 0 |
1622 | /* Set 1000BaseT Master/Slave setting */ | 1623 | /* Set 1000BaseT Master/Slave setting */ |
@@ -1669,9 +1670,9 @@ mii_get_media_pcs (struct net_device *dev) | |||
1669 | __u16 bmcr = mii_read (dev, phy_addr, PCS_BMCR); | 1670 | __u16 bmcr = mii_read (dev, phy_addr, PCS_BMCR); |
1670 | printk (KERN_INFO "Operating at 1000 Mbps, "); | 1671 | printk (KERN_INFO "Operating at 1000 Mbps, "); |
1671 | if (bmcr & MII_BMCR_DUPLEX_MODE) { | 1672 | if (bmcr & MII_BMCR_DUPLEX_MODE) { |
1672 | printk ("Full duplex\n"); | 1673 | printk (KERN_CONT "Full duplex\n"); |
1673 | } else { | 1674 | } else { |
1674 | printk ("Half duplex\n"); | 1675 | printk (KERN_CONT "Half duplex\n"); |
1675 | } | 1676 | } |
1676 | } | 1677 | } |
1677 | if (np->tx_flow) | 1678 | if (np->tx_flow) |
diff --git a/drivers/net/e1000e/defines.h b/drivers/net/e1000e/defines.h index 8890c97e112..c0f185beb8b 100644 --- a/drivers/net/e1000e/defines.h +++ b/drivers/net/e1000e/defines.h | |||
@@ -238,6 +238,7 @@ | |||
238 | #define E1000_STATUS_SPEED_100 0x00000040 /* Speed 100Mb/s */ | 238 | #define E1000_STATUS_SPEED_100 0x00000040 /* Speed 100Mb/s */ |
239 | #define E1000_STATUS_SPEED_1000 0x00000080 /* Speed 1000Mb/s */ | 239 | #define E1000_STATUS_SPEED_1000 0x00000080 /* Speed 1000Mb/s */ |
240 | #define E1000_STATUS_LAN_INIT_DONE 0x00000200 /* Lan Init Completion by NVM */ | 240 | #define E1000_STATUS_LAN_INIT_DONE 0x00000200 /* Lan Init Completion by NVM */ |
241 | #define E1000_STATUS_PHYRA 0x00000400 /* PHY Reset Asserted */ | ||
241 | #define E1000_STATUS_GIO_MASTER_ENABLE 0x00080000 /* Status of Master requests. */ | 242 | #define E1000_STATUS_GIO_MASTER_ENABLE 0x00080000 /* Status of Master requests. */ |
242 | 243 | ||
243 | /* Constants used to interpret the masked PCI-X bus speed. */ | 244 | /* Constants used to interpret the masked PCI-X bus speed. */ |
@@ -575,6 +576,8 @@ | |||
575 | #define PHY_1000T_STATUS 0x0A /* 1000Base-T Status Reg */ | 576 | #define PHY_1000T_STATUS 0x0A /* 1000Base-T Status Reg */ |
576 | #define PHY_EXT_STATUS 0x0F /* Extended Status Reg */ | 577 | #define PHY_EXT_STATUS 0x0F /* Extended Status Reg */ |
577 | 578 | ||
579 | #define PHY_CONTROL_LB 0x4000 /* PHY Loopback bit */ | ||
580 | |||
578 | /* NVM Control */ | 581 | /* NVM Control */ |
579 | #define E1000_EECD_SK 0x00000001 /* NVM Clock */ | 582 | #define E1000_EECD_SK 0x00000001 /* NVM Clock */ |
580 | #define E1000_EECD_CS 0x00000002 /* NVM Chip Select */ | 583 | #define E1000_EECD_CS 0x00000002 /* NVM Chip Select */ |
diff --git a/drivers/net/e1000e/hw.h b/drivers/net/e1000e/hw.h index 163c1c0cfee..fd44d9f9076 100644 --- a/drivers/net/e1000e/hw.h +++ b/drivers/net/e1000e/hw.h | |||
@@ -215,6 +215,7 @@ enum e1e_registers { | |||
215 | E1000_SWSM = 0x05B50, /* SW Semaphore */ | 215 | E1000_SWSM = 0x05B50, /* SW Semaphore */ |
216 | E1000_FWSM = 0x05B54, /* FW Semaphore */ | 216 | E1000_FWSM = 0x05B54, /* FW Semaphore */ |
217 | E1000_SWSM2 = 0x05B58, /* Driver-only SW semaphore */ | 217 | E1000_SWSM2 = 0x05B58, /* Driver-only SW semaphore */ |
218 | E1000_CRC_OFFSET = 0x05F50, /* CRC Offset register */ | ||
218 | E1000_HICR = 0x08F00, /* Host Interface Control */ | 219 | E1000_HICR = 0x08F00, /* Host Interface Control */ |
219 | }; | 220 | }; |
220 | 221 | ||
@@ -302,6 +303,9 @@ enum e1e_registers { | |||
302 | #define E1000_KMRNCTRLSTA_REN 0x00200000 | 303 | #define E1000_KMRNCTRLSTA_REN 0x00200000 |
303 | #define E1000_KMRNCTRLSTA_DIAG_OFFSET 0x3 /* Kumeran Diagnostic */ | 304 | #define E1000_KMRNCTRLSTA_DIAG_OFFSET 0x3 /* Kumeran Diagnostic */ |
304 | #define E1000_KMRNCTRLSTA_DIAG_NELPBK 0x1000 /* Nearend Loopback mode */ | 305 | #define E1000_KMRNCTRLSTA_DIAG_NELPBK 0x1000 /* Nearend Loopback mode */ |
306 | #define E1000_KMRNCTRLSTA_K1_CONFIG 0x7 | ||
307 | #define E1000_KMRNCTRLSTA_K1_ENABLE 0x140E | ||
308 | #define E1000_KMRNCTRLSTA_K1_DISABLE 0x1400 | ||
305 | 309 | ||
306 | #define IFE_PHY_EXTENDED_STATUS_CONTROL 0x10 | 310 | #define IFE_PHY_EXTENDED_STATUS_CONTROL 0x10 |
307 | #define IFE_PHY_SPECIAL_CONTROL 0x11 /* 100BaseTx PHY Special Control */ | 311 | #define IFE_PHY_SPECIAL_CONTROL 0x11 /* 100BaseTx PHY Special Control */ |
diff --git a/drivers/net/e1000e/ich8lan.c b/drivers/net/e1000e/ich8lan.c index 9e23f50fb9c..d56c7473144 100644 --- a/drivers/net/e1000e/ich8lan.c +++ b/drivers/net/e1000e/ich8lan.c | |||
@@ -338,6 +338,7 @@ static s32 e1000_init_nvm_params_ich8lan(struct e1000_hw *hw) | |||
338 | { | 338 | { |
339 | struct e1000_nvm_info *nvm = &hw->nvm; | 339 | struct e1000_nvm_info *nvm = &hw->nvm; |
340 | struct e1000_dev_spec_ich8lan *dev_spec = &hw->dev_spec.ich8lan; | 340 | struct e1000_dev_spec_ich8lan *dev_spec = &hw->dev_spec.ich8lan; |
341 | union ich8_hws_flash_status hsfsts; | ||
341 | u32 gfpreg; | 342 | u32 gfpreg; |
342 | u32 sector_base_addr; | 343 | u32 sector_base_addr; |
343 | u32 sector_end_addr; | 344 | u32 sector_end_addr; |
@@ -374,6 +375,20 @@ static s32 e1000_init_nvm_params_ich8lan(struct e1000_hw *hw) | |||
374 | /* Adjust to word count */ | 375 | /* Adjust to word count */ |
375 | nvm->flash_bank_size /= sizeof(u16); | 376 | nvm->flash_bank_size /= sizeof(u16); |
376 | 377 | ||
378 | /* | ||
379 | * Make sure the flash bank size does not overwrite the 4k | ||
380 | * sector ranges. We may have 64k allotted to us but we only care | ||
381 | * about the first 2 4k sectors. Therefore, if we have anything less | ||
382 | * than 64k set in the HSFSTS register, we will reduce the bank size | ||
383 | * down to 4k and let the rest remain unused. If berasesz == 3, then | ||
384 | * we are working in 64k mode. Otherwise we are not. | ||
385 | */ | ||
386 | if (nvm->flash_bank_size > E1000_ICH8_SHADOW_RAM_WORDS) { | ||
387 | hsfsts.regval = er16flash(ICH_FLASH_HSFSTS); | ||
388 | if (hsfsts.hsf_status.berasesz != 3) | ||
389 | nvm->flash_bank_size = E1000_ICH8_SHADOW_RAM_WORDS; | ||
390 | } | ||
391 | |||
377 | nvm->word_size = E1000_ICH8_SHADOW_RAM_WORDS; | 392 | nvm->word_size = E1000_ICH8_SHADOW_RAM_WORDS; |
378 | 393 | ||
379 | /* Clear shadow ram */ | 394 | /* Clear shadow ram */ |
@@ -446,6 +461,95 @@ static s32 e1000_init_mac_params_ich8lan(struct e1000_adapter *adapter) | |||
446 | return 0; | 461 | return 0; |
447 | } | 462 | } |
448 | 463 | ||
464 | /** | ||
465 | * e1000_check_for_copper_link_ich8lan - Check for link (Copper) | ||
466 | * @hw: pointer to the HW structure | ||
467 | * | ||
468 | * Checks to see of the link status of the hardware has changed. If a | ||
469 | * change in link status has been detected, then we read the PHY registers | ||
470 | * to get the current speed/duplex if link exists. | ||
471 | **/ | ||
472 | static s32 e1000_check_for_copper_link_ich8lan(struct e1000_hw *hw) | ||
473 | { | ||
474 | struct e1000_mac_info *mac = &hw->mac; | ||
475 | s32 ret_val; | ||
476 | bool link; | ||
477 | |||
478 | /* | ||
479 | * We only want to go out to the PHY registers to see if Auto-Neg | ||
480 | * has completed and/or if our link status has changed. The | ||
481 | * get_link_status flag is set upon receiving a Link Status | ||
482 | * Change or Rx Sequence Error interrupt. | ||
483 | */ | ||
484 | if (!mac->get_link_status) { | ||
485 | ret_val = 0; | ||
486 | goto out; | ||
487 | } | ||
488 | |||
489 | if (hw->mac.type == e1000_pchlan) { | ||
490 | ret_val = e1000e_write_kmrn_reg(hw, | ||
491 | E1000_KMRNCTRLSTA_K1_CONFIG, | ||
492 | E1000_KMRNCTRLSTA_K1_ENABLE); | ||
493 | if (ret_val) | ||
494 | goto out; | ||
495 | } | ||
496 | |||
497 | /* | ||
498 | * First we want to see if the MII Status Register reports | ||
499 | * link. If so, then we want to get the current speed/duplex | ||
500 | * of the PHY. | ||
501 | */ | ||
502 | ret_val = e1000e_phy_has_link_generic(hw, 1, 0, &link); | ||
503 | if (ret_val) | ||
504 | goto out; | ||
505 | |||
506 | if (!link) | ||
507 | goto out; /* No link detected */ | ||
508 | |||
509 | mac->get_link_status = false; | ||
510 | |||
511 | if (hw->phy.type == e1000_phy_82578) { | ||
512 | ret_val = e1000_link_stall_workaround_hv(hw); | ||
513 | if (ret_val) | ||
514 | goto out; | ||
515 | } | ||
516 | |||
517 | /* | ||
518 | * Check if there was DownShift, must be checked | ||
519 | * immediately after link-up | ||
520 | */ | ||
521 | e1000e_check_downshift(hw); | ||
522 | |||
523 | /* | ||
524 | * If we are forcing speed/duplex, then we simply return since | ||
525 | * we have already determined whether we have link or not. | ||
526 | */ | ||
527 | if (!mac->autoneg) { | ||
528 | ret_val = -E1000_ERR_CONFIG; | ||
529 | goto out; | ||
530 | } | ||
531 | |||
532 | /* | ||
533 | * Auto-Neg is enabled. Auto Speed Detection takes care | ||
534 | * of MAC speed/duplex configuration. So we only need to | ||
535 | * configure Collision Distance in the MAC. | ||
536 | */ | ||
537 | e1000e_config_collision_dist(hw); | ||
538 | |||
539 | /* | ||
540 | * Configure Flow Control now that Auto-Neg has completed. | ||
541 | * First, we need to restore the desired flow control | ||
542 | * settings because we may have had to re-autoneg with a | ||
543 | * different link partner. | ||
544 | */ | ||
545 | ret_val = e1000e_config_fc_after_link_up(hw); | ||
546 | if (ret_val) | ||
547 | hw_dbg(hw, "Error configuring flow control\n"); | ||
548 | |||
549 | out: | ||
550 | return ret_val; | ||
551 | } | ||
552 | |||
449 | static s32 e1000_get_variants_ich8lan(struct e1000_adapter *adapter) | 553 | static s32 e1000_get_variants_ich8lan(struct e1000_adapter *adapter) |
450 | { | 554 | { |
451 | struct e1000_hw *hw = &adapter->hw; | 555 | struct e1000_hw *hw = &adapter->hw; |
@@ -694,6 +798,38 @@ static s32 e1000_hv_phy_workarounds_ich8lan(struct e1000_hw *hw) | |||
694 | } | 798 | } |
695 | 799 | ||
696 | /** | 800 | /** |
801 | * e1000_lan_init_done_ich8lan - Check for PHY config completion | ||
802 | * @hw: pointer to the HW structure | ||
803 | * | ||
804 | * Check the appropriate indication the MAC has finished configuring the | ||
805 | * PHY after a software reset. | ||
806 | **/ | ||
807 | static void e1000_lan_init_done_ich8lan(struct e1000_hw *hw) | ||
808 | { | ||
809 | u32 data, loop = E1000_ICH8_LAN_INIT_TIMEOUT; | ||
810 | |||
811 | /* Wait for basic configuration completes before proceeding */ | ||
812 | do { | ||
813 | data = er32(STATUS); | ||
814 | data &= E1000_STATUS_LAN_INIT_DONE; | ||
815 | udelay(100); | ||
816 | } while ((!data) && --loop); | ||
817 | |||
818 | /* | ||
819 | * If basic configuration is incomplete before the above loop | ||
820 | * count reaches 0, loading the configuration from NVM will | ||
821 | * leave the PHY in a bad state possibly resulting in no link. | ||
822 | */ | ||
823 | if (loop == 0) | ||
824 | hw_dbg(hw, "LAN_INIT_DONE not set, increase timeout\n"); | ||
825 | |||
826 | /* Clear the Init Done bit for the next init event */ | ||
827 | data = er32(STATUS); | ||
828 | data &= ~E1000_STATUS_LAN_INIT_DONE; | ||
829 | ew32(STATUS, data); | ||
830 | } | ||
831 | |||
832 | /** | ||
697 | * e1000_phy_hw_reset_ich8lan - Performs a PHY reset | 833 | * e1000_phy_hw_reset_ich8lan - Performs a PHY reset |
698 | * @hw: pointer to the HW structure | 834 | * @hw: pointer to the HW structure |
699 | * | 835 | * |
@@ -707,13 +843,15 @@ static s32 e1000_phy_hw_reset_ich8lan(struct e1000_hw *hw) | |||
707 | u32 i; | 843 | u32 i; |
708 | u32 data, cnf_size, cnf_base_addr, sw_cfg_mask; | 844 | u32 data, cnf_size, cnf_base_addr, sw_cfg_mask; |
709 | s32 ret_val; | 845 | s32 ret_val; |
710 | u16 loop = E1000_ICH8_LAN_INIT_TIMEOUT; | ||
711 | u16 word_addr, reg_data, reg_addr, phy_page = 0; | 846 | u16 word_addr, reg_data, reg_addr, phy_page = 0; |
712 | 847 | ||
713 | ret_val = e1000e_phy_hw_reset_generic(hw); | 848 | ret_val = e1000e_phy_hw_reset_generic(hw); |
714 | if (ret_val) | 849 | if (ret_val) |
715 | return ret_val; | 850 | return ret_val; |
716 | 851 | ||
852 | /* Allow time for h/w to get to a quiescent state after reset */ | ||
853 | mdelay(10); | ||
854 | |||
717 | if (hw->mac.type == e1000_pchlan) { | 855 | if (hw->mac.type == e1000_pchlan) { |
718 | ret_val = e1000_hv_phy_workarounds_ich8lan(hw); | 856 | ret_val = e1000_hv_phy_workarounds_ich8lan(hw); |
719 | if (ret_val) | 857 | if (ret_val) |
@@ -741,26 +879,8 @@ static s32 e1000_phy_hw_reset_ich8lan(struct e1000_hw *hw) | |||
741 | if (!(data & sw_cfg_mask)) | 879 | if (!(data & sw_cfg_mask)) |
742 | return 0; | 880 | return 0; |
743 | 881 | ||
744 | /* Wait for basic configuration completes before proceeding*/ | 882 | /* Wait for basic configuration completes before proceeding */ |
745 | do { | 883 | e1000_lan_init_done_ich8lan(hw); |
746 | data = er32(STATUS); | ||
747 | data &= E1000_STATUS_LAN_INIT_DONE; | ||
748 | udelay(100); | ||
749 | } while ((!data) && --loop); | ||
750 | |||
751 | /* | ||
752 | * If basic configuration is incomplete before the above loop | ||
753 | * count reaches 0, loading the configuration from NVM will | ||
754 | * leave the PHY in a bad state possibly resulting in no link. | ||
755 | */ | ||
756 | if (loop == 0) { | ||
757 | hw_dbg(hw, "LAN_INIT_DONE not set, increase timeout\n"); | ||
758 | } | ||
759 | |||
760 | /* Clear the Init Done bit for the next init event */ | ||
761 | data = er32(STATUS); | ||
762 | data &= ~E1000_STATUS_LAN_INIT_DONE; | ||
763 | ew32(STATUS, data); | ||
764 | 884 | ||
765 | /* | 885 | /* |
766 | * Make sure HW does not configure LCD from PHY | 886 | * Make sure HW does not configure LCD from PHY |
@@ -961,12 +1081,14 @@ static s32 e1000_set_d0_lplu_state_ich8lan(struct e1000_hw *hw, bool active) | |||
961 | phy_ctrl |= E1000_PHY_CTRL_D0A_LPLU; | 1081 | phy_ctrl |= E1000_PHY_CTRL_D0A_LPLU; |
962 | ew32(PHY_CTRL, phy_ctrl); | 1082 | ew32(PHY_CTRL, phy_ctrl); |
963 | 1083 | ||
1084 | if (phy->type != e1000_phy_igp_3) | ||
1085 | return 0; | ||
1086 | |||
964 | /* | 1087 | /* |
965 | * Call gig speed drop workaround on LPLU before accessing | 1088 | * Call gig speed drop workaround on LPLU before accessing |
966 | * any PHY registers | 1089 | * any PHY registers |
967 | */ | 1090 | */ |
968 | if ((hw->mac.type == e1000_ich8lan) && | 1091 | if (hw->mac.type == e1000_ich8lan) |
969 | (hw->phy.type == e1000_phy_igp_3)) | ||
970 | e1000e_gig_downshift_workaround_ich8lan(hw); | 1092 | e1000e_gig_downshift_workaround_ich8lan(hw); |
971 | 1093 | ||
972 | /* When LPLU is enabled, we should disable SmartSpeed */ | 1094 | /* When LPLU is enabled, we should disable SmartSpeed */ |
@@ -979,6 +1101,9 @@ static s32 e1000_set_d0_lplu_state_ich8lan(struct e1000_hw *hw, bool active) | |||
979 | phy_ctrl &= ~E1000_PHY_CTRL_D0A_LPLU; | 1101 | phy_ctrl &= ~E1000_PHY_CTRL_D0A_LPLU; |
980 | ew32(PHY_CTRL, phy_ctrl); | 1102 | ew32(PHY_CTRL, phy_ctrl); |
981 | 1103 | ||
1104 | if (phy->type != e1000_phy_igp_3) | ||
1105 | return 0; | ||
1106 | |||
982 | /* | 1107 | /* |
983 | * LPLU and SmartSpeed are mutually exclusive. LPLU is used | 1108 | * LPLU and SmartSpeed are mutually exclusive. LPLU is used |
984 | * during Dx states where the power conservation is most | 1109 | * during Dx states where the power conservation is most |
@@ -1038,6 +1163,10 @@ static s32 e1000_set_d3_lplu_state_ich8lan(struct e1000_hw *hw, bool active) | |||
1038 | if (!active) { | 1163 | if (!active) { |
1039 | phy_ctrl &= ~E1000_PHY_CTRL_NOND0A_LPLU; | 1164 | phy_ctrl &= ~E1000_PHY_CTRL_NOND0A_LPLU; |
1040 | ew32(PHY_CTRL, phy_ctrl); | 1165 | ew32(PHY_CTRL, phy_ctrl); |
1166 | |||
1167 | if (phy->type != e1000_phy_igp_3) | ||
1168 | return 0; | ||
1169 | |||
1041 | /* | 1170 | /* |
1042 | * LPLU and SmartSpeed are mutually exclusive. LPLU is used | 1171 | * LPLU and SmartSpeed are mutually exclusive. LPLU is used |
1043 | * during Dx states where the power conservation is most | 1172 | * during Dx states where the power conservation is most |
@@ -1073,12 +1202,14 @@ static s32 e1000_set_d3_lplu_state_ich8lan(struct e1000_hw *hw, bool active) | |||
1073 | phy_ctrl |= E1000_PHY_CTRL_NOND0A_LPLU; | 1202 | phy_ctrl |= E1000_PHY_CTRL_NOND0A_LPLU; |
1074 | ew32(PHY_CTRL, phy_ctrl); | 1203 | ew32(PHY_CTRL, phy_ctrl); |
1075 | 1204 | ||
1205 | if (phy->type != e1000_phy_igp_3) | ||
1206 | return 0; | ||
1207 | |||
1076 | /* | 1208 | /* |
1077 | * Call gig speed drop workaround on LPLU before accessing | 1209 | * Call gig speed drop workaround on LPLU before accessing |
1078 | * any PHY registers | 1210 | * any PHY registers |
1079 | */ | 1211 | */ |
1080 | if ((hw->mac.type == e1000_ich8lan) && | 1212 | if (hw->mac.type == e1000_ich8lan) |
1081 | (hw->phy.type == e1000_phy_igp_3)) | ||
1082 | e1000e_gig_downshift_workaround_ich8lan(hw); | 1213 | e1000e_gig_downshift_workaround_ich8lan(hw); |
1083 | 1214 | ||
1084 | /* When LPLU is enabled, we should disable SmartSpeed */ | 1215 | /* When LPLU is enabled, we should disable SmartSpeed */ |
@@ -1905,7 +2036,7 @@ static s32 e1000_erase_flash_bank_ich8lan(struct e1000_hw *hw, u32 bank) | |||
1905 | break; | 2036 | break; |
1906 | case 1: | 2037 | case 1: |
1907 | sector_size = ICH_FLASH_SEG_SIZE_4K; | 2038 | sector_size = ICH_FLASH_SEG_SIZE_4K; |
1908 | iteration = flash_bank_size / ICH_FLASH_SEG_SIZE_4K; | 2039 | iteration = 1; |
1909 | break; | 2040 | break; |
1910 | case 2: | 2041 | case 2: |
1911 | if (hw->mac.type == e1000_ich9lan) { | 2042 | if (hw->mac.type == e1000_ich9lan) { |
@@ -1917,7 +2048,7 @@ static s32 e1000_erase_flash_bank_ich8lan(struct e1000_hw *hw, u32 bank) | |||
1917 | break; | 2048 | break; |
1918 | case 3: | 2049 | case 3: |
1919 | sector_size = ICH_FLASH_SEG_SIZE_64K; | 2050 | sector_size = ICH_FLASH_SEG_SIZE_64K; |
1920 | iteration = flash_bank_size / ICH_FLASH_SEG_SIZE_64K; | 2051 | iteration = 1; |
1921 | break; | 2052 | break; |
1922 | default: | 2053 | default: |
1923 | return -E1000_ERR_NVM; | 2054 | return -E1000_ERR_NVM; |
@@ -2143,6 +2274,12 @@ static s32 e1000_reset_hw_ich8lan(struct e1000_hw *hw) | |||
2143 | ctrl = er32(CTRL); | 2274 | ctrl = er32(CTRL); |
2144 | 2275 | ||
2145 | if (!e1000_check_reset_block(hw)) { | 2276 | if (!e1000_check_reset_block(hw)) { |
2277 | /* Clear PHY Reset Asserted bit */ | ||
2278 | if (hw->mac.type >= e1000_pchlan) { | ||
2279 | u32 status = er32(STATUS); | ||
2280 | ew32(STATUS, status & ~E1000_STATUS_PHYRA); | ||
2281 | } | ||
2282 | |||
2146 | /* | 2283 | /* |
2147 | * PHY HW reset requires MAC CORE reset at the same | 2284 | * PHY HW reset requires MAC CORE reset at the same |
2148 | * time to make sure the interface between MAC and the | 2285 | * time to make sure the interface between MAC and the |
@@ -2156,23 +2293,34 @@ static s32 e1000_reset_hw_ich8lan(struct e1000_hw *hw) | |||
2156 | ew32(CTRL, (ctrl | E1000_CTRL_RST)); | 2293 | ew32(CTRL, (ctrl | E1000_CTRL_RST)); |
2157 | msleep(20); | 2294 | msleep(20); |
2158 | 2295 | ||
2159 | if (!ret_val) { | 2296 | if (!ret_val) |
2160 | /* release the swflag because it is not reset by | ||
2161 | * hardware reset | ||
2162 | */ | ||
2163 | e1000_release_swflag_ich8lan(hw); | 2297 | e1000_release_swflag_ich8lan(hw); |
2164 | } | ||
2165 | 2298 | ||
2166 | ret_val = e1000e_get_auto_rd_done(hw); | 2299 | if (ctrl & E1000_CTRL_PHY_RST) |
2167 | if (ret_val) { | 2300 | ret_val = hw->phy.ops.get_cfg_done(hw); |
2168 | /* | 2301 | |
2169 | * When auto config read does not complete, do not | 2302 | if (hw->mac.type >= e1000_ich10lan) { |
2170 | * return with an error. This can happen in situations | 2303 | e1000_lan_init_done_ich8lan(hw); |
2171 | * where there is no eeprom and prevents getting link. | 2304 | } else { |
2172 | */ | 2305 | ret_val = e1000e_get_auto_rd_done(hw); |
2173 | hw_dbg(hw, "Auto Read Done did not complete\n"); | 2306 | if (ret_val) { |
2307 | /* | ||
2308 | * When auto config read does not complete, do not | ||
2309 | * return with an error. This can happen in situations | ||
2310 | * where there is no eeprom and prevents getting link. | ||
2311 | */ | ||
2312 | hw_dbg(hw, "Auto Read Done did not complete\n"); | ||
2313 | } | ||
2174 | } | 2314 | } |
2175 | 2315 | ||
2316 | /* | ||
2317 | * For PCH, this write will make sure that any noise | ||
2318 | * will be detected as a CRC error and be dropped rather than show up | ||
2319 | * as a bad packet to the DMA engine. | ||
2320 | */ | ||
2321 | if (hw->mac.type == e1000_pchlan) | ||
2322 | ew32(CRC_OFFSET, 0x65656565); | ||
2323 | |||
2176 | ew32(IMC, 0xffffffff); | 2324 | ew32(IMC, 0xffffffff); |
2177 | icr = er32(ICR); | 2325 | icr = er32(ICR); |
2178 | 2326 | ||
@@ -2222,6 +2370,18 @@ static s32 e1000_init_hw_ich8lan(struct e1000_hw *hw) | |||
2222 | for (i = 0; i < mac->mta_reg_count; i++) | 2370 | for (i = 0; i < mac->mta_reg_count; i++) |
2223 | E1000_WRITE_REG_ARRAY(hw, E1000_MTA, i, 0); | 2371 | E1000_WRITE_REG_ARRAY(hw, E1000_MTA, i, 0); |
2224 | 2372 | ||
2373 | /* | ||
2374 | * The 82578 Rx buffer will stall if wakeup is enabled in host and | ||
2375 | * the ME. Reading the BM_WUC register will clear the host wakeup bit. | ||
2376 | * Reset the phy after disabling host wakeup to reset the Rx buffer. | ||
2377 | */ | ||
2378 | if (hw->phy.type == e1000_phy_82578) { | ||
2379 | hw->phy.ops.read_phy_reg(hw, BM_WUC, &i); | ||
2380 | ret_val = e1000_phy_hw_reset_ich8lan(hw); | ||
2381 | if (ret_val) | ||
2382 | return ret_val; | ||
2383 | } | ||
2384 | |||
2225 | /* Setup link and flow control */ | 2385 | /* Setup link and flow control */ |
2226 | ret_val = e1000_setup_link_ich8lan(hw); | 2386 | ret_val = e1000_setup_link_ich8lan(hw); |
2227 | 2387 | ||
@@ -2254,16 +2414,6 @@ static s32 e1000_init_hw_ich8lan(struct e1000_hw *hw) | |||
2254 | ew32(CTRL_EXT, ctrl_ext); | 2414 | ew32(CTRL_EXT, ctrl_ext); |
2255 | 2415 | ||
2256 | /* | 2416 | /* |
2257 | * The 82578 Rx buffer will stall if wakeup is enabled in host and | ||
2258 | * the ME. Reading the BM_WUC register will clear the host wakeup bit. | ||
2259 | * Reset the phy after disabling host wakeup to reset the Rx buffer. | ||
2260 | */ | ||
2261 | if (hw->phy.type == e1000_phy_82578) { | ||
2262 | e1e_rphy(hw, BM_WUC, &i); | ||
2263 | e1000e_phy_hw_reset_generic(hw); | ||
2264 | } | ||
2265 | |||
2266 | /* | ||
2267 | * Clear all of the statistics registers (clear on read). It is | 2417 | * Clear all of the statistics registers (clear on read). It is |
2268 | * important that we do this after we have tried to establish link | 2418 | * important that we do this after we have tried to establish link |
2269 | * because the symbol error count will increment wildly if there | 2419 | * because the symbol error count will increment wildly if there |
@@ -2485,6 +2635,14 @@ static s32 e1000_get_link_up_info_ich8lan(struct e1000_hw *hw, u16 *speed, | |||
2485 | if (ret_val) | 2635 | if (ret_val) |
2486 | return ret_val; | 2636 | return ret_val; |
2487 | 2637 | ||
2638 | if ((hw->mac.type == e1000_pchlan) && (*speed == SPEED_1000)) { | ||
2639 | ret_val = e1000e_write_kmrn_reg(hw, | ||
2640 | E1000_KMRNCTRLSTA_K1_CONFIG, | ||
2641 | E1000_KMRNCTRLSTA_K1_DISABLE); | ||
2642 | if (ret_val) | ||
2643 | return ret_val; | ||
2644 | } | ||
2645 | |||
2488 | if ((hw->mac.type == e1000_ich8lan) && | 2646 | if ((hw->mac.type == e1000_ich8lan) && |
2489 | (hw->phy.type == e1000_phy_igp_3) && | 2647 | (hw->phy.type == e1000_phy_igp_3) && |
2490 | (*speed == SPEED_1000)) { | 2648 | (*speed == SPEED_1000)) { |
@@ -2850,6 +3008,16 @@ static s32 e1000_get_cfg_done_ich8lan(struct e1000_hw *hw) | |||
2850 | { | 3008 | { |
2851 | u32 bank = 0; | 3009 | u32 bank = 0; |
2852 | 3010 | ||
3011 | if (hw->mac.type >= e1000_pchlan) { | ||
3012 | u32 status = er32(STATUS); | ||
3013 | |||
3014 | if (status & E1000_STATUS_PHYRA) | ||
3015 | ew32(STATUS, status & ~E1000_STATUS_PHYRA); | ||
3016 | else | ||
3017 | hw_dbg(hw, | ||
3018 | "PHY Reset Asserted not set - needs delay\n"); | ||
3019 | } | ||
3020 | |||
2853 | e1000e_get_cfg_done(hw); | 3021 | e1000e_get_cfg_done(hw); |
2854 | 3022 | ||
2855 | /* If EEPROM is not marked present, init the IGP 3 PHY manually */ | 3023 | /* If EEPROM is not marked present, init the IGP 3 PHY manually */ |
@@ -2921,7 +3089,7 @@ static void e1000_clear_hw_cntrs_ich8lan(struct e1000_hw *hw) | |||
2921 | static struct e1000_mac_operations ich8_mac_ops = { | 3089 | static struct e1000_mac_operations ich8_mac_ops = { |
2922 | .id_led_init = e1000e_id_led_init, | 3090 | .id_led_init = e1000e_id_led_init, |
2923 | .check_mng_mode = e1000_check_mng_mode_ich8lan, | 3091 | .check_mng_mode = e1000_check_mng_mode_ich8lan, |
2924 | .check_for_link = e1000e_check_for_copper_link, | 3092 | .check_for_link = e1000_check_for_copper_link_ich8lan, |
2925 | /* cleanup_led dependent on mac type */ | 3093 | /* cleanup_led dependent on mac type */ |
2926 | .clear_hw_cntrs = e1000_clear_hw_cntrs_ich8lan, | 3094 | .clear_hw_cntrs = e1000_clear_hw_cntrs_ich8lan, |
2927 | .get_bus_info = e1000_get_bus_info_ich8lan, | 3095 | .get_bus_info = e1000_get_bus_info_ich8lan, |
diff --git a/drivers/net/e1000e/lib.c b/drivers/net/e1000e/lib.c index be6d9e99037..99ba2b8a2a0 100644 --- a/drivers/net/e1000e/lib.c +++ b/drivers/net/e1000e/lib.c | |||
@@ -378,12 +378,6 @@ s32 e1000e_check_for_copper_link(struct e1000_hw *hw) | |||
378 | 378 | ||
379 | mac->get_link_status = 0; | 379 | mac->get_link_status = 0; |
380 | 380 | ||
381 | if (hw->phy.type == e1000_phy_82578) { | ||
382 | ret_val = e1000_link_stall_workaround_hv(hw); | ||
383 | if (ret_val) | ||
384 | return ret_val; | ||
385 | } | ||
386 | |||
387 | /* | 381 | /* |
388 | * Check if there was DownShift, must be checked | 382 | * Check if there was DownShift, must be checked |
389 | * immediately after link-up | 383 | * immediately after link-up |
diff --git a/drivers/net/e1000e/phy.c b/drivers/net/e1000e/phy.c index e23459cf3d0..994401fd066 100644 --- a/drivers/net/e1000e/phy.c +++ b/drivers/net/e1000e/phy.c | |||
@@ -1531,7 +1531,12 @@ s32 e1000e_phy_has_link_generic(struct e1000_hw *hw, u32 iterations, | |||
1531 | */ | 1531 | */ |
1532 | ret_val = e1e_rphy(hw, PHY_STATUS, &phy_status); | 1532 | ret_val = e1e_rphy(hw, PHY_STATUS, &phy_status); |
1533 | if (ret_val) | 1533 | if (ret_val) |
1534 | break; | 1534 | /* |
1535 | * If the first read fails, another entity may have | ||
1536 | * ownership of the resources, wait and try again to | ||
1537 | * see if they have relinquished the resources yet. | ||
1538 | */ | ||
1539 | udelay(usec_interval); | ||
1535 | ret_val = e1e_rphy(hw, PHY_STATUS, &phy_status); | 1540 | ret_val = e1e_rphy(hw, PHY_STATUS, &phy_status); |
1536 | if (ret_val) | 1541 | if (ret_val) |
1537 | break; | 1542 | break; |
@@ -2737,6 +2742,11 @@ s32 e1000_link_stall_workaround_hv(struct e1000_hw *hw) | |||
2737 | if (hw->phy.type != e1000_phy_82578) | 2742 | if (hw->phy.type != e1000_phy_82578) |
2738 | goto out; | 2743 | goto out; |
2739 | 2744 | ||
2745 | /* Do not apply workaround if in PHY loopback bit 14 set */ | ||
2746 | hw->phy.ops.read_phy_reg(hw, PHY_CONTROL, &data); | ||
2747 | if (data & PHY_CONTROL_LB) | ||
2748 | goto out; | ||
2749 | |||
2740 | /* check if link is up and at 1Gbps */ | 2750 | /* check if link is up and at 1Gbps */ |
2741 | ret_val = hw->phy.ops.read_phy_reg(hw, BM_CS_STATUS, &data); | 2751 | ret_val = hw->phy.ops.read_phy_reg(hw, BM_CS_STATUS, &data); |
2742 | if (ret_val) | 2752 | if (ret_val) |
diff --git a/drivers/net/epic100.c b/drivers/net/epic100.c index b60e27dfcfa..88d7ebf3122 100644 --- a/drivers/net/epic100.c +++ b/drivers/net/epic100.c | |||
@@ -338,8 +338,7 @@ static int __devinit epic_init_one (struct pci_dev *pdev, | |||
338 | #ifndef MODULE | 338 | #ifndef MODULE |
339 | static int printed_version; | 339 | static int printed_version; |
340 | if (!printed_version++) | 340 | if (!printed_version++) |
341 | printk (KERN_INFO "%s" KERN_INFO "%s", | 341 | printk(KERN_INFO "%s%s", version, version2); |
342 | version, version2); | ||
343 | #endif | 342 | #endif |
344 | 343 | ||
345 | card_idx++; | 344 | card_idx++; |
@@ -1600,7 +1599,7 @@ static int __init epic_init (void) | |||
1600 | { | 1599 | { |
1601 | /* when a module, this is printed whether or not devices are found in probe */ | 1600 | /* when a module, this is printed whether or not devices are found in probe */ |
1602 | #ifdef MODULE | 1601 | #ifdef MODULE |
1603 | printk (KERN_INFO "%s" KERN_INFO "%s", | 1602 | printk (KERN_INFO "%s%s", |
1604 | version, version2); | 1603 | version, version2); |
1605 | #endif | 1604 | #endif |
1606 | 1605 | ||
diff --git a/drivers/net/fealnx.c b/drivers/net/fealnx.c index 891be28a7d4..48385c42ab5 100644 --- a/drivers/net/fealnx.c +++ b/drivers/net/fealnx.c | |||
@@ -1209,17 +1209,20 @@ static void fealnx_tx_timeout(struct net_device *dev) | |||
1209 | unsigned long flags; | 1209 | unsigned long flags; |
1210 | int i; | 1210 | int i; |
1211 | 1211 | ||
1212 | printk(KERN_WARNING "%s: Transmit timed out, status %8.8x," | 1212 | printk(KERN_WARNING |
1213 | " resetting...\n", dev->name, ioread32(ioaddr + ISR)); | 1213 | "%s: Transmit timed out, status %8.8x, resetting...\n", |
1214 | dev->name, ioread32(ioaddr + ISR)); | ||
1214 | 1215 | ||
1215 | { | 1216 | { |
1216 | printk(KERN_DEBUG " Rx ring %p: ", np->rx_ring); | 1217 | printk(KERN_DEBUG " Rx ring %p: ", np->rx_ring); |
1217 | for (i = 0; i < RX_RING_SIZE; i++) | 1218 | for (i = 0; i < RX_RING_SIZE; i++) |
1218 | printk(" %8.8x", (unsigned int) np->rx_ring[i].status); | 1219 | printk(KERN_CONT " %8.8x", |
1219 | printk("\n" KERN_DEBUG " Tx ring %p: ", np->tx_ring); | 1220 | (unsigned int) np->rx_ring[i].status); |
1221 | printk(KERN_CONT "\n"); | ||
1222 | printk(KERN_DEBUG " Tx ring %p: ", np->tx_ring); | ||
1220 | for (i = 0; i < TX_RING_SIZE; i++) | 1223 | for (i = 0; i < TX_RING_SIZE; i++) |
1221 | printk(" %4.4x", np->tx_ring[i].status); | 1224 | printk(KERN_CONT " %4.4x", np->tx_ring[i].status); |
1222 | printk("\n"); | 1225 | printk(KERN_CONT "\n"); |
1223 | } | 1226 | } |
1224 | 1227 | ||
1225 | spin_lock_irqsave(&np->lock, flags); | 1228 | spin_lock_irqsave(&np->lock, flags); |
diff --git a/drivers/net/fec.h b/drivers/net/fec.h index 30b7dd67133..cc47f3f057c 100644 --- a/drivers/net/fec.h +++ b/drivers/net/fec.h | |||
@@ -46,12 +46,12 @@ | |||
46 | 46 | ||
47 | #else | 47 | #else |
48 | 48 | ||
49 | #define FEC_ECNTRL; 0x000 /* Ethernet control reg */ | 49 | #define FEC_ECNTRL 0x000 /* Ethernet control reg */ |
50 | #define FEC_IEVENT; 0x004 /* Interrupt even reg */ | 50 | #define FEC_IEVENT 0x004 /* Interrupt even reg */ |
51 | #define FEC_IMASK; 0x008 /* Interrupt mask reg */ | 51 | #define FEC_IMASK 0x008 /* Interrupt mask reg */ |
52 | #define FEC_IVEC; 0x00c /* Interrupt vec status reg */ | 52 | #define FEC_IVEC 0x00c /* Interrupt vec status reg */ |
53 | #define FEC_R_DES_ACTIVE; 0x010 /* Receive descriptor reg */ | 53 | #define FEC_R_DES_ACTIVE 0x010 /* Receive descriptor reg */ |
54 | #define FEC_X_DES_ACTIVE; 0x01c /* Transmit descriptor reg */ | 54 | #define FEC_X_DES_ACTIVE 0x014 /* Transmit descriptor reg */ |
55 | #define FEC_MII_DATA 0x040 /* MII manage frame reg */ | 55 | #define FEC_MII_DATA 0x040 /* MII manage frame reg */ |
56 | #define FEC_MII_SPEED 0x044 /* MII speed control reg */ | 56 | #define FEC_MII_SPEED 0x044 /* MII speed control reg */ |
57 | #define FEC_R_BOUND 0x08c /* FIFO receive bound reg */ | 57 | #define FEC_R_BOUND 0x08c /* FIFO receive bound reg */ |
diff --git a/drivers/net/forcedeth.c b/drivers/net/forcedeth.c index 1094d292630..3b4e0766c7b 100644 --- a/drivers/net/forcedeth.c +++ b/drivers/net/forcedeth.c | |||
@@ -3514,11 +3514,13 @@ static irqreturn_t nv_nic_irq(int foo, void *data) | |||
3514 | nv_msi_workaround(np); | 3514 | nv_msi_workaround(np); |
3515 | 3515 | ||
3516 | #ifdef CONFIG_FORCEDETH_NAPI | 3516 | #ifdef CONFIG_FORCEDETH_NAPI |
3517 | napi_schedule(&np->napi); | 3517 | if (napi_schedule_prep(&np->napi)) { |
3518 | 3518 | /* | |
3519 | /* Disable furthur irq's | 3519 | * Disable further irq's (msix not enabled with napi) |
3520 | (msix not enabled with napi) */ | 3520 | */ |
3521 | writel(0, base + NvRegIrqMask); | 3521 | writel(0, base + NvRegIrqMask); |
3522 | __napi_schedule(&np->napi); | ||
3523 | } | ||
3522 | 3524 | ||
3523 | #else | 3525 | #else |
3524 | do | 3526 | do |
@@ -3615,12 +3617,13 @@ static irqreturn_t nv_nic_irq_optimized(int foo, void *data) | |||
3615 | nv_msi_workaround(np); | 3617 | nv_msi_workaround(np); |
3616 | 3618 | ||
3617 | #ifdef CONFIG_FORCEDETH_NAPI | 3619 | #ifdef CONFIG_FORCEDETH_NAPI |
3618 | napi_schedule(&np->napi); | 3620 | if (napi_schedule_prep(&np->napi)) { |
3619 | 3621 | /* | |
3620 | /* Disable furthur irq's | 3622 | * Disable further irq's (msix not enabled with napi) |
3621 | (msix not enabled with napi) */ | 3623 | */ |
3622 | writel(0, base + NvRegIrqMask); | 3624 | writel(0, base + NvRegIrqMask); |
3623 | 3625 | __napi_schedule(&np->napi); | |
3626 | } | ||
3624 | #else | 3627 | #else |
3625 | do | 3628 | do |
3626 | { | 3629 | { |
diff --git a/drivers/net/hamachi.c b/drivers/net/hamachi.c index 9d5b62cb30f..d62378cbc14 100644 --- a/drivers/net/hamachi.c +++ b/drivers/net/hamachi.c | |||
@@ -173,8 +173,8 @@ static int tx_params[MAX_UNITS] = {-1, -1, -1, -1, -1, -1, -1, -1}; | |||
173 | 173 | ||
174 | static const char version[] __devinitconst = | 174 | static const char version[] __devinitconst = |
175 | KERN_INFO DRV_NAME ".c:v" DRV_VERSION " " DRV_RELDATE " Written by Donald Becker\n" | 175 | KERN_INFO DRV_NAME ".c:v" DRV_VERSION " " DRV_RELDATE " Written by Donald Becker\n" |
176 | KERN_INFO " Some modifications by Eric kasten <kasten@nscl.msu.edu>\n" | 176 | " Some modifications by Eric kasten <kasten@nscl.msu.edu>\n" |
177 | KERN_INFO " Further modifications by Keith Underwood <keithu@parl.clemson.edu>\n"; | 177 | " Further modifications by Keith Underwood <keithu@parl.clemson.edu>\n"; |
178 | 178 | ||
179 | 179 | ||
180 | /* IP_MF appears to be only defined in <netinet/ip.h>, however, | 180 | /* IP_MF appears to be only defined in <netinet/ip.h>, however, |
@@ -1080,11 +1080,14 @@ static void hamachi_tx_timeout(struct net_device *dev) | |||
1080 | { | 1080 | { |
1081 | printk(KERN_DEBUG " Rx ring %p: ", hmp->rx_ring); | 1081 | printk(KERN_DEBUG " Rx ring %p: ", hmp->rx_ring); |
1082 | for (i = 0; i < RX_RING_SIZE; i++) | 1082 | for (i = 0; i < RX_RING_SIZE; i++) |
1083 | printk(" %8.8x", le32_to_cpu(hmp->rx_ring[i].status_n_length)); | 1083 | printk(KERN_CONT " %8.8x", |
1084 | printk("\n"KERN_DEBUG" Tx ring %p: ", hmp->tx_ring); | 1084 | le32_to_cpu(hmp->rx_ring[i].status_n_length)); |
1085 | printk(KERN_CONT "\n"); | ||
1086 | printk(KERN_DEBUG" Tx ring %p: ", hmp->tx_ring); | ||
1085 | for (i = 0; i < TX_RING_SIZE; i++) | 1087 | for (i = 0; i < TX_RING_SIZE; i++) |
1086 | printk(" %4.4x", le32_to_cpu(hmp->tx_ring[i].status_n_length)); | 1088 | printk(KERN_CONT " %4.4x", |
1087 | printk("\n"); | 1089 | le32_to_cpu(hmp->tx_ring[i].status_n_length)); |
1090 | printk(KERN_CONT "\n"); | ||
1088 | } | 1091 | } |
1089 | 1092 | ||
1090 | /* Reinit the hardware and make sure the Rx and Tx processes | 1093 | /* Reinit the hardware and make sure the Rx and Tx processes |
@@ -1753,13 +1756,13 @@ static int hamachi_close(struct net_device *dev) | |||
1753 | 1756 | ||
1754 | #ifdef __i386__ | 1757 | #ifdef __i386__ |
1755 | if (hamachi_debug > 2) { | 1758 | if (hamachi_debug > 2) { |
1756 | printk("\n"KERN_DEBUG" Tx ring at %8.8x:\n", | 1759 | printk(KERN_DEBUG " Tx ring at %8.8x:\n", |
1757 | (int)hmp->tx_ring_dma); | 1760 | (int)hmp->tx_ring_dma); |
1758 | for (i = 0; i < TX_RING_SIZE; i++) | 1761 | for (i = 0; i < TX_RING_SIZE; i++) |
1759 | printk(" %c #%d desc. %8.8x %8.8x.\n", | 1762 | printk(KERN_DEBUG " %c #%d desc. %8.8x %8.8x.\n", |
1760 | readl(ioaddr + TxCurPtr) == (long)&hmp->tx_ring[i] ? '>' : ' ', | 1763 | readl(ioaddr + TxCurPtr) == (long)&hmp->tx_ring[i] ? '>' : ' ', |
1761 | i, hmp->tx_ring[i].status_n_length, hmp->tx_ring[i].addr); | 1764 | i, hmp->tx_ring[i].status_n_length, hmp->tx_ring[i].addr); |
1762 | printk("\n"KERN_DEBUG " Rx ring %8.8x:\n", | 1765 | printk(KERN_DEBUG " Rx ring %8.8x:\n", |
1763 | (int)hmp->rx_ring_dma); | 1766 | (int)hmp->rx_ring_dma); |
1764 | for (i = 0; i < RX_RING_SIZE; i++) { | 1767 | for (i = 0; i < RX_RING_SIZE; i++) { |
1765 | printk(KERN_DEBUG " %c #%d desc. %4.4x %8.8x\n", | 1768 | printk(KERN_DEBUG " %c #%d desc. %4.4x %8.8x\n", |
@@ -1770,7 +1773,7 @@ static int hamachi_close(struct net_device *dev) | |||
1770 | u16 *addr = (u16 *) | 1773 | u16 *addr = (u16 *) |
1771 | hmp->rx_skbuff[i]->data; | 1774 | hmp->rx_skbuff[i]->data; |
1772 | int j; | 1775 | int j; |
1773 | 1776 | printk(KERN_DEBUG "Addr: "); | |
1774 | for (j = 0; j < 0x50; j++) | 1777 | for (j = 0; j < 0x50; j++) |
1775 | printk(" %4.4x", addr[j]); | 1778 | printk(" %4.4x", addr[j]); |
1776 | printk("\n"); | 1779 | printk("\n"); |
diff --git a/drivers/net/hamradio/baycom_epp.c b/drivers/net/hamradio/baycom_epp.c index 5e4b7afd068..352703255bb 100644 --- a/drivers/net/hamradio/baycom_epp.c +++ b/drivers/net/hamradio/baycom_epp.c | |||
@@ -68,7 +68,7 @@ static const char paranoia_str[] = KERN_ERR | |||
68 | 68 | ||
69 | static const char bc_drvname[] = "baycom_epp"; | 69 | static const char bc_drvname[] = "baycom_epp"; |
70 | static const char bc_drvinfo[] = KERN_INFO "baycom_epp: (C) 1998-2000 Thomas Sailer, HB9JNX/AE4WA\n" | 70 | static const char bc_drvinfo[] = KERN_INFO "baycom_epp: (C) 1998-2000 Thomas Sailer, HB9JNX/AE4WA\n" |
71 | KERN_INFO "baycom_epp: version 0.7 compiled " __TIME__ " " __DATE__ "\n"; | 71 | "baycom_epp: version 0.7 compiled " __TIME__ " " __DATE__ "\n"; |
72 | 72 | ||
73 | /* --------------------------------------------------------------------- */ | 73 | /* --------------------------------------------------------------------- */ |
74 | 74 | ||
diff --git a/drivers/net/hamradio/baycom_par.c b/drivers/net/hamradio/baycom_par.c index 2e6fc4dc74b..5f5af9a606f 100644 --- a/drivers/net/hamradio/baycom_par.c +++ b/drivers/net/hamradio/baycom_par.c | |||
@@ -102,7 +102,7 @@ | |||
102 | 102 | ||
103 | static const char bc_drvname[] = "baycom_par"; | 103 | static const char bc_drvname[] = "baycom_par"; |
104 | static const char bc_drvinfo[] = KERN_INFO "baycom_par: (C) 1996-2000 Thomas Sailer, HB9JNX/AE4WA\n" | 104 | static const char bc_drvinfo[] = KERN_INFO "baycom_par: (C) 1996-2000 Thomas Sailer, HB9JNX/AE4WA\n" |
105 | KERN_INFO "baycom_par: version 0.9 compiled " __TIME__ " " __DATE__ "\n"; | 105 | "baycom_par: version 0.9 compiled " __TIME__ " " __DATE__ "\n"; |
106 | 106 | ||
107 | /* --------------------------------------------------------------------- */ | 107 | /* --------------------------------------------------------------------- */ |
108 | 108 | ||
diff --git a/drivers/net/hamradio/baycom_ser_fdx.c b/drivers/net/hamradio/baycom_ser_fdx.c index b6a816e60c0..aa4488e871b 100644 --- a/drivers/net/hamradio/baycom_ser_fdx.c +++ b/drivers/net/hamradio/baycom_ser_fdx.c | |||
@@ -91,7 +91,7 @@ | |||
91 | 91 | ||
92 | static const char bc_drvname[] = "baycom_ser_fdx"; | 92 | static const char bc_drvname[] = "baycom_ser_fdx"; |
93 | static const char bc_drvinfo[] = KERN_INFO "baycom_ser_fdx: (C) 1996-2000 Thomas Sailer, HB9JNX/AE4WA\n" | 93 | static const char bc_drvinfo[] = KERN_INFO "baycom_ser_fdx: (C) 1996-2000 Thomas Sailer, HB9JNX/AE4WA\n" |
94 | KERN_INFO "baycom_ser_fdx: version 0.10 compiled " __TIME__ " " __DATE__ "\n"; | 94 | "baycom_ser_fdx: version 0.10 compiled " __TIME__ " " __DATE__ "\n"; |
95 | 95 | ||
96 | /* --------------------------------------------------------------------- */ | 96 | /* --------------------------------------------------------------------- */ |
97 | 97 | ||
diff --git a/drivers/net/hamradio/baycom_ser_hdx.c b/drivers/net/hamradio/baycom_ser_hdx.c index 3bcc57acbe6..88c59359602 100644 --- a/drivers/net/hamradio/baycom_ser_hdx.c +++ b/drivers/net/hamradio/baycom_ser_hdx.c | |||
@@ -79,7 +79,7 @@ | |||
79 | 79 | ||
80 | static const char bc_drvname[] = "baycom_ser_hdx"; | 80 | static const char bc_drvname[] = "baycom_ser_hdx"; |
81 | static const char bc_drvinfo[] = KERN_INFO "baycom_ser_hdx: (C) 1996-2000 Thomas Sailer, HB9JNX/AE4WA\n" | 81 | static const char bc_drvinfo[] = KERN_INFO "baycom_ser_hdx: (C) 1996-2000 Thomas Sailer, HB9JNX/AE4WA\n" |
82 | KERN_INFO "baycom_ser_hdx: version 0.10 compiled " __TIME__ " " __DATE__ "\n"; | 82 | "baycom_ser_hdx: version 0.10 compiled " __TIME__ " " __DATE__ "\n"; |
83 | 83 | ||
84 | /* --------------------------------------------------------------------- */ | 84 | /* --------------------------------------------------------------------- */ |
85 | 85 | ||
diff --git a/drivers/net/igb/e1000_82575.c b/drivers/net/igb/e1000_82575.c index efd9be21488..ac28dd5a4fd 100644 --- a/drivers/net/igb/e1000_82575.c +++ b/drivers/net/igb/e1000_82575.c | |||
@@ -190,6 +190,10 @@ static s32 igb_get_invariants_82575(struct e1000_hw *hw) | |||
190 | phy->ops.write_reg = igb_write_phy_reg_igp; | 190 | phy->ops.write_reg = igb_write_phy_reg_igp; |
191 | } | 191 | } |
192 | 192 | ||
193 | /* set lan id */ | ||
194 | hw->bus.func = (rd32(E1000_STATUS) & E1000_STATUS_FUNC_MASK) >> | ||
195 | E1000_STATUS_FUNC_SHIFT; | ||
196 | |||
193 | /* Set phy->phy_addr and phy->id. */ | 197 | /* Set phy->phy_addr and phy->id. */ |
194 | ret_val = igb_get_phy_id_82575(hw); | 198 | ret_val = igb_get_phy_id_82575(hw); |
195 | if (ret_val) | 199 | if (ret_val) |
diff --git a/drivers/net/ixgbe/ixgbe_dcb_nl.c b/drivers/net/ixgbe/ixgbe_dcb_nl.c index d56890f5c9d..7c5978ad929 100644 --- a/drivers/net/ixgbe/ixgbe_dcb_nl.c +++ b/drivers/net/ixgbe/ixgbe_dcb_nl.c | |||
@@ -138,6 +138,10 @@ static u8 ixgbe_dcbnl_set_state(struct net_device *netdev, u8 state) | |||
138 | adapter->hw.fc.requested_mode = ixgbe_fc_none; | 138 | adapter->hw.fc.requested_mode = ixgbe_fc_none; |
139 | } | 139 | } |
140 | adapter->flags &= ~IXGBE_FLAG_RSS_ENABLED; | 140 | adapter->flags &= ~IXGBE_FLAG_RSS_ENABLED; |
141 | if (adapter->hw.mac.type == ixgbe_mac_82599EB) { | ||
142 | adapter->flags &= ~IXGBE_FLAG_FDIR_HASH_CAPABLE; | ||
143 | adapter->flags &= ~IXGBE_FLAG_FDIR_PERFECT_CAPABLE; | ||
144 | } | ||
141 | adapter->flags |= IXGBE_FLAG_DCB_ENABLED; | 145 | adapter->flags |= IXGBE_FLAG_DCB_ENABLED; |
142 | ixgbe_init_interrupt_scheme(adapter); | 146 | ixgbe_init_interrupt_scheme(adapter); |
143 | if (netif_running(netdev)) | 147 | if (netif_running(netdev)) |
@@ -154,6 +158,8 @@ static u8 ixgbe_dcbnl_set_state(struct net_device *netdev, u8 state) | |||
154 | adapter->dcb_cfg.pfc_mode_enable = false; | 158 | adapter->dcb_cfg.pfc_mode_enable = false; |
155 | adapter->flags &= ~IXGBE_FLAG_DCB_ENABLED; | 159 | adapter->flags &= ~IXGBE_FLAG_DCB_ENABLED; |
156 | adapter->flags |= IXGBE_FLAG_RSS_ENABLED; | 160 | adapter->flags |= IXGBE_FLAG_RSS_ENABLED; |
161 | if (adapter->hw.mac.type == ixgbe_mac_82599EB) | ||
162 | adapter->flags |= IXGBE_FLAG_FDIR_HASH_CAPABLE; | ||
157 | ixgbe_init_interrupt_scheme(adapter); | 163 | ixgbe_init_interrupt_scheme(adapter); |
158 | if (netif_running(netdev)) | 164 | if (netif_running(netdev)) |
159 | netdev->netdev_ops->ndo_open(netdev); | 165 | netdev->netdev_ops->ndo_open(netdev); |
diff --git a/drivers/net/ixgbe/ixgbe_ethtool.c b/drivers/net/ixgbe/ixgbe_ethtool.c index 0f7b6a3a2e6..2a978008fd6 100644 --- a/drivers/net/ixgbe/ixgbe_ethtool.c +++ b/drivers/net/ixgbe/ixgbe_ethtool.c | |||
@@ -1830,7 +1830,6 @@ static int ixgbe_wol_exclusion(struct ixgbe_adapter *adapter, | |||
1830 | break; | 1830 | break; |
1831 | default: | 1831 | default: |
1832 | wol->supported = 0; | 1832 | wol->supported = 0; |
1833 | retval = 0; | ||
1834 | } | 1833 | } |
1835 | 1834 | ||
1836 | return retval; | 1835 | return retval; |
diff --git a/drivers/net/ixgbe/ixgbe_main.c b/drivers/net/ixgbe/ixgbe_main.c index 5588ef493a3..e3442f47f93 100644 --- a/drivers/net/ixgbe/ixgbe_main.c +++ b/drivers/net/ixgbe/ixgbe_main.c | |||
@@ -2697,19 +2697,23 @@ static int ixgbe_up_complete(struct ixgbe_adapter *adapter) | |||
2697 | 2697 | ||
2698 | /* | 2698 | /* |
2699 | * For hot-pluggable SFP+ devices, a new SFP+ module may have | 2699 | * For hot-pluggable SFP+ devices, a new SFP+ module may have |
2700 | * arrived before interrupts were enabled. We need to kick off | 2700 | * arrived before interrupts were enabled but after probe. Such |
2701 | * the SFP+ module setup first, then try to bring up link. | 2701 | * devices wouldn't have their type identified yet. We need to |
2702 | * kick off the SFP+ module setup first, then try to bring up link. | ||
2702 | * If we're not hot-pluggable SFP+, we just need to configure link | 2703 | * If we're not hot-pluggable SFP+, we just need to configure link |
2703 | * and bring it up. | 2704 | * and bring it up. |
2704 | */ | 2705 | */ |
2705 | err = hw->phy.ops.identify(hw); | 2706 | if (hw->phy.type == ixgbe_phy_unknown) { |
2706 | if (err == IXGBE_ERR_SFP_NOT_SUPPORTED) { | 2707 | err = hw->phy.ops.identify(hw); |
2707 | dev_err(&adapter->pdev->dev, "failed to initialize because " | 2708 | if (err == IXGBE_ERR_SFP_NOT_SUPPORTED) { |
2708 | "an unsupported SFP+ module type was detected.\n" | 2709 | /* |
2709 | "Reload the driver after installing a supported " | 2710 | * Take the device down and schedule the sfp tasklet |
2710 | "module.\n"); | 2711 | * which will unregister_netdev and log it. |
2711 | ixgbe_down(adapter); | 2712 | */ |
2712 | return err; | 2713 | ixgbe_down(adapter); |
2714 | schedule_work(&adapter->sfp_config_module_task); | ||
2715 | return err; | ||
2716 | } | ||
2713 | } | 2717 | } |
2714 | 2718 | ||
2715 | if (ixgbe_is_sfp(hw)) { | 2719 | if (ixgbe_is_sfp(hw)) { |
@@ -3126,7 +3130,11 @@ static inline bool ixgbe_set_fcoe_queues(struct ixgbe_adapter *adapter) | |||
3126 | #endif | 3130 | #endif |
3127 | if (adapter->flags & IXGBE_FLAG_RSS_ENABLED) { | 3131 | if (adapter->flags & IXGBE_FLAG_RSS_ENABLED) { |
3128 | DPRINTK(PROBE, INFO, "FCOE enabled with RSS \n"); | 3132 | DPRINTK(PROBE, INFO, "FCOE enabled with RSS \n"); |
3129 | ixgbe_set_rss_queues(adapter); | 3133 | if ((adapter->flags & IXGBE_FLAG_FDIR_HASH_CAPABLE) || |
3134 | (adapter->flags & IXGBE_FLAG_FDIR_PERFECT_CAPABLE)) | ||
3135 | ixgbe_set_fdir_queues(adapter); | ||
3136 | else | ||
3137 | ixgbe_set_rss_queues(adapter); | ||
3130 | } | 3138 | } |
3131 | /* adding FCoE rx rings to the end */ | 3139 | /* adding FCoE rx rings to the end */ |
3132 | f->mask = adapter->num_rx_queues; | 3140 | f->mask = adapter->num_rx_queues; |
@@ -3384,7 +3392,12 @@ static inline bool ixgbe_cache_ring_fcoe(struct ixgbe_adapter *adapter) | |||
3384 | } | 3392 | } |
3385 | #endif /* CONFIG_IXGBE_DCB */ | 3393 | #endif /* CONFIG_IXGBE_DCB */ |
3386 | if (adapter->flags & IXGBE_FLAG_RSS_ENABLED) { | 3394 | if (adapter->flags & IXGBE_FLAG_RSS_ENABLED) { |
3387 | ixgbe_cache_ring_rss(adapter); | 3395 | if ((adapter->flags & IXGBE_FLAG_FDIR_HASH_CAPABLE) || |
3396 | (adapter->flags & IXGBE_FLAG_FDIR_PERFECT_CAPABLE)) | ||
3397 | ixgbe_cache_ring_fdir(adapter); | ||
3398 | else | ||
3399 | ixgbe_cache_ring_rss(adapter); | ||
3400 | |||
3388 | fcoe_i = f->mask; | 3401 | fcoe_i = f->mask; |
3389 | } | 3402 | } |
3390 | for (i = 0; i < f->indices; i++, fcoe_i++) | 3403 | for (i = 0; i < f->indices; i++, fcoe_i++) |
@@ -3724,7 +3737,7 @@ static void ixgbe_sfp_task(struct work_struct *work) | |||
3724 | if ((hw->phy.type == ixgbe_phy_nl) && | 3737 | if ((hw->phy.type == ixgbe_phy_nl) && |
3725 | (hw->phy.sfp_type == ixgbe_sfp_type_not_present)) { | 3738 | (hw->phy.sfp_type == ixgbe_sfp_type_not_present)) { |
3726 | s32 ret = hw->phy.ops.identify_sfp(hw); | 3739 | s32 ret = hw->phy.ops.identify_sfp(hw); |
3727 | if (ret) | 3740 | if (ret == IXGBE_ERR_SFP_NOT_PRESENT) |
3728 | goto reschedule; | 3741 | goto reschedule; |
3729 | ret = hw->phy.ops.reset(hw); | 3742 | ret = hw->phy.ops.reset(hw); |
3730 | if (ret == IXGBE_ERR_SFP_NOT_SUPPORTED) { | 3743 | if (ret == IXGBE_ERR_SFP_NOT_SUPPORTED) { |
@@ -4534,13 +4547,17 @@ static void ixgbe_sfp_config_module_task(struct work_struct *work) | |||
4534 | u32 err; | 4547 | u32 err; |
4535 | 4548 | ||
4536 | adapter->flags |= IXGBE_FLAG_IN_SFP_MOD_TASK; | 4549 | adapter->flags |= IXGBE_FLAG_IN_SFP_MOD_TASK; |
4550 | |||
4551 | /* Time for electrical oscillations to settle down */ | ||
4552 | msleep(100); | ||
4537 | err = hw->phy.ops.identify_sfp(hw); | 4553 | err = hw->phy.ops.identify_sfp(hw); |
4554 | |||
4538 | if (err == IXGBE_ERR_SFP_NOT_SUPPORTED) { | 4555 | if (err == IXGBE_ERR_SFP_NOT_SUPPORTED) { |
4539 | dev_err(&adapter->pdev->dev, "failed to initialize because " | 4556 | dev_err(&adapter->pdev->dev, "failed to initialize because " |
4540 | "an unsupported SFP+ module type was detected.\n" | 4557 | "an unsupported SFP+ module type was detected.\n" |
4541 | "Reload the driver after installing a supported " | 4558 | "Reload the driver after installing a supported " |
4542 | "module.\n"); | 4559 | "module.\n"); |
4543 | ixgbe_down(adapter); | 4560 | unregister_netdev(adapter->netdev); |
4544 | return; | 4561 | return; |
4545 | } | 4562 | } |
4546 | hw->mac.ops.setup_sfp(hw); | 4563 | hw->mac.ops.setup_sfp(hw); |
@@ -5570,12 +5587,6 @@ static int __devinit ixgbe_probe(struct pci_dev *pdev, | |||
5570 | netdev->features |= NETIF_F_FCOE_CRC; | 5587 | netdev->features |= NETIF_F_FCOE_CRC; |
5571 | netdev->features |= NETIF_F_FSO; | 5588 | netdev->features |= NETIF_F_FSO; |
5572 | netdev->fcoe_ddp_xid = IXGBE_FCOE_DDP_MAX - 1; | 5589 | netdev->fcoe_ddp_xid = IXGBE_FCOE_DDP_MAX - 1; |
5573 | DPRINTK(DRV, INFO, "FCoE enabled, " | ||
5574 | "disabling Flow Director\n"); | ||
5575 | adapter->flags &= ~IXGBE_FLAG_FDIR_HASH_CAPABLE; | ||
5576 | adapter->flags &= | ||
5577 | ~IXGBE_FLAG_FDIR_PERFECT_CAPABLE; | ||
5578 | adapter->atr_sample_rate = 0; | ||
5579 | } else { | 5590 | } else { |
5580 | adapter->flags &= ~IXGBE_FLAG_FCOE_ENABLED; | 5591 | adapter->flags &= ~IXGBE_FLAG_FCOE_ENABLED; |
5581 | } | 5592 | } |
diff --git a/drivers/net/ixgbe/ixgbe_phy.c b/drivers/net/ixgbe/ixgbe_phy.c index 453e966762f..9ecad17522c 100644 --- a/drivers/net/ixgbe/ixgbe_phy.c +++ b/drivers/net/ixgbe/ixgbe_phy.c | |||
@@ -60,6 +60,7 @@ s32 ixgbe_identify_phy_generic(struct ixgbe_hw *hw) | |||
60 | 60 | ||
61 | if (hw->phy.type == ixgbe_phy_unknown) { | 61 | if (hw->phy.type == ixgbe_phy_unknown) { |
62 | for (phy_addr = 0; phy_addr < IXGBE_MAX_PHY_ADDR; phy_addr++) { | 62 | for (phy_addr = 0; phy_addr < IXGBE_MAX_PHY_ADDR; phy_addr++) { |
63 | hw->phy.mdio.prtad = phy_addr; | ||
63 | if (mdio45_probe(&hw->phy.mdio, phy_addr) == 0) { | 64 | if (mdio45_probe(&hw->phy.mdio, phy_addr) == 0) { |
64 | ixgbe_get_phy_id(hw); | 65 | ixgbe_get_phy_id(hw); |
65 | hw->phy.type = | 66 | hw->phy.type = |
@@ -68,6 +69,8 @@ s32 ixgbe_identify_phy_generic(struct ixgbe_hw *hw) | |||
68 | break; | 69 | break; |
69 | } | 70 | } |
70 | } | 71 | } |
72 | /* clear value if nothing found */ | ||
73 | hw->phy.mdio.prtad = 0; | ||
71 | } else { | 74 | } else { |
72 | status = 0; | 75 | status = 0; |
73 | } | 76 | } |
diff --git a/drivers/net/natsemi.c b/drivers/net/natsemi.c index c9bfe4eea18..78c088331f5 100644 --- a/drivers/net/natsemi.c +++ b/drivers/net/natsemi.c | |||
@@ -130,8 +130,8 @@ static int full_duplex[MAX_UNITS]; | |||
130 | static const char version[] __devinitconst = | 130 | static const char version[] __devinitconst = |
131 | KERN_INFO DRV_NAME " dp8381x driver, version " | 131 | KERN_INFO DRV_NAME " dp8381x driver, version " |
132 | DRV_VERSION ", " DRV_RELDATE "\n" | 132 | DRV_VERSION ", " DRV_RELDATE "\n" |
133 | KERN_INFO " originally by Donald Becker <becker@scyld.com>\n" | 133 | " originally by Donald Becker <becker@scyld.com>\n" |
134 | KERN_INFO " 2.4.x kernel port by Jeff Garzik, Tjeerd Mulder\n"; | 134 | " 2.4.x kernel port by Jeff Garzik, Tjeerd Mulder\n"; |
135 | 135 | ||
136 | MODULE_AUTHOR("Donald Becker <becker@scyld.com>"); | 136 | MODULE_AUTHOR("Donald Becker <becker@scyld.com>"); |
137 | MODULE_DESCRIPTION("National Semiconductor DP8381x series PCI Ethernet driver"); | 137 | MODULE_DESCRIPTION("National Semiconductor DP8381x series PCI Ethernet driver"); |
diff --git a/drivers/net/ne.c b/drivers/net/ne.c index 5c3e242428f..992dbfffdb0 100644 --- a/drivers/net/ne.c +++ b/drivers/net/ne.c | |||
@@ -321,7 +321,7 @@ static int __init ne_probe1(struct net_device *dev, unsigned long ioaddr) | |||
321 | } | 321 | } |
322 | 322 | ||
323 | if (ei_debug && version_printed++ == 0) | 323 | if (ei_debug && version_printed++ == 0) |
324 | printk(KERN_INFO "%s" KERN_INFO "%s", version1, version2); | 324 | printk(KERN_INFO "%s%s", version1, version2); |
325 | 325 | ||
326 | printk(KERN_INFO "NE*000 ethercard probe at %#3lx:", ioaddr); | 326 | printk(KERN_INFO "NE*000 ethercard probe at %#3lx:", ioaddr); |
327 | 327 | ||
diff --git a/drivers/net/netxen/netxen_nic.h b/drivers/net/netxen/netxen_nic.h index 970cedeb5f3..e1cdba752e0 100644 --- a/drivers/net/netxen/netxen_nic.h +++ b/drivers/net/netxen/netxen_nic.h | |||
@@ -60,7 +60,18 @@ | |||
60 | #define _NETXEN_NIC_LINUX_SUBVERSION 30 | 60 | #define _NETXEN_NIC_LINUX_SUBVERSION 30 |
61 | #define NETXEN_NIC_LINUX_VERSIONID "4.0.30" | 61 | #define NETXEN_NIC_LINUX_VERSIONID "4.0.30" |
62 | 62 | ||
63 | #define NETXEN_VERSION_CODE(a, b, c) (((a) << 16) + ((b) << 8) + (c)) | 63 | #define NETXEN_VERSION_CODE(a, b, c) (((a) << 24) + ((b) << 16) + (c)) |
64 | #define _major(v) (((v) >> 24) & 0xff) | ||
65 | #define _minor(v) (((v) >> 16) & 0xff) | ||
66 | #define _build(v) ((v) & 0xffff) | ||
67 | |||
68 | /* version in image has weird encoding: | ||
69 | * 7:0 - major | ||
70 | * 15:8 - minor | ||
71 | * 31:16 - build (little endian) | ||
72 | */ | ||
73 | #define NETXEN_DECODE_VERSION(v) \ | ||
74 | NETXEN_VERSION_CODE(((v) & 0xff), (((v) >> 8) & 0xff), ((v) >> 16)) | ||
64 | 75 | ||
65 | #define NETXEN_NUM_FLASH_SECTORS (64) | 76 | #define NETXEN_NUM_FLASH_SECTORS (64) |
66 | #define NETXEN_FLASH_SECTOR_SIZE (64 * 1024) | 77 | #define NETXEN_FLASH_SECTOR_SIZE (64 * 1024) |
@@ -614,6 +625,7 @@ struct netxen_new_user_info { | |||
614 | #define NX_P2_MN_ROMIMAGE 0 | 625 | #define NX_P2_MN_ROMIMAGE 0 |
615 | #define NX_P3_CT_ROMIMAGE 1 | 626 | #define NX_P3_CT_ROMIMAGE 1 |
616 | #define NX_P3_MN_ROMIMAGE 2 | 627 | #define NX_P3_MN_ROMIMAGE 2 |
628 | #define NX_FLASH_ROMIMAGE 3 | ||
617 | 629 | ||
618 | #define NETXEN_USER_START_OLD NETXEN_PXE_START /* for backward compatibility */ | 630 | #define NETXEN_USER_START_OLD NETXEN_PXE_START /* for backward compatibility */ |
619 | 631 | ||
@@ -1243,7 +1255,7 @@ struct netxen_adapter { | |||
1243 | u32 resv3; | 1255 | u32 resv3; |
1244 | 1256 | ||
1245 | u8 has_link_events; | 1257 | u8 has_link_events; |
1246 | u8 resv1; | 1258 | u8 fw_type; |
1247 | u16 tx_context_id; | 1259 | u16 tx_context_id; |
1248 | u16 mtu; | 1260 | u16 mtu; |
1249 | u16 is_up; | 1261 | u16 is_up; |
@@ -1387,6 +1399,7 @@ void netxen_free_adapter_offload(struct netxen_adapter *adapter); | |||
1387 | int netxen_initialize_adapter_offload(struct netxen_adapter *adapter); | 1399 | int netxen_initialize_adapter_offload(struct netxen_adapter *adapter); |
1388 | int netxen_phantom_init(struct netxen_adapter *adapter, int pegtune_val); | 1400 | int netxen_phantom_init(struct netxen_adapter *adapter, int pegtune_val); |
1389 | int netxen_load_firmware(struct netxen_adapter *adapter); | 1401 | int netxen_load_firmware(struct netxen_adapter *adapter); |
1402 | int netxen_need_fw_reset(struct netxen_adapter *adapter); | ||
1390 | void netxen_request_firmware(struct netxen_adapter *adapter); | 1403 | void netxen_request_firmware(struct netxen_adapter *adapter); |
1391 | void netxen_release_firmware(struct netxen_adapter *adapter); | 1404 | void netxen_release_firmware(struct netxen_adapter *adapter); |
1392 | int netxen_pinit_from_rom(struct netxen_adapter *adapter, int verbose); | 1405 | int netxen_pinit_from_rom(struct netxen_adapter *adapter, int verbose); |
diff --git a/drivers/net/netxen/netxen_nic_hdr.h b/drivers/net/netxen/netxen_nic_hdr.h index 3cc047844af..82410367564 100644 --- a/drivers/net/netxen/netxen_nic_hdr.h +++ b/drivers/net/netxen/netxen_nic_hdr.h | |||
@@ -853,6 +853,7 @@ enum { | |||
853 | #define NX_PEG_TUNE_CAPABILITY (NETXEN_CAM_RAM(0x02c)) | 853 | #define NX_PEG_TUNE_CAPABILITY (NETXEN_CAM_RAM(0x02c)) |
854 | 854 | ||
855 | #define NETXEN_CAM_RAM_DMA_WATCHDOG_CTRL (0x14) | 855 | #define NETXEN_CAM_RAM_DMA_WATCHDOG_CTRL (0x14) |
856 | #define NETXEN_PEG_ALIVE_COUNTER (NETXEN_CAM_RAM(0xb0)) | ||
856 | 857 | ||
857 | #define ISR_MSI_INT_TRIGGER(FUNC) (NETXEN_PCIX_PS_REG(PCIX_MSI_F(FUNC))) | 858 | #define ISR_MSI_INT_TRIGGER(FUNC) (NETXEN_PCIX_PS_REG(PCIX_MSI_F(FUNC))) |
858 | #define ISR_LEGACY_INT_TRIGGERED(VAL) (((VAL) & 0x300) == 0x200) | 859 | #define ISR_LEGACY_INT_TRIGGERED(VAL) (((VAL) & 0x300) == 0x200) |
diff --git a/drivers/net/netxen/netxen_nic_init.c b/drivers/net/netxen/netxen_nic_init.c index 055bb61d6e7..b899bd51fcd 100644 --- a/drivers/net/netxen/netxen_nic_init.c +++ b/drivers/net/netxen/netxen_nic_init.c | |||
@@ -684,11 +684,84 @@ int netxen_pinit_from_rom(struct netxen_adapter *adapter, int verbose) | |||
684 | } | 684 | } |
685 | 685 | ||
686 | int | 686 | int |
687 | netxen_need_fw_reset(struct netxen_adapter *adapter) | ||
688 | { | ||
689 | u32 count, old_count; | ||
690 | u32 val, version, major, minor, build; | ||
691 | int i, timeout; | ||
692 | u8 fw_type; | ||
693 | |||
694 | /* NX2031 firmware doesn't support heartbit */ | ||
695 | if (NX_IS_REVISION_P2(adapter->ahw.revision_id)) | ||
696 | return 1; | ||
697 | |||
698 | /* last attempt had failed */ | ||
699 | if (NXRD32(adapter, CRB_CMDPEG_STATE) == PHAN_INITIALIZE_FAILED) | ||
700 | return 1; | ||
701 | |||
702 | old_count = count = NXRD32(adapter, NETXEN_PEG_ALIVE_COUNTER); | ||
703 | |||
704 | for (i = 0; i < 10; i++) { | ||
705 | |||
706 | timeout = msleep_interruptible(200); | ||
707 | if (timeout) { | ||
708 | NXWR32(adapter, CRB_CMDPEG_STATE, | ||
709 | PHAN_INITIALIZE_FAILED); | ||
710 | return -EINTR; | ||
711 | } | ||
712 | |||
713 | count = NXRD32(adapter, NETXEN_PEG_ALIVE_COUNTER); | ||
714 | if (count != old_count) | ||
715 | break; | ||
716 | } | ||
717 | |||
718 | /* firmware is dead */ | ||
719 | if (count == old_count) | ||
720 | return 1; | ||
721 | |||
722 | /* check if we have got newer or different file firmware */ | ||
723 | if (adapter->fw) { | ||
724 | |||
725 | const struct firmware *fw = adapter->fw; | ||
726 | |||
727 | val = cpu_to_le32(*(u32 *)&fw->data[NX_FW_VERSION_OFFSET]); | ||
728 | version = NETXEN_DECODE_VERSION(val); | ||
729 | |||
730 | major = NXRD32(adapter, NETXEN_FW_VERSION_MAJOR); | ||
731 | minor = NXRD32(adapter, NETXEN_FW_VERSION_MINOR); | ||
732 | build = NXRD32(adapter, NETXEN_FW_VERSION_SUB); | ||
733 | |||
734 | if (version > NETXEN_VERSION_CODE(major, minor, build)) | ||
735 | return 1; | ||
736 | |||
737 | if (version == NETXEN_VERSION_CODE(major, minor, build)) { | ||
738 | |||
739 | val = NXRD32(adapter, NETXEN_MIU_MN_CONTROL); | ||
740 | fw_type = (val & 0x4) ? | ||
741 | NX_P3_CT_ROMIMAGE : NX_P3_MN_ROMIMAGE; | ||
742 | |||
743 | if (adapter->fw_type != fw_type) | ||
744 | return 1; | ||
745 | } | ||
746 | } | ||
747 | |||
748 | return 0; | ||
749 | } | ||
750 | |||
751 | static char *fw_name[] = { | ||
752 | "nxromimg.bin", "nx3fwct.bin", "nx3fwmn.bin", "flash", | ||
753 | }; | ||
754 | |||
755 | int | ||
687 | netxen_load_firmware(struct netxen_adapter *adapter) | 756 | netxen_load_firmware(struct netxen_adapter *adapter) |
688 | { | 757 | { |
689 | u64 *ptr64; | 758 | u64 *ptr64; |
690 | u32 i, flashaddr, size; | 759 | u32 i, flashaddr, size; |
691 | const struct firmware *fw = adapter->fw; | 760 | const struct firmware *fw = adapter->fw; |
761 | struct pci_dev *pdev = adapter->pdev; | ||
762 | |||
763 | dev_info(&pdev->dev, "loading firmware from %s\n", | ||
764 | fw_name[adapter->fw_type]); | ||
692 | 765 | ||
693 | if (NX_IS_REVISION_P2(adapter->ahw.revision_id)) | 766 | if (NX_IS_REVISION_P2(adapter->ahw.revision_id)) |
694 | NXWR32(adapter, NETXEN_ROMUSB_GLB_CAS_RST, 1); | 767 | NXWR32(adapter, NETXEN_ROMUSB_GLB_CAS_RST, 1); |
@@ -756,7 +829,7 @@ static int | |||
756 | netxen_validate_firmware(struct netxen_adapter *adapter, const char *fwname) | 829 | netxen_validate_firmware(struct netxen_adapter *adapter, const char *fwname) |
757 | { | 830 | { |
758 | __le32 val; | 831 | __le32 val; |
759 | u32 major, minor, build, ver, min_ver, bios; | 832 | u32 ver, min_ver, bios; |
760 | struct pci_dev *pdev = adapter->pdev; | 833 | struct pci_dev *pdev = adapter->pdev; |
761 | const struct firmware *fw = adapter->fw; | 834 | const struct firmware *fw = adapter->fw; |
762 | 835 | ||
@@ -768,21 +841,18 @@ netxen_validate_firmware(struct netxen_adapter *adapter, const char *fwname) | |||
768 | return -EINVAL; | 841 | return -EINVAL; |
769 | 842 | ||
770 | val = cpu_to_le32(*(u32 *)&fw->data[NX_FW_VERSION_OFFSET]); | 843 | val = cpu_to_le32(*(u32 *)&fw->data[NX_FW_VERSION_OFFSET]); |
771 | major = (__force u32)val & 0xff; | ||
772 | minor = ((__force u32)val >> 8) & 0xff; | ||
773 | build = (__force u32)val >> 16; | ||
774 | 844 | ||
775 | if (NX_IS_REVISION_P3(adapter->ahw.revision_id)) | 845 | if (NX_IS_REVISION_P3(adapter->ahw.revision_id)) |
776 | min_ver = NETXEN_VERSION_CODE(4, 0, 216); | 846 | min_ver = NETXEN_VERSION_CODE(4, 0, 216); |
777 | else | 847 | else |
778 | min_ver = NETXEN_VERSION_CODE(3, 4, 216); | 848 | min_ver = NETXEN_VERSION_CODE(3, 4, 216); |
779 | 849 | ||
780 | ver = NETXEN_VERSION_CODE(major, minor, build); | 850 | ver = NETXEN_DECODE_VERSION(val); |
781 | 851 | ||
782 | if ((major > _NETXEN_NIC_LINUX_MAJOR) || (ver < min_ver)) { | 852 | if ((_major(ver) > _NETXEN_NIC_LINUX_MAJOR) || (ver < min_ver)) { |
783 | dev_err(&pdev->dev, | 853 | dev_err(&pdev->dev, |
784 | "%s: firmware version %d.%d.%d unsupported\n", | 854 | "%s: firmware version %d.%d.%d unsupported\n", |
785 | fwname, major, minor, build); | 855 | fwname, _major(ver), _minor(ver), _build(ver)); |
786 | return -EINVAL; | 856 | return -EINVAL; |
787 | } | 857 | } |
788 | 858 | ||
@@ -798,22 +868,21 @@ netxen_validate_firmware(struct netxen_adapter *adapter, const char *fwname) | |||
798 | if (netxen_rom_fast_read(adapter, | 868 | if (netxen_rom_fast_read(adapter, |
799 | NX_FW_VERSION_OFFSET, (int *)&val)) | 869 | NX_FW_VERSION_OFFSET, (int *)&val)) |
800 | return -EIO; | 870 | return -EIO; |
801 | major = (__force u32)val & 0xff; | 871 | val = NETXEN_DECODE_VERSION(val); |
802 | minor = ((__force u32)val >> 8) & 0xff; | 872 | if (val > ver) { |
803 | build = (__force u32)val >> 16; | 873 | dev_info(&pdev->dev, "%s: firmware is older than flash\n", |
804 | if (NETXEN_VERSION_CODE(major, minor, build) > ver) | 874 | fwname); |
805 | return -EINVAL; | 875 | return -EINVAL; |
876 | } | ||
806 | 877 | ||
807 | NXWR32(adapter, NETXEN_CAM_RAM(0x1fc), NETXEN_BDINFO_MAGIC); | 878 | NXWR32(adapter, NETXEN_CAM_RAM(0x1fc), NETXEN_BDINFO_MAGIC); |
808 | return 0; | 879 | return 0; |
809 | } | 880 | } |
810 | 881 | ||
811 | static char *fw_name[] = { "nxromimg.bin", "nx3fwct.bin", "nx3fwmn.bin" }; | ||
812 | |||
813 | void netxen_request_firmware(struct netxen_adapter *adapter) | 882 | void netxen_request_firmware(struct netxen_adapter *adapter) |
814 | { | 883 | { |
815 | u32 capability, flashed_ver; | 884 | u32 capability, flashed_ver; |
816 | int fw_type; | 885 | u8 fw_type; |
817 | struct pci_dev *pdev = adapter->pdev; | 886 | struct pci_dev *pdev = adapter->pdev; |
818 | int rc = 0; | 887 | int rc = 0; |
819 | 888 | ||
@@ -830,6 +899,8 @@ request_mn: | |||
830 | 899 | ||
831 | netxen_rom_fast_read(adapter, | 900 | netxen_rom_fast_read(adapter, |
832 | NX_FW_VERSION_OFFSET, (int *)&flashed_ver); | 901 | NX_FW_VERSION_OFFSET, (int *)&flashed_ver); |
902 | flashed_ver = NETXEN_DECODE_VERSION(flashed_ver); | ||
903 | |||
833 | if (flashed_ver >= NETXEN_VERSION_CODE(4, 0, 220)) { | 904 | if (flashed_ver >= NETXEN_VERSION_CODE(4, 0, 220)) { |
834 | capability = NXRD32(adapter, NX_PEG_TUNE_CAPABILITY); | 905 | capability = NXRD32(adapter, NX_PEG_TUNE_CAPABILITY); |
835 | if (capability & NX_PEG_TUNE_MN_PRESENT) { | 906 | if (capability & NX_PEG_TUNE_MN_PRESENT) { |
@@ -838,6 +909,10 @@ request_mn: | |||
838 | } | 909 | } |
839 | } | 910 | } |
840 | 911 | ||
912 | fw_type = NX_FLASH_ROMIMAGE; | ||
913 | adapter->fw = NULL; | ||
914 | goto done; | ||
915 | |||
841 | request_fw: | 916 | request_fw: |
842 | rc = request_firmware(&adapter->fw, fw_name[fw_type], &pdev->dev); | 917 | rc = request_firmware(&adapter->fw, fw_name[fw_type], &pdev->dev); |
843 | if (rc != 0) { | 918 | if (rc != 0) { |
@@ -846,6 +921,7 @@ request_fw: | |||
846 | goto request_mn; | 921 | goto request_mn; |
847 | } | 922 | } |
848 | 923 | ||
924 | fw_type = NX_FLASH_ROMIMAGE; | ||
849 | adapter->fw = NULL; | 925 | adapter->fw = NULL; |
850 | goto done; | 926 | goto done; |
851 | } | 927 | } |
@@ -859,16 +935,13 @@ request_fw: | |||
859 | goto request_mn; | 935 | goto request_mn; |
860 | } | 936 | } |
861 | 937 | ||
938 | fw_type = NX_FLASH_ROMIMAGE; | ||
862 | adapter->fw = NULL; | 939 | adapter->fw = NULL; |
863 | goto done; | 940 | goto done; |
864 | } | 941 | } |
865 | 942 | ||
866 | done: | 943 | done: |
867 | if (adapter->fw) | 944 | adapter->fw_type = fw_type; |
868 | dev_info(&pdev->dev, "loading firmware from file %s\n", | ||
869 | fw_name[fw_type]); | ||
870 | else | ||
871 | dev_info(&pdev->dev, "loading firmware from flash\n"); | ||
872 | } | 945 | } |
873 | 946 | ||
874 | 947 | ||
diff --git a/drivers/net/netxen/netxen_nic_main.c b/drivers/net/netxen/netxen_nic_main.c index 2919a2d12bf..27539ddf94c 100644 --- a/drivers/net/netxen/netxen_nic_main.c +++ b/drivers/net/netxen/netxen_nic_main.c | |||
@@ -718,6 +718,10 @@ netxen_start_firmware(struct netxen_adapter *adapter, int request_fw) | |||
718 | if (request_fw) | 718 | if (request_fw) |
719 | netxen_request_firmware(adapter); | 719 | netxen_request_firmware(adapter); |
720 | 720 | ||
721 | err = netxen_need_fw_reset(adapter); | ||
722 | if (err <= 0) | ||
723 | return err; | ||
724 | |||
721 | if (first_boot != 0x55555555) { | 725 | if (first_boot != 0x55555555) { |
722 | NXWR32(adapter, CRB_CMDPEG_STATE, 0); | 726 | NXWR32(adapter, CRB_CMDPEG_STATE, 0); |
723 | netxen_pinit_from_rom(adapter, 0); | 727 | netxen_pinit_from_rom(adapter, 0); |
diff --git a/drivers/net/pci-skeleton.c b/drivers/net/pci-skeleton.c index 8c1f6988f39..89f7b2ad523 100644 --- a/drivers/net/pci-skeleton.c +++ b/drivers/net/pci-skeleton.c | |||
@@ -105,7 +105,7 @@ IVc. Errata | |||
105 | 105 | ||
106 | static char version[] __devinitdata = | 106 | static char version[] __devinitdata = |
107 | KERN_INFO NETDRV_DRIVER_LOAD_MSG "\n" | 107 | KERN_INFO NETDRV_DRIVER_LOAD_MSG "\n" |
108 | KERN_INFO " Support available from http://foo.com/bar/baz.html\n"; | 108 | " Support available from http://foo.com/bar/baz.html\n"; |
109 | 109 | ||
110 | /* define to 1 to enable PIO instead of MMIO */ | 110 | /* define to 1 to enable PIO instead of MMIO */ |
111 | #undef USE_IO_OPS | 111 | #undef USE_IO_OPS |
diff --git a/drivers/net/pcmcia/ibmtr_cs.c b/drivers/net/pcmcia/ibmtr_cs.c index f51944b28cf..06618af1a46 100644 --- a/drivers/net/pcmcia/ibmtr_cs.c +++ b/drivers/net/pcmcia/ibmtr_cs.c | |||
@@ -298,14 +298,11 @@ static int __devinit ibmtr_config(struct pcmcia_device *link) | |||
298 | 298 | ||
299 | strcpy(info->node.dev_name, dev->name); | 299 | strcpy(info->node.dev_name, dev->name); |
300 | 300 | ||
301 | printk(KERN_INFO "%s: port %#3lx, irq %d,", | 301 | printk(KERN_INFO |
302 | dev->name, dev->base_addr, dev->irq); | 302 | "%s: port %#3lx, irq %d, mmio %#5lx, sram %#5lx, hwaddr=%pM\n", |
303 | printk (" mmio %#5lx,", (u_long)ti->mmio); | 303 | dev->name, dev->base_addr, dev->irq, |
304 | printk (" sram %#5lx,", (u_long)ti->sram_base << 12); | 304 | (u_long)ti->mmio, (u_long)(ti->sram_base << 12), |
305 | printk ("\n" KERN_INFO " hwaddr="); | 305 | dev->dev_addr); |
306 | for (i = 0; i < TR_ALEN; i++) | ||
307 | printk("%02X", dev->dev_addr[i]); | ||
308 | printk("\n"); | ||
309 | return 0; | 306 | return 0; |
310 | 307 | ||
311 | cs_failed: | 308 | cs_failed: |
diff --git a/drivers/net/pcmcia/nmclan_cs.c b/drivers/net/pcmcia/nmclan_cs.c index 02ef63ed1f9..36de91baf23 100644 --- a/drivers/net/pcmcia/nmclan_cs.c +++ b/drivers/net/pcmcia/nmclan_cs.c | |||
@@ -1425,15 +1425,12 @@ static void BuildLAF(int *ladrf, int *adr) | |||
1425 | ladrf[byte] |= (1 << (hashcode & 7)); | 1425 | ladrf[byte] |= (1 << (hashcode & 7)); |
1426 | 1426 | ||
1427 | #ifdef PCMCIA_DEBUG | 1427 | #ifdef PCMCIA_DEBUG |
1428 | if (pc_debug > 2) { | 1428 | if (pc_debug > 2) |
1429 | printk(KERN_DEBUG " adr ="); | 1429 | printk(KERN_DEBUG " adr =%pM\n", adr); |
1430 | for (i = 0; i < 6; i++) | 1430 | printk(KERN_DEBUG " hashcode = %d(decimal), ladrf[0:63] =", hashcode); |
1431 | printk(" %02X", adr[i]); | 1431 | for (i = 0; i < 8; i++) |
1432 | printk("\n" KERN_DEBUG " hashcode = %d(decimal), ladrf[0:63]" | 1432 | printk(KERN_CONT " %02X", ladrf[i]); |
1433 | " =", hashcode); | 1433 | printk(KERN_CONT "\n"); |
1434 | for (i = 0; i < 8; i++) | ||
1435 | printk(" %02X", ladrf[i]); | ||
1436 | printk("\n"); | ||
1437 | } | 1434 | } |
1438 | #endif | 1435 | #endif |
1439 | } /* BuildLAF */ | 1436 | } /* BuildLAF */ |
diff --git a/drivers/net/pcmcia/pcnet_cs.c b/drivers/net/pcmcia/pcnet_cs.c index 652a3688836..9ef1c1bfa83 100644 --- a/drivers/net/pcmcia/pcnet_cs.c +++ b/drivers/net/pcmcia/pcnet_cs.c | |||
@@ -1727,6 +1727,7 @@ static struct pcmcia_device_id pcnet_ids[] = { | |||
1727 | PCMCIA_DEVICE_PROD_ID12("PRETEC", "Ethernet CompactLAN 10BaseT 3.3V", 0xebf91155, 0x7f5a4f50), | 1727 | PCMCIA_DEVICE_PROD_ID12("PRETEC", "Ethernet CompactLAN 10BaseT 3.3V", 0xebf91155, 0x7f5a4f50), |
1728 | PCMCIA_DEVICE_PROD_ID12("Psion Dacom", "Gold Card Ethernet", 0xf5f025c2, 0x3a30e110), | 1728 | PCMCIA_DEVICE_PROD_ID12("Psion Dacom", "Gold Card Ethernet", 0xf5f025c2, 0x3a30e110), |
1729 | PCMCIA_DEVICE_PROD_ID12("=RELIA==", "Ethernet", 0xcdd0644a, 0x00b2e941), | 1729 | PCMCIA_DEVICE_PROD_ID12("=RELIA==", "Ethernet", 0xcdd0644a, 0x00b2e941), |
1730 | PCMCIA_DEVICE_PROD_ID12("RIOS Systems Co.", "PC CARD3 ETHERNET", 0x7dd33481, 0x10b41826), | ||
1730 | PCMCIA_DEVICE_PROD_ID12("RP", "1625B Ethernet NE2000 Compatible", 0xe3e66e22, 0xb96150df), | 1731 | PCMCIA_DEVICE_PROD_ID12("RP", "1625B Ethernet NE2000 Compatible", 0xe3e66e22, 0xb96150df), |
1731 | PCMCIA_DEVICE_PROD_ID12("RPTI", "EP400 Ethernet NE2000 Compatible", 0xdc6f88fd, 0x4a7e2ae0), | 1732 | PCMCIA_DEVICE_PROD_ID12("RPTI", "EP400 Ethernet NE2000 Compatible", 0xdc6f88fd, 0x4a7e2ae0), |
1732 | PCMCIA_DEVICE_PROD_ID12("RPTI", "EP401 Ethernet NE2000 Compatible", 0xdc6f88fd, 0x4bcbd7fd), | 1733 | PCMCIA_DEVICE_PROD_ID12("RPTI", "EP401 Ethernet NE2000 Compatible", 0xdc6f88fd, 0x4bcbd7fd), |
diff --git a/drivers/net/pcnet32.c b/drivers/net/pcnet32.c index 1c35e1d637a..28368157dac 100644 --- a/drivers/net/pcnet32.c +++ b/drivers/net/pcnet32.c | |||
@@ -485,7 +485,7 @@ static void pcnet32_realloc_tx_ring(struct net_device *dev, | |||
485 | &new_ring_dma_addr); | 485 | &new_ring_dma_addr); |
486 | if (new_tx_ring == NULL) { | 486 | if (new_tx_ring == NULL) { |
487 | if (netif_msg_drv(lp)) | 487 | if (netif_msg_drv(lp)) |
488 | printk("\n" KERN_ERR | 488 | printk(KERN_ERR |
489 | "%s: Consistent memory allocation failed.\n", | 489 | "%s: Consistent memory allocation failed.\n", |
490 | dev->name); | 490 | dev->name); |
491 | return; | 491 | return; |
@@ -496,7 +496,7 @@ static void pcnet32_realloc_tx_ring(struct net_device *dev, | |||
496 | GFP_ATOMIC); | 496 | GFP_ATOMIC); |
497 | if (!new_dma_addr_list) { | 497 | if (!new_dma_addr_list) { |
498 | if (netif_msg_drv(lp)) | 498 | if (netif_msg_drv(lp)) |
499 | printk("\n" KERN_ERR | 499 | printk(KERN_ERR |
500 | "%s: Memory allocation failed.\n", dev->name); | 500 | "%s: Memory allocation failed.\n", dev->name); |
501 | goto free_new_tx_ring; | 501 | goto free_new_tx_ring; |
502 | } | 502 | } |
@@ -505,7 +505,7 @@ static void pcnet32_realloc_tx_ring(struct net_device *dev, | |||
505 | GFP_ATOMIC); | 505 | GFP_ATOMIC); |
506 | if (!new_skb_list) { | 506 | if (!new_skb_list) { |
507 | if (netif_msg_drv(lp)) | 507 | if (netif_msg_drv(lp)) |
508 | printk("\n" KERN_ERR | 508 | printk(KERN_ERR |
509 | "%s: Memory allocation failed.\n", dev->name); | 509 | "%s: Memory allocation failed.\n", dev->name); |
510 | goto free_new_lists; | 510 | goto free_new_lists; |
511 | } | 511 | } |
@@ -563,7 +563,7 @@ static void pcnet32_realloc_rx_ring(struct net_device *dev, | |||
563 | &new_ring_dma_addr); | 563 | &new_ring_dma_addr); |
564 | if (new_rx_ring == NULL) { | 564 | if (new_rx_ring == NULL) { |
565 | if (netif_msg_drv(lp)) | 565 | if (netif_msg_drv(lp)) |
566 | printk("\n" KERN_ERR | 566 | printk(KERN_ERR |
567 | "%s: Consistent memory allocation failed.\n", | 567 | "%s: Consistent memory allocation failed.\n", |
568 | dev->name); | 568 | dev->name); |
569 | return; | 569 | return; |
@@ -574,7 +574,7 @@ static void pcnet32_realloc_rx_ring(struct net_device *dev, | |||
574 | GFP_ATOMIC); | 574 | GFP_ATOMIC); |
575 | if (!new_dma_addr_list) { | 575 | if (!new_dma_addr_list) { |
576 | if (netif_msg_drv(lp)) | 576 | if (netif_msg_drv(lp)) |
577 | printk("\n" KERN_ERR | 577 | printk(KERN_ERR |
578 | "%s: Memory allocation failed.\n", dev->name); | 578 | "%s: Memory allocation failed.\n", dev->name); |
579 | goto free_new_rx_ring; | 579 | goto free_new_rx_ring; |
580 | } | 580 | } |
@@ -583,7 +583,7 @@ static void pcnet32_realloc_rx_ring(struct net_device *dev, | |||
583 | GFP_ATOMIC); | 583 | GFP_ATOMIC); |
584 | if (!new_skb_list) { | 584 | if (!new_skb_list) { |
585 | if (netif_msg_drv(lp)) | 585 | if (netif_msg_drv(lp)) |
586 | printk("\n" KERN_ERR | 586 | printk(KERN_ERR |
587 | "%s: Memory allocation failed.\n", dev->name); | 587 | "%s: Memory allocation failed.\n", dev->name); |
588 | goto free_new_lists; | 588 | goto free_new_lists; |
589 | } | 589 | } |
@@ -1766,38 +1766,38 @@ pcnet32_probe1(unsigned long ioaddr, int shared, struct pci_dev *pdev) | |||
1766 | /* Version 0x2623 and 0x2624 */ | 1766 | /* Version 0x2623 and 0x2624 */ |
1767 | if (((chip_version + 1) & 0xfffe) == 0x2624) { | 1767 | if (((chip_version + 1) & 0xfffe) == 0x2624) { |
1768 | i = a->read_csr(ioaddr, 80) & 0x0C00; /* Check tx_start_pt */ | 1768 | i = a->read_csr(ioaddr, 80) & 0x0C00; /* Check tx_start_pt */ |
1769 | printk("\n" KERN_INFO " tx_start_pt(0x%04x):", i); | 1769 | printk(KERN_INFO " tx_start_pt(0x%04x):", i); |
1770 | switch (i >> 10) { | 1770 | switch (i >> 10) { |
1771 | case 0: | 1771 | case 0: |
1772 | printk(" 20 bytes,"); | 1772 | printk(KERN_CONT " 20 bytes,"); |
1773 | break; | 1773 | break; |
1774 | case 1: | 1774 | case 1: |
1775 | printk(" 64 bytes,"); | 1775 | printk(KERN_CONT " 64 bytes,"); |
1776 | break; | 1776 | break; |
1777 | case 2: | 1777 | case 2: |
1778 | printk(" 128 bytes,"); | 1778 | printk(KERN_CONT " 128 bytes,"); |
1779 | break; | 1779 | break; |
1780 | case 3: | 1780 | case 3: |
1781 | printk("~220 bytes,"); | 1781 | printk(KERN_CONT "~220 bytes,"); |
1782 | break; | 1782 | break; |
1783 | } | 1783 | } |
1784 | i = a->read_bcr(ioaddr, 18); /* Check Burst/Bus control */ | 1784 | i = a->read_bcr(ioaddr, 18); /* Check Burst/Bus control */ |
1785 | printk(" BCR18(%x):", i & 0xffff); | 1785 | printk(KERN_CONT " BCR18(%x):", i & 0xffff); |
1786 | if (i & (1 << 5)) | 1786 | if (i & (1 << 5)) |
1787 | printk("BurstWrEn "); | 1787 | printk(KERN_CONT "BurstWrEn "); |
1788 | if (i & (1 << 6)) | 1788 | if (i & (1 << 6)) |
1789 | printk("BurstRdEn "); | 1789 | printk(KERN_CONT "BurstRdEn "); |
1790 | if (i & (1 << 7)) | 1790 | if (i & (1 << 7)) |
1791 | printk("DWordIO "); | 1791 | printk(KERN_CONT "DWordIO "); |
1792 | if (i & (1 << 11)) | 1792 | if (i & (1 << 11)) |
1793 | printk("NoUFlow "); | 1793 | printk(KERN_CONT "NoUFlow "); |
1794 | i = a->read_bcr(ioaddr, 25); | 1794 | i = a->read_bcr(ioaddr, 25); |
1795 | printk("\n" KERN_INFO " SRAMSIZE=0x%04x,", i << 8); | 1795 | printk(KERN_INFO " SRAMSIZE=0x%04x,", i << 8); |
1796 | i = a->read_bcr(ioaddr, 26); | 1796 | i = a->read_bcr(ioaddr, 26); |
1797 | printk(" SRAM_BND=0x%04x,", i << 8); | 1797 | printk(KERN_CONT " SRAM_BND=0x%04x,", i << 8); |
1798 | i = a->read_bcr(ioaddr, 27); | 1798 | i = a->read_bcr(ioaddr, 27); |
1799 | if (i & (1 << 14)) | 1799 | if (i & (1 << 14)) |
1800 | printk("LowLatRx"); | 1800 | printk(KERN_CONT "LowLatRx"); |
1801 | } | 1801 | } |
1802 | } | 1802 | } |
1803 | 1803 | ||
@@ -1996,7 +1996,7 @@ static int pcnet32_alloc_ring(struct net_device *dev, const char *name) | |||
1996 | &lp->tx_ring_dma_addr); | 1996 | &lp->tx_ring_dma_addr); |
1997 | if (lp->tx_ring == NULL) { | 1997 | if (lp->tx_ring == NULL) { |
1998 | if (netif_msg_drv(lp)) | 1998 | if (netif_msg_drv(lp)) |
1999 | printk("\n" KERN_ERR PFX | 1999 | printk(KERN_ERR PFX |
2000 | "%s: Consistent memory allocation failed.\n", | 2000 | "%s: Consistent memory allocation failed.\n", |
2001 | name); | 2001 | name); |
2002 | return -ENOMEM; | 2002 | return -ENOMEM; |
@@ -2008,7 +2008,7 @@ static int pcnet32_alloc_ring(struct net_device *dev, const char *name) | |||
2008 | &lp->rx_ring_dma_addr); | 2008 | &lp->rx_ring_dma_addr); |
2009 | if (lp->rx_ring == NULL) { | 2009 | if (lp->rx_ring == NULL) { |
2010 | if (netif_msg_drv(lp)) | 2010 | if (netif_msg_drv(lp)) |
2011 | printk("\n" KERN_ERR PFX | 2011 | printk(KERN_ERR PFX |
2012 | "%s: Consistent memory allocation failed.\n", | 2012 | "%s: Consistent memory allocation failed.\n", |
2013 | name); | 2013 | name); |
2014 | return -ENOMEM; | 2014 | return -ENOMEM; |
@@ -2018,7 +2018,7 @@ static int pcnet32_alloc_ring(struct net_device *dev, const char *name) | |||
2018 | GFP_ATOMIC); | 2018 | GFP_ATOMIC); |
2019 | if (!lp->tx_dma_addr) { | 2019 | if (!lp->tx_dma_addr) { |
2020 | if (netif_msg_drv(lp)) | 2020 | if (netif_msg_drv(lp)) |
2021 | printk("\n" KERN_ERR PFX | 2021 | printk(KERN_ERR PFX |
2022 | "%s: Memory allocation failed.\n", name); | 2022 | "%s: Memory allocation failed.\n", name); |
2023 | return -ENOMEM; | 2023 | return -ENOMEM; |
2024 | } | 2024 | } |
@@ -2027,7 +2027,7 @@ static int pcnet32_alloc_ring(struct net_device *dev, const char *name) | |||
2027 | GFP_ATOMIC); | 2027 | GFP_ATOMIC); |
2028 | if (!lp->rx_dma_addr) { | 2028 | if (!lp->rx_dma_addr) { |
2029 | if (netif_msg_drv(lp)) | 2029 | if (netif_msg_drv(lp)) |
2030 | printk("\n" KERN_ERR PFX | 2030 | printk(KERN_ERR PFX |
2031 | "%s: Memory allocation failed.\n", name); | 2031 | "%s: Memory allocation failed.\n", name); |
2032 | return -ENOMEM; | 2032 | return -ENOMEM; |
2033 | } | 2033 | } |
@@ -2036,7 +2036,7 @@ static int pcnet32_alloc_ring(struct net_device *dev, const char *name) | |||
2036 | GFP_ATOMIC); | 2036 | GFP_ATOMIC); |
2037 | if (!lp->tx_skbuff) { | 2037 | if (!lp->tx_skbuff) { |
2038 | if (netif_msg_drv(lp)) | 2038 | if (netif_msg_drv(lp)) |
2039 | printk("\n" KERN_ERR PFX | 2039 | printk(KERN_ERR PFX |
2040 | "%s: Memory allocation failed.\n", name); | 2040 | "%s: Memory allocation failed.\n", name); |
2041 | return -ENOMEM; | 2041 | return -ENOMEM; |
2042 | } | 2042 | } |
@@ -2045,7 +2045,7 @@ static int pcnet32_alloc_ring(struct net_device *dev, const char *name) | |||
2045 | GFP_ATOMIC); | 2045 | GFP_ATOMIC); |
2046 | if (!lp->rx_skbuff) { | 2046 | if (!lp->rx_skbuff) { |
2047 | if (netif_msg_drv(lp)) | 2047 | if (netif_msg_drv(lp)) |
2048 | printk("\n" KERN_ERR PFX | 2048 | printk(KERN_ERR PFX |
2049 | "%s: Memory allocation failed.\n", name); | 2049 | "%s: Memory allocation failed.\n", name); |
2050 | return -ENOMEM; | 2050 | return -ENOMEM; |
2051 | } | 2051 | } |
diff --git a/drivers/net/phy/phy.c b/drivers/net/phy/phy.c index 61755cbd978..eda94fcd406 100644 --- a/drivers/net/phy/phy.c +++ b/drivers/net/phy/phy.c | |||
@@ -928,13 +928,32 @@ static void phy_state_machine(struct work_struct *work) | |||
928 | * Otherwise, it's 0, and we're | 928 | * Otherwise, it's 0, and we're |
929 | * still waiting for AN */ | 929 | * still waiting for AN */ |
930 | if (err > 0) { | 930 | if (err > 0) { |
931 | phydev->state = PHY_RUNNING; | 931 | err = phy_read_status(phydev); |
932 | if (err) | ||
933 | break; | ||
934 | |||
935 | if (phydev->link) { | ||
936 | phydev->state = PHY_RUNNING; | ||
937 | netif_carrier_on(phydev->attached_dev); | ||
938 | } else | ||
939 | phydev->state = PHY_NOLINK; | ||
940 | phydev->adjust_link(phydev->attached_dev); | ||
932 | } else { | 941 | } else { |
933 | phydev->state = PHY_AN; | 942 | phydev->state = PHY_AN; |
934 | phydev->link_timeout = PHY_AN_TIMEOUT; | 943 | phydev->link_timeout = PHY_AN_TIMEOUT; |
935 | } | 944 | } |
936 | } else | 945 | } else { |
937 | phydev->state = PHY_RUNNING; | 946 | err = phy_read_status(phydev); |
947 | if (err) | ||
948 | break; | ||
949 | |||
950 | if (phydev->link) { | ||
951 | phydev->state = PHY_RUNNING; | ||
952 | netif_carrier_on(phydev->attached_dev); | ||
953 | } else | ||
954 | phydev->state = PHY_NOLINK; | ||
955 | phydev->adjust_link(phydev->attached_dev); | ||
956 | } | ||
938 | break; | 957 | break; |
939 | } | 958 | } |
940 | 959 | ||
diff --git a/drivers/net/qlge/qlge.h b/drivers/net/qlge/qlge.h index 156e02e8905..6ed5317ab1c 100644 --- a/drivers/net/qlge/qlge.h +++ b/drivers/net/qlge/qlge.h | |||
@@ -1607,6 +1607,8 @@ int ql_mb_get_fw_state(struct ql_adapter *qdev); | |||
1607 | int ql_cam_route_initialize(struct ql_adapter *qdev); | 1607 | int ql_cam_route_initialize(struct ql_adapter *qdev); |
1608 | int ql_read_mpi_reg(struct ql_adapter *qdev, u32 reg, u32 *data); | 1608 | int ql_read_mpi_reg(struct ql_adapter *qdev, u32 reg, u32 *data); |
1609 | int ql_mb_about_fw(struct ql_adapter *qdev); | 1609 | int ql_mb_about_fw(struct ql_adapter *qdev); |
1610 | void ql_link_on(struct ql_adapter *qdev); | ||
1611 | void ql_link_off(struct ql_adapter *qdev); | ||
1610 | 1612 | ||
1611 | #if 1 | 1613 | #if 1 |
1612 | #define QL_ALL_DUMP | 1614 | #define QL_ALL_DUMP |
diff --git a/drivers/net/qlge/qlge_ethtool.c b/drivers/net/qlge/qlge_ethtool.c index 37c99fe7977..eb6a9ee640e 100644 --- a/drivers/net/qlge/qlge_ethtool.c +++ b/drivers/net/qlge/qlge_ethtool.c | |||
@@ -59,7 +59,7 @@ static int ql_update_ring_coalescing(struct ql_adapter *qdev) | |||
59 | cqicb->pkt_delay = | 59 | cqicb->pkt_delay = |
60 | cpu_to_le16(qdev->tx_max_coalesced_frames); | 60 | cpu_to_le16(qdev->tx_max_coalesced_frames); |
61 | cqicb->flags = FLAGS_LI; | 61 | cqicb->flags = FLAGS_LI; |
62 | status = ql_write_cfg(qdev, cqicb, sizeof(cqicb), | 62 | status = ql_write_cfg(qdev, cqicb, sizeof(*cqicb), |
63 | CFG_LCQ, rx_ring->cq_id); | 63 | CFG_LCQ, rx_ring->cq_id); |
64 | if (status) { | 64 | if (status) { |
65 | QPRINTK(qdev, IFUP, ERR, | 65 | QPRINTK(qdev, IFUP, ERR, |
@@ -82,7 +82,7 @@ static int ql_update_ring_coalescing(struct ql_adapter *qdev) | |||
82 | cqicb->pkt_delay = | 82 | cqicb->pkt_delay = |
83 | cpu_to_le16(qdev->rx_max_coalesced_frames); | 83 | cpu_to_le16(qdev->rx_max_coalesced_frames); |
84 | cqicb->flags = FLAGS_LI; | 84 | cqicb->flags = FLAGS_LI; |
85 | status = ql_write_cfg(qdev, cqicb, sizeof(cqicb), | 85 | status = ql_write_cfg(qdev, cqicb, sizeof(*cqicb), |
86 | CFG_LCQ, rx_ring->cq_id); | 86 | CFG_LCQ, rx_ring->cq_id); |
87 | if (status) { | 87 | if (status) { |
88 | QPRINTK(qdev, IFUP, ERR, | 88 | QPRINTK(qdev, IFUP, ERR, |
diff --git a/drivers/net/qlge/qlge_main.c b/drivers/net/qlge/qlge_main.c index 90d1f76c0e8..5768af17f16 100644 --- a/drivers/net/qlge/qlge_main.c +++ b/drivers/net/qlge/qlge_main.c | |||
@@ -214,6 +214,10 @@ int ql_write_cfg(struct ql_adapter *qdev, void *ptr, int size, u32 bit, | |||
214 | return -ENOMEM; | 214 | return -ENOMEM; |
215 | } | 215 | } |
216 | 216 | ||
217 | status = ql_sem_spinlock(qdev, SEM_ICB_MASK); | ||
218 | if (status) | ||
219 | return status; | ||
220 | |||
217 | status = ql_wait_cfg(qdev, bit); | 221 | status = ql_wait_cfg(qdev, bit); |
218 | if (status) { | 222 | if (status) { |
219 | QPRINTK(qdev, IFUP, ERR, | 223 | QPRINTK(qdev, IFUP, ERR, |
@@ -221,12 +225,8 @@ int ql_write_cfg(struct ql_adapter *qdev, void *ptr, int size, u32 bit, | |||
221 | goto exit; | 225 | goto exit; |
222 | } | 226 | } |
223 | 227 | ||
224 | status = ql_sem_spinlock(qdev, SEM_ICB_MASK); | ||
225 | if (status) | ||
226 | goto exit; | ||
227 | ql_write32(qdev, ICB_L, (u32) map); | 228 | ql_write32(qdev, ICB_L, (u32) map); |
228 | ql_write32(qdev, ICB_H, (u32) (map >> 32)); | 229 | ql_write32(qdev, ICB_H, (u32) (map >> 32)); |
229 | ql_sem_unlock(qdev, SEM_ICB_MASK); /* does flush too */ | ||
230 | 230 | ||
231 | mask = CFG_Q_MASK | (bit << 16); | 231 | mask = CFG_Q_MASK | (bit << 16); |
232 | value = bit | (q_id << CFG_Q_SHIFT); | 232 | value = bit | (q_id << CFG_Q_SHIFT); |
@@ -237,6 +237,7 @@ int ql_write_cfg(struct ql_adapter *qdev, void *ptr, int size, u32 bit, | |||
237 | */ | 237 | */ |
238 | status = ql_wait_cfg(qdev, bit); | 238 | status = ql_wait_cfg(qdev, bit); |
239 | exit: | 239 | exit: |
240 | ql_sem_unlock(qdev, SEM_ICB_MASK); /* does flush too */ | ||
240 | pci_unmap_single(qdev->pdev, map, size, direction); | 241 | pci_unmap_single(qdev->pdev, map, size, direction); |
241 | return status; | 242 | return status; |
242 | } | 243 | } |
@@ -412,6 +413,57 @@ exit: | |||
412 | return status; | 413 | return status; |
413 | } | 414 | } |
414 | 415 | ||
416 | /* Set or clear MAC address in hardware. We sometimes | ||
417 | * have to clear it to prevent wrong frame routing | ||
418 | * especially in a bonding environment. | ||
419 | */ | ||
420 | static int ql_set_mac_addr(struct ql_adapter *qdev, int set) | ||
421 | { | ||
422 | int status; | ||
423 | char zero_mac_addr[ETH_ALEN]; | ||
424 | char *addr; | ||
425 | |||
426 | if (set) { | ||
427 | addr = &qdev->ndev->dev_addr[0]; | ||
428 | QPRINTK(qdev, IFUP, DEBUG, | ||
429 | "Set Mac addr %02x:%02x:%02x:%02x:%02x:%02x\n", | ||
430 | addr[0], addr[1], addr[2], addr[3], | ||
431 | addr[4], addr[5]); | ||
432 | } else { | ||
433 | memset(zero_mac_addr, 0, ETH_ALEN); | ||
434 | addr = &zero_mac_addr[0]; | ||
435 | QPRINTK(qdev, IFUP, DEBUG, | ||
436 | "Clearing MAC address on %s\n", | ||
437 | qdev->ndev->name); | ||
438 | } | ||
439 | status = ql_sem_spinlock(qdev, SEM_MAC_ADDR_MASK); | ||
440 | if (status) | ||
441 | return status; | ||
442 | status = ql_set_mac_addr_reg(qdev, (u8 *) addr, | ||
443 | MAC_ADDR_TYPE_CAM_MAC, qdev->func * MAX_CQ); | ||
444 | ql_sem_unlock(qdev, SEM_MAC_ADDR_MASK); | ||
445 | if (status) | ||
446 | QPRINTK(qdev, IFUP, ERR, "Failed to init mac " | ||
447 | "address.\n"); | ||
448 | return status; | ||
449 | } | ||
450 | |||
451 | void ql_link_on(struct ql_adapter *qdev) | ||
452 | { | ||
453 | QPRINTK(qdev, LINK, ERR, "%s: Link is up.\n", | ||
454 | qdev->ndev->name); | ||
455 | netif_carrier_on(qdev->ndev); | ||
456 | ql_set_mac_addr(qdev, 1); | ||
457 | } | ||
458 | |||
459 | void ql_link_off(struct ql_adapter *qdev) | ||
460 | { | ||
461 | QPRINTK(qdev, LINK, ERR, "%s: Link is down.\n", | ||
462 | qdev->ndev->name); | ||
463 | netif_carrier_off(qdev->ndev); | ||
464 | ql_set_mac_addr(qdev, 0); | ||
465 | } | ||
466 | |||
415 | /* Get a specific frame routing value from the CAM. | 467 | /* Get a specific frame routing value from the CAM. |
416 | * Used for debug and reg dump. | 468 | * Used for debug and reg dump. |
417 | */ | 469 | */ |
@@ -1628,7 +1680,7 @@ static void ql_process_mac_tx_intr(struct ql_adapter *qdev, | |||
1628 | tx_ring = &qdev->tx_ring[mac_rsp->txq_idx]; | 1680 | tx_ring = &qdev->tx_ring[mac_rsp->txq_idx]; |
1629 | tx_ring_desc = &tx_ring->q[mac_rsp->tid]; | 1681 | tx_ring_desc = &tx_ring->q[mac_rsp->tid]; |
1630 | ql_unmap_send(qdev, tx_ring_desc, tx_ring_desc->map_cnt); | 1682 | ql_unmap_send(qdev, tx_ring_desc, tx_ring_desc->map_cnt); |
1631 | qdev->stats.tx_bytes += tx_ring_desc->map_cnt; | 1683 | qdev->stats.tx_bytes += (tx_ring_desc->skb)->len; |
1632 | qdev->stats.tx_packets++; | 1684 | qdev->stats.tx_packets++; |
1633 | dev_kfree_skb(tx_ring_desc->skb); | 1685 | dev_kfree_skb(tx_ring_desc->skb); |
1634 | tx_ring_desc->skb = NULL; | 1686 | tx_ring_desc->skb = NULL; |
@@ -1660,13 +1712,13 @@ static void ql_process_mac_tx_intr(struct ql_adapter *qdev, | |||
1660 | /* Fire up a handler to reset the MPI processor. */ | 1712 | /* Fire up a handler to reset the MPI processor. */ |
1661 | void ql_queue_fw_error(struct ql_adapter *qdev) | 1713 | void ql_queue_fw_error(struct ql_adapter *qdev) |
1662 | { | 1714 | { |
1663 | netif_carrier_off(qdev->ndev); | 1715 | ql_link_off(qdev); |
1664 | queue_delayed_work(qdev->workqueue, &qdev->mpi_reset_work, 0); | 1716 | queue_delayed_work(qdev->workqueue, &qdev->mpi_reset_work, 0); |
1665 | } | 1717 | } |
1666 | 1718 | ||
1667 | void ql_queue_asic_error(struct ql_adapter *qdev) | 1719 | void ql_queue_asic_error(struct ql_adapter *qdev) |
1668 | { | 1720 | { |
1669 | netif_carrier_off(qdev->ndev); | 1721 | ql_link_off(qdev); |
1670 | ql_disable_interrupts(qdev); | 1722 | ql_disable_interrupts(qdev); |
1671 | /* Clear adapter up bit to signal the recovery | 1723 | /* Clear adapter up bit to signal the recovery |
1672 | * process that it shouldn't kill the reset worker | 1724 | * process that it shouldn't kill the reset worker |
@@ -2104,7 +2156,7 @@ static int qlge_send(struct sk_buff *skb, struct net_device *ndev) | |||
2104 | } | 2156 | } |
2105 | tx_ring_desc = &tx_ring->q[tx_ring->prod_idx]; | 2157 | tx_ring_desc = &tx_ring->q[tx_ring->prod_idx]; |
2106 | mac_iocb_ptr = tx_ring_desc->queue_entry; | 2158 | mac_iocb_ptr = tx_ring_desc->queue_entry; |
2107 | memset((void *)mac_iocb_ptr, 0, sizeof(mac_iocb_ptr)); | 2159 | memset((void *)mac_iocb_ptr, 0, sizeof(*mac_iocb_ptr)); |
2108 | 2160 | ||
2109 | mac_iocb_ptr->opcode = OPCODE_OB_MAC_IOCB; | 2161 | mac_iocb_ptr->opcode = OPCODE_OB_MAC_IOCB; |
2110 | mac_iocb_ptr->tid = tx_ring_desc->index; | 2162 | mac_iocb_ptr->tid = tx_ring_desc->index; |
@@ -2743,7 +2795,7 @@ static int ql_start_tx_ring(struct ql_adapter *qdev, struct tx_ring *tx_ring) | |||
2743 | 2795 | ||
2744 | ql_init_tx_ring(qdev, tx_ring); | 2796 | ql_init_tx_ring(qdev, tx_ring); |
2745 | 2797 | ||
2746 | err = ql_write_cfg(qdev, wqicb, sizeof(wqicb), CFG_LRQ, | 2798 | err = ql_write_cfg(qdev, wqicb, sizeof(*wqicb), CFG_LRQ, |
2747 | (u16) tx_ring->wq_id); | 2799 | (u16) tx_ring->wq_id); |
2748 | if (err) { | 2800 | if (err) { |
2749 | QPRINTK(qdev, IFUP, ERR, "Failed to load tx_ring.\n"); | 2801 | QPRINTK(qdev, IFUP, ERR, "Failed to load tx_ring.\n"); |
@@ -3008,7 +3060,7 @@ static int ql_start_rss(struct ql_adapter *qdev) | |||
3008 | int i; | 3060 | int i; |
3009 | u8 *hash_id = (u8 *) ricb->hash_cq_id; | 3061 | u8 *hash_id = (u8 *) ricb->hash_cq_id; |
3010 | 3062 | ||
3011 | memset((void *)ricb, 0, sizeof(ricb)); | 3063 | memset((void *)ricb, 0, sizeof(*ricb)); |
3012 | 3064 | ||
3013 | ricb->base_cq = qdev->rss_ring_first_cq_id | RSS_L4K; | 3065 | ricb->base_cq = qdev->rss_ring_first_cq_id | RSS_L4K; |
3014 | ricb->flags = | 3066 | ricb->flags = |
@@ -3030,7 +3082,7 @@ static int ql_start_rss(struct ql_adapter *qdev) | |||
3030 | 3082 | ||
3031 | QPRINTK(qdev, IFUP, DEBUG, "Initializing RSS.\n"); | 3083 | QPRINTK(qdev, IFUP, DEBUG, "Initializing RSS.\n"); |
3032 | 3084 | ||
3033 | status = ql_write_cfg(qdev, ricb, sizeof(ricb), CFG_LR, 0); | 3085 | status = ql_write_cfg(qdev, ricb, sizeof(*ricb), CFG_LR, 0); |
3034 | if (status) { | 3086 | if (status) { |
3035 | QPRINTK(qdev, IFUP, ERR, "Failed to load RICB.\n"); | 3087 | QPRINTK(qdev, IFUP, ERR, "Failed to load RICB.\n"); |
3036 | return status; | 3088 | return status; |
@@ -3039,25 +3091,40 @@ static int ql_start_rss(struct ql_adapter *qdev) | |||
3039 | return status; | 3091 | return status; |
3040 | } | 3092 | } |
3041 | 3093 | ||
3042 | /* Initialize the frame-to-queue routing. */ | 3094 | static int ql_clear_routing_entries(struct ql_adapter *qdev) |
3043 | static int ql_route_initialize(struct ql_adapter *qdev) | ||
3044 | { | 3095 | { |
3045 | int status = 0; | 3096 | int i, status = 0; |
3046 | int i; | ||
3047 | 3097 | ||
3048 | status = ql_sem_spinlock(qdev, SEM_RT_IDX_MASK); | 3098 | status = ql_sem_spinlock(qdev, SEM_RT_IDX_MASK); |
3049 | if (status) | 3099 | if (status) |
3050 | return status; | 3100 | return status; |
3051 | |||
3052 | /* Clear all the entries in the routing table. */ | 3101 | /* Clear all the entries in the routing table. */ |
3053 | for (i = 0; i < 16; i++) { | 3102 | for (i = 0; i < 16; i++) { |
3054 | status = ql_set_routing_reg(qdev, i, 0, 0); | 3103 | status = ql_set_routing_reg(qdev, i, 0, 0); |
3055 | if (status) { | 3104 | if (status) { |
3056 | QPRINTK(qdev, IFUP, ERR, | 3105 | QPRINTK(qdev, IFUP, ERR, |
3057 | "Failed to init routing register for CAM packets.\n"); | 3106 | "Failed to init routing register for CAM " |
3058 | goto exit; | 3107 | "packets.\n"); |
3108 | break; | ||
3059 | } | 3109 | } |
3060 | } | 3110 | } |
3111 | ql_sem_unlock(qdev, SEM_RT_IDX_MASK); | ||
3112 | return status; | ||
3113 | } | ||
3114 | |||
3115 | /* Initialize the frame-to-queue routing. */ | ||
3116 | static int ql_route_initialize(struct ql_adapter *qdev) | ||
3117 | { | ||
3118 | int status = 0; | ||
3119 | |||
3120 | status = ql_sem_spinlock(qdev, SEM_RT_IDX_MASK); | ||
3121 | if (status) | ||
3122 | return status; | ||
3123 | |||
3124 | /* Clear all the entries in the routing table. */ | ||
3125 | status = ql_clear_routing_entries(qdev); | ||
3126 | if (status) | ||
3127 | goto exit; | ||
3061 | 3128 | ||
3062 | status = ql_set_routing_reg(qdev, RT_IDX_ALL_ERR_SLOT, RT_IDX_ERR, 1); | 3129 | status = ql_set_routing_reg(qdev, RT_IDX_ALL_ERR_SLOT, RT_IDX_ERR, 1); |
3063 | if (status) { | 3130 | if (status) { |
@@ -3096,14 +3163,15 @@ exit: | |||
3096 | 3163 | ||
3097 | int ql_cam_route_initialize(struct ql_adapter *qdev) | 3164 | int ql_cam_route_initialize(struct ql_adapter *qdev) |
3098 | { | 3165 | { |
3099 | int status; | 3166 | int status, set; |
3100 | 3167 | ||
3101 | status = ql_sem_spinlock(qdev, SEM_MAC_ADDR_MASK); | 3168 | /* If check if the link is up and use to |
3102 | if (status) | 3169 | * determine if we are setting or clearing |
3103 | return status; | 3170 | * the MAC address in the CAM. |
3104 | status = ql_set_mac_addr_reg(qdev, (u8 *) qdev->ndev->perm_addr, | 3171 | */ |
3105 | MAC_ADDR_TYPE_CAM_MAC, qdev->func * MAX_CQ); | 3172 | set = ql_read32(qdev, STS); |
3106 | ql_sem_unlock(qdev, SEM_MAC_ADDR_MASK); | 3173 | set &= qdev->port_link_up; |
3174 | status = ql_set_mac_addr(qdev, set); | ||
3107 | if (status) { | 3175 | if (status) { |
3108 | QPRINTK(qdev, IFUP, ERR, "Failed to init mac address.\n"); | 3176 | QPRINTK(qdev, IFUP, ERR, "Failed to init mac address.\n"); |
3109 | return status; | 3177 | return status; |
@@ -3210,9 +3278,17 @@ static int ql_adapter_reset(struct ql_adapter *qdev) | |||
3210 | { | 3278 | { |
3211 | u32 value; | 3279 | u32 value; |
3212 | int status = 0; | 3280 | int status = 0; |
3213 | unsigned long end_jiffies = jiffies + | 3281 | unsigned long end_jiffies; |
3214 | max((unsigned long)1, usecs_to_jiffies(30)); | ||
3215 | 3282 | ||
3283 | /* Clear all the entries in the routing table. */ | ||
3284 | status = ql_clear_routing_entries(qdev); | ||
3285 | if (status) { | ||
3286 | QPRINTK(qdev, IFUP, ERR, "Failed to clear routing bits.\n"); | ||
3287 | return status; | ||
3288 | } | ||
3289 | |||
3290 | end_jiffies = jiffies + | ||
3291 | max((unsigned long)1, usecs_to_jiffies(30)); | ||
3216 | ql_write32(qdev, RST_FO, (RST_FO_FR << 16) | RST_FO_FR); | 3292 | ql_write32(qdev, RST_FO, (RST_FO_FR << 16) | RST_FO_FR); |
3217 | 3293 | ||
3218 | do { | 3294 | do { |
@@ -3252,7 +3328,7 @@ static int ql_adapter_down(struct ql_adapter *qdev) | |||
3252 | int i, status = 0; | 3328 | int i, status = 0; |
3253 | struct rx_ring *rx_ring; | 3329 | struct rx_ring *rx_ring; |
3254 | 3330 | ||
3255 | netif_carrier_off(qdev->ndev); | 3331 | ql_link_off(qdev); |
3256 | 3332 | ||
3257 | /* Don't kill the reset worker thread if we | 3333 | /* Don't kill the reset worker thread if we |
3258 | * are in the process of recovery. | 3334 | * are in the process of recovery. |
@@ -3319,8 +3395,12 @@ static int ql_adapter_up(struct ql_adapter *qdev) | |||
3319 | } | 3395 | } |
3320 | set_bit(QL_ADAPTER_UP, &qdev->flags); | 3396 | set_bit(QL_ADAPTER_UP, &qdev->flags); |
3321 | ql_alloc_rx_buffers(qdev); | 3397 | ql_alloc_rx_buffers(qdev); |
3322 | if ((ql_read32(qdev, STS) & qdev->port_init)) | 3398 | /* If the port is initialized and the |
3323 | netif_carrier_on(qdev->ndev); | 3399 | * link is up the turn on the carrier. |
3400 | */ | ||
3401 | if ((ql_read32(qdev, STS) & qdev->port_init) && | ||
3402 | (ql_read32(qdev, STS) & qdev->port_link_up)) | ||
3403 | ql_link_on(qdev); | ||
3324 | ql_enable_interrupts(qdev); | 3404 | ql_enable_interrupts(qdev); |
3325 | ql_enable_all_completion_interrupts(qdev); | 3405 | ql_enable_all_completion_interrupts(qdev); |
3326 | netif_tx_start_all_queues(qdev->ndev); | 3406 | netif_tx_start_all_queues(qdev->ndev); |
@@ -3346,11 +3426,6 @@ static int ql_get_adapter_resources(struct ql_adapter *qdev) | |||
3346 | return -ENOMEM; | 3426 | return -ENOMEM; |
3347 | } | 3427 | } |
3348 | status = ql_request_irq(qdev); | 3428 | status = ql_request_irq(qdev); |
3349 | if (status) | ||
3350 | goto err_irq; | ||
3351 | return status; | ||
3352 | err_irq: | ||
3353 | ql_free_mem_resources(qdev); | ||
3354 | return status; | 3429 | return status; |
3355 | } | 3430 | } |
3356 | 3431 | ||
@@ -3414,7 +3489,7 @@ static int ql_configure_rings(struct ql_adapter *qdev) | |||
3414 | 3489 | ||
3415 | for (i = 0; i < qdev->tx_ring_count; i++) { | 3490 | for (i = 0; i < qdev->tx_ring_count; i++) { |
3416 | tx_ring = &qdev->tx_ring[i]; | 3491 | tx_ring = &qdev->tx_ring[i]; |
3417 | memset((void *)tx_ring, 0, sizeof(tx_ring)); | 3492 | memset((void *)tx_ring, 0, sizeof(*tx_ring)); |
3418 | tx_ring->qdev = qdev; | 3493 | tx_ring->qdev = qdev; |
3419 | tx_ring->wq_id = i; | 3494 | tx_ring->wq_id = i; |
3420 | tx_ring->wq_len = qdev->tx_ring_size; | 3495 | tx_ring->wq_len = qdev->tx_ring_size; |
@@ -3430,7 +3505,7 @@ static int ql_configure_rings(struct ql_adapter *qdev) | |||
3430 | 3505 | ||
3431 | for (i = 0; i < qdev->rx_ring_count; i++) { | 3506 | for (i = 0; i < qdev->rx_ring_count; i++) { |
3432 | rx_ring = &qdev->rx_ring[i]; | 3507 | rx_ring = &qdev->rx_ring[i]; |
3433 | memset((void *)rx_ring, 0, sizeof(rx_ring)); | 3508 | memset((void *)rx_ring, 0, sizeof(*rx_ring)); |
3434 | rx_ring->qdev = qdev; | 3509 | rx_ring->qdev = qdev; |
3435 | rx_ring->cq_id = i; | 3510 | rx_ring->cq_id = i; |
3436 | rx_ring->cpu = i % cpu_cnt; /* CPU to run handler on. */ | 3511 | rx_ring->cpu = i % cpu_cnt; /* CPU to run handler on. */ |
@@ -3789,7 +3864,7 @@ static int __devinit ql_init_device(struct pci_dev *pdev, | |||
3789 | int pos, err = 0; | 3864 | int pos, err = 0; |
3790 | u16 val16; | 3865 | u16 val16; |
3791 | 3866 | ||
3792 | memset((void *)qdev, 0, sizeof(qdev)); | 3867 | memset((void *)qdev, 0, sizeof(*qdev)); |
3793 | err = pci_enable_device(pdev); | 3868 | err = pci_enable_device(pdev); |
3794 | if (err) { | 3869 | if (err) { |
3795 | dev_err(&pdev->dev, "PCI device enable failed.\n"); | 3870 | dev_err(&pdev->dev, "PCI device enable failed.\n"); |
@@ -3976,7 +4051,7 @@ static int __devinit qlge_probe(struct pci_dev *pdev, | |||
3976 | pci_disable_device(pdev); | 4051 | pci_disable_device(pdev); |
3977 | return err; | 4052 | return err; |
3978 | } | 4053 | } |
3979 | netif_carrier_off(ndev); | 4054 | ql_link_off(qdev); |
3980 | ql_display_dev_info(ndev); | 4055 | ql_display_dev_info(ndev); |
3981 | cards_found++; | 4056 | cards_found++; |
3982 | return 0; | 4057 | return 0; |
diff --git a/drivers/net/qlge/qlge_mpi.c b/drivers/net/qlge/qlge_mpi.c index 71afbf8b9c5..6685bd97da9 100644 --- a/drivers/net/qlge/qlge_mpi.c +++ b/drivers/net/qlge/qlge_mpi.c | |||
@@ -238,7 +238,7 @@ static void ql_link_up(struct ql_adapter *qdev, struct mbox_params *mbcp) | |||
238 | &qdev->mpi_port_cfg_work, 0); | 238 | &qdev->mpi_port_cfg_work, 0); |
239 | } | 239 | } |
240 | 240 | ||
241 | netif_carrier_on(qdev->ndev); | 241 | ql_link_on(qdev); |
242 | } | 242 | } |
243 | 243 | ||
244 | static void ql_link_down(struct ql_adapter *qdev, struct mbox_params *mbcp) | 244 | static void ql_link_down(struct ql_adapter *qdev, struct mbox_params *mbcp) |
@@ -251,7 +251,7 @@ static void ql_link_down(struct ql_adapter *qdev, struct mbox_params *mbcp) | |||
251 | if (status) | 251 | if (status) |
252 | QPRINTK(qdev, DRV, ERR, "Link down AEN broken!\n"); | 252 | QPRINTK(qdev, DRV, ERR, "Link down AEN broken!\n"); |
253 | 253 | ||
254 | netif_carrier_off(qdev->ndev); | 254 | ql_link_off(qdev); |
255 | } | 255 | } |
256 | 256 | ||
257 | static int ql_sfp_in(struct ql_adapter *qdev, struct mbox_params *mbcp) | 257 | static int ql_sfp_in(struct ql_adapter *qdev, struct mbox_params *mbcp) |
@@ -849,7 +849,7 @@ void ql_mpi_idc_work(struct work_struct *work) | |||
849 | case MB_CMD_PORT_RESET: | 849 | case MB_CMD_PORT_RESET: |
850 | case MB_CMD_SET_PORT_CFG: | 850 | case MB_CMD_SET_PORT_CFG: |
851 | case MB_CMD_STOP_FW: | 851 | case MB_CMD_STOP_FW: |
852 | netif_carrier_off(qdev->ndev); | 852 | ql_link_off(qdev); |
853 | /* Signal the resulting link up AEN | 853 | /* Signal the resulting link up AEN |
854 | * that the frame routing and mac addr | 854 | * that the frame routing and mac addr |
855 | * needs to be set. | 855 | * needs to be set. |
diff --git a/drivers/net/r6040.c b/drivers/net/r6040.c index ed63d23a645..961b5397a53 100644 --- a/drivers/net/r6040.c +++ b/drivers/net/r6040.c | |||
@@ -49,8 +49,8 @@ | |||
49 | #include <asm/processor.h> | 49 | #include <asm/processor.h> |
50 | 50 | ||
51 | #define DRV_NAME "r6040" | 51 | #define DRV_NAME "r6040" |
52 | #define DRV_VERSION "0.23" | 52 | #define DRV_VERSION "0.24" |
53 | #define DRV_RELDATE "05May2009" | 53 | #define DRV_RELDATE "08Jul2009" |
54 | 54 | ||
55 | /* PHY CHIP Address */ | 55 | /* PHY CHIP Address */ |
56 | #define PHY1_ADDR 1 /* For MAC1 */ | 56 | #define PHY1_ADDR 1 /* For MAC1 */ |
@@ -704,8 +704,11 @@ static irqreturn_t r6040_interrupt(int irq, void *dev_id) | |||
704 | /* Read MISR status and clear */ | 704 | /* Read MISR status and clear */ |
705 | status = ioread16(ioaddr + MISR); | 705 | status = ioread16(ioaddr + MISR); |
706 | 706 | ||
707 | if (status == 0x0000 || status == 0xffff) | 707 | if (status == 0x0000 || status == 0xffff) { |
708 | /* Restore RDC MAC interrupt */ | ||
709 | iowrite16(misr, ioaddr + MIER); | ||
708 | return IRQ_NONE; | 710 | return IRQ_NONE; |
711 | } | ||
709 | 712 | ||
710 | /* RX interrupt request */ | 713 | /* RX interrupt request */ |
711 | if (status & RX_INTS) { | 714 | if (status & RX_INTS) { |
diff --git a/drivers/net/smsc911x.c b/drivers/net/smsc911x.c index b60639bd181..66067f9d91c 100644 --- a/drivers/net/smsc911x.c +++ b/drivers/net/smsc911x.c | |||
@@ -1938,7 +1938,7 @@ static int __devexit smsc911x_drv_remove(struct platform_device *pdev) | |||
1938 | if (!res) | 1938 | if (!res) |
1939 | res = platform_get_resource(pdev, IORESOURCE_MEM, 0); | 1939 | res = platform_get_resource(pdev, IORESOURCE_MEM, 0); |
1940 | 1940 | ||
1941 | release_mem_region(res->start, res->end - res->start); | 1941 | release_mem_region(res->start, resource_size(res)); |
1942 | 1942 | ||
1943 | iounmap(pdata->ioaddr); | 1943 | iounmap(pdata->ioaddr); |
1944 | 1944 | ||
@@ -1976,7 +1976,7 @@ static int __devinit smsc911x_drv_probe(struct platform_device *pdev) | |||
1976 | retval = -ENODEV; | 1976 | retval = -ENODEV; |
1977 | goto out_0; | 1977 | goto out_0; |
1978 | } | 1978 | } |
1979 | res_size = res->end - res->start + 1; | 1979 | res_size = resource_size(res); |
1980 | 1980 | ||
1981 | irq_res = platform_get_resource(pdev, IORESOURCE_IRQ, 0); | 1981 | irq_res = platform_get_resource(pdev, IORESOURCE_IRQ, 0); |
1982 | if (!irq_res) { | 1982 | if (!irq_res) { |
@@ -2104,7 +2104,7 @@ out_unmap_io_3: | |||
2104 | out_free_netdev_2: | 2104 | out_free_netdev_2: |
2105 | free_netdev(dev); | 2105 | free_netdev(dev); |
2106 | out_release_io_1: | 2106 | out_release_io_1: |
2107 | release_mem_region(res->start, res->end - res->start); | 2107 | release_mem_region(res->start, resource_size(res)); |
2108 | out_0: | 2108 | out_0: |
2109 | return retval; | 2109 | return retval; |
2110 | } | 2110 | } |
diff --git a/drivers/net/starfire.c b/drivers/net/starfire.c index 838cce8b8ff..669253c7bd4 100644 --- a/drivers/net/starfire.c +++ b/drivers/net/starfire.c | |||
@@ -180,7 +180,7 @@ static int full_duplex[MAX_UNITS] = {0, }; | |||
180 | /* These identify the driver base version and may not be removed. */ | 180 | /* These identify the driver base version and may not be removed. */ |
181 | static const char version[] __devinitconst = | 181 | static const char version[] __devinitconst = |
182 | KERN_INFO "starfire.c:v1.03 7/26/2000 Written by Donald Becker <becker@scyld.com>\n" | 182 | KERN_INFO "starfire.c:v1.03 7/26/2000 Written by Donald Becker <becker@scyld.com>\n" |
183 | KERN_INFO " (unofficial 2.2/2.4 kernel port, version " DRV_VERSION ", " DRV_RELDATE ")\n"; | 183 | " (unofficial 2.2/2.4 kernel port, version " DRV_VERSION ", " DRV_RELDATE ")\n"; |
184 | 184 | ||
185 | MODULE_AUTHOR("Donald Becker <becker@scyld.com>"); | 185 | MODULE_AUTHOR("Donald Becker <becker@scyld.com>"); |
186 | MODULE_DESCRIPTION("Adaptec Starfire Ethernet driver"); | 186 | MODULE_DESCRIPTION("Adaptec Starfire Ethernet driver"); |
diff --git a/drivers/net/sundance.c b/drivers/net/sundance.c index 545f81b34ad..d1521c3875b 100644 --- a/drivers/net/sundance.c +++ b/drivers/net/sundance.c | |||
@@ -1698,13 +1698,13 @@ static int netdev_close(struct net_device *dev) | |||
1698 | 1698 | ||
1699 | #ifdef __i386__ | 1699 | #ifdef __i386__ |
1700 | if (netif_msg_hw(np)) { | 1700 | if (netif_msg_hw(np)) { |
1701 | printk("\n"KERN_DEBUG" Tx ring at %8.8x:\n", | 1701 | printk(KERN_DEBUG " Tx ring at %8.8x:\n", |
1702 | (int)(np->tx_ring_dma)); | 1702 | (int)(np->tx_ring_dma)); |
1703 | for (i = 0; i < TX_RING_SIZE; i++) | 1703 | for (i = 0; i < TX_RING_SIZE; i++) |
1704 | printk(" #%d desc. %4.4x %8.8x %8.8x.\n", | 1704 | printk(KERN_DEBUG " #%d desc. %4.4x %8.8x %8.8x.\n", |
1705 | i, np->tx_ring[i].status, np->tx_ring[i].frag[0].addr, | 1705 | i, np->tx_ring[i].status, np->tx_ring[i].frag[0].addr, |
1706 | np->tx_ring[i].frag[0].length); | 1706 | np->tx_ring[i].frag[0].length); |
1707 | printk("\n"KERN_DEBUG " Rx ring %8.8x:\n", | 1707 | printk(KERN_DEBUG " Rx ring %8.8x:\n", |
1708 | (int)(np->rx_ring_dma)); | 1708 | (int)(np->rx_ring_dma)); |
1709 | for (i = 0; i < /*RX_RING_SIZE*/4 ; i++) { | 1709 | for (i = 0; i < /*RX_RING_SIZE*/4 ; i++) { |
1710 | printk(KERN_DEBUG " #%d desc. %4.4x %4.4x %8.8x\n", | 1710 | printk(KERN_DEBUG " #%d desc. %4.4x %4.4x %8.8x\n", |
diff --git a/drivers/net/tsi108_eth.c b/drivers/net/tsi108_eth.c index 0f78f99f9b2..7030bd5e984 100644 --- a/drivers/net/tsi108_eth.c +++ b/drivers/net/tsi108_eth.c | |||
@@ -1132,7 +1132,9 @@ static int tsi108_get_mac(struct net_device *dev) | |||
1132 | } | 1132 | } |
1133 | 1133 | ||
1134 | if (!is_valid_ether_addr(dev->dev_addr)) { | 1134 | if (!is_valid_ether_addr(dev->dev_addr)) { |
1135 | printk("KERN_ERR: word1: %08x, word2: %08x\n", word1, word2); | 1135 | printk(KERN_ERR |
1136 | "%s: Invalid MAC address. word1: %08x, word2: %08x\n", | ||
1137 | dev->name, word1, word2); | ||
1136 | return -EINVAL; | 1138 | return -EINVAL; |
1137 | } | 1139 | } |
1138 | 1140 | ||
@@ -1201,8 +1203,8 @@ static void tsi108_set_rx_mode(struct net_device *dev) | |||
1201 | __set_bit(hash, &data->mc_hash[0]); | 1203 | __set_bit(hash, &data->mc_hash[0]); |
1202 | } else { | 1204 | } else { |
1203 | printk(KERN_ERR | 1205 | printk(KERN_ERR |
1204 | "%s: got multicast address of length %d " | 1206 | "%s: got multicast address of length %d instead of 6.\n", |
1205 | "instead of 6.\n", dev->name, | 1207 | dev->name, |
1206 | mc->dmi_addrlen); | 1208 | mc->dmi_addrlen); |
1207 | } | 1209 | } |
1208 | 1210 | ||
diff --git a/drivers/net/tulip/de2104x.c b/drivers/net/tulip/de2104x.c index 81f054dbb88..ef49744a508 100644 --- a/drivers/net/tulip/de2104x.c +++ b/drivers/net/tulip/de2104x.c | |||
@@ -944,9 +944,10 @@ static void de_set_media (struct de_private *de) | |||
944 | macmode &= ~FullDuplex; | 944 | macmode &= ~FullDuplex; |
945 | 945 | ||
946 | if (netif_msg_link(de)) { | 946 | if (netif_msg_link(de)) { |
947 | printk(KERN_INFO "%s: set link %s\n" | 947 | printk(KERN_INFO |
948 | KERN_INFO "%s: mode 0x%x, sia 0x%x,0x%x,0x%x,0x%x\n" | 948 | "%s: set link %s\n" |
949 | KERN_INFO "%s: set mode 0x%x, set sia 0x%x,0x%x,0x%x\n", | 949 | "%s: mode 0x%x, sia 0x%x,0x%x,0x%x,0x%x\n" |
950 | "%s: set mode 0x%x, set sia 0x%x,0x%x,0x%x\n", | ||
950 | de->dev->name, media_name[media], | 951 | de->dev->name, media_name[media], |
951 | de->dev->name, dr32(MacMode), dr32(SIAStatus), | 952 | de->dev->name, dr32(MacMode), dr32(SIAStatus), |
952 | dr32(CSR13), dr32(CSR14), dr32(CSR15), | 953 | dr32(CSR13), dr32(CSR14), dr32(CSR15), |
diff --git a/drivers/net/tulip/tulip_core.c b/drivers/net/tulip/tulip_core.c index 2abb5d3becc..99a63649f4f 100644 --- a/drivers/net/tulip/tulip_core.c +++ b/drivers/net/tulip/tulip_core.c | |||
@@ -570,16 +570,18 @@ static void tulip_tx_timeout(struct net_device *dev) | |||
570 | (unsigned int)tp->rx_ring[i].buffer2, | 570 | (unsigned int)tp->rx_ring[i].buffer2, |
571 | buf[0], buf[1], buf[2]); | 571 | buf[0], buf[1], buf[2]); |
572 | for (j = 0; buf[j] != 0xee && j < 1600; j++) | 572 | for (j = 0; buf[j] != 0xee && j < 1600; j++) |
573 | if (j < 100) printk(" %2.2x", buf[j]); | 573 | if (j < 100) |
574 | printk(" j=%d.\n", j); | 574 | printk(KERN_CONT " %2.2x", buf[j]); |
575 | printk(KERN_CONT " j=%d.\n", j); | ||
575 | } | 576 | } |
576 | printk(KERN_DEBUG " Rx ring %8.8x: ", (int)tp->rx_ring); | 577 | printk(KERN_DEBUG " Rx ring %8.8x: ", (int)tp->rx_ring); |
577 | for (i = 0; i < RX_RING_SIZE; i++) | 578 | for (i = 0; i < RX_RING_SIZE; i++) |
578 | printk(" %8.8x", (unsigned int)tp->rx_ring[i].status); | 579 | printk(KERN_CONT " %8.8x", |
579 | printk("\n" KERN_DEBUG " Tx ring %8.8x: ", (int)tp->tx_ring); | 580 | (unsigned int)tp->rx_ring[i].status); |
581 | printk(KERN_DEBUG " Tx ring %8.8x: ", (int)tp->tx_ring); | ||
580 | for (i = 0; i < TX_RING_SIZE; i++) | 582 | for (i = 0; i < TX_RING_SIZE; i++) |
581 | printk(" %8.8x", (unsigned int)tp->tx_ring[i].status); | 583 | printk(KERN_CONT " %8.8x", (unsigned int)tp->tx_ring[i].status); |
582 | printk("\n"); | 584 | printk(KERN_CONT "\n"); |
583 | } | 585 | } |
584 | #endif | 586 | #endif |
585 | 587 | ||
diff --git a/drivers/net/tulip/winbond-840.c b/drivers/net/tulip/winbond-840.c index 842b1a2c40d..0f15773dae5 100644 --- a/drivers/net/tulip/winbond-840.c +++ b/drivers/net/tulip/winbond-840.c | |||
@@ -142,7 +142,7 @@ static int full_duplex[MAX_UNITS] = {-1, -1, -1, -1, -1, -1, -1, -1}; | |||
142 | static const char version[] __initconst = | 142 | static const char version[] __initconst = |
143 | KERN_INFO DRV_NAME ".c:v" DRV_VERSION " (2.4 port) " | 143 | KERN_INFO DRV_NAME ".c:v" DRV_VERSION " (2.4 port) " |
144 | DRV_RELDATE " Donald Becker <becker@scyld.com>\n" | 144 | DRV_RELDATE " Donald Becker <becker@scyld.com>\n" |
145 | KERN_INFO " http://www.scyld.com/network/drivers.html\n"; | 145 | " http://www.scyld.com/network/drivers.html\n"; |
146 | 146 | ||
147 | MODULE_AUTHOR("Donald Becker <becker@scyld.com>"); | 147 | MODULE_AUTHOR("Donald Becker <becker@scyld.com>"); |
148 | MODULE_DESCRIPTION("Winbond W89c840 Ethernet driver"); | 148 | MODULE_DESCRIPTION("Winbond W89c840 Ethernet driver"); |
@@ -939,7 +939,7 @@ static void tx_timeout(struct net_device *dev) | |||
939 | printk(KERN_DEBUG " Rx ring %p: ", np->rx_ring); | 939 | printk(KERN_DEBUG " Rx ring %p: ", np->rx_ring); |
940 | for (i = 0; i < RX_RING_SIZE; i++) | 940 | for (i = 0; i < RX_RING_SIZE; i++) |
941 | printk(" %8.8x", (unsigned int)np->rx_ring[i].status); | 941 | printk(" %8.8x", (unsigned int)np->rx_ring[i].status); |
942 | printk("\n"KERN_DEBUG" Tx ring %p: ", np->tx_ring); | 942 | printk(KERN_DEBUG" Tx ring %p: ", np->tx_ring); |
943 | for (i = 0; i < TX_RING_SIZE; i++) | 943 | for (i = 0; i < TX_RING_SIZE; i++) |
944 | printk(" %8.8x", np->tx_ring[i].status); | 944 | printk(" %8.8x", np->tx_ring[i].status); |
945 | printk("\n"); | 945 | printk("\n"); |
@@ -1520,7 +1520,7 @@ static int netdev_close(struct net_device *dev) | |||
1520 | printk(KERN_DEBUG " #%d desc. %4.4x %4.4x %8.8x.\n", | 1520 | printk(KERN_DEBUG " #%d desc. %4.4x %4.4x %8.8x.\n", |
1521 | i, np->tx_ring[i].length, | 1521 | i, np->tx_ring[i].length, |
1522 | np->tx_ring[i].status, np->tx_ring[i].buffer1); | 1522 | np->tx_ring[i].status, np->tx_ring[i].buffer1); |
1523 | printk("\n"KERN_DEBUG " Rx ring %8.8x:\n", | 1523 | printk(KERN_DEBUG " Rx ring %8.8x:\n", |
1524 | (int)np->rx_ring); | 1524 | (int)np->rx_ring); |
1525 | for (i = 0; i < RX_RING_SIZE; i++) { | 1525 | for (i = 0; i < RX_RING_SIZE; i++) { |
1526 | printk(KERN_DEBUG " #%d desc. %4.4x %4.4x %8.8x\n", | 1526 | printk(KERN_DEBUG " #%d desc. %4.4x %4.4x %8.8x\n", |
diff --git a/drivers/net/tun.c b/drivers/net/tun.c index 11a0ba47b67..027f7aba26a 100644 --- a/drivers/net/tun.c +++ b/drivers/net/tun.c | |||
@@ -486,12 +486,14 @@ static unsigned int tun_chr_poll(struct file *file, poll_table * wait) | |||
486 | { | 486 | { |
487 | struct tun_file *tfile = file->private_data; | 487 | struct tun_file *tfile = file->private_data; |
488 | struct tun_struct *tun = __tun_get(tfile); | 488 | struct tun_struct *tun = __tun_get(tfile); |
489 | struct sock *sk = tun->sk; | 489 | struct sock *sk; |
490 | unsigned int mask = 0; | 490 | unsigned int mask = 0; |
491 | 491 | ||
492 | if (!tun) | 492 | if (!tun) |
493 | return POLLERR; | 493 | return POLLERR; |
494 | 494 | ||
495 | sk = tun->sk; | ||
496 | |||
495 | DBG(KERN_INFO "%s: tun_chr_poll\n", tun->dev->name); | 497 | DBG(KERN_INFO "%s: tun_chr_poll\n", tun->dev->name); |
496 | 498 | ||
497 | poll_wait(file, &tun->socket.wait, wait); | 499 | poll_wait(file, &tun->socket.wait, wait); |
@@ -1324,20 +1326,22 @@ static int tun_chr_close(struct inode *inode, struct file *file) | |||
1324 | struct tun_file *tfile = file->private_data; | 1326 | struct tun_file *tfile = file->private_data; |
1325 | struct tun_struct *tun; | 1327 | struct tun_struct *tun; |
1326 | 1328 | ||
1327 | |||
1328 | rtnl_lock(); | ||
1329 | tun = __tun_get(tfile); | 1329 | tun = __tun_get(tfile); |
1330 | if (tun) { | 1330 | if (tun) { |
1331 | DBG(KERN_INFO "%s: tun_chr_close\n", tun->dev->name); | 1331 | struct net_device *dev = tun->dev; |
1332 | |||
1333 | DBG(KERN_INFO "%s: tun_chr_close\n", dev->name); | ||
1332 | 1334 | ||
1333 | __tun_detach(tun); | 1335 | __tun_detach(tun); |
1334 | 1336 | ||
1335 | /* If desireable, unregister the netdevice. */ | 1337 | /* If desireable, unregister the netdevice. */ |
1336 | if (!(tun->flags & TUN_PERSIST)) | 1338 | if (!(tun->flags & TUN_PERSIST)) { |
1337 | unregister_netdevice(tun->dev); | 1339 | rtnl_lock(); |
1338 | 1340 | if (dev->reg_state == NETREG_REGISTERED) | |
1341 | unregister_netdevice(dev); | ||
1342 | rtnl_unlock(); | ||
1343 | } | ||
1339 | } | 1344 | } |
1340 | rtnl_unlock(); | ||
1341 | 1345 | ||
1342 | tun = tfile->tun; | 1346 | tun = tfile->tun; |
1343 | if (tun) | 1347 | if (tun) |
diff --git a/drivers/net/wan/hd64570.c b/drivers/net/wan/hd64570.c index 223238de475..1ea1ef6c3b9 100644 --- a/drivers/net/wan/hd64570.c +++ b/drivers/net/wan/hd64570.c | |||
@@ -584,8 +584,9 @@ static void sca_dump_rings(struct net_device *dev) | |||
584 | sca_in(DSR_RX(phy_node(port)), card) & DSR_DE ? "" : "in"); | 584 | sca_in(DSR_RX(phy_node(port)), card) & DSR_DE ? "" : "in"); |
585 | for (cnt = 0; cnt < port_to_card(port)->rx_ring_buffers; cnt++) | 585 | for (cnt = 0; cnt < port_to_card(port)->rx_ring_buffers; cnt++) |
586 | printk(" %02X", readb(&(desc_address(port, cnt, 0)->stat))); | 586 | printk(" %02X", readb(&(desc_address(port, cnt, 0)->stat))); |
587 | printk(KERN_CONT "\n"); | ||
587 | 588 | ||
588 | printk("\n" KERN_DEBUG "TX ring: CDA=%u EDA=%u DSR=%02X in=%u " | 589 | printk(KERN_DEBUG "TX ring: CDA=%u EDA=%u DSR=%02X in=%u " |
589 | "last=%u %sactive", | 590 | "last=%u %sactive", |
590 | sca_inw(get_dmac_tx(port) + CDAL, card), | 591 | sca_inw(get_dmac_tx(port) + CDAL, card), |
591 | sca_inw(get_dmac_tx(port) + EDAL, card), | 592 | sca_inw(get_dmac_tx(port) + EDAL, card), |
diff --git a/drivers/net/wan/hd64572.c b/drivers/net/wan/hd64572.c index 497b003d723..f099c34a3ae 100644 --- a/drivers/net/wan/hd64572.c +++ b/drivers/net/wan/hd64572.c | |||
@@ -529,8 +529,9 @@ static void sca_dump_rings(struct net_device *dev) | |||
529 | sca_in(DSR_RX(port->chan), card) & DSR_DE ? "" : "in"); | 529 | sca_in(DSR_RX(port->chan), card) & DSR_DE ? "" : "in"); |
530 | for (cnt = 0; cnt < port->card->rx_ring_buffers; cnt++) | 530 | for (cnt = 0; cnt < port->card->rx_ring_buffers; cnt++) |
531 | printk(" %02X", readb(&(desc_address(port, cnt, 0)->stat))); | 531 | printk(" %02X", readb(&(desc_address(port, cnt, 0)->stat))); |
532 | printk(KERN_CONT "\n"); | ||
532 | 533 | ||
533 | printk("\n" KERN_DEBUG "TX ring: CDA=%u EDA=%u DSR=%02X in=%u " | 534 | printk(KERN_DEBUG "TX ring: CDA=%u EDA=%u DSR=%02X in=%u " |
534 | "last=%u %sactive", | 535 | "last=%u %sactive", |
535 | sca_inl(get_dmac_tx(port) + CDAL, card), | 536 | sca_inl(get_dmac_tx(port) + CDAL, card), |
536 | sca_inl(get_dmac_tx(port) + EDAL, card), | 537 | sca_inl(get_dmac_tx(port) + EDAL, card), |
diff --git a/drivers/net/wan/sbni.c b/drivers/net/wan/sbni.c index 3fb9dbc88a1..d14e95a08d6 100644 --- a/drivers/net/wan/sbni.c +++ b/drivers/net/wan/sbni.c | |||
@@ -326,11 +326,9 @@ sbni_pci_probe( struct net_device *dev ) | |||
326 | } | 326 | } |
327 | 327 | ||
328 | if (pci_irq_line <= 0 || pci_irq_line >= nr_irqs) | 328 | if (pci_irq_line <= 0 || pci_irq_line >= nr_irqs) |
329 | printk( KERN_WARNING " WARNING: The PCI BIOS assigned " | 329 | printk( KERN_WARNING |
330 | "this PCI card to IRQ %d, which is unlikely " | 330 | " WARNING: The PCI BIOS assigned this PCI card to IRQ %d, which is unlikely to work!.\n" |
331 | "to work!.\n" | 331 | " You should use the PCI BIOS setup to assign a valid IRQ line.\n", |
332 | KERN_WARNING " You should use the PCI BIOS " | ||
333 | "setup to assign a valid IRQ line.\n", | ||
334 | pci_irq_line ); | 332 | pci_irq_line ); |
335 | 333 | ||
336 | /* avoiding re-enable dual adapters */ | 334 | /* avoiding re-enable dual adapters */ |
diff --git a/drivers/net/wireless/ath/Kconfig b/drivers/net/wireless/ath/Kconfig index d26e7b48531..eb0337c4954 100644 --- a/drivers/net/wireless/ath/Kconfig +++ b/drivers/net/wireless/ath/Kconfig | |||
@@ -1,5 +1,6 @@ | |||
1 | config ATH_COMMON | 1 | config ATH_COMMON |
2 | tristate "Atheros Wireless Cards" | 2 | tristate "Atheros Wireless Cards" |
3 | depends on WLAN_80211 | ||
3 | depends on ATH5K || ATH9K || AR9170_USB | 4 | depends on ATH5K || ATH9K || AR9170_USB |
4 | 5 | ||
5 | source "drivers/net/wireless/ath/ath5k/Kconfig" | 6 | source "drivers/net/wireless/ath/ath5k/Kconfig" |
diff --git a/drivers/net/wireless/ath/ath9k/xmit.c b/drivers/net/wireless/ath/ath9k/xmit.c index b61a071788a..4ccf48e396d 100644 --- a/drivers/net/wireless/ath/ath9k/xmit.c +++ b/drivers/net/wireless/ath/ath9k/xmit.c | |||
@@ -355,7 +355,14 @@ static void ath_tx_complete_aggr(struct ath_softc *sc, struct ath_txq *txq, | |||
355 | } | 355 | } |
356 | 356 | ||
357 | if (bf_next == NULL) { | 357 | if (bf_next == NULL) { |
358 | INIT_LIST_HEAD(&bf_head); | 358 | /* |
359 | * Make sure the last desc is reclaimed if it | ||
360 | * not a holding desc. | ||
361 | */ | ||
362 | if (!bf_last->bf_stale) | ||
363 | list_move_tail(&bf->list, &bf_head); | ||
364 | else | ||
365 | INIT_LIST_HEAD(&bf_head); | ||
359 | } else { | 366 | } else { |
360 | ASSERT(!list_empty(bf_q)); | 367 | ASSERT(!list_empty(bf_q)); |
361 | list_move_tail(&bf->list, &bf_head); | 368 | list_move_tail(&bf->list, &bf_head); |
diff --git a/drivers/net/wireless/b43/b43.h b/drivers/net/wireless/b43/b43.h index f580c2812d9..40448067e4c 100644 --- a/drivers/net/wireless/b43/b43.h +++ b/drivers/net/wireless/b43/b43.h | |||
@@ -648,6 +648,7 @@ struct b43_wl { | |||
648 | u8 nr_devs; | 648 | u8 nr_devs; |
649 | 649 | ||
650 | bool radiotap_enabled; | 650 | bool radiotap_enabled; |
651 | bool radio_enabled; | ||
651 | 652 | ||
652 | /* The beacon we are currently using (AP or IBSS mode). | 653 | /* The beacon we are currently using (AP or IBSS mode). |
653 | * This beacon stuff is protected by the irq_lock. */ | 654 | * This beacon stuff is protected by the irq_lock. */ |
diff --git a/drivers/net/wireless/b43/main.c b/drivers/net/wireless/b43/main.c index 6456afebdba..e71c8d9cd70 100644 --- a/drivers/net/wireless/b43/main.c +++ b/drivers/net/wireless/b43/main.c | |||
@@ -3497,8 +3497,8 @@ static int b43_op_config(struct ieee80211_hw *hw, u32 changed) | |||
3497 | if (phy->ops->set_rx_antenna) | 3497 | if (phy->ops->set_rx_antenna) |
3498 | phy->ops->set_rx_antenna(dev, antenna); | 3498 | phy->ops->set_rx_antenna(dev, antenna); |
3499 | 3499 | ||
3500 | if (!!conf->radio_enabled != phy->radio_on) { | 3500 | if (wl->radio_enabled != phy->radio_on) { |
3501 | if (conf->radio_enabled) { | 3501 | if (wl->radio_enabled) { |
3502 | b43_software_rfkill(dev, false); | 3502 | b43_software_rfkill(dev, false); |
3503 | b43info(dev->wl, "Radio turned on by software\n"); | 3503 | b43info(dev->wl, "Radio turned on by software\n"); |
3504 | if (!dev->radio_hw_enable) { | 3504 | if (!dev->radio_hw_enable) { |
@@ -4339,6 +4339,7 @@ static int b43_op_start(struct ieee80211_hw *hw) | |||
4339 | wl->beacon0_uploaded = 0; | 4339 | wl->beacon0_uploaded = 0; |
4340 | wl->beacon1_uploaded = 0; | 4340 | wl->beacon1_uploaded = 0; |
4341 | wl->beacon_templates_virgin = 1; | 4341 | wl->beacon_templates_virgin = 1; |
4342 | wl->radio_enabled = 1; | ||
4342 | 4343 | ||
4343 | mutex_lock(&wl->mutex); | 4344 | mutex_lock(&wl->mutex); |
4344 | 4345 | ||
@@ -4378,6 +4379,7 @@ static void b43_op_stop(struct ieee80211_hw *hw) | |||
4378 | if (b43_status(dev) >= B43_STAT_STARTED) | 4379 | if (b43_status(dev) >= B43_STAT_STARTED) |
4379 | b43_wireless_core_stop(dev); | 4380 | b43_wireless_core_stop(dev); |
4380 | b43_wireless_core_exit(dev); | 4381 | b43_wireless_core_exit(dev); |
4382 | wl->radio_enabled = 0; | ||
4381 | mutex_unlock(&wl->mutex); | 4383 | mutex_unlock(&wl->mutex); |
4382 | 4384 | ||
4383 | cancel_work_sync(&(wl->txpower_adjust_work)); | 4385 | cancel_work_sync(&(wl->txpower_adjust_work)); |
@@ -4560,6 +4562,7 @@ static int b43_wireless_core_attach(struct b43_wldev *dev) | |||
4560 | B43_WARN_ON(1); | 4562 | B43_WARN_ON(1); |
4561 | 4563 | ||
4562 | dev->phy.gmode = have_2ghz_phy; | 4564 | dev->phy.gmode = have_2ghz_phy; |
4565 | dev->phy.radio_on = 1; | ||
4563 | tmp = dev->phy.gmode ? B43_TMSLOW_GMODE : 0; | 4566 | tmp = dev->phy.gmode ? B43_TMSLOW_GMODE : 0; |
4564 | b43_wireless_core_reset(dev, tmp); | 4567 | b43_wireless_core_reset(dev, tmp); |
4565 | 4568 | ||
diff --git a/drivers/net/wireless/b43/pcmcia.c b/drivers/net/wireless/b43/pcmcia.c index 3cfc30307a2..6c3a74964ab 100644 --- a/drivers/net/wireless/b43/pcmcia.c +++ b/drivers/net/wireless/b43/pcmcia.c | |||
@@ -35,6 +35,7 @@ | |||
35 | 35 | ||
36 | static /*const */ struct pcmcia_device_id b43_pcmcia_tbl[] = { | 36 | static /*const */ struct pcmcia_device_id b43_pcmcia_tbl[] = { |
37 | PCMCIA_DEVICE_MANF_CARD(0x2D0, 0x448), | 37 | PCMCIA_DEVICE_MANF_CARD(0x2D0, 0x448), |
38 | PCMCIA_DEVICE_MANF_CARD(0x2D0, 0x476), | ||
38 | PCMCIA_DEVICE_NULL, | 39 | PCMCIA_DEVICE_NULL, |
39 | }; | 40 | }; |
40 | 41 | ||
diff --git a/drivers/net/wireless/b43legacy/b43legacy.h b/drivers/net/wireless/b43legacy/b43legacy.h index 77fda148ac4..038baa8869e 100644 --- a/drivers/net/wireless/b43legacy/b43legacy.h +++ b/drivers/net/wireless/b43legacy/b43legacy.h | |||
@@ -607,6 +607,7 @@ struct b43legacy_wl { | |||
607 | u8 nr_devs; | 607 | u8 nr_devs; |
608 | 608 | ||
609 | bool radiotap_enabled; | 609 | bool radiotap_enabled; |
610 | bool radio_enabled; | ||
610 | 611 | ||
611 | /* The beacon we are currently using (AP or IBSS mode). | 612 | /* The beacon we are currently using (AP or IBSS mode). |
612 | * This beacon stuff is protected by the irq_lock. */ | 613 | * This beacon stuff is protected by the irq_lock. */ |
diff --git a/drivers/net/wireless/b43legacy/main.c b/drivers/net/wireless/b43legacy/main.c index e5136fb65dd..c4973c1942b 100644 --- a/drivers/net/wireless/b43legacy/main.c +++ b/drivers/net/wireless/b43legacy/main.c | |||
@@ -2689,8 +2689,8 @@ static int b43legacy_op_dev_config(struct ieee80211_hw *hw, | |||
2689 | /* Antennas for RX and management frame TX. */ | 2689 | /* Antennas for RX and management frame TX. */ |
2690 | b43legacy_mgmtframe_txantenna(dev, antenna_tx); | 2690 | b43legacy_mgmtframe_txantenna(dev, antenna_tx); |
2691 | 2691 | ||
2692 | if (!!conf->radio_enabled != phy->radio_on) { | 2692 | if (wl->radio_enabled != phy->radio_on) { |
2693 | if (conf->radio_enabled) { | 2693 | if (wl->radio_enabled) { |
2694 | b43legacy_radio_turn_on(dev); | 2694 | b43legacy_radio_turn_on(dev); |
2695 | b43legacyinfo(dev->wl, "Radio turned on by software\n"); | 2695 | b43legacyinfo(dev->wl, "Radio turned on by software\n"); |
2696 | if (!dev->radio_hw_enable) | 2696 | if (!dev->radio_hw_enable) |
@@ -3441,6 +3441,7 @@ static int b43legacy_op_start(struct ieee80211_hw *hw) | |||
3441 | wl->beacon0_uploaded = 0; | 3441 | wl->beacon0_uploaded = 0; |
3442 | wl->beacon1_uploaded = 0; | 3442 | wl->beacon1_uploaded = 0; |
3443 | wl->beacon_templates_virgin = 1; | 3443 | wl->beacon_templates_virgin = 1; |
3444 | wl->radio_enabled = 1; | ||
3444 | 3445 | ||
3445 | mutex_lock(&wl->mutex); | 3446 | mutex_lock(&wl->mutex); |
3446 | 3447 | ||
@@ -3479,6 +3480,7 @@ static void b43legacy_op_stop(struct ieee80211_hw *hw) | |||
3479 | if (b43legacy_status(dev) >= B43legacy_STAT_STARTED) | 3480 | if (b43legacy_status(dev) >= B43legacy_STAT_STARTED) |
3480 | b43legacy_wireless_core_stop(dev); | 3481 | b43legacy_wireless_core_stop(dev); |
3481 | b43legacy_wireless_core_exit(dev); | 3482 | b43legacy_wireless_core_exit(dev); |
3483 | wl->radio_enabled = 0; | ||
3482 | mutex_unlock(&wl->mutex); | 3484 | mutex_unlock(&wl->mutex); |
3483 | } | 3485 | } |
3484 | 3486 | ||
@@ -3620,6 +3622,7 @@ static int b43legacy_wireless_core_attach(struct b43legacy_wldev *dev) | |||
3620 | have_bphy = 1; | 3622 | have_bphy = 1; |
3621 | 3623 | ||
3622 | dev->phy.gmode = (have_gphy || have_bphy); | 3624 | dev->phy.gmode = (have_gphy || have_bphy); |
3625 | dev->phy.radio_on = 1; | ||
3623 | tmp = dev->phy.gmode ? B43legacy_TMSLOW_GMODE : 0; | 3626 | tmp = dev->phy.gmode ? B43legacy_TMSLOW_GMODE : 0; |
3624 | b43legacy_wireless_core_reset(dev, tmp); | 3627 | b43legacy_wireless_core_reset(dev, tmp); |
3625 | 3628 | ||
diff --git a/drivers/net/wireless/iwmc3200wifi/Kconfig b/drivers/net/wireless/iwmc3200wifi/Kconfig index 1eccb6df46d..030401d367d 100644 --- a/drivers/net/wireless/iwmc3200wifi/Kconfig +++ b/drivers/net/wireless/iwmc3200wifi/Kconfig | |||
@@ -4,6 +4,15 @@ config IWM | |||
4 | depends on CFG80211 | 4 | depends on CFG80211 |
5 | select WIRELESS_EXT | 5 | select WIRELESS_EXT |
6 | select FW_LOADER | 6 | select FW_LOADER |
7 | help | ||
8 | The Intel Wireless Multicomm 3200 hardware is a combo | ||
9 | card with GPS, Bluetooth, WiMax and 802.11 radios. It | ||
10 | runs over SDIO and is typically found on Moorestown | ||
11 | based platform. This driver takes care of the 802.11 | ||
12 | part, which is a fullmac one. | ||
13 | |||
14 | If you choose to build it as a module, it'll be called | ||
15 | iwmc3200wifi.ko. | ||
7 | 16 | ||
8 | config IWM_DEBUG | 17 | config IWM_DEBUG |
9 | bool "Enable full debugging output in iwmc3200wifi" | 18 | bool "Enable full debugging output in iwmc3200wifi" |
diff --git a/drivers/net/wireless/mac80211_hwsim.c b/drivers/net/wireless/mac80211_hwsim.c index e789c6e9938..a111bda392e 100644 --- a/drivers/net/wireless/mac80211_hwsim.c +++ b/drivers/net/wireless/mac80211_hwsim.c | |||
@@ -418,6 +418,7 @@ static bool mac80211_hwsim_tx_frame(struct ieee80211_hw *hw, | |||
418 | continue; | 418 | continue; |
419 | 419 | ||
420 | if (!data2->started || !hwsim_ps_rx_ok(data2, skb) || | 420 | if (!data2->started || !hwsim_ps_rx_ok(data2, skb) || |
421 | !data->channel || !data2->channel || | ||
421 | data->channel->center_freq != data2->channel->center_freq || | 422 | data->channel->center_freq != data2->channel->center_freq || |
422 | !(data->group & data2->group)) | 423 | !(data->group & data2->group)) |
423 | continue; | 424 | continue; |
diff --git a/drivers/net/wireless/p54/p54common.c b/drivers/net/wireless/p54/p54common.c index b618bd14583..22ca122bd79 100644 --- a/drivers/net/wireless/p54/p54common.c +++ b/drivers/net/wireless/p54/p54common.c | |||
@@ -823,30 +823,30 @@ void p54_free_skb(struct ieee80211_hw *dev, struct sk_buff *skb) | |||
823 | struct p54_tx_info *range; | 823 | struct p54_tx_info *range; |
824 | unsigned long flags; | 824 | unsigned long flags; |
825 | 825 | ||
826 | if (unlikely(!skb || !dev || skb_queue_empty(&priv->tx_queue))) | 826 | if (unlikely(!skb || !dev || !skb_queue_len(&priv->tx_queue))) |
827 | return; | 827 | return; |
828 | 828 | ||
829 | /* There used to be a check here to see if the SKB was on the | 829 | /* |
830 | * TX queue or not. This can never happen because all SKBs we | 830 | * don't try to free an already unlinked skb |
831 | * see here successfully went through p54_assign_address() | ||
832 | * which means the SKB is on the ->tx_queue. | ||
833 | */ | 831 | */ |
832 | if (unlikely((!skb->next) || (!skb->prev))) | ||
833 | return; | ||
834 | 834 | ||
835 | spin_lock_irqsave(&priv->tx_queue.lock, flags); | 835 | spin_lock_irqsave(&priv->tx_queue.lock, flags); |
836 | info = IEEE80211_SKB_CB(skb); | 836 | info = IEEE80211_SKB_CB(skb); |
837 | range = (void *)info->rate_driver_data; | 837 | range = (void *)info->rate_driver_data; |
838 | if (!skb_queue_is_first(&priv->tx_queue, skb)) { | 838 | if (skb->prev != (struct sk_buff *)&priv->tx_queue) { |
839 | struct ieee80211_tx_info *ni; | 839 | struct ieee80211_tx_info *ni; |
840 | struct p54_tx_info *mr; | 840 | struct p54_tx_info *mr; |
841 | 841 | ||
842 | ni = IEEE80211_SKB_CB(skb_queue_prev(&priv->tx_queue, skb)); | 842 | ni = IEEE80211_SKB_CB(skb->prev); |
843 | mr = (struct p54_tx_info *)ni->rate_driver_data; | 843 | mr = (struct p54_tx_info *)ni->rate_driver_data; |
844 | } | 844 | } |
845 | if (!skb_queue_is_last(&priv->tx_queue, skb)) { | 845 | if (skb->next != (struct sk_buff *)&priv->tx_queue) { |
846 | struct ieee80211_tx_info *ni; | 846 | struct ieee80211_tx_info *ni; |
847 | struct p54_tx_info *mr; | 847 | struct p54_tx_info *mr; |
848 | 848 | ||
849 | ni = IEEE80211_SKB_CB(skb_queue_next(&priv->tx_queue, skb)); | 849 | ni = IEEE80211_SKB_CB(skb->next); |
850 | mr = (struct p54_tx_info *)ni->rate_driver_data; | 850 | mr = (struct p54_tx_info *)ni->rate_driver_data; |
851 | } | 851 | } |
852 | __skb_unlink(skb, &priv->tx_queue); | 852 | __skb_unlink(skb, &priv->tx_queue); |
@@ -864,13 +864,15 @@ static struct sk_buff *p54_find_tx_entry(struct ieee80211_hw *dev, | |||
864 | unsigned long flags; | 864 | unsigned long flags; |
865 | 865 | ||
866 | spin_lock_irqsave(&priv->tx_queue.lock, flags); | 866 | spin_lock_irqsave(&priv->tx_queue.lock, flags); |
867 | skb_queue_walk(&priv->tx_queue, entry) { | 867 | entry = priv->tx_queue.next; |
868 | while (entry != (struct sk_buff *)&priv->tx_queue) { | ||
868 | struct p54_hdr *hdr = (struct p54_hdr *) entry->data; | 869 | struct p54_hdr *hdr = (struct p54_hdr *) entry->data; |
869 | 870 | ||
870 | if (hdr->req_id == req_id) { | 871 | if (hdr->req_id == req_id) { |
871 | spin_unlock_irqrestore(&priv->tx_queue.lock, flags); | 872 | spin_unlock_irqrestore(&priv->tx_queue.lock, flags); |
872 | return entry; | 873 | return entry; |
873 | } | 874 | } |
875 | entry = entry->next; | ||
874 | } | 876 | } |
875 | spin_unlock_irqrestore(&priv->tx_queue.lock, flags); | 877 | spin_unlock_irqrestore(&priv->tx_queue.lock, flags); |
876 | return NULL; | 878 | return NULL; |
@@ -888,33 +890,36 @@ static void p54_rx_frame_sent(struct ieee80211_hw *dev, struct sk_buff *skb) | |||
888 | int count, idx; | 890 | int count, idx; |
889 | 891 | ||
890 | spin_lock_irqsave(&priv->tx_queue.lock, flags); | 892 | spin_lock_irqsave(&priv->tx_queue.lock, flags); |
891 | skb_queue_walk(&priv->tx_queue, entry) { | 893 | entry = (struct sk_buff *) priv->tx_queue.next; |
894 | while (entry != (struct sk_buff *)&priv->tx_queue) { | ||
892 | struct ieee80211_tx_info *info = IEEE80211_SKB_CB(entry); | 895 | struct ieee80211_tx_info *info = IEEE80211_SKB_CB(entry); |
893 | struct p54_hdr *entry_hdr; | 896 | struct p54_hdr *entry_hdr; |
894 | struct p54_tx_data *entry_data; | 897 | struct p54_tx_data *entry_data; |
895 | unsigned int pad = 0, frame_len; | 898 | unsigned int pad = 0, frame_len; |
896 | 899 | ||
897 | range = (void *)info->rate_driver_data; | 900 | range = (void *)info->rate_driver_data; |
898 | if (range->start_addr != addr) | 901 | if (range->start_addr != addr) { |
902 | entry = entry->next; | ||
899 | continue; | 903 | continue; |
904 | } | ||
900 | 905 | ||
901 | if (!skb_queue_is_last(&priv->tx_queue, entry)) { | 906 | if (entry->next != (struct sk_buff *)&priv->tx_queue) { |
902 | struct ieee80211_tx_info *ni; | 907 | struct ieee80211_tx_info *ni; |
903 | struct p54_tx_info *mr; | 908 | struct p54_tx_info *mr; |
904 | 909 | ||
905 | ni = IEEE80211_SKB_CB(skb_queue_next(&priv->tx_queue, | 910 | ni = IEEE80211_SKB_CB(entry->next); |
906 | entry)); | ||
907 | mr = (struct p54_tx_info *)ni->rate_driver_data; | 911 | mr = (struct p54_tx_info *)ni->rate_driver_data; |
908 | } | 912 | } |
909 | 913 | ||
910 | __skb_unlink(entry, &priv->tx_queue); | 914 | __skb_unlink(entry, &priv->tx_queue); |
911 | spin_unlock_irqrestore(&priv->tx_queue.lock, flags); | ||
912 | 915 | ||
913 | frame_len = entry->len; | 916 | frame_len = entry->len; |
914 | entry_hdr = (struct p54_hdr *) entry->data; | 917 | entry_hdr = (struct p54_hdr *) entry->data; |
915 | entry_data = (struct p54_tx_data *) entry_hdr->data; | 918 | entry_data = (struct p54_tx_data *) entry_hdr->data; |
916 | priv->tx_stats[entry_data->hw_queue].len--; | 919 | if (priv->tx_stats[entry_data->hw_queue].len) |
920 | priv->tx_stats[entry_data->hw_queue].len--; | ||
917 | priv->stats.dot11ACKFailureCount += payload->tries - 1; | 921 | priv->stats.dot11ACKFailureCount += payload->tries - 1; |
922 | spin_unlock_irqrestore(&priv->tx_queue.lock, flags); | ||
918 | 923 | ||
919 | /* | 924 | /* |
920 | * Frames in P54_QUEUE_FWSCAN and P54_QUEUE_BEACON are | 925 | * Frames in P54_QUEUE_FWSCAN and P54_QUEUE_BEACON are |
@@ -1164,21 +1169,23 @@ static int p54_assign_address(struct ieee80211_hw *dev, struct sk_buff *skb, | |||
1164 | } | 1169 | } |
1165 | } | 1170 | } |
1166 | 1171 | ||
1167 | skb_queue_walk(&priv->tx_queue, entry) { | 1172 | entry = priv->tx_queue.next; |
1173 | while (left--) { | ||
1168 | u32 hole_size; | 1174 | u32 hole_size; |
1169 | info = IEEE80211_SKB_CB(entry); | 1175 | info = IEEE80211_SKB_CB(entry); |
1170 | range = (void *)info->rate_driver_data; | 1176 | range = (void *)info->rate_driver_data; |
1171 | hole_size = range->start_addr - last_addr; | 1177 | hole_size = range->start_addr - last_addr; |
1172 | if (!target_skb && hole_size >= len) { | 1178 | if (!target_skb && hole_size >= len) { |
1173 | target_skb = skb_queue_prev(&priv->tx_queue, entry); | 1179 | target_skb = entry->prev; |
1174 | hole_size -= len; | 1180 | hole_size -= len; |
1175 | target_addr = last_addr; | 1181 | target_addr = last_addr; |
1176 | } | 1182 | } |
1177 | largest_hole = max(largest_hole, hole_size); | 1183 | largest_hole = max(largest_hole, hole_size); |
1178 | last_addr = range->end_addr; | 1184 | last_addr = range->end_addr; |
1185 | entry = entry->next; | ||
1179 | } | 1186 | } |
1180 | if (!target_skb && priv->rx_end - last_addr >= len) { | 1187 | if (!target_skb && priv->rx_end - last_addr >= len) { |
1181 | target_skb = skb_peek_tail(&priv->tx_queue); | 1188 | target_skb = priv->tx_queue.prev; |
1182 | largest_hole = max(largest_hole, priv->rx_end - last_addr - len); | 1189 | largest_hole = max(largest_hole, priv->rx_end - last_addr - len); |
1183 | if (!skb_queue_empty(&priv->tx_queue)) { | 1190 | if (!skb_queue_empty(&priv->tx_queue)) { |
1184 | info = IEEE80211_SKB_CB(target_skb); | 1191 | info = IEEE80211_SKB_CB(target_skb); |
@@ -2084,6 +2091,7 @@ out: | |||
2084 | static void p54_stop(struct ieee80211_hw *dev) | 2091 | static void p54_stop(struct ieee80211_hw *dev) |
2085 | { | 2092 | { |
2086 | struct p54_common *priv = dev->priv; | 2093 | struct p54_common *priv = dev->priv; |
2094 | struct sk_buff *skb; | ||
2087 | 2095 | ||
2088 | mutex_lock(&priv->conf_mutex); | 2096 | mutex_lock(&priv->conf_mutex); |
2089 | priv->mode = NL80211_IFTYPE_UNSPECIFIED; | 2097 | priv->mode = NL80211_IFTYPE_UNSPECIFIED; |
@@ -2098,7 +2106,8 @@ static void p54_stop(struct ieee80211_hw *dev) | |||
2098 | p54_tx_cancel(dev, priv->cached_beacon); | 2106 | p54_tx_cancel(dev, priv->cached_beacon); |
2099 | 2107 | ||
2100 | priv->stop(dev); | 2108 | priv->stop(dev); |
2101 | skb_queue_purge(&priv->tx_queue); | 2109 | while ((skb = skb_dequeue(&priv->tx_queue))) |
2110 | kfree_skb(skb); | ||
2102 | priv->cached_beacon = NULL; | 2111 | priv->cached_beacon = NULL; |
2103 | priv->tsf_high32 = priv->tsf_low32 = 0; | 2112 | priv->tsf_high32 = priv->tsf_low32 = 0; |
2104 | mutex_unlock(&priv->conf_mutex); | 2113 | mutex_unlock(&priv->conf_mutex); |
diff --git a/drivers/net/wireless/ray_cs.c b/drivers/net/wireless/ray_cs.c index b10b0383dfa..698b11b1cad 100644 --- a/drivers/net/wireless/ray_cs.c +++ b/drivers/net/wireless/ray_cs.c | |||
@@ -2427,11 +2427,10 @@ static void untranslate(ray_dev_t *local, struct sk_buff *skb, int len) | |||
2427 | 2427 | ||
2428 | #ifdef PCMCIA_DEBUG | 2428 | #ifdef PCMCIA_DEBUG |
2429 | if (pc_debug > 3) { | 2429 | if (pc_debug > 3) { |
2430 | int i; | 2430 | print_hex_dump(KERN_DEBUG, "skb->data before untranslate: ", |
2431 | printk(KERN_DEBUG "skb->data before untranslate"); | 2431 | DUMP_PREFIX_NONE, 16, 1, |
2432 | for (i = 0; i < 64; i++) | 2432 | skb->data, 64, true); |
2433 | printk("%02x ", skb->data[i]); | 2433 | printk(KERN_DEBUG |
2434 | printk("\n" KERN_DEBUG | ||
2435 | "type = %08x, xsap = %02x%02x%02x, org = %02x02x02x\n", | 2434 | "type = %08x, xsap = %02x%02x%02x, org = %02x02x02x\n", |
2436 | ntohs(type), psnap->dsap, psnap->ssap, psnap->ctrl, | 2435 | ntohs(type), psnap->dsap, psnap->ssap, psnap->ctrl, |
2437 | psnap->org[0], psnap->org[1], psnap->org[2]); | 2436 | psnap->org[0], psnap->org[1], psnap->org[2]); |
diff --git a/drivers/net/wireless/wavelan_cs.c b/drivers/net/wireless/wavelan_cs.c index 6af706408ac..c6d300666ad 100644 --- a/drivers/net/wireless/wavelan_cs.c +++ b/drivers/net/wireless/wavelan_cs.c | |||
@@ -3556,17 +3556,8 @@ wv_82593_config(struct net_device * dev) | |||
3556 | cfblk.rcvstop = TRUE; /* Enable Receive Stop Register */ | 3556 | cfblk.rcvstop = TRUE; /* Enable Receive Stop Register */ |
3557 | 3557 | ||
3558 | #ifdef DEBUG_I82593_SHOW | 3558 | #ifdef DEBUG_I82593_SHOW |
3559 | { | 3559 | print_hex_dump(KERN_DEBUG, "wavelan_cs: config block: ", DUMP_PREFIX_NONE, |
3560 | u_char *c = (u_char *) &cfblk; | 3560 | 16, 1, &cfblk, sizeof(struct i82593_conf_block), false); |
3561 | int i; | ||
3562 | printk(KERN_DEBUG "wavelan_cs: config block:"); | ||
3563 | for(i = 0; i < sizeof(struct i82593_conf_block); i++,c++) | ||
3564 | { | ||
3565 | if((i % 16) == 0) printk("\n" KERN_DEBUG); | ||
3566 | printk("%02x ", *c); | ||
3567 | } | ||
3568 | printk("\n"); | ||
3569 | } | ||
3570 | #endif | 3561 | #endif |
3571 | 3562 | ||
3572 | /* Copy the config block to the i82593 */ | 3563 | /* Copy the config block to the i82593 */ |
diff --git a/drivers/net/wireless/zd1211rw/zd_usb.c b/drivers/net/wireless/zd1211rw/zd_usb.c index 14a19baff21..0e6e44689cc 100644 --- a/drivers/net/wireless/zd1211rw/zd_usb.c +++ b/drivers/net/wireless/zd1211rw/zd_usb.c | |||
@@ -38,7 +38,6 @@ static struct usb_device_id usb_ids[] = { | |||
38 | /* ZD1211 */ | 38 | /* ZD1211 */ |
39 | { USB_DEVICE(0x0ace, 0x1211), .driver_info = DEVICE_ZD1211 }, | 39 | { USB_DEVICE(0x0ace, 0x1211), .driver_info = DEVICE_ZD1211 }, |
40 | { USB_DEVICE(0x0ace, 0xa211), .driver_info = DEVICE_ZD1211 }, | 40 | { USB_DEVICE(0x0ace, 0xa211), .driver_info = DEVICE_ZD1211 }, |
41 | { USB_DEVICE(0x07b8, 0x6001), .driver_info = DEVICE_ZD1211 }, | ||
42 | { USB_DEVICE(0x126f, 0xa006), .driver_info = DEVICE_ZD1211 }, | 41 | { USB_DEVICE(0x126f, 0xa006), .driver_info = DEVICE_ZD1211 }, |
43 | { USB_DEVICE(0x6891, 0xa727), .driver_info = DEVICE_ZD1211 }, | 42 | { USB_DEVICE(0x6891, 0xa727), .driver_info = DEVICE_ZD1211 }, |
44 | { USB_DEVICE(0x0df6, 0x9071), .driver_info = DEVICE_ZD1211 }, | 43 | { USB_DEVICE(0x0df6, 0x9071), .driver_info = DEVICE_ZD1211 }, |
@@ -61,6 +60,7 @@ static struct usb_device_id usb_ids[] = { | |||
61 | { USB_DEVICE(0x157e, 0x300a), .driver_info = DEVICE_ZD1211 }, | 60 | { USB_DEVICE(0x157e, 0x300a), .driver_info = DEVICE_ZD1211 }, |
62 | { USB_DEVICE(0x0105, 0x145f), .driver_info = DEVICE_ZD1211 }, | 61 | { USB_DEVICE(0x0105, 0x145f), .driver_info = DEVICE_ZD1211 }, |
63 | /* ZD1211B */ | 62 | /* ZD1211B */ |
63 | { USB_DEVICE(0x054c, 0x0257), .driver_info = DEVICE_ZD1211B }, | ||
64 | { USB_DEVICE(0x0ace, 0x1215), .driver_info = DEVICE_ZD1211B }, | 64 | { USB_DEVICE(0x0ace, 0x1215), .driver_info = DEVICE_ZD1211B }, |
65 | { USB_DEVICE(0x0ace, 0xb215), .driver_info = DEVICE_ZD1211B }, | 65 | { USB_DEVICE(0x0ace, 0xb215), .driver_info = DEVICE_ZD1211B }, |
66 | { USB_DEVICE(0x157e, 0x300d), .driver_info = DEVICE_ZD1211B }, | 66 | { USB_DEVICE(0x157e, 0x300d), .driver_info = DEVICE_ZD1211B }, |
@@ -87,6 +87,7 @@ static struct usb_device_id usb_ids[] = { | |||
87 | { USB_DEVICE(0x0471, 0x1237), .driver_info = DEVICE_ZD1211B }, | 87 | { USB_DEVICE(0x0471, 0x1237), .driver_info = DEVICE_ZD1211B }, |
88 | { USB_DEVICE(0x07fa, 0x1196), .driver_info = DEVICE_ZD1211B }, | 88 | { USB_DEVICE(0x07fa, 0x1196), .driver_info = DEVICE_ZD1211B }, |
89 | { USB_DEVICE(0x0df6, 0x0036), .driver_info = DEVICE_ZD1211B }, | 89 | { USB_DEVICE(0x0df6, 0x0036), .driver_info = DEVICE_ZD1211B }, |
90 | { USB_DEVICE(0x07b8, 0x6001), .driver_info = DEVICE_ZD1211B }, | ||
90 | /* "Driverless" devices that need ejecting */ | 91 | /* "Driverless" devices that need ejecting */ |
91 | { USB_DEVICE(0x0ace, 0x2011), .driver_info = DEVICE_INSTALLER }, | 92 | { USB_DEVICE(0x0ace, 0x2011), .driver_info = DEVICE_INSTALLER }, |
92 | { USB_DEVICE(0x0ace, 0x20ff), .driver_info = DEVICE_INSTALLER }, | 93 | { USB_DEVICE(0x0ace, 0x20ff), .driver_info = DEVICE_INSTALLER }, |
diff --git a/drivers/net/yellowfin.c b/drivers/net/yellowfin.c index 3c7a5053f1d..a07580138e8 100644 --- a/drivers/net/yellowfin.c +++ b/drivers/net/yellowfin.c | |||
@@ -109,7 +109,7 @@ static int gx_fix; | |||
109 | /* These identify the driver base version and may not be removed. */ | 109 | /* These identify the driver base version and may not be removed. */ |
110 | static const char version[] __devinitconst = | 110 | static const char version[] __devinitconst = |
111 | KERN_INFO DRV_NAME ".c:v1.05 1/09/2001 Written by Donald Becker <becker@scyld.com>\n" | 111 | KERN_INFO DRV_NAME ".c:v1.05 1/09/2001 Written by Donald Becker <becker@scyld.com>\n" |
112 | KERN_INFO " (unofficial 2.4.x port, " DRV_VERSION ", " DRV_RELDATE ")\n"; | 112 | " (unofficial 2.4.x port, " DRV_VERSION ", " DRV_RELDATE ")\n"; |
113 | 113 | ||
114 | MODULE_AUTHOR("Donald Becker <becker@scyld.com>"); | 114 | MODULE_AUTHOR("Donald Becker <becker@scyld.com>"); |
115 | MODULE_DESCRIPTION("Packet Engines Yellowfin G-NIC Gigabit Ethernet driver"); | 115 | MODULE_DESCRIPTION("Packet Engines Yellowfin G-NIC Gigabit Ethernet driver"); |
@@ -700,12 +700,15 @@ static void yellowfin_tx_timeout(struct net_device *dev) | |||
700 | int i; | 700 | int i; |
701 | printk(KERN_WARNING " Rx ring %p: ", yp->rx_ring); | 701 | printk(KERN_WARNING " Rx ring %p: ", yp->rx_ring); |
702 | for (i = 0; i < RX_RING_SIZE; i++) | 702 | for (i = 0; i < RX_RING_SIZE; i++) |
703 | printk(" %8.8x", yp->rx_ring[i].result_status); | 703 | printk(KERN_CONT " %8.8x", |
704 | printk("\n"KERN_WARNING" Tx ring %p: ", yp->tx_ring); | 704 | yp->rx_ring[i].result_status); |
705 | printk(KERN_CONT "\n"); | ||
706 | printk(KERN_WARNING" Tx ring %p: ", yp->tx_ring); | ||
705 | for (i = 0; i < TX_RING_SIZE; i++) | 707 | for (i = 0; i < TX_RING_SIZE; i++) |
706 | printk(" %4.4x /%8.8x", yp->tx_status[i].tx_errs, | 708 | printk(KERN_CONT " %4.4x /%8.8x", |
707 | yp->tx_ring[i].result_status); | 709 | yp->tx_status[i].tx_errs, |
708 | printk("\n"); | 710 | yp->tx_ring[i].result_status); |
711 | printk(KERN_CONT "\n"); | ||
709 | } | 712 | } |
710 | 713 | ||
711 | /* If the hardware is found to hang regularly, we will update the code | 714 | /* If the hardware is found to hang regularly, we will update the code |
@@ -1216,20 +1219,20 @@ static int yellowfin_close(struct net_device *dev) | |||
1216 | 1219 | ||
1217 | #if defined(__i386__) | 1220 | #if defined(__i386__) |
1218 | if (yellowfin_debug > 2) { | 1221 | if (yellowfin_debug > 2) { |
1219 | printk("\n"KERN_DEBUG" Tx ring at %8.8llx:\n", | 1222 | printk(KERN_DEBUG" Tx ring at %8.8llx:\n", |
1220 | (unsigned long long)yp->tx_ring_dma); | 1223 | (unsigned long long)yp->tx_ring_dma); |
1221 | for (i = 0; i < TX_RING_SIZE*2; i++) | 1224 | for (i = 0; i < TX_RING_SIZE*2; i++) |
1222 | printk(" %c #%d desc. %8.8x %8.8x %8.8x %8.8x.\n", | 1225 | printk(KERN_DEBUG " %c #%d desc. %8.8x %8.8x %8.8x %8.8x.\n", |
1223 | ioread32(ioaddr + TxPtr) == (long)&yp->tx_ring[i] ? '>' : ' ', | 1226 | ioread32(ioaddr + TxPtr) == (long)&yp->tx_ring[i] ? '>' : ' ', |
1224 | i, yp->tx_ring[i].dbdma_cmd, yp->tx_ring[i].addr, | 1227 | i, yp->tx_ring[i].dbdma_cmd, yp->tx_ring[i].addr, |
1225 | yp->tx_ring[i].branch_addr, yp->tx_ring[i].result_status); | 1228 | yp->tx_ring[i].branch_addr, yp->tx_ring[i].result_status); |
1226 | printk(KERN_DEBUG " Tx status %p:\n", yp->tx_status); | 1229 | printk(KERN_DEBUG " Tx status %p:\n", yp->tx_status); |
1227 | for (i = 0; i < TX_RING_SIZE; i++) | 1230 | for (i = 0; i < TX_RING_SIZE; i++) |
1228 | printk(" #%d status %4.4x %4.4x %4.4x %4.4x.\n", | 1231 | printk(KERN_DEBUG " #%d status %4.4x %4.4x %4.4x %4.4x.\n", |
1229 | i, yp->tx_status[i].tx_cnt, yp->tx_status[i].tx_errs, | 1232 | i, yp->tx_status[i].tx_cnt, yp->tx_status[i].tx_errs, |
1230 | yp->tx_status[i].total_tx_cnt, yp->tx_status[i].paused); | 1233 | yp->tx_status[i].total_tx_cnt, yp->tx_status[i].paused); |
1231 | 1234 | ||
1232 | printk("\n"KERN_DEBUG " Rx ring %8.8llx:\n", | 1235 | printk(KERN_DEBUG " Rx ring %8.8llx:\n", |
1233 | (unsigned long long)yp->rx_ring_dma); | 1236 | (unsigned long long)yp->rx_ring_dma); |
1234 | for (i = 0; i < RX_RING_SIZE; i++) { | 1237 | for (i = 0; i < RX_RING_SIZE; i++) { |
1235 | printk(KERN_DEBUG " %c #%d desc. %8.8x %8.8x %8.8x\n", | 1238 | printk(KERN_DEBUG " %c #%d desc. %8.8x %8.8x %8.8x\n", |
diff --git a/drivers/oprofile/oprofile_stats.c b/drivers/oprofile/oprofile_stats.c index e1f6ce03705..3c2270a8300 100644 --- a/drivers/oprofile/oprofile_stats.c +++ b/drivers/oprofile/oprofile_stats.c | |||
@@ -33,6 +33,7 @@ void oprofile_reset_stats(void) | |||
33 | atomic_set(&oprofile_stats.sample_lost_no_mm, 0); | 33 | atomic_set(&oprofile_stats.sample_lost_no_mm, 0); |
34 | atomic_set(&oprofile_stats.sample_lost_no_mapping, 0); | 34 | atomic_set(&oprofile_stats.sample_lost_no_mapping, 0); |
35 | atomic_set(&oprofile_stats.event_lost_overflow, 0); | 35 | atomic_set(&oprofile_stats.event_lost_overflow, 0); |
36 | atomic_set(&oprofile_stats.bt_lost_no_mapping, 0); | ||
36 | } | 37 | } |
37 | 38 | ||
38 | 39 | ||
diff --git a/drivers/parisc/eisa_enumerator.c b/drivers/parisc/eisa_enumerator.c index c709ecc2b7f..0be1d50645a 100644 --- a/drivers/parisc/eisa_enumerator.c +++ b/drivers/parisc/eisa_enumerator.c | |||
@@ -101,7 +101,7 @@ static int configure_memory(const unsigned char *buf, | |||
101 | printk("memory %lx-%lx ", (unsigned long)res->start, (unsigned long)res->end); | 101 | printk("memory %lx-%lx ", (unsigned long)res->start, (unsigned long)res->end); |
102 | result = request_resource(mem_parent, res); | 102 | result = request_resource(mem_parent, res); |
103 | if (result < 0) { | 103 | if (result < 0) { |
104 | printk("\n" KERN_ERR "EISA Enumerator: failed to claim EISA Bus address space!\n"); | 104 | printk(KERN_ERR "EISA Enumerator: failed to claim EISA Bus address space!\n"); |
105 | return result; | 105 | return result; |
106 | } | 106 | } |
107 | } | 107 | } |
@@ -191,7 +191,7 @@ static int configure_port(const unsigned char *buf, struct resource *io_parent, | |||
191 | printk("ioports %lx-%lx ", (unsigned long)res->start, (unsigned long)res->end); | 191 | printk("ioports %lx-%lx ", (unsigned long)res->start, (unsigned long)res->end); |
192 | result = request_resource(io_parent, res); | 192 | result = request_resource(io_parent, res); |
193 | if (result < 0) { | 193 | if (result < 0) { |
194 | printk("\n" KERN_ERR "EISA Enumerator: failed to claim EISA Bus address space!\n"); | 194 | printk(KERN_ERR "EISA Enumerator: failed to claim EISA Bus address space!\n"); |
195 | return result; | 195 | return result; |
196 | } | 196 | } |
197 | } | 197 | } |
@@ -224,7 +224,7 @@ static int configure_port_init(const unsigned char *buf) | |||
224 | case HPEE_PORT_INIT_WIDTH_BYTE: | 224 | case HPEE_PORT_INIT_WIDTH_BYTE: |
225 | s=1; | 225 | s=1; |
226 | if (c & HPEE_PORT_INIT_MASK) { | 226 | if (c & HPEE_PORT_INIT_MASK) { |
227 | printk("\n" KERN_WARNING "port_init: unverified mask attribute\n"); | 227 | printk(KERN_WARNING "port_init: unverified mask attribute\n"); |
228 | outb((inb(get_16(buf+len+1) & | 228 | outb((inb(get_16(buf+len+1) & |
229 | get_8(buf+len+3)) | | 229 | get_8(buf+len+3)) | |
230 | get_8(buf+len+4)), get_16(buf+len+1)); | 230 | get_8(buf+len+4)), get_16(buf+len+1)); |
@@ -249,7 +249,7 @@ static int configure_port_init(const unsigned char *buf) | |||
249 | case HPEE_PORT_INIT_WIDTH_DWORD: | 249 | case HPEE_PORT_INIT_WIDTH_DWORD: |
250 | s=4; | 250 | s=4; |
251 | if (c & HPEE_PORT_INIT_MASK) { | 251 | if (c & HPEE_PORT_INIT_MASK) { |
252 | printk("\n" KERN_WARNING "port_init: unverified mask attribute\n"); | 252 | printk(KERN_WARNING "port_init: unverified mask attribute\n"); |
253 | outl((inl(get_16(buf+len+1) & | 253 | outl((inl(get_16(buf+len+1) & |
254 | get_32(buf+len+3)) | | 254 | get_32(buf+len+3)) | |
255 | get_32(buf+len+7)), get_16(buf+len+1)); | 255 | get_32(buf+len+7)), get_16(buf+len+1)); |
@@ -259,7 +259,7 @@ static int configure_port_init(const unsigned char *buf) | |||
259 | 259 | ||
260 | break; | 260 | break; |
261 | default: | 261 | default: |
262 | printk("\n" KERN_ERR "Invalid port init word %02x\n", c); | 262 | printk(KERN_ERR "Invalid port init word %02x\n", c); |
263 | return 0; | 263 | return 0; |
264 | } | 264 | } |
265 | 265 | ||
@@ -297,7 +297,7 @@ static int configure_type_string(const unsigned char *buf) | |||
297 | /* just skip past the type field */ | 297 | /* just skip past the type field */ |
298 | len = get_8(buf); | 298 | len = get_8(buf); |
299 | if (len > 80) { | 299 | if (len > 80) { |
300 | printk("\n" KERN_ERR "eisa_enumerator: type info field too long (%d, max is 80)\n", len); | 300 | printk(KERN_ERR "eisa_enumerator: type info field too long (%d, max is 80)\n", len); |
301 | } | 301 | } |
302 | 302 | ||
303 | return 1+len; | 303 | return 1+len; |
@@ -398,7 +398,7 @@ static int parse_slot_config(int slot, | |||
398 | } | 398 | } |
399 | 399 | ||
400 | if (p0 + function_len < pos) { | 400 | if (p0 + function_len < pos) { |
401 | printk("\n" KERN_ERR "eisa_enumerator: function %d length mis-match " | 401 | printk(KERN_ERR "eisa_enumerator: function %d length mis-match " |
402 | "got %d, expected %d\n", | 402 | "got %d, expected %d\n", |
403 | num_func, pos-p0, function_len); | 403 | num_func, pos-p0, function_len); |
404 | res=-1; | 404 | res=-1; |
diff --git a/drivers/pci/hotplug/pci_hotplug_core.c b/drivers/pci/hotplug/pci_hotplug_core.c index 844580489d4..5c5043f239c 100644 --- a/drivers/pci/hotplug/pci_hotplug_core.c +++ b/drivers/pci/hotplug/pci_hotplug_core.c | |||
@@ -555,6 +555,8 @@ static struct hotplug_slot *get_slot_from_name (const char *name) | |||
555 | * @slot: pointer to the &struct hotplug_slot to register | 555 | * @slot: pointer to the &struct hotplug_slot to register |
556 | * @devnr: device number | 556 | * @devnr: device number |
557 | * @name: name registered with kobject core | 557 | * @name: name registered with kobject core |
558 | * @owner: caller module owner | ||
559 | * @mod_name: caller module name | ||
558 | * | 560 | * |
559 | * Registers a hotplug slot with the pci hotplug subsystem, which will allow | 561 | * Registers a hotplug slot with the pci hotplug subsystem, which will allow |
560 | * userspace interaction to the slot. | 562 | * userspace interaction to the slot. |
diff --git a/drivers/pci/intel-iommu.c b/drivers/pci/intel-iommu.c index 53075424a43..ebc9b8dca88 100644 --- a/drivers/pci/intel-iommu.c +++ b/drivers/pci/intel-iommu.c | |||
@@ -2117,6 +2117,47 @@ static int domain_add_dev_info(struct dmar_domain *domain, | |||
2117 | return 0; | 2117 | return 0; |
2118 | } | 2118 | } |
2119 | 2119 | ||
2120 | static int iommu_should_identity_map(struct pci_dev *pdev, int startup) | ||
2121 | { | ||
2122 | if (iommu_identity_mapping == 2) | ||
2123 | return IS_GFX_DEVICE(pdev); | ||
2124 | |||
2125 | /* | ||
2126 | * We want to start off with all devices in the 1:1 domain, and | ||
2127 | * take them out later if we find they can't access all of memory. | ||
2128 | * | ||
2129 | * However, we can't do this for PCI devices behind bridges, | ||
2130 | * because all PCI devices behind the same bridge will end up | ||
2131 | * with the same source-id on their transactions. | ||
2132 | * | ||
2133 | * Practically speaking, we can't change things around for these | ||
2134 | * devices at run-time, because we can't be sure there'll be no | ||
2135 | * DMA transactions in flight for any of their siblings. | ||
2136 | * | ||
2137 | * So PCI devices (unless they're on the root bus) as well as | ||
2138 | * their parent PCI-PCI or PCIe-PCI bridges must be left _out_ of | ||
2139 | * the 1:1 domain, just in _case_ one of their siblings turns out | ||
2140 | * not to be able to map all of memory. | ||
2141 | */ | ||
2142 | if (!pdev->is_pcie) { | ||
2143 | if (!pci_is_root_bus(pdev->bus)) | ||
2144 | return 0; | ||
2145 | if (pdev->class >> 8 == PCI_CLASS_BRIDGE_PCI) | ||
2146 | return 0; | ||
2147 | } else if (pdev->pcie_type == PCI_EXP_TYPE_PCI_BRIDGE) | ||
2148 | return 0; | ||
2149 | |||
2150 | /* | ||
2151 | * At boot time, we don't yet know if devices will be 64-bit capable. | ||
2152 | * Assume that they will -- if they turn out not to be, then we can | ||
2153 | * take them out of the 1:1 domain later. | ||
2154 | */ | ||
2155 | if (!startup) | ||
2156 | return pdev->dma_mask > DMA_BIT_MASK(32); | ||
2157 | |||
2158 | return 1; | ||
2159 | } | ||
2160 | |||
2120 | static int iommu_prepare_static_identity_mapping(void) | 2161 | static int iommu_prepare_static_identity_mapping(void) |
2121 | { | 2162 | { |
2122 | struct pci_dev *pdev = NULL; | 2163 | struct pci_dev *pdev = NULL; |
@@ -2127,16 +2168,18 @@ static int iommu_prepare_static_identity_mapping(void) | |||
2127 | return -EFAULT; | 2168 | return -EFAULT; |
2128 | 2169 | ||
2129 | for_each_pci_dev(pdev) { | 2170 | for_each_pci_dev(pdev) { |
2130 | printk(KERN_INFO "IOMMU: identity mapping for device %s\n", | 2171 | if (iommu_should_identity_map(pdev, 1)) { |
2131 | pci_name(pdev)); | 2172 | printk(KERN_INFO "IOMMU: identity mapping for device %s\n", |
2173 | pci_name(pdev)); | ||
2132 | 2174 | ||
2133 | ret = domain_context_mapping(si_domain, pdev, | 2175 | ret = domain_context_mapping(si_domain, pdev, |
2134 | CONTEXT_TT_MULTI_LEVEL); | 2176 | CONTEXT_TT_MULTI_LEVEL); |
2135 | if (ret) | 2177 | if (ret) |
2136 | return ret; | 2178 | return ret; |
2137 | ret = domain_add_dev_info(si_domain, pdev); | 2179 | ret = domain_add_dev_info(si_domain, pdev); |
2138 | if (ret) | 2180 | if (ret) |
2139 | return ret; | 2181 | return ret; |
2182 | } | ||
2140 | } | 2183 | } |
2141 | 2184 | ||
2142 | return 0; | 2185 | return 0; |
@@ -2291,6 +2334,10 @@ int __init init_dmars(void) | |||
2291 | * identity mapping if iommu_identity_mapping is set. | 2334 | * identity mapping if iommu_identity_mapping is set. |
2292 | */ | 2335 | */ |
2293 | if (!iommu_pass_through) { | 2336 | if (!iommu_pass_through) { |
2337 | #ifdef CONFIG_DMAR_BROKEN_GFX_WA | ||
2338 | if (!iommu_identity_mapping) | ||
2339 | iommu_identity_mapping = 2; | ||
2340 | #endif | ||
2294 | if (iommu_identity_mapping) | 2341 | if (iommu_identity_mapping) |
2295 | iommu_prepare_static_identity_mapping(); | 2342 | iommu_prepare_static_identity_mapping(); |
2296 | /* | 2343 | /* |
@@ -2368,15 +2415,15 @@ error: | |||
2368 | return ret; | 2415 | return ret; |
2369 | } | 2416 | } |
2370 | 2417 | ||
2418 | /* Returns a number of VTD pages, but aligned to MM page size */ | ||
2371 | static inline unsigned long aligned_nrpages(unsigned long host_addr, | 2419 | static inline unsigned long aligned_nrpages(unsigned long host_addr, |
2372 | size_t size) | 2420 | size_t size) |
2373 | { | 2421 | { |
2374 | host_addr &= ~PAGE_MASK; | 2422 | host_addr &= ~PAGE_MASK; |
2375 | host_addr += size + PAGE_SIZE - 1; | 2423 | return PAGE_ALIGN(host_addr + size) >> VTD_PAGE_SHIFT; |
2376 | |||
2377 | return host_addr >> VTD_PAGE_SHIFT; | ||
2378 | } | 2424 | } |
2379 | 2425 | ||
2426 | /* This takes a number of _MM_ pages, not VTD pages */ | ||
2380 | static struct iova *intel_alloc_iova(struct device *dev, | 2427 | static struct iova *intel_alloc_iova(struct device *dev, |
2381 | struct dmar_domain *domain, | 2428 | struct dmar_domain *domain, |
2382 | unsigned long nrpages, uint64_t dma_mask) | 2429 | unsigned long nrpages, uint64_t dma_mask) |
@@ -2443,16 +2490,24 @@ static int iommu_dummy(struct pci_dev *pdev) | |||
2443 | } | 2490 | } |
2444 | 2491 | ||
2445 | /* Check if the pdev needs to go through non-identity map and unmap process.*/ | 2492 | /* Check if the pdev needs to go through non-identity map and unmap process.*/ |
2446 | static int iommu_no_mapping(struct pci_dev *pdev) | 2493 | static int iommu_no_mapping(struct device *dev) |
2447 | { | 2494 | { |
2495 | struct pci_dev *pdev; | ||
2448 | int found; | 2496 | int found; |
2449 | 2497 | ||
2498 | if (unlikely(dev->bus != &pci_bus_type)) | ||
2499 | return 1; | ||
2500 | |||
2501 | pdev = to_pci_dev(dev); | ||
2502 | if (iommu_dummy(pdev)) | ||
2503 | return 1; | ||
2504 | |||
2450 | if (!iommu_identity_mapping) | 2505 | if (!iommu_identity_mapping) |
2451 | return iommu_dummy(pdev); | 2506 | return 0; |
2452 | 2507 | ||
2453 | found = identity_mapping(pdev); | 2508 | found = identity_mapping(pdev); |
2454 | if (found) { | 2509 | if (found) { |
2455 | if (pdev->dma_mask > DMA_BIT_MASK(32)) | 2510 | if (iommu_should_identity_map(pdev, 0)) |
2456 | return 1; | 2511 | return 1; |
2457 | else { | 2512 | else { |
2458 | /* | 2513 | /* |
@@ -2469,9 +2524,12 @@ static int iommu_no_mapping(struct pci_dev *pdev) | |||
2469 | * In case of a detached 64 bit DMA device from vm, the device | 2524 | * In case of a detached 64 bit DMA device from vm, the device |
2470 | * is put into si_domain for identity mapping. | 2525 | * is put into si_domain for identity mapping. |
2471 | */ | 2526 | */ |
2472 | if (pdev->dma_mask > DMA_BIT_MASK(32)) { | 2527 | if (iommu_should_identity_map(pdev, 0)) { |
2473 | int ret; | 2528 | int ret; |
2474 | ret = domain_add_dev_info(si_domain, pdev); | 2529 | ret = domain_add_dev_info(si_domain, pdev); |
2530 | if (ret) | ||
2531 | return 0; | ||
2532 | ret = domain_context_mapping(si_domain, pdev, CONTEXT_TT_MULTI_LEVEL); | ||
2475 | if (!ret) { | 2533 | if (!ret) { |
2476 | printk(KERN_INFO "64bit %s uses identity mapping\n", | 2534 | printk(KERN_INFO "64bit %s uses identity mapping\n", |
2477 | pci_name(pdev)); | 2535 | pci_name(pdev)); |
@@ -2480,7 +2538,7 @@ static int iommu_no_mapping(struct pci_dev *pdev) | |||
2480 | } | 2538 | } |
2481 | } | 2539 | } |
2482 | 2540 | ||
2483 | return iommu_dummy(pdev); | 2541 | return 0; |
2484 | } | 2542 | } |
2485 | 2543 | ||
2486 | static dma_addr_t __intel_map_single(struct device *hwdev, phys_addr_t paddr, | 2544 | static dma_addr_t __intel_map_single(struct device *hwdev, phys_addr_t paddr, |
@@ -2496,7 +2554,7 @@ static dma_addr_t __intel_map_single(struct device *hwdev, phys_addr_t paddr, | |||
2496 | 2554 | ||
2497 | BUG_ON(dir == DMA_NONE); | 2555 | BUG_ON(dir == DMA_NONE); |
2498 | 2556 | ||
2499 | if (iommu_no_mapping(pdev)) | 2557 | if (iommu_no_mapping(hwdev)) |
2500 | return paddr; | 2558 | return paddr; |
2501 | 2559 | ||
2502 | domain = get_valid_domain_for_dev(pdev); | 2560 | domain = get_valid_domain_for_dev(pdev); |
@@ -2506,7 +2564,8 @@ static dma_addr_t __intel_map_single(struct device *hwdev, phys_addr_t paddr, | |||
2506 | iommu = domain_get_iommu(domain); | 2564 | iommu = domain_get_iommu(domain); |
2507 | size = aligned_nrpages(paddr, size); | 2565 | size = aligned_nrpages(paddr, size); |
2508 | 2566 | ||
2509 | iova = intel_alloc_iova(hwdev, domain, size, pdev->dma_mask); | 2567 | iova = intel_alloc_iova(hwdev, domain, dma_to_mm_pfn(size), |
2568 | pdev->dma_mask); | ||
2510 | if (!iova) | 2569 | if (!iova) |
2511 | goto error; | 2570 | goto error; |
2512 | 2571 | ||
@@ -2635,7 +2694,7 @@ static void intel_unmap_page(struct device *dev, dma_addr_t dev_addr, | |||
2635 | struct iova *iova; | 2694 | struct iova *iova; |
2636 | struct intel_iommu *iommu; | 2695 | struct intel_iommu *iommu; |
2637 | 2696 | ||
2638 | if (iommu_no_mapping(pdev)) | 2697 | if (iommu_no_mapping(dev)) |
2639 | return; | 2698 | return; |
2640 | 2699 | ||
2641 | domain = find_domain(pdev); | 2700 | domain = find_domain(pdev); |
@@ -2726,7 +2785,7 @@ static void intel_unmap_sg(struct device *hwdev, struct scatterlist *sglist, | |||
2726 | struct iova *iova; | 2785 | struct iova *iova; |
2727 | struct intel_iommu *iommu; | 2786 | struct intel_iommu *iommu; |
2728 | 2787 | ||
2729 | if (iommu_no_mapping(pdev)) | 2788 | if (iommu_no_mapping(hwdev)) |
2730 | return; | 2789 | return; |
2731 | 2790 | ||
2732 | domain = find_domain(pdev); | 2791 | domain = find_domain(pdev); |
@@ -2785,7 +2844,7 @@ static int intel_map_sg(struct device *hwdev, struct scatterlist *sglist, int ne | |||
2785 | struct intel_iommu *iommu; | 2844 | struct intel_iommu *iommu; |
2786 | 2845 | ||
2787 | BUG_ON(dir == DMA_NONE); | 2846 | BUG_ON(dir == DMA_NONE); |
2788 | if (iommu_no_mapping(pdev)) | 2847 | if (iommu_no_mapping(hwdev)) |
2789 | return intel_nontranslate_map_sg(hwdev, sglist, nelems, dir); | 2848 | return intel_nontranslate_map_sg(hwdev, sglist, nelems, dir); |
2790 | 2849 | ||
2791 | domain = get_valid_domain_for_dev(pdev); | 2850 | domain = get_valid_domain_for_dev(pdev); |
@@ -2797,7 +2856,8 @@ static int intel_map_sg(struct device *hwdev, struct scatterlist *sglist, int ne | |||
2797 | for_each_sg(sglist, sg, nelems, i) | 2856 | for_each_sg(sglist, sg, nelems, i) |
2798 | size += aligned_nrpages(sg->offset, sg->length); | 2857 | size += aligned_nrpages(sg->offset, sg->length); |
2799 | 2858 | ||
2800 | iova = intel_alloc_iova(hwdev, domain, size, pdev->dma_mask); | 2859 | iova = intel_alloc_iova(hwdev, domain, dma_to_mm_pfn(size), |
2860 | pdev->dma_mask); | ||
2801 | if (!iova) { | 2861 | if (!iova) { |
2802 | sglist->dma_length = 0; | 2862 | sglist->dma_length = 0; |
2803 | return 0; | 2863 | return 0; |
@@ -3540,6 +3600,9 @@ static void intel_iommu_unmap_range(struct iommu_domain *domain, | |||
3540 | { | 3600 | { |
3541 | struct dmar_domain *dmar_domain = domain->priv; | 3601 | struct dmar_domain *dmar_domain = domain->priv; |
3542 | 3602 | ||
3603 | if (!size) | ||
3604 | return; | ||
3605 | |||
3543 | dma_pte_clear_range(dmar_domain, iova >> VTD_PAGE_SHIFT, | 3606 | dma_pte_clear_range(dmar_domain, iova >> VTD_PAGE_SHIFT, |
3544 | (iova + size - 1) >> VTD_PAGE_SHIFT); | 3607 | (iova + size - 1) >> VTD_PAGE_SHIFT); |
3545 | 3608 | ||
diff --git a/drivers/pci/msi.c b/drivers/pci/msi.c index d9f06fbfa0b..d986afb7032 100644 --- a/drivers/pci/msi.c +++ b/drivers/pci/msi.c | |||
@@ -127,17 +127,23 @@ static inline __attribute_const__ u32 msi_enabled_mask(u16 control) | |||
127 | * reliably as devices without an INTx disable bit will then generate a | 127 | * reliably as devices without an INTx disable bit will then generate a |
128 | * level IRQ which will never be cleared. | 128 | * level IRQ which will never be cleared. |
129 | */ | 129 | */ |
130 | static void msi_mask_irq(struct msi_desc *desc, u32 mask, u32 flag) | 130 | static u32 __msi_mask_irq(struct msi_desc *desc, u32 mask, u32 flag) |
131 | { | 131 | { |
132 | u32 mask_bits = desc->masked; | 132 | u32 mask_bits = desc->masked; |
133 | 133 | ||
134 | if (!desc->msi_attrib.maskbit) | 134 | if (!desc->msi_attrib.maskbit) |
135 | return; | 135 | return 0; |
136 | 136 | ||
137 | mask_bits &= ~mask; | 137 | mask_bits &= ~mask; |
138 | mask_bits |= flag; | 138 | mask_bits |= flag; |
139 | pci_write_config_dword(desc->dev, desc->mask_pos, mask_bits); | 139 | pci_write_config_dword(desc->dev, desc->mask_pos, mask_bits); |
140 | desc->masked = mask_bits; | 140 | |
141 | return mask_bits; | ||
142 | } | ||
143 | |||
144 | static void msi_mask_irq(struct msi_desc *desc, u32 mask, u32 flag) | ||
145 | { | ||
146 | desc->masked = __msi_mask_irq(desc, mask, flag); | ||
141 | } | 147 | } |
142 | 148 | ||
143 | /* | 149 | /* |
@@ -147,15 +153,21 @@ static void msi_mask_irq(struct msi_desc *desc, u32 mask, u32 flag) | |||
147 | * file. This saves a few milliseconds when initialising devices with lots | 153 | * file. This saves a few milliseconds when initialising devices with lots |
148 | * of MSI-X interrupts. | 154 | * of MSI-X interrupts. |
149 | */ | 155 | */ |
150 | static void msix_mask_irq(struct msi_desc *desc, u32 flag) | 156 | static u32 __msix_mask_irq(struct msi_desc *desc, u32 flag) |
151 | { | 157 | { |
152 | u32 mask_bits = desc->masked; | 158 | u32 mask_bits = desc->masked; |
153 | unsigned offset = desc->msi_attrib.entry_nr * PCI_MSIX_ENTRY_SIZE + | 159 | unsigned offset = desc->msi_attrib.entry_nr * PCI_MSIX_ENTRY_SIZE + |
154 | PCI_MSIX_ENTRY_VECTOR_CTRL_OFFSET; | 160 | PCI_MSIX_ENTRY_VECTOR_CTRL; |
155 | mask_bits &= ~1; | 161 | mask_bits &= ~1; |
156 | mask_bits |= flag; | 162 | mask_bits |= flag; |
157 | writel(mask_bits, desc->mask_base + offset); | 163 | writel(mask_bits, desc->mask_base + offset); |
158 | desc->masked = mask_bits; | 164 | |
165 | return mask_bits; | ||
166 | } | ||
167 | |||
168 | static void msix_mask_irq(struct msi_desc *desc, u32 flag) | ||
169 | { | ||
170 | desc->masked = __msix_mask_irq(desc, flag); | ||
159 | } | 171 | } |
160 | 172 | ||
161 | static void msi_set_mask_bit(unsigned irq, u32 flag) | 173 | static void msi_set_mask_bit(unsigned irq, u32 flag) |
@@ -188,9 +200,9 @@ void read_msi_msg_desc(struct irq_desc *desc, struct msi_msg *msg) | |||
188 | void __iomem *base = entry->mask_base + | 200 | void __iomem *base = entry->mask_base + |
189 | entry->msi_attrib.entry_nr * PCI_MSIX_ENTRY_SIZE; | 201 | entry->msi_attrib.entry_nr * PCI_MSIX_ENTRY_SIZE; |
190 | 202 | ||
191 | msg->address_lo = readl(base + PCI_MSIX_ENTRY_LOWER_ADDR_OFFSET); | 203 | msg->address_lo = readl(base + PCI_MSIX_ENTRY_LOWER_ADDR); |
192 | msg->address_hi = readl(base + PCI_MSIX_ENTRY_UPPER_ADDR_OFFSET); | 204 | msg->address_hi = readl(base + PCI_MSIX_ENTRY_UPPER_ADDR); |
193 | msg->data = readl(base + PCI_MSIX_ENTRY_DATA_OFFSET); | 205 | msg->data = readl(base + PCI_MSIX_ENTRY_DATA); |
194 | } else { | 206 | } else { |
195 | struct pci_dev *dev = entry->dev; | 207 | struct pci_dev *dev = entry->dev; |
196 | int pos = entry->msi_attrib.pos; | 208 | int pos = entry->msi_attrib.pos; |
@@ -225,11 +237,9 @@ void write_msi_msg_desc(struct irq_desc *desc, struct msi_msg *msg) | |||
225 | base = entry->mask_base + | 237 | base = entry->mask_base + |
226 | entry->msi_attrib.entry_nr * PCI_MSIX_ENTRY_SIZE; | 238 | entry->msi_attrib.entry_nr * PCI_MSIX_ENTRY_SIZE; |
227 | 239 | ||
228 | writel(msg->address_lo, | 240 | writel(msg->address_lo, base + PCI_MSIX_ENTRY_LOWER_ADDR); |
229 | base + PCI_MSIX_ENTRY_LOWER_ADDR_OFFSET); | 241 | writel(msg->address_hi, base + PCI_MSIX_ENTRY_UPPER_ADDR); |
230 | writel(msg->address_hi, | 242 | writel(msg->data, base + PCI_MSIX_ENTRY_DATA); |
231 | base + PCI_MSIX_ENTRY_UPPER_ADDR_OFFSET); | ||
232 | writel(msg->data, base + PCI_MSIX_ENTRY_DATA_OFFSET); | ||
233 | } else { | 243 | } else { |
234 | struct pci_dev *dev = entry->dev; | 244 | struct pci_dev *dev = entry->dev; |
235 | int pos = entry->msi_attrib.pos; | 245 | int pos = entry->msi_attrib.pos; |
@@ -385,6 +395,7 @@ static int msi_capability_init(struct pci_dev *dev, int nvec) | |||
385 | /* Configure MSI capability structure */ | 395 | /* Configure MSI capability structure */ |
386 | ret = arch_setup_msi_irqs(dev, nvec, PCI_CAP_ID_MSI); | 396 | ret = arch_setup_msi_irqs(dev, nvec, PCI_CAP_ID_MSI); |
387 | if (ret) { | 397 | if (ret) { |
398 | msi_mask_irq(entry, mask, ~mask); | ||
388 | msi_free_irqs(dev); | 399 | msi_free_irqs(dev); |
389 | return ret; | 400 | return ret; |
390 | } | 401 | } |
@@ -439,8 +450,14 @@ static int msix_capability_init(struct pci_dev *dev, | |||
439 | 450 | ||
440 | for (i = 0; i < nvec; i++) { | 451 | for (i = 0; i < nvec; i++) { |
441 | entry = alloc_msi_entry(dev); | 452 | entry = alloc_msi_entry(dev); |
442 | if (!entry) | 453 | if (!entry) { |
443 | break; | 454 | if (!i) |
455 | iounmap(base); | ||
456 | else | ||
457 | msi_free_irqs(dev); | ||
458 | /* No enough memory. Don't try again */ | ||
459 | return -ENOMEM; | ||
460 | } | ||
444 | 461 | ||
445 | j = entries[i].entry; | 462 | j = entries[i].entry; |
446 | entry->msi_attrib.is_msix = 1; | 463 | entry->msi_attrib.is_msix = 1; |
@@ -487,7 +504,7 @@ static int msix_capability_init(struct pci_dev *dev, | |||
487 | set_irq_msi(entry->irq, entry); | 504 | set_irq_msi(entry->irq, entry); |
488 | j = entries[i].entry; | 505 | j = entries[i].entry; |
489 | entry->masked = readl(base + j * PCI_MSIX_ENTRY_SIZE + | 506 | entry->masked = readl(base + j * PCI_MSIX_ENTRY_SIZE + |
490 | PCI_MSIX_ENTRY_VECTOR_CTRL_OFFSET); | 507 | PCI_MSIX_ENTRY_VECTOR_CTRL); |
491 | msix_mask_irq(entry, 1); | 508 | msix_mask_irq(entry, 1); |
492 | i++; | 509 | i++; |
493 | } | 510 | } |
@@ -611,9 +628,11 @@ void pci_msi_shutdown(struct pci_dev *dev) | |||
611 | pci_intx_for_msi(dev, 1); | 628 | pci_intx_for_msi(dev, 1); |
612 | dev->msi_enabled = 0; | 629 | dev->msi_enabled = 0; |
613 | 630 | ||
631 | /* Return the device with MSI unmasked as initial states */ | ||
614 | pci_read_config_word(dev, pos + PCI_MSI_FLAGS, &ctrl); | 632 | pci_read_config_word(dev, pos + PCI_MSI_FLAGS, &ctrl); |
615 | mask = msi_capable_mask(ctrl); | 633 | mask = msi_capable_mask(ctrl); |
616 | msi_mask_irq(desc, mask, ~mask); | 634 | /* Keep cached state to be restored */ |
635 | __msi_mask_irq(desc, mask, ~mask); | ||
617 | 636 | ||
618 | /* Restore dev->irq to its default pin-assertion irq */ | 637 | /* Restore dev->irq to its default pin-assertion irq */ |
619 | dev->irq = desc->msi_attrib.default_irq; | 638 | dev->irq = desc->msi_attrib.default_irq; |
@@ -653,7 +672,6 @@ static int msi_free_irqs(struct pci_dev* dev) | |||
653 | 672 | ||
654 | list_for_each_entry_safe(entry, tmp, &dev->msi_list, list) { | 673 | list_for_each_entry_safe(entry, tmp, &dev->msi_list, list) { |
655 | if (entry->msi_attrib.is_msix) { | 674 | if (entry->msi_attrib.is_msix) { |
656 | msix_mask_irq(entry, 1); | ||
657 | if (list_is_last(&entry->list, &dev->msi_list)) | 675 | if (list_is_last(&entry->list, &dev->msi_list)) |
658 | iounmap(entry->mask_base); | 676 | iounmap(entry->mask_base); |
659 | } | 677 | } |
@@ -741,9 +759,17 @@ static void msix_free_all_irqs(struct pci_dev *dev) | |||
741 | 759 | ||
742 | void pci_msix_shutdown(struct pci_dev* dev) | 760 | void pci_msix_shutdown(struct pci_dev* dev) |
743 | { | 761 | { |
762 | struct msi_desc *entry; | ||
763 | |||
744 | if (!pci_msi_enable || !dev || !dev->msix_enabled) | 764 | if (!pci_msi_enable || !dev || !dev->msix_enabled) |
745 | return; | 765 | return; |
746 | 766 | ||
767 | /* Return the device with MSI-X masked as initial states */ | ||
768 | list_for_each_entry(entry, &dev->msi_list, list) { | ||
769 | /* Keep cached states to be restored */ | ||
770 | __msix_mask_irq(entry, 1); | ||
771 | } | ||
772 | |||
747 | msix_set_enable(dev, 0); | 773 | msix_set_enable(dev, 0); |
748 | pci_intx_for_msi(dev, 1); | 774 | pci_intx_for_msi(dev, 1); |
749 | dev->msix_enabled = 0; | 775 | dev->msix_enabled = 0; |
diff --git a/drivers/pci/msi.h b/drivers/pci/msi.h index a0662842550..de27c1cb5a2 100644 --- a/drivers/pci/msi.h +++ b/drivers/pci/msi.h | |||
@@ -6,11 +6,11 @@ | |||
6 | #ifndef MSI_H | 6 | #ifndef MSI_H |
7 | #define MSI_H | 7 | #define MSI_H |
8 | 8 | ||
9 | #define PCI_MSIX_ENTRY_SIZE 16 | 9 | #define PCI_MSIX_ENTRY_SIZE 16 |
10 | #define PCI_MSIX_ENTRY_LOWER_ADDR_OFFSET 0 | 10 | #define PCI_MSIX_ENTRY_LOWER_ADDR 0 |
11 | #define PCI_MSIX_ENTRY_UPPER_ADDR_OFFSET 4 | 11 | #define PCI_MSIX_ENTRY_UPPER_ADDR 4 |
12 | #define PCI_MSIX_ENTRY_DATA_OFFSET 8 | 12 | #define PCI_MSIX_ENTRY_DATA 8 |
13 | #define PCI_MSIX_ENTRY_VECTOR_CTRL_OFFSET 12 | 13 | #define PCI_MSIX_ENTRY_VECTOR_CTRL 12 |
14 | 14 | ||
15 | #define msi_control_reg(base) (base + PCI_MSI_FLAGS) | 15 | #define msi_control_reg(base) (base + PCI_MSI_FLAGS) |
16 | #define msi_lower_address_reg(base) (base + PCI_MSI_ADDRESS_LO) | 16 | #define msi_lower_address_reg(base) (base + PCI_MSI_ADDRESS_LO) |
diff --git a/drivers/pci/pci.c b/drivers/pci/pci.c index 6c93af5ced1..dbd0f947f49 100644 --- a/drivers/pci/pci.c +++ b/drivers/pci/pci.c | |||
@@ -1517,11 +1517,20 @@ void pci_enable_ari(struct pci_dev *dev) | |||
1517 | * | 1517 | * |
1518 | * Perform INTx swizzling for a device behind one level of bridge. This is | 1518 | * Perform INTx swizzling for a device behind one level of bridge. This is |
1519 | * required by section 9.1 of the PCI-to-PCI bridge specification for devices | 1519 | * required by section 9.1 of the PCI-to-PCI bridge specification for devices |
1520 | * behind bridges on add-in cards. | 1520 | * behind bridges on add-in cards. For devices with ARI enabled, the slot |
1521 | * number is always 0 (see the Implementation Note in section 2.2.8.1 of | ||
1522 | * the PCI Express Base Specification, Revision 2.1) | ||
1521 | */ | 1523 | */ |
1522 | u8 pci_swizzle_interrupt_pin(struct pci_dev *dev, u8 pin) | 1524 | u8 pci_swizzle_interrupt_pin(struct pci_dev *dev, u8 pin) |
1523 | { | 1525 | { |
1524 | return (((pin - 1) + PCI_SLOT(dev->devfn)) % 4) + 1; | 1526 | int slot; |
1527 | |||
1528 | if (pci_ari_enabled(dev->bus)) | ||
1529 | slot = 0; | ||
1530 | else | ||
1531 | slot = PCI_SLOT(dev->devfn); | ||
1532 | |||
1533 | return (((pin - 1) + slot) % 4) + 1; | ||
1525 | } | 1534 | } |
1526 | 1535 | ||
1527 | int | 1536 | int |
@@ -2171,7 +2180,7 @@ static int pci_parent_bus_reset(struct pci_dev *dev, int probe) | |||
2171 | u16 ctrl; | 2180 | u16 ctrl; |
2172 | struct pci_dev *pdev; | 2181 | struct pci_dev *pdev; |
2173 | 2182 | ||
2174 | if (dev->subordinate) | 2183 | if (pci_is_root_bus(dev->bus) || dev->subordinate || !dev->bus->self) |
2175 | return -ENOTTY; | 2184 | return -ENOTTY; |
2176 | 2185 | ||
2177 | list_for_each_entry(pdev, &dev->bus->devices, bus_list) | 2186 | list_for_each_entry(pdev, &dev->bus->devices, bus_list) |
diff --git a/drivers/pci/pcie/aer/ecrc.c b/drivers/pci/pcie/aer/ecrc.c index ece97df4df6..a928d8ab6bd 100644 --- a/drivers/pci/pcie/aer/ecrc.c +++ b/drivers/pci/pcie/aer/ecrc.c | |||
@@ -106,7 +106,7 @@ void pcie_set_ecrc_checking(struct pci_dev *dev) | |||
106 | disable_ecrc_checking(dev); | 106 | disable_ecrc_checking(dev); |
107 | break; | 107 | break; |
108 | case ECRC_POLICY_ON: | 108 | case ECRC_POLICY_ON: |
109 | enable_ecrc_checking(dev);; | 109 | enable_ecrc_checking(dev); |
110 | break; | 110 | break; |
111 | default: | 111 | default: |
112 | return; | 112 | return; |
diff --git a/drivers/pci/quirks.c b/drivers/pci/quirks.c index 56552d74abe..06b96562396 100644 --- a/drivers/pci/quirks.c +++ b/drivers/pci/quirks.c | |||
@@ -1058,6 +1058,11 @@ static void __devinit quirk_no_ata_d3(struct pci_dev *pdev) | |||
1058 | } | 1058 | } |
1059 | DECLARE_PCI_FIXUP_EARLY(PCI_VENDOR_ID_SERVERWORKS, PCI_ANY_ID, quirk_no_ata_d3); | 1059 | DECLARE_PCI_FIXUP_EARLY(PCI_VENDOR_ID_SERVERWORKS, PCI_ANY_ID, quirk_no_ata_d3); |
1060 | DECLARE_PCI_FIXUP_EARLY(PCI_VENDOR_ID_ATI, PCI_ANY_ID, quirk_no_ata_d3); | 1060 | DECLARE_PCI_FIXUP_EARLY(PCI_VENDOR_ID_ATI, PCI_ANY_ID, quirk_no_ata_d3); |
1061 | /* ALi loses some register settings that we cannot then restore */ | ||
1062 | DECLARE_PCI_FIXUP_EARLY(PCI_VENDOR_ID_AL, PCI_ANY_ID, quirk_no_ata_d3); | ||
1063 | /* VIA comes back fine but we need to keep it alive or ACPI GTM failures | ||
1064 | occur when mode detecting */ | ||
1065 | DECLARE_PCI_FIXUP_EARLY(PCI_VENDOR_ID_VIA, PCI_ANY_ID, quirk_no_ata_d3); | ||
1061 | 1066 | ||
1062 | /* This was originally an Alpha specific thing, but it really fits here. | 1067 | /* This was originally an Alpha specific thing, but it really fits here. |
1063 | * The i82375 PCI/EISA bridge appears as non-classified. Fix that. | 1068 | * The i82375 PCI/EISA bridge appears as non-classified. Fix that. |
diff --git a/drivers/pci/slot.c b/drivers/pci/slot.c index eddb0748b0e..8c02b6c53bd 100644 --- a/drivers/pci/slot.c +++ b/drivers/pci/slot.c | |||
@@ -311,7 +311,7 @@ EXPORT_SYMBOL_GPL(pci_destroy_slot); | |||
311 | #include <linux/pci_hotplug.h> | 311 | #include <linux/pci_hotplug.h> |
312 | /** | 312 | /** |
313 | * pci_hp_create_link - create symbolic link to the hotplug driver module. | 313 | * pci_hp_create_link - create symbolic link to the hotplug driver module. |
314 | * @slot: struct pci_slot | 314 | * @pci_slot: struct pci_slot |
315 | * | 315 | * |
316 | * Helper function for pci_hotplug_core.c to create symbolic link to | 316 | * Helper function for pci_hotplug_core.c to create symbolic link to |
317 | * the hotplug driver module. | 317 | * the hotplug driver module. |
@@ -334,7 +334,7 @@ EXPORT_SYMBOL_GPL(pci_hp_create_module_link); | |||
334 | 334 | ||
335 | /** | 335 | /** |
336 | * pci_hp_remove_link - remove symbolic link to the hotplug driver module. | 336 | * pci_hp_remove_link - remove symbolic link to the hotplug driver module. |
337 | * @slot: struct pci_slot | 337 | * @pci_slot: struct pci_slot |
338 | * | 338 | * |
339 | * Helper function for pci_hotplug_core.c to remove symbolic link to | 339 | * Helper function for pci_hotplug_core.c to remove symbolic link to |
340 | * the hotplug driver module. | 340 | * the hotplug driver module. |
diff --git a/drivers/pcmcia/tcic.c b/drivers/pcmcia/tcic.c index 9ad97ea836e..8eb04230fec 100644 --- a/drivers/pcmcia/tcic.c +++ b/drivers/pcmcia/tcic.c | |||
@@ -472,7 +472,8 @@ static int __init init_tcic(void) | |||
472 | init_timer(&poll_timer); | 472 | init_timer(&poll_timer); |
473 | 473 | ||
474 | /* Build interrupt mask */ | 474 | /* Build interrupt mask */ |
475 | printk(", %d sockets\n" KERN_INFO " irq list (", sockets); | 475 | printk(KERN_CONT ", %d sockets\n", sockets); |
476 | printk(KERN_INFO " irq list ("); | ||
476 | if (irq_list_count == 0) | 477 | if (irq_list_count == 0) |
477 | mask = irq_mask; | 478 | mask = irq_mask; |
478 | else | 479 | else |
diff --git a/drivers/platform/x86/hp-wmi.c b/drivers/platform/x86/hp-wmi.c index 4ac2311c00a..ca508564a18 100644 --- a/drivers/platform/x86/hp-wmi.c +++ b/drivers/platform/x86/hp-wmi.c | |||
@@ -171,7 +171,7 @@ static int hp_wmi_tablet_state(void) | |||
171 | static int hp_wmi_set_block(void *data, bool blocked) | 171 | static int hp_wmi_set_block(void *data, bool blocked) |
172 | { | 172 | { |
173 | unsigned long b = (unsigned long) data; | 173 | unsigned long b = (unsigned long) data; |
174 | int query = BIT(b + 8) | ((!!blocked) << b); | 174 | int query = BIT(b + 8) | ((!blocked) << b); |
175 | 175 | ||
176 | return hp_wmi_perform_query(HPWMI_WIRELESS_QUERY, 1, query); | 176 | return hp_wmi_perform_query(HPWMI_WIRELESS_QUERY, 1, query); |
177 | } | 177 | } |
diff --git a/drivers/rtc/rtc-ds1374.c b/drivers/rtc/rtc-ds1374.c index 32b27739ec2..713f7bf5afb 100644 --- a/drivers/rtc/rtc-ds1374.c +++ b/drivers/rtc/rtc-ds1374.c | |||
@@ -283,7 +283,7 @@ static void ds1374_work(struct work_struct *work) | |||
283 | 283 | ||
284 | stat = i2c_smbus_read_byte_data(client, DS1374_REG_SR); | 284 | stat = i2c_smbus_read_byte_data(client, DS1374_REG_SR); |
285 | if (stat < 0) | 285 | if (stat < 0) |
286 | return; | 286 | goto unlock; |
287 | 287 | ||
288 | if (stat & DS1374_REG_SR_AF) { | 288 | if (stat & DS1374_REG_SR_AF) { |
289 | stat &= ~DS1374_REG_SR_AF; | 289 | stat &= ~DS1374_REG_SR_AF; |
@@ -302,7 +302,7 @@ static void ds1374_work(struct work_struct *work) | |||
302 | out: | 302 | out: |
303 | if (!ds1374->exiting) | 303 | if (!ds1374->exiting) |
304 | enable_irq(client->irq); | 304 | enable_irq(client->irq); |
305 | 305 | unlock: | |
306 | mutex_unlock(&ds1374->mutex); | 306 | mutex_unlock(&ds1374->mutex); |
307 | } | 307 | } |
308 | 308 | ||
diff --git a/drivers/s390/block/dasd_eckd.c b/drivers/s390/block/dasd_eckd.c index f8b1f04f26b..c11770f5b36 100644 --- a/drivers/s390/block/dasd_eckd.c +++ b/drivers/s390/block/dasd_eckd.c | |||
@@ -1696,8 +1696,7 @@ static void dasd_eckd_handle_unsolicited_interrupt(struct dasd_device *device, | |||
1696 | DBF_DEV_EVENT(DBF_ERR, device, "%s", | 1696 | DBF_DEV_EVENT(DBF_ERR, device, "%s", |
1697 | "unsolicited interrupt received " | 1697 | "unsolicited interrupt received " |
1698 | "(sense available)"); | 1698 | "(sense available)"); |
1699 | device->discipline->dump_sense_dbf(device, NULL, irb, | 1699 | device->discipline->dump_sense_dbf(device, irb, "unsolicited"); |
1700 | "unsolicited"); | ||
1701 | } | 1700 | } |
1702 | 1701 | ||
1703 | dasd_schedule_device_bh(device); | 1702 | dasd_schedule_device_bh(device); |
@@ -2941,42 +2940,20 @@ dasd_eckd_dump_ccw_range(struct ccw1 *from, struct ccw1 *to, char *page) | |||
2941 | } | 2940 | } |
2942 | 2941 | ||
2943 | static void | 2942 | static void |
2944 | dasd_eckd_dump_sense_dbf(struct dasd_device *device, struct dasd_ccw_req *req, | 2943 | dasd_eckd_dump_sense_dbf(struct dasd_device *device, struct irb *irb, |
2945 | struct irb *irb, char *reason) | 2944 | char *reason) |
2946 | { | 2945 | { |
2947 | u64 *sense; | 2946 | u64 *sense; |
2948 | int sl; | ||
2949 | struct tsb *tsb; | ||
2950 | 2947 | ||
2951 | sense = NULL; | 2948 | sense = (u64 *) dasd_get_sense(irb); |
2952 | tsb = NULL; | ||
2953 | if (req && scsw_is_tm(&req->irb.scsw)) { | ||
2954 | if (irb->scsw.tm.tcw) | ||
2955 | tsb = tcw_get_tsb( | ||
2956 | (struct tcw *)(unsigned long)irb->scsw.tm.tcw); | ||
2957 | if (tsb && (irb->scsw.tm.fcxs == 0x01)) { | ||
2958 | switch (tsb->flags & 0x07) { | ||
2959 | case 1: /* tsa_iostat */ | ||
2960 | sense = (u64 *)tsb->tsa.iostat.sense; | ||
2961 | break; | ||
2962 | case 2: /* ts_ddpc */ | ||
2963 | sense = (u64 *)tsb->tsa.ddpc.sense; | ||
2964 | break; | ||
2965 | case 3: /* tsa_intrg */ | ||
2966 | break; | ||
2967 | } | ||
2968 | } | ||
2969 | } else { | ||
2970 | if (irb->esw.esw0.erw.cons) | ||
2971 | sense = (u64 *)irb->ecw; | ||
2972 | } | ||
2973 | if (sense) { | 2949 | if (sense) { |
2974 | for (sl = 0; sl < 4; sl++) { | 2950 | DBF_DEV_EVENT(DBF_EMERG, device, |
2975 | DBF_DEV_EVENT(DBF_EMERG, device, | 2951 | "%s: %s %02x%02x%02x %016llx %016llx %016llx " |
2976 | "%s: %016llx %016llx %016llx %016llx", | 2952 | "%016llx", reason, |
2977 | reason, sense[0], sense[1], sense[2], | 2953 | scsw_is_tm(&irb->scsw) ? "t" : "c", |
2978 | sense[3]); | 2954 | scsw_cc(&irb->scsw), scsw_cstat(&irb->scsw), |
2979 | } | 2955 | scsw_dstat(&irb->scsw), sense[0], sense[1], |
2956 | sense[2], sense[3]); | ||
2980 | } else { | 2957 | } else { |
2981 | DBF_DEV_EVENT(DBF_EMERG, device, "%s", | 2958 | DBF_DEV_EVENT(DBF_EMERG, device, "%s", |
2982 | "SORRY - NO VALID SENSE AVAILABLE\n"); | 2959 | "SORRY - NO VALID SENSE AVAILABLE\n"); |
diff --git a/drivers/s390/block/dasd_erp.c b/drivers/s390/block/dasd_erp.c index d970ce2814b..cb8f9cef742 100644 --- a/drivers/s390/block/dasd_erp.c +++ b/drivers/s390/block/dasd_erp.c | |||
@@ -172,7 +172,7 @@ dasd_log_sense_dbf(struct dasd_ccw_req *cqr, struct irb *irb) | |||
172 | device = cqr->startdev; | 172 | device = cqr->startdev; |
173 | /* dump sense data to s390 debugfeature*/ | 173 | /* dump sense data to s390 debugfeature*/ |
174 | if (device->discipline && device->discipline->dump_sense_dbf) | 174 | if (device->discipline && device->discipline->dump_sense_dbf) |
175 | device->discipline->dump_sense_dbf(device, cqr, irb, "log"); | 175 | device->discipline->dump_sense_dbf(device, irb, "log"); |
176 | } | 176 | } |
177 | EXPORT_SYMBOL(dasd_log_sense_dbf); | 177 | EXPORT_SYMBOL(dasd_log_sense_dbf); |
178 | 178 | ||
diff --git a/drivers/s390/block/dasd_fba.c b/drivers/s390/block/dasd_fba.c index e21ee735f92..31849ad5e59 100644 --- a/drivers/s390/block/dasd_fba.c +++ b/drivers/s390/block/dasd_fba.c | |||
@@ -241,7 +241,7 @@ static void dasd_fba_handle_unsolicited_interrupt(struct dasd_device *device, | |||
241 | /* check for unsolicited interrupts */ | 241 | /* check for unsolicited interrupts */ |
242 | DBF_DEV_EVENT(DBF_WARNING, device, "%s", | 242 | DBF_DEV_EVENT(DBF_WARNING, device, "%s", |
243 | "unsolicited interrupt received"); | 243 | "unsolicited interrupt received"); |
244 | device->discipline->dump_sense_dbf(device, NULL, irb, "unsolicited"); | 244 | device->discipline->dump_sense_dbf(device, irb, "unsolicited"); |
245 | dasd_schedule_device_bh(device); | 245 | dasd_schedule_device_bh(device); |
246 | return; | 246 | return; |
247 | }; | 247 | }; |
@@ -444,17 +444,20 @@ dasd_fba_fill_info(struct dasd_device * device, | |||
444 | } | 444 | } |
445 | 445 | ||
446 | static void | 446 | static void |
447 | dasd_fba_dump_sense_dbf(struct dasd_device *device, struct dasd_ccw_req *req, | 447 | dasd_fba_dump_sense_dbf(struct dasd_device *device, struct irb *irb, |
448 | struct irb *irb, char *reason) | 448 | char *reason) |
449 | { | 449 | { |
450 | int sl; | 450 | u64 *sense; |
451 | if (irb->esw.esw0.erw.cons) { | 451 | |
452 | for (sl = 0; sl < 4; sl++) { | 452 | sense = (u64 *) dasd_get_sense(irb); |
453 | DBF_DEV_EVENT(DBF_EMERG, device, | 453 | if (sense) { |
454 | "%s: %08x %08x %08x %08x", | 454 | DBF_DEV_EVENT(DBF_EMERG, device, |
455 | reason, irb->ecw[8 * 0], irb->ecw[8 * 1], | 455 | "%s: %s %02x%02x%02x %016llx %016llx %016llx " |
456 | irb->ecw[8 * 2], irb->ecw[8 * 3]); | 456 | "%016llx", reason, |
457 | } | 457 | scsw_is_tm(&irb->scsw) ? "t" : "c", |
458 | scsw_cc(&irb->scsw), scsw_cstat(&irb->scsw), | ||
459 | scsw_dstat(&irb->scsw), sense[0], sense[1], | ||
460 | sense[2], sense[3]); | ||
458 | } else { | 461 | } else { |
459 | DBF_DEV_EVENT(DBF_EMERG, device, "%s", | 462 | DBF_DEV_EVENT(DBF_EMERG, device, "%s", |
460 | "SORRY - NO VALID SENSE AVAILABLE\n"); | 463 | "SORRY - NO VALID SENSE AVAILABLE\n"); |
diff --git a/drivers/s390/block/dasd_int.h b/drivers/s390/block/dasd_int.h index fd63b2f2bda..b699ca356ac 100644 --- a/drivers/s390/block/dasd_int.h +++ b/drivers/s390/block/dasd_int.h | |||
@@ -284,8 +284,7 @@ struct dasd_discipline { | |||
284 | dasd_erp_fn_t(*erp_postaction) (struct dasd_ccw_req *); | 284 | dasd_erp_fn_t(*erp_postaction) (struct dasd_ccw_req *); |
285 | void (*dump_sense) (struct dasd_device *, struct dasd_ccw_req *, | 285 | void (*dump_sense) (struct dasd_device *, struct dasd_ccw_req *, |
286 | struct irb *); | 286 | struct irb *); |
287 | void (*dump_sense_dbf) (struct dasd_device *, struct dasd_ccw_req *, | 287 | void (*dump_sense_dbf) (struct dasd_device *, struct irb *, char *); |
288 | struct irb *, char *); | ||
289 | 288 | ||
290 | void (*handle_unsolicited_interrupt) (struct dasd_device *, | 289 | void (*handle_unsolicited_interrupt) (struct dasd_device *, |
291 | struct irb *); | 290 | struct irb *); |
diff --git a/drivers/s390/block/dcssblk.c b/drivers/s390/block/dcssblk.c index 016f9e9d259..d34617682a6 100644 --- a/drivers/s390/block/dcssblk.c +++ b/drivers/s390/block/dcssblk.c | |||
@@ -964,7 +964,8 @@ static int dcssblk_freeze(struct device *dev) | |||
964 | break; | 964 | break; |
965 | } | 965 | } |
966 | if (rc) | 966 | if (rc) |
967 | pr_err("Suspend failed because device %s is writeable.\n", | 967 | pr_err("Suspending the system failed because DCSS device %s " |
968 | "is writable\n", | ||
968 | dev_info->segment_name); | 969 | dev_info->segment_name); |
969 | return rc; | 970 | return rc; |
970 | } | 971 | } |
@@ -987,8 +988,8 @@ static int dcssblk_restore(struct device *dev) | |||
987 | goto out_panic; | 988 | goto out_panic; |
988 | } | 989 | } |
989 | if (start != entry->start || end != entry->end) { | 990 | if (start != entry->start || end != entry->end) { |
990 | pr_err("Mismatch of start / end address after " | 991 | pr_err("The address range of DCSS %s changed " |
991 | "resuming device %s\n", | 992 | "while the system was suspended\n", |
992 | entry->segment_name); | 993 | entry->segment_name); |
993 | goto out_panic; | 994 | goto out_panic; |
994 | } | 995 | } |
diff --git a/drivers/s390/block/xpram.c b/drivers/s390/block/xpram.c index 2e9e1ecd6d8..db442cd6621 100644 --- a/drivers/s390/block/xpram.c +++ b/drivers/s390/block/xpram.c | |||
@@ -443,7 +443,7 @@ fail: | |||
443 | */ | 443 | */ |
444 | static void xpram_resume_error(const char *message) | 444 | static void xpram_resume_error(const char *message) |
445 | { | 445 | { |
446 | pr_err("Resume error: %s\n", message); | 446 | pr_err("Resuming the system failed: %s\n", message); |
447 | panic("xpram resume error\n"); | 447 | panic("xpram resume error\n"); |
448 | } | 448 | } |
449 | 449 | ||
diff --git a/drivers/s390/char/monreader.c b/drivers/s390/char/monreader.c index 7892550d793..3234e90bd7f 100644 --- a/drivers/s390/char/monreader.c +++ b/drivers/s390/char/monreader.c | |||
@@ -320,7 +320,7 @@ static int mon_open(struct inode *inode, struct file *filp) | |||
320 | goto out_path; | 320 | goto out_path; |
321 | } | 321 | } |
322 | filp->private_data = monpriv; | 322 | filp->private_data = monpriv; |
323 | dev_set_drvdata(&monreader_device, monpriv); | 323 | dev_set_drvdata(monreader_device, monpriv); |
324 | unlock_kernel(); | 324 | unlock_kernel(); |
325 | return nonseekable_open(inode, filp); | 325 | return nonseekable_open(inode, filp); |
326 | 326 | ||
@@ -463,7 +463,7 @@ static struct miscdevice mon_dev = { | |||
463 | *****************************************************************************/ | 463 | *****************************************************************************/ |
464 | static int monreader_freeze(struct device *dev) | 464 | static int monreader_freeze(struct device *dev) |
465 | { | 465 | { |
466 | struct mon_private *monpriv = dev_get_drvdata(&dev); | 466 | struct mon_private *monpriv = dev_get_drvdata(dev); |
467 | int rc; | 467 | int rc; |
468 | 468 | ||
469 | if (!monpriv) | 469 | if (!monpriv) |
diff --git a/drivers/s390/char/sclp_rw.h b/drivers/s390/char/sclp_rw.h index 85f491ea929..7a7bfc947d9 100644 --- a/drivers/s390/char/sclp_rw.h +++ b/drivers/s390/char/sclp_rw.h | |||
@@ -92,5 +92,10 @@ void sclp_set_columns(struct sclp_buffer *, unsigned short); | |||
92 | void sclp_set_htab(struct sclp_buffer *, unsigned short); | 92 | void sclp_set_htab(struct sclp_buffer *, unsigned short); |
93 | int sclp_chars_in_buffer(struct sclp_buffer *); | 93 | int sclp_chars_in_buffer(struct sclp_buffer *); |
94 | 94 | ||
95 | #ifdef CONFIG_SCLP_CONSOLE | ||
95 | void sclp_console_pm_event(enum sclp_pm_event sclp_pm_event); | 96 | void sclp_console_pm_event(enum sclp_pm_event sclp_pm_event); |
97 | #else | ||
98 | static inline void sclp_console_pm_event(enum sclp_pm_event sclp_pm_event) { } | ||
99 | #endif | ||
100 | |||
96 | #endif /* __SCLP_RW_H__ */ | 101 | #endif /* __SCLP_RW_H__ */ |
diff --git a/drivers/s390/char/vmwatchdog.c b/drivers/s390/char/vmwatchdog.c index cb7854c10c0..f2bc287b69e 100644 --- a/drivers/s390/char/vmwatchdog.c +++ b/drivers/s390/char/vmwatchdog.c | |||
@@ -250,14 +250,14 @@ static int vmwdt_resume(void) | |||
250 | static int vmwdt_suspend(void) | 250 | static int vmwdt_suspend(void) |
251 | { | 251 | { |
252 | if (test_and_set_bit(VMWDT_OPEN, &vmwdt_is_open)) { | 252 | if (test_and_set_bit(VMWDT_OPEN, &vmwdt_is_open)) { |
253 | pr_err("The watchdog is in use. " | 253 | pr_err("The system cannot be suspended while the watchdog" |
254 | "This prevents hibernation or suspend.\n"); | 254 | " is in use\n"); |
255 | return NOTIFY_BAD; | 255 | return NOTIFY_BAD; |
256 | } | 256 | } |
257 | if (test_bit(VMWDT_RUNNING, &vmwdt_is_open)) { | 257 | if (test_bit(VMWDT_RUNNING, &vmwdt_is_open)) { |
258 | clear_bit(VMWDT_OPEN, &vmwdt_is_open); | 258 | clear_bit(VMWDT_OPEN, &vmwdt_is_open); |
259 | pr_err("The watchdog is running. " | 259 | pr_err("The system cannot be suspended while the watchdog" |
260 | "This prevents hibernation or suspend.\n"); | 260 | " is running\n"); |
261 | return NOTIFY_BAD; | 261 | return NOTIFY_BAD; |
262 | } | 262 | } |
263 | return NOTIFY_DONE; | 263 | return NOTIFY_DONE; |
diff --git a/drivers/scsi/atari_NCR5380.c b/drivers/scsi/atari_NCR5380.c index 0471f880048..4240b05aef6 100644 --- a/drivers/scsi/atari_NCR5380.c +++ b/drivers/scsi/atari_NCR5380.c | |||
@@ -2826,8 +2826,7 @@ int NCR5380_abort(Scsi_Cmnd *cmd) | |||
2826 | */ | 2826 | */ |
2827 | 2827 | ||
2828 | local_irq_restore(flags); | 2828 | local_irq_restore(flags); |
2829 | printk(KERN_INFO "scsi%d: warning : SCSI command probably completed successfully\n" | 2829 | printk(KERN_INFO "scsi%d: warning : SCSI command probably completed successfully before abortion\n", HOSTNO); |
2830 | KERN_INFO " before abortion\n", HOSTNO); | ||
2831 | 2830 | ||
2832 | /* Maybe it is sufficient just to release the ST-DMA lock... (if | 2831 | /* Maybe it is sufficient just to release the ST-DMA lock... (if |
2833 | * possible at all) At least, we should check if the lock could be | 2832 | * possible at all) At least, we should check if the lock could be |
diff --git a/drivers/scsi/mac53c94.c b/drivers/scsi/mac53c94.c index b12ad7c7c67..18735b39b3d 100644 --- a/drivers/scsi/mac53c94.c +++ b/drivers/scsi/mac53c94.c | |||
@@ -75,8 +75,9 @@ static int mac53c94_queue(struct scsi_cmnd *cmd, void (*done)(struct scsi_cmnd * | |||
75 | int i; | 75 | int i; |
76 | printk(KERN_DEBUG "mac53c94_queue %p: command is", cmd); | 76 | printk(KERN_DEBUG "mac53c94_queue %p: command is", cmd); |
77 | for (i = 0; i < cmd->cmd_len; ++i) | 77 | for (i = 0; i < cmd->cmd_len; ++i) |
78 | printk(" %.2x", cmd->cmnd[i]); | 78 | printk(KERN_CONT " %.2x", cmd->cmnd[i]); |
79 | printk("\n" KERN_DEBUG "use_sg=%d request_bufflen=%d request_buffer=%p\n", | 79 | printk(KERN_CONT "\n"); |
80 | printk(KERN_DEBUG "use_sg=%d request_bufflen=%d request_buffer=%p\n", | ||
80 | scsi_sg_count(cmd), scsi_bufflen(cmd), scsi_sglist(cmd)); | 81 | scsi_sg_count(cmd), scsi_bufflen(cmd), scsi_sglist(cmd)); |
81 | } | 82 | } |
82 | #endif | 83 | #endif |
diff --git a/drivers/scsi/sg.c b/drivers/scsi/sg.c index ef142fd47a8..9230402c45a 100644 --- a/drivers/scsi/sg.c +++ b/drivers/scsi/sg.c | |||
@@ -619,7 +619,7 @@ sg_write(struct file *filp, const char __user *buf, size_t count, loff_t * ppos) | |||
619 | if (strcmp(current->comm, cmd) && printk_ratelimit()) { | 619 | if (strcmp(current->comm, cmd) && printk_ratelimit()) { |
620 | printk(KERN_WARNING | 620 | printk(KERN_WARNING |
621 | "sg_write: data in/out %d/%d bytes for SCSI command 0x%x--" | 621 | "sg_write: data in/out %d/%d bytes for SCSI command 0x%x--" |
622 | "guessing data in;\n" KERN_WARNING " " | 622 | "guessing data in;\n " |
623 | "program %s not setting count and/or reply_len properly\n", | 623 | "program %s not setting count and/or reply_len properly\n", |
624 | old_hdr.reply_len - (int)SZ_SG_HEADER, | 624 | old_hdr.reply_len - (int)SZ_SG_HEADER, |
625 | input_size, (unsigned int) cmnd[0], | 625 | input_size, (unsigned int) cmnd[0], |
@@ -1656,6 +1656,10 @@ static int sg_start_req(Sg_request *srp, unsigned char *cmd) | |||
1656 | md->nr_entries = req_schp->k_use_sg; | 1656 | md->nr_entries = req_schp->k_use_sg; |
1657 | md->offset = 0; | 1657 | md->offset = 0; |
1658 | md->null_mapped = hp->dxferp ? 0 : 1; | 1658 | md->null_mapped = hp->dxferp ? 0 : 1; |
1659 | if (dxfer_dir == SG_DXFER_TO_FROM_DEV) | ||
1660 | md->from_user = 1; | ||
1661 | else | ||
1662 | md->from_user = 0; | ||
1659 | } | 1663 | } |
1660 | 1664 | ||
1661 | if (iov_count) { | 1665 | if (iov_count) { |
diff --git a/drivers/scsi/sun3_NCR5380.c b/drivers/scsi/sun3_NCR5380.c index bcaba86060a..75da6e58ce5 100644 --- a/drivers/scsi/sun3_NCR5380.c +++ b/drivers/scsi/sun3_NCR5380.c | |||
@@ -2860,8 +2860,7 @@ static int NCR5380_abort(struct scsi_cmnd *cmd) | |||
2860 | */ | 2860 | */ |
2861 | 2861 | ||
2862 | local_irq_restore(flags); | 2862 | local_irq_restore(flags); |
2863 | printk(KERN_INFO "scsi%d: warning : SCSI command probably completed successfully\n" | 2863 | printk(KERN_INFO "scsi%d: warning : SCSI command probably completed successfully before abortion\n", HOSTNO); |
2864 | KERN_INFO " before abortion\n", HOSTNO); | ||
2865 | 2864 | ||
2866 | return SCSI_ABORT_NOT_RUNNING; | 2865 | return SCSI_ABORT_NOT_RUNNING; |
2867 | } | 2866 | } |
diff --git a/drivers/serial/8250_pci.c b/drivers/serial/8250_pci.c index 6160e03f410..e7108e75653 100644 --- a/drivers/serial/8250_pci.c +++ b/drivers/serial/8250_pci.c | |||
@@ -60,11 +60,12 @@ struct serial_private { | |||
60 | 60 | ||
61 | static void moan_device(const char *str, struct pci_dev *dev) | 61 | static void moan_device(const char *str, struct pci_dev *dev) |
62 | { | 62 | { |
63 | printk(KERN_WARNING "%s: %s\n" | 63 | printk(KERN_WARNING |
64 | KERN_WARNING "Please send the output of lspci -vv, this\n" | 64 | "%s: %s\n" |
65 | KERN_WARNING "message (0x%04x,0x%04x,0x%04x,0x%04x), the\n" | 65 | "Please send the output of lspci -vv, this\n" |
66 | KERN_WARNING "manufacturer and name of serial board or\n" | 66 | "message (0x%04x,0x%04x,0x%04x,0x%04x), the\n" |
67 | KERN_WARNING "modem board to rmk+serial@arm.linux.org.uk.\n", | 67 | "manufacturer and name of serial board or\n" |
68 | "modem board to rmk+serial@arm.linux.org.uk.\n", | ||
68 | pci_name(dev), str, dev->vendor, dev->device, | 69 | pci_name(dev), str, dev->vendor, dev->device, |
69 | dev->subsystem_vendor, dev->subsystem_device); | 70 | dev->subsystem_vendor, dev->subsystem_device); |
70 | } | 71 | } |
diff --git a/drivers/serial/sh-sci.c b/drivers/serial/sh-sci.c index 66f52674ca0..8e2feb56334 100644 --- a/drivers/serial/sh-sci.c +++ b/drivers/serial/sh-sci.c | |||
@@ -707,24 +707,25 @@ static irqreturn_t sci_br_interrupt(int irq, void *ptr) | |||
707 | 707 | ||
708 | static irqreturn_t sci_mpxed_interrupt(int irq, void *ptr) | 708 | static irqreturn_t sci_mpxed_interrupt(int irq, void *ptr) |
709 | { | 709 | { |
710 | unsigned short ssr_status, scr_status; | 710 | unsigned short ssr_status, scr_status, err_enabled; |
711 | struct uart_port *port = ptr; | 711 | struct uart_port *port = ptr; |
712 | irqreturn_t ret = IRQ_NONE; | 712 | irqreturn_t ret = IRQ_NONE; |
713 | 713 | ||
714 | ssr_status = sci_in(port, SCxSR); | 714 | ssr_status = sci_in(port, SCxSR); |
715 | scr_status = sci_in(port, SCSCR); | 715 | scr_status = sci_in(port, SCSCR); |
716 | err_enabled = scr_status & (SCI_CTRL_FLAGS_REIE | SCI_CTRL_FLAGS_RIE); | ||
716 | 717 | ||
717 | /* Tx Interrupt */ | 718 | /* Tx Interrupt */ |
718 | if ((ssr_status & 0x0020) && (scr_status & SCI_CTRL_FLAGS_TIE)) | 719 | if ((ssr_status & SCxSR_TDxE(port)) && (scr_status & SCI_CTRL_FLAGS_TIE)) |
719 | ret = sci_tx_interrupt(irq, ptr); | 720 | ret = sci_tx_interrupt(irq, ptr); |
720 | /* Rx Interrupt */ | 721 | /* Rx Interrupt */ |
721 | if ((ssr_status & 0x0002) && (scr_status & SCI_CTRL_FLAGS_RIE)) | 722 | if ((ssr_status & SCxSR_RDxF(port)) && (scr_status & SCI_CTRL_FLAGS_RIE)) |
722 | ret = sci_rx_interrupt(irq, ptr); | 723 | ret = sci_rx_interrupt(irq, ptr); |
723 | /* Error Interrupt */ | 724 | /* Error Interrupt */ |
724 | if ((ssr_status & 0x0080) && (scr_status & SCI_CTRL_FLAGS_REIE)) | 725 | if ((ssr_status & SCxSR_ERRORS(port)) && err_enabled) |
725 | ret = sci_er_interrupt(irq, ptr); | 726 | ret = sci_er_interrupt(irq, ptr); |
726 | /* Break Interrupt */ | 727 | /* Break Interrupt */ |
727 | if ((ssr_status & 0x0010) && (scr_status & SCI_CTRL_FLAGS_REIE)) | 728 | if ((ssr_status & SCxSR_BRK(port)) && err_enabled) |
728 | ret = sci_br_interrupt(irq, ptr); | 729 | ret = sci_br_interrupt(irq, ptr); |
729 | 730 | ||
730 | return ret; | 731 | return ret; |
diff --git a/drivers/ssb/pcmcia.c b/drivers/ssb/pcmcia.c index fbfadbac67e..100e7a5c5ea 100644 --- a/drivers/ssb/pcmcia.c +++ b/drivers/ssb/pcmcia.c | |||
@@ -583,7 +583,7 @@ static int ssb_pcmcia_sprom_write_all(struct ssb_bus *bus, const u16 *sprom) | |||
583 | ssb_printk("."); | 583 | ssb_printk("."); |
584 | err = ssb_pcmcia_sprom_write(bus, i, sprom[i]); | 584 | err = ssb_pcmcia_sprom_write(bus, i, sprom[i]); |
585 | if (err) { | 585 | if (err) { |
586 | ssb_printk("\n" KERN_NOTICE PFX | 586 | ssb_printk(KERN_NOTICE PFX |
587 | "Failed to write to SPROM.\n"); | 587 | "Failed to write to SPROM.\n"); |
588 | failed = 1; | 588 | failed = 1; |
589 | break; | 589 | break; |
@@ -591,7 +591,7 @@ static int ssb_pcmcia_sprom_write_all(struct ssb_bus *bus, const u16 *sprom) | |||
591 | } | 591 | } |
592 | err = ssb_pcmcia_sprom_command(bus, SSB_PCMCIA_SPROMCTL_WRITEDIS); | 592 | err = ssb_pcmcia_sprom_command(bus, SSB_PCMCIA_SPROMCTL_WRITEDIS); |
593 | if (err) { | 593 | if (err) { |
594 | ssb_printk("\n" KERN_NOTICE PFX | 594 | ssb_printk(KERN_NOTICE PFX |
595 | "Could not disable SPROM write access.\n"); | 595 | "Could not disable SPROM write access.\n"); |
596 | failed = 1; | 596 | failed = 1; |
597 | } | 597 | } |
@@ -678,7 +678,8 @@ int ssb_pcmcia_get_invariants(struct ssb_bus *bus, | |||
678 | sprom->board_rev = tuple.TupleData[1]; | 678 | sprom->board_rev = tuple.TupleData[1]; |
679 | break; | 679 | break; |
680 | case SSB_PCMCIA_CIS_PA: | 680 | case SSB_PCMCIA_CIS_PA: |
681 | GOTO_ERROR_ON(tuple.TupleDataLen != 9, | 681 | GOTO_ERROR_ON((tuple.TupleDataLen != 9) && |
682 | (tuple.TupleDataLen != 10), | ||
682 | "pa tpl size"); | 683 | "pa tpl size"); |
683 | sprom->pa0b0 = tuple.TupleData[1] | | 684 | sprom->pa0b0 = tuple.TupleData[1] | |
684 | ((u16)tuple.TupleData[2] << 8); | 685 | ((u16)tuple.TupleData[2] << 8); |
@@ -718,7 +719,8 @@ int ssb_pcmcia_get_invariants(struct ssb_bus *bus, | |||
718 | sprom->antenna_gain.ghz5.a3 = tuple.TupleData[1]; | 719 | sprom->antenna_gain.ghz5.a3 = tuple.TupleData[1]; |
719 | break; | 720 | break; |
720 | case SSB_PCMCIA_CIS_BFLAGS: | 721 | case SSB_PCMCIA_CIS_BFLAGS: |
721 | GOTO_ERROR_ON(tuple.TupleDataLen != 3, | 722 | GOTO_ERROR_ON((tuple.TupleDataLen != 3) && |
723 | (tuple.TupleDataLen != 5), | ||
722 | "bfl tpl size"); | 724 | "bfl tpl size"); |
723 | sprom->boardflags_lo = tuple.TupleData[1] | | 725 | sprom->boardflags_lo = tuple.TupleData[1] | |
724 | ((u16)tuple.TupleData[2] << 8); | 726 | ((u16)tuple.TupleData[2] << 8); |
diff --git a/drivers/usb/core/hcd.c b/drivers/usb/core/hcd.c index ce3f453f02e..95ccfa0b9fc 100644 --- a/drivers/usb/core/hcd.c +++ b/drivers/usb/core/hcd.c | |||
@@ -648,7 +648,7 @@ void usb_hcd_poll_rh_status(struct usb_hcd *hcd) | |||
648 | struct urb *urb; | 648 | struct urb *urb; |
649 | int length; | 649 | int length; |
650 | unsigned long flags; | 650 | unsigned long flags; |
651 | char buffer[4]; /* Any root hubs with > 31 ports? */ | 651 | char buffer[6]; /* Any root hubs with > 31 ports? */ |
652 | 652 | ||
653 | if (unlikely(!hcd->rh_registered)) | 653 | if (unlikely(!hcd->rh_registered)) |
654 | return; | 654 | return; |
diff --git a/drivers/usb/host/Kconfig b/drivers/usb/host/Kconfig index 1576a0520ad..0c03471f0d4 100644 --- a/drivers/usb/host/Kconfig +++ b/drivers/usb/host/Kconfig | |||
@@ -337,10 +337,10 @@ config USB_R8A66597_HCD | |||
337 | 337 | ||
338 | config SUPERH_ON_CHIP_R8A66597 | 338 | config SUPERH_ON_CHIP_R8A66597 |
339 | boolean "Enable SuperH on-chip R8A66597 USB" | 339 | boolean "Enable SuperH on-chip R8A66597 USB" |
340 | depends on USB_R8A66597_HCD && (CPU_SUBTYPE_SH7366 || CPU_SUBTYPE_SH7723) | 340 | depends on USB_R8A66597_HCD && (CPU_SUBTYPE_SH7366 || CPU_SUBTYPE_SH7723 || CPU_SUBTYPE_SH7724) |
341 | help | 341 | help |
342 | This driver enables support for the on-chip R8A66597 in the | 342 | This driver enables support for the on-chip R8A66597 in the |
343 | SH7366 and SH7723 processors. | 343 | SH7366, SH7723 and SH7724 processors. |
344 | 344 | ||
345 | config USB_WHCI_HCD | 345 | config USB_WHCI_HCD |
346 | tristate "Wireless USB Host Controller Interface (WHCI) driver (EXPERIMENTAL)" | 346 | tristate "Wireless USB Host Controller Interface (WHCI) driver (EXPERIMENTAL)" |
diff --git a/drivers/usb/mon/mon_bin.c b/drivers/usb/mon/mon_bin.c index f8d9045d668..0f7a30b7d2d 100644 --- a/drivers/usb/mon/mon_bin.c +++ b/drivers/usb/mon/mon_bin.c | |||
@@ -1261,7 +1261,7 @@ static int mon_alloc_buff(struct mon_pgmap *map, int npages) | |||
1261 | return -ENOMEM; | 1261 | return -ENOMEM; |
1262 | } | 1262 | } |
1263 | map[n].ptr = (unsigned char *) vaddr; | 1263 | map[n].ptr = (unsigned char *) vaddr; |
1264 | map[n].pg = virt_to_page(vaddr); | 1264 | map[n].pg = virt_to_page((void *) vaddr); |
1265 | } | 1265 | } |
1266 | return 0; | 1266 | return 0; |
1267 | } | 1267 | } |
diff --git a/drivers/video/amba-clcd.c b/drivers/video/amba-clcd.c index fb8163d181a..a21efcd10b7 100644 --- a/drivers/video/amba-clcd.c +++ b/drivers/video/amba-clcd.c | |||
@@ -226,9 +226,10 @@ static int clcdfb_set_par(struct fb_info *info) | |||
226 | clcdfb_enable(fb, regs.cntl); | 226 | clcdfb_enable(fb, regs.cntl); |
227 | 227 | ||
228 | #ifdef DEBUG | 228 | #ifdef DEBUG |
229 | printk(KERN_INFO "CLCD: Registers set to\n" | 229 | printk(KERN_INFO |
230 | KERN_INFO " %08x %08x %08x %08x\n" | 230 | "CLCD: Registers set to\n" |
231 | KERN_INFO " %08x %08x %08x %08x\n", | 231 | " %08x %08x %08x %08x\n" |
232 | " %08x %08x %08x %08x\n", | ||
232 | readl(fb->regs + CLCD_TIM0), readl(fb->regs + CLCD_TIM1), | 233 | readl(fb->regs + CLCD_TIM0), readl(fb->regs + CLCD_TIM1), |
233 | readl(fb->regs + CLCD_TIM2), readl(fb->regs + CLCD_TIM3), | 234 | readl(fb->regs + CLCD_TIM2), readl(fb->regs + CLCD_TIM3), |
234 | readl(fb->regs + CLCD_UBAS), readl(fb->regs + CLCD_LBAS), | 235 | readl(fb->regs + CLCD_UBAS), readl(fb->regs + CLCD_LBAS), |
diff --git a/drivers/video/atafb.c b/drivers/video/atafb.c index 497ff8af03e..8cd279be74e 100644 --- a/drivers/video/atafb.c +++ b/drivers/video/atafb.c | |||
@@ -2405,6 +2405,9 @@ static int do_fb_set_var(struct fb_var_screeninfo *var, int isactive) | |||
2405 | return 0; | 2405 | return 0; |
2406 | } | 2406 | } |
2407 | 2407 | ||
2408 | /* fbhw->encode_fix() must be called with fb_info->mm_lock held | ||
2409 | * if it is called after the register_framebuffer() - not a case here | ||
2410 | */ | ||
2408 | static int atafb_get_fix(struct fb_fix_screeninfo *fix, struct fb_info *info) | 2411 | static int atafb_get_fix(struct fb_fix_screeninfo *fix, struct fb_info *info) |
2409 | { | 2412 | { |
2410 | struct atafb_par par; | 2413 | struct atafb_par par; |
@@ -2414,9 +2417,7 @@ static int atafb_get_fix(struct fb_fix_screeninfo *fix, struct fb_info *info) | |||
2414 | if (err) | 2417 | if (err) |
2415 | return err; | 2418 | return err; |
2416 | memset(fix, 0, sizeof(struct fb_fix_screeninfo)); | 2419 | memset(fix, 0, sizeof(struct fb_fix_screeninfo)); |
2417 | mutex_lock(&info->mm_lock); | ||
2418 | err = fbhw->encode_fix(fix, &par); | 2420 | err = fbhw->encode_fix(fix, &par); |
2419 | mutex_unlock(&info->mm_lock); | ||
2420 | return err; | 2421 | return err; |
2421 | } | 2422 | } |
2422 | 2423 | ||
diff --git a/drivers/video/atmel_lcdfb.c b/drivers/video/atmel_lcdfb.c index cb88394ba99..da05f0801bb 100644 --- a/drivers/video/atmel_lcdfb.c +++ b/drivers/video/atmel_lcdfb.c | |||
@@ -261,6 +261,9 @@ static inline void atmel_lcdfb_free_video_memory(struct atmel_lcdfb_info *sinfo) | |||
261 | /** | 261 | /** |
262 | * atmel_lcdfb_alloc_video_memory - Allocate framebuffer memory | 262 | * atmel_lcdfb_alloc_video_memory - Allocate framebuffer memory |
263 | * @sinfo: the frame buffer to allocate memory for | 263 | * @sinfo: the frame buffer to allocate memory for |
264 | * | ||
265 | * This function is called only from the atmel_lcdfb_probe() | ||
266 | * so no locking by fb_info->mm_lock around smem_len setting is needed. | ||
264 | */ | 267 | */ |
265 | static int atmel_lcdfb_alloc_video_memory(struct atmel_lcdfb_info *sinfo) | 268 | static int atmel_lcdfb_alloc_video_memory(struct atmel_lcdfb_info *sinfo) |
266 | { | 269 | { |
@@ -270,9 +273,7 @@ static int atmel_lcdfb_alloc_video_memory(struct atmel_lcdfb_info *sinfo) | |||
270 | 273 | ||
271 | smem_len = (var->xres_virtual * var->yres_virtual | 274 | smem_len = (var->xres_virtual * var->yres_virtual |
272 | * ((var->bits_per_pixel + 7) / 8)); | 275 | * ((var->bits_per_pixel + 7) / 8)); |
273 | mutex_lock(&info->mm_lock); | ||
274 | info->fix.smem_len = max(smem_len, sinfo->smem_len); | 276 | info->fix.smem_len = max(smem_len, sinfo->smem_len); |
275 | mutex_unlock(&info->mm_lock); | ||
276 | 277 | ||
277 | info->screen_base = dma_alloc_writecombine(info->device, info->fix.smem_len, | 278 | info->screen_base = dma_alloc_writecombine(info->device, info->fix.smem_len, |
278 | (dma_addr_t *)&info->fix.smem_start, GFP_KERNEL); | 279 | (dma_addr_t *)&info->fix.smem_start, GFP_KERNEL); |
diff --git a/drivers/video/fsl-diu-fb.c b/drivers/video/fsl-diu-fb.c index 0bf2190928d..72d68b3dc47 100644 --- a/drivers/video/fsl-diu-fb.c +++ b/drivers/video/fsl-diu-fb.c | |||
@@ -1223,12 +1223,6 @@ static int __devinit install_fb(struct fb_info *info) | |||
1223 | return -EINVAL; | 1223 | return -EINVAL; |
1224 | } | 1224 | } |
1225 | 1225 | ||
1226 | if (fsl_diu_set_par(info)) { | ||
1227 | printk(KERN_ERR "fb_set_par failed"); | ||
1228 | fb_dealloc_cmap(&info->cmap); | ||
1229 | return -EINVAL; | ||
1230 | } | ||
1231 | |||
1232 | if (register_framebuffer(info) < 0) { | 1226 | if (register_framebuffer(info) < 0) { |
1233 | printk(KERN_ERR "register_framebuffer failed"); | 1227 | printk(KERN_ERR "register_framebuffer failed"); |
1234 | unmap_video_memory(info); | 1228 | unmap_video_memory(info); |
diff --git a/drivers/video/hitfb.c b/drivers/video/hitfb.c index 020db7fc915..e7116a6d82d 100644 --- a/drivers/video/hitfb.c +++ b/drivers/video/hitfb.c | |||
@@ -44,9 +44,6 @@ static struct fb_fix_screeninfo hitfb_fix __initdata = { | |||
44 | .accel = FB_ACCEL_NONE, | 44 | .accel = FB_ACCEL_NONE, |
45 | }; | 45 | }; |
46 | 46 | ||
47 | static u32 pseudo_palette[16]; | ||
48 | static struct fb_info fb_info; | ||
49 | |||
50 | static inline void hitfb_accel_wait(void) | 47 | static inline void hitfb_accel_wait(void) |
51 | { | 48 | { |
52 | while (fb_readw(HD64461_GRCFGR) & HD64461_GRCFGR_ACCSTATUS) ; | 49 | while (fb_readw(HD64461_GRCFGR) & HD64461_GRCFGR_ACCSTATUS) ; |
@@ -331,6 +328,8 @@ static struct fb_ops hitfb_ops = { | |||
331 | static int __init hitfb_probe(struct platform_device *dev) | 328 | static int __init hitfb_probe(struct platform_device *dev) |
332 | { | 329 | { |
333 | unsigned short lcdclor, ldr3, ldvndr; | 330 | unsigned short lcdclor, ldr3, ldvndr; |
331 | struct fb_info *info; | ||
332 | int ret; | ||
334 | 333 | ||
335 | if (fb_get_options("hitfb", NULL)) | 334 | if (fb_get_options("hitfb", NULL)) |
336 | return -ENODEV; | 335 | return -ENODEV; |
@@ -384,32 +383,53 @@ static int __init hitfb_probe(struct platform_device *dev) | |||
384 | break; | 383 | break; |
385 | } | 384 | } |
386 | 385 | ||
387 | fb_info.fbops = &hitfb_ops; | 386 | info = framebuffer_alloc(sizeof(u32) * 16, &dev->dev); |
388 | fb_info.var = hitfb_var; | 387 | if (unlikely(!info)) |
389 | fb_info.fix = hitfb_fix; | 388 | return -ENOMEM; |
390 | fb_info.pseudo_palette = pseudo_palette; | 389 | |
391 | fb_info.flags = FBINFO_DEFAULT | FBINFO_HWACCEL_YPAN | | 390 | info->fbops = &hitfb_ops; |
391 | info->var = hitfb_var; | ||
392 | info->fix = hitfb_fix; | ||
393 | info->pseudo_palette = info->par; | ||
394 | info->flags = FBINFO_DEFAULT | FBINFO_HWACCEL_YPAN | | ||
392 | FBINFO_HWACCEL_FILLRECT | FBINFO_HWACCEL_COPYAREA; | 395 | FBINFO_HWACCEL_FILLRECT | FBINFO_HWACCEL_COPYAREA; |
393 | 396 | ||
394 | fb_info.screen_base = (void *)hitfb_fix.smem_start; | 397 | info->screen_base = (void *)hitfb_fix.smem_start; |
395 | 398 | ||
396 | fb_alloc_cmap(&fb_info.cmap, 256, 0); | 399 | ret = fb_alloc_cmap(&info->cmap, 256, 0); |
400 | if (unlikely(ret < 0)) | ||
401 | goto err_fb; | ||
397 | 402 | ||
398 | if (register_framebuffer(&fb_info) < 0) | 403 | ret = register_framebuffer(info); |
399 | return -EINVAL; | 404 | if (unlikely(ret < 0)) |
405 | goto err; | ||
406 | |||
407 | platform_set_drvdata(dev, info); | ||
400 | 408 | ||
401 | printk(KERN_INFO "fb%d: %s frame buffer device\n", | 409 | printk(KERN_INFO "fb%d: %s frame buffer device\n", |
402 | fb_info.node, fb_info.fix.id); | 410 | info->node, info->fix.id); |
411 | |||
403 | return 0; | 412 | return 0; |
413 | |||
414 | err: | ||
415 | fb_dealloc_cmap(&info->cmap); | ||
416 | err_fb: | ||
417 | framebuffer_release(info); | ||
418 | return ret; | ||
404 | } | 419 | } |
405 | 420 | ||
406 | static int __exit hitfb_remove(struct platform_device *dev) | 421 | static int __exit hitfb_remove(struct platform_device *dev) |
407 | { | 422 | { |
408 | return unregister_framebuffer(&fb_info); | 423 | struct fb_info *info = platform_get_drvdata(dev); |
424 | |||
425 | unregister_framebuffer(info); | ||
426 | fb_dealloc_cmap(&info->cmap); | ||
427 | framebuffer_release(info); | ||
428 | |||
429 | return 0; | ||
409 | } | 430 | } |
410 | 431 | ||
411 | #ifdef CONFIG_PM | 432 | static int hitfb_suspend(struct device *dev) |
412 | static int hitfb_suspend(struct platform_device *dev, pm_message_t state) | ||
413 | { | 433 | { |
414 | u16 v; | 434 | u16 v; |
415 | 435 | ||
@@ -421,7 +441,7 @@ static int hitfb_suspend(struct platform_device *dev, pm_message_t state) | |||
421 | return 0; | 441 | return 0; |
422 | } | 442 | } |
423 | 443 | ||
424 | static int hitfb_resume(struct platform_device *dev) | 444 | static int hitfb_resume(struct device *dev) |
425 | { | 445 | { |
426 | u16 v; | 446 | u16 v; |
427 | 447 | ||
@@ -435,17 +455,19 @@ static int hitfb_resume(struct platform_device *dev) | |||
435 | 455 | ||
436 | return 0; | 456 | return 0; |
437 | } | 457 | } |
438 | #endif | 458 | |
459 | static struct dev_pm_ops hitfb_dev_pm_ops = { | ||
460 | .suspend = hitfb_suspend, | ||
461 | .resume = hitfb_resume, | ||
462 | }; | ||
439 | 463 | ||
440 | static struct platform_driver hitfb_driver = { | 464 | static struct platform_driver hitfb_driver = { |
441 | .probe = hitfb_probe, | 465 | .probe = hitfb_probe, |
442 | .remove = __exit_p(hitfb_remove), | 466 | .remove = __exit_p(hitfb_remove), |
443 | #ifdef CONFIG_PM | ||
444 | .suspend = hitfb_suspend, | ||
445 | .resume = hitfb_resume, | ||
446 | #endif | ||
447 | .driver = { | 467 | .driver = { |
448 | .name = "hitfb", | 468 | .name = "hitfb", |
469 | .owner = THIS_MODULE, | ||
470 | .pm = &hitfb_dev_pm_ops, | ||
449 | }, | 471 | }, |
450 | }; | 472 | }; |
451 | 473 | ||
diff --git a/drivers/video/i810/i810_main.c b/drivers/video/i810/i810_main.c index 71960672d72..5743ea25e81 100644 --- a/drivers/video/i810/i810_main.c +++ b/drivers/video/i810/i810_main.c | |||
@@ -2060,8 +2060,7 @@ static int __devinit i810fb_init_pci (struct pci_dev *dev, | |||
2060 | 2060 | ||
2061 | fb_var_to_videomode(&mode, &info->var); | 2061 | fb_var_to_videomode(&mode, &info->var); |
2062 | fb_add_videomode(&mode, &info->modelist); | 2062 | fb_add_videomode(&mode, &info->modelist); |
2063 | encode_fix(&info->fix, info); | 2063 | |
2064 | |||
2065 | i810fb_init_ringbuffer(info); | 2064 | i810fb_init_ringbuffer(info); |
2066 | err = register_framebuffer(info); | 2065 | err = register_framebuffer(info); |
2067 | 2066 | ||
diff --git a/drivers/video/matrox/matroxfb_DAC1064.c b/drivers/video/matrox/matroxfb_DAC1064.c index 0ce3b0a8979..a74e5da17aa 100644 --- a/drivers/video/matrox/matroxfb_DAC1064.c +++ b/drivers/video/matrox/matroxfb_DAC1064.c | |||
@@ -454,9 +454,9 @@ static void DAC1064_restore_2(WPMINFO2) { | |||
454 | dprintk(KERN_DEBUG "DAC1064regs "); | 454 | dprintk(KERN_DEBUG "DAC1064regs "); |
455 | for (i = 0; i < sizeof(MGA1064_DAC_regs); i++) { | 455 | for (i = 0; i < sizeof(MGA1064_DAC_regs); i++) { |
456 | dprintk("R%02X=%02X ", MGA1064_DAC_regs[i], ACCESS_FBINFO(hw).DACreg[i]); | 456 | dprintk("R%02X=%02X ", MGA1064_DAC_regs[i], ACCESS_FBINFO(hw).DACreg[i]); |
457 | if ((i & 0x7) == 0x7) dprintk("\n" KERN_DEBUG "continuing... "); | 457 | if ((i & 0x7) == 0x7) dprintk(KERN_DEBUG "continuing... "); |
458 | } | 458 | } |
459 | dprintk("\n" KERN_DEBUG "DAC1064clk "); | 459 | dprintk(KERN_DEBUG "DAC1064clk "); |
460 | for (i = 0; i < 6; i++) | 460 | for (i = 0; i < 6; i++) |
461 | dprintk("C%02X=%02X ", i, ACCESS_FBINFO(hw).DACclk[i]); | 461 | dprintk("C%02X=%02X ", i, ACCESS_FBINFO(hw).DACclk[i]); |
462 | dprintk("\n"); | 462 | dprintk("\n"); |
diff --git a/drivers/video/matrox/matroxfb_Ti3026.c b/drivers/video/matrox/matroxfb_Ti3026.c index 13524821e24..4e825112a60 100644 --- a/drivers/video/matrox/matroxfb_Ti3026.c +++ b/drivers/video/matrox/matroxfb_Ti3026.c | |||
@@ -651,9 +651,9 @@ static void Ti3026_restore(WPMINFO2) { | |||
651 | dprintk(KERN_DEBUG "3026DACregs "); | 651 | dprintk(KERN_DEBUG "3026DACregs "); |
652 | for (i = 0; i < 21; i++) { | 652 | for (i = 0; i < 21; i++) { |
653 | dprintk("R%02X=%02X ", DACseq[i], hw->DACreg[i]); | 653 | dprintk("R%02X=%02X ", DACseq[i], hw->DACreg[i]); |
654 | if ((i & 0x7) == 0x7) dprintk("\n" KERN_DEBUG "continuing... "); | 654 | if ((i & 0x7) == 0x7) dprintk(KERN_DEBUG "continuing... "); |
655 | } | 655 | } |
656 | dprintk("\n" KERN_DEBUG "DACclk "); | 656 | dprintk(KERN_DEBUG "DACclk "); |
657 | for (i = 0; i < 6; i++) | 657 | for (i = 0; i < 6; i++) |
658 | dprintk("C%02X=%02X ", i, hw->DACclk[i]); | 658 | dprintk("C%02X=%02X ", i, hw->DACclk[i]); |
659 | dprintk("\n"); | 659 | dprintk("\n"); |
diff --git a/drivers/video/matrox/matroxfb_base.c b/drivers/video/matrox/matroxfb_base.c index 59c3a2e1491..0c1049b308b 100644 --- a/drivers/video/matrox/matroxfb_base.c +++ b/drivers/video/matrox/matroxfb_base.c | |||
@@ -1876,7 +1876,6 @@ static int initMatrox2(WPMINFO struct board* b){ | |||
1876 | } | 1876 | } |
1877 | matroxfb_init_fix(PMINFO2); | 1877 | matroxfb_init_fix(PMINFO2); |
1878 | ACCESS_FBINFO(fbcon.screen_base) = vaddr_va(ACCESS_FBINFO(video.vbase)); | 1878 | ACCESS_FBINFO(fbcon.screen_base) = vaddr_va(ACCESS_FBINFO(video.vbase)); |
1879 | matroxfb_update_fix(PMINFO2); | ||
1880 | /* Normalize values (namely yres_virtual) */ | 1879 | /* Normalize values (namely yres_virtual) */ |
1881 | matroxfb_check_var(&vesafb_defined, &ACCESS_FBINFO(fbcon)); | 1880 | matroxfb_check_var(&vesafb_defined, &ACCESS_FBINFO(fbcon)); |
1882 | /* And put it into "current" var. Do NOT program hardware yet, or we'll not take over | 1881 | /* And put it into "current" var. Do NOT program hardware yet, or we'll not take over |
diff --git a/drivers/video/matrox/matroxfb_crtc2.c b/drivers/video/matrox/matroxfb_crtc2.c index 909e10a1189..ebcb5c6b496 100644 --- a/drivers/video/matrox/matroxfb_crtc2.c +++ b/drivers/video/matrox/matroxfb_crtc2.c | |||
@@ -289,16 +289,18 @@ static int matroxfb_dh_release(struct fb_info* info, int user) { | |||
289 | #undef m2info | 289 | #undef m2info |
290 | } | 290 | } |
291 | 291 | ||
292 | /* | ||
293 | * This function is called before the register_framebuffer so | ||
294 | * no locking is needed. | ||
295 | */ | ||
292 | static void matroxfb_dh_init_fix(struct matroxfb_dh_fb_info *m2info) | 296 | static void matroxfb_dh_init_fix(struct matroxfb_dh_fb_info *m2info) |
293 | { | 297 | { |
294 | struct fb_fix_screeninfo *fix = &m2info->fbcon.fix; | 298 | struct fb_fix_screeninfo *fix = &m2info->fbcon.fix; |
295 | 299 | ||
296 | strcpy(fix->id, "MATROX DH"); | 300 | strcpy(fix->id, "MATROX DH"); |
297 | 301 | ||
298 | mutex_lock(&m2info->fbcon.mm_lock); | ||
299 | fix->smem_start = m2info->video.base; | 302 | fix->smem_start = m2info->video.base; |
300 | fix->smem_len = m2info->video.len_usable; | 303 | fix->smem_len = m2info->video.len_usable; |
301 | mutex_unlock(&m2info->fbcon.mm_lock); | ||
302 | fix->ypanstep = 1; | 304 | fix->ypanstep = 1; |
303 | fix->ywrapstep = 0; | 305 | fix->ywrapstep = 0; |
304 | fix->xpanstep = 8; /* TBD */ | 306 | fix->xpanstep = 8; /* TBD */ |
diff --git a/drivers/video/mx3fb.c b/drivers/video/mx3fb.c index 567fb944bd2..f8778cde218 100644 --- a/drivers/video/mx3fb.c +++ b/drivers/video/mx3fb.c | |||
@@ -1365,11 +1365,6 @@ static int init_fb_chan(struct mx3fb_data *mx3fb, struct idmac_channel *ichan) | |||
1365 | init_completion(&mx3fbi->flip_cmpl); | 1365 | init_completion(&mx3fbi->flip_cmpl); |
1366 | disable_irq(ichan->eof_irq); | 1366 | disable_irq(ichan->eof_irq); |
1367 | dev_dbg(mx3fb->dev, "disabling irq %d\n", ichan->eof_irq); | 1367 | dev_dbg(mx3fb->dev, "disabling irq %d\n", ichan->eof_irq); |
1368 | ret = mx3fb_set_par(fbi); | ||
1369 | if (ret < 0) | ||
1370 | goto esetpar; | ||
1371 | |||
1372 | mx3fb_blank(FB_BLANK_UNBLANK, fbi); | ||
1373 | 1368 | ||
1374 | dev_info(dev, "registered, using mode %s\n", fb_mode); | 1369 | dev_info(dev, "registered, using mode %s\n", fb_mode); |
1375 | 1370 | ||
diff --git a/drivers/video/s3c-fb.c b/drivers/video/s3c-fb.c index 43680e54542..bb63c07e13d 100644 --- a/drivers/video/s3c-fb.c +++ b/drivers/video/s3c-fb.c | |||
@@ -211,23 +211,21 @@ static int s3c_fb_check_var(struct fb_var_screeninfo *var, | |||
211 | 211 | ||
212 | /** | 212 | /** |
213 | * s3c_fb_calc_pixclk() - calculate the divider to create the pixel clock. | 213 | * s3c_fb_calc_pixclk() - calculate the divider to create the pixel clock. |
214 | * @id: window id. | ||
214 | * @sfb: The hardware state. | 215 | * @sfb: The hardware state. |
215 | * @pixclock: The pixel clock wanted, in picoseconds. | 216 | * @pixclock: The pixel clock wanted, in picoseconds. |
216 | * | 217 | * |
217 | * Given the specified pixel clock, work out the necessary divider to get | 218 | * Given the specified pixel clock, work out the necessary divider to get |
218 | * close to the output frequency. | 219 | * close to the output frequency. |
219 | */ | 220 | */ |
220 | static int s3c_fb_calc_pixclk(struct s3c_fb *sfb, unsigned int pixclk) | 221 | static int s3c_fb_calc_pixclk(unsigned char id, struct s3c_fb *sfb, unsigned int pixclk) |
221 | { | 222 | { |
223 | struct s3c_fb_pd_win *win = sfb->pdata->win[id]; | ||
222 | unsigned long clk = clk_get_rate(sfb->bus_clk); | 224 | unsigned long clk = clk_get_rate(sfb->bus_clk); |
223 | unsigned long long tmp; | ||
224 | unsigned int result; | 225 | unsigned int result; |
225 | 226 | ||
226 | tmp = (unsigned long long)clk; | 227 | pixclk *= win->win_mode.refresh; |
227 | tmp *= pixclk; | 228 | result = clk / pixclk; |
228 | |||
229 | do_div(tmp, 1000000000UL); | ||
230 | result = (unsigned int)tmp / 1000; | ||
231 | 229 | ||
232 | dev_dbg(sfb->dev, "pixclk=%u, clk=%lu, div=%d (%lu)\n", | 230 | dev_dbg(sfb->dev, "pixclk=%u, clk=%lu, div=%d (%lu)\n", |
233 | pixclk, clk, result, clk / result); | 231 | pixclk, clk, result, clk / result); |
@@ -267,6 +265,7 @@ static int s3c_fb_set_par(struct fb_info *info) | |||
267 | struct s3c_fb *sfb = win->parent; | 265 | struct s3c_fb *sfb = win->parent; |
268 | void __iomem *regs = sfb->regs; | 266 | void __iomem *regs = sfb->regs; |
269 | int win_no = win->index; | 267 | int win_no = win->index; |
268 | u32 osdc_data = 0; | ||
270 | u32 data; | 269 | u32 data; |
271 | u32 pagewidth; | 270 | u32 pagewidth; |
272 | int clkdiv; | 271 | int clkdiv; |
@@ -302,7 +301,7 @@ static int s3c_fb_set_par(struct fb_info *info) | |||
302 | /* use window 0 as the basis for the lcd output timings */ | 301 | /* use window 0 as the basis for the lcd output timings */ |
303 | 302 | ||
304 | if (win_no == 0) { | 303 | if (win_no == 0) { |
305 | clkdiv = s3c_fb_calc_pixclk(sfb, var->pixclock); | 304 | clkdiv = s3c_fb_calc_pixclk(win_no, sfb, var->pixclock); |
306 | 305 | ||
307 | data = sfb->pdata->vidcon0; | 306 | data = sfb->pdata->vidcon0; |
308 | data &= ~(VIDCON0_CLKVAL_F_MASK | VIDCON0_CLKDIR); | 307 | data &= ~(VIDCON0_CLKVAL_F_MASK | VIDCON0_CLKDIR); |
@@ -359,8 +358,6 @@ static int s3c_fb_set_par(struct fb_info *info) | |||
359 | 358 | ||
360 | data = var->xres * var->yres; | 359 | data = var->xres * var->yres; |
361 | 360 | ||
362 | u32 osdc_data = 0; | ||
363 | |||
364 | osdc_data = VIDISD14C_ALPHA1_R(0xf) | | 361 | osdc_data = VIDISD14C_ALPHA1_R(0xf) | |
365 | VIDISD14C_ALPHA1_G(0xf) | | 362 | VIDISD14C_ALPHA1_G(0xf) | |
366 | VIDISD14C_ALPHA1_B(0xf); | 363 | VIDISD14C_ALPHA1_B(0xf); |
diff --git a/drivers/video/sh_mobile_lcdcfb.c b/drivers/video/sh_mobile_lcdcfb.c index da983b720f0..8f24564f77b 100644 --- a/drivers/video/sh_mobile_lcdcfb.c +++ b/drivers/video/sh_mobile_lcdcfb.c | |||
@@ -31,7 +31,7 @@ struct sh_mobile_lcdc_chan { | |||
31 | unsigned long enabled; /* ME and SE in LDCNT2R */ | 31 | unsigned long enabled; /* ME and SE in LDCNT2R */ |
32 | struct sh_mobile_lcdc_chan_cfg cfg; | 32 | struct sh_mobile_lcdc_chan_cfg cfg; |
33 | u32 pseudo_palette[PALETTE_NR]; | 33 | u32 pseudo_palette[PALETTE_NR]; |
34 | struct fb_info info; | 34 | struct fb_info *info; |
35 | dma_addr_t dma_handle; | 35 | dma_addr_t dma_handle; |
36 | struct fb_deferred_io defio; | 36 | struct fb_deferred_io defio; |
37 | struct scatterlist *sglist; | 37 | struct scatterlist *sglist; |
@@ -442,22 +442,22 @@ static int sh_mobile_lcdc_start(struct sh_mobile_lcdc_priv *priv) | |||
442 | /* set bpp format in PKF[4:0] */ | 442 | /* set bpp format in PKF[4:0] */ |
443 | tmp = lcdc_read_chan(ch, LDDFR); | 443 | tmp = lcdc_read_chan(ch, LDDFR); |
444 | tmp &= ~(0x0001001f); | 444 | tmp &= ~(0x0001001f); |
445 | tmp |= (priv->ch[k].info.var.bits_per_pixel == 16) ? 3 : 0; | 445 | tmp |= (ch->info->var.bits_per_pixel == 16) ? 3 : 0; |
446 | lcdc_write_chan(ch, LDDFR, tmp); | 446 | lcdc_write_chan(ch, LDDFR, tmp); |
447 | 447 | ||
448 | /* point out our frame buffer */ | 448 | /* point out our frame buffer */ |
449 | lcdc_write_chan(ch, LDSA1R, ch->info.fix.smem_start); | 449 | lcdc_write_chan(ch, LDSA1R, ch->info->fix.smem_start); |
450 | 450 | ||
451 | /* set line size */ | 451 | /* set line size */ |
452 | lcdc_write_chan(ch, LDMLSR, ch->info.fix.line_length); | 452 | lcdc_write_chan(ch, LDMLSR, ch->info->fix.line_length); |
453 | 453 | ||
454 | /* setup deferred io if SYS bus */ | 454 | /* setup deferred io if SYS bus */ |
455 | tmp = ch->cfg.sys_bus_cfg.deferred_io_msec; | 455 | tmp = ch->cfg.sys_bus_cfg.deferred_io_msec; |
456 | if (ch->ldmt1r_value & (1 << 12) && tmp) { | 456 | if (ch->ldmt1r_value & (1 << 12) && tmp) { |
457 | ch->defio.deferred_io = sh_mobile_lcdc_deferred_io; | 457 | ch->defio.deferred_io = sh_mobile_lcdc_deferred_io; |
458 | ch->defio.delay = msecs_to_jiffies(tmp); | 458 | ch->defio.delay = msecs_to_jiffies(tmp); |
459 | ch->info.fbdefio = &ch->defio; | 459 | ch->info->fbdefio = &ch->defio; |
460 | fb_deferred_io_init(&ch->info); | 460 | fb_deferred_io_init(ch->info); |
461 | 461 | ||
462 | /* one-shot mode */ | 462 | /* one-shot mode */ |
463 | lcdc_write_chan(ch, LDSM1R, 1); | 463 | lcdc_write_chan(ch, LDSM1R, 1); |
@@ -503,12 +503,12 @@ static void sh_mobile_lcdc_stop(struct sh_mobile_lcdc_priv *priv) | |||
503 | * flush frame, and wait for frame end interrupt | 503 | * flush frame, and wait for frame end interrupt |
504 | * clean up deferred io and enable clock | 504 | * clean up deferred io and enable clock |
505 | */ | 505 | */ |
506 | if (ch->info.fbdefio) { | 506 | if (ch->info->fbdefio) { |
507 | ch->frame_end = 0; | 507 | ch->frame_end = 0; |
508 | schedule_delayed_work(&ch->info.deferred_work, 0); | 508 | schedule_delayed_work(&ch->info->deferred_work, 0); |
509 | wait_event(ch->frame_end_wait, ch->frame_end); | 509 | wait_event(ch->frame_end_wait, ch->frame_end); |
510 | fb_deferred_io_cleanup(&ch->info); | 510 | fb_deferred_io_cleanup(ch->info); |
511 | ch->info.fbdefio = NULL; | 511 | ch->info->fbdefio = NULL; |
512 | sh_mobile_lcdc_clk_on(priv); | 512 | sh_mobile_lcdc_clk_on(priv); |
513 | } | 513 | } |
514 | 514 | ||
@@ -817,9 +817,16 @@ static int __init sh_mobile_lcdc_probe(struct platform_device *pdev) | |||
817 | priv->base = ioremap_nocache(res->start, (res->end - res->start) + 1); | 817 | priv->base = ioremap_nocache(res->start, (res->end - res->start) + 1); |
818 | 818 | ||
819 | for (i = 0; i < j; i++) { | 819 | for (i = 0; i < j; i++) { |
820 | info = &priv->ch[i].info; | ||
821 | cfg = &priv->ch[i].cfg; | 820 | cfg = &priv->ch[i].cfg; |
822 | 821 | ||
822 | priv->ch[i].info = framebuffer_alloc(0, &pdev->dev); | ||
823 | if (!priv->ch[i].info) { | ||
824 | dev_err(&pdev->dev, "unable to allocate fb_info\n"); | ||
825 | error = -ENOMEM; | ||
826 | break; | ||
827 | } | ||
828 | |||
829 | info = priv->ch[i].info; | ||
823 | info->fbops = &sh_mobile_lcdc_ops; | 830 | info->fbops = &sh_mobile_lcdc_ops; |
824 | info->var.xres = info->var.xres_virtual = cfg->lcd_cfg.xres; | 831 | info->var.xres = info->var.xres_virtual = cfg->lcd_cfg.xres; |
825 | info->var.yres = info->var.yres_virtual = cfg->lcd_cfg.yres; | 832 | info->var.yres = info->var.yres_virtual = cfg->lcd_cfg.yres; |
@@ -872,7 +879,7 @@ static int __init sh_mobile_lcdc_probe(struct platform_device *pdev) | |||
872 | for (i = 0; i < j; i++) { | 879 | for (i = 0; i < j; i++) { |
873 | struct sh_mobile_lcdc_chan *ch = priv->ch + i; | 880 | struct sh_mobile_lcdc_chan *ch = priv->ch + i; |
874 | 881 | ||
875 | info = &ch->info; | 882 | info = ch->info; |
876 | 883 | ||
877 | if (info->fbdefio) { | 884 | if (info->fbdefio) { |
878 | priv->ch->sglist = vmalloc(sizeof(struct scatterlist) * | 885 | priv->ch->sglist = vmalloc(sizeof(struct scatterlist) * |
@@ -915,15 +922,15 @@ static int sh_mobile_lcdc_remove(struct platform_device *pdev) | |||
915 | int i; | 922 | int i; |
916 | 923 | ||
917 | for (i = 0; i < ARRAY_SIZE(priv->ch); i++) | 924 | for (i = 0; i < ARRAY_SIZE(priv->ch); i++) |
918 | if (priv->ch[i].info.dev) | 925 | if (priv->ch[i].info->dev) |
919 | unregister_framebuffer(&priv->ch[i].info); | 926 | unregister_framebuffer(priv->ch[i].info); |
920 | 927 | ||
921 | sh_mobile_lcdc_stop(priv); | 928 | sh_mobile_lcdc_stop(priv); |
922 | 929 | ||
923 | for (i = 0; i < ARRAY_SIZE(priv->ch); i++) { | 930 | for (i = 0; i < ARRAY_SIZE(priv->ch); i++) { |
924 | info = &priv->ch[i].info; | 931 | info = priv->ch[i].info; |
925 | 932 | ||
926 | if (!info->device) | 933 | if (!info || !info->device) |
927 | continue; | 934 | continue; |
928 | 935 | ||
929 | if (priv->ch[i].sglist) | 936 | if (priv->ch[i].sglist) |
@@ -932,6 +939,7 @@ static int sh_mobile_lcdc_remove(struct platform_device *pdev) | |||
932 | dma_free_coherent(&pdev->dev, info->fix.smem_len, | 939 | dma_free_coherent(&pdev->dev, info->fix.smem_len, |
933 | info->screen_base, priv->ch[i].dma_handle); | 940 | info->screen_base, priv->ch[i].dma_handle); |
934 | fb_dealloc_cmap(&info->cmap); | 941 | fb_dealloc_cmap(&info->cmap); |
942 | framebuffer_release(info); | ||
935 | } | 943 | } |
936 | 944 | ||
937 | #ifdef CONFIG_HAVE_CLK | 945 | #ifdef CONFIG_HAVE_CLK |
diff --git a/drivers/video/sis/sis_main.c b/drivers/video/sis/sis_main.c index fd33455389b..4a067f0d0ce 100644 --- a/drivers/video/sis/sis_main.c +++ b/drivers/video/sis/sis_main.c | |||
@@ -6367,7 +6367,6 @@ error_3: vfree(ivideo->bios_abase); | |||
6367 | sis_fb_info->fix = ivideo->sisfb_fix; | 6367 | sis_fb_info->fix = ivideo->sisfb_fix; |
6368 | sis_fb_info->screen_base = ivideo->video_vbase + ivideo->video_offset; | 6368 | sis_fb_info->screen_base = ivideo->video_vbase + ivideo->video_offset; |
6369 | sis_fb_info->fbops = &sisfb_ops; | 6369 | sis_fb_info->fbops = &sisfb_ops; |
6370 | sisfb_get_fix(&sis_fb_info->fix, -1, sis_fb_info); | ||
6371 | sis_fb_info->pseudo_palette = ivideo->pseudo_palette; | 6370 | sis_fb_info->pseudo_palette = ivideo->pseudo_palette; |
6372 | 6371 | ||
6373 | fb_alloc_cmap(&sis_fb_info->cmap, 256 , 0); | 6372 | fb_alloc_cmap(&sis_fb_info->cmap, 256 , 0); |
diff --git a/drivers/video/sm501fb.c b/drivers/video/sm501fb.c index 16d4f4c7d52..924d7946278 100644 --- a/drivers/video/sm501fb.c +++ b/drivers/video/sm501fb.c | |||
@@ -1540,9 +1540,6 @@ static int sm501fb_init_fb(struct fb_info *fb, | |||
1540 | if (ret) | 1540 | if (ret) |
1541 | dev_err(info->dev, "check_var() failed on initial setup?\n"); | 1541 | dev_err(info->dev, "check_var() failed on initial setup?\n"); |
1542 | 1542 | ||
1543 | /* ensure we've activated our new configuration */ | ||
1544 | (fb->fbops->fb_set_par)(fb); | ||
1545 | |||
1546 | return 0; | 1543 | return 0; |
1547 | } | 1544 | } |
1548 | 1545 | ||
diff --git a/drivers/video/stifb.c b/drivers/video/stifb.c index eec9dcb7f59..6120f0c526f 100644 --- a/drivers/video/stifb.c +++ b/drivers/video/stifb.c | |||
@@ -1115,10 +1115,9 @@ static int __init stifb_init_fb(struct sti_struct *sti, int bpp_pref) | |||
1115 | if the device name contains the string "DX" and tell the | 1115 | if the device name contains the string "DX" and tell the |
1116 | user how to reconfigure the card. */ | 1116 | user how to reconfigure the card. */ |
1117 | if (strstr(sti->outptr.dev_name, "DX")) { | 1117 | if (strstr(sti->outptr.dev_name, "DX")) { |
1118 | printk(KERN_WARNING "WARNING: stifb framebuffer driver does not " | 1118 | printk(KERN_WARNING |
1119 | "support '%s' in double-buffer mode.\n" | 1119 | "WARNING: stifb framebuffer driver does not support '%s' in double-buffer mode.\n" |
1120 | KERN_WARNING "WARNING: Please disable the double-buffer mode " | 1120 | "WARNING: Please disable the double-buffer mode in IPL menu (the PARISC-BIOS).\n", |
1121 | "in IPL menu (the PARISC-BIOS).\n", | ||
1122 | sti->outptr.dev_name); | 1121 | sti->outptr.dev_name); |
1123 | goto out_err0; | 1122 | goto out_err0; |
1124 | } | 1123 | } |
diff --git a/drivers/video/w100fb.c b/drivers/video/w100fb.c index 8a141c2c637..2376f688ec8 100644 --- a/drivers/video/w100fb.c +++ b/drivers/video/w100fb.c | |||
@@ -748,8 +748,6 @@ int __init w100fb_probe(struct platform_device *pdev) | |||
748 | goto out; | 748 | goto out; |
749 | } | 749 | } |
750 | 750 | ||
751 | w100fb_set_par(info); | ||
752 | |||
753 | if (register_framebuffer(info) < 0) { | 751 | if (register_framebuffer(info) < 0) { |
754 | err = -EINVAL; | 752 | err = -EINVAL; |
755 | goto out; | 753 | goto out; |
diff --git a/drivers/vlynq/Kconfig b/drivers/vlynq/Kconfig index f6542211db4..a9efb162532 100644 --- a/drivers/vlynq/Kconfig +++ b/drivers/vlynq/Kconfig | |||
@@ -13,7 +13,7 @@ config VLYNQ | |||
13 | 13 | ||
14 | config VLYNQ_DEBUG | 14 | config VLYNQ_DEBUG |
15 | bool "VLYNQ bus debug" | 15 | bool "VLYNQ bus debug" |
16 | depends on VLYNQ && KERNEL_DEBUG | 16 | depends on VLYNQ && DEBUG_KERNEL |
17 | help | 17 | help |
18 | Turn on VLYNQ bus debugging. | 18 | Turn on VLYNQ bus debugging. |
19 | 19 | ||
diff --git a/drivers/vlynq/vlynq.c b/drivers/vlynq/vlynq.c index 7335433b067..f05d2a36836 100644 --- a/drivers/vlynq/vlynq.c +++ b/drivers/vlynq/vlynq.c | |||
@@ -76,7 +76,7 @@ struct vlynq_regs { | |||
76 | u32 int_device[8]; | 76 | u32 int_device[8]; |
77 | }; | 77 | }; |
78 | 78 | ||
79 | #ifdef VLYNQ_DEBUG | 79 | #ifdef CONFIG_VLYNQ_DEBUG |
80 | static void vlynq_dump_regs(struct vlynq_device *dev) | 80 | static void vlynq_dump_regs(struct vlynq_device *dev) |
81 | { | 81 | { |
82 | int i; | 82 | int i; |
diff --git a/drivers/watchdog/bcm47xx_wdt.c b/drivers/watchdog/bcm47xx_wdt.c index 5c7011cda6a..751c003864a 100644 --- a/drivers/watchdog/bcm47xx_wdt.c +++ b/drivers/watchdog/bcm47xx_wdt.c | |||
@@ -161,7 +161,7 @@ static long bcm47xx_wdt_ioctl(struct file *file, | |||
161 | { | 161 | { |
162 | void __user *argp = (void __user *)arg; | 162 | void __user *argp = (void __user *)arg; |
163 | int __user *p = argp; | 163 | int __user *p = argp; |
164 | int new_value, retval = -EINVAL;; | 164 | int new_value, retval = -EINVAL; |
165 | 165 | ||
166 | switch (cmd) { | 166 | switch (cmd) { |
167 | case WDIOC_GETSUPPORT: | 167 | case WDIOC_GETSUPPORT: |
diff --git a/drivers/watchdog/sa1100_wdt.c b/drivers/watchdog/sa1100_wdt.c index ee1caae4d33..016245419fa 100644 --- a/drivers/watchdog/sa1100_wdt.c +++ b/drivers/watchdog/sa1100_wdt.c | |||
@@ -38,7 +38,7 @@ | |||
38 | 38 | ||
39 | static unsigned long oscr_freq; | 39 | static unsigned long oscr_freq; |
40 | static unsigned long sa1100wdt_users; | 40 | static unsigned long sa1100wdt_users; |
41 | static int pre_margin; | 41 | static unsigned int pre_margin; |
42 | static int boot_status; | 42 | static int boot_status; |
43 | 43 | ||
44 | /* | 44 | /* |
@@ -84,6 +84,7 @@ static const struct watchdog_info ident = { | |||
84 | .options = WDIOF_CARDRESET | WDIOF_SETTIMEOUT | 84 | .options = WDIOF_CARDRESET | WDIOF_SETTIMEOUT |
85 | | WDIOF_KEEPALIVEPING, | 85 | | WDIOF_KEEPALIVEPING, |
86 | .identity = "SA1100/PXA255 Watchdog", | 86 | .identity = "SA1100/PXA255 Watchdog", |
87 | .firmware_version = 1, | ||
87 | }; | 88 | }; |
88 | 89 | ||
89 | static long sa1100dog_ioctl(struct file *file, unsigned int cmd, | 90 | static long sa1100dog_ioctl(struct file *file, unsigned int cmd, |
@@ -118,7 +119,7 @@ static long sa1100dog_ioctl(struct file *file, unsigned int cmd, | |||
118 | if (ret) | 119 | if (ret) |
119 | break; | 120 | break; |
120 | 121 | ||
121 | if (time <= 0 || time > 255) { | 122 | if (time <= 0 || (oscr_freq * (long long)time >= 0xffffffff)) { |
122 | ret = -EINVAL; | 123 | ret = -EINVAL; |
123 | break; | 124 | break; |
124 | } | 125 | } |
diff --git a/drivers/watchdog/w83627hf_wdt.c b/drivers/watchdog/w83627hf_wdt.c index 916890abffd..f201accc4e3 100644 --- a/drivers/watchdog/w83627hf_wdt.c +++ b/drivers/watchdog/w83627hf_wdt.c | |||
@@ -89,6 +89,11 @@ static void w83627hf_select_wd_register(void) | |||
89 | c = ((inb_p(WDT_EFDR) & 0xf7) | 0x04); /* select WDT0 */ | 89 | c = ((inb_p(WDT_EFDR) & 0xf7) | 0x04); /* select WDT0 */ |
90 | outb_p(0x2b, WDT_EFER); | 90 | outb_p(0x2b, WDT_EFER); |
91 | outb_p(c, WDT_EFDR); /* set GPIO3 to WDT0 */ | 91 | outb_p(c, WDT_EFDR); /* set GPIO3 to WDT0 */ |
92 | } else if (c == 0x88) { /* W83627EHF */ | ||
93 | outb_p(0x2d, WDT_EFER); /* select GPIO5 */ | ||
94 | c = inb_p(WDT_EFDR) & ~0x01; /* PIN77 -> WDT0# */ | ||
95 | outb_p(0x2d, WDT_EFER); | ||
96 | outb_p(c, WDT_EFDR); /* set GPIO5 to WDT0 */ | ||
92 | } | 97 | } |
93 | 98 | ||
94 | outb_p(0x07, WDT_EFER); /* point to logical device number reg */ | 99 | outb_p(0x07, WDT_EFER); /* point to logical device number reg */ |
diff --git a/drivers/watchdog/w83697ug_wdt.c b/drivers/watchdog/w83697ug_wdt.c index 883b5f79673..a6c12dec91a 100644 --- a/drivers/watchdog/w83697ug_wdt.c +++ b/drivers/watchdog/w83697ug_wdt.c | |||
@@ -149,8 +149,10 @@ static void wdt_ctrl(int timeout) | |||
149 | { | 149 | { |
150 | spin_lock(&io_lock); | 150 | spin_lock(&io_lock); |
151 | 151 | ||
152 | if (w83697ug_select_wd_register() < 0) | 152 | if (w83697ug_select_wd_register() < 0) { |
153 | spin_unlock(&io_lock); | ||
153 | return; | 154 | return; |
155 | } | ||
154 | 156 | ||
155 | outb_p(0xF4, WDT_EFER); /* Select CRF4 */ | 157 | outb_p(0xF4, WDT_EFER); /* Select CRF4 */ |
156 | outb_p(timeout, WDT_EFDR); /* Write Timeout counter to CRF4 */ | 158 | outb_p(timeout, WDT_EFDR); /* Write Timeout counter to CRF4 */ |
diff --git a/drivers/xen/events.c b/drivers/xen/events.c index 891d2e90753..abad71b1632 100644 --- a/drivers/xen/events.c +++ b/drivers/xen/events.c | |||
@@ -927,9 +927,9 @@ static struct irq_chip xen_dynamic_chip __read_mostly = { | |||
927 | void __init xen_init_IRQ(void) | 927 | void __init xen_init_IRQ(void) |
928 | { | 928 | { |
929 | int i; | 929 | int i; |
930 | size_t size = nr_cpu_ids * sizeof(struct cpu_evtchn_s); | ||
931 | 930 | ||
932 | cpu_evtchn_mask_p = alloc_bootmem(size); | 931 | cpu_evtchn_mask_p = kcalloc(nr_cpu_ids, sizeof(struct cpu_evtchn_s), |
932 | GFP_KERNEL); | ||
933 | BUG_ON(cpu_evtchn_mask_p == NULL); | 933 | BUG_ON(cpu_evtchn_mask_p == NULL); |
934 | 934 | ||
935 | init_evtchn_cpu_bindings(); | 935 | init_evtchn_cpu_bindings(); |