Patchwork [U-Boot,1/7] powerpc/mpc8xxx: Enable entering DDR debugging by key press

login
register
mail settings
Submitter York Sun
Date Jan. 4, 2013, 6:13 p.m.
Message ID <1357323245-12455-1-git-send-email-yorksun@freescale.com>
Download mbox | patch
Permalink /patch/209513/
State Accepted, archived
Delegated to: Andy Fleming
Headers show

Comments

York Sun - Jan. 4, 2013, 6:13 p.m.
Using environmental variable "ddr_interactive" to activate interactive DDR
debugging seomtiems is not enough. For example, after updating SPD with a
valid but wrong image, u-boot won't come up due to wrong DDR configuration.
By enabling key press method, we can enter debug mode to have a chance to
boot without using other tools to recover the board.

CONFIG_FSL_DDR_INTERACTIVE needs to be defined in header file. To enter the
debug mode by key press, press key 'd' shortly after reset, like one would
do to abort auto booting. It is fixed to lower case 'd' at this moment.

Signed-off-by: York Sun <yorksun@freescale.com>
---
 arch/powerpc/cpu/mpc8xxx/ddr/main.c |    6 ++++--
 doc/README.fsl-ddr                  |    7 +++++++
 2 files changed, 11 insertions(+), 2 deletions(-)
Wolfgang Denk - Jan. 8, 2013, 6:35 a.m.
Dear York Sun,

In message <1357323245-12455-1-git-send-email-yorksun@freescale.com> you wrote:
>...
> CONFIG_FSL_DDR_INTERACTIVE needs to be defined in header file. To enter the
> debug mode by key press, press key 'd' shortly after reset, like one would
> do to abort auto booting. It is fixed to lower case 'd' at this moment.
...
> --- a/doc/README.fsl-ddr
> +++ b/doc/README.fsl-ddr
> @@ -268,6 +268,13 @@ be activated by saving an environment variable "ddr_interactive". The value
>  doesn't matter. Once activated, U-boot prompts "FSL DDR>" before enabling DDR
>  controller. The available commands can be seen by typing "help".
>  
> +Another way to enter debug mode without using environment variable is to send
> +a key press during boot, like one would do to abort auto boot. To save booting
> +time, no additioal delay is added so the window to send the key press is very
> +short. For example, user can send the key press using reset command followed by
> +hitting enter key twice. In case of power on reset, user can keep hitting any
> +key while applying the power.

The documentation here does not mention the 'd' key at all.  Guess it
should?

Best regards,

Wolfgang Denk
sun york-R58495 - Jan. 8, 2013, 6:39 a.m.
On Jan 7, 2013, at 10:35 PM, Wolfgang Denk wrote:

> Dear York Sun,
> 
> In message <1357323245-12455-1-git-send-email-yorksun@freescale.com> you wrote:
>> ...
>> CONFIG_FSL_DDR_INTERACTIVE needs to be defined in header file. To enter the
>> debug mode by key press, press key 'd' shortly after reset, like one would
>> do to abort auto booting. It is fixed to lower case 'd' at this moment.
> ...
>> --- a/doc/README.fsl-ddr
>> +++ b/doc/README.fsl-ddr
>> @@ -268,6 +268,13 @@ be activated by saving an environment variable "ddr_interactive". The value
>> doesn't matter. Once activated, U-boot prompts "FSL DDR>" before enabling DDR
>> controller. The available commands can be seen by typing "help".
>> 
>> +Another way to enter debug mode without using environment variable is to send
>> +a key press during boot, like one would do to abort auto boot. To save booting
>> +time, no additioal delay is added so the window to send the key press is very
>> +short. For example, user can send the key press using reset command followed by
>> +hitting enter key twice. In case of power on reset, user can keep hitting any
>> +key while applying the power.
> 
> The documentation here does not mention the 'd' key at all.  Guess it
> should?
> 

Guess I might have generated the patch from a wrong branch. Will update.

Thanks,

York
York Sun - Jan. 8, 2013, 7:24 p.m.
On 01/07/2013 10:35 PM, Wolfgang Denk wrote:
> Dear York Sun,
> 
> In message <1357323245-12455-1-git-send-email-yorksun@freescale.com> you wrote:
>> ...
>> CONFIG_FSL_DDR_INTERACTIVE needs to be defined in header file. To enter the
>> debug mode by key press, press key 'd' shortly after reset, like one would
>> do to abort auto booting. It is fixed to lower case 'd' at this moment.
> ...
>> --- a/doc/README.fsl-ddr
>> +++ b/doc/README.fsl-ddr
>> @@ -268,6 +268,13 @@ be activated by saving an environment variable "ddr_interactive". The value
>>  doesn't matter. Once activated, U-boot prompts "FSL DDR>" before enabling DDR
>>  controller. The available commands can be seen by typing "help".
>>  
>> +Another way to enter debug mode without using environment variable is to send
>> +a key press during boot, like one would do to abort auto boot. To save booting
>> +time, no additioal delay is added so the window to send the key press is very
>> +short. For example, user can send the key press using reset command followed by
>> +hitting enter key twice. In case of power on reset, user can keep hitting any
>> +key while applying the power.
> 
> The documentation here does not mention the 'd' key at all.  Guess it
> should?
> 
>
It should. And James found my error and fixed in the patch 5/7 in this
series.

York

Patch

diff --git a/arch/powerpc/cpu/mpc8xxx/ddr/main.c b/arch/powerpc/cpu/mpc8xxx/ddr/main.c
index d6b73c7..a33c9e2 100644
--- a/arch/powerpc/cpu/mpc8xxx/ddr/main.c
+++ b/arch/powerpc/cpu/mpc8xxx/ddr/main.c
@@ -532,9 +532,11 @@  phys_size_t fsl_ddr_sdram(void)
 
 	/* Compute it once normally. */
 #ifdef CONFIG_FSL_DDR_INTERACTIVE
-	if (getenv("ddr_interactive"))
+	if (getenv("ddr_interactive")) {
 		total_memory = fsl_ddr_interactive(&info);
-	else
+	} else if (tstc() && (getc() == 'd')) {	/* we got a key press of 'd' */
+		total_memory = fsl_ddr_interactive(&info);
+	} else
 #endif
 		total_memory = fsl_ddr_compute(&info, STEP_GET_SPD, 0);
 
diff --git a/doc/README.fsl-ddr b/doc/README.fsl-ddr
index 3992640..59583b3 100644
--- a/doc/README.fsl-ddr
+++ b/doc/README.fsl-ddr
@@ -268,6 +268,13 @@  be activated by saving an environment variable "ddr_interactive". The value
 doesn't matter. Once activated, U-boot prompts "FSL DDR>" before enabling DDR
 controller. The available commands can be seen by typing "help".
 
+Another way to enter debug mode without using environment variable is to send
+a key press during boot, like one would do to abort auto boot. To save booting
+time, no additioal delay is added so the window to send the key press is very
+short. For example, user can send the key press using reset command followed by
+hitting enter key twice. In case of power on reset, user can keep hitting any
+key while applying the power.
+
 The example flow of using interactive debugging is
 type command "compute" to calculate the parameters from the default
 type command "print" with arguments to show SPD, options, registers