summaryrefslogtreecommitdiff
path: root/sys/src/9/bcm/archbcm.c
diff options
context:
space:
mode:
authorcinap_lenrek <cinap_lenrek@gmx.de>2013-01-26 17:33:56 +0100
committercinap_lenrek <cinap_lenrek@gmx.de>2013-01-26 17:33:56 +0100
commitbc610a1b1c32f6e2e9b034217bb3ce9a7defa739 (patch)
tree98fa1e680867eaf19c1be5e818a570713fa7a286 /sys/src/9/bcm/archbcm.c
parentea108c8ca6e726ac008f75775ab83775ec233171 (diff)
add raspberry pi kernel (from sources)
Diffstat (limited to 'sys/src/9/bcm/archbcm.c')
-rw-r--r--sys/src/9/bcm/archbcm.c60
1 files changed, 60 insertions, 0 deletions
diff --git a/sys/src/9/bcm/archbcm.c b/sys/src/9/bcm/archbcm.c
new file mode 100644
index 000000000..eb9c4c2d8
--- /dev/null
+++ b/sys/src/9/bcm/archbcm.c
@@ -0,0 +1,60 @@
+/*
+ * bcm2835 (e.g. raspberry pi) architecture-specific stuff
+ */
+
+#include "u.h"
+#include "../port/lib.h"
+#include "mem.h"
+#include "dat.h"
+#include "fns.h"
+#include "../port/error.h"
+#include "io.h"
+#include "arm.h"
+
+#define POWERREGS (VIRTIO+0x100000)
+
+enum {
+ Wdogfreq = 65536,
+};
+
+/*
+ * Power management / watchdog registers
+ */
+enum {
+ Rstc = 0x1c>>2,
+ Password = 0x5A<<24,
+ CfgMask = 0x03<<4,
+ CfgReset = 0x02<<4,
+ Wdog = 0x24>>2,
+};
+
+void
+archreset(void)
+{
+ fpon();
+}
+
+void
+archreboot(void)
+{
+ u32int *r;
+
+ r = (u32int*)POWERREGS;
+ r[Wdog] = Password | 1;
+ r[Rstc] = Password | (r[Rstc] & ~CfgMask) | CfgReset;
+ coherence();
+ for(;;)
+ ;
+}
+
+void
+cpuidprint(void)
+{
+ print("cpu%d: %dMHz ARM1176JZF-S\n", m->machno, m->cpumhz);
+}
+
+void
+archbcmlink(void)
+{
+}
+