diff options
author | Ben Hutchings <bhutchings@solarflare.com> | 2009-02-27 13:07:15 +0000 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2009-03-02 03:15:04 -0800 |
commit | 3f39a5e9bff000025c2679101b4f83e4fc21dbba (patch) | |
tree | b5a9632720383e3309e170da6c38f6468dbfd5ee /drivers/net/sfc/mdio_10g.c | |
parent | f794fd440066ccd7d601f405f80aa514b95f15d1 (diff) | |
download | talos-op-linux-3f39a5e9bff000025c2679101b4f83e4fc21dbba.tar.gz talos-op-linux-3f39a5e9bff000025c2679101b4f83e4fc21dbba.zip |
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/net/sfc/mdio_10g.c')
-rw-r--r-- | drivers/net/sfc/mdio_10g.c | 15 |
1 files changed, 15 insertions, 0 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 @@ #include "boards.h" #include "workarounds.h" +unsigned mdio_id_oui(u32 id) +{ + unsigned oui = 0; + int i; + + /* The bits of the OUI are designated a..x, with a=0 and b variable. + * In the id register c is the MSB but the OUI is conventionally + * written as bytes h..a, p..i, x..q. Reorder the bits accordingly. */ + for (i = 0; i < 22; ++i) + if (id & (1 << (i + 10))) + oui |= 1 << (i ^ 7); + + return oui; +} + int mdio_clause45_reset_mmd(struct efx_nic *port, int mmd, int spins, int spintime) { |