linux/drivers/net/wwan/iosm/iosm_ipc_flash.c

// SPDX-License-Identifier: GPL-2.0-only
/*
 * Copyright (C) 2020-2021 Intel Corporation.
 */

#include "iosm_ipc_coredump.h"
#include "iosm_ipc_devlink.h"
#include "iosm_ipc_flash.h"

/* This function will pack the data to be sent to the modem using the
 * payload, payload length and pack id
 */
static int ipc_flash_proc_format_ebl_pack(struct iosm_flash_data *flash_req,
					  u32 pack_length, u16 pack_id,
					  u8 *payload, u32 payload_length)
{}

/* validate the response received from modem and
 * check the type of errors received
 */
static int ipc_flash_proc_check_ebl_rsp(void *hdr_rsp, void *payload_rsp)
{}

/* Send data to the modem */
static int ipc_flash_send_data(struct iosm_devlink *ipc_devlink, u32 size,
			       u16 pack_id, u8 *payload, u32 payload_length)
{}

/**
 * ipc_flash_link_establish - Flash link establishment
 * @ipc_imem:           Pointer to struct iosm_imem
 *
 * Returns:     0 on success and failure value on error
 */
int ipc_flash_link_establish(struct iosm_imem *ipc_imem)
{}

/* Receive data from the modem */
static int ipc_flash_receive_data(struct iosm_devlink *ipc_devlink, u32 size,
				  u8 *mdm_rsp)
{}

/* Function to send command to modem and receive response */
static int ipc_flash_send_receive(struct iosm_devlink *ipc_devlink, u16 pack_id,
				  u8 *payload, u32 payload_length, u8 *mdm_rsp)
{}

/**
 * ipc_flash_boot_set_capabilities  - Set modem boot capabilities in flash
 * @ipc_devlink:        Pointer to devlink structure
 * @mdm_rsp:            Pointer to modem response buffer
 *
 * Returns:             0 on success and failure value on error
 */
int ipc_flash_boot_set_capabilities(struct iosm_devlink *ipc_devlink,
				    u8 *mdm_rsp)
{}

/* Read the SWID type and SWID value from the EBL */
int ipc_flash_read_swid(struct iosm_devlink *ipc_devlink, u8 *mdm_rsp)
{}

/* Function to check if full erase or conditional erase was successful */
static int ipc_flash_erase_check(struct iosm_devlink *ipc_devlink, u8 *mdm_rsp)
{}

/* Full erase function which will erase the nand flash through EBL command */
static int ipc_flash_full_erase(struct iosm_devlink *ipc_devlink, u8 *mdm_rsp)
{}

/* Logic for flashing all the Loadmaps available for individual fls file */
static int ipc_flash_download_region(struct iosm_devlink *ipc_devlink,
				     const struct firmware *fw, u8 *mdm_rsp)
{}

/**
 * ipc_flash_send_fls  - Inject Modem subsystem fls file to device
 * @ipc_devlink:        Pointer to devlink structure
 * @fw:                 FW image
 * @mdm_rsp:            Pointer to modem response buffer
 *
 * Returns:             0 on success and failure value on error
 */
int ipc_flash_send_fls(struct iosm_devlink *ipc_devlink,
		       const struct firmware *fw, u8 *mdm_rsp)
{}

/**
 * ipc_flash_boot_psi - Inject PSI image
 * @ipc_devlink:        Pointer to devlink structure
 * @fw:                 FW image
 *
 * Returns:             0 on success and failure value on error
 */
int ipc_flash_boot_psi(struct iosm_devlink *ipc_devlink,
		       const struct firmware *fw)
{}

/**
 * ipc_flash_boot_ebl  - Inject EBL image
 * @ipc_devlink:        Pointer to devlink structure
 * @fw:                 FW image
 *
 * Returns:             0 on success and failure value on error
 */
int ipc_flash_boot_ebl(struct iosm_devlink *ipc_devlink,
		       const struct firmware *fw)
{}