aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/firewire
diff options
context:
space:
mode:
authorStefan Richter <stefanr@s5r6.in-berlin.de>2011-09-19 03:29:30 -0400
committerStefan Richter <stefanr@s5r6.in-berlin.de>2011-10-09 11:00:17 -0400
commitb810e4ae111cb8b4c0ccbbe7ff4ea0a23c671e4f (patch)
treeedc61366619baf3d63ac1fcc8f82047d5f8839d4 /drivers/firewire
parent28897fb73c848eb441e54e859d0b64ad6b44d2e6 (diff)
firewire: ohci: optimize TSB41BA3D detection
Takes less source code and machine code, and less runtime with PHYs other than TSB41BA3D (e.g. TSB81BA3 with device ID 0x831304 which takes one instead of six read_paged_phy_reg now). Signed-off-by: Stefan Richter <stefanr@s5r6.in-berlin.de>
Diffstat (limited to 'drivers/firewire')
-rw-r--r--drivers/firewire/ohci.c36
1 files changed, 12 insertions, 24 deletions
diff --git a/drivers/firewire/ohci.c b/drivers/firewire/ohci.c
index 862fdf3400cf..399d5926caf7 100644
--- a/drivers/firewire/ohci.c
+++ b/drivers/firewire/ohci.c
@@ -2159,38 +2159,26 @@ static int configure_1394a_enhancements(struct fw_ohci *ohci)
2159 return 0; 2159 return 0;
2160} 2160}
2161 2161
2162#define TSB41BA3D_VID 0x00080028
2163#define TSB41BA3D_PID 0x00833005
2164
2165static int probe_tsb41ba3d(struct fw_ohci *ohci) 2162static int probe_tsb41ba3d(struct fw_ohci *ohci)
2166{ 2163{
2167 int reg, i, vendor_id, product_id; 2164 /* TI vendor ID = 0x080028, TSB41BA3D product ID = 0x833005 (sic) */
2165 static const u8 id[] = { 0x08, 0x00, 0x28, 0x83, 0x30, 0x05, };
2166 int reg, i;
2168 2167
2169 reg = read_phy_reg(ohci, 2); 2168 reg = read_phy_reg(ohci, 2);
2170 if (reg < 0) 2169 if (reg < 0)
2171 return reg; 2170 return reg;
2171 if ((reg & PHY_EXTENDED_REGISTERS) != PHY_EXTENDED_REGISTERS)
2172 return 0;
2172 2173
2173 if ((reg & PHY_EXTENDED_REGISTERS) == PHY_EXTENDED_REGISTERS) { 2174 for (i = ARRAY_SIZE(id) - 1; i >= 0; i--) {
2174 vendor_id = 0; 2175 reg = read_paged_phy_reg(ohci, 1, i + 10);
2175 for (i = 10; i < 13; i++) { 2176 if (reg < 0)
2176 reg = read_paged_phy_reg(ohci, 1, i); 2177 return reg;
2177 if (reg < 0) 2178 if (reg != id[i])
2178 return reg; 2179 return 0;
2179 vendor_id = (vendor_id << 8) | reg;
2180 }
2181 product_id = 0;
2182 for (i = 13; i < 16; i++) {
2183 reg = read_paged_phy_reg(ohci, 1, i);
2184 if (reg < 0)
2185 return reg;
2186 product_id = (product_id << 8) | reg;
2187 }
2188
2189 if ((vendor_id == TSB41BA3D_VID) &&
2190 (product_id == TSB41BA3D_PID))
2191 return 1;
2192 } 2180 }
2193 return 0; 2181 return 1;
2194} 2182}
2195 2183
2196static int ohci_enable(struct fw_card *card, 2184static int ohci_enable(struct fw_card *card,