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

Commit 93f304cd authored by Siddartha Mohanadoss's avatar Siddartha Mohanadoss
Browse files

msm: mhi_dev: Update ring cache logic



When MHI (modem host interface) device receives a ring start
command do not cache the ring. Cache the ring after a doorbell
for the channel is received. This avoid scenario where host
has added elements to the transfer ring and updated the write
offset as part of start command. Currently device caches the ring
to maintain copies of the write and read offset but in the
process updates the write offset without calling the client
callback indicating there is data. Also fix updating the wrap around
condition when caching the ring.

Change-Id: Iac0aa9fa97c0075cea1431f7e22e3d916532a37a
Signed-off-by: default avatarSiddartha Mohanadoss <smohanad@codeaurora.org>
parent f1f541bc
Loading
Loading
Loading
Loading
+3 −5
Original line number Diff line number Diff line
/* Copyright (c) 2015-2017, The Linux Foundation. All rights reserved.
/* Copyright (c) 2015-2018, 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
@@ -71,9 +71,7 @@ int mhi_dev_fetch_ring_elements(struct mhi_dev_ring *ring,
			host_addr.device_va = ring->ring_shadow.device_va;
			host_addr.host_pa = ring->ring_shadow.host_pa;
			host_addr.virt_addr = &ring->ring_cache[0];
			host_addr.phy_addr = (ring->ring_cache_dma_handle +
				sizeof(union mhi_dev_ring_element_type) *
				start);
			host_addr.phy_addr = ring->ring_cache_dma_handle;
			host_addr.size = (end *
				sizeof(union mhi_dev_ring_element_type));
			mhi_dev_read_from_host(ring->mhi_dev, &host_addr);
@@ -386,7 +384,7 @@ int mhi_ring_start(struct mhi_dev_ring *ring, union mhi_dev_ring_ctx *ctx,

	ring->ring_ctx_shadow = ring->ring_ctx;

	if (ring->type != RING_TYPE_ER) {
	if (ring->type != RING_TYPE_ER || ring->type != RING_TYPE_CH) {
		rc = mhi_dev_cache_ring(ring, wr_offset);
		if (rc)
			return rc;