/* $NetBSD: memcreg.h,v 1.4 2008/04/28 20:23:54 martin Exp $ */
/*-
* Copyright (c) 2000, 2002 The NetBSD Foundation, Inc.
* All rights reserved.
*
* This code is derived from software contributed to The NetBSD Foundation
* by Steve C. Woodford.
*
* 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.
*
* 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.
*/
/*
* Register definitions for the MEMECC and MEMC040 devices.
*/
#ifndef _MVME_MEMCREG_H
#define _MVME_MEMCREG_H
/*
* Size, in bytes, of the memory controller's register set
* (Actually, the MEMC040's register set is only 0x20 bytes in size, but
* we go with the larger of the two).
*/
#define MEMC_REGSIZE 0x80
/* Both memory controllers share some registers in common */
#define MEMC_REG_CHIP_ID 0x00
#define MEMC_CHIP_ID_MEMC040 0x80 /* It's a MEMC040 */
#define MEMC_CHIP_ID_MEMECC 0x81 /* It's a MEMECC */
/* Revision of the ASIC */
#define MEMC_REG_CHIP_REVISION 0x04
/* Configuration of the memory block controlled by this ASIC */
#define MEMC_REG_MEMORY_CONFIG 0x08
#define MEMC_MEMORY_CONFIG_2_BYTES(x) (0x400000 << ((x) & 0x07))
#define MEMC_MEMORY_CONFIG_2_MB(x) (4 << ((x) & 0x07))
#define MEMC040_MEMORY_CONFIG_EXTPEN (1u << 3) /* External parity enabled */
#define MEMC040_MEMORY_CONFIG_WPB (1u << 4) /* Write Per Bit mode */
#define MEMC_MEMORY_CONFIG_FSTRD (1u << 5) /* Fast RAM Read enabled */
/* Where, in the CPU's address space, does this memory appear? */
#define MEMC_REG_BASE_ADDRESS_HI 0x14
#define MEMC_REG_BASE_ADDRESS_LO 0x18
#define MEMC_BASE_ADDRESS(hi,lo) (((hi) << 24) | (((lo) & 0xc0) << 22))
/* Tells the memory controller what the board's Bus Clock frequency is */
#define MEMC_REG_BUS_CLOCK 0x1c
/* Register offsets and definitions for the Parity Memory Controller */
#define MEMC040_REG_ALT_STATUS 0x0c /* Not used */
#define MEMC040_REG_ALT_CONTROL 0x10 /* Not used */