aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/ide/pci/slc90e66.c
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@woody.linux-foundation.org>2007-10-16 19:56:35 -0400
committerLinus Torvalds <torvalds@woody.linux-foundation.org>2007-10-16 19:56:35 -0400
commit2b0460b534f383eca744eb8fff66ec9f57e702b9 (patch)
tree1bf4b9d0ebccd3083da4de7e4273b8d29f5d5c5d /drivers/ide/pci/slc90e66.c
parentd91f5bb69adde86173071cf7fffbdf705ae8c6e7 (diff)
parentb02fcae007ac64012806bc57054e7fee6e2ffe5e (diff)
Merge master.kernel.org:/pub/scm/linux/kernel/git/bart/ide-2.6
* master.kernel.org:/pub/scm/linux/kernel/git/bart/ide-2.6: (33 commits) amd74xx: remove /proc/ide/amd74xx amd74xx/via82cxxx: don't initialize drive->dn sis5513: remove /proc/ide/sis ide: remove CONFIG_IDEDMA_ONLYDISK ide: add "hdx=nodma" kernel parameter ide: remove hwif->autodma and drive->autodma ide: remove "idex=dma" kernel parameter ide: remove CONFIG_BLK_DEV_IDEDMA_FORCED ide: use PCI_VDEVICE() macro sis5513: clear prefetch and postwrite for ATAPI devices it8213/piix/slc90e66: "de-couple" PIO and UDMA modes ide: unexport noautodma ide: unexport ide_tune_dma ide: remove ->ide_dma_check (take 2) ide-pmac: add PIO autotune fallback to ->ide_dma_check ide-cris: add PIO autotune fallback to ->ide_dma_check sl82c105: add PIO autotune fallback to ->ide_dma_check cs5530/sc1200: add PIO autotune fallback to ->ide_dma_check ide: remove ide_use_fast_pio() ide: remove drive->init_speed zeroing ...
Diffstat (limited to 'drivers/ide/pci/slc90e66.c')
-rw-r--r--drivers/ide/pci/slc90e66.c67
1 files changed, 16 insertions, 51 deletions
diff --git a/drivers/ide/pci/slc90e66.c b/drivers/ide/pci/slc90e66.c
index ebac87f7200a..fa8df6d43832 100644
--- a/drivers/ide/pci/slc90e66.c
+++ b/drivers/ide/pci/slc90e66.c
@@ -1,5 +1,5 @@
1/* 1/*
2 * linux/drivers/ide/pci/slc90e66.c Version 0.16 Jul 14, 2007 2 * linux/drivers/ide/pci/slc90e66.c Version 0.18 Aug 9, 2007
3 * 3 *
4 * Copyright (C) 2000-2002 Andre Hedrick <andre@linux-ide.org> 4 * Copyright (C) 2000-2002 Andre Hedrick <andre@linux-ide.org>
5 * Copyright (C) 2006-2007 MontaVista Software, Inc. <source@mvista.com> 5 * Copyright (C) 2006-2007 MontaVista Software, Inc. <source@mvista.com>
@@ -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);
@@ -132,26 +111,21 @@ static void slc90e66_set_dma_mode(ide_drive_t *drive, const u8 speed)
132 pci_write_config_word(dev, 0x4a, reg4a|u_speed); 111 pci_write_config_word(dev, 0x4a, reg4a|u_speed);
133 } 112 }
134 } else { 113 } else {
114 const u8 mwdma_to_pio[] = { 0, 3, 4 };
115 u8 pio;
116
135 if (reg48 & u_flag) 117 if (reg48 & u_flag)
136 pci_write_config_word(dev, 0x48, reg48 & ~u_flag); 118 pci_write_config_word(dev, 0x48, reg48 & ~u_flag);
137 if (reg4a & a_speed) 119 if (reg4a & a_speed)
138 pci_write_config_word(dev, 0x4a, reg4a & ~a_speed); 120 pci_write_config_word(dev, 0x4a, reg4a & ~a_speed);
139 }
140
141 slc90e66_set_pio_mode(drive, slc90e66_dma_2_pio(speed));
142}
143 121
144static int slc90e66_config_drive_xfer_rate (ide_drive_t *drive) 122 if (speed >= XFER_MW_DMA_0)
145{ 123 pio = mwdma_to_pio[speed - XFER_MW_DMA_0];
146 drive->init_speed = 0; 124 else
147 125 pio = 2; /* only SWDMA2 is allowed */
148 if (ide_tune_dma(drive))
149 return 0;
150
151 if (ide_use_fast_pio(drive))
152 ide_set_max_pio(drive);
153 126
154 return -1; 127 slc90e66_set_pio_mode(drive, pio);
128 }
155} 129}
156 130
157static void __devinit init_hwif_slc90e66 (ide_hwif_t *hwif) 131static void __devinit init_hwif_slc90e66 (ide_hwif_t *hwif)
@@ -159,8 +133,6 @@ static void __devinit init_hwif_slc90e66 (ide_hwif_t *hwif)
159 u8 reg47 = 0; 133 u8 reg47 = 0;
160 u8 mask = hwif->channel ? 0x01 : 0x02; /* bit0:Primary */ 134 u8 mask = hwif->channel ? 0x01 : 0x02; /* bit0:Primary */
161 135
162 hwif->autodma = 0;
163
164 if (!hwif->irq) 136 if (!hwif->irq)
165 hwif->irq = hwif->channel ? 15 : 14; 137 hwif->irq = hwif->channel ? 15 : 14;
166 138
@@ -169,11 +141,11 @@ static void __devinit init_hwif_slc90e66 (ide_hwif_t *hwif)
169 141
170 pci_read_config_byte(hwif->pci_dev, 0x47, &reg47); 142 pci_read_config_byte(hwif->pci_dev, 0x47, &reg47);
171 143
172 if (!hwif->dma_base) { 144 hwif->drives[0].autotune = 1;
173 hwif->drives[0].autotune = 1; 145 hwif->drives[1].autotune = 1;
174 hwif->drives[1].autotune = 1; 146
147 if (hwif->dma_base == 0)
175 return; 148 return;
176 }
177 149
178 hwif->atapi_dma = 1; 150 hwif->atapi_dma = 1;
179 hwif->ultra_mask = 0x1f; 151 hwif->ultra_mask = 0x1f;
@@ -183,13 +155,6 @@ static void __devinit init_hwif_slc90e66 (ide_hwif_t *hwif)
183 if (hwif->cbl != ATA_CBL_PATA40_SHORT) 155 if (hwif->cbl != ATA_CBL_PATA40_SHORT)
184 /* bit[0(1)]: 0:80, 1:40 */ 156 /* bit[0(1)]: 0:80, 1:40 */
185 hwif->cbl = (reg47 & mask) ? ATA_CBL_PATA40 : ATA_CBL_PATA80; 157 hwif->cbl = (reg47 & mask) ? ATA_CBL_PATA40 : ATA_CBL_PATA80;
186
187 hwif->ide_dma_check = &slc90e66_config_drive_xfer_rate;
188
189 if (!noautodma)
190 hwif->autodma = 1;
191 hwif->drives[0].autodma = hwif->autodma;
192 hwif->drives[1].autodma = hwif->autodma;
193} 158}
194 159
195static ide_pci_device_t slc90e66_chipset __devinitdata = { 160static ide_pci_device_t slc90e66_chipset __devinitdata = {
@@ -206,8 +171,8 @@ static int __devinit slc90e66_init_one(struct pci_dev *dev, const struct pci_dev
206 return ide_setup_pci_device(dev, &slc90e66_chipset); 171 return ide_setup_pci_device(dev, &slc90e66_chipset);
207} 172}
208 173
209static struct pci_device_id slc90e66_pci_tbl[] = { 174static const struct pci_device_id slc90e66_pci_tbl[] = {
210 { PCI_DEVICE(PCI_VENDOR_ID_EFAR, PCI_DEVICE_ID_EFAR_SLC90E66_1), 0}, 175 { PCI_VDEVICE(EFAR, PCI_DEVICE_ID_EFAR_SLC90E66_1), 0 },
211 { 0, }, 176 { 0, },
212}; 177};
213MODULE_DEVICE_TABLE(pci, slc90e66_pci_tbl); 178MODULE_DEVICE_TABLE(pci, slc90e66_pci_tbl);