aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/ata/sata_via.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/ata/sata_via.c')
-rw-r--r--drivers/ata/sata_via.c35
1 files changed, 9 insertions, 26 deletions
diff --git a/drivers/ata/sata_via.c b/drivers/ata/sata_via.c
index 57fd30de8f0d..1dc9b4f2b2dc 100644
--- a/drivers/ata/sata_via.c
+++ b/drivers/ata/sata_via.c
@@ -57,7 +57,6 @@ enum {
57 SATA_CHAN_ENAB = 0x40, /* SATA channel enable */ 57 SATA_CHAN_ENAB = 0x40, /* SATA channel enable */
58 SATA_INT_GATE = 0x41, /* SATA interrupt gating */ 58 SATA_INT_GATE = 0x41, /* SATA interrupt gating */
59 SATA_NATIVE_MODE = 0x42, /* Native mode enable */ 59 SATA_NATIVE_MODE = 0x42, /* Native mode enable */
60 SATA_PATA_SHARING = 0x49, /* PATA/SATA sharing func ctrl */
61 PATA_UDMA_TIMING = 0xB3, /* PATA timing for DMA/ cable detect */ 60 PATA_UDMA_TIMING = 0xB3, /* PATA timing for DMA/ cable detect */
62 PATA_PIO_TIMING = 0xAB, /* PATA timing register */ 61 PATA_PIO_TIMING = 0xAB, /* PATA timing register */
63 62
@@ -68,7 +67,6 @@ enum {
68 NATIVE_MODE_ALL = (1 << 7) | (1 << 6) | (1 << 5) | (1 << 4), 67 NATIVE_MODE_ALL = (1 << 7) | (1 << 6) | (1 << 5) | (1 << 4),
69 68
70 SATA_EXT_PHY = (1 << 6), /* 0==use PATA, 1==ext phy */ 69 SATA_EXT_PHY = (1 << 6), /* 0==use PATA, 1==ext phy */
71 SATA_2DEV = (1 << 5), /* SATA is master/slave */
72}; 70};
73 71
74static int svia_init_one (struct pci_dev *pdev, const struct pci_device_id *ent); 72static int svia_init_one (struct pci_dev *pdev, const struct pci_device_id *ent);
@@ -122,8 +120,6 @@ static struct scsi_host_template svia_sht = {
122}; 120};
123 121
124static const struct ata_port_operations vt6420_sata_ops = { 122static const struct ata_port_operations vt6420_sata_ops = {
125 .port_disable = ata_port_disable,
126
127 .tf_load = ata_tf_load, 123 .tf_load = ata_tf_load,
128 .tf_read = ata_tf_read, 124 .tf_read = ata_tf_read,
129 .check_status = ata_check_status, 125 .check_status = ata_check_status,
@@ -146,14 +142,11 @@ static const struct ata_port_operations vt6420_sata_ops = {
146 142
147 .irq_clear = ata_bmdma_irq_clear, 143 .irq_clear = ata_bmdma_irq_clear,
148 .irq_on = ata_irq_on, 144 .irq_on = ata_irq_on,
149 .irq_ack = ata_irq_ack,
150 145
151 .port_start = ata_port_start, 146 .port_start = ata_port_start,
152}; 147};
153 148
154static const struct ata_port_operations vt6421_pata_ops = { 149static const struct ata_port_operations vt6421_pata_ops = {
155 .port_disable = ata_port_disable,
156
157 .set_piomode = vt6421_set_pio_mode, 150 .set_piomode = vt6421_set_pio_mode,
158 .set_dmamode = vt6421_set_dma_mode, 151 .set_dmamode = vt6421_set_dma_mode,
159 152
@@ -180,14 +173,11 @@ static const struct ata_port_operations vt6421_pata_ops = {
180 173
181 .irq_clear = ata_bmdma_irq_clear, 174 .irq_clear = ata_bmdma_irq_clear,
182 .irq_on = ata_irq_on, 175 .irq_on = ata_irq_on,
183 .irq_ack = ata_irq_ack,
184 176
185 .port_start = ata_port_start, 177 .port_start = ata_port_start,
186}; 178};
187 179
188static const struct ata_port_operations vt6421_sata_ops = { 180static const struct ata_port_operations vt6421_sata_ops = {
189 .port_disable = ata_port_disable,
190
191 .tf_load = ata_tf_load, 181 .tf_load = ata_tf_load,
192 .tf_read = ata_tf_read, 182 .tf_read = ata_tf_read,
193 .check_status = ata_check_status, 183 .check_status = ata_check_status,
@@ -211,7 +201,6 @@ static const struct ata_port_operations vt6421_sata_ops = {
211 201
212 .irq_clear = ata_bmdma_irq_clear, 202 .irq_clear = ata_bmdma_irq_clear,
213 .irq_on = ata_irq_on, 203 .irq_on = ata_irq_on,
214 .irq_ack = ata_irq_ack,
215 204
216 .scr_read = svia_scr_read, 205 .scr_read = svia_scr_read,
217 .scr_write = svia_scr_write, 206 .scr_write = svia_scr_write,
@@ -276,7 +265,7 @@ static void svia_noop_freeze(struct ata_port *ap)
276 265
277/** 266/**
278 * vt6420_prereset - prereset for vt6420 267 * vt6420_prereset - prereset for vt6420
279 * @ap: target ATA port 268 * @link: target ATA link
280 * @deadline: deadline jiffies for the operation 269 * @deadline: deadline jiffies for the operation
281 * 270 *
282 * SCR registers on vt6420 are pieces of shit and may hang the 271 * SCR registers on vt6420 are pieces of shit and may hang the
@@ -294,9 +283,10 @@ static void svia_noop_freeze(struct ata_port *ap)
294 * RETURNS: 283 * RETURNS:
295 * 0 on success, -errno otherwise. 284 * 0 on success, -errno otherwise.
296 */ 285 */
297static int vt6420_prereset(struct ata_port *ap, unsigned long deadline) 286static int vt6420_prereset(struct ata_link *link, unsigned long deadline)
298{ 287{
299 struct ata_eh_context *ehc = &ap->eh_context; 288 struct ata_port *ap = link->ap;
289 struct ata_eh_context *ehc = &ap->link.eh_context;
300 unsigned long timeout = jiffies + (HZ * 5); 290 unsigned long timeout = jiffies + (HZ * 5);
301 u32 sstatus, scontrol; 291 u32 sstatus, scontrol;
302 int online; 292 int online;
@@ -407,6 +397,9 @@ static void vt6421_init_addrs(struct ata_port *ap)
407 ioaddr->scr_addr = vt6421_scr_addr(iomap[5], ap->port_no); 397 ioaddr->scr_addr = vt6421_scr_addr(iomap[5], ap->port_no);
408 398
409 ata_std_ports(ioaddr); 399 ata_std_ports(ioaddr);
400
401 ata_port_pbar_desc(ap, ap->port_no, -1, "port");
402 ata_port_pbar_desc(ap, 4, ap->port_no * 8, "bmdma");
410} 403}
411 404
412static int vt6420_prepare_host(struct pci_dev *pdev, struct ata_host **r_host) 405static int vt6420_prepare_host(struct pci_dev *pdev, struct ata_host **r_host)
@@ -513,7 +506,6 @@ static int svia_init_one (struct pci_dev *pdev, const struct pci_device_id *ent)
513 struct ata_host *host; 506 struct ata_host *host;
514 int board_id = (int) ent->driver_data; 507 int board_id = (int) ent->driver_data;
515 const int *bar_sizes; 508 const int *bar_sizes;
516 u8 tmp8;
517 509
518 if (!printed_version++) 510 if (!printed_version++)
519 dev_printk(KERN_DEBUG, &pdev->dev, "version " DRV_VERSION "\n"); 511 dev_printk(KERN_DEBUG, &pdev->dev, "version " DRV_VERSION "\n");
@@ -522,19 +514,10 @@ static int svia_init_one (struct pci_dev *pdev, const struct pci_device_id *ent)
522 if (rc) 514 if (rc)
523 return rc; 515 return rc;
524 516
525 if (board_id == vt6420) { 517 if (board_id == vt6420)
526 pci_read_config_byte(pdev, SATA_PATA_SHARING, &tmp8);
527 if (tmp8 & SATA_2DEV) {
528 dev_printk(KERN_ERR, &pdev->dev,
529 "SATA master/slave not supported (0x%x)\n",
530 (int) tmp8);
531 return -EIO;
532 }
533
534 bar_sizes = &svia_bar_sizes[0]; 518 bar_sizes = &svia_bar_sizes[0];
535 } else { 519 else
536 bar_sizes = &vt6421_bar_sizes[0]; 520 bar_sizes = &vt6421_bar_sizes[0];
537 }
538 521
539 for (i = 0; i < ARRAY_SIZE(svia_bar_sizes); i++) 522 for (i = 0; i < ARRAY_SIZE(svia_bar_sizes); i++)
540 if ((pci_resource_start(pdev, i) == 0) || 523 if ((pci_resource_start(pdev, i) == 0) ||