1 #ifndef CYGONCE_DEVS_RATTLER_ETH_INL
2 #define CYGONCE_DEVS_RATTLER_ETH_INL
3 //==========================================================================
7 // Hardware specifics for A&M Rattler ethernet support
9 //==========================================================================
10 //####ECOSGPLCOPYRIGHTBEGIN####
11 // -------------------------------------------
12 // This file is part of eCos, the Embedded Configurable Operating System.
13 // Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc.
14 // Copyright (C) 2003 Gary Thomas
16 // eCos is free software; you can redistribute it and/or modify it under
17 // the terms of the GNU General Public License as published by the Free
18 // Software Foundation; either version 2 or (at your option) any later version.
20 // eCos is distributed in the hope that it will be useful, but WITHOUT ANY
21 // WARRANTY; without even the implied warranty of MERCHANTABILITY or
22 // FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
25 // You should have received a copy of the GNU General Public License along
26 // with eCos; if not, write to the Free Software Foundation, Inc.,
27 // 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
29 // As a special exception, if other files instantiate templates or use macros
30 // or inline functions from this file, or you compile this file and link it
31 // with other works to produce a work based on this file, this file does not
32 // by itself cause the resulting work to be covered by the GNU General Public
33 // License. However the source code for this file must still be made available
34 // in accordance with section (3) of the GNU General Public License.
36 // This exception does not invalidate any other reasons why a work based on
37 // this file might be covered by the GNU General Public License.
39 // Alternative licenses for eCos may be arranged by contacting Red Hat, Inc.
40 // at http://sources.redhat.com/ecos/ecos-license/
41 // -------------------------------------------
42 //####ECOSGPLCOPYRIGHTEND####
43 //==========================================================================
44 //#####DESCRIPTIONBEGIN####
47 // Contributors: gthomas,F.Robbins
52 //####DESCRIPTIONEND####
54 //==========================================================================
57 // Pin layout for PHY connections
59 #define FCC1_PHY_RESET 0x01000000
60 #define FCC1_PHY_DATA 0x10000000
61 #define FCC1_PHY_CLOCK 0x20000000
62 #define FCC2_PHY_RESET 0x02000000
63 #define FCC2_PHY_DATA 0x04000000
64 #define FCC2_PHY_CLOCK 0x08000000
66 #ifdef CYGHWR_DEVS_ETH_POWERPC_RATTLER_FCC1
68 // Initialize the PHY associated with FCC1/eth0
73 // Set up PHY reset line
74 IMM->io_regs[PORT_B].pdat |= FCC1_PHY_RESET;
75 IMM->io_regs[PORT_C].pdir |= FCC1_PHY_CLOCK;
79 // Reset the PHY associated with FCC1/eth0
84 // Toggle PHY reset line
85 IMM->io_regs[PORT_B].pdat &= ~FCC1_PHY_RESET;
86 IMM->io_regs[PORT_B].pdat |= FCC1_PHY_RESET;
90 // Set up a particular data bit for FCC1/eth0
93 fcc1_phy_set_data(int val)
97 IMM->io_regs[PORT_C].pdat |= FCC1_PHY_DATA;
100 IMM->io_regs[PORT_C].pdat &= ~FCC1_PHY_DATA;
105 // Read the current data bit for FCC1/eth0
108 fcc1_phy_get_data(void)
110 if ((IMM->io_regs[PORT_C].pdat & FCC1_PHY_DATA) != 0) {
118 // Set the clock bit for FCC1/eth0
121 fcc1_phy_set_clock(int val)
125 IMM->io_regs[PORT_C].pdat |= FCC1_PHY_CLOCK;
128 IMM->io_regs[PORT_C].pdat &= ~FCC1_PHY_CLOCK;
133 // Set the clock/data direction for FCC1/eth0
134 // Note: always forces clock to be an output
137 fcc1_phy_set_dir(int data_dir)
141 IMM->io_regs[PORT_C].pdir |= FCC1_PHY_DATA;
144 IMM->io_regs[PORT_C].pdir &= ~FCC1_PHY_DATA;
148 ETH_PHY_BIT_LEVEL_ACCESS_FUNS(fcc1_phy,
156 static unsigned char fcc_eth0_rxbufs[CYGNUM_DEVS_ETH_POWERPC_FCC_RxNUM *
157 (CYGNUM_DEVS_ETH_POWERPC_FCC_BUFSIZE + 32)];
158 static unsigned char fcc_eth0_txbufs[CYGNUM_DEVS_ETH_POWERPC_FCC_TxNUM *
159 (CYGNUM_DEVS_ETH_POWERPC_FCC_BUFSIZE + 32)];
161 #ifdef CYGSEM_REDBOOT_FLASH_CONFIG
162 RedBoot_config_option("FCC1/eth0 Network hardware address [MAC]",
164 ALWAYS_ENABLED, true,
169 static struct fcc_eth_info fcc_eth0_info = {
170 CYGNUM_HAL_INTERRUPT_FCC1, // Interrupt
171 "fcc1_esa", // ESA 'key'
172 { 0x00, 0x08, 0xe5, 0x11, 0x22, 0x33 }, // Fallback ESA
173 CYGNUM_DEVS_ETH_POWERPC_FCC_RxNUM, // Number of Rx buffers
174 fcc_eth0_rxbufs, // Pointer to buffers
175 CYGNUM_DEVS_ETH_POWERPC_FCC_TxNUM, // Number of Tx buffers
176 fcc_eth0_txbufs, // Pointer to buffers
180 ETH_DRV_SC(fcc_eth0_sc,
181 &fcc_eth0_info, // Driver specific data
182 "eth0", // Name for this interface
193 NETDEVTAB_ENTRY(fcc_eth0_netdev,
197 #endif // CYGHWR_DEVS_ETH_POWERPC_RATTLER_FCC1
199 #ifdef CYGHWR_DEVS_ETH_POWERPC_RATTLER_FCC2
201 // Initialize the PHY associated with FCC2/eth1
206 // Set up PHY reset line
207 IMM->io_regs[PORT_B].pdat |= FCC2_PHY_RESET;
208 IMM->io_regs[PORT_C].pdir |= FCC2_PHY_CLOCK;
212 // Reset the PHY associated with FCC2/eth1
217 // Toggle the PHY reset line
218 IMM->io_regs[PORT_B].pdat &= ~FCC2_PHY_RESET;
219 IMM->io_regs[PORT_B].pdat |= FCC2_PHY_RESET;
223 // Set up a particular data bit for FCC2/eth1
226 fcc2_phy_set_data(int val)
230 IMM->io_regs[PORT_C].pdat |= FCC2_PHY_DATA;
233 IMM->io_regs[PORT_C].pdat &= ~FCC2_PHY_DATA;
238 // Read the current data bit for FCC2/eth1
241 fcc2_phy_get_data(void)
243 if ((IMM->io_regs[PORT_C].pdat & FCC2_PHY_DATA) != 0) {
251 // Set the clock bit for FCC2/eth1
254 fcc2_phy_set_clock(int val)
258 IMM->io_regs[PORT_C].pdat |= FCC2_PHY_CLOCK;
261 IMM->io_regs[PORT_C].pdat &= ~FCC2_PHY_CLOCK;
266 // Set the clock/data direction for FCC2/eth1
267 // Note: always forces clock to be an output
270 fcc2_phy_set_dir(int data_dir)
274 IMM->io_regs[PORT_C].pdir |= FCC2_PHY_DATA;
277 IMM->io_regs[PORT_C].pdir &= ~FCC2_PHY_DATA;
281 ETH_PHY_BIT_LEVEL_ACCESS_FUNS(fcc2_phy,
289 static unsigned char fcc_eth1_rxbufs[CYGNUM_DEVS_ETH_POWERPC_FCC_RxNUM *
290 (CYGNUM_DEVS_ETH_POWERPC_FCC_BUFSIZE + 32)];
291 static unsigned char fcc_eth1_txbufs[CYGNUM_DEVS_ETH_POWERPC_FCC_TxNUM *
292 (CYGNUM_DEVS_ETH_POWERPC_FCC_BUFSIZE + 32)];
294 #ifdef CYGSEM_REDBOOT_FLASH_CONFIG
295 RedBoot_config_option("FCC2/eth1 Network hardware address [MAC]",
297 ALWAYS_ENABLED, true,
302 static struct fcc_eth_info fcc_eth1_info = {
303 CYGNUM_HAL_INTERRUPT_FCC2, // Interrupt
304 "fcc2_esa", // ESA 'key'
305 { 0x00, 0x08, 0xe5, 0x11, 0x22, 0x33 }, // Fallback ESA
306 CYGNUM_DEVS_ETH_POWERPC_FCC_RxNUM, // Number of Rx buffers
307 fcc_eth1_rxbufs, // Pointer to buffers
308 CYGNUM_DEVS_ETH_POWERPC_FCC_TxNUM, // Number of Tx buffers
309 fcc_eth1_txbufs, // Pointer to buffers
313 ETH_DRV_SC(fcc_eth1_sc,
314 &fcc_eth1_info, // Driver specific data
315 "eth1", // Name for this interface
326 NETDEVTAB_ENTRY(fcc_eth1_netdev,
330 #endif // CYGHWR_DEVS_ETH_POWERPC_RATTLER_FCC2
332 #endif // CYGONCE_DEVS_RATTLER_ETH_INL
333 // ------------------------------------------------------------------------