diff options
Diffstat (limited to 'drivers/ide/h8300/ide-h8300.c')
-rw-r--r-- | drivers/ide/h8300/ide-h8300.c | 48 |
1 files changed, 20 insertions, 28 deletions
diff --git a/drivers/ide/h8300/ide-h8300.c b/drivers/ide/h8300/ide-h8300.c index 20fad6d542cc..bde7a585f198 100644 --- a/drivers/ide/h8300/ide-h8300.c +++ b/drivers/ide/h8300/ide-h8300.c | |||
@@ -100,6 +100,8 @@ static void h8300_tf_read(ide_drive_t *drive, ide_task_t *task) | |||
100 | /* be sure we're looking at the low order bits */ | 100 | /* be sure we're looking at the low order bits */ |
101 | outb(ATA_DEVCTL_OBS & ~0x80, io_ports->ctl_addr); | 101 | outb(ATA_DEVCTL_OBS & ~0x80, io_ports->ctl_addr); |
102 | 102 | ||
103 | if (task->tf_flags & IDE_TFLAG_IN_FEATURE) | ||
104 | tf->feature = inb(io_ports->feature_addr); | ||
103 | if (task->tf_flags & IDE_TFLAG_IN_NSECT) | 105 | if (task->tf_flags & IDE_TFLAG_IN_NSECT) |
104 | tf->nsect = inb(io_ports->nsect_addr); | 106 | tf->nsect = inb(io_ports->nsect_addr); |
105 | if (task->tf_flags & IDE_TFLAG_IN_LBAL) | 107 | if (task->tf_flags & IDE_TFLAG_IN_LBAL) |
@@ -153,6 +155,21 @@ static void h8300_output_data(ide_drive_t *drive, struct request *rq, | |||
153 | mm_outsw(drive->hwif->io_ports.data_addr, buf, (len + 1) / 2); | 155 | mm_outsw(drive->hwif->io_ports.data_addr, buf, (len + 1) / 2); |
154 | } | 156 | } |
155 | 157 | ||
158 | static const struct ide_tp_ops h8300_tp_ops = { | ||
159 | .exec_command = ide_exec_command, | ||
160 | .read_status = ide_read_status, | ||
161 | .read_altstatus = ide_read_altstatus, | ||
162 | .read_sff_dma_status = ide_read_sff_dma_status, | ||
163 | |||
164 | .set_irq = ide_set_irq, | ||
165 | |||
166 | .tf_load = h8300_tf_load, | ||
167 | .tf_read = h8300_tf_read, | ||
168 | |||
169 | .input_data = h8300_input_data, | ||
170 | .output_data = h8300_output_data, | ||
171 | }; | ||
172 | |||
156 | #define H8300_IDE_GAP (2) | 173 | #define H8300_IDE_GAP (2) |
157 | 174 | ||
158 | static inline void hw_setup(hw_regs_t *hw) | 175 | static inline void hw_setup(hw_regs_t *hw) |
@@ -167,27 +184,14 @@ static inline void hw_setup(hw_regs_t *hw) | |||
167 | hw->chipset = ide_generic; | 184 | hw->chipset = ide_generic; |
168 | } | 185 | } |
169 | 186 | ||
170 | static inline void hwif_setup(ide_hwif_t *hwif) | ||
171 | { | ||
172 | default_hwif_iops(hwif); | ||
173 | |||
174 | hwif->tf_load = h8300_tf_load; | ||
175 | hwif->tf_read = h8300_tf_read; | ||
176 | |||
177 | hwif->input_data = h8300_input_data; | ||
178 | hwif->output_data = h8300_output_data; | ||
179 | } | ||
180 | |||
181 | static const struct ide_port_info h8300_port_info = { | 187 | static const struct ide_port_info h8300_port_info = { |
188 | .tp_ops = &h8300_tp_ops, | ||
182 | .host_flags = IDE_HFLAG_NO_IO_32BIT | IDE_HFLAG_NO_DMA, | 189 | .host_flags = IDE_HFLAG_NO_IO_32BIT | IDE_HFLAG_NO_DMA, |
183 | }; | 190 | }; |
184 | 191 | ||
185 | static int __init h8300_ide_init(void) | 192 | static int __init h8300_ide_init(void) |
186 | { | 193 | { |
187 | hw_regs_t hw; | 194 | hw_regs_t hw, *hws[] = { &hw, NULL, NULL, NULL }; |
188 | ide_hwif_t *hwif; | ||
189 | int index; | ||
190 | u8 idx[4] = { 0xff, 0xff, 0xff, 0xff }; | ||
191 | 195 | ||
192 | printk(KERN_INFO DRV_NAME ": H8/300 generic IDE interface\n"); | 196 | printk(KERN_INFO DRV_NAME ": H8/300 generic IDE interface\n"); |
193 | 197 | ||
@@ -200,19 +204,7 @@ static int __init h8300_ide_init(void) | |||
200 | 204 | ||
201 | hw_setup(&hw); | 205 | hw_setup(&hw); |
202 | 206 | ||
203 | hwif = ide_find_port_slot(&h8300_port_info); | 207 | return ide_host_add(&h8300_port_info, hws, NULL); |
204 | if (hwif == NULL) | ||
205 | return -ENOENT; | ||
206 | |||
207 | index = hwif->index; | ||
208 | ide_init_port_hw(hwif, &hw); | ||
209 | hwif_setup(hwif); | ||
210 | |||
211 | idx[0] = index; | ||
212 | |||
213 | ide_device_add(idx, &h8300_port_info); | ||
214 | |||
215 | return 0; | ||
216 | 208 | ||
217 | out_busy: | 209 | out_busy: |
218 | printk(KERN_ERR "ide-h8300: IDE I/F resource already used.\n"); | 210 | printk(KERN_ERR "ide-h8300: IDE I/F resource already used.\n"); |