#
.for unpaged_obj in head.o pre_init.o direct_tty_utils.o \
pg_utils.o klib.o omap_serial.o omap_rtc.o utility.o arch_reset.o \
+ omap_reset.o \
${MINLIB_OBJS_UNPAGED} ${MINC_OBJS_UNPAGED} ${SYS_OBJS_UNPAGED}
unpaged_${unpaged_obj}: ${unpaged_obj}
${OBJCOPY} --prefix-symbols=__k_unpaged_ ${.OBJDIR}/${unpaged_obj} $@
SRCS+= mpx.S arch_clock.c arch_do_vmctl.c arch_system.c \
omap_serial.c omap_timer.c omap_padconf.c omap_intr.c omap_rtc.c \
- exception.c klib.S memory.c \
+ omap_reset.c exception.c klib.S memory.c \
protect.c direct_tty_utils.c arch_reset.c \
pg_utils.c phys_copy.S phys_memset.S exc.S
OBJS.kernel+= ${UNPAGED_OBJS}
--- /dev/null
+#include <assert.h>
+#include <sys/types.h>
+#include <machine/cpu.h>
+#include <minix/type.h>
+#include <io.h>
+
+#include "kernel/kernel.h"
+#include "kernel/proc.h"
+#include "kernel/vm.h"
+#include "kernel/proto.h"
+#include "arch_proto.h"
+#include "omap_reset.h"
+
+#ifdef AM335X
+#define CM_BASE 0x44E00000
+#define CM_SIZE 0x1000
+#define PRM_DEVICE_OFFSET 0xf00
+#define PRM_RSTCTRL_REG 0x00
+#define RST_GLOBAL_WARM_SW_BIT 0
+#elif DM37XX
+#define CM_BASE 0x48307000
+#define CM_SIZE 0x1000
+#define PRM_RSTCTRL_REG 0x250
+#define RST_DPLL3_BIT 2
+#else
+#define CM_BASE 0x00000000
+#define CM_SIZE 0x1000
+#endif
+
+struct omap_reset
+{
+ vir_bytes base;
+ vir_bytes size;
+};
+
+static struct omap_reset omap_reset = {
+ .base = CM_BASE,
+ .size = CM_SIZE
+};
+
+static kern_phys_map reset_phys_map;
+
+void
+omap3_reset_init(void)
+{
+#if defined(AM335X) || defined(DM37XX)
+ kern_phys_map_ptr(omap_reset.base, omap_reset.size, &reset_phys_map,
+ &omap_reset.base);
+#endif /* AM335X || DM37XX */
+}
+
+void
+omap3_reset(void)
+{
+#ifdef AM335X
+ mmio_set((omap_reset.base + PRM_DEVICE_OFFSET + PRM_RSTCTRL_REG), (1 << RST_GLOBAL_WARM_SW_BIT));
+#elif DM37XX
+ mmio_set((omap_reset.base + PRM_RSTCTRL_REG), (1 << RST_DPLL3_BIT));
+#endif
+}