Tom Rix | d8380c9 | 2009-09-27 07:47:24 -0500 | [diff] [blame^] | 1 | /* |
| 2 | * NOTE: MICREL ethernet Physical layer |
| 3 | * |
| 4 | * Version: KS8721.h |
| 5 | * |
| 6 | * Authors: Eric Benard (based on dm9161.h) |
| 7 | * |
| 8 | * This program is free software; you can redistribute it and/or |
| 9 | * modify it under the terms of the GNU General Public License |
| 10 | * as published by the Free Software Foundation; either version |
| 11 | * 2 of the License, or (at your option) any later version. |
| 12 | */ |
| 13 | |
| 14 | /* MICREL PHYSICAL LAYER TRANSCEIVER KS8721 */ |
| 15 | |
| 16 | #define KS8721_BMCR 0 |
| 17 | #define KS8721_BMSR 1 |
| 18 | #define KS8721_PHYID1 2 |
| 19 | #define KS8721_PHYID2 3 |
| 20 | #define KS8721_ANAR 4 |
| 21 | #define KS8721_ANLPAR 5 |
| 22 | #define KS8721_ANER 6 |
| 23 | #define KS8721_RECR 15 |
| 24 | #define KS8721_MDINTR 27 |
| 25 | #define KS8721_100BT 31 |
| 26 | |
| 27 | /* --Bit definitions: KS8721_BMCR */ |
| 28 | #define KS8721_RESET (1 << 15) |
| 29 | #define KS8721_LOOPBACK (1 << 14) |
| 30 | #define KS8721_SPEED_SELECT (1 << 13) |
| 31 | #define KS8721_AUTONEG (1 << 12) |
| 32 | #define KS8721_POWER_DOWN (1 << 11) |
| 33 | #define KS8721_ISOLATE (1 << 10) |
| 34 | #define KS8721_RESTART_AUTONEG (1 << 9) |
| 35 | #define KS8721_DUPLEX_MODE (1 << 8) |
| 36 | #define KS8721_COLLISION_TEST (1 << 7) |
| 37 | #define KS8721_DISABLE (1 << 0) |
| 38 | |
| 39 | /*--Bit definitions: KS8721_BMSR */ |
| 40 | #define KS8721_100BASE_T4 (1 << 15) |
| 41 | #define KS8721_100BASE_TX_FD (1 << 14) |
| 42 | #define KS8721_100BASE_T4_HD (1 << 13) |
| 43 | #define KS8721_10BASE_T_FD (1 << 12) |
| 44 | #define KS8721_10BASE_T_HD (1 << 11) |
| 45 | #define KS8721_MF_PREAMB_SUPPR (1 << 6) |
| 46 | #define KS8721_AUTONEG_COMP (1 << 5) |
| 47 | #define KS8721_REMOTE_FAULT (1 << 4) |
| 48 | #define KS8721_AUTONEG_ABILITY (1 << 3) |
| 49 | #define KS8721_LINK_STATUS (1 << 2) |
| 50 | #define KS8721_JABBER_DETECT (1 << 1) |
| 51 | #define KS8721_EXTEND_CAPAB (1 << 0) |
| 52 | |
| 53 | /*--Bit definitions: KS8721_PHYID */ |
| 54 | #define KS8721_PHYID_OUI 0x0885 |
| 55 | #define KS8721_LSB_MASK 0x3F |
| 56 | |
| 57 | #define KS8721BL_MODEL 0x21 |
| 58 | #define KS8721_MODELMASK 0x3F0 |
| 59 | #define KS8721BL_REV 0x9 |
| 60 | #define KS8721_REVMASK 0xF |
| 61 | |
| 62 | /*--Bit definitions: KS8721_ANAR, KS8721_ANLPAR */ |
| 63 | #define KS8721_NP (1 << 15) |
| 64 | #define KS8721_ACK (1 << 14) |
| 65 | #define KS8721_RF (1 << 13) |
| 66 | #define KS8721_PAUSE (1 << 10) |
| 67 | #define KS8721_T4 (1 << 9) |
| 68 | #define KS8721_TX_FDX (1 << 8) |
| 69 | #define KS8721_TX_HDX (1 << 7) |
| 70 | #define KS8721_10_FDX (1 << 6) |
| 71 | #define KS8721_10_HDX (1 << 5) |
| 72 | #define KS8721_AN_IEEE_802_3 0x0001 |
| 73 | |
| 74 | /****************** function prototypes **********************/ |
| 75 | unsigned int ks8721_isphyconnected(AT91PS_EMAC p_mac); |
| 76 | unsigned char ks8721_getlinkspeed(AT91PS_EMAC p_mac); |
| 77 | unsigned char ks8721_autonegotiate(AT91PS_EMAC p_mac, int *status); |
| 78 | unsigned char ks8721_initphy(AT91PS_EMAC p_mac); |