All of lore.kernel.org
 help / color / mirror / Atom feed
* [U-Boot] [PATCH] omap3: overo: Select fdtfile for expansion board
@ 2014-06-06 18:37 Ash Charles
  2014-06-07 14:29 ` Stefan Herbrechtsmeier
  0 siblings, 1 reply; 15+ messages in thread
From: Ash Charles @ 2014-06-06 18:37 UTC (permalink / raw)
  To: u-boot

The u-boot Overo board actually supports both Overo (OMAP35xx)
and Overo Storm (AM/DM37xx) COMs with a range of different expansion
boards.  This provides a mechanism to select the an appropriate device
tree file based on the processor version and, if available, the
expansion board ID written on the expansion board EEPROM. To match the
3.15+ kernels, fdtfile names have this format:
 "omap3-overo[-storm]-<expansion board name>.dtb"

By default, we use "omap3-overo-storm-tobi.dtb".

Signed-off-by: Ash Charles <ashcharles@gmail.com>

Conflicts:
	include/configs/omap3_overo.h
---
 board/overo/overo.c           | 48 +++++++++++++++++++++++++++++++++++++++++++
 include/configs/omap3_overo.h |  2 +-
 2 files changed, 49 insertions(+), 1 deletion(-)

diff --git a/board/overo/overo.c b/board/overo/overo.c
index 62b50a8..6a0a655 100644
--- a/board/overo/overo.c
+++ b/board/overo/overo.c
@@ -230,6 +230,52 @@ unsigned int get_expansion_id(void)
 	return expansion_config.device_vendor;
 }
 
+#ifdef CONFIG_OF_LIBFDT
+void set_fdt(void)
+{
+	int is_storm = 0;
+	char fdtname[64];
+	char expansion_name[32];
+
+        if (get_cpu_family() != CPU_OMAP34XX)
+		is_storm = 1;
+
+        switch (expansion_config.device_vendor) {
+        case GUMSTIX_SUMMIT:
+		snprintf(expansion_name, ARRAY_SIZE(expansion_name), "%s",
+		        "summit");
+		break;
+	case GUMSTIX_CHESTNUT43:
+		snprintf(expansion_name, ARRAY_SIZE(expansion_name), "%s",
+		        "chestnut43");
+		break;
+	case GUMSTIX_PALO43:
+		snprintf(expansion_name, ARRAY_SIZE(expansion_name), "%s",
+		        "palo43");
+		break;
+	case GUMSTIX_GALLOP43:
+		snprintf(expansion_name, ARRAY_SIZE(expansion_name), "%s",
+		        "gallop43");
+		break;
+	case GUMSTIX_ALTO35:
+		snprintf(expansion_name, ARRAY_SIZE(expansion_name), "%s",
+		        "alto35");
+		break;
+	case GUMSTIX_TOBI:
+	case GUMSTIX_NO_EEPROM:
+	default:
+		snprintf(expansion_name, ARRAY_SIZE(expansion_name), "%s",
+		        "tobi");
+	}
+
+        snprintf(fdtname, ARRAY_SIZE(fdtname),  "omap3-overo%s-%s.dtb",
+                 is_storm ? "-storm" : "", expansion_name);
+        setenv("fdtfile", fdtname);
+}
+#else
+void set_fdt(void) { return; }
+#endif
+
 /*
  * Routine: misc_init_r
  * Description: Configure board specific parts
@@ -360,6 +406,8 @@ int misc_init_r(void)
 
 	dieid_num_r();
 
+	set_fdt();
+
 	return 0;
 }
 
diff --git a/include/configs/omap3_overo.h b/include/configs/omap3_overo.h
index 7b97be9..f79a528 100644
--- a/include/configs/omap3_overo.h
+++ b/include/configs/omap3_overo.h
@@ -83,7 +83,7 @@
 /* Environment information */
 #define CONFIG_EXTRA_ENV_SETTINGS \
 	DEFAULT_LINUX_BOOT_ENV \
-	"fdtfile=overo.dtb\0" \
+	"fdtfile=omap3-overo-storm-tobi.dtb\0" \
 	"bootdir=/boot\0" \
 	"bootfile=zImage\0" \
 	"usbtty=cdc_acm\0" \
-- 
1.8.3.2

^ permalink raw reply related	[flat|nested] 15+ messages in thread

* [U-Boot] [PATCH] omap3: overo: Select fdtfile for expansion board
  2014-06-06 18:37 [U-Boot] [PATCH] omap3: overo: Select fdtfile for expansion board Ash Charles
@ 2014-06-07 14:29 ` Stefan Herbrechtsmeier
  2014-06-07 17:48   ` Tom Rini
  0 siblings, 1 reply; 15+ messages in thread
From: Stefan Herbrechtsmeier @ 2014-06-07 14:29 UTC (permalink / raw)
  To: u-boot

Am 06.06.2014 20:37, schrieb Ash Charles:
> The u-boot Overo board actually supports both Overo (OMAP35xx)
> and Overo Storm (AM/DM37xx) COMs with a range of different expansion
> boards.  This provides a mechanism to select the an appropriate device
> tree file based on the processor version and, if available, the
> expansion board ID written on the expansion board EEPROM. To match the
> 3.15+ kernels, fdtfile names have this format:
>   "omap3-overo[-storm]-<expansion board name>.dtb"
>
> By default, we use "omap3-overo-storm-tobi.dtb".
>
> Signed-off-by: Ash Charles <ashcharles@gmail.com>
>
> Conflicts:
> 	include/configs/omap3_overo.h
> ---
>   board/overo/overo.c           | 48 +++++++++++++++++++++++++++++++++++++++++++
>   include/configs/omap3_overo.h |  2 +-
>   2 files changed, 49 insertions(+), 1 deletion(-)
>
> diff --git a/board/overo/overo.c b/board/overo/overo.c
> index 62b50a8..6a0a655 100644
> --- a/board/overo/overo.c
> +++ b/board/overo/overo.c
> @@ -230,6 +230,52 @@ unsigned int get_expansion_id(void)
>   	return expansion_config.device_vendor;
>   }
>   
> +#ifdef CONFIG_OF_LIBFDT
> +void set_fdt(void)
> +{
> +	int is_storm = 0;
> +	char fdtname[64];
> +	char expansion_name[32];
> +
> +        if (get_cpu_family() != CPU_OMAP34XX)
> +		is_storm = 1;
> +
> +        switch (expansion_config.device_vendor) {
> +        case GUMSTIX_SUMMIT:
> +		snprintf(expansion_name, ARRAY_SIZE(expansion_name), "%s",
> +		        "summit");
> +		break;
> +	case GUMSTIX_CHESTNUT43:
> +		snprintf(expansion_name, ARRAY_SIZE(expansion_name), "%s",
> +		        "chestnut43");
> +		break;
> +	case GUMSTIX_PALO43:
> +		snprintf(expansion_name, ARRAY_SIZE(expansion_name), "%s",
> +		        "palo43");
> +		break;
> +	case GUMSTIX_GALLOP43:
> +		snprintf(expansion_name, ARRAY_SIZE(expansion_name), "%s",
> +		        "gallop43");
> +		break;
> +	case GUMSTIX_ALTO35:
> +		snprintf(expansion_name, ARRAY_SIZE(expansion_name), "%s",
> +		        "alto35");
> +		break;
> +	case GUMSTIX_TOBI:
> +	case GUMSTIX_NO_EEPROM:
> +	default:
> +		snprintf(expansion_name, ARRAY_SIZE(expansion_name), "%s",
> +		        "tobi");
Why you use the tobi as default (unknown expansion board)?

> +	}
> +
> +        snprintf(fdtname, ARRAY_SIZE(fdtname),  "omap3-overo%s-%s.dtb",
> +                 is_storm ? "-storm" : "", expansion_name);
> +        setenv("fdtfile", fdtname);
This makes it impossible to save the fdtfile in the environment.

Why you don't use an command from the environment and add a boardname as 
you do on the duovero?

It would be nice if the overo could support even unknown boards. I'm 
currently working on some patches to separate the setup of the overo 
board and the expansion board. Together with a fdtfile (or board) name 
in the eeprom the overo could boot on foreigner expansion boards without 
any changes on the bootloader.

> +}
> +#else
> +void set_fdt(void) { return; }
> +#endif
> +
>   /*
>    * Routine: misc_init_r
>    * Description: Configure board specific parts
> @@ -360,6 +406,8 @@ int misc_init_r(void)
>   
>   	dieid_num_r();
>   
> +	set_fdt();
> +
>   	return 0;
>   }
>   
> diff --git a/include/configs/omap3_overo.h b/include/configs/omap3_overo.h
> index 7b97be9..f79a528 100644
> --- a/include/configs/omap3_overo.h
> +++ b/include/configs/omap3_overo.h
> @@ -83,7 +83,7 @@
>   /* Environment information */
>   #define CONFIG_EXTRA_ENV_SETTINGS \
>   	DEFAULT_LINUX_BOOT_ENV \
> -	"fdtfile=overo.dtb\0" \
> +	"fdtfile=omap3-overo-storm-tobi.dtb\0" \
>   	"bootdir=/boot\0" \
>   	"bootfile=zImage\0" \
>   	"usbtty=cdc_acm\0" \

^ permalink raw reply	[flat|nested] 15+ messages in thread

* [U-Boot] [PATCH] omap3: overo: Select fdtfile for expansion board
  2014-06-07 14:29 ` Stefan Herbrechtsmeier
