From: David Brownell <david-b@pacbell.net>
To: u-boot@lists.denx.de
Subject: [U-Boot] [patch] rm9200 ethernet driver: board-specific quirk (csb337)
Date: Tue, 9 Jun 2009 11:14:24 -0700 [thread overview]
Message-ID: <200906091114.24166.david-b@pacbell.net> (raw)
CSB337 boards originally shipped with MicroMonitor, not U-Boot;
and with a version using a different convention for recording
Ethernet addresses than anyone else. To avoid breaking Linux
when it uses U-Boot, have it use the same convention on that
hardware.
Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
---
cpu/arm920t/at91rm9200/ether.c | 22 ++++++++++++++++++----
1 file changed, 18 insertions(+), 4 deletions(-)
--- a/cpu/arm920t/at91rm9200/ether.c
+++ b/cpu/arm920t/at91rm9200/ether.c
@@ -24,6 +24,7 @@
#include <at91rm9200_net.h>
#include <net.h>
#include <miiphy.h>
+#include <asm/mach-types.h>
/* ----- Ethernet Buffer definitions ----- */
@@ -184,7 +185,7 @@ int eth_init (bd_t * bd)
p_mac->EMAC_CFG |= AT91C_EMAC_CSR; /* Clear statistics */
- /* Init Ehternet buffers */
+ /* Init Ethernet buffers */
for (i = 0; i < RBF_FRAMEMAX; i++) {
rbfdt[i].addr = (unsigned long)rbf_framebuf[i];
rbfdt[i].size = 0;
@@ -193,9 +194,22 @@ int eth_init (bd_t * bd)
rbfp = &rbfdt[0];
eth_getenv_enetaddr("ethaddr", enetaddr);
- p_mac->EMAC_SA2L = (enetaddr[3] << 24) | (enetaddr[2] << 16)
- | (enetaddr[1] << 8) | (enetaddr[0]);
- p_mac->EMAC_SA2H = (enetaddr[5] << 8) | (enetaddr[4]);
+
+ /* The CSB337 originally used a version of the MicroMonitor bootloader
+ * which saved Ethernet addresses in the "wrong" order. Operating
+ * systems (like Linux) know this, and apply a workaround. Replicate
+ * that MicroMonitor behavior so we avoid needing to make such OS code
+ * care about which bootloader was used.
+ */
+ if (machine_is_csb337()) {
+ p_mac->EMAC_SA2H = (enetaddr[0] << 8) | (enetaddr[1]);
+ p_mac->EMAC_SA2L = (enetaddr[2] << 24) | (enetaddr[3] << 16)
+ | (enetaddr[4] << 8) | (enetaddr[5]);
+ } else {
+ p_mac->EMAC_SA2L = (enetaddr[3] << 24) | (enetaddr[2] << 16)
+ | (enetaddr[1] << 8) | (enetaddr[0]);
+ p_mac->EMAC_SA2H = (enetaddr[5] << 8) | (enetaddr[4]);
+ }
p_mac->EMAC_RBQP = (long) (&rbfdt[0]);
p_mac->EMAC_RSR &= ~(AT91C_EMAC_RSR_OVR | AT91C_EMAC_REC | AT91C_EMAC_BNA);
next reply other threads:[~2009-06-09 18:14 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-06-09 18:14 David Brownell [this message]
2009-06-12 21:30 ` [U-Boot] [patch] rm9200 ethernet driver: board-specific quirk (csb337) Jean-Christophe PLAGNIOL-VILLARD
2009-06-12 22:02 ` David Brownell
2009-06-13 10:26 ` Jean-Christophe PLAGNIOL-VILLARD
2009-06-13 11:13 ` David Brownell
2009-06-13 12:28 ` Jean-Christophe PLAGNIOL-VILLARD
2009-06-13 14:50 ` Mike Frysinger
2009-06-13 14:54 ` [U-Boot] [patch] rm9200 ethernet driver: board-specific quirk?(csb337) Jean-Christophe PLAGNIOL-VILLARD
2009-06-13 15:13 ` Mike Frysinger
2009-06-13 17:19 ` [U-Boot] [patch] rm9200 ethernet driver: board-specific quirk (csb337) David Brownell
2009-07-10 20:39 ` [U-Boot] [patch] rm9200 ethernet driver: board-specific quirk?(csb337) Wolfgang Denk
2009-06-12 23:02 ` [U-Boot] [patch] rm9200 ethernet driver: board-specific quirk (csb337) Ben Warren
2009-06-18 5:14 ` Ben Warren
2009-06-19 6:59 ` David Brownell
2009-06-19 7:01 ` Ben Warren
2009-06-19 7:56 ` Jean-Christophe PLAGNIOL-VILLARD
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=200906091114.24166.david-b@pacbell.net \
--to=david-b@pacbell.net \
--cc=u-boot@lists.denx.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox