wdenk | 9c53f40 | 2003-10-15 23:53:47 +0000 | [diff] [blame] | 1 | /* |
| 2 | * tsec.h |
| 3 | * |
| 4 | * Driver for the Motorola Triple Speed Ethernet Controller |
| 5 | * |
| 6 | * This software may be used and distributed according to the |
| 7 | * terms of the GNU Public License, Version 2, incorporated |
| 8 | * herein by reference. |
| 9 | * |
Sandeep Gopalpet | b5541ef | 2009-10-31 00:35:04 +0530 | [diff] [blame] | 10 | * Copyright 2004, 2007, 2009 Freescale Semiconductor, Inc. |
wdenk | 9c53f40 | 2003-10-15 23:53:47 +0000 | [diff] [blame] | 11 | * (C) Copyright 2003, Motorola, Inc. |
| 12 | * maintained by Xianghua Xiao (x.xiao@motorola.com) |
| 13 | * author Andy Fleming |
| 14 | * |
| 15 | */ |
| 16 | |
| 17 | #ifndef __TSEC_H |
| 18 | #define __TSEC_H |
| 19 | |
| 20 | #include <net.h> |
Eran Liberty | 9095d4a | 2005-07-28 10:08:46 -0500 | [diff] [blame] | 21 | #include <config.h> |
wdenk | 9c53f40 | 2003-10-15 23:53:47 +0000 | [diff] [blame] | 22 | |
Sandeep Gopalpet | b5541ef | 2009-10-31 00:35:04 +0530 | [diff] [blame] | 23 | #define TSEC_SIZE 0x01000 |
| 24 | #define TSEC_MDIO_OFFSET 0x01000 |
Eran Liberty | 9095d4a | 2005-07-28 10:08:46 -0500 | [diff] [blame] | 25 | |
Andy Fleming | fecff2b | 2008-08-31 16:33:26 -0500 | [diff] [blame] | 26 | #define STD_TSEC_INFO(num) \ |
| 27 | { \ |
| 28 | .regs = (tsec_t *)(TSEC_BASE_ADDR + ((num - 1) * TSEC_SIZE)), \ |
Sandeep Gopalpet | b5541ef | 2009-10-31 00:35:04 +0530 | [diff] [blame] | 29 | .miiregs = (tsec_mdio_t *)(MDIO_BASE_ADDR), \ |
| 30 | .miiregs_sgmii = (tsec_mdio_t *)(MDIO_BASE_ADDR \ |
| 31 | + (num - 1) * TSEC_MDIO_OFFSET), \ |
Andy Fleming | fecff2b | 2008-08-31 16:33:26 -0500 | [diff] [blame] | 32 | .devname = CONFIG_TSEC##num##_NAME, \ |
| 33 | .phyaddr = TSEC##num##_PHY_ADDR, \ |
| 34 | .flags = TSEC##num##_FLAGS \ |
| 35 | } |
| 36 | |
| 37 | #define SET_STD_TSEC_INFO(x, num) \ |
| 38 | { \ |
| 39 | x.regs = (tsec_t *)(TSEC_BASE_ADDR + ((num - 1) * TSEC_SIZE)); \ |
Sandeep Gopalpet | b5541ef | 2009-10-31 00:35:04 +0530 | [diff] [blame] | 40 | x.miiregs = (tsec_mdio_t *)(MDIO_BASE_ADDR); \ |
| 41 | x.miiregs_sgmii = (tsec_mdio_t *)(MDIO_BASE_ADDR \ |
| 42 | + (num - 1) * TSEC_MDIO_OFFSET); \ |
Andy Fleming | fecff2b | 2008-08-31 16:33:26 -0500 | [diff] [blame] | 43 | x.devname = CONFIG_TSEC##num##_NAME; \ |
| 44 | x.phyaddr = TSEC##num##_PHY_ADDR; \ |
| 45 | x.flags = TSEC##num##_FLAGS;\ |
| 46 | } |
| 47 | |
wdenk | 9c53f40 | 2003-10-15 23:53:47 +0000 | [diff] [blame] | 48 | #define MAC_ADDR_LEN 6 |
| 49 | |
Wolfgang Denk | a1be476 | 2008-05-20 16:00:29 +0200 | [diff] [blame] | 50 | /* #define TSEC_TIMEOUT 1000000 */ |
wdenk | a445ddf | 2004-06-09 00:34:46 +0000 | [diff] [blame] | 51 | #define TSEC_TIMEOUT 1000 |
Wolfgang Denk | a1be476 | 2008-05-20 16:00:29 +0200 | [diff] [blame] | 52 | #define TOUT_LOOP 1000000 |
wdenk | 9c53f40 | 2003-10-15 23:53:47 +0000 | [diff] [blame] | 53 | |
Stefan Roese | c0dc34f | 2005-09-21 18:20:22 +0200 | [diff] [blame] | 54 | #define PHY_AUTONEGOTIATE_TIMEOUT 5000 /* in ms */ |
| 55 | |
Andy Fleming | ac65e07 | 2008-08-31 16:33:27 -0500 | [diff] [blame] | 56 | /* TBI register addresses */ |
| 57 | #define TBI_CR 0x00 |
| 58 | #define TBI_SR 0x01 |
| 59 | #define TBI_ANA 0x04 |
| 60 | #define TBI_ANLPBPA 0x05 |
| 61 | #define TBI_ANEX 0x06 |
| 62 | #define TBI_TBICON 0x11 |
| 63 | |
| 64 | /* TBI MDIO register bit fields*/ |
| 65 | #define TBICON_CLK_SELECT 0x0020 |
| 66 | #define TBIANA_ASYMMETRIC_PAUSE 0x0100 |
| 67 | #define TBIANA_SYMMETRIC_PAUSE 0x0080 |
| 68 | #define TBIANA_HALF_DUPLEX 0x0040 |
| 69 | #define TBIANA_FULL_DUPLEX 0x0020 |
| 70 | #define TBICR_PHY_RESET 0x8000 |
| 71 | #define TBICR_ANEG_ENABLE 0x1000 |
| 72 | #define TBICR_RESTART_ANEG 0x0200 |
| 73 | #define TBICR_FULL_DUPLEX 0x0100 |
| 74 | #define TBICR_SPEED1_SET 0x0040 |
| 75 | |
| 76 | |
wdenk | 9c53f40 | 2003-10-15 23:53:47 +0000 | [diff] [blame] | 77 | /* MAC register bits */ |
| 78 | #define MACCFG1_SOFT_RESET 0x80000000 |
| 79 | #define MACCFG1_RESET_RX_MC 0x00080000 |
| 80 | #define MACCFG1_RESET_TX_MC 0x00040000 |
| 81 | #define MACCFG1_RESET_RX_FUN 0x00020000 |
| 82 | #define MACCFG1_RESET_TX_FUN 0x00010000 |
| 83 | #define MACCFG1_LOOPBACK 0x00000100 |
| 84 | #define MACCFG1_RX_FLOW 0x00000020 |
| 85 | #define MACCFG1_TX_FLOW 0x00000010 |
| 86 | #define MACCFG1_SYNCD_RX_EN 0x00000008 |
| 87 | #define MACCFG1_RX_EN 0x00000004 |
| 88 | #define MACCFG1_SYNCD_TX_EN 0x00000002 |
| 89 | #define MACCFG1_TX_EN 0x00000001 |
| 90 | |
| 91 | #define MACCFG2_INIT_SETTINGS 0x00007205 |
| 92 | #define MACCFG2_FULL_DUPLEX 0x00000001 |
Wolfgang Denk | a1be476 | 2008-05-20 16:00:29 +0200 | [diff] [blame] | 93 | #define MACCFG2_IF 0x00000300 |
wdenk | a445ddf | 2004-06-09 00:34:46 +0000 | [diff] [blame] | 94 | #define MACCFG2_GMII 0x00000200 |
Wolfgang Denk | a1be476 | 2008-05-20 16:00:29 +0200 | [diff] [blame] | 95 | #define MACCFG2_MII 0x00000100 |
wdenk | 9c53f40 | 2003-10-15 23:53:47 +0000 | [diff] [blame] | 96 | |
| 97 | #define ECNTRL_INIT_SETTINGS 0x00001000 |
Wolfgang Denk | a1be476 | 2008-05-20 16:00:29 +0200 | [diff] [blame] | 98 | #define ECNTRL_TBI_MODE 0x00000020 |
Jon Loeliger | 77a4f6e | 2005-07-25 14:05:07 -0500 | [diff] [blame] | 99 | #define ECNTRL_R100 0x00000008 |
Andy Fleming | 2fffa05 | 2007-04-23 02:24:28 -0500 | [diff] [blame] | 100 | #define ECNTRL_SGMII_MODE 0x00000002 |
wdenk | 9c53f40 | 2003-10-15 23:53:47 +0000 | [diff] [blame] | 101 | |
wdenk | a445ddf | 2004-06-09 00:34:46 +0000 | [diff] [blame] | 102 | #define miim_end -2 |
| 103 | #define miim_read -1 |
| 104 | |
Jean-Christophe PLAGNIOL-VILLARD | 0383694 | 2008-10-16 15:01:15 +0200 | [diff] [blame] | 105 | #ifndef CONFIG_SYS_TBIPA_VALUE |
| 106 | #define CONFIG_SYS_TBIPA_VALUE 0x1f |
Joe Hamman | 4290d4c | 2007-08-09 09:08:18 -0500 | [diff] [blame] | 107 | #endif |
wdenk | 9c53f40 | 2003-10-15 23:53:47 +0000 | [diff] [blame] | 108 | #define MIIMCFG_INIT_VALUE 0x00000003 |
| 109 | #define MIIMCFG_RESET 0x80000000 |
| 110 | |
Wolfgang Denk | a1be476 | 2008-05-20 16:00:29 +0200 | [diff] [blame] | 111 | #define MIIMIND_BUSY 0x00000001 |
| 112 | #define MIIMIND_NOTVALID 0x00000004 |
wdenk | 9c53f40 | 2003-10-15 23:53:47 +0000 | [diff] [blame] | 113 | |
Wolfgang Denk | a1be476 | 2008-05-20 16:00:29 +0200 | [diff] [blame] | 114 | #define MIIM_CONTROL 0x00 |
wdenk | a445ddf | 2004-06-09 00:34:46 +0000 | [diff] [blame] | 115 | #define MIIM_CONTROL_RESET 0x00009140 |
Wolfgang Denk | a1be476 | 2008-05-20 16:00:29 +0200 | [diff] [blame] | 116 | #define MIIM_CONTROL_INIT 0x00001140 |
| 117 | #define MIIM_CONTROL_RESTART 0x00001340 |
| 118 | #define MIIM_ANEN 0x00001000 |
wdenk | a445ddf | 2004-06-09 00:34:46 +0000 | [diff] [blame] | 119 | |
Wolfgang Denk | a1be476 | 2008-05-20 16:00:29 +0200 | [diff] [blame] | 120 | #define MIIM_CR 0x00 |
wdenk | a445ddf | 2004-06-09 00:34:46 +0000 | [diff] [blame] | 121 | #define MIIM_CR_RST 0x00008000 |
Wolfgang Denk | a1be476 | 2008-05-20 16:00:29 +0200 | [diff] [blame] | 122 | #define MIIM_CR_INIT 0x00001000 |
wdenk | 78924a7 | 2004-04-18 21:45:42 +0000 | [diff] [blame] | 123 | |
| 124 | #define MIIM_STATUS 0x1 |
Wolfgang Denk | a1be476 | 2008-05-20 16:00:29 +0200 | [diff] [blame] | 125 | #define MIIM_STATUS_AN_DONE 0x00000020 |
wdenk | a445ddf | 2004-06-09 00:34:46 +0000 | [diff] [blame] | 126 | #define MIIM_STATUS_LINK 0x0004 |
Stefan Roese | c0dc34f | 2005-09-21 18:20:22 +0200 | [diff] [blame] | 127 | #define PHY_BMSR_AUTN_ABLE 0x0008 |
| 128 | #define PHY_BMSR_AUTN_COMP 0x0020 |
wdenk | 9c53f40 | 2003-10-15 23:53:47 +0000 | [diff] [blame] | 129 | |
wdenk | a445ddf | 2004-06-09 00:34:46 +0000 | [diff] [blame] | 130 | #define MIIM_PHYIR1 0x2 |
| 131 | #define MIIM_PHYIR2 0x3 |
wdenk | 9c53f40 | 2003-10-15 23:53:47 +0000 | [diff] [blame] | 132 | |
wdenk | a445ddf | 2004-06-09 00:34:46 +0000 | [diff] [blame] | 133 | #define MIIM_ANAR 0x4 |
| 134 | #define MIIM_ANAR_INIT 0x1e1 |
wdenk | 9c53f40 | 2003-10-15 23:53:47 +0000 | [diff] [blame] | 135 | |
| 136 | #define MIIM_TBI_ANLPBPA 0x5 |
| 137 | #define MIIM_TBI_ANLPBPA_HALF 0x00000040 |
| 138 | #define MIIM_TBI_ANLPBPA_FULL 0x00000020 |
| 139 | |
wdenk | a445ddf | 2004-06-09 00:34:46 +0000 | [diff] [blame] | 140 | #define MIIM_TBI_ANEX 0x6 |
| 141 | #define MIIM_TBI_ANEX_NP 0x00000004 |
| 142 | #define MIIM_TBI_ANEX_PRX 0x00000002 |
| 143 | |
| 144 | #define MIIM_GBIT_CONTROL 0x9 |
| 145 | #define MIIM_GBIT_CONTROL_INIT 0xe00 |
wdenk | 9c53f40 | 2003-10-15 23:53:47 +0000 | [diff] [blame] | 146 | |
Andre Schwarz | 1e18be1 | 2008-04-29 19:18:32 +0200 | [diff] [blame] | 147 | #define MIIM_EXT_PAGE_ACCESS 0x1f |
| 148 | |
Paul Gortmaker | 2bd9f1b | 2007-01-16 11:38:14 -0500 | [diff] [blame] | 149 | /* Broadcom BCM54xx -- taken from linux sungem_phy */ |
Zach LeRoy | ddb7fc7 | 2009-05-22 10:26:33 -0500 | [diff] [blame] | 150 | #define MIIM_BCM54xx_AUXCNTL 0x18 |
| 151 | #define MIIM_BCM54xx_AUXCNTL_ENCODE(val) ((val & 0x7) << 12)|(val & 0x7) |
Paul Gortmaker | 2bd9f1b | 2007-01-16 11:38:14 -0500 | [diff] [blame] | 152 | #define MIIM_BCM54xx_AUXSTATUS 0x19 |
| 153 | #define MIIM_BCM54xx_AUXSTATUS_LINKMODE_MASK 0x0700 |
| 154 | #define MIIM_BCM54xx_AUXSTATUS_LINKMODE_SHIFT 8 |
| 155 | |
wdenk | a445ddf | 2004-06-09 00:34:46 +0000 | [diff] [blame] | 156 | /* Cicada Auxiliary Control/Status Register */ |
Wolfgang Denk | a1be476 | 2008-05-20 16:00:29 +0200 | [diff] [blame] | 157 | #define MIIM_CIS8201_AUX_CONSTAT 0x1c |
| 158 | #define MIIM_CIS8201_AUXCONSTAT_INIT 0x0004 |
| 159 | #define MIIM_CIS8201_AUXCONSTAT_DUPLEX 0x0020 |
| 160 | #define MIIM_CIS8201_AUXCONSTAT_SPEED 0x0018 |
| 161 | #define MIIM_CIS8201_AUXCONSTAT_GBIT 0x0010 |
| 162 | #define MIIM_CIS8201_AUXCONSTAT_100 0x0008 |
wdenk | 9c53f40 | 2003-10-15 23:53:47 +0000 | [diff] [blame] | 163 | |
wdenk | a445ddf | 2004-06-09 00:34:46 +0000 | [diff] [blame] | 164 | /* Cicada Extended Control Register 1 */ |
Wolfgang Denk | a1be476 | 2008-05-20 16:00:29 +0200 | [diff] [blame] | 165 | #define MIIM_CIS8201_EXT_CON1 0x17 |
| 166 | #define MIIM_CIS8201_EXTCON1_INIT 0x0000 |
wdenk | 9c53f40 | 2003-10-15 23:53:47 +0000 | [diff] [blame] | 167 | |
wdenk | a445ddf | 2004-06-09 00:34:46 +0000 | [diff] [blame] | 168 | /* Cicada 8204 Extended PHY Control Register 1 */ |
| 169 | #define MIIM_CIS8204_EPHY_CON 0x17 |
| 170 | #define MIIM_CIS8204_EPHYCON_INIT 0x0006 |
Wolfgang Denk | 4de55c0 | 2006-03-12 18:09:47 +0100 | [diff] [blame] | 171 | #define MIIM_CIS8204_EPHYCON_RGMII 0x1100 |
wdenk | a445ddf | 2004-06-09 00:34:46 +0000 | [diff] [blame] | 172 | |
| 173 | /* Cicada 8204 Serial LED Control Register */ |
| 174 | #define MIIM_CIS8204_SLED_CON 0x1b |
| 175 | #define MIIM_CIS8204_SLEDCON_INIT 0x1115 |
wdenk | 9c53f40 | 2003-10-15 23:53:47 +0000 | [diff] [blame] | 176 | |
| 177 | #define MIIM_GBIT_CON 0x09 |
wdenk | 78924a7 | 2004-04-18 21:45:42 +0000 | [diff] [blame] | 178 | #define MIIM_GBIT_CON_ADVERT 0x0e00 |
wdenk | 9c53f40 | 2003-10-15 23:53:47 +0000 | [diff] [blame] | 179 | |
Jon Loeliger | 5c8aa97 | 2006-04-26 17:58:56 -0500 | [diff] [blame] | 180 | /* Entry for Vitesse VSC8244 regs starts here */ |
| 181 | /* Vitesse VSC8244 Auxiliary Control/Status Register */ |
Wolfgang Denk | a1be476 | 2008-05-20 16:00:29 +0200 | [diff] [blame] | 182 | #define MIIM_VSC8244_AUX_CONSTAT 0x1c |
| 183 | #define MIIM_VSC8244_AUXCONSTAT_INIT 0x0000 |
| 184 | #define MIIM_VSC8244_AUXCONSTAT_DUPLEX 0x0020 |
| 185 | #define MIIM_VSC8244_AUXCONSTAT_SPEED 0x0018 |
| 186 | #define MIIM_VSC8244_AUXCONSTAT_GBIT 0x0010 |
| 187 | #define MIIM_VSC8244_AUXCONSTAT_100 0x0008 |
| 188 | #define MIIM_CONTROL_INIT_LOOPBACK 0x4000 |
Jon Loeliger | 5c8aa97 | 2006-04-26 17:58:56 -0500 | [diff] [blame] | 189 | |
| 190 | /* Vitesse VSC8244 Extended PHY Control Register 1 */ |
Wolfgang Denk | a1be476 | 2008-05-20 16:00:29 +0200 | [diff] [blame] | 191 | #define MIIM_VSC8244_EPHY_CON 0x17 |
| 192 | #define MIIM_VSC8244_EPHYCON_INIT 0x0006 |
Jon Loeliger | 5c8aa97 | 2006-04-26 17:58:56 -0500 | [diff] [blame] | 193 | |
| 194 | /* Vitesse VSC8244 Serial LED Control Register */ |
Wolfgang Denk | a1be476 | 2008-05-20 16:00:29 +0200 | [diff] [blame] | 195 | #define MIIM_VSC8244_LED_CON 0x1b |
| 196 | #define MIIM_VSC8244_LEDCON_INIT 0xF011 |
Jon Loeliger | 5c8aa97 | 2006-04-26 17:58:56 -0500 | [diff] [blame] | 197 | |
Tor Krill | 8b3a82f | 2008-03-28 15:29:45 +0100 | [diff] [blame] | 198 | /* Entry for Vitesse VSC8601 regs starts here (Not complete) */ |
| 199 | /* Vitesse VSC8601 Extended PHY Control Register 1 */ |
Andre Schwarz | 1e18be1 | 2008-04-29 19:18:32 +0200 | [diff] [blame] | 200 | #define MIIM_VSC8601_EPHY_CON 0x17 |
Tor Krill | 8b3a82f | 2008-03-28 15:29:45 +0100 | [diff] [blame] | 201 | #define MIIM_VSC8601_EPHY_CON_INIT_SKEW 0x1120 |
Andre Schwarz | 1e18be1 | 2008-04-29 19:18:32 +0200 | [diff] [blame] | 202 | #define MIIM_VSC8601_SKEW_CTRL 0x1c |
Tor Krill | 8b3a82f | 2008-03-28 15:29:45 +0100 | [diff] [blame] | 203 | |
wdenk | a445ddf | 2004-06-09 00:34:46 +0000 | [diff] [blame] | 204 | /* 88E1011 PHY Status Register */ |
Wolfgang Denk | a1be476 | 2008-05-20 16:00:29 +0200 | [diff] [blame] | 205 | #define MIIM_88E1011_PHY_STATUS 0x11 |
| 206 | #define MIIM_88E1011_PHYSTAT_SPEED 0xc000 |
| 207 | #define MIIM_88E1011_PHYSTAT_GBIT 0x8000 |
| 208 | #define MIIM_88E1011_PHYSTAT_100 0x4000 |
| 209 | #define MIIM_88E1011_PHYSTAT_DUPLEX 0x2000 |
wdenk | a445ddf | 2004-06-09 00:34:46 +0000 | [diff] [blame] | 210 | #define MIIM_88E1011_PHYSTAT_SPDDONE 0x0800 |
| 211 | #define MIIM_88E1011_PHYSTAT_LINK 0x0400 |
| 212 | |
Andy Fleming | 239e75f | 2006-09-13 10:34:18 -0500 | [diff] [blame] | 213 | #define MIIM_88E1011_PHY_SCR 0x10 |
| 214 | #define MIIM_88E1011_PHY_MDI_X_AUTO 0x0060 |
| 215 | |
| 216 | /* 88E1111 PHY LED Control Register */ |
Andre Schwarz | 1e18be1 | 2008-04-29 19:18:32 +0200 | [diff] [blame] | 217 | #define MIIM_88E1111_PHY_LED_CONTROL 24 |
| 218 | #define MIIM_88E1111_PHY_LED_DIRECT 0x4100 |
| 219 | #define MIIM_88E1111_PHY_LED_COMBINE 0x411C |
Andy Fleming | 239e75f | 2006-09-13 10:34:18 -0500 | [diff] [blame] | 220 | |
Sergei Poselenov | 7d4a2c3 | 2008-06-06 15:52:44 +0200 | [diff] [blame] | 221 | /* 88E1121 PHY LED Control Register */ |
| 222 | #define MIIM_88E1121_PHY_LED_CTRL 16 |
| 223 | #define MIIM_88E1121_PHY_LED_PAGE 3 |
| 224 | #define MIIM_88E1121_PHY_LED_DEF 0x0030 |
| 225 | |
Anatolij Gustschin | d015a02 | 2008-12-02 10:31:04 +0100 | [diff] [blame] | 226 | /* 88E1121 PHY IRQ Enable/Status Register */ |
| 227 | #define MIIM_88E1121_PHY_IRQ_EN 18 |
| 228 | #define MIIM_88E1121_PHY_IRQ_STATUS 19 |
| 229 | |
Sergei Poselenov | 7d4a2c3 | 2008-06-06 15:52:44 +0200 | [diff] [blame] | 230 | #define MIIM_88E1121_PHY_PAGE 22 |
| 231 | |
Andy Fleming | 239e75f | 2006-09-13 10:34:18 -0500 | [diff] [blame] | 232 | /* 88E1145 Extended PHY Specific Control Register */ |
| 233 | #define MIIM_88E1145_PHY_EXT_CR 20 |
| 234 | #define MIIM_M88E1145_RGMII_RX_DELAY 0x0080 |
| 235 | #define MIIM_M88E1145_RGMII_TX_DELAY 0x0002 |
| 236 | |
Wolfgang Denk | a1be476 | 2008-05-20 16:00:29 +0200 | [diff] [blame] | 237 | #define MIIM_88E1145_PHY_PAGE 29 |
Andy Fleming | 239e75f | 2006-09-13 10:34:18 -0500 | [diff] [blame] | 238 | #define MIIM_88E1145_PHY_CAL_OV 30 |
| 239 | |
Dave Liu | a304a28 | 2008-01-11 18:45:28 +0800 | [diff] [blame] | 240 | /* RTL8211B PHY Status Register */ |
| 241 | #define MIIM_RTL8211B_PHY_STATUS 0x11 |
| 242 | #define MIIM_RTL8211B_PHYSTAT_SPEED 0xc000 |
| 243 | #define MIIM_RTL8211B_PHYSTAT_GBIT 0x8000 |
| 244 | #define MIIM_RTL8211B_PHYSTAT_100 0x4000 |
| 245 | #define MIIM_RTL8211B_PHYSTAT_DUPLEX 0x2000 |
| 246 | #define MIIM_RTL8211B_PHYSTAT_SPDDONE 0x0800 |
| 247 | #define MIIM_RTL8211B_PHYSTAT_LINK 0x0400 |
Andy Fleming | 239e75f | 2006-09-13 10:34:18 -0500 | [diff] [blame] | 248 | |
wdenk | a445ddf | 2004-06-09 00:34:46 +0000 | [diff] [blame] | 249 | /* DM9161 Control register values */ |
| 250 | #define MIIM_DM9161_CR_STOP 0x0400 |
| 251 | #define MIIM_DM9161_CR_RSTAN 0x1200 |
| 252 | |
| 253 | #define MIIM_DM9161_SCR 0x10 |
| 254 | #define MIIM_DM9161_SCR_INIT 0x0610 |
| 255 | |
| 256 | /* DM9161 Specified Configuration and Status Register */ |
| 257 | #define MIIM_DM9161_SCSR 0x11 |
| 258 | #define MIIM_DM9161_SCSR_100F 0x8000 |
| 259 | #define MIIM_DM9161_SCSR_100H 0x4000 |
| 260 | #define MIIM_DM9161_SCSR_10F 0x2000 |
| 261 | #define MIIM_DM9161_SCSR_10H 0x1000 |
| 262 | |
| 263 | /* DM9161 10BT Configuration/Status */ |
| 264 | #define MIIM_DM9161_10BTCSR 0x12 |
| 265 | #define MIIM_DM9161_10BTCSR_INIT 0x7800 |
wdenk | 9c53f40 | 2003-10-15 23:53:47 +0000 | [diff] [blame] | 266 | |
wdenk | f41ff3b | 2005-04-04 23:43:44 +0000 | [diff] [blame] | 267 | /* LXT971 Status 2 registers */ |
Wolfgang Denk | a1be476 | 2008-05-20 16:00:29 +0200 | [diff] [blame] | 268 | #define MIIM_LXT971_SR2 0x11 /* Status Register 2 */ |
Wolfgang Denk | a79c44f | 2006-03-12 18:06:37 +0100 | [diff] [blame] | 269 | #define MIIM_LXT971_SR2_SPEED_MASK 0x4200 |
Wolfgang Denk | a1be476 | 2008-05-20 16:00:29 +0200 | [diff] [blame] | 270 | #define MIIM_LXT971_SR2_10HDX 0x0000 /* 10 Mbit half duplex selected */ |
| 271 | #define MIIM_LXT971_SR2_10FDX 0x0200 /* 10 Mbit full duplex selected */ |
| 272 | #define MIIM_LXT971_SR2_100HDX 0x4000 /* 100 Mbit half duplex selected */ |
| 273 | #define MIIM_LXT971_SR2_100FDX 0x4200 /* 100 Mbit full duplex selected */ |
wdenk | f41ff3b | 2005-04-04 23:43:44 +0000 | [diff] [blame] | 274 | |
Wolfgang Denk | f0c4e46 | 2006-03-12 22:50:55 +0100 | [diff] [blame] | 275 | /* DP83865 Control register values */ |
| 276 | #define MIIM_DP83865_CR_INIT 0x9200 |
| 277 | |
| 278 | /* DP83865 Link and Auto-Neg Status Register */ |
| 279 | #define MIIM_DP83865_LANR 0x11 |
| 280 | #define MIIM_DP83865_SPD_MASK 0x0018 |
| 281 | #define MIIM_DP83865_SPD_1000 0x0010 |
| 282 | #define MIIM_DP83865_SPD_100 0x0008 |
| 283 | #define MIIM_DP83865_DPX_FULL 0x0002 |
| 284 | |
Wolfgang Denk | a1be476 | 2008-05-20 16:00:29 +0200 | [diff] [blame] | 285 | #define MIIM_READ_COMMAND 0x00000001 |
wdenk | 9c53f40 | 2003-10-15 23:53:47 +0000 | [diff] [blame] | 286 | |
| 287 | #define MRBLR_INIT_SETTINGS PKTSIZE_ALIGN |
| 288 | |
| 289 | #define MINFLR_INIT_SETTINGS 0x00000040 |
| 290 | |
Wolfgang Denk | a1be476 | 2008-05-20 16:00:29 +0200 | [diff] [blame] | 291 | #define DMACTRL_INIT_SETTINGS 0x000000c3 |
| 292 | #define DMACTRL_GRS 0x00000010 |
| 293 | #define DMACTRL_GTS 0x00000008 |
wdenk | 9c53f40 | 2003-10-15 23:53:47 +0000 | [diff] [blame] | 294 | |
Wolfgang Denk | a1be476 | 2008-05-20 16:00:29 +0200 | [diff] [blame] | 295 | #define TSTAT_CLEAR_THALT 0x80000000 |
| 296 | #define RSTAT_CLEAR_RHALT 0x00800000 |
wdenk | 9c53f40 | 2003-10-15 23:53:47 +0000 | [diff] [blame] | 297 | |
wdenk | 9c53f40 | 2003-10-15 23:53:47 +0000 | [diff] [blame] | 298 | |
wdenk | 9c53f40 | 2003-10-15 23:53:47 +0000 | [diff] [blame] | 299 | #define IEVENT_INIT_CLEAR 0xffffffff |
| 300 | #define IEVENT_BABR 0x80000000 |
| 301 | #define IEVENT_RXC 0x40000000 |
| 302 | #define IEVENT_BSY 0x20000000 |
| 303 | #define IEVENT_EBERR 0x10000000 |
| 304 | #define IEVENT_MSRO 0x04000000 |
| 305 | #define IEVENT_GTSC 0x02000000 |
| 306 | #define IEVENT_BABT 0x01000000 |
| 307 | #define IEVENT_TXC 0x00800000 |
| 308 | #define IEVENT_TXE 0x00400000 |
| 309 | #define IEVENT_TXB 0x00200000 |
| 310 | #define IEVENT_TXF 0x00100000 |
| 311 | #define IEVENT_IE 0x00080000 |
| 312 | #define IEVENT_LC 0x00040000 |
| 313 | #define IEVENT_CRL 0x00020000 |
| 314 | #define IEVENT_XFUN 0x00010000 |
| 315 | #define IEVENT_RXB0 0x00008000 |
| 316 | #define IEVENT_GRSC 0x00000100 |
| 317 | #define IEVENT_RXF0 0x00000080 |
| 318 | |
| 319 | #define IMASK_INIT_CLEAR 0x00000000 |
| 320 | #define IMASK_TXEEN 0x00400000 |
| 321 | #define IMASK_TXBEN 0x00200000 |
Wolfgang Denk | a1be476 | 2008-05-20 16:00:29 +0200 | [diff] [blame] | 322 | #define IMASK_TXFEN 0x00100000 |
wdenk | 9c53f40 | 2003-10-15 23:53:47 +0000 | [diff] [blame] | 323 | #define IMASK_RXFEN0 0x00000080 |
| 324 | |
| 325 | |
| 326 | /* Default Attribute fields */ |
| 327 | #define ATTR_INIT_SETTINGS 0x000000c0 |
| 328 | #define ATTRELI_INIT_SETTINGS 0x00000000 |
| 329 | |
| 330 | |
| 331 | /* TxBD status field bits */ |
| 332 | #define TXBD_READY 0x8000 |
| 333 | #define TXBD_PADCRC 0x4000 |
| 334 | #define TXBD_WRAP 0x2000 |
| 335 | #define TXBD_INTERRUPT 0x1000 |
| 336 | #define TXBD_LAST 0x0800 |
| 337 | #define TXBD_CRC 0x0400 |
| 338 | #define TXBD_DEF 0x0200 |
| 339 | #define TXBD_HUGEFRAME 0x0080 |
| 340 | #define TXBD_LATECOLLISION 0x0080 |
| 341 | #define TXBD_RETRYLIMIT 0x0040 |
| 342 | #define TXBD_RETRYCOUNTMASK 0x003c |
| 343 | #define TXBD_UNDERRUN 0x0002 |
Wolfgang Denk | a1be476 | 2008-05-20 16:00:29 +0200 | [diff] [blame] | 344 | #define TXBD_STATS 0x03ff |
wdenk | 9c53f40 | 2003-10-15 23:53:47 +0000 | [diff] [blame] | 345 | |
| 346 | /* RxBD status field bits */ |
| 347 | #define RXBD_EMPTY 0x8000 |
| 348 | #define RXBD_RO1 0x4000 |
| 349 | #define RXBD_WRAP 0x2000 |
| 350 | #define RXBD_INTERRUPT 0x1000 |
| 351 | #define RXBD_LAST 0x0800 |
| 352 | #define RXBD_FIRST 0x0400 |
| 353 | #define RXBD_MISS 0x0100 |
| 354 | #define RXBD_BROADCAST 0x0080 |
| 355 | #define RXBD_MULTICAST 0x0040 |
| 356 | #define RXBD_LARGE 0x0020 |
| 357 | #define RXBD_NONOCTET 0x0010 |
| 358 | #define RXBD_SHORT 0x0008 |
| 359 | #define RXBD_CRCERR 0x0004 |
| 360 | #define RXBD_OVERRUN 0x0002 |
| 361 | #define RXBD_TRUNCATED 0x0001 |
| 362 | #define RXBD_STATS 0x003f |
| 363 | |
| 364 | typedef struct txbd8 |
| 365 | { |
Wolfgang Denk | a1be476 | 2008-05-20 16:00:29 +0200 | [diff] [blame] | 366 | ushort status; /* Status Fields */ |
| 367 | ushort length; /* Buffer length */ |
| 368 | uint bufPtr; /* Buffer Pointer */ |
wdenk | 9c53f40 | 2003-10-15 23:53:47 +0000 | [diff] [blame] | 369 | } txbd8_t; |
| 370 | |
| 371 | typedef struct rxbd8 |
| 372 | { |
Wolfgang Denk | a1be476 | 2008-05-20 16:00:29 +0200 | [diff] [blame] | 373 | ushort status; /* Status Fields */ |
| 374 | ushort length; /* Buffer Length */ |
| 375 | uint bufPtr; /* Buffer Pointer */ |
wdenk | 9c53f40 | 2003-10-15 23:53:47 +0000 | [diff] [blame] | 376 | } rxbd8_t; |
| 377 | |
| 378 | typedef struct rmon_mib |
| 379 | { |
| 380 | /* Transmit and Receive Counters */ |
| 381 | uint tr64; /* Transmit and Receive 64-byte Frame Counter */ |
| 382 | uint tr127; /* Transmit and Receive 65-127 byte Frame Counter */ |
| 383 | uint tr255; /* Transmit and Receive 128-255 byte Frame Counter */ |
| 384 | uint tr511; /* Transmit and Receive 256-511 byte Frame Counter */ |
| 385 | uint tr1k; /* Transmit and Receive 512-1023 byte Frame Counter */ |
| 386 | uint trmax; /* Transmit and Receive 1024-1518 byte Frame Counter */ |
| 387 | uint trmgv; /* Transmit and Receive 1519-1522 byte Good VLAN Frame */ |
| 388 | /* Receive Counters */ |
| 389 | uint rbyt; /* Receive Byte Counter */ |
| 390 | uint rpkt; /* Receive Packet Counter */ |
| 391 | uint rfcs; /* Receive FCS Error Counter */ |
| 392 | uint rmca; /* Receive Multicast Packet (Counter) */ |
| 393 | uint rbca; /* Receive Broadcast Packet */ |
| 394 | uint rxcf; /* Receive Control Frame Packet */ |
| 395 | uint rxpf; /* Receive Pause Frame Packet */ |
| 396 | uint rxuo; /* Receive Unknown OP Code */ |
| 397 | uint raln; /* Receive Alignment Error */ |
| 398 | uint rflr; /* Receive Frame Length Error */ |
| 399 | uint rcde; /* Receive Code Error */ |
| 400 | uint rcse; /* Receive Carrier Sense Error */ |
| 401 | uint rund; /* Receive Undersize Packet */ |
| 402 | uint rovr; /* Receive Oversize Packet */ |
| 403 | uint rfrg; /* Receive Fragments */ |
| 404 | uint rjbr; /* Receive Jabber */ |
| 405 | uint rdrp; /* Receive Drop */ |
| 406 | /* Transmit Counters */ |
| 407 | uint tbyt; /* Transmit Byte Counter */ |
| 408 | uint tpkt; /* Transmit Packet */ |
| 409 | uint tmca; /* Transmit Multicast Packet */ |
| 410 | uint tbca; /* Transmit Broadcast Packet */ |
| 411 | uint txpf; /* Transmit Pause Control Frame */ |
| 412 | uint tdfr; /* Transmit Deferral Packet */ |
| 413 | uint tedf; /* Transmit Excessive Deferral Packet */ |
| 414 | uint tscl; /* Transmit Single Collision Packet */ |
| 415 | /* (0x2_n700) */ |
| 416 | uint tmcl; /* Transmit Multiple Collision Packet */ |
| 417 | uint tlcl; /* Transmit Late Collision Packet */ |
| 418 | uint txcl; /* Transmit Excessive Collision Packet */ |
| 419 | uint tncl; /* Transmit Total Collision */ |
| 420 | |
| 421 | uint res2; |
| 422 | |
| 423 | uint tdrp; /* Transmit Drop Frame */ |
| 424 | uint tjbr; /* Transmit Jabber Frame */ |
| 425 | uint tfcs; /* Transmit FCS Error */ |
| 426 | uint txcf; /* Transmit Control Frame */ |
| 427 | uint tovr; /* Transmit Oversize Frame */ |
| 428 | uint tund; /* Transmit Undersize Frame */ |
| 429 | uint tfrg; /* Transmit Fragments Frame */ |
| 430 | /* General Registers */ |
| 431 | uint car1; /* Carry Register One */ |
| 432 | uint car2; /* Carry Register Two */ |
| 433 | uint cam1; /* Carry Register One Mask */ |
| 434 | uint cam2; /* Carry Register Two Mask */ |
| 435 | } rmon_mib_t; |
| 436 | |
| 437 | typedef struct tsec_hash_regs |
| 438 | { |
| 439 | uint iaddr0; /* Individual Address Register 0 */ |
| 440 | uint iaddr1; /* Individual Address Register 1 */ |
| 441 | uint iaddr2; /* Individual Address Register 2 */ |
| 442 | uint iaddr3; /* Individual Address Register 3 */ |
| 443 | uint iaddr4; /* Individual Address Register 4 */ |
| 444 | uint iaddr5; /* Individual Address Register 5 */ |
| 445 | uint iaddr6; /* Individual Address Register 6 */ |
| 446 | uint iaddr7; /* Individual Address Register 7 */ |
| 447 | uint res1[24]; |
| 448 | uint gaddr0; /* Group Address Register 0 */ |
| 449 | uint gaddr1; /* Group Address Register 1 */ |
| 450 | uint gaddr2; /* Group Address Register 2 */ |
| 451 | uint gaddr3; /* Group Address Register 3 */ |
| 452 | uint gaddr4; /* Group Address Register 4 */ |
| 453 | uint gaddr5; /* Group Address Register 5 */ |
| 454 | uint gaddr6; /* Group Address Register 6 */ |
| 455 | uint gaddr7; /* Group Address Register 7 */ |
| 456 | uint res2[24]; |
| 457 | } tsec_hash_t; |
| 458 | |
Sandeep Gopalpet | b5541ef | 2009-10-31 00:35:04 +0530 | [diff] [blame] | 459 | typedef struct tsec_mdio { |
Kumar Gala | 2e97293 | 2009-10-31 11:23:41 -0500 | [diff] [blame] | 460 | uint res1[4]; |
| 461 | uint ieventm; |
| 462 | uint imaskm; |
| 463 | uint res2; |
| 464 | uint emapm; |
| 465 | uint res3[320]; |
Sandeep Gopalpet | b5541ef | 2009-10-31 00:35:04 +0530 | [diff] [blame] | 466 | uint miimcfg; /* MII Management: Configuration */ |
| 467 | uint miimcom; /* MII Management: Command */ |
| 468 | uint miimadd; /* MII Management: Address */ |
| 469 | uint miimcon; /* MII Management: Control */ |
| 470 | uint miimstat; /* MII Management: Status */ |
| 471 | uint miimind; /* MII Management: Indicators */ |
Kumar Gala | 2e97293 | 2009-10-31 11:23:41 -0500 | [diff] [blame] | 472 | uint res4[690]; |
Sandeep Gopalpet | b5541ef | 2009-10-31 00:35:04 +0530 | [diff] [blame] | 473 | } tsec_mdio_t; |
| 474 | |
wdenk | 9c53f40 | 2003-10-15 23:53:47 +0000 | [diff] [blame] | 475 | typedef struct tsec |
| 476 | { |
| 477 | /* General Control and Status Registers (0x2_n000) */ |
| 478 | uint res000[4]; |
| 479 | |
| 480 | uint ievent; /* Interrupt Event */ |
| 481 | uint imask; /* Interrupt Mask */ |
| 482 | uint edis; /* Error Disabled */ |
| 483 | uint res01c; |
| 484 | uint ecntrl; /* Ethernet Control */ |
| 485 | uint minflr; /* Minimum Frame Length */ |
| 486 | uint ptv; /* Pause Time Value */ |
| 487 | uint dmactrl; /* DMA Control */ |
| 488 | uint tbipa; /* TBI PHY Address */ |
| 489 | |
| 490 | uint res034[3]; |
| 491 | uint res040[48]; |
| 492 | |
| 493 | /* Transmit Control and Status Registers (0x2_n100) */ |
| 494 | uint tctrl; /* Transmit Control */ |
Wolfgang Denk | a1be476 | 2008-05-20 16:00:29 +0200 | [diff] [blame] | 495 | uint tstat; /* Transmit Status */ |
wdenk | 9c53f40 | 2003-10-15 23:53:47 +0000 | [diff] [blame] | 496 | uint res108; |
| 497 | uint tbdlen; /* Tx BD Data Length */ |
| 498 | uint res110[5]; |
Wolfgang Denk | a1be476 | 2008-05-20 16:00:29 +0200 | [diff] [blame] | 499 | uint ctbptr; /* Current TxBD Pointer */ |
wdenk | 9c53f40 | 2003-10-15 23:53:47 +0000 | [diff] [blame] | 500 | uint res128[23]; |
| 501 | uint tbptr; /* TxBD Pointer */ |
| 502 | uint res188[30]; |
| 503 | /* (0x2_n200) */ |
Wolfgang Denk | a1be476 | 2008-05-20 16:00:29 +0200 | [diff] [blame] | 504 | uint res200; |
wdenk | 9c53f40 | 2003-10-15 23:53:47 +0000 | [diff] [blame] | 505 | uint tbase; /* TxBD Base Address */ |
| 506 | uint res208[42]; |
| 507 | uint ostbd; /* Out of Sequence TxBD */ |
| 508 | uint ostbdp; /* Out of Sequence Tx Data Buffer Pointer */ |
Wolfgang Denk | a1be476 | 2008-05-20 16:00:29 +0200 | [diff] [blame] | 509 | uint res2b8[18]; |
wdenk | 9c53f40 | 2003-10-15 23:53:47 +0000 | [diff] [blame] | 510 | |
| 511 | /* Receive Control and Status Registers (0x2_n300) */ |
| 512 | uint rctrl; /* Receive Control */ |
| 513 | uint rstat; /* Receive Status */ |
| 514 | uint res308; |
| 515 | uint rbdlen; /* RxBD Data Length */ |
| 516 | uint res310[4]; |
Wolfgang Denk | a1be476 | 2008-05-20 16:00:29 +0200 | [diff] [blame] | 517 | uint res320; |
| 518 | uint crbptr; /* Current Receive Buffer Pointer */ |
wdenk | 9c53f40 | 2003-10-15 23:53:47 +0000 | [diff] [blame] | 519 | uint res328[6]; |
Wolfgang Denk | a1be476 | 2008-05-20 16:00:29 +0200 | [diff] [blame] | 520 | uint mrblr; /* Maximum Receive Buffer Length */ |
wdenk | 9c53f40 | 2003-10-15 23:53:47 +0000 | [diff] [blame] | 521 | uint res344[16]; |
Wolfgang Denk | a1be476 | 2008-05-20 16:00:29 +0200 | [diff] [blame] | 522 | uint rbptr; /* RxBD Pointer */ |
| 523 | uint res388[30]; |
wdenk | 9c53f40 | 2003-10-15 23:53:47 +0000 | [diff] [blame] | 524 | /* (0x2_n400) */ |
Wolfgang Denk | a1be476 | 2008-05-20 16:00:29 +0200 | [diff] [blame] | 525 | uint res400; |
| 526 | uint rbase; /* RxBD Base Address */ |
| 527 | uint res408[62]; |
wdenk | 9c53f40 | 2003-10-15 23:53:47 +0000 | [diff] [blame] | 528 | |
| 529 | /* MAC Registers (0x2_n500) */ |
| 530 | uint maccfg1; /* MAC Configuration #1 */ |
| 531 | uint maccfg2; /* MAC Configuration #2 */ |
| 532 | uint ipgifg; /* Inter Packet Gap/Inter Frame Gap */ |
| 533 | uint hafdup; /* Half-duplex */ |
| 534 | uint maxfrm; /* Maximum Frame */ |
| 535 | uint res514; |
| 536 | uint res518; |
| 537 | |
| 538 | uint res51c; |
| 539 | |
Sandeep Gopalpet | b5541ef | 2009-10-31 00:35:04 +0530 | [diff] [blame] | 540 | uint resmdio[6]; |
wdenk | 9c53f40 | 2003-10-15 23:53:47 +0000 | [diff] [blame] | 541 | |
| 542 | uint res538; |
| 543 | |
| 544 | uint ifstat; /* Interface Status */ |
| 545 | uint macstnaddr1; /* Station Address, part 1 */ |
| 546 | uint macstnaddr2; /* Station Address, part 2 */ |
| 547 | uint res548[46]; |
| 548 | |
| 549 | /* (0x2_n600) */ |
| 550 | uint res600[32]; |
| 551 | |
| 552 | /* RMON MIB Registers (0x2_n680-0x2_n73c) */ |
| 553 | rmon_mib_t rmon; |
| 554 | uint res740[48]; |
| 555 | |
| 556 | /* Hash Function Registers (0x2_n800) */ |
| 557 | tsec_hash_t hash; |
| 558 | |
Wolfgang Denk | a1be476 | 2008-05-20 16:00:29 +0200 | [diff] [blame] | 559 | uint res900[128]; |
wdenk | 9c53f40 | 2003-10-15 23:53:47 +0000 | [diff] [blame] | 560 | |
| 561 | /* Pattern Registers (0x2_nb00) */ |
Wolfgang Denk | a1be476 | 2008-05-20 16:00:29 +0200 | [diff] [blame] | 562 | uint resb00[62]; |
| 563 | uint attr; /* Default Attribute Register */ |
| 564 | uint attreli; /* Default Attribute Extract Length and Index */ |
wdenk | 9c53f40 | 2003-10-15 23:53:47 +0000 | [diff] [blame] | 565 | |
| 566 | /* TSEC Future Expansion Space (0x2_nc00-0x2_nffc) */ |
| 567 | uint resc00[256]; |
| 568 | } tsec_t; |
| 569 | |
Jon Loeliger | 77a4f6e | 2005-07-25 14:05:07 -0500 | [diff] [blame] | 570 | #define TSEC_GIGABIT (1) |
| 571 | |
| 572 | /* This flag currently only has |
| 573 | * meaning if we're using the eTSEC */ |
Andy Fleming | ac65e07 | 2008-08-31 16:33:27 -0500 | [diff] [blame] | 574 | #define TSEC_REDUCED (1 << 1) |
| 575 | |
| 576 | #define TSEC_SGMII (1 << 2) |
Jon Loeliger | 77a4f6e | 2005-07-25 14:05:07 -0500 | [diff] [blame] | 577 | |
wdenk | a445ddf | 2004-06-09 00:34:46 +0000 | [diff] [blame] | 578 | struct tsec_private { |
| 579 | volatile tsec_t *regs; |
Sandeep Gopalpet | b5541ef | 2009-10-31 00:35:04 +0530 | [diff] [blame] | 580 | volatile tsec_mdio_t *phyregs; |
| 581 | volatile tsec_mdio_t *phyregs_sgmii; |
wdenk | a445ddf | 2004-06-09 00:34:46 +0000 | [diff] [blame] | 582 | struct phy_info *phyinfo; |
| 583 | uint phyaddr; |
Jon Loeliger | 77a4f6e | 2005-07-25 14:05:07 -0500 | [diff] [blame] | 584 | u32 flags; |
wdenk | a445ddf | 2004-06-09 00:34:46 +0000 | [diff] [blame] | 585 | uint link; |
| 586 | uint duplexity; |
| 587 | uint speed; |
| 588 | }; |
| 589 | |
| 590 | |
| 591 | /* |
| 592 | * struct phy_cmd: A command for reading or writing a PHY register |
| 593 | * |
| 594 | * mii_reg: The register to read or write |
| 595 | * |
| 596 | * mii_data: For writes, the value to put in the register. |
Wolfgang Denk | a1be476 | 2008-05-20 16:00:29 +0200 | [diff] [blame] | 597 | * A value of -1 indicates this is a read. |
wdenk | a445ddf | 2004-06-09 00:34:46 +0000 | [diff] [blame] | 598 | * |
| 599 | * funct: A function pointer which is invoked for each command. |
Wolfgang Denk | a1be476 | 2008-05-20 16:00:29 +0200 | [diff] [blame] | 600 | * For reads, this function will be passed the value read |
wdenk | a445ddf | 2004-06-09 00:34:46 +0000 | [diff] [blame] | 601 | * from the PHY, and process it. |
| 602 | * For writes, the result of this function will be written |
| 603 | * to the PHY register |
| 604 | */ |
| 605 | struct phy_cmd { |
Wolfgang Denk | a1be476 | 2008-05-20 16:00:29 +0200 | [diff] [blame] | 606 | uint mii_reg; |
| 607 | uint mii_data; |
| 608 | uint (*funct) (uint mii_reg, struct tsec_private * priv); |
wdenk | a445ddf | 2004-06-09 00:34:46 +0000 | [diff] [blame] | 609 | }; |
| 610 | |
| 611 | /* struct phy_info: a structure which defines attributes for a PHY |
| 612 | * |
| 613 | * id will contain a number which represents the PHY. During |
| 614 | * startup, the driver will poll the PHY to find out what its |
| 615 | * UID--as defined by registers 2 and 3--is. The 32-bit result |
| 616 | * gotten from the PHY will be shifted right by "shift" bits to |
| 617 | * discard any bits which may change based on revision numbers |
| 618 | * unimportant to functionality |
| 619 | * |
| 620 | * The struct phy_cmd entries represent pointers to an arrays of |
| 621 | * commands which tell the driver what to do to the PHY. |
| 622 | */ |
| 623 | struct phy_info { |
Wolfgang Denk | a1be476 | 2008-05-20 16:00:29 +0200 | [diff] [blame] | 624 | uint id; |
| 625 | char *name; |
| 626 | uint shift; |
| 627 | /* Called to configure the PHY, and modify the controller |
| 628 | * based on the results */ |
| 629 | struct phy_cmd *config; |
wdenk | a445ddf | 2004-06-09 00:34:46 +0000 | [diff] [blame] | 630 | |
Wolfgang Denk | a1be476 | 2008-05-20 16:00:29 +0200 | [diff] [blame] | 631 | /* Called when starting up the controller */ |
| 632 | struct phy_cmd *startup; |
wdenk | a445ddf | 2004-06-09 00:34:46 +0000 | [diff] [blame] | 633 | |
Wolfgang Denk | a1be476 | 2008-05-20 16:00:29 +0200 | [diff] [blame] | 634 | /* Called when bringing down the controller */ |
| 635 | struct phy_cmd *shutdown; |
wdenk | a445ddf | 2004-06-09 00:34:46 +0000 | [diff] [blame] | 636 | }; |
| 637 | |
Andy Fleming | c067fc1 | 2008-08-31 16:33:25 -0500 | [diff] [blame] | 638 | struct tsec_info_struct { |
Andy Fleming | fecff2b | 2008-08-31 16:33:26 -0500 | [diff] [blame] | 639 | tsec_t *regs; |
Sandeep Gopalpet | b5541ef | 2009-10-31 00:35:04 +0530 | [diff] [blame] | 640 | tsec_mdio_t *miiregs; |
| 641 | tsec_mdio_t *miiregs_sgmii; |
Andy Fleming | fecff2b | 2008-08-31 16:33:26 -0500 | [diff] [blame] | 642 | char *devname; |
Andy Fleming | c067fc1 | 2008-08-31 16:33:25 -0500 | [diff] [blame] | 643 | unsigned int phyaddr; |
| 644 | u32 flags; |
Andy Fleming | c067fc1 | 2008-08-31 16:33:25 -0500 | [diff] [blame] | 645 | }; |
| 646 | |
Andy Fleming | fecff2b | 2008-08-31 16:33:26 -0500 | [diff] [blame] | 647 | int tsec_initialize(bd_t * bis, struct tsec_info_struct *tsec_info); |
| 648 | int tsec_standard_init(bd_t *bis); |
| 649 | int tsec_eth_init(bd_t *bis, struct tsec_info_struct *tsec_info, int num); |
| 650 | |
wdenk | 9c53f40 | 2003-10-15 23:53:47 +0000 | [diff] [blame] | 651 | #endif /* __TSEC_H */ |