aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/ata/sata_mv.c
diff options
context:
space:
mode:
authorAuke Kok <auke-jan.h.kok@intel.com>2007-06-08 18:46:36 -0400
committerGreg Kroah-Hartman <gregkh@suse.de>2007-07-11 19:02:10 -0400
commit44c10138fd4bbc4b6d6bff0873c24902f2a9da65 (patch)
tree6e16d3ec80c87490dc743f72da086356f2906ace /drivers/ata/sata_mv.c
parentb8a3a5214d7cc115f1ca3a3967b7229d97c46f4a (diff)
PCI: Change all drivers to use pci_device->revision
Instead of all drivers reading pci config space to get the revision ID, they can now use the pci_device->revision member. This exposes some issues where drivers where reading a word or a dword for the revision number, and adding useless error-handling around the read. Some drivers even just read it for no purpose of all. In devices where the revision ID is being copied over and used in what appears to be the equivalent of hotpath, I have left the copy code and the cached copy as not to influence the driver's performance. Compile tested with make all{yes,mod}config on x86_64 and i386. Signed-off-by: Auke Kok <auke-jan.h.kok@intel.com> Acked-by: Dave Jones <davej@redhat.com> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'drivers/ata/sata_mv.c')
-rw-r--r--drivers/ata/sata_mv.c20
1 files changed, 6 insertions, 14 deletions
diff --git a/drivers/ata/sata_mv.c b/drivers/ata/sata_mv.c
index 3873b29c80d6..6dcfc628aab1 100644
--- a/drivers/ata/sata_mv.c
+++ b/drivers/ata/sata_mv.c
@@ -1573,12 +1573,9 @@ static void mv5_scr_write(struct ata_port *ap, unsigned int sc_reg_in, u32 val)
1573 1573
1574static void mv5_reset_bus(struct pci_dev *pdev, void __iomem *mmio) 1574static void mv5_reset_bus(struct pci_dev *pdev, void __iomem *mmio)
1575{ 1575{
1576 u8 rev_id;
1577 int early_5080; 1576 int early_5080;
1578 1577
1579 pci_read_config_byte(pdev, PCI_REVISION_ID, &rev_id); 1578 early_5080 = (pdev->device == 0x5080) && (pdev->revision == 0);
1580
1581 early_5080 = (pdev->device == 0x5080) && (rev_id == 0);
1582 1579
1583 if (!early_5080) { 1580 if (!early_5080) {
1584 u32 tmp = readl(mmio + MV_PCI_EXP_ROM_BAR_CTL); 1581 u32 tmp = readl(mmio + MV_PCI_EXP_ROM_BAR_CTL);
@@ -2139,17 +2136,14 @@ static int mv_chip_id(struct ata_host *host, unsigned int board_idx)
2139{ 2136{
2140 struct pci_dev *pdev = to_pci_dev(host->dev); 2137 struct pci_dev *pdev = to_pci_dev(host->dev);
2141 struct mv_host_priv *hpriv = host->private_data; 2138 struct mv_host_priv *hpriv = host->private_data;
2142 u8 rev_id;
2143 u32 hp_flags = hpriv->hp_flags; 2139 u32 hp_flags = hpriv->hp_flags;
2144 2140
2145 pci_read_config_byte(pdev, PCI_REVISION_ID, &rev_id);
2146
2147 switch(board_idx) { 2141 switch(board_idx) {
2148 case chip_5080: 2142 case chip_5080:
2149 hpriv->ops = &mv5xxx_ops; 2143 hpriv->ops = &mv5xxx_ops;
2150 hp_flags |= MV_HP_50XX; 2144 hp_flags |= MV_HP_50XX;
2151 2145
2152 switch (rev_id) { 2146 switch (pdev->revision) {
2153 case 0x1: 2147 case 0x1:
2154 hp_flags |= MV_HP_ERRATA_50XXB0; 2148 hp_flags |= MV_HP_ERRATA_50XXB0;
2155 break; 2149 break;
@@ -2169,7 +2163,7 @@ static int mv_chip_id(struct ata_host *host, unsigned int board_idx)
2169 hpriv->ops = &mv5xxx_ops; 2163 hpriv->ops = &mv5xxx_ops;
2170 hp_flags |= MV_HP_50XX; 2164 hp_flags |= MV_HP_50XX;
2171 2165
2172 switch (rev_id) { 2166 switch (pdev->revision) {
2173 case 0x0: 2167 case 0x0:
2174 hp_flags |= MV_HP_ERRATA_50XXB0; 2168 hp_flags |= MV_HP_ERRATA_50XXB0;
2175 break; 2169 break;
@@ -2188,7 +2182,7 @@ static int mv_chip_id(struct ata_host *host, unsigned int board_idx)
2188 case chip_608x: 2182 case chip_608x:
2189 hpriv->ops = &mv6xxx_ops; 2183 hpriv->ops = &mv6xxx_ops;
2190 2184
2191 switch (rev_id) { 2185 switch (pdev->revision) {
2192 case 0x7: 2186 case 0x7:
2193 hp_flags |= MV_HP_ERRATA_60X1B2; 2187 hp_flags |= MV_HP_ERRATA_60X1B2;
2194 break; 2188 break;
@@ -2209,7 +2203,7 @@ static int mv_chip_id(struct ata_host *host, unsigned int board_idx)
2209 2203
2210 hp_flags |= MV_HP_GEN_IIE; 2204 hp_flags |= MV_HP_GEN_IIE;
2211 2205
2212 switch (rev_id) { 2206 switch (pdev->revision) {
2213 case 0x0: 2207 case 0x0:
2214 hp_flags |= MV_HP_ERRATA_XX42A0; 2208 hp_flags |= MV_HP_ERRATA_XX42A0;
2215 break; 2209 break;
@@ -2337,14 +2331,12 @@ static void mv_print_info(struct ata_host *host)
2337{ 2331{
2338 struct pci_dev *pdev = to_pci_dev(host->dev); 2332 struct pci_dev *pdev = to_pci_dev(host->dev);
2339 struct mv_host_priv *hpriv = host->private_data; 2333 struct mv_host_priv *hpriv = host->private_data;
2340 u8 rev_id, scc; 2334 u8 scc;
2341 const char *scc_s, *gen; 2335 const char *scc_s, *gen;
2342 2336
2343 /* Use this to determine the HW stepping of the chip so we know 2337 /* Use this to determine the HW stepping of the chip so we know
2344 * what errata to workaround 2338 * what errata to workaround
2345 */ 2339 */
2346 pci_read_config_byte(pdev, PCI_REVISION_ID, &rev_id);
2347
2348 pci_read_config_byte(pdev, PCI_CLASS_DEVICE, &scc); 2340 pci_read_config_byte(pdev, PCI_CLASS_DEVICE, &scc);
2349 if (scc == 0) 2341 if (scc == 0)
2350 scc_s = "SCSI"; 2342 scc_s = "SCSI";