wdenk | 2abbe07 | 2003-06-16 23:50:08 +0000 | [diff] [blame] | 1 | /* |
| 2 | * (C) Copyright 2003 |
| 3 | * Author : Hamid Ikdoumi (Atmel) |
| 4 | * |
| 5 | * See file CREDITS for list of people who contributed to this |
| 6 | * project. |
| 7 | * |
| 8 | * This program is free software; you can redistribute it and/or |
| 9 | * modify it under the terms of the GNU General Public License as |
| 10 | * published by the Free Software Foundation; either version 2 of |
| 11 | * the License, or (at your option) any later version. |
| 12 | * |
| 13 | * This program is distributed in the hope that it will be useful, |
| 14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 16 | * GNU General Public License for more details. |
| 17 | * |
| 18 | * You should have received a copy of the GNU General Public License |
| 19 | * along with this program; if not, write to the Free Software |
| 20 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, |
| 21 | * MA 02111-1307 USA |
| 22 | */ |
| 23 | |
| 24 | #include <at91rm9200_net.h> |
| 25 | #include <net.h> |
Marian Balakowicz | 63ff004 | 2005-10-28 22:30:33 +0200 | [diff] [blame] | 26 | #include <miiphy.h> |
David Brownell | 7168eba | 2009-06-09 11:14:24 -0700 | [diff] [blame] | 27 | #include <asm/mach-types.h> |
wdenk | 2abbe07 | 2003-06-16 23:50:08 +0000 | [diff] [blame] | 28 | |
| 29 | /* ----- Ethernet Buffer definitions ----- */ |
| 30 | |
| 31 | typedef struct { |
| 32 | unsigned long addr, size; |
| 33 | } rbf_t; |
| 34 | |
| 35 | #define RBF_ADDR 0xfffffffc |
| 36 | #define RBF_OWNER (1<<0) |
| 37 | #define RBF_WRAP (1<<1) |
| 38 | #define RBF_BROADCAST (1<<31) |
| 39 | #define RBF_MULTICAST (1<<30) |
| 40 | #define RBF_UNICAST (1<<29) |
| 41 | #define RBF_EXTERNAL (1<<28) |
| 42 | #define RBF_UNKOWN (1<<27) |
| 43 | #define RBF_SIZE 0x07ff |
| 44 | #define RBF_LOCAL4 (1<<26) |
| 45 | #define RBF_LOCAL3 (1<<25) |
| 46 | #define RBF_LOCAL2 (1<<24) |
| 47 | #define RBF_LOCAL1 (1<<23) |
| 48 | |
Wolfgang Denk | 95f9dda | 2005-10-09 00:33:37 +0200 | [diff] [blame] | 49 | #define RBF_FRAMEMAX 64 |
wdenk | 2abbe07 | 2003-06-16 23:50:08 +0000 | [diff] [blame] | 50 | #define RBF_FRAMELEN 0x600 |
| 51 | |
wdenk | 2abbe07 | 2003-06-16 23:50:08 +0000 | [diff] [blame] | 52 | #ifdef CONFIG_DRIVER_ETHER |
| 53 | |
Jon Loeliger | 3a1ed1e | 2007-07-09 18:57:22 -0500 | [diff] [blame] | 54 | #if defined(CONFIG_CMD_NET) |
wdenk | 2abbe07 | 2003-06-16 23:50:08 +0000 | [diff] [blame] | 55 | |
Wolfgang Denk | 95f9dda | 2005-10-09 00:33:37 +0200 | [diff] [blame] | 56 | /* alignment as per Errata #11 (64 bytes) is insufficient! */ |
Peter Tyser | f9a109b | 2009-04-20 11:08:46 -0500 | [diff] [blame] | 57 | rbf_t rbfdt[RBF_FRAMEMAX] __attribute__((aligned(512))); |
Wolfgang Denk | 95f9dda | 2005-10-09 00:33:37 +0200 | [diff] [blame] | 58 | rbf_t *rbfp; |
| 59 | |
Peter Tyser | f9a109b | 2009-04-20 11:08:46 -0500 | [diff] [blame] | 60 | unsigned char rbf_framebuf[RBF_FRAMEMAX][RBF_FRAMELEN] |
| 61 | __attribute__((aligned(4))); |
Wolfgang Denk | 95f9dda | 2005-10-09 00:33:37 +0200 | [diff] [blame] | 62 | |
wdenk | 2abbe07 | 2003-06-16 23:50:08 +0000 | [diff] [blame] | 63 | /* structure to interface the PHY */ |
wdenk | 429168e | 2004-08-02 23:39:03 +0000 | [diff] [blame] | 64 | AT91S_PhyOps PhyOps; |
wdenk | 2abbe07 | 2003-06-16 23:50:08 +0000 | [diff] [blame] | 65 | |
| 66 | AT91PS_EMAC p_mac; |
| 67 | |
wdenk | 2abbe07 | 2003-06-16 23:50:08 +0000 | [diff] [blame] | 68 | /*********** EMAC Phy layer Management functions *************************/ |
| 69 | /* |
wdenk | 8bde7f7 | 2003-06-27 21:31:46 +0000 | [diff] [blame] | 70 | * Name: |
wdenk | 2abbe07 | 2003-06-16 23:50:08 +0000 | [diff] [blame] | 71 | * at91rm9200_EmacEnableMDIO |
wdenk | 8bde7f7 | 2003-06-27 21:31:46 +0000 | [diff] [blame] | 72 | * Description: |
wdenk | 2abbe07 | 2003-06-16 23:50:08 +0000 | [diff] [blame] | 73 | * Enables the MDIO bit in MAC control register |
wdenk | 8bde7f7 | 2003-06-27 21:31:46 +0000 | [diff] [blame] | 74 | * Arguments: |
wdenk | 2abbe07 | 2003-06-16 23:50:08 +0000 | [diff] [blame] | 75 | * p_mac - pointer to struct AT91S_EMAC |
wdenk | 8bde7f7 | 2003-06-27 21:31:46 +0000 | [diff] [blame] | 76 | * Return value: |
wdenk | 2abbe07 | 2003-06-16 23:50:08 +0000 | [diff] [blame] | 77 | * none |
| 78 | */ |
wdenk | 429168e | 2004-08-02 23:39:03 +0000 | [diff] [blame] | 79 | void at91rm9200_EmacEnableMDIO (AT91PS_EMAC p_mac) |
wdenk | 2abbe07 | 2003-06-16 23:50:08 +0000 | [diff] [blame] | 80 | { |
| 81 | /* Mac CTRL reg set for MDIO enable */ |
| 82 | p_mac->EMAC_CTL |= AT91C_EMAC_MPE; /* Management port enable */ |
| 83 | } |
| 84 | |
| 85 | /* |
wdenk | 8bde7f7 | 2003-06-27 21:31:46 +0000 | [diff] [blame] | 86 | * Name: |
wdenk | 2abbe07 | 2003-06-16 23:50:08 +0000 | [diff] [blame] | 87 | * at91rm9200_EmacDisableMDIO |
wdenk | 8bde7f7 | 2003-06-27 21:31:46 +0000 | [diff] [blame] | 88 | * Description: |
wdenk | 2abbe07 | 2003-06-16 23:50:08 +0000 | [diff] [blame] | 89 | * Disables the MDIO bit in MAC control register |
wdenk | 8bde7f7 | 2003-06-27 21:31:46 +0000 | [diff] [blame] | 90 | * Arguments: |
wdenk | 2abbe07 | 2003-06-16 23:50:08 +0000 | [diff] [blame] | 91 | * p_mac - pointer to struct AT91S_EMAC |
wdenk | 8bde7f7 | 2003-06-27 21:31:46 +0000 | [diff] [blame] | 92 | * Return value: |
wdenk | 2abbe07 | 2003-06-16 23:50:08 +0000 | [diff] [blame] | 93 | * none |
| 94 | */ |
wdenk | 429168e | 2004-08-02 23:39:03 +0000 | [diff] [blame] | 95 | void at91rm9200_EmacDisableMDIO (AT91PS_EMAC p_mac) |
wdenk | 2abbe07 | 2003-06-16 23:50:08 +0000 | [diff] [blame] | 96 | { |
| 97 | /* Mac CTRL reg set for MDIO disable */ |
| 98 | p_mac->EMAC_CTL &= ~AT91C_EMAC_MPE; /* Management port disable */ |
| 99 | } |
| 100 | |
| 101 | |
| 102 | /* |
wdenk | 8bde7f7 | 2003-06-27 21:31:46 +0000 | [diff] [blame] | 103 | * Name: |
wdenk | 2abbe07 | 2003-06-16 23:50:08 +0000 | [diff] [blame] | 104 | * at91rm9200_EmacReadPhy |
wdenk | 8bde7f7 | 2003-06-27 21:31:46 +0000 | [diff] [blame] | 105 | * Description: |
wdenk | 2abbe07 | 2003-06-16 23:50:08 +0000 | [diff] [blame] | 106 | * Reads data from the PHY register |
wdenk | 8bde7f7 | 2003-06-27 21:31:46 +0000 | [diff] [blame] | 107 | * Arguments: |
wdenk | 2abbe07 | 2003-06-16 23:50:08 +0000 | [diff] [blame] | 108 | * dev - pointer to struct net_device |
| 109 | * RegisterAddress - unsigned char |
Wolfgang Denk | 53677ef | 2008-05-20 16:00:29 +0200 | [diff] [blame] | 110 | * pInput - pointer to value read from register |
wdenk | 8bde7f7 | 2003-06-27 21:31:46 +0000 | [diff] [blame] | 111 | * Return value: |
wdenk | 2abbe07 | 2003-06-16 23:50:08 +0000 | [diff] [blame] | 112 | * TRUE - if data read successfully |
| 113 | */ |
wdenk | 429168e | 2004-08-02 23:39:03 +0000 | [diff] [blame] | 114 | UCHAR at91rm9200_EmacReadPhy (AT91PS_EMAC p_mac, |
wdenk | 2abbe07 | 2003-06-16 23:50:08 +0000 | [diff] [blame] | 115 | unsigned char RegisterAddress, |
| 116 | unsigned short *pInput) |
| 117 | { |
| 118 | p_mac->EMAC_MAN = (AT91C_EMAC_HIGH & ~AT91C_EMAC_LOW) | |
wdenk | 074cff0 | 2004-02-24 00:16:43 +0000 | [diff] [blame] | 119 | (AT91C_EMAC_RW_R) | |
| 120 | (RegisterAddress << 18) | |
| 121 | (AT91C_EMAC_CODE_802_3); |
wdenk | 2abbe07 | 2003-06-16 23:50:08 +0000 | [diff] [blame] | 122 | |
| 123 | udelay (10000); |
| 124 | |
| 125 | *pInput = (unsigned short) p_mac->EMAC_MAN; |
| 126 | |
| 127 | return TRUE; |
| 128 | } |
| 129 | |
| 130 | |
| 131 | /* |
wdenk | 8bde7f7 | 2003-06-27 21:31:46 +0000 | [diff] [blame] | 132 | * Name: |
wdenk | 2abbe07 | 2003-06-16 23:50:08 +0000 | [diff] [blame] | 133 | * at91rm9200_EmacWritePhy |
wdenk | 8bde7f7 | 2003-06-27 21:31:46 +0000 | [diff] [blame] | 134 | * Description: |
wdenk | 2abbe07 | 2003-06-16 23:50:08 +0000 | [diff] [blame] | 135 | * Writes data to the PHY register |
wdenk | 8bde7f7 | 2003-06-27 21:31:46 +0000 | [diff] [blame] | 136 | * Arguments: |
wdenk | 2abbe07 | 2003-06-16 23:50:08 +0000 | [diff] [blame] | 137 | * dev - pointer to struct net_device |
| 138 | * RegisterAddress - unsigned char |
Wolfgang Denk | 53677ef | 2008-05-20 16:00:29 +0200 | [diff] [blame] | 139 | * pOutput - pointer to value to be written in the register |
wdenk | 8bde7f7 | 2003-06-27 21:31:46 +0000 | [diff] [blame] | 140 | * Return value: |
wdenk | 2abbe07 | 2003-06-16 23:50:08 +0000 | [diff] [blame] | 141 | * TRUE - if data read successfully |
| 142 | */ |
wdenk | 429168e | 2004-08-02 23:39:03 +0000 | [diff] [blame] | 143 | UCHAR at91rm9200_EmacWritePhy (AT91PS_EMAC p_mac, |
wdenk | a3ad8e2 | 2003-10-19 23:22:11 +0000 | [diff] [blame] | 144 | unsigned char RegisterAddress, |
| 145 | unsigned short *pOutput) |
wdenk | 2abbe07 | 2003-06-16 23:50:08 +0000 | [diff] [blame] | 146 | { |
| 147 | p_mac->EMAC_MAN = (AT91C_EMAC_HIGH & ~AT91C_EMAC_LOW) | |
| 148 | AT91C_EMAC_CODE_802_3 | AT91C_EMAC_RW_W | |
wdenk | a3ad8e2 | 2003-10-19 23:22:11 +0000 | [diff] [blame] | 149 | (RegisterAddress << 18) | *pOutput; |
wdenk | 2abbe07 | 2003-06-16 23:50:08 +0000 | [diff] [blame] | 150 | |
| 151 | udelay (10000); |
| 152 | |
| 153 | return TRUE; |
| 154 | } |
| 155 | |
wdenk | 2abbe07 | 2003-06-16 23:50:08 +0000 | [diff] [blame] | 156 | int eth_init (bd_t * bd) |
| 157 | { |
| 158 | int ret; |
| 159 | int i; |
Mike Frysinger | 6bacfa6 | 2009-02-11 19:18:41 -0500 | [diff] [blame] | 160 | uchar enetaddr[6]; |
wdenk | 2abbe07 | 2003-06-16 23:50:08 +0000 | [diff] [blame] | 161 | |
| 162 | p_mac = AT91C_BASE_EMAC; |
| 163 | |
wdenk | 0b8fa03 | 2004-04-25 14:37:29 +0000 | [diff] [blame] | 164 | /* PIO Disable Register */ |
| 165 | *AT91C_PIOA_PDR = AT91C_PA16_EMDIO | AT91C_PA15_EMDC | AT91C_PA14_ERXER | |
| 166 | AT91C_PA13_ERX1 | AT91C_PA12_ERX0 | AT91C_PA11_ECRS_ECRSDV | |
| 167 | AT91C_PA10_ETX1 | AT91C_PA9_ETX0 | AT91C_PA8_ETXEN | |
| 168 | AT91C_PA7_ETXCK_EREFCK; |
wdenk | 2abbe07 | 2003-06-16 23:50:08 +0000 | [diff] [blame] | 169 | |
wdenk | ea287de | 2005-04-01 00:25:43 +0000 | [diff] [blame] | 170 | #ifdef CONFIG_AT91C_USE_RMII |
| 171 | *AT91C_PIOB_PDR = AT91C_PB19_ERXCK; |
| 172 | *AT91C_PIOB_BSR = AT91C_PB19_ERXCK; |
| 173 | #else |
| 174 | *AT91C_PIOB_PDR = AT91C_PB19_ERXCK | AT91C_PB18_ECOL | AT91C_PB17_ERXDV | |
wdenk | 0b8fa03 | 2004-04-25 14:37:29 +0000 | [diff] [blame] | 175 | AT91C_PB16_ERX3 | AT91C_PB15_ERX2 | AT91C_PB14_ETXER | |
| 176 | AT91C_PB13_ETX3 | AT91C_PB12_ETX2; |
wdenk | 2abbe07 | 2003-06-16 23:50:08 +0000 | [diff] [blame] | 177 | |
wdenk | 0b8fa03 | 2004-04-25 14:37:29 +0000 | [diff] [blame] | 178 | /* Select B Register */ |
wdenk | ea287de | 2005-04-01 00:25:43 +0000 | [diff] [blame] | 179 | *AT91C_PIOB_BSR = AT91C_PB19_ERXCK | AT91C_PB18_ECOL | |
wdenk | 0b8fa03 | 2004-04-25 14:37:29 +0000 | [diff] [blame] | 180 | AT91C_PB17_ERXDV | AT91C_PB16_ERX3 | AT91C_PB15_ERX2 | |
| 181 | AT91C_PB14_ETXER | AT91C_PB13_ETX3 | AT91C_PB12_ETX2; |
wdenk | 9d5028c | 2004-11-21 00:06:33 +0000 | [diff] [blame] | 182 | #endif |
wdenk | 2abbe07 | 2003-06-16 23:50:08 +0000 | [diff] [blame] | 183 | |
| 184 | *AT91C_PMC_PCER = 1 << AT91C_ID_EMAC; /* Peripheral Clock Enable Register */ |
| 185 | |
| 186 | p_mac->EMAC_CFG |= AT91C_EMAC_CSR; /* Clear statistics */ |
| 187 | |
David Brownell | 7168eba | 2009-06-09 11:14:24 -0700 | [diff] [blame] | 188 | /* Init Ethernet buffers */ |
wdenk | 2abbe07 | 2003-06-16 23:50:08 +0000 | [diff] [blame] | 189 | for (i = 0; i < RBF_FRAMEMAX; i++) { |
Wolfgang Denk | f57f70a | 2005-10-13 01:45:54 +0200 | [diff] [blame] | 190 | rbfdt[i].addr = (unsigned long)rbf_framebuf[i]; |
wdenk | 2abbe07 | 2003-06-16 23:50:08 +0000 | [diff] [blame] | 191 | rbfdt[i].size = 0; |
| 192 | } |
| 193 | rbfdt[RBF_FRAMEMAX - 1].addr |= RBF_WRAP; |
| 194 | rbfp = &rbfdt[0]; |
| 195 | |
Mike Frysinger | 6bacfa6 | 2009-02-11 19:18:41 -0500 | [diff] [blame] | 196 | eth_getenv_enetaddr("ethaddr", enetaddr); |
David Brownell | 7168eba | 2009-06-09 11:14:24 -0700 | [diff] [blame] | 197 | |
| 198 | /* The CSB337 originally used a version of the MicroMonitor bootloader |
| 199 | * which saved Ethernet addresses in the "wrong" order. Operating |
| 200 | * systems (like Linux) know this, and apply a workaround. Replicate |
| 201 | * that MicroMonitor behavior so we avoid needing to make such OS code |
| 202 | * care about which bootloader was used. |
| 203 | */ |
| 204 | if (machine_is_csb337()) { |
| 205 | p_mac->EMAC_SA2H = (enetaddr[0] << 8) | (enetaddr[1]); |
| 206 | p_mac->EMAC_SA2L = (enetaddr[2] << 24) | (enetaddr[3] << 16) |
| 207 | | (enetaddr[4] << 8) | (enetaddr[5]); |
| 208 | } else { |
| 209 | p_mac->EMAC_SA2L = (enetaddr[3] << 24) | (enetaddr[2] << 16) |
| 210 | | (enetaddr[1] << 8) | (enetaddr[0]); |
| 211 | p_mac->EMAC_SA2H = (enetaddr[5] << 8) | (enetaddr[4]); |
| 212 | } |
wdenk | 0b8fa03 | 2004-04-25 14:37:29 +0000 | [diff] [blame] | 213 | |
| 214 | p_mac->EMAC_RBQP = (long) (&rbfdt[0]); |
| 215 | p_mac->EMAC_RSR &= ~(AT91C_EMAC_RSR_OVR | AT91C_EMAC_REC | AT91C_EMAC_BNA); |
| 216 | |
| 217 | p_mac->EMAC_CFG = (p_mac->EMAC_CFG | AT91C_EMAC_CAF | AT91C_EMAC_NBC) |
| 218 | & ~AT91C_EMAC_CLK; |
| 219 | |
| 220 | #ifdef CONFIG_AT91C_USE_RMII |
| 221 | p_mac->EMAC_CFG |= AT91C_EMAC_RMII; |
| 222 | #endif |
| 223 | |
wdenk | ba83a30 | 2005-04-04 12:23:03 +0000 | [diff] [blame] | 224 | #if (AT91C_MASTER_CLOCK > 40000000) |
| 225 | /* MDIO clock must not exceed 2.5 MHz, so enable MCK divider */ |
| 226 | p_mac->EMAC_CFG |= AT91C_EMAC_CLK_HCLK_64; |
| 227 | #endif |
| 228 | |
wdenk | 0b8fa03 | 2004-04-25 14:37:29 +0000 | [diff] [blame] | 229 | p_mac->EMAC_CTL |= AT91C_EMAC_TE | AT91C_EMAC_RE; |
| 230 | |
Wolfgang Denk | 080bdb7 | 2005-10-05 01:51:29 +0200 | [diff] [blame] | 231 | at91rm9200_GetPhyInterface (& PhyOps); |
wdenk | 2abbe07 | 2003-06-16 23:50:08 +0000 | [diff] [blame] | 232 | |
wdenk | 429168e | 2004-08-02 23:39:03 +0000 | [diff] [blame] | 233 | if (!PhyOps.IsPhyConnected (p_mac)) |
wdenk | 2abbe07 | 2003-06-16 23:50:08 +0000 | [diff] [blame] | 234 | printf ("PHY not connected!!\n\r"); |
| 235 | |
| 236 | /* MII management start from here */ |
| 237 | if (!(p_mac->EMAC_SR & AT91C_EMAC_LINK)) { |
wdenk | 429168e | 2004-08-02 23:39:03 +0000 | [diff] [blame] | 238 | if (!(ret = PhyOps.Init (p_mac))) { |
wdenk | 2abbe07 | 2003-06-16 23:50:08 +0000 | [diff] [blame] | 239 | printf ("MAC: error during MII initialization\n"); |
| 240 | return 0; |
| 241 | } |
| 242 | } else { |
| 243 | printf ("No link\n\r"); |
| 244 | return 0; |
| 245 | } |
| 246 | |
wdenk | 2abbe07 | 2003-06-16 23:50:08 +0000 | [diff] [blame] | 247 | return 0; |
| 248 | } |
| 249 | |
| 250 | int eth_send (volatile void *packet, int length) |
| 251 | { |
| 252 | while (!(p_mac->EMAC_TSR & AT91C_EMAC_BNQ)); |
| 253 | p_mac->EMAC_TAR = (long) packet; |
| 254 | p_mac->EMAC_TCR = length; |
| 255 | while (p_mac->EMAC_TCR & 0x7ff); |
| 256 | p_mac->EMAC_TSR |= AT91C_EMAC_COMP; |
| 257 | return 0; |
| 258 | } |
| 259 | |
| 260 | int eth_rx (void) |
| 261 | { |
| 262 | int size; |
| 263 | |
| 264 | if (!(rbfp->addr & RBF_OWNER)) |
| 265 | return 0; |
| 266 | |
| 267 | size = rbfp->size & RBF_SIZE; |
| 268 | NetReceive ((volatile uchar *) (rbfp->addr & RBF_ADDR), size); |
| 269 | |
| 270 | rbfp->addr &= ~RBF_OWNER; |
| 271 | if (rbfp->addr & RBF_WRAP) |
| 272 | rbfp = &rbfdt[0]; |
| 273 | else |
| 274 | rbfp++; |
| 275 | |
| 276 | p_mac->EMAC_RSR |= AT91C_EMAC_REC; |
| 277 | |
| 278 | return size; |
| 279 | } |
| 280 | |
| 281 | void eth_halt (void) |
| 282 | { |
| 283 | }; |
wdenk | 074cff0 | 2004-02-24 00:16:43 +0000 | [diff] [blame] | 284 | |
Jon Loeliger | 3a1ed1e | 2007-07-09 18:57:22 -0500 | [diff] [blame] | 285 | #if defined(CONFIG_MII) || defined(CONFIG_CMD_MII) |
Marian Balakowicz | 63ff004 | 2005-10-28 22:30:33 +0200 | [diff] [blame] | 286 | int at91rm9200_miiphy_read(char *devname, unsigned char addr, |
| 287 | unsigned char reg, unsigned short * value) |
wdenk | 074cff0 | 2004-02-24 00:16:43 +0000 | [diff] [blame] | 288 | { |
| 289 | at91rm9200_EmacEnableMDIO (p_mac); |
| 290 | at91rm9200_EmacReadPhy (p_mac, reg, value); |
| 291 | at91rm9200_EmacDisableMDIO (p_mac); |
| 292 | return 0; |
| 293 | } |
| 294 | |
Marian Balakowicz | 63ff004 | 2005-10-28 22:30:33 +0200 | [diff] [blame] | 295 | int at91rm9200_miiphy_write(char *devname, unsigned char addr, |
| 296 | unsigned char reg, unsigned short value) |
wdenk | 074cff0 | 2004-02-24 00:16:43 +0000 | [diff] [blame] | 297 | { |
| 298 | at91rm9200_EmacEnableMDIO (p_mac); |
| 299 | at91rm9200_EmacWritePhy (p_mac, reg, &value); |
| 300 | at91rm9200_EmacDisableMDIO (p_mac); |
| 301 | return 0; |
| 302 | } |
Marian Balakowicz | 63ff004 | 2005-10-28 22:30:33 +0200 | [diff] [blame] | 303 | |
Jon Loeliger | 3a1ed1e | 2007-07-09 18:57:22 -0500 | [diff] [blame] | 304 | #endif |
Marian Balakowicz | 63ff004 | 2005-10-28 22:30:33 +0200 | [diff] [blame] | 305 | |
| 306 | int at91rm9200_miiphy_initialize(bd_t *bis) |
| 307 | { |
Jon Loeliger | 3a1ed1e | 2007-07-09 18:57:22 -0500 | [diff] [blame] | 308 | #if defined(CONFIG_MII) || defined(CONFIG_CMD_MII) |
Marian Balakowicz | 63ff004 | 2005-10-28 22:30:33 +0200 | [diff] [blame] | 309 | miiphy_register("at91rm9200phy", at91rm9200_miiphy_read, at91rm9200_miiphy_write); |
| 310 | #endif |
| 311 | return 0; |
| 312 | } |
wdenk | 074cff0 | 2004-02-24 00:16:43 +0000 | [diff] [blame] | 313 | |
Jon Loeliger | 3a1ed1e | 2007-07-09 18:57:22 -0500 | [diff] [blame] | 314 | #endif |
wdenk | 074cff0 | 2004-02-24 00:16:43 +0000 | [diff] [blame] | 315 | |
wdenk | 2abbe07 | 2003-06-16 23:50:08 +0000 | [diff] [blame] | 316 | #endif /* CONFIG_DRIVER_ETHER */ |