diff options
Diffstat (limited to 'drivers/ide/pci/hpt34x.c')
-rw-r--r-- | drivers/ide/pci/hpt34x.c | 42 |
1 files changed, 7 insertions, 35 deletions
diff --git a/drivers/ide/pci/hpt34x.c b/drivers/ide/pci/hpt34x.c index ce7b08f08a09..924eaa3a5708 100644 --- a/drivers/ide/pci/hpt34x.c +++ b/drivers/ide/pci/hpt34x.c | |||
@@ -48,19 +48,6 @@ static u8 hpt34x_ratemask (ide_drive_t *drive) | |||
48 | return 1; | 48 | return 1; |
49 | } | 49 | } |
50 | 50 | ||
51 | static void hpt34x_clear_chipset (ide_drive_t *drive) | ||
52 | { | ||
53 | struct pci_dev *dev = HWIF(drive)->pci_dev; | ||
54 | u32 reg1 = 0, tmp1 = 0, reg2 = 0, tmp2 = 0; | ||
55 | |||
56 | pci_read_config_dword(dev, 0x44, ®1); | ||
57 | pci_read_config_dword(dev, 0x48, ®2); | ||
58 | tmp1 = ((0x00 << (3*drive->dn)) | (reg1 & ~(7 << (3*drive->dn)))); | ||
59 | tmp2 = (reg2 & ~(0x11 << drive->dn)); | ||
60 | pci_write_config_dword(dev, 0x44, tmp1); | ||
61 | pci_write_config_dword(dev, 0x48, tmp2); | ||
62 | } | ||
63 | |||
64 | static int hpt34x_tune_chipset (ide_drive_t *drive, u8 xferspeed) | 51 | static int hpt34x_tune_chipset (ide_drive_t *drive, u8 xferspeed) |
65 | { | 52 | { |
66 | struct pci_dev *dev = HWIF(drive)->pci_dev; | 53 | struct pci_dev *dev = HWIF(drive)->pci_dev; |
@@ -81,7 +68,7 @@ static int hpt34x_tune_chipset (ide_drive_t *drive, u8 xferspeed) | |||
81 | pci_read_config_dword(dev, 0x44, ®1); | 68 | pci_read_config_dword(dev, 0x44, ®1); |
82 | pci_read_config_dword(dev, 0x48, ®2); | 69 | pci_read_config_dword(dev, 0x48, ®2); |
83 | tmp1 = ((lo_speed << (3*drive->dn)) | (reg1 & ~(7 << (3*drive->dn)))); | 70 | tmp1 = ((lo_speed << (3*drive->dn)) | (reg1 & ~(7 << (3*drive->dn)))); |
84 | tmp2 = ((hi_speed << drive->dn) | reg2); | 71 | tmp2 = ((hi_speed << drive->dn) | (reg2 & ~(0x11 << drive->dn))); |
85 | pci_write_config_dword(dev, 0x44, tmp1); | 72 | pci_write_config_dword(dev, 0x44, tmp1); |
86 | pci_write_config_dword(dev, 0x48, tmp2); | 73 | pci_write_config_dword(dev, 0x48, tmp2); |
87 | 74 | ||
@@ -99,7 +86,6 @@ static int hpt34x_tune_chipset (ide_drive_t *drive, u8 xferspeed) | |||
99 | static void hpt34x_tune_drive (ide_drive_t *drive, u8 pio) | 86 | static void hpt34x_tune_drive (ide_drive_t *drive, u8 pio) |
100 | { | 87 | { |
101 | pio = ide_get_best_pio_mode(drive, pio, 5, NULL); | 88 | pio = ide_get_best_pio_mode(drive, pio, 5, NULL); |
102 | hpt34x_clear_chipset(drive); | ||
103 | (void) hpt34x_tune_chipset(drive, (XFER_PIO_0 + pio)); | 89 | (void) hpt34x_tune_chipset(drive, (XFER_PIO_0 + pio)); |
104 | } | 90 | } |
105 | 91 | ||
@@ -117,38 +103,25 @@ static int config_chipset_for_dma (ide_drive_t *drive) | |||
117 | if (!(speed)) | 103 | if (!(speed)) |
118 | return 0; | 104 | return 0; |
119 | 105 | ||
120 | hpt34x_clear_chipset(drive); | ||
121 | (void) hpt34x_tune_chipset(drive, speed); | 106 | (void) hpt34x_tune_chipset(drive, speed); |
122 | return ide_dma_enable(drive); | 107 | return ide_dma_enable(drive); |
123 | } | 108 | } |
124 | 109 | ||
125 | static int hpt34x_config_drive_xfer_rate (ide_drive_t *drive) | 110 | static int hpt34x_config_drive_xfer_rate (ide_drive_t *drive) |
126 | { | 111 | { |
127 | ide_hwif_t *hwif = HWIF(drive); | ||
128 | struct hd_driveid *id = drive->id; | ||
129 | |||
130 | drive->init_speed = 0; | 112 | drive->init_speed = 0; |
131 | 113 | ||
132 | if (id && (id->capability & 1) && drive->autodma) { | 114 | if (ide_use_dma(drive) && config_chipset_for_dma(drive)) |
133 | |||
134 | if (ide_use_dma(drive)) { | ||
135 | if (config_chipset_for_dma(drive)) | ||
136 | #ifndef CONFIG_HPT34X_AUTODMA | 115 | #ifndef CONFIG_HPT34X_AUTODMA |
137 | return hwif->ide_dma_off_quietly(drive); | 116 | return -1; |
138 | #else | 117 | #else |
139 | return hwif->ide_dma_on(drive); | 118 | return 0; |
140 | #endif | 119 | #endif |
141 | } | ||
142 | |||
143 | goto fast_ata_pio; | ||
144 | 120 | ||
145 | } else if ((id->capability & 8) || (id->field_valid & 2)) { | 121 | if (ide_use_fast_pio(drive)) |
146 | fast_ata_pio: | ||
147 | hpt34x_tune_drive(drive, 255); | 122 | hpt34x_tune_drive(drive, 255); |
148 | return hwif->ide_dma_off_quietly(drive); | 123 | |
149 | } | 124 | return -1; |
150 | /* IORDY not supported */ | ||
151 | return 0; | ||
152 | } | 125 | } |
153 | 126 | ||
154 | /* | 127 | /* |
@@ -209,7 +182,6 @@ static void __devinit init_hwif_hpt34x(ide_hwif_t *hwif) | |||
209 | 182 | ||
210 | hwif->tuneproc = &hpt34x_tune_drive; | 183 | hwif->tuneproc = &hpt34x_tune_drive; |
211 | hwif->speedproc = &hpt34x_tune_chipset; | 184 | hwif->speedproc = &hpt34x_tune_chipset; |
212 | hwif->no_dsc = 1; | ||
213 | hwif->drives[0].autotune = 1; | 185 | hwif->drives[0].autotune = 1; |
214 | hwif->drives[1].autotune = 1; | 186 | hwif->drives[1].autotune = 1; |
215 | 187 | ||