2 * linux/arch/mips/tx4927/common/tx4927_prom.c
4 * common tx4927 memory interface
6 * Author: MontaVista Software, Inc.
9 * Copyright 2001-2002 MontaVista Software Inc.
11 * This program is free software; you can redistribute it and/or modify it
12 * under the terms of the GNU General Public License as published by the
13 * Free Software Foundation; either version 2 of the License, or (at your
14 * option) any later version.
16 * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED
17 * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
18 * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
19 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
20 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
21 * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
22 * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
24 * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
25 * USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27 * You should have received a copy of the GNU General Public License along
28 * with this program; if not, write to the Free Software Foundation, Inc.,
29 * 675 Mass Ave, Cambridge, MA 02139, USA.
32 #include <linux/init.h>
34 #include <linux/sched.h>
35 #include <linux/bootmem.h>
37 #include <asm/addrspace.h>
38 #include <asm/bootinfo.h>
39 #include <asm/tx4927/tx4927.h>
41 static unsigned int __init tx4927_process_sdccr(u64 * addr)
44 unsigned int sdccr_ce;
45 unsigned int sdccr_bs;
46 unsigned int sdccr_rs;
47 unsigned int sdccr_cs;
48 unsigned int sdccr_mw;
53 unsigned int msize = 0;
55 val = (*((vu64 *) (addr)));
57 /* MVMCP -- need #defs for these bits masks */
58 sdccr_ce = ((val & (1 << 10)) >> 10);
59 sdccr_bs = ((val & (1 << 8)) >> 8);
60 sdccr_rs = ((val & (3 << 5)) >> 5);
61 sdccr_cs = ((val & (3 << 2)) >> 2);
62 sdccr_mw = ((val & (1 << 0)) >> 0);
115 } /* 8 bytes = 64 bits */
119 } /* 4 bytes = 32 bits */
123 /* bytes per chip MB per chip num chips */
124 msize = (((rs * cs * mw) / (1024 * 1024)) * bs);
130 unsigned int __init tx4927_get_mem_size(void)
138 /* MVMCP -- need #defs for these registers */
139 c0 = tx4927_process_sdccr((u64 *) 0xff1f8000);
140 c1 = tx4927_process_sdccr((u64 *) 0xff1f8008);
141 c2 = tx4927_process_sdccr((u64 *) 0xff1f8010);
142 c3 = tx4927_process_sdccr((u64 *) 0xff1f8018);
143 total = c0 + c1 + c2 + c3;