svn commit: r269958 - head/sys/arm/at91
Warner Losh
imp at FreeBSD.org
Thu Aug 14 04:21:21 UTC 2014
Author: imp
Date: Thu Aug 14 04:21:20 2014
New Revision: 269958
URL: http://svnweb.freebsd.org/changeset/base/269958
Log:
Start to add FDT support.
Added:
head/sys/arm/at91/at91_common.c (contents, props changed)
Modified:
head/sys/arm/at91/at91_machdep.c
Added: head/sys/arm/at91/at91_common.c
==============================================================================
--- /dev/null 00:00:00 1970 (empty, because file is newly added)
+++ head/sys/arm/at91/at91_common.c Thu Aug 14 04:21:20 2014 (r269958)
@@ -0,0 +1,90 @@
+#include <sys/cdefs.h>
+__FBSDID("$FreeBSD$");
+
+#define _ARM32_BUS_DMA_PRIVATE
+#include <sys/param.h>
+#include <sys/systm.h>
+#include <vm/vm.h>
+#include <machine/devmap.h>
+#include <machine/machdep.h>
+#include <arm/at91/at91var.h>
+#include <arm/at91/at91soc.h>
+#include <arm/at91/at91_aicreg.h>
+#include <dev/fdt/fdt_common.h>
+#include <dev/ofw/openfirm.h>
+#include <machine/fdt.h>
+
+extern const struct arm_devmap_entry at91_devmap[];
+extern struct bus_space at91_bs_tag;
+bus_space_tag_t fdtbus_bs_tag = &at91_bs_tag;
+
+struct fdt_fixup_entry fdt_fixup_table[] = {
+ { NULL, NULL }
+};
+
+static int
+fdt_aic_decode_ic(phandle_t node, pcell_t *intr, int *interrupt, int *trig,
+ int *pol)
+{
+ int offset;
+
+ if (fdt_is_compatible(node, "atmel,at91rm9200-aic"))
+ offset = 0;
+ else
+ return (ENXIO);
+
+ *interrupt = fdt32_to_cpu(intr[0]) + offset;
+ *trig = INTR_TRIGGER_CONFORM;
+ *pol = INTR_POLARITY_CONFORM;
+
+ return (0);
+}
+
+fdt_pic_decode_t fdt_pic_table[] = {
+ &fdt_aic_decode_ic,
+ NULL
+};
+
+static void
+at91_eoi(void *unused)
+{
+ uint32_t *eoicr = (uint32_t *)(0xdffff000 + IC_EOICR);
+
+ *eoicr = 0;
+}
+
+
+vm_offset_t
+initarm_lastaddr(void)
+{
+
+ return (arm_devmap_lastaddr());
+}
+
+void
+initarm_early_init(void)
+{
+
+ arm_post_filter = at91_eoi;
+ at91_soc_id();
+ arm_devmap_register_table(at91_devmap);
+}
+
+int
+initarm_devmap_init(void)
+{
+
+// arm_devmap_add_entry(0xfff00000, 0x00100000); /* 1MB - uart, aic and timers*/
+
+ return (0);
+}
+
+void
+initarm_gpio_init(void)
+{
+}
+
+void
+initarm_late_init(void)
+{
+}
Modified: head/sys/arm/at91/at91_machdep.c
==============================================================================
--- head/sys/arm/at91/at91_machdep.c Thu Aug 14 04:21:14 2014 (r269957)
+++ head/sys/arm/at91/at91_machdep.c Thu Aug 14 04:21:20 2014 (r269958)
@@ -43,6 +43,8 @@
* Created : 17/09/94
*/
+#include "opt_platform.h"
+
#include <sys/cdefs.h>
__FBSDID("$FreeBSD$");
@@ -111,8 +113,12 @@ __FBSDID("$FreeBSD$");
/* this should be evenly divisable by PAGE_SIZE / L2_TABLE_SIZE_REAL (or 4) */
#define NUM_KERNEL_PTS (KERNEL_PT_AFKERNEL + KERNEL_PT_AFKERNEL_NUM)
+extern struct bus_space at91_bs_tag;
+
struct pv_addr kernel_pt_table[NUM_KERNEL_PTS];
+uint32_t at91_master_clock;
+
/* Static device mappings. */
const struct arm_devmap_entry at91_devmap[] = {
/*
@@ -194,15 +200,6 @@ const struct arm_devmap_entry at91_devma
{ 0, 0, 0, 0, 0, }
};
-/* Physical and virtual addresses for some global pages */
-
-struct pv_addr systempage;
-struct pv_addr msgbufpv;
-struct pv_addr irqstack;
-struct pv_addr undstack;
-struct pv_addr abtstack;
-struct pv_addr kernelstack;
-
#ifdef LINUX_BOOT_ABI
extern int membanks;
extern int memstart[];
@@ -444,6 +441,16 @@ board_init(void)
}
#endif
+#ifndef FDT
+/* Physical and virtual addresses for some global pages */
+
+struct pv_addr msgbufpv;
+struct pv_addr kernelstack;
+struct pv_addr systempage;
+struct pv_addr irqstack;
+struct pv_addr abtstack;
+struct pv_addr undstack;
+
void *
initarm(struct arm_boot_params *abp)
{
@@ -651,6 +658,7 @@ initarm(struct arm_boot_params *abp)
return ((void *)(kernelstack.pv_va + USPACE_SVC_STACK_TOP -
sizeof(struct pcb)));
}
+#endif
/*
* These functions are handled elsewhere, so make them nops here.
More information about the svn-src-all
mailing list