diff options
author | Sergei Shtylyov <sshtylyov@ru.mvista.com> | 2009-03-31 14:15:28 -0400 |
---|---|---|
committer | Bartlomiej Zolnierkiewicz <bzolnier@gmail.com> | 2009-03-31 14:15:28 -0400 |
commit | 74638c84821c066d02c158bc843c84499ddc9764 (patch) | |
tree | cd6f79f34d87d25a621aaf1369ce226923de3c14 /drivers/ide/ide-xfer-mode.c | |
parent | c4199930b119eb9c1ffb102ed57eaac4d4424d08 (diff) |
ide: add support for CFA specified transfer modes (take 3)
Add support for the CompactFlash specific PIO modes 5/6 and MWDMA modes 3/4.
Since there were no PIO5 capable hard drives produced and one would also need
66 MHz IDE clock to actually get the difference WRT the address setup timings
programmed, I decided to simply replace the old non-standard PIO mode 5 timings
with the CFA specified ones.
Signed-off-by: Sergei Shtylyov <sshtylyov@ru.mvista.com>
Cc: stf_xl@wp.pl
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
Diffstat (limited to 'drivers/ide/ide-xfer-mode.c')
-rw-r--r-- | drivers/ide/ide-xfer-mode.c | 15 |
1 files changed, 9 insertions, 6 deletions
diff --git a/drivers/ide/ide-xfer-mode.c b/drivers/ide/ide-xfer-mode.c index 6910f6a257e8..af44be9d546c 100644 --- a/drivers/ide/ide-xfer-mode.c +++ b/drivers/ide/ide-xfer-mode.c | |||
@@ -9,11 +9,11 @@ static const char *udma_str[] = | |||
9 | { "UDMA/16", "UDMA/25", "UDMA/33", "UDMA/44", | 9 | { "UDMA/16", "UDMA/25", "UDMA/33", "UDMA/44", |
10 | "UDMA/66", "UDMA/100", "UDMA/133", "UDMA7" }; | 10 | "UDMA/66", "UDMA/100", "UDMA/133", "UDMA7" }; |
11 | static const char *mwdma_str[] = | 11 | static const char *mwdma_str[] = |
12 | { "MWDMA0", "MWDMA1", "MWDMA2" }; | 12 | { "MWDMA0", "MWDMA1", "MWDMA2", "MWDMA3", "MWDMA4" }; |
13 | static const char *swdma_str[] = | 13 | static const char *swdma_str[] = |
14 | { "SWDMA0", "SWDMA1", "SWDMA2" }; | 14 | { "SWDMA0", "SWDMA1", "SWDMA2" }; |
15 | static const char *pio_str[] = | 15 | static const char *pio_str[] = |
16 | { "PIO0", "PIO1", "PIO2", "PIO3", "PIO4", "PIO5" }; | 16 | { "PIO0", "PIO1", "PIO2", "PIO3", "PIO4", "PIO5", "PIO6" }; |
17 | 17 | ||
18 | /** | 18 | /** |
19 | * ide_xfer_verbose - return IDE mode names | 19 | * ide_xfer_verbose - return IDE mode names |
@@ -30,11 +30,11 @@ const char *ide_xfer_verbose(u8 mode) | |||
30 | 30 | ||
31 | if (mode >= XFER_UDMA_0 && mode <= XFER_UDMA_7) | 31 | if (mode >= XFER_UDMA_0 && mode <= XFER_UDMA_7) |
32 | s = udma_str[i]; | 32 | s = udma_str[i]; |
33 | else if (mode >= XFER_MW_DMA_0 && mode <= XFER_MW_DMA_2) | 33 | else if (mode >= XFER_MW_DMA_0 && mode <= XFER_MW_DMA_4) |
34 | s = mwdma_str[i]; | 34 | s = mwdma_str[i]; |
35 | else if (mode >= XFER_SW_DMA_0 && mode <= XFER_SW_DMA_2) | 35 | else if (mode >= XFER_SW_DMA_0 && mode <= XFER_SW_DMA_2) |
36 | s = swdma_str[i]; | 36 | s = swdma_str[i]; |
37 | else if (mode >= XFER_PIO_0 && mode <= XFER_PIO_5) | 37 | else if (mode >= XFER_PIO_0 && mode <= XFER_PIO_6) |
38 | s = pio_str[i & 0x7]; | 38 | s = pio_str[i & 0x7]; |
39 | else if (mode == XFER_PIO_SLOW) | 39 | else if (mode == XFER_PIO_SLOW) |
40 | s = "PIO SLOW"; | 40 | s = "PIO SLOW"; |
@@ -79,7 +79,10 @@ u8 ide_get_best_pio_mode(ide_drive_t *drive, u8 mode_wanted, u8 max_mode) | |||
79 | } | 79 | } |
80 | 80 | ||
81 | if (id[ATA_ID_FIELD_VALID] & 2) { /* ATA2? */ | 81 | if (id[ATA_ID_FIELD_VALID] & 2) { /* ATA2? */ |
82 | if (ata_id_has_iordy(id)) { | 82 | if (ata_id_is_cfa(id) && (id[ATA_ID_CFA_MODES] & 7)) |
83 | pio_mode = 4 + min_t(int, 2, | ||
84 | id[ATA_ID_CFA_MODES] & 7); | ||
85 | else if (ata_id_has_iordy(id)) { | ||
83 | if (id[ATA_ID_PIO_MODES] & 7) { | 86 | if (id[ATA_ID_PIO_MODES] & 7) { |
84 | overridden = 0; | 87 | overridden = 0; |
85 | if (id[ATA_ID_PIO_MODES] & 4) | 88 | if (id[ATA_ID_PIO_MODES] & 4) |
@@ -239,7 +242,7 @@ int ide_set_xfer_rate(ide_drive_t *drive, u8 rate) | |||
239 | 242 | ||
240 | BUG_ON(rate < XFER_PIO_0); | 243 | BUG_ON(rate < XFER_PIO_0); |
241 | 244 | ||
242 | if (rate >= XFER_PIO_0 && rate <= XFER_PIO_5) | 245 | if (rate >= XFER_PIO_0 && rate <= XFER_PIO_6) |
243 | return ide_set_pio_mode(drive, rate); | 246 | return ide_set_pio_mode(drive, rate); |
244 | 247 | ||
245 | return ide_set_dma_mode(drive, rate); | 248 | return ide_set_dma_mode(drive, rate); |