diff options
author | Mikael Pettersson <mikpe@it.uu.se> | 2007-06-19 15:53:30 -0400 |
---|---|---|
committer | Jeff Garzik <jeff@garzik.org> | 2007-07-09 12:17:34 -0400 |
commit | d0e580316e3db9f5cf6a605cc311ffb0372f0a35 (patch) | |
tree | 289e25f055b822b49e3f0bbfdacbfea763d11d17 /drivers/ata/sata_promise.c | |
parent | 5446b656ddebc2f3902242fda4e860fb343d2787 (diff) |
sata_promise: cleanups
This patch applies some trivial cleanups to sata_promise:
- repair whitespace damage
- correct comment at board_2057x_pata definition
- pull SATAII TX4 support code out to separate functions
- rename ata_nr to ata_no for consistency with libata's port_no
- remove some init-time debug printks (requested by Jeff)
This patch should cause no behavioural changes, except for
the removed printks.
Signed-off-by: Mikael Pettersson <mikpe@it.uu.se>
--
drivers/ata/sata_promise.c | 56 ++++++++++++++++++---------------------------
1 files changed, 23 insertions(+), 33 deletions(-)
Signed-off-by: Jeff Garzik <jeff@garzik.org>
Diffstat (limited to 'drivers/ata/sata_promise.c')
-rw-r--r-- | drivers/ata/sata_promise.c | 56 |
1 files changed, 23 insertions, 33 deletions
diff --git a/drivers/ata/sata_promise.c b/drivers/ata/sata_promise.c index 7fcc4fe4d79b..78bdfd00b218 100644 --- a/drivers/ata/sata_promise.c +++ b/drivers/ata/sata_promise.c | |||
@@ -45,8 +45,7 @@ | |||
45 | #include "sata_promise.h" | 45 | #include "sata_promise.h" |
46 | 46 | ||
47 | #define DRV_NAME "sata_promise" | 47 | #define DRV_NAME "sata_promise" |
48 | #define DRV_VERSION "2.07" | 48 | #define DRV_VERSION "2.08" |
49 | |||
50 | 49 | ||
51 | enum { | 50 | enum { |
52 | PDC_MAX_PORTS = 4, | 51 | PDC_MAX_PORTS = 4, |
@@ -94,7 +93,7 @@ enum { | |||
94 | board_20319 = 2, /* FastTrak S150 TX4 */ | 93 | board_20319 = 2, /* FastTrak S150 TX4 */ |
95 | board_20619 = 3, /* FastTrak TX4000 */ | 94 | board_20619 = 3, /* FastTrak TX4000 */ |
96 | board_2057x = 4, /* SATAII150 Tx2plus */ | 95 | board_2057x = 4, /* SATAII150 Tx2plus */ |
97 | board_2057x_pata = 5, /* SATAII150 Tx2plus */ | 96 | board_2057x_pata = 5, /* SATAII150 Tx2plus PATA port */ |
98 | board_40518 = 6, /* SATAII150 Tx4 */ | 97 | board_40518 = 6, /* SATAII150 Tx4 */ |
99 | 98 | ||
100 | PDC_HAS_PATA = (1 << 1), /* PDC20375/20575 has PATA */ | 99 | PDC_HAS_PATA = (1 << 1), /* PDC20375/20575 has PATA */ |
@@ -124,7 +123,6 @@ enum { | |||
124 | PDC_FLAG_4_PORTS = (1 << 26), /* 4 ports */ | 123 | PDC_FLAG_4_PORTS = (1 << 26), /* 4 ports */ |
125 | }; | 124 | }; |
126 | 125 | ||
127 | |||
128 | struct pdc_port_priv { | 126 | struct pdc_port_priv { |
129 | u8 *pkt; | 127 | u8 *pkt; |
130 | dma_addr_t pkt_dma; | 128 | dma_addr_t pkt_dma; |
@@ -340,7 +338,6 @@ static const struct pci_device_id pdc_ata_pci_tbl[] = { | |||
340 | { } /* terminate list */ | 338 | { } /* terminate list */ |
341 | }; | 339 | }; |
342 | 340 | ||
343 | |||
344 | static struct pci_driver pdc_ata_pci_driver = { | 341 | static struct pci_driver pdc_ata_pci_driver = { |
345 | .name = DRV_NAME, | 342 | .name = DRV_NAME, |
346 | .id_table = pdc_ata_pci_tbl, | 343 | .id_table = pdc_ata_pci_tbl, |
@@ -348,7 +345,6 @@ static struct pci_driver pdc_ata_pci_driver = { | |||
348 | .remove = ata_pci_remove_one, | 345 | .remove = ata_pci_remove_one, |
349 | }; | 346 | }; |
350 | 347 | ||
351 | |||
352 | static int pdc_common_port_start(struct ata_port *ap) | 348 | static int pdc_common_port_start(struct ata_port *ap) |
353 | { | 349 | { |
354 | struct device *dev = ap->host->dev; | 350 | struct device *dev = ap->host->dev; |
@@ -438,7 +434,6 @@ static u32 pdc_sata_scr_read (struct ata_port *ap, unsigned int sc_reg) | |||
438 | return readl(ap->ioaddr.scr_addr + (sc_reg * 4)); | 434 | return readl(ap->ioaddr.scr_addr + (sc_reg * 4)); |
439 | } | 435 | } |
440 | 436 | ||
441 | |||
442 | static void pdc_sata_scr_write (struct ata_port *ap, unsigned int sc_reg, | 437 | static void pdc_sata_scr_write (struct ata_port *ap, unsigned int sc_reg, |
443 | u32 val) | 438 | u32 val) |
444 | { | 439 | { |
@@ -657,8 +652,8 @@ static void pdc_error_intr(struct ata_port *ap, struct ata_queued_cmd *qc, | |||
657 | ata_port_abort(ap); | 652 | ata_port_abort(ap); |
658 | } | 653 | } |
659 | 654 | ||
660 | static inline unsigned int pdc_host_intr( struct ata_port *ap, | 655 | static inline unsigned int pdc_host_intr(struct ata_port *ap, |
661 | struct ata_queued_cmd *qc) | 656 | struct ata_queued_cmd *qc) |
662 | { | 657 | { |
663 | unsigned int handled = 0; | 658 | unsigned int handled = 0; |
664 | void __iomem *port_mmio = ap->ioaddr.cmd_addr; | 659 | void __iomem *port_mmio = ap->ioaddr.cmd_addr; |
@@ -685,10 +680,10 @@ static inline unsigned int pdc_host_intr( struct ata_port *ap, | |||
685 | handled = 1; | 680 | handled = 1; |
686 | break; | 681 | break; |
687 | 682 | ||
688 | default: | 683 | default: |
689 | ap->stats.idle_irq++; | 684 | ap->stats.idle_irq++; |
690 | break; | 685 | break; |
691 | } | 686 | } |
692 | 687 | ||
693 | return handled; | 688 | return handled; |
694 | } | 689 | } |
@@ -701,6 +696,18 @@ static void pdc_irq_clear(struct ata_port *ap) | |||
701 | readl(mmio + PDC_INT_SEQMASK); | 696 | readl(mmio + PDC_INT_SEQMASK); |
702 | } | 697 | } |
703 | 698 | ||
699 | static inline int pdc_is_sataii_tx4(unsigned long flags) | ||
700 | { | ||
701 | const unsigned long mask = PDC_FLAG_GEN_II | PDC_FLAG_4_PORTS; | ||
702 | return (flags & mask) == mask; | ||
703 | } | ||
704 | |||
705 | static inline unsigned int pdc_port_no_to_ata_no(unsigned int port_no, int is_sataii_tx4) | ||
706 | { | ||
707 | static const unsigned char sataii_tx4_port_remap[4] = { 3, 1, 0, 2}; | ||
708 | return is_sataii_tx4 ? sataii_tx4_port_remap[port_no] : port_no; | ||
709 | } | ||
710 | |||
704 | static irqreturn_t pdc_interrupt (int irq, void *dev_instance) | 711 | static irqreturn_t pdc_interrupt (int irq, void *dev_instance) |
705 | { | 712 | { |
706 | struct ata_host *host = dev_instance; | 713 | struct ata_host *host = dev_instance; |
@@ -807,7 +814,6 @@ static void pdc_tf_load_mmio(struct ata_port *ap, const struct ata_taskfile *tf) | |||
807 | ata_tf_load(ap, tf); | 814 | ata_tf_load(ap, tf); |
808 | } | 815 | } |
809 | 816 | ||
810 | |||
811 | static void pdc_exec_command_mmio(struct ata_port *ap, const struct ata_taskfile *tf) | 817 | static void pdc_exec_command_mmio(struct ata_port *ap, const struct ata_taskfile *tf) |
812 | { | 818 | { |
813 | WARN_ON (tf->protocol == ATA_PROT_DMA || | 819 | WARN_ON (tf->protocol == ATA_PROT_DMA || |
@@ -867,7 +873,6 @@ static void pdc_ata_setup_port(struct ata_port *ap, | |||
867 | ap->ioaddr.scr_addr = scr_addr; | 873 | ap->ioaddr.scr_addr = scr_addr; |
868 | } | 874 | } |
869 | 875 | ||
870 | |||
871 | static void pdc_host_init(struct ata_host *host) | 876 | static void pdc_host_init(struct ata_host *host) |
872 | { | 877 | { |
873 | void __iomem *mmio = host->iomap[PDC_MMIO_BAR]; | 878 | void __iomem *mmio = host->iomap[PDC_MMIO_BAR]; |
@@ -955,10 +960,8 @@ static int pdc_ata_init_one (struct pci_dev *pdev, const struct pci_device_id *e | |||
955 | 960 | ||
956 | if (pi->flags & PDC_FLAG_SATA_PATA) { | 961 | if (pi->flags & PDC_FLAG_SATA_PATA) { |
957 | u8 tmp = readb(base + PDC_FLASH_CTL+1); | 962 | u8 tmp = readb(base + PDC_FLASH_CTL+1); |
958 | if (!(tmp & 0x80)) { | 963 | if (!(tmp & 0x80)) |
959 | ppi[n_ports++] = pi + 1; | 964 | ppi[n_ports++] = pi + 1; |
960 | dev_printk(KERN_INFO, &pdev->dev, "PATA port found\n"); | ||
961 | } | ||
962 | } | 965 | } |
963 | 966 | ||
964 | host = ata_host_alloc_pinfo(&pdev->dev, ppi, n_ports); | 967 | host = ata_host_alloc_pinfo(&pdev->dev, ppi, n_ports); |
@@ -968,22 +971,12 @@ static int pdc_ata_init_one (struct pci_dev *pdev, const struct pci_device_id *e | |||
968 | } | 971 | } |
969 | host->iomap = pcim_iomap_table(pdev); | 972 | host->iomap = pcim_iomap_table(pdev); |
970 | 973 | ||
971 | is_sataii_tx4 = 0; | 974 | is_sataii_tx4 = pdc_is_sataii_tx4(pi->flags); |
972 | if ((pi->flags & (PDC_FLAG_GEN_II|PDC_FLAG_4_PORTS)) == (PDC_FLAG_GEN_II|PDC_FLAG_4_PORTS)) { | ||
973 | is_sataii_tx4 = 1; | ||
974 | dev_printk(KERN_INFO, &pdev->dev, "applying SATAII TX4 port numbering workaround\n"); | ||
975 | } | ||
976 | for (i = 0; i < host->n_ports; i++) { | 975 | for (i = 0; i < host->n_ports; i++) { |
977 | static const unsigned char sataii_tx4_port_remap[4] = { 3, 1, 0, 2}; | 976 | unsigned int ata_no = pdc_port_no_to_ata_no(i, is_sataii_tx4); |
978 | int ata_nr; | ||
979 | |||
980 | ata_nr = i; | ||
981 | if (is_sataii_tx4) | ||
982 | ata_nr = sataii_tx4_port_remap[i]; | ||
983 | |||
984 | pdc_ata_setup_port(host->ports[i], | 977 | pdc_ata_setup_port(host->ports[i], |
985 | base + 0x200 + ata_nr * 0x80, | 978 | base + 0x200 + ata_no * 0x80, |
986 | base + 0x400 + ata_nr * 0x100); | 979 | base + 0x400 + ata_no * 0x100); |
987 | } | 980 | } |
988 | 981 | ||
989 | /* initialize adapter */ | 982 | /* initialize adapter */ |
@@ -1002,19 +995,16 @@ static int pdc_ata_init_one (struct pci_dev *pdev, const struct pci_device_id *e | |||
1002 | &pdc_ata_sht); | 995 | &pdc_ata_sht); |
1003 | } | 996 | } |
1004 | 997 | ||
1005 | |||
1006 | static int __init pdc_ata_init(void) | 998 | static int __init pdc_ata_init(void) |
1007 | { | 999 | { |
1008 | return pci_register_driver(&pdc_ata_pci_driver); | 1000 | return pci_register_driver(&pdc_ata_pci_driver); |
1009 | } | 1001 | } |
1010 | 1002 | ||
1011 | |||
1012 | static void __exit pdc_ata_exit(void) | 1003 | static void __exit pdc_ata_exit(void) |
1013 | { | 1004 | { |
1014 | pci_unregister_driver(&pdc_ata_pci_driver); | 1005 | pci_unregister_driver(&pdc_ata_pci_driver); |
1015 | } | 1006 | } |
1016 | 1007 | ||
1017 | |||
1018 | MODULE_AUTHOR("Jeff Garzik"); | 1008 | MODULE_AUTHOR("Jeff Garzik"); |
1019 | MODULE_DESCRIPTION("Promise ATA TX2/TX4/TX4000 low-level driver"); | 1009 | MODULE_DESCRIPTION("Promise ATA TX2/TX4/TX4000 low-level driver"); |
1020 | MODULE_LICENSE("GPL"); | 1010 | MODULE_LICENSE("GPL"); |