diff options
author | Ralf Baechle <ralf@linux-mips.org> | 2009-12-16 20:57:35 -0500 |
---|---|---|
committer | Ralf Baechle <ralf@linux-mips.org> | 2009-12-16 20:57:35 -0500 |
commit | de4148f3ef54b644a181ad75a6fb4b373f2b01f0 (patch) | |
tree | 83aa287fbbcc14a3df9e161af99af49776b61b6f /drivers | |
parent | c3d8d85019c9e4f6e4f23d194b6432a2c2464372 (diff) |
MIPS: eXcite: Remove platform.
The platform has never been fully merged
Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
Cc: Thomas Koeller <thomas.koeller@baslerweb.com>
Cc: David Woodhouse <dwmw2@infradead.org>
Cc: Wim Van Sebroeck <wim@iguana.be>
Cc: linux-kernel@vger.kernel.org
Cc: linux-mtd@lists.infradead.org
Acked-by: David Woodhouse <David.Woodhouse@intel.com>
Acked-by: Wim Van Sebroeck <wim@iguana.be>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/mtd/nand/Kconfig | 8 | ||||
-rw-r--r-- | drivers/mtd/nand/Makefile | 1 | ||||
-rw-r--r-- | drivers/mtd/nand/excite_nandflash.c | 248 | ||||
-rw-r--r-- | drivers/watchdog/Kconfig | 10 | ||||
-rw-r--r-- | drivers/watchdog/Makefile | 1 | ||||
-rw-r--r-- | drivers/watchdog/rm9k_wdt.c | 419 |
6 files changed, 0 insertions, 687 deletions
diff --git a/drivers/mtd/nand/Kconfig b/drivers/mtd/nand/Kconfig index 7678538344f4..677cd53f18c3 100644 --- a/drivers/mtd/nand/Kconfig +++ b/drivers/mtd/nand/Kconfig | |||
@@ -291,14 +291,6 @@ config MTD_NAND_SHARPSL | |||
291 | tristate "Support for NAND Flash on Sharp SL Series (C7xx + others)" | 291 | tristate "Support for NAND Flash on Sharp SL Series (C7xx + others)" |
292 | depends on ARCH_PXA | 292 | depends on ARCH_PXA |
293 | 293 | ||
294 | config MTD_NAND_BASLER_EXCITE | ||
295 | tristate "Support for NAND Flash on Basler eXcite" | ||
296 | depends on BASLER_EXCITE | ||
297 | help | ||
298 | This enables the driver for the NAND flash device found on the | ||
299 | Basler eXcite Smart Camera. If built as a module, the driver | ||
300 | will be named excite_nandflash. | ||
301 | |||
302 | config MTD_NAND_CAFE | 294 | config MTD_NAND_CAFE |
303 | tristate "NAND support for OLPC CAFÉ chip" | 295 | tristate "NAND support for OLPC CAFÉ chip" |
304 | depends on PCI | 296 | depends on PCI |
diff --git a/drivers/mtd/nand/Makefile b/drivers/mtd/nand/Makefile index 460a1f39a8d1..1407bd144015 100644 --- a/drivers/mtd/nand/Makefile +++ b/drivers/mtd/nand/Makefile | |||
@@ -27,7 +27,6 @@ obj-$(CONFIG_MTD_NAND_ATMEL) += atmel_nand.o | |||
27 | obj-$(CONFIG_MTD_NAND_GPIO) += gpio.o | 27 | obj-$(CONFIG_MTD_NAND_GPIO) += gpio.o |
28 | obj-$(CONFIG_MTD_NAND_OMAP2) += omap2.o | 28 | obj-$(CONFIG_MTD_NAND_OMAP2) += omap2.o |
29 | obj-$(CONFIG_MTD_NAND_CM_X270) += cmx270_nand.o | 29 | obj-$(CONFIG_MTD_NAND_CM_X270) += cmx270_nand.o |
30 | obj-$(CONFIG_MTD_NAND_BASLER_EXCITE) += excite_nandflash.o | ||
31 | obj-$(CONFIG_MTD_NAND_PXA3xx) += pxa3xx_nand.o | 30 | obj-$(CONFIG_MTD_NAND_PXA3xx) += pxa3xx_nand.o |
32 | obj-$(CONFIG_MTD_NAND_TMIO) += tmio_nand.o | 31 | obj-$(CONFIG_MTD_NAND_TMIO) += tmio_nand.o |
33 | obj-$(CONFIG_MTD_NAND_PLATFORM) += plat_nand.o | 32 | obj-$(CONFIG_MTD_NAND_PLATFORM) += plat_nand.o |
diff --git a/drivers/mtd/nand/excite_nandflash.c b/drivers/mtd/nand/excite_nandflash.c deleted file mode 100644 index af6a6a5399e1..000000000000 --- a/drivers/mtd/nand/excite_nandflash.c +++ /dev/null | |||
@@ -1,248 +0,0 @@ | |||
1 | /* | ||
2 | * Copyright (C) 2005 - 2007 by Basler Vision Technologies AG | ||
3 | * Author: Thomas Koeller <thomas.koeller.qbaslerweb.com> | ||
4 | * Original code by Thies Moeller <thies.moeller@baslerweb.com> | ||
5 | * | ||
6 | * This program is free software; you can redistribute it and/or modify | ||
7 | * it under the terms of the GNU General Public License as published by | ||
8 | * the Free Software Foundation; either version 2 of the License, or | ||
9 | * (at your option) any later version. | ||
10 | * | ||
11 | * This program is distributed in the hope that it will be useful, | ||
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
14 | * GNU General Public License for more details. | ||
15 | * | ||
16 | * You should have received a copy of the GNU General Public License | ||
17 | * along with this program; if not, write to the Free Software | ||
18 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | ||
19 | */ | ||
20 | |||
21 | #include <linux/module.h> | ||
22 | #include <linux/types.h> | ||
23 | #include <linux/init.h> | ||
24 | #include <linux/kernel.h> | ||
25 | #include <linux/string.h> | ||
26 | #include <linux/ioport.h> | ||
27 | #include <linux/platform_device.h> | ||
28 | #include <linux/delay.h> | ||
29 | #include <linux/err.h> | ||
30 | |||
31 | #include <linux/mtd/mtd.h> | ||
32 | #include <linux/mtd/nand.h> | ||
33 | #include <linux/mtd/nand_ecc.h> | ||
34 | #include <linux/mtd/partitions.h> | ||
35 | |||
36 | #include <asm/io.h> | ||
37 | #include <asm/rm9k-ocd.h> | ||
38 | |||
39 | #include <excite_nandflash.h> | ||
40 | |||
41 | #define EXCITE_NANDFLASH_VERSION "0.1" | ||
42 | |||
43 | /* I/O register offsets */ | ||
44 | #define EXCITE_NANDFLASH_DATA_BYTE 0x00 | ||
45 | #define EXCITE_NANDFLASH_STATUS_BYTE 0x0c | ||
46 | #define EXCITE_NANDFLASH_ADDR_BYTE 0x10 | ||
47 | #define EXCITE_NANDFLASH_CMD_BYTE 0x14 | ||
48 | |||
49 | /* prefix for debug output */ | ||
50 | static const char module_id[] = "excite_nandflash"; | ||
51 | |||
52 | /* | ||
53 | * partition definition | ||
54 | */ | ||
55 | static const struct mtd_partition partition_info[] = { | ||
56 | { | ||
57 | .name = "eXcite RootFS", | ||
58 | .offset = 0, | ||
59 | .size = MTDPART_SIZ_FULL | ||
60 | } | ||
61 | }; | ||
62 | |||
63 | static inline const struct resource * | ||
64 | excite_nand_get_resource(struct platform_device *d, unsigned long flags, | ||
65 | const char *basename) | ||
66 | { | ||
67 | char buf[80]; | ||
68 | |||
69 | if (snprintf(buf, sizeof buf, "%s_%u", basename, d->id) >= sizeof buf) | ||
70 | return NULL; | ||
71 | return platform_get_resource_byname(d, flags, buf); | ||
72 | } | ||
73 | |||
74 | static inline void __iomem * | ||
75 | excite_nand_map_regs(struct platform_device *d, const char *basename) | ||
76 | { | ||
77 | void *result = NULL; | ||
78 | const struct resource *const r = | ||
79 | excite_nand_get_resource(d, IORESOURCE_MEM, basename); | ||
80 | |||
81 | if (r) | ||
82 | result = ioremap_nocache(r->start, r->end + 1 - r->start); | ||
83 | return result; | ||
84 | } | ||
85 | |||
86 | /* controller and mtd information */ | ||
87 | struct excite_nand_drvdata { | ||
88 | struct mtd_info board_mtd; | ||
89 | struct nand_chip board_chip; | ||
90 | void __iomem *regs; | ||
91 | void __iomem *tgt; | ||
92 | }; | ||
93 | |||
94 | /* Control function */ | ||
95 | static void excite_nand_control(struct mtd_info *mtd, int cmd, | ||
96 | unsigned int ctrl) | ||
97 | { | ||
98 | struct excite_nand_drvdata * const d = | ||
99 | container_of(mtd, struct excite_nand_drvdata, board_mtd); | ||
100 | |||
101 | switch (ctrl) { | ||
102 | case NAND_CTRL_CHANGE | NAND_CTRL_CLE: | ||
103 | d->tgt = d->regs + EXCITE_NANDFLASH_CMD_BYTE; | ||
104 | break; | ||
105 | case NAND_CTRL_CHANGE | NAND_CTRL_ALE: | ||
106 | d->tgt = d->regs + EXCITE_NANDFLASH_ADDR_BYTE; | ||
107 | break; | ||
108 | case NAND_CTRL_CHANGE | NAND_NCE: | ||
109 | d->tgt = d->regs + EXCITE_NANDFLASH_DATA_BYTE; | ||
110 | break; | ||
111 | } | ||
112 | |||
113 | if (cmd != NAND_CMD_NONE) | ||
114 | __raw_writeb(cmd, d->tgt); | ||
115 | } | ||
116 | |||
117 | /* Return 0 if flash is busy, 1 if ready */ | ||
118 | static int excite_nand_devready(struct mtd_info *mtd) | ||
119 | { | ||
120 | struct excite_nand_drvdata * const drvdata = | ||
121 | container_of(mtd, struct excite_nand_drvdata, board_mtd); | ||
122 | |||
123 | return __raw_readb(drvdata->regs + EXCITE_NANDFLASH_STATUS_BYTE); | ||
124 | } | ||
125 | |||
126 | /* | ||
127 | * Called by device layer to remove the driver. | ||
128 | * The binding to the mtd and all allocated | ||
129 | * resources are released. | ||
130 | */ | ||
131 | static int __devexit excite_nand_remove(struct platform_device *dev) | ||
132 | { | ||
133 | struct excite_nand_drvdata * const this = platform_get_drvdata(dev); | ||
134 | |||
135 | platform_set_drvdata(dev, NULL); | ||
136 | |||
137 | if (unlikely(!this)) { | ||
138 | printk(KERN_ERR "%s: called %s without private data!!", | ||
139 | module_id, __func__); | ||
140 | return -EINVAL; | ||
141 | } | ||
142 | |||
143 | /* first thing we need to do is release our mtd | ||
144 | * then go through freeing the resource used | ||
145 | */ | ||
146 | nand_release(&this->board_mtd); | ||
147 | |||
148 | /* free the common resources */ | ||
149 | iounmap(this->regs); | ||
150 | kfree(this); | ||
151 | |||
152 | DEBUG(MTD_DEBUG_LEVEL1, "%s: removed\n", module_id); | ||
153 | return 0; | ||
154 | } | ||
155 | |||
156 | /* | ||
157 | * Called by device layer when it finds a device matching | ||
158 | * one our driver can handle. This code checks to see if | ||
159 | * it can allocate all necessary resources then calls the | ||
160 | * nand layer to look for devices. | ||
161 | */ | ||
162 | static int __init excite_nand_probe(struct platform_device *pdev) | ||
163 | { | ||
164 | struct excite_nand_drvdata *drvdata; /* private driver data */ | ||
165 | struct nand_chip *board_chip; /* private flash chip data */ | ||
166 | struct mtd_info *board_mtd; /* mtd info for this board */ | ||
167 | int scan_res; | ||
168 | |||
169 | drvdata = kzalloc(sizeof(*drvdata), GFP_KERNEL); | ||
170 | if (unlikely(!drvdata)) { | ||
171 | printk(KERN_ERR "%s: no memory for drvdata\n", | ||
172 | module_id); | ||
173 | return -ENOMEM; | ||
174 | } | ||
175 | |||
176 | /* bind private data into driver */ | ||
177 | platform_set_drvdata(pdev, drvdata); | ||
178 | |||
179 | /* allocate and map the resource */ | ||
180 | drvdata->regs = | ||
181 | excite_nand_map_regs(pdev, EXCITE_NANDFLASH_RESOURCE_REGS); | ||
182 | |||
183 | if (unlikely(!drvdata->regs)) { | ||
184 | printk(KERN_ERR "%s: cannot reserve register region\n", | ||
185 | module_id); | ||
186 | kfree(drvdata); | ||
187 | return -ENXIO; | ||
188 | } | ||
189 | |||
190 | drvdata->tgt = drvdata->regs + EXCITE_NANDFLASH_DATA_BYTE; | ||
191 | |||
192 | /* initialise our chip */ | ||
193 | board_chip = &drvdata->board_chip; | ||
194 | board_chip->IO_ADDR_R = board_chip->IO_ADDR_W = | ||
195 | drvdata->regs + EXCITE_NANDFLASH_DATA_BYTE; | ||
196 | board_chip->cmd_ctrl = excite_nand_control; | ||
197 | board_chip->dev_ready = excite_nand_devready; | ||
198 | board_chip->chip_delay = 25; | ||
199 | board_chip->ecc.mode = NAND_ECC_SOFT; | ||
200 | |||
201 | /* link chip to mtd */ | ||
202 | board_mtd = &drvdata->board_mtd; | ||
203 | board_mtd->priv = board_chip; | ||
204 | |||
205 | DEBUG(MTD_DEBUG_LEVEL2, "%s: device scan\n", module_id); | ||
206 | scan_res = nand_scan(&drvdata->board_mtd, 1); | ||
207 | |||
208 | if (likely(!scan_res)) { | ||
209 | DEBUG(MTD_DEBUG_LEVEL2, "%s: register partitions\n", module_id); | ||
210 | add_mtd_partitions(&drvdata->board_mtd, partition_info, | ||
211 | ARRAY_SIZE(partition_info)); | ||
212 | } else { | ||
213 | iounmap(drvdata->regs); | ||
214 | kfree(drvdata); | ||
215 | printk(KERN_ERR "%s: device scan failed\n", module_id); | ||
216 | return -EIO; | ||
217 | } | ||
218 | return 0; | ||
219 | } | ||
220 | |||
221 | static struct platform_driver excite_nand_driver = { | ||
222 | .driver = { | ||
223 | .name = "excite_nand", | ||
224 | .owner = THIS_MODULE, | ||
225 | }, | ||
226 | .probe = excite_nand_probe, | ||
227 | .remove = __devexit_p(excite_nand_remove) | ||
228 | }; | ||
229 | |||
230 | static int __init excite_nand_init(void) | ||
231 | { | ||
232 | pr_info("Basler eXcite nand flash driver Version " | ||
233 | EXCITE_NANDFLASH_VERSION "\n"); | ||
234 | return platform_driver_register(&excite_nand_driver); | ||
235 | } | ||
236 | |||
237 | static void __exit excite_nand_exit(void) | ||
238 | { | ||
239 | platform_driver_unregister(&excite_nand_driver); | ||
240 | } | ||
241 | |||
242 | module_init(excite_nand_init); | ||
243 | module_exit(excite_nand_exit); | ||
244 | |||
245 | MODULE_AUTHOR("Thomas Koeller <thomas.koeller@baslerweb.com>"); | ||
246 | MODULE_DESCRIPTION("Basler eXcite NAND-Flash driver"); | ||
247 | MODULE_LICENSE("GPL"); | ||
248 | MODULE_VERSION(EXCITE_NANDFLASH_VERSION) | ||
diff --git a/drivers/watchdog/Kconfig b/drivers/watchdog/Kconfig index d958b76430a2..da84fd03850f 100644 --- a/drivers/watchdog/Kconfig +++ b/drivers/watchdog/Kconfig | |||
@@ -815,16 +815,6 @@ config PNX833X_WDT | |||
815 | timer has expired and no process has written to /dev/watchdog during | 815 | timer has expired and no process has written to /dev/watchdog during |
816 | that time. | 816 | that time. |
817 | 817 | ||
818 | config WDT_RM9K_GPI | ||
819 | tristate "RM9000/GPI hardware watchdog" | ||
820 | depends on CPU_RM9000 | ||
821 | help | ||
822 | Watchdog implementation using the GPI hardware found on | ||
823 | PMC-Sierra RM9xxx CPUs. | ||
824 | |||
825 | To compile this driver as a module, choose M here: the | ||
826 | module will be called rm9k_wdt. | ||
827 | |||
828 | config SIBYTE_WDOG | 818 | config SIBYTE_WDOG |
829 | tristate "Sibyte SoC hardware watchdog" | 819 | tristate "Sibyte SoC hardware watchdog" |
830 | depends on CPU_SB1 | 820 | depends on CPU_SB1 |
diff --git a/drivers/watchdog/Makefile b/drivers/watchdog/Makefile index 89c045dc468e..475c61100069 100644 --- a/drivers/watchdog/Makefile +++ b/drivers/watchdog/Makefile | |||
@@ -109,7 +109,6 @@ obj-$(CONFIG_RC32434_WDT) += rc32434_wdt.o | |||
109 | obj-$(CONFIG_INDYDOG) += indydog.o | 109 | obj-$(CONFIG_INDYDOG) += indydog.o |
110 | obj-$(CONFIG_WDT_MTX1) += mtx-1_wdt.o | 110 | obj-$(CONFIG_WDT_MTX1) += mtx-1_wdt.o |
111 | obj-$(CONFIG_PNX833X_WDT) += pnx833x_wdt.o | 111 | obj-$(CONFIG_PNX833X_WDT) += pnx833x_wdt.o |
112 | obj-$(CONFIG_WDT_RM9K_GPI) += rm9k_wdt.o | ||
113 | obj-$(CONFIG_SIBYTE_WDOG) += sb_wdog.o | 112 | obj-$(CONFIG_SIBYTE_WDOG) += sb_wdog.o |
114 | obj-$(CONFIG_AR7_WDT) += ar7_wdt.o | 113 | obj-$(CONFIG_AR7_WDT) += ar7_wdt.o |
115 | obj-$(CONFIG_TXX9_WDT) += txx9wdt.o | 114 | obj-$(CONFIG_TXX9_WDT) += txx9wdt.o |
diff --git a/drivers/watchdog/rm9k_wdt.c b/drivers/watchdog/rm9k_wdt.c deleted file mode 100644 index bb66958b9433..000000000000 --- a/drivers/watchdog/rm9k_wdt.c +++ /dev/null | |||
@@ -1,419 +0,0 @@ | |||
1 | /* | ||
2 | * Watchdog implementation for GPI h/w found on PMC-Sierra RM9xxx | ||
3 | * chips. | ||
4 | * | ||
5 | * Copyright (C) 2004 by Basler Vision Technologies AG | ||
6 | * Author: Thomas Koeller <thomas.koeller@baslerweb.com> | ||
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; either version 2 of the License, or | ||
11 | * (at your option) any later version. | ||
12 | * | ||
13 | * This program is distributed in the hope that it will be useful, | ||
14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
16 | * GNU General Public License for more details. | ||
17 | * | ||
18 | * You should have received a copy of the GNU General Public License | ||
19 | * along with this program; if not, write to the Free Software | ||
20 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | ||
21 | */ | ||
22 | |||
23 | #include <linux/platform_device.h> | ||
24 | #include <linux/module.h> | ||
25 | #include <linux/moduleparam.h> | ||
26 | #include <linux/interrupt.h> | ||
27 | #include <linux/fs.h> | ||
28 | #include <linux/reboot.h> | ||
29 | #include <linux/notifier.h> | ||
30 | #include <linux/miscdevice.h> | ||
31 | #include <linux/watchdog.h> | ||
32 | #include <linux/io.h> | ||
33 | #include <linux/uaccess.h> | ||
34 | #include <asm/atomic.h> | ||
35 | #include <asm/processor.h> | ||
36 | #include <asm/system.h> | ||
37 | #include <asm/rm9k-ocd.h> | ||
38 | |||
39 | #include <rm9k_wdt.h> | ||
40 | |||
41 | |||
42 | #define CLOCK 125000000 | ||
43 | #define MAX_TIMEOUT_SECONDS 32 | ||
44 | #define CPCCR 0x0080 | ||
45 | #define CPGIG1SR 0x0044 | ||
46 | #define CPGIG1ER 0x0054 | ||
47 | |||
48 | |||
49 | /* Function prototypes */ | ||
50 | static irqreturn_t wdt_gpi_irqhdl(int, void *); | ||
51 | static void wdt_gpi_start(void); | ||
52 | static void wdt_gpi_stop(void); | ||
53 | static void wdt_gpi_set_timeout(unsigned int); | ||
54 | static int wdt_gpi_open(struct inode *, struct file *); | ||
55 | static int wdt_gpi_release(struct inode *, struct file *); | ||
56 | static ssize_t wdt_gpi_write(struct file *, const char __user *, size_t, | ||
57 | loff_t *); | ||
58 | static long wdt_gpi_ioctl(struct file *, unsigned int, unsigned long); | ||
59 | static int wdt_gpi_notify(struct notifier_block *, unsigned long, void *); | ||
60 | static const struct resource *wdt_gpi_get_resource(struct platform_device *, | ||
61 | const char *, unsigned int); | ||
62 | static int __init wdt_gpi_probe(struct platform_device *); | ||
63 | static int __exit wdt_gpi_remove(struct platform_device *); | ||
64 | |||
65 | |||
66 | static const char wdt_gpi_name[] = "wdt_gpi"; | ||
67 | static atomic_t opencnt; | ||
68 | static int expect_close; | ||
69 | static int locked; | ||
70 | |||
71 | |||
72 | /* These are set from device resources */ | ||
73 | static void __iomem *wd_regs; | ||
74 | static unsigned int wd_irq, wd_ctr; | ||
75 | |||
76 | |||
77 | /* Module arguments */ | ||
78 | static int timeout = MAX_TIMEOUT_SECONDS; | ||
79 | module_param(timeout, int, 0444); | ||
80 | MODULE_PARM_DESC(timeout, "Watchdog timeout in seconds"); | ||
81 | |||
82 | static unsigned long resetaddr = 0xbffdc200; | ||
83 | module_param(resetaddr, ulong, 0444); | ||
84 | MODULE_PARM_DESC(resetaddr, "Address to write to to force a reset"); | ||
85 | |||
86 | static unsigned long flagaddr = 0xbffdc104; | ||
87 | module_param(flagaddr, ulong, 0444); | ||
88 | MODULE_PARM_DESC(flagaddr, "Address to write to boot flags to"); | ||
89 | |||
90 | static int powercycle; | ||
91 | module_param(powercycle, bool, 0444); | ||
92 | MODULE_PARM_DESC(powercycle, "Cycle power if watchdog expires"); | ||
93 | |||
94 | static int nowayout = WATCHDOG_NOWAYOUT; | ||
95 | module_param(nowayout, bool, 0444); | ||
96 | MODULE_PARM_DESC(nowayout, "Watchdog cannot be disabled once started"); | ||
97 | |||
98 | |||
99 | /* Kernel interfaces */ | ||
100 | static const struct file_operations fops = { | ||
101 | .owner = THIS_MODULE, | ||
102 | .open = wdt_gpi_open, | ||
103 | .release = wdt_gpi_release, | ||
104 | .write = wdt_gpi_write, | ||
105 | .unlocked_ioctl = wdt_gpi_ioctl, | ||
106 | }; | ||
107 | |||
108 | static struct miscdevice miscdev = { | ||
109 | .minor = WATCHDOG_MINOR, | ||
110 | .name = wdt_gpi_name, | ||
111 | .fops = &fops, | ||
112 | }; | ||
113 | |||
114 | static struct notifier_block wdt_gpi_shutdown = { | ||
115 | .notifier_call = wdt_gpi_notify, | ||
116 | }; | ||
117 | |||
118 | |||
119 | /* Interrupt handler */ | ||
120 | static irqreturn_t wdt_gpi_irqhdl(int irq, void *ctxt) | ||
121 | { | ||
122 | if (!unlikely(__raw_readl(wd_regs + 0x0008) & 0x1)) | ||
123 | return IRQ_NONE; | ||
124 | __raw_writel(0x1, wd_regs + 0x0008); | ||
125 | |||
126 | |||
127 | printk(KERN_CRIT "%s: watchdog expired - resetting system\n", | ||
128 | wdt_gpi_name); | ||
129 | |||
130 | *(volatile char *) flagaddr |= 0x01; | ||
131 | *(volatile char *) resetaddr = powercycle ? 0x01 : 0x2; | ||
132 | iob(); | ||
133 | while (1) | ||
134 | cpu_relax(); | ||
135 | } | ||
136 | |||
137 | |||
138 | /* Watchdog functions */ | ||
139 | static void wdt_gpi_start(void) | ||
140 | { | ||
141 | u32 reg; | ||
142 | |||
143 | lock_titan_regs(); | ||
144 | reg = titan_readl(CPGIG1ER); | ||
145 | titan_writel(reg | (0x100 << wd_ctr), CPGIG1ER); | ||
146 | iob(); | ||
147 | unlock_titan_regs(); | ||
148 | } | ||
149 | |||
150 | static void wdt_gpi_stop(void) | ||
151 | { | ||
152 | u32 reg; | ||
153 | |||
154 | lock_titan_regs(); | ||
155 | reg = titan_readl(CPCCR) & ~(0xf << (wd_ctr * 4)); | ||
156 | titan_writel(reg, CPCCR); | ||
157 | reg = titan_readl(CPGIG1ER); | ||
158 | titan_writel(reg & ~(0x100 << wd_ctr), CPGIG1ER); | ||
159 | iob(); | ||
160 | unlock_titan_regs(); | ||
161 | } | ||
162 | |||
163 | static void wdt_gpi_set_timeout(unsigned int to) | ||
164 | { | ||
165 | u32 reg; | ||
166 | const u32 wdval = (to * CLOCK) & ~0x0000000f; | ||
167 | |||
168 | lock_titan_regs(); | ||
169 | reg = titan_readl(CPCCR) & ~(0xf << (wd_ctr * 4)); | ||
170 | titan_writel(reg, CPCCR); | ||
171 | wmb(); | ||
172 | __raw_writel(wdval, wd_regs + 0x0000); | ||
173 | wmb(); | ||
174 | titan_writel(reg | (0x2 << (wd_ctr * 4)), CPCCR); | ||
175 | wmb(); | ||
176 | titan_writel(reg | (0x5 << (wd_ctr * 4)), CPCCR); | ||
177 | iob(); | ||
178 | unlock_titan_regs(); | ||
179 | } | ||
180 | |||
181 | |||
182 | /* /dev/watchdog operations */ | ||
183 | static int wdt_gpi_open(struct inode *inode, struct file *file) | ||
184 | { | ||
185 | int res; | ||
186 | |||
187 | if (unlikely(atomic_dec_if_positive(&opencnt) < 0)) | ||
188 | return -EBUSY; | ||
189 | |||
190 | expect_close = 0; | ||
191 | if (locked) { | ||
192 | module_put(THIS_MODULE); | ||
193 | free_irq(wd_irq, &miscdev); | ||
194 | locked = 0; | ||
195 | } | ||
196 | |||
197 | res = request_irq(wd_irq, wdt_gpi_irqhdl, IRQF_SHARED | IRQF_DISABLED, | ||
198 | wdt_gpi_name, &miscdev); | ||
199 | if (unlikely(res)) | ||
200 | return res; | ||
201 | |||
202 | wdt_gpi_set_timeout(timeout); | ||
203 | wdt_gpi_start(); | ||
204 | |||
205 | printk(KERN_INFO "%s: watchdog started, timeout = %u seconds\n", | ||
206 | wdt_gpi_name, timeout); | ||
207 | return nonseekable_open(inode, file); | ||
208 | } | ||
209 | |||
210 | static int wdt_gpi_release(struct inode *inode, struct file *file) | ||
211 | { | ||
212 | if (nowayout) { | ||
213 | printk(KERN_INFO "%s: no way out - watchdog left running\n", | ||
214 | wdt_gpi_name); | ||
215 | __module_get(THIS_MODULE); | ||
216 | locked = 1; | ||
217 | } else { | ||
218 | if (expect_close) { | ||
219 | wdt_gpi_stop(); | ||
220 | free_irq(wd_irq, &miscdev); | ||
221 | printk(KERN_INFO "%s: watchdog stopped\n", | ||
222 | wdt_gpi_name); | ||
223 | } else { | ||
224 | printk(KERN_CRIT "%s: unexpected close() -" | ||
225 | " watchdog left running\n", | ||
226 | wdt_gpi_name); | ||
227 | wdt_gpi_set_timeout(timeout); | ||
228 | __module_get(THIS_MODULE); | ||
229 | locked = 1; | ||
230 | } | ||
231 | } | ||
232 | |||
233 | atomic_inc(&opencnt); | ||
234 | return 0; | ||
235 | } | ||
236 | |||
237 | static ssize_t wdt_gpi_write(struct file *f, const char __user *d, size_t s, | ||
238 | loff_t *o) | ||
239 | { | ||
240 | char val; | ||
241 | |||
242 | wdt_gpi_set_timeout(timeout); | ||
243 | expect_close = (s > 0) && !get_user(val, d) && (val == 'V'); | ||
244 | return s ? 1 : 0; | ||
245 | } | ||
246 | |||
247 | static long wdt_gpi_ioctl(struct file *f, unsigned int cmd, unsigned long arg) | ||
248 | { | ||
249 | long res = -ENOTTY; | ||
250 | const long size = _IOC_SIZE(cmd); | ||
251 | int stat; | ||
252 | void __user *argp = (void __user *)arg; | ||
253 | static struct watchdog_info wdinfo = { | ||
254 | .identity = "RM9xxx/GPI watchdog", | ||
255 | .firmware_version = 0, | ||
256 | .options = WDIOF_SETTIMEOUT | WDIOF_KEEPALIVEPING | ||
257 | }; | ||
258 | |||
259 | if (unlikely(_IOC_TYPE(cmd) != WATCHDOG_IOCTL_BASE)) | ||
260 | return -ENOTTY; | ||
261 | |||
262 | if ((_IOC_DIR(cmd) & _IOC_READ) | ||
263 | && !access_ok(VERIFY_WRITE, arg, size)) | ||
264 | return -EFAULT; | ||
265 | |||
266 | if ((_IOC_DIR(cmd) & _IOC_WRITE) | ||
267 | && !access_ok(VERIFY_READ, arg, size)) | ||
268 | return -EFAULT; | ||
269 | |||
270 | expect_close = 0; | ||
271 | |||
272 | switch (cmd) { | ||
273 | case WDIOC_GETSUPPORT: | ||
274 | wdinfo.options = nowayout ? | ||
275 | WDIOF_SETTIMEOUT | WDIOF_KEEPALIVEPING : | ||
276 | WDIOF_SETTIMEOUT | WDIOF_KEEPALIVEPING | | ||
277 | WDIOF_MAGICCLOSE; | ||
278 | res = __copy_to_user(argp, &wdinfo, size) ? -EFAULT : size; | ||
279 | break; | ||
280 | |||
281 | case WDIOC_GETSTATUS: | ||
282 | break; | ||
283 | |||
284 | case WDIOC_GETBOOTSTATUS: | ||
285 | stat = (*(volatile char *) flagaddr & 0x01) | ||
286 | ? WDIOF_CARDRESET : 0; | ||
287 | res = __copy_to_user(argp, &stat, size) ? | ||
288 | -EFAULT : size; | ||
289 | break; | ||
290 | |||
291 | case WDIOC_SETOPTIONS: | ||
292 | break; | ||
293 | |||
294 | case WDIOC_KEEPALIVE: | ||
295 | wdt_gpi_set_timeout(timeout); | ||
296 | res = size; | ||
297 | break; | ||
298 | |||
299 | case WDIOC_SETTIMEOUT: | ||
300 | { | ||
301 | int val; | ||
302 | if (unlikely(__copy_from_user(&val, argp, size))) { | ||
303 | res = -EFAULT; | ||
304 | break; | ||
305 | } | ||
306 | |||
307 | if (val > MAX_TIMEOUT_SECONDS) | ||
308 | val = MAX_TIMEOUT_SECONDS; | ||
309 | timeout = val; | ||
310 | wdt_gpi_set_timeout(val); | ||
311 | res = size; | ||
312 | printk(KERN_INFO "%s: timeout set to %u seconds\n", | ||
313 | wdt_gpi_name, timeout); | ||
314 | } | ||
315 | break; | ||
316 | |||
317 | case WDIOC_GETTIMEOUT: | ||
318 | res = __copy_to_user(argp, &timeout, size) ? | ||
319 | -EFAULT : size; | ||
320 | break; | ||
321 | } | ||
322 | |||
323 | return res; | ||
324 | } | ||
325 | |||
326 | |||
327 | /* Shutdown notifier */ | ||
328 | static int wdt_gpi_notify(struct notifier_block *this, unsigned long code, | ||
329 | void *unused) | ||
330 | { | ||
331 | if (code == SYS_DOWN || code == SYS_HALT) | ||
332 | wdt_gpi_stop(); | ||
333 | |||
334 | return NOTIFY_DONE; | ||
335 | } | ||
336 | |||
337 | |||
338 | /* Init & exit procedures */ | ||
339 | static const struct resource *wdt_gpi_get_resource(struct platform_device *pdv, | ||
340 | const char *name, unsigned int type) | ||
341 | { | ||
342 | char buf[80]; | ||
343 | if (snprintf(buf, sizeof(buf), "%s_0", name) >= sizeof(buf)) | ||
344 | return NULL; | ||
345 | return platform_get_resource_byname(pdv, type, buf); | ||
346 | } | ||
347 | |||
348 | /* No hotplugging on the platform bus - use __devinit */ | ||
349 | static int __devinit wdt_gpi_probe(struct platform_device *pdv) | ||
350 | { | ||
351 | int res; | ||
352 | const struct resource | ||
353 | * const rr = wdt_gpi_get_resource(pdv, WDT_RESOURCE_REGS, | ||
354 | IORESOURCE_MEM), | ||
355 | * const ri = wdt_gpi_get_resource(pdv, WDT_RESOURCE_IRQ, | ||
356 | IORESOURCE_IRQ), | ||
357 | * const rc = wdt_gpi_get_resource(pdv, WDT_RESOURCE_COUNTER, | ||
358 | 0); | ||
359 | |||
360 | if (unlikely(!rr || !ri || !rc)) | ||
361 | return -ENXIO; | ||
362 | |||
363 | wd_regs = ioremap_nocache(rr->start, rr->end + 1 - rr->start); | ||
364 | if (unlikely(!wd_regs)) | ||
365 | return -ENOMEM; | ||
366 | wd_irq = ri->start; | ||
367 | wd_ctr = rc->start; | ||
368 | res = misc_register(&miscdev); | ||
369 | if (res) | ||
370 | iounmap(wd_regs); | ||
371 | else | ||
372 | register_reboot_notifier(&wdt_gpi_shutdown); | ||
373 | return res; | ||
374 | } | ||
375 | |||
376 | static int __devexit wdt_gpi_remove(struct platform_device *dev) | ||
377 | { | ||
378 | int res; | ||
379 | |||
380 | unregister_reboot_notifier(&wdt_gpi_shutdown); | ||
381 | res = misc_deregister(&miscdev); | ||
382 | iounmap(wd_regs); | ||
383 | wd_regs = NULL; | ||
384 | return res; | ||
385 | } | ||
386 | |||
387 | |||
388 | /* Device driver init & exit */ | ||
389 | static struct platform_driver wgt_gpi_driver = { | ||
390 | .driver = { | ||
391 | .name = wdt_gpi_name, | ||
392 | .owner = THIS_MODULE, | ||
393 | }, | ||
394 | .probe = wdt_gpi_probe, | ||
395 | .remove = __devexit_p(wdt_gpi_remove), | ||
396 | }; | ||
397 | |||
398 | static int __init wdt_gpi_init_module(void) | ||
399 | { | ||
400 | atomic_set(&opencnt, 1); | ||
401 | if (timeout > MAX_TIMEOUT_SECONDS) | ||
402 | timeout = MAX_TIMEOUT_SECONDS; | ||
403 | return platform_driver_register(&wdt_gpi_driver); | ||
404 | } | ||
405 | |||
406 | static void __exit wdt_gpi_cleanup_module(void) | ||
407 | { | ||
408 | platform_driver_unregister(&wdt_gpi_driver); | ||
409 | } | ||
410 | |||
411 | module_init(wdt_gpi_init_module); | ||
412 | module_exit(wdt_gpi_cleanup_module); | ||
413 | |||
414 | MODULE_AUTHOR("Thomas Koeller <thomas.koeller@baslerweb.com>"); | ||
415 | MODULE_DESCRIPTION("Basler eXcite watchdog driver for gpi devices"); | ||
416 | MODULE_VERSION("0.1"); | ||
417 | MODULE_LICENSE("GPL"); | ||
418 | MODULE_ALIAS_MISCDEV(WATCHDOG_MINOR); | ||
419 | |||