aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux
diff options
context:
space:
mode:
authorAlan Cox <alan@lxorguk.ukuu.org.uk>2005-10-21 19:01:32 -0400
committerJeff Garzik <jgarzik@pobox.com>2005-10-21 19:01:32 -0400
commit452503f993feffe96e8cc9fbff4888b96e2c5e40 (patch)
tree83163004da490ea8521ec753df71121b62de200a /include/linux
parent11e29e21514517f3022a1f30998ac4c7b1197658 (diff)
Add ide-timing functionality to libata.
This is needed for full AMD and VIA drivers and possibly more. Functions to turn actual clocking and cycle timings into register values. Also to merge shared timings to compute an optimal timing set. Built from the drivers/ide version by Vojtech Pavlik Signed-off-by: Alan Cox <alan@redhat.com> Signed-off-by: Jeff Garzik <jgarzik@pobox.com>
Diffstat (limited to 'include/linux')
-rw-r--r--include/linux/libata.h39
1 files changed, 39 insertions, 0 deletions
diff --git a/include/linux/libata.h b/include/linux/libata.h
index 0261c55f3483..0e214f8c8f9f 100644
--- a/include/linux/libata.h
+++ b/include/linux/libata.h
@@ -388,6 +388,19 @@ struct ata_port_info {
388 struct ata_port_operations *port_ops; 388 struct ata_port_operations *port_ops;
389}; 389};
390 390
391struct ata_timing {
392 unsigned short mode; /* ATA mode */
393 unsigned short setup; /* t1 */
394 unsigned short act8b; /* t2 for 8-bit I/O */
395 unsigned short rec8b; /* t2i for 8-bit I/O */
396 unsigned short cyc8b; /* t0 for 8-bit I/O */
397 unsigned short active; /* t2 or tD */
398 unsigned short recover; /* t2i or tK */
399 unsigned short cycle; /* t0 */
400 unsigned short udma; /* t2CYCTYP/2 */
401};
402
403#define FIT(v,vmin,vmax) max_t(short,min_t(short,v,vmax),vmin)
391 404
392extern void ata_port_probe(struct ata_port *); 405extern void ata_port_probe(struct ata_port *);
393extern void __sata_phy_reset(struct ata_port *ap); 406extern void __sata_phy_reset(struct ata_port *ap);
@@ -451,6 +464,32 @@ extern int ata_std_bios_param(struct scsi_device *sdev,
451 sector_t capacity, int geom[]); 464 sector_t capacity, int geom[]);
452extern int ata_scsi_slave_config(struct scsi_device *sdev); 465extern int ata_scsi_slave_config(struct scsi_device *sdev);
453 466
467/*
468 * Timing helpers
469 */
470extern int ata_timing_compute(struct ata_device *, unsigned short,
471 struct ata_timing *, int, int);
472extern void ata_timing_merge(const struct ata_timing *,
473 const struct ata_timing *, struct ata_timing *,
474 unsigned int);
475
476enum {
477 ATA_TIMING_SETUP = (1 << 0),
478 ATA_TIMING_ACT8B = (1 << 1),
479 ATA_TIMING_REC8B = (1 << 2),
480 ATA_TIMING_CYC8B = (1 << 3),
481 ATA_TIMING_8BIT = ATA_TIMING_ACT8B | ATA_TIMING_REC8B |
482 ATA_TIMING_CYC8B,
483 ATA_TIMING_ACTIVE = (1 << 4),
484 ATA_TIMING_RECOVER = (1 << 5),
485 ATA_TIMING_CYCLE = (1 << 6),
486 ATA_TIMING_UDMA = (1 << 7),
487 ATA_TIMING_ALL = ATA_TIMING_SETUP | ATA_TIMING_ACT8B |
488 ATA_TIMING_REC8B | ATA_TIMING_CYC8B |
489 ATA_TIMING_ACTIVE | ATA_TIMING_RECOVER |
490 ATA_TIMING_CYCLE | ATA_TIMING_UDMA,
491};
492
454 493
455#ifdef CONFIG_PCI 494#ifdef CONFIG_PCI
456struct pci_bits { 495struct pci_bits {