Skip to contentSkip to conversation

Cleanup ARM platform support, and add Versatile Express support

PATCH New Russell King - ARM Linux 5 participants 52 messages Mar 4, 2010 – Mar 8, 2010 1 message not in the archive

Subsystems (6)
lore
Share & tools
lore
#0 lore raw

What follows is a rather large patch set (tested by others and myself) which cleans up the Integrator, Versatile and Realview platform support, and adds support for the ARM Versatile Express platform.

These are inherently interlinked since they all reuse the same IP.

#1 lore raw

PATCH 1/1 ARM: Fix Versatile&Integrator includes to behave in the same way as Realview

Realview doesn't include mach/platform.h in mach/hardware.h, so make versatile behave in the same way. Also, move the definition of __io_address() into mach/hardware.h, just like Realview.

---
 arch/arm/mach-integrator/core.c                    |    1 +
 arch/arm/mach-integrator/cpu.c                     |    1 +
 .../arm/mach-integrator/include/mach/entry-macro.S |    1 +
 arch/arm/mach-integrator/include/mach/hardware.h   |    3 ++-
 arch/arm/mach-integrator/integrator_ap.c           |    1 +
 arch/arm/mach-integrator/integrator_cp.c           |    1 +
 arch/arm/mach-integrator/leds.c                    |    1 +
 arch/arm/mach-integrator/pci_v3.c                  |    1 +
 arch/arm/mach-versatile/core.c                     |    4 ++--
 arch/arm/mach-versatile/include/mach/entry-macro.S |    1 +
 arch/arm/mach-versatile/include/mach/hardware.h    |    3 ++-
 11 files changed, 14 insertions(+), 4 deletions(-)
arch/arm/mach-integrator/core.c +1 -0
index 8b390e3..096f899 100644
@@ -24,6 +24,7 @@
 #include <asm/clkdev.h>
 #include <mach/clkdev.h>
 #include <mach/hardware.h>
+#include <mach/platform.h>
 #include <asm/irq.h>
 #include <asm/hardware/arm_timer.h>
 #include <mach/cm.h>
arch/arm/mach-integrator/cpu.c +1 -0
index 44d4c2e..b761879 100644
@@ -20,6 +20,7 @@
 #include <linux/io.h>
 
 #include <mach/hardware.h>
+#include <mach/platform.h>
 #include <asm/mach-types.h>
 #include <asm/hardware/icst525.h>
 
arch/arm/mach-integrator/include/mach/entry-macro.S +1 -0
index 7649c57..3d029c9 100644
@@ -8,6 +8,7 @@
  * warranty of any kind, whether express or implied.
  */
 #include <mach/hardware.h>
+#include <mach/platform.h>
 #include <mach/irqs.h>
 
  		.macro	disable_fiq
arch/arm/mach-integrator/include/mach/hardware.h +2 -1
index d795642..d44af72 100644
@@ -23,7 +23,6 @@
 #define __ASM_ARCH_HARDWARE_H
 
 #include <asm/sizes.h>
-#include <mach/platform.h>
 
 /*
  * Where in virtual memory the IO devices (timers, system controllers
@@ -48,5 +47,7 @@
 #define PCIBIOS_MIN_IO		0x6000
 #define PCIBIOS_MIN_MEM 	0x00100000
 
+#define __io_address(n)		((void __iomem *)IO_ADDRESS(n))
+
 #endif
 
arch/arm/mach-integrator/integrator_ap.c +1 -0
index 8138a7e..018c32d 100644
@@ -30,6 +30,7 @@
 #include <linux/io.h>
 
 #include <mach/hardware.h>
+#include <mach/platform.h>
 #include <asm/irq.h>
 #include <asm/setup.h>
 #include <asm/param.h>		/* HZ */
arch/arm/mach-integrator/integrator_cp.c +1 -0
index 66ef86d..c66e8fa 100644
@@ -25,6 +25,7 @@
 #include <asm/clkdev.h>
 #include <mach/clkdev.h>
 #include <mach/hardware.h>
+#include <mach/platform.h>
 #include <asm/irq.h>
 #include <asm/setup.h>
 #include <asm/mach-types.h>
arch/arm/mach-integrator/leds.c +1 -0
index 8dcc823..28be186 100644
@@ -27,6 +27,7 @@
 #include <linux/io.h>
 
 #include <mach/hardware.h>
+#include <mach/platform.h>
 #include <asm/leds.h>
 #include <asm/system.h>
 #include <asm/mach-types.h>
arch/arm/mach-integrator/pci_v3.c +1 -0
index 148d25f..e87fe9f 100644
@@ -30,6 +30,7 @@
 #include <linux/io.h>
 
 #include <mach/hardware.h>
+#include <mach/platform.h>
 #include <asm/irq.h>
 #include <asm/signal.h>
 #include <asm/system.h>
arch/arm/mach-versatile/core.c +2 -2
index 9ddb49b..b77bc40 100644
@@ -35,7 +35,6 @@
 
 #include <asm/clkdev.h>
 #include <asm/system.h>
-#include <mach/hardware.h>
 #include <asm/irq.h>
 #include <asm/leds.h>
 #include <asm/hardware/arm_timer.h>
@@ -48,6 +47,8 @@
 #include <asm/mach/irq.h>
 #include <asm/mach/time.h>
 #include <asm/mach/map.h>
+#include <mach/hardware.h>
+#include <mach/platform.h>
 
 #include "core.h"
 #include "clock.h"
@@ -58,7 +59,6 @@
  *
  * Setup a VA for the Versatile Vectored Interrupt Controller.
  */
-#define __io_address(n)		__io(IO_ADDRESS(n))
 #define VA_VIC_BASE		__io_address(VERSATILE_VIC_BASE)
 #define VA_SIC_BASE		__io_address(VERSATILE_SIC_BASE)
 
arch/arm/mach-versatile/include/mach/entry-macro.S +1 -0
index 8c80209..e6f7c16 100644
@@ -8,6 +8,7 @@
  * warranty of any kind, whether express or implied.
  */
 #include <mach/hardware.h>
+#include <mach/platform.h>
 #include <asm/hardware/vic.h>
 
 		.macro	disable_fiq
arch/arm/mach-versatile/include/mach/hardware.h +2 -1
index 7aa906c..4f8f99a 100644
@@ -23,7 +23,6 @@
 #define __ASM_ARCH_HARDWARE_H
 
 #include <asm/sizes.h>
-#include <mach/platform.h>
 
 /*
  * PCI space virtual addresses
@@ -49,4 +48,6 @@
 /* macro to get at IO space when running virtually */
 #define IO_ADDRESS(x)		(((x) & 0x0fffffff) + (((x) >> 4) & 0x0f000000) + 0xf0000000)
 
+#define __io_address(n)		__io(IO_ADDRESS(n))
+
 #endif
#2 lore raw

PATCH 1/1 ARM: Improve documentation in arm_timer.h

---
 arch/arm/include/asm/hardware/arm_timer.h |   39 +++++++++++++++++-----------
 1 files changed, 24 insertions(+), 15 deletions(-)
arch/arm/include/asm/hardware/arm_timer.h +24 -15
index 04be3bd..c0f4e7b 100644
@@ -1,21 +1,30 @@
 #ifndef __ASM_ARM_HARDWARE_ARM_TIMER_H
 #define __ASM_ARM_HARDWARE_ARM_TIMER_H
 
-#define TIMER_LOAD	0x00
-#define TIMER_VALUE	0x04
-#define TIMER_CTRL	0x08
-#define TIMER_CTRL_ONESHOT	(1 << 0)
-#define TIMER_CTRL_32BIT	(1 << 1)
-#define TIMER_CTRL_DIV1		(0 << 2)
-#define TIMER_CTRL_DIV16	(1 << 2)
-#define TIMER_CTRL_DIV256	(2 << 2)
-#define TIMER_CTRL_IE		(1 << 5)	/* Interrupt Enable (versatile only) */
-#define TIMER_CTRL_PERIODIC	(1 << 6)
-#define TIMER_CTRL_ENABLE	(1 << 7)
+/*
+ * ARM timer implementation, found in Integrator, Versatile and Realview
+ * platforms.  Not all platforms support all registers and bits in these
+ * registers, so we mark them with A for Integrator AP, C for Integrator
+ * CP, V for Versatile and R for Realview.
+ *
+ * Integrator AP has 16-bit timers, Integrator CP, Versatile and Realview
+ * can have 16-bit or 32-bit selectable via a bit in the control register.
+ */
+#define TIMER_LOAD	0x00			/* ACVR rw */
+#define TIMER_VALUE	0x04			/* ACVR ro */
+#define TIMER_CTRL	0x08			/* ACVR rw */
+#define TIMER_CTRL_ONESHOT	(1 << 0)	/*  CVR */
+#define TIMER_CTRL_32BIT	(1 << 1)	/*  CVR */
+#define TIMER_CTRL_DIV1		(0 << 2)	/* ACVR */
+#define TIMER_CTRL_DIV16	(1 << 2)	/* ACVR */
+#define TIMER_CTRL_DIV256	(2 << 2)	/* ACVR */
+#define TIMER_CTRL_IE		(1 << 5)	/*   VR */
+#define TIMER_CTRL_PERIODIC	(1 << 6)	/* ACVR */
+#define TIMER_CTRL_ENABLE	(1 << 7)	/* ACVR */
 
-#define TIMER_INTCLR	0x0c
-#define TIMER_RIS	0x10
-#define TIMER_MIS	0x14
-#define TIMER_BGLOAD	0x18
+#define TIMER_INTCLR	0x0c			/* ACVR wo */
+#define TIMER_RIS	0x10			/*  CVR ro */
+#define TIMER_MIS	0x14			/*  CVR ro */
+#define TIMER_BGLOAD	0x18			/*  CVR rw */
 
 #endif
#3 lore raw

PATCH 1/1 ARM: Integrator: convert to generic time support

---
 arch/arm/Kconfig                         |    1 +
 arch/arm/mach-integrator/common.h        |    1 -
 arch/arm/mach-integrator/core.c          |   62 ++++++++++++++---------------
 arch/arm/mach-integrator/integrator_ap.c |    1 -
 arch/arm/mach-integrator/integrator_cp.c |    1 -
 5 files changed, 31 insertions(+), 35 deletions(-)
arch/arm/Kconfig +1 -0
index 4c33ca8..d656dec 100644
@@ -223,6 +223,7 @@ config ARCH_INTEGRATOR
 	select HAVE_CLK
 	select COMMON_CLKDEV
 	select ICST525
+	select GENERIC_TIME
 	help
 	  Support for ARM's Integrator platform.
 
arch/arm/mach-integrator/common.h +0 -1
index 609c49d..7dc24bb 100644
@@ -1,2 +1 @@
 extern void integrator_time_init(unsigned long, unsigned int);
-extern unsigned long integrator_gettimeoffset(void);
arch/arm/mach-integrator/core.c +30 -32

91 lines not on this page · raw message

arch/arm/mach-integrator/integrator_ap.c +0 -1
index 018c32d..cfb718f 100644
@@ -342,7 +342,6 @@ static void __init ap_init_timer(void)
 
 static struct sys_timer ap_timer = {
 	.init		= ap_init_timer,
-	.offset		= integrator_gettimeoffset,
 };
 
 MACHINE_START(INTEGRATOR, "ARM-Integrator")
arch/arm/mach-integrator/integrator_cp.c +0 -1
index c66e8fa..3e84732 100644
@@ -577,7 +577,6 @@ static void __init intcp_timer_init(void)
 
 static struct sys_timer cp_timer = {
 	.init		= intcp_timer_init,
-	.offset		= integrator_gettimeoffset,
 };
 
 MACHINE_START(CINTEGRATOR, "ARM-IntegratorCP")
#4 lore raw

PATCH 1/1 ARM: Integrator: convert to generic clockevent support

---
 arch/arm/Kconfig                |    1 +
 arch/arm/mach-integrator/core.c |  107 ++++++++++++++++++++++++++------------
 2 files changed, 74 insertions(+), 34 deletions(-)
arch/arm/Kconfig +1 -0
index d656dec..95ea101 100644
@@ -224,6 +224,7 @@ config ARCH_INTEGRATOR
 	select COMMON_CLKDEV
 	select ICST525
 	select GENERIC_TIME
+	select GENERIC_CLOCKEVENTS
 	help
 	  Support for ARM's Integrator platform.
 
arch/arm/mach-integrator/core.c +73 -34

140 lines not on this page · raw message

#5 lore raw

PATCH 1/1 ARM: Integrator: pass 'khz' to integrator_time_init

This is now what the clocksource/clockevent initialization functions want, so give them the timer tick rate directly.

---
 arch/arm/mach-integrator/common.h        |    2 +-
 arch/arm/mach-integrator/core.c          |    6 +++---
 arch/arm/mach-integrator/integrator_ap.c |    2 +-
 arch/arm/mach-integrator/integrator_cp.c |    2 +-
 4 files changed, 6 insertions(+), 6 deletions(-)
arch/arm/mach-integrator/common.h +1 -1
index 7dc24bb..cdbe710 100644
@@ -1 +1 @@
-extern void integrator_time_init(unsigned long, unsigned int);
+extern void integrator_time_init(u32, unsigned int);
arch/arm/mach-integrator/core.c +3 -3
index b1ccbe3..d02f0e3 100644
@@ -363,12 +363,12 @@ static void integrator_clockevent_init(u32 khz, unsigned int ctrl)
 /*
  * Set up timer(s).
  */
-void __init integrator_time_init(unsigned long reload, unsigned int ctrl)
+void __init integrator_time_init(u32 khz, unsigned int ctrl)
 {
 	writel(0, TIMER0_VA_BASE + TIMER_CTRL);
 	writel(0, TIMER1_VA_BASE + TIMER_CTRL);
 	writel(0, TIMER2_VA_BASE + TIMER_CTRL);
 
-	integrator_clocksource_init(reload * HZ / 1000);
-	integrator_clockevent_init(reload * HZ / 1000, ctrl);
+	integrator_clocksource_init(khz);
+	integrator_clockevent_init(khz, ctrl);
 }
