diff options
author | Ben Hutchings <bhutchings@solarflare.com> | 2008-12-13 00:44:14 -0500 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2008-12-13 00:57:58 -0500 |
commit | 27dd2caca4eabe7c13a052b7456495ba75535e6a (patch) | |
tree | 514e7844ab78e5110e09d1e4a650e3283cdd32e9 /drivers/net/sfc | |
parent | f31a45d2f45a7667acd6e85ab6613b0910c55ea9 (diff) |
sfc: Add support for MMDs numbered >15
Combine DEVS0 and DEVS1 registers into a 32-bit mask instead of
reading just DEVS0.
Signed-off-by: Ben Hutchings <bhutchings@solarflare.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/sfc')
-rw-r--r-- | drivers/net/sfc/mdio_10g.c | 24 | ||||
-rw-r--r-- | drivers/net/sfc/mdio_10g.h | 8 | ||||
-rw-r--r-- | drivers/net/sfc/tenxpress.c | 6 | ||||
-rw-r--r-- | drivers/net/sfc/xfp_phy.c | 8 |
4 files changed, 24 insertions, 22 deletions
diff --git a/drivers/net/sfc/mdio_10g.c b/drivers/net/sfc/mdio_10g.c index 19e25210b687..1eed48407ed8 100644 --- a/drivers/net/sfc/mdio_10g.c +++ b/drivers/net/sfc/mdio_10g.c | |||
@@ -121,16 +121,18 @@ int mdio_clause45_wait_reset_mmds(struct efx_nic *efx, | |||
121 | int mdio_clause45_check_mmds(struct efx_nic *efx, | 121 | int mdio_clause45_check_mmds(struct efx_nic *efx, |
122 | unsigned int mmd_mask, unsigned int fatal_mask) | 122 | unsigned int mmd_mask, unsigned int fatal_mask) |
123 | { | 123 | { |
124 | int devices, mmd = 0; | 124 | u32 devices; |
125 | int probe_mmd; | 125 | int mmd = 0, probe_mmd; |
126 | 126 | ||
127 | /* Historically we have probed the PHYXS to find out what devices are | 127 | /* Historically we have probed the PHYXS to find out what devices are |
128 | * present,but that doesn't work so well if the PHYXS isn't expected | 128 | * present,but that doesn't work so well if the PHYXS isn't expected |
129 | * to exist, if so just find the first item in the list supplied. */ | 129 | * to exist, if so just find the first item in the list supplied. */ |
130 | probe_mmd = (mmd_mask & MDIO_MMDREG_DEVS0_PHYXS) ? MDIO_MMD_PHYXS : | 130 | probe_mmd = (mmd_mask & MDIO_MMDREG_DEVS_PHYXS) ? MDIO_MMD_PHYXS : |
131 | __ffs(mmd_mask); | 131 | __ffs(mmd_mask); |
132 | devices = mdio_clause45_read(efx, efx->mii.phy_id, | 132 | devices = (mdio_clause45_read(efx, efx->mii.phy_id, |
133 | probe_mmd, MDIO_MMDREG_DEVS0); | 133 | probe_mmd, MDIO_MMDREG_DEVS0) | |
134 | mdio_clause45_read(efx, efx->mii.phy_id, | ||
135 | probe_mmd, MDIO_MMDREG_DEVS1) << 16); | ||
134 | 136 | ||
135 | /* Check all the expected MMDs are present */ | 137 | /* Check all the expected MMDs are present */ |
136 | if (devices < 0) { | 138 | if (devices < 0) { |
@@ -175,14 +177,14 @@ bool mdio_clause45_links_ok(struct efx_nic *efx, unsigned int mmd_mask) | |||
175 | else if (efx_phy_mode_disabled(efx->phy_mode)) | 177 | else if (efx_phy_mode_disabled(efx->phy_mode)) |
176 | return false; | 178 | return false; |
177 | else if (efx->loopback_mode == LOOPBACK_PHYXS) | 179 | else if (efx->loopback_mode == LOOPBACK_PHYXS) |
178 | mmd_mask &= ~(MDIO_MMDREG_DEVS0_PHYXS | | 180 | mmd_mask &= ~(MDIO_MMDREG_DEVS_PHYXS | |
179 | MDIO_MMDREG_DEVS0_PCS | | 181 | MDIO_MMDREG_DEVS_PCS | |
180 | MDIO_MMDREG_DEVS0_PMAPMD); | 182 | MDIO_MMDREG_DEVS_PMAPMD); |
181 | else if (efx->loopback_mode == LOOPBACK_PCS) | 183 | else if (efx->loopback_mode == LOOPBACK_PCS) |
182 | mmd_mask &= ~(MDIO_MMDREG_DEVS0_PCS | | 184 | mmd_mask &= ~(MDIO_MMDREG_DEVS_PCS | |
183 | MDIO_MMDREG_DEVS0_PMAPMD); | 185 | MDIO_MMDREG_DEVS_PMAPMD); |
184 | else if (efx->loopback_mode == LOOPBACK_PMAPMD) | 186 | else if (efx->loopback_mode == LOOPBACK_PMAPMD) |
185 | mmd_mask &= ~MDIO_MMDREG_DEVS0_PMAPMD; | 187 | mmd_mask &= ~MDIO_MMDREG_DEVS_PMAPMD; |
186 | 188 | ||
187 | while (mmd_mask) { | 189 | while (mmd_mask) { |
188 | if (mmd_mask & 1) { | 190 | if (mmd_mask & 1) { |
diff --git a/drivers/net/sfc/mdio_10g.h b/drivers/net/sfc/mdio_10g.h index db9f358349c6..45163838130e 100644 --- a/drivers/net/sfc/mdio_10g.h +++ b/drivers/net/sfc/mdio_10g.h | |||
@@ -73,14 +73,14 @@ | |||
73 | #define MDIO_ID_MODEL(_id32) ((_id32 >> 4) & 0x3f) | 73 | #define MDIO_ID_MODEL(_id32) ((_id32 >> 4) & 0x3f) |
74 | #define MDIO_ID_OUI(_id32) (_id32 >> 10) | 74 | #define MDIO_ID_OUI(_id32) (_id32 >> 10) |
75 | 75 | ||
76 | /* Bits in MMDREG_DEVS0. Someone thoughtfully layed things out | 76 | /* Bits in MMDREG_DEVS0/1. Someone thoughtfully layed things out |
77 | * so the 'bit present' bit number of an MMD is the number of | 77 | * so the 'bit present' bit number of an MMD is the number of |
78 | * that MMD */ | 78 | * that MMD */ |
79 | #define DEV_PRESENT_BIT(_b) (1 << _b) | 79 | #define DEV_PRESENT_BIT(_b) (1 << _b) |
80 | 80 | ||
81 | #define MDIO_MMDREG_DEVS0_PHYXS DEV_PRESENT_BIT(MDIO_MMD_PHYXS) | 81 | #define MDIO_MMDREG_DEVS_PHYXS DEV_PRESENT_BIT(MDIO_MMD_PHYXS) |
82 | #define MDIO_MMDREG_DEVS0_PCS DEV_PRESENT_BIT(MDIO_MMD_PCS) | 82 | #define MDIO_MMDREG_DEVS_PCS DEV_PRESENT_BIT(MDIO_MMD_PCS) |
83 | #define MDIO_MMDREG_DEVS0_PMAPMD DEV_PRESENT_BIT(MDIO_MMD_PMAPMD) | 83 | #define MDIO_MMDREG_DEVS_PMAPMD DEV_PRESENT_BIT(MDIO_MMD_PMAPMD) |
84 | 84 | ||
85 | /* Bits in MMDREG_STAT2 */ | 85 | /* Bits in MMDREG_STAT2 */ |
86 | #define MDIO_MMDREG_STAT2_PRESENT_VAL (2) | 86 | #define MDIO_MMDREG_STAT2_PRESENT_VAL (2) |
diff --git a/drivers/net/sfc/tenxpress.c b/drivers/net/sfc/tenxpress.c index 3fa7ccb08d50..197b5449ab18 100644 --- a/drivers/net/sfc/tenxpress.c +++ b/drivers/net/sfc/tenxpress.c | |||
@@ -19,9 +19,9 @@ | |||
19 | 19 | ||
20 | /* We expect these MMDs to be in the package */ | 20 | /* We expect these MMDs to be in the package */ |
21 | /* AN not here as mdio_check_mmds() requires STAT2 support */ | 21 | /* AN not here as mdio_check_mmds() requires STAT2 support */ |
22 | #define TENXPRESS_REQUIRED_DEVS (MDIO_MMDREG_DEVS0_PMAPMD | \ | 22 | #define TENXPRESS_REQUIRED_DEVS (MDIO_MMDREG_DEVS_PMAPMD | \ |
23 | MDIO_MMDREG_DEVS0_PCS | \ | 23 | MDIO_MMDREG_DEVS_PCS | \ |
24 | MDIO_MMDREG_DEVS0_PHYXS) | 24 | MDIO_MMDREG_DEVS_PHYXS) |
25 | 25 | ||
26 | #define TENXPRESS_LOOPBACKS ((1 << LOOPBACK_PHYXS) | \ | 26 | #define TENXPRESS_LOOPBACKS ((1 << LOOPBACK_PHYXS) | \ |
27 | (1 << LOOPBACK_PCS) | \ | 27 | (1 << LOOPBACK_PCS) | \ |
diff --git a/drivers/net/sfc/xfp_phy.c b/drivers/net/sfc/xfp_phy.c index 971a24b59fa7..0413d135e4aa 100644 --- a/drivers/net/sfc/xfp_phy.c +++ b/drivers/net/sfc/xfp_phy.c | |||
@@ -19,9 +19,9 @@ | |||
19 | #include "phy.h" | 19 | #include "phy.h" |
20 | #include "mac.h" | 20 | #include "mac.h" |
21 | 21 | ||
22 | #define XFP_REQUIRED_DEVS (MDIO_MMDREG_DEVS0_PCS | \ | 22 | #define XFP_REQUIRED_DEVS (MDIO_MMDREG_DEVS_PCS | \ |
23 | MDIO_MMDREG_DEVS0_PMAPMD | \ | 23 | MDIO_MMDREG_DEVS_PMAPMD | \ |
24 | MDIO_MMDREG_DEVS0_PHYXS) | 24 | MDIO_MMDREG_DEVS_PHYXS) |
25 | 25 | ||
26 | #define XFP_LOOPBACKS ((1 << LOOPBACK_PCS) | \ | 26 | #define XFP_LOOPBACKS ((1 << LOOPBACK_PCS) | \ |
27 | (1 << LOOPBACK_PMAPMD) | \ | 27 | (1 << LOOPBACK_PMAPMD) | \ |
@@ -64,7 +64,7 @@ static int xfp_reset_phy(struct efx_nic *efx) | |||
64 | /* Check that all the MMDs we expect are present and responding. We | 64 | /* Check that all the MMDs we expect are present and responding. We |
65 | * expect faults on some if the link is down, but not on the PHY XS */ | 65 | * expect faults on some if the link is down, but not on the PHY XS */ |
66 | rc = mdio_clause45_check_mmds(efx, XFP_REQUIRED_DEVS, | 66 | rc = mdio_clause45_check_mmds(efx, XFP_REQUIRED_DEVS, |
67 | MDIO_MMDREG_DEVS0_PHYXS); | 67 | MDIO_MMDREG_DEVS_PHYXS); |
68 | if (rc < 0) | 68 | if (rc < 0) |
69 | goto fail; | 69 | goto fail; |
70 | 70 | ||