From feb573e395ea6e82088fe15b4c34afb974a15249 Mon Sep 17 00:00:00 2001 From: Hui Liu Date: Mon, 25 Jul 2022 14:51:36 +0800 Subject: [PATCH] soc/mediatek/mt8188: Add AUXADC support TEST=get voltage as 340mV for channel 0 in MTK EVB. BUG=b:233720142 Signed-off-by: Hui Liu Change-Id: Idd1edcce6cb62fcf6991bb9342c409150989c5ca Reviewed-on: https://review.coreboot.org/c/coreboot/+/66121 Tested-by: build bot (Jenkins) Reviewed-by: Yu-Ping Wu --- src/soc/mediatek/mt8188/Makefile.inc | 1 + src/soc/mediatek/mt8188/include/soc/auxadc.h | 17 +++++++++++++++++ src/soc/mediatek/mt8188/include/soc/efuse.h | 17 +++++++++++++++++ 3 files changed, 35 insertions(+) create mode 100644 src/soc/mediatek/mt8188/include/soc/auxadc.h create mode 100644 src/soc/mediatek/mt8188/include/soc/efuse.h diff --git a/src/soc/mediatek/mt8188/Makefile.inc b/src/soc/mediatek/mt8188/Makefile.inc index 0d3dfb07d2..8db9c789a4 100644 --- a/src/soc/mediatek/mt8188/Makefile.inc +++ b/src/soc/mediatek/mt8188/Makefile.inc @@ -21,6 +21,7 @@ romstage-y += ../common/pmif.c ../common/pmif_clk.c pmif_clk.c romstage-y += ../common/pmif_spi.c pmif_spi.c romstage-y += ../common/pmif_spmi.c pmif_spmi.c +ramstage-y += ../common/auxadc.c ramstage-y += emi.c ramstage-y += ../common/mcu.c ramstage-y += ../common/mcupm.c diff --git a/src/soc/mediatek/mt8188/include/soc/auxadc.h b/src/soc/mediatek/mt8188/include/soc/auxadc.h new file mode 100644 index 0000000000..b8f0234b95 --- /dev/null +++ b/src/soc/mediatek/mt8188/include/soc/auxadc.h @@ -0,0 +1,17 @@ +/* SPDX-License-Identifier: GPL-2.0-only */ + +/* + * This file is created based on MT8188 Functional Specification + * Chapter number: 5.10 + */ + +#ifndef SOC_MEDIATEK_MT8188_AUXADC_H +#define SOC_MEDIATEK_MT8188_AUXADC_H + +#include +#include +#include + +static struct mt8188_infracfg_ao_regs *const mtk_infracfg = mt8188_infracfg_ao; + +#endif diff --git a/src/soc/mediatek/mt8188/include/soc/efuse.h b/src/soc/mediatek/mt8188/include/soc/efuse.h new file mode 100644 index 0000000000..3b693f7fe2 --- /dev/null +++ b/src/soc/mediatek/mt8188/include/soc/efuse.h @@ -0,0 +1,17 @@ +/* SPDX-License-Identifier: GPL-2.0-only */ + +#ifndef SOC_MEDIATEK_MT8188_EFUSE_H +#define SOC_MEDIATEK_MT8188_EFUSE_H + +#include +#include + +struct efuse_regs { + uint32_t reserved[107]; + uint32_t adc_cali_reg; +}; + +check_member(efuse_regs, adc_cali_reg, 0x1AC); +static struct efuse_regs *const mtk_efuse = (void *)EFUSE_BASE; + +#endif