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>
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
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
) {
66 if (mem_err
+1 != *mem_end
)
68 if (mem_wrap
!= *mem_start
)
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 */
81 mi
->bank
[0].start
= (unsigned int) mem_start
;
82 mi
->bank
[0].size
= (unsigned int) mem_end
- (unsigned int) mem_start
;
87 MACHINE_START(P2001
, "P2001")
88 /* Maintainer: Tobias Lorenz <tobias.lorenz@gmx.net> */
89 #ifdef CONFIG_P2001_AUTO_DETECT_SDRAM
92 .init_irq
= p2001_init_irq
,
93 .timer
= &p2001_timer
,