aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/ide
diff options
context:
space:
mode:
authorSergei Shtylyov <sshtylyov@ru.mvista.com>2007-07-09 17:17:56 -0400
committerBartlomiej Zolnierkiewicz <bzolnier@gmail.com>2007-07-09 17:17:56 -0400
commit1b9da32a2855afa3c5f27690e03a33dc97410c42 (patch)
treed09e32add5b9f5159ce62a4ceef6b9c47fd085bf /drivers/ide
parentb1d19db4e770a752ec032971388fa69a73c84919 (diff)
aec62xx: remove init_dma() method (take 2)
Get rid of the init_dma() method (which had no particular reason to exist) by folding it into the init_hwif() method. While at it, also perform some cleanup in the latter method: - get rid of the useless clearing of hwif->autodma; - fold the serialization code into one 'if' statement; - fold setting the drives' 'autotune' and 'autodma' fields into the single statements... Signed-off-by: Sergei Shtylyov <sshtylyov@ru.mvista.com> Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
Diffstat (limited to 'drivers/ide')
-rw-r--r--drivers/ide/pci/aec62xx.c51
1 files changed, 16 insertions, 35 deletions
diff --git a/drivers/ide/pci/aec62xx.c b/drivers/ide/pci/aec62xx.c
index 7067df2590c3..99184be6a98c 100644
--- a/drivers/ide/pci/aec62xx.c
+++ b/drivers/ide/pci/aec62xx.c
@@ -1,5 +1,5 @@
1/* 1/*
2 * linux/drivers/ide/pci/aec62xx.c Version 0.22 Apr 23, 2007 2 * linux/drivers/ide/pci/aec62xx.c Version 0.23 May 23, 2007
3 * 3 *
4 * Copyright (C) 1999-2002 Andre Hedrick <andre@linux-ide.org> 4 * Copyright (C) 1999-2002 Andre Hedrick <andre@linux-ide.org>
5 * Copyright (C) 2007 MontaVista Software, Inc. <source@mvista.com> 5 * Copyright (C) 2007 MontaVista Software, Inc. <source@mvista.com>
@@ -220,21 +220,18 @@ static unsigned int __devinit init_chipset_aec62xx(struct pci_dev *dev, const ch
220 220
221static void __devinit init_hwif_aec62xx(ide_hwif_t *hwif) 221static void __devinit init_hwif_aec62xx(ide_hwif_t *hwif)
222{ 222{
223 struct pci_dev *dev = hwif->pci_dev; 223 struct pci_dev *dev = hwif->pci_dev;
224 u8 reg54 = 0, mask = hwif->channel ? 0xf0 : 0x0f;
225 unsigned long flags;
224 226
225 hwif->autodma = 0;
226 hwif->tuneproc = &aec62xx_tune_drive; 227 hwif->tuneproc = &aec62xx_tune_drive;
227 hwif->speedproc = &aec62xx_tune_chipset; 228 hwif->speedproc = &aec62xx_tune_chipset;
228 229
229 if (dev->device == PCI_DEVICE_ID_ARTOP_ATP850UF) 230 if (dev->device == PCI_DEVICE_ID_ARTOP_ATP850UF && hwif->mate)
230 hwif->serialized = hwif->channel; 231 hwif->mate->serialized = hwif->serialized = 1;
231
232 if (hwif->mate)
233 hwif->mate->serialized = hwif->serialized;
234 232
235 if (!hwif->dma_base) { 233 if (!hwif->dma_base) {
236 hwif->drives[0].autotune = 1; 234 hwif->drives[0].autotune = hwif->drives[1].autotune = 1;
237 hwif->drives[1].autotune = 1;
238 return; 235 return;
239 } 236 }
240 237
@@ -244,32 +241,21 @@ static void __devinit init_hwif_aec62xx(ide_hwif_t *hwif)
244 hwif->ide_dma_check = &aec62xx_config_drive_xfer_rate; 241 hwif->ide_dma_check = &aec62xx_config_drive_xfer_rate;
245 hwif->dma_lost_irq = &aec62xx_dma_lost_irq; 242 hwif->dma_lost_irq = &aec62xx_dma_lost_irq;
246 243
247 if (!noautodma)
248 hwif->autodma = 1;
249 hwif->drives[0].autodma = hwif->autodma;
250 hwif->drives[1].autodma = hwif->autodma;
251}
252
253static void __devinit init_dma_aec62xx(ide_hwif_t *hwif, unsigned long dmabase)
254{
255 struct pci_dev *dev = hwif->pci_dev;
256
257 if (dev->device == PCI_DEVICE_ID_ARTOP_ATP850UF) { 244 if (dev->device == PCI_DEVICE_ID_ARTOP_ATP850UF) {
258 u8 reg54h = 0;
259 unsigned long flags;
260
261 spin_lock_irqsave(&ide_lock, flags); 245 spin_lock_irqsave(&ide_lock, flags);
262 pci_read_config_byte(dev, 0x54, &reg54h); 246 pci_read_config_byte (dev, 0x54, &reg54);
263 pci_write_config_byte(dev, 0x54, reg54h & ~(hwif->channel ? 0xF0 : 0x0F)); 247 pci_write_config_byte(dev, 0x54, (reg54 & ~mask));
264 spin_unlock_irqrestore(&ide_lock, flags); 248 spin_unlock_irqrestore(&ide_lock, flags);
265 } else { 249 } else if (!hwif->udma_four) {
266 u8 ata66 = 0; 250 u8 ata66 = 0, mask = hwif->channel ? 0x02 : 0x01;
251
267 pci_read_config_byte(hwif->pci_dev, 0x49, &ata66); 252 pci_read_config_byte(hwif->pci_dev, 0x49, &ata66);
268 if (!(hwif->udma_four)) 253 hwif->udma_four = (ata66 & mask) ? 0 : 1;
269 hwif->udma_four = (ata66&(hwif->channel?0x02:0x01))?0:1;
270 } 254 }
271 255
272 ide_setup_dma(hwif, dmabase, 8); 256 if (!noautodma)
257 hwif->autodma = 1;
258 hwif->drives[0].autodma = hwif->drives[1].autodma = hwif->autodma;
273} 259}
274 260
275static int __devinit init_setup_aec62xx(struct pci_dev *dev, ide_pci_device_t *d) 261static int __devinit init_setup_aec62xx(struct pci_dev *dev, ide_pci_device_t *d)
@@ -296,7 +282,6 @@ static ide_pci_device_t aec62xx_chipsets[] __devinitdata = {
296 .init_setup = init_setup_aec62xx, 282 .init_setup = init_setup_aec62xx,
297 .init_chipset = init_chipset_aec62xx, 283 .init_chipset = init_chipset_aec62xx,
298 .init_hwif = init_hwif_aec62xx, 284 .init_hwif = init_hwif_aec62xx,
299 .init_dma = init_dma_aec62xx,
300 .channels = 2, 285 .channels = 2,
301 .autodma = AUTODMA, 286 .autodma = AUTODMA,
302 .enablebits = {{0x4a,0x02,0x02}, {0x4a,0x04,0x04}}, 287 .enablebits = {{0x4a,0x02,0x02}, {0x4a,0x04,0x04}},
@@ -307,7 +292,6 @@ static ide_pci_device_t aec62xx_chipsets[] __devinitdata = {
307 .init_setup = init_setup_aec62xx, 292 .init_setup = init_setup_aec62xx,
308 .init_chipset = init_chipset_aec62xx, 293 .init_chipset = init_chipset_aec62xx,
309 .init_hwif = init_hwif_aec62xx, 294 .init_hwif = init_hwif_aec62xx,
310 .init_dma = init_dma_aec62xx,
311 .channels = 2, 295 .channels = 2,
312 .autodma = NOAUTODMA, 296 .autodma = NOAUTODMA,
313 .bootable = OFF_BOARD, 297 .bootable = OFF_BOARD,
@@ -317,7 +301,6 @@ static ide_pci_device_t aec62xx_chipsets[] __devinitdata = {
317 .init_setup = init_setup_aec62xx, 301 .init_setup = init_setup_aec62xx,
318 .init_chipset = init_chipset_aec62xx, 302 .init_chipset = init_chipset_aec62xx,
319 .init_hwif = init_hwif_aec62xx, 303 .init_hwif = init_hwif_aec62xx,
320 .init_dma = init_dma_aec62xx,
321 .channels = 2, 304 .channels = 2,
322 .autodma = AUTODMA, 305 .autodma = AUTODMA,
323 .enablebits = {{0x4a,0x02,0x02}, {0x4a,0x04,0x04}}, 306 .enablebits = {{0x4a,0x02,0x02}, {0x4a,0x04,0x04}},
@@ -328,7 +311,6 @@ static ide_pci_device_t aec62xx_chipsets[] __devinitdata = {
328 .init_setup = init_setup_aec6x80, 311 .init_setup = init_setup_aec6x80,
329 .init_chipset = init_chipset_aec62xx, 312 .init_chipset = init_chipset_aec62xx,
330 .init_hwif = init_hwif_aec62xx, 313 .init_hwif = init_hwif_aec62xx,
331 .init_dma = init_dma_aec62xx,
332 .channels = 2, 314 .channels = 2,
333 .autodma = AUTODMA, 315 .autodma = AUTODMA,
334 .bootable = OFF_BOARD, 316 .bootable = OFF_BOARD,
@@ -338,7 +320,6 @@ static ide_pci_device_t aec62xx_chipsets[] __devinitdata = {
338 .init_setup = init_setup_aec6x80, 320 .init_setup = init_setup_aec6x80,
339 .init_chipset = init_chipset_aec62xx, 321 .init_chipset = init_chipset_aec62xx,
340 .init_hwif = init_hwif_aec62xx, 322 .init_hwif = init_hwif_aec62xx,
341 .init_dma = init_dma_aec62xx,
342 .channels = 2, 323 .channels = 2,
343 .autodma = AUTODMA, 324 .autodma = AUTODMA,
344 .enablebits = {{0x4a,0x02,0x02}, {0x4a,0x04,0x04}}, 325 .enablebits = {{0x4a,0x02,0x02}, {0x4a,0x04,0x04}},