diff options
author | Sebastian Huber <sebastian.huber@embedded-brains.de> | 2018-04-20 13:36:14 +0200 |
---|---|---|
committer | Sebastian Huber <sebastian.huber@embedded-brains.de> | 2018-04-20 14:10:08 +0200 |
commit | b15cb636e18f7810f529ecb66f99eaf1ac1c18c9 (patch) | |
tree | a23e152f9139093aab4c480dfd6392383ad489b6 /bsps/sparc/leon2/net/leon_smc91111.c | |
parent | bsps/sparc: Move shared files to bsps (diff) | |
download | rtems-b15cb636e18f7810f529ecb66f99eaf1ac1c18c9.tar.bz2 |
bsps/sparc: Move network drivers to bsps
This patch is a part of the BSP source reorganization.
Update #3285.
Diffstat (limited to 'bsps/sparc/leon2/net/leon_smc91111.c')
-rw-r--r-- | bsps/sparc/leon2/net/leon_smc91111.c | 69 |
1 files changed, 69 insertions, 0 deletions
diff --git a/bsps/sparc/leon2/net/leon_smc91111.c b/bsps/sparc/leon2/net/leon_smc91111.c new file mode 100644 index 0000000000..748ca35491 --- /dev/null +++ b/bsps/sparc/leon2/net/leon_smc91111.c @@ -0,0 +1,69 @@ +/** + * @file + * @ingroup sparc_leon2 + * @brief SMC91111 Driver + */ + +/* + * Copyright (c) 2006. + * Aeroflex Gaisler AB. + * + * The license and distribution terms for this file may be + * found in the file LICENSE in this distribution or at + * http://www.rtems.org/license/LICENSE. + */ + +#define __INSIDE_RTEMS_BSD_TCPIP_STACK__ + +#include <rtems.h> + +#include <bsp.h> +#include <rtems/bspIo.h> + +#include <stdlib.h> +#include <stdio.h> +#include <stdarg.h> +#include <rtems/error.h> +#include <rtems/rtems_bsdnet.h> + +#include <sys/param.h> +#include <sys/mbuf.h> + +#include <sys/socket.h> +#include <sys/sockio.h> +#include <net/if.h> +#include <netinet/in.h> +#include <netinet/if_ether.h> + +#include <libchip/smc91111exp.h> + + +#define SMC91111_BASE_ADDR (void*)0x20000300 +#define SMC91111_BASE_IRQ 4 +#define SMC91111_BASE_PIO 4 + +scmv91111_configuration_t leon_scmv91111_configuration = { + SMC91111_BASE_ADDR, /* base address */ + SMC91111_BASE_IRQ, /* IRQ number (on LEON vector is irq) */ + SMC91111_BASE_PIO, /* PIO */ + 100, /* 100b */ + 1, /* fulldx */ + 1 /* autoneg */ +}; + +/* + * Attach an SMC91111 driver to the system + */ +int rtems_smc91111_driver_attach_leon2(struct rtems_bsdnet_ifconfig *config) +{ + + /* activate io area */ + printk("Activating Leon2 io port\n"); + /*configure pio */ + *((volatile unsigned int *)0x80000000) |= 0x10f80000; + *((volatile unsigned int *)0x800000A8) |= + (0xe0 | leon_scmv91111_configuration.pio) + << (8 * (leon_scmv91111_configuration.vector - 4)); /* vector = irq-no */ + + return _rtems_smc91111_driver_attach(config,&leon_scmv91111_configuration); +} |