Annotation of sys/arch/arm/xscale/i80321_mcu.c, Revision 1.1.1.1
1.1 nbrk 1: /* $OpenBSD: i80321_mcu.c,v 1.2 2006/05/29 17:27:31 drahn Exp $ */
2: /* $NetBSD: i80321_mcu.c,v 1.3 2005/12/11 12:16:51 christos Exp $ */
3:
4: /*
5: * Copyright (c) 2001, 2002 Wasabi Systems, Inc.
6: * All rights reserved.
7: *
8: * Written by Jason R. Thorpe for Wasabi Systems, Inc.
9: *
10: * Redistribution and use in source and binary forms, with or without
11: * modification, are permitted provided that the following conditions
12: * are met:
13: * 1. Redistributions of source code must retain the above copyright
14: * notice, this list of conditions and the following disclaimer.
15: * 2. Redistributions in binary form must reproduce the above copyright
16: * notice, this list of conditions and the following disclaimer in the
17: * documentation and/or other materials provided with the distribution.
18: * 3. All advertising materials mentioning features or use of this software
19: * must display the following acknowledgement:
20: * This product includes software developed for the NetBSD Project by
21: * Wasabi Systems, Inc.
22: * 4. The name of Wasabi Systems, Inc. may not be used to endorse
23: * or promote products derived from this software without specific prior
24: * written permission.
25: *
26: * THIS SOFTWARE IS PROVIDED BY WASABI SYSTEMS, INC. ``AS IS'' AND
27: * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
28: * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
29: * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL WASABI SYSTEMS, INC
30: * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
31: * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
32: * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
33: * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
34: * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
35: * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
36: * POSSIBILITY OF SUCH DAMAGE.
37: */
38:
39: /*
40: * Intel i80321 I/O Processor memory controller support.
41: */
42:
43: #include <sys/param.h>
44: #include <sys/systm.h>
45:
46: #include <machine/bus.h>
47:
48: #include <arm/xscale/i80321reg.h>
49: #include <arm/xscale/i80321var.h>
50:
51: /*
52: * i80321_sdram_bounds:
53: *
54: * Retrieve the start and size of SDRAM.
55: */
56: void
57: i80321_sdram_bounds(bus_space_tag_t st, bus_space_handle_t sh,
58: paddr_t *start, psize_t *size)
59: {
60: uint32_t sdbr, sbr0, sbr1;
61: uint32_t bank0, bank1;
62:
63: sdbr = bus_space_read_4(st, sh, MCU_SDBR);
64: sbr0 = bus_space_read_4(st, sh, MCU_SBR0);
65: sbr1 = bus_space_read_4(st, sh, MCU_SBR1);
66:
67: #ifdef VERBOSE_INIT_ARM
68: printf("i80321: SBDR = 0x%08x SBR0 = 0x%08x SBR1 = 0x%08x\n",
69: sdbr, sbr0, sbr1);
70: #endif
71:
72: *start = sdbr;
73:
74: sdbr = (sdbr >> 25) & 0x1f;
75:
76: sbr0 &= 0x3f;
77: sbr1 &= 0x3f;
78:
79: bank0 = (sbr0 - sdbr) << 25;
80: bank1 = (sbr1 - sbr0) << 25;
81:
82: #ifdef VERBOSE_INIT_ARM
83: printf("i80321: BANK0 = 0x%08x BANK1 = 0x%08x\n", bank0, bank1);
84: #endif
85:
86: *size = bank0 + bank1;
87: }
CVSweb