aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/char
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/char')
-rw-r--r--drivers/char/Kconfig32
-rw-r--r--drivers/char/Makefile1
-rw-r--r--drivers/char/bfin-otp.c189
-rw-r--r--drivers/char/drm/drmP.h1
-rw-r--r--drivers/char/drm/i915_drv.h4
-rw-r--r--drivers/char/generic_serial.c1
-rw-r--r--drivers/char/hpet.c51
-rw-r--r--drivers/char/hvc_beat.c4
-rw-r--r--drivers/char/hw_random/core.c14
-rw-r--r--drivers/char/hw_random/omap-rng.c26
-rw-r--r--drivers/char/ip2/i2lib.c12
-rw-r--r--drivers/char/keyboard.c3
-rw-r--r--drivers/char/misc.c13
-rw-r--r--drivers/char/pcmcia/synclink_cs.c10
-rw-r--r--drivers/char/rio/rioboot.c1
-rw-r--r--drivers/char/rio/riocmd.c1
-rw-r--r--drivers/char/rio/rioctrl.c1
-rw-r--r--drivers/char/rio/rioinit.c1
-rw-r--r--drivers/char/rio/riointr.c1
-rw-r--r--drivers/char/rio/rioparam.c1
-rw-r--r--drivers/char/rio/rioroute.c1
-rw-r--r--drivers/char/rio/riotable.c5
-rw-r--r--drivers/char/rio/riotty.c5
-rw-r--r--drivers/char/snsc.h2
-rw-r--r--drivers/char/sonypi.c2
-rw-r--r--drivers/char/specialix.c10
-rw-r--r--drivers/char/stallion.c2
-rw-r--r--drivers/char/synclink.c21
-rw-r--r--drivers/char/synclink_gt.c13
-rw-r--r--drivers/char/synclinkmp.c22
-rw-r--r--drivers/char/tpm/tpm_tis.c2
-rw-r--r--drivers/char/tty_io.c47
-rw-r--r--drivers/char/xilinx_hwicap/buffer_icap.c22
-rw-r--r--drivers/char/xilinx_hwicap/buffer_icap.h5
-rw-r--r--drivers/char/xilinx_hwicap/fifo_icap.c31
-rw-r--r--drivers/char/xilinx_hwicap/fifo_icap.h1
-rw-r--r--drivers/char/xilinx_hwicap/xilinx_hwicap.c63
-rw-r--r--drivers/char/xilinx_hwicap/xilinx_hwicap.h24
38 files changed, 444 insertions, 201 deletions
diff --git a/drivers/char/Kconfig b/drivers/char/Kconfig
index 47c6be84fc84..2906ee7bd298 100644
--- a/drivers/char/Kconfig
+++ b/drivers/char/Kconfig
@@ -481,6 +481,34 @@ config BRIQ_PANEL
481 481
482 It's safe to say N here. 482 It's safe to say N here.
483 483
484config BFIN_OTP
485 tristate "Blackfin On-Chip OTP Memory Support"
486 depends on BLACKFIN && (BF52x || BF54x)
487 default y
488 help
489 If you say Y here, you will get support for a character device
490 interface into the One Time Programmable memory pages that are
491 stored on the Blackfin processor. This will not get you access
492 to the secure memory pages however. You will need to write your
493 own secure code and reader for that.
494
495 To compile this driver as a module, choose M here: the module
496 will be called bfin-otp.
497
498 If unsure, it is safe to say Y.
499
500config BFIN_OTP_WRITE_ENABLE
501 bool "Enable writing support of OTP pages"
502 depends on BFIN_OTP
503 default n
504 help
505 If you say Y here, you will enable support for writing of the
506 OTP pages. This is dangerous by nature as you can only program
507 the pages once, so only enable this option when you actually
508 need it so as to not inadvertently clobber data.
509
510 If unsure, say N.
511
484config PRINTER 512config PRINTER
485 tristate "Parallel printer support" 513 tristate "Parallel printer support"
486 depends on PARPORT 514 depends on PARPORT
@@ -706,7 +734,7 @@ config NVRAM
706 734
707config RTC 735config RTC
708 tristate "Enhanced Real Time Clock Support" 736 tristate "Enhanced Real Time Clock Support"
709 depends on !PPC && !PARISC && !IA64 && !M68K && !SPARC && !FRV && !ARM && !SUPERH && !S390 737 depends on !PPC && !PARISC && !IA64 && !M68K && !SPARC && !FRV && !ARM && !SUPERH && !S390 && !AVR32
710 ---help--- 738 ---help---
711 If you say Y here and create a character special file /dev/rtc with 739 If you say Y here and create a character special file /dev/rtc with
712 major number 10 and minor number 135 using mknod ("man mknod"), you 740 major number 10 and minor number 135 using mknod ("man mknod"), you
@@ -776,7 +804,7 @@ config SGI_IP27_RTC
776 804
777config GEN_RTC 805config GEN_RTC
778 tristate "Generic /dev/rtc emulation" 806 tristate "Generic /dev/rtc emulation"
779 depends on RTC!=y && !IA64 && !ARM && !M32R && !MIPS && !SPARC && !FRV && !S390 && !SUPERH 807 depends on RTC!=y && !IA64 && !ARM && !M32R && !MIPS && !SPARC && !FRV && !S390 && !SUPERH && !AVR32
780 ---help--- 808 ---help---
781 If you say Y here and create a character special file /dev/rtc with 809 If you say Y here and create a character special file /dev/rtc with
782 major number 10 and minor number 135 using mknod ("man mknod"), you 810 major number 10 and minor number 135 using mknod ("man mknod"), you
diff --git a/drivers/char/Makefile b/drivers/char/Makefile
index 5407b7615614..4c1c584e9eb6 100644
--- a/drivers/char/Makefile
+++ b/drivers/char/Makefile
@@ -59,6 +59,7 @@ obj-$(CONFIG_VIOTAPE) += viotape.o
59obj-$(CONFIG_HVCS) += hvcs.o 59obj-$(CONFIG_HVCS) += hvcs.o
60obj-$(CONFIG_SGI_MBCS) += mbcs.o 60obj-$(CONFIG_SGI_MBCS) += mbcs.o
61obj-$(CONFIG_BRIQ_PANEL) += briq_panel.o 61obj-$(CONFIG_BRIQ_PANEL) += briq_panel.o
62obj-$(CONFIG_BFIN_OTP) += bfin-otp.o
62 63
63obj-$(CONFIG_PRINTER) += lp.o 64obj-$(CONFIG_PRINTER) += lp.o
64obj-$(CONFIG_TIPAR) += tipar.o 65obj-$(CONFIG_TIPAR) += tipar.o
diff --git a/drivers/char/bfin-otp.c b/drivers/char/bfin-otp.c
new file mode 100644
index 000000000000..0a01329451e4
--- /dev/null
+++ b/drivers/char/bfin-otp.c
@@ -0,0 +1,189 @@
1/*
2 * Blackfin On-Chip OTP Memory Interface
3 * Supports BF52x/BF54x
4 *
5 * Copyright 2007-2008 Analog Devices Inc.
6 *
7 * Enter bugs at http://blackfin.uclinux.org/
8 *
9 * Licensed under the GPL-2 or later.
10 */
11
12#include <linux/device.h>
13#include <linux/errno.h>
14#include <linux/fs.h>
15#include <linux/init.h>
16#include <linux/miscdevice.h>
17#include <linux/module.h>
18#include <linux/mutex.h>
19#include <linux/types.h>
20
21#include <asm/blackfin.h>
22#include <asm/uaccess.h>
23
24#define stamp(fmt, args...) pr_debug("%s:%i: " fmt "\n", __func__, __LINE__, ## args)
25#define stampit() stamp("here i am")
26#define pr_init(fmt, args...) ({ static const __initconst char __fmt[] = fmt; printk(__fmt, ## args); })
27
28#define DRIVER_NAME "bfin-otp"
29#define PFX DRIVER_NAME ": "
30
31static DEFINE_MUTEX(bfin_otp_lock);
32
33/* OTP Boot ROM functions */
34#define _BOOTROM_OTP_COMMAND 0xEF000018
35#define _BOOTROM_OTP_READ 0xEF00001A
36#define _BOOTROM_OTP_WRITE 0xEF00001C
37
38static u32 (* const otp_command)(u32 command, u32 value) = (void *)_BOOTROM_OTP_COMMAND;
39static u32 (* const otp_read)(u32 page, u32 flags, u64 *page_content) = (void *)_BOOTROM_OTP_READ;
40static u32 (* const otp_write)(u32 page, u32 flags, u64 *page_content) = (void *)_BOOTROM_OTP_WRITE;
41
42/* otp_command(): defines for "command" */
43#define OTP_INIT 0x00000001
44#define OTP_CLOSE 0x00000002
45
46/* otp_{read,write}(): defines for "flags" */
47#define OTP_LOWER_HALF 0x00000000 /* select upper/lower 64-bit half (bit 0) */
48#define OTP_UPPER_HALF 0x00000001
49#define OTP_NO_ECC 0x00000010 /* do not use ECC */
50#define OTP_LOCK 0x00000020 /* sets page protection bit for page */
51#define OTP_ACCESS_READ 0x00001000
52#define OTP_ACCESS_READWRITE 0x00002000
53
54/* Return values for all functions */
55#define OTP_SUCCESS 0x00000000
56#define OTP_MASTER_ERROR 0x001
57#define OTP_WRITE_ERROR 0x003
58#define OTP_READ_ERROR 0x005
59#define OTP_ACC_VIO_ERROR 0x009
60#define OTP_DATA_MULT_ERROR 0x011
61#define OTP_ECC_MULT_ERROR 0x021
62#define OTP_PREV_WR_ERROR 0x041
63#define OTP_DATA_SB_WARN 0x100
64#define OTP_ECC_SB_WARN 0x200
65
66/**
67 * bfin_otp_read - Read OTP pages
68 *
69 * All reads must be in half page chunks (half page == 64 bits).
70 */
71static ssize_t bfin_otp_read(struct file *file, char __user *buff, size_t count, loff_t *pos)
72{
73 ssize_t bytes_done;
74 u32 page, flags, ret;
75 u64 content;
76
77 stampit();
78
79 if (count % sizeof(u64))
80 return -EMSGSIZE;
81
82 if (mutex_lock_interruptible(&bfin_otp_lock))
83 return -ERESTARTSYS;
84
85 bytes_done = 0;
86 page = *pos / (sizeof(u64) * 2);
87 while (bytes_done < count) {
88 flags = (*pos % (sizeof(u64) * 2) ? OTP_UPPER_HALF : OTP_LOWER_HALF);
89 stamp("processing page %i (%s)", page, (flags == OTP_UPPER_HALF ? "upper" : "lower"));
90 ret = otp_read(page, flags, &content);
91 if (ret & OTP_MASTER_ERROR) {
92 bytes_done = -EIO;
93 break;
94 }
95 if (copy_to_user(buff + bytes_done, &content, sizeof(content))) {
96 bytes_done = -EFAULT;
97 break;
98 }
99 if (flags == OTP_UPPER_HALF)
100 ++page;
101 bytes_done += sizeof(content);
102 *pos += sizeof(content);
103 }
104
105 mutex_unlock(&bfin_otp_lock);
106
107 return bytes_done;
108}
109
110#ifdef CONFIG_BFIN_OTP_WRITE_ENABLE
111/**
112 * bfin_otp_write - Write OTP pages
113 *
114 * All writes must be in half page chunks (half page == 64 bits).
115 */
116static ssize_t bfin_otp_write(struct file *filp, const char __user *buff, size_t count, loff_t *pos)
117{
118 stampit();
119
120 if (count % sizeof(u64))
121 return -EMSGSIZE;
122
123 if (mutex_lock_interruptible(&bfin_otp_lock))
124 return -ERESTARTSYS;
125
126 /* need otp_init() documentation before this can be implemented */
127
128 mutex_unlock(&bfin_otp_lock);
129
130 return -EINVAL;
131}
132#else
133# define bfin_otp_write NULL
134#endif
135
136static struct file_operations bfin_otp_fops = {
137 .owner = THIS_MODULE,
138 .read = bfin_otp_read,
139 .write = bfin_otp_write,
140};
141
142static struct miscdevice bfin_otp_misc_device = {
143 .minor = MISC_DYNAMIC_MINOR,
144 .name = DRIVER_NAME,
145 .fops = &bfin_otp_fops,
146};
147
148/**
149 * bfin_otp_init - Initialize module
150 *
151 * Registers the device and notifier handler. Actual device
152 * initialization is handled by bfin_otp_open().
153 */
154static int __init bfin_otp_init(void)
155{
156 int ret;
157
158 stampit();
159
160 ret = misc_register(&bfin_otp_misc_device);
161 if (ret) {
162 pr_init(KERN_ERR PFX "unable to register a misc device\n");
163 return ret;
164 }
165
166 pr_init(KERN_INFO PFX "initialized\n");
167
168 return 0;
169}
170
171/**
172 * bfin_otp_exit - Deinitialize module
173 *
174 * Unregisters the device and notifier handler. Actual device
175 * deinitialization is handled by bfin_otp_close().
176 */
177static void __exit bfin_otp_exit(void)
178{
179 stampit();
180
181 misc_deregister(&bfin_otp_misc_device);
182}
183
184module_init(bfin_otp_init);
185module_exit(bfin_otp_exit);
186
187MODULE_AUTHOR("Mike Frysinger <vapier@gentoo.org>");
188MODULE_DESCRIPTION("Blackfin OTP Memory Interface");
189MODULE_LICENSE("GPL");
diff --git a/drivers/char/drm/drmP.h b/drivers/char/drm/drmP.h
index 8ea9dd1717a9..6540948d5176 100644
--- a/drivers/char/drm/drmP.h
+++ b/drivers/char/drm/drmP.h
@@ -640,7 +640,6 @@ struct drm_head {
640 struct drm_device *dev; 640 struct drm_device *dev;
641 struct proc_dir_entry *dev_root; /**< proc directory entry */ 641 struct proc_dir_entry *dev_root; /**< proc directory entry */
642 dev_t device; /**< Device number for mknod */ 642 dev_t device; /**< Device number for mknod */
643 struct class_device *dev_class;
644}; 643};
645 644
646/** 645/**
diff --git a/drivers/char/drm/i915_drv.h b/drivers/char/drm/i915_drv.h
index c10d128e34db..675d88bda066 100644
--- a/drivers/char/drm/i915_drv.h
+++ b/drivers/char/drm/i915_drv.h
@@ -1092,8 +1092,8 @@ extern int i915_wait_ring(struct drm_device * dev, int n, const char *caller);
1092#define IS_I915G(dev) ((dev)->pci_device == 0x2582 || (dev)->pci_device == 0x258a) 1092#define IS_I915G(dev) ((dev)->pci_device == 0x2582 || (dev)->pci_device == 0x258a)
1093#define IS_I915GM(dev) ((dev)->pci_device == 0x2592) 1093#define IS_I915GM(dev) ((dev)->pci_device == 0x2592)
1094#define IS_I945G(dev) ((dev)->pci_device == 0x2772) 1094#define IS_I945G(dev) ((dev)->pci_device == 0x2772)
1095#define IS_I945GM(dev) ((dev)->pci_device == 0x27A2) 1095#define IS_I945GM(dev) ((dev)->pci_device == 0x27A2 ||\
1096 1096 (dev)->pci_device == 0x27AE)
1097#define IS_I965G(dev) ((dev)->pci_device == 0x2972 || \ 1097#define IS_I965G(dev) ((dev)->pci_device == 0x2972 || \
1098 (dev)->pci_device == 0x2982 || \ 1098 (dev)->pci_device == 0x2982 || \
1099 (dev)->pci_device == 0x2992 || \ 1099 (dev)->pci_device == 0x2992 || \
diff --git a/drivers/char/generic_serial.c b/drivers/char/generic_serial.c
index 8facf3e25c49..7ed7da1d99cf 100644
--- a/drivers/char/generic_serial.c
+++ b/drivers/char/generic_serial.c
@@ -28,7 +28,6 @@
28#include <linux/interrupt.h> 28#include <linux/interrupt.h>
29#include <linux/tty_flip.h> 29#include <linux/tty_flip.h>
30#include <linux/delay.h> 30#include <linux/delay.h>
31#include <asm/semaphore.h>
32#include <asm/uaccess.h> 31#include <asm/uaccess.h>
33 32
34#define DEBUG 33#define DEBUG
diff --git a/drivers/char/hpet.c b/drivers/char/hpet.c
index 465ad35ed38f..1399971be689 100644
--- a/drivers/char/hpet.c
+++ b/drivers/char/hpet.c
@@ -731,14 +731,14 @@ static unsigned long hpet_calibrate(struct hpets *hpetp)
731 731
732int hpet_alloc(struct hpet_data *hdp) 732int hpet_alloc(struct hpet_data *hdp)
733{ 733{
734 u64 cap, mcfg, hpet_config; 734 u64 cap, mcfg;
735 struct hpet_dev *devp; 735 struct hpet_dev *devp;
736 u32 i, ntimer, irq; 736 u32 i, ntimer;
737 struct hpets *hpetp; 737 struct hpets *hpetp;
738 size_t siz; 738 size_t siz;
739 struct hpet __iomem *hpet; 739 struct hpet __iomem *hpet;
740 static struct hpets *last = NULL; 740 static struct hpets *last = NULL;
741 unsigned long period, irq_bitmap; 741 unsigned long period;
742 unsigned long long temp; 742 unsigned long long temp;
743 743
744 /* 744 /*
@@ -765,47 +765,11 @@ int hpet_alloc(struct hpet_data *hdp)
765 hpetp->hp_hpet_phys = hdp->hd_phys_address; 765 hpetp->hp_hpet_phys = hdp->hd_phys_address;
766 766
767 hpetp->hp_ntimer = hdp->hd_nirqs; 767 hpetp->hp_ntimer = hdp->hd_nirqs;
768 hpet = hpetp->hp_hpet;
769
770 /* Assign IRQs statically for legacy devices */
771 hpetp->hp_dev[0].hd_hdwirq = hdp->hd_irq[0];
772 hpetp->hp_dev[1].hd_hdwirq = hdp->hd_irq[1];
773
774 /* Assign IRQs dynamically for the others */
775 for (i = 2, devp = &hpetp->hp_dev[2]; i < hdp->hd_nirqs; i++, devp++) {
776 struct hpet_timer __iomem *timer;
777 768
778 timer = &hpet->hpet_timers[devp - hpetp->hp_dev]; 769 for (i = 0; i < hdp->hd_nirqs; i++)
770 hpetp->hp_dev[i].hd_hdwirq = hdp->hd_irq[i];
779 771
780 /* Check if there's already an IRQ assigned to the timer */ 772 hpet = hpetp->hp_hpet;
781 if (hdp->hd_irq[i]) {
782 hpetp->hp_dev[i].hd_hdwirq = hdp->hd_irq[i];
783 continue;
784 }
785
786 hpet_config = readq(&timer->hpet_config);
787 irq_bitmap = (hpet_config & Tn_INT_ROUTE_CAP_MASK)
788 >> Tn_INT_ROUTE_CAP_SHIFT;
789 if (!irq_bitmap)
790 irq = 0; /* No valid IRQ Assignable */
791 else {
792 irq = find_first_bit(&irq_bitmap, 32);
793 do {
794 hpet_config |= irq << Tn_INT_ROUTE_CNF_SHIFT;
795 writeq(hpet_config, &timer->hpet_config);
796
797 /*
798 * Verify whether we have written a valid
799 * IRQ number by reading it back again
800 */
801 hpet_config = readq(&timer->hpet_config);
802 if (irq == (hpet_config & Tn_INT_ROUTE_CNF_MASK)
803 >> Tn_INT_ROUTE_CNF_SHIFT)
804 break; /* Success */
805 } while ((irq = (find_next_bit(&irq_bitmap, 32, irq))));
806 }
807 hpetp->hp_dev[i].hd_hdwirq = irq;
808 }
809 773
810 cap = readq(&hpet->hpet_cap); 774 cap = readq(&hpet->hpet_cap);
811 775
@@ -836,8 +800,7 @@ int hpet_alloc(struct hpet_data *hdp)
836 hpetp->hp_which, hdp->hd_phys_address, 800 hpetp->hp_which, hdp->hd_phys_address,
837 hpetp->hp_ntimer > 1 ? "s" : ""); 801 hpetp->hp_ntimer > 1 ? "s" : "");
838 for (i = 0; i < hpetp->hp_ntimer; i++) 802 for (i = 0; i < hpetp->hp_ntimer; i++)
839 printk("%s %d", i > 0 ? "," : "", 803 printk("%s %d", i > 0 ? "," : "", hdp->hd_irq[i]);
840 hpetp->hp_dev[i].hd_hdwirq);
841 printk("\n"); 804 printk("\n");
842 805
843 printk(KERN_INFO "hpet%u: %u %d-bit timers, %Lu Hz\n", 806 printk(KERN_INFO "hpet%u: %u %d-bit timers, %Lu Hz\n",
diff --git a/drivers/char/hvc_beat.c b/drivers/char/hvc_beat.c
index e74bb949c289..91cdb35a9204 100644
--- a/drivers/char/hvc_beat.c
+++ b/drivers/char/hvc_beat.c
@@ -78,8 +78,8 @@ static int hvc_beat_put_chars(uint32_t vtermno, const char *buf, int cnt)
78 for (rest = cnt; rest > 0; rest -= nlen) { 78 for (rest = cnt; rest > 0; rest -= nlen) {
79 nlen = (rest > 16) ? 16 : rest; 79 nlen = (rest > 16) ? 16 : rest;
80 memcpy(kb, buf, nlen); 80 memcpy(kb, buf, nlen);
81 beat_put_term_char(vtermno, rest, kb[0], kb[1]); 81 beat_put_term_char(vtermno, nlen, kb[0], kb[1]);
82 rest -= nlen; 82 buf += nlen;
83 } 83 }
84 return cnt; 84 return cnt;
85} 85}
diff --git a/drivers/char/hw_random/core.c b/drivers/char/hw_random/core.c
index 84cdf9025737..662d60e44e9a 100644
--- a/drivers/char/hw_random/core.c
+++ b/drivers/char/hw_random/core.c
@@ -116,6 +116,10 @@ static ssize_t rng_dev_read(struct file *filp, char __user *buf,
116 err = -EAGAIN; 116 err = -EAGAIN;
117 if (!bytes_read && (filp->f_flags & O_NONBLOCK)) 117 if (!bytes_read && (filp->f_flags & O_NONBLOCK))
118 goto out; 118 goto out;
119 if (bytes_read < 0) {
120 err = bytes_read;
121 goto out;
122 }
119 123
120 err = -EFAULT; 124 err = -EFAULT;
121 while (bytes_read && size) { 125 while (bytes_read && size) {
@@ -234,11 +238,11 @@ static DEVICE_ATTR(rng_available, S_IRUGO,
234 NULL); 238 NULL);
235 239
236 240
237static void unregister_miscdev(bool suspended) 241static void unregister_miscdev(void)
238{ 242{
239 device_remove_file(rng_miscdev.this_device, &dev_attr_rng_available); 243 device_remove_file(rng_miscdev.this_device, &dev_attr_rng_available);
240 device_remove_file(rng_miscdev.this_device, &dev_attr_rng_current); 244 device_remove_file(rng_miscdev.this_device, &dev_attr_rng_current);
241 __misc_deregister(&rng_miscdev, suspended); 245 misc_deregister(&rng_miscdev);
242} 246}
243 247
244static int register_miscdev(void) 248static int register_miscdev(void)
@@ -313,7 +317,7 @@ out:
313} 317}
314EXPORT_SYMBOL_GPL(hwrng_register); 318EXPORT_SYMBOL_GPL(hwrng_register);
315 319
316void __hwrng_unregister(struct hwrng *rng, bool suspended) 320void hwrng_unregister(struct hwrng *rng)
317{ 321{
318 int err; 322 int err;
319 323
@@ -332,11 +336,11 @@ void __hwrng_unregister(struct hwrng *rng, bool suspended)
332 } 336 }
333 } 337 }
334 if (list_empty(&rng_list)) 338 if (list_empty(&rng_list))
335 unregister_miscdev(suspended); 339 unregister_miscdev();
336 340
337 mutex_unlock(&rng_mutex); 341 mutex_unlock(&rng_mutex);
338} 342}
339EXPORT_SYMBOL_GPL(__hwrng_unregister); 343EXPORT_SYMBOL_GPL(hwrng_unregister);
340 344
341 345
342MODULE_DESCRIPTION("H/W Random Number Generator (RNG) driver"); 346MODULE_DESCRIPTION("H/W Random Number Generator (RNG) driver");
diff --git a/drivers/char/hw_random/omap-rng.c b/drivers/char/hw_random/omap-rng.c
index 7e319951fa41..51738bdd834e 100644
--- a/drivers/char/hw_random/omap-rng.c
+++ b/drivers/char/hw_random/omap-rng.c
@@ -1,7 +1,5 @@
1/* 1/*
2 * drivers/char/hw_random/omap-rng.c 2 * omap-rng.c - RNG driver for TI OMAP CPU family
3 *
4 * RNG driver for TI OMAP CPU family
5 * 3 *
6 * Author: Deepak Saxena <dsaxena@plexity.net> 4 * Author: Deepak Saxena <dsaxena@plexity.net>
7 * 5 *
@@ -15,11 +13,6 @@
15 * This file is licensed under the terms of the GNU General Public 13 * This file is licensed under the terms of the GNU General Public
16 * License version 2. This program is licensed "as is" without any 14 * License version 2. This program is licensed "as is" without any
17 * warranty of any kind, whether express or implied. 15 * warranty of any kind, whether express or implied.
18 *
19 * TODO:
20 *
21 * - Make status updated be interrupt driven so we don't poll
22 *
23 */ 16 */
24 17
25#include <linux/module.h> 18#include <linux/module.h>
@@ -55,17 +48,16 @@ static void __iomem *rng_base;
55static struct clk *rng_ick; 48static struct clk *rng_ick;
56static struct platform_device *rng_dev; 49static struct platform_device *rng_dev;
57 50
58static u32 omap_rng_read_reg(int reg) 51static inline u32 omap_rng_read_reg(int reg)
59{ 52{
60 return __raw_readl(rng_base + reg); 53 return __raw_readl(rng_base + reg);
61} 54}
62 55
63static void omap_rng_write_reg(int reg, u32 val) 56static inline void omap_rng_write_reg(int reg, u32 val)
64{ 57{
65 __raw_writel(val, rng_base + reg); 58 __raw_writel(val, rng_base + reg);
66} 59}
67 60
68/* REVISIT: Does the status bit really work on 16xx? */
69static int omap_rng_data_present(struct hwrng *rng, int wait) 61static int omap_rng_data_present(struct hwrng *rng, int wait)
70{ 62{
71 int data, i; 63 int data, i;
@@ -74,6 +66,11 @@ static int omap_rng_data_present(struct hwrng *rng, int wait)
74 data = omap_rng_read_reg(RNG_STAT_REG) ? 0 : 1; 66 data = omap_rng_read_reg(RNG_STAT_REG) ? 0 : 1;
75 if (data || !wait) 67 if (data || !wait)
76 break; 68 break;
69 /* RNG produces data fast enough (2+ MBit/sec, even
70 * during "rngtest" loads, that these delays don't
71 * seem to trigger. We *could* use the RNG IRQ, but
72 * that'd be higher overhead ... so why bother?
73 */
77 udelay(10); 74 udelay(10);
78 } 75 }
79 return data; 76 return data;
@@ -101,7 +98,8 @@ static int __init omap_rng_probe(struct platform_device *pdev)
101 * A bit ugly, and it will never actually happen but there can 98 * A bit ugly, and it will never actually happen but there can
102 * be only one RNG and this catches any bork 99 * be only one RNG and this catches any bork
103 */ 100 */
104 BUG_ON(rng_dev); 101 if (rng_dev)
102 return -EBUSY;
105 103
106 if (cpu_is_omap24xx()) { 104 if (cpu_is_omap24xx()) {
107 rng_ick = clk_get(NULL, "rng_ick"); 105 rng_ick = clk_get(NULL, "rng_ick");
@@ -124,7 +122,7 @@ static int __init omap_rng_probe(struct platform_device *pdev)
124 return -EBUSY; 122 return -EBUSY;
125 123
126 dev_set_drvdata(&pdev->dev, mem); 124 dev_set_drvdata(&pdev->dev, mem);
127 rng_base = (u32 __iomem *)io_p2v(res->start); 125 rng_base = (u32 __force __iomem *)io_p2v(res->start);
128 126
129 ret = hwrng_register(&omap_rng_ops); 127 ret = hwrng_register(&omap_rng_ops);
130 if (ret) { 128 if (ret) {
@@ -182,6 +180,8 @@ static int omap_rng_resume(struct platform_device *pdev)
182 180
183#endif 181#endif
184 182
183/* work with hotplug and coldplug */
184MODULE_ALIAS("platform:omap_rng");
185 185
186static struct platform_driver omap_rng_driver = { 186static struct platform_driver omap_rng_driver = {
187 .driver = { 187 .driver = {
diff --git a/drivers/char/ip2/i2lib.c b/drivers/char/ip2/i2lib.c
index d6567b32fb5c..9c25320121ef 100644
--- a/drivers/char/ip2/i2lib.c
+++ b/drivers/char/ip2/i2lib.c
@@ -644,12 +644,12 @@ i2QueueCommands(int type, i2ChanStrPtr pCh, int timeout, int nCommands,
644 // Normal Expected path - We still hold LOCK 644 // Normal Expected path - We still hold LOCK
645 break; /* from for()- Enough room: goto proceed */ 645 break; /* from for()- Enough room: goto proceed */
646 } 646 }
647 } 647 ip2trace(CHANN, ITRC_QUEUE, 3, 1, totalsize);
648 648 WRITE_UNLOCK_IRQRESTORE(lock_var_p, flags);
649 ip2trace (CHANN, ITRC_QUEUE, 3, 1, totalsize ); 649 } else
650 ip2trace(CHANN, ITRC_QUEUE, 3, 1, totalsize);
650 651
651 // Prepare to wait for buffers to empty 652 /* Prepare to wait for buffers to empty */
652 WRITE_UNLOCK_IRQRESTORE(lock_var_p,flags);
653 serviceOutgoingFifo(pB); // Dump what we got 653 serviceOutgoingFifo(pB); // Dump what we got
654 654
655 if (timeout == 0) { 655 if (timeout == 0) {
@@ -1830,6 +1830,8 @@ i2StripFifo(i2eBordStrPtr pB)
1830 default: // Neither packet? should be impossible 1830 default: // Neither packet? should be impossible
1831 ip2trace (ITRC_NO_PORT, ITRC_SFIFO, 5, 1, 1831 ip2trace (ITRC_NO_PORT, ITRC_SFIFO, 5, 1,
1832 PTYPE_OF(pB->i2eLeadoffWord) ); 1832 PTYPE_OF(pB->i2eLeadoffWord) );
1833 WRITE_UNLOCK_IRQRESTORE(&pB->read_fifo_spinlock,
1834 bflags);
1833 1835
1834 break; 1836 break;
1835 } // End of switch on type of packets 1837 } // End of switch on type of packets
diff --git a/drivers/char/keyboard.c b/drivers/char/keyboard.c
index 45806d27579a..60b934adea65 100644
--- a/drivers/char/keyboard.c
+++ b/drivers/char/keyboard.c
@@ -1035,7 +1035,8 @@ DECLARE_TASKLET_DISABLED(keyboard_tasklet, kbd_bh, 0);
1035#if defined(CONFIG_X86) || defined(CONFIG_IA64) || defined(CONFIG_ALPHA) ||\ 1035#if defined(CONFIG_X86) || defined(CONFIG_IA64) || defined(CONFIG_ALPHA) ||\
1036 defined(CONFIG_MIPS) || defined(CONFIG_PPC) || defined(CONFIG_SPARC) ||\ 1036 defined(CONFIG_MIPS) || defined(CONFIG_PPC) || defined(CONFIG_SPARC) ||\
1037 defined(CONFIG_PARISC) || defined(CONFIG_SUPERH) ||\ 1037 defined(CONFIG_PARISC) || defined(CONFIG_SUPERH) ||\
1038 (defined(CONFIG_ARM) && defined(CONFIG_KEYBOARD_ATKBD) && !defined(CONFIG_ARCH_RPC)) 1038 (defined(CONFIG_ARM) && defined(CONFIG_KEYBOARD_ATKBD) && !defined(CONFIG_ARCH_RPC)) ||\
1039 defined(CONFIG_AVR32)
1039 1040
1040#define HW_RAW(dev) (test_bit(EV_MSC, dev->evbit) && test_bit(MSC_RAW, dev->mscbit) &&\ 1041#define HW_RAW(dev) (test_bit(EV_MSC, dev->evbit) && test_bit(MSC_RAW, dev->mscbit) &&\
1041 ((dev)->id.bustype == BUS_I8042) && ((dev)->id.vendor == 0x0001) && ((dev)->id.product == 0x0001)) 1042 ((dev)->id.bustype == BUS_I8042) && ((dev)->id.vendor == 0x0001) && ((dev)->id.product == 0x0001))
diff --git a/drivers/char/misc.c b/drivers/char/misc.c
index a39101feb2ed..4d058dadbfcc 100644
--- a/drivers/char/misc.c
+++ b/drivers/char/misc.c
@@ -232,9 +232,8 @@ int misc_register(struct miscdevice * misc)
232} 232}
233 233
234/** 234/**
235 * __misc_deregister - unregister a miscellaneous device 235 * misc_deregister - unregister a miscellaneous device
236 * @misc: device to unregister 236 * @misc: device to unregister
237 * @suspended: to be set if the function is used during suspend/resume
238 * 237 *
239 * Unregister a miscellaneous device that was previously 238 * Unregister a miscellaneous device that was previously
240 * successfully registered with misc_register(). Success 239 * successfully registered with misc_register(). Success
@@ -242,7 +241,7 @@ int misc_register(struct miscdevice * misc)
242 * indicates an error. 241 * indicates an error.
243 */ 242 */
244 243
245int __misc_deregister(struct miscdevice *misc, bool suspended) 244int misc_deregister(struct miscdevice *misc)
246{ 245{
247 int i = misc->minor; 246 int i = misc->minor;
248 247
@@ -251,11 +250,7 @@ int __misc_deregister(struct miscdevice *misc, bool suspended)
251 250
252 mutex_lock(&misc_mtx); 251 mutex_lock(&misc_mtx);
253 list_del(&misc->list); 252 list_del(&misc->list);
254 if (suspended) 253 device_destroy(misc_class, MKDEV(MISC_MAJOR, misc->minor));
255 destroy_suspended_device(misc_class,
256 MKDEV(MISC_MAJOR, misc->minor));
257 else
258 device_destroy(misc_class, MKDEV(MISC_MAJOR, misc->minor));
259 if (i < DYNAMIC_MINORS && i>0) { 254 if (i < DYNAMIC_MINORS && i>0) {
260 misc_minors[i>>3] &= ~(1 << (misc->minor & 7)); 255 misc_minors[i>>3] &= ~(1 << (misc->minor & 7));
261 } 256 }
@@ -264,7 +259,7 @@ int __misc_deregister(struct miscdevice *misc, bool suspended)
264} 259}
265 260
266EXPORT_SYMBOL(misc_register); 261EXPORT_SYMBOL(misc_register);
267EXPORT_SYMBOL(__misc_deregister); 262EXPORT_SYMBOL(misc_deregister);
268 263
269static int __init misc_init(void) 264static int __init misc_init(void)
270{ 265{
diff --git a/drivers/char/pcmcia/synclink_cs.c b/drivers/char/pcmcia/synclink_cs.c
index 279ff5005cec..4e84d233e5a2 100644
--- a/drivers/char/pcmcia/synclink_cs.c
+++ b/drivers/char/pcmcia/synclink_cs.c
@@ -1225,17 +1225,15 @@ static void ri_change(MGSLPC_INFO *info)
1225 * irq interrupt number that caused interrupt 1225 * irq interrupt number that caused interrupt
1226 * dev_id device ID supplied during interrupt registration 1226 * dev_id device ID supplied during interrupt registration
1227 */ 1227 */
1228static irqreturn_t mgslpc_isr(int irq, void *dev_id) 1228static irqreturn_t mgslpc_isr(int dummy, void *dev_id)
1229{ 1229{
1230 MGSLPC_INFO * info = (MGSLPC_INFO *)dev_id; 1230 MGSLPC_INFO *info = dev_id;
1231 unsigned short isr; 1231 unsigned short isr;
1232 unsigned char gis, pis; 1232 unsigned char gis, pis;
1233 int count=0; 1233 int count=0;
1234 1234
1235 if (debug_level >= DEBUG_LEVEL_ISR) 1235 if (debug_level >= DEBUG_LEVEL_ISR)
1236 printk("mgslpc_isr(%d) entry.\n", irq); 1236 printk("mgslpc_isr(%d) entry.\n", info->irq_level);
1237 if (!info)
1238 return IRQ_NONE;
1239 1237
1240 if (!(info->p_dev->_locked)) 1238 if (!(info->p_dev->_locked))
1241 return IRQ_HANDLED; 1239 return IRQ_HANDLED;
@@ -1327,7 +1325,7 @@ static irqreturn_t mgslpc_isr(int irq, void *dev_id)
1327 1325
1328 if (debug_level >= DEBUG_LEVEL_ISR) 1326 if (debug_level >= DEBUG_LEVEL_ISR)
1329 printk("%s(%d):mgslpc_isr(%d)exit.\n", 1327 printk("%s(%d):mgslpc_isr(%d)exit.\n",
1330 __FILE__,__LINE__,irq); 1328 __FILE__, __LINE__, info->irq_level);
1331 1329
1332 return IRQ_HANDLED; 1330 return IRQ_HANDLED;
1333} 1331}
diff --git a/drivers/char/rio/rioboot.c b/drivers/char/rio/rioboot.c
index eca2b95343e2..d956dd316005 100644
--- a/drivers/char/rio/rioboot.c
+++ b/drivers/char/rio/rioboot.c
@@ -35,7 +35,6 @@
35#include <linux/termios.h> 35#include <linux/termios.h>
36#include <linux/serial.h> 36#include <linux/serial.h>
37#include <linux/vmalloc.h> 37#include <linux/vmalloc.h>
38#include <asm/semaphore.h>
39#include <linux/generic_serial.h> 38#include <linux/generic_serial.h>
40#include <linux/errno.h> 39#include <linux/errno.h>
41#include <linux/interrupt.h> 40#include <linux/interrupt.h>
diff --git a/drivers/char/rio/riocmd.c b/drivers/char/rio/riocmd.c
index 7321d002c34f..bf36959fc121 100644
--- a/drivers/char/rio/riocmd.c
+++ b/drivers/char/rio/riocmd.c
@@ -41,7 +41,6 @@ static char *_riocmd_c_sccs_ = "@(#)riocmd.c 1.2";
41#include <asm/io.h> 41#include <asm/io.h>
42#include <asm/system.h> 42#include <asm/system.h>
43#include <asm/string.h> 43#include <asm/string.h>
44#include <asm/semaphore.h>
45#include <asm/uaccess.h> 44#include <asm/uaccess.h>
46 45
47#include <linux/termios.h> 46#include <linux/termios.h>
diff --git a/drivers/char/rio/rioctrl.c b/drivers/char/rio/rioctrl.c
index 7ce77619707c..d8eb2bcbe015 100644
--- a/drivers/char/rio/rioctrl.c
+++ b/drivers/char/rio/rioctrl.c
@@ -40,7 +40,6 @@ static char *_rioctrl_c_sccs_ = "@(#)rioctrl.c 1.3";
40#include <asm/io.h> 40#include <asm/io.h>
41#include <asm/system.h> 41#include <asm/system.h>
42#include <asm/string.h> 42#include <asm/string.h>
43#include <asm/semaphore.h>
44#include <asm/uaccess.h> 43#include <asm/uaccess.h>
45 44
46#include <linux/termios.h> 45#include <linux/termios.h>
diff --git a/drivers/char/rio/rioinit.c b/drivers/char/rio/rioinit.c
index 0794844369d6..add1718295ef 100644
--- a/drivers/char/rio/rioinit.c
+++ b/drivers/char/rio/rioinit.c
@@ -40,7 +40,6 @@ static char *_rioinit_c_sccs_ = "@(#)rioinit.c 1.3";
40#include <asm/io.h> 40#include <asm/io.h>
41#include <asm/system.h> 41#include <asm/system.h>
42#include <asm/string.h> 42#include <asm/string.h>
43#include <asm/semaphore.h>
44#include <asm/uaccess.h> 43#include <asm/uaccess.h>
45 44
46#include <linux/termios.h> 45#include <linux/termios.h>
diff --git a/drivers/char/rio/riointr.c b/drivers/char/rio/riointr.c
index ebc76342712c..4734e26e1ccd 100644
--- a/drivers/char/rio/riointr.c
+++ b/drivers/char/rio/riointr.c
@@ -42,7 +42,6 @@ static char *_riointr_c_sccs_ = "@(#)riointr.c 1.2";
42#include <asm/io.h> 42#include <asm/io.h>
43#include <asm/system.h> 43#include <asm/system.h>
44#include <asm/string.h> 44#include <asm/string.h>
45#include <asm/semaphore.h>
46#include <asm/uaccess.h> 45#include <asm/uaccess.h>
47 46
48#include <linux/termios.h> 47#include <linux/termios.h>
diff --git a/drivers/char/rio/rioparam.c b/drivers/char/rio/rioparam.c
index bb498d24adcc..da276ed57b3f 100644
--- a/drivers/char/rio/rioparam.c
+++ b/drivers/char/rio/rioparam.c
@@ -41,7 +41,6 @@ static char *_rioparam_c_sccs_ = "@(#)rioparam.c 1.3";
41#include <asm/io.h> 41#include <asm/io.h>
42#include <asm/system.h> 42#include <asm/system.h>
43#include <asm/string.h> 43#include <asm/string.h>
44#include <asm/semaphore.h>
45#include <asm/uaccess.h> 44#include <asm/uaccess.h>
46 45
47#include <linux/termios.h> 46#include <linux/termios.h>
diff --git a/drivers/char/rio/rioroute.c b/drivers/char/rio/rioroute.c
index a99f3d9d7d65..85091ff74d96 100644
--- a/drivers/char/rio/rioroute.c
+++ b/drivers/char/rio/rioroute.c
@@ -39,7 +39,6 @@ static char *_rioroute_c_sccs_ = "@(#)rioroute.c 1.3";
39#include <asm/io.h> 39#include <asm/io.h>
40#include <asm/system.h> 40#include <asm/system.h>
41#include <asm/string.h> 41#include <asm/string.h>
42#include <asm/semaphore.h>
43#include <asm/uaccess.h> 42#include <asm/uaccess.h>
44 43
45#include <linux/termios.h> 44#include <linux/termios.h>
diff --git a/drivers/char/rio/riotable.c b/drivers/char/rio/riotable.c
index 991119c9f473..2b24488e95f2 100644
--- a/drivers/char/rio/riotable.c
+++ b/drivers/char/rio/riotable.c
@@ -42,7 +42,6 @@ static char *_riotable_c_sccs_ = "@(#)riotable.c 1.2";
42#include <asm/io.h> 42#include <asm/io.h>
43#include <asm/system.h> 43#include <asm/system.h>
44#include <asm/string.h> 44#include <asm/string.h>
45#include <asm/semaphore.h>
46#include <asm/uaccess.h> 45#include <asm/uaccess.h>
47 46
48#include <linux/termios.h> 47#include <linux/termios.h>
@@ -425,8 +424,10 @@ int RIOApel(struct rio_info *p)
425 424
426 MapP = &p->RIOConnectTable[Next++]; 425 MapP = &p->RIOConnectTable[Next++];
427 MapP->HostUniqueNum = HostP->UniqueNum; 426 MapP->HostUniqueNum = HostP->UniqueNum;
428 if ((HostP->Flags & RUN_STATE) != RC_RUNNING) 427 if ((HostP->Flags & RUN_STATE) != RC_RUNNING) {
428 rio_spin_unlock_irqrestore(&HostP->HostLock, flags);
429 continue; 429 continue;
430 }
430 MapP->RtaUniqueNum = 0; 431 MapP->RtaUniqueNum = 0;
431 MapP->ID = 0; 432 MapP->ID = 0;
432 MapP->Flags = SLOT_IN_USE; 433 MapP->Flags = SLOT_IN_USE;
diff --git a/drivers/char/rio/riotty.c b/drivers/char/rio/riotty.c
index a4f0b1e3e7fa..1cb8580a161d 100644
--- a/drivers/char/rio/riotty.c
+++ b/drivers/char/rio/riotty.c
@@ -44,7 +44,6 @@ static char *_riotty_c_sccs_ = "@(#)riotty.c 1.3";
44#include <asm/io.h> 44#include <asm/io.h>
45#include <asm/system.h> 45#include <asm/system.h>
46#include <asm/string.h> 46#include <asm/string.h>
47#include <asm/semaphore.h>
48#include <asm/uaccess.h> 47#include <asm/uaccess.h>
49 48
50#include <linux/termios.h> 49#include <linux/termios.h>
@@ -319,6 +318,7 @@ int riotopen(struct tty_struct *tty, struct file *filp)
319 PortP->State |= RIO_WOPEN; 318 PortP->State |= RIO_WOPEN;
320 rio_spin_unlock_irqrestore(&PortP->portSem, flags); 319 rio_spin_unlock_irqrestore(&PortP->portSem, flags);
321 if (RIODelay(PortP, HUNDRED_MS) == RIO_FAIL) { 320 if (RIODelay(PortP, HUNDRED_MS) == RIO_FAIL) {
321 rio_spin_lock_irqsave(&PortP->portSem, flags);
322 /* 322 /*
323 ** ACTION: verify that this is a good thing 323 ** ACTION: verify that this is a good thing
324 ** to do here. -- ??? 324 ** to do here. -- ???
@@ -334,6 +334,7 @@ int riotopen(struct tty_struct *tty, struct file *filp)
334 func_exit(); 334 func_exit();
335 return -EINTR; 335 return -EINTR;
336 } 336 }
337 rio_spin_lock_irqsave(&PortP->portSem, flags);
337 } 338 }
338 PortP->State &= ~RIO_WOPEN; 339 PortP->State &= ~RIO_WOPEN;
339 } 340 }
@@ -493,6 +494,7 @@ int riotclose(void *ptr)
493 494
494 if (RIOShortCommand(p, PortP, CLOSE, 1, 0) == RIO_FAIL) { 495 if (RIOShortCommand(p, PortP, CLOSE, 1, 0) == RIO_FAIL) {
495 RIOPreemptiveCmd(p, PortP, FCLOSE); 496 RIOPreemptiveCmd(p, PortP, FCLOSE);
497 rio_spin_lock_irqsave(&PortP->portSem, flags);
496 goto close_end; 498 goto close_end;
497 } 499 }
498 500
@@ -508,6 +510,7 @@ int riotclose(void *ptr)
508 510
509 if (p->RIOHalted) { 511 if (p->RIOHalted) {
510 RIOClearUp(PortP); 512 RIOClearUp(PortP);
513 rio_spin_lock_irqsave(&PortP->portSem, flags);
511 goto close_end; 514 goto close_end;
512 } 515 }
513 if (RIODelay(PortP, HUNDRED_MS) == RIO_FAIL) { 516 if (RIODelay(PortP, HUNDRED_MS) == RIO_FAIL) {
diff --git a/drivers/char/snsc.h b/drivers/char/snsc.h
index 8a98169b60c1..4be62eda9fbc 100644
--- a/drivers/char/snsc.h
+++ b/drivers/char/snsc.h
@@ -22,8 +22,8 @@
22#include <linux/kobject.h> 22#include <linux/kobject.h>
23#include <linux/fs.h> 23#include <linux/fs.h>
24#include <linux/cdev.h> 24#include <linux/cdev.h>
25#include <linux/semaphore.h>
25#include <asm/sn/types.h> 26#include <asm/sn/types.h>
26#include <asm/semaphore.h>
27 27
28#define CHUNKSIZE 127 28#define CHUNKSIZE 127
29 29
diff --git a/drivers/char/sonypi.c b/drivers/char/sonypi.c
index 921c6d2bc8fc..c03ad164c39a 100644
--- a/drivers/char/sonypi.c
+++ b/drivers/char/sonypi.c
@@ -1147,7 +1147,7 @@ static int sonypi_acpi_remove(struct acpi_device *device, int type)
1147 return 0; 1147 return 0;
1148} 1148}
1149 1149
1150const static struct acpi_device_id sonypi_device_ids[] = { 1150static const struct acpi_device_id sonypi_device_ids[] = {
1151 {"SNY6001", 0}, 1151 {"SNY6001", 0},
1152 {"", 0}, 1152 {"", 0},
1153}; 1153};
diff --git a/drivers/char/specialix.c b/drivers/char/specialix.c
index 5ff83df67b44..4b5b5b78acb4 100644
--- a/drivers/char/specialix.c
+++ b/drivers/char/specialix.c
@@ -443,8 +443,7 @@ void missed_irq (unsigned long data)
443 spin_unlock_irqrestore(&bp->lock, flags); 443 spin_unlock_irqrestore(&bp->lock, flags);
444 if (irq) { 444 if (irq) {
445 printk (KERN_INFO "Missed interrupt... Calling int from timer. \n"); 445 printk (KERN_INFO "Missed interrupt... Calling int from timer. \n");
446 sx_interrupt (((struct specialix_board *)data)->irq, 446 sx_interrupt (-1, bp);
447 (void*)data);
448 } 447 }
449 mod_timer(&missed_irq_timer, jiffies + sx_poll); 448 mod_timer(&missed_irq_timer, jiffies + sx_poll);
450} 449}
@@ -862,23 +861,22 @@ static inline void sx_check_modem(struct specialix_board * bp)
862 861
863 862
864/* The main interrupt processing routine */ 863/* The main interrupt processing routine */
865static irqreturn_t sx_interrupt(int irq, void *dev_id) 864static irqreturn_t sx_interrupt(int dummy, void *dev_id)
866{ 865{
867 unsigned char status; 866 unsigned char status;
868 unsigned char ack; 867 unsigned char ack;
869 struct specialix_board *bp; 868 struct specialix_board *bp = dev_id;
870 unsigned long loop = 0; 869 unsigned long loop = 0;
871 int saved_reg; 870 int saved_reg;
872 unsigned long flags; 871 unsigned long flags;
873 872
874 func_enter(); 873 func_enter();
875 874
876 bp = dev_id;
877 spin_lock_irqsave(&bp->lock, flags); 875 spin_lock_irqsave(&bp->lock, flags);
878 876
879 dprintk (SX_DEBUG_FLOW, "enter %s port %d room: %ld\n", __FUNCTION__, port_No(sx_get_port(bp, "INT")), SERIAL_XMIT_SIZE - sx_get_port(bp, "ITN")->xmit_cnt - 1); 877 dprintk (SX_DEBUG_FLOW, "enter %s port %d room: %ld\n", __FUNCTION__, port_No(sx_get_port(bp, "INT")), SERIAL_XMIT_SIZE - sx_get_port(bp, "ITN")->xmit_cnt - 1);
880 if (!(bp->flags & SX_BOARD_ACTIVE)) { 878 if (!(bp->flags & SX_BOARD_ACTIVE)) {
881 dprintk (SX_DEBUG_IRQ, "sx: False interrupt. irq %d.\n", irq); 879 dprintk (SX_DEBUG_IRQ, "sx: False interrupt. irq %d.\n", bp->irq);
882 spin_unlock_irqrestore(&bp->lock, flags); 880 spin_unlock_irqrestore(&bp->lock, flags);
883 func_exit(); 881 func_exit();
884 return IRQ_NONE; 882 return IRQ_NONE;
diff --git a/drivers/char/stallion.c b/drivers/char/stallion.c
index feac54e32a12..874aaa08e956 100644
--- a/drivers/char/stallion.c
+++ b/drivers/char/stallion.c
@@ -1645,7 +1645,7 @@ static irqreturn_t stl_intr(int irq, void *dev_id)
1645{ 1645{
1646 struct stlbrd *brdp = dev_id; 1646 struct stlbrd *brdp = dev_id;
1647 1647
1648 pr_debug("stl_intr(brdp=%p,irq=%d)\n", brdp, irq); 1648 pr_debug("stl_intr(brdp=%p,irq=%d)\n", brdp, brdp->irq);
1649 1649
1650 return IRQ_RETVAL((* brdp->isr)(brdp)); 1650 return IRQ_RETVAL((* brdp->isr)(brdp));
1651} 1651}
diff --git a/drivers/char/synclink.c b/drivers/char/synclink.c
index ddc74d1f4f1b..a3237d48a584 100644
--- a/drivers/char/synclink.c
+++ b/drivers/char/synclink.c
@@ -1695,20 +1695,16 @@ static void mgsl_isr_transmit_dma( struct mgsl_struct *info )
1695 * 1695 *
1696 * Return Value: None 1696 * Return Value: None
1697 */ 1697 */
1698static irqreturn_t mgsl_interrupt(int irq, void *dev_id) 1698static irqreturn_t mgsl_interrupt(int dummy, void *dev_id)
1699{ 1699{
1700 struct mgsl_struct * info; 1700 struct mgsl_struct *info = dev_id;
1701 u16 UscVector; 1701 u16 UscVector;
1702 u16 DmaVector; 1702 u16 DmaVector;
1703 1703
1704 if ( debug_level >= DEBUG_LEVEL_ISR ) 1704 if ( debug_level >= DEBUG_LEVEL_ISR )
1705 printk("%s(%d):mgsl_interrupt(%d)entry.\n", 1705 printk(KERN_DEBUG "%s(%d):mgsl_interrupt(%d)entry.\n",
1706 __FILE__,__LINE__,irq); 1706 __FILE__, __LINE__, info->irq_level);
1707 1707
1708 info = (struct mgsl_struct *)dev_id;
1709 if (!info)
1710 return IRQ_NONE;
1711
1712 spin_lock(&info->irq_spinlock); 1708 spin_lock(&info->irq_spinlock);
1713 1709
1714 for(;;) { 1710 for(;;) {
@@ -1732,8 +1728,8 @@ static irqreturn_t mgsl_interrupt(int irq, void *dev_id)
1732 mgsl_isr_receive_dma(info); 1728 mgsl_isr_receive_dma(info);
1733 1729
1734 if ( info->isr_overflow ) { 1730 if ( info->isr_overflow ) {
1735 printk(KERN_ERR"%s(%d):%s isr overflow irq=%d\n", 1731 printk(KERN_ERR "%s(%d):%s isr overflow irq=%d\n",
1736 __FILE__,__LINE__,info->device_name, irq); 1732 __FILE__, __LINE__, info->device_name, info->irq_level);
1737 usc_DisableMasterIrqBit(info); 1733 usc_DisableMasterIrqBit(info);
1738 usc_DisableDmaInterrupts(info,DICR_MASTER); 1734 usc_DisableDmaInterrupts(info,DICR_MASTER);
1739 break; 1735 break;
@@ -1755,8 +1751,9 @@ static irqreturn_t mgsl_interrupt(int irq, void *dev_id)
1755 spin_unlock(&info->irq_spinlock); 1751 spin_unlock(&info->irq_spinlock);
1756 1752
1757 if ( debug_level >= DEBUG_LEVEL_ISR ) 1753 if ( debug_level >= DEBUG_LEVEL_ISR )
1758 printk("%s(%d):mgsl_interrupt(%d)exit.\n", 1754 printk(KERN_DEBUG "%s(%d):mgsl_interrupt(%d)exit.\n",
1759 __FILE__,__LINE__,irq); 1755 __FILE__, __LINE__, info->irq_level);
1756
1760 return IRQ_HANDLED; 1757 return IRQ_HANDLED;
1761} /* end of mgsl_interrupt() */ 1758} /* end of mgsl_interrupt() */
1762 1759
diff --git a/drivers/char/synclink_gt.c b/drivers/char/synclink_gt.c
index 1f954acf2bac..3c89266c8255 100644
--- a/drivers/char/synclink_gt.c
+++ b/drivers/char/synclink_gt.c
@@ -491,7 +491,6 @@ static void isr_serial(struct slgt_info *info);
491static void isr_rdma(struct slgt_info *info); 491static void isr_rdma(struct slgt_info *info);
492static void isr_txeom(struct slgt_info *info, unsigned short status); 492static void isr_txeom(struct slgt_info *info, unsigned short status);
493static void isr_tdma(struct slgt_info *info); 493static void isr_tdma(struct slgt_info *info);
494static irqreturn_t slgt_interrupt(int irq, void *dev_id);
495 494
496static int alloc_dma_bufs(struct slgt_info *info); 495static int alloc_dma_bufs(struct slgt_info *info);
497static void free_dma_bufs(struct slgt_info *info); 496static void free_dma_bufs(struct slgt_info *info);
@@ -2326,17 +2325,13 @@ static void isr_gpio(struct slgt_info *info, unsigned int changed, unsigned int
2326 * irq interrupt number 2325 * irq interrupt number
2327 * dev_id device ID supplied during interrupt registration 2326 * dev_id device ID supplied during interrupt registration
2328 */ 2327 */
2329static irqreturn_t slgt_interrupt(int irq, void *dev_id) 2328static irqreturn_t slgt_interrupt(int dummy, void *dev_id)
2330{ 2329{
2331 struct slgt_info *info; 2330 struct slgt_info *info = dev_id;
2332 unsigned int gsr; 2331 unsigned int gsr;
2333 unsigned int i; 2332 unsigned int i;
2334 2333
2335 DBGISR(("slgt_interrupt irq=%d entry\n", irq)); 2334 DBGISR(("slgt_interrupt irq=%d entry\n", info->irq_level));
2336
2337 info = dev_id;
2338 if (!info)
2339 return IRQ_NONE;
2340 2335
2341 spin_lock(&info->lock); 2336 spin_lock(&info->lock);
2342 2337
@@ -2385,7 +2380,7 @@ static irqreturn_t slgt_interrupt(int irq, void *dev_id)
2385 2380
2386 spin_unlock(&info->lock); 2381 spin_unlock(&info->lock);
2387 2382
2388 DBGISR(("slgt_interrupt irq=%d exit\n", irq)); 2383 DBGISR(("slgt_interrupt irq=%d exit\n", info->irq_level));
2389 return IRQ_HANDLED; 2384 return IRQ_HANDLED;
2390} 2385}
2391 2386
diff --git a/drivers/char/synclinkmp.c b/drivers/char/synclinkmp.c
index f3e7807f78d9..c96062ea72b4 100644
--- a/drivers/char/synclinkmp.c
+++ b/drivers/char/synclinkmp.c
@@ -2586,9 +2586,9 @@ void isr_io_pin( SLMP_INFO *info, u16 status )
2586 * dev_id device ID supplied during interrupt registration 2586 * dev_id device ID supplied during interrupt registration
2587 * regs interrupted processor context 2587 * regs interrupted processor context
2588 */ 2588 */
2589static irqreturn_t synclinkmp_interrupt(int irq, void *dev_id) 2589static irqreturn_t synclinkmp_interrupt(int dummy, void *dev_id)
2590{ 2590{
2591 SLMP_INFO * info; 2591 SLMP_INFO *info = dev_id;
2592 unsigned char status, status0, status1=0; 2592 unsigned char status, status0, status1=0;
2593 unsigned char dmastatus, dmastatus0, dmastatus1=0; 2593 unsigned char dmastatus, dmastatus0, dmastatus1=0;
2594 unsigned char timerstatus0, timerstatus1=0; 2594 unsigned char timerstatus0, timerstatus1=0;
@@ -2597,12 +2597,8 @@ static irqreturn_t synclinkmp_interrupt(int irq, void *dev_id)
2597 unsigned short tmp; 2597 unsigned short tmp;
2598 2598
2599 if ( debug_level >= DEBUG_LEVEL_ISR ) 2599 if ( debug_level >= DEBUG_LEVEL_ISR )
2600 printk("%s(%d): synclinkmp_interrupt(%d)entry.\n", 2600 printk(KERN_DEBUG "%s(%d): synclinkmp_interrupt(%d)entry.\n",
2601 __FILE__,__LINE__,irq); 2601 __FILE__, __LINE__, info->irq_level);
2602
2603 info = (SLMP_INFO *)dev_id;
2604 if (!info)
2605 return IRQ_NONE;
2606 2602
2607 spin_lock(&info->lock); 2603 spin_lock(&info->lock);
2608 2604
@@ -2615,9 +2611,9 @@ static irqreturn_t synclinkmp_interrupt(int irq, void *dev_id)
2615 timerstatus0 = read_reg(info, ISR2); 2611 timerstatus0 = read_reg(info, ISR2);
2616 2612
2617 if ( debug_level >= DEBUG_LEVEL_ISR ) 2613 if ( debug_level >= DEBUG_LEVEL_ISR )
2618 printk("%s(%d):%s status0=%02x, dmastatus0=%02x, timerstatus0=%02x\n", 2614 printk(KERN_DEBUG "%s(%d):%s status0=%02x, dmastatus0=%02x, timerstatus0=%02x\n",
2619 __FILE__,__LINE__,info->device_name, 2615 __FILE__, __LINE__, info->device_name,
2620 status0,dmastatus0,timerstatus0); 2616 status0, dmastatus0, timerstatus0);
2621 2617
2622 if (info->port_count == 4) { 2618 if (info->port_count == 4) {
2623 /* get status for SCA1 (ports 2-3) */ 2619 /* get status for SCA1 (ports 2-3) */
@@ -2702,8 +2698,8 @@ static irqreturn_t synclinkmp_interrupt(int irq, void *dev_id)
2702 spin_unlock(&info->lock); 2698 spin_unlock(&info->lock);
2703 2699
2704 if ( debug_level >= DEBUG_LEVEL_ISR ) 2700 if ( debug_level >= DEBUG_LEVEL_ISR )
2705 printk("%s(%d):synclinkmp_interrupt(%d)exit.\n", 2701 printk(KERN_DEBUG "%s(%d):synclinkmp_interrupt(%d)exit.\n",
2706 __FILE__,__LINE__,irq); 2702 __FILE__, __LINE__, info->irq_level);
2707 return IRQ_HANDLED; 2703 return IRQ_HANDLED;
2708} 2704}
2709 2705
diff --git a/drivers/char/tpm/tpm_tis.c b/drivers/char/tpm/tpm_tis.c
index 81503d94fecc..13a4bdd4e4d6 100644
--- a/drivers/char/tpm/tpm_tis.c
+++ b/drivers/char/tpm/tpm_tis.c
@@ -399,7 +399,7 @@ static irqreturn_t tis_int_probe(int irq, void *dev_id)
399 return IRQ_HANDLED; 399 return IRQ_HANDLED;
400} 400}
401 401
402static irqreturn_t tis_int_handler(int irq, void *dev_id) 402static irqreturn_t tis_int_handler(int dummy, void *dev_id)
403{ 403{
404 struct tpm_chip *chip = dev_id; 404 struct tpm_chip *chip = dev_id;
405 u32 interrupt; 405 u32 interrupt;
diff --git a/drivers/char/tty_io.c b/drivers/char/tty_io.c
index 613ec816ce60..4d3c7018f0c3 100644
--- a/drivers/char/tty_io.c
+++ b/drivers/char/tty_io.c
@@ -1155,6 +1155,48 @@ static struct tty_driver *get_tty_driver(dev_t device, int *index)
1155 return NULL; 1155 return NULL;
1156} 1156}
1157 1157
1158#ifdef CONFIG_CONSOLE_POLL
1159
1160/**
1161 * tty_find_polling_driver - find device of a polled tty
1162 * @name: name string to match
1163 * @line: pointer to resulting tty line nr
1164 *
1165 * This routine returns a tty driver structure, given a name
1166 * and the condition that the tty driver is capable of polled
1167 * operation.
1168 */
1169struct tty_driver *tty_find_polling_driver(char *name, int *line)
1170{
1171 struct tty_driver *p, *res = NULL;
1172 int tty_line = 0;
1173 char *str;
1174
1175 mutex_lock(&tty_mutex);
1176 /* Search through the tty devices to look for a match */
1177 list_for_each_entry(p, &tty_drivers, tty_drivers) {
1178 str = name + strlen(p->name);
1179 tty_line = simple_strtoul(str, &str, 10);
1180 if (*str == ',')
1181 str++;
1182 if (*str == '\0')
1183 str = 0;
1184
1185 if (tty_line >= 0 && tty_line <= p->num && p->poll_init &&
1186 !p->poll_init(p, tty_line, str)) {
1187
1188 res = p;
1189 *line = tty_line;
1190 break;
1191 }
1192 }
1193 mutex_unlock(&tty_mutex);
1194
1195 return res;
1196}
1197EXPORT_SYMBOL_GPL(tty_find_polling_driver);
1198#endif
1199
1158/** 1200/**
1159 * tty_check_change - check for POSIX terminal changes 1201 * tty_check_change - check for POSIX terminal changes
1160 * @tty: tty to check 1202 * @tty: tty to check
@@ -3850,6 +3892,11 @@ void tty_set_operations(struct tty_driver *driver,
3850 driver->write_proc = op->write_proc; 3892 driver->write_proc = op->write_proc;
3851 driver->tiocmget = op->tiocmget; 3893 driver->tiocmget = op->tiocmget;
3852 driver->tiocmset = op->tiocmset; 3894 driver->tiocmset = op->tiocmset;
3895#ifdef CONFIG_CONSOLE_POLL
3896 driver->poll_init = op->poll_init;
3897 driver->poll_get_char = op->poll_get_char;
3898 driver->poll_put_char = op->poll_put_char;
3899#endif
3853} 3900}
3854 3901
3855 3902
diff --git a/drivers/char/xilinx_hwicap/buffer_icap.c b/drivers/char/xilinx_hwicap/buffer_icap.c
index f577daedb630..aa7f7962a9a0 100644
--- a/drivers/char/xilinx_hwicap/buffer_icap.c
+++ b/drivers/char/xilinx_hwicap/buffer_icap.c
@@ -74,7 +74,7 @@
74 74
75/** 75/**
76 * buffer_icap_get_status - Get the contents of the status register. 76 * buffer_icap_get_status - Get the contents of the status register.
77 * @base_address: is the base address of the device 77 * @drvdata: a pointer to the drvdata.
78 * 78 *
79 * The status register contains the ICAP status and the done bit. 79 * The status register contains the ICAP status and the done bit.
80 * 80 *
@@ -88,9 +88,9 @@
88 * D1 - Always 1 88 * D1 - Always 1
89 * D0 - Done bit 89 * D0 - Done bit
90 **/ 90 **/
91static inline u32 buffer_icap_get_status(void __iomem *base_address) 91u32 buffer_icap_get_status(struct hwicap_drvdata *drvdata)
92{ 92{
93 return in_be32(base_address + XHI_STATUS_REG_OFFSET); 93 return in_be32(drvdata->base_address + XHI_STATUS_REG_OFFSET);
94} 94}
95 95
96/** 96/**
@@ -117,20 +117,8 @@ static inline u32 buffer_icap_get_bram(void __iomem *base_address,
117 **/ 117 **/
118static inline bool buffer_icap_busy(void __iomem *base_address) 118static inline bool buffer_icap_busy(void __iomem *base_address)
119{ 119{
120 return (buffer_icap_get_status(base_address) & 1) == XHI_NOT_FINISHED; 120 u32 status = in_be32(base_address + XHI_STATUS_REG_OFFSET);
121} 121 return (status & 1) == XHI_NOT_FINISHED;
122
123/**
124 * buffer_icap_busy - Return true if the icap device is not busy
125 * @base_address: is the base address of the device
126 *
127 * The queries the low order bit of the status register, which
128 * indicates whether the current configuration or readback operation
129 * has completed.
130 **/
131static inline bool buffer_icap_done(void __iomem *base_address)
132{
133 return (buffer_icap_get_status(base_address) & 1) == XHI_FINISHED;
134} 122}
135 123
136/** 124/**
diff --git a/drivers/char/xilinx_hwicap/buffer_icap.h b/drivers/char/xilinx_hwicap/buffer_icap.h
index 03184959fa00..c5b1840906b2 100644
--- a/drivers/char/xilinx_hwicap/buffer_icap.h
+++ b/drivers/char/xilinx_hwicap/buffer_icap.h
@@ -44,8 +44,6 @@
44#include <asm/io.h> 44#include <asm/io.h>
45#include "xilinx_hwicap.h" 45#include "xilinx_hwicap.h"
46 46
47void buffer_icap_reset(struct hwicap_drvdata *drvdata);
48
49/* Loads a partial bitstream from system memory. */ 47/* Loads a partial bitstream from system memory. */
50int buffer_icap_set_configuration(struct hwicap_drvdata *drvdata, u32 *data, 48int buffer_icap_set_configuration(struct hwicap_drvdata *drvdata, u32 *data,
51 u32 Size); 49 u32 Size);
@@ -54,4 +52,7 @@ int buffer_icap_set_configuration(struct hwicap_drvdata *drvdata, u32 *data,
54int buffer_icap_get_configuration(struct hwicap_drvdata *drvdata, u32 *data, 52int buffer_icap_get_configuration(struct hwicap_drvdata *drvdata, u32 *data,
55 u32 Size); 53 u32 Size);
56 54
55u32 buffer_icap_get_status(struct hwicap_drvdata *drvdata);
56void buffer_icap_reset(struct hwicap_drvdata *drvdata);
57
57#endif 58#endif
diff --git a/drivers/char/xilinx_hwicap/fifo_icap.c b/drivers/char/xilinx_hwicap/fifo_icap.c
index 6f45dbd47125..776b50528478 100644
--- a/drivers/char/xilinx_hwicap/fifo_icap.c
+++ b/drivers/char/xilinx_hwicap/fifo_icap.c
@@ -78,13 +78,6 @@
78#define XHI_CR_READ_MASK 0x00000002 /* Read from ICAP to FIFO */ 78#define XHI_CR_READ_MASK 0x00000002 /* Read from ICAP to FIFO */
79#define XHI_CR_WRITE_MASK 0x00000001 /* Write from FIFO to ICAP */ 79#define XHI_CR_WRITE_MASK 0x00000001 /* Write from FIFO to ICAP */
80 80
81/* Status Register (SR) */
82#define XHI_SR_CFGERR_N_MASK 0x00000100 /* Config Error Mask */
83#define XHI_SR_DALIGN_MASK 0x00000080 /* Data Alignment Mask */
84#define XHI_SR_RIP_MASK 0x00000040 /* Read back Mask */
85#define XHI_SR_IN_ABORT_N_MASK 0x00000020 /* Select Map Abort Mask */
86#define XHI_SR_DONE_MASK 0x00000001 /* Done bit Mask */
87
88 81
89#define XHI_WFO_MAX_VACANCY 1024 /* Max Write FIFO Vacancy, in words */ 82#define XHI_WFO_MAX_VACANCY 1024 /* Max Write FIFO Vacancy, in words */
90#define XHI_RFO_MAX_OCCUPANCY 256 /* Max Read FIFO Occupancy, in words */ 83#define XHI_RFO_MAX_OCCUPANCY 256 /* Max Read FIFO Occupancy, in words */
@@ -152,13 +145,35 @@ static inline void fifo_icap_start_readback(struct hwicap_drvdata *drvdata)
152} 145}
153 146
154/** 147/**
148 * fifo_icap_get_status - Get the contents of the status register.
149 * @drvdata: a pointer to the drvdata.
150 *
151 * The status register contains the ICAP status and the done bit.
152 *
153 * D8 - cfgerr
154 * D7 - dalign
155 * D6 - rip
156 * D5 - in_abort_l
157 * D4 - Always 1
158 * D3 - Always 1
159 * D2 - Always 1
160 * D1 - Always 1
161 * D0 - Done bit
162 **/
163u32 fifo_icap_get_status(struct hwicap_drvdata *drvdata)
164{
165 u32 status = in_be32(drvdata->base_address + XHI_SR_OFFSET);
166 dev_dbg(drvdata->dev, "Getting status = %x\n", status);
167 return status;
168}
169
170/**
155 * fifo_icap_busy - Return true if the ICAP is still processing a transaction. 171 * fifo_icap_busy - Return true if the ICAP is still processing a transaction.
156 * @drvdata: a pointer to the drvdata. 172 * @drvdata: a pointer to the drvdata.
157 **/ 173 **/
158static inline u32 fifo_icap_busy(struct hwicap_drvdata *drvdata) 174static inline u32 fifo_icap_busy(struct hwicap_drvdata *drvdata)
159{ 175{
160 u32 status = in_be32(drvdata->base_address + XHI_SR_OFFSET); 176 u32 status = in_be32(drvdata->base_address + XHI_SR_OFFSET);
161 dev_dbg(drvdata->dev, "Getting status = %x\n", status);
162 return (status & XHI_SR_DONE_MASK) ? 0 : 1; 177 return (status & XHI_SR_DONE_MASK) ? 0 : 1;
163} 178}
164 179
diff --git a/drivers/char/xilinx_hwicap/fifo_icap.h b/drivers/char/xilinx_hwicap/fifo_icap.h
index 4d3068dd0405..ffabd3ba2bd8 100644
--- a/drivers/char/xilinx_hwicap/fifo_icap.h
+++ b/drivers/char/xilinx_hwicap/fifo_icap.h
@@ -56,6 +56,7 @@ int fifo_icap_set_configuration(
56 u32 *FrameBuffer, 56 u32 *FrameBuffer,
57 u32 NumWords); 57 u32 NumWords);
58 58
59u32 fifo_icap_get_status(struct hwicap_drvdata *drvdata);
59void fifo_icap_reset(struct hwicap_drvdata *drvdata); 60void fifo_icap_reset(struct hwicap_drvdata *drvdata);
60void fifo_icap_flush_fifo(struct hwicap_drvdata *drvdata); 61void fifo_icap_flush_fifo(struct hwicap_drvdata *drvdata);
61 62
diff --git a/drivers/char/xilinx_hwicap/xilinx_hwicap.c b/drivers/char/xilinx_hwicap/xilinx_hwicap.c
index 2284fa2a5a57..016f90567a52 100644
--- a/drivers/char/xilinx_hwicap/xilinx_hwicap.c
+++ b/drivers/char/xilinx_hwicap/xilinx_hwicap.c
@@ -36,7 +36,7 @@
36 *****************************************************************************/ 36 *****************************************************************************/
37 37
38/* 38/*
39 * This is the code behind /dev/xilinx_icap -- it allows a user-space 39 * This is the code behind /dev/icap* -- it allows a user-space
40 * application to use the Xilinx ICAP subsystem. 40 * application to use the Xilinx ICAP subsystem.
41 * 41 *
42 * The following operations are possible: 42 * The following operations are possible:
@@ -67,7 +67,7 @@
67 * user-space application code that uses this device. The simplest 67 * user-space application code that uses this device. The simplest
68 * way to use this interface is simply: 68 * way to use this interface is simply:
69 * 69 *
70 * cp foo.bit /dev/xilinx_icap 70 * cp foo.bit /dev/icap0
71 * 71 *
72 * Note that unless foo.bit is an appropriately constructed partial 72 * Note that unless foo.bit is an appropriately constructed partial
73 * bitstream, this has a high likelyhood of overwriting the design 73 * bitstream, this has a high likelyhood of overwriting the design
@@ -105,18 +105,14 @@
105#include "buffer_icap.h" 105#include "buffer_icap.h"
106#include "fifo_icap.h" 106#include "fifo_icap.h"
107 107
108#define DRIVER_NAME "xilinx_icap" 108#define DRIVER_NAME "icap"
109 109
110#define HWICAP_REGS (0x10000) 110#define HWICAP_REGS (0x10000)
111 111
112/* dynamically allocate device number */ 112#define XHWICAP_MAJOR 259
113static int xhwicap_major; 113#define XHWICAP_MINOR 0
114static int xhwicap_minor;
115#define HWICAP_DEVICES 1 114#define HWICAP_DEVICES 1
116 115
117module_param(xhwicap_major, int, S_IRUGO);
118module_param(xhwicap_minor, int, S_IRUGO);
119
120/* An array, which is set to true when the device is registered. */ 116/* An array, which is set to true when the device is registered. */
121static bool probed_devices[HWICAP_DEVICES]; 117static bool probed_devices[HWICAP_DEVICES];
122static struct mutex icap_sem; 118static struct mutex icap_sem;
@@ -250,8 +246,26 @@ static int hwicap_get_configuration_register(struct hwicap_drvdata *drvdata,
250 * Create the data to be written to the ICAP. 246 * Create the data to be written to the ICAP.
251 */ 247 */
252 buffer[index++] = XHI_DUMMY_PACKET; 248 buffer[index++] = XHI_DUMMY_PACKET;
249 buffer[index++] = XHI_NOOP_PACKET;
253 buffer[index++] = XHI_SYNC_PACKET; 250 buffer[index++] = XHI_SYNC_PACKET;
254 buffer[index++] = XHI_NOOP_PACKET; 251 buffer[index++] = XHI_NOOP_PACKET;
252 buffer[index++] = XHI_NOOP_PACKET;
253
254 /*
255 * Write the data to the FIFO and initiate the transfer of data present
256 * in the FIFO to the ICAP device.
257 */
258 status = drvdata->config->set_configuration(drvdata,
259 &buffer[0], index);
260 if (status)
261 return status;
262
263 /* If the syncword was not found, then we need to start over. */
264 status = drvdata->config->get_status(drvdata);
265 if ((status & XHI_SR_DALIGN_MASK) != XHI_SR_DALIGN_MASK)
266 return -EIO;
267
268 index = 0;
255 buffer[index++] = hwicap_type_1_read(reg) | 1; 269 buffer[index++] = hwicap_type_1_read(reg) | 1;
256 buffer[index++] = XHI_NOOP_PACKET; 270 buffer[index++] = XHI_NOOP_PACKET;
257 buffer[index++] = XHI_NOOP_PACKET; 271 buffer[index++] = XHI_NOOP_PACKET;
@@ -587,7 +601,7 @@ static int __devinit hwicap_setup(struct device *dev, int id,
587 probed_devices[id] = 1; 601 probed_devices[id] = 1;
588 mutex_unlock(&icap_sem); 602 mutex_unlock(&icap_sem);
589 603
590 devt = MKDEV(xhwicap_major, xhwicap_minor + id); 604 devt = MKDEV(XHWICAP_MAJOR, XHWICAP_MINOR + id);
591 605
592 drvdata = kzalloc(sizeof(struct hwicap_drvdata), GFP_KERNEL); 606 drvdata = kzalloc(sizeof(struct hwicap_drvdata), GFP_KERNEL);
593 if (!drvdata) { 607 if (!drvdata) {
@@ -664,12 +678,14 @@ static int __devinit hwicap_setup(struct device *dev, int id,
664static struct hwicap_driver_config buffer_icap_config = { 678static struct hwicap_driver_config buffer_icap_config = {
665 .get_configuration = buffer_icap_get_configuration, 679 .get_configuration = buffer_icap_get_configuration,
666 .set_configuration = buffer_icap_set_configuration, 680 .set_configuration = buffer_icap_set_configuration,
681 .get_status = buffer_icap_get_status,
667 .reset = buffer_icap_reset, 682 .reset = buffer_icap_reset,
668}; 683};
669 684
670static struct hwicap_driver_config fifo_icap_config = { 685static struct hwicap_driver_config fifo_icap_config = {
671 .get_configuration = fifo_icap_get_configuration, 686 .get_configuration = fifo_icap_get_configuration,
672 .set_configuration = fifo_icap_set_configuration, 687 .set_configuration = fifo_icap_set_configuration,
688 .get_status = fifo_icap_get_status,
673 .reset = fifo_icap_reset, 689 .reset = fifo_icap_reset,
674}; 690};
675 691
@@ -690,7 +706,7 @@ static int __devexit hwicap_remove(struct device *dev)
690 dev_set_drvdata(dev, NULL); 706 dev_set_drvdata(dev, NULL);
691 707
692 mutex_lock(&icap_sem); 708 mutex_lock(&icap_sem);
693 probed_devices[MINOR(dev->devt)-xhwicap_minor] = 0; 709 probed_devices[MINOR(dev->devt)-XHWICAP_MINOR] = 0;
694 mutex_unlock(&icap_sem); 710 mutex_unlock(&icap_sem);
695 return 0; /* success */ 711 return 0; /* success */
696} 712}
@@ -830,23 +846,12 @@ static int __init hwicap_module_init(void)
830 icap_class = class_create(THIS_MODULE, "xilinx_config"); 846 icap_class = class_create(THIS_MODULE, "xilinx_config");
831 mutex_init(&icap_sem); 847 mutex_init(&icap_sem);
832 848
833 if (xhwicap_major) { 849 devt = MKDEV(XHWICAP_MAJOR, XHWICAP_MINOR);
834 devt = MKDEV(xhwicap_major, xhwicap_minor); 850 retval = register_chrdev_region(devt,
835 retval = register_chrdev_region( 851 HWICAP_DEVICES,
836 devt, 852 DRIVER_NAME);
837 HWICAP_DEVICES, 853 if (retval < 0)
838 DRIVER_NAME); 854 return retval;
839 if (retval < 0)
840 return retval;
841 } else {
842 retval = alloc_chrdev_region(&devt,
843 xhwicap_minor,
844 HWICAP_DEVICES,
845 DRIVER_NAME);
846 if (retval < 0)
847 return retval;
848 xhwicap_major = MAJOR(devt);
849 }
850 855
851 retval = platform_driver_register(&hwicap_platform_driver); 856 retval = platform_driver_register(&hwicap_platform_driver);
852 857
@@ -871,7 +876,7 @@ static int __init hwicap_module_init(void)
871 876
872static void __exit hwicap_module_cleanup(void) 877static void __exit hwicap_module_cleanup(void)
873{ 878{
874 dev_t devt = MKDEV(xhwicap_major, xhwicap_minor); 879 dev_t devt = MKDEV(XHWICAP_MAJOR, XHWICAP_MINOR);
875 880
876 class_destroy(icap_class); 881 class_destroy(icap_class);
877 882
diff --git a/drivers/char/xilinx_hwicap/xilinx_hwicap.h b/drivers/char/xilinx_hwicap/xilinx_hwicap.h
index 405fee7e189b..1f9c8b082dbe 100644
--- a/drivers/char/xilinx_hwicap/xilinx_hwicap.h
+++ b/drivers/char/xilinx_hwicap/xilinx_hwicap.h
@@ -65,10 +65,27 @@ struct hwicap_drvdata {
65}; 65};
66 66
67struct hwicap_driver_config { 67struct hwicap_driver_config {
68 /* Read configuration data given by size into the data buffer.
69 Return 0 if successful. */
68 int (*get_configuration)(struct hwicap_drvdata *drvdata, u32 *data, 70 int (*get_configuration)(struct hwicap_drvdata *drvdata, u32 *data,
69 u32 size); 71 u32 size);
72 /* Write configuration data given by size from the data buffer.
73 Return 0 if successful. */
70 int (*set_configuration)(struct hwicap_drvdata *drvdata, u32 *data, 74 int (*set_configuration)(struct hwicap_drvdata *drvdata, u32 *data,
71 u32 size); 75 u32 size);
76 /* Get the status register, bit pattern given by:
77 * D8 - 0 = configuration error
78 * D7 - 1 = alignment found
79 * D6 - 1 = readback in progress
80 * D5 - 0 = abort in progress
81 * D4 - Always 1
82 * D3 - Always 1
83 * D2 - Always 1
84 * D1 - Always 1
85 * D0 - 1 = operation completed
86 */
87 u32 (*get_status)(struct hwicap_drvdata *drvdata);
88 /* Reset the hw */
72 void (*reset)(struct hwicap_drvdata *drvdata); 89 void (*reset)(struct hwicap_drvdata *drvdata);
73}; 90};
74 91
@@ -163,6 +180,13 @@ struct config_registers {
163/* Constant to use for CRC check when CRC has been disabled */ 180/* Constant to use for CRC check when CRC has been disabled */
164#define XHI_DISABLED_AUTO_CRC 0x0000DEFCUL 181#define XHI_DISABLED_AUTO_CRC 0x0000DEFCUL
165 182
183/* Meanings of the bits returned by get_status */
184#define XHI_SR_CFGERR_N_MASK 0x00000100 /* Config Error Mask */
185#define XHI_SR_DALIGN_MASK 0x00000080 /* Data Alignment Mask */
186#define XHI_SR_RIP_MASK 0x00000040 /* Read back Mask */
187#define XHI_SR_IN_ABORT_N_MASK 0x00000020 /* Select Map Abort Mask */
188#define XHI_SR_DONE_MASK 0x00000001 /* Done bit Mask */
189
166/** 190/**
167 * hwicap_type_1_read - Generates a Type 1 read packet header. 191 * hwicap_type_1_read - Generates a Type 1 read packet header.
168 * @reg: is the address of the register to be read back. 192 * @reg: is the address of the register to be read back.