summaryrefslogtreecommitdiffstats
path: root/c/src/lib/libbsp
diff options
context:
space:
mode:
authorSebastian Huber <sebastian.huber@embedded-brains.de>2018-04-20 13:36:14 +0200
committerSebastian Huber <sebastian.huber@embedded-brains.de>2018-04-20 14:10:08 +0200
commitb15cb636e18f7810f529ecb66f99eaf1ac1c18c9 (patch)
treea23e152f9139093aab4c480dfd6392383ad489b6 /c/src/lib/libbsp
parentbsps/sparc: Move shared files to bsps (diff)
downloadrtems-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 'c/src/lib/libbsp')
-rw-r--r--c/src/lib/libbsp/sparc/erc32/Makefile.am2
-rw-r--r--c/src/lib/libbsp/sparc/erc32/erc32sonic/erc32sonic.c123
-rw-r--r--c/src/lib/libbsp/sparc/leon2/Makefile.am4
-rw-r--r--c/src/lib/libbsp/sparc/leon2/leon_open_eth/leon_open_eth.c64
-rw-r--r--c/src/lib/libbsp/sparc/leon2/leon_smc91111/leon_smc91111.c69
-rw-r--r--c/src/lib/libbsp/sparc/leon3/Makefile.am6
-rw-r--r--c/src/lib/libbsp/sparc/leon3/leon_greth/leon_greth.c58
-rw-r--r--c/src/lib/libbsp/sparc/leon3/leon_open_eth/leon_open_eth.c75
-rw-r--r--c/src/lib/libbsp/sparc/leon3/leon_smc91111/leon_smc91111.c89
9 files changed, 6 insertions, 484 deletions
diff --git a/c/src/lib/libbsp/sparc/erc32/Makefile.am b/c/src/lib/libbsp/sparc/erc32/Makefile.am
index 10f72b2901..c3f6f51306 100644
--- a/c/src/lib/libbsp/sparc/erc32/Makefile.am
+++ b/c/src/lib/libbsp/sparc/erc32/Makefile.am
@@ -60,7 +60,7 @@ librtemsbsp_a_SOURCES += ../../../../../../bsps/shared/start/getcurrentprocessor
endif
if HAS_NETWORKING
-librtemsbsp_a_SOURCES += erc32sonic/erc32sonic.c
+librtemsbsp_a_SOURCES += ../../../../../../bsps/sparc/erc32/net/erc32sonic.c
endif
librtemsbsp_a_SOURCES += ../../../../../../bsps/shared/cache/nocache.c
diff --git a/c/src/lib/libbsp/sparc/erc32/erc32sonic/erc32sonic.c b/c/src/lib/libbsp/sparc/erc32/erc32sonic/erc32sonic.c
deleted file mode 100644
index ce108bd825..0000000000
--- a/c/src/lib/libbsp/sparc/erc32/erc32sonic/erc32sonic.c
+++ /dev/null
@@ -1,123 +0,0 @@
-/**
- * @file
- *
- * @ingroup sparc_erc32
- *
- * @brief THARSYS VME SPARC RT board SONIC Configuration Information
- *
- * References:
- *
- * 1) SVME/DMV-171 Single Board Computer Documentation Package, #805905,
- * DY 4 Systems Inc., Kanata, Ontario, September, 1996.
- */
-
-/*
- * COPYRIGHT (c) 2000.
- * European Space Agency.
- *
- * 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 <bsp.h>
-#include <libchip/sonic.h>
-#if (SONIC_DEBUG & SONIC_DEBUG_PRINT_REGISTERS)
-#include <stdio.h>
-#endif
-
-static void erc32_sonic_write_register(
- void *base,
- uint32_t regno,
- uint32_t value
-)
-{
- volatile uint32_t *p = base;
-
-#if (SONIC_DEBUG & SONIC_DEBUG_PRINT_REGISTERS)
- printf( "%p Write 0x%04x to %s (0x%02x)\n",
- &p[regno], value, SONIC_Reg_name[regno], regno );
- fflush( stdout );
-#endif
- p[regno] = 0x0ffff & value;
-}
-
-static uint32_t erc32_sonic_read_register(
- void *base,
- uint32_t regno
-)
-{
- volatile uint32_t *p = base;
- uint32_t value;
-
- value = p[regno];
-#if (SONIC_DEBUG & SONIC_DEBUG_PRINT_REGISTERS)
- printf( "%p Read 0x%04x from %s (0x%02x)\n",
- &p[regno], value, SONIC_Reg_name[regno], regno );
- fflush( stdout );
-#endif
- return 0x0ffff & value;
-}
-
-/*
- * Default sizes of transmit and receive descriptor areas
- */
-#define RDA_COUNT 20 /* 20 */
-#define TDA_COUNT 20 /* 10 */
-
-/*
- * Default device configuration register values
- * Conservative, generic values.
- * DCR:
- * No extended bus mode
- * Unlatched bus retry
- * Programmable outputs unused
- * Asynchronous bus mode
- * User definable pins unused
- * No wait states (access time controlled by DTACK*)
- * 32-bit DMA
- * Empty/Fill DMA mode
- * Maximum Transmit/Receive FIFO
- * DC2:
- * Extended programmable outputs unused
- * Normal HOLD request
- * Packet compress output unused
- * No reject on CAM match
- */
-#define SONIC_DCR ( DCR_DW32 | DCR_RFT24 | DCR_TFT28)
-#define SONIC_DC2 (0)
-
-/*
- * Default location of device registers
- */
-#define SONIC_BASE_ADDRESS 0x10000100
-
-/*
- * Default interrupt vector
- */
-#define SONIC_VECTOR 0x1E
-
-sonic_configuration_t erc32_sonic_configuration = {
- (void *)SONIC_BASE_ADDRESS, /* base address */
- SONIC_VECTOR, /* vector number */
- SONIC_DCR, /* DCR register value */
- SONIC_DC2, /* DC2 register value */
- TDA_COUNT, /* number of transmit descriptors */
- RDA_COUNT, /* number of receive descriptors */
- erc32_sonic_write_register,
- erc32_sonic_read_register
-};
-
-int rtems_erc32_sonic_driver_attach(struct rtems_bsdnet_ifconfig *config)
-{
-
- ERC32_MEC.IO_Configuration |=
- (0x15 << (((SONIC_BASE_ADDRESS >> 24) & 0x3) * 8));
- ERC32_MEC.Control &= ~0x60001; /* Disable DMA time-out, parity & power-down */
- ERC32_MEC.Control |= 0x10000; /* Enable DMA */
- ERC32_MEC.Interrupt_Mask &= ~(1 << (SONIC_VECTOR - 0x10));
- return(rtems_sonic_driver_attach( config, &erc32_sonic_configuration ));
-
-}
diff --git a/c/src/lib/libbsp/sparc/leon2/Makefile.am b/c/src/lib/libbsp/sparc/leon2/Makefile.am
index 862cc536c2..29b368f964 100644
--- a/c/src/lib/libbsp/sparc/leon2/Makefile.am
+++ b/c/src/lib/libbsp/sparc/leon2/Makefile.am
@@ -157,8 +157,8 @@ librtemsbsp_a_SOURCES += ../../../../../../bsps/shared/start/getcurrentprocessor
endif
if HAS_NETWORKING
-librtemsbsp_a_SOURCES += leon_smc91111/leon_smc91111.c
-librtemsbsp_a_SOURCES += leon_open_eth/leon_open_eth.c
+librtemsbsp_a_SOURCES += ../../../../../../bsps/sparc/leon2/net/leon_smc91111.c
+librtemsbsp_a_SOURCES += ../../../../../../bsps/sparc/leon2/net/leon_open_eth.c
librtemsbsp_a_SOURCES += ../../../../../../bsps/sparc/shared/net/greth.c
librtemsbsp_a_SOURCES += ../../../../../../bsps/sparc/shared/net/network_interface_add.c
endif
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
deleted file mode 100644
index 27b04cd386..0000000000
--- a/c/src/lib/libbsp/sparc/leon2/leon_open_eth/leon_open_eth.c
+++ /dev/null
@@ -1,64 +0,0 @@
-/**
- * @file
- * @ingroup sparc_leon2
- * @brief LEON2 Opencores Ethernet MAC Configuration Information
- */
-
-/*
- * Copyright (c) 2004.
- * 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 <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 ((void *)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;
-}
diff --git a/c/src/lib/libbsp/sparc/leon2/leon_smc91111/leon_smc91111.c b/c/src/lib/libbsp/sparc/leon2/leon_smc91111/leon_smc91111.c
deleted file mode 100644
index 748ca35491..0000000000
--- a/c/src/lib/libbsp/sparc/leon2/leon_smc91111/leon_smc91111.c
+++ /dev/null
@@ -1,69 +0,0 @@
-/**
- * @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);
-}
diff --git a/c/src/lib/libbsp/sparc/leon3/Makefile.am b/c/src/lib/libbsp/sparc/leon3/Makefile.am
index 54d0549f8d..cd5d1dfa46 100644
--- a/c/src/lib/libbsp/sparc/leon3/Makefile.am
+++ b/c/src/lib/libbsp/sparc/leon3/Makefile.am
@@ -175,12 +175,12 @@ librtemsbsp_a_SOURCES += ../../../../../../bsps/sparc/leon3/start/bspsmp.c
endif
if HAS_NETWORKING
-librtemsbsp_a_SOURCES += leon_smc91111/leon_smc91111.c
-librtemsbsp_a_SOURCES += leon_open_eth/leon_open_eth.c
+librtemsbsp_a_SOURCES += ../../../../../../bsps/sparc/leon3/net/leon_smc91111.c
+librtemsbsp_a_SOURCES += ../../../../../../bsps/sparc/leon3/net/leon_open_eth.c
librtemsbsp_a_SOURCES += ../../../../../../bsps/sparc/shared/net/greth.c
librtemsbsp_a_SOURCES += ../../../../../../bsps/sparc/shared/net/network_interface_add.c
if !HAS_SMP
-librtemsbsp_a_SOURCES += leon_greth/leon_greth.c
+librtemsbsp_a_SOURCES += ../../../../../../bsps/sparc/leon3/net/leon_greth.c
endif
endif
diff --git a/c/src/lib/libbsp/sparc/leon3/leon_greth/leon_greth.c b/c/src/lib/libbsp/sparc/leon3/leon_greth/leon_greth.c
deleted file mode 100644
index d630522a5d..0000000000
--- a/c/src/lib/libbsp/sparc/leon3/leon_greth/leon_greth.c
+++ /dev/null
@@ -1,58 +0,0 @@
-/*
- * LEON3 Opencores Ethernet MAC Configuration Information
- *
- * COPYRIGHT (c) 2004.
- * Gaisler Research
- *
- * 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 <bsp.h>
-#include <libchip/greth.h>
-/*#if (GRETH_DEBUG & GRETH_DEBUG_PRINT_REGISTERS)*/
-#include <stdio.h>
-/*#endif*/
-
-/*
- * Default sizes of transmit and receive descriptor areas
- */
-#define RDA_COUNT 32
-#define TDA_COUNT 32
-
-greth_configuration_t leon_greth_configuration;
-
-int rtems_leon_greth_driver_attach(
- struct rtems_bsdnet_ifconfig *config,
- int attach
-)
-{
- unsigned int base_addr = 0; /* avoid warnings */
- unsigned int eth_irq = 0; /* avoid warnings */
- struct ambapp_dev *adev;
- struct ambapp_apb_info *apb;
-
- /* Scan for MAC AHB slave interface */
- adev = (void *)ambapp_for_each(&ambapp_plb, (OPTIONS_ALL|OPTIONS_APB_SLVS),
- VENDOR_GAISLER, GAISLER_ETHMAC,
- ambapp_find_by_idx, NULL);
- if (adev) {
- apb = DEV_TO_APB(adev);
- base_addr = apb->start;
- eth_irq = apb->irq;
-
- /* clear control register and reset NIC */
- *(volatile int *) base_addr = 0;
- *(volatile int *) base_addr = GRETH_CTRL_RST;
- *(volatile int *) base_addr = 0;
- leon_greth_configuration.base_address = (void*)base_addr;
- leon_greth_configuration.vector = eth_irq; /* on LEON vector is IRQ no. */
- leon_greth_configuration.txd_count = TDA_COUNT;
- leon_greth_configuration.rxd_count = RDA_COUNT;
- rtems_greth_driver_attach(config, &leon_greth_configuration);
- }
- return 0;
-}
diff --git a/c/src/lib/libbsp/sparc/leon3/leon_open_eth/leon_open_eth.c b/c/src/lib/libbsp/sparc/leon3/leon_open_eth/leon_open_eth.c
deleted file mode 100644
index c59d613d75..0000000000
--- a/c/src/lib/libbsp/sparc/leon3/leon_open_eth/leon_open_eth.c
+++ /dev/null
@@ -1,75 +0,0 @@
-/**
- * @file
- * @ingroup sparc_leon3
- * @brief LEON3 Opencores Ethernet MAC Configuration Information
- */
-
-/*
- * Copyright (c) 2004.
- * 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 <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
-
-open_eth_configuration_t leon_open_eth_configuration;
-
-int rtems_leon_open_eth_driver_attach(
- struct rtems_bsdnet_ifconfig *config,
- int attach
-)
-{
- unsigned int base_addr = 0; /* avoid warnings */
- unsigned int eth_irq = 0; /* avoid warnings */
- struct ambapp_dev *adev;
- struct ambapp_ahb_info *ahb;
-
- /* Scan for MAC AHB slave interface */
- adev = (void *)ambapp_for_each(&ambapp_plb, (OPTIONS_ALL|OPTIONS_AHB_SLVS),
- VENDOR_OPENCORES, OPENCORES_ETHMAC,
- ambapp_find_by_idx, NULL);
- if (!adev) {
- adev = (void *)ambapp_for_each(&ambapp_plb, (OPTIONS_ALL|OPTIONS_AHB_SLVS),
- VENDOR_GAISLER, GAISLER_ETHAHB,
- ambapp_find_by_idx, NULL);
- }
-
- if (adev)
- {
- ahb = DEV_TO_AHB(adev);
- base_addr = ahb->start[0];
- eth_irq = ahb->irq;
-
- /* clear control register and reset NIC */
- *(volatile int *) base_addr = 0;
- *(volatile int *) base_addr = 0x800;
- *(volatile int *) base_addr = 0;
- leon_open_eth_configuration.base_address = (void *) base_addr;
- leon_open_eth_configuration.vector = eth_irq + 0x10;
- leon_open_eth_configuration.txd_count = TDA_COUNT;
- leon_open_eth_configuration.rxd_count = RDA_COUNT;
- /* enable 100 MHz operation only if cpu frequency >= 50 MHz */
- if (LEON3_Timer_Regs->scaler_reload >= 49)
- leon_open_eth_configuration.en100MHz = 1;
- if (rtems_open_eth_driver_attach( config, &leon_open_eth_configuration )) {
- LEON_Clear_interrupt(eth_irq);
- LEON_Unmask_interrupt(eth_irq);
- }
- }
- return 0;
-}
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
deleted file mode 100644
index e4adac6c2b..0000000000
--- a/c/src/lib/libbsp/sparc/leon3/leon_smc91111/leon_smc91111.c
+++ /dev/null
@@ -1,89 +0,0 @@
-/**
- * @file
- * @ingroup sparc_leon3
- * @brief LEON3 BSP SMC91111 registration and low-level initialization
- */
-
-/*
- * 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 <bsp.h>
-#include <libchip/smc91111exp.h>
-#include <rtems/bspIo.h>
-#include <ambapp.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_leon3 (struct rtems_bsdnet_ifconfig *config,
- int attach)
-{
- unsigned long addr_mctrl = 0;
- struct grgpio_regs *io;
- struct ambapp_apb_info apbpio;
- struct ambapp_apb_info apbmctrl;
-
- if (ambapp_find_apbslv(&ambapp_plb, VENDOR_GAISLER, GAISLER_GPIO, &apbpio)
- != 1) {
- printk("SMC9111_leon3: didn't find PIO\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;
- }
- }
- }
- }
-
- /* Get controller address */
- addr_mctrl = (unsigned long) apbmctrl.start;
- io = (struct grgpio_regs *) apbpio.start;
-
- printk("Activating Leon3 io port for smsc_lan91cxx (pio:%x mctrl:%x)\n",
- (unsigned int)io, (unsigned int)addr_mctrl);
-
- /* Setup PIO IRQ */
- io->imask |= (1 << leon_scmv91111_configuration.pio);
- io->ipol |= (1 << leon_scmv91111_configuration.pio);
- io->iedge |= (1 << leon_scmv91111_configuration.pio);
- io->dir &= ~(1 << leon_scmv91111_configuration.pio);
-
- /* 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);
-};