Revert "chub: nanohub: don't reset on chub error status"
authorBoojin Kim <boojin.kim@samsung.com>
Wed, 4 Jul 2018 10:07:43 +0000 (19:07 +0900)
committerBoojin Kim <boojin.kim@samsung.com>
Wed, 4 Jul 2018 10:10:50 +0000 (19:10 +0900)
This reverts commit 9cdb43034b0d0c882c87ee497bde5fb42c34656c.

Change-Id: I65adec052aeaddfaf15093c750abd13e3967a58f
Signed-off-by: Boojin Kim <boojin.kim@samsung.com>
drivers/staging/nanohub/chub.c
drivers/staging/nanohub/chub.h
drivers/staging/nanohub/main.c

index 7df7302949db93095cf5cc587a31f7dbad4e0cf0..6bb91d53b125fd95066909b7d0304c97f5642e99 100644 (file)
@@ -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 */
index f0660a507334fa0d243d6f427d0d05fb5fb6eedf..4494a729b1d258c46923287471000b79cfc7405b 100644 (file)
@@ -92,7 +92,6 @@ enum chub_status {
        CHUB_ST_RUN,
        CHUB_ST_SHUTDOWN,
        CHUB_ST_NO_RESPONSE,
-       CHUB_ST_HANG,
 };
 
 struct read_wait {
index a3878dac6ec37e78f1fd86179542ad8617495969..2435a1dd42e29e31b98099d8d335e52c7e005f91 100644 (file)
@@ -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, &param);
@@ -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;