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

Configure Feed

Select the types of activity you want to include in your feed.

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

Pull watchdog updates from Wim Van Sebroeck:

- iTCO: Drop vendor support

- s3c2410_wdt: Drop S3C2410 support

- Convert mpc8xxx-wdt to YAML

- Several small fixes and improvements

* tag 'linux-watchdog-6.20-rc1' of git://www.linux-watchdog.org/linux-watchdog:
dt-bindings: watchdog: qcom-wdt: Document Glymur watchdog
dt-bindings: watchdog: Convert mpc8xxx-wdt to YAML
dt-bindings: watchdog: samsung-wdt: Split if:then: and constrain more
dt-bindings: watchdog: samsung-wdt: Drop S3C2410
watchdog: s3c2410_wdt: Drop S3C2410 support
dt-bindings: watchdog: samsung-wdt: Define cluster constraints top-level
watchdog: rzv2h_wdt: Discard pm_runtime_put() return value
watchdog: rz: Discard pm_runtime_put() return values
watchdog: Make API functions const correct
watchdog: imx7ulp_wdt: handle the nowayout option
watchdog: sbsa: Update the W_IIDR Implementer bit mask to 0xFFF
watchdog: Always return time left until watchdog times out
watchdog: iTCO: Drop vendor support
watchdog: starfive-wdt: Fix PM reference leak in probe error path
fix it87_wdt early reboot by reporting running timer

+161 -354
-25
Documentation/devicetree/bindings/watchdog/mpc8xxx-wdt.txt
··· 1 - * Freescale mpc8xxx watchdog driver (For 83xx, 86xx and 8xx) 2 - 3 - Required properties: 4 - - compatible: Shall contain one of the following: 5 - "mpc83xx_wdt" for an mpc83xx 6 - "fsl,mpc8610-wdt" for an mpc86xx 7 - "fsl,mpc823-wdt" for an mpc8xx 8 - - reg: base physical address and length of the area hosting the 9 - watchdog registers. 10 - On the 83xx, "Watchdog Timer Registers" area: <0x200 0x100> 11 - On the 86xx, "Watchdog Timer Registers" area: <0xe4000 0x100> 12 - On the 8xx, "General System Interface Unit" area: <0x0 0x10> 13 - 14 - Optional properties: 15 - - reg: additional physical address and length (4) of location of the 16 - Reset Status Register (called RSTRSCR on the mpc86xx) 17 - On the 83xx, it is located at offset 0x910 18 - On the 86xx, it is located at offset 0xe0094 19 - On the 8xx, it is located at offset 0x288 20 - 21 - Example: 22 - WDT: watchdog@0 { 23 - compatible = "fsl,mpc823-wdt"; 24 - reg = <0x0 0x10 0x288 0x4>; 25 - };
+64
Documentation/devicetree/bindings/watchdog/mpc8xxx-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/mpc8xxx-wdt.yaml# 5 + $schema: http://devicetree.org/meta-schemas/core.yaml# 6 + 7 + title: Freescale MPC8xxx watchdog timer (For 83xx, 86xx and 8xx) 8 + 9 + maintainers: 10 + - J. Neuschäfer <j.ne@posteo.net> 11 + 12 + properties: 13 + compatible: 14 + enum: 15 + - mpc83xx_wdt # for an mpc83xx 16 + - fsl,mpc8610-wdt # for an mpc86xx 17 + - fsl,mpc823-wdt # for an mpc8xx 18 + 19 + device_type: 20 + const: watchdog 21 + 22 + reg: 23 + minItems: 1 24 + items: 25 + - description: | 26 + Base physical address and length of the area hosting the watchdog 27 + registers. 28 + 29 + On the 83xx, "Watchdog Timer Registers" area: <0x200 0x100> 30 + On the 86xx, "Watchdog Timer Registers" area: <0xe4000 0x100> 31 + On the 8xx, "General System Interface Unit" area: <0x0 0x10> 32 + 33 + - description: | 34 + Additional optional physical address and length (4) of location of 35 + the Reset Status Register (called RSTRSCR on the mpc86xx) 36 + 37 + On the 83xx, it is located at offset 0x910 38 + On the 86xx, it is located at offset 0xe0094 39 + On the 8xx, it is located at offset 0x288 40 + 41 + required: 42 + - compatible 43 + - reg 44 + 45 + allOf: 46 + - $ref: watchdog.yaml# 47 + 48 + additionalProperties: false 49 + 50 + examples: 51 + - | 52 + watchdog@0 { 53 + compatible = "fsl,mpc823-wdt"; 54 + reg = <0x0 0x10 0x288 0x4>; 55 + }; 56 + 57 + - | 58 + watchdog@200 { 59 + compatible = "mpc83xx_wdt"; 60 + reg = <0x200 0x100>; 61 + device_type = "watchdog"; 62 + }; 63 + 64 + ...
+1
Documentation/devicetree/bindings/watchdog/qcom-wdt.yaml
··· 17 17 oneOf: 18 18 - items: 19 19 - enum: 20 + - qcom,apss-wdt-glymur 20 21 - qcom,kpss-wdt-ipq4019 21 22 - qcom,apss-wdt-ipq5018 22 23 - qcom,apss-wdt-ipq5332
+52 -20
Documentation/devicetree/bindings/watchdog/samsung-wdt.yaml
··· 19 19 oneOf: 20 20 - enum: 21 21 - google,gs101-wdt # for Google gs101 22 - - samsung,s3c2410-wdt # for S3C2410 23 22 - samsung,s3c6410-wdt # for S3C6410, S5PV210 and Exynos4 24 23 - samsung,exynos5250-wdt # for Exynos5250 25 24 - samsung,exynos5420-wdt # for Exynos5420 ··· 48 49 49 50 samsung,cluster-index: 50 51 $ref: /schemas/types.yaml#/definitions/uint32 52 + enum: [0, 1, 2] 51 53 description: 52 54 Index of CPU cluster on which watchdog is running (in case of Exynos850, 53 55 Exynos990 or Google gs101). ··· 74 74 contains: 75 75 enum: 76 76 - google,gs101-wdt 77 - - samsung,exynos5250-wdt 78 - - samsung,exynos5420-wdt 79 - - samsung,exynos7-wdt 80 77 - samsung,exynos850-wdt 81 - - samsung,exynos990-wdt 82 - - samsung,exynosautov9-wdt 83 - - samsung,exynosautov920-wdt 84 - then: 85 - required: 86 - - samsung,syscon-phandle 87 - - if: 88 - properties: 89 - compatible: 90 - contains: 91 - enum: 92 - - google,gs101-wdt 93 - - samsung,exynos850-wdt 94 - - samsung,exynos990-wdt 95 78 - samsung,exynosautov9-wdt 96 79 - samsung,exynosautov920-wdt 97 80 then: ··· 88 105 - const: watchdog 89 106 - const: watchdog_src 90 107 samsung,cluster-index: 91 - enum: [0, 1, 2] 108 + enum: [0, 1] 92 109 required: 93 110 - samsung,cluster-index 94 - else: 111 + - samsung,syscon-phandle 112 + 113 + - if: 114 + properties: 115 + compatible: 116 + contains: 117 + enum: 118 + - samsung,exynos990-wdt 119 + then: 120 + properties: 121 + clocks: 122 + items: 123 + - description: Bus clock, used for register interface 124 + - description: Source clock (driving watchdog counter) 125 + clock-names: 126 + items: 127 + - const: watchdog 128 + - const: watchdog_src 129 + required: 130 + - samsung,cluster-index 131 + - samsung,syscon-phandle 132 + 133 + - if: 134 + properties: 135 + compatible: 136 + contains: 137 + enum: 138 + - samsung,exynos5250-wdt 139 + - samsung,exynos5420-wdt 140 + - samsung,exynos7-wdt 141 + then: 95 142 properties: 96 143 clocks: 97 144 items: ··· 130 117 items: 131 118 - const: watchdog 132 119 samsung,cluster-index: false 120 + required: 121 + - samsung,syscon-phandle 122 + 123 + - if: 124 + properties: 125 + compatible: 126 + contains: 127 + enum: 128 + - samsung,s3c6410-wdt 129 + then: 130 + properties: 131 + clocks: 132 + items: 133 + - description: Bus clock, which is also a source clock 134 + clock-names: 135 + items: 136 + - const: watchdog 137 + samsung,cluster-index: false 138 + samsung,syscon-phandle: false 133 139 134 140 unevaluatedProperties: false 135 141
+1 -1
Documentation/watchdog/watchdog-kernel-api.rst
··· 293 293 294 294 extern int watchdog_init_timeout(struct watchdog_device *wdd, 295 295 unsigned int timeout_parm, 296 - struct device *dev); 296 + const struct device *dev); 297 297 298 298 The watchdog_init_timeout function allows you to initialize the timeout field 299 299 using the module timeout parameter or by retrieving the timeout-sec property from
-7
Documentation/watchdog/watchdog-parameters.rst
··· 209 209 210 210 ------------------------------------------------- 211 211 212 - iTCO_vendor_support: 213 - vendorsupport: 214 - iTCO vendor specific support mode, default=0 (none), 215 - 1=SuperMicro Pent3, 2=SuperMicro Pent4+, 911=Broken SMI BIOS 216 - 217 - ------------------------------------------------- 218 - 219 212 ib700wdt: 220 213 timeout: 221 214 Watchdog timeout in seconds. 0<= timeout <=30, default=30.
-8
drivers/watchdog/Kconfig
··· 1429 1429 To compile this driver as a module, choose M here: the 1430 1430 module will be called iTCO_wdt. 1431 1431 1432 - config ITCO_VENDOR_SUPPORT 1433 - bool "Intel TCO Timer/Watchdog Specific Vendor Support" 1434 - depends on ITCO_WDT 1435 - help 1436 - Add vendor specific support to the intel TCO timer based watchdog 1437 - devices. At this moment we only have additional support for some 1438 - SuperMicro Inc. motherboards. 1439 - 1440 1432 config IT8712F_WDT 1441 1433 tristate "IT8712F (Smart Guardian) Watchdog Timer" 1442 1434 depends on (X86 || COMPILE_TEST) && HAS_IOPORT
-3
drivers/watchdog/Makefile
··· 127 127 obj-$(CONFIG_ITCO_WDT) += iTCO_wdt.o 128 128 obj-$(CONFIG_LENOVO_SE10_WDT) += lenovo_se10_wdt.o 129 129 obj-$(CONFIG_LENOVO_SE30_WDT) += lenovo_se30_wdt.o 130 - ifeq ($(CONFIG_ITCO_VENDOR_SUPPORT),y) 131 - obj-$(CONFIG_ITCO_WDT) += iTCO_vendor_support.o 132 - endif 133 130 obj-$(CONFIG_IT8712F_WDT) += it8712f_wdt.o 134 131 obj-$(CONFIG_IT87_WDT) += it87_wdt.o 135 132 obj-$(CONFIG_HP_WATCHDOG) += hpwdt.o
-14
drivers/watchdog/iTCO_vendor.h
··· 1 - /* SPDX-License-Identifier: GPL-2.0 */ 2 - /* iTCO Vendor Specific Support hooks */ 3 - #ifdef CONFIG_ITCO_VENDOR_SUPPORT 4 - extern int iTCO_vendorsupport; 5 - extern void iTCO_vendor_pre_start(struct resource *, unsigned int); 6 - extern void iTCO_vendor_pre_stop(struct resource *); 7 - extern int iTCO_vendor_check_noreboot_on(void); 8 - #else 9 - #define iTCO_vendorsupport 0 10 - #define iTCO_vendor_pre_start(acpibase, heartbeat) {} 11 - #define iTCO_vendor_pre_stop(acpibase) {} 12 - #define iTCO_vendor_check_noreboot_on() 1 13 - /* 1=check noreboot; 0=don't check */ 14 - #endif
-216
drivers/watchdog/iTCO_vendor_support.c
··· 1 - // SPDX-License-Identifier: GPL-2.0+ 2 - /* 3 - * intel TCO vendor specific watchdog driver support 4 - * 5 - * (c) Copyright 2006-2009 Wim Van Sebroeck <wim@iguana.be>. 6 - * 7 - * Neither Wim Van Sebroeck nor Iguana vzw. admit liability nor 8 - * provide warranty for any of this software. This material is 9 - * provided "AS-IS" and at no charge. 10 - */ 11 - 12 - /* 13 - * Includes, defines, variables, module parameters, ... 14 - */ 15 - 16 - #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt 17 - 18 - /* Module and version information */ 19 - #define DRV_NAME "iTCO_vendor_support" 20 - #define DRV_VERSION "1.04" 21 - 22 - /* Includes */ 23 - #include <linux/module.h> /* For module specific items */ 24 - #include <linux/moduleparam.h> /* For new moduleparam's */ 25 - #include <linux/types.h> /* For standard types (like size_t) */ 26 - #include <linux/errno.h> /* For the -ENODEV/... values */ 27 - #include <linux/kernel.h> /* For printk/panic/... */ 28 - #include <linux/init.h> /* For __init/__exit/... */ 29 - #include <linux/ioport.h> /* For io-port access */ 30 - #include <linux/io.h> /* For inb/outb/... */ 31 - 32 - #include "iTCO_vendor.h" 33 - 34 - /* List of vendor support modes */ 35 - /* SuperMicro Pentium 3 Era 370SSE+-OEM1/P3TSSE */ 36 - #define SUPERMICRO_OLD_BOARD 1 37 - /* SuperMicro Pentium 4 / Xeon 4 / EMT64T Era Systems - no longer supported */ 38 - #define SUPERMICRO_NEW_BOARD 2 39 - /* Broken BIOS */ 40 - #define BROKEN_BIOS 911 41 - 42 - int iTCO_vendorsupport; 43 - EXPORT_SYMBOL(iTCO_vendorsupport); 44 - 45 - module_param_named(vendorsupport, iTCO_vendorsupport, int, 0); 46 - MODULE_PARM_DESC(vendorsupport, "iTCO vendor specific support mode, default=" 47 - "0 (none), 1=SuperMicro Pent3, 911=Broken SMI BIOS"); 48 - 49 - /* 50 - * Vendor Specific Support 51 - */ 52 - 53 - /* 54 - * Vendor Support: 1 55 - * Board: Super Micro Computer Inc. 370SSE+-OEM1/P3TSSE 56 - * iTCO chipset: ICH2 57 - * 58 - * Code contributed by: R. Seretny <lkpatches@paypc.com> 59 - * Documentation obtained by R. Seretny from SuperMicro Technical Support 60 - * 61 - * To enable Watchdog function: 62 - * BIOS setup -> Power -> TCO Logic SMI Enable -> Within5Minutes 63 - * This setting enables SMI to clear the watchdog expired flag. 64 - * If BIOS or CPU fail which may cause SMI hang, then system will 65 - * reboot. When application starts to use watchdog function, 66 - * application has to take over the control from SMI. 67 - * 68 - * For P3TSSE, J36 jumper needs to be removed to enable the Watchdog 69 - * function. 70 - * 71 - * Note: The system will reboot when Expire Flag is set TWICE. 72 - * So, if the watchdog timer is 20 seconds, then the maximum hang 73 - * time is about 40 seconds, and the minimum hang time is about 74 - * 20.6 seconds. 75 - */ 76 - 77 - static void supermicro_old_pre_start(struct resource *smires) 78 - { 79 - unsigned long val32; 80 - 81 - /* Bit 13: TCO_EN -> 0 = Disables TCO logic generating an SMI# */ 82 - val32 = inl(smires->start); 83 - val32 &= 0xffffdfff; /* Turn off SMI clearing watchdog */ 84 - outl(val32, smires->start); /* Needed to activate watchdog */ 85 - } 86 - 87 - static void supermicro_old_pre_stop(struct resource *smires) 88 - { 89 - unsigned long val32; 90 - 91 - /* Bit 13: TCO_EN -> 1 = Enables the TCO logic to generate SMI# */ 92 - val32 = inl(smires->start); 93 - val32 |= 0x00002000; /* Turn on SMI clearing watchdog */ 94 - outl(val32, smires->start); /* Needed to deactivate watchdog */ 95 - } 96 - 97 - /* 98 - * Vendor Support: 911 99 - * Board: Some Intel ICHx based motherboards 100 - * iTCO chipset: ICH7+ 101 - * 102 - * Some Intel motherboards have a broken BIOS implementation: i.e. 103 - * the SMI handler clear's the TIMEOUT bit in the TC01_STS register 104 - * and does not reload the time. Thus the TCO watchdog does not reboot 105 - * the system. 106 - * 107 - * These are the conclusions of Andriy Gapon <avg@icyb.net.ua> after 108 - * debugging: the SMI handler is quite simple - it tests value in 109 - * TCO1_CNT against 0x800, i.e. checks TCO_TMR_HLT. If the bit is set 110 - * the handler goes into an infinite loop, apparently to allow the 111 - * second timeout and reboot. Otherwise it simply clears TIMEOUT bit 112 - * in TCO1_STS and that's it. 113 - * So the logic seems to be reversed, because it is hard to see how 114 - * TIMEOUT can get set to 1 and SMI generated when TCO_TMR_HLT is set 115 - * (other than a transitional effect). 116 - * 117 - * The only fix found to get the motherboard(s) to reboot is to put 118 - * the glb_smi_en bit to 0. This is a dirty hack that bypasses the 119 - * broken code by disabling Global SMI. 120 - * 121 - * WARNING: globally disabling SMI could possibly lead to dramatic 122 - * problems, especially on laptops! I.e. various ACPI things where 123 - * SMI is used for communication between OS and firmware. 124 - * 125 - * Don't use this fix if you don't need to!!! 126 - */ 127 - 128 - static void broken_bios_start(struct resource *smires) 129 - { 130 - unsigned long val32; 131 - 132 - val32 = inl(smires->start); 133 - /* Bit 13: TCO_EN -> 0 = Disables TCO logic generating an SMI# 134 - Bit 0: GBL_SMI_EN -> 0 = No SMI# will be generated by ICH. */ 135 - val32 &= 0xffffdffe; 136 - outl(val32, smires->start); 137 - } 138 - 139 - static void broken_bios_stop(struct resource *smires) 140 - { 141 - unsigned long val32; 142 - 143 - val32 = inl(smires->start); 144 - /* Bit 13: TCO_EN -> 1 = Enables TCO logic generating an SMI# 145 - Bit 0: GBL_SMI_EN -> 1 = Turn global SMI on again. */ 146 - val32 |= 0x00002001; 147 - outl(val32, smires->start); 148 - } 149 - 150 - /* 151 - * Generic Support Functions 152 - */ 153 - 154 - void iTCO_vendor_pre_start(struct resource *smires, 155 - unsigned int heartbeat) 156 - { 157 - switch (iTCO_vendorsupport) { 158 - case SUPERMICRO_OLD_BOARD: 159 - supermicro_old_pre_start(smires); 160 - break; 161 - case BROKEN_BIOS: 162 - broken_bios_start(smires); 163 - break; 164 - } 165 - } 166 - EXPORT_SYMBOL(iTCO_vendor_pre_start); 167 - 168 - void iTCO_vendor_pre_stop(struct resource *smires) 169 - { 170 - switch (iTCO_vendorsupport) { 171 - case SUPERMICRO_OLD_BOARD: 172 - supermicro_old_pre_stop(smires); 173 - break; 174 - case BROKEN_BIOS: 175 - broken_bios_stop(smires); 176 - break; 177 - } 178 - } 179 - EXPORT_SYMBOL(iTCO_vendor_pre_stop); 180 - 181 - int iTCO_vendor_check_noreboot_on(void) 182 - { 183 - switch (iTCO_vendorsupport) { 184 - case SUPERMICRO_OLD_BOARD: 185 - return 0; 186 - default: 187 - return 1; 188 - } 189 - } 190 - EXPORT_SYMBOL(iTCO_vendor_check_noreboot_on); 191 - 192 - static int __init iTCO_vendor_init_module(void) 193 - { 194 - if (iTCO_vendorsupport == SUPERMICRO_NEW_BOARD) { 195 - pr_warn("Option vendorsupport=%d is no longer supported, " 196 - "please use the w83627hf_wdt driver instead\n", 197 - SUPERMICRO_NEW_BOARD); 198 - return -EINVAL; 199 - } 200 - pr_info("vendor-support=%d\n", iTCO_vendorsupport); 201 - return 0; 202 - } 203 - 204 - static void __exit iTCO_vendor_exit_module(void) 205 - { 206 - pr_info("Module Unloaded\n"); 207 - } 208 - 209 - module_init(iTCO_vendor_init_module); 210 - module_exit(iTCO_vendor_exit_module); 211 - 212 - MODULE_AUTHOR("Wim Van Sebroeck <wim@iguana.be>, " 213 - "R. Seretny <lkpatches@paypc.com>"); 214 - MODULE_DESCRIPTION("Intel TCO Vendor Specific WatchDog Timer Driver Support"); 215 - MODULE_VERSION(DRV_VERSION); 216 - MODULE_LICENSE("GPL");
+2 -10
drivers/watchdog/iTCO_wdt.c
··· 63 63 #include <linux/platform_data/itco_wdt.h> 64 64 #include <linux/mfd/intel_pmc_bxt.h> 65 65 66 - #include "iTCO_vendor.h" 67 - 68 66 /* Address definitions for the TCO */ 69 67 /* TCO base address */ 70 68 #define TCOBASE(p) ((p)->tco_res->start) ··· 281 283 struct iTCO_wdt_private *p = watchdog_get_drvdata(wd_dev); 282 284 unsigned int val; 283 285 284 - iTCO_vendor_pre_start(p->smi_res, wd_dev->timeout); 285 - 286 286 /* disable chipset's NO_REBOOT bit */ 287 287 if (p->update_no_reboot_bit(p->no_reboot_priv, false)) { 288 288 dev_err(wd_dev->parent, "failed to reset NO_REBOOT flag, reboot disabled by hardware/BIOS\n"); ··· 309 313 { 310 314 struct iTCO_wdt_private *p = watchdog_get_drvdata(wd_dev); 311 315 unsigned int val; 312 - 313 - iTCO_vendor_pre_stop(p->smi_res); 314 316 315 317 /* Bit 11: TCO Timer Halt -> 1 = The TCO timer is disabled */ 316 318 val = inw(TCO1_CNT(p)); ··· 482 488 (u64)SMI_EN(p)); 483 489 return -EBUSY; 484 490 } 485 - } else if (iTCO_vendorsupport || 486 - turn_SMI_watchdog_clear_off >= p->iTCO_version) { 491 + } else if (turn_SMI_watchdog_clear_off >= p->iTCO_version) { 487 492 dev_err(dev, "SMI I/O resource is missing\n"); 488 493 return -ENODEV; 489 494 } ··· 501 508 } 502 509 503 510 /* Check chipset's NO_REBOOT bit */ 504 - if (p->update_no_reboot_bit(p->no_reboot_priv, false) && 505 - iTCO_vendor_check_noreboot_on()) { 511 + if (p->update_no_reboot_bit(p->no_reboot_priv, false)) { 506 512 dev_info(dev, "unable to reset NO_REBOOT flag, device disabled by hardware/BIOS\n"); 507 513 return -ENODEV; /* Cannot reset NO_REBOOT bit */ 508 514 }
+1
drivers/watchdog/imx7ulp_wdt.c
··· 346 346 watchdog_stop_on_reboot(wdog); 347 347 watchdog_stop_on_unregister(wdog); 348 348 watchdog_set_drvdata(wdog, imx7ulp_wdt); 349 + watchdog_set_nowayout(wdog, nowayout); 349 350 350 351 imx7ulp_wdt->hw = of_device_get_match_data(dev); 351 352 ret = imx7ulp_wdt_init(imx7ulp_wdt, wdog->timeout * imx7ulp_wdt->hw->wdog_clock_rate);
+12
drivers/watchdog/it87_wdt.c
··· 188 188 superio_outb(t >> 8, WDTVALMSB); 189 189 } 190 190 191 + /* Internal function, should be called after superio_select(GPIO) */ 192 + static bool _wdt_running(void) 193 + { 194 + return superio_inb(WDTVALLSB) || (max_units > 255 && superio_inb(WDTVALMSB)); 195 + } 196 + 191 197 static int wdt_update_timeout(unsigned int t) 192 198 { 193 199 int ret; ··· 378 372 ctrl |= WDT_PWRGD; 379 373 superio_outb(ctrl, SCR1); 380 374 } 375 + } 376 + 377 + /* wdt already left running by firmware? */ 378 + if (_wdt_running()) { 379 + pr_info("Left running by firmware.\n"); 380 + set_bit(WDOG_HW_RUNNING, &wdt_dev.status); 381 381 } 382 382 383 383 superio_exit();
+1 -21
drivers/watchdog/s3c2410_wdt.c
··· 208 208 u32 max_cnt; 209 209 }; 210 210 211 - static const struct s3c2410_wdt_variant drv_data_s3c2410 = { 212 - .quirks = 0 213 - }; 214 - 215 - #ifdef CONFIG_OF 216 211 static const struct s3c2410_wdt_variant drv_data_s3c6410 = { 217 212 .quirks = QUIRK_HAS_WTCLRINT_REG, 218 213 }; ··· 373 378 static const struct of_device_id s3c2410_wdt_match[] = { 374 379 { .compatible = "google,gs101-wdt", 375 380 .data = &drv_data_gs101_cl0 }, 376 - { .compatible = "samsung,s3c2410-wdt", 377 - .data = &drv_data_s3c2410 }, 378 381 { .compatible = "samsung,s3c6410-wdt", 379 382 .data = &drv_data_s3c6410 }, 380 383 { .compatible = "samsung,exynos5250-wdt", ··· 392 399 {}, 393 400 }; 394 401 MODULE_DEVICE_TABLE(of, s3c2410_wdt_match); 395 - #endif 396 - 397 - static const struct platform_device_id s3c2410_wdt_ids[] = { 398 - { 399 - .name = "s3c2410-wdt", 400 - .driver_data = (unsigned long)&drv_data_s3c2410, 401 - }, 402 - {} 403 - }; 404 - MODULE_DEVICE_TABLE(platform, s3c2410_wdt_ids); 405 402 406 403 /* functions */ 407 404 ··· 703 720 platform_get_device_id(pdev)->driver_data; 704 721 } 705 722 706 - #ifdef CONFIG_OF 707 723 /* Choose Exynos850/ExynosAutov9 driver data w.r.t. cluster index */ 708 724 if (variant == &drv_data_exynos850_cl0 || 709 725 variant == &drv_data_exynosautov9_cl0 || ··· 738 756 return dev_err_probe(dev, -EINVAL, "wrong cluster index: %u\n", index); 739 757 } 740 758 } 741 - #endif 742 759 743 760 wdt->drv_data = variant; 744 761 return 0; ··· 930 949 static struct platform_driver s3c2410wdt_driver = { 931 950 .probe = s3c2410wdt_probe, 932 951 .shutdown = s3c2410wdt_shutdown, 933 - .id_table = s3c2410_wdt_ids, 934 952 .driver = { 935 953 .name = "s3c2410-wdt", 936 954 .pm = pm_sleep_ptr(&s3c2410wdt_pm_ops), 937 - .of_match_table = of_match_ptr(s3c2410_wdt_match), 955 + .of_match_table = s3c2410_wdt_match, 938 956 }, 939 957 }; 940 958
+2 -2
drivers/watchdog/sbsa_gwdt.c
··· 72 72 #define SBSA_GWDT_WCS_WS0 BIT(1) 73 73 #define SBSA_GWDT_WCS_WS1 BIT(2) 74 74 75 - #define SBSA_GWDT_VERSION_MASK 0xF 75 + #define SBSA_GWDT_VERSION_MASK GENMASK(3, 0) 76 76 #define SBSA_GWDT_VERSION_SHIFT 16 77 77 78 - #define SBSA_GWDT_IMPL_MASK 0x7FF 78 + #define SBSA_GWDT_IMPL_MASK GENMASK(11, 0) 79 79 #define SBSA_GWDT_IMPL_SHIFT 0 80 80 #define SBSA_GWDT_IMPL_MEDIATEK 0x426 81 81
+1 -1
drivers/watchdog/starfive-wdt.c
··· 446 446 platform_set_drvdata(pdev, wdt); 447 447 pm_runtime_enable(&pdev->dev); 448 448 if (pm_runtime_enabled(&pdev->dev)) { 449 - ret = pm_runtime_get_sync(&pdev->dev); 449 + ret = pm_runtime_resume_and_get(&pdev->dev); 450 450 if (ret < 0) 451 451 return ret; 452 452 } else {
+2 -1
drivers/watchdog/watchdog_core.c
··· 117 117 * bounds. 118 118 */ 119 119 int watchdog_init_timeout(struct watchdog_device *wdd, 120 - unsigned int timeout_parm, struct device *dev) 120 + unsigned int timeout_parm, 121 + const struct device *dev) 121 122 { 122 123 const char *dev_str = wdd->parent ? dev_name(wdd->parent) : 123 124 (const char *)wdd->info->identity;
+15 -20
drivers/watchdog/watchdog_dev.c
··· 424 424 * 425 425 * Get the time before a watchdog will reboot (if not pinged). 426 426 * The caller must hold wd_data->lock. 427 - * 428 - * Return: 0 if successful, error otherwise. 429 427 */ 430 - static int watchdog_get_timeleft(struct watchdog_device *wdd, 431 - unsigned int *timeleft) 428 + static void watchdog_get_timeleft(struct watchdog_device *wdd, 429 + unsigned int *timeleft) 432 430 { 433 431 *timeleft = 0; 434 432 435 - if (!wdd->ops->get_timeleft) 436 - return -EOPNOTSUPP; 433 + if (wdd->ops->get_timeleft) { 434 + *timeleft = wdd->ops->get_timeleft(wdd); 435 + } else { 436 + struct watchdog_core_data *wd_data = wdd->wd_data; 437 + s64 last_keepalive_ms = ktime_ms_delta(ktime_get(), wd_data->last_keepalive); 438 + s64 last_keepalive = DIV_ROUND_UP_ULL(last_keepalive_ms, 1000); 437 439 438 - *timeleft = wdd->ops->get_timeleft(wdd); 439 - 440 - return 0; 440 + if (wdd->timeout > last_keepalive) 441 + *timeleft = wdd->timeout - last_keepalive; 442 + } 441 443 } 442 444 443 445 #ifdef CONFIG_WATCHDOG_SYSFS ··· 501 499 { 502 500 struct watchdog_device *wdd = dev_get_drvdata(dev); 503 501 struct watchdog_core_data *wd_data = wdd->wd_data; 504 - ssize_t status; 505 502 unsigned int val; 506 503 507 504 mutex_lock(&wd_data->lock); 508 - status = watchdog_get_timeleft(wdd, &val); 505 + watchdog_get_timeleft(wdd, &val); 509 506 mutex_unlock(&wd_data->lock); 510 - if (!status) 511 - status = sysfs_emit(buf, "%u\n", val); 512 507 513 - return status; 508 + return sysfs_emit(buf, "%u\n", val); 514 509 } 515 510 static DEVICE_ATTR_RO(timeleft); 516 511 ··· 623 624 struct watchdog_device *wdd = dev_get_drvdata(dev); 624 625 umode_t mode = attr->mode; 625 626 626 - if (attr == &dev_attr_timeleft.attr && !wdd->ops->get_timeleft) 627 - mode = 0; 628 - else if (attr == &dev_attr_pretimeout.attr && !watchdog_have_pretimeout(wdd)) 627 + if (attr == &dev_attr_pretimeout.attr && !watchdog_have_pretimeout(wdd)) 629 628 mode = 0; 630 629 else if ((attr == &dev_attr_pretimeout_governor.attr || 631 630 attr == &dev_attr_pretimeout_available_governors.attr) && ··· 822 825 err = put_user(wdd->timeout, p); 823 826 break; 824 827 case WDIOC_GETTIMELEFT: 825 - err = watchdog_get_timeleft(wdd, &val); 826 - if (err < 0) 827 - break; 828 + watchdog_get_timeleft(wdd, &val); 828 829 err = put_user(val, p); 829 830 break; 830 831 case WDIOC_SETPRETIMEOUT:
+7 -5
include/linux/watchdog.h
··· 129 129 #define WATCHDOG_NOWAYOUT_INIT_STATUS (WATCHDOG_NOWAYOUT << WDOG_NO_WAY_OUT) 130 130 131 131 /* Use the following function to check whether or not the watchdog is active */ 132 - static inline bool watchdog_active(struct watchdog_device *wdd) 132 + static inline bool watchdog_active(const struct watchdog_device *wdd) 133 133 { 134 134 return test_bit(WDOG_ACTIVE, &wdd->status); 135 135 } ··· 138 138 * Use the following function to check whether or not the hardware watchdog 139 139 * is running 140 140 */ 141 - static inline bool watchdog_hw_running(struct watchdog_device *wdd) 141 + static inline bool watchdog_hw_running(const struct watchdog_device *wdd) 142 142 { 143 143 return test_bit(WDOG_HW_RUNNING, &wdd->status); 144 144 } ··· 169 169 } 170 170 171 171 /* Use the following function to check if a timeout value is invalid */ 172 - static inline bool watchdog_timeout_invalid(struct watchdog_device *wdd, unsigned int t) 172 + static inline bool watchdog_timeout_invalid(const struct watchdog_device *wdd, 173 + unsigned int t) 173 174 { 174 175 /* 175 176 * The timeout is invalid if ··· 189 188 } 190 189 191 190 /* Use the following function to check if a pretimeout value is invalid */ 192 - static inline bool watchdog_pretimeout_invalid(struct watchdog_device *wdd, 191 + static inline bool watchdog_pretimeout_invalid(const struct watchdog_device *wdd, 193 192 unsigned int t) 194 193 { 195 194 return t && wdd->timeout && t >= wdd->timeout; ··· 219 218 /* drivers/watchdog/watchdog_core.c */ 220 219 void watchdog_set_restart_priority(struct watchdog_device *wdd, int priority); 221 220 extern int watchdog_init_timeout(struct watchdog_device *wdd, 222 - unsigned int timeout_parm, struct device *dev); 221 + unsigned int timeout_parm, 222 + const struct device *dev); 223 223 extern int watchdog_register_device(struct watchdog_device *); 224 224 extern void watchdog_unregister_device(struct watchdog_device *); 225 225 int watchdog_dev_suspend(struct watchdog_device *wdd);