@ 2014-06-07 17:48   ` Tom Rini
  2014-06-07 20:11     ` Ash Charles
  0 siblings, 1 reply; 15+ messages in thread
From: Tom Rini @ 2014-06-07 17:48 UTC (permalink / raw)
  To: u-boot

On Sat, Jun 07, 2014 at 04:29:27PM +0200, Stefan Herbrechtsmeier wrote:
> Am 06.06.2014 20:37, schrieb Ash Charles:
> >The u-boot Overo board actually supports both Overo (OMAP35xx)
> >and Overo Storm (AM/DM37xx) COMs with a range of different expansion
> >boards.  This provides a mechanism to select the an appropriate device
> >tree file based on the processor version and, if available, the
> >expansion board ID written on the expansion board EEPROM. To match the
> >3.15+ kernels, fdtfile names have this format:
> >  "omap3-overo[-storm]-<expansion board name>.dtb"
[snip]
> >+        snprintf(fdtname, ARRAY_SIZE(fdtname),  "omap3-overo%s-%s.dtb",
> >+                 is_storm ? "-storm" : "", expansion_name);
> >+        setenv("fdtfile", fdtname);
> This makes it impossible to save the fdtfile in the environment.
> 
> Why you don't use an command from the environment and add a
> boardname as you do on the duovero?

In this case it might be harder to do this in a shell cmd.  But we
_must_ check for fdtfile being unset and only setenv if not already set.
And then drop fdtfile from the config file.

-- 
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 836 bytes
Desc: Digital signature
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20140607/33a532bc/attachment.pgp>

^ permalink raw reply	[flat|nested] 15+ messages in thread

