aboutsummaryrefslogtreecommitdiffstats
path: root/arch/arm/mach-at91
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2014-01-23 21:36:55 -0500
committerLinus Torvalds <torvalds@linux-foundation.org>2014-01-23 21:36:55 -0500
commitf2c73464d7b399cf4e0c601c1c7d7b079080fa52 (patch)
tree902decd0c280757075bce5068fee679e0ccc261e /arch/arm/mach-at91
parent93abdb7785503c269e73e811f3c7fd23a9243b14 (diff)
parent273c2279ca502267fac40bcaecb35942380c429c (diff)
Merge tag 'cleanup-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/arm/arm-soc
Pull ARM SoC cleanups from Olof Johansson: "This is the branch where we usually queue up cleanup efforts, moving drivers out of the architecture directory, header file restructuring, etc. Sometimes they tangle with new development so it's hard to keep it strictly to cleanups. Some of the things included in this branch are: * Atmel SAMA5 conversion to common clock * Reset framework conversion for tegra platforms - Some of this depends on tegra clock driver reworks that are shared with Mike Turquette's clk tree. * Tegra DMA refactoring, which are shared branches with the DMA tree. * Removal of some header files on exynos to prepare for multiplatform" * tag 'cleanup-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/arm/arm-soc: (169 commits) ARM: mvebu: move Armada 370/XP specific definitions to armada-370-xp.h ARM: mvebu: remove prototypes of non-existing functions from common.h ARM: mvebu: move ARMADA_XP_MAX_CPUS to armada-370-xp.h serial: sh-sci: Rework baud rate calculation serial: sh-sci: Compute overrun_bit without using baud rate algo serial: sh-sci: Remove unused GPIO request code serial: sh-sci: Move overrun_bit and error_mask fields out of pdata serial: sh-sci: Support resources passed through platform resources serial: sh-sci: Don't check IRQ in verify port operation serial: sh-sci: Set the UPF_FIXED_PORT flag serial: sh-sci: Remove duplicate interrupt check in verify port op serial: sh-sci: Simplify baud rate calculation algorithms serial: sh-sci: Remove baud rate calculation algorithm 5 serial: sh-sci: Sort headers alphabetically ARM: EXYNOS: Kill exynos_pm_late_initcall() ARM: EXYNOS: Consolidate selection of PM_GENERIC_DOMAINS for Exynos4 ARM: at91: switch Calao QIL-A9260 board to DT clk: at91: fix pmc_clk_ids data type attriubte PM / devfreq: use inclusion <mach/map.h> instead of <plat/map-s5p.h> ARM: EXYNOS: remove <mach/regs-clock.h> for exynos ...
Diffstat (limited to 'arch/arm/mach-at91')
-rw-r--r--arch/arm/mach-at91/Kconfig50
-rw-r--r--arch/arm/mach-at91/Kconfig.non_dt12
-rw-r--r--arch/arm/mach-at91/Makefile3
-rw-r--r--arch/arm/mach-at91/at91rm9200.c2
-rw-r--r--arch/arm/mach-at91/at91sam9260.c2
-rw-r--r--arch/arm/mach-at91/at91sam9261.c2
-rw-r--r--arch/arm/mach-at91/at91sam9263.c2
-rw-r--r--arch/arm/mach-at91/at91sam926x_time.c14
-rw-r--r--arch/arm/mach-at91/at91sam9g45.c2
-rw-r--r--arch/arm/mach-at91/at91sam9n12.c2
-rw-r--r--arch/arm/mach-at91/at91sam9rl.c2
-rw-r--r--arch/arm/mach-at91/at91sam9x5.c2
-rw-r--r--arch/arm/mach-at91/board-dt-sama5.c10
-rw-r--r--arch/arm/mach-at91/board-qil-a9260.c266
-rw-r--r--arch/arm/mach-at91/clock.c13
-rw-r--r--arch/arm/mach-at91/generic.h3
-rw-r--r--arch/arm/mach-at91/include/mach/at91_pmc.h190
-rw-r--r--arch/arm/mach-at91/pm.c5
-rw-r--r--arch/arm/mach-at91/pm_slowclock.S2
-rw-r--r--arch/arm/mach-at91/sama5d3.c344
-rw-r--r--arch/arm/mach-at91/setup.c8
21 files changed, 96 insertions, 840 deletions
diff --git a/arch/arm/mach-at91/Kconfig b/arch/arm/mach-at91/Kconfig
index 699b71e7f7ec..f1bf952da747 100644
--- a/arch/arm/mach-at91/Kconfig
+++ b/arch/arm/mach-at91/Kconfig
@@ -1,15 +1,33 @@
1if ARCH_AT91 1if ARCH_AT91
2 2
3config HAVE_AT91_UTMI
4 bool
5
6config HAVE_AT91_USB_CLK
7 bool
8
3config HAVE_AT91_DBGU0 9config HAVE_AT91_DBGU0
4 bool 10 bool
5 11
6config HAVE_AT91_DBGU1 12config HAVE_AT91_DBGU1
7 bool 13 bool
8 14
15config AT91_USE_OLD_CLK
16 bool
17
9config AT91_PMC_UNIT 18config AT91_PMC_UNIT
10 bool 19 bool
11 default !ARCH_AT91X40 20 default !ARCH_AT91X40
12 21
22config COMMON_CLK_AT91
23 bool
24 default AT91_PMC_UNIT && USE_OF && !AT91_USE_OLD_CLK
25 select COMMON_CLK
26
27config OLD_CLK_AT91
28 bool
29 default AT91_PMC_UNIT && AT91_USE_OLD_CLK
30
13config AT91_SAM9_ALT_RESET 31config AT91_SAM9_ALT_RESET
14 bool 32 bool
15 default !ARCH_AT91X40 33 default !ARCH_AT91X40
@@ -21,6 +39,9 @@ config AT91_SAM9G45_RESET
21config AT91_SAM9_TIME 39config AT91_SAM9_TIME
22 bool 40 bool
23 41
42config HAVE_AT91_SMD
43 bool
44
24config SOC_AT91SAM9 45config SOC_AT91SAM9
25 bool 46 bool
26 select AT91_SAM9_TIME 47 select AT91_SAM9_TIME
@@ -61,10 +82,12 @@ comment "Atmel AT91 Processor"
61if SOC_SAM_V7 82if SOC_SAM_V7
62config SOC_SAMA5D3 83config SOC_SAMA5D3
63 bool "SAMA5D3 family" 84 bool "SAMA5D3 family"
64 depends on SOC_SAM_V7
65 select SOC_SAMA5 85 select SOC_SAMA5
66 select HAVE_FB_ATMEL 86 select HAVE_FB_ATMEL
67 select HAVE_AT91_DBGU1 87 select HAVE_AT91_DBGU1
88 select HAVE_AT91_UTMI
89 select HAVE_AT91_SMD
90 select HAVE_AT91_USB_CLK
68 help 91 help
69 Select this if you are using one of Atmel's SAMA5D3 family SoC. 92 Select this if you are using one of Atmel's SAMA5D3 family SoC.
70 This support covers SAMA5D31, SAMA5D33, SAMA5D34, SAMA5D35. 93 This support covers SAMA5D31, SAMA5D33, SAMA5D34, SAMA5D35.
@@ -78,11 +101,15 @@ config SOC_AT91RM9200
78 select HAVE_AT91_DBGU0 101 select HAVE_AT91_DBGU0
79 select MULTI_IRQ_HANDLER 102 select MULTI_IRQ_HANDLER
80 select SPARSE_IRQ 103 select SPARSE_IRQ
104 select AT91_USE_OLD_CLK
105 select HAVE_AT91_USB_CLK
81 106
82config SOC_AT91SAM9260 107config SOC_AT91SAM9260
83 bool "AT91SAM9260, AT91SAM9XE or AT91SAM9G20" 108 bool "AT91SAM9260, AT91SAM9XE or AT91SAM9G20"
84 select HAVE_AT91_DBGU0 109 select HAVE_AT91_DBGU0
85 select SOC_AT91SAM9 110 select SOC_AT91SAM9
111 select AT91_USE_OLD_CLK
112 select HAVE_AT91_USB_CLK
86 help 113 help
87 Select this if you are using one of Atmel's AT91SAM9260, AT91SAM9XE 114 Select this if you are using one of Atmel's AT91SAM9260, AT91SAM9XE
88 or AT91SAM9G20 SoC. 115 or AT91SAM9G20 SoC.
@@ -92,6 +119,8 @@ config SOC_AT91SAM9261
92 select HAVE_AT91_DBGU0 119 select HAVE_AT91_DBGU0
93 select HAVE_FB_ATMEL 120 select HAVE_FB_ATMEL
94 select SOC_AT91SAM9 121 select SOC_AT91SAM9
122 select AT91_USE_OLD_CLK
123 select HAVE_AT91_USB_CLK
95 help 124 help
96 Select this if you are using one of Atmel's AT91SAM9261 or AT91SAM9G10 SoC. 125 Select this if you are using one of Atmel's AT91SAM9261 or AT91SAM9G10 SoC.
97 126
@@ -100,18 +129,25 @@ config SOC_AT91SAM9263
100 select HAVE_AT91_DBGU1 129 select HAVE_AT91_DBGU1
101 select HAVE_FB_ATMEL 130 select HAVE_FB_ATMEL
102 select SOC_AT91SAM9 131 select SOC_AT91SAM9
132 select AT91_USE_OLD_CLK
133 select HAVE_AT91_USB_CLK
103 134
104config SOC_AT91SAM9RL 135config SOC_AT91SAM9RL
105 bool "AT91SAM9RL" 136 bool "AT91SAM9RL"
106 select HAVE_AT91_DBGU0 137 select HAVE_AT91_DBGU0
107 select HAVE_FB_ATMEL 138 select HAVE_FB_ATMEL
108 select SOC_AT91SAM9 139 select SOC_AT91SAM9
140 select AT91_USE_OLD_CLK
141 select HAVE_AT91_UTMI
109 142
110config SOC_AT91SAM9G45 143config SOC_AT91SAM9G45
111 bool "AT91SAM9G45 or AT91SAM9M10 families" 144 bool "AT91SAM9G45 or AT91SAM9M10 families"
112 select HAVE_AT91_DBGU1 145 select HAVE_AT91_DBGU1
113 select HAVE_FB_ATMEL 146 select HAVE_FB_ATMEL
114 select SOC_AT91SAM9 147 select SOC_AT91SAM9
148 select AT91_USE_OLD_CLK
149 select HAVE_AT91_UTMI
150 select HAVE_AT91_USB_CLK
115 help 151 help
116 Select this if you are using one of Atmel's AT91SAM9G45 family SoC. 152 Select this if you are using one of Atmel's AT91SAM9G45 family SoC.
117 This support covers AT91SAM9G45, AT91SAM9G46, AT91SAM9M10 and AT91SAM9M11. 153 This support covers AT91SAM9G45, AT91SAM9G46, AT91SAM9M10 and AT91SAM9M11.
@@ -121,6 +157,10 @@ config SOC_AT91SAM9X5
121 select HAVE_AT91_DBGU0 157 select HAVE_AT91_DBGU0
122 select HAVE_FB_ATMEL 158 select HAVE_FB_ATMEL
123 select SOC_AT91SAM9 159 select SOC_AT91SAM9
160 select AT91_USE_OLD_CLK
161 select HAVE_AT91_UTMI
162 select HAVE_AT91_SMD
163 select HAVE_AT91_USB_CLK
124 help 164 help
125 Select this if you are using one of Atmel's AT91SAM9x5 family SoC. 165 Select this if you are using one of Atmel's AT91SAM9x5 family SoC.
126 This means that your SAM9 name finishes with a '5' (except if it is 166 This means that your SAM9 name finishes with a '5' (except if it is
@@ -133,6 +173,8 @@ config SOC_AT91SAM9N12
133 select HAVE_AT91_DBGU0 173 select HAVE_AT91_DBGU0
134 select HAVE_FB_ATMEL 174 select HAVE_FB_ATMEL
135 select SOC_AT91SAM9 175 select SOC_AT91SAM9
176 select AT91_USE_OLD_CLK
177 select HAVE_AT91_USB_CLK
136 help 178 help
137 Select this if you are using Atmel's AT91SAM9N12 SoC. 179 Select this if you are using Atmel's AT91SAM9N12 SoC.
138 180
@@ -172,12 +214,6 @@ config MACH_SAMA5_DT
172 214
173comment "AT91 Feature Selections" 215comment "AT91 Feature Selections"
174 216
175config AT91_PROGRAMMABLE_CLOCKS
176 bool "Programmable Clocks"
177 help
178 Select this if you need to program one or more of the PCK0..PCK3
179 programmable clock outputs.
180
181config AT91_SLOW_CLOCK 217config AT91_SLOW_CLOCK
182 bool "Suspend-to-RAM disables main oscillator" 218 bool "Suspend-to-RAM disables main oscillator"
183 depends on SUSPEND 219 depends on SUSPEND
diff --git a/arch/arm/mach-at91/Kconfig.non_dt b/arch/arm/mach-at91/Kconfig.non_dt
index 0363dba7d3f6..1f73e9b527da 100644
--- a/arch/arm/mach-at91/Kconfig.non_dt
+++ b/arch/arm/mach-at91/Kconfig.non_dt
@@ -12,26 +12,32 @@ config ARCH_AT91_NONE
12config ARCH_AT91RM9200 12config ARCH_AT91RM9200
13 bool "AT91RM9200" 13 bool "AT91RM9200"
14 select SOC_AT91RM9200 14 select SOC_AT91RM9200
15 select AT91_USE_OLD_CLK
15 16
16config ARCH_AT91SAM9260 17config ARCH_AT91SAM9260
17 bool "AT91SAM9260 or AT91SAM9XE or AT91SAM9G20" 18 bool "AT91SAM9260 or AT91SAM9XE or AT91SAM9G20"
18 select SOC_AT91SAM9260 19 select SOC_AT91SAM9260
20 select AT91_USE_OLD_CLK
19 21
20config ARCH_AT91SAM9261 22config ARCH_AT91SAM9261
21 bool "AT91SAM9261 or AT91SAM9G10" 23 bool "AT91SAM9261 or AT91SAM9G10"
22 select SOC_AT91SAM9261 24 select SOC_AT91SAM9261
25 select AT91_USE_OLD_CLK
23 26
24config ARCH_AT91SAM9263 27config ARCH_AT91SAM9263
25 bool "AT91SAM9263" 28 bool "AT91SAM9263"
26 select SOC_AT91SAM9263 29 select SOC_AT91SAM9263
30 select AT91_USE_OLD_CLK
27 31
28config ARCH_AT91SAM9RL 32config ARCH_AT91SAM9RL
29 bool "AT91SAM9RL" 33 bool "AT91SAM9RL"
30 select SOC_AT91SAM9RL 34 select SOC_AT91SAM9RL
35 select AT91_USE_OLD_CLK
31 36
32config ARCH_AT91SAM9G45 37config ARCH_AT91SAM9G45
33 bool "AT91SAM9G45" 38 bool "AT91SAM9G45"
34 select SOC_AT91SAM9G45 39 select SOC_AT91SAM9G45
40 select AT91_USE_OLD_CLK
35 41
36config ARCH_AT91X40 42config ARCH_AT91X40
37 bool "AT91x40" 43 bool "AT91x40"
@@ -176,12 +182,6 @@ config MACH_AFEB9260
176 <svn://194.85.238.22/home/users/george/svn/arm9eb> 182 <svn://194.85.238.22/home/users/george/svn/arm9eb>
177 <http://groups.google.com/group/arm9fpga-evolution-board> 183 <http://groups.google.com/group/arm9fpga-evolution-board>
178 184
179config MACH_QIL_A9260
180 bool "CALAO QIL-A9260 board"
181 help
182 Select this if you are using a Calao Systems QIL-A9260 Board.
183 <http://www.calao-systems.com>
184
185config MACH_CPU9260 185config MACH_CPU9260
186 bool "Eukrea CPU9260 board" 186 bool "Eukrea CPU9260 board"
187 help 187 help
diff --git a/arch/arm/mach-at91/Makefile b/arch/arm/mach-at91/Makefile
index 90aab2d5a07f..78e9cec282f4 100644
--- a/arch/arm/mach-at91/Makefile
+++ b/arch/arm/mach-at91/Makefile
@@ -7,7 +7,7 @@ obj-m :=
7obj-n := 7obj-n :=
8obj- := 8obj- :=
9 9
10obj-$(CONFIG_AT91_PMC_UNIT) += clock.o 10obj-$(CONFIG_OLD_CLK_AT91) += clock.o
11obj-$(CONFIG_AT91_SAM9_ALT_RESET) += at91sam9_alt_reset.o 11obj-$(CONFIG_AT91_SAM9_ALT_RESET) += at91sam9_alt_reset.o
12obj-$(CONFIG_AT91_SAM9G45_RESET) += at91sam9g45_reset.o 12obj-$(CONFIG_AT91_SAM9G45_RESET) += at91sam9g45_reset.o
13obj-$(CONFIG_AT91_SAM9_TIME) += at91sam926x_time.o 13obj-$(CONFIG_AT91_SAM9_TIME) += at91sam926x_time.o
@@ -52,7 +52,6 @@ obj-$(CONFIG_MACH_RSI_EWS) += board-rsi-ews.o
52obj-$(CONFIG_MACH_AT91SAM9260EK) += board-sam9260ek.o 52obj-$(CONFIG_MACH_AT91SAM9260EK) += board-sam9260ek.o
53obj-$(CONFIG_MACH_CAM60) += board-cam60.o 53obj-$(CONFIG_MACH_CAM60) += board-cam60.o
54obj-$(CONFIG_MACH_SAM9_L9260) += board-sam9-l9260.o 54obj-$(CONFIG_MACH_SAM9_L9260) += board-sam9-l9260.o
55obj-$(CONFIG_MACH_QIL_A9260) += board-qil-a9260.o
56obj-$(CONFIG_MACH_AFEB9260) += board-afeb-9260v1.o 55obj-$(CONFIG_MACH_AFEB9260) += board-afeb-9260v1.o
57obj-$(CONFIG_MACH_CPU9260) += board-cpu9krea.o 56obj-$(CONFIG_MACH_CPU9260) += board-cpu9krea.o
58obj-$(CONFIG_MACH_FLEXIBITY) += board-flexibity.o 57obj-$(CONFIG_MACH_FLEXIBITY) += board-flexibity.o
diff --git a/arch/arm/mach-at91/at91rm9200.c b/arch/arm/mach-at91/at91rm9200.c
index 25805f2f6010..e47f5fd232f5 100644
--- a/arch/arm/mach-at91/at91rm9200.c
+++ b/arch/arm/mach-at91/at91rm9200.c
@@ -12,13 +12,13 @@
12 12
13#include <linux/module.h> 13#include <linux/module.h>
14#include <linux/reboot.h> 14#include <linux/reboot.h>
15#include <linux/clk/at91_pmc.h>
15 16
16#include <asm/irq.h> 17#include <asm/irq.h>
17#include <asm/mach/arch.h> 18#include <asm/mach/arch.h>
18#include <asm/mach/map.h> 19#include <asm/mach/map.h>
19#include <asm/system_misc.h> 20#include <asm/system_misc.h>
20#include <mach/at91rm9200.h> 21#include <mach/at91rm9200.h>
21#include <mach/at91_pmc.h>
22#include <mach/at91_st.h> 22#include <mach/at91_st.h>
23#include <mach/cpu.h> 23#include <mach/cpu.h>
24 24
diff --git a/arch/arm/mach-at91/at91sam9260.c b/arch/arm/mach-at91/at91sam9260.c
index d6a1fa85371d..6c821e562159 100644
--- a/arch/arm/mach-at91/at91sam9260.c
+++ b/arch/arm/mach-at91/at91sam9260.c
@@ -11,6 +11,7 @@
11 */ 11 */
12 12
13#include <linux/module.h> 13#include <linux/module.h>
14#include <linux/clk/at91_pmc.h>
14 15
15#include <asm/proc-fns.h> 16#include <asm/proc-fns.h>
16#include <asm/irq.h> 17#include <asm/irq.h>
@@ -20,7 +21,6 @@
20#include <mach/cpu.h> 21#include <mach/cpu.h>
21#include <mach/at91_dbgu.h> 22#include <mach/at91_dbgu.h>
22#include <mach/at91sam9260.h> 23#include <mach/at91sam9260.h>
23#include <mach/at91_pmc.h>
24 24
25#include "at91_aic.h" 25#include "at91_aic.h"
26#include "at91_rstc.h" 26#include "at91_rstc.h"
diff --git a/arch/arm/mach-at91/at91sam9261.c b/arch/arm/mach-at91/at91sam9261.c
index 23ba1d8a1531..6276b4c1acfe 100644
--- a/arch/arm/mach-at91/at91sam9261.c
+++ b/arch/arm/mach-at91/at91sam9261.c
@@ -11,6 +11,7 @@
11 */ 11 */
12 12
13#include <linux/module.h> 13#include <linux/module.h>
14#include <linux/clk/at91_pmc.h>
14 15
15#include <asm/proc-fns.h> 16#include <asm/proc-fns.h>
16#include <asm/irq.h> 17#include <asm/irq.h>
@@ -19,7 +20,6 @@
19#include <asm/system_misc.h> 20#include <asm/system_misc.h>
20#include <mach/cpu.h> 21#include <mach/cpu.h>
21#include <mach/at91sam9261.h> 22#include <mach/at91sam9261.h>
22#include <mach/at91_pmc.h>
23 23
24#include "at91_aic.h" 24#include "at91_aic.h"
25#include "at91_rstc.h" 25#include "at91_rstc.h"
diff --git a/arch/arm/mach-at91/at91sam9263.c b/arch/arm/mach-at91/at91sam9263.c
index 7eccb0fc57bc..37b90f4b990c 100644
--- a/arch/arm/mach-at91/at91sam9263.c
+++ b/arch/arm/mach-at91/at91sam9263.c
@@ -11,6 +11,7 @@
11 */ 11 */
12 12
13#include <linux/module.h> 13#include <linux/module.h>
14#include <linux/clk/at91_pmc.h>
14 15
15#include <asm/proc-fns.h> 16#include <asm/proc-fns.h>
16#include <asm/irq.h> 17#include <asm/irq.h>
@@ -18,7 +19,6 @@
18#include <asm/mach/map.h> 19#include <asm/mach/map.h>
19#include <asm/system_misc.h> 20#include <asm/system_misc.h>
20#include <mach/at91sam9263.h> 21#include <mach/at91sam9263.h>
21#include <mach/at91_pmc.h>
22 22
23#include "at91_aic.h" 23#include "at91_aic.h"
24#include "at91_rstc.h" 24#include "at91_rstc.h"
diff --git a/arch/arm/mach-at91/at91sam926x_time.c b/arch/arm/mach-at91/at91sam926x_time.c
index bb392320a0dd..0f04ffe9c5a8 100644
--- a/arch/arm/mach-at91/at91sam926x_time.c
+++ b/arch/arm/mach-at91/at91sam926x_time.c
@@ -39,6 +39,7 @@
39static u32 pit_cycle; /* write-once */ 39static u32 pit_cycle; /* write-once */
40static u32 pit_cnt; /* access only w/system irq blocked */ 40static u32 pit_cnt; /* access only w/system irq blocked */
41static void __iomem *pit_base_addr __read_mostly; 41static void __iomem *pit_base_addr __read_mostly;
42static struct clk *mck;
42 43
43static inline unsigned int pit_read(unsigned int reg_offset) 44static inline unsigned int pit_read(unsigned int reg_offset)
44{ 45{
@@ -195,10 +196,14 @@ static int __init of_at91sam926x_pit_init(void)
195 if (!pit_base_addr) 196 if (!pit_base_addr)
196 goto node_err; 197 goto node_err;
197 198
199 mck = of_clk_get(np, 0);
200
198 /* Get the interrupts property */ 201 /* Get the interrupts property */
199 ret = irq_of_parse_and_map(np, 0); 202 ret = irq_of_parse_and_map(np, 0);
200 if (!ret) { 203 if (!ret) {
201 pr_crit("AT91: PIT: Unable to get IRQ from DT\n"); 204 pr_crit("AT91: PIT: Unable to get IRQ from DT\n");
205 if (!IS_ERR(mck))
206 clk_put(mck);
202 goto ioremap_err; 207 goto ioremap_err;
203 } 208 }
204 at91sam926x_pit_irq.irq = ret; 209 at91sam926x_pit_irq.irq = ret;
@@ -230,6 +235,8 @@ void __init at91sam926x_pit_init(void)
230 unsigned bits; 235 unsigned bits;
231 int ret; 236 int ret;
232 237
238 mck = ERR_PTR(-ENOENT);
239
233 /* For device tree enabled device: initialize here */ 240 /* For device tree enabled device: initialize here */
234 of_at91sam926x_pit_init(); 241 of_at91sam926x_pit_init();
235 242
@@ -237,7 +244,12 @@ void __init at91sam926x_pit_init(void)
237 * Use our actual MCK to figure out how many MCK/16 ticks per 244 * Use our actual MCK to figure out how many MCK/16 ticks per
238 * 1/HZ period (instead of a compile-time constant LATCH). 245 * 1/HZ period (instead of a compile-time constant LATCH).
239 */ 246 */
240 pit_rate = clk_get_rate(clk_get(NULL, "mck")) / 16; 247 if (IS_ERR(mck))
248 mck = clk_get(NULL, "mck");
249
250 if (IS_ERR(mck))
251 panic("AT91: PIT: Unable to get mck clk\n");
252 pit_rate = clk_get_rate(mck) / 16;
241 pit_cycle = (pit_rate + HZ/2) / HZ; 253 pit_cycle = (pit_rate + HZ/2) / HZ;
242 WARN_ON(((pit_cycle - 1) & ~AT91_PIT_PIV) != 0); 254 WARN_ON(((pit_cycle - 1) & ~AT91_PIT_PIV) != 0);
243 255
diff --git a/arch/arm/mach-at91/at91sam9g45.c b/arch/arm/mach-at91/at91sam9g45.c
index 9405aa08b104..2f455ce35268 100644
--- a/arch/arm/mach-at91/at91sam9g45.c
+++ b/arch/arm/mach-at91/at91sam9g45.c
@@ -12,13 +12,13 @@
12 12
13#include <linux/module.h> 13#include <linux/module.h>
14#include <linux/dma-mapping.h> 14#include <linux/dma-mapping.h>
15#include <linux/clk/at91_pmc.h>
15 16
16#include <asm/irq.h> 17#include <asm/irq.h>
17#include <asm/mach/arch.h> 18#include <asm/mach/arch.h>
18#include <asm/mach/map.h> 19#include <asm/mach/map.h>
19#include <asm/system_misc.h> 20#include <asm/system_misc.h>
20#include <mach/at91sam9g45.h> 21#include <mach/at91sam9g45.h>
21#include <mach/at91_pmc.h>
22#include <mach/cpu.h> 22#include <mach/cpu.h>
23 23
24#include "at91_aic.h" 24#include "at91_aic.h"
diff --git a/arch/arm/mach-at91/at91sam9n12.c b/arch/arm/mach-at91/at91sam9n12.c
index 388ec3aec4b9..4ef088c62eab 100644
--- a/arch/arm/mach-at91/at91sam9n12.c
+++ b/arch/arm/mach-at91/at91sam9n12.c
@@ -8,12 +8,12 @@
8 8
9#include <linux/module.h> 9#include <linux/module.h>
10#include <linux/dma-mapping.h> 10#include <linux/dma-mapping.h>
11#include <linux/clk/at91_pmc.h>
11 12
12#include <asm/irq.h> 13#include <asm/irq.h>
13#include <asm/mach/arch.h> 14#include <asm/mach/arch.h>
14#include <asm/mach/map.h> 15#include <asm/mach/map.h>
15#include <mach/at91sam9n12.h> 16#include <mach/at91sam9n12.h>
16#include <mach/at91_pmc.h>
17#include <mach/cpu.h> 17#include <mach/cpu.h>
18 18
19#include "board.h" 19#include "board.h"
diff --git a/arch/arm/mach-at91/at91sam9rl.c b/arch/arm/mach-at91/at91sam9rl.c
index 0750ffb7e6b1..3651517abedf 100644
--- a/arch/arm/mach-at91/at91sam9rl.c
+++ b/arch/arm/mach-at91/at91sam9rl.c
@@ -10,6 +10,7 @@
10 */ 10 */
11 11
12#include <linux/module.h> 12#include <linux/module.h>
13#include <linux/clk/at91_pmc.h>
13 14
14#include <asm/proc-fns.h> 15#include <asm/proc-fns.h>
15#include <asm/irq.h> 16#include <asm/irq.h>
@@ -19,7 +20,6 @@
19#include <mach/cpu.h> 20#include <mach/cpu.h>
20#include <mach/at91_dbgu.h> 21#include <mach/at91_dbgu.h>
21#include <mach/at91sam9rl.h> 22#include <mach/at91sam9rl.h>
22#include <mach/at91_pmc.h>
23 23
24#include "at91_aic.h" 24#include "at91_aic.h"
25#include "at91_rstc.h" 25#include "at91_rstc.h"
diff --git a/arch/arm/mach-at91/at91sam9x5.c b/arch/arm/mach-at91/at91sam9x5.c
index e8a2e075a1b8..3e8ec26e39dc 100644
--- a/arch/arm/mach-at91/at91sam9x5.c
+++ b/arch/arm/mach-at91/at91sam9x5.c
@@ -8,12 +8,12 @@
8 8
9#include <linux/module.h> 9#include <linux/module.h>
10#include <linux/dma-mapping.h> 10#include <linux/dma-mapping.h>
11#include <linux/clk/at91_pmc.h>
11 12
12#include <asm/irq.h> 13#include <asm/irq.h>
13#include <asm/mach/arch.h> 14#include <asm/mach/arch.h>
14#include <asm/mach/map.h> 15#include <asm/mach/map.h>
15#include <mach/at91sam9x5.h> 16#include <mach/at91sam9x5.h>
16#include <mach/at91_pmc.h>
17#include <mach/cpu.h> 17#include <mach/cpu.h>
18 18
19#include "board.h" 19#include "board.h"
diff --git a/arch/arm/mach-at91/board-dt-sama5.c b/arch/arm/mach-at91/board-dt-sama5.c
index bf00d15d954d..075ec0576ada 100644
--- a/arch/arm/mach-at91/board-dt-sama5.c
+++ b/arch/arm/mach-at91/board-dt-sama5.c
@@ -16,6 +16,7 @@
16#include <linux/of_irq.h> 16#include <linux/of_irq.h>
17#include <linux/of_platform.h> 17#include <linux/of_platform.h>
18#include <linux/phy.h> 18#include <linux/phy.h>
19#include <linux/clk-provider.h>
19 20
20#include <asm/setup.h> 21#include <asm/setup.h>
21#include <asm/irq.h> 22#include <asm/irq.h>
@@ -26,6 +27,13 @@
26#include "at91_aic.h" 27#include "at91_aic.h"
27#include "generic.h" 28#include "generic.h"
28 29
30static void __init sama5_dt_timer_init(void)
31{
32#if defined(CONFIG_COMMON_CLK)
33 of_clk_init(NULL);
34#endif
35 at91sam926x_pit_init();
36}
29 37
30static const struct of_device_id irq_of_match[] __initconst = { 38static const struct of_device_id irq_of_match[] __initconst = {
31 39
@@ -72,7 +80,7 @@ static const char *sama5_dt_board_compat[] __initdata = {
72 80
73DT_MACHINE_START(sama5_dt, "Atmel SAMA5 (Device Tree)") 81DT_MACHINE_START(sama5_dt, "Atmel SAMA5 (Device Tree)")
74 /* Maintainer: Atmel */ 82 /* Maintainer: Atmel */
75 .init_time = at91sam926x_pit_init, 83 .init_time = sama5_dt_timer_init,
76 .map_io = at91_map_io, 84 .map_io = at91_map_io,
77 .handle_irq = at91_aic5_handle_irq, 85 .handle_irq = at91_aic5_handle_irq,
78 .init_early = at91_dt_initialize, 86 .init_early = at91_dt_initialize,
diff --git a/arch/arm/mach-at91/board-qil-a9260.c b/arch/arm/mach-at91/board-qil-a9260.c
deleted file mode 100644
index aa3bc9b0f150..000000000000
--- a/arch/arm/mach-at91/board-qil-a9260.c
+++ /dev/null
@@ -1,266 +0,0 @@
1/*
2 * linux/arch/arm/mach-at91/board-qil-a9260.c
3 *
4 * Copyright (C) 2005 SAN People
5 * Copyright (C) 2006 Atmel
6 * Copyright (C) 2007 Calao-systems
7 *
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License as published by
10 * the Free Software Foundation; either version 2 of the License, or
11 * (at your option) any later version.
12 *
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
17 *
18 * You should have received a copy of the GNU General Public License
19 * along with this program; if not, write to the Free Software
20 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
21 */
22
23#include <linux/types.h>
24#include <linux/gpio.h>
25#include <linux/init.h>
26#include <linux/mm.h>
27#include <linux/module.h>
28#include <linux/platform_device.h>
29#include <linux/spi/spi.h>
30#include <linux/gpio_keys.h>
31#include <linux/input.h>
32#include <linux/clk.h>
33
34#include <asm/setup.h>
35#include <asm/mach-types.h>
36#include <asm/irq.h>
37
38#include <asm/mach/arch.h>
39#include <asm/mach/map.h>
40#include <asm/mach/irq.h>
41
42#include <mach/hardware.h>
43#include <mach/at91sam9_smc.h>
44
45#include "at91_aic.h"
46#include "at91_shdwc.h"
47#include "board.h"
48#include "sam9_smc.h"
49#include "generic.h"
50
51
52static void __init ek_init_early(void)
53{
54 /* Initialize processor: 12.000 MHz crystal */
55 at91_initialize(12000000);
56}
57
58/*
59 * USB Host port
60 */
61static struct at91_usbh_data __initdata ek_usbh_data = {
62 .ports = 2,
63 .vbus_pin = {-EINVAL, -EINVAL},
64 .overcurrent_pin= {-EINVAL, -EINVAL},
65};
66
67/*
68 * USB Device port
69 */
70static struct at91_udc_data __initdata ek_udc_data = {
71 .vbus_pin = AT91_PIN_PC5,
72 .pullup_pin = -EINVAL, /* pull-up driven by UDC */
73};
74
75/*
76 * SPI devices.
77 */
78static struct spi_board_info ek_spi_devices[] = {
79#if defined(CONFIG_RTC_DRV_M41T94)
80 { /* M41T94 RTC */
81 .modalias = "m41t94",
82 .chip_select = 0,
83 .max_speed_hz = 1 * 1000 * 1000,
84 .bus_num = 0,
85 }
86#endif
87};
88
89/*
90 * MACB Ethernet device
91 */
92static struct macb_platform_data __initdata ek_macb_data = {
93 .phy_irq_pin = AT91_PIN_PA31,
94 .is_rmii = 1,
95};
96
97/*
98 * NAND flash
99 */
100static struct mtd_partition __initdata ek_nand_partition[] = {
101 {
102 .name = "Uboot & Kernel",
103 .offset = 0,
104 .size = SZ_16M,
105 },
106 {
107 .name = "Root FS",
108 .offset = MTDPART_OFS_NXTBLK,
109 .size = 120 * SZ_1M,
110 },
111 {
112 .name = "FS",
113 .offset = MTDPART_OFS_NXTBLK,
114 .size = 120 * SZ_1M,
115 },
116};
117
118static struct atmel_nand_data __initdata ek_nand_data = {
119 .ale = 21,
120 .cle = 22,
121 .det_pin = -EINVAL,
122 .rdy_pin = AT91_PIN_PC13,
123 .enable_pin = AT91_PIN_PC14,
124 .ecc_mode = NAND_ECC_SOFT,
125 .on_flash_bbt = 1,
126 .parts = ek_nand_partition,
127 .num_parts = ARRAY_SIZE(ek_nand_partition),
128};
129
130static struct sam9_smc_config __initdata ek_nand_smc_config = {
131 .ncs_read_setup = 0,
132 .nrd_setup = 1,
133 .ncs_write_setup = 0,
134 .nwe_setup = 1,
135
136 .ncs_read_pulse = 3,
137 .nrd_pulse = 3,
138 .ncs_write_pulse = 3,
139 .nwe_pulse = 3,
140
141 .read_cycle = 5,
142 .write_cycle = 5,
143
144 .mode = AT91_SMC_READMODE | AT91_SMC_WRITEMODE | AT91_SMC_EXNWMODE_DISABLE | AT91_SMC_DBW_8,
145 .tdf_cycles = 2,
146};
147
148static void __init ek_add_device_nand(void)
149{
150 /* configure chip-select 3 (NAND) */
151 sam9_smc_configure(0, 3, &ek_nand_smc_config);
152
153 at91_add_device_nand(&ek_nand_data);
154}
155
156/*
157 * MCI (SD/MMC)
158 */
159static struct mci_platform_data __initdata ek_mci0_data = {
160 .slot[0] = {
161 .bus_width = 4,
162 .detect_pin = -EINVAL,
163 .wp_pin = -EINVAL,
164 },
165};
166
167/*
168 * GPIO Buttons
169 */
170#if defined(CONFIG_KEYBOARD_GPIO) || defined(CONFIG_KEYBOARD_GPIO_MODULE)
171static struct gpio_keys_button ek_buttons[] = {
172 { /* USER PUSH BUTTON */
173 .code = KEY_ENTER,
174 .gpio = AT91_PIN_PB10,
175 .active_low = 1,
176 .desc = "user_pb",
177 .wakeup = 1,
178 }
179};
180
181static struct gpio_keys_platform_data ek_button_data = {
182 .buttons = ek_buttons,
183 .nbuttons = ARRAY_SIZE(ek_buttons),
184};
185
186static struct platform_device ek_button_device = {
187 .name = "gpio-keys",
188 .id = -1,
189 .num_resources = 0,
190 .dev = {
191 .platform_data = &ek_button_data,
192 }
193};
194
195static void __init ek_add_device_buttons(void)
196{
197 at91_set_GPIO_periph(AT91_PIN_PB10, 1); /* user push button, pull up enabled */
198 at91_set_deglitch(AT91_PIN_PB10, 1);
199
200 platform_device_register(&ek_button_device);
201}
202#else
203static void __init ek_add_device_buttons(void) {}
204#endif
205
206/*
207 * LEDs
208 */
209static struct gpio_led ek_leds[] = {
210 { /* user_led (green) */
211 .name = "user_led",
212 .gpio = AT91_PIN_PB21,
213 .active_low = 0,
214 .default_trigger = "heartbeat",
215 }
216};
217
218static void __init ek_board_init(void)
219{
220 /* Serial */
221 /* DBGU on ttyS0. (Rx & Tx only) */
222 at91_register_uart(0, 0, 0);
223
224 /* USART0 on ttyS1. (Rx, Tx, CTS, RTS, DTR, DSR, DCD, RI) */
225 at91_register_uart(AT91SAM9260_ID_US0, 1, ATMEL_UART_CTS | ATMEL_UART_RTS
226 | ATMEL_UART_DTR | ATMEL_UART_DSR | ATMEL_UART_DCD
227 | ATMEL_UART_RI);
228
229 /* USART1 on ttyS2. (Rx, Tx, CTS, RTS) */
230 at91_register_uart(AT91SAM9260_ID_US1, 2, ATMEL_UART_CTS | ATMEL_UART_RTS);
231
232 /* USART2 on ttyS3. (Rx, Tx, CTS, RTS) */
233 at91_register_uart(AT91SAM9260_ID_US2, 3, ATMEL_UART_CTS | ATMEL_UART_RTS);
234 at91_add_device_serial();
235 /* USB Host */
236 at91_add_device_usbh(&ek_usbh_data);
237 /* USB Device */
238 at91_add_device_udc(&ek_udc_data);
239 /* SPI */
240 at91_add_device_spi(ek_spi_devices, ARRAY_SIZE(ek_spi_devices));
241 /* NAND */
242 ek_add_device_nand();
243 /* I2C */
244 at91_add_device_i2c(NULL, 0);
245 /* Ethernet */
246 at91_add_device_eth(&ek_macb_data);
247 /* MMC */
248 at91_add_device_mci(0, &ek_mci0_data);
249 /* Push Buttons */
250 ek_add_device_buttons();
251 /* LEDs */
252 at91_gpio_leds(ek_leds, ARRAY_SIZE(ek_leds));
253 /* shutdown controller, wakeup button (5 msec low) */
254 at91_shdwc_write(AT91_SHDW_MR, AT91_SHDW_CPTWK0_(10) | AT91_SHDW_WKMODE0_LOW
255 | AT91_SHDW_RTTWKEN);
256}
257
258MACHINE_START(QIL_A9260, "CALAO QIL_A9260")
259 /* Maintainer: calao-systems */
260 .init_time = at91sam926x_pit_init,
261 .map_io = at91_map_io,
262 .handle_irq = at91_aic_handle_irq,
263 .init_early = ek_init_early,
264 .init_irq = at91_init_irq_default,
265 .init_machine = ek_board_init,
266MACHINE_END
diff --git a/arch/arm/mach-at91/clock.c b/arch/arm/mach-at91/clock.c
index 6b2630a92f71..034529d801b2 100644
--- a/arch/arm/mach-at91/clock.c
+++ b/arch/arm/mach-at91/clock.c
@@ -24,9 +24,9 @@
24#include <linux/clk.h> 24#include <linux/clk.h>
25#include <linux/io.h> 25#include <linux/io.h>
26#include <linux/of_address.h> 26#include <linux/of_address.h>
27#include <linux/clk/at91_pmc.h>
27 28
28#include <mach/hardware.h> 29#include <mach/hardware.h>
29#include <mach/at91_pmc.h>
30#include <mach/cpu.h> 30#include <mach/cpu.h>
31 31
32#include <asm/proc-fns.h> 32#include <asm/proc-fns.h>
@@ -330,8 +330,6 @@ EXPORT_SYMBOL(clk_get_rate);
330 330
331/*------------------------------------------------------------------------*/ 331/*------------------------------------------------------------------------*/
332 332
333#ifdef CONFIG_AT91_PROGRAMMABLE_CLOCKS
334
335/* 333/*
336 * For now, only the programmable clocks support reparenting (MCK could 334 * For now, only the programmable clocks support reparenting (MCK could
337 * do this too, with care) or rate changing (the PLLs could do this too, 335 * do this too, with care) or rate changing (the PLLs could do this too,
@@ -459,8 +457,6 @@ static void __init init_programmable_clock(struct clk *clk)
459 clk->rate_hz = parent->rate_hz / pmc_prescaler_divider(pckr); 457 clk->rate_hz = parent->rate_hz / pmc_prescaler_divider(pckr);
460} 458}
461 459
462#endif /* CONFIG_AT91_PROGRAMMABLE_CLOCKS */
463
464/*------------------------------------------------------------------------*/ 460/*------------------------------------------------------------------------*/
465 461
466#ifdef CONFIG_DEBUG_FS 462#ifdef CONFIG_DEBUG_FS
@@ -577,12 +573,10 @@ int __init clk_register(struct clk *clk)
577 clk->parent = &mck; 573 clk->parent = &mck;
578 clk->mode = pmc_sys_mode; 574 clk->mode = pmc_sys_mode;
579 } 575 }
580#ifdef CONFIG_AT91_PROGRAMMABLE_CLOCKS
581 else if (clk_is_programmable(clk)) { 576 else if (clk_is_programmable(clk)) {
582 clk->mode = pmc_sys_mode; 577 clk->mode = pmc_sys_mode;
583 init_programmable_clock(clk); 578 init_programmable_clock(clk);
584 } 579 }
585#endif
586 580
587 at91_clk_add(clk); 581 at91_clk_add(clk);
588 582
@@ -884,6 +878,11 @@ static int __init at91_pmc_init(unsigned long main_clock)
884#if defined(CONFIG_OF) 878#if defined(CONFIG_OF)
885static struct of_device_id pmc_ids[] = { 879static struct of_device_id pmc_ids[] = {
886 { .compatible = "atmel,at91rm9200-pmc" }, 880 { .compatible = "atmel,at91rm9200-pmc" },
881 { .compatible = "atmel,at91sam9260-pmc" },
882 { .compatible = "atmel,at91sam9g45-pmc" },
883 { .compatible = "atmel,at91sam9n12-pmc" },
884 { .compatible = "atmel,at91sam9x5-pmc" },
885 { .compatible = "atmel,sama5d3-pmc" },
887 { /*sentinel*/ } 886 { /*sentinel*/ }
888}; 887};
889 888
diff --git a/arch/arm/mach-at91/generic.h b/arch/arm/mach-at91/generic.h
index 26dee3ce9397..631fa3b8c16d 100644
--- a/arch/arm/mach-at91/generic.h
+++ b/arch/arm/mach-at91/generic.h
@@ -46,11 +46,12 @@ extern void at91sam926x_pit_init(void);
46extern void at91x40_timer_init(void); 46extern void at91x40_timer_init(void);
47 47
48 /* Clocks */ 48 /* Clocks */
49#ifdef CONFIG_AT91_PMC_UNIT 49#ifdef CONFIG_OLD_CLK_AT91
50extern int __init at91_clock_init(unsigned long main_clock); 50extern int __init at91_clock_init(unsigned long main_clock);
51extern int __init at91_dt_clock_init(void); 51extern int __init at91_dt_clock_init(void);
52#else 52#else
53static int inline at91_clock_init(unsigned long main_clock) { return 0; } 53static int inline at91_clock_init(unsigned long main_clock) { return 0; }
54static int inline at91_dt_clock_init(void) { return 0; }
54#endif 55#endif
55struct device; 56struct device;
56 57
diff --git a/arch/arm/mach-at91/include/mach/at91_pmc.h b/arch/arm/mach-at91/include/mach/at91_pmc.h
deleted file mode 100644
index c604cc69acb5..000000000000
--- a/arch/arm/mach-at91/include/mach/at91_pmc.h
+++ /dev/null
@@ -1,190 +0,0 @@
1/*
2 * arch/arm/mach-at91/include/mach/at91_pmc.h
3 *
4 * Copyright (C) 2005 Ivan Kokshaysky
5 * Copyright (C) SAN People
6 *
7 * Power Management Controller (PMC) - System peripherals registers.
8 * Based on AT91RM9200 datasheet revision E.
9 *
10 * This program is free software; you can redistribute it and/or modify
11 * it under the terms of the GNU General Public License as published by
12 * the Free Software Foundation; either version 2 of the License, or
13 * (at your option) any later version.
14 */
15
16#ifndef AT91_PMC_H
17#define AT91_PMC_H
18
19#ifndef __ASSEMBLY__
20extern void __iomem *at91_pmc_base;
21
22#define at91_pmc_read(field) \
23 __raw_readl(at91_pmc_base + field)
24
25#define at91_pmc_write(field, value) \
26 __raw_writel(value, at91_pmc_base + field)
27#else
28.extern at91_pmc_base
29#endif
30
31#define AT91_PMC_SCER 0x00 /* System Clock Enable Register */
32#define AT91_PMC_SCDR 0x04 /* System Clock Disable Register */
33
34#define AT91_PMC_SCSR 0x08 /* System Clock Status Register */
35#define AT91_PMC_PCK (1 << 0) /* Processor Clock */
36#define AT91RM9200_PMC_UDP (1 << 1) /* USB Devcice Port Clock [AT91RM9200 only] */
37#define AT91RM9200_PMC_MCKUDP (1 << 2) /* USB Device Port Master Clock Automatic Disable on Suspend [AT91RM9200 only] */
38#define AT91RM9200_PMC_UHP (1 << 4) /* USB Host Port Clock [AT91RM9200 only] */
39#define AT91SAM926x_PMC_UHP (1 << 6) /* USB Host Port Clock [AT91SAM926x only] */
40#define AT91SAM926x_PMC_UDP (1 << 7) /* USB Devcice Port Clock [AT91SAM926x only] */
41#define AT91_PMC_PCK0 (1 << 8) /* Programmable Clock 0 */
42#define AT91_PMC_PCK1 (1 << 9) /* Programmable Clock 1 */
43#define AT91_PMC_PCK2 (1 << 10) /* Programmable Clock 2 */
44#define AT91_PMC_PCK3 (1 << 11) /* Programmable Clock 3 */
45#define AT91_PMC_PCK4 (1 << 12) /* Programmable Clock 4 [AT572D940HF only] */
46#define AT91_PMC_HCK0 (1 << 16) /* AHB Clock (USB host) [AT91SAM9261 only] */
47#define AT91_PMC_HCK1 (1 << 17) /* AHB Clock (LCD) [AT91SAM9261 only] */
48
49#define AT91_PMC_PCER 0x10 /* Peripheral Clock Enable Register */
50#define AT91_PMC_PCDR 0x14 /* Peripheral Clock Disable Register */
51#define AT91_PMC_PCSR 0x18 /* Peripheral Clock Status Register */
52
53#define AT91_CKGR_UCKR 0x1C /* UTMI Clock Register [some SAM9] */
54#define AT91_PMC_UPLLEN (1 << 16) /* UTMI PLL Enable */
55#define AT91_PMC_UPLLCOUNT (0xf << 20) /* UTMI PLL Start-up Time */
56#define AT91_PMC_BIASEN (1 << 24) /* UTMI BIAS Enable */
57#define AT91_PMC_BIASCOUNT (0xf << 28) /* UTMI BIAS Start-up Time */
58
59#define AT91_CKGR_MOR 0x20 /* Main Oscillator Register [not on SAM9RL] */
60#define AT91_PMC_MOSCEN (1 << 0) /* Main Oscillator Enable */
61#define AT91_PMC_OSCBYPASS (1 << 1) /* Oscillator Bypass */
62#define AT91_PMC_MOSCRCEN (1 << 3) /* Main On-Chip RC Oscillator Enable [some SAM9] */
63#define AT91_PMC_OSCOUNT (0xff << 8) /* Main Oscillator Start-up Time */
64#define AT91_PMC_KEY (0x37 << 16) /* MOR Writing Key */
65#define AT91_PMC_MOSCSEL (1 << 24) /* Main Oscillator Selection [some SAM9] */
66#define AT91_PMC_CFDEN (1 << 25) /* Clock Failure Detector Enable [some SAM9] */
67
68#define AT91_CKGR_MCFR 0x24 /* Main Clock Frequency Register */
69#define AT91_PMC_MAINF (0xffff << 0) /* Main Clock Frequency */
70#define AT91_PMC_MAINRDY (1 << 16) /* Main Clock Ready */
71
72#define AT91_CKGR_PLLAR 0x28 /* PLL A Register */
73#define AT91_CKGR_PLLBR 0x2c /* PLL B Register */
74#define AT91_PMC_DIV (0xff << 0) /* Divider */
75#define AT91_PMC_PLLCOUNT (0x3f << 8) /* PLL Counter */
76#define AT91_PMC_OUT (3 << 14) /* PLL Clock Frequency Range */
77#define AT91_PMC_MUL (0x7ff << 16) /* PLL Multiplier */
78#define AT91_PMC_MUL_GET(n) ((n) >> 16 & 0x7ff)
79#define AT91_PMC3_MUL (0x7f << 18) /* PLL Multiplier [SAMA5 only] */
80#define AT91_PMC3_MUL_GET(n) ((n) >> 18 & 0x7f)
81#define AT91_PMC_USBDIV (3 << 28) /* USB Divisor (PLLB only) */
82#define AT91_PMC_USBDIV_1 (0 << 28)
83#define AT91_PMC_USBDIV_2 (1 << 28)
84#define AT91_PMC_USBDIV_4 (2 << 28)
85#define AT91_PMC_USB96M (1 << 28) /* Divider by 2 Enable (PLLB only) */
86
87#define AT91_PMC_MCKR 0x30 /* Master Clock Register */
88#define AT91_PMC_CSS (3 << 0) /* Master Clock Selection */
89#define AT91_PMC_CSS_SLOW (0 << 0)
90#define AT91_PMC_CSS_MAIN (1 << 0)
91#define AT91_PMC_CSS_PLLA (2 << 0)
92#define AT91_PMC_CSS_PLLB (3 << 0)
93#define AT91_PMC_CSS_UPLL (3 << 0) /* [some SAM9 only] */
94#define PMC_PRES_OFFSET 2
95#define AT91_PMC_PRES (7 << PMC_PRES_OFFSET) /* Master Clock Prescaler */
96#define AT91_PMC_PRES_1 (0 << PMC_PRES_OFFSET)
97#define AT91_PMC_PRES_2 (1 << PMC_PRES_OFFSET)
98#define AT91_PMC_PRES_4 (2 << PMC_PRES_OFFSET)
99#define AT91_PMC_PRES_8 (3 << PMC_PRES_OFFSET)
100#define AT91_PMC_PRES_16 (4 << PMC_PRES_OFFSET)
101#define AT91_PMC_PRES_32 (5 << PMC_PRES_OFFSET)
102#define AT91_PMC_PRES_64 (6 << PMC_PRES_OFFSET)
103#define PMC_ALT_PRES_OFFSET 4
104#define AT91_PMC_ALT_PRES (7 << PMC_ALT_PRES_OFFSET) /* Master Clock Prescaler [alternate location] */
105#define AT91_PMC_ALT_PRES_1 (0 << PMC_ALT_PRES_OFFSET)
106#define AT91_PMC_ALT_PRES_2 (1 << PMC_ALT_PRES_OFFSET)
107#define AT91_PMC_ALT_PRES_4 (2 << PMC_ALT_PRES_OFFSET)
108#define AT91_PMC_ALT_PRES_8 (3 << PMC_ALT_PRES_OFFSET)
109#define AT91_PMC_ALT_PRES_16 (4 << PMC_ALT_PRES_OFFSET)
110#define AT91_PMC_ALT_PRES_32 (5 << PMC_ALT_PRES_OFFSET)
111#define AT91_PMC_ALT_PRES_64 (6 << PMC_ALT_PRES_OFFSET)
112#define AT91_PMC_MDIV (3 << 8) /* Master Clock Division */
113#define AT91RM9200_PMC_MDIV_1 (0 << 8) /* [AT91RM9200 only] */
114#define AT91RM9200_PMC_MDIV_2 (1 << 8)
115#define AT91RM9200_PMC_MDIV_3 (2 << 8)
116#define AT91RM9200_PMC_MDIV_4 (3 << 8)
117#define AT91SAM9_PMC_MDIV_1 (0 << 8) /* [SAM9 only] */
118#define AT91SAM9_PMC_MDIV_2 (1 << 8)
119#define AT91SAM9_PMC_MDIV_4 (2 << 8)
120#define AT91SAM9_PMC_MDIV_6 (3 << 8) /* [some SAM9 only] */
121#define AT91SAM9_PMC_MDIV_3 (3 << 8) /* [some SAM9 only] */
122#define AT91_PMC_PDIV (1 << 12) /* Processor Clock Division [some SAM9 only] */
123#define AT91_PMC_PDIV_1 (0 << 12)
124#define AT91_PMC_PDIV_2 (1 << 12)
125#define AT91_PMC_PLLADIV2 (1 << 12) /* PLLA divisor by 2 [some SAM9 only] */
126#define AT91_PMC_PLLADIV2_OFF (0 << 12)
127#define AT91_PMC_PLLADIV2_ON (1 << 12)
128
129#define AT91_PMC_USB 0x38 /* USB Clock Register [some SAM9 only] */
130#define AT91_PMC_USBS (0x1 << 0) /* USB OHCI Input clock selection */
131#define AT91_PMC_USBS_PLLA (0 << 0)
132#define AT91_PMC_USBS_UPLL (1 << 0)
133#define AT91_PMC_USBS_PLLB (1 << 0) /* [AT91SAMN12 only] */
134#define AT91_PMC_OHCIUSBDIV (0xF << 8) /* Divider for USB OHCI Clock */
135#define AT91_PMC_OHCIUSBDIV_1 (0x0 << 8)
136#define AT91_PMC_OHCIUSBDIV_2 (0x1 << 8)
137
138#define AT91_PMC_SMD 0x3c /* Soft Modem Clock Register [some SAM9 only] */
139#define AT91_PMC_SMDS (0x1 << 0) /* SMD input clock selection */
140#define AT91_PMC_SMD_DIV (0x1f << 8) /* SMD input clock divider */
141#define AT91_PMC_SMDDIV(n) (((n) << 8) & AT91_PMC_SMD_DIV)
142
143#define AT91_PMC_PCKR(n) (0x40 + ((n) * 4)) /* Programmable Clock 0-N Registers */
144#define AT91_PMC_ALT_PCKR_CSS (0x7 << 0) /* Programmable Clock Source Selection [alternate length] */
145#define AT91_PMC_CSS_MASTER (4 << 0) /* [some SAM9 only] */
146#define AT91_PMC_CSSMCK (0x1 << 8) /* CSS or Master Clock Selection */
147#define AT91_PMC_CSSMCK_CSS (0 << 8)
148#define AT91_PMC_CSSMCK_MCK (1 << 8)
149
150#define AT91_PMC_IER 0x60 /* Interrupt Enable Register */
151#define AT91_PMC_IDR 0x64 /* Interrupt Disable Register */
152#define AT91_PMC_SR 0x68 /* Status Register */
153#define AT91_PMC_MOSCS (1 << 0) /* MOSCS Flag */
154#define AT91_PMC_LOCKA (1 << 1) /* PLLA Lock */
155#define AT91_PMC_LOCKB (1 << 2) /* PLLB Lock */
156#define AT91_PMC_MCKRDY (1 << 3) /* Master Clock */
157#define AT91_PMC_LOCKU (1 << 6) /* UPLL Lock [some SAM9] */
158#define AT91_PMC_PCK0RDY (1 << 8) /* Programmable Clock 0 */
159#define AT91_PMC_PCK1RDY (1 << 9) /* Programmable Clock 1 */
160#define AT91_PMC_PCK2RDY (1 << 10) /* Programmable Clock 2 */
161#define AT91_PMC_PCK3RDY (1 << 11) /* Programmable Clock 3 */
162#define AT91_PMC_MOSCSELS (1 << 16) /* Main Oscillator Selection [some SAM9] */
163#define AT91_PMC_MOSCRCS (1 << 17) /* Main On-Chip RC [some SAM9] */
164#define AT91_PMC_CFDEV (1 << 18) /* Clock Failure Detector Event [some SAM9] */
165#define AT91_PMC_IMR 0x6c /* Interrupt Mask Register */
166
167#define AT91_PMC_PROT 0xe4 /* Write Protect Mode Register [some SAM9] */
168#define AT91_PMC_WPEN (0x1 << 0) /* Write Protect Enable */
169#define AT91_PMC_WPKEY (0xffffff << 8) /* Write Protect Key */
170#define AT91_PMC_PROTKEY (0x504d43 << 8) /* Activation Code */
171
172#define AT91_PMC_WPSR 0xe8 /* Write Protect Status Register [some SAM9] */
173#define AT91_PMC_WPVS (0x1 << 0) /* Write Protect Violation Status */
174#define AT91_PMC_WPVSRC (0xffff << 8) /* Write Protect Violation Source */
175
176#define AT91_PMC_PCER1 0x100 /* Peripheral Clock Enable Register 1 [SAMA5 only]*/
177#define AT91_PMC_PCDR1 0x104 /* Peripheral Clock Enable Register 1 */
178#define AT91_PMC_PCSR1 0x108 /* Peripheral Clock Enable Register 1 */
179
180#define AT91_PMC_PCR 0x10c /* Peripheral Control Register [some SAM9 and SAMA5] */
181#define AT91_PMC_PCR_PID (0x3f << 0) /* Peripheral ID */
182#define AT91_PMC_PCR_CMD (0x1 << 12) /* Command (read=0, write=1) */
183#define AT91_PMC_PCR_DIV(n) ((n) << 16) /* Divisor Value */
184#define AT91_PMC_PCR_DIV0 0x0 /* Peripheral clock is MCK */
185#define AT91_PMC_PCR_DIV2 0x1 /* Peripheral clock is MCK/2 */
186#define AT91_PMC_PCR_DIV4 0x2 /* Peripheral clock is MCK/4 */
187#define AT91_PMC_PCR_DIV8 0x3 /* Peripheral clock is MCK/8 */
188#define AT91_PMC_PCR_EN (0x1 << 28) /* Enable */
189
190#endif
diff --git a/arch/arm/mach-at91/pm.c b/arch/arm/mach-at91/pm.c
index 9986542e8060..590b52dea9f7 100644
--- a/arch/arm/mach-at91/pm.c
+++ b/arch/arm/mach-at91/pm.c
@@ -19,13 +19,13 @@
19#include <linux/module.h> 19#include <linux/module.h>
20#include <linux/platform_device.h> 20#include <linux/platform_device.h>
21#include <linux/io.h> 21#include <linux/io.h>
22#include <linux/clk/at91_pmc.h>
22 23
23#include <asm/irq.h> 24#include <asm/irq.h>
24#include <linux/atomic.h> 25#include <linux/atomic.h>
25#include <asm/mach/time.h> 26#include <asm/mach/time.h>
26#include <asm/mach/irq.h> 27#include <asm/mach/irq.h>
27 28
28#include <mach/at91_pmc.h>
29#include <mach/cpu.h> 29#include <mach/cpu.h>
30 30
31#include "at91_aic.h" 31#include "at91_aic.h"
@@ -155,9 +155,6 @@ static int at91_pm_verify_clocks(void)
155 } 155 }
156 } 156 }
157 157
158 if (!IS_ENABLED(CONFIG_AT91_PROGRAMMABLE_CLOCKS))
159 return 1;
160
161 /* PCK0..PCK3 must be disabled, or configured to use clk32k */ 158 /* PCK0..PCK3 must be disabled, or configured to use clk32k */
162 for (i = 0; i < 4; i++) { 159 for (i = 0; i < 4; i++) {
163 u32 css; 160 u32 css;
diff --git a/arch/arm/mach-at91/pm_slowclock.S b/arch/arm/mach-at91/pm_slowclock.S
index 098c28ddf025..20018779bae7 100644
--- a/arch/arm/mach-at91/pm_slowclock.S
+++ b/arch/arm/mach-at91/pm_slowclock.S
@@ -13,8 +13,8 @@
13 */ 13 */
14 14
15#include <linux/linkage.h> 15#include <linux/linkage.h>
16#include <linux/clk/at91_pmc.h>
16#include <mach/hardware.h> 17#include <mach/hardware.h>
17#include <mach/at91_pmc.h>
18#include <mach/at91_ramc.h> 18#include <mach/at91_ramc.h>
19 19
20 20
diff --git a/arch/arm/mach-at91/sama5d3.c b/arch/arm/mach-at91/sama5d3.c
index a28873fe3049..3d775d08de08 100644
--- a/arch/arm/mach-at91/sama5d3.c
+++ b/arch/arm/mach-at91/sama5d3.c
@@ -9,360 +9,19 @@
9 9
10#include <linux/module.h> 10#include <linux/module.h>
11#include <linux/dma-mapping.h> 11#include <linux/dma-mapping.h>
12#include <linux/clk/at91_pmc.h>
12 13
13#include <asm/irq.h> 14#include <asm/irq.h>
14#include <asm/mach/arch.h> 15#include <asm/mach/arch.h>
15#include <asm/mach/map.h> 16#include <asm/mach/map.h>
16#include <mach/sama5d3.h> 17#include <mach/sama5d3.h>
17#include <mach/at91_pmc.h>
18#include <mach/cpu.h> 18#include <mach/cpu.h>
19 19
20#include "soc.h" 20#include "soc.h"
21#include "generic.h" 21#include "generic.h"
22#include "clock.h"
23#include "sam9_smc.h" 22#include "sam9_smc.h"
24 23
25/* -------------------------------------------------------------------- 24/* --------------------------------------------------------------------
26 * Clocks
27 * -------------------------------------------------------------------- */
28
29/*
30 * The peripheral clocks.
31 */
32
33static struct clk pioA_clk = {
34 .name = "pioA_clk",
35 .pid = SAMA5D3_ID_PIOA,
36 .type = CLK_TYPE_PERIPHERAL,
37};
38static struct clk pioB_clk = {
39 .name = "pioB_clk",
40 .pid = SAMA5D3_ID_PIOB,
41 .type = CLK_TYPE_PERIPHERAL,
42};
43static struct clk pioC_clk = {
44 .name = "pioC_clk",
45 .pid = SAMA5D3_ID_PIOC,
46 .type = CLK_TYPE_PERIPHERAL,
47};
48static struct clk pioD_clk = {
49 .name = "pioD_clk",
50 .pid = SAMA5D3_ID_PIOD,
51 .type = CLK_TYPE_PERIPHERAL,
52};
53static struct clk pioE_clk = {
54 .name = "pioE_clk",
55 .pid = SAMA5D3_ID_PIOE,
56 .type = CLK_TYPE_PERIPHERAL,
57};
58static struct clk usart0_clk = {
59 .name = "usart0_clk",
60 .pid = SAMA5D3_ID_USART0,
61 .type = CLK_TYPE_PERIPHERAL,
62 .div = AT91_PMC_PCR_DIV2,
63};
64static struct clk usart1_clk = {
65 .name = "usart1_clk",
66 .pid = SAMA5D3_ID_USART1,
67 .type = CLK_TYPE_PERIPHERAL,
68 .div = AT91_PMC_PCR_DIV2,
69};
70static struct clk usart2_clk = {
71 .name = "usart2_clk",
72 .pid = SAMA5D3_ID_USART2,
73 .type = CLK_TYPE_PERIPHERAL,
74 .div = AT91_PMC_PCR_DIV2,
75};
76static struct clk usart3_clk = {
77 .name = "usart3_clk",
78 .pid = SAMA5D3_ID_USART3,
79 .type = CLK_TYPE_PERIPHERAL,
80 .div = AT91_PMC_PCR_DIV2,
81};
82static struct clk uart0_clk = {
83 .name = "uart0_clk",
84 .pid = SAMA5D3_ID_UART0,
85 .type = CLK_TYPE_PERIPHERAL,
86 .div = AT91_PMC_PCR_DIV2,
87};
88static struct clk uart1_clk = {
89 .name = "uart1_clk",
90 .pid = SAMA5D3_ID_UART1,
91 .type = CLK_TYPE_PERIPHERAL,
92 .div = AT91_PMC_PCR_DIV2,
93};
94static struct clk twi0_clk = {
95 .name = "twi0_clk",
96 .pid = SAMA5D3_ID_TWI0,
97 .type = CLK_TYPE_PERIPHERAL,
98 .div = AT91_PMC_PCR_DIV8,
99};
100static struct clk twi1_clk = {
101 .name = "twi1_clk",
102 .pid = SAMA5D3_ID_TWI1,
103 .type = CLK_TYPE_PERIPHERAL,
104 .div = AT91_PMC_PCR_DIV8,
105};
106static struct clk twi2_clk = {
107 .name = "twi2_clk",
108 .pid = SAMA5D3_ID_TWI2,
109 .type = CLK_TYPE_PERIPHERAL,
110 .div = AT91_PMC_PCR_DIV8,
111};
112static struct clk mmc0_clk = {
113 .name = "mci0_clk",
114 .pid = SAMA5D3_ID_HSMCI0,
115 .type = CLK_TYPE_PERIPHERAL,
116};
117static struct clk mmc1_clk = {
118 .name = "mci1_clk",
119 .pid = SAMA5D3_ID_HSMCI1,
120 .type = CLK_TYPE_PERIPHERAL,
121};
122static struct clk mmc2_clk = {
123 .name = "mci2_clk",
124 .pid = SAMA5D3_ID_HSMCI2,
125 .type = CLK_TYPE_PERIPHERAL,
126};
127static struct clk spi0_clk = {
128 .name = "spi0_clk",
129 .pid = SAMA5D3_ID_SPI0,
130 .type = CLK_TYPE_PERIPHERAL,
131};
132static struct clk spi1_clk = {
133 .name = "spi1_clk",
134 .pid = SAMA5D3_ID_SPI1,
135 .type = CLK_TYPE_PERIPHERAL,
136};
137static struct clk tcb0_clk = {
138 .name = "tcb0_clk",
139 .pid = SAMA5D3_ID_TC0,
140 .type = CLK_TYPE_PERIPHERAL,
141 .div = AT91_PMC_PCR_DIV2,
142};
143static struct clk tcb1_clk = {
144 .name = "tcb1_clk",
145 .pid = SAMA5D3_ID_TC1,
146 .type = CLK_TYPE_PERIPHERAL,
147 .div = AT91_PMC_PCR_DIV2,
148};
149static struct clk adc_clk = {
150 .name = "adc_clk",
151 .pid = SAMA5D3_ID_ADC,
152 .type = CLK_TYPE_PERIPHERAL,
153 .div = AT91_PMC_PCR_DIV2,
154};
155static struct clk adc_op_clk = {
156 .name = "adc_op_clk",
157 .type = CLK_TYPE_PERIPHERAL,
158 .rate_hz = 5000000,
159};
160static struct clk dma0_clk = {
161 .name = "dma0_clk",
162 .pid = SAMA5D3_ID_DMA0,
163 .type = CLK_TYPE_PERIPHERAL,
164};
165static struct clk dma1_clk = {
166 .name = "dma1_clk",
167 .pid = SAMA5D3_ID_DMA1,
168 .type = CLK_TYPE_PERIPHERAL,
169};
170static struct clk uhphs_clk = {
171 .name = "uhphs",
172 .pid = SAMA5D3_ID_UHPHS,
173 .type = CLK_TYPE_PERIPHERAL,
174};
175static struct clk udphs_clk = {
176 .name = "udphs_clk",
177 .pid = SAMA5D3_ID_UDPHS,
178 .type = CLK_TYPE_PERIPHERAL,
179};
180/* gmac only for sama5d33, sama5d34, sama5d35 */
181static struct clk macb0_clk = {
182 .name = "macb0_clk",
183 .pid = SAMA5D3_ID_GMAC,
184 .type = CLK_TYPE_PERIPHERAL,
185};
186/* emac only for sama5d31, sama5d35 */
187static struct clk macb1_clk = {
188 .name = "macb1_clk",
189 .pid = SAMA5D3_ID_EMAC,
190 .type = CLK_TYPE_PERIPHERAL,
191};
192/* lcd only for sama5d31, sama5d33, sama5d34 */
193static struct clk lcdc_clk = {
194 .name = "lcdc_clk",
195 .pid = SAMA5D3_ID_LCDC,
196 .type = CLK_TYPE_PERIPHERAL,
197};
198/* isi only for sama5d33, sama5d35 */
199static struct clk isi_clk = {
200 .name = "isi_clk",
201 .pid = SAMA5D3_ID_ISI,
202 .type = CLK_TYPE_PERIPHERAL,
203};
204static struct clk can0_clk = {
205 .name = "can0_clk",
206 .pid = SAMA5D3_ID_CAN0,
207 .type = CLK_TYPE_PERIPHERAL,
208 .div = AT91_PMC_PCR_DIV2,
209};
210static struct clk can1_clk = {
211 .name = "can1_clk",
212 .pid = SAMA5D3_ID_CAN1,
213 .type = CLK_TYPE_PERIPHERAL,
214 .div = AT91_PMC_PCR_DIV2,
215};
216static struct clk ssc0_clk = {
217 .name = "ssc0_clk",
218 .pid = SAMA5D3_ID_SSC0,
219 .type = CLK_TYPE_PERIPHERAL,
220 .div = AT91_PMC_PCR_DIV2,
221};
222static struct clk ssc1_clk = {
223 .name = "ssc1_clk",
224 .pid = SAMA5D3_ID_SSC1,
225 .type = CLK_TYPE_PERIPHERAL,
226 .div = AT91_PMC_PCR_DIV2,
227};
228static struct clk sha_clk = {
229 .name = "sha_clk",
230 .pid = SAMA5D3_ID_SHA,
231 .type = CLK_TYPE_PERIPHERAL,
232 .div = AT91_PMC_PCR_DIV8,
233};
234static struct clk aes_clk = {
235 .name = "aes_clk",
236 .pid = SAMA5D3_ID_AES,
237 .type = CLK_TYPE_PERIPHERAL,
238};
239static struct clk tdes_clk = {
240 .name = "tdes_clk",
241 .pid = SAMA5D3_ID_TDES,
242 .type = CLK_TYPE_PERIPHERAL,
243};
244
245static struct clk *periph_clocks[] __initdata = {
246 &pioA_clk,
247 &pioB_clk,
248 &pioC_clk,
249 &pioD_clk,
250 &pioE_clk,
251 &usart0_clk,
252 &usart1_clk,
253 &usart2_clk,
254 &usart3_clk,
255 &uart0_clk,
256 &uart1_clk,
257 &twi0_clk,
258 &twi1_clk,
259 &twi2_clk,
260 &mmc0_clk,
261 &mmc1_clk,
262 &mmc2_clk,
263 &spi0_clk,
264 &spi1_clk,
265 &tcb0_clk,
266 &tcb1_clk,
267 &adc_clk,
268 &adc_op_clk,
269 &dma0_clk,
270 &dma1_clk,
271 &uhphs_clk,
272 &udphs_clk,
273 &macb0_clk,
274 &macb1_clk,
275 &lcdc_clk,
276 &isi_clk,
277 &can0_clk,
278 &can1_clk,
279 &ssc0_clk,
280 &ssc1_clk,
281 &sha_clk,
282 &aes_clk,
283 &tdes_clk,
284};
285
286static struct clk pck0 = {
287 .name = "pck0",
288 .pmc_mask = AT91_PMC_PCK0,
289 .type = CLK_TYPE_PROGRAMMABLE,
290 .id = 0,
291};
292
293static struct clk pck1 = {
294 .name = "pck1",
295 .pmc_mask = AT91_PMC_PCK1,
296 .type = CLK_TYPE_PROGRAMMABLE,
297 .id = 1,
298};
299
300static struct clk pck2 = {
301 .name = "pck2",
302 .pmc_mask = AT91_PMC_PCK2,
303 .type = CLK_TYPE_PROGRAMMABLE,
304 .id = 2,
305};
306
307static struct clk_lookup periph_clocks_lookups[] = {
308 /* lookup table for DT entries */
309 CLKDEV_CON_DEV_ID("usart", "ffffee00.serial", &mck),
310 CLKDEV_CON_DEV_ID(NULL, "fffff200.gpio", &pioA_clk),
311 CLKDEV_CON_DEV_ID(NULL, "fffff400.gpio", &pioB_clk),
312 CLKDEV_CON_DEV_ID(NULL, "fffff600.gpio", &pioC_clk),
313 CLKDEV_CON_DEV_ID(NULL, "fffff800.gpio", &pioD_clk),
314 CLKDEV_CON_DEV_ID(NULL, "fffffa00.gpio", &pioE_clk),
315 CLKDEV_CON_DEV_ID("usart", "f001c000.serial", &usart0_clk),
316 CLKDEV_CON_DEV_ID("usart", "f0020000.serial", &usart1_clk),
317 CLKDEV_CON_DEV_ID("usart", "f8020000.serial", &usart2_clk),
318 CLKDEV_CON_DEV_ID("usart", "f8024000.serial", &usart3_clk),
319 CLKDEV_CON_DEV_ID(NULL, "f0014000.i2c", &twi0_clk),
320 CLKDEV_CON_DEV_ID(NULL, "f0018000.i2c", &twi1_clk),
321 CLKDEV_CON_DEV_ID(NULL, "f801c000.i2c", &twi2_clk),
322 CLKDEV_CON_DEV_ID("mci_clk", "f0000000.mmc", &mmc0_clk),
323 CLKDEV_CON_DEV_ID("mci_clk", "f8000000.mmc", &mmc1_clk),
324 CLKDEV_CON_DEV_ID("mci_clk", "f8004000.mmc", &mmc2_clk),
325 CLKDEV_CON_DEV_ID("spi_clk", "f0004000.spi", &spi0_clk),
326 CLKDEV_CON_DEV_ID("spi_clk", "f8008000.spi", &spi1_clk),
327 CLKDEV_CON_DEV_ID("t0_clk", "f0010000.timer", &tcb0_clk),
328 CLKDEV_CON_DEV_ID("t0_clk", "f8014000.timer", &tcb1_clk),
329 CLKDEV_CON_DEV_ID("tsc_clk", "f8018000.tsadcc", &adc_clk),
330 CLKDEV_CON_DEV_ID("dma_clk", "ffffe600.dma-controller", &dma0_clk),
331 CLKDEV_CON_DEV_ID("dma_clk", "ffffe800.dma-controller", &dma1_clk),
332 CLKDEV_CON_DEV_ID("hclk", "600000.ohci", &uhphs_clk),
333 CLKDEV_CON_DEV_ID("ohci_clk", "600000.ohci", &uhphs_clk),
334 CLKDEV_CON_DEV_ID("ehci_clk", "700000.ehci", &uhphs_clk),
335 CLKDEV_CON_DEV_ID("pclk", "500000.gadget", &udphs_clk),
336 CLKDEV_CON_DEV_ID("hclk", "500000.gadget", &utmi_clk),
337 CLKDEV_CON_DEV_ID("hclk", "f0028000.ethernet", &macb0_clk),
338 CLKDEV_CON_DEV_ID("pclk", "f0028000.ethernet", &macb0_clk),
339 CLKDEV_CON_DEV_ID("hclk", "f802c000.ethernet", &macb1_clk),
340 CLKDEV_CON_DEV_ID("pclk", "f802c000.ethernet", &macb1_clk),
341 CLKDEV_CON_DEV_ID("pclk", "f0008000.ssc", &ssc0_clk),
342 CLKDEV_CON_DEV_ID("pclk", "f000c000.ssc", &ssc1_clk),
343 CLKDEV_CON_DEV_ID("can_clk", "f000c000.can", &can0_clk),
344 CLKDEV_CON_DEV_ID("can_clk", "f8010000.can", &can1_clk),
345 CLKDEV_CON_DEV_ID("sha_clk", "f8034000.sha", &sha_clk),
346 CLKDEV_CON_DEV_ID("aes_clk", "f8038000.aes", &aes_clk),
347 CLKDEV_CON_DEV_ID("tdes_clk", "f803c000.tdes", &tdes_clk),
348};
349
350static void __init sama5d3_register_clocks(void)
351{
352 int i;
353
354 for (i = 0; i < ARRAY_SIZE(periph_clocks); i++)
355 clk_register(periph_clocks[i]);
356
357 clkdev_add_table(periph_clocks_lookups,
358 ARRAY_SIZE(periph_clocks_lookups));
359
360 clk_register(&pck0);
361 clk_register(&pck1);
362 clk_register(&pck2);
363}
364
365/* --------------------------------------------------------------------
366 * AT91SAM9x5 processor initialization 25 * AT91SAM9x5 processor initialization
367 * -------------------------------------------------------------------- */ 26 * -------------------------------------------------------------------- */
368 27
@@ -378,6 +37,5 @@ static void __init sama5d3_initialize(void)
378 37
379AT91_SOC_START(sama5d3) 38AT91_SOC_START(sama5d3)
380 .map_io = sama5d3_map_io, 39 .map_io = sama5d3_map_io,
381 .register_clocks = sama5d3_register_clocks,
382 .init = sama5d3_initialize, 40 .init = sama5d3_initialize,
383AT91_SOC_END 41AT91_SOC_END
diff --git a/arch/arm/mach-at91/setup.c b/arch/arm/mach-at91/setup.c
index 2742e00ec5d6..9dc8894c5623 100644
--- a/arch/arm/mach-at91/setup.c
+++ b/arch/arm/mach-at91/setup.c
@@ -11,6 +11,7 @@
11#include <linux/pm.h> 11#include <linux/pm.h>
12#include <linux/of_address.h> 12#include <linux/of_address.h>
13#include <linux/pinctrl/machine.h> 13#include <linux/pinctrl/machine.h>
14#include <linux/clk/at91_pmc.h>
14 15
15#include <asm/system_misc.h> 16#include <asm/system_misc.h>
16#include <asm/mach/map.h> 17#include <asm/mach/map.h>
@@ -18,7 +19,6 @@
18#include <mach/hardware.h> 19#include <mach/hardware.h>
19#include <mach/cpu.h> 20#include <mach/cpu.h>
20#include <mach/at91_dbgu.h> 21#include <mach/at91_dbgu.h>
21#include <mach/at91_pmc.h>
22 22
23#include "at91_shdwc.h" 23#include "at91_shdwc.h"
24#include "soc.h" 24#include "soc.h"
@@ -491,7 +491,8 @@ void __init at91rm9200_dt_initialize(void)
491 at91_dt_clock_init(); 491 at91_dt_clock_init();
492 492
493 /* Register the processor-specific clocks */ 493 /* Register the processor-specific clocks */
494 at91_boot_soc.register_clocks(); 494 if (at91_boot_soc.register_clocks)
495 at91_boot_soc.register_clocks();
495 496
496 at91_boot_soc.init(); 497 at91_boot_soc.init();
497} 498}
@@ -506,7 +507,8 @@ void __init at91_dt_initialize(void)
506 at91_dt_clock_init(); 507 at91_dt_clock_init();
507 508
508 /* Register the processor-specific clocks */ 509 /* Register the processor-specific clocks */
509 at91_boot_soc.register_clocks(); 510 if (at91_boot_soc.register_clocks)
511 at91_boot_soc.register_clocks();
510 512
511 if (at91_boot_soc.init) 513 if (at91_boot_soc.init)
512 at91_boot_soc.init(); 514 at91_boot_soc.init();