From a10bc29dd25dd57f7532e7a1826be43fb024159a Mon Sep 17 00:00:00 2001 From: Guodong Liu Date: Mon, 18 Oct 2021 14:36:50 +0800 Subject: [PATCH] soc/mediatek/mt8186: Add AUXADC driver support Add AUXADC controller driver code. TEST=build pass BUG=b:202871018 Signed-off-by: Guodong Liu Change-Id: I9fb7fd4903d67a2804c31ff404bc0486983c742f Reviewed-on: https://review.coreboot.org/c/coreboot/+/59253 Tested-by: build bot (Jenkins) Reviewed-by: Yu-Ping Wu --- src/soc/mediatek/mt8186/Makefile.inc | 4 +++ src/soc/mediatek/mt8186/include/soc/auxadc.h | 28 ++++++++++++++++++++ src/soc/mediatek/mt8186/include/soc/efuse.h | 17 ++++++++++++ 3 files changed, 49 insertions(+) create mode 100644 src/soc/mediatek/mt8186/include/soc/auxadc.h create mode 100644 src/soc/mediatek/mt8186/include/soc/efuse.h diff --git a/src/soc/mediatek/mt8186/Makefile.inc b/src/soc/mediatek/mt8186/Makefile.inc index 4c89f3d6b9..7d6d2ffd69 100644 --- a/src/soc/mediatek/mt8186/Makefile.inc +++ b/src/soc/mediatek/mt8186/Makefile.inc @@ -1,5 +1,6 @@ ifeq ($(CONFIG_SOC_MEDIATEK_MT8186),y) +bootblock-y += ../common/auxadc.c bootblock-y += bootblock.c bootblock-y += ../common/eint_event.c bootblock-y += ../common/flash_controller.c @@ -12,6 +13,7 @@ bootblock-y += ../common/timer.c timer.c bootblock-y += ../common/uart.c bootblock-y += ../common/wdt.c wdt.c +verstage-y += ../common/auxadc.c verstage-y += ../common/flash_controller.c verstage-y += ../common/gpio.c gpio.c verstage-$(CONFIG_SPI_FLASH) += ../common/spi.c spi.c @@ -19,6 +21,7 @@ verstage-y += ../common/timer.c timer.c verstage-y += ../common/uart.c verstage-y += ../common/wdt.c wdt.c +romstage-y += ../common/auxadc.c romstage-y += ../common/cbmem.c romstage-y += emi.c romstage-y += ../common/flash_controller.c @@ -30,6 +33,7 @@ romstage-y += ../common/uart.c romstage-y += ../common/wdt.c wdt.c romstage-y += ../common/pmic_wrap.c pmic_wrap.c mt6366.c +ramstage-y += ../common/auxadc.c ramstage-y += emi.c ramstage-y += ../common/flash_controller.c ramstage-y += ../common/gpio.c gpio.c diff --git a/src/soc/mediatek/mt8186/include/soc/auxadc.h b/src/soc/mediatek/mt8186/include/soc/auxadc.h new file mode 100644 index 0000000000..13a52e3f9d --- /dev/null +++ b/src/soc/mediatek/mt8186/include/soc/auxadc.h @@ -0,0 +1,28 @@ +/* SPDX-License-Identifier: GPL-2.0-only */ + +/* + * This file is created based on MT8186 Functional Specification + * Chapter number: 5.9 + */ + +#ifndef SOC_MEDIATEK_MT8186_AUXADC_H +#define SOC_MEDIATEK_MT8186_AUXADC_H + +#include +#include +#include + +typedef struct mtk_auxadc_regs { + uint32_t con0; + uint32_t con1; + uint32_t con1_set; + uint32_t con1_clr; + uint32_t con2; + uint32_t data[16]; + uint32_t reserved[16]; + uint32_t misc; +} mtk_auxadc_regs; + +static struct mt8186_infracfg_ao_regs *const mtk_infracfg = mt8186_infracfg_ao; + +#endif diff --git a/src/soc/mediatek/mt8186/include/soc/efuse.h b/src/soc/mediatek/mt8186/include/soc/efuse.h new file mode 100644 index 0000000000..fe3dfff9aa --- /dev/null +++ b/src/soc/mediatek/mt8186/include/soc/efuse.h @@ -0,0 +1,17 @@ +/* SPDX-License-Identifier: GPL-2.0-only */ + +#ifndef SOC_MEDIATEK_MT8186_EFUSE_H +#define SOC_MEDIATEK_MT8186_EFUSE_H + +#include +#include + +struct efuse_regs { + uint32_t reserved[130]; + uint32_t adc_cali_reg; +}; + +check_member(efuse_regs, adc_cali_reg, 0x208); +static struct efuse_regs *const mtk_efuse = (void *)EFUSEC_BASE; + +#endif