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

Commit dc3d0b7f authored by Linux Build Service Account's avatar Linux Build Service Account Committed by Gerrit - the friendly Code Review server
Browse files

Merge "mhi_dev: mhi: Add DT property for base address, MSI and version"

parents 157e0635 aeba6bf8
Loading
Loading
Loading
Loading
+6 −0
Original line number Diff line number Diff line
@@ -19,6 +19,9 @@ Required properties:
  - interrupt-names: Should be mhi-device-inta for MHI interrupt.
  - qcom,mhi-ifc-id: ID of HW interface via which MHI on device side
		communicates with host side.
  - qcom,mhi-local-pa-base: MHI device local physical start address.
  - qcom,mhi-ep-msi: End point MSI number.
  - qcom,mhi-version: MHI specification version supported by the device.

Example:

@@ -32,4 +35,7 @@ Example:
		interrupts = <0 42 0>;
		interrupt-names = "mhi-device-inta";
		qcom,mhi-ifc-id = <0x030017cb>;
		qcom,mhi-local-pa-base = <80000000>;
		qcom,mhi-ep-msi = <1>;
		qcom,mhi-version = <0x1000000>;
	};
+31 −11
Original line number Diff line number Diff line
@@ -33,10 +33,6 @@
#include "mhi_hwio.h"
#include "mhi_sm.h"

#define MHI_LOCAL_PA_BASE		0x80000000
#define MHI_LOCAL_PA_SIZE		0x3e800000
#define MHI_EP_MSI_NUM			1
#define MHI_VERSION_E			0x1000000
/* Wait time on the device for Host to set M0 state */
#define MHI_M0_WAIT_MIN_USLEEP		20000000
#define MHI_M0_WAIT_MAX_USLEEP		25000000
@@ -481,7 +477,7 @@ static int mhi_dev_send_event(struct mhi_dev *mhi, int evnt_ring,
	mhi_log(MHI_MSG_VERBOSE, "evnt type :0x%x\n", el->evt_tr_comp.type);
	mhi_log(MHI_MSG_VERBOSE, "evnt chid :0x%x\n", el->evt_tr_comp.chid);

	rc = ep_pcie_trigger_msi(mhi_ctx->phandle, MHI_EP_MSI_NUM);
	rc = ep_pcie_trigger_msi(mhi_ctx->phandle, mhi_ctx->mhi_ep_msi_num);
	if (rc) {
		pr_err("%s: error sending msi\n", __func__);
		return rc;
@@ -1040,12 +1036,12 @@ static int mhi_dev_cache_host_cfg(struct mhi_dev *mhi)
	mhi->data_base.size = addr1 - mhi->data_base.host_pa;

	if (mhi->ctrl_base.host_pa > mhi->data_base.host_pa) {
		mhi->data_base.device_pa = MHI_LOCAL_PA_BASE;
		mhi->ctrl_base.device_pa = MHI_LOCAL_PA_BASE +
		mhi->data_base.device_pa = mhi->device_local_pa_base;
		mhi->ctrl_base.device_pa = mhi->device_local_pa_base +
				mhi->ctrl_base.host_pa - mhi->data_base.host_pa;
	} else {
		mhi->ctrl_base.device_pa = MHI_LOCAL_PA_BASE;
		mhi->data_base.device_pa = MHI_LOCAL_PA_BASE +
		mhi->ctrl_base.device_pa = mhi->device_local_pa_base;
		mhi->data_base.device_pa = mhi->device_local_pa_base +
				mhi->data_base.host_pa - mhi->ctrl_base.host_pa;
	}

@@ -1718,6 +1714,14 @@ static int get_device_tree_data(struct platform_device *pdev)

	mhi_ctx = mhi;

	rc = of_property_read_u32((&pdev->dev)->of_node,
				"qcom,mhi-local-pa-base",
				&mhi_ctx->device_local_pa_base);
	if (rc) {
		pr_err("qcom,mhi-local-pa-base does not exist.\n");
		return rc;
	}

	rc = of_property_read_u32((&pdev->dev)->of_node,
				"qcom,mhi-ifc-id",
				&mhi_ctx->ifc_id);
@@ -1727,6 +1731,22 @@ static int get_device_tree_data(struct platform_device *pdev)
		return rc;
	}

	rc = of_property_read_u32((&pdev->dev)->of_node,
				"qcom,mhi-ep-msi",
				&mhi_ctx->mhi_ep_msi_num);
	if (rc) {
		pr_err("qcom,mhi-ep-msi does not exist.\n");
		return rc;
	}

	rc = of_property_read_u32((&pdev->dev)->of_node,
				"qcom,mhi-version",
				&mhi_ctx->mhi_version);
	if (rc) {
		pr_err("qcom,mhi-version does not exist.\n");
		return rc;
	}

	mhi_ctx->phandle = ep_pcie_get_phandle(mhi_ctx->ifc_id);
	if (!mhi_ctx->phandle) {
		pr_err("PCIe driver is not ready yet.\n");
@@ -1750,7 +1770,7 @@ static int get_device_tree_data(struct platform_device *pdev)
	}

	mhi_dev_sm_set_ready();
	rc = mhi_dev_mmio_write(mhi, MHIVER, MHI_VERSION_E);
	rc = mhi_dev_mmio_write(mhi, MHIVER, mhi->mhi_version);
	if (rc) {
		pr_err("Failed to update the MHI version\n");
		return rc;
@@ -1777,7 +1797,7 @@ static int get_device_tree_data(struct platform_device *pdev)
		return rc;
	}

	rc = ep_pcie_trigger_msi(mhi_ctx->phandle, MHI_EP_MSI_NUM);
	rc = ep_pcie_trigger_msi(mhi_ctx->phandle, mhi_ctx->mhi_ep_msi_num);
	if (rc)
		return rc;

+3 −0
Original line number Diff line number Diff line
@@ -504,6 +504,9 @@ struct mhi_dev {
	atomic_t			write_active;
	atomic_t			is_suspended;
	struct mutex			mhi_write_test;
	u32				device_local_pa_base;
	u32				mhi_ep_msi_num;
	u32				mhi_version;
};

enum mhi_msg_level {