From: Boojin Kim Date: Wed, 4 Jul 2018 02:13:55 +0000 (+0900) Subject: chub: nanohub: don't reset on chub error status X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=9cdb43034b0d0c882c87ee497bde5fb42c34656c;p=GitHub%2FLineageOS%2Fandroid_kernel_motorola_exynos9610.git chub: nanohub: don't reset on chub error status Change-Id: I0f1da6039a0023674a7741203820ea98e866afc0 Signed-off-by: Boojin Kim --- diff --git a/drivers/staging/nanohub/chub.c b/drivers/staging/nanohub/chub.c index 6bb91d53b125..7df7302949db 100644 --- a/drivers/staging/nanohub/chub.c +++ b/drivers/staging/nanohub/chub.c @@ -777,32 +777,27 @@ 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); - 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); + reg = IPC_REG_BL; } else { ret = request_firmware(&entry, ipc->os_name, ipc->dev); - 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); + reg = IPC_REG_OS; + } + + if (ret) { + dev_err(ipc->dev, "%s, bl(%d) request_firmware failed\n", + bl, __func__); + return ret; } + 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; } @@ -942,6 +937,8 @@ 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 4494a729b1d2..f0660a507334 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;