aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/ide/pci/pdc202xx_old.c
diff options
context:
space:
mode:
authorBartlomiej Zolnierkiewicz <bzolnier@gmail.com>2008-04-26 16:25:14 -0400
committerBartlomiej Zolnierkiewicz <bzolnier@gmail.com>2008-04-26 16:25:14 -0400
commitac95beedf8bc97b24f9540d4da9952f07221c023 (patch)
treec29837142c8083b6fcaf1767abcb0a4533676cd1 /drivers/ide/pci/pdc202xx_old.c
parent4a27214d7be31e122db4102166f49ec15958e8e9 (diff)
ide: add struct ide_port_ops (take 2)
* Move hooks for port/host specific methods from ide_hwif_t to 'struct ide_port_ops'. * Add 'const struct ide_port_ops *port_ops' to 'struct ide_port_info' and ide_hwif_t. * Update host drivers and core code accordingly. While at it: * Rename ata66_*() cable detect functions to *_cable_detect() to match the standard naming. (Suggested by Sergei Shtylyov) v2: * Fix build for bast-ide. (Noticed by Andrew Morton) Acked-by: Sergei Shtylyov <sshtylyov@ru.mvista.com> Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
Diffstat (limited to 'drivers/ide/pci/pdc202xx_old.c')
-rw-r--r--drivers/ide/pci/pdc202xx_old.c61
1 files changed, 29 insertions, 32 deletions
diff --git a/drivers/ide/pci/pdc202xx_old.c b/drivers/ide/pci/pdc202xx_old.c
index 150422ec3cf..00563e1bfc7 100644
--- a/drivers/ide/pci/pdc202xx_old.c
+++ b/drivers/ide/pci/pdc202xx_old.c
@@ -115,7 +115,7 @@ static void pdc202xx_set_pio_mode(ide_drive_t *drive, const u8 pio)
115 pdc202xx_set_mode(drive, XFER_PIO_0 + pio); 115 pdc202xx_set_mode(drive, XFER_PIO_0 + pio);
116} 116}
117 117
118static u8 __devinit pdc2026x_old_cable_detect(ide_hwif_t *hwif) 118static u8 __devinit pdc2026x_cable_detect(ide_hwif_t *hwif)
119{ 119{
120 struct pci_dev *dev = to_pci_dev(hwif->dev); 120 struct pci_dev *dev = to_pci_dev(hwif->dev);
121 u16 CIS, mask = hwif->channel ? (1 << 11) : (1 << 10); 121 u16 CIS, mask = hwif->channel ? (1 << 11) : (1 << 10);
@@ -226,26 +226,6 @@ somebody_else:
226 return (dma_stat & 4) == 4; /* return 1 if INTR asserted */ 226 return (dma_stat & 4) == 4; /* return 1 if INTR asserted */
227} 227}
228 228
229static void pdc202xx_dma_lost_irq(ide_drive_t *drive)
230{
231 ide_hwif_t *hwif = HWIF(drive);
232
233 if (hwif->resetproc != NULL)
234 hwif->resetproc(drive);
235
236 ide_dma_lost_irq(drive);
237}
238
239static void pdc202xx_dma_timeout(ide_drive_t *drive)
240{
241 ide_hwif_t *hwif = HWIF(drive);
242
243 if (hwif->resetproc != NULL)
244 hwif->resetproc(drive);
245
246 ide_dma_timeout(drive);
247}
248
249static void pdc202xx_reset_host (ide_hwif_t *hwif) 229static void pdc202xx_reset_host (ide_hwif_t *hwif)
250{ 230{
251 unsigned long high_16 = hwif->extra_base - 16; 231 unsigned long high_16 = hwif->extra_base - 16;
@@ -271,6 +251,18 @@ static void pdc202xx_reset (ide_drive_t *drive)
271 ide_set_max_pio(drive); 251 ide_set_max_pio(drive);
272} 252}
273 253
254static void pdc202xx_dma_lost_irq(ide_drive_t *drive)
255{
256 pdc202xx_reset(drive);
257 ide_dma_lost_irq(drive);
258}
259
260static void pdc202xx_dma_timeout(ide_drive_t *drive)
261{
262 pdc202xx_reset(drive);
263 ide_dma_timeout(drive);
264}
265
274static unsigned int __devinit init_chipset_pdc202xx(struct pci_dev *dev, 266static unsigned int __devinit init_chipset_pdc202xx(struct pci_dev *dev,
275 const char *name) 267 const char *name)
276{ 268{
@@ -281,17 +273,6 @@ static void __devinit init_hwif_pdc202xx(ide_hwif_t *hwif)
281{ 273{
282 struct pci_dev *dev = to_pci_dev(hwif->dev); 274 struct pci_dev *dev = to_pci_dev(hwif->dev);
283 275
284 hwif->set_pio_mode = &pdc202xx_set_pio_mode;
285 hwif->set_dma_mode = &pdc202xx_set_mode;
286
287 hwif->quirkproc = &pdc202xx_quirkproc;
288
289 if (dev->device != PCI_DEVICE_ID_PROMISE_20246) {
290 hwif->resetproc = &pdc202xx_reset;
291
292 hwif->cable_detect = pdc2026x_old_cable_detect;
293 }
294
295 if (hwif->dma_base == 0) 276 if (hwif->dma_base == 0)
296 return; 277 return;
297 278
@@ -357,6 +338,20 @@ static void __devinit pdc202ata4_fixup_irq(struct pci_dev *dev,
357 IDE_HFLAG_ABUSE_SET_DMA_MODE | \ 338 IDE_HFLAG_ABUSE_SET_DMA_MODE | \
358 IDE_HFLAG_OFF_BOARD) 339 IDE_HFLAG_OFF_BOARD)
359 340
341static const struct ide_port_ops pdc20246_port_ops = {
342 .set_pio_mode = pdc202xx_set_pio_mode,
343 .set_dma_mode = pdc202xx_set_mode,
344 .quirkproc = pdc202xx_quirkproc,
345};
346
347static const struct ide_port_ops pdc2026x_port_ops = {
348 .set_pio_mode = pdc202xx_set_pio_mode,
349 .set_dma_mode = pdc202xx_set_mode,
350 .quirkproc = pdc202xx_quirkproc,
351 .resetproc = pdc202xx_reset,
352 .cable_detect = pdc2026x_cable_detect,
353};
354
360#define DECLARE_PDC2026X_DEV(name_str, udma, extra_flags) \ 355#define DECLARE_PDC2026X_DEV(name_str, udma, extra_flags) \
361 { \ 356 { \
362 .name = name_str, \ 357 .name = name_str, \
@@ -364,6 +359,7 @@ static void __devinit pdc202ata4_fixup_irq(struct pci_dev *dev,
364 .init_hwif = init_hwif_pdc202xx, \ 359 .init_hwif = init_hwif_pdc202xx, \
365 .init_dma = init_dma_pdc202xx, \ 360 .init_dma = init_dma_pdc202xx, \
366 .extra = 48, \ 361 .extra = 48, \
362 .port_ops = &pdc2026x_port_ops, \
367 .host_flags = IDE_HFLAGS_PDC202XX | extra_flags, \ 363 .host_flags = IDE_HFLAGS_PDC202XX | extra_flags, \
368 .pio_mask = ATA_PIO4, \ 364 .pio_mask = ATA_PIO4, \
369 .mwdma_mask = ATA_MWDMA2, \ 365 .mwdma_mask = ATA_MWDMA2, \
@@ -376,6 +372,7 @@ static const struct ide_port_info pdc202xx_chipsets[] __devinitdata = {
376 .init_chipset = init_chipset_pdc202xx, 372 .init_chipset = init_chipset_pdc202xx,
377 .init_hwif = init_hwif_pdc202xx, 373 .init_hwif = init_hwif_pdc202xx,
378 .init_dma = init_dma_pdc202xx, 374 .init_dma = init_dma_pdc202xx,
375 .port_ops = &pdc20246_port_ops,
379 .extra = 16, 376 .extra = 16,
380 .host_flags = IDE_HFLAGS_PDC202XX, 377 .host_flags = IDE_HFLAGS_PDC202XX,
381 .pio_mask = ATA_PIO4, 378 .pio_mask = ATA_PIO4,