MOXA linux-2.6.x / linux-2.6.19-uc1 from UC-7110-LX-BOOTLOADER-1.9_VERSION-4.2.tgz
[linux-2.6.19-moxart.git] / arch / arm / mach-p2001 / arch.c
blobb41a18f63eb25267af30f2bb6d2878106aded980
1 /*
2 * linux/arch/arm/mach-p2001/arch.c
4 * Copyright (C) 2004-2005 Tobias Lorenz
6 * uClinux kernel startup code for p2001
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License as published by
10 * the Free Software Foundation; either version 2 of the License, or
11 * (at your option) any later version.
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
18 * You should have received a copy of the GNU General Public License
19 * along with this program; if not, write to the Free Software
20 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
22 #include <linux/types.h>
23 #include <linux/sched.h>
24 #include <linux/interrupt.h>
25 #include <linux/types.h>
26 #include <linux/kernel.h>
27 #include <linux/init.h>
28 #include <linux/list.h>
29 #include <linux/device.h>
30 #include <linux/slab.h>
31 #include <linux/string.h>
32 #include <linux/sysdev.h>
34 #include <asm/hardware.h>
35 #include <asm/io.h>
36 #include <asm/irq.h>
37 #include <asm/setup.h>
38 #include <asm/sizes.h>
39 #include <asm/mach-types.h>
41 #include <asm/mach/arch.h>
42 #include <asm/mach/irq.h>
43 #include <asm/mach/map.h>
44 #include <asm/mach/time.h>
46 extern void __init p2001_init_irq(void);
47 extern struct sys_timer p2001_timer;
49 #ifdef CONFIG_P2001_AUTO_DETECT_SDRAM
50 /* automatic memory detection (by write tests at each memory banks) */
51 static void __init p2001_fixup(struct machine_desc *desc, struct tag *tags, char **cmdline, struct meminfo *mi)
53 volatile char *mem_start; // bank 0
54 volatile char *mem_end; // bank n
55 char mem_wrap; // value of bank 0
56 char mem_err; // value of bank n
58 /* save memstart */
59 mem_start = (char *) CONFIG_DRAM_BASE;
60 mem_wrap = *mem_start;
62 /* search wrap or error position */
63 for(mem_end = mem_start + SZ_1M; mem_end < (char *) (CONFIG_DRAM_BASE + CONFIG_DRAM_SIZE); mem_end += SZ_1M) {
64 mem_err = *mem_end;
65 (*mem_end)++;
66 if (mem_err+1 != *mem_end)
67 break;
68 if (mem_wrap != *mem_start)
69 break;
70 *mem_end = mem_err;
72 *mem_end = mem_err;
74 /* print message */
75 printk("Auto detected SDRAM: 0x%08x - 0x%08x (size: %dMB)\n",
76 (unsigned int) mem_start, (unsigned int) mem_end,
77 ((unsigned int) mem_end - (unsigned int) mem_start) / SZ_1M);
79 /* give values to mm */
80 mi->nr_banks = 1;
81 mi->bank[0].start = (unsigned int) mem_start;
82 mi->bank[0].size = (unsigned int) mem_end - (unsigned int) mem_start;
83 mi->bank[0].node = 0;
85 #endif
87 MACHINE_START(P2001, "P2001")
88 /* Maintainer: Tobias Lorenz <tobias.lorenz@gmx.net> */
89 #ifdef CONFIG_P2001_AUTO_DETECT_SDRAM
90 .fixup = p2001_fixup,
91 #endif
92 .init_irq = p2001_init_irq,
93 .timer = &p2001_timer,
94 MACHINE_END