38 #define REALLY_SLOW_IO
40 #include <linux/module.h>
41 #include <linux/types.h>
42 #include <linux/kernel.h>
53 #define DRV_NAME "umc8672"
64 static const u8 pio_to_umc [5] = {0, 3, 7, 10, 11};
67 static const u8 speedtab [3][12] = {
68 {0x0f, 0x0b, 0x02, 0x02, 0x02, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x1},
69 {0x03, 0x02, 0x02, 0x02, 0x02, 0x02, 0x01, 0x01, 0x01, 0x01, 0x01, 0x1},
70 {0xff, 0xcb, 0xc0, 0x58, 0x36, 0x33, 0x23, 0x22, 0x21, 0x11, 0x10, 0x0}
73 static void out_umc(
char port,
char wert)
79 static inline u8 in_umc(
char port)
85 static void umc_set_speeds(
u8 speeds[])
91 out_umc(0xd7, (speedtab[0][speeds[2]] | (speedtab[0][speeds[3]]<<4)));
92 out_umc(0xd6, (speedtab[0][speeds[0]] | (speedtab[0][speeds[1]]<<4)));
94 for (i = 3; i >= 0; i--)
95 tmp = (tmp << 2) | speedtab[1][speeds[
i]];
97 for (i = 0; i < 4; i++) {
98 out_umc(0xd0 + i, speedtab[2][speeds[i]]);
99 out_umc(0xd8 + i, speedtab[2][speeds[i]]);
103 printk(
"umc8672: drive speeds [0 to 11]: %d %d %d %d\n",
104 speeds[0], speeds[1], speeds[2], speeds[3]);
113 printk(
"%s: setting umc8672 to PIO mode%d (speed %d)\n",
114 drive->
name, pio, pio_to_umc[pio]);
118 printk(
KERN_ERR "umc8672: other interface is busy: exiting tune_umc()\n");
120 current_speeds[drive->
name[2] -
'a'] = pio_to_umc[
pio];
121 umc_set_speeds(current_speeds);
124 spin_unlock_irqrestore(&mate->
lock,
flags);
128 .set_pio_mode = umc_set_pio_mode,
134 .port_ops = &umc8672_port_ops,
139 static int __init umc8672_probe(
void)
149 if (in_umc (0xd5) != 0xa0) {
157 umc_set_speeds(current_speeds);
163 static bool probe_umc8672;
168 static int __init umc8672_init(
void)
170 if (probe_umc8672 == 0)
173 if (umc8672_probe() == 0)