Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 9c5305af authored by Sujeev Dias's avatar Sujeev Dias Committed by Gerrit - the friendly Code Review server
Browse files

mhi: controller: generate firmware information based on device id



MHI bus framework no longer gets firmware information from
devicetree, therefore pass the firmware information to MHI
bus framework.

CRs-Fixed: 2258358
Change-Id: I1a3b0c262933f59c75736a213c8b85e5303923c7
Signed-off-by: default avatarSujeev Dias <sdias@codeaurora.org>
parent 5cd75ce7
Loading
Loading
Loading
Loading
+24 −1
Original line number Diff line number Diff line
@@ -24,6 +24,19 @@
#include <linux/mhi.h>
#include "mhi_qcom.h"

struct firmware_info {
	unsigned int dev_id;
	const char *fw_image;
	const char *edl_image;
};

static const struct firmware_info firmware_table[] = {
	{.dev_id = 0x305, .fw_image = "sdx50m/sbl1.mbn"},
	{.dev_id = 0x304, .fw_image = "sbl.mbn", .edl_image = "edl.mbn"},
	/* default, set to debug.mbn */
	{.fw_image = "debug.mbn"},
};

void mhi_deinit_pci_dev(struct mhi_controller *mhi_cntrl)
{
	struct mhi_dev *mhi_dev = mhi_controller_get_devdata(mhi_cntrl);
@@ -332,9 +345,10 @@ static struct mhi_controller *mhi_register_controller(struct pci_dev *pci_dev)
	struct mhi_controller *mhi_cntrl;
	struct mhi_dev *mhi_dev;
	struct device_node *of_node = pci_dev->dev.of_node;
	const struct firmware_info *firmware_info;
	bool use_bb;
	u64 addr_win[2];
	int ret;
	int ret, i;

	if (!of_node)
		return ERR_PTR(-ENODEV);
@@ -404,6 +418,15 @@ static struct mhi_controller *mhi_register_controller(struct pci_dev *pci_dev)
	if (ret)
		goto error_register;

	for (i = 0; i < ARRAY_SIZE(firmware_table); i++) {
		firmware_info = firmware_table + i;
		if (mhi_cntrl->dev_id == firmware_info->dev_id)
			break;
	}

	mhi_cntrl->fw_image = firmware_info->fw_image;
	mhi_cntrl->edl_image = firmware_info->edl_image;

	return mhi_cntrl;

error_register: