Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src Add initial support for Olimex iMX233 based OLinuXino boards.
details: https://anonhg.NetBSD.org/src/rev/b98b6138a4c2
branches: trunk
changeset: 782796:b98b6138a4c2
user: jkunz <jkunz%NetBSD.org@localhost>
date: Tue Nov 20 19:08:45 2012 +0000
description:
Add initial support for Olimex iMX233 based OLinuXino boards.
https://www.olimex.com/Products/OLinuXino/iMX233/
Contributed by Petri Laakso.
diffstat:
distrib/sets/lists/base/md.evbarm | 3 +-
sys/arch/evbarm/conf/IMX23_OLINUXINO | 57 +
sys/arch/evbarm/conf/files.imx23_olinuxino | 10 +
sys/arch/evbarm/conf/mk.imx23_olinuxino | 7 +
sys/arch/evbarm/conf/std.imx23_olinuxino | 21 +
sys/arch/evbarm/imx23_olinuxino/imx23_olinuxino_machdep.c | 679 ++++++++++++++
sys/arch/evbarm/imx23_olinuxino/imx23_olinuxino_start.S | 185 +++
sys/arch/evbarm/stand/Makefile | 3 +-
sys/arch/evbarm/stand/bootimx23/Makefile | 52 +
sys/arch/evbarm/stand/bootimx23/boot_prep.c | 68 +
sys/arch/evbarm/stand/bootimx23/bootimx23.bd | 31 +
sys/arch/evbarm/stand/bootimx23/clock_prep.c | 255 +++++
sys/arch/evbarm/stand/bootimx23/common.c | 69 +
sys/arch/evbarm/stand/bootimx23/common.h | 52 +
sys/arch/evbarm/stand/bootimx23/emi_prep.c | 151 +++
sys/arch/evbarm/stand/bootimx23/pinctrl_prep.c | 485 ++++++++++
sys/arch/evbarm/stand/bootimx23/power_prep.c | 579 +++++++++++
17 files changed, 2705 insertions(+), 2 deletions(-)
diffs (truncated from 2790 to 300 lines):
diff -r f660992dda98 -r b98b6138a4c2 distrib/sets/lists/base/md.evbarm
--- a/distrib/sets/lists/base/md.evbarm Tue Nov 20 19:06:12 2012 +0000
+++ b/distrib/sets/lists/base/md.evbarm Tue Nov 20 19:08:45 2012 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: md.evbarm,v 1.11 2012/11/15 19:49:11 jkunz Exp $
+# $NetBSD: md.evbarm,v 1.12 2012/11/20 19:09:47 jkunz Exp $
./usr/mdec/gzboot_ADI_BRH_0x00140000.bin base-sysutil-bin
./usr/mdec/gzboot_GEMINI_0x01600000.bin base-sysutil-bin
./usr/mdec/gzboot_IQ80310_0x00080000.bin base-sysutil-bin
@@ -8,6 +8,7 @@
./usr/mdec/gzboot_SMDK2800_0x00100000.bin base-sysutil-bin
./usr/mdec/gzboot_TS7200_0x60660000.bin base-sysutil-bin
./usr/mdec/bootmini2440 base-sysutil-bin
+./usr/mdec/bootimx23 base-sysutil-bin
./usr/sbin/elftosb base-sysutil-bin
./usr/sbin/sbtool base-sysutil-bin
./usr/sbin/sbkeygen base-sysutil-bin
diff -r f660992dda98 -r b98b6138a4c2 sys/arch/evbarm/conf/IMX23_OLINUXINO
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/sys/arch/evbarm/conf/IMX23_OLINUXINO Tue Nov 20 19:08:45 2012 +0000
@@ -0,0 +1,57 @@
+# $Id: IMX23_OLINUXINO,v 1.1 2012/11/20 19:08:45 jkunz Exp $
+#
+# IMX23_OLINUXINO -- Olimex i.MX23 OLinuXino kernel configuration file.
+#
+
+include "arch/evbarm/conf/std.imx23_olinuxino"
+
+maxusers 8
+
+config netbsd root on ? type ?
+
+# The main bus device
+mainbus0 at root
+
+# The boot CPU
+cpu0 at mainbus?
+
+# APBH bus
+apbh0 at mainbus? base 0x80000000 size 0x00040000
+
+# APBH DMA
+#apbdma0 at apbh? addr 0x80004000 size 0x2000 irq -1
+
+# Interrupt controller
+icoll0 at apbh? addr 0x80000000 size 0x2000 irq -1
+
+# Synchronous serial port for SD/MMC
+#ssp0 at apbh? addr 0x80010000 size 0x2000 irq 15
+#sdmmc* at ssp?
+#ld* at sdmmc?
+
+# APBX bus
+apbx0 at mainbus? base 0x80040000 size 0x00040000
+
+# APBX DMA
+#apbdma1 at apbx? addr 0x80024000 size 0x2000 irq -1
+
+# Timers and rotary decoder
+timrot0 at apbx? addr 0x80068020 size 0x20 irq 28
+timrot1 at apbx? addr 0x80068040 size 0x20 irq 29
+#timrot2 at apbx? addr 0x80068060 size 0x20 irq 30
+#timrot3 at apbx? addr 0x80068080 size 0x20 irq 31
+
+plcom0 at apbx? addr 0x80070000 size 0x1000 irq 0
+
+options MEMSIZE=64
+options DDB
+options HZ=100
+
+options MEMORY_DISK_HOOKS
+options MEMORY_DISK_IS_ROOT
+options MEMORY_DISK_ROOT_SIZE=12288 # 6 megs
+options MEMORY_DISK_RBFLAGS=RB_SINGLE
+
+pseudo-device md
+
+file-system FFS
diff -r f660992dda98 -r b98b6138a4c2 sys/arch/evbarm/conf/files.imx23_olinuxino
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/sys/arch/evbarm/conf/files.imx23_olinuxino Tue Nov 20 19:08:45 2012 +0000
@@ -0,0 +1,10 @@
+# $Id: files.imx23_olinuxino,v 1.1 2012/11/20 19:08:45 jkunz Exp $
+#
+# Olimex i.MX23 OLinuXino board configuration info.
+#
+
+# Pull in SoC support
+include "arch/arm/imx/files.imx23"
+
+file arch/evbarm/imx23_olinuxino/imx23_olinuxino_machdep.c
+
diff -r f660992dda98 -r b98b6138a4c2 sys/arch/evbarm/conf/mk.imx23_olinuxino
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/sys/arch/evbarm/conf/mk.imx23_olinuxino Tue Nov 20 19:08:45 2012 +0000
@@ -0,0 +1,7 @@
+# $Id: mk.imx23_olinuxino,v 1.1 2012/11/20 19:08:45 jkunz Exp $
+
+SYSTEM_FIRST_OBJ= imx23_olinuxino_start.o
+SYSTEM_FIRST_SFILE= ${THISARM}/imx23_olinuxino/imx23_olinuxino_start.S
+
+KERNEL_BASE_PHYS=0x40000000
+KERNEL_BASE_VIRT=0x40000000
diff -r f660992dda98 -r b98b6138a4c2 sys/arch/evbarm/conf/std.imx23_olinuxino
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/sys/arch/evbarm/conf/std.imx23_olinuxino Tue Nov 20 19:08:45 2012 +0000
@@ -0,0 +1,21 @@
+# $Id: std.imx23_olinuxino,v 1.1 2012/11/20 19:08:45 jkunz Exp $
+#
+# IMX23_OLINUXINO standard kernel options.
+
+machine evbarm arm
+include "conf/std" # Standard MI options.
+include "arch/arm/conf/std.arm" # Standard NetBSD/arm options.
+
+options EXEC_ELF32
+options CPU_ARM9E
+
+# To support easy transit to ../arch/arm/arm32
+options ARM32
+options ARM_INTR_IMPL="<arch/arm/imx/imx23_intr.h>"
+options EVBARM_BOARDTYPE=OLinuXino
+options KERNEL_BASE_EXT=0x40000000
+
+makeoptions BOARDMKFRAG="${THISARM}/conf/mk.imx23_olinuxino"
+makeoptions CPUFLAGS="-march=armv5te -mtune=arm926ej-s"
+
+include "arch/evbarm/conf/files.imx23_olinuxino"
diff -r f660992dda98 -r b98b6138a4c2 sys/arch/evbarm/imx23_olinuxino/imx23_olinuxino_machdep.c
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/sys/arch/evbarm/imx23_olinuxino/imx23_olinuxino_machdep.c Tue Nov 20 19:08:45 2012 +0000
@@ -0,0 +1,679 @@
+/* $Id: imx23_olinuxino_machdep.c,v 1.1 2012/11/20 19:08:45 jkunz Exp $ */
+
+/*
+ * Copyright (c) 2012 The NetBSD Foundation, Inc.
+ * All rights reserved.
+ *
+ * This code is derived from software contributed to The NetBSD Foundation
+ * by Petri Laakso.
+ *
+ * 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/bus.h>
+#include <sys/cdefs.h>
+#include <sys/device.h>
+#include <sys/lwp.h>
+#include <sys/mount.h>
+#include <sys/mutex.h>
+#include <sys/param.h>
+#include <sys/reboot.h>
+#include <sys/rnd.h>
+#include <sys/termios.h>
+#include <sys/types.h>
+
+#include <uvm/uvm.h>
+#include <uvm/uvm_prot.h>
+#include <uvm/uvm_pmap.h>
+
+#include <machine/db_machdep.h>
+#include <machine/bootconfig.h>
+#include <machine/frame.h>
+#include <machine/param.h>
+#include <machine/pcb.h>
+#include <machine/pmap.h>
+
+#include <arm/undefined.h>
+#include <arm/arm32/machdep.h>
+
+#include <arm/imx/imx23_digctlreg.h>
+#include <arm/imx/imx23_clkctrlreg.h>
+#include <arm/imx/imx23_rtcreg.h>
+#include <arm/imx/imx23_uartdbgreg.h>
+#include <arm/imx/imx23var.h>
+
+#include "plcom.h"
+#if (NPLCOM > 0)
+#include <evbarm/dev/plcomreg.h>
+#include <evbarm/dev/plcomvar.h>
+#endif
+
+#include "opt_evbarm_boardtype.h"
+
+static vaddr_t get_ttb(void);
+static void setup_real_page_tables(void);
+//static void entropy_init(void);
+
+/*
+ * Static device map for i.MX23 peripheral address space.
+ */
+#define _A(a) ((a) & ~L1_S_OFFSET)
+#define _S(s) (((s) + L1_S_SIZE - 1) & ~(L1_S_SIZE-1))
+static const struct pmap_devmap imx23_devmap[] = {
+ {
+ _A(APBH_BASE), /* Virtual address. */
+ _A(APBH_BASE), /* Physical address. */
+ _S(APBH_SIZE + APBX_SIZE), /* APBX located after APBH. */
+ VM_PROT_READ|VM_PROT_WRITE, /* Protection bits. */
+ PTE_NOCACHE /* Cache attributes. */
+ },
+ { 0, 0, 0, 0, 0 }
+};
+#undef _A
+#undef _S
+
+static vm_offset_t physical_freestart;
+static vm_offset_t physical_freeend;
+static u_int free_pages;
+//static rndsave_t imx23_boot_rsp;
+
+BootConfig bootconfig;
+vm_offset_t physical_start;
+vm_offset_t physical_end;
+char *boot_args;
+paddr_t msgbufphys;
+
+extern char KERNEL_BASE_phys;
+extern char KERNEL_BASE_virt;
+extern char _end[];
+extern char __data_start[];
+extern char _edata[];
+extern char __bss_start[];
+extern char __bss_end__[];
+extern pv_addr_t kernelstack;
+
+extern u_int data_abort_handler_address;
+extern u_int prefetch_abort_handler_address;
+
+/* Define various stack sizes in pages. */
+#define FIQ_STACK_SIZE 1
+#define IRQ_STACK_SIZE 1
+#define ABT_STACK_SIZE 1
+#define UND_STACK_SIZE 1
+
+/* Macros to translate between physical and virtual addresses. */
+#define KERNEL_BASE_PHYS ((paddr_t)&KERNEL_BASE_phys)
+#define KERNEL_BASE_VIRT ((vaddr_t)&KERNEL_BASE_virt)
+#define KERN_VTOPHYS(va) \
+ ((paddr_t)((vaddr_t)va - KERNEL_BASE_VIRT + KERNEL_BASE_PHYS))
+#define KERN_PHYSTOV(pa) \
+ ((vaddr_t)((paddr_t)pa - KERNEL_BASE_PHYS + KERNEL_BASE_VIRT))
+
+#define KERNEL_PT_SYS 0 /* L2 table for mapping vectors page. */
+#define KERNEL_PT_KERNEL 1 /* L2 table for mapping kernel. */
+#define KERNEL_PT_KERNEL_NUM 4
+
+#define KERNEL_PT_VMDATA (KERNEL_PT_KERNEL + KERNEL_PT_KERNEL_NUM)
+/* Page tables for mapping kernel VM */
+#define KERNEL_PT_VMDATA_NUM 4 /* start with 16MB of KVM */
+#define NUM_KERNEL_PTS (KERNEL_PT_VMDATA + KERNEL_PT_VMDATA_NUM)
+
+pv_addr_t kernel_pt_table[NUM_KERNEL_PTS];
+
+#define KERNEL_VM_BASE (KERNEL_BASE + 0x01000000)
+#define KERNEL_VM_SIZE (0xf0000000 - KERNEL_VM_BASE)
+
+#define REG_RD(reg) *(volatile uint32_t *)(reg)
+#define REG_WR(reg, val) \
+do { \
+ *(volatile uint32_t *)((reg)) = val; \
+} while (0)
+
+/*
+ * Initialize everything and return new svc stack pointer.
+ */
+u_int
+initarm(void *arg)
+{
+
+ if (set_cpufuncs())
+ panic("set_cpufuncs failed");
+
+ pmap_devmap_bootstrap(get_ttb(), imx23_devmap);
+
+ cpu_domains((DOMAIN_CLIENT << (PMAP_DOMAIN_KERNEL*2)) | DOMAIN_CLIENT);
+
+ consinit();
+ //entropy_init();
+
+ /* Talk to the user. */
Home |
Main Index |
Thread Index |
Old Index