mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-10 14:19:09 -04:00
mhi: core: Update logic to save bhie offset globally
Some MHI based controllers do not have a BHIE offset defined in mmio register space. For these controllers get the offset from devicetree node and save it globally in mhi controller structure. Change-Id: I86b7464d6c0985a5df20066296fd50c6cd768c77 Signed-off-by: Rama Krishna Phani A <rphani@codeaurora.org>
This commit is contained in:
parent
b709b7ac72
commit
8ee345c470
3 changed files with 17 additions and 18 deletions
|
|
@ -1494,7 +1494,6 @@ static int of_parse_dt(struct mhi_controller *mhi_cntrl,
|
|||
int ret;
|
||||
enum mhi_ee i;
|
||||
u32 *ee;
|
||||
u32 bhie_offset;
|
||||
|
||||
/* parse MHI channel configuration */
|
||||
ret = of_parse_ch_cfg(mhi_cntrl, of_node);
|
||||
|
|
@ -1535,9 +1534,9 @@ static int of_parse_dt(struct mhi_controller *mhi_cntrl,
|
|||
of_property_read_u32_index(of_node, "mhi,ee", ret, ee);
|
||||
}
|
||||
|
||||
ret = of_property_read_u32(of_node, "mhi,bhie-offset", &bhie_offset);
|
||||
ret = of_property_read_u32(of_node, "mhi,bhie-offset", &mhi_cntrl->bhie_offset);
|
||||
if (!ret)
|
||||
mhi_cntrl->bhie = mhi_cntrl->regs + bhie_offset;
|
||||
MHI_LOG("bhie-offset = 0x%x\n", mhi_cntrl->bhie_offset);
|
||||
|
||||
of_property_read_string(of_node, "mhi,name", &mhi_cntrl->name);
|
||||
|
||||
|
|
@ -1776,7 +1775,6 @@ EXPORT_SYMBOL(mhi_alloc_controller);
|
|||
int mhi_prepare_for_power_up(struct mhi_controller *mhi_cntrl)
|
||||
{
|
||||
int ret;
|
||||
u32 bhie_off;
|
||||
|
||||
mutex_lock(&mhi_cntrl->pm_mutex);
|
||||
|
||||
|
|
@ -1798,24 +1796,24 @@ int mhi_prepare_for_power_up(struct mhi_controller *mhi_cntrl)
|
|||
* This controller supports rddm, we need to manually clear
|
||||
* BHIE RX registers since por values are undefined.
|
||||
*/
|
||||
if (!mhi_cntrl->bhie) {
|
||||
if (!mhi_cntrl->bhie_offset) {
|
||||
ret = mhi_read_reg(mhi_cntrl, mhi_cntrl->regs, BHIEOFF,
|
||||
&bhie_off);
|
||||
&mhi_cntrl->bhie_offset);
|
||||
if (ret) {
|
||||
MHI_CNTRL_ERR("Error getting bhie offset\n");
|
||||
goto bhie_error;
|
||||
}
|
||||
|
||||
if (bhie_off >= mhi_cntrl->len) {
|
||||
if (mhi_cntrl->bhie_offset >= mhi_cntrl->len) {
|
||||
MHI_ERR("Invalid BHIE=0x%x len=0x%x\n",
|
||||
bhie_off, mhi_cntrl->len);
|
||||
mhi_cntrl->bhie_offset, mhi_cntrl->len);
|
||||
ret = -EINVAL;
|
||||
goto bhie_error;
|
||||
}
|
||||
|
||||
mhi_cntrl->bhie = mhi_cntrl->regs + bhie_off;
|
||||
}
|
||||
|
||||
mhi_cntrl->bhie = mhi_cntrl->regs + mhi_cntrl->bhie_offset;
|
||||
|
||||
memset_io(mhi_cntrl->bhie + BHIE_RXVECADDR_LOW_OFFS, 0,
|
||||
BHIE_RXVECSTATUS_OFFS - BHIE_RXVECADDR_LOW_OFFS + 4);
|
||||
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
// SPDX-License-Identifier: GPL-2.0-only
|
||||
/* Copyright (c) 2018-2020, The Linux Foundation. All rights reserved. */
|
||||
/* Copyright (c) 2018-2021, The Linux Foundation. All rights reserved. */
|
||||
|
||||
#include <linux/debugfs.h>
|
||||
#include <linux/delay.h>
|
||||
|
|
@ -984,24 +984,24 @@ int mhi_async_power_up(struct mhi_controller *mhi_cntrl)
|
|||
mhi_cntrl->bhi = mhi_cntrl->regs + val;
|
||||
|
||||
/* setup bhie offset if not set */
|
||||
if (mhi_cntrl->fbc_download && !mhi_cntrl->bhie) {
|
||||
ret = mhi_read_reg(mhi_cntrl, mhi_cntrl->regs, BHIEOFF, &val);
|
||||
if (mhi_cntrl->fbc_download && !mhi_cntrl->bhie_offset) {
|
||||
ret = mhi_read_reg(mhi_cntrl, mhi_cntrl->regs, BHIEOFF,
|
||||
&mhi_cntrl->bhie_offset);
|
||||
if (ret) {
|
||||
write_unlock_irq(&mhi_cntrl->pm_lock);
|
||||
MHI_CNTRL_ERR("Error getting bhie offset\n");
|
||||
goto error_bhi_offset;
|
||||
}
|
||||
|
||||
if (val >= mhi_cntrl->len) {
|
||||
if (mhi_cntrl->bhie_offset >= mhi_cntrl->len) {
|
||||
ret = -ENODEV;
|
||||
write_unlock_irq(&mhi_cntrl->pm_lock);
|
||||
MHI_ERR("Invalid bhie offset:%x\n", val);
|
||||
MHI_ERR("Invalid bhie offset:%x\n", mhi_cntrl->bhie_offset);
|
||||
goto error_bhi_offset;
|
||||
}
|
||||
|
||||
mhi_cntrl->bhie = mhi_cntrl->regs + val;
|
||||
}
|
||||
|
||||
mhi_cntrl->bhie = mhi_cntrl->regs + mhi_cntrl->bhie_offset;
|
||||
mhi_cntrl->write_reg(mhi_cntrl, mhi_cntrl->bhi, BHI_INTVEC, 0);
|
||||
mhi_cntrl->power_down = false;
|
||||
mhi_cntrl->pm_state = MHI_PM_POR;
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
/* SPDX-License-Identifier: GPL-2.0-only */
|
||||
/* Copyright (c) 2018-2020, The Linux Foundation. All rights reserved. */
|
||||
/* Copyright (c) 2018-2021, The Linux Foundation. All rights reserved. */
|
||||
|
||||
#ifndef _MHI_H_
|
||||
#define _MHI_H_
|
||||
|
|
@ -305,6 +305,7 @@ struct mhi_controller {
|
|||
size_t seg_len;
|
||||
u32 session_id;
|
||||
u32 sequence_id;
|
||||
u32 bhie_offset;
|
||||
|
||||
bool img_pre_alloc;
|
||||
struct image_info *fbc_image;
|
||||
|
|
|
|||
Loading…
Reference in a new issue