[coreboot] [v2] r4317 - trunk/coreboot-v2/src/northbridge/via/vx800

Uwe Hermann uwe at hermann-uwe.de
Thu May 28 14:17:27 CEST 2009


On Thu, May 28, 2009 at 07:26:21AM -0400, Corey Osgood wrote:
> Richard,
> 
> There are several boards currently running without SPD data, the one I'm
> looking at right now is the pcengines alix1c. Have a look at how it works
> there, it seems like a reasonable way to do things.

Usually the boards hardcode the SPD contents in an array, then the SPD
read functions don't do any SMBus stuff but rather read from that array
(for that board).

Here's a quick sample cutnpaste from a v3 board (DBE62):


/* The part is a Micron MT46V16M16 P 5B 
 * 4 M x 16 x 5 Banks, 200 Mhz, Plastic package, TSOP, DDR400B, 5 ns CL3
 * Commercial rating. 
 * @ 200 ns, data-out window, 1.6; access, +- 70 ns; dqs-dq skew: .4ns
 * http://www.micron.com/products/partdetail?part=MT46V16M16P-5B
 */

struct spd_entry {
        u8 address;
        u8 data;
};

/* Save space by using a short list of SPD values used by Geode LX Memory init */
static const struct spd_entry spd_table[] = {
        {SPD_MEMORY_TYPE, 7},
        {SPD_NUM_ROWS, 13},
        {SPD_tRFC, 0x4b},
        {SPD_ACCEPTABLE_CAS_LATENCIES, 0x10},
        {SPD_DENSITY_OF_EACH_ROW_ON_MODULE, 0x40},
        {SPD_tRAS, 0x2d},
        {SPD_MIN_CYCLE_TIME_AT_CAS_MAX, 0x7}, /*0x <= 7},*/
        {SPD_MIN_RAS_TO_CAS_DELAY, 0x58},
        {SPD_tRRD, 0x3c},
        {SPD_tRP, 0x58},
        {SPD_PRIMARY_SDRAM_WIDTH, 8},
        {SPD_NUM_BANKS_PER_SDRAM, 0x4},
        {SPD_NUM_COLUMNS, 0xa}, /* 8kB */
        {SPD_NUM_DIMM_BANKS, 0x1},
        {SPD_REFRESH, 0x82},
        {SPD_SDRAM_CYCLE_TIME_2ND, 0x0},
        {SPD_SDRAM_CYCLE_TIME_3RD, 0x0},
};

/**
 * Given an SMBUS device, and an address in that device, return the value of SPD
 * for that device. In this mainboard, the only one that can return is DIMM0. 
 * @param device The device number
 * @param address The address in SPD rom to return the value of
 * @returns The value
 */
u8 spd_read_byte(u16 device, u8 address)
{
        int i;
        /* returns 0xFF on any failures */
        u8 ret = 0xff;

        printk(BIOS_DEBUG, "spd_read_byte dev %04x", device);
        if (device == DIMM0) {
                for (i = 0; i < ARRAY_SIZE(spd_table); i++) {
                        if (spd_table[i].address == address) {
                                ret = spd_table[i].data;
                                break;
                        }
                }

                if (i == ARRAY_SIZE(spd_table))
                        printk(BIOS_DEBUG, " addr %02x does not exist in SPD table",
                                address);
        }

        printk(BIOS_DEBUG, " addr %02x returns %02x\n", address, ret);
        return ret;
}



HTH, Uwe.
-- 
http://www.hermann-uwe.de  | http://www.holsham-traders.de
http://www.crazy-hacks.org | http://www.unmaintained-free-software.org




More information about the coreboot mailing list