Kumar Gala | fabbfb9 | 2006-01-14 13:20:50 -0800 | [diff] [blame] | 1 | /* |
Anton Vorontsov | 0d7b101 | 2008-07-03 23:51:36 -0700 | [diff] [blame] | 2 | * mpc8xxx_wdt.c - MPC8xx/MPC83xx/MPC86xx watchdog userspace interface |
Kumar Gala | fabbfb9 | 2006-01-14 13:20:50 -0800 | [diff] [blame] | 3 | * |
| 4 | * Authors: Dave Updegraff <dave@cray.org> |
Wim Van Sebroeck | 5f3b275 | 2011-02-23 20:04:38 +0000 | [diff] [blame] | 5 | * Kumar Gala <galak@kernel.crashing.org> |
| 6 | * Attribution: from 83xx_wst: Florian Schirmer <jolt@tuxbox.org> |
| 7 | * ..and from sc520_wdt |
Anton Vorontsov | 500c919 | 2008-07-03 23:51:34 -0700 | [diff] [blame] | 8 | * Copyright (c) 2008 MontaVista Software, Inc. |
| 9 | * Anton Vorontsov <avorontsov@ru.mvista.com> |
Kumar Gala | fabbfb9 | 2006-01-14 13:20:50 -0800 | [diff] [blame] | 10 | * |
| 11 | * Note: it appears that you can only actually ENABLE or DISABLE the thing |
| 12 | * once after POR. Once enabled, you cannot disable, and vice versa. |
| 13 | * |
| 14 | * This program is free software; you can redistribute it and/or modify it |
| 15 | * under the terms of the GNU General Public License as published by the |
| 16 | * Free Software Foundation; either version 2 of the License, or (at your |
| 17 | * option) any later version. |
| 18 | */ |
| 19 | |
Joe Perches | 27c766a | 2012-02-15 15:06:19 -0800 | [diff] [blame] | 20 | #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt |
| 21 | |
Kumar Gala | fabbfb9 | 2006-01-14 13:20:50 -0800 | [diff] [blame] | 22 | #include <linux/fs.h> |
| 23 | #include <linux/init.h> |
| 24 | #include <linux/kernel.h> |
Anton Vorontsov | 500c919 | 2008-07-03 23:51:34 -0700 | [diff] [blame] | 25 | #include <linux/timer.h> |
Kumar Gala | fabbfb9 | 2006-01-14 13:20:50 -0800 | [diff] [blame] | 26 | #include <linux/miscdevice.h> |
Rob Herring | 5af5073 | 2013-09-17 14:28:33 -0500 | [diff] [blame] | 27 | #include <linux/of_address.h> |
Anton Vorontsov | ef8ab12 | 2008-07-03 23:51:32 -0700 | [diff] [blame] | 28 | #include <linux/of_platform.h> |
Kumar Gala | fabbfb9 | 2006-01-14 13:20:50 -0800 | [diff] [blame] | 29 | #include <linux/module.h> |
| 30 | #include <linux/watchdog.h> |
Alan Cox | f26ef3d | 2008-05-19 14:07:09 +0100 | [diff] [blame] | 31 | #include <linux/io.h> |
| 32 | #include <linux/uaccess.h> |
Anton Vorontsov | ef8ab12 | 2008-07-03 23:51:32 -0700 | [diff] [blame] | 33 | #include <sysdev/fsl_soc.h> |
Kumar Gala | fabbfb9 | 2006-01-14 13:20:50 -0800 | [diff] [blame] | 34 | |
Anton Vorontsov | 59ca1b0 | 2008-07-03 23:51:35 -0700 | [diff] [blame] | 35 | struct mpc8xxx_wdt { |
Kumar Gala | fabbfb9 | 2006-01-14 13:20:50 -0800 | [diff] [blame] | 36 | __be32 res0; |
| 37 | __be32 swcrr; /* System watchdog control register */ |
| 38 | #define SWCRR_SWTC 0xFFFF0000 /* Software Watchdog Time Count. */ |
| 39 | #define SWCRR_SWEN 0x00000004 /* Watchdog Enable bit. */ |
| 40 | #define SWCRR_SWRI 0x00000002 /* Software Watchdog Reset/Interrupt Select bit.*/ |
| 41 | #define SWCRR_SWPR 0x00000001 /* Software Watchdog Counter Prescale bit. */ |
| 42 | __be32 swcnr; /* System watchdog count register */ |
| 43 | u8 res1[2]; |
| 44 | __be16 swsrr; /* System watchdog service register */ |
| 45 | u8 res2[0xF0]; |
| 46 | }; |
| 47 | |
Anton Vorontsov | 59ca1b0 | 2008-07-03 23:51:35 -0700 | [diff] [blame] | 48 | struct mpc8xxx_wdt_type { |
Anton Vorontsov | 500c919 | 2008-07-03 23:51:34 -0700 | [diff] [blame] | 49 | int prescaler; |
| 50 | bool hw_enabled; |
| 51 | }; |
| 52 | |
Uwe Kleine-König | 7997eba | 2015-08-12 10:15:56 +0200 | [diff] [blame] | 53 | struct mpc8xxx_wdt_ddata { |
| 54 | struct mpc8xxx_wdt __iomem *base; |
| 55 | struct watchdog_device wdd; |
| 56 | struct timer_list timer; |
| 57 | spinlock_t lock; |
| 58 | }; |
Kumar Gala | fabbfb9 | 2006-01-14 13:20:50 -0800 | [diff] [blame] | 59 | |
| 60 | static u16 timeout = 0xffff; |
| 61 | module_param(timeout, ushort, 0); |
Alan Cox | f26ef3d | 2008-05-19 14:07:09 +0100 | [diff] [blame] | 62 | MODULE_PARM_DESC(timeout, |
Randy Dunlap | 76550d3 | 2010-05-01 09:46:15 -0700 | [diff] [blame] | 63 | "Watchdog timeout in ticks. (0<timeout<65536, default=65535)"); |
Kumar Gala | fabbfb9 | 2006-01-14 13:20:50 -0800 | [diff] [blame] | 64 | |
Rusty Russell | 90ab5ee | 2012-01-13 09:32:20 +1030 | [diff] [blame] | 65 | static bool reset = 1; |
Kumar Gala | fabbfb9 | 2006-01-14 13:20:50 -0800 | [diff] [blame] | 66 | module_param(reset, bool, 0); |
Alan Cox | f26ef3d | 2008-05-19 14:07:09 +0100 | [diff] [blame] | 67 | MODULE_PARM_DESC(reset, |
| 68 | "Watchdog Interrupt/Reset Mode. 0 = interrupt, 1 = reset"); |
Kumar Gala | fabbfb9 | 2006-01-14 13:20:50 -0800 | [diff] [blame] | 69 | |
Wim Van Sebroeck | 86a1e18 | 2012-03-05 16:51:11 +0100 | [diff] [blame] | 70 | static bool nowayout = WATCHDOG_NOWAYOUT; |
| 71 | module_param(nowayout, bool, 0); |
Anton Vorontsov | 500c919 | 2008-07-03 23:51:34 -0700 | [diff] [blame] | 72 | MODULE_PARM_DESC(nowayout, "Watchdog cannot be stopped once started " |
| 73 | "(default=" __MODULE_STRING(WATCHDOG_NOWAYOUT) ")"); |
| 74 | |
Uwe Kleine-König | 7997eba | 2015-08-12 10:15:56 +0200 | [diff] [blame] | 75 | static void mpc8xxx_wdt_keepalive(struct mpc8xxx_wdt_ddata *ddata) |
Kumar Gala | fabbfb9 | 2006-01-14 13:20:50 -0800 | [diff] [blame] | 76 | { |
| 77 | /* Ping the WDT */ |
Uwe Kleine-König | 7997eba | 2015-08-12 10:15:56 +0200 | [diff] [blame] | 78 | spin_lock(&ddata->lock); |
| 79 | out_be16(&ddata->base->swsrr, 0x556c); |
| 80 | out_be16(&ddata->base->swsrr, 0xaa39); |
| 81 | spin_unlock(&ddata->lock); |
Kumar Gala | fabbfb9 | 2006-01-14 13:20:50 -0800 | [diff] [blame] | 82 | } |
| 83 | |
Anton Vorontsov | 59ca1b0 | 2008-07-03 23:51:35 -0700 | [diff] [blame] | 84 | static void mpc8xxx_wdt_timer_ping(unsigned long arg) |
Anton Vorontsov | 500c919 | 2008-07-03 23:51:34 -0700 | [diff] [blame] | 85 | { |
Uwe Kleine-König | 7997eba | 2015-08-12 10:15:56 +0200 | [diff] [blame] | 86 | struct mpc8xxx_wdt_ddata *ddata = (void *)arg; |
Christophe Leroy | d5cfaf0 | 2013-12-04 07:32:14 +0100 | [diff] [blame] | 87 | |
Uwe Kleine-König | 7997eba | 2015-08-12 10:15:56 +0200 | [diff] [blame] | 88 | mpc8xxx_wdt_keepalive(ddata); |
Anton Vorontsov | 500c919 | 2008-07-03 23:51:34 -0700 | [diff] [blame] | 89 | /* We're pinging it twice faster than needed, just to be sure. */ |
Uwe Kleine-König | 7997eba | 2015-08-12 10:15:56 +0200 | [diff] [blame] | 90 | mod_timer(&ddata->timer, jiffies + HZ * ddata->wdd.timeout / 2); |
Anton Vorontsov | 500c919 | 2008-07-03 23:51:34 -0700 | [diff] [blame] | 91 | } |
| 92 | |
Christophe Leroy | d5cfaf0 | 2013-12-04 07:32:14 +0100 | [diff] [blame] | 93 | static int mpc8xxx_wdt_start(struct watchdog_device *w) |
Kumar Gala | fabbfb9 | 2006-01-14 13:20:50 -0800 | [diff] [blame] | 94 | { |
Uwe Kleine-König | 7997eba | 2015-08-12 10:15:56 +0200 | [diff] [blame] | 95 | struct mpc8xxx_wdt_ddata *ddata = |
| 96 | container_of(w, struct mpc8xxx_wdt_ddata, wdd); |
| 97 | |
Uwe Kleine-König | a57e06f | 2015-08-12 10:15:52 +0200 | [diff] [blame] | 98 | u32 tmp = SWCRR_SWEN | SWCRR_SWPR; |
Kumar Gala | fabbfb9 | 2006-01-14 13:20:50 -0800 | [diff] [blame] | 99 | |
| 100 | /* Good, fire up the show */ |
Kumar Gala | fabbfb9 | 2006-01-14 13:20:50 -0800 | [diff] [blame] | 101 | if (reset) |
| 102 | tmp |= SWCRR_SWRI; |
| 103 | |
| 104 | tmp |= timeout << 16; |
| 105 | |
Uwe Kleine-König | 7997eba | 2015-08-12 10:15:56 +0200 | [diff] [blame] | 106 | out_be32(&ddata->base->swcrr, tmp); |
Kumar Gala | fabbfb9 | 2006-01-14 13:20:50 -0800 | [diff] [blame] | 107 | |
Uwe Kleine-König | 7997eba | 2015-08-12 10:15:56 +0200 | [diff] [blame] | 108 | del_timer_sync(&ddata->timer); |
Anton Vorontsov | 500c919 | 2008-07-03 23:51:34 -0700 | [diff] [blame] | 109 | |
Kumar Gala | fabbfb9 | 2006-01-14 13:20:50 -0800 | [diff] [blame] | 110 | return 0; |
| 111 | } |
| 112 | |
Christophe Leroy | d5cfaf0 | 2013-12-04 07:32:14 +0100 | [diff] [blame] | 113 | static int mpc8xxx_wdt_ping(struct watchdog_device *w) |
Kumar Gala | fabbfb9 | 2006-01-14 13:20:50 -0800 | [diff] [blame] | 114 | { |
Uwe Kleine-König | 7997eba | 2015-08-12 10:15:56 +0200 | [diff] [blame] | 115 | struct mpc8xxx_wdt_ddata *ddata = |
| 116 | container_of(w, struct mpc8xxx_wdt_ddata, wdd); |
| 117 | |
| 118 | mpc8xxx_wdt_keepalive(ddata); |
Christophe Leroy | d5cfaf0 | 2013-12-04 07:32:14 +0100 | [diff] [blame] | 119 | return 0; |
Kumar Gala | fabbfb9 | 2006-01-14 13:20:50 -0800 | [diff] [blame] | 120 | } |
| 121 | |
Christophe Leroy | d5cfaf0 | 2013-12-04 07:32:14 +0100 | [diff] [blame] | 122 | static int mpc8xxx_wdt_stop(struct watchdog_device *w) |
| 123 | { |
Uwe Kleine-König | 7997eba | 2015-08-12 10:15:56 +0200 | [diff] [blame] | 124 | struct mpc8xxx_wdt_ddata *ddata = |
| 125 | container_of(w, struct mpc8xxx_wdt_ddata, wdd); |
| 126 | |
| 127 | mod_timer(&ddata->timer, jiffies); |
Christophe Leroy | d5cfaf0 | 2013-12-04 07:32:14 +0100 | [diff] [blame] | 128 | return 0; |
| 129 | } |
| 130 | |
| 131 | static struct watchdog_info mpc8xxx_wdt_info = { |
| 132 | .options = WDIOF_KEEPALIVEPING, |
| 133 | .firmware_version = 1, |
| 134 | .identity = "MPC8xxx", |
Kumar Gala | fabbfb9 | 2006-01-14 13:20:50 -0800 | [diff] [blame] | 135 | }; |
| 136 | |
Christophe Leroy | d5cfaf0 | 2013-12-04 07:32:14 +0100 | [diff] [blame] | 137 | static struct watchdog_ops mpc8xxx_wdt_ops = { |
| 138 | .owner = THIS_MODULE, |
| 139 | .start = mpc8xxx_wdt_start, |
| 140 | .ping = mpc8xxx_wdt_ping, |
| 141 | .stop = mpc8xxx_wdt_stop, |
| 142 | }; |
| 143 | |
Bill Pemberton | 2d991a1 | 2012-11-19 13:21:41 -0500 | [diff] [blame] | 144 | static int mpc8xxx_wdt_probe(struct platform_device *ofdev) |
Kumar Gala | fabbfb9 | 2006-01-14 13:20:50 -0800 | [diff] [blame] | 145 | { |
Kumar Gala | fabbfb9 | 2006-01-14 13:20:50 -0800 | [diff] [blame] | 146 | int ret; |
Uwe Kleine-König | de5f712 | 2015-08-12 10:15:55 +0200 | [diff] [blame] | 147 | struct resource *res; |
Arnd Bergmann | 639397e | 2012-05-21 21:57:39 +0200 | [diff] [blame] | 148 | const struct mpc8xxx_wdt_type *wdt_type; |
Uwe Kleine-König | 7997eba | 2015-08-12 10:15:56 +0200 | [diff] [blame] | 149 | struct mpc8xxx_wdt_ddata *ddata; |
Anton Vorontsov | ef8ab12 | 2008-07-03 23:51:32 -0700 | [diff] [blame] | 150 | u32 freq = fsl_get_sys_freq(); |
Anton Vorontsov | 500c919 | 2008-07-03 23:51:34 -0700 | [diff] [blame] | 151 | bool enabled; |
Christophe Leroy | d5cfaf0 | 2013-12-04 07:32:14 +0100 | [diff] [blame] | 152 | unsigned int timeout_sec; |
Kumar Gala | fabbfb9 | 2006-01-14 13:20:50 -0800 | [diff] [blame] | 153 | |
Uwe Kleine-König | f0ded83 | 2015-08-12 10:15:54 +0200 | [diff] [blame] | 154 | wdt_type = of_device_get_match_data(&ofdev->dev); |
| 155 | if (!wdt_type) |
Grant Likely | 1c48a5c | 2011-02-17 02:43:24 -0700 | [diff] [blame] | 156 | return -EINVAL; |
Grant Likely | 1c48a5c | 2011-02-17 02:43:24 -0700 | [diff] [blame] | 157 | |
Anton Vorontsov | ef8ab12 | 2008-07-03 23:51:32 -0700 | [diff] [blame] | 158 | if (!freq || freq == -1) |
| 159 | return -EINVAL; |
Kumar Gala | fabbfb9 | 2006-01-14 13:20:50 -0800 | [diff] [blame] | 160 | |
Uwe Kleine-König | 7997eba | 2015-08-12 10:15:56 +0200 | [diff] [blame] | 161 | ddata = devm_kzalloc(&ofdev->dev, sizeof(*ddata), GFP_KERNEL); |
| 162 | if (!ddata) |
| 163 | return -ENOMEM; |
Kumar Gala | fabbfb9 | 2006-01-14 13:20:50 -0800 | [diff] [blame] | 164 | |
Uwe Kleine-König | 7997eba | 2015-08-12 10:15:56 +0200 | [diff] [blame] | 165 | res = platform_get_resource(ofdev, IORESOURCE_MEM, 0); |
| 166 | ddata->base = devm_ioremap_resource(&ofdev->dev, res); |
| 167 | if (IS_ERR(ddata->base)) |
| 168 | return PTR_ERR(ddata->base); |
| 169 | |
| 170 | enabled = in_be32(&ddata->base->swcrr) & SWCRR_SWEN; |
Anton Vorontsov | 500c919 | 2008-07-03 23:51:34 -0700 | [diff] [blame] | 171 | if (!enabled && wdt_type->hw_enabled) { |
Joe Perches | 27c766a | 2012-02-15 15:06:19 -0800 | [diff] [blame] | 172 | pr_info("could not be enabled in software\n"); |
Uwe Kleine-König | 72cd501 | 2015-08-12 10:15:57 +0200 | [diff] [blame] | 173 | return -ENODEV; |
Anton Vorontsov | 500c919 | 2008-07-03 23:51:34 -0700 | [diff] [blame] | 174 | } |
| 175 | |
Uwe Kleine-König | 7997eba | 2015-08-12 10:15:56 +0200 | [diff] [blame] | 176 | spin_lock_init(&ddata->lock); |
| 177 | setup_timer(&ddata->timer, mpc8xxx_wdt_timer_ping, |
| 178 | (unsigned long)ddata); |
| 179 | |
| 180 | ddata->wdd.info = &mpc8xxx_wdt_info, |
| 181 | ddata->wdd.ops = &mpc8xxx_wdt_ops, |
| 182 | |
Kumar Gala | fabbfb9 | 2006-01-14 13:20:50 -0800 | [diff] [blame] | 183 | /* Calculate the timeout in seconds */ |
Uwe Kleine-König | a57e06f | 2015-08-12 10:15:52 +0200 | [diff] [blame] | 184 | timeout_sec = (timeout * wdt_type->prescaler) / freq; |
Kumar Gala | fabbfb9 | 2006-01-14 13:20:50 -0800 | [diff] [blame] | 185 | |
Uwe Kleine-König | 7997eba | 2015-08-12 10:15:56 +0200 | [diff] [blame] | 186 | ddata->wdd.timeout = timeout_sec; |
Uwe Kleine-König | 50ffb53 | 2015-08-12 10:15:53 +0200 | [diff] [blame] | 187 | |
Uwe Kleine-König | 7997eba | 2015-08-12 10:15:56 +0200 | [diff] [blame] | 188 | watchdog_set_nowayout(&ddata->wdd, nowayout); |
Uwe Kleine-König | 50ffb53 | 2015-08-12 10:15:53 +0200 | [diff] [blame] | 189 | |
Uwe Kleine-König | 7997eba | 2015-08-12 10:15:56 +0200 | [diff] [blame] | 190 | ret = watchdog_register_device(&ddata->wdd); |
Uwe Kleine-König | 50ffb53 | 2015-08-12 10:15:53 +0200 | [diff] [blame] | 191 | if (ret) { |
| 192 | pr_err("cannot register watchdog device (err=%d)\n", ret); |
Uwe Kleine-König | de5f712 | 2015-08-12 10:15:55 +0200 | [diff] [blame] | 193 | return ret; |
Uwe Kleine-König | 50ffb53 | 2015-08-12 10:15:53 +0200 | [diff] [blame] | 194 | } |
Anton Vorontsov | 593fc17 | 2008-08-20 16:38:36 -0700 | [diff] [blame] | 195 | |
Joe Perches | 27c766a | 2012-02-15 15:06:19 -0800 | [diff] [blame] | 196 | pr_info("WDT driver for MPC8xxx initialized. mode:%s timeout=%d (%d seconds)\n", |
| 197 | reset ? "reset" : "interrupt", timeout, timeout_sec); |
Anton Vorontsov | 500c919 | 2008-07-03 23:51:34 -0700 | [diff] [blame] | 198 | |
| 199 | /* |
| 200 | * If the watchdog was previously enabled or we're running on |
Anton Vorontsov | 59ca1b0 | 2008-07-03 23:51:35 -0700 | [diff] [blame] | 201 | * MPC8xxx, we should ping the wdt from the kernel until the |
Anton Vorontsov | 500c919 | 2008-07-03 23:51:34 -0700 | [diff] [blame] | 202 | * userspace handles it. |
| 203 | */ |
| 204 | if (enabled) |
Uwe Kleine-König | 7997eba | 2015-08-12 10:15:56 +0200 | [diff] [blame] | 205 | mod_timer(&ddata->timer, jiffies); |
| 206 | |
| 207 | platform_set_drvdata(ofdev, ddata); |
Kumar Gala | fabbfb9 | 2006-01-14 13:20:50 -0800 | [diff] [blame] | 208 | return 0; |
Kumar Gala | fabbfb9 | 2006-01-14 13:20:50 -0800 | [diff] [blame] | 209 | } |
| 210 | |
Bill Pemberton | 4b12b89 | 2012-11-19 13:26:24 -0500 | [diff] [blame] | 211 | static int mpc8xxx_wdt_remove(struct platform_device *ofdev) |
Kumar Gala | fabbfb9 | 2006-01-14 13:20:50 -0800 | [diff] [blame] | 212 | { |
Uwe Kleine-König | 7997eba | 2015-08-12 10:15:56 +0200 | [diff] [blame] | 213 | struct mpc8xxx_wdt_ddata *ddata = platform_get_drvdata(ofdev); |
| 214 | |
Christophe Leroy | d5cfaf0 | 2013-12-04 07:32:14 +0100 | [diff] [blame] | 215 | pr_crit("Watchdog removed, expect the %s soon!\n", |
| 216 | reset ? "reset" : "machine check exception"); |
Uwe Kleine-König | 7997eba | 2015-08-12 10:15:56 +0200 | [diff] [blame] | 217 | del_timer_sync(&ddata->timer); |
| 218 | watchdog_unregister_device(&ddata->wdd); |
Kumar Gala | fabbfb9 | 2006-01-14 13:20:50 -0800 | [diff] [blame] | 219 | |
| 220 | return 0; |
| 221 | } |
| 222 | |
Anton Vorontsov | 59ca1b0 | 2008-07-03 23:51:35 -0700 | [diff] [blame] | 223 | static const struct of_device_id mpc8xxx_wdt_match[] = { |
Anton Vorontsov | ef8ab12 | 2008-07-03 23:51:32 -0700 | [diff] [blame] | 224 | { |
| 225 | .compatible = "mpc83xx_wdt", |
Anton Vorontsov | 59ca1b0 | 2008-07-03 23:51:35 -0700 | [diff] [blame] | 226 | .data = &(struct mpc8xxx_wdt_type) { |
Anton Vorontsov | 500c919 | 2008-07-03 23:51:34 -0700 | [diff] [blame] | 227 | .prescaler = 0x10000, |
| 228 | }, |
| 229 | }, |
| 230 | { |
| 231 | .compatible = "fsl,mpc8610-wdt", |
Anton Vorontsov | 59ca1b0 | 2008-07-03 23:51:35 -0700 | [diff] [blame] | 232 | .data = &(struct mpc8xxx_wdt_type) { |
Anton Vorontsov | 500c919 | 2008-07-03 23:51:34 -0700 | [diff] [blame] | 233 | .prescaler = 0x10000, |
| 234 | .hw_enabled = true, |
| 235 | }, |
Anton Vorontsov | ef8ab12 | 2008-07-03 23:51:32 -0700 | [diff] [blame] | 236 | }, |
Anton Vorontsov | 0d7b101 | 2008-07-03 23:51:36 -0700 | [diff] [blame] | 237 | { |
| 238 | .compatible = "fsl,mpc823-wdt", |
| 239 | .data = &(struct mpc8xxx_wdt_type) { |
| 240 | .prescaler = 0x800, |
Christophe Leroy | 4af897f | 2013-11-30 16:45:40 +0100 | [diff] [blame] | 241 | .hw_enabled = true, |
Anton Vorontsov | 0d7b101 | 2008-07-03 23:51:36 -0700 | [diff] [blame] | 242 | }, |
| 243 | }, |
Anton Vorontsov | ef8ab12 | 2008-07-03 23:51:32 -0700 | [diff] [blame] | 244 | {}, |
| 245 | }; |
Anton Vorontsov | 59ca1b0 | 2008-07-03 23:51:35 -0700 | [diff] [blame] | 246 | MODULE_DEVICE_TABLE(of, mpc8xxx_wdt_match); |
Anton Vorontsov | ef8ab12 | 2008-07-03 23:51:32 -0700 | [diff] [blame] | 247 | |
Grant Likely | 1c48a5c | 2011-02-17 02:43:24 -0700 | [diff] [blame] | 248 | static struct platform_driver mpc8xxx_wdt_driver = { |
Anton Vorontsov | 59ca1b0 | 2008-07-03 23:51:35 -0700 | [diff] [blame] | 249 | .probe = mpc8xxx_wdt_probe, |
Bill Pemberton | 8226871 | 2012-11-19 13:21:12 -0500 | [diff] [blame] | 250 | .remove = mpc8xxx_wdt_remove, |
Grant Likely | 4018294 | 2010-04-13 16:13:02 -0700 | [diff] [blame] | 251 | .driver = { |
| 252 | .name = "mpc8xxx_wdt", |
Grant Likely | 4018294 | 2010-04-13 16:13:02 -0700 | [diff] [blame] | 253 | .of_match_table = mpc8xxx_wdt_match, |
Kumar Gala | fabbfb9 | 2006-01-14 13:20:50 -0800 | [diff] [blame] | 254 | }, |
| 255 | }; |
| 256 | |
Anton Vorontsov | 59ca1b0 | 2008-07-03 23:51:35 -0700 | [diff] [blame] | 257 | static int __init mpc8xxx_wdt_init(void) |
Kumar Gala | fabbfb9 | 2006-01-14 13:20:50 -0800 | [diff] [blame] | 258 | { |
Grant Likely | 1c48a5c | 2011-02-17 02:43:24 -0700 | [diff] [blame] | 259 | return platform_driver_register(&mpc8xxx_wdt_driver); |
Kumar Gala | fabbfb9 | 2006-01-14 13:20:50 -0800 | [diff] [blame] | 260 | } |
Anton Vorontsov | 0d7b101 | 2008-07-03 23:51:36 -0700 | [diff] [blame] | 261 | arch_initcall(mpc8xxx_wdt_init); |
Kumar Gala | fabbfb9 | 2006-01-14 13:20:50 -0800 | [diff] [blame] | 262 | |
Anton Vorontsov | 59ca1b0 | 2008-07-03 23:51:35 -0700 | [diff] [blame] | 263 | static void __exit mpc8xxx_wdt_exit(void) |
Kumar Gala | fabbfb9 | 2006-01-14 13:20:50 -0800 | [diff] [blame] | 264 | { |
Grant Likely | 1c48a5c | 2011-02-17 02:43:24 -0700 | [diff] [blame] | 265 | platform_driver_unregister(&mpc8xxx_wdt_driver); |
Kumar Gala | fabbfb9 | 2006-01-14 13:20:50 -0800 | [diff] [blame] | 266 | } |
Anton Vorontsov | 59ca1b0 | 2008-07-03 23:51:35 -0700 | [diff] [blame] | 267 | module_exit(mpc8xxx_wdt_exit); |
Kumar Gala | fabbfb9 | 2006-01-14 13:20:50 -0800 | [diff] [blame] | 268 | |
| 269 | MODULE_AUTHOR("Dave Updegraff, Kumar Gala"); |
Anton Vorontsov | 0d7b101 | 2008-07-03 23:51:36 -0700 | [diff] [blame] | 270 | MODULE_DESCRIPTION("Driver for watchdog timer in MPC8xx/MPC83xx/MPC86xx " |
| 271 | "uProcessors"); |
Kumar Gala | fabbfb9 | 2006-01-14 13:20:50 -0800 | [diff] [blame] | 272 | MODULE_LICENSE("GPL"); |