sh_eth.h 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569
  1. /* SuperH Ethernet device driver
  2. *
  3. * Copyright (C) 2006-2012 Nobuhiro Iwamatsu
  4. * Copyright (C) 2008-2012 Renesas Solutions Corp.
  5. *
  6. * This program is free software; you can redistribute it and/or modify it
  7. * under the terms and conditions of the GNU General Public License,
  8. * version 2, as published by the Free Software Foundation.
  9. *
  10. * This program is distributed in the hope it will be useful, but WITHOUT
  11. * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  12. * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
  13. * more details.
  14. *
  15. * The full GNU General Public License is included in this distribution in
  16. * the file called "COPYING".
  17. */
  18. #ifndef __SH_ETH_H__
  19. #define __SH_ETH_H__
  20. #define CARDNAME "sh-eth"
  21. #define TX_TIMEOUT (5*HZ)
  22. #define TX_RING_SIZE 64 /* Tx ring size */
  23. #define RX_RING_SIZE 64 /* Rx ring size */
  24. #define TX_RING_MIN 64
  25. #define RX_RING_MIN 64
  26. #define TX_RING_MAX 1024
  27. #define RX_RING_MAX 1024
  28. #define PKT_BUF_SZ 1538
  29. #define SH_ETH_TSU_TIMEOUT_MS 500
  30. #define SH_ETH_TSU_CAM_ENTRIES 32
  31. enum {
  32. /* IMPORTANT: To keep ethtool register dump working, add new
  33. * register names immediately before SH_ETH_MAX_REGISTER_OFFSET.
  34. */
  35. /* E-DMAC registers */
  36. EDSR = 0,
  37. EDMR,
  38. EDTRR,
  39. EDRRR,
  40. EESR,
  41. EESIPR,
  42. TDLAR,
  43. TDFAR,
  44. TDFXR,
  45. TDFFR,
  46. RDLAR,
  47. RDFAR,
  48. RDFXR,
  49. RDFFR,
  50. TRSCER,
  51. RMFCR,
  52. TFTR,
  53. FDR,
  54. RMCR,
  55. EDOCR,
  56. TFUCR,
  57. RFOCR,
  58. RMIIMODE,
  59. FCFTR,
  60. RPADIR,
  61. TRIMD,
  62. RBWAR,
  63. TBRAR,
  64. /* Ether registers */
  65. ECMR,
  66. ECSR,
  67. ECSIPR,
  68. PIR,
  69. PSR,
  70. RDMLR,
  71. PIPR,
  72. RFLR,
  73. IPGR,
  74. APR,
  75. MPR,
  76. PFTCR,
  77. PFRCR,
  78. RFCR,
  79. RFCF,
  80. TPAUSER,
  81. TPAUSECR,
  82. BCFR,
  83. BCFRR,
  84. GECMR,
  85. BCULR,
  86. MAHR,
  87. MALR,
  88. TROCR,
  89. CDCR,
  90. LCCR,
  91. CNDCR,
  92. CEFCR,
  93. FRECR,
  94. TSFRCR,
  95. TLFRCR,
  96. CERCR,
  97. CEECR,
  98. MAFCR,
  99. RTRATE,
  100. CSMR,
  101. RMII_MII,
  102. /* TSU Absolute address */
  103. ARSTR,
  104. TSU_CTRST,
  105. TSU_FWEN0,
  106. TSU_FWEN1,
  107. TSU_FCM,
  108. TSU_BSYSL0,
  109. TSU_BSYSL1,
  110. TSU_PRISL0,
  111. TSU_PRISL1,
  112. TSU_FWSL0,
  113. TSU_FWSL1,
  114. TSU_FWSLC,
  115. TSU_QTAG0, /* Same as TSU_QTAGM0 */
  116. TSU_QTAG1, /* Same as TSU_QTAGM1 */
  117. TSU_QTAGM0,
  118. TSU_QTAGM1,
  119. TSU_FWSR,
  120. TSU_FWINMK,
  121. TSU_ADQT0,
  122. TSU_ADQT1,
  123. TSU_VTAG0,
  124. TSU_VTAG1,
  125. TSU_ADSBSY,
  126. TSU_TEN,
  127. TSU_POST1,
  128. TSU_POST2,
  129. TSU_POST3,
  130. TSU_POST4,
  131. TSU_ADRH0,
  132. /* TSU_ADR{H,L}{0..31} are assumed to be contiguous */
  133. TXNLCR0,
  134. TXALCR0,
  135. RXNLCR0,
  136. RXALCR0,
  137. FWNLCR0,
  138. FWALCR0,
  139. TXNLCR1,
  140. TXALCR1,
  141. RXNLCR1,
  142. RXALCR1,
  143. FWNLCR1,
  144. FWALCR1,
  145. /* This value must be written at last. */
  146. SH_ETH_MAX_REGISTER_OFFSET,
  147. };
  148. enum {
  149. SH_ETH_REG_GIGABIT,
  150. SH_ETH_REG_FAST_RZ,
  151. SH_ETH_REG_FAST_RCAR,
  152. SH_ETH_REG_FAST_SH4,
  153. SH_ETH_REG_FAST_SH3_SH2
  154. };
  155. /* Driver's parameters */
  156. #if defined(CONFIG_CPU_SH4) || defined(CONFIG_ARCH_RENESAS)
  157. #define SH_ETH_RX_ALIGN 32
  158. #else
  159. #define SH_ETH_RX_ALIGN 2
  160. #endif
  161. /* Register's bits
  162. */
  163. /* EDSR : sh7734, sh7757, sh7763, r8a7740, and r7s72100 only */
  164. enum EDSR_BIT {
  165. EDSR_ENT = 0x01, EDSR_ENR = 0x02,
  166. };
  167. #define EDSR_ENALL (EDSR_ENT|EDSR_ENR)
  168. /* GECMR : sh7734, sh7763 and r8a7740 only */
  169. enum GECMR_BIT {
  170. GECMR_10 = 0x0, GECMR_100 = 0x04, GECMR_1000 = 0x01,
  171. };
  172. /* EDMR */
  173. enum DMAC_M_BIT {
  174. EDMR_NBST = 0x80,
  175. EDMR_EL = 0x40, /* Litte endian */
  176. EDMR_DL1 = 0x20, EDMR_DL0 = 0x10,
  177. EDMR_SRST_GETHER = 0x03,
  178. EDMR_SRST_ETHER = 0x01,
  179. };
  180. /* EDTRR */
  181. enum DMAC_T_BIT {
  182. EDTRR_TRNS_GETHER = 0x03,
  183. EDTRR_TRNS_ETHER = 0x01,
  184. };
  185. /* EDRRR */
  186. enum EDRRR_R_BIT {
  187. EDRRR_R = 0x01,
  188. };
  189. /* TPAUSER */
  190. enum TPAUSER_BIT {
  191. TPAUSER_TPAUSE = 0x0000ffff,
  192. TPAUSER_UNLIMITED = 0,
  193. };
  194. /* BCFR */
  195. enum BCFR_BIT {
  196. BCFR_RPAUSE = 0x0000ffff,
  197. BCFR_UNLIMITED = 0,
  198. };
  199. /* PIR */
  200. enum PIR_BIT {
  201. PIR_MDI = 0x08, PIR_MDO = 0x04, PIR_MMD = 0x02, PIR_MDC = 0x01,
  202. };
  203. /* PSR */
  204. enum PHY_STATUS_BIT { PHY_ST_LINK = 0x01, };
  205. /* EESR */
  206. enum EESR_BIT {
  207. EESR_TWB1 = 0x80000000,
  208. EESR_TWB = 0x40000000, /* same as TWB0 */
  209. EESR_TC1 = 0x20000000,
  210. EESR_TUC = 0x10000000,
  211. EESR_ROC = 0x08000000,
  212. EESR_TABT = 0x04000000,
  213. EESR_RABT = 0x02000000,
  214. EESR_RFRMER = 0x01000000, /* same as RFCOF */
  215. EESR_ADE = 0x00800000,
  216. EESR_ECI = 0x00400000,
  217. EESR_FTC = 0x00200000, /* same as TC or TC0 */
  218. EESR_TDE = 0x00100000,
  219. EESR_TFE = 0x00080000, /* same as TFUF */
  220. EESR_FRC = 0x00040000, /* same as FR */
  221. EESR_RDE = 0x00020000,
  222. EESR_RFE = 0x00010000,
  223. EESR_CND = 0x00000800,
  224. EESR_DLC = 0x00000400,
  225. EESR_CD = 0x00000200,
  226. EESR_TRO = 0x00000100,
  227. EESR_RMAF = 0x00000080,
  228. EESR_CEEF = 0x00000040,
  229. EESR_CELF = 0x00000020,
  230. EESR_RRF = 0x00000010,
  231. EESR_RTLF = 0x00000008,
  232. EESR_RTSF = 0x00000004,
  233. EESR_PRE = 0x00000002,
  234. EESR_CERF = 0x00000001,
  235. };
  236. #define EESR_RX_CHECK (EESR_FRC | /* Frame recv */ \
  237. EESR_RMAF | /* Multicast address recv */ \
  238. EESR_RRF | /* Bit frame recv */ \
  239. EESR_RTLF | /* Long frame recv */ \
  240. EESR_RTSF | /* Short frame recv */ \
  241. EESR_PRE | /* PHY-LSI recv error */ \
  242. EESR_CERF) /* Recv frame CRC error */
  243. #define DEFAULT_TX_CHECK (EESR_FTC | EESR_CND | EESR_DLC | EESR_CD | \
  244. EESR_TRO)
  245. #define DEFAULT_EESR_ERR_CHECK (EESR_TWB | EESR_TABT | EESR_RABT | EESR_RFE | \
  246. EESR_RDE | EESR_RFRMER | EESR_ADE | \
  247. EESR_TFE | EESR_TDE)
  248. /* EESIPR */
  249. enum EESIPR_BIT {
  250. EESIPR_TWB1IP = 0x80000000,
  251. EESIPR_TWBIP = 0x40000000, /* same as TWB0IP */
  252. EESIPR_TC1IP = 0x20000000,
  253. EESIPR_TUCIP = 0x10000000,
  254. EESIPR_ROCIP = 0x08000000,
  255. EESIPR_TABTIP = 0x04000000,
  256. EESIPR_RABTIP = 0x02000000,
  257. EESIPR_RFCOFIP = 0x01000000,
  258. EESIPR_ADEIP = 0x00800000,
  259. EESIPR_ECIIP = 0x00400000,
  260. EESIPR_FTCIP = 0x00200000, /* same as TC0IP */
  261. EESIPR_TDEIP = 0x00100000,
  262. EESIPR_TFUFIP = 0x00080000,
  263. EESIPR_FRIP = 0x00040000,
  264. EESIPR_RDEIP = 0x00020000,
  265. EESIPR_RFOFIP = 0x00010000,
  266. EESIPR_CNDIP = 0x00000800,
  267. EESIPR_DLCIP = 0x00000400,
  268. EESIPR_CDIP = 0x00000200,
  269. EESIPR_TROIP = 0x00000100,
  270. EESIPR_RMAFIP = 0x00000080,
  271. EESIPR_CEEFIP = 0x00000040,
  272. EESIPR_CELFIP = 0x00000020,
  273. EESIPR_RRFIP = 0x00000010,
  274. EESIPR_RTLFIP = 0x00000008,
  275. EESIPR_RTSFIP = 0x00000004,
  276. EESIPR_PREIP = 0x00000002,
  277. EESIPR_CERFIP = 0x00000001,
  278. };
  279. /* Receive descriptor 0 bits */
  280. enum RD_STS_BIT {
  281. RD_RACT = 0x80000000, RD_RDLE = 0x40000000,
  282. RD_RFP1 = 0x20000000, RD_RFP0 = 0x10000000,
  283. RD_RFE = 0x08000000, RD_RFS10 = 0x00000200,
  284. RD_RFS9 = 0x00000100, RD_RFS8 = 0x00000080,
  285. RD_RFS7 = 0x00000040, RD_RFS6 = 0x00000020,
  286. RD_RFS5 = 0x00000010, RD_RFS4 = 0x00000008,
  287. RD_RFS3 = 0x00000004, RD_RFS2 = 0x00000002,
  288. RD_RFS1 = 0x00000001,
  289. };
  290. #define RDF1ST RD_RFP1
  291. #define RDFEND RD_RFP0
  292. #define RD_RFP (RD_RFP1|RD_RFP0)
  293. /* Receive descriptor 1 bits */
  294. enum RD_LEN_BIT {
  295. RD_RFL = 0x0000ffff, /* receive frame length */
  296. RD_RBL = 0xffff0000, /* receive buffer length */
  297. };
  298. /* FCFTR */
  299. enum FCFTR_BIT {
  300. FCFTR_RFF2 = 0x00040000, FCFTR_RFF1 = 0x00020000,
  301. FCFTR_RFF0 = 0x00010000, FCFTR_RFD2 = 0x00000004,
  302. FCFTR_RFD1 = 0x00000002, FCFTR_RFD0 = 0x00000001,
  303. };
  304. #define DEFAULT_FIFO_F_D_RFF (FCFTR_RFF2 | FCFTR_RFF1 | FCFTR_RFF0)
  305. #define DEFAULT_FIFO_F_D_RFD (FCFTR_RFD2 | FCFTR_RFD1 | FCFTR_RFD0)
  306. /* Transmit descriptor 0 bits */
  307. enum TD_STS_BIT {
  308. TD_TACT = 0x80000000, TD_TDLE = 0x40000000,
  309. TD_TFP1 = 0x20000000, TD_TFP0 = 0x10000000,
  310. TD_TFE = 0x08000000, TD_TWBI = 0x04000000,
  311. };
  312. #define TDF1ST TD_TFP1
  313. #define TDFEND TD_TFP0
  314. #define TD_TFP (TD_TFP1|TD_TFP0)
  315. /* Transmit descriptor 1 bits */
  316. enum TD_LEN_BIT {
  317. TD_TBL = 0xffff0000, /* transmit buffer length */
  318. };
  319. /* RMCR */
  320. enum RMCR_BIT {
  321. RMCR_RNC = 0x00000001,
  322. };
  323. /* ECMR */
  324. enum FELIC_MODE_BIT {
  325. ECMR_TRCCM = 0x04000000, ECMR_RCSC = 0x00800000,
  326. ECMR_DPAD = 0x00200000, ECMR_RZPF = 0x00100000,
  327. ECMR_ZPF = 0x00080000, ECMR_PFR = 0x00040000, ECMR_RXF = 0x00020000,
  328. ECMR_TXF = 0x00010000, ECMR_MCT = 0x00002000, ECMR_PRCEF = 0x00001000,
  329. ECMR_MPDE = 0x00000200, ECMR_RE = 0x00000040, ECMR_TE = 0x00000020,
  330. ECMR_RTM = 0x00000010, ECMR_ILB = 0x00000008, ECMR_ELB = 0x00000004,
  331. ECMR_DM = 0x00000002, ECMR_PRM = 0x00000001,
  332. };
  333. /* ECSR */
  334. enum ECSR_STATUS_BIT {
  335. ECSR_BRCRX = 0x20, ECSR_PSRTO = 0x10,
  336. ECSR_LCHNG = 0x04,
  337. ECSR_MPD = 0x02, ECSR_ICD = 0x01,
  338. };
  339. #define DEFAULT_ECSR_INIT (ECSR_BRCRX | ECSR_PSRTO | ECSR_LCHNG | \
  340. ECSR_ICD | ECSIPR_MPDIP)
  341. /* ECSIPR */
  342. enum ECSIPR_STATUS_MASK_BIT {
  343. ECSIPR_BRCRXIP = 0x20, ECSIPR_PSRTOIP = 0x10,
  344. ECSIPR_LCHNGIP = 0x04,
  345. ECSIPR_MPDIP = 0x02, ECSIPR_ICDIP = 0x01,
  346. };
  347. #define DEFAULT_ECSIPR_INIT (ECSIPR_BRCRXIP | ECSIPR_PSRTOIP | \
  348. ECSIPR_LCHNGIP | ECSIPR_ICDIP | ECSIPR_MPDIP)
  349. /* APR */
  350. enum APR_BIT {
  351. APR_AP = 0x00000001,
  352. };
  353. /* MPR */
  354. enum MPR_BIT {
  355. MPR_MP = 0x00000001,
  356. };
  357. /* TRSCER */
  358. enum DESC_I_BIT {
  359. DESC_I_TINT4 = 0x0800, DESC_I_TINT3 = 0x0400, DESC_I_TINT2 = 0x0200,
  360. DESC_I_TINT1 = 0x0100, DESC_I_RINT8 = 0x0080, DESC_I_RINT5 = 0x0010,
  361. DESC_I_RINT4 = 0x0008, DESC_I_RINT3 = 0x0004, DESC_I_RINT2 = 0x0002,
  362. DESC_I_RINT1 = 0x0001,
  363. };
  364. #define DEFAULT_TRSCER_ERR_MASK (DESC_I_RINT8 | DESC_I_RINT5 | DESC_I_TINT2)
  365. /* RPADIR */
  366. enum RPADIR_BIT {
  367. RPADIR_PADS1 = 0x20000, RPADIR_PADS0 = 0x10000,
  368. RPADIR_PADR = 0x0003f,
  369. };
  370. /* FDR */
  371. #define DEFAULT_FDR_INIT 0x00000707
  372. /* ARSTR */
  373. enum ARSTR_BIT { ARSTR_ARST = 0x00000001, };
  374. /* TSU_FWEN0 */
  375. enum TSU_FWEN0_BIT {
  376. TSU_FWEN0_0 = 0x00000001,
  377. };
  378. /* TSU_ADSBSY */
  379. enum TSU_ADSBSY_BIT {
  380. TSU_ADSBSY_0 = 0x00000001,
  381. };
  382. /* TSU_TEN */
  383. enum TSU_TEN_BIT {
  384. TSU_TEN_0 = 0x80000000,
  385. };
  386. /* TSU_FWSL0 */
  387. enum TSU_FWSL0_BIT {
  388. TSU_FWSL0_FW50 = 0x1000, TSU_FWSL0_FW40 = 0x0800,
  389. TSU_FWSL0_FW30 = 0x0400, TSU_FWSL0_FW20 = 0x0200,
  390. TSU_FWSL0_FW10 = 0x0100, TSU_FWSL0_RMSA0 = 0x0010,
  391. };
  392. /* TSU_FWSLC */
  393. enum TSU_FWSLC_BIT {
  394. TSU_FWSLC_POSTENU = 0x2000, TSU_FWSLC_POSTENL = 0x1000,
  395. TSU_FWSLC_CAMSEL03 = 0x0080, TSU_FWSLC_CAMSEL02 = 0x0040,
  396. TSU_FWSLC_CAMSEL01 = 0x0020, TSU_FWSLC_CAMSEL00 = 0x0010,
  397. TSU_FWSLC_CAMSEL13 = 0x0008, TSU_FWSLC_CAMSEL12 = 0x0004,
  398. TSU_FWSLC_CAMSEL11 = 0x0002, TSU_FWSLC_CAMSEL10 = 0x0001,
  399. };
  400. /* TSU_VTAGn */
  401. #define TSU_VTAG_ENABLE 0x80000000
  402. #define TSU_VTAG_VID_MASK 0x00000fff
  403. /* The sh ether Tx buffer descriptors.
  404. * This structure should be 20 bytes.
  405. */
  406. struct sh_eth_txdesc {
  407. u32 status; /* TD0 */
  408. u32 len; /* TD1 */
  409. u32 addr; /* TD2 */
  410. u32 pad0; /* padding data */
  411. } __aligned(2) __packed;
  412. /* The sh ether Rx buffer descriptors.
  413. * This structure should be 20 bytes.
  414. */
  415. struct sh_eth_rxdesc {
  416. u32 status; /* RD0 */
  417. u32 len; /* RD1 */
  418. u32 addr; /* RD2 */
  419. u32 pad0; /* padding data */
  420. } __aligned(2) __packed;
  421. /* This structure is used by each CPU dependency handling. */
  422. struct sh_eth_cpu_data {
  423. /* mandatory functions */
  424. int (*soft_reset)(struct net_device *ndev);
  425. /* optional functions */
  426. void (*chip_reset)(struct net_device *ndev);
  427. void (*set_duplex)(struct net_device *ndev);
  428. void (*set_rate)(struct net_device *ndev);
  429. /* mandatory initialize value */
  430. int register_type;
  431. u32 edtrr_trns;
  432. u32 eesipr_value;
  433. /* optional initialize value */
  434. u32 ecsr_value;
  435. u32 ecsipr_value;
  436. u32 fdr_value;
  437. u32 fcftr_value;
  438. u32 rpadir_value;
  439. /* interrupt checking mask */
  440. u32 tx_check;
  441. u32 eesr_err_check;
  442. /* Error mask */
  443. u32 trscer_err_mask;
  444. /* hardware features */
  445. unsigned long irq_flags; /* IRQ configuration flags */
  446. unsigned no_psr:1; /* EtherC DOES NOT have PSR */
  447. unsigned apr:1; /* EtherC has APR */
  448. unsigned mpr:1; /* EtherC has MPR */
  449. unsigned tpauser:1; /* EtherC has TPAUSER */
  450. unsigned bculr:1; /* EtherC has BCULR */
  451. unsigned tsu:1; /* EtherC has TSU */
  452. unsigned hw_swap:1; /* E-DMAC has DE bit in EDMR */
  453. unsigned nbst:1; /* E-DMAC has NBST bit in EDMR */
  454. unsigned rpadir:1; /* E-DMAC has RPADIR */
  455. unsigned no_trimd:1; /* E-DMAC DOES NOT have TRIMD */
  456. unsigned no_ade:1; /* E-DMAC DOES NOT have ADE bit in EESR */
  457. unsigned no_xdfar:1; /* E-DMAC DOES NOT have RDFAR/TDFAR */
  458. unsigned xdfar_rw:1; /* E-DMAC has writeable RDFAR/TDFAR */
  459. unsigned hw_checksum:1; /* E-DMAC has CSMR */
  460. unsigned select_mii:1; /* EtherC has RMII_MII (MII select register) */
  461. unsigned rmiimode:1; /* EtherC has RMIIMODE register */
  462. unsigned rtrate:1; /* EtherC has RTRATE register */
  463. unsigned magic:1; /* EtherC has ECMR.MPDE and ECSR.MPD */
  464. unsigned no_tx_cntrs:1; /* EtherC DOES NOT have TX error counters */
  465. unsigned cexcr:1; /* EtherC has CERCR/CEECR */
  466. unsigned dual_port:1; /* Dual EtherC/E-DMAC */
  467. };
  468. struct sh_eth_private {
  469. struct platform_device *pdev;
  470. struct sh_eth_cpu_data *cd;
  471. const u16 *reg_offset;
  472. void __iomem *addr;
  473. void __iomem *tsu_addr;
  474. struct clk *clk;
  475. u32 num_rx_ring;
  476. u32 num_tx_ring;
  477. dma_addr_t rx_desc_dma;
  478. dma_addr_t tx_desc_dma;
  479. struct sh_eth_rxdesc *rx_ring;
  480. struct sh_eth_txdesc *tx_ring;
  481. struct sk_buff **rx_skbuff;
  482. struct sk_buff **tx_skbuff;
  483. spinlock_t lock; /* Register access lock */
  484. u32 cur_rx, dirty_rx; /* Producer/consumer ring indices */
  485. u32 cur_tx, dirty_tx;
  486. u32 rx_buf_sz; /* Based on MTU+slack. */
  487. struct napi_struct napi;
  488. bool irq_enabled;
  489. /* MII transceiver section. */
  490. u32 phy_id; /* PHY ID */
  491. struct mii_bus *mii_bus; /* MDIO bus control */
  492. int link;
  493. phy_interface_t phy_interface;
  494. int msg_enable;
  495. int speed;
  496. int duplex;
  497. int port; /* for TSU */
  498. int vlan_num_ids; /* for VLAN tag filter */
  499. unsigned no_ether_link:1;
  500. unsigned ether_link_active_low:1;
  501. unsigned is_opened:1;
  502. unsigned wol_enabled:1;
  503. };
  504. static inline void *sh_eth_tsu_get_offset(struct sh_eth_private *mdp,
  505. int enum_index)
  506. {
  507. return mdp->tsu_addr + mdp->reg_offset[enum_index];
  508. }
  509. #endif /* #ifndef __SH_ETH_H__ */