| 1 |
585 |
jeremybenn |
/******************************************************************************
|
| 2 |
|
|
* DISCLAIMER
|
| 3 |
|
|
* Please refer to http://www.renesas.com/disclaimer
|
| 4 |
|
|
******************************************************************************
|
| 5 |
|
|
Copyright (C) 2008. Renesas Technology Corp., All Rights Reserved.
|
| 6 |
|
|
*******************************************************************************
|
| 7 |
|
|
* File Name : phy.h
|
| 8 |
|
|
* Version : 1.02
|
| 9 |
|
|
* Description : Ethernet PHY device driver
|
| 10 |
|
|
******************************************************************************
|
| 11 |
|
|
* History : DD.MM.YYYY Version Description
|
| 12 |
|
|
* : 15.02.2010 1.00 First Release
|
| 13 |
|
|
* : 17.03.2010 1.01 Modification of macro definitions for access timing
|
| 14 |
|
|
* : 06.04.2010 1.02 RX62N changes
|
| 15 |
|
|
******************************************************************************/
|
| 16 |
|
|
|
| 17 |
|
|
#ifndef PHY_H
|
| 18 |
|
|
#define PHY_H
|
| 19 |
|
|
|
| 20 |
|
|
/******************************************************************************
|
| 21 |
|
|
Includes <System Includes> , "Project Includes"
|
| 22 |
|
|
******************************************************************************/
|
| 23 |
|
|
|
| 24 |
|
|
/******************************************************************************
|
| 25 |
|
|
Typedef definitions
|
| 26 |
|
|
******************************************************************************/
|
| 27 |
|
|
|
| 28 |
|
|
/******************************************************************************
|
| 29 |
|
|
Macro definitions
|
| 30 |
|
|
******************************************************************************/
|
| 31 |
|
|
/* Standard PHY Registers */
|
| 32 |
|
|
#define BASIC_MODE_CONTROL_REG 0
|
| 33 |
|
|
#define BASIC_MODE_STATUS_REG 1
|
| 34 |
|
|
#define PHY_IDENTIFIER1_REG 2
|
| 35 |
|
|
#define PHY_IDENTIFIER2_REG 3
|
| 36 |
|
|
#define AN_ADVERTISEMENT_REG 4
|
| 37 |
|
|
#define AN_LINK_PARTNER_ABILITY_REG 5
|
| 38 |
|
|
#define AN_EXPANSION_REG 6
|
| 39 |
|
|
|
| 40 |
|
|
/* Media Independent Interface */
|
| 41 |
|
|
#define PHY_ST 1
|
| 42 |
|
|
#define PHY_READ 2
|
| 43 |
|
|
#define PHY_WRITE 1
|
| 44 |
|
|
#define PHY_ADDR 0x01
|
| 45 |
|
|
|
| 46 |
|
|
#define MDC_WAIT 2
|
| 47 |
|
|
|
| 48 |
|
|
/* PHY return definitions */
|
| 49 |
|
|
#define R_PHY_OK 0
|
| 50 |
|
|
#define R_PHY_ERROR -1
|
| 51 |
|
|
|
| 52 |
|
|
/* Auto-Negotiation Link Partner Status */
|
| 53 |
|
|
#define PHY_AN_LINK_PARTNER_100BASE 0x0180
|
| 54 |
|
|
#define PHY_AN_LINK_PARTNER_FULL 0x0140
|
| 55 |
|
|
#define PHY_AN_COMPLETE ( 1 << 5 )
|
| 56 |
|
|
|
| 57 |
|
|
/*
|
| 58 |
|
|
* Wait counter definitions of PHY-LSI initialization
|
| 59 |
|
|
* ICLK = 96MHz
|
| 60 |
|
|
*/
|
| 61 |
|
|
#define PHY_RESET_WAIT 0x00000020L
|
| 62 |
|
|
#define PHY_AUTO_NEGOTIATON_WAIT 75
|
| 63 |
|
|
|
| 64 |
|
|
#define PHY_AN_ENABLE 0x1200
|
| 65 |
|
|
#define PHY_AN_10_100_F_H 0xde1
|
| 66 |
|
|
|
| 67 |
|
|
/******************************************************************************
|
| 68 |
|
|
Variable Externs
|
| 69 |
|
|
******************************************************************************/
|
| 70 |
|
|
|
| 71 |
|
|
/******************************************************************************
|
| 72 |
|
|
Functions Prototypes
|
| 73 |
|
|
******************************************************************************/
|
| 74 |
|
|
/**
|
| 75 |
|
|
* External prototypes
|
| 76 |
|
|
**/
|
| 77 |
|
|
short phy_init( void );
|
| 78 |
|
|
void phy_set_100full( void );
|
| 79 |
|
|
void phy_set_10half( void );
|
| 80 |
|
|
short phy_set_autonegotiate( void );
|
| 81 |
|
|
|
| 82 |
|
|
#endif /* PHY_H */
|
| 83 |
|
|
|