Lines Matching +full:1000 +full:base +full:- +full:t
1 // SPDX-License-Identifier: GPL-2.0-only
3 * Copyright (C) 1996-2001 Linus Torvalds & author (see below)
7 * Version 0.03 Cleaned auto-tune, added probe
20 * Samuel Thibault <samuel.thibault@ens-lyon.org>
40 * I/O ports are 0x30-0x31 (and 0x32-0x33 for qd6580)
41 * or 0xb0-0xb1 (and 0xb2-0xb3 for qd6580)
42 * -- qd6500 is a single IDE interface
43 * -- qd6580 is a dual IDE interface
51 * base: Timer1
54 * base+0x01: Config (R/O)
66 * base+0x02: Timer2 (qd6580 only)
69 * base+0x03: Control (qd6580 only)
71 * bits 0-3 must always be set 1
78 * bit 2-4 : always 0
81 * bit 7 : set 1 for non-ATAPI devices on primary port
82 * (maybe read-ahead and post-write buffer ?)
85 static int timings[4]={-1,-1,-1,-1}; /* stores current timing for each timer */
101 outb(drive->select | ATA_DEVICE_OBS, drive->hwif->io_ports.device_addr); in qd65xx_dev_select()
118 act_cyc = 9 - IDE_IN(active_time * clk / 1000 + 1, 2, 9); in qd6500_compute_timing()
119 rec_cyc = 15 - IDE_IN(recovery_time * clk / 1000 + 1, 0, 15); in qd6500_compute_timing()
121 act_cyc = 8 - IDE_IN(active_time * clk / 1000 + 1, 1, 8); in qd6500_compute_timing()
122 rec_cyc = 18 - IDE_IN(recovery_time * clk / 1000 + 1, 3, 18); in qd6500_compute_timing()
139 act_cyc = 17 - IDE_IN(active_time * clk / 1000 + 1, 2, 17); in qd6580_compute_timing()
140 rec_cyc = 15 - IDE_IN(recovery_time * clk / 1000 + 1, 2, 15); in qd6580_compute_timing()
155 char *m = (char *)&drive->id[ATA_ID_PROD]; in qd_find_disk_type()
162 ide_fixstring(model, ATA_ID_PROD_LEN, 1); /* byte-swap */ in qd_find_disk_type()
164 for (p = qd65xx_timing ; p->offset != -1 ; p++) { in qd_find_disk_type()
165 if (!strncmp(p->model, model+p->offset, 4)) { in qd_find_disk_type()
166 printk(KERN_DEBUG "%s: listed !\n", drive->name); in qd_find_disk_type()
167 *active_time = p->active; in qd_find_disk_type()
168 *recovery_time = p->recovery; in qd_find_disk_type()
189 printk(KERN_DEBUG "%s: %#x\n", drive->name, timing); in qd_set_timing()
194 u16 *id = drive->id; in qd6500_set_pio_mode()
198 /* FIXME: use drive->pio_mode value */ in qd6500_set_pio_mode()
202 printk(KERN_INFO "%s: PIO mode%d\n", drive->name, in qd6500_set_pio_mode()
205 recovery_time = drive->id[ATA_ID_EIDE_PIO] - 120; in qd6500_set_pio_mode()
208 qd_set_timing(drive, qd6500_compute_timing(drive->hwif, in qd6500_set_pio_mode()
214 const u8 pio = drive->pio_mode - XFER_PIO_0; in qd6580_set_pio_mode()
215 struct ide_timing *t = ide_timing_find_mode(XFER_PIO_0 + pio); in qd6580_set_pio_mode() local
219 u8 base = (hwif->config_data & 0xff00) >> 8; in qd6580_set_pio_mode() local
221 if (drive->id && !qd_find_disk_type(drive, &active_time, &recovery_time)) { in qd6580_set_pio_mode()
229 recovery_time = cycle_time - 102; in qd6580_set_pio_mode()
231 printk(KERN_WARNING "%s: Strange recovery time !\n",drive->name); in qd6580_set_pio_mode()
236 recovery_time = cycle_time - 61; in qd6580_set_pio_mode()
238 printk(KERN_WARNING "%s: Strange recovery time !\n",drive->name); in qd6580_set_pio_mode()
243 recovery_time = cycle_time - 120; in qd6580_set_pio_mode()
245 active_time = t->active; in qd6580_set_pio_mode()
246 recovery_time = cycle_time - active_time; in qd6580_set_pio_mode()
249 printk(KERN_INFO "%s: PIO mode%d\n", drive->name,pio); in qd6580_set_pio_mode()
252 if (!hwif->channel && drive->media != ide_disk) { in qd6580_set_pio_mode()
254 printk(KERN_WARNING "%s: ATAPI: disabled read-ahead FIFO " in qd6580_set_pio_mode()
255 "and post-write buffer on %s.\n", in qd6580_set_pio_mode()
256 drive->name, hwif->name); in qd6580_set_pio_mode()
281 printk(KERN_ERR "Outch ! the probe for qd65xx isn't reliable !\n"); in qd_testreg()
292 ide_hwif_t *hwif = drive->hwif; in qd6500_init_dev()
293 u8 base = (hwif->config_data & 0xff00) >> 8; in qd6500_init_dev() local
301 ide_hwif_t *hwif = drive->hwif; in qd6580_init_dev()
303 u8 base = (hwif->config_data & 0xff00) >> 8; in qd6580_init_dev() local
306 if (hwif->host_flags & IDE_HFLAG_SINGLE) { in qd6580_init_dev()
310 t2 = t1 = hwif->channel ? QD6580_DEF_DATA2 : QD6580_DEF_DATA; in qd6580_init_dev()
312 ide_set_drivedata(drive, (void *)((drive->dn & 1) ? t2 : t1)); in qd6580_init_dev()
355 static int __init qd_probe(int base) in qd_probe() argument
363 if (! ((config & QD_CONFIG_BASEPORT) >> 1 == (base == 0xb0)) ) in qd_probe()
364 return -ENODEV; in qd_probe()
373 if (qd_testreg(base)) in qd_probe()
374 return -ENODEV; /* bad register */ in qd_probe()
378 return -ENODEV; in qd_probe()
381 printk(KERN_NOTICE "qd6500 at %#x\n", base); in qd_probe()
390 if (qd_testreg(base) || qd_testreg(base + 0x02)) in qd_probe()
391 return -ENODEV; /* bad registers */ in qd_probe()
395 printk(KERN_NOTICE "qd6580 at %#x\n", base); in qd_probe()
409 return -ENODEV; in qd_probe()
412 rc = ide_legacy_device_add(&d, (base << 8) | config); in qd_probe()
427 int rc1, rc2 = -ENODEV; in qd65xx_init()
430 return -ENODEV; in qd65xx_init()
437 return -ENODEV; in qd65xx_init()