[U-Boot] [RFC][PATCH 19/21] [eNET] Add support for onboard RTL8100B (RTL8139) chips

Graeme Russ
2010-03-25T11:23:01Z

---
I simply do not know why PCI_BASE_ADDRESS_1 has to be changed to
PCI_BASE_ADDRESS_0 - Please comment

board/eNET/eNET.c | 12 ++++++++++++
drivers/net/rtl8139.c | 2 +-
include/asm-i386/ic/sc520.h | 6 +++---
include/configs/eNET.h | 9 ++++++++-
4 files changed, 24 insertions(+), 5 deletions(-)

diff --git a/board/eNET/eNET.c b/board/eNET/eNET.c
index 52ea140..9d782f3 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>
@@ -173,3 +175,13 @@ ulong board_flash_get_legacy (ulong base, int banknum, flash_info_t * info)
} else
return 0;
}
+
+int board_eth_init(bd_t *bis)
+{
+ int adapters;
+ adapters = pci_eth_init(bis);
+
+ if (adapters > 0)
+ eth_init(bis);
+
+ return adapters;
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 20384a4..d19cac6 100644
--- a/include/asm-i386/ic/sc520.h
+++ b/include/asm-i386/ic/sc520.h
@@ -307,14 +307,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 19a81b8..4380bb1 100644
--- a/include/configs/eNET.h
+++ b/include/configs/eNET.h
@@ -104,9 +104,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 */
@@ -225,6 +226,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
*/
--
1.7.0.2.182.ge007