aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMikael Pettersson <mikpe@it.uu.se>2006-12-06 03:55:43 -0500
committerJeff Garzik <jeff@garzik.org>2006-12-07 07:21:24 -0500
commitd324d4627d7442d9a74b0b93fc40f71ce194632a (patch)
tree395fb3bc578bafc3797c3d217477f758aff932e6
parent620034c84d1d939717bdfbe02c51a3fee43541c3 (diff)
[PATCH] sata_promise: cleanups, take 2
This patch performs two simple cleanups of sata_promise. * Remove board_20771 and map device id 0x3577 to board_2057x. After the recent corrections for SATAII chips, board_20771 and board_2057x were equivalent in the driver. * Remove hp->hotplug_offset and use hp->flags & PDC_FLAG_GEN_II to compute hotplug_offset in pdc_host_init(). hp->hotplug_offset was used to distinguish 1st and 2nd generation chips in one particular case, but now we have that information in a more general form in hp->flags, so hp->hotplug_offset is redundant. Changes since previous submission: rebased on libata-dev #upstream, cleaned up hotplug_offset computation based on Tejun's comments, expanded hotplug_offset removal rationale. This patch does not depend on the pending new EH conversion patch. Signed-off-by: Mikael Pettersson <mikpe@it.uu.se> Signed-off-by: Jeff Garzik <jeff@garzik.org>
-rw-r--r--drivers/ata/sata_promise.c40
1 files changed, 9 insertions, 31 deletions
diff --git a/drivers/ata/sata_promise.c b/drivers/ata/sata_promise.c
index a2778cf016bc..6f7bc5b0ef4a 100644
--- a/drivers/ata/sata_promise.c
+++ b/drivers/ata/sata_promise.c
@@ -66,9 +66,8 @@ enum {
66 board_2037x = 0, /* FastTrak S150 TX2plus */ 66 board_2037x = 0, /* FastTrak S150 TX2plus */
67 board_20319 = 1, /* FastTrak S150 TX4 */ 67 board_20319 = 1, /* FastTrak S150 TX4 */
68 board_20619 = 2, /* FastTrak TX4000 */ 68 board_20619 = 2, /* FastTrak TX4000 */
69 board_20771 = 3, /* FastTrak TX2300 */ 69 board_2057x = 3, /* SATAII150 Tx2plus */
70 board_2057x = 4, /* SATAII150 Tx2plus */ 70 board_40518 = 4, /* SATAII150 Tx4 */
71 board_40518 = 5, /* SATAII150 Tx4 */
72 71
73 PDC_HAS_PATA = (1 << 1), /* PDC20375/20575 has PATA */ 72 PDC_HAS_PATA = (1 << 1), /* PDC20375/20575 has PATA */
74 73
@@ -90,7 +89,6 @@ struct pdc_port_priv {
90 89
91struct pdc_host_priv { 90struct pdc_host_priv {
92 unsigned long flags; 91 unsigned long flags;
93 int hotplug_offset;
94}; 92};
95 93
96static u32 pdc_sata_scr_read (struct ata_port *ap, unsigned int sc_reg); 94static u32 pdc_sata_scr_read (struct ata_port *ap, unsigned int sc_reg);
@@ -205,16 +203,6 @@ static const struct ata_port_info pdc_port_info[] = {
205 .port_ops = &pdc_pata_ops, 203 .port_ops = &pdc_pata_ops,
206 }, 204 },
207 205
208 /* board_20771 */
209 {
210 .sht = &pdc_ata_sht,
211 .flags = PDC_COMMON_FLAGS | ATA_FLAG_SATA,
212 .pio_mask = 0x1f, /* pio0-4 */
213 .mwdma_mask = 0x07, /* mwdma0-2 */
214 .udma_mask = 0x7f, /* udma0-6 ; FIXME */
215 .port_ops = &pdc_sata_ops,
216 },
217
218 /* board_2057x */ 206 /* board_2057x */
219 { 207 {
220 .sht = &pdc_ata_sht, 208 .sht = &pdc_ata_sht,
@@ -244,6 +232,7 @@ static const struct pci_device_id pdc_ata_pci_tbl[] = {
244 { PCI_VDEVICE(PROMISE, 0x3570), board_2057x }, 232 { PCI_VDEVICE(PROMISE, 0x3570), board_2057x },
245 { PCI_VDEVICE(PROMISE, 0x3571), board_2057x }, 233 { PCI_VDEVICE(PROMISE, 0x3571), board_2057x },
246 { PCI_VDEVICE(PROMISE, 0x3574), board_2057x }, 234 { PCI_VDEVICE(PROMISE, 0x3574), board_2057x },
235 { PCI_VDEVICE(PROMISE, 0x3577), board_2057x },
247 { PCI_VDEVICE(PROMISE, 0x3d73), board_2057x }, 236 { PCI_VDEVICE(PROMISE, 0x3d73), board_2057x },
248 { PCI_VDEVICE(PROMISE, 0x3d75), board_2057x }, 237 { PCI_VDEVICE(PROMISE, 0x3d75), board_2057x },
249 238
@@ -256,15 +245,6 @@ static const struct pci_device_id pdc_ata_pci_tbl[] = {
256 245
257 { PCI_VDEVICE(PROMISE, 0x6629), board_20619 }, 246 { PCI_VDEVICE(PROMISE, 0x6629), board_20619 },
258 247
259/* TODO: remove all associated board_20771 code, as it completely
260 * duplicates board_2037x code, unless reason for separation can be
261 * divined.
262 */
263#if 0
264 { PCI_VDEVICE(PROMISE, 0x3570), board_20771 },
265#endif
266 { PCI_VDEVICE(PROMISE, 0x3577), board_20771 },
267
268 { } /* terminate list */ 248 { } /* terminate list */
269}; 249};
270 250
@@ -645,9 +625,14 @@ static void pdc_host_init(unsigned int chip_id, struct ata_probe_ent *pe)
645{ 625{
646 void __iomem *mmio = pe->mmio_base; 626 void __iomem *mmio = pe->mmio_base;
647 struct pdc_host_priv *hp = pe->private_data; 627 struct pdc_host_priv *hp = pe->private_data;
648 int hotplug_offset = hp->hotplug_offset; 628 int hotplug_offset;
649 u32 tmp; 629 u32 tmp;
650 630
631 if (hp->flags & PDC_FLAG_GEN_II)
632 hotplug_offset = PDC2_SATA_PLUG_CSR;
633 else
634 hotplug_offset = PDC_SATA_PLUG_CSR;
635
651 /* 636 /*
652 * Except for the hotplug stuff, this is voodoo from the 637 * Except for the hotplug stuff, this is voodoo from the
653 * Promise driver. Label this entire section 638 * Promise driver. Label this entire section
@@ -742,8 +727,6 @@ static int pdc_ata_init_one (struct pci_dev *pdev, const struct pci_device_id *e
742 goto err_out_free_ent; 727 goto err_out_free_ent;
743 } 728 }
744 729
745 /* Set default hotplug offset */
746 hp->hotplug_offset = PDC_SATA_PLUG_CSR;
747 probe_ent->private_data = hp; 730 probe_ent->private_data = hp;
748 731
749 probe_ent->sht = pdc_port_info[board_idx].sht; 732 probe_ent->sht = pdc_port_info[board_idx].sht;
@@ -767,8 +750,6 @@ static int pdc_ata_init_one (struct pci_dev *pdev, const struct pci_device_id *e
767 switch (board_idx) { 750 switch (board_idx) {
768 case board_40518: 751 case board_40518:
769 hp->flags |= PDC_FLAG_GEN_II; 752 hp->flags |= PDC_FLAG_GEN_II;
770 /* Override hotplug offset for SATAII150 */
771 hp->hotplug_offset = PDC2_SATA_PLUG_CSR;
772 /* Fall through */ 753 /* Fall through */
773 case board_20319: 754 case board_20319:
774 probe_ent->n_ports = 4; 755 probe_ent->n_ports = 4;
@@ -780,10 +761,7 @@ static int pdc_ata_init_one (struct pci_dev *pdev, const struct pci_device_id *e
780 probe_ent->port[3].scr_addr = base + 0x700; 761 probe_ent->port[3].scr_addr = base + 0x700;
781 break; 762 break;
782 case board_2057x: 763 case board_2057x:
783 case board_20771:
784 hp->flags |= PDC_FLAG_GEN_II; 764 hp->flags |= PDC_FLAG_GEN_II;
785 /* Override hotplug offset for SATAII150 */
786 hp->hotplug_offset = PDC2_SATA_PLUG_CSR;
787 /* Fall through */ 765 /* Fall through */
788 case board_2037x: 766 case board_2037x:
789 probe_ent->n_ports = 2; 767 probe_ent->n_ports = 2;