aboutsummaryrefslogtreecommitdiffstats
path: root/arch/arm/mach-zynq/slcr.c
diff options
context:
space:
mode:
Diffstat (limited to 'arch/arm/mach-zynq/slcr.c')
-rw-r--r--arch/arm/mach-zynq/slcr.c35
1 files changed, 7 insertions, 28 deletions
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 */
48static int zynq_slcr_write(u32 val, u32 offset) 48static 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 */
66static int zynq_slcr_read(u32 *val, u32 offset) 61static 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 */
204int __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