diff options
Diffstat (limited to 'drivers/ide/pci/aec62xx.c')
-rw-r--r-- | drivers/ide/pci/aec62xx.c | 62 |
1 files changed, 20 insertions, 42 deletions
diff --git a/drivers/ide/pci/aec62xx.c b/drivers/ide/pci/aec62xx.c index 73bdf64dbbfc..b173bc66ce1e 100644 --- a/drivers/ide/pci/aec62xx.c +++ b/drivers/ide/pci/aec62xx.c | |||
@@ -87,38 +87,12 @@ static u8 pci_bus_clock_list_ultra (u8 speed, struct chipset_bus_clock_list_entr | |||
87 | return chipset_table->ultra_settings; | 87 | return chipset_table->ultra_settings; |
88 | } | 88 | } |
89 | 89 | ||
90 | static u8 aec62xx_ratemask (ide_drive_t *drive) | ||
91 | { | ||
92 | ide_hwif_t *hwif = HWIF(drive); | ||
93 | u8 mode; | ||
94 | |||
95 | switch(hwif->pci_dev->device) { | ||
96 | case PCI_DEVICE_ID_ARTOP_ATP865: | ||
97 | case PCI_DEVICE_ID_ARTOP_ATP865R: | ||
98 | mode = (inb(hwif->channel ? | ||
99 | hwif->mate->dma_status : | ||
100 | hwif->dma_status) & 0x10) ? 4 : 3; | ||
101 | break; | ||
102 | case PCI_DEVICE_ID_ARTOP_ATP860: | ||
103 | case PCI_DEVICE_ID_ARTOP_ATP860R: | ||
104 | mode = 2; | ||
105 | break; | ||
106 | case PCI_DEVICE_ID_ARTOP_ATP850UF: | ||
107 | default: | ||
108 | return 1; | ||
109 | } | ||
110 | |||
111 | if (!eighty_ninty_three(drive)) | ||
112 | mode = min(mode, (u8)1); | ||
113 | return mode; | ||
114 | } | ||
115 | |||
116 | static int aec6210_tune_chipset (ide_drive_t *drive, u8 xferspeed) | 90 | static int aec6210_tune_chipset (ide_drive_t *drive, u8 xferspeed) |
117 | { | 91 | { |
118 | ide_hwif_t *hwif = HWIF(drive); | 92 | ide_hwif_t *hwif = HWIF(drive); |
119 | struct pci_dev *dev = hwif->pci_dev; | 93 | struct pci_dev *dev = hwif->pci_dev; |
120 | u16 d_conf = 0; | 94 | u16 d_conf = 0; |
121 | u8 speed = ide_rate_filter(aec62xx_ratemask(drive), xferspeed); | 95 | u8 speed = ide_rate_filter(drive, xferspeed); |
122 | u8 ultra = 0, ultra_conf = 0; | 96 | u8 ultra = 0, ultra_conf = 0; |
123 | u8 tmp0 = 0, tmp1 = 0, tmp2 = 0; | 97 | u8 tmp0 = 0, tmp1 = 0, tmp2 = 0; |
124 | unsigned long flags; | 98 | unsigned long flags; |
@@ -145,7 +119,7 @@ static int aec6260_tune_chipset (ide_drive_t *drive, u8 xferspeed) | |||
145 | { | 119 | { |
146 | ide_hwif_t *hwif = HWIF(drive); | 120 | ide_hwif_t *hwif = HWIF(drive); |
147 | struct pci_dev *dev = hwif->pci_dev; | 121 | struct pci_dev *dev = hwif->pci_dev; |
148 | u8 speed = ide_rate_filter(aec62xx_ratemask(drive), xferspeed); | 122 | u8 speed = ide_rate_filter(drive, xferspeed); |
149 | u8 unit = (drive->select.b.unit & 0x01); | 123 | u8 unit = (drive->select.b.unit & 0x01); |
150 | u8 tmp1 = 0, tmp2 = 0; | 124 | u8 tmp1 = 0, tmp2 = 0; |
151 | u8 ultra = 0, drive_conf = 0, ultra_conf = 0; | 125 | u8 ultra = 0, drive_conf = 0, ultra_conf = 0; |
@@ -181,17 +155,6 @@ static int aec62xx_tune_chipset (ide_drive_t *drive, u8 speed) | |||
181 | } | 155 | } |
182 | } | 156 | } |
183 | 157 | ||
184 | static int config_chipset_for_dma (ide_drive_t *drive) | ||
185 | { | ||
186 | u8 speed = ide_dma_speed(drive, aec62xx_ratemask(drive)); | ||
187 | |||
188 | if (!(speed)) | ||
189 | return 0; | ||
190 | |||
191 | (void) aec62xx_tune_chipset(drive, speed); | ||
192 | return ide_dma_enable(drive); | ||
193 | } | ||
194 | |||
195 | static void aec62xx_tune_drive (ide_drive_t *drive, u8 pio) | 158 | static void aec62xx_tune_drive (ide_drive_t *drive, u8 pio) |
196 | { | 159 | { |
197 | pio = ide_get_best_pio_mode(drive, pio, 4, NULL); | 160 | pio = ide_get_best_pio_mode(drive, pio, 4, NULL); |
@@ -200,7 +163,7 @@ static void aec62xx_tune_drive (ide_drive_t *drive, u8 pio) | |||
200 | 163 | ||
201 | static int aec62xx_config_drive_xfer_rate (ide_drive_t *drive) | 164 | static int aec62xx_config_drive_xfer_rate (ide_drive_t *drive) |
202 | { | 165 | { |
203 | if (ide_use_dma(drive) && config_chipset_for_dma(drive)) | 166 | if (ide_tune_dma(drive)) |
204 | return 0; | 167 | return 0; |
205 | 168 | ||
206 | if (ide_use_fast_pio(drive)) | 169 | if (ide_use_fast_pio(drive)) |
@@ -261,11 +224,13 @@ static unsigned int __devinit init_chipset_aec62xx(struct pci_dev *dev, const ch | |||
261 | 224 | ||
262 | static void __devinit init_hwif_aec62xx(ide_hwif_t *hwif) | 225 | static void __devinit init_hwif_aec62xx(ide_hwif_t *hwif) |
263 | { | 226 | { |
227 | struct pci_dev *dev = hwif->pci_dev; | ||
228 | |||
264 | hwif->autodma = 0; | 229 | hwif->autodma = 0; |
265 | hwif->tuneproc = &aec62xx_tune_drive; | 230 | hwif->tuneproc = &aec62xx_tune_drive; |
266 | hwif->speedproc = &aec62xx_tune_chipset; | 231 | hwif->speedproc = &aec62xx_tune_chipset; |
267 | 232 | ||
268 | if (hwif->pci_dev->device == PCI_DEVICE_ID_ARTOP_ATP850UF) | 233 | if (dev->device == PCI_DEVICE_ID_ARTOP_ATP850UF) |
269 | hwif->serialized = hwif->channel; | 234 | hwif->serialized = hwif->channel; |
270 | 235 | ||
271 | if (hwif->mate) | 236 | if (hwif->mate) |
@@ -277,7 +242,15 @@ static void __devinit init_hwif_aec62xx(ide_hwif_t *hwif) | |||
277 | return; | 242 | return; |
278 | } | 243 | } |
279 | 244 | ||
280 | hwif->ultra_mask = 0x7f; | 245 | hwif->ultra_mask = hwif->cds->udma_mask; |
246 | |||
247 | /* atp865 and atp865r */ | ||
248 | if (hwif->ultra_mask == 0x3f) { | ||
249 | /* check bit 0x10 of DMA status register */ | ||
250 | if (inb(pci_resource_start(dev, 4) + 2) & 0x10) | ||
251 | hwif->ultra_mask = 0x7f; /* udma0-6 */ | ||
252 | } | ||
253 | |||
281 | hwif->mwdma_mask = 0x07; | 254 | hwif->mwdma_mask = 0x07; |
282 | 255 | ||
283 | hwif->ide_dma_check = &aec62xx_config_drive_xfer_rate; | 256 | hwif->ide_dma_check = &aec62xx_config_drive_xfer_rate; |
@@ -344,6 +317,7 @@ static ide_pci_device_t aec62xx_chipsets[] __devinitdata = { | |||
344 | .autodma = AUTODMA, | 317 | .autodma = AUTODMA, |
345 | .enablebits = {{0x4a,0x02,0x02}, {0x4a,0x04,0x04}}, | 318 | .enablebits = {{0x4a,0x02,0x02}, {0x4a,0x04,0x04}}, |
346 | .bootable = OFF_BOARD, | 319 | .bootable = OFF_BOARD, |
320 | .udma_mask = 0x07, /* udma0-2 */ | ||
347 | },{ /* 1 */ | 321 | },{ /* 1 */ |
348 | .name = "AEC6260", | 322 | .name = "AEC6260", |
349 | .init_setup = init_setup_aec62xx, | 323 | .init_setup = init_setup_aec62xx, |
@@ -353,6 +327,7 @@ static ide_pci_device_t aec62xx_chipsets[] __devinitdata = { | |||
353 | .channels = 2, | 327 | .channels = 2, |
354 | .autodma = NOAUTODMA, | 328 | .autodma = NOAUTODMA, |
355 | .bootable = OFF_BOARD, | 329 | .bootable = OFF_BOARD, |
330 | .udma_mask = 0x1f, /* udma0-4 */ | ||
356 | },{ /* 2 */ | 331 | },{ /* 2 */ |
357 | .name = "AEC6260R", | 332 | .name = "AEC6260R", |
358 | .init_setup = init_setup_aec62xx, | 333 | .init_setup = init_setup_aec62xx, |
@@ -363,6 +338,7 @@ static ide_pci_device_t aec62xx_chipsets[] __devinitdata = { | |||
363 | .autodma = AUTODMA, | 338 | .autodma = AUTODMA, |
364 | .enablebits = {{0x4a,0x02,0x02}, {0x4a,0x04,0x04}}, | 339 | .enablebits = {{0x4a,0x02,0x02}, {0x4a,0x04,0x04}}, |
365 | .bootable = NEVER_BOARD, | 340 | .bootable = NEVER_BOARD, |
341 | .udma_mask = 0x1f, /* udma0-4 */ | ||
366 | },{ /* 3 */ | 342 | },{ /* 3 */ |
367 | .name = "AEC6X80", | 343 | .name = "AEC6X80", |
368 | .init_setup = init_setup_aec6x80, | 344 | .init_setup = init_setup_aec6x80, |
@@ -372,6 +348,7 @@ static ide_pci_device_t aec62xx_chipsets[] __devinitdata = { | |||
372 | .channels = 2, | 348 | .channels = 2, |
373 | .autodma = AUTODMA, | 349 | .autodma = AUTODMA, |
374 | .bootable = OFF_BOARD, | 350 | .bootable = OFF_BOARD, |
351 | .udma_mask = 0x3f, /* udma0-5 */ | ||
375 | },{ /* 4 */ | 352 | },{ /* 4 */ |
376 | .name = "AEC6X80R", | 353 | .name = "AEC6X80R", |
377 | .init_setup = init_setup_aec6x80, | 354 | .init_setup = init_setup_aec6x80, |
@@ -382,6 +359,7 @@ static ide_pci_device_t aec62xx_chipsets[] __devinitdata = { | |||
382 | .autodma = AUTODMA, | 359 | .autodma = AUTODMA, |
383 | .enablebits = {{0x4a,0x02,0x02}, {0x4a,0x04,0x04}}, | 360 | .enablebits = {{0x4a,0x02,0x02}, {0x4a,0x04,0x04}}, |
384 | .bootable = OFF_BOARD, | 361 | .bootable = OFF_BOARD, |
362 | .udma_mask = 0x3f, /* udma0-5 */ | ||
385 | } | 363 | } |
386 | }; | 364 | }; |
387 | 365 | ||