2 * Platform information definitions for the
3 * universal Freescale Ethernet driver.
5 * Copyright (c) 2003 Intracom S.A.
6 * by Pantelis Antoniou <panto@intracom.gr>
8 * 2005 (c) MontaVista Software, Inc.
9 * Vitaly Bordug <vbordug@ru.mvista.com>
11 * This file is licensed under the terms of the GNU General Public License
12 * version 2. This program is licensed "as is" without any warranty of any
13 * kind, whether express or implied.
19 #include <linux/string.h>
20 #include <linux/of_mdio.h>
21 #include <linux/if_ether.h>
22 #include <asm/types.h>
24 #define FS_ENET_NAME "fs_enet"
38 #define FS_MAX_INDEX 9
40 static inline int fs_get_fec_index(enum fs_id id)
42 if (id >= fsid_fec1 && id <= fsid_fec2)
43 return id - fsid_fec1;
47 static inline int fs_get_fcc_index(enum fs_id id)
49 if (id >= fsid_fcc1 && id <= fsid_fcc3)
50 return id - fsid_fcc1;
54 static inline int fs_get_scc_index(enum fs_id id)
56 if (id >= fsid_scc1 && id <= fsid_scc4)
57 return id - fsid_scc1;
61 static inline int fs_fec_index2id(int index)
63 int id = fsid_fec1 + index - 1;
64 if (id >= fsid_fec1 && id <= fsid_fec2)
69 static inline int fs_fcc_index2id(int index)
71 int id = fsid_fcc1 + index - 1;
72 if (id >= fsid_fcc1 && id <= fsid_fcc3)
77 static inline int fs_scc_index2id(int index)
79 int id = fsid_scc1 + index - 1;
80 if (id >= fsid_scc1 && id <= fsid_scc4)
104 struct fs_mii_bb_platform_info {
105 struct fs_mii_bit mdio_dir;
106 struct fs_mii_bit mdio_dat;
107 struct fs_mii_bit mdc_dat;
108 int delay; /* delay in us */
109 int irq[32]; /* irqs per phy's */
112 struct fs_platform_info {
114 void(*init_ioports)(struct fs_platform_info *);
115 /* device specific information */
116 int fs_no; /* controller index */
117 char fs_type[4]; /* controller type */
119 u32 cp_page; /* CPM page */
120 u32 cp_block; /* CPM sblock */
121 u32 cp_command; /* CPM page/sblock/mcn */
123 u32 clk_trx; /* some stuff for pins & mux configuration*/
135 struct device_node *phy_node;
136 const struct fs_mii_bus_info *bus_info;
138 int rx_ring, tx_ring; /* number of buffers on rx */
139 __u8 macaddr[ETH_ALEN]; /* mac address */
140 int rx_copybreak; /* limit we copy small frames */
141 int use_napi; /* use NAPI */
142 int napi_weight; /* NAPI weight */
144 int use_rmii; /* use RMII mode */
145 int has_phy; /* if the network is phy container as well...*/
147 struct fs_mii_fec_platform_info {
152 static inline int fs_get_id(struct fs_platform_info *fpi)
154 if(strstr(fpi->fs_type, "SCC"))
155 return fs_scc_index2id(fpi->fs_no);
156 if(strstr(fpi->fs_type, "FCC"))
157 return fs_fcc_index2id(fpi->fs_no);
158 if(strstr(fpi->fs_type, "FEC"))
159 return fs_fec_index2id(fpi->fs_no);