Lines Matching +full:drive +full:- +full:mode
1 // SPDX-License-Identifier: GPL-2.0-only
3 * Copyright (C) 1995-2000 Linus Torvalds & author (see below)
7 * HT-6560B EIDE-controller support
9 * Use hdparm utility to enable PIO mode support.
11 * Author: Mikko Ala-Fossi <maf@iki.fi>
35 * The special i/o-port that HT-6560B uses to configuration:
40 * The special i/o-port that HT-6560A uses to configuration:
43 * bit2 (0x04): "0" enables multi-master system (?)
48 static inline u8 HT_CONFIG(ide_drive_t *drive) in HT_CONFIG() argument
50 return ((unsigned long)ide_get_drivedata(drive) & 0xff00) >> 8; in HT_CONFIG()
54 * FIFO + PREFETCH (both a/b-model)
75 * gives. [see cmd640.c for an extreme example of this. -ml]
95 * Active Time for each drive. Smaller value gives higher speed.
98 static inline u8 HT_TIMING(ide_drive_t *drive) in HT_TIMING() argument
100 return (unsigned long)ide_get_drivedata(drive) & 0x00ff; in HT_TIMING()
107 * on the F.G.I./Holtek HT-6560B VLB IDE interface.
108 * The HT-6560B can only enable one IDE port at a time, and requires a
113 * This routine is invoked from ide.c to prepare for access to a given drive.
115 static void ht6560b_dev_select(ide_drive_t *drive) in ht6560b_dev_select() argument
117 ide_hwif_t *hwif = drive->hwif; in ht6560b_dev_select()
125 select = HT_CONFIG(drive); in ht6560b_dev_select()
126 timing = HT_TIMING(drive); in ht6560b_dev_select()
132 if (drive->media != ide_disk || in ht6560b_dev_select()
133 (drive->dev_flags & IDE_DFLAG_PRESENT) == 0) in ht6560b_dev_select()
145 * Set timing for this drive: in ht6560b_dev_select()
147 outb(timing, hwif->io_ports.device_addr); in ht6560b_dev_select()
148 (void)inb(hwif->io_ports.status_addr); in ht6560b_dev_select()
151 drive->name, select, timing); in ht6560b_dev_select()
156 outb(drive->select | ATA_DEVICE_OBS, hwif->io_ports.device_addr); in ht6560b_dev_select()
171 for (i=3;i>0;i--) { in try_to_init_ht6560b()
200 static u8 ht_pio2timings(ide_drive_t *drive, const u8 pio) in ht_pio2timings() argument
210 cycle_time = ide_pio_cycle_time(drive, pio); in ht_pio2timings()
217 active_time = t->active; in ht_pio2timings()
218 recovery_time = cycle_time - active_time - t->setup; in ht_pio2timings()
233 …printk("ht6560b: drive %s setting pio=%d recovery=%d (%dns) active=%d (%dns)\n", drive->name, pio,… in ht_pio2timings()
240 printk("ht6560b: drive %s setting pio=0\n", drive->name); in ht_pio2timings()
250 * Enable/Disable so called prefetch mode
252 static void ht_set_prefetch(ide_drive_t *drive, u8 state) in ht_set_prefetch() argument
259 config = (unsigned long)ide_get_drivedata(drive); in ht_set_prefetch()
262 * Prefetch mode and unmask irq seems to conflict in ht_set_prefetch()
265 config |= t; /* enable prefetch mode */ in ht_set_prefetch()
266 drive->dev_flags |= IDE_DFLAG_NO_UNMASK; in ht_set_prefetch()
267 drive->dev_flags &= ~IDE_DFLAG_UNMASK; in ht_set_prefetch()
269 config &= ~t; /* disable prefetch mode */ in ht_set_prefetch()
270 drive->dev_flags &= ~IDE_DFLAG_NO_UNMASK; in ht_set_prefetch()
273 ide_set_drivedata(drive, (void *)config); in ht_set_prefetch()
278 printk("ht6560b: drive %s prefetch mode %sabled\n", drive->name, (state ? "en" : "dis")); in ht_set_prefetch()
282 static void ht6560b_set_pio_mode(ide_hwif_t *hwif, ide_drive_t *drive) in ht6560b_set_pio_mode() argument
285 const u8 pio = drive->pio_mode - XFER_PIO_0; in ht6560b_set_pio_mode()
291 ht_set_prefetch(drive, pio & 1); in ht6560b_set_pio_mode()
295 timing = ht_pio2timings(drive, pio); in ht6560b_set_pio_mode()
298 config = (unsigned long)ide_get_drivedata(drive); in ht6560b_set_pio_mode()
301 ide_set_drivedata(drive, (void *)config); in ht6560b_set_pio_mode()
305 printk("ht6560b: drive %s tuned to pio mode %#x timing=%#x\n", drive->name, pio, timing); in ht6560b_set_pio_mode()
309 static void __init ht6560b_init_dev(ide_drive_t *drive) in ht6560b_init_dev() argument
311 ide_hwif_t *hwif = drive->hwif; in ht6560b_init_dev()
315 if (hwif->channel) in ht6560b_init_dev()
318 ide_set_drivedata(drive, (void *)t); in ht6560b_init_dev()
359 return -ENODEV; in ht6560b_init()
364 return -ENODEV; in ht6560b_init()
376 return -ENODEV; in ht6560b_init()
382 MODULE_DESCRIPTION("HT-6560B EIDE-controller support");