Commit 15a40333 authored by Russell King's avatar Russell King Committed by Russell King

[ARM] pxa: fix naming of memory/lcd/core clock functions

Rename pxa25x and pxa27x memory/lcd/core clock functions, and
select the correct version at run time.
Signed-off-by: default avatarRussell King <rmk+kernel@arm.linux.org.uk>
parent e259a3ae
...@@ -42,6 +42,44 @@ ...@@ -42,6 +42,44 @@
#include "devices.h" #include "devices.h"
#include "generic.h" #include "generic.h"
/*
* Get the clock frequency as reflected by CCCR and the turbo flag.
* We assume these values have been applied via a fcs.
* If info is not 0 we also display the current settings.
*/
unsigned int get_clk_frequency_khz(int info)
{
if (cpu_is_pxa21x() || cpu_is_pxa25x())
return pxa25x_get_clk_frequency_khz(info);
else
return pxa27x_get_clk_frequency_khz(info);
}
EXPORT_SYMBOL(get_clk_frequency_khz);
/*
* Return the current memory clock frequency in units of 10kHz
*/
unsigned int get_memclk_frequency_10khz(void)
{
if (cpu_is_pxa21x() || cpu_is_pxa25x())
return pxa25x_get_memclk_frequency_10khz();
else
return pxa27x_get_memclk_frequency_10khz();
}
EXPORT_SYMBOL(get_memclk_frequency_10khz);
/*
* Return the current LCD clock frequency in units of 10kHz
*/
unsigned int get_lcdclk_frequency_10khz(void)
{
if (cpu_is_pxa21x() || cpu_is_pxa25x())
return pxa25x_get_memclk_frequency_10khz();
else
return pxa27x_get_lcdclk_frequency_10khz();
}
EXPORT_SYMBOL(get_lcdclk_frequency_10khz);
/* /*
* Handy function to set GPIO alternate functions * Handy function to set GPIO alternate functions
*/ */
......
...@@ -26,3 +26,21 @@ extern unsigned int get_clk_frequency_khz(int info); ...@@ -26,3 +26,21 @@ extern unsigned int get_clk_frequency_khz(int info);
mi->bank[__nr].size = (__size), \ mi->bank[__nr].size = (__size), \
mi->bank[__nr].node = (((unsigned)(__start) - PHYS_OFFSET) >> 27) mi->bank[__nr].node = (((unsigned)(__start) - PHYS_OFFSET) >> 27)
#ifdef CONFIG_PXA25x
extern unsigned pxa25x_get_clk_frequency_khz(int);
extern unsigned pxa25x_get_memclk_frequency_10khz(void);
#else
#define pxa25x_get_clk_frequency_khz(x) (0)
#define pxa25x_get_memclk_frequency_10khz() (0)
#endif
#ifdef CONFIG_PXA27x
extern unsigned pxa27x_get_clk_frequency_khz(int);
extern unsigned pxa27x_get_memclk_frequency_10khz(void);
extern unsigned pxa27x_get_lcdclk_frequency_10khz(void);
#else
#define pxa27x_get_clk_frequency_khz(x) (0)
#define pxa27x_get_memclk_frequency_10khz() (0)
#define pxa27x_get_lcdclk_frequency_10khz() (0)
#endif
...@@ -53,7 +53,7 @@ static unsigned char N2_clk_mult[8] = { 0, 0, 2, 3, 4, 0, 6, 0 }; ...@@ -53,7 +53,7 @@ static unsigned char N2_clk_mult[8] = { 0, 0, 2, 3, 4, 0, 6, 0 };
* We assume these values have been applied via a fcs. * We assume these values have been applied via a fcs.
* If info is not 0 we also display the current settings. * If info is not 0 we also display the current settings.
*/ */
unsigned int get_clk_frequency_khz(int info) unsigned int pxa25x_get_clk_frequency_khz(int info)
{ {
unsigned long cccr, turbo; unsigned long cccr, turbo;
unsigned int l, L, m, M, n2, N; unsigned int l, L, m, M, n2, N;
...@@ -86,28 +86,14 @@ unsigned int get_clk_frequency_khz(int info) ...@@ -86,28 +86,14 @@ unsigned int get_clk_frequency_khz(int info)
return (turbo & 1) ? (N/1000) : (M/1000); return (turbo & 1) ? (N/1000) : (M/1000);
} }
EXPORT_SYMBOL(get_clk_frequency_khz);
/* /*
* Return the current memory clock frequency in units of 10kHz * Return the current memory clock frequency in units of 10kHz
*/ */
unsigned int get_memclk_frequency_10khz(void) unsigned int pxa25x_get_memclk_frequency_10khz(void)
{ {
return L_clk_mult[(CCCR >> 0) & 0x1f] * BASE_CLK / 10000; return L_clk_mult[(CCCR >> 0) & 0x1f] * BASE_CLK / 10000;
} }
EXPORT_SYMBOL(get_memclk_frequency_10khz);
/*
* Return the current LCD clock frequency in units of 10kHz
*/
unsigned int get_lcdclk_frequency_10khz(void)
{
return get_memclk_frequency_10khz();
}
EXPORT_SYMBOL(get_lcdclk_frequency_10khz);
#ifdef CONFIG_PM #ifdef CONFIG_PM
#define SAVE(x) sleep_save[SLEEP_SAVE_##x] = x #define SAVE(x) sleep_save[SLEEP_SAVE_##x] = x
......
...@@ -36,7 +36,7 @@ ...@@ -36,7 +36,7 @@
* We assume these values have been applied via a fcs. * We assume these values have been applied via a fcs.
* If info is not 0 we also display the current settings. * If info is not 0 we also display the current settings.
*/ */
unsigned int get_clk_frequency_khz( int info) unsigned int pxa27x_get_clk_frequency_khz(int info)
{ {
unsigned long ccsr, clkcfg; unsigned long ccsr, clkcfg;
unsigned int l, L, m, M, n2, N, S; unsigned int l, L, m, M, n2, N, S;
...@@ -79,7 +79,7 @@ unsigned int get_clk_frequency_khz( int info) ...@@ -79,7 +79,7 @@ unsigned int get_clk_frequency_khz( int info)
* Return the current mem clock frequency in units of 10kHz as * Return the current mem clock frequency in units of 10kHz as
* reflected by CCCR[A], B, and L * reflected by CCCR[A], B, and L
*/ */
unsigned int get_memclk_frequency_10khz(void) unsigned int pxa27x_get_memclk_frequency_10khz(void)
{ {
unsigned long ccsr, clkcfg; unsigned long ccsr, clkcfg;
unsigned int l, L, m, M; unsigned int l, L, m, M;
...@@ -104,7 +104,7 @@ unsigned int get_memclk_frequency_10khz(void) ...@@ -104,7 +104,7 @@ unsigned int get_memclk_frequency_10khz(void)
/* /*
* Return the current LCD clock frequency in units of 10kHz as * Return the current LCD clock frequency in units of 10kHz as
*/ */
unsigned int get_lcdclk_frequency_10khz(void) unsigned int pxa27x_get_lcdclk_frequency_10khz(void)
{ {
unsigned long ccsr; unsigned long ccsr;
unsigned int l, L, k, K; unsigned int l, L, k, K;
...@@ -120,10 +120,6 @@ unsigned int get_lcdclk_frequency_10khz(void) ...@@ -120,10 +120,6 @@ unsigned int get_lcdclk_frequency_10khz(void)
return (K / 10000); return (K / 10000);
} }
EXPORT_SYMBOL(get_clk_frequency_khz);
EXPORT_SYMBOL(get_memclk_frequency_10khz);
EXPORT_SYMBOL(get_lcdclk_frequency_10khz);
#ifdef CONFIG_PM #ifdef CONFIG_PM
#define SAVE(x) sleep_save[SLEEP_SAVE_##x] = x #define SAVE(x) sleep_save[SLEEP_SAVE_##x] = x
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment