aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorBen Hutchings <bhutchings@solarflare.com>2009-02-27 08:07:15 -0500
committerDavid S. Miller <davem@davemloft.net>2009-03-02 06:15:04 -0500
commit3f39a5e9bff000025c2679101b4f83e4fc21dbba (patch)
treeb5a9632720383e3309e170da6c38f6468dbfd5ee /drivers
parentf794fd440066ccd7d601f405f80aa514b95f15d1 (diff)
sfc: Fix reporting of PHY id
Shuffle bits of the OUI into the conventional written order. Replace PHY id component macros with functions. Zero-pad PHY id components in log messages. Signed-off-by: Ben Hutchings <bhutchings@solarflare.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/net/sfc/mdio_10g.c15
-rw-r--r--drivers/net/sfc/mdio_10g.h8
-rw-r--r--drivers/net/sfc/xfp_phy.c6
3 files changed, 22 insertions, 7 deletions
diff --git a/drivers/net/sfc/mdio_10g.c b/drivers/net/sfc/mdio_10g.c
index 4462fb58a3a9..9f5ec3eb3418 100644
--- a/drivers/net/sfc/mdio_10g.c
+++ b/drivers/net/sfc/mdio_10g.c
@@ -17,6 +17,21 @@
17#include "boards.h" 17#include "boards.h"
18#include "workarounds.h" 18#include "workarounds.h"
19 19
20unsigned mdio_id_oui(u32 id)
21{
22 unsigned oui = 0;
23 int i;
24
25 /* The bits of the OUI are designated a..x, with a=0 and b variable.
26 * In the id register c is the MSB but the OUI is conventionally
27 * written as bytes h..a, p..i, x..q. Reorder the bits accordingly. */
28 for (i = 0; i < 22; ++i)
29 if (id & (1 << (i + 10)))
30 oui |= 1 << (i ^ 7);
31
32 return oui;
33}
34
20int mdio_clause45_reset_mmd(struct efx_nic *port, int mmd, 35int mdio_clause45_reset_mmd(struct efx_nic *port, int mmd,
21 int spins, int spintime) 36 int spins, int spintime)
22{ 37{
diff --git a/drivers/net/sfc/mdio_10g.h b/drivers/net/sfc/mdio_10g.h
index 8ba49773ce7e..7014d2279c20 100644
--- a/drivers/net/sfc/mdio_10g.h
+++ b/drivers/net/sfc/mdio_10g.h
@@ -70,10 +70,10 @@
70#define MDIO_MMDREG_STAT1_LPABLE_LBN (1) 70#define MDIO_MMDREG_STAT1_LPABLE_LBN (1)
71#define MDIO_MMDREG_STAT1_LPABLE_WIDTH (1) 71#define MDIO_MMDREG_STAT1_LPABLE_WIDTH (1)
72 72
73/* Bits in ID reg */ 73/* Bits in combined ID regs */
74#define MDIO_ID_REV(_id32) (_id32 & 0xf) 74static inline unsigned mdio_id_rev(u32 id) { return id & 0xf; }
75#define MDIO_ID_MODEL(_id32) ((_id32 >> 4) & 0x3f) 75static inline unsigned mdio_id_model(u32 id) { return (id >> 4) & 0x3f; }
76#define MDIO_ID_OUI(_id32) (_id32 >> 10) 76extern unsigned mdio_id_oui(u32 id);
77 77
78/* Bits in MMDREG_DEVS0/1. Someone thoughtfully layed things out 78/* Bits in MMDREG_DEVS0/1. Someone thoughtfully layed things out
79 * so the 'bit present' bit number of an MMD is the number of 79 * so the 'bit present' bit number of an MMD is the number of
diff --git a/drivers/net/sfc/xfp_phy.c b/drivers/net/sfc/xfp_phy.c
index 5d1c7f800007..2df467d28064 100644
--- a/drivers/net/sfc/xfp_phy.c
+++ b/drivers/net/sfc/xfp_phy.c
@@ -88,9 +88,9 @@ static int xfp_phy_init(struct efx_nic *efx)
88 return -ENOMEM; 88 return -ENOMEM;
89 efx->phy_data = phy_data; 89 efx->phy_data = phy_data;
90 90
91 EFX_INFO(efx, "PHY ID reg %x (OUI %x model %x revision %x)\n", 91 EFX_INFO(efx, "PHY ID reg %x (OUI %06x model %02x revision %x)\n",
92 devid, MDIO_ID_OUI(devid), MDIO_ID_MODEL(devid), 92 devid, mdio_id_oui(devid), mdio_id_model(devid),
93 MDIO_ID_REV(devid)); 93 mdio_id_rev(devid));
94 94
95 phy_data->phy_mode = efx->phy_mode; 95 phy_data->phy_mode = efx->phy_mode;
96 96