* [U-Boot] [PATCH] omap3: overo: Select fdtfile for expansion board
  2014-06-07 17:48   ` Tom Rini
@ 2014-06-07 20:11     ` Ash Charles
  2014-06-08  7:57       ` Stefan Herbrechtsmeier
  0 siblings, 1 reply; 15+ messages in thread
From: Ash Charles @ 2014-06-07 20:11 UTC (permalink / raw)
  To: u-boot

On Sat, Jun 7, 2014 at 10:48 AM, Tom Rini <trini@ti.com> wrote:
> In this case it might be harder to do this in a shell cmd.  But we
> _must_ check for fdtfile being unset and only setenv if not already set.
> And then drop fdtfile from the config file.

Stefan and Tom,

Thanks both for your comments and suggestions.  I agree that fdtfile
should only be set if it is currently unset---I'll send an updated
patch.
There is actually already a mechanism for environment variables to be
set by the board eeprom [1][2] so an expansion board could certainly
set the desired fdtfile name.  The challenge (and my biggest
motivation for writing the patch) is making sure we select a dtb for
either 37xx (Overo Storm) or 35xx (non-storm) as otherwise Linux
doesn't boot.

--Ash
[1] http://elinux.org/BeagleBoardPinMux#Expansion_boards
[2] https://github.com/gumstix/meta-gumstix-extras/blob/dylan/recipes-core/i2c-tools/omap3-writeprom/writeprom.sh

^ permalink raw reply	[flat|nested] 15+ messages in thread

* [U-Boot] [PATCH] omap3: overo: Select fdtfile for expansion board
  2014-06-07 20:11     ` Ash Charles
@ 2014-06-08  7:57       ` Stefan Herbrechtsmeier
  2014-06-09 20:47         ` Ash Charles
  0 siblings, 1 reply; 15+ messages in thread
From: Stefan Herbrechtsmeier @ 2014-06-08  7:57 UTC (permalink / raw)
  To: u-boot

Am 07.06.2014 22:11, schrieb Ash Charles:
> On Sat, Jun 7, 2014 at 10:48 AM, Tom Rini <trini@ti.com> wrote:
>> In this case it might be harder to do this in a shell cmd.  But we
>> _must_ check for fdtfile being unset and only setenv if not already set.
>> And then drop fdtfile from the config file.
> Thanks both for your comments and suggestions.  I agree that fdtfile
> should only be set if it is currently unset---I'll send an updated
> patch.
It would be nice if you only set an environment variable 'expansionname' 
and setup the fdtfile via a command in the environment. This makes sure, 
that under normal condition the fdtfile is not set and thereby not saved 
in the environment with the command saveenv.

> There is actually already a mechanism for environment variables to be
> set by the board eeprom [1][2] so an expansion board could certainly
> set the desired fdtfile name.
At the moment I use this functionality to set the environment variable 
'fdtfile'.

>    The challenge (and my biggest
> motivation for writing the patch) is making sure we select a dtb for
> either 37xx (Overo Storm) or 35xx (non-storm) as otherwise Linux
> doesn't boot.
Maybe you could set an environment variable 'boardname' to 'overo' or 
'overo-storm' and use something like the following environment command:

if test -n \"${boardname}\" && test -n \"${expansionname}\"; then
     setenv fdtfile omap3-${boardname}-${expansionname}.dtb;
fi;

This allows the expansion board to set the expansionname via eeprom and 
works with both overo boards.

>
> --Ash
> [1] http://elinux.org/BeagleBoardPinMux#Expansion_boards
> [2] https://github.com/gumstix/meta-gumstix-extras/blob/dylan/recipes-core/i2c-tools/omap3-writeprom/writeprom.sh

^ permalink raw reply	[flat|nested] 15+ messages in thread

* [U-Boot] [PATCH] omap3: overo: Select fdtfile for expansion board
  2014-06-08  7:57       ` Stefan Herbrechtsmeier
@ 2014-06-09 20:47         ` Ash Charles
  2014-06-09 20:47           ` [U-Boot] [Patch v2] " Ash Charles
  0 siblings, 1 reply; 15+ messages in thread
From: Ash Charles @ 2014-06-09 20:47 UTC (permalink / raw)
  To: u-boot

On Sun, Jun 8, 2014 at 12:57 AM, Stefan Herbrechtsmeier
<stefan@herbrechtsmeier.net> wrote:
> At the moment I use this functionality to set the environment variable
> 'fdtfile'.
Cool :)
....
> Maybe you could set an environment variable 'boardname' to 'overo' or
> 'overo-storm' and use something like the following environment command:
>
> if test -n \"${boardname}\" && test -n \"${expansionname}\"; then
>     setenv fdtfile omap3-${boardname}-${expansionname}.dtb;
> fi;
>
> This allows the expansion board to set the expansionname via eeprom and
> works with both overo boards.
What is the value in testing for ${boardname} and ${expansionname}?
Shouldn't I just test for fdtfile and, if it is not set, proceed to
set it you propose? ${boardname} and ${expansionname} could be set on
boot. I'm sending an updated version of the patch for your comments
(sorry..compile-tested only as I'm not near hardware today).

--Ash

^ permalink raw reply	[flat|nested] 15+ messages in thread

* [U-Boot] [Patch v2] omap3: overo: Select fdtfile for expansion board
  2014-06-09 20:47         ` Ash Charles
@ 2014-06-09 20:47           ` Ash Charles
  2014-06-10  7:30             ` Stefan Herbrechtsmeier
  0 siblings, 1 reply; 15+ messages in thread
From: Ash Charles @ 2014-06-09 20:47 UTC (permalink / raw)
  To: u-boot

The u-boot Overo board actually supports both Overo (OMAP35xx)
and Overo Storm (AM/DM37xx) COMs with a range of different expansion
boards.  This provides a mechanism to select the an appropriate device
tree file based on the processor version and, if available, the
expansion board ID written on the expansion board EEPROM. To match the
3.15+ kernels, fdtfile names have this format:
 "omap3-overo[-storm]-<expansion board name>.dtb"

By default, we use "omap3-overo-storm-tobi.dtb".

Signed-off-by: Ash Charles <ashcharles@gmail.com>

Conflicts:
	include/configs/omap3_overo.h
---
 board/overo/overo.c           | 12 ++++++++++++
 include/configs/omap3_overo.h | 10 +++++-----
 2 files changed, 17 insertions(+), 5 deletions(-)

diff --git a/board/overo/overo.c b/board/overo/overo.c
index 62b50a8..02b606c 100644
--- a/board/overo/overo.c
+++ b/board/overo/overo.c
@@ -267,12 +267,14 @@ int misc_init_r(void)
 			expansion_config.revision,
 			expansion_config.fab_revision);
 		setenv("defaultdisplay", "dvi");
