diff options
Diffstat (limited to 'drivers/ata/pata_cs5520.c')
-rw-r--r-- | drivers/ata/pata_cs5520.c | 64 |
1 files changed, 21 insertions, 43 deletions
diff --git a/drivers/ata/pata_cs5520.c b/drivers/ata/pata_cs5520.c index 7ed279b0a12e..1186bcd2781c 100644 --- a/drivers/ata/pata_cs5520.c +++ b/drivers/ata/pata_cs5520.c | |||
@@ -140,51 +140,16 @@ static void cs5520_set_piomode(struct ata_port *ap, struct ata_device *adev) | |||
140 | } | 140 | } |
141 | 141 | ||
142 | static struct scsi_host_template cs5520_sht = { | 142 | static struct scsi_host_template cs5520_sht = { |
143 | .module = THIS_MODULE, | 143 | ATA_BMDMA_SHT(DRV_NAME), |
144 | .name = DRV_NAME, | ||
145 | .ioctl = ata_scsi_ioctl, | ||
146 | .queuecommand = ata_scsi_queuecmd, | ||
147 | .can_queue = ATA_DEF_QUEUE, | ||
148 | .this_id = ATA_SHT_THIS_ID, | ||
149 | .sg_tablesize = LIBATA_DUMB_MAX_PRD, | 144 | .sg_tablesize = LIBATA_DUMB_MAX_PRD, |
150 | .cmd_per_lun = ATA_SHT_CMD_PER_LUN, | ||
151 | .emulated = ATA_SHT_EMULATED, | ||
152 | .use_clustering = ATA_SHT_USE_CLUSTERING, | ||
153 | .proc_name = DRV_NAME, | ||
154 | .dma_boundary = ATA_DMA_BOUNDARY, | ||
155 | .slave_configure = ata_scsi_slave_config, | ||
156 | .slave_destroy = ata_scsi_slave_destroy, | ||
157 | .bios_param = ata_std_bios_param, | ||
158 | }; | 145 | }; |
159 | 146 | ||
160 | static struct ata_port_operations cs5520_port_ops = { | 147 | static struct ata_port_operations cs5520_port_ops = { |
148 | .inherits = &ata_bmdma_port_ops, | ||
149 | .qc_prep = ata_sff_dumb_qc_prep, | ||
150 | .cable_detect = ata_cable_40wire, | ||
161 | .set_piomode = cs5520_set_piomode, | 151 | .set_piomode = cs5520_set_piomode, |
162 | .set_dmamode = cs5520_set_dmamode, | 152 | .set_dmamode = cs5520_set_dmamode, |
163 | |||
164 | .tf_load = ata_tf_load, | ||
165 | .tf_read = ata_tf_read, | ||
166 | .check_status = ata_check_status, | ||
167 | .exec_command = ata_exec_command, | ||
168 | .dev_select = ata_std_dev_select, | ||
169 | |||
170 | .freeze = ata_bmdma_freeze, | ||
171 | .thaw = ata_bmdma_thaw, | ||
172 | .error_handler = ata_bmdma_error_handler, | ||
173 | .post_internal_cmd = ata_bmdma_post_internal_cmd, | ||
174 | .cable_detect = ata_cable_40wire, | ||
175 | |||
176 | .bmdma_setup = ata_bmdma_setup, | ||
177 | .bmdma_start = ata_bmdma_start, | ||
178 | .bmdma_stop = ata_bmdma_stop, | ||
179 | .bmdma_status = ata_bmdma_status, | ||
180 | .qc_prep = ata_dumb_qc_prep, | ||
181 | .qc_issue = ata_qc_issue_prot, | ||
182 | .data_xfer = ata_data_xfer, | ||
183 | |||
184 | .irq_clear = ata_bmdma_irq_clear, | ||
185 | .irq_on = ata_irq_on, | ||
186 | |||
187 | .port_start = ata_sff_port_start, | ||
188 | }; | 153 | }; |
189 | 154 | ||
190 | static int __devinit cs5520_init_one(struct pci_dev *pdev, const struct pci_device_id *id) | 155 | static int __devinit cs5520_init_one(struct pci_dev *pdev, const struct pci_device_id *id) |
@@ -203,6 +168,10 @@ static int __devinit cs5520_init_one(struct pci_dev *pdev, const struct pci_devi | |||
203 | struct ata_ioports *ioaddr; | 168 | struct ata_ioports *ioaddr; |
204 | int i, rc; | 169 | int i, rc; |
205 | 170 | ||
171 | rc = pcim_enable_device(pdev); | ||
172 | if (rc) | ||
173 | return rc; | ||
174 | |||
206 | /* IDE port enable bits */ | 175 | /* IDE port enable bits */ |
207 | pci_read_config_byte(pdev, 0x60, &pcicfg); | 176 | pci_read_config_byte(pdev, 0x60, &pcicfg); |
208 | 177 | ||
@@ -258,7 +227,7 @@ static int __devinit cs5520_init_one(struct pci_dev *pdev, const struct pci_devi | |||
258 | ioaddr->ctl_addr = iomap[1]; | 227 | ioaddr->ctl_addr = iomap[1]; |
259 | ioaddr->altstatus_addr = iomap[1]; | 228 | ioaddr->altstatus_addr = iomap[1]; |
260 | ioaddr->bmdma_addr = iomap[4]; | 229 | ioaddr->bmdma_addr = iomap[4]; |
261 | ata_std_ports(ioaddr); | 230 | ata_sff_std_ports(ioaddr); |
262 | 231 | ||
263 | ata_port_desc(host->ports[0], | 232 | ata_port_desc(host->ports[0], |
264 | "cmd 0x%x ctl 0x%x", cmd_port[0], ctl_port[0]); | 233 | "cmd 0x%x ctl 0x%x", cmd_port[0], ctl_port[0]); |
@@ -269,7 +238,7 @@ static int __devinit cs5520_init_one(struct pci_dev *pdev, const struct pci_devi | |||
269 | ioaddr->ctl_addr = iomap[3]; | 238 | ioaddr->ctl_addr = iomap[3]; |
270 | ioaddr->altstatus_addr = iomap[3]; | 239 | ioaddr->altstatus_addr = iomap[3]; |
271 | ioaddr->bmdma_addr = iomap[4] + 8; | 240 | ioaddr->bmdma_addr = iomap[4] + 8; |
272 | ata_std_ports(ioaddr); | 241 | ata_sff_std_ports(ioaddr); |
273 | 242 | ||
274 | ata_port_desc(host->ports[1], | 243 | ata_port_desc(host->ports[1], |
275 | "cmd 0x%x ctl 0x%x", cmd_port[1], ctl_port[1]); | 244 | "cmd 0x%x ctl 0x%x", cmd_port[1], ctl_port[1]); |
@@ -289,7 +258,7 @@ static int __devinit cs5520_init_one(struct pci_dev *pdev, const struct pci_devi | |||
289 | continue; | 258 | continue; |
290 | 259 | ||
291 | rc = devm_request_irq(&pdev->dev, irq[ap->port_no], | 260 | rc = devm_request_irq(&pdev->dev, irq[ap->port_no], |
292 | ata_interrupt, 0, DRV_NAME, host); | 261 | ata_sff_interrupt, 0, DRV_NAME, host); |
293 | if (rc) | 262 | if (rc) |
294 | return rc; | 263 | return rc; |
295 | 264 | ||
@@ -310,11 +279,20 @@ static int __devinit cs5520_init_one(struct pci_dev *pdev, const struct pci_devi | |||
310 | 279 | ||
311 | static int cs5520_reinit_one(struct pci_dev *pdev) | 280 | static int cs5520_reinit_one(struct pci_dev *pdev) |
312 | { | 281 | { |
282 | struct ata_host *host = dev_get_drvdata(&pdev->dev); | ||
313 | u8 pcicfg; | 283 | u8 pcicfg; |
284 | int rc; | ||
285 | |||
286 | rc = ata_pci_device_do_resume(pdev); | ||
287 | if (rc) | ||
288 | return rc; | ||
289 | |||
314 | pci_read_config_byte(pdev, 0x60, &pcicfg); | 290 | pci_read_config_byte(pdev, 0x60, &pcicfg); |
315 | if ((pcicfg & 0x40) == 0) | 291 | if ((pcicfg & 0x40) == 0) |
316 | pci_write_config_byte(pdev, 0x60, pcicfg | 0x40); | 292 | pci_write_config_byte(pdev, 0x60, pcicfg | 0x40); |
317 | return ata_pci_device_resume(pdev); | 293 | |
294 | ata_host_resume(host); | ||
295 | return 0; | ||
318 | } | 296 | } |
319 | 297 | ||
320 | /** | 298 | /** |