aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPaolo Bonzini <pbonzini@redhat.com>2014-11-24 09:37:28 -0500
committerChristoph Hellwig <hch@lst.de>2014-11-24 10:13:17 -0500
commit8a9aeb45d0f16932f5dc78a48c09f5fc3ab13832 (patch)
tree8511f8a42a0b58e587c22f0288b1f1b5c7c2d81b
parenteeea2f9c2f2ecc5f3217edcacc95817047b143c2 (diff)
esp_scsi: let DMA driver provide a config2 value
On PCscsi, the FENAB configuration also enables 24-bit DMA transfer lengths (and provides the chip id in TCHI after reset). We want to be able to enable this parameter from the DMA driver. Check if the caller of scsi_esp_register provided a value for esp->config2. If this is the case, assume this is not an ESP100, skip the detection phase and leave esp->config2 untouched. It will be used in esp_reset_esp. Reviewed-by: Hannes Reinecke <hare@suse.de> Acked-by: David S. Miller <davem@davemloft.net> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com> Signed-off-by: Christoph Hellwig <hch@lst.de>
-rw-r--r--drivers/scsi/esp_scsi.c70
1 files changed, 37 insertions, 33 deletions
diff --git a/drivers/scsi/esp_scsi.c b/drivers/scsi/esp_scsi.c
index 3fb6a00934bc..8ea03af435ba 100644
--- a/drivers/scsi/esp_scsi.c
+++ b/drivers/scsi/esp_scsi.c
@@ -2219,46 +2219,50 @@ static void esp_get_revision(struct esp *esp)
2219 u8 val; 2219 u8 val;
2220 2220
2221 esp->config1 = (ESP_CONFIG1_PENABLE | (esp->scsi_id & 7)); 2221 esp->config1 = (ESP_CONFIG1_PENABLE | (esp->scsi_id & 7));
2222 esp->config2 = (ESP_CONFIG2_SCSI2ENAB | ESP_CONFIG2_REGPARITY); 2222 if (esp->config2 == 0) {
2223 esp->config2 = (ESP_CONFIG2_SCSI2ENAB | ESP_CONFIG2_REGPARITY);
2224 esp_write8(esp->config2, ESP_CFG2);
2225
2226 val = esp_read8(ESP_CFG2);
2227 val &= ~ESP_CONFIG2_MAGIC;
2228
2229 esp->config2 = 0;
2230 if (val != (ESP_CONFIG2_SCSI2ENAB | ESP_CONFIG2_REGPARITY)) {
2231 /*
2232 * If what we write to cfg2 does not come back,
2233 * cfg2 is not implemented.
2234 * Therefore this must be a plain esp100.
2235 */
2236 esp->rev = ESP100;
2237 return;
2238 }
2239 }
2240
2241 esp_set_all_config3(esp, 5);
2242 esp->prev_cfg3 = 5;
2223 esp_write8(esp->config2, ESP_CFG2); 2243 esp_write8(esp->config2, ESP_CFG2);
2244 esp_write8(0, ESP_CFG3);
2245 esp_write8(esp->prev_cfg3, ESP_CFG3);
2224 2246
2225 val = esp_read8(ESP_CFG2); 2247 val = esp_read8(ESP_CFG3);
2226 val &= ~ESP_CONFIG2_MAGIC; 2248 if (val != 5) {
2227 if (val != (ESP_CONFIG2_SCSI2ENAB | ESP_CONFIG2_REGPARITY)) { 2249 /* The cfg2 register is implemented, however
2228 /* If what we write to cfg2 does not come back, cfg2 is not 2250 * cfg3 is not, must be esp100a.
2229 * implemented, therefore this must be a plain esp100.
2230 */ 2251 */
2231 esp->rev = ESP100; 2252 esp->rev = ESP100A;
2232 } else { 2253 } else {
2233 esp->config2 = 0; 2254 esp_set_all_config3(esp, 0);
2234 esp_set_all_config3(esp, 5); 2255 esp->prev_cfg3 = 0;
2235 esp->prev_cfg3 = 5;
2236 esp_write8(esp->config2, ESP_CFG2);
2237 esp_write8(0, ESP_CFG3);
2238 esp_write8(esp->prev_cfg3, ESP_CFG3); 2256 esp_write8(esp->prev_cfg3, ESP_CFG3);
2239 2257
2240 val = esp_read8(ESP_CFG3); 2258 /* All of cfg{1,2,3} implemented, must be one of
2241 if (val != 5) { 2259 * the fas variants, figure out which one.
2242 /* The cfg2 register is implemented, however 2260 */
2243 * cfg3 is not, must be esp100a. 2261 if (esp->cfact == 0 || esp->cfact > ESP_CCF_F5) {
2244 */ 2262 esp->rev = FAST;
2245 esp->rev = ESP100A; 2263 esp->sync_defp = SYNC_DEFP_FAST;
2246 } else { 2264 } else {
2247 esp_set_all_config3(esp, 0); 2265 esp->rev = ESP236;
2248 esp->prev_cfg3 = 0;
2249 esp_write8(esp->prev_cfg3, ESP_CFG3);
2250
2251 /* All of cfg{1,2,3} implemented, must be one of
2252 * the fas variants, figure out which one.
2253 */
2254 if (esp->cfact == 0 || esp->cfact > ESP_CCF_F5) {
2255 esp->rev = FAST;
2256 esp->sync_defp = SYNC_DEFP_FAST;
2257 } else {
2258 esp->rev = ESP236;
2259 }
2260 esp->config2 = 0;
2261 esp_write8(esp->config2, ESP_CFG2);
2262 } 2266 }
2263 } 2267 }
2264} 2268}