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

Commit ba729d23 authored by qctecmdr's avatar qctecmdr Committed by Gerrit - the friendly Code Review server
Browse files

Merge "cnss2: Fail PCI probe for certain device versions"

parents f220002a 6154e38c
Loading
Loading
Loading
Loading
+3 −3
Original line number Diff line number Diff line
@@ -1299,7 +1299,7 @@ static int of_parse_dt(struct mhi_controller *mhi_cntrl,
	return 0;

error_ev_cfg:
	kfree(mhi_cntrl->mhi_chan);
	vfree(mhi_cntrl->mhi_chan);

	return ret;
}
@@ -1442,7 +1442,7 @@ int of_register_mhi_controller(struct mhi_controller *mhi_cntrl)
	kfree(mhi_cntrl->mhi_cmd);

error_alloc_cmd:
	kfree(mhi_cntrl->mhi_chan);
	vfree(mhi_cntrl->mhi_chan);
	kfree(mhi_cntrl->mhi_event);

	return ret;
@@ -1455,7 +1455,7 @@ void mhi_unregister_mhi_controller(struct mhi_controller *mhi_cntrl)

	kfree(mhi_cntrl->mhi_cmd);
	kfree(mhi_cntrl->mhi_event);
	kfree(mhi_cntrl->mhi_chan);
	vfree(mhi_cntrl->mhi_chan);
	kfree(mhi_cntrl->mhi_tsync);

	device_del(&mhi_dev->dev);
+43 −8
Original line number Diff line number Diff line
@@ -3712,7 +3712,7 @@ static int cnss_pci_get_mhi_msi(struct cnss_pci_data *pci_priv)
	return 0;
}

static void cnss_pci_update_fw_name(struct cnss_pci_data *pci_priv)
static int cnss_pci_update_fw_name(struct cnss_pci_data *pci_priv)
{
	struct cnss_plat_data *plat_priv = pci_priv->plat_priv;
	struct mhi_controller *mhi_ctrl = pci_priv->mhi_ctrl;
@@ -3728,14 +3728,25 @@ static void cnss_pci_update_fw_name(struct cnss_pci_data *pci_priv)
		    plat_priv->device_version.major_version,
		    plat_priv->device_version.minor_version);

	if (pci_priv->device_id == QCA6390_DEVICE_ID &&
	    plat_priv->device_version.major_version >= FW_V2_NUMBER) {
	switch (pci_priv->device_id) {
	case QCA6390_DEVICE_ID:
		if (plat_priv->device_version.major_version < FW_V2_NUMBER) {
			cnss_pr_dbg("Device ID:version (0x%lx:%d) is not supported\n",
				    pci_priv->device_id,
				    plat_priv->device_version.major_version);
			return -EINVAL;
		}
		scnprintf(plat_priv->firmware_name,
			  sizeof(plat_priv->firmware_name), FW_V2_FILE_NAME);
		mhi_ctrl->fw_image = plat_priv->firmware_name;
		break;
	default:
		break;
	}

	cnss_pr_dbg("Firmware name is %s\n", mhi_ctrl->fw_image);

	return 0;
}

static int cnss_pci_register_mhi(struct cnss_pci_data *pci_priv)
@@ -3769,8 +3780,8 @@ static int cnss_pci_register_mhi(struct cnss_pci_data *pci_priv)

	ret = cnss_pci_get_mhi_msi(pci_priv);
	if (ret) {
		cnss_pr_err("Failed to get MSI for MHI\n");
		return ret;
		cnss_pr_err("Failed to get MSI for MHI, err = %d\n", ret);
		goto free_mhi_ctrl;
	}

	if (pci_priv->smmu_s1_enable) {
@@ -3800,12 +3811,25 @@ static int cnss_pci_register_mhi(struct cnss_pci_data *pci_priv)
	ret = of_register_mhi_controller(mhi_ctrl);
	if (ret) {
		cnss_pr_err("Failed to register to MHI bus, err = %d\n", ret);
		return ret;
		goto destroy_ipc;
	}

	cnss_pci_update_fw_name(pci_priv);
	ret = cnss_pci_update_fw_name(pci_priv);
	if (ret)
		goto unreg_mhi;

	return 0;

unreg_mhi:
	mhi_unregister_mhi_controller(mhi_ctrl);
destroy_ipc:
	if (mhi_ctrl->log_buf)
		ipc_log_context_destroy(mhi_ctrl->log_buf);
	kfree(mhi_ctrl->irq);
free_mhi_ctrl:
	mhi_free_controller(mhi_ctrl);

	return ret;
}

static void cnss_pci_unregister_mhi(struct cnss_pci_data *pci_priv)
@@ -3813,8 +3837,10 @@ static void cnss_pci_unregister_mhi(struct cnss_pci_data *pci_priv)
	struct mhi_controller *mhi_ctrl = pci_priv->mhi_ctrl;

	mhi_unregister_mhi_controller(mhi_ctrl);
	if (mhi_ctrl->log_buf)
		ipc_log_context_destroy(mhi_ctrl->log_buf);
	kfree(mhi_ctrl->irq);
	mhi_free_controller(mhi_ctrl);
}

static void cnss_pci_config_regs(struct cnss_pci_data *pci_priv)
@@ -4057,7 +4083,16 @@ int cnss_pci_init(struct cnss_plat_data *plat_priv)
		goto out;
	}

	if (!plat_priv->bus_priv) {
		cnss_pr_err("Failed to probe PCI driver\n");
		ret = -ENODEV;
		goto unreg_pci;
	}

	return 0;

unreg_pci:
	pci_unregister_driver(&cnss_pci_driver);
out:
	return ret;
}