1. 21 Jan, 2018 2 commits
    • André Draszik's avatar
      watchdog: mt7621: set WDOG_HW_RUNNING bit when appropriate · 392d39a8
      André Draszik authored
      If the watchdog hardware is enabled/running during boot, e.g.
      due to a boot loader configuring it, we must tell the
      watchdog framework about this fact so that it can ping the
      watchdog until userspace opens the device and takes over
      control.
      
      Do so using the WDOG_HW_RUNNING flag that exists for exactly
      that use-case.
      
      Given the watchdog driver core doesn't know what timeout was
      originally set by whoever started the watchdog (boot loader),
      we make sure to update the timeout in the hardware according
      to what the watchdog core thinks it is.
      Signed-off-by: default avatarAndré Draszik <git@andred.net>
      Cc: linux-watchdog@vger.kernel.org
      Cc: John Crispin <john@phrozen.org>
      Reviewed-by: default avatarGuenter Roeck <Linux@roeck-us.net>
      Signed-off-by: default avatarGuenter Roeck <linux@roeck-us.net>
      Signed-off-by: default avatarWim Van Sebroeck <wim@iguana.be>
      392d39a8
    • Martin Kaiser's avatar
      watchdog: imx2_wdt: restore previous timeout after suspend+resume · 0be26725
      Martin Kaiser authored
      When the watchdog device is suspended, its timeout is set to the maximum
      value. During resume, the previously set timeout should be restored.
      This does not work at the moment.
      
      The suspend function calls
      
      imx2_wdt_set_timeout(wdog, IMX2_WDT_MAX_TIME);
      
      and resume reverts this by calling
      
      imx2_wdt_set_timeout(wdog, wdog->timeout);
      
      However, imx2_wdt_set_timeout() updates wdog->timeout. Therefore,
      wdog->timeout is set to IMX2_WDT_MAX_TIME when we enter the resume
      function.
      
      Fix this by adding a new function __imx2_wdt_set_timeout() which
      only updates the hardware settings. imx2_wdt_set_timeout() now calls
      __imx2_wdt_set_timeout() and then saves the new timeout to
      wdog->timeout.
      
      During suspend, we call __imx2_wdt_set_timeout() directly so that
      wdog->timeout won't be updated and we can restore the previous value
      during resume. This approach makes wdog->timeout different from the
      actual setting in the hardware which is usually not a good thing.
      However, the two differ only while we're suspended and no kernel code is
      running, so it should be ok in this case.
      Signed-off-by: default avatarMartin Kaiser <martin@kaiser.cx>
      Cc: stable@vger.kernel.org
      Reviewed-by: default avatarGuenter Roeck <linux@roeck-us.net>
      Signed-off-by: default avatarGuenter Roeck <linux@roeck-us.net>
      Signed-off-by: default avatarWim Van Sebroeck <wim@iguana.be>
      0be26725
  2. 28 Dec, 2017 38 commits