Re: [PATCH v5 1/2] watchdog: bcm281xx: Watchdog Driver
Hi Wim, Would you be able to pull v5 of this patch series into linux-watchdog-next? There haven't been any negative comments for several weeks. Thanks, -Markus On 22 November 2013 14:56, Markus Mayer wrote: > This commit adds support for the watchdog timer used on the BCM281xx > family of SoCs. > > Signed-off-by: Markus Mayer > Reviewed-by: Matt Porter > Reviewed-by: Guenter Roeck > --- > drivers/watchdog/Kconfig| 22 +++ > drivers/watchdog/Makefile |1 + > drivers/watchdog/bcm_kona_wdt.c | 365 > +++ > 3 files changed, 388 insertions(+) > create mode 100644 drivers/watchdog/bcm_kona_wdt.c > > diff --git a/drivers/watchdog/Kconfig b/drivers/watchdog/Kconfig > index 5be6e91..24bc93a 100644 > --- a/drivers/watchdog/Kconfig > +++ b/drivers/watchdog/Kconfig > @@ -1139,6 +1139,28 @@ config BCM2835_WDT > To compile this driver as a loadable module, choose M here. > The module will be called bcm2835_wdt. > > +config BCM_KONA_WDT > + tristate "BCM Kona Watchdog" > + depends on ARCH_BCM > + select WATCHDOG_CORE > + help > + Support for the watchdog timer on the following Broadcom BCM281xx > + family, which includes BCM11130, BCM11140, BCM11351, BCM28145 and > + BCM28155 variants. > + > + Say 'Y' or 'M' here to enable the driver. The module will be called > + bcm_kona_wdt. > + > +config BCM_KONA_WDT_DEBUG > + bool "DEBUGFS support for BCM Kona Watchdog" > + depends on BCM_KONA_WDT > + help > + If enabled, adds /sys/kernel/debug/bcm-kona-wdt/info which provides > + access to the driver's internal data structures as well as watchdog > + timer hardware registres. > + > + If in doubt, say 'N'. > + > config LANTIQ_WDT > tristate "Lantiq SoC watchdog" > depends on LANTIQ > diff --git a/drivers/watchdog/Makefile b/drivers/watchdog/Makefile > index 91bd95a..af22516 100644 > --- a/drivers/watchdog/Makefile > +++ b/drivers/watchdog/Makefile > @@ -57,6 +57,7 @@ obj-$(CONFIG_RETU_WATCHDOG) += retu_wdt.o > obj-$(CONFIG_BCM2835_WDT) += bcm2835_wdt.o > obj-$(CONFIG_MOXART_WDT) += moxart_wdt.o > obj-$(CONFIG_SIRFSOC_WATCHDOG) += sirfsoc_wdt.o > +obj-$(CONFIG_BCM_KONA_WDT) += bcm_kona_wdt.o > > # AVR32 Architecture > obj-$(CONFIG_AT32AP700X_WDT) += at32ap700x_wdt.o > diff --git a/drivers/watchdog/bcm_kona_wdt.c b/drivers/watchdog/bcm_kona_wdt.c > new file mode 100644 > index 000..9fe174b > --- /dev/null > +++ b/drivers/watchdog/bcm_kona_wdt.c > @@ -0,0 +1,365 @@ > +/* > + * Copyright (C) 2013 Broadcom Corporation > + * > + * This program is free software; you can redistribute it and/or > + * modify it under the terms of the GNU General Public License as > + * published by the Free Software Foundation version 2. > + * > + * This program is distributed "as is" WITHOUT ANY WARRANTY of any > + * kind, whether express or implied; without even the implied warranty > + * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the > + * GNU General Public License for more details. > + */ > + > +#include > +#include > +#include > +#include > +#include > +#include > +#include > +#include > + > +#define SECWDOG_CTRL_REG 0x > +#define SECWDOG_COUNT_REG 0x0004 > + > +#define SECWDOG_RESERVED_MASK 0x1dff > +#define SECWDOG_WD_LOAD_FLAG 0x1000 > +#define SECWDOG_EN_MASK0x0800 > +#define SECWDOG_SRSTEN_MASK0x0400 > +#define SECWDOG_RES_MASK 0x00f0 > +#define SECWDOG_COUNT_MASK 0x000f > + > +#define SECWDOG_MAX_COUNT SECWDOG_COUNT_MASK > +#define SECWDOG_CLKS_SHIFT 20 > +#define SECWDOG_MAX_RES15 > +#define SECWDOG_DEFAULT_RESOLUTION 4 > +#define SECWDOG_MAX_TRY1000 > + > +#define SECS_TO_TICKS(x, w)((x) << (w)->resolution) > +#define TICKS_TO_SECS(x, w)((x) >> (w)->resolution) > + > +#define BCM_KONA_WDT_NAME "bcm_kona_wdt" > + > +struct bcm_kona_wdt { > + void __iomem *base; > + /* > +* One watchdog tick is 1/(2^resolution) seconds. Resolution can take > +* the values 0-15, meaning one tick can be 1s to 30.52us. Our default > +* resolution of 4 means one tick is 62.5ms. > +* > +* The watchdog counter is 20 bits. Depending on resolution, the > maximum > +* counter value of 0xf expires after about 12 days (resolution 0) > +* down to only 32s (resolution 15). The default resolution of 4 gives > +* us a maximum of about 18 hours and 12 minutes before the watchdog > +* times out. > +*/ > + int resolution; > + spinlock_t lock; > +#ifdef CONFIG_BCM_KONA_WDT_DEBUG > + struct dentry *debugfs; > +#endif > +}; > + > +#ifdef CONFIG_BCM_KONA_WDT_DEBUG >
Re: [PATCH v5 1/2] watchdog: bcm281xx: Watchdog Driver
Hi Wim, Would you be able to pull v5 of this patch series into linux-watchdog-next? There haven't been any negative comments for several weeks. Thanks, -Markus On 22 November 2013 14:56, Markus Mayer markus.ma...@linaro.org wrote: This commit adds support for the watchdog timer used on the BCM281xx family of SoCs. Signed-off-by: Markus Mayer markus.ma...@linaro.org Reviewed-by: Matt Porter matt.por...@linaro.org Reviewed-by: Guenter Roeck li...@roeck-us.net --- drivers/watchdog/Kconfig| 22 +++ drivers/watchdog/Makefile |1 + drivers/watchdog/bcm_kona_wdt.c | 365 +++ 3 files changed, 388 insertions(+) create mode 100644 drivers/watchdog/bcm_kona_wdt.c diff --git a/drivers/watchdog/Kconfig b/drivers/watchdog/Kconfig index 5be6e91..24bc93a 100644 --- a/drivers/watchdog/Kconfig +++ b/drivers/watchdog/Kconfig @@ -1139,6 +1139,28 @@ config BCM2835_WDT To compile this driver as a loadable module, choose M here. The module will be called bcm2835_wdt. +config BCM_KONA_WDT + tristate BCM Kona Watchdog + depends on ARCH_BCM + select WATCHDOG_CORE + help + Support for the watchdog timer on the following Broadcom BCM281xx + family, which includes BCM11130, BCM11140, BCM11351, BCM28145 and + BCM28155 variants. + + Say 'Y' or 'M' here to enable the driver. The module will be called + bcm_kona_wdt. + +config BCM_KONA_WDT_DEBUG + bool DEBUGFS support for BCM Kona Watchdog + depends on BCM_KONA_WDT + help + If enabled, adds /sys/kernel/debug/bcm-kona-wdt/info which provides + access to the driver's internal data structures as well as watchdog + timer hardware registres. + + If in doubt, say 'N'. + config LANTIQ_WDT tristate Lantiq SoC watchdog depends on LANTIQ diff --git a/drivers/watchdog/Makefile b/drivers/watchdog/Makefile index 91bd95a..af22516 100644 --- a/drivers/watchdog/Makefile +++ b/drivers/watchdog/Makefile @@ -57,6 +57,7 @@ obj-$(CONFIG_RETU_WATCHDOG) += retu_wdt.o obj-$(CONFIG_BCM2835_WDT) += bcm2835_wdt.o obj-$(CONFIG_MOXART_WDT) += moxart_wdt.o obj-$(CONFIG_SIRFSOC_WATCHDOG) += sirfsoc_wdt.o +obj-$(CONFIG_BCM_KONA_WDT) += bcm_kona_wdt.o # AVR32 Architecture obj-$(CONFIG_AT32AP700X_WDT) += at32ap700x_wdt.o diff --git a/drivers/watchdog/bcm_kona_wdt.c b/drivers/watchdog/bcm_kona_wdt.c new file mode 100644 index 000..9fe174b --- /dev/null +++ b/drivers/watchdog/bcm_kona_wdt.c @@ -0,0 +1,365 @@ +/* + * Copyright (C) 2013 Broadcom Corporation + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License as + * published by the Free Software Foundation version 2. + * + * This program is distributed as is WITHOUT ANY WARRANTY of any + * kind, whether express or implied; without even the implied warranty + * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + */ + +#include linux/debugfs.h +#include linux/delay.h +#include linux/err.h +#include linux/io.h +#include linux/module.h +#include linux/of_address.h +#include linux/platform_device.h +#include linux/watchdog.h + +#define SECWDOG_CTRL_REG 0x +#define SECWDOG_COUNT_REG 0x0004 + +#define SECWDOG_RESERVED_MASK 0x1dff +#define SECWDOG_WD_LOAD_FLAG 0x1000 +#define SECWDOG_EN_MASK0x0800 +#define SECWDOG_SRSTEN_MASK0x0400 +#define SECWDOG_RES_MASK 0x00f0 +#define SECWDOG_COUNT_MASK 0x000f + +#define SECWDOG_MAX_COUNT SECWDOG_COUNT_MASK +#define SECWDOG_CLKS_SHIFT 20 +#define SECWDOG_MAX_RES15 +#define SECWDOG_DEFAULT_RESOLUTION 4 +#define SECWDOG_MAX_TRY1000 + +#define SECS_TO_TICKS(x, w)((x) (w)-resolution) +#define TICKS_TO_SECS(x, w)((x) (w)-resolution) + +#define BCM_KONA_WDT_NAME bcm_kona_wdt + +struct bcm_kona_wdt { + void __iomem *base; + /* +* One watchdog tick is 1/(2^resolution) seconds. Resolution can take +* the values 0-15, meaning one tick can be 1s to 30.52us. Our default +* resolution of 4 means one tick is 62.5ms. +* +* The watchdog counter is 20 bits. Depending on resolution, the maximum +* counter value of 0xf expires after about 12 days (resolution 0) +* down to only 32s (resolution 15). The default resolution of 4 gives +* us a maximum of about 18 hours and 12 minutes before the watchdog +* times out. +*/ + int resolution; + spinlock_t lock; +#ifdef CONFIG_BCM_KONA_WDT_DEBUG + struct dentry
[PATCH v5 1/2] watchdog: bcm281xx: Watchdog Driver
This commit adds support for the watchdog timer used on the BCM281xx family of SoCs. Signed-off-by: Markus Mayer Reviewed-by: Matt Porter Reviewed-by: Guenter Roeck --- drivers/watchdog/Kconfig| 22 +++ drivers/watchdog/Makefile |1 + drivers/watchdog/bcm_kona_wdt.c | 365 +++ 3 files changed, 388 insertions(+) create mode 100644 drivers/watchdog/bcm_kona_wdt.c diff --git a/drivers/watchdog/Kconfig b/drivers/watchdog/Kconfig index 5be6e91..24bc93a 100644 --- a/drivers/watchdog/Kconfig +++ b/drivers/watchdog/Kconfig @@ -1139,6 +1139,28 @@ config BCM2835_WDT To compile this driver as a loadable module, choose M here. The module will be called bcm2835_wdt. +config BCM_KONA_WDT + tristate "BCM Kona Watchdog" + depends on ARCH_BCM + select WATCHDOG_CORE + help + Support for the watchdog timer on the following Broadcom BCM281xx + family, which includes BCM11130, BCM11140, BCM11351, BCM28145 and + BCM28155 variants. + + Say 'Y' or 'M' here to enable the driver. The module will be called + bcm_kona_wdt. + +config BCM_KONA_WDT_DEBUG + bool "DEBUGFS support for BCM Kona Watchdog" + depends on BCM_KONA_WDT + help + If enabled, adds /sys/kernel/debug/bcm-kona-wdt/info which provides + access to the driver's internal data structures as well as watchdog + timer hardware registres. + + If in doubt, say 'N'. + config LANTIQ_WDT tristate "Lantiq SoC watchdog" depends on LANTIQ diff --git a/drivers/watchdog/Makefile b/drivers/watchdog/Makefile index 91bd95a..af22516 100644 --- a/drivers/watchdog/Makefile +++ b/drivers/watchdog/Makefile @@ -57,6 +57,7 @@ obj-$(CONFIG_RETU_WATCHDOG) += retu_wdt.o obj-$(CONFIG_BCM2835_WDT) += bcm2835_wdt.o obj-$(CONFIG_MOXART_WDT) += moxart_wdt.o obj-$(CONFIG_SIRFSOC_WATCHDOG) += sirfsoc_wdt.o +obj-$(CONFIG_BCM_KONA_WDT) += bcm_kona_wdt.o # AVR32 Architecture obj-$(CONFIG_AT32AP700X_WDT) += at32ap700x_wdt.o diff --git a/drivers/watchdog/bcm_kona_wdt.c b/drivers/watchdog/bcm_kona_wdt.c new file mode 100644 index 000..9fe174b --- /dev/null +++ b/drivers/watchdog/bcm_kona_wdt.c @@ -0,0 +1,365 @@ +/* + * Copyright (C) 2013 Broadcom Corporation + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License as + * published by the Free Software Foundation version 2. + * + * This program is distributed "as is" WITHOUT ANY WARRANTY of any + * kind, whether express or implied; without even the implied warranty + * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + */ + +#include +#include +#include +#include +#include +#include +#include +#include + +#define SECWDOG_CTRL_REG 0x +#define SECWDOG_COUNT_REG 0x0004 + +#define SECWDOG_RESERVED_MASK 0x1dff +#define SECWDOG_WD_LOAD_FLAG 0x1000 +#define SECWDOG_EN_MASK0x0800 +#define SECWDOG_SRSTEN_MASK0x0400 +#define SECWDOG_RES_MASK 0x00f0 +#define SECWDOG_COUNT_MASK 0x000f + +#define SECWDOG_MAX_COUNT SECWDOG_COUNT_MASK +#define SECWDOG_CLKS_SHIFT 20 +#define SECWDOG_MAX_RES15 +#define SECWDOG_DEFAULT_RESOLUTION 4 +#define SECWDOG_MAX_TRY1000 + +#define SECS_TO_TICKS(x, w)((x) << (w)->resolution) +#define TICKS_TO_SECS(x, w)((x) >> (w)->resolution) + +#define BCM_KONA_WDT_NAME "bcm_kona_wdt" + +struct bcm_kona_wdt { + void __iomem *base; + /* +* One watchdog tick is 1/(2^resolution) seconds. Resolution can take +* the values 0-15, meaning one tick can be 1s to 30.52us. Our default +* resolution of 4 means one tick is 62.5ms. +* +* The watchdog counter is 20 bits. Depending on resolution, the maximum +* counter value of 0xf expires after about 12 days (resolution 0) +* down to only 32s (resolution 15). The default resolution of 4 gives +* us a maximum of about 18 hours and 12 minutes before the watchdog +* times out. +*/ + int resolution; + spinlock_t lock; +#ifdef CONFIG_BCM_KONA_WDT_DEBUG + struct dentry *debugfs; +#endif +}; + +#ifdef CONFIG_BCM_KONA_WDT_DEBUG +static unsigned long busy_count; +#endif + +static int secure_register_read(void __iomem *addr) +{ + uint32_t val; + unsigned count = 0; + + /* +* If the WD_LOAD_FLAG is set, the watchdog counter field is being +* updated in hardware. Once the WD timer is updated in hardware, it +* gets cleared. +*/ + do { + if (unlikely(count > 1)) + udelay(5); + val =
[PATCH v5 1/2] watchdog: bcm281xx: Watchdog Driver
This commit adds support for the watchdog timer used on the BCM281xx family of SoCs. Signed-off-by: Markus Mayer markus.ma...@linaro.org Reviewed-by: Matt Porter matt.por...@linaro.org Reviewed-by: Guenter Roeck li...@roeck-us.net --- drivers/watchdog/Kconfig| 22 +++ drivers/watchdog/Makefile |1 + drivers/watchdog/bcm_kona_wdt.c | 365 +++ 3 files changed, 388 insertions(+) create mode 100644 drivers/watchdog/bcm_kona_wdt.c diff --git a/drivers/watchdog/Kconfig b/drivers/watchdog/Kconfig index 5be6e91..24bc93a 100644 --- a/drivers/watchdog/Kconfig +++ b/drivers/watchdog/Kconfig @@ -1139,6 +1139,28 @@ config BCM2835_WDT To compile this driver as a loadable module, choose M here. The module will be called bcm2835_wdt. +config BCM_KONA_WDT + tristate BCM Kona Watchdog + depends on ARCH_BCM + select WATCHDOG_CORE + help + Support for the watchdog timer on the following Broadcom BCM281xx + family, which includes BCM11130, BCM11140, BCM11351, BCM28145 and + BCM28155 variants. + + Say 'Y' or 'M' here to enable the driver. The module will be called + bcm_kona_wdt. + +config BCM_KONA_WDT_DEBUG + bool DEBUGFS support for BCM Kona Watchdog + depends on BCM_KONA_WDT + help + If enabled, adds /sys/kernel/debug/bcm-kona-wdt/info which provides + access to the driver's internal data structures as well as watchdog + timer hardware registres. + + If in doubt, say 'N'. + config LANTIQ_WDT tristate Lantiq SoC watchdog depends on LANTIQ diff --git a/drivers/watchdog/Makefile b/drivers/watchdog/Makefile index 91bd95a..af22516 100644 --- a/drivers/watchdog/Makefile +++ b/drivers/watchdog/Makefile @@ -57,6 +57,7 @@ obj-$(CONFIG_RETU_WATCHDOG) += retu_wdt.o obj-$(CONFIG_BCM2835_WDT) += bcm2835_wdt.o obj-$(CONFIG_MOXART_WDT) += moxart_wdt.o obj-$(CONFIG_SIRFSOC_WATCHDOG) += sirfsoc_wdt.o +obj-$(CONFIG_BCM_KONA_WDT) += bcm_kona_wdt.o # AVR32 Architecture obj-$(CONFIG_AT32AP700X_WDT) += at32ap700x_wdt.o diff --git a/drivers/watchdog/bcm_kona_wdt.c b/drivers/watchdog/bcm_kona_wdt.c new file mode 100644 index 000..9fe174b --- /dev/null +++ b/drivers/watchdog/bcm_kona_wdt.c @@ -0,0 +1,365 @@ +/* + * Copyright (C) 2013 Broadcom Corporation + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License as + * published by the Free Software Foundation version 2. + * + * This program is distributed as is WITHOUT ANY WARRANTY of any + * kind, whether express or implied; without even the implied warranty + * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + */ + +#include linux/debugfs.h +#include linux/delay.h +#include linux/err.h +#include linux/io.h +#include linux/module.h +#include linux/of_address.h +#include linux/platform_device.h +#include linux/watchdog.h + +#define SECWDOG_CTRL_REG 0x +#define SECWDOG_COUNT_REG 0x0004 + +#define SECWDOG_RESERVED_MASK 0x1dff +#define SECWDOG_WD_LOAD_FLAG 0x1000 +#define SECWDOG_EN_MASK0x0800 +#define SECWDOG_SRSTEN_MASK0x0400 +#define SECWDOG_RES_MASK 0x00f0 +#define SECWDOG_COUNT_MASK 0x000f + +#define SECWDOG_MAX_COUNT SECWDOG_COUNT_MASK +#define SECWDOG_CLKS_SHIFT 20 +#define SECWDOG_MAX_RES15 +#define SECWDOG_DEFAULT_RESOLUTION 4 +#define SECWDOG_MAX_TRY1000 + +#define SECS_TO_TICKS(x, w)((x) (w)-resolution) +#define TICKS_TO_SECS(x, w)((x) (w)-resolution) + +#define BCM_KONA_WDT_NAME bcm_kona_wdt + +struct bcm_kona_wdt { + void __iomem *base; + /* +* One watchdog tick is 1/(2^resolution) seconds. Resolution can take +* the values 0-15, meaning one tick can be 1s to 30.52us. Our default +* resolution of 4 means one tick is 62.5ms. +* +* The watchdog counter is 20 bits. Depending on resolution, the maximum +* counter value of 0xf expires after about 12 days (resolution 0) +* down to only 32s (resolution 15). The default resolution of 4 gives +* us a maximum of about 18 hours and 12 minutes before the watchdog +* times out. +*/ + int resolution; + spinlock_t lock; +#ifdef CONFIG_BCM_KONA_WDT_DEBUG + struct dentry *debugfs; +#endif +}; + +#ifdef CONFIG_BCM_KONA_WDT_DEBUG +static unsigned long busy_count; +#endif + +static int secure_register_read(void __iomem *addr) +{ + uint32_t val; + unsigned count = 0; + + /* +* If the WD_LOAD_FLAG is set, the watchdog counter field is being +* updated in hardware. Once the WD timer is updated in