]> git.lizzy.rs Git - plan9front.git/blob - sys/src/9/bcm/archbcm.c
add raspberry pi kernel (from sources)
[plan9front.git] / sys / src / 9 / bcm / archbcm.c
1 /*
2  * bcm2835 (e.g. raspberry pi) architecture-specific stuff
3  */
4
5 #include "u.h"
6 #include "../port/lib.h"
7 #include "mem.h"
8 #include "dat.h"
9 #include "fns.h"
10 #include "../port/error.h"
11 #include "io.h"
12 #include "arm.h"
13
14 #define POWERREGS       (VIRTIO+0x100000)
15
16 enum {
17         Wdogfreq        = 65536,
18 };
19
20 /*
21  * Power management / watchdog registers
22  */
23 enum {
24         Rstc            = 0x1c>>2,
25                 Password        = 0x5A<<24,
26                 CfgMask         = 0x03<<4,
27                 CfgReset        = 0x02<<4,
28         Wdog            = 0x24>>2,
29 };
30
31 void
32 archreset(void)
33 {
34         fpon();
35 }
36
37 void
38 archreboot(void)
39 {
40         u32int *r;
41
42         r = (u32int*)POWERREGS;
43         r[Wdog] = Password | 1;
44         r[Rstc] = Password | (r[Rstc] & ~CfgMask) | CfgReset;
45         coherence();
46         for(;;)
47                 ;
48 }
49
50 void
51 cpuidprint(void)
52 {
53         print("cpu%d: %dMHz ARM1176JZF-S\n", m->machno, m->cpumhz);
54 }
55
56 void
57 archbcmlink(void)
58 {
59 }
60