Linux Kernel
3.7.1
Main Page
Related Pages
Modules
Namespaces
Data Structures
Files
File List
Globals
All
Data Structures
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Macros
Groups
Pages
drivers
clk
versatile
clk-realview.c
Go to the documentation of this file.
1
#include <
linux/clk.h
>
2
#include <
linux/clkdev.h
>
3
#include <
linux/err.h
>
4
#include <
linux/io.h
>
5
#include <
linux/clk-provider.h
>
6
7
#include <mach/hardware.h>
8
#include <mach/platform.h>
9
10
#include "
clk-icst.h
"
11
12
/*
13
* Implementation of the ARM RealView clock trees.
14
*/
15
16
static
void
__iomem
*sys_lock;
17
static
void
__iomem
*sys_vcoreg;
18
22
static
struct
icst_vco
realview_oscvco_get(
void
)
23
{
24
u32
val
;
25
struct
icst_vco
vco;
26
27
val
=
readl
(sys_vcoreg);
28
vco.v =
val
& 0x1ff;
29
vco.r = (
val
>> 9) & 0x7f;
30
vco.s = (
val
>> 16) & 03;
31
return
vco;
32
}
33
34
static
void
realview_oscvco_set(
struct
icst_vco
vco)
35
{
36
u32
val
;
37
38
val =
readl
(sys_vcoreg) & ~0x7ffff;
39
val |= vco.
v
| (vco.
r
<< 9) | (vco.
s
<< 16);
40
41
/* This magic unlocks the CM VCO so it can be controlled */
42
writel
(0xa05f, sys_lock);
43
writel
(val, sys_vcoreg);
44
/* This locks the CM again */
45
writel
(0, sys_lock);
46
}
47
48
static
const
struct
icst_params
realview_oscvco_params = {
49
.ref = 24000000,
50
.vco_max =
ICST307_VCO_MAX
,
51
.vco_min =
ICST307_VCO_MIN
,
52
.vd_min = 4 + 8,
53
.vd_max = 511 + 8,
54
.rd_min = 1 + 2,
55
.rd_max = 127 + 2,
56
.s2div =
icst307_s2div
,
57
.idx2s =
icst307_idx2s
,
58
};
59
60
static
const
struct
clk_icst_desc
__initdata
realview_icst_desc = {
61
.params = &realview_oscvco_params,
62
.getvco = realview_oscvco_get,
63
.setvco = realview_oscvco_set,
64
};
65
66
/*
67
* realview_clk_init() - set up the RealView clock tree
68
*/
69
void
__init
realview_clk_init
(
void
__iomem
*sysbase,
bool
is_pb1176)
70
{
71
struct
clk
*
clk
;
72
73
sys_lock = sysbase +
REALVIEW_SYS_LOCK_OFFSET
;
74
if
(is_pb1176)
75
sys_vcoreg = sysbase +
REALVIEW_SYS_OSC0_OFFSET
;
76
else
77
sys_vcoreg = sysbase +
REALVIEW_SYS_OSC4_OFFSET
;
78
79
80
/* APB clock dummy */
81
clk =
clk_register_fixed_rate
(
NULL
,
"apb_pclk"
,
NULL
, CLK_IS_ROOT, 0);
82
clk_register_clkdev
(clk,
"apb_pclk"
,
NULL
);
83
84
/* 24 MHz clock */
85
clk =
clk_register_fixed_rate
(
NULL
,
"clk24mhz"
,
NULL
, CLK_IS_ROOT,
86
24000000);
87
clk_register_clkdev
(clk,
NULL
,
"dev:uart0"
);
88
clk_register_clkdev
(clk,
NULL
,
"dev:uart1"
);
89
clk_register_clkdev
(clk,
NULL
,
"dev:uart2"
);
90
clk_register_clkdev
(clk,
NULL
,
"fpga:kmi0"
);
91
clk_register_clkdev
(clk,
NULL
,
"fpga:kmi1"
);
92
clk_register_clkdev
(clk,
NULL
,
"fpga:mmc0"
);
93
clk_register_clkdev
(clk,
NULL
,
"dev:ssp0"
);
94
if
(is_pb1176) {
95
/*
96
* UART3 is on the dev chip in PB1176
97
* UART4 only exists in PB1176
98
*/
99
clk_register_clkdev
(clk,
NULL
,
"dev:uart3"
);
100
clk_register_clkdev
(clk,
NULL
,
"dev:uart4"
);
101
}
else
102
clk_register_clkdev
(clk,
NULL
,
"fpga:uart3"
);
103
104
105
/* 1 MHz clock */
106
clk =
clk_register_fixed_rate
(
NULL
,
"clk1mhz"
,
NULL
, CLK_IS_ROOT,
107
1000000);
108
clk_register_clkdev
(clk,
NULL
,
"sp804"
);
109
110
/* ICST VCO clock */
111
clk =
icst_clk_register
(
NULL
, &realview_icst_desc);
112
clk_register_clkdev
(clk,
NULL
,
"dev:clcd"
);
113
clk_register_clkdev
(clk,
NULL
,
"issp:clcd"
);
114
}
Generated on Thu Jan 10 2013 13:28:27 for Linux Kernel by
1.8.2