aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/ata/pata_cs5530.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/ata/pata_cs5530.c')
-rw-r--r--drivers/ata/pata_cs5530.c80
1 files changed, 28 insertions, 52 deletions
diff --git a/drivers/ata/pata_cs5530.c b/drivers/ata/pata_cs5530.c
index e1818fdd9159..744beebaaf49 100644
--- a/drivers/ata/pata_cs5530.c
+++ b/drivers/ata/pata_cs5530.c
@@ -133,7 +133,7 @@ static void cs5530_set_dmamode(struct ata_port *ap, struct ata_device *adev)
133} 133}
134 134
135/** 135/**
136 * cs5530_qc_issue_prot - command issue 136 * cs5530_qc_issue - command issue
137 * @qc: command pending 137 * @qc: command pending
138 * 138 *
139 * Called when the libata layer is about to issue a command. We wrap 139 * Called when the libata layer is about to issue a command. We wrap
@@ -142,7 +142,7 @@ static void cs5530_set_dmamode(struct ata_port *ap, struct ata_device *adev)
142 * one MWDMA/UDMA bit. 142 * one MWDMA/UDMA bit.
143 */ 143 */
144 144
145static unsigned int cs5530_qc_issue_prot(struct ata_queued_cmd *qc) 145static unsigned int cs5530_qc_issue(struct ata_queued_cmd *qc)
146{ 146{
147 struct ata_port *ap = qc->ap; 147 struct ata_port *ap = qc->ap;
148 struct ata_device *adev = qc->dev; 148 struct ata_device *adev = qc->dev;
@@ -157,59 +157,23 @@ static unsigned int cs5530_qc_issue_prot(struct ata_queued_cmd *qc)
157 cs5530_set_dmamode(ap, adev); 157 cs5530_set_dmamode(ap, adev);
158 } 158 }
159 159
160 return ata_qc_issue_prot(qc); 160 return ata_sff_qc_issue(qc);
161} 161}
162 162
163static struct scsi_host_template cs5530_sht = { 163static struct scsi_host_template cs5530_sht = {
164 .module = THIS_MODULE, 164 ATA_BMDMA_SHT(DRV_NAME),
165 .name = DRV_NAME, 165 .sg_tablesize = LIBATA_DUMB_MAX_PRD,
166 .ioctl = ata_scsi_ioctl,
167 .queuecommand = ata_scsi_queuecmd,
168 .can_queue = ATA_DEF_QUEUE,
169 .this_id = ATA_SHT_THIS_ID,
170 .sg_tablesize = LIBATA_DUMB_MAX_PRD,
171 .cmd_per_lun = ATA_SHT_CMD_PER_LUN,
172 .emulated = ATA_SHT_EMULATED,
173 .use_clustering = ATA_SHT_USE_CLUSTERING,
174 .proc_name = DRV_NAME,
175 .dma_boundary = ATA_DMA_BOUNDARY,
176 .slave_configure = ata_scsi_slave_config,
177 .slave_destroy = ata_scsi_slave_destroy,
178 .bios_param = ata_std_bios_param,
179}; 166};
180 167
181static struct ata_port_operations cs5530_port_ops = { 168static struct ata_port_operations cs5530_port_ops = {
182 .set_piomode = cs5530_set_piomode, 169 .inherits = &ata_bmdma_port_ops,
183 .set_dmamode = cs5530_set_dmamode,
184 .mode_filter = ata_pci_default_filter,
185
186 .tf_load = ata_tf_load,
187 .tf_read = ata_tf_read,
188 .check_status = ata_check_status,
189 .exec_command = ata_exec_command,
190 .dev_select = ata_std_dev_select,
191
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
197 .freeze = ata_bmdma_freeze,
198 .thaw = ata_bmdma_thaw,
199 .error_handler = ata_bmdma_error_handler,
200 .post_internal_cmd = ata_bmdma_post_internal_cmd,
201 .cable_detect = ata_cable_40wire,
202
203 .qc_prep = ata_dumb_qc_prep,
204 .qc_issue = cs5530_qc_issue_prot,
205 170
206 .data_xfer = ata_data_xfer, 171 .qc_prep = ata_sff_dumb_qc_prep,
172 .qc_issue = cs5530_qc_issue,
207 173
208 .irq_handler = ata_interrupt, 174 .cable_detect = ata_cable_40wire,
209 .irq_clear = ata_bmdma_irq_clear, 175 .set_piomode = cs5530_set_piomode,
210 .irq_on = ata_irq_on, 176 .set_dmamode = cs5530_set_dmamode,
211
212 .port_start = ata_sff_port_start,
213}; 177};
214 178
215static const struct dmi_system_id palmax_dmi_table[] = { 179static const struct dmi_system_id palmax_dmi_table[] = {
@@ -334,7 +298,6 @@ fail_put:
334static int cs5530_init_one(struct pci_dev *pdev, const struct pci_device_id *id) 298static int cs5530_init_one(struct pci_dev *pdev, const struct pci_device_id *id)
335{ 299{
336 static const struct ata_port_info info = { 300 static const struct ata_port_info info = {
337 .sht = &cs5530_sht,
338 .flags = ATA_FLAG_SLAVE_POSS, 301 .flags = ATA_FLAG_SLAVE_POSS,
339 .pio_mask = 0x1f, 302 .pio_mask = 0x1f,
340 .mwdma_mask = 0x07, 303 .mwdma_mask = 0x07,
@@ -343,12 +306,16 @@ static int cs5530_init_one(struct pci_dev *pdev, const struct pci_device_id *id)
343 }; 306 };
344 /* The docking connector doesn't do UDMA, and it seems not MWDMA */ 307 /* The docking connector doesn't do UDMA, and it seems not MWDMA */
345 static const struct ata_port_info info_palmax_secondary = { 308 static const struct ata_port_info info_palmax_secondary = {
346 .sht = &cs5530_sht,
347 .flags = ATA_FLAG_SLAVE_POSS, 309 .flags = ATA_FLAG_SLAVE_POSS,
348 .pio_mask = 0x1f, 310 .pio_mask = 0x1f,
349 .port_ops = &cs5530_port_ops 311 .port_ops = &cs5530_port_ops
350 }; 312 };
351 const struct ata_port_info *ppi[] = { &info, NULL }; 313 const struct ata_port_info *ppi[] = { &info, NULL };
314 int rc;
315
316 rc = pcim_enable_device(pdev);
317 if (rc)
318 return rc;
352 319
353 /* Chip initialisation */ 320 /* Chip initialisation */
354 if (cs5530_init_chip()) 321 if (cs5530_init_chip())
@@ -358,16 +325,25 @@ static int cs5530_init_one(struct pci_dev *pdev, const struct pci_device_id *id)
358 ppi[1] = &info_palmax_secondary; 325 ppi[1] = &info_palmax_secondary;
359 326
360 /* Now kick off ATA set up */ 327 /* Now kick off ATA set up */
361 return ata_pci_init_one(pdev, ppi); 328 return ata_pci_sff_init_one(pdev, ppi, &cs5530_sht, NULL);
362} 329}
363 330
364#ifdef CONFIG_PM 331#ifdef CONFIG_PM
365static int cs5530_reinit_one(struct pci_dev *pdev) 332static int cs5530_reinit_one(struct pci_dev *pdev)
366{ 333{
334 struct ata_host *host = dev_get_drvdata(&pdev->dev);
335 int rc;
336
337 rc = ata_pci_device_do_resume(pdev);
338 if (rc)
339 return rc;
340
367 /* If we fail on resume we are doomed */ 341 /* If we fail on resume we are doomed */
368 if (cs5530_init_chip()) 342 if (cs5530_init_chip())
369 BUG(); 343 return -EIO;
370 return ata_pci_device_resume(pdev); 344
345 ata_host_resume(host);
346 return 0;
371} 347}
372#endif /* CONFIG_PM */ 348#endif /* CONFIG_PM */
373 349