Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 123809
b: refs/heads/master
c: e24b864
h: refs/heads/master
i:
  123807: f338592
v: v3
  • Loading branch information
Ben Dooks committed Dec 15, 2008
1 parent 1b51550 commit be0e1e5
Show file tree
Hide file tree
Showing 8 changed files with 50 additions and 42 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 93bc6b6371b6b7303ffdae0d69dcdc443b8b0d8a
refs/heads/master: e24b864ab3e1a5916c87e13cfdc94c1d02f0578b
33 changes: 0 additions & 33 deletions trunk/arch/arm/mach-s3c2410/include/mach/regs-clock.h
Original file line number Diff line number Diff line change
Expand Up @@ -42,13 +42,6 @@
#define S3C2410_CLKCON_IIS (1<<17)
#define S3C2410_CLKCON_SPI (1<<18)

#define S3C2410_PLLCON_MDIVSHIFT 12
#define S3C2410_PLLCON_PDIVSHIFT 4
#define S3C2410_PLLCON_SDIVSHIFT 0
#define S3C2410_PLLCON_MDIVMASK ((1<<(1+(19-12)))-1)
#define S3C2410_PLLCON_PDIVMASK ((1<<5)-1)
#define S3C2410_PLLCON_SDIVMASK 3

/* DCLKCON register addresses in gpio.h */

#define S3C2410_DCLKCON_DCLK0EN (1<<0)
Expand Down Expand Up @@ -76,32 +69,6 @@
#define S3C2410_CLKSLOW_SLOWVAL(x) (x)
#define S3C2410_CLKSLOW_GET_SLOWVAL(x) ((x) & 7)

#ifndef __ASSEMBLY__

#include <asm/div64.h>

static inline unsigned int
s3c2410_get_pll(unsigned int pllval, unsigned int baseclk)
{
unsigned int mdiv, pdiv, sdiv;
uint64_t fvco;

mdiv = pllval >> S3C2410_PLLCON_MDIVSHIFT;
pdiv = pllval >> S3C2410_PLLCON_PDIVSHIFT;
sdiv = pllval >> S3C2410_PLLCON_SDIVSHIFT;

mdiv &= S3C2410_PLLCON_MDIVMASK;
pdiv &= S3C2410_PLLCON_PDIVMASK;
sdiv &= S3C2410_PLLCON_SDIVMASK;

fvco = (uint64_t)baseclk * (mdiv + 8);
do_div(fvco, (pdiv + 2) << sdiv);

return (unsigned int)fvco;
}

#endif /* __ASSEMBLY__ */

#if defined(CONFIG_CPU_S3C2440) || defined(CONFIG_CPU_S3C2442)

/* extra registers */
Expand Down
8 changes: 4 additions & 4 deletions trunk/arch/arm/mach-s3c2410/mach-h1940.c
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@
#include <plat/clock.h>
#include <plat/devs.h>
#include <plat/cpu.h>
#include <plat/pll.h>
#include <plat/pm.h>

static struct map_desc h1940_iodesc[] __initdata = {
Expand Down Expand Up @@ -223,10 +224,9 @@ static void __init h1940_init(void)
S3C2410_MISCCR_USBSUSPND0 |
S3C2410_MISCCR_USBSUSPND1, 0x0);

tmp = (
0x78 << S3C2410_PLLCON_MDIVSHIFT)
| (0x02 << S3C2410_PLLCON_PDIVSHIFT)
| (0x03 << S3C2410_PLLCON_SDIVSHIFT);
tmp = (0x78 << S3C24XX_PLLCON_MDIVSHIFT)
| (0x02 << S3C24XX_PLLCON_PDIVSHIFT)
| (0x03 << S3C24XX_PLLCON_SDIVSHIFT);
writel(tmp, S3C2410_UPLLCON);

platform_add_devices(h1940_devices, ARRAY_SIZE(h1940_devices));
Expand Down
3 changes: 2 additions & 1 deletion trunk/arch/arm/mach-s3c2410/s3c2410.c
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@
#include <plat/cpu.h>
#include <plat/devs.h>
#include <plat/clock.h>
#include <plat/pll.h>

/* Initial IO mappings */

Expand Down Expand Up @@ -74,7 +75,7 @@ void __init s3c2410_init_clocks(int xtal)
/* now we've got our machine bits initialised, work out what
* clocks we've got */

fclk = s3c2410_get_pll(__raw_readl(S3C2410_MPLLCON), xtal);
fclk = s3c24xx_get_pll(__raw_readl(S3C2410_MPLLCON), xtal);

