aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/ide/legacy/buddha.c
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@woody.linux-foundation.org>2008-02-05 22:06:25 -0500
committerLinus Torvalds <torvalds@woody.linux-foundation.org>2008-02-05 22:06:25 -0500
commit551e4fb2465b87de9d4aa1669b27d624435443bb (patch)
tree316a5816b833a7536071a4ee0913a9b51b4faff8 /drivers/ide/legacy/buddha.c
parentb297d520b9af536d5580ac505dd316be4cf5560c (diff)
parentdfe799364e7a500389559e1dcd331d995cdc18ea (diff)
Merge git://git.kernel.org/pub/scm/linux/kernel/git/bart/ide-2.6
* git://git.kernel.org/pub/scm/linux/kernel/git/bart/ide-2.6: (29 commits) ide-tape: bump minor driver version ide-tape: cleanup the remaining codestyle issues ide-tape: fix syntax error in idetape_identify_device() ide-tape: remove leftover OnStream support warning ide-tape: collect module-related macro calls at the end ide-tape: include proper headers ide-tape: remove unused "length" arg from idetape_create_read_buffer_cmd() ide-tape: remove struct idetape_id_gcw ide-tape: cleanup and fix comments ide-tape: shorten some function names ide-tape: remove idetape_increase_max_pipeline_stages() ide-tape: struct idetape_tape_t: shorten member names v2 ide-tape: struct idetape_tape_t: remove unused members ide-tape: remove typedef idetape_chrdev_direction_t ide-tape: simplify code branching in the interrupt handler ide-tape: remove unreachable code chunk ide-tape: remove struct idetape_read_position_result_t ide-tape: refactor the debug logging facility ide: add ide_read_error() inline helper ide: add ide_read_[alt]status() inline helpers ...
Diffstat (limited to 'drivers/ide/legacy/buddha.c')
-rw-r--r--drivers/ide/legacy/buddha.c72
1 files changed, 37 insertions, 35 deletions
diff --git a/drivers/ide/legacy/buddha.c b/drivers/ide/legacy/buddha.c
index 8bdb79da17e8..50ffa871d5e9 100644
--- a/drivers/ide/legacy/buddha.c
+++ b/drivers/ide/legacy/buddha.c
@@ -56,31 +56,11 @@ static u_int xsurf_bases[XSURF_NUM_HWIFS] __initdata = {
56 XSURF_BASE1, XSURF_BASE2 56 XSURF_BASE1, XSURF_BASE2
57}; 57};
58 58
59
60 /* 59 /*
61 * Offsets from one of the above bases 60 * Offsets from one of the above bases
62 */ 61 */
63 62
64#define BUDDHA_DATA 0x00
65#define BUDDHA_ERROR 0x06 /* see err-bits */
66#define BUDDHA_NSECTOR 0x0a /* nr of sectors to read/write */
67#define BUDDHA_SECTOR 0x0e /* starting sector */
68#define BUDDHA_LCYL 0x12 /* starting cylinder */
69#define BUDDHA_HCYL 0x16 /* high byte of starting cyl */
70#define BUDDHA_SELECT 0x1a /* 101dhhhh , d=drive, hhhh=head */
71#define BUDDHA_STATUS 0x1e /* see status-bits */
72#define BUDDHA_CONTROL 0x11a 63#define BUDDHA_CONTROL 0x11a
73#define XSURF_CONTROL -1 /* X-Surf has no CS1* (Control/AltStat) */
74
75static int buddha_offsets[IDE_NR_PORTS] __initdata = {
76 BUDDHA_DATA, BUDDHA_ERROR, BUDDHA_NSECTOR, BUDDHA_SECTOR, BUDDHA_LCYL,
77 BUDDHA_HCYL, BUDDHA_SELECT, BUDDHA_STATUS, BUDDHA_CONTROL, -1
78};
79
80static int xsurf_offsets[IDE_NR_PORTS] __initdata = {
81 BUDDHA_DATA, BUDDHA_ERROR, BUDDHA_NSECTOR, BUDDHA_SECTOR, BUDDHA_LCYL,
82 BUDDHA_HCYL, BUDDHA_SELECT, BUDDHA_STATUS, XSURF_CONTROL, -1
83};
84 64
85 /* 65 /*
86 * Other registers 66 * Other registers
@@ -140,6 +120,26 @@ static int xsurf_ack_intr(ide_hwif_t *hwif)
140 return 1; 120 return 1;
141} 121}
142 122
123static void __init buddha_setup_ports(hw_regs_t *hw, unsigned long base,
124 unsigned long ctl, unsigned long irq_port,
125 ide_ack_intr_t *ack_intr)
126{
127 int i;
128
129 memset(hw, 0, sizeof(*hw));
130
131 hw->io_ports[IDE_DATA_OFFSET] = base;
132
133 for (i = 1; i < 8; i++)
134 hw->io_ports[i] = base + 2 + i * 4;
135
136 hw->io_ports[IDE_CONTROL_OFFSET] = ctl;
137 hw->io_ports[IDE_IRQ_OFFSET] = irq_port;
138
139 hw->irq = IRQ_AMIGA_PORTS;
140 hw->ack_intr = ack_intr;
141}
142
143 /* 143 /*
144 * Probe for a Buddha or Catweasel IDE interface 144 * Probe for a Buddha or Catweasel IDE interface
145 */ 145 */
@@ -202,22 +202,24 @@ fail_base2:
202 printk(KERN_INFO "ide: %s IDE controller\n", 202 printk(KERN_INFO "ide: %s IDE controller\n",
203 buddha_board_name[type]); 203 buddha_board_name[type]);
204 204
205 for(i=0;i<buddha_num_hwifs;i++) { 205 for (i = 0; i < buddha_num_hwifs; i++) {
206 if(type != BOARD_XSURF) { 206 unsigned long base, ctl, irq_port;
207 ide_setup_ports(&hw, (buddha_board+buddha_bases[i]), 207 ide_ack_intr_t *ack_intr;
208 buddha_offsets, 0, 208
209 (buddha_board+buddha_irqports[i]), 209 if (type != BOARD_XSURF) {
210 buddha_ack_intr, 210 base = buddha_board + buddha_bases[i];
211// budda_iops, 211 ctl = base + BUDDHA_CONTROL;
212 IRQ_AMIGA_PORTS); 212 irq_port = buddha_board + buddha_irqports[i];
213 ack_intr = buddha_ack_intr;
213 } else { 214 } else {
214 ide_setup_ports(&hw, (buddha_board+xsurf_bases[i]), 215 base = buddha_board + xsurf_bases[i];
215 xsurf_offsets, 0, 216 /* X-Surf has no CS1* (Control/AltStat) */
216 (buddha_board+xsurf_irqports[i]), 217 ctl = 0;
217 xsurf_ack_intr, 218 irq_port = buddha_board + xsurf_irqports[i];
218// xsurf_iops, 219 ack_intr = xsurf_ack_intr;
219 IRQ_AMIGA_PORTS); 220 }
220 } 221
222 buddha_setup_ports(&hw, base, ctl, irq_port, ack_intr);
221 223
222 hwif = ide_find_port(hw.io_ports[IDE_DATA_OFFSET]); 224 hwif = ide_find_port(hw.io_ports[IDE_DATA_OFFSET]);
223 if (hwif) { 225 if (hwif) {