On 5/4/2015 7:04 AM, fu.wei@linaro.org wrote:
+static int sbsa_gwdt_set_pretimeout(struct watchdog_device *wdd,
+ unsigned int pretimeout)
+{
+ struct sbsa_gwdt *gwdt = to_sbsa_gwdt(wdd);
+ u32 wor;
+
+ if (watchdog_pretimeout_invalid(gwdt, pretimeout)) {
+ pr_err("sbsa_gwdt: pretimeout %d is out of range(0~%d),skip\n",
+ pretimeout, gwdt->max_pretimeout);
+ return -EINVAL;
+ }
+ gwdt->pretimeout = pretimeout;
+ sbsa_gwdt_set_timeout_limits(gwdt);
+
+ /* refresh the WOR, that will cause an explicit watchdog refresh */
+ wor = pretimeout * sbsa_gwdt_rate;
+ sbsa_gwdt_cf_write(SBSA_GWDT_WOR, wor, wdd);
+
+ return 0;
+}
Fu Wei,
IIUC, isn't the SBSA_GWDT_WOR (offset 8) is the watchdog countdown timer value which is read only?
Suravee