Add board reset logic.

This commit is contained in:
gdamore 2006-02-16 01:52:37 +00:00
parent 547601cc8e
commit 982890b596
2 changed files with 30 additions and 5 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: dbau1500.c,v 1.2 2006/02/12 06:43:03 gdamore Exp $ */
/* $NetBSD: dbau1500.c,v 1.3 2006/02/16 01:52:37 gdamore Exp $ */
/*-
* Copyright (c) 2006 Itronix Inc.
@ -32,7 +32,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: dbau1500.c,v 1.2 2006/02/12 06:43:03 gdamore Exp $");
__KERNEL_RCSID(0, "$NetBSD: dbau1500.c,v 1.3 2006/02/16 01:52:37 gdamore Exp $");
#include <sys/param.h>
#include <machine/bus.h>
@ -41,9 +41,15 @@ __KERNEL_RCSID(0, "$NetBSD: dbau1500.c,v 1.2 2006/02/12 06:43:03 gdamore Exp $")
#include <evbmips/alchemy/board.h>
#include <evbmips/alchemy/dbau1500reg.h>
#define GET16(x) \
(*((volatile uint16_t *)MIPS_PHYS_TO_KSEG1(x)))
#define PUT16(x, v) \
(*((volatile uint16_t *)MIPS_PHYS_TO_KSEG1(x)) = (v))
static void dbau1500_init(void);
static int dbau1500_pci_intr_map(struct pci_attach_args *,
pci_intr_handle_t *);
static void dbau1500_reboot(void);
static const struct obiodev dbau1500_devices[] = {
#if 0
@ -58,6 +64,8 @@ static struct alchemy_board dbau1500_info = {
dbau1500_devices,
dbau1500_init,
dbau1500_pci_intr_map,
dbau1500_reboot,
NULL, /* poweroff */
};
const struct alchemy_board *
@ -124,3 +132,10 @@ dbau1500_pci_intr_map(struct pci_attach_args *pa, pci_intr_handle_t *ihp)
}
return 0;
}
void
dbau1500_reboot(void)
{
PUT16(DBAU1500_SOFTWARE_RESET, 0);
delay(100000); /* 100 msec */
}

View File

@ -1,4 +1,4 @@
/* $NetBSD: dbau1500reg.h,v 1.3 2006/02/12 06:43:03 gdamore Exp $ */
/* $NetBSD: dbau1500reg.h,v 1.4 2006/02/16 01:52:37 gdamore Exp $ */
/*-
* Copyright (c) 2006 Itronix Inc.
@ -37,8 +37,11 @@
#define DBAU1500_WHOAMI 0x0E000000
#define DBAU1500_STATUS 0x0E000004
#define DBAU1500_SOFTWARE_RESET 0x0E00001C
/* DBAU1550_WHOAMI */
/*
* DBAU1550_WHOAMI
*/
#define DBAU1500_WHOAMI_BOARD_MASK 0x00000f00
#define DBAU1500_WHOAMI_DBAU1500 0x6
@ -46,9 +49,16 @@
#define DBAU1500_WHOAMI_CPLD(x) (((x) >> 4) & 0xf)
#define DBAU1500_WHOAMI_DAUGHTER(x) ((x) & 0xf)
/* DBAU1550_STATUS */
/*
* DBAU1550_STATUS
*/
#define DBAU1500_STATUS_SWAPBOOT 0x20000000
#define DBAU1500_STATUS_PCMCIA1_INSERTED 0x00000020
#define DBAU1500_STATUS_PCMCIA0_INSERTED 0x00000010
#define DBAU1500_STATUS_PCMCIA1_VS 0x0000000c
#define DBAU1500_STATUS_PCMCIA0_VS 0x00000003
/*
* DBAU1550_SOFTWARE_RESET
*/
#define DBAU1500_SOFTWARE_RESET_RESET (1 << 15)