示例#1
0
/**
 * get_cpu_board_revision - get the CPU board revision on 85xx boards
 *
 * Read the EEPROM to determine the board revision.
 *
 * This function is called before relocation, so we need to read a private
 * copy of the EEPROM into a local variable on the stack.
 *
 * Also, we assume that CONFIG_SYS_EEPROM_BUS_NUM == CONFIG_SYS_SPD_BUS_NUM.  The global
 * variable i2c_bus_num must be compile-time initialized to CONFIG_SYS_SPD_BUS_NUM,
 * so that the SPD code will work.  This means that all pre-relocation I2C
 * operations can only occur on the CONFIG_SYS_SPD_BUS_NUM bus.  So if
 * CONFIG_SYS_EEPROM_BUS_NUM != CONFIG_SYS_SPD_BUS_NUM, then we can't read the EEPROM when
 * this function is called.  Oh well.
 */
unsigned int get_cpu_board_revision(void)
{
    struct board_eeprom {
        u32 id;           /* 0x00 - 0x03 EEPROM Tag 'CCID' */
        u8 major;         /* 0x04        Board revision, major */
        u8 minor;         /* 0x05        Board revision, minor */
    } be;

    i2c_read(CONFIG_SYS_I2C_EEPROM_ADDR, 0, CONFIG_SYS_I2C_EEPROM_ADDR_LEN,
             (void *)&be, sizeof(be));

    if (be.id != (('C' << 24) | ('C' << 16) | ('I' << 8) | 'D'))
        return MPC85XX_CPU_BOARD_REV(0, 0);

    if ((be.major == 0xff) && (be.minor == 0xff))
        return MPC85XX_CPU_BOARD_REV(0, 0);

    return MPC85XX_CPU_BOARD_REV(be.major, be.minor);
}
示例#2
0
unsigned int
get_cpu_board_revision(void)
{
	uint major = 0;
	uint minor = 0;

	id_eeprom_t id_eeprom;

	i2c_read(CFG_I2C_EEPROM_ADDR, 0, 2,
		 (uchar *) &id_eeprom, sizeof(id_eeprom));

	major = id_eeprom.idee_major;
	minor = id_eeprom.idee_minor;

	if (major == 0xff && minor == 0xff) {
		major = minor = 0;
	}

	return MPC85XX_CPU_BOARD_REV(major,minor);
}