aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/ata/pata_ns87415.c
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2008-04-18 11:38:06 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2008-04-18 11:38:06 -0400
commit8019aa946af5218bc4446c21e43cc19c9401ac68 (patch)
tree6681b73a560f5a4e4a4e8f97b3833a087a488439 /drivers/ata/pata_ns87415.c
parent73e3e6481f56b3b5b618671a8d32b19a35f84316 (diff)
parent48feb3c419508487becfb9ea3afcc54c3eac6d80 (diff)
Merge branch 'upstream-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jgarzik/libata-dev
* 'upstream-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jgarzik/libata-dev: (79 commits) ata-acpi: don't call _GTF for disabled drive sata_mv add temporary 3 second init delay for SiliconImage PMs sata_mv remove redundant edma init code sata_mv add basic port multiplier support sata_mv fix SOC flags, enable NCQ on SOC sata_mv disable hotplug for now sata_mv cosmetics sata_mv hardreset rework [libata] improve Kconfig help text for new PMP, SFF options libata: make EH fail gracefully if no reset method is available libata: Be a bit more slack about early devices libata: cable logic libata: move link onlineness check out of softreset methods libata: kill dead code paths in reset path pata_scc: fix build breakage libata: make PMP support optional libata: implement PMP helpers libata: separate PMP support code from core code libata: make SFF support optional libata: don't use ap->ioaddr in non-SFF drivers ...
Diffstat (limited to 'drivers/ata/pata_ns87415.c')
-rw-r--r--drivers/ata/pata_ns87415.c102
1 files changed, 24 insertions, 78 deletions
diff --git a/drivers/ata/pata_ns87415.c b/drivers/ata/pata_ns87415.c
index d0e2e50823b1..ae92b0049bd5 100644
--- a/drivers/ata/pata_ns87415.c
+++ b/drivers/ata/pata_ns87415.c
@@ -138,7 +138,7 @@ static void ns87415_bmdma_setup(struct ata_queued_cmd *qc)
138 dmactl |= ATA_DMA_WR; 138 dmactl |= ATA_DMA_WR;
139 iowrite8(dmactl, ap->ioaddr.bmdma_addr + ATA_DMA_CMD); 139 iowrite8(dmactl, ap->ioaddr.bmdma_addr + ATA_DMA_CMD);
140 /* issue r/w command */ 140 /* issue r/w command */
141 ap->ops->exec_command(ap, &qc->tf); 141 ap->ops->sff_exec_command(ap, &qc->tf);
142} 142}
143 143
144/** 144/**
@@ -172,14 +172,14 @@ static void ns87415_bmdma_stop(struct ata_queued_cmd *qc)
172} 172}
173 173
174/** 174/**
175 * ns87415_bmdma_irq_clear - Clear interrupt 175 * ns87415_irq_clear - Clear interrupt
176 * @ap: Channel to clear 176 * @ap: Channel to clear
177 * 177 *
178 * Erratum: Due to a chip bug regisers 02 and 0A bit 1 and 2 (the 178 * Erratum: Due to a chip bug regisers 02 and 0A bit 1 and 2 (the
179 * error bits) are reset by writing to register 00 or 08. 179 * error bits) are reset by writing to register 00 or 08.
180 */ 180 */
181 181
182static void ns87415_bmdma_irq_clear(struct ata_port *ap) 182static void ns87415_irq_clear(struct ata_port *ap)
183{ 183{
184 void __iomem *mmio = ap->ioaddr.bmdma_addr; 184 void __iomem *mmio = ap->ioaddr.bmdma_addr;
185 185
@@ -297,90 +297,32 @@ static u8 ns87560_bmdma_status(struct ata_port *ap)
297{ 297{
298 return ns87560_read_buggy(ap->ioaddr.bmdma_addr + ATA_DMA_STATUS); 298 return ns87560_read_buggy(ap->ioaddr.bmdma_addr + ATA_DMA_STATUS);
299} 299}
300
301static const struct ata_port_operations ns87560_pata_ops = {
302 .set_piomode = ns87415_set_piomode,
303 .mode_filter = ata_pci_default_filter,
304
305 .tf_load = ata_tf_load,
306 .tf_read = ns87560_tf_read,
307 .check_status = ns87560_check_status,
308 .check_atapi_dma = ns87415_check_atapi_dma,
309 .exec_command = ata_exec_command,
310 .dev_select = ata_std_dev_select,
311
312 .freeze = ata_bmdma_freeze,
313 .thaw = ata_bmdma_thaw,
314 .error_handler = ata_bmdma_error_handler,
315 .post_internal_cmd = ata_bmdma_post_internal_cmd,
316 .cable_detect = ata_cable_40wire,
317
318 .bmdma_setup = ns87415_bmdma_setup,
319 .bmdma_start = ns87415_bmdma_start,
320 .bmdma_stop = ns87415_bmdma_stop,
321 .bmdma_status = ns87560_bmdma_status,
322 .qc_prep = ata_qc_prep,
323 .qc_issue = ata_qc_issue_prot,
324 .data_xfer = ata_data_xfer,
325
326 .irq_handler = ata_interrupt,
327 .irq_clear = ns87415_bmdma_irq_clear,
328 .irq_on = ata_irq_on,
329
330 .port_start = ata_sff_port_start,
331};
332
333#endif /* 87560 SuperIO Support */ 300#endif /* 87560 SuperIO Support */
334 301
302static struct ata_port_operations ns87415_pata_ops = {
303 .inherits = &ata_bmdma_port_ops,
335 304
336static const struct ata_port_operations ns87415_pata_ops = {
337 .set_piomode = ns87415_set_piomode,
338 .mode_filter = ata_pci_default_filter,
339
340 .tf_load = ata_tf_load,
341 .tf_read = ata_tf_read,
342 .check_status = ata_check_status,
343 .check_atapi_dma = ns87415_check_atapi_dma, 305 .check_atapi_dma = ns87415_check_atapi_dma,
344 .exec_command = ata_exec_command,
345 .dev_select = ata_std_dev_select,
346
347 .freeze = ata_bmdma_freeze,
348 .thaw = ata_bmdma_thaw,
349 .error_handler = ata_bmdma_error_handler,
350 .post_internal_cmd = ata_bmdma_post_internal_cmd,
351 .cable_detect = ata_cable_40wire,
352
353 .bmdma_setup = ns87415_bmdma_setup, 306 .bmdma_setup = ns87415_bmdma_setup,
354 .bmdma_start = ns87415_bmdma_start, 307 .bmdma_start = ns87415_bmdma_start,
355 .bmdma_stop = ns87415_bmdma_stop, 308 .bmdma_stop = ns87415_bmdma_stop,
356 .bmdma_status = ata_bmdma_status, 309 .sff_irq_clear = ns87415_irq_clear,
357 .qc_prep = ata_qc_prep,
358 .qc_issue = ata_qc_issue_prot,
359 .data_xfer = ata_data_xfer,
360 310
361 .irq_handler = ata_interrupt, 311 .cable_detect = ata_cable_40wire,
362 .irq_clear = ns87415_bmdma_irq_clear, 312 .set_piomode = ns87415_set_piomode,
363 .irq_on = ata_irq_on, 313};
364 314
365 .port_start = ata_sff_port_start, 315#if defined(CONFIG_SUPERIO)
316static struct ata_port_operations ns87560_pata_ops = {
317 .inherits = &ns87415_pata_ops,
318 .sff_tf_read = ns87560_tf_read,
319 .sff_check_status = ns87560_check_status,
320 .bmdma_status = ns87560_bmdma_status,
366}; 321};
322#endif
367 323
368static struct scsi_host_template ns87415_sht = { 324static struct scsi_host_template ns87415_sht = {
369 .module = THIS_MODULE, 325 ATA_BMDMA_SHT(DRV_NAME),
370 .name = DRV_NAME,
371 .ioctl = ata_scsi_ioctl,
372 .queuecommand = ata_scsi_queuecmd,
373 .can_queue = ATA_DEF_QUEUE,
374 .this_id = ATA_SHT_THIS_ID,
375 .sg_tablesize = LIBATA_MAX_PRD,
376 .cmd_per_lun = ATA_SHT_CMD_PER_LUN,
377 .emulated = ATA_SHT_EMULATED,
378 .use_clustering = ATA_SHT_USE_CLUSTERING,
379 .proc_name = DRV_NAME,
380 .dma_boundary = ATA_DMA_BOUNDARY,
381 .slave_configure = ata_scsi_slave_config,
382 .slave_destroy = ata_scsi_slave_destroy,
383 .bios_param = ata_std_bios_param,
384}; 326};
385 327
386 328
@@ -403,16 +345,15 @@ static int ns87415_init_one (struct pci_dev *pdev, const struct pci_device_id *e
403{ 345{
404 static int printed_version; 346 static int printed_version;
405 static const struct ata_port_info info = { 347 static const struct ata_port_info info = {
406 .sht = &ns87415_sht,
407 .flags = ATA_FLAG_SLAVE_POSS, 348 .flags = ATA_FLAG_SLAVE_POSS,
408 .pio_mask = 0x1f, /* pio0-4 */ 349 .pio_mask = 0x1f, /* pio0-4 */
409 .mwdma_mask = 0x07, /* mwdma0-2 */ 350 .mwdma_mask = 0x07, /* mwdma0-2 */
410 .port_ops = &ns87415_pata_ops, 351 .port_ops = &ns87415_pata_ops,
411 }; 352 };
412 const struct ata_port_info *ppi[] = { &info, NULL }; 353 const struct ata_port_info *ppi[] = { &info, NULL };
354 int rc;
413#if defined(CONFIG_SUPERIO) 355#if defined(CONFIG_SUPERIO)
414 static const struct ata_port_info info87560 = { 356 static const struct ata_port_info info87560 = {
415 .sht = &ns87415_sht,
416 .flags = ATA_FLAG_SLAVE_POSS, 357 .flags = ATA_FLAG_SLAVE_POSS,
417 .pio_mask = 0x1f, /* pio0-4 */ 358 .pio_mask = 0x1f, /* pio0-4 */
418 .mwdma_mask = 0x07, /* mwdma0-2 */ 359 .mwdma_mask = 0x07, /* mwdma0-2 */
@@ -425,11 +366,16 @@ static int ns87415_init_one (struct pci_dev *pdev, const struct pci_device_id *e
425 if (!printed_version++) 366 if (!printed_version++)
426 dev_printk(KERN_DEBUG, &pdev->dev, 367 dev_printk(KERN_DEBUG, &pdev->dev,
427 "version " DRV_VERSION "\n"); 368 "version " DRV_VERSION "\n");
369
370 rc = pcim_enable_device(pdev);
371 if (rc)
372 return rc;
373
428 /* Select 512 byte sectors */ 374 /* Select 512 byte sectors */
429 pci_write_config_byte(pdev, 0x55, 0xEE); 375 pci_write_config_byte(pdev, 0x55, 0xEE);
430 /* Select PIO0 8bit clocking */ 376 /* Select PIO0 8bit clocking */
431 pci_write_config_byte(pdev, 0x54, 0xB7); 377 pci_write_config_byte(pdev, 0x54, 0xB7);
432 return ata_pci_init_one(pdev, ppi); 378 return ata_pci_sff_init_one(pdev, ppi, &ns87415_sht, NULL);
433} 379}
434 380
435static const struct pci_device_id ns87415_pci_tbl[] = { 381static const struct pci_device_id ns87415_pci_tbl[] = {