From: Christopher H. <ch...@us...> - 2002-07-23 20:06:49
|
Update of /cvsroot/blob/blob/src/blob In directory usw-pr-cvs1:/tmp/cvs-serv16484/src/blob Modified Files: badge4.c Log Message: fix memory size computation; small bits of cleanup Index: badge4.c =================================================================== RCS file: /cvsroot/blob/blob/src/blob/badge4.c,v retrieving revision 1.8 retrieving revision 1.9 diff -u -d -r1.8 -r1.9 --- badge4.c 2 May 2002 01:45:39 -0000 1.8 +++ badge4.c 23 Jul 2002 20:06:44 -0000 1.9 @@ -77,16 +77,24 @@ static void badge4_select_drivers(void) { - /* select serial driver */ serial_driver = &sa11x0_serial_driver; flash_descriptors = badge4_flash_descriptors; flash_driver = &intel16_flash_driver; } - __initlist(badge4_select_drivers, INIT_LEVEL_DRIVER_SELECTION); +static void badge4_banner(void) +{ + printf("\n\n\n" BOARD_NAME "\n" + "Blob port by Christopher Hoover <ch...@hp...>.\n" + "($Id$, " __DATE__ ")\n" + "\n"); +} +__initlist(badge4_banner, INIT_LEVEL_INITIAL_HARDWARE + 1); + + static void badge4_init_sa1111(void) { /* @@ -126,11 +134,10 @@ { int i, size; int typ0, typ1; - int memory_type, row_bits, col_bits, row_density; + int memory_type, row_bits, col_bits, module_rows, row_density; u8 spd[128]; - printf("\n\n\n" BOARD_NAME "\n" - "Blob port by Christopher Hoover <ch...@hp...>\n\n"); + GPDR |= (BADGE4_GPIO_SDTYP1 | BADGE4_GPIO_SDTYP0); /* Intialize the I2C bus and driver. */ i2c_init(&badge4_i2c_bus); @@ -157,6 +164,7 @@ row_bits = spd[SPD_ROW_BITS]; col_bits = spd[SPD_COL_BITS]; + module_rows = spd[SPD_MODULE_ROWS]; row_density = spd[SPD_ROW_DENSITY]; /* calculate the size: bit 0 is 4M, bit 1 is 8M, etc. */ @@ -164,9 +172,10 @@ for (i = 0; i < 8; i++) if (row_density & (1<<i)) size += (4<<i); + size *= module_rows; - printf("SDRAM: %d Mbytes (row bits=%d, col bits=%d)\n", - size, row_bits, col_bits); + printf("SDRAM: %d Mbytes (rows=%d, row bits=%d, col bits=%d)\n", + size, module_rows, row_bits, col_bits); /* * Here's what the CPLD expects @@ -185,21 +194,20 @@ } else if (row_bits == 13 && col_bits == 9) { typ1 = 1; typ0 = 0; } else { - printf("SDRAM: unexpected SDRAM geometry\n"); + printf("SDRAM: unexpected geometry\n"); goto fail; } set: - printf("SDRAM: setting type typ1=%d, typ0=%d\n", typ1, typ0); - GPDR |= (BADGE4_GPIO_SDTYP0 | BADGE4_GPIO_SDTYP1); - if (typ0) - GPSR = BADGE4_GPIO_SDTYP0; - else - GPCR = BADGE4_GPIO_SDTYP0; + printf("SDRAM: setting CPLD typ1=%d, typ0=%d\n", typ1, typ0); if (typ1) GPSR = BADGE4_GPIO_SDTYP1; else GPCR = BADGE4_GPIO_SDTYP1; + if (typ0) + GPSR = BADGE4_GPIO_SDTYP0; + else + GPCR = BADGE4_GPIO_SDTYP0; return; @@ -209,9 +217,10 @@ goto set; } -static void badge4_init_hardware(void) +static void badge4_init_hardware2(void) { badge4_init_sa1111(); badge4_setup_sdram(); } -__initlist(badge4_init_hardware, INIT_LEVEL_INITIAL_HARDWARE + 1); +__initlist(badge4_init_hardware2, INIT_LEVEL_INITIAL_HARDWARE + 2); + |