From aead287f8e42311239afc4e95261deec16be35e7 Mon Sep 17 00:00:00 2001 From: Boojin Kim Date: Wed, 4 Jul 2018 19:07:43 +0900 Subject: [PATCH] Revert "chub: nanohub: don't reset on chub error status" This reverts commit 9cdb43034b0d0c882c87ee497bde5fb42c34656c. Change-Id: I65adec052aeaddfaf15093c750abd13e3967a58f Signed-off-by: Boojin Kim --- drivers/staging/nanohub/chub.c | 37 ++++++++++++++++++---------------- drivers/staging/nanohub/chub.h | 1 - drivers/staging/nanohub/main.c | 18 ----------------- 3 files changed, 20 insertions(+), 36 deletions(-) diff --git a/drivers/staging/nanohub/chub.c b/drivers/staging/nanohub/chub.c index 7df7302949db..6bb91d53b125 100644 --- a/drivers/staging/nanohub/chub.c +++ b/drivers/staging/nanohub/chub.c @@ -777,27 +777,32 @@ int contexthub_download_image(struct contexthub_ipc_info *ipc, int bl) { const struct firmware *entry; int ret; - enum ipc_region reg; - char *name; if (bl) { ret = request_firmware(&entry, "bl.unchecked.bin", ipc->dev); - reg = IPC_REG_BL; + if (ret) { + dev_err(ipc->dev, "%s, bl request_firmware failed\n", + __func__); + return ret; + } + memcpy(ipc_get_base(IPC_REG_BL), entry->data, entry->size); + dev_info(ipc->dev, "%s: bootloader(size:0x%x) on %lx\n", + __func__, (int)entry->size, + (unsigned long)ipc_get_base(IPC_REG_BL)); + release_firmware(entry); } else { ret = request_firmware(&entry, ipc->os_name, ipc->dev); - reg = IPC_REG_OS; - } - - if (ret) { - dev_err(ipc->dev, "%s, bl(%d) request_firmware failed\n", - bl, __func__); - return ret; + if (ret) { + dev_err(ipc->dev, "%s, %s request_firmware failed\n", + __func__, ipc->os_name); + return ret; + } + memcpy(ipc_get_base(IPC_REG_OS), entry->data, entry->size); + dev_info(ipc->dev, "%s: %s(size:0x%x) on %lx\n", __func__, + ipc->os_name, (int)entry->size, + (unsigned long)ipc_get_base(IPC_REG_OS)); + release_firmware(entry); } - memcpy(ipc_get_base(reg), entry->data, entry->size); - dev_info(ipc->dev, "%s: bl:%d, bin(size:0x%x) on %lx\n", - __func__, bl, (int)entry->size, - (unsigned long)ipc_get_base(reg)); - release_firmware(entry); return 0; } @@ -937,8 +942,6 @@ 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 */ diff --git a/drivers/staging/nanohub/chub.h b/drivers/staging/nanohub/chub.h index f0660a507334..4494a729b1d2 100644 --- a/drivers/staging/nanohub/chub.h +++ b/drivers/staging/nanohub/chub.h @@ -92,7 +92,6 @@ 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 a3878dac6ec3..2435a1dd42e2 100644 --- a/drivers/staging/nanohub/main.c +++ b/drivers/staging/nanohub/main.c @@ -721,11 +721,7 @@ 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; } @@ -1380,11 +1376,6 @@ 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); @@ -1414,15 +1405,6 @@ 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