summaryrefslogtreecommitdiffstats
path: root/arch/arm/common
diff options
context:
space:
mode:
authorRussell King <rmk+kernel@arm.linux.org.uk>2010-01-16 20:16:10 +0000
committerRussell King <rmk+kernel@arm.linux.org.uk>2010-05-02 09:35:33 +0100
commitc5a0adb51002e51a4254cb7f0ab7190d41d8b930 (patch)
treeb6ae6bd13b1aa722e7d96876da28cd5ac3722188 /arch/arm/common
parent232eaf7f268f765b52170bec42bfa0c5825aa239 (diff)
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. Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
Diffstat (limited to 'arch/arm/common')
-rw-r--r--arch/arm/common/Kconfig5
-rw-r--r--arch/arm/common/Makefile3
-rw-r--r--arch/arm/common/icst.c (renamed from arch/arm/common/icst307.c)19
-rw-r--r--arch/arm/common/icst525.c99
4 files changed, 11 insertions, 115 deletions
diff --git a/arch/arm/common/Kconfig b/arch/arm/common/Kconfig
index 4efbb9df044..323d2d28952 100644
--- a/arch/arm/common/Kconfig
+++ b/arch/arm/common/Kconfig
@@ -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
diff --git a/arch/arm/common/Makefile b/arch/arm/common/Makefile
index 76be7ff2a7c..5e8ad0d6c91 100644
--- a/arch/arm/common/Makefile
+++ b/arch/arm/common/Makefile
@@ -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
diff --git a/arch/arm/common/icst307.c b/arch/arm/common/icst.c
index 8332c0726e7..9a7f09cff30 100644
--- a/arch/arm/common/icst307.c
+++ b/arch/arm/common/icst.c
@@ -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);
diff --git a/arch/arm/common/icst525.c b/arch/arm/common/icst525.c
deleted file mode 100644
index 4180255eb07..00000000000
--- a/arch/arm/common/icst525.c
+++ /dev/null
@@ -1,99 +0,0 @@
-/*
- * linux/arch/arm/common/icst525.c
- *
- * 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.
- */
-#include <linux/module.h>
-#include <linux/kernel.h>
-
-#include <asm/hardware/icst525.h>
-
-/*
- * Divisors for each OD setting.
- */
-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) * p->s2div[vco.s]);
-}
-
-EXPORT_SYMBOL(icst525_hz);
-
-/*
- * Ascending divisor S values.
- */
-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)
-{
- 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;
-
- /*
- * First, find the PLL output divisor such
- * that the PLL output is within spec.
- */
- do {
- f = freq * p->s2div[p->idx2s[i]];
-
- /*
- * f must be between 10MHz and
- * 320MHz (5V) or 200MHz (3V)
- */
- if (f > p->vco_min && f <= p->vco_max)
- break;
- } while (i < 8);
-
- if (i >= 8)
- return vco;
-
- vco.s = p->idx2s[i];
-
- /*
- * 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 fref_div, f_pll;
- unsigned int vd;
- int f_diff;
-
- fref_div = (2 * p->ref) / rd;
-
- vd = (f + fref_div / 2) / fref_div;
- if (vd < p->vd_min || vd > p->vd_max)
- continue;
-
- f_pll = fref_div * 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(icst525_hz_to_vco);