
#
# Patch managed by http://www.holgerschurig.de/patcher.html
#

--- /dev/null
+++ linux2/arch/arm/mach-pxa/corgi_param.c
@@ -0,0 +1,84 @@
+/*
+ *  Routines for accessing the parameter area on Corgi machines
+ *
+ *  Copyright (c) 2004 Richard Purdie
+ *
+ *  Based on Sharp/Lineo sharpsl_param.c
+ *
+ *  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.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ */
+ 
+#include <linux/module.h>
+#include <asm/io.h> 
+#include <asm/arch/corgi.h> 
+ 
+#define FLASH_MEM_BASE	0xa0000a00
+#define FLASH_MAGIC_CHG(a,b,c,d) ( ( d << 24 ) | ( c << 16 )  | ( b << 8 ) | a )
+
+#define FLASH_COMADJ_MAJIC	FLASH_MAGIC_CHG('C','M','A','D')
+#define	FLASH_COMADJ_MAGIC_ADR	0x00
+#define	FLASH_COMADJ_DATA_ADR	0x04
+
+#define FLASH_PHAD_MAJIC	FLASH_MAGIC_CHG('P','H','A','D')
+#define	FLASH_PHAD_MAGIC_ADR	0x38
+#define	FLASH_PHAD_DATA_ADR	0x3C 
+
+typedef struct sharpsl_flash_param_info {
+  unsigned int comadj_keyword;
+  unsigned int comadj;
+
+  unsigned int uuid_keyword;
+  unsigned char uuid[16];
+
+  unsigned int touch_keyword;
+  unsigned int touch1;
+  unsigned int touch2;
+  unsigned int touch3;
+  unsigned int touch4;
+
+  unsigned int adadj_keyword;
+  unsigned int adadj;
+
+  unsigned int phad_keyword;
+  unsigned int phadadj;
+} sharpsl_flash_param_info;
+ 
+sharpsl_flash_param_info sharpsl_flash_param;
+
+void corgi_get_param(void)
+{
+	sharpsl_flash_param.comadj_keyword = readl(FLASH_MEM_BASE + FLASH_COMADJ_MAGIC_ADR);
+	sharpsl_flash_param.comadj = readl(FLASH_MEM_BASE + FLASH_COMADJ_DATA_ADR);
+
+	sharpsl_flash_param.phad_keyword = readl(FLASH_MEM_BASE + FLASH_PHAD_MAGIC_ADR);
+	sharpsl_flash_param.phadadj = readl(FLASH_MEM_BASE + FLASH_PHAD_DATA_ADR);
+}
+
+int corgi_get_comadj(void)
+{
+  if ( sharpsl_flash_param.comadj_keyword == FLASH_COMADJ_MAJIC ) {
+    return sharpsl_flash_param.comadj;
+  } else {
+    return -1;
+  }
+}
+
+int corgi_get_phadadj(void)
+{
+  if ( sharpsl_flash_param.phad_keyword == FLASH_PHAD_MAJIC ) {
+    return sharpsl_flash_param.phadadj;
+  } else {
+    return -1;
+  }
+ }
+
+EXPORT_SYMBOL(corgi_get_phadadj);
+EXPORT_SYMBOL(corgi_get_comadj);

