diff options
Diffstat (limited to 'drivers/scsi/sata_promise.c')
-rw-r--r-- | drivers/scsi/sata_promise.c | 95 |
1 files changed, 73 insertions, 22 deletions
diff --git a/drivers/scsi/sata_promise.c b/drivers/scsi/sata_promise.c index 919fb314ad10..7c4f6ecc1cc9 100644 --- a/drivers/scsi/sata_promise.c +++ b/drivers/scsi/sata_promise.c | |||
@@ -7,21 +7,26 @@ | |||
7 | * | 7 | * |
8 | * Copyright 2003-2004 Red Hat, Inc. | 8 | * Copyright 2003-2004 Red Hat, Inc. |
9 | * | 9 | * |
10 | * The contents of this file are subject to the Open | ||
11 | * Software License version 1.1 that can be found at | ||
12 | * http://www.opensource.org/licenses/osl-1.1.txt and is included herein | ||
13 | * by reference. | ||
14 | * | 10 | * |
15 | * Alternatively, the contents of this file may be used under the terms | 11 | * This program is free software; you can redistribute it and/or modify |
16 | * of the GNU General Public License version 2 (the "GPL") as distributed | 12 | * it under the terms of the GNU General Public License as published by |
17 | * in the kernel source COPYING file, in which case the provisions of | 13 | * the Free Software Foundation; either version 2, or (at your option) |
18 | * the GPL are applicable instead of the above. If you wish to allow | 14 | * any later version. |
19 | * the use of your version of this file only under the terms of the | 15 | * |
20 | * GPL and not to allow others to use your version of this file under | 16 | * This program is distributed in the hope that it will be useful, |
21 | * the OSL, indicate your decision by deleting the provisions above and | 17 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
22 | * replace them with the notice and other provisions required by the GPL. | 18 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
23 | * If you do not delete the provisions above, a recipient may use your | 19 | * GNU General Public License for more details. |
24 | * version of this file under either the OSL or the GPL. | 20 | * |
21 | * You should have received a copy of the GNU General Public License | ||
22 | * along with this program; see the file COPYING. If not, write to | ||
23 | * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. | ||
24 | * | ||
25 | * | ||
26 | * libata documentation is available via 'make {ps|pdf}docs', | ||
27 | * as Documentation/DocBook/libata.* | ||
28 | * | ||
29 | * Hardware information only available under NDA. | ||
25 | * | 30 | * |
26 | */ | 31 | */ |
27 | 32 | ||
@@ -79,7 +84,8 @@ static irqreturn_t pdc_interrupt (int irq, void *dev_instance, struct pt_regs *r | |||
79 | static void pdc_eng_timeout(struct ata_port *ap); | 84 | static void pdc_eng_timeout(struct ata_port *ap); |
80 | static int pdc_port_start(struct ata_port *ap); | 85 | static int pdc_port_start(struct ata_port *ap); |
81 | static void pdc_port_stop(struct ata_port *ap); | 86 | static void pdc_port_stop(struct ata_port *ap); |
82 | static void pdc_phy_reset(struct ata_port *ap); | 87 | static void pdc_pata_phy_reset(struct ata_port *ap); |
88 | static void pdc_sata_phy_reset(struct ata_port *ap); | ||
83 | static void pdc_qc_prep(struct ata_queued_cmd *qc); | 89 | static void pdc_qc_prep(struct ata_queued_cmd *qc); |
84 | static void pdc_tf_load_mmio(struct ata_port *ap, struct ata_taskfile *tf); | 90 | static void pdc_tf_load_mmio(struct ata_port *ap, struct ata_taskfile *tf); |
85 | static void pdc_exec_command_mmio(struct ata_port *ap, struct ata_taskfile *tf); | 91 | static void pdc_exec_command_mmio(struct ata_port *ap, struct ata_taskfile *tf); |
@@ -106,19 +112,22 @@ static Scsi_Host_Template pdc_ata_sht = { | |||
106 | .ordered_flush = 1, | 112 | .ordered_flush = 1, |
107 | }; | 113 | }; |
108 | 114 | ||
109 | static struct ata_port_operations pdc_ata_ops = { | 115 | static struct ata_port_operations pdc_sata_ops = { |
110 | .port_disable = ata_port_disable, | 116 | .port_disable = ata_port_disable, |
111 | .tf_load = pdc_tf_load_mmio, | 117 | .tf_load = pdc_tf_load_mmio, |
112 | .tf_read = ata_tf_read, | 118 | .tf_read = ata_tf_read, |
113 | .check_status = ata_check_status, | 119 | .check_status = ata_check_status, |
114 | .exec_command = pdc_exec_command_mmio, | 120 | .exec_command = pdc_exec_command_mmio, |
115 | .dev_select = ata_std_dev_select, | 121 | .dev_select = ata_std_dev_select, |
116 | .phy_reset = pdc_phy_reset, | 122 | |
123 | .phy_reset = pdc_sata_phy_reset, | ||
124 | |||
117 | .qc_prep = pdc_qc_prep, | 125 | .qc_prep = pdc_qc_prep, |
118 | .qc_issue = pdc_qc_issue_prot, | 126 | .qc_issue = pdc_qc_issue_prot, |
119 | .eng_timeout = pdc_eng_timeout, | 127 | .eng_timeout = pdc_eng_timeout, |
120 | .irq_handler = pdc_interrupt, | 128 | .irq_handler = pdc_interrupt, |
121 | .irq_clear = pdc_irq_clear, | 129 | .irq_clear = pdc_irq_clear, |
130 | |||
122 | .scr_read = pdc_sata_scr_read, | 131 | .scr_read = pdc_sata_scr_read, |
123 | .scr_write = pdc_sata_scr_write, | 132 | .scr_write = pdc_sata_scr_write, |
124 | .port_start = pdc_port_start, | 133 | .port_start = pdc_port_start, |
@@ -126,6 +135,27 @@ static struct ata_port_operations pdc_ata_ops = { | |||
126 | .host_stop = ata_host_stop, | 135 | .host_stop = ata_host_stop, |
127 | }; | 136 | }; |
128 | 137 | ||
138 | static struct ata_port_operations pdc_pata_ops = { | ||
139 | .port_disable = ata_port_disable, | ||
140 | .tf_load = pdc_tf_load_mmio, | ||
141 | .tf_read = ata_tf_read, | ||
142 | .check_status = ata_check_status, | ||
143 | .exec_command = pdc_exec_command_mmio, | ||
144 | .dev_select = ata_std_dev_select, | ||
145 | |||
146 | .phy_reset = pdc_pata_phy_reset, | ||
147 | |||
148 | .qc_prep = pdc_qc_prep, | ||
149 | .qc_issue = pdc_qc_issue_prot, | ||
150 | .eng_timeout = pdc_eng_timeout, | ||
151 | .irq_handler = pdc_interrupt, | ||
152 | .irq_clear = pdc_irq_clear, | ||
153 | |||
154 | .port_start = pdc_port_start, | ||
155 | .port_stop = pdc_port_stop, | ||
156 | .host_stop = ata_host_stop, | ||
157 | }; | ||
158 | |||
129 | static struct ata_port_info pdc_port_info[] = { | 159 | static struct ata_port_info pdc_port_info[] = { |
130 | /* board_2037x */ | 160 | /* board_2037x */ |
131 | { | 161 | { |
@@ -135,7 +165,7 @@ static struct ata_port_info pdc_port_info[] = { | |||
135 | .pio_mask = 0x1f, /* pio0-4 */ | 165 | .pio_mask = 0x1f, /* pio0-4 */ |
136 | .mwdma_mask = 0x07, /* mwdma0-2 */ | 166 | .mwdma_mask = 0x07, /* mwdma0-2 */ |
137 | .udma_mask = 0x7f, /* udma0-6 ; FIXME */ | 167 | .udma_mask = 0x7f, /* udma0-6 ; FIXME */ |
138 | .port_ops = &pdc_ata_ops, | 168 | .port_ops = &pdc_sata_ops, |
139 | }, | 169 | }, |
140 | 170 | ||
141 | /* board_20319 */ | 171 | /* board_20319 */ |
@@ -146,7 +176,7 @@ static struct ata_port_info pdc_port_info[] = { | |||
146 | .pio_mask = 0x1f, /* pio0-4 */ | 176 | .pio_mask = 0x1f, /* pio0-4 */ |
147 | .mwdma_mask = 0x07, /* mwdma0-2 */ | 177 | .mwdma_mask = 0x07, /* mwdma0-2 */ |
148 | .udma_mask = 0x7f, /* udma0-6 ; FIXME */ | 178 | .udma_mask = 0x7f, /* udma0-6 ; FIXME */ |
149 | .port_ops = &pdc_ata_ops, | 179 | .port_ops = &pdc_sata_ops, |
150 | }, | 180 | }, |
151 | 181 | ||
152 | /* board_20619 */ | 182 | /* board_20619 */ |
@@ -157,7 +187,7 @@ static struct ata_port_info pdc_port_info[] = { | |||
157 | .pio_mask = 0x1f, /* pio0-4 */ | 187 | .pio_mask = 0x1f, /* pio0-4 */ |
158 | .mwdma_mask = 0x07, /* mwdma0-2 */ | 188 | .mwdma_mask = 0x07, /* mwdma0-2 */ |
159 | .udma_mask = 0x7f, /* udma0-6 ; FIXME */ | 189 | .udma_mask = 0x7f, /* udma0-6 ; FIXME */ |
160 | .port_ops = &pdc_ata_ops, | 190 | .port_ops = &pdc_pata_ops, |
161 | }, | 191 | }, |
162 | }; | 192 | }; |
163 | 193 | ||
@@ -181,6 +211,10 @@ static struct pci_device_id pdc_ata_pci_tbl[] = { | |||
181 | board_20319 }, | 211 | board_20319 }, |
182 | { PCI_VENDOR_ID_PROMISE, 0x3319, PCI_ANY_ID, PCI_ANY_ID, 0, 0, | 212 | { PCI_VENDOR_ID_PROMISE, 0x3319, PCI_ANY_ID, PCI_ANY_ID, 0, 0, |
183 | board_20319 }, | 213 | board_20319 }, |
214 | { PCI_VENDOR_ID_PROMISE, 0x3519, PCI_ANY_ID, PCI_ANY_ID, 0, 0, | ||
215 | board_20319 }, | ||
216 | { PCI_VENDOR_ID_PROMISE, 0x3d17, PCI_ANY_ID, PCI_ANY_ID, 0, 0, | ||
217 | board_20319 }, | ||
184 | { PCI_VENDOR_ID_PROMISE, 0x3d18, PCI_ANY_ID, PCI_ANY_ID, 0, 0, | 218 | { PCI_VENDOR_ID_PROMISE, 0x3d18, PCI_ANY_ID, PCI_ANY_ID, 0, 0, |
185 | board_20319 }, | 219 | board_20319 }, |
186 | 220 | ||
@@ -268,12 +302,23 @@ static void pdc_reset_port(struct ata_port *ap) | |||
268 | readl(mmio); /* flush */ | 302 | readl(mmio); /* flush */ |
269 | } | 303 | } |
270 | 304 | ||
271 | static void pdc_phy_reset(struct ata_port *ap) | 305 | static void pdc_sata_phy_reset(struct ata_port *ap) |
272 | { | 306 | { |
273 | pdc_reset_port(ap); | 307 | pdc_reset_port(ap); |
274 | sata_phy_reset(ap); | 308 | sata_phy_reset(ap); |
275 | } | 309 | } |
276 | 310 | ||
311 | static void pdc_pata_phy_reset(struct ata_port *ap) | ||
312 | { | ||
313 | /* FIXME: add cable detect. Don't assume 40-pin cable */ | ||
314 | ap->cbl = ATA_CBL_PATA40; | ||
315 | ap->udma_mask &= ATA_UDMA_MASK_40C; | ||
316 | |||
317 | pdc_reset_port(ap); | ||
318 | ata_port_probe(ap); | ||
319 | ata_bus_reset(ap); | ||
320 | } | ||
321 | |||
277 | static u32 pdc_sata_scr_read (struct ata_port *ap, unsigned int sc_reg) | 322 | static u32 pdc_sata_scr_read (struct ata_port *ap, unsigned int sc_reg) |
278 | { | 323 | { |
279 | if (sc_reg > SCR_CONTROL) | 324 | if (sc_reg > SCR_CONTROL) |
@@ -321,11 +366,15 @@ static void pdc_qc_prep(struct ata_queued_cmd *qc) | |||
321 | 366 | ||
322 | static void pdc_eng_timeout(struct ata_port *ap) | 367 | static void pdc_eng_timeout(struct ata_port *ap) |
323 | { | 368 | { |
369 | struct ata_host_set *host_set = ap->host_set; | ||
324 | u8 drv_stat; | 370 | u8 drv_stat; |
325 | struct ata_queued_cmd *qc; | 371 | struct ata_queued_cmd *qc; |
372 | unsigned long flags; | ||
326 | 373 | ||
327 | DPRINTK("ENTER\n"); | 374 | DPRINTK("ENTER\n"); |
328 | 375 | ||
376 | spin_lock_irqsave(&host_set->lock, flags); | ||
377 | |||
329 | qc = ata_qc_from_tag(ap, ap->active_tag); | 378 | qc = ata_qc_from_tag(ap, ap->active_tag); |
330 | if (!qc) { | 379 | if (!qc) { |
331 | printk(KERN_ERR "ata%u: BUG: timeout without command\n", | 380 | printk(KERN_ERR "ata%u: BUG: timeout without command\n", |
@@ -359,6 +408,7 @@ static void pdc_eng_timeout(struct ata_port *ap) | |||
359 | } | 408 | } |
360 | 409 | ||
361 | out: | 410 | out: |
411 | spin_unlock_irqrestore(&host_set->lock, flags); | ||
362 | DPRINTK("EXIT\n"); | 412 | DPRINTK("EXIT\n"); |
363 | } | 413 | } |
364 | 414 | ||
@@ -441,7 +491,8 @@ static irqreturn_t pdc_interrupt (int irq, void *dev_instance, struct pt_regs *r | |||
441 | VPRINTK("port %u\n", i); | 491 | VPRINTK("port %u\n", i); |
442 | ap = host_set->ports[i]; | 492 | ap = host_set->ports[i]; |
443 | tmp = mask & (1 << (i + 1)); | 493 | tmp = mask & (1 << (i + 1)); |
444 | if (tmp && ap && (!(ap->flags & ATA_FLAG_PORT_DISABLED))) { | 494 | if (tmp && ap && |
495 | !(ap->flags & (ATA_FLAG_PORT_DISABLED | ATA_FLAG_NOINTR))) { | ||
445 | struct ata_queued_cmd *qc; | 496 | struct ata_queued_cmd *qc; |
446 | 497 | ||
447 | qc = ata_qc_from_tag(ap, ap->active_tag); | 498 | qc = ata_qc_from_tag(ap, ap->active_tag); |