Commit 843789f6 authored by Casey Leedom's avatar Casey Leedom Committed by David S. Miller

cxgb4: assume flash part size to be 4MB, if it can't be determined

t4_get_flash_params() fails in a fatal fashion if the FLASH part isn't
one of the recognized parts. But this leads to desperate efforts to update
drivers when various FLASH parts which we are using suddenly become
unavailable and we need to substitute new FLASH parts.  This has lead to
more than one Customer Field Emergency when a Customer has an old driver
and suddenly can't use newly shipped adapters.

This commit fixes this by simply assuming that the FLASH part is 4MB in
size if it can't be identified. Note that all Chelsio adapters will have
flash parts which are at least 4MB in size.
Signed-off-by: default avatarCasey Leedom <leedom@chelsio.com>
Signed-off-by: default avatarGanesh Goudar <ganeshgr@chelsio.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 7f978e85
...@@ -8702,7 +8702,7 @@ static int t4_get_flash_params(struct adapter *adap) ...@@ -8702,7 +8702,7 @@ static int t4_get_flash_params(struct adapter *adap)
}; };
unsigned int part, manufacturer; unsigned int part, manufacturer;
unsigned int density, size; unsigned int density, size = 0;
u32 flashid = 0; u32 flashid = 0;
int ret; int ret;
...@@ -8772,11 +8772,6 @@ static int t4_get_flash_params(struct adapter *adap) ...@@ -8772,11 +8772,6 @@ static int t4_get_flash_params(struct adapter *adap)
case 0x22: /* 256MB */ case 0x22: /* 256MB */
size = 1 << 28; size = 1 << 28;
break; break;
default:
dev_err(adap->pdev_dev, "Micron Flash Part has bad size, ID = %#x, Density code = %#x\n",
flashid, density);
return -EINVAL;
} }
break; break;
} }
...@@ -8792,10 +8787,6 @@ static int t4_get_flash_params(struct adapter *adap) ...@@ -8792,10 +8787,6 @@ static int t4_get_flash_params(struct adapter *adap)
case 0x17: /* 64MB */ case 0x17: /* 64MB */
size = 1 << 26; size = 1 << 26;
break; break;
default:
dev_err(adap->pdev_dev, "ISSI Flash Part has bad size, ID = %#x, Density code = %#x\n",
flashid, density);
return -EINVAL;
} }
break; break;
} }
...@@ -8811,10 +8802,6 @@ static int t4_get_flash_params(struct adapter *adap) ...@@ -8811,10 +8802,6 @@ static int t4_get_flash_params(struct adapter *adap)
case 0x18: /* 16MB */ case 0x18: /* 16MB */
size = 1 << 24; size = 1 << 24;
break; break;
default:
dev_err(adap->pdev_dev, "Macronix Flash Part has bad size, ID = %#x, Density code = %#x\n",
flashid, density);
return -EINVAL;
} }
break; break;
} }
...@@ -8830,17 +8817,21 @@ static int t4_get_flash_params(struct adapter *adap) ...@@ -8830,17 +8817,21 @@ static int t4_get_flash_params(struct adapter *adap)
case 0x18: /* 16MB */ case 0x18: /* 16MB */
size = 1 << 24; size = 1 << 24;
break; break;
default:
dev_err(adap->pdev_dev, "Winbond Flash Part has bad size, ID = %#x, Density code = %#x\n",
flashid, density);
return -EINVAL;
} }
break; break;
} }
default: }
dev_err(adap->pdev_dev, "Unsupported Flash Part, ID = %#x\n",
/* 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) {
dev_warn(adap->pdev_dev, "Unknown Flash Part, ID = %#x, assuming 4MB\n",
flashid); flashid);
return -EINVAL; size = 1 << 22;
} }
/* Store decoded Flash size and fall through into vetting code. */ /* Store decoded Flash size and fall through into vetting code. */
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment