aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/ata/pata_sl82c105.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/ata/pata_sl82c105.c')
-rw-r--r--drivers/ata/pata_sl82c105.c48
1 files changed, 24 insertions, 24 deletions
diff --git a/drivers/ata/pata_sl82c105.c b/drivers/ata/pata_sl82c105.c
index 47b290b5604a..f8499786917a 100644
--- a/drivers/ata/pata_sl82c105.c
+++ b/drivers/ata/pata_sl82c105.c
@@ -8,7 +8,7 @@
8 * 8 *
9 * and in part on the documentation and errata sheet 9 * and in part on the documentation and errata sheet
10 */ 10 */
11 11
12#include <linux/kernel.h> 12#include <linux/kernel.h>
13#include <linux/module.h> 13#include <linux/module.h>
14#include <linux/pci.h> 14#include <linux/pci.h>
@@ -40,7 +40,7 @@ enum {
40 * 40 *
41 * Set up cable type and use generic probe init 41 * Set up cable type and use generic probe init
42 */ 42 */
43 43
44static int sl82c105_pre_reset(struct ata_port *ap) 44static int sl82c105_pre_reset(struct ata_port *ap)
45{ 45{
46 static const struct pci_bits sl82c105_enable_bits[] = { 46 static const struct pci_bits sl82c105_enable_bits[] = {
@@ -75,7 +75,7 @@ static void sl82c105_error_handler(struct ata_port *ap)
75 * so a configure_dmamode call will undo any work we do here and vice 75 * so a configure_dmamode call will undo any work we do here and vice
76 * versa 76 * versa
77 */ 77 */
78 78
79static void sl82c105_configure_piomode(struct ata_port *ap, struct ata_device *adev, int pio) 79static void sl82c105_configure_piomode(struct ata_port *ap, struct ata_device *adev, int pio)
80{ 80{
81 struct pci_dev *pdev = to_pci_dev(ap->host->dev); 81 struct pci_dev *pdev = to_pci_dev(ap->host->dev);
@@ -84,7 +84,7 @@ static void sl82c105_configure_piomode(struct ata_port *ap, struct ata_device *a
84 }; 84 };
85 u16 dummy; 85 u16 dummy;
86 int timing = 0x44 + (8 * ap->port_no) + (4 * adev->devno); 86 int timing = 0x44 + (8 * ap->port_no) + (4 * adev->devno);
87 87
88 pci_write_config_word(pdev, timing, pio_timing[pio]); 88 pci_write_config_word(pdev, timing, pio_timing[pio]);
89 /* Can we lose this oddity of the old driver */ 89 /* Can we lose this oddity of the old driver */
90 pci_read_config_word(pdev, timing, &dummy); 90 pci_read_config_word(pdev, timing, &dummy);
@@ -98,7 +98,7 @@ static void sl82c105_configure_piomode(struct ata_port *ap, struct ata_device *a
98 * Called to do the PIO mode setup. Our timing registers are shared 98 * Called to do the PIO mode setup. Our timing registers are shared
99 * but we want to set the PIO timing by default. 99 * but we want to set the PIO timing by default.
100 */ 100 */
101 101
102static void sl82c105_set_piomode(struct ata_port *ap, struct ata_device *adev) 102static void sl82c105_set_piomode(struct ata_port *ap, struct ata_device *adev)
103{ 103{
104 sl82c105_configure_piomode(ap, adev, adev->pio_mode - XFER_PIO_0); 104 sl82c105_configure_piomode(ap, adev, adev->pio_mode - XFER_PIO_0);
@@ -112,7 +112,7 @@ static void sl82c105_set_piomode(struct ata_port *ap, struct ata_device *adev)
112 * Load DMA cycle times into the chip ready for a DMA transfer 112 * Load DMA cycle times into the chip ready for a DMA transfer
113 * to occur. 113 * to occur.
114 */ 114 */
115 115
116static void sl82c105_configure_dmamode(struct ata_port *ap, struct ata_device *adev) 116static void sl82c105_configure_dmamode(struct ata_port *ap, struct ata_device *adev)
117{ 117{
118 struct pci_dev *pdev = to_pci_dev(ap->host->dev); 118 struct pci_dev *pdev = to_pci_dev(ap->host->dev);
@@ -122,7 +122,7 @@ static void sl82c105_configure_dmamode(struct ata_port *ap, struct ata_device *a
122 u16 dummy; 122 u16 dummy;
123 int timing = 0x44 + (8 * ap->port_no) + (4 * adev->devno); 123 int timing = 0x44 + (8 * ap->port_no) + (4 * adev->devno);
124 int dma = adev->dma_mode - XFER_MW_DMA_0; 124 int dma = adev->dma_mode - XFER_MW_DMA_0;
125 125
126 pci_write_config_word(pdev, timing, dma_timing[dma]); 126 pci_write_config_word(pdev, timing, dma_timing[dma]);
127 /* Can we lose this oddity of the old driver */ 127 /* Can we lose this oddity of the old driver */
128 pci_read_config_word(pdev, timing, &dummy); 128 pci_read_config_word(pdev, timing, &dummy);
@@ -137,7 +137,7 @@ static void sl82c105_configure_dmamode(struct ata_port *ap, struct ata_device *a
137 * for the device in question. Set appropriate PIO timings not DMA 137 * for the device in question. Set appropriate PIO timings not DMA
138 * timings at this point. 138 * timings at this point.
139 */ 139 */
140 140
141static void sl82c105_set_dmamode(struct ata_port *ap, struct ata_device *adev) 141static void sl82c105_set_dmamode(struct ata_port *ap, struct ata_device *adev)
142{ 142{
143 switch(adev->dma_mode) { 143 switch(adev->dma_mode) {
@@ -152,7 +152,7 @@ static void sl82c105_set_dmamode(struct ata_port *ap, struct ata_device *adev)
152 break; 152 break;
153 default: 153 default:
154 BUG(); 154 BUG();
155 } 155 }
156} 156}
157 157
158/** 158/**
@@ -160,16 +160,16 @@ static void sl82c105_set_dmamode(struct ata_port *ap, struct ata_device *adev)
160 * @ap: ATA interface 160 * @ap: ATA interface
161 * 161 *
162 * The sl82c105 has some serious problems with the DMA engine 162 * The sl82c105 has some serious problems with the DMA engine
163 * when transfers don't run as expected or ATAPI is used. The 163 * when transfers don't run as expected or ATAPI is used. The
164 * recommended fix is to reset the engine each use using a chip 164 * recommended fix is to reset the engine each use using a chip
165 * test register. 165 * test register.
166 */ 166 */
167 167
168static void sl82c105_reset_engine(struct ata_port *ap) 168static void sl82c105_reset_engine(struct ata_port *ap)
169{ 169{
170 struct pci_dev *pdev = to_pci_dev(ap->host->dev); 170 struct pci_dev *pdev = to_pci_dev(ap->host->dev);
171 u16 val; 171 u16 val;
172 172
173 pci_read_config_word(pdev, 0x7E, &val); 173 pci_read_config_word(pdev, 0x7E, &val);
174 pci_write_config_word(pdev, 0x7E, val | 4); 174 pci_write_config_word(pdev, 0x7E, val | 4);
175 pci_write_config_word(pdev, 0x7E, val & ~4); 175 pci_write_config_word(pdev, 0x7E, val & ~4);
@@ -180,21 +180,21 @@ static void sl82c105_reset_engine(struct ata_port *ap)
180 * @qc: ATA command 180 * @qc: ATA command
181 * 181 *
182 * Reset the DMA engine each use as recommended by the errata 182 * Reset the DMA engine each use as recommended by the errata
183 * document. 183 * document.
184 * 184 *
185 * FIXME: if we switch clock at BMDMA start/end we might get better 185 * FIXME: if we switch clock at BMDMA start/end we might get better
186 * PIO performance on DMA capable devices. 186 * PIO performance on DMA capable devices.
187 */ 187 */
188 188
189static void sl82c105_bmdma_start(struct ata_queued_cmd *qc) 189static void sl82c105_bmdma_start(struct ata_queued_cmd *qc)
190{ 190{
191 struct ata_port *ap = qc->ap; 191 struct ata_port *ap = qc->ap;
192 192
193 sl82c105_reset_engine(ap); 193 sl82c105_reset_engine(ap);
194 194
195 /* Set the clocks for DMA */ 195 /* Set the clocks for DMA */
196 sl82c105_configure_dmamode(ap, qc->dev); 196 sl82c105_configure_dmamode(ap, qc->dev);
197 /* Activate DMA */ 197 /* Activate DMA */
198 ata_bmdma_start(qc); 198 ata_bmdma_start(qc);
199} 199}
200 200
@@ -212,14 +212,14 @@ static void sl82c105_bmdma_start(struct ata_queued_cmd *qc)
212 * We assume bmdma_stop is always called if bmdma_start as called. If 212 * We assume bmdma_stop is always called if bmdma_start as called. If
213 * not then we may need to wrap qc_issue. 213 * not then we may need to wrap qc_issue.
214 */ 214 */
215 215
216static void sl82c105_bmdma_stop(struct ata_queued_cmd *qc) 216static void sl82c105_bmdma_stop(struct ata_queued_cmd *qc)
217{ 217{
218 struct ata_port *ap = qc->ap; 218 struct ata_port *ap = qc->ap;
219 219
220 ata_bmdma_stop(qc); 220 ata_bmdma_stop(qc);
221 sl82c105_reset_engine(ap); 221 sl82c105_reset_engine(ap);
222 222
223 /* This will redo the initial setup of the DMA device to matching 223 /* This will redo the initial setup of the DMA device to matching
224 PIO timings */ 224 PIO timings */
225 sl82c105_set_dmamode(ap, qc->dev); 225 sl82c105_set_dmamode(ap, qc->dev);
@@ -269,11 +269,11 @@ static struct ata_port_operations sl82c105_port_ops = {
269 269
270 .irq_handler = ata_interrupt, 270 .irq_handler = ata_interrupt,
271 .irq_clear = ata_bmdma_irq_clear, 271 .irq_clear = ata_bmdma_irq_clear,
272 272
273 .port_start = ata_port_start, 273 .port_start = ata_port_start,
274 .port_stop = ata_port_stop, 274 .port_stop = ata_port_stop,
275 .host_stop = ata_host_stop 275 .host_stop = ata_host_stop
276}; 276};
277 277
278/** 278/**
279 * sl82c105_bridge_revision - find bridge version 279 * sl82c105_bridge_revision - find bridge version
@@ -283,7 +283,7 @@ static struct ata_port_operations sl82c105_port_ops = {
283 * providing it is a Winbond 553 reports the revision. If it cannot 283 * providing it is a Winbond 553 reports the revision. If it cannot
284 * find a revision or the right device it returns -1 284 * find a revision or the right device it returns -1
285 */ 285 */
286 286
287static int sl82c105_bridge_revision(struct pci_dev *pdev) 287static int sl82c105_bridge_revision(struct pci_dev *pdev)
288{ 288{
289 struct pci_dev *bridge; 289 struct pci_dev *bridge;
@@ -315,7 +315,7 @@ static int sl82c105_bridge_revision(struct pci_dev *pdev)
315 return rev; 315 return rev;
316} 316}
317 317
318 318
319static int sl82c105_init_one(struct pci_dev *dev, const struct pci_device_id *id) 319static int sl82c105_init_one(struct pci_dev *dev, const struct pci_device_id *id)
320{ 320{
321 static struct ata_port_info info_dma = { 321 static struct ata_port_info info_dma = {
@@ -336,7 +336,7 @@ static int sl82c105_init_one(struct pci_dev *dev, const struct pci_device_id *id
336 int rev; 336 int rev;
337 337
338 rev = sl82c105_bridge_revision(dev); 338 rev = sl82c105_bridge_revision(dev);
339 339
340 if (rev == -1) 340 if (rev == -1)
341 dev_printk(KERN_WARNING, &dev->dev, "pata_sl82c105: Unable to find bridge, disabling DMA.\n"); 341 dev_printk(KERN_WARNING, &dev->dev, "pata_sl82c105: Unable to find bridge, disabling DMA.\n");
342 else if (rev <= 5) 342 else if (rev <= 5)
@@ -345,7 +345,7 @@ static int sl82c105_init_one(struct pci_dev *dev, const struct pci_device_id *id
345 port_info[0] = &info_dma; 345 port_info[0] = &info_dma;
346 port_info[1] = &info_dma; 346 port_info[1] = &info_dma;
347 } 347 }
348 348
349 pci_read_config_dword(dev, 0x40, &val); 349 pci_read_config_dword(dev, 0x40, &val);
350 val |= CTRL_P0EN | CTRL_P0F16 | CTRL_P1F16; 350 val |= CTRL_P0EN | CTRL_P0F16 | CTRL_P1F16;
351 pci_write_config_dword(dev, 0x40, val); 351 pci_write_config_dword(dev, 0x40, val);