1*993cb033Srmind /* $NetBSD: geodereg.h,v 1.9 2009/10/19 23:19:38 rmind Exp $ */ 265eb4295Sdyoung 365eb4295Sdyoung /*- 465eb4295Sdyoung * Copyright (c) 2005 David Young. All rights reserved. 565eb4295Sdyoung * 665eb4295Sdyoung * This code was written by David Young. 765eb4295Sdyoung * 865eb4295Sdyoung * Redistribution and use in source and binary forms, with or without 965eb4295Sdyoung * modification, are permitted provided that the following conditions 1065eb4295Sdyoung * are met: 1165eb4295Sdyoung * 1. Redistributions of source code must retain the above copyright 1265eb4295Sdyoung * notice, this list of conditions and the following disclaimer. 1365eb4295Sdyoung * 2. Redistributions in binary form must reproduce the above copyright 1465eb4295Sdyoung * notice, this list of conditions and the following disclaimer in the 1565eb4295Sdyoung * documentation and/or other materials provided with the distribution. 1665eb4295Sdyoung * 1765eb4295Sdyoung * THIS SOFTWARE IS PROVIDED BY DAVID YOUNG ``AS IS'' AND ANY 1865eb4295Sdyoung * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, 1965eb4295Sdyoung * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A 2065eb4295Sdyoung * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL DAVID 2165eb4295Sdyoung * YOUNG BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 2265eb4295Sdyoung * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED 2365eb4295Sdyoung * TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 2465eb4295Sdyoung * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 2565eb4295Sdyoung * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, 2665eb4295Sdyoung * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 2765eb4295Sdyoung * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY 2865eb4295Sdyoung * OF SUCH DAMAGE. 2965eb4295Sdyoung */ 3065eb4295Sdyoung 3165eb4295Sdyoung /* 3265eb4295Sdyoung * Register definitions for the AMD Geode SC1100. 3365eb4295Sdyoung */ 3465eb4295Sdyoung 3565eb4295Sdyoung #ifndef _I386_PCI_GEODEREG_H_ 3665eb4295Sdyoung #define _I386_PCI_GEODEREG_H_ 3765eb4295Sdyoung 38f66403a6Sdyoung #include <lib/libkern/libkern.h> 3965eb4295Sdyoung 4065eb4295Sdyoung /* AMD Geode SC1100 X-Bus PCI Configuration Register: General 4165eb4295Sdyoung * Configuration Block Scratchpad. Set to 0x00000000 after chip reset. 4265eb4295Sdyoung * The BIOS writes the base address of the General Configuration 4365eb4295Sdyoung * Block to this register. 4465eb4295Sdyoung */ 4565eb4295Sdyoung #define SC1100_XBUS_CBA_SCRATCHPAD 0x64 4665eb4295Sdyoung 4765eb4295Sdyoung #define SC1100_GCB_SIZE 64 4865eb4295Sdyoung 4965eb4295Sdyoung /* watchdog timeout register, 16 bits. */ 5065eb4295Sdyoung #define SC1100_GCB_WDTO 0x00 5165eb4295Sdyoung 5265eb4295Sdyoung /* Watchdog configuration register, 16 bits. */ 5365eb4295Sdyoung #define SC1100_GCB_WDCNFG 0x02 54cafe884dSdyoung #define SC1100_WDCNFG_RESERVED __BITS(15,9) /* write as read */ 5565eb4295Sdyoung 5665eb4295Sdyoung /* 32kHz clock power-down, 0: clock is enabled, 1: clock is disabled. */ 57cafe884dSdyoung #define SC1100_WDCNFG_WD32KPD __BIT(8) 5865eb4295Sdyoung 5965eb4295Sdyoung /* Watchdog event type 1, and type 2 6065eb4295Sdyoung * 6165eb4295Sdyoung * 00: no action (default after POR# is asserted) 6265eb4295Sdyoung * 01: interrupt 6365eb4295Sdyoung * 10: SMI 6465eb4295Sdyoung * 11: system reset 6565eb4295Sdyoung */ 66cafe884dSdyoung #define SC1100_WDCNFG_WDTYPE2_MASK __BITS(7,6) 67cafe884dSdyoung #define SC1100_WDCNFG_WDTYPE1_MASK __BITS(5,4) 6865eb4295Sdyoung 698cd106d3Sdyoung #define SC1100_WDCNFG_WDTYPE2_NOACTION __SHIFTIN(0, SC1100_WDCNFG_WDTYPE2_MASK) 708cd106d3Sdyoung #define SC1100_WDCNFG_WDTYPE2_INTERRUPT __SHIFTIN(1, SC1100_WDCNFG_WDTYPE2_MASK) 718cd106d3Sdyoung #define SC1100_WDCNFG_WDTYPE2_SMI __SHIFTIN(2, SC1100_WDCNFG_WDTYPE2_MASK) 728cd106d3Sdyoung #define SC1100_WDCNFG_WDTYPE2_RESET __SHIFTIN(3, SC1100_WDCNFG_WDTYPE2_MASK) 7365eb4295Sdyoung 748cd106d3Sdyoung #define SC1100_WDCNFG_WDTYPE1_NOACTION __SHIFTIN(0, SC1100_WDCNFG_WDTYPE1_MASK) 758cd106d3Sdyoung #define SC1100_WDCNFG_WDTYPE1_INTERRUPT __SHIFTIN(1, SC1100_WDCNFG_WDTYPE1_MASK) 768cd106d3Sdyoung #define SC1100_WDCNFG_WDTYPE1_SMI __SHIFTIN(2, SC1100_WDCNFG_WDTYPE1_MASK) 778cd106d3Sdyoung #define SC1100_WDCNFG_WDTYPE1_RESET __SHIFTIN(3, SC1100_WDCNFG_WDTYPE1_MASK) 7865eb4295Sdyoung 7965eb4295Sdyoung /* Watchdog timer prescaler 8065eb4295Sdyoung * 8165eb4295Sdyoung * The prescaler divisor is 2**WDPRES. 1110 (0xe) and 1111 (0xf) are 8265eb4295Sdyoung * reserved values. 8365eb4295Sdyoung */ 84cafe884dSdyoung #define SC1100_WDCNFG_WDPRES_MASK __BITS(3,0) 8565eb4295Sdyoung #define SC1100_WDCNFG_WDPRES_MAX 0xd 8665eb4295Sdyoung 8765eb4295Sdyoung /* Watchdog status register, 8 bits. */ 8865eb4295Sdyoung #define SC1100_GCB_WDSTS 0x04 89cafe884dSdyoung #define SC1100_WDSTS_RESERVED __BIT(7,4) /* write as read */ 9065eb4295Sdyoung /* Set to 1 when watchdog reset is asserted. Read-only. Reset either by 919a5e721bSdyoung * POR# (power-on reset) or by writing 0 to WDOVF. 9265eb4295Sdyoung */ 93cafe884dSdyoung #define SC1100_WDSTS_WDRST __BIT(3) 9465eb4295Sdyoung /* Set to 1 when watchdog SMI is asserted. Read-only. Reset either by 959a5e721bSdyoung * POR# (power-on reset) or by writing 0 to WDOVF. 9665eb4295Sdyoung */ 97cafe884dSdyoung #define SC1100_WDSTS_WDSMI __BIT(2) 9865eb4295Sdyoung /* Set to 1 when watchdog interrupt is asserted. Read-only. Reset either by 999a5e721bSdyoung * POR# (power-on reset) or by writing 0 to WDOVF. 10065eb4295Sdyoung */ 101cafe884dSdyoung #define SC1100_WDSTS_WDINT __BIT(1) 10265eb4295Sdyoung /* Set to 1 when watchdog overflow is asserted. Reset either by 1039a5e721bSdyoung * POR# (power-on reset) or by writing 1 to this bit. 10465eb4295Sdyoung */ 105cafe884dSdyoung #define SC1100_WDSTS_WDOVF __BIT(0) 10665eb4295Sdyoung 10765eb4295Sdyoung /* 10865eb4295Sdyoung * Helpful constants 10965eb4295Sdyoung */ 11065eb4295Sdyoung 11165eb4295Sdyoung /* maximum watchdog interval in seconds */ 11265eb4295Sdyoung #define SC1100_WDIVL_MAX ((1 << SC1100_WDCNFG_WDPRES_MAX) * \ 11365eb4295Sdyoung UINT16_MAX / SC1100_WDCLK_HZ) 11465eb4295Sdyoung /* watchdog clock rate in Hertz */ 11565eb4295Sdyoung #define SC1100_WDCLK_HZ 32000 11665eb4295Sdyoung 11709b51ec9Skardel /* 11809b51ec9Skardel * high resolution timer 11909b51ec9Skardel */ 12009b51ec9Skardel #define SC1100_GCB_TMVALUE_L 0x08 /* timer value */ 12109b51ec9Skardel 12209b51ec9Skardel #define SC1100_GCB_TMSTS_B 0x0c /* status */ 12309b51ec9Skardel #define SC1100_TMSTS_OVFL __BIT(0) /* set: overflow */ 12409b51ec9Skardel 12509b51ec9Skardel #define SC1100_GCB_TMCNFG_B 0x0d /* configuration */ 12609b51ec9Skardel #define SC1100_TMCNFG_TM27MPD __BIT(2) /* set: power down on SUSPA# */ 12709b51ec9Skardel #define SC1100_TMCNFG_TMCLKSEL __BIT(1) /* set: 27MHz clock, clear: 1MHz */ 12809b51ec9Skardel #define SC1100_TMCNFG_TMEN __BIT(0) /* set: timer interrupt enabled */ 12909b51ec9Skardel 13009b51ec9Skardel #define SC1100_GCB_IID_B 0x3c /* chip identification register */ 13109b51ec9Skardel 13209b51ec9Skardel #define SC1100_GCB_REV_B 0x3d /* revision register */ 13309b51ec9Skardel 13465eb4295Sdyoung #endif /* _I386_PCI_GEODEREG_H_ */ 135