Deep sleep patches for Freescale QorIQ platforms
cover Deep sleep patches for Freescale QorIQ platforms
From: Tang Yuantian <[email protected]>
These patches depend on the following patches:
https://patchwork.ozlabs.org/patch/389949/
https://patchwork.ozlabs.org/patch/389950/
https://patchwork.ozlabs.org/patch/389951/
https://patchwork.ozlabs.org/patch/389952/
Tang Yuantian (4):
Add deep sleep framework support for Freescale QorIQ platforms
ARM: HYP/non-sec: Make armv7_init_nonsec() usable before relocation
arm: ls102xa: Fixed a register definition error
arm: ls1021qds: Add deep sleep support
arch/arm/cpu/armv7/virt-v7.c | 14 +++--- arch/arm/include/asm/arch-ls102xa/immap_ls102xa.h | 2 +- board/freescale/ls1021aqds/ddr.c | 7 +++ board/freescale/ls1021aqds/ls1021aqds.c | 60 +++++++++++++++++++++++ common/board_f.c | 10 ++++ drivers/ddr/fsl/arm_ddr_gen3.c | 48 ++++++++++++++++-- include/configs/ls1021aqds.h | 4 ++ include/fsl_ddr_sdram.h | 2 + include/fsl_sleep.h | 32 ++++++++++++ 9 files changed, 167 insertions(+), 12 deletions(-) create mode 100644 include/fsl_sleep.h
Signature · 1 line
2.1.0.27.g96db324
PATCH 1/4 Add deep sleep framework support for Freescale QorIQ platforms
From: Tang Yuantian <[email protected]>
When Freescale QorIQ SoCs wake up from deep sleep, control is passed to the primary core that starts executing uboot. After re-initialized some IP blocks, like DDRC, kernel will take responsibility to continue to restore environment it leaves before.
This patch adds the deep sleep framework support for all Freescale QorIQ platforms that use generic_board configuation.
--- common/board_f.c | 10 +++++++++ drivers/ddr/fsl/arm_ddr_gen3.c | 48 +++++++++++++++++++++++++++++++++++++----- include/fsl_ddr_sdram.h | 2 ++ include/fsl_sleep.h | 32 ++++++++++++++++++++++++++++ 4 files changed, 87 insertions(+), 5 deletions(-) create mode 100644 include/fsl_sleep.h
common/board_f.c +10 -0
@@ -56,6 +56,9 @@#endif #include <dm/root.h> #include <linux/compiler.h> +#ifdef CONFIG_FSL_DEEP_SLEEP +#include <fsl_sleep.h> +#endif /* * Pointer to initial global data area
@@ -921,6 +924,9 @@ static init_fnc_t init_sequence_f[] = {#if defined(CONFIG_MIPS ) || defined(CONFIG_PPC ) init_func_ram,#endif +#ifdef CONFIG_FSL_DEEP_SLEEP + fsl_dp_resume, +#endif #ifdef CONFIG_POST post_init_f,#endif
@@ -1027,6 +1033,10 @@ void board_init_f(ulong boot_flags) gd->flags = boot_flags; gd->have_console =0 ; +#ifdef CONFIG_FSL_DEEP_SLEEP +if (is_warm_boot ()) + gd->flags |=GD_FLG_SILENT |GD_FLG_DISABLE_CONSOLE ; +#endif if (initcall_run_list (init_sequence_f))hang ();
drivers/ddr/fsl/arm_ddr_gen3.c +43 -5
83 lines not on this page · raw message
include/fsl_ddr_sdram.h +2 -0
@@ -114,6 +114,7 @@ typedef struct ddr4_spd_eeprom_s generic_spd_eeprom_t;#define SDRAM_CFG_2T_EN 0x00008000#define SDRAM_CFG_BI 0x00000001 +#define SDRAM_CFG2_FRC_SR 0x80000000#define SDRAM_CFG2_D_INIT 0x00000010#define SDRAM_CFG2_ODT_CFG_MASK 0x00600000#define SDRAM_CFG2_ODT_NEVER 0
@@ -163,6 +164,7 @@ typedef struct ddr4_spd_eeprom_s generic_spd_eeprom_t;#define DDR_CDR1_ODT (x) ((x & DDR_CDR1_ODT_MASK) << DDR_CDR1_ODT_SHIFT)#define DDR_CDR2_ODT (x) (x & DDR_CDR2_ODT_MASK)#define DDR_CDR2_VREF_OVRD (x) (0x00008080 | ((((x) - 37) & 0x3F) << 8)) +#define DDR_CDR2_VREF_TRAIN_EN 0x00000080#if (defined(CONFIG_SYS_FSL_DDR_VER ) && \ (CONFIG_SYS_FSL_DDR_VER >=FSL_DDR_VER_4_7 ))
include/fsl_sleep.h new file +32 -0
@@ -0,0 +1,32 @@ +/* +* Copyright 2014 Freescale Semiconductor, Inc. +* +* SPDX-License-Identifier: GPL-2.0+ +*/ + +#ifndef __DEEP_SLEEP_H +#define __DEEP_SLEEP_H + +/* +* Functions prototype for sleep. +* Each platform that supports deep sleep needs to +* implement them on their own. +*/ + +/* determine if it is a wakeup from deep sleep */ +bool is_warm_boot (void ); + +/* board specific memory setup, like CKE isolation */ +void fsl_dp_mem_setup (void ); + +/* clean up everything and jump to kernel */ +int fsl_dp_resume (void ); + +/* +* When wakeup from deep sleep, the first 128 bytes space +* will be used to do DDR training which corrupts the data +* in there. This function will restore them. +*/ +void fsl_dp_ddr_restore (void ); + +#endif
Signature · 1 line
2.1.0.27.g96db324
PATCH 1/4 Add deep sleep framework support for Freescale QorIQ platforms
Quoted 34 lines · Yuantian.Tang at freescale.com
From: Tang Yuantian <[email protected]>
When Freescale QorIQ SoCs wake up from deep sleep, control is passed to the primary core that starts executing uboot. After re-initialized some IP blocks, like DDRC, kernel will take responsibility to continue to restore environment it leaves before.
This patch adds the deep sleep framework support for all Freescale QorIQ platforms that use
generic_boardconfiguation.Signed-off-by Tang Yuantian <[email protected]>--- common/board_f.c | 10 +++++++++ drivers/ddr/fsl/arm_ddr_gen3.c | 48 +++++++++++++++++++++++++++++++++++++----- include/fsl_ddr_sdram.h | 2 ++ include/fsl_sleep.h | 32 ++++++++++++++++++++++++++++ 4 files changed, 87 insertions(+), 5 deletions(-) create mode 100644 include/fsl_sleep.hcommon/board_f.c +3
-0@@ -56,6 +56,9 @@#endif #include <dm/root.h> #include <linux/compiler.h> +#ifdef CONFIG_FSL_DEEP_SLEEP +#include <fsl_sleep.h> +#endif /* * Pointer to initial global data area
common/board_f.c static init_fnc_t init_sequence_f[] = { · line 929
Quoted 6 lines
common/board_f.c +3
-0@@ -921,6 +924,9 @@ static init_fnc_t init_sequence_f[] = {#if defined(CONFIG_MIPS ) || defined(CONFIG_PPC ) init_func_ram,#endif +#ifdef CONFIG_FSL_DEEP_SLEEP + fsl_dp_resume, +#endif
Is there not an existing hook you can use here instead? Is misc_init_f too early? If we're going to add a new hook in here, it needs to be somewhat generically named, with the requirements of the system spelled out. Some TI parts have a (setting aside marketing-speak) similar function and I believe the U-Boot patches for that use an existing hook to notice what happened and do what's needed. Thanks!
Signature · 8 lines
Tom -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 836 bytes Desc: Digital signature URL: <http://lists.denx.de/pipermail/u-boot/attachments/20141022/265daa03/attachment.pgp>
PATCH 1/4 Add deep sleep framework support for Freescale QorIQ platforms
Quoted 44 lines
-----Original Message-----
From: Tom Rini [mailto:tom.rini at gmail.com] On Behalf Of Tom Rini
Sent: Wednesday, October 22, 2014 9:54 PM
To: Tang Yuantian-B29983
Cc: albert.u.boot at aribaud.net; Jin Zhengxiong-R64188; u-boot at lists.denx.de; Sun York-R58495
Subject: Re: [U-Boot] [PATCH 1/4] Add deep sleep framework support for Freescale QorIQ platformsQuoted 7 lines · Yuantian.Tang at freescale.com
From: Tang Yuantian <[email protected]>
When Freescale QorIQ SoCs wake up from deep sleep, control is passed to the primary core that starts executing uboot. After re-initialized some IP blocks, like DDRC, kernel will take responsibility to continue to restore environment it leaves before.
Quoted 7 lines
This patch adds the deep sleep framework support for all Freescale QorIQ platforms that use
generic_boardconfiguation.Signed-off-by Tang Yuantian <[email protected]>--- common/board_f.c | 10 +++++++++ drivers/ddr/fsl/arm_ddr_gen3.c | 48+++++++++++++++++++++++++++++++++++++-----
Quoted 17 lines
include/fsl_ddr_sdram.h | 2 ++ include/fsl_sleep.h | 32 ++++++++++++++++++++++++++++ 4 files changed, 87 insertions(+), 5 deletions(-) create mode 100644
include/fsl_sleep.hcommon/board_f.c index renamed from common/board_f.c +0
-0e6aa298..b736d29 100644
common/board_f.c +3
-0@@ -56,6 +56,9 @@#endif #include <dm/root.h> #include <linux/compiler.h> +#ifdef CONFIG_FSL_DEEP_SLEEP +#include <fsl_sleep.h> +#endif
Quoted 11 lines
common/board_f.c static init_fnc_t init_sequence_f[] = { · line 929
Quoted 9 lines
common/board_f.c +0
-0/* * Pointer to initial global data area @@ -921,6 +924,9 @@ static
init_fnc_tinit_sequence_f[] = { #ifdefined(CONFIG_MIPS)||defined(CONFIG_PPC)common/board_f.c +3
-0init_func_ram,#endif +#ifdef CONFIG_FSL_DEEP_SLEEP + fsl_dp_resume, +#endif Is there not an existing hook you can use here instead? Is
misc_init_ftoo early?
Misc_init_f is too early, we need to put it between DDR initialization and relocation.
Quoted 2 lines
If we're going to add a new hook in here, it needs to be somewhat generically named, with the requirements of the system spelled out.
It is Freescale specific. Wouldn't be a misleading for other platforms that don't jump to kernel here?
Quoted 3 lines
Some TI parts have a
(setting aside marketing-speak) similar function and I believe the U-Boot patches for that use an existing hook to notice what happened and do what's needed.
Which function did you refer to? I can check if it can be used.
Thanks,
Yuantian
Quoted 5 lines
Thanks!
--
Tom
PATCH 1/4 Add deep sleep framework support for Freescale QorIQ platforms
Yuantian,
Tom didn't suggest a specific hook. If you can use existing one, you don't have to create a new one. It's preferred if you can find a good place in existing xxx_f functions.
York
-------- Original Message --------
From: Tang Yuantian-B29983
Sent: Wed, 22/10/2014 19:53
To: Tom Rini
CC: albert.u.boot at aribaud.net; Jin Zhengxiong-R64188 ; u-boot at lists.denx.de; Sun York-R58495
Subject: RE: [U-Boot] [PATCH 1/4] Add deep sleep framework support for Freescale QorIQ platforms
Quoted 43 lines
-----Original Message-----
From: Tom Rini [mailto:tom.rini at gmail.com] On Behalf Of Tom Rini
Sent: Wednesday, October 22, 2014 9:54 PM
To: Tang Yuantian-B29983
Cc: albert.u.boot at aribaud.net; Jin Zhengxiong-R64188; u-boot at lists.denx.de; Sun York-R58495
Subject: Re: [U-Boot] [PATCH 1/4] Add deep sleep framework support for Freescale QorIQ platformsQuoted 7 lines · Yuantian.Tang at freescale.com
From: Tang Yuantian <[email protected]>
When Freescale QorIQ SoCs wake up from deep sleep, control is passed to the primary core that starts executing uboot. After re-initialized some IP blocks, like DDRC, kernel will take responsibility to continue to restore environment it leaves before.
Quoted 7 lines
This patch adds the deep sleep framework support for all Freescale QorIQ platforms that use
generic_boardconfiguation.Signed-off-by Tang Yuantian <[email protected]>--- common/board_f.c | 10 +++++++++ drivers/ddr/fsl/arm_ddr_gen3.c | 48+++++++++++++++++++++++++++++++++++++-----
Quoted 17 lines
include/fsl_ddr_sdram.h | 2 ++ include/fsl_sleep.h | 32 ++++++++++++++++++++++++++++ 4 files changed, 87 insertions(+), 5 deletions(-) create mode 100644
include/fsl_sleep.hcommon/board_f.c index renamed from common/board_f.c +0
-0e6aa298..b736d29 100644
common/board_f.c +3
-0@@ -56,6 +56,9 @@#endif #include <dm/root.h> #include <linux/compiler.h> +#ifdef CONFIG_FSL_DEEP_SLEEP +#include <fsl_sleep.h> +#endif
Quoted 11 lines
common/board_f.c static init_fnc_t init_sequence_f[] = { · line 929
Quoted 9 lines
common/board_f.c +0
-0/* * Pointer to initial global data area @@ -921,6 +924,9 @@ static
init_fnc_tinit_sequence_f[] = { #ifdefined(CONFIG_MIPS)||defined(CONFIG_PPC)
init_func_ram,
#endifcommon/board_f.c +3
-0+#ifdef CONFIG_FSL_DEEP_SLEEP + fsl_dp_resume, +#endif Is there not an existing hook you can use here instead? Is
misc_init_ftoo early?
Misc_init_f is too early, we need to put it between DDR initialization and relocation.
Quoted 2 lines
If we're going to add a new hook in here, it needs to be somewhat generically named, with the requirements of the system spelled out.
It is Freescale specific. Wouldn't be a misleading for other platforms that don't jump to kernel here?
Quoted 3 lines
Some TI parts have a
(setting aside marketing-speak) similar function and I believe the U-Boot patches for that use an existing hook to notice what happened and do what's needed.
Which function did you refer to? I can check if it can be used.
Thanks,
Yuantian
Quoted 5 lines
Thanks!
--
Tom
PATCH 1/4 Add deep sleep framework support for Freescale QorIQ platforms
Thanks for your hint. Unfortunately I can't find such place. It needs to be placed between DDR initialization and relocation. It is used on both PPC and ARM platforms.
Do you have any sugguestions?
Thanks,
Yuantian
From: Sun York-R58495
Sent: Thursday, October 23, 2014 11:06 AM
To: Tang Yuantian-B29983; Tom Rini
Cc: albert.u.boot at aribaud.net; Jin Zhengxiong-R64188; u-boot at lists.denx.de
Subject: RE: [U-Boot] [PATCH 1/4] Add deep sleep framework support for Freescale QorIQ platforms
Yuantian,
Tom didn't suggest a specific hook. If you can use existing one, you don't have to create a new one. It's preferred if you can find a good place in existing xxx_f functions.
York
-------- Original Message --------
From: Tang Yuantian-B29983
Sent: Wed, 22/10/2014 19:53
To: Tom Rini
CC: albert.u.boot at aribaud.net<mailto:[email protected]>; Jin Zhengxiong-R64188 ; u-boot at lists.denx.de<mailto:[email protected]>; Sun York-R58495
Subject: RE: [U-Boot] [PATCH 1/4] Add deep sleep framework support for Freescale QorIQ platforms
Quoted 43 lines
-----Original Message-----
From: Tom Rini [mailto:tom.rini at gmail.com] On Behalf Of Tom Rini
Sent: Wednesday, October 22, 2014 9:54 PM
To: Tang Yuantian-B29983
Cc: albert.u.boot at aribaud.net<mailto:[email protected]>; Jin Zhengxiong-R64188; u-boot at lists.denx.de<mailto:[email protected]>; Sun York-R58495
Subject: Re: [U-Boot] [PATCH 1/4] Add deep sleep framework support for
Freescale QorIQ platformsQuoted 7 lines · Yuantian.Tang at freescale.com
From: Tang Yuantian <Yuantian.Tang at freescale.com<mailto:[email protected]>>
When Freescale QorIQ SoCs wake up from deep sleep, control is passed to the primary core that starts executing uboot. After re-initialized some IP blocks, like DDRC, kernel will take responsibility to continue to restore environment it leaves before.
Quoted 7 lines
This patch adds the deep sleep framework support for all Freescale QorIQ platforms that use
generic_boardconfiguation.Signed-off-by Tang Yuantian <Yuantian.Tang at freescale.com<mailto:[email protected]>>--- common/board_f.c | 10 +++++++++ drivers/ddr/fsl/arm_ddr_gen3.c | 48+++++++++++++++++++++++++++++++++++++-----
Quoted 17 lines
include/fsl_ddr_sdram.h | 2 ++ include/fsl_sleep.h | 32 ++++++++++++++++++++++++++++ 4 files changed, 87 insertions(+), 5 deletions(-) create mode 100644
include/fsl_sleep.hcommon/board_f.c index renamed from common/board_f.c +0
-0e6aa298..b736d29 100644
common/board_f.c +3
-0@@ -56,6 +56,9 @@#endif #include <dm/root.h> #include <linux/compiler.h> +#ifdef CONFIG_FSL_DEEP_SLEEP +#include <fsl_sleep.h> +#endif
Quoted 11 lines
common/board_f.c static init_fnc_t init_sequence_f[] = { · line 929
Quoted 9 lines
common/board_f.c +0
-0/* * Pointer to initial global data area @@ -921,6 +924,9 @@ static
init_fnc_tinit_sequence_f[] = { #ifdefined(CONFIG_MIPS)||defined(CONFIG_PPC)
init_func_ram,
#endifcommon/board_f.c +3
-0+#ifdef CONFIG_FSL_DEEP_SLEEP + fsl_dp_resume, +#endif Is there not an existing hook you can use here instead? Is
misc_init_ftoo early?
Misc_init_f is too early, we need to put it between DDR initialization and relocation.
Quoted 2 lines
If we're going to add a new hook in here, it needs to be somewhat generically named, with the requirements of the system spelled out.
It is Freescale specific. Wouldn't be a misleading for other platforms that don't jump to kernel here?
Quoted 3 lines
Some TI parts have a
(setting aside marketing-speak) similar function and I believe the U-Boot patches for that use an existing hook to notice what happened and do what's needed.
Which function did you refer to? I can check if it can be used.
Thanks,
Yuantian
Quoted 5 lines
Thanks!
--
Tom
PATCH 1/4 Add deep sleep framework support for Freescale QorIQ platforms
Let me take a deeper look.
York
-------- Original Message --------
From: Tang Yuantian-B29983
Sent: Wed, 22/10/2014 20:26
To: Sun York-R58495 ; Tom Rini
CC: albert.u.boot at aribaud.net; Jin Zhengxiong-R64188 ; u-boot at lists.denx.de
Subject: RE: [U-Boot] [PATCH 1/4] Add deep sleep framework support for Freescale QorIQ platforms
Thanks for your hint. Unfortunately I can't find such place. It needs to be placed between DDR initialization and relocation. It is used on both PPC and ARM platforms.
Do you have any sugguestions?
Thanks,
Yuantian
From: Sun York-R58495
Sent: Thursday, October 23, 2014 11:06 AM
To: Tang Yuantian-B29983; Tom Rini
Cc: albert.u.boot at aribaud.net; Jin Zhengxiong-R64188; u-boot at lists.denx.de
Subject: RE: [U-Boot] [PATCH 1/4] Add deep sleep framework support for Freescale QorIQ platforms
Yuantian,
Tom didn't suggest a specific hook. If you can use existing one, you don't have to create a new one. It's preferred if you can find a good place in existing xxx_f functions.
York
-------- Original Message --------
From: Tang Yuantian-B29983
Sent: Wed, 22/10/2014 19:53
To: Tom Rini
CC: albert.u.boot at aribaud.net<mailto:[email protected]>; Jin Zhengxiong-R64188 ; u-boot at lists.denx.de<mailto:[email protected]>; Sun York-R58495
Subject: RE: [U-Boot] [PATCH 1/4] Add deep sleep framework support for Freescale QorIQ platforms
Quoted 43 lines
-----Original Message-----
From: Tom Rini [mailto:tom.rini at gmail.com] On Behalf Of Tom Rini
Sent: Wednesday, October 22, 2014 9:54 PM
To: Tang Yuantian-B29983
Cc: albert.u.boot at aribaud.net<mailto:[email protected]>; Jin Zhengxiong-R64188; u-boot at lists.denx.de<mailto:[email protected]>; Sun York-R58495
Subject: Re: [U-Boot] [PATCH 1/4] Add deep sleep framework support for
Freescale QorIQ platformsQuoted 7 lines · Yuantian.Tang at freescale.com
From: Tang Yuantian <Yuantian.Tang at freescale.com<mailto:[email protected]>>
When Freescale QorIQ SoCs wake up from deep sleep, control is passed to the primary core that starts executing uboot. After re-initialized some IP blocks, like DDRC, kernel will take responsibility to continue to restore environment it leaves before.
Quoted 7 lines
This patch adds the deep sleep framework support for all Freescale QorIQ platforms that use
generic_boardconfiguation.Signed-off-by Tang Yuantian <Yuantian.Tang at freescale.com<mailto:[email protected]>>--- common/board_f.c | 10 +++++++++ drivers/ddr/fsl/arm_ddr_gen3.c | 48+++++++++++++++++++++++++++++++++++++-----
Quoted 17 lines
include/fsl_ddr_sdram.h | 2 ++ include/fsl_sleep.h | 32 ++++++++++++++++++++++++++++ 4 files changed, 87 insertions(+), 5 deletions(-) create mode 100644
include/fsl_sleep.hcommon/board_f.c index renamed from common/board_f.c +0
-0e6aa298..b736d29 100644
common/board_f.c +3
-0@@ -56,6 +56,9 @@#endif #include <dm/root.h> #include <linux/compiler.h> +#ifdef CONFIG_FSL_DEEP_SLEEP +#include <fsl_sleep.h> +#endif
Quoted 11 lines
common/board_f.c static init_fnc_t init_sequence_f[] = { · line 929
Quoted 9 lines
common/board_f.c +0
-0/* * Pointer to initial global data area @@ -921,6 +924,9 @@ static
init_fnc_tinit_sequence_f[] = { #ifdefined(CONFIG_MIPS)||defined(CONFIG_PPC)
init_func_ram,
#endifcommon/board_f.c +3
-0+#ifdef CONFIG_FSL_DEEP_SLEEP + fsl_dp_resume, +#endif Is there not an existing hook you can use here instead? Is
misc_init_ftoo early?
Misc_init_f is too early, we need to put it between DDR initialization and relocation.
Quoted 2 lines
If we're going to add a new hook in here, it needs to be somewhat generically named, with the requirements of the system spelled out.
It is Freescale specific. Wouldn't be a misleading for other platforms that don't jump to kernel here?
Quoted 3 lines
Some TI parts have a
(setting aside marketing-speak) similar function and I believe the U-Boot patches for that use an existing hook to notice what happened and do what's needed.
Which function did you refer to? I can check if it can be used.
Thanks,
Yuantian
Quoted 5 lines
Thanks!
--
Tom
PATCH 1/4 Add deep sleep framework support for Freescale QorIQ platforms
In reply to Yuantian TangYuantian,
I examined current code closely and have two suggestions:
1. In initdram() function, add a call to fsl_dp_resume()
It is rational because the deep sleep resume is mainly dealing with memory. Doing this means you need to add calls to all boards with deep sleep feature enabled, not a lot at this moment.
2. Add a new hook at exact location you proposed
But change to a more generic name, eg misc_ram. Add a weak function misc_ram() doing nothing. Then you can add misc_ram() in board file where it is needed.
Both require to put a hook in all boards with deep sleep enabled.
York
From: Tang Yuantian-B29983 <Yuantian.Tang at freescale.com<mailto:[email protected]>>
Date: Wednesday, October 22, 2014 8:26 PM
To: York Sun <yorksun at freescale.com<mailto:[email protected]>>, Tom Rini <trini at ti.com<mailto:[email protected]>>
Cc: "albert.u.boot at aribaud.net<mailto:[email protected]>" <albert.u.boot at aribaud.net<mailto:[email protected]>>, Jin Zhengxiong-R64188 <Jason.Jin at freescale.com<mailto:[email protected]>>, "u-boot at lists.denx.de<mailto:[email protected]>" <u-boot at lists.denx.de<mailto:[email protected]>>
Subject: RE: [U-Boot] [PATCH 1/4] Add deep sleep framework support for Freescale QorIQ platforms
Thanks for your hint. Unfortunately I can?t find such place. It needs to be placed between DDR initialization and relocation. It is used on both PPC and ARM platforms.
Do you have any sugguestions?
Thanks,
Yuantian
From: Sun York-R58495
Sent: Thursday, October 23, 2014 11:06 AM
To: Tang Yuantian-B29983; Tom Rini
Cc: albert.u.boot at aribaud.net<mailto:[email protected]>; Jin Zhengxiong-R64188; u-boot at lists.denx.de<mailto:[email protected]>
Subject: RE: [U-Boot] [PATCH 1/4] Add deep sleep framework support for Freescale QorIQ platforms
Yuantian,
Tom didn't suggest a specific hook. If you can use existing one, you don't have to create a new one. It's preferred if you can find a good place in existing xxx_f functions.
York
-------- Original Message --------
From: Tang Yuantian-B29983
Sent: Wed, 22/10/2014 19:53
To: Tom Rini
CC: albert.u.boot at aribaud.net<mailto:[email protected]>; Jin Zhengxiong-R64188 ; u-boot at lists.denx.de<mailto:[email protected]>; Sun York-R58495
Subject: RE: [U-Boot] [PATCH 1/4] Add deep sleep framework support for Freescale QorIQ platforms
Quoted 43 lines
-----Original Message-----
From: Tom Rini [mailto:tom.rini at gmail.com] On Behalf Of Tom Rini
Sent: Wednesday, October 22, 2014 9:54 PM
To: Tang Yuantian-B29983
Cc: albert.u.boot at aribaud.net<mailto:[email protected]>; Jin Zhengxiong-R64188; u-boot at lists.denx.de<mailto:[email protected]>; Sun York-R58495
Subject: Re: [U-Boot] [PATCH 1/4] Add deep sleep framework support for
Freescale QorIQ platformsQuoted 7 lines · Yuantian.Tang at freescale.com
From: Tang Yuantian <Yuantian.Tang at freescale.com<mailto:[email protected]>>
When Freescale QorIQ SoCs wake up from deep sleep, control is passed to the primary core that starts executing uboot. After re-initialized some IP blocks, like DDRC, kernel will take responsibility to continue to restore environment it leaves before.
Quoted 7 lines
This patch adds the deep sleep framework support for all Freescale QorIQ platforms that use
generic_boardconfiguation.Signed-off-by Tang Yuantian <Yuantian.Tang at freescale.com<mailto:[email protected]>>--- common/board_f.c | 10 +++++++++ drivers/ddr/fsl/arm_ddr_gen3.c | 48+++++++++++++++++++++++++++++++++++++-----
Quoted 17 lines
include/fsl_ddr_sdram.h | 2 ++ include/fsl_sleep.h | 32 ++++++++++++++++++++++++++++ 4 files changed, 87 insertions(+), 5 deletions(-) create mode 100644
include/fsl_sleep.hcommon/board_f.c index renamed from common/board_f.c +0
-0e6aa298..b736d29 100644
common/board_f.c +3
-0@@ -56,6 +56,9 @@#endif #include <dm/root.h> #include <linux/compiler.h> +#ifdef CONFIG_FSL_DEEP_SLEEP +#include <fsl_sleep.h> +#endif
Quoted 11 lines
common/board_f.c static init_fnc_t init_sequence_f[] = { · line 929
Quoted 9 lines
common/board_f.c +0
-0/* * Pointer to initial global data area @@ -921,6 +924,9 @@ static
init_fnc_tinit_sequence_f[] = { #ifdefined(CONFIG_MIPS)||defined(CONFIG_PPC)
init_func_ram,
#endifcommon/board_f.c +3
-0+#ifdef CONFIG_FSL_DEEP_SLEEP + fsl_dp_resume, +#endif Is there not an existing hook you can use here instead? Is
misc_init_ftoo early?
Misc_init_f is too early, we need to put it between DDR initialization and relocation.
Quoted 2 lines
If we're going to add a new hook in here, it needs to be somewhat generically named, with the requirements of the system spelled out.
It is Freescale specific. Wouldn't be a misleading for other platforms that don't jump to kernel here?
Quoted 3 lines
Some TI parts have a
(setting aside marketing-speak) similar function and I believe the U-Boot patches for that use an existing hook to notice what happened and do what's needed.
Which function did you refer to? I can check if it can be used.
Thanks,
Yuantian
Quoted 5 lines
Thanks!
--
Tom
PATCH 1/4 Add deep sleep framework support for Freescale QorIQ platforms
Thanks for your suggestions.
It sounds reasonable. I prefer the first one because we need to add calls in initdram() anyway.
Let's also take a look at what TI did and see if we can follow.
Thanks,
Yuantian
From: Sun York-R58495
Sent: Thursday, October 23, 2014 12:15 PM
To: Tang Yuantian-B29983; Tom Rini
Cc: albert.u.boot at aribaud.net; Jin Zhengxiong-R64188; u-boot at lists.denx.de
Subject: Re: [U-Boot] [PATCH 1/4] Add deep sleep framework support for Freescale QorIQ platforms
Yuantian,
I examined current code closely and have two suggestions:
1. In initdram() function, add a call to fsl_dp_resume()
It is rational because the deep sleep resume is mainly dealing with memory. Doing this means you need to add calls to all boards with deep sleep feature enabled, not a lot at this moment.
2. Add a new hook at exact location you proposed
But change to a more generic name, eg misc_ram. Add a weak function misc_ram() doing nothing. Then you can add misc_ram() in board file where it is needed.
Both require to put a hook in all boards with deep sleep enabled.
York
From: Tang Yuantian-B29983 <Yuantian.Tang at freescale.com<mailto:[email protected]>>
Date: Wednesday, October 22, 2014 8:26 PM
To: York Sun <yorksun at freescale.com<mailto:[email protected]>>, Tom Rini <trini at ti.com<mailto:[email protected]>>
Cc: "albert.u.boot at aribaud.net<mailto:[email protected]>" <albert.u.boot at aribaud.net<mailto:[email protected]>>, Jin Zhengxiong-R64188 <Jason.Jin at freescale.com<mailto:[email protected]>>, "u-boot at lists.denx.de<mailto:[email protected]>" <u-boot at lists.denx.de<mailto:[email protected]>>
Subject: RE: [U-Boot] [PATCH 1/4] Add deep sleep framework support for Freescale QorIQ platforms
Thanks for your hint. Unfortunately I can't find such place. It needs to be placed between DDR initialization and relocation. It is used on both PPC and ARM platforms.
Do you have any sugguestions?
Thanks,
Yuantian
From: Sun York-R58495
Sent: Thursday, October 23, 2014 11:06 AM
To: Tang Yuantian-B29983; Tom Rini
Cc: albert.u.boot at aribaud.net<mailto:[email protected]>; Jin Zhengxiong-R64188; u-boot at lists.denx.de<mailto:[email protected]>
Subject: RE: [U-Boot] [PATCH 1/4] Add deep sleep framework support for Freescale QorIQ platforms
Yuantian,
Tom didn't suggest a specific hook. If you can use existing one, you don't have to create a new one. It's preferred if you can find a good place in existing xxx_f functions.
York
-------- Original Message --------
From: Tang Yuantian-B29983
Sent: Wed, 22/10/2014 19:53
To: Tom Rini
CC: albert.u.boot at aribaud.net<mailto:[email protected]>; Jin Zhengxiong-R64188 ; u-boot at lists.denx.de<mailto:[email protected]>; Sun York-R58495
Subject: RE: [U-Boot] [PATCH 1/4] Add deep sleep framework support for Freescale QorIQ platforms
Quoted 43 lines
-----Original Message-----
From: Tom Rini [mailto:tom.rini at gmail.com] On Behalf Of Tom Rini
Sent: Wednesday, October 22, 2014 9:54 PM
To: Tang Yuantian-B29983
Cc: albert.u.boot at aribaud.net<mailto:[email protected]>; Jin Zhengxiong-R64188; u-boot at lists.denx.de<mailto:[email protected]>; Sun York-R58495
Subject: Re: [U-Boot] [PATCH 1/4] Add deep sleep framework support for
Freescale QorIQ platformsQuoted 7 lines · Yuantian.Tang at freescale.com
From: Tang Yuantian <Yuantian.Tang at freescale.com<mailto:[email protected]>>
When Freescale QorIQ SoCs wake up from deep sleep, control is passed to the primary core that starts executing uboot. After re-initialized some IP blocks, like DDRC, kernel will take responsibility to continue to restore environment it leaves before.
Quoted 7 lines
This patch adds the deep sleep framework support for all Freescale QorIQ platforms that use
generic_boardconfiguation.Signed-off-by Tang Yuantian <Yuantian.Tang at freescale.com<mailto:[email protected]>>--- common/board_f.c | 10 +++++++++ drivers/ddr/fsl/arm_ddr_gen3.c | 48+++++++++++++++++++++++++++++++++++++-----
Quoted 17 lines
include/fsl_ddr_sdram.h | 2 ++ include/fsl_sleep.h | 32 ++++++++++++++++++++++++++++ 4 files changed, 87 insertions(+), 5 deletions(-) create mode 100644
include/fsl_sleep.hcommon/board_f.c index renamed from common/board_f.c +0
-0e6aa298..b736d29 100644
common/board_f.c +3
-0@@ -56,6 +56,9 @@#endif #include <dm/root.h> #include <linux/compiler.h> +#ifdef CONFIG_FSL_DEEP_SLEEP +#include <fsl_sleep.h> +#endif
Quoted 11 lines
common/board_f.c static init_fnc_t init_sequence_f[] = { · line 929
Quoted 9 lines
common/board_f.c +0
-0/* * Pointer to initial global data area @@ -921,6 +924,9 @@ static
init_fnc_tinit_sequence_f[] = { #ifdefined(CONFIG_MIPS)||defined(CONFIG_PPC)
init_func_ram,
#endifcommon/board_f.c +3
-0+#ifdef CONFIG_FSL_DEEP_SLEEP + fsl_dp_resume, +#endif Is there not an existing hook you can use here instead? Is
misc_init_ftoo early?
Misc_init_f is too early, we need to put it between DDR initialization and relocation.
Quoted 2 lines
If we're going to add a new hook in here, it needs to be somewhat generically named, with the requirements of the system spelled out.
It is Freescale specific. Wouldn't be a misleading for other platforms that don't jump to kernel here?
Quoted 3 lines
Some TI parts have a
(setting aside marketing-speak) similar function and I believe the U-Boot patches for that use an existing hook to notice what happened and do what's needed.
Which function did you refer to? I can check if it can be used.
Thanks,
Yuantian
Quoted 5 lines
Thanks!
--
Tom
PATCH 1/4 Add deep sleep framework support for Freescale QorIQ platforms
Quoted 4 lines · Yuantian Tang
Thanks for your suggestions.
It sounds reasonable. I prefer the first one because we need to add calls ininitdram()anyway.Let's also take a look at what TI did and see if we can follow.
TI does it in SPL rather than full U-Boot but it's a similar location, all things considered (in the part of SPL where we're dealing with SDRAM init).
Signature · 8 lines
Tom -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 836 bytes Desc: Digital signature URL: <http://lists.denx.de/pipermail/u-boot/attachments/20141023/2c4c97bc/attachment.pgp>
PATCH 2/4 ARM: HYP/non-sec: Make armv7_init_nonsec() usable before relocation
In reply to Yuantian.Tang at freescale.comFrom: Tang Yuantian <[email protected]>
Defining variable gic_dist_addr as a globe one prevents function armv7_init_nonsec() from being used before relocation which is the case in the deep sleep resume process on Freescale QorIQ SoC platforms.
This patch removes this limitation by adding a extra same meaning local variable. In this way, no exsiting codes get corrupts.
--- arch/arm/cpu/armv7/virt-v7.c | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-)
arch/arm/cpu/armv7/virt-v7.c +8 -6
@@ -75,6 +75,7 @@ int armv7_init_nonsec(void) {unsigned int reg;unsigned itlinesnr, i; +unsigned long gic_base_addr;/* check whether the CPU supports the security extensions */ reg =read_id_pfr1 ();
@@ -89,23 +90,24 @@ int armv7_init_nonsec(void)* any access to it will trap. */ - gic_dist_addr =get_gicd_base_address (); -if (gic_dist_addr ==-1 ) + gic_base_addr =get_gicd_base_address (); + gic_dist_addr = gic_base_addr; +if (gic_base_addr ==-1 )return -1 ;/* enable the GIC distributor */ -writel (readl (gic_dist_addr +GICD_CTLR ) |0x03 , - gic_dist_addr +GICD_CTLR ); +writel (readl (gic_base_addr +GICD_CTLR ) |0x03 , + gic_base_addr +GICD_CTLR );/* TYPER[4:0] contains an encoded number of available interrupts */ - itlinesnr =readl (gic_dist_addr +GICD_TYPER ) &0x1f ; + itlinesnr =readl (gic_base_addr +GICD_TYPER ) &0x1f ;/* set all bits in the GIC group registers to one to allow access * from non-secure state. The first 32 interrupts are private per * CPU and will be set later when enabling the GIC for each core */ for (i =1 ; i <= itlinesnr; i++) -writel ((unsigned )-1 , gic_dist_addr + GICD_IGROUPRn +4 * i); +writel ((unsigned )-1 , gic_base_addr + GICD_IGROUPRn +4 * i);#ifndef CONFIG_ARMV7_PSCI smp_set_core_boot_addr ((unsigned long )secure_ram_addr (_smp_pen),-1 );
Signature · 1 line
2.1.0.27.g96db324
PATCH 3/4 arm: ls102xa: Fixed a register definition error
In reply to Yuantian.Tang at freescale.comFrom: Tang Yuantian <[email protected]>
There are 8 SCFG_SPARECR registers in SCFG memory block, not one.
--- arch/arm/include/asm/arch-ls102xa/immap_ls102xa.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/arm/include/asm/arch-ls102xa/immap_ls102xa.h +1 -1
@@ -182,7 +182,7 @@ struct ccsr_scfg {u32 etsecmcr;u32 sdhciovserlcr;u32 resv14[61 ]; -u32 sparecr; +u32 sparecr[8 ]; };/* Clocking */
Signature · 1 line
2.1.0.27.g96db324
PATCH 4/4 arm: ls1021qds: Add deep sleep support
In reply to Yuantian.Tang at freescale.comFrom: Tang Yuantian <[email protected]>
Add deep sleep support on Freescale LS1021QDS platform.
--- board/freescale/ls1021aqds/ddr.c | 7 ++++ board/freescale/ls1021aqds/ls1021aqds.c | 60 +++++++++++++++++++++++++++++++++ include/configs/ls1021aqds.h | 4 +++ 3 files changed, 71 insertions(+)
board/freescale/ls1021aqds/ddr.c +7 -0
@@ -8,6 +8,9 @@#include <fsl_ddr_sdram.h> #include <fsl_ddr_dimm_params.h> #include "ddr.h" +#ifdef CONFIG_FSL_DEEP_SLEEP +#include <fsl_sleep.h> +#endif DECLARE_GLOBAL_DATA_PTR ;
@@ -156,6 +159,10 @@ phys_size_t initdram(int board_type)puts ("Initializing DDR....using SPD\n" ); dram_size =fsl_ddr_sdram (); +#ifdef CONFIG_FSL_DEEP_SLEEP +fsl_dp_ddr_restore (); +#endif +return dram_size; }
board/freescale/ls1021aqds/ls1021aqds.c +60 -0
63 lines not on this page · raw message
include/configs/ls1021aqds.h +4 -0
@@ -19,6 +19,10 @@#define CONFIG_SKIP_LOWLEVEL_INIT #define CONFIG_BOARD_EARLY_INIT_F +#define CONFIG_FSL_DEEP_SLEEP +#ifdef CONFIG_FSL_DEEP_SLEEP +#define CONFIG_SILENT_CONSOLE +#endif /* * Size of malloc() pool */
Signature · 1 line
2.1.0.27.g96db324