]> rtime.felk.cvut.cz Git - l4.git/blob - kernel/fiasco/src/kern/arm/bsp/imx/reset-arm-imx.cpp
update
[l4.git] / kernel / fiasco / src / kern / arm / bsp / imx / reset-arm-imx.cpp
1 IMPLEMENTATION [arm && imx21]:
2
3 #include "io.h"
4 #include "kmem.h"
5
6 void __attribute__ ((noreturn))
7 platform_reset(void)
8 {
9   enum {
10     WCR  = Kmem::Watchdog_map_base + 0,
11     WCR_SRS = 1 << 4, // Software Reset Signal
12
13     PLL_PCCR1        = Kmem::Pll_map_base + 0x24,
14     PLL_PCCR1_WDT_EN = 1 << 24,
15   };
16
17   // WDT CLock Enable
18   Io::write<Unsigned32>(Io::read<Unsigned32>(PLL_PCCR1) | PLL_PCCR1_WDT_EN, PLL_PCCR1);
19
20   // Assert Software reset signal by making the bit zero
21   Io::write<Unsigned16>(Io::read<Unsigned16>(WCR) & ~WCR_SRS, WCR);
22
23   for (;;)
24     ;
25 }
26
27 // ------------------------------------------------------------------------
28 IMPLEMENTATION [arm && (imx35 || imx51 || imx53)]:
29
30 void platform_imx_cpus_off()
31 {}
32
33 // ------------------------------------------------------------------------
34 IMPLEMENTATION [arm && imx6]:
35
36 void platform_imx_cpus_off()
37 {
38   // switch off core1-3
39   Io::clear<Mword>(7 << 22, Mem_layout::Src_map_base + 0);
40 }
41
42 // ------------------------------------------------------------------------
43 IMPLEMENTATION [arm && (imx35 || imx51 || imx53 || imx6)]:
44
45 #include "io.h"
46 #include "kmem.h"
47
48 void __attribute__ ((noreturn))
49 platform_reset(void)
50 {
51   enum {
52     WCR  = Kmem::Watchdog_map_base + 0,
53     WCR_SRS = 1 << 4, // Software Reset Signal
54   };
55
56   platform_imx_cpus_off();
57
58   // Assert Software reset signal by making the bit zero
59   Io::write<Unsigned16>(Io::read<Unsigned16>(WCR) & ~WCR_SRS, WCR);
60
61   for (;;)
62     ;
63 }