diff options
Diffstat (limited to 'drivers/ata/pata_pdc2027x.c')
-rw-r--r-- | drivers/ata/pata_pdc2027x.c | 99 |
1 files changed, 11 insertions, 88 deletions
diff --git a/drivers/ata/pata_pdc2027x.c b/drivers/ata/pata_pdc2027x.c index 511c89b9bae8..0e1c2c1134d3 100644 --- a/drivers/ata/pata_pdc2027x.c +++ b/drivers/ata/pata_pdc2027x.c | |||
@@ -63,7 +63,7 @@ enum { | |||
63 | }; | 63 | }; |
64 | 64 | ||
65 | static int pdc2027x_init_one(struct pci_dev *pdev, const struct pci_device_id *ent); | 65 | static int pdc2027x_init_one(struct pci_dev *pdev, const struct pci_device_id *ent); |
66 | static void pdc2027x_error_handler(struct ata_port *ap); | 66 | static int pdc2027x_prereset(struct ata_link *link, unsigned long deadline); |
67 | static void pdc2027x_set_piomode(struct ata_port *ap, struct ata_device *adev); | 67 | static void pdc2027x_set_piomode(struct ata_port *ap, struct ata_device *adev); |
68 | static void pdc2027x_set_dmamode(struct ata_port *ap, struct ata_device *adev); | 68 | static void pdc2027x_set_dmamode(struct ata_port *ap, struct ata_device *adev); |
69 | static int pdc2027x_check_atapi_dma(struct ata_queued_cmd *qc); | 69 | static int pdc2027x_check_atapi_dma(struct ata_queued_cmd *qc); |
@@ -129,84 +129,22 @@ static struct pci_driver pdc2027x_pci_driver = { | |||
129 | }; | 129 | }; |
130 | 130 | ||
131 | static struct scsi_host_template pdc2027x_sht = { | 131 | static struct scsi_host_template pdc2027x_sht = { |
132 | .module = THIS_MODULE, | 132 | ATA_BMDMA_SHT(DRV_NAME), |
133 | .name = DRV_NAME, | ||
134 | .ioctl = ata_scsi_ioctl, | ||
135 | .queuecommand = ata_scsi_queuecmd, | ||
136 | .can_queue = ATA_DEF_QUEUE, | ||
137 | .this_id = ATA_SHT_THIS_ID, | ||
138 | .sg_tablesize = LIBATA_MAX_PRD, | ||
139 | .cmd_per_lun = ATA_SHT_CMD_PER_LUN, | ||
140 | .emulated = ATA_SHT_EMULATED, | ||
141 | .use_clustering = ATA_SHT_USE_CLUSTERING, | ||
142 | .proc_name = DRV_NAME, | ||
143 | .dma_boundary = ATA_DMA_BOUNDARY, | ||
144 | .slave_configure = ata_scsi_slave_config, | ||
145 | .slave_destroy = ata_scsi_slave_destroy, | ||
146 | .bios_param = ata_std_bios_param, | ||
147 | }; | 133 | }; |
148 | 134 | ||
149 | static struct ata_port_operations pdc2027x_pata100_ops = { | 135 | static struct ata_port_operations pdc2027x_pata100_ops = { |
150 | .mode_filter = ata_pci_default_filter, | 136 | .inherits = &ata_bmdma_port_ops, |
151 | |||
152 | .tf_load = ata_tf_load, | ||
153 | .tf_read = ata_tf_read, | ||
154 | .check_status = ata_check_status, | ||
155 | .exec_command = ata_exec_command, | ||
156 | .dev_select = ata_std_dev_select, | ||
157 | |||
158 | .check_atapi_dma = pdc2027x_check_atapi_dma, | 137 | .check_atapi_dma = pdc2027x_check_atapi_dma, |
159 | .bmdma_setup = ata_bmdma_setup, | ||
160 | .bmdma_start = ata_bmdma_start, | ||
161 | .bmdma_stop = ata_bmdma_stop, | ||
162 | .bmdma_status = ata_bmdma_status, | ||
163 | .qc_prep = ata_qc_prep, | ||
164 | .qc_issue = ata_qc_issue_prot, | ||
165 | .data_xfer = ata_data_xfer, | ||
166 | |||
167 | .freeze = ata_bmdma_freeze, | ||
168 | .thaw = ata_bmdma_thaw, | ||
169 | .error_handler = pdc2027x_error_handler, | ||
170 | .post_internal_cmd = ata_bmdma_post_internal_cmd, | ||
171 | .cable_detect = pdc2027x_cable_detect, | 138 | .cable_detect = pdc2027x_cable_detect, |
172 | 139 | .prereset = pdc2027x_prereset, | |
173 | .irq_clear = ata_bmdma_irq_clear, | ||
174 | .irq_on = ata_irq_on, | ||
175 | |||
176 | .port_start = ata_sff_port_start, | ||
177 | }; | 140 | }; |
178 | 141 | ||
179 | static struct ata_port_operations pdc2027x_pata133_ops = { | 142 | static struct ata_port_operations pdc2027x_pata133_ops = { |
143 | .inherits = &pdc2027x_pata100_ops, | ||
144 | .mode_filter = pdc2027x_mode_filter, | ||
180 | .set_piomode = pdc2027x_set_piomode, | 145 | .set_piomode = pdc2027x_set_piomode, |
181 | .set_dmamode = pdc2027x_set_dmamode, | 146 | .set_dmamode = pdc2027x_set_dmamode, |
182 | .set_mode = pdc2027x_set_mode, | 147 | .set_mode = pdc2027x_set_mode, |
183 | .mode_filter = pdc2027x_mode_filter, | ||
184 | |||
185 | .tf_load = ata_tf_load, | ||
186 | .tf_read = ata_tf_read, | ||
187 | .check_status = ata_check_status, | ||
188 | .exec_command = ata_exec_command, | ||
189 | .dev_select = ata_std_dev_select, | ||
190 | |||
191 | .check_atapi_dma = pdc2027x_check_atapi_dma, | ||
192 | .bmdma_setup = ata_bmdma_setup, | ||
193 | .bmdma_start = ata_bmdma_start, | ||
194 | .bmdma_stop = ata_bmdma_stop, | ||
195 | .bmdma_status = ata_bmdma_status, | ||
196 | .qc_prep = ata_qc_prep, | ||
197 | .qc_issue = ata_qc_issue_prot, | ||
198 | .data_xfer = ata_data_xfer, | ||
199 | |||
200 | .freeze = ata_bmdma_freeze, | ||
201 | .thaw = ata_bmdma_thaw, | ||
202 | .error_handler = pdc2027x_error_handler, | ||
203 | .post_internal_cmd = ata_bmdma_post_internal_cmd, | ||
204 | .cable_detect = pdc2027x_cable_detect, | ||
205 | |||
206 | .irq_clear = ata_bmdma_irq_clear, | ||
207 | .irq_on = ata_irq_on, | ||
208 | |||
209 | .port_start = ata_sff_port_start, | ||
210 | }; | 148 | }; |
211 | 149 | ||
212 | static struct ata_port_info pdc2027x_port_info[] = { | 150 | static struct ata_port_info pdc2027x_port_info[] = { |
@@ -310,22 +248,7 @@ static int pdc2027x_prereset(struct ata_link *link, unsigned long deadline) | |||
310 | /* Check whether port enabled */ | 248 | /* Check whether port enabled */ |
311 | if (!pdc2027x_port_enabled(link->ap)) | 249 | if (!pdc2027x_port_enabled(link->ap)) |
312 | return -ENOENT; | 250 | return -ENOENT; |
313 | return ata_std_prereset(link, deadline); | 251 | return ata_sff_prereset(link, deadline); |
314 | } | ||
315 | |||
316 | /** | ||
317 | * pdc2027x_error_handler - Perform reset on PATA port and classify | ||
318 | * @ap: Port to reset | ||
319 | * | ||
320 | * Reset PATA phy and classify attached devices. | ||
321 | * | ||
322 | * LOCKING: | ||
323 | * None (inherited from caller). | ||
324 | */ | ||
325 | |||
326 | static void pdc2027x_error_handler(struct ata_port *ap) | ||
327 | { | ||
328 | ata_bmdma_drive_eh(ap, pdc2027x_prereset, ata_std_softreset, NULL, ata_std_postreset); | ||
329 | } | 252 | } |
330 | 253 | ||
331 | /** | 254 | /** |
@@ -342,7 +265,7 @@ static unsigned long pdc2027x_mode_filter(struct ata_device *adev, unsigned long | |||
342 | struct ata_device *pair = ata_dev_pair(adev); | 265 | struct ata_device *pair = ata_dev_pair(adev); |
343 | 266 | ||
344 | if (adev->class != ATA_DEV_ATA || adev->devno == 0 || pair == NULL) | 267 | if (adev->class != ATA_DEV_ATA || adev->devno == 0 || pair == NULL) |
345 | return ata_pci_default_filter(adev, mask); | 268 | return ata_bmdma_mode_filter(adev, mask); |
346 | 269 | ||
347 | /* Check for slave of a Maxtor at UDMA6 */ | 270 | /* Check for slave of a Maxtor at UDMA6 */ |
348 | ata_id_c_string(pair->id, model_num, ATA_ID_PROD, | 271 | ata_id_c_string(pair->id, model_num, ATA_ID_PROD, |
@@ -351,7 +274,7 @@ static unsigned long pdc2027x_mode_filter(struct ata_device *adev, unsigned long | |||
351 | if (strstr(model_num, "Maxtor") == NULL && pair->dma_mode == XFER_UDMA_6) | 274 | if (strstr(model_num, "Maxtor") == NULL && pair->dma_mode == XFER_UDMA_6) |
352 | mask &= ~ (1 << (6 + ATA_SHIFT_UDMA)); | 275 | mask &= ~ (1 << (6 + ATA_SHIFT_UDMA)); |
353 | 276 | ||
354 | return ata_pci_default_filter(adev, mask); | 277 | return ata_bmdma_mode_filter(adev, mask); |
355 | } | 278 | } |
356 | 279 | ||
357 | /** | 280 | /** |
@@ -836,8 +759,8 @@ static int __devinit pdc2027x_init_one(struct pci_dev *pdev, const struct pci_de | |||
836 | return -EIO; | 759 | return -EIO; |
837 | 760 | ||
838 | pci_set_master(pdev); | 761 | pci_set_master(pdev); |
839 | return ata_host_activate(host, pdev->irq, ata_interrupt, IRQF_SHARED, | 762 | return ata_host_activate(host, pdev->irq, ata_sff_interrupt, |
840 | &pdc2027x_sht); | 763 | IRQF_SHARED, &pdc2027x_sht); |
841 | } | 764 | } |
842 | 765 | ||
843 | /** | 766 | /** |