15 #define DRV_NAME "ht6560b"
16 #define HT6560B_VERSION "v0.08"
18 #include <linux/module.h>
19 #include <linux/types.h>
20 #include <linux/kernel.h>
45 #define HT_CONFIG_PORT 0x3e6
49 return ((
unsigned long)ide_get_drivedata(drive) & 0xff00) >> 8;
55 #define HT_CONFIG_DEFAULT 0x1c
57 #define HT_SECONDARY_IF 0x01
58 #define HT_PREFETCH_MODE 0x20
99 return (
unsigned long)ide_get_drivedata(drive) & 0x00ff;
102 #define HT_TIMING_DEFAULT 0xff
118 static u8 current_select = 0;
119 static u8 current_timing = 0;
124 select = HT_CONFIG(drive);
125 timing = HT_TIMING(drive);
135 if (select != current_select || timing != current_timing) {
137 current_timing = timing;
149 printk(
"ht6560b: %s: select=%#x timing=%#x\n",
150 drive->
name, select, timing);
161 static int __init try_to_init_ht6560b(
void)
190 ": chipset detected and initialized"
192 " with debug enabled"
201 int active_time, recovery_time;
202 int active_cycles, recovery_cycles;
206 unsigned int cycle_time;
217 recovery_time = cycle_time - active_time - t->
setup;
221 active_cycles = (active_time * bus_speed + 999) / 1000;
222 recovery_cycles = (recovery_time * bus_speed + 999) / 1000;
226 if (active_cycles < 2) active_cycles = 2;
227 if (recovery_cycles < 2) recovery_cycles = 2;
228 if (active_cycles > 15) active_cycles = 15;
229 if (recovery_cycles > 15) recovery_cycles = 0;
232 printk(
"ht6560b: drive %s setting pio=%d recovery=%d (%dns) active=%d (%dns)\n", drive->
name, pio, recovery_cycles, recovery_time, active_cycles, active_time);
235 return (
u8)((recovery_cycles << 4) | active_cycles);
239 printk(
"ht6560b: drive %s setting pio=0\n", drive->
name);
258 config = (
unsigned long)ide_get_drivedata(drive);
272 ide_set_drivedata(drive, (
void *)config);
274 spin_unlock_irqrestore(&ht6560b_lock, flags);
277 printk(
"ht6560b: drive %s prefetch mode %sabled\n", drive->
name, (state ?
"en" :
"dis"));
290 ht_set_prefetch(drive, pio & 1);
294 timing = ht_pio2timings(drive, pio);
297 config = (
unsigned long)ide_get_drivedata(drive);
300 ide_set_drivedata(drive, (
void *)config);
301 spin_unlock_irqrestore(&ht6560b_lock, flags);
304 printk(
"ht6560b: drive %s tuned to pio mode %#x timing=%#x\n", drive->
name, pio, timing);
317 ide_set_drivedata(drive, (
void *)t);
320 static bool probe_ht6560b;
325 static const struct ide_tp_ops ht6560b_tp_ops = {
331 .dev_select = ht6560b_dev_select,
340 .init_dev = ht6560b_init_dev,
341 .set_pio_mode = ht6560b_set_pio_mode,
347 .tp_ops = &ht6560b_tp_ops,
348 .port_ops = &ht6560b_port_ops,
355 static int __init ht6560b_init(
void)
357 if (probe_ht6560b == 0)
366 if (!try_to_init_ht6560b()) {