• Home
  • Raw
  • Download

Lines Matching +full:drive +full:- +full:mode

1 // SPDX-License-Identifier: GPL-2.0-only
3 * Copyright (C) 1995-1996 Linus Torvalds & authors (see below)
25 * chrisc@dbass.demon.co.uk, dalecki@namu26.Num.Math.Uni-Goettingen.de,
26 * derekn@vw.ece.cmu.edu, florian@btp2x3.phy.uni-bayreuth.de,
28 * j@pobox.com, jkemp1@mises.uni-paderborn.de, jtoppe@hiwaay.net,
29 * kerouac@ssnet.com, meskes@informatik.rwth-aachen.de, hzoli@cs.elte.hu,
45 * with prefetch mode. Separate function for setting
52 * Added new function cmd640_set_mode to set PIO mode
59 * Version 0.07 Changed to more conservative drive tuning policy.
61 * (reported_PIO - 1) if it is supported, or to PIO0.
79 * prefetch can be turned OFF/ON using "hdparm -p8/-p9"
80 * (requires hdparm-3.1 or newer)
81 * Version 0.91 first release to linux-kernel list.
90 * other minor tune-ups: 0.96 was very good.
92 * Version 0.99 display setup/active/recovery clocks with PIO mode
94 * Version 1.01 slow/fast devsel can be selected with "hdparm -p6/-p7"
163 * Registers and masks for easy access by drive index:
174 * Current cmd640 timing values for each drive.
288 * Probe for CMD640x -- pci method 1
304 * Probe for CMD640x -- pci method 2
318 * Probe for CMD640x -- vlb
338 * Returns 1 if an IDE interface/drive exists at 0x170,
380 static void __set_prefetch_mode(ide_drive_t *drive, int mode) in __set_prefetch_mode() argument
382 if (mode) { /* want prefetch on? */ in __set_prefetch_mode()
384 drive->dev_flags |= IDE_DFLAG_NO_UNMASK; in __set_prefetch_mode()
385 drive->dev_flags &= ~IDE_DFLAG_UNMASK; in __set_prefetch_mode()
387 drive->dev_flags &= ~IDE_DFLAG_NO_IO_32BIT; in __set_prefetch_mode()
389 drive->dev_flags &= ~IDE_DFLAG_NO_UNMASK; in __set_prefetch_mode()
390 drive->dev_flags |= IDE_DFLAG_NO_IO_32BIT; in __set_prefetch_mode()
391 drive->io_32bit = 0; in __set_prefetch_mode()
397 * Check whether prefetch is on for a drive,
400 static void __init check_prefetch(ide_drive_t *drive, unsigned int index) in check_prefetch() argument
404 __set_prefetch_mode(drive, (b & prefetch_masks[index]) ? 0 : 1); in check_prefetch()
409 * Sets prefetch mode for a drive.
411 static void set_prefetch_mode(ide_drive_t *drive, unsigned int index, int mode) in set_prefetch_mode() argument
419 __set_prefetch_mode(drive, mode); in set_prefetch_mode()
420 if (mode) in set_prefetch_mode()
429 * Dump out current drive clocks settings
457 * for a drive into the cmd640 chipset registers to active them.
459 static void program_drive_counts(ide_drive_t *drive, unsigned int index) in program_drive_counts() argument
467 * Set up address setup count and drive read/write timing registers. in program_drive_counts()
469 * each drive. Secondary interface has one common set of registers, in program_drive_counts()
473 ide_drive_t *peer = ide_get_pair_dev(drive); in program_drive_counts()
504 * (this converts counts of 16 into counts of zero -- okay). in program_drive_counts()
513 * Set a specific pio_mode for a drive
515 static void cmd640_set_mode(ide_drive_t *drive, unsigned int index, in cmd640_set_mode() argument
532 setup_time = t->setup; in cmd640_set_mode()
533 active_time = t->active; in cmd640_set_mode()
535 recovery_time = cycle_time - (setup_time + active_time); in cmd640_set_mode()
546 recovery_count2 = cycle_count - (setup_count + active_count); in cmd640_set_mode()
552 active_count += recovery_count - 17; in cmd640_set_mode()
558 recovery_count -= 1; /* cmd640b uses (count + 1)*/ in cmd640_set_mode()
567 * In a perfect world, we might set the drive pio mode here in cmd640_set_mode()
574 program_drive_counts(drive, index); in cmd640_set_mode()
577 static void cmd640_set_pio_mode(ide_hwif_t *hwif, ide_drive_t *drive) in cmd640_set_pio_mode() argument
580 const u8 pio = drive->pio_mode - XFER_PIO_0; in cmd640_set_pio_mode()
584 case 6: /* set fast-devsel off */ in cmd640_set_pio_mode()
585 case 7: /* set fast-devsel on */ in cmd640_set_pio_mode()
591 drive->name, (pio & 1) ? "en" : "dis"); in cmd640_set_pio_mode()
595 set_prefetch_mode(drive, index, pio & 1); in cmd640_set_pio_mode()
597 drive->name, (pio & 1) ? "en" : "dis"); in cmd640_set_pio_mode()
601 cycle_time = ide_pio_cycle_time(drive, pio); in cmd640_set_pio_mode()
602 cmd640_set_mode(drive, index, pio, cycle_time); in cmd640_set_pio_mode()
604 printk("%s: selected cmd640 PIO mode%d (%dns)", in cmd640_set_pio_mode()
605 drive->name, pio, cycle_time); in cmd640_set_pio_mode()
611 static void __init cmd640_init_dev(ide_drive_t *drive) in cmd640_init_dev() argument
613 unsigned int i = drive->hwif->channel * 2 + (drive->dn & 1); in cmd640_init_dev()
618 * This way, the drive identify code has a better chance. in cmd640_init_dev()
623 program_drive_counts(drive, i); in cmd640_init_dev()
624 set_prefetch_mode(drive, i, 0); in cmd640_init_dev()
625 printk(KERN_INFO DRV_NAME ": drive%d timings/prefetch cleared\n", i); in cmd640_init_dev()
628 * Set the drive unmask flags to match the prefetch setting. in cmd640_init_dev()
630 check_prefetch(drive, i); in cmd640_init_dev()
631 printk(KERN_INFO DRV_NAME ": drive%d timings/prefetch(%s) preserved\n", in cmd640_init_dev()
632 i, (drive->dev_flags & IDE_DFLAG_NO_IO_32BIT) ? "off" : "on"); in cmd640_init_dev()
638 int irq_reg = hwif->channel ? ARTTIM23 : CFR; in cmd640_test_irq()
639 u8 irq_mask = hwif->channel ? ARTTIM23_IDE23INTR : in cmd640_test_irq()
702 printk(KERN_ERR "%s: I/O resource 0x%lX-0x%lX not free.\n", in cmd640x_init_one()
704 return -EBUSY; in cmd640x_init_one()
711 return -EBUSY; in cmd640x_init_one()
784 "\n", 'a' + cmd640_chip_version - 1, bus_type, cfr); in cmd640x_init()
793 * for access to the drive's command register block, in cmd640x_init()