3 #include <machine/cpu.h>
4 #include <minix/type.h>
5 #include <minix/board.h>
8 #include "kernel/kernel.h"
9 #include "kernel/proc.h"
10 #include "kernel/vm.h"
11 #include "kernel/proto.h"
12 #include "arch_proto.h"
13 #include "bsp_reset.h"
17 #define AM335X_CM_BASE 0x44E00000
18 #define AM335X_CM_SIZE 0x1000
20 #define AM335X_PRM_DEVICE_OFFSET 0xf00
21 #define AM335X_PRM_RSTCTRL_REG 0x00
22 #define AM335X_RST_GLOBAL_WARM_SW_BIT 0
24 #define DM37XX_CM_BASE 0x48307000
25 #define DM37XX_CM_SIZE 0x1000
26 #define DM37XX_PRM_RSTCTRL_REG 0x250
27 #define DM37XX_RST_DPLL3_BIT 2
35 static struct omap_reset omap_reset
;
37 static kern_phys_map reset_phys_map
;
42 if (BOARD_IS_BBXM(machine
.board_id
)) {
43 omap_reset
.base
= DM37XX_CM_BASE
;
44 omap_reset
.size
= DM37XX_CM_SIZE
;
45 } else if (BOARD_IS_BB(machine
.board_id
)) {
46 omap_reset
.base
= AM335X_CM_BASE
;
47 omap_reset
.size
= AM335X_CM_SIZE
;
50 kern_phys_map_ptr(omap_reset
.base
, omap_reset
.size
,
51 VMMF_UNCACHED
| VMMF_WRITE
,
52 &reset_phys_map
, (vir_bytes
) & omap_reset
.base
);
58 if (BOARD_IS_BBXM(machine
.board_id
)) {
59 mmio_set((omap_reset
.base
+ DM37XX_PRM_RSTCTRL_REG
),
60 (1 << DM37XX_RST_DPLL3_BIT
));
61 } else if (BOARD_IS_BB(machine
.board_id
)) {
62 mmio_set((omap_reset
.base
+ AM335X_PRM_DEVICE_OFFSET
+
63 AM335X_PRM_RSTCTRL_REG
),
64 (1 << AM335X_RST_GLOBAL_WARM_SW_BIT
));
73 * The am335x can signal an external power management chip to cut the power
74 * by toggling the PMIC_POWER_EN pin. It might fail if there isn't an
75 * external PMIC or if the PMIC hasn't been configured to respond to toggles.
76 * The only way to pull the pin low is via ALARM2 (see TRM 20.3.3.8).
77 * At this point PM should have already signaled readclock to set the alarm.
79 if (BOARD_IS_BB(machine
.board_id
)) {
80 /* rtc was frozen to prevent premature power-off, unfreeze it
84 /* wait for the alarm to go off and PMIC to disable power to