Yidi Lin has submitted this change. ( https://review.coreboot.org/c/coreboot/+/84774?usp=email )
Change subject: soc/mediatek/common: Add read16/write16 support for PMIF ......................................................................
soc/mediatek/common: Add read16/write16 support for PMIF
This patch is prepared for MT8196 PMIF driver.
BUG=none TEST=emerge-corsola coreboot; emerge-geralt coreboot
Change-Id: I3adbbaaf247a8bbd99627cf089b5b55fcf4fb115 Signed-off-by: Yidi Lin yidilin@chromium.org Reviewed-on: https://review.coreboot.org/c/coreboot/+/84774 Tested-by: build bot (Jenkins) no-reply@coreboot.org Reviewed-by: Yu-Ping Wu yupingso@google.com --- M src/soc/mediatek/common/include/soc/pmif_common.h M src/soc/mediatek/common/pmif.c 2 files changed, 16 insertions(+), 0 deletions(-)
Approvals: build bot (Jenkins): Verified Yu-Ping Wu: Looks good to me, approved
diff --git a/src/soc/mediatek/common/include/soc/pmif_common.h b/src/soc/mediatek/common/include/soc/pmif_common.h index ee0a266..949b34f 100644 --- a/src/soc/mediatek/common/include/soc/pmif_common.h +++ b/src/soc/mediatek/common/include/soc/pmif_common.h @@ -30,6 +30,8 @@ u32 pmifid; void (*read)(struct pmif *arb, u32 slvid, u32 reg, u32 *data); void (*write)(struct pmif *arb, u32 slvid, u32 reg, u32 data); + void (*read16)(struct pmif *arb, u32 slvid, u32 reg, u16 *data); + void (*write16)(struct pmif *arb, u32 slvid, u32 reg, u16 data); u32 (*read_field)(struct pmif *arb, u32 slvid, u32 reg, u32 mask, u32 shift); void (*write_field)(struct pmif *arb, u32 slvid, u32 reg, u32 val, u32 mask, u32 shift); int (*is_pmif_init_done)(struct pmif *arb); @@ -86,6 +88,8 @@ int mtk_pmif_init(void); void pmif_spmi_read(struct pmif *arb, u32 slvid, u32 reg, u32 *data); void pmif_spmi_write(struct pmif *arb, u32 slvid, u32 reg, u32 data); +void pmif_spmi_read16(struct pmif *arb, u32 slvid, u32 reg, u16 *data); +void pmif_spmi_write16(struct pmif *arb, u32 slvid, u32 reg, u16 data); u32 pmif_spmi_read_field(struct pmif *arb, u32 slvid, u32 reg, u32 mask, u32 shift); void pmif_spmi_write_field(struct pmif *arb, u32 slvid, u32 reg, u32 val, u32 mask, u32 shift); diff --git a/src/soc/mediatek/common/pmif.c b/src/soc/mediatek/common/pmif.c index 50fddc8..97da415 100644 --- a/src/soc/mediatek/common/pmif.c +++ b/src/soc/mediatek/common/pmif.c @@ -74,6 +74,18 @@ pmif_send_cmd(arb, 1, PMIF_CMD_EXT_REG_LONG, slvid, reg, NULL, data, 1); }
+void pmif_spmi_read16(struct pmif *arb, u32 slvid, u32 reg, u16 *data) +{ + u32 rdata = 0; + pmif_send_cmd(arb, 0, PMIF_CMD_EXT_REG_LONG, slvid, reg, &rdata, 0, 2); + *data = (u16)rdata; +} + +void pmif_spmi_write16(struct pmif *arb, u32 slvid, u32 reg, u16 data) +{ + pmif_send_cmd(arb, 1, PMIF_CMD_EXT_REG_LONG, slvid, reg, NULL, data, 2); +} + u32 pmif_spmi_read_field(struct pmif *arb, u32 slvid, u32 reg, u32 mask, u32 shift) { u32 data;