summaryrefslogtreecommitdiff
path: root/drivers/watchdog
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2018-04-03 06:20:12 +0300
committerLinus Torvalds <torvalds@linux-foundation.org>2018-04-03 06:20:12 +0300
commitf5a8eb632b562bd9c16c389f5db3a5260fba4157 (patch)
tree82687234d772ff8f72a31e598fe16553885c56c9 /drivers/watchdog
parentc9297d284126b80c9cfd72c690e0da531c99fc48 (diff)
parentdd3b8c329aa270027fba61a02a12600972dc3983 (diff)
downloadlinux-f5a8eb632b562bd9c16c389f5db3a5260fba4157.tar.xz
Merge tag 'arch-removal' of git://git.kernel.org/pub/scm/linux/kernel/git/arnd/asm-generic
Pul removal of obsolete architecture ports from Arnd Bergmann: "This removes the entire architecture code for blackfin, cris, frv, m32r, metag, mn10300, score, and tile, including the associated device drivers. I have been working with the (former) maintainers for each one to ensure that my interpretation was right and the code is definitely unused in mainline kernels. Many had fond memories of working on the respective ports to start with and getting them included in upstream, but also saw no point in keeping the port alive without any users. In the end, it seems that while the eight architectures are extremely different, they all suffered the same fate: There was one company in charge of an SoC line, a CPU microarchitecture and a software ecosystem, which was more costly than licensing newer off-the-shelf CPU cores from a third party (typically ARM, MIPS, or RISC-V). It seems that all the SoC product lines are still around, but have not used the custom CPU architectures for several years at this point. In contrast, CPU instruction sets that remain popular and have actively maintained kernel ports tend to all be used across multiple licensees. [ See the new nds32 port merged in the previous commit for the next generation of "one company in charge of an SoC line, a CPU microarchitecture and a software ecosystem" - Linus ] The removal came out of a discussion that is now documented at https://lwn.net/Articles/748074/. Unlike the original plans, I'm not marking any ports as deprecated but remove them all at once after I made sure that they are all unused. Some architectures (notably tile, mn10300, and blackfin) are still being shipped in products with old kernels, but those products will never be updated to newer kernel releases. After this series, we still have a few architectures without mainline gcc support: - unicore32 and hexagon both have very outdated gcc releases, but the maintainers promised to work on providing something newer. At least in case of hexagon, this will only be llvm, not gcc. - openrisc, risc-v and nds32 are still in the process of finishing their support or getting it added to mainline gcc in the first place. They all have patched gcc-7.3 ports that work to some degree, but complete upstream support won't happen before gcc-8.1. Csky posted their first kernel patch set last week, their situation will be similar [ Palmer Dabbelt points out that RISC-V support is in mainline gcc since gcc-7, although gcc-7.3.0 is the recommended minimum - Linus ]" This really says it all: 2498 files changed, 95 insertions(+), 467668 deletions(-) * tag 'arch-removal' of git://git.kernel.org/pub/scm/linux/kernel/git/arnd/asm-generic: (74 commits) MAINTAINERS: UNICORE32: Change email account staging: iio: remove iio-trig-bfin-timer driver tty: hvc: remove tile driver tty: remove bfin_jtag_comm and hvc_bfin_jtag drivers serial: remove tile uart driver serial: remove m32r_sio driver serial: remove blackfin drivers serial: remove cris/etrax uart drivers usb: Remove Blackfin references in USB support usb: isp1362: remove blackfin arch glue usb: musb: remove blackfin port usb: host: remove tilegx platform glue pwm: remove pwm-bfin driver i2c: remove bfin-twi driver spi: remove blackfin related host drivers watchdog: remove bfin_wdt driver can: remove bfin_can driver mmc: remove bfin_sdh driver input: misc: remove blackfin rotary driver input: keyboard: remove bf54x driver ...
Diffstat (limited to 'drivers/watchdog')
-rw-r--r--drivers/watchdog/Kconfig21
-rw-r--r--drivers/watchdog/Makefile9
-rw-r--r--drivers/watchdog/bfin_wdt.c476
3 files changed, 1 insertions, 505 deletions
diff --git a/drivers/watchdog/Kconfig b/drivers/watchdog/Kconfig
index 37460cd6cabb..de6847d7b4e3 100644
--- a/drivers/watchdog/Kconfig
+++ b/drivers/watchdog/Kconfig
@@ -815,23 +815,6 @@ config SPRD_WATCHDOG
Say Y here to include watchdog timer supported
by Spreadtrum system.
-# BLACKFIN Architecture
-
-config BFIN_WDT
- tristate "Blackfin On-Chip Watchdog Timer"
- depends on BLACKFIN
- ---help---
- If you say yes here you will get support for the Blackfin On-Chip
- Watchdog Timer. If you have one of these processors and wish to
- have watchdog support enabled, say Y, otherwise say N.
-
- To compile this driver as a module, choose M here: the
- module will be called bfin_wdt.
-
-# CRIS Architecture
-
-# FRV Architecture
-
# X86 (i386 + ia64 + x86_64) Architecture
config ACQUIRE_WDT
@@ -1431,8 +1414,6 @@ config NIC7018_WDT
To compile this driver as a module, choose M here: the module will be
called nic7018_wdt.
-# M32R Architecture
-
# M68K Architecture
config M54xx_WATCHDOG
@@ -1605,7 +1586,7 @@ config BCM7038_WDT
config IMGPDC_WDT
tristate "Imagination Technologies PDC Watchdog Timer"
depends on HAS_IOMEM
- depends on METAG || MIPS || COMPILE_TEST
+ depends on MIPS || COMPILE_TEST
select WATCHDOG_CORE
help
Driver for Imagination Technologies PowerDown Controller
diff --git a/drivers/watchdog/Makefile b/drivers/watchdog/Makefile
index 0474d38aa854..e4dd91f5585a 100644
--- a/drivers/watchdog/Makefile
+++ b/drivers/watchdog/Makefile
@@ -91,13 +91,6 @@ obj-$(CONFIG_UNIPHIER_WATCHDOG) += uniphier_wdt.o
obj-$(CONFIG_RTD119X_WATCHDOG) += rtd119x_wdt.o
obj-$(CONFIG_SPRD_WATCHDOG) += sprd_wdt.o
-# BLACKFIN Architecture
-obj-$(CONFIG_BFIN_WDT) += bfin_wdt.o
-
-# CRIS Architecture
-
-# FRV Architecture
-
# X86 (i386 + ia64 + x86_64) Architecture
obj-$(CONFIG_ACQUIRE_WDT) += acquirewdt.o
obj-$(CONFIG_ADVANTECH_WDT) += advantechwdt.o
@@ -146,8 +139,6 @@ obj-$(CONFIG_INTEL_MEI_WDT) += mei_wdt.o
obj-$(CONFIG_NI903X_WDT) += ni903x_wdt.o
obj-$(CONFIG_NIC7018_WDT) += nic7018_wdt.o
-# M32R Architecture
-
# M68K Architecture
obj-$(CONFIG_M54xx_WATCHDOG) += m54xx_wdt.o
diff --git a/drivers/watchdog/bfin_wdt.c b/drivers/watchdog/bfin_wdt.c
deleted file mode 100644
index aa4d2e8a8ef9..000000000000
--- a/drivers/watchdog/bfin_wdt.c
+++ /dev/null
@@ -1,476 +0,0 @@
-/*
- * Blackfin On-Chip Watchdog Driver
- *
- * Originally based on softdog.c
- * Copyright 2006-2010 Analog Devices Inc.
- * Copyright 2006-2007 Michele d'Amico
- * Copyright 1996 Alan Cox <alan@lxorguk.ukuu.org.uk>
- *
- * Enter bugs at http://blackfin.uclinux.org/
- *
- * Licensed under the GPL-2 or later.
- */
-
-#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
-
-#include <linux/platform_device.h>
-#include <linux/module.h>
-#include <linux/moduleparam.h>
-#include <linux/types.h>
-#include <linux/timer.h>
-#include <linux/miscdevice.h>
-#include <linux/watchdog.h>
-#include <linux/fs.h>
-#include <linux/init.h>
-#include <linux/interrupt.h>
-#include <linux/uaccess.h>
-#include <asm/blackfin.h>
-#include <asm/bfin_watchdog.h>
-
-#define stamp(fmt, args...) \
- pr_debug("%s:%i: " fmt "\n", __func__, __LINE__, ## args)
-#define stampit() stamp("here i am")
-
-#define WATCHDOG_NAME "bfin-wdt"
-
-/* The BF561 has two watchdogs (one per core), but since Linux
- * only runs on core A, we'll just work with that one.
- */
-#ifdef BF561_FAMILY
-# define bfin_read_WDOG_CTL() bfin_read_WDOGA_CTL()
-# define bfin_read_WDOG_CNT() bfin_read_WDOGA_CNT()
-# define bfin_read_WDOG_STAT() bfin_read_WDOGA_STAT()
-# define bfin_write_WDOG_CTL(x) bfin_write_WDOGA_CTL(x)
-# define bfin_write_WDOG_CNT(x) bfin_write_WDOGA_CNT(x)
-# define bfin_write_WDOG_STAT(x) bfin_write_WDOGA_STAT(x)
-#endif
-
-/* some defaults */
-#define WATCHDOG_TIMEOUT 20
-
-static unsigned int timeout = WATCHDOG_TIMEOUT;
-static bool nowayout = WATCHDOG_NOWAYOUT;
-static const struct watchdog_info bfin_wdt_info;
-static unsigned long open_check;
-static char expect_close;
-static DEFINE_SPINLOCK(bfin_wdt_spinlock);
-
-/**
- * bfin_wdt_keepalive - Keep the Userspace Watchdog Alive
- *
- * The Userspace watchdog got a KeepAlive: schedule the next timeout.
- */
-static int bfin_wdt_keepalive(void)
-{
- stampit();
- bfin_write_WDOG_STAT(0);
- return 0;
-}
-
-/**
- * bfin_wdt_stop - Stop the Watchdog
- *
- * Stops the on-chip watchdog.
- */
-static int bfin_wdt_stop(void)
-{
- stampit();
- bfin_write_WDOG_CTL(WDEN_DISABLE);
- return 0;
-}
-
-/**
- * bfin_wdt_start - Start the Watchdog
- *
- * Starts the on-chip watchdog. Automatically loads WDOG_CNT
- * into WDOG_STAT for us.
- */
-static int bfin_wdt_start(void)
-{
- stampit();
- bfin_write_WDOG_CTL(WDEN_ENABLE | ICTL_RESET);
- return 0;
-}
-
-/**
- * bfin_wdt_running - Check Watchdog status
- *
- * See if the watchdog is running.
- */
-static int bfin_wdt_running(void)
-{
- stampit();
- return ((bfin_read_WDOG_CTL() & WDEN_MASK) != WDEN_DISABLE);
-}
-
-/**
- * bfin_wdt_set_timeout - Set the Userspace Watchdog timeout
- * @t: new timeout value (in seconds)
- *
- * Translate the specified timeout in seconds into System Clock
- * terms which is what the on-chip Watchdog requires.
- */
-static int bfin_wdt_set_timeout(unsigned long t)
-{
- u32 cnt, max_t, sclk;
- unsigned long flags;
-
- sclk = get_sclk();
- max_t = -1 / sclk;
- cnt = t * sclk;
- stamp("maxtimeout=%us newtimeout=%lus (cnt=%#x)", max_t, t, cnt);
-
- if (t > max_t) {
- pr_warn("timeout value is too large\n");
- return -EINVAL;
- }
-
- spin_lock_irqsave(&bfin_wdt_spinlock, flags);
- {
- int run = bfin_wdt_running();
- bfin_wdt_stop();
- bfin_write_WDOG_CNT(cnt);
- if (run)
- bfin_wdt_start();
- }
- spin_unlock_irqrestore(&bfin_wdt_spinlock, flags);
-
- timeout = t;
-
- return 0;
-}
-
-/**
- * bfin_wdt_open - Open the Device
- * @inode: inode of device
- * @file: file handle of device
- *
- * Watchdog device is opened and started.
- */
-static int bfin_wdt_open(struct inode *inode, struct file *file)
-{
- stampit();
-
- if (test_and_set_bit(0, &open_check))
- return -EBUSY;
-
- if (nowayout)
- __module_get(THIS_MODULE);
-
- bfin_wdt_keepalive();
- bfin_wdt_start();
-
- return nonseekable_open(inode, file);
-}
-
-/**
- * bfin_wdt_close - Close the Device
- * @inode: inode of device
- * @file: file handle of device
- *
- * Watchdog device is closed and stopped.
- */
-static int bfin_wdt_release(struct inode *inode, struct file *file)
-{
- stampit();
-
- if (expect_close == 42)
- bfin_wdt_stop();
- else {
- pr_crit("Unexpected close, not stopping watchdog!\n");
- bfin_wdt_keepalive();
- }
- expect_close = 0;
- clear_bit(0, &open_check);
- return 0;
-}
-
-/**
- * bfin_wdt_write - Write to Device
- * @file: file handle of device
- * @buf: buffer to write
- * @count: length of buffer
- * @ppos: offset
- *
- * Pings the watchdog on write.
- */
-static ssize_t bfin_wdt_write(struct file *file, const char __user *data,
- size_t len, loff_t *ppos)
-{
- stampit();
-
- if (len) {
- if (!nowayout) {
- size_t i;
-
- /* In case it was set long ago */
- expect_close = 0;
-
- for (i = 0; i != len; i++) {
- char c;
- if (get_user(c, data + i))
- return -EFAULT;
- if (c == 'V')
- expect_close = 42;
- }
- }
- bfin_wdt_keepalive();
- }
-
- return len;
-}
-
-/**
- * bfin_wdt_ioctl - Query Device
- * @file: file handle of device
- * @cmd: watchdog command
- * @arg: argument
- *
- * Query basic information from the device or ping it, as outlined by the
- * watchdog API.
- */
-static long bfin_wdt_ioctl(struct file *file,
- unsigned int cmd, unsigned long arg)
-{
- void __user *argp = (void __user *)arg;
- int __user *p = argp;
-
- stampit();
-
- switch (cmd) {
- case WDIOC_GETSUPPORT:
- if (copy_to_user(argp, &bfin_wdt_info, sizeof(bfin_wdt_info)))
- return -EFAULT;
- else
- return 0;
- case WDIOC_GETSTATUS:
- case WDIOC_GETBOOTSTATUS:
- return put_user(!!(_bfin_swrst & SWRST_RESET_WDOG), p);
- case WDIOC_SETOPTIONS: {
- unsigned long flags;
- int options, ret = -EINVAL;
-
- if (get_user(options, p))
- return -EFAULT;
-
- spin_lock_irqsave(&bfin_wdt_spinlock, flags);
- if (options & WDIOS_DISABLECARD) {
- bfin_wdt_stop();
- ret = 0;
- }
- if (options & WDIOS_ENABLECARD) {
- bfin_wdt_start();
- ret = 0;
- }
- spin_unlock_irqrestore(&bfin_wdt_spinlock, flags);
- return ret;
- }
- case WDIOC_KEEPALIVE:
- bfin_wdt_keepalive();
- return 0;
- case WDIOC_SETTIMEOUT: {
- int new_timeout;
-
- if (get_user(new_timeout, p))
- return -EFAULT;
- if (bfin_wdt_set_timeout(new_timeout))
- return -EINVAL;
- }
- /* Fall */
- case WDIOC_GETTIMEOUT:
- return put_user(timeout, p);
- default:
- return -ENOTTY;
- }
-}
-
-#ifdef CONFIG_PM
-static int state_before_suspend;
-
-/**
- * bfin_wdt_suspend - suspend the watchdog
- * @pdev: device being suspended
- * @state: requested suspend state
- *
- * Remember if the watchdog was running and stop it.
- * TODO: is this even right? Doesn't seem to be any
- * standard in the watchdog world ...
- */
-static int bfin_wdt_suspend(struct platform_device *pdev, pm_message_t state)
-{
- stampit();
-
- state_before_suspend = bfin_wdt_running();
- bfin_wdt_stop();
-
- return 0;
-}
-
-/**
- * bfin_wdt_resume - resume the watchdog
- * @pdev: device being resumed
- *
- * If the watchdog was running, turn it back on.
- */
-static int bfin_wdt_resume(struct platform_device *pdev)
-{
- stampit();
-
- if (state_before_suspend) {
- bfin_wdt_set_timeout(timeout);
- bfin_wdt_start();
- }
-
- return 0;
-}
-#else
-# define bfin_wdt_suspend NULL
-# define bfin_wdt_resume NULL
-#endif
-
-static const struct file_operations bfin_wdt_fops = {
- .owner = THIS_MODULE,
- .llseek = no_llseek,
- .write = bfin_wdt_write,
- .unlocked_ioctl = bfin_wdt_ioctl,
- .open = bfin_wdt_open,
- .release = bfin_wdt_release,
-};
-
-static struct miscdevice bfin_wdt_miscdev = {
- .minor = WATCHDOG_MINOR,
- .name = "watchdog",
- .fops = &bfin_wdt_fops,
-};
-
-static const struct watchdog_info bfin_wdt_info = {
- .identity = "Blackfin Watchdog",
- .options = WDIOF_SETTIMEOUT |
- WDIOF_KEEPALIVEPING |
- WDIOF_MAGICCLOSE,
-};
-
-/**
- * bfin_wdt_probe - Initialize module
- *
- * Registers the misc device. Actual device
- * initialization is handled by bfin_wdt_open().
- */
-static int bfin_wdt_probe(struct platform_device *pdev)
-{
- int ret;
-
- ret = misc_register(&bfin_wdt_miscdev);
- if (ret) {
- pr_err("cannot register miscdev on minor=%d (err=%d)\n",
- WATCHDOG_MINOR, ret);
- return ret;
- }
-
- pr_info("initialized: timeout=%d sec (nowayout=%d)\n",
- timeout, nowayout);
-
- return 0;
-}
-
-/**
- * bfin_wdt_remove - Initialize module
- *
- * Unregisters the misc device. Actual device
- * deinitialization is handled by bfin_wdt_close().
- */
-static int bfin_wdt_remove(struct platform_device *pdev)
-{
- misc_deregister(&bfin_wdt_miscdev);
- return 0;
-}
-
-/**
- * bfin_wdt_shutdown - Soft Shutdown Handler
- *
- * Handles the soft shutdown event.
- */
-static void bfin_wdt_shutdown(struct platform_device *pdev)
-{
- stampit();
-
- bfin_wdt_stop();
-}
-
-static struct platform_device *bfin_wdt_device;
-
-static struct platform_driver bfin_wdt_driver = {
- .probe = bfin_wdt_probe,
- .remove = bfin_wdt_remove,
- .shutdown = bfin_wdt_shutdown,
- .suspend = bfin_wdt_suspend,
- .resume = bfin_wdt_resume,
- .driver = {
- .name = WATCHDOG_NAME,
- },
-};
-
-/**
- * bfin_wdt_init - Initialize module
- *
- * Checks the module params and registers the platform device & driver.
- * Real work is in the platform probe function.
- */
-static int __init bfin_wdt_init(void)
-{
- int ret;
-
- stampit();
-
- /* Check that the timeout value is within range */
- if (bfin_wdt_set_timeout(timeout))
- return -EINVAL;
-
- /* Since this is an on-chip device and needs no board-specific
- * resources, we'll handle all the platform device stuff here.
- */
- ret = platform_driver_register(&bfin_wdt_driver);
- if (ret) {
- pr_err("unable to register driver\n");
- return ret;
- }
-
- bfin_wdt_device = platform_device_register_simple(WATCHDOG_NAME,
- -1, NULL, 0);
- if (IS_ERR(bfin_wdt_device)) {
- pr_err("unable to register device\n");
- platform_driver_unregister(&bfin_wdt_driver);
- return PTR_ERR(bfin_wdt_device);
- }
-
- return 0;
-}
-
-/**
- * bfin_wdt_exit - Deinitialize module
- *
- * Back out the platform device & driver steps. Real work is in the
- * platform remove function.
- */
-static void __exit bfin_wdt_exit(void)
-{
- platform_device_unregister(bfin_wdt_device);
- platform_driver_unregister(&bfin_wdt_driver);
-}
-
-module_init(bfin_wdt_init);
-module_exit(bfin_wdt_exit);
-
-MODULE_AUTHOR("Michele d'Amico, Mike Frysinger <vapier@gentoo.org>");
-MODULE_DESCRIPTION("Blackfin Watchdog Device Driver");
-MODULE_LICENSE("GPL");
-
-module_param(timeout, uint, 0);
-MODULE_PARM_DESC(timeout,
- "Watchdog timeout in seconds. (1<=timeout<=((2^32)/SCLK), default="
- __MODULE_STRING(WATCHDOG_TIMEOUT) ")");
-
-module_param(nowayout, bool, 0);
-MODULE_PARM_DESC(nowayout,
- "Watchdog cannot be stopped once started (default="
- __MODULE_STRING(WATCHDOG_NOWAYOUT) ")");