aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/ide/legacy
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
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')
-rw-r--r--drivers/ide/legacy/buddha.c72
-rw-r--r--drivers/ide/legacy/falconide.c42
-rw-r--r--drivers/ide/legacy/gayle.c39
-rw-r--r--drivers/ide/legacy/macide.c57
-rw-r--r--drivers/ide/legacy/q40ide.c9
5 files changed, 111 insertions, 108 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) {
diff --git a/drivers/ide/legacy/falconide.c b/drivers/ide/legacy/falconide.c
index 85b69a82825f..f044048903b3 100644
--- a/drivers/ide/legacy/falconide.c
+++ b/drivers/ide/legacy/falconide.c
@@ -33,22 +33,8 @@
33 * Offsets from the above base 33 * Offsets from the above base
34 */ 34 */
35 35
36#define ATA_HD_DATA 0x00
37#define ATA_HD_ERROR 0x05 /* see err-bits */
38#define ATA_HD_NSECTOR 0x09 /* nr of sectors to read/write */
39#define ATA_HD_SECTOR 0x0d /* starting sector */
40#define ATA_HD_LCYL 0x11 /* starting cylinder */
41#define ATA_HD_HCYL 0x15 /* high byte of starting cyl */
42#define ATA_HD_SELECT 0x19 /* 101dhhhh , d=drive, hhhh=head */
43#define ATA_HD_STATUS 0x1d /* see status-bits */
44#define ATA_HD_CONTROL 0x39 36#define ATA_HD_CONTROL 0x39
45 37
46static int falconide_offsets[IDE_NR_PORTS] __initdata = {
47 ATA_HD_DATA, ATA_HD_ERROR, ATA_HD_NSECTOR, ATA_HD_SECTOR, ATA_HD_LCYL,
48 ATA_HD_HCYL, ATA_HD_SELECT, ATA_HD_STATUS, ATA_HD_CONTROL, -1
49};
50
51
52 /* 38 /*
53 * falconide_intr_lock is used to obtain access to the IDE interrupt, 39 * falconide_intr_lock is used to obtain access to the IDE interrupt,
54 * which is shared between several drivers. 40 * which is shared between several drivers.
@@ -57,6 +43,22 @@ static int falconide_offsets[IDE_NR_PORTS] __initdata = {
57int falconide_intr_lock; 43int falconide_intr_lock;
58EXPORT_SYMBOL(falconide_intr_lock); 44EXPORT_SYMBOL(falconide_intr_lock);
59 45
46static void __init falconide_setup_ports(hw_regs_t *hw)
47{
48 int i;
49
50 memset(hw, 0, sizeof(*hw));
51
52 hw->io_ports[IDE_DATA_OFFSET] = ATA_HD_BASE;
53
54 for (i = 1; i < 8; i++)
55 hw->io_ports[i] = ATA_HD_BASE + 1 + i * 4;
56
57 hw->io_ports[IDE_CONTROL_OFFSET] = ATA_HD_CONTROL;
58
59 hw->irq = IRQ_MFP_IDE;
60 hw->ack_intr = NULL;
61}
60 62
61 /* 63 /*
62 * Probe for a Falcon IDE interface 64 * Probe for a Falcon IDE interface
@@ -64,16 +66,15 @@ EXPORT_SYMBOL(falconide_intr_lock);
64 66
65static int __init falconide_init(void) 67static int __init falconide_init(void)
66{ 68{
67 if (MACH_IS_ATARI && ATARIHW_PRESENT(IDE)) {
68 hw_regs_t hw; 69 hw_regs_t hw;
69 ide_hwif_t *hwif; 70 ide_hwif_t *hwif;
70 71
72 if (!MACH_IS_ATARI || !ATARIHW_PRESENT(IDE))
73 return 0;
74
71 printk(KERN_INFO "ide: Falcon IDE controller\n"); 75 printk(KERN_INFO "ide: Falcon IDE controller\n");
72 76
73 ide_setup_ports(&hw, ATA_HD_BASE, falconide_offsets, 77 falconide_setup_ports(&hw);
74 0, 0, NULL,
75// falconide_iops,
76 IRQ_MFP_IDE);
77 78
78 hwif = ide_find_port(hw.io_ports[IDE_DATA_OFFSET]); 79 hwif = ide_find_port(hw.io_ports[IDE_DATA_OFFSET]);
79 if (hwif) { 80 if (hwif) {
@@ -85,9 +86,8 @@ static int __init falconide_init(void)
85 86
86 ide_device_add(idx, NULL); 87 ide_device_add(idx, NULL);
87 } 88 }
88 }
89 89
90 return 0; 90 return 0;
91} 91}
92 92
93module_init(falconide_init); 93module_init(falconide_init);
diff --git a/drivers/ide/legacy/gayle.c b/drivers/ide/legacy/gayle.c
index fc29ce75aff1..9d3851d27677 100644
--- a/drivers/ide/legacy/gayle.c
+++ b/drivers/ide/legacy/gayle.c
@@ -34,22 +34,8 @@
34 * Offsets from one of the above bases 34 * Offsets from one of the above bases
35 */ 35 */
36 36
37#define GAYLE_DATA 0x00
38#define GAYLE_ERROR 0x06 /* see err-bits */
39#define GAYLE_NSECTOR 0x0a /* nr of sectors to read/write */
40#define GAYLE_SECTOR 0x0e /* starting sector */
41#define GAYLE_LCYL 0x12 /* starting cylinder */
42#define GAYLE_HCYL 0x16 /* high byte of starting cyl */
43#define GAYLE_SELECT 0x1a /* 101dhhhh , d=drive, hhhh=head */
44#define GAYLE_STATUS 0x1e /* see status-bits */
45#define GAYLE_CONTROL 0x101a 37#define GAYLE_CONTROL 0x101a
46 38
47static int gayle_offsets[IDE_NR_PORTS] __initdata = {
48 GAYLE_DATA, GAYLE_ERROR, GAYLE_NSECTOR, GAYLE_SECTOR, GAYLE_LCYL,
49 GAYLE_HCYL, GAYLE_SELECT, GAYLE_STATUS, -1, -1
50};
51
52
53 /* 39 /*
54 * These are at different offsets from the base 40 * These are at different offsets from the base
55 */ 41 */
@@ -106,6 +92,26 @@ static int gayle_ack_intr_a1200(ide_hwif_t *hwif)
106 return 1; 92 return 1;
107} 93}
108 94
95static void __init gayle_setup_ports(hw_regs_t *hw, unsigned long base,
96 unsigned long ctl, unsigned long irq_port,
97 ide_ack_intr_t *ack_intr);
98{
99 int i;
100
101 memset(hw, 0, sizeof(*hw));
102
103 hw->io_ports[IDE_DATA_OFFSET] = base;
104
105 for (i = 1; i < 8; i++)
106 hw->io_ports[i] = base + 2 + i * 4;
107
108 hw->io_ports[IDE_CONTROL_OFFSET] = ctl;
109 hw->io_ports[IDE_IRQ_OFFSET] = irq_port;
110
111 hw->irq = IRQ_AMIGA_PORTS;
112 hw->ack_intr = ack_intr;
113}
114
109 /* 115 /*
110 * Probe for a Gayle IDE interface (and optionally for an IDE doubler) 116 * Probe for a Gayle IDE interface (and optionally for an IDE doubler)
111 */ 117 */
@@ -167,10 +173,7 @@ found:
167 base = (unsigned long)ZTWO_VADDR(phys_base); 173 base = (unsigned long)ZTWO_VADDR(phys_base);
168 ctrlport = GAYLE_HAS_CONTROL_REG ? (base + GAYLE_CONTROL) : 0; 174 ctrlport = GAYLE_HAS_CONTROL_REG ? (base + GAYLE_CONTROL) : 0;
169 175
170 ide_setup_ports(&hw, base, gayle_offsets, 176 gayle_setup_ports(&hw, base, ctrlport, irqport, ack_intr);
171 ctrlport, irqport, ack_intr,
172// &gayle_iops,
173 IRQ_AMIGA_PORTS);
174 177
175 hwif = ide_find_port(base); 178 hwif = ide_find_port(base);
176 if (hwif) { 179 if (hwif) {
diff --git a/drivers/ide/legacy/macide.c b/drivers/ide/legacy/macide.c
index 06df8df857a3..a61e60737dc7 100644
--- a/drivers/ide/legacy/macide.c
+++ b/drivers/ide/legacy/macide.c
@@ -31,14 +31,6 @@
31 * These match MkLinux so they should be correct. 31 * These match MkLinux so they should be correct.
32 */ 32 */
33 33
34#define IDE_DATA 0x00
35#define IDE_ERROR 0x04 /* see err-bits */
36#define IDE_NSECTOR 0x08 /* nr of sectors to read/write */
37#define IDE_SECTOR 0x0c /* starting sector */
38#define IDE_LCYL 0x10 /* starting cylinder */
39#define IDE_HCYL 0x14 /* high byte of starting cyl */
40#define IDE_SELECT 0x18 /* 101dhhhh , d=drive, hhhh=head */
41#define IDE_STATUS 0x1c /* see status-bits */
42#define IDE_CONTROL 0x38 /* control/altstatus */ 34#define IDE_CONTROL 0x38 /* control/altstatus */
43 35
44/* 36/*
@@ -63,11 +55,6 @@
63 55
64volatile unsigned char *ide_ifr = (unsigned char *) (IDE_BASE + IDE_IFR); 56volatile unsigned char *ide_ifr = (unsigned char *) (IDE_BASE + IDE_IFR);
65 57
66static int macide_offsets[IDE_NR_PORTS] = {
67 IDE_DATA, IDE_ERROR, IDE_NSECTOR, IDE_SECTOR, IDE_LCYL,
68 IDE_HCYL, IDE_SELECT, IDE_STATUS, IDE_CONTROL
69};
70
71int macide_ack_intr(ide_hwif_t* hwif) 58int macide_ack_intr(ide_hwif_t* hwif)
72{ 59{
73 if (*ide_ifr & 0x20) { 60 if (*ide_ifr & 0x20) {
@@ -77,6 +64,22 @@ int macide_ack_intr(ide_hwif_t* hwif)
77 return 0; 64 return 0;
78} 65}
79 66
67static void __init macide_setup_ports(hw_regs_t *hw, unsigned long base,
68 int irq, ide_ack_intr_t *ack_intr)
69{
70 int i;
71
72 memset(hw, 0, sizeof(*hw));
73
74 for (i = 0; i < 8; i++)
75 hw->io_ports[i] = base + i * 4;
76
77 hw->io_ports[IDE_CONTROL_OFFSET] = IDE_CONTROL;
78
79 hw->irq = irq;
80 hw->ack_intr = ack_intr;
81}
82
80static const char *mac_ide_name[] = 83static const char *mac_ide_name[] =
81 { "Quadra", "Powerbook", "Powerbook Baboon" }; 84 { "Quadra", "Powerbook", "Powerbook Baboon" };
82 85
@@ -86,27 +89,27 @@ static const char *mac_ide_name[] =
86 89
87static int __init macide_init(void) 90static int __init macide_init(void)
88{ 91{
89 hw_regs_t hw;
90 ide_hwif_t *hwif; 92 ide_hwif_t *hwif;
93 ide_ack_intr_t *ack_intr;
94 unsigned long base;
95 int irq;
96 hw_regs_t hw;
91 97
92 switch (macintosh_config->ide_type) { 98 switch (macintosh_config->ide_type) {
93 case MAC_IDE_QUADRA: 99 case MAC_IDE_QUADRA:
94 ide_setup_ports(&hw, IDE_BASE, macide_offsets, 100 base = IDE_BASE;
95 0, 0, macide_ack_intr, 101 ack_intr = macide_ack_intr;
96// quadra_ide_iops, 102 irq = IRQ_NUBUS_F;
97 IRQ_NUBUS_F);
98 break; 103 break;
99 case MAC_IDE_PB: 104 case MAC_IDE_PB:
100 ide_setup_ports(&hw, IDE_BASE, macide_offsets, 105 base = IDE_BASE;
101 0, 0, macide_ack_intr, 106 ack_intr = macide_ack_intr;
102// macide_pb_iops, 107 irq = IRQ_NUBUS_C;
103 IRQ_NUBUS_C);
104 break; 108 break;
105 case MAC_IDE_BABOON: 109 case MAC_IDE_BABOON:
106 ide_setup_ports(&hw, BABOON_BASE, macide_offsets, 110 base = BABOON_BASE;
107 0, 0, NULL, 111 ack_intr = NULL;
108// macide_baboon_iops, 112 irq = IRQ_BABOON_1;
109 IRQ_BABOON_1);
110 break; 113 break;
111 default: 114 default:
112 return -ENODEV; 115 return -ENODEV;
@@ -115,6 +118,8 @@ static int __init macide_init(void)
115 printk(KERN_INFO "ide: Macintosh %s IDE controller\n", 118 printk(KERN_INFO "ide: Macintosh %s IDE controller\n",
116 mac_ide_name[macintosh_config->ide_type - 1]); 119 mac_ide_name[macintosh_config->ide_type - 1]);
117 120
121 macide_setup_ports(&hw, base, irq, ack_intr);
122
118 hwif = ide_find_port(hw.io_ports[IDE_DATA_OFFSET]); 123 hwif = ide_find_port(hw.io_ports[IDE_DATA_OFFSET]);
119 if (hwif) { 124 if (hwif) {
120 u8 index = hwif->index; 125 u8 index = hwif->index;
diff --git a/drivers/ide/legacy/q40ide.c b/drivers/ide/legacy/q40ide.c
index 2f0b34d892a1..1381b91bc316 100644
--- a/drivers/ide/legacy/q40ide.c
+++ b/drivers/ide/legacy/q40ide.c
@@ -66,16 +66,12 @@ static int q40ide_default_irq(unsigned long base)
66 66
67 67
68/* 68/*
69 * This is very similar to ide_setup_ports except that addresses 69 * Addresses are pretranslated for Q40 ISA access.
70 * are pretranslated for q40 ISA access
71 */ 70 */
72void q40_ide_setup_ports ( hw_regs_t *hw, 71void q40_ide_setup_ports ( hw_regs_t *hw,
73 unsigned long base, int *offsets, 72 unsigned long base, int *offsets,
74 unsigned long ctrl, unsigned long intr, 73 unsigned long ctrl, unsigned long intr,
75 ide_ack_intr_t *ack_intr, 74 ide_ack_intr_t *ack_intr,
76/*
77 * ide_io_ops_t *iops,
78 */
79 int irq) 75 int irq)
80{ 76{
81 int i; 77 int i;
@@ -92,9 +88,6 @@ void q40_ide_setup_ports ( hw_regs_t *hw,
92 88
93 hw->irq = irq; 89 hw->irq = irq;
94 hw->ack_intr = ack_intr; 90 hw->ack_intr = ack_intr;
95/*
96 * hw->iops = iops;
97 */
98} 91}
99 92
100 93