static int cyttsp_exit_bl_mode(struct cyttsp *ts) { int error; u8 bl_cmd[sizeof(bl_command)]; memcpy(bl_cmd, bl_command, sizeof(bl_command)); if (ts->pdata->bl_keys) memcpy(&bl_cmd[sizeof(bl_command) - CY_NUM_BL_KEYS], ts->pdata->bl_keys, CY_NUM_BL_KEYS); error = ttsp_write_block_data(ts, CY_REG_BASE, sizeof(bl_cmd), bl_cmd); if (error) return error; msleep(CY_DELAY_DFLT); error = cyttsp_load_bl_regs(ts); if (error) return error; if (GET_BOOTLOADERMODE(ts->bl_data.bl_status)) return -EIO; return 0; }
static int cyttsp_exit_bl_mode(struct cyttsp *ts) { int retval; int tries; u8 bl_cmd[sizeof(bl_command)]; memcpy(bl_cmd, bl_command, sizeof(bl_command)); if (ts->platform_data->bl_keys) memcpy(&bl_cmd[sizeof(bl_command) - CY_NUM_BL_KEYS], ts->platform_data->bl_keys, sizeof(bl_command)); dev_dbg(ts->dev, "%s: bl_cmd= " "%02X %02X %02X %02X %02X %02X %02X %02X %02X %02X %02X\n", __func__, bl_cmd[0], bl_cmd[1], bl_cmd[2], bl_cmd[3], bl_cmd[4], bl_cmd[5], bl_cmd[6], bl_cmd[7], bl_cmd[8], bl_cmd[9], bl_cmd[10]); retval = ttsp_write_block_data(ts, CY_REG_BASE, sizeof(bl_cmd), (void *)bl_cmd); if (retval < 0) return retval; /* wait for TTSP Device to complete switch to Operational mode */ tries = 0; do { msleep(CY_DELAY_DFLT); retval = cyttsp_load_bl_regs(ts); } while (!((retval == 0) && !GET_BOOTLOADERMODE(ts->bl_data.bl_status)) && (tries++ < CY_DELAY_MAX)); dev_dbg(ts->dev, "%s: check bl ready tries=%d ret=%d stat=%02X\n", __func__, tries, retval, ts->bl_data.bl_status); if (retval < 0) return retval; else if (GET_BOOTLOADERMODE(ts->bl_data.bl_status)) return -ENODEV; else return 0; }
static int cyttsp_bl_app_valid(struct cyttsp *ts) { int retval; retval = cyttsp_load_bl_regs(ts); if (retval < 0) return -ENODEV; if (GET_BOOTLOADERMODE(ts->bl_data.bl_status)) { if (IS_VALID_APP(ts->bl_data.bl_status)) { dev_dbg(ts->dev, "%s: App found; normal boot\n", __func__); return 0; } else { dev_dbg(ts->dev, "%s: NO APP; load firmware!!\n", __func__); return -ENODEV; } } else if (GET_HSTMODE(ts->bl_data.bl_file) == CY_OPERATE_MODE) { if (!(IS_OPERATIONAL_ERR(ts->bl_data.bl_status))) { dev_dbg(ts->dev, "%s: Operational\n", __func__); return 1; } else { dev_dbg(ts->dev, "%s: Operational failure\n", __func__); return -ENODEV; } } else { dev_dbg(ts->dev, "%s: Non-Operational failure\n", __func__); return -ENODEV; } }