1 /* linux/arch/arm/mach-s3c2410/cpu.c
3 * Copyright (c) 2004 Simtec Electronics
4 * Ben Dooks <ben@simtec.co.uk>
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
24 #include <linux/init.h>
25 #include <linux/module.h>
26 #include <linux/interrupt.h>
27 #include <linux/ioport.h>
28 #include <linux/device.h>
30 #include <asm/hardware.h>
33 #include <asm/delay.h>
35 #include <asm/mach/arch.h>
36 #include <asm/mach/map.h>
38 #include <asm/arch/regs-gpio.h>
47 void (*map_io
)(struct map_desc
*mach_desc
, int size
);
52 /* table of supported CPUs */
54 static const char name_s3c2410
[] = "S3C2410";
55 static const char name_s3c2440
[] = "S3C2440";
56 static const char name_s3c2410a
[] = "S3C2410A";
57 static const char name_s3c2440a
[] = "S3C2440A";
59 static struct cpu_table cpu_ids
[] __initdata
= {
63 .map_io
= s3c2410_map_io
,
70 .map_io
= s3c2410_map_io
,
77 .map_io
= s3c2440_map_io
,
84 .map_io
= s3c2440_map_io
,
90 /* minimal IO mapping */
92 static struct map_desc s3c_iodesc
[] __initdata
= {
100 static struct cpu_table
*
101 s3c_lookup_cpu(unsigned long idcode
)
103 struct cpu_table
*tab
;
107 for (count
= 0; count
< ARRAY_SIZE(cpu_ids
); count
++) {
108 if ((idcode
& tab
->idmask
) == tab
->idcode
)
115 static struct cpu_table
*cpu
;
117 void __init
s3c24xx_init_io(struct map_desc
*mach_desc
, int size
)
119 unsigned long idcode
;
121 /* initialise the io descriptors we need for initialisation */
122 iotable_init(s3c_iodesc
, ARRAY_SIZE(s3c_iodesc
));
124 idcode
= __raw_readl(S3C2410_GSTATUS1
);
125 cpu
= s3c_lookup_cpu(idcode
);
128 printk(KERN_ERR
"Unknown CPU type 0x%08lx\n", idcode
);
129 panic("Unknown S3C24XX CPU");
132 if (cpu
->map_io
== NULL
|| cpu
->init
== NULL
) {
133 printk(KERN_ERR
"CPU %s support not enabled\n", cpu
->name
);
134 panic("Unsupported S3C24XX CPU");
137 printk("CPU %s (id 0x%08lx)\n", cpu
->name
, idcode
);
139 (cpu
->map_io
)(mach_desc
, size
);
142 static int __init
s3c_arch_init(void)
144 // do the correct init for cpu
147 panic("s3c_arch_init: NULL cpu\n");
149 return (cpu
->init
)();
152 arch_initcall(s3c_arch_init
);