summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJakub Kicinski <kuba@kernel.org>2021-09-15 14:58:23 -0700
committerDavid S. Miller <davem@davemloft.net>2021-09-16 14:32:53 +0100
commitd1ab2647de3272e878604720ac0af66442e8d1d3 (patch)
tree93eb8b63d72be96c126faa5a1257a72c05e71851
parent63f85c401ebaa62094c373c780d4051a84608ac3 (diff)
downloadlinux-d1ab2647de3272e878604720ac0af66442e8d1d3.tar.gz
linux-d1ab2647de3272e878604720ac0af66442e8d1d3.tar.bz2
linux-d1ab2647de3272e878604720ac0af66442e8d1d3.zip
Revert "net: wwan: iosm: firmware flashing and coredump collection"
The devlink parameters are not the right mechanism to pass extra parameters to device flashing. The params added are also undocumented. This reverts commit 13bb8429ca98 ("net: wwan: iosm: firmware flashing and coredump collection"). Signed-off-by: Jakub Kicinski <kuba@kernel.org> Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r--drivers/net/wwan/Kconfig1
-rw-r--r--drivers/net/wwan/iosm/Makefile5
-rw-r--r--drivers/net/wwan/iosm/iosm_ipc_chnl_cfg.c6
-rw-r--r--drivers/net/wwan/iosm/iosm_ipc_chnl_cfg.h1
-rw-r--r--drivers/net/wwan/iosm/iosm_ipc_coredump.c110
-rw-r--r--drivers/net/wwan/iosm/iosm_ipc_coredump.h75
-rw-r--r--drivers/net/wwan/iosm/iosm_ipc_devlink.c360
-rw-r--r--drivers/net/wwan/iosm/iosm_ipc_devlink.h207
-rw-r--r--drivers/net/wwan/iosm/iosm_ipc_flash.c562
-rw-r--r--drivers/net/wwan/iosm/iosm_ipc_flash.h271
-rw-r--r--drivers/net/wwan/iosm/iosm_ipc_imem.c103
-rw-r--r--drivers/net/wwan/iosm/iosm_ipc_imem.h18
-rw-r--r--drivers/net/wwan/iosm/iosm_ipc_imem_ops.c317
-rw-r--r--drivers/net/wwan/iosm/iosm_ipc_imem_ops.h49
14 files changed, 31 insertions, 2054 deletions
diff --git a/drivers/net/wwan/Kconfig b/drivers/net/wwan/Kconfig
index 17543be14665..77dbfc418bce 100644
--- a/drivers/net/wwan/Kconfig
+++ b/drivers/net/wwan/Kconfig
@@ -71,7 +71,6 @@ config RPMSG_WWAN_CTRL
config IOSM
tristate "IOSM Driver for Intel M.2 WWAN Device"
depends on INTEL_IOMMU
- select NET_DEVLINK
help
This driver enables Intel M.2 WWAN Device communication.
diff --git a/drivers/net/wwan/iosm/Makefile b/drivers/net/wwan/iosm/Makefile
index b838034bb120..4f9f0ae398e1 100644
--- a/drivers/net/wwan/iosm/Makefile
+++ b/drivers/net/wwan/iosm/Makefile
@@ -18,9 +18,6 @@ iosm-y = \
iosm_ipc_protocol.o \
iosm_ipc_protocol_ops.o \
iosm_ipc_mux.o \
- iosm_ipc_mux_codec.o \
- iosm_ipc_devlink.o \
- iosm_ipc_flash.o \
- iosm_ipc_coredump.o
+ iosm_ipc_mux_codec.o
obj-$(CONFIG_IOSM) := iosm.o
diff --git a/drivers/net/wwan/iosm/iosm_ipc_chnl_cfg.c b/drivers/net/wwan/iosm/iosm_ipc_chnl_cfg.c
index 128c999e08bb..519361ec40df 100644
--- a/drivers/net/wwan/iosm/iosm_ipc_chnl_cfg.c
+++ b/drivers/net/wwan/iosm/iosm_ipc_chnl_cfg.c
@@ -8,7 +8,7 @@
#include "iosm_ipc_chnl_cfg.h"
/* Max. sizes of a downlink buffers */
-#define IPC_MEM_MAX_DL_FLASH_BUF_SIZE (64 * 1024)
+#define IPC_MEM_MAX_DL_FLASH_BUF_SIZE (16 * 1024)
#define IPC_MEM_MAX_DL_LOOPBACK_SIZE (1 * 1024 * 1024)
#define IPC_MEM_MAX_DL_AT_BUF_SIZE 2048
#define IPC_MEM_MAX_DL_RPC_BUF_SIZE (32 * 1024)
@@ -60,10 +60,6 @@ static struct ipc_chnl_cfg modem_cfg[] = {
{ IPC_MEM_CTRL_CHL_ID_6, IPC_MEM_PIPE_12, IPC_MEM_PIPE_13,
IPC_MEM_MAX_TDS_MBIM, IPC_MEM_MAX_TDS_MBIM,
IPC_MEM_MAX_DL_MBIM_BUF_SIZE, WWAN_PORT_MBIM },
- /* Flash Channel/Coredump Channel */
- { IPC_MEM_CTRL_CHL_ID_7, IPC_MEM_PIPE_0, IPC_MEM_PIPE_1,
- IPC_MEM_MAX_TDS_FLASH_UL, IPC_MEM_MAX_TDS_FLASH_DL,
- IPC_MEM_MAX_DL_FLASH_BUF_SIZE, WWAN_PORT_UNKNOWN },
};
int ipc_chnl_cfg_get(struct ipc_chnl_cfg *chnl_cfg, int index)
diff --git a/drivers/net/wwan/iosm/iosm_ipc_chnl_cfg.h b/drivers/net/wwan/iosm/iosm_ipc_chnl_cfg.h
index e77084e76718..422471367f78 100644
--- a/drivers/net/wwan/iosm/iosm_ipc_chnl_cfg.h
+++ b/drivers/net/wwan/iosm/iosm_ipc_chnl_cfg.h
@@ -23,7 +23,6 @@ enum ipc_channel_id {
IPC_MEM_CTRL_CHL_ID_4,
IPC_MEM_CTRL_CHL_ID_5,
IPC_MEM_CTRL_CHL_ID_6,
- IPC_MEM_CTRL_CHL_ID_7,
};
/**
diff --git a/drivers/net/wwan/iosm/iosm_ipc_coredump.c b/drivers/net/wwan/iosm/iosm_ipc_coredump.c
deleted file mode 100644
index fba3c3454e80..000000000000
--- a/drivers/net/wwan/iosm/iosm_ipc_coredump.c
+++ /dev/null
@@ -1,110 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0-only
-/*
- * Copyright (C) 2020-2021 Intel Corporation.
- */
-
-#include "iosm_ipc_coredump.h"
-
-/* Collect coredump data from modem */
-int ipc_coredump_collect(struct iosm_devlink *devlink, u8 **data, int entry,
- u32 region_size)
-{
- int ret, bytes_to_read, bytes_read = 0, i = 0;
- s32 remaining;
- u8 *data_ptr;
-
- data_ptr = vmalloc(region_size);
- if (!data_ptr)
- return -ENOMEM;
-
- remaining = devlink->cd_file_info[entry].actual_size;
- ret = ipc_devlink_send_cmd(devlink, rpsi_cmd_coredump_get, entry);
- if (ret) {
- dev_err(devlink->dev, "Send coredump_get cmd failed");
- goto get_cd_fail;
- }
- while (remaining > 0) {
- bytes_to_read = min(remaining, MAX_DATA_SIZE);
- bytes_read = 0;
- ret = ipc_imem_sys_devlink_read(devlink, data_ptr + i,
- bytes_to_read, &bytes_read);
- if (ret) {
- dev_err(devlink->dev, "CD data read failed");
- goto get_cd_fail;
- }
- remaining -= bytes_read;
- i += bytes_read;
- }
-
- *data = data_ptr;
-
- return ret;
-get_cd_fail:
- vfree(data_ptr);
- return ret;
-}
-
-/* Get coredump list to be collected from modem */
-int ipc_coredump_get_list(struct iosm_devlink *devlink, u16 cmd)
-{
- u32 byte_read, num_entries, file_size;
- struct iosm_cd_table *cd_table;
- u8 size[MAX_SIZE_LEN], i;
- char *filename;
- int ret = 0;
-
- cd_table = kzalloc(MAX_CD_LIST_SIZE, GFP_KERNEL);
- if (!cd_table) {
- ret = -ENOMEM;
- goto cd_init_fail;
- }
-
- ret = ipc_devlink_send_cmd(devlink, cmd, MAX_CD_LIST_SIZE);
- if (ret) {
- dev_err(devlink->dev, "rpsi_cmd_coredump_start failed");
- goto cd_init_fail;
- }
-
- ret = ipc_imem_sys_devlink_read(devlink, (u8 *)cd_table,
- MAX_CD_LIST_SIZE, &byte_read);
- if (ret) {
- dev_err(devlink->dev, "Coredump data is invalid");
- goto cd_init_fail;
- }
-
- if (byte_read != MAX_CD_LIST_SIZE)
- goto cd_init_fail;
-
- if (cmd == rpsi_cmd_coredump_start) {
- num_entries = le32_to_cpu(cd_table->list.num_entries);
- if (num_entries == 0 || num_entries > IOSM_NOF_CD_REGION) {
- ret = -EINVAL;
- goto cd_init_fail;
- }
-
- for (i = 0; i < num_entries; i++) {
- file_size = le32_to_cpu(cd_table->list.entry[i].size);
- filename = cd_table->list.entry[i].filename;
-
- if (file_size > devlink->cd_file_info[i].default_size) {
- ret = -EINVAL;
- goto cd_init_fail;
- }
-
- devlink->cd_file_info[i].actual_size = file_size;
- dev_dbg(devlink->dev, "file: %s actual size %d",
- filename, file_size);
- devlink_flash_update_status_notify(devlink->devlink_ctx,
- filename,
- "FILENAME", 0, 0);
- snprintf(size, sizeof(size), "%d", file_size);
- devlink_flash_update_status_notify(devlink->devlink_ctx,
- size, "FILE SIZE",
- 0, 0);
- }
- }
-
-cd_init_fail:
- kfree(cd_table);
- return ret;
-}
diff --git a/drivers/net/wwan/iosm/iosm_ipc_coredump.h b/drivers/net/wwan/iosm/iosm_ipc_coredump.h
deleted file mode 100644
index d5028153c8d1..000000000000
--- a/drivers/net/wwan/iosm/iosm_ipc_coredump.h
+++ /dev/null
@@ -1,75 +0,0 @@
-/* SPDX-License-Identifier: GPL-2.0-only
- *
- * Copyright (C) 2020-2021 Intel Corporation.
- */
-
-#ifndef _IOSM_IPC_COREDUMP_H_
-#define _IOSM_IPC_COREDUMP_H_
-
-#include "iosm_ipc_devlink.h"
-
-/* Max number of bytes to receive for Coredump list structure */
-#define MAX_CD_LIST_SIZE 0x1000
-
-/* Max buffer allocated to receive coredump data */
-#define MAX_DATA_SIZE 0x00010000
-
-/* Max number of file entries */
-#define MAX_NOF_ENTRY 256
-
-/* Max length */
-#define MAX_SIZE_LEN 32
-
-/**
- * struct iosm_cd_list_entry - Structure to hold coredump file info.
- * @size: Number of bytes for the entry
- * @filename: Coredump filename to be generated on host
- */
-struct iosm_cd_list_entry {
- __le32 size;
- char filename[IOSM_MAX_FILENAME_LEN];
-} __packed;
-
-/**
- * struct iosm_cd_list - Structure to hold list of coredump files
- * to be collected.
- * @num_entries: Number of entries to be received
- * @entry: Contains File info
- */
-struct iosm_cd_list {
- __le32 num_entries;
- struct iosm_cd_list_entry entry[MAX_NOF_ENTRY];
-} __packed;
-
-/**
- * struct iosm_cd_table - Common Coredump table
- * @version: Version of coredump structure
- * @list: Coredump list structure
- */
-struct iosm_cd_table {
- __le32 version;
- struct iosm_cd_list list;
-} __packed;
-
-/**
- * ipc_coredump_collect - To collect coredump
- * @devlink: Pointer to devlink instance.
- * @data: Pointer to snapshot
- * @entry: ID of requested snapshot
- * @region_size: Region size
- *
- * Returns: 0 on success, error on failure
- */
-int ipc_coredump_collect(struct iosm_devlink *devlink, u8 **data, int entry,
- u32 region_size);
-
-/**
- * ipc_coredump_get_list - Get coredump list
- * @devlink: Pointer to devlink instance.
- * @cmd: RPSI command to be sent
- *
- * Returns: 0 on success, error on failure
- */
-int ipc_coredump_get_list(struct iosm_devlink *devlink, u16 cmd);
-
-#endif /* _IOSM_IPC_COREDUMP_H_ */
diff --git a/drivers/net/wwan/iosm/iosm_ipc_devlink.c b/drivers/net/wwan/iosm/iosm_ipc_devlink.c
deleted file mode 100644
index 592792c277fe..000000000000
--- a/drivers/net/wwan/iosm/iosm_ipc_devlink.c
+++ /dev/null
@@ -1,360 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0-only
-/*
- * Copyright (C) 2020-2021 Intel Corporation.
- */
-
-#include "iosm_ipc_chnl_cfg.h"
-#include "iosm_ipc_coredump.h"
-#include "iosm_ipc_devlink.h"
-#include "iosm_ipc_flash.h"
-
-/* Coredump list */
-static struct iosm_coredump_file_info list[IOSM_NOF_CD_REGION] = {
- {"report.json", REPORT_JSON_SIZE,},
- {"coredump.fcd", COREDUMP_FCD_SIZE,},
- {"cdd.log", CDD_LOG_SIZE,},
- {"eeprom.bin", EEPROM_BIN_SIZE,},
- {"bootcore_trace.bin", BOOTCORE_TRC_BIN_SIZE,},
- {"bootcore_prev_trace.bin", BOOTCORE_PREV_TRC_BIN_SIZE,},
-};
-
-/* Get the param values for the specific param ID's */
-static int ipc_devlink_get_param(struct devlink *dl, u32 id,
- struct devlink_param_gset_ctx *ctx)
-{
- struct iosm_devlink *ipc_devlink = devlink_priv(dl);
- int rc = 0;
-
- switch (id) {
- case IOSM_DEVLINK_PARAM_ID_ERASE_FULL_FLASH:
- ctx->val.vu8 = ipc_devlink->param.erase_full_flash;
- break;
-
- case IOSM_DEVLINK_PARAM_ID_DOWNLOAD_REGION:
- ctx->val.vu8 = ipc_devlink->param.download_region;
- break;
-
- case IOSM_DEVLINK_PARAM_ID_ADDRESS:
- ctx->val.vu32 = ipc_devlink->param.address;
- break;
-
- case IOSM_DEVLINK_PARAM_ID_REGION_COUNT:
- ctx->val.vu8 = ipc_devlink->param.region_count;
- break;
-
- default:
- rc = -EOPNOTSUPP;
- break;
- }
-
- return rc;
-}
-
-/* Set the param values for the specific param ID's */
-static int ipc_devlink_set_param(struct devlink *dl, u32 id,
- struct devlink_param_gset_ctx *ctx)
-{
- struct iosm_devlink *ipc_devlink = devlink_priv(dl);
- int rc = 0;
-
- switch (id) {
- case IOSM_DEVLINK_PARAM_ID_ERASE_FULL_FLASH:
- ipc_devlink->param.erase_full_flash = ctx->val.vu8;
- break;
-
- case IOSM_DEVLINK_PARAM_ID_DOWNLOAD_REGION:
- ipc_devlink->param.download_region = ctx->val.vu8;
- break;
-
- case IOSM_DEVLINK_PARAM_ID_ADDRESS:
- ipc_devlink->param.address = ctx->val.vu32;
- break;
-
- case IOSM_DEVLINK_PARAM_ID_REGION_COUNT:
- ipc_devlink->param.region_count = ctx->val.vu8;
- break;
-
- default:
- rc = -EOPNOTSUPP;
- break;
- }
-
- return rc;
-}
-
-/* Devlink param structure array */
-static const struct devlink_param iosm_devlink_params[] = {
- DEVLINK_PARAM_DRIVER(IOSM_DEVLINK_PARAM_ID_ERASE_FULL_FLASH,
- "erase_full_flash", DEVLINK_PARAM_TYPE_BOOL,
- BIT(DEVLINK_PARAM_CMODE_RUNTIME),
- ipc_devlink_get_param, ipc_devlink_set_param,
- NULL),
- DEVLINK_PARAM_DRIVER(IOSM_DEVLINK_PARAM_ID_DOWNLOAD_REGION,
- "download_region", DEVLINK_PARAM_TYPE_BOOL,
- BIT(DEVLINK_PARAM_CMODE_RUNTIME),
- ipc_devlink_get_param, ipc_devlink_set_param,
- NULL),
- DEVLINK_PARAM_DRIVER(IOSM_DEVLINK_PARAM_ID_ADDRESS,
- "address", DEVLINK_PARAM_TYPE_U32,
- BIT(DEVLINK_PARAM_CMODE_RUNTIME),
- ipc_devlink_get_param, ipc_devlink_set_param,
- NULL),
- DEVLINK_PARAM_DRIVER(IOSM_DEVLINK_PARAM_ID_REGION_COUNT,
- "region_count", DEVLINK_PARAM_TYPE_U8,
- BIT(DEVLINK_PARAM_CMODE_RUNTIME),
- ipc_devlink_get_param, ipc_devlink_set_param,
- NULL),
-};
-
-/* Get devlink flash component type */
-static enum iosm_flash_comp_type
-ipc_devlink_get_flash_comp_type(const char comp_str[], u32 len)
-{
- enum iosm_flash_comp_type fls_type;
-
- if (!strncmp("PSI", comp_str, len))
- fls_type = FLASH_COMP_TYPE_PSI;
- else if (!strncmp("EBL", comp_str, len))
- fls_type = FLASH_COMP_TYPE_EBL;
- else if (!strncmp("FLS", comp_str, len))
- fls_type = FLASH_COMP_TYPE_FLS;
- else
- fls_type = FLASH_COMP_TYPE_INVAL;
-
- return fls_type;
-}
-
-/* Function triggered on devlink flash command
- * Flash update function which calls multiple functions based on
- * component type specified in the flash command
- */
-static int ipc_devlink_flash_update(struct devlink *devlink,
- struct devlink_flash_update_params *params,
- struct netlink_ext_ack *extack)
-{
- struct iosm_devlink *ipc_devlink = devlink_priv(devlink);
- enum iosm_flash_comp_type fls_type;
- u32 rc = -EINVAL;
- u8 *mdm_rsp;
-
- mdm_rsp = kzalloc(IOSM_EBL_DW_PACK_SIZE, GFP_KERNEL);
- if (!mdm_rsp)
- return -ENOMEM;
-
- fls_type = ipc_devlink_get_flash_comp_type(params->component,
- strlen(params->component));
-
- switch (fls_type) {
- case FLASH_COMP_TYPE_PSI:
- rc = ipc_flash_boot_psi(ipc_devlink, params->fw);
- break;
- case FLASH_COMP_TYPE_EBL:
- rc = ipc_flash_boot_ebl(ipc_devlink, params->fw);
- if (!rc)
- rc = ipc_flash_boot_set_capabilities(ipc_devlink,
- mdm_rsp);
- if (!rc)
- rc = ipc_flash_read_swid(ipc_devlink, mdm_rsp);
- break;
- case FLASH_COMP_TYPE_FLS:
- rc = ipc_flash_send_fls(ipc_devlink, params->fw, mdm_rsp);
- break;
- default:
- devlink_flash_update_status_notify(devlink, "Invalid component",
- params->component, 0, 0);
- break;
- }
-
- if (!rc)
- devlink_flash_update_status_notify(devlink, "Flashing success",
- params->component, 0, 0);
- else
- devlink_flash_update_status_notify(devlink, "Flashing failed",
- params->component, 0, 0);
-
- kfree(mdm_rsp);
- return rc;
-}
-
-/* Call back function for devlink ops */
-static const struct devlink_ops devlink_flash_ops = {
- .supported_flash_update_params = DEVLINK_SUPPORT_FLASH_UPDATE_COMPONENT,
- .flash_update = ipc_devlink_flash_update,
-};
-
-/* Send command to modem to collect data */
-int ipc_devlink_send_cmd(struct iosm_devlink *ipc_devlink, u16 cmd, u32 entry)
-{
- struct iosm_rpsi_cmd rpsi_cmd;
-
- rpsi_cmd.param.dword = cpu_to_le32(entry);
- rpsi_cmd.cmd = cpu_to_le16(cmd);
- rpsi_cmd.crc = rpsi_cmd.param.word[0] ^ rpsi_cmd.param.word[1] ^
- rpsi_cmd.cmd;
-
- return ipc_imem_sys_devlink_write(ipc_devlink, (u8 *)&rpsi_cmd,
- sizeof(rpsi_cmd));
-}
-
-static int ipc_devlink_coredump_snapshot(struct devlink *dl,
- const struct devlink_region_ops *ops,
- struct netlink_ext_ack *extack,
- u8 **data)
-{
- struct iosm_devlink *ipc_devlink = devlink_priv(dl);
- struct iosm_coredump_file_info *cd_list = ops->priv;
- u32 region_size;
- int rc;
-
- dev_dbg(ipc_devlink->dev, "Region:%s, ID:%d", ops->name,
- cd_list->entry);
- region_size = cd_list->default_size;
- rc = ipc_coredump_collect(ipc_devlink, data, cd_list->entry,
- region_size);
- if (rc) {
- dev_err(ipc_devlink->dev, "Fail to create snapshot,err %d", rc);
- goto coredump_collect_err;
- }
-
- /* Send coredump end cmd indicating end of coredump collection */
- if (cd_list->entry == (IOSM_NOF_CD_REGION - 1))
- ipc_coredump_get_list(ipc_devlink, rpsi_cmd_coredump_end);
-
- return rc;
-coredump_collect_err:
- ipc_coredump_get_list(ipc_devlink, rpsi_cmd_coredump_end);
- return rc;
-}
-
-/* To create regions for coredump files */
-static int ipc_devlink_create_region(struct iosm_devlink *devlink)
-{
- struct devlink_region_ops *mdm_coredump;
- int rc = 0;
- u8 i;
-
- mdm_coredump = devlink->iosm_devlink_mdm_coredump;
- for (i = 0; i < IOSM_NOF_CD_REGION; i++) {
- mdm_coredump[i].name = list[i].filename;
- mdm_coredump[i].snapshot = ipc_devlink_coredump_snapshot;
- mdm_coredump[i].destructor = vfree;
- devlink->cd_regions[i] =
- devlink_region_create(devlink->devlink_ctx,
- &mdm_coredump[i], MAX_SNAPSHOTS,
- list[i].default_size);
-
- if (IS_ERR(devlink->cd_regions[i])) {
- rc = PTR_ERR(devlink->cd_regions[i]);
- dev_err(devlink->dev, "Devlink region fail,err %d", rc);
- /* Delete previously created regions */
- for ( ; i > 0; i--)
- devlink_region_destroy(devlink->cd_regions[i]);
- goto region_create_fail;
- }
- list[i].entry = i;
- mdm_coredump[i].priv = list + i;
- }
-region_create_fail:
- return rc;
-}
-
-/* To Destroy devlink regions */
-static void ipc_devlink_destroy_region(struct iosm_devlink *ipc_devlink)
-{
- u8 i;
-
- for (i = 0; i < IOSM_NOF_CD_REGION; i++)
- devlink_region_destroy(ipc_devlink->cd_regions[i]);
-}
-
-/* Handle registration to devlink framework */
-struct iosm_devlink *ipc_devlink_init(struct iosm_imem *ipc_imem)
-{
- struct ipc_chnl_cfg chnl_cfg_flash = { 0 };
- struct iosm_devlink *ipc_devlink;
- struct devlink *devlink_ctx;
- int rc;
-
- devlink_ctx = devlink_alloc(&devlink_flash_ops,
- sizeof(struct iosm_devlink),
- ipc_imem->dev);
- if (!devlink_ctx) {
- dev_err(ipc_imem->dev, "devlink_alloc failed");
- goto devlink_alloc_fail;
- }
-
- ipc_devlink = devlink_priv(devlink_ctx);
- ipc_devlink->devlink_ctx = devlink_ctx;
- ipc_devlink->pcie = ipc_imem->pcie;
- ipc_devlink->dev = ipc_imem->dev;
- rc = devlink_register(devlink_ctx);
- if (rc) {
- dev_err(ipc_devlink->dev, "devlink_register failed rc %d", rc);
- goto free_dl;
- }
-
- rc = devlink_params_register(devlink_ctx, iosm_devlink_params,
- ARRAY_SIZE(iosm_devlink_params));
- if (rc) {
- dev_err(ipc_devlink->dev,
- "devlink_params_register failed. rc %d", rc);
- goto param_reg_fail;
- }
-
- devlink_params_publish(devlink_ctx);
- ipc_devlink->cd_file_info = list;
-
- rc = ipc_devlink_create_region(ipc_devlink);
- if (rc) {
- dev_err(ipc_devlink->dev, "Devlink Region create failed, rc %d",
- rc);
- goto region_create_fail;
- }
-
- if (ipc_chnl_cfg_get(&chnl_cfg_flash, IPC_MEM_CTRL_CHL_ID_7) < 0)
- goto chnl_get_fail;
-
- ipc_imem_channel_init(ipc_imem, IPC_CTYPE_CTRL,
- chnl_cfg_flash, IRQ_MOD_OFF);
-
- init_completion(&ipc_devlink->devlink_sio.read_sem);
- skb_queue_head_init(&ipc_devlink->devlink_sio.rx_list);
-
- dev_dbg(ipc_devlink->dev, "iosm devlink register success");
-
- return ipc_devlink;
-
-chnl_get_fail:
- ipc_devlink_destroy_region(ipc_devlink);
-region_create_fail:
- devlink_params_unpublish(devlink_ctx);
- devlink_params_unregister(devlink_ctx, iosm_devlink_params,
- ARRAY_SIZE(iosm_devlink_params));
-param_reg_fail:
- devlink_unregister(devlink_ctx);
-free_dl:
- devlink_free(devlink_ctx);
-devlink_alloc_fail:
- return NULL;
-}
-
-/* Handle unregistration of devlink */
-void ipc_devlink_deinit(struct iosm_devlink *ipc_devlink)
-{
- struct devlink *devlink_ctx = ipc_devlink->devlink_ctx;
-
- ipc_devlink_destroy_region(ipc_devlink);
- devlink_params_unpublish(devlink_ctx);
- devlink_params_unregister(devlink_ctx, iosm_devlink_params,
- ARRAY_SIZE(iosm_devlink_params));
- if (ipc_devlink->devlink_sio.devlink_read_pend) {
- complete(&ipc_devlink->devlink_sio.read_sem);
- complete(&ipc_devlink->devlink_sio.channel->ul_sem);
- }
- if (!ipc_devlink->devlink_sio.devlink_read_pend)
- skb_queue_purge(&ipc_devlink->devlink_sio.rx_list);
-
- ipc_imem_sys_devlink_close(ipc_devlink);
- devlink_unregister(devlink_ctx);
- devlink_free(devlink_ctx);
-}
diff --git a/drivers/net/wwan/iosm/iosm_ipc_devlink.h b/drivers/net/wwan/iosm/iosm_ipc_devlink.h
deleted file mode 100644
index 392735080cb3..000000000000
--- a/drivers/net/wwan/iosm/iosm_ipc_devlink.h
+++ /dev/null
@@ -1,207 +0,0 @@
-/* SPDX-License-Identifier: GPL-2.0-only
- *
- * Copyright (C) 2020-2021 Intel Corporation.
- */
-
-#ifndef _IOSM_IPC_DEVLINK_H_
-#define _IOSM_IPC_DEVLINK_H_
-
-#include <net/devlink.h>
-
-#include "iosm_ipc_imem.h"
-#include "iosm_ipc_imem_ops.h"
-#include "iosm_ipc_pcie.h"
-
-/* MAX file name length */
-#define IOSM_MAX_FILENAME_LEN 32
-/* EBL response size */
-#define IOSM_EBL_RSP_SIZE 76
-/* MAX number of regions supported */
-#define IOSM_NOF_CD_REGION 6
-/* MAX number of SNAPSHOTS supported */
-#define MAX_SNAPSHOTS 1
-/* Default Coredump file size */
-#define REPORT_JSON_SIZE 0x800
-#define COREDUMP_FCD_SIZE 0x10E00000
-#define CDD_LOG_SIZE 0x30000
-#define EEPROM_BIN_SIZE 0x10000
-#define BOOTCORE_TRC_BIN_SIZE 0x8000
-#define BOOTCORE_PREV_TRC_BIN_SIZE 0x20000
-
-/**
- * enum iosm_devlink_param_id - Enum type to different devlink params
- * @IOSM_DEVLINK_PARAM_ID_BASE: Devlink param base ID
- * @IOSM_DEVLINK_PARAM_ID_ERASE_FULL_FLASH: Set if full erase required
- * @IOSM_DEVLINK_PARAM_ID_DOWNLOAD_REGION: Set if fls file to be
- * flashed is Loadmap/region file
- * @IOSM_DEVLINK_PARAM_ID_ADDRESS: Address of the region to be
- * flashed
- * @IOSM_DEVLINK_PARAM_ID_REGION_COUNT: Max region count
- */
-
-enum iosm_devlink_param_id {
- IOSM_DEVLINK_PARAM_ID_BASE = DEVLINK_PARAM_GENERIC_ID_MAX,
- IOSM_DEVLINK_PARAM_ID_ERASE_FULL_FLASH,
- IOSM_DEVLINK_PARAM_ID_DOWNLOAD_REGION,
- IOSM_DEVLINK_PARAM_ID_ADDRESS,
- IOSM_DEVLINK_PARAM_ID_REGION_COUNT,
-};
-
-/**
- * enum iosm_rpsi_cmd_code - Enum type for RPSI command list
- * @rpsi_cmd_code_ebl: Command to load ebl
- * @rpsi_cmd_coredump_start: Command to get list of files and
- * file size info from PSI
- * @rpsi_cmd_coredump_get: Command to get the coredump data
- * @rpsi_cmd_coredump_end: Command to stop receiving the coredump
- */
-enum iosm_rpsi_cmd_code {
- rpsi_cmd_code_ebl = 0x02,
- rpsi_cmd_coredump_start = 0x10,
- rpsi_cmd_coredump_get = 0x11,
- rpsi_cmd_coredump_end = 0x12,
-};
-
-/**
- * enum iosm_flash_comp_type - Enum for different flash component types
- * @FLASH_COMP_TYPE_PSI: PSI flash comp type
- * @FLASH_COMP_TYPE_EBL: EBL flash comp type
- * @FLASH_COMP_TYPE_FLS: FLS flash comp type
- * @FLASH_COMP_TYPE_INVAL: Invalid flash comp type
- */
-enum iosm_flash_comp_type {
- FLASH_COMP_TYPE_PSI,
- FLASH_COMP_TYPE_EBL,
- FLASH_COMP_TYPE_FLS,
- FLASH_COMP_TYPE_INVAL,
-};
-
-/**
- * struct iosm_devlink_sio - SIO instance
- * @rx_list: Downlink skbuf list received from CP
- * @read_sem: Needed for the blocking read or downlink transfer
- * @channel_id: Reserved channel id for flashing/CD collection to RAM
- * @channel: Channel instance for flashing and coredump
- * @devlink_read_pend: Check if read is pending
- */
-struct iosm_devlink_sio {
- struct sk_buff_head rx_list;
- struct completion read_sem;
- int channel_id;
- struct ipc_mem_channel *channel;
- u32 devlink_read_pend;
-};
-
-/**
- * struct iosm_flash_params - List of flash params required for flashing
- * @address: Address of the region file to be flashed
- * @region_count: Maximum no of regions for each fls file
- * @download_region: To be set if region is being flashed
- * @erase_full_flash: To set the flashing mode
- * erase_full_flash = 1; full erase
- * erase_full_flash = 0; no erase
- * @erase_full_flash_done: Flag to check if it is a full erase
- */
-struct iosm_flash_params {
- u32 address;
- u8 region_count;
- u8 download_region;
- u8 erase_full_flash;
- u8 erase_full_flash_done;
-};
-
-/**
- * struct iosm_ebl_ctx_data - EBL ctx data used during flashing
- * @ebl_sw_info_version: SWID version info obtained from EBL
- * @m_ebl_resp: Buffer used to read and write the ebl data
- */
-struct iosm_ebl_ctx_data {
- u8 ebl_sw_info_version;
- u8 m_ebl_resp[IOSM_EBL_RSP_SIZE];
-};
-
-/**
- * struct iosm_coredump_file_info - Coredump file info
- * @filename: Name of coredump file
- * @default_size: Default size of coredump file
- * @actual_size: Actual size of coredump file
- * @entry: Index of the coredump file
- */
-struct iosm_coredump_file_info {
- char filename[IOSM_MAX_FILENAME_LEN];
- u32 default_size;
- u32 actual_size;
- u32 entry;
-};
-
-/**
- * struct iosm_devlink - IOSM Devlink structure
- * @devlink_sio: SIO instance for read/write functionality
- * @pcie: Pointer to PCIe component
- * @dev: Pointer to device struct
- * @devlink_ctx: Pointer to devlink context
- * @param: Params required for flashing
- * @ebl_ctx: Data to be read and written to Modem
- * @cd_file_info: coredump file info
- * @iosm_devlink_mdm_coredump: region ops for coredump collection
- * @cd_regions: coredump regions
- */
-struct iosm_devlink {
- struct iosm_devlink_sio devlink_sio;
- struct iosm_pcie *pcie;
- struct device *dev;
- struct devlink *devlink_ctx;
- struct iosm_flash_params param;
- struct iosm_ebl_ctx_data ebl_ctx;
- struct iosm_coredump_file_info *cd_file_info;
- struct devlink_region_ops iosm_devlink_mdm_coredump[IOSM_NOF_CD_REGION];
- struct devlink_region *cd_regions[IOSM_NOF_CD_REGION];
-};
-
-/**
- * union iosm_rpsi_param_u - RPSI cmd param for CRC calculation
- * @word: Words member used in CRC calculation
- * @dword: Actual data
- */
-union iosm_rpsi_param_u {
- __le16 word[2];
- __le32 dword;
-};
-
-/**
- * struct iosm_rpsi_cmd - Structure for RPSI Command
- * @param: Used to calculate CRC
- * @cmd: Stores the RPSI command
- * @crc: Stores the CRC value
- */
-struct iosm_rpsi_cmd {
- union iosm_rpsi_param_u param;
- __le16 cmd;
- __le16 crc;
-};
-
-/**
- * ipc_devlink_init - To initialize the devlink to IOSM driver
- * @ipc_imem: Pointer to struct iosm_imem
- *
- * Returns: Pointer to iosm_devlink on success and NULL on failure
- */
-struct iosm_devlink *ipc_devlink_init(struct iosm_imem *ipc_imem);
-
-/**
- * ipc_devlink_deinit - To unintialize the devlink from IOSM driver.
- * @ipc_devlink: Devlink instance
- */
-void ipc_devlink_deinit(struct iosm_devlink *ipc_devlink);
-
-/**
- * ipc_devlink_send_cmd - Send command to Modem
- * @ipc_devlink: Pointer to struct iosm_devlink
- * @cmd: Command to be sent to modem
- * @entry: Command entry number
- *
- * Returns: 0 on success and failure value on error
- */
-int ipc_devlink_send_cmd(struct iosm_devlink *ipc_devlink, u16 cmd, u32 entry);
-
-#endif /* _IOSM_IPC_DEVLINK_H */
diff --git a/drivers/net/wwan/iosm/iosm_ipc_flash.c b/drivers/net/wwan/iosm/iosm_ipc_flash.c
deleted file mode 100644
index a43aafc70168..000000000000
--- a/drivers/net/wwan/iosm/iosm_ipc_flash.c
+++ /dev/null
@@ -1,562 +0,0 @@
-// 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)
-{
- u16 checksum = pack_id;
- u32 i;
-
- if (payload_length + IOSM_EBL_HEAD_SIZE > pack_length)
- return -EINVAL;
-
- flash_req->pack_id = cpu_to_le16(pack_id);
- flash_req->msg_length = cpu_to_le32(payload_length);
- checksum += (payload_length >> IOSM_EBL_PAYL_SHIFT) +
- (payload_length & IOSM_EBL_CKSM);
-
- for (i = 0; i < payload_length; i++)
- checksum += payload[i];
-
- flash_req->checksum = cpu_to_le16(checksum);
-
- return 0;
-}
-
-/* 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)
-{
- struct iosm_ebl_error *err_info = payload_rsp;
- u16 *rsp_code = hdr_rsp;
- int res = 0;
- u32 i;
-
- if (*rsp_code == IOSM_EBL_RSP_BUFF) {
- for (i = 0; i < IOSM_MAX_ERRORS; i++) {
- if (!err_info->error[i].error_code) {
- pr_err("EBL: error_class = %d, error_code = %d",
- err_info->error[i].error_class,
- err_info->error[i].error_code);
- }
- }
- res = -EINVAL;
- }
-
- return res;
-}
-
-/* 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)
-{
- struct iosm_flash_data flash_req;
- int ret;
-
- ret = ipc_flash_proc_format_ebl_pack(&flash_req, size,
- pack_id, payload, payload_length);
- if (ret) {
- dev_err(ipc_devlink->dev, "EBL2 pack failed for pack_id:%d",
- pack_id);
- goto ipc_free_payload;
- }
-
- ret = ipc_imem_sys_devlink_write(ipc_devlink, (u8 *)&flash_req,
- IOSM_EBL_HEAD_SIZE);
- if (ret) {
- dev_err(ipc_devlink->dev, "EBL Header write failed for Id:%x",
- pack_id);
- goto ipc_free_payload;
- }
-
- ret = ipc_imem_sys_devlink_write(ipc_devlink, payload, payload_length);
- if (ret) {
- dev_err(ipc_devlink->dev, "EBL Payload write failed for Id:%x",
- pack_id);
- }
-
-ipc_free_payload:
- return ret;
-}
-
-/* Allocate flash channel and read LER data from modem */
-int ipc_flash_link_establish(struct iosm_imem *ipc_imem)
-{
- u8 ler_data[IOSM_LER_RSP_SIZE];
- u32 bytes_read;
-
- /* Allocate channel for flashing/cd collection */
- ipc_imem->ipc_devlink->devlink_sio.channel =
- ipc_imem_sys_devlink_open(ipc_imem);
-
- if (!ipc_imem->ipc_devlink->devlink_sio.channel)
- goto chl_open_fail;
-
- if (ipc_imem_sys_devlink_read(ipc_imem->ipc_devlink, ler_data,
- IOSM_LER_RSP_SIZE, &bytes_read))
- goto devlink_read_fail;
-
- if (bytes_read != IOSM_LER_RSP_SIZE)
- goto devlink_read_fail;
- return 0;
-
-devlink_read_fail:
- ipc_imem_sys_devlink_close(ipc_imem->ipc_devlink);
-chl_open_fail:
- return -EIO;
-}
-
-/* Receive data from the modem */
-static int ipc_flash_receive_data(struct iosm_devlink *ipc_devlink, u32 size,
- u8 *mdm_rsp)
-{
- u8 mdm_rsp_hdr[IOSM_EBL_HEAD_SIZE];
- u32 bytes_read;
- int ret;
-
- ret = ipc_imem_sys_devlink_read(ipc_devlink, mdm_rsp_hdr,
- IOSM_EBL_HEAD_SIZE, &bytes_read);
- if (ret) {
- dev_err(ipc_devlink->dev, "EBL rsp to read %d bytes failed",
- IOSM_EBL_HEAD_SIZE);
- goto ipc_flash_recv_err;
- }
-
- if (bytes_read != IOSM_EBL_HEAD_SIZE) {
- ret = -EINVAL;
- goto ipc_flash_recv_err;
- }
-
- ret = ipc_imem_sys_devlink_read(ipc_devlink, mdm_rsp, size,
- &bytes_read);
- if (ret) {
- dev_err(ipc_devlink->dev, "EBL rsp to read %d bytes failed",
- size);
- goto ipc_flash_recv_er