aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/ide/legacy/buddha.c
diff options
context:
space:
mode:
authorBartlomiej Zolnierkiewicz <bzolnier@gmail.com>2008-02-05 20:57:50 -0500
committerBartlomiej Zolnierkiewicz <bzolnier@gmail.com>2008-02-05 20:57:50 -0500
commit29dd59755a849cc6475faa6a75f3b804e23a6fc2 (patch)
tree007f73aed935c22438e69cb2d2438b93f249d955 /drivers/ide/legacy/buddha.c
parentf2694b7e3bad75436b47b6840de352f7b7f53feb (diff)
ide: remove ide_setup_ports()
ide-cris.c: * Add cris_setup_ports() helper and use it instead of ide_setup_ports() (fixes random value being set in ->io_ports[IDE_IRQ_OFFSET]). buddha.c: * Add buddha_setup_ports() helper and use it instead of ide_setup_ports(). falconide.c: * Add falconide_setup_ports() helper and use it instead of ide_setup_ports(), also fix return value of falconide_init() while at it. gayle.c: * Add gayle_setup_ports() helper and use it instead of ide_setup_ports(). macide.c: * Add macide_setup_ports() helper and use it instead of ide_setup_ports() (fixes incorrect value being set in ->io_ports[IDE_IRQ_OFFSET]). q40ide.c: * Fix q40_ide_setup_ports() comments. ide.c: * Remove no longer needed ide_setup_ports(). Cc: Mikael Starvik <starvik@axis.com> Cc: Geert Uytterhoeven <geert@linux-m68k.org> Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
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) {