summaryrefslogtreecommitdiff
path: root/drivers/platform
diff options
context:
space:
mode:
authorAndrei Danaila <adanaila@codeaurora.org>2015-05-13 18:45:44 -0700
committerDavid Keitel <dkeitel@codeaurora.org>2016-03-23 21:11:36 -0700
commit4acd8f4e8761a276509beac75bf750946f1b8fdb (patch)
tree829250cf7f2e9b1b96fbd9d8fd665f994a838e61 /drivers/platform
parent57c86e2224d1584b3534e2b7c2f4a3a73ad642d4 (diff)
mhi: core: Flush M3 write
Do a read after write for M3 to flush the write to the device. Change-Id: I0cf8c8a9dcf3599614351e1289f4b56a0fe32289 Signed-off-by: Andrei Danaila <adanaila@codeaurora.org>
Diffstat (limited to 'drivers/platform')
-rw-r--r--drivers/platform/msm/mhi/mhi_states.c44
1 files changed, 20 insertions, 24 deletions
diff --git a/drivers/platform/msm/mhi/mhi_states.c b/drivers/platform/msm/mhi/mhi_states.c
index edb1472073c5..7f7dde6d4e0e 100644
--- a/drivers/platform/msm/mhi/mhi_states.c
+++ b/drivers/platform/msm/mhi/mhi_states.c
@@ -17,6 +17,25 @@
#include <linux/platform_device.h>
#include <linux/pm_runtime.h>
+static inline void mhi_set_m_state(struct mhi_device_ctxt *mhi_dev_ctxt,
+ enum MHI_STATE new_state)
+{
+ if (MHI_STATE_RESET == new_state) {
+ mhi_reg_write_field(mhi_dev_ctxt,
+ mhi_dev_ctxt->mmio_info.mmio_addr, MHICTRL,
+ MHICTRL_RESET_MASK,
+ MHICTRL_RESET_SHIFT,
+ 1);
+ } else {
+ mhi_reg_write_field(mhi_dev_ctxt,
+ mhi_dev_ctxt->mmio_info.mmio_addr, MHICTRL,
+ MHICTRL_MHISTATE_MASK,
+ MHICTRL_MHISTATE_SHIFT,
+ new_state);
+ }
+ mhi_reg_read(mhi_dev_ctxt->mmio_info.mmio_addr, MHICTRL);
+}
+
static void conditional_chan_db_write(
struct mhi_device_ctxt *mhi_dev_ctxt, u32 chan)
{
@@ -187,12 +206,7 @@ static enum MHI_STATUS process_m1_transition(
atomic_inc(&mhi_dev_ctxt->flags.m2_transition);
mhi_dev_ctxt->mhi_state = MHI_STATE_M2;
mhi_log(MHI_MSG_INFO, "Allowing transition to M2\n");
- mhi_reg_write_field(mhi_dev_ctxt,
- mhi_dev_ctxt->mmio_info.mmio_addr, MHICTRL,
- MHICTRL_MHISTATE_MASK,
- MHICTRL_MHISTATE_SHIFT,
- MHI_STATE_M2);
- mhi_reg_read(mhi_dev_ctxt->mmio_info.mmio_addr, MHICTRL);
+ mhi_set_m_state(mhi_dev_ctxt, MHI_STATE_M2);
mhi_dev_ctxt->counters.m1_m2++;
}
write_unlock_irqrestore(&mhi_dev_ctxt->xfer_lock, flags);
@@ -606,24 +620,6 @@ static enum MHI_STATUS process_amss_transition(
return MHI_STATUS_SUCCESS;
}
-static void mhi_set_m_state(struct mhi_device_ctxt *mhi_dev_ctxt,
- enum MHI_STATE new_state)
-{
- if (MHI_STATE_RESET == new_state) {
- mhi_reg_write_field(mhi_dev_ctxt,
- mhi_dev_ctxt->mmio_info.mmio_addr, MHICTRL,
- MHICTRL_RESET_MASK,
- MHICTRL_RESET_SHIFT,
- 1);
- } else {
- mhi_reg_write_field(mhi_dev_ctxt,
- mhi_dev_ctxt->mmio_info.mmio_addr, MHICTRL,
- MHICTRL_MHISTATE_MASK,
- MHICTRL_MHISTATE_SHIFT,
- new_state);
- }
-}
-
enum MHI_STATUS mhi_trigger_reset(struct mhi_device_ctxt *mhi_dev_ctxt)
{
enum MHI_STATUS ret_val;