From patchwork Thu Jan 18 19:52:56 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Corentin Labbe X-Patchwork-Id: 125016 Delivered-To: patch@linaro.org Received: by 10.46.64.27 with SMTP id n27csp270692lja; Thu, 18 Jan 2018 11:55:08 -0800 (PST) X-Google-Smtp-Source: ACJfBossIpbTY+yXHy3AsnNrhYS77Umj/wJQDdxhxjXZrrUbFa0xDH+fedqhVtrdc3cjktZpMBMb X-Received: by 10.98.131.200 with SMTP id h191mr28959390pfe.149.1516305308119; Thu, 18 Jan 2018 11:55:08 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1516305308; cv=none; d=google.com; s=arc-20160816; b=ddGMlewz0Q4HrckDt1h1EMql3w5F2gdz+/pwdwpBkXOtjdo3p5Eosu++fXkPP5kNwA IoktTbV72Y1vcl6gWbVuiHwZLruphfLZ4emJvOgniC8K6856wFx5wCKSlQEz6ZLxMp1G mT0CWQf6guZCeOwMlOoxkFlDiYKNKJzqm+dQwZViYbJBo5NjxoCGVHZAPm4uL5R2TSne jSJq3K/8+CytNTgtip4M3j2qmbW0SolVpHYdAaFga0zNqJkSMTRYokQBZYPeyKNISJFy UHuhN/foTEzlgFtXpfLNtSX+Gaus/05Qs1kGlBxHz7ylHuIgwa4imLmVWs/I20pQsNpe qcDg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:date:subject:cc:to:from :dkim-signature:arc-authentication-results; bh=J+QlSgoWNPLUKqfmU42heGPJeT7Q/EucQ6gAsmbHM5I=; b=I9CYfbSsYNtHKFD6CxQOZPBrdluzJLzMnXqA1krdmw9AVVZmFwvtpmtciWUf3in++6 Sy+r7cEadRWgLGGzQfwZDtZ2Cf9+pAqs9LTRvxVmaQL2q8NpyWgtCNHU5LLAtxiIkYNx B189fz3N715xhehA8+97jsYPWwZMM0NIuPAfiMqrPjs63sbZfPnO+VB1EaBziAq4M0ip AK0Q5Z3OJHIwHw41iWn22zk7QVSY6Bbe0HZG3zzzM1B/lX+F0sjnTmsNrgNc/q5jKZlp Mi/aaXKvo2fy34MytEXnpT/P5t+7UZvL1qVG8TTDd3esaLuLD6r9d6bc4mcTilbI6bAc 4/7g== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@gmail.com header.s=20161025 header.b=BcczVGIx; spf=pass (google.com: best guess record for domain of linux-watchdog-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-watchdog-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id v14si6839759pgq.604.2018.01.18.11.55.07 for ; Thu, 18 Jan 2018 11:55:08 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-watchdog-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@gmail.com header.s=20161025 header.b=BcczVGIx; spf=pass (google.com: best guess record for domain of linux-watchdog-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-watchdog-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932563AbeARTzH (ORCPT ); Thu, 18 Jan 2018 14:55:07 -0500 Received: from mail-wm0-f65.google.com ([74.125.82.65]:37096 "EHLO mail-wm0-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932269AbeARTzF (ORCPT ); Thu, 18 Jan 2018 14:55:05 -0500 Received: by mail-wm0-f65.google.com with SMTP id v71so25349894wmv.2; Thu, 18 Jan 2018 11:55:04 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id; bh=dfBqulkL++cOmlvJf71TD5JwcDS/OO/l9R9eLy3/dMQ=; b=BcczVGIxwJKu5IOG2RuVbRf3fT2z4vqSfwrX95P1hZ741HhHoPOyQmq23XX3UT0z5G ynKSiFGHKYszkt7GBrI5b2hSp6gsZFQgqgPZEXJ6z7RsVMMI85VvYXEjq+O02Gb2aDdt bBs6NHZxwHNpdrW0Qq/CYV1RRhFNIbTessiBq1576g/sbhUDvkpAtWtWhqNaGl65N+hP XbHV8c+fxscltT06E6ias72za3e1yQm4tBidJPlYYzrTl50bxHC3wS/FH9OacjLLHM59 j6S3+1DoytRI4Pbm29ispM+NAJa+TvRoDq2pbHAZ891k+0+/hXxpbcmhQdIGzXr1noer GvFA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=dfBqulkL++cOmlvJf71TD5JwcDS/OO/l9R9eLy3/dMQ=; b=ugu4PS//zdOEWEtx8iHvGgDnYeGqqsPbQyrf05n+FGWg08y6Upvj0YQ2NZFDcZIpyT rw1DBM5wiv2yIX/5XcIjEwBsRW4SgNppFb1HMKWYhLSPFwpJLGdcZFFtcFKKKT/gg8PX 9WYLfKowi/D9pVvFk55rKgqn9gcZXKASMk25lABj3PLwdONj5kZ/tqXynoe6FdM3xLGQ aUrU8TXlHFPp+JXp6Sg3ImnWM8gvyhJrjYjzfkVaWCIXCgJ8nYELRPZq/rDBOhfzPMnn i0uEBnf+xX3D3KOkOqCtxkwqomKA86+fHlUpxeIr7xFewnv2rxCCQnfTDsg5N1//PuQp rObQ== X-Gm-Message-State: AKwxytdZo0H8Pnr0WiXkkvziaK+dNBohg//2g3brmLk4Zr+sIoN0Nfqv qhcI+EEDFAffnxbrW25MDq4= X-Received: by 10.28.32.15 with SMTP id g15mr5502712wmg.22.1516305304018; Thu, 18 Jan 2018 11:55:04 -0800 (PST) Received: from Red.local (LFbn-MAR-1-494-174.w2-15.abo.wanadoo.fr. [2.15.82.174]) by smtp.googlemail.com with ESMTPSA id o81sm4984592wmo.24.2018.01.18.11.55.02 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 18 Jan 2018 11:55:02 -0800 (PST) From: Corentin Labbe To: linux@roeck-us.net, wim@linux-watchdog.org, egtvedt@samfundet.no Cc: linux-kernel@vger.kernel.org, linux-watchdog@vger.kernel.org, Corentin Labbe Subject: [PATCH] watchdog: remove at32ap700x_wdt Date: Thu, 18 Jan 2018 20:52:56 +0100 Message-Id: <20180118195256.5663-1-clabbe.montjoie@gmail.com> X-Mailer: git-send-email 2.13.6 Sender: linux-watchdog-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-watchdog@vger.kernel.org Since AVR32 is gone, this driver is useless. Signed-off-by: Corentin Labbe --- drivers/watchdog/Kconfig | 9 - drivers/watchdog/Makefile | 3 - drivers/watchdog/at32ap700x_wdt.c | 433 -------------------------------------- 3 files changed, 445 deletions(-) delete mode 100644 drivers/watchdog/at32ap700x_wdt.c -- 2.13.6 -- To unsubscribe from this list: send the line "unsubscribe linux-watchdog" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Reviewed-by: Guenter Roeck Acked-by: Hans-Christian Noren Egtvedt diff --git a/drivers/watchdog/Kconfig b/drivers/watchdog/Kconfig index 34d1c6851fa7..aff773bcebdb 100644 --- a/drivers/watchdog/Kconfig +++ b/drivers/watchdog/Kconfig @@ -814,15 +814,6 @@ config SPRD_WATCHDOG Say Y here to include watchdog timer supported by Spreadtrum system. -# AVR32 Architecture - -config AT32AP700X_WDT - tristate "AT32AP700x watchdog" - depends on CPU_AT32AP700X || COMPILE_TEST - help - Watchdog timer embedded into AT32AP700x devices. This will reboot - your system when the timeout is reached. - # BLACKFIN Architecture config BFIN_WDT diff --git a/drivers/watchdog/Makefile b/drivers/watchdog/Makefile index b43bab87ff62..0474d38aa854 100644 --- a/drivers/watchdog/Makefile +++ b/drivers/watchdog/Makefile @@ -91,9 +91,6 @@ obj-$(CONFIG_UNIPHIER_WATCHDOG) += uniphier_wdt.o obj-$(CONFIG_RTD119X_WATCHDOG) += rtd119x_wdt.o obj-$(CONFIG_SPRD_WATCHDOG) += sprd_wdt.o -# AVR32 Architecture -obj-$(CONFIG_AT32AP700X_WDT) += at32ap700x_wdt.o - # BLACKFIN Architecture obj-$(CONFIG_BFIN_WDT) += bfin_wdt.o diff --git a/drivers/watchdog/at32ap700x_wdt.c b/drivers/watchdog/at32ap700x_wdt.c deleted file mode 100644 index 81ba8920f127..000000000000 --- a/drivers/watchdog/at32ap700x_wdt.c +++ /dev/null @@ -1,433 +0,0 @@ -/* - * Watchdog driver for Atmel AT32AP700X devices - * - * Copyright (C) 2005-2006 Atmel Corporation - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License version 2 as - * published by the Free Software Foundation. - * - * - * Errata: WDT Clear is blocked after WDT Reset - * - * A watchdog timer event will, after reset, block writes to the WDT_CLEAR - * register, preventing the program to clear the next Watchdog Timer Reset. - * - * If you still want to use the WDT after a WDT reset a small code can be - * insterted at the startup checking the AVR32_PM.rcause register for WDT reset - * and use a GPIO pin to reset the system. This method requires that one of the - * GPIO pins are available and connected externally to the RESET_N pin. After - * the GPIO pin has pulled down the reset line the GPIO will be reset and leave - * the pin tristated with pullup. - */ - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#define TIMEOUT_MIN 1 -#define TIMEOUT_MAX 2 -#define TIMEOUT_DEFAULT TIMEOUT_MAX - -/* module parameters */ -static int timeout = TIMEOUT_DEFAULT; -module_param(timeout, int, 0); -MODULE_PARM_DESC(timeout, - "Timeout value. Limited to be 1 or 2 seconds. (default=" - __MODULE_STRING(TIMEOUT_DEFAULT) ")"); - -static bool nowayout = WATCHDOG_NOWAYOUT; -module_param(nowayout, bool, 0); -MODULE_PARM_DESC(nowayout, "Watchdog cannot be stopped once started (default=" - __MODULE_STRING(WATCHDOG_NOWAYOUT) ")"); - -/* Watchdog registers and write/read macro */ -#define WDT_CTRL 0x00 -#define WDT_CTRL_EN 0 -#define WDT_CTRL_PSEL 8 -#define WDT_CTRL_KEY 24 - -#define WDT_CLR 0x04 - -#define WDT_RCAUSE 0x10 -#define WDT_RCAUSE_POR 0 -#define WDT_RCAUSE_EXT 2 -#define WDT_RCAUSE_WDT 3 -#define WDT_RCAUSE_JTAG 4 -#define WDT_RCAUSE_SERP 5 - -#define WDT_BIT(name) (1 << WDT_##name) -#define WDT_BF(name, value) ((value) << WDT_##name) - -#define wdt_readl(dev, reg) \ - __raw_readl((dev)->regs + WDT_##reg) -#define wdt_writel(dev, reg, value) \ - __raw_writel((value), (dev)->regs + WDT_##reg) - -struct wdt_at32ap700x { - void __iomem *regs; - spinlock_t io_lock; - int timeout; - int boot_status; - unsigned long users; - struct miscdevice miscdev; -}; - -static struct wdt_at32ap700x *wdt; -static char expect_release; - -/* - * Disable the watchdog. - */ -static inline void at32_wdt_stop(void) -{ - unsigned long psel; - - spin_lock(&wdt->io_lock); - psel = wdt_readl(wdt, CTRL) & WDT_BF(CTRL_PSEL, 0x0f); - wdt_writel(wdt, CTRL, psel | WDT_BF(CTRL_KEY, 0x55)); - wdt_writel(wdt, CTRL, psel | WDT_BF(CTRL_KEY, 0xaa)); - spin_unlock(&wdt->io_lock); -} - -/* - * Enable and reset the watchdog. - */ -static inline void at32_wdt_start(void) -{ - /* 0xf is 2^16 divider = 2 sec, 0xe is 2^15 divider = 1 sec */ - unsigned long psel = (wdt->timeout > 1) ? 0xf : 0xe; - - spin_lock(&wdt->io_lock); - wdt_writel(wdt, CTRL, WDT_BIT(CTRL_EN) - | WDT_BF(CTRL_PSEL, psel) - | WDT_BF(CTRL_KEY, 0x55)); - wdt_writel(wdt, CTRL, WDT_BIT(CTRL_EN) - | WDT_BF(CTRL_PSEL, psel) - | WDT_BF(CTRL_KEY, 0xaa)); - spin_unlock(&wdt->io_lock); -} - -/* - * Pat the watchdog timer. - */ -static inline void at32_wdt_pat(void) -{ - spin_lock(&wdt->io_lock); - wdt_writel(wdt, CLR, 0x42); - spin_unlock(&wdt->io_lock); -} - -/* - * Watchdog device is opened, and watchdog starts running. - */ -static int at32_wdt_open(struct inode *inode, struct file *file) -{ - if (test_and_set_bit(1, &wdt->users)) - return -EBUSY; - - at32_wdt_start(); - return nonseekable_open(inode, file); -} - -/* - * Close the watchdog device. - */ -static int at32_wdt_close(struct inode *inode, struct file *file) -{ - if (expect_release == 42) { - at32_wdt_stop(); - } else { - dev_dbg(wdt->miscdev.parent, - "unexpected close, not stopping watchdog!\n"); - at32_wdt_pat(); - } - clear_bit(1, &wdt->users); - expect_release = 0; - return 0; -} - -/* - * Change the watchdog time interval. - */ -static int at32_wdt_settimeout(int time) -{ - /* - * All counting occurs at 1 / SLOW_CLOCK (32 kHz) and max prescaler is - * 2 ^ 16 allowing up to 2 seconds timeout. - */ - if ((time < TIMEOUT_MIN) || (time > TIMEOUT_MAX)) - return -EINVAL; - - /* - * Set new watchdog time. It will be used when at32_wdt_start() is - * called. - */ - wdt->timeout = time; - return 0; -} - -/* - * Get the watchdog status. - */ -static int at32_wdt_get_status(void) -{ - int rcause; - int status = 0; - - rcause = wdt_readl(wdt, RCAUSE); - - switch (rcause) { - case WDT_BIT(RCAUSE_EXT): - status = WDIOF_EXTERN1; - break; - case WDT_BIT(RCAUSE_WDT): - status = WDIOF_CARDRESET; - break; - case WDT_BIT(RCAUSE_POR): /* fall through */ - case WDT_BIT(RCAUSE_JTAG): /* fall through */ - case WDT_BIT(RCAUSE_SERP): /* fall through */ - default: - break; - } - - return status; -} - -static const struct watchdog_info at32_wdt_info = { - .identity = "at32ap700x watchdog", - .options = WDIOF_SETTIMEOUT | - WDIOF_KEEPALIVEPING | - WDIOF_MAGICCLOSE, -}; - -/* - * Handle commands from user-space. - */ -static long at32_wdt_ioctl(struct file *file, - unsigned int cmd, unsigned long arg) -{ - int ret = -ENOTTY; - int time; - void __user *argp = (void __user *)arg; - int __user *p = argp; - - switch (cmd) { - case WDIOC_GETSUPPORT: - ret = copy_to_user(argp, &at32_wdt_info, - sizeof(at32_wdt_info)) ? -EFAULT : 0; - break; - case WDIOC_GETSTATUS: - ret = put_user(0, p); - break; - case WDIOC_GETBOOTSTATUS: - ret = put_user(wdt->boot_status, p); - break; - case WDIOC_SETOPTIONS: - ret = get_user(time, p); - if (ret) - break; - if (time & WDIOS_DISABLECARD) - at32_wdt_stop(); - if (time & WDIOS_ENABLECARD) - at32_wdt_start(); - ret = 0; - break; - case WDIOC_KEEPALIVE: - at32_wdt_pat(); - ret = 0; - break; - case WDIOC_SETTIMEOUT: - ret = get_user(time, p); - if (ret) - break; - ret = at32_wdt_settimeout(time); - if (ret) - break; - /* Enable new time value */ - at32_wdt_start(); - /* fall through */ - case WDIOC_GETTIMEOUT: - ret = put_user(wdt->timeout, p); - break; - } - - return ret; -} - -static ssize_t at32_wdt_write(struct file *file, const char __user *data, - size_t len, loff_t *ppos) -{ - /* See if we got the magic character 'V' and reload the timer */ - if (len) { - if (!nowayout) { - size_t i; - - /* - * note: just in case someone wrote the magic - * character five months ago... - */ - expect_release = 0; - - /* - * scan to see whether or not we got the magic - * character - */ - for (i = 0; i != len; i++) { - char c; - if (get_user(c, data + i)) - return -EFAULT; - if (c == 'V') - expect_release = 42; - } - } - /* someone wrote to us, we should pat the watchdog */ - at32_wdt_pat(); - } - return len; -} - -static const struct file_operations at32_wdt_fops = { - .owner = THIS_MODULE, - .llseek = no_llseek, - .unlocked_ioctl = at32_wdt_ioctl, - .open = at32_wdt_open, - .release = at32_wdt_close, - .write = at32_wdt_write, -}; - -static int __init at32_wdt_probe(struct platform_device *pdev) -{ - struct resource *regs; - int ret; - - if (wdt) { - dev_dbg(&pdev->dev, "only 1 wdt instance supported.\n"); - return -EBUSY; - } - - regs = platform_get_resource(pdev, IORESOURCE_MEM, 0); - if (!regs) { - dev_dbg(&pdev->dev, "missing mmio resource\n"); - return -ENXIO; - } - - wdt = devm_kzalloc(&pdev->dev, sizeof(struct wdt_at32ap700x), - GFP_KERNEL); - if (!wdt) - return -ENOMEM; - - wdt->regs = devm_ioremap(&pdev->dev, regs->start, resource_size(regs)); - if (!wdt->regs) { - ret = -ENOMEM; - dev_dbg(&pdev->dev, "could not map I/O memory\n"); - goto err_free; - } - - spin_lock_init(&wdt->io_lock); - wdt->boot_status = at32_wdt_get_status(); - - /* Work-around for watchdog silicon errata. */ - if (wdt->boot_status & WDIOF_CARDRESET) { - dev_info(&pdev->dev, "CPU must be reset with external " - "reset or POR due to silicon errata.\n"); - ret = -EIO; - goto err_free; - } else { - wdt->users = 0; - } - - wdt->miscdev.minor = WATCHDOG_MINOR; - wdt->miscdev.name = "watchdog"; - wdt->miscdev.fops = &at32_wdt_fops; - wdt->miscdev.parent = &pdev->dev; - - platform_set_drvdata(pdev, wdt); - - if (at32_wdt_settimeout(timeout)) { - at32_wdt_settimeout(TIMEOUT_DEFAULT); - dev_dbg(&pdev->dev, - "default timeout invalid, set to %d sec.\n", - TIMEOUT_DEFAULT); - } - - ret = misc_register(&wdt->miscdev); - if (ret) { - dev_dbg(&pdev->dev, "failed to register wdt miscdev\n"); - goto err_free; - } - - dev_info(&pdev->dev, - "AT32AP700X WDT at 0x%p, timeout %d sec (nowayout=%d)\n", - wdt->regs, wdt->timeout, nowayout); - - return 0; - -err_free: - wdt = NULL; - return ret; -} - -static int __exit at32_wdt_remove(struct platform_device *pdev) -{ - if (wdt && platform_get_drvdata(pdev) == wdt) { - /* Stop the timer before we leave */ - if (!nowayout) - at32_wdt_stop(); - - misc_deregister(&wdt->miscdev); - wdt = NULL; - } - return 0; -} - -static void at32_wdt_shutdown(struct platform_device *pdev) -{ - at32_wdt_stop(); -} - -#ifdef CONFIG_PM -static int at32_wdt_suspend(struct platform_device *pdev, pm_message_t message) -{ - at32_wdt_stop(); - return 0; -} - -static int at32_wdt_resume(struct platform_device *pdev) -{ - if (wdt->users) - at32_wdt_start(); - return 0; -} -#else -#define at32_wdt_suspend NULL -#define at32_wdt_resume NULL -#endif - -/* work with hotplug and coldplug */ -MODULE_ALIAS("platform:at32_wdt"); - -static struct platform_driver at32_wdt_driver = { - .remove = __exit_p(at32_wdt_remove), - .suspend = at32_wdt_suspend, - .resume = at32_wdt_resume, - .driver = { - .name = "at32_wdt", - }, - .shutdown = at32_wdt_shutdown, -}; - -module_platform_driver_probe(at32_wdt_driver, at32_wdt_probe); - -MODULE_AUTHOR("Hans-Christian Egtvedt "); -MODULE_DESCRIPTION("Watchdog driver for Atmel AT32AP700X"); -MODULE_LICENSE("GPL");