/*-------------------------------------------------------------------------------------*\ $Header$ $Id$ $Log$ \*-------------------------------------------------------------------------------------*/ #ifndef _MDIO_H_ #define _MDIO_H_ #define MDIO_R_VER (*(volatile unsigned *)(MDIO_BASE + 0x00)) #define MDIO_R_CONTROL (*(volatile unsigned *)(MDIO_BASE + 0x04)) #define MDIO_CONTROL_IDLE (1 << 31) #define MDIO_CONTROL_ENABLE (1 << 30) #define MDIO_CONTROL_PREAMBLE (1 << 20) #define MDIO_CONTROL_FAULT (1 << 19) #define MDIO_CONTROL_FAULT_DETECT_EN (1 << 18) #define MDIO_CONTROL_IRQ_TEST_EN (1 << 17) #define MDIO_CONTROL_MAXCHAN(maxchan) ((maxchan) << 8) /*--- #define MDIO_CONTROL_CLKDIV(clkdiv) ((clkdiv) << 0) ---*/ #define MDIO_R_ALIVE (*(volatile unsigned *)(MDIO_BASE + 0x08)) #define MDIO_R_LINK (*(volatile unsigned *)(MDIO_BASE + 0x0C)) #define INTERNAL_PHY (1 << 31) #define EXTERNAL_PHY (1 << 1) #define MDIO_R_LINK_INT (*(volatile unsigned *)(MDIO_BASE + 0x10)) #define MDIO_R_USER_INTRAW (*(volatile unsigned *)(MDIO_BASE + 0x14)) #define MDIO_R_USER_INTMASK (*(volatile unsigned *)(MDIO_BASE + 0x18)) #define MDIO_R_USER_INTMASKSET (*(volatile unsigned *)(MDIO_BASE + 0x1C)) #define MDIO_R_USER_INTMASKCLR (*(volatile unsigned *)(MDIO_BASE + 0x20)) #define MDIO_R_USER_ACCESS0 (*(volatile unsigned *)(MDIO_BASE + 0x80)) #define MDIO_R_USER_ACCESS1 (*(volatile unsigned *)(MDIO_BASE + 0x88)) #define MDIO_USER_ACCESS_GO (1U << 31) #define MDIO_USER_ACCESS_WRITE (1 << 30) #define MDIO_USER_ACCESS_ACK (1 << 29) #define MDIO_USER_ACCESS_REGADDR(addr) ((addr) << 21) #define MDIO_USER_ACCESS_PHYADDR(addr) ((addr) << 16) #define MDIO_USER_ACCESS_DATA(data) ((data) << 0) #define MDIO_R_USER_PHYSEL0 (*(volatile unsigned *)(MDIO_BASE + 0x84)) #define MDIO_R_USER_PHYSEL1 (*(volatile unsigned *)(MDIO_BASE + 0x8C)) #define MDIO_USER_PHY_SELECT_LINK_SEL (1 << 7) #define MDIO_USER_PHY_SELECT_LINK_IRQ_EN (1 << 6) #define MDIO_USER_PHY_SELECT_PHY_MON(addr) ((addr) << 0) #define ARM1176 1 union _mdio_control { volatile unsigned int Reg; volatile struct __mdio_control { #if defined(ARM1176) unsigned int idle : 1; unsigned int enable : 1; unsigned int reserved29 : 1; unsigned int highest_channel : 5; unsigned int reserved2321 : 3; unsigned int preamble : 1; unsigned int fault : 1; unsigned int fault_detect_en : 1; unsigned int int_test_en : 1; unsigned int reserved16 : 1; unsigned int clk_div : 16; #else unsigned int clk_div : 8; unsigned int reserved : 9; unsigned int int_test_en : 1; unsigned int fault_detect_en : 1; unsigned int fault : 1; unsigned int preamble : 1; unsigned int reserved21_29 : 9; unsigned int enable : 1; unsigned int idle : 1; #endif } Bits; }; union _mdio_user_access { volatile unsigned int Reg; struct __mdio_user_access { #if defined(ARM1176) unsigned int go : 1; unsigned int write : 1; unsigned int ack : 1; unsigned int reserved : 3; unsigned int regaddr : 5; unsigned int phyaddr : 5; unsigned int data : 16; #else unsigned int data : 16; unsigned int phyaddr : 5; unsigned int regaddr : 5; unsigned int reserved : 3; unsigned int ack : 1; unsigned int write : 1; unsigned int go : 1; #endif } Bits; }; union _mdio_user_physel { volatile unsigned int Reg; struct __mdio_user_physel { #if defined(ARM1176) unsigned int reserved1 : 24; unsigned int linksel : 1; unsigned int linkint_en : 1; unsigned int reserved : 1; unsigned int phyadr_mon : 5; #else unsigned int phyadr_mon : 5; unsigned int reserved : 1; unsigned int linkint_en : 1; unsigned int linksel : 1; unsigned int reserved1 : 24; #endif } Bits; }; struct _user { #if defined(ARM1176) union _mdio_user_access access; union _mdio_user_physel physel; #else union _mdio_user_physel physel; union _mdio_user_access access; #endif }; struct mdio_regs { volatile unsigned int version; union _mdio_control control; volatile unsigned int alive; volatile unsigned int link; volatile unsigned int linkintraw; volatile unsigned int linkintmask; volatile unsigned int reserved1; volatile unsigned int reserved2; volatile unsigned int userintraw; volatile unsigned int userintmasked; volatile unsigned int userintmaskset; volatile unsigned int userintmaskclear; volatile unsigned int reserved[20]; struct _user user[2]; }; #endif /*--- #ifndef _MDIO_H_ ---*/