2 * This is a mini driver for the AM335X Real Time Clock. The majority of the
3 * work is done in user space in readclock, but for power-off the clock needs
4 * to be put into run mode at the last possible moment in arch_reset.c. This
5 * driver just implements mapping the memory and re-starting the clock.
10 #include <machine/cpu.h>
11 #include <minix/type.h>
12 #include <minix/board.h>
15 #include "kernel/kernel.h"
16 #include "kernel/proc.h"
17 #include "kernel/vm.h"
18 #include "kernel/proto.h"
19 #include "arch_proto.h"
22 #define RTC_SS_BASE 0x44e3e000
23 #define RTC_SS_SIZE 0x1000
24 #define RTC_CTRL_REG 0x40
25 #define RTC_CTRL_RTC_STOP_BIT 0
33 static struct omap_rtc omap_rtc
= {
38 static kern_phys_map rtc_phys_map
;
43 if (BOARD_IS_BB(machine
.board_id
)) {
44 kern_phys_map_ptr(omap_rtc
.base
, omap_rtc
.size
,
45 VMMF_UNCACHED
| VMMF_WRITE
, &rtc_phys_map
,
46 (vir_bytes
) & omap_rtc
.base
);
53 if (BOARD_IS_BB(machine
.board_id
)) {
54 /* Setting the stop bit starts the RTC running */
55 mmio_set((omap_rtc
.base
+ RTC_CTRL_REG
),
56 (1 << RTC_CTRL_RTC_STOP_BIT
));