Driver for Tadpole 3GX "Power Down Control (Aux 2) Register".
Based on existing auxreg.[ch] (Sparc Aux Register driver).
This commit is contained in:
parent
2fd2b78c1f
commit
7840960350
132
sys/arch/sparc/sparc/auxiotwo.c
Normal file
132
sys/arch/sparc/sparc/auxiotwo.c
Normal file
@ -0,0 +1,132 @@
|
||||
/* $NetBSD: auxiotwo.c,v 1.1 2000/02/25 18:17:24 jdc Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1999 The NetBSD Foundation, Inc.
|
||||
* All rights reserved.
|
||||
*
|
||||
* This code is derived from software contributed to The NetBSD Foundation
|
||||
* by Julian Coleman.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* 3. All advertising materials mentioning features or use of this software
|
||||
* must display the following acknowledgement:
|
||||
* This product includes software developed by the NetBSD
|
||||
* Foundation, Inc. and its contributors.
|
||||
* 4. Neither the name of The NetBSD Foundation nor the names of its
|
||||
* contributors may be used to endorse or promote products derived
|
||||
* from this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
|
||||
* ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
|
||||
* TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
|
||||
* BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
/*
|
||||
* Based on software developed by the Computer Systems Engineering group
|
||||
* at Lawrence Berkeley Laboratory.
|
||||
*/
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/systm.h>
|
||||
#include <sys/device.h>
|
||||
#include <sys/kernel.h>
|
||||
|
||||
#include <machine/autoconf.h>
|
||||
|
||||
#include <sparc/sparc/vaddrs.h>
|
||||
#include <sparc/sparc/auxiotwo.h>
|
||||
|
||||
static int auxiotwomatch __P((struct device *, struct cfdata *, void *));
|
||||
|
||||
static void auxiotwoattach
|
||||
__P((struct device *, struct device *, void *));
|
||||
|
||||
struct cfattach auxiotwo_obio_ca = {
|
||||
sizeof(struct device), auxiotwomatch, auxiotwoattach
|
||||
};
|
||||
|
||||
/*
|
||||
* The OPENPROM calls this "auxio2".
|
||||
*/
|
||||
static int
|
||||
auxiotwomatch(parent, cf, aux)
|
||||
struct device *parent;
|
||||
struct cfdata *cf;
|
||||
void *aux;
|
||||
{
|
||||
union obio_attach_args *uoba = aux;
|
||||
|
||||
if (uoba->uoba_isobio4 != 0)
|
||||
return (0);
|
||||
|
||||
return (strcmp("auxio2", uoba->uoba_sbus.sa_name) == 0);
|
||||
}
|
||||
|
||||
static void
|
||||
auxiotwoattach(parent, self, aux)
|
||||
struct device *parent, *self;
|
||||
void *aux;
|
||||
{
|
||||
union obio_attach_args *uoba = aux;
|
||||
struct sbus_attach_args *sa = &uoba->uoba_sbus;
|
||||
bus_space_handle_t bh;
|
||||
|
||||
if (sbus_bus_map(sa->sa_bustag,
|
||||
sa->sa_slot, sa->sa_offset,
|
||||
sizeof(long),
|
||||
BUS_SPACE_MAP_LINEAR,
|
||||
0, &bh) != 0) {
|
||||
printf("auxiotwoattach: can't map register\n");
|
||||
return;
|
||||
}
|
||||
|
||||
auxiotwo_reg = (volatile u_char *)bh;
|
||||
auxiotwo_regval = *auxiotwo_reg;
|
||||
printf("\n");
|
||||
|
||||
/*
|
||||
* This powers on the serial ports
|
||||
* XXX: this should probably be in the serial attach code.
|
||||
*/
|
||||
auxiotwobisc(AUXIOTWO_SON, 0);
|
||||
|
||||
/*
|
||||
* This powers them off :
|
||||
* auxiotwobisc(AUXIOTWO_SOF, 1);
|
||||
*/
|
||||
}
|
||||
|
||||
unsigned int
|
||||
auxiotwobisc(bis, bic)
|
||||
int bis, bic;
|
||||
{
|
||||
register int s;
|
||||
|
||||
if (auxiotwo_reg == 0)
|
||||
/*
|
||||
* Most machines do not have an `aux2' register; devices that
|
||||
* depend on it should not get configured if it's absent.
|
||||
*/
|
||||
panic("no aux2 register");
|
||||
|
||||
s = splhigh();
|
||||
auxiotwo_regval = (auxiotwo_regval | bis) & ~bic;
|
||||
*auxiotwo_reg = auxiotwo_regval;
|
||||
splx(s);
|
||||
return (auxiotwo_regval);
|
||||
}
|
61
sys/arch/sparc/sparc/auxiotwo.h
Normal file
61
sys/arch/sparc/sparc/auxiotwo.h
Normal file
@ -0,0 +1,61 @@
|
||||
/* $NetBSD: auxiotwo.h,v 1.1 2000/02/25 18:17:24 jdc Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1999 The NetBSD Foundation, Inc.
|
||||
* All rights reserved.
|
||||
*
|
||||
* This code is derived from software contributed to The NetBSD Foundation
|
||||
* by Julian Coleman, Waldi Ravens and Leo Weppelman.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* 3. All advertising materials mentioning features or use of this software
|
||||
* must display the following acknowledgement:
|
||||
* This product includes software developed by the NetBSD
|
||||
* Foundation, Inc. and its contributors.
|
||||
* 4. Neither the name of The NetBSD Foundation nor the names of its
|
||||
* contributors may be used to endorse or promote products derived
|
||||
* from this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
|
||||
* ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
|
||||
* TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
|
||||
* BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
/*
|
||||
* Based on software developed by the Computer Systems Engineering group
|
||||
* at Lawrence Berkeley Laboratory.
|
||||
*/
|
||||
|
||||
/*
|
||||
* The Tadpole Sparcbook 3 technical manual says :
|
||||
* bit 5 (0x20) Power Failure Detect (1 = power fail)
|
||||
* bit 1 (0x02) Clear Power Fail Detect (1 = clear)
|
||||
* bit 0 (0x01) Power Off (1 = off)
|
||||
* Setting bit 0 to 1 appears to have no effect. Bits 1:6 are untested
|
||||
*/
|
||||
|
||||
#define AUXIOTWO_SOF 0x80 /* Serial ports off (when set) */
|
||||
#define AUXIOTWO_PFD 0x20 /* Power Failure Detect */
|
||||
#define AUXIOTWO_CPF 0x02 /* Clear Power Fail Detect */
|
||||
#define AUXIOTWO_SON 0x01 /* Serial ports on (when cleared) */
|
||||
|
||||
#ifndef _LOCORE
|
||||
volatile u_char *auxiotwo_reg;
|
||||
u_char auxiotwo_regval;
|
||||
unsigned int auxiotwobisc __P((int, int));
|
||||
#endif
|
Loading…
Reference in New Issue
Block a user