[ARM] Allow Versatile to be built for AB and PB
authorRussell King <rmk@dyn-67.arm.linux.org.uk>
Mon, 10 Jul 2006 15:33:54 +0000 (16:33 +0100)
committerRussell King <rmk+kernel@arm.linux.org.uk>
Tue, 11 Jul 2006 20:10:42 +0000 (21:10 +0100)
If a configuration was chosen to support both the Versatile
AB and PB boards, the result would write to registers not
available on the PB version of the board.  Resolve this by
using machine_is_xxx().

Also, for the CLCD, despite how the code looks, both the AB
and PB access the same location to control the clock rate -
it's just called something different between the two board
versions.  Invent our own name for this location and use it
unconditionally.

Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
arch/arm/mach-versatile/core.c
include/asm-arm/arch-versatile/platform.h

index a432539cc1bd2dd9506181355b09135382df928f..86437717601512832c8f8308e0ab1df3dd686cec 100644 (file)
@@ -35,6 +35,7 @@
 #include <asm/hardware/arm_timer.h>
 #include <asm/hardware/icst307.h>
 #include <asm/hardware/vic.h>
+#include <asm/mach-types.h>
 
 #include <asm/mach/arch.h>
 #include <asm/mach/flash.h>
@@ -352,11 +353,7 @@ static const struct icst307_params versatile_oscvco_params = {
 static void versatile_oscvco_set(struct clk *clk, struct icst307_vco vco)
 {
        void __iomem *sys_lock = __io_address(VERSATILE_SYS_BASE) + VERSATILE_SYS_LOCK_OFFSET;
-#if defined(CONFIG_ARCH_VERSATILE_PB)
-       void __iomem *sys_osc = __io_address(VERSATILE_SYS_BASE) + VERSATILE_SYS_OSC4_OFFSET;
-#elif defined(CONFIG_MACH_VERSATILE_AB)
-       void __iomem *sys_osc = __io_address(VERSATILE_SYS_BASE) + VERSATILE_SYS_OSC1_OFFSET;
-#endif
+       void __iomem *sys_osc = __io_address(VERSATILE_SYS_BASE) + VERSATILE_SYS_OSCCLCD_OFFSET;
        u32 val;
 
        val = readl(sys_osc) & ~0x7ffff;
@@ -529,7 +526,7 @@ static void versatile_clcd_disable(struct clcd_fb *fb)
        /*
         * If the LCD is Sanyo 2x5 in on the IB2 board, turn the back-light off
         */
-       if (fb->panel == &sanyo_2_5_in) {
+       if (machine_is_versatile_ab() && fb->panel == &sanyo_2_5_in) {
                void __iomem *versatile_ib2_ctrl = __io_address(VERSATILE_IB2_CTRL);
                unsigned long ctrl;
 
@@ -578,7 +575,7 @@ static void versatile_clcd_enable(struct clcd_fb *fb)
        /*
         * If the LCD is Sanyo 2x5 in on the IB2 board, turn the back-light on
         */
-       if (fb->panel == &sanyo_2_5_in) {
+       if (machine_is_versatile_ab() && fb->panel == &sanyo_2_5_in) {
                void __iomem *versatile_ib2_ctrl = __io_address(VERSATILE_IB2_CTRL);
                unsigned long ctrl;
 
index 72ef874567d57b2cb6ad0919e457af6830c4fef9..2af9d7c9c63c32d6dea9f109b1241ff49316d7cf 100644 (file)
@@ -65,6 +65,8 @@
 #define VERSATILE_SYS_OSC1_OFFSET             0x1C
 #endif
 
+#define VERSATILE_SYS_OSCCLCD_OFFSET          0x1c
+
 #define VERSATILE_SYS_LOCK_OFFSET             0x20
 #define VERSATILE_SYS_100HZ_OFFSET            0x24
 #define VERSATILE_SYS_CFGDATA1_OFFSET         0x28