[PATCH 2/2] openrisc: enable OpenCores ethernet driver

Beniamino Galvani b.galvani at gmail.com
Sun Dec 15 12:17:26 EST 2013


The OpenCores 10/100 Mbps ethernet MAC is often available on
OpenRISC-based SoCs and is supported by the OpenRISC architectural
simulator (or1ksim) as well.

The patch enables the driver on the 'generic' openrisc board.

Signed-off-by: Beniamino Galvani <b.galvani at gmail.com>
---
 arch/openrisc/boards/generic/config.h   |    2 ++
 arch/openrisc/boards/generic/generic.c  |    7 +++++++
 arch/openrisc/configs/generic_defconfig |    6 ++++++
 3 files changed, 15 insertions(+)

diff --git a/arch/openrisc/boards/generic/config.h b/arch/openrisc/boards/generic/config.h
index 95260cd..6ebab42 100644
--- a/arch/openrisc/boards/generic/config.h
+++ b/arch/openrisc/boards/generic/config.h
@@ -11,6 +11,8 @@
 #define OPENRISC_SOPC_UART_FREQ		CONFIG_SYS_CLK_FREQ
 #define OPENRISC_SOPC_UART_BASE		0x90000000
 
+#define OPENRISC_SOPC_ETHOC_BASE	0x92000000
+
 /* We reserve 256K for barebox */
 #define BAREBOX_RESERVED_SIZE		0x40000
 
diff --git a/arch/openrisc/boards/generic/generic.c b/arch/openrisc/boards/generic/generic.c
index e366d85..290e05c 100644
--- a/arch/openrisc/boards/generic/generic.c
+++ b/arch/openrisc/boards/generic/generic.c
@@ -16,6 +16,13 @@ static int openrisc_console_init(void)
 
 	/* Register the serial port */
 	add_ns16550_device(DEVICE_ID_DYNAMIC, OPENRISC_SOPC_UART_BASE, 1024, IORESOURCE_MEM_8BIT, &serial_plat);
+
+#ifdef CONFIG_DRIVER_NET_ETHOC
+	add_generic_device("ethoc", DEVICE_ID_DYNAMIC, NULL,
+			   OPENRISC_SOPC_ETHOC_BASE, 0x1000,
+			   IORESOURCE_MEM, NULL);
+#endif
+
 	return 0;
 }
 
diff --git a/arch/openrisc/configs/generic_defconfig b/arch/openrisc/configs/generic_defconfig
index 7ae85b0..53ff671 100644
--- a/arch/openrisc/configs/generic_defconfig
+++ b/arch/openrisc/configs/generic_defconfig
@@ -18,3 +18,9 @@ CONFIG_CMD_GO=y
 CONFIG_CMD_TIMEOUT=y
 CONFIG_CMD_PARTITION=y
 CONFIG_DRIVER_SERIAL_NS16550=y
+CONFIG_NET=y
+CONFIG_NET_DHCP=y
+CONFIG_NET_PING=y
+CONFIG_CMD_TFTP=y
+CONFIG_FS_TFTP=y
+CONFIG_DRIVER_NET_ETHOC=y
-- 
1.7.10.4




More information about the barebox mailing list