Lines Matching refs:ipc_devlink
60 static int ipc_flash_send_data(struct iosm_devlink *ipc_devlink, u32 size, in ipc_flash_send_data() argument
69 dev_err(ipc_devlink->dev, "EBL2 pack failed for pack_id:%d", in ipc_flash_send_data()
74 ret = ipc_imem_sys_devlink_write(ipc_devlink, (u8 *)&flash_req, in ipc_flash_send_data()
77 dev_err(ipc_devlink->dev, "EBL Header write failed for Id:%x", in ipc_flash_send_data()
82 ret = ipc_imem_sys_devlink_write(ipc_devlink, payload, payload_length); in ipc_flash_send_data()
84 dev_err(ipc_devlink->dev, "EBL Payload write failed for Id:%x", in ipc_flash_send_data()
104 ipc_imem->ipc_devlink->devlink_sio.channel = in ipc_flash_link_establish()
107 if (!ipc_imem->ipc_devlink->devlink_sio.channel) in ipc_flash_link_establish()
110 if (ipc_imem_sys_devlink_read(ipc_imem->ipc_devlink, ler_data, in ipc_flash_link_establish()
120 ipc_imem_sys_devlink_close(ipc_imem->ipc_devlink); in ipc_flash_link_establish()
126 static int ipc_flash_receive_data(struct iosm_devlink *ipc_devlink, u32 size, in ipc_flash_receive_data() argument
133 ret = ipc_imem_sys_devlink_read(ipc_devlink, mdm_rsp_hdr, in ipc_flash_receive_data()
136 dev_err(ipc_devlink->dev, "EBL rsp to read %d bytes failed", in ipc_flash_receive_data()
146 ret = ipc_imem_sys_devlink_read(ipc_devlink, mdm_rsp, size, in ipc_flash_receive_data()
149 dev_err(ipc_devlink->dev, "EBL rsp to read %d bytes failed", in ipc_flash_receive_data()
166 static int ipc_flash_send_receive(struct iosm_devlink *ipc_devlink, u16 pack_id, in ipc_flash_send_receive() argument
175 ret = ipc_flash_send_data(ipc_devlink, frame_len, pack_id, payload, in ipc_flash_send_receive()
180 ret = ipc_flash_receive_data(ipc_devlink, in ipc_flash_send_receive()
194 int ipc_flash_boot_set_capabilities(struct iosm_devlink *ipc_devlink, in ipc_flash_boot_set_capabilities() argument
197 ipc_devlink->ebl_ctx.ebl_sw_info_version = in ipc_flash_boot_set_capabilities()
198 ipc_devlink->ebl_ctx.m_ebl_resp[EBL_RSP_SW_INFO_VER]; in ipc_flash_boot_set_capabilities()
199 ipc_devlink->ebl_ctx.m_ebl_resp[EBL_SKIP_ERASE] = IOSM_CAP_NOT_ENHANCED; in ipc_flash_boot_set_capabilities()
200 ipc_devlink->ebl_ctx.m_ebl_resp[EBL_SKIP_CRC] = IOSM_CAP_NOT_ENHANCED; in ipc_flash_boot_set_capabilities()
202 if (ipc_devlink->ebl_ctx.m_ebl_resp[EBL_CAPS_FLAG] & in ipc_flash_boot_set_capabilities()
204 if (ipc_devlink->param.erase_full_flash) in ipc_flash_boot_set_capabilities()
205 ipc_devlink->ebl_ctx.m_ebl_resp[EBL_OOS_CONFIG] &= in ipc_flash_boot_set_capabilities()
208 ipc_devlink->ebl_ctx.m_ebl_resp[EBL_OOS_CONFIG] &= in ipc_flash_boot_set_capabilities()
210 ipc_devlink->ebl_ctx.m_ebl_resp[EBL_EXT_CAPS_HANDLED] = in ipc_flash_boot_set_capabilities()
217 return ipc_flash_send_receive(ipc_devlink, FLASH_SET_PROT_CONF, in ipc_flash_boot_set_capabilities()
218 ipc_devlink->ebl_ctx.m_ebl_resp, in ipc_flash_boot_set_capabilities()
223 int ipc_flash_read_swid(struct iosm_devlink *ipc_devlink, u8 *mdm_rsp) in ipc_flash_read_swid() argument
230 if (ipc_devlink->ebl_ctx.ebl_sw_info_version != in ipc_flash_read_swid()
239 ret = ipc_flash_send_receive(ipc_devlink, FLASH_OOS_CONTROL, in ipc_flash_read_swid()
246 ret = ipc_flash_send_receive(ipc_devlink, FLASH_OOS_DATA_READ, in ipc_flash_read_swid()
252 dev_dbg(ipc_devlink->dev, "SWID %x RF_ENGINE_ID %x", swid->sw_id_val, in ipc_flash_read_swid()
258 devlink_flash_update_status_notify(ipc_devlink->devlink_ctx, ebl_swid, in ipc_flash_read_swid()
265 static int ipc_flash_erase_check(struct iosm_devlink *ipc_devlink, u8 *mdm_rsp) in ipc_flash_erase_check() argument
273 ret = ipc_flash_send_receive(ipc_devlink, FLASH_ERASE_CHECK, in ipc_flash_erase_check()
281 dev_err(ipc_devlink->dev, in ipc_flash_erase_check()
294 dev_err(ipc_devlink->dev, "Modem erase check timeout failure!"); in ipc_flash_erase_check()
303 static int ipc_flash_full_erase(struct iosm_devlink *ipc_devlink, u8 *mdm_rsp) in ipc_flash_full_erase() argument
310 dev_dbg(ipc_devlink->dev, "Erase full nand flash"); in ipc_flash_full_erase()
316 ret = ipc_flash_send_receive(ipc_devlink, FLASH_OOS_CONTROL, in ipc_flash_full_erase()
322 ipc_devlink->param.erase_full_flash_done = IOSM_SET_FLAG; in ipc_flash_full_erase()
323 ret = ipc_flash_erase_check(ipc_devlink, mdm_rsp); in ipc_flash_full_erase()
330 static int ipc_flash_download_region(struct iosm_devlink *ipc_devlink, in ipc_flash_download_region() argument
345 if (!ipc_devlink->param.erase_full_flash_done) { in ipc_flash_download_region()
347 ret = ipc_flash_send_receive(ipc_devlink, FLASH_ERASE_START, in ipc_flash_download_region()
353 ret = ipc_flash_erase_check(ipc_devlink, mdm_rsp); in ipc_flash_download_region()
359 ret = ipc_flash_send_receive(ipc_devlink, FLASH_SET_ADDRESS, in ipc_flash_download_region()
365 ret = ipc_flash_send_data(ipc_devlink, IOSM_EBL_DW_PACK_SIZE, in ipc_flash_download_region()
374 ret = ipc_imem_sys_devlink_write(ipc_devlink, file_ptr, in ipc_flash_download_region()
377 dev_err(ipc_devlink->dev, "Image write failed"); in ipc_flash_download_region()
384 ret = ipc_flash_receive_data(ipc_devlink, IOSM_EBL_DW_PAYL_SIZE, in ipc_flash_download_region()
399 int ipc_flash_send_fls(struct iosm_devlink *ipc_devlink, in ipc_flash_send_fls() argument
408 if (ipc_devlink->param.erase_full_flash) { in ipc_flash_send_fls()
409 ipc_devlink->param.erase_full_flash = false; in ipc_flash_send_fls()
410 ret = ipc_flash_full_erase(ipc_devlink, mdm_rsp); in ipc_flash_send_fls()
417 ret = ipc_flash_send_receive(ipc_devlink, FLASH_SEC_START, in ipc_flash_send_fls()
425 ret = ipc_flash_download_region(ipc_devlink, fw, mdm_rsp); in ipc_flash_send_fls()
432 ret = ipc_flash_send_receive(ipc_devlink, FLASH_SEC_END, in ipc_flash_send_fls()
449 int ipc_flash_boot_psi(struct iosm_devlink *ipc_devlink, in ipc_flash_boot_psi() argument
457 dev_dbg(ipc_devlink->dev, "Boot transfer PSI"); in ipc_flash_boot_psi()
463 ret = ipc_imem_sys_devlink_write(ipc_devlink, psi_code, psi_size); in ipc_flash_boot_psi()
465 dev_err(ipc_devlink->dev, "RPSI Image write failed"); in ipc_flash_boot_psi()
469 ret = ipc_imem_sys_devlink_read(ipc_devlink, read_data, in ipc_flash_boot_psi()
472 dev_err(ipc_devlink->dev, "ipc_devlink_sio_read ACK failed"); in ipc_flash_boot_psi()
483 devlink_flash_update_status_notify(ipc_devlink->devlink_ctx, in ipc_flash_boot_psi()
487 dev_dbg(ipc_devlink->dev, "Coredump detected"); in ipc_flash_boot_psi()
488 ret = ipc_coredump_get_list(ipc_devlink, in ipc_flash_boot_psi()
491 dev_err(ipc_devlink->dev, "Failed to get cd list"); in ipc_flash_boot_psi()
506 int ipc_flash_boot_ebl(struct iosm_devlink *ipc_devlink, in ipc_flash_boot_ebl() argument
514 if (ipc_mmio_get_exec_stage(ipc_devlink->pcie->imem->mmio) != in ipc_flash_boot_ebl()
516 devlink_flash_update_status_notify(ipc_devlink->devlink_ctx, in ipc_flash_boot_ebl()
522 dev_dbg(ipc_devlink->dev, "Boot transfer EBL"); in ipc_flash_boot_ebl()
523 ret = ipc_devlink_send_cmd(ipc_devlink, rpsi_cmd_code_ebl, in ipc_flash_boot_ebl()
526 dev_err(ipc_devlink->dev, "Sending rpsi_cmd_code_ebl failed"); in ipc_flash_boot_ebl()
530 ret = ipc_imem_sys_devlink_read(ipc_devlink, read_data, IOSM_READ_SIZE, in ipc_flash_boot_ebl()
533 dev_err(ipc_devlink->dev, "rpsi_cmd_code_ebl read failed"); in ipc_flash_boot_ebl()
542 ret = ipc_imem_sys_devlink_write(ipc_devlink, (u8 *)&ebl_size, in ipc_flash_boot_ebl()
545 dev_err(ipc_devlink->dev, "EBL length write failed"); in ipc_flash_boot_ebl()
549 ret = ipc_imem_sys_devlink_read(ipc_devlink, read_data, IOSM_READ_SIZE, in ipc_flash_boot_ebl()
552 dev_err(ipc_devlink->dev, "EBL read failed"); in ipc_flash_boot_ebl()
561 ret = ipc_imem_sys_devlink_write(ipc_devlink, in ipc_flash_boot_ebl()
565 dev_err(ipc_devlink->dev, "EBL data transfer failed"); in ipc_flash_boot_ebl()
569 ret = ipc_imem_sys_devlink_read(ipc_devlink, read_data, IOSM_READ_SIZE, in ipc_flash_boot_ebl()
572 dev_err(ipc_devlink->dev, "EBL read failed"); in ipc_flash_boot_ebl()
581 ret = ipc_imem_sys_devlink_read(ipc_devlink, in ipc_flash_boot_ebl()
582 ipc_devlink->ebl_ctx.m_ebl_resp, in ipc_flash_boot_ebl()
585 dev_err(ipc_devlink->dev, "EBL response read failed"); in ipc_flash_boot_ebl()