blob: 78a6203994d74786b02a2fd2051f301013b408be [file] [log] [blame]
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001/* Copyright (c) 2011, Code Aurora Forum. All rights reserved.
2 *
3 * This program is free software; you can redistribute it and/or modify
4 * it under the terms of the GNU General Public License version 2 and
5 * only version 2 as published by the Free Software Foundation.
6 *
7 * This program is distributed in the hope that it will be useful,
8 * but WITHOUT ANY WARRANTY; without even the implied warranty of
9 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
10 * GNU General Public License for more details.
11 */
12
Vikram Mulukutlaa5dd6112011-09-14 14:12:33 -070013#define pr_fmt(fmt) "subsys-restart: %s(): " fmt, __func__
14
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070015#include <linux/kernel.h>
16#include <linux/module.h>
17#include <linux/uaccess.h>
18#include <linux/module.h>
19#include <linux/fs.h>
20#include <linux/proc_fs.h>
21#include <linux/delay.h>
22#include <linux/list.h>
23#include <linux/io.h>
24#include <linux/kthread.h>
Vikram Mulukutla96aecfc2011-07-28 18:18:42 -070025#include <linux/time.h>
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070026
27#include <asm/current.h>
28
29#include <mach/peripheral-loader.h>
30#include <mach/scm.h>
31#include <mach/socinfo.h>
32#include <mach/subsystem_notif.h>
33#include <mach/subsystem_restart.h>
34
35#include "smd_private.h"
36
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070037struct subsys_soc_restart_order {
38 const char * const *subsystem_list;
39 int count;
40
41 struct mutex shutdown_lock;
42 struct mutex powerup_lock;
43 struct subsys_data *subsys_ptrs[];
44};
45
46struct restart_thread_data {
47 struct subsys_data *subsys;
48 int coupled;
49};
50
Vikram Mulukutla96aecfc2011-07-28 18:18:42 -070051struct restart_log {
52 struct timeval time;
53 struct subsys_data *subsys;
54 struct list_head list;
55};
56
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070057static int restart_level;
58static int enable_ramdumps;
59
Vikram Mulukutla96aecfc2011-07-28 18:18:42 -070060static LIST_HEAD(restart_log_list);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070061static LIST_HEAD(subsystem_list);
62static DEFINE_MUTEX(subsystem_list_lock);
63static DEFINE_MUTEX(soc_order_reg_lock);
Vikram Mulukutla96aecfc2011-07-28 18:18:42 -070064static DEFINE_MUTEX(restart_log_mutex);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070065
66/* SOC specific restart orders go here */
67
68#define DEFINE_SINGLE_RESTART_ORDER(name, order) \
69 static struct subsys_soc_restart_order __##name = { \
70 .subsystem_list = order, \
71 .count = ARRAY_SIZE(order), \
72 .subsys_ptrs = {[ARRAY_SIZE(order)] = NULL} \
73 }; \
74 static struct subsys_soc_restart_order *name[] = { \
75 &__##name, \
76 }
77
78/* MSM 8x60 restart ordering info */
79static const char * const _order_8x60_all[] = {
80 "external_modem", "modem", "lpass"
81};
82DEFINE_SINGLE_RESTART_ORDER(orders_8x60_all, _order_8x60_all);
83
84static const char * const _order_8x60_modems[] = {"external_modem", "modem"};
85DEFINE_SINGLE_RESTART_ORDER(orders_8x60_modems, _order_8x60_modems);
86
87/* MSM 8960 restart ordering info */
88static const char * const order_8960[] = {"modem", "lpass"};
89
90static struct subsys_soc_restart_order restart_orders_8960_one = {
91 .subsystem_list = order_8960,
92 .count = ARRAY_SIZE(order_8960),
93 .subsys_ptrs = {[ARRAY_SIZE(order_8960)] = NULL}
94 };
95
96static struct subsys_soc_restart_order *restart_orders_8960[] = {
97 &restart_orders_8960_one,
98};
99
100/* These will be assigned to one of the sets above after
101 * runtime SoC identification.
102 */
103static struct subsys_soc_restart_order **restart_orders;
104static int n_restart_orders;
105
106module_param(enable_ramdumps, int, S_IRUGO | S_IWUSR);
107
108static struct subsys_soc_restart_order *_update_restart_order(
109 struct subsys_data *subsys);
110
111int get_restart_level()
112{
113 return restart_level;
114}
115EXPORT_SYMBOL(get_restart_level);
116
117static void restart_level_changed(void)
118{
119 struct subsys_data *subsys;
120
121 if (cpu_is_msm8x60() && restart_level == RESET_SUBSYS_COUPLED) {
122 restart_orders = orders_8x60_all;
123 n_restart_orders = ARRAY_SIZE(orders_8x60_all);
124 }
125
126 if (cpu_is_msm8x60() && restart_level == RESET_SUBSYS_MIXED) {
127 restart_orders = orders_8x60_modems;
128 n_restart_orders = ARRAY_SIZE(orders_8x60_modems);
129 }
130
131 mutex_lock(&subsystem_list_lock);
132 list_for_each_entry(subsys, &subsystem_list, list)
133 subsys->restart_order = _update_restart_order(subsys);
134 mutex_unlock(&subsystem_list_lock);
135}
136
137static int restart_level_set(const char *val, struct kernel_param *kp)
138{
139 int ret;
140 int old_val = restart_level;
141
Rohit Vaswani56dd22a2011-11-11 16:21:28 -0800142 if (cpu_is_msm9615()) {
143 pr_err("Only Phase 1 subsystem restart is supported\n");
144 return -EINVAL;
145 }
146
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700147 ret = param_set_int(val, kp);
148 if (ret)
149 return ret;
150
151 switch (restart_level) {
152
153 case RESET_SOC:
154 case RESET_SUBSYS_COUPLED:
155 case RESET_SUBSYS_INDEPENDENT:
Vikram Mulukutlaa5dd6112011-09-14 14:12:33 -0700156 pr_info("Phase %d behavior activated.\n", restart_level);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700157 break;
158
159 case RESET_SUBSYS_MIXED:
Vikram Mulukutlaa5dd6112011-09-14 14:12:33 -0700160 pr_info("Phase 2+ behavior activated.\n");
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700161 break;
162
163 default:
164 restart_level = old_val;
165 return -EINVAL;
166 break;
167
168 }
169
170 if (restart_level != old_val)
171 restart_level_changed();
172
173 return 0;
174}
175
176module_param_call(restart_level, restart_level_set, param_get_int,
177 &restart_level, 0644);
178
179static struct subsys_data *_find_subsystem(const char *subsys_name)
180{
181 struct subsys_data *subsys;
182
183 mutex_lock(&subsystem_list_lock);
184 list_for_each_entry(subsys, &subsystem_list, list)
185 if (!strncmp(subsys->name, subsys_name,
186 SUBSYS_NAME_MAX_LENGTH)) {
187 mutex_unlock(&subsystem_list_lock);
188 return subsys;
189 }
190 mutex_unlock(&subsystem_list_lock);
191
192 return NULL;
193}
194
195static struct subsys_soc_restart_order *_update_restart_order(
196 struct subsys_data *subsys)
197{
198 int i, j;
199
200 if (!subsys)
201 return NULL;
202
203 if (!subsys->name)
204 return NULL;
205
206 mutex_lock(&soc_order_reg_lock);
207 for (j = 0; j < n_restart_orders; j++) {
208 for (i = 0; i < restart_orders[j]->count; i++)
209 if (!strncmp(restart_orders[j]->subsystem_list[i],
210 subsys->name, SUBSYS_NAME_MAX_LENGTH)) {
211
212 restart_orders[j]->subsys_ptrs[i] =
213 subsys;
214 mutex_unlock(&soc_order_reg_lock);
215 return restart_orders[j];
216 }
217 }
218
219 mutex_unlock(&soc_order_reg_lock);
220
221 return NULL;
222}
223
224static void _send_notification_to_order(struct subsys_data
225 **restart_list, int count,
226 enum subsys_notif_type notif_type)
227{
228 int i;
229
230 for (i = 0; i < count; i++)
231 if (restart_list[i])
232 subsys_notif_queue_notification(
233 restart_list[i]->notif_handle, notif_type);
234}
235
Vikram Mulukutla96aecfc2011-07-28 18:18:42 -0700236static int max_restarts;
237module_param(max_restarts, int, 0644);
238
239static long max_history_time = 3600;
240module_param(max_history_time, long, 0644);
241
242static void do_epoch_check(struct subsys_data *subsys)
243{
244 int n = 0;
Jordan Crouse75a25ca2011-09-09 12:49:57 -0600245 struct timeval *time_first = NULL, *curr_time;
Vikram Mulukutla96aecfc2011-07-28 18:18:42 -0700246 struct restart_log *r_log, *temp;
247 static int max_restarts_check;
248 static long max_history_time_check;
249
250 mutex_lock(&restart_log_mutex);
251
252 max_restarts_check = max_restarts;
253 max_history_time_check = max_history_time;
254
255 /* Check if epoch checking is enabled */
256 if (!max_restarts_check)
Vikram Mulukutla7a289092011-09-14 10:08:36 -0700257 goto out;
Vikram Mulukutla96aecfc2011-07-28 18:18:42 -0700258
259 r_log = kmalloc(sizeof(struct restart_log), GFP_KERNEL);
Matt Wagantalleecca342011-11-10 20:12:05 -0800260 if (!r_log)
261 goto out;
Vikram Mulukutla96aecfc2011-07-28 18:18:42 -0700262 r_log->subsys = subsys;
263 do_gettimeofday(&r_log->time);
264 curr_time = &r_log->time;
265 INIT_LIST_HEAD(&r_log->list);
266
267 list_add_tail(&r_log->list, &restart_log_list);
268
269 list_for_each_entry_safe(r_log, temp, &restart_log_list, list) {
270
271 if ((curr_time->tv_sec - r_log->time.tv_sec) >
272 max_history_time_check) {
273
274 pr_debug("Deleted node with restart_time = %ld\n",
275 r_log->time.tv_sec);
276 list_del(&r_log->list);
277 kfree(r_log);
278 continue;
279 }
280 if (!n) {
281 time_first = &r_log->time;
Vikram Mulukutlaa5dd6112011-09-14 14:12:33 -0700282 pr_debug("Time_first: %ld\n", time_first->tv_sec);
Vikram Mulukutla96aecfc2011-07-28 18:18:42 -0700283 }
284 n++;
Vikram Mulukutlaa5dd6112011-09-14 14:12:33 -0700285 pr_debug("Restart_time: %ld\n", r_log->time.tv_sec);
Vikram Mulukutla96aecfc2011-07-28 18:18:42 -0700286 }
287
Jordan Crouse75a25ca2011-09-09 12:49:57 -0600288 if (time_first && n >= max_restarts_check) {
Vikram Mulukutla96aecfc2011-07-28 18:18:42 -0700289 if ((curr_time->tv_sec - time_first->tv_sec) <
290 max_history_time_check)
291 panic("Subsystems have crashed %d times in less than "
292 "%ld seconds!", max_restarts_check,
293 max_history_time_check);
294 }
295
Vikram Mulukutla7a289092011-09-14 10:08:36 -0700296out:
Vikram Mulukutla96aecfc2011-07-28 18:18:42 -0700297 mutex_unlock(&restart_log_mutex);
298}
299
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700300static int subsystem_restart_thread(void *data)
301{
302 struct restart_thread_data *r_work = data;
303 struct subsys_data **restart_list;
304 struct subsys_data *subsys = r_work->subsys;
305 struct subsys_soc_restart_order *soc_restart_order = NULL;
306
307 struct mutex *powerup_lock;
308 struct mutex *shutdown_lock;
309
310 int i;
311 int restart_list_count = 0;
312
313 if (r_work->coupled)
314 soc_restart_order = subsys->restart_order;
315
316 /* It's OK to not take the registration lock at this point.
317 * This is because the subsystem list inside the relevant
318 * restart order is not being traversed.
319 */
320 if (!soc_restart_order) {
321 restart_list = subsys->single_restart_list;
322 restart_list_count = 1;
323 powerup_lock = &subsys->powerup_lock;
324 shutdown_lock = &subsys->shutdown_lock;
325 } else {
326 restart_list = soc_restart_order->subsys_ptrs;
327 restart_list_count = soc_restart_order->count;
328 powerup_lock = &soc_restart_order->powerup_lock;
329 shutdown_lock = &soc_restart_order->shutdown_lock;
330 }
331
Vikram Mulukutlaa5dd6112011-09-14 14:12:33 -0700332 pr_debug("[%p]: Attempting to get shutdown lock!\n", current);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700333
334 /* Try to acquire shutdown_lock. If this fails, these subsystems are
335 * already being restarted - return.
336 */
337 if (!mutex_trylock(shutdown_lock)) {
338 kfree(data);
339 do_exit(0);
340 }
341
Vikram Mulukutlaa5dd6112011-09-14 14:12:33 -0700342 pr_debug("[%p]: Attempting to get powerup lock!\n", current);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700343
344 /* Now that we've acquired the shutdown lock, either we're the first to
345 * restart these subsystems or some other thread is doing the powerup
346 * sequence for these subsystems. In the latter case, panic and bail
347 * out, since a subsystem died in its powerup sequence.
348 */
349 if (!mutex_trylock(powerup_lock))
Vikram Mulukutlaa5dd6112011-09-14 14:12:33 -0700350 panic("%s[%p]: Subsystem died during powerup!",
351 __func__, current);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700352
Vikram Mulukutla96aecfc2011-07-28 18:18:42 -0700353 do_epoch_check(subsys);
354
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700355 /* Now it is necessary to take the registration lock. This is because
356 * the subsystem list in the SoC restart order will be traversed
357 * and it shouldn't be changed until _this_ restart sequence completes.
358 */
359 mutex_lock(&soc_order_reg_lock);
360
Vikram Mulukutlaa5dd6112011-09-14 14:12:33 -0700361 pr_debug("[%p]: Starting restart sequence for %s\n", current,
362 r_work->subsys->name);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700363
364 _send_notification_to_order(restart_list,
365 restart_list_count,
366 SUBSYS_BEFORE_SHUTDOWN);
367
368 for (i = 0; i < restart_list_count; i++) {
369
370 if (!restart_list[i])
371 continue;
372
Vikram Mulukutlaa5dd6112011-09-14 14:12:33 -0700373 pr_info("[%p]: Shutting down %s\n", current,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700374 restart_list[i]->name);
375
376 if (restart_list[i]->shutdown(subsys) < 0)
Vikram Mulukutlaa5dd6112011-09-14 14:12:33 -0700377 panic("subsys-restart: %s[%p]: Failed to shutdown %s!",
378 __func__, current, restart_list[i]->name);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700379 }
380
381 _send_notification_to_order(restart_list, restart_list_count,
382 SUBSYS_AFTER_SHUTDOWN);
383
384 /* Now that we've finished shutting down these subsystems, release the
385 * shutdown lock. If a subsystem restart request comes in for a
386 * subsystem in _this_ restart order after the unlock below, and
387 * before the powerup lock is released, panic and bail out.
388 */
389 mutex_unlock(shutdown_lock);
390
391 /* Collect ram dumps for all subsystems in order here */
392 for (i = 0; i < restart_list_count; i++) {
393 if (!restart_list[i])
394 continue;
395
396 if (restart_list[i]->ramdump)
397 if (restart_list[i]->ramdump(enable_ramdumps,
398 subsys) < 0)
Vikram Mulukutlaa5dd6112011-09-14 14:12:33 -0700399 pr_warn("%s[%p]: Ramdump failed.\n",
400 restart_list[i]->name, current);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700401 }
402
403 _send_notification_to_order(restart_list,
404 restart_list_count,
405 SUBSYS_BEFORE_POWERUP);
406
407 for (i = restart_list_count - 1; i >= 0; i--) {
408
409 if (!restart_list[i])
410 continue;
411
Vikram Mulukutlaa5dd6112011-09-14 14:12:33 -0700412 pr_info("[%p]: Powering up %s\n", current,
413 restart_list[i]->name);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700414
415 if (restart_list[i]->powerup(subsys) < 0)
Vikram Mulukutlaa5dd6112011-09-14 14:12:33 -0700416 panic("%s[%p]: Failed to powerup %s!", __func__,
417 current, restart_list[i]->name);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700418 }
419
420 _send_notification_to_order(restart_list,
421 restart_list_count,
422 SUBSYS_AFTER_POWERUP);
423
Vikram Mulukutlaa5dd6112011-09-14 14:12:33 -0700424 pr_info("[%p]: Restart sequence for %s completed.\n",
425 current, r_work->subsys->name);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700426
427 mutex_unlock(powerup_lock);
428
429 mutex_unlock(&soc_order_reg_lock);
430
Vikram Mulukutlaa5dd6112011-09-14 14:12:33 -0700431 pr_debug("[%p]: Released powerup lock!\n", current);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700432
433 kfree(data);
434 do_exit(0);
435}
436
437int subsystem_restart(const char *subsys_name)
438{
439 struct subsys_data *subsys;
440 struct task_struct *tsk;
441 struct restart_thread_data *data = NULL;
442
443 if (!subsys_name) {
Vikram Mulukutlaa5dd6112011-09-14 14:12:33 -0700444 pr_err("Invalid subsystem name.\n");
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700445 return -EINVAL;
446 }
447
Vikram Mulukutla3b24c8c2011-12-02 15:12:53 -0800448 pr_info("Restart sequence requested for %s, restart_level = %d.\n",
449 subsys_name, restart_level);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700450
451 /* List of subsystems is protected by a lock. New subsystems can
452 * still come in.
453 */
454 subsys = _find_subsystem(subsys_name);
455
456 if (!subsys) {
Vikram Mulukutlaa5dd6112011-09-14 14:12:33 -0700457 pr_warn("Unregistered subsystem %s!\n", subsys_name);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700458 return -EINVAL;
459 }
460
461 if (restart_level != RESET_SOC) {
462 data = kzalloc(sizeof(struct restart_thread_data), GFP_KERNEL);
463 if (!data) {
464 restart_level = RESET_SOC;
Vikram Mulukutlaa5dd6112011-09-14 14:12:33 -0700465 pr_warn("Failed to alloc restart data. Resetting.\n");
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700466 } else {
467 if (restart_level == RESET_SUBSYS_COUPLED ||
468 restart_level == RESET_SUBSYS_MIXED)
469 data->coupled = 1;
470 else
471 data->coupled = 0;
472
473 data->subsys = subsys;
474 }
475 }
476
477 switch (restart_level) {
478
479 case RESET_SUBSYS_COUPLED:
480 case RESET_SUBSYS_MIXED:
481 case RESET_SUBSYS_INDEPENDENT:
Vikram Mulukutlaa5dd6112011-09-14 14:12:33 -0700482 pr_debug("Restarting %s [level=%d]!\n", subsys_name,
483 restart_level);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700484
485 /* Let the kthread handle the actual restarting. Using a
486 * workqueue will not work since all restart requests are
487 * serialized and it prevents the short circuiting of
488 * restart requests for subsystems already in a restart
489 * sequence.
490 */
491 tsk = kthread_run(subsystem_restart_thread, data,
Vikram Mulukutlaa5dd6112011-09-14 14:12:33 -0700492 "subsystem_restart_thread");
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700493 if (IS_ERR(tsk))
494 panic("%s: Unable to create thread to restart %s",
495 __func__, subsys->name);
496
497 break;
498
499 case RESET_SOC:
Vikram Mulukutla3b24c8c2011-12-02 15:12:53 -0800500 panic("subsys-restart: Resetting the SoC - %s crashed.",
501 subsys->name);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700502 break;
503
504 default:
505 panic("subsys-restart: Unknown restart level!\n");
506 break;
507
508 }
509
510 return 0;
511}
512EXPORT_SYMBOL(subsystem_restart);
513
514int ssr_register_subsystem(struct subsys_data *subsys)
515{
516 if (!subsys)
517 goto err;
518
519 if (!subsys->name)
520 goto err;
521
522 if (!subsys->powerup || !subsys->shutdown)
523 goto err;
524
525 subsys->notif_handle = subsys_notif_add_subsys(subsys->name);
526 subsys->restart_order = _update_restart_order(subsys);
527 subsys->single_restart_list[0] = subsys;
528
529 mutex_init(&subsys->shutdown_lock);
530 mutex_init(&subsys->powerup_lock);
531
532 mutex_lock(&subsystem_list_lock);
533 list_add(&subsys->list, &subsystem_list);
534 mutex_unlock(&subsystem_list_lock);
535
536 return 0;
537
538err:
539 return -EINVAL;
540}
541EXPORT_SYMBOL(ssr_register_subsystem);
542
Vikram Mulukutla2a7ea7e2011-09-06 11:38:47 -0700543static int ssr_panic_handler(struct notifier_block *this,
544 unsigned long event, void *ptr)
545{
546 struct subsys_data *subsys;
547
548 list_for_each_entry(subsys, &subsystem_list, list)
549 if (subsys->crash_shutdown)
550 subsys->crash_shutdown(subsys);
551 return NOTIFY_DONE;
552}
553
554static struct notifier_block panic_nb = {
555 .notifier_call = ssr_panic_handler,
556};
557
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700558static int __init ssr_init_soc_restart_orders(void)
559{
560 int i;
561
Vikram Mulukutla2a7ea7e2011-09-06 11:38:47 -0700562 atomic_notifier_chain_register(&panic_notifier_list,
563 &panic_nb);
564
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700565 if (cpu_is_msm8x60()) {
566 for (i = 0; i < ARRAY_SIZE(orders_8x60_all); i++) {
567 mutex_init(&orders_8x60_all[i]->powerup_lock);
568 mutex_init(&orders_8x60_all[i]->shutdown_lock);
569 }
570
571 for (i = 0; i < ARRAY_SIZE(orders_8x60_modems); i++) {
572 mutex_init(&orders_8x60_modems[i]->powerup_lock);
573 mutex_init(&orders_8x60_modems[i]->shutdown_lock);
574 }
575
576 restart_orders = orders_8x60_all;
577 n_restart_orders = ARRAY_SIZE(orders_8x60_all);
578 }
579
Rohit Vaswani56dd22a2011-11-11 16:21:28 -0800580 if (cpu_is_msm8960() || cpu_is_msm8930() || cpu_is_msm9615()) {
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700581 restart_orders = restart_orders_8960;
582 n_restart_orders = ARRAY_SIZE(restart_orders_8960);
583 }
584
585 if (restart_orders == NULL || n_restart_orders < 1) {
586 WARN_ON(1);
587 return -EINVAL;
588 }
589
590 return 0;
591}
592
593static int __init subsys_restart_init(void)
594{
595 int ret = 0;
596
597 restart_level = RESET_SOC;
598
599 ret = ssr_init_soc_restart_orders();
600
601 return ret;
602}
603
604arch_initcall(subsys_restart_init);
605
606MODULE_DESCRIPTION("Subsystem Restart Driver");
607MODULE_LICENSE("GPL v2");