tsec.h 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563
  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. *
  10. * Copyright 2004, 2007 Freescale Semiconductor, Inc.
  11. * (C) Copyright 2003, Motorola, Inc.
  12. * maintained by Xianghua Xiao (x.xiao@motorola.com)
  13. * author Andy Fleming
  14. *
  15. */
  16. #ifndef __TSEC_H
  17. #define __TSEC_H
  18. #include <net.h>
  19. #include <config.h>
  20. #ifndef CFG_TSEC1_OFFSET
  21. #define CFG_TSEC1_OFFSET (0x24000)
  22. #endif
  23. #define TSEC_SIZE 0x01000
  24. /* FIXME: Should these be pushed back to 83xx and 85xx config files? */
  25. #if defined(CONFIG_MPC85xx) || defined(CONFIG_MPC86xx)
  26. #define TSEC_BASE_ADDR (CFG_IMMR + CFG_TSEC1_OFFSET)
  27. #elif defined(CONFIG_MPC83XX)
  28. #define TSEC_BASE_ADDR (CFG_IMMR + CFG_TSEC1_OFFSET)
  29. #endif
  30. #define MAC_ADDR_LEN 6
  31. /* #define TSEC_TIMEOUT 1000000 */
  32. #define TSEC_TIMEOUT 1000
  33. #define TOUT_LOOP 1000000
  34. #define PHY_AUTONEGOTIATE_TIMEOUT 5000 /* in ms */
  35. /* MAC register bits */
  36. #define MACCFG1_SOFT_RESET 0x80000000
  37. #define MACCFG1_RESET_RX_MC 0x00080000
  38. #define MACCFG1_RESET_TX_MC 0x00040000
  39. #define MACCFG1_RESET_RX_FUN 0x00020000
  40. #define MACCFG1_RESET_TX_FUN 0x00010000
  41. #define MACCFG1_LOOPBACK 0x00000100
  42. #define MACCFG1_RX_FLOW 0x00000020
  43. #define MACCFG1_TX_FLOW 0x00000010
  44. #define MACCFG1_SYNCD_RX_EN 0x00000008
  45. #define MACCFG1_RX_EN 0x00000004
  46. #define MACCFG1_SYNCD_TX_EN 0x00000002
  47. #define MACCFG1_TX_EN 0x00000001
  48. #define MACCFG2_INIT_SETTINGS 0x00007205
  49. #define MACCFG2_FULL_DUPLEX 0x00000001
  50. #define MACCFG2_IF 0x00000300
  51. #define MACCFG2_GMII 0x00000200
  52. #define MACCFG2_MII 0x00000100
  53. #define ECNTRL_INIT_SETTINGS 0x00001000
  54. #define ECNTRL_TBI_MODE 0x00000020
  55. #define ECNTRL_R100 0x00000008
  56. #define ECNTRL_SGMII_MODE 0x00000002
  57. #define miim_end -2
  58. #define miim_read -1
  59. #ifndef CFG_TBIPA_VALUE
  60. #define CFG_TBIPA_VALUE 0x1f
  61. #endif
  62. #define MIIMCFG_INIT_VALUE 0x00000003
  63. #define MIIMCFG_RESET 0x80000000
  64. #define MIIMIND_BUSY 0x00000001
  65. #define MIIMIND_NOTVALID 0x00000004
  66. #define MIIM_CONTROL 0x00
  67. #define MIIM_CONTROL_RESET 0x00009140
  68. #define MIIM_CONTROL_INIT 0x00001140
  69. #define MIIM_CONTROL_RESTART 0x00001340
  70. #define MIIM_ANEN 0x00001000
  71. #define MIIM_CR 0x00
  72. #define MIIM_CR_RST 0x00008000
  73. #define MIIM_CR_INIT 0x00001000
  74. #define MIIM_STATUS 0x1
  75. #define MIIM_STATUS_AN_DONE 0x00000020
  76. #define MIIM_STATUS_LINK 0x0004
  77. #define PHY_BMSR_AUTN_ABLE 0x0008
  78. #define PHY_BMSR_AUTN_COMP 0x0020
  79. #define MIIM_PHYIR1 0x2
  80. #define MIIM_PHYIR2 0x3
  81. #define MIIM_ANAR 0x4
  82. #define MIIM_ANAR_INIT 0x1e1
  83. #define MIIM_TBI_ANLPBPA 0x5
  84. #define MIIM_TBI_ANLPBPA_HALF 0x00000040
  85. #define MIIM_TBI_ANLPBPA_FULL 0x00000020
  86. #define MIIM_TBI_ANEX 0x6
  87. #define MIIM_TBI_ANEX_NP 0x00000004
  88. #define MIIM_TBI_ANEX_PRX 0x00000002
  89. #define MIIM_GBIT_CONTROL 0x9
  90. #define MIIM_GBIT_CONTROL_INIT 0xe00
  91. /* Broadcom BCM54xx -- taken from linux sungem_phy */
  92. #define MIIM_BCM54xx_AUXSTATUS 0x19
  93. #define MIIM_BCM54xx_AUXSTATUS_LINKMODE_MASK 0x0700
  94. #define MIIM_BCM54xx_AUXSTATUS_LINKMODE_SHIFT 8
  95. /* Cicada Auxiliary Control/Status Register */
  96. #define MIIM_CIS8201_AUX_CONSTAT 0x1c
  97. #define MIIM_CIS8201_AUXCONSTAT_INIT 0x0004
  98. #define MIIM_CIS8201_AUXCONSTAT_DUPLEX 0x0020
  99. #define MIIM_CIS8201_AUXCONSTAT_SPEED 0x0018
  100. #define MIIM_CIS8201_AUXCONSTAT_GBIT 0x0010
  101. #define MIIM_CIS8201_AUXCONSTAT_100 0x0008
  102. /* Cicada Extended Control Register 1 */
  103. #define MIIM_CIS8201_EXT_CON1 0x17
  104. #define MIIM_CIS8201_EXTCON1_INIT 0x0000
  105. /* Cicada 8204 Extended PHY Control Register 1 */
  106. #define MIIM_CIS8204_EPHY_CON 0x17
  107. #define MIIM_CIS8204_EPHYCON_INIT 0x0006
  108. #define MIIM_CIS8204_EPHYCON_RGMII 0x1100
  109. /* Cicada 8204 Serial LED Control Register */
  110. #define MIIM_CIS8204_SLED_CON 0x1b
  111. #define MIIM_CIS8204_SLEDCON_INIT 0x1115
  112. #define MIIM_GBIT_CON 0x09
  113. #define MIIM_GBIT_CON_ADVERT 0x0e00
  114. /* Entry for Vitesse VSC8244 regs starts here */
  115. /* Vitesse VSC8244 Auxiliary Control/Status Register */
  116. #define MIIM_VSC8244_AUX_CONSTAT 0x1c
  117. #define MIIM_VSC8244_AUXCONSTAT_INIT 0x0000
  118. #define MIIM_VSC8244_AUXCONSTAT_DUPLEX 0x0020
  119. #define MIIM_VSC8244_AUXCONSTAT_SPEED 0x0018
  120. #define MIIM_VSC8244_AUXCONSTAT_GBIT 0x0010
  121. #define MIIM_VSC8244_AUXCONSTAT_100 0x0008
  122. #define MIIM_CONTROL_INIT_LOOPBACK 0x4000
  123. /* Vitesse VSC8244 Extended PHY Control Register 1 */
  124. #define MIIM_VSC8244_EPHY_CON 0x17
  125. #define MIIM_VSC8244_EPHYCON_INIT 0x0006
  126. /* Vitesse VSC8244 Serial LED Control Register */
  127. #define MIIM_VSC8244_LED_CON 0x1b
  128. #define MIIM_VSC8244_LEDCON_INIT 0xF011
  129. /* 88E1011 PHY Status Register */
  130. #define MIIM_88E1011_PHY_STATUS 0x11
  131. #define MIIM_88E1011_PHYSTAT_SPEED 0xc000
  132. #define MIIM_88E1011_PHYSTAT_GBIT 0x8000
  133. #define MIIM_88E1011_PHYSTAT_100 0x4000
  134. #define MIIM_88E1011_PHYSTAT_DUPLEX 0x2000
  135. #define MIIM_88E1011_PHYSTAT_SPDDONE 0x0800
  136. #define MIIM_88E1011_PHYSTAT_LINK 0x0400
  137. #define MIIM_88E1011_PHY_SCR 0x10
  138. #define MIIM_88E1011_PHY_MDI_X_AUTO 0x0060
  139. /* 88E1111 PHY LED Control Register */
  140. #define MIIM_88E1111_PHY_LED_CONTROL 24
  141. #define MIIM_88E1111_PHY_LED_DIRECT 0x4100
  142. #define MIIM_88E1111_PHY_LED_COMBINE 0x411C
  143. /* 88E1145 Extended PHY Specific Control Register */
  144. #define MIIM_88E1145_PHY_EXT_CR 20
  145. #define MIIM_M88E1145_RGMII_RX_DELAY 0x0080
  146. #define MIIM_M88E1145_RGMII_TX_DELAY 0x0002
  147. #define MIIM_88E1145_PHY_PAGE 29
  148. #define MIIM_88E1145_PHY_CAL_OV 30
  149. /* DM9161 Control register values */
  150. #define MIIM_DM9161_CR_STOP 0x0400
  151. #define MIIM_DM9161_CR_RSTAN 0x1200
  152. #define MIIM_DM9161_SCR 0x10
  153. #define MIIM_DM9161_SCR_INIT 0x0610
  154. /* DM9161 Specified Configuration and Status Register */
  155. #define MIIM_DM9161_SCSR 0x11
  156. #define MIIM_DM9161_SCSR_100F 0x8000
  157. #define MIIM_DM9161_SCSR_100H 0x4000
  158. #define MIIM_DM9161_SCSR_10F 0x2000
  159. #define MIIM_DM9161_SCSR_10H 0x1000
  160. /* DM9161 10BT Configuration/Status */
  161. #define MIIM_DM9161_10BTCSR 0x12
  162. #define MIIM_DM9161_10BTCSR_INIT 0x7800
  163. /* LXT971 Status 2 registers */
  164. #define MIIM_LXT971_SR2 0x11 /* Status Register 2 */
  165. #define MIIM_LXT971_SR2_SPEED_MASK 0x4200
  166. #define MIIM_LXT971_SR2_10HDX 0x0000 /* 10 Mbit half duplex selected */
  167. #define MIIM_LXT971_SR2_10FDX 0x0200 /* 10 Mbit full duplex selected */
  168. #define MIIM_LXT971_SR2_100HDX 0x4000 /* 100 Mbit half duplex selected */
  169. #define MIIM_LXT971_SR2_100FDX 0x4200 /* 100 Mbit full duplex selected */
  170. /* DP83865 Control register values */
  171. #define MIIM_DP83865_CR_INIT 0x9200
  172. /* DP83865 Link and Auto-Neg Status Register */
  173. #define MIIM_DP83865_LANR 0x11
  174. #define MIIM_DP83865_SPD_MASK 0x0018
  175. #define MIIM_DP83865_SPD_1000 0x0010
  176. #define MIIM_DP83865_SPD_100 0x0008
  177. #define MIIM_DP83865_DPX_FULL 0x0002
  178. #define MIIM_READ_COMMAND 0x00000001
  179. #define MRBLR_INIT_SETTINGS PKTSIZE_ALIGN
  180. #define MINFLR_INIT_SETTINGS 0x00000040
  181. #define DMACTRL_INIT_SETTINGS 0x000000c3
  182. #define DMACTRL_GRS 0x00000010
  183. #define DMACTRL_GTS 0x00000008
  184. #define TSTAT_CLEAR_THALT 0x80000000
  185. #define RSTAT_CLEAR_RHALT 0x00800000
  186. #define IEVENT_INIT_CLEAR 0xffffffff
  187. #define IEVENT_BABR 0x80000000
  188. #define IEVENT_RXC 0x40000000
  189. #define IEVENT_BSY 0x20000000
  190. #define IEVENT_EBERR 0x10000000
  191. #define IEVENT_MSRO 0x04000000
  192. #define IEVENT_GTSC 0x02000000
  193. #define IEVENT_BABT 0x01000000
  194. #define IEVENT_TXC 0x00800000
  195. #define IEVENT_TXE 0x00400000
  196. #define IEVENT_TXB 0x00200000
  197. #define IEVENT_TXF 0x00100000
  198. #define IEVENT_IE 0x00080000
  199. #define IEVENT_LC 0x00040000
  200. #define IEVENT_CRL 0x00020000
  201. #define IEVENT_XFUN 0x00010000
  202. #define IEVENT_RXB0 0x00008000
  203. #define IEVENT_GRSC 0x00000100
  204. #define IEVENT_RXF0 0x00000080
  205. #define IMASK_INIT_CLEAR 0x00000000
  206. #define IMASK_TXEEN 0x00400000
  207. #define IMASK_TXBEN 0x00200000
  208. #define IMASK_TXFEN 0x00100000
  209. #define IMASK_RXFEN0 0x00000080
  210. /* Default Attribute fields */
  211. #define ATTR_INIT_SETTINGS 0x000000c0
  212. #define ATTRELI_INIT_SETTINGS 0x00000000
  213. /* TxBD status field bits */
  214. #define TXBD_READY 0x8000
  215. #define TXBD_PADCRC 0x4000
  216. #define TXBD_WRAP 0x2000
  217. #define TXBD_INTERRUPT 0x1000
  218. #define TXBD_LAST 0x0800
  219. #define TXBD_CRC 0x0400
  220. #define TXBD_DEF 0x0200
  221. #define TXBD_HUGEFRAME 0x0080
  222. #define TXBD_LATECOLLISION 0x0080
  223. #define TXBD_RETRYLIMIT 0x0040
  224. #define TXBD_RETRYCOUNTMASK 0x003c
  225. #define TXBD_UNDERRUN 0x0002
  226. #define TXBD_STATS 0x03ff
  227. /* RxBD status field bits */
  228. #define RXBD_EMPTY 0x8000
  229. #define RXBD_RO1 0x4000
  230. #define RXBD_WRAP 0x2000
  231. #define RXBD_INTERRUPT 0x1000
  232. #define RXBD_LAST 0x0800
  233. #define RXBD_FIRST 0x0400
  234. #define RXBD_MISS 0x0100
  235. #define RXBD_BROADCAST 0x0080
  236. #define RXBD_MULTICAST 0x0040
  237. #define RXBD_LARGE 0x0020
  238. #define RXBD_NONOCTET 0x0010
  239. #define RXBD_SHORT 0x0008
  240. #define RXBD_CRCERR 0x0004
  241. #define RXBD_OVERRUN 0x0002
  242. #define RXBD_TRUNCATED 0x0001
  243. #define RXBD_STATS 0x003f
  244. typedef struct txbd8
  245. {
  246. ushort status; /* Status Fields */
  247. ushort length; /* Buffer length */
  248. uint bufPtr; /* Buffer Pointer */
  249. } txbd8_t;
  250. typedef struct rxbd8
  251. {
  252. ushort status; /* Status Fields */
  253. ushort length; /* Buffer Length */
  254. uint bufPtr; /* Buffer Pointer */
  255. } rxbd8_t;
  256. typedef struct rmon_mib
  257. {
  258. /* Transmit and Receive Counters */
  259. uint tr64; /* Transmit and Receive 64-byte Frame Counter */
  260. uint tr127; /* Transmit and Receive 65-127 byte Frame Counter */
  261. uint tr255; /* Transmit and Receive 128-255 byte Frame Counter */
  262. uint tr511; /* Transmit and Receive 256-511 byte Frame Counter */
  263. uint tr1k; /* Transmit and Receive 512-1023 byte Frame Counter */
  264. uint trmax; /* Transmit and Receive 1024-1518 byte Frame Counter */
  265. uint trmgv; /* Transmit and Receive 1519-1522 byte Good VLAN Frame */
  266. /* Receive Counters */
  267. uint rbyt; /* Receive Byte Counter */
  268. uint rpkt; /* Receive Packet Counter */
  269. uint rfcs; /* Receive FCS Error Counter */
  270. uint rmca; /* Receive Multicast Packet (Counter) */
  271. uint rbca; /* Receive Broadcast Packet */
  272. uint rxcf; /* Receive Control Frame Packet */
  273. uint rxpf; /* Receive Pause Frame Packet */
  274. uint rxuo; /* Receive Unknown OP Code */
  275. uint raln; /* Receive Alignment Error */
  276. uint rflr; /* Receive Frame Length Error */
  277. uint rcde; /* Receive Code Error */
  278. uint rcse; /* Receive Carrier Sense Error */
  279. uint rund; /* Receive Undersize Packet */
  280. uint rovr; /* Receive Oversize Packet */
  281. uint rfrg; /* Receive Fragments */
  282. uint rjbr; /* Receive Jabber */
  283. uint rdrp; /* Receive Drop */
  284. /* Transmit Counters */
  285. uint tbyt; /* Transmit Byte Counter */
  286. uint tpkt; /* Transmit Packet */
  287. uint tmca; /* Transmit Multicast Packet */
  288. uint tbca; /* Transmit Broadcast Packet */
  289. uint txpf; /* Transmit Pause Control Frame */
  290. uint tdfr; /* Transmit Deferral Packet */
  291. uint tedf; /* Transmit Excessive Deferral Packet */
  292. uint tscl; /* Transmit Single Collision Packet */
  293. /* (0x2_n700) */
  294. uint tmcl; /* Transmit Multiple Collision Packet */
  295. uint tlcl; /* Transmit Late Collision Packet */
  296. uint txcl; /* Transmit Excessive Collision Packet */
  297. uint tncl; /* Transmit Total Collision */
  298. uint res2;
  299. uint tdrp; /* Transmit Drop Frame */
  300. uint tjbr; /* Transmit Jabber Frame */
  301. uint tfcs; /* Transmit FCS Error */
  302. uint txcf; /* Transmit Control Frame */
  303. uint tovr; /* Transmit Oversize Frame */
  304. uint tund; /* Transmit Undersize Frame */
  305. uint tfrg; /* Transmit Fragments Frame */
  306. /* General Registers */
  307. uint car1; /* Carry Register One */
  308. uint car2; /* Carry Register Two */
  309. uint cam1; /* Carry Register One Mask */
  310. uint cam2; /* Carry Register Two Mask */
  311. } rmon_mib_t;
  312. typedef struct tsec_hash_regs
  313. {
  314. uint iaddr0; /* Individual Address Register 0 */
  315. uint iaddr1; /* Individual Address Register 1 */
  316. uint iaddr2; /* Individual Address Register 2 */
  317. uint iaddr3; /* Individual Address Register 3 */
  318. uint iaddr4; /* Individual Address Register 4 */
  319. uint iaddr5; /* Individual Address Register 5 */
  320. uint iaddr6; /* Individual Address Register 6 */
  321. uint iaddr7; /* Individual Address Register 7 */
  322. uint res1[24];
  323. uint gaddr0; /* Group Address Register 0 */
  324. uint gaddr1; /* Group Address Register 1 */
  325. uint gaddr2; /* Group Address Register 2 */
  326. uint gaddr3; /* Group Address Register 3 */
  327. uint gaddr4; /* Group Address Register 4 */
  328. uint gaddr5; /* Group Address Register 5 */
  329. uint gaddr6; /* Group Address Register 6 */
  330. uint gaddr7; /* Group Address Register 7 */
  331. uint res2[24];
  332. } tsec_hash_t;
  333. typedef struct tsec
  334. {
  335. /* General Control and Status Registers (0x2_n000) */
  336. uint res000[4];
  337. uint ievent; /* Interrupt Event */
  338. uint imask; /* Interrupt Mask */
  339. uint edis; /* Error Disabled */
  340. uint res01c;
  341. uint ecntrl; /* Ethernet Control */
  342. uint minflr; /* Minimum Frame Length */
  343. uint ptv; /* Pause Time Value */
  344. uint dmactrl; /* DMA Control */
  345. uint tbipa; /* TBI PHY Address */
  346. uint res034[3];
  347. uint res040[48];
  348. /* Transmit Control and Status Registers (0x2_n100) */
  349. uint tctrl; /* Transmit Control */
  350. uint tstat; /* Transmit Status */
  351. uint res108;
  352. uint tbdlen; /* Tx BD Data Length */
  353. uint res110[5];
  354. uint ctbptr; /* Current TxBD Pointer */
  355. uint res128[23];
  356. uint tbptr; /* TxBD Pointer */
  357. uint res188[30];
  358. /* (0x2_n200) */
  359. uint res200;
  360. uint tbase; /* TxBD Base Address */
  361. uint res208[42];
  362. uint ostbd; /* Out of Sequence TxBD */
  363. uint ostbdp; /* Out of Sequence Tx Data Buffer Pointer */
  364. uint res2b8[18];
  365. /* Receive Control and Status Registers (0x2_n300) */
  366. uint rctrl; /* Receive Control */
  367. uint rstat; /* Receive Status */
  368. uint res308;
  369. uint rbdlen; /* RxBD Data Length */
  370. uint res310[4];
  371. uint res320;
  372. uint crbptr; /* Current Receive Buffer Pointer */
  373. uint res328[6];
  374. uint mrblr; /* Maximum Receive Buffer Length */
  375. uint res344[16];
  376. uint rbptr; /* RxBD Pointer */
  377. uint res388[30];
  378. /* (0x2_n400) */
  379. uint res400;
  380. uint rbase; /* RxBD Base Address */
  381. uint res408[62];
  382. /* MAC Registers (0x2_n500) */
  383. uint maccfg1; /* MAC Configuration #1 */
  384. uint maccfg2; /* MAC Configuration #2 */
  385. uint ipgifg; /* Inter Packet Gap/Inter Frame Gap */
  386. uint hafdup; /* Half-duplex */
  387. uint maxfrm; /* Maximum Frame */
  388. uint res514;
  389. uint res518;
  390. uint res51c;
  391. uint miimcfg; /* MII Management: Configuration */
  392. uint miimcom; /* MII Management: Command */
  393. uint miimadd; /* MII Management: Address */
  394. uint miimcon; /* MII Management: Control */
  395. uint miimstat; /* MII Management: Status */
  396. uint miimind; /* MII Management: Indicators */
  397. uint res538;
  398. uint ifstat; /* Interface Status */
  399. uint macstnaddr1; /* Station Address, part 1 */
  400. uint macstnaddr2; /* Station Address, part 2 */
  401. uint res548[46];
  402. /* (0x2_n600) */
  403. uint res600[32];
  404. /* RMON MIB Registers (0x2_n680-0x2_n73c) */
  405. rmon_mib_t rmon;
  406. uint res740[48];
  407. /* Hash Function Registers (0x2_n800) */
  408. tsec_hash_t hash;
  409. uint res900[128];
  410. /* Pattern Registers (0x2_nb00) */
  411. uint resb00[62];
  412. uint attr; /* Default Attribute Register */
  413. uint attreli; /* Default Attribute Extract Length and Index */
  414. /* TSEC Future Expansion Space (0x2_nc00-0x2_nffc) */
  415. uint resc00[256];
  416. } tsec_t;
  417. #define TSEC_GIGABIT (1)
  418. /* This flag currently only has
  419. * meaning if we're using the eTSEC */
  420. #define TSEC_REDUCED (1 << 1)
  421. struct tsec_private {
  422. volatile tsec_t *regs;
  423. volatile tsec_t *phyregs;
  424. struct phy_info *phyinfo;
  425. uint phyaddr;
  426. u32 flags;
  427. uint link;
  428. uint duplexity;
  429. uint speed;
  430. };
  431. /*
  432. * struct phy_cmd: A command for reading or writing a PHY register
  433. *
  434. * mii_reg: The register to read or write
  435. *
  436. * mii_data: For writes, the value to put in the register.
  437. * A value of -1 indicates this is a read.
  438. *
  439. * funct: A function pointer which is invoked for each command.
  440. * For reads, this function will be passed the value read
  441. * from the PHY, and process it.
  442. * For writes, the result of this function will be written
  443. * to the PHY register
  444. */
  445. struct phy_cmd {
  446. uint mii_reg;
  447. uint mii_data;
  448. uint (*funct) (uint mii_reg, struct tsec_private* priv);
  449. };
  450. /* struct phy_info: a structure which defines attributes for a PHY
  451. *
  452. * id will contain a number which represents the PHY. During
  453. * startup, the driver will poll the PHY to find out what its
  454. * UID--as defined by registers 2 and 3--is. The 32-bit result
  455. * gotten from the PHY will be shifted right by "shift" bits to
  456. * discard any bits which may change based on revision numbers
  457. * unimportant to functionality
  458. *
  459. * The struct phy_cmd entries represent pointers to an arrays of
  460. * commands which tell the driver what to do to the PHY.
  461. */
  462. struct phy_info {
  463. uint id;
  464. char *name;
  465. uint shift;
  466. /* Called to configure the PHY, and modify the controller
  467. * based on the results */
  468. struct phy_cmd *config;
  469. /* Called when starting up the controller */
  470. struct phy_cmd *startup;
  471. /* Called when bringing down the controller */
  472. struct phy_cmd *shutdown;
  473. };
  474. #endif /* __TSEC_H */