[U-Boot,V8,8/9] omap3: implement boot parameter saving

Submitted by Simon Schwarz on Aug. 2, 2011, 3:59 p.m.

Details

Message ID 1312300757-9039-9-git-send-email-simonschwarzcor@gmail.com
State Superseded
Headers show

Commit Message

Simon Schwarz Aug. 2, 2011, 3:59 p.m.
Implements the saving of boot params passed by OMAP3 ROM code.

Signed-off-by: Simon Schwarz <simonschwarzcor@gmail.com>
---
Didn't exist before V8
---
 arch/arm/cpu/armv7/omap-common/spl.c     |    6 +++++-
 arch/arm/cpu/armv7/omap3/lowlevel_init.S |    9 +++++++--
 arch/arm/include/asm/omap_common.h       |   10 ++++++++++
 3 files changed, 22 insertions(+), 3 deletions(-)

Comments

Aneesh V Aug. 5, 2011, 7:41 a.m.
Hi Simon,

On Tuesday 02 August 2011 09:29 PM, Simon Schwarz wrote:
> Implements the saving of boot params passed by OMAP3 ROM code.
>
> Signed-off-by: Simon Schwarz<simonschwarzcor@gmail.com>
> ---
> Didn't exist before V8
> ---
>   arch/arm/cpu/armv7/omap-common/spl.c     |    6 +++++-
>   arch/arm/cpu/armv7/omap3/lowlevel_init.S |    9 +++++++--
>   arch/arm/include/asm/omap_common.h       |   10 ++++++++++
>   3 files changed, 22 insertions(+), 3 deletions(-)
>
> diff --git a/arch/arm/cpu/armv7/omap-common/spl.c b/arch/arm/cpu/armv7/omap-common/spl.c
> index 53d10bf..3dd8e0d 100644
> --- a/arch/arm/cpu/armv7/omap-common/spl.c
> +++ b/arch/arm/cpu/armv7/omap-common/spl.c
> @@ -194,8 +194,12 @@ static void mmc_load_image(void)
>   		printf("spl: mmc init failed: err - %d\n", err);
>   		hang();
>   	}
> -
> +/* For OMAP3 there is no automatic boot mode detection */
> +#ifdef CONFIG_OMAP34XX
> +	boot_mode = CONFIG_SYS_MMC_SD_BOOTMODE;
> +#else
>   	boot_mode = omap_boot_mode();
> +#endif

Why boot mode detection is not supported? You seem to be saving
bootparams below that has boot mode information. Why don't you use it?

best regards,
Aneesh
Simon Schwarz Aug. 8, 2011, 8:03 a.m.
Hi Aneesh,

On 08/05/2011 09:41 AM, Aneesh V wrote:
> Hi Simon,
>
> On Tuesday 02 August 2011 09:29 PM, Simon Schwarz wrote:
>> Implements the saving of boot params passed by OMAP3 ROM code.
>>
>> Signed-off-by: Simon Schwarz<simonschwarzcor@gmail.com>
>> ---
>> Didn't exist before V8
>> ---
>> arch/arm/cpu/armv7/omap-common/spl.c | 6 +++++-
>> arch/arm/cpu/armv7/omap3/lowlevel_init.S | 9 +++++++--
>> arch/arm/include/asm/omap_common.h | 10 ++++++++++
>> 3 files changed, 22 insertions(+), 3 deletions(-)
>>
>> diff --git a/arch/arm/cpu/armv7/omap-common/spl.c
>> b/arch/arm/cpu/armv7/omap-common/spl.c
>> index 53d10bf..3dd8e0d 100644
>> --- a/arch/arm/cpu/armv7/omap-common/spl.c
>> +++ b/arch/arm/cpu/armv7/omap-common/spl.c
>> @@ -194,8 +194,12 @@ static void mmc_load_image(void)
>> printf("spl: mmc init failed: err - %d\n", err);
>> hang();
>> }
>> -
>> +/* For OMAP3 there is no automatic boot mode detection */
>> +#ifdef CONFIG_OMAP34XX
>> + boot_mode = CONFIG_SYS_MMC_SD_BOOTMODE;
>> +#else
>> boot_mode = omap_boot_mode();
>> +#endif
>
> Why boot mode detection is not supported? You seem to be saving
> bootparams below that has boot mode information. Why don't you use it?
>

