| cpu-type.patch
|
| Files affected:
|   arch/arm/mach-s3c2410/cpu.c        |   12 	12 +	0 -	0 !
|   include/asm-arm/arch-s3c2410/cpu.h |   67 	67 +	0 -	0 !
|   2 files changed, 79 insertions(+)
|
| Ben Dooks, Wed, 27 Oct 2004 16:25:33 +0100

--- linux-2.6.10-rc1-bk2-set2-patched/include/asm-arm/arch-s3c2410/cpu.h	1970-01-01 01:00:00.000000000 +0100
+++ linux-2.6.10-rc1-bk2-set2-work1/include/asm-arm/arch-s3c2410/cpu.h	2004-10-27 16:20:09.000000000 +0100
@@ -0,0 +1,67 @@
+/* linux/include/asm-arm/arch-s3c2410/cpu.h
+ *
+ * Copyright (c) 2004 Simtec Electronics <linux@simtec.co.uk>
+ *		http://www.simtec.co.uk/products/SWLINUX/
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+ *
+ * S3C2410 CPU identification code
+ *
+ *  Changelog:
+ *	21-Oct-2004  BJD  Initial version
+ *
+*/
+
+#ifndef __ASM_ARCH_CPU_H
+#define __ASM_ARCH_CPU_H __FILE__
+
+typedef enum s3c24xx_cpu_type {
+	CPU_S3C2410,
+	CPU_S3C2410A,
+	CPU_S3C2440X,
+	CPU_S3C2440A,
+} s3c24xx_cpu_t;
+
+extern enum s3c24xx_cpu_type	s3c24xx_cpu_type;
+extern const char		*s3c24xx_cpu_name;
+
+/* over-all type of the cpu, s3c2410 or s3c2440 without
+ * worrying about the revisions that are available of
+ * each of them
+*/
+
+#ifdef CONFIG_CPU_S3C2410
+# ifdef arch_cpu_type
+#  undef arch_cpu_type
+#  define arch_cpu_type s3c24xx_cpu_type
+# else
+#  define arch_cpu_type CPU_S3C2410
+# endif
+# define cpu_is_s3c2410() (arch_cpu_type == CPU_S3C2410 \
+			   || arch_cpu_type == CPU_S3C2410A)
+#else
+#define cpu_is_s3c2410() 0
+#endif
+
+#ifdef CONFIG_CPU_S3C2440
+# ifdef arch_cpu_type
+#  undef arch_cpu_type
+#  define arch_cpu_type s3c24xx_cpu_type
+# else
+#  define arch_cpu_type CPU_S3C2410
+# endif
+# define cpu_is_s3c2440() (arch_cpu_type == CPU_S3C2440X \
+			   || arch_cpu_type == CPU_S3C2440A)
+#else
+#define cpu_is_s3c2440() 0
+#endif
+
+/* cpu types which are specific to the id-code of the cpu */
+
+#define cpu_is_s3c2410a() (s3c24xx_cpu_type == CPU_S3C2410A)
+#define cpu_is_s3c2440x() (s3c24xx_cpu_type == CPU_S3C2440X)
+#define cpu_is_s3c2440a() (s3c24xx_cpu_type == CPU_S3C2440A)
+
+#endif /* __ASM_ARCH_CPU_H */
--- linux-2.6.10-rc1-bk2-set2-patched/arch/arm/mach-s3c2410/cpu.c	2004-10-27 16:24:38.000000000 +0100
+++ linux-2.6.10-rc1-bk2-set2-work1/arch/arm/mach-s3c2410/cpu.c	2004-10-27 16:22:28.000000000 +0100
@@ -36,6 +36,7 @@
 #include <asm/mach/map.h>
 
 #include <asm/arch/regs-gpio.h>
+#include <asm/arch/cpu.h>
 
 #include "cpu.h"
 #include "clock.h"
@@ -45,11 +46,15 @@
 struct cpu_table {
 	unsigned long	idcode;
 	unsigned long	idmask;
+	s3c24xx_cpu_t	type;
 	void		(*map_io)(struct map_desc *mach_desc, int size);
 	int		(*init)(void);
 	const char	*name;
 };
 
+enum s3c24xx_cpu_type	s3c24xx_cpu_type;
+const char		*s3c24xx_cpu_name;
+
 /* table of supported CPUs */
 
 static const char name_s3c2410[]  = "S3C2410";
@@ -61,6 +66,7 @@
 	{
 		.idcode	= 0x32410000,
 		.idmask = 0xffffffff,
+		.type	= CPU_S3C2410,
 		.map_io = s3c2410_map_io,
 		.init   = s3c2410_init,
 		.name   = name_s3c2410
@@ -68,6 +74,7 @@
 	{
 		.idcode	= 0x3241002,
 		.idmask = 0xffffffff,
+		.type	= CPU_S3C2410A,
 		.map_io = s3c2410_map_io,
 		.init   = s3c2410_init,
 		.name   = name_s3c2410a
@@ -75,6 +82,7 @@
 	{
 		.idcode	= 0x32440000,
 		.idmask = 0xffffffff,
+		.type	= CPU_S3C2440X,
 		.map_io = s3c2440_map_io,
 		.init   = s3c2440_init,
 		.name   = name_s3c2440
@@ -82,6 +90,7 @@
 	{
 		.idcode	= 0x32440001,
 		.idmask = 0xffffffff,
+		.type   = CPU_S3C2440A,
 		.map_io = s3c2440_map_io,
 		.init   = s3c2440_init,
 		.name   = name_s3c2440a
@@ -157,6 +166,9 @@
 
 	printk("CPU %s (id 0x%08lx)\n", cpu->name, idcode);
 
+	s3c24xx_cpu_type = cpu->type;
+	s3c24xx_cpu_name = cpu->name;
+
 	(cpu->map_io)(mach_desc, size);
 }
 
