aboutsummaryrefslogtreecommitdiffstats
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
commitb1d19db4e770a752ec032971388fa69a73c84919 (patch)
tree5e4f9bf005b2ede5dbf658b10d42c835511c0ada
parent83a6d4ab3b09c0c1921b657bbaac5ada3c9c3623 (diff)
aec62xx: rework init_setup_aec6x80()
Rework init_setup_aec6x80() so that it won't rewrite the constant name strings anymore -- in order to do this: - in aec62xx_init_one(), pass a local copy of 'struct pci_device_id' down the call chain; - change the names for in aec62xx_chipsets[] to default to AEC-6280[R]; - override the 'name' field in init_setup_aec6x80() only if bit 4 of the DMA status register is set. While at it, also change the 'udma_mask' field for AEC-6x80R chips in this function and remove the code doing the same from the init_hwif() method... Signed-off-by: Sergei Shtylyov <sshtylyov@ru.mvista.com> Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
-rw-r--r--drivers/ide/pci/aec62xx.c35
1 files changed, 13 insertions, 22 deletions
diff --git a/drivers/ide/pci/aec62xx.c b/drivers/ide/pci/aec62xx.c
index bed32d0eaa37..7067df2590c3 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.21 Apr 21, 2007 2 * linux/drivers/ide/pci/aec62xx.c Version 0.22 Apr 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>
@@ -239,14 +239,6 @@ static void __devinit init_hwif_aec62xx(ide_hwif_t *hwif)
239 } 239 }
240 240
241 hwif->ultra_mask = hwif->cds->udma_mask; 241 hwif->ultra_mask = hwif->cds->udma_mask;
242
243 /* atp865 and atp865r */
244 if (hwif->ultra_mask == 0x3f) {
245 /* check bit 0x10 of DMA status register */
246 if (inb(pci_resource_start(dev, 4) + 2) & 0x10)
247 hwif->ultra_mask = 0x7f; /* udma0-6 */
248 }
249
250 hwif->mwdma_mask = 0x07; 242 hwif->mwdma_mask = 0x07;
251 243
252 hwif->ide_dma_check = &aec62xx_config_drive_xfer_rate; 244 hwif->ide_dma_check = &aec62xx_config_drive_xfer_rate;
@@ -287,16 +279,12 @@ static int __devinit init_setup_aec62xx(struct pci_dev *dev, ide_pci_device_t *d
287 279
288static int __devinit init_setup_aec6x80(struct pci_dev *dev, ide_pci_device_t *d) 280static int __devinit init_setup_aec6x80(struct pci_dev *dev, ide_pci_device_t *d)
289{ 281{
290 unsigned long bar4reg = pci_resource_start(dev, 4); 282 unsigned long dma_base = pci_resource_start(dev, 4);
291 283
292 if (inb(bar4reg+2) & 0x10) { 284 if (inb(dma_base + 2) & 0x10) {
293 strcpy(d->name, "AEC6880"); 285 d->name = (dev->device == PCI_DEVICE_ID_ARTOP_ATP865R) ?
294 if (dev->device == PCI_DEVICE_ID_ARTOP_ATP865R) 286 "AEC6880R" : "AEC6880";
295 strcpy(d->name, "AEC6880R"); 287 d->udma_mask = 0x7f; /* udma0-6 */
296 } else {
297 strcpy(d->name, "AEC6280");
298 if (dev->device == PCI_DEVICE_ID_ARTOP_ATP865R)
299 strcpy(d->name, "AEC6280R");
300 } 288 }
301 289
302 return ide_setup_pci_device(dev, d); 290 return ide_setup_pci_device(dev, d);
@@ -336,7 +324,7 @@ static ide_pci_device_t aec62xx_chipsets[] __devinitdata = {
336 .bootable = NEVER_BOARD, 324 .bootable = NEVER_BOARD,
337 .udma_mask = 0x1f, /* udma0-4 */ 325 .udma_mask = 0x1f, /* udma0-4 */
338 },{ /* 3 */ 326 },{ /* 3 */
339 .name = "AEC6X80", 327 .name = "AEC6280",
340 .init_setup = init_setup_aec6x80, 328 .init_setup = init_setup_aec6x80,
341 .init_chipset = init_chipset_aec62xx, 329 .init_chipset = init_chipset_aec62xx,
342 .init_hwif = init_hwif_aec62xx, 330 .init_hwif = init_hwif_aec62xx,
@@ -346,7 +334,7 @@ static ide_pci_device_t aec62xx_chipsets[] __devinitdata = {
346 .bootable = OFF_BOARD, 334 .bootable = OFF_BOARD,
347 .udma_mask = 0x3f, /* udma0-5 */ 335 .udma_mask = 0x3f, /* udma0-5 */
348 },{ /* 4 */ 336 },{ /* 4 */
349 .name = "AEC6X80R", 337 .name = "AEC6280R",
350 .init_setup = init_setup_aec6x80, 338 .init_setup = init_setup_aec6x80,
351 .init_chipset = init_chipset_aec62xx, 339 .init_chipset = init_chipset_aec62xx,
352 .init_hwif = init_hwif_aec62xx, 340 .init_hwif = init_hwif_aec62xx,
@@ -366,13 +354,16 @@ static ide_pci_device_t aec62xx_chipsets[] __devinitdata = {
366 * 354 *
367 * Called when the PCI registration layer (or the IDE initialization) 355 * Called when the PCI registration layer (or the IDE initialization)
368 * finds a device matching our IDE device tables. 356 * finds a device matching our IDE device tables.
357 *
358 * NOTE: since we're going to modify the 'name' field for AEC-6[26]80[R]
359 * chips, pass a local copy of 'struct pci_device_id' down the call chain.
369 */ 360 */
370 361
371static int __devinit aec62xx_init_one(struct pci_dev *dev, const struct pci_device_id *id) 362static int __devinit aec62xx_init_one(struct pci_dev *dev, const struct pci_device_id *id)
372{ 363{
373 ide_pci_device_t *d = &aec62xx_chipsets[id->driver_data]; 364 ide_pci_device_t d = aec62xx_chipsets[id->driver_data];
374 365
375 return d->init_setup(dev, d); 366 return d.init_setup(dev, &d);
376} 367}
377 368
378static struct pci_device_id aec62xx_pci_tbl[] = { 369static struct pci_device_id aec62xx_pci_tbl[] = {