+		setenv("expansionname", "summit");
 		break;
 	case GUMSTIX_TOBI:
 		printf("Recognized Tobi expansion board (rev %d %s)\n",
 			expansion_config.revision,
 			expansion_config.fab_revision);
 		setenv("defaultdisplay", "dvi");
+		setenv("expansionname", "tobi");
 		break;
 	case GUMSTIX_TOBI_DUO:
 		printf("Recognized Tobi Duo expansion board (rev %d %s)\n",
@@ -293,12 +295,14 @@ int misc_init_r(void)
 			expansion_config.revision,
 			expansion_config.fab_revision);
 		setenv("defaultdisplay", "lcd43");
+		setenv("expansionname", "palo43");
 		break;
 	case GUMSTIX_CHESTNUT43:
 		printf("Recognized Chestnut43 expansion board (rev %d %s)\n",
 			expansion_config.revision,
 			expansion_config.fab_revision);
 		setenv("defaultdisplay", "lcd43");
+		setenv("expansionname", "chestnut43");
 		break;
 	case GUMSTIX_PINTO:
 		printf("Recognized Pinto expansion board (rev %d %s)\n",
@@ -310,6 +314,7 @@ int misc_init_r(void)
 			expansion_config.revision,
 			expansion_config.fab_revision);
 		setenv("defaultdisplay", "lcd43");
+		setenv("expansionname", "gallop43");
 		break;
 	case GUMSTIX_ALTO35:
 		printf("Recognized Alto35 expansion board (rev %d %s)\n",
@@ -317,6 +322,7 @@ int misc_init_r(void)
 			expansion_config.fab_revision);
 		MUX_ALTO35();
 		setenv("defaultdisplay", "lcd35");
+		setenv("expansionname", "alto35");
 		break;
 	case GUMSTIX_STAGECOACH:
 		printf("Recognized Stagecoach expansion board (rev %d %s)\n",
@@ -352,6 +358,7 @@ int misc_init_r(void)
 		break;
 	default:
 		printf("Unrecognized expansion board 0x%08x\n", expansion_id);
+		setenv("expansionname", "tobi");
 		break;
 	}
 
@@ -360,6 +367,11 @@ int misc_init_r(void)
 
 	dieid_num_r();
 
+        if (get_cpu_family() == CPU_OMAP34XX)
+		setenv(boardname, "overo")
+        else:
+		setenv(boardname, "overo-storm")
+
 	return 0;
 }
 
diff --git a/include/configs/omap3_overo.h b/include/configs/omap3_overo.h
index 1a13633..f7483a0 100644
--- a/include/configs/omap3_overo.h
+++ b/include/configs/omap3_overo.h
@@ -83,7 +83,6 @@
 /* Environment information */
 #define CONFIG_EXTRA_ENV_SETTINGS \
 	DEFAULT_LINUX_BOOT_ENV \
-	"fdtfile=overo.dtb\0" \
 	"bootdir=/boot\0" \
 	"bootfile=zImage\0" \
 	"usbtty=cdc_acm\0" \
@@ -152,10 +151,11 @@
 			"run mmcboot;" \
 		"fi;" \
 		"if run loadzimage; then " \
-			"if test -n $fdtfile; then " \
-				"if run loadfdt; then " \
-					"run mmcbootfdt;" \
-				"fi;" \
+			"if test $fdtfile; then " \
+				"setenv fdtfile omap3-${boardname}-${expansionname}.dtb;" \
+			"fi;" \
+			"if run loadfdt; then " \
+				"run mmcbootfdt;" \
 			"fi;" \
 		"fi;" \
 	"fi;" \
-- 
1.8.3.2

^ permalink raw reply related	[flat|nested] 15+ messages in thread

