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.c126
1 files changed, 18 insertions, 108 deletions
diff --git a/drivers/ata/sata_via.c b/drivers/ata/sata_via.c
index 0d03f44824fb..96deeb354e16 100644
--- a/drivers/ata/sata_via.c
+++ b/drivers/ata/sata_via.c
@@ -71,7 +71,7 @@ static int svia_init_one(struct pci_dev *pdev, const struct pci_device_id *ent);
71static int svia_scr_read(struct ata_port *ap, unsigned int sc_reg, u32 *val); 71static int svia_scr_read(struct ata_port *ap, unsigned int sc_reg, u32 *val);
72static int svia_scr_write(struct ata_port *ap, unsigned int sc_reg, u32 val); 72static int svia_scr_write(struct ata_port *ap, unsigned int sc_reg, u32 val);
73static void svia_noop_freeze(struct ata_port *ap); 73static void svia_noop_freeze(struct ata_port *ap);
74static void vt6420_error_handler(struct ata_port *ap); 74static int vt6420_prereset(struct ata_link *link, unsigned long deadline);
75static int vt6421_pata_cable_detect(struct ata_port *ap); 75static int vt6421_pata_cable_detect(struct ata_port *ap);
76static void vt6421_set_pio_mode(struct ata_port *ap, struct ata_device *adev); 76static void vt6421_set_pio_mode(struct ata_port *ap, struct ata_device *adev);
77static void vt6421_set_dma_mode(struct ata_port *ap, struct ata_device *adev); 77static void vt6421_set_dma_mode(struct ata_port *ap, struct ata_device *adev);
@@ -100,110 +100,26 @@ static struct pci_driver svia_pci_driver = {
100}; 100};
101 101
102static struct scsi_host_template svia_sht = { 102static struct scsi_host_template svia_sht = {
103 .module = THIS_MODULE, 103 ATA_BMDMA_SHT(DRV_NAME),
104 .name = DRV_NAME,
105 .ioctl = ata_scsi_ioctl,
106 .queuecommand = ata_scsi_queuecmd,
107 .can_queue = ATA_DEF_QUEUE,
108 .this_id = ATA_SHT_THIS_ID,
109 .sg_tablesize = LIBATA_MAX_PRD,
110 .cmd_per_lun = ATA_SHT_CMD_PER_LUN,
111 .emulated = ATA_SHT_EMULATED,
112 .use_clustering = ATA_SHT_USE_CLUSTERING,
113 .proc_name = DRV_NAME,
114 .dma_boundary = ATA_DMA_BOUNDARY,
115 .slave_configure = ata_scsi_slave_config,
116 .slave_destroy = ata_scsi_slave_destroy,
117 .bios_param = ata_std_bios_param,
118}; 104};
119 105
120static const struct ata_port_operations vt6420_sata_ops = { 106static struct ata_port_operations vt6420_sata_ops = {
121 .tf_load = ata_tf_load, 107 .inherits = &ata_bmdma_port_ops,
122 .tf_read = ata_tf_read,
123 .check_status = ata_check_status,
124 .exec_command = ata_exec_command,
125 .dev_select = ata_std_dev_select,
126
127 .bmdma_setup = ata_bmdma_setup,
128 .bmdma_start = ata_bmdma_start,
129 .bmdma_stop = ata_bmdma_stop,
130 .bmdma_status = ata_bmdma_status,
131
132 .qc_prep = ata_qc_prep,
133 .qc_issue = ata_qc_issue_prot,
134 .data_xfer = ata_data_xfer,
135
136 .freeze = svia_noop_freeze, 108 .freeze = svia_noop_freeze,
137 .thaw = ata_bmdma_thaw, 109 .prereset = vt6420_prereset,
138 .error_handler = vt6420_error_handler,
139 .post_internal_cmd = ata_bmdma_post_internal_cmd,
140
141 .irq_clear = ata_bmdma_irq_clear,
142 .irq_on = ata_irq_on,
143
144 .port_start = ata_port_start,
145}; 110};
146 111
147static const struct ata_port_operations vt6421_pata_ops = { 112static struct ata_port_operations vt6421_pata_ops = {
113 .inherits = &ata_bmdma_port_ops,
114 .cable_detect = vt6421_pata_cable_detect,
148 .set_piomode = vt6421_set_pio_mode, 115 .set_piomode = vt6421_set_pio_mode,
149 .set_dmamode = vt6421_set_dma_mode, 116 .set_dmamode = vt6421_set_dma_mode,
150
151 .tf_load = ata_tf_load,
152 .tf_read = ata_tf_read,
153 .check_status = ata_check_status,
154 .exec_command = ata_exec_command,
155 .dev_select = ata_std_dev_select,
156
157 .bmdma_setup = ata_bmdma_setup,
158 .bmdma_start = ata_bmdma_start,
159 .bmdma_stop = ata_bmdma_stop,
160 .bmdma_status = ata_bmdma_status,
161
162 .qc_prep = ata_qc_prep,
163 .qc_issue = ata_qc_issue_prot,
164 .data_xfer = ata_data_xfer,
165
166 .freeze = ata_bmdma_freeze,
167 .thaw = ata_bmdma_thaw,
168 .error_handler = ata_bmdma_error_handler,
169 .post_internal_cmd = ata_bmdma_post_internal_cmd,
170 .cable_detect = vt6421_pata_cable_detect,
171
172 .irq_clear = ata_bmdma_irq_clear,
173 .irq_on = ata_irq_on,
174
175 .port_start = ata_port_start,
176}; 117};
177 118
178static const struct ata_port_operations vt6421_sata_ops = { 119static struct ata_port_operations vt6421_sata_ops = {
179 .tf_load = ata_tf_load, 120 .inherits = &ata_bmdma_port_ops,
180 .tf_read = ata_tf_read,
181 .check_status = ata_check_status,
182 .exec_command = ata_exec_command,
183 .dev_select = ata_std_dev_select,
184
185 .bmdma_setup = ata_bmdma_setup,
186 .bmdma_start = ata_bmdma_start,
187 .bmdma_stop = ata_bmdma_stop,
188 .bmdma_status = ata_bmdma_status,
189
190 .qc_prep = ata_qc_prep,
191 .qc_issue = ata_qc_issue_prot,
192 .data_xfer = ata_data_xfer,
193
194 .freeze = ata_bmdma_freeze,
195 .thaw = ata_bmdma_thaw,
196 .error_handler = ata_bmdma_error_handler,
197 .post_internal_cmd = ata_bmdma_post_internal_cmd,
198 .cable_detect = ata_cable_sata,
199
200 .irq_clear = ata_bmdma_irq_clear,
201 .irq_on = ata_irq_on,
202
203 .scr_read = svia_scr_read, 121 .scr_read = svia_scr_read,
204 .scr_write = svia_scr_write, 122 .scr_write = svia_scr_write,
205
206 .port_start = ata_port_start,
207}; 123};
208 124
209static const struct ata_port_info vt6420_port_info = { 125static const struct ata_port_info vt6420_port_info = {
@@ -257,8 +173,8 @@ static void svia_noop_freeze(struct ata_port *ap)
257 /* Some VIA controllers choke if ATA_NIEN is manipulated in 173 /* Some VIA controllers choke if ATA_NIEN is manipulated in
258 * certain way. Leave it alone and just clear pending IRQ. 174 * certain way. Leave it alone and just clear pending IRQ.
259 */ 175 */
260 ata_chk_status(ap); 176 ap->ops->sff_check_status(ap);
261 ata_bmdma_irq_clear(ap); 177 ata_sff_irq_clear(ap);
262} 178}
263 179
264/** 180/**
@@ -320,23 +236,17 @@ static int vt6420_prereset(struct ata_link *link, unsigned long deadline)
320 236
321 if (!online) { 237 if (!online) {
322 /* tell EH to bail */ 238 /* tell EH to bail */
323 ehc->i.action &= ~ATA_EH_RESET_MASK; 239 ehc->i.action &= ~ATA_EH_RESET;
324 return 0; 240 return 0;
325 } 241 }
326 242
327 skip_scr: 243 skip_scr:
328 /* wait for !BSY */ 244 /* wait for !BSY */
329 ata_wait_ready(ap, deadline); 245 ata_sff_wait_ready(link, deadline);
330 246
331 return 0; 247 return 0;
332} 248}
333 249
334static void vt6420_error_handler(struct ata_port *ap)
335{
336 ata_bmdma_drive_eh(ap, vt6420_prereset, ata_std_softreset, NULL,
337 ata_std_postreset);
338}
339
340static int vt6421_pata_cable_detect(struct ata_port *ap) 250static int vt6421_pata_cable_detect(struct ata_port *ap)
341{ 251{
342 struct pci_dev *pdev = to_pci_dev(ap->host->dev); 252 struct pci_dev *pdev = to_pci_dev(ap->host->dev);
@@ -394,7 +304,7 @@ static void vt6421_init_addrs(struct ata_port *ap)
394 ioaddr->bmdma_addr = bmdma_addr; 304 ioaddr->bmdma_addr = bmdma_addr;
395 ioaddr->scr_addr = vt6421_scr_addr(iomap[5], ap->port_no); 305 ioaddr->scr_addr = vt6421_scr_addr(iomap[5], ap->port_no);
396 306
397 ata_std_ports(ioaddr); 307 ata_sff_std_ports(ioaddr);
398 308
399 ata_port_pbar_desc(ap, ap->port_no, -1, "port"); 309 ata_port_pbar_desc(ap, ap->port_no, -1, "port");
400 ata_port_pbar_desc(ap, 4, ap->port_no * 8, "bmdma"); 310 ata_port_pbar_desc(ap, 4, ap->port_no * 8, "bmdma");
@@ -406,7 +316,7 @@ static int vt6420_prepare_host(struct pci_dev *pdev, struct ata_host **r_host)
406 struct ata_host *host; 316 struct ata_host *host;
407 int rc; 317 int rc;
408 318
409 rc = ata_pci_prepare_sff_host(pdev, ppi, &host); 319 rc = ata_pci_sff_prepare_host(pdev, ppi, &host);
410 if (rc) 320 if (rc)
411 return rc; 321 return rc;
412 *r_host = host; 322 *r_host = host;
@@ -538,8 +448,8 @@ static int svia_init_one(struct pci_dev *pdev, const struct pci_device_id *ent)
538 svia_configure(pdev); 448 svia_configure(pdev);
539 449
540 pci_set_master(pdev); 450 pci_set_master(pdev);
541 return ata_host_activate(host, pdev->irq, ata_interrupt, IRQF_SHARED, 451 return ata_host_activate(host, pdev->irq, ata_sff_interrupt,
542 &svia_sht); 452 IRQF_SHARED, &svia_sht);
543} 453}
544 454
545static int __init svia_init(void) 455static int __init svia_init(void)