From bd9e89fec71bcb5f60f23608649671566579ccb4 Mon Sep 17 00:00:00 2001 From: Bhaumik Bhatt Date: Tue, 19 Jan 2021 15:58:09 -0800 Subject: [PATCH] bus: mhi: host: Add UL and DL event ring IDs to MHI device Offload channels where the client drivers manage their own context information need event ring information in the MHI device structure that is currently not exposed to them. Add those to enable these drivers to function properly. Change-Id: Icc80344518591ca74c75ab932ac15eca9a77d0ad Signed-off-by: Bhaumik Bhatt Signed-off-by: Lazarus Motha --- drivers/bus/mhi/host/main.c | 6 +++++- include/linux/mhi.h | 4 ++++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/drivers/bus/mhi/host/main.c b/drivers/bus/mhi/host/main.c index ec9c7e12f9ba..0dc847c18191 100644 --- a/drivers/bus/mhi/host/main.c +++ b/drivers/bus/mhi/host/main.c @@ -1,6 +1,6 @@ // SPDX-License-Identifier: GPL-2.0 /* - * Copyright (c) 2018-2020, The Linux Foundation. All rights reserved. + * Copyright (c) 2018-2021, The Linux Foundation. All rights reserved. * */ @@ -378,11 +378,13 @@ void mhi_create_devices(struct mhi_controller *mhi_cntrl) case DMA_TO_DEVICE: mhi_dev->ul_chan = mhi_chan; mhi_dev->ul_chan_id = mhi_chan->chan; + mhi_dev->ul_event_id = mhi_chan->er_index; break; case DMA_FROM_DEVICE: /* We use dl_chan as offload channels */ mhi_dev->dl_chan = mhi_chan; mhi_dev->dl_chan_id = mhi_chan->chan; + mhi_dev->dl_event_id = mhi_chan->er_index; break; default: dev_err(dev, "Direction not supported\n"); @@ -401,9 +403,11 @@ void mhi_create_devices(struct mhi_controller *mhi_cntrl) if (mhi_chan->dir == DMA_TO_DEVICE) { mhi_dev->ul_chan = mhi_chan; mhi_dev->ul_chan_id = mhi_chan->chan; + mhi_dev->ul_event_id = mhi_chan->er_index; } else { mhi_dev->dl_chan = mhi_chan; mhi_dev->dl_chan_id = mhi_chan->chan; + mhi_dev->dl_event_id = mhi_chan->er_index; } get_device(&mhi_dev->dev); mhi_chan->mhi_dev = mhi_dev; diff --git a/include/linux/mhi.h b/include/linux/mhi.h index 3ba339d087b8..a2b2bc7b59c5 100644 --- a/include/linux/mhi.h +++ b/include/linux/mhi.h @@ -491,7 +491,9 @@ struct mhi_controller { * @dev: Driver model device node for the MHI device * @dev_type: MHI device type * @ul_chan_id: MHI channel id for UL transfer + * @ul_event_id: MHI event ring id for UL transfer * @dl_chan_id: MHI channel id for DL transfer + * @ul_event_id: MHI event ring id for DL transfer * @dev_wake: Device wakeup counter */ struct mhi_device { @@ -503,7 +505,9 @@ struct mhi_device { struct device dev; enum mhi_device_type dev_type; int ul_chan_id; + int ul_event_id; int dl_chan_id; + int dl_event_id; u32 dev_wake; };