Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

scsi: esp_scsi: Add support for FSC chip

The FSC (NCR53CF9x-2 / SYM53CF9x-2) has a different family code than QLogic
or Emulex parts. This caused it to be detected as a FAS100A.

Unforunately, this meant the configuration of the CONFIG3 register was
incorrect. This causes data transfer issues with FAST-SCSI targets.

The FSC also has the CONFIG4 register. It can be used to enable a feature
called Active Negation which should always be enabled according to the data
manual.

Link: https://lore.kernel.org/r/20191119202021.28720-3-jongk@linux-m68k.org
Reviewed-by: Finn Thain <fthain@telegraphics.com.au>
Signed-off-by: Kars de Jong <jongk@linux-m68k.org>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>

authored by

Kars de Jong and committed by
Martin K. Petersen
bd407261 2086faae

+28 -16
+12 -8
drivers/scsi/esp_scsi.c
··· 243 243 /* Reset the ESP chip, _not_ the SCSI bus. */ 244 244 static void esp_reset_esp(struct esp *esp) 245 245 { 246 - u8 family_code, version; 247 - 248 246 /* Now reset the ESP chip */ 249 247 scsi_esp_cmd(esp, ESP_CMD_RC); 250 248 scsi_esp_cmd(esp, ESP_CMD_NULL | ESP_CMD_DMA); ··· 255 257 */ 256 258 esp->max_period = ((35 * esp->ccycle) / 1000); 257 259 if (esp->rev == FAST) { 258 - version = esp_read8(ESP_UID); 259 - family_code = (version & 0xf8) >> 3; 260 - if (family_code == 0x02) 260 + u8 family_code = ESP_FAMILY(esp_read8(ESP_UID)); 261 + 262 + if (family_code == ESP_UID_F236) { 261 263 esp->rev = FAS236; 262 - else if (family_code == 0x0a) 264 + } else if (family_code == ESP_UID_HME) { 263 265 esp->rev = FASHME; /* Version is usually '5'. */ 264 - else 266 + } else if (family_code == ESP_UID_FSC) { 267 + esp->rev = FSC; 268 + /* Enable Active Negation */ 269 + esp_write8(ESP_CONFIG4_RADE, ESP_CFG4); 270 + } else { 265 271 esp->rev = FAS100A; 272 + } 266 273 esp->min_period = ((4 * esp->ccycle) / 1000); 267 274 } else { 268 275 esp->min_period = ((5 * esp->ccycle) / 1000); ··· 311 308 312 309 case FAS236: 313 310 case PCSCSI: 314 - /* Fast 236, AM53c974 or HME */ 311 + case FSC: 315 312 esp_write8(esp->config2, ESP_CFG2); 316 313 if (esp->rev == FASHME) { 317 314 u8 cfg3 = esp->target[0].esp_config3; ··· 2377 2374 "ESP236", 2378 2375 "FAS236", 2379 2376 "AM53C974", 2377 + "53CF9x-2", 2380 2378 "FAS100A", 2381 2379 "FAST", 2382 2380 "FASHME",
+16 -8
drivers/scsi/esp_scsi.h
··· 78 78 #define ESP_CONFIG3_IMS 0x80 /* ID msg chk'ng (esp/fas236) */ 79 79 #define ESP_CONFIG3_OBPUSH 0x80 /* Push odd-byte to dma (hme) */ 80 80 81 - /* ESP config register 4 read-write, found only on am53c974 chips */ 82 - #define ESP_CONFIG4_RADE 0x04 /* Active negation */ 83 - #define ESP_CONFIG4_RAE 0x08 /* Active negation on REQ and ACK */ 84 - #define ESP_CONFIG4_PWD 0x20 /* Reduced power feature */ 85 - #define ESP_CONFIG4_GE0 0x40 /* Glitch eater bit 0 */ 86 - #define ESP_CONFIG4_GE1 0x80 /* Glitch eater bit 1 */ 81 + /* ESP config register 4 read-write */ 82 + #define ESP_CONFIG4_BBTE 0x01 /* Back-to-back transfers (fsc) */ 83 + #define ESP_CONGIG4_TEST 0x02 /* Transfer counter test mode (fsc) */ 84 + #define ESP_CONFIG4_RADE 0x04 /* Active negation (am53c974/fsc) */ 85 + #define ESP_CONFIG4_RAE 0x08 /* Act. negation REQ/ACK (am53c974) */ 86 + #define ESP_CONFIG4_PWD 0x20 /* Reduced power feature (am53c974) */ 87 + #define ESP_CONFIG4_GE0 0x40 /* Glitch eater bit 0 (am53c974) */ 88 + #define ESP_CONFIG4_GE1 0x80 /* Glitch eater bit 1 (am53c974) */ 87 89 88 90 #define ESP_CONFIG_GE_12NS (0) 89 91 #define ESP_CONFIG_GE_25NS (ESP_CONFIG_GE1) ··· 211 209 #define ESP_TEST_TS 0x04 /* Tristate test mode */ 212 210 213 211 /* ESP unique ID register read-only, found on fas236+fas100a only */ 212 + #define ESP_UID_FAM 0xf8 /* ESP family bitmask */ 213 + 214 + #define ESP_FAMILY(uid) (((uid) & ESP_UID_FAM) >> 3) 215 + 216 + /* Values for the ESP family bits */ 214 217 #define ESP_UID_F100A 0x00 /* ESP FAS100A */ 215 218 #define ESP_UID_F236 0x02 /* ESP FAS236 */ 216 - #define ESP_UID_REV 0x07 /* ESP revision */ 217 - #define ESP_UID_FAM 0xf8 /* ESP family */ 219 + #define ESP_UID_HME 0x0a /* FAS HME */ 220 + #define ESP_UID_FSC 0x14 /* NCR/Symbios Logic 53CF9x-2 */ 218 221 219 222 /* ESP fifo flags register read-only */ 220 223 /* Note that the following implies a 16 byte FIFO on the ESP. */ ··· 271 264 ESP236, 272 265 FAS236, 273 266 PCSCSI, /* AM53c974 */ 267 + FSC, /* NCR/Symbios Logic 53CF9x-2 */ 274 268 FAS100A, 275 269 FAST, 276 270 FASHME,