* [U-Boot] [Patch v2] omap3: overo: Select fdtfile for expansion board
  2014-06-09 20:47           ` [U-Boot] [Patch v2] " Ash Charles
@ 2014-06-10  7:30             ` Stefan Herbrechtsmeier
  2014-06-10 17:17               ` Ash Charles
  0 siblings, 1 reply; 15+ messages in thread
From: Stefan Herbrechtsmeier @ 2014-06-10  7:30 UTC (permalink / raw)
  To: u-boot

Am 09.06.2014 22:47, schrieb Ash Charles:
> The u-boot Overo board actually supports both Overo (OMAP35xx)
> and Overo Storm (AM/DM37xx) COMs with a range of different expansion
> boards.  This provides a mechanism to select the an appropriate device
> tree file based on the processor version and, if available, the
> expansion board ID written on the expansion board EEPROM. To match the
> 3.15+ kernels, fdtfile names have this format:
>   "omap3-overo[-storm]-<expansion board name>.dtb"
>
> By default, we use "omap3-overo-storm-tobi.dtb".
>
> Signed-off-by: Ash Charles <ashcharles@gmail.com>
>
> Conflicts:
> 	include/configs/omap3_overo.h
> ---
>   board/overo/overo.c           | 12 ++++++++++++
>   include/configs/omap3_overo.h | 10 +++++-----
>   2 files changed, 17 insertions(+), 5 deletions(-)
>
> diff --git a/board/overo/overo.c b/board/overo/overo.c
> index 62b50a8..02b606c 100644
> --- a/board/overo/overo.c
> +++ b/board/overo/overo.c
> @@ -267,12 +267,14 @@ int misc_init_r(void)
>   			expansion_config.revision,
>   			expansion_config.fab_revision);
>   		setenv("defaultdisplay", "dvi");
> +		setenv("expansionname", "summit");
>   		break;
>   	case GUMSTIX_TOBI:
>   		printf("Recognized Tobi expansion board (rev %d %s)\n",
>   			expansion_config.revision,
>   			expansion_config.fab_revision);
>   		setenv("defaultdisplay", "dvi");
> +		setenv("expansionname", "tobi");
>   		break;
>   	case GUMSTIX_TOBI_DUO:
>   		printf("Recognized Tobi Duo expansion board (rev %d %s)\n",
> @@ -293,12 +295,14 @@ int misc_init_r(void)
>   			expansion_config.revision,
>   			expansion_config.fab_revision);
>   		setenv("defaultdisplay", "lcd43");
> +		setenv("expansionname", "palo43");
>   		break;
>   	case GUMSTIX_CHESTNUT43:
>   		printf("Recognized Chestnut43 expansion board (rev %d %s)\n",
>   			expansion_config.revision,
>   			expansion_config.fab_revision);
>   		setenv("defaultdisplay", "lcd43");
> +		setenv("expansionname", "chestnut43");
>   		break;
>   	case GUMSTIX_PINTO:
>   		printf("Recognized Pinto expansion board (rev %d %s)\n",
> @@ -310,6 +314,7 @@ int misc_init_r(void)
>   			expansion_config.revision,
>   			expansion_config.fab_revision);
>   		setenv("defaultdisplay", "lcd43");
> +		setenv("expansionname", "gallop43");
>   		break;
>   	case GUMSTIX_ALTO35:
>   		printf("Recognized Alto35 expansion board (rev %d %s)\n",
> @@ -317,6 +322,7 @@ int misc_init_r(void)
>   			expansion_config.fab_revision);
>   		MUX_ALTO35();
>   		setenv("defaultdisplay", "lcd35");
> +		setenv("expansionname", "alto35");
>   		break;
>   	case GUMSTIX_STAGECOACH:
>   		printf("Recognized Stagecoach expansion board (rev %d %s)\n",
> @@ -352,6 +358,7 @@ int misc_init_r(void)
>   		break;
>   	default:
>   		printf("Unrecognized expansion board 0x%08x\n", expansion_id);
> +		setenv("expansionname", "tobi");
Why you set the 'expansionname' to 'tobi' for unknown (maybe foreign) 
expansion boards?

>   		break;
>   	}
What happens if the eeprom is empty, no eeprom is available or the ETTUS 
expansion board is present? In this case the expansionname is empty.

>   
> @@ -360,6 +367,11 @@ int misc_init_r(void)
>   
>   	dieid_num_r();
>   
> +        if (get_cpu_family() == CPU_OMAP34XX)
> +		setenv(boardname, "overo")
> +        else:
> +		setenv(boardname, "overo-storm")
> +
>   	return 0;
>   }
>   
> diff --git a/include/configs/omap3_overo.h b/include/configs/omap3_overo.h
> index 1a13633..f7483a0 100644
> --- a/include/configs/omap3_overo.h
> +++ b/include/configs/omap3_overo.h
> @@ -83,7 +83,6 @@
>   /* Environment information */
>   #define CONFIG_EXTRA_ENV_SETTINGS \
>   	DEFAULT_LINUX_BOOT_ENV \
> -	"fdtfile=overo.dtb\0" \
>   	"bootdir=/boot\0" \
>   	"bootfile=zImage\0" \
>   	"usbtty=cdc_acm\0" \
> @@ -152,10 +151,11 @@
>   			"run mmcboot;" \
>   		"fi;" \
>   		"if run loadzimage; then " \
> -			"if test -n $fdtfile; then " \
> -				"if run loadfdt; then " \
> -					"run mmcbootfdt;" \
> -				"fi;" \
> +			"if test $fdtfile; then " \
> +				"setenv fdtfile omap3-${boardname}-${expansionname}.dtb;" \
> +			"fi;" \
> +			"if run loadfdt; then " \
> +				"run mmcbootfdt;" \
>   			"fi;" \
>   		"fi;" \
>   	"fi;" \

^ permalink raw reply	[flat|nested] 15+ messages in thread

* [U-Boot] [Patch v2] omap3: overo: Select fdtfile for expansion board
  2014-06-10  7:30             ` Stefan Herbrechtsmeier
@ 2014-06-10 17:17               ` Ash Charles
  2014-06-10 18:06                 ` Stefan Herbrechtsmeier
  0 siblings, 1 reply; 15+ messages in thread
From: Ash Charles @ 2014-06-10 17:17 UTC (permalink / raw)
  To: u-boot

On Tue, Jun 10, 2014 at 12:30 AM, Stefan Herbrechtsmeier
<stefan@herbrechtsmeier.net> wrote:
> Why you set the 'expansionname' to 'tobi' for unknown (maybe foreign)
> expansion boards?
1. We need some sort of default otherwise people's boards that either
don't have an eeprom or don't have board data set in the eeprom will
stop booting.  Some Overo COMs don't have NAND therefore there is not
a good mechansim for saving the environment.
2. Tobi has been the default for ages and it is reasonable generic
choice.  It is also the most common expansion board for Overo COMs out
there.
>
>>                 break;
>>         }
>
> What happens if the eeprom is empty, no eeprom is available or the ETTUS
> expansion board is present? In this case the expansionname is empty.
I think 'expansionname' is set to 'tobi' in the default case of the
switch statement.

--Ash

^ permalink raw reply	[flat|nested] 15+ messages in thread

