1 /* 2 * MDIO used to interact with the PHY when using GMII/MII 3 */ 4 #ifndef _TITAN_MDIO_H 5 #define _TITAN_MDIO_H 6 7 #include <linux/netdevice.h> 8 #include <linux/tqueue.h> 9 #include <linux/delay.h> 10 #include "titan_ge.h" 11 12 13 #define TITAN_GE_MDIO_ERROR (-9000) 14 #define TITAN_GE_MDIO_GOOD 0 15 16 #define TITAN_GE_MDIO_BASE TITAN_GE_BASE 17 18 #define TITAN_GE_MDIO_READ(offset) *(volatile u32 *)(TITAN_GE_MDIO_BASE + offset) 19 20 #define TITAN_GE_MDIO_WRITE(offset, data) \ 21 *(volatile u32 *)(TITAN_GE_MDIO_BASE + offset) = data 22 23 24 /* GMII specific registers */ 25 #define TITAN_GE_MARVEL_PHY_ID 0x00 26 #define TITAN_PHY_AUTONEG_ADV 0x04 27 #define TITAN_PHY_LP_ABILITY 0x05 28 #define TITAN_GE_MDIO_MII_CTRL 0x09 29 #define TITAN_GE_MDIO_MII_EXTENDED 0x0f 30 #define TITAN_GE_MDIO_PHY_CTRL 0x10 31 #define TITAN_GE_MDIO_PHY_STATUS 0x11 32 #define TITAN_GE_MDIO_PHY_IE 0x12 33 #define TITAN_GE_MDIO_PHY_IS 0x13 34 #define TITAN_GE_MDIO_PHY_LED 0x18 35 #define TITAN_GE_MDIO_PHY_LED_OVER 0x19 36 #define PHY_ANEG_TIME_WAIT 45 /* 45 seconds wait time */ 37 38 /* 39 * MDIO Config Structure 40 */ 41 typedef struct 42 { 43 unsigned int clka; 44 int mdio_spre; 45 int mdio_mode; 46 } titan_ge_mdio_config; 47 48 /* 49 * Function Prototypes 50 */ 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); 55 56 #endif /* _TITAN_MDIO_H */ 57 58 59 60