[U-Boot-Users] small AT91RM9200 ethernet patch

20 Feb
2004
20 Feb
'04
3:31 p.m.
Hi there,
please consider the attached patch.
* Patch by Steven Scholz, 20 Feb 2004: - Add support for MII commands on AT91RM9200 boards - some cleanup in AT91RM9200 ethernet code
--
Steven Scholz
imc Measurement & Control imc Meßsysteme GmbH
Voltastr. 5 Voltastr. 5
13355 Berlin 13355 Berlin
Germany Deutschland
Index: cpu/at91rm9200/at91rm9200_ether.c
===================================================================
RCS file: /cvsroot/u-boot/u-boot/cpu/at91rm9200/at91rm9200_ether.c,v
retrieving revision 1.3
diff -p -u -r1.3 at91rm9200_ether.c
--- cpu/at91rm9200/at91rm9200_ether.c 19 Oct 2003 23:22:11 -0000 1.3
+++ cpu/at91rm9200/at91rm9200_ether.c 20 Feb 2004 14:14:05 -0000
@@ -310,8 +310,9 @@ static UCHAR at91rm9200_EmacReadPhy (AT9
unsigned short *pInput)
{
p_mac->EMAC_MAN = (AT91C_EMAC_HIGH & ~AT91C_EMAC_LOW) |
- (AT91C_EMAC_CODE_802_3) | (AT91C_EMAC_RW_R) |
- (RegisterAddress << 18);
+ (AT91C_EMAC_RW_R) |
+ (RegisterAddress << 18) |
+ (AT91C_EMAC_CODE_802_3);
udelay (10000);
@@ -421,8 +422,14 @@ int eth_init (bd_t * bd)
p_mac->EMAC_RBQP = (long) (&rbfdt[0]);
p_mac->EMAC_RSR &= ~(AT91C_EMAC_RSR_OVR | AT91C_EMAC_REC | AT91C_EMAC_BNA);
- p_mac->EMAC_CFG = (p_mac->EMAC_CFG | AT91C_EMAC_CAF | AT91C_EMAC_NBC | AT91C_EMAC_RMII)
+
+ p_mac->EMAC_CFG = (p_mac->EMAC_CFG | AT91C_EMAC_CAF | AT91C_EMAC_NBC)
& ~AT91C_EMAC_CLK;
+
+#ifdef CONFIG_AT91C_USE_RMII
+ p_mac->EMAC_CFG |= AT91C_EMAC_RMII;
+#endif
+
p_mac->EMAC_CTL |= AT91C_EMAC_TE | AT91C_EMAC_RE;
return 0;
@@ -462,5 +469,25 @@ int eth_rx (void)
void eth_halt (void)
{
};
+
+#if (CONFIG_COMMANDS & CFG_CMD_MII)
+int miiphy_read(unsigned char addr, unsigned char reg, unsigned short * value)
+{
+ at91rm9200_EmacEnableMDIO (p_mac);
+ at91rm9200_EmacReadPhy (p_mac, reg, value);
+ at91rm9200_EmacDisableMDIO (p_mac);
+ return 0;
+}
+
+int miiphy_write(unsigned char addr, unsigned char reg, unsigned short value)
+{
+ at91rm9200_EmacEnableMDIO (p_mac);
+ at91rm9200_EmacWritePhy (p_mac, reg, &value);
+ at91rm9200_EmacDisableMDIO (p_mac);
+ return 0;
+}
+#endif /* CONFIG_COMMANDS & CFG_CMD_MII */
+
#endif /* CONFIG_COMMANDS & CFG_CMD_NET */
+
#endif /* CONFIG_DRIVER_ETHER */
Index: include/configs/at91rm9200dk.h
===================================================================
RCS file: /cvsroot/u-boot/u-boot/include/configs/at91rm9200dk.h,v
retrieving revision 1.5
diff -p -u -r1.5 at91rm9200dk.h
--- include/configs/at91rm9200dk.h 6 Dec 2003 23:55:11 -0000 1.5
+++ include/configs/at91rm9200dk.h 20 Feb 2004 14:14:05 -0000
@@ -112,6 +116,7 @@
#define CONFIG_DRIVER_ETHER
#define CONFIG_NET_RETRY_COUNT 20
+#define CONFIG_AT91C_USE_RMII
#define CONFIG_HAS_DATAFLASH 1
#define CFG_SPI_WRITE_TOUT (5*CFG_HZ)

24 Feb
24 Feb
12:59 a.m.
In message 40361A39.8070402@imc-berlin.de you wrote:
- Patch by Steven Scholz, 20 Feb 2004:
- Add support for MII commands on AT91RM9200 boards
- some cleanup in AT91RM9200 ethernet code
Applied. Thanks.
Best regards,
Wolfgang Denk
--
Software Engineering: Embedded and Realtime Systems, Embedded Linux
Phone: (+49)-8142-4596-87 Fax: (+49)-8142-4596-88 Email: wd@denx.de
After a time, you may find that "having" is not so pleasing a thing,
after all, as "wanting." It is not logical, but it is often true.
-- Spock, "Amok Time", stardate 3372.7
7743
Age (days ago)
7746
Last active (days ago)
1 comments
2 participants
participants (2)
-
Steven Scholz
-
Wolfgang Denk