예제 #1
0
void
at91_rst_cpu_reset(void)
{

	if (at91_rst_sc) {
		cpu_reset_sam9g20(); /* May be null */

		WR4(at91_rst_sc, RST_MR,
		    RST_MR_ERSTL(0xd) | RST_MR_URSTEN | RST_MR_KEY);

		WR4(at91_rst_sc, RST_CR,
		    RST_CR_PROCRST |
		    RST_CR_PERRST  |
		    RST_CR_EXTRST  |
		    RST_CR_KEY);
	}
	while(1)
		continue;
}
예제 #2
0
void
cpu_reset(void)
{

	if (rst_sc) {

		cpu_reset_sam9g20(); /* May be null */

		WR4(rst_sc, RST_MR,
		    RST_MR_ERSTL(0xd) | RST_MR_URSTEN | RST_MR_KEY);

		WR4(rst_sc, RST_CR,
		    RST_CR_PROCRST |
		    RST_CR_PERRST  |
		    RST_CR_EXTRST  |
		    RST_CR_KEY);
	}

	for(;;) ;
}
예제 #3
0
static int
at91_rst_attach(device_t dev)
{
	struct rst_softc *sc;
	const char *cause;
	int rid, err;

	rst_sc = sc = device_get_softc(dev);
	sc->sc_dev = dev;

	callout_init(&sc->tick_ch, 0);

	rid = 0;
	sc->mem_res = bus_alloc_resource_any(dev, SYS_RES_MEMORY, &rid,
	    RF_ACTIVE);
	if (sc->mem_res == NULL) {
		device_printf(dev, "could not allocate memory resources.\n");
		err = ENOMEM;
		goto out;
	}
	rid = 0;
	sc->irq_res = bus_alloc_resource_any(dev, SYS_RES_IRQ, &rid,
	    RF_ACTIVE | RF_SHAREABLE);
	if (sc->irq_res == NULL) {
		device_printf(dev, "could not allocate interrupt resources.\n");
		err = ENOMEM;
		goto out;
	}

	/* Activate the interrupt. */
	err = bus_setup_intr(dev, sc->irq_res, INTR_TYPE_MISC | INTR_MPSAFE,
	    rst_intr, NULL, sc, &sc->intrhand);
	if (err)
		device_printf(dev, "could not establish interrupt handler.\n");

	WR4(rst_sc, RST_MR, RST_MR_ERSTL(0xd) | RST_MR_URSIEN | RST_MR_KEY);

	switch (RD4(sc, RST_SR) & RST_SR_RST_MASK) {
		case	RST_SR_RST_POW:
			cause = "Power On";
			break;
		case	RST_SR_RST_WAKE:
			cause = "Wake Up";
			break;
		case	RST_SR_RST_WDT:	
			cause = "Watchdog";
			break;
		case	RST_SR_RST_SOFT:
			cause = "Software Request";
			break;
		case	RST_SR_RST_USR:
			cause = "External (User)";
			break;
		default:
			cause = "Unknown";
			break;
	}

	device_printf(dev, "Reset cause: %s.\n", cause);
	/* cpu_reset_addr = cpu_reset; */

out:
	return (err);
}