aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/ata/pata_it821x.c
diff options
context:
space:
mode:
authorJeff Garzik <jeff@garzik.org>2006-08-31 00:03:49 -0400
committerJeff Garzik <jeff@garzik.org>2006-08-31 00:03:49 -0400
commit85cd7251b9112e3dabeac9fd3b175601ca607241 (patch)
treeb33b80f54883e224a586661165bd0aee2c47ed39 /drivers/ata/pata_it821x.c
parent481ff126e8d9be63809e7854badf815e54066eed (diff)
[libata #pata-drivers] Trim trailing whitespace.
Diffstat (limited to 'drivers/ata/pata_it821x.c')
-rw-r--r--drivers/ata/pata_it821x.c70
1 files changed, 35 insertions, 35 deletions
diff --git a/drivers/ata/pata_it821x.c b/drivers/ata/pata_it821x.c
index c8a7798f8ce5..af39097d8081 100644
--- a/drivers/ata/pata_it821x.c
+++ b/drivers/ata/pata_it821x.c
@@ -6,7 +6,7 @@
6 * based upon 6 * based upon
7 * 7 *
8 * it821x.c 8 * it821x.c
9 * 9 *
10 * linux/drivers/ide/pci/it821x.c Version 0.09 December 2004 10 * linux/drivers/ide/pci/it821x.c Version 0.09 December 2004
11 * 11 *
12 * Copyright (C) 2004 Red Hat <alan@redhat.com> 12 * Copyright (C) 2004 Red Hat <alan@redhat.com>
@@ -118,7 +118,7 @@ static int it8212_noraid;
118 * 118 *
119 * Set the cable type 119 * Set the cable type
120 */ 120 */
121 121
122static int it821x_pre_reset(struct ata_port *ap) 122static int it821x_pre_reset(struct ata_port *ap)
123{ 123{
124 ap->cbl = ATA_CBL_PATA80; 124 ap->cbl = ATA_CBL_PATA80;
@@ -131,7 +131,7 @@ static int it821x_pre_reset(struct ata_port *ap)
131 * 131 *
132 * Set the cable type and trigger a probe 132 * Set the cable type and trigger a probe
133 */ 133 */
134 134
135static void it821x_error_handler(struct ata_port *ap) 135static void it821x_error_handler(struct ata_port *ap)
136{ 136{
137 return ata_bmdma_drive_eh(ap, it821x_pre_reset, ata_std_softreset, NULL, ata_std_postreset); 137 return ata_bmdma_drive_eh(ap, it821x_pre_reset, ata_std_softreset, NULL, ata_std_postreset);
@@ -286,7 +286,7 @@ static void it821x_passthru_set_piomode(struct ata_port *ap, struct ata_device *
286 struct it821x_dev *itdev = ap->private_data; 286 struct it821x_dev *itdev = ap->private_data;
287 int unit = adev->devno; 287 int unit = adev->devno;
288 int mode_wanted = adev->pio_mode - XFER_PIO_0; 288 int mode_wanted = adev->pio_mode - XFER_PIO_0;
289 289
290 /* We prefer 66Mhz clock for PIO 0-3, don't care for PIO4 */ 290 /* We prefer 66Mhz clock for PIO 0-3, don't care for PIO4 */
291 itdev->want[unit][1] = pio_want[mode_wanted]; 291 itdev->want[unit][1] = pio_want[mode_wanted];
292 itdev->want[unit][0] = 1; /* PIO is lowest priority */ 292 itdev->want[unit][0] = 1; /* PIO is lowest priority */
@@ -301,7 +301,7 @@ static void it821x_passthru_set_piomode(struct ata_port *ap, struct ata_device *
301 * @adev: ATA device 301 * @adev: ATA device
302 * 302 *
303 * Set up the DMA modes. The actions taken depend heavily on the mode 303 * Set up the DMA modes. The actions taken depend heavily on the mode
304 * to use. If UDMA is used as is hopefully the usual case then the 304 * to use. If UDMA is used as is hopefully the usual case then the
305 * timing register is private and we need only consider the clock. If 305 * timing register is private and we need only consider the clock. If
306 * we are using MWDMA then we have to manage the setting ourself as 306 * we are using MWDMA then we have to manage the setting ourself as
307 * we switch devices and mode. 307 * we switch devices and mode.
@@ -322,7 +322,7 @@ static void it821x_passthru_set_dmamode(struct ata_port *ap, struct ata_device *
322 322
323 if (adev->dma_mode >= XFER_UDMA_0) { 323 if (adev->dma_mode >= XFER_UDMA_0) {
324 int mode_wanted = adev->dma_mode - XFER_UDMA_0; 324 int mode_wanted = adev->dma_mode - XFER_UDMA_0;
325 325
326 itdev->want[unit][1] = udma_want[mode_wanted]; 326 itdev->want[unit][1] = udma_want[mode_wanted];
327 itdev->want[unit][0] = 3; /* UDMA is high priority */ 327 itdev->want[unit][0] = 3; /* UDMA is high priority */
328 itdev->mwdma[unit] = MWDMA_OFF; 328 itdev->mwdma[unit] = MWDMA_OFF;
@@ -341,7 +341,7 @@ static void it821x_passthru_set_dmamode(struct ata_port *ap, struct ata_device *
341 it821x_program_udma(ap, adev, itdev->udma[unit]); 341 it821x_program_udma(ap, adev, itdev->udma[unit]);
342 } else { 342 } else {
343 int mode_wanted = adev->dma_mode - XFER_MW_DMA_0; 343 int mode_wanted = adev->dma_mode - XFER_MW_DMA_0;
344 344
345 itdev->want[unit][1] = mwdma_want[mode_wanted]; 345 itdev->want[unit][1] = mwdma_want[mode_wanted];
346 itdev->want[unit][0] = 2; /* MWDMA is low priority */ 346 itdev->want[unit][0] = 2; /* MWDMA is low priority */
347 itdev->mwdma[unit] = dma[mode_wanted]; 347 itdev->mwdma[unit] = dma[mode_wanted];
@@ -363,7 +363,7 @@ static void it821x_passthru_set_dmamode(struct ata_port *ap, struct ata_device *
363 * @qc: Command in progress 363 * @qc: Command in progress
364 * 364 *
365 * Usually drivers set the DMA timing at the point the set_dmamode call 365 * Usually drivers set the DMA timing at the point the set_dmamode call
366 * is made. IT821x however requires we load new timings on the 366 * is made. IT821x however requires we load new timings on the
367 * transitions in some cases. 367 * transitions in some cases.
368 */ 368 */
369 369
@@ -410,7 +410,7 @@ static void it821x_passthru_bmdma_stop(struct ata_queued_cmd *qc)
410 * 410 *
411 * Device selection hook. If neccessary perform clock switching 411 * Device selection hook. If neccessary perform clock switching
412 */ 412 */
413 413
414static void it821x_passthru_dev_select(struct ata_port *ap, 414static void it821x_passthru_dev_select(struct ata_port *ap,
415 unsigned int device) 415 unsigned int device)
416{ 416{
@@ -431,7 +431,7 @@ static void it821x_passthru_dev_select(struct ata_port *ap,
431 * perform out own device selection timing loads before the 431 * perform out own device selection timing loads before the
432 * usual happenings kick off 432 * usual happenings kick off
433 */ 433 */
434 434
435static unsigned int it821x_smart_qc_issue_prot(struct ata_queued_cmd *qc) 435static unsigned int it821x_smart_qc_issue_prot(struct ata_queued_cmd *qc)
436{ 436{
437 switch(qc->tf.command) 437 switch(qc->tf.command)
@@ -466,7 +466,7 @@ static unsigned int it821x_smart_qc_issue_prot(struct ata_queued_cmd *qc)
466 * perform out own device selection timing loads before the 466 * perform out own device selection timing loads before the
467 * usual happenings kick off 467 * usual happenings kick off
468 */ 468 */
469 469
470static unsigned int it821x_passthru_qc_issue_prot(struct ata_queued_cmd *qc) 470static unsigned int it821x_passthru_qc_issue_prot(struct ata_queued_cmd *qc)
471{ 471{
472 it821x_passthru_dev_select(qc->ap, qc->dev->devno); 472 it821x_passthru_dev_select(qc->ap, qc->dev->devno);
@@ -480,9 +480,9 @@ static unsigned int it821x_passthru_qc_issue_prot(struct ata_queued_cmd *qc)
480 * Use a non standard set_mode function. We don't want to be tuned. 480 * Use a non standard set_mode function. We don't want to be tuned.
481 * The BIOS configured everything. Our job is not to fiddle. We 481 * The BIOS configured everything. Our job is not to fiddle. We
482 * read the dma enabled bits from the PCI configuration of the device 482 * read the dma enabled bits from the PCI configuration of the device
483 * and respect them. 483 * and respect them.
484 */ 484 */
485 485
486static void it821x_smart_set_mode(struct ata_port *ap) 486static void it821x_smart_set_mode(struct ata_port *ap)
487{ 487{
488 int dma_enabled = 0; 488 int dma_enabled = 0;
@@ -492,14 +492,14 @@ static void it821x_smart_set_mode(struct ata_port *ap)
492 /* It is possible that BMDMA isn't allocated */ 492 /* It is possible that BMDMA isn't allocated */
493 if (ap->ioaddr.bmdma_addr) 493 if (ap->ioaddr.bmdma_addr)
494 dma_enabled = inb(ap->ioaddr.bmdma_addr + ATA_DMA_CMD); 494 dma_enabled = inb(ap->ioaddr.bmdma_addr + ATA_DMA_CMD);
495 495
496 for (i = 0; i < ATA_MAX_DEVICES; i++) { 496 for (i = 0; i < ATA_MAX_DEVICES; i++) {
497 struct ata_device *dev = &ap->device[i]; 497 struct ata_device *dev = &ap->device[i];
498 if (ata_dev_enabled(dev)) { 498 if (ata_dev_enabled(dev)) {
499 /* We don't really care */ 499 /* We don't really care */
500 dev->pio_mode = XFER_PIO_0; 500 dev->pio_mode = XFER_PIO_0;
501 dev->dma_mode = XFER_MW_DMA_0; 501 dev->dma_mode = XFER_MW_DMA_0;
502 /* We do need the right mode information for DMA or PIO 502 /* We do need the right mode information for DMA or PIO
503 and this comes from the current configuration flags */ 503 and this comes from the current configuration flags */
504 if (dma_enabled & (1 << (5 + i))) { 504 if (dma_enabled & (1 << (5 + i))) {
505 dev->xfer_mode = XFER_MW_DMA_0; 505 dev->xfer_mode = XFER_MW_DMA_0;
@@ -526,7 +526,7 @@ static void it821x_smart_set_mode(struct ata_port *ap)
526 * FIXME: When FUA appears we need to block FUA too. And SMART and 526 * FIXME: When FUA appears we need to block FUA too. And SMART and
527 * basically we need to filter commands for this chip. 527 * basically we need to filter commands for this chip.
528 */ 528 */
529 529
530static void it821x_dev_config(struct ata_port *ap, struct ata_device *adev) 530static void it821x_dev_config(struct ata_port *ap, struct ata_device *adev)
531{ 531{
532 unsigned char model_num[40]; 532 unsigned char model_num[40];
@@ -535,7 +535,7 @@ static void it821x_dev_config(struct ata_port *ap, struct ata_device *adev)
535 535
536 /* This block ought to be a library routine as it is in several 536 /* This block ought to be a library routine as it is in several
537 drivers now */ 537 drivers now */
538 538
539 ata_id_string(adev->id, model_num, ATA_ID_PROD_OFS, 539 ata_id_string(adev->id, model_num, ATA_ID_PROD_OFS,
540 sizeof(model_num)); 540 sizeof(model_num));
541 s = &model_num[0]; 541 s = &model_num[0];
@@ -549,7 +549,7 @@ static void it821x_dev_config(struct ata_port *ap, struct ata_device *adev)
549 549
550 if (adev->max_sectors > 255) 550 if (adev->max_sectors > 255)
551 adev->max_sectors = 255; 551 adev->max_sectors = 255;
552 552
553 if (strstr(model_num, "Integrated Technology Express")) { 553 if (strstr(model_num, "Integrated Technology Express")) {
554 /* RAID mode */ 554 /* RAID mode */
555 printk(KERN_INFO "IT821x %sRAID%d volume", 555 printk(KERN_INFO "IT821x %sRAID%d volume",
@@ -569,12 +569,12 @@ static void it821x_dev_config(struct ata_port *ap, struct ata_device *adev)
569 * Decide if this ATAPI command can be issued by DMA on this 569 * Decide if this ATAPI command can be issued by DMA on this
570 * controller. Return 0 if it can be. 570 * controller. Return 0 if it can be.
571 */ 571 */
572 572
573static int it821x_check_atapi_dma(struct ata_queued_cmd *qc) 573static int it821x_check_atapi_dma(struct ata_queued_cmd *qc)
574{ 574{
575 struct ata_port *ap = qc->ap; 575 struct ata_port *ap = qc->ap;
576 struct it821x_dev *itdev = ap->private_data; 576 struct it821x_dev *itdev = ap->private_data;
577 577
578 /* No ATAPI DMA in smart mode */ 578 /* No ATAPI DMA in smart mode */
579 if (itdev->smart) 579 if (itdev->smart)
580 return -EOPNOTSUPP; 580 return -EOPNOTSUPP;
@@ -584,7 +584,7 @@ static int it821x_check_atapi_dma(struct ata_queued_cmd *qc)
584 /* Cool */ 584 /* Cool */
585 return 0; 585 return 0;
586} 586}
587 587
588 588
589/** 589/**
590 * it821x_port_start - port setup 590 * it821x_port_start - port setup
@@ -592,10 +592,10 @@ static int it821x_check_atapi_dma(struct ata_queued_cmd *qc)
592 * 592 *
593 * The it821x needs to maintain private data structures and also to 593 * The it821x needs to maintain private data structures and also to
594 * use the standard PCI interface which lacks support for this 594 * use the standard PCI interface which lacks support for this
595 * functionality. We instead set up the private data on the port 595 * functionality. We instead set up the private data on the port
596 * start hook, and tear it down on port stop 596 * start hook, and tear it down on port stop
597 */ 597 */
598 598
599static int it821x_port_start(struct ata_port *ap) 599static int it821x_port_start(struct ata_port *ap)
600{ 600{
601 struct pci_dev *pdev = to_pci_dev(ap->host->dev); 601 struct pci_dev *pdev = to_pci_dev(ap->host->dev);
@@ -605,13 +605,13 @@ static int it821x_port_start(struct ata_port *ap)
605 int ret = ata_port_start(ap); 605 int ret = ata_port_start(ap);
606 if (ret < 0) 606 if (ret < 0)
607 return ret; 607 return ret;
608 608
609 ap->private_data = kmalloc(sizeof(struct it821x_dev), GFP_KERNEL); 609 ap->private_data = kmalloc(sizeof(struct it821x_dev), GFP_KERNEL);
610 if (ap->private_data == NULL) { 610 if (ap->private_data == NULL) {
611 ata_port_stop(ap); 611 ata_port_stop(ap);
612 return -ENOMEM; 612 return -ENOMEM;
613 } 613 }
614 614
615 itdev = ap->private_data; 615 itdev = ap->private_data;
616 memset(itdev, 0, sizeof(struct it821x_dev)); 616 memset(itdev, 0, sizeof(struct it821x_dev));
617 617
@@ -650,7 +650,7 @@ static int it821x_port_start(struct ata_port *ap)
650 * 650 *
651 * Release the private objects we added in it821x_port_start 651 * Release the private objects we added in it821x_port_start
652 */ 652 */
653 653
654static void it821x_port_stop(struct ata_port *ap) { 654static void it821x_port_stop(struct ata_port *ap) {
655 kfree(ap->private_data); 655 kfree(ap->private_data);
656 ap->private_data = NULL; /* We want an OOPS if we reuse this 656 ap->private_data = NULL; /* We want an OOPS if we reuse this
@@ -684,7 +684,7 @@ static struct ata_port_operations it821x_smart_port_ops = {
684 .tf_load = ata_tf_load, 684 .tf_load = ata_tf_load,
685 .tf_read = ata_tf_read, 685 .tf_read = ata_tf_read,
686 .mode_filter = ata_pci_default_filter, 686 .mode_filter = ata_pci_default_filter,
687 687
688 .check_status = ata_check_status, 688 .check_status = ata_check_status,
689 .check_atapi_dma= it821x_check_atapi_dma, 689 .check_atapi_dma= it821x_check_atapi_dma,
690 .exec_command = ata_exec_command, 690 .exec_command = ata_exec_command,
@@ -712,14 +712,14 @@ static struct ata_port_operations it821x_smart_port_ops = {
712 .port_start = it821x_port_start, 712 .port_start = it821x_port_start,
713 .port_stop = it821x_port_stop, 713 .port_stop = it821x_port_stop,
714 .host_stop = ata_host_stop 714 .host_stop = ata_host_stop
715}; 715};
716 716
717static struct ata_port_operations it821x_passthru_port_ops = { 717static struct ata_port_operations it821x_passthru_port_ops = {
718 .port_disable = ata_port_disable, 718 .port_disable = ata_port_disable,
719 .set_piomode = it821x_passthru_set_piomode, 719 .set_piomode = it821x_passthru_set_piomode,
720 .set_dmamode = it821x_passthru_set_dmamode, 720 .set_dmamode = it821x_passthru_set_dmamode,
721 .mode_filter = ata_pci_default_filter, 721 .mode_filter = ata_pci_default_filter,
722 722
723 .tf_load = ata_tf_load, 723 .tf_load = ata_tf_load,
724 .tf_read = ata_tf_read, 724 .tf_read = ata_tf_read,
725 .check_status = ata_check_status, 725 .check_status = ata_check_status,
@@ -748,7 +748,7 @@ static struct ata_port_operations it821x_passthru_port_ops = {
748 .port_start = it821x_port_start, 748 .port_start = it821x_port_start,
749 .port_stop = it821x_port_stop, 749 .port_stop = it821x_port_stop,
750 .host_stop = ata_host_stop 750 .host_stop = ata_host_stop
751}; 751};
752 752
753static void __devinit it821x_disable_raid(struct pci_dev *pdev) 753static void __devinit it821x_disable_raid(struct pci_dev *pdev)
754{ 754{
@@ -767,11 +767,11 @@ static void __devinit it821x_disable_raid(struct pci_dev *pdev)
767 pci_write_config_byte(pdev, PCI_LATENCY_TIMER, 0x20); 767 pci_write_config_byte(pdev, PCI_LATENCY_TIMER, 0x20);
768} 768}
769 769
770 770
771static int it821x_init_one(struct pci_dev *pdev, const struct pci_device_id *id) 771static int it821x_init_one(struct pci_dev *pdev, const struct pci_device_id *id)
772{ 772{
773 u8 conf; 773 u8 conf;
774 774
775 static struct ata_port_info info_smart = { 775 static struct ata_port_info info_smart = {
776 .sht = &it821x_sht, 776 .sht = &it821x_sht,
777 .flags = ATA_FLAG_SLAVE_POSS | ATA_FLAG_SRST, 777 .flags = ATA_FLAG_SLAVE_POSS | ATA_FLAG_SRST,
@@ -788,7 +788,7 @@ static int it821x_init_one(struct pci_dev *pdev, const struct pci_device_id *id)
788 .port_ops = &it821x_passthru_port_ops 788 .port_ops = &it821x_passthru_port_ops
789 }; 789 };
790 static struct ata_port_info *port_info[2]; 790 static struct ata_port_info *port_info[2];
791 791
792 static char *mode[2] = { "pass through", "smart" }; 792 static char *mode[2] = { "pass through", "smart" };
793 793
794 /* Force the card into bypass mode if so requested */ 794 /* Force the card into bypass mode if so requested */
@@ -798,13 +798,13 @@ static int it821x_init_one(struct pci_dev *pdev, const struct pci_device_id *id)
798 } 798 }
799 pci_read_config_byte(pdev, 0x50, &conf); 799 pci_read_config_byte(pdev, 0x50, &conf);
800 conf &= 1; 800 conf &= 1;
801 801
802 printk(KERN_INFO DRV_NAME ": controller in %s mode.\n", mode[conf]); 802 printk(KERN_INFO DRV_NAME ": controller in %s mode.\n", mode[conf]);
803 if (conf == 0) 803 if (conf == 0)
804 port_info[0] = port_info[1] = &info_passthru; 804 port_info[0] = port_info[1] = &info_passthru;
805 else 805 else
806 port_info[0] = port_info[1] = &info_smart; 806 port_info[0] = port_info[1] = &info_smart;
807 807
808 return ata_pci_init_one(pdev, port_info, 2); 808 return ata_pci_init_one(pdev, port_info, 2);
809} 809}
810 810