Skip to contentSkip to conversation

ARM: AM43xx: Add support for RTC only mode

PATCH Superseded Keerthy 2 participants 7 messages Mar 15, 2018

Subsystems (3)

v1 of 4 Superseded Latest is v4 →

lore
Share & tools
lore

Keerthy

author
#0 lore raw

cover ARM: AM43xx: Add support for RTC only mode

Kernel stores information to the RTC_SCRATCH0 and RTC_SCRATCH1 registers for wakeup from RTC-only mode. Parse these registers during SPL boot and jump to the kernel resume vector if the device is waking up from RTC-only mode.

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 mode support is currently only enabled for am43xx_evm_rtconly_config.
This is not to be used with epos evm builds.

Dave Gerlach (1):
am43xx: Do not allow EMIF to control DDR_RESET in rtconly config

Tero Kristo (1):
ARM: AM43xx: Add support for RTC only mode

 arch/arm/include/asm/arch-am33xx/clock.h  |   6 ++
 arch/arm/mach-omap2/am33xx/Kconfig        |   7 ++
 arch/arm/mach-omap2/am33xx/board.c        | 109 +++++++++++++++++++++++++++---
 arch/arm/mach-omap2/am33xx/clock.c        |  10 +++
 arch/arm/mach-omap2/am33xx/clock_am43xx.c |  21 ++++++
 arch/arm/mach-omap2/am33xx/emif4.c        |   5 ++
 board/ti/am43xx/MAINTAINERS               |   1 +
 board/ti/am43xx/board.c                   |  56 +++++++++++++++
 configs/am43xx_evm_rtconly_defconfig      |  59 ++++++++++++++++
 9 files changed, 266 insertions(+), 8 deletions(-)
 create mode 100644 configs/am43xx_evm_rtconly_defconfig
Signature · 1 line
1.9.1
author
#1 lore raw

PATCH 1/2 ARM: AM43xx: Add support for RTC only mode

From: Tero Kristo <[email protected]>

Kernel stores information to the RTC_SCRATCH0 and RTC_SCRATCH1 registers for wakeup from RTC-only mode. Parse these registers during SPL boot and jump to the kernel resume vector if the device is waking up from RTC-only mode.

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 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]
---
 arch/arm/include/asm/arch-am33xx/clock.h  |   6 ++
 arch/arm/mach-omap2/am33xx/Kconfig        |   7 ++
 arch/arm/mach-omap2/am33xx/board.c        | 109 +++++++++++++++++++++++++++---
 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, 261 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 +7 -0
index 9a9ccd7..5ff4a85 100644
@@ -239,6 +239,13 @@ config TARGET_CM_T43
 
 endchoice
 
+config SPL_RTC_ONLY_SUPPORT
+	bool
+	depends on SPL
+	prompt "Enable RTC ONLY Support"
+	help
+	  If you want RTC ONLY Support, say Y.
+
 endif
 
 if AM43XX || AM33XX
arch/arm/mach-omap2/am33xx/board.c +101 -8

141 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
#2 lore raw

PATCH 1/2 ARM: AM43xx: Add support for RTC only mode

Quoted 6 lines · Keerthy

From: Tero Kristo <[email protected]>

Kernel stores information to the RTC_SCRATCH0 and RTC_SCRATCH1 registers for wakeup from RTC-only mode. Parse these registers during SPL boot and jump to the kernel resume vector if the device is waking up from RTC-only mode.

[snip]

Quoted 5 lines
arch/arm/mach-omap2/am33xx/Kconfig +0 -0
index 9a9ccd7..5ff4a85 100644

arch/arm/mach-omap2/am33xx/Kconfig config TARGET_CM_T43 · line 247

Quoted 9 lines
arch/arm/mach-omap2/am33xx/Kconfig +6 -0
@@ -239,6 +239,13 @@ config TARGET_CM_T43
 
 endchoice
 
+config SPL_RTC_ONLY_SUPPORT
+	bool
+	depends on SPL
+	prompt "Enable RTC ONLY Support"
+	help
+	  If you want RTC ONLY Support, say Y.

Please expand on the help content here.

[snip]

arch/arm/mach-omap2/am33xx/Kconfig config TARGET_CM_T43

Quoted 5 lines
arch/arm/mach-omap2/am33xx/Kconfig +5 -0
+/*
+ * RTC only mode magic value, checked against during boot to see if we have
+ * a valid config
+ */
+#define RTC_MAGIC_VAL		0x8cd0

Update the comment to include where this value needs to be kept in sync with (what file in the kernel?).

[snip]

Quoted 1 line

+CONFIG_OF_LIST="am437x-gp-evm am437x-sk-evm am43x-epos-evm am437x-idk-evm"

We don't support this on all of those, do we? I thought the comments said you can't do it on ePOS... 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/20180315/4aa854b7/attachment.sig>
author
#3 lore raw

PATCH 1/2 ARM: AM43xx: Add support for RTC only mode

Quoted 17 lines · Tom Rini
Quoted 6 lines · Keerthy

From: Tero Kristo <[email protected]>

Kernel stores information to the RTC_SCRATCH0 and RTC_SCRATCH1 registers for wakeup from RTC-only mode. Parse these registers during SPL boot and jump to the kernel resume vector if the device is waking up from RTC-only mode.

[snip]

Quoted 8 lines
arch/arm/mach-omap2/am33xx/Kconfig +0 -0
index 9a9ccd7..5ff4a85 100644
@@ -239,6 +239,13 @@ config TARGET_CM_T43
 
 endchoice
 
Quoted 8 lines

