summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTony Truong <truong@codeaurora.org>2015-05-13 18:41:48 -0700
committerDavid Keitel <dkeitel@codeaurora.org>2016-03-23 21:24:44 -0700
commit6ad91fea76ea37f267701ceb6ad0b0b2100f8220 (patch)
tree284548e8dfbc004ca64d68a7de03b2807fecb81b
parent44bbb50c5985139c0a8a36e90f61aa1c10edd624 (diff)
mhi: core: Resolve issue for UL/DL
Resolve issue whereby UL DL properties were being incorrectly set for non HW event rings. CRs-Fixed: 827294 Change-Id: Ie279061e84c0f2498393c5d7bfaef404307c84da Signed-off-by: Andrei Danaila <adanaila@codeaurora.org> Signed-off-by: Tony Truong <truong@codeaurora.org>
-rw-r--r--drivers/platform/msm/mhi/mhi_macros.h14
-rw-r--r--drivers/platform/msm/mhi/mhi_main.c4
2 files changed, 14 insertions, 4 deletions
diff --git a/drivers/platform/msm/mhi/mhi_macros.h b/drivers/platform/msm/mhi/mhi_macros.h
index 8ff25c79601a..9d5c15e60672 100644
--- a/drivers/platform/msm/mhi/mhi_macros.h
+++ b/drivers/platform/msm/mhi/mhi_macros.h
@@ -1,4 +1,4 @@
-/* Copyright (c) 2014-2015, The Linux Foundation. All rights reserved.
+/* Copyright (c) 2014-2016, 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
@@ -33,6 +33,8 @@
#define MHI_RPM_AUTOSUSPEND_TMR_VAL_MS 1000
#define MAX_BUF_SIZE 32
+#define HW_EVENT_RINGS_ALLOCATED 2
+
#define PRIMARY_CMD_RING 0
#define MHI_WORK_Q_MAX_SIZE 128
@@ -46,11 +48,11 @@
#define MHI_PCIE_DEVICE_ID_ZIRC 0x0301
#define TRB_MAX_DATA_SIZE 0x1000
-
#define MHI_DATA_SEG_WINDOW_START_ADDR 0x0ULL
#define MHI_DATA_SEG_WINDOW_END_ADDR 0x3E800000ULL
#define MHI_M2_DEBOUNCE_TMR_MS 10
+
#define MHI_XFER_DB_INTERVAL 8
#define MHI_EV_DB_INTERVAL 1
@@ -92,6 +94,14 @@
#define MHI_THREAD_SLEEP_TIMEOUT_MS 20
#define MHI_RESUME_WAKE_RETRIES 20
+#define IS_HW_EV_RING(_mhi_dev_ctxt, _EV_INDEX) (_EV_INDEX >= \
+ ((_mhi_dev_ctxt)->mmio_info.nr_event_rings - \
+ HW_EVENT_RINGS_ALLOCATED))
+
+#define IS_SW_EV_RING(_mhi_dev_ctxt, _EV_INDEX) (_EV_INDEX < \
+ ((_mhi_dev_ctxt)->mmio_info.nr_event_rings - \
+ HW_EVENT_RINGS_ALLOCATED))
+
/* Debugging Capabilities*/
#define MHI_DBG_MAX_EVENT_HISTORY 10
diff --git a/drivers/platform/msm/mhi/mhi_main.c b/drivers/platform/msm/mhi/mhi_main.c
index 2e0192c4e78f..2a5e92380b25 100644
--- a/drivers/platform/msm/mhi/mhi_main.c
+++ b/drivers/platform/msm/mhi/mhi_main.c
@@ -1148,12 +1148,12 @@ enum MHI_STATUS recycle_trb_and_ring(struct mhi_device_ctxt *mhi_dev_ctxt,
added_xfer_pkt->data_tx_pkt =
*(struct mhi_tx_pkt *)removed_xfer_pkt;
} else if (MHI_RING_TYPE_EVENT_RING == ring_type) {
+
spinlock_t *lock;
unsigned long flags;
if (ring_index >= mhi_dev_ctxt->mmio_info.nr_event_rings)
return MHI_STATUS_ERROR;
-
lock = &mhi_dev_ctxt->mhi_ev_spinlock_list[ring_index];
spin_lock_irqsave(lock, flags);
db_value = mhi_v2p_addr(mhi_dev_ctxt, ring_type, ring_index,
@@ -1586,7 +1586,7 @@ void mhi_process_db(struct mhi_device_ctxt *mhi_dev_ctxt,
/* Event Doorbell and Polling mode Disabled */
} else if (io_addr == mhi_dev_ctxt->mmio_info.event_db_addr) {
/* Only ring for software channel */
- if (IS_SOFTWARE_CHANNEL(chan) ||
+ if (IS_SW_EV_RING(mhi_dev_ctxt, chan) ||
!mhi_dev_ctxt->flags.uldl_enabled) {
mhi_write_db(mhi_dev_ctxt, io_addr, chan, val);
mhi_dev_ctxt->flags.db_mode[chan] = 0;