diff options
Diffstat (limited to 'drivers/ide/legacy/q40ide.c')
-rw-r--r-- | drivers/ide/legacy/q40ide.c | 47 |
1 files changed, 26 insertions, 21 deletions
diff --git a/drivers/ide/legacy/q40ide.c b/drivers/ide/legacy/q40ide.c index 9c2b9d078f69..4abd8fc78197 100644 --- a/drivers/ide/legacy/q40ide.c +++ b/drivers/ide/legacy/q40ide.c | |||
@@ -96,6 +96,27 @@ static void q40ide_output_data(ide_drive_t *drive, struct request *rq, | |||
96 | outsw_swapw(data_addr, buf, (len + 1) / 2); | 96 | outsw_swapw(data_addr, buf, (len + 1) / 2); |
97 | } | 97 | } |
98 | 98 | ||
99 | /* Q40 has a byte-swapped IDE interface */ | ||
100 | static const struct ide_tp_ops q40ide_tp_ops = { | ||
101 | .exec_command = ide_exec_command, | ||
102 | .read_status = ide_read_status, | ||
103 | .read_altstatus = ide_read_altstatus, | ||
104 | .read_sff_dma_status = ide_read_sff_dma_status, | ||
105 | |||
106 | .set_irq = ide_set_irq, | ||
107 | |||
108 | .tf_load = ide_tf_load, | ||
109 | .tf_read = ide_tf_read, | ||
110 | |||
111 | .input_data = q40ide_input_data, | ||
112 | .output_data = q40ide_output_data, | ||
113 | }; | ||
114 | |||
115 | static const struct ide_port_info q40ide_port_info = { | ||
116 | .tp_ops = &q40ide_tp_ops, | ||
117 | .host_flags = IDE_HFLAG_NO_DMA, | ||
118 | }; | ||
119 | |||
99 | /* | 120 | /* |
100 | * the static array is needed to have the name reported in /proc/ioports, | 121 | * the static array is needed to have the name reported in /proc/ioports, |
101 | * hwif->name unfortunately isn't available yet | 122 | * hwif->name unfortunately isn't available yet |
@@ -111,9 +132,7 @@ static const char *q40_ide_names[Q40IDE_NUM_HWIFS]={ | |||
111 | static int __init q40ide_init(void) | 132 | static int __init q40ide_init(void) |
112 | { | 133 | { |
113 | int i; | 134 | int i; |
114 | ide_hwif_t *hwif; | 135 | hw_regs_t hw[Q40IDE_NUM_HWIFS], *hws[] = { NULL, NULL, NULL, NULL }; |
115 | const char *name; | ||
116 | u8 idx[4] = { 0xff, 0xff, 0xff, 0xff }; | ||
117 | 136 | ||
118 | if (!MACH_IS_Q40) | 137 | if (!MACH_IS_Q40) |
119 | return -ENODEV; | 138 | return -ENODEV; |
@@ -121,9 +140,8 @@ static int __init q40ide_init(void) | |||
121 | printk(KERN_INFO "ide: Q40 IDE controller\n"); | 140 | printk(KERN_INFO "ide: Q40 IDE controller\n"); |
122 | 141 | ||
123 | for (i = 0; i < Q40IDE_NUM_HWIFS; i++) { | 142 | for (i = 0; i < Q40IDE_NUM_HWIFS; i++) { |
124 | hw_regs_t hw; | 143 | const char *name = q40_ide_names[i]; |
125 | 144 | ||
126 | name = q40_ide_names[i]; | ||
127 | if (!request_region(pcide_bases[i], 8, name)) { | 145 | if (!request_region(pcide_bases[i], 8, name)) { |
128 | printk("could not reserve ports %lx-%lx for %s\n", | 146 | printk("could not reserve ports %lx-%lx for %s\n", |
129 | pcide_bases[i],pcide_bases[i]+8,name); | 147 | pcide_bases[i],pcide_bases[i]+8,name); |
@@ -135,26 +153,13 @@ static int __init q40ide_init(void) | |||
135 | release_region(pcide_bases[i], 8); | 153 | release_region(pcide_bases[i], 8); |
136 | continue; | 154 | continue; |
137 | } | 155 | } |
138 | q40_ide_setup_ports(&hw, pcide_bases[i], | 156 | q40_ide_setup_ports(&hw[i], pcide_bases[i], NULL, |
139 | NULL, | ||
140 | // m68kide_iops, | ||
141 | q40ide_default_irq(pcide_bases[i])); | 157 | q40ide_default_irq(pcide_bases[i])); |
142 | 158 | ||
143 | hwif = ide_find_port(); | 159 | hws[i] = &hw[i]; |
144 | if (hwif) { | ||
145 | ide_init_port_hw(hwif, &hw); | ||
146 | |||
147 | /* Q40 has a byte-swapped IDE interface */ | ||
148 | hwif->input_data = q40ide_input_data; | ||
149 | hwif->output_data = q40ide_output_data; | ||
150 | |||
151 | idx[i] = hwif->index; | ||
152 | } | ||
153 | } | 160 | } |
154 | 161 | ||
155 | ide_device_add(idx, NULL); | 162 | return ide_host_add(&q40ide_port_info, hws, NULL); |
156 | |||
157 | return 0; | ||
158 | } | 163 | } |
159 | 164 | ||
160 | module_init(q40ide_init); | 165 | module_init(q40ide_init); |