bus: mhi: ep: Add support for reading from the host
authorManivannan Sadhasivam <manivannan.sadhasivam@linaro.org>
Tue, 5 Apr 2022 13:57:50 +0000 (19:27 +0530)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Tue, 26 Apr 2022 11:17:41 +0000 (13:17 +0200)
commit530125889977365cb6db32d7d0bd84c9f54c8aab
tree978f98404e39b0dba3131f960344ca52aa01a7e9
parente827569062a804c67b51930ce83a4cb886113cb7
bus: mhi: ep: Add support for reading from the host

Data transfer between host and the ep device happens over the transfer
ring associated with each bi-directional channel pair. Host defines the
transfer ring by allocating memory for it. The read and write pointer
addresses of the transfer ring are stored in the channel context.

Once host places the elements in the transfer ring, it increments the
write pointer and rings the channel doorbell. Device will receive the
doorbell interrupt and will process the transfer ring elements.

This commit adds support for reading the transfer ring elements from
the transfer ring till write pointer, incrementing the read pointer and
finally sending the completion event to the host through corresponding
event ring.

Reviewed-by: Alex Elder <elder@linaro.org>
Signed-off-by: Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org>
Link: https://lore.kernel.org/r/20220405135754.6622-15-manivannan.sadhasivam@linaro.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/bus/mhi/ep/main.c
include/linux/mhi_ep.h