Browse Source

Adjust EEPROM/flash detection to fit expected manufacturing practice.

tags/v0.9.3
Michael Brown 18 years ago
parent
commit
4c3e0fede5
1 changed files with 31 additions and 8 deletions
  1. 31
    8
      src/drivers/net/etherfabric.c

+ 31
- 8
src/drivers/net/etherfabric.c View File

1545
 #define FCN_EE_SPI_HDATA0_LBN 0
1545
 #define FCN_EE_SPI_HDATA0_LBN 0
1546
 #define FCN_EE_SPI_HDATA0_WIDTH 32
1546
 #define FCN_EE_SPI_HDATA0_WIDTH 32
1547
 
1547
 
1548
+/* VPI configuration register */
1549
+#define FCN_VPD_CONFIG_REG_KER 0x0140
1550
+#define FCN_VPD_9BIT_LBN 1
1551
+#define FCN_VPD_9BIT_WIDTH 1
1552
+
1548
 /* NIC status register */
1553
 /* NIC status register */
1549
 #define FCN_NIC_STAT_REG 0x0200
1554
 #define FCN_NIC_STAT_REG 0x0200
1550
 #define ONCHIP_SRAM_LBN 16
1555
 #define ONCHIP_SRAM_LBN 16
2285
  *
2290
  *
2286
  */
2291
  */
2287
 static void falcon_init_spi ( struct efab_nic *efab ) {
2292
 static void falcon_init_spi ( struct efab_nic *efab ) {
2293
+	efab_oword_t reg;
2294
+	int eeprom_9bit;
2295
+
2288
 	/* Initialise SPI bus */
2296
 	/* Initialise SPI bus */
2289
 	efab->spi.rw = falcon_spi_rw;
2297
 	efab->spi.rw = falcon_spi_rw;
2290
 	efab->falcon_eeprom.bus = &efab->spi;
2298
 	efab->falcon_eeprom.bus = &efab->spi;
2292
 	efab->falcon_flash.bus = &efab->spi;
2300
 	efab->falcon_flash.bus = &efab->spi;
2293
 	efab->falcon_flash.slave = FCN_EE_SPI_FLASH;
2301
 	efab->falcon_flash.slave = FCN_EE_SPI_FLASH;
2294
 
2302
 
2295
-	/* Initialise EEPROM, if present */
2303
+	/* Initialise flash if present */
2296
 	if ( efab->has_flash ) {
2304
 	if ( efab->has_flash ) {
2305
+		DBG ( "Flash is present\n" );
2297
 		init_at25f1024 ( &efab->falcon_flash );
2306
 		init_at25f1024 ( &efab->falcon_flash );
2298
-		init_at25040 ( &efab->falcon_eeprom );
2299
-	} else {
2300
-		init_mc25xx640 ( &efab->falcon_eeprom );
2301
-		/* Falcon's SPI interface cannot support a block size
2302
-		 * larger than 16, so forcibly reduce it
2303
-		 */
2304
-		efab->falcon_eeprom.nvs.block_size = 16;
2307
+	}
2308
+
2309
+	/* Initialise EEPROM if present */
2310
+	if ( efab->has_eeprom ) {
2311
+		if ( efab->is_asic ) {
2312
+			falcon_read ( efab, &reg, FCN_VPD_CONFIG_REG_KER );
2313
+			eeprom_9bit = EFAB_OWORD_FIELD ( reg, FCN_VPD_9BIT );
2314
+		} else {
2315
+			eeprom_9bit = 1;
2316
+		}
2317
+		if ( eeprom_9bit ) {
2318
+			DBG ( "Small EEPROM is present\n" );
2319
+			init_at25040 ( &efab->falcon_eeprom );
2320
+		} else {
2321
+			DBG ( "Large EEPROM is present\n" );
2322
+			init_mc25xx640 ( &efab->falcon_eeprom );
2323
+			/* Falcon's SPI interface cannot support a block
2324
+			   size larger than 16, so forcibly reduce it
2325
+			 */
2326
+			efab->falcon_eeprom.nvs.block_size = 16;
2327
+		}
2305
 	}
2328
 	}
2306
 }
2329
 }
2307
 
2330
 

Loading…
Cancel
Save