Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit d7b94ef0 authored by Hemant Kumar's avatar Hemant Kumar
Browse files

mhi: core: Finish pending reg writes before entering suspend



It is possible that the write offload worker gets a chance to
run after PCIe link is handed off to DRV subsystem. DRV
subsystem can enter L1SS sleep while work handler is trying to
access MHI register. This results into NOC error. Fix this
issue by flushing work before handing off PCIe link to DRV
subsystem or link enters D3 cold.

Change-Id: I83e33b3753b62bf13a7f50af52c951b7a09a32e7
Signed-off-by: default avatarHemant Kumar <hemantk@codeaurora.org>
parent 44652454
Loading
Loading
Loading
Loading
+7 −1
Original line number Diff line number Diff line
// SPDX-License-Identifier: GPL-2.0-only
/* Copyright (c) 2018-2019, The Linux Foundation. All rights reserved. */
/* Copyright (c) 2018-2020, The Linux Foundation. All rights reserved. */

#include <linux/debugfs.h>
#include <linux/delay.h>
@@ -1171,6 +1171,9 @@ int mhi_pm_suspend(struct mhi_controller *mhi_cntrl)
	write_unlock_irq(&mhi_cntrl->pm_lock);
	MHI_LOG("Wait for M3 completion\n");

	/* finish reg writes before D3 cold */
	mhi_force_reg_write(mhi_cntrl);

	ret = wait_event_timeout(mhi_cntrl->state_event,
				 mhi_cntrl->dev_state == MHI_STATE_M3 ||
				 MHI_PM_IN_ERROR_STATE(mhi_cntrl->pm_state),
@@ -1285,6 +1288,9 @@ int mhi_pm_fast_suspend(struct mhi_controller *mhi_cntrl, bool notify_client)
	mhi_cntrl->M3_FAST++;
	write_unlock_irq(&mhi_cntrl->pm_lock);

	/* finish reg writes before DRV hand-off to avoid noc err */
	mhi_force_reg_write(mhi_cntrl);

	/* now safe to check ctrl event ring */
	tasklet_enable(&mhi_cntrl->mhi_event->task);
	mhi_msi_handlr(0, mhi_cntrl->mhi_event);