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/clk.h>
20 #include <linux/string.h>
21 #include <linux/of_mdio.h>
22 #include <linux/if_ether.h>
23 #include <asm/types.h>
25 #define FS_ENET_NAME "fs_enet"
39 #define FS_MAX_INDEX 9
41 static inline int fs_get_fec_index(enum fs_id id)
43 if (id >= fsid_fec1 && id <= fsid_fec2)
44 return id - fsid_fec1;
48 static inline int fs_get_fcc_index(enum fs_id id)
50 if (id >= fsid_fcc1 && id <= fsid_fcc3)
51 return id - fsid_fcc1;
55 static inline int fs_get_scc_index(enum fs_id id)
57 if (id >= fsid_scc1 && id <= fsid_scc4)
58 return id - fsid_scc1;
62 static inline int fs_fec_index2id(int index)
64 int id = fsid_fec1 + index - 1;
65 if (id >= fsid_fec1 && id <= fsid_fec2)
70 static inline int fs_fcc_index2id(int index)
72 int id = fsid_fcc1 + index - 1;
73 if (id >= fsid_fcc1 && id <= fsid_fcc3)
78 static inline int fs_scc_index2id(int index)
80 int id = fsid_scc1 + index - 1;
81 if (id >= fsid_scc1 && id <= fsid_scc4)
105 struct fs_mii_bb_platform_info {
106 struct fs_mii_bit mdio_dir;
107 struct fs_mii_bit mdio_dat;
108 struct fs_mii_bit mdc_dat;
109 int delay; /* delay in us */
110 int irq[32]; /* irqs per phy's */
113 struct fs_platform_info {
115 void(*init_ioports)(struct fs_platform_info *);
116 /* device specific information */
117 int fs_no; /* controller index */
118 char fs_type[4]; /* controller type */
120 u32 cp_page; /* CPM page */
121 u32 cp_block; /* CPM sblock */
122 u32 cp_command; /* CPM page/sblock/mcn */
124 u32 clk_trx; /* some stuff for pins & mux configuration*/
136 struct device_node *phy_node;
137 const struct fs_mii_bus_info *bus_info;
139 int rx_ring, tx_ring; /* number of buffers on rx */
140 __u8 macaddr[ETH_ALEN]; /* mac address */
141 int rx_copybreak; /* limit we copy small frames */
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 clk *clk_per; /* 'per' clock for register access */
149 struct fs_mii_fec_platform_info {
154 static inline int fs_get_id(struct fs_platform_info *fpi)
156 if(strstr(fpi->fs_type, "SCC"))
157 return fs_scc_index2id(fpi->fs_no);
158 if(strstr(fpi->fs_type, "FCC"))
159 return fs_fcc_index2id(fpi->fs_no);
160 if(strstr(fpi->fs_type, "FEC"))
161 return fs_fec_index2id(fpi->fs_no);