diff options
author | Michal Simek <michal.simek@xilinx.com> | 2014-12-11 05:31:30 -0500 |
---|---|---|
committer | Michal Simek <michal.simek@xilinx.com> | 2015-01-29 09:38:17 -0500 |
commit | 3329659df0300d1d0aa22f5e7063f83a88ef92aa (patch) | |
tree | a909ee1f22c7de2d1e3e050d128b555aae262c9f | |
parent | bb9cac24d7c0face942dd4661c1eb6fe2df6b90f (diff) |
ARM: zynq: Simplify SLCR initialization
Based on
"mfd: syscon: Decouple syscon interface from platform devices"
(sha1: bdb0066df96e74a4002125467ebe459feff1ebef)
SLCR driver can use syscon/regmap drivers directly.
Signed-off-by: Michal Simek <michal.simek@xilinx.com>
-rw-r--r-- | arch/arm/mach-zynq/common.c | 2 | ||||
-rw-r--r-- | arch/arm/mach-zynq/slcr.c | 35 |
2 files changed, 7 insertions, 30 deletions
diff --git a/arch/arm/mach-zynq/common.c b/arch/arm/mach-zynq/common.c index 26f92c28d22b..c887196cfdbe 100644 --- a/arch/arm/mach-zynq/common.c +++ b/arch/arm/mach-zynq/common.c | |||
@@ -146,8 +146,6 @@ out: | |||
146 | 146 | ||
147 | platform_device_register(&zynq_cpuidle_device); | 147 | platform_device_register(&zynq_cpuidle_device); |
148 | platform_device_register_full(&devinfo); | 148 | platform_device_register_full(&devinfo); |
149 | |||
150 | zynq_slcr_init(); | ||
151 | } | 149 | } |
152 | 150 | ||
153 | static void __init zynq_timer_init(void) | 151 | static void __init zynq_timer_init(void) |
diff --git a/arch/arm/mach-zynq/slcr.c b/arch/arm/mach-zynq/slcr.c index d4cb50cf97c0..c3c24fd8b306 100644 --- a/arch/arm/mach-zynq/slcr.c +++ b/arch/arm/mach-zynq/slcr.c | |||
@@ -47,11 +47,6 @@ static struct regmap *zynq_slcr_regmap; | |||
47 | */ | 47 | */ |
48 | static int zynq_slcr_write(u32 val, u32 offset) | 48 | static int zynq_slcr_write(u32 val, u32 offset) |
49 | { | 49 | { |
50 | if (!zynq_slcr_regmap) { | ||
51 | writel(val, zynq_slcr_base + offset); | ||
52 | return 0; | ||
53 | } | ||
54 | |||
55 | return regmap_write(zynq_slcr_regmap, offset, val); | 50 | return regmap_write(zynq_slcr_regmap, offset, val); |
56 | } | 51 | } |
57 | 52 | ||
@@ -65,12 +60,7 @@ static int zynq_slcr_write(u32 val, u32 offset) | |||
65 | */ | 60 | */ |
66 | static int zynq_slcr_read(u32 *val, u32 offset) | 61 | static int zynq_slcr_read(u32 *val, u32 offset) |
67 | { | 62 | { |
68 | if (zynq_slcr_regmap) | 63 | return regmap_read(zynq_slcr_regmap, offset, val); |
69 | return regmap_read(zynq_slcr_regmap, offset, val); | ||
70 | |||
71 | *val = readl(zynq_slcr_base + offset); | ||
72 | |||
73 | return 0; | ||
74 | } | 64 | } |
75 | 65 | ||
76 | /** | 66 | /** |
@@ -196,23 +186,6 @@ void zynq_slcr_cpu_state_write(int cpu, bool die) | |||
196 | } | 186 | } |
197 | 187 | ||
198 | /** | 188 | /** |
199 | * zynq_slcr_init - Regular slcr driver init | ||
200 | * Return: 0 on success, negative errno otherwise. | ||
201 | * | ||
202 | * Called early during boot from platform code to remap SLCR area. | ||
203 | */ | ||
204 | int __init zynq_slcr_init(void) | ||
205 | { | ||
206 | zynq_slcr_regmap = syscon_regmap_lookup_by_compatible("xlnx,zynq-slcr"); | ||
207 | if (IS_ERR(zynq_slcr_regmap)) { | ||
208 | pr_err("%s: failed to find zynq-slcr\n", __func__); | ||
209 | return -ENODEV; | ||
210 | } | ||
211 | |||
212 | return 0; | ||
213 | } | ||
214 | |||
215 | /** | ||
216 | * zynq_early_slcr_init - Early slcr init function | 189 | * zynq_early_slcr_init - Early slcr init function |
217 | * | 190 | * |
218 | * Return: 0 on success, negative errno otherwise. | 191 | * Return: 0 on success, negative errno otherwise. |
@@ -237,6 +210,12 @@ int __init zynq_early_slcr_init(void) | |||
237 | 210 | ||
238 | np->data = (__force void *)zynq_slcr_base; | 211 | np->data = (__force void *)zynq_slcr_base; |
239 | 212 | ||
213 | zynq_slcr_regmap = syscon_regmap_lookup_by_compatible("xlnx,zynq-slcr"); | ||
214 | if (IS_ERR(zynq_slcr_regmap)) { | ||
215 | pr_err("%s: failed to find zynq-slcr\n", __func__); | ||
216 | return -ENODEV; | ||
217 | } | ||
218 | |||
240 | /* unlock the SLCR so that registers can be changed */ | 219 | /* unlock the SLCR so that registers can be changed */ |
241 | zynq_slcr_unlock(); | 220 | zynq_slcr_unlock(); |
242 | 221 | ||