File tree Expand file tree Collapse file tree 2 files changed +21
-0
lines changed Expand file tree Collapse file tree 2 files changed +21
-0
lines changed Original file line number Diff line number Diff line change @@ -144,6 +144,8 @@ static int rn5t618_wdt_probe(struct platform_device *pdev)
144
144
struct rn5t618 * rn5t618 = dev_get_drvdata (dev -> parent );
145
145
struct rn5t618_wdt * wdt ;
146
146
int min_timeout , max_timeout ;
147
+ int ret ;
148
+ unsigned int val ;
147
149
148
150
wdt = devm_kzalloc (dev , sizeof (struct rn5t618_wdt ), GFP_KERNEL );
149
151
if (!wdt )
@@ -160,6 +162,16 @@ static int rn5t618_wdt_probe(struct platform_device *pdev)
160
162
wdt -> wdt_dev .timeout = max_timeout ;
161
163
wdt -> wdt_dev .parent = dev ;
162
164
165
+ /* Read out previous power-off factor */
166
+ ret = regmap_read (wdt -> rn5t618 -> regmap , RN5T618_POFFHIS , & val );
167
+ if (ret )
168
+ return ret ;
169
+
170
+ if (val & RN5T618_POFFHIS_VINDET )
171
+ wdt -> wdt_dev .bootstatus = WDIOF_POWERUNDER ;
172
+ else if (val & RN5T618_POFFHIS_WDG )
173
+ wdt -> wdt_dev .bootstatus = WDIOF_CARDRESET ;
174
+
163
175
watchdog_set_drvdata (& wdt -> wdt_dev , wdt );
164
176
watchdog_init_timeout (& wdt -> wdt_dev , timeout , dev );
165
177
watchdog_set_nowayout (& wdt -> wdt_dev , nowayout );
Original file line number Diff line number Diff line change 227
227
#define RN5T618_WATCHDOG_WDOGTIM_S 0
228
228
#define RN5T618_PWRIRQ_IR_WDOG BIT(6)
229
229
230
+ #define RN5T618_POFFHIS_PWRON BIT(0)
231
+ #define RN5T618_POFFHIS_TSHUT BIT(1)
232
+ #define RN5T618_POFFHIS_VINDET BIT(2)
233
+ #define RN5T618_POFFHIS_IODET BIT(3)
234
+ #define RN5T618_POFFHIS_CPU BIT(4)
235
+ #define RN5T618_POFFHIS_WDG BIT(5)
236
+ #define RN5T618_POFFHIS_DCLIM BIT(6)
237
+ #define RN5T618_POFFHIS_N_OE BIT(7)
238
+
230
239
enum {
231
240
RN5T618_DCDC1 ,
232
241
RN5T618_DCDC2 ,
You can’t perform that action at this time.
0 commit comments