Re: [PATCH 6/6] watchdog: ts4600: add driver for TS-4600 watchdog
On 12/14/2016 03:12 PM, Sebastien Bourdelin wrote: This watchdog is instantiated in a FPGA and can only be access using a GPIOs bit-banged bus, called the NBUS by Technologic Systems. The watchdog is made of only one register, called the feed register. Writing to this register will re-arm the watchdog for a given time (and enable it if it was disable). It can be disabled by writing a special value into it. Signed-off-by: Sebastien Bourdelin --- .../devicetree/bindings/watchdog/ts4600-wdt.txt| 16 ++ arch/arm/boot/dts/imx28-ts4600-common.dtsi | 5 + drivers/watchdog/Kconfig | 10 + drivers/watchdog/Makefile | 1 + drivers/watchdog/ts4600_wdt.c | 213 + 5 files changed, 245 insertions(+) create mode 100644 Documentation/devicetree/bindings/watchdog/ts4600-wdt.txt create mode 100644 drivers/watchdog/ts4600_wdt.c diff --git a/Documentation/devicetree/bindings/watchdog/ts4600-wdt.txt b/Documentation/devicetree/bindings/watchdog/ts4600-wdt.txt new file mode 100644 index 000..61d620e --- /dev/null +++ b/Documentation/devicetree/bindings/watchdog/ts4600-wdt.txt @@ -0,0 +1,16 @@ +TS-4600 Technologic Systems Watchdog + +Required properties: +- compatible: must be "technologic,ts4600-wdt" +- reg: offset to the FPGA's watchdog register + +Optional property: +- timeout-sec: contains the watchdog timeout in seconds. + +Example: + +wdt { + compatible = "technologic,ts4600-wdt"; + reg = <0x2a>; + timeout-sec = <10>; +}; diff --git a/arch/arm/boot/dts/imx28-ts4600-common.dtsi b/arch/arm/boot/dts/imx28-ts4600-common.dtsi index b668933..dd7318c 100644 --- a/arch/arm/boot/dts/imx28-ts4600-common.dtsi +++ b/arch/arm/boot/dts/imx28-ts4600-common.dtsi @@ -116,6 +116,11 @@ strobe-gpios = <&gpio0 25 GPIO_ACTIVE_HIGH>; ale-gpios= <&gpio0 26 GPIO_ACTIVE_HIGH>; rdy-gpios= <&gpio0 21 GPIO_ACTIVE_HIGH>; + + wdt@2a { + compatible = "technologic,ts4600-wdt"; + reg = <0x2a>; + }; }; }; diff --git a/drivers/watchdog/Kconfig b/drivers/watchdog/Kconfig index 3eb58cb..7a8e176 100644 --- a/drivers/watchdog/Kconfig +++ b/drivers/watchdog/Kconfig @@ -500,6 +500,16 @@ config NUC900_WATCHDOG To compile this driver as a module, choose M here: the module will be called nuc900_wdt. +config TS4600_WATCHDOG + tristate "TS-4600 Watchdog" + depends on HAS_IOMEM && OF + depends on SOC_IMX28 || COMPILE_TEST Asd 0day reports, this does not work. + select WATCHDOG_CORE + help + Technologic Systems TS-4600 has watchdog timer implemented in + an external FPGA. Say Y here if you want to support for the + watchdog timer on TS-4600 board. + config TS4800_WATCHDOG tristate "TS-4800 Watchdog" depends on HAS_IOMEM && OF diff --git a/drivers/watchdog/Makefile b/drivers/watchdog/Makefile index caa9f4a..d4b4bd2 100644 --- a/drivers/watchdog/Makefile +++ b/drivers/watchdog/Makefile @@ -61,6 +61,7 @@ obj-$(CONFIG_RN5T618_WATCHDOG) += rn5t618_wdt.o obj-$(CONFIG_COH901327_WATCHDOG) += coh901327_wdt.o obj-$(CONFIG_STMP3XXX_RTC_WATCHDOG) += stmp3xxx_rtc_wdt.o obj-$(CONFIG_NUC900_WATCHDOG) += nuc900_wdt.o +obj-$(CONFIG_TS4600_WATCHDOG) += ts4600_wdt.o obj-$(CONFIG_TS4800_WATCHDOG) += ts4800_wdt.o obj-$(CONFIG_TS72XX_WATCHDOG) += ts72xx_wdt.o obj-$(CONFIG_IMX2_WDT) += imx2_wdt.o diff --git a/drivers/watchdog/ts4600_wdt.c b/drivers/watchdog/ts4600_wdt.c new file mode 100644 index 000..db91b40 --- /dev/null +++ b/drivers/watchdog/ts4600_wdt.c @@ -0,0 +1,213 @@ +/* + * Watchdog driver for TS-4600 based boards + * + * Copyright (c) 2016 - Savoir-faire Linux + * Author: Sebastien Bourdelin + * + * This file is licensed under the terms of the GNU General Public + * License version 2. This program is licensed "as is" without any + * warranty of any kind, whether express or implied. + * + * The watchdog on the TS-4600 based boards is in an FPGA and can only be + * accessed using a GPIO bit-banged bus called the NBUS by Technologic Systems. + * The logic for the watchdog is the same then for the TS-4800 SoM, only the way + * to access it change, therefore this driver is heavely based on the ts4800_wdt + * driver from Damien Riegel . + */ + +#include +#include +#include +#include +#include +#include + +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) ")"); + +/* possible feed values */ +#define TS4600_WDT_FEED_2S 0x1 +#define TS4600_WDT_FEED_10S 0x2 +#define TS4600_WDT_DISABLE 0x3 + +struct ts4600_wdt { + struct watchdog_device wdd; + u32 feed_offset; + u32 feed_val; +}
Re: [PATCH 6/6] watchdog: ts4600: add driver for TS-4600 watchdog
On Wed, Dec 14, 2016 at 06:12:36PM -0500, Sebastien Bourdelin wrote: > This watchdog is instantiated in a FPGA and can only be access using a > GPIOs bit-banged bus, called the NBUS by Technologic Systems. > The watchdog is made of only one register, called the feed register. > Writing to this register will re-arm the watchdog for a given time (and > enable it if it was disable). It can be disabled by writing a special > value into it. > > Signed-off-by: Sebastien Bourdelin > --- > .../devicetree/bindings/watchdog/ts4600-wdt.txt| 16 ++ > arch/arm/boot/dts/imx28-ts4600-common.dtsi | 5 + Acked-by: Rob Herring > drivers/watchdog/Kconfig | 10 + > drivers/watchdog/Makefile | 1 + > drivers/watchdog/ts4600_wdt.c | 213 > + > 5 files changed, 245 insertions(+) > create mode 100644 Documentation/devicetree/bindings/watchdog/ts4600-wdt.txt > create mode 100644 drivers/watchdog/ts4600_wdt.c
Re: [PATCH 6/6] watchdog: ts4600: add driver for TS-4600 watchdog
Hi Sebastien, [auto build test ERROR on linus/master] [also build test ERROR on v4.9] [cannot apply to next-20161215] [if your patch is applied to the wrong git tree, please drop us a note to help improve the system] url: https://github.com/0day-ci/linux/commits/Sebastien-Bourdelin/of-documentation-add-bindings-documentation-for-TS-4600/20161215-072238 config: i386-allyesconfig (attached as .config) compiler: gcc-6 (Debian 6.2.0-3) 6.2.0 20160901 reproduce: # save the attached .config to linux build tree make ARCH=i386 All errors (new ones prefixed by >>): drivers/built-in.o: In function `ts4600_wdt_start': >> ts4600_wdt.c:(.text+0x2333d64): undefined reference to `ts_nbus_write' drivers/built-in.o: In function `ts4600_wdt_stop': ts4600_wdt.c:(.text+0x2333d85): undefined reference to `ts_nbus_write' drivers/built-in.o: In function `ts4600_wdt_probe': ts4600_wdt.c:(.text+0x2333e66): undefined reference to `ts_nbus_write' >> ts4600_wdt.c:(.text+0x2333ee9): undefined reference to `ts_nbus_is_ready' --- 0-DAY kernel test infrastructureOpen Source Technology Center https://lists.01.org/pipermail/kbuild-all Intel Corporation .config.gz Description: application/gzip
[PATCH 6/6] watchdog: ts4600: add driver for TS-4600 watchdog
This watchdog is instantiated in a FPGA and can only be access using a GPIOs bit-banged bus, called the NBUS by Technologic Systems. The watchdog is made of only one register, called the feed register. Writing to this register will re-arm the watchdog for a given time (and enable it if it was disable). It can be disabled by writing a special value into it. Signed-off-by: Sebastien Bourdelin --- .../devicetree/bindings/watchdog/ts4600-wdt.txt| 16 ++ arch/arm/boot/dts/imx28-ts4600-common.dtsi | 5 + drivers/watchdog/Kconfig | 10 + drivers/watchdog/Makefile | 1 + drivers/watchdog/ts4600_wdt.c | 213 + 5 files changed, 245 insertions(+) create mode 100644 Documentation/devicetree/bindings/watchdog/ts4600-wdt.txt create mode 100644 drivers/watchdog/ts4600_wdt.c diff --git a/Documentation/devicetree/bindings/watchdog/ts4600-wdt.txt b/Documentation/devicetree/bindings/watchdog/ts4600-wdt.txt new file mode 100644 index 000..61d620e --- /dev/null +++ b/Documentation/devicetree/bindings/watchdog/ts4600-wdt.txt @@ -0,0 +1,16 @@ +TS-4600 Technologic Systems Watchdog + +Required properties: +- compatible: must be "technologic,ts4600-wdt" +- reg: offset to the FPGA's watchdog register + +Optional property: +- timeout-sec: contains the watchdog timeout in seconds. + +Example: + +wdt { + compatible = "technologic,ts4600-wdt"; + reg = <0x2a>; + timeout-sec = <10>; +}; diff --git a/arch/arm/boot/dts/imx28-ts4600-common.dtsi b/arch/arm/boot/dts/imx28-ts4600-common.dtsi index b668933..dd7318c 100644 --- a/arch/arm/boot/dts/imx28-ts4600-common.dtsi +++ b/arch/arm/boot/dts/imx28-ts4600-common.dtsi @@ -116,6 +116,11 @@ strobe-gpios = <&gpio0 25 GPIO_ACTIVE_HIGH>; ale-gpios= <&gpio0 26 GPIO_ACTIVE_HIGH>; rdy-gpios= <&gpio0 21 GPIO_ACTIVE_HIGH>; + + wdt@2a { + compatible = "technologic,ts4600-wdt"; + reg = <0x2a>; + }; }; }; diff --git a/drivers/watchdog/Kconfig b/drivers/watchdog/Kconfig index 3eb58cb..7a8e176 100644 --- a/drivers/watchdog/Kconfig +++ b/drivers/watchdog/Kconfig @@ -500,6 +500,16 @@ config NUC900_WATCHDOG To compile this driver as a module, choose M here: the module will be called nuc900_wdt. +config TS4600_WATCHDOG + tristate "TS-4600 Watchdog" + depends on HAS_IOMEM && OF + depends on SOC_IMX28 || COMPILE_TEST + select WATCHDOG_CORE + help + Technologic Systems TS-4600 has watchdog timer implemented in + an external FPGA. Say Y here if you want to support for the + watchdog timer on TS-4600 board. + config TS4800_WATCHDOG tristate "TS-4800 Watchdog" depends on HAS_IOMEM && OF diff --git a/drivers/watchdog/Makefile b/drivers/watchdog/Makefile index caa9f4a..d4b4bd2 100644 --- a/drivers/watchdog/Makefile +++ b/drivers/watchdog/Makefile @@ -61,6 +61,7 @@ obj-$(CONFIG_RN5T618_WATCHDOG) += rn5t618_wdt.o obj-$(CONFIG_COH901327_WATCHDOG) += coh901327_wdt.o obj-$(CONFIG_STMP3XXX_RTC_WATCHDOG) += stmp3xxx_rtc_wdt.o obj-$(CONFIG_NUC900_WATCHDOG) += nuc900_wdt.o +obj-$(CONFIG_TS4600_WATCHDOG) += ts4600_wdt.o obj-$(CONFIG_TS4800_WATCHDOG) += ts4800_wdt.o obj-$(CONFIG_TS72XX_WATCHDOG) += ts72xx_wdt.o obj-$(CONFIG_IMX2_WDT) += imx2_wdt.o diff --git a/drivers/watchdog/ts4600_wdt.c b/drivers/watchdog/ts4600_wdt.c new file mode 100644 index 000..db91b40 --- /dev/null +++ b/drivers/watchdog/ts4600_wdt.c @@ -0,0 +1,213 @@ +/* + * Watchdog driver for TS-4600 based boards + * + * Copyright (c) 2016 - Savoir-faire Linux + * Author: Sebastien Bourdelin + * + * This file is licensed under the terms of the GNU General Public + * License version 2. This program is licensed "as is" without any + * warranty of any kind, whether express or implied. + * + * The watchdog on the TS-4600 based boards is in an FPGA and can only be + * accessed using a GPIO bit-banged bus called the NBUS by Technologic Systems. + * The logic for the watchdog is the same then for the TS-4800 SoM, only the way + * to access it change, therefore this driver is heavely based on the ts4800_wdt + * driver from Damien Riegel . + */ + +#include +#include +#include +#include +#include +#include + +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) ")"); + +/* possible feed values */ +#define TS4600_WDT_FEED_2S 0x1 +#define TS4600_WDT_FEED_10S 0x2 +#define TS4600_WDT_DISABLE 0x3 + +struct ts4600_wdt { + struct watchdog_device wdd; + u32 feed_offset; + u32 feed_val; +}; + +/* + * TS-4600 supports the following timeout values: + * + * value desc + * ---