aboutsummaryrefslogtreecommitdiffstats
path: root/arch/arm/mach-at91
diff options
context:
space:
mode:
authorBoris BREZILLON <b.brezillon@overkiz.com>2013-10-11 03:37:46 -0400
committerNicolas Ferre <nicolas.ferre@atmel.com>2013-12-02 09:22:52 -0500
commitc8a8c6300866a51ba41fb41b95800e5982dcf96a (patch)
tree6507955bb6c5c569ee9211540416e9b087b430e4 /arch/arm/mach-at91
parent2edb90ae421a0f65edcdef65ef9dd08e3228abbf (diff)
ARM: at91: add Kconfig options for common clk support
This patch adds the following Kconfig options to prepare the transition to common clk framework: - AT91_USE_OLD_CLK: this option is selected by every SoC which does not support new at91 clks based on common clk framework (SoC which does not define the clock tree in its device tree). This options is also selected when the user choose non dt boards support (new at91 clks can only be registered from a device tree definition). - COMMON_CLK_AT91: this option cannot be selected directly. Instead it is enabled if these 3 conditions are met: * at least one of the selected SoCs have a PMC (Power Management Controller) Unit * device tree support is enabled * the old at91 clk implementation is disabled (every selected SoC define its clks in its device tree and non dt boards support is disabled) - OLD_CLK_AT91: this option cannot be selected directly. Instead it is enabled if these 2 conditions are met: * at least one of the selected SoCs have a PMC (Power Management Controller) Unit * at least one of the selected SoCs does not define its clks in its device tree or non dt-boards support is enabled This patch selects AT91_USE_OLD_CLK in all currently supported SoCs. These selects will be removed after clk definitions are properly added in each soc's device tree. It also selects AT91_USE_OLD_CLK in all non-dt boards support. AT91_PMC_UNIT references are replaced by OLD_CLK_AT91, because PMC Unit is enabled for both old and common clk implementations, and old clk implementation should not be compiled if COMMON_CLK is enabled. To avoid future link errors, a new stub is created for at91_dt_clock_init function if OLD_CLK_AT91 is disabled. A new check is added in dt init functions (setup.c) to prepare for SoCs supporting new clk implementation. These SoCs won't setup the register_clocks callback (clk registration is done using of_clk_init). Signed-off-by: Boris BREZILLON <b.brezillon@overkiz.com> Acked-by: Mike Turquette <mturquette@linaro.org> Signed-off-by: Nicolas Ferre <nicolas.ferre@atmel.com>
Diffstat (limited to 'arch/arm/mach-at91')
-rw-r--r--arch/arm/mach-at91/Kconfig21
-rw-r--r--arch/arm/mach-at91/Kconfig.non_dt6
-rw-r--r--arch/arm/mach-at91/Makefile2
-rw-r--r--arch/arm/mach-at91/generic.h3
-rw-r--r--arch/arm/mach-at91/setup.c6
5 files changed, 34 insertions, 4 deletions
diff --git a/arch/arm/mach-at91/Kconfig b/arch/arm/mach-at91/Kconfig
index 699b71e7f7ec..85b53a441459 100644
--- a/arch/arm/mach-at91/Kconfig
+++ b/arch/arm/mach-at91/Kconfig
@@ -6,10 +6,22 @@ config HAVE_AT91_DBGU0
6config HAVE_AT91_DBGU1 6config HAVE_AT91_DBGU1
7 bool 7 bool
8 8
9config AT91_USE_OLD_CLK
10 bool
11
9config AT91_PMC_UNIT 12config AT91_PMC_UNIT
10 bool 13 bool
11 default !ARCH_AT91X40 14 default !ARCH_AT91X40
12 15
16config COMMON_CLK_AT91
17 bool
18 default AT91_PMC_UNIT && USE_OF && !AT91_USE_OLD_CLK
19 select COMMON_CLK
20
21config OLD_CLK_AT91
22 bool
23 default AT91_PMC_UNIT && AT91_USE_OLD_CLK
24
13config AT91_SAM9_ALT_RESET 25config AT91_SAM9_ALT_RESET
14 bool 26 bool
15 default !ARCH_AT91X40 27 default !ARCH_AT91X40
@@ -65,6 +77,7 @@ config SOC_SAMA5D3
65 select SOC_SAMA5 77 select SOC_SAMA5
66 select HAVE_FB_ATMEL 78 select HAVE_FB_ATMEL
67 select HAVE_AT91_DBGU1 79 select HAVE_AT91_DBGU1
80 select AT91_USE_OLD_CLK
68 help 81 help
69 Select this if you are using one of Atmel's SAMA5D3 family SoC. 82 Select this if you are using one of Atmel's SAMA5D3 family SoC.
70 This support covers SAMA5D31, SAMA5D33, SAMA5D34, SAMA5D35. 83 This support covers SAMA5D31, SAMA5D33, SAMA5D34, SAMA5D35.
@@ -78,11 +91,13 @@ config SOC_AT91RM9200
78 select HAVE_AT91_DBGU0 91 select HAVE_AT91_DBGU0
79 select MULTI_IRQ_HANDLER 92 select MULTI_IRQ_HANDLER
80 select SPARSE_IRQ 93 select SPARSE_IRQ
94 select AT91_USE_OLD_CLK
81 95
82config SOC_AT91SAM9260 96config SOC_AT91SAM9260
83 bool "AT91SAM9260, AT91SAM9XE or AT91SAM9G20" 97 bool "AT91SAM9260, AT91SAM9XE or AT91SAM9G20"
84 select HAVE_AT91_DBGU0 98 select HAVE_AT91_DBGU0
85 select SOC_AT91SAM9 99 select SOC_AT91SAM9
100 select AT91_USE_OLD_CLK
86 help 101 help
87 Select this if you are using one of Atmel's AT91SAM9260, AT91SAM9XE 102 Select this if you are using one of Atmel's AT91SAM9260, AT91SAM9XE
88 or AT91SAM9G20 SoC. 103 or AT91SAM9G20 SoC.
@@ -92,6 +107,7 @@ config SOC_AT91SAM9261
92 select HAVE_AT91_DBGU0 107 select HAVE_AT91_DBGU0
93 select HAVE_FB_ATMEL 108 select HAVE_FB_ATMEL
94 select SOC_AT91SAM9 109 select SOC_AT91SAM9
110 select AT91_USE_OLD_CLK
95 help 111 help
96 Select this if you are using one of Atmel's AT91SAM9261 or AT91SAM9G10 SoC. 112 Select this if you are using one of Atmel's AT91SAM9261 or AT91SAM9G10 SoC.
97 113
@@ -100,18 +116,21 @@ config SOC_AT91SAM9263
100 select HAVE_AT91_DBGU1 116 select HAVE_AT91_DBGU1
101 select HAVE_FB_ATMEL 117 select HAVE_FB_ATMEL
102 select SOC_AT91SAM9 118 select SOC_AT91SAM9
119 select AT91_USE_OLD_CLK
103 120
104config SOC_AT91SAM9RL 121config SOC_AT91SAM9RL
105 bool "AT91SAM9RL" 122 bool "AT91SAM9RL"
106 select HAVE_AT91_DBGU0 123 select HAVE_AT91_DBGU0
107 select HAVE_FB_ATMEL 124 select HAVE_FB_ATMEL
108 select SOC_AT91SAM9 125 select SOC_AT91SAM9
126 select AT91_USE_OLD_CLK
109 127
110config SOC_AT91SAM9G45 128config SOC_AT91SAM9G45
111 bool "AT91SAM9G45 or AT91SAM9M10 families" 129 bool "AT91SAM9G45 or AT91SAM9M10 families"
112 select HAVE_AT91_DBGU1 130 select HAVE_AT91_DBGU1
113 select HAVE_FB_ATMEL 131 select HAVE_FB_ATMEL
114 select SOC_AT91SAM9 132 select SOC_AT91SAM9
133 select AT91_USE_OLD_CLK
115 help 134 help
116 Select this if you are using one of Atmel's AT91SAM9G45 family SoC. 135 Select this if you are using one of Atmel's AT91SAM9G45 family SoC.
117 This support covers AT91SAM9G45, AT91SAM9G46, AT91SAM9M10 and AT91SAM9M11. 136 This support covers AT91SAM9G45, AT91SAM9G46, AT91SAM9M10 and AT91SAM9M11.
@@ -121,6 +140,7 @@ config SOC_AT91SAM9X5
121 select HAVE_AT91_DBGU0 140 select HAVE_AT91_DBGU0
122 select HAVE_FB_ATMEL 141 select HAVE_FB_ATMEL
123 select SOC_AT91SAM9 142 select SOC_AT91SAM9
143 select AT91_USE_OLD_CLK
124 help 144 help
125 Select this if you are using one of Atmel's AT91SAM9x5 family SoC. 145 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 146 This means that your SAM9 name finishes with a '5' (except if it is
@@ -133,6 +153,7 @@ config SOC_AT91SAM9N12
133 select HAVE_AT91_DBGU0 153 select HAVE_AT91_DBGU0
134 select HAVE_FB_ATMEL 154 select HAVE_FB_ATMEL
135 select SOC_AT91SAM9 155 select SOC_AT91SAM9
156 select AT91_USE_OLD_CLK
136 help 157 help
137 Select this if you are using Atmel's AT91SAM9N12 SoC. 158 Select this if you are using Atmel's AT91SAM9N12 SoC.
138 159
diff --git a/arch/arm/mach-at91/Kconfig.non_dt b/arch/arm/mach-at91/Kconfig.non_dt
index ca900be144ce..b736b571e882 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"
diff --git a/arch/arm/mach-at91/Makefile b/arch/arm/mach-at91/Makefile
index 90aab2d5a07f..705b38a179ec 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
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/setup.c b/arch/arm/mach-at91/setup.c
index ca542dee087d..7d3f7cc61081 100644
--- a/arch/arm/mach-at91/setup.c
+++ b/arch/arm/mach-at91/setup.c
@@ -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();