mirror of
https://source.denx.de/u-boot/u-boot.git
synced 2026-05-12 16:16:11 +02:00
board: venice: update model representation for venice-flex
Update the model string representation for the Venice-Flex product family (GW8xxx). Signed-off-by: Tim Harvey <tharvey@gateworks.com> Reviewed-by: Peng Fan <peng.fan@nxp.com>
This commit is contained in:
parent
da9e2218af
commit
41bc2d5334
@ -6,6 +6,7 @@
|
||||
#include <gsc.h>
|
||||
#include <hexdump.h>
|
||||
#include <i2c.h>
|
||||
#include <dm/device.h>
|
||||
#include <dm/uclass.h>
|
||||
|
||||
#include "eeprom.h"
|
||||
@ -19,7 +20,7 @@
|
||||
|
||||
struct venice_board_info som_info;
|
||||
struct venice_board_info base_info;
|
||||
char venice_model[32];
|
||||
char venice_model[64];
|
||||
char venice_som_model[32];
|
||||
char venice_baseboard_model[32];
|
||||
u32 venice_serial;
|
||||
@ -109,7 +110,7 @@ static int eeprom_read(int busno, int slave, int alen, struct venice_board_info
|
||||
/* validate checksum */
|
||||
for (chksum = 0, i = 0; i < (int)sizeof(*info) - 2; i++)
|
||||
chksum += buf[i];
|
||||
if ((info->chksum[0] != chksum >> 8) ||
|
||||
if ((info->chksum[0] != ((chksum >> 8) & 0xff)) ||
|
||||
(info->chksum[1] != (chksum & 0xff))) {
|
||||
printf("EEPROM: I2C%d@0x%02x: Invalid Checksum\n", busno, slave);
|
||||
print_hex_dump_bytes("", DUMP_PREFIX_NONE, buf, sizeof(*info));
|
||||
@ -128,6 +129,54 @@ static int eeprom_read(int busno, int slave, int alen, struct venice_board_info
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int fsa_eeprom_read(const char *base, int fsa, struct fsa_board_info *info)
|
||||
{
|
||||
int i;
|
||||
int chksum;
|
||||
unsigned char *buf = (unsigned char *)info;
|
||||
struct udevice *dev, *bus;
|
||||
int ret;
|
||||
u8 reg;
|
||||
|
||||
/* probe mux */
|
||||
ret = uclass_get_device_by_seq(UCLASS_I2C, 2, &bus);
|
||||
if (!ret)
|
||||
ret = dm_i2c_probe(bus, 0x70, 0, &dev);
|
||||
if (ret)
|
||||
return ret;
|
||||
/* steer mux */
|
||||
if (!strncmp(base, "GW82", 4)) {
|
||||
if (fsa < 3)
|
||||
reg = (fsa == 1) ? BIT(1) : BIT(0);
|
||||
else
|
||||
return -EINVAL;
|
||||
}
|
||||
dm_i2c_write(dev, 0x00, ®, 1);
|
||||
|
||||
/* get eeprom */
|
||||
ret = dm_i2c_probe(bus, 0x54, 0, &dev);
|
||||
if (ret)
|
||||
return ret;
|
||||
|
||||
/* read eeprom config section */
|
||||
ret = dm_i2c_read(dev, 0x00, buf, sizeof(*info));
|
||||
if (ret)
|
||||
return ret;
|
||||
|
||||
/* validate checksum */
|
||||
for (chksum = 0, i = 0; i < (int)sizeof(*info) - 2; i++)
|
||||
chksum += buf[i];
|
||||
if ((info->chksum[0] != ((chksum >> 8) & 0xff)) ||
|
||||
(info->chksum[1] != (chksum & 0xff))) {
|
||||
printf("FSA%d EEPROM (board): %s: Invalid Checksum\n", fsa, dev->name);
|
||||
print_hex_dump_bytes("", DUMP_PREFIX_OFFSET, buf, sizeof(*info));
|
||||
memset(info, 0, sizeof(*info));
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* determine BOM revision from model */
|
||||
int get_bom_rev(const char *str)
|
||||
{
|
||||
@ -352,6 +401,57 @@ int venice_eeprom_init(int quiet)
|
||||
}
|
||||
venice_serial = som_info.serial;
|
||||
|
||||
/* GW8xxx product family naming scheme */
|
||||
if (venice_model[2] == '8') {
|
||||
struct fsa_board_info fsa_info;
|
||||
int i = 0;
|
||||
int fsa;
|
||||
|
||||
/* baseboard */
|
||||
if (base_info.model[0]) {
|
||||
rev_pcb = get_pcb_rev(base_info.model);
|
||||
rev_bom = get_bom_rev(base_info.model);
|
||||
venice_model[i++] = 'G';
|
||||
venice_model[i++] = 'W';
|
||||
venice_model[i++] = base_info.model[2]; /* baseboard */
|
||||
venice_model[i++] = base_info.model[3];
|
||||
venice_model[i++] = base_info.model[4]; /* subload */
|
||||
venice_model[i++] = base_info.model[5];
|
||||
venice_model[i++] = rev_pcb;
|
||||
if (rev_bom)
|
||||
venice_model[i++] = rev_bom;
|
||||
venice_model[i++] = '-';
|
||||
venice_model[i++] = 'S';
|
||||
} else {
|
||||
venice_model[i++] = 'G';
|
||||
venice_model[i++] = 'W';
|
||||
}
|
||||
|
||||
/* som */
|
||||
rev_pcb = get_pcb_rev(som_info.model);
|
||||
rev_bom = get_bom_rev(som_info.model);
|
||||
venice_model[i++] = som_info.model[4];
|
||||
venice_model[i++] = som_info.model[5];
|
||||
venice_model[i++] = rev_pcb;
|
||||
if (rev_bom)
|
||||
venice_model[i++] = rev_bom;
|
||||
|
||||
/* fsa */
|
||||
for (fsa = 1; fsa < FSA_MAX; fsa++) {
|
||||
if (!fsa_eeprom_read(venice_model, fsa, &fsa_info)) {
|
||||
venice_model[i++] = '-';
|
||||
venice_model[i++] = 'F';
|
||||
venice_model[i++] = '0' + fsa;
|
||||
venice_model[i++] = fsa_info.model[5];
|
||||
venice_model[i++] = fsa_info.model[6];
|
||||
venice_model[i++] = fsa_info.model[8];
|
||||
if (fsa_info.model[9])
|
||||
venice_model[i++] = fsa_info.model[9];
|
||||
}
|
||||
}
|
||||
venice_model[i++] = 0;
|
||||
}
|
||||
|
||||
if (!quiet)
|
||||
eeprom_info(false);
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user