Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

Merge tag 'linux-watchdog-6.6-rc1' of git://www.linux-watchdog.org/linux-watchdog

Pull watchdog updates from Wim Van Sebroeck:

- add marvell GTI watchdog driver

- add support for Amlogic-T7 SoCs

- document the IPQ5018 watchdog compatible

- enable COMPILE_TEST for more watchdog device drivers

- core: stop watchdog when executing poweroff command

- other small improvements and fixes

* tag 'linux-watchdog-6.6-rc1' of git://www.linux-watchdog.org/linux-watchdog: (21 commits)
watchdog: Add support for Amlogic-T7 SoCs
watchdog: Add a new struct for Amlogic-GXBB driver
dt-bindings: watchdog: Add support for Amlogic-T7 SoCs
dt-bindings: watchdog: qcom-wdt: document IPQ5018
watchdog: imx2_wdt: Improve dev_crit() message
watchdog: stm32: Drop unnecessary of_match_ptr()
watchdog: sama5d4: readout initial state
watchdog: intel-mid_wdt: add MODULE_ALIAS() to allow auto-load
watchdog: core: stop watchdog when executing poweroff command
watchdog: pm8916_wdt: Remove redundant of_match_ptr()
watchdog: xilinx_wwdt: Use div_u64() in xilinx_wwdt_start()
watchdog: starfive: Remove #ifdef guards for PM related functions
watchdog: s3c2410: Fix potential deadlock on &wdt->lock
watchdog:rit_wdt: Add support for WDIOF_CARDRESET
dt-bindings: watchdog: ti,rti-wdt: Add support for WDIOF_CARDRESET
watchdog: Enable COMPILE_TEST for more drivers
watchdog: advantech_ec_wdt: fix Kconfig dependencies
watchdog: Explicitly include correct DT includes
Watchdog: Add marvell GTI watchdog driver
dt-bindings: watchdog: marvell GTI system watchdog driver
...

