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

Commit 4ee99b1a authored by Sujeev Dias's avatar Sujeev Dias
Browse files

mhi: core: get bhie offset from devicetree node



Some MHI based controllers do not have a BHIE offset defined in
mmio register space. For these controllers get the offset from
devicetree node.

CRs-Fixed: 2464900
Change-Id: Ib10d38aff366a56ac401dba5aac0b820411ad27d
Signed-off-by: default avatarSujeev Dias <sdias@codeaurora.org>
parent abd91337
Loading
Loading
Loading
Loading
+16 −8
Original line number Diff line number Diff line
@@ -1065,6 +1065,7 @@ static int of_parse_dt(struct mhi_controller *mhi_cntrl,
	int ret;
	enum mhi_ee i;
	u32 *ee;
	u32 bhie_offset;

	/* parse MHI channel configuration */
	ret = of_parse_ch_cfg(mhi_cntrl, of_node);
@@ -1105,6 +1106,10 @@ static int of_parse_dt(struct mhi_controller *mhi_cntrl,
		of_property_read_u32_index(of_node, "mhi,ee", ret, ee);
	}

	ret = of_property_read_u32(of_node, "mhi,bhie-offset", &bhie_offset);
	if (!ret)
		mhi_cntrl->bhie = mhi_cntrl->regs + bhie_offset;

	return 0;

error_ev_cfg:
@@ -1317,6 +1322,7 @@ int mhi_prepare_for_power_up(struct mhi_controller *mhi_cntrl)
		 * This controller supports rddm, we need to manually clear
		 * BHIE RX registers since por values are undefined.
		 */
		if (!mhi_cntrl->bhie) {
			ret = mhi_read_reg(mhi_cntrl, mhi_cntrl->regs, BHIEOFF,
					   &bhie_off);
			if (ret) {
@@ -1324,9 +1330,11 @@ int mhi_prepare_for_power_up(struct mhi_controller *mhi_cntrl)
				goto bhie_error;
			}

		memset_io(mhi_cntrl->regs + bhie_off + BHIE_RXVECADDR_LOW_OFFS,
			  0, BHIE_RXVECSTATUS_OFFS - BHIE_RXVECADDR_LOW_OFFS +
			  4);
			mhi_cntrl->bhie = mhi_cntrl->regs + bhie_off;
		}

		memset_io(mhi_cntrl->bhie + BHIE_RXVECADDR_LOW_OFFS, 0,
			  BHIE_RXVECSTATUS_OFFS - BHIE_RXVECADDR_LOW_OFFS + 4);
	}

	mhi_cntrl->pre_init = true;
+2 −2
Original line number Diff line number Diff line
@@ -814,8 +814,8 @@ int mhi_async_power_up(struct mhi_controller *mhi_cntrl)

	mhi_cntrl->bhi = mhi_cntrl->regs + val;

	/* setup bhie offset */
	if (mhi_cntrl->fbc_download) {
	/* setup bhie offset if not set */
	if (mhi_cntrl->fbc_download && !mhi_cntrl->bhie) {
		ret = mhi_read_reg(mhi_cntrl, mhi_cntrl->regs, BHIEOFF, &val);
		if (ret) {
			write_unlock_irq(&mhi_cntrl->pm_lock);