aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/ata/pata_pdc202xx_old.c
diff options
context:
space:
mode:
authorJeff Garzik <jeff@garzik.org>2006-08-31 00:03:49 -0400
committerJeff Garzik <jeff@garzik.org>2006-08-31 00:03:49 -0400
commit85cd7251b9112e3dabeac9fd3b175601ca607241 (patch)
treeb33b80f54883e224a586661165bd0aee2c47ed39 /drivers/ata/pata_pdc202xx_old.c
parent481ff126e8d9be63809e7854badf815e54066eed (diff)
[libata #pata-drivers] Trim trailing whitespace.
Diffstat (limited to 'drivers/ata/pata_pdc202xx_old.c')
-rw-r--r--drivers/ata/pata_pdc202xx_old.c64
1 files changed, 32 insertions, 32 deletions
diff --git a/drivers/ata/pata_pdc202xx_old.c b/drivers/ata/pata_pdc202xx_old.c
index 6cb52b0e7696..48f43432764e 100644
--- a/drivers/ata/pata_pdc202xx_old.c
+++ b/drivers/ata/pata_pdc202xx_old.c
@@ -10,7 +10,7 @@
10 * TODO: 10 * TODO:
11 * Channel interlock/reset on both required ? 11 * Channel interlock/reset on both required ?
12 */ 12 */
13 13
14#include <linux/kernel.h> 14#include <linux/kernel.h>
15#include <linux/module.h> 15#include <linux/module.h>
16#include <linux/pci.h> 16#include <linux/pci.h>
@@ -29,7 +29,7 @@
29 * 29 *
30 * Set up cable type and use generic probe init 30 * Set up cable type and use generic probe init
31 */ 31 */
32 32
33static int pdc2024x_pre_reset(struct ata_port *ap) 33static int pdc2024x_pre_reset(struct ata_port *ap)
34{ 34{
35 ap->cbl = ATA_CBL_PATA40; 35 ap->cbl = ATA_CBL_PATA40;
@@ -47,7 +47,7 @@ static int pdc2026x_pre_reset(struct ata_port *ap)
47{ 47{
48 struct pci_dev *pdev = to_pci_dev(ap->host->dev); 48 struct pci_dev *pdev = to_pci_dev(ap->host->dev);
49 u16 cis; 49 u16 cis;
50 50
51 pci_read_config_word(pdev, 0x50, &cis); 51 pci_read_config_word(pdev, 0x50, &cis);
52 if (cis & (1 << (10 + ap->port_no))) 52 if (cis & (1 << (10 + ap->port_no)))
53 ap->cbl = ATA_CBL_PATA80; 53 ap->cbl = ATA_CBL_PATA80;
@@ -72,7 +72,7 @@ static void pdc2026x_error_handler(struct ata_port *ap)
72 * so a configure_dmamode call will undo any work we do here and vice 72 * so a configure_dmamode call will undo any work we do here and vice
73 * versa 73 * versa
74 */ 74 */
75 75
76static void pdc_configure_piomode(struct ata_port *ap, struct ata_device *adev, int pio) 76static void pdc_configure_piomode(struct ata_port *ap, struct ata_device *adev, int pio)
77{ 77{
78 struct pci_dev *pdev = to_pci_dev(ap->host->dev); 78 struct pci_dev *pdev = to_pci_dev(ap->host->dev);
@@ -88,7 +88,7 @@ static void pdc_configure_piomode(struct ata_port *ap, struct ata_device *adev,
88 r_bp &= ~0x07; 88 r_bp &= ~0x07;
89 r_ap |= (pio_timing[pio] >> 8); 89 r_ap |= (pio_timing[pio] >> 8);
90 r_bp |= (pio_timing[pio] & 0xFF); 90 r_bp |= (pio_timing[pio] & 0xFF);
91 91
92 if (ata_pio_need_iordy(adev)) 92 if (ata_pio_need_iordy(adev))
93 r_ap |= 0x20; /* IORDY enable */ 93 r_ap |= 0x20; /* IORDY enable */
94 if (adev->class == ATA_DEV_ATA) 94 if (adev->class == ATA_DEV_ATA)
@@ -105,7 +105,7 @@ static void pdc_configure_piomode(struct ata_port *ap, struct ata_device *adev,
105 * Called to do the PIO mode setup. Our timing registers are shared 105 * Called to do the PIO mode setup. Our timing registers are shared
106 * but we want to set the PIO timing by default. 106 * but we want to set the PIO timing by default.
107 */ 107 */
108 108
109static void pdc_set_piomode(struct ata_port *ap, struct ata_device *adev) 109static void pdc_set_piomode(struct ata_port *ap, struct ata_device *adev)
110{ 110{
111 pdc_configure_piomode(ap, adev, adev->pio_mode - XFER_PIO_0); 111 pdc_configure_piomode(ap, adev, adev->pio_mode - XFER_PIO_0);
@@ -119,7 +119,7 @@ static void pdc_set_piomode(struct ata_port *ap, struct ata_device *adev)
119 * Load DMA cycle times into the chip ready for a DMA transfer 119 * Load DMA cycle times into the chip ready for a DMA transfer
120 * to occur. 120 * to occur.
121 */ 121 */
122 122
123static void pdc_set_dmamode(struct ata_port *ap, struct ata_device *adev) 123static void pdc_set_dmamode(struct ata_port *ap, struct ata_device *adev)
124{ 124{
125 struct pci_dev *pdev = to_pci_dev(ap->host->dev); 125 struct pci_dev *pdev = to_pci_dev(ap->host->dev);
@@ -130,21 +130,21 @@ static void pdc_set_dmamode(struct ata_port *ap, struct ata_device *adev)
130 { 0x20, 0x01 }, 130 { 0x20, 0x01 },
131 { 0x40, 0x02 }, /* 66 Mhz Clock */ 131 { 0x40, 0x02 }, /* 66 Mhz Clock */
132 { 0x20, 0x01 }, 132 { 0x20, 0x01 },
133 { 0x20, 0x01 } 133 { 0x20, 0x01 }
134 }; 134 };
135 u8 r_bp, r_cp; 135 u8 r_bp, r_cp;
136 136
137 pci_read_config_byte(pdev, port + 1, &r_bp); 137 pci_read_config_byte(pdev, port + 1, &r_bp);
138 pci_read_config_byte(pdev, port + 2, &r_cp); 138 pci_read_config_byte(pdev, port + 2, &r_cp);
139 139
140 r_bp &= ~0xF0; 140 r_bp &= ~0xF0;
141 r_cp &= ~0x0F; 141 r_cp &= ~0x0F;
142 142
143 if (adev->dma_mode >= XFER_UDMA_0) { 143 if (adev->dma_mode >= XFER_UDMA_0) {
144 int speed = adev->dma_mode - XFER_UDMA_0; 144 int speed = adev->dma_mode - XFER_UDMA_0;
145 r_bp |= udma_timing[speed][0]; 145 r_bp |= udma_timing[speed][0];
146 r_cp |= udma_timing[speed][1]; 146 r_cp |= udma_timing[speed][1];
147 147
148 } else { 148 } else {
149 int speed = adev->dma_mode - XFER_MW_DMA_0; 149 int speed = adev->dma_mode - XFER_MW_DMA_0;
150 r_bp |= 0x60; 150 r_bp |= 0x60;
@@ -152,7 +152,7 @@ static void pdc_set_dmamode(struct ata_port *ap, struct ata_device *adev)
152 } 152 }
153 pci_write_config_byte(pdev, port + 1, r_bp); 153 pci_write_config_byte(pdev, port + 1, r_bp);
154 pci_write_config_byte(pdev, port + 2, r_cp); 154 pci_write_config_byte(pdev, port + 2, r_cp);
155 155
156} 156}
157 157
158/** 158/**
@@ -162,7 +162,7 @@ static void pdc_set_dmamode(struct ata_port *ap, struct ata_device *adev)
162 * In UDMA3 or higher we have to clock switch for the duration of the 162 * In UDMA3 or higher we have to clock switch for the duration of the
163 * DMA transfer sequence. 163 * DMA transfer sequence.
164 */ 164 */
165 165
166static void pdc2026x_bmdma_start(struct ata_queued_cmd *qc) 166static void pdc2026x_bmdma_start(struct ata_queued_cmd *qc)
167{ 167{
168 struct ata_port *ap = qc->ap; 168 struct ata_port *ap = qc->ap;
@@ -173,16 +173,16 @@ static void pdc2026x_bmdma_start(struct ata_queued_cmd *qc)
173 unsigned long master = ap->host->ports[0]->ioaddr.bmdma_addr; 173 unsigned long master = ap->host->ports[0]->ioaddr.bmdma_addr;
174 unsigned long clock = master + 0x11; 174 unsigned long clock = master + 0x11;
175 unsigned long atapi_reg = master + 0x20 + (4 * ap->port_no); 175 unsigned long atapi_reg = master + 0x20 + (4 * ap->port_no);
176 176
177 u32 len; 177 u32 len;
178 178
179 /* Check we keep host level locking here */ 179 /* Check we keep host level locking here */
180 if (adev->dma_mode >= XFER_UDMA_2) 180 if (adev->dma_mode >= XFER_UDMA_2)
181 outb(inb(clock) | sel66, clock); 181 outb(inb(clock) | sel66, clock);
182 else 182 else
183 outb(inb(clock) & ~sel66, clock); 183 outb(inb(clock) & ~sel66, clock);
184 184
185 /* The DMA clocks may have been trashed by a reset. FIXME: make conditional 185 /* The DMA clocks may have been trashed by a reset. FIXME: make conditional
186 and move to qc_issue ? */ 186 and move to qc_issue ? */
187 pdc_set_dmamode(ap, qc->dev); 187 pdc_set_dmamode(ap, qc->dev);
188 188
@@ -193,16 +193,16 @@ static void pdc2026x_bmdma_start(struct ata_queued_cmd *qc)
193 len = qc->nsect * 512; 193 len = qc->nsect * 512;
194 else 194 else
195 len = qc->nbytes; 195 len = qc->nbytes;
196 196
197 if (tf->flags & ATA_TFLAG_WRITE) 197 if (tf->flags & ATA_TFLAG_WRITE)
198 len |= 0x06000000; 198 len |= 0x06000000;
199 else 199 else
200 len |= 0x05000000; 200 len |= 0x05000000;
201 201
202 outl(len, atapi_reg); 202 outl(len, atapi_reg);
203 } 203 }
204 204
205 /* Activate DMA */ 205 /* Activate DMA */
206 ata_bmdma_start(qc); 206 ata_bmdma_start(qc);
207} 207}
208 208
@@ -213,19 +213,19 @@ static void pdc2026x_bmdma_start(struct ata_queued_cmd *qc)
213 * After a DMA completes we need to put the clock back to 33MHz for 213 * After a DMA completes we need to put the clock back to 33MHz for
214 * PIO timings. 214 * PIO timings.
215 */ 215 */
216 216
217static void pdc2026x_bmdma_stop(struct ata_queued_cmd *qc) 217static void pdc2026x_bmdma_stop(struct ata_queued_cmd *qc)
218{ 218{
219 struct ata_port *ap = qc->ap; 219 struct ata_port *ap = qc->ap;
220 struct ata_device *adev = qc->dev; 220 struct ata_device *adev = qc->dev;
221 struct ata_taskfile *tf = &qc->tf; 221 struct ata_taskfile *tf = &qc->tf;
222 222
223 int sel66 = ap->port_no ? 0x08: 0x02; 223 int sel66 = ap->port_no ? 0x08: 0x02;
224 /* The clock bits are in the same register for both channels */ 224 /* The clock bits are in the same register for both channels */
225 unsigned long master = ap->host->ports[0]->ioaddr.bmdma_addr; 225 unsigned long master = ap->host->ports[0]->ioaddr.bmdma_addr;
226 unsigned long clock = master + 0x11; 226 unsigned long clock = master + 0x11;
227 unsigned long atapi_reg = master + 0x20 + (4 * ap->port_no); 227 unsigned long atapi_reg = master + 0x20 + (4 * ap->port_no);
228 228
229 /* Cases the state machine will not complete correctly */ 229 /* Cases the state machine will not complete correctly */
230 if (tf->protocol == ATA_PROT_ATAPI_DMA || ( tf->flags & ATA_TFLAG_LBA48)) { 230 if (tf->protocol == ATA_PROT_ATAPI_DMA || ( tf->flags & ATA_TFLAG_LBA48)) {
231 outl(0, atapi_reg); 231 outl(0, atapi_reg);
@@ -248,7 +248,7 @@ static void pdc2026x_bmdma_stop(struct ata_queued_cmd *qc)
248 * sizes to 8bit to avoid making the state engine on the 2026x cards 248 * sizes to 8bit to avoid making the state engine on the 2026x cards
249 * barf. 249 * barf.
250 */ 250 */
251 251
252static void pdc2026x_dev_config(struct ata_port *ap, struct ata_device *adev) 252static void pdc2026x_dev_config(struct ata_port *ap, struct ata_device *adev)
253{ 253{
254 adev->max_sectors = 256; 254 adev->max_sectors = 256;
@@ -299,11 +299,11 @@ static struct ata_port_operations pdc2024x_port_ops = {
299 299
300 .irq_handler = ata_interrupt, 300 .irq_handler = ata_interrupt,
301 .irq_clear = ata_bmdma_irq_clear, 301 .irq_clear = ata_bmdma_irq_clear,
302 302
303 .port_start = ata_port_start, 303 .port_start = ata_port_start,
304 .port_stop = ata_port_stop, 304 .port_stop = ata_port_stop,
305 .host_stop = ata_host_stop 305 .host_stop = ata_host_stop
306}; 306};
307 307
308static struct ata_port_operations pdc2026x_port_ops = { 308static struct ata_port_operations pdc2026x_port_ops = {
309 .port_disable = ata_port_disable, 309 .port_disable = ata_port_disable,
@@ -333,11 +333,11 @@ static struct ata_port_operations pdc2026x_port_ops = {
333 333
334 .irq_handler = ata_interrupt, 334 .irq_handler = ata_interrupt,
335 .irq_clear = ata_bmdma_irq_clear, 335 .irq_clear = ata_bmdma_irq_clear,
336 336
337 .port_start = ata_port_start, 337 .port_start = ata_port_start,
338 .port_stop = ata_port_stop, 338 .port_stop = ata_port_stop,
339 .host_stop = ata_host_stop 339 .host_stop = ata_host_stop
340}; 340};
341 341
342static int pdc_init_one(struct pci_dev *dev, const struct pci_device_id *id) 342static int pdc_init_one(struct pci_dev *dev, const struct pci_device_id *id)
343{ 343{
@@ -349,7 +349,7 @@ static int pdc_init_one(struct pci_dev *dev, const struct pci_device_id *id)
349 .mwdma_mask = 0x07, 349 .mwdma_mask = 0x07,
350 .udma_mask = ATA_UDMA2, 350 .udma_mask = ATA_UDMA2,
351 .port_ops = &pdc2024x_port_ops 351 .port_ops = &pdc2024x_port_ops
352 }, 352 },
353 { 353 {
354 .sht = &pdc_sht, 354 .sht = &pdc_sht,
355 .flags = ATA_FLAG_SLAVE_POSS | ATA_FLAG_SRST, 355 .flags = ATA_FLAG_SLAVE_POSS | ATA_FLAG_SRST,
@@ -366,12 +366,12 @@ static int pdc_init_one(struct pci_dev *dev, const struct pci_device_id *id)
366 .udma_mask = ATA_UDMA5, 366 .udma_mask = ATA_UDMA5,
367 .port_ops = &pdc2026x_port_ops 367 .port_ops = &pdc2026x_port_ops
368 } 368 }
369 369
370 }; 370 };
371 static struct ata_port_info *port_info[2]; 371 static struct ata_port_info *port_info[2];
372 372
373 port_info[0] = port_info[1] = &info[id->driver_data]; 373 port_info[0] = port_info[1] = &info[id->driver_data];
374 374
375 if (dev->device == PCI_DEVICE_ID_PROMISE_20265) { 375 if (dev->device == PCI_DEVICE_ID_PROMISE_20265) {
376 struct pci_dev *bridge = dev->bus->self; 376 struct pci_dev *bridge = dev->bus->self;
377 /* Don't grab anything behind a Promise I2O RAID */ 377 /* Don't grab anything behind a Promise I2O RAID */