Update of /cvsroot/blob/blob/src/blob
In directory usw-pr-cvs1:/tmp/cvs-serv1968/src/blob
Modified Files:
badge4.c
Log Message:
working version that does the sdram/cpld/spd dance properly
Index: badge4.c
===================================================================
RCS file: /cvsroot/blob/blob/src/blob/badge4.c,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -d -r1.7 -r1.8
--- badge4.c 27 Apr 2002 00:55:04 -0000 1.7
+++ badge4.c 2 May 2002 01:45:39 -0000 1.8
@@ -36,10 +36,12 @@
#include <blob/i2c-gpio.h>
#include <blob/spd.h>
+#define DEBUG
+
static struct i2c_bus_gpio_private badge4_i2c_bus_gpio_private = {
sda_gpio: BADGE4_GPIO_SDSDA,
scl_gpio: BADGE4_GPIO_SDSCL,
- delay: 1000
+ delay: 100
};
static struct i2c_bus badge4_i2c_bus = {
@@ -120,38 +122,42 @@
*/
}
-static inline int spd_byte(int addr)
-{
- return i2c_read_device_byte_at(&badge4_i2c_bus, SPD_I2C_ADDR(0), addr);
-}
-
static void badge4_setup_sdram(void)
{
int i, size;
int typ0, typ1;
int memory_type, row_bits, col_bits, row_density;
+ u8 spd[128];
+
+ printf("\n\n\n" BOARD_NAME "\n"
+ "Blob port by Christopher Hoover <ch...@hp...>\n\n");
/* Intialize the I2C bus and driver. */
i2c_init(&badge4_i2c_bus);
/* Probe for the SPD EEPROM */
if (i2c_probe(&badge4_i2c_bus, SPD_I2C_ADDR(0)) != 0) {
- printf("SDRAM: SDRAM SO-DIMM absent\n");
+ printf("SDRAM: SDRAM SO-DIMM absent.\n");
return;
}
/* Read the SPD to determine the SO-DIMM SDRAM parameters. */
+ if (i2c_read_device_bytes(&badge4_i2c_bus, SPD_I2C_ADDR(0),
+ 0, spd, sizeof(spd)) != 0) {
+ printf("SDRAM: failed to read SPD EEPROM.\n");
+ goto fail;
+ }
/* quick sanity check */
- memory_type = spd_byte(SPD_MEMORY_TYPE);
+ memory_type = spd[SPD_MEMORY_TYPE];
if (memory_type != SPD_MEMORY_TYPE_SDRAM) {
printf("SDRAM: SDRAM SO-DIMM wrong type (%d)\n", memory_type);
goto fail;
}
- row_bits = spd_byte(SPD_ROW_BITS);
- col_bits = spd_byte(SPD_COL_BITS);
- row_density = spd_byte(SPD_ROW_DENSITY);
+ row_bits = spd[SPD_ROW_BITS];
+ col_bits = spd[SPD_COL_BITS];
+ row_density = spd[SPD_ROW_DENSITY];
/* calculate the size: bit 0 is 4M, bit 1 is 8M, etc. */
size = 0;
|