Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
xiphi1978
linux
提交
e902be56
L
linux
项目概览
xiphi1978
/
linux
通知
2
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
L
linux
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
e902be56
编写于
11月 27, 2008
作者:
R
Russell King
提交者:
Russell King
11月 27, 2008
浏览文件
操作
浏览文件
下载
差异文件
Merge branches 'core' and 'clks' into devel
上级
c750815e
5e1dbdb4
变更
44
隐藏空白更改
内联
并排
Showing
44 changed file
with
618 addition
and
588 deletion
+618
-588
arch/arm/Kconfig
arch/arm/Kconfig
+4
-0
arch/arm/common/Kconfig
arch/arm/common/Kconfig
+3
-0
arch/arm/common/Makefile
arch/arm/common/Makefile
+1
-0
arch/arm/common/clkdev.c
arch/arm/common/clkdev.c
+128
-0
arch/arm/include/asm/clkdev.h
arch/arm/include/asm/clkdev.h
+30
-0
arch/arm/mach-integrator/clock.c
arch/arm/mach-integrator/clock.c
+4
-76
arch/arm/mach-integrator/clock.h
arch/arm/mach-integrator/clock.h
+0
-25
arch/arm/mach-integrator/core.c
arch/arm/mach-integrator/core.c
+35
-0
arch/arm/mach-integrator/impd1.c
arch/arm/mach-integrator/impd1.c
+16
-10
arch/arm/mach-integrator/include/mach/clkdev.h
arch/arm/mach-integrator/include/mach/clkdev.h
+25
-0
arch/arm/mach-integrator/integrator_cp.c
arch/arm/mach-integrator/integrator_cp.c
+10
-8
arch/arm/mach-pxa/clock.c
arch/arm/mach-pxa/clock.c
+10
-56
arch/arm/mach-pxa/clock.h
arch/arm/mach-pxa/clock.h
+20
-39
arch/arm/mach-pxa/include/mach/clkdev.h
arch/arm/mach-pxa/include/mach/clkdev.h
+7
-0
arch/arm/mach-pxa/pwm.c
arch/arm/mach-pxa/pwm.c
+1
-1
arch/arm/mach-pxa/pxa25x.c
arch/arm/mach-pxa/pxa25x.c
+43
-28
arch/arm/mach-pxa/pxa27x.c
arch/arm/mach-pxa/pxa27x.c
+54
-35
arch/arm/mach-pxa/pxa300.c
arch/arm/mach-pxa/pxa300.c
+10
-8
arch/arm/mach-pxa/pxa320.c
arch/arm/mach-pxa/pxa320.c
+5
-3
arch/arm/mach-pxa/pxa3xx.c
arch/arm/mach-pxa/pxa3xx.c
+51
-36
arch/arm/mach-pxa/ssp.c
arch/arm/mach-pxa/ssp.c
+1
-1
arch/arm/mach-realview/clock.c
arch/arm/mach-realview/clock.c
+5
-75
arch/arm/mach-realview/clock.h
arch/arm/mach-realview/clock.h
+0
-6
arch/arm/mach-realview/core.c
arch/arm/mach-realview/core.c
+50
-2
arch/arm/mach-realview/core.h
arch/arm/mach-realview/core.h
+0
-1
arch/arm/mach-realview/include/mach/clkdev.h
arch/arm/mach-realview/include/mach/clkdev.h
+7
-0
arch/arm/mach-realview/realview_eb.c
arch/arm/mach-realview/realview_eb.c
+0
-2
arch/arm/mach-realview/realview_pb1176.c
arch/arm/mach-realview/realview_pb1176.c
+0
-2
arch/arm/mach-realview/realview_pb11mp.c
arch/arm/mach-realview/realview_pb11mp.c
+0
-2
arch/arm/mach-sa1100/clock.c
arch/arm/mach-sa1100/clock.c
+27
-73
arch/arm/mach-versatile/clock.c
arch/arm/mach-versatile/clock.c
+5
-75
arch/arm/mach-versatile/clock.h
arch/arm/mach-versatile/clock.h
+1
-6
arch/arm/mach-versatile/core.c
arch/arm/mach-versatile/core.c
+48
-8
arch/arm/mach-versatile/include/mach/clkdev.h
arch/arm/mach-versatile/include/mach/clkdev.h
+7
-0
drivers/i2c/busses/i2c-pxa.c
drivers/i2c/busses/i2c-pxa.c
+1
-1
drivers/input/keyboard/pxa27x_keypad.c
drivers/input/keyboard/pxa27x_keypad.c
+1
-1
drivers/media/video/pxa_camera.c
drivers/media/video/pxa_camera.c
+1
-1
drivers/mmc/host/pxamci.c
drivers/mmc/host/pxamci.c
+1
-1
drivers/mtd/nand/pxa3xx_nand.c
drivers/mtd/nand/pxa3xx_nand.c
+1
-1
drivers/serial/pxa.c
drivers/serial/pxa.c
+1
-1
drivers/usb/gadget/pxa25x_udc.c
drivers/usb/gadget/pxa25x_udc.c
+1
-1
drivers/usb/gadget/pxa27x_udc.c
drivers/usb/gadget/pxa27x_udc.c
+1
-1
drivers/usb/host/ohci-pxa27x.c
drivers/usb/host/ohci-pxa27x.c
+1
-1
drivers/video/pxafb.c
drivers/video/pxafb.c
+1
-1
未找到文件。
arch/arm/Kconfig
浏览文件 @
e902be56
...
...
@@ -211,6 +211,7 @@ config ARCH_INTEGRATOR
bool "ARM Ltd. Integrator family"
select ARM_AMBA
select HAVE_CLK
select COMMON_CLKDEV
select ICST525
help
Support for ARM's Integrator platform.
...
...
@@ -219,6 +220,7 @@ config ARCH_REALVIEW
bool "ARM Ltd. RealView family"
select ARM_AMBA
select HAVE_CLK
select COMMON_CLKDEV
select ICST307
select GENERIC_TIME
select GENERIC_CLOCKEVENTS
...
...
@@ -230,6 +232,7 @@ config ARCH_VERSATILE
select ARM_AMBA
select ARM_VIC
select HAVE_CLK
select COMMON_CLKDEV
select ICST307
select GENERIC_TIME
select GENERIC_CLOCKEVENTS
...
...
@@ -477,6 +480,7 @@ config ARCH_PXA
select ARCH_MTD_XIP
select GENERIC_GPIO
select HAVE_CLK
select COMMON_CLKDEV
select ARCH_REQUIRE_GPIOLIB
select GENERIC_TIME
select GENERIC_CLOCKEVENTS
...
...
arch/arm/common/Kconfig
浏览文件 @
e902be56
...
...
@@ -33,3 +33,6 @@ config SHARPSL_PM
config SHARP_SCOOP
bool
config COMMON_CLKDEV
bool
arch/arm/common/Makefile
浏览文件 @
e902be56
...
...
@@ -17,3 +17,4 @@ obj-$(CONFIG_SHARP_SCOOP) += scoop.o
obj-$(CONFIG_ARCH_IXP2000)
+=
uengine.o
obj-$(CONFIG_ARCH_IXP23XX)
+=
uengine.o
obj-$(CONFIG_PCI_HOST_ITE8152)
+=
it8152.o
obj-$(CONFIG_COMMON_CLKDEV)
+=
clkdev.o
arch/arm/common/clkdev.c
0 → 100644
浏览文件 @
e902be56
/*
* arch/arm/common/clkdev.c
*
* Copyright (C) 2008 Russell King.
*
* 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.
*
* Helper for the clk API to assist looking up a struct clk.
*/
#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/mutex.h>
#include <asm/clkdev.h>
#include <mach/clkdev.h>
static
LIST_HEAD
(
clocks
);
static
DEFINE_MUTEX
(
clocks_mutex
);
static
struct
clk
*
clk_find
(
const
char
*
dev_id
,
const
char
*
con_id
)
{
struct
clk_lookup
*
p
;
struct
clk
*
clk
=
NULL
;
int
match
,
best
=
0
;
list_for_each_entry
(
p
,
&
clocks
,
node
)
{
if
((
p
->
dev_id
&&
!
dev_id
)
||
(
p
->
con_id
&&
!
con_id
))
continue
;
match
=
0
;
if
(
p
->
dev_id
)
match
+=
2
*
(
strcmp
(
p
->
dev_id
,
dev_id
)
==
0
);
if
(
p
->
con_id
)
match
+=
1
*
(
strcmp
(
p
->
con_id
,
con_id
)
==
0
);
if
(
match
==
0
)
continue
;
if
(
match
>
best
)
{
clk
=
p
->
clk
;
best
=
match
;
}
}
return
clk
;
}
struct
clk
*
clk_get
(
struct
device
*
dev
,
const
char
*
con_id
)
{
const
char
*
dev_id
=
dev
?
dev_name
(
dev
)
:
NULL
;
struct
clk
*
clk
;
mutex_lock
(
&
clocks_mutex
);
clk
=
clk_find
(
dev_id
,
con_id
);
if
(
clk
&&
!
__clk_get
(
clk
))
clk
=
NULL
;
mutex_unlock
(
&
clocks_mutex
);
return
clk
?
clk
:
ERR_PTR
(
-
ENOENT
);
}
EXPORT_SYMBOL
(
clk_get
);
void
clk_put
(
struct
clk
*
clk
)
{
__clk_put
(
clk
);
}
EXPORT_SYMBOL
(
clk_put
);
void
clkdev_add
(
struct
clk_lookup
*
cl
)
{
mutex_lock
(
&
clocks_mutex
);
list_add_tail
(
&
cl
->
node
,
&
clocks
);
mutex_unlock
(
&
clocks_mutex
);
}
EXPORT_SYMBOL
(
clkdev_add
);
#define MAX_DEV_ID 20
#define MAX_CON_ID 16
struct
clk_lookup_alloc
{
struct
clk_lookup
cl
;
char
dev_id
[
MAX_DEV_ID
];
char
con_id
[
MAX_CON_ID
];
};
struct
clk_lookup
*
clkdev_alloc
(
struct
clk
*
clk
,
const
char
*
con_id
,
const
char
*
dev_fmt
,
...)
{
struct
clk_lookup_alloc
*
cla
;
cla
=
kzalloc
(
sizeof
(
*
cla
),
GFP_KERNEL
);
if
(
!
cla
)
return
NULL
;
cla
->
cl
.
clk
=
clk
;
if
(
con_id
)
{
strlcpy
(
cla
->
con_id
,
con_id
,
sizeof
(
cla
->
con_id
));
cla
->
cl
.
con_id
=
cla
->
con_id
;
}
if
(
dev_fmt
)
{
va_list
ap
;
va_start
(
ap
,
dev_fmt
);
vscnprintf
(
cla
->
dev_id
,
sizeof
(
cla
->
dev_id
),
dev_fmt
,
ap
);
cla
->
cl
.
dev_id
=
cla
->
dev_id
;
va_end
(
ap
);
}
return
&
cla
->
cl
;
}
EXPORT_SYMBOL
(
clkdev_alloc
);
/*
* clkdev_drop - remove a clock dynamically allocated
*/
void
clkdev_drop
(
struct
clk_lookup
*
cl
)
{
mutex_lock
(
&
clocks_mutex
);
list_del
(
&
cl
->
node
);
mutex_unlock
(
&
clocks_mutex
);
kfree
(
cl
);
}
EXPORT_SYMBOL
(
clkdev_drop
);
arch/arm/include/asm/clkdev.h
0 → 100644
浏览文件 @
e902be56
/*
* arch/arm/include/asm/clkdev.h
*
* Copyright (C) 2008 Russell King.
*
* 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.
*
* Helper for the clk API to assist looking up a struct clk.
*/
#ifndef __ASM_CLKDEV_H
#define __ASM_CLKDEV_H
struct
clk
;
struct
clk_lookup
{
struct
list_head
node
;
const
char
*
dev_id
;
const
char
*
con_id
;
struct
clk
*
clk
;
};
struct
clk_lookup
*
clkdev_alloc
(
struct
clk
*
clk
,
const
char
*
con_id
,
const
char
*
dev_fmt
,
...);
void
clkdev_add
(
struct
clk_lookup
*
cl
);
void
clkdev_drop
(
struct
clk_lookup
*
cl
);
#endif
arch/arm/mach-integrator/clock.c
浏览文件 @
e902be56
...
...
@@ -10,42 +10,12 @@
*/
#include <linux/module.h>
#include <linux/kernel.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/icst525.h>
#include "clock.h"
static
LIST_HEAD
(
clocks
);
static
DEFINE_MUTEX
(
clocks_mutex
);
struct
clk
*
clk_get
(
struct
device
*
dev
,
const
char
*
id
)
{
struct
clk
*
p
,
*
clk
=
ERR_PTR
(
-
ENOENT
);
mutex_lock
(
&
clocks_mutex
);
list_for_each_entry
(
p
,
&
clocks
,
node
)
{
if
(
strcmp
(
id
,
p
->
name
)
==
0
&&
try_module_get
(
p
->
owner
))
{
clk
=
p
;
break
;
}
}
mutex_unlock
(
&
clocks_mutex
);
return
clk
;
}
EXPORT_SYMBOL
(
clk_get
);
void
clk_put
(
struct
clk
*
clk
)
{
module_put
(
clk
->
owner
);
}
EXPORT_SYMBOL
(
clk_put
);
#include <asm/clkdev.h>
#include <mach/clkdev.h>
int
clk_enable
(
struct
clk
*
clk
)
{
...
...
@@ -67,7 +37,6 @@ EXPORT_SYMBOL(clk_get_rate);
long
clk_round_rate
(
struct
clk
*
clk
,
unsigned
long
rate
)
{
struct
icst525_vco
vco
;
vco
=
icst525_khz_to_vco
(
clk
->
params
,
rate
/
1000
);
return
icst525_khz
(
clk
->
params
,
vco
)
*
1000
;
}
...
...
@@ -76,56 +45,15 @@ EXPORT_SYMBOL(clk_round_rate);
int
clk_set_rate
(
struct
clk
*
clk
,
unsigned
long
rate
)
{
int
ret
=
-
EIO
;
if
(
clk
->
setvco
)
{
struct
icst525_vco
vco
;
vco
=
icst525_khz_to_vco
(
clk
->
params
,
rate
/
1000
);
clk
->
rate
=
icst525_khz
(
clk
->
params
,
vco
)
*
1000
;
printk
(
"Clock %s: setting VCO reg params: S=%d R=%d V=%d
\n
"
,
clk
->
name
,
vco
.
s
,
vco
.
r
,
vco
.
v
);
clk
->
setvco
(
clk
,
vco
);
ret
=
0
;
}
return
0
;
return
ret
;
}
EXPORT_SYMBOL
(
clk_set_rate
);
/*
* These are fixed clocks.
*/
static
struct
clk
kmi_clk
=
{
.
name
=
"KMIREFCLK"
,
.
rate
=
24000000
,
};
static
struct
clk
uart_clk
=
{
.
name
=
"UARTCLK"
,
.
rate
=
14745600
,
};
int
clk_register
(
struct
clk
*
clk
)
{
mutex_lock
(
&
clocks_mutex
);
list_add
(
&
clk
->
node
,
&
clocks
);
mutex_unlock
(
&
clocks_mutex
);
return
0
;
}
EXPORT_SYMBOL
(
clk_register
);
void
clk_unregister
(
struct
clk
*
clk
)
{
mutex_lock
(
&
clocks_mutex
);
list_del
(
&
clk
->
node
);
mutex_unlock
(
&
clocks_mutex
);
}
EXPORT_SYMBOL
(
clk_unregister
);
static
int
__init
clk_init
(
void
)
{
clk_register
(
&
kmi_clk
);
clk_register
(
&
uart_clk
);
return
0
;
}
arch_initcall
(
clk_init
);
arch/arm/mach-integrator/clock.h
浏览文件 @
e902be56
/*
* linux/arch/arm/mach-integrator/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.
*/
struct
module
;
struct
icst525_params
;
struct
clk
{
struct
list_head
node
;
unsigned
long
rate
;
struct
module
*
owner
;
const
char
*
name
;
const
struct
icst525_params
*
params
;
void
*
data
;
void
(
*
setvco
)(
struct
clk
*
,
struct
icst525_vco
vco
);
};
int
clk_register
(
struct
clk
*
clk
);
void
clk_unregister
(
struct
clk
*
clk
);
arch/arm/mach-integrator/core.c
浏览文件 @
e902be56
...
...
@@ -21,6 +21,8 @@
#include <linux/amba/serial.h>
#include <linux/io.h>
#include <asm/clkdev.h>
#include <mach/clkdev.h>
#include <mach/hardware.h>
#include <asm/irq.h>
#include <asm/hardware/arm_timer.h>
...
...
@@ -108,10 +110,43 @@ static struct amba_device *amba_devs[] __initdata = {
&
kmi1_device
,
};
/*
* These are fixed clocks.
*/
static
struct
clk
clk24mhz
=
{
.
rate
=
24000000
,
};
static
struct
clk
uartclk
=
{
.
rate
=
14745600
,
};
static
struct
clk_lookup
lookups
[]
__initdata
=
{
{
/* UART0 */
.
dev_id
=
"mb:16"
,
.
clk
=
&
uartclk
,
},
{
/* UART1 */
.
dev_id
=
"mb:17"
,
.
clk
=
&
uartclk
,
},
{
/* KMI0 */
.
dev_id
=
"mb:18"
,
.
clk
=
&
clk24mhz
,
},
{
/* KMI1 */
.
dev_id
=
"mb:19"
,
.
clk
=
&
clk24mhz
,
},
{
/* MMCI - IntegratorCP */
.
dev_id
=
"mb:1c"
,
.
clk
=
&
uartclk
,
}
};
static
int
__init
integrator_init
(
void
)
{
int
i
;
for
(
i
=
0
;
i
<
ARRAY_SIZE
(
lookups
);
i
++
)
clkdev_add
(
&
lookups
[
i
]);
for
(
i
=
0
;
i
<
ARRAY_SIZE
(
amba_devs
);
i
++
)
{
struct
amba_device
*
d
=
amba_devs
[
i
];
amba_device_register
(
d
,
&
iomem_resource
);
...
...
arch/arm/mach-integrator/impd1.c
浏览文件 @
e902be56
...
...
@@ -22,13 +22,13 @@
#include <linux/amba/clcd.h>
#include <linux/io.h>
#include <asm/clkdev.h>
#include <mach/clkdev.h>
#include <asm/hardware/icst525.h>
#include <mach/lm.h>
#include <mach/impd1.h>
#include <asm/sizes.h>
#include "clock.h"
static
int
module_id
;
module_param_named
(
lmid
,
module_id
,
int
,
0444
);
...
...
@@ -37,6 +37,7 @@ MODULE_PARM_DESC(lmid, "logic module stack position");
struct
impd1_module
{
void
__iomem
*
base
;
struct
clk
vcos
[
2
];
struct
clk_lookup
*
clks
[
3
];
};
static
const
struct
icst525_params
impd1_vco_params
=
{
...
...
@@ -339,9 +340,8 @@ static struct impd1_device impd1_devs[] = {
}
};
static
const
char
*
impd1_vconames
[
2
]
=
{
"CLCDCLK"
,
"AUXVCO2"
,
static
struct
clk
fixed_14745600
=
{
.
rate
=
14745600
,
};
static
int
impd1_probe
(
struct
lm_device
*
dev
)
...
...
@@ -374,14 +374,20 @@ static int impd1_probe(struct lm_device *dev)
for
(
i
=
0
;
i
<
ARRAY_SIZE
(
impd1
->
vcos
);
i
++
)
{
impd1
->
vcos
[
i
].
owner
=
THIS_MODULE
,
impd1
->
vcos
[
i
].
name
=
impd1_vconames
[
i
],
impd1
->
vcos
[
i
].
params
=
&
impd1_vco_params
,
impd1
->
vcos
[
i
].
data
=
impd1
,
impd1
->
vcos
[
i
].
setvco
=
impd1_setvco
;
clk_register
(
&
impd1
->
vcos
[
i
]);
}
impd1
->
clks
[
0
]
=
clkdev_alloc
(
&
impd1
->
vcos
[
0
],
NULL
,
"lm%x:01000"
,
dev
->
id
);
impd1
->
clks
[
1
]
=
clkdev_alloc
(
&
fixed_14745600
,
NULL
,
"lm%x:00100"
,
dev
->
id
);
impd1
->
clks
[
2
]
=
clkdev_alloc
(
&
fixed_14745600
,
NULL
,
"lm%x:00200"
,
dev
->
id
);
for
(
i
=
0
;
i
<
ARRAY_SIZE
(
impd1
->
clks
);
i
++
)
clkdev_add
(
impd1
->
clks
[
i
]);
for
(
i
=
0
;
i
<
ARRAY_SIZE
(
impd1_devs
);
i
++
)
{
struct
impd1_device
*
idev
=
impd1_devs
+
i
;
struct
amba_device
*
d
;
...
...
@@ -434,8 +440,8 @@ static void impd1_remove(struct lm_device *dev)
device_for_each_child
(
&
dev
->
dev
,
NULL
,
impd1_remove_one
);
for
(
i
=
0
;
i
<
ARRAY_SIZE
(
impd1
->
vco
s
);
i
++
)
clk
_unregister
(
&
impd1
->
vco
s
[
i
]);
for
(
i
=
0
;
i
<
ARRAY_SIZE
(
impd1
->
clk
s
);
i
++
)
clk
dev_drop
(
impd1
->
clk
s
[
i
]);
lm_set_drvdata
(
dev
,
NULL
);
...
...
arch/arm/mach-integrator/include/mach/clkdev.h
0 → 100644
浏览文件 @
e902be56
#ifndef __ASM_MACH_CLKDEV_H
#define __ASM_MACH_CLKDEV_H
#include <linux/module.h>
#include <asm/hardware/icst525.h>
struct
clk
{
unsigned
long
rate
;
struct
module
*
owner
;
const
struct
icst525_params
*
params
;
void
*
data
;
void
(
*
setvco
)(
struct
clk
*
,
struct
icst525_vco
vco
);
};
static
inline
int
__clk_get
(
struct
clk
*
clk
)
{
return
try_module_get
(
clk
->
owner
);
}
static
inline
void
__clk_put
(
struct
clk
*
clk
)
{
module_put
(
clk
->
owner
);
}
#endif
arch/arm/mach-integrator/integrator_cp.c
浏览文件 @
e902be56
...
...
@@ -21,6 +21,8 @@
#include <linux/amba/clcd.h>
#include <linux/io.h>
#include <asm/clkdev.h>
#include <mach/clkdev.h>
#include <mach/hardware.h>
#include <asm/irq.h>
#include <asm/setup.h>
...
...
@@ -38,7 +40,6 @@
#include <asm/mach/time.h>
#include "common.h"
#include "clock.h"
#define INTCP_PA_MMC_BASE 0x1c000000
#define INTCP_PA_AACI_BASE 0x1d000000
...
...
@@ -289,15 +290,16 @@ static void cp_auxvco_set(struct clk *clk, struct icst525_vco vco)
writel
(
0
,
CM_LOCK
);
}
static
struct
clk
cp_clcd_clk
=
{
.
name
=
"CLCDCLK"
,
static
struct
clk
cp_auxclk
=
{
.
params
=
&
cp_auxvco_params
,
.
setvco
=
cp_auxvco_set
,
};
static
struct
clk
cp_mmci_clk
=
{
.
name
=
"MCLK"
,
.
rate
=
14745600
,
static
struct
clk_lookup
cp_lookups
[]
=
{
{
/* CLCD */
.
dev_id
=
"mb:c0"
,
.
clk
=
&
cp_auxclk
,
},
};
/*
...
...
@@ -554,8 +556,8 @@ static void __init intcp_init(void)
{
int
i
;
clk_register
(
&
cp_clcd_clk
);
clk_register
(
&
cp_mmci_clk
);
for
(
i
=
0
;
i
<
ARRAY_SIZE
(
cp_lookups
);
i
++
)
clkdev_add
(
&
cp_lookups
[
i
]
);
platform_add_devices
(
intcp_devs
,
ARRAY_SIZE
(
intcp_devs
));
...
...
arch/arm/mach-pxa/clock.c
浏览文件 @
e902be56
...
...
@@ -12,6 +12,7 @@
#include <linux/platform_device.h>
#include <linux/delay.h>
#include <asm/clkdev.h>
#include <mach/pxa2xx-regs.h>
#include <mach/pxa2xx-gpio.h>
#include <mach/hardware.h>
...
...
@@ -20,45 +21,8 @@
#include "generic.h"
#include "clock.h"
static
LIST_HEAD
(
clocks
);
static
DEFINE_MUTEX
(
clocks_mutex
);
static
DEFINE_SPINLOCK
(
clocks_lock
);
static
struct
clk
*
clk_lookup
(
struct
device
*
dev
,
const
char
*
id
)
{
struct
clk
*
p
;
list_for_each_entry
(
p
,
&
clocks
,
node
)
if
(
strcmp
(
id
,
p
->
name
)
==
0
&&
p
->
dev
==
dev
)
return
p
;
return
NULL
;
}
struct
clk
*
clk_get
(
struct
device
*
dev
,
const
char
*
id
)
{
struct
clk
*
p
,
*
clk
=
ERR_PTR
(
-
ENOENT
);
mutex_lock
(
&
clocks_mutex
);
p
=
clk_lookup
(
dev
,
id
);
if
(
!
p
)
p
=
clk_lookup
(
NULL
,
id
);
if
(
p
)
clk
=
p
;
mutex_unlock
(
&
clocks_mutex
);
if
(
!
IS_ERR
(
clk
)
&&
clk
->
ops
==
NULL
)
clk
=
clk
->
other
;
return
clk
;
}
EXPORT_SYMBOL
(
clk_get
);
void
clk_put
(
struct
clk
*
clk
)
{
}
EXPORT_SYMBOL
(
clk_put
);
int
clk_enable
(
struct
clk
*
clk
)
{
unsigned
long
flags
;
...
...
@@ -116,37 +80,27 @@ const struct clkops clk_cken_ops = {
.
disable
=
clk_cken_disable
,
};
void
clks_register
(
struct
clk
*
clks
,
size_t
num
)
void
clks_register
(
struct
clk
_lookup
*
clks
,
size_t
num
)
{
int
i
;
mutex_lock
(
&
clocks_mutex
);
for
(
i
=
0
;
i
<
num
;
i
++
)
list_add
(
&
clks
[
i
].
node
,
&
clocks
);
mutex_unlock
(
&
clocks_mutex
);
clkdev_add
(
&
clks
[
i
]);
}
int
clk_add_alias
(
char
*
alias
,
struct
device
*
alias_dev
,
char
*
id
,
struct
device
*
dev
)
{
struct
clk
*
r
=
clk_
lookup
(
dev
,
id
);
struct
clk
*
new
;
struct
clk
*
r
=
clk_
get
(
dev
,
id
);
struct
clk
_lookup
*
l
;
if
(
!
r
)
return
-
ENODEV
;
new
=
kzalloc
(
sizeof
(
struct
clk
),
GFP_KERNEL
);
if
(
!
new
)
return
-
ENOMEM
;
new
->
name
=
alias
;
new
->
dev
=
alias_dev
;
new
->
other
=
r
;
mutex_lock
(
&
clocks_mutex
);
list_add
(
&
new
->
node
,
&
clocks
);
mutex_unlock
(
&
clocks_mutex
);
l
=
clkdev_alloc
(
r
,
alias
,
alias_dev
?
dev_name
(
alias_dev
)
:
NULL
);
clk_put
(
r
);
if
(
!
l
)
return
-
ENODEV
;
clkdev_add
(
l
);
return
0
;
}
arch/arm/mach-pxa/clock.h
浏览文件 @
e902be56
#include <linux/list.h>
struct
clk
;
#include <asm/clkdev.h>
struct
clkops
{
void
(
*
enable
)(
struct
clk
*
);
...
...
@@ -9,9 +7,6 @@ struct clkops {
};
struct
clk
{
struct
list_head
node
;
const
char
*
name
;
struct
device
*
dev
;
const
struct
clkops
*
ops
;
unsigned
long
rate
;
unsigned
int
cken
;
...
...
@@ -20,41 +15,31 @@ struct clk {
struct
clk
*
other
;
};
#define INIT_C
KEN(_name, _cken, _rate, _delay, _dev)
\
#define INIT_C
LKREG(_clk,_devname,_conname)
\
{ \
.name = _name, \
.dev = _dev, \
.clk = _clk, \
.dev_id = _devname, \
.con_id = _conname, \
}
#define DEFINE_CKEN(_name, _cken, _rate, _delay) \
struct clk clk_##_name = { \
.ops = &clk_cken_ops, \
.rate = _rate, \
.cken = CKEN_##_cken, \
.delay = _delay, \
}
#define INIT_CK(_name, _cken, _ops, _dev) \
{ \
.name = _name, \
.dev = _dev, \
#define DEFINE_CK(_name, _cken, _ops) \
struct clk clk_##_name = { \
.ops = _ops, \
.cken = CKEN_##_cken, \
}
/*
* This is a placeholder to alias one clock device+name pair
* to another struct clk.
*/
#define INIT_CKOTHER(_name, _other, _dev) \
{ \
.name = _name, \
.dev = _dev, \
.other = _other, \
}
#define INIT_CLK(_name, _ops, _rate, _delay, _dev) \
{ \
.name = _name, \
.dev = _dev, \
.ops = _ops, \
.rate = _rate, \
#define DEFINE_CLK(_name, _ops, _rate, _delay) \
struct clk clk_##_name = { \
.ops = _ops, \
.rate = _rate, \
.delay = _delay, \
}
...
...
@@ -64,20 +49,16 @@ void clk_cken_enable(struct clk *clk);
void
clk_cken_disable
(
struct
clk
*
clk
);
#ifdef CONFIG_PXA3xx
#define PXA3xx_CKEN(_name, _cken, _rate, _delay, _dev) \
{ \
.name = _name, \
.dev = _dev, \
#define DEFINE_PXA3_CKEN(_name, _cken, _rate, _delay) \
struct clk clk_##_name = { \
.ops = &clk_pxa3xx_cken_ops, \
.rate = _rate, \
.cken = CKEN_##_cken, \
.delay = _delay, \
}
#define PXA3xx_CK(_name, _cken, _ops, _dev) \
{ \
.name = _name, \
.dev = _dev, \
#define DEFINE_PXA3_CK(_name, _cken, _ops) \
struct clk clk_##_name = { \
.ops = _ops, \
.cken = CKEN_##_cken, \
}
...
...
@@ -87,7 +68,7 @@ extern void clk_pxa3xx_cken_enable(struct clk *);
extern
void
clk_pxa3xx_cken_disable
(
struct
clk
*
);
#endif
void
clks_register
(
struct
clk
*
clks
,
size_t
num
);
void
clks_register
(
struct
clk
_lookup
*
clks
,
size_t
num
);
int
clk_add_alias
(
char
*
alias
,
struct
device
*
alias_dev
,
char
*
id
,
struct
device
*
dev
);
arch/arm/mach-pxa/include/mach/clkdev.h
0 → 100644
浏览文件 @
e902be56
#ifndef __ASM_MACH_CLKDEV_H
#define __ASM_MACH_CLKDEV_H
#define __clk_get(clk) ({ 1; })
#define __clk_put(clk) do { } while (0)
#endif
arch/arm/mach-pxa/pwm.c
浏览文件 @
e902be56
...
...
@@ -173,7 +173,7 @@ static struct pwm_device *pwm_probe(struct platform_device *pdev,
return
ERR_PTR
(
-
ENOMEM
);
}
pwm
->
clk
=
clk_get
(
&
pdev
->
dev
,
"PWMCLK"
);
pwm
->
clk
=
clk_get
(
&
pdev
->
dev
,
NULL
);
if
(
IS_ERR
(
pwm
->
clk
))
{
ret
=
PTR_ERR
(
pwm
->
clk
);
goto
err_free
;
...
...
arch/arm/mach-pxa/pxa25x.c
浏览文件 @
e902be56
...
...
@@ -167,36 +167,51 @@ static const struct clkops clk_pxa25x_gpio11_ops = {
* 95.842MHz -> MMC 19.169MHz, I2C 31.949MHz, FICP 47.923MHz, USB 47.923MHz
* 147.456MHz -> UART 14.7456MHz, AC97 12.288MHz, I2S 5.672MHz (allegedly)
*/
static
struct
clk
pxa25x_hwuart_clk
=
INIT_CKEN
(
"UARTCLK"
,
HWUART
,
14745600
,
1
,
&
pxa_device_hwuart
.
dev
)
;
static
DEFINE_CKEN
(
pxa25x_hwuart
,
HWUART
,
14745600
,
1
);
static
struct
clk_lookup
pxa25x_hwuart_clkreg
=
INIT_CLKREG
(
&
clk_pxa25x_hwuart
,
"pxa2xx-uart.3"
,
NULL
);
/*
* PXA 2xx clock declarations.
*/
static
struct
clk
pxa25x_clks
[]
=
{
INIT_CK
(
"LCDCLK"
,
LCD
,
&
clk_pxa25x_lcd_ops
,
&
pxa_device_fb
.
dev
),
INIT_CKEN
(
"UARTCLK"
,
FFUART
,
14745600
,
1
,
&
pxa_device_ffuart
.
dev
),
INIT_CKEN
(
"UARTCLK"
,
BTUART
,
14745600
,
1
,
&
pxa_device_btuart
.
dev
),
INIT_CKEN
(
"UARTCLK"
,
STUART
,
14745600
,
1
,
NULL
),
INIT_CKEN
(
"UDCCLK"
,
USB
,
47923000
,
5
,
&
pxa25x_device_udc
.
dev
),
INIT_CLK
(
"GPIO11_CLK"
,
&
clk_pxa25x_gpio11_ops
,
3686400
,
0
,
NULL
),
INIT_CLK
(
"GPIO12_CLK"
,
&
clk_pxa25x_gpio12_ops
,
32768
,
0
,
NULL
),
INIT_CKEN
(
"MMCCLK"
,
MMC
,
19169000
,
0
,
&
pxa_device_mci
.
dev
),
INIT_CKEN
(
"I2CCLK"
,
I2C
,
31949000
,
0
,
&
pxa_device_i2c
.
dev
),
INIT_CKEN
(
"SSPCLK"
,
SSP
,
3686400
,
0
,
&
pxa25x_device_ssp
.
dev
),
INIT_CKEN
(
"SSPCLK"
,
NSSP
,
3686400
,
0
,
&
pxa25x_device_nssp
.
dev
),
INIT_CKEN
(
"SSPCLK"
,
ASSP
,
3686400
,
0
,
&
pxa25x_device_assp
.
dev
),
INIT_CKEN
(
"PWMCLK"
,
PWM0
,
3686400
,
0
,
&
pxa25x_device_pwm0
.
dev
),
INIT_CKEN
(
"PWMCLK"
,
PWM1
,
3686400
,
0
,
&
pxa25x_device_pwm1
.
dev
),
INIT_CKEN
(
"AC97CLK"
,
AC97
,
24576000
,
0
,
NULL
),
/*
INIT_CKEN("I2SCLK", I2S, 14745600, 0, NULL),
*/
INIT_CKEN
(
"FICPCLK"
,
FICP
,
47923000
,
0
,
NULL
),
static
DEFINE_CK
(
pxa25x_lcd
,
LCD
,
&
clk_pxa25x_lcd_ops
);
static
DEFINE_CKEN
(
pxa25x_ffuart
,
FFUART
,
14745600
,
1
);
static
DEFINE_CKEN
(
pxa25x_btuart
,
BTUART
,
14745600
,
1
);
static
DEFINE_CKEN
(
pxa25x_stuart
,
STUART
,
14745600
,
1
);
static
DEFINE_CKEN
(
pxa25x_usb
,
USB
,
47923000
,
5
);
static
DEFINE_CLK
(
pxa25x_gpio11
,
&
clk_pxa25x_gpio11_ops
,
3686400
,
0
);
static
DEFINE_CLK
(
pxa25x_gpio12
,
&
clk_pxa25x_gpio12_ops
,
32768
,
0
);
static
DEFINE_CKEN
(
pxa25x_mmc
,
MMC
,
19169000
,
0
);
static
DEFINE_CKEN
(
pxa25x_i2c
,
I2C
,
31949000
,
0
);
static
DEFINE_CKEN
(
pxa25x_ssp
,
SSP
,
3686400
,
0
);
static
DEFINE_CKEN
(
pxa25x_nssp
,
NSSP
,
3686400
,
0
);
static
DEFINE_CKEN
(
pxa25x_assp
,
ASSP
,
3686400
,
0
);
static
DEFINE_CKEN
(
pxa25x_pwm0
,
PWM0
,
3686400
,
0
);
static
DEFINE_CKEN
(
pxa25x_pwm1
,
PWM1
,
3686400
,
0
);
static
DEFINE_CKEN
(
pxa25x_ac97
,
AC97
,
24576000
,
0
);
static
DEFINE_CKEN
(
pxa25x_i2s
,
I2S
,
14745600
,
0
);
static
DEFINE_CKEN
(
pxa25x_ficp
,
FICP
,
47923000
,
0
);
static
struct
clk_lookup
pxa25x_clkregs
[]
=
{
INIT_CLKREG
(
&
clk_pxa25x_lcd
,
"pxa2xx-fb"
,
NULL
),
INIT_CLKREG
(
&
clk_pxa25x_ffuart
,
"pxa2xx-uart.0"
,
NULL
),
INIT_CLKREG
(
&
clk_pxa25x_btuart
,
"pxa2xx-uart.1"
,
NULL
),
INIT_CLKREG
(
&
clk_pxa25x_stuart
,
"pxa2xx-uart.2"
,
NULL
),
INIT_CLKREG
(
&
clk_pxa25x_usb
,
"pxa25x-udc"
,
NULL
),
INIT_CLKREG
(
&
clk_pxa25x_mmc
,
"pxa2xx-mci.0"
,
NULL
),
INIT_CLKREG
(
&
clk_pxa25x_i2c
,
"pxa2xx-i2c.0"
,
NULL
),
INIT_CLKREG
(
&
clk_pxa25x_ssp
,
"pxa25x-ssp.0"
,
NULL
),
INIT_CLKREG
(
&
clk_pxa25x_nssp
,
"pxa25x-nssp.1"
,
NULL
),
INIT_CLKREG
(
&
clk_pxa25x_assp
,
"pxa25x-nssp.2"
,
NULL
),
INIT_CLKREG
(
&
clk_pxa25x_pwm0
,
"pxa25x-pwm.0"
,
NULL
),
INIT_CLKREG
(
&
clk_pxa25x_pwm1
,
"pxa25x-pwm.1"
,
NULL
),
INIT_CLKREG
(
&
clk_pxa25x_i2s
,
"pxa2xx-i2s"
,
NULL
),
INIT_CLKREG
(
&
clk_pxa25x_stuart
,
"pxa2xx-ir"
,
"UARTCLK"
),
INIT_CLKREG
(
&
clk_pxa25x_ficp
,
"pxa2xx-ir"
,
"FICPCLK"
),
INIT_CLKREG
(
&
clk_pxa25x_ac97
,
NULL
,
"AC97CLK"
),
INIT_CLKREG
(
&
clk_pxa25x_gpio11
,
NULL
,
"GPIO11_CLK"
),
INIT_CLKREG
(
&
clk_pxa25x_gpio12
,
NULL
,
"GPIO12_CLK"
),
};
#ifdef CONFIG_PM
...
...
@@ -336,7 +351,7 @@ static int __init pxa25x_init(void)
reset_status
=
RCSR
;
clks_register
(
pxa25x_clk
s
,
ARRAY_SIZE
(
pxa25x_clk
s
));
clks_register
(
pxa25x_clk
regs
,
ARRAY_SIZE
(
pxa25x_clkreg
s
));
if
((
ret
=
pxa_init_dma
(
16
)))
return
ret
;
...
...
@@ -357,7 +372,7 @@ static int __init pxa25x_init(void)
/* Only add HWUART for PXA255/26x; PXA210/250 do not have it. */
if
(
cpu_is_pxa255
()
||
cpu_is_pxa26x
())
{
clks_register
(
&
pxa25x_hwuart_clk
,
1
);
clks_register
(
&
pxa25x_hwuart_clk
reg
,
1
);
ret
=
platform_device_register
(
&
pxa_device_hwuart
);
}
...
...
arch/arm/mach-pxa/pxa27x.c
浏览文件 @
e902be56
...
...
@@ -144,40 +144,59 @@ static const struct clkops clk_pxa27x_lcd_ops = {
.
getrate
=
clk_pxa27x_lcd_getrate
,
};
static
struct
clk
pxa27x_clks
[]
=
{
INIT_CK
(
"LCDCLK"
,
LCD
,
&
clk_pxa27x_lcd_ops
,
&
pxa_device_fb
.
dev
),
INIT_CK
(
"CAMCLK"
,
CAMERA
,
&
clk_pxa27x_lcd_ops
,
NULL
),
INIT_CKEN
(
"UARTCLK"
,
FFUART
,
14857000
,
1
,
&
pxa_device_ffuart
.
dev
),
INIT_CKEN
(
"UARTCLK"
,
BTUART
,
14857000
,
1
,
&
pxa_device_btuart
.
dev
),
INIT_CKEN
(
"UARTCLK"
,
STUART
,
14857000
,
1
,
NULL
),
INIT_CKEN
(
"I2SCLK"
,
I2S
,
14682000
,
0
,
&
pxa_device_i2s
.
dev
),
INIT_CKEN
(
"I2CCLK"
,
I2C
,
32842000
,
0
,
&
pxa_device_i2c
.
dev
),
INIT_CKEN
(
"UDCCLK"
,
USB
,
48000000
,
5
,
&
pxa27x_device_udc
.
dev
),
INIT_CKEN
(
"MMCCLK"
,
MMC
,
19500000
,
0
,
&
pxa_device_mci
.
dev
),
INIT_CKEN
(
"FICPCLK"
,
FICP
,
48000000
,
0
,
&
pxa_device_ficp
.
dev
),
INIT_CKEN
(
"USBCLK"
,
USBHOST
,
48000000
,
0
,
&
pxa27x_device_ohci
.
dev
),
INIT_CKEN
(
"I2CCLK"
,
PWRI2C
,
13000000
,
0
,
&
pxa27x_device_i2c_power
.
dev
),
INIT_CKEN
(
"KBDCLK"
,
KEYPAD
,
32768
,
0
,
&
pxa27x_device_keypad
.
dev
),
INIT_CKEN
(
"SSPCLK"
,
SSP1
,
13000000
,
0
,
&
pxa27x_device_ssp1
.
dev
),
INIT_CKEN
(
"SSPCLK"
,
SSP2
,
13000000
,
0
,
&
pxa27x_device_ssp2
.
dev
),
INIT_CKEN
(
"SSPCLK"
,
SSP3
,
13000000
,
0
,
&
pxa27x_device_ssp3
.
dev
),
INIT_CKEN
(
"PWMCLK"
,
PWM0
,
13000000
,
0
,
&
pxa27x_device_pwm0
.
dev
),
INIT_CKEN
(
"PWMCLK"
,
PWM1
,
13000000
,
0
,
&
pxa27x_device_pwm1
.
dev
),
INIT_CKEN
(
"AC97CLK"
,
AC97
,
24576000
,
0
,
NULL
),
INIT_CKEN
(
"AC97CONFCLK"
,
AC97CONF
,
24576000
,
0
,
NULL
),
/*
INIT_CKEN("MSLCLK", MSL, 48000000, 0, NULL),
INIT_CKEN("USIMCLK", USIM, 48000000, 0, NULL),
INIT_CKEN("MSTKCLK", MEMSTK, 19500000, 0, NULL),
INIT_CKEN("IMCLK", IM, 0, 0, NULL),
INIT_CKEN("MEMCLK", MEMC, 0, 0, NULL),
*/
static
DEFINE_CK
(
pxa27x_lcd
,
LCD
,
&
clk_pxa27x_lcd_ops
);
static
DEFINE_CK
(
pxa27x_camera
,
CAMERA
,
&
clk_pxa27x_lcd_ops
);
static
DEFINE_CKEN
(
pxa27x_ffuart
,
FFUART
,
14857000
,
1
);
static
DEFINE_CKEN
(
pxa27x_btuart
,
BTUART
,
14857000
,
1
);
static
DEFINE_CKEN
(
pxa27x_stuart
,
STUART
,
14857000
,
1
);
static
DEFINE_CKEN
(
pxa27x_i2s
,
I2S
,
14682000
,
0
);
static
DEFINE_CKEN
(
pxa27x_i2c
,
I2C
,
32842000
,
0
);
static
DEFINE_CKEN
(
pxa27x_usb
,
USB
,
48000000
,
5
);
static
DEFINE_CKEN
(
pxa27x_mmc
,
MMC
,
19500000
,
0
);
static
DEFINE_CKEN
(
pxa27x_ficp
,
FICP
,
48000000
,
0
);
static
DEFINE_CKEN
(
pxa27x_usbhost
,
USBHOST
,
48000000
,
0
);
static
DEFINE_CKEN
(
pxa27x_pwri2c
,
PWRI2C
,
13000000
,
0
);
static
DEFINE_CKEN
(
pxa27x_keypad
,
KEYPAD
,
32768
,
0
);
static
DEFINE_CKEN
(
pxa27x_ssp1
,
SSP1
,
13000000
,
0
);
static
DEFINE_CKEN
(
pxa27x_ssp2
,
SSP2
,
13000000
,
0
);
static
DEFINE_CKEN
(
pxa27x_ssp3
,
SSP3
,
13000000
,
0
);
static
DEFINE_CKEN
(
pxa27x_pwm0
,
PWM0
,
13000000
,
0
);
static
DEFINE_CKEN
(
pxa27x_pwm1
,
PWM1
,
13000000
,
0
);
static
DEFINE_CKEN
(
pxa27x_ac97
,
AC97
,
24576000
,
0
);
static
DEFINE_CKEN
(
pxa27x_ac97conf
,
AC97CONF
,
24576000
,
0
);
static
DEFINE_CKEN
(
pxa27x_msl
,
MSL
,
48000000
,
0
);
static
DEFINE_CKEN
(
pxa27x_usim
,
USIM
,
48000000
,
0
);
static
DEFINE_CKEN
(
pxa27x_memstk
,
MEMSTK
,
19500000
,
0
);
static
DEFINE_CKEN
(
pxa27x_im
,
IM
,
0
,
0
);
static
DEFINE_CKEN
(
pxa27x_memc
,
MEMC
,
0
,
0
);
static
struct
clk_lookup
pxa27x_clkregs
[]
=
{
INIT_CLKREG
(
&
clk_pxa27x_lcd
,
"pxa2xx-fb"
,
NULL
),
INIT_CLKREG
(
&
clk_pxa27x_camera
,
"pxa27x-camera.0"
,
NULL
),
INIT_CLKREG
(
&
clk_pxa27x_ffuart
,
"pxa2xx-uart.0"
,
NULL
),
INIT_CLKREG
(
&
clk_pxa27x_btuart
,
"pxa2xx-uart.1"
,
NULL
),
INIT_CLKREG
(
&
clk_pxa27x_stuart
,
"pxa2xx-uart.2"
,
NULL
),
INIT_CLKREG
(
&
clk_pxa27x_i2s
,
"pxa2xx-i2s"
,
NULL
),
INIT_CLKREG
(
&
clk_pxa27x_i2c
,
"pxa2xx-i2c.0"
,
NULL
),
INIT_CLKREG
(
&
clk_pxa27x_usb
,
"pxa27x-udc"
,
NULL
),
INIT_CLKREG
(
&
clk_pxa27x_mmc
,
"pxa2xx-mci.0"
,
NULL
),
INIT_CLKREG
(
&
clk_pxa27x_stuart
,
"pxa2xx-ir"
,
"UARTCLK"
),
INIT_CLKREG
(
&
clk_pxa27x_ficp
,
"pxa2xx-ir"
,
"FICPCLK"
),
INIT_CLKREG
(
&
clk_pxa27x_usbhost
,
"pxa27x-ohci"
,
NULL
),
INIT_CLKREG
(
&
clk_pxa27x_pwri2c
,
"pxa2xx-i2c.1"
,
NULL
),
INIT_CLKREG
(
&
clk_pxa27x_keypad
,
"pxa27x-keypad"
,
NULL
),
INIT_CLKREG
(
&
clk_pxa27x_ssp1
,
"pxa27x-ssp.0"
,
NULL
),
INIT_CLKREG
(
&
clk_pxa27x_ssp2
,
"pxa27x-ssp.1"
,
NULL
),
INIT_CLKREG
(
&
clk_pxa27x_ssp3
,
"pxa27x-ssp.2"
,
NULL
),
INIT_CLKREG
(
&
clk_pxa27x_pwm0
,
"pxa27x-pwm.0"
,
NULL
),
INIT_CLKREG
(
&
clk_pxa27x_pwm1
,
"pxa27x-pwm.1"
,
NULL
),
INIT_CLKREG
(
&
clk_pxa27x_ac97
,
NULL
,
"AC97CLK"
),
INIT_CLKREG
(
&
clk_pxa27x_ac97conf
,
NULL
,
"AC97CONFCLK"
),
INIT_CLKREG
(
&
clk_pxa27x_msl
,
NULL
,
"MSLCLK"
),
INIT_CLKREG
(
&
clk_pxa27x_usim
,
NULL
,
"USIMCLK"
),
INIT_CLKREG
(
&
clk_pxa27x_memstk
,
NULL
,
"MSTKCLK"
),
INIT_CLKREG
(
&
clk_pxa27x_im
,
NULL
,
"IMCLK"
),
INIT_CLKREG
(
&
clk_pxa27x_memc
,
NULL
,
"MEMCLK"
),
};
#ifdef CONFIG_PM
...
...
@@ -380,7 +399,7 @@ static int __init pxa27x_init(void)
reset_status
=
RCSR
;
clks_register
(
pxa27x_clk
s
,
ARRAY_SIZE
(
pxa27x_clk
s
));
clks_register
(
pxa27x_clk
regs
,
ARRAY_SIZE
(
pxa27x_clkreg
s
));
if
((
ret
=
pxa_init_dma
(
32
)))
return
ret
;
...
...
arch/arm/mach-pxa/pxa300.c
浏览文件 @
e902be56
...
...
@@ -85,14 +85,16 @@ static struct pxa3xx_mfp_addr_map pxa310_mfp_addr_map[] __initdata = {
MFP_ADDR_END
,
};
static
struct
clk
common_clks
[]
=
{
PXA3xx_CKEN
(
"NANDCLK"
,
NAND
,
156000000
,
0
,
&
pxa3xx_device_nand
.
dev
),
static
DEFINE_PXA3_CKEN
(
common_nand
,
NAND
,
156000000
,
0
);
static
struct
clk_lookup
common_clkregs
[]
=
{
INIT_CLKREG
(
&
clk_common_nand
,
"pxa3xx-nand"
,
"NANDCLK"
),
};
static
struct
clk
pxa310_clks
[]
=
{
#ifdef CONFIG_CPU_PXA310
PXA3xx_CKEN
(
"MMCCLK"
,
MMC3
,
19500000
,
0
,
&
pxa3xx_device_mci3
.
dev
),
#endif
static
DEFINE_PXA3_CKEN
(
pxa310_mmc3
,
MMC3
,
19500000
,
0
);
static
struct
clk_lookup
pxa310_clkregs
[]
=
{
INIT_CLKREG
(
&
clk_pxa310_mmc3
,
"pxa2xx-mci.2"
,
"MMCCLK"
),
};
static
int
__init
pxa300_init
(
void
)
...
...
@@ -100,12 +102,12 @@ static int __init pxa300_init(void)
if
(
cpu_is_pxa300
()
||
cpu_is_pxa310
())
{
pxa3xx_init_mfp
();
pxa3xx_mfp_init_addr
(
pxa300_mfp_addr_map
);
clks_register
(
ARRAY_AND_SIZE
(
common_clks
));
clks_register
(
ARRAY_AND_SIZE
(
common_clk
reg
s
));
}
if
(
cpu_is_pxa310
())
{
pxa3xx_mfp_init_addr
(
pxa310_mfp_addr_map
);
clks_register
(
ARRAY_AND_SIZE
(
pxa310_clks
));
clks_register
(
ARRAY_AND_SIZE
(
pxa310_clk
reg
s
));
}
return
0
;
...
...
arch/arm/mach-pxa/pxa320.c
浏览文件 @
e902be56
...
...
@@ -80,8 +80,10 @@ static struct pxa3xx_mfp_addr_map pxa320_mfp_addr_map[] __initdata = {
MFP_ADDR_END
,
};
static
struct
clk
pxa320_clks
[]
=
{
PXA3xx_CKEN
(
"NANDCLK"
,
NAND
,
104000000
,
0
,
&
pxa3xx_device_nand
.
dev
),
static
DEFINE_PXA3_CKEN
(
pxa320_nand
,
NAND
,
104000000
,
0
);
static
struct
clk_lookup
pxa320_clkregs
[]
=
{
INIT_CLKREG
(
&
clk_pxa320_nand
,
"pxa3xx-nand"
,
"NANDCLK"
),
};
static
int
__init
pxa320_init
(
void
)
...
...
@@ -89,7 +91,7 @@ static int __init pxa320_init(void)
if
(
cpu_is_pxa320
())
{
pxa3xx_init_mfp
();
pxa3xx_mfp_init_addr
(
pxa320_mfp_addr_map
);
clks_register
(
ARRAY_AND_SIZE
(
pxa320_clks
));
clks_register
(
ARRAY_AND_SIZE
(
pxa320_clk
reg
s
));
}
return
0
;
...
...
arch/arm/mach-pxa/pxa3xx.c
浏览文件 @
e902be56
...
...
@@ -216,43 +216,58 @@ static const struct clkops clk_dummy_ops = {
.
disable
=
clk_dummy_disable
,
};
static
struct
clk
pxa3xx_clks
[]
=
{
{
.
name
=
"CLK_POUT"
,
.
ops
=
&
clk_pout_ops
,
.
rate
=
13000000
,
.
delay
=
70
,
},
/* Power I2C clock is always on */
{
.
name
=
"I2CCLK"
,
.
ops
=
&
clk_dummy_ops
,
.
dev
=
&
pxa3xx_device_i2c_power
.
dev
,
},
PXA3xx_CK
(
"LCDCLK"
,
LCD
,
&
clk_pxa3xx_hsio_ops
,
&
pxa_device_fb
.
dev
),
PXA3xx_CK
(
"CAMCLK"
,
CAMERA
,
&
clk_pxa3xx_hsio_ops
,
NULL
),
PXA3xx_CK
(
"AC97CLK"
,
AC97
,
&
clk_pxa3xx_ac97_ops
,
NULL
),
PXA3xx_CKEN
(
"UARTCLK"
,
FFUART
,
14857000
,
1
,
&
pxa_device_ffuart
.
dev
),
PXA3xx_CKEN
(
"UARTCLK"
,
BTUART
,
14857000
,
1
,
&
pxa_device_btuart
.
dev
),
PXA3xx_CKEN
(
"UARTCLK"
,
STUART
,
14857000
,
1
,
NULL
),
PXA3xx_CKEN
(
"I2CCLK"
,
I2C
,
32842000
,
0
,
&
pxa_device_i2c
.
dev
),
PXA3xx_CKEN
(
"UDCCLK"
,
UDC
,
48000000
,
5
,
&
pxa27x_device_udc
.
dev
),
PXA3xx_CKEN
(
"USBCLK"
,
USBH
,
48000000
,
0
,
&
pxa27x_device_ohci
.
dev
),
PXA3xx_CKEN
(
"KBDCLK"
,
KEYPAD
,
32768
,
0
,
&
pxa27x_device_keypad
.
dev
),
static
struct
clk
clk_pxa3xx_pout
=
{
.
ops
=
&
clk_pout_ops
,
.
rate
=
13000000
,
.
delay
=
70
,
};
PXA3xx_CKEN
(
"SSPCLK"
,
SSP1
,
13000000
,
0
,
&
pxa27x_device_ssp1
.
dev
),
PXA3xx_CKEN
(
"SSPCLK"
,
SSP2
,
13000000
,
0
,
&
pxa27x_device_ssp2
.
dev
),
PXA3xx_CKEN
(
"SSPCLK"
,
SSP3
,
13000000
,
0
,
&
pxa27x_device_ssp3
.
dev
),
PXA3xx_CKEN
(
"SSPCLK"
,
SSP4
,
13000000
,
0
,
&
pxa3xx_device_ssp4
.
dev
),
PXA3xx_CKEN
(
"PWMCLK"
,
PWM0
,
13000000
,
0
,
&
pxa27x_device_pwm0
.
dev
),
PXA3xx_CKEN
(
"PWMCLK"
,
PWM1
,
13000000
,
0
,
&
pxa27x_device_pwm1
.
dev
),
static
struct
clk
clk_dummy
=
{
.
ops
=
&
clk_dummy_ops
,
};
PXA3xx_CKEN
(
"MMCCLK"
,
MMC1
,
19500000
,
0
,
&
pxa_device_mci
.
dev
),
PXA3xx_CKEN
(
"MMCCLK"
,
MMC2
,
19500000
,
0
,
&
pxa3xx_device_mci2
.
dev
),
static
DEFINE_PXA3_CK
(
pxa3xx_lcd
,
LCD
,
&
clk_pxa3xx_hsio_ops
);
static
DEFINE_PXA3_CK
(
pxa3xx_camera
,
CAMERA
,
&
clk_pxa3xx_hsio_ops
);
static
DEFINE_PXA3_CK
(
pxa3xx_ac97
,
AC97
,
&
clk_pxa3xx_ac97_ops
);
static
DEFINE_PXA3_CKEN
(
pxa3xx_ffuart
,
FFUART
,
14857000
,
1
);
static
DEFINE_PXA3_CKEN
(
pxa3xx_btuart
,
BTUART
,
14857000
,
1
);
static
DEFINE_PXA3_CKEN
(
pxa3xx_stuart
,
STUART
,
14857000
,
1
);
static
DEFINE_PXA3_CKEN
(
pxa3xx_i2c
,
I2C
,
32842000
,
0
);
static
DEFINE_PXA3_CKEN
(
pxa3xx_udc
,
UDC
,
48000000
,
5
);
static
DEFINE_PXA3_CKEN
(
pxa3xx_usbh
,
USBH
,
48000000
,
0
);
static
DEFINE_PXA3_CKEN
(
pxa3xx_keypad
,
KEYPAD
,
32768
,
0
);
static
DEFINE_PXA3_CKEN
(
pxa3xx_ssp1
,
SSP1
,
13000000
,
0
);
static
DEFINE_PXA3_CKEN
(
pxa3xx_ssp2
,
SSP2
,
13000000
,
0
);
static
DEFINE_PXA3_CKEN
(
pxa3xx_ssp3
,
SSP3
,
13000000
,
0
);
static
DEFINE_PXA3_CKEN
(
pxa3xx_ssp4
,
SSP4
,
13000000
,
0
);
static
DEFINE_PXA3_CKEN
(
pxa3xx_pwm0
,
PWM0
,
13000000
,
0
);
static
DEFINE_PXA3_CKEN
(
pxa3xx_pwm1
,
PWM1
,
13000000
,
0
);
static
DEFINE_PXA3_CKEN
(
pxa3xx_mmc1
,
MMC1
,
19500000
,
0
);
static
DEFINE_PXA3_CKEN
(
pxa3xx_mmc2
,
MMC2
,
19500000
,
0
);
static
struct
clk_lookup
pxa3xx_clkregs
[]
=
{
INIT_CLKREG
(
&
clk_pxa3xx_pout
,
NULL
,
"CLK_POUT"
),
/* Power I2C clock is always on */
INIT_CLKREG
(
&
clk_dummy
,
"pxa2xx-i2c.1"
,
NULL
),
INIT_CLKREG
(
&
clk_pxa3xx_lcd
,
"pxa2xx-fb"
,
NULL
),
INIT_CLKREG
(
&
clk_pxa3xx_camera
,
NULL
,
"CAMCLK"
),
INIT_CLKREG
(
&
clk_pxa3xx_ac97
,
NULL
,
"AC97CLK"
),
INIT_CLKREG
(
&
clk_pxa3xx_ffuart
,
"pxa2xx-uart.0"
,
NULL
),
INIT_CLKREG
(
&
clk_pxa3xx_btuart
,
"pxa2xx-uart.1"
,
NULL
),
INIT_CLKREG
(
&
clk_pxa3xx_stuart
,
"pxa2xx-uart.2"
,
NULL
),
INIT_CLKREG
(
&
clk_pxa3xx_stuart
,
"pxa2xx-ir"
,
"UARTCLK"
),
INIT_CLKREG
(
&
clk_pxa3xx_i2c
,
"pxa2xx-i2c.0"
,
NULL
),
INIT_CLKREG
(
&
clk_pxa3xx_udc
,
"pxa27x-udc"
,
NULL
),
INIT_CLKREG
(
&
clk_pxa3xx_usbh
,
"pxa27x-ohci"
,
NULL
),
INIT_CLKREG
(
&
clk_pxa3xx_keypad
,
"pxa27x-keypad"
,
NULL
),
INIT_CLKREG
(
&
clk_pxa3xx_ssp1
,
"pxa27x-ssp.0"
,
NULL
),
INIT_CLKREG
(
&
clk_pxa3xx_ssp2
,
"pxa27x-ssp.1"
,
NULL
),
INIT_CLKREG
(
&
clk_pxa3xx_ssp3
,
"pxa27x-ssp.2"
,
NULL
),
INIT_CLKREG
(
&
clk_pxa3xx_ssp4
,
"pxa27x-ssp.3"
,
NULL
),
INIT_CLKREG
(
&
clk_pxa3xx_pwm0
,
"pxa27x-pwm.0"
,
NULL
),
INIT_CLKREG
(
&
clk_pxa3xx_pwm1
,
"pxa27x-pwm.1"
,
NULL
),
INIT_CLKREG
(
&
clk_pxa3xx_mmc1
,
"pxa2xx-mci.0"
,
NULL
),
INIT_CLKREG
(
&
clk_pxa3xx_mmc2
,
"pxa2xx-mci.1"
,
NULL
),
};
#ifdef CONFIG_PM
...
...
@@ -595,7 +610,7 @@ static int __init pxa3xx_init(void)
*/
ASCR
&=
~
(
ASCR_RDH
|
ASCR_D1S
|
ASCR_D2S
|
ASCR_D3S
);
clks_register
(
pxa3xx_clk
s
,
ARRAY_SIZE
(
pxa3xx_clk
s
));
clks_register
(
pxa3xx_clk
regs
,
ARRAY_SIZE
(
pxa3xx_clkreg
s
));
if
((
ret
=
pxa_init_dma
(
32
)))
return
ret
;
...
...
arch/arm/mach-pxa/ssp.c
浏览文件 @
e902be56
...
...
@@ -356,7 +356,7 @@ static int __devinit ssp_probe(struct platform_device *pdev, int type)
}
ssp
->
pdev
=
pdev
;
ssp
->
clk
=
clk_get
(
&
pdev
->
dev
,
"SSPCLK"
);
ssp
->
clk
=
clk_get
(
&
pdev
->
dev
,
NULL
);
if
(
IS_ERR
(
ssp
->
clk
))
{
ret
=
PTR_ERR
(
ssp
->
clk
);
goto
err_free
;
...
...
arch/arm/mach-realview/clock.c
浏览文件 @
e902be56
...
...
@@ -10,9 +10,11 @@
*/
#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>
...
...
@@ -20,32 +22,6 @@
#include "clock.h"
static
LIST_HEAD
(
clocks
);
static
DEFINE_MUTEX
(
clocks_mutex
);
struct
clk
*
clk_get
(
struct
device
*
dev
,
const
char
*
id
)
{
struct
clk
*
p
,
*
clk
=
ERR_PTR
(
-
ENOENT
);
mutex_lock
(
&
clocks_mutex
);
list_for_each_entry
(
p
,
&
clocks
,
node
)
{
if
(
strcmp
(
id
,
p
->
name
)
==
0
&&
try_module_get
(
p
->
owner
))
{
clk
=
p
;
break
;
}
}
mutex_unlock
(
&
clocks_mutex
);
return
clk
;
}
EXPORT_SYMBOL
(
clk_get
);
void
clk_put
(
struct
clk
*
clk
)
{
module_put
(
clk
->
owner
);
}
EXPORT_SYMBOL
(
clk_put
);
int
clk_enable
(
struct
clk
*
clk
)
{
return
0
;
...
...
@@ -65,7 +41,9 @@ EXPORT_SYMBOL(clk_get_rate);
long
clk_round_rate
(
struct
clk
*
clk
,
unsigned
long
rate
)
{
return
rate
;
struct
icst307_vco
vco
;
vco
=
icst307_khz_to_vco
(
clk
->
params
,
rate
/
1000
);
return
icst307_khz
(
clk
->
params
,
vco
)
*
1000
;
}
EXPORT_SYMBOL
(
clk_round_rate
);
...
...
@@ -78,57 +56,9 @@ int clk_set_rate(struct clk *clk, unsigned long rate)
vco
=
icst307_khz_to_vco
(
clk
->
params
,
rate
/
1000
);
clk
->
rate
=
icst307_khz
(
clk
->
params
,
vco
)
*
1000
;
printk
(
"Clock %s: setting VCO reg params: S=%d R=%d V=%d
\n
"
,
clk
->
name
,
vco
.
s
,
vco
.
r
,
vco
.
v
);
clk
->
setvco
(
clk
,
vco
);
ret
=
0
;
}
return
ret
;
}
EXPORT_SYMBOL
(
clk_set_rate
);
/*
* These are fixed clocks.
*/
static
struct
clk
kmi_clk
=
{
.
name
=
"KMIREFCLK"
,
.
rate
=
24000000
,
};
static
struct
clk
uart_clk
=
{
.
name
=
"UARTCLK"
,
.
rate
=
24000000
,
};
static
struct
clk
mmci_clk
=
{
.
name
=
"MCLK"
,
.
rate
=
24000000
,
};
int
clk_register
(
struct
clk
*
clk
)
{
mutex_lock
(
&
clocks_mutex
);
list_add
(
&
clk
->
node
,
&
clocks
);
mutex_unlock
(
&
clocks_mutex
);
return
0
;
}
EXPORT_SYMBOL
(
clk_register
);
void
clk_unregister
(
struct
clk
*
clk
)
{
mutex_lock
(
&
clocks_mutex
);
list_del
(
&
clk
->
node
);
mutex_unlock
(
&
clocks_mutex
);
}
EXPORT_SYMBOL
(
clk_unregister
);
static
int
__init
clk_init
(
void
)
{
clk_register
(
&
kmi_clk
);
clk_register
(
&
uart_clk
);
clk_register
(
&
mmci_clk
);
return
0
;
}
arch_initcall
(
clk_init
);
arch/arm/mach-realview/clock.h
浏览文件 @
e902be56
...
...
@@ -12,14 +12,8 @@ struct module;
struct
icst307_params
;
struct
clk
{
struct
list_head
node
;
unsigned
long
rate
;
struct
module
*
owner
;
const
char
*
name
;
const
struct
icst307_params
*
params
;
void
*
data
;
void
(
*
setvco
)(
struct
clk
*
,
struct
icst307_vco
vco
);
};
int
clk_register
(
struct
clk
*
clk
);
void
clk_unregister
(
struct
clk
*
clk
);
arch/arm/mach-realview/core.c
浏览文件 @
e902be56
...
...
@@ -29,6 +29,7 @@
#include <linux/clockchips.h>
#include <linux/io.h>
#include <asm/clkdev.h>
#include <asm/system.h>
#include <mach/hardware.h>
#include <asm/irq.h>
...
...
@@ -188,12 +189,59 @@ static void realview_oscvco_set(struct clk *clk, struct icst307_vco vco)
writel
(
0
,
sys_lock
);
}
struct
clk
realview_clcd_clk
=
{
.
name
=
"CLCDCLK"
,
static
struct
clk
oscvco_clk
=
{
.
params
=
&
realview_oscvco_params
,
.
setvco
=
realview_oscvco_set
,
};
/*
* These are fixed clocks.
*/
static
struct
clk
ref24_clk
=
{
.
rate
=
24000000
,
};
static
struct
clk_lookup
lookups
[]
=
{
{
/* UART0 */
.
dev_id
=
"dev:f1"
,
.
clk
=
&
ref24_clk
,
},
{
/* UART1 */
.
dev_id
=
"dev:f2"
,
.
clk
=
&
ref24_clk
,
},
{
/* UART2 */
.
dev_id
=
"dev:f3"
,
.
clk
=
&
ref24_clk
,
},
{
/* UART3 */
.
dev_id
=
"fpga:09"
,
.
clk
=
&
ref24_clk
,
},
{
/* KMI0 */
.
dev_id
=
"fpga:06"
,
.
clk
=
&
ref24_clk
,
},
{
/* KMI1 */
.
dev_id
=
"fpga:07"
,
.
clk
=
&
ref24_clk
,
},
{
/* MMC0 */
.
dev_id
=
"fpga:05"
,
.
clk
=
&
ref24_clk
,
},
{
/* EB:CLCD */
.
dev_id
=
"dev:20"
,
.
clk
=
&
oscvco_clk
,
},
{
/* PB:CLCD */
.
dev_id
=
"issp:20"
,
.
clk
=
&
oscvco_clk
,
}
};
static
int
__init
clk_init
(
void
)
{
int
i
;
for
(
i
=
0
;
i
<
ARRAY_SIZE
(
lookups
);
i
++
)
clkdev_add
(
&
lookups
[
i
]);
return
0
;
}
arch_initcall
(
clk_init
);
/*
* CLCD support.
*/
...
...
arch/arm/mach-realview/core.h
浏览文件 @
e902be56
...
...
@@ -48,7 +48,6 @@ extern struct platform_device realview_flash_device;
extern
struct
platform_device
realview_i2c_device
;
extern
struct
mmc_platform_data
realview_mmc0_plat_data
;
extern
struct
mmc_platform_data
realview_mmc1_plat_data
;
extern
struct
clk
realview_clcd_clk
;
extern
struct
clcd_board
clcd_plat_data
;
extern
void
__iomem
*
gic_cpu_base_addr
;
#ifdef CONFIG_LOCAL_TIMERS
...
...
arch/arm/mach-realview/include/mach/clkdev.h
0 → 100644
浏览文件 @
e902be56
#ifndef __ASM_MACH_CLKDEV_H
#define __ASM_MACH_CLKDEV_H
#define __clk_get(clk) ({ 1; })
#define __clk_put(clk) do { } while (0)
#endif
arch/arm/mach-realview/realview_eb.c
浏览文件 @
e902be56
...
...
@@ -372,8 +372,6 @@ static void __init realview_eb_init(void)
#endif
}
clk_register
(
&
realview_clcd_clk
);
realview_flash_register
(
&
realview_eb_flash_resource
,
1
);
platform_device_register
(
&
realview_i2c_device
);
eth_device_register
();
...
...
arch/arm/mach-realview/realview_pb1176.c
浏览文件 @
e902be56
...
...
@@ -265,8 +265,6 @@ static void __init realview_pb1176_init(void)
l2x0_init
(
__io_address
(
REALVIEW_PB1176_L220_BASE
),
0x00730000
,
0xfe000fff
);
#endif
clk_register
(
&
realview_clcd_clk
);
realview_flash_register
(
&
realview_pb1176_flash_resource
,
1
);
platform_device_register
(
&
realview_pb1176_smsc911x_device
);
...
...
arch/arm/mach-realview/realview_pb11mp.c
浏览文件 @
e902be56
...
...
@@ -312,8 +312,6 @@ static void __init realview_pb11mp_init(void)
l2x0_init
(
__io_address
(
REALVIEW_TC11MP_L220_BASE
),
0x00790000
,
0xfe000fff
);
#endif
clk_register
(
&
realview_clcd_clk
);
realview_flash_register
(
realview_pb11mp_flash_resource
,
ARRAY_SIZE
(
realview_pb11mp_flash_resource
));
platform_device_register
(
&
realview_pb11mp_smsc911x_device
);
...
...
arch/arm/mach-sa1100/clock.c
浏览文件 @
e902be56
...
...
@@ -3,6 +3,7 @@
*/
#include <linux/module.h>
#include <linux/kernel.h>
#include <linux/device.h>
#include <linux/list.h>
#include <linux/errno.h>
#include <linux/err.h>
...
...
@@ -14,36 +15,39 @@
#include <mach/hardware.h>
/*
* Very simple clock implementation - we only have one clock to
* deal with at the moment, so we only match using the "name".
* Very simple clock implementation - we only have one clock to deal with.
*/
struct
clk
{
struct
list_head
node
;
unsigned
long
rate
;
const
char
*
name
;
unsigned
int
enabled
;
void
(
*
enable
)(
void
);
void
(
*
disable
)(
void
);
};
static
LIST_HEAD
(
clocks
);
static
DEFINE_MUTEX
(
clocks_mutex
);
static
void
clk_gpio27_enable
(
void
)
{
/*
* First, set up the 3.6864MHz clock on GPIO 27 for the SA-1111:
* (SA-1110 Developer's Manual, section 9.1.2.1)
*/
GAFR
|=
GPIO_32_768kHz
;
GPDR
|=
GPIO_32_768kHz
;
TUCR
=
TUCR_3_6864MHz
;
}
static
void
clk_gpio27_disable
(
void
)
{
TUCR
=
0
;
GPDR
&=
~
GPIO_32_768kHz
;
GAFR
&=
~
GPIO_32_768kHz
;
}
static
struct
clk
clk_gpio27
;
static
DEFINE_SPINLOCK
(
clocks_lock
);
struct
clk
*
clk_get
(
struct
device
*
dev
,
const
char
*
id
)
{
struct
clk
*
p
,
*
clk
=
ERR_PTR
(
-
ENOENT
);
mutex_lock
(
&
clocks_mutex
);
list_for_each_entry
(
p
,
&
clocks
,
node
)
{
if
(
strcmp
(
id
,
p
->
name
)
==
0
)
{
clk
=
p
;
break
;
}
}
mutex_unlock
(
&
clocks_mutex
);
const
char
*
devname
=
dev_name
(
dev
);
return
clk
;
return
strcmp
(
devname
,
"sa1111.0"
)
?
ERR_PTR
(
-
ENOENT
)
:
&
clk_gpio27
;
}
EXPORT_SYMBOL
(
clk_get
);
...
...
@@ -58,7 +62,7 @@ int clk_enable(struct clk *clk)
spin_lock_irqsave
(
&
clocks_lock
,
flags
);
if
(
clk
->
enabled
++
==
0
)
clk
->
enable
();
clk
_gpio27_
enable
();
spin_unlock_irqrestore
(
&
clocks_lock
,
flags
);
return
0
;
}
...
...
@@ -72,63 +76,13 @@ void clk_disable(struct clk *clk)
spin_lock_irqsave
(
&
clocks_lock
,
flags
);
if
(
--
clk
->
enabled
==
0
)
clk
->
disable
();
clk
_gpio27_
disable
();
spin_unlock_irqrestore
(
&
clocks_lock
,
flags
);
}
EXPORT_SYMBOL
(
clk_disable
);
unsigned
long
clk_get_rate
(
struct
clk
*
clk
)
{
return
clk
->
rate
;
return
3686400
;
}
EXPORT_SYMBOL
(
clk_get_rate
);
static
void
clk_gpio27_enable
(
void
)
{
/*
* First, set up the 3.6864MHz clock on GPIO 27 for the SA-1111:
* (SA-1110 Developer's Manual, section 9.1.2.1)
*/
GAFR
|=
GPIO_32_768kHz
;
GPDR
|=
GPIO_32_768kHz
;
TUCR
=
TUCR_3_6864MHz
;
}
static
void
clk_gpio27_disable
(
void
)
{
TUCR
=
0
;
GPDR
&=
~
GPIO_32_768kHz
;
GAFR
&=
~
GPIO_32_768kHz
;
}
static
struct
clk
clk_gpio27
=
{
.
name
=
"SA1111_CLK"
,
.
rate
=
3686400
,
.
enable
=
clk_gpio27_enable
,
.
disable
=
clk_gpio27_disable
,
};
int
clk_register
(
struct
clk
*
clk
)
{
mutex_lock
(
&
clocks_mutex
);
list_add
(
&
clk
->
node
,
&
clocks
);
mutex_unlock
(
&
clocks_mutex
);
return
0
;
}
EXPORT_SYMBOL
(
clk_register
);
void
clk_unregister
(
struct
clk
*
clk
)
{
mutex_lock
(
&
clocks_mutex
);
list_del
(
&
clk
->
node
);
mutex_unlock
(
&
clocks_mutex
);
}
EXPORT_SYMBOL
(
clk_unregister
);
static
int
__init
clk_init
(
void
)
{
clk_register
(
&
clk_gpio27
);
return
0
;
}
arch_initcall
(
clk_init
);
arch/arm/mach-versatile/clock.c
浏览文件 @
e902be56
...
...
@@ -10,6 +10,7 @@
*/
#include <linux/module.h>
#include <linux/kernel.h>
#include <linux/device.h>
#include <linux/list.h>
#include <linux/errno.h>
#include <linux/err.h>
...
...
@@ -17,36 +18,11 @@
#include <linux/clk.h>
#include <linux/mutex.h>
#include <asm/clkdev.h>
#include <asm/hardware/icst307.h>
#include "clock.h"
static
LIST_HEAD
(
clocks
);
static
DEFINE_MUTEX
(
clocks_mutex
);
struct
clk
*
clk_get
(
struct
device
*
dev
,
const
char
*
id
)
{
struct
clk
*
p
,
*
clk
=
ERR_PTR
(
-
ENOENT
);
mutex_lock
(
&
clocks_mutex
);
list_for_each_entry
(
p
,
&
clocks
,
node
)
{
if
(
strcmp
(
id
,
p
->
name
)
==
0
&&
try_module_get
(
p
->
owner
))
{
clk
=
p
;
break
;
}
}
mutex_unlock
(
&
clocks_mutex
);
return
clk
;
}
EXPORT_SYMBOL
(
clk_get
);
void
clk_put
(
struct
clk
*
clk
)
{
module_put
(
clk
->
owner
);
}
EXPORT_SYMBOL
(
clk_put
);
int
clk_enable
(
struct
clk
*
clk
)
{
return
0
;
...
...
@@ -66,7 +42,9 @@ EXPORT_SYMBOL(clk_get_rate);
long
clk_round_rate
(
struct
clk
*
clk
,
unsigned
long
rate
)
{
return
rate
;
struct
icst307_vco
vco
;
vco
=
icst307_khz_to_vco
(
clk
->
params
,
rate
/
1000
);
return
icst307_khz
(
clk
->
params
,
vco
)
*
1000
;
}
EXPORT_SYMBOL
(
clk_round_rate
);
...
...
@@ -79,57 +57,9 @@ int clk_set_rate(struct clk *clk, unsigned long rate)
vco
=
icst307_khz_to_vco
(
clk
->
params
,
rate
/
1000
);
clk
->
rate
=
icst307_khz
(
clk
->
params
,
vco
)
*
1000
;
printk
(
"Clock %s: setting VCO reg params: S=%d R=%d V=%d
\n
"
,
clk
->
name
,
vco
.
s
,
vco
.
r
,
vco
.
v
);
clk
->
setvco
(
clk
,
vco
);
ret
=
0
;
}
return
ret
;
}
EXPORT_SYMBOL
(
clk_set_rate
);
/*
* These are fixed clocks.
*/
static
struct
clk
kmi_clk
=
{
.
name
=
"KMIREFCLK"
,
.
rate
=
24000000
,
};
static
struct
clk
uart_clk
=
{
.
name
=
"UARTCLK"
,
.
rate
=
24000000
,
};
static
struct
clk
mmci_clk
=
{
.
name
=
"MCLK"
,
.
rate
=
24000000
,
};
int
clk_register
(
struct
clk
*
clk
)
{
mutex_lock
(
&
clocks_mutex
);
list_add
(
&
clk
->
node
,
&
clocks
);
mutex_unlock
(
&
clocks_mutex
);
return
0
;
}
EXPORT_SYMBOL
(
clk_register
);
void
clk_unregister
(
struct
clk
*
clk
)
{
mutex_lock
(
&
clocks_mutex
);
list_del
(
&
clk
->
node
);
mutex_unlock
(
&
clocks_mutex
);
}
EXPORT_SYMBOL
(
clk_unregister
);
static
int
__init
clk_init
(
void
)
{
clk_register
(
&
kmi_clk
);
clk_register
(
&
uart_clk
);
clk_register
(
&
mmci_clk
);
return
0
;
}
arch_initcall
(
clk_init
);
arch/arm/mach-versatile/clock.h
浏览文件 @
e902be56
...
...
@@ -12,14 +12,9 @@ struct module;
struct
icst307_params
;
struct
clk
{
struct
list_head
node
;
unsigned
long
rate
;
struct
module
*
owner
;
const
char
*
name
;
const
struct
icst307_params
*
params
;
u32
oscoff
;
void
*
data
;
void
(
*
setvco
)(
struct
clk
*
,
struct
icst307_vco
vco
);
};
int
clk_register
(
struct
clk
*
clk
);
void
clk_unregister
(
struct
clk
*
clk
);
arch/arm/mach-versatile/core.c
浏览文件 @
e902be56
...
...
@@ -31,6 +31,7 @@
#include <linux/cnt32_to_63.h>
#include <linux/io.h>
#include <asm/clkdev.h>
#include <asm/system.h>
#include <mach/hardware.h>
#include <asm/irq.h>
...
...
@@ -373,22 +374,60 @@ static const struct icst307_params versatile_oscvco_params = {
static
void
versatile_oscvco_set
(
struct
clk
*
clk
,
struct
icst307_vco
vco
)
{
void
__iomem
*
sys
_lock
=
__io_address
(
VERSATILE_SYS_BASE
)
+
VERSATILE_SYS_LOCK_OFFSET
;
void
__iomem
*
sys_
osc
=
__io_address
(
VERSATILE_SYS_BASE
)
+
VERSATILE_SYS_OSCCLCD
_OFFSET
;
void
__iomem
*
sys
=
__io_address
(
VERSATILE_SYS_BASE
)
;
void
__iomem
*
sys_
lock
=
sys
+
VERSATILE_SYS_LOCK
_OFFSET
;
u32
val
;
val
=
readl
(
sys
_osc
)
&
~
0x7ffff
;
val
=
readl
(
sys
+
clk
->
oscoff
)
&
~
0x7ffff
;
val
|=
vco
.
v
|
(
vco
.
r
<<
9
)
|
(
vco
.
s
<<
16
);
writel
(
0xa05f
,
sys_lock
);
writel
(
val
,
sys
_osc
);
writel
(
val
,
sys
+
clk
->
oscoff
);
writel
(
0
,
sys_lock
);
}
static
struct
clk
versatile_clcd_clk
=
{
.
name
=
"CLCDCLK"
,
static
struct
clk
osc4_clk
=
{
.
params
=
&
versatile_oscvco_params
,
.
setvco
=
versatile_oscvco_set
,
.
oscoff
=
VERSATILE_SYS_OSCCLCD_OFFSET
,
.
setvco
=
versatile_oscvco_set
,
};
/*
* These are fixed clocks.
*/
static
struct
clk
ref24_clk
=
{
.
rate
=
24000000
,
};
static
struct
clk_lookup
lookups
[]
__initdata
=
{
{
/* UART0 */
.
dev_id
=
"dev:f1"
,
.
clk
=
&
ref24_clk
,
},
{
/* UART1 */
.
dev_id
=
"dev:f2"
,
.
clk
=
&
ref24_clk
,
},
{
/* UART2 */
.
dev_id
=
"dev:f3"
,
.
clk
=
&
ref24_clk
,
},
{
/* UART3 */
.
dev_id
=
"fpga:09"
,
.
clk
=
&
ref24_clk
,
},
{
/* KMI0 */
.
dev_id
=
"fpga:06"
,
.
clk
=
&
ref24_clk
,
},
{
/* KMI1 */
.
dev_id
=
"fpga:07"
,
.
clk
=
&
ref24_clk
,
},
{
/* MMC0 */
.
dev_id
=
"fpga:05"
,
.
clk
=
&
ref24_clk
,
},
{
/* MMC1 */
.
dev_id
=
"fpga:0b"
,
.
clk
=
&
ref24_clk
,
},
{
/* CLCD */
.
dev_id
=
"dev:20"
,
.
clk
=
&
osc4_clk
,
}
};
/*
...
...
@@ -786,7 +825,8 @@ void __init versatile_init(void)
{
int
i
;
clk_register
(
&
versatile_clcd_clk
);
for
(
i
=
0
;
i
<
ARRAY_SIZE
(
lookups
);
i
++
)
clkdev_add
(
&
lookups
[
i
]);
platform_device_register
(
&
versatile_flash_device
);
platform_device_register
(
&
versatile_i2c_device
);
...
...
arch/arm/mach-versatile/include/mach/clkdev.h
0 → 100644
浏览文件 @
e902be56
#ifndef __ASM_MACH_CLKDEV_H
#define __ASM_MACH_CLKDEV_H
#define __clk_get(clk) ({ 1; })
#define __clk_put(clk) do { } while (0)
#endif
drivers/i2c/busses/i2c-pxa.c
浏览文件 @
e902be56
...
...
@@ -1016,7 +1016,7 @@ static int i2c_pxa_probe(struct platform_device *dev)
snprintf
(
i2c
->
adap
.
name
,
sizeof
(
i2c
->
adap
.
name
),
"pxa_i2c-i2c.%u"
,
i2c
->
adap
.
nr
);
i2c
->
clk
=
clk_get
(
&
dev
->
dev
,
"I2CCLK"
);
i2c
->
clk
=
clk_get
(
&
dev
->
dev
,
NULL
);
if
(
IS_ERR
(
i2c
->
clk
))
{
ret
=
PTR_ERR
(
i2c
->
clk
);
goto
eclk
;
...
...
drivers/input/keyboard/pxa27x_keypad.c
浏览文件 @
e902be56
...
...
@@ -475,7 +475,7 @@ static int __devinit pxa27x_keypad_probe(struct platform_device *pdev)
goto
failed_free_mem
;
}
keypad
->
clk
=
clk_get
(
&
pdev
->
dev
,
"KBDCLK"
);
keypad
->
clk
=
clk_get
(
&
pdev
->
dev
,
NULL
);
if
(
IS_ERR
(
keypad
->
clk
))
{
dev_err
(
&
pdev
->
dev
,
"failed to get keypad clock
\n
"
);
error
=
PTR_ERR
(
keypad
->
clk
);
...
...
drivers/media/video/pxa_camera.c
浏览文件 @
e902be56
...
...
@@ -1071,7 +1071,7 @@ static int pxa_camera_probe(struct platform_device *pdev)
goto
exit
;
}
pcdev
->
clk
=
clk_get
(
&
pdev
->
dev
,
"CAMCLK"
);
pcdev
->
clk
=
clk_get
(
&
pdev
->
dev
,
NULL
);
if
(
IS_ERR
(
pcdev
->
clk
))
{
err
=
PTR_ERR
(
pcdev
->
clk
);
goto
exit_kfree
;
...
...
drivers/mmc/host/pxamci.c
浏览文件 @
e902be56
...
...
@@ -533,7 +533,7 @@ static int pxamci_probe(struct platform_device *pdev)
host
->
pdata
=
pdev
->
dev
.
platform_data
;
host
->
clkrt
=
CLKRT_OFF
;
host
->
clk
=
clk_get
(
&
pdev
->
dev
,
"MMCCLK"
);
host
->
clk
=
clk_get
(
&
pdev
->
dev
,
NULL
);
if
(
IS_ERR
(
host
->
clk
))
{
ret
=
PTR_ERR
(
host
->
clk
);
host
->
clk
=
NULL
;
...
...
drivers/mtd/nand/pxa3xx_nand.c
浏览文件 @
e902be56
...
...
@@ -1079,7 +1079,7 @@ static int pxa3xx_nand_probe(struct platform_device *pdev)
this
=
&
info
->
nand_chip
;
mtd
->
priv
=
info
;
info
->
clk
=
clk_get
(
&
pdev
->
dev
,
"NANDCLK"
);
info
->
clk
=
clk_get
(
&
pdev
->
dev
,
NULL
);
if
(
IS_ERR
(
info
->
clk
))
{
dev_err
(
&
pdev
->
dev
,
"failed to get nand clock
\n
"
);
ret
=
PTR_ERR
(
info
->
clk
);
...
...
drivers/serial/pxa.c
浏览文件 @
e902be56
...
...
@@ -766,7 +766,7 @@ static int serial_pxa_probe(struct platform_device *dev)
if
(
!
sport
)
return
-
ENOMEM
;
sport
->
clk
=
clk_get
(
&
dev
->
dev
,
"UARTCLK"
);
sport
->
clk
=
clk_get
(
&
dev
->
dev
,
NULL
);
if
(
IS_ERR
(
sport
->
clk
))
{
ret
=
PTR_ERR
(
sport
->
clk
);
goto
err_free
;
...
...
drivers/usb/gadget/pxa25x_udc.c
浏览文件 @
e902be56
...
...
@@ -2145,7 +2145,7 @@ static int __init pxa25x_udc_probe(struct platform_device *pdev)
if
(
irq
<
0
)
return
-
ENODEV
;
dev
->
clk
=
clk_get
(
&
pdev
->
dev
,
"UDCCLK"
);
dev
->
clk
=
clk_get
(
&
pdev
->
dev
,
NULL
);
if
(
IS_ERR
(
dev
->
clk
))
{
retval
=
PTR_ERR
(
dev
->
clk
);
goto
err_clk
;
...
...
drivers/usb/gadget/pxa27x_udc.c
浏览文件 @
e902be56
...
...
@@ -2226,7 +2226,7 @@ static int __init pxa_udc_probe(struct platform_device *pdev)
udc
->
dev
=
&
pdev
->
dev
;
udc
->
mach
=
pdev
->
dev
.
platform_data
;
udc
->
clk
=
clk_get
(
&
pdev
->
dev
,
"UDCCLK"
);
udc
->
clk
=
clk_get
(
&
pdev
->
dev
,
NULL
);
if
(
IS_ERR
(
udc
->
clk
))
{
retval
=
PTR_ERR
(
udc
->
clk
);
goto
err_clk
;
...
...
drivers/usb/host/ohci-pxa27x.c
浏览文件 @
e902be56
...
...
@@ -296,7 +296,7 @@ int usb_hcd_pxa27x_probe (const struct hc_driver *driver, struct platform_device
return
-
ENXIO
;
}
usb_clk
=
clk_get
(
&
pdev
->
dev
,
"USBCLK"
);
usb_clk
=
clk_get
(
&
pdev
->
dev
,
NULL
);
if
(
IS_ERR
(
usb_clk
))
return
PTR_ERR
(
usb_clk
);
...
...
drivers/video/pxafb.c
浏览文件 @
e902be56
...
...
@@ -1429,7 +1429,7 @@ static struct pxafb_info * __devinit pxafb_init_fbinfo(struct device *dev)
memset
(
fbi
,
0
,
sizeof
(
struct
pxafb_info
));
fbi
->
dev
=
dev
;
fbi
->
clk
=
clk_get
(
dev
,
"LCDCLK"
);
fbi
->
clk
=
clk_get
(
dev
,
NULL
);
if
(
IS_ERR
(
fbi
->
clk
))
{
kfree
(
fbi
);
return
NULL
;
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录