summaryrefslogtreecommitdiffstats
path: root/c/src/lib/libbsp/sparc/leon3/leon_smc91111/leon_smc91111.c
diff options
context:
space:
mode:
authorDaniel Hellstrom <daniel@gaisler.com>2012-04-17 16:25:41 +0200
committerGedare Bloom <gedare@rtems.org>2012-04-17 22:01:47 -0400
commitfc6f872d3f1296085e874154f3381dbae49886ac (patch)
tree7a0b639e81069f8ef299f0bc4cdf7a2cd970a250 /c/src/lib/libbsp/sparc/leon3/leon_smc91111/leon_smc91111.c
parentLEON3: updated console driver for new AMBAPP layer (diff)
downloadrtems-fc6f872d3f1296085e874154f3381dbae49886ac.tar.bz2
LEON3: Network initialization code updated to new AMBAPP layer
Updated SMC91111, GRETH and open_eth driver registration code to use new AMBAPP Layer. Signed-off-by: Daniel Hellstrom <daniel@gaisler.com>
Diffstat (limited to '')
-rw-r--r--c/src/lib/libbsp/sparc/leon3/leon_smc91111/leon_smc91111.c40
1 files changed, 25 insertions, 15 deletions
diff --git a/c/src/lib/libbsp/sparc/leon3/leon_smc91111/leon_smc91111.c b/c/src/lib/libbsp/sparc/leon3/leon_smc91111/leon_smc91111.c
index 841c4b6651..9e582fb599 100644
--- a/c/src/lib/libbsp/sparc/leon3/leon_smc91111/leon_smc91111.c
+++ b/c/src/lib/libbsp/sparc/leon3/leon_smc91111/leon_smc91111.c
@@ -1,11 +1,14 @@
-/*
- * $Id$
+/* LEON3 BSP SMC91111 registration and low-level initialization
+ *
+ * The license and distribution terms for this file may be
+ * found in the file LICENSE in this distribution or at
+ * http://www.rtems.com/license/LICENSE.
*/
#include <bsp.h>
#include <libchip/smc91111exp.h>
#include <rtems/bspIo.h>
-
+#include <ambapp.h>
#define SMC91111_BASE_ADDR (void*)0x20000300
#define SMC91111_BASE_IRQ 4
@@ -32,21 +35,29 @@ rtems_smc91111_driver_attach_leon3 (struct rtems_bsdnet_ifconfig *config,
{
unsigned long addr_mctrl = 0;
LEON3_IOPORT_Regs_Map *io;
+ struct ambapp_apb_info apbpio;
+ struct ambapp_apb_info apbmctrl;
- amba_apb_device apbpio;
- amba_ahb_device apbmctrl;
-
- if ( amba_find_apbslv(&amba_conf,VENDOR_GAISLER,GAISLER_PIOPORT,&apbpio) != 1 ){
+ if (ambapp_find_apbslv(&ambapp_plb, VENDOR_GAISLER, GAISLER_GPIO, &apbpio)
+ != 1) {
printk("SMC9111_leon3: didn't find PIO\n");
return 0;
}
- /* Find LEON2 memory controller */
- if ( amba_find_ahbslv(&amba_conf,VENDOR_ESA,ESA_MCTRL,&apbmctrl) != 1 ){
- /* LEON2 memory controller not found, search for fault tolerant memory controller */
- if ( amba_find_ahbslv(&amba_conf,VENDOR_GAISLER,GAISLER_FTMCTRL,&apbmctrl) != 1 ) {
- printk("SMC9111_leon3: didn't find any memory controller\n");
- return 0;
+ /* In order to access the SMC controller the memory controller must have
+ * I/O bus enabled. Find first memory controller.
+ */
+ if (ambapp_find_apbslv(&ambapp_plb, VENDOR_ESA, ESA_MCTRL, &apbmctrl) != 1) {
+ if (ambapp_find_apbslv(&ambapp_plb, VENDOR_GAISLER, GAISLER_FTMCTRL,
+ &apbmctrl) != 1) {
+ if (ambapp_find_apbslv(&ambapp_plb, VENDOR_GAISLER, GAISLER_FTSRCTRL,
+ &apbmctrl) != 1) {
+ if (ambapp_find_apbslv(&ambapp_plb, VENDOR_GAISLER, GAISLER_FTSRCTRL8,
+ &apbmctrl) != 1) {
+ printk("SMC9111_leon3: didn't find any memory controller\n");
+ return 0;
+ }
+ }
}
}
@@ -68,6 +79,5 @@ rtems_smc91111_driver_attach_leon3 (struct rtems_bsdnet_ifconfig *config,
/* Setup memory controller I/O waitstates */
*((volatile unsigned int *) addr_mctrl) |= 0x10f80000; /* enable I/O area access */
- return _rtems_smc91111_driver_attach (config,
- &leon_scmv91111_configuration);
+ return _rtems_smc91111_driver_attach(config, &leon_scmv91111_configuration);
};