ChangeSet 1.2224.7.1, 2005/04/01 23:01:38+01:00, [EMAIL PROTECTED](none)
[ARM PATCH] 2637/1: Combine code for Sharp SL series parameter area
Patch from Richard Purdie
The Sharp SL series bootloader puts a parameter structure into
memory with important LCD parameters in it (amongst other things).
The structure is common to collie, corgi, poodle, tosa and other
models. This patch combines all the existing code into one place
and simplifies access to the data.
Signed-off-by: Richard Purdie
Signed-off-by: Russell King
arch/arm/common/Kconfig | 3 +
arch/arm/common/Makefile | 1
arch/arm/common/sharpsl_param.c | 60 +++++++++++++++++++++++++++++++++++
arch/arm/mach-pxa/Kconfig | 1
arch/arm/mach-pxa/corgi.c | 25 ++------------
arch/arm/mach-pxa/poodle.c | 8 ++++
arch/arm/mach-sa1100/Kconfig | 1
arch/arm/mach-sa1100/collie.c | 3 +
include/asm-arm/arch-pxa/corgi.h | 34 -------------------
include/asm-arm/arch-pxa/poodle.h | 41 -----------------------
include/asm-arm/arch-sa1100/collie.h | 28 ----------------
include/asm-arm/mach/sharpsl_param.h | 37 +++++++++++++++++++++
12 files changed, 118 insertions(+), 124 deletions(-)
diff -Nru a/arch/arm/common/Kconfig b/arch/arm/common/Kconfig
--- a/arch/arm/common/Kconfig 2005-04-03 21:21:51 -07:00
+++ b/arch/arm/common/Kconfig 2005-04-03 21:21:51 -07:00
@@ -17,5 +17,8 @@
config SHARP_LOCOMO
bool
+config SHARP_PARAM
+ bool
+
config SHARP_SCOOP
bool
diff -Nru a/arch/arm/common/Makefile b/arch/arm/common/Makefile
--- a/arch/arm/common/Makefile 2005-04-03 21:21:51 -07:00
+++ b/arch/arm/common/Makefile 2005-04-03 21:21:51 -07:00
@@ -11,4 +11,5 @@
obj-$(CONFIG_DMABOUNCE) += dmabounce.o
obj-$(CONFIG_TIMER_ACORN) += time-acorn.o
obj-$(CONFIG_SHARP_LOCOMO) += locomo.o
+obj-$(CONFIG_SHARP_PARAM) += sharpsl_param.o
obj-$(CONFIG_SHARP_SCOOP) += scoop.o
diff -Nru a/arch/arm/common/sharpsl_param.c b/arch/arm/common/sharpsl_param.c
--- /dev/null Wed Dec 31 16:00:00 196900
+++ b/arch/arm/common/sharpsl_param.c 2005-04-03 21:21:51 -07:00
@@ -0,0 +1,60 @@
+/*
+ * Hardware parameter area specific to Sharp SL series devices
+ *
+ * Copyright (c) 2005 Richard Purdie
+ *
+ * Based on Sharp's 2.4 kernel patches
+ *
+ * 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.
+ *
+ */
+
+#include <linux/kernel.h>
+#include <linux/string.h>
+#include <asm/mach/sharpsl_param.h>
+
+/*
+ * Certain hardware parameters determined at the time of device manufacture,
+ * typically including LCD parameters are loaded by the bootloader at the
+ * address PARAM_BASE. As the kernel will overwrite them, we need to store
+ * them early in the boot process, then pass them to the appropriate drivers.
+ * Not all devices use all paramaters but the format is common to all.
+ */
+#ifdef ARCH_SA1100
+#define PARAM_BASE 0xe8ffc000
+#else
+#define PARAM_BASE 0xa0000a00
+#endif
+#define MAGIC_CHG(a,b,c,d) ( ( d << 24 ) | ( c << 16 ) | ( b << 8 ) | a )
+
+#define COMADJ_MAGIC MAGIC_CHG('C','M','A','D')
+#define UUID_MAGIC MAGIC_CHG('U','U','I','D')
+#define TOUCH_MAGIC MAGIC_CHG('T','U','C','H')
+#define AD_MAGIC MAGIC_CHG('B','V','A','D')
+#define PHAD_MAGIC MAGIC_CHG('P','H','A','D')
+
+struct sharpsl_param_info sharpsl_param;
+
+void sharpsl_save_param(void)
+{
+ memcpy(&sharpsl_param, (void *)PARAM_BASE, sizeof(struct
sharpsl_param_info));
+
+ if (sharpsl_param.comadj_keyword != COMADJ_MAGIC)
+ sharpsl_param.comadj=-1;
+
+ if (sharpsl_param.phad_keyword != PHAD_MAGIC)
+ sharpsl_param.phadadj=-1;
+
+ if (sharpsl_param.uuid_keyword != UUID_MAGIC)
+ sharpsl_param.uuid[0]=-1;
+
+ if (sharpsl_param.touch_keyword != TOUCH_MAGIC)
+ sharpsl_param.touch_xp=-1;
+
+ if (sharpsl_param.adadj_keyword != AD_MAGIC)
+ sharpsl_param.adadj=-1;
+}
+
+
diff -Nru a/arch/arm/mach-pxa/Kconfig b/arch/arm/mach-pxa/Kconfig
--- a/arch/arm/mach-pxa/Kconfig 2005-04-03 21:21:51 -07:00
+++ b/arch/arm/mach-pxa/Kconfig 2005-04-03 21:21:51 -07:00
@@ -23,6 +23,7 @@
bool "SHARP SL-5600 and SL-C7xx Models"
select PXA25x
select SHARP_SCOOP
+ select SHARP_PARAM
help
Say Y here if you intend to run this kernel on a
Sharp SL-5600 (Poodle), Sharp SL-C700 (Corgi),
diff -Nru a/arch/arm/mach-pxa/corgi.c b/arch/arm/mach-pxa/corgi.c
--- a/arch/arm/mach-pxa/corgi.c 2005-04-03 21:21:51 -07:00
+++ b/arch/arm/mach-pxa/corgi.c 2005-04-03 21:21:51 -07:00
@@ -37,6 +37,7 @@
#include <asm/arch/udc.h>
#include <asm/arch/corgi.h>
+#include <asm/mach/sharpsl_param.h>
#include <asm/hardware/scoop.h>
#include <video/w100fb.h>
@@ -231,28 +232,10 @@
&corgibl_device,
};
-static struct sharpsl_flash_param_info sharpsl_flash_param;
-
-static 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);
-}
-
static void __init corgi_init(void)
{
- if (sharpsl_flash_param.comadj_keyword == FLASH_COMADJ_MAJIC)
- corgi_fb_info.comadj=sharpsl_flash_param.comadj;
- else
- corgi_fb_info.comadj=-1;
-
- if (sharpsl_flash_param.phad_keyword == FLASH_PHAD_MAJIC)
- corgi_fb_info.phadadj=sharpsl_flash_param.phadadj;
- else
- corgi_fb_info.phadadj=-1;
+ corgi_fb_info.comadj=sharpsl_param.comadj;
+ corgi_fb_info.phadadj=sharpsl_param.phadadj;
pxa_gpio_mode(CORGI_GPIO_USB_PULLUP | GPIO_OUT);
pxa_set_udc_info(&udc_info);
@@ -264,7 +247,7 @@
static void __init fixup_corgi(struct machine_desc *desc,
struct tag *tags, char **cmdline, struct meminfo *mi)
{
- corgi_get_param();
+ sharpsl_save_param();
mi->nr_banks=1;
mi->bank[0].start = 0xa0000000;
mi->bank[0].node = 0;
diff -Nru a/arch/arm/mach-pxa/poodle.c b/arch/arm/mach-pxa/poodle.c
--- a/arch/arm/mach-pxa/poodle.c 2005-04-03 21:21:51 -07:00
+++ b/arch/arm/mach-pxa/poodle.c 2005-04-03 21:21:51 -07:00
@@ -35,6 +35,7 @@
#include <asm/hardware/scoop.h>
#include <asm/hardware/locomo.h>
+#include <asm/mach/sharpsl_param.h>
#include "generic.h"
@@ -152,6 +153,12 @@
}
}
+static void __init fixup_poodle(struct machine_desc *desc,
+ struct tag *tags, char **cmdline, struct meminfo *mi)
+{
+ sharpsl_save_param();
+}
+
static struct map_desc poodle_io_desc[] __initdata = {
/* virtual physical length */
{ 0xef800000, 0x00000000, 0x00800000, MT_DEVICE }, /* Boot Flash */
@@ -174,6 +181,7 @@
MACHINE_START(POODLE, "SHARP Poodle")
BOOT_MEM(0xa0000000, 0x40000000, io_p2v(0x40000000))
+ FIXUP(fixup_poodle)
MAPIO(poodle_map_io)
INITIRQ(pxa_init_irq)
.timer = &pxa_timer,
diff -Nru a/arch/arm/mach-sa1100/Kconfig b/arch/arm/mach-sa1100/Kconfig
--- a/arch/arm/mach-sa1100/Kconfig 2005-04-03 21:21:51 -07:00
+++ b/arch/arm/mach-sa1100/Kconfig 2005-04-03 21:21:51 -07:00
@@ -47,6 +47,7 @@
bool "Sharp Zaurus SL5500"
select SHARP_LOCOMO
select SHARP_SCOOP
+ select SHARP_PARAM
help
Say Y here to support the Sharp Zaurus SL5500 PDAs.
diff -Nru a/arch/arm/mach-sa1100/collie.c b/arch/arm/mach-sa1100/collie.c
--- a/arch/arm/mach-sa1100/collie.c 2005-04-03 21:21:51 -07:00
+++ b/arch/arm/mach-sa1100/collie.c 2005-04-03 21:21:51 -07:00
@@ -38,6 +38,7 @@
#include <asm/mach/serial_sa1100.h>
#include <asm/hardware/scoop.h>
+#include <asm/mach/sharpsl_param.h>
#include <asm/hardware/locomo.h>
#include "generic.h"
@@ -166,6 +167,8 @@
sa11x0_set_flash_data(&collie_flash_data, collie_flash_resources,
ARRAY_SIZE(collie_flash_resources));
+
+ sharpsl_save_param();
}
static struct map_desc collie_io_desc[] __initdata = {
diff -Nru a/include/asm-arm/arch-pxa/corgi.h b/include/asm-arm/arch-pxa/corgi.h
--- a/include/asm-arm/arch-pxa/corgi.h 2005-04-03 21:21:51 -07:00
+++ b/include/asm-arm/arch-pxa/corgi.h 2005-04-03 21:21:51 -07:00
@@ -100,40 +100,6 @@
/*
- * Corgi Parameter Area Definitions
- */
-#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
-
-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;
-};
-
-/*
* Shared data structures
*/
extern struct platform_device corgiscoop_device;
diff -Nru a/include/asm-arm/arch-pxa/poodle.h
b/include/asm-arm/arch-pxa/poodle.h
--- a/include/asm-arm/arch-pxa/poodle.h 2005-04-03 21:21:51 -07:00
+++ b/include/asm-arm/arch-pxa/poodle.h 2005-04-03 21:21:51 -07:00
@@ -67,45 +67,4 @@
#define POODLE_SCOOP_IO_DIR ( POODLE_SCOOP_VPEN | POODLE_SCOOP_HS_OUT )
#define POODLE_SCOOP_IO_OUT ( 0 )
-/*
- * Flash Memory mappings
- *
- * We have the following mapping:
- * phys virt
- * boot ROM 00000000 ef800000
- */
-#define FLASH_MEM_BASE 0xa0000a00
-#define FLASH_DATA(adr) (*(volatile unsigned
int*)(FLASH_MEM_BASE+(adr)))
-#define FLASH_DATA_F(adr) (*(volatile float32 *)(FLASH_MEM_BASE+(adr)))
-#define FLASH_MAGIC_CHG(a,b,c,d) ( ( d << 24 ) | ( c << 16 ) | ( b << 8 ) | a
)
-
-/* COMADJ */
-#define FLASH_COMADJ_MAJIC FLASH_MAGIC_CHG('C','M','A','D')
-#define FLASH_COMADJ_MAGIC_ADR 0x00
-#define FLASH_COMADJ_DATA_ADR 0x04
-
-/* UUID */
-#define FLASH_UUID_MAJIC FLASH_MAGIC_CHG('U','U','I','D')
-#define FLASH_UUID_MAGIC_ADR 0x08
-#define FLASH_UUID_DATA_ADR 0x0C
-
-/* TOUCH PANEL */
-#define FLASH_TOUCH_MAJIC FLASH_MAGIC_CHG('T','U','C','H')
-#define FLASH_TOUCH_MAGIC_ADR 0x1C
-#define FLASH_TOUCH_XP_DATA_ADR 0x20
-#define FLASH_TOUCH_YP_DATA_ADR 0x24
-#define FLASH_TOUCH_XD_DATA_ADR 0x28
-#define FLASH_TOUCH_YD_DATA_ADR 0x2C
-
-/* AD */
-#define FLASH_AD_MAJIC FLASH_MAGIC_CHG('B','V','A','D')
-#define FLASH_AD_MAGIC_ADR 0x30
-#define FLASH_AD_DATA_ADR 0x34
-
-/* PHAD */
-#define FLASH_PHAD_MAJIC FLASH_MAGIC_CHG('P','H','A','D')
-#define FLASH_PHAD_MAGIC_ADR 0x38
-#define FLASH_PHAD_DATA_ADR 0x3C
-
-
#endif /* __ASM_ARCH_POODLE_H */
diff -Nru a/include/asm-arm/arch-sa1100/collie.h
b/include/asm-arm/arch-sa1100/collie.h
--- a/include/asm-arm/arch-sa1100/collie.h 2005-04-03 21:21:51 -07:00
+++ b/include/asm-arm/arch-sa1100/collie.h 2005-04-03 21:21:51 -07:00
@@ -66,34 +66,6 @@
#define COLLIE_LCM_IRQ_GPIO_nSD_DETECT IRQ_LOCOMO_GPIO13
#define COLLIE_LCM_IRQ_GPIO_nSD_WP IRQ_LOCOMO_GPIO14
-/*
- * Flash Memory mappings
- *
- */
-
-#define FLASH_MEM_BASE 0xe8ffc000
-#define FLASH_DATA(adr) (*(volatile unsigned
int*)(FLASH_MEM_BASE+(adr)))
-#define FLASH_DATA_F(adr) (*(volatile float32 *)(FLASH_MEM_BASE+(adr)))
-#define FLASH_MAGIC_CHG(a,b,c,d) ( ( d << 24 ) | ( c << 16 ) | ( b << 8 ) | a
)
-
-// COMADJ
-#define FLASH_COMADJ_MAJIC FLASH_MAGIC_CHG('C','M','A','D')
-#define FLASH_COMADJ_MAGIC_ADR 0x00
-#define FLASH_COMADJ_DATA_ADR 0x04
-
-// TOUCH PANEL
-#define FLASH_TOUCH_MAJIC FLASH_MAGIC_CHG('T','U','C','H')
-#define FLASH_TOUCH_MAGIC_ADR 0x1C
-#define FLASH_TOUCH_XP_DATA_ADR 0x20
-#define FLASH_TOUCH_YP_DATA_ADR 0x24
-#define FLASH_TOUCH_XD_DATA_ADR 0x28
-#define FLASH_TOUCH_YD_DATA_ADR 0x2C
-
-// AD
-#define FLASH_AD_MAJIC FLASH_MAGIC_CHG('B','V','A','D')
-#define FLASH_AD_MAGIC_ADR 0x30
-#define FLASH_AD_DATA_ADR 0x34
-
/* GPIO's on the TC35143AF (Toshiba Analog Frontend) */
#define COLLIE_TC35143_GPIO_VERSION0 UCB_IO_0 /* GPIO0=Version
*/
#define COLLIE_TC35143_GPIO_TBL_CHK UCB_IO_1 /* GPIO1=TBL_CHK
*/
diff -Nru a/include/asm-arm/mach/sharpsl_param.h
b/include/asm-arm/mach/sharpsl_param.h
--- /dev/null Wed Dec 31 16:00:00 196900
+++ b/include/asm-arm/mach/sharpsl_param.h 2005-04-03 21:21:51 -07:00
@@ -0,0 +1,37 @@
+/*
+ * Hardware parameter area specific to Sharp SL series devices
+ *
+ * Copyright (c) 2005 Richard Purdie
+ *
+ * Based on Sharp's 2.4 kernel patches
+ *
+ * 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.
+ *
+ */
+
+struct sharpsl_param_info {
+ unsigned int comadj_keyword;
+ unsigned int comadj;
+
+ unsigned int uuid_keyword;
+ unsigned char uuid[16];
+
+ unsigned int touch_keyword;
+ unsigned int touch_xp;
+ unsigned int touch_yp;
+ unsigned int touch_xd;
+ unsigned int touch_yd;
+
+ unsigned int adadj_keyword;
+ unsigned int adadj;
+
+ unsigned int phad_keyword;
+ unsigned int phadadj;
+} __attribute__((packed));
+
+
+extern struct sharpsl_param_info sharpsl_param;
+extern void sharpsl_save_param(void);
+
-
To unsubscribe from this list: send the line "unsubscribe bk-commits-head" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at http://vger.kernel.org/majordomo-info.html