aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/ide/pci/slc90e66.c
diff options
context:
space:
mode:
authorBartlomiej Zolnierkiewicz <bzolnier@gmail.com>2007-10-16 16:29:54 -0400
committerBartlomiej Zolnierkiewicz <bzolnier@gmail.com>2007-10-16 16:29:54 -0400
commit8c91abf86280a1b900619ee0d8ae1840e943110e (patch)
treef78a53e4860fbde0bc0c741ef186c5a40d272b17 /drivers/ide/pci/slc90e66.c
parent94c7fa0fcc89571b24c90e0a7545ad31aa390f24 (diff)
it8213/piix/slc90e66: remove {it8213,piix,slc90e66}_dma_2_pio()
Acked-by: Sergei Shtylyov <sshtylyov@ru.mvista.com> Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
Diffstat (limited to 'drivers/ide/pci/slc90e66.c')
-rw-r--r--drivers/ide/pci/slc90e66.c33
1 files changed, 11 insertions, 22 deletions
diff --git a/drivers/ide/pci/slc90e66.c b/drivers/ide/pci/slc90e66.c
index 31cb0263dbd2..772b58671bb2 100644
--- a/drivers/ide/pci/slc90e66.c
+++ b/drivers/ide/pci/slc90e66.c
@@ -21,27 +21,6 @@
21 21
22#include <asm/io.h> 22#include <asm/io.h>
23 23
24static u8 slc90e66_dma_2_pio (u8 xfer_rate) {
25 switch(xfer_rate) {
26 case XFER_UDMA_4:
27 case XFER_UDMA_3:
28 case XFER_UDMA_2:
29 case XFER_UDMA_1:
30 case XFER_UDMA_0:
31 case XFER_MW_DMA_2:
32 return 4;
33 case XFER_MW_DMA_1:
34 return 3;
35 case XFER_SW_DMA_2:
36 return 2;
37 case XFER_MW_DMA_0:
38 case XFER_SW_DMA_1:
39 case XFER_SW_DMA_0:
40 default:
41 return 0;
42 }
43}
44
45static void slc90e66_set_pio_mode(ide_drive_t *drive, const u8 pio) 24static void slc90e66_set_pio_mode(ide_drive_t *drive, const u8 pio)
46{ 25{
47 ide_hwif_t *hwif = HWIF(drive); 26 ide_hwif_t *hwif = HWIF(drive);
@@ -103,6 +82,7 @@ static void slc90e66_set_dma_mode(ide_drive_t *drive, const u8 speed)
103 int sitre = 0, a_speed = 7 << (drive->dn * 4); 82 int sitre = 0, a_speed = 7 << (drive->dn * 4);
104 int u_speed = 0, u_flag = 1 << drive->dn; 83 int u_speed = 0, u_flag = 1 << drive->dn;
105 u16 reg4042, reg44, reg48, reg4a; 84 u16 reg4042, reg44, reg48, reg4a;
85 u8 pio;
106 86
107 pci_read_config_word(dev, maslave, &reg4042); 87 pci_read_config_word(dev, maslave, &reg4042);
108 sitre = (reg4042 & 0x4000) ? 1 : 0; 88 sitre = (reg4042 & 0x4000) ? 1 : 0;
@@ -131,14 +111,23 @@ static void slc90e66_set_dma_mode(ide_drive_t *drive, const u8 speed)
131 pci_read_config_word(dev, 0x4a, &reg4a); 111 pci_read_config_word(dev, 0x4a, &reg4a);
132 pci_write_config_word(dev, 0x4a, reg4a|u_speed); 112 pci_write_config_word(dev, 0x4a, reg4a|u_speed);
133 } 113 }
114
115 pio = 4;
134 } else { 116 } else {
117 const u8 mwdma_to_pio[] = { 0, 3, 4 };
118
135 if (reg48 & u_flag) 119 if (reg48 & u_flag)
136 pci_write_config_word(dev, 0x48, reg48 & ~u_flag); 120 pci_write_config_word(dev, 0x48, reg48 & ~u_flag);
137 if (reg4a & a_speed) 121 if (reg4a & a_speed)
138 pci_write_config_word(dev, 0x4a, reg4a & ~a_speed); 122 pci_write_config_word(dev, 0x4a, reg4a & ~a_speed);
123
124 if (speed >= XFER_MW_DMA_0)
125 pio = mwdma_to_pio[speed - XFER_MW_DMA_0];
126 else
127 pio = 2; /* only SWDMA2 is allowed */
139 } 128 }
140 129
141 slc90e66_set_pio_mode(drive, slc90e66_dma_2_pio(speed)); 130 slc90e66_set_pio_mode(drive, pio);
142} 131}
143 132
144static int slc90e66_config_drive_xfer_rate (ide_drive_t *drive) 133static int slc90e66_config_drive_xfer_rate (ide_drive_t *drive)