1/*
2 * @TAG(OTHER_GPL)
3 */
4
5/*
6 * (C) Copyright 2009 Ilya Yanok, Emcraft Systems Ltd <yanok@emcraft.com>
7 * (C) Copyright 2008 Armadeus Systems, nc
8 * (C) Copyright 2008 Eric Jarrige <eric.jarrige@armadeus.org>
9 * (C) Copyright 2007 Pengutronix, Sascha Hauer <s.hauer@pengutronix.de>
10 * (C) Copyright 2007 Pengutronix, Juergen Beisert <j.beisert@pengutronix.de>
11 *
12 * (C) Copyright 2003
13 * Wolfgang Denk, DENX Software Engineering, wd@denx.de.
14 *
15 * This file is based on mpc4200fec.h
16 * (C) Copyright Motorola, Inc., 2000
17 *
18 * This program is free software; you can redistribute it and/or
19 * modify it under the terms of the GNU General Public License as
20 * published by the Free Software Foundation; either version 2 of
21 * the License, or (at your option) any later version.
22 *
23 * This program is distributed in the hope that it will be useful,
24 * but WITHOUT ANY WARRANTY; without even the implied warranty of
25 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
26 * GNU General Public License for more details.
27 *
28 * You should have received a copy of the GNU General Public License
29 * along with this program; if not, write to the Free Software
30 * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
31 * MA 02111-1307 USA
32 *
33 */
34
35#pragma once
36
37#include "../enet.h"
38
39#define PKTSIZE			1518
40#define PKTSIZE_ALIGN		1536
41
42struct eth_device {
43	char name[16];
44	unsigned char enetaddr[6];
45	int iobase;
46	int state;
47	struct fec_priv *priv;
48        int (*write_hwaddr)(struct eth_device *dev);
49};
50
51int fec_init(unsigned phy_mask, struct enet* enet);
52
53#define FEC_RCNTRL_MAX_FL_SHIFT		16
54#define FEC_RCNTRL_LOOP			0x00000001
55#define FEC_RCNTRL_DRT			0x00000002
56#define FEC_RCNTRL_MII_MODE		0x00000004
57#define FEC_RCNTRL_PROM			0x00000008
58#define FEC_RCNTRL_BC_REJ		0x00000010
59#define FEC_RCNTRL_FCE			0x00000020
60#define FEC_RCNTRL_RGMII		0x00000040
61#define FEC_RCNTRL_RMII			0x00000100
62#define FEC_RCNTRL_RMII_10T		0x00000200
63
64#define FEC_TCNTRL_GTS			0x00000001
65#define FEC_TCNTRL_HBC			0x00000002
66#define FEC_TCNTRL_FDEN			0x00000004
67#define FEC_TCNTRL_TFC_PAUSE		0x00000008
68#define FEC_TCNTRL_RFC_PAUSE		0x00000010
69
70#define FEC_ECNTRL_RESET		0x00000001	/* reset the FEC */
71#define FEC_ECNTRL_ETHER_EN		0x00000002	/* enable the FEC */
72#define FEC_ECNTRL_SPEED		0x00000020
73#define FEC_ECNTRL_DBSWAP		0x00000100
74
75#define FEC_X_WMRK_STRFWD		0x00000100
76
77/**
78 * @brief i.MX27-FEC private structure
79 */
80struct fec_priv {
81#ifdef CONFIG_PHYLIB
82	int phy_mask;
83	struct phy_device *phydev;
84#else
85	int phy_id;
86	int (*mii_postcall)(int);
87#endif
88};
89