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 <asm/types.h>
23 #define FS_ENET_NAME "fs_enet"
37 #define FS_MAX_INDEX 9
39 static inline int fs_get_fec_index(enum fs_id id)
41 if (id >= fsid_fec1 && id <= fsid_fec2)
42 return id - fsid_fec1;
46 static inline int fs_get_fcc_index(enum fs_id id)
48 if (id >= fsid_fcc1 && id <= fsid_fcc3)
49 return id - fsid_fcc1;
53 static inline int fs_get_scc_index(enum fs_id id)
55 if (id >= fsid_scc1 && id <= fsid_scc4)
56 return id - fsid_scc1;
60 static inline int fs_fec_index2id(int index)
62 int id = fsid_fec1 + index - 1;
63 if (id >= fsid_fec1 && id <= fsid_fec2)
68 static inline int fs_fcc_index2id(int index)
70 int id = fsid_fcc1 + index - 1;
71 if (id >= fsid_fcc1 && id <= fsid_fcc3)
76 static inline int fs_scc_index2id(int index)
78 int id = fsid_scc1 + index - 1;
79 if (id >= fsid_scc1 && id <= fsid_scc4)
103 struct fs_mii_bb_platform_info {
104 struct fs_mii_bit mdio_dir;
105 struct fs_mii_bit mdio_dat;
106 struct fs_mii_bit mdc_dat;
107 int delay; /* delay in us */
108 int irq[32]; /* irqs per phy's */
111 struct fs_platform_info {
113 void(*init_ioports)(struct fs_platform_info *);
114 /* device specific information */
115 int fs_no; /* controller index */
116 char fs_type[4]; /* controller type */
118 u32 cp_page; /* CPM page */
119 u32 cp_block; /* CPM sblock */
120 u32 cp_command; /* CPM page/sblock/mcn */
122 u32 clk_trx; /* some stuff for pins & mux configuration*/
134 struct device_node *phy_node;
135 const struct fs_mii_bus_info *bus_info;
137 int rx_ring, tx_ring; /* number of buffers on rx */
138 __u8 macaddr[6]; /* mac address */
139 int rx_copybreak; /* limit we copy small frames */
140 int use_napi; /* use NAPI */
141 int napi_weight; /* NAPI weight */
143 int use_rmii; /* use RMII mode */
144 int has_phy; /* if the network is phy container as well...*/
146 struct fs_mii_fec_platform_info {
151 static inline int fs_get_id(struct fs_platform_info *fpi)
153 if(strstr(fpi->fs_type, "SCC"))
154 return fs_scc_index2id(fpi->fs_no);
155 if(strstr(fpi->fs_type, "FCC"))
156 return fs_fcc_index2id(fpi->fs_no);
157 if(strstr(fpi->fs_type, "FEC"))
158 return fs_fec_index2id(fpi->fs_no);