aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorMikael Pettersson <mikpe@it.uu.se>2007-02-25 11:51:15 -0500
committerJeff Garzik <jeff@garzik.org>2007-02-25 15:41:40 -0500
commit098cdff3d40286f87062c17cd07e98ca7ad94184 (patch)
tree5507d29e76b66c6a5f06835777df7267fbaa38a7 /drivers
parent540477b4d93f5b49f9e9ce3ae2437071103a0f8e (diff)
sata_promise: simplify port setup
Each place in pdc_ata_init_one() that initialises a SATA port first calls pdc_ata_setup_port(), and then manually assigns the port's ->scr_addr. Simplify the code by extending pdc_ata_setup_port() to also handle scr_addr initialisation; for PATA ports we pass NULL as scr_addr. The initialisation of the PATA-only 20619 redundantly set up scr_addr for the ports. Remove this. Tested on 20619, 20575, and 20775 chips. Signed-off-by: Mikael Pettersson <mikpe@it.uu.se> Signed-off-by: Jeff Garzik <jeff@garzik.org>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/ata/sata_promise.c29
1 files changed, 10 insertions, 19 deletions
diff --git a/drivers/ata/sata_promise.c b/drivers/ata/sata_promise.c
index 5940bf403751..44e0fc7471f2 100644
--- a/drivers/ata/sata_promise.c
+++ b/drivers/ata/sata_promise.c
@@ -777,7 +777,8 @@ static int pdc_old_check_atapi_dma(struct ata_queued_cmd *qc)
777 return pdc_check_atapi_dma(qc); 777 return pdc_check_atapi_dma(qc);
778} 778}
779 779
780static void pdc_ata_setup_port(struct ata_ioports *port, void __iomem *base) 780static void pdc_ata_setup_port(struct ata_ioports *port, void __iomem *base,
781 void __iomem *scr_addr)
781{ 782{
782 port->cmd_addr = base; 783 port->cmd_addr = base;
783 port->data_addr = base; 784 port->data_addr = base;
@@ -792,6 +793,7 @@ static void pdc_ata_setup_port(struct ata_ioports *port, void __iomem *base)
792 port->status_addr = base + 0x1c; 793 port->status_addr = base + 0x1c;
793 port->altstatus_addr = 794 port->altstatus_addr =
794 port->ctl_addr = base + 0x38; 795 port->ctl_addr = base + 0x38;
796 port->scr_addr = scr_addr;
795} 797}
796 798
797 799
@@ -904,11 +906,8 @@ static int pdc_ata_init_one (struct pci_dev *pdev, const struct pci_device_id *e
904 906
905 base = probe_ent->iomap[PDC_MMIO_BAR]; 907 base = probe_ent->iomap[PDC_MMIO_BAR];
906 908
907 pdc_ata_setup_port(&probe_ent->port[0], base + 0x200); 909 pdc_ata_setup_port(&probe_ent->port[0], base + 0x200, base + 0x400);
908 pdc_ata_setup_port(&probe_ent->port[1], base + 0x280); 910 pdc_ata_setup_port(&probe_ent->port[1], base + 0x280, base + 0x500);
909
910 probe_ent->port[0].scr_addr = base + 0x400;
911 probe_ent->port[1].scr_addr = base + 0x500;
912 911
913 /* notice 4-port boards */ 912 /* notice 4-port boards */
914 switch (board_idx) { 913 switch (board_idx) {
@@ -917,12 +916,8 @@ static int pdc_ata_init_one (struct pci_dev *pdev, const struct pci_device_id *e
917 /* Fall through */ 916 /* Fall through */
918 case board_20319: 917 case board_20319:
919 probe_ent->n_ports = 4; 918 probe_ent->n_ports = 4;
920 919 pdc_ata_setup_port(&probe_ent->port[2], base + 0x300, base + 0x600);
921 pdc_ata_setup_port(&probe_ent->port[2], base + 0x300); 920 pdc_ata_setup_port(&probe_ent->port[3], base + 0x380, base + 0x700);
922 pdc_ata_setup_port(&probe_ent->port[3], base + 0x380);
923
924 probe_ent->port[2].scr_addr = base + 0x600;
925 probe_ent->port[3].scr_addr = base + 0x700;
926 break; 921 break;
927 case board_2057x: 922 case board_2057x:
928 hp->flags |= PDC_FLAG_GEN_II; 923 hp->flags |= PDC_FLAG_GEN_II;
@@ -932,7 +927,7 @@ static int pdc_ata_init_one (struct pci_dev *pdev, const struct pci_device_id *e
932 tmp = readb(base + PDC_FLASH_CTL+1); 927 tmp = readb(base + PDC_FLASH_CTL+1);
933 if (!(tmp & 0x80)) { 928 if (!(tmp & 0x80)) {
934 probe_ent->n_ports = 3; 929 probe_ent->n_ports = 3;
935 pdc_ata_setup_port(&probe_ent->port[2], base + 0x300); 930 pdc_ata_setup_port(&probe_ent->port[2], base + 0x300, NULL);
936 hp->port_flags[2] = ATA_FLAG_SLAVE_POSS; 931 hp->port_flags[2] = ATA_FLAG_SLAVE_POSS;
937 printk(KERN_INFO DRV_NAME " PATA port found\n"); 932 printk(KERN_INFO DRV_NAME " PATA port found\n");
938 } else 933 } else
@@ -942,12 +937,8 @@ static int pdc_ata_init_one (struct pci_dev *pdev, const struct pci_device_id *e
942 break; 937 break;
943 case board_20619: 938 case board_20619:
944 probe_ent->n_ports = 4; 939 probe_ent->n_ports = 4;
945 940 pdc_ata_setup_port(&probe_ent->port[2], base + 0x300, NULL);
946 pdc_ata_setup_port(&probe_ent->port[2], base + 0x300); 941 pdc_ata_setup_port(&probe_ent->port[3], base + 0x380, NULL);
947 pdc_ata_setup_port(&probe_ent->port[3], base + 0x380);
948
949 probe_ent->port[2].scr_addr = base + 0x600;
950 probe_ent->port[3].scr_addr = base + 0x700;
951 break; 942 break;
952 default: 943 default:
953 BUG(); 944 BUG();