tmp = __raw_readl(S3C2410_CLKDIVN);

Expand Down
3 changes: 2 additions & 1 deletion trunk/arch/arm/mach-s3c2412/s3c2412.c
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@
#include <plat/devs.h>
#include <plat/clock.h>
#include <plat/pm.h>
#include <plat/pll.h>

#ifndef CONFIG_CPU_S3C2412_ONLY
void __iomem *s3c24xx_va_gpio2 = S3C24XX_VA_GPIO;
Expand Down Expand Up @@ -165,7 +166,7 @@ void __init s3c2412_init_clocks(int xtal)
/* now we've got our machine bits initialised, work out what
* clocks we've got */

fclk = s3c2410_get_pll(__raw_readl(S3C2410_MPLLCON), xtal*2);
fclk = s3c24xx_get_pll(__raw_readl(S3C2410_MPLLCON), xtal*2);

clk_mpll.rate = fclk;

Expand Down
3 changes: 2 additions & 1 deletion trunk/arch/arm/plat-s3c24xx/clock.c
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@

#include <plat/clock.h>
#include <plat/cpu.h>
#include <plat/pll.h>

/* clock information */

Expand Down Expand Up @@ -332,7 +333,7 @@ int __init s3c24xx_setup_clocks(unsigned long xtal,
/* initialise the main system clocks */

clk_xtal.rate = xtal;
clk_upll.rate = s3c2410_get_pll(__raw_readl(S3C2410_UPLLCON), xtal);
clk_upll.rate = s3c24xx_get_pll(__raw_readl(S3C2410_UPLLCON), xtal);

clk_mpll.rate = fclk;
clk_h.rate = hclk;
Expand Down
37 changes: 37 additions & 0 deletions trunk/arch/arm/plat-s3c24xx/include/plat/pll.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
/* linux/arch/arm/plat-s3c24xx/include/plat/pll.h
*
* Copyright 2008 Simtec Electronics
* Ben Dooks <ben@simtec.co.uk>
* http://armlinux.simtec.co.uk/
*
* S3C24xx - common pll registers and code
*/

#define S3C24XX_PLLCON_MDIVSHIFT 12
#define S3C24XX_PLLCON_PDIVSHIFT 4
#define S3C24XX_PLLCON_SDIVSHIFT 0
#define S3C24XX_PLLCON_MDIVMASK ((1<<(1+(19-12)))-1)
#define S3C24XX_PLLCON_PDIVMASK ((1<<5)-1)
#define S3C24XX_PLLCON_SDIVMASK 3

#include <asm/div64.h>

static inline unsigned int
s3c24xx_get_pll(unsigned int pllval, unsigned int baseclk)
{
unsigned int mdiv, pdiv, sdiv;
uint64_t fvco;

mdiv = pllval >> S3C24XX_PLLCON_MDIVSHIFT;
pdiv = pllval >> S3C24XX_PLLCON_PDIVSHIFT;
sdiv = pllval >> S3C24XX_PLLCON_SDIVSHIFT;

mdiv &= S3C24XX_PLLCON_MDIVMASK;
pdiv &= S3C24XX_PLLCON_PDIVMASK;
sdiv &= S3C24XX_PLLCON_SDIVMASK;

fvco = (uint64_t)baseclk * (mdiv + 8);
do_div(fvco, (pdiv + 2) << sdiv);

return (unsigned int)fvco;
}
3 changes: 2 additions & 1 deletion trunk/arch/arm/plat-s3c24xx/s3c244x.c
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@
#include <plat/devs.h>
#include <plat/cpu.h>
#include <plat/pm.h>
#include <plat/pll.h>

static struct map_desc s3c244x_iodesc[] __initdata = {
IODESC_ENT(CLKPWR),
Expand Down Expand Up @@ -80,7 +81,7 @@ void __init s3c244x_init_clocks(int xtal)
/* now we've got our machine bits initialised, work out what
* clocks we've got */

fclk = s3c2410_get_pll(__raw_readl(S3C2410_MPLLCON), xtal) * 2;
fclk = s3c24xx_get_pll(__raw_readl(S3C2410_MPLLCON), xtal) * 2;

clkdiv = __raw_readl(S3C2410_CLKDIVN);
camdiv = __raw_readl(S3C2440_CAMDIVN);
Expand Down

0 comments on commit be0e1e5

Please sign in to comment.