+625 -101
+1
Documentation/devicetree/bindings/watchdog/amlogic,meson-gxbb-wdt.yaml
··· 17 17 compatible: 18 18 enum: 19 19 - amlogic,meson-gxbb-wdt 20 + - amlogic,t7-wdt 20 21 21 22 reg: 22 23 maxItems: 1
+83
Documentation/devicetree/bindings/watchdog/marvell,cn10624-wdt.yaml
··· 1 + # SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) 2 + %YAML 1.2 3 + --- 4 + $id: http://devicetree.org/schemas/watchdog/marvell,cn10624-wdt.yaml# 5 + $schema: http://devicetree.org/meta-schemas/core.yaml# 6 + 7 + title: Marvell Global Timer (GTI) system watchdog 8 + 9 + maintainers: 10 + - Bharat Bhushan <bbhushan2@marvell.com> 11 + 12 + allOf: 13 + - $ref: watchdog.yaml# 14 + 15 + properties: 16 + compatible: 17 + oneOf: 18 + - enum: 19 + - marvell,cn9670-wdt 20 + - marvell,cn10624-wdt 21 + 22 + - items: 23 + - enum: 24 + - marvell,cn9880-wdt 25 + - marvell,cnf9535-wdt 26 + - const: marvell,cn9670-wdt 27 + 28 + - items: 29 + - enum: 30 + - marvell,cn10308-wdt 31 + - marvell,cnf10518-wdt 32 + - const: marvell,cn10624-wdt 33 + 34 + reg: 35 + maxItems: 1 36 + 37 + interrupts: 38 + maxItems: 1 39 + 40 + clocks: 41 + maxItems: 1 42 + 43 + clock-names: 44 + items: 45 + - const: refclk 46 + 47 + marvell,wdt-timer-index: 48 + $ref: /schemas/types.yaml#/definitions/uint32 49 + minimum: 0 50 + maximum: 63 51 + description: 52 + An SoC have many timers (up to 64), firmware can reserve one or more timer 53 + for some other use case and configures one of the global timer as watchdog 54 + timer. Firmware will update this field with the timer number configured 55 + as watchdog timer. 56 + 57 + required: 58 + - compatible 59 + - reg 60 + - interrupts 61 + - clocks 62 + - clock-names 63 + 64 + unevaluatedProperties: false 65 + 66 + examples: 67 + - | 68 + #include <dt-bindings/interrupt-controller/arm-gic.h> 69 + soc { 70 + #address-cells = <2>; 71 + #size-cells = <2>; 72 + 73 + watchdog@802000040000 { 74 + compatible = "marvell,cn9670-wdt"; 75 + reg = <0x00008020 0x00040000 0x00000000 0x00020000>; 76 + interrupts = <GIC_SPI 38 IRQ_TYPE_EDGE_RISING>; 77 + clocks = <&sclk>; 78 + clock-names = "refclk"; 79 + marvell,wdt-timer-index = <63>; 80 + }; 81 + }; 82 + 83 + ...
+1
Documentation/devicetree/bindings/watchdog/qcom-wdt.yaml
··· 18 18 - items: 19 19 - enum: 20 20 - qcom,kpss-wdt-ipq4019 21 + - qcom,apss-wdt-ipq5018 21 22 - qcom,apss-wdt-ipq5332 22 23 - qcom,apss-wdt-ipq9574 23 24 - qcom,apss-wdt-msm8994
+27 -1
Documentation/devicetree/bindings/watchdog/ti,rti-wdt.yaml
··· 34 34 power-domains: 35 35 maxItems: 1 36 36 37 + memory-region: 38 + maxItems: 1 39 + description: 40 + Contains the watchdog reserved memory. It is optional. 41 + In the reserved memory, the specified values, which are 42 + PON_REASON_SOF_NUM(0xBBBBCCCC), PON_REASON_MAGIC_NUM(0xDDDDDDDD), 43 + and PON_REASON_EOF_NUM(0xCCCCBBBB), are pre-stored at the first 44 + 3 * 4 bytes to tell that last boot was caused by watchdog reset. 45 + Once the PON reason is captured by driver(rti_wdt.c), the driver 46 + is supposed to wipe the whole memory region. Surely, if this 47 + property is set, at least 12 bytes reserved memory starting from 48 + specific memory address(0xa220000) should be set. More please 49 + refer to example. 50 + 37 51 required: 38 52 - compatible 39 53 - reg ··· 61 47 /* 62 48 * RTI WDT in main domain on J721e SoC. Assigned clocks are used to 63 49 * select the source clock for the watchdog, forcing it to tick with 64 - * a 32kHz clock in this case. 50 + * a 32kHz clock in this case. Add a reserved memory(optional) to keep 51 + * the watchdog reset cause persistent, which was be written in 12 bytes 52 + * starting from 0xa2200000 by RTI Watchdog Firmware, then make it 53 + * possible to get watchdog reset cause in driver. 54 + * 55 + * Reserved memory should be defined as follows: 56 + * reserved-memory { 57 + * wdt_reset_memory_region: wdt-memory@a2200000 { 58 + * reg = <0x00 0xa2200000 0x00 0x1000>; 59 + * no-map; 60 + * }; 61 + * } 65 62 */ 66 63 #include <dt-bindings/soc/ti,sci_pm_domain.h> 67 64 ··· 83 58 power-domains = <&k3_pds 252 TI_SCI_PD_EXCLUSIVE>; 84 59 assigned-clocks = <&k3_clks 252 1>; 85 60 assigned-clock-parents = <&k3_clks 252 5>; 61 + memory-region = <&wdt_reset_memory_region>; 86 62 };
+55 -40
drivers/watchdog/Kconfig
··· 307 307 config XILINX_WINDOW_WATCHDOG 308 308 tristate "Xilinx window watchdog timer" 309 309 depends on HAS_IOMEM 310 - depends on ARM64 310 + depends on ARM64 || COMPILE_TEST 311 311 select WATCHDOG_CORE 312 312 help 313 313 Window watchdog driver for the versal_wwdt IP core. ··· 343 343 344 344 config MLX_WDT 345 345 tristate "Mellanox Watchdog" 346 - depends on MELLANOX_PLATFORM 346 + depends on MELLANOX_PLATFORM || COMPILE_TEST 347 347 select WATCHDOG_CORE 348 348 select REGMAP 349 349 help ··· 493 493 494 494 config IXP4XX_WATCHDOG 495 495 tristate "IXP4xx Watchdog" 496 - depends on ARCH_IXP4XX 496 + depends on ARCH_IXP4XX || (ARM && COMPILE_TEST) 497 497 select WATCHDOG_CORE 498 498 help 499 499 Say Y here if to include support for the watchdog timer ··· 529 529 530 530 config SA1100_WATCHDOG 531 531 tristate "SA1100/PXA2xx watchdog" 532 - depends on ARCH_SA1100 || ARCH_PXA 532 + depends on ARCH_SA1100 || ARCH_PXA || COMPILE_TEST 533 533 help 534 534 Watchdog timer embedded into SA11x0 and PXA2xx chips. This will 535 535 reboot your system when timeout is reached. ··· 720 720 config IMX_SC_WDT 721 721 tristate "IMX SC Watchdog" 722 722 depends on HAVE_ARM_SMCCC 723 - depends on IMX_SCU 723 + depends on IMX_SCU || COMPILE_TEST 724 724 select WATCHDOG_CORE 725 725 help 726 726 This is the driver for the system controller watchdog ··· 931 931 932 932 config STM32_WATCHDOG 933 933 tristate "STM32 Independent WatchDoG (IWDG) support" 934 - depends on ARCH_STM32 934 + depends on ARCH_STM32 || COMPILE_TEST 935 935 select WATCHDOG_CORE 936 936 default y 937 937 help ··· 1065 1065 1066 1066 config ADVANTECH_WDT 1067 1067 tristate "Advantech SBC Watchdog Timer" 1068 - depends on X86 1068 + depends on X86 || COMPILE_TEST 1069 1069 help 1070 1070 If you are configuring a Linux kernel for the Advantech single-board 1071 1071 computer, say `Y' here to support its built-in watchdog timer ··· 1074 1074 1075 1075 config ADVANTECH_EC_WDT 1076 1076 tristate "Advantech Embedded Controller Watchdog Timer" 1077 - depends on X86 1077 + depends on X86 || COMPILE_TEST 1078 + select ISA_BUS_API 1079 + select WATCHDOG_CORE 1078 1080 help 1079 1081 This driver supports Advantech products with ITE based Embedded Controller. 1080 1082 It does not support Advantech products with other ECs or without EC. 1081 1083 1082 1084 config ALIM1535_WDT 1083 1085 tristate "ALi M1535 PMU Watchdog Timer" 1084 - depends on X86 && PCI 1086 + depends on (X86 || COMPILE_TEST) && PCI 1085 1087 help 1086 1088 This is the driver for the hardware watchdog on the ALi M1535 PMU. 1087 1089 ··· 1107 1105 1108 1106 config EBC_C384_WDT 1109 1107 tristate "WinSystems EBC-C384 Watchdog Timer" 1110 - depends on X86 1108 + depends on X86 || COMPILE_TEST 1111 1109 select ISA_BUS_API 1112 1110 select WATCHDOG_CORE 1113 1111 help ··· 1117 1115 1118 1116 config EXAR_WDT 1119 1117 tristate "Exar Watchdog Timer" 1120 - depends on X86 1118 + depends on X86 || COMPILE_TEST 1121 1119 select WATCHDOG_CORE 1122 1120 help 1123 1121 Enables watchdog timer support for the watchdog timer present ··· 1128 1126 1129 1127 config F71808E_WDT 1130 1128 tristate "Fintek F718xx, F818xx Super I/O Watchdog" 1131 - depends on X86 1129 + depends on X86 || COMPILE_TEST 1132 1130 select WATCHDOG_CORE 1133 1131 help 1134 1132 This is the driver for the hardware watchdog on the Fintek F71808E, ··· 1140 1138 1141 1139 config SP5100_TCO 1142 1140 tristate "AMD/ATI SP5100 TCO Timer/Watchdog" 1143 - depends on X86 && PCI 1141 + depends on (X86 || COMPILE_TEST) && PCI 1144 1142 select WATCHDOG_CORE 1145 1143 help 1146 1144 Hardware watchdog driver for the AMD/ATI SP5100 chipset. The TCO ··· 1179 1177 1180 1178 config SBC_FITPC2_WATCHDOG 1181 1179 tristate "Compulab SBC-FITPC2 watchdog" 1182 - depends on X86 1180 + depends on X86 || COMPILE_TEST 1183 1181 help 1184 1182 This is the driver for the built-in watchdog timer on the fit-PC2, 1185 1183 fit-PC2i, CM-iAM single-board computers made by Compulab. ··· 1204 1202 1205 1203 config EUROTECH_WDT 1206 1204 tristate "Eurotech CPU-1220/1410 Watchdog Timer" 1207 - depends on X86 1205 + depends on X86 || COMPILE_TEST 1208 1206 help 1209 1207 Enable support for the watchdog timer on the Eurotech CPU-1220 and 1210 1208 CPU-1410 cards. These are PC/104 SBCs. Spec sheets and product ··· 1212 1210 1213 1211 config IB700_WDT 1214 1212 tristate "IB700 SBC Watchdog Timer" 1215 - depends on X86 1213 + depends on X86 || COMPILE_TEST 1216 1214 help 1217 1215 This is the driver for the hardware watchdog on the IB700 Single 1218 1216 Board Computer produced by TMC Technology (www.tmc-uk.com). This ··· 1229 1227 1230 1228 config IBMASR 1231 1229 tristate "IBM Automatic Server Restart" 1232 - depends on X86 1230 + depends on X86 || COMPILE_TEST 1233 1231 help 1234 1232 This is the driver for the IBM Automatic Server Restart watchdog 1235 1233 timer built-in into some eServer xSeries machines. ··· 1239 1237 1240 1238 config WAFER_WDT 1241 1239 tristate "ICP Single Board Computer Watchdog Timer" 1242 - depends on X86 1240 + depends on X86 || COMPILE_TEST 1243 1241 help 1244 1242 This is a driver for the hardware watchdog on the ICP Single 1245 1243 Board Computer. This driver is working on (at least) the following ··· 1261 1259 1262 1260 config IE6XX_WDT 1263 1261 tristate "Intel Atom E6xx Watchdog" 1264 - depends on X86 && PCI 1262 + depends on (X86 || COMPILE_TEST) && PCI 1265 1263 select WATCHDOG_CORE 1266 1264 select MFD_CORE 1267 1265 select LPC_SCH ··· 1321 1319 1322 1320 config IT8712F_WDT 1323 1321 tristate "IT8712F (Smart Guardian) Watchdog Timer" 1324 - depends on X86 1322 + depends on X86 || COMPILE_TEST 1325 1323 help 1326 1324 This is the driver for the built-in watchdog timer on the IT8712F 1327 1325 Super I/0 chipset used on many motherboards. ··· 1334 1332 1335 1333 config IT87_WDT 1336 1334 tristate "IT87 Watchdog Timer" 1337 - depends on X86 1335 + depends on X86 || COMPILE_TEST 1338 1336 select WATCHDOG_CORE 1339 1337 help 1340 1338 This is the driver for the hardware watchdog on the ITE IT8607, ··· 1352 1350 config HP_WATCHDOG 1353 1351 tristate "HP ProLiant iLO2+ Hardware Watchdog Timer" 1354 1352 select WATCHDOG_CORE 1355 - depends on (ARM64 || X86) && PCI 1353 + depends on (ARM64 || X86 || COMPILE_TEST) && PCI 1356 1354 help 1357 1355 A software monitoring watchdog and NMI handling driver. This driver 1358 1356 will detect lockups and provide a stack trace. This is a driver that ··· 1382 1380 1383 1381 config SC1200_WDT 1384 1382 tristate "National Semiconductor PC87307/PC97307 (ala SC1200) Watchdog" 1385 - depends on X86 1383 + depends on X86 || COMPILE_TEST 1386 1384 help 1387 1385 This is a driver for National Semiconductor PC87307/PC97307 hardware 1388 1386 watchdog cards as found on the SC1200. This watchdog is mainly used ··· 1405 1403 1406 1404 config PC87413_WDT 1407 1405 tristate "NS PC87413 watchdog" 1408 - depends on X86 1406 + depends on X86 || COMPILE_TEST 1409 1407 help 1410 1408 This is the driver for the hardware watchdog on the PC87413 chipset 1411 1409 This watchdog simply watches your kernel to make sure it doesn't ··· 1419 1417 1420 1418 config NV_TCO 1421 1419 tristate "nVidia TCO Timer/Watchdog" 1422 - depends on X86 && PCI 1420 + depends on (X86 || COMPILE_TEST) && PCI 1423 1421 help 1424 1422 Hardware driver for the TCO timer built into the nVidia Hub family 1425 1423 (such as the MCP51). The TCO (Total Cost of Ownership) timer is a ··· 1448 1446 1449 1447 config 60XX_WDT 1450 1448 tristate "SBC-60XX Watchdog Timer" 1451 - depends on X86 1449 + depends on X86 || COMPILE_TEST 1452 1450 help 1453 1451 This driver can be used with the watchdog timer found on some 1454 1452 single board computers, namely the 6010 PII based computer. ··· 1488 1486 1489 1487 config CPU5_WDT 1490 1488 tristate "SMA CPU5 Watchdog" 1491 - depends on X86 1489 + depends on X86 || COMPILE_TEST 1492 1490 help 1493 1491 TBD. 1494 1492 To compile this driver as a module, choose M here: the ··· 1496 1494 1497 1495 config SMSC_SCH311X_WDT 1498 1496 tristate "SMSC SCH311X Watchdog Timer" 1499 - depends on X86 1497 + depends on X86 || COMPILE_TEST 1500 1498 help 1501 1499 This is the driver for the hardware watchdog timer on the 1502 1500 SMSC SCH3112, SCH3114 and SCH3116 Super IO chipset ··· 1508 1506 1509 1507 config SMSC37B787_WDT 1510 1508 tristate "Winbond SMsC37B787 Watchdog Timer" 1511 - depends on X86 1509 + depends on X86 || COMPILE_TEST 1512 1510 help 1513 1511 This is the driver for the hardware watchdog component on the 1514 1512 Winbond SMsC37B787 chipset as used on the NetRunner Mainboard ··· 1528 1526 1529 1527 config TQMX86_WDT 1530 1528 tristate "TQ-Systems TQMX86 Watchdog Timer" 1531 - depends on X86 1529 + depends on X86 || COMPILE_TEST 1532 1530 select WATCHDOG_CORE 1533 1531 help 1534 1532 This is the driver for the hardware watchdog timer in the TQMX86 IO ··· 1541 1539 1542 1540 config VIA_WDT 1543 1541 tristate "VIA Watchdog Timer" 1544 - depends on X86 && PCI 1542 + depends on (X86 || COMPILE_TEST) && PCI 1545 1543 select WATCHDOG_CORE 1546 1544 help 1547 1545 This is the driver for the hardware watchdog timer on VIA ··· 1554 1552 1555 1553 config W83627HF_WDT 1556 1554 tristate "Watchdog timer for W83627HF/W83627DHG and compatibles" 1557 - depends on X86 1555 + depends on X86 || COMPILE_TEST 1558 1556 select WATCHDOG_CORE 1559 1557 help 1560 1558 This is the driver for the hardware watchdog on the following ··· 1584 1582 1585 1583 config W83877F_WDT 1586 1584 tristate "W83877F (EMACS) Watchdog Timer" 1587 - depends on X86 1585 + depends on X86 || COMPILE_TEST 1588 1586 help 1589 1587 This is the driver for the hardware watchdog on the W83877F chipset 1590 1588 as used in EMACS PC-104 motherboards (and likely others). This ··· 1599 1597 1600 1598 config W83977F_WDT 1601 1599 tristate "W83977F (PCM-5335) Watchdog Timer" 1602 - depends on X86 1600 + depends on X86 || COMPILE_TEST 1603 1601 help 1604 1602 This is the driver for the hardware watchdog on the W83977F I/O chip 1605 1603 as used in AAEON's PCM-5335 SBC (and likely others). This ··· 1612 1610 1613 1611 config MACHZ_WDT 1614 1612 tristate "ZF MachZ Watchdog" 1615 - depends on X86 1613 + depends on X86 || COMPILE_TEST 1616 1614 help 1617 1615 If you are using a ZF Micro MachZ processor, say Y here, otherwise 1618 1616 N. This is the driver for the watchdog timer built-in on that ··· 1625 1623 1626 1624 config SBC_EPX_C3_WATCHDOG 1627 1625 tristate "Winsystems SBC EPX-C3 watchdog" 1628 - depends on X86 1626 + depends on X86 || COMPILE_TEST 1629 1627 help 1630 1628 This is the driver for the built-in watchdog timer on the EPX-C3 1631 1629 Single-board computer made by Winsystems, Inc. ··· 1741 1739 1742 1740 config JZ4740_WDT 1743 1741 tristate "Ingenic jz4740 SoC hardware watchdog" 1744 - depends on MIPS 1742 + depends on MIPS || COMPILE_TEST 1745 1743 depends on COMMON_CLK 1746 1744 select WATCHDOG_CORE 1747 1745 select MFD_SYSCON ··· 1800 1798 from the first interrupt, it is then only poked when the 1801 1799 device is written. 1802 1800 1801 + config MARVELL_GTI_WDT 1802 + tristate "Marvell GTI Watchdog driver" 1803 + depends on ARCH_THUNDER || (COMPILE_TEST && 64BIT) 1804 + default y 1805 + select WATCHDOG_CORE 1806 + help 1807 + Marvell GTI hardware supports watchdog timer. First timeout 1808 + works as watchdog pretimeout and installed interrupt handler 1809 + will be called on first timeout. Hardware can generate interrupt 1810 + to SCP on second timeout but it is not enabled, so second 1811 + timeout is ignored. If device poke does not happen then system 1812 + will reboot on third timeout. 1813 + 1803 1814 config BCM2835_WDT 1804 1815 tristate "Broadcom BCM2835 hardware watchdog" 1805 1816 depends on ARCH_BCM2835 || (OF && COMPILE_TEST) ··· 1838 1823 1839 1824 config BCM_KONA_WDT_DEBUG 1840 1825 bool "DEBUGFS support for BCM Kona Watchdog" 1841 - depends on BCM_KONA_WDT 1826 + depends on BCM_KONA_WDT || COMPILE_TEST 1842 1827 help 1843 1828 If enabled, adds /sys/kernel/debug/bcm_kona_wdt/info which provides 1844 1829 access to the driver's internal data structures as well as watchdog ··· 1879 1864 1880 1865 config LOONGSON1_WDT 1881 1866 tristate "Loongson1 SoC hardware watchdog" 1882 - depends on MACH_LOONGSON32 1867 + depends on MACH_LOONGSON32 || COMPILE_TEST 1883 1868 select WATCHDOG_CORE 1884 1869 help 1885 1870 Hardware driver for the Loongson1 SoC Watchdog Timer. ··· 1893 1878 1894 1879 config GXP_WATCHDOG 1895 1880 tristate "HPE GXP watchdog support" 1896 - depends on ARCH_HPE_GXP 1881 + depends on ARCH_HPE_GXP || COMPILE_TEST 1897 1882 select WATCHDOG_CORE 1898 1883 help 1899 1884 Say Y here to include support for the watchdog timer
+1
drivers/watchdog/Makefile
··· 98 98 obj-$(CONFIG_MSC313E_WATCHDOG) += msc313e_wdt.o 99 99 obj-$(CONFIG_APPLE_WATCHDOG) += apple_wdt.o 100 100 obj-$(CONFIG_SUNPLUS_WATCHDOG) += sunplus_wdt.o 101 + obj-$(CONFIG_MARVELL_GTI_WDT) += marvell_gti_wdt.o 101 102 102 103 # X86 (i386 + ia64 + x86_64) Architecture 103 104 obj-$(CONFIG_ACQUIRE_WDT) += acquirewdt.o
-1
drivers/watchdog/armada_37xx_wdt.c
··· 14 14 #include <linux/module.h> 15 15 #include <linux/moduleparam.h> 16 16 #include <linux/of.h> 17 - #include <linux/of_device.h> 18 17 #include <linux/platform_device.h> 19 18 #include <linux/regmap.h> 20 19 #include <linux/types.h>
+1 -2
drivers/watchdog/at91rm9200_wdt.c
··· 18 18 #include <linux/mfd/syscon.h> 19 19 #include <linux/mfd/syscon/atmel-st.h> 20 20 #include <linux/miscdevice.h> 21 + #include <linux/mod_devicetable.h> 21 22 #include <linux/module.h> 22 23 #include <linux/moduleparam.h> 23 24 #include <linux/platform_device.h> ··· 27 26 #include <linux/types.h> 28 27 #include <linux/watchdog.h> 29 28 #include <linux/uaccess.h> 30 - #include <linux/of.h> 31 - #include <linux/of_device.h> 32 29 33 30 #define WDT_DEFAULT_TIME 5 /* seconds */ 34 31 #define WDT_MAX_TIME 256 /* seconds */
+1 -1
drivers/watchdog/cpwd.c
··· 31 31 #include <linux/mutex.h> 32 32 #include <linux/io.h> 33 33 #include <linux/of.h> 34 - #include <linux/of_device.h> 34 + #include <linux/platform_device.h> 35 35 #include <linux/uaccess.h> 36 36 37 37 #include <asm/irq.h>
+2 -4
drivers/watchdog/ftwdt010_wdt.c
··· 14 14 #include <linux/io.h> 15 15 #include <linux/kernel.h> 16 16 #include <linux/module.h> 17 - #include <linux/of_device.h> 17 + #include <linux/mod_devicetable.h> 18 18 #include <linux/platform_device.h> 19 19 #include <linux/slab.h> 20 20 #include <linux/watchdog.h> ··· 221 221 ftwdt010_wdt_resume) 222 222 }; 223 223 224 - #ifdef CONFIG_OF 225 224 static const struct of_device_id ftwdt010_wdt_match[] = { 226 225 { .compatible = "faraday,ftwdt010" }, 227 226 { .compatible = "cortina,gemini-watchdog" }, 228 227 {}, 229 228 }; 230 229 MODULE_DEVICE_TABLE(of, ftwdt010_wdt_match); 231 - #endif 232 230 233 231 static struct platform_driver ftwdt010_wdt_driver = { 234 232 .probe = ftwdt010_wdt_probe, 235 233 .driver = { 236 234 .name = "ftwdt010-wdt", 237 - .of_match_table = of_match_ptr(ftwdt010_wdt_match), 235 + .of_match_table = ftwdt010_wdt_match, 238 236 .pm = &ftwdt010_wdt_dev_pm_ops, 239 237 }, 240 238 };
+1 -1
drivers/watchdog/gef_wdt.c
··· 31 31 #include <linux/fs.h> 32 32 #include <linux/of.h> 33 33 #include <linux/of_address.h> 34 - #include <linux/of_platform.h> 34 + #include <linux/platform_device.h> 35 35 #include <linux/io.h> 36 36 #include <linux/uaccess.h> 37 37
+2 -3
drivers/watchdog/imx2_wdt.c
··· 26 26 #include <linux/kernel.h> 27 27 #include <linux/module.h> 28 28 #include <linux/moduleparam.h> 29 - #include <linux/of_address.h> 30 - #include <linux/of_device.h> 29 + #include <linux/of.h> 31 30 #include <linux/platform_device.h> 32 31 #include <linux/regmap.h> 33 32 #include <linux/watchdog.h> ··· 374 375 */ 375 376 imx2_wdt_set_timeout(wdog, IMX2_WDT_MAX_TIME); 376 377 imx2_wdt_ping(wdog); 377 - dev_crit(&pdev->dev, "Device shutdown: Expect reboot!\n"); 378 + dev_crit(&pdev->dev, "Device shutdown.\n"); 378 379 } 379 380 } 380 381
-1
drivers/watchdog/imx7ulp_wdt.c
··· 9 9 #include <linux/kernel.h> 10 10 #include <linux/module.h> 11 11 #include <linux/of.h> 12 - #include <linux/of_device.h> 13 12 #include <linux/platform_device.h> 14 13 #include <linux/reboot.h> 15 14 #include <linux/watchdog.h>
+1
drivers/watchdog/intel-mid_wdt.c
··· 203 203 MODULE_AUTHOR("David Cohen <david.a.cohen@linux.intel.com>"); 204 204 MODULE_DESCRIPTION("Watchdog Driver for Intel MID platform"); 205 205 MODULE_LICENSE("GPL"); 206 + MODULE_ALIAS("platform:intel_mid_wdt");
+2 -1
drivers/watchdog/lantiq_wdt.c
··· 9 9 #include <linux/module.h> 10 10 #include <linux/bitops.h> 11 11 #include <linux/watchdog.h> 12 - #include <linux/of_platform.h> 12 + #include <linux/of.h> 13 + #include <linux/platform_device.h> 13 14 #include <linux/uaccess.h> 14 15 #include <linux/clk.h> 15 16 #include <linux/io.h>
+1
drivers/watchdog/loongson1_wdt.c
··· 4 4 */ 5 5 6 6 #include <linux/clk.h> 7 + #include <linux/io.h> 7 8 #include <linux/module.h> 8 9 #include <linux/of.h> 9 10 #include <linux/platform_device.h>
+340
drivers/watchdog/marvell_gti_wdt.c
··· 1 + // SPDX-License-Identifier: GPL-2.0 2 + /* Marvell GTI Watchdog driver 3 + * 4 + * Copyright (C) 2023 Marvell. 5 + */ 6 + 7 + #include <linux/clk.h> 8 + #include <linux/interrupt.h> 9 + #include <linux/io.h> 10 + #include <linux/module.h> 11 + #include <linux/of_platform.h> 12 + #include <linux/platform_device.h> 13 + #include <linux/watchdog.h> 14 + 15 + /* 16 + * Hardware supports following mode of operation: 17 + * 1) Interrupt Only: 18 + * This will generate the interrupt to arm core whenever timeout happens. 19 + * 20 + * 2) Interrupt + del3t (Interrupt to firmware (SCP processor)). 21 + * This will generate interrupt to arm core on 1st timeout happens 22 + * This will generate interrupt to SCP processor on 2nd timeout happens 23 + * 24 + * 3) Interrupt + Interrupt to SCP processor (called delt3t) + reboot. 25 + * This will generate interrupt to arm core on 1st timeout happens 26 + * Will generate interrupt to SCP processor on 2nd timeout happens, 27 + * if interrupt is configured. 28 + * Reboot on 3rd timeout. 29 + * 30 + * Driver will use hardware in mode-3 above so that system can reboot in case 31 + * a hardware hang. Also h/w is configured not to generate SCP interrupt, so 32 + * effectively 2nd timeout is ignored within hardware. 33 + * 34 + * First timeout is effectively watchdog pretimeout. 35 + */ 36 + 37 + /* GTI CWD Watchdog (GTI_CWD_WDOG) Register */ 38 + #define GTI_CWD_WDOG(reg_offset) (0x8 * (reg_offset)) 39 + #define GTI_CWD_WDOG_MODE_INT_DEL3T_RST 0x3 40 + #define GTI_CWD_WDOG_MODE_MASK GENMASK_ULL(1, 0) 41 + #define GTI_CWD_WDOG_LEN_SHIFT 4 42 + #define GTI_CWD_WDOG_LEN_MASK GENMASK_ULL(19, 4) 43 + #define GTI_CWD_WDOG_CNT_SHIFT 20 44 + #define GTI_CWD_WDOG_CNT_MASK GENMASK_ULL(43, 20) 45 + 46 + /* GTI CWD Watchdog Interrupt (GTI_CWD_INT) Register */ 47 + #define GTI_CWD_INT 0x200 48 + #define GTI_CWD_INT_PENDING_STATUS(bit) BIT_ULL(bit) 49 + 50 + /* GTI CWD Watchdog Interrupt Enable Clear (GTI_CWD_INT_ENA_CLR) Register */ 51 + #define GTI_CWD_INT_ENA_CLR 0x210 52 + #define GTI_CWD_INT_ENA_CLR_VAL(bit) BIT_ULL(bit) 53 + 54 + /* GTI CWD Watchdog Interrupt Enable Set (GTI_CWD_INT_ENA_SET) Register */ 55 + #define GTI_CWD_INT_ENA_SET 0x218 56 + #define GTI_CWD_INT_ENA_SET_VAL(bit) BIT_ULL(bit) 57 + 58 + /* GTI CWD Watchdog Poke (GTI_CWD_POKE) Registers */ 59 + #define GTI_CWD_POKE(reg_offset) (0x10000 + 0x8 * (reg_offset)) 60 + #define GTI_CWD_POKE_VAL 1 61 + 62 + struct gti_match_data { 63 + u32 gti_num_timers; 64 + }; 65 + 66 + static const struct gti_match_data match_data_octeontx2 = { 67 + .gti_num_timers = 54, 68 + }; 69 + 70 + static const struct gti_match_data match_data_cn10k = { 71 + .gti_num_timers = 64, 72 + }; 73 + 74 + struct gti_wdt_priv { 75 + struct watchdog_device wdev; 76 + void __iomem *base; 77 + u32 clock_freq; 78 + struct clk *sclk; 79 + /* wdt_timer_idx used for timer to be used for system watchdog */ 80 + u32 wdt_timer_idx; 81 + const struct gti_match_data *data; 82 + }; 83 + 84 + static irqreturn_t gti_wdt_interrupt(int irq, void *data) 85 + { 86 + struct watchdog_device *wdev = data; 87 + struct gti_wdt_priv *priv = watchdog_get_drvdata(wdev); 88 + 89 + /* Clear Interrupt Pending Status */ 90 + writeq(GTI_CWD_INT_PENDING_STATUS(priv->wdt_timer_idx), 91 + priv->base + GTI_CWD_INT); 92 + 93 + watchdog_notify_pretimeout(wdev); 94 + 95 + return IRQ_HANDLED; 96 + } 97 + 98 + static int gti_wdt_ping(struct watchdog_device *wdev) 99 + { 100 + struct gti_wdt_priv *priv = watchdog_get_drvdata(wdev); 101 + 102 + writeq(GTI_CWD_POKE_VAL, 103 + priv->base + GTI_CWD_POKE(priv->wdt_timer_idx)); 104 + 105 + return 0; 106 + } 107 + 108 + static int gti_wdt_start(struct watchdog_device *wdev) 109 + { 110 + struct gti_wdt_priv *priv = watchdog_get_drvdata(wdev); 111 + u64 regval; 112 + 113 + if (!wdev->pretimeout) 114 + return -EINVAL; 115 + 116 + set_bit(WDOG_HW_RUNNING, &wdev->status); 117 + 118 + /* Clear any pending interrupt */ 119 + writeq(GTI_CWD_INT_PENDING_STATUS(priv->wdt_timer_idx), 120 + priv->base + GTI_CWD_INT); 121 + 122 + /* Enable Interrupt */ 123 + writeq(GTI_CWD_INT_ENA_SET_VAL(priv->wdt_timer_idx), 124 + priv->base + GTI_CWD_INT_ENA_SET); 125 + 126 + /* Set (Interrupt + SCP interrupt (DEL3T) + core domain reset) Mode */ 127 + regval = readq(priv->base + GTI_CWD_WDOG(priv->wdt_timer_idx)); 128 + regval |= GTI_CWD_WDOG_MODE_INT_DEL3T_RST; 129 + writeq(regval, priv->base + GTI_CWD_WDOG(priv->wdt_timer_idx)); 130 + 131 + return 0; 132 + } 133 + 134 + static int gti_wdt_stop(struct watchdog_device *wdev) 135 + { 136 + struct gti_wdt_priv *priv = watchdog_get_drvdata(wdev); 137 + u64 regval; 138 + 139 + /* Disable Interrupt */ 140 + writeq(GTI_CWD_INT_ENA_CLR_VAL(priv->wdt_timer_idx), 141 + priv->base + GTI_CWD_INT_ENA_CLR); 142 + 143 + /* Set GTI_CWD_WDOG.Mode = 0 to stop the timer */ 144 + regval = readq(priv->base + GTI_CWD_WDOG(priv->wdt_timer_idx)); 145 + regval &= ~GTI_CWD_WDOG_MODE_MASK; 146 + writeq(regval, priv->base + GTI_CWD_WDOG(priv->wdt_timer_idx)); 147 + 148 + return 0; 149 + } 150 + 151 + static int gti_wdt_settimeout(struct watchdog_device *wdev, 152 + unsigned int timeout) 153 + { 154 + struct gti_wdt_priv *priv = watchdog_get_drvdata(wdev); 155 + u64 timeout_wdog, regval; 156 + 157 + /* Update new timeout */ 158 + wdev->timeout = timeout; 159 + 160 + /* Pretimeout is 1/3 of timeout */ 161 + wdev->pretimeout = timeout / 3; 162 + 163 + /* Get clock cycles from pretimeout */ 164 + timeout_wdog = (u64)priv->clock_freq * wdev->pretimeout; 165 + 166 + /* Watchdog counts in 1024 cycle steps */ 167 + timeout_wdog = timeout_wdog >> 10; 168 + 169 + /* GTI_CWD_WDOG.CNT: reload counter is 16-bit */ 170 + timeout_wdog = (timeout_wdog + 0xff) >> 8; 171 + if (timeout_wdog >= 0x10000) 172 + timeout_wdog = 0xffff; 173 + 174 + /* 175 + * GTI_CWD_WDOG.LEN is 24bit, lower 8-bits should be zero and 176 + * upper 16-bits are same as GTI_CWD_WDOG.CNT 177 + */ 178 + regval = readq(priv->base + GTI_CWD_WDOG(priv->wdt_timer_idx)); 179 + regval &= GTI_CWD_WDOG_MODE_MASK; 180 + regval |= (timeout_wdog << (GTI_CWD_WDOG_CNT_SHIFT + 8)) | 181 + (timeout_wdog << GTI_CWD_WDOG_LEN_SHIFT); 182 + writeq(regval, priv->base + GTI_CWD_WDOG(priv->wdt_timer_idx)); 183 + 184 + return 0; 185 + } 186 + 187 + static int gti_wdt_set_pretimeout(struct watchdog_device *wdev, 188 + unsigned int timeout) 189 + { 190 + struct gti_wdt_priv *priv = watchdog_get_drvdata(wdev); 191 + struct watchdog_device *wdog_dev = &priv->wdev; 192 + 193 + /* pretimeout should 1/3 of max_timeout */ 194 + if (timeout * 3 <= wdog_dev->max_timeout) 195 + return gti_wdt_settimeout(wdev, timeout * 3); 196 + 197 + return -EINVAL; 198 + } 199 + 200 + static void gti_clk_disable_unprepare(void *data) 201 + { 202 + clk_disable_unprepare(data); 203 + } 204 + 205 + static int gti_wdt_get_cntfrq(struct platform_device *pdev, 206 + struct gti_wdt_priv *priv) 207 + { 208 + int err; 209 + 210 + priv->sclk = devm_clk_get_enabled(&pdev->dev, NULL); 211 + if (IS_ERR(priv->sclk)) 212 + return PTR_ERR(priv->sclk); 213 + 214 + err = devm_add_action_or_reset(&pdev->dev, 215 + gti_clk_disable_unprepare, priv->sclk); 216 + if (err) 217 + return err; 218 + 219 + priv->clock_freq = clk_get_rate(priv->sclk); 220 + if (!priv->clock_freq) 221 + return -EINVAL; 222 + 223 + return 0; 224 + } 225 + 226 + static const struct watchdog_info gti_wdt_ident = { 227 + .identity = "Marvell GTI watchdog", 228 + .options = WDIOF_SETTIMEOUT | WDIOF_PRETIMEOUT | WDIOF_KEEPALIVEPING | 229 + WDIOF_MAGICCLOSE | WDIOF_CARDRESET, 230 + }; 231 + 232 + static const struct watchdog_ops gti_wdt_ops = { 233 + .owner = THIS_MODULE, 234 + .start = gti_wdt_start, 235 + .stop = gti_wdt_stop, 236 + .ping = gti_wdt_ping, 237 + .set_timeout = gti_wdt_settimeout, 238 + .set_pretimeout = gti_wdt_set_pretimeout, 239 + }; 240 + 241 + static int gti_wdt_probe(struct platform_device *pdev) 242 + { 243 + struct gti_wdt_priv *priv; 244 + struct device *dev = &pdev->dev; 245 + struct watchdog_device *wdog_dev; 246 + u64 max_pretimeout; 247 + u32 wdt_idx; 248 + int irq; 249 + int err; 250 + 251 + priv = devm_kzalloc(&pdev->dev, sizeof(*priv), GFP_KERNEL); 252 + if (!priv) 253 + return -ENOMEM; 254 + 255 + priv->base = devm_platform_ioremap_resource(pdev, 0); 256 + if (IS_ERR(priv->base)) 257 + return dev_err_probe(&pdev->dev, PTR_ERR(priv->base), 258 + "reg property not valid/found\n"); 259 + 260 + err = gti_wdt_get_cntfrq(pdev, priv); 261 + if (err) 262 + return dev_err_probe(&pdev->dev, err, 263 + "GTI clock frequency not valid/found"); 264 + 265 + priv->data = of_device_get_match_data(dev); 266 + 267 + /* default use last timer for watchdog */ 268 + priv->wdt_timer_idx = priv->data->gti_num_timers - 1; 269 + 270 + err = of_property_read_u32(dev->of_node, "marvell,wdt-timer-index", 271 + &wdt_idx); 272 + if (!err) { 273 + if (wdt_idx >= priv->data->gti_num_timers) 274 + return dev_err_probe(&pdev->dev, err, 275 + "GTI wdog timer index not valid"); 276 + 277 + priv->wdt_timer_idx = wdt_idx; 278 + } 279 + 280 + wdog_dev = &priv->wdev; 281 + wdog_dev->info = &gti_wdt_ident, 282 + wdog_dev->ops = &gti_wdt_ops, 283 + wdog_dev->parent = dev; 284 + /* 285 + * Watchdog counter is 24 bit where lower 8 bits are zeros 286 + * This counter decrements every 1024 clock cycles. 287 + */ 288 + max_pretimeout = (GTI_CWD_WDOG_CNT_MASK >> GTI_CWD_WDOG_CNT_SHIFT); 289 + max_pretimeout &= ~0xFFUL; 290 + max_pretimeout = (max_pretimeout * 1024) / priv->clock_freq; 291 + wdog_dev->pretimeout = max_pretimeout; 292 + 293 + /* Maximum timeout is 3 times the pretimeout */ 294 + wdog_dev->max_timeout = max_pretimeout * 3; 295 + /* Minimum first timeout (pretimeout) is 1, so min_timeout as 3 */ 296 + wdog_dev->min_timeout = 3; 297 + wdog_dev->timeout = wdog_dev->pretimeout; 298 + 299 + watchdog_set_drvdata(wdog_dev, priv); 300 + platform_set_drvdata(pdev, priv); 301 + gti_wdt_settimeout(wdog_dev, wdog_dev->timeout); 302 + watchdog_stop_on_reboot(wdog_dev); 303 + watchdog_stop_on_unregister(wdog_dev); 304 + 305 + err = devm_watchdog_register_device(dev, wdog_dev); 306 + if (err) 307 + return err; 308 + 309 + irq = platform_get_irq(pdev, 0); 310 + if (irq < 0) 311 + return dev_err_probe(&pdev->dev, irq, "IRQ resource not found\n"); 312 + 313 + err = devm_request_irq(dev, irq, gti_wdt_interrupt, 0, 314 + pdev->name, &priv->wdev); 315 + if (err) 316 + return dev_err_probe(dev, err, "Failed to register interrupt handler\n"); 317 + 318 + dev_info(dev, "Watchdog enabled (timeout=%d sec)\n", wdog_dev->timeout); 319 + return 0; 320 + } 321 + 322 + static const struct of_device_id gti_wdt_of_match[] = { 323 + { .compatible = "marvell,cn9670-wdt", .data = &match_data_octeontx2}, 324 + { .compatible = "marvell,cn10624-wdt", .data = &match_data_cn10k}, 325 + { }, 326 + }; 327 + MODULE_DEVICE_TABLE(of, gti_wdt_of_match); 328 + 329 + static struct platform_driver gti_wdt_driver = { 330 + .driver = { 331 + .name = "gti-wdt", 332 + .of_match_table = gti_wdt_of_match, 333 + }, 334 + .probe = gti_wdt_probe, 335 + }; 336 + module_platform_driver(gti_wdt_driver); 337 + 338 + MODULE_AUTHOR("Bharat Bhushan <bbhushan2@marvell.com>"); 339 + MODULE_DESCRIPTION("Marvell GTI watchdog driver"); 340 + MODULE_LICENSE("GPL");
-1
drivers/watchdog/menz69_wdt.c
··· 153 153 static struct mcb_driver men_z069_driver = { 154 154 .driver = { 155 155 .name = "z069-wdt", 156 - .owner = THIS_MODULE, 157 156 }, 158 157 .probe = men_z069_probe, 159 158 .remove = men_z069_remove,
+18 -3
drivers/watchdog/meson_gxbb_wdt.c
··· 22 22 23 23 #define GXBB_WDT_CTRL_CLKDIV_EN BIT(25) 24 24 #define GXBB_WDT_CTRL_CLK_EN BIT(24) 25 - #define GXBB_WDT_CTRL_EE_RESET BIT(21) 26 25 #define GXBB_WDT_CTRL_EN BIT(18) 27 26 #define GXBB_WDT_CTRL_DIV_MASK (BIT(18) - 1) 28 27 ··· 42 43 void __iomem *reg_base; 43 44 struct watchdog_device wdt_dev; 44 45 struct clk *clk; 46 + }; 47 + 48 + struct wdt_params { 49 + u32 rst; 45 50 }; 46 51 47 52 static int meson_gxbb_wdt_start(struct watchdog_device *wdt_dev) ··· 143 140 SET_SYSTEM_SLEEP_PM_OPS(meson_gxbb_wdt_suspend, meson_gxbb_wdt_resume) 144 141 }; 145 142 143 + static const struct wdt_params gxbb_params = { 144 + .rst = BIT(21), 145 + }; 146 + 147 + static const struct wdt_params t7_params = { 148 + .rst = BIT(22), 149 + }; 150 + 146 151 static const struct of_device_id meson_gxbb_wdt_dt_ids[] = { 147 - { .compatible = "amlogic,meson-gxbb-wdt", }, 152 + { .compatible = "amlogic,meson-gxbb-wdt", .data = &gxbb_params, }, 153 + { .compatible = "amlogic,t7-wdt", .data = &t7_params, }, 148 154 { /* sentinel */ }, 149 155 }; 150 156 MODULE_DEVICE_TABLE(of, meson_gxbb_wdt_dt_ids); ··· 162 150 { 163 151 struct device *dev = &pdev->dev; 164 152 struct meson_gxbb_wdt *data; 153 + struct wdt_params *params; 165 154 u32 ctrl_reg; 166 155 167 156 data = devm_kzalloc(dev, sizeof(*data), GFP_KERNEL); ··· 176 163 data->clk = devm_clk_get_enabled(dev, NULL); 177 164 if (IS_ERR(data->clk)) 178 165 return PTR_ERR(data->clk); 166 + 167 + params = (struct wdt_params *)of_device_get_match_data(dev); 179 168 180 169 platform_set_drvdata(pdev, data); 181 170 ··· 206 191 /* Setup with 1ms timebase */ 207 192 ctrl_reg |= ((clk_get_rate(data->clk) / 1000) & 208 193 GXBB_WDT_CTRL_DIV_MASK) | 209 - GXBB_WDT_CTRL_EE_RESET | 194 + params->rst | 210 195 GXBB_WDT_CTRL_CLK_EN | 211 196 GXBB_WDT_CTRL_CLKDIV_EN; 212 197
+2 -2
drivers/watchdog/meson_wdt.c
··· 11 11 #include <linux/init.h> 12 12 #include <linux/io.h> 13 13 #include <linux/kernel.h> 14 + #include <linux/mod_devicetable.h> 14 15 #include <linux/module.h> 15 16 #include <linux/moduleparam.h> 16 - #include <linux/of.h> 17 - #include <linux/of_device.h> 18 17 #include <linux/platform_device.h> 18 + #include <linux/property.h> 19 19 #include <linux/types.h> 20 20 #include <linux/watchdog.h> 21 21
+2 -2
drivers/watchdog/mpc8xxx_wdt.c
··· 16 16 #include <linux/fs.h> 17 17 #include <linux/init.h> 18 18 #include <linux/kernel.h> 19 - #include <linux/of_address.h> 20 - #include <linux/of_platform.h> 19 + #include <linux/of.h> 20 + #include <linux/platform_device.h> 21 21 #include <linux/module.h> 22 22 #include <linux/watchdog.h> 23 23 #include <linux/io.h>
-1
drivers/watchdog/mtk_wdt.c
··· 25 25 #include <linux/module.h> 26 26 #include <linux/moduleparam.h> 27 27 #include <linux/of.h> 28 - #include <linux/of_device.h> 29 28 #include <linux/platform_device.h> 30 29 #include <linux/reset-controller.h> 31 30 #include <linux/types.h>
+1 -2
drivers/watchdog/of_xilinx_wdt.c
··· 10 10 #include <linux/clk.h> 11 11 #include <linux/err.h> 12 12 #include <linux/module.h> 13 + #include <linux/platform_device.h> 13 14 #include <linux/types.h> 14 15 #include <linux/kernel.h> 15 16 #include <linux/ioport.h> 16 17 #include <linux/watchdog.h> 17 18 #include <linux/io.h> 18 19 #include <linux/of.h> 19 - #include <linux/of_device.h> 20 - #include <linux/of_address.h> 21 20 22 21 /* Register offsets for the Wdt device */ 23 22 #define XWT_TWCSR0_OFFSET 0x0 /* Control/Status Register0 */
-1
drivers/watchdog/pic32-dmt.c
··· 12 12 #include <linux/kernel.h> 13 13 #include <linux/module.h> 14 14 #include <linux/of.h> 15 - #include <linux/of_device.h> 16 15 #include <linux/platform_device.h> 17 16 #include <linux/pm.h> 18 17 #include <linux/watchdog.h>
-1
drivers/watchdog/pic32-wdt.c
··· 12 12 #include <linux/kernel.h> 13 13 #include <linux/module.h> 14 14 #include <linux/of.h> 15 - #include <linux/of_device.h> 16 15 #include <linux/platform_device.h> 17 16 #include <linux/pm.h> 18 17 #include <linux/watchdog.h>
+1 -1
drivers/watchdog/pika_wdt.c
··· 23 23 #include <linux/bitops.h> 24 24 #include <linux/uaccess.h> 25 25 #include <linux/io.h> 26 + #include <linux/of.h> 26 27 #include <linux/of_address.h> 27 - #include <linux/of_platform.h> 28 28 29 29 #define DRV_NAME "PIKA-WDT" 30 30
+1 -1
drivers/watchdog/pm8916_wdt.c
··· 266 266 .probe = pm8916_wdt_probe, 267 267 .driver = { 268 268 .name = "pm8916-wdt", 269 - .of_match_table = of_match_ptr(pm8916_wdt_id_table), 269 + .of_match_table = pm8916_wdt_id_table, 270 270 .pm = &pm8916_wdt_pm_ops, 271 271 }, 272 272 };
-1
drivers/watchdog/qcom-wdt.c
··· 11 11 #include <linux/of.h> 12 12 #include <linux/platform_device.h> 13 13 #include <linux/watchdog.h> 14 - #include <linux/of_device.h> 15 14 16 15 enum wdt_reg { 17 16 WDT_RST,
+1 -1
drivers/watchdog/rave-sp-wdt.c
··· 13 13 #include <linux/mfd/rave-sp.h> 14 14 #include <linux/module.h> 15 15 #include <linux/nvmem-consumer.h> 16 - #include <linux/of_device.h> 16 + #include <linux/of.h> 17 17 #include <linux/platform_device.h> 18 18 #include <linux/reboot.h> 19 19 #include <linux/slab.h>
+1 -1
drivers/watchdog/riowd.c
··· 14 14 #include <linux/miscdevice.h> 15 15 #include <linux/watchdog.h> 16 16 #include <linux/of.h> 17 - #include <linux/of_device.h> 17 + #include <linux/platform_device.h> 18 18 #include <linux/io.h> 19 19 #include <linux/uaccess.h> 20 20 #include <linux/slab.h>
+48
drivers/watchdog/rti_wdt.c
··· 14 14 #include <linux/mod_devicetable.h> 15 15 #include <linux/module.h> 16 16 #include <linux/moduleparam.h> 17 + #include <linux/of.h> 18 + #include <linux/of_address.h> 17 19 #include <linux/platform_device.h> 18 20 #include <linux/pm_runtime.h> 19 21 #include <linux/types.h> ··· 53 51 #define WDT_PRELOAD_MAX 0xfff 54 52 55 53 #define DWDST BIT(1) 54 + 55 + #define PON_REASON_SOF_NUM 0xBBBBCCCC 56 + #define PON_REASON_MAGIC_NUM 0xDDDDDDDD 57 + #define PON_REASON_EOF_NUM 0xCCCCBBBB 58 + #define RESERVED_MEM_MIN_SIZE 12 56 59 57 60 static int heartbeat = DEFAULT_HEARTBEAT; 58 61 ··· 205 198 struct rti_wdt_device *wdt; 206 199 struct clk *clk; 207 200 u32 last_ping = 0; 201 + struct device_node *node; 202 + u32 reserved_mem_size; 203 + struct resource res; 204 + u32 *vaddr; 205 + u64 paddr; 208 206 209 207 wdt = devm_kzalloc(dev, sizeof(*wdt), GFP_KERNEL); 210 208 if (!wdt) ··· 294 282 dev_warn(dev, "time_left > heartbeat? Assuming last ping just before now.\n"); 295 283 last_ping = 0; 296 284 } 285 + } 286 + 287 + node = of_parse_phandle(pdev->dev.of_node, "memory-region", 0); 288 + if (node) { 289 + ret = of_address_to_resource(node, 0, &res); 290 + if (ret) { 291 + dev_err(dev, "No memory address assigned to the region.\n"); 292 + goto err_iomap; 293 + } 294 + 295 + /* 296 + * If reserved memory is defined for watchdog reset cause. 297 + * Readout the Power-on(PON) reason and pass to bootstatus. 298 + */ 299 + paddr = res.start; 300 + reserved_mem_size = resource_size(&res); 301 + if (reserved_mem_size < RESERVED_MEM_MIN_SIZE) { 302 + dev_err(dev, "The size of reserved memory is too small.\n"); 303 + ret = -EINVAL; 304 + goto err_iomap; 305 + } 306 + 307 + vaddr = memremap(paddr, reserved_mem_size, MEMREMAP_WB); 308 + if (!vaddr) { 309 + dev_err(dev, "Failed to map memory-region.\n"); 310 + ret = -ENOMEM; 311 + goto err_iomap; 312 + } 313 + 314 + if (vaddr[0] == PON_REASON_SOF_NUM && 315 + vaddr[1] == PON_REASON_MAGIC_NUM && 316 + vaddr[2] == PON_REASON_EOF_NUM) { 317 + wdd->bootstatus |= WDIOF_CARDRESET; 318 + } 319 + memset(vaddr, 0, reserved_mem_size); 320 + memunmap(vaddr); 297 321 } 298 322 299 323 watchdog_init_timeout(wdd, heartbeat, dev);
+2 -2
drivers/watchdog/rza_wdt.c
··· 9 9 #include <linux/bitops.h> 10 10 #include <linux/clk.h> 11 11 #include <linux/delay.h> 12 + #include <linux/io.h> 12 13 #include <linux/module.h> 13 - #include <linux/of_address.h> 14 - #include <linux/of_device.h> 14 + #include <linux/of.h> 15 15 #include <linux/platform_device.h> 16 16 #include <linux/watchdog.h> 17 17
+1 -1
drivers/watchdog/rzg2l_wdt.c
··· 11 11 #include <linux/iopoll.h> 12 12 #include <linux/kernel.h> 13 13 #include <linux/module.h> 14 - #include <linux/of_device.h> 14 + #include <linux/of.h> 15 15 #include <linux/platform_device.h> 16 16 #include <linux/pm_runtime.h> 17 17 #include <linux/reset.h>
+9 -7
drivers/watchdog/s3c2410_wdt.c
··· 23 23 #include <linux/slab.h> 24 24 #include <linux/err.h> 25 25 #include <linux/of.h> 26 - #include <linux/of_device.h> 27 26 #include <linux/mfd/syscon.h> 28 27 #include <linux/regmap.h> 29 28 #include <linux/delay.h> ··· 378 379 static int s3c2410wdt_keepalive(struct watchdog_device *wdd) 379 380 { 380 381 struct s3c2410_wdt *wdt = watchdog_get_drvdata(wdd); 382 + unsigned long flags; 381 383 382 - spin_lock(&wdt->lock); 384 + spin_lock_irqsave(&wdt->lock, flags); 383 385 writel(wdt->count, wdt->reg_base + S3C2410_WTCNT); 384 - spin_unlock(&wdt->lock); 386 + spin_unlock_irqrestore(&wdt->lock, flags); 385 387 386 388 return 0; 387 389 } ··· 399 399 static int s3c2410wdt_stop(struct watchdog_device *wdd) 400 400 { 401 401 struct s3c2410_wdt *wdt = watchdog_get_drvdata(wdd); 402 + unsigned long flags; 402 403 403 - spin_lock(&wdt->lock); 404 + spin_lock_irqsave(&wdt->lock, flags); 404 405 __s3c2410wdt_stop(wdt); 405 - spin_unlock(&wdt->lock); 406 + spin_unlock_irqrestore(&wdt->lock, flags); 406 407 407 408 return 0; 408 409 } ··· 412 411 { 413 412 unsigned long wtcon; 414 413 struct s3c2410_wdt *wdt = watchdog_get_drvdata(wdd); 414 + unsigned long flags; 415 415 416 - spin_lock(&wdt->lock); 416 + spin_lock_irqsave(&wdt->lock, flags); 417 417 418 418 __s3c2410wdt_stop(wdt); 419 419 ··· 435 433 writel(wdt->count, wdt->reg_base + S3C2410_WTDAT); 436 434 writel(wdt->count, wdt->reg_base + S3C2410_WTCNT); 437 435 writel(wtcon, wdt->reg_base + S3C2410_WTCON); 438 - spin_unlock(&wdt->lock); 436 + spin_unlock_irqrestore(&wdt->lock, flags); 439 437 440 438 return 0; 441 439 }
+7 -1
drivers/watchdog/sama5d4_wdt.c
··· 11 11 #include <linux/kernel.h> 12 12 #include <linux/module.h> 13 13 #include <linux/of.h> 14 - #include <linux/of_device.h> 15 14 #include <linux/of_irq.h> 16 15 #include <linux/platform_device.h> 17 16 #include <linux/reboot.h> ··· 254 255 struct sama5d4_wdt *wdt; 255 256 void __iomem *regs; 256 257 u32 irq = 0; 258 + u32 reg; 257 259 int ret; 258 260 259 261 wdt = devm_kzalloc(dev, sizeof(*wdt), GFP_KERNEL); ··· 304 304 } 305 305 306 306 watchdog_init_timeout(wdd, wdt_timeout, dev); 307 + 308 + reg = wdt_read(wdt, AT91_WDT_MR); 309 + if (!(reg & AT91_WDT_WDDIS)) { 310 + wdt->mr &= ~AT91_WDT_WDDIS; 311 + set_bit(WDOG_HW_RUNNING, &wdd->status); 312 + } 307 313 308 314 ret = sama5d4_wdt_init(wdt); 309 315 if (ret)
+1 -2
drivers/watchdog/sbsa_gwdt.c
··· 43 43 #include <linux/io.h> 44 44 #include <linux/io-64-nonatomic-lo-hi.h> 45 45 #include <linux/interrupt.h> 46 + #include <linux/mod_devicetable.h> 46 47 #include <linux/module.h> 47 48 #include <linux/moduleparam.h> 48 - #include <linux/of.h> 49 - #include <linux/of_device.h> 50 49 #include <linux/platform_device.h> 51 50 #include <linux/uaccess.h> 52 51 #include <linux/watchdog.h>
+5 -8
drivers/watchdog/starfive-wdt.c
··· 8 8 #include <linux/clk.h> 9 9 #include <linux/iopoll.h> 10 10 #include <linux/module.h> 11 - #include <linux/of_device.h> 11 + #include <linux/of.h> 12 + #include <linux/platform_device.h> 12 13 #include <linux/pm_runtime.h> 13 14 #include <linux/reset.h> 14 15 #include <linux/watchdog.h> ··· 527 526 starfive_wdt_pm_stop(&wdt->wdd); 528 527 } 529 528 530 - #ifdef CONFIG_PM_SLEEP 531 529 static int starfive_wdt_suspend(struct device *dev) 532 530 { 533 531 struct starfive_wdt *wdt = dev_get_drvdata(dev); ··· 556 556 557 557 return starfive_wdt_start(wdt); 558 558 } 559 - #endif /* CONFIG_PM_SLEEP */ 560 559 561 - #ifdef CONFIG_PM 562 560 static int starfive_wdt_runtime_suspend(struct device *dev) 563 561 { 564 562 struct starfive_wdt *wdt = dev_get_drvdata(dev); ··· 572 574 573 575 return starfive_wdt_enable_clock(wdt); 574 576 } 575 - #endif /* CONFIG_PM */ 576 577 577 578 static const struct dev_pm_ops starfive_wdt_pm_ops = { 578 - SET_RUNTIME_PM_OPS(starfive_wdt_runtime_suspend, starfive_wdt_runtime_resume, NULL) 579 - SET_SYSTEM_SLEEP_PM_OPS(starfive_wdt_suspend, starfive_wdt_resume) 579 + RUNTIME_PM_OPS(starfive_wdt_runtime_suspend, starfive_wdt_runtime_resume, NULL) 580 + SYSTEM_SLEEP_PM_OPS(starfive_wdt_suspend, starfive_wdt_resume) 580 581 }; 581 582 582 583 static const struct of_device_id starfive_wdt_match[] = { ··· 591 594 .shutdown = starfive_wdt_shutdown, 592 595 .driver = { 593 596 .name = "starfive-wdt", 594 - .pm = &starfive_wdt_pm_ops, 597 + .pm = pm_ptr(&starfive_wdt_pm_ops), 595 598 .of_match_table = starfive_wdt_match, 596 599 }, 597 600 };
+1 -2
drivers/watchdog/stm32_iwdg.c
··· 17 17 #include <linux/kernel.h> 18 18 #include <linux/module.h> 19 19 #include <linux/of.h> 20 - #include <linux/of_device.h> 21 20 #include <linux/platform_device.h> 22 21 #include <linux/watchdog.h> 23 22 ··· 287 288 .probe = stm32_iwdg_probe, 288 289 .driver = { 289 290 .name = "iwdg", 290 - .of_match_table = of_match_ptr(stm32_iwdg_of_match), 291 + .of_match_table = stm32_iwdg_of_match, 291 292 }, 292 293 }; 293 294 module_platform_driver(stm32_iwdg_driver);
-1
drivers/watchdog/sunxi_wdt.c
··· 18 18 #include <linux/module.h> 19 19 #include <linux/moduleparam.h> 20 20 #include <linux/of.h> 21 - #include <linux/of_device.h> 22 21 #include <linux/platform_device.h> 23 22 #include <linux/types.h> 24 23 #include <linux/watchdog.h>
+1 -1
drivers/watchdog/watchdog_core.c
··· 161 161 struct watchdog_device *wdd; 162 162 163 163 wdd = container_of(nb, struct watchdog_device, reboot_nb); 164 - if (code == SYS_DOWN || code == SYS_HALT) { 164 + if (code == SYS_DOWN || code == SYS_HALT || code == SYS_POWER_OFF) { 165 165 if (watchdog_hw_running(wdd)) { 166 166 int ret; 167 167
+4 -3
drivers/watchdog/xilinx_wwdt.c
··· 9 9 #include <linux/interrupt.h> 10 10 #include <linux/io.h> 11 11 #include <linux/ioport.h> 12 + #include <linux/math64.h> 13 + #include <linux/mod_devicetable.h> 12 14 #include <linux/module.h> 13 - #include <linux/of_device.h> 14 - #include <linux/of_address.h> 15 + #include <linux/platform_device.h> 15 16 #include <linux/watchdog.h> 16 17 17 18 /* Max timeout is calculated at 100MHz source clock */ ··· 72 71 73 72 /* Calculate timeout count */ 74 73 time_out = xdev->freq * wdd->timeout; 75 - closed_timeout = (time_out * xdev->close_percent) / 100; 74 + closed_timeout = div_u64(time_out * xdev->close_percent, 100); 76 75 open_timeout = time_out - closed_timeout; 77 76 wdd->min_hw_heartbeat_ms = xdev->close_percent * 10 * wdd->timeout; 78 77