diff options
author | Finn Thain <fthain@telegraphics.com.au> | 2008-04-25 11:06:05 -0400 |
---|---|---|
committer | James Bottomley <James.Bottomley@HansenPartnership.com> | 2008-04-27 13:19:57 -0400 |
commit | 6fe07aaffbf086a0ce9134ef27ce4a8921ff5947 (patch) | |
tree | 3df572890c012b0a23662141fc4e538a36b66b10 /drivers/scsi/esp_scsi.c | |
parent | 6d9d63b9480e1c7ea41845646de803c2d3f0eae2 (diff) |
[SCSI] m68k: new mac_esp scsi driver
Replace the mac_esp driver with a new one based on the esp_scsi core.
For esp_scsi: add support for sync transfers for the PIO mode, add a new
esp_driver_ops method to get the maximum dma transfer size (like the old
NCR53C9x driver), and some cleanups.
Signed-off-by: Finn Thain <fthain@telegraphics.com.au>
Acked-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Geert Uytterhoeven <geert@linux-m68k.org>
Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>
Diffstat (limited to 'drivers/scsi/esp_scsi.c')
-rw-r--r-- | drivers/scsi/esp_scsi.c | 35 |
1 files changed, 24 insertions, 11 deletions
diff --git a/drivers/scsi/esp_scsi.c b/drivers/scsi/esp_scsi.c index bfdee5968892..a0b6d414953d 100644 --- a/drivers/scsi/esp_scsi.c +++ b/drivers/scsi/esp_scsi.c | |||
@@ -978,7 +978,7 @@ static int esp_check_spur_intr(struct esp *esp) | |||
978 | */ | 978 | */ |
979 | if (!esp->ops->dma_error(esp)) { | 979 | if (!esp->ops->dma_error(esp)) { |
980 | printk(KERN_ERR PFX "esp%d: Spurious irq, " | 980 | printk(KERN_ERR PFX "esp%d: Spurious irq, " |
981 | "sreg=%x.\n", | 981 | "sreg=%02x.\n", |
982 | esp->host->unique_id, esp->sreg); | 982 | esp->host->unique_id, esp->sreg); |
983 | return -1; | 983 | return -1; |
984 | } | 984 | } |
@@ -1447,6 +1447,9 @@ static void esp_msgin_sdtr(struct esp *esp, struct esp_target_data *tp) | |||
1447 | if (offset > 15) | 1447 | if (offset > 15) |
1448 | goto do_reject; | 1448 | goto do_reject; |
1449 | 1449 | ||
1450 | if (esp->flags & ESP_FLAG_DISABLE_SYNC) | ||
1451 | offset = 0; | ||
1452 | |||
1450 | if (offset) { | 1453 | if (offset) { |
1451 | int rounded_up, one_clock; | 1454 | int rounded_up, one_clock; |
1452 | 1455 | ||
@@ -1697,7 +1700,12 @@ again: | |||
1697 | else | 1700 | else |
1698 | ent->flags &= ~ESP_CMD_FLAG_WRITE; | 1701 | ent->flags &= ~ESP_CMD_FLAG_WRITE; |
1699 | 1702 | ||
1700 | dma_len = esp_dma_length_limit(esp, dma_addr, dma_len); | 1703 | if (esp->ops->dma_length_limit) |
1704 | dma_len = esp->ops->dma_length_limit(esp, dma_addr, | ||
1705 | dma_len); | ||
1706 | else | ||
1707 | dma_len = esp_dma_length_limit(esp, dma_addr, dma_len); | ||
1708 | |||
1701 | esp->data_dma_len = dma_len; | 1709 | esp->data_dma_len = dma_len; |
1702 | 1710 | ||
1703 | if (!dma_len) { | 1711 | if (!dma_len) { |
@@ -1761,7 +1769,6 @@ again: | |||
1761 | esp_advance_dma(esp, ent, cmd, bytes_sent); | 1769 | esp_advance_dma(esp, ent, cmd, bytes_sent); |
1762 | esp_event(esp, ESP_EVENT_CHECK_PHASE); | 1770 | esp_event(esp, ESP_EVENT_CHECK_PHASE); |
1763 | goto again; | 1771 | goto again; |
1764 | break; | ||
1765 | } | 1772 | } |
1766 | 1773 | ||
1767 | case ESP_EVENT_STATUS: { | 1774 | case ESP_EVENT_STATUS: { |
@@ -2235,7 +2242,7 @@ static void esp_bootup_reset(struct esp *esp) | |||
2235 | 2242 | ||
2236 | static void esp_set_clock_params(struct esp *esp) | 2243 | static void esp_set_clock_params(struct esp *esp) |
2237 | { | 2244 | { |
2238 | int fmhz; | 2245 | int fhz; |
2239 | u8 ccf; | 2246 | u8 ccf; |
2240 | 2247 | ||
2241 | /* This is getting messy but it has to be done correctly or else | 2248 | /* This is getting messy but it has to be done correctly or else |
@@ -2270,9 +2277,9 @@ static void esp_set_clock_params(struct esp *esp) | |||
2270 | * This entails the smallest and largest sync period we could ever | 2277 | * This entails the smallest and largest sync period we could ever |
2271 | * handle on this ESP. | 2278 | * handle on this ESP. |
2272 | */ | 2279 | */ |
2273 | fmhz = esp->cfreq; | 2280 | fhz = esp->cfreq; |
2274 | 2281 | ||
2275 | ccf = ((fmhz / 1000000) + 4) / 5; | 2282 | ccf = ((fhz / 1000000) + 4) / 5; |
2276 | if (ccf == 1) | 2283 | if (ccf == 1) |
2277 | ccf = 2; | 2284 | ccf = 2; |
2278 | 2285 | ||
@@ -2281,16 +2288,16 @@ static void esp_set_clock_params(struct esp *esp) | |||
2281 | * been unable to find the clock-frequency PROM property. All | 2288 | * been unable to find the clock-frequency PROM property. All |
2282 | * other machines provide useful values it seems. | 2289 | * other machines provide useful values it seems. |
2283 | */ | 2290 | */ |
2284 | if (fmhz <= 5000000 || ccf < 1 || ccf > 8) { | 2291 | if (fhz <= 5000000 || ccf < 1 || ccf > 8) { |
2285 | fmhz = 20000000; | 2292 | fhz = 20000000; |
2286 | ccf = 4; | 2293 | ccf = 4; |
2287 | } | 2294 | } |
2288 | 2295 | ||
2289 | esp->cfact = (ccf == 8 ? 0 : ccf); | 2296 | esp->cfact = (ccf == 8 ? 0 : ccf); |
2290 | esp->cfreq = fmhz; | 2297 | esp->cfreq = fhz; |
2291 | esp->ccycle = ESP_MHZ_TO_CYCLE(fmhz); | 2298 | esp->ccycle = ESP_HZ_TO_CYCLE(fhz); |
2292 | esp->ctick = ESP_TICK(ccf, esp->ccycle); | 2299 | esp->ctick = ESP_TICK(ccf, esp->ccycle); |
2293 | esp->neg_defp = ESP_NEG_DEFP(fmhz, ccf); | 2300 | esp->neg_defp = ESP_NEG_DEFP(fhz, ccf); |
2294 | esp->sync_defp = SYNC_DEFP_SLOW; | 2301 | esp->sync_defp = SYNC_DEFP_SLOW; |
2295 | } | 2302 | } |
2296 | 2303 | ||
@@ -2382,6 +2389,12 @@ static int esp_slave_configure(struct scsi_device *dev) | |||
2382 | struct esp_target_data *tp = &esp->target[dev->id]; | 2389 | struct esp_target_data *tp = &esp->target[dev->id]; |
2383 | int goal_tags, queue_depth; | 2390 | int goal_tags, queue_depth; |
2384 | 2391 | ||
2392 | if (esp->flags & ESP_FLAG_DISABLE_SYNC) { | ||
2393 | /* Bypass async domain validation */ | ||
2394 | dev->ppr = 0; | ||
2395 | dev->sdtr = 0; | ||
2396 | } | ||
2397 | |||
2385 | goal_tags = 0; | 2398 | goal_tags = 0; |
2386 | 2399 | ||
2387 | if (dev->tagged_supported) { | 2400 | if (dev->tagged_supported) { |