Skip to contentSkip to conversation

omap3: overo: Select fdtfile for expansion board

PATCH New Ash Charles 3 participants 15 messages Jun 6, 2014 – Jun 19, 2014

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 omap3: overo: Select fdtfile for expansion board

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".

Conflicts:
include/configs/omap3_overo.h

---
 board/overo/overo.c           | 48 +++++++++++++++++++++++++++++++++++++++++++
 include/configs/omap3_overo.h |  2 +-
 2 files changed, 49 insertions(+), 1 deletion(-)
board/overo/overo.c +48 -0
index 62b50a8..6a0a655 100644
@@ -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;
 }
 
include/configs/omap3_overo.h +1 -1
index 7b97be9..f79a528 100644
@@ -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" \
Signature · 1 line
1.8.3.2
#1 lore raw

PATCH 1/1 omap3: overo: Select fdtfile for expansion board

Am 06.06.2014 20:37, schrieb Ash Charles:

Quoted 53 lines

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".

Conflicts:
include/configs/omap3_overo.h

---
  board/overo/overo.c           | 48 +++++++++++++++++++++++++++++++++++++++++++
  include/configs/omap3_overo.h |  2 +-
  2 files changed, 49 insertions(+), 1 deletion(-)
board/overo/overo.c +26 -0
index 62b50a8..6a0a655 100644
@@ -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");

board/overo/overo.c unsigned int get_expansion_id(void) · line 268

Quoted 10 lines
board/overo/overo.c +10 -0
+		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)?

board/overo/overo.c unsigned int get_expansion_id(void) · line 273

Quoted 5 lines
board/overo/overo.c +5 -0
+	}
+
+        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.

Quoted 30 lines
board/overo/overo.c +7 -0
+}
+#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;
  }
 
include/configs/omap3_overo.h +1 -1
index 7b97be9..f79a528 100644
@@ -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" \
#2 lore raw

PATCH 1/1 omap3: overo: Select fdtfile for expansion board

Quoted 8 lines · Stefan Herbrechtsmeier

Am 06.06.2014 20:37, schrieb Ash Charles:

Quoted 7 lines

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]

Quoted 7 lines

board/overo/overo.c unsigned int get_expansion_id(void) · line 273

Quoted 3 lines
board/overo/overo.c +3 -0
+        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.

Signature · 8 lines
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>
#3 lore raw

PATCH 1/1 omap3: overo: Select fdtfile for expansion board

Quoted 3 lines · Tom Rini

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

#4 lore raw

PATCH 1/1 omap3: overo: Select fdtfile for expansion board

Am 07.06.2014 22:11, schrieb Ash Charles:

Quoted 7 lines · Tom Rini
Quoted 3 lines

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.

Quoted 3 lines

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'.

Quoted 4 lines

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.

Quoted 4 lines

--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

#5 lore raw

PATCH 1/1 omap3: overo: Select fdtfile for expansion board

Quoted 2 lines · Stefan Herbrechtsmeier

At the moment I use this functionality to set the environment variable 'fdtfile'.

Cool :)
....

Quoted 9 lines

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

#6 lore raw

PATCH v2 1/1 omap3: overo: Select fdtfile for expansion board

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".

Conflicts:
include/configs/omap3_overo.h

---
 board/overo/overo.c           | 12 ++++++++++++
 include/configs/omap3_overo.h | 10 +++++-----
 2 files changed, 17 insertions(+), 5 deletions(-)
board/overo/overo.c +12 -0
index 62b50a8..02b606c 100644
@@ -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;
 }
 
include/configs/omap3_overo.h +5 -5
index 1a13633..f7483a0 100644
@@ -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;" \
Signature · 1 line
1.8.3.2
#7 lore raw

PATCH v2 1/1 omap3: overo: Select fdtfile for expansion board

Am 09.06.2014 22:47, schrieb Ash Charles:

Quoted 70 lines

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".

Conflicts:
include/configs/omap3_overo.h

---
  board/overo/overo.c           | 12 ++++++++++++
  include/configs/omap3_overo.h | 10 +++++-----
  2 files changed, 17 insertions(+), 5 deletions(-)
board/overo/overo.c +6 -0
index 62b50a8..02b606c 100644
@@ -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",

board/overo/overo.c int misc_init_r(void) · line 361

Quoted 4 lines
board/overo/overo.c +1 -0
@@ -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?

board/overo/overo.c int misc_init_r(void) · line 363

Quoted 2 lines
board/overo/overo.c +0 -0
  		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.

Quoted 41 lines
board/overo/overo.c +5 -0
@@ -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;
  }
 
include/configs/omap3_overo.h +5 -5
index 1a13633..f7483a0 100644
@@ -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;" \
#8 lore raw

PATCH v2 1/1 omap3: overo: Select fdtfile for expansion board

Quoted 2 lines · Stefan Herbrechtsmeier

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.

Quoted 6 lines
Quoted 3 lines
                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

#9 lore raw

PATCH v2 1/1 omap3: overo: Select fdtfile for expansion board

Am 10.06.2014 19:17, schrieb Ash Charles:

Quoted 7 lines
Quoted 2 lines · Stefan Herbrechtsmeier

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.

Quoted 2 lines

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.

Quoted 3 lines

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.

Quoted 6 lines
Quoted 4 lines
Quoted 2 lines
                 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.

#10 lore raw

PATCH v2 1/1 omap3: overo: Select fdtfile for expansion board

Quoted 1 line · Stefan Herbrechtsmeier

You could use an environment file next to the u-boot image.

Good point.
...

Quoted 3 lines

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.
...

Quoted 1 line

I think you mixed the GUMSTIX_NO_EEPROM and default case.

Yes---you're totally correct---thanks for catching this.

--Ash

#11 lore raw

PATCH v3 1/1 omap3: overo: Select fdtfile for expansion board

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".

Conflicts:
include/configs/omap3_overo.h

---
 board/overo/overo.c           | 14 ++++++++++++++
 include/configs/omap3_overo.h | 10 +++++-----
 2 files changed, 19 insertions(+), 5 deletions(-)
board/overo/overo.c +14 -0
index 62b50a8..13220c5 100644
@@ -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;
 }
 
include/configs/omap3_overo.h +5 -5
index 1a13633..f7483a0 100644
@@ -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;" \
Signature · 1 line
1.8.3.2
#12 lore raw

PATCH v3 1/1 omap3: overo: Select fdtfile for expansion board

Am 10.06.2014 21:02, schrieb Ash Charles:

Quoted 70 lines

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".

Conflicts:
include/configs/omap3_overo.h

---
  board/overo/overo.c           | 14 ++++++++++++++
  include/configs/omap3_overo.h | 10 +++++-----
  2 files changed, 19 insertions(+), 5 deletions(-)
board/overo/overo.c +6 -0
index 62b50a8..13220c5 100644
@@ -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",

board/overo/overo.c int misc_init_r(void) · line 362

Quoted 8 lines
board/overo/overo.c +3 -0
@@ -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).

Quoted 43 lines
board/overo/overo.c +5 -0
  		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;
  }
 
include/configs/omap3_overo.h +5 -5
index 1a13633..f7483a0 100644
@@ -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;" \
#13 lore raw

PATCH v3 1/1 omap3: overo: Select fdtfile for expansion board

Quoted 2 lines · Stefan Herbrechtsmeier

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

#14 lore raw

PATCH v3 1/1 omap3: overo: Select fdtfile for expansion board

In reply to Ash Charles
Quoted 11 lines · 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".

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

Signature · 8 lines
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>