* [U-Boot] [Patch v2] omap3: overo: Select fdtfile for expansion board
  2014-06-10 17:17               ` Ash Charles
@ 2014-06-10 18:06                 ` Stefan Herbrechtsmeier
  2014-06-10 19:00                   ` Ash Charles
  0 siblings, 1 reply; 15+ messages in thread
From: Stefan Herbrechtsmeier @ 2014-06-10 18:06 UTC (permalink / raw)
  To: u-boot

Am 10.06.2014 19:17, schrieb Ash Charles:
> On Tue, Jun 10, 2014 at 12:30 AM, Stefan Herbrechtsmeier
> <stefan@herbrechtsmeier.net>  wrote:
>> Why you set the 'expansionname' to 'tobi' for unknown (maybe foreign)
>> expansion boards?
> 1. We need some sort of default otherwise people's boards that either
> don't have an eeprom or don't have board data set in the eeprom will
> stop booting.
But this cases are handled by GUMSTIX_NO_EEPROM. The default is used for 
a programmed eeprom with an unknown vendor and device id.

>    Some Overo COMs don't have NAND therefore there is not
> a good mechansim for saving the environment.
You could use an environment file next to the u-boot image.

> 2. Tobi has been the default for ages and it is reasonable generic
> choice.  It is also the most common expansion board for Overo COMs out
> there.
Ok, but please use the GUMSTIX_NO_EEPROM case and leave the default 
empty or at least check the vendor id. This allows foreign vendors to 
use the upstream u-boot if they have an eeprom on there expansion board.

>>>                  break;
>>>          }
>> What happens if the eeprom is empty, no eeprom is available or the ETTUS
>> expansion board is present? In this case the expansionname is empty.
> I think 'expansionname' is set to 'tobi' in the default case of the
> switch statement.
I think you mixed the GUMSTIX_NO_EEPROM and default case.

^ permalink raw reply	[flat|nested] 15+ messages in thread

* [U-Boot] [Patch v2] omap3: overo: Select fdtfile for expansion board
  2014-06-10 18:06                 ` Stefan Herbrechtsmeier
@ 2014-06-10 19:00                   ` Ash Charles
  2014-06-10 19:02                     ` [U-Boot] [Patch v3] " Ash Charles
  0 siblings, 1 reply; 15+ messages in thread
From: Ash Charles @ 2014-06-10 19:00 UTC (permalink / raw)
  To: u-boot

On Tue, Jun 10, 2014 at 11:06 AM, Stefan Herbrechtsmeier
<stefan@herbrechtsmeier.net> wrote:
> You could use an environment file next to the u-boot image.
Good point.
...
> Ok, but please use the GUMSTIX_NO_EEPROM case and leave the default empty or
> at least check the vendor id. This allows foreign vendors to use the
> upstream u-boot if they have an eeprom on there expansion board.
Okay---this makes sense. I'm resending with 'tobi' in the
GUMSTIX_NO_EEPROM case instead.  I've added a test on vendor id in the
default case to likewise use tobi in the case where the eeprom is
responsive but un-programmed.
...
> I think you mixed the GUMSTIX_NO_EEPROM and default case.
Yes---you're totally correct---thanks for catching this.

--Ash

^ permalink raw reply	[flat|nested] 15+ messages in thread

* [U-Boot] [Patch v3] omap3: overo: Select fdtfile for expansion board
  2014-06-10 19:00                   ` Ash Charles
@ 2014-06-10 19:02                     ` Ash Charles
  2014-06-10 19:29                       ` Stefan Herbrechtsmeier
  2014-06-19 22:02                       ` [U-Boot] [U-Boot, " Tom Rini
  0 siblings, 2 replies; 15+ messages in thread
From: Ash Charles @ 2014-06-10 19:02 UTC (permalink / raw)
  To: u-boot

The u-boot Overo board actually supports both Overo (OMAP35xx)
and Overo Storm (AM/DM37xx) COMs with a range of different expansion
boards.  This provides a mechanism to select the an appropriate device
tree file based on the processor version and, if available, the
expansion board ID written on the expansion board EEPROM. To match the
3.15+ kernels, fdtfile names have this format:
 "omap3-overo[-storm]-<expansion board name>.dtb"

By default, we use "omap3-overo-storm-tobi.dtb".

Signed-off-by: Ash Charles <ashcharles@gmail.com>

Conflicts:
	include/configs/omap3_overo.h
---
 board/overo/overo.c           | 14 ++++++++++++++
 include/configs/omap3_overo.h | 10 +++++-----
 2 files changed, 19 insertions(+), 5 deletions(-)

diff --git a/board/overo/overo.c b/board/overo/overo.c
index 62b50a8..13220c5 100644
--- a/board/overo/overo.c
+++ b/board/overo/overo.c
@@ -267,12 +267,14 @@ int misc_init_r(void)
 			expansion_config.revision,
 			expansion_config.fab_revision);
 		setenv("defaultdisplay", "dvi");
+		setenv("expansionname", "summit");
 		break;
 	case GUMSTIX_TOBI:
 		printf("Recognized Tobi expansion board (rev %d %s)\n",
 			expansion_config.revision,
 			expansion_config.fab_revision);
 		setenv("defaultdisplay", "dvi");
+		setenv("expansionname", "tobi");
 		break;
 	case GUMSTIX_TOBI_DUO:
 		printf("Recognized Tobi Duo expansion board (rev %d %s)\n",
@@ -293,12 +295,14 @@ int misc_init_r(void)
 			expansion_config.revision,
 			expansion_config.fab_revision);
 		setenv("defaultdisplay", "lcd43");
+		setenv("expansionname", "palo43");
 		break;
 	case GUMSTIX_CHESTNUT43:
 		printf("Recognized Chestnut43 expansion board (rev %d %s)\n",
 			expansion_config.revision,
 			expansion_config.fab_revision);
 		setenv("defaultdisplay", "lcd43");
+		setenv("expansionname", "chestnut43");
 		break;
 	case GUMSTIX_PINTO:
 		printf("Recognized Pinto expansion board (rev %d %s)\n",
@@ -310,6 +314,7 @@ int misc_init_r(void)
 			expansion_config.revision,
 			expansion_config.fab_revision);
 		setenv("defaultdisplay", "lcd43");
+		setenv("expansionname", "gallop43");
 		break;
 	case GUMSTIX_ALTO35:
 		printf("Recognized Alto35 expansion board (rev %d %s)\n",
@@ -317,6 +322,7 @@ int misc_init_r(void)
 			expansion_config.fab_revision);
 		MUX_ALTO35();
 		setenv("defaultdisplay", "lcd35");
