Yidi Lin has uploaded this change for review. ( https://review.coreboot.org/c/coreboot/+/46395 )
Change subject: soc/mediatek/mt8192: add rtc MT6359P driver ......................................................................
soc/mediatek/mt8192: add rtc MT6359P driver
Add rtc MT6359P driver.
TEST=boot asurada
Signed-off-by: Yuchen Huang yuchen.huang@mediatek.corp-partner.google.com Change-Id: I57d6738fdec148c7458b2024a0a8225415ca2f3e --- M src/soc/mediatek/common/include/soc/rtc_common.h M src/soc/mediatek/common/rtc.c M src/soc/mediatek/mt8192/Makefile.inc M src/soc/mediatek/mt8192/bootblock.c A src/soc/mediatek/mt8192/include/soc/rtc.h A src/soc/mediatek/mt8192/rtc.c 6 files changed, 694 insertions(+), 25 deletions(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/95/46395/1
diff --git a/src/soc/mediatek/common/include/soc/rtc_common.h b/src/soc/mediatek/common/include/soc/rtc_common.h old mode 100644 new mode 100755 index 5159f37..19dc3cd --- a/src/soc/mediatek/common/include/soc/rtc_common.h +++ b/src/soc/mediatek/common/include/soc/rtc_common.h @@ -102,26 +102,4 @@ int rtc_reg_init(void); void rtc_boot_common(void);
-static inline s32 rtc_read(u16 addr, u16 *rdata) -{ - s32 ret; - - ret = pwrap_read(addr, rdata); - if (ret < 0) - rtc_info("pwrap_read fail: ret=%d\n", ret); - - return ret; -} - -static inline s32 rtc_write(u16 addr, u16 wdata) -{ - s32 ret; - - ret = pwrap_write(addr, wdata); - if (ret < 0) - rtc_info("pwrap_write fail: ret=%d\n", ret); - - return ret; -} - #endif /* SOC_MEDIATEK_RTC_COMMON_H */ diff --git a/src/soc/mediatek/common/rtc.c b/src/soc/mediatek/common/rtc.c old mode 100644 new mode 100755 index 0925f7f..d0b90f7 --- a/src/soc/mediatek/common/rtc.c +++ b/src/soc/mediatek/common/rtc.c @@ -2,7 +2,7 @@
#include <soc/rtc_common.h> #include <soc/rtc.h> -#include <soc/pmic_wrap.h> +#include <soc/pmif.h> #include <timer.h>
/* ensure rtc write success */ @@ -164,8 +164,8 @@
switch (rtc_check_state()) { case RTC_STATE_REBOOT: - pwrap_write_field(RTC_BBPU, RTC_BBPU_KEY | RTC_BBPU_RELOAD, - 0xFFFF, 0); + rtc_read(RTC_BBPU, &bbpu); + rtc_write(RTC_BBPU, bbpu | RTC_BBPU_KEY | RTC_BBPU_RELOAD); rtc_write_trigger(); rtc_osc_init(); break; @@ -176,6 +176,7 @@ default: if (rtc_init(0)) rtc_init(1); + rtc_info("RTC_STATE_INIT\n"); break; }
diff --git a/src/soc/mediatek/mt8192/Makefile.inc b/src/soc/mediatek/mt8192/Makefile.inc old mode 100644 new mode 100755 index 5fc90a8..9542aa4 --- a/src/soc/mediatek/mt8192/Makefile.inc +++ b/src/soc/mediatek/mt8192/Makefile.inc @@ -11,6 +11,7 @@ bootblock-y += ../common/uart.c bootblock-y += ../common/wdt.c bootblock-y += pmif.c pmif_clk.c pmif_spi.c pmif_spmi.c +bootblock-y += ../common/rtc.c rtc.c bootblock-y += mt6315.c bootblock-y += mt6359p.c
diff --git a/src/soc/mediatek/mt8192/bootblock.c b/src/soc/mediatek/mt8192/bootblock.c old mode 100644 new mode 100755 index 7987b1c..5bb85ba --- a/src/soc/mediatek/mt8192/bootblock.c +++ b/src/soc/mediatek/mt8192/bootblock.c @@ -7,6 +7,7 @@ #include <soc/pll.h> #include <soc/pmif.h> #include <soc/wdt.h> +#include <soc/rtc.h>
void bootblock_soc_init(void) { @@ -16,4 +17,5 @@ mtk_pmif_init(); mt6359p_init(); mt6315_init(); + rtc_boot(); } diff --git a/src/soc/mediatek/mt8192/include/soc/rtc.h b/src/soc/mediatek/mt8192/include/soc/rtc.h new file mode 100755 index 0000000..b1be85c --- /dev/null +++ b/src/soc/mediatek/mt8192/include/soc/rtc.h @@ -0,0 +1,220 @@ +/* + * This file is part of the coreboot project. + * + * Copyright 2018 MediaTek Inc. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; version 2 of the License. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + */ +#ifndef SOC_MEDIATEK_MT8192_RTC_H +#define SOC_MEDIATEK_MT8192_RTC_H + +#include <soc/rtc_common.h> + +/* RTC registers */ +enum { + RTC_BBPU = 0x0588, + RTC_IRQ_STA = 0x058A, + RTC_IRQ_EN = 0x058C, + RTC_CII_EN = 0x058E +}; + +enum { + RTC_TC_SEC = 0x0592, + RTC_TC_MIN = 0x0594, + RTC_TC_HOU = 0x0596, + RTC_TC_DOM = 0x0598, + RTC_TC_DOW = 0x059A, + RTC_TC_MTH = 0x059C, + RTC_TC_YEA = 0x059E +}; + +enum { + RTC_AL_SEC = 0x05A0, + RTC_AL_MIN = 0x05A2, + RTC_AL_HOU = 0x05A4, + RTC_AL_DOM = 0x05A6, + RTC_AL_DOW = 0x05A8, + RTC_AL_MTH = 0x05AA, + RTC_AL_YEA = 0x05AC, + RTC_AL_MASK = 0x0590 +}; + +enum { + RTC_OSC32CON = 0x05AE, + RTC_CON = 0x05C4, + RTC_WRTGR = 0x05C2 +}; + +enum { + RTC_POWERKEY1 = 0x05B0, + RTC_POWERKEY2 = 0x05B2 +}; + +enum { + RTC_PDN1 = 0x05B4, + RTC_PDN2 = 0x05B6, + RTC_SPAR0 = 0x05B8, + RTC_SPAR1 = 0x05BA, + RTC_PROT = 0x05BC, + RTC_DIFF = 0x05BE, + RTC_CALI = 0x05C0 +}; + +enum { + RTC_BBPU_ENABLE_ALARM = 1U << 0, + RTC_BBPU_SPAR_SW = 1U << 1, + RTC_BBPU_RESET_SPAR = 1U << 2, + RTC_BBPU_RESET_ALARM = 1U << 3, + RTC_BBPU_CLRPKY = 1U << 4, + RTC_BBPU_RELOAD = 1U << 5, + RTC_BBPU_CBUSY = 1U << 6, + RTC_CBUSY_TIMEOUT_US = 1000000 +}; + +enum { + RTC_CON_VBAT_LPSTA_RAW = 1U << 0, + RTC_CON_EOSC32_LPEN = 1U << 1, + RTC_CON_XOSC32_LPEN = 1U << 2, + RTC_CON_LPRST = 1U << 3, + RTC_CON_CDBO = 1U << 4, + RTC_CON_F32KOB = 1U << 5, + RTC_CON_GPO = 1U << 6, + RTC_CON_GOE = 1U << 7, + RTC_CON_GSR = 1U << 8, + RTC_CON_GSMT = 1U << 9, + RTC_CON_GPEN = 1U << 10, + RTC_CON_GPU = 1U << 11, + RTC_CON_GE4 = 1U << 12, + RTC_CON_GE8 = 1U << 13, + RTC_CON_GPI = 1U << 14, + RTC_CON_LPSTA_RAW = 1U << 15 +}; + +enum { + RTC_XOSCCALI_MASK = 0x1F << 0, + RTC_XOSC32_ENB = 1U << 5, + RTC_EMB_HW_MODE = 0U << 6, + RTC_EMB_K_EOSC32_MODE = 1U << 6, + RTC_EMB_SW_DCXO_MODE = 2U << 6, + RTC_EMB_SW_EOSC32_MODE = 3U << 6, + RTC_EMBCK_SEL_MODE_MASK = 3U << 6, + RTC_EMBCK_SRC_SEL = 1U << 8, + RTC_EMBCK_SEL_OPTION = 1U << 9, + RTC_GPS_CKOUT_EN = 1U << 10, + RTC_REG_XOSC32_ENB = 1U << 15 +}; + +enum { + RTC_LPD_OPT_XOSC_AND_EOSC_LPD = 0U << 13, + RTC_LPD_OPT_EOSC_LPD = 1U << 13, + RTC_LPD_OPT_XOSC_LPD = 2U << 13, + RTC_LPD_OPT_F32K_CK_ALIVE = 3U << 13, + RTC_LPD_OPT_MASK = 3U << 13 +}; + +/* PMIC TOP Register Definition */ +enum { + PMIC_RG_SCK_TOP_CON0 = 0x050C +}; + +/* PMIC TOP Register Definition */ +enum { + PMIC_RG_TOP_CKPDN_CON0 = 0x010C, + PMIC_RG_TOP_CKPDN_CON0_SET = 0x010E, + PMIC_RG_TOP_CKPDN_CON0_CLR = 0x0110, + PMIC_RG_TOP_CKPDN_CON1 = 0x0112, + PMIC_RG_TOP_CKPDN_CON1_SET = 0x0114, + PMIC_RG_TOP_CKPDN_CON1_CLR = 0x0116, + PMIC_RG_TOP_CKSEL_CON0 = 0x0118, + PMIC_RG_TOP_CKSEL_CON0_SET = 0x011A, + PMIC_RG_TOP_CKSEL_CON0_CLR = 0x011C +}; + +enum { + PMIC_RG_FQMTR_32K_CK_PDN_SHIFT = 10, + PMIC_RG_FQMTR_CK_PDN_SHIFT = 11 +}; + +/* PMIC DCXO Register Definition */ +enum { + PMIC_RG_DCXO_CW00 = 0x0788, + PMIC_RG_DCXO_CW00_SET = 0x078A, + PMIC_RG_DCXO_CW00_CLR = 0x078C, + PMIC_RG_DCXO_CW02 = 0x0790, + PMIC_RG_DCXO_CW08 = 0x079C, + PMIC_RG_DCXO_CW09 = 0x079E, + PMIC_RG_DCXO_CW09_SET = 0x07A0, + PMIC_RG_DCXO_CW09_CLR = 0x07A2, + PMIC_RG_DCXO_CW12 = 0x07A8 +}; + +/* PMIC Frequency Meter Definition */ +enum { + PMIC_RG_FQMTR_CKSEL = 0x0118, + PMIC_RG_FQMTR_RST = 0x013A, + PMIC_RG_FQMTR_CON0 = 0x0546, + PMIC_RG_FQMTR_WINSET = 0x0548, + PMIC_RG_FQMTR_DATA = 0x054A, + FQMTR_TIMEOUT_US = 8000 +}; + +enum { + PMIC_FQMTR_FIX_CLK_26M = 0U << 0, + PMIC_FQMTR_FIX_CLK_XOSC_32K_DET = 1U << 0, + PMIC_FQMTR_FIX_CLK_EOSC_32K = 2U << 0, + PMIC_FQMTR_FIX_CLK_RTC_32K = 3U << 0, + PMIC_FQMTR_FIX_CLK_DCXO1M_CK = 4U << 0, + PMIC_FQMTR_FIX_CLK_TCK_SEC = 5U << 0, + PMIC_FQMTR_FIX_CLK_PMU_32K = 6U << 0, + PMIC_FQMTR_CKSEL_MASK = 7U << 0 +}; + +enum { + PMIC_FQMTR_RST_SHIFT = 8 +}; + +enum { + PMIC_FQMTR_CON0_XOSC32_CK = 0U << 0, + PMIC_FQMTR_CON0_DCXO_F32K_CK = 1U << 0, + PMIC_FQMTR_CON0_EOSC32_CK = 2U << 0, + PMIC_FQMTR_CON0_XOSC32_CK_DETECTON = 3U << 0, + PMIC_FQMTR_CON0_FQM26M_CK = 4U << 0, + PMIC_FQMTR_CON0_FQM32k_CK = 5U << 0, + PMIC_FQMTR_CON0_TEST_CK = 6U << 0, + PMIC_FQMTR_CON0_TCKSEL_MASK = 7U << 0, + PMIC_FQMTR_CON0_BUSY = 1U << 3, + PMIC_FQMTR_CON0_DCXO26M_EN = 1U << 4, + PMIC_FQMTR_CON0_FQMTR_EN = 1U << 15 +}; + +enum { + RTC_FQMTR_LOW_BASE = 794 - 2, + RTC_FQMTR_HIGH_BASE = 794 + 2 +}; + +enum { + RTC_XOSCCALI_START = 0x00, + RTC_XOSCCALI_END = 0x1f +}; + +enum { + RTC_TC_MTH_MASK = 0xf +}; + +int rtc_read(u16 addr, u16 *rdata); +int rtc_write(u16 addr, u16 wdata); +void rtc_write_field(u16 reg, u16 val, u16 mask, u16 shift); +void rtc_bbpu_power_on(void); +void rtc_osc_init(void); +int rtc_init(u8 recover); +void rtc_boot(void); +void mt6359_dcxo_disable_unused(void); +#endif /* SOC_MEDIATEK_MT8192_RTC_H */ + diff --git a/src/soc/mediatek/mt8192/rtc.c b/src/soc/mediatek/mt8192/rtc.c new file mode 100755 index 0000000..a8e28b5 --- /dev/null +++ b/src/soc/mediatek/mt8192/rtc.c @@ -0,0 +1,467 @@ +/* + * This file is part of the coreboot project. + * + * Copyright 2018 MediaTek Inc. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; version 2 of the License. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + */ +#include <delay.h> +#include <halt.h> +#include <soc/mt6359p.h> +#include <soc/pmif.h> +#include <soc/rtc_common.h> +#include <soc/rtc.h> +#include <timer.h> + +#define RTC_GPIO_USER_MASK ((1 << 13) - (1 << 8)) + +static struct pmif *pmif_arb = NULL; + +int rtc_read(u16 addr, u16 *rdata) +{ + if (pmif_arb == NULL) + pmif_arb = get_pmif_controller(PMIF_SPI, 0); + return pmif_arb->read_cmd(pmif_arb, 0, (unsigned int)addr, (unsigned int *)rdata); +} + +int rtc_write(u16 addr, u16 wdata) +{ + if (pmif_arb == NULL) + pmif_arb = get_pmif_controller(PMIF_SPI, 0); + return pmif_arb->write_cmd(pmif_arb, 0, (unsigned int)addr, (unsigned int)wdata); +} + +void rtc_write_field(u16 reg, u16 val, u16 mask, u16 shift) +{ + u16 old, new; + + rtc_read(reg, &old); + new = old & ~(mask << shift); + new |= (val << shift); + rtc_write(reg, new); +} + +/* initialize rtc setting of using dcxo clock */ +static int rtc_enable_dcxo(void) +{ + if (!rtc_writeif_unlock()) { /* Unlock for reload */ + rtc_info("rtc_writeif_unlock() failed\n"); + return 0; + } + + u16 bbpu, con, osc32con, sec; + + rtc_read(RTC_BBPU, &bbpu); + rtc_write(RTC_BBPU, bbpu | RTC_BBPU_KEY | RTC_BBPU_RELOAD); + rtc_write_trigger(); + rtc_read(RTC_OSC32CON, &osc32con); + osc32con &= ~(RTC_EMBCK_SRC_SEL | RTC_EMBCK_SEL_MODE_MASK + | RTC_GPS_CKOUT_EN); + osc32con |= RTC_XOSC32_ENB | RTC_REG_XOSC32_ENB + | RTC_EMB_K_EOSC32_MODE | RTC_EMBCK_SEL_OPTION; + + if (!rtc_xosc_write(osc32con)) { + rtc_info("rtc_xosc_write() failed\n"); + return 0; + } + + rtc_read(RTC_CON, &con); + rtc_read(RTC_OSC32CON, &osc32con); + rtc_read(RTC_AL_SEC, &sec); + rtc_info("con=0x%x, osc32con=0x%x, sec=0x%x\n", con, osc32con, sec); + return 1; +} + +/* initialize rtc related gpio */ +static int rtc_gpio_init(void) +{ + u16 con; + + /* GPI mode and pull down */ + rtc_read(RTC_CON, &con); + con &= (RTC_CON_LPSTA_RAW | RTC_CON_LPRST | RTC_CON_EOSC32_LPEN + | RTC_CON_XOSC32_LPEN); + con |= (RTC_CON_GPEN | RTC_CON_GOE); + con &= ~(RTC_CON_F32KOB); + con &= ~RTC_CON_GPU; + rtc_write(RTC_CON, con); + + return rtc_write_trigger(); +} + +static u16 rtc_get_frequency_meter(u16 val, u16 measure_src, u16 window_size) +{ + u16 bbpu, osc32con; + u16 fqmtr_busy, fqmtr_data, fqmtr_rst, fqmtr_tcksel; + struct stopwatch sw; + + if (val) { + rtc_read(RTC_BBPU, &bbpu); + rtc_write(RTC_BBPU, bbpu | RTC_BBPU_KEY | RTC_BBPU_RELOAD); + rtc_write_trigger(); + rtc_read(RTC_OSC32CON, &osc32con); + rtc_xosc_write((osc32con & ~RTC_XOSCCALI_MASK) | + (val & RTC_XOSCCALI_MASK)); + } + + /* enable FQMTR clock */ + rtc_write_field(PMIC_RG_TOP_CKPDN_CON0_CLR, 1, 1, + PMIC_RG_FQMTR_32K_CK_PDN_SHIFT); + rtc_write_field(PMIC_RG_TOP_CKPDN_CON0_CLR, 1, 1, + PMIC_RG_FQMTR_CK_PDN_SHIFT); + /* FQMTR reset */ + rtc_write_field(PMIC_RG_FQMTR_RST, 1, 1, PMIC_FQMTR_RST_SHIFT); + + do { + rtc_read(PMIC_RG_FQMTR_DATA, &fqmtr_data); + rtc_read(PMIC_RG_FQMTR_CON0, &fqmtr_busy); + } while (fqmtr_data && (fqmtr_busy & PMIC_FQMTR_CON0_BUSY)); + + rtc_read(PMIC_RG_FQMTR_RST, &fqmtr_rst); + /* FQMTR normal */ + rtc_write_field(PMIC_RG_FQMTR_RST, 0, 1, PMIC_FQMTR_RST_SHIFT); + /* set frequency meter window value (0=1X32K(fixed clock)) */ + rtc_write(PMIC_RG_FQMTR_WINSET, window_size); + /* enable 26M and set test clock source */ + rtc_write(PMIC_RG_FQMTR_CON0, PMIC_FQMTR_CON0_DCXO26M_EN | measure_src); + /* enable 26M -> delay 100us -> enable FQMTR */ + udelay(100); + rtc_read(PMIC_RG_FQMTR_CON0, &fqmtr_tcksel); + /* enable FQMTR */ + rtc_write(PMIC_RG_FQMTR_CON0, fqmtr_tcksel | PMIC_FQMTR_CON0_FQMTR_EN); + udelay(100); + stopwatch_init_usecs_expire(&sw, FQMTR_TIMEOUT_US); + /* FQMTR read until ready */ + do { + rtc_read(PMIC_RG_FQMTR_CON0, &fqmtr_busy); + if (stopwatch_expired(&sw)) { + rtc_info("get frequency time out !!\n"); + return 0; + } + } while (fqmtr_busy & PMIC_FQMTR_CON0_BUSY); + + /* read data should be closed to 26M/32k = 794 */ + rtc_read(PMIC_RG_FQMTR_DATA, &fqmtr_data); + rtc_read(PMIC_RG_FQMTR_CON0, &fqmtr_tcksel); + /* disable FQMTR */ + rtc_write(PMIC_RG_FQMTR_CON0, fqmtr_tcksel & ~PMIC_FQMTR_CON0_FQMTR_EN); + /* disable FQMTR -> delay 100us -> disable 26M */ + udelay(100); + /* disable 26M */ + rtc_read(PMIC_RG_FQMTR_CON0, &fqmtr_tcksel); + rtc_write(PMIC_RG_FQMTR_CON0, + fqmtr_tcksel & ~PMIC_FQMTR_CON0_DCXO26M_EN); + rtc_info("input=0x%x, output=%d\n", val, fqmtr_data); + /* disable FQMTR clock */ + rtc_write_field(PMIC_RG_TOP_CKPDN_CON0_SET, 1, 1, + PMIC_RG_FQMTR_32K_CK_PDN_SHIFT); + rtc_write_field(PMIC_RG_TOP_CKPDN_CON0_SET, 1, 1, + PMIC_RG_FQMTR_CK_PDN_SHIFT); + return fqmtr_data; +} + +/* 32k clock calibration */ +static u16 rtc_eosc_cali(void) +{ + u16 middle, diff1, diff2, cksel; + u16 val = 0; + u16 left = RTC_XOSCCALI_START, right = RTC_XOSCCALI_END; + + rtc_read(PMIC_RG_FQMTR_CKSEL, &cksel); + cksel &= ~PMIC_FQMTR_CKSEL_MASK; + /* select EOSC_32 as fixed clock */ + rtc_write(PMIC_RG_FQMTR_CKSEL, cksel | PMIC_FQMTR_FIX_CLK_EOSC_32K); + rtc_read(PMIC_RG_FQMTR_CKSEL, &cksel); + rtc_info("PMIC_RG_FQMTR_CKSEL=0x%x\n", cksel); + + while (left <= right) { + middle = (right + left) / 2; + if (middle == left) + break; + /* select 26M as target clock */ + val = rtc_get_frequency_meter(middle, PMIC_FQMTR_CON0_FQM26M_CK, 0); + if (val >= RTC_FQMTR_LOW_BASE && val <= RTC_FQMTR_HIGH_BASE) + break; + if (val > RTC_FQMTR_HIGH_BASE) + right = middle; + else + left = middle; + } + + if (val >= RTC_FQMTR_LOW_BASE && val <= RTC_FQMTR_HIGH_BASE) + return middle; + + val = rtc_get_frequency_meter(left, PMIC_FQMTR_CON0_FQM26M_CK, 0); + + if (val > RTC_FQMTR_LOW_BASE) + diff1 = val - RTC_FQMTR_LOW_BASE; + else + diff1 = RTC_FQMTR_LOW_BASE - val; + + val = rtc_get_frequency_meter(right, PMIC_FQMTR_CON0_FQM26M_CK, 0); + + if (val > RTC_FQMTR_LOW_BASE) + diff2 = val - RTC_FQMTR_LOW_BASE; + else + diff2 = RTC_FQMTR_LOW_BASE - val; + + if (diff1 < diff2) + return left; + else + return right; +} + +void rtc_osc_init(void) +{ + u16 osc32con; + + /* enable 32K export */ + rtc_gpio_init(); + /* Calibrate eosc32 for powerdown clock */ + rtc_read(RTC_OSC32CON, &osc32con); + rtc_info("osc32con val = 0x%x\n", osc32con); + osc32con &= ~RTC_XOSCCALI_MASK; + osc32con |= rtc_eosc_cali() & RTC_XOSCCALI_MASK; + rtc_xosc_write(osc32con); + rtc_info("EOSC32 cali val = 0x%x\n", osc32con); +} + +/* enable lpd subroutine */ +static int rtc_lpen(u16 con) +{ + con &= ~RTC_CON_LPRST; + rtc_write(RTC_CON, con); + + if (!rtc_write_trigger()) + return 0; + + con |= RTC_CON_LPRST; + rtc_write(RTC_CON, con); + + if (!rtc_write_trigger()) + return 0; + + con &= ~RTC_CON_LPRST; + rtc_write(RTC_CON, con); + + if (!rtc_write_trigger()) + return 0; + + return 1; +} + +/* low power detect setting */ +static int rtc_lpd_init(void) +{ + u16 con, sec; + + /* disable both XOSC & EOSC LPD */ + rtc_read(RTC_AL_SEC, &sec); + sec |= RTC_LPD_OPT_F32K_CK_ALIVE; + rtc_write(RTC_AL_SEC, sec); + + if (!rtc_write_trigger()) + return 0; + + /* init XOSC32 to detect 32k clock stop */ + rtc_read(RTC_CON, &con); + con |= RTC_CON_XOSC32_LPEN; + + if (!rtc_lpen(con)) + return 0; + + /* init EOSC32 to detect rtc low power */ + rtc_read(RTC_CON, &con); + con |= RTC_CON_EOSC32_LPEN; + + if (!rtc_lpen(con)) + return 0; + + rtc_read(RTC_CON, &con); + con &= ~RTC_CON_XOSC32_LPEN; + rtc_write(RTC_CON, con); + /*Enable RTC_LPD_OPT: EOSC LPD*/ + rtc_read(RTC_AL_SEC, &sec); + sec &= ~RTC_LPD_OPT_MASK; + sec |= RTC_LPD_OPT_EOSC_LPD; + rtc_write(RTC_AL_SEC, sec); + + if (!rtc_write_trigger()) + return 0; + + return 1; +} + +static bool rtc_hw_init(void) +{ + u16 bbpu; + + rtc_read(RTC_BBPU, &bbpu); + rtc_write(RTC_BBPU, (bbpu | RTC_BBPU_KEY | RTC_BBPU_RESET_ALARM | RTC_BBPU_RESET_SPAR) & (~RTC_BBPU_SPAR_SW)); + rtc_write_trigger(); + udelay(500); + + rtc_read(RTC_BBPU, &bbpu); + rtc_write(RTC_BBPU, bbpu | RTC_BBPU_KEY | RTC_BBPU_RELOAD); + rtc_write_trigger(); + rtc_read(RTC_BBPU, &bbpu); + + if (bbpu & RTC_BBPU_RESET_ALARM || bbpu & RTC_BBPU_RESET_SPAR) { + rtc_info("timeout\n"); + return false; + } + return true; +} + +/* write powerkeys to enable rtc functions */ +static int rtc_powerkey_init(void) +{ + rtc_write(RTC_POWERKEY1, RTC_POWERKEY1_KEY); + rtc_write(RTC_POWERKEY2, RTC_POWERKEY2_KEY); + return rtc_write_trigger(); +} + +/* rtc init check */ +int rtc_init(u8 recover) +{ + int ret; + + rtc_info("recovery: %d\n", recover); + + /* write powerkeys to enable rtc functions */ + if (!rtc_powerkey_init()) { + ret = -RTC_STATUS_POWERKEY_INIT_FAIL; + goto err; + } + + /* write interface unlock need to be set after powerkey match */ + if (!rtc_writeif_unlock()) { + ret = -RTC_STATUS_WRITEIF_UNLOCK_FAIL; + goto err; + } + + //rtc_osc_init(); + + if (recover) + mdelay(20); + + if (!rtc_gpio_init()) { + ret = -RTC_STATUS_GPIO_INIT_FAIL; + goto err; + } + + if (!rtc_hw_init()) { + ret = -RTC_STATUS_HW_INIT_FAIL; + goto err; + } + + if (!rtc_reg_init()) { + ret = -RTC_STATUS_REG_INIT_FAIL; + goto err; + } + + if (!rtc_lpd_init()) { + ret = -RTC_STATUS_LPD_INIT_FAIL; + goto err; + } + /* After lpd init, powerkeys need to be written again to enable + * low power detect function. + */ + if (!rtc_powerkey_init()) { + ret = -RTC_STATUS_POWERKEY_INIT_FAIL; + goto err; + } + return RTC_STATUS_OK; +err: + rtc_info("init fail: ret=%d\n", ret); + return ret; +} + +/* enable rtc bbpu */ +void rtc_bbpu_power_on(void) +{ + u16 bbpu; + int ret; + + /* pull powerhold high, control by pmic */ + rtc_write_field(PMIC_PWRHOLD, 1, 0x1, 0); + bbpu = RTC_BBPU_KEY | RTC_BBPU_ENABLE_ALARM; + rtc_write(RTC_BBPU, bbpu); + ret = rtc_write_trigger(); + rtc_info("rtc_write_trigger=%d\n", ret); + rtc_read(RTC_BBPU, &bbpu); + rtc_info("done BBPU=%#x\n", bbpu); +} + +void poweroff(void) +{ + u16 bbpu; + + if (!rtc_writeif_unlock()) + rtc_info("rtc_writeif_unlock() failed\n"); + /* pull PWRBB low */ + bbpu = RTC_BBPU_KEY | RTC_BBPU_ENABLE_ALARM; + rtc_write(RTC_BBPU, bbpu); + rtc_write_field(PMIC_PWRHOLD, 0, 0x1, 0); + halt(); +} + +static void dcxo_init(void) +{ + u16 tmp; + + rtc_read(PMIC_RG_DCXO_CW00, &tmp); + rtc_info("CW00,0x%x:0x%x\n", PMIC_RG_DCXO_CW00, tmp); + rtc_read(PMIC_RG_DCXO_CW09, &tmp); + rtc_info("CW09,0x%x:0x%x\n", PMIC_RG_DCXO_CW09, tmp); + rtc_read(PMIC_RG_DCXO_CW08, &tmp); + rtc_info("CW08,0x%x:0x%x\n", PMIC_RG_DCXO_CW08, tmp); + /* 26M enable control */ + /* Enable clock buffer XO_SOC */ + rtc_write_field(PMIC_RG_DCXO_CW00, 0x4005, 0xFFFF, 0); + rtc_read(PMIC_RG_DCXO_CW00, &tmp); + rtc_info("CW0,0x%x:0x%x\n", PMIC_RG_DCXO_CW00, tmp); + rtc_write_field(PMIC_RG_DCXO_CW09_CLR, 0x3f, 0x3f, 9); + rtc_read(PMIC_RG_DCXO_CW09, &tmp); + rtc_info("PMIC_RG_DCXO_CW09,0x%x:0x%x\n", PMIC_RG_DCXO_CW09, tmp); + /* Mode and buffer controlled by srclken0 */ + rtc_write_field(PMIC_RG_DCXO_CW08, 0x1, 0x1, 2); + rtc_read(PMIC_RG_DCXO_CW08, &tmp); + rtc_info("PMIC_RG_DCXO_CW08,0x%x:0x%x\n", PMIC_RG_DCXO_CW08, tmp); +} + +void mt6359_dcxo_disable_unused(void) +{ + /* Disable HW BBLPM arbiter */ + //rtc_write_field(PMIC_RG_DCXO_CW12, 0x0, 0x1, 0); + rtc_write_field(PMIC_RG_DCXO_CW12, 0x2, 0x3, 0); +} + +/* the rtc boot flow entry */ +void rtc_boot(void) +{ + u16 tmp; + + /* dcxo clock init settings */ + dcxo_init(); + /* dcxo 32k init settings */ + rtc_write_field(PMIC_RG_DCXO_CW02, 0xF, 0xF, 0); + rtc_read(PMIC_RG_SCK_TOP_CON0, &tmp); + rtc_info("PMIC_RG_SCK_TOP_CON0,0x%x:0x%x\n", PMIC_RG_SCK_TOP_CON0, tmp); + rtc_write_field(PMIC_RG_SCK_TOP_CON0, 0x1, 0x1, 0); + rtc_read(PMIC_RG_SCK_TOP_CON0, &tmp); + rtc_info("PMIC_RG_SCK_TOP_CON0,0x%x:0x%x\n", PMIC_RG_SCK_TOP_CON0, tmp); + /* use dcxo 32K clock */ + if (!rtc_enable_dcxo()) + rtc_info("rtc_enable_dcxo() failed\n"); + rtc_boot_common(); + rtc_bbpu_power_on(); +} +
build bot (Jenkins) has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/46395 )
Change subject: soc/mediatek/mt8192: add rtc MT6359P driver ......................................................................
Patch Set 1:
(1 comment)
https://review.coreboot.org/c/coreboot/+/46395/1/src/soc/mediatek/mt8192/rtc... File src/soc/mediatek/mt8192/rtc.c:
https://review.coreboot.org/c/coreboot/+/46395/1/src/soc/mediatek/mt8192/rtc... PS1, Line 307: rtc_write(RTC_BBPU, (bbpu | RTC_BBPU_KEY | RTC_BBPU_RESET_ALARM | RTC_BBPU_RESET_SPAR) & (~RTC_BBPU_SPAR_SW)); line over 96 characters
HAOUAS Elyes has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/46395 )
Change subject: soc/mediatek/mt8192: add rtc MT6359P driver ......................................................................
Patch Set 1:
(2 comments)
https://review.coreboot.org/c/coreboot/+/46395/1/src/soc/mediatek/mt8192/inc... File src/soc/mediatek/mt8192/include/soc/rtc.h:
https://review.coreboot.org/c/coreboot/+/46395/1/src/soc/mediatek/mt8192/inc... PS1, Line 1: /* : * This file is part of the coreboot project. : * : * Copyright 2018 MediaTek Inc. : * : * This program is free software; you can redistribute it and/or modify : * it under the terms of the GNU General Public License as published by : * the Free Software Foundation; version 2 of the License. : * : * This program is distributed in the hope that it will be useful, : * but WITHOUT ANY WARRANTY; without even the implied warranty of : * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the : * GNU General Public License for more details. : */ SPDX ....
https://review.coreboot.org/c/coreboot/+/46395/1/src/soc/mediatek/mt8192/rtc... File src/soc/mediatek/mt8192/rtc.c:
https://review.coreboot.org/c/coreboot/+/46395/1/src/soc/mediatek/mt8192/rtc... PS1, Line 1: /* : * This file is part of the coreboot project. : * : * Copyright 2018 MediaTek Inc. : * : * This program is free software; you can redistribute it and/or modify : * it under the terms of the GNU General Public License as published by : * the Free Software Foundation; version 2 of the License. : * : * This program is distributed in the hope that it will be useful, : * but WITHOUT ANY WARRANTY; without even the implied warranty of : * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the : * GNU General Public License for more details. : */ SPDX...
build bot (Jenkins) has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/46395 )
Change subject: soc/mediatek/mt8192: add rtc MT6359P driver ......................................................................
Patch Set 2:
(1 comment)
https://review.coreboot.org/c/coreboot/+/46395/2/src/soc/mediatek/mt8192/rtc... File src/soc/mediatek/mt8192/rtc.c:
https://review.coreboot.org/c/coreboot/+/46395/2/src/soc/mediatek/mt8192/rtc... PS2, Line 307: rtc_write(RTC_BBPU, (bbpu | RTC_BBPU_KEY | RTC_BBPU_RESET_ALARM | RTC_BBPU_RESET_SPAR) & (~RTC_BBPU_SPAR_SW)); line over 96 characters
build bot (Jenkins) has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/46395 )
Change subject: soc/mediatek/mt8192: add rtc MT6359P driver ......................................................................
Patch Set 3:
(1 comment)
https://review.coreboot.org/c/coreboot/+/46395/3/src/soc/mediatek/mt8192/rtc... File src/soc/mediatek/mt8192/rtc.c:
https://review.coreboot.org/c/coreboot/+/46395/3/src/soc/mediatek/mt8192/rtc... PS3, Line 307: rtc_write(RTC_BBPU, (bbpu | RTC_BBPU_KEY | RTC_BBPU_RESET_ALARM | RTC_BBPU_RESET_SPAR) & (~RTC_BBPU_SPAR_SW)); line over 96 characters
build bot (Jenkins) has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/46395 )
Change subject: soc/mediatek/mt8192: add rtc MT6359P driver ......................................................................
Patch Set 4:
(1 comment)
https://review.coreboot.org/c/coreboot/+/46395/4/src/soc/mediatek/mt8192/rtc... File src/soc/mediatek/mt8192/rtc.c:
https://review.coreboot.org/c/coreboot/+/46395/4/src/soc/mediatek/mt8192/rtc... PS4, Line 307: rtc_write(RTC_BBPU, (bbpu | RTC_BBPU_KEY | RTC_BBPU_RESET_ALARM | RTC_BBPU_RESET_SPAR) & (~RTC_BBPU_SPAR_SW)); line over 96 characters
Paul Menzel has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/46395 )
Change subject: soc/mediatek/mt8192: add rtc MT6359P driver ......................................................................
Patch Set 4:
(9 comments)
https://review.coreboot.org/c/coreboot/+/46395/4//COMMIT_MSG Commit Message:
https://review.coreboot.org/c/coreboot/+/46395/4//COMMIT_MSG@9 PS4, Line 9: Add rtc MT6359P driver. Please elaborate and add the datasheet name an revision.
https://review.coreboot.org/c/coreboot/+/46395/4//COMMIT_MSG@10 PS4, Line 10: Why can’t more common code be used?
https://review.coreboot.org/c/coreboot/+/46395/4/src/soc/mediatek/mt8192/rtc... File src/soc/mediatek/mt8192/rtc.c:
https://review.coreboot.org/c/coreboot/+/46395/4/src/soc/mediatek/mt8192/rtc... PS4, Line 31: pmif_arb->read_cmd Why isn’t data of type `void`?
https://review.coreboot.org/c/coreboot/+/46395/4/src/soc/mediatek/mt8192/rtc... PS4, Line 51: dcxo clock What is dcxo?
https://review.coreboot.org/c/coreboot/+/46395/4/src/soc/mediatek/mt8192/rtc... PS4, Line 350: //rtc_osc_init(); Why?
https://review.coreboot.org/c/coreboot/+/46395/4/src/soc/mediatek/mt8192/rtc... PS4, Line 353: mdelay(20); Please add a comment why 20 ms delay is needed.
https://review.coreboot.org/c/coreboot/+/46395/4/src/soc/mediatek/mt8192/rtc... PS4, Line 376: */ Please use one of the recommended styles [1].
https://doc.coreboot.org/coding_style.html#commenting
https://review.coreboot.org/c/coreboot/+/46395/4/src/soc/mediatek/mt8192/rtc... PS4, Line 387: bbpu What is that?
https://review.coreboot.org/c/coreboot/+/46395/4/src/soc/mediatek/mt8192/rtc... PS4, Line 443: //rtc_write_field(PMIC_RG_DCXO_CW12, 0x0, 0x1, 0); Why is this commented out?
build bot (Jenkins) has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/46395 )
Change subject: soc/mediatek/mt8192: add rtc MT6359P driver ......................................................................
Patch Set 5:
(1 comment)
https://review.coreboot.org/c/coreboot/+/46395/5/src/soc/mediatek/mt8192/rtc... File src/soc/mediatek/mt8192/rtc.c:
https://review.coreboot.org/c/coreboot/+/46395/5/src/soc/mediatek/mt8192/rtc... PS5, Line 307: rtc_write(RTC_BBPU, (bbpu | RTC_BBPU_KEY | RTC_BBPU_RESET_ALARM | RTC_BBPU_RESET_SPAR) & (~RTC_BBPU_SPAR_SW)); line over 96 characters
build bot (Jenkins) has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/46395 )
Change subject: soc/mediatek/mt8192: add rtc MT6359P driver ......................................................................
Patch Set 6:
(1 comment)
https://review.coreboot.org/c/coreboot/+/46395/6/src/soc/mediatek/mt8192/rtc... File src/soc/mediatek/mt8192/rtc.c:
https://review.coreboot.org/c/coreboot/+/46395/6/src/soc/mediatek/mt8192/rtc... PS6, Line 307: rtc_write(RTC_BBPU, (bbpu | RTC_BBPU_KEY | RTC_BBPU_RESET_ALARM | RTC_BBPU_RESET_SPAR) & (~RTC_BBPU_SPAR_SW)); line over 96 characters
build bot (Jenkins) has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/46395 )
Change subject: soc/mediatek/mt8192: add rtc MT6359P driver ......................................................................
Patch Set 7:
(1 comment)
https://review.coreboot.org/c/coreboot/+/46395/7/src/soc/mediatek/mt8192/rtc... File src/soc/mediatek/mt8192/rtc.c:
https://review.coreboot.org/c/coreboot/+/46395/7/src/soc/mediatek/mt8192/rtc... PS7, Line 307: rtc_write(RTC_BBPU, (bbpu | RTC_BBPU_KEY | RTC_BBPU_RESET_ALARM | RTC_BBPU_RESET_SPAR) & (~RTC_BBPU_SPAR_SW)); line over 96 characters
build bot (Jenkins) has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/46395 )
Change subject: soc/mediatek/mt8192: add rtc MT6359P driver ......................................................................
Patch Set 8:
(1 comment)
https://review.coreboot.org/c/coreboot/+/46395/8/src/soc/mediatek/mt8192/rtc... File src/soc/mediatek/mt8192/rtc.c:
https://review.coreboot.org/c/coreboot/+/46395/8/src/soc/mediatek/mt8192/rtc... PS8, Line 307: rtc_write(RTC_BBPU, (bbpu | RTC_BBPU_KEY | RTC_BBPU_RESET_ALARM | RTC_BBPU_RESET_SPAR) & (~RTC_BBPU_SPAR_SW)); line over 96 characters
build bot (Jenkins) has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/46395 )
Change subject: soc/mediatek/mt8192: add rtc MT6359P driver ......................................................................
Patch Set 9:
(1 comment)
https://review.coreboot.org/c/coreboot/+/46395/9/src/soc/mediatek/mt8192/rtc... File src/soc/mediatek/mt8192/rtc.c:
https://review.coreboot.org/c/coreboot/+/46395/9/src/soc/mediatek/mt8192/rtc... PS9, Line 307: rtc_write(RTC_BBPU, (bbpu | RTC_BBPU_KEY | RTC_BBPU_RESET_ALARM | RTC_BBPU_RESET_SPAR) & (~RTC_BBPU_SPAR_SW)); line over 96 characters
build bot (Jenkins) has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/46395 )
Change subject: soc/mediatek/mt8192: add rtc MT6359P driver ......................................................................
Patch Set 10:
(1 comment)
https://review.coreboot.org/c/coreboot/+/46395/10/src/soc/mediatek/mt8192/rt... File src/soc/mediatek/mt8192/rtc.c:
https://review.coreboot.org/c/coreboot/+/46395/10/src/soc/mediatek/mt8192/rt... PS10, Line 307: rtc_write(RTC_BBPU, (bbpu | RTC_BBPU_KEY | RTC_BBPU_RESET_ALARM | RTC_BBPU_RESET_SPAR) & (~RTC_BBPU_SPAR_SW)); line over 96 characters
build bot (Jenkins) has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/46395 )
Change subject: soc/mediatek/mt8192: add rtc MT6359P driver ......................................................................
Patch Set 12:
(1 comment)
https://review.coreboot.org/c/coreboot/+/46395/12/src/soc/mediatek/mt8192/rt... File src/soc/mediatek/mt8192/rtc.c:
https://review.coreboot.org/c/coreboot/+/46395/12/src/soc/mediatek/mt8192/rt... PS12, Line 307: rtc_write(RTC_BBPU, (bbpu | RTC_BBPU_KEY | RTC_BBPU_RESET_ALARM | RTC_BBPU_RESET_SPAR) & (~RTC_BBPU_SPAR_SW)); line over 96 characters
build bot (Jenkins) has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/46395 )
Change subject: soc/mediatek/mt8192: add rtc MT6359P driver ......................................................................
Patch Set 13:
(1 comment)
https://review.coreboot.org/c/coreboot/+/46395/13/src/soc/mediatek/mt8192/rt... File src/soc/mediatek/mt8192/rtc.c:
https://review.coreboot.org/c/coreboot/+/46395/13/src/soc/mediatek/mt8192/rt... PS13, Line 307: rtc_write(RTC_BBPU, (bbpu | RTC_BBPU_KEY | RTC_BBPU_RESET_ALARM | RTC_BBPU_RESET_SPAR) & (~RTC_BBPU_SPAR_SW)); line over 96 characters
build bot (Jenkins) has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/46395 )
Change subject: soc/mediatek/mt8192: add rtc MT6359P driver ......................................................................
Patch Set 14:
(1 comment)
https://review.coreboot.org/c/coreboot/+/46395/14/src/soc/mediatek/mt8192/rt... File src/soc/mediatek/mt8192/rtc.c:
https://review.coreboot.org/c/coreboot/+/46395/14/src/soc/mediatek/mt8192/rt... PS14, Line 307: rtc_write(RTC_BBPU, (bbpu | RTC_BBPU_KEY | RTC_BBPU_RESET_ALARM | RTC_BBPU_RESET_SPAR) & (~RTC_BBPU_SPAR_SW)); line over 96 characters
build bot (Jenkins) has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/46395 )
Change subject: soc/mediatek/mt8192: add rtc MT6359P driver ......................................................................
Patch Set 15:
(1 comment)
https://review.coreboot.org/c/coreboot/+/46395/15/src/soc/mediatek/mt8192/rt... File src/soc/mediatek/mt8192/rtc.c:
https://review.coreboot.org/c/coreboot/+/46395/15/src/soc/mediatek/mt8192/rt... PS15, Line 307: rtc_write(RTC_BBPU, (bbpu | RTC_BBPU_KEY | RTC_BBPU_RESET_ALARM | RTC_BBPU_RESET_SPAR) & (~RTC_BBPU_SPAR_SW)); line over 96 characters
build bot (Jenkins) has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/46395 )
Change subject: soc/mediatek/mt8192: add rtc MT6359P driver ......................................................................
Patch Set 16:
(1 comment)
https://review.coreboot.org/c/coreboot/+/46395/16/src/soc/mediatek/mt8192/rt... File src/soc/mediatek/mt8192/rtc.c:
https://review.coreboot.org/c/coreboot/+/46395/16/src/soc/mediatek/mt8192/rt... PS16, Line 307: rtc_write(RTC_BBPU, (bbpu | RTC_BBPU_KEY | RTC_BBPU_RESET_ALARM | RTC_BBPU_RESET_SPAR) & (~RTC_BBPU_SPAR_SW)); line over 96 characters
build bot (Jenkins) has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/46395 )
Change subject: soc/mediatek/mt8192: add rtc MT6359P driver ......................................................................
Patch Set 17:
(1 comment)
https://review.coreboot.org/c/coreboot/+/46395/17/src/soc/mediatek/mt8192/rt... File src/soc/mediatek/mt8192/rtc.c:
https://review.coreboot.org/c/coreboot/+/46395/17/src/soc/mediatek/mt8192/rt... PS17, Line 307: rtc_write(RTC_BBPU, (bbpu | RTC_BBPU_KEY | RTC_BBPU_RESET_ALARM | RTC_BBPU_RESET_SPAR) & (~RTC_BBPU_SPAR_SW)); line over 96 characters
Hello build bot (Jenkins), Patrick Georgi, Martin Roth, YuCheng Hung, Yuchen Huang,
I'd like you to reexamine a change. Please visit
https://review.coreboot.org/c/coreboot/+/46395
to look at the new patch set (#18).
Change subject: soc/mediatek/mt8192: add rtc MT6359P driver ......................................................................
soc/mediatek/mt8192: add rtc MT6359P driver
Add rtc MT6359P driver.
TEST=boot asurada
Signed-off-by: Yuchen Huang yuchen.huang@mediatek.corp-partner.google.com Change-Id: I57d6738fdec148c7458b2024a0a8225415ca2f3e --- M src/soc/mediatek/common/include/soc/rtc_common.h M src/soc/mediatek/common/rtc.c M src/soc/mediatek/mt8192/Makefile.inc M src/soc/mediatek/mt8192/bootblock.c A src/soc/mediatek/mt8192/include/soc/rtc.h A src/soc/mediatek/mt8192/rtc.c 6 files changed, 734 insertions(+), 28 deletions(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/95/46395/18
build bot (Jenkins) has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/46395 )
Change subject: soc/mediatek/mt8192: add rtc MT6359P driver ......................................................................
Patch Set 18:
(9 comments)
https://review.coreboot.org/c/coreboot/+/46395/18/src/soc/mediatek/mt8192/in... File src/soc/mediatek/mt8192/include/soc/rtc.h:
https://review.coreboot.org/c/coreboot/+/46395/18/src/soc/mediatek/mt8192/in... PS18, Line 113: RTC_GP_OSC32_CON = 2U << 13, /* Keep RG_EOSC_RSV[0] to low for lower leakage current hw design change */ line over 96 characters
https://review.coreboot.org/c/coreboot/+/46395/18/src/soc/mediatek/mt8192/in... PS18, Line 118: OSC32CON_ANALOG_SETTING = RTC_GP_OSC32_CON | RTC_EOSC32_CHOP_EN | RTC_EOSC32_VCT_EN |\ Avoid unnecessary line continuations
https://review.coreboot.org/c/coreboot/+/46395/18/src/soc/mediatek/mt8192/in... PS18, Line 119: RTC_GPS_CKOUT_EN | RTC_EMBCK_SEL_OPTION | RTC_EMB_K_EOSC32_MODE line over 96 characters
https://review.coreboot.org/c/coreboot/+/46395/18/src/soc/mediatek/mt8192/rt... File src/soc/mediatek/mt8192/rtc.c:
https://review.coreboot.org/c/coreboot/+/46395/18/src/soc/mediatek/mt8192/rt... PS18, Line 190: if (middle == left) { braces {} are not necessary for single statement blocks
https://review.coreboot.org/c/coreboot/+/46395/18/src/soc/mediatek/mt8192/rt... PS18, Line 195: if (val >= RTC_FQMTR_LOW_BASE && val <= RTC_FQMTR_HIGH_BASE) { braces {} are not necessary for single statement blocks
https://review.coreboot.org/c/coreboot/+/46395/18/src/soc/mediatek/mt8192/rt... PS18, Line 198: if (val > RTC_FQMTR_HIGH_BASE) { braces {} are not necessary for any arm of this statement
https://review.coreboot.org/c/coreboot/+/46395/18/src/soc/mediatek/mt8192/rt... PS18, Line 201: else { else should follow close brace '}'
https://review.coreboot.org/c/coreboot/+/46395/18/src/soc/mediatek/mt8192/rt... PS18, Line 316: rtc_write(RTC_BBPU, (bbpu | RTC_BBPU_KEY | RTC_BBPU_RESET_ALARM | RTC_BBPU_RESET_SPAR) & (~RTC_BBPU_SPAR_SW)); line over 96 characters
https://review.coreboot.org/c/coreboot/+/46395/18/src/soc/mediatek/mt8192/rt... PS18, Line 382: rtc_write(RTC_AL_YEA, (year | RTC_K_EOSC_RSV_0) & (~RTC_K_EOSC_RSV_1) & (~RTC_K_EOSC_RSV_2)); line over 96 characters
Hello build bot (Jenkins), Patrick Georgi, Martin Roth, YuCheng Hung, Yuchen Huang,
I'd like you to reexamine a change. Please visit
https://review.coreboot.org/c/coreboot/+/46395
to look at the new patch set (#19).
Change subject: soc/mediatek/mt8192: add rtc MT6359P driver ......................................................................
soc/mediatek/mt8192: add rtc MT6359P driver
Add rtc MT6359P driver.
TEST=boot asurada
Signed-off-by: Yuchen Huang yuchen.huang@mediatek.corp-partner.google.com Change-Id: I57d6738fdec148c7458b2024a0a8225415ca2f3e --- M src/soc/mediatek/common/include/soc/rtc_common.h M src/soc/mediatek/common/rtc.c M src/soc/mediatek/mt8192/Makefile.inc M src/soc/mediatek/mt8192/bootblock.c A src/soc/mediatek/mt8192/include/soc/rtc.h A src/soc/mediatek/mt8192/rtc.c 6 files changed, 734 insertions(+), 28 deletions(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/95/46395/19
build bot (Jenkins) has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/46395 )
Change subject: soc/mediatek/mt8192: add rtc MT6359P driver ......................................................................
Patch Set 19:
(9 comments)
https://review.coreboot.org/c/coreboot/+/46395/19/src/soc/mediatek/mt8192/in... File src/soc/mediatek/mt8192/include/soc/rtc.h:
https://review.coreboot.org/c/coreboot/+/46395/19/src/soc/mediatek/mt8192/in... PS19, Line 113: RTC_GP_OSC32_CON = 2U << 13, /* Keep RG_EOSC_RSV[0] to low for lower leakage current hw design change */ line over 96 characters
https://review.coreboot.org/c/coreboot/+/46395/19/src/soc/mediatek/mt8192/in... PS19, Line 118: OSC32CON_ANALOG_SETTING = RTC_GP_OSC32_CON | RTC_EOSC32_CHOP_EN | RTC_EOSC32_VCT_EN |\ Avoid unnecessary line continuations
https://review.coreboot.org/c/coreboot/+/46395/19/src/soc/mediatek/mt8192/in... PS19, Line 119: RTC_GPS_CKOUT_EN | RTC_EMBCK_SEL_OPTION | RTC_EMB_K_EOSC32_MODE line over 96 characters
https://review.coreboot.org/c/coreboot/+/46395/19/src/soc/mediatek/mt8192/rt... File src/soc/mediatek/mt8192/rtc.c:
https://review.coreboot.org/c/coreboot/+/46395/19/src/soc/mediatek/mt8192/rt... PS19, Line 190: if (middle == left) { braces {} are not necessary for single statement blocks
https://review.coreboot.org/c/coreboot/+/46395/19/src/soc/mediatek/mt8192/rt... PS19, Line 195: if (val >= RTC_FQMTR_LOW_BASE && val <= RTC_FQMTR_HIGH_BASE) { braces {} are not necessary for single statement blocks
https://review.coreboot.org/c/coreboot/+/46395/19/src/soc/mediatek/mt8192/rt... PS19, Line 198: if (val > RTC_FQMTR_HIGH_BASE) { braces {} are not necessary for any arm of this statement
https://review.coreboot.org/c/coreboot/+/46395/19/src/soc/mediatek/mt8192/rt... PS19, Line 201: else { else should follow close brace '}'
https://review.coreboot.org/c/coreboot/+/46395/19/src/soc/mediatek/mt8192/rt... PS19, Line 316: rtc_write(RTC_BBPU, (bbpu | RTC_BBPU_KEY | RTC_BBPU_RESET_ALARM | RTC_BBPU_RESET_SPAR) & (~RTC_BBPU_SPAR_SW)); line over 96 characters
https://review.coreboot.org/c/coreboot/+/46395/19/src/soc/mediatek/mt8192/rt... PS19, Line 382: rtc_write(RTC_AL_YEA, (year | RTC_K_EOSC_RSV_0) & (~RTC_K_EOSC_RSV_1) & (~RTC_K_EOSC_RSV_2)); line over 96 characters
build bot (Jenkins) has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/46395 )
Change subject: soc/mediatek/mt8192: add rtc MT6359P driver ......................................................................
Patch Set 20:
(9 comments)
https://review.coreboot.org/c/coreboot/+/46395/20/src/soc/mediatek/mt8192/in... File src/soc/mediatek/mt8192/include/soc/rtc.h:
https://review.coreboot.org/c/coreboot/+/46395/20/src/soc/mediatek/mt8192/in... PS20, Line 113: RTC_GP_OSC32_CON = 2U << 13, /* Keep RG_EOSC_RSV[0] to low for lower leakage current hw design change */ line over 96 characters
https://review.coreboot.org/c/coreboot/+/46395/20/src/soc/mediatek/mt8192/in... PS20, Line 118: OSC32CON_ANALOG_SETTING = RTC_GP_OSC32_CON | RTC_EOSC32_CHOP_EN | RTC_EOSC32_VCT_EN |\ Avoid unnecessary line continuations
https://review.coreboot.org/c/coreboot/+/46395/20/src/soc/mediatek/mt8192/in... PS20, Line 119: RTC_GPS_CKOUT_EN | RTC_EMBCK_SEL_OPTION | RTC_EMB_K_EOSC32_MODE line over 96 characters
https://review.coreboot.org/c/coreboot/+/46395/20/src/soc/mediatek/mt8192/rt... File src/soc/mediatek/mt8192/rtc.c:
https://review.coreboot.org/c/coreboot/+/46395/20/src/soc/mediatek/mt8192/rt... PS20, Line 190: if (middle == left) { braces {} are not necessary for single statement blocks
https://review.coreboot.org/c/coreboot/+/46395/20/src/soc/mediatek/mt8192/rt... PS20, Line 195: if (val >= RTC_FQMTR_LOW_BASE && val <= RTC_FQMTR_HIGH_BASE) { braces {} are not necessary for single statement blocks
https://review.coreboot.org/c/coreboot/+/46395/20/src/soc/mediatek/mt8192/rt... PS20, Line 198: if (val > RTC_FQMTR_HIGH_BASE) { braces {} are not necessary for any arm of this statement
https://review.coreboot.org/c/coreboot/+/46395/20/src/soc/mediatek/mt8192/rt... PS20, Line 201: else { else should follow close brace '}'
https://review.coreboot.org/c/coreboot/+/46395/20/src/soc/mediatek/mt8192/rt... PS20, Line 316: rtc_write(RTC_BBPU, (bbpu | RTC_BBPU_KEY | RTC_BBPU_RESET_ALARM | RTC_BBPU_RESET_SPAR) & (~RTC_BBPU_SPAR_SW)); line over 96 characters
https://review.coreboot.org/c/coreboot/+/46395/20/src/soc/mediatek/mt8192/rt... PS20, Line 382: rtc_write(RTC_AL_YEA, (year | RTC_K_EOSC_RSV_0) & (~RTC_K_EOSC_RSV_1) & (~RTC_K_EOSC_RSV_2)); line over 96 characters
Hello build bot (Jenkins), Patrick Georgi, Martin Roth, YuCheng Hung, Yuchen Huang,
I'd like you to reexamine a change. Please visit
https://review.coreboot.org/c/coreboot/+/46395
to look at the new patch set (#22).
Change subject: soc/mediatek/mt8192: add rtc MT6359P driver ......................................................................
soc/mediatek/mt8192: add rtc MT6359P driver
Add rtc MT6359P driver.
TEST=boot asurada
Signed-off-by: Yuchen Huang yuchen.huang@mediatek.corp-partner.google.com Change-Id: I57d6738fdec148c7458b2024a0a8225415ca2f3e --- M src/soc/mediatek/common/include/soc/rtc_common.h M src/soc/mediatek/common/rtc.c M src/soc/mediatek/mt8192/Makefile.inc M src/soc/mediatek/mt8192/bootblock.c A src/soc/mediatek/mt8192/include/soc/rtc.h A src/soc/mediatek/mt8192/rtc.c 6 files changed, 734 insertions(+), 28 deletions(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/95/46395/22
build bot (Jenkins) has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/46395 )
Change subject: soc/mediatek/mt8192: add rtc MT6359P driver ......................................................................
Patch Set 22:
(9 comments)
https://review.coreboot.org/c/coreboot/+/46395/22/src/soc/mediatek/mt8192/in... File src/soc/mediatek/mt8192/include/soc/rtc.h:
https://review.coreboot.org/c/coreboot/+/46395/22/src/soc/mediatek/mt8192/in... PS22, Line 113: RTC_GP_OSC32_CON = 2U << 13, /* Keep RG_EOSC_RSV[0] to low for lower leakage current hw design change */ line over 96 characters
https://review.coreboot.org/c/coreboot/+/46395/22/src/soc/mediatek/mt8192/in... PS22, Line 118: OSC32CON_ANALOG_SETTING = RTC_GP_OSC32_CON | RTC_EOSC32_CHOP_EN | RTC_EOSC32_VCT_EN |\ Avoid unnecessary line continuations
https://review.coreboot.org/c/coreboot/+/46395/22/src/soc/mediatek/mt8192/in... PS22, Line 119: RTC_GPS_CKOUT_EN | RTC_EMBCK_SEL_OPTION | RTC_EMB_K_EOSC32_MODE line over 96 characters
https://review.coreboot.org/c/coreboot/+/46395/22/src/soc/mediatek/mt8192/rt... File src/soc/mediatek/mt8192/rtc.c:
https://review.coreboot.org/c/coreboot/+/46395/22/src/soc/mediatek/mt8192/rt... PS22, Line 190: if (middle == left) { braces {} are not necessary for single statement blocks
https://review.coreboot.org/c/coreboot/+/46395/22/src/soc/mediatek/mt8192/rt... PS22, Line 195: if (val >= RTC_FQMTR_LOW_BASE && val <= RTC_FQMTR_HIGH_BASE) { braces {} are not necessary for single statement blocks
https://review.coreboot.org/c/coreboot/+/46395/22/src/soc/mediatek/mt8192/rt... PS22, Line 198: if (val > RTC_FQMTR_HIGH_BASE) { braces {} are not necessary for any arm of this statement
https://review.coreboot.org/c/coreboot/+/46395/22/src/soc/mediatek/mt8192/rt... PS22, Line 201: else { else should follow close brace '}'
https://review.coreboot.org/c/coreboot/+/46395/22/src/soc/mediatek/mt8192/rt... PS22, Line 316: rtc_write(RTC_BBPU, (bbpu | RTC_BBPU_KEY | RTC_BBPU_RESET_ALARM | RTC_BBPU_RESET_SPAR) & (~RTC_BBPU_SPAR_SW)); line over 96 characters
https://review.coreboot.org/c/coreboot/+/46395/22/src/soc/mediatek/mt8192/rt... PS22, Line 382: rtc_write(RTC_AL_YEA, (year | RTC_K_EOSC_RSV_0) & (~RTC_K_EOSC_RSV_1) & (~RTC_K_EOSC_RSV_2)); line over 96 characters
build bot (Jenkins) has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/46395 )
Change subject: soc/mediatek/mt8192: add rtc MT6359P driver ......................................................................
Patch Set 25:
(9 comments)
https://review.coreboot.org/c/coreboot/+/46395/25/src/soc/mediatek/mt8192/in... File src/soc/mediatek/mt8192/include/soc/rtc.h:
https://review.coreboot.org/c/coreboot/+/46395/25/src/soc/mediatek/mt8192/in... PS25, Line 113: RTC_GP_OSC32_CON = 2U << 13, /* Keep RG_EOSC_RSV[0] to low for lower leakage current hw design change */ line over 96 characters
https://review.coreboot.org/c/coreboot/+/46395/25/src/soc/mediatek/mt8192/in... PS25, Line 118: OSC32CON_ANALOG_SETTING = RTC_GP_OSC32_CON | RTC_EOSC32_CHOP_EN | RTC_EOSC32_VCT_EN |\ Avoid unnecessary line continuations
https://review.coreboot.org/c/coreboot/+/46395/25/src/soc/mediatek/mt8192/in... PS25, Line 119: RTC_GPS_CKOUT_EN | RTC_EMBCK_SEL_OPTION | RTC_EMB_K_EOSC32_MODE line over 96 characters
https://review.coreboot.org/c/coreboot/+/46395/25/src/soc/mediatek/mt8192/rt... File src/soc/mediatek/mt8192/rtc.c:
https://review.coreboot.org/c/coreboot/+/46395/25/src/soc/mediatek/mt8192/rt... PS25, Line 190: if (middle == left) { braces {} are not necessary for single statement blocks
https://review.coreboot.org/c/coreboot/+/46395/25/src/soc/mediatek/mt8192/rt... PS25, Line 195: if (val >= RTC_FQMTR_LOW_BASE && val <= RTC_FQMTR_HIGH_BASE) { braces {} are not necessary for single statement blocks
https://review.coreboot.org/c/coreboot/+/46395/25/src/soc/mediatek/mt8192/rt... PS25, Line 198: if (val > RTC_FQMTR_HIGH_BASE) { braces {} are not necessary for any arm of this statement
https://review.coreboot.org/c/coreboot/+/46395/25/src/soc/mediatek/mt8192/rt... PS25, Line 201: else { else should follow close brace '}'
https://review.coreboot.org/c/coreboot/+/46395/25/src/soc/mediatek/mt8192/rt... PS25, Line 316: rtc_write(RTC_BBPU, (bbpu | RTC_BBPU_KEY | RTC_BBPU_RESET_ALARM | RTC_BBPU_RESET_SPAR) & (~RTC_BBPU_SPAR_SW)); line over 96 characters
https://review.coreboot.org/c/coreboot/+/46395/25/src/soc/mediatek/mt8192/rt... PS25, Line 382: rtc_write(RTC_AL_YEA, (year | RTC_K_EOSC_RSV_0) & (~RTC_K_EOSC_RSV_1) & (~RTC_K_EOSC_RSV_2)); line over 96 characters
build bot (Jenkins) has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/46395 )
Change subject: soc/mediatek/mt8192: add rtc MT6359P driver ......................................................................
Patch Set 26:
(9 comments)
https://review.coreboot.org/c/coreboot/+/46395/26/src/soc/mediatek/mt8192/in... File src/soc/mediatek/mt8192/include/soc/rtc.h:
https://review.coreboot.org/c/coreboot/+/46395/26/src/soc/mediatek/mt8192/in... PS26, Line 113: RTC_GP_OSC32_CON = 2U << 13, /* Keep RG_EOSC_RSV[0] to low for lower leakage current hw design change */ line over 96 characters
https://review.coreboot.org/c/coreboot/+/46395/26/src/soc/mediatek/mt8192/in... PS26, Line 118: OSC32CON_ANALOG_SETTING = RTC_GP_OSC32_CON | RTC_EOSC32_CHOP_EN | RTC_EOSC32_VCT_EN |\ Avoid unnecessary line continuations
https://review.coreboot.org/c/coreboot/+/46395/26/src/soc/mediatek/mt8192/in... PS26, Line 119: RTC_GPS_CKOUT_EN | RTC_EMBCK_SEL_OPTION | RTC_EMB_K_EOSC32_MODE line over 96 characters
https://review.coreboot.org/c/coreboot/+/46395/26/src/soc/mediatek/mt8192/rt... File src/soc/mediatek/mt8192/rtc.c:
https://review.coreboot.org/c/coreboot/+/46395/26/src/soc/mediatek/mt8192/rt... PS26, Line 190: if (middle == left) { braces {} are not necessary for single statement blocks
https://review.coreboot.org/c/coreboot/+/46395/26/src/soc/mediatek/mt8192/rt... PS26, Line 195: if (val >= RTC_FQMTR_LOW_BASE && val <= RTC_FQMTR_HIGH_BASE) { braces {} are not necessary for single statement blocks
https://review.coreboot.org/c/coreboot/+/46395/26/src/soc/mediatek/mt8192/rt... PS26, Line 198: if (val > RTC_FQMTR_HIGH_BASE) { braces {} are not necessary for any arm of this statement
https://review.coreboot.org/c/coreboot/+/46395/26/src/soc/mediatek/mt8192/rt... PS26, Line 201: else { else should follow close brace '}'
https://review.coreboot.org/c/coreboot/+/46395/26/src/soc/mediatek/mt8192/rt... PS26, Line 316: rtc_write(RTC_BBPU, (bbpu | RTC_BBPU_KEY | RTC_BBPU_RESET_ALARM | RTC_BBPU_RESET_SPAR) & (~RTC_BBPU_SPAR_SW)); line over 96 characters
https://review.coreboot.org/c/coreboot/+/46395/26/src/soc/mediatek/mt8192/rt... PS26, Line 382: rtc_write(RTC_AL_YEA, (year | RTC_K_EOSC_RSV_0) & (~RTC_K_EOSC_RSV_1) & (~RTC_K_EOSC_RSV_2)); line over 96 characters
build bot (Jenkins) has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/46395 )
Change subject: soc/mediatek/mt8192: add rtc MT6359P driver ......................................................................
Patch Set 28:
(9 comments)
https://review.coreboot.org/c/coreboot/+/46395/28/src/soc/mediatek/mt8192/in... File src/soc/mediatek/mt8192/include/soc/rtc.h:
https://review.coreboot.org/c/coreboot/+/46395/28/src/soc/mediatek/mt8192/in... PS28, Line 113: RTC_GP_OSC32_CON = 2U << 13, /* Keep RG_EOSC_RSV[0] to low for lower leakage current hw design change */ line over 96 characters
https://review.coreboot.org/c/coreboot/+/46395/28/src/soc/mediatek/mt8192/in... PS28, Line 118: OSC32CON_ANALOG_SETTING = RTC_GP_OSC32_CON | RTC_EOSC32_CHOP_EN | RTC_EOSC32_VCT_EN |\ Avoid unnecessary line continuations
https://review.coreboot.org/c/coreboot/+/46395/28/src/soc/mediatek/mt8192/in... PS28, Line 119: RTC_GPS_CKOUT_EN | RTC_EMBCK_SEL_OPTION | RTC_EMB_K_EOSC32_MODE line over 96 characters
https://review.coreboot.org/c/coreboot/+/46395/28/src/soc/mediatek/mt8192/rt... File src/soc/mediatek/mt8192/rtc.c:
https://review.coreboot.org/c/coreboot/+/46395/28/src/soc/mediatek/mt8192/rt... PS28, Line 190: if (middle == left) { braces {} are not necessary for single statement blocks
https://review.coreboot.org/c/coreboot/+/46395/28/src/soc/mediatek/mt8192/rt... PS28, Line 195: if (val >= RTC_FQMTR_LOW_BASE && val <= RTC_FQMTR_HIGH_BASE) { braces {} are not necessary for single statement blocks
https://review.coreboot.org/c/coreboot/+/46395/28/src/soc/mediatek/mt8192/rt... PS28, Line 198: if (val > RTC_FQMTR_HIGH_BASE) { braces {} are not necessary for any arm of this statement
https://review.coreboot.org/c/coreboot/+/46395/28/src/soc/mediatek/mt8192/rt... PS28, Line 201: else { else should follow close brace '}'
https://review.coreboot.org/c/coreboot/+/46395/28/src/soc/mediatek/mt8192/rt... PS28, Line 316: rtc_write(RTC_BBPU, (bbpu | RTC_BBPU_KEY | RTC_BBPU_RESET_ALARM | RTC_BBPU_RESET_SPAR) & (~RTC_BBPU_SPAR_SW)); line over 96 characters
https://review.coreboot.org/c/coreboot/+/46395/28/src/soc/mediatek/mt8192/rt... PS28, Line 382: rtc_write(RTC_AL_YEA, (year | RTC_K_EOSC_RSV_0) & (~RTC_K_EOSC_RSV_1) & (~RTC_K_EOSC_RSV_2)); line over 96 characters
build bot (Jenkins) has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/46395 )
Change subject: soc/mediatek/mt8192: add rtc MT6359P driver ......................................................................
Patch Set 29:
(9 comments)
https://review.coreboot.org/c/coreboot/+/46395/29/src/soc/mediatek/mt8192/in... File src/soc/mediatek/mt8192/include/soc/rtc.h:
https://review.coreboot.org/c/coreboot/+/46395/29/src/soc/mediatek/mt8192/in... PS29, Line 113: RTC_GP_OSC32_CON = 2U << 13, /* Keep RG_EOSC_RSV[0] to low for lower leakage current hw design change */ line over 96 characters
https://review.coreboot.org/c/coreboot/+/46395/29/src/soc/mediatek/mt8192/in... PS29, Line 118: OSC32CON_ANALOG_SETTING = RTC_GP_OSC32_CON | RTC_EOSC32_CHOP_EN | RTC_EOSC32_VCT_EN |\ Avoid unnecessary line continuations
https://review.coreboot.org/c/coreboot/+/46395/29/src/soc/mediatek/mt8192/in... PS29, Line 119: RTC_GPS_CKOUT_EN | RTC_EMBCK_SEL_OPTION | RTC_EMB_K_EOSC32_MODE line over 96 characters
https://review.coreboot.org/c/coreboot/+/46395/29/src/soc/mediatek/mt8192/rt... File src/soc/mediatek/mt8192/rtc.c:
https://review.coreboot.org/c/coreboot/+/46395/29/src/soc/mediatek/mt8192/rt... PS29, Line 190: if (middle == left) { braces {} are not necessary for single statement blocks
https://review.coreboot.org/c/coreboot/+/46395/29/src/soc/mediatek/mt8192/rt... PS29, Line 195: if (val >= RTC_FQMTR_LOW_BASE && val <= RTC_FQMTR_HIGH_BASE) { braces {} are not necessary for single statement blocks
https://review.coreboot.org/c/coreboot/+/46395/29/src/soc/mediatek/mt8192/rt... PS29, Line 198: if (val > RTC_FQMTR_HIGH_BASE) { braces {} are not necessary for any arm of this statement
https://review.coreboot.org/c/coreboot/+/46395/29/src/soc/mediatek/mt8192/rt... PS29, Line 201: else { else should follow close brace '}'
https://review.coreboot.org/c/coreboot/+/46395/29/src/soc/mediatek/mt8192/rt... PS29, Line 316: rtc_write(RTC_BBPU, (bbpu | RTC_BBPU_KEY | RTC_BBPU_RESET_ALARM | RTC_BBPU_RESET_SPAR) & (~RTC_BBPU_SPAR_SW)); line over 96 characters
https://review.coreboot.org/c/coreboot/+/46395/29/src/soc/mediatek/mt8192/rt... PS29, Line 382: rtc_write(RTC_AL_YEA, (year | RTC_K_EOSC_RSV_0) & (~RTC_K_EOSC_RSV_1) & (~RTC_K_EOSC_RSV_2)); line over 96 characters
build bot (Jenkins) has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/46395 )
Change subject: soc/mediatek/mt8192: add rtc MT6359P driver ......................................................................
Patch Set 30:
(9 comments)
https://review.coreboot.org/c/coreboot/+/46395/30/src/soc/mediatek/mt8192/in... File src/soc/mediatek/mt8192/include/soc/rtc.h:
https://review.coreboot.org/c/coreboot/+/46395/30/src/soc/mediatek/mt8192/in... PS30, Line 113: RTC_GP_OSC32_CON = 2U << 13, /* Keep RG_EOSC_RSV[0] to low for lower leakage current hw design change */ line over 96 characters
https://review.coreboot.org/c/coreboot/+/46395/30/src/soc/mediatek/mt8192/in... PS30, Line 118: OSC32CON_ANALOG_SETTING = RTC_GP_OSC32_CON | RTC_EOSC32_CHOP_EN | RTC_EOSC32_VCT_EN |\ Avoid unnecessary line continuations
https://review.coreboot.org/c/coreboot/+/46395/30/src/soc/mediatek/mt8192/in... PS30, Line 119: RTC_GPS_CKOUT_EN | RTC_EMBCK_SEL_OPTION | RTC_EMB_K_EOSC32_MODE line over 96 characters
https://review.coreboot.org/c/coreboot/+/46395/30/src/soc/mediatek/mt8192/rt... File src/soc/mediatek/mt8192/rtc.c:
https://review.coreboot.org/c/coreboot/+/46395/30/src/soc/mediatek/mt8192/rt... PS30, Line 190: if (middle == left) { braces {} are not necessary for single statement blocks
https://review.coreboot.org/c/coreboot/+/46395/30/src/soc/mediatek/mt8192/rt... PS30, Line 195: if (val >= RTC_FQMTR_LOW_BASE && val <= RTC_FQMTR_HIGH_BASE) { braces {} are not necessary for single statement blocks
https://review.coreboot.org/c/coreboot/+/46395/30/src/soc/mediatek/mt8192/rt... PS30, Line 198: if (val > RTC_FQMTR_HIGH_BASE) { braces {} are not necessary for any arm of this statement
https://review.coreboot.org/c/coreboot/+/46395/30/src/soc/mediatek/mt8192/rt... PS30, Line 201: else { else should follow close brace '}'
https://review.coreboot.org/c/coreboot/+/46395/30/src/soc/mediatek/mt8192/rt... PS30, Line 316: rtc_write(RTC_BBPU, (bbpu | RTC_BBPU_KEY | RTC_BBPU_RESET_ALARM | RTC_BBPU_RESET_SPAR) & (~RTC_BBPU_SPAR_SW)); line over 96 characters
https://review.coreboot.org/c/coreboot/+/46395/30/src/soc/mediatek/mt8192/rt... PS30, Line 382: rtc_write(RTC_AL_YEA, (year | RTC_K_EOSC_RSV_0) & (~RTC_K_EOSC_RSV_1) & (~RTC_K_EOSC_RSV_2)); line over 96 characters
Yu-Ping Wu has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/46395 )
Change subject: soc/mediatek/mt8192: add rtc MT6359P driver ......................................................................
Patch Set 30:
(2 comments)
https://review.coreboot.org/c/coreboot/+/46395/30/src/soc/mediatek/mt8192/in... File src/soc/mediatek/mt8192/include/soc/rtc.h:
https://review.coreboot.org/c/coreboot/+/46395/30/src/soc/mediatek/mt8192/in... PS30, Line 1: /* Wrong header.
https://review.coreboot.org/c/coreboot/+/46395/30/src/soc/mediatek/mt8192/rt... File src/soc/mediatek/mt8192/rtc.c:
https://review.coreboot.org/c/coreboot/+/46395/30/src/soc/mediatek/mt8192/rt... PS30, Line 1: /* Wrong header.
Hello build bot (Jenkins), Patrick Georgi, Martin Roth, YuCheng Hung, Yuchen Huang,
I'd like you to reexamine a change. Please visit
https://review.coreboot.org/c/coreboot/+/46395
to look at the new patch set (#31).
Change subject: soc/mediatek/mt8192: add rtc MT6359P driver ......................................................................
soc/mediatek/mt8192: add rtc MT6359P driver
Add rtc MT6359P driver.
TEST=boot asurada
Signed-off-by: Yuchen Huang yuchen.huang@mediatek.corp-partner.google.com Change-Id: I57d6738fdec148c7458b2024a0a8225415ca2f3e --- M src/soc/mediatek/common/include/soc/rtc_common.h M src/soc/mediatek/common/rtc.c M src/soc/mediatek/mt8192/Makefile.inc M src/soc/mediatek/mt8192/bootblock.c A src/soc/mediatek/mt8192/include/soc/rtc.h A src/soc/mediatek/mt8192/rtc.c 6 files changed, 710 insertions(+), 28 deletions(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/95/46395/31
Hello Hung-Te Lin, build bot (Jenkins), Patrick Georgi, Martin Roth, YuCheng Hung, Yuchen Huang,
I'd like you to reexamine a change. Please visit
https://review.coreboot.org/c/coreboot/+/46395
to look at the new patch set (#32).
Change subject: soc/mediatek/mt8192: add rtc MT6359P driver ......................................................................
soc/mediatek/mt8192: add rtc MT6359P driver
Add rtc MT6359P driver.
TEST=boot asurada
Signed-off-by: Yuchen Huang yuchen.huang@mediatek.corp-partner.google.com Change-Id: I57d6738fdec148c7458b2024a0a8225415ca2f3e --- M src/soc/mediatek/common/include/soc/rtc_common.h M src/soc/mediatek/common/rtc.c M src/soc/mediatek/mt8192/Makefile.inc M src/soc/mediatek/mt8192/bootblock.c A src/soc/mediatek/mt8192/include/soc/rtc.h A src/soc/mediatek/mt8192/rtc.c 6 files changed, 710 insertions(+), 28 deletions(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/95/46395/32
build bot (Jenkins) has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/46395 )
Change subject: soc/mediatek/mt8192: add rtc MT6359P driver ......................................................................
Patch Set 32:
(9 comments)
https://review.coreboot.org/c/coreboot/+/46395/32/src/soc/mediatek/mt8192/in... File src/soc/mediatek/mt8192/include/soc/rtc.h:
https://review.coreboot.org/c/coreboot/+/46395/32/src/soc/mediatek/mt8192/in... PS32, Line 101: RTC_GP_OSC32_CON = 2U << 13, /* Keep RG_EOSC_RSV[0] to low for lower leakage current hw design change */ line over 96 characters
https://review.coreboot.org/c/coreboot/+/46395/32/src/soc/mediatek/mt8192/in... PS32, Line 106: OSC32CON_ANALOG_SETTING = RTC_GP_OSC32_CON | RTC_EOSC32_CHOP_EN | RTC_EOSC32_VCT_EN |\ Avoid unnecessary line continuations
https://review.coreboot.org/c/coreboot/+/46395/32/src/soc/mediatek/mt8192/in... PS32, Line 107: RTC_GPS_CKOUT_EN | RTC_EMBCK_SEL_OPTION | RTC_EMB_K_EOSC32_MODE line over 96 characters
https://review.coreboot.org/c/coreboot/+/46395/32/src/soc/mediatek/mt8192/rt... File src/soc/mediatek/mt8192/rtc.c:
https://review.coreboot.org/c/coreboot/+/46395/32/src/soc/mediatek/mt8192/rt... PS32, Line 178: if (middle == left) { braces {} are not necessary for single statement blocks
https://review.coreboot.org/c/coreboot/+/46395/32/src/soc/mediatek/mt8192/rt... PS32, Line 183: if (val >= RTC_FQMTR_LOW_BASE && val <= RTC_FQMTR_HIGH_BASE) { braces {} are not necessary for single statement blocks
https://review.coreboot.org/c/coreboot/+/46395/32/src/soc/mediatek/mt8192/rt... PS32, Line 186: if (val > RTC_FQMTR_HIGH_BASE) { braces {} are not necessary for any arm of this statement
https://review.coreboot.org/c/coreboot/+/46395/32/src/soc/mediatek/mt8192/rt... PS32, Line 189: else { else should follow close brace '}'
https://review.coreboot.org/c/coreboot/+/46395/32/src/soc/mediatek/mt8192/rt... PS32, Line 304: rtc_write(RTC_BBPU, (bbpu | RTC_BBPU_KEY | RTC_BBPU_RESET_ALARM | RTC_BBPU_RESET_SPAR) & (~RTC_BBPU_SPAR_SW)); line over 96 characters
https://review.coreboot.org/c/coreboot/+/46395/32/src/soc/mediatek/mt8192/rt... PS32, Line 370: rtc_write(RTC_AL_YEA, (year | RTC_K_EOSC_RSV_0) & (~RTC_K_EOSC_RSV_1) & (~RTC_K_EOSC_RSV_2)); line over 96 characters
Hello Hung-Te Lin, build bot (Jenkins), Patrick Georgi, Martin Roth, YuCheng Hung, Yuchen Huang,
I'd like you to reexamine a change. Please visit
https://review.coreboot.org/c/coreboot/+/46395
to look at the new patch set (#34).
Change subject: soc/mediatek/mt8192: add rtc MT6359P driver ......................................................................
soc/mediatek/mt8192: add rtc MT6359P driver
Add rtc MT6359P driver.
TEST=boot asurada
Signed-off-by: Yuchen Huang yuchen.huang@mediatek.corp-partner.google.com Change-Id: I57d6738fdec148c7458b2024a0a8225415ca2f3e --- M src/soc/mediatek/common/include/soc/rtc_common.h M src/soc/mediatek/common/rtc.c M src/soc/mediatek/mt8192/Makefile.inc M src/soc/mediatek/mt8192/bootblock.c A src/soc/mediatek/mt8192/include/soc/rtc.h A src/soc/mediatek/mt8192/rtc.c 6 files changed, 710 insertions(+), 28 deletions(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/95/46395/34
build bot (Jenkins) has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/46395 )
Change subject: soc/mediatek/mt8192: add rtc MT6359P driver ......................................................................
Patch Set 34:
(9 comments)
https://review.coreboot.org/c/coreboot/+/46395/34/src/soc/mediatek/mt8192/in... File src/soc/mediatek/mt8192/include/soc/rtc.h:
https://review.coreboot.org/c/coreboot/+/46395/34/src/soc/mediatek/mt8192/in... PS34, Line 101: RTC_GP_OSC32_CON = 2U << 13, /* Keep RG_EOSC_RSV[0] to low for lower leakage current hw design change */ line over 96 characters
https://review.coreboot.org/c/coreboot/+/46395/34/src/soc/mediatek/mt8192/in... PS34, Line 106: OSC32CON_ANALOG_SETTING = RTC_GP_OSC32_CON | RTC_EOSC32_CHOP_EN | RTC_EOSC32_VCT_EN |\ Avoid unnecessary line continuations
https://review.coreboot.org/c/coreboot/+/46395/34/src/soc/mediatek/mt8192/in... PS34, Line 107: RTC_GPS_CKOUT_EN | RTC_EMBCK_SEL_OPTION | RTC_EMB_K_EOSC32_MODE line over 96 characters
https://review.coreboot.org/c/coreboot/+/46395/34/src/soc/mediatek/mt8192/rt... File src/soc/mediatek/mt8192/rtc.c:
https://review.coreboot.org/c/coreboot/+/46395/34/src/soc/mediatek/mt8192/rt... PS34, Line 178: if (middle == left) { braces {} are not necessary for single statement blocks
https://review.coreboot.org/c/coreboot/+/46395/34/src/soc/mediatek/mt8192/rt... PS34, Line 183: if (val >= RTC_FQMTR_LOW_BASE && val <= RTC_FQMTR_HIGH_BASE) { braces {} are not necessary for single statement blocks
https://review.coreboot.org/c/coreboot/+/46395/34/src/soc/mediatek/mt8192/rt... PS34, Line 186: if (val > RTC_FQMTR_HIGH_BASE) { braces {} are not necessary for any arm of this statement
https://review.coreboot.org/c/coreboot/+/46395/34/src/soc/mediatek/mt8192/rt... PS34, Line 189: else { else should follow close brace '}'
https://review.coreboot.org/c/coreboot/+/46395/34/src/soc/mediatek/mt8192/rt... PS34, Line 304: rtc_write(RTC_BBPU, (bbpu | RTC_BBPU_KEY | RTC_BBPU_RESET_ALARM | RTC_BBPU_RESET_SPAR) & (~RTC_BBPU_SPAR_SW)); line over 96 characters
https://review.coreboot.org/c/coreboot/+/46395/34/src/soc/mediatek/mt8192/rt... PS34, Line 370: rtc_write(RTC_AL_YEA, (year | RTC_K_EOSC_RSV_0) & (~RTC_K_EOSC_RSV_1) & (~RTC_K_EOSC_RSV_2)); line over 96 characters
Yu-Ping Wu has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/46395 )
Change subject: soc/mediatek/mt8192: add rtc MT6359P driver ......................................................................
Patch Set 34:
(2 comments)
https://review.coreboot.org/c/coreboot/+/46395/30/src/soc/mediatek/mt8192/in... File src/soc/mediatek/mt8192/include/soc/rtc.h:
https://review.coreboot.org/c/coreboot/+/46395/30/src/soc/mediatek/mt8192/in... PS30, Line 1: /*
Wrong header.
Done
https://review.coreboot.org/c/coreboot/+/46395/30/src/soc/mediatek/mt8192/rt... File src/soc/mediatek/mt8192/rtc.c:
https://review.coreboot.org/c/coreboot/+/46395/30/src/soc/mediatek/mt8192/rt... PS30, Line 1: /*
Wrong header.
Done
build bot (Jenkins) has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/46395 )
Change subject: soc/mediatek/mt8192: add rtc MT6359P driver ......................................................................
Patch Set 35:
(9 comments)
https://review.coreboot.org/c/coreboot/+/46395/35/src/soc/mediatek/mt8192/in... File src/soc/mediatek/mt8192/include/soc/rtc.h:
https://review.coreboot.org/c/coreboot/+/46395/35/src/soc/mediatek/mt8192/in... PS35, Line 101: RTC_GP_OSC32_CON = 2U << 13, /* Keep RG_EOSC_RSV[0] to low for lower leakage current hw design change */ line over 96 characters
https://review.coreboot.org/c/coreboot/+/46395/35/src/soc/mediatek/mt8192/in... PS35, Line 106: OSC32CON_ANALOG_SETTING = RTC_GP_OSC32_CON | RTC_EOSC32_CHOP_EN | RTC_EOSC32_VCT_EN |\ Avoid unnecessary line continuations
https://review.coreboot.org/c/coreboot/+/46395/35/src/soc/mediatek/mt8192/in... PS35, Line 107: RTC_GPS_CKOUT_EN | RTC_EMBCK_SEL_OPTION | RTC_EMB_K_EOSC32_MODE line over 96 characters
https://review.coreboot.org/c/coreboot/+/46395/35/src/soc/mediatek/mt8192/rt... File src/soc/mediatek/mt8192/rtc.c:
https://review.coreboot.org/c/coreboot/+/46395/35/src/soc/mediatek/mt8192/rt... PS35, Line 178: if (middle == left) { braces {} are not necessary for single statement blocks
https://review.coreboot.org/c/coreboot/+/46395/35/src/soc/mediatek/mt8192/rt... PS35, Line 183: if (val >= RTC_FQMTR_LOW_BASE && val <= RTC_FQMTR_HIGH_BASE) { braces {} are not necessary for single statement blocks
https://review.coreboot.org/c/coreboot/+/46395/35/src/soc/mediatek/mt8192/rt... PS35, Line 186: if (val > RTC_FQMTR_HIGH_BASE) { braces {} are not necessary for any arm of this statement
https://review.coreboot.org/c/coreboot/+/46395/35/src/soc/mediatek/mt8192/rt... PS35, Line 189: else { else should follow close brace '}'
https://review.coreboot.org/c/coreboot/+/46395/35/src/soc/mediatek/mt8192/rt... PS35, Line 304: rtc_write(RTC_BBPU, (bbpu | RTC_BBPU_KEY | RTC_BBPU_RESET_ALARM | RTC_BBPU_RESET_SPAR) & (~RTC_BBPU_SPAR_SW)); line over 96 characters
https://review.coreboot.org/c/coreboot/+/46395/35/src/soc/mediatek/mt8192/rt... PS35, Line 370: rtc_write(RTC_AL_YEA, (year | RTC_K_EOSC_RSV_0) & (~RTC_K_EOSC_RSV_1) & (~RTC_K_EOSC_RSV_2)); line over 96 characters
build bot (Jenkins) has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/46395 )
Change subject: soc/mediatek/mt8192: add rtc MT6359P driver ......................................................................
Patch Set 36:
(9 comments)
https://review.coreboot.org/c/coreboot/+/46395/36/src/soc/mediatek/mt8192/in... File src/soc/mediatek/mt8192/include/soc/rtc.h:
https://review.coreboot.org/c/coreboot/+/46395/36/src/soc/mediatek/mt8192/in... PS36, Line 101: RTC_GP_OSC32_CON = 2U << 13, /* Keep RG_EOSC_RSV[0] to low for lower leakage current hw design change */ line over 96 characters
https://review.coreboot.org/c/coreboot/+/46395/36/src/soc/mediatek/mt8192/in... PS36, Line 106: OSC32CON_ANALOG_SETTING = RTC_GP_OSC32_CON | RTC_EOSC32_CHOP_EN | RTC_EOSC32_VCT_EN |\ Avoid unnecessary line continuations
https://review.coreboot.org/c/coreboot/+/46395/36/src/soc/mediatek/mt8192/in... PS36, Line 107: RTC_GPS_CKOUT_EN | RTC_EMBCK_SEL_OPTION | RTC_EMB_K_EOSC32_MODE line over 96 characters
https://review.coreboot.org/c/coreboot/+/46395/36/src/soc/mediatek/mt8192/rt... File src/soc/mediatek/mt8192/rtc.c:
https://review.coreboot.org/c/coreboot/+/46395/36/src/soc/mediatek/mt8192/rt... PS36, Line 178: if (middle == left) { braces {} are not necessary for single statement blocks
https://review.coreboot.org/c/coreboot/+/46395/36/src/soc/mediatek/mt8192/rt... PS36, Line 183: if (val >= RTC_FQMTR_LOW_BASE && val <= RTC_FQMTR_HIGH_BASE) { braces {} are not necessary for single statement blocks
https://review.coreboot.org/c/coreboot/+/46395/36/src/soc/mediatek/mt8192/rt... PS36, Line 186: if (val > RTC_FQMTR_HIGH_BASE) { braces {} are not necessary for any arm of this statement
https://review.coreboot.org/c/coreboot/+/46395/36/src/soc/mediatek/mt8192/rt... PS36, Line 189: else { else should follow close brace '}'
https://review.coreboot.org/c/coreboot/+/46395/36/src/soc/mediatek/mt8192/rt... PS36, Line 304: rtc_write(RTC_BBPU, (bbpu | RTC_BBPU_KEY | RTC_BBPU_RESET_ALARM | RTC_BBPU_RESET_SPAR) & (~RTC_BBPU_SPAR_SW)); line over 96 characters
https://review.coreboot.org/c/coreboot/+/46395/36/src/soc/mediatek/mt8192/rt... PS36, Line 370: rtc_write(RTC_AL_YEA, (year | RTC_K_EOSC_RSV_0) & (~RTC_K_EOSC_RSV_1) & (~RTC_K_EOSC_RSV_2)); line over 96 characters
build bot (Jenkins) has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/46395 )
Change subject: soc/mediatek/mt8192: add rtc MT6359P driver ......................................................................
Patch Set 38:
(9 comments)
https://review.coreboot.org/c/coreboot/+/46395/38/src/soc/mediatek/mt8192/in... File src/soc/mediatek/mt8192/include/soc/rtc.h:
https://review.coreboot.org/c/coreboot/+/46395/38/src/soc/mediatek/mt8192/in... PS38, Line 101: RTC_GP_OSC32_CON = 2U << 13, /* Keep RG_EOSC_RSV[0] to low for lower leakage current hw design change */ line over 96 characters
https://review.coreboot.org/c/coreboot/+/46395/38/src/soc/mediatek/mt8192/in... PS38, Line 106: OSC32CON_ANALOG_SETTING = RTC_GP_OSC32_CON | RTC_EOSC32_CHOP_EN | RTC_EOSC32_VCT_EN |\ Avoid unnecessary line continuations
https://review.coreboot.org/c/coreboot/+/46395/38/src/soc/mediatek/mt8192/in... PS38, Line 107: RTC_GPS_CKOUT_EN | RTC_EMBCK_SEL_OPTION | RTC_EMB_K_EOSC32_MODE line over 96 characters
https://review.coreboot.org/c/coreboot/+/46395/38/src/soc/mediatek/mt8192/rt... File src/soc/mediatek/mt8192/rtc.c:
https://review.coreboot.org/c/coreboot/+/46395/38/src/soc/mediatek/mt8192/rt... PS38, Line 178: if (middle == left) { braces {} are not necessary for single statement blocks
https://review.coreboot.org/c/coreboot/+/46395/38/src/soc/mediatek/mt8192/rt... PS38, Line 183: if (val >= RTC_FQMTR_LOW_BASE && val <= RTC_FQMTR_HIGH_BASE) { braces {} are not necessary for single statement blocks
https://review.coreboot.org/c/coreboot/+/46395/38/src/soc/mediatek/mt8192/rt... PS38, Line 186: if (val > RTC_FQMTR_HIGH_BASE) { braces {} are not necessary for any arm of this statement
https://review.coreboot.org/c/coreboot/+/46395/38/src/soc/mediatek/mt8192/rt... PS38, Line 189: else { else should follow close brace '}'
https://review.coreboot.org/c/coreboot/+/46395/38/src/soc/mediatek/mt8192/rt... PS38, Line 304: rtc_write(RTC_BBPU, (bbpu | RTC_BBPU_KEY | RTC_BBPU_RESET_ALARM | RTC_BBPU_RESET_SPAR) & (~RTC_BBPU_SPAR_SW)); line over 96 characters
https://review.coreboot.org/c/coreboot/+/46395/38/src/soc/mediatek/mt8192/rt... PS38, Line 370: rtc_write(RTC_AL_YEA, (year | RTC_K_EOSC_RSV_0) & (~RTC_K_EOSC_RSV_1) & (~RTC_K_EOSC_RSV_2)); line over 96 characters
Yuchen Huang has uploaded a new patch set (#39) to the change originally created by Yidi Lin. ( https://review.coreboot.org/c/coreboot/+/46395 )
Change subject: soc/mediatek/mt8192: add rtc MT6359P driver ......................................................................
soc/mediatek/mt8192: add rtc MT6359P driver
Add rtc MT6359P driver.
TEST=boot asurada
Signed-off-by: Yuchen Huang yuchen.huang@mediatek.corp-partner.google.com Change-Id: I57d6738fdec148c7458b2024a0a8225415ca2f3e --- M src/soc/mediatek/common/include/soc/rtc_common.h M src/soc/mediatek/common/rtc.c M src/soc/mediatek/mt8192/Makefile.inc M src/soc/mediatek/mt8192/bootblock.c A src/soc/mediatek/mt8192/include/soc/rtc.h A src/soc/mediatek/mt8192/rtc.c 6 files changed, 717 insertions(+), 28 deletions(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/95/46395/39
build bot (Jenkins) has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/46395 )
Change subject: soc/mediatek/mt8192: add rtc MT6359P driver ......................................................................
Patch Set 39:
(1 comment)
https://review.coreboot.org/c/coreboot/+/46395/39/src/soc/mediatek/mt8192/in... File src/soc/mediatek/mt8192/include/soc/rtc.h:
https://review.coreboot.org/c/coreboot/+/46395/39/src/soc/mediatek/mt8192/in... PS39, Line 107: OSC32CON_ANALOG_SETTING = RTC_GP_OSC32_CON | RTC_EOSC32_CHOP_EN |\ Avoid unnecessary line continuations
Yuchen Huang has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/46395 )
Change subject: soc/mediatek/mt8192: add rtc MT6359P driver ......................................................................
Patch Set 39:
(9 comments)
https://review.coreboot.org/c/coreboot/+/46395/38/src/soc/mediatek/mt8192/in... File src/soc/mediatek/mt8192/include/soc/rtc.h:
https://review.coreboot.org/c/coreboot/+/46395/38/src/soc/mediatek/mt8192/in... PS38, Line 101: RTC_GP_OSC32_CON = 2U << 13, /* Keep RG_EOSC_RSV[0] to low for lower leakage current hw design change */
line over 96 characters
done
https://review.coreboot.org/c/coreboot/+/46395/38/src/soc/mediatek/mt8192/in... PS38, Line 106: OSC32CON_ANALOG_SETTING = RTC_GP_OSC32_CON | RTC_EOSC32_CHOP_EN | RTC_EOSC32_VCT_EN |\
Avoid unnecessary line continuations
done
https://review.coreboot.org/c/coreboot/+/46395/38/src/soc/mediatek/mt8192/in... PS38, Line 107: RTC_GPS_CKOUT_EN | RTC_EMBCK_SEL_OPTION | RTC_EMB_K_EOSC32_MODE
line over 96 characters
done
https://review.coreboot.org/c/coreboot/+/46395/38/src/soc/mediatek/mt8192/rt... File src/soc/mediatek/mt8192/rtc.c:
https://review.coreboot.org/c/coreboot/+/46395/38/src/soc/mediatek/mt8192/rt... PS38, Line 178: if (middle == left) {
braces {} are not necessary for single statement blocks
done
https://review.coreboot.org/c/coreboot/+/46395/38/src/soc/mediatek/mt8192/rt... PS38, Line 183: if (val >= RTC_FQMTR_LOW_BASE && val <= RTC_FQMTR_HIGH_BASE) {
braces {} are not necessary for single statement blocks
done
https://review.coreboot.org/c/coreboot/+/46395/38/src/soc/mediatek/mt8192/rt... PS38, Line 186: if (val > RTC_FQMTR_HIGH_BASE) {
braces {} are not necessary for any arm of this statement
done
https://review.coreboot.org/c/coreboot/+/46395/38/src/soc/mediatek/mt8192/rt... PS38, Line 189: else {
else should follow close brace '}'
done
https://review.coreboot.org/c/coreboot/+/46395/38/src/soc/mediatek/mt8192/rt... PS38, Line 304: rtc_write(RTC_BBPU, (bbpu | RTC_BBPU_KEY | RTC_BBPU_RESET_ALARM | RTC_BBPU_RESET_SPAR) & (~RTC_BBPU_SPAR_SW));
line over 96 characters
done
https://review.coreboot.org/c/coreboot/+/46395/38/src/soc/mediatek/mt8192/rt... PS38, Line 370: rtc_write(RTC_AL_YEA, (year | RTC_K_EOSC_RSV_0) & (~RTC_K_EOSC_RSV_1) & (~RTC_K_EOSC_RSV_2));
line over 96 characters
done
Yuchen Huang has uploaded a new patch set (#40) to the change originally created by Yidi Lin. ( https://review.coreboot.org/c/coreboot/+/46395 )
Change subject: soc/mediatek/mt8192: add rtc MT6359P driver ......................................................................
soc/mediatek/mt8192: add rtc MT6359P driver
Add rtc MT6359P driver.
TEST=boot asurada
Signed-off-by: Yuchen Huang yuchen.huang@mediatek.corp-partner.google.com Change-Id: I57d6738fdec148c7458b2024a0a8225415ca2f3e --- M src/soc/mediatek/common/include/soc/rtc_common.h M src/soc/mediatek/common/rtc.c M src/soc/mediatek/mt8183/include/soc/rtc.h M src/soc/mediatek/mt8192/Makefile.inc M src/soc/mediatek/mt8192/bootblock.c A src/soc/mediatek/mt8192/include/soc/rtc.h A src/soc/mediatek/mt8192/rtc.c 7 files changed, 718 insertions(+), 28 deletions(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/95/46395/40
build bot (Jenkins) has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/46395 )
Change subject: soc/mediatek/mt8192: add rtc MT6359P driver ......................................................................
Patch Set 40:
(1 comment)
https://review.coreboot.org/c/coreboot/+/46395/40/src/soc/mediatek/mt8192/in... File src/soc/mediatek/mt8192/include/soc/rtc.h:
https://review.coreboot.org/c/coreboot/+/46395/40/src/soc/mediatek/mt8192/in... PS40, Line 108: OSC32CON_ANALOG_SETTING = RTC_GP_OSC32_CON | RTC_EOSC32_CHOP_EN |\ Avoid unnecessary line continuations
Yidi Lin has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/46395 )
Change subject: soc/mediatek/mt8192: add rtc MT6359P driver ......................................................................
Patch Set 40:
(5 comments)
https://review.coreboot.org/c/coreboot/+/46395/40/src/soc/mediatek/mt8192/rt... File src/soc/mediatek/mt8192/rtc.c:
https://review.coreboot.org/c/coreboot/+/46395/40/src/soc/mediatek/mt8192/rt... PS40, Line 88: static u16 rtc_get_frequency_meter what about make this function into common function and extract FQMTR enabling part to the SOC-depend function.
https://review.coreboot.org/c/coreboot/+/46395/40/src/soc/mediatek/mt8192/rt... PS40, Line 165: static u16 rtc_eosc_cali(void) I think this function can be shared with 83.
https://review.coreboot.org/c/coreboot/+/46395/40/src/soc/mediatek/mt8192/rt... PS40, Line 221: void rtc_osc_init(void) I think this function can be shared with 83.
https://review.coreboot.org/c/coreboot/+/46395/40/src/soc/mediatek/mt8192/rt... PS40, Line 237: static int rtc_lpen(u16 con) ditto
https://review.coreboot.org/c/coreboot/+/46395/40/src/soc/mediatek/mt8192/rt... PS40, Line 325: rtc_powerkey_init ditto
Yuchen Huang has uploaded a new patch set (#41) to the change originally created by Yidi Lin. ( https://review.coreboot.org/c/coreboot/+/46395 )
Change subject: soc/mediatek/mt8192: add rtc MT6359P driver ......................................................................
soc/mediatek/mt8192: add rtc MT6359P driver
Add rtc MT6359P driver.
TEST=boot asurada
Signed-off-by: Yuchen Huang yuchen.huang@mediatek.corp-partner.google.com Change-Id: I57d6738fdec148c7458b2024a0a8225415ca2f3e --- M src/soc/mediatek/common/include/soc/rtc_common.h M src/soc/mediatek/common/rtc.c M src/soc/mediatek/mt8183/include/soc/rtc.h M src/soc/mediatek/mt8183/rtc.c M src/soc/mediatek/mt8192/Makefile.inc M src/soc/mediatek/mt8192/bootblock.c A src/soc/mediatek/mt8192/include/soc/rtc.h A src/soc/mediatek/mt8192/rtc.c 8 files changed, 752 insertions(+), 126 deletions(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/95/46395/41
build bot (Jenkins) has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/46395 )
Change subject: soc/mediatek/mt8192: add rtc MT6359P driver ......................................................................
Patch Set 41:
(1 comment)
https://review.coreboot.org/c/coreboot/+/46395/41/src/soc/mediatek/mt8192/in... File src/soc/mediatek/mt8192/include/soc/rtc.h:
https://review.coreboot.org/c/coreboot/+/46395/41/src/soc/mediatek/mt8192/in... PS41, Line 108: OSC32CON_ANALOG_SETTING = RTC_GP_OSC32_CON | RTC_EOSC32_CHOP_EN |\ Avoid unnecessary line continuations
Yuchen Huang has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/46395 )
Change subject: soc/mediatek/mt8192: add rtc MT6359P driver ......................................................................
Patch Set 41:
(5 comments)
https://review.coreboot.org/c/coreboot/+/46395/40/src/soc/mediatek/mt8192/rt... File src/soc/mediatek/mt8192/rtc.c:
https://review.coreboot.org/c/coreboot/+/46395/40/src/soc/mediatek/mt8192/rt... PS40, Line 88: static u16 rtc_get_frequency_meter
what about make this function into common function and extract FQMTR enabling part to the SOC-depend […]
Designer provided programming guide of frequency meter flow according to different PMIC. The shift and name of register bit may be quiet different, it is not recommended to use this part as a common part. In future PMICs, this one may be more different
https://review.coreboot.org/c/coreboot/+/46395/40/src/soc/mediatek/mt8192/rt... PS40, Line 165: static u16 rtc_eosc_cali(void)
I think this function can be shared with 83.
Done
https://review.coreboot.org/c/coreboot/+/46395/40/src/soc/mediatek/mt8192/rt... PS40, Line 221: void rtc_osc_init(void)
I think this function can be shared with 83.
Done
https://review.coreboot.org/c/coreboot/+/46395/40/src/soc/mediatek/mt8192/rt... PS40, Line 237: static int rtc_lpen(u16 con)
ditto
Done
https://review.coreboot.org/c/coreboot/+/46395/40/src/soc/mediatek/mt8192/rt... PS40, Line 325: rtc_powerkey_init
ditto
Done
Yu-Ping Wu has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/46395 )
Change subject: soc/mediatek/mt8192: add rtc MT6359P driver ......................................................................
Patch Set 41:
(2 comments)
https://review.coreboot.org/c/coreboot/+/46395/1/src/soc/mediatek/mt8192/inc... File src/soc/mediatek/mt8192/include/soc/rtc.h:
https://review.coreboot.org/c/coreboot/+/46395/1/src/soc/mediatek/mt8192/inc... PS1, Line 1: /* : * This file is part of the coreboot project. : * : * Copyright 2018 MediaTek Inc. : * : * This program is free software; you can redistribute it and/or modify : * it under the terms of the GNU General Public License as published by : * the Free Software Foundation; version 2 of the License. : * : * This program is distributed in the hope that it will be useful, : * but WITHOUT ANY WARRANTY; without even the implied warranty of : * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the : * GNU General Public License for more details. : */
SPDX ....
Done
https://review.coreboot.org/c/coreboot/+/46395/1/src/soc/mediatek/mt8192/rtc... File src/soc/mediatek/mt8192/rtc.c:
https://review.coreboot.org/c/coreboot/+/46395/1/src/soc/mediatek/mt8192/rtc... PS1, Line 1: /* : * This file is part of the coreboot project. : * : * Copyright 2018 MediaTek Inc. : * : * This program is free software; you can redistribute it and/or modify : * it under the terms of the GNU General Public License as published by : * the Free Software Foundation; version 2 of the License. : * : * This program is distributed in the hope that it will be useful, : * but WITHOUT ANY WARRANTY; without even the implied warranty of : * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the : * GNU General Public License for more details. : */
SPDX...
Done
Yidi Lin has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/46395 )
Change subject: soc/mediatek/mt8192: add rtc MT6359P driver ......................................................................
Patch Set 41:
(9 comments)
https://review.coreboot.org/c/coreboot/+/46395/41/src/soc/mediatek/common/in... File src/soc/mediatek/common/include/soc/rtc_common.h:
https://review.coreboot.org/c/coreboot/+/46395/41/src/soc/mediatek/common/in... PS41, Line 9: #include <soc/pmic_wrap_common.h> move to mt8183/include/soc/rtc.h ?
https://review.coreboot.org/c/coreboot/+/46395/41/src/soc/mediatek/common/rt... File src/soc/mediatek/common/rtc.c:
https://review.coreboot.org/c/coreboot/+/46395/41/src/soc/mediatek/common/rt... PS41, Line 144: if (con & RTC_CON_LPSTA_RAW) : return RTC_STATE_INIT; Does it effect 73/83 if the check is removed from common code ?
https://review.coreboot.org/c/coreboot/+/46395/41/src/soc/mediatek/mt8183/in... File src/soc/mediatek/mt8183/include/soc/rtc.h:
PS41: please also add change to mt8173/include/soc/rtc.h
https://review.coreboot.org/c/coreboot/+/46395/41/src/soc/mediatek/mt8183/in... PS41, Line 234: remove one blank
https://review.coreboot.org/c/coreboot/+/46395/41/src/soc/mediatek/mt8192/bo... File src/soc/mediatek/mt8192/bootblock.c:
https://review.coreboot.org/c/coreboot/+/46395/41/src/soc/mediatek/mt8192/bo... PS41, Line 10: #include <soc/rtc.h> in alphabet order
https://review.coreboot.org/c/coreboot/+/46395/41/src/soc/mediatek/mt8192/in... File src/soc/mediatek/mt8192/include/soc/rtc.h:
https://review.coreboot.org/c/coreboot/+/46395/41/src/soc/mediatek/mt8192/in... PS41, Line 6: #include <soc/rtc_common.h> : #include <soc/pmif.h> in alphabet order
https://review.coreboot.org/c/coreboot/+/46395/41/src/soc/mediatek/mt8192/in... PS41, Line 108: \ remove \
https://review.coreboot.org/c/coreboot/+/46395/41/src/soc/mediatek/mt8192/rt... File src/soc/mediatek/mt8192/rtc.c:
https://review.coreboot.org/c/coreboot/+/46395/41/src/soc/mediatek/mt8192/rt... PS41, Line 33: void static void ?
https://review.coreboot.org/c/coreboot/+/46395/41/src/soc/mediatek/mt8192/rt... PS41, Line 347: //rtc_write_field(PMIC_RG_DCXO_CW12, 0x0, 0x1, 0); remove
Yuchen Huang has uploaded a new patch set (#42) to the change originally created by Yidi Lin. ( https://review.coreboot.org/c/coreboot/+/46395 )
Change subject: soc/mediatek/mt8192: add rtc MT6359P driver ......................................................................
soc/mediatek/mt8192: add rtc MT6359P driver
Add rtc MT6359P driver.
TEST=boot asurada
Signed-off-by: Yuchen Huang yuchen.huang@mediatek.corp-partner.google.com Change-Id: I57d6738fdec148c7458b2024a0a8225415ca2f3e --- A src/soc/mediatek/common/include/soc/rtc_cali.h M src/soc/mediatek/common/include/soc/rtc_common.h M src/soc/mediatek/common/rtc.c A src/soc/mediatek/common/rtc_cali.c M src/soc/mediatek/mt8173/include/soc/rtc.h M src/soc/mediatek/mt8183/Makefile.inc M src/soc/mediatek/mt8183/include/soc/rtc.h M src/soc/mediatek/mt8183/rtc.c M src/soc/mediatek/mt8192/Makefile.inc M src/soc/mediatek/mt8192/bootblock.c A src/soc/mediatek/mt8192/include/soc/rtc.h A src/soc/mediatek/mt8192/rtc.c 12 files changed, 782 insertions(+), 126 deletions(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/95/46395/42
Yuchen Huang has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/46395 )
Change subject: soc/mediatek/mt8192: add rtc MT6359P driver ......................................................................
Patch Set 42:
(10 comments)
https://review.coreboot.org/c/coreboot/+/46395/41/src/soc/mediatek/common/in... File src/soc/mediatek/common/include/soc/rtc_common.h:
https://review.coreboot.org/c/coreboot/+/46395/41/src/soc/mediatek/common/in... PS41, Line 9: #include <soc/pmic_wrap_common.h>
move to mt8183/include/soc/rtc. […]
Done
https://review.coreboot.org/c/coreboot/+/46395/41/src/soc/mediatek/common/rt... File src/soc/mediatek/common/rtc.c:
https://review.coreboot.org/c/coreboot/+/46395/41/src/soc/mediatek/common/rt... PS41, Line 144: if (con & RTC_CON_LPSTA_RAW) : return RTC_STATE_INIT;
Does it effect 73/83 if the check is removed from common code ?
Done merge CL: 46883 for lpd_init. 46883 will be abandoned.
https://review.coreboot.org/c/coreboot/+/46395/41/src/soc/mediatek/mt8183/in... File src/soc/mediatek/mt8183/include/soc/rtc.h:
PS41:
please also add change to mt8173/include/soc/rtc. […]
Done
https://review.coreboot.org/c/coreboot/+/46395/41/src/soc/mediatek/mt8183/in... PS41, Line 234:
remove one blank
Done
https://review.coreboot.org/c/coreboot/+/46395/41/src/soc/mediatek/mt8192/bo... File src/soc/mediatek/mt8192/bootblock.c:
https://review.coreboot.org/c/coreboot/+/46395/41/src/soc/mediatek/mt8192/bo... PS41, Line 10: #include <soc/rtc.h>
in alphabet order
Done
https://review.coreboot.org/c/coreboot/+/46395/41/src/soc/mediatek/mt8192/in... File src/soc/mediatek/mt8192/include/soc/rtc.h:
https://review.coreboot.org/c/coreboot/+/46395/41/src/soc/mediatek/mt8192/in... PS41, Line 6: #include <soc/rtc_common.h> : #include <soc/pmif.h>
in alphabet order
Done
https://review.coreboot.org/c/coreboot/+/46395/41/src/soc/mediatek/mt8192/in... PS41, Line 108: \
remove \
Done
https://review.coreboot.org/c/coreboot/+/46395/41/src/soc/mediatek/mt8192/in... PS41, Line 108: OSC32CON_ANALOG_SETTING = RTC_GP_OSC32_CON | RTC_EOSC32_CHOP_EN |\
Avoid unnecessary line continuations
done
https://review.coreboot.org/c/coreboot/+/46395/41/src/soc/mediatek/mt8192/rt... File src/soc/mediatek/mt8192/rtc.c:
https://review.coreboot.org/c/coreboot/+/46395/41/src/soc/mediatek/mt8192/rt... PS41, Line 33: void
static void ?
Done
https://review.coreboot.org/c/coreboot/+/46395/41/src/soc/mediatek/mt8192/rt... PS41, Line 347: //rtc_write_field(PMIC_RG_DCXO_CW12, 0x0, 0x1, 0);
remove
Done
Yidi Lin has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/46395 )
Change subject: soc/mediatek/mt8192: add rtc MT6359P driver ......................................................................
Patch Set 42:
(6 comments)
https://review.coreboot.org/c/coreboot/+/46395/42/src/soc/mediatek/common/in... File src/soc/mediatek/common/include/soc/rtc_cali.h:
https://review.coreboot.org/c/coreboot/+/46395/42/src/soc/mediatek/common/in... PS42, Line 8: void rtc_osc_init(void); move to rtc_common.h
https://review.coreboot.org/c/coreboot/+/46395/42/src/soc/mediatek/common/rt... File src/soc/mediatek/common/rtc_cali.c:
PS42: rtc_osc_init.c ?
https://review.coreboot.org/c/coreboot/+/46395/42/src/soc/mediatek/common/rt... PS42, Line 7: int rtc_eosc_cali(void) static int ?
https://review.coreboot.org/c/coreboot/+/46395/42/src/soc/mediatek/mt8173/in... File src/soc/mediatek/mt8173/include/soc/rtc.h:
https://review.coreboot.org/c/coreboot/+/46395/42/src/soc/mediatek/mt8173/in... PS42, Line 9: #include <soc/pmic_wrap_common.h> in alphabet order
https://review.coreboot.org/c/coreboot/+/46395/42/src/soc/mediatek/mt8173/in... PS42, Line 127: remove extra blank line
https://review.coreboot.org/c/coreboot/+/46395/42/src/soc/mediatek/mt8183/in... File src/soc/mediatek/mt8183/include/soc/rtc.h:
https://review.coreboot.org/c/coreboot/+/46395/42/src/soc/mediatek/mt8183/in... PS42, Line 6: #include <soc/rtc_common.h> : #include <soc/pmic_wrap_common.h> : #include <soc/rtc_cali.h> in alphabet order
Yidi Lin has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/46395 )
Change subject: soc/mediatek/mt8192: add rtc MT6359P driver ......................................................................
Patch Set 42:
(3 comments)
https://review.coreboot.org/c/coreboot/+/46395/42/src/soc/mediatek/common/rt... File src/soc/mediatek/common/rtc_cali.c:
https://review.coreboot.org/c/coreboot/+/46395/42/src/soc/mediatek/common/rt... PS42, Line 77: remove blank line
https://review.coreboot.org/c/coreboot/+/46395/42/src/soc/mediatek/mt8192/in... File src/soc/mediatek/mt8192/include/soc/rtc.h:
https://review.coreboot.org/c/coreboot/+/46395/42/src/soc/mediatek/mt8192/in... PS42, Line 235: remove blank line
https://review.coreboot.org/c/coreboot/+/46395/42/src/soc/mediatek/mt8192/rt... File src/soc/mediatek/mt8192/rtc.c:
https://review.coreboot.org/c/coreboot/+/46395/42/src/soc/mediatek/mt8192/rt... PS42, Line 362: remove blank line
Yuchen Huang has uploaded a new patch set (#43) to the change originally created by Yidi Lin. ( https://review.coreboot.org/c/coreboot/+/46395 )
Change subject: soc/mediatek/mt8192: add rtc MT6359P driver ......................................................................
soc/mediatek/mt8192: add rtc MT6359P driver
Add rtc MT6359P driver.
TEST=boot asurada
Signed-off-by: Yuchen Huang yuchen.huang@mediatek.corp-partner.google.com Change-Id: I57d6738fdec148c7458b2024a0a8225415ca2f3e --- M src/soc/mediatek/common/include/soc/rtc_common.h M src/soc/mediatek/common/rtc.c A src/soc/mediatek/common/rtc_osc_init.c M src/soc/mediatek/mt8173/include/soc/rtc.h M src/soc/mediatek/mt8183/Makefile.inc M src/soc/mediatek/mt8183/include/soc/rtc.h M src/soc/mediatek/mt8183/rtc.c M src/soc/mediatek/mt8192/Makefile.inc M src/soc/mediatek/mt8192/bootblock.c A src/soc/mediatek/mt8192/include/soc/rtc.h A src/soc/mediatek/mt8192/rtc.c 11 files changed, 766 insertions(+), 128 deletions(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/95/46395/43
Yuchen Huang has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/46395 )
Change subject: soc/mediatek/mt8192: add rtc MT6359P driver ......................................................................
Patch Set 43:
(9 comments)
https://review.coreboot.org/c/coreboot/+/46395/42/src/soc/mediatek/common/in... File src/soc/mediatek/common/include/soc/rtc_cali.h:
https://review.coreboot.org/c/coreboot/+/46395/42/src/soc/mediatek/common/in... PS42, Line 8: void rtc_osc_init(void);
move to rtc_common. […]
Done
https://review.coreboot.org/c/coreboot/+/46395/42/src/soc/mediatek/common/rt... File src/soc/mediatek/common/rtc_cali.c:
PS42:
rtc_osc_init. […]
Done
https://review.coreboot.org/c/coreboot/+/46395/42/src/soc/mediatek/common/rt... PS42, Line 7: int rtc_eosc_cali(void)
static int ?
Done
https://review.coreboot.org/c/coreboot/+/46395/42/src/soc/mediatek/common/rt... PS42, Line 77:
remove blank line
Done
https://review.coreboot.org/c/coreboot/+/46395/42/src/soc/mediatek/mt8173/in... File src/soc/mediatek/mt8173/include/soc/rtc.h:
https://review.coreboot.org/c/coreboot/+/46395/42/src/soc/mediatek/mt8173/in... PS42, Line 9: #include <soc/pmic_wrap_common.h>
in alphabet order
Done
https://review.coreboot.org/c/coreboot/+/46395/42/src/soc/mediatek/mt8173/in... PS42, Line 127:
remove extra blank line
Done
https://review.coreboot.org/c/coreboot/+/46395/42/src/soc/mediatek/mt8183/in... File src/soc/mediatek/mt8183/include/soc/rtc.h:
https://review.coreboot.org/c/coreboot/+/46395/42/src/soc/mediatek/mt8183/in... PS42, Line 6: #include <soc/rtc_common.h> : #include <soc/pmic_wrap_common.h> : #include <soc/rtc_cali.h>
in alphabet order
Done
https://review.coreboot.org/c/coreboot/+/46395/42/src/soc/mediatek/mt8192/in... File src/soc/mediatek/mt8192/include/soc/rtc.h:
https://review.coreboot.org/c/coreboot/+/46395/42/src/soc/mediatek/mt8192/in... PS42, Line 235:
remove blank line
Done
https://review.coreboot.org/c/coreboot/+/46395/42/src/soc/mediatek/mt8192/rt... File src/soc/mediatek/mt8192/rtc.c:
https://review.coreboot.org/c/coreboot/+/46395/42/src/soc/mediatek/mt8192/rt... PS42, Line 362:
remove blank line
Done
Yidi Lin has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/46395 )
Change subject: soc/mediatek/mt8192: add rtc MT6359P driver ......................................................................
Patch Set 43:
(1 comment)
Hung-Te & Yu-Ping,
Please review RTC driver.
https://review.coreboot.org/c/coreboot/+/46395/43/src/soc/mediatek/mt8173/in... File src/soc/mediatek/mt8173/include/soc/rtc.h:
https://review.coreboot.org/c/coreboot/+/46395/43/src/soc/mediatek/mt8173/in... PS43, Line 6: #include "mt6391.h" : #include <soc/pmic_wrap_common.h> : #include <soc/rtc_common.h> : #include <stdint.h> #include <soc/pmic_wrap_common.h> #include <soc/rtc_common.h> #include <stdint.h> #include "mt6391.h"
Hung-Te Lin has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/46395 )
Change subject: soc/mediatek/mt8192: add rtc MT6359P driver ......................................................................
Patch Set 43:
Please review RTC driver.
You have to first solve buildbot failure:
src/soc/mediatek/common/rtc_osc_init.c has multiple final newlines.
Yuchen Huang has uploaded a new patch set (#44) to the change originally created by Yidi Lin. ( https://review.coreboot.org/c/coreboot/+/46395 )
Change subject: soc/mediatek/mt8192: add rtc MT6359P driver ......................................................................
soc/mediatek/mt8192: add rtc MT6359P driver
Add rtc MT6359P driver.
TEST=boot asurada
Signed-off-by: Yuchen Huang yuchen.huang@mediatek.corp-partner.google.com Change-Id: I57d6738fdec148c7458b2024a0a8225415ca2f3e --- M src/soc/mediatek/common/include/soc/rtc_common.h M src/soc/mediatek/common/rtc.c A src/soc/mediatek/common/rtc_osc_init.c M src/soc/mediatek/mt8173/include/soc/rtc.h M src/soc/mediatek/mt8183/Makefile.inc M src/soc/mediatek/mt8183/include/soc/rtc.h M src/soc/mediatek/mt8183/rtc.c M src/soc/mediatek/mt8192/Makefile.inc M src/soc/mediatek/mt8192/bootblock.c A src/soc/mediatek/mt8192/include/soc/rtc.h A src/soc/mediatek/mt8192/rtc.c 11 files changed, 765 insertions(+), 127 deletions(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/95/46395/44
Yuchen Huang has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/46395 )
Change subject: soc/mediatek/mt8192: add rtc MT6359P driver ......................................................................
Patch Set 44:
(1 comment)
https://review.coreboot.org/c/coreboot/+/46395/43/src/soc/mediatek/mt8173/in... File src/soc/mediatek/mt8173/include/soc/rtc.h:
https://review.coreboot.org/c/coreboot/+/46395/43/src/soc/mediatek/mt8173/in... PS43, Line 6: #include "mt6391.h" : #include <soc/pmic_wrap_common.h> : #include <soc/rtc_common.h> : #include <stdint.h>
#include <soc/pmic_wrap_common.h> […]
Done
Yuchen Huang has uploaded a new patch set (#45) to the change originally created by Yidi Lin. ( https://review.coreboot.org/c/coreboot/+/46395 )
Change subject: soc/mediatek/mt8192: add rtc MT6359P driver ......................................................................
soc/mediatek/mt8192: add rtc MT6359P driver
Add rtc MT6359P driver.
TEST=boot asurada
Signed-off-by: Yuchen Huang yuchen.huang@mediatek.corp-partner.google.com Change-Id: I57d6738fdec148c7458b2024a0a8225415ca2f3e --- M src/soc/mediatek/common/include/soc/rtc_common.h M src/soc/mediatek/common/rtc.c A src/soc/mediatek/common/rtc_osc_init.c M src/soc/mediatek/mt8173/include/soc/rtc.h M src/soc/mediatek/mt8183/Makefile.inc M src/soc/mediatek/mt8183/include/soc/rtc.h M src/soc/mediatek/mt8183/rtc.c M src/soc/mediatek/mt8192/Makefile.inc M src/soc/mediatek/mt8192/bootblock.c A src/soc/mediatek/mt8192/include/soc/rtc.h A src/soc/mediatek/mt8192/rtc.c 11 files changed, 764 insertions(+), 127 deletions(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/95/46395/45
Yidi Lin has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/46395 )
Change subject: soc/mediatek/mt8192: add rtc MT6359P driver ......................................................................
Patch Set 45:
(1 comment)
https://review.coreboot.org/c/coreboot/+/46395/45/src/soc/mediatek/mt8183/Ma... File src/soc/mediatek/mt8183/Makefile.inc:
https://review.coreboot.org/c/coreboot/+/46395/45/src/soc/mediatek/mt8183/Ma... PS45, Line 57: rtc_cali.c rtc_osc_init.c
Yuchen Huang has uploaded a new patch set (#46) to the change originally created by Yidi Lin. ( https://review.coreboot.org/c/coreboot/+/46395 )
Change subject: soc/mediatek/mt8192: add rtc MT6359P driver ......................................................................
soc/mediatek/mt8192: add rtc MT6359P driver
Add rtc MT6359P driver.
TEST=boot asurada
Signed-off-by: Yuchen Huang yuchen.huang@mediatek.corp-partner.google.com Change-Id: I57d6738fdec148c7458b2024a0a8225415ca2f3e --- M src/soc/mediatek/common/include/soc/rtc_common.h M src/soc/mediatek/common/rtc.c A src/soc/mediatek/common/rtc_osc_init.c M src/soc/mediatek/mt8173/include/soc/rtc.h M src/soc/mediatek/mt8183/Makefile.inc M src/soc/mediatek/mt8183/include/soc/rtc.h M src/soc/mediatek/mt8183/rtc.c M src/soc/mediatek/mt8192/Makefile.inc M src/soc/mediatek/mt8192/bootblock.c A src/soc/mediatek/mt8192/include/soc/rtc.h A src/soc/mediatek/mt8192/rtc.c 11 files changed, 764 insertions(+), 127 deletions(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/95/46395/46
Yuchen Huang has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/46395 )
Change subject: soc/mediatek/mt8192: add rtc MT6359P driver ......................................................................
Patch Set 46:
(1 comment)
https://review.coreboot.org/c/coreboot/+/46395/45/src/soc/mediatek/mt8183/Ma... File src/soc/mediatek/mt8183/Makefile.inc:
https://review.coreboot.org/c/coreboot/+/46395/45/src/soc/mediatek/mt8183/Ma... PS45, Line 57: rtc_cali.c
rtc_osc_init. […]
Done
Yu-Ping Wu has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/46395 )
Change subject: soc/mediatek/mt8192: add rtc MT6359P driver ......................................................................
Patch Set 46:
Please address the unresolved comments in older patchsets first.
Yuchen Huang has uploaded a new patch set (#47) to the change originally created by Yidi Lin. ( https://review.coreboot.org/c/coreboot/+/46395 )
Change subject: soc/mediatek/mt8192: add rtc MT6359P driver ......................................................................
soc/mediatek/mt8192: add rtc MT6359P driver
Add rtc MT6359P driver for rtc init and rtc eosc calibration.
Reference datasheet: Document No: RH-D-2018-0101.
Signed-off-by: Yuchen Huang yuchen.huang@mediatek.corp-partner.google.com Change-Id: I57d6738fdec148c7458b2024a0a8225415ca2f3e --- M src/soc/mediatek/common/include/soc/rtc_common.h M src/soc/mediatek/common/rtc.c A src/soc/mediatek/common/rtc_osc_init.c M src/soc/mediatek/mt8173/include/soc/rtc.h M src/soc/mediatek/mt8173/rtc.c M src/soc/mediatek/mt8183/Makefile.inc M src/soc/mediatek/mt8183/include/soc/rtc.h M src/soc/mediatek/mt8183/rtc.c M src/soc/mediatek/mt8192/Makefile.inc M src/soc/mediatek/mt8192/bootblock.c A src/soc/mediatek/mt8192/include/soc/rtc.h A src/soc/mediatek/mt8192/rtc.c 12 files changed, 767 insertions(+), 129 deletions(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/95/46395/47
build bot (Jenkins) has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/46395 )
Change subject: soc/mediatek/mt8192: add rtc MT6359P driver ......................................................................
Patch Set 47:
(2 comments)
https://review.coreboot.org/c/coreboot/+/46395/47/src/soc/mediatek/mt8183/rt... File src/soc/mediatek/mt8183/rtc.c:
https://review.coreboot.org/c/coreboot/+/46395/47/src/soc/mediatek/mt8183/rt... PS47, Line 253: low power detect function. */ code indent should use tabs where possible
https://review.coreboot.org/c/coreboot/+/46395/47/src/soc/mediatek/mt8192/rt... File src/soc/mediatek/mt8192/rtc.c:
https://review.coreboot.org/c/coreboot/+/46395/47/src/soc/mediatek/mt8192/rt... PS47, Line 271: low power detect function. */ code indent should use tabs where possible
Yuchen Huang has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/46395 )
Change subject: soc/mediatek/mt8192: add rtc MT6359P driver ......................................................................
Patch Set 47:
(10 comments)
https://review.coreboot.org/c/coreboot/+/46395/4//COMMIT_MSG Commit Message:
https://review.coreboot.org/c/coreboot/+/46395/4//COMMIT_MSG@9 PS4, Line 9: Add rtc MT6359P driver.
Please elaborate and add the datasheet name an revision.
Done
https://review.coreboot.org/c/coreboot/+/46395/4//COMMIT_MSG@10 PS4, Line 10:
Why can’t more common code be used?
Done
https://review.coreboot.org/c/coreboot/+/46395/4/src/soc/mediatek/mt8192/rtc... File src/soc/mediatek/mt8192/rtc.c:
https://review.coreboot.org/c/coreboot/+/46395/4/src/soc/mediatek/mt8192/rtc... PS4, Line 31: pmif_arb->read_cmd
Why isn’t data of type `void`?
fixed in ps46
https://review.coreboot.org/c/coreboot/+/46395/4/src/soc/mediatek/mt8192/rtc... PS4, Line 51: dcxo clock
What is dcxo?
DCXO is a modue in PMIC. The 32K clock of MT6359 RTC comes from DCXO 26M by default.
https://review.coreboot.org/c/coreboot/+/46395/4/src/soc/mediatek/mt8192/rtc... PS4, Line 307: rtc_write(RTC_BBPU, (bbpu | RTC_BBPU_KEY | RTC_BBPU_RESET_ALARM | RTC_BBPU_RESET_SPAR) & (~RTC_BBPU_SPAR_SW));
line over 96 characters
done
https://review.coreboot.org/c/coreboot/+/46395/4/src/soc/mediatek/mt8192/rtc... PS4, Line 350: //rtc_osc_init();
Why?
Done
https://review.coreboot.org/c/coreboot/+/46395/4/src/soc/mediatek/mt8192/rtc... PS4, Line 353: mdelay(20);
Please add a comment why 20 ms delay is needed.
Done. In recovery mode, We need 20ms delay for register setting.
https://review.coreboot.org/c/coreboot/+/46395/4/src/soc/mediatek/mt8192/rtc... PS4, Line 376: */
Please use one of the recommended styles [1]. […]
Done
https://review.coreboot.org/c/coreboot/+/46395/4/src/soc/mediatek/mt8192/rtc... PS4, Line 387: bbpu
What is that?
BBPU means 'baseband power up' which is a control register of RTC.
https://review.coreboot.org/c/coreboot/+/46395/4/src/soc/mediatek/mt8192/rtc... PS4, Line 443: //rtc_write_field(PMIC_RG_DCXO_CW12, 0x0, 0x1, 0);
Why is this commented out?
Done
Yuchen Huang has uploaded a new patch set (#48) to the change originally created by Yidi Lin. ( https://review.coreboot.org/c/coreboot/+/46395 )
Change subject: soc/mediatek/mt8192: add rtc MT6359P driver ......................................................................
soc/mediatek/mt8192: add rtc MT6359P driver
Add rtc MT6359P driver for rtc init and rtc eosc calibration.
Reference datasheet: Document No: RH-D-2018-0101.
Signed-off-by: Yuchen Huang yuchen.huang@mediatek.corp-partner.google.com Change-Id: I57d6738fdec148c7458b2024a0a8225415ca2f3e --- M src/soc/mediatek/common/include/soc/rtc_common.h M src/soc/mediatek/common/rtc.c A src/soc/mediatek/common/rtc_osc_init.c M src/soc/mediatek/mt8173/include/soc/rtc.h M src/soc/mediatek/mt8173/rtc.c M src/soc/mediatek/mt8183/Makefile.inc M src/soc/mediatek/mt8183/include/soc/rtc.h M src/soc/mediatek/mt8183/rtc.c M src/soc/mediatek/mt8192/Makefile.inc M src/soc/mediatek/mt8192/bootblock.c A src/soc/mediatek/mt8192/include/soc/rtc.h A src/soc/mediatek/mt8192/rtc.c 12 files changed, 767 insertions(+), 129 deletions(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/95/46395/48
Yuchen Huang has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/46395 )
Change subject: soc/mediatek/mt8192: add rtc MT6359P driver ......................................................................
Patch Set 48:
(2 comments)
https://review.coreboot.org/c/coreboot/+/46395/47/src/soc/mediatek/mt8183/rt... File src/soc/mediatek/mt8183/rtc.c:
https://review.coreboot.org/c/coreboot/+/46395/47/src/soc/mediatek/mt8183/rt... PS47, Line 253: low power detect function. */
code indent should use tabs where possible
fixed
https://review.coreboot.org/c/coreboot/+/46395/47/src/soc/mediatek/mt8192/rt... File src/soc/mediatek/mt8192/rtc.c:
https://review.coreboot.org/c/coreboot/+/46395/47/src/soc/mediatek/mt8192/rt... PS47, Line 271: low power detect function. */
code indent should use tabs where possible
fixed
Yuchen Huang has uploaded a new patch set (#49) to the change originally created by Yidi Lin. ( https://review.coreboot.org/c/coreboot/+/46395 )
Change subject: soc/mediatek/mt8192: add rtc MT6359P driver ......................................................................
soc/mediatek/mt8192: add rtc MT6359P driver
Add rtc MT6359P driver for rtc init and rtc eosc calibration.
Reference datasheet: Document No: RH-D-2018-0101.
Signed-off-by: Yuchen Huang yuchen.huang@mediatek.corp-partner.google.com Change-Id: I57d6738fdec148c7458b2024a0a8225415ca2f3e --- M src/soc/mediatek/common/include/soc/rtc_common.h M src/soc/mediatek/common/rtc.c A src/soc/mediatek/common/rtc_osc_init.c M src/soc/mediatek/mt8173/include/soc/rtc.h M src/soc/mediatek/mt8173/rtc.c M src/soc/mediatek/mt8183/Makefile.inc M src/soc/mediatek/mt8183/include/soc/rtc.h M src/soc/mediatek/mt8183/rtc.c M src/soc/mediatek/mt8192/Makefile.inc M src/soc/mediatek/mt8192/bootblock.c A src/soc/mediatek/mt8192/include/soc/rtc.h A src/soc/mediatek/mt8192/rtc.c 12 files changed, 771 insertions(+), 128 deletions(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/95/46395/49
Yidi Lin has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/46395 )
Change subject: soc/mediatek/mt8192: add rtc MT6359P driver ......................................................................
Patch Set 51:
Hung-Te & Yu-Ping,
Please review this patch.
Yu-Ping Wu has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/46395 )
Change subject: soc/mediatek/mt8192: add rtc MT6359P driver ......................................................................
Patch Set 51:
(29 comments)
https://review.coreboot.org/c/coreboot/+/46395/51//COMMIT_MSG Commit Message:
https://review.coreboot.org/c/coreboot/+/46395/51//COMMIT_MSG@8 PS51, Line 8: Since it's not trivial to me, could you mention how the code is "refactored" (by moving between files)? For example, why the code mt8173 and mt8183 needs to be changed?
https://review.coreboot.org/c/coreboot/+/46395/51/src/soc/mediatek/common/rt... File src/soc/mediatek/common/rtc.c:
https://review.coreboot.org/c/coreboot/+/46395/51/src/soc/mediatek/common/rt... PS51, Line 103: 0 Does 0 mean success or failure here?
https://review.coreboot.org/c/coreboot/+/46395/51/src/soc/mediatek/common/rt... File src/soc/mediatek/common/rtc_osc_init.c:
https://review.coreboot.org/c/coreboot/+/46395/51/src/soc/mediatek/common/rt... PS51, Line 4: #include <soc/rtc.h> rtc.h should come before rtc_common.h
https://review.coreboot.org/c/coreboot/+/46395/51/src/soc/mediatek/common/rt... PS51, Line 9: diff1, diff2 diff_left, diff_right
https://review.coreboot.org/c/coreboot/+/46395/51/src/soc/mediatek/common/rt... PS51, Line 10: = 0 No need to initialize this and "middle".
https://review.coreboot.org/c/coreboot/+/46395/51/src/soc/mediatek/common/rt... PS51, Line 20: 0x%x %#x
https://review.coreboot.org/c/coreboot/+/46395/51/src/soc/mediatek/common/rt... PS51, Line 34: Remove extra blank line.
https://review.coreboot.org/c/coreboot/+/46395/51/src/soc/mediatek/common/rt... PS51, Line 44: if (val > RTC_FQMTR_LOW_BASE) : diff1 = val - RTC_FQMTR_LOW_BASE; : else : diff1 = RTC_FQMTR_LOW_BASE - val; This can be simplified to
diff1 = ABS(val - RTC_FQMTR_LOW_BASE)
Same for diff2.
https://review.coreboot.org/c/coreboot/+/46395/51/src/soc/mediatek/common/rt... PS51, Line 56: : One space after ":"
https://review.coreboot.org/c/coreboot/+/46395/51/src/soc/mediatek/common/rt... PS51, Line 69: C Please be consistent with the case (C or c).
https://review.coreboot.org/c/coreboot/+/46395/51/src/soc/mediatek/mt8173/in... File src/soc/mediatek/mt8173/include/soc/rtc.h:
https://review.coreboot.org/c/coreboot/+/46395/51/src/soc/mediatek/mt8173/in... PS51, Line 111: fail failed
https://review.coreboot.org/c/coreboot/+/46395/51/src/soc/mediatek/mt8173/in... PS51, Line 122: fail failed
https://review.coreboot.org/c/coreboot/+/46395/51/src/soc/mediatek/mt8173/rt... File src/soc/mediatek/mt8173/rtc.c:
https://review.coreboot.org/c/coreboot/+/46395/51/src/soc/mediatek/mt8173/rt... PS51, Line 87: W w
https://review.coreboot.org/c/coreboot/+/46395/51/src/soc/mediatek/mt8173/rt... PS51, Line 87: . No period for consistency with comments above.
https://review.coreboot.org/c/coreboot/+/46395/51/src/soc/mediatek/mt8173/rt... PS51, Line 87: i I
https://review.coreboot.org/c/coreboot/+/46395/51/src/soc/mediatek/mt8183/in... File src/soc/mediatek/mt8183/include/soc/rtc.h:
https://review.coreboot.org/c/coreboot/+/46395/51/src/soc/mediatek/mt8183/in... PS51, Line 219: fail failed
https://review.coreboot.org/c/coreboot/+/46395/51/src/soc/mediatek/mt8183/in... PS51, Line 230: fail failed
https://review.coreboot.org/c/coreboot/+/46395/51/src/soc/mediatek/mt8183/rt... File src/soc/mediatek/mt8183/rtc.c:
https://review.coreboot.org/c/coreboot/+/46395/51/src/soc/mediatek/mt8183/rt... PS51, Line 228: /* in recovery mode, We need 20ms delay for register setting. */ Same.
https://review.coreboot.org/c/coreboot/+/46395/51/src/soc/mediatek/mt8192/in... File src/soc/mediatek/mt8192/include/soc/rtc.h:
https://review.coreboot.org/c/coreboot/+/46395/51/src/soc/mediatek/mt8192/in... PS51, Line 14: E Could you add a "," for all the enums in this file?
https://review.coreboot.org/c/coreboot/+/46395/51/src/soc/mediatek/mt8192/in... PS51, Line 89: to low low
https://review.coreboot.org/c/coreboot/+/46395/51/src/soc/mediatek/mt8192/in... PS51, Line 89: lower leakage current hw design change What does that mean?
https://review.coreboot.org/c/coreboot/+/46395/51/src/soc/mediatek/mt8192/rt... File src/soc/mediatek/mt8192/rtc.c:
https://review.coreboot.org/c/coreboot/+/46395/51/src/soc/mediatek/mt8192/rt... PS51, Line 21: (unsigned int) Do we need the cast? Same below.
Even if we do, the type should be u32.
https://review.coreboot.org/c/coreboot/+/46395/51/src/soc/mediatek/mt8192/rt... PS51, Line 46: /* Unlock for reload */ Move to its own line.
https://review.coreboot.org/c/coreboot/+/46395/51/src/soc/mediatek/mt8192/rt... PS51, Line 67: 0x%x %#x
https://review.coreboot.org/c/coreboot/+/46395/51/src/soc/mediatek/mt8192/rt... PS51, Line 136: out !! out!
https://review.coreboot.org/c/coreboot/+/46395/51/src/soc/mediatek/mt8192/rt... PS51, Line 220: u8 If this is boolean, please use native type such as int.
https://review.coreboot.org/c/coreboot/+/46395/51/src/soc/mediatek/mt8192/rt... PS51, Line 241: W w
https://review.coreboot.org/c/coreboot/+/46395/51/src/soc/mediatek/mt8192/rt... PS51, Line 241: i I
https://review.coreboot.org/c/coreboot/+/46395/51/src/soc/mediatek/mt8192/rt... PS51, Line 319: 0x%x %#x
Same for all occurrences in this file.
Yuchen Huang has uploaded a new patch set (#52) to the change originally created by Yidi Lin. ( https://review.coreboot.org/c/coreboot/+/46395 )
Change subject: soc/mediatek/mt8192: add rtc MT6359P driver ......................................................................
soc/mediatek/mt8192: add rtc MT6359P driver
Add rtc MT6359P driver for rtc init and rtc eosc calibration. And refactor 8173 and 8183 code, extract common API for common useage.
Reference datasheet: Document No: RH-D-2018-0101.
Signed-off-by: Yuchen Huang yuchen.huang@mediatek.corp-partner.google.com Change-Id: I57d6738fdec148c7458b2024a0a8225415ca2f3e --- M src/soc/mediatek/common/include/soc/rtc_common.h M src/soc/mediatek/common/rtc.c A src/soc/mediatek/common/rtc_osc_init.c M src/soc/mediatek/mt8173/include/soc/rtc.h M src/soc/mediatek/mt8173/rtc.c M src/soc/mediatek/mt8183/Makefile.inc M src/soc/mediatek/mt8183/include/soc/rtc.h M src/soc/mediatek/mt8183/rtc.c M src/soc/mediatek/mt8192/Makefile.inc M src/soc/mediatek/mt8192/bootblock.c A src/soc/mediatek/mt8192/include/soc/rtc.h A src/soc/mediatek/mt8192/rtc.c 12 files changed, 775 insertions(+), 168 deletions(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/95/46395/52
Yuchen Huang has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/46395 )
Change subject: soc/mediatek/mt8192: add rtc MT6359P driver ......................................................................
Patch Set 52:
(29 comments)
https://review.coreboot.org/c/coreboot/+/46395/51//COMMIT_MSG Commit Message:
https://review.coreboot.org/c/coreboot/+/46395/51//COMMIT_MSG@8 PS51, Line 8:
Since it's not trivial to me, could you mention how the code is "refactored" (by moving between file […]
Done
https://review.coreboot.org/c/coreboot/+/46395/51/src/soc/mediatek/common/rt... File src/soc/mediatek/common/rtc.c:
https://review.coreboot.org/c/coreboot/+/46395/51/src/soc/mediatek/common/rt... PS51, Line 103: 0
Does 0 mean success or failure here?
0 here means failure. This is consistent in the rtc coreboot driver
https://review.coreboot.org/c/coreboot/+/46395/51/src/soc/mediatek/common/rt... File src/soc/mediatek/common/rtc_osc_init.c:
https://review.coreboot.org/c/coreboot/+/46395/51/src/soc/mediatek/common/rt... PS51, Line 4: #include <soc/rtc.h>
rtc.h should come before rtc_common. […]
Done
https://review.coreboot.org/c/coreboot/+/46395/51/src/soc/mediatek/common/rt... PS51, Line 9: diff1, diff2
diff_left, diff_right
Done
https://review.coreboot.org/c/coreboot/+/46395/51/src/soc/mediatek/common/rt... PS51, Line 10: = 0
No need to initialize this and "middle".
Done
https://review.coreboot.org/c/coreboot/+/46395/51/src/soc/mediatek/common/rt... PS51, Line 20: 0x%x
%#x
Done
https://review.coreboot.org/c/coreboot/+/46395/51/src/soc/mediatek/common/rt... PS51, Line 34:
Remove extra blank line.
Done
https://review.coreboot.org/c/coreboot/+/46395/51/src/soc/mediatek/common/rt... PS51, Line 44: if (val > RTC_FQMTR_LOW_BASE) : diff1 = val - RTC_FQMTR_LOW_BASE; : else : diff1 = RTC_FQMTR_LOW_BASE - val;
This can be simplified to […]
Ack
https://review.coreboot.org/c/coreboot/+/46395/51/src/soc/mediatek/common/rt... PS51, Line 56: :
One space after ":"
Done
https://review.coreboot.org/c/coreboot/+/46395/51/src/soc/mediatek/common/rt... PS51, Line 69: C
Please be consistent with the case (C or c).
Done
https://review.coreboot.org/c/coreboot/+/46395/51/src/soc/mediatek/mt8173/in... File src/soc/mediatek/mt8173/include/soc/rtc.h:
https://review.coreboot.org/c/coreboot/+/46395/51/src/soc/mediatek/mt8173/in... PS51, Line 111: fail
failed
Done
https://review.coreboot.org/c/coreboot/+/46395/51/src/soc/mediatek/mt8173/in... PS51, Line 122: fail
failed
Done
https://review.coreboot.org/c/coreboot/+/46395/51/src/soc/mediatek/mt8173/rt... File src/soc/mediatek/mt8173/rtc.c:
https://review.coreboot.org/c/coreboot/+/46395/51/src/soc/mediatek/mt8173/rt... PS51, Line 87: .
No period for consistency with comments above.
Ack
https://review.coreboot.org/c/coreboot/+/46395/51/src/soc/mediatek/mt8173/rt... PS51, Line 87: i
I
Done
https://review.coreboot.org/c/coreboot/+/46395/51/src/soc/mediatek/mt8173/rt... PS51, Line 87: W
w
Done
https://review.coreboot.org/c/coreboot/+/46395/51/src/soc/mediatek/mt8183/in... File src/soc/mediatek/mt8183/include/soc/rtc.h:
https://review.coreboot.org/c/coreboot/+/46395/51/src/soc/mediatek/mt8183/in... PS51, Line 219: fail
failed
Done
https://review.coreboot.org/c/coreboot/+/46395/51/src/soc/mediatek/mt8183/in... PS51, Line 230: fail
failed
Done
https://review.coreboot.org/c/coreboot/+/46395/51/src/soc/mediatek/mt8183/rt... File src/soc/mediatek/mt8183/rtc.c:
https://review.coreboot.org/c/coreboot/+/46395/51/src/soc/mediatek/mt8183/rt... PS51, Line 228: /* in recovery mode, We need 20ms delay for register setting. */
Same.
Done
https://review.coreboot.org/c/coreboot/+/46395/51/src/soc/mediatek/mt8192/in... File src/soc/mediatek/mt8192/include/soc/rtc.h:
https://review.coreboot.org/c/coreboot/+/46395/51/src/soc/mediatek/mt8192/in... PS51, Line 14: E
Could you add a "," for all the enums in this file?
Done
https://review.coreboot.org/c/coreboot/+/46395/51/src/soc/mediatek/mt8192/in... PS51, Line 89: to low
low
Ack
https://review.coreboot.org/c/coreboot/+/46395/51/src/soc/mediatek/mt8192/in... PS51, Line 89: lower leakage current hw design change
What does that mean?
Ack
https://review.coreboot.org/c/coreboot/+/46395/51/src/soc/mediatek/mt8192/rt... File src/soc/mediatek/mt8192/rtc.c:
https://review.coreboot.org/c/coreboot/+/46395/51/src/soc/mediatek/mt8192/rt... PS51, Line 21: (unsigned int)
Do we need the cast? Same below. […]
Done
https://review.coreboot.org/c/coreboot/+/46395/51/src/soc/mediatek/mt8192/rt... PS51, Line 46: /* Unlock for reload */
Move to its own line.
Ack
https://review.coreboot.org/c/coreboot/+/46395/51/src/soc/mediatek/mt8192/rt... PS51, Line 67: 0x%x
%#x
Done
https://review.coreboot.org/c/coreboot/+/46395/51/src/soc/mediatek/mt8192/rt... PS51, Line 136: out !!
out!
Done
https://review.coreboot.org/c/coreboot/+/46395/51/src/soc/mediatek/mt8192/rt... PS51, Line 220: u8
If this is boolean, please use native type such as int.
Done
https://review.coreboot.org/c/coreboot/+/46395/51/src/soc/mediatek/mt8192/rt... PS51, Line 241: i
I
Done
https://review.coreboot.org/c/coreboot/+/46395/51/src/soc/mediatek/mt8192/rt... PS51, Line 241: W
w
Done
https://review.coreboot.org/c/coreboot/+/46395/51/src/soc/mediatek/mt8192/rt... PS51, Line 319: 0x%x
%#x […]
Done
Yuchen Huang has uploaded a new patch set (#53) to the change originally created by Yidi Lin. ( https://review.coreboot.org/c/coreboot/+/46395 )
Change subject: soc/mediatek/mt8192: add rtc MT6359P driver ......................................................................
soc/mediatek/mt8192: add rtc MT6359P driver
Add rtc MT6359P driver for rtc init and rtc eosc calibration. Refactor 8173 and 8183 code, extract common API for common useage. Refactor rtc_read and rtc_write interface,8173 and 8183 access RTC via pmic_wrap while 8192 via pmif
Reference datasheet: Document No: RH-D-2018-0101.
Signed-off-by: Yuchen Huang yuchen.huang@mediatek.corp-partner.google.com Change-Id: I57d6738fdec148c7458b2024a0a8225415ca2f3e --- M src/soc/mediatek/common/include/soc/rtc_common.h M src/soc/mediatek/common/rtc.c A src/soc/mediatek/common/rtc_osc_init.c M src/soc/mediatek/mt8173/include/soc/rtc.h M src/soc/mediatek/mt8173/rtc.c M src/soc/mediatek/mt8183/Makefile.inc M src/soc/mediatek/mt8183/include/soc/rtc.h M src/soc/mediatek/mt8183/rtc.c M src/soc/mediatek/mt8192/Makefile.inc M src/soc/mediatek/mt8192/bootblock.c A src/soc/mediatek/mt8192/include/soc/rtc.h A src/soc/mediatek/mt8192/rtc.c 12 files changed, 775 insertions(+), 166 deletions(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/95/46395/53
Yidi Lin has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/46395 )
Change subject: soc/mediatek/mt8192: add rtc MT6359P driver ......................................................................
Patch Set 53:
(3 comments)
https://review.coreboot.org/c/coreboot/+/46395/51//COMMIT_MSG Commit Message:
https://review.coreboot.org/c/coreboot/+/46395/51//COMMIT_MSG@8 PS51, Line 8:
Done
We change the code for mt8173 and mt8183 for these two reasons. 1. Move rtc_read and rtc_write to SoC folder. - mt8173 and mt8183 accesses RTC via pmic wrapper. - mt8192 accesses RTC via PMIF.
2. Following functions can share with mt8192. Move them to common/. - rtc_lpen - rtc_powerkey_init - rtc_eosc_cali - rtc_osc_init
https://review.coreboot.org/c/coreboot/+/46395/53/src/soc/mediatek/common/in... File src/soc/mediatek/common/include/soc/rtc_common.h:
https://review.coreboot.org/c/coreboot/+/46395/53/src/soc/mediatek/common/in... PS53, Line 8: <soc/rtc.h> rtc.h
https://review.coreboot.org/c/coreboot/+/46395/51/src/soc/mediatek/common/rt... File src/soc/mediatek/common/rtc.c:
https://review.coreboot.org/c/coreboot/+/46395/51/src/soc/mediatek/common/rt... PS51, Line 47: int rtc_set(const struct rtc_time *time) : { : return -1; : } : : /* get rtc time */ : int rtc_get(struct rtc_time *time) : { : u16 value; : : rtc_read(RTC_TC_SEC, &value); : time->sec = value; : rtc_read(RTC_TC_MIN, &value); : time->min = value; : rtc_read(RTC_TC_HOU, &value); : time->hour = value; : rtc_read(RTC_TC_DOM, &value); : time->mday = value; : rtc_read(RTC_TC_MTH, &value); : time->mon = value; : rtc_read(RTC_TC_YEA, &value); : time->year = (value + RTC_MIN_YEAR_OFFSET) % 100; : : return 0; : } : these two functions is needed for src/include/rtc.h
Yuchen Huang has uploaded a new patch set (#54) to the change originally created by Yidi Lin. ( https://review.coreboot.org/c/coreboot/+/46395 )
Change subject: soc/mediatek/mt8192: add rtc MT6359P driver ......................................................................
soc/mediatek/mt8192: add rtc MT6359P driver
Add rtc MT6359P driver for rtc init and rtc eosc calibration. Refactor 8173 and 8183 code, extract common API for common useage. Refactor rtc_read and rtc_write interface,8173 and 8183 access RTC via pmic_wrap while 8192 via pmif
Reference datasheet: Document No: RH-D-2018-0101.
Signed-off-by: Yuchen Huang yuchen.huang@mediatek.corp-partner.google.com Change-Id: I57d6738fdec148c7458b2024a0a8225415ca2f3e --- M src/soc/mediatek/common/include/soc/rtc_common.h M src/soc/mediatek/common/rtc.c A src/soc/mediatek/common/rtc_osc_init.c M src/soc/mediatek/mt8173/include/soc/rtc.h M src/soc/mediatek/mt8173/rtc.c M src/soc/mediatek/mt8183/Makefile.inc M src/soc/mediatek/mt8183/include/soc/rtc.h M src/soc/mediatek/mt8183/rtc.c M src/soc/mediatek/mt8192/Makefile.inc M src/soc/mediatek/mt8192/bootblock.c A src/soc/mediatek/mt8192/include/soc/rtc.h A src/soc/mediatek/mt8192/rtc.c 12 files changed, 776 insertions(+), 138 deletions(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/95/46395/54
Yuchen Huang has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/46395 )
Change subject: soc/mediatek/mt8192: add rtc MT6359P driver ......................................................................
Patch Set 54:
(2 comments)
https://review.coreboot.org/c/coreboot/+/46395/53/src/soc/mediatek/common/in... File src/soc/mediatek/common/include/soc/rtc_common.h:
https://review.coreboot.org/c/coreboot/+/46395/53/src/soc/mediatek/common/in... PS53, Line 8: <soc/rtc.h>
rtc. […]
Done
https://review.coreboot.org/c/coreboot/+/46395/51/src/soc/mediatek/common/rt... File src/soc/mediatek/common/rtc.c:
https://review.coreboot.org/c/coreboot/+/46395/51/src/soc/mediatek/common/rt... PS51, Line 47: int rtc_set(const struct rtc_time *time) : { : return -1; : } : : /* get rtc time */ : int rtc_get(struct rtc_time *time) : { : u16 value; : : rtc_read(RTC_TC_SEC, &value); : time->sec = value; : rtc_read(RTC_TC_MIN, &value); : time->min = value; : rtc_read(RTC_TC_HOU, &value); : time->hour = value; : rtc_read(RTC_TC_DOM, &value); : time->mday = value; : rtc_read(RTC_TC_MTH, &value); : time->mon = value; : rtc_read(RTC_TC_YEA, &value); : time->year = (value + RTC_MIN_YEAR_OFFSET) % 100; : : return 0; : } :
these two functions is needed for src/include/rtc. […]
Ack
Hello Hung-Te Lin, build bot (Jenkins), Patrick Georgi, Martin Roth, YuCheng Hung, Yuchen Huang,
I'd like you to reexamine a change. Please visit
https://review.coreboot.org/c/coreboot/+/46395
to look at the new patch set (#55).
Change subject: soc/mediatek/mt8192: add rtc MT6359P driver ......................................................................
soc/mediatek/mt8192: add rtc MT6359P driver
Add rtc MT6359P driver for rtc init and rtc eosc calibration. Refactor 8173 and 8183 code, extract common API for common useage. Refactor rtc_read and rtc_write interface,8173 and 8183 access RTC via pmic_wrap while 8192 via pmif
Reference datasheet: Document No: RH-D-2018-0101.
Signed-off-by: Yuchen Huang yuchen.huang@mediatek.corp-partner.google.com Change-Id: I57d6738fdec148c7458b2024a0a8225415ca2f3e --- M src/soc/mediatek/common/include/soc/rtc_common.h M src/soc/mediatek/common/rtc.c A src/soc/mediatek/common/rtc_osc_init.c M src/soc/mediatek/mt8173/include/soc/rtc.h M src/soc/mediatek/mt8173/rtc.c M src/soc/mediatek/mt8183/Makefile.inc M src/soc/mediatek/mt8183/include/soc/rtc.h M src/soc/mediatek/mt8183/rtc.c M src/soc/mediatek/mt8192/Makefile.inc M src/soc/mediatek/mt8192/bootblock.c A src/soc/mediatek/mt8192/include/soc/rtc.h A src/soc/mediatek/mt8192/rtc.c 12 files changed, 777 insertions(+), 137 deletions(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/95/46395/55
Yidi Lin has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/46395 )
Change subject: soc/mediatek/mt8192: add rtc MT6359P driver ......................................................................
Patch Set 55:
Fix build failure on kukui and oak.
Yu-Ping Wu has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/46395 )
Change subject: soc/mediatek/mt8192: add rtc MT6359P driver ......................................................................
Patch Set 56:
(10 comments)
https://review.coreboot.org/c/coreboot/+/46395/56//COMMIT_MSG Commit Message:
https://review.coreboot.org/c/coreboot/+/46395/56//COMMIT_MSG@10 PS56, Line 10: Refactor 8173 and 8183 code, extract common API for common useage. Refactor mt8173 and mt8183 code by extracting common API.
Please put as many words in a line as possible (without exceeding 72 characters).
https://review.coreboot.org/c/coreboot/+/46395/56//COMMIT_MSG@11 PS56, Line 11: Refactor rtc_read and rtc_write interface,8173 and 8183 access RTC via pmic_wrap : while 8192 via pmif Move rtc_read and rtc_write to each SoC folder, because mt8173 and mt8183 access rtc via pmic wrapper, while mt8192 accesses it via pmif.
https://review.coreboot.org/c/coreboot/+/46395/51/src/soc/mediatek/common/rt... File src/soc/mediatek/common/rtc.c:
https://review.coreboot.org/c/coreboot/+/46395/51/src/soc/mediatek/common/rt... PS51, Line 103: 0
0 here means failure. […]
Ack. It seems like all rtc functions (except rtc_init()) are using 1 as the success return value. This is quite confusing and incompatible with the convention.
It'd be nice to upload *another* cleanup patch to fix this. See b/176307061.
https://review.coreboot.org/c/coreboot/+/46395/51/src/soc/mediatek/common/rt... File src/soc/mediatek/common/rtc_osc_init.c:
https://review.coreboot.org/c/coreboot/+/46395/51/src/soc/mediatek/common/rt... PS51, Line 44: if (val > RTC_FQMTR_LOW_BASE) : diff1 = val - RTC_FQMTR_LOW_BASE; : else : diff1 = RTC_FQMTR_LOW_BASE - val;
Ack
Not done.
https://review.coreboot.org/c/coreboot/+/46395/56/src/soc/mediatek/mt8173/rt... File src/soc/mediatek/mt8173/rtc.c:
https://review.coreboot.org/c/coreboot/+/46395/56/src/soc/mediatek/mt8173/rt... PS56, Line 20: /* export 32K clock RTC_32K2V8 */ Since this is irrelevant, let's keep it unchanged.
https://review.coreboot.org/c/coreboot/+/46395/56/src/soc/mediatek/mt8173/rt... PS56, Line 78: /* use SW to detect 32K mode instead of HW */ Since this is irrelevant, let's keep it unchanged.
https://review.coreboot.org/c/coreboot/+/46395/56/src/soc/mediatek/mt8192/rt... File src/soc/mediatek/mt8192/rtc.c:
https://review.coreboot.org/c/coreboot/+/46395/56/src/soc/mediatek/mt8192/rt... PS56, Line 67: 0x%x %#x
https://review.coreboot.org/c/coreboot/+/46395/56/src/soc/mediatek/mt8192/rt... PS56, Line 192: %x Maybe %#x?
https://review.coreboot.org/c/coreboot/+/46395/56/src/soc/mediatek/mt8192/rt... PS56, Line 280: err: Add a blank line before this.
https://review.coreboot.org/c/coreboot/+/46395/56/src/soc/mediatek/mt8192/rt... PS56, Line 281: fail failed
Hello Hung-Te Lin, build bot (Jenkins), Patrick Georgi, Martin Roth, YuCheng Hung, Yuchen Huang,
I'd like you to reexamine a change. Please visit
https://review.coreboot.org/c/coreboot/+/46395
to look at the new patch set (#57).
Change subject: soc/mediatek/mt8192: add rtc MT6359P driver ......................................................................
soc/mediatek/mt8192: add rtc MT6359P driver
Add rtc MT6359P driver for rtc init and rtc eosc calibration. Refactor mt8173 and mt8183 code by extracting common API. Move rtc_read and rtc_write to each SoC folder, because mt8173 and mt8183 access rtc via pmic wrapper, while mt8192 accesses it via pmif.
Reference datasheet: Document No: RH-D-2018-0101.
Signed-off-by: Yuchen Huang yuchen.huang@mediatek.corp-partner.google.com Change-Id: I57d6738fdec148c7458b2024a0a8225415ca2f3e --- M src/soc/mediatek/common/include/soc/rtc_common.h M src/soc/mediatek/common/rtc.c A src/soc/mediatek/common/rtc_osc_init.c M src/soc/mediatek/mt8173/include/soc/rtc.h M src/soc/mediatek/mt8173/rtc.c M src/soc/mediatek/mt8183/Makefile.inc M src/soc/mediatek/mt8183/include/soc/rtc.h M src/soc/mediatek/mt8183/rtc.c M src/soc/mediatek/mt8192/Makefile.inc M src/soc/mediatek/mt8192/bootblock.c A src/soc/mediatek/mt8192/include/soc/rtc.h A src/soc/mediatek/mt8192/rtc.c 12 files changed, 768 insertions(+), 135 deletions(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/95/46395/57
Yidi Lin has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/46395 )
Change subject: soc/mediatek/mt8192: add rtc MT6359P driver ......................................................................
Patch Set 57:
(9 comments)
https://review.coreboot.org/c/coreboot/+/46395/56//COMMIT_MSG Commit Message:
https://review.coreboot.org/c/coreboot/+/46395/56//COMMIT_MSG@10 PS56, Line 10: Refactor 8173 and 8183 code, extract common API for common useage.
Refactor mt8173 and mt8183 code by extracting common API. […]
Done
https://review.coreboot.org/c/coreboot/+/46395/56//COMMIT_MSG@11 PS56, Line 11: Refactor rtc_read and rtc_write interface,8173 and 8183 access RTC via pmic_wrap : while 8192 via pmif
Move rtc_read and rtc_write to each SoC folder, because mt8173 and mt8183 access rtc via pmic wrappe […]
Done
https://review.coreboot.org/c/coreboot/+/46395/51/src/soc/mediatek/common/rt... File src/soc/mediatek/common/rtc_osc_init.c:
https://review.coreboot.org/c/coreboot/+/46395/51/src/soc/mediatek/common/rt... PS51, Line 44: if (val > RTC_FQMTR_LOW_BASE) : diff1 = val - RTC_FQMTR_LOW_BASE; : else : diff1 = RTC_FQMTR_LOW_BASE - val;
Not done.
Done
https://review.coreboot.org/c/coreboot/+/46395/56/src/soc/mediatek/mt8173/rt... File src/soc/mediatek/mt8173/rtc.c:
https://review.coreboot.org/c/coreboot/+/46395/56/src/soc/mediatek/mt8173/rt... PS56, Line 20: /* export 32K clock RTC_32K2V8 */
Since this is irrelevant, let's keep it unchanged.
Done
https://review.coreboot.org/c/coreboot/+/46395/56/src/soc/mediatek/mt8173/rt... PS56, Line 78: /* use SW to detect 32K mode instead of HW */
Since this is irrelevant, let's keep it unchanged.
Done
https://review.coreboot.org/c/coreboot/+/46395/56/src/soc/mediatek/mt8192/rt... File src/soc/mediatek/mt8192/rtc.c:
https://review.coreboot.org/c/coreboot/+/46395/56/src/soc/mediatek/mt8192/rt... PS56, Line 67: 0x%x
%#x
Done
https://review.coreboot.org/c/coreboot/+/46395/56/src/soc/mediatek/mt8192/rt... PS56, Line 192: %x
Maybe %#x?
Done
https://review.coreboot.org/c/coreboot/+/46395/56/src/soc/mediatek/mt8192/rt... PS56, Line 280: err:
Add a blank line before this.
Done
https://review.coreboot.org/c/coreboot/+/46395/56/src/soc/mediatek/mt8192/rt... PS56, Line 281: fail
failed
Done
Yu-Ping Wu has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/46395 )
Change subject: soc/mediatek/mt8192: add rtc MT6359P driver ......................................................................
Patch Set 57: Code-Review+2
Hung-Te Lin has submitted this change. ( https://review.coreboot.org/c/coreboot/+/46395 )
Change subject: soc/mediatek/mt8192: add rtc MT6359P driver ......................................................................
soc/mediatek/mt8192: add rtc MT6359P driver
Add rtc MT6359P driver for rtc init and rtc eosc calibration. Refactor mt8173 and mt8183 code by extracting common API. Move rtc_read and rtc_write to each SoC folder, because mt8173 and mt8183 access rtc via pmic wrapper, while mt8192 accesses it via pmif.
Reference datasheet: Document No: RH-D-2018-0101.
Signed-off-by: Yuchen Huang yuchen.huang@mediatek.corp-partner.google.com Change-Id: I57d6738fdec148c7458b2024a0a8225415ca2f3e Reviewed-on: https://review.coreboot.org/c/coreboot/+/46395 Tested-by: build bot (Jenkins) no-reply@coreboot.org Reviewed-by: Yu-Ping Wu yupingso@google.com --- M src/soc/mediatek/common/include/soc/rtc_common.h M src/soc/mediatek/common/rtc.c A src/soc/mediatek/common/rtc_osc_init.c M src/soc/mediatek/mt8173/include/soc/rtc.h M src/soc/mediatek/mt8173/rtc.c M src/soc/mediatek/mt8183/Makefile.inc M src/soc/mediatek/mt8183/include/soc/rtc.h M src/soc/mediatek/mt8183/rtc.c M src/soc/mediatek/mt8192/Makefile.inc M src/soc/mediatek/mt8192/bootblock.c A src/soc/mediatek/mt8192/include/soc/rtc.h A src/soc/mediatek/mt8192/rtc.c 12 files changed, 768 insertions(+), 135 deletions(-)
Approvals: build bot (Jenkins): Verified Yu-Ping Wu: Looks good to me, approved
diff --git a/src/soc/mediatek/common/include/soc/rtc_common.h b/src/soc/mediatek/common/include/soc/rtc_common.h index 5159f37..7ddb8df 100644 --- a/src/soc/mediatek/common/include/soc/rtc_common.h +++ b/src/soc/mediatek/common/include/soc/rtc_common.h @@ -6,7 +6,6 @@ #include <bcd.h> #include <console/console.h> #include <rtc.h> -#include <soc/pmic_wrap_common.h>
#define RTCTAG "[RTC]" #define rtc_info(fmt, arg ...) printk(BIOS_INFO, RTCTAG "%s,%d: " fmt, \ @@ -99,29 +98,10 @@ int rtc_write_trigger(void); int rtc_writeif_unlock(void); int rtc_xosc_write(u16 val); +int rtc_lpen(u16 con); int rtc_reg_init(void); +void rtc_osc_init(void); +int rtc_powerkey_init(void); void rtc_boot_common(void);
-static inline s32 rtc_read(u16 addr, u16 *rdata) -{ - s32 ret; - - ret = pwrap_read(addr, rdata); - if (ret < 0) - rtc_info("pwrap_read fail: ret=%d\n", ret); - - return ret; -} - -static inline s32 rtc_write(u16 addr, u16 wdata) -{ - s32 ret; - - ret = pwrap_write(addr, wdata); - if (ret < 0) - rtc_info("pwrap_write fail: ret=%d\n", ret); - - return ret; -} - #endif /* SOC_MEDIATEK_RTC_COMMON_H */ diff --git a/src/soc/mediatek/common/rtc.c b/src/soc/mediatek/common/rtc.c index 0925f7f..95bd13b 100644 --- a/src/soc/mediatek/common/rtc.c +++ b/src/soc/mediatek/common/rtc.c @@ -2,7 +2,6 @@
#include <soc/rtc_common.h> #include <soc/rtc.h> -#include <soc/pmic_wrap.h> #include <timer.h>
/* ensure rtc write success */ @@ -94,6 +93,30 @@ return rtc_write_trigger(); }
+/* enable lpd subroutine */ +int rtc_lpen(u16 con) +{ + con &= ~RTC_CON_LPRST; + rtc_write(RTC_CON, con); + + if (!rtc_write_trigger()) + return 0; + + con |= RTC_CON_LPRST; + rtc_write(RTC_CON, con); + + if (!rtc_write_trigger()) + return 0; + + con &= ~RTC_CON_LPRST; + rtc_write(RTC_CON, con); + + if (!rtc_write_trigger()) + return 0; + + return 1; +} + /* initialize rtc related registers */ int rtc_reg_init(void) { @@ -129,6 +152,14 @@ return rtc_write_trigger(); }
+/* write powerkeys to enable rtc functions */ +int rtc_powerkey_init(void) +{ + rtc_write(RTC_POWERKEY1, RTC_POWERKEY1_KEY); + rtc_write(RTC_POWERKEY2, RTC_POWERKEY2_KEY); + return rtc_write_trigger(); +} + static u8 rtc_check_state(void) { u16 con; @@ -164,18 +195,21 @@
switch (rtc_check_state()) { case RTC_STATE_REBOOT: - pwrap_write_field(RTC_BBPU, RTC_BBPU_KEY | RTC_BBPU_RELOAD, - 0xFFFF, 0); + rtc_read(RTC_BBPU, &bbpu); + rtc_write(RTC_BBPU, bbpu | RTC_BBPU_KEY | RTC_BBPU_RELOAD); rtc_write_trigger(); rtc_osc_init(); + rtc_info("RTC_STATE_REBOOT\n"); break; case RTC_STATE_RECOVER: rtc_init(1); + rtc_info("RTC_STATE_RECOVER\n"); break; case RTC_STATE_INIT: default: if (rtc_init(0)) rtc_init(1); + rtc_info("RTC_STATE_INIT\n"); break; }
diff --git a/src/soc/mediatek/common/rtc_osc_init.c b/src/soc/mediatek/common/rtc_osc_init.c new file mode 100644 index 0000000..521e7a0 --- /dev/null +++ b/src/soc/mediatek/common/rtc_osc_init.c @@ -0,0 +1,67 @@ +/* SPDX-License-Identifier: GPL-2.0-only */ + +#include <soc/rtc.h> +#include <soc/rtc_common.h> + +/* 32k clock calibration */ +static int rtc_eosc_cali(void) +{ + u16 diff_left, diff_right, cksel; + u16 val = 0; + u16 middle; + u16 left = RTC_XOSCCALI_START; + u16 right = RTC_XOSCCALI_END; + + rtc_read(PMIC_RG_FQMTR_CKSEL, &cksel); + cksel &= ~PMIC_FQMTR_CKSEL_MASK; + /* select EOSC_32 as fixed clock */ + rtc_write(PMIC_RG_FQMTR_CKSEL, cksel | PMIC_FQMTR_FIX_CLK_EOSC_32K); + rtc_read(PMIC_RG_FQMTR_CKSEL, &cksel); + rtc_info("PMIC_RG_FQMTR_CKSEL=%#x\n", cksel); + + while (left <= right) { + middle = (right + left) / 2; + if (middle == left) + break; + + /* select 26M as target clock */ + val = rtc_get_frequency_meter(middle, PMIC_FQMTR_CON0_FQM26M_CK, 0); + if (val >= RTC_FQMTR_LOW_BASE && val <= RTC_FQMTR_HIGH_BASE) + break; + + if (val > RTC_FQMTR_HIGH_BASE) + right = middle; + else + left = middle; + } + + if (val >= RTC_FQMTR_LOW_BASE && val <= RTC_FQMTR_HIGH_BASE) + return middle; + + val = rtc_get_frequency_meter(left, PMIC_FQMTR_CON0_FQM26M_CK, 0); + diff_left = ABS(val - RTC_FQMTR_LOW_BASE); + + val = rtc_get_frequency_meter(right, PMIC_FQMTR_CON0_FQM26M_CK, 0); + diff_right = ABS(val - RTC_FQMTR_LOW_BASE); + + rtc_info("left: %d, middle: %d, right: %d\n", left, middle, right); + if (diff_left < diff_right) + return left; + else + return right; +} + +void rtc_osc_init(void) +{ + u16 osc32con; + + /* enable 32K export */ + rtc_gpio_init(); + /* calibrate eosc32 for powerdown clock */ + rtc_read(RTC_OSC32CON, &osc32con); + rtc_info("osc32con val = %#x\n", osc32con); + osc32con &= ~RTC_XOSCCALI_MASK; + osc32con |= rtc_eosc_cali() & RTC_XOSCCALI_MASK; + rtc_xosc_write(osc32con); + rtc_info("EOSC32 cali val = %#x\n", osc32con); +} diff --git a/src/soc/mediatek/mt8173/include/soc/rtc.h b/src/soc/mediatek/mt8173/include/soc/rtc.h index d0d3023..bb9425f 100644 --- a/src/soc/mediatek/mt8173/include/soc/rtc.h +++ b/src/soc/mediatek/mt8173/include/soc/rtc.h @@ -3,6 +3,7 @@ #ifndef SOC_MEDIATEK_MT8173_RTC_H #define SOC_MEDIATEK_MT8173_RTC_H
+#include <soc/pmic_wrap_common.h> #include <soc/rtc_common.h> #include <stdint.h> #include "mt6391.h" @@ -98,8 +99,29 @@ };
/* external API */ -void rtc_osc_init(void); -int rtc_init(u8 recover); +int rtc_init(int recover); void rtc_boot(void);
+static inline s32 rtc_read(u16 addr, u16 *rdata) +{ + s32 ret; + + ret = pwrap_read(addr, rdata); + if (ret < 0) + rtc_info("pwrap_read failed: ret=%d\n", ret); + + return ret; +} + +static inline s32 rtc_write(u16 addr, u16 wdata) +{ + s32 ret; + + ret = pwrap_write(addr, wdata); + if (ret < 0) + rtc_info("pwrap_write failed: ret=%d\n", ret); + + return ret; +} + #endif /* SOC_MEDIATEK_MT8173_RTC_H */ diff --git a/src/soc/mediatek/mt8173/rtc.c b/src/soc/mediatek/mt8173/rtc.c index d08de45..94ec421 100644 --- a/src/soc/mediatek/mt8173/rtc.c +++ b/src/soc/mediatek/mt8173/rtc.c @@ -1,8 +1,8 @@ /* SPDX-License-Identifier: GPL-2.0-only */
#include <delay.h> -#include <soc/rtc_common.h> #include <soc/rtc.h> +#include <soc/rtc_common.h> #include <soc/mt6391.h> #include <soc/pmic_wrap.h> #include <types.h> @@ -59,7 +59,7 @@ }
/* rtc init check */ -int rtc_init(u8 recover) +int rtc_init(int recover) { int ret;
@@ -84,6 +84,7 @@ goto err; }
+ /* In recovery mode, we need delay for register setting. */ if (recover) mdelay(1000);
diff --git a/src/soc/mediatek/mt8183/Makefile.inc b/src/soc/mediatek/mt8183/Makefile.inc index 744455d..e0ec810 100644 --- a/src/soc/mediatek/mt8183/Makefile.inc +++ b/src/soc/mediatek/mt8183/Makefile.inc @@ -37,7 +37,7 @@ romstage-y += ../common/mmu_operations.c mmu_operations.c romstage-y += ../common/pll.c pll.c romstage-y += ../common/pmic_wrap.c pmic_wrap.c mt6358.c -romstage-y += ../common/rtc.c rtc.c +romstage-y += ../common/rtc.c ../common/rtc_osc_init.c rtc.c romstage-$(CONFIG_SPI_FLASH) += ../common/spi.c spi.c romstage-y += ../common/i2c.c i2c.c romstage-y += ../common/timer.c @@ -54,7 +54,7 @@ ramstage-y += ../common/mmu_operations.c mmu_operations.c ramstage-y += ../common/mtcmos.c mtcmos.c ramstage-y += ../common/pmic_wrap.c -ramstage-y += ../common/rtc.c rtc.c +ramstage-y += ../common/rtc.c ../common/rtc_osc_init.c rtc.c ramstage-y += soc.c ramstage-$(CONFIG_SPI_FLASH) += ../common/spi.c spi.c ramstage-y += spm.c diff --git a/src/soc/mediatek/mt8183/include/soc/rtc.h b/src/soc/mediatek/mt8183/include/soc/rtc.h index 0e5c598..f7c189f 100644 --- a/src/soc/mediatek/mt8183/include/soc/rtc.h +++ b/src/soc/mediatek/mt8183/include/soc/rtc.h @@ -3,6 +3,7 @@ #ifndef SOC_MEDIATEK_MT8183_RTC_H #define SOC_MEDIATEK_MT8183_RTC_H
+#include <soc/pmic_wrap_common.h> #include <soc/rtc_common.h>
/* RTC registers */ @@ -203,9 +204,32 @@
/* external API */ void rtc_bbpu_power_on(void); -void rtc_osc_init(void); -int rtc_init(u8 recover); +int rtc_init(int recover); +int rtc_gpio_init(void); void rtc_boot(void); +u16 rtc_get_frequency_meter(u16 val, u16 measure_src, u16 window_size); void mt6358_dcxo_disable_unused(void);
+static inline s32 rtc_read(u16 addr, u16 *rdata) +{ + s32 ret; + + ret = pwrap_read(addr, rdata); + if (ret < 0) + rtc_info("pwrap_read failed: ret=%d\n", ret); + + return ret; +} + +static inline s32 rtc_write(u16 addr, u16 wdata) +{ + s32 ret; + + ret = pwrap_write(addr, wdata); + if (ret < 0) + rtc_info("pwrap_write failed: ret=%d\n", ret); + + return ret; +} + #endif /* SOC_MEDIATEK_MT8183_RTC_H */ diff --git a/src/soc/mediatek/mt8183/rtc.c b/src/soc/mediatek/mt8183/rtc.c index 400412f..41dc5c0 100644 --- a/src/soc/mediatek/mt8183/rtc.c +++ b/src/soc/mediatek/mt8183/rtc.c @@ -2,8 +2,8 @@
#include <delay.h> #include <halt.h> -#include <soc/rtc_common.h> #include <soc/rtc.h> +#include <soc/rtc_common.h> #include <soc/mt6358.h> #include <soc/pmic_wrap.h> #include <timer.h> @@ -20,7 +20,7 @@ rtc_write_trigger();
mdelay(1); - if (!rtc_writeif_unlock()) { /* Unlock for reload */ + if (!rtc_writeif_unlock()) { rtc_info("rtc_writeif_unlock() failed\n"); return 0; } @@ -44,7 +44,7 @@ }
/* initialize rtc related gpio */ -static int rtc_gpio_init(void) +int rtc_gpio_init(void) { u16 con;
@@ -67,7 +67,7 @@ return rtc_write_trigger(); }
-static u16 rtc_get_frequency_meter(u16 val, u16 measure_src, u16 window_size) +u16 rtc_get_frequency_meter(u16 val, u16 measure_src, u16 window_size) { u16 bbpu, osc32con; u16 fqmtr_busy, fqmtr_data, fqmtr_rst, fqmtr_tcksel; @@ -142,93 +142,6 @@ return fqmtr_data; }
-/* 32k clock calibration */ -static u16 rtc_eosc_cali(void) -{ - u16 middle, diff1, diff2, cksel; - u16 val = 0; - u16 left = RTC_XOSCCALI_START, right = RTC_XOSCCALI_END; - - rtc_read(PMIC_RG_FQMTR_CKSEL, &cksel); - cksel &= ~PMIC_FQMTR_CKSEL_MASK; - /* select EOSC_32 as fixed clock */ - rtc_write(PMIC_RG_FQMTR_CKSEL, cksel | PMIC_FQMTR_FIX_CLK_EOSC_32K); - rtc_read(PMIC_RG_FQMTR_CKSEL, &cksel); - rtc_info("PMIC_RG_FQMTR_CKSEL=0x%x\n", cksel); - - while (left <= right) { - middle = (right + left) / 2; - if (middle == left) - break; - - /* select 26M as target clock */ - val = rtc_get_frequency_meter(middle, PMIC_FQMTR_CON0_FQM26M_CK, 0); - - if (val >= RTC_FQMTR_LOW_BASE && val <= RTC_FQMTR_HIGH_BASE) - break; - if (val > RTC_FQMTR_HIGH_BASE) - right = middle; - else - left = middle; - } - - if (val >= RTC_FQMTR_LOW_BASE && val <= RTC_FQMTR_HIGH_BASE) - return middle; - - val = rtc_get_frequency_meter(left, PMIC_FQMTR_CON0_FQM26M_CK, 0); - if (val > RTC_FQMTR_LOW_BASE) - diff1 = val - RTC_FQMTR_LOW_BASE; - else - diff1 = RTC_FQMTR_LOW_BASE - val; - - val = rtc_get_frequency_meter(right, PMIC_FQMTR_CON0_FQM26M_CK, 0); - if (val > RTC_FQMTR_LOW_BASE) - diff2 = val - RTC_FQMTR_LOW_BASE; - else - diff2 = RTC_FQMTR_LOW_BASE - val; - - if (diff1 < diff2) - return left; - else - return right; -} - -void rtc_osc_init(void) -{ - u16 osc32con; - - /* enable 32K export */ - rtc_gpio_init(); - - /* Calibrate eosc32 for powerdown clock */ - rtc_read(RTC_OSC32CON, &osc32con); - osc32con &= ~RTC_XOSCCALI_MASK; - osc32con |= rtc_eosc_cali() & RTC_XOSCCALI_MASK; - rtc_xosc_write(osc32con); - rtc_info("EOSC32 cali val = 0x%x\n", osc32con); -} - -/* enable lpd subroutine */ -static int rtc_lpen(u16 con) -{ - con &= ~RTC_CON_LPRST; - rtc_write(RTC_CON, con); - if (!rtc_write_trigger()) - return 0; - - con |= RTC_CON_LPRST; - rtc_write(RTC_CON, con); - if (!rtc_write_trigger()) - return 0; - - con &= ~RTC_CON_LPRST; - rtc_write(RTC_CON, con); - if (!rtc_write_trigger()) - return 0; - - return 1; -} - /* low power detect setting */ static int rtc_lpd_init(void) { @@ -291,16 +204,8 @@ return true; }
-/* write powerkeys to enable rtc functions */ -static int rtc_powerkey_init(void) -{ - rtc_write(RTC_POWERKEY1, RTC_POWERKEY1_KEY); - rtc_write(RTC_POWERKEY2, RTC_POWERKEY2_KEY); - return rtc_write_trigger(); -} - /* rtc init check */ -int rtc_init(u8 recover) +int rtc_init(int recover) { int ret;
@@ -320,6 +225,7 @@
rtc_osc_init();
+ /* In recovery mode, we need 20ms delay for register setting. */ if (recover) mdelay(20);
@@ -343,7 +249,8 @@ goto err; }
- /* After lpd init, powerkeys need to be written again to enable + /* + * After lpd init, powerkeys need to be written again to enable * low power detect function. */ if (!rtc_powerkey_init()) { diff --git a/src/soc/mediatek/mt8192/Makefile.inc b/src/soc/mediatek/mt8192/Makefile.inc index 415acf3..dc6548b 100644 --- a/src/soc/mediatek/mt8192/Makefile.inc +++ b/src/soc/mediatek/mt8192/Makefile.inc @@ -12,6 +12,7 @@ bootblock-y += ../common/uart.c bootblock-y += ../common/wdt.c bootblock-y += pmif.c pmif_clk.c pmif_spi.c pmif_spmi.c +bootblock-y += ../common/rtc.c ../common/rtc_osc_init.c rtc.c bootblock-y += mt6315.c bootblock-y += mt6359p.c
diff --git a/src/soc/mediatek/mt8192/bootblock.c b/src/soc/mediatek/mt8192/bootblock.c index 7987b1c..5295422 100644 --- a/src/soc/mediatek/mt8192/bootblock.c +++ b/src/soc/mediatek/mt8192/bootblock.c @@ -6,6 +6,7 @@ #include <soc/mt6359p.h> #include <soc/pll.h> #include <soc/pmif.h> +#include <soc/rtc.h> #include <soc/wdt.h>
void bootblock_soc_init(void) @@ -16,4 +17,5 @@ mtk_pmif_init(); mt6359p_init(); mt6315_init(); + rtc_boot(); } diff --git a/src/soc/mediatek/mt8192/include/soc/rtc.h b/src/soc/mediatek/mt8192/include/soc/rtc.h new file mode 100644 index 0000000..15e0d2d --- /dev/null +++ b/src/soc/mediatek/mt8192/include/soc/rtc.h @@ -0,0 +1,231 @@ +/* SPDX-License-Identifier: GPL-2.0-only */ + +#ifndef SOC_MEDIATEK_MT8192_RTC_H +#define SOC_MEDIATEK_MT8192_RTC_H + +#include <soc/pmif.h> + +/* RTC registers */ +enum { + RTC_BBPU = 0x0588, + RTC_IRQ_STA = 0x058A, + RTC_IRQ_EN = 0x058C, + RTC_CII_EN = 0x058E, +}; + +enum { + RTC_TC_SEC = 0x0592, + RTC_TC_MIN = 0x0594, + RTC_TC_HOU = 0x0596, + RTC_TC_DOM = 0x0598, + RTC_TC_DOW = 0x059A, + RTC_TC_MTH = 0x059C, + RTC_TC_YEA = 0x059E, +}; + +enum { + RTC_AL_SEC = 0x05A0, + RTC_AL_MIN = 0x05A2, + RTC_AL_HOU = 0x05A4, + RTC_AL_DOM = 0x05A6, + RTC_AL_DOW = 0x05A8, + RTC_AL_MTH = 0x05AA, + RTC_AL_YEA = 0x05AC, + RTC_AL_MASK = 0x0590, +}; + +enum { + RTC_OSC32CON = 0x05AE, + RTC_CON = 0x05C4, + RTC_WRTGR = 0x05C2, +}; + +enum { + RTC_POWERKEY1 = 0x05B0, + RTC_POWERKEY2 = 0x05B2, +}; + +enum { + RTC_PDN1 = 0x05B4, + RTC_PDN2 = 0x05B6, + RTC_SPAR0 = 0x05B8, + RTC_SPAR1 = 0x05BA, + RTC_PROT = 0x05BC, + RTC_DIFF = 0x05BE, + RTC_CALI = 0x05C0, +}; + +enum { + RTC_BBPU_ENABLE_ALARM = 1U << 0, + RTC_BBPU_SPAR_SW = 1U << 1, + RTC_BBPU_RESET_SPAR = 1U << 2, + RTC_BBPU_RESET_ALARM = 1U << 3, + RTC_BBPU_CLRPKY = 1U << 4, + RTC_BBPU_RELOAD = 1U << 5, + RTC_BBPU_CBUSY = 1U << 6, + RTC_CBUSY_TIMEOUT_US = 1000000, +}; + +enum { + RTC_CON_VBAT_LPSTA_RAW = 1U << 0, + RTC_CON_EOSC32_LPEN = 1U << 1, + RTC_CON_XOSC32_LPEN = 1U << 2, + RTC_CON_LPRST = 1U << 3, + RTC_CON_CDBO = 1U << 4, + RTC_CON_F32KOB = 1U << 5, + RTC_CON_GPO = 1U << 6, + RTC_CON_GOE = 1U << 7, + RTC_CON_GSR = 1U << 8, + RTC_CON_GSMT = 1U << 9, + RTC_CON_GPEN = 1U << 10, + RTC_CON_GPU = 1U << 11, + RTC_CON_GE4 = 1U << 12, + RTC_CON_GE8 = 1U << 13, + RTC_CON_GPI = 1U << 14, + RTC_CON_LPSTA_RAW = 1U << 15, +}; + +enum { + RTC_XOSCCALI_MASK = 0x1F << 0, + RTC_XOSC32_ENB = 1U << 5, + RTC_EMB_HW_MODE = 0U << 6, + RTC_EMB_K_EOSC32_MODE = 1U << 6, + RTC_EMB_SW_DCXO_MODE = 2U << 6, + RTC_EMB_SW_EOSC32_MODE = 3U << 6, + RTC_EMBCK_SEL_MODE_MASK = 3U << 6, + RTC_EMBCK_SRC_SEL = 1U << 8, + RTC_EMBCK_SEL_OPTION = 1U << 9, + RTC_GPS_CKOUT_EN = 1U << 10, + RTC_EOSC32_VCT_EN = 1U << 11, + RTC_EOSC32_CHOP_EN = 1U << 12, + RTC_GP_OSC32_CON = 2U << 13, + RTC_REG_XOSC32_ENB = 1U << 15, +}; + +enum { + OSC32CON_ANALOG_SETTING = RTC_GP_OSC32_CON | RTC_EOSC32_CHOP_EN | + RTC_EOSC32_VCT_EN | RTC_GPS_CKOUT_EN | RTC_EMBCK_SEL_OPTION | + RTC_EMB_K_EOSC32_MODE, +}; + +enum { + RTC_LPD_OPT_XOSC_AND_EOSC_LPD = 0U << 13, + RTC_LPD_OPT_EOSC_LPD = 1U << 13, + RTC_LPD_OPT_XOSC_LPD = 2U << 13, + RTC_LPD_OPT_F32K_CK_ALIVE = 3U << 13, + RTC_LPD_OPT_MASK = 3U << 13, +}; + +/* PMIC TOP Register Definition */ +enum { + PMIC_RG_SCK_TOP_CON0 = 0x050C, +}; + +/* PMIC TOP Register Definition */ +enum { + PMIC_RG_TOP_CKPDN_CON0 = 0x010C, + PMIC_RG_TOP_CKPDN_CON0_SET = 0x010E, + PMIC_RG_TOP_CKPDN_CON0_CLR = 0x0110, + PMIC_RG_TOP_CKPDN_CON1 = 0x0112, + PMIC_RG_TOP_CKPDN_CON1_SET = 0x0114, + PMIC_RG_TOP_CKPDN_CON1_CLR = 0x0116, + PMIC_RG_TOP_CKSEL_CON0 = 0x0118, + PMIC_RG_TOP_CKSEL_CON0_SET = 0x011A, + PMIC_RG_TOP_CKSEL_CON0_CLR = 0x011C, +}; + +enum { + PMIC_RG_FQMTR_32K_CK_PDN_SHIFT = 10, + PMIC_RG_FQMTR_CK_PDN_SHIFT = 11, +}; + +enum { + PMIC_RG_BANK_FQMTR_RST = 0x522, +}; + +enum { + PMIC_RG_FQMTR_DCXO26M_EN_SHIFT = 4, + PMIC_RG_BANK_FQMTR_RST_SHIFT = 6, +}; + +/* PMIC DCXO Register Definition */ +enum { + PMIC_RG_DCXO_CW00 = 0x0788, + PMIC_RG_DCXO_CW00_SET = 0x078A, + PMIC_RG_DCXO_CW00_CLR = 0x078C, + PMIC_RG_DCXO_CW02 = 0x0790, + PMIC_RG_DCXO_CW08 = 0x079C, + PMIC_RG_DCXO_CW09 = 0x079E, + PMIC_RG_DCXO_CW09_SET = 0x07A0, + PMIC_RG_DCXO_CW09_CLR = 0x07A2, + PMIC_RG_DCXO_CW12 = 0x07A8, +}; + +/* PMIC Frequency Meter Definition */ +enum { + PMIC_RG_FQMTR_CKSEL = 0x0118, + PMIC_RG_FQMTR_RST = 0x013A, + PMIC_RG_FQMTR_CON0 = 0x0546, + PMIC_RG_FQMTR_WINSET = 0x0548, + PMIC_RG_FQMTR_DATA = 0x054A, + FQMTR_TIMEOUT_US = 8000, +}; + +enum { + PMIC_FQMTR_FIX_CLK_26M = 0U << 0, + PMIC_FQMTR_FIX_CLK_XOSC_32K_DET = 1U << 0, + PMIC_FQMTR_FIX_CLK_EOSC_32K = 2U << 0, + PMIC_FQMTR_FIX_CLK_RTC_32K = 3U << 0, + PMIC_FQMTR_FIX_CLK_DCXO1M_CK = 4U << 0, + PMIC_FQMTR_FIX_CLK_TCK_SEC = 5U << 0, + PMIC_FQMTR_FIX_CLK_PMU_32K = 6U << 0, + PMIC_FQMTR_CKSEL_MASK = 7U << 0, +}; + +enum { + PMIC_FQMTR_RST_SHIFT = 8, +}; + +enum { + PMIC_FQMTR_CON0_XOSC32_CK = 0U << 0, + PMIC_FQMTR_CON0_DCXO_F32K_CK = 1U << 0, + PMIC_FQMTR_CON0_EOSC32_CK = 2U << 0, + PMIC_FQMTR_CON0_XOSC32_CK_DETECTON = 3U << 0, + PMIC_FQMTR_CON0_FQM26M_CK = 4U << 0, + PMIC_FQMTR_CON0_FQM32k_CK = 5U << 0, + PMIC_FQMTR_CON0_TEST_CK = 6U << 0, + PMIC_FQMTR_CON0_TCKSEL_MASK = 7U << 0, + PMIC_FQMTR_CON0_BUSY = 1U << 3, + PMIC_FQMTR_CON0_DCXO26M_EN = 1U << 4, + PMIC_FQMTR_CON0_FQMTR_EN = 1U << 15, +}; + +enum { + RTC_FQMTR_LOW_BASE = 794 - 2, + RTC_FQMTR_HIGH_BASE = 794 + 2, +}; + +enum { + RTC_XOSCCALI_START = 0x00, + RTC_XOSCCALI_END = 0x1f, +}; + +enum { + RTC_TC_MTH_MASK = 0xf, +}; + +enum { + RTC_K_EOSC_RSV_0 = 1 << 8, + RTC_K_EOSC_RSV_1 = 1 << 9, + RTC_K_EOSC_RSV_2 = 1 << 10, +}; + +void rtc_read(u16 addr, u16 *rdata); +void rtc_write(u16 addr, u16 wdata); +void rtc_bbpu_power_on(void); +int rtc_init(int recover); +int rtc_gpio_init(void); +void rtc_boot(void); +u16 rtc_get_frequency_meter(u16 val, u16 measure_src, u16 window_size); +void mt6359_dcxo_disable_unused(void); +#endif /* SOC_MEDIATEK_MT8192_RTC_H */ diff --git a/src/soc/mediatek/mt8192/rtc.c b/src/soc/mediatek/mt8192/rtc.c new file mode 100644 index 0000000..8615873 --- /dev/null +++ b/src/soc/mediatek/mt8192/rtc.c @@ -0,0 +1,364 @@ +/* SPDX-License-Identifier: GPL-2.0-only */ + +#include <delay.h> +#include <halt.h> +#include <soc/mt6359p.h> +#include <soc/pmif.h> +#include <soc/rtc.h> +#include <soc/rtc_common.h> +#include <timer.h> + +#define RTC_GPIO_USER_MASK ((1 << 13) - (1 << 8)) + +static struct pmif *pmif_arb = NULL; + +void rtc_read(u16 addr, u16 *rdata) +{ + u32 data; + + if (pmif_arb == NULL) + pmif_arb = get_pmif_controller(PMIF_SPI, 0); + pmif_arb->read(pmif_arb, 0, (u32)addr, &data); + + *rdata = (u16)data; +} + +void rtc_write(u16 addr, u16 wdata) +{ + if (pmif_arb == NULL) + pmif_arb = get_pmif_controller(PMIF_SPI, 0); + pmif_arb->write(pmif_arb, 0, (unsigned int)addr, (unsigned int)wdata); +} + +static void rtc_write_field(u16 reg, u16 val, u16 mask, u16 shift) +{ + u16 old, new; + + rtc_read(reg, &old); + new = old & ~(mask << shift); + new |= (val << shift); + rtc_write(reg, new); +} + +/* initialize rtc setting of using dcxo clock */ +static int rtc_enable_dcxo(void) +{ + if (!rtc_writeif_unlock()) { + rtc_info("rtc_writeif_unlock() failed\n"); + return 0; + } + + u16 bbpu, con, osc32con, sec; + rtc_read(RTC_BBPU, &bbpu); + rtc_write(RTC_BBPU, bbpu | RTC_BBPU_KEY | RTC_BBPU_RELOAD); + rtc_write_trigger(); + rtc_read(RTC_OSC32CON, &osc32con); + osc32con &= ~(RTC_EMBCK_SRC_SEL | RTC_EMBCK_SEL_MODE_MASK); + osc32con |= (OSC32CON_ANALOG_SETTING | RTC_REG_XOSC32_ENB); + + if (!rtc_xosc_write(osc32con)) { + rtc_info("rtc_xosc_write() failed\n"); + return 0; + } + + rtc_read(RTC_CON, &con); + rtc_read(RTC_OSC32CON, &osc32con); + rtc_read(RTC_AL_SEC, &sec); + rtc_info("con=%#x, osc32con=%#x, sec=%#x\n", con, osc32con, sec); + return 1; +} + +/* initialize rtc related gpio */ +int rtc_gpio_init(void) +{ + u16 con; + + /* GPI mode and pull down */ + rtc_read(RTC_CON, &con); + con &= (RTC_CON_LPSTA_RAW | RTC_CON_LPRST | RTC_CON_EOSC32_LPEN + | RTC_CON_XOSC32_LPEN); + con |= (RTC_CON_GPEN | RTC_CON_GOE); + con &= ~(RTC_CON_F32KOB); + con &= ~RTC_CON_GPU; + rtc_write(RTC_CON, con); + + return rtc_write_trigger(); +} + +u16 rtc_get_frequency_meter(u16 val, u16 measure_src, u16 window_size) +{ + u16 bbpu, osc32con; + u16 fqmtr_busy, fqmtr_data, fqmtr_tcksel; + struct stopwatch sw; + + if (val) { + rtc_read(RTC_BBPU, &bbpu); + rtc_write(RTC_BBPU, bbpu | RTC_BBPU_KEY | RTC_BBPU_RELOAD); + rtc_write_trigger(); + rtc_read(RTC_OSC32CON, &osc32con); + rtc_xosc_write((osc32con & ~RTC_XOSCCALI_MASK) | + (val & RTC_XOSCCALI_MASK)); + } + + /* RG_BANK_FQMTR_RST=1, reset FQMTR*/ + rtc_write_field(PMIC_RG_BANK_FQMTR_RST, 1, 1, + PMIC_RG_BANK_FQMTR_RST_SHIFT); + udelay(20); + /* RG_BANK_FQMTR_RST=0, release FQMTR*/ + rtc_write_field(PMIC_RG_BANK_FQMTR_RST, 0, 1, + PMIC_RG_BANK_FQMTR_RST_SHIFT); + + /* enable FQMTR clock */ + rtc_write_field(PMIC_RG_TOP_CKPDN_CON0_CLR, 1, 1, + PMIC_RG_FQMTR_CK_PDN_SHIFT); + rtc_write_field(PMIC_RG_TOP_CKPDN_CON0_CLR, 1, 1, + PMIC_RG_FQMTR_32K_CK_PDN_SHIFT); + + + rtc_write_field(PMIC_RG_FQMTR_CON0, 1, 1, + PMIC_RG_FQMTR_DCXO26M_EN_SHIFT); + + /* set frequency meter window value (0=1X32K(fixed clock)) */ + rtc_write(PMIC_RG_FQMTR_WINSET, window_size); + /* enable 26M and set test clock source */ + rtc_write(PMIC_RG_FQMTR_CON0, PMIC_FQMTR_CON0_DCXO26M_EN | measure_src); + /* enable 26M -> delay 100us -> enable FQMTR */ + mdelay(1); + rtc_read(PMIC_RG_FQMTR_CON0, &fqmtr_tcksel); + /* enable FQMTR */ + rtc_write(PMIC_RG_FQMTR_CON0, fqmtr_tcksel | PMIC_FQMTR_CON0_FQMTR_EN); + mdelay(1); + stopwatch_init_usecs_expire(&sw, FQMTR_TIMEOUT_US); + /* FQMTR read until ready */ + do { + rtc_read(PMIC_RG_FQMTR_CON0, &fqmtr_busy); + if (stopwatch_expired(&sw)) { + rtc_info("get frequency time out!\n"); + return 0; + } + } while (fqmtr_busy & PMIC_FQMTR_CON0_BUSY); + + /* read data should be closed to 26M/32k = 794 */ + rtc_read(PMIC_RG_FQMTR_DATA, &fqmtr_data); + + /* disable FQMTR */ + rtc_read(PMIC_RG_FQMTR_CON0, &fqmtr_tcksel); + rtc_write(PMIC_RG_FQMTR_CON0, fqmtr_tcksel & ~PMIC_FQMTR_CON0_FQMTR_EN); + /* disable FQMTR -> delay 100us -> disable 26M */ + mdelay(1); + /* disable 26M */ + rtc_read(PMIC_RG_FQMTR_CON0, &fqmtr_tcksel); + rtc_write(PMIC_RG_FQMTR_CON0, + fqmtr_tcksel & ~PMIC_FQMTR_CON0_DCXO26M_EN); + rtc_info("input=%d, output=%d\n", val, fqmtr_data); + + /* disable FQMTR clock */ + rtc_write_field(PMIC_RG_TOP_CKPDN_CON0_SET, 1, 1, + PMIC_RG_FQMTR_CK_PDN_SHIFT); + rtc_write_field(PMIC_RG_TOP_CKPDN_CON0_SET, 1, 1, + PMIC_RG_FQMTR_32K_CK_PDN_SHIFT); + + return fqmtr_data; +} + +/* low power detect setting */ +static int rtc_lpd_init(void) +{ + u16 con, sec; + + /* enable both XOSC & EOSC LPD */ + rtc_read(RTC_AL_SEC, &sec); + sec &= ~RTC_LPD_OPT_F32K_CK_ALIVE; + rtc_write(RTC_AL_SEC, sec); + + if (!rtc_write_trigger()) + return 0; + + /* init XOSC32 to detect 32k clock stop */ + rtc_read(RTC_CON, &con); + con |= RTC_CON_XOSC32_LPEN; + + if (!rtc_lpen(con)) + return 0; + + /* init EOSC32 to detect rtc low power */ + rtc_read(RTC_CON, &con); + con |= RTC_CON_EOSC32_LPEN; + + if (!rtc_lpen(con)) + return 0; + + rtc_read(RTC_CON, &con); + rtc_info("check RTC_CON_LPSTA_RAW after LP init: %#x\n", con); + + return 1; +} + +static bool rtc_hw_init(void) +{ + u16 bbpu; + + rtc_read(RTC_BBPU, &bbpu); + bbpu |= RTC_BBPU_KEY | RTC_BBPU_RESET_ALARM | RTC_BBPU_RESET_SPAR; + rtc_write(RTC_BBPU, bbpu & (~RTC_BBPU_SPAR_SW)); + rtc_write_trigger(); + udelay(500); + + rtc_read(RTC_BBPU, &bbpu); + rtc_write(RTC_BBPU, bbpu | RTC_BBPU_KEY | RTC_BBPU_RELOAD); + rtc_write_trigger(); + rtc_read(RTC_BBPU, &bbpu); + + if (bbpu & RTC_BBPU_RESET_ALARM || bbpu & RTC_BBPU_RESET_SPAR) { + rtc_info("timeout\n"); + return false; + } + return true; +} + +/* rtc init check */ +int rtc_init(int recover) +{ + int ret; + u16 year; + + rtc_info("recovery: %d\n", recover); + + /* write powerkeys to enable rtc functions */ + if (!rtc_powerkey_init()) { + ret = -RTC_STATUS_POWERKEY_INIT_FAIL; + goto err; + } + + /* write interface unlock need to be set after powerkey match */ + if (!rtc_writeif_unlock()) { + ret = -RTC_STATUS_WRITEIF_UNLOCK_FAIL; + goto err; + } + + rtc_osc_init(); + + /* In recovery mode, we need 20ms delay for register setting. */ + if (recover) + mdelay(20); + + if (!rtc_gpio_init()) { + ret = -RTC_STATUS_GPIO_INIT_FAIL; + goto err; + } + + if (!rtc_hw_init()) { + ret = -RTC_STATUS_HW_INIT_FAIL; + goto err; + } + + if (!rtc_reg_init()) { + ret = -RTC_STATUS_REG_INIT_FAIL; + goto err; + } + + /* solution1 for EOSC cali*/ + rtc_read(RTC_AL_YEA, &year); + rtc_write(RTC_AL_YEA, (year | RTC_K_EOSC_RSV_0) & (~RTC_K_EOSC_RSV_1) + & (~RTC_K_EOSC_RSV_2)); + rtc_write_trigger(); + + if (!rtc_lpd_init()) { + ret = -RTC_STATUS_LPD_INIT_FAIL; + goto err; + } + + /* + * After lpd init, powerkeys need to be written again to enable + * low power detect function. + */ + if (!rtc_powerkey_init()) { + ret = -RTC_STATUS_POWERKEY_INIT_FAIL; + goto err; + } + return RTC_STATUS_OK; + +err: + rtc_info("init failed: ret=%d\n", ret); + return ret; +} + +/* enable rtc bbpu */ +void rtc_bbpu_power_on(void) +{ + u16 bbpu; + int ret; + + /* pull powerhold high, control by pmic */ + rtc_write_field(PMIC_PWRHOLD, 1, 0x1, 0); + bbpu = RTC_BBPU_KEY | RTC_BBPU_ENABLE_ALARM; + rtc_write(RTC_BBPU, bbpu); + ret = rtc_write_trigger(); + rtc_info("rtc_write_trigger=%d\n", ret); + rtc_read(RTC_BBPU, &bbpu); + rtc_info("done BBPU=%#x\n", bbpu); +} + +void poweroff(void) +{ + u16 bbpu; + + if (!rtc_writeif_unlock()) + rtc_info("rtc_writeif_unlock() failed\n"); + /* pull PWRBB low */ + bbpu = RTC_BBPU_KEY | RTC_BBPU_ENABLE_ALARM; + rtc_write(RTC_BBPU, bbpu); + rtc_write_field(PMIC_PWRHOLD, 0, 0x1, 0); + halt(); +} + +static void dcxo_init(void) +{ + u16 tmp; + + rtc_read(PMIC_RG_DCXO_CW00, &tmp); + rtc_info("CW00,%#x:%#x\n", PMIC_RG_DCXO_CW00, tmp); + rtc_read(PMIC_RG_DCXO_CW09, &tmp); + rtc_info("CW09,%#x:%#x\n", PMIC_RG_DCXO_CW09, tmp); + rtc_read(PMIC_RG_DCXO_CW08, &tmp); + rtc_info("CW08,%#x:%#x\n", PMIC_RG_DCXO_CW08, tmp); + /* 26M enable control */ + /* enable clock buffer XO_SOC */ + rtc_write_field(PMIC_RG_DCXO_CW00, 0x4005, 0xFFFF, 0); + rtc_read(PMIC_RG_DCXO_CW00, &tmp); + rtc_info("CW0,%#x:%#x\n", PMIC_RG_DCXO_CW00, tmp); + rtc_write_field(PMIC_RG_DCXO_CW09_CLR, 0x3f, 0x3f, 9); + rtc_read(PMIC_RG_DCXO_CW09, &tmp); + rtc_info("PMIC_RG_DCXO_CW09,%#x:%#x\n", PMIC_RG_DCXO_CW09, tmp); + /* mode and buffer controlled by srclken0 */ + rtc_write_field(PMIC_RG_DCXO_CW08, 0x1, 0x1, 2); + rtc_read(PMIC_RG_DCXO_CW08, &tmp); + rtc_info("PMIC_RG_DCXO_CW08,%#x:%#x\n", PMIC_RG_DCXO_CW08, tmp); +} + +void mt6359_dcxo_disable_unused(void) +{ + /* disable HW BBLPM arbiter */ + rtc_write_field(PMIC_RG_DCXO_CW12, 0x2, 0x3, 0); +} + +/* the rtc boot flow entry */ +void rtc_boot(void) +{ + u16 tmp; + + /* dcxo clock init settings */ + dcxo_init(); + /* dcxo 32k init settings */ + rtc_write_field(PMIC_RG_DCXO_CW02, 0xF, 0xF, 0); + rtc_read(PMIC_RG_SCK_TOP_CON0, &tmp); + rtc_info("PMIC_RG_SCK_TOP_CON0,%#x:%#x\n", PMIC_RG_SCK_TOP_CON0, tmp); + rtc_write_field(PMIC_RG_SCK_TOP_CON0, 0x1, 0x1, 0); + rtc_read(PMIC_RG_SCK_TOP_CON0, &tmp); + rtc_info("PMIC_RG_SCK_TOP_CON0,%#x:%#x\n", PMIC_RG_SCK_TOP_CON0, tmp); + /* use dcxo 32K clock */ + if (!rtc_enable_dcxo()) + rtc_info("rtc_enable_dcxo() failed\n"); + rtc_boot_common(); + rtc_bbpu_power_on(); +}