pata_hpt3x2n.c (5a84d159061d914c8dd4aa372ac6e9529c2be453) | pata_hpt3x2n.c (a0fcdc0259e98d1c16d96baea9ba8a8603e41791) |
---|---|
1/* 2 * Libata driver for the highpoint 372N and 302N UDMA66 ATA controllers. 3 * 4 * This driver is heavily based upon: 5 * 6 * linux/drivers/ide/pci/hpt366.c Version 0.36 April 25, 2003 7 * 8 * Copyright (C) 1999-2003 Andre Hedrick <andre@linux-ide.org> --- 11 unchanged lines hidden (view full) --- 20#include <linux/pci.h> 21#include <linux/init.h> 22#include <linux/blkdev.h> 23#include <linux/delay.h> 24#include <scsi/scsi_host.h> 25#include <linux/libata.h> 26 27#define DRV_NAME "pata_hpt3x2n" | 1/* 2 * Libata driver for the highpoint 372N and 302N UDMA66 ATA controllers. 3 * 4 * This driver is heavily based upon: 5 * 6 * linux/drivers/ide/pci/hpt366.c Version 0.36 April 25, 2003 7 * 8 * Copyright (C) 1999-2003 Andre Hedrick <andre@linux-ide.org> --- 11 unchanged lines hidden (view full) --- 20#include <linux/pci.h> 21#include <linux/init.h> 22#include <linux/blkdev.h> 23#include <linux/delay.h> 24#include <scsi/scsi_host.h> 25#include <linux/libata.h> 26 27#define DRV_NAME "pata_hpt3x2n" |
28#define DRV_VERSION "0.3.2" | 28#define DRV_VERSION "0.3.3" |
29 30enum { 31 HPT_PCI_FAST = (1 << 31), 32 PCI66 = (1 << 1), 33 USE_DPLL = (1 << 0) 34}; 35 36struct hpt_clock { --- 73 unchanged lines hidden (view full) --- 110 return clocks->timing; 111 clocks++; 112 } 113 BUG(); 114 return 0xffffffffU; /* silence compiler warning */ 115} 116 117/** | 29 30enum { 31 HPT_PCI_FAST = (1 << 31), 32 PCI66 = (1 << 1), 33 USE_DPLL = (1 << 0) 34}; 35 36struct hpt_clock { --- 73 unchanged lines hidden (view full) --- 110 return clocks->timing; 111 clocks++; 112 } 113 BUG(); 114 return 0xffffffffU; /* silence compiler warning */ 115} 116 117/** |
118 * hpt3x2n_pre_reset - reset the hpt3x2n bus 119 * @ap: ATA port to reset | 118 * hpt3x2n_cable_detect - Detect the cable type 119 * @ap: ATA port to detect on |
120 * | 120 * |
121 * Perform the initial reset handling for the 3x2n series controllers. 122 * Reset the hardware and state machine, obtain the cable type. | 121 * Return the cable type attached to this port |
123 */ 124 | 122 */ 123 |
125static int hpt3xn_pre_reset(struct ata_port *ap) | 124static int hpt3x2n_cable_detect(struct ata_port *ap) |
126{ 127 u8 scr2, ata66; 128 struct pci_dev *pdev = to_pci_dev(ap->host->dev); 129 130 pci_read_config_byte(pdev, 0x5B, &scr2); 131 pci_write_config_byte(pdev, 0x5B, scr2 & ~0x01); 132 /* Cable register now active */ 133 pci_read_config_byte(pdev, 0x5A, &ata66); 134 /* Restore state */ 135 pci_write_config_byte(pdev, 0x5B, scr2); 136 137 if (ata66 & (1 << ap->port_no)) | 125{ 126 u8 scr2, ata66; 127 struct pci_dev *pdev = to_pci_dev(ap->host->dev); 128 129 pci_read_config_byte(pdev, 0x5B, &scr2); 130 pci_write_config_byte(pdev, 0x5B, scr2 & ~0x01); 131 /* Cable register now active */ 132 pci_read_config_byte(pdev, 0x5A, &ata66); 133 /* Restore state */ 134 pci_write_config_byte(pdev, 0x5B, scr2); 135 136 if (ata66 & (1 << ap->port_no)) |
138 ap->cbl = ATA_CBL_PATA40; | 137 return ATA_CBL_PATA40; |
139 else | 138 else |
140 ap->cbl = ATA_CBL_PATA80; | 139 return ATA_CBL_PATA80; 140} |
141 | 141 |
142/** 143 * hpt3x2n_pre_reset - reset the hpt3x2n bus 144 * @ap: ATA port to reset 145 * 146 * Perform the initial reset handling for the 3x2n series controllers. 147 * Reset the hardware and state machine, 148 */ 149 150static int hpt3xn_pre_reset(struct ata_port *ap) 151{ 152 struct pci_dev *pdev = to_pci_dev(ap->host->dev); |
|
142 /* Reset the state machine */ 143 pci_write_config_byte(pdev, 0x50, 0x37); 144 pci_write_config_byte(pdev, 0x54, 0x37); 145 udelay(100); | 153 /* Reset the state machine */ 154 pci_write_config_byte(pdev, 0x50, 0x37); 155 pci_write_config_byte(pdev, 0x54, 0x37); 156 udelay(100); |
146 | |
147 return ata_std_prereset(ap); 148} 149 150/** 151 * hpt3x2n_error_handler - probe the hpt3x2n bus 152 * @ap: ATA port to reset 153 * 154 * Perform the probe reset handling for the 3x2N --- 204 unchanged lines hidden (view full) --- 359 .check_status = ata_check_status, 360 .exec_command = ata_exec_command, 361 .dev_select = ata_std_dev_select, 362 363 .freeze = ata_bmdma_freeze, 364 .thaw = ata_bmdma_thaw, 365 .error_handler = hpt3x2n_error_handler, 366 .post_internal_cmd = ata_bmdma_post_internal_cmd, | 157 return ata_std_prereset(ap); 158} 159 160/** 161 * hpt3x2n_error_handler - probe the hpt3x2n bus 162 * @ap: ATA port to reset 163 * 164 * Perform the probe reset handling for the 3x2N --- 204 unchanged lines hidden (view full) --- 369 .check_status = ata_check_status, 370 .exec_command = ata_exec_command, 371 .dev_select = ata_std_dev_select, 372 373 .freeze = ata_bmdma_freeze, 374 .thaw = ata_bmdma_thaw, 375 .error_handler = hpt3x2n_error_handler, 376 .post_internal_cmd = ata_bmdma_post_internal_cmd, |
377 .cable_detect = hpt3x2n_cable_detect, |
|
367 368 .bmdma_setup = ata_bmdma_setup, 369 .bmdma_start = ata_bmdma_start, 370 .bmdma_stop = hpt3x2n_bmdma_stop, 371 .bmdma_status = ata_bmdma_status, 372 373 .qc_prep = ata_qc_prep, 374 .qc_issue = hpt3x2n_qc_issue_prot, --- 222 unchanged lines hidden --- | 378 379 .bmdma_setup = ata_bmdma_setup, 380 .bmdma_start = ata_bmdma_start, 381 .bmdma_stop = hpt3x2n_bmdma_stop, 382 .bmdma_status = ata_bmdma_status, 383 384 .qc_prep = ata_qc_prep, 385 .qc_issue = hpt3x2n_qc_issue_prot, --- 222 unchanged lines hidden --- |