aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndres Salomon <dilinger@collabora.co.uk>2009-12-14 21:00:40 -0500
committerLinus Torvalds <torvalds@linux-foundation.org>2009-12-15 11:53:28 -0500
commitf060f27007b393bac6e50ee6fc26d8505acf6fe4 (patch)
treefd83b0c9550814dfb5fc6a726ce7b5eb1baaa6f3
parent2e8c12436f540d3c40137ebf10268803dc972f6a (diff)
cs5535: move VSA2 checks into linux/cs5535.h
Signed-off-by: Andres Salomon <dilinger@collabora.co.uk> Cc: Jordan Crouse <jordan@cosmicpenguin.net> Cc: Ingo Molnar <mingo@elte.hu> Cc: Thomas Gleixner <tglx@linutronix.de> Cc: john stultz <johnstul@us.ibm.com> Cc: Chris Ball <cjb@laptop.org> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
-rw-r--r--arch/x86/include/asm/geode.h19
-rw-r--r--arch/x86/kernel/geode_32.c22
-rw-r--r--arch/x86/kernel/olpc.c4
-rw-r--r--drivers/video/geode/display_gx.c2
-rw-r--r--drivers/video/geode/lxfb_ops.c2
-rw-r--r--include/linux/cs5535.h32
6 files changed, 36 insertions, 45 deletions
diff --git a/arch/x86/include/asm/geode.h b/arch/x86/include/asm/geode.h
index 976b3f11c009..df1eaf87426a 100644
--- a/arch/x86/include/asm/geode.h
+++ b/arch/x86/include/asm/geode.h
@@ -95,16 +95,6 @@ extern int geode_get_dev_base(unsigned int dev);
95#define PM_AWKD 0x50 95#define PM_AWKD 0x50
96#define PM_SSC 0x54 96#define PM_SSC 0x54
97 97
98/* VSA2 magic values */
99
100#define VSA_VRC_INDEX 0xAC1C
101#define VSA_VRC_DATA 0xAC1E
102#define VSA_VR_UNLOCK 0xFC53 /* unlock virtual register */
103#define VSA_VR_SIGNATURE 0x0003
104#define VSA_VR_MEM_SIZE 0x0200
105#define AMD_VSA_SIG 0x4132 /* signature is ascii 'VSA2' */
106#define GSW_VSA_SIG 0x534d /* General Software signature */
107
108static inline u32 geode_gpio(unsigned int nr) 98static inline u32 geode_gpio(unsigned int nr)
109{ 99{
110 BUG_ON(nr > 28); 100 BUG_ON(nr > 28);
@@ -148,15 +138,6 @@ static inline int is_geode(void)
148 return (is_geode_gx() || is_geode_lx()); 138 return (is_geode_gx() || is_geode_lx());
149} 139}
150 140
151#ifdef CONFIG_MGEODE_LX
152extern int geode_has_vsa2(void);
153#else
154static inline int geode_has_vsa2(void)
155{
156 return 0;
157}
158#endif
159
160static inline void geode_mfgpt_write(int timer, u16 reg, u16 value) 141static inline void geode_mfgpt_write(int timer, u16 reg, u16 value)
161{ 142{
162 u32 base = geode_get_dev_base(GEODE_DEV_MFGPT); 143 u32 base = geode_get_dev_base(GEODE_DEV_MFGPT);
diff --git a/arch/x86/kernel/geode_32.c b/arch/x86/kernel/geode_32.c
index 9b08e852fd1a..9dad6ca6cd70 100644
--- a/arch/x86/kernel/geode_32.c
+++ b/arch/x86/kernel/geode_32.c
@@ -161,28 +161,6 @@ void geode_gpio_setup_event(unsigned int gpio, int pair, int pme)
161} 161}
162EXPORT_SYMBOL_GPL(geode_gpio_setup_event); 162EXPORT_SYMBOL_GPL(geode_gpio_setup_event);
163 163
164int geode_has_vsa2(void)
165{
166 static int has_vsa2 = -1;
167
168 if (has_vsa2 == -1) {
169 u16 val;
170
171 /*
172 * The VSA has virtual registers that we can query for a
173 * signature.
174 */
175 outw(VSA_VR_UNLOCK, VSA_VRC_INDEX);
176 outw(VSA_VR_SIGNATURE, VSA_VRC_INDEX);
177
178 val = inw(VSA_VRC_DATA);
179 has_vsa2 = (val == AMD_VSA_SIG || val == GSW_VSA_SIG);
180 }
181
182 return has_vsa2;
183}
184EXPORT_SYMBOL_GPL(geode_has_vsa2);
185
186static int __init geode_southbridge_init(void) 164static int __init geode_southbridge_init(void)
187{ 165{
188 if (!is_geode()) 166 if (!is_geode())
diff --git a/arch/x86/kernel/olpc.c b/arch/x86/kernel/olpc.c
index 4006c522adc7..9d1d263f786f 100644
--- a/arch/x86/kernel/olpc.c
+++ b/arch/x86/kernel/olpc.c
@@ -212,7 +212,7 @@ static int __init olpc_init(void)
212 unsigned char *romsig; 212 unsigned char *romsig;
213 213
214 /* The ioremap check is dangerous; limit what we run it on */ 214 /* The ioremap check is dangerous; limit what we run it on */
215 if (!is_geode() || geode_has_vsa2()) 215 if (!is_geode() || cs5535_has_vsa2())
216 return 0; 216 return 0;
217 217
218 spin_lock_init(&ec_lock); 218 spin_lock_init(&ec_lock);
@@ -244,7 +244,7 @@ static int __init olpc_init(void)
244 (unsigned char *) &olpc_platform_info.ecver, 1); 244 (unsigned char *) &olpc_platform_info.ecver, 1);
245 245
246 /* check to see if the VSA exists */ 246 /* check to see if the VSA exists */
247 if (geode_has_vsa2()) 247 if (cs5535_has_vsa2())
248 olpc_platform_info.flags |= OLPC_F_VSA; 248 olpc_platform_info.flags |= OLPC_F_VSA;
249 249
250 printk(KERN_INFO "OLPC board revision %s%X (EC=%x)\n", 250 printk(KERN_INFO "OLPC board revision %s%X (EC=%x)\n",
diff --git a/drivers/video/geode/display_gx.c b/drivers/video/geode/display_gx.c
index e759895bf3d3..3ddf055e302e 100644
--- a/drivers/video/geode/display_gx.c
+++ b/drivers/video/geode/display_gx.c
@@ -25,7 +25,7 @@ unsigned int gx_frame_buffer_size(void)
25{ 25{
26 unsigned int val; 26 unsigned int val;
27 27
28 if (!geode_has_vsa2()) { 28 if (!cs5535_has_vsa2()) {
29 uint32_t hi, lo; 29 uint32_t hi, lo;
30 30
31 /* The number of pages is (PMAX - PMIN)+1 */ 31 /* The number of pages is (PMAX - PMIN)+1 */
diff --git a/drivers/video/geode/lxfb_ops.c b/drivers/video/geode/lxfb_ops.c
index b1cd49c99356..fe1ee7cbccda 100644
--- a/drivers/video/geode/lxfb_ops.c
+++ b/drivers/video/geode/lxfb_ops.c
@@ -307,7 +307,7 @@ unsigned int lx_framebuffer_size(void)
307{ 307{
308 unsigned int val; 308 unsigned int val;
309 309
310 if (!geode_has_vsa2()) { 310 if (!cs5535_has_vsa2()) {
311 uint32_t hi, lo; 311 uint32_t hi, lo;
312 312
313 /* The number of pages is (PMAX - PMIN)+1 */ 313 /* The number of pages is (PMAX - PMIN)+1 */
diff --git a/include/linux/cs5535.h b/include/linux/cs5535.h
index 39e93e8ed95d..eb34108a608b 100644
--- a/include/linux/cs5535.h
+++ b/include/linux/cs5535.h
@@ -36,6 +36,38 @@
36#define LBAR_ACPI_SIZE 0x40 36#define LBAR_ACPI_SIZE 0x40
37#define LBAR_PMS_SIZE 0x80 37#define LBAR_PMS_SIZE 0x80
38 38
39/* VSA2 magic values */
40#define VSA_VRC_INDEX 0xAC1C
41#define VSA_VRC_DATA 0xAC1E
42#define VSA_VR_UNLOCK 0xFC53 /* unlock virtual register */
43#define VSA_VR_SIGNATURE 0x0003
44#define VSA_VR_MEM_SIZE 0x0200
45#define AMD_VSA_SIG 0x4132 /* signature is ascii 'VSA2' */
46#define GSW_VSA_SIG 0x534d /* General Software signature */
47
48#include <linux/io.h>
49
50static inline int cs5535_has_vsa2(void)
51{
52 static int has_vsa2 = -1;
53
54 if (has_vsa2 == -1) {
55 uint16_t val;
56
57 /*
58 * The VSA has virtual registers that we can query for a
59 * signature.
60 */
61 outw(VSA_VR_UNLOCK, VSA_VRC_INDEX);
62 outw(VSA_VR_SIGNATURE, VSA_VRC_INDEX);
63
64 val = inw(VSA_VRC_DATA);
65 has_vsa2 = (val == AMD_VSA_SIG || val == GSW_VSA_SIG);
66 }
67
68 return has_vsa2;
69}
70
39/* GPIOs */ 71/* GPIOs */
40#define GPIO_OUTPUT_VAL 0x00 72#define GPIO_OUTPUT_VAL 0x00
41#define GPIO_OUTPUT_ENABLE 0x04 73#define GPIO_OUTPUT_ENABLE 0x04