From 7619badb9c3776327724b49948cf17ae9ca8edc2 Mon Sep 17 00:00:00 2001 From: Tero Kristo Date: Sat, 17 Mar 2018 13:32:52 +0530 Subject: ARM: AM43xx: Add support for RTC only + DDR in self-refresh mode Kernel stores information to the RTC_SCRATCH0 and RTC_SCRATCH1 registers for wakeup from RTC-only mode with DDR in self-refresh. Parse these registers during SPL boot and jump to the kernel resume vector if the device is waking up from RTC-only modewith DDR in Self-refresh. The RTC scratch register layout used is: SCRATCH0 : bits00-31 : kernel resume address SCRATCH1 : bits00-15 : RTC magic value used to detect valid config SCRATCH1 : bits16-31 : board type information populated by bootloader During the normal boot path the SCRATCH1 : bits16-31 are updated with the eeprom read board type data. In the rtc_only boot path the rtc scratchpad register is read and the board type is determined and correspondingly ddr dpll parameters are set. This is done so as to avoid costly i2c read to eeprom. RTC-only +DRR in self-refresh mode support is currently only enabled for am43xx_evm_rtconly_config. This is not to be used with epos evm builds. Signed-off-by: Tero Kristo [j-keerthy@ti.com Rebased to latest u-boot master branch] Signed-off-by: Keerthy Reviewed-by: Tom Rini --- board/ti/am43xx/board.c | 56 +++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 56 insertions(+) (limited to 'board/ti/am43xx/board.c') diff --git a/board/ti/am43xx/board.c b/board/ti/am43xx/board.c index 715960a596..d8944ea816 100644 --- a/board/ti/am43xx/board.c +++ b/board/ti/am43xx/board.c @@ -520,6 +520,62 @@ static void enable_vtt_regulator(void) writel(temp, AM33XX_GPIO5_BASE + OMAP_GPIO_OE); } +enum { + RTC_BOARD_EPOS = 1, + RTC_BOARD_EVM14, + RTC_BOARD_EVM12, + RTC_BOARD_GPEVM, + RTC_BOARD_SK, +}; + +/* + * In the rtc_only+DRR in self-refresh boot path we have the board type info + * in the rtc scratch pad register hence we bypass the costly i2c reads to + * eeprom and directly programthe board name string + */ +void rtc_only_update_board_type(u32 btype) +{ + const char *name = ""; + const char *rev = "1.0"; + + switch (btype) { + case RTC_BOARD_EPOS: + name = "AM43EPOS"; + break; + case RTC_BOARD_EVM14: + name = "AM43__GP"; + rev = "1.4"; + break; + case RTC_BOARD_EVM12: + name = "AM43__GP"; + rev = "1.2"; + break; + case RTC_BOARD_GPEVM: + name = "AM43__GP"; + break; + case RTC_BOARD_SK: + name = "AM43__SK"; + break; + } + ti_i2c_eeprom_am_set(name, rev); +} + +u32 rtc_only_get_board_type(void) +{ + if (board_is_eposevm()) + return RTC_BOARD_EPOS; + else if (board_is_evm_14_or_later()) + return RTC_BOARD_EVM14; + else if (board_is_evm_12_or_later()) + return RTC_BOARD_EVM12; + else if (board_is_gpevm()) + return RTC_BOARD_GPEVM; + else if (board_is_sk()) + return RTC_BOARD_SK; + + return 0; +} + void sdram_init(void) { /* -- cgit