From 1b96cf30a91d98f3e84aac12b19d2a2bbbe5d402 Mon Sep 17 00:00:00 2001 From: John Crispin Date: Tue, 22 Apr 2014 08:08:02 +0000 Subject: linux/generic: add MIB counters and port status to ADM6996 switch This patch adds port status information and MIB counters to the ADM6996 switch driver. The driver supports also the older ADM6996L-variant, but I'm not able to test this patch on that chip. According to the datasheet the same registers exist there as well, so I think it should work, but any feedback is appreciated. Signed-off-by: Matti Laakso SVN-Revision: 40542 --- target/linux/generic/files/drivers/net/phy/adm6996.h | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) (limited to 'target/linux/generic/files/drivers/net/phy/adm6996.h') diff --git a/target/linux/generic/files/drivers/net/phy/adm6996.h b/target/linux/generic/files/drivers/net/phy/adm6996.h index b30eceafdd..66c77a0968 100644 --- a/target/linux/generic/files/drivers/net/phy/adm6996.h +++ b/target/linux/generic/files/drivers/net/phy/adm6996.h @@ -50,6 +50,16 @@ enum admreg { ADM_COUNTER_BASE = 0xa0, ADM_SIG0 = ADM_COUNTER_BASE + 0, ADM_SIG1 = ADM_COUNTER_BASE + 1, + ADM_PS0 = ADM_COUNTER_BASE + 2, + ADM_PS1 = ADM_COUNTER_BASE + 3, + ADM_PS2 = ADM_COUNTER_BASE + 4, + ADM_CL0 = ADM_COUNTER_BASE + 8, /* RxPacket */ + ADM_CL6 = ADM_COUNTER_BASE + 0x1a, /* RxByte */ + ADM_CL12 = ADM_COUNTER_BASE + 0x2c, /* TxPacket */ + ADM_CL18 = ADM_COUNTER_BASE + 0x3e, /* TxByte */ + ADM_CL24 = ADM_COUNTER_BASE + 0x50, /* Coll */ + ADM_CL30 = ADM_COUNTER_BASE + 0x62, /* Err */ +#define ADM_OFFSET_PORT(n) ((n * 4) - (n / 4) * 2 - (n / 5) * 2) ADM_PHY_BASE = 0x200, #define ADM_PHY_PORT(n) (ADM_PHY_BASE + (0x20 * n)) }; @@ -159,6 +169,14 @@ static const u8 adm_portcfg[] = { ((ports & 0x04) << 2) | ((ports & 0x08) << 3) | \ ((ports & 0x10) << 3) | ((ports & 0x20) << 3)) +/* Port status register */ +enum { + ADM_PS_LS = (1 << 0), /* Link status */ + ADM_PS_SS = (1 << 1), /* Speed status */ + ADM_PS_DS = (1 << 2), /* Duplex status */ + ADM_PS_FCS = (1 << 3) /* Flow control status */ +}; + /* * Split the register address in phy id and register * it will get combined again by the mdio bus op -- cgit v1.2.3