Commit f4b8b319 authored by Russell King's avatar Russell King

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

Signed-off-by: default avatarRussell King <rmk+kernel@arm.linux.org.uk>
parent c5a0adb5
...@@ -243,6 +243,7 @@ config ARCH_INTEGRATOR ...@@ -243,6 +243,7 @@ config ARCH_INTEGRATOR
select ICST select ICST
select GENERIC_TIME select GENERIC_TIME
select GENERIC_CLOCKEVENTS select GENERIC_CLOCKEVENTS
select PLAT_VERSATILE
help help
Support for ARM's Integrator platform. Support for ARM's Integrator platform.
...@@ -255,6 +256,7 @@ config ARCH_REALVIEW ...@@ -255,6 +256,7 @@ config ARCH_REALVIEW
select GENERIC_TIME select GENERIC_TIME
select GENERIC_CLOCKEVENTS select GENERIC_CLOCKEVENTS
select ARCH_WANT_OPTIONAL_GPIOLIB select ARCH_WANT_OPTIONAL_GPIOLIB
select PLAT_VERSATILE
help help
This enables support for ARM Ltd RealView boards. This enables support for ARM Ltd RealView boards.
...@@ -268,6 +270,7 @@ config ARCH_VERSATILE ...@@ -268,6 +270,7 @@ config ARCH_VERSATILE
select GENERIC_TIME select GENERIC_TIME
select GENERIC_CLOCKEVENTS select GENERIC_CLOCKEVENTS
select ARCH_WANT_OPTIONAL_GPIOLIB select ARCH_WANT_OPTIONAL_GPIOLIB
select PLAT_VERSATILE
help help
This enables support for ARM Ltd Versatile board. This enables support for ARM Ltd Versatile board.
...@@ -938,6 +941,9 @@ config PLAT_ORION ...@@ -938,6 +941,9 @@ config PLAT_ORION
config PLAT_PXA config PLAT_PXA
bool bool
config PLAT_VERSATILE
bool
source arch/arm/mm/Kconfig source arch/arm/mm/Kconfig
config IWMMXT config IWMMXT
......
...@@ -192,6 +192,7 @@ plat-$(CONFIG_PLAT_PXA) := pxa ...@@ -192,6 +192,7 @@ plat-$(CONFIG_PLAT_PXA) := pxa
plat-$(CONFIG_PLAT_S3C24XX) := s3c24xx samsung plat-$(CONFIG_PLAT_S3C24XX) := s3c24xx samsung
plat-$(CONFIG_PLAT_S5PC1XX) := s5pc1xx samsung plat-$(CONFIG_PLAT_S5PC1XX) := s5pc1xx samsung
plat-$(CONFIG_PLAT_S5P) := s5p samsung plat-$(CONFIG_PLAT_S5P) := s5p samsung
plat-$(CONFIG_PLAT_VERSATILE) := versatile
ifeq ($(CONFIG_ARCH_EBSA110),y) ifeq ($(CONFIG_ARCH_EBSA110),y)
# This is what happens if you forget the IOCS16 line. # This is what happens if you forget the IOCS16 line.
......
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,7 @@
# Object file lists. # 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_AP) += integrator_ap.o
obj-$(CONFIG_ARCH_INTEGRATOR_CP) += integrator_cp.o obj-$(CONFIG_ARCH_INTEGRATOR_CP) += integrator_cp.o
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
# Makefile for the linux kernel. # 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_EB) += realview_eb.o
obj-$(CONFIG_MACH_REALVIEW_PB11MP) += realview_pb11mp.o obj-$(CONFIG_MACH_REALVIEW_PB11MP) += realview_pb11mp.o
obj-$(CONFIG_MACH_REALVIEW_PB1176) += realview_pb1176.o obj-$(CONFIG_MACH_REALVIEW_PB1176) += realview_pb1176.o
......
/*
* linux/arch/arm/mach-realview/clock.c
*
* 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 <linux/module.h>
#include <linux/kernel.h>
#include <linux/device.h>
#include <linux/list.h>
#include <linux/errno.h>
#include <linux/err.h>
#include <linux/string.h>
#include <linux/clk.h>
#include <linux/mutex.h>
#include <asm/hardware/icst.h>
#include "clock.h"
int clk_enable(struct clk *clk)
{
return 0;
}
EXPORT_SYMBOL(clk_enable);
void clk_disable(struct clk *clk)
{
}
EXPORT_SYMBOL(clk_disable);
unsigned long clk_get_rate(struct clk *clk)
{
return clk->rate;
}
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);
}
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;
}
return ret;
}
EXPORT_SYMBOL(clk_set_rate);
/*
* 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);
};
...@@ -48,11 +48,11 @@ ...@@ -48,11 +48,11 @@
#include <asm/hardware/gic.h> #include <asm/hardware/gic.h>
#include <mach/clkdev.h>
#include <mach/platform.h> #include <mach/platform.h>
#include <mach/irqs.h> #include <mach/irqs.h>
#include "core.h" #include "core.h"
#include "clock.h"
#define REALVIEW_REFCOUNTER (__io_address(REALVIEW_SYS_BASE) + REALVIEW_SYS_24MHz_OFFSET) #define REALVIEW_REFCOUNTER (__io_address(REALVIEW_SYS_BASE) + REALVIEW_SYS_24MHz_OFFSET)
......
#ifndef __ASM_MACH_CLKDEV_H #ifndef __ASM_MACH_CLKDEV_H
#define __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_get(clk) ({ 1; })
#define __clk_put(clk) do { } while (0) #define __clk_put(clk) do { } while (0)
......
...@@ -43,7 +43,6 @@ ...@@ -43,7 +43,6 @@
#include <mach/irqs.h> #include <mach/irqs.h>
#include "core.h" #include "core.h"
#include "clock.h"
static struct map_desc realview_eb_io_desc[] __initdata = { static struct map_desc realview_eb_io_desc[] __initdata = {
{ {
......
...@@ -43,7 +43,6 @@ ...@@ -43,7 +43,6 @@
#include <mach/irqs.h> #include <mach/irqs.h>
#include "core.h" #include "core.h"
#include "clock.h"
static struct map_desc realview_pb1176_io_desc[] __initdata = { static struct map_desc realview_pb1176_io_desc[] __initdata = {
{ {
......
...@@ -44,7 +44,6 @@ ...@@ -44,7 +44,6 @@
#include <mach/irqs.h> #include <mach/irqs.h>
#include "core.h" #include "core.h"
#include "clock.h"
static struct map_desc realview_pb11mp_io_desc[] __initdata = { static struct map_desc realview_pb11mp_io_desc[] __initdata = {
{ {
......
...@@ -41,7 +41,6 @@ ...@@ -41,7 +41,6 @@
#include <mach/irqs.h> #include <mach/irqs.h>
#include "core.h" #include "core.h"
#include "clock.h"
static struct map_desc realview_pba8_io_desc[] __initdata = { static struct map_desc realview_pba8_io_desc[] __initdata = {
{ {
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
# Makefile for the linux kernel. # 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_ARCH_VERSATILE_PB) += versatile_pb.o
obj-$(CONFIG_MACH_VERSATILE_AB) += versatile_ab.o obj-$(CONFIG_MACH_VERSATILE_AB) += versatile_ab.o
obj-$(CONFIG_PCI) += pci.o obj-$(CONFIG_PCI) += pci.o
/*
* linux/arch/arm/mach-versatile/clock.c
*
* 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 <linux/module.h>
#include <linux/kernel.h>
#include <linux/device.h>
#include <linux/list.h>
#include <linux/errno.h>
#include <linux/err.h>
#include <linux/string.h>
#include <linux/clk.h>
#include <linux/mutex.h>
#include <asm/clkdev.h>
#include <asm/hardware/icst.h>
#include "clock.h"
int clk_enable(struct clk *clk)
{
return 0;
}
EXPORT_SYMBOL(clk_enable);
void clk_disable(struct clk *clk)
{
}
EXPORT_SYMBOL(clk_disable);
unsigned long clk_get_rate(struct clk *clk)
{
return clk->rate;
}
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);
}
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;
}
return ret;
}
EXPORT_SYMBOL(clk_set_rate);
/*
* 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);
};
...@@ -47,11 +47,11 @@ ...@@ -47,11 +47,11 @@
#include <asm/mach/irq.h> #include <asm/mach/irq.h>
#include <asm/mach/time.h> #include <asm/mach/time.h>
#include <asm/mach/map.h> #include <asm/mach/map.h>
#include <mach/clkdev.h>
#include <mach/hardware.h> #include <mach/hardware.h>
#include <mach/platform.h> #include <mach/platform.h>
#include "core.h" #include "core.h"
#include "clock.h"
/* /*
* All IO addresses are mapped onto VA 0xFFFx.xxxx, where x.xxxx * All IO addresses are mapped onto VA 0xFFFx.xxxx, where x.xxxx
......
#ifndef __ASM_MACH_CLKDEV_H #ifndef __ASM_MACH_CLKDEV_H
#define __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_get(clk) ({ 1; })
#define __clk_put(clk) do { } while (0) #define __clk_put(clk) do { } while (0)
......
/* /*
* linux/arch/arm/mach-integrator/clock.c * linux/arch/arm/plat-versatile/clock.c
* *
* Copyright (C) 2004 ARM Limited. * Copyright (C) 2004 ARM Limited.
* Written by Deep Blue Solutions Limited. * Written by Deep Blue Solutions Limited.
...@@ -15,7 +15,7 @@ ...@@ -15,7 +15,7 @@
#include <linux/mutex.h> #include <linux/mutex.h>
#include <asm/hardware/icst.h> #include <asm/hardware/icst.h>
#include <asm/clkdev.h>
#include <mach/clkdev.h> #include <mach/clkdev.h>
int clk_enable(struct clk *clk) int clk_enable(struct clk *clk)
......
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