Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/arch/evbarm Add support for Versatile Express A15 board.



details:   https://anonhg.NetBSD.org/src/rev/c843932d542e
branches:  trunk
changeset: 336058:c843932d542e
user:      slp <slp%NetBSD.org@localhost>
date:      Mon Feb 09 07:47:15 2015 +0000

description:
Add support for Versatile Express A15 board.

This has not been tested with real hardware, just with the software
model emulated by QEMU.

diffstat:

 sys/arch/evbarm/conf/files.vexpress         |   68 +++
 sys/arch/evbarm/conf/mk.vexpress            |   70 +++
 sys/arch/evbarm/conf/std.vexpress           |   64 +++
 sys/arch/evbarm/vexpress/if_smsh_axi.c      |  234 +++++++++++
 sys/arch/evbarm/vexpress/platform.h         |  102 +++++
 sys/arch/evbarm/vexpress/vexpress_axi.c     |  312 +++++++++++++++
 sys/arch/evbarm/vexpress/vexpress_intr.h    |  108 +++++
 sys/arch/evbarm/vexpress/vexpress_machdep.c |  568 ++++++++++++++++++++++++++++
 sys/arch/evbarm/vexpress/vexpress_plcom.c   |  194 +++++++++
 sys/arch/evbarm/vexpress/vexpress_plmmc.c   |  182 ++++++++
 sys/arch/evbarm/vexpress/vexpress_space.c   |  506 ++++++++++++++++++++++++
 sys/arch/evbarm/vexpress/vexpress_start.S   |  274 +++++++++++++
 sys/arch/evbarm/vexpress/vexpress_var.h     |   96 ++++
 13 files changed, 2778 insertions(+), 0 deletions(-)

diffs (truncated from 2830 to 300 lines):

