summaryrefslogtreecommitdiffstats
path: root/c/src/lib/libbsp/sparc/leon2/leon_open_eth
diff options
context:
space:
mode:
authorRalf Corsepius <ralf.corsepius@rtems.org>2006-01-09 10:36:06 +0000
committerRalf Corsepius <ralf.corsepius@rtems.org>2006-01-09 10:36:06 +0000
commitbec7ba52314ce3beb962b6dae7131ff59ce3a76b (patch)
treed4519d9d6d802ae19767af216538fad1c5029c87 /c/src/lib/libbsp/sparc/leon2/leon_open_eth
parent2006-01-09 Ralf Corsepius <ralf.corsepius@rtems.org> (diff)
downloadrtems-bec7ba52314ce3beb962b6dae7131ff59ce3a76b.tar.bz2
Backport from rtems-4-6-branch.
Diffstat (limited to 'c/src/lib/libbsp/sparc/leon2/leon_open_eth')
-rw-r--r--c/src/lib/libbsp/sparc/leon2/leon_open_eth/leon_open_eth.c54
1 files changed, 54 insertions, 0 deletions
diff --git a/c/src/lib/libbsp/sparc/leon2/leon_open_eth/leon_open_eth.c b/c/src/lib/libbsp/sparc/leon2/leon_open_eth/leon_open_eth.c
new file mode 100644
index 0000000000..ea89310d74
--- /dev/null
+++ b/c/src/lib/libbsp/sparc/leon2/leon_open_eth/leon_open_eth.c
@@ -0,0 +1,54 @@
+/*
+ * LEON2 Opencores Ethernet MAC Configuration Information
+ *
+ * $Id$
+ */
+
+
+#include <bsp.h>
+#include <libchip/open_eth.h>
+#if (OPEN_ETH_DEBUG & OPEN_ETH_DEBUG_PRINT_REGISTERS)
+#include <stdio.h>
+#endif
+
+/*
+ * Default sizes of transmit and receive descriptor areas
+ */
+#define RDA_COUNT 16
+#define TDA_COUNT 16
+
+/*
+ * Default location of device registers
+ */
+#define OPEN_ETH_BASE_ADDRESS 0xb0000000
+
+/*
+ * Default interrupt vector
+ */
+#define OPEN_ETH_VECTOR 0x1C
+
+open_eth_configuration_t leon_open_eth_configuration = {
+ OPEN_ETH_BASE_ADDRESS, /* base address */
+ OPEN_ETH_VECTOR, /* vector number */
+ TDA_COUNT, /* number of transmit descriptors */
+ RDA_COUNT, /* number of receive descriptors */
+ 0 /* 100 MHz operation */
+};
+
+int rtems_leon_open_eth_driver_attach(struct rtems_bsdnet_ifconfig *config)
+{
+
+ /* clear control register and reset NIC */
+ *(volatile int *) OPEN_ETH_BASE_ADDRESS = 0;
+ *(volatile int *) OPEN_ETH_BASE_ADDRESS = 0x800;
+ *(volatile int *) OPEN_ETH_BASE_ADDRESS = 0;
+
+ /* enable 100 MHz operation only if cpu frequency >= 50 MHz */
+ if (LEON_REG.Scaler_Reload >= 49) leon_open_eth_configuration.en100MHz = 1;
+
+ if (rtems_open_eth_driver_attach( config, &leon_open_eth_configuration )) {
+ LEON_REG.Interrupt_Clear = (1 << (OPEN_ETH_VECTOR - 0x10));
+ LEON_REG.Interrupt_Mask |= (1 << (OPEN_ETH_VECTOR - 0x10));
+ }
+ return 0;
+}