Because you wrote: "What I have done for OMAP4 will not work for OMAP3. 
For OMAP3 you will
get only the boot-device(eMMC, MMC/SD, nand etc) and *not* the bootmode(raw
vs FAT)."
http://mid.gmane.org/4E256783.5080601@ti.com

Did I understand you wrong here?

> best regards,
> Aneesh

Regards
Simon
Aneesh V Aug. 8, 2011, 8:44 a.m.
Hi Simon,

On Monday 08 August 2011 01:33 PM, Simon Schwarz wrote:
> Hi Aneesh,
>
> On 08/05/2011 09:41 AM, Aneesh V wrote:
>> Hi Simon,
>>
>> On Tuesday 02 August 2011 09:29 PM, Simon Schwarz wrote:
>>> Implements the saving of boot params passed by OMAP3 ROM code.
>>>
>>> Signed-off-by: Simon Schwarz<simonschwarzcor@gmail.com>
>>> ---
>>> Didn't exist before V8
>>> ---
>>> arch/arm/cpu/armv7/omap-common/spl.c | 6 +++++-
>>> arch/arm/cpu/armv7/omap3/lowlevel_init.S | 9 +++++++--
>>> arch/arm/include/asm/omap_common.h | 10 ++++++++++
>>> 3 files changed, 22 insertions(+), 3 deletions(-)
>>>
>>> diff --git a/arch/arm/cpu/armv7/omap-common/spl.c
>>> b/arch/arm/cpu/armv7/omap-common/spl.c
>>> index 53d10bf..3dd8e0d 100644
>>> --- a/arch/arm/cpu/armv7/omap-common/spl.c
>>> +++ b/arch/arm/cpu/armv7/omap-common/spl.c
>>> @@ -194,8 +194,12 @@ static void mmc_load_image(void)
>>> printf("spl: mmc init failed: err - %d\n", err);
>>> hang();
>>> }
>>> -
>>> +/* For OMAP3 there is no automatic boot mode detection */
>>> +#ifdef CONFIG_OMAP34XX
>>> + boot_mode = CONFIG_SYS_MMC_SD_BOOTMODE;
>>> +#else
>>> boot_mode = omap_boot_mode();
>>> +#endif
>>
>> Why boot mode detection is not supported? You seem to be saving
>> bootparams below that has boot mode information. Why don't you use it?
>>
>
> Because you wrote: "What I have done for OMAP4 will not work for OMAP3.
> For OMAP3 you will
> get only the boot-device(eMMC, MMC/SD, nand etc) and *not* the bootmode(raw
> vs FAT)."
> http://mid.gmane.org/4E256783.5080601@ti.com
>
> Did I understand you wrong here?

Sorry for the noise. I mistook 'boot_mode' for 'boot_device'. Anyway,
instead of hard-coding this, I would prefer the following approach
taken by x-loader.

1. For eMMC - raw mode
2. For external MMC/SD card - FAT mode.

best regards,
Aneesh
Simon Schwarz Aug. 8, 2011, 10:59 a.m.
On 08/08/2011 10:44 AM, Aneesh V wrote:
> Hi Simon,
>
> On Monday 08 August 2011 01:33 PM, Simon Schwarz wrote:
>> Hi Aneesh,
>>
>> On 08/05/2011 09:41 AM, Aneesh V wrote:
>>> Hi Simon,
>>>
>>> On Tuesday 02 August 2011 09:29 PM, Simon Schwarz wrote:
>>>> Implements the saving of boot params passed by OMAP3 ROM code.
>>>>
>>>> Signed-off-by: Simon Schwarz<simonschwarzcor@gmail.com>
>>>> ---
>>>> Didn't exist before V8
>>>> ---
>>>> arch/arm/cpu/armv7/omap-common/spl.c | 6 +++++-
>>>> arch/arm/cpu/armv7/omap3/lowlevel_init.S | 9 +++++++--
>>>> arch/arm/include/asm/omap_common.h | 10 ++++++++++
>>>> 3 files changed, 22 insertions(+), 3 deletions(-)
>>>>
>>>> diff --git a/arch/arm/cpu/armv7/omap-common/spl.c
>>>> b/arch/arm/cpu/armv7/omap-common/spl.c
>>>> index 53d10bf..3dd8e0d 100644
>>>> --- a/arch/arm/cpu/armv7/omap-common/spl.c
>>>> +++ b/arch/arm/cpu/armv7/omap-common/spl.c
>>>> @@ -194,8 +194,12 @@ static void mmc_load_image(void)
>>>> printf("spl: mmc init failed: err - %d\n", err);
>>>> hang();
>>>> }
>>>> -
>>>> +/* For OMAP3 there is no automatic boot mode detection */
>>>> +#ifdef CONFIG_OMAP34XX
>>>> + boot_mode = CONFIG_SYS_MMC_SD_BOOTMODE;
>>>> +#else
>>>> boot_mode = omap_boot_mode();
>>>> +#endif
>>>
>>> Why boot mode detection is not supported? You seem to be saving
>>> bootparams below that has boot mode information. Why don't you use it?
>>>
>>
>> Because you wrote: "What I have done for OMAP4 will not work for OMAP3.
>> For OMAP3 you will
>> get only the boot-device(eMMC, MMC/SD, nand etc) and *not* the
>> bootmode(raw
>> vs FAT)."
>> http://mid.gmane.org/4E256783.5080601@ti.com
>>
>> Did I understand you wrong here?
>
> Sorry for the noise. I mistook 'boot_mode' for 'boot_device'. Anyway,
> instead of hard-coding this, I would prefer the following approach
> taken by x-loader.
>
> 1. For eMMC - raw mode
> 2. For external MMC/SD card - FAT mode.

