aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/ide/ppc/pmac.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/ide/ppc/pmac.c')
-rw-r--r--drivers/ide/ppc/pmac.c21
1 files changed, 8 insertions, 13 deletions
diff --git a/drivers/ide/ppc/pmac.c b/drivers/ide/ppc/pmac.c
index dcb2c466bb97..93fb9067c043 100644
--- a/drivers/ide/ppc/pmac.c
+++ b/drivers/ide/ppc/pmac.c
@@ -5,7 +5,7 @@
5 * for doing DMA. 5 * for doing DMA.
6 * 6 *
7 * Copyright (C) 1998-2003 Paul Mackerras & Ben. Herrenschmidt 7 * Copyright (C) 1998-2003 Paul Mackerras & Ben. Herrenschmidt
8 * Copyright (C) 2007 Bartlomiej Zolnierkiewicz 8 * Copyright (C) 2007-2008 Bartlomiej Zolnierkiewicz
9 * 9 *
10 * This program is free software; you can redistribute it and/or 10 * This program is free software; you can redistribute it and/or
11 * modify it under the terms of the GNU General Public License 11 * modify it under the terms of the GNU General Public License
@@ -48,8 +48,6 @@
48#include <asm/mediabay.h> 48#include <asm/mediabay.h>
49#endif 49#endif
50 50
51#include "../ide-timing.h"
52
53#undef IDE_PMAC_DEBUG 51#undef IDE_PMAC_DEBUG
54 52
55#define DMA_WAIT_TIMEOUT 50 53#define DMA_WAIT_TIMEOUT 50
@@ -495,6 +493,7 @@ static void pmac_outbsync(ide_hwif_t *hwif, u8 value, unsigned long port)
495static void 493static void
496pmac_ide_set_pio_mode(ide_drive_t *drive, const u8 pio) 494pmac_ide_set_pio_mode(ide_drive_t *drive, const u8 pio)
497{ 495{
496 struct ide_timing *tim = ide_timing_find_mode(XFER_PIO_0 + pio);
498 u32 *timings, t; 497 u32 *timings, t;
499 unsigned accessTicks, recTicks; 498 unsigned accessTicks, recTicks;
500 unsigned accessTime, recTime; 499 unsigned accessTime, recTime;
@@ -526,10 +525,9 @@ pmac_ide_set_pio_mode(ide_drive_t *drive, const u8 pio)
526 } 525 }
527 case controller_kl_ata4: 526 case controller_kl_ata4:
528 /* 66Mhz cell */ 527 /* 66Mhz cell */
529 recTime = cycle_time - ide_pio_timings[pio].active_time 528 recTime = cycle_time - tim->active - tim->setup;
530 - ide_pio_timings[pio].setup_time;
531 recTime = max(recTime, 150U); 529 recTime = max(recTime, 150U);
532 accessTime = ide_pio_timings[pio].active_time; 530 accessTime = tim->active;
533 accessTime = max(accessTime, 150U); 531 accessTime = max(accessTime, 150U);
534 accessTicks = SYSCLK_TICKS_66(accessTime); 532 accessTicks = SYSCLK_TICKS_66(accessTime);
535 accessTicks = min(accessTicks, 0x1fU); 533 accessTicks = min(accessTicks, 0x1fU);
@@ -542,10 +540,9 @@ pmac_ide_set_pio_mode(ide_drive_t *drive, const u8 pio)
542 default: { 540 default: {
543 /* 33Mhz cell */ 541 /* 33Mhz cell */
544 int ebit = 0; 542 int ebit = 0;
545 recTime = cycle_time - ide_pio_timings[pio].active_time 543 recTime = cycle_time - tim->active - tim->setup;
546 - ide_pio_timings[pio].setup_time;
547 recTime = max(recTime, 150U); 544 recTime = max(recTime, 150U);
548 accessTime = ide_pio_timings[pio].active_time; 545 accessTime = tim->active;
549 accessTime = max(accessTime, 150U); 546 accessTime = max(accessTime, 150U);
550 accessTicks = SYSCLK_TICKS(accessTime); 547 accessTicks = SYSCLK_TICKS(accessTime);
551 accessTicks = min(accessTicks, 0x1fU); 548 accessTicks = min(accessTicks, 0x1fU);
@@ -1151,8 +1148,6 @@ pmac_ide_macio_attach(struct macio_dev *mdev, const struct of_device_id *match)
1151 base = ioremap(macio_resource_start(mdev, 0), 0x400); 1148 base = ioremap(macio_resource_start(mdev, 0), 0x400);
1152 regbase = (unsigned long) base; 1149 regbase = (unsigned long) base;
1153 1150
1154 hwif->dev = &mdev->bus->pdev->dev;
1155
1156 pmif->mdev = mdev; 1151 pmif->mdev = mdev;
1157 pmif->node = mdev->ofdev.node; 1152 pmif->node = mdev->ofdev.node;
1158 pmif->regbase = regbase; 1153 pmif->regbase = regbase;
@@ -1174,7 +1169,8 @@ pmac_ide_macio_attach(struct macio_dev *mdev, const struct of_device_id *match)
1174 memset(&hw, 0, sizeof(hw)); 1169 memset(&hw, 0, sizeof(hw));
1175 pmac_ide_init_ports(&hw, pmif->regbase); 1170 pmac_ide_init_ports(&hw, pmif->regbase);
1176 hw.irq = irq; 1171 hw.irq = irq;
1177 hw.dev = &mdev->ofdev.dev; 1172 hw.dev = &mdev->bus->pdev->dev;
1173 hw.parent = &mdev->ofdev.dev;
1178 1174
1179 rc = pmac_ide_setup_device(pmif, hwif, &hw); 1175 rc = pmac_ide_setup_device(pmif, hwif, &hw);
1180 if (rc != 0) { 1176 if (rc != 0) {
@@ -1274,7 +1270,6 @@ pmac_ide_pci_attach(struct pci_dev *pdev, const struct pci_device_id *id)
1274 goto out_free_pmif; 1270 goto out_free_pmif;
1275 } 1271 }
1276 1272
1277 hwif->dev = &pdev->dev;
1278 pmif->mdev = NULL; 1273 pmif->mdev = NULL;
1279 pmif->node = np; 1274 pmif->node = np;
1280 1275