Skip to contentSkip to conversation

ARM: AM43xx: Add support for RTC only + DDR in self-refresh mode

PATCH New Keerthy 2 participants 3 messages Mar 17, 2018 – Apr 7, 2018

Subsystems (3)
lore
Share & tools
lore

Keerthy

author
#0 lore raw

PATCH v4 1/2 ARM: AM43xx: Add support for RTC only + DDR in self-refresh mode

From: Tero Kristo <[email protected]>

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.

[j-keerthy at ti.com Rebased to latest u-boot master branch]

---

Changes in v4:

* Added Tero as Author.

Changes in v3:

* Replaced all RTC Only references with RTC Only plus DDR.

Changes in v2:

* Added more description to CONFIG Option.
* Renamed CONFIG_SPL_RTC_ONLY_SUPPORT to CONFIG_SPL_RTC_DDR_SUPPORT
* Added the probable kernel file where RTC Magic value will need to be matched.

 arch/arm/include/asm/arch-am33xx/clock.h  |   6 ++
 arch/arm/mach-omap2/am33xx/Kconfig        |  14 ++++
 arch/arm/mach-omap2/am33xx/board.c        | 110 +++++++++++++++++++++++++++---
 arch/arm/mach-omap2/am33xx/clock.c        |  10 +++
 arch/arm/mach-omap2/am33xx/clock_am43xx.c |  21 ++++++
 board/ti/am43xx/MAINTAINERS               |   1 +
 board/ti/am43xx/board.c                   |  56 +++++++++++++++
 configs/am43xx_evm_rtconly_defconfig      |  59 ++++++++++++++++
 8 files changed, 269 insertions(+), 8 deletions(-)
 create mode 100644 configs/am43xx_evm_rtconly_defconfig
arch/arm/include/asm/arch-am33xx/clock.h +6 -0
index 9dbcd3a..eeebf16 100644
@@ -122,6 +122,12 @@ void scale_vcores(void);
 void do_setup_dpll(const struct dpll_regs *, const struct dpll_params *);
 void prcm_init(void);
 void enable_basic_clocks(void);
+
+void rtc_only_update_board_type(u32 btype);
+u32 rtc_only_get_board_type(void);
+void rtc_only_prcm_init(void);
+void rtc_only_enable_basic_clocks(void);
+
 void do_enable_clocks(u32 *const *, u32 *const *, u8);
 void do_disable_clocks(u32 *const *, u32 *const *, u8);
 
arch/arm/mach-omap2/am33xx/Kconfig +14 -0
index 9a9ccd7..76da6d9 100644
@@ -239,6 +239,20 @@ config TARGET_CM_T43
 
 endchoice
 
+config SPL_RTC_DDR_SUPPORT
+	bool
+	depends on SPL
+	prompt "Enable RTC-DDR ONLY Support"
+	help
+	  If you want RTC-DDR ONLY Support, say Y. RTC Only with DDR in
+	  self-refresh mode is a special power saving mode where in all
+	  the other voltages are turned off apart from the RTC domain and DDR.
+	  So only RTC is alive and ticking and one can program it to wake
+	  up after a predetermined period. Once RTC alarm fires, the PMIC
+	  powers up all the voltage domains. U-Boot takes a special path
+	  as the DDR has contents is in self-refresh and restore path is
+	  followed.
+
 endif
 
 if AM43XX || AM33XX
arch/arm/mach-omap2/am33xx/board.c +102 -8

142 lines not on this page · raw message

arch/arm/mach-omap2/am33xx/clock.c +10 -0
index 3d17698..ad28d20 100644
@@ -244,3 +244,13 @@ void prcm_init(void)
 	scale_vcores();
 	setup_dplls();
 }
+
+void rtc_only_prcm_init(void)
+{
+	const struct dpll_params *params;
+
+	rtc_only_enable_basic_clocks();
+
+	params = get_dpll_ddr_params();
+	do_setup_dpll(&dpll_ddr_regs, params);
+}
arch/arm/mach-omap2/am33xx/clock_am43xx.c +21 -0
index 73ea955..117a63e 100644
@@ -124,6 +124,27 @@ void enable_basic_clocks(void)
 	writel(0x4, &cmdpll->clkselmacclk);
 }
 
+void rtc_only_enable_basic_clocks(void)
+{
+	u32 *const clk_domains[] = {
+		&cmper->emifclkstctrl,
+		0
+	};
+
+	u32 *const clk_modules_explicit_en[] = {
+		&cmper->gpio5clkctrl,
+		&cmper->emiffwclkctrl,
+		&cmper->emifclkctrl,
+		&cmper->otfaemifclkctrl,
+		0
+	};
+
+	do_enable_clocks(clk_domains, clk_modules_explicit_en, 1);
+
+	/* Select the Master osc clk as Timer2 clock source */
+	writel(0x1, &cmdpll->clktimer2clk);
+}
+
 #ifdef CONFIG_TI_EDMA3
 void enable_edma3_clocks(void)
 {
board/ti/am43xx/MAINTAINERS +1 -0
index 83645ac..bf09806 100644
@@ -7,4 +7,5 @@ F:	configs/am43xx_evm_defconfig
 F:	configs/am43xx_evm_ethboot_defconfig
 F:	configs/am43xx_evm_qspiboot_defconfig
 F:	configs/am43xx_evm_usbhost_boot_defconfig
+F:	configs/am43xx_evm_rtconly_defconfig
 F:	configs/am43xx_hs_evm_defconfig
board/ti/am43xx/board.c +56 -0

62 lines not on this page · raw message

configs/am43xx_evm_rtconly_defconfig new file +59 -0

59 lines not on this page · raw message

Signature · 1 line
1.9.1
#1 lore raw

PATCH v4 1/2 ARM: AM43xx: Add support for RTC only + DDR in self-refresh mode

Quoted 19 lines · Keerthy

From: Tero Kristo <[email protected]>

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.

Quoted 7 lines

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.

[j-keerthy at ti.com Rebased to latest u-boot master branch]
Signature · 8 lines
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: not available
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20180318/e8845f64/attachment.sig>
#2 lore raw

PATCH v4 1/2 ARM: AM43xx: Add support for RTC only + DDR in self-refresh mode

In reply to Keerthy
Quoted 19 lines · Keerthy

From: Tero Kristo <[email protected]>

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.

Quoted 8 lines

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.

[j-keerthy at ti.com Rebased to latest u-boot master branch]

Applied to u-boot/master, thanks!

Signature · 8 lines
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: not available
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20180406/e94b416c/attachment.sig>