shithub: riscv

ref: a08bf6831f5122fc9bfc6dccf77096f6ac2e4d03
dir: /sys/src/9/bcm/archbcm.c/

View raw version
/*
 * 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)
{
}