[v4,7/7] board: ti: AM57xx: Add detection logic for AM57xx-evm

Message ID 20151110001515.GA2195@kahuna
State New
Headers show

Commit Message

Nishanth Menon Nov. 10, 2015, 12:15 a.m.
On 18:39-20151105, Steve Kipisz wrote:
[...]

> diff --git a/board/ti/am57xx/board.c b/board/ti/am57xx/board.c

> index 042f9ab1965a..15da8e66fee5 100644

> --- a/board/ti/am57xx/board.c

> +++ b/board/ti/am57xx/board.c

	[...]
> +static void setup_board_eeprom_env(void)

> +{

> +	char *name = "beagle_x15";

> +	int rc;

> +	struct ti_am_eeprom_printable p;

> +

> +	rc = ti_i2c_eeprom_am_get_print(CONFIG_EEPROM_BUS_ADDRESS,

> +					CONFIG_EEPROM_CHIP_ADDRESS, &p);

> +	if (rc) {

> +		printf("Invalid EEPROM data(@0x%p). Default to X15\n",

> +		       TI_AM_EEPROM_DATA);

> +		goto invalid_eeprom;

> +	}

> +

> +	if (board_is_am572x_evm())

> +		name = "am57xx_evm";

I suggest adding:
	else if (board_is_x15())
		name = "beagle_x15";
If we dont do that, we end up with the "Unidentified board claim"
print even if we have a valid eeprom.


Also, at this point, we can reasonably detect and update our prints (to
prevent folks from being confused :))

How about squashing the following to this patch?
-- 
Regards,
Nishanth Menon
_______________________________________________
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot

Patch

diff --git a/board/ti/am57xx/board.c b/board/ti/am57xx/board.c
index 4ae484140608..30d358885fe0 100644
--- a/board/ti/am57xx/board.c
+++ b/board/ti/am57xx/board.c
@@ -46,7 +46,7 @@  DECLARE_GLOBAL_DATA_PTR;
 #define GPIO_DDR_VTT_EN 203
 
 const struct omap_sysinfo sysinfo = {
-	"Board: BeagleBoard x15\n"
+	"Board: UNKNOWN(BeagleBoard X15?)\n"
 };
 
 static const struct dmm_lisa_map_regs beagle_x15_lisa_regs = {
@@ -262,6 +262,27 @@  void do_board_detect(void)
 
 #else	/* CONFIG_SPL_BUILD */
 
+void do_board_detect(void)
+{
+	struct ti_am_eeprom *ep;
+	char *bname = NULL;
+	int rc;
+
+	rc = ti_i2c_eeprom_am_get(CONFIG_EEPROM_BUS_ADDRESS,
+				  CONFIG_EEPROM_CHIP_ADDRESS, &ep);
+	if (rc)
+		printf("ti_i2c_eeprom_init failed %d\n", rc);
+
+	if (board_is_x15())
+		bname = "BeagleBoard X15";
+	else if (board_is_am572x_evm())
+		bname = "AM572x EVM";
+
+	if (bname)
+		snprintf(sysinfo.board_string, sizeof(sysinfo.board_string),
+			 "Board: %s\n", bname);
+}
+
 static void setup_board_eeprom_env(void)
 {
 	char *name = "beagle_x15";