xref: /illumos-gate/usr/src/uts/sun4u/excalibur/sys/xcalppm_reg.h (revision 7c478bd95313f5f23a4c958a745db2134aa03244)
1*7c478bd9Sstevel@tonic-gate /*
2*7c478bd9Sstevel@tonic-gate  * CDDL HEADER START
3*7c478bd9Sstevel@tonic-gate  *
4*7c478bd9Sstevel@tonic-gate  * The contents of this file are subject to the terms of the
5*7c478bd9Sstevel@tonic-gate  * Common Development and Distribution License, Version 1.0 only
6*7c478bd9Sstevel@tonic-gate  * (the "License").  You may not use this file except in compliance
7*7c478bd9Sstevel@tonic-gate  * with the License.
8*7c478bd9Sstevel@tonic-gate  *
9*7c478bd9Sstevel@tonic-gate  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
10*7c478bd9Sstevel@tonic-gate  * or http://www.opensolaris.org/os/licensing.
11*7c478bd9Sstevel@tonic-gate  * See the License for the specific language governing permissions
12*7c478bd9Sstevel@tonic-gate  * and limitations under the License.
13*7c478bd9Sstevel@tonic-gate  *
14*7c478bd9Sstevel@tonic-gate  * When distributing Covered Code, include this CDDL HEADER in each
15*7c478bd9Sstevel@tonic-gate  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
16*7c478bd9Sstevel@tonic-gate  * If applicable, add the following below this CDDL HEADER, with the
17*7c478bd9Sstevel@tonic-gate  * fields enclosed by brackets "[]" replaced with your own identifying
18*7c478bd9Sstevel@tonic-gate  * information: Portions Copyright [yyyy] [name of copyright owner]
19*7c478bd9Sstevel@tonic-gate  *
20*7c478bd9Sstevel@tonic-gate  * CDDL HEADER END
21*7c478bd9Sstevel@tonic-gate  */
22*7c478bd9Sstevel@tonic-gate /*
23*7c478bd9Sstevel@tonic-gate  * Copyright (c) 1999-2001 by Sun Microsystems, Inc.
24*7c478bd9Sstevel@tonic-gate  * All rights reserved.
25*7c478bd9Sstevel@tonic-gate  */
26*7c478bd9Sstevel@tonic-gate 
27*7c478bd9Sstevel@tonic-gate /*
28*7c478bd9Sstevel@tonic-gate  * Platform Power Management
29*7c478bd9Sstevel@tonic-gate  *
30*7c478bd9Sstevel@tonic-gate  * Register and bit definitions of the power-related parts
31*7c478bd9Sstevel@tonic-gate  */
32*7c478bd9Sstevel@tonic-gate 
33*7c478bd9Sstevel@tonic-gate #ifndef	_SYS_XCALPPM_REG_H
34*7c478bd9Sstevel@tonic-gate #define	_SYS_XCALPPM_REG_H
35*7c478bd9Sstevel@tonic-gate 
36*7c478bd9Sstevel@tonic-gate #pragma ident	"%Z%%M%	%I%	%E% SMI"
37*7c478bd9Sstevel@tonic-gate 
38*7c478bd9Sstevel@tonic-gate #ifdef	__cplusplus
39*7c478bd9Sstevel@tonic-gate extern "C" {
40*7c478bd9Sstevel@tonic-gate #endif
41*7c478bd9Sstevel@tonic-gate 
42*7c478bd9Sstevel@tonic-gate /*
43*7c478bd9Sstevel@tonic-gate  * Registers accessed by the ppm driver.  These registers actually come
44*7c478bd9Sstevel@tonic-gate  * from different ASICs on the system and are collected for us
45*7c478bd9Sstevel@tonic-gate  * by the prom into a single device node.  These registers are:
46*7c478bd9Sstevel@tonic-gate  *
47*7c478bd9Sstevel@tonic-gate  *	BBC E* Control Register (other registers like E* Assert Change Time
48*7c478bd9Sstevel@tonic-gate  *	    or E* PLL Settle Time are offseted from this address)
49*7c478bd9Sstevel@tonic-gate  *	Mode Auxio Register
50*7c478bd9Sstevel@tonic-gate  *	SuperI/O Configuration Register
51*7c478bd9Sstevel@tonic-gate  *	SuperI/O GPIO Registers
52*7c478bd9Sstevel@tonic-gate  */
53*7c478bd9Sstevel@tonic-gate struct xcppmreg {
54*7c478bd9Sstevel@tonic-gate 	volatile uint16_t *bbc_estar_ctrl;	/* set cpu clock rate */
55*7c478bd9Sstevel@tonic-gate 	volatile uint32_t *bbc_assert_change;	/* set t1 cpu trans time */
56*7c478bd9Sstevel@tonic-gate 	volatile uint32_t *bbc_pll_settle;	/* set t4 cpu trans time */
57*7c478bd9Sstevel@tonic-gate 	volatile uint32_t *rio_mode_auxio;	/* transition cpu clock */
58*7c478bd9Sstevel@tonic-gate 	volatile uint8_t *gpio_bank_sel_index;	/* index GPIO bank sel. */
59*7c478bd9Sstevel@tonic-gate 	volatile uint8_t *gpio_bank_sel_data;	/* data GPIO bank select */
60*7c478bd9Sstevel@tonic-gate 	volatile uint8_t *gpio_port1_data;	/* set LED */
61*7c478bd9Sstevel@tonic-gate 	volatile uint8_t *gpio_port2_data;	/* set DC-DC, 1394, FET */
62*7c478bd9Sstevel@tonic-gate };
63*7c478bd9Sstevel@tonic-gate 
64*7c478bd9Sstevel@tonic-gate struct xcppmhndl {
65*7c478bd9Sstevel@tonic-gate 	ddi_acc_handle_t	bbc_estar_ctrl;
66*7c478bd9Sstevel@tonic-gate 	ddi_acc_handle_t	rio_mode_auxio;
67*7c478bd9Sstevel@tonic-gate 	ddi_acc_handle_t	gpio_bank_select;
68*7c478bd9Sstevel@tonic-gate 	ddi_acc_handle_t	gpio_data_ports;
69*7c478bd9Sstevel@tonic-gate };
70*7c478bd9Sstevel@tonic-gate 
71*7c478bd9Sstevel@tonic-gate /*
72*7c478bd9Sstevel@tonic-gate  * Register offsets
73*7c478bd9Sstevel@tonic-gate  */
74*7c478bd9Sstevel@tonic-gate #define	BBC_ESTAR_CTRL_OFFSET		0x0
75*7c478bd9Sstevel@tonic-gate #define	BBC_ASSERT_CHANGE_OFFSET	0x2
76*7c478bd9Sstevel@tonic-gate #define	BBC_PLL_SETTLE_OFFSET		0xa
77*7c478bd9Sstevel@tonic-gate 
78*7c478bd9Sstevel@tonic-gate #define	GPIO_BANK_SEL_INDEX_OFFSET	0x0
79*7c478bd9Sstevel@tonic-gate #define	GPIO_BANK_SEL_DATA_OFFSET	0x1
80*7c478bd9Sstevel@tonic-gate 
81*7c478bd9Sstevel@tonic-gate #define	GPIO_PORT1_DATA_OFFSET		0x0
82*7c478bd9Sstevel@tonic-gate #define	GPIO_PORT2_DATA_OFFSET		0x4
83*7c478bd9Sstevel@tonic-gate 
84*7c478bd9Sstevel@tonic-gate /*
85*7c478bd9Sstevel@tonic-gate  * Definitions for the RIO Mode Auxio register
86*7c478bd9Sstevel@tonic-gate  */
87*7c478bd9Sstevel@tonic-gate #define	RIO_BBC_ESTAR_MODE		0x800
88*7c478bd9Sstevel@tonic-gate 
89*7c478bd9Sstevel@tonic-gate /*
90*7c478bd9Sstevel@tonic-gate  * Index for SuperIO Configuration 2 register
91*7c478bd9Sstevel@tonic-gate  */
92*7c478bd9Sstevel@tonic-gate #define	SIO_CONFIG2_INDEX		0x22
93*7c478bd9Sstevel@tonic-gate 
94*7c478bd9Sstevel@tonic-gate /*
95*7c478bd9Sstevel@tonic-gate  * GPIO Data Port 1 bit assignments
96*7c478bd9Sstevel@tonic-gate  */
97*7c478bd9Sstevel@tonic-gate #define	LED	0x02		/* Controls front panel LED */
98*7c478bd9Sstevel@tonic-gate 
99*7c478bd9Sstevel@tonic-gate /*
100*7c478bd9Sstevel@tonic-gate  * GPIO Data Port 2 bit assignments
101*7c478bd9Sstevel@tonic-gate  */
102*7c478bd9Sstevel@tonic-gate #define	CPEN	0x02		/* Controls 1394 cable power [1 = on] */
103*7c478bd9Sstevel@tonic-gate #define	HIGHPWR	0x08		/* Enter/Leave low pwr mode [1 = high pwr] */
104*7c478bd9Sstevel@tonic-gate #define	DRVON	0x10		/* Controls pwr to internal drives [1 = on] */
105*7c478bd9Sstevel@tonic-gate 
106*7c478bd9Sstevel@tonic-gate /*
107*7c478bd9Sstevel@tonic-gate  * BBC timing registers are set according to "bbc_delay" variable
108*7c478bd9Sstevel@tonic-gate  * and adjusted based on current clock speed.
109*7c478bd9Sstevel@tonic-gate  */
110*7c478bd9Sstevel@tonic-gate extern int bbc_delay;				/* microsec */
111*7c478bd9Sstevel@tonic-gate #define	BBC_DELAY	(bbc_delay * 1000000)	/* nanosec */
112*7c478bd9Sstevel@tonic-gate #define	EXCAL_CLOCK	10			/* 10 nsec or 100 MHz */
113*7c478bd9Sstevel@tonic-gate #define	BBC_CLOCK	(2 * EXCAL_CLOCK)	/* BBC clock is half speed */
114*7c478bd9Sstevel@tonic-gate 
115*7c478bd9Sstevel@tonic-gate #define	XCPPM_BBC_DELAY(index)				\
116*7c478bd9Sstevel@tonic-gate 	(index == 0) ? (BBC_DELAY/(BBC_CLOCK * 32)) :	\
117*7c478bd9Sstevel@tonic-gate 	((index == 1) ? (BBC_DELAY/(BBC_CLOCK * 2)) :	\
118*7c478bd9Sstevel@tonic-gate 	BBC_DELAY/BBC_CLOCK)
119*7c478bd9Sstevel@tonic-gate 
120*7c478bd9Sstevel@tonic-gate /*
121*7c478bd9Sstevel@tonic-gate  * BBC E* Control Reg bit masks
122*7c478bd9Sstevel@tonic-gate  */
123*7c478bd9Sstevel@tonic-gate #define	BBC_ESTAR_SLOW		0x20		/* 1/32 speed */
124*7c478bd9Sstevel@tonic-gate #define	BBC_ESTAR_MEDIUM	0x2		/* 1/2  speed */
125*7c478bd9Sstevel@tonic-gate #define	BBC_ESTAR_FAST		0x1		/* full speed */
126*7c478bd9Sstevel@tonic-gate 
127*7c478bd9Sstevel@tonic-gate /*
128*7c478bd9Sstevel@tonic-gate  * register access IO
129*7c478bd9Sstevel@tonic-gate  */
130*7c478bd9Sstevel@tonic-gate #define	XCPPM_CLRBIT		0x0
131*7c478bd9Sstevel@tonic-gate #define	XCPPM_SETBIT		0x1
132*7c478bd9Sstevel@tonic-gate #define	XCPPM_GETBIT		0x2
133*7c478bd9Sstevel@tonic-gate 
134*7c478bd9Sstevel@tonic-gate #ifdef	__cplusplus
135*7c478bd9Sstevel@tonic-gate }
136*7c478bd9Sstevel@tonic-gate #endif
137*7c478bd9Sstevel@tonic-gate 
138*7c478bd9Sstevel@tonic-gate #endif	/* _SYS_XCALPPM_REG_H */
139