diff mbox

[U-Boot,v2] omap3: overo: Select fdtfile for expansion board

Message ID 1402346851-20350-1-git-send-email-ashcharles@gmail.com
State Superseded
Delegated to: Tom Rini
Headers show

Commit Message

Ash Charles June 9, 2014, 8:47 p.m. UTC
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(-)

Comments

Stefan Herbrechtsmeier June 10, 2014, 7:30 a.m. UTC | #1
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;" \
Ash Charles June 10, 2014, 5:17 p.m. UTC | #2
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
Stefan Herbrechtsmeier June 10, 2014, 6:06 p.m. UTC | #3
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.
Ash Charles June 10, 2014, 7 p.m. UTC | #4
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
diff mbox

Patch

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;" \