arch/arm/mach-omap2/am33xx/Kconfig config TARGET_CM_T43 · line 247

Quoted 6 lines
arch/arm/mach-omap2/am33xx/Kconfig +6 -0
+config SPL_RTC_ONLY_SUPPORT
+	bool
+	depends on SPL
+	prompt "Enable RTC ONLY Support"
+	help
+	  If you want RTC ONLY Support, say Y.

Please expand on the help content here.

Sure

Quoted 10 lines

[snip]

arch/arm/mach-omap2/am33xx/Kconfig

Quoted 5 lines
arch/arm/mach-omap2/am33xx/Kconfig +5 -0
+/*
+ * RTC only mode magic value, checked against during boot to see if we have
+ * a valid config
+ */
+#define RTC_MAGIC_VAL		0x8cd0

Update the comment to include where this value needs to be kept in sync with (what file in the kernel?).

Okay.

Quoted 6 lines

[snip]

Quoted 1 line

+CONFIG_OF_LIST="am437x-gp-evm am437x-sk-evm am43x-epos-evm am437x-idk-evm"

We don't support this on all of those, do we? I thought the comments said you can't do it on ePOS... Thanks!

The config should surely have all the above booting. The RTC-Only mode will not be supported in ePOS.

Quoted 1 line
#4 lore raw

PATCH 1/2 ARM: AM43xx: Add support for RTC only mode

Quoted 45 lines · Keerthy
Quoted 17 lines · Tom Rini
Quoted 6 lines · Keerthy

From: Tero Kristo <[email protected]>

Kernel stores information to the RTC_SCRATCH0 and RTC_SCRATCH1 registers for wakeup from RTC-only mode. Parse these registers during SPL boot and jump to the kernel resume vector if the device is waking up from RTC-only mode.

[snip]

Quoted 8 lines
arch/arm/mach-omap2/am33xx/Kconfig +0 -0
index 9a9ccd7..5ff4a85 100644
@@ -239,6 +239,13 @@ config TARGET_CM_T43
 
 endchoice
 
Quoted 8 lines

arch/arm/mach-omap2/am33xx/Kconfig config TARGET_CM_T43 · line 247

Quoted 6 lines
arch/arm/mach-omap2/am33xx/Kconfig +6 -0
+config SPL_RTC_ONLY_SUPPORT
+	bool
+	depends on SPL
+	prompt "Enable RTC ONLY Support"
+	help
+	  If you want RTC ONLY Support, say Y.

Please expand on the help content here.

Sure

Quoted 10 lines

[snip]

arch/arm/mach-omap2/am33xx/Kconfig

Quoted 5 lines
arch/arm/mach-omap2/am33xx/Kconfig +5 -0
+/*
+ * RTC only mode magic value, checked against during boot to see if we have
+ * a valid config
+ */
+#define RTC_MAGIC_VAL		0x8cd0

Update the comment to include where this value needs to be kept in sync with (what file in the kernel?).

Okay.

Quoted 1 line
Quoted 8 lines
Quoted 5 lines

[snip]

Quoted 1 line

+CONFIG_OF_LIST="am437x-gp-evm am437x-sk-evm am43x-epos-evm am437x-idk-evm"

We don't support this on all of those, do we? I thought the comments said you can't do it on ePOS... Thanks!

The config should surely have all the above booting. The RTC-Only mode will not be supported in ePOS.

So we keep ePOS here to ensure that enabling it doesn't break on HW it's not supported on? OK.. 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/20180315/93651c83/attachment.sig>
author
#5 lore raw

PATCH 2/2 am43xx: Do not allow EMIF to control DDR_RESET in rtconly config

In reply to Keerthy

From: Dave Gerlach <[email protected]>

Prevent EMIF control of DDR_RESET line on DDR3 am43xx platforms for am43xx_evm_rtconly_config. Without this DDR is unstable and can become corrupted after multiple iterations of RTC+DDR mode.

[j-keerthy at ti.com Ported to latest master branch]
---
 arch/arm/mach-omap2/am33xx/emif4.c | 5 +++++
 1 file changed, 5 insertions(+)
arch/arm/mach-omap2/am33xx/emif4.c +5 -0
index 68c7705..54e11d3 100644
@@ -95,8 +95,13 @@ void config_ddr(unsigned int pll, const struct ctrl_ioregs *ioregs,
 	writel(DDR_CKE_CTRL_NORMAL, &ddrctrl->ddrckectrl);
 
 	if (emif_sdram_type(regs->sdram_config) == EMIF_SDRAM_TYPE_DDR3)
+#ifndef CONFIG_SPL_RTC_ONLY_SUPPORT
 		/* Allow EMIF to control DDR_RESET */
 		writel(0x00000000, &ddrctrl->ddrioctrl);
+#else
+		/* Override EMIF DDR_RESET control */
+		writel(0x80000000, &ddrctrl->ddrioctrl);
+#endif /* CONFIG_SPL_RTC_ONLY_SUPPORT */
 #endif
 
 	/* Program EMIF instance */
Signature · 1 line
1.9.1
#6 lore raw

PATCH 2/2 am43xx: Do not allow EMIF to control DDR_RESET in rtconly config

Quoted 9 lines · Keerthy

From: Dave Gerlach <[email protected]>

Prevent EMIF control of DDR_RESET line on DDR3 am43xx platforms for am43xx_evm_rtconly_config. Without this DDR is unstable and can become corrupted after multiple iterations of RTC+DDR mode.

[j-keerthy at ti.com Ported to latest 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/20180315/f14e3798/attachment.sig>