| Pantelis Antoniou | 48257c4 | 2005-10-28 16:25:58 -0400 | [diff] [blame] | 1 | /* | 
|  | 2 | * Platform information definitions for the | 
|  | 3 | * universal Freescale Ethernet driver. | 
|  | 4 | * | 
|  | 5 | * Copyright (c) 2003 Intracom S.A. | 
|  | 6 | *  by Pantelis Antoniou <panto@intracom.gr> | 
|  | 7 | * | 
|  | 8 | * 2005 (c) MontaVista Software, Inc. | 
|  | 9 | * Vitaly Bordug <vbordug@ru.mvista.com> | 
|  | 10 | * | 
|  | 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. | 
|  | 14 | */ | 
|  | 15 |  | 
|  | 16 | #ifndef FS_ENET_PD_H | 
|  | 17 | #define FS_ENET_PD_H | 
|  | 18 |  | 
| Pantelis Antoniou | 48257c4 | 2005-10-28 16:25:58 -0400 | [diff] [blame] | 19 | #include <asm/types.h> | 
|  | 20 |  | 
|  | 21 | #define FS_ENET_NAME	"fs_enet" | 
|  | 22 |  | 
|  | 23 | enum fs_id { | 
|  | 24 | fsid_fec1, | 
|  | 25 | fsid_fec2, | 
|  | 26 | fsid_fcc1, | 
|  | 27 | fsid_fcc2, | 
|  | 28 | fsid_fcc3, | 
|  | 29 | fsid_scc1, | 
|  | 30 | fsid_scc2, | 
|  | 31 | fsid_scc3, | 
|  | 32 | fsid_scc4, | 
|  | 33 | }; | 
|  | 34 |  | 
|  | 35 | #define FS_MAX_INDEX	9 | 
|  | 36 |  | 
|  | 37 | static inline int fs_get_fec_index(enum fs_id id) | 
|  | 38 | { | 
|  | 39 | if (id >= fsid_fec1 && id <= fsid_fec2) | 
|  | 40 | return id - fsid_fec1; | 
|  | 41 | return -1; | 
|  | 42 | } | 
|  | 43 |  | 
|  | 44 | static inline int fs_get_fcc_index(enum fs_id id) | 
|  | 45 | { | 
|  | 46 | if (id >= fsid_fcc1 && id <= fsid_fcc3) | 
|  | 47 | return id - fsid_fcc1; | 
|  | 48 | return -1; | 
|  | 49 | } | 
|  | 50 |  | 
|  | 51 | static inline int fs_get_scc_index(enum fs_id id) | 
|  | 52 | { | 
|  | 53 | if (id >= fsid_scc1 && id <= fsid_scc4) | 
|  | 54 | return id - fsid_scc1; | 
|  | 55 | return -1; | 
|  | 56 | } | 
|  | 57 |  | 
| Vitaly Bordug | 611a15a | 2006-09-21 22:38:05 +0400 | [diff] [blame] | 58 | static inline int fs_fec_index2id(int index) | 
|  | 59 | { | 
|  | 60 | int id = fsid_fec1 + index - 1; | 
|  | 61 | if (id >= fsid_fec1 && id <= fsid_fec2) | 
|  | 62 | return id; | 
|  | 63 | return FS_MAX_INDEX; | 
|  | 64 | } | 
|  | 65 |  | 
|  | 66 | static inline int fs_fcc_index2id(int index) | 
|  | 67 | { | 
|  | 68 | int id = fsid_fcc1 + index - 1; | 
|  | 69 | if (id >= fsid_fcc1 && id <= fsid_fcc3) | 
|  | 70 | return id; | 
|  | 71 | return FS_MAX_INDEX; | 
|  | 72 | } | 
|  | 73 |  | 
|  | 74 | static inline int fs_scc_index2id(int index) | 
|  | 75 | { | 
|  | 76 | int id = fsid_scc1 + index - 1; | 
|  | 77 | if (id >= fsid_scc1 && id <= fsid_scc4) | 
|  | 78 | return id; | 
|  | 79 | return FS_MAX_INDEX; | 
|  | 80 | } | 
|  | 81 |  | 
| Pantelis Antoniou | 48257c4 | 2005-10-28 16:25:58 -0400 | [diff] [blame] | 82 | enum fs_mii_method { | 
|  | 83 | fsmii_fixed, | 
|  | 84 | fsmii_fec, | 
|  | 85 | fsmii_bitbang, | 
|  | 86 | }; | 
|  | 87 |  | 
|  | 88 | enum fs_ioport { | 
|  | 89 | fsiop_porta, | 
|  | 90 | fsiop_portb, | 
|  | 91 | fsiop_portc, | 
|  | 92 | fsiop_portd, | 
|  | 93 | fsiop_porte, | 
|  | 94 | }; | 
|  | 95 |  | 
| Vitaly Bordug | 2ca2d5e | 2006-08-14 23:00:31 -0700 | [diff] [blame] | 96 | struct fs_mii_bit { | 
|  | 97 | u32 offset; | 
|  | 98 | u8 bit; | 
|  | 99 | u8 polarity; | 
|  | 100 | }; | 
|  | 101 | struct fs_mii_bb_platform_info { | 
|  | 102 | struct fs_mii_bit 	mdio_dir; | 
|  | 103 | struct fs_mii_bit 	mdio_dat; | 
|  | 104 | struct fs_mii_bit	mdc_dat; | 
|  | 105 | int mdio_port;	/* port & bit for MDIO */ | 
|  | 106 | int mdio_bit; | 
|  | 107 | int mdc_port;	/* port & bit for MDC  */ | 
|  | 108 | int mdc_bit; | 
|  | 109 | int delay;	/* delay in us         */ | 
|  | 110 | int irq[32]; 	/* irqs per phy's */ | 
| Pantelis Antoniou | 48257c4 | 2005-10-28 16:25:58 -0400 | [diff] [blame] | 111 | }; | 
|  | 112 |  | 
|  | 113 | struct fs_platform_info { | 
| Vitaly Bordug | d3465c9 | 2006-09-21 22:38:05 +0400 | [diff] [blame] | 114 |  | 
|  | 115 | void(*init_ioports)(struct fs_platform_info *); | 
| Pantelis Antoniou | 48257c4 | 2005-10-28 16:25:58 -0400 | [diff] [blame] | 116 | /* device specific information */ | 
|  | 117 | int fs_no;		/* controller index            */ | 
| Vitaly Bordug | 611a15a | 2006-09-21 22:38:05 +0400 | [diff] [blame] | 118 | char fs_type[4];	/* controller type             */ | 
| Pantelis Antoniou | 48257c4 | 2005-10-28 16:25:58 -0400 | [diff] [blame] | 119 |  | 
|  | 120 | u32 cp_page;		/* CPM page */ | 
|  | 121 | u32 cp_block;		/* CPM sblock */ | 
| Vitaly Bordug | d3465c9 | 2006-09-21 22:38:05 +0400 | [diff] [blame] | 122 |  | 
| Pantelis Antoniou | 48257c4 | 2005-10-28 16:25:58 -0400 | [diff] [blame] | 123 | u32 clk_trx;		/* some stuff for pins & mux configuration*/ | 
| Vitaly Bordug | d3465c9 | 2006-09-21 22:38:05 +0400 | [diff] [blame] | 124 | u32 clk_rx; | 
|  | 125 | u32 clk_tx; | 
| Pantelis Antoniou | 48257c4 | 2005-10-28 16:25:58 -0400 | [diff] [blame] | 126 | u32 clk_route; | 
|  | 127 | u32 clk_mask; | 
| Vitaly Bordug | d3465c9 | 2006-09-21 22:38:05 +0400 | [diff] [blame] | 128 |  | 
| Pantelis Antoniou | 48257c4 | 2005-10-28 16:25:58 -0400 | [diff] [blame] | 129 | u32 mem_offset; | 
|  | 130 | u32 dpram_offset; | 
|  | 131 | u32 fcc_regs_c; | 
|  | 132 |  | 
|  | 133 | u32 device_flags; | 
|  | 134 |  | 
|  | 135 | int phy_addr;		/* the phy address (-1 no phy) */ | 
| Vitaly Bordug | 2ca2d5e | 2006-08-14 23:00:31 -0700 | [diff] [blame] | 136 | const char*	bus_id; | 
| Pantelis Antoniou | 48257c4 | 2005-10-28 16:25:58 -0400 | [diff] [blame] | 137 | int phy_irq;		/* the phy irq (if it exists)  */ | 
|  | 138 |  | 
|  | 139 | const struct fs_mii_bus_info *bus_info; | 
|  | 140 |  | 
|  | 141 | int rx_ring, tx_ring;	/* number of buffers on rx     */ | 
|  | 142 | __u8 macaddr[6];	/* mac address                 */ | 
|  | 143 | int rx_copybreak;	/* limit we copy small frames  */ | 
|  | 144 | int use_napi;		/* use NAPI                    */ | 
|  | 145 | int napi_weight;	/* NAPI weight                 */ | 
|  | 146 |  | 
|  | 147 | int use_rmii;		/* use RMII mode 	       */ | 
| Vitaly Bordug | 2ca2d5e | 2006-08-14 23:00:31 -0700 | [diff] [blame] | 148 | int has_phy;            /* if the network is phy container as well...*/ | 
| Pantelis Antoniou | 48257c4 | 2005-10-28 16:25:58 -0400 | [diff] [blame] | 149 | }; | 
| Vitaly Bordug | 2ca2d5e | 2006-08-14 23:00:31 -0700 | [diff] [blame] | 150 | struct fs_mii_fec_platform_info { | 
|  | 151 | u32 irq[32]; | 
|  | 152 | u32 mii_speed; | 
|  | 153 | }; | 
| Vitaly Bordug | 611a15a | 2006-09-21 22:38:05 +0400 | [diff] [blame] | 154 |  | 
|  | 155 | static inline int fs_get_id(struct fs_platform_info *fpi) | 
|  | 156 | { | 
|  | 157 | if(strstr(fpi->fs_type, "SCC")) | 
|  | 158 | return fs_scc_index2id(fpi->fs_no); | 
|  | 159 | if(strstr(fpi->fs_type, "FCC")) | 
|  | 160 | return fs_fcc_index2id(fpi->fs_no); | 
|  | 161 | if(strstr(fpi->fs_type, "FEC")) | 
|  | 162 | return fs_fec_index2id(fpi->fs_no); | 
|  | 163 | return fpi->fs_no; | 
|  | 164 | } | 
|  | 165 |  | 
| Pantelis Antoniou | 48257c4 | 2005-10-28 16:25:58 -0400 | [diff] [blame] | 166 | #endif |