blob: b5eef8633f0b24c0a5419770e5011bf896381956 [file] [log] [blame]
Wolfgang Denk4646d2a2006-05-30 15:56:48 +02001/*
2 * (C) Copyright 2005
3 * Stefan Roese, DENX Software Engineering, sr@denx.de.
4 *
5 * See file CREDITS for list of people who contributed to this
6 * project.
7 *
8 * This program is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU General Public License as
10 * published by the Free Software Foundation; either version 2 of
11 * the License, or (at your option) any later version.
12 *
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
17 *
18 * You should have received a copy of the GNU General Public License
19 * along with this program; if not, write to the Free Software
20 * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
21 * MA 02111-1307 USA
22 */
23
24#ifndef NPE_H
25#define NPE_H
26
27/*
28 * defines...
29 */
Jean-Christophe PLAGNIOL-VILLARD03836942008-10-16 15:01:15 +020030#define CONFIG_SYS_NPE_NUMS 1
Wolfgang Denk4646d2a2006-05-30 15:56:48 +020031#ifdef CONFIG_HAS_ETH1
Jean-Christophe PLAGNIOL-VILLARD03836942008-10-16 15:01:15 +020032#undef CONFIG_SYS_NPE_NUMS
33#define CONFIG_SYS_NPE_NUMS 2
Wolfgang Denk4646d2a2006-05-30 15:56:48 +020034#endif
35
36#define NPE_NUM_PORTS 3
37#define ACTIVE_PORTS 1
38
39#define NPE_PKT_SIZE 1600
40
41#define CONFIG_DEVS_ETH_INTEL_NPE_MAX_RX_DESCRIPTORS 64
42#define CONFIG_DEVS_ETH_INTEL_NPE_MAX_TX_DESCRIPTORS 2
43
44#define NPE_MBUF_POOL_SIZE \
45 ((CONFIG_DEVS_ETH_INTEL_NPE_MAX_TX_DESCRIPTORS + \
46 CONFIG_DEVS_ETH_INTEL_NPE_MAX_RX_DESCRIPTORS) * \
47 sizeof(IX_OSAL_MBUF) * ACTIVE_PORTS)
48
49#define NPE_PKT_POOL_SIZE \
50 ((CONFIG_DEVS_ETH_INTEL_NPE_MAX_TX_DESCRIPTORS + \
51 CONFIG_DEVS_ETH_INTEL_NPE_MAX_RX_DESCRIPTORS) * \
52 NPE_PKT_SIZE * ACTIVE_PORTS)
53
54#define NPE_MEM_POOL_SIZE (NPE_MBUF_POOL_SIZE + NPE_PKT_POOL_SIZE)
55
56#define PHY_AUTONEGOTIATE_TIMEOUT 4000 /* 4000 ms autonegotiate timeout */
57
58/*
59 * structs...
60 */
61struct npe {
62 u8 active; /* NPE active */
63 u8 eth_id; /* IX_ETH_PORT_1 or IX_ETH_PORT_2 */
64 u8 phy_no; /* which PHY (0 - 31) */
65 u8 mac_address[6];
66
67 IX_OSAL_MBUF *rxQHead;
68 IX_OSAL_MBUF *txQHead;
69
70 u8 *tx_pkts;
71 u8 *rx_pkts;
72 IX_OSAL_MBUF *rx_mbufs;
73 IX_OSAL_MBUF *tx_mbufs;
74
75 int print_speed;
76
77 int rx_read;
78 int rx_write;
79 int rx_len[PKTBUFSRX];
80};
81
82/*
83 * prototypes...
84 */
Mike Frysinger5ff5fdb2010-07-27 18:35:08 -040085extern int npe_miiphy_read (const char *devname, unsigned char addr,
Wolfgang Denk4646d2a2006-05-30 15:56:48 +020086 unsigned char reg, unsigned short *value);
Mike Frysinger5ff5fdb2010-07-27 18:35:08 -040087extern int npe_miiphy_write (const char *devname, unsigned char addr,
Wolfgang Denk4646d2a2006-05-30 15:56:48 +020088 unsigned char reg, unsigned short value);
89
90#endif /* ifndef NPE_H */