|
59 | 59 | #define PON_REASON_EOF_NUM 0xCCCCBBBB
|
60 | 60 | #define RESERVED_MEM_MIN_SIZE 12
|
61 | 61 |
|
| 62 | +#define MAX_HW_ERROR 250 |
| 63 | + |
62 | 64 | static int heartbeat = DEFAULT_HEARTBEAT;
|
63 | 65 |
|
64 | 66 | /*
|
@@ -97,7 +99,7 @@ static int rti_wdt_start(struct watchdog_device *wdd)
|
97 | 99 | * to be 50% or less than that; we obviouly want to configure the open
|
98 | 100 | * window as large as possible so we select the 50% option.
|
99 | 101 | */
|
100 |
| - wdd->min_hw_heartbeat_ms = 500 * wdd->timeout; |
| 102 | + wdd->min_hw_heartbeat_ms = 520 * wdd->timeout + MAX_HW_ERROR; |
101 | 103 |
|
102 | 104 | /* Generate NMI when wdt expires */
|
103 | 105 | writel_relaxed(RTIWWDRX_NMI, wdt->base + RTIWWDRXCTRL);
|
@@ -131,31 +133,33 @@ static int rti_wdt_setup_hw_hb(struct watchdog_device *wdd, u32 wsize)
|
131 | 133 | * be petted during the open window; not too early or not too late.
|
132 | 134 | * The HW configuration options only allow for the open window size
|
133 | 135 | * to be 50% or less than that.
|
| 136 | + * To avoid any glitches, we accommodate 2% + max hardware error |
| 137 | + * safety margin. |
134 | 138 | */
|
135 | 139 | switch (wsize) {
|
136 | 140 | case RTIWWDSIZE_50P:
|
137 |
| - /* 50% open window => 50% min heartbeat */ |
138 |
| - wdd->min_hw_heartbeat_ms = 500 * heartbeat; |
| 141 | + /* 50% open window => 52% min heartbeat */ |
| 142 | + wdd->min_hw_heartbeat_ms = 520 * heartbeat + MAX_HW_ERROR; |
139 | 143 | break;
|
140 | 144 |
|
141 | 145 | case RTIWWDSIZE_25P:
|
142 |
| - /* 25% open window => 75% min heartbeat */ |
143 |
| - wdd->min_hw_heartbeat_ms = 750 * heartbeat; |
| 146 | + /* 25% open window => 77% min heartbeat */ |
| 147 | + wdd->min_hw_heartbeat_ms = 770 * heartbeat + MAX_HW_ERROR; |
144 | 148 | break;
|
145 | 149 |
|
146 | 150 | case RTIWWDSIZE_12P5:
|
147 |
| - /* 12.5% open window => 87.5% min heartbeat */ |
148 |
| - wdd->min_hw_heartbeat_ms = 875 * heartbeat; |
| 151 | + /* 12.5% open window => 89.5% min heartbeat */ |
| 152 | + wdd->min_hw_heartbeat_ms = 895 * heartbeat + MAX_HW_ERROR; |
149 | 153 | break;
|
150 | 154 |
|
151 | 155 | case RTIWWDSIZE_6P25:
|
152 |
| - /* 6.5% open window => 93.5% min heartbeat */ |
153 |
| - wdd->min_hw_heartbeat_ms = 935 * heartbeat; |
| 156 | + /* 6.5% open window => 95.5% min heartbeat */ |
| 157 | + wdd->min_hw_heartbeat_ms = 955 * heartbeat + MAX_HW_ERROR; |
154 | 158 | break;
|
155 | 159 |
|
156 | 160 | case RTIWWDSIZE_3P125:
|
157 |
| - /* 3.125% open window => 96.9% min heartbeat */ |
158 |
| - wdd->min_hw_heartbeat_ms = 969 * heartbeat; |
| 161 | + /* 3.125% open window => 98.9% min heartbeat */ |
| 162 | + wdd->min_hw_heartbeat_ms = 989 * heartbeat + MAX_HW_ERROR; |
159 | 163 | break;
|
160 | 164 |
|
161 | 165 | default:
|
@@ -233,14 +237,6 @@ static int rti_wdt_probe(struct platform_device *pdev)
|
233 | 237 | return -EINVAL;
|
234 | 238 | }
|
235 | 239 |
|
236 |
| - /* |
237 |
| - * If watchdog is running at 32k clock, it is not accurate. |
238 |
| - * Adjust frequency down in this case so that we don't pet |
239 |
| - * the watchdog too often. |
240 |
| - */ |
241 |
| - if (wdt->freq < 32768) |
242 |
| - wdt->freq = wdt->freq * 9 / 10; |
243 |
| - |
244 | 240 | pm_runtime_enable(dev);
|
245 | 241 | ret = pm_runtime_resume_and_get(dev);
|
246 | 242 | if (ret < 0) {
|
|
0 commit comments