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 <asm/types.h>
22 #define FS_ENET_NAME "fs_enet"
36 #define FS_MAX_INDEX 9
38 static inline int fs_get_fec_index(enum fs_id id
)
40 if (id
>= fsid_fec1
&& id
<= fsid_fec2
)
41 return id
- fsid_fec1
;
45 static inline int fs_get_fcc_index(enum fs_id id
)
47 if (id
>= fsid_fcc1
&& id
<= fsid_fcc3
)
48 return id
- fsid_fcc1
;
52 static inline int fs_get_scc_index(enum fs_id id
)
54 if (id
>= fsid_scc1
&& id
<= fsid_scc4
)
55 return id
- fsid_scc1
;
59 static inline int fs_fec_index2id(int index
)
61 int id
= fsid_fec1
+ index
- 1;
62 if (id
>= fsid_fec1
&& id
<= fsid_fec2
)
67 static inline int fs_fcc_index2id(int index
)
69 int id
= fsid_fcc1
+ index
- 1;
70 if (id
>= fsid_fcc1
&& id
<= fsid_fcc3
)
75 static inline int fs_scc_index2id(int index
)
77 int id
= fsid_scc1
+ index
- 1;
78 if (id
>= fsid_scc1
&& id
<= fsid_scc4
)
102 struct fs_mii_bb_platform_info
{
103 struct fs_mii_bit mdio_dir
;
104 struct fs_mii_bit mdio_dat
;
105 struct fs_mii_bit mdc_dat
;
106 int delay
; /* delay in us */
107 int irq
[32]; /* irqs per phy's */
110 struct fs_platform_info
{
112 void(*init_ioports
)(struct fs_platform_info
*);
113 /* device specific information */
114 int fs_no
; /* controller index */
115 char fs_type
[4]; /* controller type */
117 u32 cp_page
; /* CPM page */
118 u32 cp_block
; /* CPM sblock */
119 u32 cp_command
; /* CPM page/sblock/mcn */
121 u32 clk_trx
; /* some stuff for pins & mux configuration*/
133 int phy_addr
; /* the phy address (-1 no phy) */
135 int phy_irq
; /* the phy irq (if it exists) */
137 const struct fs_mii_bus_info
*bus_info
;
139 int rx_ring
, tx_ring
; /* number of buffers on rx */
140 __u8 macaddr
[6]; /* mac address */
141 int rx_copybreak
; /* limit we copy small frames */
142 int use_napi
; /* use NAPI */
143 int napi_weight
; /* NAPI weight */
145 int use_rmii
; /* use RMII mode */
146 int has_phy
; /* if the network is phy container as well...*/
148 struct fs_mii_fec_platform_info
{
153 static inline int fs_get_id(struct fs_platform_info
*fpi
)
155 if(strstr(fpi
->fs_type
, "SCC"))
156 return fs_scc_index2id(fpi
->fs_no
);
157 if(strstr(fpi
->fs_type
, "FCC"))
158 return fs_fcc_index2id(fpi
->fs_no
);
159 if(strstr(fpi
->fs_type
, "FEC"))
160 return fs_fec_index2id(fpi
->fs_no
);