board: ti: am65x: Use different overlay for IDK with SR1.0 EVM

The ICSSG IP is different between the two AM65x Silicon Revisions SR1.0
and SR2.0, and the ICSSG Ethernet nodes will look different between the
two versions. The Linux kernel uses a separate overlay file for the IDK
board between the two variants. Introduce a runtime check to use a
different overlay for IDK daughter card specifically for SR1.0 silicon.

Code is based on logic from an older patch from Roger Quadros.

Signed-off-by: Roger Quadros <rogerq@ti.com>
Signed-off-by: Suman Anna <s-anna@ti.com>
This commit is contained in:
Suman Anna 2021-04-29 20:13:30 -05:00 committed by Praneeth Bajjuri
parent 50d1fed083
commit 94a99712b5
1 changed files with 12 additions and 3 deletions

View File

@ -206,6 +206,7 @@ static int probe_daughtercards(void)
struct udevice *soc;
char str[SOC_MAX_STR_SIZE];
const char *am65x_sr1_dtboname = "k3-am654-base-board-sr1.dtbo";
const char *am65x_idk_sr1_dtboname = "k3-am654-idk-sr1.dtbo";
/*
* Daughter card presence detection signal name to GPIO (via I2C I/O
@ -295,6 +296,7 @@ static int probe_daughtercards(void)
/* Obtain card-specific slot index and associated I2C address */
u8 slot_index = cards[i].slot_index;
u8 i2c_addr = slot_map[slot_index].i2c_addr;
const char *dtboname;
/*
* The presence detection signal is active-low, hence skip
@ -363,19 +365,26 @@ static int probe_daughtercards(void)
if (!strlen(cards[i].dtbo_name))
continue;
k3_dtbo_list[nb_dtbos++] = cards[i].dtbo_name;
dtboname = cards[i].dtbo_name;
/* Fix up IDK overlay for SR1.0 */
if (!strncmp(ep.name, "AM6-IDKAPPEVM", sizeof(ep.name)) &&
!strncmp(str, "SR1.0", 5))
dtboname = am65x_idk_sr1_dtboname;
k3_dtbo_list[nb_dtbos++] = dtboname;
/*
* Make sure we are not running out of buffer space by checking
* if we can fit the new overlay, a trailing space to be used
* as a separator, plus the terminating zero.
*/
if (strlen(name_overlays) + strlen(cards[i].dtbo_name) + 2 >
if (strlen(name_overlays) + strlen(dtboname) + 2 >
sizeof(name_overlays))
return -ENOMEM;
/* Append to our list of overlays */
strcat(name_overlays, cards[i].dtbo_name);
strcat(name_overlays, dtboname);
strcat(name_overlays, " ");
}