diff -r 6829463acca3 -r c843932d542e sys/arch/evbarm/conf/files.vexpress
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/sys/arch/evbarm/conf/files.vexpress       Mon Feb 09 07:47:15 2015 +0000
@@ -0,0 +1,68 @@
+#      $NetBSD: files.vexpress,v 1.1 2015/02/09 07:47:15 slp Exp $
+#
+# Versatile Express board configuration info
+#
+
+file   arch/evbarm/vexpress/vexpress_machdep.c
+
+include "arch/arm/pic/files.pic"
+include "arch/arm/cortex/files.cortex"
+
+file    arch/arm/arm32/arm32_boot.c
+file    arch/arm/arm32/arm32_kvminit.c
+file    arch/arm/arm32/arm32_reboot.c
+file    arch/arm/arm32/irq_dispatch.S
+
+file   arch/evbarm/vexpress/vexpress_space.c
+
+# VEXPRESS AXI/AHB bus interface and SoC domains
+device  axi { [addr=-1], [size=0], [irq=-1], [irqbase=-1]} : bus_space_generic
+attach  axi at mainbus
+file    arch/evbarm/vexpress/vexpress_axi.c    axi
+
+# UART Interface
+attach  plcom at axi with vexpressplcom
+file    arch/evbarm/vexpress/vexpress_plcom.c  vexpressplcom
+
+# MMCI host controller
+attach plmmc at axi with vexpressplmmc
+file   arch/evbarm/vexpress/vexpress_plmmc.c   vexpressplmmc
+
+# SMSC LAN9118
+attach  smsh at axi with smsh_axi
+file    arch/evbarm/vexpress/if_smsh_axi.c     smsh_axi
+
+#      $NetBSD: files.vexpress,v 1.1 2015/02/09 07:47:15 slp Exp $
+#
+# Versatile Express board configuration info
+#
+
+file   arch/evbarm/vexpress/vexpress_machdep.c
+
+include "arch/arm/pic/files.pic"
+include "arch/arm/cortex/files.cortex"
+
+file    arch/arm/arm32/arm32_boot.c
+file    arch/arm/arm32/arm32_kvminit.c
+file    arch/arm/arm32/arm32_reboot.c
+file    arch/arm/arm32/irq_dispatch.S
+
+file   arch/evbarm/vexpress/vexpress_space.c
+
+# VEXPRESS AXI/AHB bus interface and SoC domains
+device  axi { [addr=-1], [size=0], [irq=-1], [irqbase=-1]} : bus_space_generic
+attach  axi at mainbus
+file    arch/evbarm/vexpress/vexpress_axi.c    axi
+
+# UART Interface
+attach  plcom at axi with vexpressplcom
+file    arch/evbarm/vexpress/vexpress_plcom.c  vexpressplcom
+
+# MMCI host controller
+attach plmmc at axi with vexpressplmmc
+file   arch/evbarm/vexpress/vexpress_plmmc.c   vexpressplmmc
+
+# SMSC LAN9118
+attach  smsh at axi with smsh_axi
+file    arch/evbarm/vexpress/if_smsh_axi.c     smsh_axi
+
diff -r 6829463acca3 -r c843932d542e sys/arch/evbarm/conf/mk.vexpress
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/sys/arch/evbarm/conf/mk.vexpress  Mon Feb 09 07:47:15 2015 +0000
@@ -0,0 +1,70 @@
+#      $NetBSD: mk.vexpress,v 1.1 2015/02/09 07:47:15 slp Exp $
+
+.if !empty(MACHINE_ARCH:M*eb)
+EXTRA_LINKFLAGS+=      --be8
+.endif
+
+SYSTEM_FIRST_OBJ=      vexpress_start.o
+SYSTEM_FIRST_SFILE=    ${THISARM}/vexpress/vexpress_start.S
+
+_OSRELEASE!=           ${HOST_SH} $S/conf/osrelease.sh
+
+KERNEL_BASE_PHYS?=$(LOADADDRESS)
+KERNEL_BASE_VIRT?=$(LOADADDRESS)
+
+MKUBOOTIMAGEARGS=      -A arm -T kernel
+MKUBOOTIMAGEARGS+=     -a $(KERNEL_BASE_PHYS) -e $(KERNEL_BASE_PHYS)
+MKUBOOTIMAGEARGS+=     -n "NetBSD/$(BOARDTYPE) ${_OSRELEASE}"
+MKUBOOTIMAGEARGS_NONE= ${MKUBOOTIMAGEARGS} -C none
+MKUBOOTIMAGEARGS_GZ=   ${MKUBOOTIMAGEARGS} -C gz
+
+SYSTEM_LD_TAIL_EXTRA+=; \
+       echo ${OBJCOPY} -S -O binary $@ $@.bin; \
+       ${OBJCOPY} -S -O binary $@ $@.bin; \
+       echo ${TOOL_GZIP} -9c $@.bin > $@.bin.gz; \
+       ${TOOL_GZIP} -9c $@.bin > $@.bin.gz; \
+       echo ${TOOL_MKUBOOTIMAGE} ${MKUBOOTIMAGEARGS_GZ} $@.bin.gz $@.gz.ub; \
+       ${TOOL_MKUBOOTIMAGE} ${MKUBOOTIMAGEARGS_GZ} $@.bin.gz $@.gz.ub; \
+       echo ${TOOL_MKUBOOTIMAGE} ${MKUBOOTIMAGEARGS_NONE} $@.bin $@.ub; \
+       ${TOOL_MKUBOOTIMAGE} ${MKUBOOTIMAGEARGS_NONE} $@.bin $@.ub; \
+       echo
+
+EXTRA_KERNELS+= ${KERNELS:@.KERNEL.@${.KERNEL.}.bin@}
+EXTRA_KERNELS+= ${KERNELS:@.KERNEL.@${.KERNEL.}.ub@}
+EXTRA_KERNELS+= ${KERNELS:@.KERNEL.@${.KERNEL.}.bin.gz@}
+EXTRA_KERNELS+= ${KERNELS:@.KERNEL.@${.KERNEL.}.gz.ub@}
+#      $NetBSD: mk.vexpress,v 1.1 2015/02/09 07:47:15 slp Exp $
+
+.if !empty(MACHINE_ARCH:M*eb)
+EXTRA_LINKFLAGS+=      --be8
+.endif
+
+SYSTEM_FIRST_OBJ=      vexpress_start.o
+SYSTEM_FIRST_SFILE=    ${THISARM}/vexpress/vexpress_start.S
+
+_OSRELEASE!=           ${HOST_SH} $S/conf/osrelease.sh
+
+KERNEL_BASE_PHYS?=$(LOADADDRESS)
+KERNEL_BASE_VIRT?=$(LOADADDRESS)
+
+MKUBOOTIMAGEARGS=      -A arm -T kernel
+MKUBOOTIMAGEARGS+=     -a $(KERNEL_BASE_PHYS) -e $(KERNEL_BASE_PHYS)
+MKUBOOTIMAGEARGS+=     -n "NetBSD/$(BOARDTYPE) ${_OSRELEASE}"
+MKUBOOTIMAGEARGS_NONE= ${MKUBOOTIMAGEARGS} -C none
+MKUBOOTIMAGEARGS_GZ=   ${MKUBOOTIMAGEARGS} -C gz
+
+SYSTEM_LD_TAIL_EXTRA+=; \
+       echo ${OBJCOPY} -S -O binary $@ $@.bin; \
+       ${OBJCOPY} -S -O binary $@ $@.bin; \
+       echo ${TOOL_GZIP} -9c $@.bin > $@.bin.gz; \
+       ${TOOL_GZIP} -9c $@.bin > $@.bin.gz; \
+       echo ${TOOL_MKUBOOTIMAGE} ${MKUBOOTIMAGEARGS_GZ} $@.bin.gz $@.gz.ub; \
+       ${TOOL_MKUBOOTIMAGE} ${MKUBOOTIMAGEARGS_GZ} $@.bin.gz $@.gz.ub; \
+       echo ${TOOL_MKUBOOTIMAGE} ${MKUBOOTIMAGEARGS_NONE} $@.bin $@.ub; \
+       ${TOOL_MKUBOOTIMAGE} ${MKUBOOTIMAGEARGS_NONE} $@.bin $@.ub; \
+       echo
+
+EXTRA_KERNELS+= ${KERNELS:@.KERNEL.@${.KERNEL.}.bin@}
+EXTRA_KERNELS+= ${KERNELS:@.KERNEL.@${.KERNEL.}.ub@}
+EXTRA_KERNELS+= ${KERNELS:@.KERNEL.@${.KERNEL.}.bin.gz@}
+EXTRA_KERNELS+= ${KERNELS:@.KERNEL.@${.KERNEL.}.gz.ub@}
diff -r 6829463acca3 -r c843932d542e sys/arch/evbarm/conf/std.vexpress
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/sys/arch/evbarm/conf/std.vexpress Mon Feb 09 07:47:15 2015 +0000
@@ -0,0 +1,64 @@
+#       $NetBSD: std.vexpress,v 1.1 2015/02/09 07:47:15 slp Exp $
+#
+# standard NetBSD/evbarm for VEXPRESS options
+
+machine evbarm arm
+include        "arch/evbarm/conf/std.evbarm"
+
+# Pull in VEXPRESS config definitions
+include        "arch/evbarm/conf/files.vexpress"
+
+makeoptions    CPUFLAGS="-march=armv7-a -mfpu=neon"
+
+# To support easy transit to ../arch/arm/arm32
+options        MODULAR
+options        MODULAR_DEFAULT_AUTOLOAD
+options        ARM_HAS_VBAR
+options        CORTEX_PMC
+options        __HAVE_CPU_COUNTER
+options        __HAVE_FAST_SOFTINTS            # should be in types.h
+#options       __HAVE_MM_MD_DIRECT_MAPPED_PHYS
+options        TPIDRPRW_IS_CURCPU
+options        KERNEL_BASE_EXT=0x80000000
+options        FPU_VFP
+
+makeoptions     KERNEL_BASE_PHYS="0x80000000"
+makeoptions     KERNEL_BASE_VIRT="0x80000000"
+makeoptions     BOARDTYPE="vexpress"
+makeoptions     BOARDMKFRAG="${THISARM}/conf/mk.vexpress"
+
+options         ARM_INTR_IMPL="<arch/evbarm/vexpress/vexpress_intr.h>"
+options         ARM_GENERIC_TODR
+
+#       $NetBSD: std.vexpress,v 1.1 2015/02/09 07:47:15 slp Exp $
+#
+# standard NetBSD/evbarm for VEXPRESS options
+
+machine evbarm arm
+include        "arch/evbarm/conf/std.evbarm"
+
+# Pull in VEXPRESS config definitions
+include        "arch/evbarm/conf/files.vexpress"
+
+makeoptions    CPUFLAGS="-march=armv7-a -mfpu=neon"
+
+# To support easy transit to ../arch/arm/arm32
+options        MODULAR
+options        MODULAR_DEFAULT_AUTOLOAD
+options        ARM_HAS_VBAR
+options        CORTEX_PMC
+options        __HAVE_CPU_COUNTER
+options        __HAVE_FAST_SOFTINTS            # should be in types.h
+#options       __HAVE_MM_MD_DIRECT_MAPPED_PHYS
+options        TPIDRPRW_IS_CURCPU
+options        KERNEL_BASE_EXT=0x80000000
+options        FPU_VFP
+
+makeoptions     KERNEL_BASE_PHYS="0x80000000"
+makeoptions     KERNEL_BASE_VIRT="0x80000000"
+makeoptions     BOARDTYPE="vexpress"
+makeoptions     BOARDMKFRAG="${THISARM}/conf/mk.vexpress"
+
+options         ARM_INTR_IMPL="<arch/evbarm/vexpress/vexpress_intr.h>"
+options         ARM_GENERIC_TODR
+
diff -r 6829463acca3 -r c843932d542e sys/arch/evbarm/vexpress/if_smsh_axi.c
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/sys/arch/evbarm/vexpress/if_smsh_axi.c    Mon Feb 09 07:47:15 2015 +0000
@@ -0,0 +1,234 @@
+/*     $NetBSD: if_smsh_axi.c,v 1.1 2015/02/09 07:47:15 slp Exp $      */
+/*-
+ * Copyright (c) 2015 The NetBSD Foundation, Inc.
+ * All rights reserved.
+ *
+ * This code is derived from software contributed to The NetBSD Foundation
+ * by Sergio L. Pascual.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
+ * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include <sys/cdefs.h>
+__KERNEL_RCSID(0, "$NetBSD: if_smsh_axi.c,v 1.1 2015/02/09 07:47:15 slp Exp $");
+
+#include "locators.h"
+
+#include <sys/param.h>
+#include <sys/device.h>
+#include <sys/errno.h>
+#include <sys/bus.h>
+#include <sys/systm.h>
+
+#include <net/if.h>
+#include <net/if_ether.h>
+#include <net/if_media.h>
+
+#include <dev/mii/miivar.h>
+
+#include <dev/ic/lan9118var.h>
+#include <dev/ic/lan9118reg.h>
+
+#include <evbarm/vexpress/vexpress_var.h>
+
+
+static int smsh_axi_match(device_t, struct cfdata *, void *);
+static void smsh_axi_attach(device_t, device_t, void *);
+
+CFATTACH_DECL_NEW(smsh_axi, sizeof(struct lan9118_softc),
+    smsh_axi_match, smsh_axi_attach, NULL, NULL);
+
+
+/* ARGSUSED */
+static int
+smsh_axi_match(device_t parent, struct cfdata * match, void *aux)
+{
+       struct axi_attach_args *aa = aux;
+
+       /* Disallow wildcarded values. */
+       if (aa->aa_addr == 0)
+               return 0;
+       if (aa->aa_irq == 0)
+               return 0;
+
+       return 1;
+}
+
+/* ARGSUSED */
+static void
+smsh_axi_attach(device_t parent, device_t self, void *aux)
+{
+       struct lan9118_softc *sc = device_private(self);
+       struct axi_attach_args *aa = aux;
+       prop_dictionary_t dict = device_properties(self);



Home | Main Index | Thread Index | Old Index