18c2ecf20Sopenharmony_ci/*
28c2ecf20Sopenharmony_ci * drivers/net/ethernet/freescale/fec_mpc52xx.h
38c2ecf20Sopenharmony_ci *
48c2ecf20Sopenharmony_ci * Driver for the MPC5200 Fast Ethernet Controller
58c2ecf20Sopenharmony_ci *
68c2ecf20Sopenharmony_ci * Author: Dale Farnsworth <dfarnsworth@mvista.com>
78c2ecf20Sopenharmony_ci *
88c2ecf20Sopenharmony_ci * 2003-2004 (c) MontaVista, Software, Inc.  This file is licensed under
98c2ecf20Sopenharmony_ci * the terms of the GNU General Public License version 2.  This program
108c2ecf20Sopenharmony_ci * is licensed "as is" without any warranty of any kind, whether express
118c2ecf20Sopenharmony_ci * or implied.
128c2ecf20Sopenharmony_ci */
138c2ecf20Sopenharmony_ci
148c2ecf20Sopenharmony_ci#ifndef __DRIVERS_NET_MPC52XX_FEC_H__
158c2ecf20Sopenharmony_ci#define __DRIVERS_NET_MPC52XX_FEC_H__
168c2ecf20Sopenharmony_ci
178c2ecf20Sopenharmony_ci#include <linux/phy.h>
188c2ecf20Sopenharmony_ci
198c2ecf20Sopenharmony_ci/* Tunable constant */
208c2ecf20Sopenharmony_ci/* FEC_RX_BUFFER_SIZE includes 4 bytes for CRC32 */
218c2ecf20Sopenharmony_ci#define FEC_RX_BUFFER_SIZE	1522	/* max receive packet size */
228c2ecf20Sopenharmony_ci#define FEC_RX_NUM_BD		256
238c2ecf20Sopenharmony_ci#define FEC_TX_NUM_BD		64
248c2ecf20Sopenharmony_ci
258c2ecf20Sopenharmony_ci#define FEC_RESET_DELAY		50 	/* uS */
268c2ecf20Sopenharmony_ci
278c2ecf20Sopenharmony_ci#define FEC_WATCHDOG_TIMEOUT	((400*HZ)/1000)
288c2ecf20Sopenharmony_ci
298c2ecf20Sopenharmony_ci/* ======================================================================== */
308c2ecf20Sopenharmony_ci/* Hardware register sets & bits                                            */
318c2ecf20Sopenharmony_ci/* ======================================================================== */
328c2ecf20Sopenharmony_ci
338c2ecf20Sopenharmony_cistruct mpc52xx_fec {
348c2ecf20Sopenharmony_ci	u32 fec_id;			/* FEC + 0x000 */
358c2ecf20Sopenharmony_ci	u32 ievent;			/* FEC + 0x004 */
368c2ecf20Sopenharmony_ci	u32 imask;			/* FEC + 0x008 */
378c2ecf20Sopenharmony_ci
388c2ecf20Sopenharmony_ci	u32 reserved0[1];		/* FEC + 0x00C */
398c2ecf20Sopenharmony_ci	u32 r_des_active;		/* FEC + 0x010 */
408c2ecf20Sopenharmony_ci	u32 x_des_active;		/* FEC + 0x014 */
418c2ecf20Sopenharmony_ci	u32 r_des_active_cl;		/* FEC + 0x018 */
428c2ecf20Sopenharmony_ci	u32 x_des_active_cl;		/* FEC + 0x01C */
438c2ecf20Sopenharmony_ci	u32 ivent_set;			/* FEC + 0x020 */
448c2ecf20Sopenharmony_ci	u32 ecntrl;			/* FEC + 0x024 */
458c2ecf20Sopenharmony_ci
468c2ecf20Sopenharmony_ci	u32 reserved1[6];		/* FEC + 0x028-03C */
478c2ecf20Sopenharmony_ci	u32 mii_data;			/* FEC + 0x040 */
488c2ecf20Sopenharmony_ci	u32 mii_speed;			/* FEC + 0x044 */
498c2ecf20Sopenharmony_ci	u32 mii_status;			/* FEC + 0x048 */
508c2ecf20Sopenharmony_ci
518c2ecf20Sopenharmony_ci	u32 reserved2[5];		/* FEC + 0x04C-05C */
528c2ecf20Sopenharmony_ci	u32 mib_data;			/* FEC + 0x060 */
538c2ecf20Sopenharmony_ci	u32 mib_control;		/* FEC + 0x064 */
548c2ecf20Sopenharmony_ci
558c2ecf20Sopenharmony_ci	u32 reserved3[6];		/* FEC + 0x068-7C */
568c2ecf20Sopenharmony_ci	u32 r_activate;			/* FEC + 0x080 */
578c2ecf20Sopenharmony_ci	u32 r_cntrl;			/* FEC + 0x084 */
588c2ecf20Sopenharmony_ci	u32 r_hash;			/* FEC + 0x088 */
598c2ecf20Sopenharmony_ci	u32 r_data;			/* FEC + 0x08C */
608c2ecf20Sopenharmony_ci	u32 ar_done;			/* FEC + 0x090 */
618c2ecf20Sopenharmony_ci	u32 r_test;			/* FEC + 0x094 */
628c2ecf20Sopenharmony_ci	u32 r_mib;			/* FEC + 0x098 */
638c2ecf20Sopenharmony_ci	u32 r_da_low;			/* FEC + 0x09C */
648c2ecf20Sopenharmony_ci	u32 r_da_high;			/* FEC + 0x0A0 */
658c2ecf20Sopenharmony_ci
668c2ecf20Sopenharmony_ci	u32 reserved4[7];		/* FEC + 0x0A4-0BC */
678c2ecf20Sopenharmony_ci	u32 x_activate;			/* FEC + 0x0C0 */
688c2ecf20Sopenharmony_ci	u32 x_cntrl;			/* FEC + 0x0C4 */
698c2ecf20Sopenharmony_ci	u32 backoff;			/* FEC + 0x0C8 */
708c2ecf20Sopenharmony_ci	u32 x_data;			/* FEC + 0x0CC */
718c2ecf20Sopenharmony_ci	u32 x_status;			/* FEC + 0x0D0 */
728c2ecf20Sopenharmony_ci	u32 x_mib;			/* FEC + 0x0D4 */
738c2ecf20Sopenharmony_ci	u32 x_test;			/* FEC + 0x0D8 */
748c2ecf20Sopenharmony_ci	u32 fdxfc_da1;			/* FEC + 0x0DC */
758c2ecf20Sopenharmony_ci	u32 fdxfc_da2;			/* FEC + 0x0E0 */
768c2ecf20Sopenharmony_ci	u32 paddr1;			/* FEC + 0x0E4 */
778c2ecf20Sopenharmony_ci	u32 paddr2;			/* FEC + 0x0E8 */
788c2ecf20Sopenharmony_ci	u32 op_pause;			/* FEC + 0x0EC */
798c2ecf20Sopenharmony_ci
808c2ecf20Sopenharmony_ci	u32 reserved5[4];		/* FEC + 0x0F0-0FC */
818c2ecf20Sopenharmony_ci	u32 instr_reg;			/* FEC + 0x100 */
828c2ecf20Sopenharmony_ci	u32 context_reg;		/* FEC + 0x104 */
838c2ecf20Sopenharmony_ci	u32 test_cntrl;			/* FEC + 0x108 */
848c2ecf20Sopenharmony_ci	u32 acc_reg;			/* FEC + 0x10C */
858c2ecf20Sopenharmony_ci	u32 ones;			/* FEC + 0x110 */
868c2ecf20Sopenharmony_ci	u32 zeros;			/* FEC + 0x114 */
878c2ecf20Sopenharmony_ci	u32 iaddr1;			/* FEC + 0x118 */
888c2ecf20Sopenharmony_ci	u32 iaddr2;			/* FEC + 0x11C */
898c2ecf20Sopenharmony_ci	u32 gaddr1;			/* FEC + 0x120 */
908c2ecf20Sopenharmony_ci	u32 gaddr2;			/* FEC + 0x124 */
918c2ecf20Sopenharmony_ci	u32 random;			/* FEC + 0x128 */
928c2ecf20Sopenharmony_ci	u32 rand1;			/* FEC + 0x12C */
938c2ecf20Sopenharmony_ci	u32 tmp;			/* FEC + 0x130 */
948c2ecf20Sopenharmony_ci
958c2ecf20Sopenharmony_ci	u32 reserved6[3];		/* FEC + 0x134-13C */
968c2ecf20Sopenharmony_ci	u32 fifo_id;			/* FEC + 0x140 */
978c2ecf20Sopenharmony_ci	u32 x_wmrk;			/* FEC + 0x144 */
988c2ecf20Sopenharmony_ci	u32 fcntrl;			/* FEC + 0x148 */
998c2ecf20Sopenharmony_ci	u32 r_bound;			/* FEC + 0x14C */
1008c2ecf20Sopenharmony_ci	u32 r_fstart;			/* FEC + 0x150 */
1018c2ecf20Sopenharmony_ci	u32 r_count;			/* FEC + 0x154 */
1028c2ecf20Sopenharmony_ci	u32 r_lag;			/* FEC + 0x158 */
1038c2ecf20Sopenharmony_ci	u32 r_read;			/* FEC + 0x15C */
1048c2ecf20Sopenharmony_ci	u32 r_write;			/* FEC + 0x160 */
1058c2ecf20Sopenharmony_ci	u32 x_count;			/* FEC + 0x164 */
1068c2ecf20Sopenharmony_ci	u32 x_lag;			/* FEC + 0x168 */
1078c2ecf20Sopenharmony_ci	u32 x_retry;			/* FEC + 0x16C */
1088c2ecf20Sopenharmony_ci	u32 x_write;			/* FEC + 0x170 */
1098c2ecf20Sopenharmony_ci	u32 x_read;			/* FEC + 0x174 */
1108c2ecf20Sopenharmony_ci
1118c2ecf20Sopenharmony_ci	u32 reserved7[2];		/* FEC + 0x178-17C */
1128c2ecf20Sopenharmony_ci	u32 fm_cntrl;			/* FEC + 0x180 */
1138c2ecf20Sopenharmony_ci	u32 rfifo_data;			/* FEC + 0x184 */
1148c2ecf20Sopenharmony_ci	u32 rfifo_status;		/* FEC + 0x188 */
1158c2ecf20Sopenharmony_ci	u32 rfifo_cntrl;		/* FEC + 0x18C */
1168c2ecf20Sopenharmony_ci	u32 rfifo_lrf_ptr;		/* FEC + 0x190 */
1178c2ecf20Sopenharmony_ci	u32 rfifo_lwf_ptr;		/* FEC + 0x194 */
1188c2ecf20Sopenharmony_ci	u32 rfifo_alarm;		/* FEC + 0x198 */
1198c2ecf20Sopenharmony_ci	u32 rfifo_rdptr;		/* FEC + 0x19C */
1208c2ecf20Sopenharmony_ci	u32 rfifo_wrptr;		/* FEC + 0x1A0 */
1218c2ecf20Sopenharmony_ci	u32 tfifo_data;			/* FEC + 0x1A4 */
1228c2ecf20Sopenharmony_ci	u32 tfifo_status;		/* FEC + 0x1A8 */
1238c2ecf20Sopenharmony_ci	u32 tfifo_cntrl;		/* FEC + 0x1AC */
1248c2ecf20Sopenharmony_ci	u32 tfifo_lrf_ptr;		/* FEC + 0x1B0 */
1258c2ecf20Sopenharmony_ci	u32 tfifo_lwf_ptr;		/* FEC + 0x1B4 */
1268c2ecf20Sopenharmony_ci	u32 tfifo_alarm;		/* FEC + 0x1B8 */
1278c2ecf20Sopenharmony_ci	u32 tfifo_rdptr;		/* FEC + 0x1BC */
1288c2ecf20Sopenharmony_ci	u32 tfifo_wrptr;		/* FEC + 0x1C0 */
1298c2ecf20Sopenharmony_ci
1308c2ecf20Sopenharmony_ci	u32 reset_cntrl;		/* FEC + 0x1C4 */
1318c2ecf20Sopenharmony_ci	u32 xmit_fsm;			/* FEC + 0x1C8 */
1328c2ecf20Sopenharmony_ci
1338c2ecf20Sopenharmony_ci	u32 reserved8[3];		/* FEC + 0x1CC-1D4 */
1348c2ecf20Sopenharmony_ci	u32 rdes_data0;			/* FEC + 0x1D8 */
1358c2ecf20Sopenharmony_ci	u32 rdes_data1;			/* FEC + 0x1DC */
1368c2ecf20Sopenharmony_ci	u32 r_length;			/* FEC + 0x1E0 */
1378c2ecf20Sopenharmony_ci	u32 x_length;			/* FEC + 0x1E4 */
1388c2ecf20Sopenharmony_ci	u32 x_addr;			/* FEC + 0x1E8 */
1398c2ecf20Sopenharmony_ci	u32 cdes_data;			/* FEC + 0x1EC */
1408c2ecf20Sopenharmony_ci	u32 status;			/* FEC + 0x1F0 */
1418c2ecf20Sopenharmony_ci	u32 dma_control;		/* FEC + 0x1F4 */
1428c2ecf20Sopenharmony_ci	u32 des_cmnd;			/* FEC + 0x1F8 */
1438c2ecf20Sopenharmony_ci	u32 data;			/* FEC + 0x1FC */
1448c2ecf20Sopenharmony_ci
1458c2ecf20Sopenharmony_ci	u32 rmon_t_drop;		/* FEC + 0x200 */
1468c2ecf20Sopenharmony_ci	u32 rmon_t_packets;		/* FEC + 0x204 */
1478c2ecf20Sopenharmony_ci	u32 rmon_t_bc_pkt;		/* FEC + 0x208 */
1488c2ecf20Sopenharmony_ci	u32 rmon_t_mc_pkt;		/* FEC + 0x20C */
1498c2ecf20Sopenharmony_ci	u32 rmon_t_crc_align;		/* FEC + 0x210 */
1508c2ecf20Sopenharmony_ci	u32 rmon_t_undersize;		/* FEC + 0x214 */
1518c2ecf20Sopenharmony_ci	u32 rmon_t_oversize;		/* FEC + 0x218 */
1528c2ecf20Sopenharmony_ci	u32 rmon_t_frag;		/* FEC + 0x21C */
1538c2ecf20Sopenharmony_ci	u32 rmon_t_jab;			/* FEC + 0x220 */
1548c2ecf20Sopenharmony_ci	u32 rmon_t_col;			/* FEC + 0x224 */
1558c2ecf20Sopenharmony_ci	u32 rmon_t_p64;			/* FEC + 0x228 */
1568c2ecf20Sopenharmony_ci	u32 rmon_t_p65to127;		/* FEC + 0x22C */
1578c2ecf20Sopenharmony_ci	u32 rmon_t_p128to255;		/* FEC + 0x230 */
1588c2ecf20Sopenharmony_ci	u32 rmon_t_p256to511;		/* FEC + 0x234 */
1598c2ecf20Sopenharmony_ci	u32 rmon_t_p512to1023;		/* FEC + 0x238 */
1608c2ecf20Sopenharmony_ci	u32 rmon_t_p1024to2047;		/* FEC + 0x23C */
1618c2ecf20Sopenharmony_ci	u32 rmon_t_p_gte2048;		/* FEC + 0x240 */
1628c2ecf20Sopenharmony_ci	u32 rmon_t_octets;		/* FEC + 0x244 */
1638c2ecf20Sopenharmony_ci	u32 ieee_t_drop;		/* FEC + 0x248 */
1648c2ecf20Sopenharmony_ci	u32 ieee_t_frame_ok;		/* FEC + 0x24C */
1658c2ecf20Sopenharmony_ci	u32 ieee_t_1col;		/* FEC + 0x250 */
1668c2ecf20Sopenharmony_ci	u32 ieee_t_mcol;		/* FEC + 0x254 */
1678c2ecf20Sopenharmony_ci	u32 ieee_t_def;			/* FEC + 0x258 */
1688c2ecf20Sopenharmony_ci	u32 ieee_t_lcol;		/* FEC + 0x25C */
1698c2ecf20Sopenharmony_ci	u32 ieee_t_excol;		/* FEC + 0x260 */
1708c2ecf20Sopenharmony_ci	u32 ieee_t_macerr;		/* FEC + 0x264 */
1718c2ecf20Sopenharmony_ci	u32 ieee_t_cserr;		/* FEC + 0x268 */
1728c2ecf20Sopenharmony_ci	u32 ieee_t_sqe;			/* FEC + 0x26C */
1738c2ecf20Sopenharmony_ci	u32 t_fdxfc;			/* FEC + 0x270 */
1748c2ecf20Sopenharmony_ci	u32 ieee_t_octets_ok;		/* FEC + 0x274 */
1758c2ecf20Sopenharmony_ci
1768c2ecf20Sopenharmony_ci	u32 reserved9[2];		/* FEC + 0x278-27C */
1778c2ecf20Sopenharmony_ci	u32 rmon_r_drop;		/* FEC + 0x280 */
1788c2ecf20Sopenharmony_ci	u32 rmon_r_packets;		/* FEC + 0x284 */
1798c2ecf20Sopenharmony_ci	u32 rmon_r_bc_pkt;		/* FEC + 0x288 */
1808c2ecf20Sopenharmony_ci	u32 rmon_r_mc_pkt;		/* FEC + 0x28C */
1818c2ecf20Sopenharmony_ci	u32 rmon_r_crc_align;		/* FEC + 0x290 */
1828c2ecf20Sopenharmony_ci	u32 rmon_r_undersize;		/* FEC + 0x294 */
1838c2ecf20Sopenharmony_ci	u32 rmon_r_oversize;		/* FEC + 0x298 */
1848c2ecf20Sopenharmony_ci	u32 rmon_r_frag;		/* FEC + 0x29C */
1858c2ecf20Sopenharmony_ci	u32 rmon_r_jab;			/* FEC + 0x2A0 */
1868c2ecf20Sopenharmony_ci
1878c2ecf20Sopenharmony_ci	u32 rmon_r_resvd_0;		/* FEC + 0x2A4 */
1888c2ecf20Sopenharmony_ci
1898c2ecf20Sopenharmony_ci	u32 rmon_r_p64;			/* FEC + 0x2A8 */
1908c2ecf20Sopenharmony_ci	u32 rmon_r_p65to127;		/* FEC + 0x2AC */
1918c2ecf20Sopenharmony_ci	u32 rmon_r_p128to255;		/* FEC + 0x2B0 */
1928c2ecf20Sopenharmony_ci	u32 rmon_r_p256to511;		/* FEC + 0x2B4 */
1938c2ecf20Sopenharmony_ci	u32 rmon_r_p512to1023;		/* FEC + 0x2B8 */
1948c2ecf20Sopenharmony_ci	u32 rmon_r_p1024to2047;		/* FEC + 0x2BC */
1958c2ecf20Sopenharmony_ci	u32 rmon_r_p_gte2048;		/* FEC + 0x2C0 */
1968c2ecf20Sopenharmony_ci	u32 rmon_r_octets;		/* FEC + 0x2C4 */
1978c2ecf20Sopenharmony_ci	u32 ieee_r_drop;		/* FEC + 0x2C8 */
1988c2ecf20Sopenharmony_ci	u32 ieee_r_frame_ok;		/* FEC + 0x2CC */
1998c2ecf20Sopenharmony_ci	u32 ieee_r_crc;			/* FEC + 0x2D0 */
2008c2ecf20Sopenharmony_ci	u32 ieee_r_align;		/* FEC + 0x2D4 */
2018c2ecf20Sopenharmony_ci	u32 r_macerr;			/* FEC + 0x2D8 */
2028c2ecf20Sopenharmony_ci	u32 r_fdxfc;			/* FEC + 0x2DC */
2038c2ecf20Sopenharmony_ci	u32 ieee_r_octets_ok;		/* FEC + 0x2E0 */
2048c2ecf20Sopenharmony_ci
2058c2ecf20Sopenharmony_ci	u32 reserved10[7];		/* FEC + 0x2E4-2FC */
2068c2ecf20Sopenharmony_ci
2078c2ecf20Sopenharmony_ci	u32 reserved11[64];		/* FEC + 0x300-3FF */
2088c2ecf20Sopenharmony_ci};
2098c2ecf20Sopenharmony_ci
2108c2ecf20Sopenharmony_ci#define	FEC_MIB_DISABLE			0x80000000
2118c2ecf20Sopenharmony_ci
2128c2ecf20Sopenharmony_ci#define	FEC_IEVENT_HBERR		0x80000000
2138c2ecf20Sopenharmony_ci#define	FEC_IEVENT_BABR			0x40000000
2148c2ecf20Sopenharmony_ci#define	FEC_IEVENT_BABT			0x20000000
2158c2ecf20Sopenharmony_ci#define	FEC_IEVENT_GRA			0x10000000
2168c2ecf20Sopenharmony_ci#define	FEC_IEVENT_TFINT		0x08000000
2178c2ecf20Sopenharmony_ci#define	FEC_IEVENT_MII			0x00800000
2188c2ecf20Sopenharmony_ci#define	FEC_IEVENT_LATE_COL		0x00200000
2198c2ecf20Sopenharmony_ci#define	FEC_IEVENT_COL_RETRY_LIM	0x00100000
2208c2ecf20Sopenharmony_ci#define	FEC_IEVENT_XFIFO_UN		0x00080000
2218c2ecf20Sopenharmony_ci#define	FEC_IEVENT_XFIFO_ERROR		0x00040000
2228c2ecf20Sopenharmony_ci#define	FEC_IEVENT_RFIFO_ERROR		0x00020000
2238c2ecf20Sopenharmony_ci
2248c2ecf20Sopenharmony_ci#define	FEC_IMASK_HBERR			0x80000000
2258c2ecf20Sopenharmony_ci#define	FEC_IMASK_BABR			0x40000000
2268c2ecf20Sopenharmony_ci#define	FEC_IMASK_BABT			0x20000000
2278c2ecf20Sopenharmony_ci#define	FEC_IMASK_GRA			0x10000000
2288c2ecf20Sopenharmony_ci#define	FEC_IMASK_MII			0x00800000
2298c2ecf20Sopenharmony_ci#define	FEC_IMASK_LATE_COL		0x00200000
2308c2ecf20Sopenharmony_ci#define	FEC_IMASK_COL_RETRY_LIM		0x00100000
2318c2ecf20Sopenharmony_ci#define	FEC_IMASK_XFIFO_UN		0x00080000
2328c2ecf20Sopenharmony_ci#define	FEC_IMASK_XFIFO_ERROR		0x00040000
2338c2ecf20Sopenharmony_ci#define	FEC_IMASK_RFIFO_ERROR		0x00020000
2348c2ecf20Sopenharmony_ci
2358c2ecf20Sopenharmony_ci/* all but MII, which is enabled separately */
2368c2ecf20Sopenharmony_ci#define FEC_IMASK_ENABLE	(FEC_IMASK_HBERR | FEC_IMASK_BABR | \
2378c2ecf20Sopenharmony_ci		FEC_IMASK_BABT | FEC_IMASK_GRA | FEC_IMASK_LATE_COL | \
2388c2ecf20Sopenharmony_ci		FEC_IMASK_COL_RETRY_LIM | FEC_IMASK_XFIFO_UN | \
2398c2ecf20Sopenharmony_ci		FEC_IMASK_XFIFO_ERROR | FEC_IMASK_RFIFO_ERROR)
2408c2ecf20Sopenharmony_ci
2418c2ecf20Sopenharmony_ci#define	FEC_RCNTRL_MAX_FL_SHIFT		16
2428c2ecf20Sopenharmony_ci#define	FEC_RCNTRL_LOOP			0x01
2438c2ecf20Sopenharmony_ci#define	FEC_RCNTRL_DRT			0x02
2448c2ecf20Sopenharmony_ci#define	FEC_RCNTRL_MII_MODE		0x04
2458c2ecf20Sopenharmony_ci#define	FEC_RCNTRL_PROM			0x08
2468c2ecf20Sopenharmony_ci#define	FEC_RCNTRL_BC_REJ		0x10
2478c2ecf20Sopenharmony_ci#define	FEC_RCNTRL_FCE			0x20
2488c2ecf20Sopenharmony_ci
2498c2ecf20Sopenharmony_ci#define	FEC_TCNTRL_GTS			0x00000001
2508c2ecf20Sopenharmony_ci#define	FEC_TCNTRL_HBC			0x00000002
2518c2ecf20Sopenharmony_ci#define	FEC_TCNTRL_FDEN			0x00000004
2528c2ecf20Sopenharmony_ci#define	FEC_TCNTRL_TFC_PAUSE		0x00000008
2538c2ecf20Sopenharmony_ci#define	FEC_TCNTRL_RFC_PAUSE		0x00000010
2548c2ecf20Sopenharmony_ci
2558c2ecf20Sopenharmony_ci#define	FEC_ECNTRL_RESET		0x00000001
2568c2ecf20Sopenharmony_ci#define	FEC_ECNTRL_ETHER_EN		0x00000002
2578c2ecf20Sopenharmony_ci
2588c2ecf20Sopenharmony_ci#define FEC_MII_DATA_ST			0x40000000	/* Start frame */
2598c2ecf20Sopenharmony_ci#define FEC_MII_DATA_OP_RD		0x20000000	/* Perform read */
2608c2ecf20Sopenharmony_ci#define FEC_MII_DATA_OP_WR		0x10000000	/* Perform write */
2618c2ecf20Sopenharmony_ci#define FEC_MII_DATA_PA_MSK		0x0f800000	/* PHY Address mask */
2628c2ecf20Sopenharmony_ci#define FEC_MII_DATA_RA_MSK		0x007c0000	/* PHY Register mask */
2638c2ecf20Sopenharmony_ci#define FEC_MII_DATA_TA			0x00020000	/* Turnaround */
2648c2ecf20Sopenharmony_ci#define FEC_MII_DATA_DATAMSK		0x0000ffff	/* PHY data mask */
2658c2ecf20Sopenharmony_ci
2668c2ecf20Sopenharmony_ci#define FEC_MII_READ_FRAME	(FEC_MII_DATA_ST | FEC_MII_DATA_OP_RD | FEC_MII_DATA_TA)
2678c2ecf20Sopenharmony_ci#define FEC_MII_WRITE_FRAME	(FEC_MII_DATA_ST | FEC_MII_DATA_OP_WR | FEC_MII_DATA_TA)
2688c2ecf20Sopenharmony_ci
2698c2ecf20Sopenharmony_ci#define FEC_MII_DATA_RA_SHIFT		0x12		/* MII reg addr bits */
2708c2ecf20Sopenharmony_ci#define FEC_MII_DATA_PA_SHIFT		0x17		/* MII PHY addr bits */
2718c2ecf20Sopenharmony_ci
2728c2ecf20Sopenharmony_ci#define FEC_PADDR2_TYPE			0x8808
2738c2ecf20Sopenharmony_ci
2748c2ecf20Sopenharmony_ci#define FEC_OP_PAUSE_OPCODE		0x00010000
2758c2ecf20Sopenharmony_ci
2768c2ecf20Sopenharmony_ci#define FEC_FIFO_WMRK_256B		0x3
2778c2ecf20Sopenharmony_ci
2788c2ecf20Sopenharmony_ci#define FEC_FIFO_STATUS_ERR		0x00400000
2798c2ecf20Sopenharmony_ci#define FEC_FIFO_STATUS_UF		0x00200000
2808c2ecf20Sopenharmony_ci#define FEC_FIFO_STATUS_OF		0x00100000
2818c2ecf20Sopenharmony_ci
2828c2ecf20Sopenharmony_ci#define FEC_FIFO_CNTRL_FRAME		0x08000000
2838c2ecf20Sopenharmony_ci#define FEC_FIFO_CNTRL_LTG_7		0x07000000
2848c2ecf20Sopenharmony_ci
2858c2ecf20Sopenharmony_ci#define FEC_RESET_CNTRL_RESET_FIFO	0x02000000
2868c2ecf20Sopenharmony_ci#define FEC_RESET_CNTRL_ENABLE_IS_RESET	0x01000000
2878c2ecf20Sopenharmony_ci
2888c2ecf20Sopenharmony_ci#define FEC_XMIT_FSM_APPEND_CRC		0x02000000
2898c2ecf20Sopenharmony_ci#define FEC_XMIT_FSM_ENABLE_CRC		0x01000000
2908c2ecf20Sopenharmony_ci
2918c2ecf20Sopenharmony_ci
2928c2ecf20Sopenharmony_ciextern struct platform_driver mpc52xx_fec_mdio_driver;
2938c2ecf20Sopenharmony_ci
2948c2ecf20Sopenharmony_ci#endif	/* __DRIVERS_NET_MPC52XX_FEC_H__ */
295