RT-AC66 3.0.0.4.374.130 core
[tomato.git] / release / src-rt-6.x / linux / linux-2.6 / drivers / net / titan_mdio.h
blob5d23344b8d7640bebdc5da4f9db0509c1aa1a59a
1 /*
2 * MDIO used to interact with the PHY when using GMII/MII
3 */
4 #ifndef _TITAN_MDIO_H
5 #define _TITAN_MDIO_H
7 #include <linux/netdevice.h>
8 #include <linux/workqueue.h>
9 #include <linux/delay.h>
10 #include "titan_ge.h"
13 #define TITAN_GE_MDIO_ERROR (-9000)
14 #define TITAN_GE_MDIO_GOOD 0
16 #define TITAN_GE_MDIO_BASE titan_ge_base
18 #define TITAN_GE_MDIO_READ(offset) \
19 *(volatile u32 *)(titan_ge_base + (offset))
21 #define TITAN_GE_MDIO_WRITE(offset, data) \
22 *(volatile u32 *)(titan_ge_base + (offset)) = (data)
25 /* GMII specific registers */
26 #define TITAN_GE_MARVEL_PHY_ID 0x00
27 #define TITAN_PHY_AUTONEG_ADV 0x04
28 #define TITAN_PHY_LP_ABILITY 0x05
29 #define TITAN_GE_MDIO_MII_CTRL 0x09
30 #define TITAN_GE_MDIO_MII_EXTENDED 0x0f
31 #define TITAN_GE_MDIO_PHY_CTRL 0x10
32 #define TITAN_GE_MDIO_PHY_STATUS 0x11
33 #define TITAN_GE_MDIO_PHY_IE 0x12
34 #define TITAN_GE_MDIO_PHY_IS 0x13
35 #define TITAN_GE_MDIO_PHY_LED 0x18
36 #define TITAN_GE_MDIO_PHY_LED_OVER 0x19
37 #define PHY_ANEG_TIME_WAIT 45 /* 45 seconds wait time */
40 * MDIO Config Structure
42 typedef struct {
43 unsigned int clka;
44 int mdio_spre;
45 int mdio_mode;
46 } titan_ge_mdio_config;
49 * Function Prototypes
51 int titan_ge_mdio_setup(titan_ge_mdio_config *);
52 int titan_ge_mdio_inaddrs(int, int);
53 int titan_ge_mdio_read(int, int, unsigned int *);
54 int titan_ge_mdio_write(int, int, unsigned int);
56 #endif /* _TITAN_MDIO_H */