+		setenv("expansionname", "alto35");
 		break;
 	case GUMSTIX_STAGECOACH:
 		printf("Recognized Stagecoach expansion board (rev %d %s)\n",
@@ -349,8 +355,11 @@ int misc_init_r(void)
 		break;
 	case GUMSTIX_NO_EEPROM:
 		puts("No EEPROM on expansion board\n");
+		setenv("expansionname", "tobi");
 		break;
 	default:
+		if (expansion_id == 0x0)
+			setenv("expansionname", "tobi");
 		printf("Unrecognized expansion board 0x%08x\n", expansion_id);
 		break;
 	}
@@ -360,6 +369,11 @@ int misc_init_r(void)
 
 	dieid_num_r();
 
+	if (get_cpu_family() == CPU_OMAP34XX)
+		setenv("boardname", "overo");
+	else
+		setenv("boardname", "overo-storm");
+
 	return 0;
 }
 
diff --git a/include/configs/omap3_overo.h b/include/configs/omap3_overo.h
index 1a13633..f7483a0 100644
--- a/include/configs/omap3_overo.h
+++ b/include/configs/omap3_overo.h
@@ -83,7 +83,6 @@
 /* Environment information */
 #define CONFIG_EXTRA_ENV_SETTINGS \
 	DEFAULT_LINUX_BOOT_ENV \
-	"fdtfile=overo.dtb\0" \
 	"bootdir=/boot\0" \
 	"bootfile=zImage\0" \
 	"usbtty=cdc_acm\0" \
@@ -152,10 +151,11 @@
 			"run mmcboot;" \
 		"fi;" \
 		"if run loadzimage; then " \
-			"if test -n $fdtfile; then " \
-				"if run loadfdt; then " \
-					"run mmcbootfdt;" \
-				"fi;" \
+			"if test $fdtfile; then " \
+				"setenv fdtfile omap3-${boardname}-${expansionname}.dtb;" \
+			"fi;" \
+			"if run loadfdt; then " \
+				"run mmcbootfdt;" \
 			"fi;" \
 		"fi;" \
 	"fi;" \
-- 
1.8.3.2

^ permalink raw reply related	[flat|nested] 15+ messages in thread

* [U-Boot] [Patch v3] omap3: overo: Select fdtfile for expansion board
  2014-06-10 19:02                     ` [U-Boot] [Patch v3] " Ash Charles
@ 2014-06-10 19:29                       ` Stefan Herbrechtsmeier
  2014-06-10 20:28                         ` Ash Charles
  2014-06-19 22:02                       ` [U-Boot] [U-Boot, " Tom Rini
  1 sibling, 1 reply; 15+ messages in thread
From: Stefan Herbrechtsmeier @ 2014-06-10 19:29 UTC (permalink / raw)
  To: u-boot

Am 10.06.2014 21:02, schrieb Ash Charles:
> The u-boot Overo board actually supports both Overo (OMAP35xx)
> and Overo Storm (AM/DM37xx) COMs with a range of different expansion
> boards.  This provides a mechanism to select the an appropriate device
> tree file based on the processor version and, if available, the
> expansion board ID written on the expansion board EEPROM. To match the
> 3.15+ kernels, fdtfile names have this format:
>   "omap3-overo[-storm]-<expansion board name>.dtb"
>
> By default, we use "omap3-overo-storm-tobi.dtb".
>
> Signed-off-by: Ash Charles <ashcharles@gmail.com>
>
> Conflicts:
> 	include/configs/omap3_overo.h
> ---
>   board/overo/overo.c           | 14 ++++++++++++++
>   include/configs/omap3_overo.h | 10 +++++-----
>   2 files changed, 19 insertions(+), 5 deletions(-)
>
> diff --git a/board/overo/overo.c b/board/overo/overo.c
> index 62b50a8..13220c5 100644
> --- a/board/overo/overo.c
> +++ b/board/overo/overo.c
> @@ -267,12 +267,14 @@ int misc_init_r(void)
>   			expansion_config.revision,
>   			expansion_config.fab_revision);
>   		setenv("defaultdisplay", "dvi");
> +		setenv("expansionname", "summit");
>   		break;
>   	case GUMSTIX_TOBI:
>   		printf("Recognized Tobi expansion board (rev %d %s)\n",
>   			expansion_config.revision,
>   			expansion_config.fab_revision);
>   		setenv("defaultdisplay", "dvi");
> +		setenv("expansionname", "tobi");
>   		break;
>   	case GUMSTIX_TOBI_DUO:
>   		printf("Recognized Tobi Duo expansion board (rev %d %s)\n",
> @@ -293,12 +295,14 @@ int misc_init_r(void)
>   			expansion_config.revision,
>   			expansion_config.fab_revision);
>   		setenv("defaultdisplay", "lcd43");
> +		setenv("expansionname", "palo43");
>   		break;
>   	case GUMSTIX_CHESTNUT43:
>   		printf("Recognized Chestnut43 expansion board (rev %d %s)\n",
>   			expansion_config.revision,
>   			expansion_config.fab_revision);
>   		setenv("defaultdisplay", "lcd43");
> +		setenv("expansionname", "chestnut43");
>   		break;
>   	case GUMSTIX_PINTO:
>   		printf("Recognized Pinto expansion board (rev %d %s)\n",
> @@ -310,6 +314,7 @@ int misc_init_r(void)
>   			expansion_config.revision,
>   			expansion_config.fab_revision);
>   		setenv("defaultdisplay", "lcd43");
> +		setenv("expansionname", "gallop43");
>   		break;
>   	case GUMSTIX_ALTO35:
>   		printf("Recognized Alto35 expansion board (rev %d %s)\n",
> @@ -317,6 +322,7 @@ int misc_init_r(void)
>   			expansion_config.fab_revision);
>   		MUX_ALTO35();
>   		setenv("defaultdisplay", "lcd35");
> +		setenv("expansionname", "alto35");
>   		break;
>   	case GUMSTIX_STAGECOACH:
>   		printf("Recognized Stagecoach expansion board (rev %d %s)\n",
> @@ -349,8 +355,11 @@ int misc_init_r(void)
>   		break;
>   	case GUMSTIX_NO_EEPROM:
>   		puts("No EEPROM on expansion board\n");
> +		setenv("expansionname", "tobi");
>   		break;
>   	default:
> +		if (expansion_id == 0x0)
> +			setenv("expansionname", "tobi");
You should add an additional case (0x0) above GUMSTIX_NO_EEPROM but an 
un-programmed eeprom returns GUMSTIX_NO_EEPROM (0xffffffff).

>   		printf("Unrecognized expansion board 0x%08x\n", expansion_id);
>   		break;
>   	}
> @@ -360,6 +369,11 @@ int misc_init_r(void)
>   
>   	dieid_num_r();
>   
> +	if (get_cpu_family() == CPU_OMAP34XX)
> +		setenv("boardname", "overo");
> +	else
> +		setenv("boardname", "overo-storm");
> +
>   	return 0;
>   }
>   
> diff --git a/include/configs/omap3_overo.h b/include/configs/omap3_overo.h
> index 1a13633..f7483a0 100644
> --- a/include/configs/omap3_overo.h
> +++ b/include/configs/omap3_overo.h
> @@ -83,7 +83,6 @@
>   /* Environment information */
>   #define CONFIG_EXTRA_ENV_SETTINGS \
>   	DEFAULT_LINUX_BOOT_ENV \
> -	"fdtfile=overo.dtb\0" \
>   	"bootdir=/boot\0" \
>   	"bootfile=zImage\0" \
>   	"usbtty=cdc_acm\0" \
> @@ -152,10 +151,11 @@
>   			"run mmcboot;" \
>   		"fi;" \
>   		"if run loadzimage; then " \
> -			"if test -n $fdtfile; then " \
> -				"if run loadfdt; then " \
> -					"run mmcbootfdt;" \
> -				"fi;" \
> +			"if test $fdtfile; then " \
> +				"setenv fdtfile omap3-${boardname}-${expansionname}.dtb;" \
> +			"fi;" \
> +			"if run loadfdt; then " \
> +				"run mmcbootfdt;" \
>   			"fi;" \
>   		"fi;" \
>   	"fi;" \