arch/arm/mach-integrator/integrator_ap.c +1 -1
index cfb718f..93da7d4 100644
@@ -337,7 +337,7 @@ static void __init ap_init(void)
 
 static void __init ap_init_timer(void)
 {
-	integrator_time_init(1000000 * TICKS_PER_uSEC / HZ, 0);
+	integrator_time_init(TICKS_PER_uSEC * 1000, 0);
 }
 
 static struct sys_timer ap_timer = {
arch/arm/mach-integrator/integrator_cp.c +1 -1
index 3e84732..108bc48 100644
@@ -572,7 +572,7 @@ static void __init intcp_init(void)
 
 static void __init intcp_timer_init(void)
 {
-	integrator_time_init(1000000 / HZ, TIMER_CTRL_IE);
+	integrator_time_init(1000, TIMER_CTRL_IE);
 }
 
 static struct sys_timer cp_timer = {
#6 lore raw

PATCH 1/1 ARM: Realview/Versatile/Integrator: remove unused definitions from platform.h

---
 arch/arm/mach-integrator/include/mach/platform.h |   42 +--------------------
 arch/arm/mach-realview/include/mach/platform.h   |   20 ----------
 arch/arm/mach-versatile/include/mach/platform.h  |   26 +------------
 3 files changed, 4 insertions(+), 84 deletions(-)
arch/arm/mach-integrator/include/mach/platform.h +2 -40
index e00a262..f934227 100644
@@ -23,9 +23,6 @@
  *
  *   Integrator address map
  *
- * 	NOTE: This is a multi-hosted header file for use with uHAL and
- * 	      supported debuggers.
- *
  * ***********************************************************************/
 
 #ifndef __address_h
@@ -328,20 +325,6 @@
  */
 #define PHYS_PCI_V3_BASE                0x62000000
 
-#define PCI_DRAMSIZE                    INTEGRATOR_SSRAM_SIZE
-
-/* 'export' these to UHAL */
-#define UHAL_PCI_IO                     PCI_IO_BASE
-#define UHAL_PCI_MEM                    PCI_MEM_BASE
-#define UHAL_PCI_ALLOC_IO_BASE          0x00004000
-#define UHAL_PCI_ALLOC_MEM_BASE         PCI_MEM_BASE
-#define UHAL_PCI_MAX_SLOT               20
-
-/* ========================================================================
- *  Start of uHAL definitions
- * ========================================================================
- */
-
 /* ------------------------------------------------------------------------
  *  Integrator Interrupt Controllers
  * ------------------------------------------------------------------------
@@ -389,7 +372,7 @@
  */
 
 /* ------------------------------------------------------------------------
- *  LED's - The header LED is not accessible via the uHAL API
+ *  LED's
  * ------------------------------------------------------------------------
  *
  */
@@ -402,34 +385,18 @@
 #define LED_BANK                        INTEGRATOR_DBG_LEDS
 
 /*
- *  Memory definitions - run uHAL out of SSRAM.
- *
- */
-#define uHAL_MEMORY_SIZE                INTEGRATOR_SSRAM_SIZE
-
-/*
- *  Clean base - dummy
- *
- */
-#define CLEAN_BASE                      INTEGRATOR_BOOT_ROM_HI
-
-/*
  *  Timer definitions
  *
  *  Only use timer 1 & 2
  *  (both run at 24MHz and will need the clock divider set to 16).
  *
- *  Timer 0 runs at bus frequency and therefore could vary and currently
- *  uHAL can't handle that.
- *
+ *  Timer 0 runs at bus frequency
  */
 
 #define INTEGRATOR_TIMER0_BASE          INTEGRATOR_CT_BASE
 #define INTEGRATOR_TIMER1_BASE          (INTEGRATOR_CT_BASE + 0x100)
 #define INTEGRATOR_TIMER2_BASE          (INTEGRATOR_CT_BASE + 0x200)
 
-#define MAX_TIMER                       2
-#define MAX_PERIOD                      699050
 #define TICKS_PER_uSEC                  24
 
 /*
@@ -437,14 +404,9 @@
  *
  */
 #define mSEC_1                          1000
-#define mSEC_5                          (mSEC_1 * 5)
 #define mSEC_10                         (mSEC_1 * 10)
-#define mSEC_25                         (mSEC_1 * 25)
-#define SEC_1                           (mSEC_1 * 1000)
 
 #define INTEGRATOR_CSR_BASE             0x10000000
 #define INTEGRATOR_CSR_SIZE             0x10000000
 
 #endif
-
-/* 	END */
arch/arm/mach-realview/include/mach/platform.h +0 -20
index 86c0c44..1b77a27 100644
@@ -231,12 +231,6 @@
 #define REALVIEW_INTREG_OFFSET		0x8	/* Interrupt control */
 #define REALVIEW_DECODE_OFFSET		0xC	/* Fitted logic modules */
 
-/* 
- *  Clean base - dummy
- * 
- */
-#define CLEAN_BASE                      REALVIEW_BOOT_ROM_HI
-
 /*
  * System controller bit assignment
  */
@@ -249,20 +243,6 @@
 #define REALVIEW_TIMER4_EnSel	21
 
 
-#define MAX_TIMER                       2
-#define MAX_PERIOD                      699050
-#define TICKS_PER_uSEC                  1
-
-/* 
- *  These are useconds NOT ticks.  
- * 
- */
-#define mSEC_1                          1000
-#define mSEC_5                          (mSEC_1 * 5)
-#define mSEC_10                         (mSEC_1 * 10)
-#define mSEC_25                         (mSEC_1 * 25)
-#define SEC_1                           (mSEC_1 * 1000)
-
 #define REALVIEW_CSR_BASE             0x10000000
 #define REALVIEW_CSR_SIZE             0x10000000
 
arch/arm/mach-versatile/include/mach/platform.h +2 -24
index 8320739..ec08740 100644
@@ -205,7 +205,7 @@
 #define VERSATILE_CLCD_BASE            0x10120000	/* CLCD */
 #define VERSATILE_DMAC_BASE            0x10130000	/* DMA controller */
 #define VERSATILE_VIC_BASE             0x10140000	/* Vectored interrupt controller */
-#define VERSATILE_PERIPH_BASE          0x10150000    /* off-chip peripherals alias from */
+#define VERSATILE_PERIPH_BASE          0x10150000	/* off-chip peripherals alias from */
                                                 /* 0x10000000 - 0x100FFFFF */
 #define VERSATILE_AHBM_BASE            0x101D0000	/* AHB monitor */
 #define VERSATILE_SCTL_BASE            0x101E0000	/* System controller */
@@ -213,7 +213,7 @@
 #define VERSATILE_TIMER0_1_BASE        0x101E2000	/* Timer 0 and 1 */
 #define VERSATILE_TIMER2_3_BASE        0x101E3000	/* Timer 2 and 3 */
 #define VERSATILE_GPIO0_BASE           0x101E4000	/* GPIO port 0 */
-#define VERSATILE_GPIO1_BASE           0x101E5000    /* GPIO port 1 */
+#define VERSATILE_GPIO1_BASE           0x101E5000	/* GPIO port 1 */
 #define VERSATILE_GPIO2_BASE           0x101E6000	/* GPIO port 2 */
 #define VERSATILE_GPIO3_BASE           0x101E7000	/* GPIO port 3 */
 #define VERSATILE_RTC_BASE             0x101E8000	/* Real Time Clock */
@@ -379,12 +379,6 @@
 #define SIC_INT_PCI3                    30
 
 
-/* 
- *  Clean base - dummy
- * 
- */
-#define CLEAN_BASE                      VERSATILE_BOOT_ROM_HI
-
 /*
  * System controller bit assignment
  */
@@ -397,20 +391,6 @@
 #define VERSATILE_TIMER4_EnSel	21
 
 
-#define MAX_TIMER                       2
-#define MAX_PERIOD                      699050
-#define TICKS_PER_uSEC                  1
-
-/* 
- *  These are useconds NOT ticks.  
- * 
- */
-#define mSEC_1                          1000
-#define mSEC_5                          (mSEC_1 * 5)
-#define mSEC_10                         (mSEC_1 * 10)
-#define mSEC_25                         (mSEC_1 * 25)
-#define SEC_1                           (mSEC_1 * 1000)
-
 #define VERSATILE_CSR_BASE             0x10000000
 #define VERSATILE_CSR_SIZE             0x10000000
 
@@ -432,5 +412,3 @@
 #endif
 
 #endif
-
-/* 	END */
#7 lore raw

PATCH 1/1 ARM: Integrator: fix Integrator/CP definitions, move to platform.h

---
 arch/arm/mach-integrator/include/mach/platform.h |   14 ++++---
 arch/arm/mach-integrator/integrator_ap.c         |    4 +-
 arch/arm/mach-integrator/integrator_cp.c         |   38 ++++++++++-----------
 3 files changed, 28 insertions(+), 28 deletions(-)
arch/arm/mach-integrator/include/mach/platform.h +8 -6
index f934227..5e6ea5c 100644
@@ -287,12 +287,14 @@
 #define INTEGRATOR_DBG_LEDS             (INTEGRATOR_DBG_BASE + INTEGRATOR_DBG_LEDS_OFFSET)
 #define INTEGRATOR_DBG_SWITCH           (INTEGRATOR_DBG_BASE + INTEGRATOR_DBG_SWITCH_OFFSET)
 
-
-#if defined(CONFIG_ARCH_INTEGRATOR_AP)
-#define INTEGRATOR_GPIO_BASE            0x1B000000	 /*  GPIO */
-#elif defined(CONFIG_ARCH_INTEGRATOR_CP)
-#define INTEGRATOR_GPIO_BASE            0xC9000000	 /*  GPIO */
-#endif
+#define INTEGRATOR_AP_GPIO_BASE		0x1B000000	/* GPIO */
+
+#define INTEGRATOR_CP_MMC_BASE		0x1C000000	/* MMC */
+#define INTEGRATOR_CP_AACI_BASE		0x1D000000	/* AACI */
+#define INTEGRATOR_CP_ETH_BASE		0xC8000000	/* Ethernet */
+#define INTEGRATOR_CP_GPIO_BASE		0xC9000000	/* GPIO */
+#define INTEGRATOR_CP_SIC_BASE		0xCA000000	/* SIC */
+#define INTEGRATOR_CP_CTL_BASE		0xCB000000	/* CP system control */
 
 /* ------------------------------------------------------------------------
  *  KMI keyboard/mouse definitions
arch/arm/mach-integrator/integrator_ap.c +2 -2
index 93da7d4..45bba04 100644
@@ -118,8 +118,8 @@ static struct map_desc ap_io_desc[] __initdata = {
 		.length		= SZ_4K,
 		.type		= MT_DEVICE
 	}, {
-		.virtual	= IO_ADDRESS(INTEGRATOR_GPIO_BASE),
-		.pfn		= __phys_to_pfn(INTEGRATOR_GPIO_BASE),
+		.virtual	= IO_ADDRESS(INTEGRATOR_AP_GPIO_BASE),
+		.pfn		= __phys_to_pfn(INTEGRATOR_AP_GPIO_BASE),
 		.length		= SZ_4K,
 		.type		= MT_DEVICE
 	}, {
arch/arm/mach-integrator/integrator_cp.c +18 -20
index 108bc48..333c297 100644
@@ -42,9 +42,6 @@
 
 #include "common.h"
 
-#define INTCP_PA_MMC_BASE		0x1c000000
-#define INTCP_PA_AACI_BASE		0x1d000000
-
 #define INTCP_PA_FLASH_BASE		0x24000000
 #define INTCP_FLASH_SIZE		SZ_32M
 
@@ -52,12 +49,11 @@
 
 #define INTCP_VA_CIC_BASE		IO_ADDRESS(INTEGRATOR_HDR_BASE) + 0x40
 #define INTCP_VA_PIC_BASE		IO_ADDRESS(INTEGRATOR_IC_BASE)
-#define INTCP_VA_SIC_BASE		IO_ADDRESS(0xca000000)
+#define INTCP_VA_SIC_BASE		IO_ADDRESS(INTEGRATOR_CP_SIC_BASE)
 
-#define INTCP_PA_ETH_BASE		0xc8000000
 #define INTCP_ETH_SIZE			0x10
 
-#define INTCP_VA_CTRL_BASE		IO_ADDRESS(0xcb000000)
+#define INTCP_VA_CTRL_BASE		IO_ADDRESS(INTEGRATOR_CP_CTL_BASE)
 #define INTCP_FLASHPROG			0x04
 #define CINTEGRATOR_FLASHPROG_FLVPPEN	(1 << 0)
 #define CINTEGRATOR_FLASHPROG_FLWREN	(1 << 1)
@@ -72,7 +68,9 @@
  * f1600000	16000000	UART 0
  * f1700000	17000000	UART 1
  * f1a00000	1a000000	Debug LEDs
- * f1b00000	1b000000	GPIO
+ * fc900000	c9000000	GPIO
+ * fca00000	ca000000	SIC
+ * fcb00000	cb000000	CP system control
  */
 
 static struct map_desc intcp_io_desc[] __initdata = {
@@ -117,18 +115,18 @@ static struct map_desc intcp_io_desc[] __initdata = {
 		.length		= SZ_4K,
 		.type		= MT_DEVICE
 	}, {
-		.virtual	= IO_ADDRESS(INTEGRATOR_GPIO_BASE),
-		.pfn		= __phys_to_pfn(INTEGRATOR_GPIO_BASE),
+		.virtual	= IO_ADDRESS(INTEGRATOR_CP_GPIO_BASE),
+		.pfn		= __phys_to_pfn(INTEGRATOR_CP_GPIO_BASE),
 		.length		= SZ_4K,
 		.type		= MT_DEVICE
 	}, {
-		.virtual	= IO_ADDRESS(0xca000000),
-		.pfn		= __phys_to_pfn(0xca000000),
+		.virtual	= IO_ADDRESS(INTEGRATOR_CP_SIC_BASE),
+		.pfn		= __phys_to_pfn(INTEGRATOR_CP_SIC_BASE),
 		.length		= SZ_4K,
 		.type		= MT_DEVICE
 	}, {
-		.virtual	= IO_ADDRESS(0xcb000000),
-		.pfn		= __phys_to_pfn(0xcb000000),
+		.virtual	= IO_ADDRESS(INTEGRATOR_CP_CTL_BASE),
+		.pfn		= __phys_to_pfn(INTEGRATOR_CP_CTL_BASE),
 		.length		= SZ_4K,
 		.type		= MT_DEVICE
 	}
@@ -364,8 +362,8 @@ static struct platform_device intcp_flash_device = {
 
 static struct resource smc91x_resources[] = {
 	[0] = {
-		.start	= INTCP_PA_ETH_BASE,
-		.end	= INTCP_PA_ETH_BASE + INTCP_ETH_SIZE - 1,
+		.start	= INTEGRATOR_CP_ETH_BASE,
+		.end	= INTEGRATOR_CP_ETH_BASE + INTCP_ETH_SIZE - 1,
 		.flags	= IORESOURCE_MEM,
 	},
 	[1] = {
@@ -396,7 +394,7 @@ static struct platform_device *intcp_devs[] __initdata = {
 static unsigned int mmc_status(struct device *dev)
 {
 	unsigned int status = readl(IO_ADDRESS(0xca000000) + 4);
-	writel(8, IO_ADDRESS(0xcb000000) + 8);
+	writel(8, IO_ADDRESS(INTEGRATOR_CP_CTL_BASE) + 8);
 
 	return status & 8;
 }
@@ -414,8 +412,8 @@ static struct amba_device mmc_device = {
 		.platform_data = &mmc_data,
 	},
 	.res		= {
-		.start	= INTCP_PA_MMC_BASE,
-		.end	= INTCP_PA_MMC_BASE + SZ_4K - 1,
+		.start	= INTEGRATOR_CP_MMC_BASE,
+		.end	= INTEGRATOR_CP_MMC_BASE + SZ_4K - 1,
 		.flags	= IORESOURCE_MEM,
 	},
 	.irq		= { IRQ_CP_MMCIINT0, IRQ_CP_MMCIINT1 },
@@ -427,8 +425,8 @@ static struct amba_device aaci_device = {
 		.init_name = "mb:1d",
 	},
 	.res		= {
-		.start	= INTCP_PA_AACI_BASE,
-		.end	= INTCP_PA_AACI_BASE + SZ_4K - 1,
+		.start	= INTEGRATOR_CP_AACI_BASE,
+		.end	= INTEGRATOR_CP_AACI_BASE + SZ_4K - 1,
 		.flags	= IORESOURCE_MEM,
 	},
 	.irq		= { IRQ_CP_AACIINT, NO_IRQ },
#8 lore raw

PATCH 1/1 ARM: Integrator: allow IO_ADDRESS() to be used for register addresses

---
 arch/arm/mach-integrator/include/mach/hardware.h |   14 +++++++-------
 1 files changed, 7 insertions(+), 7 deletions(-)
arch/arm/mach-integrator/include/mach/hardware.h +7 -7
index d44af72..8e26360 100644
@@ -35,18 +35,18 @@
 #define PCIO_BASE		PCI_IO_VADDR
 #define PCIMEM_BASE		PCI_MEMORY_VADDR
 
-#ifdef CONFIG_MMU
-/* macro to get at IO space when running virtually */
-#define IO_ADDRESS(x) (((x) >> 4) + IO_BASE) 
-#else
-#define IO_ADDRESS(x) (x)
-#endif
-
 #define pcibios_assign_all_busses()	1
 
 #define PCIBIOS_MIN_IO		0x6000
 #define PCIBIOS_MIN_MEM 	0x00100000
 
+/* macro to get at IO space when running virtually */
+#ifdef CONFIG_MMU
+#define IO_ADDRESS(x)	(((x) & 0x000fffff) | (((x) >> 4) & 0x0ff00000) | IO_BASE)
+#else
+#define IO_ADDRESS(x)	(x)
+#endif
+
 #define __io_address(n)		((void __iomem *)IO_ADDRESS(n))
 
 #endif
#9 lore raw

PATCH 1/1 ARM: Integrator: convert to use register definitions

Rather than using converted base address plus offset, use the register address itself now that IO_ADDRESS() can cope with these.

---
 arch/arm/mach-integrator/core.c          |   12 ++++++------
 arch/arm/mach-integrator/cpu.c           |    8 ++++----
 arch/arm/mach-integrator/integrator_ap.c |    2 +-
 arch/arm/mach-integrator/integrator_cp.c |   10 +++++-----
 arch/arm/mach-integrator/pci_v3.c        |    6 +++---
 5 files changed, 19 insertions(+), 19 deletions(-)
arch/arm/mach-integrator/core.c +6 -6
index d02f0e3..ac2b0c5 100644
@@ -166,8 +166,8 @@ arch_initcall(integrator_init);
  *  UART0  7    6
  *  UART1  5    4
  */
-#define SC_CTRLC	(IO_ADDRESS(INTEGRATOR_SC_BASE) + INTEGRATOR_SC_CTRLC_OFFSET)
-#define SC_CTRLS	(IO_ADDRESS(INTEGRATOR_SC_BASE) + INTEGRATOR_SC_CTRLS_OFFSET)
+#define SC_CTRLC	IO_ADDRESS(INTEGRATOR_SC_CTRLC)
+#define SC_CTRLS	IO_ADDRESS(INTEGRATOR_SC_CTRLS)
 
 static void integrator_uart_set_mctrl(struct amba_device *dev, void __iomem *base, unsigned int mctrl)
 {
@@ -199,7 +199,7 @@ static struct amba_pl010_data integrator_uart_data = {
 	.set_mctrl = integrator_uart_set_mctrl,
 };
 
-#define CM_CTRL	IO_ADDRESS(INTEGRATOR_HDR_BASE) + INTEGRATOR_HDR_CTRL_OFFSET
+#define CM_CTRL	IO_ADDRESS(INTEGRATOR_HDR_CTRL)
 
 static DEFINE_SPINLOCK(cm_lock);
 
@@ -224,9 +224,9 @@ EXPORT_SYMBOL(cm_control);
 /*
  * Where is the timer (VA)?
  */
-#define TIMER0_VA_BASE (IO_ADDRESS(INTEGRATOR_CT_BASE)+0x00000000)
-#define TIMER1_VA_BASE (IO_ADDRESS(INTEGRATOR_CT_BASE)+0x00000100)
-#define TIMER2_VA_BASE (IO_ADDRESS(INTEGRATOR_CT_BASE)+0x00000200)
+#define TIMER0_VA_BASE IO_ADDRESS(INTEGRATOR_TIMER0_BASE)
+#define TIMER1_VA_BASE IO_ADDRESS(INTEGRATOR_TIMER1_BASE)
+#define TIMER2_VA_BASE IO_ADDRESS(INTEGRATOR_TIMER2_BASE)
 
 /*
  * How long is the timer interval?
arch/arm/mach-integrator/cpu.c +4 -4
index b761879..7f1b73b 100644
@@ -26,10 +26,10 @@
 
 static struct cpufreq_driver integrator_driver;
 
-#define CM_ID  	(IO_ADDRESS(INTEGRATOR_HDR_BASE)+INTEGRATOR_HDR_ID_OFFSET)
-#define CM_OSC	(IO_ADDRESS(INTEGRATOR_HDR_BASE)+INTEGRATOR_HDR_OSC_OFFSET)
-#define CM_STAT (IO_ADDRESS(INTEGRATOR_HDR_BASE)+INTEGRATOR_HDR_STAT_OFFSET)
-#define CM_LOCK (IO_ADDRESS(INTEGRATOR_HDR_BASE)+INTEGRATOR_HDR_LOCK_OFFSET)
+#define CM_ID  	IO_ADDRESS(INTEGRATOR_HDR_ID)
+#define CM_OSC	IO_ADDRESS(INTEGRATOR_HDR_OSC)
+#define CM_STAT IO_ADDRESS(INTEGRATOR_HDR_STAT)
+#define CM_LOCK IO_ADDRESS(INTEGRATOR_HDR_LOCK)
 
 static const struct icst525_params lclk_params = {
 	.ref		= 24000,
arch/arm/mach-integrator/integrator_ap.c +1 -1
index 45bba04..c89b231 100644
@@ -56,7 +56,7 @@
 #define VA_IC_BASE	IO_ADDRESS(INTEGRATOR_IC_BASE) 
 #define VA_SC_BASE	IO_ADDRESS(INTEGRATOR_SC_BASE)
 #define VA_EBI_BASE	IO_ADDRESS(INTEGRATOR_EBI_BASE)
-#define VA_CMIC_BASE	IO_ADDRESS(INTEGRATOR_HDR_BASE) + INTEGRATOR_HDR_IC_OFFSET
+#define VA_CMIC_BASE	IO_ADDRESS(INTEGRATOR_HDR_IC)
 
 /*
  * Logical      Physical
arch/arm/mach-integrator/integrator_cp.c +5 -5
index 333c297..c0161df 100644
@@ -47,7 +47,7 @@
 
 #define INTCP_PA_CLCD_BASE		0xc0000000
 
-#define INTCP_VA_CIC_BASE		IO_ADDRESS(INTEGRATOR_HDR_BASE) + 0x40
+#define INTCP_VA_CIC_BASE		IO_ADDRESS(INTEGRATOR_HDR_BASE + 0x40)
 #define INTCP_VA_PIC_BASE		IO_ADDRESS(INTEGRATOR_IC_BASE)
 #define INTCP_VA_SIC_BASE		IO_ADDRESS(INTEGRATOR_CP_SIC_BASE)
 
@@ -265,8 +265,8 @@ static void __init intcp_init_irq(void)
 /*
  * Clock handling
  */
-#define CM_LOCK (IO_ADDRESS(INTEGRATOR_HDR_BASE)+INTEGRATOR_HDR_LOCK_OFFSET)
-#define CM_AUXOSC (IO_ADDRESS(INTEGRATOR_HDR_BASE)+0x1c)
+#define CM_LOCK IO_ADDRESS(INTEGRATOR_HDR_LOCK)
+#define CM_AUXOSC IO_ADDRESS(INTEGRATOR_HDR_BASE + 0x1c)
 
 static const struct icst525_params cp_auxvco_params = {
 	.ref		= 24000,
@@ -393,8 +393,8 @@ static struct platform_device *intcp_devs[] __initdata = {
  */
 static unsigned int mmc_status(struct device *dev)
 {
-	unsigned int status = readl(IO_ADDRESS(0xca000000) + 4);
-	writel(8, IO_ADDRESS(INTEGRATOR_CP_CTL_BASE) + 8);
+	unsigned int status = readl(IO_ADDRESS(0xca000000 + 4));
+	writel(8, IO_ADDRESS(INTEGRATOR_CP_CTL_BASE + 8));
 
 	return status & 8;
 }
arch/arm/mach-integrator/pci_v3.c +3 -3
index e87fe9f..e549162 100644
@@ -391,9 +391,9 @@ static int __init pci_v3_setup_resources(struct resource **resource)
  * means I can't get additional information on the reason for the pm2fb
  * problems.  I suppose I'll just have to mind-meld with the machine. ;)
  */
-#define SC_PCI     (IO_ADDRESS(INTEGRATOR_SC_BASE) + INTEGRATOR_SC_PCIENABLE_OFFSET)
-#define SC_LBFADDR (IO_ADDRESS(INTEGRATOR_SC_BASE) + 0x20)
-#define SC_LBFCODE (IO_ADDRESS(INTEGRATOR_SC_BASE) + 0x24)
+#define SC_PCI     IO_ADDRESS(INTEGRATOR_SC_PCIENABLE)
+#define SC_LBFADDR IO_ADDRESS(INTEGRATOR_SC_BASE + 0x20)
+#define SC_LBFCODE IO_ADDRESS(INTEGRATOR_SC_BASE + 0x24)
 
 static int
 v3_pci_fault(unsigned long addr, unsigned int fsr, struct pt_regs *regs)
#10 lore raw

PATCH 1/1 ARM: ICST: merge common ICST VCO structures

The structures for the ICST307 and ICST525 VCO devices are identical, so merge them together.

---
 arch/arm/common/icst307.c                      |   14 +++++-----
 arch/arm/common/icst525.c                      |   14 +++++-----
 arch/arm/include/asm/hardware/icst.h           |   32 ++++++++++++++++++++++++
 arch/arm/include/asm/hardware/icst307.h        |   21 +++------------
 arch/arm/include/asm/hardware/icst525.h        |   21 +++------------
 arch/arm/mach-integrator/clock.c               |    5 ++-
 arch/arm/mach-integrator/cpu.c                 |   10 +++---
 arch/arm/mach-integrator/impd1.c               |    4 +-
 arch/arm/mach-integrator/include/mach/clkdev.h |    6 ++--
 arch/arm/mach-integrator/integrator_cp.c       |    4 +-
 arch/arm/mach-realview/clock.c                 |    4 +-
 arch/arm/mach-realview/clock.h                 |    7 +++--
 arch/arm/mach-realview/core.c                  |    4 +-
 arch/arm/mach-versatile/clock.c                |    4 +-
 arch/arm/mach-versatile/clock.h                |    7 +++--
 arch/arm/mach-versatile/core.c                 |    4 +-
 16 files changed, 85 insertions(+), 76 deletions(-)
 create mode 100644 arch/arm/include/asm/hardware/icst.h
arch/arm/common/icst307.c +7 -7
index 6d094c1..2eebd96 100644
@@ -24,7 +24,7 @@
  */
 static unsigned char s2div[8] = { 10, 2, 8, 4, 5, 7, 3, 6 };
 
-unsigned long icst307_khz(const struct icst307_params *p, struct icst307_vco vco)
+unsigned long icst307_khz(const struct icst_params *p, struct icst_vco vco)
 {
 	return p->ref * 2 * (vco.v + 8) / ((vco.r + 2) * s2div[vco.s]);
 }
@@ -36,10 +36,10 @@ EXPORT_SYMBOL(icst307_khz);
  */
 static unsigned char idx2s[8] = { 1, 6, 3, 4, 7, 5, 2, 0 };
 
-struct icst307_vco
-icst307_khz_to_vco(const struct icst307_params *p, unsigned long freq)
+struct icst_vco
+icst307_khz_to_vco(const struct icst_params *p, unsigned long freq)
 {
-	struct icst307_vco vco = { .s = 1, .v = p->vd_max, .r = p->rd_max };
+	struct icst_vco vco = { .s = 1, .v = p->vd_max, .r = p->rd_max };
 	unsigned long f;
 	unsigned int i = 0, rd, best = (unsigned int)-1;
 
@@ -96,10 +96,10 @@ icst307_khz_to_vco(const struct icst307_params *p, unsigned long freq)
 
 EXPORT_SYMBOL(icst307_khz_to_vco);
 
-struct icst307_vco
-icst307_ps_to_vco(const struct icst307_params *p, unsigned long period)
+struct icst_vco
+icst307_ps_to_vco(const struct icst_params *p, unsigned long period)
 {
-	struct icst307_vco vco = { .s = 1, .v = p->vd_max, .r = p->rd_max };
+	struct icst_vco vco = { .s = 1, .v = p->vd_max, .r = p->rd_max };
 	unsigned long f, ps;
 	unsigned int i = 0, rd, best = (unsigned int)-1;
 
arch/arm/common/icst525.c +7 -7
index 3d377c5..fd5c2e7 100644
@@ -21,7 +21,7 @@
  */
 static unsigned char s2div[8] = { 10, 2, 8, 4, 5, 7, 9, 6 };
 
-unsigned long icst525_khz(const struct icst525_params *p, struct icst525_vco vco)
+unsigned long icst525_khz(const struct icst_params *p, struct icst_vco vco)
 {
 	return p->ref * 2 * (vco.v + 8) / ((vco.r + 2) * s2div[vco.s]);
 }
@@ -33,10 +33,10 @@ EXPORT_SYMBOL(icst525_khz);
  */
 static unsigned char idx2s[] = { 1, 3, 4, 7, 5, 2, 6, 0 };
 
-struct icst525_vco
-icst525_khz_to_vco(const struct icst525_params *p, unsigned long freq)
+struct icst_vco
+icst525_khz_to_vco(const struct icst_params *p, unsigned long freq)
 {
-	struct icst525_vco vco = { .s = 1, .v = p->vd_max, .r = p->rd_max };
+	struct icst_vco vco = { .s = 1, .v = p->vd_max, .r = p->rd_max };
 	unsigned long f;
 	unsigned int i = 0, rd, best = (unsigned int)-1;
 
@@ -94,10 +94,10 @@ icst525_khz_to_vco(const struct icst525_params *p, unsigned long freq)
 
 EXPORT_SYMBOL(icst525_khz_to_vco);
 
-struct icst525_vco
-icst525_ps_to_vco(const struct icst525_params *p, unsigned long period)
+struct icst_vco
+icst525_ps_to_vco(const struct icst_params *p, unsigned long period)
 {
-	struct icst525_vco vco = { .s = 1, .v = p->vd_max, .r = p->rd_max };
+	struct icst_vco vco = { .s = 1, .v = p->vd_max, .r = p->rd_max };
 	unsigned long f, ps;
 	unsigned int i = 0, rd, best = (unsigned int)-1;
 
arch/arm/include/asm/hardware/icst.h new file +32 -0
new file mode 100644
index 0000000..65b1edd
@@ -0,0 +1,32 @@
+/*
+ *  arch/arm/include/asm/hardware/icst.h
+ *
+ *  Copyright (C) 2003 Deep Blue Solutions, Ltd, All Rights Reserved.
+ *
+ * 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.
+ *
+ *  Support functions for calculating clocks/divisors for the ICST
+ *  clock generators.  See http://www.icst.com/ for more information
+ *  on these devices.
+ */
+#ifndef ASMARM_HARDWARE_ICST_H
+#define ASMARM_HARDWARE_ICST_H
+
+struct icst_params {
+	unsigned long	ref;
+	unsigned long	vco_max;	/* inclusive */
+	unsigned short	vd_min;		/* inclusive */
+	unsigned short	vd_max;		/* inclusive */
+	unsigned char	rd_min;		/* inclusive */
+	unsigned char	rd_max;		/* inclusive */
+};
+
+struct icst_vco {
+	unsigned short	v;
+	unsigned char	r;
+	unsigned char	s;
+};
+
+#endif
arch/arm/include/asm/hardware/icst307.h +4 -17
index 554f128..85932e9 100644
@@ -16,23 +16,10 @@
 #ifndef ASMARM_HARDWARE_ICST307_H
 #define ASMARM_HARDWARE_ICST307_H
 
-struct icst307_params {
-	unsigned long	ref;
-	unsigned long	vco_max;	/* inclusive */
-	unsigned short	vd_min;		/* inclusive */
-	unsigned short	vd_max;		/* inclusive */
-	unsigned char	rd_min;		/* inclusive */
-	unsigned char	rd_max;		/* inclusive */
-};
+#include <asm/hardware/icst.h>
 
-struct icst307_vco {
-	unsigned short	v;
-	unsigned char	r;
-	unsigned char	s;
-};
-
-unsigned long icst307_khz(const struct icst307_params *p, struct icst307_vco vco);
-struct icst307_vco icst307_khz_to_vco(const struct icst307_params *p, unsigned long freq);
-struct icst307_vco icst307_ps_to_vco(const struct icst307_params *p, unsigned long period);
+unsigned long icst307_khz(const struct icst_params *p, struct icst_vco vco);
+struct icst_vco icst307_khz_to_vco(const struct icst_params *p, unsigned long freq);
+struct icst_vco icst307_ps_to_vco(const struct icst_params *p, unsigned long period);
 
 #endif
arch/arm/include/asm/hardware/icst525.h +4 -17
index 58f0dc4..170deb2 100644
@@ -14,23 +14,10 @@
 #ifndef ASMARM_HARDWARE_ICST525_H
 #define ASMARM_HARDWARE_ICST525_H
 
-struct icst525_params {
-	unsigned long	ref;
-	unsigned long	vco_max;	/* inclusive */
-	unsigned short	vd_min;		/* inclusive */
-	unsigned short	vd_max;		/* inclusive */
-	unsigned char	rd_min;		/* inclusive */
-	unsigned char	rd_max;		/* inclusive */
-};
+#include <asm/hardware/icst.h>
 
-struct icst525_vco {
-	unsigned short	v;
-	unsigned char	r;
-	unsigned char	s;
-};
-
-unsigned long icst525_khz(const struct icst525_params *p, struct icst525_vco vco);
-struct icst525_vco icst525_khz_to_vco(const struct icst525_params *p, unsigned long freq);
-struct icst525_vco icst525_ps_to_vco(const struct icst525_params *p, unsigned long period);
+unsigned long icst525_khz(const struct icst_params *p, struct icst_vco vco);
+struct icst_vco icst525_khz_to_vco(const struct icst_params *p, unsigned long freq);
+struct icst_vco icst525_ps_to_vco(const struct icst_params *p, unsigned long period);
 
 #endif
arch/arm/mach-integrator/clock.c +3 -2
index 989ecf5..bb70b64 100644
@@ -14,6 +14,7 @@
 #include <linux/clk.h>
 #include <linux/mutex.h>
 
+#include <asm/hardware/icst525.h>
 #include <asm/clkdev.h>
 #include <mach/clkdev.h>
 
@@ -36,7 +37,7 @@ EXPORT_SYMBOL(clk_get_rate);
 
 long clk_round_rate(struct clk *clk, unsigned long rate)
 {
-	struct icst525_vco vco;
+	struct icst_vco vco;
 	vco = icst525_khz_to_vco(clk->params, rate / 1000);
 	return icst525_khz(clk->params, vco) * 1000;
 }
@@ -47,7 +48,7 @@ int clk_set_rate(struct clk *clk, unsigned long rate)
 	int ret = -EIO;
 
 	if (clk->setvco) {
-		struct icst525_vco vco;
+		struct icst_vco vco;
 
 		vco = icst525_khz_to_vco(clk->params, rate / 1000);
 		clk->rate = icst525_khz(clk->params, vco) * 1000;
arch/arm/mach-integrator/cpu.c +5 -5
index 7f1b73b..c4e5deb 100644
@@ -31,7 +31,7 @@ static struct cpufreq_driver integrator_driver;
 #define CM_STAT IO_ADDRESS(INTEGRATOR_HDR_STAT)
 #define CM_LOCK IO_ADDRESS(INTEGRATOR_HDR_LOCK)
 
-static const struct icst525_params lclk_params = {
+static const struct icst_params lclk_params = {
 	.ref		= 24000,
 	.vco_max	= 320000,
 	.vd_min		= 8,
@@ -40,7 +40,7 @@ static const struct icst525_params lclk_params = {
 	.rd_max		= 24,
 };
 
-static const struct icst525_params cclk_params = {
+static const struct icst_params cclk_params = {
 	.ref		= 24000,
 	.vco_max	= 320000,
 	.vd_min		= 12,
@@ -54,7 +54,7 @@ static const struct icst525_params cclk_params = {
  */
 static int integrator_verify_policy(struct cpufreq_policy *policy)
 {
-	struct icst525_vco vco;
+	struct icst_vco vco;
 
 	cpufreq_verify_within_limits(policy, 
 				     policy->cpuinfo.min_freq, 
@@ -80,7 +80,7 @@ static int integrator_set_target(struct cpufreq_policy *policy,
 {
 	cpumask_t cpus_allowed;
 	int cpu = policy->cpu;
-	struct icst525_vco vco;
+	struct icst_vco vco;
 	struct cpufreq_freqs freqs;
 	u_int cm_osc;
 
@@ -156,7 +156,7 @@ static unsigned int integrator_get(unsigned int cpu)
 	cpumask_t cpus_allowed;
 	unsigned int current_freq;
 	u_int cm_osc;
-	struct icst525_vco vco;
+	struct icst_vco vco;
 
 	cpus_allowed = current->cpus_allowed;
 
arch/arm/mach-integrator/impd1.c +2 -2
index 0058c93..dfb961b 100644
@@ -40,7 +40,7 @@ struct impd1_module {
 	struct clk_lookup *clks[3];
 };
 
-static const struct icst525_params impd1_vco_params = {
+static const struct icst_params impd1_vco_params = {
 	.ref		= 24000,	/* 24 MHz */
 	.vco_max	= 200000,	/* 200 MHz */
 	.vd_min		= 12,
@@ -49,7 +49,7 @@ static const struct icst525_params impd1_vco_params = {
 	.rd_max		= 120,
 };
 
-static void impd1_setvco(struct clk *clk, struct icst525_vco vco)
+static void impd1_setvco(struct clk *clk, struct icst_vco vco)
 {
 	struct impd1_module *impd1 = clk->data;
 	int vconr = clk - impd1->vcos;
arch/arm/mach-integrator/include/mach/clkdev.h +3 -3
index 9293e41..89ea938 100644
@@ -2,14 +2,14 @@
 #define __ASM_MACH_CLKDEV_H
 
 #include <linux/module.h>
-#include <asm/hardware/icst525.h>
+#include <asm/hardware/icst.h>
 
 struct clk {
 	unsigned long		rate;
 	struct module		*owner;
-	const struct icst525_params *params;
+	const struct icst_params *params;
 	void			*data;
-	void			(*setvco)(struct clk *, struct icst525_vco vco);
+	void			(*setvco)(struct clk *, struct icst_vco vco);
 };
 
 static inline int __clk_get(struct clk *clk)
arch/arm/mach-integrator/integrator_cp.c +2 -2
index c0161df..15bfbe2 100644
@@ -268,7 +268,7 @@ static void __init intcp_init_irq(void)
 #define CM_LOCK IO_ADDRESS(INTEGRATOR_HDR_LOCK)
 #define CM_AUXOSC IO_ADDRESS(INTEGRATOR_HDR_BASE + 0x1c)
 
-static const struct icst525_params cp_auxvco_params = {
+static const struct icst_params cp_auxvco_params = {
 	.ref		= 24000,
 	.vco_max	= 320000,
 	.vd_min 	= 8,
@@ -277,7 +277,7 @@ static const struct icst525_params cp_auxvco_params = {
 	.rd_max 	= 65,
 };
 
-static void cp_auxvco_set(struct clk *clk, struct icst525_vco vco)
+static void cp_auxvco_set(struct clk *clk, struct icst_vco vco)
 {
 	u32 val;
 
arch/arm/mach-realview/clock.c +2 -2
index a704311..8364657 100644
@@ -41,7 +41,7 @@ EXPORT_SYMBOL(clk_get_rate);
 
 long clk_round_rate(struct clk *clk, unsigned long rate)
 {
-	struct icst307_vco vco;
+	struct icst_vco vco;
 	vco = icst307_khz_to_vco(clk->params, rate / 1000);
 	return icst307_khz(clk->params, vco) * 1000;
 }
@@ -52,7 +52,7 @@ int clk_set_rate(struct clk *clk, unsigned long rate)
 	int ret = -EIO;
 
 	if (clk->setvco) {
-		struct icst307_vco vco;
+		struct icst_vco vco;
 
 		vco = icst307_khz_to_vco(clk->params, rate / 1000);
 		clk->rate = icst307_khz(clk->params, vco) * 1000;
arch/arm/mach-realview/clock.h +4 -3
index ebbb0f0..fa64c85 100644
@@ -8,12 +8,13 @@
  * it under the terms of the GNU General Public License version 2 as
  * published by the Free Software Foundation.
  */
+#include <asm/hardware/icst.h>
+
 struct module;
-struct icst307_params;
 
 struct clk {
 	unsigned long		rate;
-	const struct icst307_params *params;
+	const struct icst_params *params;
 	void			*data;
-	void			(*setvco)(struct clk *, struct icst307_vco vco);
+	void			(*setvco)(struct clk *, struct icst_vco vco);
 };
arch/arm/mach-realview/core.c +2 -2
index 90bd4ef..ac50474 100644
@@ -273,7 +273,7 @@ struct mmci_platform_data realview_mmc1_plat_data = {
 /*
  * Clock handling
  */
-static const struct icst307_params realview_oscvco_params = {
+static const struct icst_params realview_oscvco_params = {
 	.ref		= 24000,
 	.vco_max	= 200000,
 	.vd_min		= 4 + 8,
@@ -282,7 +282,7 @@ static const struct icst307_params realview_oscvco_params = {
 	.rd_max		= 127 + 2,
 };
 
-static void realview_oscvco_set(struct clk *clk, struct icst307_vco vco)
+static void realview_oscvco_set(struct clk *clk, struct icst_vco vco)
 {
 	void __iomem *sys_lock = __io_address(REALVIEW_SYS_BASE) + REALVIEW_SYS_LOCK_OFFSET;
 	void __iomem *sys_osc;
arch/arm/mach-versatile/clock.c +2 -2
index c50a44e..530e16a 100644
@@ -42,7 +42,7 @@ EXPORT_SYMBOL(clk_get_rate);
 
 long clk_round_rate(struct clk *clk, unsigned long rate)
 {
-	struct icst307_vco vco;
+	struct icst_vco vco;
 	vco = icst307_khz_to_vco(clk->params, rate / 1000);
 	return icst307_khz(clk->params, vco) * 1000;
 }
@@ -53,7 +53,7 @@ int clk_set_rate(struct clk *clk, unsigned long rate)
 	int ret = -EIO;
 
 	if (clk->setvco) {
-		struct icst307_vco vco;
+		struct icst_vco vco;
 
 		vco = icst307_khz_to_vco(clk->params, rate / 1000);
 		clk->rate = icst307_khz(clk->params, vco) * 1000;
arch/arm/mach-versatile/clock.h +4 -3
index 03468fd..aed7e22 100644
@@ -8,13 +8,14 @@
  * it under the terms of the GNU General Public License version 2 as
  * published by the Free Software Foundation.
  */
+#include <asm/hardware/icst.h>
+
 struct module;
-struct icst307_params;
 
 struct clk {
 	unsigned long		rate;
-	const struct icst307_params *params;
+	const struct icst_params *params;
 	u32			oscoff;
 	void			*data;
-	void			(*setvco)(struct clk *, struct icst307_vco vco);
+	void			(*setvco)(struct clk *, struct icst_vco vco);
 };
arch/arm/mach-versatile/core.c +2 -2
index b77bc40..ded7134 100644
@@ -379,7 +379,7 @@ static struct mmci_platform_data mmc0_plat_data = {
 /*
  * Clock handling
  */
-static const struct icst307_params versatile_oscvco_params = {
+static const struct icst_params versatile_oscvco_params = {
 	.ref		= 24000,
 	.vco_max	= 200000,
 	.vd_min		= 4 + 8,
@@ -388,7 +388,7 @@ static const struct icst307_params versatile_oscvco_params = {
 	.rd_max		= 127 + 2,
 };
 
-static void versatile_oscvco_set(struct clk *clk, struct icst307_vco vco)
+static void versatile_oscvco_set(struct clk *clk, struct icst_vco vco)
 {
 	void __iomem *sys = __io_address(VERSATILE_SYS_BASE);
 	void __iomem *sys_lock = sys + VERSATILE_SYS_LOCK_OFFSET;
#11 lore raw

PATCH 1/1 ARM: ICST: icst.*_ps_to_vco() functions are unused, remove them

These functions were originally implemented for the CLCD driver before we had clk API support. Since the CLCD driver does not use these anymore, we can remove them.

---
 arch/arm/common/icst307.c               |   64 ------------------------------
 arch/arm/common/icst525.c               |   65 -------------------------------
 arch/arm/include/asm/hardware/icst307.h |    1 -
 arch/arm/include/asm/hardware/icst525.h |    1 -
 4 files changed, 0 insertions(+), 131 deletions(-)
arch/arm/common/icst307.c +0 -64
index 2eebd96..f78f5b5 100644
@@ -95,67 +95,3 @@ icst307_khz_to_vco(const struct icst_params *p, unsigned long freq)
 }
 
 EXPORT_SYMBOL(icst307_khz_to_vco);
-
-struct icst_vco
-icst307_ps_to_vco(const struct icst_params *p, unsigned long period)
-{
-	struct icst_vco vco = { .s = 1, .v = p->vd_max, .r = p->rd_max };
-	unsigned long f, ps;
-	unsigned int i = 0, rd, best = (unsigned int)-1;
-
-	ps = 1000000000UL / p->vco_max;
-
-	/*
-	 * First, find the PLL output divisor such
-	 * that the PLL output is within spec.
-	 */
-	do {
-		f = period / s2div[idx2s[i]];
-
-		/*
-		 * f must be between 6MHz and 200MHz (3.3 or 5V)
-		 */
-		if (f >= ps && f < 1000000000UL / 6000 + 1)
-			break;
-	} while (i < ARRAY_SIZE(idx2s));
-
-	if (i >= ARRAY_SIZE(idx2s))
-		return vco;
-
-	vco.s = idx2s[i];
-
-	ps = 500000000UL / p->ref;
-
-	/*
-	 * Now find the closest divisor combination
-	 * which gives a PLL output of 'f'.
-	 */
-	for (rd = p->rd_min; rd <= p->rd_max; rd++) {
-		unsigned long f_in_div, f_pll;
-		unsigned int vd;
-		int f_diff;
-
-		f_in_div = ps * rd;
-
-		vd = (f_in_div + f / 2) / f;
-		if (vd < p->vd_min || vd > p->vd_max)
-			continue;
-
-		f_pll = (f_in_div + vd / 2) / vd;
-		f_diff = f_pll - f;
-		if (f_diff < 0)
-			f_diff = -f_diff;
-
-		if ((unsigned)f_diff < best) {
-			vco.v = vd - 8;
-			vco.r = rd - 2;
-			if (f_diff == 0)
-				break;
-			best = f_diff;
-		}
-	}
-
-	return vco;
-}
-
-EXPORT_SYMBOL(icst307_ps_to_vco);
arch/arm/common/icst525.c +0 -65

68 lines not on this page · raw message

arch/arm/include/asm/hardware/icst307.h +0 -1
index 85932e9..8d0820a 100644
@@ -20,6 +20,5 @@
 
 unsigned long icst307_khz(const struct icst_params *p, struct icst_vco vco);
 struct icst_vco icst307_khz_to_vco(const struct icst_params *p, unsigned long freq);
-struct icst_vco icst307_ps_to_vco(const struct icst_params *p, unsigned long period);
 
 #endif
arch/arm/include/asm/hardware/icst525.h +0 -1
index 170deb2..42a274e 100644
@@ -18,6 +18,5 @@
 
 unsigned long icst525_khz(const struct icst_params *p, struct icst_vco vco);
 struct icst_vco icst525_khz_to_vco(const struct icst_params *p, unsigned long freq);
-struct icst_vco icst525_ps_to_vco(const struct icst_params *p, unsigned long period);
 
 #endif
#12 lore raw

PATCH 1/1 ARM: ICST: provide definitions for max/min VCO frequencies

---
 arch/arm/common/icst307.c                |    2 +-
 arch/arm/common/icst525.c                |    2 +-
 arch/arm/include/asm/hardware/icst307.h  |    7 +++++++
 arch/arm/include/asm/hardware/icst525.h  |    8 ++++++++
 arch/arm/mach-integrator/cpu.c           |    4 ++--
 arch/arm/mach-integrator/impd1.c         |    2 +-
 arch/arm/mach-integrator/integrator_cp.c |    2 +-
 arch/arm/mach-realview/core.c            |    2 +-
 arch/arm/mach-versatile/core.c           |    2 +-
 9 files changed, 23 insertions(+), 8 deletions(-)
arch/arm/common/icst307.c +1 -1
index f78f5b5..f6063c9 100644
@@ -53,7 +53,7 @@ icst307_khz_to_vco(const struct icst_params *p, unsigned long freq)
 		/*
 		 * f must be between 6MHz and 200MHz (3.3 or 5V)
 		 */
-		if (f > 6000 && f <= p->vco_max)
+		if (f > ICST307_VCO_MIN && f <= p->vco_max)
 			break;
 	} while (i < ARRAY_SIZE(idx2s));
 
arch/arm/common/icst525.c +1 -1
index eadf983..34dc2e1 100644
@@ -51,7 +51,7 @@ icst525_khz_to_vco(const struct icst_params *p, unsigned long freq)
 		 * f must be between 10MHz and
 		 *  320MHz (5V) or 200MHz (3V)
 		 */
-		if (f > 10000 && f <= p->vco_max)
+		if (f > ICST525_VCO_MIN && f <= p->vco_max)
 			break;
 	} while (i < ARRAY_SIZE(idx2s));
 
arch/arm/include/asm/hardware/icst307.h +7 -0
index 8d0820a..0c4e37e 100644
@@ -21,4 +21,11 @@
 unsigned long icst307_khz(const struct icst_params *p, struct icst_vco vco);
 struct icst_vco icst307_khz_to_vco(const struct icst_params *p, unsigned long freq);
 
+/*
+ * ICST307 VCO frequency must be between 6MHz and 200MHz (3.3 or 5V).
+ * This frequency is pre-output divider.
+ */
+#define ICST307_VCO_MIN	6000
+#define ICST307_VCO_MAX	200000
+
 #endif
arch/arm/include/asm/hardware/icst525.h +8 -0
index 42a274e..3b72c13 100644
@@ -19,4 +19,12 @@
 unsigned long icst525_khz(const struct icst_params *p, struct icst_vco vco);
 struct icst_vco icst525_khz_to_vco(const struct icst_params *p, unsigned long freq);
 
+/*
+ * ICST525 VCO frequency must be between 10MHz and 200MHz (3V) or 320MHz (5V).
+ * This frequency is pre-output divider.
+ */
+#define ICST525_VCO_MIN		10000
+#define ICST525_VCO_MAX_3V	200000
+#define ICST525_VCO_MAX_5V	320000
+
 #endif
arch/arm/mach-integrator/cpu.c +2 -2
index c4e5deb..1671b4a 100644
@@ -33,7 +33,7 @@ static struct cpufreq_driver integrator_driver;
 
 static const struct icst_params lclk_params = {
 	.ref		= 24000,
-	.vco_max	= 320000,
+	.vco_max	= ICST525_VCO_MAX_5V,
 	.vd_min		= 8,
 	.vd_max		= 132,
 	.rd_min		= 24,
@@ -42,7 +42,7 @@ static const struct icst_params lclk_params = {
 
 static const struct icst_params cclk_params = {
 	.ref		= 24000,
-	.vco_max	= 320000,
+	.vco_max	= ICST525_VCO_MAX_5V,
 	.vd_min		= 12,
 	.vd_max		= 160,
 	.rd_min		= 24,
arch/arm/mach-integrator/impd1.c +1 -1
index dfb961b..5aca7eb 100644
@@ -42,7 +42,7 @@ struct impd1_module {
 
 static const struct icst_params impd1_vco_params = {
 	.ref		= 24000,	/* 24 MHz */
-	.vco_max	= 200000,	/* 200 MHz */
+	.vco_max	= ICST525_VCO_MAX_3V,
 	.vd_min		= 12,
 	.vd_max		= 519,
 	.rd_min		= 3,
arch/arm/mach-integrator/integrator_cp.c +1 -1
index 15bfbe2..27f9510 100644
@@ -270,7 +270,7 @@ static void __init intcp_init_irq(void)
 
 static const struct icst_params cp_auxvco_params = {
 	.ref		= 24000,
-	.vco_max	= 320000,
+	.vco_max	= ICST525_VCO_MAX_5V,
 	.vd_min 	= 8,
 	.vd_max 	= 263,
 	.rd_min 	= 3,
arch/arm/mach-realview/core.c +1 -1
index ac50474..5a850f0 100644
@@ -275,7 +275,7 @@ struct mmci_platform_data realview_mmc1_plat_data = {
  */
 static const struct icst_params realview_oscvco_params = {
 	.ref		= 24000,
-	.vco_max	= 200000,
+	.vco_max	= ICST307_VCO_MAX,
 	.vd_min		= 4 + 8,
 	.vd_max		= 511 + 8,
 	.rd_min		= 1 + 2,
arch/arm/mach-versatile/core.c +1 -1
index ded7134..f8ed561 100644
@@ -381,7 +381,7 @@ static struct mmci_platform_data mmc0_plat_data = {
  */
 static const struct icst_params versatile_oscvco_params = {
 	.ref		= 24000,
-	.vco_max	= 200000,
+	.vco_max	= ICST307_VCO_MAX,
 	.vd_min		= 4 + 8,
 	.vd_max		= 511 + 8,
 	.rd_min		= 1 + 2,
#13 lore raw

PATCH 1/1 ARM: ICST: use Hz instead of kHz

This makes the ICST support fit more nicely with the clk API, eliminating the need to *1000 and /1000 in places.

---
 arch/arm/common/icst307.c                |    8 ++++----
 arch/arm/common/icst525.c                |    8 ++++----
 arch/arm/include/asm/hardware/icst307.h  |    8 ++++----
 arch/arm/include/asm/hardware/icst525.h  |   10 +++++-----
 arch/arm/mach-integrator/clock.c         |    8 ++++----
 arch/arm/mach-integrator/cpu.c           |   22 +++++++++++-----------
 arch/arm/mach-integrator/impd1.c         |    6 +++---
 arch/arm/mach-integrator/integrator_cp.c |    2 +-
 arch/arm/mach-realview/clock.c           |    8 ++++----
 arch/arm/mach-realview/core.c            |    2 +-
 arch/arm/mach-versatile/clock.c          |    8 ++++----
 arch/arm/mach-versatile/core.c           |    2 +-
 12 files changed, 46 insertions(+), 46 deletions(-)
arch/arm/common/icst307.c +4 -4
index f6063c9..66c69e5 100644
@@ -24,12 +24,12 @@
  */
 static unsigned char s2div[8] = { 10, 2, 8, 4, 5, 7, 3, 6 };
 
-unsigned long icst307_khz(const struct icst_params *p, struct icst_vco vco)
+unsigned long icst307_hz(const struct icst_params *p, struct icst_vco vco)
 {
 	return p->ref * 2 * (vco.v + 8) / ((vco.r + 2) * s2div[vco.s]);
 }
 
-EXPORT_SYMBOL(icst307_khz);
+EXPORT_SYMBOL(icst307_hz);
 
 /*
  * Ascending divisor S values.
@@ -37,7 +37,7 @@ EXPORT_SYMBOL(icst307_khz);
 static unsigned char idx2s[8] = { 1, 6, 3, 4, 7, 5, 2, 0 };
 
 struct icst_vco
-icst307_khz_to_vco(const struct icst_params *p, unsigned long freq)
+icst307_hz_to_vco(const struct icst_params *p, unsigned long freq)
 {
 	struct icst_vco vco = { .s = 1, .v = p->vd_max, .r = p->rd_max };
 	unsigned long f;
@@ -94,4 +94,4 @@ icst307_khz_to_vco(const struct icst_params *p, unsigned long freq)
 	return vco;
 }
 
-EXPORT_SYMBOL(icst307_khz_to_vco);
+EXPORT_SYMBOL(icst307_hz_to_vco);
arch/arm/common/icst525.c +4 -4
index 34dc2e1..c1d22b7 100644
@@ -21,12 +21,12 @@
  */
 static unsigned char s2div[8] = { 10, 2, 8, 4, 5, 7, 9, 6 };
 
-unsigned long icst525_khz(const struct icst_params *p, struct icst_vco vco)
+unsigned long icst525_hz(const struct icst_params *p, struct icst_vco vco)
 {
 	return p->ref * 2 * (vco.v + 8) / ((vco.r + 2) * s2div[vco.s]);
 }
 
-EXPORT_SYMBOL(icst525_khz);
+EXPORT_SYMBOL(icst525_hz);
 
 /*
  * Ascending divisor S values.
@@ -34,7 +34,7 @@ EXPORT_SYMBOL(icst525_khz);
 static unsigned char idx2s[] = { 1, 3, 4, 7, 5, 2, 6, 0 };
 
 struct icst_vco
-icst525_khz_to_vco(const struct icst_params *p, unsigned long freq)
+icst525_hz_to_vco(const struct icst_params *p, unsigned long freq)
 {
 	struct icst_vco vco = { .s = 1, .v = p->vd_max, .r = p->rd_max };
 	unsigned long f;
@@ -92,4 +92,4 @@ icst525_khz_to_vco(const struct icst_params *p, unsigned long freq)
 	return vco;
 }
 
-EXPORT_SYMBOL(icst525_khz_to_vco);
+EXPORT_SYMBOL(icst525_hz_to_vco);
arch/arm/include/asm/hardware/icst307.h +4 -4
index 0c4e37e..0f09618 100644
@@ -18,14 +18,14 @@
 
 #include <asm/hardware/icst.h>
 
-unsigned long icst307_khz(const struct icst_params *p, struct icst_vco vco);
-struct icst_vco icst307_khz_to_vco(const struct icst_params *p, unsigned long freq);
+unsigned long icst307_hz(const struct icst_params *p, struct icst_vco vco);
+struct icst_vco icst307_hz_to_vco(const struct icst_params *p, unsigned long freq);
 
 /*
  * ICST307 VCO frequency must be between 6MHz and 200MHz (3.3 or 5V).
  * This frequency is pre-output divider.
  */
-#define ICST307_VCO_MIN	6000
-#define ICST307_VCO_MAX	200000
+#define ICST307_VCO_MIN	6000000
+#define ICST307_VCO_MAX	200000000
 
 #endif
arch/arm/include/asm/hardware/icst525.h +5 -5
index 3b72c13..1000a60 100644
@@ -16,15 +16,15 @@
 
 #include <asm/hardware/icst.h>
 
-unsigned long icst525_khz(const struct icst_params *p, struct icst_vco vco);
-struct icst_vco icst525_khz_to_vco(const struct icst_params *p, unsigned long freq);
+unsigned long icst525_hz(const struct icst_params *p, struct icst_vco vco);
+struct icst_vco icst525_hz_to_vco(const struct icst_params *p, unsigned long freq);
 
 /*
  * ICST525 VCO frequency must be between 10MHz and 200MHz (3V) or 320MHz (5V).
  * This frequency is pre-output divider.
  */
-#define ICST525_VCO_MIN		10000
-#define ICST525_VCO_MAX_3V	200000
-#define ICST525_VCO_MAX_5V	320000
+#define ICST525_VCO_MIN		10000000
+#define ICST525_VCO_MAX_3V	200000000
+#define ICST525_VCO_MAX_5V	320000000
 
 #endif
arch/arm/mach-integrator/clock.c +4 -4
index bb70b64..a4f80d3 100644
@@ -38,8 +38,8 @@ EXPORT_SYMBOL(clk_get_rate);
 long clk_round_rate(struct clk *clk, unsigned long rate)
 {
 	struct icst_vco vco;
-	vco = icst525_khz_to_vco(clk->params, rate / 1000);
-	return icst525_khz(clk->params, vco) * 1000;
+	vco = icst525_hz_to_vco(clk->params, rate);
+	return icst525_hz(clk->params, vco);
 }
 EXPORT_SYMBOL(clk_round_rate);
 
@@ -50,8 +50,8 @@ int clk_set_rate(struct clk *clk, unsigned long rate)
 	if (clk->setvco) {
 		struct icst_vco vco;
 
-		vco = icst525_khz_to_vco(clk->params, rate / 1000);
-		clk->rate = icst525_khz(clk->params, vco) * 1000;
+		vco = icst525_hz_to_vco(clk->params, rate);
+		clk->rate = icst525_hz(clk->params, vco);
 		clk->setvco(clk, vco);
 		ret = 0;
 	}
arch/arm/mach-integrator/cpu.c +11 -11
index 1671b4a..3ebb785 100644
@@ -32,7 +32,7 @@ static struct cpufreq_driver integrator_driver;
 #define CM_LOCK IO_ADDRESS(INTEGRATOR_HDR_LOCK)
 
 static const struct icst_params lclk_params = {
-	.ref		= 24000,
+	.ref		= 24000000,
 	.vco_max	= ICST525_VCO_MAX_5V,
 	.vd_min		= 8,
 	.vd_max		= 132,
@@ -41,7 +41,7 @@ static const struct icst_params lclk_params = {
 };
 
 static const struct icst_params cclk_params = {
-	.ref		= 24000,
+	.ref		= 24000000,
 	.vco_max	= ICST525_VCO_MAX_5V,
 	.vd_min		= 12,
 	.vd_max		= 160,
@@ -60,11 +60,11 @@ static int integrator_verify_policy(struct cpufreq_policy *policy)
 				     policy->cpuinfo.min_freq, 
 				     policy->cpuinfo.max_freq);
 
-	vco = icst525_khz_to_vco(&cclk_params, policy->max);
-	policy->max = icst525_khz(&cclk_params, vco);
+	vco = icst525_hz_to_vco(&cclk_params, policy->max * 1000);
+	policy->max = icst525_hz(&cclk_params, vco) / 1000;
 
-	vco = icst525_khz_to_vco(&cclk_params, policy->min);
-	policy->min = icst525_khz(&cclk_params, vco);
+	vco = icst525_hz_to_vco(&cclk_params, policy->min * 1000);
+	policy->min = icst525_hz(&cclk_params, vco) / 1000;
 
 	cpufreq_verify_within_limits(policy, 
 				     policy->cpuinfo.min_freq, 
@@ -106,17 +106,17 @@ static int integrator_set_target(struct cpufreq_policy *policy,
 	}
 	vco.v = cm_osc & 255;
 	vco.r = 22;
-	freqs.old = icst525_khz(&cclk_params, vco);
+	freqs.old = icst525_hz(&cclk_params, vco) / 1000;
 
-	/* icst525_khz_to_vco rounds down -- so we need the next
+	/* icst525_hz_to_vco rounds down -- so we need the next
 	 * larger freq in case of CPUFREQ_RELATION_L.
 	 */
 	if (relation == CPUFREQ_RELATION_L)
 		target_freq += 999;
 	if (target_freq > policy->max)
 		target_freq = policy->max;
-	vco = icst525_khz_to_vco(&cclk_params, target_freq);
-	freqs.new = icst525_khz(&cclk_params, vco);
+	vco = icst525_hz_to_vco(&cclk_params, target_freq * 1000);
+	freqs.new = icst525_hz(&cclk_params, vco) / 1000;
 
 	freqs.cpu = policy->cpu;
 
@@ -174,7 +174,7 @@ static unsigned int integrator_get(unsigned int cpu)
 	vco.v = cm_osc & 255;
 	vco.r = 22;
 
-	current_freq = icst525_khz(&cclk_params, vco); /* current freq */
+	current_freq = icst525_hz(&cclk_params, vco) / 1000; /* current freq */
 
 	set_cpus_allowed(current, cpus_allowed);
 
arch/arm/mach-integrator/impd1.c +3 -3
index 5aca7eb..ecce3eb 100644
@@ -41,7 +41,7 @@ struct impd1_module {
 };
 
 static const struct icst_params impd1_vco_params = {
-	.ref		= 24000,	/* 24 MHz */
+	.ref		= 24000000,	/* 24 MHz */
 	.vco_max	= ICST525_VCO_MAX_3V,
 	.vd_min		= 12,
 	.vd_max		= 519,
@@ -73,8 +73,8 @@ static void impd1_setvco(struct clk *clk, struct icst_vco vco)
 	vco.r = (val >> 9) & 0x7f;
 	vco.s = (val >> 16) & 7;
 
-	pr_debug("IM-PD1: VCO%d clock is %ld kHz\n",
-		 vconr, icst525_khz(&impd1_vco_params, vco));
+	pr_debug("IM-PD1: VCO%d clock is %ld Hz\n",
+		 vconr, icst525_hz(&impd1_vco_params, vco));
 #endif
 }
 
arch/arm/mach-integrator/integrator_cp.c +1 -1
index 27f9510..335af99 100644
@@ -269,7 +269,7 @@ static void __init intcp_init_irq(void)
 #define CM_AUXOSC IO_ADDRESS(INTEGRATOR_HDR_BASE + 0x1c)
 
 static const struct icst_params cp_auxvco_params = {
-	.ref		= 24000,
+	.ref		= 24000000,
 	.vco_max	= ICST525_VCO_MAX_5V,
 	.vd_min 	= 8,
 	.vd_max 	= 263,
arch/arm/mach-realview/clock.c +4 -4
index 8364657..2ba0667 100644
@@ -42,8 +42,8 @@ EXPORT_SYMBOL(clk_get_rate);
 long clk_round_rate(struct clk *clk, unsigned long rate)
 {
 	struct icst_vco vco;
-	vco = icst307_khz_to_vco(clk->params, rate / 1000);
-	return icst307_khz(clk->params, vco) * 1000;
+	vco = icst307_hz_to_vco(clk->params, rate);
+	return icst307_hz(clk->params, vco);
 }
 EXPORT_SYMBOL(clk_round_rate);
 
@@ -54,8 +54,8 @@ int clk_set_rate(struct clk *clk, unsigned long rate)
 	if (clk->setvco) {
 		struct icst_vco vco;
 
-		vco = icst307_khz_to_vco(clk->params, rate / 1000);
-		clk->rate = icst307_khz(clk->params, vco) * 1000;
+		vco = icst307_hz_to_vco(clk->params, rate);
+		clk->rate = icst307_hz(clk->params, vco);
 		clk->setvco(clk, vco);
 		ret = 0;
 	}
arch/arm/mach-realview/core.c +1 -1
index 5a850f0..02d4837 100644
@@ -274,7 +274,7 @@ struct mmci_platform_data realview_mmc1_plat_data = {
  * Clock handling
  */
 static const struct icst_params realview_oscvco_params = {
-	.ref		= 24000,
+	.ref		= 24000000,
 	.vco_max	= ICST307_VCO_MAX,
 	.vd_min		= 4 + 8,
 	.vd_max		= 511 + 8,
arch/arm/mach-versatile/clock.c +4 -4
index 530e16a..82753be 100644
@@ -43,8 +43,8 @@ EXPORT_SYMBOL(clk_get_rate);
 long clk_round_rate(struct clk *clk, unsigned long rate)
 {
 	struct icst_vco vco;
-	vco = icst307_khz_to_vco(clk->params, rate / 1000);
-	return icst307_khz(clk->params, vco) * 1000;
+	vco = icst307_hz_to_vco(clk->params, rate);
+	return icst307_hz(clk->params, vco);
 }
 EXPORT_SYMBOL(clk_round_rate);
 
@@ -55,8 +55,8 @@ int clk_set_rate(struct clk *clk, unsigned long rate)
 	if (clk->setvco) {
 		struct icst_vco vco;
 
-		vco = icst307_khz_to_vco(clk->params, rate / 1000);
-		clk->rate = icst307_khz(clk->params, vco) * 1000;
+		vco = icst307_hz_to_vco(clk->params, rate);
+		clk->rate = icst307_hz(clk->params, vco);
 		clk->setvco(clk, vco);
 		ret = 0;
 	}
arch/arm/mach-versatile/core.c +1 -1
index f8ed561..ff5d24f 100644
@@ -380,7 +380,7 @@ static struct mmci_platform_data mmc0_plat_data = {
  * Clock handling
  */
 static const struct icst_params versatile_oscvco_params = {
-	.ref		= 24000,
+	.ref		= 24000000,
 	.vco_max	= ICST307_VCO_MAX,
 	.vd_min		= 4 + 8,
 	.vd_max		= 511 + 8,
#14 lore raw

PATCH 1/1 ARM: ICST: move minimum VCO frequency to icst_params

---
 arch/arm/common/icst307.c                |    2 +-
 arch/arm/common/icst525.c                |    2 +-
 arch/arm/include/asm/hardware/icst.h     |    1 +
 arch/arm/mach-integrator/cpu.c           |    2 ++
 arch/arm/mach-integrator/impd1.c         |    1 +
 arch/arm/mach-integrator/integrator_cp.c |    1 +
 arch/arm/mach-realview/core.c            |    1 +
 arch/arm/mach-versatile/core.c           |    1 +
 8 files changed, 9 insertions(+), 2 deletions(-)
arch/arm/common/icst307.c +1 -1
index 66c69e5..312485f 100644
@@ -53,7 +53,7 @@ icst307_hz_to_vco(const struct icst_params *p, unsigned long freq)
 		/*
 		 * f must be between 6MHz and 200MHz (3.3 or 5V)
 		 */
-		if (f > ICST307_VCO_MIN && f <= p->vco_max)
+		if (f > p->vco_min && f <= p->vco_max)
 			break;
 	} while (i < ARRAY_SIZE(idx2s));
 
arch/arm/common/icst525.c +1 -1
index c1d22b7..da58965 100644
@@ -51,7 +51,7 @@ icst525_hz_to_vco(const struct icst_params *p, unsigned long freq)
 		 * f must be between 10MHz and
 		 *  320MHz (5V) or 200MHz (3V)
 		 */
-		if (f > ICST525_VCO_MIN && f <= p->vco_max)
+		if (f > p->vco_min && f <= p->vco_max)
 			break;
 	} while (i < ARRAY_SIZE(idx2s));
 
arch/arm/include/asm/hardware/icst.h +1 -0
index 65b1edd..6707c6a 100644
@@ -17,6 +17,7 @@
 struct icst_params {
 	unsigned long	ref;
 	unsigned long	vco_max;	/* inclusive */
+	unsigned long	vco_min;	/* exclusive */
 	unsigned short	vd_min;		/* inclusive */
 	unsigned short	vd_max;		/* inclusive */
 	unsigned char	rd_min;		/* inclusive */
arch/arm/mach-integrator/cpu.c +2 -0
index 3ebb785..569306b 100644
@@ -34,6 +34,7 @@ static struct cpufreq_driver integrator_driver;
 static const struct icst_params lclk_params = {
 	.ref		= 24000000,
 	.vco_max	= ICST525_VCO_MAX_5V,
+	.vco_min	= ICST525_VCO_MIN,
 	.vd_min		= 8,
 	.vd_max		= 132,
 	.rd_min		= 24,
@@ -43,6 +44,7 @@ static const struct icst_params lclk_params = {
 static const struct icst_params cclk_params = {
 	.ref		= 24000000,
 	.vco_max	= ICST525_VCO_MAX_5V,
+	.vco_min	= ICST525_VCO_MIN,
 	.vd_min		= 12,
 	.vd_max		= 160,
 	.rd_min		= 24,
arch/arm/mach-integrator/impd1.c +1 -0
index ecce3eb..036cfb4 100644
@@ -43,6 +43,7 @@ struct impd1_module {
 static const struct icst_params impd1_vco_params = {
 	.ref		= 24000000,	/* 24 MHz */
 	.vco_max	= ICST525_VCO_MAX_3V,
+	.vco_min	= ICST525_VCO_MIN,
 	.vd_min		= 12,
 	.vd_max		= 519,
 	.rd_min		= 3,
arch/arm/mach-integrator/integrator_cp.c +1 -0
index 335af99..34c120a 100644
@@ -271,6 +271,7 @@ static void __init intcp_init_irq(void)
 static const struct icst_params cp_auxvco_params = {
 	.ref		= 24000000,
 	.vco_max	= ICST525_VCO_MAX_5V,
+	.vco_min	= ICST525_VCO_MIN,
 	.vd_min 	= 8,
 	.vd_max 	= 263,
 	.rd_min 	= 3,
arch/arm/mach-realview/core.c +1 -0
index 02d4837..3ac4413 100644
@@ -276,6 +276,7 @@ struct mmci_platform_data realview_mmc1_plat_data = {
 static const struct icst_params realview_oscvco_params = {
 	.ref		= 24000000,
 	.vco_max	= ICST307_VCO_MAX,
+	.vco_min	= ICST307_VCO_MIN,
 	.vd_min		= 4 + 8,
 	.vd_max		= 511 + 8,
 	.rd_min		= 1 + 2,
arch/arm/mach-versatile/core.c +1 -0
index ff5d24f..c4bf680 100644
@@ -382,6 +382,7 @@ static struct mmci_platform_data mmc0_plat_data = {
 static const struct icst_params versatile_oscvco_params = {
 	.ref		= 24000000,
 	.vco_max	= ICST307_VCO_MAX,
+	.vco_min	= ICST307_VCO_MIN,
 	.vd_min		= 4 + 8,
 	.vd_max		= 511 + 8,
 	.rd_min		= 1 + 2,
#15 lore raw

PATCH 1/1 ARM: ICST: indirect s2div and idx2s arrays via icst_params

---
 arch/arm/common/icst307.c                |   18 +++++++++++-------
 arch/arm/common/icst525.c                |   18 +++++++++++-------
 arch/arm/include/asm/hardware/icst.h     |    2 ++
 arch/arm/include/asm/hardware/icst307.h  |    3 +++
 arch/arm/include/asm/hardware/icst525.h  |    3 +++
 arch/arm/mach-integrator/cpu.c           |    4 ++++
 arch/arm/mach-integrator/impd1.c         |    2 ++
 arch/arm/mach-integrator/integrator_cp.c |    2 ++
 arch/arm/mach-realview/core.c            |    2 ++
 arch/arm/mach-versatile/core.c           |    2 ++
 10 files changed, 42 insertions(+), 14 deletions(-)
arch/arm/common/icst307.c +11 -7
index 312485f..8332c07 100644
@@ -22,11 +22,13 @@
 /*
  * Divisors for each OD setting.
  */
-static unsigned char s2div[8] = { 10, 2, 8, 4, 5, 7, 3, 6 };
+const unsigned char icst307_s2div[8] = { 10, 2, 8, 4, 5, 7, 3, 6 };
+
+EXPORT_SYMBOL(icst307_s2div);
 
 unsigned long icst307_hz(const struct icst_params *p, struct icst_vco vco)
 {
-	return p->ref * 2 * (vco.v + 8) / ((vco.r + 2) * s2div[vco.s]);
+	return p->ref * 2 * (vco.v + 8) / ((vco.r + 2) * p->s2div[vco.s]);
 }
 
 EXPORT_SYMBOL(icst307_hz);
@@ -34,7 +36,9 @@ EXPORT_SYMBOL(icst307_hz);
 /*
  * Ascending divisor S values.
  */
-static unsigned char idx2s[8] = { 1, 6, 3, 4, 7, 5, 2, 0 };
+const unsigned char icst307_idx2s[8] = { 1, 6, 3, 4, 7, 5, 2, 0 };
+
+EXPORT_SYMBOL(icst307_idx2s);
 
 struct icst_vco
 icst307_hz_to_vco(const struct icst_params *p, unsigned long freq)
@@ -48,19 +52,19 @@ icst307_hz_to_vco(const struct icst_params *p, unsigned long freq)
 	 * that the PLL output is within spec.
 	 */
 	do {
-		f = freq * s2div[idx2s[i]];
+		f = freq * p->s2div[p->idx2s[i]];
 
 		/*
 		 * f must be between 6MHz and 200MHz (3.3 or 5V)
 		 */
 		if (f > p->vco_min && f <= p->vco_max)
 			break;
-	} while (i < ARRAY_SIZE(idx2s));
+	} while (i < 8);
 
-	if (i >= ARRAY_SIZE(idx2s))
+	if (i >= 8)
 		return vco;
 
-	vco.s = idx2s[i];
+	vco.s = p->idx2s[i];
 
 	/*
 	 * Now find the closest divisor combination
arch/arm/common/icst525.c +11 -7
index da58965..4180255 100644
@@ -19,11 +19,13 @@
 /*
  * Divisors for each OD setting.
  */
-static unsigned char s2div[8] = { 10, 2, 8, 4, 5, 7, 9, 6 };
+const unsigned char icst525_s2div[8] = { 10, 2, 8, 4, 5, 7, 9, 6 };
+
+EXPORT_SYMBOL(icst525_s2div);
 
 unsigned long icst525_hz(const struct icst_params *p, struct icst_vco vco)
 {
-	return p->ref * 2 * (vco.v + 8) / ((vco.r + 2) * s2div[vco.s]);
+	return p->ref * 2 * (vco.v + 8) / ((vco.r + 2) * p->s2div[vco.s]);
 }
 
 EXPORT_SYMBOL(icst525_hz);
@@ -31,7 +33,9 @@ EXPORT_SYMBOL(icst525_hz);
 /*
  * Ascending divisor S values.
  */
-static unsigned char idx2s[] = { 1, 3, 4, 7, 5, 2, 6, 0 };
+const unsigned char icst525_idx2s[8] = { 1, 3, 4, 7, 5, 2, 6, 0 };
+
+EXPORT_SYMBOL(icst525_idx2s);
 
 struct icst_vco
 icst525_hz_to_vco(const struct icst_params *p, unsigned long freq)
@@ -45,7 +49,7 @@ icst525_hz_to_vco(const struct icst_params *p, unsigned long freq)
 	 * that the PLL output is within spec.
 	 */
 	do {
-		f = freq * s2div[idx2s[i]];
+		f = freq * p->s2div[p->idx2s[i]];
 
 		/*
 		 * f must be between 10MHz and
@@ -53,12 +57,12 @@ icst525_hz_to_vco(const struct icst_params *p, unsigned long freq)
 		 */
 		if (f > p->vco_min && f <= p->vco_max)
 			break;
-	} while (i < ARRAY_SIZE(idx2s));
+	} while (i < 8);
 
-	if (i >= ARRAY_SIZE(idx2s))
+	if (i >= 8)
 		return vco;
 
-	vco.s = idx2s[i];
+	vco.s = p->idx2s[i];
 
 	/*
 	 * Now find the closest divisor combination
arch/arm/include/asm/hardware/icst.h +2 -0
index 6707c6a..4d40368 100644
@@ -22,6 +22,8 @@ struct icst_params {
 	unsigned short	vd_max;		/* inclusive */
 	unsigned char	rd_min;		/* inclusive */
 	unsigned char	rd_max;		/* inclusive */
+	const unsigned char *s2div;	/* chip specific s2div array */
+	const unsigned char *idx2s;	/* chip specific idx2s array */
 };
 
 struct icst_vco {
arch/arm/include/asm/hardware/icst307.h +3 -0
index 0f09618..d76fc6e 100644
@@ -28,4 +28,7 @@ struct icst_vco icst307_hz_to_vco(const struct icst_params *p, unsigned long fre
 #define ICST307_VCO_MIN	6000000
 #define ICST307_VCO_MAX	200000000
 
+extern const unsigned char icst307_s2div[];
+extern const unsigned char icst307_idx2s[];
+
 #endif
arch/arm/include/asm/hardware/icst525.h +3 -0
index 1000a60..2f9b953 100644
@@ -27,4 +27,7 @@ struct icst_vco icst525_hz_to_vco(const struct icst_params *p, unsigned long fre
 #define ICST525_VCO_MAX_3V	200000000
 #define ICST525_VCO_MAX_5V	320000000
 
+extern const unsigned char icst525_s2div[];
+extern const unsigned char icst525_idx2s[];
+
 #endif
arch/arm/mach-integrator/cpu.c +4 -0
index 569306b..9481c54 100644
@@ -39,6 +39,8 @@ static const struct icst_params lclk_params = {
 	.vd_max		= 132,
 	.rd_min		= 24,
 	.rd_max		= 24,
+	.s2div		= icst525_s2div,
+	.idx2s		= icst525_idx2s,
 };
 
 static const struct icst_params cclk_params = {
@@ -49,6 +51,8 @@ static const struct icst_params cclk_params = {
 	.vd_max		= 160,
 	.rd_min		= 24,
 	.rd_max		= 24,
+	.s2div		= icst525_s2div,
+	.idx2s		= icst525_idx2s,
 };
 
 /*
arch/arm/mach-integrator/impd1.c +2 -0
index 036cfb4..e24cfc3 100644
@@ -48,6 +48,8 @@ static const struct icst_params impd1_vco_params = {
 	.vd_max		= 519,
 	.rd_min		= 3,
 	.rd_max		= 120,
+	.s2div		= icst525_s2div,
+	.idx2s		= icst525_idx2s,
 };
 
 static void impd1_setvco(struct clk *clk, struct icst_vco vco)
arch/arm/mach-integrator/integrator_cp.c +2 -0
index 34c120a..9997d1f 100644
@@ -276,6 +276,8 @@ static const struct icst_params cp_auxvco_params = {
 	.vd_max 	= 263,
 	.rd_min 	= 3,
 	.rd_max 	= 65,
+	.s2div		= icst525_s2div,
+	.idx2s		= icst525_idx2s,
 };
 
 static void cp_auxvco_set(struct clk *clk, struct icst_vco vco)
arch/arm/mach-realview/core.c +2 -0
index 3ac4413..26d44ca 100644
@@ -281,6 +281,8 @@ static const struct icst_params realview_oscvco_params = {
 	.vd_max		= 511 + 8,
 	.rd_min		= 1 + 2,
 	.rd_max		= 127 + 2,
+	.s2div		= icst307_s2div,
+	.idx2s		= icst307_idx2s,
 };
 
 static void realview_oscvco_set(struct clk *clk, struct icst_vco vco)
arch/arm/mach-versatile/core.c +2 -0
index c4bf680..51d7aeb 100644
@@ -387,6 +387,8 @@ static const struct icst_params versatile_oscvco_params = {
 	.vd_max		= 511 + 8,
 	.rd_min		= 1 + 2,
 	.rd_max		= 127 + 2,
+	.s2div		= icst307_s2div,
+	.idx2s		= icst307_idx2s,
 };
 
 static void versatile_oscvco_set(struct clk *clk, struct icst_vco vco)
#16 lore raw

PATCH 1/1 ARM: ICST: kill duplicate icst code

The only difference between ICST307 and ICST525 are the two arrays for calculating the S parameter; the code is now identical. Merge the two files and kill the duplicated code.

---
 arch/arm/Kconfig                         |    6 +-
 arch/arm/common/Kconfig                  |    5 +-
 arch/arm/common/Makefile                 |    3 +-
 arch/arm/common/{icst307.c => icst.c}    |   19 +++---
 arch/arm/common/icst525.c                |   99 ------------------------------
 arch/arm/include/asm/hardware/icst.h     |   24 +++++++
 arch/arm/include/asm/hardware/icst307.h  |   34 ----------
 arch/arm/include/asm/hardware/icst525.h  |   33 ----------
 arch/arm/mach-integrator/clock.c         |   10 ++--
 arch/arm/mach-integrator/cpu.c           |   20 +++---
 arch/arm/mach-integrator/impd1.c         |    2 +-
 arch/arm/mach-integrator/integrator_cp.c |    2 +-
 arch/arm/mach-realview/clock.c           |   10 ++--
 arch/arm/mach-realview/core.c            |    2 +-
 arch/arm/mach-realview/realview_eb.c     |    1 -
 arch/arm/mach-realview/realview_pb1176.c |    1 -
 arch/arm/mach-realview/realview_pb11mp.c |    1 -
 arch/arm/mach-realview/realview_pba8.c   |    1 -
 arch/arm/mach-versatile/clock.c          |   10 ++--
 arch/arm/mach-versatile/core.c           |    2 +-
 20 files changed, 67 insertions(+), 218 deletions(-)
 rename arch/arm/common/{icst307.c => icst.c} (82%)
 delete mode 100644 arch/arm/common/icst525.c
 delete mode 100644 arch/arm/include/asm/hardware/icst307.h
 delete mode 100644 arch/arm/include/asm/hardware/icst525.h
arch/arm/Kconfig +3 -3
index 95ea101..b9ac2c9 100644
@@ -222,7 +222,7 @@ config ARCH_INTEGRATOR
 	select ARCH_HAS_CPUFREQ
 	select HAVE_CLK
 	select COMMON_CLKDEV
-	select ICST525
+	select ICST
 	select GENERIC_TIME
 	select GENERIC_CLOCKEVENTS
 	help
@@ -233,7 +233,7 @@ config ARCH_REALVIEW
 	select ARM_AMBA
 	select HAVE_CLK
 	select COMMON_CLKDEV
-	select ICST307
+	select ICST
 	select GENERIC_TIME
 	select GENERIC_CLOCKEVENTS
 	select ARCH_WANT_OPTIONAL_GPIOLIB
@@ -246,7 +246,7 @@ config ARCH_VERSATILE
 	select ARM_VIC
 	select HAVE_CLK
 	select COMMON_CLKDEV
-	select ICST307
+	select ICST
 	select GENERIC_TIME
 	select GENERIC_CLOCKEVENTS
 	select ARCH_WANT_OPTIONAL_GPIOLIB
arch/arm/common/Kconfig +1 -4
index 4efbb9d..323d2d2 100644
@@ -12,10 +12,7 @@ config ARM_VIC_NR
 	  The maximum number of VICs available in the system, for
 	  power management.
 
-config ICST525
-	bool
-
-config ICST307
+config ICST
 	bool
 
 config SA1111
arch/arm/common/Makefile +1 -2
index 76be7ff..5e8ad0d 100644
@@ -4,8 +4,7 @@
 
 obj-$(CONFIG_ARM_GIC)		+= gic.o
 obj-$(CONFIG_ARM_VIC)		+= vic.o
-obj-$(CONFIG_ICST525)		+= icst525.o
-obj-$(CONFIG_ICST307)		+= icst307.o
+obj-$(CONFIG_ICST)		+= icst.o
 obj-$(CONFIG_SA1111)		+= sa1111.o
 obj-$(CONFIG_PCI_HOST_VIA82C505) += via82c505.o
 obj-$(CONFIG_DMABOUNCE)		+= dmabounce.o
arch/arm/common/icst.c renamed from arch/arm/common/icst307.c +9 -10
similarity index 82%
rename from arch/arm/common/icst307.c
rename to arch/arm/common/icst.c
index 8332c07..9a7f09c 100644
@@ -17,31 +17,33 @@
 #include <linux/module.h>
 #include <linux/kernel.h>
 
-#include <asm/hardware/icst307.h>
+#include <asm/hardware/icst.h>
 
 /*
  * Divisors for each OD setting.
  */
 const unsigned char icst307_s2div[8] = { 10, 2, 8, 4, 5, 7, 3, 6 };
-
+const unsigned char icst525_s2div[8] = { 10, 2, 8, 4, 5, 7, 9, 6 };
 EXPORT_SYMBOL(icst307_s2div);
+EXPORT_SYMBOL(icst525_s2div);
 
-unsigned long icst307_hz(const struct icst_params *p, struct icst_vco vco)
+unsigned long icst_hz(const struct icst_params *p, struct icst_vco vco)
 {
 	return p->ref * 2 * (vco.v + 8) / ((vco.r + 2) * p->s2div[vco.s]);
 }
 
-EXPORT_SYMBOL(icst307_hz);
+EXPORT_SYMBOL(icst_hz);
 
 /*
  * Ascending divisor S values.
  */
 const unsigned char icst307_idx2s[8] = { 1, 6, 3, 4, 7, 5, 2, 0 };
-
+const unsigned char icst525_idx2s[8] = { 1, 3, 4, 7, 5, 2, 6, 0 };
 EXPORT_SYMBOL(icst307_idx2s);
+EXPORT_SYMBOL(icst525_idx2s);
 
 struct icst_vco
-icst307_hz_to_vco(const struct icst_params *p, unsigned long freq)
+icst_hz_to_vco(const struct icst_params *p, unsigned long freq)
 {
 	struct icst_vco vco = { .s = 1, .v = p->vd_max, .r = p->rd_max };
 	unsigned long f;
@@ -54,9 +56,6 @@ icst307_hz_to_vco(const struct icst_params *p, unsigned long freq)
 	do {
 		f = freq * p->s2div[p->idx2s[i]];
 
-		/*
-		 * f must be between 6MHz and 200MHz (3.3 or 5V)
-		 */
 		if (f > p->vco_min && f <= p->vco_max)
 			break;
 	} while (i < 8);
@@ -98,4 +97,4 @@ icst307_hz_to_vco(const struct icst_params *p, unsigned long freq)
 	return vco;
 }
 
-EXPORT_SYMBOL(icst307_hz_to_vco);
+EXPORT_SYMBOL(icst_hz_to_vco);
arch/arm/common/icst525.c deleted +0 -99

99 lines not on this page · raw message

arch/arm/include/asm/hardware/icst.h +24 -0
index 4d40368..10382a3 100644
@@ -32,4 +32,28 @@ struct icst_vco {
 	unsigned char	s;
 };
 
+unsigned long icst_hz(const struct icst_params *p, struct icst_vco vco);
+struct icst_vco icst_hz_to_vco(const struct icst_params *p, unsigned long freq);
+
+/*
+ * ICST307 VCO frequency must be between 6MHz and 200MHz (3.3 or 5V).
+ * This frequency is pre-output divider.
+ */
+#define ICST307_VCO_MIN	6000000
+#define ICST307_VCO_MAX	200000000
+
+extern const unsigned char icst307_s2div[];
+extern const unsigned char icst307_idx2s[];
+
+/*
+ * ICST525 VCO frequency must be between 10MHz and 200MHz (3V) or 320MHz (5V).
+ * This frequency is pre-output divider.
+ */
+#define ICST525_VCO_MIN		10000000
+#define ICST525_VCO_MAX_3V	200000000
+#define ICST525_VCO_MAX_5V	320000000
+
+extern const unsigned char icst525_s2div[];
+extern const unsigned char icst525_idx2s[];
+
 #endif
arch/arm/include/asm/hardware/icst307.h deleted +0 -34
deleted file mode 100644
index d76fc6e..0000000
@@ -1,34 +0,0 @@
-/*
- *  arch/arm/include/asm/hardware/icst307.h
- *
- *  Copyright (C) 2003 Deep Blue Solutions, Ltd, All Rights Reserved.
- *
- * 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.
- *
- *  Support functions for calculating clocks/divisors for the ICS307
- *  clock generators.  See http://www.icst.com/ for more information
- *  on these devices.
- *
- *  This file is similar to the icst525.h file
- */
-#ifndef ASMARM_HARDWARE_ICST307_H
-#define ASMARM_HARDWARE_ICST307_H
-
-#include <asm/hardware/icst.h>
-
-unsigned long icst307_hz(const struct icst_params *p, struct icst_vco vco);
-struct icst_vco icst307_hz_to_vco(const struct icst_params *p, unsigned long freq);
-
-/*
- * ICST307 VCO frequency must be between 6MHz and 200MHz (3.3 or 5V).
- * This frequency is pre-output divider.
- */
-#define ICST307_VCO_MIN	6000000
-#define ICST307_VCO_MAX	200000000
-
-extern const unsigned char icst307_s2div[];
-extern const unsigned char icst307_idx2s[];
-
-#endif
arch/arm/include/asm/hardware/icst525.h deleted +0 -33
deleted file mode 100644
index 2f9b953..0000000
@@ -1,33 +0,0 @@
-/*
- *  arch/arm/include/asm/hardware/icst525.h
- *
- *  Copyright (C) 2003 Deep Blue Solutions, Ltd, All Rights Reserved.
- *
- * 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.
- *
- *  Support functions for calculating clocks/divisors for the ICST525
- *  clock generators.  See http://www.icst.com/ for more information
- *  on these devices.
- */
-#ifndef ASMARM_HARDWARE_ICST525_H
-#define ASMARM_HARDWARE_ICST525_H
-
-#include <asm/hardware/icst.h>
-
-unsigned long icst525_hz(const struct icst_params *p, struct icst_vco vco);
-struct icst_vco icst525_hz_to_vco(const struct icst_params *p, unsigned long freq);
-
-/*
- * ICST525 VCO frequency must be between 10MHz and 200MHz (3V) or 320MHz (5V).
- * This frequency is pre-output divider.
- */
-#define ICST525_VCO_MIN		10000000
-#define ICST525_VCO_MAX_3V	200000000
-#define ICST525_VCO_MAX_5V	320000000
-
-extern const unsigned char icst525_s2div[];
-extern const unsigned char icst525_idx2s[];
-
-#endif
arch/arm/mach-integrator/clock.c +5 -5
index a4f80d3..52fc294 100644
@@ -14,7 +14,7 @@
 #include <linux/clk.h>
 #include <linux/mutex.h>
 
-#include <asm/hardware/icst525.h>
+#include <asm/hardware/icst.h>
 #include <asm/clkdev.h>
 #include <mach/clkdev.h>
 
@@ -38,8 +38,8 @@ EXPORT_SYMBOL(clk_get_rate);
 long clk_round_rate(struct clk *clk, unsigned long rate)
 {
 	struct icst_vco vco;
-	vco = icst525_hz_to_vco(clk->params, rate);
-	return icst525_hz(clk->params, vco);
+	vco = icst_hz_to_vco(clk->params, rate);
+	return icst_hz(clk->params, vco);
 }
 EXPORT_SYMBOL(clk_round_rate);
 
@@ -50,8 +50,8 @@ int clk_set_rate(struct clk *clk, unsigned long rate)
 	if (clk->setvco) {
 		struct icst_vco vco;
 
-		vco = icst525_hz_to_vco(clk->params, rate);
-		clk->rate = icst525_hz(clk->params, vco);
+		vco = icst_hz_to_vco(clk->params, rate);
+		clk->rate = icst_hz(clk->params, vco);
 		clk->setvco(clk, vco);
 		ret = 0;
 	}
arch/arm/mach-integrator/cpu.c +10 -10
index 9481c54..1cb222d 100644
@@ -22,7 +22,7 @@
 #include <mach/hardware.h>
 #include <mach/platform.h>
 #include <asm/mach-types.h>
-#include <asm/hardware/icst525.h>
+#include <asm/hardware/icst.h>
 
 static struct cpufreq_driver integrator_driver;
 
@@ -66,11 +66,11 @@ static int integrator_verify_policy(struct cpufreq_policy *policy)
 				     policy->cpuinfo.min_freq, 
 				     policy->cpuinfo.max_freq);
 
-	vco = icst525_hz_to_vco(&cclk_params, policy->max * 1000);
-	policy->max = icst525_hz(&cclk_params, vco) / 1000;
+	vco = icst_hz_to_vco(&cclk_params, policy->max * 1000);
+	policy->max = icst_hz(&cclk_params, vco) / 1000;
 
-	vco = icst525_hz_to_vco(&cclk_params, policy->min * 1000);
-	policy->min = icst525_hz(&cclk_params, vco) / 1000;
+	vco = icst_hz_to_vco(&cclk_params, policy->min * 1000);
+	policy->min = icst_hz(&cclk_params, vco) / 1000;
 
 	cpufreq_verify_within_limits(policy, 
 				     policy->cpuinfo.min_freq, 
@@ -112,17 +112,17 @@ static int integrator_set_target(struct cpufreq_policy *policy,
 	}
 	vco.v = cm_osc & 255;
 	vco.r = 22;
-	freqs.old = icst525_hz(&cclk_params, vco) / 1000;
+	freqs.old = icst_hz(&cclk_params, vco) / 1000;
 
-	/* icst525_hz_to_vco rounds down -- so we need the next
+	/* icst_hz_to_vco rounds down -- so we need the next
 	 * larger freq in case of CPUFREQ_RELATION_L.
 	 */
 	if (relation == CPUFREQ_RELATION_L)
 		target_freq += 999;
 	if (target_freq > policy->max)
 		target_freq = policy->max;
-	vco = icst525_hz_to_vco(&cclk_params, target_freq * 1000);
-	freqs.new = icst525_hz(&cclk_params, vco) / 1000;
+	vco = icst_hz_to_vco(&cclk_params, target_freq * 1000);
+	freqs.new = icst_hz(&cclk_params, vco) / 1000;
 
 	freqs.cpu = policy->cpu;
 
@@ -180,7 +180,7 @@ static unsigned int integrator_get(unsigned int cpu)
 	vco.v = cm_osc & 255;
 	vco.r = 22;
 
-	current_freq = icst525_hz(&cclk_params, vco) / 1000; /* current freq */
+	current_freq = icst_hz(&cclk_params, vco) / 1000; /* current freq */
 
 	set_cpus_allowed(current, cpus_allowed);
 
arch/arm/mach-integrator/impd1.c +1 -1
index e24cfc3..3e21102 100644
@@ -24,7 +24,7 @@
 
 #include <asm/clkdev.h>
 #include <mach/clkdev.h>
-#include <asm/hardware/icst525.h>
+#include <asm/hardware/icst.h>
 #include <mach/lm.h>
 #include <mach/impd1.h>
 #include <asm/sizes.h>
arch/arm/mach-integrator/integrator_cp.c +1 -1
index 9997d1f..a9ab8fd 100644
@@ -29,7 +29,7 @@
 #include <asm/irq.h>
 #include <asm/setup.h>
 #include <asm/mach-types.h>
-#include <asm/hardware/icst525.h>
+#include <asm/hardware/icst.h>
 
 #include <mach/cm.h>
 #include <mach/lm.h>
arch/arm/mach-realview/clock.c +5 -5
index 2ba0667..18c5459 100644
@@ -18,7 +18,7 @@
 #include <linux/clk.h>
 #include <linux/mutex.h>
 
-#include <asm/hardware/icst307.h>
+#include <asm/hardware/icst.h>
 
 #include "clock.h"
 
@@ -42,8 +42,8 @@ EXPORT_SYMBOL(clk_get_rate);
 long clk_round_rate(struct clk *clk, unsigned long rate)
 {
 	struct icst_vco vco;
-	vco = icst307_hz_to_vco(clk->params, rate);
-	return icst307_hz(clk->params, vco);
+	vco = icst_hz_to_vco(clk->params, rate);
+	return icst_hz(clk->params, vco);
 }
 EXPORT_SYMBOL(clk_round_rate);
 
@@ -54,8 +54,8 @@ int clk_set_rate(struct clk *clk, unsigned long rate)
 	if (clk->setvco) {
 		struct icst_vco vco;
 
-		vco = icst307_hz_to_vco(clk->params, rate);
-		clk->rate = icst307_hz(clk->params, vco);
+		vco = icst_hz_to_vco(clk->params, rate);
+		clk->rate = icst_hz(clk->params, vco);
 		clk->setvco(clk, vco);
 		ret = 0;
 	}
arch/arm/mach-realview/core.c +1 -1
index 26d44ca..a8c215a 100644
@@ -39,7 +39,7 @@
 #include <asm/leds.h>
 #include <asm/mach-types.h>
 #include <asm/hardware/arm_timer.h>
-#include <asm/hardware/icst307.h>
+#include <asm/hardware/icst.h>
 
 #include <asm/mach/arch.h>
 #include <asm/mach/flash.h>
arch/arm/mach-realview/realview_eb.c +0 -1
index 7d857d3..39d953c 100644
@@ -32,7 +32,6 @@
 #include <asm/leds.h>
 #include <asm/mach-types.h>
 #include <asm/hardware/gic.h>
-#include <asm/hardware/icst307.h>
 #include <asm/hardware/cache-l2x0.h>
 #include <asm/localtimer.h>
 
arch/arm/mach-realview/realview_pb1176.c +0 -1
index 44392e5..a93aac5 100644
@@ -32,7 +32,6 @@
 #include <asm/leds.h>
 #include <asm/mach-types.h>
 #include <asm/hardware/gic.h>
-#include <asm/hardware/icst307.h>
 #include <asm/hardware/cache-l2x0.h>
 
 #include <asm/mach/arch.h>
arch/arm/mach-realview/realview_pb11mp.c +0 -1
index 3e02731..c7c656e 100644
@@ -32,7 +32,6 @@
 #include <asm/leds.h>
 #include <asm/mach-types.h>
 #include <asm/hardware/gic.h>
-#include <asm/hardware/icst307.h>
 #include <asm/hardware/cache-l2x0.h>
 #include <asm/localtimer.h>
 
arch/arm/mach-realview/realview_pba8.c +0 -1
index fe4e25c..3e3aaa3 100644
@@ -31,7 +31,6 @@
 #include <asm/leds.h>
 #include <asm/mach-types.h>
 #include <asm/hardware/gic.h>
-#include <asm/hardware/icst307.h>
 
 #include <asm/mach/arch.h>
 #include <asm/mach/map.h>
arch/arm/mach-versatile/clock.c +5 -5
index 82753be..adc67d7 100644
@@ -19,7 +19,7 @@
 #include <linux/mutex.h>
 
 #include <asm/clkdev.h>
-#include <asm/hardware/icst307.h>
+#include <asm/hardware/icst.h>
 
 #include "clock.h"
 
@@ -43,8 +43,8 @@ EXPORT_SYMBOL(clk_get_rate);
 long clk_round_rate(struct clk *clk, unsigned long rate)
 {
 	struct icst_vco vco;
-	vco = icst307_hz_to_vco(clk->params, rate);
-	return icst307_hz(clk->params, vco);
+	vco = icst_hz_to_vco(clk->params, rate);
+	return icst_hz(clk->params, vco);
 }
 EXPORT_SYMBOL(clk_round_rate);
 
@@ -55,8 +55,8 @@ int clk_set_rate(struct clk *clk, unsigned long rate)
 	if (clk->setvco) {
 		struct icst_vco vco;
 
-		vco = icst307_hz_to_vco(clk->params, rate);
-		clk->rate = icst307_hz(clk->params, vco);
+		vco = icst_hz_to_vco(clk->params, rate);
+		clk->rate = icst_hz(clk->params, vco);
 		clk->setvco(clk, vco);
 		ret = 0;
 	}
arch/arm/mach-versatile/core.c +1 -1
index 51d7aeb..3c67691 100644
@@ -38,7 +38,7 @@
 #include <asm/irq.h>
 #include <asm/leds.h>
 #include <asm/hardware/arm_timer.h>
-#include <asm/hardware/icst307.h>
+#include <asm/hardware/icst.h>
 #include <asm/hardware/vic.h>
 #include <asm/mach-types.h>
 
#17 lore raw

PATCH 1/1 ARM: Realview/Versatile/Integrator: separate out common clock code

---
 arch/arm/Kconfig                                   |    6 ++
 arch/arm/Makefile                                  |    1 +
 arch/arm/mach-integrator/Makefile                  |    2 +-
 arch/arm/mach-realview/Makefile                    |    2 +-
 arch/arm/mach-realview/clock.c                     |   64 -------------------
 arch/arm/mach-realview/clock.h                     |   20 ------
 arch/arm/mach-realview/core.c                      |    2 +-
 arch/arm/mach-realview/include/mach/clkdev.h       |    9 +++
 arch/arm/mach-realview/realview_eb.c               |    1 -
 arch/arm/mach-realview/realview_pb1176.c           |    1 -
 arch/arm/mach-realview/realview_pb11mp.c           |    1 -
 arch/arm/mach-realview/realview_pba8.c             |    1 -
 arch/arm/mach-versatile/Makefile                   |    2 +-
 arch/arm/mach-versatile/clock.c                    |   65 --------------------
 arch/arm/mach-versatile/clock.h                    |   21 ------
 arch/arm/mach-versatile/core.c                     |    2 +-
 arch/arm/mach-versatile/include/mach/clkdev.h      |    9 +++
 arch/arm/plat-versatile/Makefile                   |    1 +
 .../{mach-integrator => plat-versatile}/clock.c    |    4 +-
 19 files changed, 33 insertions(+), 181 deletions(-)
 delete mode 100644 arch/arm/mach-realview/clock.c
 delete mode 100644 arch/arm/mach-realview/clock.h
 delete mode 100644 arch/arm/mach-versatile/clock.c
 delete mode 100644 arch/arm/mach-versatile/clock.h
 create mode 100644 arch/arm/plat-versatile/Makefile
 rename arch/arm/{mach-integrator => plat-versatile}/clock.c (94%)
arch/arm/Kconfig +6 -0
index b9ac2c9..d296ae9 100644
@@ -225,6 +225,7 @@ config ARCH_INTEGRATOR
 	select ICST
 	select GENERIC_TIME
 	select GENERIC_CLOCKEVENTS
+	select PLAT_VERSATILE
 	help
 	  Support for ARM's Integrator platform.
 
@@ -237,6 +238,7 @@ config ARCH_REALVIEW
 	select GENERIC_TIME
 	select GENERIC_CLOCKEVENTS
 	select ARCH_WANT_OPTIONAL_GPIOLIB
+	select PLAT_VERSATILE
 	help
 	  This enables support for ARM Ltd RealView boards.
 
@@ -250,6 +252,7 @@ config ARCH_VERSATILE
 	select GENERIC_TIME
 	select GENERIC_CLOCKEVENTS
 	select ARCH_WANT_OPTIONAL_GPIOLIB
+	select PLAT_VERSATILE
 	help
 	  This enables support for ARM Ltd Versatile board.
 
@@ -852,6 +855,9 @@ config PLAT_ORION
 config PLAT_PXA
 	bool
 
+config PLAT_VERSATILE
+	bool
+
 source arch/arm/mm/Kconfig
 
 config IWMMXT
arch/arm/Makefile +1 -0
index 9e75825..a07a3be 100644
@@ -185,6 +185,7 @@ plat-$(CONFIG_PLAT_PXA)		:= pxa
 plat-$(CONFIG_PLAT_S3C24XX)	:= s3c24xx s3c samsung
 plat-$(CONFIG_PLAT_S3C64XX)	:= s3c64xx s3c samsung
 plat-$(CONFIG_PLAT_S5PC1XX)	:= s5pc1xx s3c samsung
+plat-$(CONFIG_PLAT_VERSATILE)	:= versatile
 
 ifeq ($(CONFIG_ARCH_EBSA110),y)
 # This is what happens if you forget the IOCS16 line.
arch/arm/mach-integrator/Makefile +1 -1
index 6a5ef8d..ebeef96 100644
@@ -4,7 +4,7 @@
 
 # Object file lists.
 
-obj-y					:= clock.o core.o lm.o
+obj-y					:= core.o lm.o
 obj-$(CONFIG_ARCH_INTEGRATOR_AP)	+= integrator_ap.o
 obj-$(CONFIG_ARCH_INTEGRATOR_CP)	+= integrator_cp.o
 
arch/arm/mach-realview/Makefile +1 -1
index e704edb..a01b76b 100644
@@ -2,7 +2,7 @@
 # Makefile for the linux kernel.
 #
 
-obj-y					:= core.o clock.o
+obj-y					:= core.o
 obj-$(CONFIG_MACH_REALVIEW_EB)		+= realview_eb.o
 obj-$(CONFIG_MACH_REALVIEW_PB11MP)	+= realview_pb11mp.o
 obj-$(CONFIG_MACH_REALVIEW_PB1176)	+= realview_pb1176.o
arch/arm/mach-realview/clock.c deleted +0 -64

64 lines not on this page · raw message

arch/arm/mach-realview/clock.h deleted +0 -20
deleted file mode 100644
index fa64c85..0000000
@@ -1,20 +0,0 @@
-/*
- *  linux/arch/arm/mach-realview/clock.h
- *
- *  Copyright (C) 2004 ARM Limited.
- *  Written by Deep Blue Solutions Limited.
- *
- * 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 <asm/hardware/icst.h>
-
-struct module;
-
-struct clk {
-	unsigned long		rate;
-	const struct icst_params *params;
-	void			*data;
-	void			(*setvco)(struct clk *, struct icst_vco vco);
-};
arch/arm/mach-realview/core.c +1 -1
index a8c215a..17eb7eb 100644
@@ -48,11 +48,11 @@
 
 #include <asm/hardware/gic.h>
 
+#include <mach/clkdev.h>
 #include <mach/platform.h>
 #include <mach/irqs.h>
 
 #include "core.h"
-#include "clock.h"
 
 #define REALVIEW_REFCOUNTER	(__io_address(REALVIEW_SYS_BASE) + REALVIEW_SYS_24MHz_OFFSET)
 
arch/arm/mach-realview/include/mach/clkdev.h +9 -0
index 04b37a8..fefe467 100644
@@ -1,6 +1,15 @@
 #ifndef __ASM_MACH_CLKDEV_H
 #define __ASM_MACH_CLKDEV_H
 
+#include <asm/hardware/icst.h>
+
+struct clk {
+	unsigned long		rate;
+	const struct icst_params *params;
+	u32			oscoff;
+	void			(*setvco)(struct clk *, struct icst_vco vco);
+};
+
 #define __clk_get(clk) ({ 1; })
 #define __clk_put(clk) do { } while (0)
 
arch/arm/mach-realview/realview_eb.c +0 -1
index 39d953c..006765f 100644
@@ -43,7 +43,6 @@
 #include <mach/irqs.h>
 
 #include "core.h"
-#include "clock.h"
 
 static struct map_desc realview_eb_io_desc[] __initdata = {
 	{
arch/arm/mach-realview/realview_pb1176.c +0 -1
index a93aac5..217f7c1 100644
@@ -43,7 +43,6 @@
 #include <mach/irqs.h>
 
 #include "core.h"
-#include "clock.h"
 
 static struct map_desc realview_pb1176_io_desc[] __initdata = {
 	{
arch/arm/mach-realview/realview_pb11mp.c +0 -1
index c7c656e..9ef2ecc 100644
@@ -44,7 +44,6 @@
 #include <mach/irqs.h>
 
 #include "core.h"
-#include "clock.h"
 
 static struct map_desc realview_pb11mp_io_desc[] __initdata = {
 	{
arch/arm/mach-realview/realview_pba8.c +0 -1
index 3e3aaa3..2fab3a6 100644
@@ -41,7 +41,6 @@
 #include <mach/irqs.h>
 
 #include "core.h"
-#include "clock.h"
 
 static struct map_desc realview_pba8_io_desc[] __initdata = {
 	{
arch/arm/mach-versatile/Makefile +1 -1
index ba81e70..97cf4d8 100644
@@ -2,7 +2,7 @@
 # Makefile for the linux kernel.
 #
 
-obj-y					:= core.o clock.o
+obj-y					:= core.o
 obj-$(CONFIG_ARCH_VERSATILE_PB)		+= versatile_pb.o
 obj-$(CONFIG_MACH_VERSATILE_AB)		+= versatile_ab.o
 obj-$(CONFIG_PCI)			+= pci.o
arch/arm/mach-versatile/clock.c deleted +0 -65

65 lines not on this page · raw message

arch/arm/mach-versatile/clock.h deleted +0 -21
deleted file mode 100644
index aed7e22..0000000
@@ -1,21 +0,0 @@
-/*
- *  linux/arch/arm/mach-versatile/clock.h
- *
- *  Copyright (C) 2004 ARM Limited.
- *  Written by Deep Blue Solutions Limited.
- *
- * 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 <asm/hardware/icst.h>
-
-struct module;
-
-struct clk {
-	unsigned long		rate;
-	const struct icst_params *params;
-	u32			oscoff;
-	void			*data;
-	void			(*setvco)(struct clk *, struct icst_vco vco);
-};
arch/arm/mach-versatile/core.c +1 -1
index 3c67691..e9d255f 100644
@@ -47,11 +47,11 @@
 #include <asm/mach/irq.h>
 #include <asm/mach/time.h>
 #include <asm/mach/map.h>
+#include <mach/clkdev.h>
 #include <mach/hardware.h>
 #include <mach/platform.h>
 
 #include "core.h"
-#include "clock.h"
 
 /*
  * All IO addresses are mapped onto VA 0xFFFx.xxxx, where x.xxxx
arch/arm/mach-versatile/include/mach/clkdev.h +9 -0
index 04b37a8..fefe467 100644
@@ -1,6 +1,15 @@
 #ifndef __ASM_MACH_CLKDEV_H
 #define __ASM_MACH_CLKDEV_H
 
+#include <asm/hardware/icst.h>
+
+struct clk {
+	unsigned long		rate;
+	const struct icst_params *params;
+	u32			oscoff;
+	void			(*setvco)(struct clk *, struct icst_vco vco);
+};
+
 #define __clk_get(clk) ({ 1; })
 #define __clk_put(clk) do { } while (0)
 
arch/arm/plat-versatile/Makefile new file +1 -0
new file mode 100644
index 0000000..2228fd1
@@ -0,0 +1 @@
+obj-y	:= clock.o
arch/arm/plat-versatile/clock.c renamed from arch/arm/mach-integrator/clock.c +2 -2
similarity index 94%
rename from arch/arm/mach-integrator/clock.c
rename to arch/arm/plat-versatile/clock.c
index 52fc294..2fa34de 100644
@@ -1,5 +1,5 @@
 /*
- *  linux/arch/arm/mach-integrator/clock.c
+ *  linux/arch/arm/plat-versatile/clock.c
  *
  *  Copyright (C) 2004 ARM Limited.
  *  Written by Deep Blue Solutions Limited.
@@ -15,7 +15,7 @@
 #include <linux/mutex.h>
 
 #include <asm/hardware/icst.h>
-#include <asm/clkdev.h>
+
 #include <mach/clkdev.h>
 
 int clk_enable(struct clk *clk)
#18 lore raw

PATCH 1/1 ARM: Realview/Versatile: separate out common SP804 timer code

---
 arch/arm/Kconfig                                |    5 +
 arch/arm/mach-realview/core.c                   |  139 +------------------
 arch/arm/mach-versatile/core.c                  |  135 +------------------
 arch/arm/plat-versatile/Makefile                |    1 +
 arch/arm/plat-versatile/include/plat/timer-sp.h |    2 +
 arch/arm/plat-versatile/timer-sp.c              |  168 +++++++++++++++++++++++
 6 files changed, 182 insertions(+), 268 deletions(-)
 create mode 100644 arch/arm/plat-versatile/include/plat/timer-sp.h
 create mode 100644 arch/arm/plat-versatile/timer-sp.c
arch/arm/Kconfig +5 -0
index d296ae9..01bc0dd 100644
@@ -239,6 +239,7 @@ config ARCH_REALVIEW
 	select GENERIC_CLOCKEVENTS
 	select ARCH_WANT_OPTIONAL_GPIOLIB
 	select PLAT_VERSATILE
+	select ARM_TIMER_SP804
 	help
 	  This enables support for ARM Ltd RealView boards.
 
@@ -253,6 +254,7 @@ config ARCH_VERSATILE
 	select GENERIC_CLOCKEVENTS
 	select ARCH_WANT_OPTIONAL_GPIOLIB
 	select PLAT_VERSATILE
+	select ARM_TIMER_SP804
 	help
 	  This enables support for ARM Ltd Versatile board.
 
@@ -858,6 +860,9 @@ config PLAT_PXA
 config PLAT_VERSATILE
 	bool
 
+config ARM_TIMER_SP804
+	bool
+
 source arch/arm/mm/Kconfig
 
 config IWMMXT
arch/arm/mach-realview/core.c +3 -136

163 lines not on this page · raw message

arch/arm/mach-versatile/core.c +3 -132

159 lines not on this page · raw message

arch/arm/plat-versatile/Makefile +1 -0
index 2228fd1..334d2f1 100644
@@ -1 +1,2 @@
 obj-y	:= clock.o
+obj-$(CONFIG_ARM_TIMER_SP804) += timer-sp.o
arch/arm/plat-versatile/include/plat/timer-sp.h new file +2 -0
new file mode 100644
index 0000000..21e75e3
@@ -0,0 +1,2 @@
+void sp804_clocksource_init(void __iomem *);
+void sp804_clockevents_init(void __iomem *, unsigned int);
arch/arm/plat-versatile/timer-sp.c new file +168 -0

168 lines not on this page · raw message

#19 lore raw

PATCH 1/1 ARM: Realview/Versatile: remove useless TIMER_RELOAD calculations

Realview/Versatile copied the Integrator timer code, including the calculations for ensuring that the reload value fits into the 16-bit counter. However, these platforms have a 32-bit counter which is clocked at a slower rate.

The result is that the preprocessor conditions are never triggered:
TICKS_PER_uSEC = 1, mSEC_10 = 10000, which is 0x2710 - less than 0x10000.

So, remove the unnecessary complexity, reducing the TIMER_RELOAD calculation to just:

TICKS_PER_uSEC * mSEC_10

---
 arch/arm/plat-versatile/timer-sp.c |   12 +-----------
 1 files changed, 1 insertions(+), 11 deletions(-)
arch/arm/plat-versatile/timer-sp.c +1 -11
index 98722f4..d1dbef5 100644
@@ -33,17 +33,7 @@
 /*
  * How long is the timer interval?
  */
-#define TIMER_INTERVAL	(TICKS_PER_uSEC * mSEC_10)
-#if TIMER_INTERVAL >= 0x100000
-#define TIMER_RELOAD	(TIMER_INTERVAL >> 8)
-#define TIMER_DIVISOR	(TIMER_CTRL_DIV256)
-#elif TIMER_INTERVAL >= 0x10000
-#define TIMER_RELOAD	(TIMER_INTERVAL >> 4)		/* Divide by 16 */
-#define TIMER_DIVISOR	(TIMER_CTRL_DIV16)
-#else
-#define TIMER_RELOAD	(TIMER_INTERVAL)
-#define TIMER_DIVISOR	(TIMER_CTRL_DIV1)
-#endif
+#define TIMER_RELOAD	(TICKS_PER_uSEC * mSEC_10)
 
 
 static void __iomem *clksrc_base;
#20 lore raw

PATCH 1/1 ARM: Realview/Versatile: don't use magic numbers for timer frequency

---
 arch/arm/plat-versatile/timer-sp.c |   12 +++++-------
 1 files changed, 5 insertions(+), 7 deletions(-)
arch/arm/plat-versatile/timer-sp.c +5 -7
index d1dbef5..fb0d1c2 100644
@@ -26,15 +26,13 @@
 
 #include <asm/hardware/arm_timer.h>
 
-#include <mach/platform.h>
-
 #include <plat/timer-sp.h>
 
 /*
- * How long is the timer interval?
+ * These timers are currently always setup to be clocked at 1MHz.
  */
-#define TIMER_RELOAD	(TICKS_PER_uSEC * mSEC_10)
-
+#define TIMER_FREQ_KHZ	(1000)
+#define TIMER_RELOAD	(TIMER_FREQ_KHZ * 1000 / HZ)
 
 static void __iomem *clksrc_base;
 
@@ -65,7 +63,7 @@ void __init sp804_clocksource_init(void __iomem *base)
 	writel(TIMER_CTRL_32BIT | TIMER_CTRL_ENABLE | TIMER_CTRL_PERIODIC,
 		clksrc_base + TIMER_CTRL);
 
-	cs->mult = clocksource_khz2mult(1000, cs->shift);
+	cs->mult = clocksource_khz2mult(TIMER_FREQ_KHZ, cs->shift);
 	clocksource_register(cs);
 }
 
@@ -149,7 +147,7 @@ void __init sp804_clockevents_init(void __iomem *base, unsigned int timer_irq)
 	clkevt_base = base;
 
 	evt->irq = timer_irq;
-	evt->mult = div_sc(1000000, NSEC_PER_SEC, evt->shift);
+	evt->mult = div_sc(TIMER_FREQ_KHZ, NSEC_PER_MSEC, evt->shift);
 	evt->max_delta_ns = clockevent_delta2ns(0xffffffff, evt);
 	evt->min_delta_ns = clockevent_delta2ns(0xf, evt);
 
#21 lore raw

PATCH 1/1 ARM: Integrator: convert Integrator/CP to use SP804 timer support

The Integrator/CP board has SP804-compatible timer modules, so use the SP804-compatible code from Versatile and Realview.

---
 arch/arm/mach-integrator/Kconfig         |    1 +
 arch/arm/mach-integrator/integrator_cp.c |   14 ++++++++++++--
 2 files changed, 13 insertions(+), 2 deletions(-)
arch/arm/mach-integrator/Kconfig +1 -0
index df97d16..27db275 100644
@@ -11,6 +11,7 @@ config ARCH_INTEGRATOR_AP
 config ARCH_INTEGRATOR_CP
 	bool "Support Integrator/CP platform"
 	select ARCH_CINTEGRATOR
+	select ARM_TIMER_SP804
 	help
 	  Include support for the ARM(R) Integrator CP platform.
 
arch/arm/mach-integrator/integrator_cp.c +12 -2
index a9ab8fd..a7575c4 100644
@@ -29,6 +29,7 @@
 #include <asm/irq.h>
 #include <asm/setup.h>
 #include <asm/mach-types.h>
+#include <asm/hardware/arm_timer.h>
 #include <asm/hardware/icst.h>
 
 #include <mach/cm.h>
@@ -40,6 +41,8 @@
 #include <asm/mach/map.h>
 #include <asm/mach/time.h>
 
+#include <plat/timer-sp.h>
+
 #include "common.h"
 
 #define INTCP_PA_FLASH_BASE		0x24000000
@@ -569,11 +572,18 @@ static void __init intcp_init(void)
 	}
 }
 
-#define TIMER_CTRL_IE	(1 << 5)			/* Interrupt Enable */
+#define TIMER0_VA_BASE __io_address(INTEGRATOR_TIMER0_BASE)
+#define TIMER1_VA_BASE __io_address(INTEGRATOR_TIMER1_BASE)
+#define TIMER2_VA_BASE __io_address(INTEGRATOR_TIMER2_BASE)
 
 static void __init intcp_timer_init(void)
 {
-	integrator_time_init(1000, TIMER_CTRL_IE);
+	writel(0, TIMER0_VA_BASE + TIMER_CTRL);
+	writel(0, TIMER1_VA_BASE + TIMER_CTRL);
+	writel(0, TIMER2_VA_BASE + TIMER_CTRL);
+
+	sp804_clocksource_init(TIMER2_VA_BASE);
+	sp804_clockevents_init(TIMER1_VA_BASE, IRQ_TIMERINT1);
 }
 
 static struct sys_timer cp_timer = {
#22 lore raw

PATCH 1/1 ARM: Integrator: move 16-bit timer support to Integrator/AP

Only Integrator/AP has 16-bit timers, so move the support into the Integrator/AP specific support files.

---
 arch/arm/mach-integrator/common.h        |    1 -
 arch/arm/mach-integrator/core.c          |  157 -----------------------------
 arch/arm/mach-integrator/integrator_ap.c |  158 +++++++++++++++++++++++++++++-
 arch/arm/mach-integrator/integrator_cp.c |    2 -
 4 files changed, 155 insertions(+), 163 deletions(-)
 delete mode 100644 arch/arm/mach-integrator/common.h
arch/arm/mach-integrator/common.h deleted +0 -1
deleted file mode 100644
index cdbe710..0000000
@@ -1 +0,0 @@
-extern void integrator_time_init(u32, unsigned int);
arch/arm/mach-integrator/core.c +0 -157

177 lines not on this page · raw message

arch/arm/mach-integrator/integrator_ap.c +155 -3

182 lines not on this page · raw message

arch/arm/mach-integrator/integrator_cp.c +0 -2
index a7575c4..5a5a8c1 100644
@@ -43,8 +43,6 @@
 
 #include <plat/timer-sp.h>
 
-#include "common.h"
-
 #define INTCP_PA_FLASH_BASE		0x24000000
 #define INTCP_FLASH_SIZE		SZ_32M
 
#23 lore raw

PATCH 1/1 ARM: Realview/Versatile: separate out common sched_clock()

Provide a common sched_clock() implementation for Versatile and Realview.

---
 arch/arm/mach-realview/core.c         |   16 ----------
 arch/arm/mach-versatile/core.c        |   22 -------------
 arch/arm/plat-versatile/Makefile      |    2 +
 arch/arm/plat-versatile/sched-clock.c |   53 +++++++++++++++++++++++++++++++++
 4 files changed, 55 insertions(+), 38 deletions(-)
 create mode 100644 arch/arm/plat-versatile/sched-clock.c
arch/arm/mach-realview/core.c +0 -16
index 80b8142..f97f001 100644
@@ -53,8 +53,6 @@
 
 #include "core.h"
 
-#define REALVIEW_REFCOUNTER	(__io_address(REALVIEW_SYS_BASE) + REALVIEW_SYS_24MHz_OFFSET)
-
 /* used by entry-macro.S and platsmp.c */
 void __iomem *gic_cpu_base_addr;
 
@@ -77,20 +75,6 @@ void __init realview_adjust_zones(int node, unsigned long *size,
 }
 #endif
 
-/*
- * This is the RealView sched_clock implementation.  This has
- * a resolution of 41.7ns, and a maximum value of about 179s.
- */
-unsigned long long sched_clock(void)
-{
-	unsigned long long v;
-
-	v = (unsigned long long)readl(REALVIEW_REFCOUNTER) * 125;
-	do_div(v, 3);
-
-	return v;
-}
-
 
 #define REALVIEW_FLASHCTRL    (__io_address(REALVIEW_SYS_BASE) + REALVIEW_SYS_FLASH_OFFSET)
 
arch/arm/mach-versatile/core.c +0 -22
index b68ddd3..490fc75 100644
@@ -28,7 +28,6 @@
 #include <linux/amba/clcd.h>
 #include <linux/amba/pl061.h>
 #include <linux/amba/mmci.h>
-#include <linux/cnt32_to_63.h>
 #include <linux/io.h>
 
 #include <asm/clkdev.h>
@@ -227,27 +226,6 @@ void __init versatile_map_io(void)
 	iotable_init(versatile_io_desc, ARRAY_SIZE(versatile_io_desc));
 }
 
-#define VERSATILE_REFCOUNTER	(__io_address(VERSATILE_SYS_BASE) + VERSATILE_SYS_24MHz_OFFSET)
-
-/*
- * This is the Versatile sched_clock implementation.  This has
- * a resolution of 41.7ns, and a maximum value of about 35583 days.
- *
- * The return value is guaranteed to be monotonic in that range as
- * long as there is always less than 89 seconds between successive
- * calls to this function.
- */
-unsigned long long sched_clock(void)
-{
-	unsigned long long v = cnt32_to_63(readl(VERSATILE_REFCOUNTER));
-
-	/* the <<1 gets rid of the cnt_32_to_63 top bit saving on a bic insn */
-	v *= 125<<1;
-	do_div(v, 3<<1);
-
-	return v;
-}
-
 
 #define VERSATILE_FLASHCTRL    (__io_address(VERSATILE_SYS_BASE) + VERSATILE_SYS_FLASH_OFFSET)
 
arch/arm/plat-versatile/Makefile +2 -0
index 334d2f1..9b1a668 100644
@@ -1,2 +1,4 @@
 obj-y	:= clock.o
 obj-$(CONFIG_ARM_TIMER_SP804) += timer-sp.o
+obj-$(CONFIG_ARCH_REALVIEW) += sched-clock.o
+obj-$(CONFIG_ARCH_VERSATILE) += sched-clock.o
arch/arm/plat-versatile/sched-clock.c new file +53 -0

53 lines not on this page · raw message

#24 lore raw

PATCH 1/1 ARM: Make Integrator/Versatile/Reaview VCO code similar

---
 arch/arm/mach-integrator/impd1.c               |   16 ++++------------
 arch/arm/mach-integrator/include/mach/clkdev.h |    3 ++-
 arch/arm/mach-integrator/integrator_cp.c       |    9 +++++----
 arch/arm/mach-realview/core.c                  |   16 ++++++++--------
 arch/arm/mach-realview/include/mach/clkdev.h   |    2 +-
 arch/arm/mach-versatile/core.c                 |   10 +++++-----
 arch/arm/mach-versatile/include/mach/clkdev.h  |    2 +-
 7 files changed, 26 insertions(+), 32 deletions(-)
arch/arm/mach-integrator/impd1.c +4 -12
index 3e21102..2f9de62 100644
@@ -55,20 +55,10 @@ static const struct icst_params impd1_vco_params = {
 static void impd1_setvco(struct clk *clk, struct icst_vco vco)
 {
 	struct impd1_module *impd1 = clk->data;
-	int vconr = clk - impd1->vcos;
-	u32 val;
-
-	val = vco.v | (vco.r << 9) | (vco.s << 16);
+	u32 val = vco.v | (vco.r << 9) | (vco.s << 16);
 
 	writel(0xa05f, impd1->base + IMPD1_LOCK);
-	switch (vconr) {
-	case 0:
-		writel(val, impd1->base + IMPD1_OSC1);
-		break;
-	case 1:
-		writel(val, impd1->base + IMPD1_OSC2);
-		break;
-	}
+	writel(val, clk->vcoreg);
 	writel(0, impd1->base + IMPD1_LOCK);
 
 #ifdef DEBUG
@@ -381,6 +371,8 @@ static int impd1_probe(struct lm_device *dev)
 		impd1->vcos[i].data = impd1,
 		impd1->vcos[i].setvco = impd1_setvco;
 	}
+	impd1->vcos[0].vcoreg = impd1->base + IMPD1_OSC1;
+	impd1->vcos[1].vcoreg = impd1->base + IMPD1_OSC2;
 
 	impd1->clks[0] = clkdev_alloc(&impd1->vcos[0], NULL, "lm%x:01000",
 					dev->id);
arch/arm/mach-integrator/include/mach/clkdev.h +2 -1
index 89ea938..ed67e8e 100644
@@ -8,8 +8,9 @@ struct clk {
 	unsigned long		rate;
 	struct module		*owner;
 	const struct icst_params *params;
-	void			*data;
+	void __iomem		*vcoreg;
 	void			(*setvco)(struct clk *, struct icst_vco vco);
+	void			*data;
 };
 
 static inline int __clk_get(struct clk *clk)
arch/arm/mach-integrator/integrator_cp.c +5 -4
index 5a5a8c1..5908580 100644
@@ -266,8 +266,8 @@ static void __init intcp_init_irq(void)
 /*
  * Clock handling
  */
-#define CM_LOCK IO_ADDRESS(INTEGRATOR_HDR_LOCK)
-#define CM_AUXOSC IO_ADDRESS(INTEGRATOR_HDR_BASE + 0x1c)
+#define CM_LOCK		(__io_address(INTEGRATOR_HDR_BASE)+INTEGRATOR_HDR_LOCK_OFFSET)
+#define CM_AUXOSC	(__io_address(INTEGRATOR_HDR_BASE)+0x1c)
 
 static const struct icst_params cp_auxvco_params = {
 	.ref		= 24000000,
@@ -285,16 +285,17 @@ static void cp_auxvco_set(struct clk *clk, struct icst_vco vco)
 {
 	u32 val;
 
-	val = readl(CM_AUXOSC) & ~0x7ffff;
+	val = readl(clk->vcoreg) & ~0x7ffff;
 	val |= vco.v | (vco.r << 9) | (vco.s << 16);
 
 	writel(0xa05f, CM_LOCK);
-	writel(val, CM_AUXOSC);
+	writel(val, clk->vcoreg);
 	writel(0, CM_LOCK);
 }
 
 static struct clk cp_auxclk = {
 	.params	= &cp_auxvco_params,
+	.vcoreg	= CM_AUXOSC,
 	.setvco = cp_auxvco_set,
 };
 
arch/arm/mach-realview/core.c +8 -8
index f97f001..043b93b 100644
@@ -271,19 +271,13 @@ static const struct icst_params realview_oscvco_params = {
 static void realview_oscvco_set(struct clk *clk, struct icst_vco vco)
 {
 	void __iomem *sys_lock = __io_address(REALVIEW_SYS_BASE) + REALVIEW_SYS_LOCK_OFFSET;
-	void __iomem *sys_osc;
 	u32 val;
 
-	if (machine_is_realview_pb1176())
-		sys_osc = __io_address(REALVIEW_SYS_BASE) + REALVIEW_SYS_OSC0_OFFSET;
-	else
-		sys_osc = __io_address(REALVIEW_SYS_BASE) + REALVIEW_SYS_OSC4_OFFSET;
-
-	val = readl(sys_osc) & ~0x7ffff;
+	val = readl(clk->vcoreg) & ~0x7ffff;
 	val |= vco.v | (vco.r << 9) | (vco.s << 16);
 
 	writel(0xa05f, sys_lock);
-	writel(val, sys_osc);
+	writel(val, clk->vcoreg);
 	writel(0, sys_lock);
 }
 
@@ -332,7 +326,13 @@ static struct clk_lookup lookups[] = {
 
 static int __init clk_init(void)
 {
+	if (machine_is_realview_pb1176())
+		oscvco_clk.vcoreg = __io_address(REALVIEW_SYS_BASE) + REALVIEW_SYS_OSC0_OFFSET;
+	else
+		oscvco_clk.vcoreg = __io_address(REALVIEW_SYS_BASE) + REALVIEW_SYS_OSC4_OFFSET;
+
 	clkdev_add_table(lookups, ARRAY_SIZE(lookups));
+
 	return 0;
 }
 arch_initcall(clk_init);
arch/arm/mach-realview/include/mach/clkdev.h +1 -1
index fefe467..baea03c 100644
@@ -6,7 +6,7 @@
 struct clk {
 	unsigned long		rate;
 	const struct icst_params *params;
-	u32			oscoff;
+	void __iomem		*vcoreg;
 	void			(*setvco)(struct clk *, struct icst_vco vco);
 };
 
arch/arm/mach-versatile/core.c +5 -5
index 490fc75..957bbde 100644
@@ -370,21 +370,19 @@ static const struct icst_params versatile_oscvco_params = {
 
 static void versatile_oscvco_set(struct clk *clk, struct icst_vco vco)
 {
-	void __iomem *sys = __io_address(VERSATILE_SYS_BASE);
-	void __iomem *sys_lock = sys + VERSATILE_SYS_LOCK_OFFSET;
+	void __iomem *sys_lock = __io_address(VERSATILE_SYS_BASE) + VERSATILE_SYS_LOCK_OFFSET;
 	u32 val;
 
-	val = readl(sys + clk->oscoff) & ~0x7ffff;
+	val = readl(clk->vcoreg) & ~0x7ffff;
 	val |= vco.v | (vco.r << 9) | (vco.s << 16);
 
 	writel(0xa05f, sys_lock);
-	writel(val, sys + clk->oscoff);
+	writel(val, clk->vcoreg);
 	writel(0, sys_lock);
 }
 
 static struct clk osc4_clk = {
 	.params	= &versatile_oscvco_params,
-	.oscoff	= VERSATILE_SYS_OSCCLCD_OFFSET,
 	.setvco	= versatile_oscvco_set,
 };
 
@@ -831,6 +829,8 @@ void __init versatile_init(void)
 {
 	int i;
 
+	osc4_clk.vcoreg	= __io_address(VERSATILE_SYS_BASE) + VERSATILE_SYS_OSCCLCD_OFFSET;
+
 	clkdev_add_table(lookups, ARRAY_SIZE(lookups));
 
 	platform_device_register(&versatile_flash_device);
arch/arm/mach-versatile/include/mach/clkdev.h +1 -1
index fefe467..baea03c 100644
@@ -6,7 +6,7 @@
 struct clk {
 	unsigned long		rate;
 	const struct icst_params *params;
-	u32			oscoff;
+	void __iomem		*vcoreg;
 	void			(*setvco)(struct clk *, struct icst_vco vco);
 };
 
#25 lore raw

PATCH 1/1 ARM: 5890/1: Fix incorrect Realview board IRQs for L220 and PMU

From: Will Deacon <[email protected]>

In anticipation of PMU support for Realview boards, the IRQs defined for some of these boards need updating.

This patch removes incorrect L220 IRQ definitions, corrects incorrect PMU IRQs and adds any missing IRQs that are required.

---
 arch/arm/mach-realview/include/mach/irqs-pb1176.h |    1 +
 arch/arm/mach-realview/include/mach/irqs-pba8.h   |    8 ++------
 arch/arm/mach-realview/include/mach/irqs-pbx.h    |   14 ++++----------
 3 files changed, 7 insertions(+), 16 deletions(-)
arch/arm/mach-realview/include/mach/irqs-pb1176.h +1 -0
index 2410d4f..830055b 100644
@@ -31,6 +31,7 @@
 #define IRQ_DC1176_SOFTINT	(IRQ_DC1176_GIC_START + 1)	/* Software interrupt */
 #define IRQ_DC1176_COMMRx	(IRQ_DC1176_GIC_START + 2)	/* Debug Comm Rx interrupt */
 #define IRQ_DC1176_COMMTx	(IRQ_DC1176_GIC_START + 3)	/* Debug Comm Tx interrupt */
+#define IRQ_DC1176_CORE_PMU	(IRQ_DC1176_GIC_START + 7)	/* Core PMU interrupt */
 #define IRQ_DC1176_TIMER0	(IRQ_DC1176_GIC_START + 8)	/* Timer 0 */
 #define IRQ_DC1176_TIMER1	(IRQ_DC1176_GIC_START + 9)	/* Timer 1 */
 #define IRQ_DC1176_TIMER2	(IRQ_DC1176_GIC_START + 10)	/* Timer 2 */
arch/arm/mach-realview/include/mach/irqs-pba8.h +2 -6
index 86792a9..4a88a4e 100644
@@ -23,12 +23,6 @@
 
 #define IRQ_PBA8_GIC_START			32
 
-/* L220
-#define IRQ_PBA8_L220_EVENT	(IRQ_PBA8_GIC_START + 29)
-#define IRQ_PBA8_L220_SLAVE	(IRQ_PBA8_GIC_START + 30)
-#define IRQ_PBA8_L220_DECODE	(IRQ_PBA8_GIC_START + 31)
-*/
-
 /*
  * PB-A8 on-board gic irq sources
  */
@@ -65,6 +59,8 @@
 #define IRQ_PBA8_TSPEN		(IRQ_PBA8_GIC_START + 30)	/* Touchscreen pen */
 #define IRQ_PBA8_TSKPAD		(IRQ_PBA8_GIC_START + 31)	/* Touchscreen keypad */
 
+#define IRQ_PBA8_PMU		(IRQ_PBA8_GIC_START + 47)	/* Cortex-A8 PMU */
+
 /* ... */
 #define IRQ_PBA8_PCI0		(IRQ_PBA8_GIC_START + 50)
 #define IRQ_PBA8_PCI1		(IRQ_PBA8_GIC_START + 51)
arch/arm/mach-realview/include/mach/irqs-pbx.h +4 -10
index deaad43..206a300 100644
@@ -22,12 +22,6 @@
 
 #define IRQ_PBX_GIC_START			32
 
-/* L220
-#define IRQ_PBX_L220_EVENT	(IRQ_PBX_GIC_START + 29)
-#define IRQ_PBX_L220_SLAVE	(IRQ_PBX_GIC_START + 30)
-#define IRQ_PBX_L220_DECODE	(IRQ_PBX_GIC_START + 31)
-*/
-
 /*
  * PBX on-board gic irq sources
  */
@@ -77,10 +71,10 @@
 #define IRQ_PBX_TIMER4_5        (IRQ_PBX_GIC_START + 41)        /* Timer 0/1 (default timer) */
 #define IRQ_PBX_TIMER6_7        (IRQ_PBX_GIC_START + 42)        /* Timer 2/3 */
 /* ... */
-#define IRQ_PBX_PMU_CPU3        (IRQ_PBX_GIC_START + 44)        /* CPU PMU Interrupts */
-#define IRQ_PBX_PMU_CPU2        (IRQ_PBX_GIC_START + 45)
-#define IRQ_PBX_PMU_CPU1        (IRQ_PBX_GIC_START + 46)
-#define IRQ_PBX_PMU_CPU0        (IRQ_PBX_GIC_START + 47)
+#define IRQ_PBX_PMU_CPU0        (IRQ_PBX_GIC_START + 44)        /* CPU PMU Interrupts */
+#define IRQ_PBX_PMU_CPU1        (IRQ_PBX_GIC_START + 45)
+#define IRQ_PBX_PMU_CPU2        (IRQ_PBX_GIC_START + 46)
+#define IRQ_PBX_PMU_CPU3        (IRQ_PBX_GIC_START + 47)
 
 /* ... */
 #define IRQ_PBX_PCI0		(IRQ_PBX_GIC_START + 50)
#26 lore raw

PATCH 1/1 Video: ARM CLCD: Better fix for swapped IENB and CNTL registers

On PL111, as found on Realview and other platforms, these registers are always arranged as CNTL then IENB. On PL110, these registers are IENB then CNTL, except on Versatile platforms.

Re-arrange the handling of these register swaps so that PL111 always gets it right without resorting to ifdefs, leaving the only case needing special handling being PL110 on Versatile.

Fill out amba/clcd.h with the PL110/PL111 register definition differences in case someone tries to use the PL110 specific definitions on PL111.

---
 drivers/video/amba-clcd.c |   31 ++++++++++++++++++++++++-------
 include/linux/amba/clcd.h |   33 +++++++++++++++++----------------
 2 files changed, 41 insertions(+), 23 deletions(-)
drivers/video/amba-clcd.c +24 -7
index a21efcd..afe21e6 100644
@@ -65,16 +65,16 @@ static void clcdfb_disable(struct clcd_fb *fb)
 	if (fb->board->disable)
 		fb->board->disable(fb);
 
-	val = readl(fb->regs + CLCD_CNTL);
+	val = readl(fb->regs + fb->off_cntl);
 	if (val & CNTL_LCDPWR) {
 		val &= ~CNTL_LCDPWR;
-		writel(val, fb->regs + CLCD_CNTL);
+		writel(val, fb->regs + fb->off_cntl);
 
 		clcdfb_sleep(20);
 	}
 	if (val & CNTL_LCDEN) {
 		val &= ~CNTL_LCDEN;
-		writel(val, fb->regs + CLCD_CNTL);
+		writel(val, fb->regs + fb->off_cntl);
 	}
 
 	/*
@@ -94,7 +94,7 @@ static void clcdfb_enable(struct clcd_fb *fb, u32 cntl)
 	 * Bring up by first enabling..
 	 */
 	cntl |= CNTL_LCDEN;
-	writel(cntl, fb->regs + CLCD_CNTL);
+	writel(cntl, fb->regs + fb->off_cntl);
 
 	clcdfb_sleep(20);
 
@@ -102,7 +102,7 @@ static void clcdfb_enable(struct clcd_fb *fb, u32 cntl)
 	 * and now apply power.
 	 */
 	cntl |= CNTL_LCDPWR;
-	writel(cntl, fb->regs + CLCD_CNTL);
+	writel(cntl, fb->regs + fb->off_cntl);
 
 	/*
 	 * finally, enable the interface.
@@ -233,7 +233,7 @@ static int clcdfb_set_par(struct fb_info *info)
 		readl(fb->regs + CLCD_TIM0), readl(fb->regs + CLCD_TIM1),
 		readl(fb->regs + CLCD_TIM2), readl(fb->regs + CLCD_TIM3),
 		readl(fb->regs + CLCD_UBAS), readl(fb->regs + CLCD_LBAS),
-		readl(fb->regs + CLCD_IENB), readl(fb->regs + CLCD_CNTL));
+		readl(fb->regs + fb->off_ienb), readl(fb->regs + fb->off_cntl));
 #endif
 
 	return 0;
@@ -345,6 +345,23 @@ static int clcdfb_register(struct clcd_fb *fb)
 {
 	int ret;
 
+	/*
+	 * ARM PL111 always has IENB at 0x1c; it's only PL110
+	 * which is reversed on some platforms.
+	 */
+	if (amba_manf(fb->dev) == 0x41 && amba_part(fb->dev) == 0x111) {
+		fb->off_ienb = CLCD_PL111_IENB;
+		fb->off_cntl = CLCD_PL111_CNTL;
+	} else {
+#ifdef CONFIG_ARCH_VERSATILE
+		fb->off_ienb = CLCD_PL111_IENB;
+		fb->off_cntl = CLCD_PL111_CNTL;
+#else
+		fb->off_ienb = CLCD_PL110_IENB;
+		fb->off_cntl = CLCD_PL110_CNTL;
+#endif
+	}
+
 	fb->clk = clk_get(&fb->dev->dev, NULL);
 	if (IS_ERR(fb->clk)) {
 		ret = PTR_ERR(fb->clk);
@@ -416,7 +433,7 @@ static int clcdfb_register(struct clcd_fb *fb)
 	/*
 	 * Ensure interrupts are disabled.
 	 */
-	writel(0, fb->regs + CLCD_IENB);
+	writel(0, fb->regs + fb->off_ienb);
 
 	fb_set_var(&fb->fb, &fb->fb.var);
 
include/linux/amba/clcd.h +17 -16
index 29c0448..ca16c38 100644
@@ -21,22 +21,21 @@
 #define CLCD_UBAS 		0x00000010
 #define CLCD_LBAS 		0x00000014
 
-#if !defined(CONFIG_ARCH_VERSATILE) && !defined(CONFIG_ARCH_REALVIEW)
-#define CLCD_IENB 		0x00000018
-#define CLCD_CNTL 		0x0000001c
-#else
-/*
- * Someone rearranged these two registers on the Versatile
- * platform...
- */
-#define CLCD_IENB 		0x0000001c
-#define CLCD_CNTL 		0x00000018
-#endif
-
-#define CLCD_STAT 		0x00000020
-#define CLCD_INTR 		0x00000024
-#define CLCD_UCUR 		0x00000028
-#define CLCD_LCUR 		0x0000002C
+#define CLCD_PL110_IENB		0x00000018
+#define CLCD_PL110_CNTL		0x0000001c
+#define CLCD_PL110_STAT		0x00000020
+#define CLCD_PL110_INTR 	0x00000024
+#define CLCD_PL110_UCUR		0x00000028
+#define CLCD_PL110_LCUR		0x0000002C
+
+#define CLCD_PL111_CNTL		0x00000018
+#define CLCD_PL111_IENB		0x0000001c
+#define CLCD_PL111_RIS		0x00000020
+#define CLCD_PL111_MIS		0x00000024
+#define CLCD_PL111_ICR		0x00000028
+#define CLCD_PL111_UCUR		0x0000002c
+#define CLCD_PL111_LCUR		0x00000030
+
 #define CLCD_PALL 		0x00000200
 #define CLCD_PALETTE		0x00000200
 
@@ -147,6 +146,8 @@ struct clcd_fb {
 	struct clcd_board	*board;
 	void			*board_data;
 	void __iomem		*regs;
+	u16			off_ienb;
+	u16			off_cntl;
 	u32			clcd_cntl;
 	u32			cmap[16];
 };
#27 lore raw

PATCH 1/1 ARM: Add L2 cache handling to smp boot support

The page table and secondary data which we're asking the secondary CPU to make use of has to hit RAM to ensure that the secondary CPU can see it since it may not be taking part in coherency or cache searches at this point.

---
 arch/arm/kernel/smp.c |    4 +++-
 1 files changed, 3 insertions(+), 1 deletions(-)
arch/arm/kernel/smp.c +3 -1
index 57162af..577543f 100644
@@ -99,6 +99,7 @@ int __cpuinit __cpu_up(unsigned int cpu)
 	*pmd = __pmd((PHYS_OFFSET & PGDIR_MASK) |
 		     PMD_TYPE_SECT | PMD_SECT_AP_WRITE);
 	flush_pmd_entry(pmd);
+	outer_clean_range(__pa(pmd), __pa(pmd + 1));
 
 	/*
 	 * We need to tell the secondary core where to find
@@ -106,7 +107,8 @@ int __cpuinit __cpu_up(unsigned int cpu)
 	 */
 	secondary_data.stack = task_stack_page(idle) + THREAD_START_SP;
 	secondary_data.pgdir = virt_to_phys(pgd);
-	wmb();
+	__cpuc_flush_dcache_area(&secondary_data, sizeof(secondary_data));
+	outer_clean_range(__pa(&secondary_data), __pa(&secondary_data + 1));
 
 	/*
 	 * Now bring the CPU into our world.
#28 lore raw

PATCH 1/1 ARM: Indirect round/set_rate operations through clk structure

---
 arch/arm/mach-integrator/impd1.c               |   10 +++++-
 arch/arm/mach-integrator/include/mach/clkdev.h |    4 +-
 arch/arm/mach-integrator/integrator_cp.c       |    8 ++++-
 arch/arm/mach-realview/core.c                  |    8 ++++-
 arch/arm/mach-realview/include/mach/clkdev.h   |    4 +-
 arch/arm/mach-versatile/core.c                 |    8 ++++-
 arch/arm/mach-versatile/include/mach/clkdev.h  |    4 +-
 arch/arm/plat-versatile/clock.c                |   38 ++++++++++++++++-------
 arch/arm/plat-versatile/include/plat/clock.h   |   15 +++++++++
 9 files changed, 76 insertions(+), 23 deletions(-)
 create mode 100644 arch/arm/plat-versatile/include/plat/clock.h
arch/arm/mach-integrator/impd1.c +8 -2
index 2f9de62..1a0ee93 100644
@@ -71,6 +71,12 @@ static void impd1_setvco(struct clk *clk, struct icst_vco vco)
 #endif
 }
 
+static const struct clk_ops impd1_clk_ops = {
+	.round	= icst_clk_round,
+	.set	= icst_clk_set,
+	.setvco	= impd1_setvco,
+};
+
 void impd1_tweak_control(struct device *dev, u32 mask, u32 val)
 {
 	struct impd1_module *impd1 = dev_get_drvdata(dev);
@@ -366,10 +372,10 @@ static int impd1_probe(struct lm_device *dev)
 		(unsigned long)dev->resource.start);
 
 	for (i = 0; i < ARRAY_SIZE(impd1->vcos); i++) {
+		impd1->vcos[i].ops = &impd1_clk_ops,
 		impd1->vcos[i].owner = THIS_MODULE,
 		impd1->vcos[i].params = &impd1_vco_params,
-		impd1->vcos[i].data = impd1,
-		impd1->vcos[i].setvco = impd1_setvco;
+		impd1->vcos[i].data = impd1;
 	}
 	impd1->vcos[0].vcoreg = impd1->base + IMPD1_OSC1;
 	impd1->vcos[1].vcoreg = impd1->base + IMPD1_OSC2;
arch/arm/mach-integrator/include/mach/clkdev.h +2 -2
index ed67e8e..bfe0767 100644
@@ -2,14 +2,14 @@
 #define __ASM_MACH_CLKDEV_H
 
 #include <linux/module.h>
-#include <asm/hardware/icst.h>
+#include <plat/clock.h>
 
 struct clk {
 	unsigned long		rate;
+	const struct clk_ops	*ops;
 	struct module		*owner;
 	const struct icst_params *params;
 	void __iomem		*vcoreg;
-	void			(*setvco)(struct clk *, struct icst_vco vco);
 	void			*data;
 };
 
arch/arm/mach-integrator/integrator_cp.c +7 -1
index 5908580..54edb6b 100644
@@ -293,10 +293,16 @@ static void cp_auxvco_set(struct clk *clk, struct icst_vco vco)
 	writel(0, CM_LOCK);
 }
 
+static const struct clk_ops cp_auxclk_ops = {
+	.round	= icst_clk_round,
+	.set	= icst_clk_set,
+	.setvco	= cp_auxvco_set,
+};
+
 static struct clk cp_auxclk = {
+	.ops	= &cp_auxclk_ops,
 	.params	= &cp_auxvco_params,
 	.vcoreg	= CM_AUXOSC,
-	.setvco = cp_auxvco_set,
 };
 
 static struct clk_lookup cp_lookups[] = {
arch/arm/mach-realview/core.c +7 -1
index 043b93b..1b468bd 100644
@@ -281,9 +281,15 @@ static void realview_oscvco_set(struct clk *clk, struct icst_vco vco)
 	writel(0, sys_lock);
 }
 
+static const struct clk_ops oscvco_clk_ops = {
+	.round	= icst_clk_round,
+	.set	= icst_clk_set,
+	.setvco	= realview_oscvco_set,
+};
+
 static struct clk oscvco_clk = {
+	.ops	= &oscvco_clk_ops,
 	.params	= &realview_oscvco_params,
-	.setvco = realview_oscvco_set,
 };
 
 /*
arch/arm/mach-realview/include/mach/clkdev.h +2 -2
index baea03c..e58d077 100644
@@ -1,13 +1,13 @@
 #ifndef __ASM_MACH_CLKDEV_H
 #define __ASM_MACH_CLKDEV_H
 
-#include <asm/hardware/icst.h>
+#include <plat/clock.h>
 
 struct clk {
 	unsigned long		rate;
+	const struct clk_ops	*ops;
 	const struct icst_params *params;
 	void __iomem		*vcoreg;
-	void			(*setvco)(struct clk *, struct icst_vco vco);
 };
 
 #define __clk_get(clk) ({ 1; })
arch/arm/mach-versatile/core.c +7 -1
index 957bbde..60baba6 100644
@@ -381,9 +381,15 @@ static void versatile_oscvco_set(struct clk *clk, struct icst_vco vco)
 	writel(0, sys_lock);
 }
 
+static const struct clk_ops osc4_clk_ops = {
+	.round	= icst_clk_round,
+	.set	= icst_clk_set,
+	.setvco	= versatile_oscvco_set,
+};
+
 static struct clk osc4_clk = {
+	.ops	= &osc4_clk_ops,
 	.params	= &versatile_oscvco_params,
-	.setvco	= versatile_oscvco_set,
 };
 
 /*
arch/arm/mach-versatile/include/mach/clkdev.h +2 -2
index baea03c..e58d077 100644
@@ -1,13 +1,13 @@
 #ifndef __ASM_MACH_CLKDEV_H
 #define __ASM_MACH_CLKDEV_H
 
-#include <asm/hardware/icst.h>
+#include <plat/clock.h>
 
 struct clk {
 	unsigned long		rate;
+	const struct clk_ops	*ops;
 	const struct icst_params *params;
 	void __iomem		*vcoreg;
-	void			(*setvco)(struct clk *, struct icst_vco vco);
 };
 
 #define __clk_get(clk) ({ 1; })
arch/arm/plat-versatile/clock.c +26 -12
index 2fa34de..5c8b656 100644
@@ -37,24 +37,38 @@ EXPORT_SYMBOL(clk_get_rate);
 
 long clk_round_rate(struct clk *clk, unsigned long rate)
 {
-	struct icst_vco vco;
-	vco = icst_hz_to_vco(clk->params, rate);
-	return icst_hz(clk->params, vco);
+	long ret = -EIO;
+	if (clk->ops && clk->ops->round)
+		ret = clk->ops->round(clk, rate);
+	return ret;
 }
 EXPORT_SYMBOL(clk_round_rate);
 
 int clk_set_rate(struct clk *clk, unsigned long rate)
 {
 	int ret = -EIO;
-
-	if (clk->setvco) {
-		struct icst_vco vco;
-
-		vco = icst_hz_to_vco(clk->params, rate);
-		clk->rate = icst_hz(clk->params, vco);
-		clk->setvco(clk, vco);
-		ret = 0;
-	}
+	if (clk->ops && clk->ops->set)
+		ret = clk->ops->set(clk, rate);
 	return ret;
 }
 EXPORT_SYMBOL(clk_set_rate);
+
+long icst_clk_round(struct clk *clk, unsigned long rate)
+{
+	struct icst_vco vco;
+	vco = icst_hz_to_vco(clk->params, rate);
+	return icst_hz(clk->params, vco);
+}
+EXPORT_SYMBOL(icst_clk_round);
+
+int icst_clk_set(struct clk *clk, unsigned long rate)
+{
+	struct icst_vco vco;
+
+	vco = icst_hz_to_vco(clk->params, rate);
+	clk->rate = icst_hz(clk->params, vco);
+	clk->ops->setvco(clk, vco);
+
+	return 0;
+}
+EXPORT_SYMBOL(icst_clk_set);
arch/arm/plat-versatile/include/plat/clock.h new file +15 -0
new file mode 100644
index 0000000..3cfb024
@@ -0,0 +1,15 @@
+#ifndef PLAT_CLOCK_H
+#define PLAT_CLOCK_H
+
+#include <asm/hardware/icst.h>
+
+struct clk_ops {
+	long	(*round)(struct clk *, unsigned long);
+	int	(*set)(struct clk *, unsigned long);
+	void	(*setvco)(struct clk *, struct icst_vco);
+};
+
+int icst_clk_set(struct clk *, unsigned long);
+long icst_clk_round(struct clk *, unsigned long);
+
+#endif

A message that is not in the archive (sent off-list or not yet received): git-1267729916-eaa5eec739637f32f8733d528ff0b94fd62b1214@rmk-PC

#30 lore raw

PATCH 1/1 Merge branch 'origin' into versatile

---
Patch suppressed due to merge commit

#31 lore raw

PATCH 1/1 ARM: Add Versatile Express support

---
 arch/arm/Kconfig                                  |   16 +
 arch/arm/Makefile                                 |    1 +
 arch/arm/mach-vexpress/Kconfig                    |    4 +
 arch/arm/mach-vexpress/Makefile                   |    5 +
 arch/arm/mach-vexpress/Makefile.boot              |    3 +
 arch/arm/mach-vexpress/core.h                     |   26 ++
 arch/arm/mach-vexpress/include/mach/clkdev.h      |   16 +
 arch/arm/mach-vexpress/include/mach/debug-macro.S |   23 ++
 arch/arm/mach-vexpress/include/mach/entry-macro.S |   67 +++++
 arch/arm/mach-vexpress/include/mach/hardware.h    |    1 +
 arch/arm/mach-vexpress/include/mach/io.h          |   28 ++
 arch/arm/mach-vexpress/include/mach/irqs.h        |    4 +
 arch/arm/mach-vexpress/include/mach/memory.h      |   25 ++
 arch/arm/mach-vexpress/include/mach/motherboard.h |  121 ++++++++
 arch/arm/mach-vexpress/include/mach/system.h      |   37 +++
 arch/arm/mach-vexpress/include/mach/timex.h       |   23 ++
 arch/arm/mach-vexpress/include/mach/uncompress.h  |   52 ++++
 arch/arm/mach-vexpress/include/mach/vmalloc.h     |   21 ++
 arch/arm/mach-vexpress/v2m.c                      |  319 +++++++++++++++++++++
 drivers/i2c/busses/Kconfig                        |    2 +-
 20 files changed, 793 insertions(+), 1 deletions(-)
 create mode 100644 arch/arm/mach-vexpress/Kconfig
 create mode 100644 arch/arm/mach-vexpress/Makefile
 create mode 100644 arch/arm/mach-vexpress/Makefile.boot
 create mode 100644 arch/arm/mach-vexpress/core.h
 create mode 100644 arch/arm/mach-vexpress/include/mach/clkdev.h
 create mode 100644 arch/arm/mach-vexpress/include/mach/debug-macro.S
 create mode 100644 arch/arm/mach-vexpress/include/mach/entry-macro.S
 create mode 100644 arch/arm/mach-vexpress/include/mach/hardware.h
 create mode 100644 arch/arm/mach-vexpress/include/mach/io.h
 create mode 100644 arch/arm/mach-vexpress/include/mach/irqs.h
 create mode 100644 arch/arm/mach-vexpress/include/mach/memory.h
 create mode 100644 arch/arm/mach-vexpress/include/mach/motherboard.h
 create mode 100644 arch/arm/mach-vexpress/include/mach/system.h
 create mode 100644 arch/arm/mach-vexpress/include/mach/timex.h
 create mode 100644 arch/arm/mach-vexpress/include/mach/uncompress.h
 create mode 100644 arch/arm/mach-vexpress/include/mach/vmalloc.h
 create mode 100644 arch/arm/mach-vexpress/v2m.c
arch/arm/Kconfig +16 -0
index 28fc082..2213d61 100644
@@ -269,6 +269,20 @@ config ARCH_VERSATILE
 	help
 	  This enables support for ARM Ltd Versatile board.
 
+config ARCH_VEXPRESS
+	bool "ARM Ltd. Versatile Express family"
+	select ARCH_WANT_OPTIONAL_GPIOLIB
+	select ARM_AMBA
+	select ARM_TIMER_SP804
+	select COMMON_CLKDEV
+	select GENERIC_CLOCKEVENTS
+	select GENERIC_TIME
+	select HAVE_CLK
+	select ICST
+	select PLAT_VERSATILE
+	help
+	  This enables support for the ARM Ltd Versatile Express boards.
+
 config ARCH_AT91
 	bool "Atmel AT91"
 	select GENERIC_GPIO
@@ -865,6 +879,8 @@ source "arch/arm/mach-ux500/Kconfig"
 
 source "arch/arm/mach-versatile/Kconfig"
 
+source "arch/arm/mach-vexpress/Kconfig"
+
 source "arch/arm/mach-w90x900/Kconfig"
 
 # Definitions to make life easier
arch/arm/Makefile +1 -0
index f19125e..710340c 100644
@@ -170,6 +170,7 @@ machine-$(CONFIG_ARCH_STMP37XX)		:= stmp37xx
 machine-$(CONFIG_ARCH_U300)		:= u300
 machine-$(CONFIG_ARCH_U8500)		:= ux500
 machine-$(CONFIG_ARCH_VERSATILE)	:= versatile
+machine-$(CONFIG_ARCH_VEXPRESS)		:= vexpress
 machine-$(CONFIG_ARCH_W90X900)		:= w90x900
 machine-$(CONFIG_ARCH_NUC93X)		:= nuc93x
 machine-$(CONFIG_FOOTBRIDGE)		:= footbridge
arch/arm/mach-vexpress/Kconfig new file +4 -0
new file mode 100644
index 0000000..751858c
@@ -0,0 +1,4 @@
+menu "Versatile Express platform type"
+	depends on ARCH_VEXPRESS
+
+endmenu
arch/arm/mach-vexpress/Makefile new file +5 -0
new file mode 100644
index 0000000..b47cf73
@@ -0,0 +1,5 @@
+#
+# Makefile for the linux kernel.
+#
+
+obj-y					:= v2m.o
arch/arm/mach-vexpress/Makefile.boot new file +3 -0
new file mode 100644
index 0000000..07c2d9c
@@ -0,0 +1,3 @@
+   zreladdr-y	:= 0x60008000
+params_phys-y	:= 0x60000100
+initrd_phys-y	:= 0x60800000
arch/arm/mach-vexpress/core.h new file +26 -0
new file mode 100644
index 0000000..57dd95c
@@ -0,0 +1,26 @@
+#define __MMIO_P2V(x)	(((x) & 0xfffff) | (((x) & 0x0f000000) >> 4) | 0xf8000000)
+#define MMIO_P2V(x)	((void __iomem *)__MMIO_P2V(x))
+
+#define AMBA_DEVICE(name,busid,base,plat)	\
+struct amba_device name##_device = {		\
+	.dev		= {			\
+		.coherent_dma_mask = ~0UL,	\
+		.init_name = busid,		\
+		.platform_data = plat,		\
+	},					\
+	.res		= {			\
+		.start	= base,			\
+		.end	= base + SZ_4K - 1,	\
+		.flags	= IORESOURCE_MEM,	\
+	},					\
+	.dma_mask	= ~0UL,			\
+	.irq		= IRQ_##base,		\
+	/* .dma		= DMA_##base,*/		\
+}
+
+struct map_desc;
+
+void v2m_map_io(struct map_desc *tile, size_t num);
+extern struct sys_timer v2m_timer;
+
+extern void __iomem *gic_cpu_base_addr;
arch/arm/mach-vexpress/include/mach/clkdev.h new file +16 -0
new file mode 100644
index 0000000..baea03c
@@ -0,0 +1,16 @@
+#ifndef __ASM_MACH_CLKDEV_H
+#define __ASM_MACH_CLKDEV_H
+
+#include <asm/hardware/icst.h>
+
+struct clk {
+	unsigned long		rate;
+	const struct icst_params *params;
+	void __iomem		*vcoreg;
+	void			(*setvco)(struct clk *, struct icst_vco vco);
+};
+
+#define __clk_get(clk) ({ 1; })
+#define __clk_put(clk) do { } while (0)
+
+#endif
arch/arm/mach-vexpress/include/mach/debug-macro.S new file +23 -0
new file mode 100644
index 0000000..5167e2a
@@ -0,0 +1,23 @@
+/* arch/arm/mach-realview/include/mach/debug-macro.S
+ *
+ * Debugging macro include header
+ *
+ *  Copyright (C) 1994-1999 Russell King
+ *  Moved from linux/arch/arm/kernel/debug.S by Ben Dooks
+ *
+ * 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.
+ */
+
+#define DEBUG_LL_UART_OFFSET	0x00009000
+
+		.macro	addruart,rx,tmp
+		mrc	p15, 0, \rx, c1, c0
+		tst	\rx, #1			@ MMU enabled?
+		moveq	\rx,      #0x10000000
+		movne	\rx,      #0xf8000000	@ virtual base
+		orr	\rx, \rx, #DEBUG_LL_UART_OFFSET
+		.endm
+
+#include <asm/hardware/debug-pl01x.S>
arch/arm/mach-vexpress/include/mach/entry-macro.S new file +67 -0

67 lines not on this page · raw message

arch/arm/mach-vexpress/include/mach/hardware.h new file +1 -0
new file mode 100644
index 0000000..40a8c17
@@ -0,0 +1 @@
+/* empty */
arch/arm/mach-vexpress/include/mach/io.h new file +28 -0
new file mode 100644
index 0000000..748bb52
@@ -0,0 +1,28 @@
+/*
+ *  arch/arm/mach-vexpress/include/mach/io.h
+ *
+ *  Copyright (C) 2003 ARM Limited
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * 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.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ */
+#ifndef __ASM_ARM_ARCH_IO_H
+#define __ASM_ARM_ARCH_IO_H
+
+#define IO_SPACE_LIMIT 0xffffffff
+
+#define __io(a)		__typesafe_io(a)
+#define __mem_pci(a)	(a)
+
+#endif
arch/arm/mach-vexpress/include/mach/irqs.h new file +4 -0
new file mode 100644
index 0000000..7054cbf
@@ -0,0 +1,4 @@
+#define IRQ_LOCALTIMER		29
+#define IRQ_LOCALWDOG		30
+
+#define NR_IRQS	128
arch/arm/mach-vexpress/include/mach/memory.h new file +25 -0
new file mode 100644
index 0000000..be28232
@@ -0,0 +1,25 @@
+/*
+ *  arch/arm/mach-vexpress/include/mach/memory.h
+ *
+ *  Copyright (C) 2003 ARM Limited
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * 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.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ */
+#ifndef __ASM_ARCH_MEMORY_H
+#define __ASM_ARCH_MEMORY_H
+
+#define PHYS_OFFSET		UL(0x60000000)
+
+#endif
arch/arm/mach-vexpress/include/mach/motherboard.h new file +121 -0

121 lines not on this page · raw message

arch/arm/mach-vexpress/include/mach/system.h new file +37 -0
new file mode 100644
index 0000000..899a4e6
@@ -0,0 +1,37 @@
+/*
+ *  arch/arm/mach-vexpress/include/mach/system.h
+ *
+ *  Copyright (C) 2003 ARM Limited
+ *  Copyright (C) 2000 Deep Blue Solutions Ltd
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * 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.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ */
+#ifndef __ASM_ARCH_SYSTEM_H
+#define __ASM_ARCH_SYSTEM_H
+
+static inline void arch_idle(void)
+{
+	/*
+	 * This should do all the clock switching
+	 * and wait for interrupt tricks
+	 */
+	cpu_do_idle();
+}
+
+static inline void arch_reset(char mode, const char *cmd)
+{
+}
+
+#endif
arch/arm/mach-vexpress/include/mach/timex.h new file +23 -0
new file mode 100644
index 0000000..00029ba
@@ -0,0 +1,23 @@
+/*
+ *  arch/arm/mach-vexpress/include/mach/timex.h
+ *
+ *  RealView architecture timex specifications
+ *
+ *  Copyright (C) 2003 ARM Limited
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * 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.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ */
+
+#define CLOCK_TICK_RATE		(50000000 / 16)
arch/arm/mach-vexpress/include/mach/uncompress.h new file +52 -0

52 lines not on this page · raw message

arch/arm/mach-vexpress/include/mach/vmalloc.h new file +21 -0
new file mode 100644
index 0000000..f43a36e
@@ -0,0 +1,21 @@
+/*
+ *  arch/arm/mach-vexpress/include/mach/vmalloc.h
+ *
+ *  Copyright (C) 2003 ARM Limited
+ *  Copyright (C) 2000 Russell King.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * 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.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ */
+#define VMALLOC_END		0xf8000000UL
arch/arm/mach-vexpress/v2m.c new file +319 -0

319 lines not on this page · raw message

drivers/i2c/busses/Kconfig +1 -1
index 4cc3807..913c1da 100644
@@ -556,7 +556,7 @@ config I2C_STU300
 
 config I2C_VERSATILE
 	tristate "ARM Versatile/Realview I2C bus support"
-	depends on ARCH_VERSATILE || ARCH_REALVIEW
+	depends on ARCH_VERSATILE || ARCH_REALVIEW || ARCH_VEXPRESS
 	select I2C_ALGOBIT
 	help
 	  Say yes if you want to support the I2C serial bus on ARMs Versatile
#32 lore raw

PATCH 1/1 ARM: Add Versatile Express CA9x4 processor support

---
 arch/arm/mach-vexpress/Kconfig                 |    5 +
 arch/arm/mach-vexpress/Makefile                |    1 +
 arch/arm/mach-vexpress/ct-ca9x4.c              |  201 ++++++++++++++++++++++++
 arch/arm/mach-vexpress/include/mach/ct-ca9x4.h |   43 +++++
 arch/arm/mm/Kconfig                            |    3 +-
 5 files changed, 252 insertions(+), 1 deletions(-)
 create mode 100644 arch/arm/mach-vexpress/ct-ca9x4.c
 create mode 100644 arch/arm/mach-vexpress/include/mach/ct-ca9x4.h
arch/arm/mach-vexpress/Kconfig +5 -0
index 751858c..3f19b66 100644
@@ -1,4 +1,9 @@
 menu "Versatile Express platform type"
 	depends on ARCH_VEXPRESS
 
+config ARCH_VEXPRESS_CA9X4
+	bool "Versatile Express Cortex-A9x4 tile"
+	select CPU_V7
+	select ARM_GIC
+
 endmenu
arch/arm/mach-vexpress/Makefile +1 -0
index b47cf73..3c5e160 100644
@@ -3,3 +3,4 @@
 #
 
 obj-y					:= v2m.o
+obj-$(CONFIG_ARCH_VEXPRESS_CA9X4)	+= ct-ca9x4.o
arch/arm/mach-vexpress/ct-ca9x4.c new file +201 -0

201 lines not on this page · raw message

arch/arm/mach-vexpress/include/mach/ct-ca9x4.h new file +43 -0

43 lines not on this page · raw message

arch/arm/mm/Kconfig +2 -1
index c4ed9f9..270c8e2 100644
@@ -754,7 +754,8 @@ config CACHE_FEROCEON_L2_WRITETHROUGH
 config CACHE_L2X0
 	bool "Enable the L2x0 outer cache controller"
 	depends on REALVIEW_EB_ARM11MP || MACH_REALVIEW_PB11MP || MACH_REALVIEW_PB1176 || \
-		   REALVIEW_EB_A9MP || ARCH_MX35 || ARCH_MX31 || MACH_REALVIEW_PBX || ARCH_NOMADIK || ARCH_OMAP4
+		   REALVIEW_EB_A9MP || ARCH_MX35 || ARCH_MX31 || MACH_REALVIEW_PBX || \
+		   ARCH_NOMADIK || ARCH_OMAP4 || ARCH_VEXPRESS_CA9X4
 	default y
 	select OUTER_CACHE
 	help
#33 lore raw

PATCH 1/1 ARM: Add Versatile Express SMP support

---
 arch/arm/Kconfig                          |    5 +-
 arch/arm/mach-vexpress/Makefile           |    2 +
 arch/arm/mach-vexpress/headsmp.S          |   39 ++++++
 arch/arm/mach-vexpress/include/mach/smp.h |   21 +++
 arch/arm/mach-vexpress/localtimer.c       |   26 ++++
 arch/arm/mach-vexpress/platsmp.c          |  190 +++++++++++++++++++++++++++++
 6 files changed, 281 insertions(+), 2 deletions(-)
 create mode 100644 arch/arm/mach-vexpress/headsmp.S
 create mode 100644 arch/arm/mach-vexpress/include/mach/smp.h
 create mode 100644 arch/arm/mach-vexpress/localtimer.c
 create mode 100644 arch/arm/mach-vexpress/platsmp.c
arch/arm/Kconfig +3 -2
index 2213d61..b82eb04 100644
@@ -1060,10 +1060,11 @@ source "kernel/time/Kconfig"
 config SMP
 	bool "Symmetric Multi-Processing (EXPERIMENTAL)"
 	depends on EXPERIMENTAL && (REALVIEW_EB_ARM11MP || REALVIEW_EB_A9MP ||\
-		 MACH_REALVIEW_PB11MP || MACH_REALVIEW_PBX || ARCH_OMAP4 || ARCH_U8500)
+		 MACH_REALVIEW_PB11MP || MACH_REALVIEW_PBX || ARCH_OMAP4 ||\
+		 ARCH_U8500 || ARCH_VEXPRESS_CA9X4)
 	depends on GENERIC_CLOCKEVENTS
 	select USE_GENERIC_SMP_HELPERS
-	select HAVE_ARM_SCU if (ARCH_REALVIEW || ARCH_OMAP4 || ARCH_U8500)
+	select HAVE_ARM_SCU if (ARCH_REALVIEW || ARCH_OMAP4 || ARCH_U8500 || ARCH_VEXPRESS_CA9X4)
 	help
 	  This enables support for systems with more than one CPU. If you have
 	  a system with only one CPU, like most personal computers, say N. If
arch/arm/mach-vexpress/Makefile +2 -0
index 3c5e160..1b71b77 100644
@@ -4,3 +4,5 @@
 
 obj-y					:= v2m.o
 obj-$(CONFIG_ARCH_VEXPRESS_CA9X4)	+= ct-ca9x4.o
+obj-$(CONFIG_SMP)			+= platsmp.o headsmp.o
+obj-$(CONFIG_LOCAL_TIMERS)		+= localtimer.o
arch/arm/mach-vexpress/headsmp.S new file +39 -0
new file mode 100644
index 0000000..de02324
@@ -0,0 +1,39 @@
+/*
+ *  linux/arch/arm/mach-vexpress/headsmp.S
+ *
+ *  Copyright (c) 2003 ARM Limited
+ *  All Rights Reserved
+ *
+ * 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/linkage.h>
+#include <linux/init.h>
+
+	__INIT
+
+/*
+ * Realview specific entry point for secondary CPUs.  This provides
+ * a "holding pen" into which all secondary cores are held until we're
+ * ready for them to initialise.
+ */
+ENTRY(vexpress_secondary_startup)
+	mrc	p15, 0, r0, c0, c0, 5
+	and	r0, r0, #15
+	adr	r4, 1f
+	ldmia	r4, {r5, r6}
+	sub	r4, r4, r5
+	add	r6, r6, r4
+pen:	ldr	r7, [r6]
+	cmp	r7, r0
+	bne	pen
+
+	/*
+	 * we've been released from the holding pen: secondary_stack
+	 * should now contain the SVC stack for this core
+	 */
+	b	secondary_startup
+
+1:	.long	.
+	.long	pen_release
arch/arm/mach-vexpress/include/mach/smp.h new file +21 -0
new file mode 100644
index 0000000..72a9621
@@ -0,0 +1,21 @@
+#ifndef __MACH_SMP_H
+#define __MACH_SMP_H
+
+#include <asm/hardware/gic.h>
+
+#define hard_smp_processor_id()				\
+	({						\
+		unsigned int cpunum;			\
+		__asm__("mrc p15, 0, %0, c0, c0, 5"	\
+			: "=r" (cpunum));		\
+		cpunum &= 0x0F;				\
+	})
+
+/*
+ * We use IRQ1 as the IPI
+ */
+static inline void smp_cross_call(const struct cpumask *mask)
+{
+	gic_raise_softirq(mask, 1);
+}
+#endif
arch/arm/mach-vexpress/localtimer.c new file +26 -0
new file mode 100644
index 0000000..c0e3a59
@@ -0,0 +1,26 @@
+/*
+ *  linux/arch/arm/mach-vexpress/localtimer.c
+ *
+ *  Copyright (C) 2002 ARM Ltd.
+ *  All Rights Reserved
+ *
+ * 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/init.h>
+#include <linux/smp.h>
+#include <linux/clockchips.h>
+
+#include <asm/smp_twd.h>
+#include <asm/localtimer.h>
+#include <mach/irqs.h>
+
+/*
+ * Setup the local clock events for a CPU.
+ */
+void __cpuinit local_timer_setup(struct clock_event_device *evt)
+{
+	evt->irq = IRQ_LOCALTIMER;
+	twd_timer_setup(evt);
+}
arch/arm/mach-vexpress/platsmp.c new file +190 -0

190 lines not on this page · raw message

#34 lore raw

PATCH 1/1 ARM: Versatile Express: support adjusting clock rates for CLCD

---
 arch/arm/mach-vexpress/ct-ca9x4.c            |   16 +++++++++++++++-
 arch/arm/mach-vexpress/include/mach/clkdev.h |    5 ++---
 2 files changed, 17 insertions(+), 4 deletions(-)
arch/arm/mach-vexpress/ct-ca9x4.c +15 -1
index 7258398..5a0449c 100644
@@ -103,7 +103,6 @@ static void ct_ca9x4_clcd_enable(struct clcd_fb *fb)
 {
 	v2m_cfg_write(SYS_CFG_MUXFPGA | SYS_CFG_SITE_DB1, 0);
 	v2m_cfg_write(SYS_CFG_DVIMODE | SYS_CFG_SITE_DB1, 2);
-	v2m_cfg_write(SYS_CFG_OSC | SYS_CFG_SITE_DB1 | 1, 63500127);
 }
 
 static int ct_ca9x4_clcd_setup(struct clcd_fb *fb)
@@ -160,8 +159,23 @@ static struct amba_device *ct_ca9x4_amba_devs[] __initdata = {
 };
 
 
+static long ct_round(struct clk *clk, unsigned long rate)
+{
+	return rate;
+}
+
+static int ct_set(struct clk *clk, unsigned long rate)
+{
+	return v2m_cfg_write(SYS_CFG_OSC | SYS_CFG_SITE_DB1 | 1, rate);
+}
+
+static const struct clk_ops osc1_clk_ops = {
+	.round	= ct_round,
+	.set	= ct_set,
+};
 
 static struct clk osc1_clk = {
+	.ops	= &osc1_clk_ops,
 	.rate	= 24000000,
 };
 
arch/arm/mach-vexpress/include/mach/clkdev.h +2 -3
index baea03c..3f8307d 100644
@@ -1,13 +1,12 @@
 #ifndef __ASM_MACH_CLKDEV_H
 #define __ASM_MACH_CLKDEV_H
 
-#include <asm/hardware/icst.h>
+#include <plat/clock.h>
 
 struct clk {
+	const struct clk_ops	*ops;
 	unsigned long		rate;
 	const struct icst_params *params;
-	void __iomem		*vcoreg;
-	void			(*setvco)(struct clk *, struct icst_vco vco);
 };
 
 #define __clk_get(clk) ({ 1; })
#35 lore raw

PATCH 1/1 ARM: Versatile Express: support adjusting clock rates for CLCD

I've just merged this change into the appropriate earlier patches; it doesn't make sense for it to be separate.

#36 lore raw

PATCH 1/1 ARM: Add Versatile Express SMP support

In reply to Russell King
Quoted 6 lines

-----Original Message-----
From: linux-arm-kernel-bounces at lists.infradead.org [mailto:linux-arm- kernel-bounces at lists.infradead.org] On Behalf Of Russell King

+++ b/arch/arm/mach-vexpress/headsmp.S

<snip>

Quoted 1 line

+ * Realview specific entry point for secondary CPUs. This provides

That "Realview" is incorrect, it could either be removed or replaced with "Versatile Express"

Colin

--
Colin Tuckley - ARM Ltd.
110 Fulbourn Rd
Cambridge, CB1 9NJ
Tel: +44 1223 400536

-- IMPORTANT NOTICE: The contents of this email and any attachments are confidential and may also be privileged. If you are not the intended recipient, please notify the sender immediately and do not disclose the contents to any other person, use it for any purpose, or store or copy the information in any medium. Thank you.

#37 lore raw

PATCH 1/1 ARM: Add Versatile Express SMP support

Quoted 9 lines · Colin Tuckley
Quoted 6 lines

-----Original Message-----
From: linux-arm-kernel-bounces at lists.infradead.org [mailto:linux-arm- kernel-bounces at lists.infradead.org] On Behalf Of Russell King

+++ b/arch/arm/mach-vexpress/headsmp.S

   <snip>
Quoted 5 lines
Quoted 1 line

+ * Realview specific entry point for secondary CPUs. This provides

That "Realview" is incorrect, it could either be removed or replaced with "Versatile Express"

Fixed, replaced with "Versatile Express".

#38 lore raw

PATCH 1/1 ARM: Add Versatile Express CA9x4 processor support

In reply to Russell King

Hi Russell,

Quoted 4 lines

+config ARCH_VEXPRESS_CA9X4
+ ? ? ? bool "Versatile Express Cortex-A9x4 tile"
+ ? ? ? select CPU_V7
+ ? ? ? select ARM_GIC

#39 lore raw

PATCH 1/1 ARM: Add Versatile Express CA9x4 processor support

In reply to Russell King

Hello Russell,

arch/arm/mach-vexpress/include/mach/ct-ca9x4.h line 41

Quoted 9 lines
arch/arm/mach-vexpress/include/mach/ct-ca9x4.h new file +9 -0
+/*
+ * Interrupts.  Those in {} are for AMBA devices
+ */
+#define IRQ_CT_CA9X4_CLCDC	{ 76 }
+#define IRQ_CT_CA9X4_DMC	{ -1 }
+#define IRQ_CT_CA9X4_SMC	{ 77, 78 }
+#define IRQ_CT_CA9X4_TIMER0	80
+#define IRQ_CT_CA9X4_TIMER1	81
+#define IRQ_CT_CA9X4_GPIO	{ 82 }

Could you add the PMU interrupts as well please? It saves me adding them in an extra patch later. I believe they are numbers 92-95.

The only problem with adding the PMU interrupts here is that they are not visible to kernel/pmu.c, which includes <linux/interrupt.h>. Adding a conditional #include <mach/ct-ca9x4.h> worked, but it's not very nice. Would it be possible to include the tile IRQs in the include/mach/irqs.h?

Thanks,

Will

#40 lore raw

PATCH 1/1 ARM: Add Versatile Express CA9x4 processor support

Quoted 5 lines · Will Deacon

The only problem with adding the PMU interrupts here is that they are not visible to kernel/pmu.c, which includes <linux/interrupt.h>. Adding a conditional #include <mach/ct-ca9x4.h> worked, but it's not very nice. Would it be possible to include the tile IRQs in the include/mach/irqs.h?

Given that this platform can have multiple different tiles fitted, I don't think it's correct to publicise the interrupt numbers globally.

Currently, we have the situation where 99.9% of the tile dependencies are entirely separated from the motherboard - the only exception being the base of the motherboard IRQ numbers, and the base addresses of the motherboard CS regions.

It would be better if there was some way to allow board support to register their individual details with the PMU code. The fact that the PMU interrupts on CA9x4 are 92-95 does not mean that on another Versatile Express tile, they will be the same - and in that case if you select the interrupts through ifdefs, you're tied to only one platform inspite of the rest of the kernel image supporting multiple platforms.

#41 lore raw

PATCH 1/1 ARM: Add Versatile Express CA9x4 processor support

Hello Russell,

Quoted 15 lines · Will Deacon
Quoted 5 lines

The only problem with adding the PMU interrupts here is that they are not visible to kernel/pmu.c, which includes <linux/interrupt.h>. Adding a conditional #include <mach/ct-ca9x4.h> worked, but it's not very nice. Would it be possible to include the tile IRQs in the include/mach/irqs.h?

Given that this platform can have multiple different tiles fitted, I don't think it's correct to publicise the interrupt numbers globally.

Currently, we have the situation where 99.9% of the tile dependencies are entirely separated from the motherboard - the only exception being the base of the motherboard IRQ numbers, and the base addresses of the motherboard CS regions.

Quoted 7 lines

It would be better if there was some way to allow board support to register their individual details with the PMU code. The fact that the PMU interrupts on CA9x4 are 92-95 does not mean that on another Versatile Express tile, they will be the same - and in that case if you select the interrupts through ifdefs, you're tied to only one platform inspite of the rest of the kernel image supporting multiple platforms.

You're right. Adding a PMU IRQ registration mechanism might also help to solve the problem of registering other event sources that a board may have. I'll try and put something together this week as an RFC.

Cheers,

Will

#42 lore raw

PATCH 1/1 ARM: Add Versatile Express CA9x4 processor support

In reply to Russell King
Quoted 5 lines

-----Original Message-----
From: linux-arm-kernel-bounces at lists.infradead.org [mailto:linux-arm- kernel-bounces at lists.infradead.org] On Behalf Of Russell King

+ * Versatile Express Core Tile Cortex A9x4 Support

Versatile Express daughter boards are *not* called "Core Tiles". They are both physically and electrically incompatible and so we have specifically avoided using the term.

Quoted 1 line

+static struct clcd_panel xvga_panel = {

What happened to the support for vga and svga? These are needed when using the CLCD controller on the motherboard which doesn't support XVGA due to bus bandwidth limitations.

arch/arm/mach-vexpress/ct-ca9x4.c line 107

Quoted 6 lines
arch/arm/mach-vexpress/ct-ca9x4.c new file +6 -0
+static void ct_ca9x4_clcd_enable(struct clcd_fb *fb)
+{
+	v2m_cfg_write(SYS_CFG_MUXFPGA | SYS_CFG_SITE_DB1, 0);
+	v2m_cfg_write(SYS_CFG_DVIMODE | SYS_CFG_SITE_DB1, 2);
+	v2m_cfg_write(SYS_CFG_OSC | SYS_CFG_SITE_DB1 | 1, 63500127);
+}

This is not the preferred way to use the SRI (which I'm now told is officially called "The Serial Configuration Controller").

There is a documented data structure and set of routines which are used by the boot-monitor, self-test, bootloader and my kernel patch set for the Versatile Express. We would prefer that it be kept consistent across all software that needs to use the SCC.

My versions of these routines also make use of spin_lock() to make them smp safe.

Regards,

Colin

#43 lore raw

PATCH 1/1 ARM: Add Versatile Express CA9x4 processor support

Quoted 9 lines · Colin Tuckley
Quoted 5 lines

-----Original Message-----
From: linux-arm-kernel-bounces at lists.infradead.org [mailto:linux-arm- kernel-bounces at lists.infradead.org] On Behalf Of Russell King

+ * Versatile Express Core Tile Cortex A9x4 Support

Versatile Express daughter boards are *not* called "Core Tiles". They are both physically and electrically incompatible and so we have specifically avoided using the term.

I don't believe you.

DUI0448A contains these phrases:

CoreTile Express A9x4

Contents CoreTile Express A9x4 Technical Reference Manual 1.2 About the CoreTile Express A9x4 daughterboard 2.8 Overview of the CoreTile Express A9x4 daughterboard

There are 28 references in this document to 'CoreTile'.

Quoted 5 lines
Quoted 1 line

+static struct clcd_panel xvga_panel = {

What happened to the support for vga and svga? These are needed when using the CLCD controller on the motherboard which doesn't support XVGA due to bus bandwidth limitations.

You may notice that this is supporting the Core Tile CLCD controller, not the motherboard controller. This file does not deal with *any* motherboard stuff.

Quoted 7 lines

This is not the preferred way to use the SRI (which I'm now told is officially called "The Serial Configuration Controller").

There is a documented data structure and set of routines which are used by the boot-monitor, self-test, bootloader and my kernel patch set for the Versatile Express. We would prefer that it be kept consistent across all software that needs to use the SCC.

So we should have some over complicated way to access what is a simple protocol. I'm sorry, in Linux land, we don't always follow manufacturers recommendations to that level if there's a better way to do it - and I believe that these interfaces are much better for what is actually required.

Just because some other bits of software use some kind of software API does not mean that the kernel should do - in fact, we've been down this exact route with another manufacturer, who provided an "OS independent library" for talking to their I2C based system controller which "every OS must use" - the result was a very unstable kernel which kept provoking the system to completely reboot.

Replacing that with a custom written implementation for Linux resolved all the spontaneous reboot issues.

What I'm saying is that just because someone comes up with a super duper all bells and whistles API and says that it should be implemented is not a justification to implement it - in my experience it's better to stick knives in the paper it's written on, stamp on it, and then burn it. ;)

#44 lore raw

PATCH 1/1 ARM: Add Versatile Express support

In reply to Russell King

Hi Russell,

Quoted 5 lines

+config ARCH_VEXPRESS
+ ? ? ? bool "ARM Ltd. Versatile Express family"
+ ? ? ? select ARCH_WANT_OPTIONAL_GPIOLIB
+ ? ? ? select ARM_AMBA
+ ? ? ? select ARM_TIMER_SP804

You need platform.h, as it's used in arch/arm/plat-versatile/timer-sp.c Unless I'm mistaken, it's missing from this patchset.

Otherwise, Tested-By: Albin Tonnerre <[email protected]>

#45 lore raw

PATCH 1/1 ARM: Add Versatile Express support

Quoted 8 lines · Albin Tonnerre

Hi Russell,

Quoted 5 lines

+config ARCH_VEXPRESS
+ ? ? ? bool "ARM Ltd. Versatile Express family"
+ ? ? ? select ARCH_WANT_OPTIONAL_GPIOLIB
+ ? ? ? select ARM_AMBA
+ ? ? ? select ARM_TIMER_SP804

Quoted 4 lines

You need platform.h, as it's used in arch/arm/plat-versatile/timer-sp.c Unless I'm mistaken, it's missing from this patchset.

Otherwise, Tested-By: Albin Tonnerre <[email protected]>

Builds fine for me. timer-sp.c does not include platform.h

#46 lore raw

PATCH 1/1 ARM: Add Versatile Express support

Quoted 9 lines · Russell King - ARM Linux
Quoted 8 lines · Albin Tonnerre

Hi Russell,

Quoted 5 lines

+config ARCH_VEXPRESS
+ ? ? ? bool "ARM Ltd. Versatile Express family"
+ ? ? ? select ARCH_WANT_OPTIONAL_GPIOLIB
+ ? ? ? select ARM_AMBA
+ ? ? ? select ARM_TIMER_SP804

Quoted 6 lines
Quoted 4 lines

You need platform.h, as it's used in arch/arm/plat-versatile/timer-sp.c Unless I'm mistaken, it's missing from this patchset.

Otherwise, Tested-By: Albin Tonnerre <[email protected]>

Builds fine for me. ?timer-sp.c does not include platform.h

My fault, I overlooked the fact that 'ARM: Realview/Versatile: don't use magic numbers for timer frequency' removes this particular include.

Regards,
Albin

#47 lore raw

PATCH 1/1 ARM: Add Versatile Express support

In reply to Russell King

For some reason you seem to have renamed the "System Register Interface" to "configuration register interface"

The SRI sub-system is used for more functions than configuration and all of the ARM documentation refers to it as the SRI, so for consistency it needs to be called the SRI.

Colin

#48 lore raw

PATCH 1/1 ARM: Add Versatile Express support

Quoted 2 lines · Colin Tuckley

For some reason you seem to have renamed the "System Register Interface" to "configuration register interface"

No I have not - I'm using the terminology found in the ARM documentation:

Configuration Data Register, SYS_CFG registers

The SYS_CFG registers enable communication between the MCC and DCC to read and write a variety of system parameters, for example:
? oscillators
? voltage
? current
? power.
...

There's many more references to these being 'configuration' registers in the user guides for these boards. I see no sign of it being called by any different name.

Maybe the documentation on the ARM website is out of date? In any case, it would seem that I'm using the publically documented names for these interfaces.

#49 lore raw

PATCH 1/1 ARM: Realview/Versatile/Integrator: separate out common clock code

In reply to Russell King

Review

Quoted 5 lines

-----Original Message-----
From: linux-arm-kernel-bounces at lists.infradead.org [mailto:linux-arm- kernel-bounces at lists.infradead.org] On Behalf Of Russell King

(quoted diff) +1 -0
+	select PLAT_VERSATILE

This needs to be called something else if it's going to be used for mach-realview and mach-integrator. It's too confusing because of there being a mach-versatile. It needs to be a more generic name, something that isn't a mach. Perhaps "ARMDEV".

Colin

#50 lore raw

PATCH 1/1 ARM: Realview/Versatile/Integrator: separate outcommon clock code

Quoted 10 lines · Colin Tuckley
Quoted 5 lines

-----Original Message-----
From: linux-arm-kernel-bounces at lists.infradead.org [mailto:linux-arm- kernel-bounces at lists.infradead.org] On Behalf Of Russell King

+ select PLAT_VERSATILE

This needs to be called something else if it's going to be used for mach-realview and mach-integrator. It's too confusing because of there being a mach-versatile. It needs to be a more generic name, something that isn't a mach. Perhaps "ARMDEV".

I'm ok with the plat-versatile name and I don't think we should argue much about this. That's just a Linux internal name and it isn't visible to someone compiling the kernel.

Signature · 1 line
Catalin
#51 lore raw

PATCH 1/1 ARM: Realview/Versatile/Integrator: separate out common clock code

In reply to Colin Tuckley
Quoted 10 lines · Colin Tuckley

Review

Quoted 5 lines

-----Original Message-----
From: linux-arm-kernel-bounces at lists.infradead.org [mailto:linux-arm- kernel-bounces at lists.infradead.org] On Behalf Of Russell King

(quoted diff) +1 -0
+	select PLAT_VERSATILE

This needs to be called something else if it's going to be used for mach-realview and mach-integrator. It's too confusing because of there being a mach-versatile. It needs to be a more generic name, something that isn't a mach. Perhaps "ARMDEV".

Well, the platform families are officially documented on the ARM documentation site as:

"Versatile Express"
"RealView Versatile baseboards" (eg, of which the Realview EB and
Versatile PB926 are members)
"Integrator baseboards"

So the commonest naming theme is 'Versatile' - except for the old Integrator platforms.

I think it's reasonable to describe the common parts between all these families as 'Vesatile' rather than making up another name which doesn't really connect with any of them.

#52 lore raw
In reply to Russell King - ARM Linux

Hi Russell,

Quoted 3 lines · Russell King - ARM Linux

What follows is a rather large patch set (tested by others and myself) which cleans up the Integrator, Versatile and Realview platform support, and adds support for the ARM Versatile Express platform.

Rather than sending an e-mail to every individual patch, I'll just comment here on the series. I welcome the Integrator/Versatile/RealView clean-up and the patches look fine. For these (*except* the Versatile Express patches):

(you don't actually need to go back and add the ack to the patches).

Regarding the choice of the plat-versatile name for the common directory I don't think it's something that should prevent merging (I'm personally ok with this but it could be easily changed at a later time).

Regarding the VE patches, since I haven't done the port I cannot actually tell whether there is something missing. I'll let Colin comment on them.

Signature · 1 line
Catalin