cxgbe(4): Assume that any unknown flash on the card is 4MB and has 64KB

sectors, instead of refusing to attach to the card.

Submitted by:	Casey Leedom @ Chelsio
MFC after:	3 days
Sponsored by:	Chelsio Communications
This commit is contained in:
Navdeep Parhar 2018-07-06 19:33:58 +00:00
parent 5b500ea949
commit 4d96a1b772

View File

@ -7910,7 +7910,7 @@ int t4_get_flash_params(struct adapter *adapter)
int ret;
u32 flashid = 0;
unsigned int part, manufacturer;
unsigned int density, size;
unsigned int density, size = 0;
/*
@ -7949,7 +7949,7 @@ int t4_get_flash_params(struct adapter *adapter)
*/
manufacturer = flashid & 0xff;
switch (manufacturer) {
case 0x20: { /* Micron/Numonix */
case 0x20: /* Micron/Numonix */
/*
* This Density -> Size decoding table is taken from Micron
* Data Sheets.
@ -7965,17 +7965,10 @@ int t4_get_flash_params(struct adapter *adapter)
case 0x20: size = 1 << 26; break; /* 64MB */
case 0x21: size = 1 << 27; break; /* 128MB */
case 0x22: size = 1 << 28; break; /* 256MB */
default:
CH_ERR(adapter, "Micron Flash Part has bad size, "
"ID = %#x, Density code = %#x\n",
flashid, density);
return -EINVAL;
}
break;
}
case 0x9d: { /* ISSI -- Integrated Silicon Solution, Inc. */
case 0x9d: /* ISSI -- Integrated Silicon Solution, Inc. */
/*
* This Density -> Size decoding table is taken from ISSI
* Data Sheets.
@ -7984,17 +7977,10 @@ int t4_get_flash_params(struct adapter *adapter)
switch (density) {
case 0x16: size = 1 << 25; break; /* 32MB */
case 0x17: size = 1 << 26; break; /* 64MB */
default:
CH_ERR(adapter, "ISSI Flash Part has bad size, "
"ID = %#x, Density code = %#x\n",
flashid, density);
return -EINVAL;
}
break;
}
case 0xc2: { /* Macronix */
case 0xc2: /* Macronix */
/*
* This Density -> Size decoding table is taken from Macronix
* Data Sheets.
@ -8003,17 +7989,10 @@ int t4_get_flash_params(struct adapter *adapter)
switch (density) {
case 0x17: size = 1 << 23; break; /* 8MB */
case 0x18: size = 1 << 24; break; /* 16MB */
default:
CH_ERR(adapter, "Macronix Flash Part has bad size, "
"ID = %#x, Density code = %#x\n",
flashid, density);
return -EINVAL;
}
break;
}
case 0xef: { /* Winbond */
case 0xef: /* Winbond */
/*
* This Density -> Size decoding table is taken from Winbond
* Data Sheets.
@ -8022,19 +8001,19 @@ int t4_get_flash_params(struct adapter *adapter)
switch (density) {
case 0x17: size = 1 << 23; break; /* 8MB */
case 0x18: size = 1 << 24; break; /* 16MB */
default:
CH_ERR(adapter, "Winbond Flash Part has bad size, "
"ID = %#x, Density code = %#x\n",
flashid, density);
return -EINVAL;
}
break;
}
default:
CH_ERR(adapter, "Unsupported Flash Part, ID = %#x\n", flashid);
return -EINVAL;
/* If we didn't recognize the FLASH part, that's no real issue: the
* Hardware/Software contract says that Hardware will _*ALWAYS*_
* use a FLASH part which is at least 4MB in size and has 64KB
* sectors. The unrecognized FLASH part is likely to be much larger
* than 4MB, but that's all we really need.
*/
if (size == 0) {
CH_WARN(adapter, "Unknown Flash Part, ID = %#x, assuming 4MB\n", flashid);
size = 1 << 22;
}
/*