summaryrefslogtreecommitdiff
path: root/src/soc
diff options
context:
space:
mode:
authorYidi Lin <yidilin@chromium.org>2024-11-26 23:03:48 +0800
committerYidi Lin <yidilin@chromium.org>2024-11-28 13:41:40 +0000
commit7f36241461510b0f083b04485564ffa544f973a4 (patch)
tree2b7be4b4fd0c61a1fe31de23b525094fe3702bf2 /src/soc
parentf8e4cdd05815ce4f00fb353731314e29207b0af8 (diff)
soc/mediatek: Eliminate redundant calls to get_pmif_controller()
It is unnecessary to look up PMIF controller by mstid in multiple functions. Just pass `arb` to these functions in order to avoid redundant calls to get_pmif_controller(). BUG=none TEST=compiled Change-Id: I907d6ff029827e4afe4f1d05e39c8dd662c7c45e Signed-off-by: Yidi Lin <yidilin@chromium.org> Reviewed-on: https://review.coreboot.org/c/coreboot/+/85327 Reviewed-by: Yu-Ping Wu <yupingso@google.com> Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Diffstat (limited to 'src/soc')
-rw-r--r--src/soc/mediatek/common/include/soc/pmif_spmi.h2
-rw-r--r--src/soc/mediatek/common/pmif_spmi.c28
-rw-r--r--src/soc/mediatek/mt8188/pmif_spmi.c2
-rw-r--r--src/soc/mediatek/mt8192/pmif_spmi.c2
-rw-r--r--src/soc/mediatek/mt8195/pmif_spmi.c2
5 files changed, 14 insertions, 22 deletions
diff --git a/src/soc/mediatek/common/include/soc/pmif_spmi.h b/src/soc/mediatek/common/include/soc/pmif_spmi.h
index f62e3439b7..8610c54e3b 100644
--- a/src/soc/mediatek/common/include/soc/pmif_spmi.h
+++ b/src/soc/mediatek/common/include/soc/pmif_spmi.h
@@ -95,5 +95,5 @@ extern const size_t spmi_dev_cnt;
int pmif_spmi_init(struct pmif *arb);
int spmi_config_master(void);
void pmif_spmi_iocfg(void);
-void pmif_spmi_config(struct pmif *arb, int mstid);
+void pmif_spmi_config(struct pmif *arb);
#endif /* __SOC_MEDIATEK_PMIF_SPMI_H__ */
diff --git a/src/soc/mediatek/common/pmif_spmi.c b/src/soc/mediatek/common/pmif_spmi.c
index 5a359c7ddd..7263ff2fa3 100644
--- a/src/soc/mediatek/common/pmif_spmi.c
+++ b/src/soc/mediatek/common/pmif_spmi.c
@@ -22,7 +22,7 @@ DEFINE_BIT(SPI_EINT_MODE_GATING_EN, 13)
DEFINE_BITFIELD(SPM_SLEEP_REQ_SEL, 1, 0)
DEFINE_BITFIELD(SCP_SLEEP_REQ_SEL, 10, 9)
-__weak void pmif_spmi_config(struct pmif *arb, int mstid)
+__weak void pmif_spmi_config(struct pmif *arb)
{
/* Do nothing. */
}
@@ -94,10 +94,8 @@ static int spmi_mst_init(struct pmif *pmif_arb)
return 0;
}
-static void pmif_spmi_force_normal_mode(int mstid)
+static void pmif_spmi_force_normal_mode(struct pmif *arb)
{
- struct pmif *arb = get_pmif_controller(PMIF_SPMI, mstid);
-
/* listen srclken_0 only for entering normal or sleep mode */
SET32_BITFIELDS(&arb->mtk_pmif->spi_mode_ctrl,
SPI_MODE_CTRL, 0,
@@ -110,27 +108,21 @@ static void pmif_spmi_force_normal_mode(int mstid)
SCP_SLEEP_REQ_SEL, 0);
}
-static void pmif_spmi_enable_swinf(int mstid)
+static void pmif_spmi_enable_swinf(struct pmif *arb)
{
- struct pmif *arb = get_pmif_controller(PMIF_SPMI, mstid);
-
write32(&arb->mtk_pmif->inf_en, PMIF_SPMI_SW_CHAN);
write32(&arb->mtk_pmif->arb_en, PMIF_SPMI_SW_CHAN);
}
-static void pmif_spmi_enable_cmdIssue(int mstid, bool en)
+static void pmif_spmi_enable_cmdIssue(struct pmif *arb, bool en)
{
- struct pmif *arb = get_pmif_controller(PMIF_SPMI, mstid);
-
/* Enable cmdIssue */
write32(&arb->mtk_pmif->cmdissue_en, en);
}
-static void pmif_spmi_enable(int mstid)
+static void pmif_spmi_enable(struct pmif *arb)
{
- struct pmif *arb = get_pmif_controller(PMIF_SPMI, mstid);
-
- pmif_spmi_config(arb, mstid);
+ pmif_spmi_config(arb);
/*
* set bytecnt max limitation.
@@ -161,10 +153,10 @@ static void pmif_spmi_enable(int mstid)
int pmif_spmi_init(struct pmif *arb)
{
if (arb->is_pmif_init_done(arb) != 0) {
- pmif_spmi_force_normal_mode(arb->mstid);
- pmif_spmi_enable_swinf(arb->mstid);
- pmif_spmi_enable_cmdIssue(arb->mstid, true);
- pmif_spmi_enable(arb->mstid);
+ pmif_spmi_force_normal_mode(arb);
+ pmif_spmi_enable_swinf(arb);
+ pmif_spmi_enable_cmdIssue(arb, true);
+ pmif_spmi_enable(arb);
if (arb->is_pmif_init_done(arb))
return -E_NODEV;
}
diff --git a/src/soc/mediatek/mt8188/pmif_spmi.c b/src/soc/mediatek/mt8188/pmif_spmi.c
index 2d8611b08f..006f74424f 100644
--- a/src/soc/mediatek/mt8188/pmif_spmi.c
+++ b/src/soc/mediatek/mt8188/pmif_spmi.c
@@ -61,7 +61,7 @@ int spmi_config_master(void)
return 0;
}
-void pmif_spmi_config(struct pmif *arb, int mstid)
+void pmif_spmi_config(struct pmif *arb)
{
u32 cmd_per;
diff --git a/src/soc/mediatek/mt8192/pmif_spmi.c b/src/soc/mediatek/mt8192/pmif_spmi.c
index d2155fadef..fb1dad0396 100644
--- a/src/soc/mediatek/mt8192/pmif_spmi.c
+++ b/src/soc/mediatek/mt8192/pmif_spmi.c
@@ -56,7 +56,7 @@ int spmi_config_master(void)
return 0;
}
-void pmif_spmi_config(struct pmif *arb, int mstid)
+void pmif_spmi_config(struct pmif *arb)
{
u32 cmd_per;
diff --git a/src/soc/mediatek/mt8195/pmif_spmi.c b/src/soc/mediatek/mt8195/pmif_spmi.c
index 8fff703190..4d5f06f734 100644
--- a/src/soc/mediatek/mt8195/pmif_spmi.c
+++ b/src/soc/mediatek/mt8195/pmif_spmi.c
@@ -66,7 +66,7 @@ int spmi_config_master(void)
return 0;
}
-void pmif_spmi_config(struct pmif *arb, int mstid)
+void pmif_spmi_config(struct pmif *arb)
{
u32 cmd_per;