blob: 60a8fc429970bcbd27c8b931716d6546e7e6be25 [file] [log] [blame]
Linus Torvalds1da177e2005-04-16 15:20:36 -07001/*
Stephen Rothwellb354cab2005-11-08 12:20:34 +11002 * Copyright (C) 1994-1996 Linus Torvalds & authors
Linus Torvalds1da177e2005-04-16 15:20:36 -07003 *
Stephen Rothwellb354cab2005-11-08 12:20:34 +11004 * This file contains the powerpc architecture specific IDE code.
Linus Torvalds1da177e2005-04-16 15:20:36 -07005 */
Stephen Rothwellb354cab2005-11-08 12:20:34 +11006#ifndef _ASM_POWERPC_IDE_H
7#define _ASM_POWERPC_IDE_H
Linus Torvalds1da177e2005-04-16 15:20:36 -07008
9#ifdef __KERNEL__
10
Stephen Rothwellb354cab2005-11-08 12:20:34 +110011#ifndef __powerpc64__
Linus Torvalds1da177e2005-04-16 15:20:36 -070012#include <linux/sched.h>
13#include <asm/mpc8xx.h>
Linus Torvalds1da177e2005-04-16 15:20:36 -070014#endif
Stephen Rothwell73ea9e12006-09-19 17:30:20 +100015#include <asm/io.h>
Linus Torvalds1da177e2005-04-16 15:20:36 -070016
Stephen Rothwellb354cab2005-11-08 12:20:34 +110017#ifndef MAX_HWIFS
18#ifdef __powerpc64__
19#define MAX_HWIFS 10
20#else
21#define MAX_HWIFS 8
22#endif
23#endif
24
Benjamin Herrenschmidt4cb3cee2006-11-11 17:25:10 +110025#ifdef __powerpc64__
26#define __ide_mm_insw(p, a, c) readsw((void __iomem *)(p), (a), (c))
27#define __ide_mm_insl(p, a, c) readsl((void __iomem *)(p), (a), (c))
28#define __ide_mm_outsw(p, a, c) writesw((void __iomem *)(p), (a), (c))
29#define __ide_mm_outsl(p, a, c) writesl((void __iomem *)(p), (a), (c))
30#else
Stephen Rothwell73ea9e12006-09-19 17:30:20 +100031#define __ide_mm_insw(p, a, c) _insw_ns((volatile u16 __iomem *)(p), (a), (c))
32#define __ide_mm_insl(p, a, c) _insl_ns((volatile u32 __iomem *)(p), (a), (c))
33#define __ide_mm_outsw(p, a, c) _outsw_ns((volatile u16 __iomem *)(p), (a), (c))
34#define __ide_mm_outsl(p, a, c) _outsl_ns((volatile u32 __iomem *)(p), (a), (c))
Benjamin Herrenschmidt4cb3cee2006-11-11 17:25:10 +110035#endif
Stephen Rothwell73ea9e12006-09-19 17:30:20 +100036
Stephen Rothwellb354cab2005-11-08 12:20:34 +110037#ifndef __powerpc64__
Linus Torvalds1da177e2005-04-16 15:20:36 -070038#include <linux/hdreg.h>
39#include <linux/ioport.h>
Linus Torvalds1da177e2005-04-16 15:20:36 -070040
41struct ide_machdep_calls {
42 int (*default_irq)(unsigned long base);
43 unsigned long (*default_io_base)(int index);
44 void (*ide_init_hwif)(hw_regs_t *hw,
45 unsigned long data_port,
46 unsigned long ctrl_port,
47 int *irq);
48};
49
50extern struct ide_machdep_calls ppc_ide_md;
51
52#undef SUPPORT_SLOW_DATA_PORTS
53#define SUPPORT_SLOW_DATA_PORTS 0
54
55#define IDE_ARCH_OBSOLETE_DEFAULTS
56
57static __inline__ int ide_default_irq(unsigned long base)
58{
59 if (ppc_ide_md.default_irq)
60 return ppc_ide_md.default_irq(base);
61 return 0;
62}
63
64static __inline__ unsigned long ide_default_io_base(int index)
65{
66 if (ppc_ide_md.default_io_base)
67 return ppc_ide_md.default_io_base(index);
68 return 0;
69}
70
Linus Torvalds1da177e2005-04-16 15:20:36 -070071#ifdef CONFIG_PCI
72#define ide_init_default_irq(base) (0)
73#else
74#define ide_init_default_irq(base) ide_default_irq(base)
75#endif
76
77#if (defined CONFIG_APUS || defined CONFIG_BLK_DEV_MPC8xx_IDE )
78#define IDE_ARCH_ACK_INTR 1
79#define ide_ack_intr(hwif) (hwif->hw.ack_intr ? hwif->hw.ack_intr(hwif) : 1)
80#endif
81
Stephen Rothwellb354cab2005-11-08 12:20:34 +110082#endif /* __powerpc64__ */
83
84#define IDE_ARCH_OBSOLETE_INIT
85#define ide_default_io_ctl(base) ((base) + 0x206) /* obsolete */
86
Linus Torvalds1da177e2005-04-16 15:20:36 -070087#endif /* __KERNEL__ */
88
Stephen Rothwellb354cab2005-11-08 12:20:34 +110089#endif /* _ASM_POWERPC_IDE_H */