ADD: [serdes] sanity check for bd serdes configuration
BugzId: 77163
This commit is contained in:
parent
6552251ade
commit
8f18c9be41
|
|
@ -208,13 +208,31 @@ static int init_console(void)
|
||||||
|
|
||||||
int hws_board_topology_load(struct serdes_map **serdes_map_array, u8 *count)
|
int hws_board_topology_load(struct serdes_map **serdes_map_array, u8 *count)
|
||||||
{
|
{
|
||||||
int i;
|
int i, j;
|
||||||
|
int bd_config_is_broken = 0;
|
||||||
|
|
||||||
if (read_eeprom() < 0){
|
if (read_eeprom() < 0){
|
||||||
/* If we do not have a board descriptor use the default
|
/* If we do not have a board descriptor use the default
|
||||||
serdes configuration defined in board_serdes_map */
|
serdes configuration defined in board_serdes_map */
|
||||||
puts("Could not read board descriptor using default serdes config.\n");
|
puts("Could not read board descriptor using default serdes config.\n");
|
||||||
} else {
|
} else {
|
||||||
|
/* Check for broken serdes config in BD -> If multiple serdes lines are
|
||||||
|
configured for the same function something is obviously broken. */
|
||||||
|
for (i = 0; i<ARRAY_SIZE(board_serdes_map); i++) {
|
||||||
|
for (j = i+1; j<ARRAY_SIZE(board_serdes_map); j++) {
|
||||||
|
if ((bd_get_serdes_type(i) == bd_get_serdes_type(j)) &&
|
||||||
|
(bd_get_serdes_type(i) < DEFAULT_SERDES)) { // DEFAULT_SERDES & LAST_SERDES_TYPE are always ok
|
||||||
|
printf("Serdes lines %d and %d are configured for same function %d\n",
|
||||||
|
i, j, bd_get_serdes_type(i));
|
||||||
|
bd_config_is_broken = 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (bd_config_is_broken) {
|
||||||
|
printf("Serdes config in BD is broken! -> Ignoring BD serdes config\n");
|
||||||
|
}
|
||||||
|
|
||||||
for (i = 0; i < ARRAY_SIZE(board_serdes_map); i++) {
|
for (i = 0; i < ARRAY_SIZE(board_serdes_map); i++) {
|
||||||
enum serdes_type type;
|
enum serdes_type type;
|
||||||
uint8_t user_config = get_eeprom_serdes_config(i);
|
uint8_t user_config = get_eeprom_serdes_config(i);
|
||||||
|
|
@ -223,10 +241,15 @@ int hws_board_topology_load(struct serdes_map **serdes_map_array, u8 *count)
|
||||||
/* if we have a user config we use that one */
|
/* if we have a user config we use that one */
|
||||||
type = (enum serdes_type)user_config;
|
type = (enum serdes_type)user_config;
|
||||||
} else {
|
} else {
|
||||||
/* otherwise we use the config from the bd */
|
/* otherwise we use the config from the bd if it is not broken */
|
||||||
type = bd_get_serdes_type(i);
|
if (bd_config_is_broken) {
|
||||||
|
type = LAST_SERDES_TYPE;
|
||||||
|
} else {
|
||||||
|
type = bd_get_serdes_type(i);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* LAST_SERDES_TYPE means use compiled in default */
|
||||||
if (type < LAST_SERDES_TYPE) {
|
if (type < LAST_SERDES_TYPE) {
|
||||||
if ((type >= SGMII0) && (type <= SGMII2)) {
|
if ((type >= SGMII0) && (type <= SGMII2)) {
|
||||||
board_serdes_map[i].serdes_speed = SERDES_SPEED_1_25_GBPS;
|
board_serdes_map[i].serdes_speed = SERDES_SPEED_1_25_GBPS;
|
||||||
|
|
|
||||||
|
|
@ -225,13 +225,31 @@ static int init_console(void)
|
||||||
|
|
||||||
int hws_board_topology_load(struct serdes_map **serdes_map_array, u8 *count)
|
int hws_board_topology_load(struct serdes_map **serdes_map_array, u8 *count)
|
||||||
{
|
{
|
||||||
int i;
|
int i, j;
|
||||||
|
int bd_config_is_broken = 0;
|
||||||
|
|
||||||
if (read_eeprom() < 0){
|
if (read_eeprom() < 0){
|
||||||
/* If we do not have a board descriptor use the default
|
/* If we do not have a board descriptor use the default
|
||||||
serdes configuration defined in board_serdes_map */
|
serdes configuration defined in board_serdes_map */
|
||||||
puts("Could not read board descriptor using default serdes config.\n");
|
puts("Could not read board descriptor using default serdes config.\n");
|
||||||
} else {
|
} else {
|
||||||
|
/* Check for broken serdes config in BD -> If multiple serdes lines are
|
||||||
|
configured for the same function something is obviously broken. */
|
||||||
|
for (i = 0; i<ARRAY_SIZE(board_serdes_map); i++) {
|
||||||
|
for (j = i+1; j<ARRAY_SIZE(board_serdes_map); j++) {
|
||||||
|
if ((bd_get_serdes_type(i) == bd_get_serdes_type(j)) &&
|
||||||
|
(bd_get_serdes_type(i) < DEFAULT_SERDES)) { // DEFAULT_SERDES & LAST_SERDES_TYPE are always ok
|
||||||
|
printf("Serdes lines %d and %d are configured for same function %d\n",
|
||||||
|
i, j, bd_get_serdes_type(i));
|
||||||
|
bd_config_is_broken = 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (bd_config_is_broken) {
|
||||||
|
printf("Serdes config in BD is broken! -> Ignoring BD serdes config\n");
|
||||||
|
}
|
||||||
|
|
||||||
for (i = 0; i < ARRAY_SIZE(board_serdes_map); i++) {
|
for (i = 0; i < ARRAY_SIZE(board_serdes_map); i++) {
|
||||||
enum serdes_type type;
|
enum serdes_type type;
|
||||||
uint8_t user_config = get_eeprom_serdes_config(i);
|
uint8_t user_config = get_eeprom_serdes_config(i);
|
||||||
|
|
@ -240,10 +258,15 @@ int hws_board_topology_load(struct serdes_map **serdes_map_array, u8 *count)
|
||||||
/* if we have a user config we use that one */
|
/* if we have a user config we use that one */
|
||||||
type = (enum serdes_type)user_config;
|
type = (enum serdes_type)user_config;
|
||||||
} else {
|
} else {
|
||||||
/* otherwise we use the config from the bd */
|
/* otherwise we use the config from the bd if it is not broken */
|
||||||
type = bd_get_serdes_type(i);
|
if (bd_config_is_broken) {
|
||||||
|
type = LAST_SERDES_TYPE;
|
||||||
|
} else {
|
||||||
|
type = bd_get_serdes_type(i);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* LAST_SERDES_TYPE means use compiled in default */
|
||||||
if (type < LAST_SERDES_TYPE) {
|
if (type < LAST_SERDES_TYPE) {
|
||||||
if ((type >= SGMII0) && (type <= SGMII2)) {
|
if ((type >= SGMII0) && (type <= SGMII2)) {
|
||||||
board_serdes_map[i].serdes_speed = SERDES_SPEED_1_25_GBPS;
|
board_serdes_map[i].serdes_speed = SERDES_SPEED_1_25_GBPS;
|
||||||
|
|
|
||||||
|
|
@ -203,13 +203,31 @@ static int init_console(void)
|
||||||
|
|
||||||
int hws_board_topology_load(struct serdes_map **serdes_map_array, u8 *count)
|
int hws_board_topology_load(struct serdes_map **serdes_map_array, u8 *count)
|
||||||
{
|
{
|
||||||
int i;
|
int i, j;
|
||||||
|
int bd_config_is_broken = 0;
|
||||||
|
|
||||||
if (read_eeprom() < 0){
|
if (read_eeprom() < 0){
|
||||||
/* If we do not have a board descriptor use the default
|
/* If we do not have a board descriptor use the default
|
||||||
serdes configuration defined in board_serdes_map */
|
serdes configuration defined in board_serdes_map */
|
||||||
puts("Could not read board descriptor using default serdes config.\n");
|
puts("Could not read board descriptor using default serdes config.\n");
|
||||||
} else {
|
} else {
|
||||||
|
/* Check for broken serdes config in BD -> If multiple serdes lines are
|
||||||
|
configured for the same function something is obviously broken. */
|
||||||
|
for (i = 0; i<ARRAY_SIZE(board_serdes_map); i++) {
|
||||||
|
for (j = i+1; j<ARRAY_SIZE(board_serdes_map); j++) {
|
||||||
|
if ((bd_get_serdes_type(i) == bd_get_serdes_type(j)) &&
|
||||||
|
(bd_get_serdes_type(i) < DEFAULT_SERDES)) { // DEFAULT_SERDES & LAST_SERDES_TYPE are always ok
|
||||||
|
printf("Serdes lines %d and %d are configured for same function %d\n",
|
||||||
|
i, j, bd_get_serdes_type(i));
|
||||||
|
bd_config_is_broken = 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (bd_config_is_broken) {
|
||||||
|
printf("Serdes config in BD is broken! -> Ignoring BD serdes config\n");
|
||||||
|
}
|
||||||
|
|
||||||
for (i = 0; i < ARRAY_SIZE(board_serdes_map); i++) {
|
for (i = 0; i < ARRAY_SIZE(board_serdes_map); i++) {
|
||||||
enum serdes_type type;
|
enum serdes_type type;
|
||||||
uint8_t user_config = get_eeprom_serdes_config(i);
|
uint8_t user_config = get_eeprom_serdes_config(i);
|
||||||
|
|
@ -218,10 +236,15 @@ int hws_board_topology_load(struct serdes_map **serdes_map_array, u8 *count)
|
||||||
/* if we have a user config we use that one */
|
/* if we have a user config we use that one */
|
||||||
type = (enum serdes_type)user_config;
|
type = (enum serdes_type)user_config;
|
||||||
} else {
|
} else {
|
||||||
/* otherwise we use the config from the bd */
|
/* otherwise we use the config from the bd if it is not broken */
|
||||||
type = bd_get_serdes_type(i);
|
if (bd_config_is_broken) {
|
||||||
|
type = LAST_SERDES_TYPE;
|
||||||
|
} else {
|
||||||
|
type = bd_get_serdes_type(i);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* LAST_SERDES_TYPE means use compiled in default */
|
||||||
if (type < LAST_SERDES_TYPE) {
|
if (type < LAST_SERDES_TYPE) {
|
||||||
if ((type >= SGMII0) && (type <= SGMII2)) {
|
if ((type >= SGMII0) && (type <= SGMII2)) {
|
||||||
board_serdes_map[i].serdes_speed = SERDES_SPEED_1_25_GBPS;
|
board_serdes_map[i].serdes_speed = SERDES_SPEED_1_25_GBPS;
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue