aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRichard Purdie <rpurdie@net.rmk.(none)>2005-04-02 01:01:38 +0100
committerRussell King <rmk@flint.arm.linux.org.uk>2005-04-02 01:01:38 +0100
commite379d235fd5af2f934bb81e6765ef6062de1a5b1 (patch)
treecca1d1df75ae935baf70338b8c506022f318ce8a
parente1cccd684e70ddcba500fb14712d55c0ebe459e0 (diff)
downloadhistory-e379d235fd5af2f934bb81e6765ef6062de1a5b1.tar.gz
[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
-rw-r--r--arch/arm/common/Kconfig3
-rw-r--r--arch/arm/common/Makefile1
-rw-r--r--arch/arm/common/sharpsl_param.c60
-rw-r--r--arch/arm/mach-pxa/Kconfig1
-rw-r--r--arch/arm/mach-pxa/corgi.c25
-rw-r--r--arch/arm/mach-pxa/poodle.c8
-rw-r--r--arch/arm/mach-sa1100/Kconfig1
-rw-r--r--arch/arm/mach-sa1100/collie.c3
-rw-r--r--include/asm-arm/arch-pxa/corgi.h34
-rw-r--r--include/asm-arm/arch-pxa/poodle.h41
-rw-r--r--include/asm-arm/arch-sa1100/collie.h28
-rw-r--r--include/asm-arm/mach/sharpsl_param.h37
12 files changed, 118 insertions, 124 deletions
diff --git a/arch/arm/common/Kconfig b/arch/arm/common/Kconfig
index 7f5df795881dff..692af6b5e8ff25 100644
--- a/arch/arm/common/Kconfig
+++ b/arch/arm/common/Kconfig
@@ -17,5 +17,8 @@ config TIMER_ACORN
config SHARP_LOCOMO
bool
+config SHARP_PARAM
+ bool
+
config SHARP_SCOOP
bool
diff --git a/arch/arm/common/Makefile b/arch/arm/common/Makefile
index ba4a9d3957ccee..11f20a43ee3aa8 100644
--- a/arch/arm/common/Makefile
+++ b/arch/arm/common/Makefile
@@ -11,4 +11,5 @@ obj-$(CONFIG_PCI_HOST_VIA82C505) += via82c505.o
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 --git a/arch/arm/common/sharpsl_param.c b/arch/arm/common/sharpsl_param.c
new file mode 100644
index 00000000000000..c2c557a224c2af
--- /dev/null
+++ b/arch/arm/common/sharpsl_param.c
@@ -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 --git a/arch/arm/mach-pxa/Kconfig b/arch/arm/mach-pxa/Kconfig
index c437660bf92f82..405a55f2287cc8 100644
--- a/arch/arm/mach-pxa/Kconfig
+++ b/arch/arm/mach-pxa/Kconfig
@@ -23,6 +23,7 @@ config PXA_SHARPSL
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 --git a/arch/arm/mach-pxa/corgi.c b/arch/arm/mach-pxa/corgi.c
index 94841068a688e5..f691cf77d3908a 100644
--- a/arch/arm/mach-pxa/corgi.c
+++ b/arch/arm/mach-pxa/corgi.c
@@ -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 @@ static struct platform_device *devices[] __initdata = {
&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 corgi_init(void)
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 --git a/arch/arm/mach-pxa/poodle.c b/arch/arm/mach-pxa/poodle.c
index 5ee67808224a9f..b6c746ea38305b 100644
--- a/arch/arm/mach-pxa/poodle.c
+++ b/arch/arm/mach-pxa/poodle.c
@@ -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 poodle_init(void)
}
}
+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 @@ static void __init poodle_map_io(void)
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 --git a/arch/arm/mach-sa1100/Kconfig b/arch/arm/mach-sa1100/Kconfig
index 5178cde08ab969..50cde576dadfc9 100644
--- a/arch/arm/mach-sa1100/Kconfig
+++ b/arch/arm/mach-sa1100/Kconfig
@@ -47,6 +47,7 @@ config SA1100_COLLIE
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 --git a/arch/arm/mach-sa1100/collie.c b/arch/arm/mach-sa1100/collie.c
index da9412c5d385ee..99287890d3964e 100644
--- a/arch/arm/mach-sa1100/collie.c
+++ b/arch/arm/mach-sa1100/collie.c
@@ -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 @@ static void __init collie_init(void)
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 --git a/include/asm-arm/arch-pxa/corgi.h b/include/asm-arm/arch-pxa/corgi.h
index 4f69467327d1e2..324db06b5dd4b2 100644
--- a/include/asm-arm/arch-pxa/corgi.h
+++ b/include/asm-arm/arch-pxa/corgi.h
@@ -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 --git a/include/asm-arm/arch-pxa/poodle.h b/include/asm-arm/arch-pxa/poodle.h
index 027573d38ee477..58bda9d571a5ae 100644
--- a/include/asm-arm/arch-pxa/poodle.h
+++ b/include/asm-arm/arch-pxa/poodle.h
@@ -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 --git a/include/asm-arm/arch-sa1100/collie.h b/include/asm-arm/arch-sa1100/collie.h
index 01e60d7c30f687..d49e5ff63ca433 100644
--- a/include/asm-arm/arch-sa1100/collie.h
+++ b/include/asm-arm/arch-sa1100/collie.h
@@ -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 --git a/include/asm-arm/mach/sharpsl_param.h b/include/asm-arm/mach/sharpsl_param.h
new file mode 100644
index 00000000000000..7a24ecf0422000
--- /dev/null
+++ b/include/asm-arm/mach/sharpsl_param.h
@@ -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);
+