Add support for picking up the size of SDRAM by reading the memory

controller's config register.
This commit is contained in:
scw 2003-12-08 14:41:11 +00:00
parent 37efcf9045
commit 40db825e26
4 changed files with 95 additions and 3 deletions

View File

@ -1,9 +1,10 @@
# $NetBSD: files.ixp425,v 1.5 2003/11/16 12:41:03 scw Exp $
# $NetBSD: files.ixp425,v 1.6 2003/12/08 14:41:11 scw Exp $
#
# Configuration info for Intel IXP4xx CPU support
#
file arch/arm/xscale/ixp425_intr.c
file arch/arm/xscale/ixp425_mem.c
file arch/arm/arm32/irq_dispatch.S
file arch/arm/xscale/xscale_pmc.c perfctrs

View File

@ -0,0 +1,85 @@
/* $NetBSD: ixp425_mem.c,v 1.1 2003/12/08 14:41:11 scw Exp $ */
/*
* Copyright (c) 2003 Wasabi Systems, Inc.
* All rights reserved.
*
* Written by Steve C. Woodford for Wasabi Systems, Inc.
*
* 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 for the NetBSD Project by
* Wasabi Systems, Inc.
* 4. The name of Wasabi Systems, Inc. may not be used to endorse
* or promote products derived from this software without specific prior
* written permission.
*
* THIS SOFTWARE IS PROVIDED BY WASABI SYSTEMS, INC. ``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 WASABI SYSTEMS, INC
* 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.
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: ixp425_mem.c,v 1.1 2003/12/08 14:41:11 scw Exp $");
#include <sys/param.h>
#include <sys/systm.h>
#include <arm/xscale/ixp425reg.h>
#include <arm/xscale/ixp425var.h>
static uint32_t sdram_64bit[] = {
0x00800000, /* 8M: One 2M x 32 chip */
0x01000000, /* 16M: Two 2M x 32 chips */
0x01000000, /* 16M: One 4M x 32 chip */
0x02000000, /* 32M: Two 4M x 32 chips */
0, 0, 0, 0
};
static uint32_t sdram_other[] = {
0x02000000, /* 32M: Two 8M x 16 chips */
0x04000000, /* 64M: Four 8M x 16 chips */
0x04000000, /* 64M: Two 16M x 16 chips */
0x08000000, /* 128M: Four 16M x 16 chips */
0x08000000, /* 128M: Two 32M x 16 chips */
0x10000000, /* 256M: Four 32M x 16 chips */
0, 0
};
#define MCU_REG_READ(x) (*(volatile uint32_t *)(IXP425_MCU_VBASE + (x)))
uint32_t
ixp425_sdram_size(void)
{
uint32_t size, sdr_config;
sdr_config = MCU_REG_READ(MCU_SDR_CONFIG);
if (sdr_config & MCU_SDR_CONFIG_64MBIT)
size = sdram_64bit[MCU_SDR_CONFIG_MCONF(sdr_config)];
else
size = sdram_other[MCU_SDR_CONFIG_MCONF(sdr_config)];
if (size == 0) {
printf("** SDR_CONFIG retuns unknown value, using 32M\n");
size = 32 * 1024 * 1024;
}
return (size);
}

View File

@ -1,4 +1,4 @@
/* $NetBSD: ixp425reg.h,v 1.15 2003/12/08 13:40:33 scw Exp $ */
/* $NetBSD: ixp425reg.h,v 1.16 2003/12/08 14:41:11 scw Exp $ */
/*
* Copyright (c) 2003
* Ichiro FUKUHARA <ichiro@ichiro.org>.
@ -445,7 +445,12 @@
* SDRAM Configuration Register
*/
#define IXP425_MCU_HWBASE 0xcc000000UL
#define IXP425_MCU_VBASE (IXP425_PCI_VBASE + IXP425_PCI_SIZE)
/* 0xf0012000 */
#define IXP425_MCU_SIZE 0x1000 /* Actually only 256 bytes */
#define MCU_SDR_CONFIG 0x00
#define MCU_SDR_CONFIG_MCONF(x) ((x) & 0x7)
#define MCU_SDR_CONFIG_64MBIT (1u << 5)
#define MCU_SDR_REFRESH 0x04
#define MCU_SDR_IR 0x08

View File

@ -1,4 +1,4 @@
/* $NetBSD: ixp425var.h,v 1.7 2003/11/02 21:24:39 scw Exp $ */
/* $NetBSD: ixp425var.h,v 1.8 2003/12/08 14:41:11 scw Exp $ */
/*
* Copyright (c) 2003
@ -148,5 +148,6 @@ void ixp425_intr_init(void);
void *ixp425_intr_establish(int, int, int (*)(void *), void *);
void ixp425_intr_disestablish(void *);
uint32_t ixp425_sdram_size(void);
#endif /* _IXP425VAR_H_ */