^ permalink raw reply	[flat|nested] 15+ messages in thread

* [U-Boot] [Patch v3] omap3: overo: Select fdtfile for expansion board
  2014-06-10 19:29                       ` Stefan Herbrechtsmeier
@ 2014-06-10 20:28                         ` Ash Charles
  0 siblings, 0 replies; 15+ messages in thread
From: Ash Charles @ 2014-06-10 20:28 UTC (permalink / raw)
  To: u-boot

On Tue, Jun 10, 2014 at 12:29 PM, Stefan Herbrechtsmeier
<stefan@herbrechtsmeier.net> wrote:
> You should add an additional case (0x0) above GUMSTIX_NO_EEPROM but an
> un-programmed eeprom returns GUMSTIX_NO_EEPROM (0xffffffff).
Forgive my stupidity---I don't follow.
Either,
1. No eeprom is probed or expansion_id is 0xFFFFFFFF (blank)--->this
gets caught by the GUMSTIX_NO_EEPROM case, or
2. An eeprom written with all zeros is read--->this gets caught by the
if statement nested in the default case.

Thanks for your patience in trying to find a change that works generally.

--Ash

^ permalink raw reply	[flat|nested] 15+ messages in thread

* [U-Boot] [U-Boot, v3] omap3: overo: Select fdtfile for expansion board
  2014-06-10 19:02                     ` [U-Boot] [Patch v3] " Ash Charles
  2014-06-10 19:29                       ` Stefan Herbrechtsmeier
@ 2014-06-19 22:02                       ` Tom Rini
  1 sibling, 0 replies; 15+ messages in thread
From: Tom Rini @ 2014-06-19 22:02 UTC (permalink / raw)
  To: u-boot

On Tue, Jun 10, 2014 at 12:02:36PM -0700, Ash Charles wrote:

> The u-boot Overo board actually supports both Overo (OMAP35xx)
> and Overo Storm (AM/DM37xx) COMs with a range of different expansion
> boards.  This provides a mechanism to select the an appropriate device
> tree file based on the processor version and, if available, the
> expansion board ID written on the expansion board EEPROM. To match the
> 3.15+ kernels, fdtfile names have this format:
>  "omap3-overo[-storm]-<expansion board name>.dtb"
> 
> By default, we use "omap3-overo-storm-tobi.dtb".
> 
> Signed-off-by: Ash Charles <ashcharles@gmail.com>

Applied to u-boot-ti/master, thanks!

-- 
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 836 bytes
Desc: Digital signature
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20140619/762f380c/attachment.pgp>

^ permalink raw reply	[flat|nested] 15+ messages in thread

end of thread, other threads:[~2014-06-19 22:02 UTC | newest]

Thread overview: 15+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-06-06 18:37 [U-Boot] [PATCH] omap3: overo: Select fdtfile for expansion board Ash Charles
2014-06-07 14:29 ` Stefan Herbrechtsmeier
2014-06-07 17:48   ` Tom Rini
2014-06-07 20:11     ` Ash Charles
2014-06-08  7:57       ` Stefan Herbrechtsmeier
2014-06-09 20:47         ` Ash Charles
2014-06-09 20:47           ` [U-Boot] [Patch v2] " Ash Charles
2014-06-10  7:30             ` Stefan Herbrechtsmeier
2014-06-10 17:17               ` Ash Charles
2014-06-10 18:06                 ` Stefan Herbrechtsmeier
2014-06-10 19:00                   ` Ash Charles
2014-06-10 19:02                     ` [U-Boot] [Patch v3] " Ash Charles
2014-06-10 19:29                       ` Stefan Herbrechtsmeier
2014-06-10 20:28                         ` Ash Charles
2014-06-19 22:02                       ` [U-Boot] [U-Boot, " Tom Rini

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.