Loading drivers/soc/qcom/bgcom_interface.c +15 −0 Original line number Diff line number Diff line Loading @@ -94,6 +94,7 @@ struct device *dev_ret; static dev_t bg_dev; static int device_open; static void *handle; static bool twm_exit; static struct bgcom_open_config_type config_type; static DECLARE_COMPLETION(bg_modem_down_wait); Loading Loading @@ -363,6 +364,10 @@ static long bg_com_ioctl(struct file *filp, case BG_MODEM_DOWN2_BG_DONE: ret = modem_down2_bg(); break; case BG_TWM_EXIT: twm_exit = true; ret = 0; break; default: ret = -ENOIOCTLCMD; } Loading Loading @@ -562,6 +567,16 @@ static int ssr_modem_cb(struct notifier_block *this, return NOTIFY_DONE; } bool is_twm_exit(void) { if (twm_exit) { twm_exit = false; return true; } return false; } EXPORT_SYMBOL(is_twm_exit); static struct notifier_block ssr_modem_nb = { .notifier_call = ssr_modem_cb, .priority = 0, Loading drivers/soc/qcom/bgcom_interface.h +8 −1 Original line number Diff line number Diff line Loading @@ -13,10 +13,17 @@ #ifndef BGCOM_INTERFACE_H #define BGCOM_INTERFACE_H /** /* * bg_soft_reset() - soft reset Blackghost * Return 0 on success or -Ve on error */ int bg_soft_reset(void); /* * is_twm_exit() * Return true if device is booting up on TWM exit. * value is auto cleared once read. */ bool is_twm_exit(void); #endif /* BGCOM_INTERFACE_H */ drivers/soc/qcom/pil_bg_intf.h +1 −1 Original line number Diff line number Diff line Loading @@ -36,7 +36,7 @@ __packed struct tzapp_bg_req { __packed struct tzapp_bg_rsp { uint32_t tzapp_bg_cmd; uint32_t bg_info_len; uint32_t status; int32_t status; uint32_t bg_info[100]; }; Loading drivers/soc/qcom/subsys-pil-bg.c +5 −3 Original line number Diff line number Diff line Loading @@ -30,6 +30,7 @@ #include "peripheral-loader.h" #include "../../misc/qseecom_kernel.h" #include "pil_bg_intf.h" #include "bgcom_interface.h" #define INVALID_GPIO -1 #define NUM_GPIOS 4 Loading @@ -37,7 +38,7 @@ #define desc_to_data(d) container_of(d, struct pil_bg_data, desc) #define subsys_to_data(d) container_of(d, struct pil_bg_data, subsys_desc) #define BG_RAMDUMP_SZ 0x00102000 #define BG_CRASH_IN_TWM 2 #define BG_CRASH_IN_TWM -2 /** * struct pil_bg_data * @qseecom_handle: handle of TZ app Loading Loading @@ -393,7 +394,9 @@ static int bg_auth_and_xfer(struct pil_desc *pil) ret = bgpil_tzapp_comm(bg_data, &bg_tz_req); if (bg_data->cmd_status == BG_CRASH_IN_TWM) { /* Do ramdump and resend boot cmd */ bg_data->subsys_desc.ramdump(true, &bg_data->subsys_desc); if (is_twm_exit()) bg_data->subsys_desc.ramdump(true, &bg_data->subsys_desc); bg_tz_req.tzapp_bg_cmd = BGPIL_DLOAD_CONT; ret = bgpil_tzapp_comm(bg_data, &bg_tz_req); } Loading Loading @@ -524,7 +527,6 @@ static irqreturn_t bg_status_change(int irq, void *dev_id) } else if (value == false && drvdata->is_ready) { dev_err(drvdata->desc.dev, "BG got unexpected reset: irq state changed 1->0\n"); drvdata->is_ready = false; queue_work(drvdata->bg_queue, &drvdata->restart_work); } else { dev_err(drvdata->desc.dev, Loading include/uapi/linux/bgcom_interface.h +4 −0 Original line number Diff line number Diff line Loading @@ -19,6 +19,7 @@ #define BGCOM_REG_WRITE 5 #define BGCOM_SOFT_RESET 6 #define BGCOM_MODEM_DOWN2_BG 7 #define BGCOM_TWM_EXIT 8 #define EXCHANGE_CODE 'V' struct bg_ui_data { Loading Loading @@ -57,6 +58,9 @@ enum bg_event_type { #define BG_SOFT_RESET \ _IOWR(EXCHANGE_CODE, BGCOM_SOFT_RESET, \ struct bg_ui_data) #define BG_TWM_EXIT \ _IOWR(EXCHANGE_CODE, BGCOM_TWM_EXIT, \ struct bg_ui_data) #define BG_MODEM_DOWN2_BG_DONE \ _IOWR(EXCHANGE_CODE, BGCOM_MODEM_DOWN2_BG, \ struct bg_ui_data) Loading Loading
drivers/soc/qcom/bgcom_interface.c +15 −0 Original line number Diff line number Diff line Loading @@ -94,6 +94,7 @@ struct device *dev_ret; static dev_t bg_dev; static int device_open; static void *handle; static bool twm_exit; static struct bgcom_open_config_type config_type; static DECLARE_COMPLETION(bg_modem_down_wait); Loading Loading @@ -363,6 +364,10 @@ static long bg_com_ioctl(struct file *filp, case BG_MODEM_DOWN2_BG_DONE: ret = modem_down2_bg(); break; case BG_TWM_EXIT: twm_exit = true; ret = 0; break; default: ret = -ENOIOCTLCMD; } Loading Loading @@ -562,6 +567,16 @@ static int ssr_modem_cb(struct notifier_block *this, return NOTIFY_DONE; } bool is_twm_exit(void) { if (twm_exit) { twm_exit = false; return true; } return false; } EXPORT_SYMBOL(is_twm_exit); static struct notifier_block ssr_modem_nb = { .notifier_call = ssr_modem_cb, .priority = 0, Loading
drivers/soc/qcom/bgcom_interface.h +8 −1 Original line number Diff line number Diff line Loading @@ -13,10 +13,17 @@ #ifndef BGCOM_INTERFACE_H #define BGCOM_INTERFACE_H /** /* * bg_soft_reset() - soft reset Blackghost * Return 0 on success or -Ve on error */ int bg_soft_reset(void); /* * is_twm_exit() * Return true if device is booting up on TWM exit. * value is auto cleared once read. */ bool is_twm_exit(void); #endif /* BGCOM_INTERFACE_H */
drivers/soc/qcom/pil_bg_intf.h +1 −1 Original line number Diff line number Diff line Loading @@ -36,7 +36,7 @@ __packed struct tzapp_bg_req { __packed struct tzapp_bg_rsp { uint32_t tzapp_bg_cmd; uint32_t bg_info_len; uint32_t status; int32_t status; uint32_t bg_info[100]; }; Loading
drivers/soc/qcom/subsys-pil-bg.c +5 −3 Original line number Diff line number Diff line Loading @@ -30,6 +30,7 @@ #include "peripheral-loader.h" #include "../../misc/qseecom_kernel.h" #include "pil_bg_intf.h" #include "bgcom_interface.h" #define INVALID_GPIO -1 #define NUM_GPIOS 4 Loading @@ -37,7 +38,7 @@ #define desc_to_data(d) container_of(d, struct pil_bg_data, desc) #define subsys_to_data(d) container_of(d, struct pil_bg_data, subsys_desc) #define BG_RAMDUMP_SZ 0x00102000 #define BG_CRASH_IN_TWM 2 #define BG_CRASH_IN_TWM -2 /** * struct pil_bg_data * @qseecom_handle: handle of TZ app Loading Loading @@ -393,7 +394,9 @@ static int bg_auth_and_xfer(struct pil_desc *pil) ret = bgpil_tzapp_comm(bg_data, &bg_tz_req); if (bg_data->cmd_status == BG_CRASH_IN_TWM) { /* Do ramdump and resend boot cmd */ bg_data->subsys_desc.ramdump(true, &bg_data->subsys_desc); if (is_twm_exit()) bg_data->subsys_desc.ramdump(true, &bg_data->subsys_desc); bg_tz_req.tzapp_bg_cmd = BGPIL_DLOAD_CONT; ret = bgpil_tzapp_comm(bg_data, &bg_tz_req); } Loading Loading @@ -524,7 +527,6 @@ static irqreturn_t bg_status_change(int irq, void *dev_id) } else if (value == false && drvdata->is_ready) { dev_err(drvdata->desc.dev, "BG got unexpected reset: irq state changed 1->0\n"); drvdata->is_ready = false; queue_work(drvdata->bg_queue, &drvdata->restart_work); } else { dev_err(drvdata->desc.dev, Loading
include/uapi/linux/bgcom_interface.h +4 −0 Original line number Diff line number Diff line Loading @@ -19,6 +19,7 @@ #define BGCOM_REG_WRITE 5 #define BGCOM_SOFT_RESET 6 #define BGCOM_MODEM_DOWN2_BG 7 #define BGCOM_TWM_EXIT 8 #define EXCHANGE_CODE 'V' struct bg_ui_data { Loading Loading @@ -57,6 +58,9 @@ enum bg_event_type { #define BG_SOFT_RESET \ _IOWR(EXCHANGE_CODE, BGCOM_SOFT_RESET, \ struct bg_ui_data) #define BG_TWM_EXIT \ _IOWR(EXCHANGE_CODE, BGCOM_TWM_EXIT, \ struct bg_ui_data) #define BG_MODEM_DOWN2_BG_DONE \ _IOWR(EXCHANGE_CODE, BGCOM_MODEM_DOWN2_BG, \ struct bg_ui_data) Loading