aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/scsi/sata_promise.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/scsi/sata_promise.c')
-rw-r--r--drivers/scsi/sata_promise.c68
1 files changed, 52 insertions, 16 deletions
diff --git a/drivers/scsi/sata_promise.c b/drivers/scsi/sata_promise.c
index 4d8201422a1..538ad727bd2 100644
--- a/drivers/scsi/sata_promise.c
+++ b/drivers/scsi/sata_promise.c
@@ -84,13 +84,15 @@ static irqreturn_t pdc_interrupt (int irq, void *dev_instance, struct pt_regs *r
84static void pdc_eng_timeout(struct ata_port *ap); 84static void pdc_eng_timeout(struct ata_port *ap);
85static int pdc_port_start(struct ata_port *ap); 85static int pdc_port_start(struct ata_port *ap);
86static void pdc_port_stop(struct ata_port *ap); 86static void pdc_port_stop(struct ata_port *ap);
87static void pdc_phy_reset(struct ata_port *ap); 87static void pdc_pata_phy_reset(struct ata_port *ap);
88static void pdc_sata_phy_reset(struct ata_port *ap);
88static void pdc_qc_prep(struct ata_queued_cmd *qc); 89static void pdc_qc_prep(struct ata_queued_cmd *qc);
89static void pdc_tf_load_mmio(struct ata_port *ap, struct ata_taskfile *tf); 90static void pdc_tf_load_mmio(struct ata_port *ap, struct ata_taskfile *tf);
90static void pdc_exec_command_mmio(struct ata_port *ap, struct ata_taskfile *tf); 91static void pdc_exec_command_mmio(struct ata_port *ap, struct ata_taskfile *tf);
91static void pdc_irq_clear(struct ata_port *ap); 92static void pdc_irq_clear(struct ata_port *ap);
92static int pdc_qc_issue_prot(struct ata_queued_cmd *qc); 93static int pdc_qc_issue_prot(struct ata_queued_cmd *qc);
93 94
95
94static Scsi_Host_Template pdc_ata_sht = { 96static Scsi_Host_Template pdc_ata_sht = {
95 .module = THIS_MODULE, 97 .module = THIS_MODULE,
96 .name = DRV_NAME, 98 .name = DRV_NAME,
@@ -111,24 +113,48 @@ static Scsi_Host_Template pdc_ata_sht = {
111 .ordered_flush = 1, 113 .ordered_flush = 1,
112}; 114};
113 115
114static struct ata_port_operations pdc_ata_ops = { 116static struct ata_port_operations pdc_sata_ops = {
115 .port_disable = ata_port_disable, 117 .port_disable = ata_port_disable,
116 .tf_load = pdc_tf_load_mmio, 118 .tf_load = pdc_tf_load_mmio,
117 .tf_read = ata_tf_read, 119 .tf_read = ata_tf_read,
118 .check_status = ata_check_status, 120 .check_status = ata_check_status,
119 .exec_command = pdc_exec_command_mmio, 121 .exec_command = pdc_exec_command_mmio,
120 .dev_select = ata_std_dev_select, 122 .dev_select = ata_std_dev_select,
121 .phy_reset = pdc_phy_reset, 123
124 .phy_reset = pdc_sata_phy_reset,
125
122 .qc_prep = pdc_qc_prep, 126 .qc_prep = pdc_qc_prep,
123 .qc_issue = pdc_qc_issue_prot, 127 .qc_issue = pdc_qc_issue_prot,
124 .eng_timeout = pdc_eng_timeout, 128 .eng_timeout = pdc_eng_timeout,
125 .irq_handler = pdc_interrupt, 129 .irq_handler = pdc_interrupt,
126 .irq_clear = pdc_irq_clear, 130 .irq_clear = pdc_irq_clear,
131
127 .scr_read = pdc_sata_scr_read, 132 .scr_read = pdc_sata_scr_read,
128 .scr_write = pdc_sata_scr_write, 133 .scr_write = pdc_sata_scr_write,
129 .port_start = pdc_port_start, 134 .port_start = pdc_port_start,
130 .port_stop = pdc_port_stop, 135 .port_stop = pdc_port_stop,
131 .host_stop = ata_host_stop, 136 .host_stop = ata_pci_host_stop,
137};
138
139static struct ata_port_operations pdc_pata_ops = {
140 .port_disable = ata_port_disable,
141 .tf_load = pdc_tf_load_mmio,
142 .tf_read = ata_tf_read,
143 .check_status = ata_check_status,
144 .exec_command = pdc_exec_command_mmio,
145 .dev_select = ata_std_dev_select,
146
147 .phy_reset = pdc_pata_phy_reset,
148
149 .qc_prep = pdc_qc_prep,
150 .qc_issue = pdc_qc_issue_prot,
151 .eng_timeout = pdc_eng_timeout,
152 .irq_handler = pdc_interrupt,
153 .irq_clear = pdc_irq_clear,
154
155 .port_start = pdc_port_start,
156 .port_stop = pdc_port_stop,
157 .host_stop = ata_pci_host_stop,
132}; 158};
133 159
134static struct ata_port_info pdc_port_info[] = { 160static struct ata_port_info pdc_port_info[] = {
@@ -140,7 +166,7 @@ static struct ata_port_info pdc_port_info[] = {
140 .pio_mask = 0x1f, /* pio0-4 */ 166 .pio_mask = 0x1f, /* pio0-4 */
141 .mwdma_mask = 0x07, /* mwdma0-2 */ 167 .mwdma_mask = 0x07, /* mwdma0-2 */
142 .udma_mask = 0x7f, /* udma0-6 ; FIXME */ 168 .udma_mask = 0x7f, /* udma0-6 ; FIXME */
143 .port_ops = &pdc_ata_ops, 169 .port_ops = &pdc_sata_ops,
144 }, 170 },
145 171
146 /* board_20319 */ 172 /* board_20319 */
@@ -151,7 +177,7 @@ static struct ata_port_info pdc_port_info[] = {
151 .pio_mask = 0x1f, /* pio0-4 */ 177 .pio_mask = 0x1f, /* pio0-4 */
152 .mwdma_mask = 0x07, /* mwdma0-2 */ 178 .mwdma_mask = 0x07, /* mwdma0-2 */
153 .udma_mask = 0x7f, /* udma0-6 ; FIXME */ 179 .udma_mask = 0x7f, /* udma0-6 ; FIXME */
154 .port_ops = &pdc_ata_ops, 180 .port_ops = &pdc_sata_ops,
155 }, 181 },
156 182
157 /* board_20619 */ 183 /* board_20619 */
@@ -162,7 +188,7 @@ static struct ata_port_info pdc_port_info[] = {
162 .pio_mask = 0x1f, /* pio0-4 */ 188 .pio_mask = 0x1f, /* pio0-4 */
163 .mwdma_mask = 0x07, /* mwdma0-2 */ 189 .mwdma_mask = 0x07, /* mwdma0-2 */
164 .udma_mask = 0x7f, /* udma0-6 ; FIXME */ 190 .udma_mask = 0x7f, /* udma0-6 ; FIXME */
165 .port_ops = &pdc_ata_ops, 191 .port_ops = &pdc_pata_ops,
166 }, 192 },
167}; 193};
168 194
@@ -257,7 +283,7 @@ static void pdc_port_stop(struct ata_port *ap)
257 283
258static void pdc_reset_port(struct ata_port *ap) 284static void pdc_reset_port(struct ata_port *ap)
259{ 285{
260 void *mmio = (void *) ap->ioaddr.cmd_addr + PDC_CTLSTAT; 286 void __iomem *mmio = (void __iomem *) ap->ioaddr.cmd_addr + PDC_CTLSTAT;
261 unsigned int i; 287 unsigned int i;
262 u32 tmp; 288 u32 tmp;
263 289
@@ -277,12 +303,23 @@ static void pdc_reset_port(struct ata_port *ap)
277 readl(mmio); /* flush */ 303 readl(mmio); /* flush */
278} 304}
279 305
280static void pdc_phy_reset(struct ata_port *ap) 306static void pdc_sata_phy_reset(struct ata_port *ap)
281{ 307{
282 pdc_reset_port(ap); 308 pdc_reset_port(ap);
283 sata_phy_reset(ap); 309 sata_phy_reset(ap);
284} 310}
285 311
312static void pdc_pata_phy_reset(struct ata_port *ap)
313{
314 /* FIXME: add cable detect. Don't assume 40-pin cable */
315 ap->cbl = ATA_CBL_PATA40;
316 ap->udma_mask &= ATA_UDMA_MASK_40C;
317
318 pdc_reset_port(ap);
319 ata_port_probe(ap);
320 ata_bus_reset(ap);
321}
322
286static u32 pdc_sata_scr_read (struct ata_port *ap, unsigned int sc_reg) 323static u32 pdc_sata_scr_read (struct ata_port *ap, unsigned int sc_reg)
287{ 324{
288 if (sc_reg > SCR_CONTROL) 325 if (sc_reg > SCR_CONTROL)
@@ -382,7 +419,7 @@ static inline unsigned int pdc_host_intr( struct ata_port *ap,
382 u8 status; 419 u8 status;
383 unsigned int handled = 0, have_err = 0; 420 unsigned int handled = 0, have_err = 0;
384 u32 tmp; 421 u32 tmp;
385 void *mmio = (void *) ap->ioaddr.cmd_addr + PDC_GLOBAL_CTL; 422 void __iomem *mmio = (void __iomem *) ap->ioaddr.cmd_addr + PDC_GLOBAL_CTL;
386 423
387 tmp = readl(mmio); 424 tmp = readl(mmio);
388 if (tmp & PDC_ERR_MASK) { 425 if (tmp & PDC_ERR_MASK) {
@@ -411,7 +448,7 @@ static inline unsigned int pdc_host_intr( struct ata_port *ap,
411static void pdc_irq_clear(struct ata_port *ap) 448static void pdc_irq_clear(struct ata_port *ap)
412{ 449{
413 struct ata_host_set *host_set = ap->host_set; 450 struct ata_host_set *host_set = ap->host_set;
414 void *mmio = host_set->mmio_base; 451 void __iomem *mmio = host_set->mmio_base;
415 452
416 readl(mmio + PDC_INT_SEQMASK); 453 readl(mmio + PDC_INT_SEQMASK);
417} 454}
@@ -423,7 +460,7 @@ static irqreturn_t pdc_interrupt (int irq, void *dev_instance, struct pt_regs *r
423 u32 mask = 0; 460 u32 mask = 0;
424 unsigned int i, tmp; 461 unsigned int i, tmp;
425 unsigned int handled = 0; 462 unsigned int handled = 0;
426 void *mmio_base; 463 void __iomem *mmio_base;
427 464
428 VPRINTK("ENTER\n"); 465 VPRINTK("ENTER\n");
429 466
@@ -545,7 +582,7 @@ static void pdc_ata_setup_port(struct ata_ioports *port, unsigned long base)
545 582
546static void pdc_host_init(unsigned int chip_id, struct ata_probe_ent *pe) 583static void pdc_host_init(unsigned int chip_id, struct ata_probe_ent *pe)
547{ 584{
548 void *mmio = pe->mmio_base; 585 void __iomem *mmio = pe->mmio_base;
549 u32 tmp; 586 u32 tmp;
550 587
551 /* 588 /*
@@ -588,7 +625,7 @@ static int pdc_ata_init_one (struct pci_dev *pdev, const struct pci_device_id *e
588 static int printed_version; 625 static int printed_version;
589 struct ata_probe_ent *probe_ent = NULL; 626 struct ata_probe_ent *probe_ent = NULL;
590 unsigned long base; 627 unsigned long base;
591 void *mmio_base; 628 void __iomem *mmio_base;
592 unsigned int board_idx = (unsigned int) ent->driver_data; 629 unsigned int board_idx = (unsigned int) ent->driver_data;
593 int pci_dev_busy = 0; 630 int pci_dev_busy = 0;
594 int rc; 631 int rc;
@@ -627,8 +664,7 @@ static int pdc_ata_init_one (struct pci_dev *pdev, const struct pci_device_id *e
627 probe_ent->dev = pci_dev_to_dev(pdev); 664 probe_ent->dev = pci_dev_to_dev(pdev);
628 INIT_LIST_HEAD(&probe_ent->node); 665 INIT_LIST_HEAD(&probe_ent->node);
629 666
630 mmio_base = ioremap(pci_resource_start(pdev, 3), 667 mmio_base = pci_iomap(pdev, 3, 0);
631 pci_resource_len(pdev, 3));
632 if (mmio_base == NULL) { 668 if (mmio_base == NULL) {
633 rc = -ENOMEM; 669 rc = -ENOMEM;
634 goto err_out_free_ent; 670 goto err_out_free_ent;