diff options
author | Russell King <rmk@dyn-67.arm.linux.org.uk> | 2005-07-28 04:30:20 -0400 |
---|---|---|
committer | Russell King <rmk+kernel@arm.linux.org.uk> | 2005-07-28 04:30:20 -0400 |
commit | 661299d9d0437a0ff72240f3d60016ac3a361a6e (patch) | |
tree | 765512576314fc3612b503f182b9ae4e60fcf849 /include/asm-cris/arch-v10/ide.h | |
parent | 05caac585f8abd6c0113856bc8858e3ef214d8a6 (diff) | |
parent | 41c018b7ecb60b1c2c4d5dee0cd37d32a94c45af (diff) |
Merge with Linus' 2.6 tree
Diffstat (limited to 'include/asm-cris/arch-v10/ide.h')
-rw-r--r-- | include/asm-cris/arch-v10/ide.h | 99 |
1 files changed, 99 insertions, 0 deletions
diff --git a/include/asm-cris/arch-v10/ide.h b/include/asm-cris/arch-v10/ide.h new file mode 100644 index 000000000000..8cf2d7cb22ac --- /dev/null +++ b/include/asm-cris/arch-v10/ide.h | |||
@@ -0,0 +1,99 @@ | |||
1 | /* | ||
2 | * linux/include/asm-cris/ide.h | ||
3 | * | ||
4 | * Copyright (C) 2000, 2001, 2002 Axis Communications AB | ||
5 | * | ||
6 | * Authors: Bjorn Wesen | ||
7 | * | ||
8 | */ | ||
9 | |||
10 | /* | ||
11 | * This file contains the ETRAX 100LX specific IDE code. | ||
12 | */ | ||
13 | |||
14 | #ifndef __ASMCRIS_IDE_H | ||
15 | #define __ASMCRIS_IDE_H | ||
16 | |||
17 | #ifdef __KERNEL__ | ||
18 | |||
19 | #include <asm/arch/svinto.h> | ||
20 | #include <asm/io.h> | ||
21 | #include <asm-generic/ide_iops.h> | ||
22 | |||
23 | |||
24 | /* ETRAX 100 can support 4 IDE busses on the same pins (serialized) */ | ||
25 | |||
26 | #define MAX_HWIFS 4 | ||
27 | |||
28 | extern __inline__ int ide_default_irq(unsigned long base) | ||
29 | { | ||
30 | /* all IDE busses share the same IRQ, number 4. | ||
31 | * this has the side-effect that ide-probe.c will cluster our 4 interfaces | ||
32 | * together in a hwgroup, and will serialize accesses. this is good, because | ||
33 | * we can't access more than one interface at the same time on ETRAX100. | ||
34 | */ | ||
35 | return 4; | ||
36 | } | ||
37 | |||
38 | extern __inline__ unsigned long ide_default_io_base(int index) | ||
39 | { | ||
40 | /* we have no real I/O base address per interface, since all go through the | ||
41 | * same register. but in a bitfield in that register, we have the i/f number. | ||
42 | * so we can use the io_base to remember that bitfield. | ||
43 | */ | ||
44 | static const unsigned long io_bases[MAX_HWIFS] = { | ||
45 | IO_FIELD(R_ATA_CTRL_DATA, sel, 0), | ||
46 | IO_FIELD(R_ATA_CTRL_DATA, sel, 1), | ||
47 | IO_FIELD(R_ATA_CTRL_DATA, sel, 2), | ||
48 | IO_FIELD(R_ATA_CTRL_DATA, sel, 3) | ||
49 | }; | ||
50 | return io_bases[index]; | ||
51 | } | ||
52 | |||
53 | /* this is called once for each interface, to setup the port addresses. data_port is the result | ||
54 | * of the ide_default_io_base call above. ctrl_port will be 0, but that is don't care for us. | ||
55 | */ | ||
56 | |||
57 | extern __inline__ void ide_init_hwif_ports(hw_regs_t *hw, unsigned long data_port, unsigned long ctrl_port, int *irq) | ||
58 | { | ||
59 | int i; | ||
60 | |||
61 | /* fill in ports for ATA addresses 0 to 7 */ | ||
62 | |||
63 | for (i = IDE_DATA_OFFSET; i <= IDE_STATUS_OFFSET; i++) { | ||
64 | hw->io_ports[i] = data_port | | ||
65 | IO_FIELD(R_ATA_CTRL_DATA, addr, i) | | ||
66 | IO_STATE(R_ATA_CTRL_DATA, cs0, active); | ||
67 | } | ||
68 | |||
69 | /* the IDE control register is at ATA address 6, with CS1 active instead of CS0 */ | ||
70 | |||
71 | hw->io_ports[IDE_CONTROL_OFFSET] = data_port | | ||
72 | IO_FIELD(R_ATA_CTRL_DATA, addr, 6) | | ||
73 | IO_STATE(R_ATA_CTRL_DATA, cs1, active); | ||
74 | |||
75 | /* whats this for ? */ | ||
76 | |||
77 | hw->io_ports[IDE_IRQ_OFFSET] = 0; | ||
78 | } | ||
79 | |||
80 | extern __inline__ void ide_init_default_hwifs(void) | ||
81 | { | ||
82 | hw_regs_t hw; | ||
83 | int index; | ||
84 | |||
85 | for(index = 0; index < MAX_HWIFS; index++) { | ||
86 | ide_init_hwif_ports(&hw, ide_default_io_base(index), 0, NULL); | ||
87 | hw.irq = ide_default_irq(ide_default_io_base(index)); | ||
88 | ide_register_hw(&hw, NULL); | ||
89 | } | ||
90 | } | ||
91 | |||
92 | /* some configuration options we don't need */ | ||
93 | |||
94 | #undef SUPPORT_VLB_SYNC | ||
95 | #define SUPPORT_VLB_SYNC 0 | ||
96 | |||
97 | #endif /* __KERNEL__ */ | ||
98 | |||
99 | #endif /* __ASMCRIS_IDE_H */ | ||