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>
This commit is contained in:
Tony Truong 2015-05-13 18:41:48 -07:00 committed by David Keitel
parent 44bbb50c59
commit 6ad91fea76
2 changed files with 14 additions and 4 deletions

View file

@ -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

View file

@ -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;