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

Commit 644243f9 authored by Rama Krishna Phani A's avatar Rama Krishna Phani A
Browse files

msm: mhi_dev: update NHWER after M0 from host



Host might update NHWER value before issuing M0 to device.
So, update number of HW event rings after M0 is received from host.

Change-Id: I2e0b28a82e299e66b0167977c4c4ed9d7b6c889e
Signed-off-by: default avatarRama Krishna Phani A <rphani@codeaurora.org>
parent bcec8f77
Loading
Loading
Loading
Loading
+4 −0
Original line number Diff line number Diff line
@@ -1957,6 +1957,10 @@ static int mhi_dev_cache_host_cfg(struct mhi_dev *mhi)
		return rc;
	}

	mhi_log(MHI_MSG_VERBOSE,
		"Number of Event rings : %d, HW Event rings : %d\n",
			mhi->cfg.event_rings, mhi->cfg.hw_event_rings);

	mhi->cmd_ctx_shadow.size = sizeof(struct mhi_dev_cmd_ctx);
	mhi->ev_ctx_shadow.size = sizeof(struct mhi_dev_ev_ctx) *
					mhi->cfg.event_rings;
+14 −8
Original line number Diff line number Diff line
/* Copyright (c) 2015, 2017-2019, The Linux Foundation. All rights reserved.
/* Copyright (c) 2015, 2017-2020, The Linux Foundation. All rights reserved.
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License version 2 and
@@ -982,16 +982,22 @@ EXPORT_SYMBOL(mhi_dev_mmio_init);

int mhi_dev_update_ner(struct mhi_dev *dev)
{
	int rc = 0;
	int rc = 0, mhi_cfg = 0;

	rc = mhi_dev_mmio_masked_read(dev, MHICFG, MHICFG_NER_MASK,
				  MHICFG_NER_SHIFT, &dev->cfg.event_rings);
	if (rc) {
		pr_err("Error update NER\n");
	if (WARN_ON(!dev))
		return -EINVAL;

	rc = mhi_dev_mmio_read(dev, MHICFG, &mhi_cfg);
	if (rc)
		return rc;
	}

	pr_debug("NER in HW :%d\n", dev->cfg.event_rings);
	pr_debug("MHICFG: 0x%x", mhi_cfg);

	dev->cfg.event_rings =
		(mhi_cfg & MHICFG_NER_MASK) >> MHICFG_NER_SHIFT;
	dev->cfg.hw_event_rings =
		(mhi_cfg & MHICFG_NHWER_MASK) >> MHICFG_NHWER_SHIFT;

	return 0;
}
EXPORT_SYMBOL(mhi_dev_update_ner);