From cf3574b499e6edc410de2ff3fc124457a1608db2 Mon Sep 17 00:00:00 2001 From: Boojin Kim Date: Wed, 4 Jul 2018 19:08:56 +0900 Subject: [PATCH] chub: disable silent-reset Change-Id: I08c37f8053b7dd60c664f5ce952a72eaef6094c3 Signed-off-by: Boojin Kim --- drivers/staging/nanohub/chub.c | 8 ++++++-- drivers/staging/nanohub/chub.h | 1 + drivers/staging/nanohub/main.c | 18 ++++++++++++++++++ 3 files changed, 25 insertions(+), 2 deletions(-) diff --git a/drivers/staging/nanohub/chub.c b/drivers/staging/nanohub/chub.c index 58965bfc463d..5fad14964679 100644 --- a/drivers/staging/nanohub/chub.c +++ b/drivers/staging/nanohub/chub.c @@ -913,6 +913,7 @@ do_reset: /* dump hw & sram into file */ chub_dbg_dump_hw(ipc, err); if (need_reset) { +#ifdef CHUB_RESET_ENABLE ret = contexthub_reset(ipc); if (ret) dev_warn(ipc->dev, "%s: fails to reset %d.\n", @@ -925,6 +926,9 @@ do_reset: if (ipc->irq_wdt) enable_irq(ipc->irq_wdt); } +#else + atomic_set(&ipc->chub_status, CHUB_ST_HANG); +#endif } else { /* dump log into file: DO NOT logbuf dueto sram corruption */ log_dump_all(err); @@ -1043,7 +1047,7 @@ static irqreturn_t contexthub_irq_handler(int irq, void *data) return IRQ_HANDLED; } -#ifdef WDT_ENABLE +#ifdef CHUB_RESET_ENABLE static irqreturn_t contexthub_irq_wdt_handler(int irq, void *data) { struct contexthub_ipc_info *ipc = data; @@ -1175,7 +1179,7 @@ static __init int contexthub_ipc_hw_init(struct platform_device *pdev, return ret; } -#ifdef WDT_ENABLE +#ifdef CHUB_RESET_ENABLE /* get wdt interrupt optionally */ chub->irq_wdt = irq_of_parse_and_map(node, 1); if (chub->irq_wdt > 0) { diff --git a/drivers/staging/nanohub/chub.h b/drivers/staging/nanohub/chub.h index aa080694b23d..adf573e98504 100644 --- a/drivers/staging/nanohub/chub.h +++ b/drivers/staging/nanohub/chub.h @@ -92,6 +92,7 @@ enum chub_status { CHUB_ST_RUN, CHUB_ST_SHUTDOWN, CHUB_ST_NO_RESPONSE, + CHUB_ST_HANG, }; struct read_wait { diff --git a/drivers/staging/nanohub/main.c b/drivers/staging/nanohub/main.c index 2435a1dd42e2..a3878dac6ec3 100644 --- a/drivers/staging/nanohub/main.c +++ b/drivers/staging/nanohub/main.c @@ -721,7 +721,11 @@ static int nanohub_hw_reset(struct nanohub_data *data) nanohub_wakeup_unlock(data); } #elif defined(CONFIG_NANOHUB_MAILBOX) +#ifdef CHUB_RESET_ENABLE ret = contexthub_reset(data->pdata->mailbox_client); +#else + ret = -EINVAL; +#endif #endif return ret; } @@ -1376,6 +1380,11 @@ static int nanohub_kthread(void *arg) static const struct sched_param param = { .sched_priority = (MAX_USER_RT_PRIO/2)-1, }; +#ifdef CONFIG_NANOHUB_MAILBOX +#ifndef CHUB_RESET_ENABLE + struct contexthub_ipc_info *ipc; +#endif +#endif data->kthread_err_cnt = 0; sched_setscheduler(current, SCHED_FIFO, ¶m); @@ -1405,6 +1414,15 @@ static int nanohub_kthread(void *arg) } msleep_interruptible(WAKEUP_TIMEOUT_MS); nanohub_set_state(data, ST_RUNNING); +#ifdef CONFIG_NANOHUB_MAILBOX +#ifndef CHUB_RESET_ENABLE + if (ret) { + dev_warn(data->io[ID_NANOHUB_SENSOR].dev, + "%s fails. nanohub isn't running\n", __func__); + return 0; + } +#endif +#endif break; case ST_RUNNING: break; -- 2.20.1