done.

> best regards,
> Aneesh

Regards
Simon

Patch hide | download patch | download mbox

diff --git a/arch/arm/cpu/armv7/omap-common/spl.c b/arch/arm/cpu/armv7/omap-common/spl.c
index 53d10bf..3dd8e0d 100644
--- a/arch/arm/cpu/armv7/omap-common/spl.c
+++ b/arch/arm/cpu/armv7/omap-common/spl.c
@@ -194,8 +194,12 @@  static void mmc_load_image(void)
 		printf("spl: mmc init failed: err - %d\n", err);
 		hang();
 	}
-
+/* For OMAP3 there is no automatic boot mode detection */
+#ifdef CONFIG_OMAP34XX
+	boot_mode = CONFIG_SYS_MMC_SD_BOOTMODE;
+#else
 	boot_mode = omap_boot_mode();
+#endif
 	if (boot_mode == MMCSD_MODE_RAW) {
 		debug("boot mode - RAW\n");
 		mmc_load_image_raw(mmc);
diff --git a/arch/arm/cpu/armv7/omap3/lowlevel_init.S b/arch/arm/cpu/armv7/omap3/lowlevel_init.S
index 48a7ec6..a308ebd 100644
--- a/arch/arm/cpu/armv7/omap3/lowlevel_init.S
+++ b/arch/arm/cpu/armv7/omap3/lowlevel_init.S
@@ -37,8 +37,13 @@  _TEXT_BASE:
 
 .global save_boot_params
 save_boot_params:
-	#warning "Please implement save_boot_params for OMAP3"
-	bx lr
+#ifdef CONFIG_SPL_BUILD
+	ldr	r4, =omap3_boot_device
+	ldr	r5, [r0, #0x4]
+	and	r5, r5, #0xff
+	str	r5, [r4]
+#endif
+	bx	lr
 
 .global omap3_gp_romcode_call
 omap3_gp_romcode_call:
diff --git a/arch/arm/include/asm/omap_common.h b/arch/arm/include/asm/omap_common.h
index 13f6884..6469047 100644
--- a/arch/arm/include/asm/omap_common.h
+++ b/arch/arm/include/asm/omap_common.h
@@ -37,6 +37,7 @@ 
 void preloader_console_init(void);
 
 /* Boot device */
+#ifdef CONFIG_OMAP44XX /* OMAP4 */
 #define BOOT_DEVICE_NONE	0
 #define BOOT_DEVICE_XIP		1
 #define BOOT_DEVICE_XIPWAIT	2
@@ -44,6 +45,15 @@  void preloader_console_init(void);
 #define BOOT_DEVICE_ONE_NAND	4
 #define BOOT_DEVICE_MMC1	5
 #define BOOT_DEVICE_MMC2	6
+#elif CONFIG_OMAP34XX /* OMAP3 */
+#define BOOT_DEVICE_NONE	0
+#define BOOT_DEVICE_XIP		1
+#define BOOT_DEVICE_NAND	2
+#define BOOT_DEVICE_ONE_NAND	3
+#define BOOT_DEVICE_MMC2	5
+#define BOOT_DEVICE_MMC1	6
+#define BOOT_DEVICE_XIPWAIT	7
+#endif
 
 /* Boot type */
 #define	MMCSD_MODE_UNDEFINED	0