[U-Boot] [RFC][PATCH] Ethernet Support for eNET Board

Graeme Russ graeme.russ at gmail.com
Sat Aug 29 13:03:03 CEST 2009


OK, after much wailing and gnashing of teeth, I have FINALLY got the
Ethernet chips on my eNET board working. In the end, the critical mod was
in drivers/net/rtl8139.c, line 217 where I needed to change
PCI_BASE_ADDRESS_1 to PCI_BASE_ADDRESS_0 - The big question for me now is
Why? I assume this driver is working for everyone else, and this change
will probably break the driver for everyone else, so now I need to know
what I can do so that Ethernet works on my board WITHOUT modifying rtl8139.c

I also had to move SC520_PCI_IO_PHYS from 0x1000 to 0x2000 because I have
LEDs, Hex Switches and a couple of other board specific I/O at 0x1000

Anyone got any ideas?


diff --git a/board/eNET/eNET.c b/board/eNET/eNET.c
index 29cf295..9359ea6 100644
--- a/board/eNET/eNET.c
+++ b/board/eNET/eNET.c
@@ -24,6 +24,8 @@
 #include <common.h>
 #include <asm/io.h>
 #include <asm/ic/sc520.h>
+#include <net.h>
+#include <netdev.h>
 
 #ifdef CONFIG_HW_WATCHDOG
 #include <watchdog.h>
@@ -165,3 +167,10 @@ ulong board_flash_get_legacy (ulong base, int banknum, flash_info_t * info)
 	} else
 		return 0;
 }
+
+int board_eth_init(bd_t *bis)
+{
+	printf("Initializing Ethernet\n");
+	return pci_eth_init(bis);
+}
+
diff --git a/drivers/net/rtl8139.c b/drivers/net/rtl8139.c
index db8a727..a3df564 100644
--- a/drivers/net/rtl8139.c
+++ b/drivers/net/rtl8139.c
@@ -214,7 +214,7 @@ int rtl8139_initialize(bd_t *bis)
 		if ((devno = pci_find_devices(supported, idx++)) < 0)
 			break;
 
-		pci_read_config_dword(devno, PCI_BASE_ADDRESS_1, &iobase);
+		pci_read_config_dword(devno, PCI_BASE_ADDRESS_0, &iobase);
 		iobase &= ~0xf;
 
 		debug ("rtl8139: REALTEK RTL8139 @0x%x\n", iobase);
diff --git a/include/asm-i386/ic/sc520.h b/include/asm-i386/ic/sc520.h
index 57c9904..6e2375c 100644
--- a/include/asm-i386/ic/sc520.h
+++ b/include/asm-i386/ic/sc520.h
@@ -306,14 +306,14 @@ extern volatile sc520_mmcr_t *sc520_mmcr;
 
 /* PCI I/O space from 0x1000 to 0xdfff
  * (make 0xe000-0xfdff available for stuff like PCCard boot) */
-#define SC520_PCI_IO_PHYS	0x00001000
-#define SC520_PCI_IO_BUS	0x00001000
+#define SC520_PCI_IO_PHYS	0x00002000
+#define SC520_PCI_IO_BUS	0x00002000
 #define SC520_PCI_IO_SIZE	0x0000d000
 
 /* system memory from 0x00000000 to 0x0fffffff */
 #define	SC520_PCI_MEMORY_PHYS	0x00000000
 #define	SC520_PCI_MEMORY_BUS	0x00000000
-#define SC520_PCI_MEMORY_SIZE	0x10000000
+#define SC520_PCI_MEMORY_SIZE	0x08000000
 
 /* PCI bus memory from 0x10000000 to 0x26ffffff
  * (make 0x27000000 - 0x27ffffff available for stuff like PCCard boot) */
diff --git a/include/configs/eNET.h b/include/configs/eNET.h
index c4c38de..df0d586 100644
--- a/include/configs/eNET.h
+++ b/include/configs/eNET.h
@@ -86,9 +86,10 @@
 #define CONFIG_CMD_LOADS	/* loads			*/
 #define CONFIG_CMD_MEMORY	/* md mm nm mw cp cmp crc base loop mtest */
 #define CONFIG_CMD_MISC		/* Misc functions like sleep etc*/
-#undef CONFIG_CMD_NET		/* bootp, tftpboot, rarpboot	*/
+#define CONFIG_CMD_NET		/* bootp, tftpboot, rarpboot	*/
 #undef CONFIG_CMD_NFS		/* NFS support			*/
 #define CONFIG_CMD_PCI		/* PCI support			*/
+#define CONFIG_CMD_PING		/* ICMP echo support		*/
 #define CONFIG_CMD_RUN		/* run command in env variable	*/
 #define CONFIG_CMD_SAVEENV	/* saveenv			*/
 #define CONFIG_CMD_SETGETDCR	/* DCR support on 4xx		*/
@@ -208,6 +209,12 @@
 #define CONFIG_SYS_THIRD_PCI_IRQ   11
 #define CONFIG_SYS_FORTH_PCI_IRQ   15
 
+ /*
+ * Network device (TRL8100B) support
+ */
+#define CONFIG_NET_MULTI
+#define CONFIG_RTL8139
+
 /*-----------------------------------------------------------------------
  * Hardware watchdog configuration
  */


More information about the U-Boot mailing list