Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1 | /* |
Stephen Rothwell | b354cab | 2005-11-08 12:20:34 +1100 | [diff] [blame] | 2 | * Copyright (C) 1994-1996 Linus Torvalds & authors |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3 | * |
Stephen Rothwell | b354cab | 2005-11-08 12:20:34 +1100 | [diff] [blame] | 4 | * This file contains the powerpc architecture specific IDE code. |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5 | */ |
Stephen Rothwell | b354cab | 2005-11-08 12:20:34 +1100 | [diff] [blame] | 6 | #ifndef _ASM_POWERPC_IDE_H |
| 7 | #define _ASM_POWERPC_IDE_H |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 8 | |
| 9 | #ifdef __KERNEL__ |
| 10 | |
Stephen Rothwell | b354cab | 2005-11-08 12:20:34 +1100 | [diff] [blame] | 11 | #ifndef __powerpc64__ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 12 | #include <linux/sched.h> |
| 13 | #include <asm/mpc8xx.h> |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 14 | #endif |
Stephen Rothwell | 73ea9e1 | 2006-09-19 17:30:20 +1000 | [diff] [blame] | 15 | #include <asm/io.h> |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 16 | |
Stephen Rothwell | b354cab | 2005-11-08 12:20:34 +1100 | [diff] [blame] | 17 | #ifndef MAX_HWIFS |
| 18 | #ifdef __powerpc64__ |
| 19 | #define MAX_HWIFS 10 |
| 20 | #else |
| 21 | #define MAX_HWIFS 8 |
| 22 | #endif |
| 23 | #endif |
| 24 | |
Benjamin Herrenschmidt | 4cb3cee | 2006-11-11 17:25:10 +1100 | [diff] [blame] | 25 | #define __ide_mm_insw(p, a, c) readsw((void __iomem *)(p), (a), (c)) |
| 26 | #define __ide_mm_insl(p, a, c) readsl((void __iomem *)(p), (a), (c)) |
| 27 | #define __ide_mm_outsw(p, a, c) writesw((void __iomem *)(p), (a), (c)) |
| 28 | #define __ide_mm_outsl(p, a, c) writesl((void __iomem *)(p), (a), (c)) |
Stephen Rothwell | 73ea9e1 | 2006-09-19 17:30:20 +1000 | [diff] [blame] | 29 | |
Stephen Rothwell | b354cab | 2005-11-08 12:20:34 +1100 | [diff] [blame] | 30 | #ifndef __powerpc64__ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 31 | #include <linux/hdreg.h> |
| 32 | #include <linux/ioport.h> |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 33 | |
| 34 | struct ide_machdep_calls { |
| 35 | int (*default_irq)(unsigned long base); |
| 36 | unsigned long (*default_io_base)(int index); |
| 37 | void (*ide_init_hwif)(hw_regs_t *hw, |
| 38 | unsigned long data_port, |
| 39 | unsigned long ctrl_port, |
| 40 | int *irq); |
| 41 | }; |
| 42 | |
| 43 | extern struct ide_machdep_calls ppc_ide_md; |
| 44 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 45 | #define IDE_ARCH_OBSOLETE_DEFAULTS |
| 46 | |
| 47 | static __inline__ int ide_default_irq(unsigned long base) |
| 48 | { |
| 49 | if (ppc_ide_md.default_irq) |
| 50 | return ppc_ide_md.default_irq(base); |
| 51 | return 0; |
| 52 | } |
| 53 | |
| 54 | static __inline__ unsigned long ide_default_io_base(int index) |
| 55 | { |
| 56 | if (ppc_ide_md.default_io_base) |
| 57 | return ppc_ide_md.default_io_base(index); |
| 58 | return 0; |
| 59 | } |
| 60 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 61 | #ifdef CONFIG_PCI |
| 62 | #define ide_init_default_irq(base) (0) |
| 63 | #else |
| 64 | #define ide_init_default_irq(base) ide_default_irq(base) |
| 65 | #endif |
| 66 | |
Adrian Bunk | e6b6e3f | 2007-08-27 23:29:53 +0200 | [diff] [blame] | 67 | #ifdef CONFIG_BLK_DEV_MPC8xx_IDE |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 68 | #define IDE_ARCH_ACK_INTR 1 |
Bartlomiej Zolnierkiewicz | 18e181f | 2007-10-20 00:32:32 +0200 | [diff] [blame] | 69 | #define ide_ack_intr(hwif) ((hwif)->ack_intr ? (hwif)->ack_intr(hwif) : 1) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 70 | #endif |
| 71 | |
Stephen Rothwell | b354cab | 2005-11-08 12:20:34 +1100 | [diff] [blame] | 72 | #endif /* __powerpc64__ */ |
| 73 | |
Stephen Rothwell | b354cab | 2005-11-08 12:20:34 +1100 | [diff] [blame] | 74 | #define ide_default_io_ctl(base) ((base) + 0x206) /* obsolete */ |
| 75 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 76 | #endif /* __KERNEL__ */ |
| 77 | |
Stephen Rothwell | b354cab | 2005-11-08 12:20:34 +1100 | [diff] [blame] | 78 | #endif /* _ASM_POWERPC_IDE_H */ |